Merge branch 'Saturn-Next' into unnestmothink

This commit is contained in:
Alug committed 2025-07-27 18:14:17 +02:00
commit d6bd289fcf
30 files changed
+352 -265

No files matched your search

+20 -3
View File
@@ -152,6 +152,8 @@ boolean dedicated = false;
boolean loaded_config = false; // true once config.cfg loaded AND executed
static void D_CleanFile(char **filearray);
//
// D_PostEvent
// Called by the I/O functions when input is detected
@@ -896,9 +898,24 @@ void D_SRB2Loop(void)
rendertimefrac_unpaused = FRACUNIT;
}
if ((interp || doDisplay) && !frameskip)
if (interp || doDisplay)
{
ranwipe = D_Display();
if (!frameskip)
{
ranwipe = D_Display();
}
else if (!dedicated)
{
// always update console and hud
// otherwise it may take minutes to open it
CON_Drawer();
if (gamestate == GS_LEVEL)
{
ST_Drawer();
HU_Drawer();
}
}
}
// Only take screenshots after drawing.
@@ -1215,7 +1232,7 @@ void D_AddPostloadFiles(void)
postautoloaded = true;
}
void D_CleanFile(char **filearray)
static void D_CleanFile(char **filearray)
{
size_t pnumwadfiles;
for (pnumwadfiles = 0; filearray[pnumwadfiles]; pnumwadfiles++)
-2
View File
@@ -85,8 +85,6 @@ void D_PostEvent(const event_t *ev);
void D_ProcessEvents(void);
void D_CleanFile(char **filearray);
const char *D_Home(void);
//
+12
View File
@@ -1185,6 +1185,18 @@ filestatus_t findfile(char *filename, const UINT8 *wantedmd5sum, boolean complet
badmd5 = true;
// if not found at all, just move on without doing anything
if (cv_addons_option.value == 3 && *cv_addons_folder.string != '\0')
{
// next, check any custom directory if specified
homecheck = filesearch(filename, cv_addons_folder.string, wantedmd5sum, completepath, 10);
if (homecheck == FS_FOUND) // we found the file, so return that we have :)
return FS_FOUND;
else if (homecheck == FS_MD5SUMBAD) // file has a bad md5; move on and look for a file with the right md5
badmd5 = true;
// if not found at all, just move on without doing anything
}
// finally check "." directory
homecheck = filesearch(filename, ".", wantedmd5sum, completepath, 10);
+5
View File
@@ -152,3 +152,8 @@ boolean I_UseNativeKeyboard(void)
{
return false;
}
void I_SetBorderlessWindow(void)
{
}
+2 -2
View File
@@ -111,8 +111,8 @@ extern char logfilename[1024];
#else
#define VERSION 1 // Game version
#define SUBVERSION 6 // more precise version number
#define VERSIONSTRING "Saturn v8.2"
#define VERSIONSTRINGW L"Saturn v8.2"
#define VERSIONSTRING "Saturn v8.3"
#define VERSIONSTRINGW L"Saturn v8.3"
// 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!
+35 -32
View File
@@ -109,7 +109,7 @@ boolean addedtogame;
player_t players[MAXPLAYERS];
INT32 consoleplayer; // player taking events and displaying
INT32 displayplayers[MAXSPLITSCREENPLAYERS]; // view being displayed
INT32 displayplayers[MAXSPLITSCREENPLAYERS] = {0}; // view being displayed
tic_t gametic;
tic_t levelstarttic; // gametic at level start
@@ -681,47 +681,49 @@ INT32 JoyAxis(axis_input_e axissel, UINT8 player)
INT32 axisval;
boolean flp = false;
UINT8 pnum = player-1;
//find what axis to get
switch (axissel)
{
case AXISTURN:
axisval = cv_turnaxis[player-1].value;
axisval = cv_turnaxis[pnum].value;
break;
case AXISMOVE:
axisval = cv_moveaxis[player-1].value;
axisval = cv_moveaxis[pnum].value;
break;
case AXISCAMTURN:
axisval = cv_camturnaxis[player-1].value;
axisval = cv_camturnaxis[pnum].value;
break;
case AXISCAMSTRAFE:
axisval = cv_camstrafeaxis[player-1].value;
axisval = cv_camstrafeaxis[pnum].value;
break;
case AXISBRAKE:
axisval = cv_brakeaxis[player-1].value;
axisval = cv_brakeaxis[pnum].value;
break;
case AXISAIM:
axisval = cv_aimaxis[player-1].value;
axisval = cv_aimaxis[pnum].value;
break;
case AXISLOOK:
axisval = cv_lookaxis[player-1].value;
axisval = cv_lookaxis[pnum].value;
break;
case AXISFIRE:
axisval = cv_fireaxis[player-1].value;
axisval = cv_fireaxis[pnum].value;
break;
case AXISDRIFT:
axisval = cv_driftaxis[player-1].value;
axisval = cv_driftaxis[pnum].value;
break;
case AXISLOOKBACK:
axisval = cv_lookbackaxis[player-1].value;
axisval = cv_lookbackaxis[pnum].value;
break;
case AXISCUSTOM1:
axisval = cv_custom1axis[player-1].value;
axisval = cv_custom1axis[pnum].value;
break;
case AXISCUSTOM2:
axisval = cv_custom2axis[player-1].value;
axisval = cv_custom2axis[pnum].value;
break;
case AXISCUSTOM3:
axisval = cv_custom3axis[player-1].value;
axisval = cv_custom3axis[pnum].value;
break;
default:
return 0;
@@ -732,44 +734,51 @@ INT32 JoyAxis(axis_input_e axissel, UINT8 player)
axisval = -axisval;
flp = true;
}
if (axisval > JOYAXISSET*2 || axisval == 0) //not there in array or None
return 0;
if (axisval%2)
if (axisval % 2)
{
axisval /= 2;
retaxis = joyxmove[axisval];
retaxis = joyxmove[pnum][axisval];
if (retaxis < (-JOYAXISRANGE))
retaxis = -JOYAXISRANGE;
if (retaxis > (+JOYAXISRANGE))
retaxis = +JOYAXISRANGE;
if (!Joystick[player-1].bGamepadStyle && axissel < AXISDEAD)
if (!Joystick[pnum].bGamepadStyle && axissel < AXISDEAD)
{
const INT32 jdeadzone = ((JOYAXISRANGE-1) * cv_xdeadzone[player-1].value) >> FRACBITS;
const INT32 jdeadzone = ((JOYAXISRANGE-1) * cv_xdeadzone[pnum].value) >> FRACBITS;
if (abs(retaxis) <= jdeadzone)
return 0;
}
if (flp) retaxis = -retaxis; //flip it around
if (flp)
retaxis = -retaxis; // flip it around
return retaxis;
}
else
{
axisval--;
axisval /= 2;
retaxis = joyymove[axisval];
retaxis = joyymove[pnum][axisval];
if (retaxis < (-JOYAXISRANGE))
retaxis = -JOYAXISRANGE;
if (retaxis > (+JOYAXISRANGE))
retaxis = +JOYAXISRANGE;
if (!Joystick[player-1].bGamepadStyle && axissel < AXISDEAD)
if (!Joystick[pnum].bGamepadStyle && axissel < AXISDEAD)
{
const INT32 jdeadzone = ((JOYAXISRANGE-1) * cv_ydeadzone[player-1].value) >> FRACBITS;
const INT32 jdeadzone = ((JOYAXISRANGE-1) * cv_ydeadzone[pnum].value) >> FRACBITS;
if (abs(retaxis) <= jdeadzone)
return 0;
}
if (flp) retaxis = -retaxis; //flip it around
if (flp)
retaxis = -retaxis; // flip it around
return retaxis;
}
}
@@ -1216,15 +1225,9 @@ static void G_DoLoadLevel(boolean resetplayer)
}
// clear cmd building stuff
memset(gamekeydown, 0, sizeof (gamekeydown));
for (i = 0; i < JOYAXISSET; i++)
{
joyxmove[i] = joyymove[i] = 0;
joy2xmove[i] = joy2ymove[i] = 0;
joy3xmove[i] = joy3ymove[i] = 0;
joy4xmove[i] = joy4ymove[i] = 0;
}
memset(gamekeydown, 0, sizeof(gamekeydown));
memset(joyxmove, 0, sizeof(joyxmove));
memset(joyymove, 0, sizeof(joyymove));
mousex = mousey = 0;
// clear hud messages remains (usually from game startup)
+9 -19
View File
@@ -114,8 +114,7 @@ INT32 mousex, mousey;
INT32 mlooky; // like mousey but with a custom sensitivity for mlook
// joystick values are repeated
INT32 joyxmove[JOYAXISSET], joyymove[JOYAXISSET], joy2xmove[JOYAXISSET], joy2ymove[JOYAXISSET],
joy3xmove[JOYAXISSET], joy3ymove[JOYAXISSET], joy4xmove[JOYAXISSET], joy4ymove[JOYAXISSET];
INT32 joyxmove[MAXSPLITSCREENPLAYERS][JOYAXISSET], joyymove[MAXSPLITSCREENPLAYERS][JOYAXISSET];
// current state of the keys: true if pushed
UINT8 gamekeydown[NUMINPUTS];
@@ -187,32 +186,32 @@ void G_MapEventsToControls(event_t *ev)
i = ev->data1;
if (i >= JOYAXISSET || menuactive || CON_Ready() || chat_on)
break;
if (ev->data2 != INT32_MAX) joyxmove[i] = ev->data2;
if (ev->data3 != INT32_MAX) joyymove[i] = ev->data3;
if (ev->data2 != INT32_MAX) joyxmove[0][i] = ev->data2;
if (ev->data3 != INT32_MAX) joyymove[0][i] = ev->data3;
break;
case ev_joystick2: // buttons are virtual keys
i = ev->data1;
if (i >= JOYAXISSET || menuactive)
break;
if (ev->data2 != INT32_MAX) joy2xmove[i] = ev->data2;
if (ev->data3 != INT32_MAX) joy2ymove[i] = ev->data3;
if (ev->data2 != INT32_MAX) joyxmove[1][i] = ev->data2;
if (ev->data3 != INT32_MAX) joyymove[1][i] = ev->data3;
break;
case ev_joystick3:
i = ev->data1;
if (i >= JOYAXISSET)
break;
if (ev->data2 != INT32_MAX) joy3xmove[i] = ev->data2;
if (ev->data3 != INT32_MAX) joy3ymove[i] = ev->data3;
if (ev->data2 != INT32_MAX) joyxmove[2][i] = ev->data2;
if (ev->data3 != INT32_MAX) joyymove[2][i] = ev->data3;
break;
case ev_joystick4:
i = ev->data1;
if (i >= JOYAXISSET)
break;
if (ev->data2 != INT32_MAX) joy4xmove[i] = ev->data2;
if (ev->data3 != INT32_MAX) joy4ymove[i] = ev->data3;
if (ev->data2 != INT32_MAX) joyxmove[3][i] = ev->data2;
if (ev->data3 != INT32_MAX) joyymove[3][i] = ev->data3;
break;
default:
@@ -258,15 +257,6 @@ void G_ResetControls(void)
memset(joyxmove, 0, sizeof(joyxmove));
memset(joyymove, 0, sizeof(joyymove));
memset(joy2xmove, 0, sizeof(joy2xmove));
memset(joy2ymove, 0, sizeof(joy2ymove));
memset(joy3xmove, 0, sizeof(joy3xmove));
memset(joy3ymove, 0, sizeof(joy3ymove));
memset(joy4xmove, 0, sizeof(joy4xmove));
memset(joy4ymove, 0, sizeof(joy4ymove));
// reset those just in case the game missed the keyup event
memset(dpadscrollstate, false, sizeof(dpadscrollstate));
}
+8 -5
View File
@@ -41,10 +41,12 @@ typedef enum
KEY_DBLJOY1 = KEY_DBLMOUSE1 + MOUSEBUTTONS,
KEY_DBLHAT1 = KEY_DBLJOY1 + JOYBUTTONS,
KEY_2JOY1 = KEY_DBLHAT1 + MOUSEBUTTONS,
KEY_2MOUSE1 = KEY_DBLHAT1 + JOYHATS*4,
KEY_2JOY1 = KEY_2MOUSE1 + MOUSEBUTTONS,
KEY_2HAT1 = KEY_2JOY1 + JOYBUTTONS,
KEY_DBL2JOY1 = KEY_2HAT1 + MOUSEBUTTONS,
KEY_DBL2MOUSE1 = KEY_2HAT1 + JOYHATS*4,
KEY_DBL2JOY1 = KEY_DBL2MOUSE1 + MOUSEBUTTONS,
KEY_DBL2HAT1 = KEY_DBL2JOY1 + JOYBUTTONS,
KEY_3JOY1 = KEY_DBL2HAT1 + JOYHATS*4,
@@ -61,8 +63,10 @@ typedef enum
KEY_MOUSEWHEELUP = KEY_DBL4HAT1 + JOYHATS*4,
KEY_MOUSEWHEELDOWN = KEY_MOUSEWHEELUP + 1,
KEY_2MOUSEWHEELUP = KEY_MOUSEWHEELDOWN + 1,
KEY_2MOUSEWHEELDOWN = KEY_2MOUSEWHEELUP + 1,
NUMINPUTS = KEY_MOUSEWHEELDOWN + 1,
NUMINPUTS = KEY_2MOUSEWHEELDOWN + 1, // FIXME: all the mouse 2 stuff should be removed, but it screws up mappings somehow
} key_input_e;
typedef enum
@@ -113,8 +117,7 @@ extern consvar_t cv_gamepadled[MAXSPLITSCREENPLAYERS];
extern INT32 mousex, mousey;
extern INT32 mlooky; //mousey with mlookSensitivity
extern INT32 joyxmove[JOYAXISSET], joyymove[JOYAXISSET], joy2xmove[JOYAXISSET], joy2ymove[JOYAXISSET],
joy3xmove[JOYAXISSET], joy3ymove[JOYAXISSET], joy4xmove[JOYAXISSET], joy4ymove[JOYAXISSET];
extern INT32 joyxmove[MAXSPLITSCREENPLAYERS][JOYAXISSET], joyymove[MAXSPLITSCREENPLAYERS][JOYAXISSET];
// current state of the keys: true if pushed
extern UINT8 gamekeydown[NUMINPUTS];
+3 -2
View File
@@ -161,7 +161,7 @@ static boolean SameVertice (polyvertex_t *p1, polyvertex_t *p2)
return false;
#else
#define DIVLINE_VERTEX_DIFF 0.45f
float ep = DIVLINE_VERTEX_DIFF;
static const float ep = DIVLINE_VERTEX_DIFF;
if (fabsf( p2->x - p1->x ) > ep )
return false;
if (fabsf( p2->y - p1->y ) > ep )
@@ -283,6 +283,7 @@ static void SplitPoly (fdivline_t *bsp, //splitting parametric line
*backpoly = NULL;
return;
}
if (pe <= ps)
I_Error("SplitPoly: invalid splitting line (%d %d)", ps, pe);
@@ -368,7 +369,7 @@ static poly_t *CutOutSubsecPoly(seg_t *lseg, INT32 count, poly_t *poly)
for (; count--; lseg++)
{
//x,y,dx,dy (like a divline)
line_t *line = lseg->linedef;
const line_t *line = lseg->linedef;
// portal check
if (!gl_maphasportals && line->special == PORTALSPECIAL && lseg->side == 0)
+1 -1
View File
@@ -121,7 +121,7 @@ static clipnode_t * gld_clipnode_NewRange(angle_t start, angle_t end)
boolean gld_clipper_SafeCheckRange(angle_t startAngle, angle_t endAngle)
{
if(startAngle > endAngle)
if (startAngle > endAngle)
{
return (gld_clipper_IsRangeVisible(startAngle, ANGLE_MAX) || gld_clipper_IsRangeVisible(0, endAngle));
}
+34 -30
View File
@@ -1049,7 +1049,7 @@ static void HWR_SplitWall(sector_t *sector, FOutVector *wallVerts, INT32 texnum,
if ((endtop < endrealbot) && (top < realbot))
return;
lightlist_t *list = sector->lightlist;
const lightlist_t *list = sector->lightlist;
if (!(list[i].flags & FF_NOSHADE))
{
@@ -1387,9 +1387,9 @@ void HWR_ProcessSeg(void) // Sort of like GLWall::Process in GZDoom
wallVerts[2].z = wallVerts[1].z = ve.y;
// x offset the texture
fixed_t texturehpeg = gl_sidedef->textureoffset + gl_curline->offset;
float cliplow = (float)texturehpeg;
float cliphigh = (float)(texturehpeg + (gl_curline->flength*FRACUNIT));
const fixed_t texturehpeg = gl_sidedef->textureoffset + gl_curline->offset;
const float cliplow = (float)texturehpeg;
const float cliphigh = (float)(texturehpeg + (gl_curline->flength*FRACUNIT));
FUINT lightnum = gl_frontsector->lightlevel;
extracolormap_t *colormap = gl_frontsector->extra_colormap;
@@ -1400,7 +1400,7 @@ void HWR_ProcessSeg(void) // Sort of like GLWall::Process in GZDoom
if (gl_frontsector)
Surf.PolyColor.s.alpha = 255;
INT32 gl_midtexture = R_GetTextureNum(gl_sidedef->midtexture);
const INT32 gl_midtexture = R_GetTextureNum(gl_sidedef->midtexture);
GLMapTexture_t *glTex = NULL;
// two sided line
@@ -1678,7 +1678,7 @@ void HWR_ProcessSeg(void) // Sort of like GLWall::Process in GZDoom
}
// Find the wall's coordinates
fixed_t midtexheight = textureheight[gl_midtexture] * repeats;
const fixed_t midtexheight = textureheight[gl_midtexture] * repeats;
if (gl_linedef->flags & ML_EFFECT2)
{
@@ -2004,6 +2004,7 @@ void HWR_ProcessSeg(void) // Sort of like GLWall::Process in GZDoom
wallVerts[0].s = wallVerts[3].s = cliplow * glTex->scaleX;
wallVerts[2].s = wallVerts[1].s = cliphigh * glTex->scaleX;
}
FBITFIELD blendmode;
if (roverflags & FF_FOG)
@@ -3296,7 +3297,7 @@ static gl_vissprite_t gl_overflowsprite;
static gl_vissprite_t *HWR_GetVisSprite(UINT32 num)
{
UINT32 chunk = num >> VISSPRITECHUNKBITS;
const UINT32 chunk = num >> VISSPRITECHUNKBITS;
// Allocate chunk if necessary
if (!gl_visspritechunks[chunk])
@@ -3358,13 +3359,6 @@ static void HWR_DrawSpriteShadow(gl_vissprite_t *spr, patch_t *gpatch, GLPatch_t
fixed_t slopez;
float offset = 0;
// technically this_scale gets multiplied and added to sprite y/x scale, but this thing needs it for some crap so ill just throw it in here again
const boolean hires = (spr->mobj && spr->mobj->skin && K_GetMobjSkin(spr->mobj)->flags & SF_HIRES);
if (spr->mobj)
this_scale = FixedToFloat(spr->mobj->scale);
if (hires)
this_scale = this_scale * FixedToFloat(K_GetMobjSkin(spr->mobj)->highresscale);
R_GetShadowZ(spr->mobj, &floorslope);
mobjfloor = HWR_OpaqueFloorAtPos(
@@ -3415,6 +3409,14 @@ static void HWR_DrawSpriteShadow(gl_vissprite_t *spr, patch_t *gpatch, GLPatch_t
else
floorheight = FixedInt(spr->mobj->z - mobjfloor);
// technically this_scale gets multiplied and added to sprite y/x scale, but this thing needs it for some crap so ill just throw it in here again
const boolean hires = (spr->mobj && spr->mobj->skin && K_GetMobjSkin(spr->mobj)->flags & SF_HIRES);
if (spr->mobj)
this_scale = FixedToFloat(spr->mobj->scale);
if (hires)
this_scale = this_scale * FixedToFloat(K_GetMobjSkin(spr->mobj)->highresscale);
// create the sprite billboard
//
// 3--2
@@ -4147,8 +4149,8 @@ gl_vissprite_t* gl_vsprorder[MAXVISSPRITES];
// sorted and drawn together with transparent surfaces.
static int CompareVisSprites(const void *p1, const void *p2)
{
gl_vissprite_t* spr1 = *(gl_vissprite_t*const*)p1;
gl_vissprite_t* spr2 = *(gl_vissprite_t*const*)p2;
const gl_vissprite_t* spr1 = *(gl_vissprite_t*const*)p1;
const gl_vissprite_t* spr2 = *(gl_vissprite_t*const*)p2;
int idiff;
float fdiff;
@@ -4326,8 +4328,8 @@ static void HWR_AddTransparentPolyobjectFloor(lumpnum_t lumpnum, polyobj_t *poly
static int CompareDrawNodePlanes(const void *p1, const void *p2)
{
INT32 n1 = *(const INT32*)p1;
INT32 n2 = *(const INT32*)p2;
const INT32 n1 = *(const INT32*)p1;
const INT32 n2 = *(const INT32*)p2;
return ABS(drawnodes[n2].u.plane.fixedheight - viewz) - ABS(drawnodes[n1].u.plane.fixedheight - viewz);
}
@@ -4673,8 +4675,6 @@ static void HWR_ProjectSprite(mobj_t *thing)
if (interp.spritexscale < 1 || interp.spriteyscale < 1)
return;
const boolean papersprite = (thing->frame & FF_PAPERSPRITE);
INT32 blendmode;
if (thing->frame & FF_BLENDMASK)
blendmode = ((thing->frame & FF_BLENDMASK) >> FF_BLENDSHIFT) + 1;
@@ -4688,6 +4688,8 @@ static void HWR_ProjectSprite(mobj_t *thing)
return;
}
const boolean papersprite = (thing->frame & FF_PAPERSPRITE);
// transform the origin point
tr_x = FixedToFloat(interp.x);
tr_y = FixedToFloat(interp.y);
@@ -4715,12 +4717,6 @@ static void HWR_ProjectSprite(mobj_t *thing)
rot = (thing->frame & FF_FRAMEMASK);
#ifdef ROTSPRITE
// determine here if sprite should rotate for optimization
const boolean sliprollrotate = (cv_sliptideroll.value && (thing->player && thing->player->sliproll));
const boolean shouldrotate = (interp.sloperoll || interp.slopepitch || interp.roll || interp.pitch || thing->rollangle || sliprollrotate);
#endif
//Fab : 02-08-98: 'skin' override spritedef currently used for skin
if ((thing->skin || thing->localskin) && thing->sprite == SPR_PLAY)
{
@@ -4759,6 +4755,12 @@ static void HWR_ProjectSprite(mobj_t *thing)
I_Error("sprframes NULL for sprite %d\n", thing->sprite);
#endif
#ifdef ROTSPRITE
// determine here if sprite should rotate for optimization
const boolean sliprollrotate = (cv_sliptideroll.value && (thing->player && thing->player->sliproll));
const boolean shouldrotate = (interp.sloperoll || interp.slopepitch || interp.roll || interp.pitch || thing->rollangle || sliprollrotate);
#endif
if (sprframe->rotate != SRF_SINGLE || papersprite
#ifdef ROTSPRITE
|| (shouldrotate)
@@ -5202,13 +5204,13 @@ void HWR_BuildSkyDome(void)
{
int c, r;
signed char yflip;
int row_count = 4;
static constexpr int row_count = 4;
int col_count = 4;
float delta;
gl_sky_t *sky = &gl_sky;
gl_skyvertex_t *vertex_p;
texture_t *texture = textures[texturetranslation[skytexture]];
const texture_t *texture = textures[texturetranslation[skytexture]];
sky->detail = 16;
col_count *= sky->detail;
@@ -5417,7 +5419,7 @@ void HWR_SetTransform(float fpov)
void HWR_ClearClipper(void)
{
angle_t a1 = gld_FrustumAngle(gl_aimingangle);
const angle_t a1 = gld_FrustumAngle(gl_aimingangle);
gld_clipper_Clear();
gld_clipper_SafeAddClipRange(viewangle + a1, viewangle - a1);
#ifdef HAVE_SPHEREFRUSTRUM
@@ -5723,6 +5725,8 @@ void HWR_RenderPlayerView(void)
HWR_RenderFrame(player, false);
}
// Determine on mapload if current map has any Horizonlines present
// so we can avoid rather hot checks in HWR_Subsector
static void HWR_CheckForHorizonLines(void)
{
size_t i;
@@ -5976,7 +5980,7 @@ void HWR_Shutdown(void)
static void HWR_RenderWall(FOutVector *wallVerts, FSurfaceInfo *pSurf, FBITFIELD blend, boolean fogwall, INT32 lightlevel, extracolormap_t *wallcolormap)
{
FBITFIELD blendmode = blend;
UINT8 alpha = pSurf->PolyColor.s.alpha; // retain the alpha
const UINT8 alpha = pSurf->PolyColor.s.alpha; // retain the alpha
INT32 shader = SHADER_NONE;
+6 -8
View File
@@ -310,7 +310,7 @@ void HU_LoadGraphics(void)
lt_font[0] = (patch_t *)W_CachePatchName("LTFNT039", PU_HUDGFX); /// \note fake start hack
// Number support
lt_font[9] = (patch_t *)W_CachePatchName("LTFNT048", PU_HUDGFX);
lt_font[9] = (patch_t *)W_CachePatchName("LTFNT048", PU_HUDGFX);
lt_font[10] = (patch_t *)W_CachePatchName("LTFNT049", PU_HUDGFX);
lt_font[11] = (patch_t *)W_CachePatchName("LTFNT050", PU_HUDGFX);
lt_font[12] = (patch_t *)W_CachePatchName("LTFNT051", PU_HUDGFX);
@@ -747,7 +747,7 @@ static void Command_CSay_f(void)
return;
}
if(!server && !IsPlayerAdmin(consoleplayer))
if (!server && !IsPlayerAdmin(consoleplayer))
{
CONS_Alert(CONS_NOTICE, M_GetText("Only servers and admins can use csay.\n"));
return;
@@ -2881,13 +2881,11 @@ void HU_DoCEcho(const char *msg)
*p = '\n';
CONS_Printf("%s\n", temp);
return;
}
else if (cv_cechotoggle.value)
cechotimer = cechoduration;
I_OutputMsg("%s\n", msg); // print to log
if (!cv_cechotoggle.value)
return;
cechotimer = cechoduration;
I_OutputMsg("%s\n", msg); // ALWAYS print to log
}
+1 -7
View File
@@ -1475,13 +1475,7 @@ static void AddBannedIndex(void)
banned_size *= 2;
}
banned = Z_ReallocAlign(
(void*) banned,
sizeof(banned_t) * banned_size,
PU_STATIC,
NULL,
sizeof(banned_t) * 8
);
banned = Z_Realloc((void*) banned, sizeof(banned_t) * banned_size, PU_STATIC, NULL);
}
numbans++;
+2
View File
@@ -145,6 +145,8 @@ boolean I_UseNativeKeyboard(void);
boolean I_CheckNativeRes(void);
void I_SetBorderlessWindow(void);
#ifdef USE_FBO_OGL
void RefreshOGLSDLSurface(void);
+6 -5
View File
@@ -3081,14 +3081,12 @@ static void K_SpawnDriftSparks(player_t *player)
if (leveltime % 2 == 1)
return;
if (cv_airsparks.value)
goto skipground;
const boolean onground = P_IsObjectOnGround(player->mo);
if (!P_IsObjectOnGround(player->mo))
// kinda sketchy
if (!cv_airsparks.value && !onground)
return;
skipground: // idk im sleepy
if (!player->kartstuff[k_drift] || player->kartstuff[k_driftcharge] < K_GetKartDriftSparkValue(player))
return;
@@ -3105,6 +3103,8 @@ skipground: // idk im sleepy
newy = player->mo->y + P_ReturnThrustY(player->mo, thrustangle, smolscale);
spark = P_SpawnMobj(newx, newy, player->mo->z, MT_DRIFTSPARK);
spark->islocal = cv_airsparks.value && !onground;
P_SetTarget(&spark->target, player->mo);
spark->angle = travelangle-(ANGLE_45/5)*player->kartstuff[k_drift];
@@ -5361,6 +5361,7 @@ FUNCINLINE static ATTRINLINE void K_SpawnNormalSpeedLines(player_t *player, bool
fast->momx = 3*player->mo->momx/4;
fast->momy = 3*player->mo->momy/4;
fast->momz = 3*player->mo->momz/4;
fast->islocal = !synched;
P_SetTarget(&fast->target, player->mo); // easier lua access
K_MatchGenericExtraFlags(fast, player->mo);
+2 -1
View File
@@ -150,7 +150,8 @@ static const udata_field_t mobj_fields[] = {
FIELD(mobj_t, cvmem, udatalib_getter_int32, udatalib_setter_int32),
FIELD(mobj_t, standingslope, udatalib_getter_slope, mobj_standingslope_noset),
FIELD(mobj_t, colorized, udatalib_getter_boolean, udatalib_setter_boolean),
FIELD(mobj_t, mirrored, udatalib_getter_boolean, udatalib_setter_boolean),
FIELD(mobj_t, mirrored, udatalib_getter_boolean, udatalib_setter_boolean),
FIELD(mobj_t, islocal, udatalib_getter_boolean, udatalib_setter_boolean),
{ NULL, 0, NULL, NULL },
};
#undef FIELD
+13 -12
View File
@@ -1114,10 +1114,10 @@ static menuitem_t MP_PlayerSetupMenu[] =
#ifndef NONET
static menuitem_t MP_ConnectMenu[] =
{
{IT_STRING | IT_KEYHANDLER, NULL, "", M_HandleServerSearch,0},
{IT_STRING | IT_CVAR, NULL, "Sort By", &cv_serversort, 16},
{IT_STRING | IT_KEYHANDLER, NULL, "Page", M_HandleServerPage, 24},
{IT_STRING | IT_CALL, NULL, "Refresh", M_Refresh, 32},
{IT_STRING | IT_CVAR, NULL, "Sort By", &cv_serversort, 0},
{IT_STRING | IT_KEYHANDLER, NULL, "Page", M_HandleServerPage, 8},
{IT_STRING | IT_CALL, NULL, "Refresh", M_Refresh, 16},
{IT_STRING | IT_KEYHANDLER, NULL, "", M_HandleServerSearch,25},
{IT_STRING | IT_SPACE, NULL, "", M_Connect, 48},
{IT_STRING | IT_SPACE, NULL, "", M_Connect, 60},
@@ -1133,10 +1133,10 @@ static menuitem_t MP_ConnectMenu[] =
enum
{
mp_connect_search,
mp_connect_sort,
mp_connect_page,
mp_connect_refresh,
mp_connect_search,
FIRSTSERVERLINE
};
#endif
@@ -6072,8 +6072,8 @@ static void M_AddonsOptions(INT32 choice)
M_SetupNextMenu(&OP_AddonsOptionsDef);
}
#define LOCATIONSTRING1 "Visit \x83SRB2.ORG/MODS\x80 to get & make addons!"
#define LOCATIONSTRING2 "Visit \x88SRB2.ORG/MODS\x80 to get & make addons!"
#define LOCATIONSTRING1 "Visit \x83mb.srb2.org/addons\x80 to get & make addons!"
#define LOCATIONSTRING2 "Visit \x88mb.srb2.org/addons\x80 to get & make addons!"
static void M_AddonsInternal(void)
{
@@ -9884,15 +9884,16 @@ static void M_DrawConnectMenu(void)
M_DrawServerLines(currentMenu->x, serverlistpage);
}
V_DrawFill(currentMenu->x, currentMenu->y, MAXSTRINGLENGTH*8+6, 8+6, 239);
INT32 input_y = currentMenu->menuitems[mp_connect_search].alphaKey;
V_DrawFill(currentMenu->x, currentMenu->y+input_y, MAXSTRINGLENGTH*8+6, 8+6, 239);
const INT32 xoff = 3, yoff = 3;
if (itemOn != 0)
V_DrawString(currentMenu->x+xoff, currentMenu->y+yoff, V_ALLOWLOWERCASE, menuinput.buffer);
if (itemOn != mp_connect_search)
V_DrawString(currentMenu->x+xoff, currentMenu->y+yoff+input_y, V_ALLOWLOWERCASE, menuinput.buffer);
else
M_DrawTextInput(currentMenu->x+xoff, currentMenu->y+yoff, &menuinput, 0);
M_DrawTextInput(currentMenu->x+xoff, currentMenu->y+yoff+input_y, &menuinput, 0);
localservercount = serverlistcount;
+1
View File
@@ -414,6 +414,7 @@ typedef struct mobj_s
boolean init_salty;
// WARNING: New fields must be added separately to savegame and Lua.
boolean islocal; // BEWARE: islocal does not exist in vanilla, strictly to be used for locally loaded addons to not cause desynchs with the mobj linedef trigger check. DO NOT USE THIS IN ACTUAL ADDONS YOU INTEND TO USE ON YOUR SERVER
} mobj_t;
//
+4 -5
View File
@@ -1254,8 +1254,7 @@ static void R_InitColormaps(void)
// Load in the light tables
lump = W_GetNumForName("COLORMAP");
//Z_MallocAlign(W_LumpLength (lump), PU_STATIC, NULL, 8);
colormaps = Z_MallocAlign((256 * 64), PU_STATIC, NULL, 8);
colormaps = Z_Malloc((256 * 64), PU_STATIC, NULL);
W_ReadLump(lump, colormaps);
// no need to init encoremap at this stage
@@ -1296,7 +1295,7 @@ void R_ReInitColormaps(UINT16 num, lumpnum_t newencoremap)
lighttable_t *colormap_p, *colormap_p2;
size_t p, i;
encoremap = Z_MallocAlign(256 + 10, PU_LEVEL, NULL, 8);
encoremap = Z_Malloc(256 + 10, PU_LEVEL, NULL);
W_ReadLump(newencoremap, encoremap);
colormap_p = colormap_p2 = colormaps;
colormap_p += (256 * 32);
@@ -1355,7 +1354,7 @@ void R_ClearColormaps(void)
foundcolormaps[num_extra_colormaps] = lump;
// aligned on 8 bit for asm code
extra_colormaps[num_extra_colormaps].colormap = Z_MallocAlign(W_LumpLength(lump), PU_LEVEL, NULL, 16);
extra_colormaps[num_extra_colormaps].colormap = Z_Malloc(W_LumpLength(lump), PU_LEVEL, NULL);
W_ReadLump(lump, extra_colormaps[num_extra_colormaps].colormap);
// We set all params of the colormap to normal because there
@@ -1551,7 +1550,7 @@ INT32 R_CreateColormap(char *p1, char *p2, char *p3)
}
// Now allocate memory for the actual colormap array itself!
colormap_p = Z_MallocAlign((256 * (encoremap ? 64 : 32)) + 10, PU_LEVEL, NULL, 8);
colormap_p = Z_Malloc((256 * (encoremap ? 64 : 32)) + 10, PU_LEVEL, NULL);
extra_colormaps[mapnum].colormap = (UINT8 *)colormap_p;
// Calculate the palette index for each palette index, for each light level
+3 -3
View File
@@ -119,7 +119,7 @@ void R_InitTranslucencyTables(void)
// Load here the transparency lookup tables 'TRANSx0'
// NOTE: the TRANSx0 resources MUST BE aligned on 64k for the asm
// optimised code (in other words, transtables pointer low word is 0)
transtables = static_cast<UINT8*>(Z_MallocAlign(NUMTRANSTABLES*0x10000, PU_STATIC, NULL, 16));
transtables = static_cast<UINT8*>(Z_Malloc(NUMTRANSTABLES*0x10000, PU_STATIC, NULL));
W_ReadLump(W_GetNumForName("TRANS10"), transtables);
W_ReadLump(W_GetNumForName("TRANS20"), transtables+0x10000);
@@ -246,7 +246,7 @@ static void R_GenerateBlendTables(void)
INT32 i;
for (i = 0; i < NUMBLENDMAPS; i++)
blendtables[i] = static_cast<UINT8*>(Z_MallocAlign(BlendTab_Count[i] * 0x10000, PU_STATIC, NULL, 16));
blendtables[i] = static_cast<UINT8*>(Z_Malloc(BlendTab_Count[i] * 0x10000, PU_STATIC, NULL));
InitColorLUT(&transtab_lut, pLocalPalette, false);
@@ -365,7 +365,7 @@ static UINT8* RGetTranslationColormap(INT32 skinnum, skincolors_t color, UINT8 f
// Generate the colormap if necessary
if (!ret)
{
ret = static_cast<UINT8*>(Z_MallocAlign(NUM_PALETTE_ENTRIES, (flags & GTC_CACHE) ? PU_LEVEL : PU_STATIC, NULL, 8));
ret = static_cast<UINT8*>(Z_Malloc(NUM_PALETTE_ENTRIES, (flags & GTC_CACHE) ? PU_LEVEL : PU_STATIC, NULL));
K_GenerateKartColormap(ret, skinnum, color, local); //R_GenerateTranslationColormap(ret, skinnum, color); // SRB2kart
// Cache the colormap if desired
+8 -20
View File
@@ -42,13 +42,13 @@ static CV_PossibleValue_t fpscap_cons_t[] = {
{0, NULL}
};
consvar_t cv_fpscap = {"fpscap", "Match refresh rate", CV_SAVE, fpscap_cons_t, NULL, 0, NULL, NULL, 0, 0, NULL};
consvar_t cv_fpscap = {"fpscap", "Match refresh rate", CV_SAVE, fpscap_cons_t, NULL, 0, NULL, NULL, 0, 0, NULL};
consvar_t cv_fpscapbg = {"fpscapbackground", "Match refresh rate", CV_SAVE, fpscap_cons_t, NULL, 0, NULL, NULL, 0, 0, NULL};
consvar_t cv_precipinterp = {"precipinterpolation", "On", CV_SAVE, CV_OnOff, NULL, 0, NULL, NULL, 0, 0, NULL};
ps_metric_t ps_interp_frac = {0};
ps_metric_t ps_interp_lag = {0};
ps_metric_t ps_interp_lag = {0};
static boolean R_UseBackgroundFramerateCap(void)
{
@@ -67,21 +67,21 @@ static boolean R_UseBackgroundFramerateCap(void)
return false;
}
static UINT32 R_GetBackgroundFramerateCap(void)
static UINT32 R_GetFrameCap(INT32 val)
{
if (cv_fpscapbg.value == 0)
if (val == 0)
{
// 0: Match refresh rate
return I_GetRefreshRate();
}
if (cv_fpscapbg.value < 0)
if (val < 0)
{
// -1: Unlimited
return 0;
}
return cv_fpscapbg.value;
return val;
}
UINT32 R_GetFramerateCap(void)
@@ -95,22 +95,10 @@ UINT32 R_GetFramerateCap(void)
if (R_UseBackgroundFramerateCap())
{
return R_GetBackgroundFramerateCap();
return R_GetFrameCap(cv_fpscapbg.value);
}
if (cv_fpscap.value == 0)
{
// 0: Match refresh rate
return I_GetRefreshRate();
}
if (cv_fpscap.value < 0)
{
// -1: Unlimited
return 0;
}
return cv_fpscap.value;
return R_GetFrameCap(cv_fpscap.value);
}
boolean R_UsingFrameInterpolation(void)
+34 -32
View File
@@ -1133,7 +1133,6 @@ static void R_SetupSkyScale(player_t *player, camera_t *thiscam, mapheader_t *mh
{
if (skyboxmo[1])
{
angle_t ang;
fixed_t x = 0, y = 0;
if (mh->skybox_scalex > 0)
@@ -1165,8 +1164,8 @@ static void R_SetupSkyScale(player_t *player, camera_t *thiscam, mapheader_t *mh
newview->y -= x;
break;
default:
ang = viewmobj->angle>>ANGLETOFINESHIFT;
newview->x += FixedMul(x,FINECOSINE(ang)) - FixedMul(y, FINESINE(ang));
angle_t ang = viewmobj->angle>>ANGLETOFINESHIFT;
newview->x += FixedMul(x,FINECOSINE(ang)) - FixedMul(y, FINESINE(ang));
newview->y += FixedMul(x, FINESINE(ang)) + FixedMul(y,FINECOSINE(ang));
break;
}
@@ -1192,14 +1191,14 @@ static void R_SetupSkyScale(player_t *player, camera_t *thiscam, mapheader_t *mh
}
}
void R_SkyboxFrame(int s)
void R_SkyboxFrame(UINT8 pnum)
{
player_t *player = &players[displayplayers[s]];
camera_t *thiscam = &camera[s];
subsector_t *subsector = NULL;
player_t *player = &players[displayplayers[pnum]];
camera_t *thiscam = &camera[pnum];
sector_t *viewsec = NULL;
mapheader_t *mh = mapheaderinfo[gamemap-1];
R_SetViewContext(static_cast<viewcontext_e>(VIEWCONTEXT_SKY1 + s));
R_SetViewContext(static_cast<viewcontext_e>(VIEWCONTEXT_SKY1 + pnum));
// cut-away view stuff
newview->sky = true;
@@ -1215,35 +1214,38 @@ void R_SkyboxFrame(int s)
R_SetupAimingFrame(player, thiscam);
newview->angle += viewmobj->angle;
if (!P_MobjWasRemoved(viewmobj))
{
newview->angle += viewmobj->angle;
newview->x = viewmobj->x;
newview->y = viewmobj->y;
newview->z = (viewmobj->spawnpoint) ? (((fixed_t)viewmobj->spawnpoint->angle)<<FRACBITS) : 0;
newview->x = viewmobj->x;
newview->y = viewmobj->y;
newview->z = (viewmobj->spawnpoint) ? (((fixed_t)viewmobj->spawnpoint->angle) << FRACBITS) : 0;
if (viewmobj->subsector)
viewsec = viewmobj->subsector->sector;
}
if (mh)
{
R_SetupSkyScale(player, thiscam, mh);
}
if (!P_MobjWasRemoved(viewmobj) && viewmobj->subsector && viewmobj->subsector->sector)
subsector = viewmobj->subsector;
R_SetupCommonFrame(player, subsector->sector);
R_SetupCommonFrame(player, viewsec);
}
void R_SetupFrame(int s, boolean skybox)
void R_SetupFrame(UINT8 pnum, boolean skybox)
{
player_t *player = &players[displayplayers[s]];
camera_t *thiscam = &camera[s];
boolean chasecam = (cv_chasecam[s].value);
sector_t * sector = NULL;
player_t *player = &players[displayplayers[pnum]];
camera_t *thiscam = &camera[pnum];
boolean chasecam = (cv_chasecam[pnum].value);
sector_t *viewsec = NULL;
R_SetViewContext(static_cast<viewcontext_e>(VIEWCONTEXT_PLAYER1 + s));
R_SetViewContext(static_cast<viewcontext_e>(VIEWCONTEXT_PLAYER1 + pnum));
if (thiscam->reset)
{
R_ResetViewInterpolation(s);
R_ResetViewInterpolation(pnum);
thiscam->reset = false;
}
@@ -1278,10 +1280,10 @@ void R_SetupFrame(int s, boolean skybox)
newview->y = viewmobj->y;
newview->z = viewmobj->z + 20*FRACUNIT;
if (viewmobj->subsector && viewmobj->subsector->sector)
sector = viewmobj->subsector->sector;
if (viewmobj->subsector)
viewsec = viewmobj->subsector->sector;
R_SetupCommonFrame(player, sector);
R_SetupCommonFrame(player, viewsec);
}
else if (thiscam && chasecam) // use outside cam view
{
@@ -1292,10 +1294,10 @@ void R_SetupFrame(int s, boolean skybox)
newview->y = thiscam->y;
newview->z = thiscam->z + (thiscam->height>>1);
if (thiscam->subsector && thiscam->subsector->sector)
sector = thiscam->subsector->sector;
if (thiscam->subsector)
viewsec = thiscam->subsector->sector;
R_SetupCommonFrame(player, sector);
R_SetupCommonFrame(player, viewsec);
}
else if (player->mo) // use the player's eyes view
{
@@ -1306,10 +1308,10 @@ void R_SetupFrame(int s, boolean skybox)
newview->y = viewmobj->y;
newview->z = player->viewz;
if (viewmobj->subsector && viewmobj->subsector->sector)
sector = viewmobj->subsector->sector;
if (viewmobj->subsector)
viewsec = viewmobj->subsector->sector;
R_SetupCommonFrame(player, sector);
R_SetupCommonFrame(player, viewsec);
}
}
+2 -2
View File
@@ -215,8 +215,8 @@ void R_SetViewSize(void);
void R_ExecuteSetViewSize(void);
fixed_t R_GetPlayerFov(player_t *player);
void R_SkyboxFrame(int s);
void R_SetupFrame(int s, boolean skybox);
void R_SkyboxFrame(UINT8 pnum);
void R_SetupFrame(UINT8 pnum, boolean skybox);
// Called by G_Drawer.
void R_RenderPlayerView(player_t *player);
+2 -2
View File
@@ -1166,7 +1166,7 @@ static void R_DrawWallColumn(drawcolumndata_t* dc, INT32 yl, INT32 yh, fixed_t m
dc->source = R_GetColumn(texture, texturecolumn);
dc->texheight = textureheight[texture] >> FRACBITS;
dc->sourcelength = dc->texheight;
R_SetColumnFunc(colfunctype);
//R_SetColumnFunc(colfunctype);
coldrawfunc_t* colfunccopy = colfunc;
drawcolumndata_t dc_copy = *dc;
if (remap)
@@ -2888,7 +2888,7 @@ void R_StoreWallRange(INT32 start, INT32 stop)
didsolidcol = false;
if (!segtextured && !numffloors)
if (!segtextured && !numffloors && !numbackffloors)
{
if (markfloor || markceiling)
R_MarkSegBounds();
+5 -1
View File
@@ -66,7 +66,9 @@ static void Highreshudscale_OnChange(void)
static void SCR_ChangeFullscreen (void);
consvar_t cv_fullscreen = {"fullscreen", "Yes", CV_SAVE|CV_CALL, CV_YesNo, SCR_ChangeFullscreen, 0, NULL, NULL, 0, 0, NULL};
static CV_PossibleValue_t fullscreen_cons_t[] = {{0, "No"}, {1, "Yes"}, {2, "Borderless Window"}, {0, NULL}};
consvar_t cv_fullscreen = {"fullscreen", "Yes", CV_SAVE|CV_CALL, fullscreen_cons_t, SCR_ChangeFullscreen, 0, NULL, NULL, 0, 0, NULL};
static CV_PossibleValue_t accuratefps_cons_t[] = {{0, "Inaccurate"}, {1, "Accurate"}, {0, NULL}};
consvar_t cv_accuratefps = {"fpssampling", "1", CV_SAVE, accuratefps_cons_t, NULL, 0, NULL, NULL, 0, 0, NULL};
@@ -325,6 +327,8 @@ void SCR_SetDefaultMode(void)
void SCR_ChangeFullscreen(void)
{
#ifdef DIRECTFULLSCREEN
I_SetBorderlessWindow(); // Running this here so we can have borderless window at startup
// allow_fullscreen is set by VID_PrepareModeList
// it is used to prevent switching to fullscreen during startup
if (!allow_fullscreen)
+8 -1
View File
@@ -150,7 +150,7 @@ UINT8 graphics_started = 0; // Is used in console.c and screen.c
// To disable fullscreen at startup; is set in VID_PrepareModeList
boolean allow_fullscreen = false;
static SDL_bool disable_fullscreen = SDL_FALSE;
#define USE_FULLSCREEN (disable_fullscreen||!allow_fullscreen)?0:cv_fullscreen.value
#define USE_FULLSCREEN (disable_fullscreen||!allow_fullscreen)? 0: (cv_fullscreen.value == 1)
static SDL_bool disable_mouse = SDL_FALSE;
#define USE_MOUSEINPUT (!disable_mouse && cv_usemouse.value && havefocus)
#define MOUSE_MENU false //(!disable_mouse && cv_usemouse.value && menuactive && !USE_FULLSCREEN)
@@ -1353,6 +1353,7 @@ static void SDLSetMode(INT32 width, INT32 height, SDL_bool fullscreen)
{
wasfullscreen = SDL_TRUE;
SDL_SetWindowFullscreen(window, SDL_WINDOW_FULLSCREEN_DESKTOP);
I_SetBorderlessWindow();
}
else // windowed mode
{
@@ -2157,4 +2158,10 @@ static void Impl_SetVsync(void)
#endif
}
void I_SetBorderlessWindow(void)
{
SDL_bool borderless = (cv_fullscreen.value == 2) ? SDL_FALSE : SDL_TRUE;
SDL_SetWindowBordered(window, borderless);
}
#endif
+17 -16
View File
@@ -419,27 +419,28 @@ static void ST_drawDebugInfo(void)
static void ST_drawLevelTitle(void)
{
char *lvlttl = mapheaderinfo[gamemap-1]->lvlttl;
char *subttl = mapheaderinfo[gamemap-1]->subttl;
char *zonttl = mapheaderinfo[gamemap-1]->zonttl; // SRB2kart
char *actnum = mapheaderinfo[gamemap-1]->actnum;
INT32 lvlttlxpos;
INT32 ttlnumxpos;
INT32 zonexpos;
INT32 dupcalc = (vid.width/vid.dupx);
UINT8 gtc = G_GetGametypeColor(gametype);
char *lvlttl, *subttl, *zonttl, *actnum;
INT32 lvlttlxpos, ttlnumxpos, zonexpos;
INT32 dupcalc;
UINT8 gtc;
INT32 sub = 0;
INT32 bary = (splitscreen)
? BASEVIDHEIGHT/2
: 163;
INT32 bary;
INT32 lvlw;
if (!cv_stagetitle.value)
if (!cv_stagetitle.value || (timeinmap > 113))
return;
if (timeinmap > 113)
if (*mapheaderinfo[gamemap-1]->lvlttl == '\0')
return;
lvlttl = mapheaderinfo[gamemap-1]->lvlttl;
subttl = mapheaderinfo[gamemap-1]->subttl;
zonttl = mapheaderinfo[gamemap-1]->zonttl; // SRB2kart
actnum = mapheaderinfo[gamemap-1]->actnum;
dupcalc = (vid.width/vid.dupx);
gtc = G_GetGametypeColor(gametype);
bary = (splitscreen) ? BASEVIDHEIGHT/2 : 163;
lvlw = V_LevelNameWidth(lvlttl);
if (actnum[0])
@@ -603,7 +604,7 @@ static void ST_overlayDrawer(void)
}
// draw level title Tails
if (*mapheaderinfo[gamemap-1]->lvlttl != '\0' && !(hu_showscores && (netgame || multiplayer) && !mapreset) && LUA_HudEnabled(hud_stagetitle) && !forceshowhud)
if (!(hu_showscores && (netgame || multiplayer) && !mapreset) && LUA_HudEnabled(hud_stagetitle) && !forceshowhud)
ST_drawLevelTitle();
if (!hu_showscores && netgame && !mapreset)
@@ -740,7 +741,7 @@ void ST_Drawer(void)
UINT8 i;
#ifdef SEENAMES
if (cv_seenames.value && cv_allowseenames.value && displayplayers[0] == consoleplayer && seenplayer && seenplayer->mo && !mapreset)
if (UNLIKELY(cv_seenames.value && cv_allowseenames.value && displayplayers[0] == consoleplayer && seenplayer && seenplayer->mo && !mapreset))
{
if (cv_seenames.value == 1)
V_DrawCenteredString(BASEVIDWIDTH/2, BASEVIDHEIGHT/2 + 15, V_HUDTRANSHALF, player_names[seenplayer-players]);
+1 -1
View File
@@ -611,7 +611,7 @@ static lumpinfo_t* ResGetLumpsZip (FILE* handle, UINT16* nlmp)
fseek(handle, LONG(zend.cdiroffset), SEEK_SET);
char *cdir = (Z_MallocAlign(LONG(zend.cdirsize), PU_STATIC, &cdir, 7));
char *cdir = Z_Malloc(LONG(zend.cdirsize), PU_STATIC, &cdir);
if (fread(cdir, 1, LONG(zend.cdirsize), handle) < (UINT32)(LONG(zend.cdirsize)))
{
+85 -37
View File
@@ -149,9 +149,12 @@ void Z_Free(void *ptr)
#endif
#endif
#ifdef ZDEBUG
#ifdef ZDEBUG2
// Write every Z_Free call to a debug file.
CONS_Debug(DBG_MEMORY, "Z_Free at %s:%d\n", file, line);
#elif defined(ZDEBUG)
(void)file;
(void)line;
#endif
// anything that isn't by lua gets passed to lua just in case.
@@ -202,7 +205,7 @@ static void *xm(size_t size)
return p;
}
/** The Z_MallocAlign function.
/** The Z_Malloc function.
* Allocates a block of memory, adds it to a linked list so we can keep track of it.
*
* \param size Amount of memory to be allocated, in bytes.
@@ -210,22 +213,19 @@ static void *xm(size_t size)
* \param user The address of a pointer to the memory to be allocated.
* When the memory is freed by Z_Free later,
* the pointer at this address will then be automatically set to NULL.
* \param alignbits The alignment of the memory to be allocated, in bits. Can be 0.
* \note You can pass Z_Malloc() a NULL user if the tag is less than PU_PURGELEVEL.
* \sa Z_CallocAlign, Z_ReallocAlign
* \sa Z_Calloc, Z_Realloc
*/
#ifdef ZDEBUG
void *Z_Malloc2(size_t size, INT32 tag, void *user, INT32 alignbits,
void *Z_Malloc2(size_t size, INT32 tag, void *user,
const char *file, INT32 line)
#else
void *Z_MallocAlign(size_t size, INT32 tag, void *user, INT32 alignbits)
void *Z_Malloc(size_t size, INT32 tag, void *user)
#endif
{
memblock_t *block;
void *ptr;
(void)(alignbits); // no longer used, so silence warnings. TODO we should figure out a solution for this
#ifdef ZDEBUG2
CONS_Debug(DBG_MEMORY, "Z_Malloc %s:%d\n", file, line);
#endif
@@ -270,55 +270,53 @@ void *Z_MallocAlign(size_t size, INT32 tag, void *user, INT32 alignbits)
return ptr;
}
/** The Z_CallocAlign function.
/** The Z_Calloc function.
* Allocates a block of memory, adds it to a linked list so we can keep track of it.
* Unlike Z_MallocAlign, this also initialises the bytes to zero.
* Unlike Z_Malloc, this also initialises the bytes to zero.
*
* \param size Amount of memory to be allocated, in bytes.
* \param tag Purge tag.
* \param user The address of a pointer to the memory to be allocated.
* When the memory is freed by Z_Free later,
* the pointer at this address will then be automatically set to NULL.
* \param alignbits The alignment of the memory to be allocated, in bits. Can be 0.
* \note You can pass Z_Calloc() a NULL user if the tag is less than PU_PURGELEVEL.
* \sa Z_MallocAlign, Z_ReallocAlign
* \sa Z_Malloc, Z_Realloc
*/
#ifdef ZDEBUG
void *Z_Calloc2(size_t size, INT32 tag, void *user, INT32 alignbits, const char *file, INT32 line)
void *Z_Calloc2(size_t size, INT32 tag, void *user, const char *file, INT32 line)
#else
void *Z_CallocAlign(size_t size, INT32 tag, void *user, INT32 alignbits)
void *Z_Calloc(size_t size, INT32 tag, void *user)
#endif
{
#ifdef VALGRIND_MEMPOOL_ALLOC
Z_calloc = true;
#endif
#ifdef ZDEBUG
return memset(Z_Malloc2 (size, tag, user, alignbits, file, line), 0, size);
return memset(Z_Malloc2(size, tag, user, file, line), 0, size);
#else
return memset(Z_MallocAlign(size, tag, user, alignbits ), 0, size);
return memset(Z_Malloc (size, tag, user ), 0, size);
#endif
}
/** The Z_ReallocAlign function.
/** The Z_Realloc function.
* Reallocates a block of memory with a new size.
*
* \param ptr A pointer to allocated memory,
* assumed to have been allocated with Z_Malloc/Z_Calloc.
* If NULL, this function instead acts as a wrapper for Z_CallocAlign.
* If NULL, this function instead acts as a wrapper for Z_Calloc.
* \param size New size of memory block, in bytes.
* If zero, then the memory is freed and NULL is returned.
* \param tag New purge tag.
* \param user The address of a pointer to the memory to be reallocated.
* This can be a different user to the one originally assigned to the memory block.
* \param alignbits The alignment of the memory to be allocated, in bits. Can be 0.
* \return A pointer to the reallocated memory. Can be NULL if memory was freed.
* \note You can pass Z_Realloc() a NULL user if the tag is less than PU_PURGELEVEL.
* \sa Z_MallocAlign, Z_CallocAlign
* \sa Z_Malloc, Z_Calloc
*/
#ifdef ZDEBUG
void *Z_Realloc2(void *ptr, size_t size, INT32 tag, void *user, INT32 alignbits, const char *file, INT32 line)
void *Z_Realloc2(void *ptr, size_t size, INT32 tag, void *user, const char *file, INT32 line)
#else
void *Z_ReallocAlign(void *ptr, size_t size, INT32 tag, void *user, INT32 alignbits)
void *Z_Realloc(void *ptr, size_t size, INT32 tag, void *user)
#endif
{
void *rez;
@@ -338,9 +336,9 @@ void *Z_ReallocAlign(void *ptr, size_t size, INT32 tag, void *user, INT32 alignb
if (!ptr)
{
#ifdef ZDEBUG
return Z_Calloc2(size, tag, user, alignbits, file , line);
return Z_Calloc2(size, tag, user, file, line);
#else
return Z_CallocAlign(size, tag, user, alignbits);
return Z_Calloc(size, tag, user);
#endif
}
@@ -348,9 +346,9 @@ void *Z_ReallocAlign(void *ptr, size_t size, INT32 tag, void *user, INT32 alignb
#ifdef PARANOIA
if (block->id != ZONEID)
#ifdef ZDEBUG
I_Error("Z_ReallocAlign at %s:%d: wrong id", file, line);
I_Error("Z_Realloc at %s:%d: wrong id", file, line);
#else
I_Error("Z_ReallocAlign: wrong id");
I_Error("Z_Realloc: wrong id");
#endif
#endif
@@ -358,11 +356,13 @@ void *Z_ReallocAlign(void *ptr, size_t size, INT32 tag, void *user, INT32 alignb
return NULL;
#ifdef ZDEBUG
#ifdef ZDEBUG2
// Write every Z_Realloc call to a debug file.
DEBFILE(va("Z_Realloc at %s:%d\n", file, line));
rez = Z_Malloc2(size, tag, user, alignbits, file, line);
#endif
rez = Z_Malloc2(size, tag, user, file, line);
#else
rez = Z_MallocAlign(size, tag, user, alignbits);
rez = Z_Malloc(size, tag, user);
#endif
if (size < block->realsize)
@@ -394,11 +394,19 @@ void *Z_ReallocAlign(void *ptr, size_t size, INT32 tag, void *user, INT32 alignb
* \param lowtag The lowest tag to consider.
* \param hightag The highest tag to consider.
*/
#ifdef ZDEBUG
void Z_FreeTags2(INT32 lowtag, INT32 hightag, const char *file, INT32 line)
#else
void Z_FreeTags(INT32 lowtag, INT32 hightag)
#endif
{
memblock_t *block, *next;
#ifdef ZDEBUG
Z_CheckHeap2(file, line);
#else
Z_CheckHeap(420);
#endif
for (block = head.next; block != &head; block = next)
{
next = block->next; // get link before freeing
@@ -468,12 +476,20 @@ void Z_CheckMemCleanup(void)
* \param i Identifies from where in the code Z_CheckHeap was called.
* \author Graue <graue@oceanbase.org>
*/
void Z_CheckHeap(INT32 i)
#ifdef ZDEBUG
void Z_CheckHeap2(const char *file, INT32 line)
#else
void Z_CheckHeap(INT32 tag)
#endif
{
memblock_t *block;
UINT32 blocknumon = 0;
void *given;
#ifndef ZDEBUG
(void)tag;
#endif
for (block = head.next; block != &head; block = block->next)
{
blocknumon++;
@@ -498,11 +514,19 @@ void Z_CheckHeap(INT32 i)
#endif
if (block->user != NULL && *(block->user) != given)
{
I_Error("Z_CheckHeap %d: block %u"
I_Error("Z_CheckHeap"
#ifdef ZDEBUG
"at %s %d :"
#endif
"block %u"
#ifdef ZDEBUG
"(owned by %s:%d)"
#endif
" doesn't have a proper user", i, blocknumon
" doesn't have a proper user"
#ifdef ZDEBUG
, file, line
#endif
, blocknumon
#ifdef ZDEBUG
, block->ownerfile, block->ownerline
#endif
@@ -510,11 +534,19 @@ void Z_CheckHeap(INT32 i)
}
if (block->next->prev != block)
{
I_Error("Z_CheckHeap %d: block %u"
I_Error("Z_CheckHeap"
#ifdef ZDEBUG
"at %s %d :"
#endif
"block %u"
#ifdef ZDEBUG
"(owned by %s:%d)"
#endif
" lacks proper backlink", i, blocknumon
" lacks proper backlink"
#ifdef ZDEBUG
, file, line
#endif
, blocknumon
#ifdef ZDEBUG
, block->ownerfile, block->ownerline
#endif
@@ -522,11 +554,19 @@ void Z_CheckHeap(INT32 i)
}
if (block->prev->next != block)
{
I_Error("Z_CheckHeap %d: block %u"
I_Error("Z_CheckHeap"
#ifdef ZDEBUG
"at %s %d :"
#endif
"block %u"
#ifdef ZDEBUG
"(owned by %s:%d)"
#endif
" lacks proper forward link", i, blocknumon
" lacks proper forward link"
#ifdef ZDEBUG
, file, line
#endif
, blocknumon
#ifdef ZDEBUG
, block->ownerfile, block->ownerline
#endif
@@ -534,11 +574,19 @@ void Z_CheckHeap(INT32 i)
}
if (block->id != ZONEID)
{
I_Error("Z_CheckHeap %d: block %u"
I_Error("Z_CheckHeap"
#ifdef ZDEBUG
"at %s %d :"
#endif
"block %u"
#ifdef ZDEBUG
"(owned by %s:%d)"
#endif
" have the wrong ID", i, blocknumon
" have the wrong ID"
#ifdef ZDEBUG
, file, line
#endif
, blocknumon
#ifdef ZDEBUG
, block->ownerfile, block->ownerline
#endif
+23 -16
View File
@@ -32,7 +32,7 @@ extern "C" {
#define FUNCALLOC(x)
#endif
//#define ZDEBUG
#define ZDEBUG
//
// Purge tags
@@ -92,30 +92,31 @@ void Z_Init(void);
// Z_Free and alloc with alignment
#ifdef ZDEBUG
#define Z_Free(p) Z_Free2(p, __FILE__, __LINE__)
#define Z_MallocAlign(s,t,u,a) Z_Malloc2(s, t, u, a, __FILE__, __LINE__)
#define Z_CallocAlign(s,t,u,a) Z_Calloc2(s, t, u, a, __FILE__, __LINE__)
#define Z_ReallocAlign(p,s,t,u,a) Z_Realloc2(p,s, t, u, a, __FILE__, __LINE__)
#define Z_Malloc(s,t,u) Z_Malloc2(s, t, u, __FILE__, __LINE__)
#define Z_Calloc(s,t,u) Z_Calloc2(s, t, u, __FILE__, __LINE__)
#define Z_Realloc(p,s,t,u) Z_Realloc2(p,s, t, u, __FILE__, __LINE__)
void Z_Free2(void *ptr, const char *file, INT32 line);
void *Z_Malloc2(size_t size, INT32 tag, void *user, INT32 alignbits, const char *file, INT32 line) FUNCALLOC(1);
void *Z_Calloc2(size_t size, INT32 tag, void *user, INT32 alignbits, const char *file, INT32 line) FUNCALLOC(1);
void *Z_Realloc2(void *ptr, size_t size, INT32 tag, void *user, INT32 alignbits, const char *file, INT32 line) FUNCALLOC(2);
void *Z_Malloc2(size_t size, INT32 tag, void *user, const char *file, INT32 line) FUNCALLOC(1);
void *Z_Calloc2(size_t size, INT32 tag, void *user, const char *file, INT32 line) FUNCALLOC(1);
void *Z_Realloc2(void *ptr, size_t size, INT32 tag, void *user, const char *file, INT32 line) FUNCALLOC(2);
#else
void Z_Free(void *ptr);
void *Z_MallocAlign(size_t size, INT32 tag, void *user, INT32 alignbits) FUNCALLOC(1);
void *Z_CallocAlign(size_t size, INT32 tag, void *user, INT32 alignbits) FUNCALLOC(1);
void *Z_ReallocAlign(void *ptr, size_t size, INT32 tag, void *user, INT32 alignbits) FUNCALLOC(2);
void *Z_Malloc(size_t size, INT32 tag, void *user) FUNCALLOC(1);
void *Z_Calloc(size_t size, INT32 tag, void *user) FUNCALLOC(1);
void *Z_Realloc(void *ptr, size_t size, INT32 tag, void *user) FUNCALLOC(2);
#endif
// Alloc with standard alignment
#define Z_Malloc(s,t,u) Z_MallocAlign(s, t, u, sizeof(void *))
#define Z_Calloc(s,t,u) Z_CallocAlign(s, t, u, sizeof(void *))
#define Z_Realloc(p,s,t,u) Z_ReallocAlign(p, s, t, u, sizeof(void *))
// Free all memory by tag
// these don't give line numbers for ZDEBUG currently though
// (perhaps this should be changed in future?)
#ifdef ZDEBUG
#define Z_FreeTag(tagnum) Z_FreeTags2(tagnum, tagnum, __FILE__, __LINE__)
#define Z_FreeTags(tagnum, tagnum2) Z_FreeTags2(tagnum, tagnum2, __FILE__, __LINE__)
void Z_FreeTags2(INT32 lowtag, INT32 hightag, const char *file, INT32 line);
#else
#define Z_FreeTag(tagnum) Z_FreeTags(tagnum, tagnum)
void Z_FreeTags(INT32 lowtag, INT32 hightag);
#endif
// Iterate memory by tag
#define Z_IterateTag(tagnum, func) Z_IterateTags(tagnum, tagnum, func)
@@ -125,7 +126,13 @@ void Z_IterateTags(INT32 lowtag, INT32 hightag, boolean (*iterfunc)(void *));
// Utility functions
//
void Z_CheckMemCleanup(void);
void Z_CheckHeap(INT32 i);
#ifdef ZDEBUG
#define Z_CheckHeap(tag) Z_CheckHeap2(__FILE__, __LINE__)
void Z_CheckHeap2(const char *file, INT32 line);
#else
void Z_CheckHeap(INT32 tag);
#endif
//
// Zone memory modification