CleverRaven/Cataclysm-DDA — pull request #6951 by kevingranade (2014-03-27 08:41:02+00:00)
Title: [VERY WIP] Portals

Has a lot of rough edges, unimplemented bits, bugs, and a memory leak you could drive a killdozer through.
I thought people might want to play with it though. Once I sort out what I need to do, I'm probably completely obliterating those last two commits.
That aside, what's it do?
It hooks into the field of view calculation code, when it detects a portal in a scan, it casts a special "portal" type shadow instead of a normal shadow. A later hack into the map draw code checks for this special shadow and substitutes content from a special "foreign" map instead of from the regular map.
pic $= words * 1000
http://polehammer.com/azmodean/holy_crap_portals.png
As you can see, it renders a different map where you'd expect the shadow for the portal to be.
TODO:
Fix the shadowcasting bug that makes the shadow too wide.
Close the gigantic memory leak, we leak a map every tick that a portal is visible.
Generate and substitute in the lightmap from the foreign map where appropriate.
Maybe cast light through the portals.
Render monsters, npcs from foreign map.
Maybe allow firing through portals.
Maybe implement monster vision/hearing (definitely NOT scent) through portals.
Implement teleporting to the destination of the portal.
Place portals somewhere in the world.
Maybe hook it up to the portal generator item.
Make baddies pop out of portals?
Fix bug where portal destination is always drawn from the current overmap layer.
Make the portal appear at a random offset relative to the current location rather than a random position on the current overmap.
Fix the bug where rendering intermittently flashes on and off.
More I've forgotten about, TODOs are sprinkled throughout the code.