codemp/cgame/cg_servercmds.c File Reference

#include "cg_local.h"
#include "../../ui/menudef.h"
#include "cg_lights.h"
#include "..\ghoul2\g2.h"
#include "../ui/ui_public.h"

Go to the source code of this file.

Defines

#define MAX_STRINGED_SV_STRING   1024

Functions

void CG_ParseServerinfo (void)
void CG_SetConfigValues (void)
void CG_ShaderStateChanged (void)
void SetCustomSoundForType (clientInfo_t *ci, int setType, int index, sfxHandle_t sfx)
void CG_PrecacheNPCSounds (const char *str)
void CG_HandleNPCSounds (centity_t *cent)
int CG_HandleAppendedSkin (char *modelName)
void CG_CacheG2AnimInfo (char *modelName)
void SetDuelistHealthsFromConfigString (const char *str)
void CG_ParseSiegeObjectiveStatus (const char *str)
void CG_ParseWeatherEffect (const char *str)
void CG_ParseSiegeState (const char *str)
void CG_KillCEntityG2 (int entNum)
void CG_KillCEntityInstances (void)
void CG_CheckSVStringEdRef (char *buf, const char *str)
void CG_SiegeBriefingDisplay (int team, int dontshow)
void CG_ParseSiegeExtendedData (void)
void CG_ChatBox_AddString (char *chatStr)
void CG_ExecuteNewServerCommands (int latestSequence)

Variables

char * cg_customSoundNames [MAX_CUSTOM_SOUNDS]
const char * cg_customCombatSoundNames [MAX_CUSTOM_COMBAT_SOUNDS]
const char * cg_customExtraSoundNames [MAX_CUSTOM_EXTRA_SOUNDS]
const char * cg_customJediSoundNames [MAX_CUSTOM_JEDI_SOUNDS]
const char * cg_customDuelSoundNames [MAX_CUSTOM_DUEL_SOUNDS]
int cgSiegeRoundState
int cgSiegeRoundTime
int cg_beatingSiegeTime
int cg_siegeWinTeam


Define Documentation

#define MAX_STRINGED_SV_STRING   1024
 

Definition at line 1057 of file cg_servercmds.c.


Function Documentation

void CG_CacheG2AnimInfo char *  modelName  ) 
 

Definition at line 6876 of file cg_players.c.

References BG_GetVehicleModelName(), BG_GetVehicleSkinName(), BG_ParseAnimationEvtFile(), BG_ParseAnimationFile(), bgNumAnimEvents, MAX_QPATH, NULL, Q_strrchr(), qfalse, strcpy(), trap_G2API_CleanGhoul2Models(), trap_G2API_GetGLAName(), trap_G2API_InitGhoul2Model(), trap_R_RegisterSkin(), and va().

06877 {
06878         void *g2 = NULL;
06879         char *slash;
06880         char useModel[MAX_QPATH];
06881         char useSkin[MAX_QPATH];
06882         int animIndex;
06883 
06884         strcpy(useModel, modelName);
06885         strcpy(useSkin, modelName);
06886 
06887         if (modelName[0] == '$')
06888         { //it's a vehicle name actually, let's precache the whole vehicle
06889                 BG_GetVehicleModelName(useModel);
06890                 BG_GetVehicleSkinName(useSkin);
06891                 if ( useSkin[0] )
06892                 { //use a custom skin
06893                         trap_R_RegisterSkin(va("models/players/%s/model_%s.skin", useModel, useSkin));
06894                 }
06895                 else
06896                 {
06897                         trap_R_RegisterSkin(va("models/players/%s/model_default.skin", useModel));
06898                 }
06899                 strcpy(useModel, va("models/players/%s/model.glm", useModel));
06900         }
06901 
06902         trap_G2API_InitGhoul2Model(&g2, useModel, 0, 0, 0, 0, 0);
06903 
06904         if (g2)
06905         {
06906                 char GLAName[MAX_QPATH];
06907                 char originalModelName[MAX_QPATH];
06908 
06909                 animIndex = -1;
06910 
06911                 GLAName[0] = 0;
06912                 trap_G2API_GetGLAName(g2, 0, GLAName);
06913 
06914                 strcpy(originalModelName, useModel);
06915                         
06916                 slash = Q_strrchr( GLAName, '/' );
06917                 if ( slash )
06918                 {
06919                         strcpy(slash, "/animation.cfg");
06920 
06921                         animIndex = BG_ParseAnimationFile(GLAName, NULL, qfalse);
06922                 }
06923 
06924                 if (animIndex != -1)
06925                 {
06926                         slash = Q_strrchr( originalModelName, '/' );
06927                         if ( slash )
06928                         {
06929                                 slash++;
06930                                 *slash = 0;
06931                         }
06932 
06933                         BG_ParseAnimationEvtFile(originalModelName, animIndex, bgNumAnimEvents);
06934                 }
06935 
06936                 //Now free the temp instance
06937                 trap_G2API_CleanGhoul2Models(&g2);
06938         }
06939 }

void CG_ChatBox_AddString char *  chatStr  ) 
 

Definition at line 7540 of file cg_draw.c.

References cg, cg_chatBox, CG_ChatBox_StrInsert(), CG_Text_Width(), CHATBOX_CUTOFF_LEN, chatBoxItem_t, cg_t::chatItemActive, cg_t::chatItems, FONT_SMALL, vmCvar_t::integer, chatBoxItem_s::lines, MAX_CHATBOX_ITEMS, memset(), strcpy(), chatBoxItem_s::string, strlen(), cg_t::time, and chatBoxItem_s::time.

