Skip to content
Snippets Groups Projects

Compare revisions

Changes are shown as if the source revision was being merged into the target revision. Learn more about comparing revisions.

Source

Select target project
No results found
Select Git revision

Target

Select target project
  • STJr/SRB2
  • Sryder/SRB2
  • wolfy852/SRB2
  • Alpha2244/SRB2
  • Inuyasha/SRB2
  • yoshibot/SRB2
  • TehRealSalt/SRB2
  • PrisimaTF/SRB2
  • Hatninja/SRB2
  • SteelT/SRB2
  • james/SRB2
  • ShaderWraith/SRB2
  • SinnamonLat/SRB2
  • mazmazz_/SRB2
  • filpAM/SRB2
  • chaoloveicemdboy/SRB2
  • Whooa21/SRB2
  • Machturne/SRB2
  • Golden/SRB2
  • Tatsuru/SRB2
  • Snu/SRB2
  • Zwip-Zwap_Zapony/SRB2
  • fickleheart/SRB2
  • alphaRexJames/SRB2
  • JJK/SRB2
  • diskpoppy/SRB2
  • Hannu_Hanhi/SRB2
  • ZipperQR/SRB2
  • kays/SRB2
  • spherallic/SRB2
  • Zippy_Zolton/SRB2
  • namiishere/SRB2
  • Ors/SRB2
  • SMS_Alfredo/SRB2
  • sonic_edge/SRB2
  • lavla/SRB2
  • ashi/SRB2
  • X.organic/SRB2
  • Fafabis/SRB2
  • Meziu/SRB2
  • v-rob/SRB2
  • tertu/SRB2
  • bitten2up/SRB2
  • flarn2006/SRB2
  • Krabs/SRB2
  • clairebun/SRB2
  • Lactozilla/SRB2
  • thehackstack/SRB2
  • Spice/SRB2
  • win8linux/SRB2
  • JohnFrostFox/SRB2
  • talktoneon726/SRB2
  • Wane/SRB2
  • Lamibe/SRB2
  • spectrumuk2/srb-2
  • nerdyminer18/srb-2
  • 256nil/SRB2
  • ARJr/SRB2
  • Alam/SRB2
  • Zenya/srb-2-marathon-demos
  • Acelite/srb-2-archivedmodifications
  • MIDIMan/SRB2
  • Lach/SRB2
  • Frostiikin/bounce-tweaks
  • Jaden/SRB2
  • Tyron/SRB2
  • Astronight/SRB2
  • Mari0shi06/SRB2
  • aiire/SRB2
  • Galactice/SRB2
  • srb2-ports/srb2-dreamcast
  • sdasdas/SRB2
  • chreas/srb-2-vr
  • StarManiaKG/the-story-of-sinically-rocketing-and-botching-the-2nd
  • LoganAir/SRB2
  • NepDisk/srb-2
  • alufolie91/SRB2
  • Felicia.iso/SRB2
  • twi/SRB2
  • BarrelsOFun/SRB2
  • Speed2411/SRB2
  • Leather_Realms/SRB2
  • Ayemar/SRB2
  • Acelite/SRB2
  • VladDoc/SRB2
  • kaldrum/model-features
  • strawberryfox417/SRB2
  • Lugent/SRB2
  • Jisk/SRB2
  • Rem/SRB2
  • Refrag/SRB2
  • Henry_3230/srb-3230
  • TehPuertoRicanSpartan2/tprs-srb2
  • Leminn/srb-2-marathon-stuff
  • chromaticpipe2/SRB2
  • MiguelGustavo15/SRB2
  • Maru/srb-2-tests
  • SilicDev/SRB2
  • UnmatchedBracket/SRB2
  • HybridDog/SRB2
  • xordspar0/SRB2
  • jsjhbewfhh/SRB2
  • Fancy2209/SRB2
  • Lorsoen/SRB2
  • shindoukin/SRB2
  • GamerOfDays/SRB2
  • Craftyawesome/SRB2
  • tenshi-tensai-tennoji/SRB2
  • Scarfdudebalder/SRB2
  • luigi-budd/srb-2-fix-interplag-lockon
  • mskluesner/SRB2
  • johnpetersa19/SRB2
  • Pheazant/SRB2
  • chromaticpipe2/srb2classic
  • romoney5/SRB2
  • PAS/SRB2Classic
  • BlueStaggo/SRB2
