aboutsummaryrefslogtreecommitdiff
path: root/animation.gbasm
blob: a10b01ee566fc9718db6302f224087ad892bd7bd (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
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)
	LD BC, =Animation_Jump_table
	.JUMP_TABLE

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

	RET

Try_Launch_Animation: ; XY in BC, jump_table index in A
	PUSH HL
	PUSH AF

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

	LD A, $04
	ADD L
	LD L, A

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

	LD A, $04
	ADD L
	LD L, A

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

	LD A, $04
	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
	XOR A
	LD (HL+), A

	POP HL
	RET

	Try_Launch_Animation.No_Free_slot_found:
	POP AF
	POP HL
	RET

Animation_Jump_table:
	; 00
	RET
	NOP
	NOP
	NOP

	; 01
	JP =Sparkle_Animation
	NOP

	; 02
	JP =Rotating_Ball_Animation
	NOP

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