codemp/game/bg_saga.h File Reference

#include "../namespace_begin.h"
#include "../namespace_end.h"

Go to the source code of this file.

Data Structures

struct  siegeClass_t
struct  siegeClassDesc_t
struct  siegeTeam_t

Defines

#define MAX_SIEGE_INFO_SIZE   16384
#define SIEGETEAM_TEAM1   1
#define SIEGETEAM_TEAM2   2
#define SIEGE_POINTS_OBJECTIVECOMPLETED   20
#define SIEGE_POINTS_FINALOBJECTIVECOMPLETED   30
#define SIEGE_POINTS_TEAMWONROUND   10
#define SIEGE_ROUND_BEGIN_TIME   5000
#define MAX_SIEGE_CLASSES   128
#define MAX_SIEGE_CLASSES_PER_TEAM   16
#define MAX_SIEGE_TEAMS   16
#define MAX_EXDATA_ENTS_TO_SEND   MAX_CLIENTS
#define SIEGE_CLASS_DESC_LEN   4096

Enumerations

enum  siegePlayerClassFlags_t {
  SPC_INFANTRY = 0, SPC_VANGUARD, SPC_SUPPORT, SPC_JEDI,
  SPC_DEMOLITIONIST, SPC_HEAVY_WEAPONS, SPC_MAX
}
enum  siegeClassFlags_t {
  CFL_MORESABERDMG = 0, CFL_STRONGAGAINSTPHYSICAL, CFL_FASTFORCEREGEN, CFL_STATVIEWER,
  CFL_HEAVYMELEE, CFL_SINGLE_ROCKET, CFL_CUSTOMSKEL, CFL_EXTRA_AMMO
}

Functions

int BG_SiegeGetValueGroup (char *buf, char *group, char *outbuf)
int BG_SiegeGetPairedValue (char *buf, char *key, char *outbuf)
void BG_SiegeStripTabs (char *buf)
void BG_SiegeLoadClasses (siegeClassDesc_t *descBuffer)
void BG_SiegeLoadTeams (void)
siegeTeam_tBG_SiegeFindThemeForTeam (int team)
void BG_PrecacheSabersForSiegeTeam (int team)
siegeClass_tBG_SiegeFindClassByName (const char *classname)
qboolean BG_SiegeCheckClassLegality (int team, char *classname)
void BG_SiegeSetTeamTheme (int team, char *themeName)
int BG_SiegeFindClassIndexByName (const char *classname)

Variables

siegeClass_t bgSiegeClasses [MAX_SIEGE_CLASSES]
int bgNumSiegeClasses
siegeTeam_t bgSiegeTeams [MAX_SIEGE_TEAMS]
int bgNumSiegeTeams
char siege_info [MAX_SIEGE_INFO_SIZE]
int siege_valid


Define Documentation

#define MAX_EXDATA_ENTS_TO_SEND   MAX_CLIENTS
 

Definition at line 17 of file bg_saga.h.

Referenced by G_SiegeClientExData().

#define MAX_SIEGE_CLASSES   128
 

Definition at line 12 of file bg_saga.h.

Referenced by BG_SiegeParseTeamFile(), and G_TeamForSiegeClass().

#define MAX_SIEGE_CLASSES_PER_TEAM   16
 

Definition at line 13 of file bg_saga.h.

#define MAX_SIEGE_INFO_SIZE   16384
 

Definition at line 1 of file bg_saga.h.

Referenced by CG_InitSiegeMode(), CG_PrecacheSiegeObjectiveAssetsForTeam(), CG_SiegeObjectiveCompleted(), decompTriggerUse(), InitSiegeMode(), siegeTriggerUse(), and UI_SetSiegeTeams().

#define MAX_SIEGE_TEAMS   16
 

Definition at line 15 of file bg_saga.h.

#define SIEGE_CLASS_DESC_LEN   4096
 

Definition at line 47 of file bg_saga.h.

Referenced by BG_SiegeParseClassFile().

#define SIEGE_POINTS_FINALOBJECTIVECOMPLETED   30
 

Definition at line 7 of file bg_saga.h.

Referenced by AddSiegeWinningTeamPoints().

#define SIEGE_POINTS_OBJECTIVECOMPLETED   20
 

Definition at line 6 of file bg_saga.h.

Referenced by BroadcastObjectiveCompletion().

#define SIEGE_POINTS_TEAMWONROUND   10
 

Definition at line 8 of file bg_saga.h.

Referenced by AddSiegeWinningTeamPoints().

#define SIEGE_ROUND_BEGIN_TIME   5000
 

Definition at line 10 of file bg_saga.h.

Referenced by SiegeCheckTimers().

#define SIEGETEAM_TEAM1   1
 

Definition at line 3 of file bg_saga.h.

Referenced by BG_SiegeCheckClassLegality(), BG_SiegeFindThemeForTeam(), BG_SiegeSetTeamTheme(), CalculateSiegeGoals(), CG_InitSiegeMode(), CG_ParseSiegeObjectiveStatus(), CG_Player(), CG_PrecacheSiegeObjectiveAssetsForTeam(), CG_SiegeBriefingDisplay(), CG_SiegeGetObjectiveDescription(), CG_SiegeGetObjectiveFinal(), CG_SiegeObjectiveCompleted(), CG_SiegeRoundOver(), ClientSpawn(), decompTriggerUse(), FindIntermissionPoint(), G_SiegeGetCompletionStatus(), G_SiegeSetObjectiveComplete(), G_TeamForSiegeClass(), InitSiegeMode(), multi_trigger(), multi_trigger_run(), NPC_SetMiscDefaultData(), SelectRandomTeamSpawnPoint(), SiegeCheckTimers(), SiegeDoTeamAssign(), SiegeItemThink(), SiegeObjectiveCompleted(), SiegeRoundComplete(), SiegeTakesPriority(), siegeTriggerUse(), UI_SetSiegeTeams(), and UI_UpdateCvarsForClass().

#define SIEGETEAM_TEAM2   2
 

Definition at line 4 of file bg_saga.h.

Referenced by BG_SiegeCheckClassLegality(), BG_SiegeFindThemeForTeam(), CG_InitSiegeMode(), CG_ParseSiegeObjectiveStatus(), CG_SiegeBriefingDisplay(), FindIntermissionPoint(), G_SiegeGetCompletionStatus(), G_SiegeSetObjectiveComplete(), G_TeamForSiegeClass(), InitSiegeMode(), multi_trigger(), multi_trigger_run(), NPC_SetMiscDefaultData(), SiegeCheckTimers(), SiegeDoTeamAssign(), SiegeItemThink(), UI_SetSiegeTeams(), and UI_UpdateCvarsForClass().


Enumeration Type Documentation

enum siegeClassFlags_t
 

Enumeration values:
CFL_MORESABERDMG 
CFL_STRONGAGAINSTPHYSICAL 
CFL_FASTFORCEREGEN 
CFL_STATVIEWER 
CFL_HEAVYMELEE 
CFL_SINGLE_ROCKET 
CFL_CUSTOMSKEL 
CFL_EXTRA_AMMO 

Definition at line 31 of file bg_saga.h.

00032 {
00033         CFL_MORESABERDMG = 0,
00034         CFL_STRONGAGAINSTPHYSICAL,
00035         CFL_FASTFORCEREGEN,
00036         CFL_STATVIEWER,
00037         CFL_HEAVYMELEE,
00038         CFL_SINGLE_ROCKET,//has only 1 rocket to use with rocketlauncher
00039         CFL_CUSTOMSKEL, //class uses a custom skeleton, be sure to load on server etc
00040         CFL_EXTRA_AMMO
00041 } siegeClassFlags_t;

enum siegePlayerClassFlags_t
 

Enumeration values:
SPC_INFANTRY 
SPC_VANGUARD 
SPC_SUPPORT 
SPC_JEDI 
SPC_DEMOLITIONIST 
SPC_HEAVY_WEAPONS 
SPC_MAX 

Definition at line 20 of file bg_saga.h.

00021 {
00022         SPC_INFANTRY = 0,
00023         SPC_VANGUARD,
00024         SPC_SUPPORT,
00025         SPC_JEDI,
00026         SPC_DEMOLITIONIST,
00027         SPC_HEAVY_WEAPONS,
00028         SPC_MAX
00029 } siegePlayerClassFlags_t;


Function Documentation

void BG_PrecacheSabersForSiegeTeam int  team  ) 
 

Definition at line 1363 of file bg_saga.c.

References BG_ModelCache(), BG_SiegeFindThemeForTeam(), siegeTeam_t::classes, MAX_SABERS, saberInfo_t::model, saberInfo_t::name, NULL, siegeTeam_t::numClasses, Q_stricmp(), siegeClass_t::saber1, siegeClass_t::saber2, and WP_SaberParseParms().

Referenced by CG_InitSiegeMode(), and InitSiegeMode().

