diff --git a/polymer/eduke32/source/actors.h b/polymer/eduke32/source/actors.h index 48575f935..8eff5048d 100644 --- a/polymer/eduke32/source/actors.h +++ b/polymer/eduke32/source/actors.h @@ -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 { diff --git a/polymer/eduke32/source/game.c b/polymer/eduke32/source/game.c index b70ff646f..1c1d238b7 100644 --- a/polymer/eduke32/source/game.c +++ b/polymer/eduke32/source/game.c @@ -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 diff --git a/polymer/eduke32/source/gamedef.c b/polymer/eduke32/source/gamedef.c index 8c9963716..4e6fc1c47 100644 --- a/polymer/eduke32/source/gamedef.c +++ b/polymer/eduke32/source/gamedef.c @@ -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); diff --git a/polymer/eduke32/source/gameexec.c b/polymer/eduke32/source/gameexec.c index b429a56b6..505885966 100644 --- a/polymer/eduke32/source/gameexec.c +++ b/polymer/eduke32/source/gameexec.c @@ -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; diff --git a/polymer/eduke32/source/lunatic/lunacon.lua b/polymer/eduke32/source/lunatic/lunacon.lua index 48e6b7ba2..505436279 100644 --- a/polymer/eduke32/source/lunatic/lunacon.lua +++ b/polymer/eduke32/source/lunatic/lunacon.lua @@ -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...: