Prev: 47718 Up: Map Next: 47795
47726: 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 47726 LD A,(47795) Return if *MessagingCountdown is not zero.
47729 OR A
47730 RET NZ
Set the appropriate UDG base address (Font).
47731 LD HL,57308 Write Font to *47081.
47734 LD (47081),HL
Fetch the current room for the active character.
47737 LD A,(IY+15) A=*IY+15 (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 (255) to find the related room label memory location.
47740 LD HL,32543 HL=Messaging_TownSquare.
47743 CALL FindDataById Call FindDataById.
47746 PUSH HL Stash the room name memory address (HL) on the stack.
Fetch the length of the room name.
47747 CALL CountBytesToTerminator Call CountBytesToTerminator.
47750 LD C,B C=length of the room name.
Fetch the character name.
47751 LD H,124 H=124.
47753 LD L,(IY-35) L=*IY-35.
47756 PUSH HL Stash the character name memory address (HL) on the stack.
Fetch the length of the character name.
47757 CALL CountBytesToTerminator Call CountBytesToTerminator.
Hold the length of all the segments in C (7 is the length of " IS IN ").
47760 LD A,7 C=7+B+C.
47762 ADD A,B
47763 ADD A,C
47764 LD C,A
47765 LD A,32 A=32-C.
47767 SUB C
47768 SRL A Shift and rotate A left one bit.
Set this to the screen co-ordinates held in DE.
47770 LD E,A E=A.
47771 LD D,4 D=4.
Retrieve the character name label memory location.
47773 POP HL Restore HL from the stack.
47774 LD C,78 C=78 (INK: YELLOW, PAPER: BLUE (BRIGHT) ).
47776 CALL Controller_Tile Call Controller_Tile.
Prints " IS IN " to the screen.
47779 LD HL,47718 HL=Messaging_IsIn.
47782 CALL Controller_Tile Call Controller_Tile.
Retrieve the room label memory location.
47785 POP HL Restore HL from the stack.
Print the room name to the screen.
47786 CALL Controller_Tile Call Controller_Tile.
Kick off a countdown for showing the messaging for a brief period of time.
47789 LD A,30 Write 30 to MessagingCountdown.
47791 LD (47795),A
47794 RET Return.
Prev: 47718 Up: Map Next: 47795