01364 {
01365         siegeTeam_t *t;
01366         saberInfo_t saber;
01367         char *saberName;
01368         int sNum;
01369 
01370         t = BG_SiegeFindThemeForTeam(team);
01371 
01372         if (t)
01373         {
01374                 int i = 0;
01375 
01376                 while (i < t->numClasses)
01377                 {
01378                         sNum = 0;
01379 
01380                         while (sNum < MAX_SABERS)
01381                         {
01382                                 switch (sNum)
01383                                 {
01384                                 case 0:
01385                                         saberName = &t->classes[i]->saber1[0];
01386                                         break;
01387                                 case 1:
01388                                         saberName = &t->classes[i]->saber2[0];
01389                                         break;
01390                                 default:
01391                                         saberName = NULL;
01392                                         break;
01393                                 }
01394 
01395                                 if (saberName && saberName[0])
01396                                 {
01397                                         WP_SaberParseParms(saberName, &saber);
01398                                         if (!Q_stricmp(saberName, saber.name))
01399                                         { //found the matching saber
01400                                                 if (saber.model[0])
01401                                                 {
01402                                                         BG_ModelCache(saber.model, NULL);
01403                                                 }
01404                                         }
01405                                 }
01406 
01407                                 sNum++;
01408                         }
01409 
01410                         i++;
01411                 }
01412         }
01413 }

qboolean BG_SiegeCheckClassLegality int  team,
char *  classname
 

Definition at line 1416 of file bg_saga.c.

References NULL, Q_stricmp(), qboolean, qfalse, qtrue, SIEGETEAM_TEAM1, SIEGETEAM_TEAM2, strcpy(), team1Theme, and team2Theme.

Referenced by ClientUserinfoChanged(), and Cmd_SiegeClass_f().

01417 {
01418         siegeTeam_t **teamPtr = NULL;
01419         int i = 0;
01420 
01421         if (team == SIEGETEAM_TEAM1)
01422         {
01423                 teamPtr = &team1Theme;
01424         }
01425         else if (team == SIEGETEAM_TEAM2)
01426         {
01427                 teamPtr = &team2Theme;
01428         }
01429         else
01430         { //spectator? Whatever, you're legal then.
01431                 return qtrue;
01432         }
01433 
01434         if (!teamPtr || !(*teamPtr))
01435         { //Well, guess the class is ok, seeing as there is no team theme to begin with.
01436                 return qtrue;
01437         }
01438 
01439         //See if the class is listed on the team
01440         while (i < (*teamPtr)->numClasses)
01441         {
01442                 if (!Q_stricmp(classname, (*teamPtr)->classes[i]->name))
01443                 { //found it, so it's alright
01444                         return qtrue;
01445                 }
01446                 i++;
01447         }
01448 
01449         //Didn't find it, so copy the name of the first valid class over it.
01450         strcpy(classname, (*teamPtr)->classes[0]->name);
01451 
01452         return qfalse;
01453 }

siegeClass_t* BG_SiegeFindClassByName const char *  classname  ) 
 

Definition at line 1219 of file bg_saga.c.

References bgNumSiegeClasses, bgSiegeClasses, name, NULL, and Q_stricmp().

Referenced by BG_SiegeParseTeamFile(), CG_DrawSiegeInfo(), and CG_NewClientInfo().

01220 {
01221         int i = 0;
01222 
01223         while (i < bgNumSiegeClasses)
01224         {
01225                 if (!Q_stricmp(bgSiegeClasses[i].name, classname))
01226                 { //found it
01227                         return &bgSiegeClasses[i];
01228                 }
01229                 i++;
01230         }
01231 
01232         return NULL;
01233 }

int BG_SiegeFindClassIndexByName const char *  classname  ) 
 

Definition at line 1489 of file bg_saga.c.

References bgNumSiegeClasses, bgSiegeClasses, name, and Q_stricmp().

Referenced by CG_NewClientInfo(), ClientUserinfoChanged(), and G_ValidateSiegeClassForTeam().

01490 {
01491         int i = 0;
01492 
01493         while (i < bgNumSiegeClasses)
01494         {
01495                 if (!Q_stricmp(bgSiegeClasses[i].name, classname))
01496                 { //found it
01497                         return i;
01498                 }
01499                 i++;
01500         }
01501 
01502         return -1;
01503 }

siegeTeam_t* BG_SiegeFindThemeForTeam int  team  ) 
 

Definition at line 1344 of file bg_saga.c.

References NULL, SIEGETEAM_TEAM1, SIEGETEAM_TEAM2, team1Theme, and team2Theme.

Referenced by BG_GetClassOnBaseClass(), BG_GetUIPortrait(), BG_GetUIPortraitFile(), BG_PrecacheSabersForSiegeTeam(), BG_SiegeCountBaseClass(), CG_InitSiegeMode(), CG_PrecachePlayersForSiegeTeam(), G_SiegeRegisterWeaponsAndHoldables(), G_TeamForSiegeClass(), G_ValidateSiegeClassForTeam(), and UI_SetSiegeTeams().

