Fixed some things ...

- fixed some insecure code
- fixed alot of warnings
This commit is contained in:
Walter Julius 'GSIO01' Hennecke 2012-09-10 21:26:13 +02:00
parent f75168cce5
commit f8eab147d4
14 changed files with 33 additions and 1085 deletions

View File

@ -922,10 +922,9 @@ static void AdminMenu_Init( void ) {
AdminGeneric_InitLists();
/* point the FX list */
for ( i = 0; i < 11; i++ ) {
for ( i = 0; i < 10; i++ ) {
fxList[i] = s_admin_fxData[i].name;
}
fxList[11] = 0;
/* get key binds for the bound list */
for ( i = 0; i < 3; i++ ) {

View File

@ -2630,7 +2630,7 @@ char MenuText[MAXMENUTEXT];
UI_ParseMenuText
=================
*/
static void UI_ParseMenuText()
static void UI_ParseMenuText(void)
{
char *token;
char *buffer;
@ -2728,7 +2728,7 @@ char ButtonText[MAXBUTTONTEXT];
UI_ParseButtonText
=================
*/
static void UI_ParseButtonText()
static void UI_ParseButtonText(void)
{
char *token;
char *buffer;
@ -2955,7 +2955,7 @@ void UI_SecurityCodeSetup ( void )
if ( !code )
Com_Printf( S_COLOR_RED "No data was able to be loaded\n" );
else
Com_Printf( S_COLOR_RED "ID was %u, should be %u\n", code->ID, SECURITY_ID );
Com_Printf( S_COLOR_RED "ID was %lu, should be %u\n", code->ID, SECURITY_ID );
UI_ConfirmMenu( menu_normal_text[MNT_ID_INVALID], 0, SecurityFeedback );
return;
@ -3023,7 +3023,7 @@ void UI_SecurityCodeSetup ( void )
trap_FS_Write( code, SECURITY_SIZE, wf );
trap_FS_FCloseFile( wf );
trap_Cvar_Set( "sv_securityHash", va( "%u", code->hash ) );
trap_Cvar_Set( "sv_securityHash", va( "%lu", code->hash ) );
}
/* TiM - NYARRR!!!!! ioEF has a weird config system which appears to trip this system. */
@ -3050,7 +3050,7 @@ void UI_SecurityCodeSetup ( void )
* update the security code value and lock it each time
* from here, it is subsequently sent to the server on player connect
*/
trap_Cvar_Set( "sv_securityCode", va( "%u", code->playerID ) );
trap_Cvar_Set( "sv_securityCode", va( "%lu", code->playerID ) );
}

View File

@ -144,7 +144,7 @@ static void ConfirmMenu_Draw( void )
char *message;
char buffer[46];
int height;
int x, y;
int y;
int i, j;
int spacePoint=45;
@ -152,7 +152,6 @@ static void ConfirmMenu_Draw( void )
numLines = strlen( message ) / 45 + 1;
height = (SMALLCHAR_HEIGHT + 4) * numLines;
x = 345;
y = 277 - (height * 0.5); //269
//Com_Printf( S_COLOR_RED "numLines: %i\n", numLines );

View File

@ -2577,14 +2577,10 @@ Controls_MenuEvent
*/
static void Controls_MenuEvent (void* ptr, int event)
{
menuframework_s* m;
if (event != QM_ACTIVATED)
return;
m = ((menucommon_s*)ptr)->parent;
switch (((menucommon_s*)ptr)->id)
{
case ID_CONTROLS:
@ -2690,12 +2686,7 @@ static void Controls_MenuEvent (void* ptr, int event)
case ID_KEYTURNPEED:
case ID_LOOKSPRING:
case ID_AUTOSWITCHWEAPONS:
Controls_SetConfig();
// if (event == QM_ACTIVATED)
// {
// s_controls.changesmade = qtrue;
// }
break;
}
}
@ -3474,15 +3465,12 @@ M_Default_Event
*/
void M_Default_Event (void* ptr, int event)
{
menuframework_s* m;
if (event != QM_ACTIVATED)
{
return;
}
m = ((menucommon_s*)ptr)->parent;
switch (((menucommon_s*)ptr)->id)
{

View File

@ -308,10 +308,6 @@ UI_DemosMenu_Key
*/
static sfxHandle_t UI_DemosMenu_Key( int key )
{
menucommon_s *item;
item = Menu_ItemAtCursor( &s_demos.menu );
return Menu_DefaultKey( &s_demos.menu, key );
}

File diff suppressed because it is too large Load Diff

View File

@ -12,7 +12,7 @@ x, y, are in pixels
*/
void MField_Draw( mfield_t *edit, int x, int y, int style, vec4_t color,int cursor ) {
int len;
int charw,charh;
int charw;
int drawLen;
int prestep;
int cursorChar;
@ -71,17 +71,14 @@ void MField_Draw( mfield_t *edit, int x, int y, int style, vec4_t color,int curs
if (style & UI_SMALLFONT)
{
charh = SMALLCHAR_HEIGHT;
charw = SMALLCHAR_WIDTH;
}
else if (style & UI_GIANTFONT)
{
charh = GIANTCHAR_HEIGHT;
charw = GIANTCHAR_WIDTH;
}
else
{
charh = BIGCHAR_HEIGHT;
charw = BIGCHAR_WIDTH;
}
@ -91,13 +88,6 @@ void MField_Draw( mfield_t *edit, int x, int y, int style, vec4_t color,int curs
if (style & UI_CENTER)
{
x = x + (len/2);
//x = x + ( edit->cursor - prestep ) * charw;
//len = strlen(str);
//x -= (len * (charw/2));
//x = x - (len * (charw/2));
//Com_Printf( "Dist is: %i, len is %i, width = %i\n", x, len, charw );
}
else if (style & UI_RIGHT)
{
@ -106,18 +96,11 @@ void MField_Draw( mfield_t *edit, int x, int y, int style, vec4_t color,int curs
}
else {
x = x + len;
//x = x + ( edit->cursor - prestep ) * charw;
}
if(!((uis.realtime/BLINK_DIVISOR) & 1))
{
char buff[2];
buff[0] = (unsigned char)cursorChar;
buff[1] = '\0';
UI_DrawChar( x, y+2, cursorChar, style & ~(UI_CENTER|UI_RIGHT), color );
//UI_DrawProportionalString ( x, y+2, buff, style, color );
}
}
@ -370,7 +353,6 @@ void MenuField_Draw( menufield_s *f )
int x;
int y;
int w;
int h;
int style;
qboolean focus;
int color,titleColor;
@ -388,29 +370,21 @@ void MenuField_Draw( menufield_s *f )
if (f->field.style & UI_TINYFONT)
{
w = TINYCHAR_WIDTH;
h = TINYCHAR_HEIGHT;
//style = UI_TINYFONT;
style = f->field.style;
}
else if (f->field.style & UI_BIGFONT)
{
w = BIGCHAR_WIDTH;
h = BIGCHAR_HEIGHT;
//style = UI_BIGFONT;
style = f->field.style;
}
else if (f->field.style & UI_GIANTFONT)
{
w = GIANTCHAR_WIDTH;
h = GIANTCHAR_HEIGHT;
//style = UI_GIANTFONT;
style = f->field.style;
}
else
{
w = SMALLCHAR_WIDTH;
h = SMALLCHAR_HEIGHT;
//style = UI_SMALLFONT;
style = f->field.style;
}
@ -494,12 +468,6 @@ void MenuField_Draw( menufield_s *f )
UI_DrawProportionalString( x - 5, y, menu_button_text[f->field.titleEnum][0],UI_RIGHT | UI_SMALLFONT, colorTable[titleColor]);
}// TiM 5 = 10 previously
//TiM: This is leftover from Quake III. We'll be using this variable elsewhere now :)
/*if ( f->generic.name )
{
UI_DrawString( x - w, y, f->generic.name, style|UI_RIGHT, colorTable[color] );
}*/
MField_Draw( &f->field, x, y+offset, style, colorTable[color],focus );
}

View File

@ -1377,18 +1377,13 @@ qboolean UI_ParseModelDataFile( playerInfo_t *pi, const char *charName,
fileHandle_t file;
int file_len;
char charText[20000];
char *textPtr, *prevValue;
char *textPtr;
char fileName[MAX_QPATH];
//char animPath[MAX_QPATH];
int i, n;
char *token;
char legsFileRoute[MAX_QPATH];
qboolean didAnims = qfalse;
qboolean skinSetFound=qfalse;
int noBlinking;
noBlinking = trap_Cvar_VariableValue( "cg_noBlinkingHeads" );
//size_t strLen;
//create the file route
Com_sprintf( fileName, sizeof(fileName), "models/players_rpgx/%s/%s.model", charName, modelName);
@ -1445,7 +1440,6 @@ qboolean UI_ParseModelDataFile( playerInfo_t *pi, const char *charName,
}
while ( 1 ) {
prevValue = textPtr; //set a backup
token = COM_Parse( &textPtr );
if (!token[0] || !token ) { //we've hit the end of the file. w00t! exit!
@ -1623,7 +1617,7 @@ qboolean UI_ParseModelDataFile( playerInfo_t *pi, const char *charName,
if ( !skinSetFound )
{
if ( !UI_ParseSkinSetDataFile( pi, va("%s_*", modelName, skinName ), charName, skinName ) )
if ( !UI_ParseSkinSetDataFile( pi, va("%s_*", modelName ), charName, skinName ) )
{
Com_Printf( S_COLOR_RED "ERROR: Tried loading default skin set, however it failed.\n");
}

View File

@ -1052,7 +1052,6 @@ Slider_Draw
static void Slider_Draw( menuslider_s *s )
{
int color;
int style;
int textColor=CT_RED;
int thumbColor=CT_LTGREY,backgroundColor=CT_DKGREY;
int focus,thumbX;
@ -1063,12 +1062,10 @@ static void Slider_Draw( menuslider_s *s )
if ( s->generic.flags & QMF_GRAYED )
{
color = CT_DKGREY;
style = UI_LEFT;
}
else if (Menu_ItemAtCursor( s->generic.parent ) == s)
{
color = s->color2;
style = UI_LEFT|UI_PULSE;
textColor = s->textcolor2;
thumbColor = s->thumbColor2;
backgroundColor = CT_LTGREY;
@ -1077,7 +1074,6 @@ static void Slider_Draw( menuslider_s *s )
else
{
color = s->color;
style = UI_LEFT;
textColor = s->textcolor;
thumbColor = s->thumbColor;
}

View File

@ -211,11 +211,8 @@ static void ServerInfo_LinePrep( void)
const char *s;
char key[MAX_INFO_KEY];
char value[MAX_INFO_VALUE];
menutext_s *hold_key,*hold_value;
s = s_serverinfo.info;
hold_key = &s_serverinfo.key1;
hold_value = &s_serverinfo.value1;
s_serverinfo.lineCnt = 0;
i=0;
while ( s )

View File

@ -404,7 +404,7 @@ static void ArenaServers_UpdatePicture( void ) {
hpic = trap_R_RegisterShaderNoMip( va("levelshots/%s.tga", servernodeptr->mapname) );
if (!hpic)
{
Com_sprintf( picname, sizeof(picname), "levelshots/unknownmap.tga", servernodeptr->mapname );
Com_sprintf( picname, sizeof(picname), "levelshots/unknownmap.tga" );
}
else
{
@ -845,13 +845,11 @@ void ArenaServers_LoadFavorites( void )
int i;
int j;
int numtempitems;
char emptyinfo[MAX_INFO_STRING];
char adrstr[MAX_ADDRESSLENGTH];
servernode_t templist[MAX_FAVORITESERVERS];
qboolean found;
found = qfalse;
emptyinfo[0] = '\0';
// copy the old
memcpy( templist, g_favoriteserverlist, sizeof(servernode_t)*MAX_FAVORITESERVERS );
@ -1420,8 +1418,6 @@ ArenaServers_Event
*/
static void ArenaServers_Event( void* ptr, int event ) {
int id;
menuframework_s* m;
id = ((menucommon_s*)ptr)->id;
@ -1430,8 +1426,6 @@ static void ArenaServers_Event( void* ptr, int event ) {
return;
}
m = ((menucommon_s*)ptr)->parent;
switch( id )
{
case ID_MAINMENU:

View File

@ -110,20 +110,8 @@ UI_SPPostgameMenu_NextEvent
=================
*/
static void UI_SPPostgameMenu_NextEvent( void* ptr, int event ) {
// int currentSet;
int levelSet;
int level;
// int currentLevel;
const char *arenaInfo;
int gametype;
gametype = trap_Cvar_VariableValue("g_gametype" );
//------------------------------------------- GAME TYPES
//0 GT_FFA, // free for all
//1 GT_TOURNAMENT, // one on one tournament
//2 GT_SINGLE_PLAYER, // single player tournament
//3 GT_TEAM, // team deathmatch
//4 GT_CTF, // capture the flag
if (event != QM_ACTIVATED) {
@ -131,11 +119,6 @@ static void UI_SPPostgameMenu_NextEvent( void* ptr, int event ) {
}
UI_PopMenu();
// if (gametype!=2) // FOR ALL NON 'GT_SINGLE_PLAYER' GAMES
// { return;
// }
// handle specially if we just won the training map
if( postgameMenuInfo.won == 0 ) {
level = 0;
@ -143,11 +126,6 @@ static void UI_SPPostgameMenu_NextEvent( void* ptr, int event ) {
else {
level = postgameMenuInfo.level + 1;
}
if (uis.demoversion) {
levelSet = level / 2;
} else {
levelSet = level / ARENAS_PER_TIER;
}
#if 0
currentLevel = UI_GetCurrentGame();
if( currentLevel == -1 ) {

View File

@ -858,7 +858,6 @@ static void StartServer_LevelshotDraw( void *self ) {
int x;
int y;
int n;
int color = CT_DKGOLD1;
b = (menubitmap_s *)self;
@ -884,11 +883,6 @@ static void StartServer_LevelshotDraw( void *self ) {
}
n = (s_startserver.page * MAX_MAPSPERPAGE) + (b->generic.id - ID_PICTURES);
if (n == s_startserver.currentmap)
{
color = CT_LTGOLD1;
}
y += b->height;
@ -913,25 +907,15 @@ StartServer_Graphics
*/
void StartServer_Graphics (void)
{
int x;
UI_MenuFrame2(&s_startserver.menu);
// trap_R_SetColor( colorTable[CT_DKBROWN1]);
// UI_DrawHandlePic(30,331, 47, 58, uis.whiteShader);
trap_R_SetColor( colorTable[CT_LTBROWN1]);
UI_DrawHandlePic(30,203, 47, 186, uis.whiteShader); // Middle left line
UI_DrawProportionalString( 74, 150, "5164",UI_RIGHT|UI_TINYFONT, colorTable[CT_BLACK]);
//trap_R_SetColor( colorTable[CT_BLACK]);
//UI_DrawHandlePic(30,55, 47, 280, uis.whiteShader);
// Level pics frame
trap_R_SetColor( colorTable[CT_DKBROWN1]);
x = START_X_POS;
UI_DrawProportionalString( 74, 30, "6801",UI_RIGHT|UI_TINYFONT, colorTable[CT_BLACK]);
UI_DrawProportionalString( 74, 207, "615222",UI_RIGHT|UI_TINYFONT, colorTable[CT_BLACK]);
@ -944,12 +928,6 @@ void StartServer_Graphics (void)
UI_DrawHandlePic(s_startserver.back.generic.x - 14, s_startserver.back.generic.y,
MENU_BUTTON_MED_HEIGHT, MENU_BUTTON_MED_HEIGHT, uis.graphicButtonLeftEnd);
trap_R_SetColor( colorTable[CT_DKBROWN1]);
//UI_DrawHandlePic(s_startserver.assimilation.generic.x - 24, 56, 170, 18, uis.whiteShader); // Top
//UI_DrawHandlePic(s_startserver.assimilation.generic.x - 34, 46,32, -32,s_startserver.corner_ll);
//UI_DrawHandlePic(s_startserver.assimilation.generic.x - 34, 64, 18, 278, uis.whiteShader); // Side
//UI_DrawProportionalString( s_startserver.assimilation.generic.x, 57, menu_normal_text[MNT_PARAMETERS],UI_SMALLFONT, colorTable[CT_BLACK]);
trap_R_SetColor( colorTable[CT_DKPURPLE2]);
//left bracket 'round server icons
@ -2310,7 +2288,7 @@ ServerOptions_MenuInit
static void ServerOptions_MenuInit( qboolean multiplayer )
{
int x,y,yInc;
int n,assim;
int n;
memset( &s_serveroptions, 0 ,sizeof(serveroptions_t) );
s_serveroptions.multiplayer = multiplayer;
@ -2541,7 +2519,6 @@ static void ServerOptions_MenuInit( qboolean multiplayer )
s_serveroptions.playerName[n].focusWidth = 14 * SMALLCHAR_WIDTH;
s_serveroptions.playerTeam[n].generic.type = MTYPE_SPINCONTROL;
//s_serveroptions.playerTeam[n].generic.flags = QMF_GRAPHICLIST;
s_serveroptions.playerTeam[n].generic.callback = ServerOptions_Event;
s_serveroptions.playerTeam[n].generic.id = ID_PLAYER_TEAM;
s_serveroptions.playerTeam[n].generic.x = 296;
@ -2555,25 +2532,20 @@ static void ServerOptions_MenuInit( qboolean multiplayer )
s_serveroptions.playerTeam[n].width = 20;
s_serveroptions.playerTeam[n].height = 18;
//MCG ADD:
// if ( s_serveroptions.specialties )
// {
s_serveroptions.playerClass[n].generic.type = MTYPE_SPINCONTROL;
//s_serveroptions.playerClass[n].generic.flags = QMF_GRAPHICLIST;
s_serveroptions.playerClass[n].generic.callback = ServerOptions_Event;
s_serveroptions.playerClass[n].generic.id = ID_PLAYER_CLASS;
s_serveroptions.playerClass[n].generic.x = 322;
s_serveroptions.playerClass[n].generic.y = y;
s_serveroptions.playerClass[n].listnames = playerClass_list;
s_serveroptions.playerClass[n].listshaders = s_serveroptions.pClassShaders;
s_serveroptions.playerClass[n].listX = 1;
s_serveroptions.playerClass[n].listY = 1;
s_serveroptions.playerClass[n].focusWidth = 28;
s_serveroptions.playerClass[n].focusHeight = 18;
s_serveroptions.playerClass[n].width = 28;
s_serveroptions.playerClass[n].height = 18;
// }
//MCG END
s_serveroptions.playerClass[n].generic.type = MTYPE_SPINCONTROL;
s_serveroptions.playerClass[n].generic.callback = ServerOptions_Event;
s_serveroptions.playerClass[n].generic.id = ID_PLAYER_CLASS;
s_serveroptions.playerClass[n].generic.x = 322;
s_serveroptions.playerClass[n].generic.y = y;
s_serveroptions.playerClass[n].listnames = playerClass_list;
s_serveroptions.playerClass[n].listshaders = s_serveroptions.pClassShaders;
s_serveroptions.playerClass[n].listX = 1;
s_serveroptions.playerClass[n].listY = 1;
s_serveroptions.playerClass[n].focusWidth = 28;
s_serveroptions.playerClass[n].focusHeight = 18;
s_serveroptions.playerClass[n].width = 28;
s_serveroptions.playerClass[n].height = 18;
y += ( SMALLCHAR_HEIGHT + 4 );
}
@ -2663,13 +2635,9 @@ static void ServerOptions_MenuInit( qboolean multiplayer )
Menu_AddItem( &s_serveroptions.menu, &s_serveroptions.playerTeam[n] );
}
//if( s_serveroptions.specialties )
{
Menu_AddItem( &s_serveroptions.menu, &s_serveroptions.playerClass[n] );
}
}
assim = trap_Cvar_VariableValue( "g_pModAssimilation");
Menu_AddItem( &s_serveroptions.menu, &s_serveroptions.playerClass[n] );
}
#if 0
if ( s_serveroptions.gametype != GT_CTF )
@ -2682,11 +2650,6 @@ static void ServerOptions_MenuInit( qboolean multiplayer )
}
#endif
// if (!assim) // No points in assimilation
// {
// Menu_AddItem( &s_serveroptions.menu, &s_serveroptions.timelimit );
// }
if ( s_serveroptions.gametype >= GT_TEAM )
{
Menu_AddItem( &s_serveroptions.menu, &s_serveroptions.friendlyfire );

View File

@ -1849,7 +1849,7 @@ void M_VideoDriverMenu_Graphics (void)
{
float labelColor[] = { 0, 1.0, 0, 1.0 };
float textColor[] = { 1, 1, 1, 1 };
int x,y,x2,x3;
int x,y,x2;
UI_MenuFrame(&s_videodriver.menu);
@ -1861,10 +1861,6 @@ void M_VideoDriverMenu_Graphics (void)
UI_Setup_MenuButtons();
// trap_R_SetColor( colorTable[CT_DKPURPLE1]);
// UI_DrawHandlePic( 30, 203, 47, 69, uis.whiteShader); // Top Left column above two buttons
// UI_DrawHandlePic( 30, 344, 47, 45, uis.whiteShader); // Top Left column below two buttons
// Top Frame
UI_DrawHandlePic( 178, 136, 32, -32, s_videodriver.corner_ll_8_16); // UL
UI_DrawHandlePic( 178, 221, 32, 32, s_videodriver.corner_ll_8_16); // LL
@ -1904,7 +1900,6 @@ void M_VideoDriverMenu_Graphics (void)
x = 204;
x2 = 259;
x3 = x2 + 150;
y = 168;
UI_DrawProportionalString( x, y, menu_normal_text[MNT_VENDOR], UI_LEFT|UI_TINYFONT, labelColor );
UI_DrawProportionalString( x2, y, uis.glconfig.vendor_string, UI_LEFT|UI_TINYFONT, textColor );
@ -2307,7 +2302,7 @@ static void VideoData2_MenuInit( void )
UI_VideoData2SettingsGetCvars
=================
*/
static void UI_VideoData2SettingsGetCvars()
static void UI_VideoData2SettingsGetCvars(void)
{
s_videodata2.gamma_slider.curvalue = trap_Cvar_VariableValue( "r_gamma" ) * 10.0f;
s_videodata2.screensize_slider.curvalue = trap_Cvar_VariableValue( "cg_viewsize" );