Enumify stuff having to do with action parameters.

git-svn-id: https://svn.eduke32.com/eduke32@5848 1a8010ca-5511-0410-912e-c29ae57300e0
This commit is contained in:
hendricks266 2016-09-06 02:15:23 +00:00
parent ec4d6f7b89
commit abd1523477
5 changed files with 20 additions and 10 deletions

View file

@ -99,6 +99,16 @@ enum uactortypes_t
#define AC_ACTION_ID(t) ((t)[4])
#define AC_AI_ID(t) ((t)[5]) /* the ID of the actor's current ai */
enum actionparams
{
ACTION_STARTFRAME = 0,
ACTION_NUMFRAMES,
ACTION_VIEWTYPE,
ACTION_INCVAL,
ACTION_DELAY,
ACTION_PARAM_COUNT,
};
#ifdef LUNATIC
struct action
{

View file

@ -4073,10 +4073,10 @@ PALONLY:
if (G_HaveActor(pSprite->picnum))
{
#if !defined LUNATIC
if ((unsigned)scrofs_action + 2 >= (unsigned)g_scriptSize)
if ((unsigned)scrofs_action + ACTION_VIEWTYPE >= (unsigned)g_scriptSize)
goto skip;
l = apScript[scrofs_action + 2];
l = apScript[scrofs_action + ACTION_VIEWTYPE];
#else
l = viewtype;
#endif
@ -4128,7 +4128,7 @@ PALONLY:
l = klabs(l);
#if !defined LUNATIC
t->picnum += frameOffset + apScript[scrofs_action] + l*curframe;
t->picnum += frameOffset + apScript[scrofs_action + ACTION_STARTFRAME] + l*curframe;
#else
t->picnum += frameOffset + startframe + l*curframe;
#endif

View file

@ -3357,7 +3357,7 @@ DO_DEFSTATE:
g_labelCnt++;
}
for (j=4; j>=0; j--)
for (j=ACTION_PARAM_COUNT-1; j>=0; j--)
{
if (C_GetKeyword() != -1) break;
C_GetNextValue(LABEL_DEFINE);

View file

@ -5776,16 +5776,16 @@ void A_LoadActor(int32_t spriteNum)
void VM_UpdateAnim(int spriteNum, int32_t *pData)
{
#if !defined LUNATIC
intptr_t const actionofs = AC_ACTION_ID(pData);
intptr_t const *actionptr = (actionofs != 0 && actionofs + 4u < (unsigned) g_scriptSize) ? &apScript[actionofs] : NULL;
size_t const actionofs = AC_ACTION_ID(pData);
intptr_t const *actionptr = (actionofs != 0 && actionofs + (ACTION_PARAM_COUNT-1) < (unsigned) g_scriptSize) ? &apScript[actionofs] : NULL;
if (actionptr != NULL)
#endif
{
#if !defined LUNATIC
int const action_frames = actionptr[1];
int const action_incval = actionptr[3];
int const action_delay = actionptr[4];
int const action_frames = actionptr[ACTION_NUMFRAMES];
int const action_incval = actionptr[ACTION_INCVAL];
int const action_delay = actionptr[ACTION_DELAY];
#else
int const action_frames = actor[spriteNum].ac.numframes;
int const action_incval = actor[spriteNum].ac.incval;

View file

@ -1962,7 +1962,7 @@ local Couter = {
/ function(...) Define.composite(LABEL.MOVE, ...) end,
-- startframe, numframes, viewtype, incval, delay:
action = sp1 * tok.identifier * (sp1 * tok.define)^-5
action = sp1 * tok.identifier * (sp1 * tok.define)^-5 -- ACTION_PARAM_COUNT
/ function(...) Define.composite(LABEL.ACTION, ...) end,
-- action, move, flags...: