diff --git a/src/deh_soc.c b/src/deh_soc.c index 8dd849daf..2193cd875 100644 --- a/src/deh_soc.c +++ b/src/deh_soc.c @@ -912,7 +912,7 @@ static void readspriteframe(MYFILE *f, spriteinfo_t *sprinfo, UINT8 frame) else if (fastcmp(word, "YPIVOT")) sprinfo->pivot[frame].y = value; else if (fastcmp(word, "ROTAXIS")) - sprinfo->pivot[frame].rotaxis = value; + deh_warning("SpriteInfo: ROTAXIS is deprecated and will be removed."); else { f->curpos = lastline; diff --git a/src/hardware/hw_defs.h b/src/hardware/hw_defs.h index 131d2caa3..74c4ed7d2 100644 --- a/src/hardware/hw_defs.h +++ b/src/hardware/hw_defs.h @@ -93,9 +93,6 @@ typedef struct FVector //Hurdler: Transform (coords + angles) //BP: transform order : scale(rotation_x(rotation_y(translation(v)))) -// Kart features -#define USE_FTRANSFORM_MIRROR - // Vanilla features #define USE_MODEL_NEXTFRAME @@ -108,13 +105,10 @@ typedef struct UINT8 splitscreen; boolean flip; // screenflip boolean roll; - SINT8 rollflip; FLOAT rollangle; // done to not override USE_FTRANSFORM_ANGLEZ - UINT8 rotaxis; FLOAT centerx, centery; -#ifdef USE_FTRANSFORM_MIRROR + FLOAT rollx, rollz; boolean mirror; // SRB2Kart: Encore Mode -#endif boolean shearing; // 14042019 float viewaiming; // 17052019 } FTransform; diff --git a/src/hardware/hw_main.c b/src/hardware/hw_main.c index 4e1b7975e..bb2ce9001 100644 --- a/src/hardware/hw_main.c +++ b/src/hardware/hw_main.c @@ -4158,7 +4158,7 @@ static void HWR_DrawSprite(gl_vissprite_t *spr) angle = viewangle; if (!spr->rotated) - angle += spr->mobj->rollangle; + angle += spr->mobj->spriteroll; angle = -angle; angle += ANGLE_90; @@ -5245,17 +5245,17 @@ static void HWR_ProjectSprite(mobj_t *thing) spr_topoffset = spritecachedinfo[lumpoff].topoffset; #ifdef ROTSPRITE - if (thing->rollangle + if (interp.spriteroll && !(splat && !(thing->renderflags & RF_NOSPLATROLLANGLE))) { if (papersprite) { // a positive rollangle should should pitch papersprites upwards relative to their facing angle - rollangle = R_GetRollAngle(InvAngle(thing->rollangle)); + rollangle = R_GetRollAngle(InvAngle(interp.spriteroll)); } else { - rollangle = R_GetRollAngle(thing->rollangle); + rollangle = R_GetRollAngle(interp.spriteroll); } rotsprite = Patch_GetRotatedSprite(sprframe, (thing->frame & FF_FRAMEMASK), rot, flip, false, sprinfo, rollangle); @@ -5913,6 +5913,8 @@ static void HWR_DrawSkyBackground(player_t *player) fixed_t rol = AngleFixed(player->viewrollangle); dometransform.rollangle = FIXED_TO_FLOAT(rol); dometransform.roll = true; + dometransform.rollx = 1.0f; + dometransform.rollz = 0.0f; } dometransform.splitscreen = splitscreen; @@ -6191,6 +6193,8 @@ void HWR_RenderSkyboxView(INT32 viewnumber, player_t *player) fixed_t rol = AngleFixed(player->viewrollangle); atransform.rollangle = FIXED_TO_FLOAT(rol); atransform.roll = true; + atransform.rollx = 1.0f; + atransform.rollz = 0.0f; } atransform.splitscreen = splitscreen; @@ -6405,6 +6409,8 @@ void HWR_RenderPlayerView(INT32 viewnumber, player_t *player) fixed_t rol = AngleFixed(player->viewrollangle); atransform.rollangle = FIXED_TO_FLOAT(rol); atransform.roll = true; + atransform.rollx = 1.0f; + atransform.rollz = 0.0f; } atransform.splitscreen = splitscreen; diff --git a/src/hardware/hw_md2.c b/src/hardware/hw_md2.c index 83a9146cd..baacc2490 100644 --- a/src/hardware/hw_md2.c +++ b/src/hardware/hw_md2.c @@ -1346,8 +1346,6 @@ boolean HWR_DrawModel(gl_vissprite_t *spr) const UINT8 hflip = (UINT8)(!(spr->mobj->mirrored) != !R_ThingHorizontallyFlipped(spr->mobj)); spritedef_t *sprdef; spriteframe_t *sprframe; - spriteinfo_t *sprinfo; - angle_t ang; INT32 mod; float finalscale; interpmobjstate_t interp; @@ -1388,12 +1386,10 @@ boolean HWR_DrawModel(gl_vissprite_t *spr) { md2 = &md2_playermodels[(skin_t*)spr->mobj->skin-skins]; md2->skin = (skin_t*)spr->mobj->skin-skins; - sprinfo = &((skin_t *)spr->mobj->skin)->sprinfo[spr->mobj->sprite2]; } else { md2 = &md2_models[spr->mobj->sprite]; - sprinfo = &spriteinfo[spr->mobj->sprite]; } // texture loading before model init, so it knows if sprite graphics are used, which @@ -1615,43 +1611,32 @@ boolean HWR_DrawModel(gl_vissprite_t *spr) } p.rollangle = 0.0f; - p.rollflip = 1; - p.rotaxis = 0; - if (spr->mobj->rollangle) + + if (interp.spriteroll) { - fixed_t anglef = AngleFixed(spr->mobj->rollangle); + fixed_t camAngleDiff = AngleFixed(viewangle) - FLOAT_TO_FIXED(p.angley); // dumb reconversion back, I know + fixed_t anglef = AngleFixed(interp.spriteroll); + p.rollangle = FIXED_TO_FLOAT(anglef); p.roll = true; // rotation pivot - p.centerx = FIXED_TO_FLOAT(spr->mobj->radius/2); - p.centery = FIXED_TO_FLOAT(spr->mobj->height/(flip ? -2 : 2)); + p.centerx = FIXED_TO_FLOAT(spr->mobj->radius / 2); + p.centery = FIXED_TO_FLOAT(spr->mobj->height / 2); - // rotation axis - if (sprinfo->available) - p.rotaxis = (UINT8)(sprinfo->pivot[(spr->mobj->frame & FF_FRAMEMASK)].rotaxis); - - // for NiGHTS specifically but should work everywhere else - ang = R_PointToAngle (interp.x, interp.y) - interp.angle; - if ((sprframe->rotate & SRF_RIGHT) && (ang < ANGLE_180)) // See from right - p.rollflip = 1; - else if ((sprframe->rotate & SRF_LEFT) && (ang >= ANGLE_180)) // See from left - p.rollflip = -1; - - if (flip) - p.rollflip *= -1; + // rotation axes relative to camera + p.rollx = FIXED_TO_FLOAT(FINECOSINE(FixedAngle(camAngleDiff) >> ANGLETOFINESHIFT)); + p.rollz = FIXED_TO_FLOAT(FINESINE(FixedAngle(camAngleDiff) >> ANGLETOFINESHIFT)); } - p.anglez = FIXED_TO_FLOAT(AngleFixed(spr->mobj->pitch)); - p.anglex = FIXED_TO_FLOAT(AngleFixed(spr->mobj->roll)); + p.anglez = FIXED_TO_FLOAT(AngleFixed(interp.pitch)); + p.anglex = FIXED_TO_FLOAT(AngleFixed(interp.roll)); // SRB2CBTODO: MD2 scaling support finalscale *= FIXED_TO_FLOAT(interp.scale); p.flip = atransform.flip; -#ifdef USE_FTRANSFORM_MIRROR - p.mirror = atransform.mirror; // from Kart -#endif + p.mirror = atransform.mirror; HWD.pfnSetShader(SHADER_MODEL); // model shader HWD.pfnDrawModel(md2->model, frame, durs, tics, nextFrame, &p, finalscale, flip, hflip, &Surf); diff --git a/src/hardware/r_opengl/r_opengl.c b/src/hardware/r_opengl/r_opengl.c index f50479a71..d785b3cbf 100644 --- a/src/hardware/r_opengl/r_opengl.c +++ b/src/hardware/r_opengl/r_opengl.c @@ -2782,7 +2782,6 @@ static void DrawModelEx(model_t *model, INT32 frameIndex, float duration, float pglEnable(GL_CULL_FACE); pglEnable(GL_NORMALIZE); -#ifdef USE_FTRANSFORM_MIRROR // flipped is if the object is vertically flipped // hflipped is if the object is horizontally flipped // pos->flip is if the screen is flipped vertically @@ -2795,17 +2794,6 @@ static void DrawModelEx(model_t *model, INT32 frameIndex, float duration, float else pglCullFace(GL_BACK); } -#else - // pos->flip is if the screen is flipped too - if (flipped ^ hflipped ^ pos->flip) // If one or three of these are active, but not two, invert the model's culling - { - pglCullFace(GL_FRONT); - } - else - { - pglCullFace(GL_BACK); - } -#endif pglPushMatrix(); // should be the same as glLoadIdentity //Hurdler: now it seems to work @@ -2821,14 +2809,8 @@ static void DrawModelEx(model_t *model, INT32 frameIndex, float duration, float if (pos->roll) { - float roll = (1.0f * pos->rollflip); pglTranslatef(pos->centerx, pos->centery, 0); - if (pos->rotaxis == 2) // Z - pglRotatef(pos->rollangle, 0.0f, 0.0f, roll); - else if (pos->rotaxis == 1) // Y - pglRotatef(pos->rollangle, 0.0f, roll, 0.0f); - else // X - pglRotatef(pos->rollangle, roll, 0.0f, 0.0f); + pglRotatef(pos->rollangle, pos->rollx, 0.0f, pos->rollz); pglTranslatef(-pos->centerx, -pos->centery, 0); } @@ -3001,13 +2983,9 @@ EXPORT void HWRAPI(SetTransform) (FTransform *stransform) if (stransform) { used_fov = stransform->fovxangle; -#ifdef USE_FTRANSFORM_MIRROR - // mirroring from Kart if (stransform->mirror) pglScalef(-stransform->scalex, stransform->scaley, -stransform->scalez); - else -#endif - if (stransform->flip) + else if (stransform->flip) pglScalef(stransform->scalex, -stransform->scaley, -stransform->scalez); else pglScalef(stransform->scalex, stransform->scaley, -stransform->scalez); diff --git a/src/lua_infolib.c b/src/lua_infolib.c index 578878b21..10baa3c67 100644 --- a/src/lua_infolib.c +++ b/src/lua_infolib.c @@ -319,7 +319,7 @@ static int PopPivotSubTable(spriteframepivot_t *pivot, lua_State *L, int stk, in else if (ikey == 2 || (key && fastcmp(key, "y"))) pivot[idx].y = (INT32)value; else if (ikey == 3 || (key && fastcmp(key, "rotaxis"))) - pivot[idx].rotaxis = (UINT8)value; + LUA_UsageWarning(L, "\"rotaxis\" is deprecated and will be removed.") else if (ikey == -1 && (key != NULL)) FIELDERROR("pivot key", va("invalid option %s", key)); okcool = 1; @@ -576,7 +576,10 @@ static int framepivot_get(lua_State *L) else if (fastcmp("y", field)) lua_pushinteger(L, framepivot->y); else if (fastcmp("rotaxis", field)) - lua_pushinteger(L, (UINT8)framepivot->rotaxis); + { + LUA_UsageWarning(L, "\"rotaxis\" is deprecated and will be removed."); + lua_pushinteger(L, 0); + } else return luaL_error(L, va("Field %s does not exist in spriteframepivot_t", field)); @@ -602,7 +605,7 @@ static int framepivot_set(lua_State *L) else if (fastcmp("y", field)) framepivot->y = luaL_checkinteger(L, 3); else if (fastcmp("rotaxis", field)) - framepivot->rotaxis = luaL_checkinteger(L, 3); + LUA_UsageWarning(L, "\"rotaxis\" is deprecated and will be removed.") else return luaL_error(L, va("Field %s does not exist in spriteframepivot_t", field)); diff --git a/src/lua_mobjlib.c b/src/lua_mobjlib.c index 09d244c91..404af016a 100644 --- a/src/lua_mobjlib.c +++ b/src/lua_mobjlib.c @@ -33,7 +33,8 @@ enum mobj_e { mobj_angle, mobj_pitch, mobj_roll, - mobj_rollangle, + mobj_spriteroll, + mobj_rollangle, // backwards compat mobj_sprite, mobj_frame, mobj_sprite2, @@ -110,7 +111,8 @@ static const char *const mobj_opt[] = { "angle", "pitch", "roll", - "rollangle", + "spriteroll", + "rollangle", // backwards compat "sprite", "frame", "sprite2", @@ -229,8 +231,9 @@ static int mobj_get(lua_State *L) case mobj_roll: lua_pushangle(L, mo->roll); break; - case mobj_rollangle: - lua_pushangle(L, mo->rollangle); + case mobj_spriteroll: + case mobj_rollangle: // backwards compat + lua_pushangle(L, mo->spriteroll); break; case mobj_sprite: lua_pushinteger(L, mo->sprite); @@ -518,8 +521,9 @@ static int mobj_set(lua_State *L) case mobj_roll: mo->roll = luaL_checkangle(L, 3); break; - case mobj_rollangle: - mo->rollangle = luaL_checkangle(L, 3); + case mobj_spriteroll: + case mobj_rollangle: // backwards compat + mo->spriteroll = luaL_checkangle(L, 3); break; case mobj_sprite: mo->sprite = luaL_checkinteger(L, 3); diff --git a/src/p_enemy.c b/src/p_enemy.c index d9b44e603..b40525b2d 100644 --- a/src/p_enemy.c +++ b/src/p_enemy.c @@ -8687,10 +8687,10 @@ void A_RollAngle(mobj_t *actor) // relative (default) if (!locvar2) - actor->rollangle += angle; + actor->spriteroll += angle; // absolute else - actor->rollangle = angle; + actor->spriteroll = angle; } // Function: A_ChangeRollAngleRelative @@ -8715,7 +8715,7 @@ void A_ChangeRollAngleRelative(mobj_t *actor) I_Error("A_ChangeRollAngleRelative: var1 is greater than var2"); #endif - actor->rollangle += FixedAngle(P_RandomRange(amin, amax)); + actor->spriteroll += FixedAngle(P_RandomRange(amin, amax)); } // Function: A_ChangeRollAngleAbsolute @@ -8740,7 +8740,7 @@ void A_ChangeRollAngleAbsolute(mobj_t *actor) I_Error("A_ChangeRollAngleAbsolute: var1 is greater than var2"); #endif - actor->rollangle = FixedAngle(P_RandomRange(amin, amax)); + actor->spriteroll = FixedAngle(P_RandomRange(amin, amax)); } // Function: A_PlaySound diff --git a/src/p_inter.c b/src/p_inter.c index 8c57beac8..4d22ba343 100644 --- a/src/p_inter.c +++ b/src/p_inter.c @@ -3117,7 +3117,7 @@ static void P_NiGHTSDamage(mobj_t *target, mobj_t *source) P_SetPlayerMobjState(target, S_PLAY_NIGHTS_STUN); S_StartSound(target, sfx_nghurt); - player->mo->rollangle = 0; + player->mo->spriteroll = 0; if (oldnightstime > 10*TICRATE && player->nightstime < 10*TICRATE) diff --git a/src/p_mobj.c b/src/p_mobj.c index 9b22647c8..9a889d516 100644 --- a/src/p_mobj.c +++ b/src/p_mobj.c @@ -9868,9 +9868,9 @@ static boolean P_MobjRegularThink(mobj_t *mobj) break; case MT_MINUS: if (P_IsObjectOnGround(mobj)) - mobj->rollangle = 0; + mobj->spriteroll = 0; else - mobj->rollangle = R_PointToAngle2(0, 0, P_MobjFlip(mobj)*mobj->momz, (mobj->scale << 1) - min(abs(mobj->momz), mobj->scale << 1)); + mobj->spriteroll = R_PointToAngle2(0, 0, P_MobjFlip(mobj)*mobj->momz, (mobj->scale << 1) - min(abs(mobj->momz), mobj->scale << 1)); break; case MT_PUSH: P_PointPushThink(mobj); @@ -14167,6 +14167,13 @@ mobj_t *P_SpawnMobjFromMobj(mobj_t *mobj, fixed_t xofs, fixed_t yofs, fixed_t zo newmobj->old_angle = mobj->old_angle; } + newmobj->old_pitch2 = mobj->old_pitch2; + newmobj->old_pitch = mobj->old_pitch; + newmobj->old_roll2 = mobj->old_roll2; + newmobj->old_roll = mobj->old_roll; + newmobj->old_spriteroll2 = mobj->old_spriteroll2; + newmobj->old_spriteroll = mobj->old_spriteroll; + newmobj->old_scale2 = mobj->old_scale2; newmobj->old_scale = mobj->old_scale; newmobj->old_spritexscale = mobj->old_spritexscale; diff --git a/src/p_mobj.h b/src/p_mobj.h index f573e9020..6a5ab84c4 100644 --- a/src/p_mobj.h +++ b/src/p_mobj.h @@ -292,7 +292,7 @@ typedef struct mobj_s angle_t angle, pitch, roll; // orientation angle_t old_angle, old_pitch, old_roll; // orientation interpolation angle_t old_angle2, old_pitch2, old_roll2; - angle_t rollangle; + angle_t spriteroll, old_spriteroll, old_spriteroll2; spritenum_t sprite; // used to find patch_t and flip value UINT32 frame; // frame number, plus bits see p_pspr.h UINT8 sprite2; // player sprites @@ -429,7 +429,7 @@ typedef struct precipmobj_s angle_t angle, pitch, roll; // orientation angle_t old_angle, old_pitch, old_roll; // orientation interpolation angle_t old_angle2, old_pitch2, old_roll2; - angle_t rollangle; + angle_t spriteroll, old_spriteroll, old_spriteroll2; spritenum_t sprite; // used to find patch_t and flip value UINT32 frame; // frame number, plus bits see p_pspr.h UINT8 sprite2; // player sprites diff --git a/src/p_saveg.c b/src/p_saveg.c index 40fd65638..ce0b262a3 100644 --- a/src/p_saveg.c +++ b/src/p_saveg.c @@ -1565,7 +1565,7 @@ typedef enum MD2_SLOPE = 1<<11, MD2_COLORIZED = 1<<12, MD2_MIRRORED = 1<<13, - MD2_ROLLANGLE = 1<<14, + MD2_SPRITEROLL = 1<<14, MD2_SHADOWSCALE = 1<<15, MD2_RENDERFLAGS = 1<<16, MD2_BLENDMODE = 1<<17, @@ -1783,8 +1783,8 @@ static void SaveMobjThinker(const thinker_t *th, const UINT8 type) diff2 |= MD2_COLORIZED; if (mobj->mirrored) diff2 |= MD2_MIRRORED; - if (mobj->rollangle) - diff2 |= MD2_ROLLANGLE; + if (mobj->spriteroll) + diff2 |= MD2_SPRITEROLL; if (mobj->shadowscale) diff2 |= MD2_SHADOWSCALE; if (mobj->renderflags) @@ -1951,8 +1951,8 @@ static void SaveMobjThinker(const thinker_t *th, const UINT8 type) WRITEUINT8(save_p, mobj->colorized); if (diff2 & MD2_MIRRORED) WRITEUINT8(save_p, mobj->mirrored); - if (diff2 & MD2_ROLLANGLE) - WRITEANGLE(save_p, mobj->rollangle); + if (diff2 & MD2_SPRITEROLL) + WRITEANGLE(save_p, mobj->spriteroll); if (diff2 & MD2_SHADOWSCALE) WRITEFIXED(save_p, mobj->shadowscale); if (diff2 & MD2_RENDERFLAGS) @@ -3001,8 +3001,8 @@ static thinker_t* LoadMobjThinker(actionf_p1 thinker) mobj->colorized = READUINT8(save_p); if (diff2 & MD2_MIRRORED) mobj->mirrored = READUINT8(save_p); - if (diff2 & MD2_ROLLANGLE) - mobj->rollangle = READANGLE(save_p); + if (diff2 & MD2_SPRITEROLL) + mobj->spriteroll = READANGLE(save_p); if (diff2 & MD2_SHADOWSCALE) mobj->shadowscale = READFIXED(save_p); if (diff2 & MD2_RENDERFLAGS) diff --git a/src/p_user.c b/src/p_user.c index 74b5b7175..16952f775 100644 --- a/src/p_user.c +++ b/src/p_user.c @@ -676,7 +676,7 @@ static void P_DeNightserizePlayer(player_t *player) player->marebonuslap = 0; player->flyangle = 0; player->anotherflyangle = 0; - player->mo->rollangle = 0; + player->mo->spriteroll = 0; P_SetTarget(&player->mo->target, NULL); P_SetTarget(&player->axis1, P_SetTarget(&player->axis2, NULL)); @@ -802,7 +802,7 @@ void P_NightserizePlayer(player_t *player, INT32 nighttime) player->secondjump = 0; player->flyangle = 0; player->anotherflyangle = 0; - player->mo->rollangle = 0; + player->mo->spriteroll = 0; player->powers[pw_shield] = SH_NONE; player->powers[pw_super] = 0; @@ -1978,7 +1978,7 @@ mobj_t *P_SpawnGhostMobj(mobj_t *mobj) ghost->angle = (mobj->player ? mobj->player->drawangle : mobj->angle); ghost->roll = mobj->roll; ghost->pitch = mobj->pitch; - ghost->rollangle = mobj->rollangle; + ghost->spriteroll = mobj->spriteroll; ghost->sprite = mobj->sprite; ghost->sprite2 = mobj->sprite2; @@ -2017,6 +2017,7 @@ mobj_t *P_SpawnGhostMobj(mobj_t *mobj) ghost->old_angle = (mobj->player ? mobj->player->old_drawangle2 : mobj->old_angle2); ghost->old_pitch = mobj->old_pitch2; ghost->old_roll = mobj->old_roll2; + ghost->old_spriteroll = mobj->old_spriteroll2; return ghost; } @@ -6793,9 +6794,9 @@ static void P_DoNiGHTSCapsule(player_t *player) { if ((player->mo->state == &states[S_PLAY_NIGHTS_PULL]) && (player->mo->sprite2 == SPR2_NPUL)) - player->mo->rollangle -= ANG30; + player->mo->spriteroll -= ANG30; else - player->mo->rollangle = 0; + player->mo->spriteroll = 0; } if (G_IsSpecialStage(gamemap)) @@ -7248,7 +7249,7 @@ static void P_NiGHTSMovement(player_t *player) && player->mo->state <= &states[S_PLAY_NIGHTS_TRANS6]) { player->mo->momx = player->mo->momy = player->mo->momz = 0; - player->mo->rollangle = 0; + player->mo->spriteroll = 0; return; } @@ -7266,7 +7267,7 @@ static void P_NiGHTSMovement(player_t *player) { if (player->mo->state != &states[S_PLAY_NIGHTS_DRILL]) P_SetPlayerMobjState(player->mo, S_PLAY_NIGHTS_DRILL); - player->mo->rollangle = ANGLE_90; + player->mo->spriteroll = ANGLE_90; } else #endif @@ -7599,9 +7600,9 @@ static void P_NiGHTSMovement(player_t *player) P_SetPlayerMobjState(player->mo, flystate); if (player->charflags & SF_NONIGHTSROTATION) - player->mo->rollangle = 0; + player->mo->spriteroll = 0; else - player->mo->rollangle = rollangle; + player->mo->spriteroll = rollangle; P_SetPlayerAngle(player, player->mo->angle); diff --git a/src/r_fps.c b/src/r_fps.c index 6166f0408..e8f43f499 100644 --- a/src/r_fps.c +++ b/src/r_fps.c @@ -294,6 +294,9 @@ void R_InterpolateMobjState(mobj_t *mobj, fixed_t frac, interpmobjstate_t *out) out->scale = mobj->scale; out->subsector = mobj->subsector; out->angle = mobj->player ? mobj->player->drawangle : mobj->angle; + out->pitch = mobj->pitch; + out->roll = mobj->roll; + out->spriteroll = mobj->spriteroll; out->spritexscale = mobj->spritexscale; out->spriteyscale = mobj->spriteyscale; out->spritexoffset = mobj->spritexoffset; @@ -323,6 +326,10 @@ void R_InterpolateMobjState(mobj_t *mobj, fixed_t frac, interpmobjstate_t *out) { out->angle = mobj->resetinterp ? mobj->angle : R_LerpAngle(mobj->old_angle, mobj->angle, frac); } + + out->pitch = mobj->resetinterp ? mobj->pitch : R_LerpAngle(mobj->old_pitch, mobj->pitch, frac); + out->roll = mobj->resetinterp ? mobj->roll : R_LerpAngle(mobj->old_roll, mobj->roll, frac); + out->spriteroll = mobj->resetinterp ? mobj->spriteroll : R_LerpAngle(mobj->old_spriteroll, mobj->spriteroll, frac); } void R_InterpolatePrecipMobjState(precipmobj_t *mobj, fixed_t frac, interpmobjstate_t *out) @@ -335,6 +342,9 @@ void R_InterpolatePrecipMobjState(precipmobj_t *mobj, fixed_t frac, interpmobjst out->scale = FRACUNIT; out->subsector = mobj->subsector; out->angle = mobj->angle; + out->pitch = mobj->angle; + out->roll = mobj->roll; + out->spriteroll = mobj->spriteroll; out->spritexscale = mobj->spritexscale; out->spriteyscale = mobj->spriteyscale; out->spritexoffset = mobj->spritexoffset; @@ -354,6 +364,9 @@ void R_InterpolatePrecipMobjState(precipmobj_t *mobj, fixed_t frac, interpmobjst out->subsector = R_PointInSubsector(out->x, out->y); out->angle = R_LerpAngle(mobj->old_angle, mobj->angle, frac); + out->pitch = R_LerpAngle(mobj->old_pitch, mobj->pitch, frac); + out->roll = R_LerpAngle(mobj->old_roll, mobj->roll, frac); + out->spriteroll = R_LerpAngle(mobj->old_spriteroll, mobj->spriteroll, frac); } static void AddInterpolator(levelinterpolator_t* interpolator) @@ -766,6 +779,7 @@ void R_ResetMobjInterpolationState(mobj_t *mobj) mobj->old_angle2 = mobj->old_angle; mobj->old_pitch2 = mobj->old_pitch; mobj->old_roll2 = mobj->old_roll; + mobj->old_spriteroll2 = mobj->old_spriteroll; mobj->old_scale2 = mobj->old_scale; mobj->old_x = mobj->x; mobj->old_y = mobj->y; @@ -773,6 +787,7 @@ void R_ResetMobjInterpolationState(mobj_t *mobj) mobj->old_angle = mobj->angle; mobj->old_pitch = mobj->pitch; mobj->old_roll = mobj->roll; + mobj->old_spriteroll = mobj->spriteroll; mobj->old_scale = mobj->scale; mobj->old_spritexscale = mobj->spritexscale; mobj->old_spriteyscale = mobj->spriteyscale; @@ -801,10 +816,14 @@ void R_ResetPrecipitationMobjInterpolationState(precipmobj_t *mobj) mobj->old_angle2 = mobj->old_angle; mobj->old_pitch2 = mobj->old_pitch; mobj->old_roll2 = mobj->old_roll; + mobj->old_spriteroll2 = mobj->old_spriteroll; mobj->old_x = mobj->x; mobj->old_y = mobj->y; mobj->old_z = mobj->z; mobj->old_angle = mobj->angle; + mobj->old_pitch = mobj->pitch; + mobj->old_roll = mobj->roll; + mobj->old_spriteroll = mobj->spriteroll; mobj->old_spritexscale = mobj->spritexscale; mobj->old_spriteyscale = mobj->spriteyscale; mobj->old_spritexoffset = mobj->spritexoffset; diff --git a/src/r_fps.h b/src/r_fps.h index 85c87a2f4..9a8bfa38a 100644 --- a/src/r_fps.h +++ b/src/r_fps.h @@ -59,6 +59,9 @@ typedef struct { fixed_t z; subsector_t *subsector; angle_t angle; + angle_t pitch; + angle_t roll; + angle_t spriteroll; fixed_t scale; fixed_t spritexscale; fixed_t spriteyscale; diff --git a/src/r_picformats.c b/src/r_picformats.c index 9aea8c6c1..3e817f4a0 100644 --- a/src/r_picformats.c +++ b/src/r_picformats.c @@ -1407,7 +1407,6 @@ static void R_ParseSpriteInfoFrame(spriteinfo_t *info) UINT8 frameFrame = 0xFF; INT16 frameXPivot = 0; INT16 frameYPivot = 0; - rotaxis_t frameRotAxis = 0; // Sprite identifier sprinfoToken = M_GetToken(NULL); @@ -1458,12 +1457,6 @@ static void R_ParseSpriteInfoFrame(spriteinfo_t *info) { Z_Free(sprinfoToken); sprinfoToken = M_GetToken(NULL); - 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; } Z_Free(sprinfoToken); @@ -1480,7 +1473,6 @@ static void R_ParseSpriteInfoFrame(spriteinfo_t *info) // set fields info->pivot[frameFrame].x = frameXPivot; info->pivot[frameFrame].y = frameYPivot; - info->pivot[frameFrame].rotaxis = frameRotAxis; } // diff --git a/src/r_picformats.h b/src/r_picformats.h index 4f9637460..4050a1b71 100644 --- a/src/r_picformats.h +++ b/src/r_picformats.h @@ -95,7 +95,6 @@ typedef enum typedef struct { INT32 x, y; - rotaxis_t rotaxis; } spriteframepivot_t; typedef struct diff --git a/src/r_splats.c b/src/r_splats.c index 72bfe74b3..d182d628b 100644 --- a/src/r_splats.c +++ b/src/r_splats.c @@ -191,7 +191,7 @@ void R_DrawFloorSplat(vissprite_t *spr) splatangle = spr->viewpoint.angle; if (!(spr->cut & SC_ISROTATED)) - splatangle += mobj->rollangle; + splatangle += mobj->spriteroll; splat.angle = -splatangle; splat.angle += ANGLE_90; diff --git a/src/r_things.c b/src/r_things.c index 19b8ee83d..eab8d13c2 100644 --- a/src/r_things.c +++ b/src/r_things.c @@ -1743,17 +1743,17 @@ static void R_ProjectSprite(mobj_t *thing) patch = W_CachePatchNum(sprframe->lumppat[rot], PU_SPRITE); #ifdef ROTSPRITE - if (thing->rollangle + if (interp.spriteroll && !(splat && !(thing->renderflags & RF_NOSPLATROLLANGLE))) { if (papersprite && ang >= ANGLE_180) { // Makes Software act much more sane like OpenGL - rollangle = R_GetRollAngle(InvAngle(thing->rollangle)); + rollangle = R_GetRollAngle(InvAngle(interp.spriteroll)); } else { - rollangle = R_GetRollAngle(thing->rollangle); + rollangle = R_GetRollAngle(interp.spriteroll); } rotsprite = Patch_GetRotatedSprite(sprframe, (thing->frame & FF_FRAMEMASK), rot, flip, false, sprinfo, rollangle);