-
Notifications
You must be signed in to change notification settings - Fork 3
/
ancilla_repulse_spark.asm
140 lines (87 loc) · 3.46 KB
/
ancilla_repulse_spark.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
; ==============================================================================
; $40F82-$40F88 DATA
pool Ancilla_RepulseSpark:
{
.chr
db $93, $82, $81
.properties
db $22, $12, $22, $22
}
; ==============================================================================
; My best guess is that this handles generic hit / spark effects that
; don't fit anywhere else, but $0FAC is quite unfamiliar still. It never
; seems to receive a value higher than 5, but there are checks for
; it as high as 9 and beyond.
; *$40F89-$4107F LOCAL
Ancilla_RepulseSpark:
{
LDA $0FAC : BEQ Ancilla_IsBelowPlayer.return
; Activate enemies that are listening for sounds?
LDA.b #$02 : STA $0FDC
DEC $0FAF : BPL .dont_decrement_state
DEC $0FAC
LDA.b #$01 : STA $0FAF
.dont_decrement_state
LDA.b #$10
LDY $0FB3 : BEQ .dont_sort_sprites
LDY $0B68 : BNE .on_bg1
JSL OAM_AllocateFromRegionD
BRA .check_if_on_screen
.on_bg1
JSL OAM_AllocateFromRegionF
BRA .check_if_on_screen
.dont_sort_sprites
JSL OAM_AllocateFromRegionA
.check_if_on_screen
LDA $0FAD : SUB $00E2 : CMP.b #$F8 : BCS .off_screen
STA $00
LDA $0FAE : SUB $00E8 : CMP.b #$F0 : BCS .off_screen
STA $01
LDA $0FAC : CMP.b #$03 : BCC .later_states
LDY.b #$00
LDA $00 : STA ($90), Y
LDA $01 : INY : STA ($90), Y
LDA.b #$80
LDX $0FAC : CPX.b #$09 : BCS .use_different_chr
LDA.b #$92
.use_different_chr
INY : STA ($90), Y
LDX $0B68
LDA.l .properties, X : INY : STA ($90), Y
TYA : LSR #2 : TAY
LDA.b #$00 : STA ($92), Y
RTS
.off_screen
; Self terminate because the object went off screen.
STZ $0FAC
RTS
.later_states
; The last three states of this object use more oam entries than the
; earlier ones.
LDA $00 : SUB.b #$04 : LDY.b #$00 : STA ($90), Y
LDY.b #$08 : STA ($90), Y
ADD.b #$08 : LDY.b #$04 : STA ($90), Y
LDY.b #$0C : STA ($90), Y
LDA $01 : SUB.b #$04 : LDY.b #$01 : STA ($90), Y
LDY.b #$05 : STA ($90), Y
ADD.b #$08 : LDY.b #$09 : STA ($90), Y
LDY.b #$0D : STA ($90), Y
LDX $0B68
LDA.l .properties, X : LDY.b #$03 : STA ($90), Y
ORA.b #$40 : LDY.b #$07 : STA ($90), Y
ORA.b #$80 : LDY.b #$0F : STA ($90), Y
EOR.b #$40 : LDY.b #$0B : STA ($90), Y
LDX $0FAC
LDA .chr, X : LDY.b #$02 : STA ($90), Y
LDY.b #$06 : STA ($90), Y
LDY.b #$0A : STA ($90), Y
LDY.b #$0E : STA ($90), Y
LDY.b #$00
LDA.b #$00
STA ($92), Y : INY
STA ($92), Y : INY
STA ($92), Y : INY
STA ($92), Y
RTS
}
; ==============================================================================