Skip to navigation


Driving model: ApplyBounce

Name: ApplyBounce [Show more] Type: Subroutine Category: Driving model Summary: Apply a bounce to the player's car when it hits the ground
Context: See this subroutine in context in the source code References: This subroutine is called as follows: * ApplyElevation (Part 4 of 5) calls ApplyBounce

Calculate the following: yGravityDelta = A / 2 yJumpHeight = A / 4 heightAboveTrack = heightAboveTrack + 1 spinYawAngleHi = spinYawAngleHi >> 1 with bit 7 set and make the crash/contact sound.
.ApplyBounce LSR A \ Set yGravityDelta = A / 2 STA yGravityDelta LSR A \ Set yJumpHeight = A / 4 STA yJumpHeight INC heightAboveTrack \ Set heightAboveTrack = heightAboveTrack + 1 SEC \ Rotate spinYawAngleHi right, inserting a 1 into bit 7 ROR spinYawAngleHi LDA #4 \ Make sound #4 (crash/contact) at the current volume JSR MakeSound-3 \ level RTS \ Return from the subroutine