codemp/game/g_cmds.c File Reference

#include "g_local.h"
#include "bg_saga.h"
#include "../../ui/menudef.h"
#include "../namespace_begin.h"
#include "../namespace_end.h"

Go to the source code of this file.

Defines

#define EC   "\x19"

Functions

int AcceptBotCommand (char *cmd, gentity_t *pl)
void WP_SetSaber (int entNum, saberInfo_t *sabers, int saberNum, const char *saberName)
void Cmd_NPC_f (gentity_t *ent)
void SetTeamQuick (gentity_t *ent, int team, qboolean doBegin)
void DeathmatchScoreboardMessage (gentity_t *ent)
void Cmd_Score_f (gentity_t *ent)
qboolean CheatsOk (gentity_t *ent)
char * ConcatArgs (int start)
void SanitizeString (char *in, char *out)
int ClientNumberFromString (gentity_t *to, char *s)
void Cmd_Give_f (gentity_t *cmdent, int baseArg)
void Cmd_God_f (gentity_t *ent)
void Cmd_Notarget_f (gentity_t *ent)
void Cmd_Noclip_f (gentity_t *ent)
void Cmd_LevelShot_f (gentity_t *ent)
void Cmd_TeamTask_f (gentity_t *ent)
void Cmd_Kill_f (gentity_t *ent)
gentity_tG_GetDuelWinner (gclient_t *client)
void BroadcastTeamChange (gclient_t *client, int oldTeam)
qboolean G_PowerDuelCheckFail (gentity_t *ent)
void SetTeam (gentity_t *ent, char *s)
void StopFollowing (gentity_t *ent)
void Cmd_Team_f (gentity_t *ent)
void Cmd_DuelTeam_f (gentity_t *ent)
int G_TeamForSiegeClass (const char *clName)
void Cmd_SiegeClass_f (gentity_t *ent)
void Cmd_ForceChanged_f (gentity_t *ent)
qboolean WP_SaberStyleValidForSaber (saberInfo_t *saber1, saberInfo_t *saber2, int saberHolstered, int saberAnimLevel)
qboolean WP_UseFirstValidSaberStyle (saberInfo_t *saber1, saberInfo_t *saber2, int saberHolstered, int *saberAnimLevel)
qboolean G_SetSaber (gentity_t *ent, int saberNum, char *saberName, qboolean siegeOverride)
void Cmd_Follow_f (gentity_t *ent)
void Cmd_FollowCycle_f (gentity_t *ent, int dir)
void G_Say (gentity_t *ent, gentity_t *target, int mode, const char *chatText)
void Cmd_GameCommand_f (gentity_t *ent)
void Cmd_Where_f (gentity_t *ent)
int G_ClientNumberFromName (const char *name)
void SanitizeString2 (char *in, char *out)
int G_ClientNumberFromStrippedName (const char *name)
void SiegeClearSwitchData (void)
const char * G_GetArenaInfoByMap (const char *map)
void Cmd_CallVote_f (gentity_t *ent)
void Cmd_Vote_f (gentity_t *ent)
void Cmd_CallTeamVote_f (gentity_t *ent)
void Cmd_TeamVote_f (gentity_t *ent)
void Cmd_SetViewpos_f (gentity_t *ent)
void Cmd_Stats_f (gentity_t *ent)
int G_ItemUsable (playerState_t *ps, int forcedUse)
void saberKnockDown (gentity_t *saberent, gentity_t *saberOwner, gentity_t *other)
void Cmd_ToggleSaber_f (gentity_t *ent)
qboolean WP_SaberCanTurnOffSomeBlades (saberInfo_t *saber)
void Cmd_SaberAttackCycle_f (gentity_t *ent)
qboolean G_OtherPlayersDueling (void)
void Cmd_EngageDuel_f (gentity_t *ent)
void Cmd_DebugSetSaberMove_f (gentity_t *self)
void Cmd_DebugSetBodyAnim_f (gentity_t *self, int flags)
void StandardSetBodyAnim (gentity_t *self, int anim, int flags)
void DismembermentTest (gentity_t *self)
void Bot_SetForcedMovement (int bot, int forward, int right, int up)
void DismembermentByNum (gentity_t *self, int num)
void G_SetVehDamageFlags (gentity_t *veh, int shipSurf, int damageLevel)
qboolean TryGrapple (gentity_t *ent)
qboolean saberKnockOutOfHand (gentity_t *saberent, gentity_t *saberOwner, vec3_t velocity)
void ClientCommand (int clientNum)

Variables

qboolean g_dontPenalizeTeam = qfalse
qboolean g_preventTeamBegin = qfalse
vmCvar_t d_saberStanceDebug
stringID_table_t animTable [MAX_ANIMATIONS+1]


Define Documentation

#define EC   "\x19"
 

Definition at line 1525 of file g_cmds.c.

Referenced by G_Say().


Function Documentation

int AcceptBotCommand char *  cmd,
gentity_t pl
 

Definition at line 3501 of file ai_wpnav.c.

References atoi(), gentity_s::client, ConcatArgs(), CreateNewWP(), CreateNewWP_InTrail(), entityShared_t::currentOrigin, CVAR_ROM, CVAR_SERVERINFO, wpobject_s::flags, G_Printf(), gBotEdit, gDeactivated, gentity_t, GetClosestSpawn(), GetNextSpawnInIndex(), gWPArray, gWPNum, wpobject_s::inuse, NULL, playerState_s::origin, gclient_s::ps, Q_stricmp(), gentity_s::r, RemoveWP(), RemoveWP_InTrail(), S_COLOR_WHITE, S_COLOR_YELLOW, SavePathData(), vmCvar_t::string, TeleportToWP(), trap_Cvar_Register(), VectorCopy, WPFLAG_DUCK, WPFLAG_GOALPOINT, WPFLAG_JUMP, WPFLAG_NOMOVEFUNC, WPFLAG_NOVIS, WPFLAG_ONEWAY_BACK, WPFLAG_ONEWAY_FWD, WPFLAG_SNIPEORCAMP, WPFLAG_SNIPEORCAMPSTAND, WPFLAG_WAITFORFUNC, and WPFlagsModify().

