mirror of
https://git.do.srb2.org/STJr/SRB2.git
synced 2024-11-21 20:11:12 +00:00
Implement Lactozilla's suggestions and add 3D model support
This commit is contained in:
parent
7c937a5dc0
commit
a19f843a3e
4 changed files with 16 additions and 12 deletions
|
@ -1286,6 +1286,11 @@ boolean HWR_DrawModel(gl_vissprite_t *spr)
|
|||
//if (tics > durs)
|
||||
//durs = tics;
|
||||
|
||||
// Make linkdraw objects use their tracer's alpha value
|
||||
fixed_t newalpha = spr->mobj->alpha;
|
||||
if ((spr->mobj->flags2 & MF2_LINKDRAW) && spr->mobj->tracer)
|
||||
newalpha = spr->mobj->tracer->alpha;
|
||||
|
||||
INT32 blendmode;
|
||||
if (spr->mobj->frame & FF_BLENDMASK)
|
||||
blendmode = ((spr->mobj->frame & FF_BLENDMASK) >> FF_BLENDSHIFT) + 1;
|
||||
|
@ -1300,6 +1305,8 @@ boolean HWR_DrawModel(gl_vissprite_t *spr)
|
|||
Surf.PolyFlags = HWR_GetBlendModeFlag(blendmode);
|
||||
}
|
||||
|
||||
Surf.PolyColor.s.alpha = FixedMul(newalpha, Surf.PolyColor.s.alpha);
|
||||
|
||||
// don't forget to enable the depth test because we can't do this
|
||||
// like before: model polygons are not sorted
|
||||
|
||||
|
|
|
@ -1990,7 +1990,7 @@ static void SaveMobjThinker(const thinker_t *th, const UINT8 type)
|
|||
diff2 |= MD2_DONTDRAWFORVIEWMOBJ;
|
||||
if (mobj->dispoffset != mobj->info->dispoffset)
|
||||
diff2 |= MD2_DISPOFFSET;
|
||||
if (mobj->alpha < FRACUNIT)
|
||||
if (mobj->alpha != FRACUNIT)
|
||||
diff2 |= MD2_ALPHA;
|
||||
|
||||
if (diff2 != 0)
|
||||
|
|
|
@ -992,12 +992,10 @@ UINT8 *R_GetTranslationForThing(mobj_t *mobj, skincolornum_t color, UINT16 trans
|
|||
return NULL;
|
||||
}
|
||||
|
||||
transnum_t R_GetTransmapFromAlpha(fixed_t alpha, transnum_t transmap)
|
||||
// Based off of R_GetLinedefTransTable
|
||||
transnum_t R_GetThingTransTable(fixed_t alpha, transnum_t transmap)
|
||||
{
|
||||
INT32 value = 10 - transmap;
|
||||
value = 10 - (FixedCeil(alpha * value)>>FRACBITS);
|
||||
|
||||
return value;
|
||||
return (20*(FRACUNIT - ((alpha * (10 - transmap))/10) - 1) + FRACUNIT) >> (FRACBITS+1);
|
||||
}
|
||||
|
||||
//
|
||||
|
@ -1505,7 +1503,7 @@ static void R_ProjectDropShadow(mobj_t *thing, vissprite_t *vis, fixed_t scale,
|
|||
floordiff = abs((isflipped ? interp.height : 0) + interp.z - groundz);
|
||||
|
||||
trans = floordiff / (100*FRACUNIT) + 3;
|
||||
trans = R_GetTransmapFromAlpha(thing->alpha, trans);
|
||||
trans = R_GetThingTransTable(thing->alpha, trans);
|
||||
if (trans >= 9) return;
|
||||
|
||||
scalemul = FixedMul(FRACUNIT - floordiff/640, scale);
|
||||
|
@ -2194,9 +2192,9 @@ static void R_ProjectSprite(mobj_t *thing)
|
|||
trans = 0;
|
||||
|
||||
if ((oldthing->flags2 & MF2_LINKDRAW) && oldthing->tracer)
|
||||
trans = R_GetTransmapFromAlpha(oldthing->tracer->alpha, trans);
|
||||
trans = R_GetThingTransTable(oldthing->tracer->alpha, trans);
|
||||
else
|
||||
trans = R_GetTransmapFromAlpha(oldthing->alpha, trans);
|
||||
trans = R_GetThingTransTable(oldthing->alpha, trans);
|
||||
|
||||
// Check if this sprite needs to be rendered like a shadow
|
||||
shadowdraw = (!!(thing->renderflags & RF_SHADOWDRAW) && !(papersprite || splat));
|
||||
|
@ -3658,8 +3656,7 @@ boolean R_ThingVisible (mobj_t *thing)
|
|||
(thing->sprite == SPR_NULL) || // Don't draw null-sprites
|
||||
(thing->flags2 & MF2_DONTDRAW) || // Don't draw MF2_LINKDRAW objects
|
||||
(thing->drawonlyforplayer && thing->drawonlyforplayer != viewplayer) || // Don't draw other players' personal objects
|
||||
((rendermode == render_soft && R_GetTransmapFromAlpha(thing->alpha, (thing->frame & FF_TRANSMASK)>>FF_TRANSSHIFT) >= 10) ||
|
||||
(rendermode == render_opengl && thing->alpha == 0)) ||
|
||||
(!R_BlendLevelVisible(thing->blendmode, R_GetThingTransTable(thing->alpha, 0))) ||
|
||||
(!P_MobjWasRemoved(r_viewmobj) && (
|
||||
(r_viewmobj == thing) || // Don't draw first-person players or awayviewmobj objects
|
||||
(r_viewmobj->player && r_viewmobj->player->followmobj == thing) || // Don't draw first-person players' followmobj
|
||||
|
|
|
@ -93,7 +93,7 @@ boolean R_ThingIsFullDark (mobj_t *thing);
|
|||
boolean R_ThingIsFlashing (mobj_t *thing);
|
||||
|
||||
UINT8 *R_GetTranslationForThing(mobj_t *mobj, skincolornum_t color, UINT16 translation);
|
||||
transnum_t R_GetTransmapFromAlpha(fixed_t alpha, transnum_t transmap);
|
||||
transnum_t R_GetThingTransTable(fixed_t alpha, transnum_t transmap);
|
||||
|
||||
void R_ThingOffsetOverlay (mobj_t *thing, fixed_t *outx, fixed_t *outy);
|
||||
|
||||
|
|
Loading…
Reference in a new issue