2 ; Copyright (C) 2010 Kent Hansen.
4 ; This program is free software; you can redistribute it and/or modify
5 ; it under the terms of the GNU General Public License as published by
6 ; the Free Software Foundation; either version 3 of the License, or
7 ; (at your option) any later version.
9 ; This program is distributed in the hope that it will be useful,
10 ; but WITHOUT ANY WARRANTY; without even the implied warranty of
11 ; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 ; GNU General Public License for more details.
14 ; You should have received a copy of the GNU General Public License
15 ; along with this program. If not, see <http://www.gnu.org/licenses/>.
18 .
include "common/sprite.h"
24 ; 0 = vertical, 1 = horizontal
33 .extrn
frame_count:byte
35 .
public initialize_orb_parallax
36 .
public update_orb_parallax
38 ; A = orbientation (0 = vertical, 1 = horizontal)
39 .
proc initialize_orb_parallax
41 jsr initialize_target_lists
49 .
proc get_winning_player
50 lda player.energy_level
+1
72 and #
$23 ; sprite priority + palette
75 lda targets_1.pos_y.
int,y
77 lda targets_1.pos_x.
int,y
89 lda targets_1.pos_y.
int,y
91 lda targets_1.pos_x.
int,y
100 ldy active_targets_head
103 cpy #
$FF ; end of list?
114 lda targets_1.pos_x.
int,y
119 + lda targets_1.pos_y.
int,y
133 lda free_targets_list
135 sty free_targets_list
137 ; remove from active targets list
138 cpy active_targets_tail
140 sta active_targets_tail
145 sty active_targets_head
147 + sta targets_2.next
,x
151 .
proc maybe_spawn_orb
159 + sta spawn_orb_timer
160 ; grab target from free list
161 ldx free_targets_list
164 ; don't spawn, no free targets now
166 + lda targets_2.next
,x
167 sta free_targets_list
170 sta targets_1.pos_y.frac
,x
171 sta targets_1.pos_x.frac
,x
175 sta targets_1.pos_y.
int,x
177 + sta targets_1.pos_x.
int,x
178 ++ lda spawn_orb_index
187 + asl
: asl
: asl
: asl
: asl
; * 32
191 sta targets_1.pos_y.
int,x
193 + sta targets_1.pos_x.
int,x
198 sta targets_1.state
,x
203 lda
@@size_speed_lo,y
204 sta targets_2.speed_x.frac
,x
205 lda
@@size_speed_hi,y
206 sta targets_2.speed_x.
int,x
208 sta targets_2.speed_y.frac
,x
209 sta targets_2.speed_y.
int,x
212 + lda
@@size_speed_lo,y
213 sta targets_2.speed_y.frac
,x
214 lda
@@size_speed_hi,y
215 sta targets_2.speed_y.
int,x
217 sta targets_2.speed_x.frac
,x
218 sta targets_2.speed_x.
int,x
222 clc : adc spawn_orb_index
225 + jsr get_winning_player
226 and #
3 ; use as palette
228 ++ ora targets_1.state
,x
229 sta targets_1.state
,x
230 jmp add_to_active_targets_list
234 .
db $40,$00,$C0,$80,$40,$00,$C0,$80
236 .
db $FF,$FF,$FE,$FE,$FE,$FE,$FD,$FD
238 .
db 8,24,40,56,120,168,184,208
241 .
proc update_orb_parallax