Merge branch 'shieldscalefix' into 'next'

Fix shieldscale 0 bugs

See merge request STJr/SRB2!2425
This commit is contained in:
sphere 2024-06-03 23:25:02 +00:00
commit b4b72730db
3 changed files with 27 additions and 5 deletions

View file

@ -10211,9 +10211,12 @@ void M_DrawNightsAttackMenu(void)
color = skins[skinnumber]->prefcolor;
angle_t fa = (FixedAngle(((FixedInt(ntsatkdrawtimer * 4)) % 360)<<FRACBITS)>>ANGLETOFINESHIFT) & FINEMASK;
fixed_t scale = skins[skinnumber]->highresscale;
if (skins[skinnumber]->shieldscale)
scale = FixedDiv(scale, skins[skinnumber]->shieldscale);
V_DrawFixedPatch(270<<FRACBITS, (186<<FRACBITS) - 8*FINESINE(fa),
FixedDiv(skins[skinnumber]->highresscale, skins[skinnumber]->shieldscale),
scale,
(sprframe->flip & 1<<6) ? V_FLIP : 0,
natksprite,
R_GetTranslationColormap(TC_BLINK, color, GTC_CACHE));
@ -12300,7 +12303,9 @@ static void M_DrawSetupMultiPlayerMenu(void)
if (multi_frame >= sprdef->numframes)
multi_frame = 0;
scale = FixedDiv(skins[setupm_fakeskin]->highresscale, skins[setupm_fakeskin]->shieldscale);
scale = skins[setupm_fakeskin]->highresscale;
if (skins[setupm_fakeskin]->shieldscale)
scale = FixedDiv(scale, skins[setupm_fakeskin]->shieldscale);
#define chary (y+64)
@ -12333,7 +12338,7 @@ static void M_DrawSetupMultiPlayerMenu(void)
V_DrawFixedPatch(
x<<FRACBITS,
chary<<FRACBITS,
FixedDiv(skins[setupm_fakeskin]->highresscale, skins[setupm_fakeskin]->shieldscale),
scale,
flags, patch, colormap);
goto colordraw;

View file

@ -6662,8 +6662,21 @@ static boolean P_ShieldLook(mobj_t *thing, shieldtype_t shield)
thing->flags |= MF_NOCLIPHEIGHT;
thing->eflags = (thing->eflags & ~MFE_VERTICALFLIP)|(thing->target->eflags & MFE_VERTICALFLIP);
P_SetScale(thing, FixedMul(thing->target->scale, thing->target->player->shieldscale), true);
thing->old_scale = FixedMul(thing->target->old_scale, thing->target->player->shieldscale);
//Set the shield's scale based on shieldscale, hide it if we're too small!
fixed_t scale = FixedMul(thing->target->scale, thing->target->player->shieldscale);
if (scale < 1) {
P_SetScale(thing, thing->target->scale, true);
thing->old_scale = thing->target->old_scale;
thing->flags2 |= (MF2_DONTDRAW|MF2_JUSTATTACKED); //Hide and indicate we're hidden
} else {
P_SetScale(thing, scale, true);
thing->old_scale = FixedMul(thing->target->old_scale, thing->target->player->shieldscale);
//Only unhide if we were hidden by the above code
if (thing->flags2 & MF2_JUSTATTACKED)
thing->flags2 &= ~(MF2_DONTDRAW|MF2_JUSTATTACKED);
}
#define NewMH(mobj) mobj->height // Ugly mobj-height and player-height defines, for the sake of prettier code
#define NewPH(player) P_GetPlayerHeight(player)

View file

@ -1774,6 +1774,10 @@ static void R_ProjectSprite(mobj_t *thing)
}
this_scale = interp.scale;
if (this_scale < 1)
return;
radius = interp.radius; // For drop shadows
height = interp.height; // Ditto