.PreviewLandscape JSR SpawnEnemies \ Calculate the number of enemies for this landscape, \ add them to the landscape and set the palette \ accordingly LDX #3 \ Set X = 3 to pass to DrawTitleView so the background \ of the landscape preview is black with stars LDY #0 \ Set Y = 0 to pass to DrawTitleView so it draws the \ screen with the correct perspective for the landscape \ preview LDA #&80 \ Set A = &80 so the call to DrawTitleView does not draw \ a 3D object as part of the landscape preview JSR DrawTitleView \ Draw the landscape preview LDX #4 \ Print text token 4: Background colour black, print JSR PrintTextToken \ "PRESS ANY KEY" at (192, 64), print "LANDSCAPE" two \ characters right of (64, 768), move cursor right JSR PrintLandscapeNum \ Print the four-digit landscape number (0000 to 9999) JSR SpawnPlayer \ Add the player and trees to the landscape, and then \ generate and check the landscape secret code (the \ SpawnPlayer routine falls through into SpawnTrees, \ which falls through into CheckSecretCode) \ \ If the entered secret entry code in the keyboard input \ buffer does not match the generated secret code for \ this landscape, then the call to CheckSecretCode will \ return here so we can display an error with the jump \ to SecretCodeError below \ \ If the codes match then the CheckSecretCode routine \ will jump to the PlayGame routine to play the game, so \ we will not return here JMP SecretCodeError \ The entered secret entry in the keyboard input buffer \ does not match the generated secret code for this \ landscape, so jump to SecretCodeError to display the \ "WRONG SECRET CODE" error, wait for a key press and \ rejoin the main title loopName: PreviewLandscape [Show more] Type: Subroutine Category: Landscape Summary: Draw an aerial preview of the landscape Deep dive: Program flow of the main title loop Adding enemies and trees to the landscape Drawing the landscape preview Drawing the title screensContext: See this subroutine in context in the source code References: This subroutine is called as follows: * JumpToPreview calls PreviewLandscape
[X]
Subroutine DrawTitleView (category: Title screen)
Draw the main title screen, the secret code screen or the landscape preview
[X]
Subroutine PrintLandscapeNum (category: Text)
Print the four-digit landscape number (0000 to 9999)
[X]
Subroutine PrintTextToken (category: Text)
Print a recursive text token
[X]
Subroutine SecretCodeError (category: Main title loop)
Display the "WRONG SECRET CODE" error, wait for a key press and rejoin the main title loop
[X]
Subroutine SpawnEnemies (category: Landscape)
Calculate the number of enemies for this landscape, add them to the landscape and set the palette accordingly
[X]
Subroutine SpawnPlayer (category: Landscape)
Add the player object to the landscape, ideally placing it below all the enemies and in the bottom half of the landscape