Referenced by CG_EntityEvent().

07541 {
07542         chatBoxItem_t *chat = &cg.chatItems[cg.chatItemActive];
07543         float chatLen;
07544 
07545         if (cg_chatBox.integer<=0)
07546         { //don't bother then.
07547                 return;
07548         }
07549 
07550         memset(chat, 0, sizeof(chatBoxItem_t));
07551 
07552         if (strlen(chatStr) > sizeof(chat->string))
07553         { //too long, terminate at proper len.
07554                 chatStr[sizeof(chat->string)-1] = 0;
07555         }
07556 
07557         strcpy(chat->string, chatStr);
07558         chat->time = cg.time + cg_chatBox.integer;
07559 
07560         chat->lines = 1;
07561 
07562         chatLen = CG_Text_Width(chat->string, 1.0f, FONT_SMALL);
07563         if (chatLen > CHATBOX_CUTOFF_LEN)
07564         { //we have to break it into segments...
07565         int i = 0;
07566                 int lastLinePt = 0;
07567                 char s[2];
07568 
07569                 chatLen = 0;
07570                 while (chat->string[i])
07571                 {
07572                         s[0] = chat->string[i];
07573                         s[1] = 0;
07574                         chatLen += CG_Text_Width(s, 0.65f, FONT_SMALL);
07575 
07576                         if (chatLen >= CHATBOX_CUTOFF_LEN)
07577                         {
07578                                 int j = i;
07579                                 while (j > 0 && j > lastLinePt)
07580                                 {
07581                                         if (chat->string[j] == ' ')
07582                                         {
07583                                                 break;
07584                                         }
07585                                         j--;
07586                                 }
07587                                 if (chat->string[j] == ' ')
07588                                 {
07589                                         i = j;
07590                                 }
07591 
07592                 chat->lines++;
07593                                 CG_ChatBox_StrInsert(chat->string, i, "\n");
07594                                 i++;
07595                                 chatLen = 0;
07596                                 lastLinePt = i+1;
07597                         }
07598                         i++;
07599                 }
07600         }
07601 
07602         cg.chatItemActive++;
07603         if (cg.chatItemActive >= MAX_CHATBOX_ITEMS)
07604         {
07605                 cg.chatItemActive = 0;
07606         }
07607 }

void CG_CheckSVStringEdRef char *  buf,
const char *  str
 

Definition at line 1059 of file cg_servercmds.c.

References qfalse.

01060 { //I don't really like doing this. But it utilizes the system that was already in place.
01061         int i = 0;
01062         int b = 0;
01063         int strLen = 0;
01064         qboolean gotStrip = qfalse;
01065 
01066         if (!str || !str[0])
01067         {
01068                 if (str)
01069                 {
01070                         strcpy(buf, str);
01071                 }
01072                 return;
01073         }
01074 
01075         strcpy(buf, str);
01076 
01077         strLen = strlen(str);
01078 
01079         if (strLen >= MAX_STRINGED_SV_STRING)
01080         {
01081                 return;
01082         }
01083 
01084         while (i < strLen && str[i])
01085         {
01086                 gotStrip = qfalse;
01087 
01088                 if (str[i] == '@' && (i+1) < strLen)
01089                 {
01090                         if (str[i+1] == '@' && (i+2) < strLen)
01091                         {
01092                                 if (str[i+2] == '@' && (i+3) < strLen)
01093                                 { //@@@ should mean to insert a StringEd reference here, so insert it into buf at the current place
01094                                         char stringRef[MAX_STRINGED_SV_STRING];
01095                                         int r = 0;
01096 
01097                                         while (i < strLen && str[i] == '@')
01098                                         {
01099                                                 i++;
01100                                         }
01101 
01102                                         while (i < strLen && str[i] && str[i] != ' ' && str[i] != ':' && str[i] != '.' && str[i] != '\n')
01103                                         {
01104                                                 stringRef[r] = str[i];
01105                                                 r++;
01106                                                 i++;
01107                                         }
01108                                         stringRef[r] = 0;
01109 
01110                                         buf[b] = 0;
01111                                         Q_strcat(buf, MAX_STRINGED_SV_STRING, CG_GetStringEdString("MP_SVGAME", stringRef));
01112                                         b = strlen(buf);
01113                                 }
01114                         }
01115                 }
01116 
01117                 if (!gotStrip)
01118                 {
01119                         buf[b] = str[i];
01120                         b++;
01121                 }
01122                 i++;
01123         }
01124 
01125         buf[b] = 0;
01126 }

void CG_ExecuteNewServerCommands int  latestSequence  ) 
 

Definition at line 1681 of file cg_servercmds.c.

Referenced by CG_SetInitialSnapshot().

01681                                                        {
01682         while ( cgs.serverCommandSequence < latestSequence ) {
01683                 if ( trap_GetServerCommand( ++cgs.serverCommandSequence ) ) {
01684                         CG_ServerCommand();
01685                 }
01686         }
01687 }

int CG_HandleAppendedSkin char *  modelName  ) 
 

Definition at line 6817 of file cg_players.c.

References MAX_QPATH, Q_strrchr(), qhandle_t, strchr(), strcpy(), trap_R_RegisterSkin(), and va().

Referenced by CG_G2AnimEntModelLoad().

