summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorTim Angus <tim@ngus.net>2003-08-12 02:42:17 +0000
committerTim Angus <tim@ngus.net>2003-08-12 02:42:17 +0000
commitd8289eef899a0be82afbe22501f39f20e5b25d90 (patch)
tree69580d6f7ebb4d339cb5368f4b52a430e8a8886a /src
parent44a9b6d825e66df1f6f9cd2475186c0f0bf2cb8b (diff)
* Disabled automatically bringing up spawn menus to prevent cutting off chat
* EV_NEXT_WEAPON event now only triggers on the correct client * Creep slowdown totally reworked, it's now predicted and might actually work * Listboxes now have their selection set to 0 whenever displayed
Diffstat (limited to 'src')
-rw-r--r--src/cgame/cg_event.c4
-rw-r--r--src/game/bg_pmove.c9
-rw-r--r--src/game/g_active.c33
-rw-r--r--src/game/g_buildable.c50
-rw-r--r--src/game/g_client.c8
-rw-r--r--src/game/g_cmds.c6
-rw-r--r--src/game/g_local.h1
-rw-r--r--src/game/tremulous.h3
-rw-r--r--src/ui/ui_main.c2
-rw-r--r--src/ui/ui_shared.c9
10 files changed, 81 insertions, 44 deletions
diff --git a/src/cgame/cg_event.c b/src/cgame/cg_event.c
index 017750c7..10e1dcd1 100644
--- a/src/cgame/cg_event.c
+++ b/src/cgame/cg_event.c
@@ -552,7 +552,9 @@ void CG_EntityEvent( centity_t *cent, vec3_t position )
case EV_NEXT_WEAPON:
DEBUGNAME( "EV_NEXT_WEAPON" );
- CG_NextWeapon_f( );
+
+ if( clientNum == cg.predictedPlayerState.clientNum )
+ CG_NextWeapon_f( );
break;
case EV_FIRE_WEAPON:
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)
diff --git a/src/ui/ui_main.c b/src/ui/ui_main.c
index b01f62bc..21281f87 100644
--- a/src/ui/ui_main.c
+++ b/src/ui/ui_main.c
@@ -3574,6 +3574,8 @@ static void UI_LoadTremAlienBuilds( )
uiInfo.tremAlienBuildCount++;
}
}
+
+ uiInfo.tremAlienBuildIndex = 0;
}
/*
diff --git a/src/ui/ui_shared.c b/src/ui/ui_shared.c
index 73244fef..5b0e8e30 100644
--- a/src/ui/ui_shared.c
+++ b/src/ui/ui_shared.c
@@ -4404,7 +4404,7 @@ qboolean Menus_AnyFullScreenVisible() {
}
menuDef_t *Menus_ActivateByName(const char *p) {
- int i;
+ int i, j;
menuDef_t *m = NULL;
menuDef_t *focus = Menu_GetFocused();
@@ -4413,6 +4413,13 @@ menuDef_t *Menus_ActivateByName(const char *p) {
m = &Menus[i];
Menus_Activate(m);
Menu_HandleMouseMove( m, DC->cursorx, DC->cursory ); //TA: force the item under the cursor to focus
+
+ for( j = 0; j < m->itemCount; j++ ) //TA: reset selection in listboxes when opened
+ {
+ if( m->items[ j ]->type == ITEM_TYPE_LISTBOX )
+ m->items[ j ]->cursorPos = 0;
+ }
+
if (openMenuCount < MAX_OPEN_MENUS && focus != NULL) {
menuStack[openMenuCount++] = focus;
}