Prev: CE5A Up: Map Next: CEE2
CE84: 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 05 0D or 0E and is in view, its screen position is stored in the first two bytes of its extra record, and bit 7 of field 09 of the extra record is set to show that it is visible.
UpdateExtraRecords CE84 LD IY,$B708 Point IY at the first extra record.
CE88 LD IX,$B540 Point IX at Entities.
CE8C LD B,$0C Set the number of entities to 0C.
UpdateExtraRecords_Loop CE8E LD (IY+$09),$00 Mark the extra record as not in use.
CE92 PUSH BC Save the entity count.
CE93 PUSH IX Save the entity.
CE95 LD A,(IX+$00) Fetch the type of the entity.
CE98 AND A Test it.
CE99 JR Z,UpdateExtraRecords_Next Jump to UpdateExtraRecords_Next if the entity is not in use.
CE9B CP $05 Jump to UpdateExtraRecords_Next if the entity is a puff.
CE9D JR Z,UpdateExtraRecords_Next
CE9F CP $0D Jump to UpdateExtraRecords_Next if the entity is a sparkle.
CEA1 JR Z,UpdateExtraRecords_Next
CEA3 CP $0E Jump to UpdateExtraRecords_Next if the entity is a shot.
CEA5 JR Z,UpdateExtraRecords_Next
CEA7 CP $0F Jump to UpdateExtraRecords_Skip unless the entity is a pickup.
CEA9 JR NZ,UpdateExtraRecords_Skip
CEAB RES 6,(IX+$1E) Reset bit 6 of field 1E of the pickup.
CEAF LD A,(IX+$09) Fetch the low byte of the z coordinate.
CEB2 AND A Test it.
CEB3 JR Z,UpdateExtraRecords_Next Jump to UpdateExtraRecords_Next if it is zero.
UpdateExtraRecords_Skip CEB5 CALL UpdateExtraRecord Set up the extra record from the entity.
CEB8 JR NZ,UpdateExtraRecords_Next Jump to UpdateExtraRecords_Next if the record was not set up.
CEBA CALL ProjectEntity Work out the screen position of the entity.
CEBD BIT 7,(IX+$01) Jump to UpdateExtraRecords_Next if the entity is hidden.
CEC1 JR NZ,UpdateExtraRecords_Next
CEC3 LD A,(IX+$0E) Fetch the column of the entity on the screen.
CEC6 LD (IY+$00),A Store it in the first byte of the extra record.
CEC9 LD A,(IX+$0F) Fetch the row of the entity on the screen.
CECC LD (IY+$01),A Store it in the second byte of the extra record.
CECF LD (IY+$09),$80 Mark the extra record as in use.
UpdateExtraRecords_Next CED3 POP IX Restore the entity.
CED5 LD BC,$0026 Set the size of an entity to 26.
CED8 ADD IX,BC Move on to the next entity.
CEDA LD C,$0D Set the size of an extra record to 0D.
CEDC ADD IY,BC Move on to the next extra record.
CEDE POP BC Restore the entity count.
CEDF DJNZ UpdateExtraRecords_Loop Decrease it and jump back until every entity has been updated.
CEE1 RET Return.
Prev: CE5A Up: Map Next: CEE2