summaryrefslogtreecommitdiff
path: root/src/game
diff options
context:
space:
mode:
Diffstat (limited to 'src/game')
-rw-r--r--src/game/bg_misc.c1
-rw-r--r--src/game/bg_public.h1
-rw-r--r--src/game/g_active.c19
-rw-r--r--src/game/g_buildable.c36
-rw-r--r--src/game/g_client.c4
-rw-r--r--src/game/g_cmds.c40
-rw-r--r--src/game/g_local.h8
-rw-r--r--src/game/g_main.c6
-rw-r--r--src/game/g_utils.c14
-rw-r--r--src/game/g_weapon.c2
10 files changed, 79 insertions, 52 deletions
diff --git a/src/game/bg_misc.c b/src/game/bg_misc.c
index 9451a52a..7bb663f7 100644
--- a/src/game/bg_misc.c
+++ b/src/game/bg_misc.c
@@ -3574,7 +3574,6 @@ char *eventnames[ ] =
"EV_STOPLOOPINGSOUND",
"EV_TAUNT",
- "EV_MENU", //TA: menu event
"EV_BUILD_DELAY", //TA: can't build yet
"EV_POISONCLOUD", //TA: client poisoned
"EV_KNOCKOVER", //TA: client knocked over
diff --git a/src/game/bg_public.h b/src/game/bg_public.h
index d86f01f1..e14e1448 100644
--- a/src/game/bg_public.h
+++ b/src/game/bg_public.h
@@ -527,7 +527,6 @@ typedef enum
EV_STOPLOOPINGSOUND,
EV_TAUNT,
- EV_MENU, //TA: menu event
EV_BUILD_DELAY, //TA: can't build yet
EV_POISONCLOUD, //TA: client poisoned
EV_KNOCKOVER, //TA: client knocked over
diff --git a/src/game/g_active.c b/src/game/g_active.c
index f5470e43..28c03a9c 100644
--- a/src/game/g_active.c
+++ b/src/game/g_active.c
@@ -344,11 +344,11 @@ void SpectatorThink( gentity_t *ent, usercmd_t *ucmd )
if( ( client->buttons & BUTTON_ATTACK ) && !( client->oldbuttons & BUTTON_ATTACK ) )
{
if( client->pers.pteam == PTE_NONE )
- G_AddPredictableEvent( ent, EV_MENU, MN_TEAM );
+ G_TriggerMenu( ent->client->ps.clientNum, MN_TEAM );
else if( client->pers.pteam == PTE_ALIENS )
- G_AddPredictableEvent( ent, EV_MENU, MN_A_CLASS );
+ G_TriggerMenu( ent->client->ps.clientNum, MN_A_CLASS );
else if( client->pers.pteam == PTE_HUMANS )
- G_AddPredictableEvent( ent, EV_MENU, MN_H_SPAWN );
+ G_TriggerMenu( ent->client->ps.clientNum, MN_H_SPAWN );
}
// attack button cycles through spectators
@@ -1113,7 +1113,7 @@ void ClientThink_real( gentity_t *ent )
else
{
//exit is blocked
- G_AddPredictableEvent( ent, EV_MENU, MN_A_HOVEL_BLOCKED );
+ G_TriggerMenu( ent->client->ps.clientNum, MN_A_HOVEL_BLOCKED );
}
}
else
@@ -1158,7 +1158,7 @@ void ClientThink_real( gentity_t *ent )
if( client->ps.persistant[ PERS_CREDIT ] > 0 )
{
//no nearby objects and alien - show class menu
- G_AddPredictableEvent( ent, EV_MENU, MN_A_INFEST );
+ G_TriggerMenu( ent->client->ps.clientNum, MN_A_INFEST );
}
}
}
@@ -1174,7 +1174,7 @@ void ClientThink_real( gentity_t *ent )
// forcerespawn is to prevent users from waiting out powerups
if( g_forcerespawn.integer > 0 &&
( level.time - client->respawnTime ) > 0 )
- { //g_forcerespawn.integer * 1000 ) {
+ {
respawn( ent );
return;
}
@@ -1196,6 +1196,13 @@ void ClientThink_real( gentity_t *ent )
ClientSpawn( ent, client->infestBody );
}
+ if( level.framenum > client->retriggerArmouryMenu && client->retriggerArmouryMenu )
+ {
+ G_TriggerMenu( client->ps.clientNum, MN_H_ARMOURY );
+
+ client->retriggerArmouryMenu = 0;
+ }
+
// perform once-a-second actions
ClientTimerActions( ent, msec );
}
diff --git a/src/game/g_buildable.c b/src/game/g_buildable.c
index f83faefe..b3a7e5b4 100644
--- a/src/game/g_buildable.c
+++ b/src/game/g_buildable.c
@@ -709,7 +709,7 @@ void AHovel_Use( gentity_t *self, gentity_t *other, gentity_t *activator )
if( self->active )
{
//this hovel is in use
- G_AddPredictableEvent( activator, EV_MENU, MN_A_HOVEL_OCCUPIED );
+ G_TriggerMenu( activator->client->ps.clientNum, MN_A_HOVEL_OCCUPIED );
}
else if( ( activator->client->ps.stats[ STAT_PCLASS ] == PCL_A_B_BASE ) ||
( activator->client->ps.stats[ STAT_PCLASS ] == PCL_A_B_LEV1 ) )
@@ -1099,9 +1099,9 @@ void HArmoury_Activate( gentity_t *self, gentity_t *other, gentity_t *activator
//if this is powered then call the armoury menu
if( self->powered )
- G_AddPredictableEvent( activator, EV_MENU, MN_H_ARMOURY );
+ G_TriggerMenu( activator->client->ps.clientNum, MN_H_ARMOURY );
else
- G_AddPredictableEvent( activator, EV_MENU, MN_H_NOPOWER );
+ G_TriggerMenu( activator->client->ps.clientNum, MN_H_NOPOWER );
}
/*
@@ -1140,9 +1140,9 @@ void HBank_Activate( gentity_t *self, gentity_t *other, gentity_t *activator )
//if this is powered then call the bank menu
if( self->powered )
- G_AddPredictableEvent( activator, EV_MENU, MN_H_BANK );
+ G_TriggerMenu( activator->client->ps.clientNum, MN_H_BANK );
else
- G_AddPredictableEvent( activator, EV_MENU, MN_H_NOPOWER );
+ G_TriggerMenu( activator->client->ps.clientNum, MN_H_NOPOWER );
}
/*
@@ -2070,56 +2070,56 @@ qboolean G_ValidateBuild( gentity_t *ent, buildable_t buildable )
return qtrue;
case IBE_NOASSERT:
- G_AddPredictableEvent( ent, EV_MENU, MN_A_NOASSERT );
+ G_TriggerMenu( ent->client->ps.clientNum, MN_A_NOASSERT );
return qfalse;
case IBE_NOHIVEMIND:
- G_AddPredictableEvent( ent, EV_MENU, MN_A_NOHVMND );
+ G_TriggerMenu( ent->client->ps.clientNum, MN_A_NOHVMND );
return qfalse;
case IBE_HIVEMIND:
- G_AddPredictableEvent( ent, EV_MENU, MN_A_HIVEMIND );
+ G_TriggerMenu( ent->client->ps.clientNum, MN_A_HIVEMIND );
return qfalse;
case IBE_NORMAL:
- G_AddPredictableEvent( ent, EV_MENU, MN_A_NORMAL );
+ G_TriggerMenu( ent->client->ps.clientNum, MN_A_NORMAL );
return qfalse;
case IBE_REACTOR:
- G_AddPredictableEvent( ent, EV_MENU, MN_H_REACTOR );
+ G_TriggerMenu( ent->client->ps.clientNum, MN_H_REACTOR );
return qfalse;
case IBE_REPEATER:
- G_AddPredictableEvent( ent, EV_MENU, MN_H_REPEATER );
+ G_TriggerMenu( ent->client->ps.clientNum, MN_H_REPEATER );
return qfalse;
case IBE_NOROOM:
if( ent->client->ps.stats[ STAT_PTEAM ] == PTE_HUMANS )
- G_AddPredictableEvent( ent, EV_MENU, MN_H_NOROOM );
+ G_TriggerMenu( ent->client->ps.clientNum, MN_H_NOROOM );
else
- G_AddPredictableEvent( ent, EV_MENU, MN_A_NOROOM );
+ G_TriggerMenu( ent->client->ps.clientNum, MN_A_NOROOM );
return qfalse;
case IBE_NOPOWER:
- G_AddPredictableEvent( ent, EV_MENU, MN_H_NOPOWER );
+ G_TriggerMenu( ent->client->ps.clientNum, MN_H_NOPOWER );
return qfalse;
case IBE_NODCC:
- G_AddPredictableEvent( ent, EV_MENU, MN_H_NODCC );
+ G_TriggerMenu( ent->client->ps.clientNum, MN_H_NODCC );
return qfalse;
case IBE_SPWNWARN:
- G_AddPredictableEvent( ent, EV_MENU, MN_A_SPWNWARN );
+ G_TriggerMenu( ent->client->ps.clientNum, MN_A_SPWNWARN );
G_buildItem( ent, buildable, origin, ent->s.apos.trBase );
return qtrue;
case IBE_RPLWARN:
- G_AddPredictableEvent( ent, EV_MENU, MN_H_RPLWARN );
+ G_TriggerMenu( ent->client->ps.clientNum, MN_H_RPLWARN );
G_buildItem( ent, buildable, origin, ent->s.apos.trBase );
return qtrue;
case IBE_RPTWARN:
- G_AddPredictableEvent( ent, EV_MENU, MN_H_RPTWARN );
+ G_TriggerMenu( ent->client->ps.clientNum, MN_H_RPTWARN );
G_buildItem( ent, buildable, origin, ent->s.apos.trBase );
return qtrue;
}
diff --git a/src/game/g_client.c b/src/game/g_client.c
index 65bc992c..a77cf96b 100644
--- a/src/game/g_client.c
+++ b/src/game/g_client.c
@@ -1348,9 +1348,9 @@ void ClientSpawn( gentity_t *ent, gentity_t *spawn )
if( client->sess.sessionTeam == TEAM_SPECTATOR )
{
if( teamLocal == PTE_ALIENS )
- G_AddPredictableEvent( ent, EV_MENU, MN_A_CLASS );
+ G_TriggerMenu( ent->client->ps.clientNum, MN_A_CLASS );
else if( teamLocal == PTE_HUMANS )
- G_AddPredictableEvent( ent, EV_MENU, MN_H_SPAWN );
+ G_TriggerMenu( ent->client->ps.clientNum, MN_H_SPAWN );
}
// increment the spawncount so the client will detect the respawn
diff --git a/src/game/g_cmds.c b/src/game/g_cmds.c
index c197bdaa..4deac46a 100644
--- a/src/game/g_cmds.c
+++ b/src/game/g_cmds.c
@@ -1024,7 +1024,7 @@ void Cmd_Class_f( gentity_t *ent )
else
{
ent->client->pers.pclass = PCL_NONE;
- G_AddPredictableEvent( ent, EV_MENU, MN_A_NOEROOM );
+ G_TriggerMenu( clientNum, MN_A_NOEROOM );
return;
}
}
@@ -1279,7 +1279,7 @@ void Cmd_Buy_f( gentity_t *ent )
//already got this?
if( BG_gotWeapon( weapon, ent->client->ps.stats ) )
{
- G_AddPredictableEvent( ent, EV_MENU, MN_H_ITEMHELD );
+ G_TriggerMenu( ent->client->ps.clientNum, MN_H_ITEMHELD );
return;
}
@@ -1292,14 +1292,14 @@ void Cmd_Buy_f( gentity_t *ent )
BG_FindPriceForWeapon( weapon ),
(short)ent->client->ps.persistant[ PERS_CREDIT ] );
- G_AddPredictableEvent( ent, EV_MENU, MN_H_NOFUNDS );
+ G_TriggerMenu( ent->client->ps.clientNum, MN_H_NOFUNDS );
return;
}
//have space to carry this?
if( BG_FindSlotsForWeapon( weapon ) & ent->client->ps.stats[ STAT_SLOTS ] )
{
- G_AddPredictableEvent( ent, EV_MENU, MN_H_NOSLOTS );
+ G_TriggerMenu( ent->client->ps.clientNum, MN_H_NOSLOTS );
return;
}
@@ -1350,14 +1350,14 @@ void Cmd_Buy_f( gentity_t *ent )
//already got this?
if( BG_gotItem( upgrade, ent->client->ps.stats ) )
{
- G_AddPredictableEvent( ent, EV_MENU, MN_H_ITEMHELD );
+ G_TriggerMenu( ent->client->ps.clientNum, MN_H_ITEMHELD );
return;
}
//can afford this?
if( BG_FindPriceForUpgrade( upgrade ) > (short)ent->client->ps.persistant[ PERS_CREDIT ] )
{
- G_AddPredictableEvent( ent, EV_MENU, MN_H_NOFUNDS );
+ G_TriggerMenu( ent->client->ps.clientNum, MN_H_NOFUNDS );
G_LogPrintf( "Client %d buying upgrade %d, value %d, credit %d\n",
ent->client->ps.clientNum,
weapon,
@@ -1370,7 +1370,7 @@ void Cmd_Buy_f( gentity_t *ent )
//have space to carry this?
if( BG_FindSlotsForUpgrade( upgrade ) & ent->client->ps.stats[ STAT_SLOTS ] )
{
- G_AddPredictableEvent( ent, EV_MENU, MN_H_NOSLOTS );
+ G_TriggerMenu( ent->client->ps.clientNum, MN_H_NOSLOTS );
return;
}
@@ -1403,7 +1403,7 @@ void Cmd_Buy_f( gentity_t *ent )
if( clips + newClips > maxClips )
{
//FIXME: different dialog?
- G_AddPredictableEvent( ent, EV_MENU, MN_H_NOSLOTS );
+ G_TriggerMenu( ent->client->ps.clientNum, MN_H_NOSLOTS );
return;
}
else
@@ -1437,7 +1437,7 @@ void Cmd_Buy_f( gentity_t *ent )
G_AddPredictableEvent( ent, EV_NEXT_WEAPON, 0 );
//retrigger the armoury menu
- G_AddPredictableEvent( ent, EV_MENU, MN_H_ARMOURY );
+ ent->client->retriggerArmouryMenu = level.framenum + RAM_FRAMES;
//update ClientInfo
ClientUserinfoChanged( ent->client->ps.clientNum );
@@ -1522,7 +1522,7 @@ void Cmd_Sell_f( gentity_t *ent )
trap_SendServerCommand( ent-g_entities, va( "print \"Unknown item\n\"" ) );
//retrigger the armoury menu
- G_AddPredictableEvent( ent, EV_MENU, MN_H_ARMOURY );
+ ent->client->retriggerArmouryMenu = level.framenum + RAM_FRAMES;
//update ClientInfo
ClientUserinfoChanged( ent->client->ps.clientNum );
@@ -1583,7 +1583,7 @@ void Cmd_Deposit_f( gentity_t *ent )
level.bankCredits[ ent->client->ps.clientNum ] += amount;
}
else
- G_AddPredictableEvent( ent, EV_MENU, MN_H_NOFUNDS );
+ G_TriggerMenu( ent->client->ps.clientNum, MN_H_NOFUNDS );
}
else
trap_SendServerCommand( ent-g_entities, va( "print \"Aliens have no bank\n\"" ) );
@@ -1645,7 +1645,7 @@ void Cmd_Withdraw_f( gentity_t *ent )
level.bankCredits[ ent->client->ps.clientNum ] -= amount;
}
else
- G_AddPredictableEvent( ent, EV_MENU, MN_H_NOFUNDS );
+ G_TriggerMenu( ent->client->ps.clientNum, MN_H_NOFUNDS );
}
else
trap_SendServerCommand( ent-g_entities, va( "print \"Aliens have no bank\n\"" ) );
@@ -1693,35 +1693,35 @@ void Cmd_Build_f( gentity_t *ent )
break;
case IBE_NOASSERT:
- G_AddPredictableEvent( ent, EV_MENU, MN_A_NOASSERT );
+ G_TriggerMenu( ent->client->ps.clientNum, MN_A_NOASSERT );
break;
case IBE_NOHIVEMIND:
- G_AddPredictableEvent( ent, EV_MENU, MN_A_NOHVMND );
+ G_TriggerMenu( ent->client->ps.clientNum, MN_A_NOHVMND );
break;
case IBE_HIVEMIND:
- G_AddPredictableEvent( ent, EV_MENU, MN_A_HIVEMIND );
+ G_TriggerMenu( ent->client->ps.clientNum, MN_A_HIVEMIND );
break;
case IBE_REACTOR:
- G_AddPredictableEvent( ent, EV_MENU, MN_H_REACTOR );
+ G_TriggerMenu( ent->client->ps.clientNum, MN_H_REACTOR );
break;
case IBE_REPEATER:
- G_AddPredictableEvent( ent, EV_MENU, MN_H_REPEATER );
+ G_TriggerMenu( ent->client->ps.clientNum, MN_H_REPEATER );
break;
case IBE_NOPOWER:
- G_AddPredictableEvent( ent, EV_MENU, MN_H_NOPOWER );
+ G_TriggerMenu( ent->client->ps.clientNum, MN_H_NOPOWER );
break;
case IBE_NOCREEP:
- G_AddPredictableEvent( ent, EV_MENU, MN_A_NOCREEP );
+ G_TriggerMenu( ent->client->ps.clientNum, MN_A_NOCREEP );
break;
case IBE_NODCC:
- G_AddPredictableEvent( ent, EV_MENU, MN_H_NODCC );
+ G_TriggerMenu( ent->client->ps.clientNum, MN_H_NODCC );
break;
}
}
diff --git a/src/game/g_local.h b/src/game/g_local.h
index 7a6c5521..c0fd6981 100644
--- a/src/game/g_local.h
+++ b/src/game/g_local.h
@@ -185,11 +185,10 @@ struct gentity_s
int killedBy; //TA: clientNum of killer
gentity_t *targeted; //TA: true if the player is currently a valid target of a turret
+ vec3_t turretAim; //TA: aim vector for turrets
vec4_t animation; //TA: animated map objects
- vec3_t turretAim; //TA: aim vector for turrets
-
gentity_t *builder; //TA: occupant of this hovel
qboolean nonSegModel; //TA: this entity uses a nonsegmented player model
@@ -363,6 +362,9 @@ struct gclient_s
int lastFlameBall; //TA: s.number of the last flame ball fired
int lastRefilTime; //TA: last time human got a refil from rpt/rctr
+
+#define RAM_FRAMES 1 //TA: number of frames to wait before retriggering
+ int retriggerArmouryMenu; //TA: frame number to retrigger the armoury menu
};
#define MAX_LOCDAMAGE_TEXT 8192
@@ -588,6 +590,8 @@ void G_SetOrigin( gentity_t *ent, vec3_t origin );
void AddRemap(const char *oldShader, const char *newShader, float timeOffset);
const char *BuildShaderStateConfig();
+void G_TriggerMenu( int clientNum, dynMenu_t menu );
+
//
// g_combat.c
//
diff --git a/src/game/g_main.c b/src/game/g_main.c
index 584fe4b4..5e472b44 100644
--- a/src/game/g_main.c
+++ b/src/game/g_main.c
@@ -236,13 +236,17 @@ void QDECL G_Printf( const char *fmt, ... )
{
va_list argptr;
char text[ 1024 ];
+ char clientText[ 1048 ];
va_start( argptr, fmt );
vsprintf( text, fmt, argptr );
va_end( argptr );
if( !g_dedicated.integer )
- trap_SendServerCommand( -1, va( "gprintf \"%s\"", text ) );
+ {
+ Com_sprintf( clientText, 1048, "gprintf \"%s\"", text );
+ trap_SendServerCommand( -1, clientText );
+ }
trap_Printf( text );
}
diff --git a/src/game/g_utils.c b/src/game/g_utils.c
index 708c3799..3c5ef2e2 100644
--- a/src/game/g_utils.c
+++ b/src/game/g_utils.c
@@ -726,6 +726,20 @@ qboolean G_Visible( gentity_t *ent1, gentity_t *ent2 )
return qtrue;
}
+/*
+===============
+G_TriggerMenu
+
+Trigger a menu on some client
+===============
+*/
+void G_TriggerMenu( int clientNum, dynMenu_t menu )
+{
+ char buffer[ 32 ];
+
+ Com_sprintf( buffer, 32, "servermenu %d", menu );
+ trap_SendServerCommand( clientNum, buffer );
+}
/*
================
diff --git a/src/game/g_weapon.c b/src/game/g_weapon.c
index 11eb3b0c..968b2149 100644
--- a/src/game/g_weapon.c
+++ b/src/game/g_weapon.c
@@ -482,7 +482,7 @@ void buildFire( gentity_t *ent, dynMenu_t menu )
return;
}
- G_AddPredictableEvent( ent, EV_MENU, menu );
+ G_TriggerMenu( ent->client->ps.clientNum, menu );
}