Prev: BA20 Up: Map Next: BB46
BA3E: Record The Result In The Character Script
Used by the routine at ProcessCharacterDisplay.
Clears the character-script list, then reads the script address stored on this character.
RecordResultCharacterScript BA3E PUSH IX Clear the character script entry list.
BA40 XOR A
BA41 LD ($9FEB),A
BA44 LD E,(IX+$05) Read the object attribute.
BA47 LD D,(IX+$06) Call JumpToHandler to jump to handler.
BA4A PUSH DE
BA4B PUSH DE
BA4C POP IY
BA4E CALL JumpToHandler
BA51 POP IX Call FollowRecordPointer to follow the record pointer.
BA53 PUSH AF
BA54 CALL FollowRecordPointer
BA57 POP AF
BA58 POP IX Call CopyPointerToStack to copy pointer to stack.
BA5A PUSH AF
BA5B CALL CopyPointerToStack
BA5E POP AF
BA5F RET Return.
BA60 DEFB $00 State byte for this character display. Written by BA67 and BB4D. Read by RecordResultCharacterScript_StateByteZero and RecordResultCharacterScript_StateByte.
BA61 DEFB $00 Second state byte, written beside BA60 by BA67 and SaveObjectState. Read by BAB2.
BA62 DEFB $00 First byte of the object id kept while the display is built. Read by BAC1 and RecordResultCharacterScript_SavedDisplayDisplay.
BA63 DEFB $00 Second byte of that object id. With BA64 it is also read as a word. Read by BAC9.
BA64 DEFB $00 Third byte of that object id. BAD1 compares it with the record.
BA65 DEFB $00 Low byte of the saved character record. Written by BA7F and read by ReadActionFlags.
BA66 DEFB $00 High byte of the saved character record, stored with BA65.
BA67 LD ($BA60),A Clear both state bytes at BA60 and BA61.
BA6A LD ($BA61),A
A following display value is not FF.
RecordResultCharacterScript_FollowingDisplay BA6D CALL CalculateObjectPointerOffset Call CalculateObjectPointerOffset and jump to ReadActionFlags_MessagePointer if a following display value is not FF.
BA70 JP C,ReadActionFlags_MessagePointer
BA73 JR Z,RecordResultCharacterScript_FollowCharacterLink Go to RecordResultCharacterScript_FollowCharacterLink if the room's object list is empty.
BA75 CALL SetObjectTablePointer Go to RecordResultCharacterScript_LeaveResultBit if the object table ends before the moved marker.
BA78 JR NZ,RecordResultCharacterScript_LeaveResultBit
BA7A LD A,$01 Take 01.
RecordResultCharacterScript_0 BA7C CALL SaveObjectState Call SaveObjectState to save the object state.
BA7F LD ($BA65),IX Save the character record at BA65 and jump ahead to RecordResultCharacterScript_StateByteZero.
BA83 JR RecordResultCharacterScript_StateByteZero
Leave 02 as the result, then see whether bit 5 of the action flags is set, then check for character id 50.
RecordResultCharacterScript_LeaveResultBit BA85 CALL SearchObjectTable Go to RecordResultCharacterScript_ReadAttribute if the object table ends before the moved marker.
BA88 JR NZ,RecordResultCharacterScript_ReadAttribute
BA8A LD A,$02 Take 02 and jump to RecordResultCharacterScript_0 if bit 5 of the action flags is set.
BA8C BIT 5,(IX+$03)
BA90 JR NZ,RecordResultCharacterScript_0
Get character attribute.
BA92 CALL GetCharacterAttribute Call GetCharacterAttribute to read the character's attribute.
Is the attribute below 32?
BA95 CP $32 Go to RecordResultCharacterScript_0 with A=03 if the value from GetCharacterAttribute is below 32.
BA97 LD A,$03
BA99 JR C,RecordResultCharacterScript_0
BA9B JR RecordResultCharacterScript_FollowCharacterLink The attribute is 32 or more, so skip the next test and follow the character link at RecordResultCharacterScript_FollowCharacterLink.
Reads the character's attribute. A value below 46 selects picture 04; otherwise the character link is followed.
Get character attribute.
RecordResultCharacterScript_ReadAttribute BA9D CALL GetCharacterAttribute Call GetCharacterAttribute to read the character's attribute.
Is the attribute below 46?
BAA0 CP $46 Go to RecordResultCharacterScript_0 with A=04 if the value from GetCharacterAttribute is below 46.
BAA2 LD A,$04
BAA4 JR C,RecordResultCharacterScript_0
RecordResultCharacterScript_FollowCharacterLink BAA6 CALL FollowCharacterLink Call FollowCharacterLink to follow the character link.
BAA9 JR NZ,RecordResultCharacterScript_FollowingDisplay Go back to RecordResultCharacterScript_FollowingDisplay when the character link is still set.
RecordResultCharacterScript_StateByteZero BAAB LD A,($BA60) Jump to RecordResultCharacterScript_PolicePointer if the state byte at BA60 is zero.
BAAE AND A
BAAF JP Z,RecordResultCharacterScript_PolicePointer
BAB2 LD A,($BA61) Jump to RecordResultCharacterScript_StateByte if the state byte at BA61 is zero.
BAB5 AND A
BAB6 JR Z,RecordResultCharacterScript_StateByte
BAB8 LD IX,$9FF6 Point at the object display link.
RecordResultCharacterScript_Loop BABC CALL FetchObjectPointerFromStack Go to RecordResultCharacterScript_AskFiveBytes if the object pointer is zero.
BABF JR Z,RecordResultCharacterScript_AskFiveBytes
BAC1 LD A,($BA62) Jump back to RecordResultCharacterScript_Loop while this id does not match the record's flag byte.
BAC4 CP (IX+$00)
BAC7 JR NZ,RecordResultCharacterScript_Loop
BAC9 LD A,($BA63) Jump back to RecordResultCharacterScript_Loop while this id does not match the moved marker.
BACC CP (IX+$01)
BACF JR NZ,RecordResultCharacterScript_Loop
BAD1 LD A,($BA64) Jump back to RecordResultCharacterScript_Loop while this id does not match the location.
BAD4 CP (IX+$02)
BAD7 JR NZ,RecordResultCharacterScript_Loop
BAD9 PUSH IY Save the schedule entry and the character record.
BADB PUSH IX
BADD POP DE Use the saved record as the source and point IY at 9FF0+04.
BADE LD IY,$9FF4
Step pointer and compare.
BAE2 CALL IncrementPointerAndCompare Call IncrementPointerAndCompare to compare the pointer with the next record.
BAE5 LD A,(IX-$02) Copy the pointer into the previous character record.
BAE8 LD (IY-$02),A
BAEB LD A,(IX-$01) Store the high byte of the pointer in the previous character record.
BAEE LD (IY-$01),A
BAF1 POP IY
BAF3 JR RecordResultCharacterScript_SavedDisplayDisplay Jump ahead to RecordResultCharacterScript_SavedDisplayDisplay to read the saved display pointer.
Ask for five bytes, then read the saved display pointer.
RecordResultCharacterScript_AskFiveBytes BAF5 LD A,$05 Take 05 then call AllocateMemory to allocate memory.
BAF7 CALL AllocateMemory
RecordResultCharacterScript_SavedDisplayDisplay BAFA LD A,($BA62) Read the object id saved at BA62.
BAFD LD HL,($BA63)
BB00 LD (IX+$00),A Store the record's flag byte.
BB03 LD (IX+$01),L Store the moved marker and store the location.
BB06 LD (IX+$02),H
BB09 LD HL,($9FF4) Read the saved display link.
BB0C LD ($9FF4),IX Store the low byte of the pointer in the previous character record.
BB10 LD (IX-$02),L
BB13 LD (IX-$01),H Store the high byte of the pointer in the previous character record.
RecordResultCharacterScript_StateByte BB16 LD A,($BA60) Jump to ReadActionFlags if the state byte at BA60 is 01.
BB19 CP $01
BB1B JR Z,ReadActionFlags
BB1D CALL GetCharacterAttribute Call GetCharacterAttribute to read the character attribute and jump to RecordResultCharacterScript_PolicePointer when it is below 19.
BB20 CP $19
BB22 JR C,RecordResultCharacterScript_PolicePointer
BB24 LD IX,$BA62 Point at the workspace byte at BA62, then call ProcessObjectPointer to run object pointer.
BB28 CALL ProcessObjectPointer
BB2B JR NZ,RecordResultCharacterScript_PolicePointer Go to RecordResultCharacterScript_PolicePointer if no differing object pointer remains.
BB2D LD A,C Take the count and call PointToObjectAttributeByte to point to object attribute byte.
BB2E PUSH BC
BB2F CALL PointToObjectAttributeByte
BB32 POP AF
BB33 PUSH HL Call PointToObjectAttributeByte to point to object attribute byte, saving pointer.
BB34 CALL PointToObjectAttributeByte
BB37 PUSH HL Take the police message, then call PrintTextAndHandleControlCharacters to print the police message.
BB38 LD HL,$6F62
BB3B CALL PrintTextAndHandleControlCharacters
BB3E RET Return.
Use the police as the pointer.
RecordResultCharacterScript_PolicePointer BB3F LD HL,$6F54 Take the police message, then call PrintTextAndHandleControlCharacters to print the police message.
BB42 CALL PrintTextAndHandleControlCharacters
BB45 RET Return.
Prev: BA20 Up: Map Next: BB46