Referenced by ClientCommand().

03502 {
03503         int OptionalArgument, i;
03504         int FlagsFromArgument;
03505         char *OptionalSArgument, *RequiredSArgument;
03506 #ifndef _XBOX
03507         vmCvar_t mapname;
03508 #endif
03509 
03510         if (!gBotEdit)
03511         {
03512                 return 0;
03513         }
03514 
03515         OptionalArgument = 0;
03516         i = 0;
03517         FlagsFromArgument = 0;
03518         OptionalSArgument = NULL;
03519         RequiredSArgument = NULL;
03520 
03521         //if a waypoint editing related command is issued, bots will deactivate.
03522         //once bot_wp_save is issued and the trail is recalculated, bots will activate again.
03523 
03524         if (!pl || !pl->client)
03525         {
03526                 return 0;
03527         }
03528 
03529         if (Q_stricmp (cmd, "bot_wp_cmdlist") == 0) //lists all the bot waypoint commands.
03530         {
03531                 G_Printf(S_COLOR_YELLOW "bot_wp_add" S_COLOR_WHITE " - Add a waypoint (optional int parameter will insert the point after the specified waypoint index in a trail)\n\n");
03532                 G_Printf(S_COLOR_YELLOW "bot_wp_rem" S_COLOR_WHITE " - Remove a waypoint (removes last unless waypoint index is specified as a parameter)\n\n");
03533                 G_Printf(S_COLOR_YELLOW "bot_wp_addflagged" S_COLOR_WHITE " - Same as wp_add, but adds a flagged point (type bot_wp_addflagged for help)\n\n");
03534                 G_Printf(S_COLOR_YELLOW "bot_wp_switchflags" S_COLOR_WHITE " - Switches flags on an existing waypoint (type bot_wp_switchflags for help)\n\n");
03535                 G_Printf(S_COLOR_YELLOW "bot_wp_tele" S_COLOR_WHITE " - Teleport yourself to the specified waypoint's location\n");
03536                 G_Printf(S_COLOR_YELLOW "bot_wp_killoneways" S_COLOR_WHITE " - Removes oneway (backward and forward) flags on all waypoints in the level\n\n");
03537                 G_Printf(S_COLOR_YELLOW "bot_wp_save" S_COLOR_WHITE " - Saves all waypoint data into a file for later use\n");
03538 
03539                 return 1;
03540         }
03541 
03542         if (Q_stricmp (cmd, "bot_wp_add") == 0)
03543         {
03544                 gDeactivated = 1;
03545                 OptionalSArgument = ConcatArgs( 1 );
03546 
03547                 if (OptionalSArgument)
03548                 {
03549                         OptionalArgument = atoi(OptionalSArgument);
03550                 }
03551 
03552                 if (OptionalSArgument && OptionalSArgument[0])
03553                 {
03554                         CreateNewWP_InTrail(pl->client->ps.origin, 0, OptionalArgument);
03555                 }
03556                 else
03557                 {
03558                         CreateNewWP(pl->client->ps.origin, 0);
03559                 }
03560                 return 1;
03561         }
03562 
03563         if (Q_stricmp (cmd, "bot_wp_rem") == 0)
03564         {
03565                 gDeactivated = 1;
03566 
03567                 OptionalSArgument = ConcatArgs( 1 );
03568 
03569                 if (OptionalSArgument)
03570                 {
03571                         OptionalArgument = atoi(OptionalSArgument);
03572                 }
03573 
03574                 if (OptionalSArgument && OptionalSArgument[0])
03575                 {
03576                         RemoveWP_InTrail(OptionalArgument);
03577                 }
03578                 else
03579                 {
03580                         RemoveWP();
03581                 }
03582 
03583                 return 1;
03584         }
03585 
03586         if (Q_stricmp (cmd, "bot_wp_tele") == 0)
03587         {
03588                 gDeactivated = 1;
03589                 OptionalSArgument = ConcatArgs( 1 );
03590 
03591                 if (OptionalSArgument)
03592                 {
03593                         OptionalArgument = atoi(OptionalSArgument);
03594                 }
03595 
03596                 if (OptionalSArgument && OptionalSArgument[0])
03597                 {
03598                         TeleportToWP(pl, OptionalArgument);
03599                 }
03600                 else
03601                 {
03602                         G_Printf(S_COLOR_YELLOW "You didn't specify an index. Assuming last.\n");
03603                         TeleportToWP(pl, gWPNum-1);
03604                 }
03605                 return 1;
03606         }
03607 
03608         if (Q_stricmp (cmd, "bot_wp_spawntele") == 0)
03609         {
03610                 gentity_t *closestSpawn = GetClosestSpawn(pl);
03611 
03612                 if (!closestSpawn)
03613                 { //There should always be a spawn point..
03614                         return 1;
03615                 }
03616 
03617                 closestSpawn = GetNextSpawnInIndex(closestSpawn);
03618 
03619                 if (closestSpawn)
03620                 {
03621                         VectorCopy(closestSpawn->r.currentOrigin, pl->client->ps.origin);
03622                 }
03623                 return 1;
03624         }
03625 
03626         if (Q_stricmp (cmd, "bot_wp_addflagged") == 0)
03627         {
03628                 gDeactivated = 1;
03629 
03630                 RequiredSArgument = ConcatArgs( 1 );
03631 
03632                 if (!RequiredSArgument || !RequiredSArgument[0])
03633                 {
03634                         G_Printf(S_COLOR_YELLOW "Flag string needed for bot_wp_addflagged\nj - Jump point\nd - Duck point\nc - Snipe or camp standing\nf - Wait for func\nm - Do not move to when func is under\ns - Snipe or camp\nx - Oneway, forward\ny - Oneway, back\ng - Mission goal\nn - No visibility\nExample (for a point the bot would jump at, and reverse on when traveling a trail backwards):\nbot_wp_addflagged jx\n");
03635                         return 1;
03636                 }
03637 
03638                 while (RequiredSArgument[i])
03639                 {
03640                         if (RequiredSArgument[i] == 'j')
03641                         {
03642                                 FlagsFromArgument |= WPFLAG_JUMP;
03643                         }
03644                         else if (RequiredSArgument[i] == 'd')
03645                         {
03646                                 FlagsFromArgument |= WPFLAG_DUCK;
03647                         }
03648                         else if (RequiredSArgument[i] == 'c')
03649                         {
03650                                 FlagsFromArgument |= WPFLAG_SNIPEORCAMPSTAND;
03651                         }
03652                         else if (RequiredSArgument[i] == 'f')
03653                         {
03654                                 FlagsFromArgument |= WPFLAG_WAITFORFUNC;
03655                         }
03656                         else if (RequiredSArgument[i] == 's')
03657                         {
03658                                 FlagsFromArgument |= WPFLAG_SNIPEORCAMP;
03659                         }
03660                         else if (RequiredSArgument[i] == 'x')
03661                         {
03662                                 FlagsFromArgument |= WPFLAG_ONEWAY_FWD;
03663                         }
03664                         else if (RequiredSArgument[i] == 'y')
03665                         {
03666                                 FlagsFromArgument |= WPFLAG_ONEWAY_BACK;
03667                         }
03668                         else if (RequiredSArgument[i] == 'g')
03669                         {
03670                                 FlagsFromArgument |= WPFLAG_GOALPOINT;
03671                         }
03672                         else if (RequiredSArgument[i] == 'n')
03673                         {
03674                                 FlagsFromArgument |= WPFLAG_NOVIS;
03675                         }
03676                         else if (RequiredSArgument[i] == 'm')
03677                         {
03678                                 FlagsFromArgument |= WPFLAG_NOMOVEFUNC;
03679                         }
03680 
03681                         i++;
03682                 }
03683 
03684                 OptionalSArgument = ConcatArgs( 2 );
03685 
03686                 if (OptionalSArgument)
03687                 {
03688                         OptionalArgument = atoi(OptionalSArgument);
03689                 }
03690 
03691                 if (OptionalSArgument && OptionalSArgument[0])
03692                 {
03693                         CreateNewWP_InTrail(pl->client->ps.origin, FlagsFromArgument, OptionalArgument);
03694                 }
03695                 else
03696                 {
03697                         CreateNewWP(pl->client->ps.origin, FlagsFromArgument);
03698                 }
03699                 return 1;
03700         }
03701 
03702         if (Q_stricmp (cmd, "bot_wp_switchflags") == 0)
03703         {
03704                 gDeactivated = 1;
03705 
03706                 RequiredSArgument = ConcatArgs( 1 );
03707 
03708                 if (!RequiredSArgument || !RequiredSArgument[0])
03709                 {
03710                         G_Printf(S_COLOR_YELLOW "Flag string needed for bot_wp_switchflags\nType bot_wp_addflagged for a list of flags and their corresponding characters, or use 0 for no flags.\nSyntax: bot_wp_switchflags <flags> <n>\n");
03711                         return 1;
03712                 }
03713 
03714                 while (RequiredSArgument[i])
03715                 {
03716                         if (RequiredSArgument[i] == 'j')
03717                         {
03718                                 FlagsFromArgument |= WPFLAG_JUMP;
03719                         }
03720                         else if (RequiredSArgument[i] == 'd')
03721                         {
03722                                 FlagsFromArgument |= WPFLAG_DUCK;
03723                         }
03724                         else if (RequiredSArgument[i] == 'c')
03725                         {
03726                                 FlagsFromArgument |= WPFLAG_SNIPEORCAMPSTAND;
03727                         }
03728                         else if (RequiredSArgument[i] == 'f')
03729                         {
03730                                 FlagsFromArgument |= WPFLAG_WAITFORFUNC;
03731                         }
03732                         else if (RequiredSArgument[i] == 's')
03733                         {
03734                                 FlagsFromArgument |= WPFLAG_SNIPEORCAMP;
03735                         }
03736                         else if (RequiredSArgument[i] == 'x')
03737                         {
03738                                 FlagsFromArgument |= WPFLAG_ONEWAY_FWD;
03739                         }
03740                         else if (RequiredSArgument[i] == 'y')
03741                         {
03742                                 FlagsFromArgument |= WPFLAG_ONEWAY_BACK;
03743                         }
03744                         else if (RequiredSArgument[i] == 'g')
03745                         {
03746                                 FlagsFromArgument |= WPFLAG_GOALPOINT;
03747                         }
03748                         else if (RequiredSArgument[i] == 'n')
03749                         {
03750                                 FlagsFromArgument |= WPFLAG_NOVIS;
03751                         }
03752                         else if (RequiredSArgument[i] == 'm')
03753                         {
03754                                 FlagsFromArgument |= WPFLAG_NOMOVEFUNC;
03755                         }
03756 
03757                         i++;
03758                 }
03759 
03760                 OptionalSArgument = ConcatArgs( 2 );
03761 
03762                 if (OptionalSArgument)
03763                 {
03764                         OptionalArgument = atoi(OptionalSArgument);
03765                 }
03766 
03767                 if (OptionalSArgument && OptionalSArgument[0])
03768                 {
03769                         WPFlagsModify(OptionalArgument, FlagsFromArgument);
03770                 }
03771                 else
03772                 {
03773                         G_Printf(S_COLOR_YELLOW "Waypoint number (to modify) needed for bot_wp_switchflags\nSyntax: bot_wp_switchflags <flags> <n>\n");
03774                 }
03775                 return 1;
03776         }
03777 
03778         if (Q_stricmp (cmd, "bot_wp_killoneways") == 0)
03779         {
03780                 i = 0;
03781 
03782                 while (i < gWPNum)
03783                 {
03784                         if (gWPArray[i] && gWPArray[i]->inuse)
03785                         {
03786                                 if (gWPArray[i]->flags & WPFLAG_ONEWAY_FWD)
03787                                 {
03788                                         gWPArray[i]->flags -= WPFLAG_ONEWAY_FWD;
03789                                 }
03790                                 if (gWPArray[i]->flags & WPFLAG_ONEWAY_BACK)
03791                                 {
03792                                         gWPArray[i]->flags -= WPFLAG_ONEWAY_BACK;
03793                                 }
03794                         }
03795 
03796                         i++;
03797                 }
03798 
03799                 return 1;
03800         }
03801 
03802 #ifndef _XBOX
03803         if (Q_stricmp (cmd, "bot_wp_save") == 0)
03804         {
03805                 gDeactivated = 0;
03806                 trap_Cvar_Register( &mapname, "mapname", "", CVAR_SERVERINFO | CVAR_ROM );
03807                 SavePathData(mapname.string);
03808                 return 1;
03809         }
03810 #endif
03811 
03812         return 0;
03813 }