01345 {
01346         if (team == SIEGETEAM_TEAM1)
01347         {
01348                 return team1Theme;
01349         }
01350         else if (team == SIEGETEAM_TEAM2)
01351         {
01352                 return team2Theme;
01353         }
01354 
01355     return NULL;
01356 }

int BG_SiegeGetPairedValue char *  buf,
char *  key,
char *  outbuf
 

Definition at line 408 of file bg_saga.c.

References Com_Error(), ERR_DROP, Q_stricmp(), qboolean, qfalse, qtrue, and SIEGECHAR_TAB.

Referenced by BG_SiegeParseClassFile(), BG_SiegeParseTeamFile(), CG_InitSiegeMode(), CG_ParseSiegeObjectiveStatus(), CG_PrecacheSiegeObjectiveAssetsForTeam(), CG_SiegeBriefingDisplay(), CG_SiegeGetObjectiveDescription(), CG_SiegeGetObjectiveFinal(), CG_SiegeObjectiveCompleted(), CG_SiegeRoundOver(), decompTriggerUse(), InitSiegeMode(), SiegeBeginRound(), SiegeRoundComplete(), siegeTriggerUse(), and UI_SetSiegeTeams().

00409 {
00410         int i = 0;
00411         int j;
00412         int k;
00413         char checkKey[4096];
00414 
00415         while (buf[i])
00416         {
00417                 if (buf[i] != ' ' && buf[i] != '{' && buf[i] != '}' && buf[i] != '\n' && buf[i] != '\r')
00418                 { //we're on a valid character
00419                         if (buf[i] == '/' &&
00420                                 buf[i+1] == '/')
00421                         { //this is a comment, so skip over it
00422                                 while (buf[i] && buf[i] != '\n' && buf[i] != '\r')
00423                                 {
00424                                         i++;
00425                                 }
00426                         }
00427                         else
00428                         { //parse to the next space/endline/eos and check this value against our key value.
00429                                 j = 0;
00430 
00431                                 while (buf[i] != ' ' && buf[i] != '\n' && buf[i] != '\r' && buf[i] != SIEGECHAR_TAB && buf[i])
00432                                 {
00433                                         if (buf[i] == '/' && buf[i+1] == '/')
00434                                         { //hit a comment, break out.
00435                                                 break;
00436                                         }
00437 
00438                                         checkKey[j] = buf[i];
00439                                         j++;
00440                                         i++;
00441                                 }
00442                                 checkKey[j] = 0;
00443 
00444                                 k = i;
00445 
00446                                 while (buf[k] && (buf[k] == ' ' || buf[k] == '\n' || buf[k] == '\r'))
00447                                 {
00448                                         k++;
00449                                 }
00450 
00451                                 if (buf[k] == '{')
00452                                 { //this is not the start of a value but rather of a group. We don't want to look in subgroups so skip over the whole thing.
00453                                         int openB = 0;
00454 
00455                                         while (buf[i] && (buf[i] != '}' || openB))
00456                                         {
00457                                                 if (buf[i] == '{')
00458                                                 {
00459                                                         openB++;
00460                                                 }
00461                                                 else if (buf[i] == '}')
00462                                                 {
00463                                                         openB--;
00464                                                 }
00465 
00466                                                 if (openB < 0)
00467                                                 {
00468                                                         Com_Error(ERR_DROP, "Unexpected closing bracket (too many) while parsing to end of group '%s'", checkKey);
00469                                                 }
00470 
00471                                                 if (buf[i] == '}' && !openB)
00472                                                 { //this is the end of the group
00473                                                         break;
00474                                                 }
00475                                                 i++;
00476                                         }
00477 
00478                                         if (buf[i] == '}')
00479                                         {
00480                                                 i++;
00481                                         }
00482                                 }
00483                                 else
00484                                 {
00485                                         //Is this the one we want?
00486                                         if (buf[i] != '/' || buf[i+1] != '/')
00487                                         { //make sure we didn't stop on a comment, if we did then this is considered an error in the file.
00488                                                 if (!Q_stricmp(checkKey, key))
00489                                                 { //guess so. Parse along to the next valid character, then put that into the output buffer and return 1.
00490                                                         while ((buf[i] == ' ' || buf[i] == '\n' || buf[i] == '\r' || buf[i] == SIEGECHAR_TAB) && buf[i])
00491                                                         {
00492                                                                 i++;
00493                                                         }
00494 
00495                                                         if (buf[i])
00496                                                         { //We're at the start of the value now.
00497                                                                 qboolean parseToQuote = qfalse;
00498 
00499                                                                 if (buf[i] == '\"')
00500                                                                 { //if the value is in quotes, then stop at the next quote instead of ' '
00501                                                                         i++;
00502                                                                         parseToQuote = qtrue;
00503                                                                 }
00504 
00505                                                                 j = 0;
00506                                                                 while ( ((!parseToQuote && buf[i] != ' ' && buf[i] != '\n' && buf[i] != '\r') || (parseToQuote && buf[i] != '\"')) )
00507                                                                 {
00508                                                                         if (buf[i] == '/' &&
00509                                                                                 buf[i+1] == '/')
00510                                                                         { //hit a comment after the value? This isn't an ideal way to be writing things, but we'll support it anyway.
00511                                                                                 break;
00512                                                                         }
00513                                                                         outbuf[j] = buf[i];
00514                                                                         j++;
00515                                                                         i++;
00516 
00517                                                                         if (!buf[i])
00518                                                                         {
00519                                                                                 if (parseToQuote)
00520                                                                                 {
00521                                                                                         Com_Error(ERR_DROP, "Unexpected EOF while looking for endquote, error finding paired value for '%s'", key);
00522                                                                                 }
00523                                                                                 else
00524                                                                                 {
00525                                                                                         Com_Error(ERR_DROP, "Unexpected EOF while looking for space or endline, error finding paired value for '%s'", key);
00526                                                                                 }
00527                                                                         }
00528                                                                 }
00529                                                                 outbuf[j] = 0;
00530 
00531                                                                 return 1; //we got it, so return 1.
00532                                                         }
00533                                                         else
00534                                                         {
00535                                                                 Com_Error(ERR_DROP, "Error parsing file, unexpected EOF while looking for valud '%s'", key);
00536                                                         }
00537                                                 }
00538                                                 else
00539                                                 { //if that wasn't the desired key, then make sure we parse to the end of the line, so we don't mistake a value for a key
00540                                                         while (buf[i] && buf[i] != '\n')
00541                                                         {
00542                                                                 i++;
00543                                                         }
00544                                                 }
00545                                         }
00546                                         else
00547                                         {
00548                                                 Com_Error(ERR_DROP, "Error parsing file, found comment, expected value for '%s'", key);
00549                                         }
00550                                 }
00551                         }
00552                 }
00553 
00554                 if (!buf[i])
00555                 {
00556                         break;
00557                 }
00558                 i++;
00559         }
00560 
00561         return 0; //guess we never found it.
00562 }

