From dc453fbbda15f6a40bdac3f9455dad44f8f0bfbd Mon Sep 17 00:00:00 2001 From: Sryder Date: Sun, 25 Oct 2020 23:19:20 +0000 Subject: [PATCH] Fix various things that used NUMTRANSMAPS for the number of translucent trans maps --- src/dehacked.c | 1 + src/hu_stuff.c | 10 +++++----- src/k_battle.c | 4 ++-- src/p_mobj.c | 22 +++++++++++----------- src/p_polyobj.c | 16 ++++++++-------- src/p_pspr.h | 3 ++- src/p_setup.c | 2 +- src/p_spec.c | 2 +- src/s_sound.c | 2 +- 9 files changed, 32 insertions(+), 30 deletions(-) diff --git a/src/dehacked.c b/src/dehacked.c index 9bd84fdbc..6268aca86 100644 --- a/src/dehacked.c +++ b/src/dehacked.c @@ -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}, diff --git a/src/hu_stuff.c b/src/hu_stuff.c index 35f977bd6..93192d796 100644 --- a/src/hu_stuff.c +++ b/src/hu_stuff.c @@ -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<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); diff --git a/src/p_mobj.c b/src/p_mobj.c index be907321e..25cb1bf8c 100644 --- a/src/p_mobj.c +++ b/src/p_mobj.c @@ -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; } */ diff --git a/src/p_polyobj.c b/src/p_polyobj.c index eff28e21d..6b6d7d588 100644 --- a/src/p_polyobj.c +++ b/src/p_polyobj.c @@ -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 } diff --git a/src/p_pspr.h b/src/p_pspr.h index cbc1a845f..ee82ade6a 100644 --- a/src/p_pspr.h +++ b/src/p_pspr.h @@ -101,7 +101,8 @@ typedef enum tr_trans70, tr_trans80, tr_trans90, - tr_transadd, + NUMTRANSLUCENTTRANSMAPS, + tr_transadd = NUMTRANSLUCENTTRANSMAPS, tr_transsub, NUMTRANSMAPS } transnum_t; diff --git a/src/p_setup.c b/src/p_setup.c index 50f39c5fa..df4fec9c8 100644 --- a/src/p_setup.c +++ b/src/p_setup.c @@ -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++) { diff --git a/src/p_spec.c b/src/p_spec.c index 34a962975..2435e964d 100644 --- a/src/p_spec.c +++ b/src/p_spec.c @@ -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) diff --git a/src/s_sound.c b/src/s_sound.c index 197e65e57..302a352a7 100644 --- a/src/s_sound.c +++ b/src/s_sound.c @@ -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