forked from FireEmblemUniverse/fireemblem8u
/
banim-efxmagic-bindingblade.c
145 lines (114 loc) · 2.84 KB
/
banim-efxmagic-bindingblade.c
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
#include "global.h"
#include "anime.h"
#include "ekrbattle.h"
#include "efxbattle.h"
#include "efxmagic.h"
#include "hardware.h"
#include "bmlib.h"
//! FE8U = 0x0805CEC4
void StartSpellAnimEckesachsRanged_Null(struct Anim * anim)
{
return;
}
// clang-format off
struct ProcCmd CONST_DATA ProcScr_efxHurtmut[] =
{
PROC_NAME("efxHurtmut"),
PROC_REPEAT(efxHurtmut_Loop_Main),
PROC_END,
};
// clang-format on
//! FE8U = 0x0805CEC8
void StartSpellAnimBindingBlade(struct Anim * anim)
{
struct ProcEfx * proc;
SpellFx_Begin();
NewEfxSpellCast();
SpellFx_ClearBG1Position();
proc = Proc_Start(ProcScr_efxHurtmut, PROC_TREE_3);
proc->anim = anim;
proc->timer = 0;
proc->hitted = CheckRoundMiss(GetAnimRoundTypeAnotherSide(anim));
return;
}
//! FE8U = 0x0805CF04
void efxHurtmut_Loop_Main(struct ProcEfx * proc)
{
struct Anim * anim = GetAnimAnotherSide(proc->anim);
int duration = EfxGetCamMovDuration();
proc->timer++;
if (proc->timer == 1)
{
NewEfxFarAttackWithDistance(proc->anim, -1);
}
if (proc->timer == duration + 1)
{
PlaySFX(0x10D, 0x100, anim->xPosition, 1);
StartSubSpell_efxHurtmutOBJ(anim);
NewEfxFlashBgWhite(proc->anim, 6);
anim->state3 |= (ANIM_BIT3_TAKE_BACK_ENABLE | ANIM_BIT3_HIT_EFFECT_APPLIED);
StartBattleAnimHitEffectsDefault(anim, proc->hitted);
if (!proc->hitted)
{
EfxPlayHittedSFX(anim);
}
}
else if (proc->timer == duration + 28)
{
NewEfxALPHA(anim, 0, 14, 16, 0, 0);
}
else if (proc->timer == duration + 50)
{
return;
}
else if (proc->timer == duration + 55)
{
SpellFx_Finish();
RegisterEfxSpellCastEnd();
Proc_Break(proc);
}
return;
}
// clang-format off
struct ProcCmd CONST_DATA ProcScr_efxHurtmutOBJ[] =
{
PROC_NAME("efxHurtmutOBJ"),
PROC_REPEAT(efxHurtmutOBJ_Loop),
PROC_END,
};
// clang-format on
//! FE8U = 0x0805CFC0
void StartSubSpell_efxHurtmutOBJ(struct Anim * anim)
{
struct ProcEfxOBJ * proc;
u32 * scr;
gEfxBgSemaphore++;
proc = Proc_Start(ProcScr_efxHurtmutOBJ, PROC_TREE_3);
proc->anim = anim;
proc->timer = 0;
proc->terminator = 52;
if (GetAnimPosition(anim) == 0)
{
scr = AnimScr_EfxBindingBlade_Left;
}
else
{
scr = AnimScr_EfxBindingBlade_Right;
}
proc->anim2 = EfxCreateFrontAnim(anim, scr, scr, scr, scr);
SpellFx_RegisterObjPal(Pal_FireBreathSprites, PLTT_SIZE_4BPP);
SpellFx_RegisterObjGfx(Img_BreathSprites, 32 * 4 * CHR_SIZE);
return;
}
//! FE8U = 0x0805D030
void efxHurtmutOBJ_Loop(struct ProcEfxOBJ * proc)
{
proc->timer++;
if (proc->timer > proc->terminator)
{
AnimDelete(proc->anim2);
gEfxBgSemaphore--;
Proc_Break(proc);
}
return;
}