Prev: 58109 Up: Map Next: 58182
58140: Build Entity Spawn Record
Used by the routine at Process_Tracked_Enemy_Entity.
Reads the direction byte from (IX+2), indexes the direction animation offset table at Direction_Animation_Offset_Table by direction × 4, and writes five bytes to the entity spawn buffer at 50449: the animation type byte (40 + direction), the direction-adjusted Y coordinate, the direction-adjusted X coordinate, and two further table bytes via two LDI instructions. Called from Process_Tracked_Enemy_Entity.
Build_Entity_Spawn_Record 58140 LD HL,59311 Index the direction animation table at Direction_Animation_Offset_Table and write the animation type byte (40 + direction) to the spawn buffer at 50449.
58143 LD D,0
58145 LD A,(IX+2)
58148 AND 7
58150 LD E,A
58151 SLA E
58153 SLA E
58155 ADD HL,DE Write the direction-adjusted Y and X coordinates to the spawn buffer.
58156 LD DE,50449
58159 ADD A,40
58161 LD (DE),A
58162 INC DE
58163 LD A,(IX+3)
58166 ADD A,(HL)
58167 LD (DE),A
58168 INC HL
58169 INC DE Copy two further direction table bytes to the spawn buffer via LDI×2.
58170 LD A,(IX+5)
58173 ADD A,(HL)
58174 LD (DE),A
58175 INC HL
58176 INC DE
58177 LDI
58179 LDI
58181 RET Return.
Prev: 58109 Up: Map Next: 58182