Misc small fixups/cleanups.

This commit is contained in:
Shpoike 2024-11-07 12:17:46 +00:00
parent d26b741e4b
commit 28a880c56e
19 changed files with 116 additions and 53 deletions

View file

@ -4219,7 +4219,7 @@ static void CLNQ_ParseServerData(void) //Doesn't change gamedir - use with caut
CL_CheckServerInfo();
#if _MSC_VER > 1200
Sys_RecentServer("+nqconnect", cls.servername, cls.servername, "Join NQ Server");
Sys_RecentServer("+connectnq", cls.servername, cls.servername, "Join NQ Server");
#endif
if (CPNQ_IS_DP) //DP's protocol requires client+server to have exactly the same data files. this is shit, but in the interests of compatibility...

View file

@ -31,8 +31,8 @@ void IN_ActivateMouse(void)
SDL_ShowCursor(0);
#if SDL_MAJOR_VERSION >= 2
SDL_SetRelativeMouseMode(true);
SDL_SetWindowGrab(sdlwindow, true);
SDL_SetRelativeMouseMode(SDL_TRUE);
SDL_SetWindowGrab(sdlwindow, SDL_TRUE);
#else
SDL_WM_GrabInput(SDL_GRAB_ON);
#endif
@ -46,8 +46,8 @@ void IN_DeactivateMouse(void)
mouseactive = false;
SDL_ShowCursor(1);
#if SDL_MAJOR_VERSION >= 2
SDL_SetRelativeMouseMode(false);
SDL_SetWindowGrab(sdlwindow, false);
SDL_SetRelativeMouseMode(SDL_FALSE);
SDL_SetWindowGrab(sdlwindow, SDL_FALSE);
#else
SDL_WM_GrabInput(SDL_GRAB_OFF);
#endif

View file

