mirror of
https://git.do.srb2.org/STJr/SRB2.git
synced 2024-11-22 12:31:32 +00:00
Make alpha use fixed_t and add alpha field to precipmobj_t
This commit is contained in:
parent
d18a4cca1e
commit
a76544a376
4 changed files with 11 additions and 10 deletions
|
@ -357,7 +357,7 @@ static int mobj_get(lua_State *L)
|
||||||
lua_pushinteger(L, mo->blendmode);
|
lua_pushinteger(L, mo->blendmode);
|
||||||
break;
|
break;
|
||||||
case mobj_alpha:
|
case mobj_alpha:
|
||||||
lua_pushinteger(L, mo->alpha);
|
lua_pushfixed(L, mo->alpha);
|
||||||
break;
|
break;
|
||||||
case mobj_bnext:
|
case mobj_bnext:
|
||||||
if (mo->blocknode && mo->blocknode->bnext) {
|
if (mo->blocknode && mo->blocknode->bnext) {
|
||||||
|
@ -740,7 +740,7 @@ static int mobj_set(lua_State *L)
|
||||||
}
|
}
|
||||||
case mobj_alpha:
|
case mobj_alpha:
|
||||||
{
|
{
|
||||||
INT32 alpha = (INT32)luaL_checkinteger(L, 3);
|
fixed_t alpha = luaL_checkfixed(L, 3);
|
||||||
if (alpha < 0)
|
if (alpha < 0)
|
||||||
alpha = 0;
|
alpha = 0;
|
||||||
else if (alpha > FRACUNIT)
|
else if (alpha > FRACUNIT)
|
||||||
|
|
|
@ -313,7 +313,7 @@ typedef struct mobj_s
|
||||||
|
|
||||||
UINT32 renderflags; // render flags
|
UINT32 renderflags; // render flags
|
||||||
INT32 blendmode; // blend mode
|
INT32 blendmode; // blend mode
|
||||||
UINT32 alpha; // alpha
|
fixed_t alpha; // alpha
|
||||||
fixed_t spritexscale, spriteyscale;
|
fixed_t spritexscale, spriteyscale;
|
||||||
fixed_t spritexoffset, spriteyoffset;
|
fixed_t spritexoffset, spriteyoffset;
|
||||||
fixed_t old_spritexscale, old_spriteyscale;
|
fixed_t old_spritexscale, old_spriteyscale;
|
||||||
|
@ -457,6 +457,7 @@ typedef struct precipmobj_s
|
||||||
|
|
||||||
UINT32 renderflags; // render flags
|
UINT32 renderflags; // render flags
|
||||||
INT32 blendmode; // blend mode
|
INT32 blendmode; // blend mode
|
||||||
|
fixed_t alpha; // alpha
|
||||||
fixed_t spritexscale, spriteyscale;
|
fixed_t spritexscale, spriteyscale;
|
||||||
fixed_t spritexoffset, spriteyoffset;
|
fixed_t spritexoffset, spriteyoffset;
|
||||||
fixed_t old_spritexscale, old_spriteyscale;
|
fixed_t old_spritexscale, old_spriteyscale;
|
||||||
|
|
|
@ -2174,7 +2174,7 @@ static void SaveMobjThinker(const thinker_t *th, const UINT8 type)
|
||||||
if (diff2 & MD2_TRANSLATION)
|
if (diff2 & MD2_TRANSLATION)
|
||||||
WRITEUINT16(save_p, mobj->translation);
|
WRITEUINT16(save_p, mobj->translation);
|
||||||
if (diff2 & MD2_ALPHA)
|
if (diff2 & MD2_ALPHA)
|
||||||
WRITEUINT32(save_p, mobj->alpha);
|
WRITEFIXED(save_p, mobj->alpha);
|
||||||
|
|
||||||
WRITEUINT32(save_p, mobj->mobjnum);
|
WRITEUINT32(save_p, mobj->mobjnum);
|
||||||
}
|
}
|
||||||
|
@ -3242,7 +3242,7 @@ static thinker_t* LoadMobjThinker(actionf_p1 thinker)
|
||||||
if (diff2 & MD2_TRANSLATION)
|
if (diff2 & MD2_TRANSLATION)
|
||||||
mobj->translation = READUINT16(save_p);
|
mobj->translation = READUINT16(save_p);
|
||||||
if (diff2 & MD2_ALPHA)
|
if (diff2 & MD2_ALPHA)
|
||||||
mobj->alpha = READUINT32(save_p);
|
mobj->alpha = READFIXED(save_p);
|
||||||
|
|
||||||
if (diff & MD_REDFLAG)
|
if (diff & MD_REDFLAG)
|
||||||
{
|
{
|
||||||
|
|
|
@ -1276,7 +1276,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_GetTransmapFromAlpha((UINT32)thing->alpha, trans);
|
||||||
if (trans >= 9) return;
|
if (trans >= 9) return;
|
||||||
|
|
||||||
scalemul = FixedMul(FRACUNIT - floordiff/640, scale);
|
scalemul = FixedMul(FRACUNIT - floordiff/640, scale);
|
||||||
|
@ -1963,9 +1963,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_GetTransmapFromAlpha((UINT32)oldthing->tracer->alpha, trans);
|
||||||
else
|
else
|
||||||
trans = R_GetTransmapFromAlpha(oldthing->alpha, trans);
|
trans = R_GetTransmapFromAlpha((UINT32)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));
|
||||||
|
@ -3428,7 +3428,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) ||
|
((rendermode == render_soft && R_GetTransmapFromAlpha((UINT32)thing->alpha, (thing->frame & FF_TRANSMASK)>>FF_TRANSSHIFT) >= 10) ||
|
||||||
(rendermode == render_opengl && 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
|
||||||
|
|
Loading…
Reference in a new issue