Prev: 28903 Up: Map Next: 29107
28970: Initialise Object Slots
Used by the routine at Initialise_Next_Phase.
Fills 21 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 28970 LD IX,60160 Point IX at Object_Slots.
28974 LD DE,11 Set the slot stride to 11 in DE.
28977 LD B,21 Set the slot counter to 21 in B.
Write one object slot.
Initialise_Object_Slots_Write 28979 LD HL,42350 Write 42350 to the slot handler.
28982 LD (IX+9),L
28985 LD (IX+10),H
28988 XOR A Write 0 to the X, Y and low depth bytes.
28989 LD (IX+1),A
28992 LD (IX+2),A
28995 LD (IX+3),A
28998 LD (IX+4),A
29001 LD (IX+5),A
29004 LD (IX+6),18 Write 18 to the depth high byte.
29008 LD (IX+0),1 Set the occupied flag.
29012 LD A,(57847) Write *Model_Letter to the slot.
29015 LD (IX+7),A
29018 ADD IX,DE Advance the slot pointer by 11.
29020 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.
29022 LD IX,58496 Point IX at Long_Object_Slots.
29026 LD DE,6 Set the slot stride to 6 in DE.
29029 LD B,21 Set the slot counter to 21 in B.
Write random deltas into one slot.
Initialise_Object_Slots_Deltas 29031 EXX Switch to the shadow registers.
29032 LD A,63 Call Random_Number and clamp the maximum value to 63.
29034 CALL Random_Number
29037 SUB 32 Subtract 32 from the result.
29039 CALL Fetch_Sine_Cosine Call Fetch_Sine_Cosine.
29042 LD HL,(57850) Call Random_Number_Range with the range at *57850.
29045 CALL Random_Number_Range
29048 NEG Negate the result and sign-extend it to HL.
29050 LD L,A
29051 LD H,255
29053 ADD HL,HL Multiply the result by four.
29054 ADD HL,HL
29055 EX DE,HL Copy the result to DE.
29056 LD HL,0 Set the second coordinate to 0 in HL.
29059 CALL Rotate_Coordinates Call Rotate_Coordinates.
29062 LD (IX+4),E Write the depth delta to the slot.
29065 LD (IX+5),D
29068 PUSH HL Stash the rotated second coordinate on the stack.
29069 LD A,63 Call Random_Number and clamp the maximum value to 63.
29071 CALL Random_Number
29074 ADD A,A Multiply the result by four.
29075 ADD A,A
29076 CALL Fetch_Sine_Cosine Call Fetch_Sine_Cosine.
29079 POP HL Restore the rotated second coordinate from the stack.
29080 LD DE,0 Set the first coordinate to 0 in DE.
29083 CALL Rotate_Coordinates Call Rotate_Coordinates.
29086 LD (IX+0),L Write the X delta to the slot.
29089 LD (IX+1),H
29092 LD (IX+2),E Write the Y delta to the slot.
29095 LD (IX+3),D
29098 EXX Switch back.
29099 ADD IX,DE Advance the slot pointer by the slot stride.
29101 DJNZ Initialise_Object_Slots_Deltas Decrease the slot counter by one and loop back to Initialise_Object_Slots_Deltas until it is zero.
29103 CALL Add_Object_Deltas Call Add_Object_Deltas.
29106 RET Return.
Prev: 28903 Up: Map Next: 29107