Prev: 8D99 Up: Map Next: 8FAD
8D9D: Action Dir
Used by the routine at Action_Run.
Action_Dir 8D9D CALL LocationLit Jump to Action_Dir_0 if LocationLit reports that it is light.
8DA0 JR NC,Action_Dir_0
8DA2 LD A,$09
8DA4 CALL GetRandomNum
8DA7 INC A
8DA8 LD ($B6E7),A
This entry point is used by the routine at ActionUntie.
Action_Dir_0 8DAB LD IY,($B70C)
8DAF LD A,(IY+$01)
8DB2 CP $FF
8DB4 JR Z,Action_Dir_1
8DB6 CALL LocateObject
8DB9 BIT 6,(IX+$07)
8DBD JR Z,Action_Dir_2
8DBF LD (IY+$01),$FF
Action_Dir_1 8DC3 LD A,($B6EA)
8DC6 CALL $9CE8
8DC9 ADD A,(IY+$02)
8DCC LD ($8D9C),A
8DCF LD A,($B6E7)
8DD2 CALL $9F08
8DD5 CP $FF
8DD7 JR NZ,Action_Dir_3
Action_Dir_2 8DD9 CALL LocationLit Jump to 9F76 if LocationLit reports that it is light.
8DDC JP NC,$9F76
8DDF CALL $9D44 Call 9D44.
8DE2 LD IX,$C11B IX=Objects.
8DE6 AND A
8DE7 LD HL,$AD7D HL="but fall and hit your head[0x15]"
8DEA RR (IX+$05)
8DEE JP NZ,PrintMsg
8DF1 LD HL,$AD8A HL="but fall and smash your skull"
8DF4 CALL PrintMsg Call PrintMsg.
8DF7 JP YouAreDead Jump to YouAreDead.
Action_Dir_3 8DFA LD A,(IX+$02)
8DFD AND A
8DFE JR Z,Action_Dir_2
8E00 LD ($8D9B),A
8E03 LD A,(IX+$01)
8E06 CALL Action_Dir_8
8E09 DEC A
8E0A JR Z,Action_Dir_2
8E0C DEC A
8E0D JR Z,Action_Dir_5
8E0F DEC A
8E10 JR Z,Action_Dir_6
This entry point is used by the routine at 9BDC.
Action_Dir_4 8E12 CALL $9D44 Call 9D44.
8E15 LD (IY+$10),B Update the location.
8E18 LD A,($B6EA) A=CurrentCharacter.
8E1B CALL $9BDD Call 9BDD.
8E1E LD A,($B6EA) A=CurrentCharacter.
8E21 CP $00 Return if the character is not $00 - "You".
8E23 RET NZ
8E24 LD IX,$C78E Call IndexIdTable using the events table, looking for a match with ActionLocationID.
8E28 LD A,($8D9B)
8E2B CALL IndexIdTable
8E2E JR Z,PercentageLocation Jump to PercentageLocation if no event was found.
8E30 LD L,(IX+$01) Load the event from the events table.
8E33 LD H,(IX+$02)
8E36 CALL TriggerAction Call TriggerAction to execute it.
The game adds a one-time only value to the completion percentage once certain locations are reached (as long as it's not dark).
PercentageLocation 8E39 CALL LocationLit Return if LocationLit reports that it is dark.
8E3C RET C
8E3D LD A,($B6EA) A=CurrentCharacter.
8E40 AND A Set zero flag if the character is $00 - "You".
8E41 LD A,($8D9B) A=ActionLocationID.
8E44 JR NZ,PercentageLocation_Skip Jump to PercentageLocation_Skip to deal with any other object.
8E46 LD HL,($8D99) HL=ActionLocationData.
8E49 BIT 6,(HL) If bit 6 is already (percentage is already added) set jump to YouSeeController.
8E4B JP NZ,YouSeeController
8E4E SET 6,(HL) Set bit 6 of the location attributes, this sets that the percentage has already been added and hence will be skipped the next time this location is accessed.
8E50 PUSH AF Stash AF on the stack.
8E51 LD IX,$8D6E Call IndexIdTable with PercentageLocationTable.
8E55 CALL IndexIdTable
8E58 JR Z,PercentageLocation_Return Jump to PercentageLocation_Return if there was no match.
8E5A PUSH DE Stash DE on the stack.
8E5B LD E,(IX+$01) DE=the percentage value to add from the match of PercentageLocationTable.
8E5E LD D,(IX+$02)
8E61 LD HL,($B6F7) Add the percentage value to PercentageComplete and write it.
8E64 ADD HL,DE
8E65 LD ($B6F7),HL
8E68 POP DE Restore DE from the stack.
PercentageLocation_Return 8E69 POP AF Restore AF from the stack.
PercentageLocation_Skip 8E6A JP YouSeePreposition Jump to YouSeePreposition.
Action_Dir_5 8E6D LD HL,$AE23 HL="[0x04] is too small for you to enter".
8E70 JR Action_Dir_7
Action_Dir_6 8E72 LD IX,($8D99)
8E76 LD HL,$AE2E HL="[0x04] is too full for you to{5} enter[0x15]".
Action_Dir_7 8E79 PUSH HL
8E7A LD L,(IX+$02)
8E7D LD H,(IX+$03)
8E80 EX (SP),HL
8E81 CALL PrintMsg Call PrintMsg.
8E84 RET Return.
Action_Dir_8 8E85 AND A
8E86 JR Z,Action_Dir_10
8E88 CALL LocateObject
8E8B LD A,(IX+$07)
8E8E AND $28
8E90 JR Z,Action_Dir_14
8E92 LD A,($B6EA)
8E95 AND A
8E96 JR NZ,Action_Dir_9
8E98 BIT 7,(IX+$04)
8E9C JR NZ,Action_Dir_14
Action_Dir_9 8E9E LD A,($8D9C)
8EA1 LD B,(IX+$02)
8EA4 SUB B
8EA5 JR NC,Action_Dir_13
Action_Dir_10 8EA7 LD A,($8D9B)
8EAA LD B,A
8EAB CALL LocateLocation
8EAE LD ($8D99),IX
8EB2 LD A,$FF
8EB4 CP (IX+$01)
8EB7 JR Z,Action_Dir_11
8EB9 LD A,B
8EBA CALL $9C41
8EBD LD C,A
8EBE LD A,($8D9C)
8EC1 SUB C
8EC2 JR NC,Action_Dir_12
Action_Dir_11 8EC4 XOR A
8EC5 RET
Action_Dir_12 8EC6 LD A,$03
8EC8 AND A
8EC9 RET
Action_Dir_13 8ECA LD A,$02
8ECC AND A
8ECD RET
Action_Dir_14 8ECE LD A,$01
8ED0 AND A
8ED1 RET
Action_Dir_15 8ED2 PUSH IX
8ED4 CALL LocateObject
Action_Dir_16 8ED7 LD A,(IX+$01)
8EDA CP $FF
8EDC JR Z,Action_Dir_17
8EDE CALL LocateObject
8EE1 BIT 5,(IX+$07)
8EE5 JR NZ,Action_Dir_16
8EE7 OR $01
Action_Dir_17 8EE9 POP IX
8EEB RET
This entry point is used by the routine at ActionClimbOut.
Action_Dir_18 8EEC LD A,($B6E8)
8EEF CALL LocateObject
8EF2 CALL ActionClimbOut_4
8EF5 JP Z,DisplayExits_3
8EF8 LD A,($B6EA)
8EFB CALL Action_Dir_15
8EFE RET NZ
8EFF CALL $9F25
8F02 CP $FF
8F04 JP Z,$9F76
8F07 LD A,(IX+$02)
8F0A CP $00
8F0C JP Z,$9F76
8F0F CALL $9D44
8F12 PUSH IX
8F14 CALL LocateLocation
8F17 BIT 7,(IX+$00)
8F1B POP IX
8F1D JR Z,Action_Dir_19
8F1F LD IY,($B70C)
8F23 LD A,(IY+$10)
8F26 PUSH AF
8F27 LD A,(IX+$02)
8F2A LD (IY+$10),A
8F2D CALL YouSeeEntry
8F30 POP AF
8F31 LD (IY+$10),A
8F34 RET
Action_Dir_19 8F35 LD HL,$AE1F HL="it is dark"
8F38 JP PrintMsg Jump to PrintMsg.
This entry point is used by the routine at ActionClimbOut.
Action_Dir_20 8F3B CALL $9F25
This entry point is used by the routines at Action_Enter and Action_Follow.
Action_Dir_21 8F3E CP $FF
8F40 JP Z,$9F76
8F43 LD A,(IX+$02)
8F46 CP $00
8F48 JP Z,$9F76
8F4B LD A,(IX+$01)
8F4E PUSH IX
8F50 CALL Action_Dir_8
8F53 POP IX
8F55 JP NZ,$9F76
8F58 CALL $9D44
8F5B LD A,(IX+$00)
8F5E LD ($B6E7),A
8F61 LD A,$FF
8F63 LD ($B6E8),A
8F66 JP Action_Dir_0
8F69 LD IX,($B708)
8F6D LD A,($B6E9)
8F70 CP $17
8F72 JR Z,Action_Dir_23
8F74 CP $18
8F76 JR Z,Action_Dir_24
Action_Dir_22 8F78 LD IY,($B70A)
8F7C BIT 1,(IY+$07)
8F80 JP Z,$9F76
8F83 BIT 2,(IX+$07)
8F87 LD A,$82
8F89 JP NZ,DisplayExits_3
8F8C LD HL,$924F
8F8F JP $9F4A
Action_Dir_23 8F92 LD A,$15
8F94 LD IY,$C454
8F98 JR Action_Dir_25
Action_Dir_24 8F9A LD A,$16
8F9C LD IY,$C469
Action_Dir_25 8FA0 LD ($B6E9),A
8FA3 LD ($B70A),IY
8FA7 LD (IY+$01),$FF
8FAB JR Action_Dir_22
Prev: 8D99 Up: Map Next: 8FAD