Prev: BD7E Up: Map Next: BE22
BDC2: Point The Object List At This Room
Used by the routine at CalculateObjectPointerOffset.
Points the object list at this room and remembers the character record in the display pointer.
Adjust object table for sum.
PointObjectListRoom BDC2 CALL AdjustObjectTableForSum Call AdjustObjectTableForSum to point the object list at this room.
BDC5 LD ($BA13),IX Store this object pointer at BA13 and at BA13+02.
BDC9 LD ($BA15),IX
BDCD LD DE,($BA17) Read the display pointer and point HL at the character pairs at 994D.
BDD1 LD HL,$994D
BDD4 LD B,$01 Count 01.
PointObjectListRoom_Loop BDD6 LD A,(HL) Read the next object-list byte.
BDD7 INC HL Advance through the object list.
BDD8 OR (HL) Merge the following object-list byte.
BDD9 DEC HL Step back one byte.
BDDA RET Z Return when this object-list pair is empty.
BDDB LD A,E Jump ahead to PointObjectListRoom_Next if the low byte differs from this object pair.
BDDC CP (HL)
BDDD JR NZ,PointObjectListRoom_Next
BDDF INC HL Jump ahead to PointObjectListRoom_CountRecordResult if the high byte matches this object pair.
BDE0 LD A,D
BDE1 CP (HL)
BDE2 DEC HL
BDE3 JR Z,PointObjectListRoom_CountRecordResult
PointObjectListRoom_Next BDE5 INC HL Step to the next object pair and go back to PointObjectListRoom_Loop.
BDE6 INC HL
BDE7 INC B
BDE8 JR PointObjectListRoom_Loop
Remember how many objects were listed and read the next one.
PointObjectListRoom_CountRecordResult BDEA LD A,B Record the display pointer.
BDEB LD ($BA1A),A
BDEE LD A,$02
BDF0 LD ($A038),A Store it in the object attribute flag.
BDF3 CALL ReadCharacterRecordWord Call ReadCharacterRecordWord to read the next display object and return when the list has ended.
BDF6 CP $FF
BDF8 RET Z
BDF9 LD ($BA19),A Call ReadCharacterRecordWord to read the character record from the display link.
BDFC CALL ReadCharacterRecordWord
BDFF CP $FF Jump to UseObjectDisplayLink_ConditionHoldsCaller when another display object follows.
BE01 JR NZ,UseObjectDisplayLink_ConditionHoldsCaller
BE03 LD A,($BA19) Call UseObjectDisplayLink to copy the object's picture link.
BE06 CALL UseObjectDisplayLink
BE09 CALL ReadCharacterRecordValue Call ReadCharacterRecordValue to read the next saved object and return when that list has ended.
BE0C CP $FF
BE0E RET Z
BE0F LD ($BA1B),A Call ReadCharacterRecordValue to read the character record from the saved value.
BE12 CALL ReadCharacterRecordValue
BE15 CP $FF Jump to UseObjectDisplayLink_ConditionHoldsCaller when another saved object follows.
BE17 JR NZ,UseObjectDisplayLink_ConditionHoldsCaller
BE19 LD A,($BA1B) Call UseObjectDisplayLink to copy the object's picture link.
BE1C CALL UseObjectDisplayLink
BE1F OR %00000001 Reset the zero flag.
BE21 RET Return.
Prev: BD7E Up: Map Next: BE22