int BG_SiegeGetValueGroup char *  buf,
char *  group,
char *  outbuf
 

Definition at line 191 of file bg_saga.c.

References BG_SiegeStripTabs(), Com_Error(), ERR_DROP, Q_stricmp(), qboolean, qfalse, qtrue, and SIEGECHAR_TAB.

Referenced by BG_SiegeParseClassFile(), BG_SiegeParseTeamFile(), CG_InitSiegeMode(), CG_PrecacheSiegeObjectiveAssetsForTeam(), CG_SiegeBriefingDisplay(), CG_SiegeGetObjectiveDescription(), CG_SiegeGetObjectiveFinal(), CG_SiegeObjectiveCompleted(), CG_SiegeRoundOver(), decompTriggerUse(), InitSiegeMode(), SiegeRoundComplete(), siegeTriggerUse(), and UI_SetSiegeTeams().

00192 {
00193         int i = 0;
00194         int j;
00195         char checkGroup[4096];
00196         qboolean isGroup;
00197         int parseGroups = 0;
00198 
00199         while (buf[i])
00200         {
00201                 if (buf[i] != ' ' && buf[i] != '{' && buf[i] != '}' && buf[i] != '\n' && buf[i] != '\r' && buf[i] != SIEGECHAR_TAB)
00202                 { //we're on a valid character
00203                         if (buf[i] == '/' &&
00204                                 buf[i+1] == '/')
00205                         { //this is a comment, so skip over it
00206                                 while (buf[i] && buf[i] != '\n' && buf[i] != '\r' && buf[i] != SIEGECHAR_TAB)
00207                                 {
00208                                         i++;
00209                                 }
00210                         }
00211                         else
00212                         { //parse to the next space/endline/eos and check this value against our group value.
00213                                 j = 0;
00214 
00215                                 while (buf[i] != ' ' && buf[i] != '\n' && buf[i] != '\r' && buf[i] != SIEGECHAR_TAB && buf[i] != '{' && buf[i])
00216                                 {
00217                                         if (buf[i] == '/' && buf[i+1] == '/')
00218                                         { //hit a comment, break out.
00219                                                 break;
00220                                         }
00221 
00222                                         checkGroup[j] = buf[i];
00223                                         j++;
00224                                         i++;
00225                                 }
00226                                 checkGroup[j] = 0;
00227 
00228                                 //Make sure this is a group as opposed to a globally defined value.
00229                                 if (buf[i] == '/' && buf[i+1] == '/')
00230                                 { //stopped on a comment, so first parse to the end of it.
00231                     while (buf[i] && buf[i] != '\n' && buf[i] != '\r')
00232                                         {
00233                                                 i++;
00234                                         }
00235                                         while (buf[i] == '\n' || buf[i] == '\r')
00236                                         {
00237                                                 i++;
00238                                         }
00239                                 }
00240 
00241                                 if (!buf[i])
00242                                 {
00243                                         Com_Error(ERR_DROP, "Unexpected EOF while looking for group '%s'", group);
00244                                 }
00245 
00246                                 isGroup = qfalse;
00247 
00248                                 while (buf[i] && buf[i] == ' ' || buf[i] == SIEGECHAR_TAB || buf[i] == '\n' || buf[i] == '\r')
00249                                 { //parse to the next valid character
00250                                         i++;
00251                                 }
00252 
00253                                 if (buf[i] == '{')
00254                                 { //if the next valid character is an opening bracket, then this is indeed a group
00255                                         isGroup = qtrue;
00256                                 }
00257 
00258                                 //Is this the one we want?
00259                                 if (isGroup && !Q_stricmp(checkGroup, group))
00260                                 { //guess so. Parse until we hit the { indicating the beginning of the group.
00261                                         while (buf[i] != '{' && buf[i])
00262                                         {
00263                                                 i++;
00264                                         }
00265 
00266                                         if (buf[i])
00267                                         { //We're at the start of the group now, so parse to the closing bracket.
00268                                                 j = 0;
00269 
00270                                                 parseGroups = 0;
00271 
00272                                                 while ((buf[i] != '}' || parseGroups) && buf[i])
00273                                                 {
00274                                                         if (buf[i] == '{')
00275                                                         { //increment for the opening bracket.
00276                                                                 parseGroups++;
00277                                                         }
00278                                                         else if (buf[i] == '}')
00279                                                         { //decrement for the closing bracket
00280                                                                 parseGroups--;
00281                                                         }
00282 
00283                                                         if (parseGroups < 0)
00284                                                         { //Syntax error, I guess.
00285                                                                 Com_Error(ERR_DROP, "Found a closing bracket without an opening bracket while looking for group '%s'", group);
00286                                                         }
00287 
00288                                                         if ((buf[i] != '{' || parseGroups > 1) &&
00289                                                                 (buf[i] != '}' || parseGroups > 0))
00290                                                         { //don't put the start and end brackets for this group into the output buffer
00291                                                                 outbuf[j] = buf[i];
00292                                                                 j++;
00293                                                         }
00294 
00295                                                         if (buf[i] == '}' && !parseGroups)
00296                                                         { //Alright, we can break out now.
00297                                                                 break;
00298                                                         }
00299 
00300                                                         i++;
00301                                                 }
00302                                                 outbuf[j] = 0;
00303 
00304                                                 //Verify that we ended up on the closing bracket.
00305                                                 if (buf[i] != '}')
00306                                                 {
00307                                                         Com_Error(ERR_DROP, "Group '%s' is missing a closing bracket", group);
00308                                                 }
00309 
00310                                                 //Strip the tabs so we're friendly for value parsing.
00311                                                 BG_SiegeStripTabs(outbuf);
00312 
00313                                                 return 1; //we got it, so return 1.
00314                                         }
00315                                         else
00316                                         {
00317                                                 Com_Error(ERR_DROP, "Error parsing group in file, unexpected EOF before opening bracket while looking for group '%s'", group);
00318                                         }
00319                                 }
00320                                 else if (!isGroup)
00321                                 { //if it wasn't a group, parse to the end of the line
00322                                         while (buf[i] && buf[i] != '\n' && buf[i] != '\r')
00323                                         {
00324                                                 i++;
00325                                         }
00326                                 }
00327                                 else
00328                                 { //this was a group but we not the one we wanted to find, so parse by it.
00329                                         parseGroups = 0;
00330 
00331                                         while (buf[i] && (buf[i] != '}' || parseGroups))
00332                                         {
00333                                                 if (buf[i] == '{')
00334                                                 {
00335                                                         parseGroups++;
00336                                                 }
00337                                                 else if (buf[i] == '}')
00338                                                 {
00339                                                         parseGroups--;
00340                                                 }
00341 
00342                                                 if (parseGroups < 0)
00343                                                 { //Syntax error, I guess.
00344                                                         Com_Error(ERR_DROP, "Found a closing bracket without an opening bracket while looking for group '%s'", group);
00345                                                 }
00346 
00347                                                 if (buf[i] == '}' && !parseGroups)
00348                                                 { //Alright, we can break out now.
00349                                                         break;
00350                                                 }
00351 
00352                                                 i++;
00353                                         }
00354 
00355                                         if (buf[i] != '}')
00356                                         {
00357                                                 Com_Error(ERR_DROP, "Found an opening bracket without a matching closing bracket while looking for group '%s'", group);
00358                                         }
00359 
00360                                         i++;
00361                                 }
00362                         }
00363                 }
00364                 else if (buf[i] == '{')
00365                 { //we're in a group that isn't the one we want, so parse to the end.
00366                         parseGroups = 0;
00367 
00368                         while (buf[i] && (buf[i] != '}' || parseGroups))
00369                         {
00370                                 if (buf[i] == '{')
00371                                 {
00372                                         parseGroups++;
00373                                 }
00374                                 else if (buf[i] == '}')
00375                                 {
00376                                         parseGroups--;
00377                                 }
00378 
00379                                 if (parseGroups < 0)
00380                                 { //Syntax error, I guess.
00381                                         Com_Error(ERR_DROP, "Found a closing bracket without an opening bracket while looking for group '%s'", group);
00382                                 }
00383 
00384                                 if (buf[i] == '}' && !parseGroups)
00385                                 { //Alright, we can break out now.
00386                                         break;
00387                                 }
00388 
00389                                 i++;
00390                         }
00391 
00392                         if (buf[i] != '}')
00393                         {
00394                                 Com_Error(ERR_DROP, "Found an opening bracket without a matching closing bracket while looking for group '%s'", group);
00395                         }
00396                 }
00397 
00398                 if (!buf[i])
00399                 {
00400                         break;
00401                 }
00402                 i++;
00403         }
00404 
00405         return 0; //guess we never found it.
00406 }