void Bot_SetForcedMovement int  bot,
int  forward,
int  right,
int  up
 

Definition at line 5883 of file ai_main.c.

References bot_state_t, botstates, bot_state_s::forceMove_Forward, bot_state_s::forceMove_Right, and bot_state_s::forceMove_Up.

Referenced by ClientCommand().

05884 {
05885         bot_state_t *bs;
05886 
05887         bs = botstates[bot];
05888 
05889         if (!bs)
05890         { //not a bot
05891                 return;
05892         }
05893 
05894         if (forward != -1)
05895         {
05896                 if (bs->forceMove_Forward)
05897                 {
05898                         bs->forceMove_Forward = 0;
05899                 }
05900                 else
05901                 {
05902                         bs->forceMove_Forward = forward;
05903                 }
05904         }
05905         if (right != -1)
05906         {
05907                 if (bs->forceMove_Right)
05908                 {
05909                         bs->forceMove_Right = 0;
05910                 }
05911                 else
05912                 {
05913                         bs->forceMove_Right = right;
05914                 }
05915         }
05916         if (up != -1)
05917         {
05918                 if (bs->forceMove_Up)
05919                 {
05920                         bs->forceMove_Up = 0;
05921                 }
05922                 else
05923                 {
05924                         bs->forceMove_Up = up;
05925                 }
05926         }
05927 }

