.SpinTrackSection LDA #0 \ Set the Y-th entry in vergeDataRight to 0, to reset STA vergeDataRight,Y \ the colour of the verge mark to black (this is \ recalculated in the GetVergeAndMarkers routine) LDA xVergeRightLo,Y \ Set xVergeRight = xVergeRight - spinYawAngle SEC \ SBC spinYawAngleHi \ starting with the low bytes STA xVergeRightLo,Y LDA xVergeRightHi,Y \ And then the high bytes SBC spinYawAngleTop STA xVergeRightHi,Y LDA yVergeRight,Y \ Set A = Y-th entry in yVergeRight - spinPitchAngle SEC SBC spinPitchAngle STA yVergeRight,Y \ Store the result in the Y-th entry in yVergeRight CMP horizonLine \ If A < horizonLine, then this track section is lower BCC rott1 \ than the current horizon, so jump to rott1 to return \ from the subroutine STA horizonLine \ Otherwise this track section is higher than the \ current horizon pitch angle, so the track obscures the \ horizon and we need to update horizonLine to this \ new pitch angle STY horizonListIndex \ Set horizonListIndex to the track section list index \ number in Y .rott1 RTS \ Return from the subroutineName: SpinTrackSection [Show more] Type: Subroutine Category: Track geometry Summary: Apply spin to a section in the track section listContext: See this subroutine in context in the source code References: This subroutine is called as follows: * GetSectionAngles (Part 1 of 3) calls SpinTrackSection
Arguments: Y The index of the entry in the track section list: Y = 0 to 5 (update the right verge): * Reset vergeDataRight to zero * Subtract spinYawAngle from the yaw angles in xVergeRightLo, xVergeRightHi * Subtract spinPitchAngle from the pitch angle in yVergeRight * Update horizonListIndex and horizonLine Y = 0 to 5 + 40 (update the left verge): * Reset vergeDataLeft to zero * Subtract spinYawAngle from the yaw angles in xVergeLeftLo, xVergeLeftHi * Subtract spinPitchAngle from the pitch angle in yVergeLeft * Update horizonListIndex and horizonLine
[X]
Variable horizonLine in workspace Zero page
The track line number of the horizon
[X]
Variable horizonListIndex in workspace Zero page
The track section or segment that's on the horizon, given in terms of the index within the track section list (or the track segment list)
[X]
Label rott1 is local to this routine
[X]
Variable spinPitchAngle in workspace Zero page
The amount of pitch angle spin that is being applied to the player's car
[X]
Variable spinYawAngleHi (category: Car geometry)
High byte of the amount of yaw angle spin that is being applied to the player's car
[X]
Variable spinYawAngleTop (category: Car geometry)
Top byte of the amount of yaw angle spin that is being applied to the player's car
[X]
Variable vergeDataRight (category: Track geometry)
Data (such as colour) for the verge marks on the right side of the track
[X]
Variable xVergeRightHi (category: Track geometry)
High byte of segment yaw angles along the right track verge in front of the player (i.e. along the x-axis)
[X]
Variable xVergeRightLo (category: Track geometry)
Low byte of segment yaw angles along the right track verge in front of the player (i.e. along the x-axis)
[X]
Variable yVergeRight (category: Track geometry)
Segment pitch angles along the right track verge in front of the player (i.e. along the up-down y-axis)