mirror of
https://git.do.srb2.org/STJr/SRB2.git
synced 2025-01-17 23:21:22 +00:00
Bug fixes
This commit is contained in:
parent
b872222b50
commit
b03d95c5c6
4 changed files with 40 additions and 18 deletions
|
@ -722,6 +722,8 @@ FBITFIELD HWR_GetBlendModeFlag(INT32 ast)
|
|||
|
||||
UINT8 HWR_GetTranstableAlpha(INT32 transtablenum)
|
||||
{
|
||||
transtablenum = max(min(transtablenum, tr_trans90), 0);
|
||||
|
||||
switch (transtablenum)
|
||||
{
|
||||
case 0 : return 0xff;
|
||||
|
@ -3787,7 +3789,12 @@ static void HWR_SplitSprite(gl_vissprite_t *spr)
|
|||
blend = HWR_GetBlendModeFlag(spr->mobj->blendmode);
|
||||
}
|
||||
else if (spr->mobj->frame & FF_TRANSMASK)
|
||||
blend = HWR_SurfaceBlend(spr->mobj->blendmode, (spr->mobj->frame & FF_TRANSMASK)>>FF_TRANSSHIFT, &Surf);
|
||||
{
|
||||
INT32 trans = (spr->mobj->frame & FF_TRANSMASK)>>FF_TRANSSHIFT;
|
||||
if (spr->mobj->blendmode == AST_TRANSLUCENT && trans >= NUMTRANSMAPS)
|
||||
return;
|
||||
blend = HWR_SurfaceBlend(spr->mobj->blendmode, trans, &Surf);
|
||||
}
|
||||
else
|
||||
{
|
||||
// BP: i agree that is little better in environement but it don't
|
||||
|
@ -4202,7 +4209,12 @@ static void HWR_DrawSprite(gl_vissprite_t *spr)
|
|||
blend = HWR_GetBlendModeFlag(spr->mobj->blendmode);
|
||||
}
|
||||
else if (spr->mobj->frame & FF_TRANSMASK)
|
||||
blend = HWR_SurfaceBlend(spr->mobj->blendmode, (spr->mobj->frame & FF_TRANSMASK)>>FF_TRANSSHIFT, &Surf);
|
||||
{
|
||||
INT32 trans = (spr->mobj->frame & FF_TRANSMASK)>>FF_TRANSSHIFT;
|
||||
if (spr->mobj->blendmode == AST_TRANSLUCENT && trans >= NUMTRANSMAPS)
|
||||
return;
|
||||
blend = HWR_SurfaceBlend(spr->mobj->blendmode, trans, &Surf);
|
||||
}
|
||||
else
|
||||
{
|
||||
// BP: i agree that is little better in environement but it don't
|
||||
|
@ -4317,7 +4329,12 @@ static inline void HWR_DrawPrecipitationSprite(gl_vissprite_t *spr)
|
|||
blend = HWR_GetBlendModeFlag(spr->mobj->blendmode);
|
||||
}
|
||||
else if (spr->mobj->frame & FF_TRANSMASK)
|
||||
blend = HWR_SurfaceBlend(spr->mobj->blendmode, (spr->mobj->frame & FF_TRANSMASK)>>FF_TRANSSHIFT, &Surf);
|
||||
{
|
||||
INT32 trans = (spr->mobj->frame & FF_TRANSMASK)>>FF_TRANSSHIFT;
|
||||
if (spr->mobj->blendmode == AST_TRANSLUCENT && trans >= NUMTRANSMAPS)
|
||||
return;
|
||||
blend = HWR_SurfaceBlend(spr->mobj->blendmode, trans, &Surf);
|
||||
}
|
||||
else
|
||||
{
|
||||
// BP: i agree that is little better in environement but it don't
|
||||
|
|
|
@ -1316,21 +1316,16 @@ boolean HWR_DrawModel(gl_vissprite_t *spr)
|
|||
//if (tics > durs)
|
||||
//durs = tics;
|
||||
|
||||
if (spr->mobj->flags2 & MF2_SHADOW)
|
||||
{
|
||||
Surf.PolyColor.s.alpha = 0x40;
|
||||
Surf.PolyFlags = HWR_GetBlendModeFlag(spr->mobj->blendmode);
|
||||
}
|
||||
else if (spr->mobj->frame & FF_TRANSMASK)
|
||||
if (spr->mobj->frame & FF_TRANSMASK)
|
||||
Surf.PolyFlags = HWR_SurfaceBlend(spr->mobj->blendmode, (spr->mobj->frame & FF_TRANSMASK)>>FF_TRANSSHIFT, &Surf);
|
||||
else
|
||||
{
|
||||
Surf.PolyColor.s.alpha = 0xFF;
|
||||
Surf.PolyFlags = 0;
|
||||
Surf.PolyColor.s.alpha = (spr->mobj->flags2 & MF2_SHADOW) ? 0x40 : 0xff;
|
||||
Surf.PolyFlags = HWR_GetBlendModeFlag(spr->mobj->blendmode);
|
||||
}
|
||||
|
||||
// dont forget to enabled the depth test because we can't do this like
|
||||
// before: polygons models are not sorted
|
||||
// don't forget to enable the depth test because we can't do this
|
||||
// like before: model polygons are not sorted
|
||||
|
||||
// 1. load model+texture if not already loaded
|
||||
// 2. draw model with correct position, rotation,...
|
||||
|
|
|
@ -2600,6 +2600,7 @@ static void DrawModelEx(model_t *model, INT32 frameIndex, INT32 duration, INT32
|
|||
|
||||
boolean useVBO = true;
|
||||
|
||||
FBITFIELD flags;
|
||||
int i;
|
||||
|
||||
// Because otherwise, scaling the screen negatively vertically breaks the lighting
|
||||
|
@ -2667,8 +2668,6 @@ static void DrawModelEx(model_t *model, INT32 frameIndex, INT32 duration, INT32
|
|||
else
|
||||
pglColor4ubv((GLubyte*)&Surface->PolyColor.s);
|
||||
|
||||
SetBlend((poly.alpha < 1 ? Surface->PolyFlags : (PF_Masked|PF_Occlude))|PF_Modulated);
|
||||
|
||||
tint.red = byte2float[Surface->TintColor.s.red];
|
||||
tint.green = byte2float[Surface->TintColor.s.green];
|
||||
tint.blue = byte2float[Surface->TintColor.s.blue];
|
||||
|
@ -2679,6 +2678,13 @@ static void DrawModelEx(model_t *model, INT32 frameIndex, INT32 duration, INT32
|
|||
fade.blue = byte2float[Surface->FadeColor.s.blue];
|
||||
fade.alpha = byte2float[Surface->FadeColor.s.alpha];
|
||||
|
||||
flags = (Surface->PolyFlags | PF_Modulated);
|
||||
if (Surface->PolyFlags & (PF_Additive|PF_AdditiveSource|PF_Subtractive|PF_ReverseSubtract|PF_Multiplicative))
|
||||
flags |= PF_Occlude;
|
||||
else if (Surface->PolyColor.s.alpha == 0xFF)
|
||||
flags |= (PF_Occlude | PF_Masked);
|
||||
|
||||
SetBlend(flags);
|
||||
Shader_Load(Surface, &poly, &tint, &fade);
|
||||
|
||||
pglEnable(GL_CULL_FACE);
|
||||
|
|
|
@ -1802,7 +1802,11 @@ static void R_ProjectSprite(mobj_t *thing)
|
|||
if (oldthing->flags2 & MF2_SHADOW || thing->flags2 & MF2_SHADOW) // actually only the player should use this (temporary invisibility)
|
||||
trans = tr_trans80; // because now the translucency is set through FF_TRANSMASK
|
||||
else if (oldthing->frame & FF_TRANSMASK)
|
||||
{
|
||||
trans = (oldthing->frame & FF_TRANSMASK) >> FF_TRANSSHIFT;
|
||||
if (oldthing->blendmode == AST_TRANSLUCENT && trans >= NUMTRANSMAPS)
|
||||
return;
|
||||
}
|
||||
else
|
||||
trans = 0;
|
||||
|
||||
|
@ -1834,7 +1838,7 @@ static void R_ProjectSprite(mobj_t *thing)
|
|||
else
|
||||
trans += 3;
|
||||
|
||||
if (trans >= 9)
|
||||
if (trans >= NUMTRANSMAPS)
|
||||
return;
|
||||
|
||||
trans--;
|
||||
|
@ -2007,8 +2011,8 @@ static void R_ProjectSprite(mobj_t *thing)
|
|||
vis->scale += FixedMul(scalestep, spriteyscale) * (vis->x1 - x1);
|
||||
}
|
||||
|
||||
if ((thing->blendmode != AST_COPY) && cv_translucency.value)
|
||||
vis->transmap = R_GetBlendTable(thing->blendmode, trans);
|
||||
if ((oldthing->blendmode != AST_COPY) && cv_translucency.value)
|
||||
vis->transmap = R_GetBlendTable(oldthing->blendmode, trans);
|
||||
else
|
||||
vis->transmap = NULL;
|
||||
|
||||
|
|
Loading…
Reference in a new issue