void BroadcastTeamChange gclient_t client,
int  oldTeam
 

Definition at line 579 of file g_cmds.c.

References client, level_locals_t::clients, playerState_s::fd, forcedata_s::forceDoInit, g_gametype, G_GetStringEdString(), G_LogPrintf(), gclient_t, GT_DUEL, GT_POWERDUEL, GT_SIEGE, vmCvar_t::integer, level, clientPersistant_t::netname, gclient_s::pers, gclient_s::ps, S_COLOR_WHITE, gclient_s::sess, clientSession_t::sessionTeam, TEAM_BLUE, TEAM_FREE, TEAM_RED, TEAM_SPECTATOR, TeamName(), trap_SendServerCommand(), and va().

Referenced by ClientConnect(), G_InitSessionData(), and SetTeam().

00580 {
00581         client->ps.fd.forceDoInit = 1; //every time we change teams make sure our force powers are set right
00582 
00583         if (g_gametype.integer == GT_SIEGE)
00584         { //don't announce these things in siege
00585                 return;
00586         }
00587 
00588         if ( client->sess.sessionTeam == TEAM_RED ) {
00589                 trap_SendServerCommand( -1, va("cp \"%s" S_COLOR_WHITE " %s\n\"",
00590                         client->pers.netname, G_GetStringEdString("MP_SVGAME", "JOINEDTHEREDTEAM")) );
00591         } else if ( client->sess.sessionTeam == TEAM_BLUE ) {
00592                 trap_SendServerCommand( -1, va("cp \"%s" S_COLOR_WHITE " %s\n\"",
00593                 client->pers.netname, G_GetStringEdString("MP_SVGAME", "JOINEDTHEBLUETEAM")));
00594         } else if ( client->sess.sessionTeam == TEAM_SPECTATOR && oldTeam != TEAM_SPECTATOR ) {
00595                 trap_SendServerCommand( -1, va("cp \"%s" S_COLOR_WHITE " %s\n\"",
00596                 client->pers.netname, G_GetStringEdString("MP_SVGAME", "JOINEDTHESPECTATORS")));
00597         } else if ( client->sess.sessionTeam == TEAM_FREE ) {
00598                 if (g_gametype.integer == GT_DUEL || g_gametype.integer == GT_POWERDUEL)
00599                 {
00600                         /*
00601                         gentity_t *currentWinner = G_GetDuelWinner(client);
00602 
00603                         if (currentWinner && currentWinner->client)
00604                         {
00605                                 trap_SendServerCommand( -1, va("cp \"%s" S_COLOR_WHITE " %s %s\n\"",
00606                                 currentWinner->client->pers.netname, G_GetStringEdString("MP_SVGAME", "VERSUS"), client->pers.netname));
00607                         }
00608                         else
00609                         {
00610                                 trap_SendServerCommand( -1, va("cp \"%s" S_COLOR_WHITE " %s\n\"",
00611                                 client->pers.netname, G_GetStringEdString("MP_SVGAME", "JOINEDTHEBATTLE")));
00612                         }
00613                         */
00614                         //NOTE: Just doing a vs. once it counts two players up
00615                 }
00616                 else
00617                 {
00618                         trap_SendServerCommand( -1, va("cp \"%s" S_COLOR_WHITE " %s\n\"",
00619                         client->pers.netname, G_GetStringEdString("MP_SVGAME", "JOINEDTHEBATTLE")));
00620                 }
00621         }
00622 
00623         G_LogPrintf ( "setteam:  %i %s %s\n",
00624                                   client - &level.clients[0],
00625                                   TeamName ( oldTeam ),
00626                                   TeamName ( client->sess.sessionTeam ) );
00627 }

qboolean CheatsOk gentity_t ent  ) 
 

Definition at line 109 of file g_cmds.c.

References g_cheats, g_entities, G_GetStringEdString(), gentity_t, gentity_s::health, vmCvar_t::integer, qboolean, qfalse, qtrue, trap_SendServerCommand(), and va().

