#define STATE() doesn't work in VC?

#define STATE() doesn't work in VC?
This commit is contained in:
Logan Aerl Arias 2024-02-20 00:36:36 -05:00
parent 3b532c4c6e
commit 50c1f6e73a
7 changed files with 33 additions and 38 deletions

View file

@ -682,6 +682,7 @@ playersprite_t spr2defaults[NUMPLAYERSPRITES] = {
0, // SPR2_XTRA (should never be referenced)
};
// Doesn't work with VC
#define STATE(sprite, frame, duration, action, var1, var2, nextstate) \
{ sprite, frame, duration, action, { ACTION_INTEGER_VAL(var1), ACTION_INTEGER_VAL(var2) }, nextstate }

View file

@ -33,8 +33,6 @@
extern CV_PossibleValue_t Color_cons_t[];
boolean LUA_CallAction(enum actionnum actionnum, mobj_t *actor);
state_t *astate;
boolean LUA_ValueIsValidActionVal(lua_State *L, int i)

View file

@ -49,7 +49,7 @@ int LUA_Call(lua_State *L, int nargs, int nresults, int errorhandlerindex);
boolean LUA_CallAction(enum actionnum actionnum, mobj_t *actor, action_val_t *args, unsigned argcount);
boolean LUA_ValueIsValidActionVal(lua_State *L, int i);
void LUA_ValueToActionVal(lua_State *L, int i, action_val_t *val);
void LUA_LoadLump(UINT16 wad, UINT16 lump, boolean noresults);
boolean LUA_LoadLump(UINT16 wad, UINT16 lump);
void LUA_DoLump(UINT16 wad, UINT16 lump, boolean noresults);
#ifdef LUA_ALLOW_BYTECODE
void LUA_DumpFile(const char *filename);

View file

@ -2909,7 +2909,7 @@ void A_1upThinker(mobj_t *actor, action_val_t *args, unsigned argcount)
}
}
if (closestplayer == -1 || skins[players[closestplayer].skin].sprites[SPR2_LIFE].numframes == 0)
if (closestplayer == -1 || skins[players[closestplayer].skin]->sprites[SPR2_LIFE].numframes == 0)
{ // Closest player not found (no players in game?? may be empty dedicated server!), or does not have correct sprite.
if (actor->tracer)
{
@ -3285,7 +3285,7 @@ static void P_DoBossVictory(mobj_t *mo)
{
if (!playeringame[i])
continue;
P_DoPlayerExit(&players[i]);
P_DoPlayerExit(&players[i], false );
}
}
else
@ -8534,6 +8534,26 @@ void A_Dye(mobj_t *actor, action_val_t *args, unsigned argcount)
}
}
// Function: A_SetTranslation
//
// Description: Changes the translation of an actor.
//
// var1 = translation ID
// var2 = unused
//
void A_SetTranslation(mobj_t *actor, action_val_t *args, unsigned argcount)
{
INT32 locvar1 = GET_ARG(GetInteger, 0);
if (LUA_CallAction(A_SETTRANSLATION, actor, args, argcount))
return;
if (R_TranslationIsValid(locvar1))
actor->translation = (UINT32)locvar1;
else
actor->translation = 0;
}
// Function: A_MoveRelative
//
// Description: Moves an object (wrapper for P_Thrust)
@ -10297,7 +10317,7 @@ void A_ForceWin(mobj_t *actor, action_val_t *args, unsigned argcount)
{
if (!playeringame[i])
continue;
P_DoPlayerExit(&players[i]);
P_DoPlayerExit(&players[i], false);
}
}

View file

@ -175,6 +175,7 @@ void A_SetRandomTics(mobj_t *actor, action_val_t *args, unsigned argcount);
void A_ChangeColorRelative(mobj_t *actor, action_val_t *args, unsigned argcount);
void A_ChangeColorAbsolute(mobj_t *actor, action_val_t *args, unsigned argcount);
void A_Dye(mobj_t *actor, action_val_t *args, unsigned argcount);
void A_SetTranslation(mobj_t *actor, action_val_t *args, unsigned argcount);
void A_MoveRelative(mobj_t *actor, action_val_t *args, unsigned argcount);
void A_MoveAbsolute(mobj_t *actor, action_val_t *args, unsigned argcount);
void A_Thrust(mobj_t *actor, action_val_t *args, unsigned argcount);