117 results
Select Git revision
Show changes
Commits on Source (21)
......@@ -844,6 +844,10 @@ static void IdentifyVersion(void)
// Add our crappy patches to fix our bugs
// D_AddFile(va(pandf,srb2waddir,"patch.dta"));
// Add the thokker WAD
if (M_CheckParm("-nothokker") == 0)
D_AddFile(va(pandf,srb2waddir,"thokker.thk"));
#if !defined (HAVE_SDL) || defined (HAVE_MIXER)
{
#if defined (DC) && 0
......
......@@ -44,6 +44,7 @@
#include "lua_hook.h"
#include "m_cond.h"
#include "m_anigif.h"
#include "m_argv.h"
#ifdef NETGAME_DEVMODE
#define CV_RESTRICT CV_NETVAR
......@@ -1618,7 +1619,10 @@ static void Command_Map_f(void)
// new gametype value
// use current one by default
i = COM_CheckParm("-gametype");
if (i)
if (M_CheckParm("-nothokker") == 0)
newgametype = GT_TEAMMATCH;
else if (i)
{
if (!multiplayer)
{
......@@ -3375,8 +3379,13 @@ void D_GameTypeChanged(INT32 lastgametype)
if (!cv_timelimit.changed && !cv_pointlimit.changed) // user hasn't changed limits
{
// default settings for match: timelimit 10 mins, no pointlimit
CV_SetValue(&cv_pointlimit, 0);
CV_SetValue(&cv_timelimit, 10);
if (M_CheckParm("-nothokker") != 0) {
CV_SetValue(&cv_pointlimit, 0);
CV_SetValue(&cv_timelimit, 10);
} else {
CV_SetValue(&cv_pointlimit, 3);
CV_SetValue(&cv_timelimit, 0);
}
}
if (!cv_itemrespawntime.changed)
CV_Set(&cv_itemrespawntime, cv_itemrespawntime.defaultvalue); // respawn normally
......
......@@ -998,7 +998,7 @@ static const struct {
static void readlevelheader(MYFILE *f, INT32 num)
{
char *s = Z_Malloc(MAXLINELEN, PU_STATIC, NULL);
char *word;
char *word = s;
char *word2;
//char *word3; // Non-uppercase version of word2
char *tmp;
......@@ -1028,7 +1028,7 @@ static void readlevelheader(MYFILE *f, INT32 num)
continue; // Skip comment lines, but don't break.
// Set / reset word, because some things (Lua.) move it
word = s;
//word = s;
// Get the part before the " = "
tmp = strchr(s, '=');
......@@ -7761,36 +7761,36 @@ struct {
{"FF_GOOWATER",FF_GOOWATER}, ///< Used with ::FF_SWIMMABLE. Makes thick bouncey goop.
// Angles
{"ANG1",ANG1>>16},
{"ANG2",ANG2>>16},
{"ANG10",ANG10>>16},
{"ANG15",ANG15>>16},
{"ANG20",ANG20>>16},
{"ANG30",ANG30>>16},
{"ANG60",ANG60>>16},
{"ANG64h",ANG64h>>16},
{"ANG105",ANG105>>16},
{"ANG210",ANG210>>16},
{"ANG255",ANG255>>16},
{"ANG340",ANG340>>16},
{"ANG350",ANG350>>16},
{"ANGLE_11hh",ANGLE_11hh>>16},
{"ANGLE_22h",ANGLE_22h>>16},
{"ANGLE_45",ANGLE_45>>16},
{"ANGLE_67h",ANGLE_67h>>16},
{"ANGLE_90",ANGLE_90>>16},
{"ANGLE_112h",ANGLE_112h>>16},
{"ANGLE_135",ANGLE_135>>16},
{"ANGLE_157h",ANGLE_157h>>16},
{"ANGLE_180",ANGLE_180>>16},
{"ANGLE_202h",ANGLE_202h>>16},
{"ANGLE_225",ANGLE_225>>16},
{"ANGLE_247h",ANGLE_247h>>16},
{"ANGLE_270",ANGLE_270>>16},
{"ANGLE_292h",ANGLE_292h>>16},
{"ANGLE_315",ANGLE_315>>16},
{"ANGLE_337h",ANGLE_337h>>16},
{"ANGLE_MAX",ANGLE_MAX>>16},
{"ANG1",ANG1>>0},
{"ANG2",ANG2>>0},
{"ANG10",ANG10>>0},
{"ANG15",ANG15>>0},
{"ANG20",ANG20>>0},
{"ANG30",ANG30>>0},
{"ANG60",ANG60>>0},
{"ANG64h",ANG64h>>0},
{"ANG105",ANG105>>0},
{"ANG210",ANG210>>0},
{"ANG255",ANG255>>0},
{"ANG340",ANG340>>0},
{"ANG350",ANG350>>0},
{"ANGLE_11hh",ANGLE_11hh>>0},
{"ANGLE_22h",ANGLE_22h>>0},
{"ANGLE_45",ANGLE_45>>0},
{"ANGLE_67h",ANGLE_67h>>0},
{"ANGLE_90",ANGLE_90>>0},
{"ANGLE_112h",ANGLE_112h>>0},
{"ANGLE_135",ANGLE_135>>0},
{"ANGLE_157h",ANGLE_157h>>0},
{"ANGLE_180",ANGLE_180>>0},
{"ANGLE_202h",ANGLE_202h>>0},
{"ANGLE_225",ANGLE_225>>0},
{"ANGLE_247h",ANGLE_247h>>0},
{"ANGLE_270",ANGLE_270>>0},
{"ANGLE_292h",ANGLE_292h>>0},
{"ANGLE_315",ANGLE_315>>0},
{"ANGLE_337h",ANGLE_337h>>0},
{"ANGLE_MAX",ANGLE_MAX>>0},
// P_Chase directions (dirtype_t)
{"DI_NODIR",DI_NODIR},
......
......@@ -147,10 +147,10 @@ extern FILE *logstream;
// most interface strings are ignored in development mode.
// we use comprevision and compbranch instead.
#else
#define VERSION 201 // Game version
#define SUBVERSION 14 // more precise version number
#define VERSIONSTRING "v2.1.14"
#define VERSIONSTRINGW L"v2.1.14"
#define VERSION 165 // Game version
#define SUBVERSION 1
#define VERSIONSTRING "v2.1.14 (Thokker 1.0.1)"
#define VERSIONSTRINGW L"v2.1.14 (Thokker 1.0.1)"
// Hey! If you change this, add 1 to the MODVERSION below!
// Otherwise we can't force updates!
#endif
......@@ -166,8 +166,8 @@ extern FILE *logstream;
// The string used in the alert that pops up in the event of an update being available.
// Please change to apply to your modification (we don't want everyone asking where your mod is on SRB2.org!).
#define UPDATE_ALERT_STRING \
"A new update is available for SRB2.\n"\
"Please visit SRB2.org to download it.\n"\
"A new update is available for SRB2 Thokker.\n"\
"Please visit the SRB2MB to download it.\n"\
"\n"\
"You are using version: %s\n"\
"The newest version is: %s\n"\
......@@ -183,8 +183,8 @@ extern FILE *logstream;
// The string used in the I_Error alert upon trying to host through command line parameters.
// Generally less filled with newlines, since Windows gives you lots more room to work with.
#define UPDATE_ALERT_STRING_CONSOLE \
"A new update is available for SRB2.\n"\
"Please visit SRB2.org to download it.\n"\
"A new update is available for SRB2 Thokker.\n"\
"Please visit the SRB2MB to download it.\n"\
"\n"\
"You are using version: %s\n"\
"The newest version is: %s\n"\
......@@ -201,14 +201,14 @@ extern FILE *logstream;
// The Modification ID; must be obtained from Inuyasha ( http://mb.srb2.org/private.php?do=newpm&u=2604 ).
// DO NOT try to set this otherwise, or your modification will be unplayable through the Master Server.
// "12" is the default mod ID for version 2.1
#define MODID 12
// "13" is the default mod ID for Thokker
#define MODID 13
// The Modification Version, starting from 1. Do not follow your version string for this,
// it's only for detection of the version the player is using so the MS can alert them of an update.
// Only set it higher, not lower, obviously.
// Note that we use this to help keep internal testing in check; this is why v2.1.0 is not version "1".
#define MODVERSION 19
#define MODVERSION 2
......
......@@ -39,7 +39,9 @@
#include "../st_stuff.h"
#include "../i_system.h"
#include "../m_cheat.h"
#ifdef ESLOPE
#include "../p_slopes.h"
#endif
#include "hw_md2.h"
#define R_FAKEFLOORS
......@@ -519,7 +521,7 @@ static UINT8 HWR_FogBlockAlpha(INT32 light, UINT32 color, UINT32 fadecolor) // L
// -----------------+
// HWR_RenderPlane : Render a floor or ceiling convex polygon
// -----------------+
static void HWR_RenderPlane(sector_t *sector, extrasubsector_t *xsub, fixed_t fixedheight,
static void HWR_RenderPlane(sector_t *shittyUnusedVariable, extrasubsector_t *xsub, fixed_t fixedheight,
FBITFIELD PolyFlags, INT32 lightlevel, lumpnum_t lumpnum, sector_t *FOFsector, UINT8 alpha, boolean fogplane, extracolormap_t *planecolormap)
{
polyvertex_t * pv;
......@@ -535,14 +537,42 @@ static void HWR_RenderPlane(sector_t *sector, extrasubsector_t *xsub, fixed_t fi
angle_t angle = 0;
FSurfaceInfo Surf;
fixed_t tempxsow, tempytow;
#ifdef ESLOPE
pslope_t *slope = NULL;
#endif
static FOutVector *planeVerts = NULL;
static UINT16 numAllocedPlaneVerts = 0;
(void)shittyUnusedVariable; ///@TODO remove shitty unused variable
// no convex poly were generated for this subsector
if (!xsub->planepoly)
return;
#ifdef ESLOPE
// Get the slope pointer to simplify future code
if (FOFsector)
{
if (FOFsector->f_slope && FOFsector->floorheight == fixedheight)
slope = FOFsector->f_slope;
else if (FOFsector->c_slope && FOFsector->ceilingheight == fixedheight)
slope = FOFsector->c_slope;
}
else
{
// Use fixedheight to determine whether to check floor or ceiling because I hate my life
if (gr_frontsector->f_slope && gr_frontsector->floorheight == fixedheight)
slope = gr_frontsector->f_slope;
else if (gr_frontsector->c_slope && gr_frontsector->ceilingheight == fixedheight)
slope = gr_frontsector->c_slope;
}
// Set fixedheight to the slope's height from our viewpoint, if we have a slope
if (slope)
fixedheight = P_GetZAt(slope, viewx, viewy);
#endif
height = FIXED_TO_FLOAT(fixedheight);
pv = xsub->planepoly->pts;
......@@ -608,7 +638,12 @@ static void HWR_RenderPlane(sector_t *sector, extrasubsector_t *xsub, fixed_t fi
if (FOFsector != NULL)
{
#ifdef ESLOPE
if ((slope && slope == FOFsector->f_slope)
|| fixedheight == FOFsector->floorheight) // it's a floor
#else
if (fixedheight == FOFsector->floorheight) // it's a floor
#endif
{
scrollx = FIXED_TO_FLOAT(FOFsector->floor_xoffs)/fflatsize;
scrolly = FIXED_TO_FLOAT(FOFsector->floor_yoffs)/fflatsize;
......@@ -623,7 +658,12 @@ static void HWR_RenderPlane(sector_t *sector, extrasubsector_t *xsub, fixed_t fi
}
else if (gr_frontsector)
{
#ifdef ESLOPE
if ((slope && slope == gr_frontsector->f_slope)
|| fixedheight == gr_frontsector->floorheight) // it's a floor
#else
if (fixedheight < dup_viewz) // it's a floor
#endif
{
scrollx = FIXED_TO_FLOAT(gr_frontsector->floor_xoffs)/fflatsize;
scrolly = FIXED_TO_FLOAT(gr_frontsector->floor_yoffs)/fflatsize;
......@@ -678,24 +718,13 @@ static void HWR_RenderPlane(sector_t *sector, extrasubsector_t *xsub, fixed_t fi
v3d->x = pv->x;
v3d->y = height;
v3d->z = pv->y;
#ifdef SLOPENESS
if (sector && sector->special == 65535)
#ifdef ESLOPE
if (slope)
{
size_t q;
for (q = 0; q < sector->linecount; q++)
{
if (v3d->x == sector->lines[q]->v1->x>>FRACBITS)
{
if (v3d->z == sector->lines[q]->v1->y>>FRACBITS)
{
v3d->y += sector->lines[q]->v1->z>>FRACBITS;
break;
}
}
}
fixedheight = P_GetZAt(slope, FLOAT_TO_FIXED(pv->x), FLOAT_TO_FIXED(pv->y));
v3d->y = FIXED_TO_FLOAT(fixedheight);
}
#else
(void)sector;
#endif
}
......@@ -714,6 +743,11 @@ static void HWR_RenderPlane(sector_t *sector, extrasubsector_t *xsub, fixed_t fi
{
sector_t *psector = gr_frontsector;
#ifdef ESLOPE
if (slope)
fixedheight = P_GetZAt(slope, psector->soundorg.x, psector->soundorg.y);
#endif
if (psector->ffloors)
{
ffloor_t *caster = psector->lightlist[R_GetPlaneLight(psector, fixedheight, false)].caster;
......@@ -1050,23 +1084,50 @@ static void HWR_SplitWall(sector_t *sector, wallVert3D *wallVerts, INT32 texnum,
lightlist. This may also include leaving out parts
of the wall that can't be seen */
GLTexture_t * glTex;
float realtop, realbot, top, bot;
float pegt, pegb, pegmul;
float height = 0.0f, bheight = 0.0f;
#ifdef ESLOPE
float endrealtop, endrealbot, endtop, endbot;
float endpegt, endpegb, endpegmul;
float endheight = 0.0f, endbheight = 0.0f;
fixed_t v1x = FLOAT_TO_FIXED(wallVerts[0].x);
fixed_t v1y = FLOAT_TO_FIXED(wallVerts[0].y);
fixed_t v2x = FLOAT_TO_FIXED(wallVerts[1].x);
fixed_t v2y = FLOAT_TO_FIXED(wallVerts[1].y);
// compiler complains when P_GetZAt is used in FLOAT_TO_FIXED directly
// use this as a temp var to store P_GetZAt's return value each time
fixed_t temp;
#endif
INT32 solid, i;
lightlist_t * list = sector->lightlist;
const UINT8 alpha = Surf->FlatColor.s.alpha;
FUINT lightnum;
extracolormap_t *colormap;
realtop = top = wallVerts[2].y;
realtop = top = wallVerts[3].y;
realbot = bot = wallVerts[0].y;
pegt = wallVerts[2].t;
pegt = wallVerts[3].t;
pegb = wallVerts[0].t;
pegmul = (pegb - pegt) / (top - bot);
#ifdef ESLOPE
endrealtop = endtop = wallVerts[2].y;
endrealbot = endbot = wallVerts[1].y;
endpegt = wallVerts[2].t;
endpegb = wallVerts[1].t;
endpegmul = (endpegb - endpegt) / (endtop - endbot);
#endif
for (i = 1; i < sector->numlights; i++)
{
#ifdef ESLOPE
if (endtop < endrealbot)
#endif
if (top < realbot)
return;
......@@ -1099,14 +1160,45 @@ static void HWR_SplitWall(sector_t *sector, wallVert3D *wallVerts, INT32 texnum,
if (cutflag == FF_CUTSOLIDS) // These are regular walls sent in from StoreWallRange, they shouldn't be cut from this
solid = false;
#ifdef ESLOPE
if (list[i].slope)
{
temp = P_GetZAt(list[i].slope, v1x, v1y);
height = FIXED_TO_FLOAT(temp);
temp = P_GetZAt(list[i].slope, v2x, v2y);
endheight = FIXED_TO_FLOAT(temp);
}
else
height = endheight = FIXED_TO_FLOAT(list[i].height);
if (solid)
{
if (*list[i].caster->b_slope)
{
temp = P_GetZAt(*list[i].caster->b_slope, v1x, v1y);
bheight = FIXED_TO_FLOAT(temp);
temp = P_GetZAt(*list[i].caster->b_slope, v2x, v2y);
endbheight = FIXED_TO_FLOAT(temp);
}
else
bheight = endbheight = FIXED_TO_FLOAT(*list[i].caster->bottomheight);
}
#else
height = FIXED_TO_FLOAT(list[i].height);
if (solid)
bheight = FIXED_TO_FLOAT(*list[i].caster->bottomheight);
#endif
#ifdef ESLOPE
if (endheight >= endtop)
#endif
if (height >= top)
{
if (solid && top > bheight)
top = bheight;
#ifdef ESLOPE
if (solid && endtop > endbheight)
endtop = endbheight;
#endif
continue;
}
......@@ -1116,6 +1208,13 @@ static void HWR_SplitWall(sector_t *sector, wallVert3D *wallVerts, INT32 texnum,
if (bot < realbot)
bot = realbot;
#ifdef ESLOPE
endbot = endheight;
if (endbot < endrealbot)
endbot = endrealbot;
#endif
// colormap test
if (list[i-1].caster)
{
......@@ -1130,13 +1229,25 @@ static void HWR_SplitWall(sector_t *sector, wallVert3D *wallVerts, INT32 texnum,
Surf->FlatColor.s.alpha = alpha;
#ifdef ESLOPE
wallVerts[3].t = pegt + ((realtop - top) * pegmul);
wallVerts[2].t = endpegt + ((endrealtop - endtop) * endpegmul);
wallVerts[0].t = pegt + ((realtop - bot) * pegmul);
wallVerts[1].t = endpegt + ((endrealtop - endbot) * endpegmul);
// set top/bottom coords
wallVerts[3].y = top;
wallVerts[2].y = endtop;
wallVerts[0].y = bot;
wallVerts[1].y = endbot;
#else
wallVerts[3].t = wallVerts[2].t = pegt + ((realtop - top) * pegmul);
wallVerts[0].t = wallVerts[1].t = pegt + ((realtop - bot) * pegmul);
// set top/bottom coords
wallVerts[2].y = wallVerts[3].y = top;
wallVerts[0].y = wallVerts[1].y = bot;
#endif
glTex = HWR_GetTexture(texnum);
if (cutflag & FF_TRANSLUCENT)
......@@ -1150,9 +1261,19 @@ static void HWR_SplitWall(sector_t *sector, wallVert3D *wallVerts, INT32 texnum,
top = bheight;
else
top = height;
#ifdef ESLOPE
if (solid)
endtop = endbheight;
else
endtop = endheight;
#endif
}
bot = realbot;
#ifdef ESLOPE
endbot = endrealbot;
if (endtop <= endrealbot)
#endif
if (top <= realbot)
return;
......@@ -1168,12 +1289,25 @@ static void HWR_SplitWall(sector_t *sector, wallVert3D *wallVerts, INT32 texnum,
}
Surf->FlatColor.s.alpha = alpha;
wallVerts[3].t = wallVerts[2].t = pegt + ((realtop - top) * pegmul);
wallVerts[0].t = wallVerts[1].t = pegt + ((realtop - bot) * pegmul);
#ifdef ESLOPE
wallVerts[3].t = pegt + ((realtop - top) * pegmul);
wallVerts[2].t = endpegt + ((endrealtop - endtop) * endpegmul);
wallVerts[0].t = pegt + ((realtop - bot) * pegmul);
wallVerts[1].t = endpegt + ((endrealtop - endbot) * endpegmul);
// set top/bottom coords
wallVerts[2].y = wallVerts[3].y = top;
wallVerts[0].y = wallVerts[1].y = bot;
wallVerts[3].y = top;
wallVerts[2].y = endtop;
wallVerts[0].y = bot;
wallVerts[1].y = endbot;
#else
wallVerts[3].t = wallVerts[2].t = pegt + ((realtop - top) * pegmul);
wallVerts[0].t = wallVerts[1].t = pegt + ((realtop - bot) * pegmul);
// set top/bottom coords
wallVerts[2].y = wallVerts[3].y = top;
wallVerts[0].y = wallVerts[1].y = bot;
#endif
glTex = HWR_GetTexture(texnum);
if (cutflag & FF_TRANSLUCENT)
......@@ -1321,11 +1455,19 @@ static void HWR_StoreWallRange(double startfrac, double endfrac)
fixed_t worldtop, worldbottom;
fixed_t worldhigh = 0, worldlow = 0;
#ifdef ESLOPE
fixed_t worldtopslope, worldbottomslope;
fixed_t worldhighslope = 0, worldlowslope = 0;
fixed_t v1x, v1y, v2x, v2y;
#endif
GLTexture_t *grTex = NULL;
float cliplow = 0.0f, cliphigh = 0.0f;
INT32 gr_midtexture;
fixed_t h, l; // 3D sides and 2s middle textures
#ifdef ESLOPE
fixed_t hS, lS;
#endif
FUINT lightnum = 0; // shut up compiler
extracolormap_t *colormap;
......@@ -1337,22 +1479,56 @@ static void HWR_StoreWallRange(double startfrac, double endfrac)
gr_sidedef = gr_curline->sidedef;
gr_linedef = gr_curline->linedef;
vs.x = ((polyvertex_t *)gr_curline->v1)->x;
vs.y = ((polyvertex_t *)gr_curline->v1)->y;
ve.x = ((polyvertex_t *)gr_curline->v2)->x;
ve.y = ((polyvertex_t *)gr_curline->v2)->y;
#ifdef ESLOPE
v1x = FLOAT_TO_FIXED(vs.x);
v1y = FLOAT_TO_FIXED(vs.y);
v2x = FLOAT_TO_FIXED(ve.x);
v2y = FLOAT_TO_FIXED(ve.y);
#endif
if (gr_frontsector->heightsec != -1)
{
#ifdef ESLOPE
worldtop = worldtopslope = sectors[gr_frontsector->heightsec].ceilingheight;
worldbottom = worldbottomslope = sectors[gr_frontsector->heightsec].floorheight;
#else
worldtop = sectors[gr_frontsector->heightsec].ceilingheight;
worldbottom = sectors[gr_frontsector->heightsec].floorheight;
#endif
}
else
{
#ifdef ESLOPE
if (gr_frontsector->c_slope)
{
worldtop = P_GetZAt(gr_frontsector->c_slope, v1x, v1y);
worldtopslope = P_GetZAt(gr_frontsector->c_slope, v2x, v2y);
}
else
{
worldtop = worldtopslope = gr_frontsector->ceilingheight;
}
if (gr_frontsector->f_slope)
{
worldbottom = P_GetZAt(gr_frontsector->f_slope, v1x, v1y);
worldbottomslope = P_GetZAt(gr_frontsector->f_slope, v2x, v2y);
}
else
{
worldbottom = worldbottomslope = gr_frontsector->floorheight;
}
#else
worldtop = gr_frontsector->ceilingheight;
worldbottom = gr_frontsector->floorheight;
#endif
}
vs.x = ((polyvertex_t *)gr_curline->v1)->x;
vs.y = ((polyvertex_t *)gr_curline->v1)->y;
ve.x = ((polyvertex_t *)gr_curline->v2)->x;
ve.y = ((polyvertex_t *)gr_curline->v2)->y;
// remember vertices ordering
// 3--2
// | /|
......@@ -1396,13 +1572,40 @@ static void HWR_StoreWallRange(double startfrac, double endfrac)
// two sided line
if (gr_backsector->heightsec != -1)
{
#ifdef ESLOPE
worldhigh = worldhighslope = sectors[gr_backsector->heightsec].ceilingheight;
worldlow = worldlowslope = sectors[gr_backsector->heightsec].floorheight;
#else
worldhigh = sectors[gr_backsector->heightsec].ceilingheight;
worldlow = sectors[gr_backsector->heightsec].floorheight;
#endif
}
else
{
#ifdef ESLOPE
if (gr_backsector->c_slope)
{
worldhigh = P_GetZAt(gr_backsector->c_slope, v1x, v1y);
worldhighslope = P_GetZAt(gr_backsector->c_slope, v2x, v2y);
}
else
{
worldhigh = worldhighslope = gr_backsector->ceilingheight;
}
if (gr_backsector->f_slope)
{
worldlow = P_GetZAt(gr_backsector->f_slope, v1x, v1y);
worldlowslope = P_GetZAt(gr_backsector->f_slope, v2x, v2y);
}
else
{
worldlow = worldlowslope = gr_backsector->floorheight;
}
#else
worldhigh = gr_backsector->ceilingheight;
worldlow = gr_backsector->floorheight;
#endif
}
// hack to allow height changes in outdoor areas
......@@ -1411,10 +1614,18 @@ static void HWR_StoreWallRange(double startfrac, double endfrac)
gr_backsector->ceilingpic == skyflatnum)
{
worldtop = worldhigh;
#ifdef ESLOPE
worldtopslope = worldhighslope;
#endif
}
// check TOP TEXTURE
if (worldhigh < worldtop && texturetranslation[gr_sidedef->toptexture])
if ((
#ifdef ESLOPE
worldhighslope < worldtopslope ||
#endif
worldhigh < worldtop
) && texturetranslation[gr_sidedef->toptexture])
{
if (drawtextured)
{
......@@ -1425,8 +1636,15 @@ static void HWR_StoreWallRange(double startfrac, double endfrac)
// PEGGING
if (gr_linedef->flags & ML_DONTPEGTOP)
texturevpegtop = 0;
else
#ifdef ESLOPE
else if (gr_linedef->flags & ML_EFFECT1)
texturevpegtop = worldhigh + textureheight[gr_sidedef->toptexture] - worldtop;
else
texturevpegtop = gr_backsector->ceilingheight + textureheight[gr_sidedef->toptexture] - gr_frontsector->ceilingheight;
#else
else
texturevpegtop = worldhigh + textureheight[gr_sidedef->toptexture] - worldtop;
#endif
texturevpegtop += gr_sidedef->rowoffset;
......@@ -1434,14 +1652,46 @@ static void HWR_StoreWallRange(double startfrac, double endfrac)
texturevpegtop %= SHORT(textures[texturetranslation[gr_sidedef->toptexture]]->height)<<FRACBITS;
wallVerts[3].t = wallVerts[2].t = texturevpegtop * grTex->scaleY;
wallVerts[0].t = wallVerts[1].t = (texturevpegtop + worldtop - worldhigh) * grTex->scaleY;
wallVerts[0].t = wallVerts[1].t = (texturevpegtop + gr_frontsector->ceilingheight - gr_backsector->ceilingheight) * grTex->scaleY;
wallVerts[0].s = wallVerts[3].s = cliplow * grTex->scaleX;
wallVerts[2].s = wallVerts[1].s = cliphigh * grTex->scaleX;
#ifdef ESLOPE
// Adjust t value for sloped walls
if (!(gr_linedef->flags & ML_EFFECT1))
{
// Unskewed
wallVerts[3].t -= (worldtop - gr_frontsector->ceilingheight) * grTex->scaleY;
wallVerts[2].t -= (worldtopslope - gr_frontsector->ceilingheight) * grTex->scaleY;
wallVerts[0].t -= (worldhigh - gr_backsector->ceilingheight) * grTex->scaleY;
wallVerts[1].t -= (worldhighslope - gr_backsector->ceilingheight) * grTex->scaleY;
}
else if (gr_linedef->flags & ML_DONTPEGTOP)
{
// Skewed by top
wallVerts[0].t = (texturevpegtop + worldtop - worldhigh) * grTex->scaleY;
wallVerts[1].t = (texturevpegtop + worldtopslope - worldhighslope) * grTex->scaleY;
}
else
{
// Skewed by bottom
wallVerts[0].t = (texturevpegtop + worldhigh - worldtop) * grTex->scaleY;
wallVerts[2].t = wallVerts[3].t - (worldhighslope - worldhigh) * grTex->scaleY;
wallVerts[1].t = wallVerts[2].t - (worldhighslope - worldtopslope) * grTex->scaleY;
}
#endif
}
// set top/bottom coords
#ifdef ESLOPE
wallVerts[3].y = FIXED_TO_FLOAT(worldtop);
wallVerts[0].y = FIXED_TO_FLOAT(worldhigh);
wallVerts[2].y = FIXED_TO_FLOAT(worldtopslope);
wallVerts[1].y = FIXED_TO_FLOAT(worldhighslope);
#else
wallVerts[2].y = wallVerts[3].y = FIXED_TO_FLOAT(worldtop);
wallVerts[0].y = wallVerts[1].y = FIXED_TO_FLOAT(worldhigh);
#endif
if (gr_frontsector->numlights)
HWR_SplitWall(gr_frontsector, wallVerts, texturetranslation[gr_sidedef->toptexture], &Surf, FF_CUTSOLIDS);
......@@ -1452,7 +1702,11 @@ static void HWR_StoreWallRange(double startfrac, double endfrac)
}
// check BOTTOM TEXTURE
if (worldlow > worldbottom && texturetranslation[gr_sidedef->bottomtexture]) //only if VISIBLE!!!
if ((
#ifdef ESLOPE
worldlowslope > worldbottomslope ||
#endif
worldlow > worldbottom) && texturetranslation[gr_sidedef->bottomtexture]) //only if VISIBLE!!!
{
if (drawtextured)
{
......@@ -1461,10 +1715,19 @@ static void HWR_StoreWallRange(double startfrac, double endfrac)
grTex = HWR_GetTexture(texturetranslation[gr_sidedef->bottomtexture]);
// PEGGING
if (gr_linedef->flags & ML_DONTPEGBOTTOM)
#ifdef ESLOPE
if (!(gr_linedef->flags & ML_DONTPEGBOTTOM))
texturevpegbottom = 0;
else if (gr_linedef->flags & ML_EFFECT1)
texturevpegbottom = worldtop - worldlow;
else
texturevpegbottom = 0;
texturevpegbottom = gr_frontsector->ceilingheight - gr_backsector->floorheight;
#else
if (gr_linedef->flags & ML_DONTPEGBOTTOM)
texturevpegbottom = worldtop - worldlow;
else
texturevpegbottom = 0;
#endif
texturevpegbottom += gr_sidedef->rowoffset;
......@@ -1472,14 +1735,46 @@ static void HWR_StoreWallRange(double startfrac, double endfrac)
texturevpegbottom %= SHORT(textures[texturetranslation[gr_sidedef->bottomtexture]]->height)<<FRACBITS;
wallVerts[3].t = wallVerts[2].t = texturevpegbottom * grTex->scaleY;
wallVerts[0].t = wallVerts[1].t = (texturevpegbottom + worldlow - worldbottom) * grTex->scaleY;
wallVerts[0].t = wallVerts[1].t = (texturevpegbottom + gr_backsector->floorheight - gr_frontsector->floorheight) * grTex->scaleY;
wallVerts[0].s = wallVerts[3].s = cliplow * grTex->scaleX;
wallVerts[2].s = wallVerts[1].s = cliphigh * grTex->scaleX;
#ifdef ESLOPE
// Adjust t value for sloped walls
if (!(gr_linedef->flags & ML_EFFECT1))
{
// Unskewed
wallVerts[0].t -= (worldbottom - gr_frontsector->floorheight) * grTex->scaleY;
wallVerts[1].t -= (worldbottomslope - gr_frontsector->floorheight) * grTex->scaleY;
wallVerts[3].t -= (worldlow - gr_backsector->floorheight) * grTex->scaleY;
wallVerts[2].t -= (worldlowslope - gr_backsector->floorheight) * grTex->scaleY;
}
else if (gr_linedef->flags & ML_DONTPEGBOTTOM)
{
// Skewed by bottom
wallVerts[0].t = (texturevpegbottom + worldlow - worldbottom) * grTex->scaleY;
wallVerts[2].t = wallVerts[3].t - (worldlowslope - worldlow) * grTex->scaleY;
wallVerts[1].t = wallVerts[2].t - (worldbottomslope - worldlowslope) * grTex->scaleY;
}
else
{
// Skewed by top
wallVerts[0].t = (texturevpegbottom + worldlow - worldbottom) * grTex->scaleY;
wallVerts[1].t = (texturevpegbottom + worldlowslope - worldbottomslope) * grTex->scaleY;
}
#endif
}
// set top/bottom coords
#ifdef ESLOPE
wallVerts[3].y = FIXED_TO_FLOAT(worldlow);
wallVerts[0].y = FIXED_TO_FLOAT(worldbottom);
wallVerts[2].y = FIXED_TO_FLOAT(worldlowslope);
wallVerts[1].y = FIXED_TO_FLOAT(worldbottomslope);
#else
wallVerts[2].y = wallVerts[3].y = FIXED_TO_FLOAT(worldlow);
wallVerts[0].y = wallVerts[1].y = FIXED_TO_FLOAT(worldbottom);
#endif
if (gr_frontsector->numlights)
HWR_SplitWall(gr_frontsector, wallVerts, texturetranslation[gr_sidedef->bottomtexture], &Surf, FF_CUTSOLIDS);
......@@ -1546,14 +1841,36 @@ static void HWR_StoreWallRange(double startfrac, double endfrac)
popentop = back->ceilingheight;
popenbottom = back->floorheight;
}
#endif
else
{
popentop = front->ceilingheight < back->ceilingheight ? front->ceilingheight : back->ceilingheight;
popenbottom = front->floorheight > back->floorheight ? front->floorheight : back->floorheight;
#endif
{
#ifdef ESLOPE
popentop = min(worldtop, worldhigh);
popenbottom = max(worldbottom, worldlow);
#else
popentop = min(front->ceilingheight, back->ceilingheight);
popenbottom = max(front->floorheight, back->floorheight);
#endif
}
if (gr_linedef->flags & ML_DONTPEGBOTTOM)
#ifdef ESLOPE
if (gr_linedef->flags & ML_EFFECT2)
{
if (!!(gr_linedef->flags & ML_DONTPEGBOTTOM) ^ !!(gr_linedef->flags & ML_EFFECT3))
{
polybottom = max(front->floorheight, back->floorheight) + gr_sidedef->rowoffset;
polytop = polybottom + textureheight[gr_midtexture]*repeats;
}
else
{
polytop = min(front->ceilingheight, back->ceilingheight) + gr_sidedef->rowoffset;
polybottom = polytop - textureheight[gr_midtexture]*repeats;
}
}
else if (!!(gr_linedef->flags & ML_DONTPEGBOTTOM) ^ !!(gr_linedef->flags & ML_EFFECT3))
#else
if (gr_linedef->flags & ML_DONTPEGBOTTOM)
#endif
{
polybottom = popenbottom + gr_sidedef->rowoffset;
polytop = polybottom + textureheight[gr_midtexture]*repeats;
......@@ -1576,17 +1893,21 @@ static void HWR_StoreWallRange(double startfrac, double endfrac)
else
{
// The cut-off values of a linedef can always be constant, since every line has an absoulute front and or back sector
lowcut = front->floorheight > back->floorheight ? front->floorheight : back->floorheight;
highcut = front->ceilingheight < back->ceilingheight ? front->ceilingheight : back->ceilingheight;
lowcut = popenbottom;
highcut = popentop;
}
h = polytop > highcut ? highcut : polytop;
l = polybottom < lowcut ? lowcut : polybottom;
h = min(highcut, polytop);
l = max(polybottom, lowcut);
if (drawtextured)
{
// PEGGING
#ifdef ESLOPE
if (!!(gr_linedef->flags & ML_DONTPEGBOTTOM) ^ !!(gr_linedef->flags & ML_EFFECT3))
#else
if (gr_linedef->flags & ML_DONTPEGBOTTOM)
#endif
texturevpeg = textureheight[gr_sidedef->midtexture]*repeats - h + polybottom;
else
texturevpeg = polytop - h;
......@@ -1605,6 +1926,52 @@ static void HWR_StoreWallRange(double startfrac, double endfrac)
wallVerts[2].y = wallVerts[3].y = FIXED_TO_FLOAT(h);
wallVerts[0].y = wallVerts[1].y = FIXED_TO_FLOAT(l);
#ifdef ESLOPE
// Correct to account for slopes
{
fixed_t midtextureslant;
if (gr_linedef->flags & ML_EFFECT2)
midtextureslant = 0;
else if (!!(gr_linedef->flags & ML_DONTPEGBOTTOM) ^ !!(gr_linedef->flags & ML_EFFECT3))
midtextureslant = worldlow < worldbottom
? worldbottomslope-worldbottom
: worldlowslope-worldlow;
else
midtextureslant = worldtop < worldhigh
? worldtopslope-worldtop
: worldhighslope-worldhigh;
polytop += midtextureslant;
polybottom += midtextureslant;
highcut += worldtop < worldhigh
? worldtopslope-worldtop
: worldhighslope-worldhigh;
lowcut += worldlow < worldbottom
? worldbottomslope-worldbottom
: worldlowslope-worldlow;
// Texture stuff
h = min(highcut, polytop);
l = max(polybottom, lowcut);
if (drawtextured)
{
// PEGGING
if (!!(gr_linedef->flags & ML_DONTPEGBOTTOM) ^ !!(gr_linedef->flags & ML_EFFECT3))
texturevpeg = textureheight[gr_sidedef->midtexture]*repeats - h + polybottom;
else
texturevpeg = polytop - h;
wallVerts[2].t = texturevpeg * grTex->scaleY;
wallVerts[1].t = (h - l + texturevpeg) * grTex->scaleY;
}
wallVerts[2].y = FIXED_TO_FLOAT(h);
wallVerts[1].y = FIXED_TO_FLOAT(l);
}
#endif
// set alpha for transparent walls (new boom and legacy linedef types)
// ooops ! this do not work at all because render order we should render it in backtofront order
switch (gr_linedef->special)
......@@ -1785,6 +2152,11 @@ static void HWR_StoreWallRange(double startfrac, double endfrac)
{
fixed_t texturevpeg;
// PEGGING
#ifdef ESLOPE
if ((gr_linedef->flags & (ML_DONTPEGBOTTOM|ML_EFFECT2)) == (ML_DONTPEGBOTTOM|ML_EFFECT2))
texturevpeg = gr_frontsector->floorheight + textureheight[gr_sidedef->midtexture] - gr_frontsector->ceilingheight + gr_sidedef->rowoffset;
else
#endif
if (gr_linedef->flags & ML_DONTPEGBOTTOM)
texturevpeg = worldbottom + textureheight[gr_sidedef->midtexture] - worldtop + gr_sidedef->rowoffset;
else
......@@ -1794,14 +2166,37 @@ static void HWR_StoreWallRange(double startfrac, double endfrac)
grTex = HWR_GetTexture(gr_midtexture);
wallVerts[3].t = wallVerts[2].t = texturevpeg * grTex->scaleY;
wallVerts[0].t = wallVerts[1].t = (texturevpeg + worldtop - worldbottom) * grTex->scaleY;
wallVerts[0].t = wallVerts[1].t = (texturevpeg + gr_frontsector->ceilingheight - gr_frontsector->floorheight) * grTex->scaleY;
wallVerts[0].s = wallVerts[3].s = cliplow * grTex->scaleX;
wallVerts[2].s = wallVerts[1].s = cliphigh * grTex->scaleX;
#ifdef ESLOPE
// Texture correction for slopes
if (gr_linedef->flags & ML_EFFECT2) {
wallVerts[3].t += (gr_frontsector->ceilingheight - worldtop) * grTex->scaleY;
wallVerts[2].t += (gr_frontsector->ceilingheight - worldtopslope) * grTex->scaleY;
wallVerts[0].t += (gr_frontsector->floorheight - worldbottom) * grTex->scaleY;
wallVerts[1].t += (gr_frontsector->floorheight - worldbottomslope) * grTex->scaleY;
} else if (gr_linedef->flags & ML_DONTPEGBOTTOM) {
wallVerts[3].t = wallVerts[0].t + (worldbottom-worldtop) * grTex->scaleY;
wallVerts[2].t = wallVerts[1].t + (worldbottomslope-worldtopslope) * grTex->scaleY;
} else {
wallVerts[0].t = wallVerts[3].t - (worldbottom-worldtop) * grTex->scaleY;
wallVerts[1].t = wallVerts[2].t - (worldbottomslope-worldtopslope) * grTex->scaleY;
}
#endif
}
#ifdef ESLOPE
//Set textures properly on single sided walls that are sloped
wallVerts[3].y = FIXED_TO_FLOAT(worldtop);
wallVerts[0].y = FIXED_TO_FLOAT(worldbottom);
wallVerts[2].y = FIXED_TO_FLOAT(worldtopslope);
wallVerts[1].y = FIXED_TO_FLOAT(worldbottomslope);
#else
// set top/bottom coords
wallVerts[2].y = wallVerts[3].y = FIXED_TO_FLOAT(worldtop);
wallVerts[0].y = wallVerts[1].y = FIXED_TO_FLOAT(worldbottom);
#endif
// I don't think that solid walls can use translucent linedef types...
if (gr_frontsector->numlights)
HWR_SplitWall(gr_frontsector, wallVerts, gr_midtexture, &Surf, FF_CUTSOLIDS);
......@@ -1834,6 +2229,8 @@ static void HWR_StoreWallRange(double startfrac, double endfrac)
INT32 texnum;
line_t * newline = NULL; // Multi-Property FOF
///TODO add slope support (fixing cutoffs, proper wall clipping) - maybe just disable highcut/lowcut if either sector or FOF has a slope
/// to allow fun plane intersecting in OGL? But then people would abuse that and make software look bad. :C
highcut = gr_frontsector->ceilingheight < gr_backsector->ceilingheight ? gr_frontsector->ceilingheight : gr_backsector->ceilingheight;
lowcut = gr_frontsector->floorheight > gr_backsector->floorheight ? gr_frontsector->floorheight : gr_backsector->floorheight;
......@@ -1855,6 +2252,24 @@ static void HWR_StoreWallRange(double startfrac, double endfrac)
texnum = texturetranslation[sides[newline->sidenum[0]].midtexture];
}
#ifdef ESLOPE
h = *rover->t_slope ? P_GetZAt(*rover->t_slope, v1x, v1y) : *rover->topheight;
hS = *rover->t_slope ? P_GetZAt(*rover->t_slope, v2x, v2y) : *rover->topheight;
l = *rover->b_slope ? P_GetZAt(*rover->b_slope, v1x, v1y) : *rover->bottomheight;
lS = *rover->b_slope ? P_GetZAt(*rover->b_slope, v2x, v2y) : *rover->bottomheight;
if (!(*rover->t_slope) && !gr_frontsector->c_slope && !gr_backsector->c_slope && h > highcut)
h = hS = highcut;
if (!(*rover->b_slope) && !gr_frontsector->f_slope && !gr_backsector->f_slope && l < lowcut)
l = lS = lowcut;
//Hurdler: HW code starts here
//FIXME: check if peging is correct
// set top/bottom coords
wallVerts[3].y = FIXED_TO_FLOAT(h);
wallVerts[2].y = FIXED_TO_FLOAT(hS);
wallVerts[0].y = FIXED_TO_FLOAT(l);
wallVerts[1].y = FIXED_TO_FLOAT(lS);
#else
h = *rover->topheight;
l = *rover->bottomheight;
if (h > highcut)
......@@ -1866,6 +2281,7 @@ static void HWR_StoreWallRange(double startfrac, double endfrac)
// set top/bottom coords
wallVerts[2].y = wallVerts[3].y = FIXED_TO_FLOAT(h);
wallVerts[0].y = wallVerts[1].y = FIXED_TO_FLOAT(l);
#endif
if (rover->flags & FF_FOG)
{
wallVerts[3].t = wallVerts[2].t = 0;
......@@ -1875,6 +2291,15 @@ static void HWR_StoreWallRange(double startfrac, double endfrac)
}
else if (drawtextured)
{
#ifdef ESLOPE // P.S. this is better-organized than the old version
fixed_t offs = sides[(newline ?: rover->master)->sidenum[0]].rowoffset;
grTex = HWR_GetTexture(texnum);
wallVerts[3].t = (*rover->topheight - h + offs) * grTex->scaleY;
wallVerts[2].t = (*rover->topheight - hS + offs) * grTex->scaleY;
wallVerts[0].t = (*rover->topheight - l + offs) * grTex->scaleY;
wallVerts[1].t = (*rover->topheight - lS + offs) * grTex->scaleY;
#else
grTex = HWR_GetTexture(texnum);
if (newline)
......@@ -1887,6 +2312,7 @@ static void HWR_StoreWallRange(double startfrac, double endfrac)
wallVerts[3].t = wallVerts[2].t = (*rover->topheight - h + sides[rover->master->sidenum[0]].rowoffset) * grTex->scaleY;
wallVerts[0].t = wallVerts[1].t = (h - l + (*rover->topheight - h + sides[rover->master->sidenum[0]].rowoffset)) * grTex->scaleY;
}
#endif
wallVerts[0].s = wallVerts[3].s = cliplow * grTex->scaleX;
wallVerts[2].s = wallVerts[1].s = cliphigh * grTex->scaleX;
......@@ -1959,7 +2385,24 @@ static void HWR_StoreWallRange(double startfrac, double endfrac)
newline = rover->master->frontsector->lines[0] + linenum;
texnum = texturetranslation[sides[newline->sidenum[0]].midtexture];
}
#ifdef ESLOPE //backsides
h = *rover->t_slope ? P_GetZAt(*rover->t_slope, v1x, v1y) : *rover->topheight;
hS = *rover->t_slope ? P_GetZAt(*rover->t_slope, v2x, v2y) : *rover->topheight;
l = *rover->b_slope ? P_GetZAt(*rover->b_slope, v1x, v1y) : *rover->bottomheight;
lS = *rover->b_slope ? P_GetZAt(*rover->b_slope, v2x, v2y) : *rover->bottomheight;
if (!(*rover->t_slope) && !gr_frontsector->c_slope && !gr_backsector->c_slope && h > highcut)
h = hS = highcut;
if (!(*rover->b_slope) && !gr_frontsector->f_slope && !gr_backsector->f_slope && l < lowcut)
l = lS = lowcut;
//Hurdler: HW code starts here
//FIXME: check if peging is correct
// set top/bottom coords
wallVerts[3].y = FIXED_TO_FLOAT(h);
wallVerts[2].y = FIXED_TO_FLOAT(hS);
wallVerts[0].y = FIXED_TO_FLOAT(l);
wallVerts[1].y = FIXED_TO_FLOAT(lS);
#else
h = *rover->topheight;
l = *rover->bottomheight;
if (h > highcut)
......@@ -1971,7 +2414,7 @@ static void HWR_StoreWallRange(double startfrac, double endfrac)
// set top/bottom coords
wallVerts[2].y = wallVerts[3].y = FIXED_TO_FLOAT(h);
wallVerts[0].y = wallVerts[1].y = FIXED_TO_FLOAT(l);
#endif
if (rover->flags & FF_FOG)
{
wallVerts[3].t = wallVerts[2].t = 0;
......@@ -2465,13 +2908,17 @@ static void HWR_AddLine(seg_t * line)
// and no middle texture.
if (
#ifdef POLYOBJECTS
!line->polyseg
!line->polyseg &&
#endif
gr_backsector->ceilingpic == gr_frontsector->ceilingpic
&& gr_backsector->floorpic == gr_frontsector->floorpic
#ifdef ESLOPE
&& gr_backsector->f_slope == gr_frontsector->f_slope
&& gr_backsector->c_slope == gr_frontsector->c_slope
#endif
&& gr_backsector->ceilingpic == gr_frontsector->ceilingpic
&& gr_backsector->floorpic == gr_frontsector->floorpic
&& gr_backsector->lightlevel == gr_frontsector->lightlevel
&& gr_curline->sidedef->midtexture == 0
&& !gr_backsector->ffloors && !gr_frontsector->ffloors)
&& gr_curline->sidedef->midtexture == 0
&& !gr_backsector->ffloors && !gr_frontsector->ffloors)
// SoM: For 3D sides... Boris, would you like to take a
// crack at rendering 3D sides? You would need to add the
// above check and add code to HWR_StoreWallRange...
......@@ -2865,6 +3312,7 @@ static void HWR_Subsector(size_t num)
INT32 floorlightlevel;
INT32 ceilinglightlevel;
INT32 locFloorHeight, locCeilingHeight;
INT32 cullFloorHeight, cullCeilingHeight;
INT32 light = 0;
extracolormap_t *floorcolormap;
extracolormap_t *ceilingcolormap;
......@@ -2921,26 +3369,41 @@ static void HWR_Subsector(size_t num)
// ----- for special tricks with HW renderer -----
if (gr_frontsector->pseudoSector)
{
locFloorHeight = gr_frontsector->virtualFloorheight;
locCeilingHeight = gr_frontsector->virtualCeilingheight;
cullFloorHeight = locFloorHeight = gr_frontsector->virtualFloorheight;
cullCeilingHeight = locCeilingHeight = gr_frontsector->virtualCeilingheight;
}
else if (gr_frontsector->virtualFloor)
{
locFloorHeight = gr_frontsector->virtualFloorheight;
///@TODO Is this whole virtualFloor mess even useful? I don't think it even triggers ever.
cullFloorHeight = locFloorHeight = gr_frontsector->virtualFloorheight;
if (gr_frontsector->virtualCeiling)
locCeilingHeight = gr_frontsector->virtualCeilingheight;
cullCeilingHeight = locCeilingHeight = gr_frontsector->virtualCeilingheight;
else
locCeilingHeight = gr_frontsector->ceilingheight;
cullCeilingHeight = locCeilingHeight = gr_frontsector->ceilingheight;
}
else if (gr_frontsector->virtualCeiling)
{
locCeilingHeight = gr_frontsector->virtualCeilingheight;
locFloorHeight = gr_frontsector->floorheight;
cullCeilingHeight = locCeilingHeight = gr_frontsector->virtualCeilingheight;
cullFloorHeight = locFloorHeight = gr_frontsector->floorheight;
}
else
{
locFloorHeight = gr_frontsector->floorheight;
locCeilingHeight = gr_frontsector->ceilingheight;
cullFloorHeight = locFloorHeight = gr_frontsector->floorheight;
cullCeilingHeight = locCeilingHeight = gr_frontsector->ceilingheight;
#ifdef ESLOPE
if (gr_frontsector->f_slope)
{
cullFloorHeight = P_GetZAt(gr_frontsector->f_slope, viewx, viewy);
locFloorHeight = P_GetZAt(gr_frontsector->f_slope, gr_frontsector->soundorg.x, gr_frontsector->soundorg.y);
}
if (gr_frontsector->c_slope)
{
cullCeilingHeight = P_GetZAt(gr_frontsector->c_slope, viewx, viewy);
locCeilingHeight = P_GetZAt(gr_frontsector->c_slope, gr_frontsector->soundorg.x, gr_frontsector->soundorg.y);
}
#endif
}
// ----- end special tricks -----
......@@ -2971,14 +3434,18 @@ static void HWR_Subsector(size_t num)
// render floor ?
#ifdef DOPLANES
// yeah, easy backface cull! :)
if (locFloorHeight < dup_viewz)
if (cullFloorHeight < dup_viewz)
{
if (gr_frontsector->floorpic != skyflatnum)
{
if (sub->validcount != validcount)
{
HWR_GetFlat(levelflats[gr_frontsector->floorpic].lumpnum);
HWR_RenderPlane(gr_frontsector, &extrasubsectors[num], locFloorHeight, PF_Occlude, floorlightlevel, levelflats[gr_frontsector->floorpic].lumpnum, NULL, 255, false, floorcolormap);
HWR_RenderPlane(gr_frontsector, &extrasubsectors[num],
// Hack to make things continue to work around slopes.
locFloorHeight == cullFloorHeight ? locFloorHeight : gr_frontsector->floorheight,
// We now return you to your regularly scheduled rendering.
PF_Occlude, floorlightlevel, levelflats[gr_frontsector->floorpic].lumpnum, NULL, 255, false, floorcolormap);
}
}
else
......@@ -2989,14 +3456,18 @@ static void HWR_Subsector(size_t num)
}
}
if (locCeilingHeight > dup_viewz)
if (cullCeilingHeight > dup_viewz)
{
if (gr_frontsector->ceilingpic != skyflatnum)
{
if (sub->validcount != validcount)
{
HWR_GetFlat(levelflats[gr_frontsector->ceilingpic].lumpnum);
HWR_RenderPlane(NULL, &extrasubsectors[num], locCeilingHeight, PF_Occlude, ceilinglightlevel, levelflats[gr_frontsector->ceilingpic].lumpnum,NULL, 255, false, ceilingcolormap);
HWR_RenderPlane(NULL, &extrasubsectors[num],
// Hack to make things continue to work around slopes.
locCeilingHeight == cullCeilingHeight ? locCeilingHeight : gr_frontsector->ceilingheight,
// We now return you to your regularly scheduled rendering.
PF_Occlude, ceilinglightlevel, levelflats[gr_frontsector->ceilingpic].lumpnum,NULL, 255, false, ceilingcolormap);
}
}
else
......@@ -3025,22 +3496,34 @@ static void HWR_Subsector(size_t num)
for (rover = gr_frontsector->ffloors;
rover; rover = rover->next)
{
fixed_t cullHeight, centerHeight;
// bottom plane
#ifdef ESLOPE
if (*rover->b_slope)
{
cullHeight = P_GetZAt(*rover->b_slope, viewx, viewy);
centerHeight = P_GetZAt(*rover->b_slope, gr_frontsector->soundorg.x, gr_frontsector->soundorg.y);
}
else
#endif
cullHeight = centerHeight = *rover->bottomheight;
if (!(rover->flags & FF_EXISTS) || !(rover->flags & FF_RENDERPLANES))
continue;
if (sub->validcount == validcount)
continue;
if (*rover->bottomheight <= gr_frontsector->ceilingheight &&
*rover->bottomheight >= gr_frontsector->floorheight &&
((dup_viewz < *rover->bottomheight && !(rover->flags & FF_INVERTPLANES)) ||
(dup_viewz > *rover->bottomheight && (rover->flags & FF_BOTHPLANES || rover->flags & FF_INVERTPLANES))))
if (centerHeight <= locCeilingHeight &&
centerHeight >= locFloorHeight &&
((dup_viewz < cullHeight && !(rover->flags & FF_INVERTPLANES)) ||
(dup_viewz > cullHeight && (rover->flags & FF_BOTHPLANES || rover->flags & FF_INVERTPLANES))))
{
if (rover->flags & FF_FOG)
{
UINT8 alpha;
light = R_GetPlaneLight(gr_frontsector, *rover->bottomheight, dup_viewz < *rover->bottomheight ? true : false);
light = R_GetPlaneLight(gr_frontsector, centerHeight, dup_viewz < cullHeight ? true : false);
if (rover->master->frontsector->extra_colormap)
alpha = HWR_FogBlockAlpha(*gr_frontsector->lightlist[light].lightlevel, rover->master->frontsector->extra_colormap->rgba, rover->master->frontsector->extra_colormap->fadergba);
......@@ -3056,7 +3539,7 @@ static void HWR_Subsector(size_t num)
}
else if (rover->flags & FF_TRANSLUCENT) // SoM: Flags are more efficient
{
light = R_GetPlaneLight(gr_frontsector, *rover->bottomheight, dup_viewz < *rover->bottomheight ? true : false);
light = R_GetPlaneLight(gr_frontsector, centerHeight, dup_viewz < cullHeight ? true : false);
#ifndef SORTING
HWR_Add3DWater(levelflats[*rover->bottompic].lumpnum,
&extrasubsectors[num],
......@@ -3075,21 +3558,33 @@ static void HWR_Subsector(size_t num)
else
{
HWR_GetFlat(levelflats[*rover->bottompic].lumpnum);
light = R_GetPlaneLight(gr_frontsector, *rover->bottomheight, dup_viewz < *rover->bottomheight ? true : false);
light = R_GetPlaneLight(gr_frontsector, centerHeight, dup_viewz < cullHeight ? true : false);
HWR_RenderPlane(NULL, &extrasubsectors[num], *rover->bottomheight, PF_Occlude, *gr_frontsector->lightlist[light].lightlevel, levelflats[*rover->bottompic].lumpnum,
rover->master->frontsector, 255, false, gr_frontsector->lightlist[light].extra_colormap);
}
}
if (*rover->topheight >= gr_frontsector->floorheight &&
*rover->topheight <= gr_frontsector->ceilingheight &&
((dup_viewz > *rover->topheight && !(rover->flags & FF_INVERTPLANES)) ||
(dup_viewz < *rover->topheight && (rover->flags & FF_BOTHPLANES || rover->flags & FF_INVERTPLANES))))
// top plane
#ifdef ESLOPE
if (*rover->t_slope)
{
cullHeight = P_GetZAt(*rover->t_slope, viewx, viewy);
centerHeight = P_GetZAt(*rover->t_slope, gr_frontsector->soundorg.x, gr_frontsector->soundorg.y);
}
else
#endif
cullHeight = centerHeight = *rover->topheight;
if (centerHeight >= locFloorHeight &&
centerHeight <= locCeilingHeight &&
((dup_viewz > cullHeight && !(rover->flags & FF_INVERTPLANES)) ||
(dup_viewz < cullHeight && (rover->flags & FF_BOTHPLANES || rover->flags & FF_INVERTPLANES))))
{
if (rover->flags & FF_FOG)
{
UINT8 alpha;
light = R_GetPlaneLight(gr_frontsector, *rover->topheight, dup_viewz < *rover->topheight ? true : false);
light = R_GetPlaneLight(gr_frontsector, centerHeight, dup_viewz < cullHeight ? true : false);
if (rover->master->frontsector->extra_colormap)
alpha = HWR_FogBlockAlpha(*gr_frontsector->lightlist[light].lightlevel, rover->master->frontsector->extra_colormap->rgba, rover->master->frontsector->extra_colormap->fadergba);
......@@ -3105,7 +3600,7 @@ static void HWR_Subsector(size_t num)
}
else if (rover->flags & FF_TRANSLUCENT)
{
light = R_GetPlaneLight(gr_frontsector, *rover->topheight, dup_viewz < *rover->topheight ? true : false);
light = R_GetPlaneLight(gr_frontsector, centerHeight, dup_viewz < cullHeight ? true : false);
#ifndef SORTING
HWR_Add3DWater(levelflats[*rover->toppic].lumpnum,
&extrasubsectors[num],
......@@ -3125,7 +3620,7 @@ static void HWR_Subsector(size_t num)
else
{
HWR_GetFlat(levelflats[*rover->toppic].lumpnum);
light = R_GetPlaneLight(gr_frontsector, *rover->topheight, dup_viewz < *rover->topheight ? true : false);
light = R_GetPlaneLight(gr_frontsector, centerHeight, dup_viewz < cullHeight ? true : false);
HWR_RenderPlane(NULL, &extrasubsectors[num], *rover->topheight, PF_Occlude, *gr_frontsector->lightlist[light].lightlevel, levelflats[*rover->toppic].lumpnum,
rover->master->frontsector, 255, false, gr_frontsector->lightlist[light].extra_colormap);
}
......@@ -4003,11 +4498,11 @@ static void HWR_SortVisSprites(void)
gr_vsprsortedhead.next = gr_vsprsortedhead.prev = &gr_vsprsortedhead;
for (i = 0; i < gr_visspritecount; i++)
{
bestdist = ZCLIP_PLANE-1;
best = NULL;
bestdispoffset = INT32_MAX;
for (ds = unsorted.next; ds != &unsorted; ds = ds->next)
{
if (ds->tz > bestdist)
if (!best || ds->tz > bestdist)
{
bestdist = ds->tz;
bestdispoffset = ds->dispoffset;
......@@ -4522,7 +5017,7 @@ static void HWR_ProjectSprite(mobj_t *thing)
tz = (tr_x * gr_viewcos) + (tr_y * gr_viewsin);
// thing is behind view plane?
if (tz < ZCLIP_PLANE)
if (tz < ZCLIP_PLANE && (!cv_grmd2.value || md2_models[thing->sprite].notfound == true)) //Yellow: Only MD2's dont disappear
return;
tx = (tr_x * gr_viewsin) - (tr_y * gr_viewcos);
......
......@@ -1346,248 +1346,6 @@ static void HWR_GetBlendedTexture(GLPatch_t *gpatch, GLPatch_t *blendgpatch, con
Z_ChangeTag(newmip->grInfo.data, PU_HWRCACHE_UNLOCKED);
}
static void HWR_CreateBlendedTexture(GLPatch_t *gpatch, GLPatch_t *blendgpatch, GLMipmap_t *grmip, skincolors_t color)
{
UINT16 w = gpatch->width, h = gpatch->height;
UINT32 size = w*h;
RGBA_t *image, *blendimage, *cur, blendcolor;
if (grmip->width == 0)
{
grmip->width = gpatch->width;
grmip->height = gpatch->height;
// no wrap around, no chroma key
grmip->flags = 0;
// setup the texture info
grmip->grInfo.format = GR_RGBA;
}
Z_Free(grmip->grInfo.data);
grmip->grInfo.data = NULL;
cur = Z_Malloc(size*4, PU_HWRCACHE, &grmip->grInfo.data);
memset(cur, 0x00, size*4);
image = gpatch->mipmap.grInfo.data;
blendimage = blendgpatch->mipmap.grInfo.data;
switch (color)
{
case SKINCOLOR_WHITE:
blendcolor = V_GetColor(3);
break;
case SKINCOLOR_SILVER:
blendcolor = V_GetColor(10);
break;
case SKINCOLOR_GREY:
blendcolor = V_GetColor(15);
break;
case SKINCOLOR_BLACK:
blendcolor = V_GetColor(27);
break;
case SKINCOLOR_CYAN:
blendcolor = V_GetColor(215);
break;
case SKINCOLOR_TEAL:
blendcolor = V_GetColor(221);
break;
case SKINCOLOR_STEELBLUE:
blendcolor = V_GetColor(203);
break;
case SKINCOLOR_BLUE:
blendcolor = V_GetColor(232);
break;
case SKINCOLOR_PEACH:
blendcolor = V_GetColor(71);
break;
case SKINCOLOR_TAN:
blendcolor = V_GetColor(79);
break;
case SKINCOLOR_PINK:
blendcolor = V_GetColor(147);
break;
case SKINCOLOR_LAVENDER:
blendcolor = V_GetColor(251);
break;
case SKINCOLOR_PURPLE:
blendcolor = V_GetColor(195);
break;
case SKINCOLOR_ORANGE:
blendcolor = V_GetColor(87);
break;
case SKINCOLOR_ROSEWOOD:
blendcolor = V_GetColor(94);
break;
case SKINCOLOR_BEIGE:
blendcolor = V_GetColor(40);
break;
case SKINCOLOR_BROWN:
blendcolor = V_GetColor(57);
break;
case SKINCOLOR_RED:
blendcolor = V_GetColor(130);
break;
case SKINCOLOR_DARKRED:
blendcolor = V_GetColor(139);
break;
case SKINCOLOR_NEONGREEN:
blendcolor = V_GetColor(184);
break;
case SKINCOLOR_GREEN:
blendcolor = V_GetColor(166);
break;
case SKINCOLOR_ZIM:
blendcolor = V_GetColor(180);
break;
case SKINCOLOR_OLIVE:
blendcolor = V_GetColor(108);
break;
case SKINCOLOR_YELLOW:
blendcolor = V_GetColor(104);
break;
case SKINCOLOR_GOLD:
blendcolor = V_GetColor(115);
break;
case SKINCOLOR_SUPER1:
blendcolor = V_GetColor(97);
break;
case SKINCOLOR_SUPER2:
blendcolor = V_GetColor(100);
break;
case SKINCOLOR_SUPER3:
blendcolor = V_GetColor(103);
break;
case SKINCOLOR_SUPER4:
blendcolor = V_GetColor(113);
break;
case SKINCOLOR_SUPER5:
blendcolor = V_GetColor(116);
break;
case SKINCOLOR_TSUPER1:
blendcolor = V_GetColor(81);
break;
case SKINCOLOR_TSUPER2:
blendcolor = V_GetColor(82);
break;
case SKINCOLOR_TSUPER3:
blendcolor = V_GetColor(84);
break;
case SKINCOLOR_TSUPER4:
blendcolor = V_GetColor(85);
break;
case SKINCOLOR_TSUPER5:
blendcolor = V_GetColor(87);
break;
case SKINCOLOR_KSUPER1:
blendcolor = V_GetColor(122);
break;
case SKINCOLOR_KSUPER2:
blendcolor = V_GetColor(123);
break;
case SKINCOLOR_KSUPER3:
blendcolor = V_GetColor(124);
break;
case SKINCOLOR_KSUPER4:
blendcolor = V_GetColor(125);
break;
case SKINCOLOR_KSUPER5:
blendcolor = V_GetColor(126);
break;
default:
blendcolor = V_GetColor(247);
break;
}
while (size--)
{
if (blendimage->s.alpha == 0)
{
// Don't bother with blending the pixel if the alpha of the blend pixel is 0
cur->rgba = image->rgba;
}
else
{
INT32 tempcolor;
INT16 tempmult, tempalpha;
tempalpha = -(abs(blendimage->s.red-127)-127)*2;
if (tempalpha > 255)
tempalpha = 255;
else if (tempalpha < 0)
tempalpha = 0;
tempmult = (blendimage->s.red-127)*2;
if (tempmult > 255)
tempmult = 255;
else if (tempmult < 0)
tempmult = 0;
tempcolor = (image->s.red*(255-blendimage->s.alpha))/255 + ((tempmult + ((tempalpha*blendcolor.s.red)/255)) * blendimage->s.alpha)/255;
cur->s.red = (UINT8)tempcolor;
tempcolor = (image->s.green*(255-blendimage->s.alpha))/255 + ((tempmult + ((tempalpha*blendcolor.s.green)/255)) * blendimage->s.alpha)/255;
cur->s.green = (UINT8)tempcolor;
tempcolor = (image->s.blue*(255-blendimage->s.alpha))/255 + ((tempmult + ((tempalpha*blendcolor.s.blue)/255)) * blendimage->s.alpha)/255;
cur->s.blue = (UINT8)tempcolor;
cur->s.alpha = image->s.alpha;
}
cur++; image++; blendimage++;
}
return;
}
static void HWR_GetBlendedTexture(GLPatch_t *gpatch, GLPatch_t *blendgpatch, const UINT8 *colormap, skincolors_t color)
{
// mostly copied from HWR_GetMappedPatch, hence the similarities and comment
GLMipmap_t *grmip, *newmip;
if (colormap == colormaps || colormap == NULL)
{
// Don't do any blending
HWD.pfnSetTexture(&gpatch->mipmap);
return;
}
// search for the mimmap
// skip the first (no colormap translated)
for (grmip = &gpatch->mipmap; grmip->nextcolormap; )
{
grmip = grmip->nextcolormap;
if (grmip->colormap == colormap)
{
if (grmip->downloaded && grmip->grInfo.data)
{
HWD.pfnSetTexture(grmip); // found the colormap, set it to the correct texture
Z_ChangeTag(grmip->grInfo.data, PU_HWRCACHE_UNLOCKED);
return;
}
}
}
// If here, the blended texture has not been created
// So we create it
//BP: WARNING: don't free it manually without clearing the cache of harware renderer
// (it have a liste of mipmap)
// this malloc is cleared in HWR_FreeTextureCache
// (...) unfortunately z_malloc fragment alot the memory :(so malloc is better
newmip = calloc(1, sizeof (*newmip));
if (newmip == NULL)
I_Error("%s: Out of memory", "HWR_GetMappedPatch");
grmip->nextcolormap = newmip;
newmip->colormap = colormap;
HWR_CreateBlendedTexture(gpatch, blendgpatch, newmip, color);
HWD.pfnSetTexture(newmip);
Z_ChangeTag(newmip->grInfo.data, PU_HWRCACHE_UNLOCKED);
}
// -----------------+
// HWR_DrawMD2 : Draw MD2
......
......@@ -26,7 +26,7 @@
#pragma warning(disable : 4214 4244)
#endif
#include "SDL_opengl.h" //Alam_GBC: Simple, yes?
#include <SDL2/SDL_opengl.h> //Alam_GBC: Simple, yes?
#ifdef _MSC_VER
#pragma warning(default : 4214 4244)
......
......@@ -14,6 +14,7 @@
#include "r_defs.h"
#include "d_player.h"
#include "blua/lua.h"
enum hook {
hook_NetVars=0,
......@@ -47,6 +48,7 @@ enum hook {
};
extern const char *const hookNames[];
void LUAh_NetArchiveHook(lua_CFunction archFunc);
void LUAh_MapChange(void); // Hook for map change (before load)
void LUAh_MapLoad(void); // Hook for map load
void LUAh_PlayerJoin(int playernum); // Hook for Got_AddPlayer
......
......@@ -173,6 +173,34 @@ int LUA_HookLib(lua_State *L)
return 0;
}
void LUAh_NetArchiveHook(lua_CFunction archFunc)
{
int TABLESINDEX;
hook_p hookp;
if (!gL)
return;
TABLESINDEX = lua_gettop(gL);
lua_settop(gL, 0);
lua_pushvalue(gL, TABLESINDEX);
lua_pushcclosure(gL, archFunc, 1);
lua_pushnil(gL);
for (hookp = roothook; hookp; hookp = hookp->next)
if (hookp->type == hook_NetVars)
{
lua_pushfstring(gL, FMT_HOOKID, hookp->id);
lua_gettable(gL, LUA_REGISTRYINDEX);
lua_pushvalue(gL, -2);
LUA_Call(gL, 1);
}
lua_pop(gL, 2);
}
boolean LUAh_MobjHook(mobj_t *mo, enum hook which)
{
hook_p hookp;
......
......@@ -915,30 +915,6 @@ static void UnArchiveTables(void)
}
}
static void NetArchiveHook(lua_CFunction archFunc)
{
int TABLESINDEX;
if (!gL)
return;
TABLESINDEX = lua_gettop(gL);
lua_getfield(gL, LUA_REGISTRYINDEX, "hook");
I_Assert(lua_istable(gL, -1));
lua_rawgeti(gL, -1, hook_NetVars);
lua_remove(gL, -2);
I_Assert(lua_istable(gL, -1));
lua_pushvalue(gL, TABLESINDEX);
lua_pushcclosure(gL, archFunc, 1);
lua_pushnil(gL);
while (lua_next(gL, -3) != 0) {
lua_pushvalue(gL, -3); // function
LUA_Call(gL, 1);
}
lua_pop(gL, 2);
}
void LUA_Step(void)
{
if (!gL)
......@@ -972,7 +948,7 @@ void LUA_Archive(void)
}
WRITEUINT32(save_p, UINT32_MAX); // end of mobjs marker, replaces mobjnum.
NetArchiveHook(NetArchive); // call the NetArchive hook in archive mode
LUAh_NetArchiveHook(NetArchive); // call the NetArchive hook in archive mode
ArchiveTables();
if (gL)
......@@ -1003,7 +979,7 @@ void LUA_UnArchive(void)
UnArchiveExtVars(th); // apply variables
} while(mobjnum != UINT32_MAX); // repeat until end of mobjs marker.
NetArchiveHook(NetUnArchive); // call the NetArchive hook in unarchive mode
LUAh_NetArchiveHook(NetUnArchive); // call the NetArchive hook in unarchive mode
UnArchiveTables();
if (gL)
......
......@@ -31,8 +31,8 @@
// angle_t casting
// we reduce the angle to a fixed point between 0.0 and 1.0
#define luaL_checkangle(L, i) (((angle_t)(luaL_checkfixed(L, i)&0xFFFF))<<16)
#define lua_pushangle(L, a) lua_pushfixed(L, a>>16)
#define luaL_checkangle(L, i) (((angle_t)(luaL_checkfixed(L, i)&0xFFFFFFFF))<<0)
#define lua_pushangle(L, a) lua_pushfixed(L, a>>0)
#ifdef _DEBUG
void LUA_ClearExtVars(void);
......
......@@ -389,6 +389,7 @@ CV_PossibleValue_t gametype_cons_t[] =
{GT_CTF, "CTF"},
{0, NULL}
};
CV_PossibleValue_t gametype_cons_t_thokker[] = {{GT_TEAMMATCH, "Thokker"}};
consvar_t cv_newgametype = {"newgametype", "Co-op", CV_HIDEN|CV_CALL, gametype_cons_t, Newgametype_OnChange, 0, NULL, NULL, 0, 0, NULL};
static CV_PossibleValue_t serversort_cons_t[] = {
......@@ -2676,6 +2677,11 @@ void M_Ticker(void)
//
void M_Init(void)
{
if (M_CheckParm("-nothokker") == 0) {
cv_newgametype.PossibleValue = gametype_cons_t_thokker;
cv_newgametype.defaultvalue = "Thokker";
}
CV_RegisterVar(&cv_nextmap);
CV_RegisterVar(&cv_newgametype);
CV_RegisterVar(&cv_chooseskin);
......
......@@ -46,14 +46,14 @@ static pslope_t *slopelist = NULL;
static UINT16 slopecount = 0;
// Calculate line normal
static void P_CalculateSlopeNormal(pslope_t *slope) {
void P_CalculateSlopeNormal(pslope_t *slope) {
slope->normal.z = FINECOSINE(slope->zangle>>ANGLETOFINESHIFT);
slope->normal.x = -FixedMul(FINESINE(slope->zangle>>ANGLETOFINESHIFT), slope->d.x);
slope->normal.y = -FixedMul(FINESINE(slope->zangle>>ANGLETOFINESHIFT), slope->d.y);
}
// With a vertex slope that has its vertices set, configure relevant slope info
static void P_ReconfigureVertexSlope(pslope_t *slope)
void P_ReconfigureVertexSlope(pslope_t *slope)
{
vector3_t vec1, vec2;
......@@ -543,7 +543,7 @@ void P_SpawnSlope_Line(int linenum)
//
// Creates a new slope from three vertices with the specified IDs
//
static pslope_t *P_NewVertexSlope(INT16 tag1, INT16 tag2, INT16 tag3, UINT8 flags)
pslope_t *P_NewVertexSlope(INT16 tag1, INT16 tag2, INT16 tag3, UINT8 flags)
{
size_t i;
mapthing_t *mt = mapthings;
......
......@@ -29,6 +29,9 @@
#define P_SLOPES_H__
#ifdef ESLOPE
void P_CalculateSlopeNormal(pslope_t *slope);
void P_ReconfigureVertexSlope(pslope_t *slope);
void P_ResetDynamicSlopes(void);
void P_RunDynamicSlopes(void);
// P_SpawnSlope_Line
......@@ -36,6 +39,8 @@ void P_RunDynamicSlopes(void);
// sectors.
void P_SpawnSlope_Line(int linenum);
pslope_t *P_NewVertexSlope(INT16 tag1, INT16 tag2, INT16 tag3, UINT8 flags);
#ifdef SPRINGCLEAN
// Loads just map objects that make slopes,
// terrain affecting objects have to be spawned first
......
......@@ -50,7 +50,7 @@
#include <string.h>
#include <ctype.h>
//#include "SDL_image.h"
#include <SDL2/SDL_image.h>
#ifdef LOAD_XPM
......@@ -499,7 +499,7 @@ SDL_Surface *IMG_LoadXPM_RW(SDL_RWops *src)
}
#endif
static inline SDL_Surface *IMG_ReadXPMFromArray(const char **xpm)
extern DECLSPEC SDL_Surface *IMG_ReadXPMFromArray(char **xpm)
{
return NULL;
}
......
......@@ -31,7 +31,7 @@
#ifdef HAVE_SDL
#include "SDL.h"
#include <SDL2/SDL.h>
#ifdef _MSC_VER
#pragma warning(default : 4214 4244)
......@@ -42,7 +42,7 @@
#endif
#if SDL_VERSION_ATLEAST(1,2,6) && !defined (NOLOADSO)
#include "SDL_loadso.h" // 1.2.6+
#include <SDL2/SDL_loadso.h> // 1.2.6+
#elif !defined (NOLOADSO)
#define NOLOADSO
#endif
......
......@@ -81,7 +81,7 @@ void __set_fpscr(long); // in libgcc / kernel's startup.s?
#ifdef HAVE_SDL
#include "SDL.h"
#include <SDL2/SDL.h>
#ifdef HAVE_TTF
#include "i_ttf.h"
......@@ -92,7 +92,7 @@ void __set_fpscr(long); // in libgcc / kernel's startup.s?
#endif
#if SDL_VERSION_ATLEAST(1,2,7) && !defined (DC)
#include "SDL_cpuinfo.h" // 1.2.7 or greater
#include <SDL2/SDL_cpuinfo.h> // 1.2.7 or greater
#define HAVE_SDLCPUINFO
#endif
......
......@@ -27,7 +27,7 @@
#ifdef HAVE_SDL
#include "SDL.h"
#include <SDL2/SDL.h>
#ifdef _MSC_VER
#pragma warning(default : 4214 4244)
......@@ -56,7 +56,7 @@
#include "../doomdef.h"
#if defined (_WIN32)
#include "SDL_syswm.h"
#include <SDL2/SDL_syswm.h>
#endif
#include "../doomstat.h"
......
......@@ -15,12 +15,12 @@
#ifdef _MSC_VER
#pragma warning(disable : 4214 4244)
#endif
#include "SDL.h"
#include <SDL2/SDL.h>
#ifdef _MSC_VER
#pragma warning(default : 4214 4244)
#endif
#include "SDL_mixer.h"
#include <SDL2/SDL_mixer.h>
/* This is the version number macro for the current SDL_mixer version: */
#ifndef SDL_MIXER_COMPILEDVERSION
......
......@@ -23,7 +23,7 @@
#ifdef HAVE_SDL
#include "SDL.h"
#include <SDL2/SDL.h>
#include "sdlmain.h"
......