.DrawTitleView STA titleObjectToDraw \ Set titleObjectToDraw to the object that we are \ drawing so we can refer to it throughout the title \ routines STX screenBackground \ Set screenBackground to the type of background to draw \ for the title screen or landscape preview \ We start by setting the correct colour for any drop \ shadow text on the title screen (i.e. text that uses \ the standard font and which is printed twice with an \ offset to give a drop-shadow effect, as opposed to the \ large 3D text which is drawn as 3D objects) TXA \ Set A to the background type LDX #2 \ Set X = 2 to use as the colour for the rear character \ of a drop shadow (this is red on the title screens or \ white/yellow/cyan/red in the landscape preview) EOR #3 \ Update the VDU codes at vduShadowFront so the front STA vduShadowFront+1 \ character of the dropdown text is printed in colour \ A EOR 3, so that's: \ \ * Colour 2 (red) for the solid blue background \ \ * Colour 0 (blue) for the star background BEQ tvew1 \ If we just set the colour of the front character to \ blue, skip the following instruction INX \ Set X = 3 to use as the colour for the rear character \ of a drop shadow (this is yellow on the title screens \ green/red/yellow/cyan in the landscape preview) .tvew1 STX vduShadowRear+1 \ Update the VDU codes at vduShadowRear so the rear \ character of the dropdown text is printed in colour X, \ so that's: \ \ * Colour 3 (yellow) for the solid blue background \ \ * Colour 2 for the star background, which is red for \ the secret code screen, or white/yellow/cyan/red \ in the landscape preview) STY viewType \ Set viewType to the view type so we can use it as an \ index into the screen configuration tables to set up \ the correct perspective depending on whether this is \ a landscape preview (Y = 0) or a title screen (Y = 1) \ We now set up object #16 to use as the viewing object \ for the large 3D text blocks, using the values from \ the configuration tables LDA yTextViewer,Y \ Set the y-coordinate of the viewer in object #16 STA yObjectHi+16 LDA textViewerPitch,Y \ Set the pitch angle of the viewer in object #16 STA objectPitchAngle+16 LDA xTextViewer,Y \ Set the x-coordinate of the viewer in object #16 STA xObject+16 LDA zTextViewer,Y \ Set the z-coordinate of the viewer in object #16 STA zObject+16 LDA textViewerYaw,Y \ Set the yaw angle of the viewer in object #16 STA objectYawAngle+16 LDA titleOffset,Y \ Store the title offset on the stack so we can retrieve PHA \ it below JSR ClearScreen \ Clear the screen to the screen background specified in \ screenBackground (so that's blue for the main title \ screen or black with stars for the secret code screen \ or landscape preview) LDA titleObjectToDraw \ If bit 7 of titleObjectToDraw is set then we are BMI tvew2 \ drawing the landscape preview, so skip the following \ instruction as there is no 3D object on the right of \ the screen JSR DrawTitleObjects \ Otherwise call DrawTitleObjects to draw an object of \ type A (so that's 0 for a robot or 5 for the Sentinel) \ standing on top of a tower on the right side of the \ screen .tvew2 PLA \ Set xTitleOffset to the title offset, which will only STA xTitleOffset \ be non-zero when we are drawing the large 3D text on \ the main title screen or secret code screen LDX #16 \ Set the viewing object to object #16 STX viewingObject JSR DrawLandscapeView \ Draw the landscape view to display the large 3D text \ (for the title screens) or draw the landscape preview LDA viewType \ If viewType is non-zero then this is the main title BNE tvew4 \ screen or secret code screen, so jump to tvew4 to skip \ the following LDX #127 \ We just drew the landscape preview, so we now reset \ the tile visibilities so we're ready to play the game, \ so set a byte counter in X to work through the 128 \ bytes in the tileVisibility table STX viewType \ Set viewType to a non-zero value (it doesn't matter \ what) so the GetObjectAngles routine will process \ angles for the game's landscape from now on .tvew3 STA tileVisibility,X \ Zero the X-th byte in the tileVisibility table DEX \ Decrement the byte counter BPL tvew3 \ Loop back until we have zeroed the whole \ tileVisibility table .tvew4 LDA #0 \ Set xTitleOffset = 0 to remove the x-coordinate offset STA xTitleOffset \ that we used for the text, as is it not needed during \ gameplay STA screenBackground \ Set screenBackground = 0 so if we start the game after \ showing this title screen, the FillScreen routine will \ clear the screen buffers to the blue and black sky, \ which is the only screen background we need during \ gameplay RTS \ Return from the subroutineName: DrawTitleView [Show more] Type: Subroutine Category: Title screen Summary: Draw the main title screen, the secret code screen or the landscape previewContext: See this subroutine in context in the source code References: This subroutine is called as follows: * DrawTitleScreen calls DrawTitleView * PreviewLandscape calls DrawTitleView
Arguments: A The object to draw on the title screen: * 0 = draw a robot on the right of the screen for the secret code screen * 5 = draw the Sentinel on the right of the screen for the main title screen * &80 = draw the landscape preview X The screen background: * 1 = fill with solid colour 0 (blue) for the main title screen * 3 = fill with solid colour 1 (black) and draw 240 randomly positioned stars in colour 2 (white, yellow, cyan or red), for the secret code screen and landscape preview Y The view type: * 0 = landscape preview * 1 = main title screen or secret code screen
[X]
Subroutine ClearScreen (category: Graphics)
Clear the screen to a specified background
[X]
Subroutine DrawLandscapeView (Part 1 of 3) (category: Drawing the landscape)
Set up a number of variables for drawing the landscape view
[X]
Subroutine DrawTitleObjects (category: Title screen)
Draw an object on top of a tower on the title screen
[X]
Variable objectPitchAngle in workspace Stack variables
The pitch angle for each object (i.e. the vertical direction in which they are facing)
[X]
Variable objectYawAngle (category: 3D objects)
The yaw angle for each object (i.e. the horizontal direction in which they are facing)
[X]
Variable screenBackground in workspace Main variable workspace
The type of screen background when clearing the screen
[X]
Variable textViewerPitch (category: Title screen)
The pitch angle of the viewer for the large 3D text on the title screen
[X]
Variable textViewerYaw (category: Title screen)
The yaw angle of the viewer for the large 3D text on the title screen
[X]
Variable tileVisibility (category: Drawing the landscape)
A table for storing the visibility of each tile from the player's point of view, with one bit per tile (1 = visible, 0 = hidden)
[X]
Variable titleObjectToDraw in workspace Main variable workspace
The object we are drawing in the DrawTitleView routine
[X]
Variable titleOffset (category: Title screen)
An offset to apply to the large 3D text for the title screen
[X]
Label tvew1 is local to this routine
[X]
Label tvew2 is local to this routine
[X]
Label tvew3 is local to this routine
[X]
Label tvew4 is local to this routine
[X]
Variable vduShadowFront (category: Text)
VDU commands for printing the front character of a drop shadow
[X]
Variable vduShadowRear (category: Text)
VDU commands for printing the rear character of a drop shadow
[X]
Variable viewType (category: Title screen)
Storage for the type of title view we are drawing in DrawTitleView (title screen or landscape preview)
[X]
Variable viewingObject in workspace Zero page
The number of the viewing object
[X]
Variable xObject (category: 3D objects)
The x-coordinates in 3D space for the 3D objects
[X]
Variable xTextViewer (category: Title screen)
The x-coordinate of the viewer for the large 3D text on the title screen
[X]
Variable xTitleOffset in workspace Main variable workspace
An x-coordinate offset for drawing the title screen this is zero during gameplay)
[X]
Variable yObjectHi (category: 3D objects)
The y-coordinates in 3D space for the 3D objects (high byte)
[X]
Variable yTextViewer (category: Title screen)
The y-coordinate of the viewer for the large 3D text on the title screen
[X]
Variable zObject (category: 3D objects)
The z-coordinates in 3D space for the 3D objects
[X]
Variable zTextViewer (category: Title screen)
The z-coordinate of the viewer for the large 3D text on the title screen