Prev: EC99 Up: Map Next: ED66
ECB6: Change Room
Used by the routines at MovePlayer, Action_Climb, Action_Enter and GameStart.
Commits a move into the destination room held in A. It refuses the move while the player is badly hurt, otherwise calls MovePlayerToRoom, describes the room via Handler_DisplayRoom, then arms the local dangers.
Input
A Destination room ID
ChangeRoom ECB6 LD C,A C=A.
ECB7 LD A,$48 Call ValidateItemPresent with item 48: "You are seriously injured".
ECB9 CALL ValidateItemPresent
ECBC JR NZ,ChangeRoom_EnterRoom Jump to ChangeRoom_EnterRoom if "You are seriously injured" is not in the current room.
Print "You can't move. You are too badly injured.".
ECBE LD HL,$DB38 HL=Messaging_YouCantMove.
ECC1 CALL PrintStringAndNewline Call PrintStringAndNewline.
ECC4 RET Return.
Move into the requested room and arm local dangers.
ChangeRoom_EnterRoom ECC5 LD A,C A=C.
ECC6 CALL MovePlayerToRoom Call MovePlayerToRoom.
ECC9 LD E,$00 E=00.
ECCB CALL Handler_DisplayRoom Call Handler_DisplayRoom.
ECCE LD A,$41 Jump to ChangeRoom_SlimeMonster if ValidateItemPresent reports that "A giant spider. It advances toward you" isn't in the current room.
ECD0 CALL ValidateItemPresent
ECD3 JR NZ,ChangeRoom_SlimeMonster
Arm the giant spider for six turns.
ECD5 LD HL,$BA36 HL=Flag_TurnBasedEventState.
ECD8 SET 1,(HL) Set bit 1 of *HL.
ECDA LD A,$06 A=06.
ECDC LD ($BA38),A Write A to *Counter_Spider.
Is the slime monster here?
ChangeRoom_SlimeMonster ECDF LD A,$1E Jump to ChangeRoom_Demons if ValidateItemPresent reports that "A monster from the slime" isn't in the current room.
ECE1 CALL ValidateItemPresent
ECE4 JR NZ,ChangeRoom_Demons
Arm the slime monster for six turns.
ECE6 LD HL,$BA36 HL=Flag_TurnBasedEventState.
ECE9 SET 2,(HL) Set bit 2 of *HL.
ECEB LD A,$06 A=06.
ECED LD ($BA39),A Write A to *Counter_SlimeMonster.
Are the demons here?
ChangeRoom_Demons ECF0 LD A,$29 Jump to ChangeRoom_Zarn if ValidateItemPresent reports that "Some demons are attacking you. They scream and jab at you with vicious tridents" isn't in the current room.
ECF2 CALL ValidateItemPresent
ECF5 JR NZ,ChangeRoom_Zarn
Arm the demons for six turns.
ECF7 LD HL,$BA36 HL=Flag_TurnBasedEventState.
ECFA SET 3,(HL) Set bit 3 of *HL.
ECFC LD A,$06 A=06.
ECFE LD ($BA3A),A Write A to *Counter_Demons.
Is Zarn here?
ChangeRoom_Zarn ED01 LD A,$2A Jump to ChangeRoom_Witch if ValidateItemPresent reports that "The Wizard,Zarn. He prepares to cast a spell over you" isn't in the current room.
ED03 CALL ValidateItemPresent
ED06 JR NZ,ChangeRoom_Witch
Arm Zarn for six turns.
ED08 LD HL,$BA36 HL=Flag_TurnBasedEventState.
ED0B SET 4,(HL) Set bit 4 of *HL.
ED0D LD A,$06 A=06.
ED0F LD ($BA3B),A Write A to *Counter_Wizard.
Is the witch here?
ChangeRoom_Witch ED12 LD A,$2E Jump to ChangeRoom_OldMan if ValidateItemPresent reports that "The Witch" isn't in the current room.
ED14 CALL ValidateItemPresent
ED17 JR NZ,ChangeRoom_OldMan
ED19 LD A,$43 Jump to ChangeRoom_WitchSeesRing if "A ring,which you are wearing" is held.
ED1B CALL IsObjectCarried
ED1E JR Z,ChangeRoom_WitchSeesRing
Print "The Witch sees you,chuckles gleefully,then throws some majic powder at you. You cannot move. She beats you with her broom.".
ED20 LD HL,$DB63 HL=Messaging_TheWitchSeesYouChuckles.
ED23 CALL PrintStringAndNewline Call PrintStringAndNewline.
ED26 POP HL Restore HL from the stack.
ED27 LD HL,$EB23 Switch GameOver onto the stack so the next return actions a "game over".
ED2A EX (SP),HL
ED2B RET Return.
Print "The Witch sees the ring on your hand,then she screams and vanishes in a puff of smoke.".
ChangeRoom_WitchSeesRing ED2C LD HL,$DBDE HL=Messaging_TheWitchSeesTheRingOn.
ED2F CALL PrintStringAndNewline Call PrintStringAndNewline.
ED32 LD A,$2E Call Handler_DestroyItem with item 2E: "The Witch".
ED34 CALL Handler_DestroyItem
Is the old man here?
ChangeRoom_OldMan ED37 LD A,$2F Jump to ChangeRoom_GreatValley if ValidateItemPresent reports that "The Old Man. He lays down a bow and some arrows. He says:- 'These are tipped wit" isn't in the current room.
ED39 CALL ValidateItemPresent
ED3C JR NZ,ChangeRoom_GreatValley
ED3E LD A,$2F Call Handler_DestroyItem with item 2F: "The Old Man. He lays down a bow and some arrows. He says:- 'These are tipped wit".
ED40 CALL Handler_DestroyItem
ED43 LD A,$03 Call Handler_UpdateItemForTheCurrentRoom with item 03: "A bow".
ED45 CALL Handler_UpdateItemForTheCurrentRoom
ED48 LD A,$04 Call Handler_UpdateItemForTheCurrentRoom with item 04: "Some arrows".
ED4A CALL Handler_UpdateItemForTheCurrentRoom
Print "He suddenly vanishes.".
ED4D LD HL,$D93D HL=Messaging_HeSuddenlyVanishes.
ED50 CALL PausePrintStringAndScroll Call PausePrintStringAndScroll.
Has the player brought Mara to the Great Valley?
ChangeRoom_GreatValley ED53 LD A,($BA9B) Jump to ChangeRoom_Return if *CurrentRoom isn't room 05: " The Great Valley".
ED56 CP $05
ED58 JR NZ,ChangeRoom_Return
ED5A LD A,$2C Jump to ChangeRoom_Return if ValidateItemPresent reports that "The Princess,Mara" isn't in the current room.
ED5C CALL ValidateItemPresent
ED5F JR NZ,ChangeRoom_Return
ED61 POP HL Restore HL from the stack.
ED62 JP GameComplete Jump to GameComplete.
ChangeRoom_Return ED65 RET Return.
Prev: EC99 Up: Map Next: ED66