.gmar9 \ The verge marks are either black-white-black-white \ or red-white-red-white, so we now work out which of \ these colours applies to this segment TXA \ If bit 0 of X is clear, then this is a non-white verge AND #%00000001 \ mark, so jump to gmar10 to set A = V to use as the BEQ gmar10 \ vergeDataRight for this segment LDA #2 \ Otherwise this is a white verge mark, so set A = 2 \ to use as the vergeDataRight for this segment BNE gmar11 \ Jump to gmar11 (this BNE is effectively a JMP as A is \ never zero) .gmar10 LDA V \ Set A = V, which is 0 (black verge mark) or 1 (red \ verge mark) .gmar11 LDY segmentListPointer \ Set Y to the index of the current entry in the track \ segment list STA vergeDataRight,Y \ Store A in the segment's corresponding vergeDataRight, \ so that's 2 for a white verge mark, 1 for a red verge \ mark, and 0 for a black verge mark LDA LL \ Set A to the segment's pitch angle, from the point \ of view of the player STA yVergeRight,Y \ Store the result in the segment's entry in yVergeRight \ to set the segment's pitch angle CMP #80 \ If the pitch angle is 80 or more, jump to gmar12 BCS gmar12 \ to return from the subroutine CMP horizonLine \ If the pitch angle is less than horizonLine, jump BCC gmar12 \ to gmar12 to return from the subroutine \ If we get here then the pitch angle in A is less \ than 80 and is greater or equal to horizonLine STA horizonLine \ This track segment 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 segment number in Y .gmar12 RTS \ Return from the subroutineName: GetVergeAndMarkers (Part 4 of 4) [Show more] Type: Subroutine Category: Track geometry Summary: Store details of the segment's verge marksContext: See this subroutine in context in the source code References: No direct references to this subroutine in this source file
[X]
Label gmar10 is local to this routine
[X]
Label gmar11 is local to this routine
[X]
Label gmar12 is local to this routine
[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]
Variable segmentListPointer in workspace Zero page
The index of the current entry in the track segment list
[X]
Variable vergeDataRight (category: Track geometry)
Data (such as colour) for the verge marks on the right side of the track
[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)