Commit Graph

79 Commits

Author SHA1 Message Date
Christoph Oelckers 90cad80422 - fixed some issues with FPathTraverse:
* when starting directly on a blockline the trace was offset by one map unit. Do this only for the internal block trace calculations but not for the variable that's being exposed to the outside because in rare situations that can create incorrect values.
 * using startfrac could lead to an actor whose inside was right at that positon to be missed.
 * when using startfrac the adjusted trace start was not used for all calculations, which could cause the trace to fail.

With these issues fixed, P_AimLineAttack can now successfully navigate line portals.
2016-03-03 02:50:48 +01:00
Christoph Oelckers 4b23a1c0c7 - added handling for line portals to P_AimLineAttack. 2016-03-03 02:50:45 +01:00
Christoph Oelckers f5fd0df077 - made P_AimLineAttack work through sector portals.
Note: Test output not removed yet!
2016-03-02 20:44:02 +01:00
Randy Heit 55142078d8 Normalize line endings 2016-03-01 09:47:10 -06:00
Christoph Oelckers 15b6c11748 - did some cleanup on FPathTraverse::PortalRelocate. 2016-03-01 02:06:31 +01:00
Christoph Oelckers 5e7ecb3c44 - hm. I thouggr thia has been saved before committing. 2016-03-01 01:53:09 +01:00
Christoph Oelckers 2584108200 - removed the one-sided line portals on polyobjects only limitation. Using Eternity's polyportal testmap shows that it expects one-sided crossable portals on non-polyobject walls.
- converted the P_TranslatePortal* functions to use floating point trigonometry. The combination of R_PointToAngle and finesine even created discrepancies with perfectly parallel portals which is just not acceptable.
- added a function to FPathTraverse to relocate the trace and restart from the new position.
- made P_UseLines portal aware. Traversal through line portals is complete (all types, even teleporters), whether sector portals need better treatment remains to be seen - at the moment it only checks the range at the player's vertical center.
2016-03-01 01:36:36 +01:00
Christoph Oelckers e9fa53c54d - fixed dropoff calculation over portals.
It can easily happen that the lower sector has no lines below the checked area, in which case it would not set the dropoffz correctly. To prevent this, P_LineOpening must, when it checks the opening over a sector portal, actually calculate the dropoff to the lower portal itself by calling sector_t::NextLowestPointAt. It also means that FindRefPoint must calculate a proper reference point when one side of the line to be checked is part of a floor portal.
2016-02-28 13:59:15 +01:00
Christoph Oelckers a9ca53bc00 - added a check for the destination of a portal to P_CheckPosition. This needs to run a separate BlockLinesIterator that only sets selected fields. 2016-02-27 23:35:13 +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 a9db998700 - did some refactoring on FPathTraverse to allow inheriting from that class with different collection functions.
This will be needed to implement an efficient portal checker that doesn't run through the entire blockmap to find the portals.
2016-02-25 09:54:09 +01:00
Christoph Oelckers e11da06e69 - some preparations for actor interpolation through wall portals. 2016-02-25 00:41:31 +01:00
Christoph Oelckers ed2b107bc9 - fixed: P_LineOpening_XFloors set some floor-related info in the ceiling case so that it never reached the point where it is needed.
- fixed: FMultiBlockLinesIterator/FMultiBlockThingsIterator need to treat radius=-1 as 'use default from actor.'
2016-02-22 15:51:18 +01:00
Christoph Oelckers 730145d1fc - more transition to FMultiBlock* iterators:
* removed all code for dealing with z-displacing portals in the iterator loops. This would cause too many problems so I decided to scrap any provisions for allowing interactive portals with z-displacement. They will remain restricted to pure teleporter portals.
 * changed spechit to carry a position along with the special line. If something is activated through an interactive portal this is needed to calculate movement.
 * pass the abovementioned position to CheckForPushSpecial.
 * collect touched portal lines in a second array analogous to spechit.
 * use FMultiBlockThingsIterator in P_TestMobjZ.
2016-02-22 12:05:38 +01:00
Christoph Oelckers 98c7fabb89 - untested partial refactoring of P_CheckPosition.
(This is just a safety commit before doing some more extensive behind-the-scenes refactoring.)

Notable changes here:

 * use the same logic for determining whether a 3D floor is 'below' or 'above' the actor as all the other functions.
 * removed the broken code which tried to detect whether an actor was touching a steep slope. Better use P_LineOpening to find the correct planes and store the results.
 * improved detection whether the slopes on both sides of a plane are identical, using the same data as for steep slope detection.
