Prev: C47E Up: Map Next: C4AA
C489: Set up one special-object entry
A table entry is nine bytes: +0 the type, 0 once the object has been collected; +1 to +4 where it starts, as x, y, z and room; +5 to +8 where it is now, in the same order. Here the type is written and the starting position copied to the current one.
Input
HL the entry
E the rotating kind
init_obj_loop C489 LD A,E type 96 + (kind mod 8)
C48A AND $07
C48C OR $60
C48E LD (HL),A
C48F INC HL on to +1, and the next kind
C490 INC E
C491 PUSH DE copy +1..+4, where it starts, to +5..+8, where it is
C492 EX DE,HL
C493 LD HL,$0004
C496 ADD HL,DE
C497 EX DE,HL
C498 LD BC,$0004
C49B LDIR
C49D EX DE,HL
C49E PUSH HL until the sprite table at sprite_tbl, which follows the last entry
C49F LD BC,sprite_tbl
C4A2 AND A
C4A3 SBC HL,BC
C4A5 POP HL
C4A6 POP DE
C4A7 JR C,init_obj_loop
C4A9 RET
Prev: C47E Up: Map Next: C4AA