Prev: 62443 Up: Map Next: 62594
62476: Update all characters' stats (deteriorate or regenerate) and wake up / send to sleep if required
Used by the routine at 62330.
62476 LD DE,8 Load DE with 8 (as data is 8 bytes long)
62479 LD HL,62895 Point HL at start of characters' stat regeneration data table
62482 LD IX,24776 Point IX at Off-White Knight's current stats (2nd entry in characters' current stats table, as first is Magic Knight's)
62486 LD B,8 Load B with 8 (8 characters)
62488 BIT 7,(IX+6) If current character is awake...
62492 JR Z,62498 ...then skip ahead to 62498
62494 INC HL Advance HL by four bytes to stat deterioration data...
62495 INC HL ...
62496 INC HL ...
62497 INC HL ...
62498 LD C,(HL) Load stat change value into C
62499 LD A,(IX+0) Load current character's strength into A
62502 CALL 62594 Update character's strength as they tire (awake) or regenerate (asleep)...
62505 LD (IX+0),A ...
62508 INC HL Advance HL to next (happiness) data
62509 LD C,(HL) Load stat change value into C
62510 LD A,(IX+1) Load current character's happiness into A
62513 CALL 62594 Update character's happiness as they tire (awake) or regenerate (asleep)...
62516 LD (IX+1),A ...
62519 INC HL Advance HL to next (stamina) data
62520 LD C,(HL) Load stat change value into C
62521 LD A,(IX+2) Load current character's stamina into A
62524 CALL 62594 Update character's stamina as they tire (awake) or regenerate (asleep)...
62527 LD (IX+2),A ...
62530 INC HL Advance HL to next (magic level) data
62531 LD C,(HL) Load stat change value into C
62532 LD A,(IX+3) Load current character's magic level into A
62535 CALL 62594 Update character's magic level as they tire (awake) or regenerate (asleep)...
62538 LD (IX+3),A ...
62541 INC HL Advance HL to next block of data
62542 BIT 7,(IX+6) If current character is asleep...
62546 JR NZ,62552 ...then we have already moved into data for next character, so skip ahead to 62552
62548 INC HL Else, we are now in same character's "asleep" data, so need to advance HL by four bytes to get to next character's data...
62549 INC HL ...
62550 INC HL ...
62551 INC HL ...
62552 ADD IX,DE Advance IX by eight bytes to next character's stats
62554 DJNZ 62488 Loop back to 62488
62556 LD DE,8 Load DE with 8
62559 LD IX,24776 Point IX to Off-White Knight's current stats
62563 LD B,8 Load B with 8 (8 characters)
62565 LD C,0 Load C with zero (to denote first character, Off-White Knight)
62567 LD A,(IX+2) Load current character's stamina into A
62570 AND 127 If stamina (bits 0-6) is not zero...
62572 JR NZ,62580 ...then skip ahead to 62580
62574 SET 7,(IX+6) Else send character to sleep
62578 JR 62588 Skip ahead to 62588
62580 CP 100 If stamina is not 100...
62582 JR NZ,62588 ...then skip ahead to 62588
62584 RES 7,(IX+6) Else wake character up
62588 ADD IX,DE Advance IX to next character's stats
62590 INC C Increase C for next character
62591 DJNZ 62567 Loop back to 62567 for next character
62593 RET Return
Prev: 62443 Up: Map Next: 62594