Prev: 39900 Up: Map Next: 40001
39959: Object: Move Nested Contents
Used by the routine at Object_MoveContents.
Moves every object held by the id in A to the location in B, then does the same for what those objects hold. Meeting the player (id 0) clears the flag at Object_MoveContents.
Object_MoveContents_Recurse 39959 PUSH IY Start the object search one slot before ObjectTable.
39961 PUSH IX
39963 LD IX,49248
Object_MoveContents_Recurse_Loop 39967 CALL Table_FindTheRecord Call Table_FindTheRecord to find the record.
39970 JR Z,Object_MoveContents_Recurse_Done Jump to Object_MoveContents_Recurse_Done if Table_FindTheRecord reached the end of the index.
39972 CP (IY+1) Jump back to Object_MoveContents_Recurse_Loop if where this object is is not the id in A.
39975 JR NZ,Object_MoveContents_Recurse_Loop
39977 LD (IY+16),B Set this object's location to the location in B.
Object_MoveContents_Recurse_Player 39980 PUSH AF Save the id being sought and read the id from the index entry.
39981 LD A,(IX+0)
39984 AND A Jump to Object_MoveContents_Recurse_MoveTheContents if this object's id is not zero.
39985 JR NZ,Object_MoveContents_Recurse_MoveTheContents
39987 LD (39900),A Clear the flag at Object_MoveContents: the player was among the contents.
Object_MoveContents_Recurse_MoveTheContents 39990 CALL Object_MoveContents_Recurse Call Object_MoveContents_Recurse to move the contents.
39993 POP AF Jump back to Object_MoveContents_Recurse_Loop to find the record.
39994 JR Object_MoveContents_Recurse_Loop
Object_MoveContents_Recurse_Done 39996 POP IX Restore IX and IY from the stack.
39998 POP IY
40000 RET Return.
View the equivalent code in;
Prev: 39900 Up: Map Next: 40001