2016-02-22 12:05:37 +01:00
Christoph Oelckers abcc6049b9 - made the z coordinate part of the CheckResults for the MultiBlock iterators and use these for all height checks in the iterator loops. This will later make it easier to support arbitrary portals with height displacements. 2016-02-22 12:05:36 +01:00
Christoph Oelckers 58fcd8d742 - implemented the FMultiBlockThingsIterator and converted P_TeleportMove to use it. 2016-02-21 00:21:41 +01:00
Christoph Oelckers cfbb3bcbb2 - completed work on P_FindFloorCeiling and all functions it calls.
Note: The debug output is left in so that in cases of an error it can still be used.
2016-02-20 02:22:10 +01:00
Christoph Oelckers 28799c4b51 - some logic fixes in FMultiBlockLinesIterator. 2016-02-19 16:13:36 +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 884a265d4a - refactored P_FindFloorCeiling to be portal aware and cleaned up its interface.
A big problem with this function was that some flags required setting up some variables before calling it and others did not. It will now set everything up itself so all initializations to AActor::floorz and ceilingz that were made before these calls (which were all identical to begin with) could be removed and the internal initialization logic streamlined.
2016-02-17 21:57:52 +01:00
Christoph Oelckers 0948448988 - some more checking and refactoring of ZatPoint calls.
- removed Plane/Floor/CeilingAtPoint functions because they are overkill for the problem they were meant to solve. Calling ZatPoint with adjusted coordinates created with AActor::PosRelative is just as easy in the few places where this is needed.
- made P_HitWater and P_CheckSplash portal aware.
2016-02-17 02:21:26 +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 6adb069506 - rewrote p_local.h so that it doesn't pull in the entire bunch of headers.
This was to resolve some circular dependencies with the portal code.
The most notable changees:

 * FTextureID was moved from textures.h to doomtype.h because it is frequently needed in files that don't want to do anything with actual textures.
 * split off the parts from p_maputl into a separate header.
 * consolidated all blockmap related data into p_blockmap.h
 * split off the polyobject parts into po_man.h
2016-02-15 02:14:34 +01:00
Christoph Oelckers 158caf78a0 - more float to double conversion.
In particular this removes all assignments of FIXED2FLOAT to double variables because they not only lose precision but also generate unnecessary code.
2016-02-11 21:33:30 +01:00
Christoph Oelckers 4d8070927d - p_maputl.cpp done. 2016-01-20 14:04:47 +01:00
Christoph Oelckers 35271187a5 - took care of the rest of p_map.cpp. 2016-01-20 13:48:05 +01:00
Christoph Oelckers c611456397 - more refactoring of AActor coordinate access. 2016-01-17 18:36:14 +01:00
alexey.lysiuk afed5e62eb Fixed intercept check in FPathTraverse
Because frac variable has fixed_t type it must be compared with fixed one
Test case: try to break stained glass windows or open door at the beginning of Hexen's MAP01
2016-01-16 13:22:27 +02:00
Christoph Oelckers 90e2dc5f5a - some minor optimizations to FPathTraverse:
* since we can trivially decide whether a line crosses the trace behind the end point from checking the return value of P_InterceptVector, there is no need to add those to the list of intercepts as they get discarded anyway in t
* maxfrac is always FRACUNIT so there's no need to waste some variable for a constant value.
2016-01-15 16:40:50 +01:00
Christoph Oelckers 867b7767ef - ignore COMPAT_POINTONSIDE in a few places where the side effects of the old P_PointOn*Side functions are either not needed or problematic:
* the sight checking code needs to be as precise as possible and should not depend on some old semi-broken routines. (This is more a precision issue of these routines - P_PointOnDivlineSide removes the lower 8 bits of each value - than having an issue with returning the wrong side in some cases.)
 * for slope creations it is flat out wrong to use the old routines at all.
 * also ignore this in the modern (box-shaped) case of FPathTraverse::AddLineIntercepts. This functionality is new to ZDoom and therefore not subject to compatibility concerns.
 * the line-to-line teleporter. It seems the hideous fudging code was just there to work around the design issues of these functions, so let's better not ever call them here in the first place.
 * A_PainShootSkull: Its usage here does not depend on these issues.
 * P_ExplodeMissile: New code exclusive to ZDoom.
 * FPolyObj::CheckMobjBlocking

All occurences in p_map.cpp have been left alone although most of them probably won't need the compatibility option either.
2016-01-15 12:56:27 +01:00
Christoph Oelckers 71c7f2b42c - added 'floorterrain' and 'ceilingterrain' sector properties for UDMF. These will take precedence over texture based terrain if used.
'ceilingterrain' is needed because the top of 3D-floors refers to the model sector's ceiling, so in order to give a 3D floor a terrain it must be assignable to the sector's ceiling.
Note that although it is basically the same property, its actual function bears no relevance to its use in Eternity.
2016-01-09 12:10:36 +01:00
alexey.lysiuk 39b18a3447 Improved point-on-line compatibility feature
P_PointOnLineSide() and P_PointOnDivlineSide() functions from the initial Doom source code release are used in compatibility mode
2015-09-15 18:21:05 +03:00
Christoph Oelckers f482dc094d fixed: R_PointOnSideSlow had precision issues with very short lines.
When this function was originally written there was no possibility of fractional vertex coordinates so it threw away the fractional parts of the node's directional vector (which in the original nodes was always 0.)
Now, with UDMF and high precision vertices this no longer works and the loss of significant parts of their value caused this code to produce erroneous results if the linedefs were only a few map units long and using fractional positions.
2014-08-11 12:27:04 +02:00
Randy Heit 5b86ce9f7d - If A_SeekerMissile is used with the SMF_LOOK flag and its targets is unseekable, it now clears
its tracer so that it will look for a new target the next time it is called.
- Extended P_RoughMonsterSearch() with a flag to indicate that it should only search for seekable
  targets.

