Prev: AC34 Up: Map Next: ACDD
AC60: 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 AC60 LD A,($5C3C) The scroll-in flag.
AC63 AND A Call UpdateCrystalStack if A is zero.
AC64 CALL Z,UpdateCrystalStack
AC67 LD IX,$A80B The map object slots.
AC6B LD B,$06 B=06.
UpdateMapObjects_Loop AC6D PUSH BC Stash BC on the stack.
AC6E PUSH IX Stash IX on the stack.
AC70 LD A,(IX+$00) Read offset 00 of IX.
AC73 CP $FF Jump to UpdateMapObjects_Next if A is FF.
AC75 JR Z,UpdateMapObjects_Next
AC77 BIT 7,(IX+$03) Jump to UpdateMapObjects_Next2 if bit 7 of offset 03 of IX is set.
AC7B JR NZ,UpdateMapObjects_Next2
AC7D LD A,(IX+$18) Read offset 18 of IX.
AC80 AND %00001110 Keep the bits of A that are set in 0E.
AC82 SRL A Shift A right.
AC84 LD ($5C1C),A The bits that fire a shot from the object.
AC87 CALL NZ,FireShotWhenHit Call FireShotWhenHit if the zero flag is clear.
UpdateMapObjects_Next2 AC8A CALL ResetSprites Call ResetSprites.
AC8D BIT 7,(IX+$10) Call PrepareErase if bit 7 of offset 10 of IX is set.
AC91 CALL NZ,PrepareErase
AC94 RES 6,(IX+$10) Reset bit 6 of offset 10 of IX.
AC98 EXX Switch to the alternate registers.
AC99 BIT 7,(IX+$15) Call StepObjectState if bit 7 of offset 15 of IX is set.
AC9D CALL NZ,StepObjectState
ACA0 BIT 7,(IX+$03) Call CheckItemPickup if bit 7 of offset 03 of IX is set.
ACA4 CALL NZ,CheckItemPickup
ACA7 BIT 4,(IX+$10) Jump to UpdateMapObjects_Move if bit 4 of offset 10 of IX is clear.
ACAB JR Z,UpdateMapObjects_Move
ACAD LD (IX+$00),$FF Store FF at offset 00 of IX.
ACB1 LD (IX+$10),$00 Store 00 at offset 10 of IX.
ACB5 JR UpdateMapObjects_Draw Jump to UpdateMapObjects_Draw.
UpdateMapObjects_Move ACB7 CALL PrepareDraw Call PrepareDraw.
UpdateMapObjects_Draw ACBA CALL DrawObject Call DrawObject.
ACBD LD IY,($AD46) Fetch the word at CurrentObject into IY.
ACC1 BIT 7,(IY+$03) Call TrimObjectSprite if bit 7 of offset 03 of IY is clear.
ACC5 CALL Z,TrimObjectSprite
ACC8 CALL SetObjectAttributes Call SetObjectAttributes.
ACCB LD IX,($AD46) Fetch the word at CurrentObject into IX.
ACCF CALL CheckObjectHitByShot Call CheckObjectHitByShot.
UpdateMapObjects_Next ACD2 POP IX Bring IX back off the stack.
ACD4 LD BC,$001A BC=1A.
ACD7 ADD IX,BC IX gains BC.
ACD9 POP BC Bring BC back off the stack.
ACDA DJNZ UpdateMapObjects_Loop Decrease B and jump to UpdateMapObjects_Loop until none remain.
ACDC RET Return.
Prev: AC34 Up: Map Next: ACDD