Prev: 9341 Up: Map Next: 93F2
938D: Update Object
Used by the routine at UpdateChasingObject.
Part of UpdateChasingObject. Redraws the object, moves it, counts down its lifetime and gives it a position.
Input
IX Address of the object
UpdateObject 938D CALL ResetSprites Reset the collision state.
9390 BIT 7,(IX+$10) Test bit 7 of the flags of the object.
9394 CALL NZ,PrepareErase Call PrepareErase if it is set.
9397 RES 6,(IX+$10) Clear bit 6 of the flags of the object.
939B EXX Switch registers.
939C CALL AccelerateObject Move the object.
939F CALL SetFacing Set the facing of the object.
93A2 DEC (IX+$15) Count down the lifetime of the object.
93A5 JR NZ,UpdateObject_Flags Jump to UpdateObject_Flags if it has not run out.
UpdateObject_Remove 93A7 LD (IX+$00),$FF Free the slot.
93AB JP UpdateObject_Finish Jump to UpdateObject_Finish.
UpdateObject_Flags 93AE BIT 4,(IX+$10) Jump to UpdateObject_Remove if bit 4 of the flags of the object is set.
93B2 JR NZ,UpdateObject_Remove
93B4 LD BC,$0B10 BC=0B10.
93B7 CALL MoveObjectBackAndForth Nudge the object and reverse its speeds.
93BA LD HL,($CE57) Fetch the map position from MapPosition.
93BD LD B,$00 Clear B.
93BF LD A,L Fetch the map column.
93C0 CP (IX+$01) Compare it with the map column of the object.
93C3 JR Z,UpdateObject_Zone Jump to UpdateObject_Zone if they are the same.
93C5 INC B Add two to B.
93C6 INC B
UpdateObject_Zone 93C7 LD A,H Fetch the map zone.
93C8 CP (IX+$04) Compare it with the map zone of the object.
93CB JR Z,UpdateObject_Table Jump to UpdateObject_Table if they are the same.
93CD INC B Add one to B.
UpdateObject_Table 93CE LD A,B A=B.
93CF LD HL,$DC91 Use the table at VisibleTiles.
93D2 CALL AddAToHL Add the offset to the address.
93D5 LD A,(HL) Fetch the entry.
93D6 CP $3E Jump to UpdateObject_Draw if it is not 3E.
93D8 JR NZ,UpdateObject_Draw
93DA LD A,(IX+$02) Fetch the horizontal position of the object.
93DD CP $18 Jump to UpdateObject_Draw if it is lower than 18.
93DF JR C,UpdateObject_Draw
93E1 CP $D8 Jump to UpdateObject_Draw if it is D8 or higher.
93E3 JR NC,UpdateObject_Draw
93E5 LD (IX+$05),$6A Set the vertical position of the object to 6A.
UpdateObject_Draw 93E9 CALL PrepareDraw Draw the object.
UpdateObject_Finish 93EC CALL DrawObject Call DrawObject.
93EF JP SetObjectAttributes Jump to SetObjectAttributes.
Prev: 9341 Up: Map Next: 93F2