aboutsummaryrefslogtreecommitdiff
path: root/animation.gbasm
blob: bfaabe68b39db11900cadbb41f0ebaa67a4cb9b8 (plain)
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
Animation_Wait_Mode:
	LD A, $mem_current_mode
	CP $enum_animation_wait_mode
	RET NZ

	LD A, $mem_animation_wait_frames
	DEC A
	LD $mem_animation_wait_frames, A
	CP $00
	RET NZ
	LD A, $enum_dungeon_mode
	LD $mem_current_mode, A
	LD $mem_requested_mode, A
	CALL =Update_VBlank_Handler
	RET

Display_Animation_List:
	LD HL, $mem_animation_list
	CALL =Display_Animation
	CALL =Display_Animation
	CALL =Display_Animation
	JP =Display_Animation

Display_Animation:
	PUSH HL

	LD A, (HL)
	AND $3f
	LD BC, =Animation_Jump_table
	.JUMP_TABLE

	POP HL
	LD A, L
	ADD $08
	LD L, A

	RET

Try_Launch_Animation: ; XY in BC, jump_table index in A, number of steps in E, entity_effect in D
	PUSH HL
	PUSH AF

	LD HL, $mem_animation_list
	XOR A
	CP (HL)
	JP Z, =Try_Launch_Animation.Free_slot_Found

	LD A, $08
	ADD L
	LD L, A

	XOR A
	CP (HL)
	JP Z, =Try_Launch_Animation.Free_slot_Found

	LD A, $08
	ADD L
	LD L, A

	XOR A
	CP (HL)
	JP Z, =Try_Launch_Animation.Free_slot_Found

	LD A, $08
	ADD L
	LD L, A

	XOR A
	CP (HL)
	JP NZ, =Try_Launch_Animation.No_Free_slot_found

	Try_Launch_Animation.Free_slot_Found:
	POP AF

	LD (HL+), A
	LD A, B
	LD (HL+), A
	LD A, C
	LD (HL+), A
	LD A, E
	LD (HL+), A
	LD (HL), D

	POP HL
	RET

	Try_Launch_Animation.No_Free_slot_found:
	POP AF
	POP HL
	RET

End_animation:
	LD A, L
	AND $f8
	LD L, A
	LD (HL), $00
	LD A, L
	ADD $04
	LD L, A

	LD A, $f0
	AND (HL)
	CP $10
	RET NZ

	LD A, (HL)
	AND $0f
	SWAP A

	PUSH HL
	ADD $07
	LD L, A
	LD H, high($mem_entities_list)

	SET 3, (HL)

	LD A, $1f
	LD $mem_blinking_animation_counter, A
	.SET_SOUND_EFFECT =_sound_effect_Damage

	POP HL

	RET

Animation_Jump_table:
	; 00
	RET
	NOP
	NOP
	NOP

	; 01
	JP =Sparkle_Animation
	NOP

	; 02
	JP =Rotating_Ball_Animation
	NOP

	; 03
	JP =Laser_Animation
	NOP

	; 04
	JP =Bubbles_Animation
	NOP

.INCLUDE "animations/sparkles.gbasm"
.INCLUDE "animations/rotatingball.gbasm"
.INCLUDE "animations/laser.gbasm"
.INCLUDE "animations/bubbles.gbasm"