Fix various things that used NUMTRANSMAPS for the number of translucent trans maps

This commit is contained in:
Sryder 2020-10-25 23:19:20 +00:00
parent 488ad70da3
commit dc453fbbda
9 changed files with 32 additions and 30 deletions

View file

@ -11148,6 +11148,7 @@ struct {
{"tr_trans70",tr_trans70},
{"tr_trans80",tr_trans80},
{"tr_trans90",tr_trans90},
{"NUMTRANSLUCENTTRANSMAPS",NUMTRANSLUCENTTRANSMAPS},
{"tr_transadd",tr_transadd},
{"tr_transsub",tr_transsub},
{"NUMTRANSMAPS",NUMTRANSMAPS},

View file

@ -703,7 +703,7 @@ static void Got_Saycmd(UINT8 **p, INT32 playernum)
}
else if (target == -1) // say team
{
if (players[playernum].ctfteam == 1)
if (players[playernum].ctfteam == 1)
{
// red text
cstart = textcolor = "\x85";
@ -1934,7 +1934,7 @@ void HU_DrawSongCredits(void)
}
else
{
if (cursongcredit.trans < NUMTRANSMAPS)
if (cursongcredit.trans < NUMTRANSLUCENTTRANSMAPS)
cursongcredit.trans++;
if (cursongcredit.x > 0)
cursongcredit.x /= 2;
@ -1942,10 +1942,10 @@ void HU_DrawSongCredits(void)
cursongcredit.x = 0;
}
bgt = (NUMTRANSMAPS/2)+(cursongcredit.trans/2);
if (bgt < NUMTRANSMAPS)
bgt = (NUMTRANSLUCENTTRANSMAPS/2)+(cursongcredit.trans/2);
if (bgt < NUMTRANSLUCENTTRANSMAPS)
V_DrawScaledPatch(cursongcredit.x, y-2, V_SNAPTOLEFT|(bgt<<V_ALPHASHIFT), songcreditbg);
if (cursongcredit.trans < NUMTRANSMAPS)
if (cursongcredit.trans < NUMTRANSLUCENTTRANSMAPS)
V_DrawRightAlignedThinString(cursongcredit.x, y, V_ALLOWLOWERCASE|V_6WIDTHSPACE|V_SNAPTOLEFT|(cursongcredit.trans<<V_ALPHASHIFT), str);
}

View file

@ -419,10 +419,10 @@ void K_RunBattleOvertime(void)
if (!splitscreen && players[displayplayers[0]].mo)
{
INT32 dist = P_AproxDistance(battleovertime.x-players[displayplayers[0]].mo->x, battleovertime.y-players[displayplayers[0]].mo->y);
transparency = max(0, NUMTRANSMAPS - ((256 + (dist>>FRACBITS)) / 256));
transparency = max(0, NUMTRANSLUCENTTRANSMAPS - ((256 + (dist>>FRACBITS)) / 256));
}
if (transparency < NUMTRANSMAPS)
if (transparency < NUMTRANSLUCENTTRANSMAPS)
{
mobj_t *beam = P_SpawnMobj(battleovertime.x, battleovertime.y, battleovertime.z + (mobjinfo[MT_RANDOMITEM].height/2), MT_OVERTIMEBEAM);
P_SetScale(beam, beam->scale*2);

View file

@ -6442,7 +6442,7 @@ static boolean P_MobjRegularThink(mobj_t *mobj)
mobj->color = K_RainbowColor(
(SKINCOLOR_PURPLE - SKINCOLOR_PINK) // Smoothly transition into the other state
+ ((mobj->fuse - 32) * 2) // Make the color flashing slow down while it runs out
);
);
switch (mobj->extravalue1)
{
@ -6674,12 +6674,12 @@ static boolean P_MobjRegularThink(mobj_t *mobj)
const angle_t off = FixedAngle(40*FRACUNIT);
angle_t ang = mobj->target->angle;
fixed_t z;
UINT8 trans = (mobj->target->player->kartstuff[k_tiregrease] * (NUMTRANSMAPS+1)) / greasetics;
UINT8 trans = (mobj->target->player->kartstuff[k_tiregrease] * (NUMTRANSLUCENTTRANSMAPS+1)) / greasetics;
if (trans > NUMTRANSMAPS)
trans = NUMTRANSMAPS;
if (trans > NUMTRANSLUCENTTRANSMAPS)
trans = NUMTRANSLUCENTTRANSMAPS;
trans = NUMTRANSMAPS - trans;
trans = NUMTRANSLUCENTTRANSMAPS - trans;
z = mobj->target->z;
if (mobj->eflags & MFE_VERTICALFLIP)
@ -6702,7 +6702,7 @@ static boolean P_MobjRegularThink(mobj_t *mobj)
if (leveltime & 1)
mobj->drawflags |= MFD_DONTDRAW;
if (trans >= NUMTRANSMAPS)
if (trans >= NUMTRANSLUCENTTRANSMAPS)
mobj->drawflags |= MFD_DONTDRAW;
else if (trans == 0)
mobj->drawflags = (mobj->drawflags & ~MFD_TRANSMASK);
@ -8437,15 +8437,15 @@ void P_MobjThinker(mobj_t *mobj)
{
if (mobj->flags2 & MF2_BOSSNOTRAP) // "fast" flag
{
if ((signed)((mobj->frame & FF_TRANSMASK) >> FF_TRANSSHIFT) < (NUMTRANSMAPS-1) - (2*mobj->fuse)/3)
if ((signed)((mobj->frame & FF_TRANSMASK) >> FF_TRANSSHIFT) < (NUMTRANSLUCENTTRANSMAPS-1) - (2*mobj->fuse)/3)
// fade out when nearing the end of fuse...
mobj->frame = (mobj->frame & ~FF_TRANSMASK) | (((NUMTRANSMAPS-1) - (2*mobj->fuse)/3) << FF_TRANSSHIFT);
mobj->frame = (mobj->frame & ~FF_TRANSMASK) | (((NUMTRANSLUCENTTRANSMAPS-1) - (2*mobj->fuse)/3) << FF_TRANSSHIFT);
}
else
{
if ((signed)((mobj->frame & FF_TRANSMASK) >> FF_TRANSSHIFT) < (NUMTRANSMAPS-1) - mobj->fuse / 2)
if ((signed)((mobj->frame & FF_TRANSMASK) >> FF_TRANSSHIFT) < (NUMTRANSLUCENTTRANSMAPS-1) - mobj->fuse / 2)
// fade out when nearing the end of fuse...
mobj->frame = (mobj->frame & ~FF_TRANSMASK) | (((NUMTRANSMAPS-1) - mobj->fuse / 2) << FF_TRANSSHIFT);
mobj->frame = (mobj->frame & ~FF_TRANSMASK) | (((NUMTRANSLUCENTTRANSMAPS-1) - mobj->fuse / 2) << FF_TRANSSHIFT);
}
}
@ -10048,7 +10048,7 @@ void P_SpawnPlayer(INT32 playernum)
/*
if (bonusgame || specialstage)
{
// Bots should avoid
// Bots should avoid
p->spectator = true;
}
*/

View file

@ -2515,7 +2515,7 @@ void T_PolyObjFade(polyfade_t *th)
if (th->timer <= 0)
{
po->translucency = max(min(th->destvalue, NUMTRANSMAPS), 0);
po->translucency = max(min(th->destvalue, NUMTRANSLUCENTTRANSMAPS), 0);
// remove thinker
if (po->thinker == &th->thinker)
@ -2526,8 +2526,8 @@ void T_PolyObjFade(polyfade_t *th)
{
INT16 delta = abs(th->destvalue - th->sourcevalue);
INT32 duration = th->ticbased ? th->duration
: abs(FixedMul(FixedDiv(256, NUMTRANSMAPS), NUMTRANSMAPS - th->destvalue)
- FixedMul(FixedDiv(256, NUMTRANSMAPS), NUMTRANSMAPS - th->sourcevalue)); // speed-based internal counter duration: delta in 256 scale
: abs(FixedMul(FixedDiv(256, NUMTRANSLUCENTTRANSMAPS), NUMTRANSLUCENTTRANSMAPS - th->destvalue)
- FixedMul(FixedDiv(256, NUMTRANSLUCENTTRANSMAPS), NUMTRANSLUCENTTRANSMAPS - th->sourcevalue)); // speed-based internal counter duration: delta in 256 scale
fixed_t factor = min(FixedDiv(duration - th->timer, duration), 1*FRACUNIT);
if (th->destvalue < th->sourcevalue)
po->translucency = max(min(po->translucency, th->sourcevalue - (INT16)FixedMul(delta, factor)), th->destvalue);
@ -2538,7 +2538,7 @@ void T_PolyObjFade(polyfade_t *th)
if (!stillfading)
{
// set render flags
if (po->translucency >= NUMTRANSMAPS) // invisible
if (po->translucency >= NUMTRANSLUCENTTRANSMAPS) // invisible
po->flags &= ~POF_RENDERALL;
else
po->flags |= (po->spawnflags & POF_RENDERALL);
@ -2561,8 +2561,8 @@ void T_PolyObjFade(polyfade_t *th)
}
else
{
if (po->translucency >= NUMTRANSMAPS)
// HACK: OpenGL renders fully opaque when >= NUMTRANSMAPS
if (po->translucency >= NUMTRANSLUCENTTRANSMAPS)
// HACK: OpenGL renders add/sub.opaque when >= NUMTRANSLUCENTTRANSMAPS
po->translucency = tr_trans90;
po->flags |= (po->spawnflags & POF_RENDERALL);
@ -2630,8 +2630,8 @@ boolean EV_DoPolyObjFade(polyfadedata_t *pfdata)
else
{
th->ticbased = false;
th->timer = abs(FixedMul(FixedDiv(256, NUMTRANSMAPS), NUMTRANSMAPS - th->destvalue)
- FixedMul(FixedDiv(256, NUMTRANSMAPS), NUMTRANSMAPS - th->sourcevalue)); // delta converted to 256 scale, use as internal counter
th->timer = abs(FixedMul(FixedDiv(256, NUMTRANSLUCENTTRANSMAPS), NUMTRANSLUCENTTRANSMAPS - th->destvalue)
- FixedMul(FixedDiv(256, NUMTRANSLUCENTTRANSMAPS), NUMTRANSLUCENTTRANSMAPS - th->sourcevalue)); // delta converted to 256 scale, use as internal counter
th->duration = abs(pfdata->speed); // use th->duration as speed decrement
}

View file

@ -101,7 +101,8 @@ typedef enum
tr_trans70,
tr_trans80,
tr_trans90,
tr_transadd,
NUMTRANSLUCENTTRANSMAPS,
tr_transadd = NUMTRANSLUCENTTRANSMAPS,
tr_transsub,
NUMTRANSMAPS
} transnum_t;

View file

@ -3381,7 +3381,7 @@ static void P_InitLevelSettings(void)
// song credit init
memset(&cursongcredit,0,sizeof(struct cursongcredit));
cursongcredit.trans = NUMTRANSMAPS;
cursongcredit.trans = NUMTRANSLUCENTTRANSMAPS;
for (i = 0; i < MAXPLAYERS; i++)
{

View file

@ -1257,7 +1257,7 @@ static boolean PolyFade(line_t *line)
else
pfd.destvalue = value;
pfd.destvalue = max(min(pfd.destvalue, NUMTRANSMAPS), 0);
pfd.destvalue = max(min(pfd.destvalue, NUMTRANSLUCENTTRANSMAPS), 0);
// already equal, nothing to do
if (po->translucency == pfd.destvalue)

View file

@ -1800,7 +1800,7 @@ void S_ShowMusicCredit(void)
cursongcredit.def = def;
cursongcredit.anim = 5*TICRATE;
cursongcredit.x = 0;
cursongcredit.trans = NUMTRANSMAPS;
cursongcredit.trans = NUMTRANSLUCENTTRANSMAPS;
return;
}
else