mirror of
https://git.do.srb2.org/STJr/SRB2.git
synced 2024-11-15 01:01:33 +00:00
Merge branch 'shieldscalefix' into 'next'
Fix shieldscale 0 bugs See merge request STJr/SRB2!2425
This commit is contained in:
commit
b4b72730db
3 changed files with 27 additions and 5 deletions
11
src/m_menu.c
11
src/m_menu.c
|
@ -10211,9 +10211,12 @@ void M_DrawNightsAttackMenu(void)
|
||||||
color = skins[skinnumber]->prefcolor;
|
color = skins[skinnumber]->prefcolor;
|
||||||
|
|
||||||
angle_t fa = (FixedAngle(((FixedInt(ntsatkdrawtimer * 4)) % 360)<<FRACBITS)>>ANGLETOFINESHIFT) & FINEMASK;
|
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),
|
V_DrawFixedPatch(270<<FRACBITS, (186<<FRACBITS) - 8*FINESINE(fa),
|
||||||
FixedDiv(skins[skinnumber]->highresscale, skins[skinnumber]->shieldscale),
|
scale,
|
||||||
(sprframe->flip & 1<<6) ? V_FLIP : 0,
|
(sprframe->flip & 1<<6) ? V_FLIP : 0,
|
||||||
natksprite,
|
natksprite,
|
||||||
R_GetTranslationColormap(TC_BLINK, color, GTC_CACHE));
|
R_GetTranslationColormap(TC_BLINK, color, GTC_CACHE));
|
||||||
|
@ -12300,7 +12303,9 @@ static void M_DrawSetupMultiPlayerMenu(void)
|
||||||
if (multi_frame >= sprdef->numframes)
|
if (multi_frame >= sprdef->numframes)
|
||||||
multi_frame = 0;
|
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)
|
#define chary (y+64)
|
||||||
|
|
||||||
|
@ -12333,7 +12338,7 @@ static void M_DrawSetupMultiPlayerMenu(void)
|
||||||
V_DrawFixedPatch(
|
V_DrawFixedPatch(
|
||||||
x<<FRACBITS,
|
x<<FRACBITS,
|
||||||
chary<<FRACBITS,
|
chary<<FRACBITS,
|
||||||
FixedDiv(skins[setupm_fakeskin]->highresscale, skins[setupm_fakeskin]->shieldscale),
|
scale,
|
||||||
flags, patch, colormap);
|
flags, patch, colormap);
|
||||||
|
|
||||||
goto colordraw;
|
goto colordraw;
|
||||||
|
|
15
src/p_mobj.c
15
src/p_mobj.c
|
@ -6662,9 +6662,22 @@ static boolean P_ShieldLook(mobj_t *thing, shieldtype_t shield)
|
||||||
thing->flags |= MF_NOCLIPHEIGHT;
|
thing->flags |= MF_NOCLIPHEIGHT;
|
||||||
thing->eflags = (thing->eflags & ~MFE_VERTICALFLIP)|(thing->target->eflags & MFE_VERTICALFLIP);
|
thing->eflags = (thing->eflags & ~MFE_VERTICALFLIP)|(thing->target->eflags & MFE_VERTICALFLIP);
|
||||||
|
|
||||||
P_SetScale(thing, FixedMul(thing->target->scale, thing->target->player->shieldscale), true);
|
//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);
|
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 NewMH(mobj) mobj->height // Ugly mobj-height and player-height defines, for the sake of prettier code
|
||||||
#define NewPH(player) P_GetPlayerHeight(player)
|
#define NewPH(player) P_GetPlayerHeight(player)
|
||||||
#define OldMH(mobj) FixedMul(mobj->height, FixedDiv(mobj->old_scale, mobj->scale))
|
#define OldMH(mobj) FixedMul(mobj->height, FixedDiv(mobj->old_scale, mobj->scale))
|
||||||
|
|
|
@ -1774,6 +1774,10 @@ static void R_ProjectSprite(mobj_t *thing)
|
||||||
}
|
}
|
||||||
|
|
||||||
this_scale = interp.scale;
|
this_scale = interp.scale;
|
||||||
|
|
||||||
|
if (this_scale < 1)
|
||||||
|
return;
|
||||||
|
|
||||||
radius = interp.radius; // For drop shadows
|
radius = interp.radius; // For drop shadows
|
||||||
height = interp.height; // Ditto
|
height = interp.height; // Ditto
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue