Prev: 44084 Up: Map Next: 44253
44128: Update Map Objects
Used by the routine at ScrollWorld.
Runs once a frame to look after the six map objects in the slots at MapObjectSlots. For each used slot it erases the old sprite, removes the object if it is flagged for removal or lets it move and draws it in its new place, sets the attributes under it, and checks whether it has been shot.
UpdateMapObjects 44128 LD A,(23612) The scroll-in flag.
44131 AND A Call UpdateCrystalStack if A is zero.
44132 CALL Z,UpdateCrystalStack
44135 LD IX,43019 The map object slots.
44139 LD B,6 B=6.
UpdateMapObjects_Loop 44141 PUSH BC Stash BC on the stack.
44142 PUSH IX Stash IX on the stack.
44144 LD A,(IX+0) Read offset 0 of IX.
44147 CP 255 Jump to UpdateMapObjects_Next if A is 255.
44149 JR Z,UpdateMapObjects_Next
44151 BIT 7,(IX+3) Jump to UpdateMapObjects_Next2 if bit 7 of offset 3 of IX is set.
44155 JR NZ,UpdateMapObjects_Next2
44157 LD A,(IX+24) Read offset 24 of IX.
44160 AND %00001110 Keep the bits of A that are set in 14.
44162 SRL A Shift A right.
44164 LD (23580),A The bits that fire a shot from the object.
44167 CALL NZ,FireShotWhenHit Call FireShotWhenHit if the zero flag is clear.
UpdateMapObjects_Next2 44170 CALL ResetSprites Call ResetSprites.
44173 BIT 7,(IX+16) Call PrepareErase if bit 7 of offset 16 of IX is set.
44177 CALL NZ,PrepareErase
44180 RES 6,(IX+16) Reset bit 6 of offset 16 of IX.
44184 EXX Switch to the alternate registers.
44185 BIT 7,(IX+21) Call StepObjectState if bit 7 of offset 21 of IX is set.
44189 CALL NZ,StepObjectState
44192 BIT 7,(IX+3) Call CheckItemPickup if bit 7 of offset 3 of IX is set.
44196 CALL NZ,CheckItemPickup
44199 BIT 4,(IX+16) Jump to UpdateMapObjects_Move if bit 4 of offset 16 of IX is clear.
44203 JR Z,UpdateMapObjects_Move
44205 LD (IX+0),255 Store 255 at offset 0 of IX.
44209 LD (IX+16),0 Store 0 at offset 16 of IX.
44213 JR UpdateMapObjects_Draw Jump to UpdateMapObjects_Draw.
UpdateMapObjects_Move 44215 CALL PrepareDraw Call PrepareDraw.
UpdateMapObjects_Draw 44218 CALL DrawObject Call DrawObject.
44221 LD IY,(44358) Fetch the word at CurrentObject into IY.
44225 BIT 7,(IY+3) Call TrimObjectSprite if bit 7 of offset 3 of IY is clear.
44229 CALL Z,TrimObjectSprite
44232 CALL SetObjectAttributes Call SetObjectAttributes.
44235 LD IX,(44358) Fetch the word at CurrentObject into IX.
44239 CALL CheckObjectHitByShot Call CheckObjectHitByShot.
UpdateMapObjects_Next 44242 POP IX Bring IX back off the stack.
44244 LD BC,26 BC=26.
44247 ADD IX,BC IX gains BC.
44249 POP BC Bring BC back off the stack.
44250 DJNZ UpdateMapObjects_Loop Decrease B and jump to UpdateMapObjects_Loop until none remain.
44252 RET Return.
Prev: 44084 Up: Map Next: 44253