diff options
Diffstat (limited to 'src/game')
-rw-r--r-- | src/game/bg_pmove.c | 9 | ||||
-rw-r--r-- | src/game/g_active.c | 33 | ||||
-rw-r--r-- | src/game/g_buildable.c | 50 | ||||
-rw-r--r-- | src/game/g_client.c | 8 | ||||
-rw-r--r-- | src/game/g_cmds.c | 6 | ||||
-rw-r--r-- | src/game/g_local.h | 1 | ||||
-rw-r--r-- | src/game/tremulous.h | 3 |
7 files changed, 68 insertions, 42 deletions
diff --git a/src/game/bg_pmove.c b/src/game/bg_pmove.c index cb5d8162..359a4c59 100644 --- a/src/game/bg_pmove.c +++ b/src/game/bg_pmove.c @@ -378,6 +378,15 @@ static float PM_CmdScale( usercmd_t *cmd ) //slow down once stamina depletes if( pm->ps->stats[ STAT_STAMINA ] <= -500 ) modifier *= (float)( pm->ps->stats[ STAT_STAMINA ] + 1000 ) / 500.0f; + + if( pm->ps->stats[ STAT_STATE ] & SS_CREEPSLOWED ) + { + if( BG_gotItem( UP_LIGHTARMOUR, pm->ps->stats ) || + BG_gotItem( UP_BATTLESUIT, pm->ps->stats ) ) + modifier *= CREEP_ARMOUR_MODIFIER; + else + modifier *= CREEP_MODIFIER; + } } if( pm->ps->pm_type == PM_GRABBED || pm->ps->pm_type == PM_KNOCKED ) diff --git a/src/game/g_active.c b/src/game/g_active.c index df7a2111..ba1921ca 100644 --- a/src/game/g_active.c +++ b/src/game/g_active.c @@ -769,12 +769,6 @@ void ClientThink_real( gentity_t *ent ) usercmd_t *ucmd; float speed; - //TA: creep variables - gentity_t *creepNode; - vec3_t temp_v; - int i; - qboolean cSlowed = qfalse; - client = ent->client; // don't think if the client is not yet connected (and thus not yet spawned in) @@ -928,32 +922,9 @@ void ClientThink_real( gentity_t *ent ) if( client->ps.stats[ STAT_STATE ] & SS_SLOWLOCKED ) client->ps.speed *= DRAGOON_SLOWBLOB_SPEED_MOD; - //TA: slow player if standing in creep - for( i = 1, creepNode = g_entities + i; i < level.num_entities; i++, creepNode++ ) - { - if( creepNode->biteam == PTE_ALIENS ) - { - VectorSubtract( client->ps.origin, creepNode->s.origin, temp_v ); - - if( ( VectorLength( temp_v ) <= BG_FindCreepSizeForBuildable( creepNode->s.modelindex ) ) && - ( temp_v[ 2 ] <= 21 ) && //assumes mins of player is (x, x, -24) - ( client->ps.stats[ STAT_PTEAM ] == PTE_HUMANS ) ) - { - if( BG_gotItem( UP_LIGHTARMOUR, client->ps.stats ) ) - client->ps.speed *= 0.75; - else - client->ps.speed *= 0.5; - - client->ps.stats[ STAT_STATE ] |= SS_CREEPSLOWED; - cSlowed = qtrue; - break; - } - } - } - - if( !cSlowed ) + if( client->lastCreepSlowTime + CREEP_TIMEOUT < level.time ) client->ps.stats[ STAT_STATE ] &= ~SS_CREEPSLOWED; - + // set up for pmove oldEventSequence = client->ps.eventSequence; diff --git a/src/game/g_buildable.c b/src/game/g_buildable.c index 3219734c..b27b1064 100644 --- a/src/game/g_buildable.c +++ b/src/game/g_buildable.c @@ -275,6 +275,42 @@ static qboolean isCreep( vec3_t origin ) /* ================ +creepSlow + +Set any nearby humans' SS_CREEPSLOWED flag +================ +*/ +static void creepSlow( buildable_t buildable, vec3_t origin ) +{ + int entityList[ MAX_GENTITIES ]; + vec3_t range; + vec3_t mins, maxs; + int i, num; + gentity_t *enemy; + float creepSize = (float)BG_FindCreepSizeForBuildable( buildable ); + + VectorSet( range, creepSize, creepSize, creepSize ); + + VectorAdd( origin, range, maxs ); + VectorSubtract( origin, range, mins ); + + //find humans + num = trap_EntitiesInBox( mins, maxs, entityList, MAX_GENTITIES ); + for( i = 0; i < num; i++ ) + { + enemy = &g_entities[ entityList[ i ] ]; + + if( enemy->client && enemy->client->ps.stats[ STAT_PTEAM ] == PTE_HUMANS && + enemy->client->ps.groundEntityNum != ENTITYNUM_NONE ) + { + enemy->client->ps.stats[ STAT_STATE ] |= SS_CREEPSLOWED; + enemy->client->lastCreepSlowTime = level.time; + } + } +} + +/* +================ nullDieFunction hack to prevent compilers complaining about function pointer -> NULL conversion @@ -449,6 +485,8 @@ void ASpawn_Think( gentity_t *self ) G_FreeEntity( ent ); //quietly remove } + creepSlow( self->s.modelindex, self->s.origin ); + self->nextthink = level.time + BG_FindNextThinkForBuildable( self->s.modelindex ); } @@ -507,6 +545,8 @@ void AOvermind_Think( gentity_t *self ) } } + creepSlow( self->s.modelindex, self->s.origin ); + self->nextthink = level.time + BG_FindNextThinkForBuildable( self->s.modelindex ); } @@ -601,6 +641,8 @@ void ABarricade_Think( gentity_t *self ) return; } + creepSlow( self->s.modelindex, self->s.origin ); + self->nextthink = level.time + BG_FindNextThinkForBuildable( self->s.modelindex ); } @@ -641,6 +683,8 @@ void AAcidTube_Damage( gentity_t *self ) G_SelectiveRadiusDamage( self->s.pos.trBase, self->parent, self->splashDamage, self->splashRadius, self, self->splashMethodOfDeath, PTE_ALIENS ); + creepSlow( self->s.modelindex, self->s.origin ); + self->nextthink = level.time + BG_FindNextThinkForBuildable( self->s.modelindex ); } @@ -685,6 +729,8 @@ void AAcidTube_Think( gentity_t *self ) } } + creepSlow( self->s.modelindex, self->s.origin ); + self->nextthink = level.time + BG_FindNextThinkForBuildable( self->s.modelindex ); } @@ -755,6 +801,8 @@ void AHovel_Think( gentity_t *self ) else G_setIdleBuildableAnim( self, BANIM_IDLE1 ); + creepSlow( self->s.modelindex, self->s.origin ); + self->nextthink = level.time + 200; } @@ -986,6 +1034,8 @@ void ATrapper_Think( gentity_t *self ) int range = BG_FindRangeForBuildable( self->s.modelindex ); int firespeed = BG_FindFireSpeedForBuildable( self->s.modelindex ); + creepSlow( self->s.modelindex, self->s.origin ); + self->nextthink = level.time + BG_FindNextThinkForBuildable( self->s.modelindex ); //if there is no creep nearby die diff --git a/src/game/g_client.c b/src/game/g_client.c index a4d2684a..a61cd200 100644 --- a/src/game/g_client.c +++ b/src/game/g_client.c @@ -1365,14 +1365,6 @@ void ClientSpawn( gentity_t *ent, gentity_t *spawn ) client->ps.eventSequence = eventSequence; - if( client->sess.sessionTeam == TEAM_SPECTATOR ) - { - if( teamLocal == PTE_ALIENS ) - G_TriggerMenu( index, MN_A_CLASS ); - else if( teamLocal == PTE_HUMANS ) - G_TriggerMenu( index, MN_H_SPAWN ); - } - // increment the spawncount so the client will detect the respawn client->ps.persistant[ PERS_SPAWN_COUNT ]++; client->ps.persistant[ PERS_TEAM ] = client->sess.sessionTeam; diff --git a/src/game/g_cmds.c b/src/game/g_cmds.c index c03187ae..8ac5bf79 100644 --- a/src/game/g_cmds.c +++ b/src/game/g_cmds.c @@ -1466,7 +1466,7 @@ void Cmd_Buy_f( gentity_t *ent ) //if the buyer previously had no items at all, force a new selection if( numItems == 0 ) - G_AddEvent( ent, EV_NEXT_WEAPON, 0 ); + G_AddEvent( ent, EV_NEXT_WEAPON, ent->client->ps.clientNum ); //retrigger the armoury menu ent->client->retriggerArmouryMenu = level.framenum + RAM_FRAMES; @@ -1533,7 +1533,7 @@ void Cmd_Sell_f( gentity_t *ent ) //if we have this weapon selected, force a new selection if( weapon == ent->client->ps.weapon ) - G_AddEvent( ent, EV_NEXT_WEAPON, 0 ); + G_AddEvent( ent, EV_NEXT_WEAPON, ent->client->ps.clientNum ); } else if( upgrade != UP_NONE ) { @@ -1548,7 +1548,7 @@ void Cmd_Sell_f( gentity_t *ent ) //if we have this upgrade selected, force a new selection if( upgrade == ent->client->pers.cmd.weapon - 32 ) - G_AddEvent( ent, EV_NEXT_WEAPON, 0 ); + G_AddEvent( ent, EV_NEXT_WEAPON, ent->client->ps.clientNum ); } else trap_SendServerCommand( ent-g_entities, va( "print \"Unknown item\n\"" ) ); diff --git a/src/game/g_local.h b/src/game/g_local.h index 699258f5..966fad93 100644 --- a/src/game/g_local.h +++ b/src/game/g_local.h @@ -353,6 +353,7 @@ struct gclient_s int lastBoostedTime; int lastKnockedOverTime; int lastGetUpTime; + int lastCreepSlowTime; //TA: time until creep can be removed int pouncePayload; //TA: amount of damage pounce attack will do qboolean allowedToPounce; diff --git a/src/game/tremulous.h b/src/game/tremulous.h index dc381441..d3561a6e 100644 --- a/src/game/tremulous.h +++ b/src/game/tremulous.h @@ -179,6 +179,9 @@ #define ABHM(h) ((int)((float)h*ALIEN_BHLTH_MODIFIER)) #define CREEP_BASESIZE 700 +#define CREEP_TIMEOUT 1000 +#define CREEP_MODIFIER 0.5f +#define CREEP_ARMOUR_MODIFIER 0.75f #define ASPAWN_BP 100 #define ASPAWN_HEALTH ABHM(500) |