Prev: 9BCA Up: Map Next: 9C17
9BDC: Object: Move Contents
Moves everything inside the object in A (recursively) to the location in B; if the player is among them, the player moves too. The byte here is set while the player has not been found among those contents.
Object_MoveContents 9BDC DEFB $FF
Object_MoveContents_0 9BDD LD HL,$9BDC Point HL at the flag that says the player was not found.
9BE0 LD (HL),$01 Set the flag.
9BE2 CALL Object_MoveContents_Recurse Call Object_MoveContents_Recurse to move the contents.
9BE5 LD A,(HL) Return if the player was not among the contents (the flag at Object_MoveContents is still set).
9BE6 AND A
9BE7 RET NZ
9BE8 PUSH HL Save HL.
Test this flag.
9BE9 LD A,($C12B) Jump to Object_MoveContents_ClearAndReturn if *C12B is zero.
9BEC AND A
9BED JR Z,Object_MoveContents_ClearAndReturn
9BEF LD A,($B6EA) Read *CurrentCharacter.
9BF2 PUSH AF Read *Pointer_CurrentCharacter.
9BF3 LD HL,($B70C)
9BF6 PUSH HL Point *Pointer_CurrentCharacter at "You".
9BF7 LD HL,$C11B
9BFA LD ($B70C),HL
9BFD XOR A Clear *CurrentCharacter.
9BFE LD ($B6EA),A
9C01 LD A,B Store B at ActionLocationID.
9C02 LD ($8D9B),A
9C05 CALL Action_Direction_0 Call Action_Direction_0 to move the character, unless the message is held back.
9C08 CALL Action_None Call Action_None, the empty action.
9C0B POP HL Update *Pointer_CurrentCharacter.
9C0C LD ($B70C),HL
9C0F POP AF Update *CurrentCharacter.
9C10 LD ($B6EA),A
Object_MoveContents_ClearAndReturn 9C13 POP HL Restore HL from the stack and clear the byte it points at.
9C14 XOR A
9C15 LD (HL),A
9C16 RET Return.
Prev: 9BCA Up: Map Next: 9C17