Compare commits
3 Commits
796107d4cc
...
9b0adc84c5
Author | SHA1 | Date |
---|---|---|
an | 9b0adc84c5 | |
an | dd68032f7d | |
an | a3995e795d |
|
@ -132,7 +132,7 @@ void CFG_ReadCvarOverrides(const char **vars, int32_t num_vars)
|
|||
|
||||
for(i = 0; i < num_vars; i++)
|
||||
{
|
||||
q_strlcpy(&buff[1], vars[i], sizeof(buff) - 1);
|
||||
q_strlcpy(&buff[1], vars[i], strsizeof(buff));
|
||||
j = COM_CheckParm(buff);
|
||||
if(j != 0 && j < com_argc - 1)
|
||||
{
|
||||
|
|
|
@ -165,10 +165,10 @@ void Cbuf_Execute(void)
|
|||
break;
|
||||
}
|
||||
|
||||
if(i > (int32_t)sizeof(line) - 1)
|
||||
if(i > (int32_t)strsizeof(line))
|
||||
{
|
||||
memcpy(line, text, sizeof(line) - 1);
|
||||
line[sizeof(line) - 1] = 0;
|
||||
memcpy(line, text, strsizeof(line));
|
||||
line[strsizeof(line)] = 0;
|
||||
}
|
||||
else
|
||||
{
|
||||
|
|
149
source/common.c
149
source/common.c
|
@ -31,13 +31,11 @@ static char argvdummy[] = " ";
|
|||
|
||||
int32_t safemode;
|
||||
|
||||
cvar_t registered = {"registered", "1", CVAR_ROM}; /* set to correct value in COM_CheckRegistered() */
|
||||
cvar_t registered = {"registered", "1", CVAR_ROM};
|
||||
cvar_t cmdline = {"cmdline", "", CVAR_ROM/*|CVAR_SERVERINFO*/}; /* sending cmdline upon CCREQ_RULE_INFO is evil */
|
||||
|
||||
static bool com_modified; // set true if using non-id files
|
||||
|
||||
bool fitzmode;
|
||||
|
||||
static void COM_Path_f(void);
|
||||
|
||||
// if a packfile directory differs from this, it is assumed to be hacked
|
||||
|
@ -58,27 +56,6 @@ char com_cmdline[CMDLINE_LENGTH];
|
|||
|
||||
bool standard_quake = true, rogue, hipnotic;
|
||||
|
||||
// this graphic needs to be in the pak file to use registered features
|
||||
static uint16_t pop[] =
|
||||
{
|
||||
0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
|
||||
0x0000, 0x0000, 0x6600, 0x0000, 0x0000, 0x0000, 0x6600, 0x0000,
|
||||
0x0000, 0x0066, 0x0000, 0x0000, 0x0000, 0x0000, 0x0067, 0x0000,
|
||||
0x0000, 0x6665, 0x0000, 0x0000, 0x0000, 0x0000, 0x0065, 0x6600,
|
||||
0x0063, 0x6561, 0x0000, 0x0000, 0x0000, 0x0000, 0x0061, 0x6563,
|
||||
0x0064, 0x6561, 0x0000, 0x0000, 0x0000, 0x0000, 0x0061, 0x6564,
|
||||
0x0064, 0x6564, 0x0000, 0x6469, 0x6969, 0x6400, 0x0064, 0x6564,
|
||||
0x0063, 0x6568, 0x6200, 0x0064, 0x6864, 0x0000, 0x6268, 0x6563,
|
||||
0x0000, 0x6567, 0x6963, 0x0064, 0x6764, 0x0063, 0x6967, 0x6500,
|
||||
0x0000, 0x6266, 0x6769, 0x6a68, 0x6768, 0x6a69, 0x6766, 0x6200,
|
||||
0x0000, 0x0062, 0x6566, 0x6666, 0x6666, 0x6666, 0x6562, 0x0000,
|
||||
0x0000, 0x0000, 0x0062, 0x6364, 0x6664, 0x6362, 0x0000, 0x0000,
|
||||
0x0000, 0x0000, 0x0000, 0x0062, 0x6662, 0x0000, 0x0000, 0x0000,
|
||||
0x0000, 0x0000, 0x0000, 0x0061, 0x6661, 0x0000, 0x0000, 0x0000,
|
||||
0x0000, 0x0000, 0x0000, 0x0000, 0x6500, 0x0000, 0x0000, 0x0000,
|
||||
0x0000, 0x0000, 0x0000, 0x0000, 0x6400, 0x0000, 0x0000, 0x0000
|
||||
};
|
||||
|
||||
/*
|
||||
|
||||
All of Quake's data access is through a hierchal file system, but the contents
|
||||
|
@ -102,13 +79,6 @@ especially over ISDN / T1 lines. If there is a cache directory specified, when
|
|||
a file is found by the normal search path, it will be mirrored into the cache
|
||||
directory, then opened there.
|
||||
|
||||
FIXME:
|
||||
The file "parms.txt" will be read out of the game directory and appended to the
|
||||
current command line arguments to allow different games to initialize startup
|
||||
parms differently. This could be used to add a "-sspeed 22050" for the high
|
||||
quality sound edition. Because they are added at the end, they will not
|
||||
override an explicit setting on the original command line.
|
||||
|
||||
*/
|
||||
|
||||
//============================================================================
|
||||
|
@ -872,7 +842,7 @@ const char *MSG_ReadString(void)
|
|||
string[l] = c;
|
||||
l++;
|
||||
}
|
||||
while(l < sizeof(string) - 1);
|
||||
while(l < strsizeof(string));
|
||||
|
||||
string[l] = 0;
|
||||
|
||||
|
@ -1272,58 +1242,6 @@ int32_t COM_CheckParm(const char *parm)
|
|||
return 0;
|
||||
}
|
||||
|
||||
/*
|
||||
================
|
||||
COM_CheckRegistered
|
||||
|
||||
Looks for the pop.txt file and verifies it.
|
||||
Sets the "registered" cvar.
|
||||
Immediately exits out if an alternate game was attempted to be started without
|
||||
being registered.
|
||||
================
|
||||
*/
|
||||
static void COM_CheckRegistered(void)
|
||||
{
|
||||
int32_t h;
|
||||
uint16_t check[128];
|
||||
int32_t i;
|
||||
|
||||
COM_OpenFile("gfx/pop.lmp", &h, NULL);
|
||||
|
||||
if(h == -1)
|
||||
{
|
||||
Cvar_SetROM("registered", "0");
|
||||
Con_Printf("Playing shareware version.\n");
|
||||
if(com_modified)
|
||||
Sys_Error("You must have the registered version to use modified games.\n\n"
|
||||
"Basedir is: %s\n\n"
|
||||
"Check that this has an " GAMENAME " subdirectory containing pak0.pak and pak1.pak, "
|
||||
"or use the -basedir command-line option to specify another directory.",
|
||||
com_basedir);
|
||||
return;
|
||||
}
|
||||
|
||||
Sys_FileRead(h, check, sizeof(check));
|
||||
COM_CloseFile(h);
|
||||
|
||||
for(i = 0; i < 128; i++)
|
||||
{
|
||||
if(pop[i] != (uint16_t)BigShort(check[i]))
|
||||
Sys_Error("Corrupted data file.");
|
||||
}
|
||||
|
||||
for(i = 0; com_cmdline[i]; i++)
|
||||
{
|
||||
if(com_cmdline[i] != ' ')
|
||||
break;
|
||||
}
|
||||
|
||||
Cvar_SetROM("cmdline", &com_cmdline[i]);
|
||||
Cvar_SetROM("registered", "1");
|
||||
Con_Printf("Playing registered version.\n");
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
================
|
||||
COM_InitArgv
|
||||
|
@ -1379,17 +1297,6 @@ void COM_InitArgv(int32_t argc, char **argv)
|
|||
}
|
||||
}
|
||||
|
||||
/*
|
||||
================
|
||||
Test_f -- johnfitz
|
||||
================
|
||||
*/
|
||||
#ifdef _DEBUG
|
||||
static void FitzTest_f(void)
|
||||
{
|
||||
}
|
||||
#endif
|
||||
|
||||
/*
|
||||
================
|
||||
COM_Init
|
||||
|
@ -1435,12 +1342,6 @@ void COM_Init(void)
|
|||
BigFloat = FloatSwap;
|
||||
LittleFloat = FloatNoSwap;
|
||||
}
|
||||
|
||||
if(COM_CheckParm("-fitz"))
|
||||
fitzmode = true;
|
||||
#ifdef _DEBUG
|
||||
Cmd_AddCommand("fitztest", FitzTest_f); //johnfitz
|
||||
#endif
|
||||
}
|
||||
|
||||
|
||||
|
@ -1448,14 +1349,12 @@ void COM_Init(void)
|
|||
============
|
||||
va
|
||||
|
||||
does a varargs printf into a temp buffer. cycles between
|
||||
4 different static buffers. the number of buffers cycled
|
||||
is defined in VA_NUM_BUFFS.
|
||||
FIXME: make this buffer size safe someday
|
||||
does a varargs printf into a temp buffer. cycles between a number of static
|
||||
buffers.
|
||||
============
|
||||
*/
|
||||
#define VA_NUM_BUFFS 4
|
||||
#define VA_BUFFERLEN 1024
|
||||
#define VA_NUM_BUFFS 8
|
||||
#define VA_BUFFERLEN 4096
|
||||
|
||||
static char *get_va_buffer(void)
|
||||
{
|
||||
|
@ -1663,13 +1562,6 @@ static int32_t COM_FindFile(const char *filename, int32_t *handle, FILE **file,
|
|||
}
|
||||
else /* check a file in the directory tree */
|
||||
{
|
||||
if(!registered.value)
|
||||
{
|
||||
/* if not a registered version, don't ever go beyond base */
|
||||
if(strchr(filename, '/') || strchr(filename, '\\'))
|
||||
continue;
|
||||
}
|
||||
|
||||
q_snprintf(netpath, sizeof(netpath), "%s/%s", search->filename, filename);
|
||||
findtime = Sys_FileTime(netpath);
|
||||
if(findtime == -1)
|
||||
|
@ -2033,7 +1925,7 @@ static void COM_AddGameDirectory(const char *base, const char *dir)
|
|||
int32_t i;
|
||||
uint32_t path_id;
|
||||
searchpath_t *search;
|
||||
pack_t *pak, *qspak;
|
||||
pack_t *pak;
|
||||
char pakfile[MAX_OSPATH];
|
||||
bool been_here = false;
|
||||
|
||||
|
@ -2057,16 +1949,6 @@ _add_path:
|
|||
{
|
||||
q_snprintf(pakfile, sizeof(pakfile), "%s/pak%" PRIi32 ".pak", com_gamedir, i);
|
||||
pak = COM_LoadPackFile(pakfile);
|
||||
if(i != 0 || path_id != 1 || fitzmode)
|
||||
qspak = NULL;
|
||||
else
|
||||
{
|
||||
bool old = com_modified;
|
||||
if(been_here) base = host_parms->userdir;
|
||||
q_snprintf(pakfile, sizeof(pakfile), "%s/quakespasm.pak", base);
|
||||
qspak = COM_LoadPackFile(pakfile);
|
||||
com_modified = old;
|
||||
}
|
||||
if(pak)
|
||||
{
|
||||
search = (searchpath_t *) Z_Malloc(sizeof(searchpath_t));
|
||||
|
@ -2075,14 +1957,6 @@ _add_path:
|
|||
search->next = com_searchpaths;
|
||||
com_searchpaths = search;
|
||||
}
|
||||
if(qspak)
|
||||
{
|
||||
search = (searchpath_t *) Z_Malloc(sizeof(searchpath_t));
|
||||
search->path_id = path_id;
|
||||
search->pack = qspak;
|
||||
search->next = com_searchpaths;
|
||||
com_searchpaths = search;
|
||||
}
|
||||
if(!pak) break;
|
||||
}
|
||||
|
||||
|
@ -2107,12 +1981,6 @@ static void COM_Game_f(void)
|
|||
const char *p2 = Cmd_Argv(2);
|
||||
searchpath_t *search;
|
||||
|
||||
if(!registered.value) //disable shareware quake
|
||||
{
|
||||
Con_Printf("You must have the registered version to use modified games\n");
|
||||
return;
|
||||
}
|
||||
|
||||
if(!*p || !strcmp(p, ".") || strstr(p, "..") || strstr(p, "/") || strstr(p, "\\") || strstr(p, ":"))
|
||||
{
|
||||
Con_Printf("gamedir should be a single directory name, not a path\n");
|
||||
|
@ -2251,7 +2119,6 @@ void COM_InitFilesystem(void) //johnfitz -- modified based on topaz's tutorial
|
|||
{
|
||||
int32_t i, j;
|
||||
|
||||
Cvar_RegisterVariable(®istered);
|
||||
Cvar_RegisterVariable(&cmdline);
|
||||
Cmd_AddCommand("path", COM_Path_f);
|
||||
Cmd_AddCommand("game", COM_Game_f); //johnfitz
|
||||
|
@ -2312,8 +2179,6 @@ void COM_InitFilesystem(void) //johnfitz -- modified based on topaz's tutorial
|
|||
}
|
||||
}
|
||||
}
|
||||
|
||||
COM_CheckRegistered();
|
||||
}
|
||||
|
||||
|
||||
|
|
|
@ -76,11 +76,6 @@ void RemoveLink(link_t *l);
|
|||
void InsertLinkBefore(link_t *l, link_t *before);
|
||||
void InsertLinkAfter(link_t *l, link_t *after);
|
||||
|
||||
// (type *)STRUCT_FROM_LINK(link_t *link, type, member)
|
||||
// ent = STRUCT_FROM_LINK(link,entity_t,order)
|
||||
// FIXME: remove this mess!
|
||||
#define STRUCT_FROM_LINK(l,t,m) ((t *)((byte *)l - (intptr_t)&(((t *)0)->m)))
|
||||
|
||||
//============================================================================
|
||||
|
||||
extern bool host_bigendian;
|
||||
|
@ -299,10 +294,10 @@ char *FS_fgets(char *s, int32_t size, fshandle_t *fh);
|
|||
long FS_filelength(fshandle_t *fh);
|
||||
|
||||
|
||||
extern struct cvar_s registered;
|
||||
extern bool standard_quake, rogue, hipnotic;
|
||||
extern bool fitzmode;
|
||||
/* if true, run in fitzquake mode disabling custom quakespasm hacks */
|
||||
|
||||
struct cvar_s;
|
||||
|
||||
#endif /* _Q_COMMON_H */
|
||||
|
||||
|
|
|
@ -824,7 +824,7 @@ static const arg_completion_type_t arg_completion_types[] =
|
|||
};
|
||||
|
||||
static const int32_t num_arg_completion_types =
|
||||
sizeof(arg_completion_types) / sizeof(arg_completion_types[0]);
|
||||
arraysizeof(arg_completion_types);
|
||||
|
||||
/*
|
||||
============
|
||||
|
@ -849,8 +849,8 @@ const char *FindCompletion(const char *partial, filelist_item_t *filelist, int32
|
|||
if(init == 0)
|
||||
{
|
||||
init = 1;
|
||||
strncpy(matched, file->name, sizeof(matched) - 1);
|
||||
matched[sizeof(matched) - 1] = '\0';
|
||||
strncpy(matched, file->name, strsizeof(matched));
|
||||
matched[strsizeof(matched)] = '\0';
|
||||
}
|
||||
else
|
||||
{
|
||||
|
|
|
@ -60,7 +60,6 @@
|
|||
#ifdef __cplusplus
|
||||
static inline char *FIND_FIRST_DIRSEP(char *_the_path)
|
||||
{
|
||||
/* FIXME: What about C:FOO ? */
|
||||
char *p1 = strchr(_the_path, '/');
|
||||
char *p2 = strchr(_the_path, '\\');
|
||||
if(p1 == NULL) return p2;
|
||||
|
@ -69,7 +68,6 @@ static inline char *FIND_FIRST_DIRSEP(char *_the_path)
|
|||
}
|
||||
static inline char *FIND_LAST_DIRSEP(char *_the_path)
|
||||
{
|
||||
/* FIXME: What about C:FOO ? */
|
||||
char *p1 = strrchr(_the_path, '/');
|
||||
char *p2 = strrchr(_the_path, '\\');
|
||||
if(p1 == NULL) return p2;
|
||||
|
@ -78,7 +76,6 @@ static inline char *FIND_LAST_DIRSEP(char *_the_path)
|
|||
}
|
||||
static inline const char *FIND_FIRST_DIRSEP(const char *_the_path)
|
||||
{
|
||||
/* FIXME: What about C:FOO ? */
|
||||
const char *p1 = strchr(_the_path, '/');
|
||||
const char *p2 = strchr(_the_path, '\\');
|
||||
if(p1 == NULL) return p2;
|
||||
|
@ -87,7 +84,6 @@ static inline const char *FIND_FIRST_DIRSEP(const char *_the_path)
|
|||
}
|
||||
static inline const char *FIND_LAST_DIRSEP(const char *_the_path)
|
||||
{
|
||||
/* FIXME: What about C:FOO ? */
|
||||
const char *p1 = strrchr(_the_path, '/');
|
||||
const char *p2 = strrchr(_the_path, '\\');
|
||||
if(p1 == NULL) return p2;
|
||||
|
@ -97,7 +93,6 @@ static inline const char *FIND_LAST_DIRSEP(const char *_the_path)
|
|||
#else
|
||||
static inline char *FIND_FIRST_DIRSEP(const char *_the_path)
|
||||
{
|
||||
/* FIXME: What about C:FOO ? */
|
||||
char *p1 = strchr(_the_path, '/');
|
||||
char *p2 = strchr(_the_path, '\\');
|
||||
if(p1 == NULL) return p2;
|
||||
|
@ -106,7 +101,6 @@ static inline char *FIND_FIRST_DIRSEP(const char *_the_path)
|
|||
}
|
||||
static inline char *FIND_LAST_DIRSEP(const char *_the_path)
|
||||
{
|
||||
/* FIXME: What about C:FOO ? */
|
||||
char *p1 = strrchr(_the_path, '/');
|
||||
char *p2 = strrchr(_the_path, '\\');
|
||||
if(p1 == NULL) return p2;
|
||||
|
|
|
@ -2023,7 +2023,7 @@ void Mod_LoadBrushModel(qmodel_t *mod, void *buffer)
|
|||
// swap all the lumps
|
||||
mod_base = (byte *)header;
|
||||
|
||||
for(i = 0; i < (int32_t) sizeof(dheader_t) / 4; i++)
|
||||
for(i = 0; i < (int32_t)sizeof(dheader_t) / 4; i++)
|
||||
((int32_t *)header)[i] = LittleLong(((int32_t *)header)[i]);
|
||||
|
||||
// load into heap
|
||||
|
|
|
@ -569,7 +569,7 @@ GLuint GL_CreateProgram(const GLchar *vertSource, const GLchar *fragSource, int3
|
|||
}
|
||||
else
|
||||
{
|
||||
if(gl_num_programs == (sizeof(gl_programs) / sizeof(GLuint)))
|
||||
if(gl_num_programs == arraysizeof(gl_programs))
|
||||
Host_Error("gl_programs overflow");
|
||||
|
||||
gl_programs[gl_num_programs] = program;
|
||||
|
|
|
@ -145,7 +145,7 @@ for a few moments
|
|||
*/
|
||||
void SCR_CenterPrint(const char *str) //update centerprint data
|
||||
{
|
||||
strncpy(scr_centerstring, str, sizeof(scr_centerstring) - 1);
|
||||
strncpy(scr_centerstring, str, strsizeof(scr_centerstring));
|
||||
scr_centertime_off = scr_centertime.value;
|
||||
scr_centertime_start = cl.time;
|
||||
|
||||
|
|
|
@ -77,8 +77,6 @@ cvar_t pausable = {"pausable", "1", CVAR_NONE};
|
|||
|
||||
cvar_t developer = {"developer", "0", CVAR_NONE};
|
||||
|
||||
cvar_t temp1 = {"temp1", "0", CVAR_NONE};
|
||||
|
||||
cvar_t devstats = {"devstats", "0", CVAR_NONE}; //johnfitz -- track developer statistics that vary every frame
|
||||
|
||||
devstats_t dev_stats, dev_peakstats;
|
||||
|
@ -282,8 +280,6 @@ void Host_InitLocal(void)
|
|||
|
||||
Cvar_RegisterVariable(&pausable);
|
||||
|
||||
Cvar_RegisterVariable(&temp1);
|
||||
|
||||
Host_FindMaxClients();
|
||||
}
|
||||
|
||||
|
|
|
@ -1362,11 +1362,11 @@ void Host_Say(bool teamonly)
|
|||
q_snprintf(text, sizeof(text), "\001<%s> %s", hostname.string, p);
|
||||
|
||||
// check length & truncate if necessary
|
||||
j = (int32_t) strlen(text);
|
||||
if(j >= (int32_t) sizeof(text) - 1)
|
||||
j = strlen(text);
|
||||
if(j >= (int32_t)strsizeof(text))
|
||||
{
|
||||
text[sizeof(text) - 2] = '\n';
|
||||
text[sizeof(text) - 1] = '\0';
|
||||
text[strsizeof(text) - 1] = '\n';
|
||||
text[strsizeof(text)] = '\0';
|
||||
}
|
||||
else
|
||||
{
|
||||
|
@ -1440,11 +1440,11 @@ void Host_Tell_f(void)
|
|||
q_snprintf(text, sizeof(text), "%s: %s", host_client->name, p);
|
||||
|
||||
// check length & truncate if necessary
|
||||
j = (int32_t) strlen(text);
|
||||
if(j >= (int32_t) sizeof(text) - 1)
|
||||
j = strlen(text);
|
||||
if(j >= (int32_t)strsizeof(text))
|
||||
{
|
||||
text[sizeof(text) - 2] = '\n';
|
||||
text[sizeof(text) - 1] = '\0';
|
||||
text[strsizeof(text) - 1] = '\n';
|
||||
text[strsizeof(text)] = '\0';
|
||||
}
|
||||
else
|
||||
{
|
||||
|
@ -2242,14 +2242,6 @@ void Host_Startdemos_f(void)
|
|||
if(!sv.active && cls.demonum != -1 && !cls.demoplayback)
|
||||
{
|
||||
cls.demonum = 0;
|
||||
if(!fitzmode)
|
||||
{
|
||||
/* QuakeSpasm customization: */
|
||||
/* go straight to menu, no CL_NextDemo */
|
||||
cls.demonum = -1;
|
||||
Cbuf_InsertText("menu_main\n");
|
||||
return;
|
||||
}
|
||||
CL_NextDemo();
|
||||
}
|
||||
else
|
||||
|
|
|
@ -999,7 +999,7 @@ void IN_SendKeyEvents(void)
|
|||
case SDL_MOUSEBUTTONDOWN:
|
||||
case SDL_MOUSEBUTTONUP:
|
||||
if(event.button.button < 1 ||
|
||||
event.button.button > sizeof(buttonremap) / sizeof(buttonremap[0]))
|
||||
event.button.button > arraysizeof(buttonremap))
|
||||
{
|
||||
Con_Printf("Ignored event for mouse button %" PRIi32 "\n",
|
||||
event.button.button);
|
||||
|
|
|
@ -530,7 +530,7 @@ void Key_Message(int32_t key)
|
|||
|
||||
void Char_Message(int32_t key)
|
||||
{
|
||||
if(chat_bufferlen == sizeof(chat_buffer) - 1)
|
||||
if(chat_bufferlen == strsizeof(chat_buffer))
|
||||
return; // all full
|
||||
|
||||
chat_buffer[chat_bufferlen++] = key;
|
||||
|
|
|
@ -281,8 +281,6 @@ void M_Main_Key(int32_t key)
|
|||
key_dest = key_game;
|
||||
m_state = m_none;
|
||||
cls.demonum = m_save_demonum;
|
||||
if(!fitzmode) /* QuakeSpasm customization: */
|
||||
break;
|
||||
if(cls.demonum != -1 && !cls.demoplayback && cls.state != ca_connected)
|
||||
CL_NextDemo();
|
||||
break;
|
||||
|
@ -440,7 +438,7 @@ void M_ScanSaves(void)
|
|||
continue;
|
||||
fscanf(f, "%" PRIi32 "\n", &version);
|
||||
fscanf(f, "%79s\n", name);
|
||||
strncpy(m_filenames[i], name, sizeof(m_filenames[i]) - 1);
|
||||
strncpy(m_filenames[i], name, strsizeof(m_filenames[i]));
|
||||
|
||||
// change _ back to space
|
||||
for(j = 0; j < SAVEGAME_COMMENT_LENGTH; j++)
|
||||
|
@ -1684,10 +1682,11 @@ bool M_Quit_TextEntry(void)
|
|||
|
||||
void M_Quit_Draw(void) //johnfitz -- modified for new quit message
|
||||
{
|
||||
char msg1[40];
|
||||
char msg2[] = "by Ozkan, Ericw & Stevenaaus"; /* msg2/msg3 are mostly [40] */
|
||||
char msg3[] = "Press y to quit";
|
||||
int32_t boxlen;
|
||||
static char const msg1[] = "QuakeSpasm " QUAKESPASM_VERSION;
|
||||
static char const msg2[] = "by Ozkan, Ericw & Stevenaaus";
|
||||
static char const msg3[] = "Press y to quit";
|
||||
|
||||
int32_t boxlen;
|
||||
|
||||
if(wasInMenus)
|
||||
{
|
||||
|
@ -1697,19 +1696,13 @@ void M_Quit_Draw(void) //johnfitz -- modified for new quit message
|
|||
m_state = m_quit;
|
||||
}
|
||||
|
||||
sprintf(msg1, "QuakeSpasm " QUAKESPASM_VERSION);
|
||||
|
||||
//okay, this is kind of fucked up. M_DrawTextBox will always act as if
|
||||
//width is even. Also, the width and lines values are for the interior of the box,
|
||||
//but the x and y values include the border.
|
||||
boxlen = q_max(strlen(msg1), q_max((sizeof(msg2) - 1), (sizeof(msg3) - 1))) + 1;
|
||||
boxlen = q_max(strsizeof(msg1), q_max(strsizeof(msg2), strsizeof(msg3))) + 1;
|
||||
if(boxlen & 1) boxlen++;
|
||||
M_DrawTextBox(160 - 4 * (boxlen + 2), 76, boxlen, 4);
|
||||
|
||||
//now do the text
|
||||
M_Print(160 - 4 * strlen(msg1), 88, msg1);
|
||||
M_Print(160 - 4 * (sizeof(msg2) - 1), 96, msg2);
|
||||
M_PrintWhite(160 - 4 * (sizeof(msg3) - 1), 104, msg3);
|
||||
M_Print(160 - 4 * strsizeof(msg1), 88, msg1);
|
||||
M_Print(160 - 4 * strsizeof(msg2), 96, msg2);
|
||||
M_PrintWhite(160 - 4 * strsizeof(msg3), 104, msg3);
|
||||
}
|
||||
|
||||
//=============================================================================
|
||||
|
@ -2305,10 +2298,8 @@ void M_NetStart_Change(int32_t dir)
|
|||
//PGM 03/02/97 added 1 for dmatch episode
|
||||
else if(rogue)
|
||||
count = 4;
|
||||
else if(registered.value)
|
||||
count = 7;
|
||||
else
|
||||
count = 2;
|
||||
count = 7;
|
||||
|
||||
if(startepisode < 0)
|
||||
startepisode = count - 1;
|
||||
|
@ -2648,13 +2639,6 @@ void M_Draw(void)
|
|||
break;
|
||||
|
||||
case m_quit:
|
||||
if(!fitzmode)
|
||||
{
|
||||
/* QuakeSpasm customization: */
|
||||
/* Quit now! S.A. */
|
||||
key_dest = key_console;
|
||||
Host_Quit_f();
|
||||
}
|
||||
M_Quit_Draw();
|
||||
break;
|
||||
|
||||
|
|
|
@ -68,7 +68,7 @@ static char *PF_VarString(int32_t first)
|
|||
{
|
||||
if(!dev_overflows.varstring || dev_overflows.varstring + CONSOLE_RESPAM_TIME < realtime)
|
||||
{
|
||||
Con_DWarning("PF_VarString: %" PRIi32 " characters exceeds standard limit of 255 (max = %" PRIi32 ").\n", (int32_t) s, (int32_t)(sizeof(out) - 1));
|
||||
Con_DWarning("PF_VarString: %" PRIi32 " characters exceeds standard limit of 255 (max = %" PRIi32 ").\n", (int32_t)s, (int32_t)strsizeof(out));
|
||||
dev_overflows.varstring = realtime;
|
||||
}
|
||||
}
|
||||
|
@ -1766,5 +1766,5 @@ static builtin_t pr_builtin[] =
|
|||
};
|
||||
|
||||
builtin_t *pr_builtins = pr_builtin;
|
||||
int32_t pr_numbuiltins = sizeof(pr_builtin) / sizeof(pr_builtin[0]);
|
||||
int32_t pr_numbuiltins = arraysizeof(pr_builtin);
|
||||
|
||||
|
|
|
@ -43,7 +43,7 @@ int32_t pr_edict_size; // in bytes
|
|||
|
||||
uint16_t pr_crc;
|
||||
|
||||
int32_t type_size[8] =
|
||||
int32_t type_size[8] =
|
||||
{
|
||||
1, // ev_void
|
||||
1, // sizeof(string_t) / 4 // ev_string
|
||||
|
|
|
@ -144,7 +144,7 @@ static void PR_PrintStatement(dstatement_t *s)
|
|||
{
|
||||
int32_t i;
|
||||
|
||||
if((uint32_t)s->op < sizeof(pr_opnames) / sizeof(pr_opnames[0]))
|
||||
if((uint32_t)s->op < arraysizeof(pr_opnames))
|
||||
{
|
||||
Con_Printf("%s ", pr_opnames[s->op]);
|
||||
i = strlen(pr_opnames[s->op]);
|
||||
|
|
|
@ -55,7 +55,7 @@ typedef struct edict_s
|
|||
/* other fields from progs come immediately after */
|
||||
} edict_t;
|
||||
|
||||
#define EDICT_FROM_AREA(l) STRUCT_FROM_LINK(l,edict_t,area)
|
||||
#define EDICT_FROM_AREA(l) (edict_t *)((byte *)l - offsetof(edict_t, area))
|
||||
|
||||
//============================================================================
|
||||
|
||||
|
|
|
@ -29,27 +29,21 @@
|
|||
#ifndef __QSTDINC_H
|
||||
#define __QSTDINC_H
|
||||
|
||||
#include <sys/types.h>
|
||||
#include <stddef.h>
|
||||
#include <stdbool.h>
|
||||
#include <stdnoreturn.h>
|
||||
#include <limits.h>
|
||||
#include <stdarg.h>
|
||||
#include <stdbool.h>
|
||||
#include <stddef.h>
|
||||
#include <stdint.h>
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
#include <stdnoreturn.h>
|
||||
#include <string.h>
|
||||
#include <sys/types.h>
|
||||
|
||||
#ifndef _WIN32
|
||||
#include <sys/param.h>
|
||||
#endif
|
||||
|
||||
#include <stdio.h>
|
||||
|
||||
#if defined(_MSC_VER) && (_MSC_VER < 1600)
|
||||
#include "msinttypes/stdint.h"
|
||||
#else
|
||||
#include <stdint.h>
|
||||
#endif
|
||||
|
||||
#include <stdlib.h>
|
||||
#include <stdarg.h>
|
||||
#include <string.h>
|
||||
|
||||
_Static_assert(sizeof(float) == 4, "float not correct size");
|
||||
_Static_assert(sizeof(int32_t) == 4, "int32_t not correct size");
|
||||
|
||||
|
@ -102,4 +96,7 @@ typedef vec_t vec5_t[5];
|
|||
#define FUNCP_PRINTF(x,y)
|
||||
#endif
|
||||
|
||||
#define arraysizeof(a) (sizeof(a) / sizeof(*a))
|
||||
#define strsizeof(a) (sizeof(a) - 1)
|
||||
|
||||
#endif /* __QSTDINC_H */
|
||||
|
|
|
@ -197,7 +197,7 @@ void GLAlias_CreateShaders(void)
|
|||
if(!gl_glsl_alias_able)
|
||||
return;
|
||||
|
||||
r_alias_program = GL_CreateProgram(vertSource, fragSource, sizeof(bindings) / sizeof(bindings[0]), bindings);
|
||||
r_alias_program = GL_CreateProgram(vertSource, fragSource, arraysizeof(bindings), bindings);
|
||||
|
||||
if(r_alias_program != 0)
|
||||
{
|
||||
|
|
|
@ -877,7 +877,7 @@ void GLWorld_CreateShaders(void)
|
|||
if(!gl_glsl_alias_able)
|
||||
return;
|
||||
|
||||
r_world_program = GL_CreateProgram(vertSource, fragSource, sizeof(bindings) / sizeof(bindings[0]), bindings);
|
||||
r_world_program = GL_CreateProgram(vertSource, fragSource, arraysizeof(bindings), bindings);
|
||||
|
||||
if(r_world_program != 0)
|
||||
{
|
||||
|
|
|
@ -506,20 +506,6 @@ void Sbar_SoloScoreboard(void)
|
|||
sprintf(str, "Secrets: %" PRIi32 "/%" PRIi32 "", cl.stats[STAT_SECRETS], cl.stats[STAT_TOTALSECRETS]);
|
||||
Sbar_DrawString(312 - strlen(str) * 8, 12, str);
|
||||
|
||||
if(!fitzmode)
|
||||
{
|
||||
/* QuakeSpasm customization: */
|
||||
q_snprintf(str, sizeof(str), "skill %" PRIi32 "", (int32_t)(skill.value + 0.5));
|
||||
Sbar_DrawString(160 - strlen(str) * 4, 12, str);
|
||||
|
||||
q_snprintf(str, sizeof(str), "%s (%s)", cl.levelname, cl.mapname);
|
||||
len = strlen(str);
|
||||
if(len > 40)
|
||||
Sbar_DrawScrollString(0, 4, 320, str);
|
||||
else
|
||||
Sbar_DrawString(160 - len * 4, 4, str);
|
||||
return;
|
||||
}
|
||||
minutes = cl.time / 60;
|
||||
seconds = cl.time - 60 * minutes;
|
||||
tens = seconds / 10;
|
||||
|
|
|
@ -65,7 +65,7 @@ net_driver_t net_drivers[] =
|
|||
}
|
||||
};
|
||||
|
||||
const int32_t net_numdrivers = (sizeof(net_drivers) / sizeof(net_drivers[0]));
|
||||
const int32_t net_numdrivers = arraysizeof(net_drivers);
|
||||
|
||||
#include "net_udp.h"
|
||||
|
||||
|
@ -96,5 +96,5 @@ net_landriver_t net_landrivers[] =
|
|||
}
|
||||
};
|
||||
|
||||
const int32_t net_numlandrivers = (sizeof(net_landrivers) / sizeof(net_landrivers[0]));
|
||||
const int32_t net_numlandrivers = arraysizeof(net_landrivers);
|
||||
|
||||
|
|
|
@ -65,7 +65,7 @@ net_driver_t net_drivers[] =
|
|||
}
|
||||
};
|
||||
|
||||
const int32_t net_numdrivers = (sizeof(net_drivers) / sizeof(net_drivers[0]));
|
||||
const int32_t net_numdrivers = arraysizeof(net_drivers);
|
||||
|
||||
|
||||
#include "net_wins.h"
|
||||
|
@ -122,5 +122,5 @@ net_landriver_t net_landrivers[] =
|
|||
}
|
||||
};
|
||||
|
||||
const int32_t net_numlandrivers = (sizeof(net_landrivers) / sizeof(net_landrivers[0]));
|
||||
const int32_t net_numlandrivers = arraysizeof(net_landrivers);
|
||||
|
||||
|
|
Loading…
Reference in New Issue