Prev: BA66 Up: Map Next: BAB3
BA6E: Handler: Display Character Location
Used by the routine at Handler_ChangeCharacters.
When a character switch is attempted but the character is not in the current room, this routine shows the current location of the chosen character.
For example:
wally-is-in-the-town-square
wilma-is-in-penny-lane
tom-is-in-the-pub
dick-is-in-the-docks
harry-is-in-the-super-market
Return if the messaging is already showing.
Handler_DisplayCharacterLocation BA6E LD A,($BAB3) Return if *MessagingCountdown is not zero.
BA71 OR A
BA72 RET NZ
Set the appropriate UDG base address (Font).
BA73 LD HL,$DFDC Write Font to *B7E9.
BA76 LD ($B7E9),HL
Fetch the current room for the active character.
BA79 LD A,(IY+$0F) A=*IY+0F (current room).
Find the room name from the room ID.
As the room names vary in length (and there's no lookup table), we call FindDataById, which counts through each terminator (FF) to find the related room label memory location.
BA7C LD HL,$7F1F HL=Messaging_TownSquare.
BA7F CALL FindDataById Call FindDataById.
BA82 PUSH HL Stash the room name memory address (HL) on the stack.
Fetch the length of the room name.
BA83 CALL CountBytesToTerminator Call CountBytesToTerminator.
BA86 LD C,B C=length of the room name.
Fetch the character name.
BA87 LD H,$7C H=7C.
BA89 LD L,(IY-$23) L=*IY-23.
BA8C PUSH HL Stash the character name memory address (HL) on the stack.
Fetch the length of the character name.
BA8D CALL CountBytesToTerminator Call CountBytesToTerminator.
Hold the length of all the segments in C (07 is the length of " IS IN ").
BA90 LD A,$07 C=07+B+C.
BA92 ADD A,B
BA93 ADD A,C
BA94 LD C,A
BA95 LD A,$20 A=20-C.
BA97 SUB C
BA98 SRL A Shift and rotate A left one bit.
Set this to the screen co-ordinates held in DE.
BA9A LD E,A E=A.
BA9B LD D,$04 D=04.
Retrieve the character name label memory location.
BA9D POP HL Restore HL from the stack.
BA9E LD C,$4E C=4E (INK: YELLOW, PAPER: BLUE (BRIGHT) ).
BAA0 CALL Controller_Tile Call Controller_Tile.
Prints " IS IN " to the screen.
BAA3 LD HL,$BA66 HL=Messaging_IsIn.
BAA6 CALL Controller_Tile Call Controller_Tile.
Retrieve the room label memory location.
BAA9 POP HL Restore HL from the stack.
Print the room name to the screen.
BAAA CALL Controller_Tile Call Controller_Tile.
Kick off a countdown for showing the messaging for a brief period of time.
BAAD LD A,$1E Write 1E to MessagingCountdown.
BAAF LD ($BAB3),A
BAB2 RET Return.
Prev: BA66 Up: Map Next: BAB3