Commit Graph

93 Commits

Author SHA1 Message Date
Christoph Oelckers c830801da3 - g_hexen almost done except for 3 things that require more extensive changes. 2016-03-21 22:20:10 +01:00
Christoph Oelckers 7ebb96f15c - use one of the new floating point special variables to store the portal plane height of the skybox things. 2016-03-21 00:05:44 +01:00
Christoph Oelckers 0bdb65c477 - made AActor::radius a double.
This means that all files in g_doom are now fully converted.
2016-03-20 15:04:13 +01:00
Christoph Oelckers 51b05d331d - replaced AActor::vel and player_t::Vel with a floating point version.
- Converted P_MovePlayer and all associated variables to floating point because this wasn't working well with a mixture between float and fixed.

Like the angle commit this has just been patched up to compile, the bulk of work is yet to be done.
2016-03-20 00:54:18 +01:00
Christoph Oelckers c64eee5b15 Merge branch 'master' into float
# Conflicts:
#	src/g_heretic/a_hereticweaps.cpp
#	src/p_map.cpp
#	src/p_mobj.cpp
#	src/p_things.cpp
#	src/portal.cpp
2016-03-15 00:16:13 +01:00
Christoph Oelckers 448e66f19b - fixed: P_PointInSectorBuggy must handle the single-subsector special case. 2016-03-13 16:57:02 +01:00
Christoph Oelckers b73d6e42af - fixed: FMultiBlockLinesIterator must reset the current sector when doing the final up and downwards check from the start position. 2016-03-13 02:31:47 +01:00
Christoph Oelckers 161d03231a - added custom math routines for reliability. 2016-03-11 15:45:47 +01:00
Christoph Oelckers 3d367d585d - did some profiling which revealed that P_PointInSector was called needlessly often. Did some optimization to the MultiBlock iterators to avoid this problem. 2016-03-10 14:22:18 +01:00
Christoph Oelckers 0a1e22aa7a - fixed: FPathTraverse::init kills the intercepts array so PortalRelocate needs to store the line before calling that function. 2016-03-08 18:45:52 +01:00
Christoph Oelckers 899389e6a4 - link actors into blockmap through linked line portals.
Links through sector portals are not done because nearly all the checks can be performed without doing this so if it works without there's no need to add more processing time.
Will have to see if there's cases left where such a link is needed and if so, whether there's better options to do it.

For line portals such links are necessary to have proper collision detection with actors that are currently transitioning the portal.
2016-03-08 14:41:37 +01:00
Christoph Oelckers 3c25b2c066 - some redesign of P_CheckSight to handle portals.
Portal stuff not tested yet.
2016-03-07 21:59:32 +01:00
Christoph Oelckers c455c60480 - fixed: calculating open.range requires signed math.
- fixed: FMultiBlockLinesIterator initialized continueup twice but forgot continuedown.
- fixed: One of the debug messages in P_AimLineAttack was missing an if (aimdebug).
2016-03-05 01:23:27 +01:00
Christoph Oelckers 14a0567343 - optimized the portal translation functions by precalculating the rotation angle, sine and cosine. 2016-03-03 11:58:04 +01:00
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