diff --git a/code/cgame/cg_draw.c b/code/cgame/cg_draw.c index 24eb8d1..9515022 100644 --- a/code/cgame/cg_draw.c +++ b/code/cgame/cg_draw.c @@ -31,9 +31,9 @@ int infoStringCount; static qboolean drawCrosshairName=qfalse; -extern void InitPostGameMenuStruct(); +extern void InitPostGameMenuStruct(void); -static void CG_InterfaceStartup(); +static void CG_InterfaceStartup(void); char *ingame_text[IGT_MAX]; /* Holds pointers to ingame text */ @@ -748,7 +748,6 @@ Used for both the status bar and the scoreboard void CG_DrawHead( float x, float y, float w, float h, int clientNum, vec3_t headAngles ) { clipHandle_t cm; - centity_t *cent; clientInfo_t *ci; playerState_t *ps; float value; @@ -756,7 +755,6 @@ void CG_DrawHead( float x, float y, float w, float h, int clientNum, vec3_t head vec3_t origin; vec3_t mins, maxs; - cent = &cg_entities[ clientNum ]; ci = &cgs.clientinfo[ clientNum ]; ps = &cg.snap->ps; @@ -955,15 +953,6 @@ CG_DrawAmmo */ static void CG_DrawAmmo(centity_t *cent) { - float value; -// float xLength; - playerState_t *ps; -// int max,brightColor_i,darkColor_i,numColor_i; - - ps = &cg.snap->ps; - - value = ps->ammo[cent->currentState.weapon]; - return; } @@ -1257,17 +1246,16 @@ CG_DrawStatusBar static void CG_DrawStatusBar( void ) { centity_t *cent; - playerState_t *ps; vec3_t angles; - int y=0; - vec4_t whiteA; - int x, z, i, h, yZ; - vec3_t tmpVec, eAngle, forward, dAngle; + int y=0; + vec4_t whiteA; + int x, z, i, h, yZ; + vec3_t tmpVec, eAngle, forward, dAngle; //RPG-X: Redtechie - for the HACK code below - //int rpg_shakemycamera; - int healthBarWidth; - //float rpg_shakemycamera_intensity; - //const char *info; + //int rpg_shakemycamera; + int healthBarWidth; + //float rpg_shakemycamera_intensity; + //const char *info; /*static float colors[4][4] = { @@ -1295,8 +1283,6 @@ static void CG_DrawStatusBar( void ) // draw the team background CG_DrawTeamBackground( 0, 420, 640, 60, 0.33, cg.snap->ps.persistant[PERS_TEAM], qfalse ); - ps = &cg.snap->ps; - VectorClear( angles ); // draw any 3D icons first, so the changes back to 2D are minimized @@ -2141,16 +2127,7 @@ Draw the small two score display */ static float CG_DrawScores( float y ) { -// const char *s; - int s1, s2; //, score; -// int x, w; -// int v; -// vec4_t color; - float y1; -// gitem_t *item; - - s1 = cgs.scores1; - s2 = cgs.scores2; + float y1; y -= BIGCHAR_HEIGHT + 8; y1 = y; @@ -3223,7 +3200,6 @@ CG_LabelCrosshairEntity static void CG_LabelViewEntity( int clientNum, vec3_t origin, vec3_t entMins, vec3_t entMaxs, char *name, qboolean scanAll, vec4_t color, qboolean drawHealth, int health, char *pClass, char *rank, char *race, char* age, char *height, char *weight, char *weapon ) {//ID teammates, ID enemies, ID objectives, etc. - centity_t *cent; //clientInfo_t *ci; vec3_t center, maxs, mins, top, bottom, topLeft, topRight, bottomLeft, bottomRight; vec3_t worldEast = {1.0f, 0, 0}, worldNorth = {0, 1.0f, 0}, worldUp = {0, 0, 1.0f}; @@ -3250,8 +3226,6 @@ static void CG_LabelViewEntity( int clientNum, vec3_t origin, vec3_t entMins, ve char showAge[1024]; char showClass[1024]; //char *health = "100"; - - cent = &cg_entities[clientNum]; /*if ( clientNum < MAX_CLIENTS ) { ci = &cgs.clientinfo[clientNum]; @@ -4319,7 +4293,6 @@ static void CG_DrawWarmup( void ) { int sec; int i; clientInfo_t *ci1, *ci2; - int cw; const char *s; sec = cg.warmup; @@ -4357,11 +4330,6 @@ static void CG_DrawWarmup( void ) { // w = CG_DrawStrlen( s ); w = UI_ProportionalStringWidth(s,UI_BIGFONT); - if ( w > 640 / BIGCHAR_WIDTH ) { - cw = 640 / w; - } else { - cw = BIGCHAR_WIDTH; - } // CG_DrawStringExt( 320 - w * cw/2, 20,s, colorWhite, // qfalse, qtrue, cw, (int)(cw * 1.5), 0 ); UI_DrawProportionalString( (SCREEN_WIDTH/2), 20,s, UI_BIGFONT|UI_CENTER, colorTable[CT_LTGOLD1]); @@ -4386,12 +4354,6 @@ static void CG_DrawWarmup( void ) { w = UI_ProportionalStringWidth(s,UI_BIGFONT); - if ( w > 640 / BIGCHAR_WIDTH ) { - cw = 640 / w; - } else { - cw = BIGCHAR_WIDTH; - } - UI_DrawProportionalString((SCREEN_WIDTH/2) , 20,gamename, UI_BIGFONT|UI_CENTER, colorTable[CT_LTGOLD1]); } @@ -4416,20 +4378,6 @@ static void CG_DrawWarmup( void ) { break; } } - switch ( cg.warmupCount ) { - case 0: - cw = 28; - break; - case 1: - cw = 24; - break; - case 2: - cw = 20; - break; - default: - cw = 16; - break; - } // w = CG_DrawStrlen( s ); // CG_DrawStringExt( 320 - w * cw/2, 70, s, colorWhite, diff --git a/code/cgame/cg_drawtools.c b/code/cgame/cg_drawtools.c index 4a9c460..e7544eb 100644 --- a/code/cgame/cg_drawtools.c +++ b/code/cgame/cg_drawtools.c @@ -750,15 +750,9 @@ static void UI_DrawProportionalString2( int x, int y, const char* str, vec4_t co float fcol; float fwidth; float fheight; - vec4_t givenColor; int colorI; int special; - givenColor[0] = color[0]; - givenColor[1] = color[1]; - givenColor[2] = color[2]; - givenColor[3] = color[3]; - // draw the colored text trap_R_SetColor( color ); @@ -1452,7 +1446,7 @@ qboolean CG_ParseRankData( char **data, rankMenuData_t* rankMenuData ) { } } else { - Com_Printf( S_COLOR_RED, "Could not find { in current rankset file.\n" ); + Com_Printf( S_COLOR_RED "Could not find { in current rankset file.\n" ); return qtrue; } } @@ -1467,7 +1461,7 @@ qboolean CG_LoadRanks( void ) { fileHandle_t file; int file_len; char charText[32000]; - char *textPtr, *prevValue; + char *textPtr; char fileName[MAX_QPATH]; int i; int rankCount=0; @@ -1523,7 +1517,6 @@ qboolean CG_LoadRanks( void ) { //DEFAULT I SAY! IT'S SPECIAL! //WE NEED A DEFAULT FOR ERRORS! NO DEFAULT NO RANK FOR YOU! while ( 1 ) { - prevValue = textPtr; token = COM_Parse( &textPtr ); if ( !token[0] ) { @@ -1590,7 +1583,6 @@ qboolean CG_LoadRanks( void ) { else { //Parse.Rank.Data? :) *sigh* if only rofl while (1) { - prevValue = textPtr; token = COM_Parse( &textPtr ); if ( !token[0] ) { break; diff --git a/code/cgame/cg_ents.c b/code/cgame/cg_ents.c index b5aba67..0f337d7 100644 --- a/code/cgame/cg_ents.c +++ b/code/cgame/cg_ents.c @@ -871,7 +871,7 @@ Also called by client movement prediction code void CG_AdjustPositionForMover( const vec3_t in, int moverNum, int fromTime, int toTime, vec3_t out ) { centity_t *cent; vec3_t oldOrigin, origin, deltaOrigin; - vec3_t oldAngles, angles, deltaAngles; + vec3_t oldAngles, angles, UNUSED_VAR deltaAngles; if ( moverNum <= 0 || moverNum >= ENTITYNUM_MAX_NORMAL ) { VectorCopy( in, out ); diff --git a/code/cgame/cg_env.c b/code/cgame/cg_env.c index 8abb726..9b3f0a9 100644 --- a/code/cgame/cg_env.c +++ b/code/cgame/cg_env.c @@ -671,7 +671,7 @@ void CG_FountainSpurt( vec3_t org, vec3_t end ) //vec3_t rgb = { 0.4f, 0.7f, 0.8f }; //float distance; //FXBezier *fxb; - localEntity_t *le; + localEntity_t UNUSED_VAR *le; // offset table, could have used sin/cos, I suppose //TiM - This was for the 4-way fountain. not needed no more @@ -800,10 +800,10 @@ void electric_spark( vec3_t pos, vec3_t normal, vec3_t dir, vec3_t user ) void CG_ElectricalExplosion( vec3_t start, vec3_t dir, float radius ) { localEntity_t *le; - localEntity_t *particle; //FXTrail + localEntity_t UNUSED_VAR *particle; //FXTrail vec3_t pos, temp/*, angles*/; int i, numSparks; - float scale, dscale; + float scale; // Spawn some delayed smoke /*FX_AddSpawner( start, dir, NULL, NULL, 150, 40, qfalse, 9000, smoke_puffs ); @@ -816,7 +816,6 @@ void CG_ElectricalExplosion( vec3_t start, vec3_t dir, float radius ) for ( i = 0; i < numSparks; i++ ) { scale = 0.7f + random(); //0.2 - dscale = -scale*2; particle = FX_AddTrail( start, NULL, @@ -919,7 +918,7 @@ void CG_PhaserFX(centity_t *cent) { qboolean TorpedoQFX_Think(localEntity_t *le) { - vec3_t line1end, line2end, axis[3], rgb, vel, dis; + vec3_t line1end, line2end, axis[3], vel, dis; float dist; VectorSubtract(le->refEntity.origin, le->addOrigin, dis); @@ -958,8 +957,6 @@ qboolean TorpedoQFX_Think(localEntity_t *le) FX_AddLine( line1end, line2end, 1.0f, random() * 25 + 2, 0.0f, /*0.1 + random() * 0.2*/0.0f, 0.0f, 1, cgs.media.quantumGlow); //FX_AddSprite(line1end, NULL, qfalse, random() * 90 + 30, 4, 1.0f, 0.0f, 0, 0.0f, 1.0f, cgs.media.photonStar); - VectorSet( rgb, 1.0f, 0.45f, 0.15f ); // orange - FX_AddSprite( le->refEntity.origin, NULL,qfalse,random() * 60 + 30, 4, 0.5f, 0.0f, 0, 0.0f, 1.0f, cgs.media.quantumRays); //FX_AddSprite2(le->refEntity.origin, NULL,qfalse,random() * 10 + 60, 0.0f, 0.1f, 0.1f, rgb, rgb, 0.0f, 0.0f, 1, cgs.media.whiteRingShader); FX_AddSprite( le->refEntity.origin, NULL,qfalse,random() * 40 + 8, 4, 0.5f, 0.0f, 0, 0.0f, 1.0f, cgs.media.quantumGlow ); @@ -975,7 +972,7 @@ qboolean TorpedoQFX_Think(localEntity_t *le) qboolean TorpedoPFX_Think(localEntity_t *le) { - vec3_t line1end, line2end, axis[3], rgb, vel, dis; + vec3_t line1end, line2end, axis[3], vel, dis; float dist; VectorSubtract(le->refEntity.origin, le->addOrigin, dis); @@ -1014,8 +1011,6 @@ qboolean TorpedoPFX_Think(localEntity_t *le) FX_AddLine( line1end, line2end, 1.0f, random() * 25 + 2, 0.0f, /*0.1 + random() * 0.2*/0.0f, 0.0f, 1, cgs.media.photonGlow); //FX_AddSprite(line1end, NULL, qfalse, random() * 90 + 30, 4, 1.0f, 0.0f, 0, 0.0f, 1.0f, cgs.media.photonStar); - VectorSet( rgb, 1.0f, 0.45f, 0.15f ); // orange - FX_AddSprite( le->refEntity.origin, NULL,qfalse,random() * 60 + 30, 4, 0.5f, 0.0f, 0, 0.0f, 1.0f, cgs.media.photonRay); //FX_AddSprite2(le->refEntity.origin, NULL,qfalse,random() * 10 + 60, 0.0f, 0.1f, 0.1f, rgb, rgb, 0.0f, 0.0f, 1, cgs.media.whiteRingShader); FX_AddSprite( le->refEntity.origin, NULL,qfalse,random() * 40 + 8, 4, 0.5f, 0.0f, 0, 0.0f, 1.0f, cgs.media.photonGlow ); @@ -1087,7 +1082,7 @@ qboolean ParticleFire_Think(localEntity_t *le) { } void CG_ParticleFire(vec3_t origin, int killtime, int size) { - localEntity_t *le; + localEntity_t UNUSED_VAR *le; le = FX_AddSpawner(origin, NULL, NULL, NULL, qfalse, 0, 0, killtime, ParticleFire_Think, 10); //le->data.spawner.data1 = size; } @@ -1560,7 +1555,8 @@ Creates an orange electricity bolt effect with a pulse that travels down the bea ====================== */ -/*void ForgeBoltFireback( vec3_t start, vec3_t end, vec3_t velocity, vec3_t user ) +#if 0 +void ForgeBoltFireback( vec3_t start, vec3_t end, vec3_t velocity, vec3_t user ) { FX_AddElectricity( start, end, 1.0, user[DATA_RADIUS], 5.0, 1.0, 0.0, 200, cgs.media.pjBoltShader, (int)user[DATA_EFFECTS], user[DATA_CHAOS] ); @@ -1614,7 +1610,7 @@ bool ForgeBoltPulse( FXPrimitive *fx, centity_t *ent ) } //----------------------------- -/*void CG_ForgeBolt( centity_t *cent ) +void CG_ForgeBolt( centity_t *cent ) { qboolean pulse; int effects; @@ -1676,6 +1672,7 @@ bool ForgeBoltPulse( FXPrimitive *fx, centity_t *ent ) BoltSparkSpew( cent->currentState.origin2, dir, cgs.media.dkorangeParticleShader ); } } +#endif /* =========================== @@ -1687,8 +1684,8 @@ Create directed and scaled plasma jet void CG_Plasma( vec3_t start, vec3_t end, vec3_t sRGB, vec3_t eRGB, int startalpha, int endalpha ) { - vec3_t v, sp; - float detail, len, salpha = (startalpha / 255) , ealpha = (endalpha / 255); + vec3_t v; + float len, salpha = (startalpha / 255) , ealpha = (endalpha / 255); //detail = FX_DetailLevel( start, 16, 1200 ); //if ( detail == 0 ) @@ -1697,7 +1694,6 @@ void CG_Plasma( vec3_t start, vec3_t end, vec3_t sRGB, vec3_t eRGB, int startalp // Orient the plasma VectorSubtract( end, start, v ); len = VectorNormalize( v ); - VectorMA( start, 0.5f, v, sp ); // Stash a quad at the base to make the effect look a bit more solid //FX_AddQuad( sp, v, NULL, NULL, len * 0.36f, 0.0f, salpha, salpha, sRGB, sRGB, 0.0f, 45.0f, 0.0f, 200, cgs.media.prifleImpactShader ); @@ -1724,7 +1720,8 @@ particle stream fx for STASIS level ====================== */ -/*bool particle_stream_think( FXPrimitive *fx, centity_t *ent ) +#if 0 +bool particle_stream_think( FXPrimitive *fx, centity_t *ent ) { vec3_t old_org; @@ -1794,7 +1791,7 @@ The particles will accelerate up to the half-way point of the cylinder, then dec ====================== */ -/*void CG_TransporterStream( centity_t *cent ) +void CG_TransporterStream( centity_t *cent ) { vec3_t vel, accel, dir, pos, right, up; float len, time, acceleration, scale, dis, vf; @@ -1878,7 +1875,7 @@ CG_ExplosionTrail ------------------------- */ -/*qboolean explosionTrailThink( localEntity_t *fx ) +qboolean explosionTrailThink( localEntity_t *fx ) { localEntity_t *le=0; vec3_t direction, origin, new_org, angles, dir; @@ -1955,7 +1952,7 @@ A scanning type beam ---------------------- */ -/*void CG_BorgEnergyBeam( centity_t *cent ) +void CG_BorgEnergyBeam( centity_t *cent ) { vec3_t normal, angles, base, dir, dir2, rgb; float len, alpha; @@ -2018,6 +2015,7 @@ A scanning type beam VectorCopy( base, cent->gent->pos1 ); cent->gent->angle += cent->gent->speed * 0.08f; } +#endif /* ---------------------- diff --git a/code/cgame/cg_info.c b/code/cgame/cg_info.c index 1ab7c78..f8281e7 100644 --- a/code/cgame/cg_info.c +++ b/code/cgame/cg_info.c @@ -558,7 +558,7 @@ static void ObjectivePrint_Line(int strIndex,int color,centity_t *cent) int y,pixelLen,charLen; char holdText[1024], holdText2[2]; char finalText[MAX_OBJ_LENGTH]; - int len,len_s,maxPixLength,charHeight; + int len,maxPixLength,charHeight; assert(cgs.objectives[strIndex].text); @@ -567,7 +567,6 @@ static void ObjectivePrint_Line(int strIndex,int color,centity_t *cent) len = strlen(str); len++; Q_strncpyz(finalText,str,len); - len_s = strlen(str); pixelLen = UI_ProportionalStringWidth(finalText,UI_SMALLFONT); @@ -658,7 +657,7 @@ static int Objective_LineCnt(int strIndex,centity_t *cent) int pixelLen,charLen; char holdText[1024], holdText2[2]; char finalText[MAX_OBJ_LENGTH]; - int len,len_s,maxPixLength; + int len,maxPixLength; int lineCnt; assert(cgs.objectives[strIndex].text); @@ -667,7 +666,6 @@ static int Objective_LineCnt(int strIndex,centity_t *cent) len = strlen(str); len++; Q_strncpyz(finalText,str,len); - len_s = strlen(str); pixelLen = UI_ProportionalStringWidth(finalText,UI_SMALLFONT); lineCnt = 0; diff --git a/code/cgame/cg_local.h b/code/cgame/cg_local.h index 9ff47f5..d24871b 100644 --- a/code/cgame/cg_local.h +++ b/code/cgame/cg_local.h @@ -1838,8 +1838,8 @@ qboolean CG_Cvar_ClampInt( const char *name, vmCvar_t *vmCvar, int min, int max const char *CG_ConfigString( int index ); const char *CG_Argv( int arg ); -void QDECL CG_Printf( const char *msg, ... ); -void QDECL CG_Error( const char *msg, ... ); +void QDECL CG_Printf( const char *msg, ... ) __attribute__ ((format(printf, 1, 2))); +void QDECL CG_Error( const char *msg, ... ) __attribute__ ((format(printf, 1, 2))); void CG_StartMusic( void ); void CG_UpdateCvars( void ); diff --git a/code/cgame/cg_main.c b/code/cgame/cg_main.c index 2794963..08c0159 100644 --- a/code/cgame/cg_main.c +++ b/code/cgame/cg_main.c @@ -433,7 +433,7 @@ void QDECL CG_Printf( const char *msg, ... ) { char *msgPtr; va_start (argptr, msg); - vsprintf (text, msg, argptr); + Q_vsnprintf(text, sizeof(text), msg, argptr); va_end (argptr); if ( cg_chatColor.integer > 0 && cg_chatColor.integer < 8 ) @@ -496,7 +496,7 @@ void QDECL CG_Error( const char *msg, ... ) { char text[1024]; va_start (argptr, msg); - vsprintf (text, msg, argptr); + Q_vsnprintf (text,sizeof(text), msg, argptr); va_end (argptr); trap_Error( text ); @@ -510,7 +510,7 @@ void QDECL Com_Error( int level, const char *error, ... ) { char text[1024]; va_start (argptr, error); - vsprintf (text, error, argptr); + Q_vsnprintf (text,sizeof(text), error, argptr); va_end (argptr); CG_Error( "%s", text); @@ -521,7 +521,7 @@ void QDECL Com_Printf( const char *msg, ... ) { char text[1024]; va_start (argptr, msg); - vsprintf (text, msg, argptr); + Q_vsnprintf (text, sizeof(text), msg, argptr); va_end (argptr); CG_Printf ("%s", text); @@ -2312,7 +2312,7 @@ qboolean CG_LoadUsablesStrings( void ) token = COM_Parse( &textPtr ); if ( Q_strncmp( token, "{", 1 ) != 0 ) { - CG_Printf( S_COLOR_RED "ERROR: UsableDescriptions had no opening brace ( { )!\n", fileRoute ); + CG_Printf( S_COLOR_RED "ERROR: UsableDescriptions had no opening brace ( { )!\n" ); continue; } diff --git a/code/cgame/cg_players.c b/code/cgame/cg_players.c index e880c82..5760938 100644 --- a/code/cgame/cg_players.c +++ b/code/cgame/cg_players.c @@ -952,7 +952,7 @@ static qboolean CG_ParseModelDataFile( clientInfo_t *ci, 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; @@ -1017,7 +1017,6 @@ static qboolean CG_ParseModelDataFile( clientInfo_t *ci, 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! diff --git a/code/cgame/cg_screenfx.h b/code/cgame/cg_screenfx.h index fc43a60..f6c784a 100644 --- a/code/cgame/cg_screenfx.h +++ b/code/cgame/cg_screenfx.h @@ -24,5 +24,5 @@ extern screenFX_t theScreenFX; void CG_AddFullScreenEffect(int screenfx, int clientNum); -void CG_DrawFullScreenFX(); +void CG_DrawFullScreenFX(void); diff --git a/code/client/cl_main.c b/code/client/cl_main.c index 386a14b..20e9064 100644 --- a/code/client/cl_main.c +++ b/code/client/cl_main.c @@ -3803,15 +3803,14 @@ CL_ServerInfoPacket =================== */ void CL_ServerInfoPacket( netadr_t from, msg_t *msg ) { - int i, type; + int i; + int UNUSED_VAR type; char info[MAX_INFO_STRING]; char *infoString; int prot; char *gamename; qboolean gameMismatch; - Q_UNUSED(type); - // eliteforce doesn't send a \n after infoResponse.. infoString = strchr((char *) msg->data, '"'); if(!infoString) diff --git a/code/game/q_shared.h b/code/game/q_shared.h index 7b4b1d1..0e3782e 100644 --- a/code/game/q_shared.h +++ b/code/game/q_shared.h @@ -37,6 +37,20 @@ #endif + +//Ignore __attribute__ on non-gcc platforms +#ifndef __GNUC__ +#ifndef __attribute__ +#define __attribute__(x) +#endif +#endif + +#ifdef __GNUC__ +#define UNUSED_VAR __attribute__((unused)) +#else +#define UNUSED_VAR +#endif + /********************************************************************** VM Considerations @@ -74,6 +88,7 @@ #include #include +#define Q_vsnprintf vsnprintf #endif #ifdef _WIN32 @@ -740,8 +755,8 @@ qboolean Info_Validate( const char *s ); void Info_NextPair( const char **s, char key[MAX_INFO_KEY], char value[MAX_INFO_VALUE] ); // this is only here so the functions in q_shared.c and bg_*.c can link -void QDECL Com_Error( int errlevel, const char *error, ... ); -void QDECL Com_Printf( const char *msg, ... ); +void QDECL Com_Error( int errlevel, const char *error, ... ) __attribute__ ((format(printf, 2, 3))); +void QDECL Com_Printf( const char *msg, ... ) __attribute__ ((format (printf, 1, 2))); /* diff --git a/code/qcommon/q_shared.h b/code/qcommon/q_shared.h index 147527f..a952284 100644 --- a/code/qcommon/q_shared.h +++ b/code/qcommon/q_shared.h @@ -90,8 +90,6 @@ Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA //#pragma intrinsic( memset, memcpy ) #endif -#define Q_UNUSED(x) (void)x; - //Ignore __attribute__ on non-gcc platforms #ifndef __GNUC__ #ifndef __attribute__