Prev: 43302 Up: Map Next: 43428
43318: Make current character eat and drink if possible
Used by the routine at 64623.
43318 CALL 45552 Display "[Character] IS ASLEEP" window and jump to main game loop if Current Character is asleep, else return here and continue
43321 LD A,(41937) Load A with index of Current Character
43324 LD E,0 Point HL at character's current strength...
43326 CALL 45406 ...
43329 PUSH HL Transfer address from HL...
43330 POP IX ...into IX
43332 LD A,(IX+6) Load A with character's food level stripping out asleep flag...
43335 AND 127 ...and set zero flag if food level is zero
43337 LD HL,52788 Point HL at "[Current Character's short name] HAS NO FOOD LEFT" text
43340 JP Z,64313 If zero flag is set then display "[Character] HAS NO FOOD LEFT" window (29) and return to game
43343 LD A,(IX+2) If character's stamina is less than 20...
43346 CP 20 ...then set carry flag
43348 LD HL,52804 Point HL at "[Current Character's short name] IS TOO TIRED TO EAT OR DRINK" text
43351 JP C,64313 If carry flag is set then display "[Character] IS TOO TIRED TO EAT OR DRINK" window (29) and return to game
43354 LD A,(IX+1) If character's happiness is less than 30...
43357 CP 30 ...
43359 JP C,64280 ...then display "[Character] DOES NOT WANT TO BE COMMANDED BY YOU" window (29) and return to game
43362 LD A,(IX+6) Load A with character's asleep flag...
43365 AND 128 ...
43367 LD (43407),A ...and store in operand of instruction at 43406
43370 RES 7,(IX+6) Reset character's asleep flag
43374 LD A,(IX+0) Load A with character's unused flag...
43377 AND 128 ...
43379 LD (43415),A ...and store in operand of instruction at 43414
43382 RES 7,(IX+0) Reset character's unused flag
43386 LD A,(IX+0) If character's strength is 100...
43389 CP 100 ...
43391 JP Z,43406 ...then skip ahead to 43406
43394 DEC (IX+6) Decrease character's food level by one
43397 INC (IX+0) Increase character's strength by one
43400 LD A,(IX+6) If character's food level is not zero...
43403 OR A ...
43404 JR NZ,43386 ...then loop back to 43386
The operand of the instruction at 43406 represents the character's asleep flag (128 for asleep or 0 for awake). This is modified by the instruction at 43367.
43406 LD A,0 Load A with asleep flag value...
43408 OR (IX+6) ...merge with food level...
43411 LD (IX+6),A ...and store
The operand of the instruction at 43414 represents the character's unused flag (bit 7 of strength). This is modified by the instruction at 43379.
43414 LD A,0 Load A with unused flag value...
43416 OR (IX+0) ...merge with strength...
43419 LD (IX+0),A ...and store
43422 LD HL,52817 Point HL at "[Current Character's short name] HAS TAKEN REFRESHMENT" text
43425 JP 64313 Display "[Character] HAS TAKEN REFRESHMENT" window (29) and return to game
Prev: 43302 Up: Map Next: 43428