From 5cd5bc632499b503e0552345839c74236ef04856 Mon Sep 17 00:00:00 2001 From: Tim Angus Date: Sun, 23 Sep 2007 16:22:20 +0000 Subject: * (bug 2756) s/damage/dmg/ * (bug 2717) Move respawning for ClientThink to ClientEndFrame * Remove redundant cvar g_forcerespawn --- misc/entities.def | 2 +- src/game/g_active.c | 41 +++++++++++++---------------------------- src/game/g_local.h | 3 +-- src/game/g_main.c | 2 -- 4 files changed, 15 insertions(+), 33 deletions(-) diff --git a/misc/entities.def b/misc/entities.def index e4aeacb3..e61ce16c 100644 --- a/misc/entities.def +++ b/misc/entities.def @@ -1022,7 +1022,7 @@ TARGET_* ENTITIES When triggered, this hurts the entity that caused the trigger. -------- KEYS -------- -damage: amount of damage to deal (default: 5) +dmg: amount of damage to deal (default: 5) */ /*QUAKED target_rumble (1 0 0) (-8 -8 -8) (8 8 8) diff --git a/src/game/g_active.c b/src/game/g_active.c index 7ba6bd88..d8d7a3d8 100644 --- a/src/game/g_active.c +++ b/src/game/g_active.c @@ -1208,7 +1208,7 @@ void G_UnlaggedOn( vec3_t muzzle, float range ) the current time, but only updates other player's positions up to the postition sent in the most recent snapshot. - This allows player X to essentially "move through" the position of player Y + This allows player X to essentially "move through" the position of player Y when player X's cmd is processed with Pmove() on the server. This is because player Y was clipping player X's Pmove() on his client, but when the same cmd is processed with Pmove on the server it is not clipped. @@ -1251,7 +1251,7 @@ static void G_UnlaggedDetectCollisions( gentity_t *ent ) trap_Trace(&tr, ent->client->oldOrigin, ent->r.mins, ent->r.maxs, ent->client->ps.origin, ent->s.number, MASK_PLAYERSOLID ); if( tr.entityNum >= 0 && tr.entityNum < MAX_CLIENTS ) - g_entities[ tr.entityNum ].client->unlaggedCalc.used = qfalse; + g_entities[ tr.entityNum ].client->unlaggedCalc.used = qfalse; G_UnlaggedOff( ); } @@ -1345,7 +1345,7 @@ void ClientThink_real( gentity_t *ent ) if( !ClientInactivityTimer( client ) ) return; - // calculate where ent is currently seeing all the other active clients + // calculate where ent is currently seeing all the other active clients G_UnlaggedCalc( ent->client->unlaggedTime, ent ); if( client->noclip ) @@ -1550,7 +1550,7 @@ void ClientThink_real( gentity_t *ent ) // touch other objects ClientImpacts( ent, &pm ); - + // execute client events ClientEvents( ent, oldEventSequence ); @@ -1565,6 +1565,10 @@ void ClientThink_real( gentity_t *ent ) if( ent->client->ps.eventSequence != oldEventSequence ) ent->eventTime = level.time; + // Don't think anymore if dead + if( client->ps.stats[ STAT_HEALTH ] <= 0 ) + return; + // swap and latch button actions client->oldbuttons = client->buttons; client->buttons = ucmd->buttons; @@ -1656,29 +1660,6 @@ void ClientThink_real( gentity_t *ent ) } } - // check for respawning - if( client->ps.stats[ STAT_HEALTH ] <= 0 ) - { - // wait for the attack button to be pressed - if( level.time > client->respawnTime ) - { - // forcerespawn is to prevent users from waiting out powerups - if( g_forcerespawn.integer > 0 && - ( level.time - client->respawnTime ) > 0 ) - { - respawn( ent ); - return; - } - - // pressing attack or use is the normal respawn method - if( ucmd->buttons & ( BUTTON_ATTACK | BUTTON_USE_HOLDABLE ) ) - { - respawn( ent ); - } - } - return; - } - if( level.framenum > client->retriggerArmouryMenu && client->retriggerArmouryMenu ) { G_TriggerMenu( client->ps.clientNum, MN_H_ARMOURY ); @@ -1703,7 +1684,7 @@ void ClientThink_real( gentity_t *ent ) // perform once-a-second actions ClientTimerActions( ent, msec ); - + if( ent->suicideTime > 0 && ent->suicideTime < level.time ) { ent->flags &= ~FL_GODMODE; @@ -1821,6 +1802,10 @@ void ClientEndFrame( gentity_t *ent ) ent->client->ps.stats[ STAT_HEALTH ] = ent->health; // FIXME: get rid of ent->health... + // respawn if dead + if( ent->client->ps.stats[ STAT_HEALTH ] <= 0 && level.time >= ent->client->respawnTime ) + respawn( ent ); + G_SetClientSound( ent ); // set the latest infor diff --git a/src/game/g_local.h b/src/game/g_local.h index c806086c..59e39eec 100644 --- a/src/game/g_local.h +++ b/src/game/g_local.h @@ -408,7 +408,7 @@ struct gclient_s int lasthurt_mod; // type of damage the client did // timers - int respawnTime; // can respawn when time > this, force after g_forcerespwan + int respawnTime; // can respawn when time > this int inactivityTime; // kick players when time > this qboolean inactivityWarning;// qtrue if the five seoond warning has been given int rewardTime; // clear the EF_AWARD_IMPRESSIVE, etc when time > this @@ -1122,7 +1122,6 @@ extern vmCvar_t g_gravity; extern vmCvar_t g_speed; extern vmCvar_t g_knockback; extern vmCvar_t g_quadfactor; -extern vmCvar_t g_forcerespawn; extern vmCvar_t g_inactivity; extern vmCvar_t g_debugMove; extern vmCvar_t g_debugAlloc; diff --git a/src/game/g_main.c b/src/game/g_main.c index 17245fc9..14986dbb 100644 --- a/src/game/g_main.c +++ b/src/game/g_main.c @@ -57,7 +57,6 @@ vmCvar_t g_gravity; vmCvar_t g_cheats; vmCvar_t g_knockback; vmCvar_t g_quadfactor; -vmCvar_t g_forcerespawn; vmCvar_t g_inactivity; vmCvar_t g_debugMove; vmCvar_t g_debugDamage; @@ -185,7 +184,6 @@ static cvarTable_t gameCvarTable[ ] = { &g_quadfactor, "g_quadfactor", "3", 0, 0, qtrue }, { &g_weaponRespawn, "g_weaponrespawn", "5", 0, 0, qtrue }, { &g_weaponTeamRespawn, "g_weaponTeamRespawn", "30", 0, 0, qtrue }, - { &g_forcerespawn, "g_forcerespawn", "20", 0, 0, qtrue }, { &g_inactivity, "g_inactivity", "0", 0, 0, qtrue }, { &g_debugMove, "g_debugMove", "0", 0, 0, qfalse }, { &g_debugDamage, "g_debugDamage", "0", 0, 0, qfalse }, -- cgit