Commit cc97e22e by Jaime Ita Passos

Changes to sprite rendering:

- Added render flags (see r_defs.h) - Implemented floor splats - Drop shadow sprite rendering through render flags
parent b808b3ef
......@@ -648,12 +648,15 @@ static inline void resynch_write_player(resynch_pak *rsp, const size_t i)
rsp->eflags = (UINT16)SHORT(players[i].mo->eflags);
rsp->flags = LONG(players[i].mo->flags);
rsp->flags2 = LONG(players[i].mo->flags2);
rsp->renderflags = LONG(players[i].mo->renderflags);
rsp->radius = LONG(players[i].mo->radius);
rsp->height = LONG(players[i].mo->height);
rsp->scale = LONG(players[i].mo->scale);
rsp->destscale = LONG(players[i].mo->destscale);
rsp->scalespeed = LONG(players[i].mo->scalespeed);
rsp->spritexscale = LONG(players[i].mo->spritexscale);
rsp->spriteyscale = LONG(players[i].mo->spriteyscale);
}
static void resynch_read_player(resynch_pak *rsp)
......@@ -787,6 +790,7 @@ static void resynch_read_player(resynch_pak *rsp)
players[i].mo->eflags = (UINT16)SHORT(rsp->eflags);
players[i].mo->flags = LONG(rsp->flags);
players[i].mo->flags2 = LONG(rsp->flags2);
players[i].mo->renderflags = LONG(rsp->renderflags);
players[i].mo->friction = LONG(rsp->friction);
players[i].mo->health = LONG(rsp->health);
players[i].mo->momx = LONG(rsp->momx);
......@@ -813,6 +817,8 @@ static void resynch_read_player(resynch_pak *rsp)
players[i].mo->scale = LONG(rsp->scale);
players[i].mo->destscale = LONG(rsp->destscale);
players[i].mo->scalespeed = LONG(rsp->scalespeed);
players[i].mo->spritexscale = LONG(rsp->spritexscale);
players[i].mo->spriteyscale = LONG(rsp->spriteyscale);
// And finally, SET THE MOBJ SKIN damn it.
if ((players[i].powers[pw_carry] == CR_NIGHTSMODE) && (skins[players[i].skin].sprites[SPR2_NFLY].numframes == 0))
......
......@@ -293,12 +293,15 @@ typedef struct
UINT32 flags;
UINT32 flags2;
UINT16 eflags;
UINT32 renderflags;
fixed_t radius;
fixed_t height;
fixed_t scale;
fixed_t destscale;
fixed_t scalespeed;
fixed_t spritexscale;
fixed_t spriteyscale;
} ATTRPACK resynch_pak;
typedef struct
......
......@@ -671,10 +671,6 @@ void D_RegisterClientCommands(void)
CV_RegisterVar(&cv_gif_dynamicdelay);
CV_RegisterVar(&cv_gif_localcolortable);
#ifdef WALLSPLATS
CV_RegisterVar(&cv_splats);
#endif
// register these so it is saved to config
CV_RegisterVar(&cv_playername);
CV_RegisterVar(&cv_playercolor);
......
......@@ -75,9 +75,6 @@ extern consvar_t cv_teamscramble;
extern consvar_t cv_scrambleonchange;
extern consvar_t cv_netstat;
#ifdef WALLSPLATS
extern consvar_t cv_splats;
#endif
extern consvar_t cv_countdowntime;
extern consvar_t cv_runscripts;
......
......@@ -9035,6 +9035,7 @@ static const char *const MOBJFLAG2_LIST[] = {
"AMBUSH", // Alternate behaviour typically set by MTF_AMBUSH
"LINKDRAW", // Draw vissprite of mobj immediately before/after tracer's vissprite (dependent on dispoffset and position)
"SHIELD", // Thinker calls P_AddShield/P_ShieldLook (must be partnered with MF_SCENERY to use)
"SPLAT", // Object is a splat
NULL
};
......@@ -9579,6 +9580,22 @@ struct {
{"tr_trans90",tr_trans90},
{"NUMTRANSMAPS",NUMTRANSMAPS},
// Render flags
{"RF_HORIZONTALFLIP",RF_HORIZONTALFLIP},
{"RF_VERTICALFLIP",RF_VERTICALFLIP},
{"RF_ONESIDED",RF_ONESIDED},
{"RF_NOSPLATBILLBOARD",RF_NOSPLATBILLBOARD},
{"RF_NOSPLATROLLANGLE",RF_NOSPLATROLLANGLE},
{"RF_FULLBRIGHT",RF_FULLBRIGHT},
{"RF_FULLDARK",RF_FULLDARK},
{"RF_SPRITETYPEMASK",RF_SPRITETYPEMASK},
{"RF_PAPERSPRITE",RF_PAPERSPRITE},
{"RF_FLOORSPRITE",RF_FLOORSPRITE},
{"RF_VOXELSPRITE",RF_VOXELSPRITE},
{"RF_SHADOWDRAW",RF_SHADOWDRAW},
{"RF_SHADOWEFFECTS",RF_SHADOWEFFECTS},
{"RF_DROPSHADOW",RF_DROPSHADOW},
// Level flags
{"LF_SCRIPTISFILE",LF_SCRIPTISFILE},
{"LF_SPEEDMUSIC",LF_SPEEDMUSIC},
......
......@@ -641,6 +641,9 @@ extern const char *compdate, *comptime, *comprevision, *compbranch;
/// Render flats on walls
#define WALLFLATS
/// Floor splats
#define FLOORSPLATS
/// Maintain compatibility with older 2.2 demos
#define OLD22DEMOCOMPAT
......
......@@ -700,79 +700,6 @@ static void HWR_RenderSkyPlane(extrasubsector_t *xsub, fixed_t fixedheight)
#endif //doplanes
/*
wallVerts order is :
3--2
| /|
|/ |
0--1
*/
#ifdef WALLSPLATS
static void HWR_DrawSegsSplats(FSurfaceInfo * pSurf)
{
FOutVector wallVerts[4];
wallsplat_t *splat;
patch_t *gpatch;
fixed_t i;
// seg bbox
fixed_t segbbox[4];
M_ClearBox(segbbox);
M_AddToBox(segbbox,
FLOAT_TO_FIXED(((polyvertex_t *)gl_curline->pv1)->x),
FLOAT_TO_FIXED(((polyvertex_t *)gl_curline->pv1)->y));
M_AddToBox(segbbox,
FLOAT_TO_FIXED(((polyvertex_t *)gl_curline->pv2)->x),
FLOAT_TO_FIXED(((polyvertex_t *)gl_curline->pv2)->y));
splat = (wallsplat_t *)gl_curline->linedef->splats;
for (; splat; splat = splat->next)
{
//BP: don't draw splat extern to this seg
// this is quick fix best is explain in logboris.txt at 12-4-2000
if (!M_PointInBox(segbbox,splat->v1.x,splat->v1.y) && !M_PointInBox(segbbox,splat->v2.x,splat->v2.y))
continue;
gpatch = W_CachePatchNum(splat->patch, PU_SPRITE);
HWR_GetPatch(gpatch);
wallVerts[0].x = wallVerts[3].x = FIXED_TO_FLOAT(splat->v1.x);
wallVerts[0].z = wallVerts[3].z = FIXED_TO_FLOAT(splat->v1.y);
wallVerts[2].x = wallVerts[1].x = FIXED_TO_FLOAT(splat->v2.x);
wallVerts[2].z = wallVerts[1].z = FIXED_TO_FLOAT(splat->v2.y);
i = splat->top;
if (splat->yoffset)
i += *splat->yoffset;
wallVerts[2].y = wallVerts[3].y = FIXED_TO_FLOAT(i)+(gpatch->height>>1);
wallVerts[0].y = wallVerts[1].y = FIXED_TO_FLOAT(i)-(gpatch->height>>1);
wallVerts[3].s = wallVerts[3].t = wallVerts[2].s = wallVerts[0].t = 0.0f;
wallVerts[1].s = wallVerts[1].t = wallVerts[2].t = wallVerts[0].s = 1.0f;
switch (splat->flags & SPLATDRAWMODE_MASK)
{
case SPLATDRAWMODE_OPAQUE :
pSurf.PolyColor.s.alpha = 0xff;
i = PF_Translucent;
break;
case SPLATDRAWMODE_TRANS :
pSurf.PolyColor.s.alpha = 128;
i = PF_Translucent;
break;
case SPLATDRAWMODE_SHADE :
pSurf.PolyColor.s.alpha = 0xff;
i = PF_Substractive;
break;
}
HWD.pfnSetShader(2); // wall shader
HWD.pfnDrawPolygon(&pSurf, wallVerts, 4, i|PF_Modulated|PF_Decal);
}
}
#endif
FBITFIELD HWR_TranstableToAlpha(INT32 transtablenum, FSurfaceInfo *pSurf)
{
switch (transtablenum)
......@@ -797,19 +724,21 @@ static void HWR_AddTransparentWall(FOutVector *wallVerts, FSurfaceInfo *pSurf, I
// Wall generation from subsector segs
// ==========================================================================
/*
wallVerts order is :
3--2
| /|
|/ |
0--1
*/
//
// HWR_ProjectWall
//
static void HWR_ProjectWall(FOutVector *wallVerts, FSurfaceInfo *pSurf, FBITFIELD blendmode, INT32 lightlevel, extracolormap_t *wallcolormap)
{
HWR_Lighting(pSurf, lightlevel, wallcolormap);
HWR_ProcessPolygon(pSurf, wallVerts, 4, blendmode|PF_Modulated|PF_Occlude, 2, false); // wall shader
#ifdef WALLSPLATS
if (gl_curline->linedef->splats && cv_splats.value)
HWR_DrawSegsSplats(pSurf);
#endif
}
// ==========================================================================
......@@ -3977,7 +3906,7 @@ static void HWR_DrawSprite(gl_vissprite_t *spr)
patch_t *gpatch; // sprite patch converted to hardware
FSurfaceInfo Surf;
const boolean hires = (spr->mobj && spr->mobj->skin && ((skin_t *)spr->mobj->skin)->flags & SF_HIRES);
//const boolean papersprite = (spr->mobj && (spr->mobj->frame & FF_PAPERSPRITE));
//const boolean papersprite = R_ThingIsPaperSprite(spr->mobj);
if (spr->mobj)
this_scale = FIXED_TO_FLOAT(spr->mobj->scale);
if (hires)
......@@ -4761,14 +4690,14 @@ static void HWR_ProjectSprite(mobj_t *thing)
size_t lumpoff;
unsigned rot;
UINT16 flip;
boolean vflip = (!(thing->eflags & MFE_VERTICALFLIP) != !(thing->frame & FF_VERTICALFLIP));
boolean vflip = (!(thing->eflags & MFE_VERTICALFLIP) != !R_ThingVerticallyFlipped(thing));
boolean mirrored = thing->mirrored;
boolean hflip = (!(thing->frame & FF_HORIZONTALFLIP) != !mirrored);
boolean hflip = (!R_ThingHorizontallyFlipped(thing) != !mirrored);
INT32 dispoffset;
angle_t ang;
INT32 heightsec, phs;
const boolean papersprite = (thing->frame & FF_PAPERSPRITE);
const boolean papersprite = R_ThingIsPaperSprite(thing);
angle_t mobjangle = (thing->player ? thing->player->drawangle : thing->angle);
float z1, z2;
......@@ -4909,13 +4838,16 @@ static void HWR_ProjectSprite(mobj_t *thing)
if (thing->rollangle)
{
rollangle = R_GetRollAngle(thing->rollangle);
rotsprite = Patch_GetRotatedSprite(sprframe, (thing->frame & FF_FRAMEMASK), rot, flip, sprinfo, rollangle);
rotsprite = Patch_GetRotatedSprite(sprframe, (thing->frame & FF_FRAMEMASK), rot, flip, false, sprinfo, rollangle);
if (rotsprite != NULL)
{
spr_width = SHORT(rotsprite->width) << FRACBITS;
spr_height = SHORT(rotsprite->height) << FRACBITS;
spr_offset = SHORT(rotsprite->leftoffset) << FRACBITS;
spr_topoffset = SHORT(rotsprite->topoffset) << FRACBITS;
spr_width = rotsprite->width << FRACBITS;
spr_height = rotsprite->height << FRACBITS;
spr_offset = rotsprite->leftoffset << FRACBITS;
spr_topoffset = rotsprite->topoffset << FRACBITS;
spr_topoffset += FEETADJUST;
// flip -> rotate, not rotate -> flip
flip = 0;
}
......@@ -6224,13 +6156,7 @@ void HWR_RenderWall(FOutVector *wallVerts, FSurfaceInfo *pSurf, FBITFIELD blend,
}
blendmode |= PF_Modulated; // No PF_Occlude means overlapping (incorrect) transparency
HWR_ProcessPolygon(pSurf, wallVerts, 4, blendmode, shader, false);
#ifdef WALLSPLATS
if (gl_curline->linedef->splats && cv_splats.value)
HWR_DrawSegsSplats(pSurf);
#endif
}
INT32 HWR_GetTextureUsed(void)
......
......@@ -458,7 +458,7 @@ static int libd_getSpritePatch(lua_State *L)
INT32 rot = R_GetRollAngle(rollangle);
if (rot) {
patch_t *rotsprite = Patch_GetRotatedSprite(sprframe, frame, angle, sprframe->flip & (1<<angle), &spriteinfo[i], rot);
patch_t *rotsprite = Patch_GetRotatedSprite(sprframe, frame, angle, sprframe->flip & (1<<angle), true, &spriteinfo[i], rot);
LUA_PushUserdata(L, rotsprite, META_PATCH);
lua_pushboolean(L, false);
lua_pushboolean(L, true);
......@@ -570,7 +570,7 @@ static int libd_getSprite2Patch(lua_State *L)
INT32 rot = R_GetRollAngle(rollangle);
if (rot) {
patch_t *rotsprite = Patch_GetRotatedSprite(sprframe, frame, angle, sprframe->flip & (1<<angle), &skins[i].sprinfo[j], rot);
patch_t *rotsprite = Patch_GetRotatedSprite(sprframe, frame, angle, sprframe->flip & (1<<angle), true, &skins[i].sprinfo[j], rot);
LUA_PushUserdata(L, rotsprite, META_PATCH);
lua_pushboolean(L, false);
lua_pushboolean(L, true);
......
......@@ -56,6 +56,7 @@ enum mobj_e {
mobj_flags,
mobj_flags2,
mobj_eflags,
mobj_renderflags,
mobj_skin,
mobj_color,
mobj_bnext,
......@@ -83,6 +84,8 @@ enum mobj_e {
mobj_scale,
mobj_destscale,
mobj_scalespeed,
mobj_spritexscale,
mobj_spriteyscale,
mobj_extravalue1,
mobj_extravalue2,
mobj_cusval,
......@@ -125,6 +128,7 @@ static const char *const mobj_opt[] = {
"flags",
"flags2",
"eflags",
"renderflags",
"skin",
"color",
"bnext",
......@@ -152,6 +156,8 @@ static const char *const mobj_opt[] = {
"scale",
"destscale",
"scalespeed",
"spritexscale",
"spriteyscale",
"extravalue1",
"extravalue2",
"cusval",
......@@ -277,6 +283,9 @@ static int mobj_get(lua_State *L)
case mobj_eflags:
lua_pushinteger(L, mo->eflags);
break;
case mobj_renderflags:
lua_pushinteger(L, mo->renderflags);
break;
case mobj_skin: // skin name or nil, not struct
if (!mo->skin)
return 0;
......@@ -381,6 +390,12 @@ static int mobj_get(lua_State *L)
case mobj_scalespeed:
lua_pushfixed(L, mo->scalespeed);
break;
case mobj_spritexscale:
lua_pushfixed(L, mo->spritexscale);
break;
case mobj_spriteyscale:
lua_pushfixed(L, mo->spriteyscale);
break;
case mobj_extravalue1:
lua_pushinteger(L, mo->extravalue1);
break;
......@@ -580,6 +595,9 @@ static int mobj_set(lua_State *L)
case mobj_eflags:
mo->eflags = (UINT32)luaL_checkinteger(L, 3);
break;
case mobj_renderflags:
mo->renderflags = (UINT32)luaL_checkinteger(L, 3);
break;
case mobj_skin: // set skin by name
{
INT32 i;
......@@ -721,6 +739,12 @@ static int mobj_set(lua_State *L)
case mobj_scalespeed:
mo->scalespeed = luaL_checkfixed(L, 3);
break;
case mobj_spritexscale:
mo->spritexscale = luaL_checkfixed(L, 3);
break;
case mobj_spriteyscale:
mo->spriteyscale = luaL_checkfixed(L, 3);
break;
case mobj_extravalue1:
mo->extravalue1 = luaL_checkinteger(L, 3);
break;
......
......@@ -38,10 +38,6 @@
static CV_PossibleValue_t CV_BobSpeed[] = {{0, "MIN"}, {4*FRACUNIT, "MAX"}, {0, NULL}};
consvar_t cv_movebob = CVAR_INIT ("movebob", "1.0", CV_FLOAT|CV_SAVE, CV_BobSpeed, NULL);
#ifdef WALLSPLATS
consvar_t cv_splats = CVAR_INIT ("splats", "On", CV_SAVE, CV_OnOff, NULL);
#endif
actioncache_t actioncachehead;
static mobj_t *overlaycap = NULL;
......@@ -1961,29 +1957,6 @@ void P_XYMovement(mobj_t *mo)
return;
}
// draw damage on wall
//SPLAT TEST ----------------------------------------------------------
#ifdef WALLSPLATS
if (blockingline && mo->type != MT_REDRING && mo->type != MT_FIREBALL
&& !(mo->flags2 & (MF2_AUTOMATIC|MF2_RAILRING|MF2_BOUNCERING|MF2_EXPLOSION|MF2_SCATTER)))
// set by last P_TryMove() that failed
{
divline_t divl;
divline_t misl;
fixed_t frac;
P_MakeDivline(blockingline, &divl);
misl.x = mo->x;
misl.y = mo->y;
misl.dx = mo->momx;
misl.dy = mo->momy;
frac = P_InterceptVector(&divl, &misl);
R_AddWallSplat(blockingline, P_PointOnLineSide(mo->x,mo->y,blockingline),
"A_DMG3", mo->z, frac, SPLATDRAWMODE_SHADE);
}
#endif
// --------------------------------------------------------- SPLAT TEST
P_ExplodeMissile(mo);
return;
}
......@@ -9614,12 +9587,6 @@ static boolean P_MobjRegularThink(mobj_t *mobj)
mobj->fuse = 1; // Return to base.
break;
}
case MT_CANNONBALL:
#ifdef FLOORSPLATS
R_AddFloorSplat(mobj->tracer->subsector, mobj->tracer, "TARGET", mobj->tracer->x,
mobj->tracer->y, mobj->tracer->floorz, SPLATDRAWMODE_SHADE);
#endif
break;
case MT_SPINDUST: // Spindash dust
mobj->momx = FixedMul(mobj->momx, (3*FRACUNIT)/4); // originally 50000
mobj->momy = FixedMul(mobj->momy, (3*FRACUNIT)/4); // same
......@@ -10487,6 +10454,7 @@ mobj_t *P_SpawnMobj(fixed_t x, fixed_t y, fixed_t z, mobjtype_t type)
mobj->tics = st->tics;
mobj->sprite = st->sprite;
mobj->frame = st->frame; // FF_FRAMEMASK for frame, and other bits..
mobj->renderflags = 0;
P_SetupStateAnimation(mobj, st);
mobj->friction = ORIG_FRICTION;
......@@ -10497,6 +10465,7 @@ mobj_t *P_SpawnMobj(fixed_t x, fixed_t y, fixed_t z, mobjtype_t type)
mobj->scale = FRACUNIT;
mobj->destscale = mobj->scale;
mobj->scalespeed = FRACUNIT/12;
mobj->spritexscale = mobj->spriteyscale = mobj->scale;
// TODO: Make this a special map header
if ((maptol & TOL_ERZ3) && !(mobj->type == MT_BLACKEGGMAN))
......
......@@ -194,6 +194,7 @@ typedef enum
MF2_AMBUSH = 1<<27, // Alternate behaviour typically set by MTF_AMBUSH
MF2_LINKDRAW = 1<<28, // Draw vissprite of mobj immediately before/after tracer's vissprite (dependent on dispoffset and position)
MF2_SHIELD = 1<<29, // Thinker calls P_AddShield/P_ShieldLook (must be partnered with MF_SCENERY to use)
MF2_SPLAT = 1<<30, // Renders as a splat
// free: to and including 1<<31
} mobjflag2_t;
......@@ -308,6 +309,7 @@ typedef struct mobj_s
UINT32 flags; // flags from mobjinfo tables
UINT32 flags2; // MF2_ flags
UINT16 eflags; // extra flags
UINT32 renderflags; // render flags
void *skin; // overrides 'sprite' when non-NULL (for player bodies to 'remember' the skin)
// Player and mobj sprites in multiplayer modes are modified
......@@ -360,6 +362,7 @@ typedef struct mobj_s
fixed_t scale;
fixed_t destscale;
fixed_t scalespeed;
fixed_t spritexscale, spriteyscale;
// Extra values are for internal use for whatever you want
INT32 extravalue1;
......
......@@ -1393,7 +1393,10 @@ typedef enum
MD2_COLORIZED = 1<<12,
MD2_MIRRORED = 1<<13,
MD2_ROLLANGLE = 1<<14,
MD2_SHADOWSCALE = 1<<15,
MD2_SPRITEXSCALE = 1<<15,
MD2_SPRITEYSCALE = 1<<16,
MD2_SHADOWSCALE = 1<<17,
MD2_RENDERFLAGS = 1<<18,
} mobj_diff2_t;
typedef enum
......@@ -1604,8 +1607,14 @@ static void SaveMobjThinker(const thinker_t *th, const UINT8 type)
diff2 |= MD2_MIRRORED;
if (mobj->rollangle)
diff2 |= MD2_ROLLANGLE;
if (mobj->spritexscale != FRACUNIT)
diff2 |= MD2_SPRITEXSCALE;
if (mobj->spriteyscale != FRACUNIT)
diff2 |= MD2_SPRITEYSCALE;
if (mobj->shadowscale)
diff2 |= MD2_SHADOWSCALE;
if (mobj->renderflags)
diff2 |= MD2_RENDERFLAGS;
if (diff2 != 0)
diff |= MD_MORE;
......@@ -1746,8 +1755,14 @@ static void SaveMobjThinker(const thinker_t *th, const UINT8 type)
WRITEUINT8(save_p, mobj->mirrored);
if (diff2 & MD2_ROLLANGLE)
WRITEANGLE(save_p, mobj->rollangle);
if (diff2 & MD2_SPRITEXSCALE)
WRITEFIXED(save_p, mobj->spritexscale);
if (diff2 & MD2_SPRITEYSCALE)
WRITEFIXED(save_p, mobj->spriteyscale);
if (diff2 & MD2_SHADOWSCALE)
WRITEFIXED(save_p, mobj->shadowscale);
if (diff2 & MD2_RENDERFLAGS)
WRITEUINT32(save_p, mobj->renderflags);
WRITEUINT32(save_p, mobj->mobjnum);
}
......@@ -2755,8 +2770,14 @@ static thinker_t* LoadMobjThinker(actionf_p1 thinker)
mobj->mirrored = READUINT8(save_p);
if (diff2 & MD2_ROLLANGLE)
mobj->rollangle = READANGLE(save_p);
if (diff2 & MD2_SPRITEXSCALE)
mobj->spritexscale = READFIXED(save_p);
if (diff2 & MD2_SPRITEYSCALE)
mobj->spriteyscale = READFIXED(save_p);
if (diff2 & MD2_SHADOWSCALE)
mobj->shadowscale = READFIXED(save_p);
if (diff2 & MD2_RENDERFLAGS)
mobj->renderflags = READUINT32(save_p);
if (diff & MD_REDFLAG)
{
......
......@@ -1080,9 +1080,6 @@ static void P_InitializeLinedef(line_t *ld)
ld->frontsector = ld->backsector = NULL;
ld->validcount = 0;
#ifdef WALLSPLATS
ld->splats = NULL;
#endif
ld->firsttag = ld->nexttag = -1;
ld->polyobj = NULL;
......@@ -2081,9 +2078,6 @@ static boolean P_LoadMapData(const virtres_t *virt)
static void P_InitializeSubsector(subsector_t *ss)
{
ss->sector = NULL;
#ifdef FLOORSPLATS
ss->splats = NULL;
#endif
ss->validcount = 0;
}
......@@ -2128,7 +2122,7 @@ static void P_LoadNodes(UINT8 *data)
* \param seg Seg to compute length for.
* \return Length in fracunits.
*/
fixed_t P_SegLength(seg_t *seg)
static fixed_t P_SegLength(seg_t *seg)
{
INT64 dx = (seg->v2->x - seg->v1->x)>>1;
INT64 dy = (seg->v2->y - seg->v1->y)>>1;
......@@ -4094,11 +4088,6 @@ boolean P_LoadLevel(boolean fromnetsave)
Patch_FreeTag(PU_PATCH_ROTATED);
Z_FreeTags(PU_LEVEL, PU_PURGELEVEL - 1);
#if defined (WALLSPLATS) || defined (FLOORSPLATS)
// clear the splats from previous level
R_ClearLevelSplats();
#endif
P_InitThinkers();
P_InitCachedActions();
......
......@@ -8678,12 +8678,6 @@ void P_MovePlayer(player_t *player)
player->fovadd = 0;
#endif
#ifdef FLOORSPLATS
if (cv_shadow.value && rendermode == render_soft)
R_AddFloorSplat(player->mo->subsector, player->mo, "SHADOW", player->mo->x,
player->mo->y, player->mo->floorz, SPLATDRAWMODE_OPAQUE);
#endif
// Look for blocks to bust up
// Because of FF_SHATTER, we should look for blocks constantly,
// not just when spinning or playing as Knuckles
......
......@@ -1048,11 +1048,6 @@ static void R_Subsector(size_t num)
}
}
#ifdef FLOORSPLATS
if (sub->splats)
R_AddVisibleFloorSplats(sub);
#endif
// killough 9/18/98: Fix underwater slowdown, by passing real sector
// instead of fake one. Improve sprite lighting by basing sprite
// lightlevels on floor & ceiling lightlevels in the surrounding area.
......
......@@ -409,9 +409,6 @@ typedef struct line_s
sector_t *backsector;
size_t validcount; // if == validcount, already checked
#if 1//#ifdef WALLSPLATS
void *splats; // wallsplat_t list
#endif
INT32 firsttag, nexttag; // improves searches for tags.
polyobj_t *polyobj; // Belongs to a polyobject?
......@@ -457,9 +454,6 @@ typedef struct subsector_s
INT16 numlines;
UINT16 firstline;
struct polyobj_s *polyList; // haleyjd 02/19/06: list of polyobjects
#if 1//#ifdef FLOORSPLATS
void *splats; // floorsplat_t list
#endif
size_t validcount;
} subsector_t;
......@@ -674,6 +668,7 @@ typedef struct
UINT8 *columns; // Software column data
void *hardware; // OpenGL patch, allocated whenever necessary
void *flats[4]; // The patch as flats
#ifdef ROTSPRITE
rotsprite_t *rotated; // Rotated patches
......@@ -720,6 +715,28 @@ typedef struct
typedef enum
{
RF_HORIZONTALFLIP = 0x0001, // Flip sprite horizontally
RF_VERTICALFLIP = 0x0002, // Flip sprite vertically
RF_ONESIDED = 0x0004, // Wall/floor sprite is visible from front only
RF_NOSPLATBILLBOARD = 0x0008, // Don't billboard floor sprites (faces forward from the view angle)
RF_NOSPLATROLLANGLE = 0x0010, // Don't rotate floor sprites by the object's rollangle (uses rotated patches instead)
RF_BLENDMASK = 0x0F00, // --Blending modes
RF_FULLBRIGHT = 0x0100, // Sprite is drawn at full brightness
RF_FULLDARK = 0x0200, // Sprite is drawn completely dark
RF_SPRITETYPEMASK = 0x7000, // ---Different sprite types, not all implemented
RF_PAPERSPRITE = 0x1000, // Paper sprite
RF_FLOORSPRITE = 0x2000, // Floor sprite
RF_VOXELSPRITE = 0x3000, // Voxel object
RF_SHADOWDRAW = 0x10000, // Stretches and skews the sprite like a shadow.
RF_SHADOWEFFECTS = 0x20000, // Scales and becomes transparent like a shadow.
RF_DROPSHADOW = (RF_SHADOWDRAW | RF_SHADOWEFFECTS | RF_FULLDARK),
} renderflags_t;
typedef enum
{
SRF_SINGLE = 0, // 0-angle for all rotations
SRF_3D = 1, // Angles 1-8
SRF_3DGE = 2, // 3DGE, ZDoom and Doom Legacy all have 16-angle support. Why not us?
......@@ -759,7 +776,7 @@ typedef struct
UINT16 flip;
#ifdef ROTSPRITE
rotsprite_t *rotated[16]; // Rotated patches
rotsprite_t *rotated[2][16]; // Rotated patches
#endif
} spriteframe_t;
......
......@@ -98,6 +98,7 @@ INT32 dc_numlights = 0, dc_maxlights, dc_texheight;
INT32 ds_y, ds_x1, ds_x2;
lighttable_t *ds_colormap;
lighttable_t *ds_translation; // Lactozilla: Sprite splat drawer
fixed_t ds_xfrac, ds_yfrac, ds_xstep, ds_ystep;
UINT16 ds_flatwidth, ds_flatheight;
boolean ds_powersoftwo;
......
......@@ -56,6 +56,7 @@ extern INT32 dc_texheight;
extern INT32 ds_y, ds_x1, ds_x2;
extern lighttable_t *ds_colormap;
extern lighttable_t *ds_translation;
extern fixed_t ds_xfrac, ds_yfrac, ds_xstep, ds_ystep;
extern UINT16 ds_flatwidth, ds_flatheight;
extern boolean ds_powersoftwo;
......@@ -151,8 +152,10 @@ void R_DrawColumnShadowed_8(void);
void R_DrawSpan_8(void);
void R_DrawSplat_8(void);
void R_DrawFloorSprite_8(void);
void R_DrawTranslucentSpan_8(void);
void R_DrawTranslucentSplat_8(void);
void R_DrawTranslucentFloorSprite_8(void);
void R_DrawTiltedSpan_8(void);
void R_DrawTiltedTranslucentSpan_8(void);
#ifndef NOWATER
......@@ -171,8 +174,10 @@ void R_DrawFogSpan_8(void);
// Lactozilla: Non-powers-of-two
void R_DrawSpan_NPO2_8(void);
void R_DrawTranslucentSpan_NPO2_8(void);
void R_DrawFloorSprite_NPO2_8(void);
void R_DrawSplat_NPO2_8(void);
void R_DrawTranslucentSplat_NPO2_8(void);
void R_DrawTranslucentFloorSprite_NPO2_8(void);
void R_DrawTiltedSpan_NPO2_8(void);
void R_DrawTiltedTranslucentSpan_NPO2_8(void);
#ifndef NOWATER
......
......@@ -1419,6 +1419,230 @@ void R_DrawTranslucentSplat_8 (void)
}
}
/** \brief The R_DrawFloorSprite_8 function
Just like R_DrawSplat_8, but for floor sprites.
*/
void R_DrawFloorSprite_8 (void)
{
fixed_t xposition;
fixed_t yposition;
fixed_t xstep, ystep;
UINT16 *source;
UINT8 *colormap;
UINT8 *translation;
UINT8 *dest;
const UINT8 *deststop = screens[0] + vid.rowbytes * vid.height;
size_t count = (ds_x2 - ds_x1 + 1);
UINT32 val;
xposition = ds_xfrac; yposition = ds_yfrac;
xstep = ds_xstep; ystep = ds_ystep;
// SoM: we only need 6 bits for the integer part (0 thru 63) so the rest
// can be used for the fraction part. This allows calculation of the memory a