0
0
Fork 0
mirror of https://git.do.srb2.org/STJr/SRB2.git synced 2025-03-22 10:52:23 +00:00

rename rollaxis to rotaxis

This commit is contained in:
Jaime Passos 2019-11-13 12:47:30 -03:00
parent b54f6181c3
commit a9183b474b
7 changed files with 31 additions and 31 deletions

View file

@ -9365,10 +9365,10 @@ struct {
{"NUMDIRS",NUMDIRS},
#ifdef ROTSPRITE
// Sprite roll axis (rollaxis_t)
{"ROLLAXIS_X",ROLLAXIS_X},
{"ROLLAXIS_Y",ROLLAXIS_Y},
{"ROLLAXIS_Z",ROLLAXIS_Z},
// Sprite rotation axis (rotaxis_t)
{"ROTAXIS_X",ROTAXIS_X},
{"ROTAXIS_Y",ROTAXIS_Y},
{"ROTAXIS_Z",ROTAXIS_Z},
#endif
// Buttons (ticcmd_t)

View file

@ -117,9 +117,9 @@ typedef struct
boolean flip; // screenflip
#ifdef ROTSPRITE
boolean roll;
UINT8 rollaxis;
SINT8 rollflip;
FLOAT rollangle; // done to not override USE_FTRANSFORM_ANGLEZ
UINT8 rotaxis;
FLOAT centerx, centery;
#endif
#ifdef USE_FTRANSFORM_MIRROR

View file

@ -1187,8 +1187,8 @@ void HWR_DrawModel(gr_vissprite_t *spr)
#ifdef ROTSPRITE
p.rollangle = 0.0f;
p.rollaxis = 0;
p.rollflip = 0;
p.rotaxis = 0;
if (spr->mobj->rollangle)
{
fixed_t anglef = AngleFixed(spr->mobj->rollangle);
@ -1199,9 +1199,9 @@ void HWR_DrawModel(gr_vissprite_t *spr)
p.centerx = FIXED_TO_FLOAT(spr->mobj->radius/2);
p.centery = FIXED_TO_FLOAT(spr->mobj->height/2);
// roll axis
// rotation axis
if (sprinfo->available)
p.rollaxis = (UINT8)(sprinfo->pivot[(spr->mobj->frame & FF_FRAMEMASK)].rollaxis);
p.rotaxis = (UINT8)(sprinfo->pivot[(spr->mobj->frame & FF_FRAMEMASK)].rotaxis);
// for NiGHTS specifically but should work everywhere else
ang = R_PointToAngle (spr->mobj->x, spr->mobj->y) - (spr->mobj->player ? spr->mobj->player->drawangle : spr->mobj->angle);

View file

@ -2071,9 +2071,9 @@ static void DrawModelEx(model_t *model, INT32 frameIndex, INT32 duration, INT32
{
float roll = (1.0f * pos->rollflip);
pglTranslatef(pos->centerx, pos->centery, 0);
if (pos->rollaxis == 2) // Z
if (pos->rotaxis == 2) // Z
pglRotatef(pos->rollangle, 0.0f, 0.0f, roll);
else if (pos->rollaxis == 1) // Y
else if (pos->rotaxis == 1) // Y
pglRotatef(pos->rollangle, 0.0f, roll, 0.0f);
else // X
pglRotatef(pos->rollangle, roll, 0.0f, 0.0f);

View file

@ -305,8 +305,8 @@ static int PopPivotSubTable(spriteframepivot_t *pivot, lua_State *L, int stk, in
pivot[idx].x = (INT32)value;
else if (ikey == 2 || (key && fastcmp(key, "y")))
pivot[idx].y = (INT32)value;
else if (ikey == 3 || (key && fastcmp(key, "rollaxis")))
pivot[idx].rollaxis = (UINT8)value;
else if (ikey == 3 || (key && fastcmp(key, "rotaxis")))
pivot[idx].rotaxis = (UINT8)value;
else if (ikey == -1 && (key != NULL))
FIELDERROR("pivot key", va("x, y or roll axis expected, got %s", key));
ok = 1;
@ -330,7 +330,7 @@ static int PopPivotTable(spriteinfo_t *info, lua_State *L, int stk)
// stk = 0 has the pivot table
// stk = 1 has the frame key
// stk = 2 has the frame table
// stk = 3 has either "x" or "y" or "rollaxis" or a number as key
// stk = 3 has either "x" or "y" or "rotaxis" or a number as key
// stk = 4 has the value for the key mentioned above
while (lua_next(L, stk))
{
@ -570,8 +570,8 @@ static int framepivot_get(lua_State *L)
lua_pushinteger(L, framepivot->x);
else if (fastcmp("y", field))
lua_pushinteger(L, framepivot->y);
else if (fastcmp("rollaxis", field))
lua_pushinteger(L, (UINT8)framepivot->rollaxis);
else if (fastcmp("rotaxis", field))
lua_pushinteger(L, (UINT8)framepivot->rotaxis);
else
return luaL_error(L, va("Field %s does not exist in spriteframepivot_t", field));
@ -594,8 +594,8 @@ static int framepivot_set(lua_State *L)
framepivot->x = luaL_checkinteger(L, 3);
else if (fastcmp("y", field))
framepivot->y = luaL_checkinteger(L, 3);
else if (fastcmp("rollaxis", field))
framepivot->rollaxis = (UINT8)luaL_checkinteger(L, 3);
else if (fastcmp("rotaxis", field))
framepivot->rotaxis = (rotaxis_t)(luaL_checkinteger(L, 3));
else
return luaL_error(L, va("Field %s does not exist in spriteframepivot_t", field));

View file

@ -791,7 +791,7 @@ static void R_ParseSpriteInfoFrame(spriteinfo_t *info)
#ifdef ROTSPRITE
INT16 frameXPivot = 0;
INT16 frameYPivot = 0;
rollaxis_t frameRollAxis = 0;
rotaxis_t frameRotAxis = 0;
#endif
// Sprite identifier
@ -840,16 +840,16 @@ static void R_ParseSpriteInfoFrame(spriteinfo_t *info)
sprinfoToken = M_GetToken(NULL);
frameYPivot = atoi(sprinfoToken);
}
else if (stricmp(sprinfoToken, "ROLLAXIS")==0)
else if (stricmp(sprinfoToken, "ROTAXIS")==0)
{
Z_Free(sprinfoToken);
sprinfoToken = M_GetToken(NULL);
if ((stricmp(sprinfoToken, "X")==0) || (stricmp(sprinfoToken, "XAXIS")==0))
frameRollAxis = ROLLAXIS_X;
else if ((stricmp(sprinfoToken, "Y")==0) || (stricmp(sprinfoToken, "YAXIS")==0))
frameRollAxis = ROLLAXIS_Y;
else if ((stricmp(sprinfoToken, "Z")==0) || (stricmp(sprinfoToken, "ZAXIS")==0))
frameRollAxis = ROLLAXIS_Z;
if ((stricmp(sprinfoToken, "X")==0) || (stricmp(sprinfoToken, "XAXIS")==0) || (stricmp(sprinfoToken, "ROLL")==0))
frameRotAxis = ROTAXIS_X;
else if ((stricmp(sprinfoToken, "Y")==0) || (stricmp(sprinfoToken, "YAXIS")==0) || (stricmp(sprinfoToken, "PITCH")==0))
frameRotAxis = ROTAXIS_Y;
else if ((stricmp(sprinfoToken, "Z")==0) || (stricmp(sprinfoToken, "ZAXIS")==0) || (stricmp(sprinfoToken, "YAW")==0))
frameRotAxis = ROTAXIS_Z;
}
#endif
Z_Free(sprinfoToken);
@ -868,7 +868,7 @@ static void R_ParseSpriteInfoFrame(spriteinfo_t *info)
#ifdef ROTSPRITE
info->pivot[frameFrame].x = frameXPivot;
info->pivot[frameFrame].y = frameYPivot;
info->pivot[frameFrame].rollaxis = frameRollAxis;
info->pivot[frameFrame].rotaxis = frameRotAxis;
#endif
}

View file

@ -21,15 +21,15 @@
#ifdef ROTSPRITE
typedef enum
{
ROLLAXIS_X, // the default
ROLLAXIS_Y,
ROLLAXIS_Z
} rollaxis_t;
ROTAXIS_X, // roll (the default)
ROTAXIS_Y, // pitch
ROTAXIS_Z // yaw
} rotaxis_t;
typedef struct
{
INT32 x, y;
rollaxis_t rollaxis;
rotaxis_t rotaxis;
} spriteframepivot_t;
#endif