Referenced by ClientCommand(), Cmd_Give_f(), Cmd_God_f(), Cmd_LevelShot_f(), Cmd_Noclip_f(), and Cmd_Notarget_f().

00109                                            {
00110         if ( !g_cheats.integer ) {
00111                 trap_SendServerCommand( ent-g_entities, va("print \"%s\n\"", G_GetStringEdString("MP_SVGAME", "NOCHEATS")));
00112                 return qfalse;
00113         }
00114         if ( ent->health <= 0 ) {
00115                 trap_SendServerCommand( ent-g_entities, va("print \"%s\n\"", G_GetStringEdString("MP_SVGAME", "MUSTBEALIVE")));
00116                 return qfalse;
00117         }
00118         return qtrue;
00119 }

void ClientCommand int  clientNum  ) 
 

Definition at line 3074 of file g_cmds.c.

References AcceptBotCommand(), AngleVectors(), atoi(), gclient_s::beingThrown, BG_KnockDownable(), Bot_SetForcedMovement(), BOTH_STAND1, BROKENLIMB_LARM, BROKENLIMB_RARM, CHAN_AUTO, CHAN_VOICE, CheatsOk(), gentity_s::classname, gentity_s::client, gentity_s::clipmask, Cmd_CallTeamVote_f(), Cmd_CallVote_f(), Cmd_DebugSetBodyAnim_f(), Cmd_DebugSetSaberMove_f(), Cmd_DuelTeam_f(), Cmd_Follow_f(), Cmd_FollowCycle_f(), Cmd_ForceChanged_f(), Cmd_GameCommand_f(), Cmd_Give_f(), Cmd_God_f(), Cmd_Kill_f(), Cmd_LevelShot_f(), Cmd_Noclip_f(), Cmd_Notarget_f(), Cmd_NPC_f(), Cmd_Score_f(), Cmd_SetViewpos_f(), Cmd_SiegeClass_f(), Cmd_Stats_f(), Cmd_Team_f(), Cmd_TeamTask_f(), Cmd_TeamVote_f(), Cmd_ToggleSaber_f(), Cmd_Vote_f(), Cmd_Where_f(), Com_Printf(), CONTENTS_SOLID, DismembermentByNum(), DismembermentTest(), gclient_s::doingThrow, EF_RAG, playerState_s::eFlags, trace_t::entityNum, ENTITYNUM_NONE, FL_GODMODE, gentity_s::flags, FOFS, playerState_s::forceDodgeAnim, playerState_s::forceHandExtend, playerState_s::forceHandExtendTime, trace_t::fraction, G_BreakArm(), G_CheckForDismemberment(), g_entities, G_EntitySound(), G_Find(), g_gametype, G_GetStringEdString(), G_SetVehDamageFlags(), G_Sound(), G_SoundIndex(), gentity_t, gGAvoidDismember, gentity_s::ghoul2, playerState_s::groundEntityNum, GT_TEAM, HANDEXTEND_KNOCKDOWN, HANDEXTEND_NONE, HANDEXTEND_PRETHROW, HANDEXTEND_PRETHROWN, gentity_s::health, playerState_s::heldByClient, vmCvar_t::integer, level_locals_t::intermissiontime, gentity_s::inuse, playerState_s::legsAnim, level, LS_NONE, entityState_s::m_iVehicleNum, MASK_PLAYERSOLID, MAX_CLIENTS, MAX_GENTITIES, MAX_STRING_CHARS, MAX_TOKEN_CHARS, entityShared_t::maxs, entityShared_t::mins, MOD_SUICIDE, NULL, entityState_s::number, playerState_s::origin, player_die(), gclient_s::ps, Q_stricmp(), qboolean, qfalse, qtrue, playerState_s::quickerGetup, gentity_s::r, playerState_s::ragAttach, gentity_s::s, playerState_s::saberBlocked, playerState_s::saberBlocking, playerState_s::saberEntityNum, playerState_s::saberHolstered, playerState_s::saberInFlight, saberKnockOutOfHand(), playerState_s::saberMove, SAY_ALL, SAY_TEAM, SETANIM_FLAG_HOLD, SETANIM_FLAG_HOLDLESS, SETANIM_FLAG_OVERRIDE, SetClientViewAngle(), SHIPSURF_FRONT, StandardSetBodyAnim(), trace_t::startsolid, STAT_HEALTH, playerState_s::stats, strstr(), gclient_s::throwingIndex, level_locals_t::time, trap_Argc(), trap_Argv(), trap_SendServerCommand(), trap_Trace(), trap_TrueFree(), trap_TrueMalloc(), gentity_s::use, va(), vec3_origin, vec3_t, VectorClear, VectorCopy, VectorNormalize(), VectorSubtract, vectoyaw(), playerState_s::velocity, playerState_s::viewangles, playerState_s::weapon, playerState_s::weaponTime, WP_SABER, and YAW.

Referenced by vmMain().

