diff --git a/src/d_main.c b/src/d_main.c index 9197f2e65..2df283550 100644 --- a/src/d_main.c +++ b/src/d_main.c @@ -824,7 +824,7 @@ void D_SRB2Loop(void) if (interp) { - renderdeltatics = FLOAT_TO_FIXED(deltatics); + renderdeltatics = DoubleToFixed(deltatics); if (!(paused || P_AutoPause()) && deltatics < 1.0 && !hu_stopped) { @@ -877,7 +877,7 @@ void D_SRB2Loop(void) // Use the time before sleep for frameskip calculations: // post-sleep time is literally being intentionally wasted - deltasecs = (double)((INT64)(finishprecise - enterprecise)) / I_GetPrecisePrecision(); + deltasecs = (double)(finishprecise - enterprecise) / I_GetPrecisePrecision(); deltatics = deltasecs * NEWTICRATE; // If time spent this game loop exceeds a single tic, @@ -911,7 +911,7 @@ void D_SRB2Loop(void) } // Capture the time once more to get the real delta time. finishprecise = I_GetPreciseTime(); - deltasecs = (double)((INT64)(finishprecise - enterprecise)) / I_GetPrecisePrecision(); + deltasecs = (double)(finishprecise - enterprecise) / I_GetPrecisePrecision(); deltatics = deltasecs * NEWTICRATE; } } diff --git a/src/hardware/hw_draw.c b/src/hardware/hw_draw.c index 14a7c479d..ab88e602f 100644 --- a/src/hardware/hw_draw.c +++ b/src/hardware/hw_draw.c @@ -638,7 +638,11 @@ void HWR_DrawConsoleBack(UINT32 color, INT32 height) Surf.PolyColor.rgba = UINT2RGBA(color); Surf.PolyColor.s.alpha = 0x80; - GL_DrawPolygon(&Surf, v, 4, PF_NoTexture|PF_Modulated|PF_Translucent|PF_NoDepthTest); + int flags = PF_NoTexture|PF_Modulated|PF_NoDepthTest; + + flags |= HWR_GetBlendModeFlag(((B_MODULATE & V_BLENDMASK) >> V_BLENDSHIFT)+1); + + GL_DrawPolygon(&Surf, v, 4, flags); } diff --git a/src/i_time.c b/src/i_time.c index a1ef580bd..ee6fe7f68 100644 --- a/src/i_time.c +++ b/src/i_time.c @@ -58,7 +58,7 @@ void I_UpdateTime(fixed_t timescale) tic_t realtics; // get real tics - ticratescaled = (double)TICRATE * FIXED_TO_FLOAT(timescale); + ticratescaled = (double)TICRATE * FixedToDouble(timescale); enterprecise = I_GetPreciseTime(); elapsedseconds = (double)(enterprecise - oldenterprecise) / I_GetPrecisePrecision(); @@ -77,6 +77,6 @@ void I_UpdateTime(fixed_t timescale) { double fractional, integral; fractional = modf(tictimer * ticratescaled, &integral); - g_time.timefrac = FLOAT_TO_FIXED(fractional); + g_time.timefrac = DoubleToFixed(fractional); } } diff --git a/src/k_kart.c b/src/k_kart.c index c1af69df7..a00b3cdc5 100644 --- a/src/k_kart.c +++ b/src/k_kart.c @@ -1713,8 +1713,8 @@ void K_KartBouncing(mobj_t *mobj1, mobj_t *mobj2, boolean bounce, boolean solid) fx->eflags |= MFE_VERTICALFLIP; else fx->eflags &= ~MFE_VERTICALFLIP; - fx->lightlevel = M_RandomRange(200, 255); - fx->frame |= FF_ABSOLUTELIGHTLEVEL; + //fx->lightlevel = M_RandomRange(200, 255); + //fx->frame |= FF_ABSOLUTELIGHTLEVEL; fx->blendmode = AST_ADD; P_SetScale(fx, mobj1->scale); @@ -3725,8 +3725,8 @@ void K_SpawnSparkleTrail(mobj_t *mo) sparkle->color = mo->color; - sparkle->lightlevel = M_RandomRange(200, 255); - sparkle->frame |= FF_ABSOLUTELIGHTLEVEL; + //sparkle->lightlevel = M_RandomRange(200, 255); + //sparkle->frame |= FF_ABSOLUTELIGHTLEVEL; sparkle->blendmode = AST_ADD; } @@ -3867,8 +3867,8 @@ void K_DriftDustHandling(mobj_t *spawner) else dust->color = SKINCOLOR_SILVER; // fallback - dust->lightlevel = M_RandomRange(200, 255); - dust->frame |= FF_ABSOLUTELIGHTLEVEL; + //dust->lightlevel = M_RandomRange(200, 255); + //dust->frame |= FF_ABSOLUTELIGHTLEVEL; dust->blendmode = AST_ADD; } else @@ -5568,8 +5568,8 @@ static inline void K_SpawnNormalSpeedLines(player_t *player, boolean synched) } } - fast->lightlevel = M_RandomRange(200, 255); - fast->frame |= FF_ABSOLUTELIGHTLEVEL; + //fast->lightlevel = M_RandomRange(200, 255); + //fast->frame |= FF_ABSOLUTELIGHTLEVEL; fast->blendmode = AST_ADD; } @@ -9058,7 +9058,7 @@ static void K_DrawKartPositionNum(INT32 num) INT32 W = SHORT(kp_positionnum[0][0]->width); fixed_t scale = FRACUNIT; patch_t *localpatch = kp_positionnum[0][0]; - INT32 addOrSub = B_ADD; + INT32 addOrSub = B_SUBTRACT; //INT32 splitflags = K_calcSplitFlags(V_SNAPTOBOTTOM|V_SNAPTORIGHT); INT32 fx = 0, fy = 0, fflags = 0; INT32 xoffs = wheeloffs ? -48 : 0; @@ -9068,7 +9068,7 @@ static void K_DrawKartPositionNum(INT32 num) if ((mapheaderinfo[gamemap - 1]->levelflags & LF_SUBTRACTNUM) == LF_SUBTRACTNUM) { - addOrSub = B_SUBTRACT; + addOrSub = B_ADD; } if ((cv_posanim.value && stplyr->kartstuff[k_positiondelay]) || stplyr->exiting) diff --git a/src/m_fixed.h b/src/m_fixed.h index 3f1acd7ae..8962003ce 100644 --- a/src/m_fixed.h +++ b/src/m_fixed.h @@ -49,6 +49,16 @@ FUNCMATH FUNCINLINE static ATTRINLINE fixed_t FloatToFixed(float f) return (fixed_t)(f * FRACUNIT); } +FUNCMATH FUNCINLINE static ATTRINLINE float FixedToDouble(fixed_t x) +{ + return x / (double)FRACUNIT; +} + +FUNCMATH FUNCINLINE static ATTRINLINE fixed_t DoubleToFixed(double f) +{ + return (fixed_t)(f * FRACUNIT); +} + // for backwards compat #define FIXED_TO_FLOAT(x) FixedToFloat(x) // (((float)(x)) / ((float)FRACUNIT)) #define FLOAT_TO_FIXED(f) FloatToFixed(f) // (fixed_t)((f) * ((float)FRACUNIT)) diff --git a/src/p_pspr.h b/src/p_pspr.h index 89f6c1108..4301e912d 100644 --- a/src/p_pspr.h +++ b/src/p_pspr.h @@ -46,6 +46,7 @@ #define FF_BLENDMASK 0x7000 /// \brief shift for FF_BLENDMASK #define FF_BLENDSHIFT 12 + /// \brief preshifted blend flags minus 1 as effects don't distinguish between AST_COPY and AST_TRANSLUCENT #define FF_ADD ((AST_ADD-1)<= AST_OVERLAY) return NULL; offs = (ClipBlendLevel(style, alphalevel) << FF_TRANSSHIFT); @@ -412,7 +412,7 @@ UINT8 *R_GetBlendTable(int style, INT32 alphalevel) boolean R_BlendLevelVisible(INT32 blendmode, INT32 alphalevel) { - if (blendmode == AST_COPY || blendmode == AST_SUBTRACT || blendmode == AST_MODULATE || blendmode == AST_OVERLAY) + if (blendmode <= AST_COPY || blendmode == AST_SUBTRACT || blendmode == AST_MODULATE || blendmode >= AST_OVERLAY) return true; return (alphalevel < BlendTab_Count[BlendTab_FromStyle[blendmode]]);