codemp/cgame/cg_consolecmds.c File Reference

#include "cg_local.h"
#include "../ui/ui_shared.h"
#include "bg_saga.h"

Go to the source code of this file.

Data Structures

struct  consoleCommand_t

Functions

void CG_TargetCommand_f (void)
void Menu_Reset ()
void CG_SiegeBriefingDisplay (int team, int dontshow)
qboolean CG_ConsoleCommand (void)
void CG_InitConsoleCommands (void)

Variables

menuDef_tmenuScoreboard


Function Documentation

qboolean CG_ConsoleCommand void   ) 
 

Definition at line 309 of file cg_consolecmds.c.

References CG_Argv(), consoleCommand_t::function, Q_stricmp(), qboolean, qfalse, and qtrue.

Referenced by vmMain().

00309                                    {
00310         const char      *cmd;
00311         int             i;
00312 
00313         cmd = CG_Argv(0);
00314 
00315         for ( i = 0 ; i < sizeof( commands ) / sizeof( commands[0] ) ; i++ ) {
00316                 if ( !Q_stricmp( cmd, commands[i].cmd ) ) {
00317                         commands[i].function();
00318                         return qtrue;
00319                 }
00320         }
00321 
00322         return qfalse;
00323 }

void CG_InitConsoleCommands void   ) 
 

Definition at line 334 of file cg_consolecmds.c.

References trap_AddCommand().

Referenced by CG_Init().

00334                                     {
00335         int             i;
00336 
00337         for ( i = 0 ; i < sizeof( commands ) / sizeof( commands[0] ) ; i++ ) {
00338                 trap_AddCommand( commands[i].cmd );
00339         }
00340 
00341         //
00342         // the game server will interpret these commands, which will be automatically
00343         // forwarded to the server after they are not recognized locally
00344         //
00345         trap_AddCommand ("forcechanged");
00346         trap_AddCommand ("sv_invnext");
00347         trap_AddCommand ("sv_invprev");
00348         trap_AddCommand ("sv_forcenext");
00349         trap_AddCommand ("sv_forceprev");
00350         trap_AddCommand ("sv_saberswitch");
00351         trap_AddCommand ("engage_duel");
00352         trap_AddCommand ("force_heal");
00353         trap_AddCommand ("force_speed");
00354         trap_AddCommand ("force_throw");
00355         trap_AddCommand ("force_pull");
00356         trap_AddCommand ("force_distract");
00357         trap_AddCommand ("force_rage");
00358         trap_AddCommand ("force_protect");
00359         trap_AddCommand ("force_absorb");
00360         trap_AddCommand ("force_healother");
00361         trap_AddCommand ("force_forcepowerother");
00362         trap_AddCommand ("force_seeing");
00363         trap_AddCommand ("use_seeker");
00364         trap_AddCommand ("use_field");
00365         trap_AddCommand ("use_bacta");
00366         trap_AddCommand ("use_electrobinoculars");
00367         trap_AddCommand ("zoom");
00368         trap_AddCommand ("use_sentry");
00369         trap_AddCommand ("bot_order");
00370         trap_AddCommand ("saberAttackCycle");
00371         trap_AddCommand ("kill");
00372         trap_AddCommand ("say");
00373         trap_AddCommand ("say_team");
00374         trap_AddCommand ("tell");
00375         trap_AddCommand ("give");
00376         trap_AddCommand ("god");
00377         trap_AddCommand ("notarget");
00378         trap_AddCommand ("noclip");
00379         trap_AddCommand ("team");
00380         trap_AddCommand ("follow");
00381         trap_AddCommand ("levelshot");
00382         trap_AddCommand ("addbot");
00383         trap_AddCommand ("setviewpos");
00384         trap_AddCommand ("callvote");
00385         trap_AddCommand ("vote");
00386         trap_AddCommand ("callteamvote");
00387         trap_AddCommand ("teamvote");
00388         trap_AddCommand ("stats");
00389         trap_AddCommand ("teamtask");
00390         trap_AddCommand ("loaddefered");        // spelled wrong, but not changing for demo
00391 }

void CG_SiegeBriefingDisplay int  team,
int  dontshow
 

