-
Notifications
You must be signed in to change notification settings - Fork 53
/
glitched.asm
79 lines (79 loc) · 2.46 KB
/
glitched.asm
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
;================================================================================
; Glitched Mode Fixes
;================================================================================
GetAgahnimPalette:
LDA.b RoomIndex ; get room id
CMP.b #13 : BNE + ; Agahnim 2 room
LDA.b #$07 ; Use Agahnim 2
RTL
+ ; Elsewhere
LDA.b #$0b ; Use Agahnim 1
RTL
;--------------------------------------------------------------------------------
GetAgahnimDeath:
STA.w $0BA0, X ; thing we wrote over
LDA.b RoomIndex ; get room id
CMP.b #13 : BNE + ; Agahnim 2 room
LDA.l Bugfix_SetWorldOnAgahnimDeath : BEQ ++
LDA.l InvertedMode : BEQ +++
LDA.b #$00 : STA.l CurrentWorld ; Switch to light world
BRA ++
+++
LDA.b #$40 : STA.l CurrentWorld ; Switch to dark world
++
LDA.b #$01 ; Use Agahnim 2
RTL
+ ; Elsewhere
LDA.l Bugfix_SetWorldOnAgahnimDeath : BEQ ++
LDA.l InvertedMode : BEQ +++
LDA.b #$40 : STA.l CurrentWorld ; Switch to dark world
BRA ++
+++
LDA.b #$00 : STA.l CurrentWorld ; Switch to light world
; (This will later get flipped to DW when Agahnim 1
; warps us to the pyramid)
++
LDA.b #$00 ; Use Agahnim 1
RTL
;--------------------------------------------------------------------------------
GetAgahnimType:
LDA.b RoomIndex ; get room id
CMP.b #13 : BNE + ; Agahnim 2 room
LDA.b #$0006 ; Use Agahnim 2
BRA .done
+ ; Elsewhere
LDA.b #$0001 ; Use Agahnim 1
.done
RTL
;--------------------------------------------------------------------------------
GetAgahnimSlot:
PHX ; thing we wrote over
LDA.b RoomIndex ; get room id
CMP.b #13 : BNE + ; Agahnim 2 room
LDA.b #$01 ; Use Agahnim 2
JML.l GetAgahnimSlotReturn
+ ; Elsewhere
LDA.b #$00 ; Use Agahnim 1
JML.l GetAgahnimSlotReturn
;--------------------------------------------------------------------------------
GetAgahnimLightning:
INC.w SpriteAux, X ; thing we wrote over
LDA.b RoomIndex ; get room id
CMP.b #13 : BNE + ; Agahnim 2 room
LDA.b #$01 ; Use Agahnim 2
RTL
+ ; Elsewhere
LDA.b #$00 ; Use Agahnim 1
RTL
;--------------------------------------------------------------------------------
;0 = Allow
;1 = Forbid
AllowJoypadInput:
LDA.l PermitSQFromBosses : BEQ .fullCheck
LDA.w RoomItemsTaken : AND.b #$80 : BEQ .fullCheck
LDA.w MedallionFlag : ORA.w CutsceneFlag ; we have heart container, do short check
RTL
.fullCheck
LDA.w MedallionFlag : ORA.w CutsceneFlag : ORA.w NoMenu
RTL
;--------------------------------------------------------------------------------