INNER CODE UNIT · C
halfIndex
acoto87/war1 · src/war_actions.c:183
s32 halfIndex = nframes%2 == 0 ? nframes/2 : (nframes+1)/2;
for(s32 i = 0; i < nframes; i++)
{
addUnitActionDefStep(&def, WAR_ACTION_STEP_FRAME, frames[i]);
if (i == halfIndex)
{
addUnitActionDefStep(&def, WAR_ACTION_STEP_ATTACK, 0);
addUnitActionDefStep(&def, attackSound, 0);
}
addUnitActionDefStep(&def, WAR_ACTION_STEP_WAIT, attackSpeed);
}
// make sure we don't attack faster just because we have fewer frames
addUnitActionDefStep(&def, WAR_ACTION_STEP_WAIT, (5 - nframes) * attackSpeed);
addUnitActionDefStep(&def, WAR_ACTION_STEP_FRAME, 0);