Prev: 43318 Up: Map Next: 43486
43428: Make current character be happy if possible
Used by the routine at 64623.
43428 CALL 45552 Display "[Character] IS ASLEEP" window and jump to main game loop if Current Character is asleep, else return here and continue
43431 LD A,(41937) Load A with index of Current Character
43434 LD E,0 Point HL at start of character's current stats...
43436 CALL 45406 ...
43439 PUSH HL Transfer address from HL...
43440 POP IX ...into IX
43442 LD A,(IX+2) If character's stamina is less than 30...
43445 CP 30 ...then set carry flag
43447 LD HL,52836 Point HL at "[Current Character's short name] IS TOO TIRED TO BE HAPPY" text
43450 JP C,64313 If carry flag is set then display "[Character] IS TOO TIRED TO BE HAPPY" window (29) and return to game
43453 LD A,(IX+1) If character's happiness is less than 5...
43456 CP 5 ...
43458 JP C,64280 ...then display "[Character] DOES NOT WANT TO BE COMMANDED BY YOU" window (29) and return to game
43461 LD A,(41937) Load DE with index of Current Character...
43464 LD E,A ...
43465 LD D,0 ...
43467 LD HL,43486 Load HL with start address of table of characters' default happiness levels...
43470 ADD HL,DE ...and add DE as offset
43471 LD A,(IX+1) Load A with character's current happiness...
43474 AND 128 ...and reset all but bit 7 (unused)
43476 OR (HL) Add in character's default happiness...
43477 LD (IX+1),A ...and set as character's current happiness
43480 LD HL,52845 Point HL at "[Current Character's short name] WILL TRY TO BE HAPPY" text
43483 JP 64313 Display "[Character] WILL TRY TO BE HAPPY" window (29) and return to game
Prev: 43318 Up: Map Next: 43486