06818 {
06819         char skinName[MAX_QPATH];
06820         char *p;
06821         qhandle_t skinID = 0;
06822         int i = 0;
06823 
06824         //see if it has a skin name
06825         p = Q_strrchr(modelName, '*');
06826 
06827         if (p)
06828         { //found a *, we should have a model name before it and a skin name after it.
06829                 *p = 0; //terminate the modelName string at this point, then go ahead and parse to the next 0 for the skin.
06830                 p++;
06831 
06832                 while (p && *p)
06833                 {
06834                         skinName[i] = *p;
06835                         i++;
06836                         p++;
06837                 }
06838                 skinName[i] = 0;
06839 
06840                 if (skinName[0]) 
06841                 { //got it, register the skin under the model path.
06842                         char baseFolder[MAX_QPATH];
06843 
06844                         strcpy(baseFolder, modelName);
06845                         p = Q_strrchr(baseFolder, '/'); //go back to the first /, should be the path point
06846 
06847                         if (p)
06848                         { //got it.. terminate at the slash and register.
06849                                 char *useSkinName;
06850 
06851                                 *p = 0;
06852 
06853                                 if (strchr(skinName, '|'))
06854                                 {//three part skin
06855                                         useSkinName = va("%s/|%s", baseFolder, skinName);
06856                                 }
06857                                 else
06858                                 {
06859                                         useSkinName = va("%s/model_%s.skin", baseFolder, skinName);
06860                                 }
06861 
06862                                 skinID = trap_R_RegisterSkin(useSkinName);
06863                         }
06864                 }
06865         }
06866 
06867         return skinID;
06868 }

void CG_HandleNPCSounds centity_t cent  ) 
 

Definition at line 484 of file cg_servercmds.c.

Referenced by CG_G2AnimEntModelLoad().

00485 {
00486         if (!cent->npcClient)
00487         {
00488                 return;
00489         }
00490 
00491         //standard
00492         if (cent->currentState.csSounds_Std)
00493         {
00494                 const char *s = CG_ConfigString( CS_SOUNDS + cent->currentState.csSounds_Std );
00495 
00496                 if (s && s[0])
00497                 {
00498                         char sEnd[MAX_QPATH];
00499                         int i = 2;
00500                         int j = 0;
00501 
00502                         //Parse past the initial "*" which indicates this is a custom sound, and the $ which indicates
00503                         //it is an NPC custom sound dir.
00504                         while (s[i])
00505                         {
00506                                 sEnd[j] = s[i];
00507                                 j++;
00508                                 i++;
00509                         }
00510                         sEnd[j] = 0;
00511 
00512                         CG_RegisterCustomSounds(cent->npcClient, 1, sEnd);
00513                 }
00514         }
00515         else
00516         {
00517                 memset(&cent->npcClient->sounds, 0, sizeof(cent->npcClient->sounds));
00518         }
00519 
00520         //combat
00521         if (cent->currentState.csSounds_Combat)
00522         {
00523                 const char *s = CG_ConfigString( CS_SOUNDS + cent->currentState.csSounds_Combat );
00524 
00525                 if (s && s[0])
00526                 {
00527                         char sEnd[MAX_QPATH];
00528                         int i = 2;
00529                         int j = 0;
00530 
00531                         //Parse past the initial "*" which indicates this is a custom sound, and the $ which indicates
00532                         //it is an NPC custom sound dir.
00533                         while (s[i])
00534                         {
00535                                 sEnd[j] = s[i];
00536                                 j++;
00537                                 i++;
00538                         }
00539                         sEnd[j] = 0;
00540 
00541                         CG_RegisterCustomSounds(cent->npcClient, 2, sEnd);
00542                 }
00543         }
00544         else
00545         {
00546                 memset(&cent->npcClient->combatSounds, 0, sizeof(cent->npcClient->combatSounds));
00547         }
00548 
00549         //extra
00550         if (cent->currentState.csSounds_Extra)
00551         {
00552                 const char *s = CG_ConfigString( CS_SOUNDS + cent->currentState.csSounds_Extra );
00553 
00554                 if (s && s[0])
00555                 {
00556                         char sEnd[MAX_QPATH];
00557                         int i = 2;
00558                         int j = 0;
00559 
00560                         //Parse past the initial "*" which indicates this is a custom sound, and the $ which indicates
00561                         //it is an NPC custom sound dir.
00562                         while (s[i])
00563                         {
00564                                 sEnd[j] = s[i];
00565                                 j++;
00566                                 i++;
00567                         }
00568                         sEnd[j] = 0;
00569 
00570                         CG_RegisterCustomSounds(cent->npcClient, 3, sEnd);
00571                 }
00572         }
00573         else
00574         {
00575                 memset(&cent->npcClient->extraSounds, 0, sizeof(cent->npcClient->extraSounds));
00576         }
00577 
00578         //jedi
00579         if (cent->currentState.csSounds_Jedi)
00580         {
00581                 const char *s = CG_ConfigString( CS_SOUNDS + cent->currentState.csSounds_Jedi );
00582 
00583                 if (s && s[0])
00584                 {
00585                         char sEnd[MAX_QPATH];
00586                         int i = 2;
00587                         int j = 0;
00588 
00589                         //Parse past the initial "*" which indicates this is a custom sound, and the $ which indicates
00590                         //it is an NPC custom sound dir.
00591                         while (s[i])
00592                         {
00593                                 sEnd[j] = s[i];
00594                                 j++;
00595                                 i++;
00596                         }
00597                         sEnd[j] = 0;
00598 
00599                         CG_RegisterCustomSounds(cent->npcClient, 4, sEnd);
00600                 }
00601         }
00602         else
00603         {
00604                 memset(&cent->npcClient->jediSounds, 0, sizeof(cent->npcClient->jediSounds));
00605         }
00606 }

