Commit Graph

22 Commits

Author SHA1 Message Date
Christoph Oelckers 07771bd56e - changed parameter of P_GetOffsetPosition to a simple coordinate so that it can be used for other things than actors. 2016-02-29 16:29:51 +01:00
Christoph Oelckers 60c2a55ec4 - added P_GetOffsetPosition calls to all needed functions. 2016-02-26 11:52:53 +01:00
Christoph Oelckers d46e109a5b - prevent Visual C++ from making stupid code. 2016-02-26 11:52:52 +01:00
Christoph Oelckers eafd2519b4 - fixed a few incorrect uses of AngleTo function.
- added portal offsetting to all AproxDistance, AngleTo and Vec*To members of AActor.
- optimized displacement retrieval so that the most common case with no offset retrieves a constant null-vector which can be optimized away fully by the compiler.
- early out in P_GetOffsetPosition if there's no portal lines nearby, so that the common case can skip the traverser completely even on maps with line portals.
2016-02-26 11:52:50 +01:00
Christoph Oelckers c7bce8b346 - added a special portal blockmap. This only contains all lines which have a crossable line portal assigned. This is to speed up offset calculations because those are quite frequent and would be too inefficient with the full blockmap.
- made some minor changes to FPathTraverse so that the Add*Intercepts methods can be virtually overridden.
- removed the PortalTracer class because in its existing form it was too costly. Replaced with a P_GetOffsetPosition function that does the minimum required work to get to the translated destination and that's better suited for being called from the Vec*Offset methods. Other use cases will require some changes to FPathTraverse anyway, or some wrapping class like the FMultiBlock iterators.
2016-02-25 13:00:23 +01:00
Christoph Oelckers dc37f78566 - fixed: Old portal data must be deleted before loading a new level. 2016-02-20 02:22:09 +01:00
Christoph Oelckers cb0e7c6ca5 - fixed some issues with P_FindFloorCeiling rework. 2016-02-20 02:22:08 +01:00
Christoph Oelckers 02d7572343 - some header dependency cleanup so that it is no longer needed to include portal.h to get the inline functions. Portal.h has been reduced of most dependencies now so that including it is cheap and can be done in other headers.
- some consolidation in p_map.cpp. PIT_CheckLine and PIT_FindFloorCeiling had quite a bit of redundancy which has been merged.
- Ĩontinued work on FMultiBlockLinesIterator. It's still not completely finished.
2016-02-19 14:08:41 +01:00
Christoph Oelckers 3841a5f626 - implemented FMultiBlockLinesIterator for checking a position across portals. This is not fully tested yet. 2016-02-19 10:39:40 +01:00
Christoph Oelckers 8d53f6176e - fixed conditions for PortalBlocksView. Created a new function PortalBlocksSight that's relevant for playsim-related sight checks. 2016-02-16 22:57:03 +01:00
Christoph Oelckers 1b88052bba - started refactoring ZatPoint calls which need to be portal aware.
To summarize, anything that just works with map geometry doesn't need to bother, as does the renderer. (i.e. nearly all r_* files, p_floor.cpp, p_ceiling.cpp et.al)
But all calls that are somehow related to actor positions need to be made aware of potential portal transitions:

 * added FloorAtPoint, CeilingAtPoint and PlaneAtPoint methods to sector_t, which can be used to calculate a plane's height with relation to a given actor, even if that actor is on the other side of a portal.
 * added HighestCeilingAt and LowestFloorAt methods which traverse all ceiling/floor portals until they find an impassable plane.
2016-02-16 16:40:53 +01:00
Christoph Oelckers 22e8678903 - refactored P_CollectConnectedGroups to avoid frequent heap allocations for the common cases
* the temporary checking arrays are now static
 * the array that gets the returned values only starts allocating memory when the third touched sector group is found. The most common cases (no touched portal and one touched portal) can be handled without accessing the heap.

- did some streamlining of AActor::LinkToSector:

 * there's only now version of this function that can handle everything
 * moved the FIXMAPTHINGPOS stuff into a separate function.
 * removed LinkToWorldForMapThing and put all special handling this function did into P_PointInSectorBuggy.
2016-02-16 12:51:10 +01:00
Christoph Oelckers f24bf7e622 - separated FCheckPosition and its FPortalGroupTable substructure into its own header because this was creating too many dependencies on other headers with FCheckPosition in p_local.h and FPortalGroupTable in portals.h. 2016-02-15 13:40:31 +01:00
Christoph Oelckers 405db83393 - added a function which collects all portal group an actor would touch if standing in a given position. 2016-02-15 00:53:59 +01:00
Christoph Oelckers c338b9cde3 - some more portal preparation . 2016-02-14 16:26:27 +01:00
Christoph Oelckers d5a1004c41 - some preparations for portal stuff:
* set up linked sector portals so that everything that will eventually have to be considered is present, even though the software renderer currently can't handle those adequately.
* tag all skybox things with a type so that they can easily be distinguished at run time.
* fill in the linked portal types in xlat/eternity.txt.
2016-02-14 13:12:03 +01:00
Christoph Oelckers 77b9f41dff - added Line_SetPortalTarget action special so that portals can be assigned new targets. Setting the target to 0 disables the portal.cpp. Static linked portals can not be reassigned.
Please note that these still require the portal to be set up in the map with Line_SetPortal. It will not create a new portal if none exists on any line with the given ID.
2016-02-06 21:16:57 +01:00
Christoph Oelckers 94b7ef72ca - more cleanup on portal implementation:
- store portal data in a separate structure.
- store portal data in savegames because some of this will be changeable later.
- run a cleanup pass after all portals have been created to weed out broken ones.
- add a definition type that's compatible with Eternity Engine's line portal types.
- swapped arg[2] and arg[3] of Line_SetPortal, because the type is more significant than the alignment.
2016-02-05 23:15:56 +01:00
Christoph Oelckers 9eaefc3685 - initialize portals with all other static line specials instead of doing it separately in P_FinishLoadingLineDefs when the map isn't fully set up yet.
- replace all float use in portal.cpp with doubles.
2016-02-05 16:58:57 +01:00
Christoph Oelckers 00895c245e - mpved all software renderer specific code for the portals into the render sources. 2016-02-05 15:39:06 +01:00
ZZYZX 4d518a220c Fixed skybox clipping: lines in a skybox shouldn't be clipped against current portal 2016-01-10 05:22:33 +02:00
ZZYZX 31cad858d9 Fixed odd merge bugs 2015-06-07 20:54:36 +03:00