Prev: 52826 Up: Map Next: 52962
52868: Update Extra Records
Used by the routine at RunFrame.
Updates the extra record of each of the entities, with UpdateExtraRecord. If the entity is in use, is not of type 5 13 or 14 and is in view, its screen position is stored in the first two bytes of its extra record, and bit 7 of field 9 of the extra record is set to show that it is visible.
UpdateExtraRecords 52868 LD IY,46856 Point IY at the first extra record.
52872 LD IX,46400 Point IX at Entities.
52876 LD B,12 Set the number of entities to 12.
UpdateExtraRecords_Loop 52878 LD (IY+9),0 Mark the extra record as not in use.
52882 PUSH BC Save the entity count.
52883 PUSH IX Save the entity.
52885 LD A,(IX+0) Fetch the type of the entity.
52888 AND A Test it.
52889 JR Z,UpdateExtraRecords_Next Jump to UpdateExtraRecords_Next if the entity is not in use.
52891 CP 5 Jump to UpdateExtraRecords_Next if the entity is a puff.
52893 JR Z,UpdateExtraRecords_Next
52895 CP 13 Jump to UpdateExtraRecords_Next if the entity is a sparkle.
52897 JR Z,UpdateExtraRecords_Next
52899 CP 14 Jump to UpdateExtraRecords_Next if the entity is a shot.
52901 JR Z,UpdateExtraRecords_Next
52903 CP 15 Jump to UpdateExtraRecords_Skip unless the entity is a pickup.
52905 JR NZ,UpdateExtraRecords_Skip
52907 RES 6,(IX+30) Reset bit 6 of field 30 of the pickup.
52911 LD A,(IX+9) Fetch the low byte of the z coordinate.
52914 AND A Test it.
52915 JR Z,UpdateExtraRecords_Next Jump to UpdateExtraRecords_Next if it is zero.
UpdateExtraRecords_Skip 52917 CALL UpdateExtraRecord Set up the extra record from the entity.
52920 JR NZ,UpdateExtraRecords_Next Jump to UpdateExtraRecords_Next if the record was not set up.
52922 CALL ProjectEntity Work out the screen position of the entity.
52925 BIT 7,(IX+1) Jump to UpdateExtraRecords_Next if the entity is hidden.
52929 JR NZ,UpdateExtraRecords_Next
52931 LD A,(IX+14) Fetch the column of the entity on the screen.
52934 LD (IY+0),A Store it in the first byte of the extra record.
52937 LD A,(IX+15) Fetch the row of the entity on the screen.
52940 LD (IY+1),A Store it in the second byte of the extra record.
52943 LD (IY+9),128 Mark the extra record as in use.
UpdateExtraRecords_Next 52947 POP IX Restore the entity.
52949 LD BC,38 Set the size of an entity to 38.
52952 ADD IX,BC Move on to the next entity.
52954 LD C,13 Set the size of an extra record to 13.
52956 ADD IY,BC Move on to the next extra record.
52958 POP BC Restore the entity count.
52959 DJNZ UpdateExtraRecords_Loop Decrease it and jump back until every entity has been updated.
52961 RET Return.
Prev: 52826 Up: Map Next: 52962