Skip to navigation


Player: PlacePlayerOnLaunchpad

Name: PlacePlayerOnLaunchpad [Show more] Type: Subroutine Category: Player Summary: The main entry point for the game
Context: See this subroutine in context in the source code References: This subroutine is called as follows: * LoseLife calls PlacePlayerOnLaunchpad
.PlacePlayerOnLaunchpad LDR R0, [R11, #remainingLives] \ Set R0 to the number of remaining lives MOV R1, #30 \ Set (R1, R2) = (30, 1) so the following MOV R2, #1 \ call to PrintScoreInBothBanks prints the \ number of lives at column 30 on row 1 BL PrintScoreInBothBanks \ Print the number of lives in R0 at column \ 30 on row 1, just before the high score \ towards the right end of the score bar MVN R0, #0 \ Set playingGame = -1 to flag that the game STR R0, [R11, #playingGame] \ is being played and that this is not the \ crash animation MOV R0, #0 \ Set xCamera = 0 and zCamera = 0 STR R0, [R11, #xCamera] \ STR R0, [R11, #zCamera] \ This doesn't have any effect as the camera \ position is set at the start of the main \ loop by the call to MoveAndDrawPlayer, \ which overwrites these values STR R0, [R11, #shipDirection] \ Set shipDirection = 0 so the ship faces \ right when the game starts (though this is \ quickly corrected when the game uses the \ mouse coordinates to calculate the \ direction) MOV R0, #1 \ Set shipPitch = 1 so the ship is very STR R0, [R11, #shipPitch] \ slightly pitched up for take-off MOV R0, #LAUNCHPAD_SIZE/2 \ Set the starting coordinates of the MOV R2, R0 \ player's ship as follows: ADD R3, R11, #xPlayer \ MOV R1, #LAUNCHPAD_Y \ xPlayer = LAUNCHPAD_SIZE / 2 STMIA R3!, {R0-R2} \ yPlayer = LAUNCHPAD_Y \ zPlayer = LAUNCHPAD_SIZE / 2 \ \ which is in the middle of the launchpad MOV R0, #0 \ Set the player's velocity to zero as MOV R1, #0 \ follows: MOV R2, #0 \ STMIA R3!, {R0-R2} \ xVelocity = 0 \ yVelocity = 0 \ zVelocity = 0 BL ResetMousePosition \ Reset the mouse position to (511, 511), \ ready for the game