SVN r3572 (trunk)
2012-04-19 03:22:06 +00:00
Randy Heit 280ca05554 - In P_SpawnMapThing(), pass the same flags to P_FindFloorCeiling() as the respawn functions do.
- Rename FFCF_3DMIDTEXRESTRICT to FF_3DRESTRICT and make it work with 3D floors too.

SVN r3562 (trunk)
2012-04-14 03:55:46 +00:00
Randy Heit da21075480 - Fixed: The onlyspawnpos handling in P_FindFloorCeiling would fail to adjust an actor's floorz
(and related) to a 3D midtex beneath its Z if it also touched a 3D midtex above its Z.

SVN r3548 (trunk)
2012-04-10 03:18:04 +00:00
Randy Heit 837126ae57 - Fixed: Do not interpolate from an actor's despawned position to its spawned position when it
respawns.
- Use doubles instead of floats, as appropriate, in PIT_FindFloorCeiling().
- Fixed: The second call to P_FindFloorCeiling() in A_RestoreSpecialPosition and P_NightmareRespawn()
  must only consider 3D floors and midtexes.

SVN r3545 (trunk)
2012-04-08 21:12:14 +00:00
Randy Heit d0bba7c3c3 - Added another flag to P_FindFloorCeiling() to get it to do its standard processing but
without resetting the actor's sector. The 3D floor checks in P_NightmareRespawn() and
  A_RestoreSpecialPosition now use this.
- Fixed: P_NightmareRespawn() did its Z clamping before checking for 3D floors.
- Fixed: Respawning actors were not clamped to the ceiling.

SVN r3542 (trunk)
2012-04-08 05:39:46 +00:00
Randy Heit c445f684fc - Fixed: In P_LineOpening_3dMidtex(), set the floorpic or ceilingpic to the 3D midtex if it
alters the opening. This fixes things such as removing a projectile when it hits a 3D midtex
  instead of exploding it because the real floor or ceiling is sky.

SVN r3490 (trunk)
2012-03-29 05:09:56 +00:00
Randy Heit b2abe9d11e - Use 64-bit coordinates for a few spots in the FPathTraverse constructor and P_SightPathTraverse().
- Allow FTraceInfo::TrlaceTraverse to pass the endpoints to FPathTraverse as deltas instead of
  as absolute coordinates.

SVN r3487 (trunk)
2012-03-28 04:20:23 +00:00
Randy Heit cfd5b84535 - Replace >>MAPBLOCKSHIFT with GetSafeBlockX/GetSafeBlockY from Mocha Doom.
SVN r3486 (trunk)
2012-03-28 03:49:38 +00:00
Christoph Oelckers 080e769c76 - removed all asserts from the interpolation objects' Destroy methods. The condition will not be true after a failed savegame write occured.
- fixed: D_ErrorCleanup must clear 'savegamerestore'.
- fixed: Cleaning up when loading a savegame failed while restoring the thinker list did not work. There were two issues:
  * removed the asserts in GC::SweepList because they get triggered by thinkers that were not fully initialized during loading.
  * AActor::UnlinkFromWorld may not assume that the sector list has been initialized when this function is called. 

SVN r3274 (trunk)
2011-07-15 13:26:36 +00:00
Christoph Oelckers d8ea5cdad9 - fixed: BlockLinesIterator::Next could get stuck in rare situations where validcount was altered while the iterator was still running. This should probably be dealt with by using another marking method but at least this prevents the engine from freezing.
SVN r3268 (trunk)
2011-07-07 22:09:09 +00:00
Christoph Oelckers 622d1ebe6a - fixed: Spawning things abuve a 3D midtexture did not provess the 'is above midtexture' state properly.
- fixed: When teleporting an actor the destination must be checked with the new z position, not the old one.


SVN r3111 (trunk)
2011-01-20 11:40:05 +00:00
Christoph Oelckers 9a4abe0915 - merged automap branch into trunk.
SVN r2609 (trunk)
2010-08-27 15:20:05 +00:00
Christoph Oelckers 4ac64b6df7 - merged polyobject branch into trunk and made some adjustments for savegame compatibility.
SVN r2448 (trunk)
2010-07-23 05:56:25 +00:00
Christoph Oelckers 853b8f8963 - did some profiling of P_InterceptVector. Here's the results I got:
* the unaltered floating point version is 10% faster than the 64 bit integer version.
  * using doubles instead of floats increases performance by another 25%.
  * another 15% can be gained by manually optimizing the code.
- P_InterceptVector now uses the optimized floating point version which is almost twice as fast as the 64bit integer version.

SVN r2395 (trunk)
2010-06-30 15:20:18 +00:00
Christoph Oelckers 6c4d070095 - restored original Doom behavior for hitscans to only check actors which have their center in the blockmap cells being checked, compatibility optioned by COMPATF_HITSCAN.
SVN r2341 (trunk)
2010-05-28 21:07:45 +00:00