mirror of
https://github.com/yquake2/yquake2remaster.git
synced 2024-11-10 15:21:44 +00:00
cppcheck fixes.
In src/backends/unix/network.c: * line 181: Assignment of function parameter has no effect outside the function. Did you forget dereferencing it? * line 276: The scope of the variable 'tmp' can be reduced. * line 665: The scope of the variable 'mcast_addr' can be reduced. * line 665: The scope of the variable 'mcast_port' can be reduced. * line 666: The scope of the variable 'error' can be reduced. * line 775: The scope of the variable 'i' can be reduced. In src/backends/windows/network.c: * line 186: Assignment of function parameter has no effect outside the function. Did you forget dereferencing it? * line 287: The scope of the variable 'tmp' can be reduced. * line 707: The scope of the variable 'mcast_addr' can be reduced. * line 707: The scope of the variable 'mcast_port' can be reduced. * line 1049: The scope of the variable 'err' can be reduced. * line 1163: The scope of the variable 'i' can be reduced. In src/client/menu/menu.c arrayIndexOutOfBounds: * line 1921: Array 'creditsIndex[256]' accessed at index 256, which is out of bounds. variableScope: * line 332: The scope of the variable 'item' can be reduced. * line 533: The scope of the variable 'x' can be reduced. * line 533: The scope of the variable 'y' can be reduced. * line 838: The scope of the variable 'b' can be reduced. * line 864: The scope of the variable 'b' can be reduced. * line 1910: The scope of the variable 'n' can be reduced. * line 2199: The scope of the variable 'str' can be reduced. * line 2812: The scope of the variable 'length' can be reduced. * line 2813: The scope of the variable 'i' can be reduced. * line 3838: The scope of the variable 'c' can be reduced. * line 4112: The scope of the variable 'scratch' can be reduced. * line 4181: The scope of the variable 'i' can be reduced. * line 4345: The scope of the variable 's' can be reduced. In src/game/player/hud.c arrayIndexOutOfBounds: * line 132: Array itemlist[43] accessed at index 255 which is out of bounds. Itemlist assigned only once, and has only 43 items, better ignore unexisted items. variableScope: * line 82: The scope of the variable 'n' can be reduced. * line 217: The scope of the variable 'x' can be reduced. * line 217: The scope of the variable 'y' can be reduced. * line 218: The scope of the variable 'cl' can be reduced. * line 583: The scope of the variable 'cl' can be reduced.
This commit is contained in:
parent
2bf45a4750
commit
1b2708c06e
5 changed files with 95 additions and 71 deletions
|
@ -176,10 +176,6 @@ SockadrToNetadr(struct sockaddr_storage *s, netadr_t *a)
|
||||||
a->scope_id = s6->sin6_scope_id;
|
a->scope_id = s6->sin6_scope_id;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else
|
|
||||||
{
|
|
||||||
s = NULL;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
|
@ -273,7 +269,7 @@ NET_CompareBaseAdr(netadr_t a, netadr_t b)
|
||||||
char *
|
char *
|
||||||
NET_BaseAdrToString(netadr_t a)
|
NET_BaseAdrToString(netadr_t a)
|
||||||
{
|
{
|
||||||
static char s[64], tmp[64];
|
static char s[64];
|
||||||
struct sockaddr_storage ss;
|
struct sockaddr_storage ss;
|
||||||
struct sockaddr_in6 *s6;
|
struct sockaddr_in6 *s6;
|
||||||
|
|
||||||
|
@ -332,6 +328,8 @@ NET_BaseAdrToString(netadr_t a)
|
||||||
IN6_IS_ADDR_LINKLOCAL(&((struct sockaddr_in6 *)&ss)->
|
IN6_IS_ADDR_LINKLOCAL(&((struct sockaddr_in6 *)&ss)->
|
||||||
sin6_addr))
|
sin6_addr))
|
||||||
{
|
{
|
||||||
|
char tmp[64];
|
||||||
|
|
||||||
/* If the address is multicast (link) or a
|
/* If the address is multicast (link) or a
|
||||||
link-local, need to carry the scope. The string
|
link-local, need to carry the scope. The string
|
||||||
format of the IPv6 address is used by the
|
format of the IPv6 address is used by the
|
||||||
|
@ -662,11 +660,13 @@ NET_SendPacket(netsrc_t sock, int length, void *data, netadr_t to)
|
||||||
{
|
{
|
||||||
struct addrinfo hints;
|
struct addrinfo hints;
|
||||||
struct addrinfo *res;
|
struct addrinfo *res;
|
||||||
char tmp[128], mcast_addr[128], mcast_port[10];
|
char tmp[128];
|
||||||
int error;
|
|
||||||
|
|
||||||
if (multicast_interface != NULL)
|
if (multicast_interface != NULL)
|
||||||
{
|
{
|
||||||
|
int error;
|
||||||
|
char mcast_addr[128], mcast_port[10];
|
||||||
|
|
||||||
/* Do a getnameinfo/getaddrinfo cycle
|
/* Do a getnameinfo/getaddrinfo cycle
|
||||||
to calculate the scope_id of the
|
to calculate the scope_id of the
|
||||||
multicast address. getaddrinfo is
|
multicast address. getaddrinfo is
|
||||||
|
@ -772,10 +772,10 @@ NET_OpenIP(void)
|
||||||
void
|
void
|
||||||
NET_Config(qboolean multiplayer)
|
NET_Config(qboolean multiplayer)
|
||||||
{
|
{
|
||||||
int i;
|
|
||||||
|
|
||||||
if (!multiplayer)
|
if (!multiplayer)
|
||||||
{
|
{
|
||||||
|
int i;
|
||||||
|
|
||||||
/* shut down any existing sockets */
|
/* shut down any existing sockets */
|
||||||
for (i = 0; i < 2; i++)
|
for (i = 0; i < 2; i++)
|
||||||
{
|
{
|
||||||
|
|
|
@ -144,7 +144,7 @@ NetadrToSockadr(netadr_t *a, struct sockaddr_storage *s)
|
||||||
case NA_LOOPBACK:
|
case NA_LOOPBACK:
|
||||||
case NA_IPX:
|
case NA_IPX:
|
||||||
case NA_BROADCAST_IPX:
|
case NA_BROADCAST_IPX:
|
||||||
/* no handling of NA_LOOPBACK,
|
/* no handling of NA_LOOPBACK,
|
||||||
NA_IPX, NA_BROADCAST_IPX */
|
NA_IPX, NA_BROADCAST_IPX */
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
@ -181,10 +181,6 @@ SockadrToNetadr(struct sockaddr_storage *s, netadr_t *a)
|
||||||
a->scope_id = s6->sin6_scope_id;
|
a->scope_id = s6->sin6_scope_id;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else
|
|
||||||
{
|
|
||||||
s = NULL;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
qboolean
|
qboolean
|
||||||
|
@ -203,7 +199,7 @@ NET_CompareAdr(netadr_t a, netadr_t b)
|
||||||
if (a.type == NA_IP)
|
if (a.type == NA_IP)
|
||||||
{
|
{
|
||||||
if ((a.ip[0] == b.ip[0]) && (a.ip[1] == b.ip[1]) &&
|
if ((a.ip[0] == b.ip[0]) && (a.ip[1] == b.ip[1]) &&
|
||||||
(a.ip[2] == b.ip[2]) && (a.ip[3] == b.ip[3]) &&
|
(a.ip[2] == b.ip[2]) && (a.ip[3] == b.ip[3]) &&
|
||||||
(a.port == b.port))
|
(a.port == b.port))
|
||||||
{
|
{
|
||||||
return true;
|
return true;
|
||||||
|
@ -284,7 +280,7 @@ NET_CompareBaseAdr(netadr_t a, netadr_t b)
|
||||||
char *
|
char *
|
||||||
NET_BaseAdrToString(netadr_t a)
|
NET_BaseAdrToString(netadr_t a)
|
||||||
{
|
{
|
||||||
static char s[64], tmp[64];
|
static char s[64];
|
||||||
struct sockaddr_storage ss;
|
struct sockaddr_storage ss;
|
||||||
struct sockaddr_in6 *s6;
|
struct sockaddr_in6 *s6;
|
||||||
|
|
||||||
|
@ -342,6 +338,8 @@ NET_BaseAdrToString(netadr_t a)
|
||||||
already return scoped IPv6 address. */
|
already return scoped IPv6 address. */
|
||||||
if (strchr(s, '%') == NULL)
|
if (strchr(s, '%') == NULL)
|
||||||
{
|
{
|
||||||
|
char tmp[64];
|
||||||
|
|
||||||
Com_sprintf(tmp, sizeof(tmp), "%s%%%d", s,
|
Com_sprintf(tmp, sizeof(tmp), "%s%%%d", s,
|
||||||
s6->sin6_scope_id);
|
s6->sin6_scope_id);
|
||||||
memcpy(s, tmp, sizeof(s));
|
memcpy(s, tmp, sizeof(s));
|
||||||
|
@ -698,13 +696,13 @@ NET_SendPacket(netsrc_t sock, int length, void *data, netadr_t to)
|
||||||
{
|
{
|
||||||
struct sockaddr_in6 *s6 = (struct sockaddr_in6 *)&addr;
|
struct sockaddr_in6 *s6 = (struct sockaddr_in6 *)&addr;
|
||||||
|
|
||||||
/* If multicast socket, must specify scope.
|
/* If multicast socket, must specify scope.
|
||||||
So multicast_interface must be specified */
|
So multicast_interface must be specified */
|
||||||
if (IN6_IS_ADDR_MULTICAST(&s6->sin6_addr))
|
if (IN6_IS_ADDR_MULTICAST(&s6->sin6_addr))
|
||||||
{
|
{
|
||||||
struct addrinfo hints;
|
struct addrinfo hints;
|
||||||
struct addrinfo *res;
|
struct addrinfo *res;
|
||||||
char tmp[128], mcast_addr[128], mcast_port[10];
|
char tmp[128];
|
||||||
int error;
|
int error;
|
||||||
|
|
||||||
/* Do a getnameinfo/getaddrinfo cycle
|
/* Do a getnameinfo/getaddrinfo cycle
|
||||||
|
@ -726,6 +724,8 @@ NET_SendPacket(netsrc_t sock, int length, void *data, netadr_t to)
|
||||||
|
|
||||||
if (multicast_interface != NULL)
|
if (multicast_interface != NULL)
|
||||||
{
|
{
|
||||||
|
char mcast_addr[128], mcast_port[10]
|
||||||
|
|
||||||
Com_sprintf(mcast_addr, sizeof(mcast_addr), "%s", tmp);
|
Com_sprintf(mcast_addr, sizeof(mcast_addr), "%s", tmp);
|
||||||
Com_sprintf(mcast_port, sizeof(mcast_port), "%d",
|
Com_sprintf(mcast_port, sizeof(mcast_port), "%d",
|
||||||
ntohs(s6->sin6_port));
|
ntohs(s6->sin6_port));
|
||||||
|
@ -1046,10 +1046,11 @@ NET_IPXSocket(int port)
|
||||||
int newsocket;
|
int newsocket;
|
||||||
struct sockaddr_ipx address;
|
struct sockaddr_ipx address;
|
||||||
unsigned long t = 1;
|
unsigned long t = 1;
|
||||||
int err;
|
|
||||||
|
|
||||||
if ((newsocket = socket(PF_IPX, SOCK_DGRAM, NSPROTO_IPX)) == -1)
|
if ((newsocket = socket(PF_IPX, SOCK_DGRAM, NSPROTO_IPX)) == -1)
|
||||||
{
|
{
|
||||||
|
int err;
|
||||||
|
|
||||||
err = WSAGetLastError();
|
err = WSAGetLastError();
|
||||||
|
|
||||||
if (err != WSAEAFNOSUPPORT)
|
if (err != WSAEAFNOSUPPORT)
|
||||||
|
@ -1154,13 +1155,12 @@ NET_OpenIPX(void)
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* A single player game will
|
* A single player game will
|
||||||
* only use the loopback code
|
* only use the loopback code
|
||||||
*/
|
*/
|
||||||
void
|
void
|
||||||
NET_Config(qboolean multiplayer)
|
NET_Config(qboolean multiplayer)
|
||||||
{
|
{
|
||||||
int i;
|
|
||||||
static qboolean old_config;
|
static qboolean old_config;
|
||||||
|
|
||||||
if (old_config == multiplayer)
|
if (old_config == multiplayer)
|
||||||
|
@ -1171,7 +1171,9 @@ NET_Config(qboolean multiplayer)
|
||||||
old_config = multiplayer;
|
old_config = multiplayer;
|
||||||
|
|
||||||
if (!multiplayer)
|
if (!multiplayer)
|
||||||
{
|
{
|
||||||
|
int i;
|
||||||
|
|
||||||
/* shut down any existing sockets */
|
/* shut down any existing sockets */
|
||||||
for (i = 0; i < 2; i++)
|
for (i = 0; i < 2; i++)
|
||||||
{
|
{
|
||||||
|
@ -1209,7 +1211,7 @@ NET_Config(qboolean multiplayer)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* sleeps msec or until
|
* sleeps msec or until
|
||||||
* net socket is ready
|
* net socket is ready
|
||||||
*/
|
*/
|
||||||
|
|
|
@ -329,11 +329,12 @@ const char *
|
||||||
Default_MenuKey(menuframework_s *m, int key)
|
Default_MenuKey(menuframework_s *m, int key)
|
||||||
{
|
{
|
||||||
const char *sound = NULL;
|
const char *sound = NULL;
|
||||||
menucommon_s *item;
|
|
||||||
int menu_key = Key_GetMenuKey(key);
|
int menu_key = Key_GetMenuKey(key);
|
||||||
|
|
||||||
if (m)
|
if (m)
|
||||||
{
|
{
|
||||||
|
menucommon_s *item;
|
||||||
|
|
||||||
if ((item = Menu_ItemAtCursor(m)) != 0)
|
if ((item = Menu_ItemAtCursor(m)) != 0)
|
||||||
{
|
{
|
||||||
if (item->type == MTYPE_FIELD)
|
if (item->type == MTYPE_FIELD)
|
||||||
|
@ -433,13 +434,14 @@ M_Print(int x, int y, char *str)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/* Unsused, left for backward compability */
|
||||||
void
|
void
|
||||||
M_DrawPic(int x, int y, char *pic)
|
M_DrawPic(int x, int y, char *pic)
|
||||||
{
|
{
|
||||||
float scale = SCR_GetMenuScale();
|
float scale = SCR_GetMenuScale();
|
||||||
|
|
||||||
Draw_PicScaled((x + ((viddef.width - 320) >> 1)) * scale,
|
Draw_PicScaled((x + ((viddef.width - 320) >> 1)) * scale,
|
||||||
(y + ((viddef.height - 240) >> 1)) * scale, pic, scale);
|
(y + ((viddef.height - 240) >> 1)) * scale, pic, scale);
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
|
@ -530,7 +532,7 @@ static int m_popup_endtime;
|
||||||
static void
|
static void
|
||||||
M_Popup(void)
|
M_Popup(void)
|
||||||
{
|
{
|
||||||
int x, y, width, lines;
|
int width, lines;
|
||||||
int n;
|
int n;
|
||||||
char *str;
|
char *str;
|
||||||
|
|
||||||
|
@ -569,6 +571,7 @@ M_Popup(void)
|
||||||
|
|
||||||
if (width)
|
if (width)
|
||||||
{
|
{
|
||||||
|
int x, y;
|
||||||
width += 2;
|
width += 2;
|
||||||
|
|
||||||
x = (320 - (width + 2) * 8) / 2;
|
x = (320 - (width + 2) * 8) / 2;
|
||||||
|
@ -835,12 +838,12 @@ M_UnbindCommand(char *command)
|
||||||
{
|
{
|
||||||
int j;
|
int j;
|
||||||
int l;
|
int l;
|
||||||
char *b;
|
|
||||||
|
|
||||||
l = strlen(command);
|
l = strlen(command);
|
||||||
|
|
||||||
for (j = 0; j < 256; j++)
|
for (j = 0; j < 256; j++)
|
||||||
{
|
{
|
||||||
|
char *b;
|
||||||
b = keybindings[j];
|
b = keybindings[j];
|
||||||
|
|
||||||
if (!b)
|
if (!b)
|
||||||
|
@ -861,7 +864,6 @@ M_FindKeysForCommand(char *command, int *twokeys)
|
||||||
int count;
|
int count;
|
||||||
int j;
|
int j;
|
||||||
int l;
|
int l;
|
||||||
char *b;
|
|
||||||
|
|
||||||
twokeys[0] = twokeys[1] = -1;
|
twokeys[0] = twokeys[1] = -1;
|
||||||
l = strlen(command);
|
l = strlen(command);
|
||||||
|
@ -869,6 +871,7 @@ M_FindKeysForCommand(char *command, int *twokeys)
|
||||||
|
|
||||||
for (j = 0; j < 256; j++)
|
for (j = 0; j < 256; j++)
|
||||||
{
|
{
|
||||||
|
char *b;
|
||||||
b = keybindings[j];
|
b = keybindings[j];
|
||||||
|
|
||||||
if (!b)
|
if (!b)
|
||||||
|
@ -1474,9 +1477,10 @@ M_Menu_Video_f(void)
|
||||||
* END GAME MENU
|
* END GAME MENU
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
#define CREDITS_SIZE 256
|
||||||
static int credits_start_time;
|
static int credits_start_time;
|
||||||
static const char **credits;
|
static const char **credits;
|
||||||
static char *creditsIndex[256];
|
static char *creditsIndex[CREDITS_SIZE];
|
||||||
static char *creditsBuffer;
|
static char *creditsBuffer;
|
||||||
static const char *idcredits[] = {
|
static const char *idcredits[] = {
|
||||||
"+QUAKE II BY ID SOFTWARE",
|
"+QUAKE II BY ID SOFTWARE",
|
||||||
|
@ -1907,7 +1911,6 @@ M_Credits_Key(int key)
|
||||||
static void
|
static void
|
||||||
M_Menu_Credits_f(void)
|
M_Menu_Credits_f(void)
|
||||||
{
|
{
|
||||||
int n;
|
|
||||||
int count;
|
int count;
|
||||||
char *p;
|
char *p;
|
||||||
|
|
||||||
|
@ -1916,9 +1919,11 @@ M_Menu_Credits_f(void)
|
||||||
|
|
||||||
if (count != -1)
|
if (count != -1)
|
||||||
{
|
{
|
||||||
|
int n;
|
||||||
p = creditsBuffer;
|
p = creditsBuffer;
|
||||||
|
|
||||||
for (n = 0; n < 255; n++)
|
// CREDITS_SIZE - 1 - last pointer should be NULL
|
||||||
|
for (n = 0; n < CREDITS_SIZE - 1; n++)
|
||||||
{
|
{
|
||||||
creditsIndex[n] = p;
|
creditsIndex[n] = p;
|
||||||
|
|
||||||
|
@ -1946,11 +1951,14 @@ M_Menu_Credits_f(void)
|
||||||
|
|
||||||
if (--count == 0)
|
if (--count == 0)
|
||||||
{
|
{
|
||||||
|
// no credits any more
|
||||||
|
// move one step futher for set NULL
|
||||||
|
n ++;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
creditsIndex[++n] = 0;
|
creditsIndex[n] = 0;
|
||||||
credits = (const char **)creditsIndex;
|
credits = (const char **)creditsIndex;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
|
@ -2196,7 +2204,6 @@ static void
|
||||||
LoadSave_AdjustPage(int dir)
|
LoadSave_AdjustPage(int dir)
|
||||||
{
|
{
|
||||||
int i;
|
int i;
|
||||||
char *str;
|
|
||||||
|
|
||||||
m_loadsave_page += dir;
|
m_loadsave_page += dir;
|
||||||
|
|
||||||
|
@ -2213,6 +2220,7 @@ LoadSave_AdjustPage(int dir)
|
||||||
|
|
||||||
for (i = 0; i < MAX_SAVEPAGES; i++)
|
for (i = 0; i < MAX_SAVEPAGES; i++)
|
||||||
{
|
{
|
||||||
|
char *str;
|
||||||
str = va("%c%d%c",
|
str = va("%c%d%c",
|
||||||
i == m_loadsave_page ? '[' : ' ',
|
i == m_loadsave_page ? '[' : ' ',
|
||||||
i + 1,
|
i + 1,
|
||||||
|
@ -2817,13 +2825,13 @@ StartServer_MenuInit(void)
|
||||||
|
|
||||||
char *buffer;
|
char *buffer;
|
||||||
char *s;
|
char *s;
|
||||||
int length;
|
|
||||||
int i;
|
|
||||||
float scale = SCR_GetMenuScale();
|
float scale = SCR_GetMenuScale();
|
||||||
|
|
||||||
/* initialize list of maps once, reuse it afterwards (=> it isn't freed) */
|
/* initialize list of maps once, reuse it afterwards (=> it isn't freed) */
|
||||||
if (mapnames == NULL)
|
if (mapnames == NULL)
|
||||||
{
|
{
|
||||||
|
int i, length;
|
||||||
|
|
||||||
/* load the list of map names */
|
/* load the list of map names */
|
||||||
if ((length = FS_LoadFile("maps.lst", (void **)&buffer)) == -1)
|
if ((length = FS_LoadFile("maps.lst", (void **)&buffer)) == -1)
|
||||||
{
|
{
|
||||||
|
@ -3865,7 +3873,6 @@ PlayerConfig_ScanDirectories(void)
|
||||||
for (i = 0; i < npms; i++)
|
for (i = 0; i < npms; i++)
|
||||||
{
|
{
|
||||||
int k, s;
|
int k, s;
|
||||||
char *a, *b, *c;
|
|
||||||
char **pcxnames;
|
char **pcxnames;
|
||||||
char **skinnames;
|
char **skinnames;
|
||||||
fileHandle_t f;
|
fileHandle_t f;
|
||||||
|
@ -3926,12 +3933,11 @@ PlayerConfig_ScanDirectories(void)
|
||||||
/* copy the valid skins */
|
/* copy the valid skins */
|
||||||
for (s = 0, k = 0; k < npcxfiles - 1; k++)
|
for (s = 0, k = 0; k < npcxfiles - 1; k++)
|
||||||
{
|
{
|
||||||
char *a, *b, *c;
|
|
||||||
|
|
||||||
if (!strstr(pcxnames[k], "_i.pcx"))
|
if (!strstr(pcxnames[k], "_i.pcx"))
|
||||||
{
|
{
|
||||||
if (IconOfSkinExists(pcxnames[k], pcxnames, npcxfiles - 1))
|
if (IconOfSkinExists(pcxnames[k], pcxnames, npcxfiles - 1))
|
||||||
{
|
{
|
||||||
|
char *a, *b, *c;
|
||||||
a = strrchr(pcxnames[k], '/');
|
a = strrchr(pcxnames[k], '/');
|
||||||
b = strrchr(pcxnames[k], '\\');
|
b = strrchr(pcxnames[k], '\\');
|
||||||
|
|
||||||
|
@ -3962,23 +3968,25 @@ PlayerConfig_ScanDirectories(void)
|
||||||
s_pmi[s_numplayermodels].nskins = nskins;
|
s_pmi[s_numplayermodels].nskins = nskins;
|
||||||
s_pmi[s_numplayermodels].skindisplaynames = skinnames;
|
s_pmi[s_numplayermodels].skindisplaynames = skinnames;
|
||||||
|
|
||||||
/* make short name for the model */
|
|
||||||
a = strrchr(dirnames[i], '/');
|
|
||||||
b = strrchr(dirnames[i], '\\');
|
|
||||||
|
|
||||||
if (a > b)
|
|
||||||
{
|
{
|
||||||
c = a;
|
char *a, *b, *c;
|
||||||
|
/* make short name for the model */
|
||||||
|
a = strrchr(dirnames[i], '/');
|
||||||
|
b = strrchr(dirnames[i], '\\');
|
||||||
|
|
||||||
|
if (a > b)
|
||||||
|
{
|
||||||
|
c = a;
|
||||||
|
}
|
||||||
|
|
||||||
|
else
|
||||||
|
{
|
||||||
|
c = b;
|
||||||
|
}
|
||||||
|
|
||||||
|
Q_strlcpy(s_pmi[s_numplayermodels].displayname, c + 1, sizeof(s_pmi[s_numplayermodels].displayname));
|
||||||
|
Q_strlcpy(s_pmi[s_numplayermodels].directory, c + 1, sizeof(s_pmi[s_numplayermodels].directory));
|
||||||
}
|
}
|
||||||
|
|
||||||
else
|
|
||||||
{
|
|
||||||
c = b;
|
|
||||||
}
|
|
||||||
|
|
||||||
Q_strlcpy(s_pmi[s_numplayermodels].displayname, c + 1, sizeof(s_pmi[s_numplayermodels].displayname));
|
|
||||||
Q_strlcpy(s_pmi[s_numplayermodels].directory, c + 1, sizeof(s_pmi[s_numplayermodels].directory));
|
|
||||||
|
|
||||||
FreeFileList(pcxnames, npcxfiles);
|
FreeFileList(pcxnames, npcxfiles);
|
||||||
|
|
||||||
s_numplayermodels++;
|
s_numplayermodels++;
|
||||||
|
@ -4200,8 +4208,7 @@ static void
|
||||||
PlayerConfig_MenuDraw(void)
|
PlayerConfig_MenuDraw(void)
|
||||||
{
|
{
|
||||||
refdef_t refdef;
|
refdef_t refdef;
|
||||||
char scratch[MAX_QPATH];
|
float scale = SCR_GetMenuScale();
|
||||||
float scale = SCR_GetMenuScale();
|
|
||||||
|
|
||||||
memset(&refdef, 0, sizeof(refdef));
|
memset(&refdef, 0, sizeof(refdef));
|
||||||
|
|
||||||
|
@ -4217,6 +4224,7 @@ PlayerConfig_MenuDraw(void)
|
||||||
{
|
{
|
||||||
static int yaw;
|
static int yaw;
|
||||||
entity_t entity;
|
entity_t entity;
|
||||||
|
char scratch[MAX_QPATH];
|
||||||
|
|
||||||
memset(&entity, 0, sizeof(entity));
|
memset(&entity, 0, sizeof(entity));
|
||||||
|
|
||||||
|
@ -4269,11 +4277,10 @@ PlayerConfig_MenuDraw(void)
|
||||||
static const char *
|
static const char *
|
||||||
PlayerConfig_MenuKey(int key)
|
PlayerConfig_MenuKey(int key)
|
||||||
{
|
{
|
||||||
int i;
|
|
||||||
|
|
||||||
if (key == K_ESCAPE)
|
if (key == K_ESCAPE)
|
||||||
{
|
{
|
||||||
char scratch[1024];
|
char scratch[1024];
|
||||||
|
int i;
|
||||||
|
|
||||||
Cvar_Set("name", s_player_name_field.buffer);
|
Cvar_Set("name", s_player_name_field.buffer);
|
||||||
|
|
||||||
|
@ -4433,10 +4440,9 @@ M_Draw(void)
|
||||||
void
|
void
|
||||||
M_Keydown(int key)
|
M_Keydown(int key)
|
||||||
{
|
{
|
||||||
const char *s;
|
|
||||||
|
|
||||||
if (m_keyfunc)
|
if (m_keyfunc)
|
||||||
{
|
{
|
||||||
|
const char *s;
|
||||||
if ((s = m_keyfunc(key)) != 0)
|
if ((s = m_keyfunc(key)) != 0)
|
||||||
{
|
{
|
||||||
S_StartLocalSound((char *)s);
|
S_StartLocalSound((char *)s);
|
||||||
|
|
|
@ -1655,7 +1655,7 @@ SpawnItem(edict_t *ent, gitem_t *item)
|
||||||
|
|
||||||
/* ====================================================================== */
|
/* ====================================================================== */
|
||||||
|
|
||||||
gitem_t itemlist[] = {
|
static const gitem_t gameitemlist[] = {
|
||||||
{
|
{
|
||||||
NULL
|
NULL
|
||||||
}, /* leave index 0 alone */
|
}, /* leave index 0 alone */
|
||||||
|
@ -2576,6 +2576,8 @@ gitem_t itemlist[] = {
|
||||||
{NULL}
|
{NULL}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
gitem_t itemlist[MAX_ITEMS];
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* QUAKED item_health (.3 .3 1) (-16 -16 -16) (16 16 16)
|
* QUAKED item_health (.3 .3 1) (-16 -16 -16) (16 16 16)
|
||||||
*/
|
*/
|
||||||
|
@ -2673,7 +2675,9 @@ SP_item_health_mega(edict_t *self)
|
||||||
void
|
void
|
||||||
InitItems(void)
|
InitItems(void)
|
||||||
{
|
{
|
||||||
game.num_items = sizeof(itemlist) / sizeof(itemlist[0]) - 1;
|
memset(itemlist, 0, sizeof(itemlist));
|
||||||
|
memcpy(itemlist, gameitemlist, sizeof(gameitemlist));
|
||||||
|
game.num_items = sizeof(gameitemlist) / sizeof(gameitemlist[0]) - 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
|
|
|
@ -79,8 +79,8 @@ MoveClientToIntermission(edict_t *ent)
|
||||||
void
|
void
|
||||||
BeginIntermission(edict_t *targ)
|
BeginIntermission(edict_t *targ)
|
||||||
{
|
{
|
||||||
int i, n;
|
int i;
|
||||||
edict_t *ent, *client;
|
edict_t *ent;
|
||||||
|
|
||||||
if (!targ)
|
if (!targ)
|
||||||
{
|
{
|
||||||
|
@ -97,6 +97,8 @@ BeginIntermission(edict_t *targ)
|
||||||
/* respawn any dead clients */
|
/* respawn any dead clients */
|
||||||
for (i = 0; i < maxclients->value; i++)
|
for (i = 0; i < maxclients->value; i++)
|
||||||
{
|
{
|
||||||
|
edict_t *client;
|
||||||
|
|
||||||
client = g_edicts + 1 + i;
|
client = g_edicts + 1 + i;
|
||||||
|
|
||||||
if (!client->inuse)
|
if (!client->inuse)
|
||||||
|
@ -119,6 +121,9 @@ BeginIntermission(edict_t *targ)
|
||||||
{
|
{
|
||||||
for (i = 0; i < maxclients->value; i++)
|
for (i = 0; i < maxclients->value; i++)
|
||||||
{
|
{
|
||||||
|
int n;
|
||||||
|
edict_t *client;
|
||||||
|
|
||||||
client = g_edicts + 1 + i;
|
client = g_edicts + 1 + i;
|
||||||
|
|
||||||
if (!client->inuse)
|
if (!client->inuse)
|
||||||
|
@ -193,6 +198,8 @@ BeginIntermission(edict_t *targ)
|
||||||
/* move all clients to the intermission point */
|
/* move all clients to the intermission point */
|
||||||
for (i = 0; i < maxclients->value; i++)
|
for (i = 0; i < maxclients->value; i++)
|
||||||
{
|
{
|
||||||
|
edict_t *client;
|
||||||
|
|
||||||
client = g_edicts + 1 + i;
|
client = g_edicts + 1 + i;
|
||||||
|
|
||||||
if (!client->inuse)
|
if (!client->inuse)
|
||||||
|
@ -210,14 +217,10 @@ DeathmatchScoreboardMessage(edict_t *ent, edict_t *killer)
|
||||||
char entry[1024];
|
char entry[1024];
|
||||||
char string[1400];
|
char string[1400];
|
||||||
int stringlength;
|
int stringlength;
|
||||||
int i, j, k;
|
int i;
|
||||||
int sorted[MAX_CLIENTS];
|
int sorted[MAX_CLIENTS];
|
||||||
int sortedscores[MAX_CLIENTS];
|
int sortedscores[MAX_CLIENTS];
|
||||||
int score, total;
|
int total;
|
||||||
int x, y;
|
|
||||||
gclient_t *cl;
|
|
||||||
edict_t *cl_ent;
|
|
||||||
char *tag;
|
|
||||||
|
|
||||||
if (!ent) /* killer can be NULL */
|
if (!ent) /* killer can be NULL */
|
||||||
{
|
{
|
||||||
|
@ -229,6 +232,9 @@ DeathmatchScoreboardMessage(edict_t *ent, edict_t *killer)
|
||||||
|
|
||||||
for (i = 0; i < game.maxclients; i++)
|
for (i = 0; i < game.maxclients; i++)
|
||||||
{
|
{
|
||||||
|
int k, j, score;
|
||||||
|
edict_t *cl_ent;
|
||||||
|
|
||||||
cl_ent = g_edicts + 1 + i;
|
cl_ent = g_edicts + 1 + i;
|
||||||
|
|
||||||
if (!cl_ent->inuse || game.clients[i].resp.spectator)
|
if (!cl_ent->inuse || game.clients[i].resp.spectator)
|
||||||
|
@ -270,6 +276,11 @@ DeathmatchScoreboardMessage(edict_t *ent, edict_t *killer)
|
||||||
|
|
||||||
for (i = 0; i < total; i++)
|
for (i = 0; i < total; i++)
|
||||||
{
|
{
|
||||||
|
char *tag;
|
||||||
|
int x, y, j;
|
||||||
|
gclient_t *cl;
|
||||||
|
edict_t *cl_ent;
|
||||||
|
|
||||||
cl = &game.clients[sorted[i]];
|
cl = &game.clients[sorted[i]];
|
||||||
cl_ent = g_edicts + 1 + sorted[i];
|
cl_ent = g_edicts + 1 + sorted[i];
|
||||||
|
|
||||||
|
@ -580,7 +591,6 @@ void
|
||||||
G_CheckChaseStats(edict_t *ent)
|
G_CheckChaseStats(edict_t *ent)
|
||||||
{
|
{
|
||||||
int i;
|
int i;
|
||||||
gclient_t *cl;
|
|
||||||
|
|
||||||
if (!ent)
|
if (!ent)
|
||||||
{
|
{
|
||||||
|
@ -589,6 +599,8 @@ G_CheckChaseStats(edict_t *ent)
|
||||||
|
|
||||||
for (i = 1; i <= maxclients->value; i++)
|
for (i = 1; i <= maxclients->value; i++)
|
||||||
{
|
{
|
||||||
|
gclient_t *cl;
|
||||||
|
|
||||||
cl = g_edicts[i].client;
|
cl = g_edicts[i].client;
|
||||||
|
|
||||||
if (!g_edicts[i].inuse || (cl->chase_target != ent))
|
if (!g_edicts[i].inuse || (cl->chase_target != ent))
|
||||||
|
|
Loading…
Reference in a new issue