Prev: 91B9 Up: Map Next: 9252
9206: EAT and DRINK
Eating food makes the actor stronger: 10 is added to their strength (byte 5 of their record). If the target is inside a container (for example a drink in a bottle), the container's 'full' flag (bit 2) is cleared and the actor gains only 1. The food or drink then vanishes: its holder is set to $FF and all its locations to 0.
But there is a limit. If the new strength would be 128 or more, the game prints 'his foul gluttony has killed him' ('your foul gluttony has killed you' for Bilbo), and the actor dies (96DD). Bilbo starts with strength 64, so the seventh helping of food is fatal.
9206 CALL $9C99 Dry run? Then stop here: eating and drinking always work
9209 LD IX,($B5F8) IX = the food or drink's own record
920D LD A,(IX+$01) Is it lying loose, or inside something (a bottle, say)?
9210 CP $FF
9212 JR Z,$921F Loose: skip the container step below
9214 CALL $9B25 Inside something: IX = that container's own record
9217 RES 2,(IX+$07) It is no longer full
921B LD A,$01 Drinking from a container only gives 1 point of strength
921D JR $9224
This entry point is used by the routine at A842.
921F CALL $9C99 (Reached only when the action is genuinely happening, so this always passes straight through)
9222 LD A,$0A Eating or drinking on its own gives 10 points of strength
9224 LD IX,($B5FC) IX = the actor's own record
9228 ADD A,(IX+$05) Add the gain to the actor's current strength
922B CP $80 Would that take strength to 128 or more?
922D JR NC,$9246 Yes: the meal proves fatal (see below)
922F LD (IX+$05),A No: store the new, higher strength
9232 LD IX,($B5F8) IX = the food or drink's own record
9236 LD (IX+$01),$FF It is held by nobody now...
923A LD B,(IX+$00) ...B = how many locations it has (normally 1)...
923D LD (IX+$10),$00 ...and each of those locations becomes 0: it has vanished entirely
9241 INC IX
9243 DJNZ $923D
9245 RET
9246 LD HL,$B038 "your foul gluttony has killed you."
9249 CALL $72D4
924C LD A,($B5DB) A = the actor
924F JP $96DD The actor dies
Prev: 91B9 Up: Map Next: 9252