Prev: 28060 Up: Map Next: 28370
28090: Game Play Entry
Handles Robbie while he is not carrying a spray can (Robbie state 1). While the "get ready" delay in PlayDelay_Counter counts down, Robbie does nothing and the label for the player flashes. After that, the controls move him around the play area. When he walks into a cubby hole which contains a spray can he picks it up and becomes Robbie carrying a can (see Robbie_CarryingCan). Walking into a cubby hole which has a bonus item in it collects the item (see UpdateBonusItem).
Input
IX Robbie object
The Robbie object fields used (here and in Robbie_CarryingCan) are:
Field Use
+0 The state: 1 when empty-handed and 2 when carrying a can
+3 The colour (white when empty-handed, otherwise the colour of the can)
+4 bit 0 Facing left (Robbie faces right if this is not set)
+4 bit 2 Cannot pick up or drop a can (until he has moved away)
+4 bit 3 Has just picked up a can
+6 The item last dropped into a cubby hole
GamePlayEntry 28090 LD HL,24098 HL=PlayDelay_Counter (the "get ready" delay).
28093 LD A,(HL) Jump to Robbie_EmptyHanded_Move if the delay is zero.
28094 AND A
28095 JR Z,Robbie_EmptyHanded_Move
28097 DEC (HL) Decrease the delay by one.
28098 JP NZ,FlashPlayerLabel Jump to FlashPlayerLabel to flash the player label if the delay has not run out (which returns to the main loop).
28101 LD A,(24094) A=the current player from Current_Player.
28104 AND A Jump to Robbie_EmptyHanded_GetReady2UP if it is the second player.
28105 JR NZ,Robbie_EmptyHanded_GetReady2UP
28107 LD HL,24 HL=24 (the position of the label for 1UP).
Robbie_EmptyHanded_GetReady 28110 CALL StopFlashingPlayerLabel Stop the player label flashing using StopFlashingPlayerLabel.
28113 CALL PlayMidTone Play a tone using PlayMidTone.
28116 JR Robbie_EmptyHanded_Move Jump to Robbie_EmptyHanded_Move.
Robbie_EmptyHanded_GetReady2UP 28118 LD HL,216 HL=216 (the position of the label for 2UP).
28121 JR Robbie_EmptyHanded_GetReady Jump to Robbie_EmptyHanded_GetReady.
Once Robbie is away from the cubby holes he can pick up and drop things again.
Robbie_EmptyHanded_Move 28123 LD A,(IX+1) A=the X position of Robbie.
28126 CP 32 Jump to Robbie_EmptyHanded_Input if Robbie is too far to the left.
28128 JR C,Robbie_EmptyHanded_Input
28130 CP 208 Jump to Robbie_EmptyHanded_Input if Robbie is too far to the right.
28132 JR NC,Robbie_EmptyHanded_Input
28134 RES 2,(IX+4) Reset bit 2 of IX+4.
Robbie_EmptyHanded_Input 28138 CALL StoreEntity Remember the position and state using StoreEntity.
28141 CALL ReadInput Read the controls using ReadInput.
28144 BIT 0,A Jump to Robbie_EmptyHanded_Right if right is being pressed.
28146 JR Z,Robbie_EmptyHanded_Right
28148 BIT 1,A Jump to Robbie_EmptyHanded_Left if left is being pressed.
28150 JR Z,Robbie_EmptyHanded_Left
Robbie_EmptyHanded_Vertical 28152 LD A,(IX+1) A=the X position of Robbie.
28155 CP 24 Jump to Robbie_EmptyHanded_Draw if Robbie is in the cubby hole column on the left.
28157 JR C,Robbie_EmptyHanded_Draw
28159 CP 216 Jump to Robbie_EmptyHanded_Draw if Robbie is in the cubby hole column on the right.
28161 JR NC,Robbie_EmptyHanded_Draw
28163 CALL ReadInput Read the controls using ReadInput.
28166 BIT 3,A Jump to Robbie_EmptyHanded_Up if up is being pressed.
28168 JR Z,Robbie_EmptyHanded_Up
28170 BIT 2,A Jump to Robbie_EmptyHanded_Down if down is being pressed.
28172 JR Z,Robbie_EmptyHanded_Down
Robbie_EmptyHanded_Draw 28174 JP DrawObject Jump to DrawObject to draw Robbie.
Move right.
Robbie_EmptyHanded_Right 28177 LD A,(IX+1) A=the X position of Robbie.
28180 ADD A,2 Add 2.
28182 CP 216 Jump to Robbie_EmptyHanded_CubbyColumn if Robbie has reached the cubby hole column on the right.
28184 JR NC,Robbie_EmptyHanded_CubbyColumn
Robbie_EmptyHanded_StoreX 28186 LD (IX+1),A Write the new X position.
28189 JR Robbie_EmptyHanded_Vertical Jump to Robbie_EmptyHanded_Vertical.
Move left.
Robbie_EmptyHanded_Left 28191 LD A,(IX+1) A=the X position of Robbie.
28194 SUB 2 Subtract 2.
28196 CP 24 Jump to Robbie_EmptyHanded_CubbyColumn if Robbie has reached the cubby hole column on the left.
28198 JR C,Robbie_EmptyHanded_CubbyColumn
28200 JR Robbie_EmptyHanded_StoreX Jump to Robbie_EmptyHanded_StoreX.
Move up.
Robbie_EmptyHanded_Up 28202 LD A,(IX+2) A=the Y position of Robbie.
28205 SUB 2 Subtract 2.
28207 CP 40 Jump to Robbie_EmptyHanded_Draw if Robbie has reached the top.
28209 JR C,Robbie_EmptyHanded_Draw
Robbie_EmptyHanded_StoreY 28211 LD (IX+2),A Write the new Y position.
28214 JR Robbie_EmptyHanded_Draw Jump to Robbie_EmptyHanded_Draw.
Move down.
Robbie_EmptyHanded_Down 28216 LD A,(IX+2) A=the Y position of Robbie.
28219 ADD A,2 Add 2.
28221 CP 184 Jump to Robbie_EmptyHanded_Draw if Robbie has reached the bottom.
28223 JR NC,Robbie_EmptyHanded_Draw
28225 JR Robbie_EmptyHanded_StoreY Jump to Robbie_EmptyHanded_StoreY.
Robbie has reached one of the cubby hole columns.
Robbie_EmptyHanded_CubbyColumn 28227 CALL CheckCubbyHole Check for a cubby hole using CheckCubbyHole.
28230 BIT 0,E Jump to Robbie_EmptyHanded_Vertical if Robbie is not level with a cubby hole.
28232 JR Z,Robbie_EmptyHanded_Vertical
28234 BIT 1,E Test bit 1 of E (the right hand side).
28236 LD A,(IX+1) A=the X position of Robbie.
28239 JR Z,Robbie_EmptyHanded_CubbyHoleLeft Jump to Robbie_EmptyHanded_CubbyHoleLeft if Robbie is on the left hand side.
28241 ADD A,2 Add 2.
28243 CP 228 Jump to Robbie_EmptyHanded_Draw if Robbie has reached the edge of the play area.
28245 JR NC,Robbie_EmptyHanded_Draw
Robbie_EmptyHanded_CubbyHole 28247 BIT 2,E Jump to Robbie_EmptyHanded_Pickup if the cubby hole is not empty.
28249 JR NZ,Robbie_EmptyHanded_Pickup
28251 LD (IX+1),A Write the new X position.
28254 JR Robbie_EmptyHanded_Draw Jump to Robbie_EmptyHanded_Draw.
Robbie_EmptyHanded_CubbyHoleLeft 28256 SUB 2 Subtract 2.
28258 CP 12 Jump to Robbie_EmptyHanded_Draw if Robbie has reached the edge of the play area.
28260 JR C,Robbie_EmptyHanded_Draw
28262 JR Robbie_EmptyHanded_CubbyHole Jump to Robbie_EmptyHanded_CubbyHole.
Robbie has walked into a cubby hole which is not empty.
Robbie_EmptyHanded_Pickup 28264 LD A,(HL) A=the contents of the cubby hole.
28265 BIT 7,A Jump to Robbie_EmptyHanded_Bonus if bit 7 is set (a bonus item is in the hole).
28267 JR NZ,Robbie_EmptyHanded_Bonus
28269 BIT 2,(IX+4) Jump to Robbie_EmptyHanded_TakeCan if Robbie is free to pick the item up.
28273 JR Z,Robbie_EmptyHanded_TakeCan
28275 CP (IX+6) Jump to Robbie_EmptyHanded_Draw if this is the item that Robbie has just dropped.
28278 JP Z,Robbie_EmptyHanded_Draw
Robbie_EmptyHanded_TakeCan 28281 AND %00000111 Keep only bits 0-2 (the colour of the can).
28283 OR %01000000 Set bit 6 (BRIGHT).
28285 LD (IX+3),A Write it to the colour of Robbie.
28288 LD (IX+11),A Write it to the colour of the spray can object.
28291 LD A,2 A=2 (the state of Robbie when he is carrying a can).
28293 LD (IX+0),A Make Robbie carry a can (state 2).
28296 INC A Increment the state by one (the state of the spray can object).
28297 LD (IX+8),A Make the spray can object active (state 3).
28300 CALL PlayHighTone Play a tone using PlayHighTone.
28303 BIT 7,(IX+1) Test bit 7 of the X position of Robbie.
28307 LD A,(IX+1) A=the X position of Robbie.
28310 JR Z,Robbie_EmptyHanded_TakeCanLeft Jump to Robbie_EmptyHanded_TakeCanLeft if Robbie is on the left hand side.
28312 RES 0,(IX+4) Reset bit 0 of IX+4 (Robbie faces right).
28316 ADD A,20 Add 20.
28318 LD (IX+9),A Write it to the X position of the spray can object.
28321 SUB 4 Subtract 4.
Robbie_EmptyHanded_PlaceCan 28323 LD (IX+13),A Write it to the new X position of the spray can.
28326 LD A,(IX+2) A=the Y position of Robbie.
28329 LD (IX+10),A Write it to the Y position of the spray can object.
28332 LD (IX+14),A Write it to the new Y position of the spray can.
28335 LD (IX+12),0 Write 0 to IX+12 (the can is not being put away).
28339 LD (HL),0 Empty the cubby hole.
28341 SET 2,(IX+4) Set bit 2 of IX+4.
28345 SET 3,(IX+4) Set bit 3 of IX+4.
28349 JP Robbie_EmptyHanded_Draw Jump to Robbie_EmptyHanded_Draw.
Robbie_EmptyHanded_Bonus 28352 LD (HL),128 Write 128 to the cubby hole to mark the bonus item as collected.
28354 JP Robbie_EmptyHanded_Draw Jump to Robbie_EmptyHanded_Draw.
Robbie_EmptyHanded_TakeCanLeft 28357 SUB 13 Subtract 13.
28359 LD (IX+9),A Write it to the X position of the spray can object.
28362 ADD A,1 Add 1.
28364 SET 0,(IX+4) Set bit 0 of IX+4 (Robbie faces left).
28368 JR Robbie_EmptyHanded_PlaceCan Jump to Robbie_EmptyHanded_PlaceCan.
View the equivalent code in;
Prev: 28060 Up: Map Next: 28370