Prev: CB92 Up: Map Next: CC31
CB98: Solitary
This sends the hero to solitary.
Used by the routines at escaped, collision, target_reached and action_papers.
Input
Silence the bell.
solitary CB98 LD A,$FF Set the bell ring counter/flag to bell_STOP
CB9A LD ($A130),A
Seize hero's held items.
CB9D LD HL,$8215 Point HL at items_held[0]
CBA0 LD C,(HL) Fetch the item
CBA1 LD (HL),A Set it to item_NONE
CBA2 CALL item_discovered Discover the item
CBA5 LD HL,$8216 Point HL at items_held[1]
CBA8 LD C,(HL) Fetch the item
CBA9 LD (HL),$FF Set it to item_NONE
CBAB CALL item_discovered Discover the item
CBAE CALL draw_all_items Draw held items
Discover all items.
CBB1 LD B,$10 Set B to 16 iterations - once per item
CBB3 LD HL,$76C9 Point HL at item_structs[0].room
Start loop
solitary_0 CBB6 PUSH BC Preserve loop counter
CBB7 PUSH HL Preserve itemstruct pointer
Is the item outdoors?
CBB8 LD A,(HL) Fetch itemstruct.room_and_flags
CBB9 AND $3F Mask off the room part. Is the item indoors?
CBBB JR NZ,solitary_next Jump if so
CBBD DEC HL Point HL at itemstruct.item_and_flags
CBBE LD A,(HL) Fetch it
CBBF INC HL Advance HL to itemstruct.pos.x
CBC0 INC HL
CBC1 EX DE,HL Bank itemstruct pointer
CBC2 EX AF,AF' Bank item_and_flags
CBC3 XOR A Set area index to zero
Start loop
solitary_1 CBC4 PUSH AF Preserve area index
CBC5 PUSH DE Preserve itemstruct pointer
If the item is within the camp bounds then it will be discovered.
CBC6 CALL within_camp_bounds Is the specified position within the bounds of the indexed area?
CBC9 JR Z,solitary_discovered Jump if so
CBCB POP DE Restore itemstruct pointer
CBCC POP AF Restore area index
CBCD INC A Loop until area index is 3
CBCE CP $03
CBD0 JP NZ,solitary_1
CBD3 JR solitary_next Jump to next
solitary_discovered CBD5 POP DE Restore itemstruct pointer
CBD6 POP AF Restore area index
CBD7 EX AF,AF' Unbank item_and_flags
CBD8 LD C,A Discover the item
CBD9 CALL item_discovered
solitary_next CBDC POP HL Restore itemstruct pointer
CBDD POP BC Restore loop counter
CBDE LD DE,$0007 Advance HL to the next itemstruct
CBE1 ADD HL,DE
CBE2 DJNZ solitary_0 ...loop
Move the hero to solitary.
CBE4 LD A,$18 Set vischar[0].room to room_24_SOLITARY
CBE6 LD ($801C),A
Commentary: This should instead be 24 which is the door between room_22_REDKEY and room_24_SOLITARY.
CBE9 LD A,$14 Set the global current door to 20
CBEB LD ($68A1),A
CBEE LD B,$23 Decrease morale by 35
CBF0 CALL decrease_morale
CBF3 CALL reset_map_and_characters Reset all visible characters, clock, day_or_night flag, general flags, collapsed tunnel objects, lock the gates, reset all beds, clear the mess halls and reset characters
Set the commandant on a path which results in the hero being released.
CBF6 LD DE,$7613 Point DE at character_structs[character_0_COMMANDANT].room
CBF9 LD HL,$CC31 Point HL at solitary_commandant_data
CBFC LD BC,$0006 Copy six bytes
CBFF LDIR
Queue solitary messages.
CC01 LD B,$0D Queue the message "YOU ARE IN SOLITARY"
CC03 CALL queue_message
CC06 LD B,$0E Queue the message "WAIT FOR RELEASE"
CC08 CALL queue_message
CC0B LD B,$13 Queue the message "ANOTHER DAY DAWNS"
CC0D CALL queue_message
CC10 LD A,$FF Inhibit user input
CC12 LD ($A13A),A
CC15 XOR A Immediately take automatic control of the hero
CC16 LD ($A139),A
CC19 LD HL,$CE2E Set vischar.mi.sprite to the prisoner sprite set
CC1C LD ($8015),HL
CC1F LD HL,$7AC6 Point HL at solitary_pos for transition
CC22 LD IY,$8000 Point IY at the hero's vischar
CC26 LD (IY+$0E),$03 Set vischar.direction to direction_BOTTOM_LEFT
CC2A XOR A Set hero's route.index to routeindex_0_HALT
CC2B LD ($8002),A
CC2E JP transition Exit via transition
Prev: CB92 Up: Map Next: CC31