03074                                     {
03075         gentity_t *ent;
03076         char    cmd[MAX_TOKEN_CHARS];
03077 
03078         ent = g_entities + clientNum;
03079         if ( !ent->client ) {
03080                 return;         // not fully in game yet
03081         }
03082 
03083 
03084         trap_Argv( 0, cmd, sizeof( cmd ) );
03085 
03086         //rww - redirect bot commands
03087         if (strstr(cmd, "bot_") && AcceptBotCommand(cmd, ent))
03088         {
03089                 return;
03090         }
03091         //end rww
03092 
03093         if (Q_stricmp (cmd, "say") == 0) {
03094                 Cmd_Say_f (ent, SAY_ALL, qfalse);
03095                 return;
03096         }
03097         if (Q_stricmp (cmd, "say_team") == 0) {
03098                 if (g_gametype.integer < GT_TEAM)
03099                 { //not a team game, just refer to regular say.
03100                         Cmd_Say_f (ent, SAY_ALL, qfalse);
03101                 }
03102                 else
03103                 {
03104                         Cmd_Say_f (ent, SAY_TEAM, qfalse);
03105                 }
03106                 return;
03107         }
03108         if (Q_stricmp (cmd, "tell") == 0) {
03109                 Cmd_Tell_f ( ent );
03110                 return;
03111         }
03112 
03113         if (Q_stricmp(cmd, "voice_cmd") == 0)
03114         {
03115                 Cmd_VoiceCommand_f(ent);
03116                 return;
03117         }
03118 
03119         if (Q_stricmp (cmd, "score") == 0) {
03120                 Cmd_Score_f (ent);
03121                 return;
03122         }
03123 
03124         // ignore all other commands when at intermission
03125         if (level.intermissiontime)
03126         {
03127                 qboolean giveError = qfalse;
03128                 //rwwFIXMEFIXME: This is terrible, write it differently
03129 
03130                 if (!Q_stricmp(cmd, "give"))
03131                 {
03132                         giveError = qtrue;
03133                 }
03134                 else if (!Q_stricmp(cmd, "giveother"))
03135                 {
03136                         giveError = qtrue;
03137                 }
03138                 else if (!Q_stricmp(cmd, "god"))
03139                 {
03140                         giveError = qtrue;
03141                 }
03142                 else if (!Q_stricmp(cmd, "notarget"))
03143                 {
03144                         giveError = qtrue;
03145                 }
03146                 else if (!Q_stricmp(cmd, "noclip"))
03147                 {
03148                         giveError = qtrue;
03149                 }
03150                 else if (!Q_stricmp(cmd, "kill"))
03151                 {
03152                         giveError = qtrue;
03153                 }
03154                 else if (!Q_stricmp(cmd, "teamtask"))
03155                 {
03156                         giveError = qtrue;
03157                 }
03158                 else if (!Q_stricmp(cmd, "levelshot"))
03159                 {
03160                         giveError = qtrue;
03161                 }
03162                 else if (!Q_stricmp(cmd, "follow"))
03163                 {
03164                         giveError = qtrue;
03165                 }
03166                 else if (!Q_stricmp(cmd, "follownext"))
03167                 {
03168                         giveError = qtrue;
03169                 }
03170                 else if (!Q_stricmp(cmd, "followprev"))
03171                 {
03172                         giveError = qtrue;
03173                 }
03174                 else if (!Q_stricmp(cmd, "team"))
03175                 {
03176                         giveError = qtrue;
03177                 }
03178                 else if (!Q_stricmp(cmd, "duelteam"))
03179                 {
03180                         giveError = qtrue;
03181                 }
03182                 else if (!Q_stricmp(cmd, "siegeclass"))
03183                 {
03184                         giveError = qtrue;
03185                 }
03186                 else if (!Q_stricmp(cmd, "forcechanged"))
03187                 { //special case: still update force change
03188                         Cmd_ForceChanged_f (ent);
03189                         return;
03190                 }
03191                 else if (!Q_stricmp(cmd, "where"))
03192                 {
03193                         giveError = qtrue;
03194                 }
03195                 else if (!Q_stricmp(cmd, "callvote"))
03196                 {
03197                         giveError = qtrue;
03198                 }
03199                 else if (!Q_stricmp(cmd, "vote"))
03200                 {
03201                         giveError = qtrue;
03202                 }
03203                 else if (!Q_stricmp(cmd, "callteamvote"))
03204                 {
03205                         giveError = qtrue;
03206                 }
03207                 else if (!Q_stricmp(cmd, "teamvote"))
03208                 {
03209                         giveError = qtrue;
03210                 }
03211                 else if (!Q_stricmp(cmd, "gc"))
03212                 {
03213                         giveError = qtrue;
03214                 }
03215                 else if (!Q_stricmp(cmd, "setviewpos"))
03216                 {
03217                         giveError = qtrue;
03218                 }
03219                 else if (!Q_stricmp(cmd, "stats"))
03220                 {
03221                         giveError = qtrue;
03222                 }
03223 
03224                 if (giveError)
03225                 {
03226                         trap_SendServerCommand( clientNum, va("print \"%s (%s) \n\"", G_GetStringEdString("MP_SVGAME", "CANNOT_TASK_INTERMISSION"), cmd ) );
03227                 }
03228                 else
03229                 {
03230                         Cmd_Say_f (ent, qfalse, qtrue);
03231                 }
03232                 return;
03233         }
03234 
03235         if (Q_stricmp (cmd, "give") == 0)
03236         {
03237                 Cmd_Give_f (ent, 0);
03238         }
03239         else if (Q_stricmp (cmd, "giveother") == 0)
03240         { //for debugging pretty much
03241                 Cmd_Give_f (ent, 1);
03242         }
03243         else if (Q_stricmp (cmd, "t_use") == 0 && CheatsOk(ent))
03244         { //debug use map object
03245                 if (trap_Argc() > 1)
03246                 {
03247                         char sArg[MAX_STRING_CHARS];
03248                         gentity_t *targ;
03249 
03250                         trap_Argv( 1, sArg, sizeof( sArg ) );
03251                         targ = G_Find( NULL, FOFS(targetname), sArg );
03252 
03253                         while (targ)
03254                         {
03255                                 if (targ->use)
03256                                 {
03257                                         targ->use(targ, ent, ent);
03258                                 }
03259                                 targ = G_Find( targ, FOFS(targetname), sArg );
03260                         }
03261                 }
03262         }
03263         else if (Q_stricmp (cmd, "god") == 0)
03264                 Cmd_God_f (ent);
03265         else if (Q_stricmp (cmd, "notarget") == 0)
03266                 Cmd_Notarget_f (ent);
03267         else if (Q_stricmp (cmd, "noclip") == 0)
03268                 Cmd_Noclip_f (ent);
03269         else if ( Q_stricmp( cmd, "NPC" ) == 0 && CheatsOk(ent) )
03270         {
03271                 Cmd_NPC_f( ent );
03272         }
03273         else if (Q_stricmp (cmd, "kill") == 0)
03274                 Cmd_Kill_f (ent);
03275         else if (Q_stricmp (cmd, "teamtask") == 0)
03276                 Cmd_TeamTask_f (ent);
03277         else if (Q_stricmp (cmd, "levelshot") == 0)
03278                 Cmd_LevelShot_f (ent);
03279         else if (Q_stricmp (cmd, "follow") == 0)
03280                 Cmd_Follow_f (ent);
03281         else if (Q_stricmp (cmd, "follownext") == 0)
03282                 Cmd_FollowCycle_f (ent, 1);
03283         else if (Q_stricmp (cmd, "followprev") == 0)
03284                 Cmd_FollowCycle_f (ent, -1);
03285         else if (Q_stricmp (cmd, "team") == 0)
03286                 Cmd_Team_f (ent);
03287         else if (Q_stricmp (cmd, "duelteam") == 0)
03288                 Cmd_DuelTeam_f (ent);
03289         else if (Q_stricmp (cmd, "siegeclass") == 0)
03290                 Cmd_SiegeClass_f (ent);
03291         else if (Q_stricmp (cmd, "forcechanged") == 0)
03292                 Cmd_ForceChanged_f (ent);
03293         else if (Q_stricmp (cmd, "where") == 0)
03294                 Cmd_Where_f (ent);
03295         else if (Q_stricmp (cmd, "callvote") == 0)
03296                 Cmd_CallVote_f (ent);
03297         else if (Q_stricmp (cmd, "vote") == 0)
03298                 Cmd_Vote_f (ent);
03299         else if (Q_stricmp (cmd, "callteamvote") == 0)
03300                 Cmd_CallTeamVote_f (ent);
03301         else if (Q_stricmp (cmd, "teamvote") == 0)
03302                 Cmd_TeamVote_f (ent);
03303         else if (Q_stricmp (cmd, "gc") == 0)
03304                 Cmd_GameCommand_f( ent );
03305         else if (Q_stricmp (cmd, "setviewpos") == 0)
03306                 Cmd_SetViewpos_f( ent );
03307         else if (Q_stricmp (cmd, "stats") == 0)
03308                 Cmd_Stats_f( ent );
03309         /*
03310         else if (Q_stricmp (cmd, "kylesmash") == 0)
03311         {
03312                 TryGrapple(ent);
03313         }
03314         */
03315         //for convenient powerduel testing in release
03316         else if (Q_stricmp(cmd, "killother") == 0 && CheatsOk( ent ))
03317         {
03318                 if (trap_Argc() > 1)
03319                 {
03320                         char sArg[MAX_STRING_CHARS];
03321                         int entNum = 0;
03322 
03323                         trap_Argv( 1, sArg, sizeof( sArg ) );
03324 
03325                         entNum = G_ClientNumFromNetname(sArg);
03326 
03327                         if (entNum >= 0 && entNum < MAX_GENTITIES)
03328                         {
03329                                 gentity_t *kEnt = &g_entities[entNum];
03330 
03331                                 if (kEnt->inuse && kEnt->client)
03332                                 {
03333                                         kEnt->flags &= ~FL_GODMODE;
03334                                         kEnt->client->ps.stats[STAT_HEALTH] = kEnt->health = -999;
03335                                         player_die (kEnt, kEnt, kEnt, 100000, MOD_SUICIDE);
03336                                 }
03337                         }
03338                 }
03339         }
03340 #ifdef _DEBUG
03341         else if (Q_stricmp(cmd, "relax") == 0 && CheatsOk( ent ))
03342         {
03343                 if (ent->client->ps.eFlags & EF_RAG)
03344                 {
03345                         ent->client->ps.eFlags &= ~EF_RAG;
03346                 }
03347                 else
03348                 {
03349                         ent->client->ps.eFlags |= EF_RAG;
03350                 }
03351         }
03352         else if (Q_stricmp(cmd, "holdme") == 0 && CheatsOk( ent ))
03353         {
03354                 if (trap_Argc() > 1)
03355                 {
03356                         char sArg[MAX_STRING_CHARS];
03357                         int entNum = 0;
03358 
03359                         trap_Argv( 1, sArg, sizeof( sArg ) );
03360 
03361                         entNum = atoi(sArg);
03362 
03363                         if (entNum >= 0 &&
03364                                 entNum < MAX_GENTITIES)
03365                         {
03366                                 gentity_t *grabber = &g_entities[entNum];
03367 
03368                                 if (grabber->inuse && grabber->client && grabber->ghoul2)
03369                                 {
03370                                         if (!grabber->s.number)
03371                                         { //switch cl 0 and entitynum_none, so we can operate on the "if non-0" concept
03372                                                 ent->client->ps.ragAttach = ENTITYNUM_NONE;
03373                                         }
03374                                         else
03375                                         {
03376                                                 ent->client->ps.ragAttach = grabber->s.number;
03377                                         }
03378                                 }
03379                         }
03380                 }
03381                 else
03382                 {
03383                         ent->client->ps.ragAttach = 0;
03384                 }
03385         }
03386         else if (Q_stricmp(cmd, "limb_break") == 0 && CheatsOk( ent ))
03387         {
03388                 if (trap_Argc() > 1)
03389                 {
03390                         char sArg[MAX_STRING_CHARS];
03391                         int breakLimb = 0;
03392 
03393                         trap_Argv( 1, sArg, sizeof( sArg ) );
03394                         if (!Q_stricmp(sArg, "right"))
03395                         {
03396                                 breakLimb = BROKENLIMB_RARM;
03397                         }
03398                         else if (!Q_stricmp(sArg, "left"))
03399                         {
03400                                 breakLimb = BROKENLIMB_LARM;
03401                         }
03402 
03403                         G_BreakArm(ent, breakLimb);
03404                 }
03405         }
03406         else if (Q_stricmp(cmd, "headexplodey") == 0 && CheatsOk( ent ))
03407         {
03408                 Cmd_Kill_f (ent);
03409                 if (ent->health < 1)
03410                 {
03411                         DismembermentTest(ent);
03412                 }
03413         }
03414         else if (Q_stricmp(cmd, "debugstupidthing") == 0 && CheatsOk( ent ))
03415         {
03416                 int i = 0;
03417                 gentity_t *blah;
03418                 while (i < MAX_GENTITIES)
03419                 {
03420                         blah = &g_entities[i];
03421                         if (blah->inuse && blah->classname && blah->classname[0] && !Q_stricmp(blah->classname, "NPC_Vehicle"))
03422                         {
03423                                 Com_Printf("Found it.\n");
03424                         }
03425                         i++;
03426                 }
03427         }
03428         else if (Q_stricmp(cmd, "arbitraryprint") == 0 && CheatsOk( ent ))
03429         {
03430                 trap_SendServerCommand( -1, va("cp \"Blah blah blah\n\""));
03431         }
03432         else if (Q_stricmp(cmd, "handcut") == 0 && CheatsOk( ent ))
03433         {
03434                 int bCl = 0;
03435                 char sarg[MAX_STRING_CHARS];
03436 
03437                 if (trap_Argc() > 1)
03438                 {
03439                         trap_Argv( 1, sarg, sizeof( sarg ) );
03440 
03441                         if (sarg[0])
03442                         {
03443                                 bCl = atoi(sarg);
03444 
03445                                 if (bCl >= 0 && bCl < MAX_GENTITIES)
03446                                 {
03447                                         gentity_t *hEnt = &g_entities[bCl];
03448 
03449                                         if (hEnt->client)
03450                                         {
03451                                                 if (hEnt->health > 0)
03452                                                 {
03453                                                         gGAvoidDismember = 1;
03454                                                         hEnt->flags &= ~FL_GODMODE;
03455                                                         hEnt->client->ps.stats[STAT_HEALTH] = hEnt->health = -999;
03456                                                         player_die (hEnt, hEnt, hEnt, 100000, MOD_SUICIDE);
03457                                                 }
03458                                                 gGAvoidDismember = 2;
03459                                                 G_CheckForDismemberment(hEnt, ent, hEnt->client->ps.origin, 999, hEnt->client->ps.legsAnim, qfalse);
03460                                                 gGAvoidDismember = 0;
03461                                         }
03462                                 }
03463                         }
03464                 }
03465         }
03466         else if (Q_stricmp(cmd, "loveandpeace") == 0 && CheatsOk( ent ))
03467         {
03468                 trace_t tr;
03469                 vec3_t fPos;
03470 
03471                 AngleVectors(ent->client->ps.viewangles, fPos, 0, 0);
03472 
03473                 fPos[0] = ent->client->ps.origin[0] + fPos[0]*40;
03474                 fPos[1] = ent->client->ps.origin[1] + fPos[1]*40;
03475                 fPos[2] = ent->client->ps.origin[2] + fPos[2]*40;
03476 
03477                 trap_Trace(&tr, ent->client->ps.origin, 0, 0, fPos, ent->s.number, ent->clipmask);
03478 
03479                 if (tr.entityNum < MAX_CLIENTS && tr.entityNum != ent->s.number)
03480                 {
03481                         gentity_t *other = &g_entities[tr.entityNum];
03482 
03483                         if (other && other->inuse && other->client)
03484                         {
03485                                 vec3_t entDir;
03486                                 vec3_t otherDir;
03487                                 vec3_t entAngles;
03488                                 vec3_t otherAngles;
03489 
03490                                 if (ent->client->ps.weapon == WP_SABER && !ent->client->ps.saberHolstered)
03491                                 {
03492                                         Cmd_ToggleSaber_f(ent);
03493                                 }
03494 
03495                                 if (other->client->ps.weapon == WP_SABER && !other->client->ps.saberHolstered)
03496                                 {
03497                                         Cmd_ToggleSaber_f(other);
03498                                 }
03499 
03500                                 if ((ent->client->ps.weapon != WP_SABER || ent->client->ps.saberHolstered) &&
03501                                         (other->client->ps.weapon != WP_SABER || other->client->ps.saberHolstered))
03502                                 {
03503                                         VectorSubtract( other->client->ps.origin, ent->client->ps.origin, otherDir );
03504                                         VectorCopy( ent->client->ps.viewangles, entAngles );
03505                                         entAngles[YAW] = vectoyaw( otherDir );
03506                                         SetClientViewAngle( ent, entAngles );
03507 
03508                                         StandardSetBodyAnim(ent, /*BOTH_KISSER1LOOP*/BOTH_STAND1, SETANIM_FLAG_OVERRIDE|SETANIM_FLAG_HOLD|SETANIM_FLAG_HOLDLESS);
03509                                         ent->client->ps.saberMove = LS_NONE;
03510                                         ent->client->ps.saberBlocked = 0;
03511                                         ent->client->ps.saberBlocking = 0;
03512 
03513                                         VectorSubtract( ent->client->ps.origin, other->client->ps.origin, entDir );
03514                                         VectorCopy( other->client->ps.viewangles, otherAngles );
03515                                         otherAngles[YAW] = vectoyaw( entDir );
03516                                         SetClientViewAngle( other, otherAngles );
03517 
03518                                         StandardSetBodyAnim(other, /*BOTH_KISSEE1LOOP*/BOTH_STAND1, SETANIM_FLAG_OVERRIDE|SETANIM_FLAG_HOLD|SETANIM_FLAG_HOLDLESS);
03519                                         other->client->ps.saberMove = LS_NONE;
03520                                         other->client->ps.saberBlocked = 0;
03521                                         other->client->ps.saberBlocking = 0;
03522                                 }
03523                         }
03524                 }
03525         }
03526 #endif
03527         else if (Q_stricmp(cmd, "thedestroyer") == 0 && CheatsOk( ent ) && ent && ent->client && ent->client->ps.saberHolstered && ent->client->ps.weapon == WP_SABER)
03528         {
03529                 Cmd_ToggleSaber_f(ent);
03530 
03531                 if (!ent->client->ps.saberHolstered)
03532                 {
03533                 }
03534         }
03535         //begin bot debug cmds
03536         else if (Q_stricmp(cmd, "debugBMove_Forward") == 0 && CheatsOk(ent))
03537         {
03538                 int arg = 4000;
03539                 int bCl = 0;
03540                 char sarg[MAX