diff --git a/src/hardware/hw_main.cpp b/src/hardware/hw_main.cpp index 01433edd0..dbec25d29 100644 --- a/src/hardware/hw_main.cpp +++ b/src/hardware/hw_main.cpp @@ -3733,7 +3733,7 @@ static void HWR_SplitSprite(gl_vissprite_t *spr, const boolean papersprite) wallVerts[1].z = baseWallVerts[2].z + (baseWallVerts[2].z - baseWallVerts[1].z) * heightmult; } - HWR_Lighting(&Surf, lightlevel, colormap, P_SectorUsesDirectionalLighting(sector) && !(sprmo->frame & FF_FULLBRIGHT)); + HWR_Lighting(&Surf, lightlevel, colormap, P_SectorUsesDirectionalLighting(sector) && !R_ThingIsFullBright(sprmo)); Surf.PolyColor.s.alpha = alpha; @@ -3787,7 +3787,7 @@ static void HWR_DrawSprite(gl_vissprite_t *spr) if (!sprmo->subsector) return; - const boolean papersprite = (sprmo->frame & FF_PAPERSPRITE); + const boolean papersprite = R_ThingIsPaperSprite(sprmo); const sector_t *sector = sprmo->subsector->sector; if (sector->numlights) @@ -3946,7 +3946,7 @@ static void HWR_DrawPrecipitationSprite(gl_vissprite_t *spr) INT32 shader = SHADER_NONE; - const precipmobj_t *sprmo = spr->precip; + precipmobj_t *sprmo = spr->precip; if (!sprmo->subsector) return; @@ -3992,11 +3992,10 @@ static void HWR_DrawPrecipitationSprite(gl_vissprite_t *spr) if (sector->numlights) { - INT32 light; + // Always use the light at the top instead of whatever I was doing before + INT32 light = R_GetPlaneLight(sector, sprmo->z, false); // sprmo->z + sprmo->height - light = R_GetPlaneLight(sector, sprmo->z, false); // Always use the light at the top instead of whatever I was doing before - - if (!(sprmo->frame & FF_FULLBRIGHT)) + if (!R_PrecipThingIsFullBright(sprmo)) lightlevel = static_cast(*sector->lightlist[light].lightlevel); if (sector->lightlist[light].extra_colormap) @@ -4004,7 +4003,7 @@ static void HWR_DrawPrecipitationSprite(gl_vissprite_t *spr) } else { - if (!(sprmo->frame & FF_FULLBRIGHT)) + if (!R_PrecipThingIsFullBright(sprmo)) lightlevel = static_cast(sector->lightlevel); if (sector->extra_colormap) @@ -4588,7 +4587,7 @@ static void HWR_ProjectSprite(mobj_t *thing) return; } - const boolean papersprite = (thing->frame & FF_PAPERSPRITE); + const boolean papersprite = R_ThingIsPaperSprite(thing); // transform the origin point tr_x = FixedToFloat(interp.x); @@ -4602,8 +4601,8 @@ static void HWR_ProjectSprite(mobj_t *thing) return; const boolean mirrored = thing->mirrored; - const boolean vflip = (thing->eflags & MFE_VERTICALFLIP); - const boolean hflip = (!(thing->frame & FF_HORIZONTALFLIP) != !mirrored); + const boolean vflip = R_ThingVerticallyFlipped(thing); + const boolean hflip = (!R_ThingHorizontallyFlipped(thing) != !mirrored); // decide which patch to use for sprite relative to player #ifdef RANGECHECK diff --git a/src/hardware/hw_md2.c b/src/hardware/hw_md2.c index 4cb8a0a51..0f8328041 100644 --- a/src/hardware/hw_md2.c +++ b/src/hardware/hw_md2.c @@ -1153,8 +1153,11 @@ void HWR_DrawMD2(gl_vissprite_t *spr) INT32 durs = spr->mobj->state->tics; INT32 tics = spr->mobj->tics; //mdlframe_t *next = NULL; + + //const UINT8 flip = (UINT8)(!(spr->mobj->eflags & MFE_VERTICALFLIP) != !R_ThingVerticallyFlipped(spr->mobj)); // :chaosleep: const UINT8 flip = (UINT8)((spr->mobj->eflags & MFE_VERTICALFLIP) == MFE_VERTICALFLIP); - const UINT8 hflip = (UINT8)(!(spr->mobj->mirrored) != !(spr->mobj->frame & FF_HORIZONTALFLIP)); + const UINT8 hflip = (UINT8)(!(spr->mobj->mirrored) != !R_ThingHorizontallyFlipped(spr->mobj)); + spritedef_t *sprdef; spriteframe_t *sprframe; spriteinfo_t *sprinfo; diff --git a/src/r_main.cpp b/src/r_main.cpp index 038fa8a6a..d2b6eed65 100644 --- a/src/r_main.cpp +++ b/src/r_main.cpp @@ -411,7 +411,7 @@ angle_t R_PlayerSliptideAngle(player_t *player) if (!sprframe) return 0; - if (sprframe->rotate != SRF_SINGLE || (mo->frame & FF_PAPERSPRITE)) + if (sprframe->rotate != SRF_SINGLE || R_ThingIsPaperSprite(mo)) ang = R_PointToAngle(mo->x, mo->y) - mo->angle; return FixedMul(FINECOSINE((ang) >> ANGLETOFINESHIFT), mo->player->sliproll * mo->player->kartstuff[k_aizdriftstrat]); diff --git a/src/r_things.cpp b/src/r_things.cpp index 951e6c094..44dc14929 100644 --- a/src/r_things.cpp +++ b/src/r_things.cpp @@ -1241,9 +1241,9 @@ static void R_ProjectSprite(mobj_t *thing) return; const boolean mirrored = thing->mirrored; - const boolean vflip = (thing->eflags & MFE_VERTICALFLIP); - const boolean hflip = (!(thing->frame & FF_HORIZONTALFLIP) != !mirrored); - const boolean papersprite = (thing->frame & FF_PAPERSPRITE); + const boolean vflip = R_ThingVerticallyFlipped(thing); + const boolean hflip = (!R_ThingHorizontallyFlipped(thing) != !mirrored); + const boolean papersprite = R_ThingIsPaperSprite(thing); // transform the origin point tr_x = interp.x - viewx; @@ -3030,11 +3030,37 @@ boolean R_CheckMobjInterpDist(mobj_t *thing) return R_CheckInterpDist(thing); } -boolean R_ThingIsFullBright(mobj_t *thing) +boolean R_ThingHorizontallyFlipped(mobj_t *thing) +{ + return (thing->frame & FF_HORIZONTALFLIP); +} + +boolean R_ThingVerticallyFlipped(mobj_t *thing) +{ + return (thing->eflags & MFE_VERTICALFLIP); //(thing->frame & FF_VERTICALFLIP); +} + +boolean R_ThingIsPaperSprite(mobj_t *thing) +{ + return (thing->frame & FF_PAPERSPRITE); +} + +template +boolean R_ThingIsFullBrightT(T *thing) { return ((thing->frame & FF_BRIGHTMASK) == FF_FULLBRIGHT); } +boolean R_PrecipThingIsFullBright(precipmobj_t *thing) +{ + return R_ThingIsFullBrightT(thing); +} + +boolean R_ThingIsFullBright(mobj_t *thing) +{ + return R_ThingIsFullBrightT(thing); +} + boolean R_ThingIsSemiBright(mobj_t *thing) { return ((thing->frame & FF_BRIGHTMASK) == FF_SEMIBRIGHT); diff --git a/src/r_things.h b/src/r_things.h index e8e30ca6b..bde0ad592 100644 --- a/src/r_things.h +++ b/src/r_things.h @@ -88,6 +88,11 @@ boolean R_CheckPrecipMobjInterpDist(precipmobj_t *thing); boolean R_CheckMobjInterpDist(mobj_t *thing); fixed_t R_DoPlayerFade(mobj_t *thing); +boolean R_ThingHorizontallyFlipped(mobj_t *thing); +boolean R_ThingVerticallyFlipped(mobj_t *thing); +boolean R_ThingIsPaperSprite(mobj_t *thing); + +boolean R_PrecipThingIsFullBright(precipmobj_t *thing); boolean R_ThingIsFullBright(mobj_t *thing); boolean R_ThingIsSemiBright(mobj_t *thing); boolean R_ThingIsFullDark(mobj_t *thing);