summaryrefslogtreecommitdiff
path: root/src/game
diff options
context:
space:
mode:
authorTim Angus <tim@ngus.net>2001-06-16 19:19:42 +0000
committerTim Angus <tim@ngus.net>2001-06-16 19:19:42 +0000
commitba6e8c35bf5ffcdca53eb2345319c402ba50a86d (patch)
tree6bf0d270bfa93980cc6bc8a36373848dc1789a74 /src/game
parent96c0b0481787295d3cce286429b97d1432b5ee95 (diff)
Restructured dynamic menu handling
Diffstat (limited to 'src/game')
-rw-r--r--src/game/bg_misc.c2
-rw-r--r--src/game/bg_public.h3
-rw-r--r--src/game/g_active.c2
-rw-r--r--src/game/g_client.c1
-rw-r--r--src/game/g_cmds.c16
-rw-r--r--src/game/g_local.h1
6 files changed, 18 insertions, 7 deletions
diff --git a/src/game/bg_misc.c b/src/game/bg_misc.c
index 5884055e..4cfcfc70 100644
--- a/src/game/bg_misc.c
+++ b/src/game/bg_misc.c
@@ -2063,7 +2063,7 @@ upgradeAttributes_t bg_upgrades[ ] =
100,
SLOT_HEAD,
"nvg",
- "nvg"
+ "NVG"
},
{
UP_CHESTARMOUR,
diff --git a/src/game/bg_public.h b/src/game/bg_public.h
index cd01d87f..07353455 100644
--- a/src/game/bg_public.h
+++ b/src/game/bg_public.h
@@ -546,7 +546,8 @@ typedef enum
MN_H_REPEATER,
MN_H_RPLWARN,
MN_H_RPTWARN,
- MN_H_MCUPOWER
+ MN_H_MCUPOWER,
+ MN_H_NOSLOTS
} dynMenu_t;
// animations
diff --git a/src/game/g_active.c b/src/game/g_active.c
index 18da18d7..e0a3654a 100644
--- a/src/game/g_active.c
+++ b/src/game/g_active.c
@@ -752,7 +752,7 @@ void ClientThink_real( gentity_t *ent ) {
client->ps.gravity = g_gravity.value;
// set speed
- client->ps.speed = g_speed.value * client->classSpeed;
+ client->ps.speed = g_speed.value * BG_FindSpeedForClass( client->ps.stats[ STAT_PCLASS ] );
//TA: slow player if standing in creep
for ( i = 1, creepNode = g_entities + i; i < level.num_entities; i++, creepNode++ )
diff --git a/src/game/g_client.c b/src/game/g_client.c
index e81a3ab2..810ad6d6 100644
--- a/src/game/g_client.c
+++ b/src/game/g_client.c
@@ -1314,7 +1314,6 @@ void ClientSpawn( gentity_t *ent, gentity_t *spawn ) {
client->pers.maxHealth = client->ps.stats[ STAT_MAX_HEALTH ] = BG_FindHealthForClass( ent->client->pers.pclass );
client->ps.stats[ STAT_ARMOR ] = BG_FindArmorForClass( ent->client->pers.pclass );
- client->classSpeed = BG_FindSpeedForClass( ent->client->pers.pclass );
// clear entity values
switch( ent->client->pers.pclass )
diff --git a/src/game/g_cmds.c b/src/game/g_cmds.c
index 5372f037..9f0d4c6a 100644
--- a/src/game/g_cmds.c
+++ b/src/game/g_cmds.c
@@ -1846,9 +1846,15 @@ void Cmd_Buy_f( gentity_t *ent )
weapon = BG_FindWeaponNumForName( s );
upgrade = BG_FindUpgradeNumForName( s );
-
+
if( weapon != WP_NONE )
{
+ if( BG_FindSlotsForWeapon( weapon ) & ent->client->ps.stats[ STAT_SLOTS ] )
+ {
+ G_AddPredictableEvent( ent, EV_MENU, MN_H_NOSLOTS );
+ return;
+ }
+
BG_packWeapon( weapon, ent->client->ps.stats );
BG_FindAmmoForWeapon( weapon, &quan, &clips, &maxClips );
BG_packAmmoArray( weapon, ent->client->ps.ammo, ent->client->ps.powerups,
@@ -1857,6 +1863,12 @@ void Cmd_Buy_f( gentity_t *ent )
}
else if( upgrade != UP_NONE )
{
+ if( BG_FindSlotsForUpgrade( upgrade ) & ent->client->ps.stats[ STAT_SLOTS ] )
+ {
+ G_AddPredictableEvent( ent, EV_MENU, MN_H_NOSLOTS );
+ return;
+ }
+
BG_packItem( upgrade, ent->client->ps.stats );
}
else
@@ -1914,7 +1926,7 @@ void Cmd_Sell_f( gentity_t *ent )
}
else if( upgrade != UP_NONE )
{
- if( BG_gotItem( weapon, ent->client->ps.stats ) )
+ if( BG_gotItem( upgrade, ent->client->ps.stats ) )
BG_removeItem( upgrade, ent->client->ps.stats );
}
else
diff --git a/src/game/g_local.h b/src/game/g_local.h
index b635b880..1a1dbfa0 100644
--- a/src/game/g_local.h
+++ b/src/game/g_local.h
@@ -324,7 +324,6 @@ struct gclient_s {
char *areabits;
- float classSpeed; //TA: here to save STAT_ space
int lastInfestTime; //TA: to keep track of how long infests take
gentity_t *infestBody; //TA: body that is being infested. must be persistant
};