Skip to content

Draft: "Bouncy NiGHTS" - General NiGHTS tweaks

Zwip-Zwap Zapony requested to merge Zwip-Zwap_Zapony/SRB2:bouncy-nights into next

This merge request fixes/changes lots of things about how NiGHTS mode handles, hopefully leading to a more expected and "defined" experience.
I'm submitting it as a draft, as I don't know how to accomplish the rest:


General:

  • When drilling/boosting, you can now angle yourself left/right without having to also press up/down
  • When at a standstill, landing on the ground now sets your flight angle along the ground, instead of keeping the angle that you last flew at (Continuing to fly before landing on the ground still uses your old flight angle)
  • When pressing in the opposite direction of your flight angle (e.g. left while flying right), you now always curve upwards (or downwards in reverse gravity) instead of just counter-clockwise, making U-turns more predictable (If you go up while flying down or vice-versa, you curve forwards) - This comes at the cost of repeated U-turns slowly elevating you rather than keeping you around the same position
  • Flying diagonally down-right now uses a flight angle of 315 instead of 314 (This is a hack, to compensate for player->sidemove and player->forwardmove being +35,-36 when pressing down-right, which yields an angle of 314)
  • When braking and falling, the falling speed is now affected by gravity, and accelerates a little rather than instantly being 100% fall speed
  • TODO You can now land on top of goop, which is especially important now that you no longer just fall through goop
  • TODO Once !1514 (closed) is merged, use player->mo->pitch instead of player->mo->rollangle, so that the player angle looks correct regardless of viewing direction (Only relevant in multiplayer or with ghosts)
  • TODO Increment DEMOVERSION, and check for older demo versions to use the old code in P_NiGHTSMovement(), P_XYMovement(), and P_PlayerZMovement() when watching replays

(I'd also have liked to change player->flyangle from an INT32 of 0-359 into an angle_t of 0-ANGLE_MAX, but that'd break any existing Lua scripts that play with NiGHTS mode.)


Bouncing/Slopes:

  • Bouncing off walls now "reflects" you appropriately, rather than snapping you to diagonal 45-degree angles
  • Bouncing off floors/ceilings now "reflects" you appropriately and takes slopes into account, rather than incrementing your angle by 90 degrees - TODO Make it reliably collide with sloped ceilings; it currently only collides with/bounces off the ceiling when the flight angle is 1 to 179, which isn't good enough when slopes are involved
  • TODO Flying horizontally when on an upwards slope now makes you bounce off it, and flying horizontally when on a downwards slope now makes you fly straight through the air, instead of "riding" up/down the slope


Reverse gravity:

  • When in reverse gravity, the player sprite angle is no longer mismatched with the flight angle
  • When in reverse gravity, the up/down movement is no longer flipped (Though this might have been intentional, to make reverse gravity harder to control?)
  • When in reverse gravity, coming to a standstill now makes you fall up instead of down
  • TODO Once all bouncing things are done, make sure that everything related works correctly in reverse gravity too


Technical:

  • Optimized angledif2 out of P_NiGHTSMovement() (technically might have a difference if Lua sets player->flyangle above 359), and un-loop a for loop by incrementing by thrustfactor directly
  • Added P_NiGHTSGetTrackYaw(player), P_NiGHTSGetPlaneSlopeAngle(player,slope), and P_NiGHTSBounceOffPlane(player,ceiling), to help calculate/handle NiGHTS angles and bounces


Debugging:

  • DBG_NIGHTS-devmode now shows messages in the console when you bounce off walls/floors/ceilings, with the old and new flight angle and the slope angle
  • DBG_NIGHTSBASIC-devmode now displays "Angle: [player->flyangle]" above "Drill: [player->drillmeter]"
  • DBG_NIGHTSBASIC-devmode no longer displays a very faint 4294967295 (-1) link value when you don't have a link
Edited by Zwip-Zwap Zapony

Merge request reports

Loading