Prev: 37697 Up: Map Next: 37874
37773: 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 37773 CALL ResetSprites Reset the collision state.
37776 BIT 7,(IX+16) Test bit 7 of the flags of the object.
37780 CALL NZ,PrepareErase Call PrepareErase if it is set.
37783 RES 6,(IX+16) Clear bit 6 of the flags of the object.
37787 EXX Switch registers.
37788 CALL AccelerateObject Move the object.
37791 CALL SetFacing Set the facing of the object.
37794 DEC (IX+21) Count down the lifetime of the object.
37797 JR NZ,UpdateObject_Flags Jump to UpdateObject_Flags if it has not run out.
UpdateObject_Remove 37799 LD (IX+0),255 Free the slot.
37803 JP UpdateObject_Finish Jump to UpdateObject_Finish.
UpdateObject_Flags 37806 BIT 4,(IX+16) Jump to UpdateObject_Remove if bit 4 of the flags of the object is set.
37810 JR NZ,UpdateObject_Remove
37812 LD BC,2832 BC=2832.
37815 CALL MoveObjectBackAndForth Nudge the object and reverse its speeds.
37818 LD HL,(52823) Fetch the map position from MapPosition.
37821 LD B,0 Clear B.
37823 LD A,L Fetch the map column.
37824 CP (IX+1) Compare it with the map column of the object.
37827 JR Z,UpdateObject_Zone Jump to UpdateObject_Zone if they are the same.
37829 INC B Add two to B.
37830 INC B
UpdateObject_Zone 37831 LD A,H Fetch the map zone.
37832 CP (IX+4) Compare it with the map zone of the object.
37835 JR Z,UpdateObject_Table Jump to UpdateObject_Table if they are the same.
37837 INC B Add one to B.
UpdateObject_Table 37838 LD A,B A=B.
37839 LD HL,56465 Use the table at VisibleTiles.
37842 CALL AddAToHL Add the offset to the address.
37845 LD A,(HL) Fetch the entry.
37846 CP 62 Jump to UpdateObject_Draw if it is not 62.
37848 JR NZ,UpdateObject_Draw
37850 LD A,(IX+2) Fetch the horizontal position of the object.
37853 CP 24 Jump to UpdateObject_Draw if it is lower than 24.
37855 JR C,UpdateObject_Draw
37857 CP 216 Jump to UpdateObject_Draw if it is 216 or higher.
37859 JR NC,UpdateObject_Draw
37861 LD (IX+5),106 Set the vertical position of the object to 106.
UpdateObject_Draw 37865 CALL PrepareDraw Draw the object.
UpdateObject_Finish 37868 CALL DrawObject Call DrawObject.
37871 JP SetObjectAttributes Jump to SetObjectAttributes.
Prev: 37697 Up: Map Next: 37874