INNER CODE UNIT · C
halfIndex
acoto87/war1 · src/war_actions.c:81
s32 halfIndex = nframes % 2 == 0 ? nframes / 2 : (nframes + 1) / 2;
// This code convert the frames sequence in this WAR_ACTION_STEP_FRAME sequence.
// (this code is ported from the War1gus project, built with the Stratagus engine)
//
// 1 frame a => a 0 a 0 a 0 a 0
// 2 frames a b => a 0 b 0 a 0 b 0
// 3 frames a b c => a b a 0 c b c 0
// 4 frames a b c d => a b a 0 d c d 0
// 5 frames a b c d e => a b c b a e d c d e
//
// This code is used with a previous steps calling 'wact_getFrameNumbers'
// and construct the base frame sequences for walk, attack and death animations.
//
// Is this way because of the layout of the spritesheets of the units:
// (in reality is 5 frames per row, because of the directions of the units,
// to keep it simple asume that there is only one direction NORTH)
//