Prev: 35143 Up: Map Next: 35228
35151: Display Lives
Draw the 1UP and 2UP lives counts and the life UDG, or spaces if a player has none.
Controller for 1UP lives.
DisplayPlayerLives 35151 LD HL,64 Call ScreenAddress with the pixel co-ordinates 0064 to get the 1UP lives screen address.
35154 CALL ScreenAddress
35157 CALL FetchLives_1UP A=1UP lives remaining (by calling FetchLives_1UP).
35160 AND A If 1UP lives are zero, jump to Handler1UPNoLives.
35161 JR Z,Handler1UPNoLives
35163 CALL HandlerDisplayLives Else, there are lives to display so call HandlerDisplayLives.
Controller for 2UP lives.
Controller2UPLives 35166 LD HL,176 Call ScreenAddress with the pixel co-ordinates 0176 to get the 2UP lives screen address.
35169 CALL ScreenAddress
35172 CALL FetchLives_2UP A=2UP lives remaining (by calling FetchLives_2UP).
35175 AND A If 2UP lives are zero, jump to Handler2UPNoLives.
35176 JR Z,Handler2UPNoLives
Handles displaying the lives count and UDG character.
HandlerDisplayLives 35178 ADD A,48 Add 48 to convert to an ASCII character (starting at "0").
35180 CALL PrintScreen Call PrintScreen.
35183 LD DE,53585 DE=UDG_Life.
35186 PUSH BC Stash BC and DE on the stack.
35187 PUSH DE
35188 JP PrintCharacter_Draw Jump to PrintCharacter_Draw.
1UP has no lives.
Handler1UPNoLives 35191 CALL Handler2UPNoLives Call Handler2UPNoLives.
35194 JR Controller2UPLives Jump to Controller2UPLives.
2UP has no lives.
Handler2UPNoLives 35196 LD A,32 A=ASCII " " (SPACE).
35198 CALL PrintScreen Call PrintScreen.
35201 LD A,32 A=ASCII " " (SPACE).
35203 JP PrintScreen Jump to PrintScreen.
Return the 1UP player's lives left.
FetchLives_1UP 35206 LD A,(24165) If Flag_ActivePlayer is not zero then jump to InactivePlayerLives.
35209 AND A
35210 JR NZ,InactivePlayerLives
Return currently active players lives left.
ActivePlayerLives 35212 LD A,(24225) A=*ActivePlayer_Lives.
35215 RET Return.
Return inactive players lives left.
InactivePlayerLives 35216 LD A,(24229) A=*InactivePlayer_Lives.
35219 RET Return.
Return the 2UP player's lives left.
FetchLives_2UP 35220 LD A,(24165) If Flag_ActivePlayer is zero then jump to InactivePlayerLives.
35223 AND A
35224 JR Z,InactivePlayerLives
35226 JR ActivePlayerLives Jump to ActivePlayerLives.
View the equivalent code in;
Prev: 35143 Up: Map Next: 35228