.HookFixHorizon STA &1FEA \ Modify the DrawObject routine at dobj3 instruction #6 \ so that objects get cut off at the track line number \ in A instead of horizonLine when they are hidden \ behind a hill STA yVergeLeft,Y \ Set the pitch angle for the left side of the horizon \ line in the track verge buffer to the updated value of \ horizonLine (this is the instruction that we overwrote \ with the call to the hook routine, so this makes sure \ we still do this) \ We now work through the verge buffer from index Y up \ to index 8, and do the following for each entry: \ \ * If xVergeRight < xVergeLeft, set \ xVergeRight= xVergeLeft \ \ * Set yVergeRight= yVergeLeft \ \ This appears to squeeze the left verge of the track \ into the right verge, but only for a few entries just \ in front of the horizon section, i.e. for the track \ section list and the first three entries in the track \ segment list .coll1 LDA xVergeRightLo,Y \ Set A= xVergeRight - xVergeLeft for the horizon SEC \ SBC xVergeLeftLo,Y \ starting with the low bytes LDA xVergeRightHi,Y \ And then the high bytes SBC xVergeLeftHi,Y BPL coll2 \ If the result is positive, jump to coll2 to skip the \ following \ If we get here then the result is negative, so \ xVergeRight < xVergeLeft LDA xVergeRightLo,Y \ Set xVergeRight= xVergeLeft STA xVergeLeftLo,Y LDA xVergeRightHi,Y STA xVergeLeftHi,Y .coll2 LDA yVergeRight,Y \ Set yVergeRight= yVergeLeft STA yVergeLeft,Y CPY #6 \ If the horizon section index >= 6, jump to coll3 BCS coll3 \ If we get here then the track section at the horizon \ is one of sections 0 to 5 LDA #0 \ Zero the vergeDataRight and vergeDataLeft entries for STA vergeDataRight,Y \ the horizon section index STA vergeDataLeft,Y .coll3 INY \ Increment the verge buffer index CPY #9 \ Loop back until we have processed up to index 8 BCC coll1 LDY horizonListIndex \ Restore the value of Y that we had on entering the \ hook routine RTS \ Return from the subroutineName: HookFixHorizon [Show more] Type: Subroutine Category: Extra tracks Summary: Apply the horizon line in A instead of horizonLine Deep dive: Secrets of the extra tracks Code hooks in the extra tracksContext: See this subroutine in context in the source code References: This subroutine is called as follows: * newContentHi calls HookFixHorizon * newContentLo calls HookFixHorizon
This routine is called from GetTrackAndMarkers. It does the following: * Cut objects off at the track line in A rather than horizonLine * Collapse the left verge of the track into the right verge, but only for a few entries just in front of the horizon section, i.e. for the track section list and the first three entries in the track segment list * If the track section at the horizon is one of sections 0 to 5, zero the vergeDataRight and vergeDataLeft entries for the horizon section index to hide the verge
Arguments: A The updated value of horizonLine Y The horizon section index in the verge buffer from horizonListIndex
[X]
Label coll1 is local to this routine
[X]
Label coll2 is local to this routine
[X]
Label coll3 is local to this routine
[X]
Configuration variable horizonListIndex = &0051
[X]
Configuration variable vergeDataLeft = &5F08
[X]
Configuration variable vergeDataRight = &5EE0
[X]
Configuration variable xVergeLeftHi = &5EB8
[X]
Configuration variable xVergeLeftLo = &5E68
[X]
Configuration variable xVergeRightHi = &5E90
[X]
Configuration variable xVergeRightLo = &5E40
[X]
Configuration variable yVergeLeft = &5F48
[X]
Configuration variable yVergeRight = &5F20