View file

@ -6917,32 +6917,6 @@ void P_RunOverlays(void)
continue;
}
if (!splitscreen /*&& rendermode != render_soft*/)
{
angle_t viewingangle;
if (players[displayplayer].awayviewtics && players[displayplayer].awayviewmobj != NULL && !P_MobjWasRemoved(players[displayplayer].awayviewmobj))
viewingangle = R_PointToAngle2(mo->target->x, mo->target->y, players[displayplayer].awayviewmobj->x, players[displayplayer].awayviewmobj->y);
else if (!camera.chase && players[displayplayer].mo)
viewingangle = R_PointToAngle2(mo->target->x, mo->target->y, players[displayplayer].mo->x, players[displayplayer].mo->y);
else
viewingangle = R_PointToAngle2(mo->target->x, mo->target->y, camera.x, camera.y);
if (!(mo->state->frame & FF_ANIMATE))
{
INT32 var1 = Action_ValueToInteger(mo->state->vars[0]);
if (var1)
viewingangle += ANGLE_180;
}
destx = mo->target->x + P_ReturnThrustX(mo->target, viewingangle, FixedMul(FRACUNIT/4, mo->scale));
desty = mo->target->y + P_ReturnThrustY(mo->target, viewingangle, FixedMul(FRACUNIT/4, mo->scale));
}
else
{
destx = mo->target->x;
desty = mo->target->y;
}
mo->eflags = (mo->eflags & ~MFE_VERTICALFLIP) | (mo->target->eflags & MFE_VERTICALFLIP);
mo->scale = mo->destscale = mo->target->scale;
mo->old_scale = mo->target->old_scale;
@ -6965,21 +6939,22 @@ void P_RunOverlays(void)
mo->height = mo->target->height;
if (mo->eflags & MFE_VERTICALFLIP)
{
mo->z = (mo->target->z + mo->target->height - mo->height) - zoffs;
mo->z = mo->target->z + mo->target->height - mo->height - zoffs;
if (mo->scale == mo->old_scale)
mo->old_z = mo->target->old_z + mo->target->height - mo->height - zoffs;
else // Interpolate height scale changes - mo and mo->target have the same scales here, so don't interpolate them individually
mo->old_z = mo->target->old_z + FixedMul(mo->target->height - mo->height, FixedDiv(mo->old_scale, mo->scale)) - zoffs;
}
else
mo->z = mo->target->z + zoffs;
if (Action_ValueToInteger(mo->state->vars[0]))
{
mo->z = mo->target->z + zoffs;
mo->old_z = mo->target->old_z + zoffs;
}
if (!(mo->state->frame & FF_ANIMATE) && Action_ValueToInteger(mo->state->vars[0]))
P_SetUnderlayPosition(mo);
if (!(mo->state->frame & FF_ANIMATE))
{
if (Action_ValueToInteger(mo->state->vars[0]))
P_SetUnderlayPosition(mo);
}
else
P_SetThingPosition(mo);
P_CheckPosition(mo, mo->x, mo->y);

View file

@ -3518,7 +3518,7 @@ void R_ThingOffsetOverlay(mobj_t *thing, fixed_t *x, fixed_t *y)
do // Get the overlay's offset
{
// Does the overlay use FF_ANIMATE? If not, if var1 is non-zero, it's an underlay instead of an overlay
if (!(mobj->state->frame & FF_ANIMATE) && mobj->state->var1)
if (!(mobj->state->frame & FF_ANIMATE) && Action_ValueToInteger(mobj->state->vars[0]))
offset += 1; // Underlay below the target, away from the camera
else
offset -= 1; // Overlay on top of the target, towards the camera