Prev: 96E2 Up: Map Next: 9748
96EF: Choose Fourth Side
Used by the routine at CreatePickup_ThirdSide.
CreatePickup_FourthSide 96EF LD BC,$0030 BC is 30 the first offset for the fourth side.
96F2 LD DE,$00B0 DE is B0 the second offset for the fourth side.
96F5 LD A,$10 A is 10 the direction for the fourth side.
This entry point is used by the routines at CreatePickup, CreatePickup_SecondSide and CreatePickup_ThirdSide.
CreatePickup_Place 96F7 LD L,A Copy the direction into L.
96F8 LD A,($5F9B) Fetch the random number.
96FB RRA Shift it right twice...
96FC RRA
96FD AND %00001111 ...and keep bits 2-5.
96FF OR L Add the direction.
9700 OR %10000000 Set bit 7.
9702 LD (IX+$11),A Store it in field 11 of the pickup.
9705 LD HL,($5CE4) Fetch the view position from 5CE4.
9708 ADD HL,BC Add the first offset.
9709 LD A,($B548) Fetch the first coordinate of the player from B548.
970C LD (IX+$08),A Store it in field 08 of the pickup.
970F DEC A Decrease it by one.
9710 LD B,A Keep it in B.
9711 LD A,($B549) Fetch the second coordinate of the player from B549.
9714 LD (IX+$09),A Store it in field 09 of the pickup.
9717 LD C,A Keep it in C.
9718 AND A Subtract the coordinate of the player from the position.
9719 SBC HL,BC
971B LD (IX+$05),H Store the high byte in field 05 of the pickup.
971E LD (IX+$06),L Store the low byte in field 06 of the pickup.
9721 LD HL,($5CE2) Fetch the view position from ViewPosition.
9724 ADD HL,DE Add the second offset.
9725 AND A Add the coordinate of the player.
9726 ADD HL,BC
9727 LD (IX+$02),H Store the high byte in field 02 of the pickup.
972A LD (IX+$03),L Store the low byte in field 03 of the pickup.
972D LD (IX+$00),$0F Set the type of the pickup to 0F.
9731 CALL SetEntityDefaults Call SetEntityDefaults to set up the rest of the pickup.
9734 LD (IX+$10),$22 Set field 10 of the pickup to 22.
9738 LD (IX+$1D),$10 Set field 1D of the pickup to 10.
973C LD A,$08 A is 08.
973E LD (IX+$0B),A Set field 0B of the pickup to 08.
9741 LD (IX+$0C),A Set field 0C of the pickup to 08.
9744 LD (IX+$0D),A Set field 0D of the pickup to 08.
9747 RET Return.
Prev: 96E2 Up: Map Next: 9748