Prev: 70E7 Up: Map Next: 71B3
712A: Initialise Object Slots
Used by the routine at Initialise_Next_Phase.
Fills 15 slots at Object_Slots, writes random deltas to Long_Object_Slots, then calls Add_Object_Deltas.
Fill the slots at Object_Slots.
Initialise_Object_Slots 712A LD IX,$EB00 Point IX at Object_Slots.
712E LD DE,$000B Set the slot stride to 0B in DE.
7131 LD B,$15 Set the slot counter to 15 in B.
Write one object slot.
Initialise_Object_Slots_Write 7133 LD HL,$A56E Write A56E to the slot handler.
7136 LD (IX+$09),L
7139 LD (IX+$0A),H
713C XOR A Write 00 to the X, Y and low depth bytes.
713D LD (IX+$01),A
7140 LD (IX+$02),A
7143 LD (IX+$03),A
7146 LD (IX+$04),A
7149 LD (IX+$05),A
714C LD (IX+$06),$12 Write 12 to the depth high byte.
7150 LD (IX+$00),$01 Set the occupied flag.
7154 LD A,($E1F7) Write *Model_Letter to the slot.
7157 LD (IX+$07),A
715A ADD IX,DE Advance the slot pointer by 0B.
715C DJNZ Initialise_Object_Slots_Write Decrease the slot counter by one and loop back to Initialise_Object_Slots_Write until it is zero.
Fill the deltas at Long_Object_Slots.
715E LD IX,$E480 Point IX at Long_Object_Slots.
7162 LD DE,$0006 Set the slot stride to 06 in DE.
7165 LD B,$15 Set the slot counter to 15 in B.
Write random deltas into one slot.
Initialise_Object_Slots_Deltas 7167 EXX Switch to the shadow registers.
7168 LD A,$3F Call Random_Number and clamp the maximum value to 3F.
716A CALL Random_Number
716D SUB $20 Subtract 20 from the result.
716F CALL Fetch_Sine_Cosine Call Fetch_Sine_Cosine.
7172 LD HL,($E1FA) Call Random_Number_Range with the range at *E1FA.
7175 CALL Random_Number_Range
7178 NEG Negate the result and sign-extend it to HL.
717A LD L,A
717B LD H,$FF
717D ADD HL,HL Multiply the result by four.
717E ADD HL,HL
717F EX DE,HL Copy the result to DE.
7180 LD HL,$0000 Set the second coordinate to 00 in HL.
7183 CALL Rotate_Coordinates Call Rotate_Coordinates.
7186 LD (IX+$04),E Write the depth delta to the slot.
7189 LD (IX+$05),D
718C PUSH HL Stash the rotated second coordinate on the stack.
718D LD A,$3F Call Random_Number and clamp the maximum value to 3F.
718F CALL Random_Number
7192 ADD A,A Multiply the result by four.
7193 ADD A,A
7194 CALL Fetch_Sine_Cosine Call Fetch_Sine_Cosine.
7197 POP HL Restore the rotated second coordinate from the stack.
7198 LD DE,$0000 Set the first coordinate to 00 in DE.
719B CALL Rotate_Coordinates Call Rotate_Coordinates.
719E LD (IX+$00),L Write the X delta to the slot.
71A1 LD (IX+$01),H
71A4 LD (IX+$02),E Write the Y delta to the slot.
71A7 LD (IX+$03),D
71AA EXX Switch back.
71AB ADD IX,DE Advance the slot pointer by the slot stride.
71AD DJNZ Initialise_Object_Slots_Deltas Decrease the slot counter by one and loop back to Initialise_Object_Slots_Deltas until it is zero.
71AF CALL Add_Object_Deltas Call Add_Object_Deltas.
71B2 RET Return.
Prev: 70E7 Up: Map Next: 71B3