Prev: 65BA Up: Map Next: 69F1
65BF: Handle the input for hero.
Used by the routine at Vector_HeroInit.
HeroInputHandler 65BF LD A,(WarningTimer_E006) See if Warning needs clearing
65C2 AND A
65C3 JR Z,HeroInputHandler_0
65C5 DEC A Decrease warning timer if greater than zero.
65C6 LD (WarningTimer_E006),A
65C9 JR NZ,HeroInputHandler_0 Ignore if not zero.
65CB LD DE,Attr_WarningText Clear warning message by blanking the attributes.
65CE LD HL,Zeros
65D1 LD BC,$000A
65D4 LDIR
HeroInputHandler_0 65D6 LD A,(ThruDoorGo_E005) Thru Door Go
65D9 AND A
65DA JR Z,HeroInputHandler_1
65DC DEC A Decrease door go counter.
65DD LD (ThruDoorGo_E005),A
65E0 JP Vector_MobilesUpdate1
HeroInputHandler_1 65E3 LD A,(DeathMode)
65E6 AND A
65E7 JP NZ,HeroInputHandler_47
HeroInputHandler_2 65EA LD A,($65BE)
65ED AND A
65EE JP NZ,HeroInputHandler_42
65F1 LD A,(ThruDoorCounter_E004) See if man is stepping through a door.
65F4 AND A
65F5 JP NZ,HeroInputHandler_31
65F8 CALL VectorToKeyboardInput Check input
65FB LD A,(Hero_Anim)
65FE CP $10 Is Hero standing still (facing left or right)?
6600 JR NZ,HeroInputHandler_3
6602 LD A,(FlagsDemoMode) Is game in demo mode?
6605 AND A
6606 JR Z,HeroInputHandler_3
6608 OR $08
660A LD (InputFlags_DFBA),A
HeroInputHandler_3 660D LD A,(InputFlags_DFBA)
6610 LD HL,($65BC)
6613 DEC L
6614 JP M,HeroInputHandler_4
6617 AND H
6618 LD (InputFlags_DFBA),A
661B LD ($65BC),HL
HeroInputHandler_4 661E AND $0C Check for previous rotation. If so then do not allow rotation again until user releases a key.
6620 JR Z,HeroInputHandler_5
6622 LD A,(PreviousInputFlags_65BA)
6625 AND $0C
6627 JP NZ,Vector_MobilesUpdate1
662A LD A,(InputFlags_DFBA)
662D LD (PreviousInputFlags_65BA),A
6630 AND $0C Check for rotate
6632 CP $0C
6634 JP Z,Vector_MobilesUpdate1
6637 BIT 2,A
6639 JR Z,RotateCCW
663B LD A,(CamDirection_DFD2) Rotate clockwise
663E INC A
663F JR RotateStore
RotateCCW 6641 LD A,(CamDirection_DFD2) Rotate counter clockwise
6644 DEC A
RotateStore 6645 AND $03 mask result and store new camera direction.
6647 LD (CamDirection_DFD2),A
664A CALL ScreenUpdate
664D RET
Check for object handling inputs (get/drop/select)
HeroInputHandler_5 664E LD A,(InputFlags_DFBA)
6651 AND $E0
6653 JR Z,HeroInputHandler_8
6655 LD A,(PreviousInputFlags_65BA) Make sure user isn't holding down a key. If so do no object handling until key is released.
6658 AND $60
665A JR NZ,HeroInputHandler_8
665C LD A,(InputFlags_DFBA) Check for select input.
665F BIT 7,A
6661 JR Z,HeroInputHandler_6
6663 LD A,(PreviousInputFlags_65BA) Making sure user isn't holding key down.
6666 BIT 7,A
6668 JR NZ,HeroInputHandler_6
666A CALL Vector_HandleSelection
666D JR HeroInputHandler_8
Handle left/right.
HeroInputHandler_6 666F LD A,(InputFlags_DFBA)
6672 AND $60
6674 CP $60
6676 JR Z,HeroInputHandler_8
6678 BIT 5,A
667A JR Z,HeroInputHandler_7
667C CALL Vector_ObjectPickUp
667F JR HeroInputHandler_8
HeroInputHandler_7 6681 BIT 6,A
6683 CALL NZ,Vector_ObjectDrop
HeroInputHandler_8 6686 LD A,(InputFlags_DFBA)
6689 LD (PreviousInputFlags_65BA),A
668C LD A,(Hero_Anim) See if the current frame matches anything from the animation table.
668F LD HL,HeroAnimFrames
6692 LD BC,$0007
6695 CPIR
6697 JP NZ,HeroInputHandler_25
669A LD HL,(ManData_PosSecondary_dfc5) Workout which axis to move along.
669D LD DE,$0008
66A0 LD A,(CamDirection_DFD2)
66A3 BIT 0,A
66A5 JR Z,HeroInputHandler_9
66A7 LD HL,(ManData_PosPrimary_dfc3)
HeroInputHandler_9 66AA BIT 1,A
66AC JR Z,HeroInputHandler_10
66AE LD DE,$FFF8
HeroInputHandler_10 66B1 LD A,(InputFlags_DFBA) Get the walk inputs and store them. If both are pressed then do nothing.
66B4 AND $03
66B6 CP $03
66B8 JR NZ,HeroInputHandler_11
66BA XOR A
HeroInputHandler_11 66BB LD ( s0),A
66BE LD A,(Hero_Anim) Halfway through a step so keep moving.
66C1 CP $04
66C3 JP Z,HeroInputHandler_19
66C6 CP $0B
66C8 JP Z,HeroInputHandler_19
66CB LD A,(InputFlags_DFBA) Attack key is down.
66CE BIT 4,A
66D0 JP NZ,HeroInputHandler_37
66D3 LD A,(Hero_Anim)
66D6 CP $07
66D8 JP Z,HeroInputHandler_25
66DB CP $0E
66DD JP Z,HeroInputHandler_25
66E0 LD A,( s0) Get input for walking again.
66E3 CP $00 Nothing pressed.
66E5 JP Z,HeroInputHandler_30
66E8 LD BC,(ManWalkDirection_DFD4)
66EC CP C
66ED JR Z,HeroInputHandler_12
66EF LD A,(Hero_Anim) Standing still animation.
66F2 CP $10
66F4 JR NZ,HeroInputHandler_12
66F6 LD A,$13 Set to facing the camera. Part of turning around. Setting heros direction to the opposite of camera.
66F8 LD (Hero_Anim),A
66FB LD A,(CamDirection_DFD2)
66FE XOR $02
6700 LD (ManCamDirection_DFD5),A
6703 JP HeroInputHandler_30
HeroInputHandler_12 6706 LD A,( s0)
6709 CP $02
670B JR Z,HeroInputHandler_13
670D AND A
670E ADC HL,DE
6710 JR HeroInputHandler_14
HeroInputHandler_13 6712 SBC HL,DE
HeroInputHandler_14 6714 JP M,HeroInputHandler_17
6717 JR Z,HeroInputHandler_17
6719 LD E,L
671A LD D,H
671B LD BC,$01FE
671E AND A
671F SBC HL,BC
6721 JR NC,HeroInputHandler_17
6723 LD IX,(CurrentPathPtr)
6727 LD L,(IX+$02)
672A LD H,$00
672C ADD HL,HL
672D SCF
672E SBC HL,DE
6730 JP NC,HeroInputHandler_15
6733 LD L,(IX+$03)
6736 LD H,$00
6738 ADD HL,HL
6739 EX DE,HL
673A SCF
673B SBC HL,DE
673D JP C,HeroInputHandler_17
HeroInputHandler_15 6740 LD A,( s0)
6743 CALL $891F
6746 LD A,(ThruDoorCounter_E004)
6749 CP $01
674B JR Z,HeroInputHandler_17
674D LD A,( s0)
6750 LD (ManWalkDirection_DFD4),A
6753 LD C,$01
6755 CP $01
6757 JR Z,HeroInputHandler_16
6759 LD C,$FF
HeroInputHandler_16 675B LD A,(CamDirection_DFD2)
675E ADD A,C
675F AND $03
6761 LD (ManCamDirection_DFD5),A
6764 LD A,$10
6766 LD (Hero_Anim),A
6769 JP HeroInputHandler_30
HeroInputHandler_17 676C LD A,( s0)
676F LD (ManWalkDirection_DFD4),A
6772 LD C,$01
6774 CP $01
6776 JR Z,HeroInputHandler_18
6778 LD C,$FF
HeroInputHandler_18 677A LD A,(CamDirection_DFD2)
677D ADD A,C
677E AND $03
6780 LD (ManCamDirection_DFD5),A
6783 LD A,($65BB)
6786 ADD A,$02
6788 LD (Hero_Anim),A
678B JR HeroInputHandler_29
HeroInputHandler_19 678D LD A,(Hero_Anim)
6790 LD ($65BB),A
6793 LD A,(ManWalkDirection_DFD4)
6796 CP $02
6798 JR Z,HeroInputHandler_20
679A AND A
679B ADC HL,DE
679D JR HeroInputHandler_21
HeroInputHandler_20 679F SBC HL,DE
HeroInputHandler_21 67A1 JP M,HeroInputHandler_22
67A4 JR Z,HeroInputHandler_22
67A6 LD E,L
67A7 LD D,H
67A8 LD BC,$01FE
67AB AND A
67AC SBC HL,BC
67AE JR NC,HeroInputHandler_22
67B0 LD IX,(CurrentPathPtr)
67B4 LD L,(IX+$02)
67B7 LD H,$00
67B9 ADD HL,HL
67BA AND A
67BB SBC HL,DE
67BD JR NC,HeroInputHandler_23
67BF LD L,(IX+$03)
67C2 LD H,$00
67C4 ADD HL,HL
67C5 EX DE,HL
67C6 AND A
67C7 SBC HL,DE
67C9 JR NC,HeroInputHandler_23
HeroInputHandler_22 67CB LD A,( s0)
67CE LD HL,ManWalkDirection_DFD4
67D1 CP (HL)
67D2 JR Z,HeroInputHandler_25
67D4 JR HeroInputHandler_24
HeroInputHandler_23 67D6 LD A,(ManWalkDirection_DFD4)
67D9 CALL $891F
67DC LD A,(ThruDoorCounter_E004)
67DF CP $01
67E1 JR Z,HeroInputHandler_25
HeroInputHandler_24 67E3 LD A,(Hero_Anim)
67E6 CP $04
67E8 LD A,$0F
67EA JR Z,HeroInputHandler_28
67EC LD A,$11
67EE JR HeroInputHandler_28
HeroInputHandler_25 67F0 LD A,(Hero_Anim)
67F3 CP $0F
67F5 JR Z,HeroInputHandler_26
67F7 CP $11
67F9 JR NZ,HeroInputHandler_27
HeroInputHandler_26 67FB LD A,$10
67FD JR HeroInputHandler_28
HeroInputHandler_27 67FF INC A
6800 CP $0F
6802 JR NZ,HeroInputHandler_28
6804 LD A,$01
HeroInputHandler_28 6806 LD (Hero_Anim),A
HeroInputHandler_29 6809 CALL HeroInputHandle
HeroInputHandler_30 680C LD A,(Hero_Anim)
680F JP Vector_MobilesUpdate2
HeroInputHandler_31 6812 CP $02
6814 JR Z,HeroInputHandler_33
6816 CP $03
6818 JR Z,HeroInputHandler_34
681A CP $04
681C JR Z,HeroInputHandler_35
681E LD A,(Hero_Anim)
6821 CP $01
6823 JR Z,HeroInputHandler_32
6825 CP $08
6827 JR NZ,HeroInputHandler_25
HeroInputHandler_32 6829 LD A,$02
682B LD (ThruDoorCounter_E004),A
682E LD A,$05
6830 LD (ThruDoorGo_E005),A
6833 XOR A
6834 JP Vector_MobilesUpdate2
HeroInputHandler_33 6837 LD A,$03
6839 LD (ThruDoorCounter_E004),A
683C LD A,$05
683E LD (ThruDoorGo_E005),A
6841 JP $8922
HeroInputHandler_34 6844 LD A,$04
6846 LD (ThruDoorCounter_E004),A
6849 JR HeroInputHandler_29
HeroInputHandler_35 684B LD A,(Hero_Anim)
684E CP $04
6850 JR Z,HeroInputHandler_36
6852 CP $0B
6854 JR NZ,HeroInputHandler_27
HeroInputHandler_36 6856 LD L,$02
6858 LD H,$03
685A LD ($65BC),HL
685D XOR A
685E LD (ThruDoorCounter_E004),A
6861 JP HeroInputHandler
HeroInputHandler_37 6864 LD A,(ManWalkDirection_DFD4)
6867 CP $02
6869 JR Z,HeroInputHandler_38
686B AND A
686C ADC HL,DE
686E JR HeroInputHandler_39
HeroInputHandler_38 6870 SBC HL,DE
HeroInputHandler_39 6872 JP M,HeroInputHandler_41
6875 JR Z,HeroInputHandler_41
6877 LD E,L
6878 LD D,H
6879 LD BC,$01FE
687C AND A
687D SBC HL,BC
687F JR NC,HeroInputHandler_41
6881 LD IX,(CurrentPathPtr)
6885 LD L,(IX+$02)
6888 LD H,$00
688A ADD HL,HL
688B SCF
688C SBC HL,DE
688E JP NC,HeroInputHandler_40
6891 LD L,(IX+$03)
6894 LD H,$00
6896 ADD HL,HL
6897 EX DE,HL
6898 SCF
6899 SBC HL,DE
689B JP C,HeroInputHandler_41
HeroInputHandler_40 689E LD HL,InputFlags_DFBA
68A1 RES 4,(HL)
68A3 JP HeroInputHandler_8
HeroInputHandler_41 68A6 LD A,$01
68A8 LD ($65BE),A
68AB LD A,(Hero_Anim)
68AE CP $07
68B0 JP Z,HeroInputHandler_25
68B3 CP $0E
68B5 JP Z,HeroInputHandler_25
68B8 LD A,($65BB)
68BB ADD A,$03
68BD LD (Hero_Anim),A
68C0 JP HeroInputHandler_25
HeroInputHandler_42 68C3 DEC A
68C4 JR Z,HeroInputHandler_43
68C6 LD ($65BE),A
68C9 JP Vector_MobilesUpdate1
HeroInputHandler_43 68CC LD A,(Hero_Anim)
68CF LD HL,$658F
68D2 LD BC,$000E
68D5 CPIR
68D7 LD A,(HL)
68D8 LD (Hero_Anim),A
68DB CP $14
68DD JR NZ,HeroInputHandler_44
68DF LD A,$05
68E1 LD ($65BE),A
68E4 CALL HeroInputHandle
68E7 CALL $6534
68EA LD A,(Hero_Anim)
68ED JP Vector_MobilesUpdate2
HeroInputHandler_44 68F0 CP $04
68F2 JR Z,HeroInputHandler_45
68F4 CP $0B
68F6 JR NZ,HeroInputHandler_46
HeroInputHandler_45 68F8 CALL $6534
68FB JP HeroInputHandler_29
HeroInputHandler_46 68FE CP $10
6900 JP NZ,HeroInputHandler_29
6903 XOR A
6904 LD ($65BE),A
6907 JP HeroInputHandler_29
HeroInputHandler_47 690A CP $01
690C JR NZ,HeroInputHandler_51
HeroInputHandler_48 690E LD A,$02
6910 LD (DeathMode),A
6913 LD A,$3C
6915 LD (ThruDoorGo_E005),A
6918 LD A,($65BE)
691B AND A
691C JR Z,HeroInputHandler_49
691E XOR A
691F LD ($65BE),A
6922 LD A,(Hero_Anim)
6925 CP $14
6927 JR NZ,HeroInputHandler_49
6929 CALL $6534
HeroInputHandler_49 692C LD A,(ManData_InventoryCount_DFC9)
692F AND A
6930 JR Z,HeroInputHandler_50
6932 CALL Vector_ObjectDrop
6935 JR HeroInputHandler_49
HeroInputHandler_50 6937 LD DE,$000A
693A LD HL,$00FA
693D CALL $03B5
6940 XOR A
6941 JP Vector_MobilesUpdate2
HeroInputHandler_51 6944 CP $02
6946 JR NZ,HeroInputHandler_52
6948 XOR A
6949 LD (DeathMode),A
694C JP HeroInit
HeroInputHandler_52 694F CP $14
6951 JR NC,HeroInputHandler_54
6953 INC A
6954 CP $12
6956 JR NZ,HeroInputHandler_53
6958 XOR A
6959 LD (DeathMode),A
695C JP HeroInputHandler_2
HeroInputHandler_53 695F LD (DeathMode),A
6962 LD L,$01
6964 LD H,$E3
6966 LD ($65BC),HL
6969 JP HeroInputHandler_2
HeroInputHandler_54 696C INC A
696D LD (DeathMode),A
6970 CP $18
6972 JR NC,HeroInputHandler_56
6974 LD L,$01
6976 LD H,$01
6978 LD A,(CamDirection_DFD2)
697B BIT 1,A
697D JR NZ,HeroInputHandler_55
697F LD H,$02
HeroInputHandler_55 6981 LD ($65BC),HL
6984 JP HeroInputHandler_2
HeroInputHandler_56 6987 LD A,(DeathMode)
698A CP $18
698C JR NZ,HeroInputHandler_58
698E LD A,(ManData_InventoryCount_DFC9)
6991 AND A
6992 JP Z,HeroInputHandler_48
6995 LD A,($65BE)
6998 AND A
6999 JR Z,HeroInputHandler_57
699B XOR A
699C LD ($65BE),A
699F LD A,(Hero_Anim)
69A2 CP $14
69A4 JR NZ,HeroInputHandler_57
69A6 CALL $6534
HeroInputHandler_57 69A9 CALL Vector_ObjectDrop
HeroInputHandler_58 69AC LD A,(DeathMode)
69AF CP $1D
69B1 JR C,HeroInputHandler_60
69B3 LD A,(Hero_Anim)
69B6 CP $06
69B8 JR Z,HeroInputHandler_59
69BA CP $0D
69BC JR NZ,HeroInputHandler_60
HeroInputHandler_59 69BE LD A,$10
69C0 LD (Hero_Anim),A
69C3 XOR A
69C4 LD (DeathMode),A
69C7 JR HeroInputHandler_61
HeroInputHandler_60 69C9 LD A,(Hero_Anim)
69CC LD HL,$659D
69CF LD BC,$001D
69D2 CPIR
69D4 LD A,(HL)
69D5 LD (Hero_Anim),A
HeroInputHandler_61 69D8 LD A,(ManWalkDirection_DFD4)
69DB XOR $03
69DD LD (ManWalkDirection_DFD4),A
69E0 CALL HeroInputHandle
69E3 LD A,(ManWalkDirection_DFD4)
69E6 XOR $03
69E8 LD (ManWalkDirection_DFD4),A
69EB LD A,(Hero_Anim)
69EE JP Vector_MobilesUpdate2
Prev: 65BA Up: Map Next: 69F1