Routines |
Prev: F812 | Up: Map | Next: F879 |
Used by the routine at 81AE.
|
||||
F814 | LD HL,($F812) | Point HL at the next food. | ||
F817 | LD A,(IY+$0F) | Get the current room in A. | ||
F81A | CP (HL) | Is the food in this room? | ||
F81B | JR Z,$F823 | Jump foward if there is. | ||
F81D | LD DE,$0015 | Point to the second food table. | ||
F820 | ADD HL,DE | |||
F821 | CP (HL) | Is the food in this room? | ||
F822 | RET NZ | Return if it isn't - there's no food here. | ||
There's food in the room, so draw it.
|
||||
F823 | INC HL | Put the x co-ordinate in E. | ||
F824 | LD E,(HL) | |||
F825 | INC HL | Put the y co-ordinate in D. | ||
F826 | LD D,(HL) | |||
F827 | INC HL | Put the object number in B. | ||
F828 | LD A,(HL) | |||
F829 | LD B,A | |||
F82A | LD ($A838),DE | Copy the position to the scratch buffer at A838. | ||
F82E | CALL $A83D | Draw the food. | ||
F831 | LD A,(IY+$05) | Put the x co-ordinate in A. | ||
F834 | SUB E | Is it near enough the food? | ||
F835 | SUB $04 | |||
F837 | CP $F8 | |||
F839 | RET C | Return if not. | ||
F83A | LD A,(IY+$0A) | Get the y co-ordinate. | ||
F83D | SUB D | Is it near enough the food? | ||
F83E | ADD A,$0C | |||
F840 | CP $F8 | |||
F842 | RET C | Return if not. | ||
There's food here, and the player has picked it up.
|
||||
F843 | LD HL,($F812) | Move HL to the next food entry. | ||
F846 | INC HL | |||
F847 | INC HL | |||
F848 | INC HL | |||
F849 | INC HL | |||
F84A | LD A,(HL) | Is this the end of the list? | ||
F84B | CP $FF | If so, set it back to the beginning. (F7E9) | ||
F84D | JR NZ,$F852 | |||
F84F | LD HL,$F7E9 | |||
F852 | LD ($F812),HL | Store the next location of food back in memory. | ||
F855 | LD A,(IY+$19) | Get the ID of favourite food for this player. (BC80) | ||
F858 | CP B | Does it match the ID of this food? | ||
F859 | JR Z,$F864 | If so, jump forward to restore endurance to full strength. | ||
F85B | LD A,(IY+$14) | Get the endurance. | ||
F85E | ADD A,$20 | Add 20 to a maximum of 80. | ||
F860 | CP $80 | |||
F862 | JR C,$F866 | |||
F864 | LD A,$80 | |||
F866 | LD (IY+$14),A | Store this new endurance value. | ||
F869 | CALL $E36D | Update the endurance and lives display. | ||
F86C | LD BC,$643C | Play a "picked up food" sound effect. | ||
F86F | LD DE,$0128 | |||
F872 | LD HL,$0103 | |||
F875 | CALL $E3D3 | |||
F878 | RET | Return. |
Prev: F812 | Up: Map | Next: F879 |