Prev: EF32 Up: Map Next: F03A
EF54: Change Room
Input
A Destination room ID
ChangeRoom EF54 LD HL,$BC6F HL=Flag_EventState.
EF57 BIT 0,(HL) Jump to ChangeRoom_0 if bit 0 of *HL is unset.
EF59 JR Z,ChangeRoom_0
EF5B LD HL,$BC67 Initialise Counter_Crab to 06.
EF5E LD (HL),$06
EF60 CP $2C Jump to ChangeRoom_0 if A is not equal to 2C.
EF62 JR NZ,ChangeRoom_0
EF64 LD HL,$BC6F Reset bit 0 of *Flag_EventState.
EF67 RES 0,(HL)
EF69 PUSH AF Stash AF on the stack.
Spawn the giant crab in The Rockpool.
EF6A LD BC,$2930 Call Handler_UpdateObjectLocation using item "A giant crab" to create it in The Rockpool.
EF6D CALL Handler_UpdateObjectLocation
EF70 POP AF Restore AF from the stack.
EF71 LD HL,$EC27 Write 2F to *EC27 to open up westbound access to The Secluded Beach from The Canyon.
EF74 LD (HL),$2F
EF76 LD HL,$EC2A Write 30 to *EC2A to open up northbound access to The Rockpool from The Secluded Beach.
EF79 LD (HL),$30
ChangeRoom_0 EF7B CALL MovePlayerToRoom Call MovePlayerToRoom.
EF7E LD E,$00 E=00.
EF80 CALL Handler_DisplayRoomImage Call Handler_DisplayRoomImage.
EF83 LD A,($BCCB) Jump to ChangeRoom_1 if *CurrentRoom is not room 30: " The Rockpool".
EF86 CP $30
EF88 JR NZ,ChangeRoom_1
EF8A LD A,$29 Call ValidateItemPresent with "A giant crab".
EF8C CALL ValidateItemPresent
EF8F JR NZ,ChangeRoom_1 Jump to ChangeRoom_1 if A is not equal to 29.
EF91 LD HL,$BC6F Set bit 0 of *Flag_EventState.
EF94 SET 0,(HL)
EF96 XOR A Write 00 to *EC27 to remove access to The Secluded Beach from The Canyon.
EF97 LD ($EC27),A
EF9A LD ($EC2A),A Write 00 to *EC2A to remove access to The Rockpool from The Secluded Beach.
EF9D LD HL,$BC66 Set bit 0 of *Flag_TurnBasedEventState which relates to the crab being active.
EFA0 SET 0,(HL)
EFA2 LD A,$06 Write 06 to *Counter_Crab.
EFA4 LD ($BC67),A
ChangeRoom_1 EFA7 LD A,$2B Call ValidateItemPresent with "A giant octopus".
EFA9 CALL ValidateItemPresent
EFAC JR NZ,ChangeRoom_2 Jump to ChangeRoom_2 if "A giant octopus" isn't in the current room.
EFAE LD HL,$BC66 Set bit 1 of *Flag_TurnBasedEventState which relates to the tentacle being active.
EFB1 SET 1,(HL)
EFB3 LD A,$05 Write 05 to *Counter_Tentacle.
EFB5 LD ($BC68),A
ChangeRoom_2 EFB8 LD A,$2A Call ValidateItemPresent with "A lion".
EFBA CALL ValidateItemPresent
EFBD JR NZ,ChangeRoom_3 Jump to ChangeRoom_3 if "A lion" isn't in the current room.
EFBF LD HL,$BC66 Set bit 3 of *Flag_TurnBasedEventState which relates to the lion being active.
EFC2 SET 3,(HL)
EFC4 LD A,$07 Write 07 to *Counter_Lion.
EFC6 LD ($BC6A),A
ChangeRoom_3 EFC9 LD HL,$E8C1 Call CheckActiveScenicEvents with Data_ItemGroup_Crocodile.
EFCC CALL CheckActiveScenicEvents
EFCF JR NZ,ChangeRoom_4 Jump to ChangeRoom_4 if A is not equal to 07.
EFD1 LD HL,$BC66 Set bit 4 of *Flag_TurnBasedEventState which relates to the crocodile being active.
EFD4 SET 4,(HL)
EFD6 LD A,$0B Write 0B to *Counter_Crocodile.
EFD8 LD ($BC6B),A
ChangeRoom_4 EFDB LD A,$18 Call ValidateItemPresent with "Surrounded by natives".
EFDD CALL ValidateItemPresent
EFE0 JR NZ,ChangeRoom_5 Jump to ChangeRoom_5 if "Surrounded by natives" isn't in the current room.
EFE2 LD HL,$BC66 Set bit 5 of *Flag_TurnBasedEventState which relates to the cannibals being active.
EFE5 SET 5,(HL)
EFE7 LD A,$09 Initialise the turn counter at *Counter_Cannibals with 09.
EFE9 LD ($BC6C),A
ChangeRoom_5 EFEC LD A,($BCCB) Jump to ChangeRoom_6 if *CurrentRoom is not room 03: " Your Ship".
EFEF CP $03
EFF1 JR NZ,ChangeRoom_6
EFF3 LD A,$1D Call ValidateItemPresent with "The Jewels of Babylon".
EFF5 CALL ValidateItemPresent
EFF8 JR NZ,ChangeRoom_6 Jump to ChangeRoom_6 if "The Jewels of Babylon" isn't in the current room.
EFFA POP HL Restore HL and HL from the stack.
EFFB POP HL
EFFC JP GameComplete Jump to GameComplete.
ChangeRoom_6 EFFF LD A,($BCCB) Jump to ChangeRoom_7 if *CurrentRoom is not room 02: " The Open Sea".
F002 CP $02
F004 JR NZ,ChangeRoom_7
F006 LD HL,$BC54 Jump to ChangeRoom_7 if bit 5 of *GameFlags_Help is set.
F009 BIT 5,(HL)
F00B JR NZ,ChangeRoom_7
F00D SET 5,(HL) Set bit 5 of *HL.
F00F LD HL,$BC66 Set bit 7 of *Flag_TurnBasedEventState which relates to the wave being active.
F012 SET 7,(HL)
F014 LD A,$05 Write 05 to *Counter_Wave.
F016 LD ($BC6E),A
ChangeRoom_7 F019 LD A,($BCCB) Jump to ChangeRoom_8 if *CurrentRoom is not room 6C: " The Bridge".
F01C CP $6C
F01E JR NZ,ChangeRoom_8
F020 LD A,$1D Call ValidateItemPresent with "The Jewels of Babylon".
F022 CALL ValidateItemPresent
F025 JR NZ,ChangeRoom_8 Jump to ChangeRoom_8 if "The Jewels of Babylon" isn't in the current room.
Print "The bridge begins to shake...".
F027 LD HL,$E5CF HL=Messaging_TheBridgeBeginsToShake.
F02A CALL PrintStringAndNewline Call PrintStringAndNewline.
F02D POP HL Restore HL from the stack.
Bad luck!
F02E LD HL,$EDD7 Switch GameOver onto the stack so the next return actions a "game over".
F031 EX (SP),HL
Print "Suddenly,it collapses.".
F032 LD HL,$E5ED HL=Messaging_SuddenlyItCollapses.
F035 CALL PausePrintStringAndScroll Call PausePrintStringAndScroll.
F038 RET Return.
ChangeRoom_8 F039 RET Return.
Prev: EF32 Up: Map Next: F03A