void BG_SiegeLoadClasses siegeClassDesc_t descBuffer  ) 
 

Definition at line 1181 of file bg_saga.c.

References BG_SiegeParseClassFile(), bgNumSiegeClasses, MAX_QPATH, NULL, strcat(), strcpy(), strlen(), and trap_FS_GetFileList().

Referenced by CG_InitSiegeMode(), InitSiegeMode(), and UI_SiegeInit().

01182 {
01183         int numFiles;
01184         int filelen;
01185         char filelist[4096];
01186         char filename[MAX_QPATH];
01187         char* fileptr;
01188         int i;
01189 
01190         bgNumSiegeClasses = 0;
01191 
01192         numFiles = trap_FS_GetFileList("ext_data/Siege/Classes", ".scl", filelist, 4096 );
01193         fileptr = filelist;
01194 
01195         for (i = 0; i < numFiles; i++, fileptr += filelen+1)
01196         {
01197                 filelen = strlen(fileptr);
01198                 strcpy(filename, "ext_data/Siege/Classes/");
01199                 strcat(filename, fileptr);
01200 
01201                 if (descBuffer)
01202                 {
01203                         BG_SiegeParseClassFile(filename, &descBuffer[i]);
01204                 }
01205                 else
01206                 {
01207                         BG_SiegeParseClassFile(filename, NULL);
01208                 }
01209         }
01210 }