void CG_KillCEntityG2 int  entNum  ) 
 

Definition at line 863 of file cg_servercmds.c.

Referenced by CG_DestroyAllGhoul2().

00864 {
00865         int j;
00866         clientInfo_t *ci = NULL;
00867         centity_t *cent = &cg_entities[entNum];
00868 
00869         if (entNum < MAX_CLIENTS)
00870         {
00871                 ci = &cgs.clientinfo[entNum];
00872         }
00873         else
00874         {
00875                 ci = cent->npcClient;
00876         }
00877 
00878         if (ci)
00879         {
00880                 if (ci == cent->npcClient)
00881                 { //never going to be != cent->ghoul2, unless cent->ghoul2 has already been removed (and then this ptr is not valid)
00882                         ci->ghoul2Model = NULL;
00883                 }
00884                 else if (ci->ghoul2Model == cent->ghoul2)
00885                 {
00886                         ci->ghoul2Model = NULL;
00887                 }
00888                 else if (ci->ghoul2Model && trap_G2_HaveWeGhoul2Models(ci->ghoul2Model))
00889                 {
00890                         trap_G2API_CleanGhoul2Models(&ci->ghoul2Model);
00891                         ci->ghoul2Model = NULL;
00892                 }
00893 
00894                 //Clean up any weapon instances for custom saber stuff
00895                 j = 0;
00896                 while (j < MAX_SABERS)
00897                 {
00898                         if (ci->ghoul2Weapons[j] && trap_G2_HaveWeGhoul2Models(ci->ghoul2Weapons[j]))
00899                         {
00900                                 trap_G2API_CleanGhoul2Models(&ci->ghoul2Weapons[j]);
00901                                 ci->ghoul2Weapons[j] = NULL;
00902                         }
00903 
00904                         j++;
00905                 }
00906         }
00907 
00908         if (cent->ghoul2 && trap_G2_HaveWeGhoul2Models(cent->ghoul2))
00909         {
00910                 trap_G2API_CleanGhoul2Models(&cent->ghoul2);
00911                 cent->ghoul2 = NULL;
00912         }
00913 
00914         if (cent->grip_arm && trap_G2_HaveWeGhoul2Models(cent->grip_arm))
00915         {
00916                 trap_G2API_CleanGhoul2Models(&cent->grip_arm);
00917                 cent->grip_arm = NULL;
00918         }
00919 
00920         if (cent->frame_hold && trap_G2_HaveWeGhoul2Models(cent->frame_hold))
00921         {
00922                 trap_G2API_CleanGhoul2Models(&cent->frame_hold);
00923                 cent->frame_hold = NULL;
00924         }
00925 
00926         if (cent->npcClient)
00927         {
00928                 CG_DestroyNPCClient(&cent->npcClient);
00929         }
00930 
00931         cent->isRagging = qfalse; //just in case.
00932         cent->ikStatus = qfalse;
00933 
00934         cent->localAnimIndex = 0;
00935 }

void CG_KillCEntityInstances void   ) 
 

Definition at line 937 of file cg_servercmds.c.

00938 {
00939         int i = 0;
00940         centity_t *cent;
00941 
00942         while (i < MAX_GENTITIES)
00943         {
00944                 cent = &cg_entities[i];
00945 
00946                 if (i >= MAX_CLIENTS && cent->currentState.number == i)
00947                 { //do not clear G2 instances on client ents, they are constant
00948                         CG_KillCEntityG2(i);
00949                 }
00950 
00951                 cent->bolt1 = 0;
00952                 cent->bolt2 = 0;
00953                 cent->bolt3 = 0;
00954                 cent->bolt4 = 0;
00955 
00956                 cent->bodyHeight = 0;//SABER_LENGTH_MAX;
00957                 //cent->saberExtendTime = 0;
00958 
00959                 cent->boltInfo = 0;
00960 
00961                 cent->frame_minus1_refreshed = 0;
00962                 cent->frame_minus2_refreshed = 0;
00963                 cent->dustTrailTime = 0;
00964                 cent->ghoul2weapon = NULL;
00965                 //cent->torsoBolt = 0;
00966                 cent->trailTime = 0;
00967                 cent->frame_hold_time = 0;
00968                 cent->frame_hold_refreshed = 0;
00969                 cent->trickAlpha = 0;
00970                 cent->trickAlphaTime = 0;
00971                 VectorClear(cent->turAngles);
00972                 cent->weapon = 0;
00973                 cent->teamPowerEffectTime = 0;
00974                 cent->teamPowerType = 0;
00975                 cent->numLoopingSounds = 0;
00976 
00977                 cent->localAnimIndex = 0;
00978 
00979                 i++;
00980         }
00981 }

void CG_ParseServerinfo void   ) 
 

Definition at line 105 of file cg_servercmds.c.

References atoi(), cgs_t::capturelimit, cg, CG_ConfigString(), cgs, Com_sprintf(), CS_SERVERINFO, CS_TERRAINS, cgs_t::debugMelee, cgs_t::dmflags, cgs_t::duel_fraglimit, cgs_t::fDisable, cgs_t::fraglimit, cgs_t::gametype, Info_ValueForKey(), cgs_t::jediVmerc, cgs_t::mapname, cgs_t::maxclients, cg_t::mInRMG, cg_t::mRMGWeather, cgs_t::needpass, cgs_t::noSpecMove, qfalse, qtrue, cgs_t::showDuelHealths, cgs_t::siegeTeamSwitch, cgs_t::stepSlideFix, cgs_t::teamflags, cgs_t::timelimit, trap_Cvar_Set(), va(), and cgs_t::wDisable.

Referenced by CG_Init().

00105                                 {
00106         const char      *info;
00107         const char      *tinfo;
00108         char    *mapname;
00109 
00110         info = CG_ConfigString( CS_SERVERINFO );
00111 
00112         cgs.debugMelee = atoi( Info_ValueForKey( info, "g_debugMelee" ) ); //trap_Cvar_GetHiddenVarValue("g_iknowkungfu");
00113         cgs.stepSlideFix = atoi( Info_ValueForKey( info, "g_stepSlideFix" ) );
00114 
00115         cgs.noSpecMove = atoi( Info_ValueForKey( info, "g_noSpecMove" ) );
00116 
00117         trap_Cvar_Set("bg_fighterAltControl", Info_ValueForKey( info, "bg_fighterAltControl" ));
00118 
00119         cgs.siegeTeamSwitch = atoi( Info_ValueForKey( info, "g_siegeTeamSwitch" ) );
00120 
00121         cgs.showDuelHealths = atoi( Info_ValueForKey( info, "g_showDuelHealths" ) );
00122 
00123         cgs.gametype = atoi( Info_ValueForKey( info, "g_gametype" ) );
00124         trap_Cvar_Set("g_gametype", va("%i", cgs.gametype));
00125         cgs.needpass = atoi( Info_ValueForKey( info, "needpass" ) );
00126         cgs.jediVmerc = atoi( Info_ValueForKey( info, "g_jediVmerc" ) );
00127         cgs.wDisable = atoi( Info_ValueForKey( info, "wdisable" ) );
00128         cgs.fDisable = atoi( Info_ValueForKey( info, "fdisable" ) );
00129         cgs.dmflags = atoi( Info_ValueForKey( info, "dmflags" ) );
00130         cgs.teamflags = atoi( Info_ValueForKey( info, "teamflags" ) );
00131         cgs.fraglimit = atoi( Info_ValueForKey( info, "fraglimit" ) );
00132         cgs.duel_fraglimit = atoi( Info_ValueForKey( info, "duel_fraglimit" ) );
00133         cgs.capturelimit = atoi( Info_ValueForKey( info, "capturelimit" ) );
00134         cgs.timelimit = atoi( Info_ValueForKey( info, "timelimit" ) );
00135         cgs.maxclients = atoi( Info_ValueForKey( info, "sv_maxclients" ) );
00136         mapname = Info_ValueForKey( info, "mapname" );
00137 
00138         //rww - You must do this one here, Info_ValueForKey always uses the same memory pointer.
00139         trap_Cvar_Set ( "ui_about_mapname", mapname );
00140 
00141         Com_sprintf( cgs.mapname, sizeof( cgs.mapname ), "maps/%s.bsp", mapname );
00142 //      Q_strncpyz( cgs.redTeam, Info_ValueForKey( info, "g_redTeam" ), sizeof(cgs.redTeam) );
00143 //      trap_Cvar_Set("g_redTeam", cgs.redTeam);
00144 //      Q_strncpyz( cgs.blueTeam, Info_ValueForKey( info, "g_blueTeam" ), sizeof(cgs.blueTeam) );
00145 //      trap_Cvar_Set("g_blueTeam", cgs.blueTeam);
00146 
00147         trap_Cvar_Set ( "ui_about_gametype", va("%i", cgs.gametype ) );
00148         trap_Cvar_Set ( "ui_about_fraglimit", va("%i", cgs.fraglimit ) );
00149         trap_Cvar_Set ( "ui_about_duellimit", va("%i", cgs.duel_fraglimit ) );
00150         trap_Cvar_Set ( "ui_about_capturelimit", va("%i", cgs.capturelimit ) );
00151         trap_Cvar_Set ( "ui_about_timelimit", va("%i", cgs.timelimit ) );
00152         trap_Cvar_Set ( "ui_about_maxclients", va("%i", cgs.maxclients ) );
00153         trap_Cvar_Set ( "ui_about_dmflags", va("%i", cgs.dmflags ) );
00154         trap_Cvar_Set ( "ui_about_hostname", Info_ValueForKey( info, "sv_hostname" ) );
00155         trap_Cvar_Set ( "ui_about_needpass", Info_ValueForKey( info, "g_needpass" ) );
00156         trap_Cvar_Set ( "ui_about_botminplayers", Info_ValueForKey ( info, "bot_minplayers" ) );
00157 
00158         //Set the siege teams based on what the server has for overrides.
00159         trap_Cvar_Set("cg_siegeTeam1", Info_ValueForKey(info, "g_siegeTeam1"));
00160         trap_Cvar_Set("cg_siegeTeam2", Info_ValueForKey(info, "g_siegeTeam2"));
00161 
00162         tinfo = CG_ConfigString( CS_TERRAINS + 1 );
00163         if ( !tinfo || !*tinfo )
00164         {
00165                 cg.mInRMG = qfalse;
00166         }
00167         else
00168         {
00169                 int weather = 0;
00170 
00171                 cg.mInRMG = qtrue;
00172                 trap_Cvar_Set("RMG", "1");
00173 
00174                 weather = atoi( Info_ValueForKey( info, "RMG_weather" ) );
00175 
00176                 trap_Cvar_Set("RMG_weather", va("%i", weather));
00177 
00178                 if (weather == 1 || weather == 2)
00179                 {
00180                         cg.mRMGWeather = qtrue;
00181                 }
00182                 else
00183                 {
00184                         cg.mRMGWeather = qfalse;
00185                 }
00186         }
00187 }

void CG_ParseSiegeExtendedData void   ) 
 

Definition at line 1063 of file cg_saga.c.

References CG_Argv(), CG_ParseSiegeExtendedDataEntry(), and trap_Argc().

01064 {
01065         int numEntries = trap_Argc();
01066         int i = 0;
01067 
01068         if (numEntries < 1)
01069         {
01070                 assert(!"Bad numEntries for sxd");
01071                 return;
01072         }
01073 
01074         while (i < numEntries)
01075         {
01076                 CG_ParseSiegeExtendedDataEntry(CG_Argv(i+1));
01077                 i++;
01078         }
01079 }

void CG_ParseSiegeObjectiveStatus const char *  str  ) 
 

Definition at line 458 of file cg_saga.c.

References BG_SiegeGetPairedValue(), cg, CG_SiegeBriefingDisplay(), PERS_TEAM, playerState_s::persistant, cg_t::predictedPlayerState, SIEGETEAM_TEAM1, SIEGETEAM_TEAM2, TEAM_SPECTATOR, trap_Cvar_Set(), and va().

00459 {
00460         int i = 0;
00461         int     team = SIEGETEAM_TEAM1;
00462         char *cvarName;
00463         char *s;
00464         int objectiveNum = 0;
00465 
00466         if (!str || !str[0])
00467         {
00468                 return;
00469         }
00470 
00471         while (str[i])
00472         {
00473                 if (str[i] == '|')
00474                 { //switch over to team2, this is the next section
00475             team = SIEGETEAM_TEAM2;
00476                         objectiveNum = 0;
00477                 }
00478                 else if (str[i] == '-')
00479                 {
00480                         objectiveNum++;
00481                         i++;
00482 
00483                         cvarName = va("team%i_objective%i", team, objectiveNum);
00484                         if (str[i] == '1')
00485                         { //it's completed
00486                                 trap_Cvar_Set(cvarName, "1");
00487                         }
00488                         else
00489                         { //otherwise assume it is not
00490                                 trap_Cvar_Set(cvarName, "0");
00491                         }
00492 
00493                         s = CG_SiegeObjectiveBuffer(team, objectiveNum);
00494                         if (s && s[0])
00495                         { //now set the description and graphic cvars to by read by the menu
00496                                 char buffer[8192];
00497 
00498                                 cvarName = va("team%i_objective%i_longdesc", team, objectiveNum);
00499                                 if (BG_SiegeGetPairedValue(s, "objdesc", buffer))
00500                                 {
00501                                         trap_Cvar_Set(cvarName, buffer);
00502                                 }
00503                                 else
00504                                 {
00505                                         trap_Cvar_Set(cvarName, "UNSPECIFIED");
00506                                 }
00507 
00508                                 cvarName = va("team%i_objective%i_gfx", team, objectiveNum);
00509                                 if (BG_SiegeGetPairedValue(s, "objgfx", buffer))
00510                                 {
00511                                         trap_Cvar_Set(cvarName, buffer);
00512                                 }
00513                                 else
00514                                 {
00515                                         trap_Cvar_Set(cvarName, "UNSPECIFIED");
00516                                 }
00517 
00518                                 cvarName = va("team%i_objective%i_mapicon", team, objectiveNum);
00519                                 if (BG_SiegeGetPairedValue(s, "mapicon", buffer))
00520                                 {
00521                                         trap_Cvar_Set(cvarName, buffer);
00522                                 }
00523                                 else
00524                                 {
00525                                         trap_Cvar_Set(cvarName, "UNSPECIFIED");
00526                                 }
00527 
00528                                 cvarName = va("team%i_objective%i_litmapicon", team, objectiveNum);
00529                                 if (BG_SiegeGetPairedValue(s, "litmapicon", buffer))
00530                                 {
00531                                         trap_Cvar_Set(cvarName, buffer);
00532                                 }
00533                                 else
00534                                 {
00535                                         trap_Cvar_Set(cvarName, "UNSPECIFIED");
00536                                 }
00537 
00538                                 cvarName = va("team%i_objective%i_donemapicon", team, objectiveNum);
00539                                 if (BG_SiegeGetPairedValue(s, "donemapicon", buffer))
00540                                 {
00541                                         trap_Cvar_Set(cvarName, buffer);
00542                                 }
00543                                 else
00544                                 {
00545                                         trap_Cvar_Set(cvarName, "UNSPECIFIED");
00546                                 }
00547 
00548                                 cvarName = va("team%i_objective%i_mappos", team, objectiveNum);
00549                                 if (BG_SiegeGetPairedValue(s, "mappos", buffer))
00550                                 {
00551                                         trap_Cvar_Set(cvarName, buffer);
00552                                 }
00553                                 else
00554                                 {
00555                                         trap_Cvar_Set(cvarName, "0 0 32 32");
00556                                 }
00557                         }
00558                 }
00559                 i++;
00560         }
00561 
00562         if (cg.predictedPlayerState.persistant[PERS_TEAM] != TEAM_SPECTATOR)
00563         { //update menu cvars
00564                 CG_SiegeBriefingDisplay(cg.predictedPlayerState.persistant[PERS_TEAM], 1);
00565         }
00566 }