@ -3524,7 +3524,7 @@ void Media_RecordFrame (void)
Draw_FunString(0, y, capturemessage.string);
}
//time for annother frame?
//time for another frame?
if (!captureframeforce)
{
if (capturelastvideotime > realtime+1)

View file

@ -138,6 +138,7 @@ void Menu_Prompt (void (*callback)(void *, promptbutton_t), void *ctx, const cha
#define Menu_PromptOrPrint(messages,optioncancel,highpri) Con_Printf("%s", messages)
#endif
void M_Window_ClosePrompt (void); //called when the window was requested to be closed. displays whatever quit menu is appropriate.
#ifndef NOBUILTINMENUS
//
@ -150,8 +151,6 @@ void M_Menu_Mods_f (void); //used at startup if the current gamedirs look dodgy.
void M_Menu_Installer (void); //given an embedded manifest, this displays an install menu for said game.
mpic_t *M_CachePic (char *path);
void M_Menu_Quit_f (void);
void M_Window_ClosePrompt (void); //called when the window was requested to be closed. displays whatever quit menu is appropriate.
void menufixme(void); //REMOVE REMOVE REMOVE
typedef struct emenu_s emenu_t;

View file

@ -2072,9 +2072,12 @@ void R_DrawNameTags(void)
else
{
shader = NULL;
#ifdef TERRAIN
if (cl.worldmodel->terrain && trace.brush_id && (shader = Terr_GetShader(cl.worldmodel, &trace)))
shadername = shader->name;
else if ((surf = (trace.fraction == 1)?NULL:Mod_GetSurfaceNearPoint(cl.worldmodel, trace.endpos)))
else
#endif
if ((surf = (trace.fraction == 1)?NULL:Mod_GetSurfaceNearPoint(cl.worldmodel, trace.endpos)))
{
shadername = surf->texinfo->texture->name;
shader = surf->texinfo->texture->shader;

View file

@ -3885,7 +3885,11 @@ void CL_Say (qboolean team, char *extra)
//messagemode always adds quotes. the console command never did.
//the server is expected to use Cmd_Args and to strip first+last chars if the first is a quote. this is annoying and clumsy for mods to parse.
#ifdef HAVE_LEGACY
if (!dpcompat_console.ival && !cls.qex)
if (!dpcompat_console.ival
#ifdef NQPROT
&& !cls.qex
#endif
)
CL_SendSeatClientCommand(true, split, "%s \"%s%s\"", team ? "say_team" : "say", extra?extra:"", sendtext);
else
#endif

View file

@ -1465,9 +1465,9 @@ static void Cmd_AliasList_f (void)
if (!num)
Con_TPrintf("Alias list:\n");
if (cmd->execlevel)
Con_Printf("(%2i)(%2i) %s\n", (int)(cmd->restriction?cmd->restriction:rcon_level.ival), cmd->execlevel, cmd->name);
Con_Printf(S_COLOR_TRANS"(%2i)(%2i) "S_COLOR_WHITE"^[%s\\type\\/%s^]\n", (int)(cmd->restriction?cmd->restriction:rcon_level.ival), cmd->execlevel, cmd->name, cmd->name);
else
Con_Printf("(%2i) %s\n", (int)(cmd->restriction?cmd->restriction:rcon_level.ival), cmd->name);
Con_Printf(S_COLOR_TRANS "(%2i) "S_COLOR_WHITE"^[%s\\type\\/%s^]\n", (int)(cmd->restriction?cmd->restriction:rcon_level.ival), cmd->name, cmd->name);
num++;
}
if (num)
@ -3739,7 +3739,7 @@ skipblock:
if (trueblock)
goto skipblock; //we've had our true, all others are assumed to be false.
else
goto elseif; //and have annother go.
goto elseif; //and have another go.
}
else
{ //we got an else. This is the last block. Don't go through the normal way, cos that would let us follow up with a second else.

View file

@ -1811,8 +1811,8 @@ qboolean Alias_GAliasBuildMesh(mesh_t *mesh, vbo_t **vbop, galiasinfo_t *inf, in
#endif
mesh->xyz_array = meshcache.coords;
//we don't support meshes with one pose skeletal and annother not.
//we don't support meshes with one group skeletal and annother not.
//we don't support meshes with one pose skeletal and another not.
//we don't support meshes with one group skeletal and another not.
#ifdef SKELETALMODELS
meshcache.vbop = NULL;

View file

@ -1464,6 +1464,9 @@ static void COM_Path_f (void)
return;
}
if (fs_hidesyspaths.ival)
Con_Printf("External paths are hidden, ^[click to unhide\\type\\set fs_hidesyspaths 0;path^]\n");
if (com_purepaths || fs_puremode)
{
Con_Printf ("Pure paths:\n");
@ -2677,7 +2680,7 @@ static qboolean FS_NativePath(const char *fname, enum fs_relative relativeto, ch
Q_snprintfz(out, outlen, "$bindir/%s", fname+strlen(host_parms.binarydir));
#ifdef FTE_LIBRARY_PATH
else if (!strncmp(fname, STRINGIFY(FTE_LIBRARY_PATH)"/", strlen(STRINGIFY(FTE_LIBRARY_PATH)"/"))) //FS_LIBRARYDIR
Q_snprintfz(out, outlen, "$libdir/%s", fname+strlen(host_parms.binarydir));
Q_snprintfz(out, outlen, "$libdir/%s", fname+strlen(STRINGIFY(FTE_LIBRARY_PATH)"/"));
#endif
else //should try bindir
Q_snprintfz(out, outlen, "$system/%s", COM_SkipPath(fname)); //FS_SYSTEM :(
@ -2685,11 +2688,13 @@ static qboolean FS_NativePath(const char *fname, enum fs_relative relativeto, ch
else
Q_snprintfz(out, outlen, "%s", fname);
#ifdef _WIN32
for (; *out; out++)
{
if (*out == '\\')
*out = '/';
}
#endif
return true;
}

View file

@ -1,6 +1,6 @@
//This file should be easily portable.
//The biggest strength of this plugin system is that ALL interactions are performed via
//named functions, this makes it *really* easy to port plugins from one engine to annother.
//named functions, this makes it *really* easy to port plugins from one engine to another.
#include "quakedef.h"
#include "netinc.h"

View file

@ -1,6 +1,6 @@
//This file should be easily portable.
//The biggest strength of this plugin system is that ALL interactions are performed via
//named functions, this makes it *really* easy to port plugins from one engine to annother.
//named functions, this makes it *really* easy to port plugins from one engine to another.
#include "quakedef.h"
#include "fs.h"

View file

@ -6851,7 +6851,7 @@ void QCBUILTIN PF_Abort(pubprogfuncs_t *prinst, struct globalvars_s *pr_globals)
prinst->AbortStack(prinst);
}
//this func calls a function in annother progs
//this func calls a function in another progs
//it works in the same way as the above func, except that it calls by reference to a function, as opposed to by it's name
//used for entity function variables - not actually needed anymore
void QCBUILTIN PF_externrefcall (pubprogfuncs_t *prinst, struct globalvars_s *pr_globals)
@ -6868,20 +6868,28 @@ void QCBUILTIN PF_externrefcall (pubprogfuncs_t *prinst, struct globalvars_s *pr
PR_ExecuteProgram(prinst, f);
}
void QCBUILTIN PF_externset (pubprogfuncs_t *prinst, struct globalvars_s *pr_globals) //set a value in annother progs
void QCBUILTIN PF_externset (pubprogfuncs_t *prinst, struct globalvars_s *pr_globals) //set a value in another progs
{
int n = G_PROG(OFS_PARM0);
int v = G_INT(OFS_PARM1);
eval_t *v = (eval_t*)&G_INT(OFS_PARM1);
const char *varname = PF_VarString(prinst, 2, pr_globals);
eval_t *var;
etype_t t = ev_void;
var = PR_FindGlobal(prinst, varname, n, NULL);
var = PR_FindGlobal(prinst, varname, n, &t);
if (var)
var->_int = v;
{
if (t == ev_vector)
VectorCopy(v->_vector, var->_vector);
else if (t == ev_int64 || t == ev_uint64 || t == ev_double)
var->i64 = v->i64;
else
var->_int = v->_int;
}
}
void QCBUILTIN PF_externvalue (pubprogfuncs_t *prinst, struct globalvars_s *pr_globals) //return a value in annother progs
void QCBUILTIN PF_externvalue (pubprogfuncs_t *prinst, struct globalvars_s *pr_globals) //return a value in another progs
{
int n = G_PROG(OFS_PARM0);
const char *varname = PF_VarString(prinst, 1, pr_globals);
@ -6914,7 +6922,7 @@ void QCBUILTIN PF_externvalue (pubprogfuncs_t *prinst, struct globalvars_s *pr_g
}
}
void QCBUILTIN PF_externcall (pubprogfuncs_t *prinst, struct globalvars_s *pr_globals) //this func calls a function in annother progs (by name)
void QCBUILTIN PF_externcall (pubprogfuncs_t *prinst, struct globalvars_s *pr_globals) //this func calls a function in another progs (by name)
{
int progsnum;
const char *funcname;
@ -8092,7 +8100,7 @@ qc_extension_t QSG_Extensions[] = {
{"DP_QC_TRACETOSS"},
{"DP_QC_TRACE_MOVETYPE_HITMODEL"},
{"DP_QC_TRACE_MOVETYPE_WORLDONLY"},
{"DP_QC_TRACE_MOVETYPES"}, //this one is just a lame excuse to add annother extension...
{"DP_QC_TRACE_MOVETYPES"}, //this one is just a lame excuse to add another extension...
{"DP_QC_UNLIMITEDTEMPSTRINGS", NULL, 0,{NULL}, "Supersedes DP_QC_MULTIPLETEMPSTRINGS, superseded by FTE_QC_PERSISTENTTEMPSTRINGS. Specifies that all temp strings will be valid at least until the QCVM returns."},
{"DP_QC_URI_ESCAPE", NULL, 2,{"uri_escape", "uri_unescape"}},
#ifdef WEBCLIENT

View file

@ -130,7 +130,7 @@ typedef struct q2trace_s
#define MOVE_WORLDONLY (MOVE_NOMONSTERS|MOVE_MISSILE) //use MOVE_OTHERONLY instead
#endif
#define MOVE_HITMODEL (1<<2)
#define MOVE_RESERVED (1<<3) //so we are less likly to get into tricky situations when we want to steal annother future DP extension.
#define MOVE_RESERVED (1<<3) //so we are less likly to get into tricky situations when we want to steal another future DP extension.
#define MOVE_TRIGGERS (1<<4) //triggers must be marked with FINDABLE_NONSOLID (an alternative to solid-corpse)
#define MOVE_EVERYTHING (1<<5) //can return triggers and non-solid items if they're marked with FINDABLE_NONSOLID (works even if the items are not properly linked)
#define MOVE_LAGGED (1<<6) //trace touches current last-known-state, instead of actual ents (just affects players for now)

View file

@ -35,20 +35,24 @@ typedef struct bspx_header_s bspx_header_t;
typedef enum {
SHADER_SORT_NONE,
SHADER_SORT_RIPPLE,
SHADER_SORT_DEFERREDLIGHT,
SHADER_SORT_RIPPLE, //new
SHADER_SORT_DEFERREDLIGHT, //new
SHADER_SORT_PORTAL,
SHADER_SORT_SKY,
SHADER_SORT_SKY, //aka environment
SHADER_SORT_OPAQUE,
//fixme: occlusion tests
SHADER_SORT_DECAL,
SHADER_SORT_SEETHROUGH,
//then rtlights are drawn
SHADER_SORT_UNLITDECAL,
SHADER_SORT_UNLITDECAL, //new
SHADER_SORT_BANNER,
//fog
SHADER_SORT_UNDERWATER,
SHADER_SORT_BLEND,
SHADER_SORT_ADDITIVE,
//blend2,3,6
//stencilshadow
//almostnearest
SHADER_SORT_NEAREST,

View file

@ -1165,6 +1165,21 @@ static void Shader_SurfaceParm (parsestate_t *ps, const char **ptr)
Con_DLPrintf(2, "Shader %s, Unknown surface parm \"%s\"\n", ps->s->name, token); //note that there are game-specific names used to override mod surfaceflags+contents
}
static void Shader_DP_Sort (parsestate_t *ps, const char **ptr)
{
shader_t *shader = ps->s;
char *token;
token = Shader_ParseString ( ptr );
if (!Q_stricmp(token, "sky"))
shader->sort = SHADER_SORT_SKY;
else if (!Q_stricmp(token, "hud"))
shader->sort = SHADER_SORT_NEAREST;
// else if (!Q_stricmp(token, "distance"))
// shader->sort = SHADER_SORT_NONE; //not really immplemented, could maybe force v_depthsortentities. just let q3 rules take over.
}
static void Shader_Sort (parsestate_t *ps, const char **ptr)
{
shader_t *shader = ps->s;
@ -1176,13 +1191,19 @@ static void Shader_Sort (parsestate_t *ps, const char **ptr)
Con_DPrintf("Shader %s, ignoring 'sort %s'\n", ps->s->name, token);
return; //dp ignores 'sort' entirely.
}
// else if ( !Q_stricmp( token, "none" ) )
// shader->sort = SHADER_SORT_NONE; //default, overwritten with an automatic choice.
else if ( !Q_stricmp( token, "ripple" ) ) //fte, weird. drawn only to the ripplemap.
shader->sort = SHADER_SORT_RIPPLE;
else if ( !Q_stricmp( token, "deferredlight" ) ) //fte, weird. drawn only to prelight buffer.
shader->sort = SHADER_SORT_DEFERREDLIGHT;
else if ( !Q_stricmp( token, "portal" ) )
shader->sort = SHADER_SORT_PORTAL;
else if( !Q_stricmp( token, "sky" ) )
shader->sort = SHADER_SORT_SKY;
else if( !Q_stricmp( token, "opaque" ) )
shader->sort = SHADER_SORT_OPAQUE;
else if( !Q_stricmp( token, "decal" ) || !Q_stricmp( token, "litdecal" ) )
else if( !Q_stricmp( token, "decal" ) || !Q_stricmp( token, "litdecal" ) )
shader->sort = SHADER_SORT_DECAL;
else if( !Q_stricmp( token, "seethrough" ) )
shader->sort = SHADER_SORT_SEETHROUGH;
@ -1190,21 +1211,41 @@ static void Shader_Sort (parsestate_t *ps, const char **ptr)
shader->sort = SHADER_SORT_UNLITDECAL;
else if( !Q_stricmp( token, "banner" ) )
shader->sort = SHADER_SORT_BANNER;
else if( !Q_stricmp( token, "additive" ) )
shader->sort = SHADER_SORT_ADDITIVE;
else if( !Q_stricmp( token, "underwater" ) )
shader->sort = SHADER_SORT_UNDERWATER;
else if( !Q_stricmp( token, "blend" ))
shader->sort = SHADER_SORT_BLEND;
else if( !Q_stricmp( token, "additive" ) )
shader->sort = SHADER_SORT_ADDITIVE;
else if( !Q_stricmp( token, "nearest" ) )
shader->sort = SHADER_SORT_NEAREST;
else if( !Q_stricmp( token, "blend" ) )
shader->sort = SHADER_SORT_BLEND;
else if ( !Q_stricmp( token, "deferredlight" ) )
shader->sort = SHADER_SORT_DEFERREDLIGHT;
else if ( !Q_stricmp( token, "ripple" ) )
shader->sort = SHADER_SORT_RIPPLE;
else
{
shader->sort = atoi ( token );
int q3 = atoi ( token );
shadersort_t q3sorttofte[] =
{
/* 0*/SHADER_SORT_NONE,
/* 1*/SHADER_SORT_PORTAL,
/* 2*/SHADER_SORT_SKY, //aka environment in q3
/* 3*/SHADER_SORT_OPAQUE,
/* 4*/SHADER_SORT_DECAL,
/* 5*/SHADER_SORT_SEETHROUGH,
/* 6*/SHADER_SORT_BANNER,
/* 7*/SHADER_SORT_UNDERWATER/*SHADER_SORT_FOG*/,
/* 8*/SHADER_SORT_UNDERWATER,
/* 9*/SHADER_SORT_BLEND, //blend0 in q3
/*10*/SHADER_SORT_ADDITIVE, //blend1 in q3
/*11*/SHADER_SORT_ADDITIVE/*SHADER_SORT_BLEND2*/,
/*12*/SHADER_SORT_ADDITIVE/*SHADER_SORT_BLEND3*/,
/*13*/SHADER_SORT_ADDITIVE/*SHADER_SORT_BLEND6*/, //yes, 4+5 missing in q3...
/*14*/SHADER_SORT_ADDITIVE/*SHADER_SORT_STENCIL*/,
/*15*/SHADER_SORT_NEAREST/*SHADER_SORT_ALMOSTNEAREST*/,
/*16*/SHADER_SORT_NEAREST
};
if (q3 >= 0 && q3 < countof(q3sorttofte))
shader->sort = q3sorttofte[q3];
else
shader->sort = SHADER_SORT_NONE; // :(
clamp ( shader->sort, SHADER_SORT_NONE, SHADER_SORT_NEAREST );
}
}
@ -2952,6 +2993,7 @@ static shaderkey_t shaderkeys[] =
{"polygonoffset", NULL, "dp"},
{"glossintensitymod", Shader_DP_GlossScale, "dp"}, //scales r_shadow_glossintensity(=1), aka: gl_specular
{"glossexponentmod", Shader_DP_GlossExponent, "dp"}, //scales r_shadow_glossexponent(=32)
{"transparentsort", Shader_DP_Sort, "dp"}, //urgh...
/*doom3 compat*/
{"diffusemap", Shader_DiffuseMap, "doom3"}, //macro for "{\nstage diffusemap\nmap <map>\n}"
@ -3940,7 +3982,7 @@ static void Shaderpass_Scroll (parsestate_t *ps, const char **ptr)
}
else
{
Con_Printf("Bad shader scale\n");
Con_DPrintf("Bad shader scroll value\n");
return;
}
@ -3952,7 +3994,7 @@ static void Shaderpass_Scroll (parsestate_t *ps, const char **ptr)
}
else
{
Con_Printf("Bad shader scale\n");
Con_DPrintf("Bad shader scroll value\n");
return;
}

View file

@ -311,7 +311,7 @@ static void SDLVID_EnumerateVideoModes (const char *driver, const char *output,
static qboolean SDLVID_Init (rendererstate_t *info, unsigned char *palette, r_qrenderer_t qrenderer)
{
int flags = 0;
#if SDL_MAJOR_VERSION >= 2
#if SDL_VERSION_ATLEAST(2,0,0)
int display = -1;
SDL_DisplayMode modeinfo, *usemode;
@ -361,7 +361,6 @@ static qboolean SDLVID_Init (rendererstate_t *info, unsigned char *palette, r_qr
if (info->stereo)
SDL_GL_SetAttribute(SDL_GL_STEREO, 1);
#if SDL_MAJOR_VERSION >= 2
if (info->srgb)
SDL_GL_SetAttribute(SDL_GL_FRAMEBUFFER_SRGB_CAPABLE, 1);
@ -393,7 +392,6 @@ static qboolean SDLVID_Init (rendererstate_t *info, unsigned char *palette, r_qr
SDL_GL_SetAttribute(SDL_GL_CONTEXT_PROFILE_MASK, SDL_GL_CONTEXT_PROFILE_COMPATIBILITY);
else
SDL_GL_SetAttribute(SDL_GL_CONTEXT_PROFILE_MASK, SDL_GL_CONTEXT_PROFILE_CORE);
#endif
if (info->multisample)
{
SDL_GL_SetAttribute(SDL_GL_MULTISAMPLESAMPLES, info->multisample);

View file

@ -1289,7 +1289,7 @@ void NPP_NQWriteByte(int dest, qbyte data) //replacement write func (nq to qw)
case TENQ_NQGUNSHOT:
multicastpos=3;
multicasttype=MULTICAST_PVS;
//we need to emit annother qbyte here. QuakeWorld has a number of particles.
//we need to emit another qbyte here. QuakeWorld has a number of particles.
//emit it here and we don't need to remember to play with temp_entity later
NPP_AddData(&data, sizeof(qbyte));
data = 1;

View file

@ -1321,8 +1321,8 @@ static VkAccelerationStructureKHR VKBE_GenerateBLAS(model_t *mod)
asbgi.type = asci.type;
asbgi.flags = VK_BUILD_ACCELERATION_STRUCTURE_PREFER_FAST_TRACE_BIT_KHR /* | VK_BUILD_ACCELERATION_STRUCTURE_ALLOW_UPDATE_BIT_KHR*/;
asbgi.mode = VK_BUILD_ACCELERATION_STRUCTURE_MODE_BUILD_KHR;
asbgi.srcAccelerationStructure = NULL; //ignored here
asbgi.dstAccelerationStructure = NULL; //filled in later
asbgi.srcAccelerationStructure = VK_NULL_HANDLE; //ignored here
asbgi.dstAccelerationStructure = VK_NULL_HANDLE; //filled in later
asbgi.geometryCount = countof(asg);
asbgi.pGeometries = asg;
asbgi.ppGeometries = NULL; //too much indirection! oh noes!
@ -1443,8 +1443,8 @@ static VkAccelerationStructureKHR VKBE_GenerateTLAS(void)
asbgi.type = asci.type;
asbgi.flags = VK_BUILD_ACCELERATION_STRUCTURE_PREFER_FAST_TRACE_BIT_KHR /* | VK_BUILD_ACCELERATION_STRUCTURE_ALLOW_UPDATE_BIT_KHR*/;
asbgi.mode = VK_BUILD_ACCELERATION_STRUCTURE_MODE_BUILD_KHR;
asbgi.srcAccelerationStructure = NULL; //ignored here
asbgi.dstAccelerationStructure = NULL; //filled in later
asbgi.srcAccelerationStructure = VK_NULL_HANDLE; //ignored here
asbgi.dstAccelerationStructure = VK_NULL_HANDLE; //filled in later
asbgi.geometryCount = countof(asg);
asbgi.pGeometries = asg;
asbgi.ppGeometries = NULL; //too much indirection! oh noes!

View file

@ -2952,7 +2952,7 @@ I've removed the following from this function as it covered the menu (~Moodles):
else if (!strcmp(command, "guidemos"))
{
int maxshowndemos;
char sizestr[11];
char sizestr[13];
int start;
int i;
@ -4614,7 +4614,7 @@ void QW_ProcessUDPPacket(cluster_t *cluster, netmsg_t *m, netadr_t from)
/*int passwd =*/ ReadLong(m);
//fte extension, sent so that dual-protocol servers will not create connections for dual-protocol clients
//the nqconnect command disables this (as well as the qw hand shake) if you really want to use nq protocols with fte clients
//the connectnq command disables this (as well as the qw hand shake) if you really want to use nq protocols with fte clients
ReadString(m, tempbuffer, sizeof(tempbuffer));
if (!strncmp(tempbuffer, "getchallenge", 12))
break;