Prev: 40656 Up: Map Next: 40734
40657: Character Action: Gardener
Input
HL Pointer to gardener state
CharacterAction_Gardener 40657 LD HL,40656 HL=CharacterState_Gardener (point to gardener state).
This entry point is used by the routine at CharacterAction_Cook.
CharacterAction_Entry 40660 LD BC,0 BC=0000 (initialise object ID).
This entry point is used by the routine at CharacterAction_DaphneStrachan.
CharacterAction_CheckState 40663 LD A,(HL) A=*HL (load character state).
40664 AND A Jump to CharacterAction_Gardener_CheckTime if the character state is zero (hasn't moved yet).
40665 JR Z,CharacterAction_Gardener_CheckTime
Handle gardener's morning state (has already moved).
40667 LD B,A B=A (store state value in B).
40668 XOR A A=0 (clear state for next time).
40669 LD DE,0 DE=0000 (no location offset).
40672 CALL UpdateCharacterStateAndLocation Call UpdateCharacterStateAndLocation (update gardener state and location).
40675 LD A,(41014) A=*CurrentCharacter_ID (load current character ID).
40678 LD B,C B=C (use object ID from C).
40679 LD DE,0 DE=0000 (no location offset).
40682 CALL UpdateObjectLocation Call UpdateObjectLocation (move the object to the character's location).
40685 SET 6,(IX+5) Set bit 6 of *IX+5 (mark object as having special description).
40689 RET Return.
Check if it's still morning.
CharacterAction_Gardener_CheckTime 40690 LD A,(40930) Return if *Messaging_AM_PM is equal to ASCII 97 ("a") (still AM).
40693 CP 97
40695 RET Z
Handle gardener's afternoon state (at 9am).
40696 LD A,(40928) Return if *CurrentTime_Hour is not equal to 9 (not 9am yet).
40699 CP 9
40701 RET NZ
40702 LD DE,504 DE=0504 (location offset for afternoon).
40705 LD A,30 A=30 (attribute index).
40707 CALL GetCharacterAttributeWithSign Call GetCharacterAttributeWithSign (get character attribute with sign).
40710 ADD A,E A+=E (add offset to attribute value).
40711 LD E,A E=A (store result in E).
40712 LD A,(40970) A=*CurrentCharacterAttribute (load character attribute).
40715 CALL UpdateCharacterStateAndLocation Call UpdateCharacterStateAndLocation (update gardener state and location).
40718 LD A,(41014) A=*CurrentCharacter_ID (load current character ID).
40721 LD B,16 B=16 (object ID for gardener's tool).
40723 LD DE,2032 DE=2032 (location offset for object).
40726 CALL UpdateObjectLocation Call UpdateObjectLocation (move the object to the new location).
40729 RES 6,(IX+5) Reset bit 6 of *IX+5 (clear special description flag).
40733 RET Return.
Prev: 40656 Up: Map Next: 40734