Prev: 29118 Up: Map Next: 29257
29210: Update Bonus Item
Used by the routine at SpawnBonusItem.
Updates the bonus item. It sits in a cubby hole and flashes, and when Robbie touches it the cubby hole is changed (see Robbie_EmptyHanded_Pickup) and so the bonus item is collected by CollectBonusItem. It goes back to the start of the main loop at MainLoop_NewPass.
UpdateBonusItem 29210 LD IX,24124 IX=State_BonusItem.
29214 CALL StoreEntity Remember the position and state using StoreEntity.
29217 LD C,(IX+5) C=the cubby hole number from IX+5.
29220 LD B,0 B=0.
29222 LD HL,24099 HL=CubbyHoles.
29225 ADD HL,BC Add the cubby hole number.
29226 LD A,(HL) A=the contents of the cubby hole.
29227 CP (IX+4) Compare it with IX+4.
29230 JR NZ,CollectBonusItem Jump to CollectBonusItem if it has changed.
29232 CALL DisplayEntity Erase the sprite at the previous position and draw it at the new position using DisplayEntity.
29235 CALL ColouriseSprite Colour the sprite using ColouriseSprite.
29238 LD A,(24087) A=the game timer from GameTimer.
29241 AND %00000011 Keep only bits 0-1 (every fourth update).
29243 JP NZ,MainLoop_NewPass Jump to MainLoop_NewPass unless the result is zero.
29246 LD A,(IX+3) A=the colour of the bonus item.
29249 XOR %00000100 Flip bit 2 (so the item flashes).
29251 LD (IX+3),A Write it back to the colour of the bonus item.
29254 JP MainLoop_NewPass Jump to MainLoop_NewPass.
Prev: 29118 Up: Map Next: 29257