void BG_SiegeLoadTeams void   ) 
 

Definition at line 1314 of file bg_saga.c.

References BG_SiegeParseTeamFile(), bgNumSiegeTeams, MAX_QPATH, strcat(), strcpy(), strlen(), and trap_FS_GetFileList().

Referenced by CG_InitSiegeMode(), InitSiegeMode(), and UI_SiegeInit().

01315 {
01316         int numFiles;
01317         int filelen;
01318         char filelist[4096];
01319         char filename[MAX_QPATH];
01320         char* fileptr;
01321         int i;
01322 
01323         bgNumSiegeTeams = 0;
01324 
01325         numFiles = trap_FS_GetFileList("ext_data/Siege/Teams", ".team", filelist, 4096 );
01326         fileptr = filelist;
01327 
01328         for (i = 0; i < numFiles; i++, fileptr += filelen+1)
01329         {
01330                 filelen = strlen(fileptr);
01331                 strcpy(filename, "ext_data/Siege/Teams/");
01332                 strcat(filename, fileptr);
01333                 BG_SiegeParseTeamFile(filename);
01334         }
01335 }

void BG_SiegeSetTeamTheme int  team,
char *  themeName
 

Definition at line 1473 of file bg_saga.c.

References BG_SiegeFindTeamForTheme(), NULL, SIEGETEAM_TEAM1, team1Theme, and team2Theme.

