From a02fabfad7e8dce6901d7cc455ab2e3a8321585b Mon Sep 17 00:00:00 2001 From: zturtleman Date: Tue, 8 Mar 2011 09:07:05 +0000 Subject: [PATCH] Fixed all but one warning in "game". --- engine/code/game/ai_dmnet.c | 3 +- engine/code/game/ai_dmq3.c | 6 +- engine/code/game/ai_team.c | 3 +- engine/code/game/bg_pmove.c | 3 + engine/code/game/g_active.c | 13 +- engine/code/game/g_client.c | 311 +++++++++++--------- engine/code/game/g_cmds.c | 2 +- engine/code/game/g_combat.c | 6 +- engine/code/game/g_local.h | 19 +- engine/code/game/g_main.c | 28 +- engine/code/game/g_misc.c | 5 +- engine/code/game/g_rally_hazard.c | 5 +- engine/code/game/g_rally_mapents.c | 3 +- engine/code/game/g_rally_observer_cams.c | 12 +- engine/code/game/g_rally_racetools.c | 15 +- engine/code/game/g_rally_scripted_objects.c | 7 +- engine/code/game/g_rally_tools.c | 2 +- engine/code/game/g_team.c | 16 +- engine/code/game/g_team.h | 4 +- engine/code/game/g_weapon.c | 3 +- 20 files changed, 248 insertions(+), 218 deletions(-) diff --git a/engine/code/game/ai_dmnet.c b/engine/code/game/ai_dmnet.c index a78c6143..739d5823 100644 --- a/engine/code/game/ai_dmnet.c +++ b/engine/code/game/ai_dmnet.c @@ -3014,7 +3014,8 @@ int AINode_MoveToNextCheckpoint( bot_state_t *bs ) gentity_t *next = NULL, *prev = NULL, *ent = NULL; int nextCheckpoint; int lastCheckpoint; - float f, dist, speed, accel, actualSpeed, dot, a_normal, curvature; + float f, dist, speed, actualSpeed, dot, curvature; + //float accel, a_normal; int throttleChange; if (BotIsObserver(bs)) { diff --git a/engine/code/game/ai_dmq3.c b/engine/code/game/ai_dmq3.c index 1954b491..e18570c1 100644 --- a/engine/code/game/ai_dmq3.c +++ b/engine/code/game/ai_dmq3.c @@ -4251,7 +4251,7 @@ int BotGetActivateGoal(bot_state_t *bs, int entitynum, bot_activategoal_t *activ return 0; } trap_AAS_ValueForBSPEpairKey(ent, "classname", classname, sizeof(classname)); - if (!classname) { + if (!*classname) { BotAI_Print(PRT_ERROR, "BotGetActivateGoal: entity with model %s has no classname\n", model); return 0; } @@ -4516,7 +4516,7 @@ void BotAIBlocked(bot_state_t *bs, bot_moveresult_t *moveresult, int activate) { #ifdef OBSTACLEDEBUG ClientName(bs->client, netname, sizeof(netname)); BotAI_Print(PRT_MESSAGE, "%s: I'm blocked by model %d\n", netname, entinfo.modelindex); -#endif OBSTACLEDEBUG +#endif // OBSTACLEDEBUG // if blocked by a bsp model and the bot wants to activate it if (activate && entinfo.modelindex > 0 && entinfo.modelindex <= max_bspmodelindex) { // find the bsp entity which should be activated in order to get the blocking entity out of the way @@ -5535,5 +5535,3 @@ BotShutdownDeathmatchAI void BotShutdownDeathmatchAI(void) { altroutegoals_setup = qfalse; } - - diff --git a/engine/code/game/ai_team.c b/engine/code/game/ai_team.c index ff3d97f4..0907f0a3 100644 --- a/engine/code/game/ai_team.c +++ b/engine/code/game/ai_team.c @@ -130,7 +130,7 @@ int BotSortTeamMatesByBaseTravelTime(bot_state_t *bs, int *teammates, int maxtea char buf[MAX_INFO_STRING]; static int maxclients; int traveltimes[MAX_CLIENTS]; - bot_goal_t *goal; + bot_goal_t *goal = NULL; // STONELANCE if (gametype == GT_CTF /*|| gametype == GT_1FCTF*/) { @@ -148,7 +148,6 @@ int BotSortTeamMatesByBaseTravelTime(bot_state_t *bs, int *teammates, int maxtea goal = &blueobelisk; } #endif - if (!maxclients) maxclients = trap_Cvar_VariableIntegerValue("sv_maxclients"); diff --git a/engine/code/game/bg_pmove.c b/engine/code/game/bg_pmove.c index 866faca5..8cc6917f 100644 --- a/engine/code/game/bg_pmove.c +++ b/engine/code/game/bg_pmove.c @@ -2059,6 +2059,9 @@ static void PM_Alt_Weapon( void ) { case WP_FLAME_THROWER: ammo_use = 3; break; + default: + ammo_use = 1; + break; } if ( pm->ps->ammo[ pm->ps->weapon ] > ammo_use ) { diff --git a/engine/code/game/g_active.c b/engine/code/game/g_active.c index ead14ca4..9e494080 100644 --- a/engine/code/game/g_active.c +++ b/engine/code/game/g_active.c @@ -20,6 +20,7 @@ along with q3rally; if not, write to the Free Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA =========================================================================== */ +// #include "g_local.h" @@ -375,7 +376,7 @@ void G_TouchTriggers( gentity_t *ent ) { gentity_t *hit; trace_t trace; vec3_t mins, maxs; - vec3_t range = { 40, 40, 52 }; + static vec3_t range = { 40, 40, 52 }; if ( !ent->client ) { return; @@ -788,13 +789,13 @@ void ClientEvents( gentity_t *ent, int oldEventSequence ) { ent->pain_debounce_time = level.time + 200; // no normal pain sound G_Damage (ent, NULL, NULL, NULL, NULL, damage, 0, MOD_FALLING); break; - + case EV_FIRE_WEAPON: FireWeapon( ent ); break; - case EV_ALTFIRE_WEAPON: - FireAltWeapon( ent ); - break; + case EV_ALTFIRE_WEAPON: + FireAltWeapon( ent ); + break; // STONELANCE case EV_FIRE_REARWEAPON: FireRearWeapon( ent ); @@ -850,7 +851,7 @@ void ClientEvents( gentity_t *ent, int oldEventSequence ) { } } #endif - SelectSpawnPoint( ent->client->ps.origin, origin, angles ); + SelectSpawnPoint( ent->client->ps.origin, origin, angles, qfalse ); TeleportPlayer( ent, origin, angles ); break; diff --git a/engine/code/game/g_client.c b/engine/code/game/g_client.c index c5ca8213..785b5f38 100644 --- a/engine/code/game/g_client.c +++ b/engine/code/game/g_client.c @@ -154,7 +154,7 @@ go to a random point that doesn't telefrag ================ */ #define MAX_SPAWN_POINTS 128 -gentity_t *SelectRandomDeathmatchSpawnPoint( void ) { +gentity_t *SelectRandomDeathmatchSpawnPoint(qboolean isbot) { gentity_t *spot; int count; int selection; @@ -163,11 +163,19 @@ gentity_t *SelectRandomDeathmatchSpawnPoint( void ) { count = 0; spot = NULL; - while ((spot = G_Find (spot, FOFS(classname), "info_player_deathmatch")) != NULL) { - if ( SpotWouldTelefrag( spot ) ) { + while((spot = G_Find (spot, FOFS(classname), "info_player_deathmatch")) != NULL && count < MAX_SPAWN_POINTS) + { + if(SpotWouldTelefrag(spot)) + continue; + + if(((spot->flags & FL_NO_BOTS) && isbot) || + ((spot->flags & FL_NO_HUMANS) && !isbot)) + { + // spot is not for this human/bot player continue; } - spots[ count ] = spot; + + spots[count] = spot; count++; } @@ -186,47 +194,65 @@ SelectRandomFurthestSpawnPoint Chooses a player start, deathmatch start, etc ============ */ -gentity_t *SelectRandomFurthestSpawnPoint ( vec3_t avoidPoint, vec3_t origin, vec3_t angles ) { +gentity_t *SelectRandomFurthestSpawnPoint ( vec3_t avoidPoint, vec3_t origin, vec3_t angles, qboolean isbot ) { gentity_t *spot; vec3_t delta; float dist; - float list_dist[64]; - gentity_t *list_spot[64]; + float list_dist[MAX_SPAWN_POINTS]; + gentity_t *list_spot[MAX_SPAWN_POINTS]; int numSpots, rnd, i, j; numSpots = 0; spot = NULL; - while ((spot = G_Find (spot, FOFS(classname), "info_player_deathmatch")) != NULL) { - if ( SpotWouldTelefrag( spot ) ) { + while((spot = G_Find (spot, FOFS(classname), "info_player_deathmatch")) != NULL) + { + if(SpotWouldTelefrag(spot)) + continue; + + if(((spot->flags & FL_NO_BOTS) && isbot) || + ((spot->flags & FL_NO_HUMANS) && !isbot)) + { + // spot is not for this human/bot player continue; } + VectorSubtract( spot->s.origin, avoidPoint, delta ); dist = VectorLength( delta ); - for (i = 0; i < numSpots; i++) { - if ( dist > list_dist[i] ) { - if ( numSpots >= 64 ) - numSpots = 64-1; - for (j = numSpots; j > i; j--) { + + for (i = 0; i < numSpots; i++) + { + if(dist > list_dist[i]) + { + if (numSpots >= MAX_SPAWN_POINTS) + numSpots = MAX_SPAWN_POINTS - 1; + + for(j = numSpots; j > i; j--) + { list_dist[j] = list_dist[j-1]; list_spot[j] = list_spot[j-1]; } + list_dist[i] = dist; list_spot[i] = spot; + numSpots++; - if (numSpots > 64) - numSpots = 64; break; } } - if (i >= numSpots && numSpots < 64) { + + if(i >= numSpots && numSpots < MAX_SPAWN_POINTS) + { list_dist[numSpots] = dist; list_spot[numSpots] = spot; numSpots++; } } - if (!numSpots) { - spot = G_Find( NULL, FOFS(classname), "info_player_deathmatch"); + + if(!numSpots) + { + spot = G_Find(NULL, FOFS(classname), "info_player_deathmatch"); + // STONELANCE // if (!spot) // G_Error( "Couldn't find a spawn point" ); @@ -237,6 +263,7 @@ gentity_t *SelectRandomFurthestSpawnPoint ( vec3_t avoidPoint, vec3_t origin, ve G_Error( "Couldn't find a spawn point" ); } // END + VectorCopy (spot->s.origin, origin); origin[2] += 9; VectorCopy (spot->s.angles, angles); @@ -260,8 +287,8 @@ SelectSpawnPoint Chooses a player start, deathmatch start, etc ============ */ -gentity_t *SelectSpawnPoint ( vec3_t avoidPoint, vec3_t origin, vec3_t angles ) { - return SelectRandomFurthestSpawnPoint( avoidPoint, origin, angles ); +gentity_t *SelectSpawnPoint ( vec3_t avoidPoint, vec3_t origin, vec3_t angles, qboolean isbot ) { + return SelectRandomFurthestSpawnPoint( avoidPoint, origin, angles, isbot ); /* gentity_t *spot; @@ -300,19 +327,25 @@ Try to find a spawn point marked 'initial', otherwise use normal spawn selection. ============ */ -gentity_t *SelectInitialSpawnPoint( vec3_t origin, vec3_t angles ) { +gentity_t *SelectInitialSpawnPoint( vec3_t origin, vec3_t angles, qboolean isbot ) { gentity_t *spot; spot = NULL; - while ((spot = G_Find (spot, FOFS(classname), "info_player_deathmatch")) != NULL) { - if ( spot->spawnflags & 1 ) { - break; + + while ((spot = G_Find (spot, FOFS(classname), "info_player_deathmatch")) != NULL) + { + if(((spot->flags & FL_NO_BOTS) && isbot) || + ((spot->flags & FL_NO_HUMANS) && !isbot)) + { + continue; } + + if((spot->spawnflags & 0x01)) + break; } - if ( !spot || SpotWouldTelefrag( spot ) ) { - return SelectSpawnPoint( vec3_origin, origin, angles ); - } + if (!spot || SpotWouldTelefrag(spot)) + return SelectSpawnPoint(vec3_origin, origin, angles, isbot); VectorCopy (spot->s.origin, origin); origin[2] += 9; @@ -336,7 +369,6 @@ gentity_t *SelectSpectatorSpawnPoint( vec3_t origin, vec3_t angles ) { return NULL; } - /* ======================================================================= @@ -448,7 +480,6 @@ void CopyToBodyQue( gentity_t *ent ) { } } #endif - body->s.powerups = 0; // clear powerups body->s.loopSound = 0; // clear lava burning body->s.number = body - g_entities; @@ -732,12 +763,12 @@ team_t PickTeam( int ignoreClientNum ) { */ int team; - if ( team = LowestTeamCount( ignoreClientNum ) ){ + if ( (team = LowestTeamCount(ignoreClientNum)) ){ return team; } // equal team count, so join the team with the lowest score - if ( team = LowestTeamScore() ){ + if ( (team = LowestTeamScore()) ){ return team; } // END @@ -771,85 +802,63 @@ static void ForceClientSkin( gclient_t *client, char *model, const char *skin ) ClientCheckName ============ */ -static void ClientCleanName( const char *in, char *out, int outSize ) { - int len, colorlessLen; - char ch; - char *p; - int spaces; +static void ClientCleanName(const char *in, char *out, int outSize) +{ + int outpos = 0, colorlessLen = 0, spaces = 0; - //save room for trailing null byte - outSize--; + // discard leading spaces + for(; *in == ' '; in++); + + for(; *in && outpos < outSize - 1; in++) + { + out[outpos] = *in; - len = 0; - colorlessLen = 0; - p = out; - *p = 0; - spaces = 0; - - while( 1 ) { - ch = *in++; - if( !ch ) { - break; + if(*in == ' ') + { + // don't allow too many consecutive spaces + if(spaces > 2) + continue; + + spaces++; } - - // don't allow leading spaces - if( !*p && ch == ' ' ) { - continue; - } - - // check colors - if( ch == Q_COLOR_ESCAPE ) { - // solo trailing carat is not a color prefix - if( !*in ) { - break; - } - - // don't allow black in a name, period + else if(outpos > 0 && out[outpos - 1] == Q_COLOR_ESCAPE) + { + if(Q_IsColorString(&out[outpos - 1])) + { + colorlessLen--; + // STONELANCE /* - if( ColorIndex(*in) == 0 ) { - in++; - continue; - } + if(ColorIndex(*in) == 0) + { + // Disallow color black in names to prevent players + // from getting advantage playing in front of black backgrounds + outpos--; + continue; + } */ // END - - // make sure room in dest for both chars - if( len > outSize - 2 ) { - break; } - - *out++ = ch; - *out++ = *in++; - len += 2; - continue; - } - - // don't allow too many consecutive spaces - if( ch == ' ' ) { - spaces++; - if( spaces > 3 ) { - continue; + else + { + spaces = 0; + colorlessLen++; } } - else { + else + { spaces = 0; + colorlessLen++; } - - if( len > outSize - 1 ) { - break; - } - - *out++ = ch; - colorlessLen++; - len++; + + outpos++; } - *out = 0; + + out[outpos] = '\0'; // don't allow empty names - if( *p == 0 || colorlessLen == 0 ) { - Q_strncpyz( p, "UnnamedPlayer", outSize ); - } + if( *out == '\0' || colorlessLen == 0) + Q_strncpyz(out, "UnnamedPlayer", outSize ); } @@ -986,6 +995,7 @@ void ClientUserinfoChanged( int clientNum ) { // END /* NOTE: all client side now + // team switch( team ) { case TEAM_RED: @@ -1078,16 +1088,19 @@ void ClientUserinfoChanged( int clientNum ) { strcpy(redTeam, Info_ValueForKey( userinfo, "g_redteam" )); strcpy(blueTeam, Info_ValueForKey( userinfo, "g_blueteam" )); // STONELANCE - UPDATE: need to add names for green and yellow teams? - + // send over a subset of the userinfo keys so other clients can // print scoreboards, display models, and play custom sounds - if ( ent->r.svFlags & SVF_BOT ) { + if (ent->r.svFlags & SVF_BOT) + { // STONELANCE - UPDATE: change the userinfo string for bots? s = va("n\\%s\\t\\%i\\model\\%s\\hmodel\\%s\\c1\\%s\\c2\\%s\\hc\\%i\\w\\%i\\l\\%i\\skill\\%s\\tt\\%d\\tl\\%d", client->pers.netname, team, model, headModel, c1, c2, client->pers.maxHealth, client->sess.wins, client->sess.losses, Info_ValueForKey( userinfo, "skill" ), teamTask, teamLeader ); - } else { + } + else + { // STONELANCE s = va("n\\%s\\t\\%i\\model\\%s\\hmodel\\%s\\rim\\%s\\plate\\%s\\g_redteam\\%s\\g_blueteam\\%s\\c1\\%s\\c2\\%s\\hc\\%i\\w\\%i\\l\\%i\\cm\\%i\\ms\\%i\\tt\\%d\\tl\\%d", client->pers.netname, client->sess.sessionTeam, model, headModel, rim, plate, redTeam, blueTeam, c1, c2, @@ -1103,6 +1116,7 @@ void ClientUserinfoChanged( int clientNum ) { trap_SetConfigstring( CS_PLAYERS+clientNum, s ); + // this is not the userinfo, more like the configstring actually G_LogPrintf( "ClientUserinfoChanged: %i %s\n", clientNum, s ); } @@ -1138,14 +1152,20 @@ char *ClientConnect( int clientNum, qboolean firstTime, qboolean isBot ) { trap_GetUserinfo( clientNum, userinfo, sizeof( userinfo ) ); - // check to see if they are on the banned IP list + // IP filtering + // https://zerowing.idsoftware.com/bugzilla/show_bug.cgi?id=500 + // recommanding PB based IP / GUID banning, the builtin system is pretty limited + // check to see if they are on the banned IP list value = Info_ValueForKey (userinfo, "ip"); if ( G_FilterPacket( value ) ) { - return "Banned."; + return "You are banned from this server."; } - // check for a password - if ( !( ent->r.svFlags & SVF_BOT ) ) { + // we don't check password for bots and local client + // NOTE: local client <-> "ip" "localhost" + // this means this client is not running in our current process + if ( !isBot && (strcmp(value, "localhost") != 0)) { + // check for a password value = Info_ValueForKey (userinfo, "password"); if ( g_password.string[0] && Q_stricmp( g_password.string, "none" ) && strcmp( g_password.string, value) != 0) { @@ -1240,6 +1260,7 @@ void ClientBegin( int clientNum ) { int flags; ent = g_entities + clientNum; + client = level.clients + clientNum; // STONELANCE @@ -1302,6 +1323,7 @@ void ClientBegin( int clientNum ) { // send event tent = G_TempEntity( ent->client->ps.origin, EV_PLAYER_TELEPORT_IN ); tent->s.clientNum = ent->s.clientNum; + // STONELANCE /* if ( g_gametype.integer != GT_TOURNAMENT ) { @@ -1350,13 +1372,16 @@ void ClientSpawn(gentity_t *ent) { index = ent - g_entities; client = ent->client; + VectorClear(spawn_origin); + // find a spawn point // do it before setting health back up, so farthest // ranging doesn't count this client // STONELANCE // if ( client->sess.sessionTeam == TEAM_SPECTATOR ) { if ( client->sess.sessionTeam == TEAM_SPECTATOR || isRaceObserver( ent->s.number ) ) { - if ( client->sess.spectatorState == SPECTATOR_OBSERVE ){ + spawnPoint = NULL; + if ( client->sess.spectatorState == SPECTATOR_OBSERVE ) { int clientNum; clientNum = client->sess.spectatorClient; @@ -1368,59 +1393,51 @@ void ClientSpawn(gentity_t *ent) { clientNum = level.follow2; } - if( clientNum > 0 ) - FindBestObserverSpot(ent, &g_entities[clientNum], spawn_origin, spawn_angles); + if( clientNum >= 0) + spawnPoint = FindBestObserverSpot(ent, &g_entities[clientNum], spawn_origin, spawn_angles); } - else + if (!spawnPoint) // END spawnPoint = SelectSpectatorSpawnPoint ( spawn_origin, spawn_angles); - } else if ( (g_gametype.integer >= GT_CTF) ) { + } else if (g_gametype.integer >= GT_CTF ) { // all base oriented team games use the CTF spawn points spawnPoint = SelectCTFSpawnPoint ( client->sess.sessionTeam, client->pers.teamState.state, - spawn_origin, spawn_angles); - } else { - do { - // the first spawn should be at a good looking spot + spawn_origin, spawn_angles, + !!(ent->r.svFlags & SVF_BOT)); + } + else + { // STONELANCE - if (isRallyRace()){ - // respawn at the grid if the race just started to stop people from - // killing themselves inorder to get ahead at the beginning - if ( level.startRaceTime && level.time - level.startRaceTime > 1000 ) - spawnPoint = SelectLastMarkerForSpawn(ent, spawn_origin, spawn_angles); - else - spawnPoint = SelectGridPositionSpawn(ent, spawn_origin, spawn_angles); + if (isRallyRace()) { + // respawn at the grid if the race just started to stop people from + // killing themselves inorder to get ahead at the beginning + if ( level.startRaceTime && level.time - level.startRaceTime > 1000 ) + spawnPoint = SelectLastMarkerForSpawn(ent, spawn_origin, spawn_angles, !!(ent->r.svFlags & SVF_BOT)); + else + spawnPoint = SelectGridPositionSpawn(ent, spawn_origin, spawn_angles, !!(ent->r.svFlags & SVF_BOT)); - if (g_trackReversed.integer && level.trackIsReversable){ - spawn_angles[YAW] += 180; - } - } else + if (g_trackReversed.integer && level.trackIsReversable){ + spawn_angles[YAW] += 180; + } + } else // END - if ( !client->pers.initialSpawn && client->pers.localClient ) { - client->pers.initialSpawn = qtrue; - spawnPoint = SelectInitialSpawnPoint( spawn_origin, spawn_angles ); - } else { - // don't spawn near existing origin if possible - spawnPoint = SelectSpawnPoint ( - client->ps.origin, - spawn_origin, spawn_angles); - } - - // Tim needs to prevent bots from spawning at the initial point - // on q3dm0... - if ( ( spawnPoint->flags & FL_NO_BOTS ) && ( ent->r.svFlags & SVF_BOT ) ) { - continue; // try again - } - // just to be symetric, we have a nohumans option... - if ( ( spawnPoint->flags & FL_NO_HUMANS ) && !( ent->r.svFlags & SVF_BOT ) ) { - continue; // try again - } - - break; - - } while ( 1 ); + // the first spawn should be at a good looking spot + if ( !client->pers.initialSpawn && client->pers.localClient ) + { + client->pers.initialSpawn = qtrue; + spawnPoint = SelectInitialSpawnPoint(spawn_origin, spawn_angles, + !!(ent->r.svFlags & SVF_BOT)); + } + else + { + // don't spawn near existing origin if possible + spawnPoint = SelectSpawnPoint ( + client->ps.origin, + spawn_origin, spawn_angles, !!(ent->r.svFlags & SVF_BOT)); + } } client->pers.teamState.state = TEAM_ACTIVE; @@ -1464,7 +1481,7 @@ void ClientSpawn(gentity_t *ent) { */ // END - memset (client, 0, sizeof(*client)); // bk FIXME: Com_Memset? + Com_Memset (client, 0, sizeof(*client)); client->pers = saved; client->sess = savedSess; diff --git a/engine/code/game/g_cmds.c b/engine/code/game/g_cmds.c index c403ec55..42fa580d 100644 --- a/engine/code/game/g_cmds.c +++ b/engine/code/game/g_cmds.c @@ -1811,7 +1811,7 @@ void Cmd_Stats_f( gentity_t *ent ) { // STONELANCE void Cmd_SaveBPoints_f( gentity_t *other ) { - int i, j; + int i; fileHandle_t f; char buffer[256]; char serverinfo[MAX_INFO_STRING]; diff --git a/engine/code/game/g_combat.c b/engine/code/game/g_combat.c index 872163d8..ab669e15 100644 --- a/engine/code/game/g_combat.c +++ b/engine/code/game/g_combat.c @@ -1414,12 +1414,12 @@ qboolean G_RadiusDamage_NoKnockBack ( vec3_t origin, gentity_t *attacker, float int entityList[MAX_GENTITIES]; int numListedEntities; vec3_t mins, maxs; - vec3_t v; +// vec3_t v; // vec3_t dir; int i, e; qboolean hitClient = qfalse; - vec3_t o; - float minDist; +// vec3_t o; +// float minDist; if ( radius < 1 ) { radius = 1; diff --git a/engine/code/game/g_local.h b/engine/code/game/g_local.h index e391bd1c..41692b19 100644 --- a/engine/code/game/g_local.h +++ b/engine/code/game/g_local.h @@ -606,7 +606,7 @@ void G_AddPredictableEvent( gentity_t *ent, int event, int eventParm ); void G_AddEvent( gentity_t *ent, int event, int eventParm ); void G_SetOrigin( gentity_t *ent, vec3_t origin ); void AddRemap(const char *oldShader, const char *newShader, float timeOffset); -const char *BuildShaderStateConfig(); +const char *BuildShaderStateConfig( void ); // // g_combat.c @@ -614,6 +614,10 @@ const char *BuildShaderStateConfig(); qboolean CanDamage (gentity_t *targ, vec3_t origin); void G_Damage (gentity_t *targ, gentity_t *inflictor, gentity_t *attacker, vec3_t dir, vec3_t point, int damage, int dflags, int mod); qboolean G_RadiusDamage (vec3_t origin, gentity_t *attacker, float damage, float radius, gentity_t *ignore, int mod); +// STONELANCE +qboolean G_RadiusDamage_NoKnockBack ( vec3_t origin, gentity_t *attacker, float damage, float radius, + gentity_t *ignore, int mod); +// END int G_InvulnerabilityEffect( gentity_t *targ, vec3_t dir, vec3_t point, vec3_t impactpoint, vec3_t bouncedir ); void body_die( gentity_t *self, gentity_t *inflictor, gentity_t *attacker, int damage, int meansOfDeath ); void TossClientItems( gentity_t *self ); @@ -709,7 +713,7 @@ team_t TeamCount( int ignoreClientNum, int team ); int TeamLeader( int team ); team_t PickTeam( int ignoreClientNum ); void SetClientViewAngle( gentity_t *ent, vec3_t angle ); -gentity_t *SelectSpawnPoint ( vec3_t avoidPoint, vec3_t origin, vec3_t angles ); +gentity_t *SelectSpawnPoint (vec3_t avoidPoint, vec3_t origin, vec3_t angles, qboolean isbot); void CopyToBodyQue( gentity_t *ent ); void respawn (gentity_t *ent); void BeginIntermission (void); @@ -749,7 +753,7 @@ void G_StartKamikaze( gentity_t *ent ); #define OBSERVERCAM_ZOOM 1 #define OBSERVERCAM_FIXED 2 -qboolean FindBestObserverSpot( gentity_t *self, gentity_t *target, vec3_t spot, vec3_t angles); +gentity_t *FindBestObserverSpot( gentity_t *self, gentity_t *target, vec3_t spot, vec3_t angles); void UpdateObserverSpot( gentity_t *ent, qboolean forceUpdate ); // @@ -782,8 +786,8 @@ void CreateRallyStarter( void ); void CalculatePlayerPositions( void ); void Cmd_RacePositions_f( void ); void Cmd_Times_f( gentity_t *ent ); -gentity_t *SelectLastMarkerForSpawn( gentity_t *ent, vec3_t origin, vec3_t angles ); -gentity_t *SelectGridPositionSpawn( gentity_t *ent, vec3_t origin, vec3_t angles ); +gentity_t *SelectLastMarkerForSpawn( gentity_t *ent, vec3_t origin, vec3_t angles, qboolean isbot ); +gentity_t *SelectGridPositionSpawn( gentity_t *ent, vec3_t origin, vec3_t angles, qboolean isbot ); // // g_rally_rearweapon.c @@ -798,6 +802,8 @@ void CreateBioHazard (gentity_t *owner, vec3_t origin); void CheckForOil(vec3_t origin, float radius); void CreateOilHazard (gentity_t *owner, vec3_t origin); void CreatePoisonHazard (gentity_t *owner, vec3_t origin); +void CreatePoisonCloudHazard (gentity_t *owner, vec3_t origin); +void CreateSmokeHazard (gentity_t *owner, vec3_t origin); // END @@ -840,6 +846,9 @@ void ClientUserinfoChanged( int clientNum ); void ClientDisconnect( int clientNum ); void ClientBegin( int clientNum ); void ClientCommand( int clientNum ); +// STONELANCE +gentity_t *SelectSpectatorSpawnPoint( vec3_t origin, vec3_t angles ); +// END // // g_active.c diff --git a/engine/code/game/g_main.c b/engine/code/game/g_main.c index 24354222..1be8d11b 100644 --- a/engine/code/game/g_main.c +++ b/engine/code/game/g_main.c @@ -1158,7 +1158,7 @@ void FindIntermissionPoint( void ) { // find the intermission spot ent = G_Find (NULL, FOFS(classname), "info_player_intermission"); if ( !ent ) { // the map creator forgot to put in an intermission point... - SelectSpawnPoint ( vec3_origin, level.intermission_origin, level.intermission_angle ); + SelectSpawnPoint ( vec3_origin, level.intermission_origin, level.intermission_angle, qfalse ); } else { VectorCopy (ent->s.origin, level.intermission_origin); // STONELANCE @@ -1229,6 +1229,7 @@ void BeginIntermission( void ) { // send the current scoring to all clients SendScoreboardMessageToAllClients(); + } @@ -1244,6 +1245,8 @@ or moved to a new level based on the "nextmap" cvar void ExitLevel (void) { int i; gclient_t *cl; + char nextmap[MAX_STRING_CHARS]; + char d1[MAX_STRING_CHARS]; //bot interbreeding BotInterbreedEndMatch(); @@ -1265,7 +1268,16 @@ void ExitLevel (void) { */ // END - trap_SendConsoleCommand( EXEC_APPEND, "vstr nextmap\n" ); + trap_Cvar_VariableStringBuffer( "nextmap", nextmap, sizeof(nextmap) ); + trap_Cvar_VariableStringBuffer( "d1", d1, sizeof(d1) ); + + if( !Q_stricmp( nextmap, "map_restart 0" ) && Q_stricmp( d1, "" ) ) { + trap_Cvar_Set( "nextmap", "vstr d2" ); + trap_SendConsoleCommand( EXEC_APPEND, "vstr d1\n" ); + } else { + trap_SendConsoleCommand( EXEC_APPEND, "vstr nextmap\n" ); + } + level.changemap = NULL; level.intermissiontime = 0; @@ -1319,7 +1331,7 @@ void QDECL G_LogPrintf( const char *fmt, ... ) { Com_sprintf( string, sizeof(string), "%3i:%i%i ", min, tens, sec ); va_start( argptr, fmt ); - Q_vsnprintf (string+7, sizeof(string)-7, fmt, argptr); + Q_vsnprintf(string + 7, sizeof(string) - 7, fmt, argptr); va_end( argptr ); if ( g_dedicated.integer ) { @@ -1378,10 +1390,9 @@ Append information about this game to the log file void LogExit( const char *string ) { int i, numSorted; gclient_t *cl; -#ifdef MISSIONPACK // bk001205 +#ifdef MISSIONPACK qboolean won = qtrue; #endif - G_LogPrintf( "Exit: %s\n", string ); level.intermissionQueued = level.time; @@ -1623,7 +1634,6 @@ void CheckExitRules( void ) { } // check for sudden death - if ( ScoreIsTied() ) { // always wait for sudden death return; @@ -1638,8 +1648,8 @@ void CheckExitRules( void ) { } // STONELANCE - if (g_gametype.integer == GT_DERBY && level.startRaceTime && !level.finishRaceTime){ - gclient_t *winner; + if (g_gametype.integer == GT_DERBY && level.startRaceTime && !level.finishRaceTime) { + gclient_t *winner = NULL; for ( i=0, count = 0 ; i< g_maxclients.integer ; i++ ) { cl = level.clients + i; @@ -1652,7 +1662,7 @@ void CheckExitRules( void ) { winner = cl; } - if (count == 1){ + if (winner && count == 1) { level.winnerNumber = winner->ps.clientNum; level.finishRaceTime = level.time; diff --git a/engine/code/game/g_misc.c b/engine/code/game/g_misc.c index 8a6108a6..77f8ba37 100644 --- a/engine/code/game/g_misc.c +++ b/engine/code/game/g_misc.c @@ -764,6 +764,5 @@ void G_BREAKWOOD(gentity_t *ent, vec3_t point, int mod) { tent->s.eventParm = 0; break; } - } - } - \ No newline at end of file + } +} diff --git a/engine/code/game/g_rally_hazard.c b/engine/code/game/g_rally_hazard.c index cd0e31d3..12bc01c8 100644 --- a/engine/code/game/g_rally_hazard.c +++ b/engine/code/game/g_rally_hazard.c @@ -155,7 +155,6 @@ void CreateBioHazard (gentity_t *owner, vec3_t origin){ gentity_t *ent; gentity_t *other; vec3_t dist; - vec3_t snapped; int highest; other = NULL; @@ -355,7 +354,7 @@ CreatePoisonCloudHazard ============ */ -void CreatePoisonCloudHazard (gentity_t *owner, vec3_t origin){ +void CreatePoisonCloudHazard (gentity_t *owner, vec3_t origin) { gentity_t *ent; ent = G_TempEntity( origin, EV_HAZARD ); @@ -374,7 +373,7 @@ CreateSmokeHazard ============ */ -void CreateSmokeHazard (gentity_t *owner, vec3_t origin){ +void CreateSmokeHazard (gentity_t *owner, vec3_t origin) { gentity_t *ent; ent = G_TempEntity( origin, EV_HAZARD ); diff --git a/engine/code/game/g_rally_mapents.c b/engine/code/game/g_rally_mapents.c index b0242d95..d4505fcf 100644 --- a/engine/code/game/g_rally_mapents.c +++ b/engine/code/game/g_rally_mapents.c @@ -91,6 +91,7 @@ void Touch_StartFinish (gentity_t *self, gentity_t *other, trace_t *trace ){ place = "eighth"; break; default: + place = NULL; Com_Printf( "Unknown placing: %i\n", other->client->ps.stats[STAT_POSITION] ); break; } @@ -181,7 +182,7 @@ void SP_rally_startfinish( gentity_t *ent ) { if (!g_laplimit.integer){ level.numberOfLaps = ent->laps; - trap_Cvar_Set( "laplimit", va("%s", level.numberOfLaps) ); + trap_Cvar_Set( "laplimit", va("%d", level.numberOfLaps) ); } else level.numberOfLaps = g_laplimit.integer; diff --git a/engine/code/game/g_rally_observer_cams.c b/engine/code/game/g_rally_observer_cams.c index 20e4db36..ccc5a100 100644 --- a/engine/code/game/g_rally_observer_cams.c +++ b/engine/code/game/g_rally_observer_cams.c @@ -34,16 +34,16 @@ void SP_info_observer_spot( gentity_t *ent ){ } -qboolean FindBestObserverSpot( gentity_t *self, gentity_t *target, vec3_t spot, vec3_t angles){ +gentity_t *FindBestObserverSpot( gentity_t *self, gentity_t *target, vec3_t spot, vec3_t angles){ gentity_t *ent; trace_t tr; vec3_t delta; static vec3_t mins = { -4, -4, -4 }; static vec3_t maxs = { 4, 4, 4 }; float dist, bestDist; - qboolean foundSpot; + gentity_t *foundSpot; - foundSpot = qfalse; + foundSpot = NULL; dist = 0; bestDist = 0; ent = NULL; @@ -53,7 +53,7 @@ qboolean FindBestObserverSpot( gentity_t *self, gentity_t *target, vec3_t spot, // Com_Printf("Found an observer spot in PVS\n"); // VectorCopy(ent->s.origin, spot); -// foundSpot = qtrue; +// foundSpot = ent; // return foundSpot; trap_Trace(&tr, ent->r.currentOrigin, mins, maxs, target->client->ps.origin, target->s.number, CONTENTS_SOLID); @@ -77,7 +77,7 @@ qboolean FindBestObserverSpot( gentity_t *self, gentity_t *target, vec3_t spot, self->spotflags = ent->spawnflags; // use this one - return qtrue; + return ent; } } @@ -89,7 +89,7 @@ qboolean FindBestObserverSpot( gentity_t *self, gentity_t *target, vec3_t spot, // Com_Printf("Found a valid observer spot\n"); self->spotflags = ent->spawnflags; - foundSpot = qtrue; + foundSpot = ent; } } diff --git a/engine/code/game/g_rally_racetools.c b/engine/code/game/g_rally_racetools.c index 00947d54..19b2953d 100644 --- a/engine/code/game/g_rally_racetools.c +++ b/engine/code/game/g_rally_racetools.c @@ -265,8 +265,7 @@ void CalculatePlayerPositions( void ) } positionChanged = qfalse; - leader = NULL; - ent = NULL; + leader = ent = last = NULL; while ( (ent = G_Find (ent, FOFS(classname), "player")) != NULL ) { if ( ent->client->sess.sessionTeam == TEAM_SPECTATOR ) continue; @@ -307,7 +306,9 @@ void CalculatePlayerPositions( void ) { // cur->carBehind = NULL; ent->carBehind = cur; - last->carBehind = ent; + if (last) { + last->carBehind = ent; + } } else { cur->carBehind = ent; @@ -481,7 +482,7 @@ SelectLastMarkerForSpawn ============ */ -gentity_t *SelectLastMarkerForSpawn( gentity_t *ent, vec3_t origin, vec3_t angles ) { +gentity_t *SelectLastMarkerForSpawn( gentity_t *ent, vec3_t origin, vec3_t angles, qboolean isbot ) { gentity_t *spot; int lastMarker; @@ -498,7 +499,7 @@ gentity_t *SelectLastMarkerForSpawn( gentity_t *ent, vec3_t origin, vec3_t angle } if ( !spot ) { - return SelectSpawnPoint( vec3_origin, origin, angles ); + return SelectSpawnPoint( vec3_origin, origin, angles, isbot ); } // spawn at last checkpoint @@ -516,7 +517,7 @@ SelectGridPositionSpawn ============ */ -gentity_t *SelectGridPositionSpawn( gentity_t *ent, vec3_t origin, vec3_t angles ) { +gentity_t *SelectGridPositionSpawn( gentity_t *ent, vec3_t origin, vec3_t angles, qboolean isbot ) { gentity_t *spot; int gridPosition; @@ -535,7 +536,7 @@ gentity_t *SelectGridPositionSpawn( gentity_t *ent, vec3_t origin, vec3_t angles if ( !spot || SpotWouldTelefrag( spot ) ) { // FIXME: put into spectator mode instead? G_Printf("Warning: No info_player_start found for race spawn, trying info_player_deathmatch\n"); - return SelectSpawnPoint( vec3_origin, origin, angles ); + return SelectSpawnPoint( vec3_origin, origin, angles, isbot ); } VectorCopy (spot->s.origin, origin); diff --git a/engine/code/game/g_rally_scripted_objects.c b/engine/code/game/g_rally_scripted_objects.c index 5ef216e9..a5283cdb 100644 --- a/engine/code/game/g_rally_scripted_objects.c +++ b/engine/code/game/g_rally_scripted_objects.c @@ -75,8 +75,8 @@ qboolean G_ParseScriptedObject( gentity_t *ent ){ char *token; char text[MAX_SCRIPT_TEXT]; char filename[MAX_QPATH]; - char model[MAX_QPATH]; - char deadmodel[MAX_QPATH]; +// char model[MAX_QPATH]; +// char deadmodel[MAX_QPATH]; fileHandle_t f; // setup defaults @@ -298,9 +298,8 @@ qboolean G_ScriptedObject_ApplyCollision( gentity_t *self, vec3_t at, vec3_t nor vec3_t arm; vec3_t vP1; vec3_t impulse, impulseMoment; - vec3_t delta, cross, cross2; + vec3_t cross, cross2; float impulseNum, oppositeImpulseNum, impulseDen, dot; - int i; // temp for inverseWorldInertiaTensor vec3_t axis[3]; diff --git a/engine/code/game/g_rally_tools.c b/engine/code/game/g_rally_tools.c index 2046793f..ab31e437 100644 --- a/engine/code/game/g_rally_tools.c +++ b/engine/code/game/g_rally_tools.c @@ -101,7 +101,7 @@ G_ResetCar ================= */ void G_ResetCar( gentity_t *ent ) { - int i; +// int i; vec3_t origin, end, angles; vec3_t mins, maxs; trace_t tr; diff --git a/engine/code/game/g_team.c b/engine/code/game/g_team.c index 30f60469..31e0a01d 100644 --- a/engine/code/game/g_team.c +++ b/engine/code/game/g_team.c @@ -35,7 +35,6 @@ typedef struct teamgame_s { int blueTakenTime; int redObeliskAttackedTime; int blueObeliskAttackedTime; - } teamgame_t; teamgame_t teamgame; @@ -44,18 +43,16 @@ gentity_t *neutralObelisk; void Team_SetFlagStatus( int team, flagStatus_t status ); - void Team_InitGame( void ) { memset(&teamgame, 0, sizeof teamgame); switch( g_gametype.integer ) { case GT_CTF: - teamgame.redStatus = teamgame.blueStatus = -1; // Invalid to force update + teamgame.redStatus = -1; // Invalid to force update Team_SetFlagStatus( TEAM_RED, FLAG_ATBASE ); + teamgame.blueStatus = -1; // Invalid to force update Team_SetFlagStatus( TEAM_BLUE, FLAG_ATBASE ); break; - - #ifdef MISSIONPACK case GT_1FCTF: teamgame.flagStatus = -1; // Invalid to force update @@ -209,8 +206,6 @@ qboolean OnSameTeam( gentity_t *ent1, gentity_t *ent2 ) { static char ctfFlagStatusRemap[] = { '0', '1', '*', '*', '2' }; static char oneFlagStatusRemap[] = { '0', '1', '2', '3', '4' }; - - void Team_SetFlagStatus( int team, flagStatus_t status ) { qboolean modified = qfalse; @@ -1053,13 +1048,13 @@ SelectCTFSpawnPoint ============ */ -gentity_t *SelectCTFSpawnPoint ( team_t team, int teamstate, vec3_t origin, vec3_t angles ) { +gentity_t *SelectCTFSpawnPoint ( team_t team, int teamstate, vec3_t origin, vec3_t angles, qboolean isbot ) { gentity_t *spot; spot = SelectRandomTeamSpawnPoint ( teamstate, team ); if (!spot) { - return SelectSpawnPoint( vec3_origin, origin, angles ); + return SelectSpawnPoint( vec3_origin, origin, angles, isbot ); } VectorCopy (spot->s.origin, origin); @@ -1132,7 +1127,7 @@ void TeamplayInfoMessage( gentity_t *ent ) { i, player->client->pers.teamState.location, h, a, player->client->ps.weapon, player->s.powerups); j = strlen(entry); - if (stringlength + j > sizeof(string)) + if (stringlength + j >= sizeof(string)) break; strcpy (string + stringlength, entry); stringlength += j; @@ -1516,4 +1511,3 @@ qboolean CheckObeliskAttack( gentity_t *obelisk, gentity_t *attacker ) { return qfalse; } #endif - diff --git a/engine/code/game/g_team.h b/engine/code/game/g_team.h index 3da86513..af06fd9a 100644 --- a/engine/code/game/g_team.h +++ b/engine/code/game/g_team.h @@ -80,12 +80,10 @@ void Team_CheckHurtCarrier(gentity_t *targ, gentity_t *attacker); void Team_InitGame(void); void Team_ReturnFlag(int team); void Team_FreeEntity(gentity_t *ent); -gentity_t *SelectCTFSpawnPoint ( team_t team, int teamstate, vec3_t origin, vec3_t angles ); +gentity_t *SelectCTFSpawnPoint ( team_t team, int teamstate, vec3_t origin, vec3_t angles, qboolean isbot ); gentity_t *Team_GetLocation(gentity_t *ent); qboolean Team_GetLocationMsg(gentity_t *ent, char *loc, int loclen); void TeamplayInfoMessage( gentity_t *ent ); void CheckTeamStatus(void); int Pickup_Team( gentity_t *ent, gentity_t *other ); - - diff --git a/engine/code/game/g_weapon.c b/engine/code/game/g_weapon.c index 83f226a5..44b8106f 100644 --- a/engine/code/game/g_weapon.c +++ b/engine/code/game/g_weapon.c @@ -560,7 +560,8 @@ plasma circles around player similar to AltFire Mod */ void Weapon_Plasmagun_Circular_Fire (gentity_t *ent) { - gentity_t *m, *n; + gentity_t *m; +// gentity_t *n; vec3_t temp, temp2; //forward[0] += (float)sin( m->s.pos.trTime / m->s.pos.trDuration );