Prev: 47648 Up: Map Next: 47942
47678: 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 47678 PUSH IX Clear the character script entry list.
47680 XOR A
47681 LD (40939),A
47684 LD E,(IX+5) Read the object attribute.
47687 LD D,(IX+6) Call JumpToHandler to jump to handler.
47690 PUSH DE
47691 PUSH DE
47692 POP IY
47694 CALL JumpToHandler
47697 POP IX Call FollowRecordPointer to follow the record pointer.
47699 PUSH AF
47700 CALL FollowRecordPointer
47703 POP AF
47704 POP IX Call CopyPointerToStack to copy pointer to stack.
47706 PUSH AF
47707 CALL CopyPointerToStack
47710 POP AF
47711 RET Return.
47712 DEFB 0 State byte for this character display. Written by 47719 and 47949. Read by RecordResultCharacterScript_StateByteZero and RecordResultCharacterScript_StateByte.
47713 DEFB 0 Second state byte, written beside 47712 by 47719 and SaveObjectState. Read by 47794.
47714 DEFB 0 First byte of the object id kept while the display is built. Read by 47809 and RecordResultCharacterScript_SavedDisplayDisplay.
47715 DEFB 0 Second byte of that object id. With 47716 it is also read as a word. Read by 47817.
47716 DEFB 0 Third byte of that object id. 47825 compares it with the record.
47717 DEFB 0 Low byte of the saved character record. Written by 47743 and read by ReadActionFlags.
47718 DEFB 0 High byte of the saved character record, stored with 47717.
47719 LD (47712),A Clear both state bytes at 47712 and 47713.
47722 LD (47713),A
A following display value is not 255.
RecordResultCharacterScript_FollowingDisplay 47725 CALL CalculateObjectPointerOffset Call CalculateObjectPointerOffset and jump to ReadActionFlags_MessagePointer if a following display value is not 255.
47728 JP C,ReadActionFlags_MessagePointer
47731 JR Z,RecordResultCharacterScript_FollowCharacterLink Go to RecordResultCharacterScript_FollowCharacterLink if the room's object list is empty.
47733 CALL SetObjectTablePointer Go to RecordResultCharacterScript_LeaveResultBit if the object table ends before the moved marker.
47736 JR NZ,RecordResultCharacterScript_LeaveResultBit
47738 LD A,1 Take 1.
RecordResultCharacterScript_0 47740 CALL SaveObjectState Call SaveObjectState to save the object state.
47743 LD (47717),IX Save the character record at 47717 and jump ahead to RecordResultCharacterScript_StateByteZero.
47747 JR RecordResultCharacterScript_StateByteZero
Leave 2 as the result, then see whether bit 5 of the action flags is set, then check for character id 50.
RecordResultCharacterScript_LeaveResultBit 47749 CALL SearchObjectTable Go to RecordResultCharacterScript_ReadAttribute if the object table ends before the moved marker.
47752 JR NZ,RecordResultCharacterScript_ReadAttribute
47754 LD A,2 Take 2 and jump to RecordResultCharacterScript_0 if bit 5 of the action flags is set.
47756 BIT 5,(IX+3)
47760 JR NZ,RecordResultCharacterScript_0
Get character attribute.
47762 CALL GetCharacterAttribute Call GetCharacterAttribute to read the character's attribute.
Is the attribute below 50?
47765 CP 50 Go to RecordResultCharacterScript_0 with A=3 if the value from GetCharacterAttribute is below 50.
47767 LD A,3
47769 JR C,RecordResultCharacterScript_0
47771 JR RecordResultCharacterScript_FollowCharacterLink The attribute is 50 or more, so skip the next test and follow the character link at RecordResultCharacterScript_FollowCharacterLink.
Reads the character's attribute. A value below 70 selects picture 4; otherwise the character link is followed.
Get character attribute.
RecordResultCharacterScript_ReadAttribute 47773 CALL GetCharacterAttribute Call GetCharacterAttribute to read the character's attribute.
Is the attribute below 70?
47776 CP 70 Go to RecordResultCharacterScript_0 with A=4 if the value from GetCharacterAttribute is below 70.
47778 LD A,4
47780 JR C,RecordResultCharacterScript_0
RecordResultCharacterScript_FollowCharacterLink 47782 CALL FollowCharacterLink Call FollowCharacterLink to follow the character link.
47785 JR NZ,RecordResultCharacterScript_FollowingDisplay Go back to RecordResultCharacterScript_FollowingDisplay when the character link is still set.
RecordResultCharacterScript_StateByteZero 47787 LD A,(47712) Jump to RecordResultCharacterScript_PolicePointer if the state byte at 47712 is zero.
47790 AND A
47791 JP Z,RecordResultCharacterScript_PolicePointer
47794 LD A,(47713) Jump to RecordResultCharacterScript_StateByte if the state byte at 47713 is zero.
47797 AND A
47798 JR Z,RecordResultCharacterScript_StateByte
47800 LD IX,40950 Point at the object display link.
RecordResultCharacterScript_Loop 47804 CALL FetchObjectPointerFromStack Go to RecordResultCharacterScript_AskFiveBytes if the object pointer is zero.
47807 JR Z,RecordResultCharacterScript_AskFiveBytes
47809 LD A,(47714) Jump back to RecordResultCharacterScript_Loop while this id does not match the record's flag byte.
47812 CP (IX+0)
47815 JR NZ,RecordResultCharacterScript_Loop
47817 LD A,(47715) Jump back to RecordResultCharacterScript_Loop while this id does not match the moved marker.
47820 CP (IX+1)
47823 JR NZ,RecordResultCharacterScript_Loop
47825 LD A,(47716) Jump back to RecordResultCharacterScript_Loop while this id does not match the location.
47828 CP (IX+2)
47831 JR NZ,RecordResultCharacterScript_Loop
47833 PUSH IY Save the schedule entry and the character record.
47835 PUSH IX
47837 POP DE Use the saved record as the source and point IY at 40944+4.
47838 LD IY,40948
Step pointer and compare.
47842 CALL IncrementPointerAndCompare Call IncrementPointerAndCompare to compare the pointer with the next record.
47845 LD A,(IX-2) Copy the pointer into the previous character record.
47848 LD (IY-2),A
47851 LD A,(IX-1) Store the high byte of the pointer in the previous character record.
47854 LD (IY-1),A
47857 POP IY
47859 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 47861 LD A,5 Take 5 then call AllocateMemory to allocate memory.
47863 CALL AllocateMemory
RecordResultCharacterScript_SavedDisplayDisplay 47866 LD A,(47714) Read the object id saved at 47714.
47869 LD HL,(47715)
47872 LD (IX+0),A Store the record's flag byte.
47875 LD (IX+1),L Store the moved marker and store the location.
47878 LD (IX+2),H
47881 LD HL,(40948) Read the saved display link.
47884 LD (40948),IX Store the low byte of the pointer in the previous character record.
47888 LD (IX-2),L
47891 LD (IX-1),H Store the high byte of the pointer in the previous character record.
RecordResultCharacterScript_StateByte 47894 LD A,(47712) Jump to ReadActionFlags if the state byte at 47712 is 1.
47897 CP 1
47899 JR Z,ReadActionFlags
47901 CALL GetCharacterAttribute Call GetCharacterAttribute to read the character attribute and jump to RecordResultCharacterScript_PolicePointer when it is below 25.
47904 CP 25
47906 JR C,RecordResultCharacterScript_PolicePointer
47908 LD IX,47714 Point at the workspace byte at 47714, then call ProcessObjectPointer to run object pointer.
47912 CALL ProcessObjectPointer
47915 JR NZ,RecordResultCharacterScript_PolicePointer Go to RecordResultCharacterScript_PolicePointer if no differing object pointer remains.
47917 LD A,C Take the count and call PointToObjectAttributeByte to point to object attribute byte.
47918 PUSH BC
47919 CALL PointToObjectAttributeByte
47922 POP AF
47923 PUSH HL Call PointToObjectAttributeByte to point to object attribute byte, saving pointer.
47924 CALL PointToObjectAttributeByte
47927 PUSH HL Take the police message, then call PrintTextAndHandleControlCharacters to print the police message.
47928 LD HL,28514
47931 CALL PrintTextAndHandleControlCharacters
47934 RET Return.
Use the police as the pointer.
RecordResultCharacterScript_PolicePointer 47935 LD HL,28500 Take the police message, then call PrintTextAndHandleControlCharacters to print the police message.
47938 CALL PrintTextAndHandleControlCharacters
47941 RET Return.
Prev: 47648 Up: Map Next: 47942