Referenced by CG_InitSiegeMode(), InitSiegeMode(), and UI_SetSiegeTeams().

01474 {
01475         siegeTeam_t **teamPtr = NULL;
01476 
01477         if (team == SIEGETEAM_TEAM1)
01478         {
01479                 teamPtr = &team1Theme;
01480         }
01481         else
01482         {
01483                 teamPtr = &team2Theme;
01484         }
01485 
01486         (*teamPtr) = BG_SiegeFindTeamForTheme(themeName);
01487 }

void BG_SiegeStripTabs char *  buf  ) 
 

Definition at line 168 of file bg_saga.c.

References SIEGECHAR_TAB.

Referenced by BG_SiegeGetValueGroup().

00169 {
00170         int i = 0;
00171         int i_r = 0;
00172 
00173         while (buf[i])
00174         {
00175                 if (buf[i] != SIEGECHAR_TAB)
00176                 { //not a tab, just stick it in
00177                         buf[i_r] = buf[i];
00178                 }
00179                 else
00180                 { //If it's a tab, convert it to a space.
00181                         buf[i_r] = ' ';
00182                 }
00183 
00184                 i_r++;
00185                 i++;
00186         }
00187 
00188         buf[i_r] = '\0';
00189 }


Variable Documentation

int bgNumSiegeClasses
 

Definition at line 93 of file bg_saga.h.

Referenced by BG_SiegeFindClassByName(), BG_SiegeFindClassIndexByName(), BG_SiegeLoadClasses(), BG_SiegeParseClassFile(), CG_InitSiegeMode(), InitSiegeMode(), UI_SiegeClassNum(), and UI_SiegeInit().

int bgNumSiegeTeams
 

Definition at line 96 of file bg_saga.h.

Referenced by BG_SiegeFindTeamForTheme(), BG_SiegeLoadTeams(), BG_SiegeParseTeamFile(), CG_InitSiegeMode(), InitSiegeMode(), and UI_SiegeInit().

siegeClass_t bgSiegeClasses[MAX_SIEGE_CLASSES]
 

Definition at line 92 of file bg_saga.h.

Referenced by BG_SiegeFindClassByName(), BG_SiegeFindClassIndexByName(), BG_SiegeParseClassFile(), CG_DrawActiveFrame(), CG_GetClassCount(), ClientSpawn(), ClientThink_real(), ClientUserinfoChanged(), Cmd_SaberAttackCycle_f(), G_Damage(), G_HeavyMelee(), G_RunFrame(), G_SetSaber(), G_ValidateSiegeClassForTeam(), multi_trigger(), SelectRandomTeamSpawnPoint(), SetupGameGhoul2Model(), shield_power_converter_use(), Touch_Multi(), TryHeal(), UI_SiegeClassNum(), WP_ForcePowersUpdate(), WP_InitForcePowers(), and WP_SpawnInitForcePowers().

siegeTeam_t bgSiegeTeams[MAX_SIEGE_TEAMS]
 

Definition at line 95 of file bg_saga.h.

Referenced by BG_SiegeFindTeamForTheme(), and BG_SiegeParseTeamFile().

char siege_info[MAX_SIEGE_INFO_SIZE]
 

Definition at line 112 of file bg_saga.h.

Referenced by CG_InitSiegeMode(), CG_PrecacheSiegeObjectiveAssetsForTeam(), CG_SiegeBriefingDisplay(), CG_SiegeGetObjectiveDescription(), CG_SiegeGetObjectiveFinal(), CG_SiegeObjectiveCompleted(), CG_SiegeRoundOver(), decompTriggerUse(), InitSiegeMode(), SiegeBeginRound(), SiegeRoundComplete(), siegeTriggerUse(), and UI_SetSiegeTeams().

int siege_valid
 

Definition at line 113 of file bg_saga.h.

Referenced by CG_InitSiegeMode(), CG_PrecacheSiegeObjectiveAssetsForTeam(), CG_SiegeBriefingDisplay(), CG_SiegeObjectiveCompleted(), CG_SiegeRoundOver(), InitSiegeMode(), siegeTriggerUse(), SP_info_siege_decomplete(), SP_info_siege_objective(), SP_info_siege_radaricon(), SP_misc_siege_item(), and SP_target_siege_end().