diff options
-rw-r--r-- | src/cgame/cg_local.h | 12 | ||||
-rw-r--r-- | src/cgame/cg_main.c | 6 | ||||
-rw-r--r-- | src/cgame/cg_servercmds.c | 71 | ||||
-rw-r--r-- | src/game/bg_public.h | 1 | ||||
-rw-r--r-- | src/game/g_cmds.c | 2 |
5 files changed, 91 insertions, 1 deletions
diff --git a/src/cgame/cg_local.h b/src/cgame/cg_local.h index 540d3d62..3f4a0d80 100644 --- a/src/cgame/cg_local.h +++ b/src/cgame/cg_local.h @@ -1508,6 +1508,9 @@ extern vmCvar_t cg_debugParticles; extern vmCvar_t cg_debugTrails; extern vmCvar_t cg_debugPVS; extern vmCvar_t cg_disableWarningDialogs; +extern vmCvar_t cg_disableUpgradeDialogs; +extern vmCvar_t cg_disableBuildDialogs; +extern vmCvar_t cg_disableCommandDialogs; extern vmCvar_t cg_disableScannerPlane; extern vmCvar_t cg_tutorial; @@ -2070,3 +2073,12 @@ void trap_GetDemoName( char *buffer, int size ); #define CROSSHAIR_RANGEDONLY 1 #define CROSSHAIR_ALWAYSON 2 +// menu types for cg_disable*Dialogs +typedef enum +{ + DT_INTERACTIVE, // team, class, armoury + DT_ARMOURYEVOLVE, // Insufficient funds et al + DT_BUILD, // build errors + DT_COMMAND, // You must be living/human/spec etc. + +} dialogType_t; diff --git a/src/cgame/cg_main.c b/src/cgame/cg_main.c index 7ad1c21f..f07df10f 100644 --- a/src/cgame/cg_main.c +++ b/src/cgame/cg_main.c @@ -215,6 +215,9 @@ vmCvar_t cg_debugParticles; vmCvar_t cg_debugTrails; vmCvar_t cg_debugPVS; vmCvar_t cg_disableWarningDialogs; +vmCvar_t cg_disableUpgradeDialogs; +vmCvar_t cg_disableBuildDialogs; +vmCvar_t cg_disableCommandDialogs; vmCvar_t cg_disableScannerPlane; vmCvar_t cg_tutorial; @@ -336,6 +339,9 @@ static cvarTable_t cvarTable[ ] = { &cg_debugTrails, "cg_debugTrails", "0", CVAR_CHEAT }, { &cg_debugPVS, "cg_debugPVS", "0", CVAR_CHEAT }, { &cg_disableWarningDialogs, "cg_disableWarningDialogs", "0", CVAR_ARCHIVE }, + { &cg_disableUpgradeDialogs, "cg_disableUpgradeDialogs", "0", CVAR_ARCHIVE }, + { &cg_disableBuildDialogs, "cg_disableBuildDialogs", "0", CVAR_ARCHIVE }, + { &cg_disableCommandDialogs, "cg_disableCommandDialogs", "0", CVAR_ARCHIVE }, { &cg_disableScannerPlane, "cg_disableScannerPlane", "0", CVAR_ARCHIVE }, { &cg_tutorial, "cg_tutorial", "1", CVAR_ARCHIVE }, { &cg_hudFiles, "cg_hudFiles", "ui/hud.txt", CVAR_ARCHIVE}, diff --git a/src/cgame/cg_servercmds.c b/src/cgame/cg_servercmds.c index 5c150e97..a6dc1967 100644 --- a/src/cgame/cg_servercmds.c +++ b/src/cgame/cg_servercmds.c @@ -457,6 +457,7 @@ void CG_Menu( int menu, int arg ) const char *longMsg = NULL; // command parameter const char *shortMsg = NULL; // non-modal version of message const char *dialog; + dialogType_t type = 0; // controls which cg_disable var will switch it off switch( cg.snap->ps.stats[ STAT_PTEAM ] ) { @@ -475,50 +476,65 @@ void CG_Menu( int menu, int arg ) { case MN_TEAM: cmd = "menu tremulous_teamselect\n"; + type = DT_INTERACTIVE; break; case MN_A_CLASS: cmd = "menu tremulous_alienclass\n"; + type = DT_INTERACTIVE; break; case MN_H_SPAWN: cmd = "menu tremulous_humanitem\n"; + type = DT_INTERACTIVE; break; case MN_A_BUILD: cmd = "menu tremulous_alienbuild\n"; + type = DT_INTERACTIVE; break; case MN_H_BUILD: cmd = "menu tremulous_humanbuild\n"; + type = DT_INTERACTIVE; break; case MN_H_ARMOURY: cmd = "menu tremulous_humanarmoury\n"; + type = DT_INTERACTIVE; + break; + + case MN_H_UNKNOWNITEM: + shortMsg = "Unknown item"; + type = DT_ARMOURYEVOLVE; break; case MN_A_TEAMFULL: longMsg = "The alien team has too many players. Please wait until slots " "become available or join the human team."; shortMsg = "The alien team has too many players"; + type = DT_COMMAND; break; case MN_H_TEAMFULL: longMsg = "The human team has too many players. Please wait until slots " "become available or join the alien team."; shortMsg = "The human team has too many players"; + type = DT_COMMAND; break; case MN_A_TEAMCHANGEBUILDTIMER: longMsg = "You cannot leave the Alien team until your build timer " "has expired."; shortMsg = "You cannot change teams until your build timer expires."; + type = DT_COMMAND; break; case MN_H_TEAMCHANGEBUILDTIMER: longMsg = "You cannot leave the Human team until your build timer " "has expired."; shortMsg = "You cannot change teams until your build timer expires."; + type = DT_COMMAND; break; //=============================== @@ -530,33 +546,39 @@ void CG_Menu( int menu, int arg ) //longMsg = "This action is considered cheating. It can only be used " // "in cheat mode, which is not enabled on this server."; shortMsg = "Cheats are not enabled on this server"; + type = DT_COMMAND; break; case MN_CMD_TEAM: //longMsg = "You must be on a team to perform this action. Join the alien" // "or human team and try again."; shortMsg = "Join a team first"; + type = DT_COMMAND; break; case MN_CMD_SPEC: //longMsg = "You may not perform this action while on a team. Become a " // "spectator before trying again."; shortMsg = "You can only use this command when spectating"; + type = DT_COMMAND; break; case MN_CMD_ALIEN: //longMsg = "You must be on the alien team to perform this action."; shortMsg = "Must be alien to use this command"; + type = DT_COMMAND; break; case MN_CMD_HUMAN: //longMsg = "You must be on the human team to perform this action."; shortMsg = "Must be human to use this command"; + type = DT_COMMAND; break; case MN_CMD_LIVING: //longMsg = "You must be living to perform this action."; shortMsg = "Must be living to use this command"; + type = DT_COMMAND; break; @@ -566,6 +588,7 @@ void CG_Menu( int menu, int arg ) longMsg = "There is no room to build here. Move until the structure turns " "translucent green indicating a valid build location."; shortMsg = "There is no room to build here"; + type = DT_BUILD; break; case MN_B_NORMAL: @@ -573,11 +596,13 @@ void CG_Menu( int menu, int arg ) "unsuitable to build on. Please choose another site for this " "structure."; shortMsg = "Cannot build on this surface"; + type = DT_BUILD; break; case MN_B_CANNOT: longMsg = NULL; shortMsg = "You cannot build that structure"; + type = DT_BUILD; break; case MN_B_SUDDENDEATH: @@ -585,6 +610,7 @@ void CG_Menu( int menu, int arg ) "game has entered Sudden Death. During Sudden Death " "building is not allowed."; shortMsg = "Cannot build during Sudden Death"; + type = DT_BUILD; break; case MN_B_REVOKED: @@ -592,6 +618,7 @@ void CG_Menu( int menu, int arg ) "for the team. You will not be allowed to build until your " "team votes to reinstate your building rights."; shortMsg = "Your building rights have been revoked"; + type = DT_BUILD; break; @@ -601,77 +628,90 @@ void CG_Menu( int menu, int arg ) longMsg = "There is no power remaining. Free up power by deconstructing " "existing buildable objects."; shortMsg = "There is no power remaining"; + type = DT_BUILD; break; case MN_H_NOTPOWERED: longMsg = "This buildable is not powered. Build a Reactor and/or Repeater " "in order to power it."; shortMsg = "This buildable is not powered"; + type = DT_BUILD; break; case MN_H_ONEREACTOR: longMsg = "There can only be one Reactor. Deconstruct the existing one if you " "wish to move it."; shortMsg = "There can only be one Reactor"; + type = DT_BUILD; break; case MN_H_NOPOWERHERE: longMsg = "There is no power here. If available, a Repeater may be used to " "transmit power to this location."; shortMsg = "There is no power here"; + type = DT_BUILD; break; case MN_H_NODCC: longMsg = "There is no Defense Computer. A Defense Computer is needed to " "build this."; shortMsg = "There is no Defense Computer"; + type = DT_BUILD; break; case MN_H_RPTPOWERHERE: longMsg = "This area already has power. A Repeater is not required here."; shortMsg = "This area already has power"; + type = DT_BUILD; break; case MN_H_NOSLOTS: longMsg = "You have no room to carry this. Please sell any conflicting " "upgrades before purchasing this item."; shortMsg = "You have no room to carry this"; + type = DT_ARMOURYEVOLVE; break; case MN_H_NOFUNDS: longMsg = "Insufficient funds. You do not have enough credits to perform " "this action."; shortMsg = "Insufficient funds"; + type = DT_ARMOURYEVOLVE; break; case MN_H_ITEMHELD: longMsg = "You already hold this item. It is not possible to carry multiple " "items of the same type."; shortMsg = "You already hold this item"; + type = DT_ARMOURYEVOLVE; break; case MN_H_NOARMOURYHERE: longMsg = "You must be near a powered Armoury in order to purchase " "weapons, upgrades or non-energy ammunition."; shortMsg = "You must be near a powered Armoury"; + type = DT_ARMOURYEVOLVE; break; case MN_H_NOENERGYAMMOHERE: longMsg = "You must be near an Armoury, Reactor or Repeater in order " "to purchase energy ammunition."; shortMsg = "You must be near an Armoury, Reactor or Repeater"; + type = DT_ARMOURYEVOLVE; break; case MN_H_NOROOMBSUITON: longMsg = "There is not enough room here to put on a Battle Suit. " "Make sure you have enough head room to climb in."; shortMsg = "Not enough room here to put on a Battle Suit"; + type = DT_ARMOURYEVOLVE; break; case MN_H_NOROOMBSUITOFF: longMsg = "There is not enough room here to take off your Battle Suit. " "Make sure you have enough head room to climb out."; shortMsg = "Not enough room here to take off your Battle Suit"; + type = DT_ARMOURYEVOLVE; break; case MN_H_ARMOURYBUILDTIMER: @@ -679,14 +719,17 @@ void CG_Menu( int menu, int arg ) "build timer has expired."; shortMsg = "You can not buy or sell weapos until your build timer " "expires"; + type = DT_ARMOURYEVOLVE; break; case MN_H_DEADTOCLASS: shortMsg = "You must be dead to use the class command"; + type = DT_COMMAND; break; case MN_H_UNKNOWNSPAWNITEM: shortMsg = "Unknown starting item"; + type = DT_COMMAND; break; //=============================== @@ -695,36 +738,42 @@ void CG_Menu( int menu, int arg ) longMsg = "There is no creep here. You must build near existing Eggs or " "the Overmind. Alien structures will not support themselves."; shortMsg = "There is no creep here"; + type = DT_BUILD; break; case MN_A_NOOVMND: longMsg = "There is no Overmind. An Overmind must be built to control " "the structure you tried to place"; shortMsg = "There is no Overmind"; + type = DT_BUILD; break; case MN_A_ONEOVERMIND: longMsg = "There can only be one Overmind. Deconstruct the existing one if you " "wish to move it."; shortMsg = "There can only be one Overmind"; + type = DT_BUILD; break; case MN_A_ONEHOVEL: longMsg = "There can only be one Hovel. Deconstruct the existing one if you " "wish to move it."; shortMsg = "There can only be one Hovel"; + type = DT_BUILD; break; case MN_A_NOBP: longMsg = "The Overmind cannot control any more structures. Deconstruct existing " "structures to build more."; shortMsg = "The Overmind cannot control any more structures"; + type = DT_BUILD; break; case MN_A_NOEROOM: longMsg = "There is no room to evolve here. Move away from walls or other " "nearby objects and try again."; shortMsg = "There is no room to evolve here"; + type = DT_ARMOURYEVOLVE; break; case MN_A_TOOCLOSE: @@ -732,75 +781,97 @@ void CG_Menu( int menu, int arg ) "until you are no longer aware of the enemy's presence and try " "again."; shortMsg = "This location is too close to the enemy to evolve"; + type = DT_ARMOURYEVOLVE; break; case MN_A_NOOVMND_EVOLVE: longMsg = "There is no Overmind. An Overmind must be built to allow " "you to upgrade."; shortMsg = "There is no Overmind"; + type = DT_ARMOURYEVOLVE; break; case MN_A_EVOLVEBUILDTIMER: longMsg = "You cannot Evolve until your build timer has expired."; shortMsg = "You cannot Evolve until your build timer expires"; + type = DT_ARMOURYEVOLVE; break; case MN_A_HOVEL_OCCUPIED: longMsg = "This Hovel is already occupied by another builder."; shortMsg = "This Hovel is already occupied by another builder"; + type = DT_COMMAND; break; case MN_A_HOVEL_BLOCKED: longMsg = "The exit to this Hovel is currently blocked. Please wait until it " "becomes clear then try again."; shortMsg = "The exit to this Hovel is currently blocked"; + type = DT_COMMAND; break; case MN_A_HOVEL_EXIT: longMsg = "The exit to this Hovel would always be blocked. Please choose " "a more suitable location."; shortMsg = "The exit to this Hovel would always be blocked"; + type = DT_BUILD; break; case MN_A_INFEST: trap_Cvar_Set( "ui_currentClass", va( "%d %d", cg.snap->ps.stats[ STAT_PCLASS ], cg.snap->ps.persistant[ PERS_CREDIT ] ) ); cmd = "menu tremulous_alienupgrade\n"; + type = DT_INTERACTIVE; break; case MN_A_CANTEVOLVE: shortMsg = va( "You cannot evolve to %s", BG_FindHumanNameForClassNum( arg ) ); + type = DT_ARMOURYEVOLVE; break; case MN_A_EVOLVEWALLWALK: shortMsg = "You cannot evolve while wallwalking"; + type = DT_ARMOURYEVOLVE; break; case MN_A_UNKNOWNCLASS: shortMsg = "Unknown class"; + type = DT_ARMOURYEVOLVE; break; case MN_A_CLASSNOTSPAWN: shortMsg = va( "You cannot spawn as %s", BG_FindHumanNameForClassNum( arg ) ); + type = DT_ARMOURYEVOLVE; break; case MN_A_CLASSNOTALLOWED: shortMsg = va( "%s is not allowed", BG_FindHumanNameForClassNum( arg ) ); + type = DT_ARMOURYEVOLVE; break; case MN_A_CLASSNOTATSTAGE: shortMsg = va( "%s is not allowed at Stage %d", BG_FindHumanNameForClassNum( arg ), cgs.alienStage + 1 ); + type = DT_ARMOURYEVOLVE; break; default: Com_Printf( "cgame: debug: no such menu %d\n", menu ); } + if( type == DT_ARMOURYEVOLVE && cg_disableUpgradeDialogs.integer ) + return; + + if( type == DT_BUILD && cg_disableBuildDialogs.integer ) + return; + + if( type == DT_COMMAND && cg_disableCommandDialogs.integer ) + return; + if( cmd != dialog ) { trap_SendConsoleCommand( cmd ); diff --git a/src/game/bg_public.h b/src/game/bg_public.h index 64ce67d5..18c0d28f 100644 --- a/src/game/bg_public.h +++ b/src/game/bg_public.h @@ -620,6 +620,7 @@ typedef enum MN_H_SPAWN, MN_H_BUILD, MN_H_ARMOURY, + MN_H_UNKNOWNITEM, MN_H_NOSLOTS, MN_H_NOFUNDS, MN_H_ITEMHELD, diff --git a/src/game/g_cmds.c b/src/game/g_cmds.c index 98e23ba3..29a2acc4 100644 --- a/src/game/g_cmds.c +++ b/src/game/g_cmds.c @@ -2135,7 +2135,7 @@ void Cmd_Buy_f( gentity_t *ent ) } else { - trap_SendServerCommand( ent-g_entities, va( "print \"Unknown item\n\"" ) ); + G_TriggerMenu( ent->client->ps.clientNum, MN_H_UNKNOWNITEM ); } //update ClientInfo |