← C61D Spawn objects from the current level's wave script Map C76D → Fill the free inhabitant slots with wheels
C73D: Initialize an object from the spawn tables
Initializes a freshly allocated logic record, laid out as the secondary object's logic record, from the type's initial heading, speed and singleton flag. It clears the record's counters and animation, and sets the state to spawn.
Input
B object type (0 to $13)
IY address of the object's 16-byte record
spawn_object_init C73D LD E,B The heading comes from the type's entry in the initial-heading table.
C73E LD D,$00
C740 LD HL,spawn_heading_table
C743 ADD HL,DE
C744 LD A,(HL)
C745 LD (IY+$00),A
C748 LD HL,spawn_speed_table The movement speed comes from the type's own entry.
C74B ADD HL,DE
C74C LD A,(HL)
C74D LD (IY+$01),A
C750 LD HL,spawn_singleton_table The singleton flag comes from the type's entry; non-zero blocks a second live instance.
C753 ADD HL,DE
C754 LD A,(HL)
C755 LD (IY+$0D),A
C758 LD (IY+$09),$00 Clear the two counters and the animation frame.
C75C LD (IY+$0A),$00
C760 LD (IY+$0B),$00
C764 LD (IY+$0E),$00 Clear the animation timer and set the state to spawn, the state the spawn animation runs from.
C768 LD (IY+$0C),$01
C76C RET
← C61D Spawn objects from the current level's wave script Map C76D → Fill the free inhabitant slots with wheels
Fork me on GitHub