-
Notifications
You must be signed in to change notification settings - Fork 41
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Improved weapon interpolation #2123
Conversation
This approach, similar to that of mobj interpolation, eliminates some issues from the old approach, namely interpolation having to be reset upon sprite changes and view-size changes.
There were issues: #693 I agree that we don't need it anymore. I don't think we need diff --git a/src/am_map.c b/src/am_map.c
index 1b859153..aebd15d8 100644
--- a/src/am_map.c
+++ b/src/am_map.c
@@ -2312,10 +2312,7 @@ void AM_Drawer (void)
}
if (automapoverlay == AM_OVERLAY_OFF)
- {
AM_clearFB(mapcolor_back); //jff 1/5/98 background default color
- pspr_interp = false;
- }
// [Alaux] Dark automap overlay
else if (automapoverlay == AM_OVERLAY_DARK && !MN_MenuIsShaded())
V_ShadeScreen();
diff --git a/src/p_mobj.c b/src/p_mobj.c
index b8eed65f..9bb8d6fd 100644
--- a/src/p_mobj.c
+++ b/src/p_mobj.c
@@ -1127,8 +1127,6 @@ void P_SpawnPlayer (mapthing_t* mthing)
p->momx = p->momy = 0; // killough 10/98: initialize bobbing to 0.
- pspr_interp = false;
-
// setup gun psprite
P_SetupPsprites (p);
diff --git a/src/p_pspr.c b/src/p_pspr.c
index 526e57fc..826b534d 100644
--- a/src/p_pspr.c
+++ b/src/p_pspr.c
@@ -167,9 +167,12 @@ static void P_BringUpWeapon(player_t *player)
player->pendingweapon = wp_nochange;
+ pspdef_t *psp = &player->psprites[ps_weapon];
+
// killough 12/98: prevent pistol from starting visibly at bottom of screen:
- player->psprites[ps_weapon].sy = demo_version >= DV_MBF ?
- WEAPONBOTTOM+FRACUNIT*2 : WEAPONBOTTOM;
+ psp->sy = demo_version >= DV_MBF ? WEAPONBOTTOM + FRACUNIT * 2 : WEAPONBOTTOM;
+
+ psp->sy2 = psp->oldsy2 = psp->sy;
P_SetPsprite(player, ps_weapon, newstate);
}
diff --git a/src/r_things.c b/src/r_things.c
index 4002abd3..975fac56 100644
--- a/src/r_things.c
+++ b/src/r_things.c
@@ -787,8 +787,6 @@ void R_NearbySprites (void)
// R_DrawPSprite
//
-boolean pspr_interp = true; // weapon bobbing interpolation
-
void R_DrawPSprite (pspdef_t *psp)
{
fixed_t tx;
@@ -823,15 +821,13 @@ void R_DrawPSprite (pspdef_t *psp)
fixed_t sx2, sy2;
- if (uncapped && oldleveltime < leveltime && pspr_interp)
+ if (uncapped && oldleveltime < leveltime)
{
sx2 = LerpFixed(psp->oldsx2, psp->sx2);
sy2 = LerpFixed(psp->oldsy2, psp->sy2);
}
else
{
- pspr_interp = true;
-
sx2 = psp->sx2;
sy2 = psp->sy2;
}
diff --git a/src/r_things.h b/src/r_things.h
index f85d45a0..40321c55 100644
--- a/src/r_things.h
+++ b/src/r_things.h
@@ -39,7 +39,6 @@ extern int64_t sprtopscreen; // [FG] 64-bit integer math
extern fixed_t pspritescale;
extern fixed_t pspriteiscale;
-extern boolean pspr_interp; // weapon bobbing interpolation
extern boolean flipcorpses;
extern lighttable_t **spritelights; Nice simplification, thanks! |
Co-Authored-By: Roman Fomin <[email protected]>
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM as well, thank you!
(Apparently, PrBoom+'s interpolation code is too different to be directly applicable to the Crispy/Woof approach.)
But we could set them equal to |
FWIW, I tried DSDA 0.28.2 out of curiosity, and its bobbing seems to have the same issues as with the approach that we're replacing here.
I agree; done in 7064a8e. Anything else? Otherwise, I'll merge. EDIT: Oops, I rushed it and didn't do it properly. Give me a second. EDIT 2: Should be fixed in b028290. |
Yes, now it's right. Please go ahead! |
This approach, similar to that of mobj interpolation, eliminates some issues from the old approach, namely interpolation having to be reset upon sprite changes and view-size changes; we now interpolate
sx2
andsy2
, which are independent of resolution and sprite size, instead of the vissprite itself, which is dependent on those factors.I think it's not necessary to save/load
oldsx2, oldsy2
in/from savegames.While we're on this, what's the purpose of
pspr_interp = false
in the followingAM_Drawer()
code?woof/src/am_map.c
Lines 2314 to 2318 in dcf9341
I think we can remove it.