Prev: 38626 Up: Map Next: 38728
38639: Choose Fourth Side
Used by the routine at CreatePickup_ThirdSide.
CreatePickup_FourthSide 38639 LD BC,48 BC is 48 the first offset for the fourth side.
38642 LD DE,176 DE is 176 the second offset for the fourth side.
38645 LD A,16 A is 16 the direction for the fourth side.
This entry point is used by the routines at CreatePickup, CreatePickup_SecondSide and CreatePickup_ThirdSide.
CreatePickup_Place 38647 LD L,A Copy the direction into L.
38648 LD A,(24475) Fetch the random number.
38651 RRA Shift it right twice...
38652 RRA
38653 AND %00001111 ...and keep bits 2-5.
38655 OR L Add the direction.
38656 OR %10000000 Set bit 7.
38658 LD (IX+17),A Store it in field 17 of the pickup.
38661 LD HL,(23780) Fetch the view position from 23780.
38664 ADD HL,BC Add the first offset.
38665 LD A,(46408) Fetch the first coordinate of the player from 46408.
38668 LD (IX+8),A Store it in field 8 of the pickup.
38671 DEC A Decrease it by one.
38672 LD B,A Keep it in B.
38673 LD A,(46409) Fetch the second coordinate of the player from 46409.
38676 LD (IX+9),A Store it in field 9 of the pickup.
38679 LD C,A Keep it in C.
38680 AND A Subtract the coordinate of the player from the position.
38681 SBC HL,BC
38683 LD (IX+5),H Store the high byte in field 5 of the pickup.
38686 LD (IX+6),L Store the low byte in field 6 of the pickup.
38689 LD HL,(23778) Fetch the view position from ViewPosition.
38692 ADD HL,DE Add the second offset.
38693 AND A Add the coordinate of the player.
38694 ADD HL,BC
38695 LD (IX+2),H Store the high byte in field 2 of the pickup.
38698 LD (IX+3),L Store the low byte in field 3 of the pickup.
38701 LD (IX+0),15 Set the type of the pickup to 15.
38705 CALL SetEntityDefaults Call SetEntityDefaults to set up the rest of the pickup.
38708 LD (IX+16),34 Set field 16 of the pickup to 34.
38712 LD (IX+29),16 Set field 29 of the pickup to 16.
38716 LD A,8 A is 8.
38718 LD (IX+11),A Set field 11 of the pickup to 8.
38721 LD (IX+12),A Set field 12 of the pickup to 8.
38724 LD (IX+13),A Set field 13 of the pickup to 8.
38727 RET Return.
Prev: 38626 Up: Map Next: 38728