diff options
Diffstat (limited to 'src')
-rw-r--r-- | src/cgame/cg_local.h | 2 | ||||
-rw-r--r-- | src/cgame/cg_main.c | 10 | ||||
-rw-r--r-- | src/game/bg_pmove.c | 61 | ||||
-rw-r--r-- | src/game/bg_public.h | 6 | ||||
-rw-r--r-- | src/game/g_active.c | 19 | ||||
-rw-r--r-- | src/game/g_buildable.c | 6 | ||||
-rw-r--r-- | src/game/g_client.c | 8 | ||||
-rw-r--r-- | src/game/g_cmds.c | 9 | ||||
-rw-r--r-- | src/game/g_local.h | 20 | ||||
-rw-r--r-- | src/game/g_weapon.c | 3 |
10 files changed, 78 insertions, 66 deletions
diff --git a/src/cgame/cg_local.h b/src/cgame/cg_local.h index 2fa1b756..55df1873 100644 --- a/src/cgame/cg_local.h +++ b/src/cgame/cg_local.h @@ -1508,8 +1508,6 @@ extern vmCvar_t cg_noTaunt; extern vmCvar_t cg_drawSurfNormal; extern vmCvar_t cg_drawBBOX; extern vmCvar_t cg_wwSmoothTime; -extern vmCvar_t cg_wwFollow; -extern vmCvar_t cg_wwToggle; extern vmCvar_t cg_depthSortParticles; extern vmCvar_t cg_bounceParticles; extern vmCvar_t cg_consoleLatency; diff --git a/src/cgame/cg_main.c b/src/cgame/cg_main.c index 8aa3b52c..94e7c237 100644 --- a/src/cgame/cg_main.c +++ b/src/cgame/cg_main.c @@ -168,8 +168,6 @@ vmCvar_t cg_noTaunt; vmCvar_t cg_drawSurfNormal; vmCvar_t cg_drawBBOX; vmCvar_t cg_wwSmoothTime; -vmCvar_t cg_wwFollow; -vmCvar_t cg_wwToggle; vmCvar_t cg_depthSortParticles; vmCvar_t cg_bounceParticles; vmCvar_t cg_consoleLatency; @@ -276,11 +274,12 @@ static cvarTable_t cvarTable[ ] = { &cg_drawSurfNormal, "cg_drawSurfNormal", "0", CVAR_CHEAT }, { &cg_drawBBOX, "cg_drawBBOX", "0", CVAR_CHEAT }, { &cg_wwSmoothTime, "cg_wwSmoothTime", "300", CVAR_ARCHIVE }, - { &cg_wwFollow, "cg_wwFollow", "1", CVAR_ARCHIVE|CVAR_USERINFO }, - { &cg_wwToggle, "cg_wwToggle", "1", CVAR_ARCHIVE|CVAR_USERINFO }, + { NULL, "cg_wwFollow", "1", CVAR_ARCHIVE|CVAR_USERINFO }, + { NULL, "cg_wwToggle", "1", CVAR_ARCHIVE|CVAR_USERINFO }, { &cg_stickySpec, "cg_stickySpec", "1", CVAR_ARCHIVE|CVAR_USERINFO }, { &cg_alwaysSprint, "cg_alwaysSprint", "0", CVAR_ARCHIVE|CVAR_USERINFO }, { &cg_unlagged, "cg_unlagged", "1", CVAR_ARCHIVE|CVAR_USERINFO }, + { NULL, "cg_flySpeed", "600", CVAR_ARCHIVE|CVAR_USERINFO }, { &cg_depthSortParticles, "cg_depthSortParticles", "1", CVAR_ARCHIVE }, { &cg_bounceParticles, "cg_bounceParticles", "0", CVAR_ARCHIVE }, { &cg_consoleLatency, "cg_consoleLatency", "3000", CVAR_ARCHIVE }, @@ -415,7 +414,8 @@ void CG_UpdateCvars( void ) cvarTable_t *cv; for( i = 0, cv = cvarTable; i < cvarTableSize; i++, cv++ ) - trap_Cvar_Update( cv->vmCvar ); + if( cv->vmCvar ) + trap_Cvar_Update( cv->vmCvar ); // check for modications here diff --git a/src/game/bg_pmove.c b/src/game/bg_pmove.c index dfcac8df..6f15674c 100644 --- a/src/game/bg_pmove.c +++ b/src/game/bg_pmove.c @@ -88,25 +88,13 @@ void PM_AddTouchEnt( int entityNum ) } /* -=============== -PM_Paralyzed -=============== -*/ -qboolean PM_Paralyzed( playerState_t *ps ) -{ - return ( ps->pm_type == PM_DEAD || - ps->pm_type == PM_FREEZE || - ps->pm_type == PM_INTERMISSION ); -} - -/* =================== PM_StartTorsoAnim =================== */ void PM_StartTorsoAnim( int anim ) { - if( PM_Paralyzed( pm->ps ) ) + if( PM_Paralyzed( pm->ps->pm_type ) ) return; pm->ps->torsoAnim = ( ( pm->ps->torsoAnim & ANIM_TOGGLEBIT ) ^ ANIM_TOGGLEBIT ) @@ -120,7 +108,7 @@ PM_StartWeaponAnim */ static void PM_StartWeaponAnim( int anim ) { - if( PM_Paralyzed( pm->ps ) ) + if( PM_Paralyzed( pm->ps->pm_type ) ) return; pm->ps->weaponAnim = ( ( pm->ps->weaponAnim & ANIM_TOGGLEBIT ) ^ ANIM_TOGGLEBIT ) @@ -134,7 +122,7 @@ PM_StartLegsAnim */ static void PM_StartLegsAnim( int anim ) { - if( PM_Paralyzed( pm->ps ) ) + if( PM_Paralyzed( pm->ps->pm_type ) ) return; //legsTimer is clamped too tightly for nonsegmented models @@ -1619,8 +1607,6 @@ static void PM_NoclipMove( void ) float wishspeed; float scale; - pm->ps->viewheight = DEFAULT_VIEWHEIGHT; - // friction speed = VectorLength( pm->ps->velocity ); @@ -2428,23 +2414,29 @@ static void PM_SetWaterLevel( void ) /* ============== +PM_SetViewheight +============== +*/ +static void PM_SetViewheight( void ) +{ + pm->ps->viewheight = ( pm->ps->pm_flags & PMF_DUCKED ) + ? BG_ClassConfig( pm->ps->stats[ STAT_CLASS ] )->crouchViewheight + : BG_ClassConfig( pm->ps->stats[ STAT_CLASS ] )->viewheight; +} + +/* +============== PM_CheckDuck -Sets mins, maxs, and pm->ps->viewheight +Sets mins and maxs, and calls PM_SetViewheight ============== */ static void PM_CheckDuck (void) { trace_t trace; vec3_t PCmins, PCmaxs, PCcmaxs; - int PCvh, PCcvh; BG_ClassBoundingBox( pm->ps->stats[ STAT_CLASS ], PCmins, PCmaxs, PCcmaxs, NULL, NULL ); - PCvh = BG_ClassConfig( pm->ps->stats[ STAT_CLASS ] )->viewheight; - PCcvh = BG_ClassConfig( pm->ps->stats[ STAT_CLASS ] )->crouchViewheight; - - if( pm->ps->persistant[ PERS_SPECSTATE ] != SPECTATOR_NOT ) - PCcvh = PCvh; pm->mins[ 0 ] = PCmins[ 0 ]; pm->mins[ 1 ] = PCmins[ 1 ]; @@ -2461,10 +2453,9 @@ static void PM_CheckDuck (void) return; } - // If the standing and crouching viewheights are the same the class can't crouch - if( ( pm->cmd.upmove < 0 ) && ( PCvh != PCcvh ) && - pm->ps->pm_type != PM_JETPACK && - !BG_InventoryContainsUpgrade( UP_BATTLESUIT, pm->ps->stats ) ) + // If the standing and crouching bboxes are the same the class can't crouch + if( ( pm->cmd.upmove < 0 ) && !VectorCompare( PCmaxs, PCcmaxs ) && + pm->ps->pm_type != PM_JETPACK ) { // duck pm->ps->pm_flags |= PMF_DUCKED; @@ -2483,15 +2474,11 @@ static void PM_CheckDuck (void) } if( pm->ps->pm_flags & PMF_DUCKED ) - { pm->maxs[ 2 ] = PCcmaxs[ 2 ]; - pm->ps->viewheight = PCcvh; - } else - { pm->maxs[ 2 ] = PCmaxs[ 2 ]; - pm->ps->viewheight = PCvh; - } + + PM_SetViewheight( ); } @@ -3418,7 +3405,7 @@ PM_Animate */ static void PM_Animate( void ) { - if( PM_Paralyzed( pm->ps ) ) + if( PM_Paralyzed( pm->ps->pm_type ) ) return; if( pm->cmd.buttons & BUTTON_GESTURE ) @@ -3697,7 +3684,7 @@ void PmoveSingle( pmove_t *pmove ) else if( pm->cmd.forwardmove > 0 || ( pm->cmd.forwardmove == 0 && pm->cmd.rightmove ) ) pm->ps->pm_flags &= ~PMF_BACKWARDS_RUN; - if( PM_Paralyzed( pm->ps ) ) + if( PM_Paralyzed( pm->ps->pm_type ) ) { pm->cmd.forwardmove = 0; pm->cmd.rightmove = 0; @@ -3718,6 +3705,8 @@ void PmoveSingle( pmove_t *pmove ) { PM_UpdateViewAngles( pm->ps, &pm->cmd ); PM_NoclipMove( ); + PM_SetViewheight( ); + PM_Weapon( ); PM_DropTimers( ); return; } diff --git a/src/game/bg_public.h b/src/game/bg_public.h index ca61f135..5763c658 100644 --- a/src/game/bg_public.h +++ b/src/game/bg_public.h @@ -116,6 +116,12 @@ typedef enum PM_INTERMISSION, // no movement or status bar } pmtype_t; +// 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 ||\ + (x) == PM_GRABBED ) + typedef enum { WEAPON_READY, diff --git a/src/game/g_active.c b/src/game/g_active.c index 8b3b79fc..cee31467 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( client->ps.pm_type == PM_DEAD ) + if( !PM_Live( client->ps.pm_type ) ) return; // total points of damage shot at the player this frame @@ -457,13 +457,14 @@ void SpectatorThink( gentity_t *ent, usercmd_t *ucmd ) if( client->sess.spectatorState == SPECTATOR_LOCKED || client->sess.spectatorState == SPECTATOR_FOLLOW ) client->ps.pm_type = PM_FREEZE; - else - client->ps.pm_type = PM_SPECTATOR; - - if( queued ) + else if( client->noclip ) + client->ps.pm_type = PM_NOCLIP; + else if( queued ) client->ps.pm_flags |= PMF_QUEUED; - client->ps.speed = BG_Class( client->ps.stats[ STAT_CLASS ] )->speed; + client->ps.pm_type = PM_SPECTATOR; + + client->ps.speed = client->pers.flySpeed; client->ps.stats[ STAT_STAMINA ] = 0; client->ps.stats[ STAT_MISC ] = 0; client->ps.stats[ STAT_BUILDABLE ] = 0; @@ -1495,7 +1496,11 @@ void ClientThink_real( gentity_t *ent ) } // set speed - client->ps.speed = g_speed.value * BG_Class( client->ps.stats[ STAT_CLASS ] )->speed; + if( client->ps.pm_type == PM_NOCLIP ) + client->ps.speed = client->pers.flySpeed; + else + client->ps.speed = g_speed.value * + BG_Class( client->ps.stats[ STAT_CLASS ] )->speed; if( client->lastCreepSlowTime + CREEP_TIMEOUT < level.time ) client->ps.stats[ STAT_STATE ] &= ~SS_CREEPSLOWED; diff --git a/src/game/g_buildable.c b/src/game/g_buildable.c index 2a089ba5..11fe5214 100644 --- a/src/game/g_buildable.c +++ b/src/game/g_buildable.c @@ -309,7 +309,7 @@ G_FindOvermind Attempt to find an overmind for self ================ */ -static qboolean G_FindOvermind( gentity_t *self ) +qboolean G_FindOvermind( gentity_t *self ) { int i; gentity_t *ent; @@ -348,7 +348,7 @@ G_IsOvermindBuilt Simple wrapper to G_FindOvermind to check if a location has an overmind ================ */ -qboolean G_IsOvermindBuilt( void ) +static qboolean G_IsOvermindBuilt( void ) { gentity_t dummy; @@ -1395,7 +1395,7 @@ void ABooster_Touch( gentity_t *self, gentity_t *other, trace_t *trace ) if( !client ) return; - if( client && client->ps.stats[ STAT_TEAM ] == TEAM_HUMANS ) + if( client->ps.stats[ STAT_TEAM ] == TEAM_HUMANS ) return; client->ps.stats[ STAT_STATE ] |= SS_BOOSTED; diff --git a/src/game/g_client.c b/src/game/g_client.c index 782f053e..e69581da 100644 --- a/src/game/g_client.c +++ b/src/game/g_client.c @@ -1119,6 +1119,14 @@ void ClientUserinfoChanged( int clientNum ) else client->ps.persistant[ PERS_STATE ] &= ~PS_ALWAYSSPRINT; + // fly speed + s = Info_ValueForKey( userinfo, "cg_flySpeed" ); + + if( *s ) + client->pers.flySpeed = atoi( s ); + else + client->pers.flySpeed = BG_Class( PCL_NONE )->speed; + // teamInfo s = Info_ValueForKey( userinfo, "teamoverlay" ); diff --git a/src/game/g_cmds.c b/src/game/g_cmds.c index 87fa5777..06d2ed81 100644 --- a/src/game/g_cmds.c +++ b/src/game/g_cmds.c @@ -2975,12 +2975,13 @@ commands_t cmds[ ] = { { "give", CMD_CHEAT|CMD_TEAM|CMD_LIVING, Cmd_Give_f }, { "god", CMD_CHEAT|CMD_TEAM|CMD_LIVING, Cmd_God_f }, { "notarget", CMD_CHEAT|CMD_TEAM|CMD_LIVING, Cmd_Notarget_f }, - { "noclip", CMD_CHEAT|CMD_TEAM|CMD_LIVING, Cmd_Noclip_f }, + { "noclip", CMD_CHEAT_TEAM, Cmd_Noclip_f }, { "levelshot", CMD_CHEAT, Cmd_LevelShot_f }, - { "setviewpos", CMD_CHEAT, Cmd_SetViewpos_f }, + { "setviewpos", CMD_CHEAT_TEAM, Cmd_SetViewpos_f }, { "destroy", CMD_CHEAT|CMD_TEAM|CMD_LIVING, Cmd_Destroy_f }, { "test", CMD_CHEAT, Cmd_Test_f }, { "damage", CMD_CHEAT|CMD_LIVING, Cmd_Damage_f }, + { "where", 0, Cmd_Where_f }, // game commands { "ptrcverify", CMD_SPEC, Cmd_PTRCVerify_f }, @@ -2990,7 +2991,6 @@ commands_t cmds[ ] = { { "follownext", CMD_SPEC, Cmd_FollowCycle_f }, { "followprev", CMD_SPEC, Cmd_FollowCycle_f }, - { "where", CMD_TEAM, Cmd_Where_f }, { "teamvote", CMD_TEAM, Cmd_TeamVote_f }, { "class", CMD_TEAM, Cmd_Class_f }, { "kill", CMD_TEAM|CMD_LIVING, Cmd_Kill_f }, @@ -3053,7 +3053,8 @@ void ClientCommand( int clientNum ) G_FloodLimited( ent ) ) ) return; - if( cmds[ i ].cmdFlags & CMD_TEAM && + if( ( cmds[ i ].cmdFlags & CMD_TEAM || + ( cmds[ i ].cmdFlags & CMD_CHEAT_TEAM && !g_cheats.integer ) ) && ent->client->pers.teamSelection == TEAM_NONE ) { G_TriggerMenu( clientNum, MN_CMD_TEAM ); diff --git a/src/game/g_local.h b/src/game/g_local.h index 01b6ef5c..f1fa6b11 100644 --- a/src/game/g_local.h +++ b/src/game/g_local.h @@ -304,6 +304,7 @@ typedef struct int location; // player locations int voteCount; // to prevent people from constantly calling votes qboolean teamInfo; // send team overlay updates? + float flySpeed; // for spectator/noclip moves class_t classSelection; // player class (copied to ent->client->ps.stats[ STAT_CLASS ] once spawned) float evolveHealthFraction; @@ -637,14 +638,15 @@ typedef struct int emoticonCount; } level_locals_t; -#define CMD_CHEAT 0x01 -#define CMD_MESSAGE 0x02 // sends message to others (skip when muted) -#define CMD_TEAM 0x04 // must be on a team -#define CMD_SPEC 0x08 // must be in spectator mode -#define CMD_ALIEN 0x10 -#define CMD_HUMAN 0x20 -#define CMD_LIVING 0x40 -#define CMD_INTERMISSION 0x80 // valid during intermission +#define CMD_CHEAT 0x0001 +#define CMD_CHEAT_TEAM 0x0002 // is a cheat when used on a team +#define CMD_MESSAGE 0x0004 // sends message to others (skip when muted) +#define CMD_TEAM 0x0008 // must be on a team +#define CMD_SPEC 0x0010 // must be in spectator mode +#define CMD_ALIEN 0x0020 +#define CMD_HUMAN 0x0040 +#define CMD_LIVING 0x0080 +#define CMD_INTERMISSION 0x0100 // valid during intermission typedef struct { @@ -730,7 +732,7 @@ gentity_t *G_CheckSpawnPoint( int spawnNum, vec3_t origin, vec3_t normal buildable_t G_IsPowered( vec3_t origin ); qboolean G_IsDCCBuilt( void ); int G_FindDCC( gentity_t *self ); -qboolean G_IsOvermindBuilt( void ); +qboolean G_FindOvermind( gentity_t *self ); qboolean G_FindCreep( gentity_t *self ); void G_BuildableThink( gentity_t *ent, int msec ); diff --git a/src/game/g_weapon.c b/src/game/g_weapon.c index 1edb5ccf..13648267 100644 --- a/src/game/g_weapon.c +++ b/src/game/g_weapon.c @@ -920,6 +920,9 @@ qboolean CheckVenomAttack( gentity_t *ent ) if( !traceEnt->takedamage ) return qfalse; + if( traceEnt->health <= 0 ) + return qfalse; + if( !traceEnt->client && !traceEnt->s.eType == ET_BUILDABLE ) return qfalse; |