-
Notifications
You must be signed in to change notification settings - Fork 4
/
Copy pathancilla_happiness_pond_rupees.asm
220 lines (127 loc) · 5 KB
/
ancilla_happiness_pond_rupees.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
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
; ==============================================================================
; Ancilla 0x42 (rupees thrown into pond of wishing)
; *$447DE-$44818 JUMP LOCATION
Ancilla_HappinessPondRupees:
{
LDA.b #$02 : STA $0309
STZ $0308
LDX.b #$09
.next_rupee_slot
LDA $7F586C, X : BEQ .inactive_rupee
PHX
JSR HappinessPondRupees_ExecuteRupee
PLX
LDA $7F58AA, X : CMP.b #$02 : BNE .dont_deactivate_rupee
LDA.b #$00 : STA $7F586C, X
.inactive_rupee
.dont_deactivate_rupee
DEX : BPL .next_rupee_slot
LDX.b #$09
.find_active_rupee_loop
LDA $7F586C, X : BNE .not_all_inactive
DEX : BPL .find_active_rupee_loop
LDX $0FA0
STZ $0C4A, X
RTS
.not_all_inactive
; \wtf Could be wrong, but this is probably not necessary since
; we're done and we'll be moving on to the next Ancilla anyways, so
; restoring the index is not useful at all.
BRL Ancilla_RestoreIndex
}
; ==============================================================================
; *$44819-$448BD LOCAL
HappinessPondRupees_ExecuteRupee:
{
; \wtf Wait, why does this need 4 oam slots exactly?
LDA.b #$10 : JSR Ancilla_AllocateOam
PHX
LDY $0FA0
JSR HappinessPondRupee_LoadRupeeeState
TYX
LDA $0C54, X : BEQ .not_in_splash_state
LDA $11 : BNE .just_draw_splash
LDA $0C68, X : BNE .just_draw_splash
LDA.b #$06 : STA $0C68, X
INC $0C5E, X : LDA $0C5E, X : CMP.b #$05 : BNE .just_draw_splash
INC $0C54, X
BRL .return
.just_draw_splash
JSR Ancilla_ObjectSplash.draw
BRA .return
.not_in_splash_state
LDA $11 : BNE .just_draw_item
LDA $0C68, X : BNE .just_draw_item
LDA $0294, X : SUB.b #$02 : STA $0294, X
JSR Ancilla_MoveVert
JSR Ancilla_MoveHoriz
JSR Ancilla_MoveAltitude
LDA $029E, X : BPL .just_draw_item
CMP.b #$E4 : BCS .just_draw_item
LDA.b #$E4 : STA $029E, X
LDA $0BFA, X : ADD.b #$1E : STA $0BFA, X
LDA $0C0E, X : ADC.b #$00 : STA $0C0E, X
LDA $0C04, X : ADD.b #$FC : STA $0C04, X
LDA $0C18, X : ADC.b #$FF : STA $0C18, X
STZ $0C5E, X
LDA.b #$06 : STA $0C68, X
LDA.b #$28 : JSR Ancilla_DoSfx2
INC $0C54, X
BRA .return
.just_draw_item
LDA.b #$02 : STA $0BF0, X
LDA.b #$00 : STA $0C7C, X
JSR Ancilla_WishPondItem.draw
.return
TXY
PLX
JSR HappinessPondRupees_StoreRupeeState
RTS
}
; ==============================================================================
; *$448BE-$44923 LOCAL
HappinessPondRupees_LoadRupeeeState:
{
; \wtf All of these arrays appear to have been allocated 0x0C bytes
; apart, except there's a 2 byte gap between the arrays starting at
; $7F586C and $7F587A. Why?
LDA $7F5824, X : STA $0BFA, Y
LDA $7F5830, X : STA $0C0E, Y
LDA $7F583C, X : STA $0C04, Y
LDA $7F5848, X : STA $0C18, Y
LDA $7F5854, X : STA $029E, Y
LDA $7F5800, X : STA $0C22, Y
LDA $7F580C, X : STA $0C2C, Y
LDA $7F5818, X : STA $0294, Y
LDA $7F5886, X : STA $0C36, Y
LDA $7F5892, X : STA $0C40, Y
LDA $7F589E, X : STA $02A8, Y
LDA $7F587A, X : STA $0C5E, Y
LDA $7F58AA, X : STA $0C54, Y
LDA $7F5860, X : BEQ .timer_expired
DEC A
.timer_expired
STA $0C68, Y
RTS
}
; ==============================================================================
; *$44924-$44986 LOCAL
HappinessPondRupees_StoreRupeeState:
{
LDA $0BFA, Y : STA $7F5824, X
LDA $0C0E, Y : STA $7F5830, X
LDA $0C04, Y : STA $7F583C, X
LDA $0C18, Y : STA $7F5848, X
LDA $029E, Y : STA $7F5854, X
LDA $0C22, Y : STA $7F5800, X
LDA $0C2C, Y : STA $7F580C, X
LDA $0294, Y : STA $7F5818, X
LDA $0C36, Y : STA $7F5886, X
LDA $0C40, Y : STA $7F5892, X
LDA $02A8, Y : STA $7F589E, X
LDA $0C5E, Y : STA $7F587A, X
LDA $0C68, Y : STA $7F5860, X
LDA $0C54, Y : STA $7F58AA, X
RTS
}
; ==============================================================================