Prev: 8C59 Up: Map Next: 8C8C
8C63: The handler for a piece of food
Sprites $50 to $57 are food, and ACTOR_HANDLERS sends all eight of them here. Every frame it asks whether the player is standing on it; if not, it just draws itself and that is the whole of its behaviour.
Eating is worth $40 -- a quarter of the bar -- and the total is held at $F0 rather than being allowed to wrap, so arriving at a roast with almost full health wastes most of it. The two branches before the cap catch the carry as well as the compare, because $5E28 plus $40 can pass $FF.
Input
IX The food
EAT_FOOD 8C63 CALL ACTOR_TO_WORKSPACE Is the player on it?
8C66 CALL NEAR_PLAYER
8C69 JR C,EAT_FOOD_0 No -- draw it and do nothing else.
8C6B JP DRAW_AT_POSITION
EAT_FOOD_0 8C6E CALL ERASE_THING Rub it out and free its slot. REGROW_FOOD fills the slot again, much later, while the player is elsewhere.
8C71 LD (IX+$00),$00
8C75 CALL PLAY_SOUND_EATING A noise.
8C78 LD C,$40 Sixty-four units of life force.
8C7A LD A,($5E28)
8C7D ADD A,C
8C7E JR C,EAT_FOOD_1 Cap it, catching both the carry and the limit...
8C80 CP $F0
8C82 JR C,EAT_FOOD_2
EAT_FOOD_1 8C84 LD A,$F0 ...at $F0, just short of a full bar.
EAT_FOOD_2 8C86 LD ($5E28),A Store it and redraw the roast on the scroll.
8C89 JP DRAW_FOOD
Prev: 8C59 Up: Map Next: 8C8C