-
Notifications
You must be signed in to change notification settings - Fork 10
/
ffight_ae_init_player_hijacks.asm
213 lines (165 loc) · 5.02 KB
/
ffight_ae_init_player_hijacks.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
;================================================
hijack_player_2_hitbox_init:
lea ($53a2, A5), A0
jsr $0097e2
bsr p3_init_hitboxes
rts
;================================================
;================================================
; Player 3 hitbox init
p3_init_hitboxes:
move.w #$15, ($736a,A5)
move.l #$fff36a, ($736c,A5)
clr.l ($5308,A5)
clr.l ($530c,A5)
move.w #$14, D7
lea ($736a, A5), A0
jsr $0097e2
move.w #$15, ($73a2,A5)
move.l #$fff36a, ($73a4,A5)
move.w #$14, D7
lea ($73a2, A5), A0
jsr $0097e2
rts
;================================================
;================================================
hijack_player_2_init_char_select:
btst #$1, ($7f,A5)
beq hijack_player_2_init_char_select_check_p3
jsr $009f9c
hijack_player_2_init_char_select_check_p3:
btst #$2, ($7f,A5)
beq hijack_player_2_init_char_select_exit
bsr p3_init_char_select
hijack_player_2_init_char_select_exit:
rts
;================================================
;================================================
p3_init_char_select:
bsr p3_init_more
lea (p3_main_mem,A5), A4
jsr $00a2ba ; Clear ram
move.b ($85,A5), ($80,A4)
move.b #$1, ($0,A4) ; Initialize player
move.b #$2, ($13,A4)
move.b #$82, ($2F,A4) ; palette assignment
movea.l ($b6,A5), A1
move.w (A1), ($92,A4)
bsr p3_a032
rts
;================================================
;================================================
handle_two_player_init:
lea (p2_main_mem,A5), A4
jsr $009F7C
move.b #$1, ($13,A4)
move.b #$81, ($2F,A4) ; palette assignment
; jsr hijack_charsel_copypalette
rts
;================================================
;================================================
handle_player_three_init:
lea (p3_main_mem,A5), A4
jsr $009F7C
move.b #$2, ($13,A4)
move.b #$82, ($2F,A4) ; palette assignment
; jsr hijack_charsel_copypalette
rts
;================================================
;================================================
player_3_main_init:
lea (p3_main_mem,A5), A4
move.l ($84,A4), -(A7)
move.b ($81,A4), -(A7)
move.b ($90,A4), -(A7)
move.w ($92,A4), -(A7)
bsr p3_init_more
bsr handle_player_three_init
move.w (A7)+, ($92,A4)
move.b (A7)+, ($90,A4)
move.b (A7)+, ($81,A4)
jsr $00a0fe
bsr p3_a032
jsr $00A084 ; Go here instead of a070, the player address is already loaded in a4...
jsr $00a106
move.l (A7)+, ($84,A4)
jmp $00A17C
;================================================
;================================================
; Player 3 version of a032, called by a070
p3_a032:
; lea ($4df4,A5), A3
; lea (-$4d00,A5), A2
lea ($4dee,A5), A3
lea (-$4e80,A5), A2
jsr $00a042
rts
;================================================
;================================================
p3_init_level_start:
bsr p3_a032
btst #$2, ($7f,A5)
beq p3_init_level_start_exit
lea (p3_main_mem,A5), A4
jmp $00a084
p3_init_level_start_exit:
rts
;================================================
;================================================
hijack_clear_player_2_ram_char_select:
bsr p3_init_more
lea (p3_main_mem,A5), A4
jsr $00a2ba ; Clear player ram
movea.l ($b6,A5), A1
move.w (A1), ($92,A4)
; Do p2 stuff
jsr $009fec
lea (p2_main_mem,A5), A4
jsr $00a2ba ; Clear player ram
jmp $009F50
;================================================
;================================================
p3_init_more:
clr.l (p3_main_target_queue_data,A5) ; Clear main target queue data
move.b #$2, (p3_main_target_queue_data_play_id,A5)
clr.w (p3_main_target_queue_data_play_mem_ref,A5)
clr.w D0
move.w D0, (p3_target_queue_head_offset, A5) ; Clear target queue head/tail
move.w D0, (p3_target_queue_tail_offset, A5)
move.l #$1f, D0
moveq #$0, D1
lea (p3_target_queue_offset,A5), A0 ; Load target queue for clearing
p3_init_more_loop:
move.l D1, (A0)+
dbra D0, p3_init_more_loop
rts
;================================================
;================================================
hijack_init_players_level_start
jsr $00a05c
jsr $00a070
bsr p3_init_level_start
rts
;================================================
;================================================
hijack_player_2_init_2_demo:
btst #$1, ($7f,A5)
beq hijack_player_2_init_2_demo_p3
jsr $009fec
lea (p2_main_mem,A5), A4
jsr $00a398
hijack_player_2_init_2_demo_p3:
btst #$2, ($7f,A5)
beq hijack_player_2_init_2_demo_exit
bsr p3_init_more
lea (p3_main_mem,A5), A4
jmp $00a398
hijack_player_2_init_2_demo_exit:
rts
;================================================
hijack_player_1_init_idvar:
move.b #0,($13,A4) ; player ID
move.b #$80,($2F,A4) ; palette ID
; jsr hijack_charsel_copypalette
jmp $009F92
;================================================