![]() |
Routines |
| Prev: 44673 | Up: Map | Next: 44863 |
|
Handler for the object types 28 to 43 the plants (mushrooms, pods, flytraps, weeds and bellflowers) that stand in some of the rooms. Each plant has two frames, and bit 0 of its type picks the frame.
A plant is set up the first time that it is handled after its room has been drawn (see Handle_Plant_Set_Up). After that it makes Sabreman tumble if he touches it, by setting bit 7 of his redraw flags (see Start_Tumbling).
|
||||||||
| Handle_Plant | 44729 | BIT 0,(IX+15) | Jump to Handle_Plant_Set_Up if the plant has just been created (bit 0 of the redraw flags is set). | |||||
| 44733 | JR NZ,Handle_Plant_Set_Up | |||||||
| 44735 | CALL StoreEntity | Save the state of the plant (see StoreEntity). | ||||||
|
Remove the plant if Sabreman is not in the same room.
|
||||||||
| 44738 | LD A,(36636) | Fetch the room x of Sabreman. | ||||||
| 44741 | CP (IX+2) | Jump to Handle_Plant_Remove if the plant is not in the same room x. | ||||||
| 44744 | JR NZ,Handle_Plant_Remove | |||||||
| 44746 | LD A,(36638) | Fetch the room y of Sabreman. | ||||||
| 44749 | CP (IX+4) | Jump to Handle_Plant_Remove if the plant is not in the same room y. | ||||||
| 44752 | JR NZ,Handle_Plant_Remove | |||||||
|
See if Sabreman is touching the plant.
|
||||||||
| 44754 | LD A,(36637) | Fetch the y position of Sabreman. | ||||||
| 44757 | SUB (IX+3) | Subtract the y position of the plant. | ||||||
| 44760 | CP 20 | Jump to Handle_Plant_Animate if Sabreman is 20 or more pixels below the plant, or above it. | ||||||
| 44762 | JR NC,Handle_Plant_Animate | |||||||
| 44764 | LD A,(36635) | Fetch the x position of Sabreman. | ||||||
| 44767 | SUB (IX+1) | Subtract the x position of the plant. | ||||||
| 44770 | SUB 4 | Subtract 4 to allow for the difference between the widths of the sprites. | ||||||
| 44772 | JP P,Handle_Plant_Test_Width | Jump to Handle_Plant_Test_Width if the difference is positive. | ||||||
| 44775 | NEG | Make the difference positive. | ||||||
| Handle_Plant_Test_Width | 44777 | CP 20 | Jump to Handle_Plant_Animate if Sabreman is 20 or more pixels away from the plant sideways. | |||||
| 44779 | JR NC,Handle_Plant_Animate | |||||||
| 44781 | LD A,(36649) | Fetch the redraw flags of Sabreman. | ||||||
| 44784 | OR %10000000 | Set bit 7, which makes him tumble. | ||||||
| 44786 | LD (36649),A | Store the redraw flags of Sabreman. | ||||||
|
Choose the frame of the plant from bit 3 of a counter.
|
||||||||
| Handle_Plant_Animate | 44789 | INC (IX+6) | Add one to the animation counter of the plant. | |||||
| 44792 | LD A,(IX+6) | Fetch the animation counter of the plant. | ||||||
| 44795 | RRA | Shift bit 3 of the counter into bit 0 (rotate right three times). | ||||||
| 44796 | RRA | |||||||
| 44797 | RRA | |||||||
| 44798 | AND %00000001 | Keep only the bit. | ||||||
| 44800 | LD B,A | Keep the frame number in B. | ||||||
| 44801 | LD A,(IX+0) | Fetch the type of the plant. | ||||||
| 44804 | AND %11111110 | Clear bit 0 of the type of the plant. | ||||||
| 44806 | ADD A,B | Add the frame number to make the new type. | ||||||
| 44807 | LD (IX+0),A | Store the new type. | ||||||
| 44810 | JP Update_Object_Sprite | Jump to Update_Object_Sprite. | ||||||
| Handle_Plant_Remove | 44813 | LD (IX+0),0 | Remove the plant by setting its type to zero. | |||||
| 44817 | RET | Return. | ||||||
|
Set up a new plant. Its type depends on its x position and on the room, and it takes its room from Sabreman.
|
||||||||
| Handle_Plant_Set_Up | 44818 | LD A,(36636) | Fetch the room x of Sabreman. | |||||
| 44821 | LD (IX+2),A | Store it as the room x of the plant. | ||||||
| 44824 | LD A,(36638) | Fetch the room y of Sabreman. | ||||||
| 44827 | LD (IX+4),A | Store it as the room y of the plant. | ||||||
| 44830 | LD (IX+5),69 | Set the attribute to 69 (bright cyan). | ||||||
| 44834 | LD A,(IX+1) | Fetch the x position of the plant. | ||||||
| 44837 | RRA | Divide it by four. | ||||||
| 44838 | RRA | |||||||
| 44839 | ADD A,(IX+2) | Add the room x. | ||||||
| 44842 | AND %00001110 | Keep only bits 1 to 3, so that the type is even. | ||||||
| 44844 | ADD A,28 | Add 28 the first type of a plant. | ||||||
| 44846 | LD (IX+0),A | Store it as the type of the plant. | ||||||
| 44849 | LD (IX+6),A | Store it as the animation counter of the plant. | ||||||
| 44852 | RRA | Divide the type by two. | ||||||
| 44853 | AND %00000011 | Keep only two bits. | ||||||
| 44855 | ADD A,66 | Add 66 to make a bright attribute. | ||||||
| 44857 | LD (IX+5),A | Store it as the attribute of the plant. | ||||||
| 44860 | JP Update_Object_Sprite | Jump to Update_Object_Sprite. | ||||||
| Prev: 44673 | Up: Map | Next: 44863 |