.ProcessLine LDA #0 \ Set showLine = 0 as a starting point for the return STA showLine \ value (so we start out by assuming the line is \ visible, and change this if we find that it isn't) STA isObject \ Set isObject = 0, which we will set to a non-zero \ object ID below if we end up processing an object LDX lineId \ Set X = lineId, so X contains the ID of the line we \ want to check for visibility LDY lineEndPointId,X \ Set M to the point ID of the line's end point STY M LDY lineStartPointId,X \ Set L to the point ID for the line's start point STY L CPX #12 \ If lineId >= 12, then this is not the horizon or a BCS plin2 \ runway line, so jump to plin2 to process the line CPX #0 \ If lineId is not zero, then this is not the horizon, BNE plin1 \ so it must be a runway line, so jump to plin1 to \ process it \ If we get here then lineId is 0, so this is the \ horizon JSR ProcessHorizonLine \ Process the horizon and set showLine accordingly RTS \ Return from the subroutineName: ProcessLine (Part 1 of 7) [Show more] Type: Subroutine Category: Visibility Summary: Process a line, rotating and transforming it to the correct coordinates and calculating its visibility Deep dive: Visibility checksContext: See this subroutine in context in the source code References: This subroutine is called as follows: * ShowOrHideLine calls ProcessLine * UpdateLinesToShow calls ProcessLine * ProcessLinesToHide calls via ProcessLine-1
Arguments: lineId The line ID of the line to process HH Determines whether we check against the line's maximum visible distance during the visibility checks: * 0 = check the line's distance against the maximum visible distance in maxLineDistance * Non-zero = skip the distance check
Returns: showLine Whether this line is visible: * 0 = line is visible * Non-zero = line is not visible
Other entry points: ProcessLine-1 Contains an RTS
[X]
Subroutine ProcessHorizonLine (category: Visibility)
Calculate coordinates for the horizon's start and end points
[X]
Variable isObject in workspace Main variable workspace
Temporary storage, used to store the object ID when we check the visibility of an object in ProcessLine and call SetObjectCoords to set its coordinates
[X]
Variable lineEndPointId (category: 3D geometry)
The point ID for a line's end point
[X]
Variable lineStartPointId (category: 3D geometry)
The point ID for a line's start point
[X]
Label plin1 in subroutine ProcessLine (Part 2 of 7)
[X]
Label plin2 in subroutine ProcessLine (Part 3 of 7)
[X]
Variable showLine in workspace Main variable workspace
Determines whether a line is visible