Prev: 38544 Up: Map Next: 38614
38587: Create Pickup
Used by the routine at UpdateSpawnPoints.
Tries to create a pickup in one of the two entity slots starting at 46514. The pickup is placed beside the view, on the side chosen by the low bits of a random number, at a position relative to the player, and it is given the type 15.
CreatePickup 38587 LD IX,46514 Point IX at the first of the two entity slots.
38591 LD B,2 Set the number of slots to look at in B to 2.
38593 CALL FindFreeEntity Call FindFreeEntity to find a free slot.
38596 RET NZ Return if there is no free slot.
38597 CALL ClearEntity Call ClearEntity to clear the slot.
38600 LD A,(24475) Fetch the random number from 24475.
38603 AND %00000011 Keep only bits 0-1, to choose the side.
38605 JR NZ,CreatePickup_SecondSide Jump to CreatePickup_SecondSide unless the first side is chosen.
38607 LD DE,64 DE is 64 the offset for the first side.
38610 LD C,E E moves into C.
38611 LD B,D D moves into B, so the offset is also BC.
38612 JR CreatePickup_Place Jump to CreatePickup_Place.
Prev: 38544 Up: Map Next: 38614