Skip to navigation

Title screen: DrawTitleScreen

Name: DrawTitleScreen [Show more] Type: Subroutine Category: Title screen Summary: Draw the title screen or the screen showing the secret code
Context: See this subroutine in context in the source code References: This subroutine is called as follows: * FinishLandscape calls DrawTitleScreen * MainTitleLoop calls DrawTitleScreen * SecretCodeError calls DrawTitleScreen

Arguments: A Determines the type of screen to draw: * If bit 7 = 0 then draw the title screen * If bit 7 = 1 then draw the secret code screen
.DrawTitleScreen STA screenType \ Store the screen type in A in screenType, so we can \ refer to it below LDA #128 \ Set objectYawAngle+63 = 128 STA objectYawAngle+63 \ \ The degree system in the Sentinel looks like this: \ \ 0 \ -32 | +32 Overhead view of object \ \ | / \ \ | / 0 = looking straight ahead \ \|/ +64 = looking sharp right \ -64 -----+----- +64 -64 = looking sharp left \ /|\ \ / | \ \ / | \ \ -96 | +96 \ 128 \ \ So this makes object #63 face directly out of the \ screen LDA #&E0 \ For object #63, set the following: STA yObjectLo+63 \ LDA #&02 \ yObject(Hi Lo) = &2E0 STA yObjectHi+63 \ \ So this sets the altitude of object #63 to just under \ three full block heights (2.875, to be precise) \ \ We use object #63 for drawing the 3D text blocks in \ the game title in the main title screen, or the code \ in the secret code screen, so this ensures that the \ text blocks are drawn at the correct height to get the \ title effect SEC \ Set bit 7 of drawingTitleScreen to indicate that we ROR drawingTitleScreen \ are drawing a title screen LDA #0 \ Call ProcessTileData with A = 0 to zero the tile data JSR ProcessTileData \ for the whole landscape BIT screenType \ If bit 7 of the screen type is clear, jump to titl1 to BPL titl1 \ draw "THE SENTINEL" in large 3D text for the main \ title screen \ If we get here then bit 7 of the argument is set, so \ we now draw the secret code JSR SpawnSecretCode3D \ Spawn the secret code in large 3D text blocks LDX #3 \ Set X = 3 to pass to DrawTitleView so the background \ of the secret code screen is black with stars LDA #0 \ Set A = 0 so the call to DrawTitleView draws a robot \ on the right of the screen BEQ titl3 \ Jump to titl3 to skip the following and draw the robot \ (this BEQ is effectively a JMP as A is always zero) .titl1 LDX #0 \ We now look through all the characters in the title \ text, drawing each one in turn, so set X as a \ character index .titl2 LDA titleText,X \ Set A to the X-th character in the title text JSR SpawnCharacter3D \ Spawn the 3D text blocks for drawing the character in \ A in large 3D text INX \ Increment the character index CPX #15 \ Loop back until we have drawn all 15 characters in the BCC titl2 \ title text LDX #1 \ Set X = 1 to pass to DrawTitleView so the background \ of the landscape preview is solid blue LDA #5 \ Set A = 5 so the call to DrawTitleView draws the \ Sentinel on the right of the screen .titl3 LDY #1 \ Set Y = 1 to pass to DrawTitleView so it draws the \ screen with the correct perspective for the title \ screen JSR DrawTitleView \ Draw the title screen with the object and background \ defined in A and X LSR drawingTitleScreen \ Clear bit 7 of drawingTitleScreen to indicate we are \ no longer drawing a title screen RTS \ Return from the subroutine