Many improvements that were in the raycast-physics branch, backported since that branch is probably dead, and if I ever revive it then it will be with a new approach. Many are sourced from PRBoom +ZDoom + Eternity Engine.
- Some line / divline comparison functions use const.
- P_PointOnLineSide and P_BoxOnLineSize use PrBoom's version.
- P_InterceptVector is more resistant to overflow.
- PIT_AddThingIntercepts checks against actual bounding box, instead of a corner-to-corner cross-section.
- P_TraverseIntercepts doesn't run the callback function on NULL intercepts.
- P_PathTraverse handles traces that go through blockmap corners properly.
- Removed unused earlyout flag to simplify logic.
- Added g_ prefix to trace.
Before
- Each time / once only activates when the mobj's sector
changes
- The activation may depend on the mobj touching the floor
- If the mobj is in the air when the sector changes, the
action will never be activated
After
- Each time / once actions that require floor touching
also activate every time the mobj lands on the ground
from the air (regardless of whether the sector changed)
P_LineOpening results are stored in a locally made struct instead of being a bunch of disorganized globals.
Waypoint traversals can go thru 1 line, if it was blocked by step-up rules, for free, similar concept to sound-blocking lines in Doom.
Found while working on bot changes to respect step-up, lowfloor would occasionally be the floor below instead of the FOF. Also code cleanup to remove redundant / unused stuff.
There can be very many precipmobjs in a sector. During BSP
rendering, for each sector reached by BSP (the entire
visible level at least), all the precipmobjs would be
iterated and their distance from the camera calculated, to
determine whether they are within draw distance.
The issue with the old approach is that there really are
too many precipmobjs in each sector. By iterating the
blockmap within a certain range instead, precipmobjs
out of view are not iterated at all, saving some time.
Caveat: drawdist_precip is no longer respected as an
exact value, since it must round to the precision of the
blockmap.
List of potentially scary changes:
- Removes snext/sprev for precipmobj_t
- Removes preciplist for sector_t
- Adds bnext/bprev for precipmobj_t
- mobj_t and precipmobj_t field offsets are symmetrical
- Modified P_SetPrecipitationThingPosition and P_SetThingPosition
- The syntax in these functions is kind of wacky
This makes it significantly easier to save/restore the state of these variables, whenever we need to do so for calling movement functions in the middle of other movement functions. This will also make it easier to move it out of global variable hell if desired later.
Water skipping is enabled for Orbinaut, Jawz, and Ballhog currently. Jawz can water run, as long as their target is on/above the plane they're at -- once their target goes into the water, they'll start skipping.
An optimized error check was put into P_BlockThingsIterator for tmthing, but this meant that anything that was not using or even setting this variable (the supermajority of them) would exit after finding 1 thing in each block.
To keep this error check & keep it optimized, the PIT_ functions were expanded to three options instead of two: BMIT_CONTINUE lets the search continue. If used as the last mobj, it will return true when the iterator finishes. BMIT_ABORT ends the search and forces the iterator to return false.
BMIT_STOP ends the search and forces the iterator to return true.
You can run on water in any case where you would have
slope resistance AND your speed is over 100%. You may run
on water regardless if you're speed is above 200%.
Set a sidedef's midtexture to "TRIPWIRE" to turn that line
into a tripwire.
Players can't drive through a tripwire and will bounce
back at high speed if they're in one of the following
states:
1. Invincibility / Grow
2. Sneakers
3. Flame Shield dash
4. >200% on the speedometer
Hitting a tripwire plays a sound, sends you into hitlag,
then plays another sound when the hitlag is over. The
sounds used depend on whether you can drive through the
tripwire.
See notably the finish line. Basically respawning exactly on a line can let you
cross it twice, if you crossed it before respawning, or NOT cross it, depending
on which direction you drive after landing. So this just respawns very slightly
before the line so you can cross (or not cross) it normally.
Not convinced that the small speed benefit from P_AproxDistance is worth the "aproximate"[sic] results it gives. Let's instead try a define to replace it with FixedHypot. In Lua, the function gives a deprecated warning.
Inspired by the hyperwall fix for vanilla, except for everything. From little testing, actively improves waypoint checks, bumping, speed checks, wall collisions, Jawz targetting, Lightning Shield attacks, so on.
The only way I see this as a potential downgrade is A_Look (and related functions) getting slower, which are barely used in Kart.
This should fix the janky falling off steep slopes and let you cling to them.
Because when falling off a sector the edge of the player must not intersect
the edge of the higher sector, it is trickier than step up. The height
difference at the line must be stored to be useful.
This is for slopes. When moving across a slope the height changes. Therefore
compare the height at the edge where slopes meet so only a wall will block the
player, and not a very steep slope.