-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathstate_attract.asm
81 lines (70 loc) · 1.63 KB
/
state_attract.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
attract_init:
; SCROLL SPEED
jsr game_init_generic
lda #03
sta scroll_speed_hi
lda #173
sta scroll_speed_lo
lda #state_update_jump_table_offset+5
sta state_update_addr
lda attract_true
bne .attract_mode_set
jsr clear_all_enemies
lda #$ff
sta attract_true
lda #iframe_attract_length
sta state_iframe_length
.attract_mode_set
jsr render_enable
jsr palette_fade_in_init
rts
attract_update: subroutine
; some buttons return to menu
lda player_controls
and #BUTTON_START|BUTTON_B|BUTTON_A
beq .buttons_for_menu_not_pressed
lda #state_init_jump_table_offset+0
jsr palette_fade_out_init
jmp state_update_done
.buttons_for_menu_not_pressed
lda wtf
and #$07
bne .no_enemy_spawn
jsr attract_spawn_enemy
.no_enemy_spawn
lda player_health
cmp #$00
beq .done
jsr player_demo_controls
jsr player_bullets_check_controls
.done
jsr game_update_generic
jmp state_update_done
attract_spawn_enemy: subroutine
; starglasses
lda $03a0
bne .no_starglasses
ldx #$a0
lda #starglasses_id
bne .delegate
.no_starglasses
; birb
jsr get_enemy_slot_1_sprite
bcs .no_birb
lda #birb_id
bne .delegate
.no_birb
; maggs
jsr get_enemy_slot_2_sprite
bcs .no_maggs
lda #maggs_id
bne .delegate
.no_maggs
; skully
jsr get_enemy_slot_4_sprite
lda #skully_id
cpx #$c0
bcc .delegate
rts
.delegate
jmp enemy_spawn_delegator