Definition at line 720 of file cg_saga.c.

References BG_SiegeGetPairedValue(), BG_SiegeGetValueGroup(), CG_DrawSiegeMessage(), CG_SiegeGetObjectiveDescription(), CG_SiegeGetObjectiveFinal(), Com_sprintf(), qboolean, qfalse, qtrue, siege_info, siege_valid, SIEGETEAM_TEAM1, SIEGETEAM_TEAM2, TEAM_SPECTATOR, trap_Cvar_Set(), trap_Cvar_VariableStringBuffer(), and va().

00721 {
00722         char                    teamstr[64];
00723         char                    briefing[8192];
00724         char                    properValue[1024];
00725         char                    objectiveDesc[1024];
00726         int                             i = 1;
00727         int                             useTeam = team;
00728         qboolean                primary = qfalse;
00729 
00730         if (!siege_valid)
00731         {
00732                 return;
00733         }
00734 
00735         if (team == TEAM_SPECTATOR)
00736         {
00737                 return;
00738         }
00739 
00740         if (team == SIEGETEAM_TEAM1)
00741         {
00742                 Com_sprintf(teamstr, sizeof(teamstr), team1);
00743         }
00744         else
00745         {
00746                 Com_sprintf(teamstr, sizeof(teamstr), team2);
00747         }
00748 
00749         if (useTeam != SIEGETEAM_TEAM1 && useTeam != SIEGETEAM_TEAM2)
00750         { //This shouldn't be happening. But just fall back to team 2 anyway.
00751                 useTeam = SIEGETEAM_TEAM2;
00752         }
00753 
00754         trap_Cvar_Set(va("siege_primobj_inuse"), "0");
00755 
00756         while (i < 16)
00757         { //do up to 16 objectives I suppose
00758                 //Get the value for this objective on this team
00759                 //Now set the cvar for the menu to display.
00760                 
00761                 //primary = (CG_SiegeGetObjectiveFinal(useTeam, i)>-1)?qtrue:qfalse;
00762                 primary = (CG_SiegeGetObjectiveFinal(useTeam, i)>0)?qtrue:qfalse;
00763 
00764                 properValue[0] = 0;
00765                 trap_Cvar_VariableStringBuffer(va("team%i_objective%i", useTeam, i), properValue, 1024);
00766                 if (primary)
00767                 {
00768                         trap_Cvar_Set(va("siege_primobj"), properValue);
00769                 }
00770                 else
00771                 {
00772                         trap_Cvar_Set(va("siege_objective%i", i), properValue);
00773                 }
00774 
00775                 //Now set the long desc cvar for the menu to display.
00776                 properValue[0] = 0;
00777                 trap_Cvar_VariableStringBuffer(va("team%i_objective%i_longdesc", useTeam, i), properValue, 1024);
00778                 if (primary)
00779                 {
00780                         trap_Cvar_Set(va("siege_primobj_longdesc"), properValue);
00781                 }
00782                 else
00783                 {
00784                         trap_Cvar_Set(va("siege_objective%i_longdesc", i), properValue);
00785                 }
00786 
00787                 //Now set the gfx cvar for the menu to display.
00788                 properValue[0] = 0;
00789                 trap_Cvar_VariableStringBuffer(va("team%i_objective%i_gfx", useTeam, i), properValue, 1024);
00790                 if (primary)
00791                 {
00792                         trap_Cvar_Set(va("siege_primobj_gfx"), properValue);
00793                 }
00794                 else
00795                 {
00796                         trap_Cvar_Set(va("siege_objective%i_gfx", i), properValue);
00797                 }
00798 
00799                 //Now set the mapicon cvar for the menu to display.
00800                 properValue[0] = 0;
00801                 trap_Cvar_VariableStringBuffer(va("team%i_objective%i_mapicon", useTeam, i), properValue, 1024);
00802                 if (primary)
00803                 {
00804                         trap_Cvar_Set(va("siege_primobj_mapicon"), properValue);
00805                 }
00806                 else
00807                 {
00808                         trap_Cvar_Set(va("siege_objective%i_mapicon", i), properValue);
00809                 }
00810 
00811                 //Now set the mappos cvar for the menu to display.
00812                 properValue[0] = 0;
00813                 trap_Cvar_VariableStringBuffer(va("team%i_objective%i_mappos", useTeam, i), properValue, 1024);
00814                 if (primary)
00815                 {
00816                         trap_Cvar_Set(va("siege_primobj_mappos"), properValue);
00817                 }
00818                 else
00819                 {
00820                         trap_Cvar_Set(va("siege_objective%i_mappos", i), properValue);
00821                 }
00822 
00823                 //Now set the description cvar for the objective
00824                 CG_SiegeGetObjectiveDescription(useTeam, i, objectiveDesc);
00825 
00826                 if (objectiveDesc[0])
00827                 { //found a valid objective description
00828                         if ( primary )
00829                         {
00830                                 trap_Cvar_Set(va("siege_primobj_desc"), objectiveDesc);
00831                                 //this one is marked not in use because it gets primobj
00832                                 trap_Cvar_Set(va("siege_objective%i_inuse", i), "0");
00833                                 trap_Cvar_Set(va("siege_primobj_inuse"), "1");
00834 
00835                                 trap_Cvar_Set(va("team%i_objective%i_inuse", useTeam, i), "1");
00836 
00837                         }
00838                         else
00839                         {
00840                                 trap_Cvar_Set(va("siege_objective%i_desc", i), objectiveDesc);
00841                                 trap_Cvar_Set(va("siege_objective%i_inuse", i), "2");
00842                                 trap_Cvar_Set(va("team%i_objective%i_inuse", useTeam, i), "2");
00843 
00844                         }
00845                 }
00846                 else
00847                 { //didn't find one, so set the "inuse" cvar to 0 for the objective and mark it non-complete.
00848                         trap_Cvar_Set(va("siege_objective%i_inuse", i), "0");
00849                         trap_Cvar_Set(va("siege_objective%i", i), "0");
00850                         trap_Cvar_Set(va("team%i_objective%i_inuse", useTeam, i), "0");
00851                         trap_Cvar_Set(va("team%i_objective%i", useTeam, i), "0");
00852 
00853                         trap_Cvar_Set(va("siege_objective%i_mappos", i), "");
00854                         trap_Cvar_Set(va("team%i_objective%i_mappos", useTeam, i), "");
00855                         trap_Cvar_Set(va("siege_objective%i_gfx", i), "");
00856                         trap_Cvar_Set(va("team%i_objective%i_gfx", useTeam, i), "");
00857                         trap_Cvar_Set(va("siege_objective%i_mapicon", i), "");
00858                         trap_Cvar_Set(va("team%i_objective%i_mapicon", useTeam, i), "");
00859                 }
00860 
00861                 i++;
00862         }
00863 
00864         if (dontshow)
00865         {
00866                 return;
00867         }
00868 
00869         if (BG_SiegeGetValueGroup(siege_info, teamstr, cgParseObjectives))
00870         {
00871                 if (BG_SiegeGetPairedValue(cgParseObjectives, "briefing", briefing))
00872                 {
00873                         CG_DrawSiegeMessage(briefing, 1);
00874                 }
00875         }
00876 }

void CG_TargetCommand_f void   ) 
 

Definition at line 13 of file cg_consolecmds.c.

References atoi(), CG_CrosshairPlayer(), trap_Argv(), trap_SendConsoleCommand(), and va().

00013                                 {
00014         int             targetNum;
00015         char    test[4];
00016 
00017         targetNum = CG_CrosshairPlayer();
00018         if (!targetNum ) {
00019                 return;
00020         }
00021 
00022         trap_Argv( 1, test, 4 );
00023         trap_SendConsoleCommand( va( "gc %i %i", targetNum, atoi( test ) ) );
00024 }

void Menu_Reset  ) 
 

Definition at line 9850 of file ui_shared.c.

Referenced by CG_LoadHudMenu(), UI_LoadMenus(), and vmMain().

09850                   {
09851         menuCount = 0;
09852 }


Variable Documentation

menuDef_t * menuScoreboard
 

Definition at line 9 of file cg_consolecmds.c.