Prev: 9ED0 Up: Map Next: 9F1E
9ED1: Character Action: Gardener
Input
HL Pointer to gardener state
CharacterAction_Gardener 9ED1 LD HL,$9ED0 HL=CharacterState_Gardener (point to gardener state).
This entry point is used by the routine at CharacterAction_Cook.
CharacterAction_Entry 9ED4 LD BC,$0000 BC=0000 (initialise object ID).
This entry point is used by the routine at CharacterAction_DaphneStrachan.
CharacterAction_CheckState 9ED7 LD A,(HL) A=*HL (load character state).
9ED8 AND A Jump to CharacterAction_Gardener_CheckTime if the character state is zero (hasn't moved yet).
9ED9 JR Z,CharacterAction_Gardener_CheckTime
Handle gardener's morning state (has already moved).
9EDB LD B,A B=A (store state value in B).
9EDC XOR A A=00 (clear state for next time).
9EDD LD DE,$0000 DE=0000 (no location offset).
9EE0 CALL UpdateCharacterStateAndLocation Call UpdateCharacterStateAndLocation (update gardener state and location).
9EE3 LD A,($A036) A=*CurrentCharacter_ID (load current character ID).
9EE6 LD B,C B=C (use object ID from C).
9EE7 LD DE,$0000 DE=0000 (no location offset).
9EEA CALL UpdateObjectLocation Call UpdateObjectLocation (move the object to the character's location).
9EED SET 6,(IX+$05) Set bit 6 of *IX+05 (mark object as having special description).
9EF1 RET Return.
Check if it's still morning.
CharacterAction_Gardener_CheckTime 9EF2 LD A,($9FE2) Return if *Messaging_AM_PM is equal to ASCII 61 ("a") (still AM).
9EF5 CP $61
9EF7 RET Z
Handle gardener's afternoon state (at 9am).
9EF8 LD A,($9FE0) Return if *CurrentTime_Hour is not equal to 09 (not 9am yet).
9EFB CP $09
9EFD RET NZ
9EFE LD DE,$01F8 DE=01F8 (location offset for afternoon).
9F01 LD A,$1E A=1E (attribute index).
9F03 CALL GetCharacterAttributeWithSign Call GetCharacterAttributeWithSign (get character attribute with sign).
9F06 ADD A,E A+=E (add offset to attribute value).
9F07 LD E,A E=A (store result in E).
9F08 LD A,($A00A) A=*CurrentCharacterAttribute (load character attribute).
9F0B CALL UpdateCharacterStateAndLocation Call UpdateCharacterStateAndLocation (update gardener state and location).
9F0E LD A,($A036) A=*CurrentCharacter_ID (load current character ID).
9F11 LD B,$10 B=10 (object ID for gardener's tool).
9F13 LD DE,$07F0 DE=07F0 (location offset for object).
9F16 CALL UpdateObjectLocation Call UpdateObjectLocation (move the object to the new location).
9F19 RES 6,(IX+$05) Reset bit 6 of *IX+05 (clear special description flag).
9F1D RET Return.
Prev: 9ED0 Up: Map Next: 9F1E