Prev: 59859 Up: Map Next: 60016
59873: Handler: Change Room
Used by the routines at Handler_ShowNewRoom, Action_Down, Action_Pour and GameStart.
Change room, with the special cases for the gates and the cottage.
Handler_ChangeRoom 59873 CP 55 See whether the player is moving into the Hall of the Phoenix.
59875 JR NZ,Handler_ChangeRoom_0
59877 LD HL,44662 Point HL at the room-change flags.
59880 BIT 0,(HL) See whether the Hall of the Phoenix is safe to enter.
59882 JR NZ,Handler_ChangeRoom_0 Jump to Handler_ChangeRoom_0 if the zero flag is clear.
59884 POP HL Return via the "You are dead." message.
59885 LD HL,59829
59888 EX (SP),HL
59889 LD HL,53324 Print "The scorching flames of the firegate have incinerated you." and start a new line.
59892 CALL PrintStringAndANewline
59895 RET Return.
Handler_ChangeRoom_0 59896 LD C,A Remember the room being moved to.
59897 LD A,(44749) Read the current room into A.
59900 CP 55 See whether the player is leaving the Hall of the Phoenix.
59902 JR NZ,Handler_ChangeRoom_2
59904 LD HL,44662 Point HL at the room-change flags.
59907 BIT 1,(HL) See whether the ashes have already become a phoenix.
59909 JR NZ,Handler_ChangeRoom_2 Jump to Handler_ChangeRoom_2 if the zero flag is clear.
59911 LD A,63 See whether the move is into the Hall of Black Magic.
59913 CP C
59914 JR NZ,Handler_ChangeRoom_1
59916 LD BC,33154 Turn the hot ashes into a phoenix.
59919 CALL TransformItem
59922 XOR A Close the south exit from the Hall of the Phoenix.
59923 LD (59697),A
Handler_ChangeRoom_AshesBurst 59926 LD HL,53383 Print "Suddenly,the ashes burst into flames...." and start a new line.
59929 CALL PrintStringAndANewline
Handler_ChangeRoom_PhoenixAppears 59932 LD HL,53424 Pause, print "A phoenix emerges from the fire and blocks your path." and scroll.
59935 CALL PausePrintStringAndScroll
59938 RET Return.
Handler_ChangeRoom_1 59939 LD A,C Take the destination room.
59940 PUSH AF Remember the destination room.
59941 LD A,130 Remove the phoenix.
59943 CALL HandlerDestroyItemEvent
59946 LD A,129 Leave the hot ashes in this room.
59948 CALL HandlerUpdateItemEventForTheCurrentRoom
59951 LD A,63 Open the south exit from the Hall of the Phoenix into the Hall of Black Magic.
59953 LD (59697),A
59956 POP AF Restore the destination room from the stack.
59957 LD C,A Put the destination room back.
Handler_ChangeRoom_2 59958 LD A,C Hand the destination room to the move.
59959 CALL Handler_SetCurrentRoom Call Handler_SetCurrentRoom to move the player into the room.
59962 LD A,(44749) Read the current room into A.
59965 CP 2 See whether the player is inside the ruined cottage.
59967 JR NZ,Handler_ShowNewRoom
59969 LD A,(44689) Read the event-state flags into A.
59972 CP 15 See whether the cottage tasks are finished.
59974 JR NZ,Handler_ShowNewRoom
59976 LD HL,60016 Count how many of the five gems are here.
59979 LD B,5
59981 LD C,0
Cottage_CountGem 59983 LD A,(HL) Read the next gem.
59984 CALL Get_ObjectLocation Call Get_ObjectLocation to find where the object is.
59987 JR NZ,Handler_ChangeRoom_3 Jump to Handler_ChangeRoom_3 if the zero flag is clear.
59989 INC C Count a gem that is here.
Handler_ChangeRoom_3 59990 INC HL Move on to the next gem.
59991 DJNZ Cottage_CountGem Step down B by one and jump to Cottage_CountGem until it is zero.
59993 LD A,5 See whether all five gems are here.
59995 CP C
59996 JR NZ,Handler_ShowNewRoom
59998 LD HL,58628 Check the list of treasures at 58628.
60001 CALL CheckActiveScenicEvents
60004 JR NZ,Handler_ShowNewRoom Jump to Handler_ShowNewRoom if none of the items listed at 58628 is here or carried.
60006 POP HL Restore HL, HL from the stack.
60007 POP HL
60008 LD A,4 Score four points and finish the game.
60010 CALL AddToScore
60013 JP GameComplete
Prev: 59859 Up: Map Next: 60016