void CG_ParseSiegeState const char *  str  ) 
 

Definition at line 1403 of file cg_main.c.

References atoi(), cg, cgSiegeRoundBeganTime, cgSiegeRoundState, cgSiegeRoundTime, and cg_t::time.

01404 {
01405         int i = 0;
01406         int j = 0;
01407 //      int prevState = cgSiegeRoundState;
01408         char b[1024];
01409 
01410         while (str[i] && str[i] != '|')
01411         {
01412                 b[j] = str[i];
01413                 i++;
01414                 j++;
01415         }
01416         b[j] = 0;
01417         cgSiegeRoundState = atoi(b);
01418 
01419         if (str[i] == '|')
01420         {
01421                 j = 0;
01422                 i++;
01423                 while (str[i])
01424                 {
01425                         b[j] = str[i];
01426                         i++;
01427                         j++;
01428                 }
01429                 b[j] = 0;
01430 //              if (cgSiegeRoundState != prevState)
01431                 { //it changed
01432                         cgSiegeRoundTime = atoi(b);
01433                         if (cgSiegeRoundState == 0 || cgSiegeRoundState == 2)
01434                         {
01435                                 cgSiegeRoundBeganTime = cgSiegeRoundTime;
01436                         }
01437                 }
01438         }
01439         else
01440         {
01441             cgSiegeRoundTime = cg.time;
01442         }
01443 }

void CG_ParseWeatherEffect const char *  str  ) 
 

Definition at line 1395 of file cg_main.c.

References trap_R_WorldEffectCommand().

01396 {
01397         char *sptr = (char *)str;
01398         sptr++; //pass the '*'
01399         trap_R_WorldEffectCommand(sptr);
01400 }

void CG_PrecacheNPCSounds const char *  str  ) 
 

Definition at line 432 of file cg_servercmds.c.

00433 {
00434         char sEnd[MAX_QPATH];
00435         char pEnd[MAX_QPATH];
00436         int i = 0;
00437         int j = 0;
00438         int k = 0;
00439 
00440         k = 2;
00441 
00442         while (str[k])
00443         {
00444                 pEnd[k-2] = str[k];
00445                 k++;
00446         }
00447         pEnd[k-2] = 0;
00448 
00449         while (i < 4) //4 types
00450         { //It would be better if we knew what type this actually was (extra, combat, jedi, etc).
00451           //But that would require extra configstring indexing and that is a bad thing.
00452 
00453                 while (j < MAX_CUSTOM_SOUNDS)
00454                 {
00455                         const char *s = GetCustomSoundForType(i+1, j);
00456 
00457                         if (s && s[0])
00458                         { //whatever it is, try registering it under this folder.
00459                                 k = 1;
00460                                 while (s[k])
00461                                 {
00462                                         sEnd[k-1] = s[k];
00463                                         k++;
00464                                 }
00465                                 sEnd[k-1] = 0;
00466 
00467                                 trap_S_ShutUp(qtrue);
00468                                 trap_S_RegisterSound( va("sound/chars/%s/misc/%s", pEnd, sEnd) );
00469                                 trap_S_ShutUp(qfalse);
00470                         }
00471                         else
00472                         { //move onto the next set
00473                                 break;
00474                         }
00475 
00476                         j++;
00477                 }
00478 
00479                 j = 0;
00480                 i++;
00481         }
00482 }

void CG_SetConfigValues void   ) 
 

Definition at line 213 of file cg_servercmds.c.

References atoi(), cgs_t::blueflag, cg, CG_ConfigString(), cgs, CS_CLIENT_DUELISTS, CS_CLIENT_DUELWINNER, CS_CLIENT_JEDIMASTER, CS_FLAGSTATUS, CS_LEVEL_START_TIME, CS_SCORES1, CS_SCORES2, CS_WARMUP, cgs_t::duelist1, cgs_t::duelist2, cgs_t::duelWinner, cgs_t::gametype, GT_CTF, GT_CTY, cgs_t::jediMaster, cgs_t::levelStartTime, cgs_t::redflag, cgs_t::scores1, cgs_t::scores2, and cg_t::warmup.

Referenced by CG_Init().

00214 {
00215         const char *s;
00216         const char *str;
00217 
00218         cgs.scores1 = atoi( CG_ConfigString( CS_SCORES1 ) );
00219         cgs.scores2 = atoi( CG_ConfigString( CS_SCORES2 ) );
00220         cgs.levelStartTime = atoi( CG_ConfigString( CS_LEVEL_START_TIME ) );
00221         if( cgs.gametype == GT_CTF || cgs.gametype == GT_CTY ) {
00222                 s = CG_ConfigString( CS_FLAGSTATUS );
00223                 cgs.redflag = s[0] - '0';
00224                 cgs.blueflag = s[1] - '0';
00225         }
00226         cg.warmup = atoi( CG_ConfigString( CS_WARMUP ) );
00227 
00228         // Track who the jedi master is
00229         cgs.jediMaster = atoi ( CG_ConfigString ( CS_CLIENT_JEDIMASTER ) );
00230         cgs.duelWinner = atoi ( CG_ConfigString ( CS_CLIENT_DUELWINNER ) );
00231 
00232         str = CG_ConfigString(CS_CLIENT_DUELISTS);
00233 
00234         if (str && str[0])
00235         {
00236                 char buf[64];
00237                 int c = 0;
00238                 int i = 0;
00239 
00240                 while (str[i] && str[i] != '|')
00241                 {
00242                         buf[c] = str[i];
00243                         c++;
00244                         i++;
00245                 }
00246                 buf[c] = 0;
00247 
00248                 cgs.duelist1 = atoi ( buf );
00249                 c = 0;
00250 
00251                 i++;
00252                 while (str[i])
00253                 {
00254                         buf[c] = str[i];
00255                         c++;
00256                         i++;
00257                 }
00258                 buf[c] = 0;
00259 
00260                 cgs.duelist2 = atoi ( buf );
00261         }
00262 }

