Merge branch 'Saturn-Next' into fborender

This commit is contained in:
Alug committed 2024-05-18 22:33:41 +02:00
commit 6db73bfd63
37 files changed
+900 -752

No files matched your search

+543 -541
View File
File diff suppressed because it is too large. Load diff
+10 -1
View File
@@ -12,6 +12,7 @@
# to avoid a false positive with the version detection...
SUPPORTED_GCC_VERSIONS:=\
141 14\
132 131 130 13\
123 122 121 120 12\
114 113 112 111 110 11\
@@ -23,7 +24,7 @@ SUPPORTED_GCC_VERSIONS:=\
55 54 53 52 51 50\
49 48 47 46 45 44 43 42 41 40
LATEST_GCC_VERSION=13.2
LATEST_GCC_VERSION=14.1
# gcc or g++
ifdef PREFIX
@@ -77,6 +78,14 @@ ifeq (,$(filter GCC%,$(.VARIABLES)))
endif
endif
ifdef GCC141
GCC141=1
endif
ifdef GCC14
GCC14=1
endif
ifdef GCC132
GCC131=1
endif
+1 -1
View File
@@ -71,7 +71,7 @@ apng_create_info_struct (png_structp pngp)
{
apng_infop ainfop;
(void)pngp;
if (( ainfop = calloc(sizeof (apng_info),1) ))
if (( ainfop = calloc(1, sizeof (apng_info)) ))
{
apng_set_write_fn(pngp, ainfop, 0, 0, 0, 0, 0);
apng_set_set_acTL_fn(pngp, ainfop, 0);
+6 -1
View File
@@ -2132,7 +2132,12 @@ void CV_SaveVariables(FILE *f)
// Silly hack for Min/Max vars
if (!strcmp(cvar->string, "MAX") || !strcmp(cvar->string, "MIN"))
sprintf(stringtowrite, "%d", cvar->value);
{
if (cvar->flags & CV_FLOAT)
sprintf(stringtowrite, "%f", FixedToFloat(cvar->value));
else
sprintf(stringtowrite, "%d", cvar->value);
}
else
strcpy(stringtowrite, cvar->string);
+6
View File
@@ -1445,6 +1445,12 @@ void Command_Ping_f(void)
pingv[pingc].ms = ms;
pingc++;
}
else
{
pingv[pingc].num = 0;
pingv[pingc].f = 0;
pingv[pingc].ms = 0;
}
}
if (f_width < 10) f_width = 1;
+1 -5
View File
@@ -2659,13 +2659,9 @@ void D_ModifyClientVote(SINT8 voted, UINT8 splitplayer)
{
char buf[2];
char *p = buf;
UINT8 player = consoleplayer;
if (splitplayer > 0)
player = displayplayers[splitplayer];
WRITESINT8(p, voted);
WRITEUINT8(p, player);
WRITEUINT8(p, splitplayer);
SendNetXCmd(XD_MODIFYVOTE, &buf, 2);
}
+6 -2
View File
@@ -334,7 +334,7 @@ static void readPlayer(MYFILE *f, INT32 num)
// It works down here, though.
{
INT32 numline = 0;
for (i = 0; i < MAXLINELEN-1; i++)
for (i = 0; (size_t)i < sizeof(description[num].notes)-1; i++)
{
if (numline < 20 && description[num].notes[i] == '\n')
numline++;
@@ -8940,7 +8940,11 @@ static char *lua_enumlib_sprintf_upper(char **buf, int* size, const char *format
if (length > *size)
{
void *ptr = realloc(*buf, length+1);
if (!ptr) return NULL;
if (!ptr)
{
va_end(va);
return NULL;
}
*buf = ptr;
*size = length+1;
+2 -2
View File
@@ -127,8 +127,8 @@ extern char logfilename[1024];
#else
#define VERSION 1 // Game version
#define SUBVERSION 6 // more precise version number
#define VERSIONSTRING "Saturn v6.1 "
#define VERSIONSTRINGW L"Saturn v6.1"
#define VERSIONSTRING "Saturn v6.2 "
#define VERSIONSTRINGW L"Saturn v6.2"
// Hey! If you change this, add 1 to the MODVERSION below! Otherwise we can't force updates!
// And change CMakeLists.txt (not src/, but in root), for CMake users!
// AND appveyor.yml, for the build bots!
+7 -2
View File
@@ -2117,6 +2117,8 @@ void G_ResetView(UINT8 viewnum, INT32 playernum, boolean onlyactive)
{
camerap = &camera[viewnum-1];
P_ResetCamera(&players[(*displayplayerp)], camerap);
R_ResetViewInterpolation(viewnum);
}
if (viewnum > splits)
@@ -6221,7 +6223,10 @@ void G_ReadMetalTic(mobj_t *metal)
// Read changes from the tic
if (ziptic & GZT_XYZ)
{
P_MoveOrigin(metal, READFIXED(metal_p), READFIXED(metal_p), READFIXED(metal_p));
oldmetal.x = READFIXED(metal_p);
oldmetal.y = READFIXED(metal_p);
oldmetal.z = READFIXED(metal_p);
P_MoveOrigin(metal, oldmetal.x, oldmetal.y, oldmetal.z);
oldmetal.x = metal->x;
oldmetal.y = metal->y;
oldmetal.z = metal->z;
@@ -8374,7 +8379,7 @@ void G_SaveDemo(void)
size_t i, strindex = 0;
boolean dash = true;
for (i = 0; demo.titlename[i] && i < 127; i++)
for (i = 0; i < 127 && demo.titlename[i]; i++)
{
if ((demo.titlename[i] >= 'a' && demo.titlename[i] <= 'z') ||
(demo.titlename[i] >= '0' && demo.titlename[i] <= '9'))
+84 -55
View File
@@ -180,6 +180,8 @@ static void CV_anisotropic_ONChange(void)
static void CV_screentextures_ONChange(void)
{
ONLY_IF_GL_LOADED
if (cv_grscreentextures.value != 3)
CV_Set(&cv_grpaletterendering, "Off");
HWD.pfnSetSpecialState(HWD_SET_SCREEN_TEXTURES, cv_grscreentextures.value);
}
@@ -274,6 +276,8 @@ ps_metric_t ps_hw_numcolors = {0};
ps_metric_t ps_hw_batchsorttime = {0};
ps_metric_t ps_hw_batchdrawtime = {0};
static void HWR_AddPrecipitationSprites(void);
// ==========================================================================
// View position
// ==========================================================================
@@ -505,6 +509,8 @@ void HWR_Lighting(FSurfaceInfo *Surface, INT32 light_level, extracolormap_t *col
poly_color.s.blue = (UINT8)blue;
}
light_level = SOFTLIGHT(light_level);
// Clamp the light level, since it can sometimes go out of the 0-255 range from animations
light_level = min(max(light_level, cv_secbright.value), 255);
@@ -1120,7 +1126,7 @@ static void HWR_SplitWall(sector_t *sector, FOutVector *wallVerts, INT32 texnum,
{
if (HWR_ShouldUsePaletteRendering())
{
lightnum = SOFTLIGHT(pfloor->master->frontsector->lightlevel);
lightnum = pfloor->master->frontsector->lightlevel;
colormap = pfloor->master->frontsector->extra_colormap;
lightnum = colormap ? lightnum : HWR_CalcWallLight(lightnum, v1x, v1y, v2x, v2y);
}else{
@@ -1132,7 +1138,7 @@ static void HWR_SplitWall(sector_t *sector, FOutVector *wallVerts, INT32 texnum,
{
if (HWR_ShouldUsePaletteRendering())
{
lightnum = SOFTLIGHT(*list[i].lightlevel);
lightnum = *list[i].lightlevel;
colormap = list[i].extra_colormap;
lightnum = colormap ? lightnum : HWR_CalcWallLight(lightnum, v1x, v1y, v2x, v2y);
}else{
@@ -1507,7 +1513,7 @@ void HWR_ProcessSeg(void) // Sort of like GLWall::Process in GZDoom
if (HWR_ShouldUsePaletteRendering())
{
lightnum = SOFTLIGHT(gr_frontsector->lightlevel);
lightnum = gr_frontsector->lightlevel;
colormap = gr_frontsector->extra_colormap;
lightnum = colormap ? lightnum : HWR_CalcWallLight(lightnum, vs.x, vs.y, ve.x, ve.y);
}
@@ -2238,7 +2244,7 @@ void HWR_ProcessSeg(void) // Sort of like GLWall::Process in GZDoom
if (HWR_ShouldUsePaletteRendering())
{
lightnum = SOFTLIGHT(rover->master->frontsector->lightlevel);
lightnum = rover->master->frontsector->lightlevel;
colormap = rover->master->frontsector->extra_colormap;
lightnum = colormap ? lightnum : HWR_CalcWallLight(lightnum, vs.x, vs.y, ve.x, ve.y);
}else{
@@ -2246,7 +2252,7 @@ void HWR_ProcessSeg(void) // Sort of like GLWall::Process in GZDoom
colormap = rover->master->frontsector->extra_colormap;
}
Surf.PolyColor.s.alpha = HWR_FogBlockAlpha(SOFTLIGHT(rover->master->frontsector->lightlevel), rover->master->frontsector->extra_colormap);
Surf.PolyColor.s.alpha = HWR_FogBlockAlpha(rover->master->frontsector->lightlevel, rover->master->frontsector->extra_colormap);
if (gr_frontsector->numlights)
HWR_SplitWall(gr_frontsector, wallVerts, 0, false, &Surf, rover->flags, rover, 0);
@@ -2377,7 +2383,7 @@ void HWR_ProcessSeg(void) // Sort of like GLWall::Process in GZDoom
if (HWR_ShouldUsePaletteRendering())
{
lightnum = SOFTLIGHT(rover->master->frontsector->lightlevel);
lightnum = rover->master->frontsector->lightlevel;
colormap = rover->master->frontsector->extra_colormap;
lightnum = colormap ? lightnum : HWR_CalcWallLight(lightnum, vs.x, vs.y, ve.x, ve.y);
}else{
@@ -2385,7 +2391,7 @@ void HWR_ProcessSeg(void) // Sort of like GLWall::Process in GZDoom
colormap = rover->master->frontsector->extra_colormap;
}
Surf.PolyColor.s.alpha = HWR_FogBlockAlpha(SOFTLIGHT(rover->master->frontsector->lightlevel), rover->master->frontsector->extra_colormap);
Surf.PolyColor.s.alpha = HWR_FogBlockAlpha(rover->master->frontsector->lightlevel, rover->master->frontsector->extra_colormap);
if (gr_backsector->numlights)
HWR_SplitWall(gr_backsector, wallVerts, 0, false, &Surf, rover->flags, rover, 0);
@@ -3062,13 +3068,13 @@ void HWR_AddPolyObjectPlanes(void)
FSurfaceInfo Surf;
FBITFIELD blendmode = HWR_TranstableToAlpha(po_ptrs[i]->translucency, &Surf);
HWR_AddTransparentPolyobjectFloor(levelflats[polyobjsector->floorpic].lumpnum, po_ptrs[i], false, polyobjsector->floorheight,
SOFTLIGHT(polyobjsector->lightlevel), Surf.PolyColor.s.alpha, polyobjsector, blendmode, NULL);
polyobjsector->lightlevel, Surf.PolyColor.s.alpha, polyobjsector, blendmode, NULL);
}
else
{
HWR_GetFlat(levelflats[polyobjsector->floorpic].lumpnum, R_NoEncore(polyobjsector, false));
HWR_RenderPolyObjectPlane(po_ptrs[i], false, polyobjsector->floorheight, PF_Occlude,
SOFTLIGHT(polyobjsector->lightlevel), levelflats[polyobjsector->floorpic].lumpnum,
polyobjsector->lightlevel, levelflats[polyobjsector->floorpic].lumpnum,
polyobjsector, 255, NULL);
}
}
@@ -3084,13 +3090,13 @@ void HWR_AddPolyObjectPlanes(void)
memset(&Surf, 0x00, sizeof(Surf));
blendmode = HWR_TranstableToAlpha(po_ptrs[i]->translucency, &Surf);
HWR_AddTransparentPolyobjectFloor(levelflats[polyobjsector->ceilingpic].lumpnum, po_ptrs[i], true, polyobjsector->ceilingheight,
SOFTLIGHT(polyobjsector->lightlevel), Surf.PolyColor.s.alpha, polyobjsector, blendmode, NULL);
polyobjsector->lightlevel, Surf.PolyColor.s.alpha, polyobjsector, blendmode, NULL);
}
else
{
HWR_GetFlat(levelflats[polyobjsector->ceilingpic].lumpnum, R_NoEncore(polyobjsector, true));
HWR_RenderPolyObjectPlane(po_ptrs[i], true, polyobjsector->ceilingheight, PF_Occlude,
SOFTLIGHT(polyobjsector->lightlevel), levelflats[polyobjsector->ceilingpic].lumpnum,
polyobjsector->lightlevel, levelflats[polyobjsector->ceilingpic].lumpnum,
polyobjsector, 255, NULL);
}
}
@@ -3232,12 +3238,12 @@ static void HWR_Subsector(size_t num)
light = R_GetPlaneLight(gr_frontsector, locFloorHeight, false);
if (gr_frontsector->floorlightsec == -1)
floorlightlevel = SOFTLIGHT(*gr_frontsector->lightlist[light].lightlevel);
floorlightlevel = *gr_frontsector->lightlist[light].lightlevel;
floorcolormap = gr_frontsector->lightlist[light].extra_colormap;
light = R_GetPlaneLight(gr_frontsector, locCeilingHeight, false);
if (gr_frontsector->ceilinglightsec == -1)
ceilinglightlevel = SOFTLIGHT(*gr_frontsector->lightlist[light].lightlevel);
ceilinglightlevel = *gr_frontsector->lightlist[light].lightlevel;
ceilingcolormap = gr_frontsector->lightlist[light].extra_colormap;
}
@@ -3305,7 +3311,7 @@ static void HWR_Subsector(size_t num)
centerHeight = P_GetFFloorBottomZAt(rover, gr_frontsector->soundorg.x, gr_frontsector->soundorg.y);
if (centerHeight <= locCeilingHeight && centerHeight >= locFloorHeight &&
((viewz < bottomCullHeight && (rover->flags & FF_BOTHPLANES || !(rover->flags & FF_INVERTPLANES))) ||
((viewz < bottomCullHeight && !(rover->flags & FF_INVERTPLANES)) ||
(viewz > bottomCullHeight && (rover->flags & FF_BOTHPLANES || rover->flags & FF_INVERTPLANES))))
{
if (rover->flags & FF_FOG)
@@ -3314,13 +3320,13 @@ static void HWR_Subsector(size_t num)
light = R_GetPlaneLight(gr_frontsector, centerHeight, viewz < bottomCullHeight ? true : false);
alpha = HWR_FogBlockAlpha(SOFTLIGHT(*gr_frontsector->lightlist[light].lightlevel), rover->master->frontsector->extra_colormap);
alpha = HWR_FogBlockAlpha(*gr_frontsector->lightlist[light].lightlevel, rover->master->frontsector->extra_colormap);
HWR_AddTransparentFloor(0,
&extrasubsectors[num],
false,
*rover->bottomheight,
SOFTLIGHT(*gr_frontsector->lightlist[light].lightlevel),
*gr_frontsector->lightlist[light].lightlevel,
alpha, rover->master->frontsector, PF_Fog|PF_NoTexture,
true, rover->master->frontsector->extra_colormap);
}
@@ -3331,7 +3337,7 @@ static void HWR_Subsector(size_t num)
&extrasubsectors[num],
false,
*rover->bottomheight,
SOFTLIGHT(*gr_frontsector->lightlist[light].lightlevel),
*gr_frontsector->lightlist[light].lightlevel,
max(0, min(rover->alpha, 255)), rover->master->frontsector, (rover->flags & FF_RIPPLE ? PF_Ripple : 0)|PF_Translucent,
false, gr_frontsector->lightlist[light].extra_colormap);
}
@@ -3339,7 +3345,7 @@ static void HWR_Subsector(size_t num)
{
HWR_GetFlat(levelflats[*rover->bottompic].lumpnum, R_NoEncore(gr_frontsector, false));
light = R_GetPlaneLight(gr_frontsector, centerHeight, viewz < bottomCullHeight ? true : false);
HWR_RenderPlane(sub, &extrasubsectors[num], false, *rover->bottomheight, (rover->flags & FF_RIPPLE ? PF_Ripple : 0)|PF_Occlude, SOFTLIGHT(*gr_frontsector->lightlist[light].lightlevel), levelflats[*rover->bottompic].lumpnum,
HWR_RenderPlane(sub, &extrasubsectors[num], false, *rover->bottomheight, (rover->flags & FF_RIPPLE ? PF_Ripple : 0)|PF_Occlude, *gr_frontsector->lightlist[light].lightlevel, levelflats[*rover->bottompic].lumpnum,
rover->master->frontsector, 255, gr_frontsector->lightlist[light].extra_colormap);
}
}
@@ -3349,7 +3355,7 @@ static void HWR_Subsector(size_t num)
if (centerHeight >= locFloorHeight &&
centerHeight <= locCeilingHeight &&
((viewz > topCullHeight && (rover->flags & FF_BOTHPLANES || !(rover->flags & FF_INVERTPLANES))) ||
((viewz > topCullHeight && !(rover->flags & FF_INVERTPLANES)) ||
(viewz < topCullHeight && (rover->flags & FF_BOTHPLANES || rover->flags & FF_INVERTPLANES))))
{
if (rover->flags & FF_FOG)
@@ -3358,13 +3364,13 @@ static void HWR_Subsector(size_t num)
light = R_GetPlaneLight(gr_frontsector, centerHeight, viewz < topCullHeight ? true : false);
alpha = HWR_FogBlockAlpha(SOFTLIGHT(*gr_frontsector->lightlist[light].lightlevel), rover->master->frontsector->extra_colormap);
alpha = HWR_FogBlockAlpha(*gr_frontsector->lightlist[light].lightlevel, rover->master->frontsector->extra_colormap);
HWR_AddTransparentFloor(0,
&extrasubsectors[num],
true,
*rover->topheight,
SOFTLIGHT(*gr_frontsector->lightlist[light].lightlevel),
*gr_frontsector->lightlist[light].lightlevel,
alpha, rover->master->frontsector, PF_Fog|PF_NoTexture,
true, rover->master->frontsector->extra_colormap);
}
@@ -3375,7 +3381,7 @@ static void HWR_Subsector(size_t num)
&extrasubsectors[num],
true,
*rover->topheight,
SOFTLIGHT(*gr_frontsector->lightlist[light].lightlevel),
*gr_frontsector->lightlist[light].lightlevel,
max(0, min(rover->alpha, 255)), rover->master->frontsector, (rover->flags & FF_RIPPLE ? PF_Ripple : 0)|PF_Translucent,
false, gr_frontsector->lightlist[light].extra_colormap);
}
@@ -3383,7 +3389,7 @@ static void HWR_Subsector(size_t num)
{
HWR_GetFlat(levelflats[*rover->toppic].lumpnum, R_NoEncore(gr_frontsector, true));
light = R_GetPlaneLight(gr_frontsector, centerHeight, viewz < topCullHeight ? true : false);
HWR_RenderPlane(sub, &extrasubsectors[num], true, *rover->topheight, (rover->flags & FF_RIPPLE ? PF_Ripple : 0)|PF_Occlude, SOFTLIGHT(*gr_frontsector->lightlist[light].lightlevel), levelflats[*rover->toppic].lumpnum,
HWR_RenderPlane(sub, &extrasubsectors[num], true, *rover->topheight, (rover->flags & FF_RIPPLE ? PF_Ripple : 0)|PF_Occlude, *gr_frontsector->lightlist[light].lightlevel, levelflats[*rover->toppic].lumpnum,
rover->master->frontsector, 255, gr_frontsector->lightlist[light].extra_colormap);
}
}
@@ -4007,7 +4013,7 @@ static void HWR_SplitSprite(gr_vissprite_t *spr)
alpha = Surf.PolyColor.s.alpha;
// Start with the lightlevel and colormap from the top of the sprite
lightlevel = SOFTLIGHT(*list[sector->numlights - 1].lightlevel);
lightlevel = *list[sector->numlights - 1].lightlevel;
colormap = list[sector->numlights - 1].extra_colormap;
i = 0;
@@ -4022,7 +4028,7 @@ static void HWR_SplitSprite(gr_vissprite_t *spr)
if (h <= temp)
{
if (!(spr->mobj->frame & FF_FULLBRIGHT))
lightlevel = *list[i-1].lightlevel > 255 ? 255 : SOFTLIGHT(*list[i-1].lightlevel);
lightlevel = *list[i-1].lightlevel > 255 ? 255 : *list[i-1].lightlevel;
colormap = list[i-1].extra_colormap;
break;
}
@@ -4037,7 +4043,7 @@ static void HWR_SplitSprite(gr_vissprite_t *spr)
if (!(list[i].flags & FF_NOSHADE) && (list[i].flags & FF_CUTSPRITES))
{
if (!(spr->mobj->frame & FF_FULLBRIGHT))
lightlevel = *list[i].lightlevel > 255 ? 255 : SOFTLIGHT(*list[i].lightlevel);
lightlevel = *list[i].lightlevel > 255 ? 255 : *list[i].lightlevel;
colormap = list[i].extra_colormap;
}
@@ -4256,7 +4262,7 @@ static void HWR_DrawSprite(gr_vissprite_t *spr)
extracolormap_t *colormap = sector->extra_colormap;
if (!(spr->mobj->frame & FF_FULLBRIGHT))
lightlevel = sector->lightlevel > 255 ? 255 : SOFTLIGHT(sector->lightlevel);
lightlevel = sector->lightlevel > 255 ? 255 : sector->lightlevel;
HWR_Lighting(&Surf, lightlevel, colormap);
}
@@ -4357,7 +4363,7 @@ static inline void HWR_DrawPrecipitationSprite(gr_vissprite_t *spr)
light = R_GetPlaneLight(sector, spr->mobj->z + spr->mobj->height, false); // Always use the light at the top instead of whatever I was doing before
if (!(spr->mobj->frame & FF_FULLBRIGHT))
lightlevel = *sector->lightlist[light].lightlevel > 255 ? 255 : SOFTLIGHT(*sector->lightlist[light].lightlevel);
lightlevel = *sector->lightlist[light].lightlevel > 255 ? 255 : *sector->lightlist[light].lightlevel;
if (sector->lightlist[light].extra_colormap)
colormap = sector->lightlist[light].extra_colormap;
@@ -4365,7 +4371,7 @@ static inline void HWR_DrawPrecipitationSprite(gr_vissprite_t *spr)
else
{
if (!(spr->mobj->frame & FF_FULLBRIGHT))
lightlevel = sector->lightlevel > 255 ? 255 : SOFTLIGHT(sector->lightlevel);
lightlevel = sector->lightlevel > 255 ? 255 : sector->lightlevel;
if (sector->extra_colormap)
colormap = sector->extra_colormap;
@@ -4413,8 +4419,9 @@ static int CompareVisSprites(const void *p1, const void *p2)
// make transparent sprites last
// "boolean to int"
int transparency1 = (spr1->mobj->flags2 & MF2_SHADOW) || (spr1->mobj->frame & FF_TRANSMASK);
int transparency2 = (spr2->mobj->flags2 & MF2_SHADOW) || (spr2->mobj->frame & FF_TRANSMASK);
int transparency1 = (!spr1->precip && (spr1->mobj->flags2 & MF2_SHADOW)) || (spr1->mobj->frame & FF_TRANSMASK);
int transparency2 = (!spr2->precip && (spr2->mobj->flags2 & MF2_SHADOW)) || (spr2->mobj->frame & FF_TRANSMASK);
idiff = transparency1 - transparency2;
if (idiff != 0) return idiff;
@@ -4427,8 +4434,6 @@ static int CompareVisSprites(const void *p1, const void *p2)
return -1;
}
#undef SOFTLIGHT
static void HWR_SortVisSprites(void)
{
UINT32 i;
@@ -4757,8 +4762,7 @@ void HWR_DrawSprites(void)
void HWR_AddSprites(sector_t *sec)
{
mobj_t *thing;
precipmobj_t *precipthing;
fixed_t approx_dist, limit_dist, precip_limit_dist;
fixed_t approx_dist, limit_dist;
INT32 splitflags;
boolean split_drawsprite; // drawing with splitscreen flags
@@ -4780,13 +4784,9 @@ void HWR_AddSprites(sector_t *sec)
limit_dist = min(current_bsp_culling_distance, cv_drawdist.value << FRACBITS);
else
limit_dist = current_bsp_culling_distance;
precip_limit_dist = min(current_bsp_culling_distance, cv_drawdist_precip.value << FRACBITS);
}
else
{
limit_dist = cv_drawdist.value << FRACBITS;
precip_limit_dist = cv_drawdist_precip.value << FRACBITS;
}
// Handle all things in sector.
// If a limit exists, handle things a tiny bit different.
@@ -4794,7 +4794,6 @@ void HWR_AddSprites(sector_t *sec)
{
for (thing = sec->thinglist; thing; thing = thing->snext)
{
split_drawsprite = false;
if (thing->sprite == SPR_NULL || thing->flags2 & MF2_DONTDRAW)
@@ -4839,7 +4838,6 @@ void HWR_AddSprites(sector_t *sec)
// Draw everything in sector, no checks
for (thing = sec->thinglist; thing; thing = thing->snext)
{
split_drawsprite = false;
if (thing->sprite == SPR_NULL || thing->flags2 & MF2_DONTDRAW)
@@ -4874,21 +4872,46 @@ void HWR_AddSprites(sector_t *sec)
HWR_ProjectSprite(thing);
}
}
}
// --------------------------------------------------------------------------
// HWR_AddPrecipitationSprites
// This renders through the blockmap instead of BSP to avoid
// iterating a huge amount of precipitation sprites in sectors
// that are beyond drawdist.
// --------------------------------------------------------------------------
static void HWR_AddPrecipitationSprites(void)
{
//const fixed_t drawdist = cv_drawdist_precip.value * mapobjectscale;
fixed_t drawdist;
INT32 xl, xh, yl, yh, bx, by;
precipmobj_t *th;
if (current_bsp_culling_distance)
drawdist = min(current_bsp_culling_distance, cv_drawdist_precip.value * mapobjectscale);
else
drawdist = cv_drawdist_precip.value * mapobjectscale;
// No to infinite precipitation draw distance.
if (precip_limit_dist)
if (drawdist == 0)
{
for (precipthing = sec->preciplist; precipthing; precipthing = precipthing->snext)
return;
}
R_GetRenderBlockMapDimensions(drawdist, &xl, &xh, &yl, &yh);
for (bx = xl; bx <= xh; bx++)
{
for (by = yl; by <= yh; by++)
{
if (precipthing->precipflags & PCF_INVISIBLE)
continue;
for (th = precipblocklinks[(by * bmapwidth) + bx]; th; th = th->bnext)
{
if (th->precipflags & PCF_INVISIBLE)
continue;
approx_dist = P_AproxDistance(viewx-precipthing->x, viewy-precipthing->y);
if (approx_dist > precip_limit_dist)
continue;
HWR_ProjectPrecipitationSprite(precipthing);
HWR_ProjectPrecipitationSprite(th);
}
}
}
}
@@ -4917,11 +4940,11 @@ void HWR_ProjectSprite(mobj_t *thing)
size_t lumpoff;
unsigned rot;
UINT8 flip;
boolean mirrored = thing->mirrored;
boolean hflip = (!(thing->frame & FF_HORIZONTALFLIP) != !mirrored);
boolean mirrored;
boolean hflip;
angle_t ang, camang;
const boolean papersprite = (thing->frame & FF_PAPERSPRITE);
boolean papersprite;
INT32 heightsec, phs;
INT32 dist = -1;
@@ -4940,6 +4963,10 @@ void HWR_ProjectSprite(mobj_t *thing)
if (!thing)
return;
mirrored = thing->mirrored;
hflip = (!(thing->frame & FF_HORIZONTALFLIP) != !mirrored);
papersprite = (thing->frame & FF_PAPERSPRITE);
if (cv_grmaxinterpdist.value)
dist = R_QuickCamDist(thing->x, thing->y);
@@ -5712,6 +5739,8 @@ static void HWR_RenderViewpoint(gl_portal_t *rootportal, const float fpov, playe
if (cv_grbatching.value)
HWR_StartBatching();
HWR_AddPrecipitationSprites();
ps_numbspcalls.value.i = 0;
ps_numpolyobjects.value.i = 0;
PS_START_TIMING(ps_bsptime);
@@ -5731,7 +5760,7 @@ static void HWR_RenderViewpoint(gl_portal_t *rootportal, const float fpov, playe
gr_portal = oldgl_portal_state;
PS_STOP_TIMING(ps_bsptime);
if (cv_grbatching.value)
HWR_RenderBatches();
+9 -2
View File
@@ -531,7 +531,8 @@ static void HU_removeChatText_Log(void)
free(chat_log[0]);
size_t i;
for(i=0;i<chat_nummsg_log-1;i++) {
for(i=0;i<chat_nummsg_log-1;i++)
{
chat_log[i] = chat_log[i+1];
}
chat_nummsg_log--; // lost 1 msg.
@@ -549,7 +550,13 @@ static void Chatlogsize_OnChange(void)
#define reallocarray(ptr, nmemb, size) realloc(ptr, (nmemb)*(size))
// TODO - use z_zone allocators?
chat_log = reallocarray(chat_log, cv_chatlogsize.value, sizeof(char*));
char **new_chat_log = reallocarray(chat_log, cv_chatlogsize.value, sizeof(char*));
if (new_chat_log == NULL)
{
free(chat_log);
return;
}
chat_log = new_chat_log;
#undef reallocarray
chat_nummsg_log = min(chat_nummsg_log, (UINT32)cv_chatlogsize.value);
+1 -8
View File
@@ -121,14 +121,7 @@ FUNCMATH FUNCINLINE static ATTRINLINE fixed_t FixedDiv(fixed_t a, fixed_t b)
*/
FUNCMATH FUNCINLINE static ATTRINLINE fixed_t FixedRem(fixed_t x, fixed_t y)
{
const boolean n = x < 0;
x = abs(x);
while (x >= y)
x -= y;
if (n)
return -x;
else
return x;
return x % y;
}
/** \brief The FixedSqrt function
+9 -5
View File
@@ -1339,9 +1339,9 @@ static menuitem_t OP_VideoOptionsMenu[] =
{IT_SUBMENU|IT_STRING, NULL, "Advanced Color Settings...", &OP_ColorOptionsDef, 50},
{IT_STRING | IT_CVAR, NULL, "Draw Distance", &cv_drawdist, 65},
{IT_STRING | IT_CVAR, NULL, "Weather Draw Distance",&cv_drawdist_precip, 75},
{IT_STRING | IT_CVAR, NULL, "Field of View", &cv_fov, 95},
{IT_STRING | IT_CVAR, NULL, "Draw Distance", &cv_drawdist, 65},
{IT_STRING | IT_CVAR, NULL, "Weather Draw Distance",&cv_drawdist_precip, 75},
{IT_STRING | IT_CVAR | IT_CV_BIGFLOAT, NULL, "Field of View", &cv_fov, 95},
{IT_STRING | IT_CVAR, NULL, "Show FPS", &cv_ticrate, 105},
{IT_STRING | IT_CVAR, NULL, "Vertical Sync", &cv_vidwait, 115},
@@ -2351,7 +2351,7 @@ static menuitem_t OP_DriftGaugeMenu[] =
{IT_HEADER, NULL, "Driftgauge", NULL, 0},
{IT_STRING | IT_CVAR, NULL, "Driftgauge", &cv_driftgauge, 20},
{IT_STRING | IT_CVAR, NULL, "Driftgauge Transparency", &cv_driftgaugetrans, 30},
{IT_STRING | IT_CVAR, NULL, "Driftgauge Offset", &cv_driftgaugeofs, 40},
{IT_STRING | IT_CVAR | IT_CV_BIGFLOAT, NULL, "Driftgauge Offset", &cv_driftgaugeofs, 40},
{IT_STRING | IT_CVAR, NULL, "Driftgauge Style", &cv_driftgaugestyle, 50},
};
@@ -3305,7 +3305,11 @@ static void M_ChangeCvar(INT32 choice)
else if (cv->flags & CV_FLOAT)
{
char s[20];
sprintf(s,"%f",FIXED_TO_FLOAT(cv->value)+(choice)*(1.0f/16.0f));
float increment;
increment = (currentMenu->menuitems[itemOn].status & IT_CV_BIGFLOAT) ? 0.5 : (1.f/16);
sprintf(s,"%f",FIXED_TO_FLOAT(cv->value)+(choice)*increment);
CV_Set(cv,s);
}
else
+4
View File
@@ -129,6 +129,10 @@ extern boolean menu_text_input;
#define IT_CV_NOMOD 2048
#define IT_CV_INVISSLIDER 2560
// For cv_float's, will use 1/2 as increment instead of 1/16
// Not sure if i should add it to cvartype, since its more a flag than type
#define IT_CV_BIGFLOAT 4096
//call/submenu specific
// There used to be a lot more here but ...
// A lot of them became redundant with the advent of the Pause menu, so they were removed
+1 -1
View File
@@ -1589,7 +1589,7 @@ char *va(const char *format, ...)
static char string[1024];
va_start(argptr, format);
vsprintf(string, format, argptr);
vsnprintf(string, 1024, format, argptr);
va_end(argptr);
return string;
+1
View File
@@ -387,6 +387,7 @@ extern INT32 bmapheight; // in mapblocks
extern fixed_t bmaporgx;
extern fixed_t bmaporgy; // origin of block map
extern mobj_t **blocklinks; // for thing chains
extern precipmobj_t **precipblocklinks; // special blockmap for precip rendering
//
// P_INTER
+40 -30
View File
@@ -754,15 +754,45 @@ void P_UnsetThingPosition(mobj_t *thing)
void P_UnsetPrecipThingPosition(precipmobj_t *thing)
{
precipmobj_t **sprev = thing->sprev;
precipmobj_t *snext = thing->snext;
if ((*sprev = snext) != NULL) // unlink from sector list
snext->sprev = sprev;
precipmobj_t **bprev = thing->bprev;
precipmobj_t *bnext = thing->bnext;
if (bprev && (*bprev = bnext) != NULL) // unlink from block map
bnext->bprev = bprev;
precipsector_list = thing->touching_sectorlist;
thing->touching_sectorlist = NULL; //to be restored by P_SetPrecipThingPosition
}
static void P_LinkToBlockMap(mobj_t *thing, mobj_t **bmap)
{
const INT32 blockx = (unsigned)(thing->x - bmaporgx) >> MAPBLOCKSHIFT;
const INT32 blocky = (unsigned)(thing->y - bmaporgy) >> MAPBLOCKSHIFT;
if (blockx >= 0 && blockx < bmapwidth
&& blocky >= 0 && blocky < bmapheight)
{
// killough 8/11/98: simpler scheme using
// pointer-to-pointer prev pointers --
// allows head nodes to be treated like everything else
mobj_t **link = &bmap[(blocky * bmapwidth) + blockx];
mobj_t *bnext = *link;
thing->bnext = bnext;
if (bnext != NULL)
bnext->bprev = &thing->bnext;
thing->bprev = link;
*link = thing;
}
else // thing is off the map
{
thing->bnext = NULL, thing->bprev = NULL;
}
}
//
// P_SetThingPosition
// Links a thing into both a block and a subsector
@@ -819,24 +849,7 @@ void P_SetThingPosition(mobj_t *thing)
if (!(thing->flags & MF_NOBLOCKMAP))
{
// inert things don't need to be in blockmap
const INT32 blockx = (unsigned)(thing->x - bmaporgx)>>MAPBLOCKSHIFT;
const INT32 blocky = (unsigned)(thing->y - bmaporgy)>>MAPBLOCKSHIFT;
if (blockx >= 0 && blockx < bmapwidth
&& blocky >= 0 && blocky < bmapheight)
{
// killough 8/11/98: simpler scheme using
// pointer-to-pointer prev pointers --
// allows head nodes to be treated like everything else
mobj_t **link = &blocklinks[blocky*bmapwidth + blockx];
mobj_t *bnext = *link;
if ((thing->bnext = bnext) != NULL)
bnext->bprev = &thing->bnext;
thing->bprev = link;
*link = thing;
}
else // thing is off the map
thing->bnext = NULL, thing->bprev = NULL;
P_LinkToBlockMap(thing, blocklinks);
}
// Allows you to 'step' on a new linedef exec when the previous
@@ -891,18 +904,15 @@ void P_SetUnderlayPosition(mobj_t *thing)
void P_SetPrecipitationThingPosition(precipmobj_t *thing)
{
subsector_t *ss = thing->subsector = R_PointInSubsector(thing->x, thing->y);
precipmobj_t **link = &ss->sector->preciplist;
precipmobj_t *snext = *link;
if ((thing->snext = snext) != NULL)
snext->sprev = &thing->snext;
thing->sprev = link;
*link = thing;
thing->subsector = R_PointInSubsector(thing->x, thing->y);
P_CreatePrecipSecNodeList(thing, thing->x, thing->y);
thing->touching_sectorlist = precipsector_list; // Attach to Thing's precipmobj_t
precipsector_list = NULL; // clear for next time
// NOTE: this works because bnext/bprev are at the same
// offsets in precipmobj_t and mobj_t
P_LinkToBlockMap((mobj_t*)thing, (mobj_t**)precipblocklinks);
}
//
+26 -12
View File
@@ -1329,7 +1329,7 @@ void P_XYMovement(mobj_t *mo)
fixed_t oldx, oldy; // reducing bobbing/momentum on ice when up against walls
boolean moved;
pslope_t *oldslope = NULL;
vector3_t slopemom;
vector3_t slopemom = {0,0,0};
fixed_t predictedz = 0;
I_Assert(mo != NULL);
@@ -4978,18 +4978,17 @@ static void P_Boss9Thinker(mobj_t *mobj)
mobj->angle -= InvAngle(angle)/8;
// Spawn energy particles
for (spawner = mobj->hnext; spawner; spawner = spawner->hnext) {
for (spawner = mobj->hnext; spawner; spawner = spawner->hnext)
{
dist = P_AproxDistance(spawner->x - mobj->x, spawner->y - mobj->y);
if (P_RandomRange(1,(dist>>FRACBITS)/16) == 1)
break;
}
if (spawner) {
if (spawner && dist)
{
mobj_t *missile = P_SpawnMissile(spawner, mobj, MT_MSGATHER);
missile->momz = FixedDiv(missile->momz, 7*FRACUNIT/4);
if (dist == 0)
missile->fuse = 0;
else
missile->fuse = (dist/P_AproxDistance(missile->momx, missile->momy));
missile->fuse = (dist/P_AproxDistance(missile->momx, missile->momy));
if (missile->fuse > mobj->fuse)
P_RemoveMobj(missile);
}
@@ -10147,6 +10146,9 @@ void P_SpawnPrecipitation(void)
//for (j = 0; j < cv_precipdensity.value; ++j) -- density is 1 for kart always
{
INT32 floorz;
INT32 ceilingz;
x = ((cv_lessprecip.value ? basex*1.5 : basex) + ((M_RandomKey(MAPBLOCKUNITS<<3)<<FRACBITS)>>3));
y = ((cv_lessprecip.value ? basey*1.5 : basey) + ((M_RandomKey(MAPBLOCKUNITS<<3)<<FRACBITS)>>3));
@@ -10180,8 +10182,19 @@ void P_SpawnPrecipitation(void)
else // everything else.
rainmo = P_SpawnRainMobj(x, y, height, MT_RAIN);
// Randomly assign a height, now that floorz is set.
rainmo->z = M_RandomRange(rainmo->floorz>>FRACBITS, rainmo->ceilingz>>FRACBITS)<<FRACBITS;
floorz = rainmo->floorz >> FRACBITS;
ceilingz = rainmo->ceilingz >> FRACBITS;
if (floorz < ceilingz)
{
// Randomly assign a height, now that floorz is set.
rainmo->z = M_RandomRange(floorz, ceilingz) << FRACBITS;
}
else
{
// ...except if the floor is above the ceiling.
rainmo->z = ceilingz << FRACBITS;
}
}
}
@@ -10270,7 +10283,8 @@ void P_PrecipitationEffects(void)
volume = 255; // Sky above? We get it full blast.
else
{
fixed_t x, y, yl, yh, xl, xh;
/* GCC is optimizing away y >= yl, FUCK YOU */
volatile fixed_t x, y, yl, yh, xl, xh;
fixed_t closedist, newdist;
// Essentially check in a 1024 unit radius of the player for an outdoor area.
@@ -10279,8 +10293,8 @@ void P_PrecipitationEffects(void)
xl = players[displayplayers[0]].mo->x - 1024*FRACUNIT;
xh = players[displayplayers[0]].mo->x + 1024*FRACUNIT;
closedist = 2048*FRACUNIT;
for (y = yl; y <= yh; y += FRACUNIT*64)
for (x = xl; x <= xh; x += FRACUNIT*64)
for (y = yl; y >= yl && y <= yh; y += FRACUNIT*64)
for (x = xl; x >= xl && x <= xh; x += FRACUNIT*64)
{
if (R_PointInSubsector(x, y)->sector->ceilingpic == skyflatnum) // Found the outdoors!
{
+6 -6
View File
@@ -279,8 +279,8 @@ typedef struct mobj_s
fixed_t old_x2, old_y2, old_z2;
// More list: links in sector (if needed)
struct mobj_s *snext;
struct mobj_s **sprev; // killough 8/11/98: change to ptr-to-ptr
struct mobj_s *bnext;
struct mobj_s **bprev; // killough 8/11/98: change to ptr-to-ptr
// More drawing info: to determine current sprite.
angle_t angle, pitch, roll; // orientation
@@ -338,8 +338,8 @@ typedef struct mobj_s
// Interaction info, by BLOCKMAP.
// Links in blocks (if needed).
struct mobj_s *bnext;
struct mobj_s **bprev; // killough 8/11/98: change to ptr-to-ptr
struct mobj_s *snext;
struct mobj_s **sprev; // killough 8/11/98: change to ptr-to-ptr
// Additional pointers for NiGHTS hoops
struct mobj_s *hnext;
@@ -432,8 +432,8 @@ typedef struct precipmobj_s
fixed_t old_x2, old_y2, old_z2;
// More list: links in sector (if needed)
struct precipmobj_s *snext;
struct precipmobj_s **sprev; // killough 8/11/98: change to ptr-to-ptr
struct precipmobj_s *bnext;
struct precipmobj_s **bprev; // killough 8/11/98: change to ptr-to-ptr
// More drawing info: to determine current sprite.
angle_t angle, pitch, roll; // orientation
+3 -3
View File
@@ -1206,7 +1206,7 @@ static boolean Polyobj_moveXY(polyobj_t *po, fixed_t x, fixed_t y)
// http://www.inversereality.org/tutorials/graphics%20programming/2dtransformations.html
// It is, of course, just a vector-matrix multiplication.
//
static inline void Polyobj_rotatePoint(vertex_t *v, const vertex_t *c, angle_t ang)
static inline void Polyobj_rotatePoint(vertex_t *v, const vector2_t *c, angle_t ang)
{
vertex_t tmp = *v;
@@ -1267,7 +1267,7 @@ static void Polyobj_rotateLine(line_t *ld)
//
// Causes objects resting on top of the rotating polyobject to 'ride' with its movement.
//
static void Polyobj_rotateThings(polyobj_t *po, vertex_t origin, angle_t delta, UINT8 turnthings)
static void Polyobj_rotateThings(polyobj_t *po, vector2_t origin, angle_t delta, UINT8 turnthings)
{
static INT32 pomovecount = 10000;
INT32 x, y;
@@ -1367,7 +1367,7 @@ static boolean Polyobj_rotate(polyobj_t *po, angle_t delta, UINT8 turnthings)
{
size_t i;
angle_t angle;
vertex_t origin;
vector2_t origin;
INT32 hitflags = 0;
// don't move bad polyobjects
+13 -32
View File
@@ -127,6 +127,7 @@ INT32 *blockmaplump; // Big blockmap
fixed_t bmaporgx, bmaporgy;
// for thing chains
mobj_t **blocklinks;
precipmobj_t **precipblocklinks;
// REJECT
// For fast sight rejection.
@@ -714,7 +715,7 @@ static void P_LoadRawSectors(UINT8 *data, size_t i)
ss->thinglist = NULL;
ss->touching_thinglist = NULL;
ss->preciplist = NULL;
ss->touching_preciplist = NULL;
ss->floordata = NULL;
@@ -1948,6 +1949,9 @@ static void P_CreateBlockMap(void)
// haleyjd 2/22/06: setup polyobject blockmap
count = sizeof(*polyblocklinks) * bmapwidth * bmapheight;
polyblocklinks = Z_Calloc(count, PU_LEVEL, NULL);
count = sizeof (*precipblocklinks)* bmapwidth*bmapheight;
precipblocklinks = Z_Calloc(count, PU_LEVEL, NULL);
}
}
@@ -1982,10 +1986,6 @@ static void P_ReadBlockMapLump(INT16 *wadblockmaplump, size_t count)
// this should return false.
static boolean P_LoadBlockMap(lumpnum_t lumpnum)
{
#if 0
(void)lumpnum;
return false;
#else
size_t count;
const char *lumpname = W_CheckNameForNum(lumpnum);
@@ -2023,27 +2023,11 @@ static boolean P_LoadBlockMap(lumpnum_t lumpnum)
// haleyjd 2/22/06: setup polyobject blockmap
count = sizeof(*polyblocklinks) * bmapwidth * bmapheight;
polyblocklinks = Z_Calloc(count, PU_LEVEL, NULL);
count = sizeof (*precipblocklinks)* bmapwidth*bmapheight;
precipblocklinks = Z_Calloc(count, PU_LEVEL, NULL);
return true;
/* Original
blockmaplump = W_CacheLumpNum(lump, PU_LEVEL);
blockmap = blockmaplump+4;
count = W_LumpLength (lump)/2;
for (i = 0; i < count; i++)
blockmaplump[i] = SHORT(blockmaplump[i]);
bmaporgx = blockmaplump[0]<<FRACBITS;
bmaporgy = blockmaplump[1]<<FRACBITS;
bmapwidth = blockmaplump[2];
bmapheight = blockmaplump[3];
}
// clear out mobj chains
count = sizeof (*blocklinks)*bmapwidth*bmapheight;
blocklinks = Z_Calloc(count, PU_LEVEL, NULL);
return true;
*/
#endif
}
// This needs to be a separate function
@@ -2052,12 +2036,6 @@ static boolean P_LoadBlockMap(lumpnum_t lumpnum)
// -- Monster Iestyn 09/01/18
static boolean P_LoadRawBlockMap(UINT8 *data, size_t count, const char *lumpname)
{
#if 0
(void)data;
(void)count;
(void)lumpname;
return false;
#else
// Check if the lump is named "BLOCKMAP"
if (!lumpname || memcmp(lumpname, "BLOCKMAP", 8) != 0)
{
@@ -2087,8 +2065,11 @@ static boolean P_LoadRawBlockMap(UINT8 *data, size_t count, const char *lumpname
// haleyjd 2/22/06: setup polyobject blockmap
count = sizeof(*polyblocklinks) * bmapwidth * bmapheight;
polyblocklinks = Z_Calloc(count, PU_LEVEL, NULL);
count = sizeof (*precipblocklinks)* bmapwidth*bmapheight;
precipblocklinks = Z_Calloc(count, PU_LEVEL, NULL);
return true;
#endif
}
//
+5 -1
View File
@@ -82,8 +82,12 @@ void P_MixUp(mobj_t *thing, fixed_t x, fixed_t y, fixed_t z, angle_t angle,
// move chasecam at new player location
for (i = 0; i <= splitscreen; i++)
{
if (thing->player == &players[displayplayers[i]] && camera[i].chase)
if (thing->player != &players[displayplayers[i]])
continue;
if (camera[i].chase)
P_ResetCamera(thing->player, &camera[i]);
R_ResetViewInterpolation(i + 1);
break;
}
// don't run in place after a teleport
+7 -1
View File
@@ -581,6 +581,13 @@ void P_Ticker(boolean run)
if (playeringame[i])
++players[i].jointime;
if (run)
{
// Update old view state BEFORE ticking so resetting
// the old interpolation state from game logic works.
R_UpdateViewInterpolation();
}
if (objectplacing)
{
if (OP_FreezeObjectplace())
@@ -827,7 +834,6 @@ void P_Ticker(boolean run)
if (run)
{
R_UpdateLevelInterpolators();
R_UpdateViewInterpolation();
// Hack: ensure newview is assigned every tic.
// Ensures view interpolation is T-1 to T in poor network conditions
+7 -11
View File
@@ -2510,18 +2510,15 @@ static void P_MovePlayer(player_t *player)
if ((player->mo->ceilingz - player->mo->floorz < player->mo->height)
&& !(player->mo->flags & MF_NOCLIP))
{
if (player->mo->ceilingz - player->mo->floorz < player->mo->height)
if ((netgame || multiplayer) && player->spectator)
P_DamageMobj(player->mo, NULL, NULL, 42000); // Respawn crushed spectators
else
{
if ((netgame || multiplayer) && player->spectator)
P_DamageMobj(player->mo, NULL, NULL, 42000); // Respawn crushed spectators
else
{
K_SquishPlayer(player, NULL, NULL); // SRB2kart - we don't kill when squished, we squish when squished.
}
if (player->playerstate == PST_DEAD)
return;
K_SquishPlayer(player, NULL, NULL); // SRB2kart - we don't kill when squished, we squish when squished.
}
if (player->playerstate == PST_DEAD)
return;
}
#ifdef HWRENDER
@@ -3962,7 +3959,6 @@ boolean P_MoveChaseCamera(player_t *player, camera_t *thiscam, boolean resetcall
{
P_MoveChaseCamera(player, thiscam, false);
R_ResetViewInterpolation(num + 1);
R_ResetViewInterpolation(num + 1);
}
return (x == thiscam->x && y == thiscam->y && z == thiscam->z && angle == thiscam->aiming);
+6 -6
View File
@@ -41,33 +41,33 @@ typedef void *pref_typ;
#define COMP(a, b) ((*compar)((void *)(a), (void *)(b)))
static void swapbytes(void *a0, void *b0, size_t n)
static inline void swapbytes(void *a0, void *b0, size_t n)
{
char *a = a0, *b = b0, t;
do {ASWAP(*a, *b, t); a++; b++;} while (--n);
}
static void swapdword(void *a0, void *b0, size_t n)
static inline void swapdword(void *a0, void *b0, size_t n)
{
DWORD *a = a0, *b = b0, t;
ASWAP(*a, *b, t);
(void)n;
}
static void swapdwords(void *a0, void *b0, size_t n)
static inline void swapdwords(void *a0, void *b0, size_t n)
{
DWORD *a = a0, *b = b0, t;
do {ASWAP(*a, *b, t); a++; b++;} while (n -= sizeof(DWORD));
}
static void swapword(void *a0, void *b0, size_t n)
static inline void swapword(void *a0, void *b0, size_t n)
{
WORD *a = a0, *b = b0, t;
ASWAP(*a, *b, t);
(void)n;
}
static void swapwords(void *a0, void *b0, size_t n)
static inline void swapwords(void *a0, void *b0, size_t n)
{
WORD *a = a0, *b = b0, t;
do {ASWAP(*a, *b, t); a++; b++;} while (n -= sizeof(WORD));
@@ -75,7 +75,7 @@ static void swapwords(void *a0, void *b0, size_t n)
typedef void (*swapf_typ)(void *, void *, size_t);
static char *med3(char *a, char *b, char *c, int (*compar)(const void *, const void *))
static inline char *med3(char *a, char *b, char *c, int (*compar)(const void *, const void *))
{
return COMP(a, b) < 0 ?
(COMP(b, c) < 0 ? b : COMP(a, c) < 0 ? c : a) :
+11 -2
View File
@@ -1088,6 +1088,7 @@ void R_ReInitColormaps(UINT16 num, lumpnum_t newencoremap)
{
char colormap[9] = "COLORMAP";
lumpnum_t lump;
const lumpnum_t basecolormaplump = W_GetNumForName(colormap);
if (num > 0 && num <= 10000)
snprintf(colormap, 8, "CLM%04u", num-1);
@@ -1095,8 +1096,16 @@ void R_ReInitColormaps(UINT16 num, lumpnum_t newencoremap)
// Load in the light tables, now 64k aligned for smokie...
lump = W_GetNumForName(colormap);
if (lump == LUMPERROR)
lump = W_GetNumForName("COLORMAP");
W_ReadLump(lump, colormaps);
lump = basecolormaplump;
else
{
if (W_LumpLength(lump) != W_LumpLength(basecolormaplump))
{
CONS_Alert(CONS_WARNING, "%s lump size does not match COLORMAP, results may be unexpected.\n", colormap);
}
}
W_ReadLumpHeader(lump, colormaps, W_LumpLength(basecolormaplump), 0U);
// Encore mode.
if (newencoremap != LUMPERROR)
-1
View File
@@ -350,7 +350,6 @@ typedef struct sector_s
fixed_t floorspeed, ceilspeed;
// list of precipitation mobjs in sector
precipmobj_t *preciplist;
struct mprecipsecnode_s *touching_preciplist;
// Eternity engine slope
+11 -2
View File
@@ -23,6 +23,8 @@
#include "r_state.h"
#include "z_zone.h"
#include "console.h" // con_startup_loadprogress
#include "i_time.h"
#ifdef HWRENDER
#include "hardware/hw_main.h" // for cv_grshearing
#endif
@@ -80,6 +82,7 @@ static viewvars_t skyview_old[MAXSPLITSCREENPLAYERS];
static viewvars_t skyview_new[MAXSPLITSCREENPLAYERS];
static viewvars_t *oldview = &pview_old[0];
static tic_t last_view_update;
static int oldview_invalid[MAXSPLITSCREENPLAYERS] = {0, 0, 0, 0};
viewvars_t *newview = &pview_new[0];
@@ -200,21 +203,27 @@ void R_UpdateViewInterpolation(void)
if (oldview_invalid[i]) oldview_invalid[i]--;
}
last_view_update = I_GetTime();
}
void R_ResetViewInterpolation(UINT8 p)
{
// Wait an extra tic if the interpolation state hasn't
// updated yet.
int t = last_view_update == I_GetTime() ? 1 : 2;
if (p == 0)
{
UINT8 i;
for (i = 0; i < MAXSPLITSCREENPLAYERS; i++)
{
oldview_invalid[i]++;
oldview_invalid[i] = t;
}
}
else
{
oldview_invalid[p - 1]++;
oldview_invalid[p - 1] = t;
}
}
+29
View File
@@ -32,6 +32,7 @@
#include "m_random.h" // quake camera shake
#include "doomstat.h" // MAXSPLITSCREENPLAYERS
#include "r_fps.h" // Frame interpolation/uncapped
#include "tables.h"
#ifdef HWRENDER
#include "hardware/hw_main.h"
@@ -594,6 +595,33 @@ boolean R_DoCulling(line_t *cullheight, line_t *viewcullheight, fixed_t vz, fixe
return false;
}
// Returns search dimensions within a blockmap, in the direction of viewangle and out to a certain distance.
void R_GetRenderBlockMapDimensions(fixed_t drawdist, INT32 *xl, INT32 *xh, INT32 *yl, INT32 *yh)
{
const angle_t left = viewangle - clipangle;
const angle_t right = viewangle + clipangle;
const fixed_t vxleft = viewx + FixedMul(drawdist, FCOS(left));
const fixed_t vyleft = viewy + FixedMul(drawdist, FSIN(left));
const fixed_t vxright = viewx + FixedMul(drawdist, FCOS(right));
const fixed_t vyright = viewy + FixedMul(drawdist, FSIN(right));
// Try to narrow the search to within only the field of view
*xl = (unsigned)(min(viewx, min(vxleft, vxright)) - bmaporgx)>>MAPBLOCKSHIFT;
*xh = (unsigned)(max(viewx, max(vxleft, vxright)) - bmaporgx)>>MAPBLOCKSHIFT;
*yl = (unsigned)(min(viewy, min(vyleft, vyright)) - bmaporgy)>>MAPBLOCKSHIFT;
*yh = (unsigned)(max(viewy, max(vyleft, vyright)) - bmaporgy)>>MAPBLOCKSHIFT;
if (*xh >= bmapwidth)
*xh = bmapwidth - 1;
if (*yh >= bmapheight)
*yh = bmapheight - 1;
BMBOUNDFIX(*xl, *xh, *yl, *yh);
}
//
// R_InitTextureMapping
//
@@ -1728,6 +1756,7 @@ void R_RenderPlayerView(player_t *player)
PS_START_TIMING(ps_bsptime);
R_RenderBSPNode((INT32)numnodes - 1);
PS_STOP_TIMING(ps_bsptime);
R_AddPrecipitationSprites();
PS_START_TIMING(ps_sw_spritecliptime);
R_ClipSprites();
PS_STOP_TIMING(ps_sw_spritecliptime);
+1
View File
@@ -80,6 +80,7 @@ subsector_t *R_PointInSubsector(fixed_t x, fixed_t y);
subsector_t *R_IsPointInSubsector(fixed_t x, fixed_t y);
boolean R_DoCulling(line_t *cullheight, line_t *viewcullheight, fixed_t vz, fixed_t bottomh, fixed_t toph);
void R_GetRenderBlockMapDimensions(fixed_t drawdist, INT32 *xl, INT32 *xh, INT32 *yl, INT32 *yh);
// Performance stats
extern precise_t ps_prevframetime;// time when previous frame was rendered
+30 -10
View File
@@ -1897,7 +1897,6 @@ weatherthink:
void R_AddSprites(sector_t *sec, INT32 lightlevel)
{
mobj_t *thing;
precipmobj_t *precipthing; // Tails 08-25-2002
INT32 lightnum;
fixed_t approx_dist, limit_dist;
@@ -2016,21 +2015,42 @@ void R_AddSprites(sector_t *sec, INT32 lightlevel)
R_ProjectSprite(thing);
}
}
}
// R_AddPrecipitationSprites
// This renders through the blockmap instead of BSP to avoid
// iterating a huge amount of precipitation sprites in sectors
// that are beyond drawdist.
//
void R_AddPrecipitationSprites(void)
{
const fixed_t drawdist = cv_drawdist_precip.value * mapobjectscale;
INT32 xl, xh, yl, yh, bx, by;
precipmobj_t *th, *next;
if (drawdist == 0)
{
return;
}
R_GetRenderBlockMapDimensions(drawdist, &xl, &xh, &yl, &yh);
// no, no infinite draw distance for precipitation. this option at zero is supposed to turn it off
if ((limit_dist = (fixed_t)cv_drawdist_precip.value << FRACBITS))
for (bx = xl; bx <= xh; bx++)
{
for (precipthing = sec->preciplist; precipthing; precipthing = precipthing->snext)
for (by = yl; by <= yh; by++)
{
if (precipthing->precipflags & PCF_INVISIBLE)
continue;
for (th = precipblocklinks[(by * bmapwidth) + bx]; th; th = next)
{
// Store this beforehand because R_ProjectPrecipitionSprite may free th (see P_PrecipThinker)
next = th->bnext;
approx_dist = P_AproxDistance(viewx-precipthing->x, viewy-precipthing->y);
if (th->precipflags & PCF_INVISIBLE)
continue;
if (approx_dist > limit_dist)
continue;
R_ProjectPrecipitationSprite(precipthing);
R_ProjectPrecipitationSprite(th);
}
}
}
}
+1
View File
@@ -67,6 +67,7 @@ void R_AddSpriteDefs(UINT16 wadnum);
//SoM: 6/5/2000: Light sprites correctly!
void R_AddSprites(sector_t *sec, INT32 lightlevel);
void R_AddPrecipitationSprites(void);
void R_InitSprites(void);
void R_ClearSprites(void);
void R_DrawMasked(void);
+1 -5
View File
@@ -4039,16 +4039,12 @@ static const char *locateWad(void)
#endif
#ifndef NOHOME
// find in $HOME
I_OutputMsg(",HOME/" DEFAULTDIR);
I_OutputMsg(",HOME");
if ((envstr = I_GetEnv("HOME")) != NULL)
{
char *tmp = malloc(strlen(envstr) + sizeof(DEFAULTDIR));
strcpy(tmp, envstr);
strcat(tmp, DEFAULTDIR);
WadPath = searchWad(envstr);
if (WadPath)
return WadPath;
free(tmp);
}
#endif
#ifdef DEFAULTSEARCHPATH1
+5
View File
@@ -24,6 +24,7 @@
#define FINEMASK (FINEANGLES - 1)
#define ANGLETOFINESHIFT 19 // 0x100000000 to 0x2000
#define FINEANGLE_C(x) ((FixedAngle((x)*FRACUNIT)>>ANGLETOFINESHIFT) & FINEMASK) // ((x*(ANGLE_45/45))>>ANGLETOFINESHIFT) & FINEMASK
#define ANGLETOFINE(x) (((x)>>ANGLETOFINESHIFT) & FINEMASK)
// Effective size is 10240.
extern fixed_t finesine[5*FINEANGLES/4];
@@ -121,4 +122,8 @@ void FM_Rotate(matrix_t *dest, angle_t angle, fixed_t x, fixed_t y, fixed_t z);
#define FINECOSINE(n) (finecosine[n]>>(FINE_FRACBITS-FRACBITS))
#define FINETANGENT(n) (finetangent[n]>>(FINE_FRACBITS-FRACBITS))
// FSIN(ANGLE_90) = FRACUNIT
#define FSIN(n) FINESINE(ANGLETOFINE(n))
#define FCOS(n) FINECOSINE(ANGLETOFINE(n))
#endif
+4 -1
View File
@@ -2944,6 +2944,9 @@ INT32 V_ThinStringWidth(const char *string, INT32 option)
if ((UINT8)c >= 0x80 && (UINT8)c <= 0x8F) //color parsing! -Inuyasha 2.16.09
continue;
if (c < HU_FONTSTART)
continue;
if (!lowercase || !tny_font[c-HU_FONTSTART])
c = toupper(c);
c -= HU_FONTSTART;
@@ -3367,7 +3370,7 @@ void V_Init(void)
#ifdef DEBUG
CONS_Debug(DBG_RENDER, "V_Init done:\n");
for (i = 0; i < NUMSCREENS+1; i++)
for (i = 0; i < NUMSCREENS; i++)
CONS_Debug(DBG_RENDER, " screens[%d] = %x\n", i, screens[i]);
#endif
}
+2 -2
View File
@@ -186,9 +186,9 @@ FILE *W_OpenWadFile(const char **filename, boolean useerrors)
if (filenamebuf != *filename) {
// avoid overlap
strncpy(filenamebuf, *filename, MAX_WADPATH);
filenamebuf[MAX_WADPATH - 1] = '\0';
*filename = filenamebuf;
}
filenamebuf[MAX_WADPATH - 1] = '\0';
*filename = filenamebuf;
// open wad file
if ((handle = fopen_utf8(*filename, "rb")) == NULL)
+1 -1
View File
@@ -1486,7 +1486,7 @@ void Y_VoteTicker(void)
if ((InputDown(gc_accelerate, i+1) || JoyAxis(AXISMOVE, i+1) > 0) && !pressed)
{
D_ModifyClientVote(voteclient.playerinfo[i].selection, i);
D_ModifyClientVote(voteclient.playerinfo[i].selection, p);
pressed = true;
}
}