mirror of
https://git.do.srb2.org/STJr/SRB2.git
synced 2024-11-22 04:21:23 +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)
|
//if (tics > durs)
|
||||||
//durs = tics;
|
//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;
|
INT32 blendmode;
|
||||||
if (spr->mobj->frame & FF_BLENDMASK)
|
if (spr->mobj->frame & FF_BLENDMASK)
|
||||||
blendmode = ((spr->mobj->frame & FF_BLENDMASK) >> FF_BLENDSHIFT) + 1;
|
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.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
|
// don't forget to enable the depth test because we can't do this
|
||||||
// like before: model polygons are not sorted
|
// like before: model polygons are not sorted
|
||||||
|
|
||||||
|
|
|
@ -1990,7 +1990,7 @@ static void SaveMobjThinker(const thinker_t *th, const UINT8 type)
|
||||||
diff2 |= MD2_DONTDRAWFORVIEWMOBJ;
|
diff2 |= MD2_DONTDRAWFORVIEWMOBJ;
|
||||||
if (mobj->dispoffset != mobj->info->dispoffset)
|
if (mobj->dispoffset != mobj->info->dispoffset)
|
||||||
diff2 |= MD2_DISPOFFSET;
|
diff2 |= MD2_DISPOFFSET;
|
||||||
if (mobj->alpha < FRACUNIT)
|
if (mobj->alpha != FRACUNIT)
|
||||||
diff2 |= MD2_ALPHA;
|
diff2 |= MD2_ALPHA;
|
||||||
|
|
||||||
if (diff2 != 0)
|
if (diff2 != 0)
|
||||||
|
|
|
@ -992,12 +992,10 @@ UINT8 *R_GetTranslationForThing(mobj_t *mobj, skincolornum_t color, UINT16 trans
|
||||||
return NULL;
|
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;
|
return (20*(FRACUNIT - ((alpha * (10 - transmap))/10) - 1) + FRACUNIT) >> (FRACBITS+1);
|
||||||
value = 10 - (FixedCeil(alpha * value)>>FRACBITS);
|
|
||||||
|
|
||||||
return value;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
//
|
//
|
||||||
|
@ -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);
|
floordiff = abs((isflipped ? interp.height : 0) + interp.z - groundz);
|
||||||
|
|
||||||
trans = floordiff / (100*FRACUNIT) + 3;
|
trans = floordiff / (100*FRACUNIT) + 3;
|
||||||
trans = R_GetTransmapFromAlpha(thing->alpha, trans);
|
trans = R_GetThingTransTable(thing->alpha, trans);
|
||||||
if (trans >= 9) return;
|
if (trans >= 9) return;
|
||||||
|
|
||||||
scalemul = FixedMul(FRACUNIT - floordiff/640, scale);
|
scalemul = FixedMul(FRACUNIT - floordiff/640, scale);
|
||||||
|
@ -2194,9 +2192,9 @@ static void R_ProjectSprite(mobj_t *thing)
|
||||||
trans = 0;
|
trans = 0;
|
||||||
|
|
||||||
if ((oldthing->flags2 & MF2_LINKDRAW) && oldthing->tracer)
|
if ((oldthing->flags2 & MF2_LINKDRAW) && oldthing->tracer)
|
||||||
trans = R_GetTransmapFromAlpha(oldthing->tracer->alpha, trans);
|
trans = R_GetThingTransTable(oldthing->tracer->alpha, trans);
|
||||||
else
|
else
|
||||||
trans = R_GetTransmapFromAlpha(oldthing->alpha, trans);
|
trans = R_GetThingTransTable(oldthing->alpha, trans);
|
||||||
|
|
||||||
// Check if this sprite needs to be rendered like a shadow
|
// Check if this sprite needs to be rendered like a shadow
|
||||||
shadowdraw = (!!(thing->renderflags & RF_SHADOWDRAW) && !(papersprite || splat));
|
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->sprite == SPR_NULL) || // Don't draw null-sprites
|
||||||
(thing->flags2 & MF2_DONTDRAW) || // Don't draw MF2_LINKDRAW objects
|
(thing->flags2 & MF2_DONTDRAW) || // Don't draw MF2_LINKDRAW objects
|
||||||
(thing->drawonlyforplayer && thing->drawonlyforplayer != viewplayer) || // Don't draw other players' personal 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) ||
|
(!R_BlendLevelVisible(thing->blendmode, R_GetThingTransTable(thing->alpha, 0))) ||
|
||||||
(rendermode == render_opengl && thing->alpha == 0)) ||
|
|
||||||
(!P_MobjWasRemoved(r_viewmobj) && (
|
(!P_MobjWasRemoved(r_viewmobj) && (
|
||||||
(r_viewmobj == thing) || // Don't draw first-person players or awayviewmobj objects
|
(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
|
(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);
|
boolean R_ThingIsFlashing (mobj_t *thing);
|
||||||
|
|
||||||
UINT8 *R_GetTranslationForThing(mobj_t *mobj, skincolornum_t color, UINT16 translation);
|
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);
|
void R_ThingOffsetOverlay (mobj_t *thing, fixed_t *outx, fixed_t *outy);
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue