commit b97124d390630e6f0895a16c6585e969a5a68258 Author: devhc Date: Sun Jun 12 08:54:28 2011 +0200 REFACTOR [a living player is alive] diff --git a/ChangeLog b/ChangeLog index 9518bd1..8f28b08 100644 --- a/ChangeLog +++ b/ChangeLog @@ -151,7 +151,7 @@ box displayed * Fixed "Server command overflow" bug for clients that should time out - * Fixed a bug where only live clients would have their scores logged + * Fixed a bug where only clients alive would have their scores logged at the end of the game * Reworked how weapon changes are performed, fixing bugs in the process diff --git a/src/cgame/cg_local.h b/src/cgame/cg_local.h index 574e5ac..a8b54a1 100644 --- a/src/cgame/cg_local.h +++ b/src/cgame/cg_local.h @@ -2075,6 +2075,6 @@ typedef enum DT_INTERACTIVE, // team, class, armoury DT_ARMOURYEVOLVE, // Insufficient funds et al DT_BUILD, // build errors - DT_COMMAND, // You must be living/human/spec etc. + DT_COMMAND, // You must be alive/human/spec/etc. } dialogType_t; diff --git a/src/cgame/cg_players.c b/src/cgame/cg_players.c index 1118cc5..b4780c2 100644 --- a/src/cgame/cg_players.c +++ b/src/cgame/cg_players.c @@ -2160,7 +2160,7 @@ void CG_Corpse( centity_t *cent ) int renderfx; qboolean shadow = qfalse; float shadowPlane; - vec3_t origin, liveZ, deadZ; + vec3_t origin, aliveZ, deadZ; float scale; corpseNum = CG_GetCorpseNum( es->clientNum ); @@ -2180,8 +2180,8 @@ void CG_Corpse( centity_t *cent ) memset( &head, 0, sizeof( head ) ); VectorCopy( cent->lerpOrigin, origin ); - BG_ClassBoundingBox( es->clientNum, liveZ, NULL, NULL, deadZ, NULL ); - origin[ 2 ] -= ( liveZ[ 2 ] - deadZ[ 2 ] ); + BG_ClassBoundingBox( es->clientNum, aliveZ, NULL, NULL, deadZ, NULL ); + origin[ 2 ] -= ( aliveZ[ 2 ] - deadZ[ 2 ] ); VectorCopy( es->angles, cent->lerpAngles ); diff --git a/src/cgame/cg_servercmds.c b/src/cgame/cg_servercmds.c index d95363d..9c04d6d 100644 --- a/src/cgame/cg_servercmds.c +++ b/src/cgame/cg_servercmds.c @@ -563,9 +563,9 @@ void CG_Menu( int menu, int arg ) type = DT_COMMAND; break; - case MN_CMD_LIVING: - //longMsg = "You must be living to perform this action."; - shortMsg = "Must be living to use this command"; + case MN_CMD_ALIVE: + //longMsg = "You must be alive to perform this action."; + shortMsg = "Must be alive to use this command"; type = DT_COMMAND; break; diff --git a/src/game/bg_misc.c b/src/game/bg_misc.c index 8c945cc..7c6d839 100644 --- a/src/game/bg_misc.c +++ b/src/game/bg_misc.c @@ -2763,7 +2763,7 @@ char *eventnames[ ] = "EV_DEATH3", "EV_OBITUARY", - "EV_GIB_PLAYER", // gib a previously living player + "EV_GIB_PLAYER", "EV_BUILD_CONSTRUCT", "EV_BUILD_DESTROY", diff --git a/src/game/bg_pmove.c b/src/game/bg_pmove.c index b26a488..e841007 100644 --- a/src/game/bg_pmove.c +++ b/src/game/bg_pmove.c @@ -1778,12 +1778,12 @@ static void PM_CrashLand( void ) if( delta > AVG_FALL_DISTANCE ) { - if( PM_Live( pm->ps->pm_type ) ) + if( PM_Alive( pm->ps->pm_type ) ) PM_AddEvent( EV_FALL_FAR ); } else if( delta > MIN_FALL_DISTANCE ) { - if( PM_Live( pm->ps->pm_type ) ) + if( PM_Alive( pm->ps->pm_type ) ) PM_AddEvent( EV_FALL_MEDIUM ); } else diff --git a/src/game/bg_public.h b/src/game/bg_public.h index 6bdef99..da2b24b 100644 --- a/src/game/bg_public.h +++ b/src/game/bg_public.h @@ -117,7 +117,7 @@ typedef enum PM_NOCLIP, // noclip movement PM_SPECTATOR, // still run into walls PM_JETPACK, // jetpack physics - PM_GRABBED, // like dead, but for when the player is still live + PM_GRABBED, // like dead, but for when the player is still alive PM_DEAD, // no acceleration or turning, but free falling PM_FREEZE, // stuck in place with no control PM_INTERMISSION // no movement or status bar @@ -126,7 +126,7 @@ typedef enum // pmtype_t categories #define PM_Paralyzed( x ) ( (x) == PM_DEAD || (x) == PM_FREEZE ||\ (x) == PM_INTERMISSION ) -#define PM_Live( x ) ( (x) == PM_NORMAL || (x) == PM_JETPACK ||\ +#define PM_Alive( x ) ( (x) == PM_NORMAL || (x) == PM_JETPACK ||\ (x) == PM_GRABBED ) typedef enum @@ -515,7 +515,7 @@ typedef enum EV_DEATH3, EV_OBITUARY, - EV_GIB_PLAYER, // gib a previously living player + EV_GIB_PLAYER, EV_BUILD_CONSTRUCT, EV_BUILD_DESTROY, @@ -566,7 +566,7 @@ typedef enum MN_CMD_SPEC, MN_CMD_ALIEN, MN_CMD_HUMAN, - MN_CMD_LIVING, + MN_CMD_ALIVE, //alien stuff MN_A_CLASS, diff --git a/src/game/g_active.c b/src/game/g_active.c index 2620ac9..2b03f6d 100644 --- a/src/game/g_active.c +++ b/src/game/g_active.c @@ -40,7 +40,7 @@ void P_DamageFeedback( gentity_t *player ) vec3_t angles; client = player->client; - if( !PM_Live( client->ps.pm_type ) ) + if( !PM_Alive( client->ps.pm_type ) ) return; // total points of damage shot at the player this frame @@ -743,9 +743,9 @@ void ClientTimerActions( gentity_t *ent, int msec ) else client->voiceEnthusiasm = 0.0f; - client->pers.aliveSeconds++; + client->pers.secondsAlive++; if( g_freeFundPeriod.integer > 0 && - client->pers.aliveSeconds % g_freeFundPeriod.integer == 0 ) + client->pers.secondsAlive % g_freeFundPeriod.integer == 0 ) { // Give clients some credit periodically if( G_TimeTilSuddenDeath( ) > 0 ) diff --git a/src/game/g_buildable.c b/src/game/g_buildable.c index 2d870c7..e8528c8 100644 --- a/src/game/g_buildable.c +++ b/src/game/g_buildable.c @@ -2072,7 +2072,7 @@ void HMedistat_Think( gentity_t *self ) if( self->enemy == player && player->client && player->client->ps.stats[ STAT_TEAM ] == TEAM_HUMANS && player->health < player->client->ps.stats[ STAT_MAX_HEALTH ] && - PM_Live( player->client->ps.pm_type ) ) + PM_Alive( player->client->ps.pm_type ) ) { occupied = qtrue; player->client->ps.stats[ STAT_STATE ] |= SS_HEALING_ACTIVE; @@ -2095,7 +2095,7 @@ void HMedistat_Think( gentity_t *self ) { if( ( player->health < player->client->ps.stats[ STAT_MAX_HEALTH ] || player->client->ps.stats[ STAT_STAMINA ] < STAMINA_MAX ) && - PM_Live( player->client->ps.pm_type ) ) + PM_Alive( player->client->ps.pm_type ) ) { self->enemy = player; diff --git a/src/game/g_cmds.c b/src/game/g_cmds.c index 7db1a28..d89ea05 100644 --- a/src/game/g_cmds.c +++ b/src/game/g_cmds.c @@ -600,7 +600,7 @@ void Cmd_Team_f( gentity_t *ent ) // stop switching teams for gameplay exploit reasons by enforcing a long // wait before they can come back - if( !force && !g_cheats.integer && ent->client->pers.aliveSeconds && + if( !force && !g_cheats.integer && ent->client->pers.secondsAlive && level.time - ent->client->pers.teamChangeTime < 30000 ) { trap_SendServerCommand( ent-g_entities, @@ -3104,35 +3104,35 @@ int G_FloodLimited( gentity_t *ent ) commands_t cmds[ ] = { { "a", CMD_MESSAGE|CMD_INTERMISSION, Cmd_AdminMessage_f }, - { "build", CMD_TEAM|CMD_LIVING, Cmd_Build_f }, - { "buy", CMD_HUMAN|CMD_LIVING, Cmd_Buy_f }, + { "build", CMD_TEAM|CMD_ALIVE, Cmd_Build_f }, + { "buy", CMD_HUMAN|CMD_ALIVE, Cmd_Buy_f }, { "callteamvote", CMD_MESSAGE|CMD_TEAM, Cmd_CallVote_f }, { "callvote", CMD_MESSAGE, Cmd_CallVote_f }, { "class", CMD_TEAM, Cmd_Class_f }, - { "damage", CMD_CHEAT|CMD_LIVING, Cmd_Damage_f }, - { "deconstruct", CMD_TEAM|CMD_LIVING, Cmd_Destroy_f }, - { "destroy", CMD_CHEAT|CMD_TEAM|CMD_LIVING, Cmd_Destroy_f }, + { "damage", CMD_CHEAT|CMD_ALIVE, Cmd_Damage_f }, + { "deconstruct", CMD_TEAM|CMD_ALIVE, Cmd_Destroy_f }, + { "destroy", CMD_CHEAT|CMD_TEAM|CMD_ALIVE, Cmd_Destroy_f }, { "follow", CMD_SPEC, Cmd_Follow_f }, { "follownext", CMD_SPEC, Cmd_FollowCycle_f }, { "followprev", CMD_SPEC, Cmd_FollowCycle_f }, - { "give", CMD_CHEAT|CMD_TEAM|CMD_LIVING, Cmd_Give_f }, - { "god", CMD_CHEAT|CMD_TEAM|CMD_LIVING, Cmd_God_f }, + { "give", CMD_CHEAT|CMD_TEAM|CMD_ALIVE, Cmd_Give_f }, + { "god", CMD_CHEAT|CMD_TEAM|CMD_ALIVE, Cmd_God_f }, { "ignore", 0, Cmd_Ignore_f }, - { "itemact", CMD_HUMAN|CMD_LIVING, Cmd_ActivateItem_f }, - { "itemdeact", CMD_HUMAN|CMD_LIVING, Cmd_DeActivateItem_f }, - { "itemtoggle", CMD_HUMAN|CMD_LIVING, Cmd_ToggleItem_f }, - { "kill", CMD_TEAM|CMD_LIVING, Cmd_Kill_f }, + { "itemact", CMD_HUMAN|CMD_ALIVE, Cmd_ActivateItem_f }, + { "itemdeact", CMD_HUMAN|CMD_ALIVE, Cmd_DeActivateItem_f }, + { "itemtoggle", CMD_HUMAN|CMD_ALIVE, Cmd_ToggleItem_f }, + { "kill", CMD_TEAM|CMD_ALIVE, Cmd_Kill_f }, { "listmaps", CMD_MESSAGE|CMD_INTERMISSION, Cmd_ListMaps_f }, { "m", CMD_MESSAGE|CMD_INTERMISSION, Cmd_PrivateMessage_f }, { "mt", CMD_MESSAGE|CMD_INTERMISSION, Cmd_PrivateMessage_f }, { "noclip", CMD_CHEAT_TEAM, Cmd_Noclip_f }, - { "notarget", CMD_CHEAT|CMD_TEAM|CMD_LIVING, Cmd_Notarget_f }, - { "reload", CMD_HUMAN|CMD_LIVING, Cmd_Reload_f }, + { "notarget", CMD_CHEAT|CMD_TEAM|CMD_ALIVE, Cmd_Notarget_f }, + { "reload", CMD_HUMAN|CMD_ALIVE, Cmd_Reload_f }, { "say", CMD_MESSAGE|CMD_INTERMISSION, Cmd_Say_f }, - { "say_area", CMD_MESSAGE|CMD_TEAM|CMD_LIVING, Cmd_SayArea_f }, + { "say_area", CMD_MESSAGE|CMD_TEAM|CMD_ALIVE, Cmd_SayArea_f }, { "say_team", CMD_MESSAGE|CMD_INTERMISSION, Cmd_Say_f }, { "score", CMD_INTERMISSION, ScoreboardMessage }, - { "sell", CMD_HUMAN|CMD_LIVING, Cmd_Sell_f }, + { "sell", CMD_HUMAN|CMD_ALIVE, Cmd_Sell_f }, { "setviewpos", CMD_CHEAT_TEAM, Cmd_SetViewpos_f }, { "team", 0, Cmd_Team_f }, { "teamvote", CMD_TEAM, Cmd_Vote_f }, @@ -3224,11 +3224,11 @@ void ClientCommand( int clientNum ) return; } - if( command->cmdFlags & CMD_LIVING && + if( command->cmdFlags & CMD_ALIVE && ( ent->client->ps.stats[ STAT_HEALTH ] <= 0 || ent->client->sess.spectatorState != SPECTATOR_NOT ) ) { - G_TriggerMenu( clientNum, MN_CMD_LIVING ); + G_TriggerMenu( clientNum, MN_CMD_ALIVE ); return; } diff --git a/src/game/g_local.h b/src/game/g_local.h index fd5f3af..d5af8e2 100644 --- a/src/game/g_local.h +++ b/src/game/g_local.h @@ -313,7 +313,7 @@ typedef struct namelog_t *namelog; g_admin_admin_t *admin; - int aliveSeconds; // time player has been alive in seconds + int secondsAlive; // time player has been alive in seconds qboolean hasHealed; // has healed a player (basi regen aura) in the last 10sec (for score use) // used to save persistant[] values while in SPECTATOR_FOLLOW mode @@ -607,8 +607,8 @@ typedef struct float averageNumHumanClients; int numHumanSamples; - int numLiveAlienClients; - int numLiveHumanClients; + int numAlienClientsAlive; + int numHumanClientsAlive; int alienBuildPoints; int alienBuildPointQueue; @@ -677,7 +677,7 @@ typedef struct #define CMD_SPEC 0x0010 // must be a spectator #define CMD_ALIEN 0x0020 #define CMD_HUMAN 0x0040 -#define CMD_LIVING 0x0080 +#define CMD_ALIVE 0x0080 #define CMD_INTERMISSION 0x0100 // valid during intermission typedef struct diff --git a/src/game/g_main.c b/src/game/g_main.c index 68ec689..5e7ffcd 100644 --- a/src/game/g_main.c +++ b/src/game/g_main.c @@ -1433,8 +1433,8 @@ void CalculateRanks( void ) memset( level.numVotingClients, 0, sizeof( level.numVotingClients ) ); level.numAlienClients = 0; level.numHumanClients = 0; - level.numLiveAlienClients = 0; - level.numLiveHumanClients = 0; + level.numAlienClientsAlive = 0; + level.numHumanClientsAlive = 0; for( i = 0; i < level.maxclients; i++ ) { @@ -1457,19 +1457,19 @@ void CalculateRanks( void ) { level.numAlienClients++; if( level.clients[ i ].sess.spectatorState == SPECTATOR_NOT ) - level.numLiveAlienClients++; + level.numAlienClientsAlive++; } else if( level.clients[ i ].pers.teamSelection == TEAM_HUMANS ) { level.numHumanClients++; if( level.clients[ i ].sess.spectatorState == SPECTATOR_NOT ) - level.numLiveHumanClients++; + level.numHumanClientsAlive++; } } } } - level.numNonSpectatorClients = level.numLiveAlienClients + - level.numLiveHumanClients; + level.numNonSpectatorClients = level.numAlienClientsAlive + + level.numHumanClientsAlive; level.numVotingClients[ TEAM_ALIENS ] = level.numAlienClients; level.numVotingClients[ TEAM_HUMANS ] = level.numHumanClients; P[ i ] = '\0'; @@ -2057,7 +2057,7 @@ void CheckExitRules( void ) if( level.uncondHumanWin || ( ( level.time > level.startTime + 1000 ) && ( level.numAlienSpawns == 0 ) && - ( level.numLiveAlienClients == 0 ) ) ) + ( level.numAlienClientsAlive == 0 ) ) ) { //humans win level.lastWin = TEAM_HUMANS; @@ -2068,7 +2068,7 @@ void CheckExitRules( void ) else if( level.uncondAlienWin || ( ( level.time > level.startTime + 1000 ) && ( level.numHumanSpawns == 0 ) && - ( level.numLiveHumanClients == 0 ) ) ) + ( level.numHumanClientsAlive == 0 ) ) ) { //aliens win level.lastWin = TEAM_ALIENS; diff --git a/src/game/g_mover.c b/src/game/g_mover.c index 255f4b0..15b28ec 100644 --- a/src/game/g_mover.c +++ b/src/game/g_mover.c @@ -1744,7 +1744,7 @@ PLAT ============== Touch_Plat -Don't allow decent if a living player is on it +Don't allow to descend if a player is on it and is alive =============== */ void Touch_Plat( gentity_t *ent, gentity_t *other, trace_t *trace )