void CG_ShaderStateChanged void   ) 
 

Definition at line 269 of file cg_servercmds.c.

References CG_ConfigString(), CS_SHADERSTATE, MAX_QPATH, strchr(), strcpy(), strncpy(), and strstr().

Referenced by CG_Init().

00269                                  {
00270         char originalShader[MAX_QPATH];
00271         char newShader[MAX_QPATH];
00272         char timeOffset[16];
00273         const char *o;
00274         char *n,*t;
00275 
00276         o = CG_ConfigString( CS_SHADERSTATE );
00277         while (o && *o) {
00278                 n = strstr(o, "=");
00279                 if (n && *n) {
00280                         strncpy(originalShader, o, n-o);
00281                         originalShader[n-o] = 0;
00282                         n++;
00283                         t = strstr(n, ":");
00284                         if (t && *t) {
00285                                 strncpy(newShader, n, t-n);
00286                                 newShader[t-n] = 0;
00287                         } else {
00288                                 break;
00289                         }
00290                         t++;
00291                         o = strstr(t, "@");
                        if (o) {
                                strncpy(timeOffset, t, o-t);
                                timeOffset[o-t] = 0;
                                o++;
                                trap_R_RemapShader( originalShader, newShader, timeOffset );
                        }
                } else {
                        break;
                }
        }
}

void CG_SiegeBriefingDisplay int  team,
int  dontshow
 

Referenced by CG_ParseSiegeObjectiveStatus().

void SetCustomSoundForType clientInfo_t ci,
int  setType,
int  index,
sfxHandle_t  sfx
 

Definition at line 332 of file cg_servercmds.c.

00333 {
00334         switch (setType)
00335         {
00336         case 1:
00337                 ci->sounds[index] = sfx;
00338                 break;
00339         case 2:
00340                 ci->combatSounds[index] = sfx;
00341                 break;
00342         case 3:
00343                 ci->extraSounds[index] = sfx;
00344                 break;
00345         case 4:
00346                 ci->jediSounds[index] = sfx;
00347                 break;
00348         case 5:
00349                 ci->siegeSounds[index] = sfx;
00350                 break;
00351         case 6:
00352                 ci->duelSounds[index] = sfx;
00353                 break;
00354         default:
00355                 assert(0);
00356                 break;
00357         }
00358 }

void SetDuelistHealthsFromConfigString const char *  str  ) 
 

Definition at line 612 of file cg_servercmds.c.

00612                                                            {
00613         char buf[64];
00614         int c = 0;
00615         int i = 0;
00616 
00617         while (str[i] && str[i] != '|')
00618         {
00619                 buf[c] = str[i];
00620                 c++;
00621                 i++;
00622         }
00623         buf[c] = 0;
00624 
00625         cgs.duelist1health = atoi ( buf );
00626 
00627         c = 0;
00628         i++;
00629         while (str[i] && str[i] != '|')
00630         {
00631                 buf[c] = str[i];
00632                 c++;
00633                 i++;
00634         }
00635         buf[c] = 0;
00636 
00637         cgs.duelist2health = atoi ( buf );
00638 
00639         c = 0;
00640         i++;
00641         if ( str[i] == '!' )
00642         {       // we only have 2 duelists, apparently.
00643                 cgs.duelist3health = -1;
00644                 return;
00645         }
00646 
00647         while (str[i] && str[i] != '|')
00648         {
00649                 buf[c] = str[i];
00650                 c++;
00651                 i++;
00652         }
00653         buf[c] = 0;
00654 
00655         cgs.duelist3health = atoi ( buf );
00656 }


Variable Documentation

int cg_beatingSiegeTime
 

Definition at line 669 of file cg_servercmds.c.

const char* cg_customCombatSoundNames[MAX_CUSTOM_COMBAT_SOUNDS]
 

Definition at line 305 of file cg_servercmds.c.

Referenced by CG_CustomSound().

const char* cg_customDuelSoundNames[MAX_CUSTOM_DUEL_SOUNDS]
 

Definition at line 308 of file cg_servercmds.c.

Referenced by CG_CustomSound(), and CG_LoadCISounds().

const char* cg_customExtraSoundNames[MAX_CUSTOM_EXTRA_SOUNDS]
 

Definition at line 306 of file cg_servercmds.c.

Referenced by CG_CustomSound().

const char* cg_customJediSoundNames[MAX_CUSTOM_JEDI_SOUNDS]
 

Definition at line 307 of file cg_servercmds.c.

Referenced by CG_CustomSound().

char* cg_customSoundNames[MAX_CUSTOM_SOUNDS]
 

Definition at line 304 of file cg_servercmds.c.

Referenced by CG_CustomSound(), and CG_LoadCISounds().

int cg_siegeWinTeam
 

Definition at line 670 of file cg_servercmds.c.

int cgSiegeRoundState
 

Definition at line 664 of file cg_servercmds.c.

int cgSiegeRoundTime
 

Definition at line 665 of file cg_servercmds.c.