mirror of
https://git.do.srb2.org/KartKrew/Kart-Public.git
synced 2025-01-27 11:40:52 +00:00
Some minor cleanup for OpenGL sprite/MD2 code
This commit is contained in:
parent
965bd2f694
commit
af4c2fe391
2 changed files with 9 additions and 17 deletions
|
@ -3658,7 +3658,7 @@ static void HWR_DrawSpriteShadow(gr_vissprite_t *spr, GLPatch_t *gpatch, float t
|
||||||
/*if (spr->mobj->frame & FF_TRANSMASK || spr->mobj->flags2 & MF2_SHADOW)
|
/*if (spr->mobj->frame & FF_TRANSMASK || spr->mobj->flags2 & MF2_SHADOW)
|
||||||
{
|
{
|
||||||
sector_t *sector = spr->mobj->subsector->sector;
|
sector_t *sector = spr->mobj->subsector->sector;
|
||||||
UINT8 lightlevel = sector->lightlevel;
|
UINT8 lightlevel = 255;
|
||||||
extracolormap_t *colormap = sector->extra_colormap;
|
extracolormap_t *colormap = sector->extra_colormap;
|
||||||
|
|
||||||
if (sector->numlights)
|
if (sector->numlights)
|
||||||
|
@ -3667,8 +3667,6 @@ static void HWR_DrawSpriteShadow(gr_vissprite_t *spr, GLPatch_t *gpatch, float t
|
||||||
|
|
||||||
if (!(spr->mobj->frame & FF_FULLBRIGHT))
|
if (!(spr->mobj->frame & FF_FULLBRIGHT))
|
||||||
lightlevel = *sector->lightlist[light].lightlevel;
|
lightlevel = *sector->lightlist[light].lightlevel;
|
||||||
else
|
|
||||||
lightlevel = 255;
|
|
||||||
|
|
||||||
if (sector->lightlist[light].extra_colormap)
|
if (sector->lightlist[light].extra_colormap)
|
||||||
colormap = sector->lightlist[light].extra_colormap;
|
colormap = sector->lightlist[light].extra_colormap;
|
||||||
|
@ -3830,7 +3828,7 @@ static void HWR_DrawSprite(gr_vissprite_t *spr)
|
||||||
// colormap test
|
// colormap test
|
||||||
{
|
{
|
||||||
sector_t *sector = spr->mobj->subsector->sector;
|
sector_t *sector = spr->mobj->subsector->sector;
|
||||||
UINT8 lightlevel = sector->lightlevel;
|
UINT8 lightlevel = 255;
|
||||||
extracolormap_t *colormap = sector->extra_colormap;
|
extracolormap_t *colormap = sector->extra_colormap;
|
||||||
|
|
||||||
if (sector->numlights)
|
if (sector->numlights)
|
||||||
|
@ -3841,8 +3839,6 @@ static void HWR_DrawSprite(gr_vissprite_t *spr)
|
||||||
|
|
||||||
if (!(spr->mobj->frame & FF_FULLBRIGHT))
|
if (!(spr->mobj->frame & FF_FULLBRIGHT))
|
||||||
lightlevel = *sector->lightlist[light].lightlevel;
|
lightlevel = *sector->lightlist[light].lightlevel;
|
||||||
else
|
|
||||||
lightlevel = 255;
|
|
||||||
|
|
||||||
if (sector->lightlist[light].extra_colormap)
|
if (sector->lightlist[light].extra_colormap)
|
||||||
colormap = sector->lightlist[light].extra_colormap;
|
colormap = sector->lightlist[light].extra_colormap;
|
||||||
|
@ -3851,16 +3847,11 @@ static void HWR_DrawSprite(gr_vissprite_t *spr)
|
||||||
{
|
{
|
||||||
if (!(spr->mobj->frame & FF_FULLBRIGHT))
|
if (!(spr->mobj->frame & FF_FULLBRIGHT))
|
||||||
lightlevel = sector->lightlevel;
|
lightlevel = sector->lightlevel;
|
||||||
else
|
|
||||||
lightlevel = 255;
|
|
||||||
|
|
||||||
if (sector->extra_colormap)
|
if (sector->extra_colormap)
|
||||||
colormap = sector->extra_colormap;
|
colormap = sector->extra_colormap;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (spr->mobj->frame & FF_FULLBRIGHT)
|
|
||||||
lightlevel = 255;
|
|
||||||
|
|
||||||
if (colormap)
|
if (colormap)
|
||||||
Surf.FlatColor.rgba = HWR_Lighting(lightlevel, colormap->rgba, colormap->fadergba, false, false);
|
Surf.FlatColor.rgba = HWR_Lighting(lightlevel, colormap->rgba, colormap->fadergba, false, false);
|
||||||
else
|
else
|
||||||
|
|
|
@ -1082,6 +1082,12 @@ void HWR_DrawMD2(gr_vissprite_t *spr)
|
||||||
md2_t *md2;
|
md2_t *md2;
|
||||||
UINT8 color[4];
|
UINT8 color[4];
|
||||||
|
|
||||||
|
if (!cv_grmd2.value)
|
||||||
|
return;
|
||||||
|
|
||||||
|
if (!spr->precip)
|
||||||
|
return;
|
||||||
|
|
||||||
// MD2 colormap fix
|
// MD2 colormap fix
|
||||||
// colormap test
|
// colormap test
|
||||||
{
|
{
|
||||||
|
@ -1116,8 +1122,7 @@ void HWR_DrawMD2(gr_vissprite_t *spr)
|
||||||
Surf.FlatColor.rgba = HWR_Lighting(lightlevel, NORMALFOG, FADEFOG, false, false);
|
Surf.FlatColor.rgba = HWR_Lighting(lightlevel, NORMALFOG, FADEFOG, false, false);
|
||||||
}
|
}
|
||||||
|
|
||||||
// Look at HWR_ProjetctSprite for more
|
// Look at HWR_ProjectSprite for more
|
||||||
if (cv_grmd2.value && ((md2_models[spr->mobj->sprite].scale > 0.0f) || (md2_playermodels[(skin_t*)spr->mobj->skin-skins].scale > 0.0f)) && !spr->precip)
|
|
||||||
{
|
{
|
||||||
GLPatch_t *gpatch;
|
GLPatch_t *gpatch;
|
||||||
INT32 *buff;
|
INT32 *buff;
|
||||||
|
@ -1134,15 +1139,11 @@ void HWR_DrawMD2(gr_vissprite_t *spr)
|
||||||
//durs = tics;
|
//durs = tics;
|
||||||
|
|
||||||
if (spr->mobj->flags2 & MF2_SHADOW)
|
if (spr->mobj->flags2 & MF2_SHADOW)
|
||||||
{
|
|
||||||
Surf.FlatColor.s.alpha = 0x40;
|
Surf.FlatColor.s.alpha = 0x40;
|
||||||
}
|
|
||||||
else if (spr->mobj->frame & FF_TRANSMASK)
|
else if (spr->mobj->frame & FF_TRANSMASK)
|
||||||
HWR_TranstableToAlpha((spr->mobj->frame & FF_TRANSMASK)>>FF_TRANSSHIFT, &Surf);
|
HWR_TranstableToAlpha((spr->mobj->frame & FF_TRANSMASK)>>FF_TRANSSHIFT, &Surf);
|
||||||
else
|
else
|
||||||
{
|
|
||||||
Surf.FlatColor.s.alpha = 0xFF;
|
Surf.FlatColor.s.alpha = 0xFF;
|
||||||
}
|
|
||||||
|
|
||||||
// dont forget to enabled the depth test because we can't do this like
|
// dont forget to enabled the depth test because we can't do this like
|
||||||
// before: polygons models are not sorted
|
// before: polygons models are not sorted
|
||||||
|
|
Loading…
Reference in a new issue