From f75168cce5e98a2337248eb1dc86382e9acfd1ff Mon Sep 17 00:00:00 2001 From: Walter Julius 'GSIO01' Hennecke Date: Mon, 10 Sep 2012 12:55:24 +0200 Subject: [PATCH] Fixed some things ... - fixed some insecure code - fexed a lot of warnings --- code/game/ai_chat.c | 10 +-- code/game/ai_cmd.c | 5 +- code/game/ai_dmnet.c | 2 +- code/game/ai_dmq3.c | 6 +- code/game/ai_main.h | 2 +- code/game/g_active.c | 29 ++----- code/game/g_cinematic.h | 11 +++ code/game/g_client.c | 14 +-- code/game/g_cmds.c | 26 ++---- code/game/g_combat.c | 6 +- code/game/g_fx.c | 12 +-- code/game/g_items.c | 2 +- code/game/g_local.h | 10 +-- code/game/g_log.c | 3 + code/game/g_main.c | 152 ++------------------------------- code/game/g_missile.c | 8 +- code/game/g_session.c | 3 +- code/game/g_spawn.c | 8 +- code/game/g_svcmds.c | 4 +- code/game/g_target.c | 16 ++-- code/game/g_team.c | 5 +- code/game/g_turrets.c | 2 - code/game/g_usable.c | 4 +- code/game/g_utils.c | 26 +++--- code/game/g_weapon.c | 18 ++-- code/game/game.vcxproj.filters | 6 +- code/game/lua_game.c | 2 +- code/game/q_shared.h | 7 ++ 28 files changed, 107 insertions(+), 292 deletions(-) create mode 100644 code/game/g_cinematic.h diff --git a/code/game/ai_chat.c b/code/game/ai_chat.c index 3ea3160..ef11dda 100644 --- a/code/game/ai_chat.c +++ b/code/game/ai_chat.c @@ -315,9 +315,8 @@ BotVisibleEnemies ================== */ int BotVisibleEnemies(bot_state_t *bs) { - float vis, dist; + float vis; int i; - vec3_t dir; aas_entityinfo_t entinfo; for (i = 0; i < MAX_CLIENTS; i++) { @@ -333,9 +332,7 @@ int BotVisibleEnemies(bot_state_t *bs) { if (EntityIsInvisible(&entinfo) && !EntityIsShooting(&entinfo)) { continue; } - //calculate the distance towards the enemy - VectorSubtract(entinfo.origin, bs->origin, dir); - dist = VectorLength(dir); + //if on the same team if (BotSameTeam(bs, i)) continue; //check if the enemy is visible @@ -895,9 +892,6 @@ BotChatTime ================== */ float BotChatTime(bot_state_t *bs) { - int cpm; - - cpm = 4000; return 4000; } diff --git a/code/game/ai_cmd.c b/code/game/ai_cmd.c index 1a5a021..cacc983 100644 --- a/code/game/ai_cmd.c +++ b/code/game/ai_cmd.c @@ -893,14 +893,12 @@ void BotMatch_CheckPoint(bot_state_t *bs, bot_match_t *match) { char buf[MAX_MESSAGE_SIZE]; vec3_t position; bot_waypoint_t *cp; - int i; if (!TeamPlayIsOn()) return; // trap_BotMatchVariable(match, POSITION, buf, MAX_MESSAGE_SIZE); VectorClear(position); //BotGPSToPosition(buf, position); - i = sscanf(buf, "%f %f %f", &position[0], &position[1], &position[2]); position[2] += 0.5; areanum = BotPointAreaNum(position); if (!areanum) { @@ -1181,7 +1179,7 @@ BotMatch_WhereAreYou */ void BotMatch_WhereAreYou(bot_state_t *bs, bot_match_t *match) { float dist, bestdist; - int i, bestitem, redflagtt, blueflagtt, redtobluett; + int i, bestitem, redflagtt, blueflagtt; bot_goal_t goal; char *nearbyitems[] = { "Phaser Compression Rifle", @@ -1222,7 +1220,6 @@ void BotMatch_WhereAreYou(bot_state_t *bs, bot_match_t *match) { if (gametype == GT_CTF) { redflagtt = trap_AAS_AreaTravelTimeToGoalArea(bs->areanum, bs->origin, ctf_redflag.areanum, TFL_DEFAULT); blueflagtt = trap_AAS_AreaTravelTimeToGoalArea(bs->areanum, bs->origin, ctf_blueflag.areanum, TFL_DEFAULT); - redtobluett = trap_AAS_AreaTravelTimeToGoalArea(ctf_redflag.areanum, ctf_redflag.origin, ctf_blueflag.areanum, TFL_DEFAULT); if (redflagtt < (redflagtt + blueflagtt) * 0.4) { BotAI_BotInitialChat(bs, "ctflocation", nearbyitems[bestitem], "red", NULL); } diff --git a/code/game/ai_dmnet.c b/code/game/ai_dmnet.c index 5d3f91e..80833ed 100644 --- a/code/game/ai_dmnet.c +++ b/code/game/ai_dmnet.c @@ -65,7 +65,7 @@ void BotDumpNodeSwitches(bot_state_t *bs) { ClientName(bs->client, netname, sizeof(netname)); BotAI_Print(PRT_MESSAGE, "%s at %1.1f switched more than %d AI nodes\n", netname, trap_AAS_Time(), MAX_NODESWITCHES); for (i = 0; i < numnodeswitches; i++) { - BotAI_Print(PRT_MESSAGE, nodeswitch[i]); + BotAI_Print(PRT_MESSAGE, "%s", nodeswitch[i]); } BotAI_Print(PRT_FATAL, ""); } diff --git a/code/game/ai_dmq3.c b/code/game/ai_dmq3.c index 8ef2b4f..df7d12f 100644 --- a/code/game/ai_dmq3.c +++ b/code/game/ai_dmq3.c @@ -640,7 +640,7 @@ BotShouldDetonateDetPack qboolean BotShouldDetonateDetPack(bot_state_t *bs) { int botNum = 0, detWeight = 0; - vec3_t packOrg, dir; + vec3_t packOrg = { 0.0f, 0.0f, 0.0f }, dir; float dist; aas_entityinfo_t botinfo; @@ -1014,7 +1014,6 @@ BotCanAndWantsToRocketJump ================== */ int BotCanAndWantsToRocketJump(bot_state_t *bs) { - float rocketjumper; //if rocket jumping is disabled if (!bot_rocketjump.integer) return qfalse; @@ -1048,7 +1047,6 @@ int BotCanAndWantsToRocketJump(bot_state_t *bs) { } } } - rocketjumper = 1; return qtrue; } @@ -1084,8 +1082,6 @@ BotWantsToCamp ================== */ int BotWantsToCamp(bot_state_t *bs) { - float camper; - camper = 0; return qfalse; } diff --git a/code/game/ai_main.h b/code/game/ai_main.h index f682376..ef8ec1d 100644 --- a/code/game/ai_main.h +++ b/code/game/ai_main.h @@ -217,7 +217,7 @@ int NumBots(void); void BotEntityInfo(int entnum, aas_entityinfo_t *info); // from the game source -void QDECL BotAI_Print(int type, char *fmt, ...); +void QDECL BotAI_Print(int type, char *fmt, ...) __attribute__ ((format (printf, 2, 3))); void QDECL QDECL BotAI_BotInitialChat( bot_state_t *bs, char *type, ... ); void BotAI_Trace(bsp_trace_t *bsptrace, vec3_t start, vec3_t mins, vec3_t maxs, vec3_t end, int passent, int contentmask); int BotAI_GetClientState( int clientNum, playerState_t *state ); diff --git a/code/game/g_active.c b/code/game/g_active.c index dd9af8d..18bbfa0 100644 --- a/code/game/g_active.c +++ b/code/game/g_active.c @@ -1467,7 +1467,7 @@ void ShieldTouch(gentity_t *self, gentity_t *other, trace_t *trace) void CreateShield(gentity_t *ent) { trace_t tr; - vec3_t mins, maxs, end, posTraceEnd, negTraceEnd, start; + vec3_t end, posTraceEnd, negTraceEnd, start; int height, posWidth, negWidth, halfWidth = 0; qboolean xaxis; int paramData = 0; @@ -1481,8 +1481,6 @@ void CreateShield(gentity_t *ent) height = (int)(MAX_SHIELD_HEIGHT * tr.fraction); // use angles to find the proper axis along which to align the shield - VectorSet(mins, -SHIELD_HALFTHICKNESS, -SHIELD_HALFTHICKNESS, 0); - VectorSet(maxs, SHIELD_HALFTHICKNESS, SHIELD_HALFTHICKNESS, height); VectorCopy(ent->r.currentOrigin, posTraceEnd); VectorCopy(ent->r.currentOrigin, negTraceEnd); @@ -1536,15 +1534,6 @@ void CreateShield(gentity_t *ent) } ent->clipmask = MASK_SHOT; - // scanable forcefield - /*if(rpg_scannableForceField.integer) { - VectorCopy(maxs, ent->s.origin2); - VectorCopy(mins, ent->s.angles2); - trap_LinkEntity(ent); - }*/ - - // Information for shield rendering. - // xaxis - 1 bit // height - 0-254 8 bits //10 // posWidth - 0-255 8 bits //10 @@ -2415,7 +2404,7 @@ void ClientEvents( gentity_t *ent, int oldEventSequence ) { //VectorCopy(ps->origin, TransDat[ps->clientNum].pTransCoord); //VectorCopy(ps->viewangles, TransDat[ps->clientNum].pTransCoordRot); //TransDat[ps->clientNum].pUsed = qtrue; - trap_SendServerCommand( ent-g_entities, va("chat \"Site to Site Transporter Location Confirmed.\nPress again to Energize.\"", Q_COLOR_ESCAPE)); + trap_SendServerCommand( ent-g_entities, va("chat \"Site to Site Transporter Location Confirmed.\nPress again to Energize.\"")); //trap_SendConsoleCommand( EXEC_APPEND, va("echo Site to Site Transporter Location Confirmed.\necho Press again to Energize.") ); ps->stats[STAT_HOLDABLE_ITEM] = BG_FindItemForHoldable( HI_TRANSPORTER ) - bg_itemlist; ps->stats[STAT_USEABLE_PLACED] = 2; // = 1 @@ -2430,7 +2419,7 @@ void ClientEvents( gentity_t *ent, int oldEventSequence ) { memset( &TransDat[ps->clientNum].storedCoord[TPT_PORTABLE], 0, sizeof( TransDat[ps->clientNum].storedCoord[TPT_PORTABLE]) ); } else { - trap_SendServerCommand( ent-g_entities, va("chat \"Unable to comply. Already within transport cycle.\"", Q_COLOR_ESCAPE)); + trap_SendServerCommand( ent-g_entities, va("chat \"Unable to comply. Already within transport cycle.\"")); } ps->stats[STAT_USEABLE_PLACED] = 0; @@ -2639,7 +2628,6 @@ ClientThink void ClientThink_real( gentity_t *ent ) { gclient_t *client; pmove_t pm; - vec3_t oldOrigin; int oldEventSequence; int msec; usercmd_t *ucmd; @@ -2889,12 +2877,10 @@ void ClientThink_real( gentity_t *ent ) { //pm.admin = IsAdmin(ent); // we use this way now the old way didn't work for adminlogin // y call a function though??? - pm.admin = g_classData[client->sess.sessionClass].isAdmin || client->LoggedAsAdmin; + pm.admin = (qboolean)(g_classData[client->sess.sessionClass].isAdmin || client->LoggedAsAdmin); //pm.admin = g_classData[client->sess.sessionClass].isAdmin; - pm.medic = g_classData[client->sess.sessionClass].isMedical; - pm.borg = g_classData[client->sess.sessionClass].isBorg; - - VectorCopy( ps->origin, oldOrigin ); + pm.medic = (qboolean)g_classData[client->sess.sessionClass].isMedical; + pm.borg = (qboolean)g_classData[client->sess.sessionClass].isBorg; // perform a pmove Pmove (&pm); @@ -3110,7 +3096,6 @@ ClientEndFrame */ void ClientEndFrame( gentity_t *ent ) { int i; - clientPersistant_t *pers; playerState_t *ps = &ent->client->ps; if ( ent->client->sess.sessionTeam == TEAM_SPECTATOR /*|| (ps->eFlags&EF_ELIMINATED)*/ ) { @@ -3119,8 +3104,6 @@ void ClientEndFrame( gentity_t *ent ) { return; } - pers = &ent->client->pers; - // turn off any expired powerups for ( i = 0 ; i < MAX_POWERUPS ; i++ ) { if ( ps->powerups[ i ] < level.time ) { diff --git a/code/game/g_cinematic.h b/code/game/g_cinematic.h new file mode 100644 index 0000000..a8c8490 --- /dev/null +++ b/code/game/g_cinematic.h @@ -0,0 +1,11 @@ +// g_cinematic.h + +#ifndef _G_CINEMATIC_H +#define _G_CINEMATIC_H + +void Cinematic_ActivateCameraMode(gentity_t *ent, gentity_t *target); +void Cinematic_DeactivateCameraMode(gentity_t *ent); +void Cinematic_ActivateGlobalCameraMode(gentity_t *target); +void Cinematic_DeactivateGlobalCameraMode(void); + +#endif // _G_CINEMATIC_H \ No newline at end of file diff --git a/code/game/g_client.c b/code/game/g_client.c index abbe3ae..da250f1 100644 --- a/code/game/g_client.c +++ b/code/game/g_client.c @@ -964,16 +964,12 @@ ClientUserInfoChanged void ClientUserinfoChanged( int clientNum ) { gentity_t *ent; int i; - char *s; //, *oldModel; + char *s; char model[MAX_QPATH]; char oldname[MAX_STRING_CHARS]; gclient_t *client; - char *c1; char userinfo[MAX_INFO_STRING]; qboolean reset; - //char *sex; -// int pickborg = 0; - char *borgytype; float weight, height; char age[MAX_NAME_LENGTH]; char race[MAX_NAME_LENGTH]; @@ -981,12 +977,9 @@ void ClientUserinfoChanged( int clientNum ) { qboolean changeName = qtrue; //TiM : For the name filter char sHeight[10]; char sWeight[10]; - //int silentCloak; clientPersistant_t *pers; clientSession_t *sess; - borgytype = "borg"; - model[0] = 0; ent = g_entities + clientNum; @@ -1201,9 +1194,6 @@ void ClientUserinfoChanged( int clientNum ) { client->noAdminChat = qfalse; } - // colors - c1 = Info_ValueForKey( userinfo, "color" ); - // teamInfo s = Info_ValueForKey( userinfo, "teamoverlay" ); if ( ! *s || atoi( s ) != 0 ) { @@ -1590,7 +1580,7 @@ void transTent_think(gentity_t *ent) { if(!temp[0]) Com_sprintf(temp, sizeof(temp), "a%i\\%s\\", i, mapChangeData.name[i]); else - Com_sprintf(temp, sizeof(temp), "%sa%i\\%s\\", i, mapChangeData.name[i]); + Com_sprintf(temp, sizeof(temp), "%sa%i\\%s\\", temp, i, mapChangeData.name[i]); } trap_SendServerCommand(ent-g_entities, va("ui_trdata \"%s\"", temp)); diff --git a/code/game/g_cmds.c b/code/game/g_cmds.c index 4353eb7..3a03432 100644 --- a/code/game/g_cmds.c +++ b/code/game/g_cmds.c @@ -1114,7 +1114,6 @@ static void Cmd_Class_f( gentity_t *ent ) { int j; char send[100]; gentity_t *other; - qboolean check = qtrue; char *className; gclient_t *client; clientSession_t *sess; @@ -1157,7 +1156,6 @@ static void Cmd_Class_f( gentity_t *ent ) { if ( trap_Argc() == 1 ) { className = g_classData[sess->sessionClass].formalName; - check = qfalse; trap_SendServerCommand( ent-g_entities, va( "print \"\nCurrent Class: %s\nUsage: Changes the user to a different class\nCommand: Class \n\nType '/classlist' into the console for a more complete list\n\"", className ) ); return; @@ -2063,15 +2061,12 @@ Cmd_ForceName_f */ void Cmd_ForceName_f( gentity_t *ent ) { gclient_t *cl; - gclient_t *client; gentity_t *other; gentity_t *sayA; int j; char send[100]; char str[MAX_TOKEN_CHARS]; char *str2; - //char str2[MAX_TOKEN_CHARS]; - //char userinfo[MAX_INFO_STRING]; char clientCmd[MAX_INFO_STRING]; #ifndef SQL @@ -2099,7 +2094,6 @@ void Cmd_ForceName_f( gentity_t *ent ) { return; } other = g_entities + cl->ps.clientNum; - client = other->client; //Get there new name str2 = ConcatArgs( 2 ); @@ -2341,7 +2335,7 @@ void Cmd_ForceKill_f( gentity_t *ent ) { int targetNum; int j, p; char send[80]; - gentity_t *target; + gentity_t *target = NULL; gentity_t *other; char arg[MAX_TOKEN_CHARS]; playerState_t *ps; @@ -2498,7 +2492,7 @@ void Cmd_ForceKillRadius_f( gentity_t *ent) if( ( rpg_forcekillradiuswaittime.integer - (level.time - LastFKRadius[clientNum]) > 0) ) { //Send message to client informing them so they can't flood. - trap_SendServerCommand( clientNum, va("cp \"Cannot use Force Kill Radius Command for %d seconds", ( rpg_forcekillradiuswaittime.integer - (level.time - LastFKRadius[clientNum]) ) * 0.001 )); // GSIO was / 1000 + trap_SendServerCommand( clientNum, va("cp \"Cannot use Force Kill Radius Command for %d seconds", (int)(( rpg_forcekillradiuswaittime.integer - (level.time - LastFKRadius[clientNum]) ) * 0.001 ))); // GSIO was / 1000 return; } @@ -2884,7 +2878,7 @@ DragCheck (RPG-X: J2J) ================= */ //This is used internally and run every frame to check for clients that need to be draged by someone. -void DragCheck() +void DragCheck(void) { gentity_t *ent = NULL; gentity_t *target = NULL; @@ -2953,7 +2947,6 @@ void Cmd_disarm_f( gentity_t *ent) gentity_t *tripwire = NULL; int foundTripWires[MAX_GENTITIES] = {ENTITYNUM_NONE}; int tripcount = 0; - int mineornot; int i; char arg[MAX_TOKEN_CHARS]; @@ -2972,7 +2965,6 @@ void Cmd_disarm_f( gentity_t *ent) #endif trap_Argv( 1, arg, sizeof( arg ) ); - mineornot = atoi( arg ); if(arg == NULL){ //J2J //Just mine @@ -3494,7 +3486,7 @@ void Cmd_Revive_f( gentity_t *ent) G_LogPrintf( "%s revived everyone (%s)\n", pers->netname, pers->ip); - Com_sprintf (send, sizeof(send), "%s revived everyone\n", pers->netname, pla_str); + Com_sprintf (send, sizeof(send), "%s revived everyone\n", pers->netname); for (j = MAX_CLIENTS - 1; j > -1; j--) { // again j++ to j-- and 1023 to MAX_CLIENTS if(g_entities[j].client){ @@ -6267,7 +6259,7 @@ static void Cmd_alert_f(gentity_t *ent) { i = 0; } else { - G_PrintfClient(ent, "Invalid alert condition %s. Valid conditions: red, blue, yellow, green.\n"); + G_PrintfClient(ent, "Invalid alert condition \'%s\'. Valid conditions: red, blue, yellow, green.\n", arg); return; } if(i == 1) { @@ -6472,18 +6464,18 @@ static void Cmd_shiphealth_f(gentity_t *ent) { RSS = floor((CSS / TSS * 100)); if(CHS == 0){ - trap_SendServerCommand( ent-g_entities, va("print \"^4The Ship is destroyed, what do you want?\n\"", RHS, CHS, THS) ); + trap_SendServerCommand( ent-g_entities, "print \"^4The Ship is destroyed, what do you want?\n\"" ); } else { if(SI == 1){ - trap_SendServerCommand( ent-g_entities, va("print \"^4Shields are online\n\"", RHS, CHS, THS) ); + trap_SendServerCommand( ent-g_entities, "print \"^4Shields are online\n\"" ); trap_SendServerCommand( ent-g_entities, va("print \"^4Shield Capactiy at %i Percent (%i of %i Points)\n\"", RSS, CSS, TSS) ); trap_SendServerCommand( ent-g_entities, va("print \"^4Structual Integrity at %i Percent (%i of %i Points)\n\"", RHS, CHS, THS) ); } else if(SI == 0){ - trap_SendServerCommand( ent-g_entities, va("print \"^4Shields are offline\n\"", RHS, CHS, THS) ); + trap_SendServerCommand( ent-g_entities, "print \"^4Shields are offline\n\"" ); trap_SendServerCommand( ent-g_entities, va("print \"^4Shield Capactiy at %i Percent (%i of %i Points)\n\"", RSS, CSS, TSS) ); trap_SendServerCommand( ent-g_entities, va("print \"^4Structual Integrity at %i Percent (%i of %i Points)\n\"", RHS, CHS, THS) ); } else { - trap_SendServerCommand( ent-g_entities, va("print \"^4Shields are inoperable\n\"", RHS, CHS, THS) ); + trap_SendServerCommand( ent-g_entities, "print \"^4Shields are inoperable\n\"" ); trap_SendServerCommand( ent-g_entities, va("print \"^4Structual Integrity at %i Percent (%i of %i Points)\n\"", RHS, CHS, THS) ); } } diff --git a/code/game/g_combat.c b/code/game/g_combat.c index bc8eca9..7fc5e6d 100644 --- a/code/game/g_combat.c +++ b/code/game/g_combat.c @@ -384,7 +384,7 @@ void player_die( gentity_t *self, gentity_t *inflictor, gentity_t *attacker, int if (rpg_kickAfterXkills.integer < 1) { - trap_SendServerCommand( attacker-g_entities, va("print \"^7Server: You have been caught n00bing, you have been temporary put in the n00b class.\n\"", (rpg_kickAfterXkills.integer - attacker->n00bCount) ) ); + trap_SendServerCommand( attacker-g_entities, va("print \"^7Server: You have been caught n00bing, you have been temporary put in the n00b class.\n\"" ) ); } else { trap_SendServerCommand( attacker-g_entities, va("print \"^7Server: You have been caught n00bing, %i more times and you will be kicked.\n\"", (rpg_kickAfterXkills.integer - attacker->n00bCount) ) ); } @@ -409,7 +409,7 @@ void player_die( gentity_t *self, gentity_t *inflictor, gentity_t *attacker, int { if ( g_classData[i].isn00b) { char conName[64]; - trap_Cvar_VariableStringBuffer( va( "rpg_%sPass" ), conName, sizeof(conName) ); + trap_Cvar_VariableStringBuffer( va( "rpg_%sPass", conName ), conName, sizeof(conName) ); Q_strncpyz(attacker->client->origClass, ClassNameForValue( attacker->client->sess.sessionClass ), sizeof(attacker->client->origClass)); attacker->client->n00bTime = level.time + 10000; @@ -1238,7 +1238,6 @@ void G_Damage( gentity_t *targ, gentity_t *inflictor, gentity_t *attacker, vec3_t dir, vec3_t point, int damage, int dflags, int mod ) { gclient_t *client; int take=0; - int save; // int asave; int knockback; qboolean bFriend = (targ && attacker)?OnSameTeam( targ, attacker ):qfalse; @@ -1474,7 +1473,6 @@ void G_Damage( gentity_t *targ, gentity_t *inflictor, gentity_t *attacker, } take = damage; - save = 0; // save some from armor //RPG-X: - RedTechie No armor in RPG diff --git a/code/game/g_fx.c b/code/game/g_fx.c index 626a6fc..1cf3198 100644 --- a/code/game/g_fx.c +++ b/code/game/g_fx.c @@ -189,8 +189,6 @@ void steam_link( gentity_t *ent ) { gentity_t *target = NULL; vec3_t dir; - float len; - //trace_t *tr; if (ent->target) { @@ -209,7 +207,7 @@ void steam_link( gentity_t *ent ) VectorSubtract( target->s.origin, ent->s.origin, dir ); - len = VectorNormalize(dir); + VectorNormalize(dir); VectorCopy(dir, ent->s.angles2); //vectoangles(dir, ent->s.angles2); //GSIO01: haha funny thing this made steam buggy VectorShort(ent->s.angles2); @@ -331,7 +329,6 @@ void bolt_link( gentity_t *ent ) { gentity_t *target = NULL; vec3_t dir; - float len; if (ent->target) { @@ -349,7 +346,7 @@ void bolt_link( gentity_t *ent ) } VectorSubtract( target->s.origin, ent->s.origin, dir ); - len = VectorNormalize( dir ); + VectorNormalize( dir ); vectoangles( dir, ent->s.angles ); VectorCopy( target->s.origin, ent->s.origin2 ); @@ -1349,7 +1346,6 @@ void forge_bolt_link( gentity_t *ent ) { gentity_t *target = NULL; vec3_t dir; - float len; target = G_Find (target, FOFS(targetname), ent->target); @@ -1364,7 +1360,7 @@ void forge_bolt_link( gentity_t *ent ) } VectorSubtract( target->s.origin, ent->s.origin, dir ); - len = VectorNormalize( dir ); + VectorNormalize( dir ); vectoangles( dir, ent->s.angles ); VectorCopy( target->s.origin, ent->s.origin2 ); @@ -2087,7 +2083,7 @@ void borg_bolt_link( gentity_t *ent ) if (!target2) { - Com_Printf("borg_bolt_link: unable to find target2 %s falling back to using ent's origin\n", ent->parent ); + Com_Printf("borg_bolt_link: unable to find target2 %s falling back to using ent's origin\n", ent->target ); } else { diff --git a/code/game/g_items.c b/code/game/g_items.c index 1accdd3..a23a388 100644 --- a/code/game/g_items.c +++ b/code/game/g_items.c @@ -900,7 +900,7 @@ void FinishSpawningItem( gentity_t *ent ) { ent->use = Use_Item; - Com_Printf(va("print \"giType %i!\n\"", ent->item->giType)); + Com_Printf("print \"giType %i!\n\"", ent->item->giType); //Commeted out because if statement causes sharing vialation /*if ( ent->item->giType == IT_TEAM ) { diff --git a/code/game/g_local.h b/code/game/g_local.h index 8c0f5de..d2e8d2a 100644 --- a/code/game/g_local.h +++ b/code/game/g_local.h @@ -967,10 +967,10 @@ void SP_fx_spark( gentity_t *ent ); void FindIntermissionPoint( void ); void G_RunThink (gentity_t *ent); void SendScoreboardMessageToAllClients( void ); -void QDECL G_Printf( const char *fmt, ... ); -void QDECL G_Error( const char *fmt, ... ); -void QDECL G_PrintfClient( gentity_t *ent, const char *fmt, ...); -void QDECL G_PrintfClientAll(const char *fmt, ...); +void QDECL G_Printf( const char *fmt, ... ) __attribute__ ((format (printf, 1, 2))); +void QDECL G_Error( const char *fmt, ... ) __attribute__ ((format (printf, 1, 2))); +void QDECL G_PrintfClient( gentity_t *ent, const char *fmt, ...) __attribute__ ((format (printf, 2, 3))); +void QDECL G_PrintfClientAll(const char *fmt, ...) __attribute__ ((format (printf, 1, 2))); // // g_sql.c @@ -1129,7 +1129,7 @@ typedef enum #define AWARDS_MSG_LENGTH 256 -void QDECL G_LogPrintf( const char *fmt, ... ); +void QDECL G_LogPrintf( const char *fmt, ... ) __attribute__ ((format (printf, 1, 2))); void QDECL G_LogWeaponPickup(int client, int weaponid); void QDECL G_LogWeaponFire(int client, int weaponid); void QDECL G_LogWeaponDamage(int client, int mod, int amount); diff --git a/code/game/g_log.c b/code/game/g_log.c index c75aed7..73b3a9a 100644 --- a/code/game/g_log.c +++ b/code/game/g_log.c @@ -1162,6 +1162,9 @@ qboolean CalculateTactician(gentity_t *ent, int *kills) while( weapon0) ) { weapon++; + if(weapon>=WP_NUM_WEAPONS) { + break; + } nKills+=killsWithWeapon[weapon]; // Update the number of kills } // diff --git a/code/game/g_main.c b/code/game/g_main.c index af40ba7..8a13108 100644 --- a/code/game/g_main.c +++ b/code/game/g_main.c @@ -1204,7 +1204,6 @@ static void G_LoadServerChangeFile(void) { char *buffer; int file_len; char *txtPtr, *token; - char *temp; int cnt = 0; int i = 0; @@ -1269,17 +1268,6 @@ static void G_LoadServerChangeFile(void) { if(cnt > 12) break; - temp = G_NewString(token); - - /*if(!infoString[0]) - Com_sprintf(infoString, sizeof(infoString), "i%i\\%s\\", cnt, temp); - else { - if(cnt % 2 == 0) - Com_sprintf(infoString, sizeof(infoString), "%si%i\\%s\\", infoString, i, temp); - else - Com_sprintf(infoString, sizeof(infoString), "%sd%i\\%s\\", infoString, i, temp); - }*/ - if(cnt % 2 == 0) Q_strncpyz(srvChangeData.ip[i], token, sizeof(srvChangeData.ip[i])); else @@ -1309,7 +1297,6 @@ static void G_LoadMapChangeFile(void) { char *buffer; int file_len; char *txtPtr, *token; - char *temp; int cnt = 0; int i = 0; @@ -1374,17 +1361,6 @@ static void G_LoadMapChangeFile(void) { if(cnt > 12) break; - temp = G_NewString(token); - - /*if(!infoString[0]) - Com_sprintf(infoString, sizeof(infoString), "i%i\\%s\\", cnt, temp); - else { - if(cnt % 2 == 0) - Com_sprintf(infoString, sizeof(infoString), "%si%i\\%s\\", infoString, i, temp); - else - Com_sprintf(infoString, sizeof(infoString), "%sd%i\\%s\\", infoString, i, temp); - }*/ - if(cnt % 2 == 0) Q_strncpyz(mapChangeData.name[i], token, sizeof(mapChangeData.name[i])); else @@ -1474,7 +1450,7 @@ static void G_LoadLocationsFile( void ) token = COM_Parse( &textPtr ); if ( Q_strncmp( token, "{", 1 ) != 0 ) { - G_Printf( S_COLOR_RED "ERROR: LocationsList2 had no opening brace ( { )!\n", fileRoute ); + G_Printf( S_COLOR_RED "ERROR: LocationsList2 had no opening brace ( { )!\n" ); continue; } @@ -1559,7 +1535,7 @@ static void G_LoadLocationsFile( void ) token = COM_Parse( &textPtr ); if ( Q_strncmp( token, "{", 1 ) != 0 ) { - G_Printf( S_COLOR_RED "ERROR: LocationsList had no opening brace ( { )!\n", fileRoute ); + G_Printf( S_COLOR_RED "ERROR: LocationsList had no opening brace ( { )!\n" ); continue; } @@ -1717,7 +1693,7 @@ char *G_searchGroupList(const char *name) } else { - Com_sprintf(races, sizeof(races), text_p); + Com_sprintf(races, sizeof(races), "%s", text_p); } return races; @@ -1898,9 +1874,7 @@ extern int LastFKRadius[]; //(RPG-X J2J) added so array can be initialised t extern RPGX_SiteTOSiteData TransDat[]; //(RPG-X J2J) added for tricorder transporter extern RPGX_DragData DragDat[]; void G_InitGame( int levelTime, int randomSeed, int restart ) { - int i;//,j; - //vec3_t Zero = {0.0,0.0,0.0}; //RPG-X J2J //TiM - use vec3_origin instead - gentity_t* SpawnPnt; //RPG-X J2J + int i; char fileName[MAX_QPATH]; float messageTime; @@ -2077,7 +2051,6 @@ void G_InitGame( int levelTime, int randomSeed, int restart ) { /*RPG-X J2J************************************************************************************/ G_Printf ("Initializing RPG-X Globals..."); - SpawnPnt = SelectRandomSpawnPoint(); //Grab a random spawn point. //TiM : Reset teh recon system on game init. //Leave this out for now to make this data persistant. @@ -2657,7 +2630,7 @@ void FindIntermissionPoint( void ) { ClearFiringFlags ================== */ -void ClearFiringFlags() +void ClearFiringFlags(void) { int i = 0; gentity_t *ent = NULL; @@ -2956,119 +2929,13 @@ void CheckTournement( void ) { } if ( g_gametype.integer == GT_TOURNAMENT ) { - - // pull in a spectator if needed - //RPG-X: RedTechie - pulling on people isnt nice - /*if ( level.numPlayingClients < 2 ) { - AddTournamentPlayer(); - }*/ - - // if we don't have two players, go back to "waiting for players" - //RPG-X: RedTechie - No warmup! - /*if ( level.numPlayingClients != 2 ) { - if ( level.warmupTime != -1 ) { - level.warmupTime = -1; - trap_SetConfigstring( CS_WARMUP, va("%i", level.warmupTime) ); - G_LogPrintf( "Warmup:\n" ); - } - return; - }*/ - if ( level.warmupTime == 0 || level.warmupTime != 0) {//RPG-X: RedTechie - No warmup Fail safe return; } - - // if the warmup is changed at the console, restart it - //RPG-X: RedTechie - No warmup! - /*if ( g_warmup.modificationCount != level.warmupModificationCount ) { - level.warmupModificationCount = g_warmup.modificationCount; - level.warmupTime = -1; - }*/ - - // if all players have arrived, start the countdown - //RPG-X: RedTechie - No warmup! - /*if ( level.warmupTime < 0 ) - { - if ( level.numPlayingClients == 2 ) - { - if ( g_warmup.integer > 1 ) - { - // fudge by -1 to account for extra delays - level.warmupTime = level.time + ( g_warmup.integer - 1 ) * 1000; - trap_SetConfigstring( CS_WARMUP, va("%i", level.warmupTime) ); - } - else - { - level.warmupTime = 0; - } - } - return; - }*/ - - //RPG-X: RedTechie - No warmup! - // if the warmup time has counted down, restart - /*if ( level.time > level.warmupTime ) { - level.warmupTime += 10000; - trap_Cvar_Set( "g_restarted", "1" ); - trap_SendConsoleCommand( EXEC_APPEND, "map_restart 0\n" ); - level.restarted = qtrue; - return; - }*/ - } else if ( g_gametype.integer != GT_SINGLE_PLAYER /*&& g_doWarmup.integer*/ ) { //RPG-X: RedTechie - No warmup! - int counts[TEAM_NUM_TEAMS]; - //qboolean notEnough = qfalse; - - if ( g_gametype.integer > GT_TEAM ) { - counts[TEAM_BLUE] = TeamCount( -1, TEAM_BLUE ); - counts[TEAM_RED] = TeamCount( -1, TEAM_RED ); - - //RPG-X: RedTechie - Enough players always - /* if (counts[TEAM_RED] < 1 || counts[TEAM_BLUE] < 1) { - notEnough = qtrue; - } - } else if ( level.numPlayingClients < 2 ) { - notEnough = qtrue; - }*/ - - //RPG-X: RedTechie - No warmup! - /*if ( notEnough ) { - if ( level.warmupTime != -1 ) { - level.warmupTime = -1; - trap_SetConfigstring( CS_WARMUP, va("%i", level.warmupTime) ); - G_LogPrintf( "Warmup:\n" ); - } - return; // still waiting for team members - }*/ - + } else if ( g_gametype.integer != GT_SINGLE_PLAYER /*&& g_doWarmup.integer*/ ) { //RPG-X: RedTechie - No warmup! if ( level.warmupTime == 0) { return; } - - // if the warmup is changed at the console, restart it - //RPG-X: RedTechie - No warmup! - /*if ( g_warmup.modificationCount != level.warmupModificationCount ) { - level.warmupModificationCount = g_warmup.modificationCount; - level.warmupTime = -1; - }*/ - - // if all players have arrived, start the countdown - //RPG-X: RedTechie - No warmup! - /*if ( level.warmupTime < 0 ) { - // fudge by -1 to account for extra delays - level.warmupTime = level.time + ( g_warmup.integer - 1 ) * 1000; - trap_SetConfigstring( CS_WARMUP, va("%i", level.warmupTime) ); - return; - }*/ - - // if the warmup time has counted down, restart - //RPG-X: RedTechie - No warmup! - /*if ( level.time > level.warmupTime ) { - level.warmupTime += 10000; - trap_Cvar_Set( "g_restarted", "1" ); - trap_SendConsoleCommand( EXEC_APPEND, "map_restart 0\n" ); - level.restarted = qtrue; - return;*/ - } } } @@ -3172,8 +3039,6 @@ void G_RunFrame( int levelTime ) { gclient_t *client; playerState_t *ps; entityState_t *es; - int msec; -int start, end; // if we are waiting for the level to restart, do nothing if ( level.restarted ) { @@ -3183,7 +3048,6 @@ int start, end; level.framenum++; level.previousTime = level.time; level.time = levelTime; - msec = level.time - level.previousTime; // get any cvar changes G_UpdateCvars(); @@ -3191,7 +3055,6 @@ int start, end; // // go through all allocated objects // -start = trap_Milliseconds(); ent = &g_entities[0]; for (i=0 ; iinuse ) { @@ -3263,9 +3126,7 @@ start = trap_Milliseconds(); G_RunThink( ent ); } - end = trap_Milliseconds(); - start = trap_Milliseconds(); // perform final fixups on the players ent = &g_entities[0]; for (i=0 ; i < level.maxclients ; i++, ent++ ) { @@ -3273,7 +3134,6 @@ start = trap_Milliseconds(); ClientEndFrame( ent ); } } - end = trap_Milliseconds(); // see if it is time to do a tournement restart CheckTournement(); diff --git a/code/game/g_missile.c b/code/game/g_missile.c index 38adfbf..b8552f8 100644 --- a/code/game/g_missile.c +++ b/code/game/g_missile.c @@ -153,11 +153,7 @@ G_MissileStick void G_MissileStick( gentity_t *ent, trace_t *trace ) { vec3_t org, dir; - gentity_t *tent = NULL; - gentity_t *other = NULL; - gclient_t *client; - - client = ent->client; + gentity_t *other = NULL; other = &g_entities[trace->entityNum]; @@ -170,7 +166,7 @@ void G_MissileStick( gentity_t *ent, trace_t *trace ) } // send client a message to start the grenade a-beepin' - tent = G_TempEntity( ent->r.currentOrigin, EV_GRENADE_SHRAPNEL ); + G_TempEntity( ent->r.currentOrigin, EV_GRENADE_SHRAPNEL ); // Back away from the wall //VectorMA( trace->endpos, 3.5, trace->plane.normal, org ); diff --git a/code/game/g_session.c b/code/game/g_session.c index eb0691c..a5c2bb7 100644 --- a/code/game/g_session.c +++ b/code/game/g_session.c @@ -51,13 +51,12 @@ Called on a reconnect void G_ReadSessionData( gclient_t *client ) { char s[MAX_STRING_CHARS]; const char *var; - int i; int team, spec; var = va( "session%i", client - level.clients ); trap_Cvar_VariableStringBuffer( var, s, sizeof(s) ); - i = sscanf( s, "%i %i %i %i %i %i %i", + sscanf( s, "%i %i %i %i %i %i %i", &team, &client->sess.sessionClass, &client->sess.spectatorTime, diff --git a/code/game/g_spawn.c b/code/game/g_spawn.c index 809eb2e..c5004ad 100644 --- a/code/game/g_spawn.c +++ b/code/game/g_spawn.c @@ -108,10 +108,9 @@ qboolean G_SpawnInt( const char *key, const char *defaultString, int *out ) { qboolean G_SpawnVector( const char *key, const char *defaultString, float *out ) { char *s; qboolean present; - int i; present = G_SpawnString( key, defaultString, &s ); - i = sscanf( s, "%f %f %f", &out[0], &out[1], &out[2] ); + sscanf( s, "%f %f %f", &out[0], &out[1], &out[2] ); return present; } @@ -581,7 +580,6 @@ qboolean G_ParseField( const char *key, const char *value, gentity_t *ent ) { float v; vec3_t vec; vec4_t vec4; - int i; for ( f=fields ; f->name ; f++ ) { if ( !Q_stricmp(f->name, key) ) { @@ -593,13 +591,13 @@ qboolean G_ParseField( const char *key, const char *value, gentity_t *ent ) { *(char **)(b+f->ofs) = G_NewString (value); break; case F_VECTOR: - i = sscanf (value, "%f %f %f", &vec[0], &vec[1], &vec[2]); + sscanf (value, "%f %f %f", &vec[0], &vec[1], &vec[2]); ((float *)(b+f->ofs))[0] = vec[0]; ((float *)(b+f->ofs))[1] = vec[1]; ((float *)(b+f->ofs))[2] = vec[2]; break; case F_VECTOR4: - i = sscanf (value, "%f %f %f %f", &vec4[0], &vec[1], &vec[2], &vec[3]); + sscanf (value, "%f %f %f %f", &vec4[0], &vec[1], &vec[2], &vec[3]); ((float *)(b+f->ofs))[0] = vec4[0]; ((float *)(b+f->ofs))[0] = vec4[1]; ((float *)(b+f->ofs))[0] = vec4[2]; diff --git a/code/game/g_svcmds.c b/code/game/g_svcmds.c index 37a850e..553ba3c 100644 --- a/code/game/g_svcmds.c +++ b/code/game/g_svcmds.c @@ -299,7 +299,7 @@ static void UpdateIDBans (void) //} //When parsed back in, the line breaks will be used to divide it up - Com_sprintf( buffer, sizeof( buffer ), "%i\n{\n\t%ul\n\t\"%s\"\n\t\"%s\"\n}\n\n", i, id->playerID, id->playerName, id->banReason ); + Com_sprintf( buffer, sizeof( buffer ), "%i\n{\n\t%lu\n\t\"%s\"\n\t\"%s\"\n}\n\n", i, id->playerID, id->playerName, id->banReason ); trap_FS_Write( buffer, strlen(buffer), f ); } @@ -523,7 +523,7 @@ void Svcmd_FindID_f ( void ) { G_Printf( "%-4.4s %-16.16s %-45.45s\n", "ID:", "Name:", "Reason:" ); G_Printf( "%-4.4s %-16.16s %-45.45s\n", "----", "-----------------", "-------------------------------------" ); - G_Printf( outputBuf ); + G_Printf( "%s", outputBuf ); } } diff --git a/code/game/g_target.c b/code/game/g_target.c index 65fc335..82b6a3d 100644 --- a/code/game/g_target.c +++ b/code/game/g_target.c @@ -1681,7 +1681,7 @@ void target_doorLock_use(gentity_t *ent, gentity_t *other, gentity_t* activator) void SP_target_doorLock(gentity_t *ent) { char *temp; if(!ent->target) { - DEVELOPER(G_Printf(S_COLOR_YELLOW "[Entity-Error] target_doorlock at %s without target!\n");); + DEVELOPER(G_Printf(S_COLOR_YELLOW "[Entity-Error] target_doorlock at %s without target!\n", vtos(ent->s.origin));); G_FreeEntity(ent); return; } @@ -2578,7 +2578,7 @@ spawnflags: 1 tells ent to free once aborted */ static int target_selfdestruct_get_unsafe_players(gentity_t *ents[MAX_GENTITIES]) { int i, n, num, cur = 0, cur2 = 0; - list_iter_p iter; + list_iter_p iter = NULL; safeZone_t* sz; int entlist[MAX_GENTITIES]; gentity_t *safePlayers[MAX_GENTITIES]; @@ -2617,7 +2617,9 @@ static int target_selfdestruct_get_unsafe_players(gentity_t *ents[MAX_GENTITIES] } } - free(iter); + if(iter != NULL) { + free(iter); + } return cur2; } @@ -2634,7 +2636,7 @@ void target_selfdestruct_use(gentity_t *ent, gentity_t *other, gentity_t *activa void target_selfdestruct_think(gentity_t *ent) { gentity_t* client; - double ETAmin, ETAsec, temp; + double ETAmin, ETAsec, temp = 0.0f; int i = 0; //now we have 3 destinct stages the entity can think about. @@ -2940,7 +2942,7 @@ falsename: redname for target_alert */ static int target_shiphealth_get_unsafe_players(gentity_t *ents[MAX_GENTITIES]) { int i, n, num, cur = 0, cur2 = 0; - list_iter_p iter; + list_iter_p iter = NULL; safeZone_t* sz; int entlist[MAX_GENTITIES]; gentity_t *safePlayers[MAX_GENTITIES]; @@ -2979,7 +2981,9 @@ static int target_shiphealth_get_unsafe_players(gentity_t *ents[MAX_GENTITIES]) } } - free(iter); + if(iter != NULL) { + free(iter); + } return cur2; } diff --git a/code/game/g_team.c b/code/game/g_team.c index 964224f..56255f0 100644 --- a/code/game/g_team.c +++ b/code/game/g_team.c @@ -77,6 +77,7 @@ const char *TeamColorString(int team) { } // NULL for everyone +void QDECL PrintMsg( gentity_t *ent, const char *fmt, ... ) __attribute__ ((format (printf, 2, 3))); void QDECL PrintMsg( gentity_t *ent, const char *fmt, ... ) { char msg[1024]; va_list argptr; @@ -84,7 +85,7 @@ void QDECL PrintMsg( gentity_t *ent, const char *fmt, ... ) { va_start (argptr,fmt); if (vsprintf (msg, fmt, argptr) > sizeof(msg)) { - G_Error ( "PrintMsg overrun" ); + G_Error ( "%s", "PrintMsg overrun" ); } va_end (argptr); @@ -864,7 +865,6 @@ void TeamplayInfoMessage( gentity_t *ent ) { gentity_t *player; int cnt; //int h, a; - int clients[TEAM_MAXOVERLAY]; //TiM : Send data regardless /*if ( ! ent->client->pers.teamInfo ) @@ -881,7 +881,6 @@ void TeamplayInfoMessage( gentity_t *ent ) { player = g_entities + level.sortedClients[i]; if (player->inuse && player->client->sess.sessionTeam == ent->client->sess.sessionTeam ) { - clients[cnt++] = level.sortedClients[i]; } } diff --git a/code/game/g_turrets.c b/code/game/g_turrets.c index 2d3232c..c1f2c6c 100644 --- a/code/game/g_turrets.c +++ b/code/game/g_turrets.c @@ -351,7 +351,6 @@ void turret_aim( gentity_t *self ) vec3_t enemyDir; vec3_t desiredAngles; float diffAngle, armAngleDiff, headAngleDiff; - int upTurn = 0; int yawTurn = 0; gentity_t *lastEnemy = self->lastEnemy; @@ -430,7 +429,6 @@ void turret_aim( gentity_t *self ) {/* Add the increment */ lastEnemy->lastEnemy->r.currentAngles[0] += (diffAngle < 0) ? -self->speed : self->speed; } - upTurn = (diffAngle > 0) ? 1 : -1; } /* Cap the range */ headAngleDiff = AngleSubtract(self->r.currentAngles[0], lastEnemy->lastEnemy->r.currentAngles[0]); diff --git a/code/game/g_usable.c b/code/game/g_usable.c index 87084c6..f14b047 100644 --- a/code/game/g_usable.c +++ b/code/game/g_usable.c @@ -434,7 +434,7 @@ qboolean G_SetupUsablesStrings( void ) token = COM_Parse( &textPtr ); if ( Q_strncmp( token, "{", 1 ) != 0 ) { - G_Printf( S_COLOR_RED "ERROR: UsableDescriptions had no opening brace ( { )!\n", fileRoute ); + G_Printf( S_COLOR_RED "ERROR: UsableDescriptions had no opening brace ( { )!\n" ); continue; } @@ -453,7 +453,7 @@ qboolean G_SetupUsablesStrings( void ) token = COM_Parse( &textPtr ); if ( Q_strncmp( token, "{", 1 ) ) { - G_Printf( S_COLOR_RED "ERROR: UsableEntities had no opening brace ( { )!\n", fileRoute ); + G_Printf( S_COLOR_RED "ERROR: UsableEntities had no opening brace ( { )!\n" ); continue; } diff --git a/code/game/g_utils.c b/code/game/g_utils.c index a7bb2b8..556b3d3 100644 --- a/code/game/g_utils.c +++ b/code/game/g_utils.c @@ -359,7 +359,7 @@ void G_UseTargets2( gentity_t *ent, gentity_t *activator, char *target ) { t = NULL; while ( (t = G_Find (t, FOFS(targetname), target)) != NULL ) { if ( t == ent ) { - G_Printf (va("WARNING: Entity %i used itself.\n", t->s.number)); /* RPG-X | GSIO01 | 22.10.09: a little bit more information for the mapper */ + G_Printf ("WARNING: Entity %i used itself.\n", t->s.number); /* RPG-X | GSIO01 | 22.10.09: a little bit more information for the mapper */ } else { if ( t->use ) { t->use (t, ent, activator); @@ -379,7 +379,7 @@ void G_UseTargets2( gentity_t *ent, gentity_t *activator, char *target ) { } } if ( !ent->inuse ) { - G_Printf(va("Entity %i was removed while using targets\n", t->s.number)); /* RPG-X | GSIO01 | 22.10.09: a little bit more information for the mapper */ + G_Printf("Entity %i was removed while using targets\n", t->s.number); /* RPG-X | GSIO01 | 22.10.09: a little bit more information for the mapper */ return; } } @@ -392,7 +392,7 @@ void G_UseTargets2( gentity_t *ent, gentity_t *activator, char *target ) { t = NULL; while ( (t = G_Find (t, FOFS(swapname), target)) != NULL ) { if ( t == ent ) { - G_Printf (va("WARNING: Entity %i used itself.\n", t->s.number)); /* RPG-X | GSIO01 | 22.10.09: a little bit more information for the mapper */ + G_Printf ("WARNING: Entity %i used itself.\n", t->s.number); /* RPG-X | GSIO01 | 22.10.09: a little bit more information for the mapper */ } else { if ( t->use ) { t->use (t, ent, activator); @@ -412,7 +412,7 @@ void G_UseTargets2( gentity_t *ent, gentity_t *activator, char *target ) { } } if ( !ent->inuse ) { - G_Printf(va("Entity %i was removed while using targets\n", t->s.number)); /* RPG-X | GSIO01 | 22.10.09: a little bit more information for the mapper */ + G_Printf("Entity %i was removed while using targets\n", t->s.number); /* RPG-X | GSIO01 | 22.10.09: a little bit more information for the mapper */ return; } } @@ -420,7 +420,7 @@ void G_UseTargets2( gentity_t *ent, gentity_t *activator, char *target ) { t = NULL; while ( (t = G_Find (t, FOFS(truename), target)) != NULL ) { if ( t == ent ) { - G_Printf (va("WARNING: Entity %i used itself.\n", t->s.number)); /* RPG-X | GSIO01 | 22.10.09: a little bit more information for the mapper */ + G_Printf ("WARNING: Entity %i used itself.\n", t->s.number); /* RPG-X | GSIO01 | 22.10.09: a little bit more information for the mapper */ } else { if ( t->use ) { t->use (t, ent, activator); @@ -440,7 +440,7 @@ void G_UseTargets2( gentity_t *ent, gentity_t *activator, char *target ) { } } if ( !ent->inuse ) { - G_Printf(va("Entity %i was removed while using targets\n", t->s.number)); /* RPG-X | GSIO01 | 22.10.09: a little bit more information for the mapper */ + G_Printf("Entity %i was removed while using targets\n", t->s.number); /* RPG-X | GSIO01 | 22.10.09: a little bit more information for the mapper */ return; } } @@ -448,7 +448,7 @@ void G_UseTargets2( gentity_t *ent, gentity_t *activator, char *target ) { t = NULL; while ( (t = G_Find (t, FOFS(falsename), target)) != NULL ) { if ( t == ent ) { - G_Printf (va("WARNING: Entity %i used itself.\n", t->s.number)); /* RPG-X | GSIO01 | 22.10.09: a little bit more information for the mapper */ + G_Printf ("WARNING: Entity %i used itself.\n", t->s.number); /* RPG-X | GSIO01 | 22.10.09: a little bit more information for the mapper */ } else { if ( t->use ) { t->use (t, ent, activator); @@ -468,7 +468,7 @@ void G_UseTargets2( gentity_t *ent, gentity_t *activator, char *target ) { } } if ( !ent->inuse ) { - G_Printf(va("Entity %i was removed while using targets\n", t->s.number)); /* RPG-X | GSIO01 | 22.10.09: a little bit more information for the mapper */ + G_Printf("Entity %i was removed while using targets\n", t->s.number); /* RPG-X | GSIO01 | 22.10.09: a little bit more information for the mapper */ return; } } @@ -483,7 +483,7 @@ void G_UseTargets2( gentity_t *ent, gentity_t *activator, char *target ) { t = NULL; while( (t = G_Find(t, FOFS(bluename), target)) != NULL ) { if ( t == ent ) { - G_Printf (va("WARNING: Entity %i used itself.\n", t->s.number)); /* RPG-X | GSIO01 | 22.10.09: a little bit more information for the mapper */ + G_Printf ("WARNING: Entity %i used itself.\n", t->s.number); /* RPG-X | GSIO01 | 22.10.09: a little bit more information for the mapper */ } else { if ( t->use ) { t->use (t, ent, ent); @@ -503,7 +503,7 @@ void G_UseTargets2( gentity_t *ent, gentity_t *activator, char *target ) { } } if ( !ent->inuse ) { - G_Printf(va("Entity %i was removed while using targets\n", t->s.number)); /* RPG-X | GSIO01 | 22.10.09: a little bit more information for the mapper */ + G_Printf("Entity %i was removed while using targets\n", t->s.number); /* RPG-X | GSIO01 | 22.10.09: a little bit more information for the mapper */ return; } } @@ -733,7 +733,7 @@ gentity_t *G_Spawn( void ) { } G_LogPrintf("RPG-X WARNING: Max entities hit! Removed all tripmines. Restart the server ASAP or suffer a server crash!\n"); - trap_SendServerCommand( -1, va("print \"^1RPG-X WARNING: Max entities hit! Removed all tripmines. Restart the server ASAP or suffer a server crash!\n\"", i, ENTITYNUM_MAX_NORMAL)); + trap_SendServerCommand( -1, "print \"^1RPG-X WARNING: Max entities hit! Removed all tripmines. Restart the server ASAP or suffer a server crash!\n\""); if ( i == ENTITYNUM_MAX_NORMAL ) { G_Error( "G_Spawn: no free entities" ); @@ -1222,7 +1222,7 @@ gentity_t *G_GetNearestEnt(char *classname, vec3_t origin, float radius, gentity */ gentity_t *G_GetNearestPlayer(vec3_t origin, float radius, gentity_t *ignore ) { gentity_t *entList[MAX_GENTITIES], *nearest = NULL; - int count, i; + int i; float distance, minDist; vec3_t dist; @@ -1231,7 +1231,7 @@ gentity_t *G_GetNearestPlayer(vec3_t origin, float radius, gentity_t *ignore ) { minDist = radius; - count = G_RadiusList(origin, radius, ignore, qtrue, entList); + G_RadiusList(origin, radius, ignore, qtrue, entList); for(i = 0; i < MAX_CLIENTS; i++) { if(entList[i]->client) { diff --git a/code/game/g_weapon.c b/code/game/g_weapon.c index 6315c0c..0e0471c 100644 --- a/code/game/g_weapon.c +++ b/code/game/g_weapon.c @@ -211,13 +211,10 @@ static void WP_FirePhaser( gentity_t *ent, qboolean alt_fire ) * Use the ending point of the thin trace to do two more traces, * one on either side, for actual damaging effect. */ - vec3_t vUp = {0,0,1}, vRight, start2, end2; - float halfBeamWidth = PHASER_ALT_RADIUS; + vec3_t vUp = {0,0,1}, vRight; CrossProduct(forward, vUp, vRight); VectorNormalize(vRight); - VectorMA(muzzle, halfBeamWidth, vRight, start2); - VectorMA(end, halfBeamWidth, vRight, end2); VectorCopy(tr.endpos, end); trap_Trace (&tr, muzzle, NULL, NULL, end, ent->s.number, (CONTENTS_PLAYERCLIP|CONTENTS_BODY) ); if ( (tr.entityNum != (MAX_GENTITIES-1)) && @@ -226,8 +223,6 @@ static void WP_FirePhaser( gentity_t *ent, qboolean alt_fire ) trEnts[1] = tr.entityNum; trEntFraction[1] = tr.fraction; } - VectorMA(muzzle, -halfBeamWidth, vRight, start2); - VectorMA(end, -halfBeamWidth, vRight, end2); trap_Trace (&tr, muzzle, NULL, NULL, end, ent->s.number, (CONTENTS_PLAYERCLIP|CONTENTS_BODY) ); if ( (tr.entityNum != (MAX_GENTITIES-1)) && (tr.entityNum != trEnts[0]) && @@ -594,11 +589,10 @@ static void WP_FireDisruptor( gentity_t *ent, qboolean alt_fire ) static void grenadeExplode( gentity_t *ent ) { vec3_t pos; - gentity_t *tent; VectorSet( pos, ent->r.currentOrigin[0], ent->r.currentOrigin[1], ent->r.currentOrigin[2] + 8 ); - tent = G_TempEntity( pos, EV_GRENADE_EXPLODE ); + G_TempEntity( pos, EV_GRENADE_EXPLODE ); /* splash damage (doesn't apply to person directly hit) */ if ( ent->splashDamage ) { @@ -1559,11 +1553,11 @@ static void WP_TricorderScan (gentity_t *ent, qboolean alt_fire) * if u actually tried this, you'd atomically disperse the transportee in a very painful way O_o */ if ( TransDat[tr_ent->client->ps.clientNum].beamTime > level.time ) { - trap_SendServerCommand( ent-g_entities, va("chat \"Unable to comply. Subject is already within a transport cycle.\"", Q_COLOR_ESCAPE)); + trap_SendServerCommand( ent-g_entities, "chat \"Unable to comply. Subject is already within a transport cycle.\""); return; } - trap_SendServerCommand( ent-g_entities, va("chat \"Energizing.\"", Q_COLOR_ESCAPE)); + trap_SendServerCommand( ent-g_entities, "chat \"Energizing.\""); G_InitTransport( tr_ent->client->ps.clientNum, TransDat[clientNum].storedCoord[TPT_TRICORDER].origin, TransDat[clientNum].storedCoord[TPT_TRICORDER].angles ); return; @@ -1577,12 +1571,12 @@ static void WP_TricorderScan (gentity_t *ent, qboolean alt_fire) /*VectorCopy(ent->client->ps.origin, TransDat[clientNum].TransCoord);*/ /*VectorCopy(ent->client->ps.viewangles, TransDat[clientNum].TransCoordRot);*/ TransDat[clientNum].LastClick = level.time-5000; - trap_SendServerCommand( ent-g_entities, va("chat \"Location Confirmed.\"", Q_COLOR_ESCAPE)); + trap_SendServerCommand( ent-g_entities, "chat \"Location Confirmed.\""); /*trap_SendConsoleCommand( EXEC_APPEND, va("echo Location Confirmed.") );*/ } else { - trap_SendServerCommand( ent-g_entities, va("chat \"Click again to confirm Transporter Location.\"", Q_COLOR_ESCAPE)); + trap_SendServerCommand( ent-g_entities, "chat \"Click again to confirm Transporter Location.\""); /*trap_SendConsoleCommand( EXEC_APPEND, va("echo Click again to confirm Transporter Location.") );*/ TransDat[clientNum].LastClick = level.time; } diff --git a/code/game/game.vcxproj.filters b/code/game/game.vcxproj.filters index ea16300..e6f6c26 100644 --- a/code/game/game.vcxproj.filters +++ b/code/game/game.vcxproj.filters @@ -452,15 +452,15 @@ Source Files\lua - - Header Files - Header Files Header Files + + Header Files + diff --git a/code/game/lua_game.c b/code/game/lua_game.c index aa854c7..f1eebbe 100644 --- a/code/game/lua_game.c +++ b/code/game/lua_game.c @@ -272,7 +272,7 @@ static int Game_AlertAddShader(lua_State *L) { return 1; } luaAlertState->shaders[cond] = tmp; - Com_sprintf(luaAlertState->shaders[cond], sizeof(luaAlertState->shaders[cond]), "%s\0%s", luaAlertState->shaders[cond], shader); + Com_sprintf(luaAlertState->shaders[cond], sizeof(luaAlertState->shaders[cond]), "%s\n%s", luaAlertState->shaders[cond], shader); } lua_pushboolean(L, 1); diff --git a/code/game/q_shared.h b/code/game/q_shared.h index 377db59..c51b7f9 100644 --- a/code/game/q_shared.h +++ b/code/game/q_shared.h @@ -37,6 +37,13 @@ #endif +//Ignore __attribute__ on non-gcc platforms +#ifndef __GNUC__ +#ifndef __attribute__ +#define __attribute__(x) +#endif +#endif + /********************************************************************** VM Considerations