#include "cg_local.h"#include "bg_saga.h"Go to the source code of this file.
|
||||||||||||
|
Definition at line 4353 of file cg_draw.c. References trap_Cvar_Set(), trap_OpenUIMenu(), UIMENU_CLOSEALL, UIMENU_SIEGEMESSAGE, and UIMENU_SIEGEOBJECTIVES. Referenced by CG_SiegeBriefingDisplay(), and CG_SiegeRoundOver().
04354 {
04355 // if (!( trap_Key_GetCatcher() & KEYCATCH_UI ))
04356 {
04357 trap_OpenUIMenu(UIMENU_CLOSEALL);
04358 trap_Cvar_Set("cg_siegeMessage", str);
04359 if (objectiveScreen)
04360 {
04361 trap_OpenUIMenu(UIMENU_SIEGEOBJECTIVES);
04362 }
04363 else
04364 {
04365 trap_OpenUIMenu(UIMENU_SIEGEMESSAGE);
04366 }
04367 }
04368 }
|
|
|
Definition at line 4370 of file cg_draw.c. References BIGCHAR_WIDTH, CG_CenterPrint(), SCREEN_HEIGHT, and trap_SP_GetStringTextString(). Referenced by CG_SiegeObjectiveCompleted().
04371 {
04372 char text[1024];
04373 if (str[0]=='@')
04374 {
04375 trap_SP_GetStringTextString(str+1, text, sizeof(text));
04376 str = text;
04377 }
04378 CG_CenterPrint(str, SCREEN_HEIGHT * 0.30, BIGCHAR_WIDTH);
04379 }
|
|
|
Definition at line 143 of file cg_saga.c. References atoi(), BG_PrecacheSabersForSiegeTeam(), BG_SiegeFindThemeForTeam(), BG_SiegeGetPairedValue(), BG_SiegeGetValueGroup(), BG_SiegeLoadClasses(), BG_SiegeLoadTeams(), BG_SiegeSetTeamTheme(), bgNumSiegeClasses, bgNumSiegeTeams, CG_Error(), CG_PrecachePlayersForSiegeTeam(), CG_PrecacheSiegeObjectiveAssetsForTeam(), CG_SetSiegeTimerCvar(), cgs, cgSiegeTeam1PlShader, cgSiegeTeam2PlShader, siegeTeam_t::classes, Com_sprintf(), fileHandle_t, siegeClass_t::forcedModel, siegeClass_t::forcedSkin, siegeTeam_t::friendlyShader, FS_READ, cgs_t::gametype, GT_SIEGE, cgs_t::mapname, MAX_QPATH, MAX_SIEGE_INFO_SIZE, NULL, siegeTeam_t::numClasses, Q_stricmp(), siege_info, siege_valid, SIEGETEAM_TEAM1, SIEGETEAM_TEAM2, strchr(), strcpy(), strlen(), team1Timed, team2Timed, trap_Cvar_Set(), trap_Cvar_VariableStringBuffer(), trap_FS_FCloseFile(), trap_FS_FOpenFile(), trap_FS_Read(), trap_R_RegisterModel(), trap_R_RegisterShaderNoMip(), trap_R_RegisterSkin(), trap_SP_GetStringTextString(), and va(). Referenced by CG_Init().
00144 {
00145 char levelname[MAX_QPATH];
00146 char btime[1024];
00147 char teams[2048];
00148 char teamInfo[MAX_SIEGE_INFO_SIZE];
00149 int len = 0;
00150 int i = 0;
00151 int j = 0;
00152 siegeClass_t *cl;
00153 siegeTeam_t *sTeam;
00154 fileHandle_t f;
00155 char teamIcon[128];
00156
00157 if (cgs.gametype != GT_SIEGE)
00158 {
00159 goto failure;
00160 }
00161
00162 Com_sprintf(levelname, sizeof(levelname), "%s\0", cgs.mapname);
00163
00164 i = strlen(levelname)-1;
00165
00166 while (i > 0 && levelname[i] && levelname[i] != '.')
00167 {
00168 i--;
00169 }
00170
00171 if (!i)
00172 {
00173 goto failure;
00174 }
00175
00176 levelname[i] = '\0'; //kill the ".bsp"
00177
00178 Com_sprintf(levelname, sizeof(levelname), "%s.siege\0", levelname);
00179
00180 if (!levelname || !levelname[0])
00181 {
00182 goto failure;
00183 }
00184
00185 len = trap_FS_FOpenFile(levelname, &f, FS_READ);
00186
00187 if (!f || len >= MAX_SIEGE_INFO_SIZE)
00188 {
00189 goto failure;
00190 }
00191
00192 trap_FS_Read(siege_info, len, f);
00193
00194 trap_FS_FCloseFile(f);
00195
00196 siege_valid = 1;
00197
00198 if (BG_SiegeGetValueGroup(siege_info, "Teams", teams))
00199 {
00200 char buf[1024];
00201
00202 trap_Cvar_VariableStringBuffer("cg_siegeTeam1", buf, 1024);
00203 if (buf[0] && Q_stricmp(buf, "none"))
00204 {
00205 strcpy(team1, buf);
00206 }
00207 else
00208 {
00209 BG_SiegeGetPairedValue(teams, "team1", team1);
00210 }
00211
00212 if (team1[0] == '@')
00213 { //it's a damn stringed reference.
00214 char b[256];
00215 trap_SP_GetStringTextString(team1+1, b, 256);
00216 trap_Cvar_Set("cg_siegeTeam1Name", b);
00217 }
00218 else
00219 {
00220 trap_Cvar_Set("cg_siegeTeam1Name", team1);
00221 }
00222
00223 trap_Cvar_VariableStringBuffer("cg_siegeTeam2", buf, 1024);
00224 if (buf[0] && Q_stricmp(buf, "none"))
00225 {
00226 strcpy(team2, buf);
00227 }
00228 else
00229 {
00230 BG_SiegeGetPairedValue(teams, "team2", team2);
00231 }
00232
00233 if (team2[0] == '@')
00234 { //it's a damn stringed reference.
00235 char b[256];
00236 trap_SP_GetStringTextString(team2+1, b, 256);
00237 trap_Cvar_Set("cg_siegeTeam2Name", b);
00238 }
00239 else
00240 {
00241 trap_Cvar_Set("cg_siegeTeam2Name", team2);
00242 }
00243 }
00244 else
00245 {
00246 CG_Error("Siege teams not defined");
00247 }
00248
00249 if (BG_SiegeGetValueGroup(siege_info, team1, teamInfo))
00250 {
00251 if (BG_SiegeGetPairedValue(teamInfo, "TeamIcon", teamIcon))
00252 {
00253 trap_Cvar_Set( "team1_icon", teamIcon);
00254 }
00255
00256 if (BG_SiegeGetPairedValue(teamInfo, "Timed", btime))
00257 {
00258 team1Timed = atoi(btime)*1000;
00259 CG_SetSiegeTimerCvar ( team1Timed );
00260 }
00261 else
00262 {
00263 team1Timed = 0;
00264 }
00265 }
00266 else
00267 {
00268 CG_Error("No team entry for '%s'\n", team1);
00269 }
00270
00271 if (BG_SiegeGetPairedValue(siege_info, "mapgraphic", teamInfo))
00272 {
00273 trap_Cvar_Set("siege_mapgraphic", teamInfo);
00274 }
00275 else
00276 {
00277 trap_Cvar_Set("siege_mapgraphic", "gfx/mplevels/siege1_hoth");
00278 }
00279
00280 if (BG_SiegeGetPairedValue(siege_info, "missionname", teamInfo))
00281 {
00282 trap_Cvar_Set("siege_missionname", teamInfo);
00283 }
00284 else
00285 {
00286 trap_Cvar_Set("siege_missionname", " ");
00287 }
00288
00289 if (BG_SiegeGetValueGroup(siege_info, team2, teamInfo))
00290 {
00291 if (BG_SiegeGetPairedValue(teamInfo, "TeamIcon", teamIcon))
00292 {
00293 trap_Cvar_Set( "team2_icon", teamIcon);
00294 }
00295
00296 if (BG_SiegeGetPairedValue(teamInfo, "Timed", btime))
00297 {
00298 team2Timed = atoi(btime)*1000;
00299 CG_SetSiegeTimerCvar ( team2Timed );
00300 }
00301 else
00302 {
00303 team2Timed = 0;
00304 }
00305 }
00306 else
00307 {
00308 CG_Error("No team entry for '%s'\n", team2);
00309 }
00310
00311 //Load the player class types
00312 BG_SiegeLoadClasses(NULL);
00313
00314 if (!bgNumSiegeClasses)
00315 { //We didn't find any?!
00316 CG_Error("Couldn't find any player classes for Siege");
00317 }
00318
00319 //Now load the teams since we have class data.
00320 BG_SiegeLoadTeams();
00321
00322 if (!bgNumSiegeTeams)
00323 { //React same as with classes.
00324 CG_Error("Couldn't find any player teams for Siege");
00325 }
00326
00327 //Get and set the team themes for each team. This will control which classes can be
00328 //used on each team.
00329 if (BG_SiegeGetValueGroup(siege_info, team1, teamInfo))
00330 {
00331 if (BG_SiegeGetPairedValue(teamInfo, "UseTeam", btime))
00332 {
00333 BG_SiegeSetTeamTheme(SIEGETEAM_TEAM1, btime);
00334 }
00335 if (BG_SiegeGetPairedValue(teamInfo, "FriendlyShader", btime))
00336 {
00337 cgSiegeTeam1PlShader = trap_R_RegisterShaderNoMip(btime);
00338 }
00339 else
00340 {
00341 cgSiegeTeam1PlShader = 0;
00342 }
00343 }
00344 if (BG_SiegeGetValueGroup(siege_info, team2, teamInfo))
00345 {
00346 if (BG_SiegeGetPairedValue(teamInfo, "UseTeam", btime))
00347 {
00348 BG_SiegeSetTeamTheme(SIEGETEAM_TEAM2, btime);
00349 }
00350 if (BG_SiegeGetPairedValue(teamInfo, "FriendlyShader", btime))
00351 {
00352 cgSiegeTeam2PlShader = trap_R_RegisterShaderNoMip(btime);
00353 }
00354 else
00355 {
00356 cgSiegeTeam2PlShader = 0;
00357 }
00358 }
00359
00360 //Now go through the classes used by the loaded teams and try to precache
00361 //any forced models or forced skins.
00362 i = SIEGETEAM_TEAM1;
00363
00364 while (i <= SIEGETEAM_TEAM2)
00365 {
00366 j = 0;
00367 sTeam = BG_SiegeFindThemeForTeam(i);
00368
00369 if (!sTeam)
00370 {
00371 i++;
00372 continue;
00373 }
00374
00375 //Get custom team shaders while we're at it.
00376 if (i == SIEGETEAM_TEAM1)
00377 {
00378 cgSiegeTeam1PlShader = sTeam->friendlyShader;
00379 }
00380 else if (i == SIEGETEAM_TEAM2)
00381 {
00382 cgSiegeTeam2PlShader = sTeam->friendlyShader;
00383 }
00384
00385 while (j < sTeam->numClasses)
00386 {
00387 cl = sTeam->classes[j];
00388
00389 if (cl->forcedModel[0])
00390 { //This class has a forced model, so precache it.
00391 trap_R_RegisterModel(va("models/players/%s/model.glm", cl->forcedModel));
00392
00393 if (cl->forcedSkin[0])
00394 { //also has a forced skin, precache it.
00395 char *useSkinName;
00396
00397 if (strchr(cl->forcedSkin, '|'))
00398 {//three part skin
00399 useSkinName = va("models/players/%s/|%s", cl->forcedModel, cl->forcedSkin);
00400 }
00401 else
00402 {
00403 useSkinName = va("models/players/%s/model_%s.skin", cl->forcedModel, cl->forcedSkin);
00404 }
00405
00406 trap_R_RegisterSkin(useSkinName);
00407 }
00408 }
00409
00410 j++;
00411 }
00412 i++;
00413 }
00414
00415 //precache saber data for classes that use sabers on both teams
00416 BG_PrecacheSabersForSiegeTeam(SIEGETEAM_TEAM1);
00417 BG_PrecacheSabersForSiegeTeam(SIEGETEAM_TEAM2);
00418
00419 CG_PrecachePlayersForSiegeTeam(SIEGETEAM_TEAM1);
00420 CG_PrecachePlayersForSiegeTeam(SIEGETEAM_TEAM2);
00421
00422 CG_PrecachePlayersForSiegeTeam(SIEGETEAM_TEAM1);
00423 CG_PrecachePlayersForSiegeTeam(SIEGETEAM_TEAM2);
00424
00425 CG_PrecacheSiegeObjectiveAssetsForTeam(SIEGETEAM_TEAM1);
00426 CG_PrecacheSiegeObjectiveAssetsForTeam(SIEGETEAM_TEAM2);
00427
00428 return;
00429 failure:
00430 siege_valid = 0;
00431 }
|
|
||||||||||||
|
Definition at line 799 of file cg_players.c. References bg_customSiegeSoundNames, cg_buildScript, cg_customDuelSoundNames, cg_customSoundNames, cgs, Com_sprintf(), COM_StripExtension(), DEFAULT_FEMALE_SOUNDPATH, DEFAULT_MALE_SOUNDPATH, clientInfo_t::duelSounds, fileHandle_t, FS_READ, cgs_t::gametype, clientInfo_t::gender, GENDER_FEMALE, GENDER_MALE, GT_DUEL, GT_POWERDUEL, GT_TEAM, vmCvar_t::integer, MAX_CUSTOM_DUEL_SOUNDS, MAX_CUSTOM_SIEGE_SOUNDS, MAX_CUSTOM_SOUNDS, MAX_QPATH, clientInfo_t::modelName, Q_stricmp(), qboolean, qfalse, qtrue, clientInfo_t::siegeSounds, clientInfo_t::skinName, clientInfo_t::sounds, trap_FS_FCloseFile(), trap_FS_FOpenFile(), trap_FS_Read(), trap_S_RegisterSound(), trap_S_ShutUp(), and va(). Referenced by CG_LoadClientInfo(), and CG_PrecachePlayersForSiegeTeam().
00800 {
00801 fileHandle_t f;
00802 qboolean isFemale = qfalse;
00803 int i = 0;
00804 int fLen = 0;
00805 const char *dir;
00806 char soundpath[MAX_QPATH];
00807 char soundName[1024];
00808 const char *s;
00809
00810 dir = ci->modelName;
00811
00812 if ( !ci->skinName || !Q_stricmp( "default", ci->skinName ) )
00813 {//try default sounds.cfg first
00814 fLen = trap_FS_FOpenFile(va("models/players/%s/sounds.cfg", dir), &f, FS_READ);
00815 if ( !f )
00816 {//no? Look for _default sounds.cfg
00817 fLen = trap_FS_FOpenFile(va("models/players/%s/sounds_default.cfg", dir), &f, FS_READ);
00818 }
00819 }
00820 else
00821 {//use the .skin associated with this skin
00822 fLen = trap_FS_FOpenFile(va("models/players/%s/sounds_%s.cfg", dir, ci->skinName), &f, FS_READ);
00823 if ( !f )
00824 {//fall back to default sounds
00825 fLen = trap_FS_FOpenFile(va("models/players/%s/sounds.cfg", dir), &f, FS_READ);
00826 }
00827 }
00828
00829 soundpath[0] = 0;
00830
00831 if (f)
00832 {
00833 trap_FS_Read(soundpath, fLen, f);
00834 soundpath[fLen] = 0;
00835
00836 i = fLen;
00837
00838 while (i >= 0 && soundpath[i] != '\n')
00839 {
00840 if (soundpath[i] == 'f')
00841 {
00842 isFemale = qtrue;
00843 soundpath[i] = 0;
00844 }
00845
00846 i--;
00847 }
00848
00849 i = 0;
00850
00851 while (soundpath[i] && soundpath[i] != '\r' && soundpath[i] != '\n')
00852 {
00853 i++;
00854 }
00855 soundpath[i] = 0;
00856
00857 trap_FS_FCloseFile(f);
00858 }
00859
00860 if (isFemale)
00861 {
00862 ci->gender = GENDER_FEMALE;
00863 }
00864 else
00865 {
00866 ci->gender = GENDER_MALE;
00867 }
00868
00869 trap_S_ShutUp(qtrue);
00870
00871 for ( i = 0 ; i < MAX_CUSTOM_SOUNDS ; i++ )
00872 {
00873 s = cg_customSoundNames[i];
00874 if ( !s ) {
00875 break;
00876 }
00877
00878 Com_sprintf(soundName, sizeof(soundName), "%s", s+1);
00879 COM_StripExtension(soundName, soundName);
00880 //strip the extension because we might want .mp3's
00881
00882 ci->sounds[i] = 0;
00883 // if the model didn't load use the sounds of the default model
00884 if (soundpath[0])
00885 {
00886 ci->sounds[i] = trap_S_RegisterSound( va("sound/chars/%s/misc/%s", soundpath, soundName) );
00887 }
00888 else
00889 {
00890 if (modelloaded)
00891 {
00892 ci->sounds[i] = trap_S_RegisterSound( va("sound/chars/%s/misc/%s", dir, soundName) );
00893 }
00894 }
00895
00896 if (!ci->sounds[i])
00897 { //failed the load, try one out of the generic path
00898 if (isFemale)
00899 {
00900 ci->sounds[i] = trap_S_RegisterSound( va("sound/%s/%s", DEFAULT_FEMALE_SOUNDPATH, soundName) );
00901 }
00902 else
00903 {
00904 ci->sounds[i] = trap_S_RegisterSound( va("sound/%s/%s", DEFAULT_MALE_SOUNDPATH, soundName) );
00905 }
00906 }
00907 }
00908
00909 if (cgs.gametype >= GT_TEAM || cg_buildScript.integer)
00910 { //load the siege sounds then
00911 for ( i = 0 ; i < MAX_CUSTOM_SIEGE_SOUNDS; i++ )
00912 {
00913 s = bg_customSiegeSoundNames[i];
00914 if ( !s )
00915 {
00916 break;
00917 }
00918
00919 Com_sprintf(soundName, sizeof(soundName), "%s", s+1);
00920 COM_StripExtension(soundName, soundName);
00921 //strip the extension because we might want .mp3's
00922
00923 ci->siegeSounds[i] = 0;
00924 // if the model didn't load use the sounds of the default model
00925 if (soundpath[0])
00926 {
00927 ci->siegeSounds[i] = trap_S_RegisterSound( va("sound/%s/%s", soundpath, soundName) );
00928 }
00929 else
00930 {
00931 if (modelloaded)
00932 {
00933 ci->siegeSounds[i] = trap_S_RegisterSound( va("sound/chars/%s/misc/%s", dir, soundName) );
00934 }
00935 }
00936
00937 if (!ci->siegeSounds[i])
00938 { //failed the load, try one out of the generic path
00939 if (isFemale)
00940 {
00941 ci->siegeSounds[i] = trap_S_RegisterSound( va("sound/%s/%s", DEFAULT_FEMALE_SOUNDPATH, soundName) );
00942 }
00943 else
00944 {
00945 ci->siegeSounds[i] = trap_S_RegisterSound( va("sound/%s/%s", DEFAULT_MALE_SOUNDPATH, soundName) );
00946 }
00947 }
00948 }
00949 }
00950
00951 if (cgs.gametype == GT_DUEL
00952 ||cgs.gametype == GT_POWERDUEL
00953 || cg_buildScript.integer)
00954 { //load the Duel sounds then
00955 for ( i = 0 ; i < MAX_CUSTOM_DUEL_SOUNDS; i++ )
00956 {
00957 s = cg_customDuelSoundNames[i];
00958 if ( !s )
00959 {
00960 break;
00961 }
00962
00963 Com_sprintf(soundName, sizeof(soundName), "%s", s+1);
00964 COM_StripExtension(soundName, soundName);
00965 //strip the extension because we might want .mp3's
00966
00967 ci->duelSounds[i] = 0;
00968 // if the model didn't load use the sounds of the default model
00969 if (soundpath[0])
00970 {
00971 ci->duelSounds[i] = trap_S_RegisterSound( va("sound/chars/%s/misc/%s", soundpath, soundName) );
00972 }
00973 else
00974 {
00975 if (modelloaded)
00976 {
00977 ci->duelSounds[i] = trap_S_RegisterSound( va("sound/chars/%s/misc/%s", dir, soundName) );
00978 }
00979 }
00980
00981 if (!ci->duelSounds[i])
00982 { //failed the load, try one out of the generic path
00983 if (isFemale)
00984 {
00985 ci->duelSounds[i] = trap_S_RegisterSound( va("sound/%s/%s", DEFAULT_FEMALE_SOUNDPATH, soundName) );
00986 }
00987 else
00988 {
00989 ci->duelSounds[i] = trap_S_RegisterSound( va("sound/%s/%s", DEFAULT_MALE_SOUNDPATH, soundName) );
00990 }
00991 }
00992 }
00993 }
00994
00995 trap_S_ShutUp(qfalse);
00996 }
|
|
|
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 }
|
|
|
Definition at line 987 of file cg_saga.c. References siegeExtended_s::ammo, ammoData, atoi(), centity_t, cg, cg_entities, cg_siegeExtendedData, centity_s::currentState, EF_DOUBLE_AMMO, entityState_s::eFlags, siegeExtended_s::health, siegeExtended_s::lastUpdated, MAX_CLIENTS, MAX_STRING_CHARS, siegeExtended_s::maxhealth, cg_t::time, siegeExtended_s::weapon, entityState_s::weapon, and weaponData. Referenced by CG_ParseSiegeExtendedData().
00988 {
00989 char s[MAX_STRING_CHARS];
00990 char *str = (char *)conStr;
00991 int argParses = 0;
00992 int i;
00993 int maxAmmo = 0, clNum = -1, health = 1, maxhealth = 1, ammo = 1;
00994 centity_t *cent;
00995
00996 if (!conStr || !conStr[0])
00997 {
00998 return;
00999 }
01000
01001 while (*str && argParses < 4)
01002 {
01003 i = 0;
01004 while (*str && *str != '|')
01005 {
01006 s[i] = *str;
01007 i++;
01008 *str++;
01009 }
01010 s[i] = 0;
01011 switch (argParses)
01012 {
01013 case 0:
01014 clNum = atoi(s);
01015 break;
01016 case 1:
01017 health = atoi(s);
01018 break;
01019 case 2:
01020 maxhealth = atoi(s);
01021 break;
01022 case 3:
01023 ammo = atoi(s);
01024 break;
01025 default:
01026 break;
01027 }
01028 argParses++;
01029 str++;
01030 }
01031
01032 if (clNum < 0 || clNum >= MAX_CLIENTS)
01033 {
01034 return;
01035 }
01036
01037 cg_siegeExtendedData[clNum].health = health;
01038 cg_siegeExtendedData[clNum].maxhealth = maxhealth;
01039 cg_siegeExtendedData[clNum].ammo = ammo;
01040
01041 cent = &cg_entities[clNum];
01042
01043 maxAmmo = ammoData[weaponData[cent->currentState.weapon].ammoIndex].max;
01044 if ( (cent->currentState.eFlags & EF_DOUBLE_AMMO) )
01045 {
01046 maxAmmo *= 2.0f;
01047 }
01048 if (ammo >= 0 && ammo <= maxAmmo )
01049 { //assure the weapon number is valid and not over max
01050 //keep the weapon so if it changes before our next ext data update we'll know
01051 //that the ammo is not applicable.
01052 cg_siegeExtendedData[clNum].weapon = cent->currentState.weapon;
01053 }
01054 else
01055 { //not valid? Oh well, just invalidate the weapon too then so we don't display ammo
01056 cg_siegeExtendedData[clNum].weapon = -1;
01057 }
01058
01059 cg_siegeExtendedData[clNum].lastUpdated = cg.time;
01060 }
|
|
|
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 }
|
|
|
Definition at line 101 of file cg_saga.c. References BG_SiegeFindThemeForTeam(), CG_LoadCISounds(), siegeTeam_t::classes, siegeClass_t::forcedModel, siegeClass_t::forcedSkin, memset(), clientInfo_t::modelName, siegeTeam_t::numClasses, qtrue, clientInfo_t::skinName, strcpy(), trap_R_RegisterModel(), trap_R_RegisterSkin(), and va(). Referenced by CG_InitSiegeMode().
00102 {
00103 siegeTeam_t *stm;
00104 int i = 0;
00105
00106 stm = BG_SiegeFindThemeForTeam(team);
00107
00108 if (!stm)
00109 { //invalid team/no theme for team?
00110 return;
00111 }
00112
00113 while (i < stm->numClasses)
00114 {
00115 siegeClass_t *scl = stm->classes[i];
00116
00117 if (scl->forcedModel[0])
00118 {
00119 clientInfo_t fake;
00120
00121 memset(&fake, 0, sizeof(fake));
00122 strcpy(fake.modelName, scl->forcedModel);
00123
00124 trap_R_RegisterModel(va("models/players/%s/model.glm", scl->forcedModel));
00125 if (scl->forcedSkin[0])
00126 {
00127 trap_R_RegisterSkin(va("models/players/%s/model_%s.skin", scl->forcedModel, scl->forcedSkin));
00128 strcpy(fake.skinName, scl->forcedSkin);
00129 }
00130 else
00131 {
00132 strcpy(fake.skinName, "default");
00133 }
00134
00135 //precache the sounds for the model...
00136 CG_LoadCISounds(&fake, qtrue);
00137 }
00138
00139 i++;
00140 }
00141 }
|
|
|
Definition at line 35 of file cg_saga.c. References BG_SiegeGetPairedValue(), BG_SiegeGetValueGroup(), CG_Error(), Com_sprintf(), MAX_QPATH, MAX_SIEGE_INFO_SIZE, siege_info, siege_valid, SIEGETEAM_TEAM1, trap_R_RegisterShaderNoMip(), and trap_S_RegisterSound(). Referenced by CG_InitSiegeMode().
00036 {
00037 char teamstr[64];
00038 char objstr[256];
00039 char foundobjective[MAX_SIEGE_INFO_SIZE];
00040
00041 if (!siege_valid)
00042 {
00043 CG_Error("Siege data does not exist on client!\n");
00044 return;
00045 }
00046
00047 if (myTeam == SIEGETEAM_TEAM1)
00048 {
00049 Com_sprintf(teamstr, sizeof(teamstr), team1);
00050 }
00051 else
00052 {
00053 Com_sprintf(teamstr, sizeof(teamstr), team2);
00054 }
00055
00056 if (BG_SiegeGetValueGroup(siege_info, teamstr, cgParseObjectives))
00057 {
00058 int i = 1;
00059 while (i < 32)
00060 { //eh, just try 32 I guess
00061 Com_sprintf(objstr, sizeof(objstr), "Objective%i", i);
00062
00063 if (BG_SiegeGetValueGroup(cgParseObjectives, objstr, foundobjective))
00064 {
00065 char str[MAX_QPATH];
00066
00067 if (BG_SiegeGetPairedValue(foundobjective, "sound_team1", str))
00068 {
00069 trap_S_RegisterSound(str);
00070 }
00071 if (BG_SiegeGetPairedValue(foundobjective, "sound_team2", str))
00072 {
00073 trap_S_RegisterSound(str);
00074 }
00075 if (BG_SiegeGetPairedValue(foundobjective, "objgfx", str))
00076 {
00077 trap_R_RegisterShaderNoMip(str);
00078 }
00079 if (BG_SiegeGetPairedValue(foundobjective, "mapicon", str))
00080 {
00081 trap_R_RegisterShaderNoMip(str);
00082 }
00083 if (BG_SiegeGetPairedValue(foundobjective, "litmapicon", str))
00084 {
00085 trap_R_RegisterShaderNoMip(str);
00086 }
00087 if (BG_SiegeGetPairedValue(foundobjective, "donemapicon", str))
00088 {
00089 trap_R_RegisterShaderNoMip(str);
00090 }
00091 }
00092 else
00093 { //no more
00094 break;
00095 }
00096 i++;
00097 }
00098 }
00099 }
|
|
|
Definition at line 1081 of file cg_saga.c. References trap_Cvar_Set(), and va(). Referenced by CG_InitSiegeMode().
01082 {
01083 int seconds;
01084 int mins;
01085 int tens;
01086
01087 seconds = msec / 1000;
01088 mins = seconds / 60;
01089 seconds -= mins * 60;
01090 tens = seconds / 10;
01091 seconds -= tens * 10;
01092
01093 trap_Cvar_Set("ui_siegeTimer", va( "%i:%i%i", mins, tens, seconds ) );
01094 }
|
|
||||||||||||
|
|
|
||||||||||||||||
|
Definition at line 667 of file cg_saga.c. References BG_SiegeGetPairedValue(), BG_SiegeGetValueGroup(), Com_sprintf(), siege_info, SIEGETEAM_TEAM1, and va(). Referenced by CG_SiegeBriefingDisplay().
00668 {
00669 char teamstr[1024];
00670 char objectiveStr[8192];
00671
00672 buffer[0] = 0; //set to 0 ahead of time in case we fail to find the objective group/name
00673
00674 if (team == SIEGETEAM_TEAM1)
00675 {
00676 Com_sprintf(teamstr, sizeof(teamstr), team1);
00677 }
00678 else
00679 {
00680 Com_sprintf(teamstr, sizeof(teamstr), team2);
00681 }
00682
00683 if (BG_SiegeGetValueGroup(siege_info, teamstr, cgParseObjectives))
00684 { //found the team group
00685 if (BG_SiegeGetValueGroup(cgParseObjectives, va("Objective%i", objective), objectiveStr))
00686 { //found the objective group
00687 //Parse the name right into the buffer.
00688 BG_SiegeGetPairedValue(objectiveStr, "goalname", buffer);
00689 }
00690 }
00691 }
|
|
||||||||||||
|
Definition at line 693 of file cg_saga.c. References atoi(), BG_SiegeGetPairedValue(), BG_SiegeGetValueGroup(), Com_sprintf(), siege_info, SIEGETEAM_TEAM1, and va(). Referenced by CG_SiegeBriefingDisplay().
00694 {
00695 char finalStr[64];
00696 char teamstr[1024];
00697 char objectiveStr[8192];
00698
00699 if (team == SIEGETEAM_TEAM1)
00700 {
00701 Com_sprintf(teamstr, sizeof(teamstr), team1);
00702 }
00703 else
00704 {
00705 Com_sprintf(teamstr, sizeof(teamstr), team2);
00706 }
00707
00708 if (BG_SiegeGetValueGroup(siege_info, teamstr, cgParseObjectives))
00709 { //found the team group
00710 if (BG_SiegeGetValueGroup(cgParseObjectives, va("Objective%i", objective), objectiveStr))
00711 { //found the objective group
00712 //Parse the name right into the buffer.
00713 BG_SiegeGetPairedValue(objectiveStr, "final", finalStr);
00714 return (atoi( finalStr ));
00715 }
00716 }
00717 return 0;
00718 }
|
|
||||||||||||||||
|
Definition at line 878 of file cg_saga.c. References BG_SiegeGetPairedValue(), BG_SiegeGetValueGroup(), centity_t, cg, CG_DrawSiegeMessageNonMenu(), CG_Error(), CHAN_ANNOUNCER, Com_sprintf(), MAX_SIEGE_INFO_SIZE, NULL, PERS_TEAM, playerState_s::persistant, playerState_t, cg_t::predictedPlayerState, snapshot_t::ps, siege_info, siege_valid, SIEGETEAM_TEAM1, cg_t::snap, TEAM_SPECTATOR, trap_S_RegisterSound(), and trap_S_StartLocalSound(). Referenced by CG_EntityEvent().
00879 {
00880 int myTeam;
00881 char teamstr[64];
00882 char objstr[256];
00883 char foundobjective[MAX_SIEGE_INFO_SIZE];
00884 char appstring[1024];
00885 char soundstr[1024];
00886 int success = 0;
00887 playerState_t *ps = NULL;
00888
00889 if (!siege_valid)
00890 {
00891 CG_Error("Siege data does not exist on client!\n");
00892 return;
00893 }
00894
00895 if (cg.snap)
00896 { //this should always be true, if it isn't though use the predicted ps as a fallback
00897 ps = &cg.snap->ps;
00898 }
00899 else
00900 {
00901 ps = &cg.predictedPlayerState;
00902 }
00903
00904 if (!ps)
00905 {
00906 assert(0);
00907 return;
00908 }
00909
00910 myTeam = ps->persistant[PERS_TEAM];
00911
00912 if (myTeam == TEAM_SPECTATOR)
00913 {
00914 return;
00915 }
00916
00917 if (won == SIEGETEAM_TEAM1)
00918 {
00919 Com_sprintf(teamstr, sizeof(teamstr), team1);
00920 }
00921 else
00922 {
00923 Com_sprintf(teamstr, sizeof(teamstr), team2);
00924 }
00925
00926 if (BG_SiegeGetValueGroup(siege_info, teamstr, cgParseObjectives))
00927 {
00928 Com_sprintf(objstr, sizeof(objstr), "Objective%i", objectivenum);
00929
00930 if (BG_SiegeGetValueGroup(cgParseObjectives, objstr, foundobjective))
00931 {
00932 if (myTeam == SIEGETEAM_TEAM1)
00933 {
00934 success = BG_SiegeGetPairedValue(foundobjective, "message_team1", appstring);
00935 }
00936 else
00937 {
00938 success = BG_SiegeGetPairedValue(foundobjective, "message_team2", appstring);
00939 }
00940
00941 if (success)
00942 {
00943 CG_DrawSiegeMessageNonMenu(appstring);
00944 }
00945
00946 appstring[0] = 0;
00947 soundstr[0] = 0;
00948
00949 if (myTeam == SIEGETEAM_TEAM1)
00950 {
00951 Com_sprintf(teamstr, sizeof(teamstr), "sound_team1");
00952 }
00953 else
00954 {
00955 Com_sprintf(teamstr, sizeof(teamstr), "sound_team2");
00956 }
00957
00958 if (BG_SiegeGetPairedValue(foundobjective, teamstr, appstring))
00959 {
00960 Com_sprintf(soundstr, sizeof(soundstr), appstring);
00961 }
00962 /*
00963 else
00964 {
00965 if (myTeam != won)
00966 {
00967 Com_sprintf(soundstr, sizeof(soundstr), DEFAULT_LOSE_OBJECTIVE);
00968 }
00969 else
00970 {
00971 Com_sprintf(soundstr, sizeof(soundstr), DEFAULT_WIN_OBJECTIVE);
00972 }
00973 }
00974 */
00975
00976 if (soundstr[0])
00977 {
00978 trap_S_StartLocalSound(trap_S_RegisterSound(soundstr), CHAN_ANNOUNCER);
00979 }
00980 }
00981 }
00982 }
|
|
||||||||||||
|
Definition at line 568 of file cg_saga.c. References BG_SiegeGetPairedValue(), BG_SiegeGetValueGroup(), centity_t, cg, CG_DrawSiegeMessage(), CG_Error(), CHAN_ANNOUNCER, Com_sprintf(), NULL, PERS_TEAM, playerState_s::persistant, playerState_t, cg_t::predictedPlayerState, snapshot_t::ps, siege_info, siege_valid, SIEGETEAM_TEAM1, cg_t::snap, TEAM_SPECTATOR, trap_S_RegisterSound(), and trap_S_StartLocalSound(). Referenced by CG_EntityEvent().
00569 {
00570 int myTeam;
00571 char teamstr[64];
00572 char appstring[1024];
00573 char soundstr[1024];
00574 int success = 0;
00575 playerState_t *ps = NULL;
00576
00577 if (!siege_valid)
00578 {
00579 CG_Error("ERROR: Siege data does not exist on client!\n");
00580 return;
00581 }
00582
00583 if (cg.snap)
00584 { //this should always be true, if it isn't though use the predicted ps as a fallback
00585 ps = &cg.snap->ps;
00586 }
00587 else
00588 {
00589 ps = &cg.predictedPlayerState;
00590 }
00591
00592 if (!ps)
00593 {
00594 assert(0);
00595 return;
00596 }
00597
00598 myTeam = ps->persistant[PERS_TEAM];
00599
00600 if (myTeam == TEAM_SPECTATOR)
00601 {
00602 return;
00603 }
00604
00605 if (myTeam == SIEGETEAM_TEAM1)
00606 {
00607 Com_sprintf(teamstr, sizeof(teamstr), team1);
00608 }
00609 else
00610 {
00611 Com_sprintf(teamstr, sizeof(teamstr), team2);
00612 }
00613
00614 if (BG_SiegeGetValueGroup(siege_info, teamstr, cgParseObjectives))
00615 {
00616 if (won == myTeam)
00617 {
00618 success = BG_SiegeGetPairedValue(cgParseObjectives, "wonround", appstring);
00619 }
00620 else
00621 {
00622 success = BG_SiegeGetPairedValue(cgParseObjectives, "lostround", appstring);
00623 }
00624
00625 if (success)
00626 {
00627 CG_DrawSiegeMessage(appstring, 0);
00628 }
00629
00630 appstring[0] = 0;
00631 soundstr[0] = 0;
00632
00633 if (myTeam == won)
00634 {
00635 Com_sprintf(teamstr, sizeof(teamstr), "roundover_sound_wewon");
00636 }
00637 else
00638 {
00639 Com_sprintf(teamstr, sizeof(teamstr), "roundover_sound_welost");
00640 }
00641
00642 if (BG_SiegeGetPairedValue(cgParseObjectives, teamstr, appstring))
00643 {
00644 Com_sprintf(soundstr, sizeof(soundstr), appstring);
00645 }
00646 /*
00647 else
00648 {
00649 if (myTeam != won)
00650 {
00651 Com_sprintf(soundstr, sizeof(soundstr), DEFAULT_LOSE_ROUND);
00652 }
00653 else
00654 {
00655 Com_sprintf(soundstr, sizeof(soundstr), DEFAULT_WIN_ROUND);
00656 }
00657 }
00658 */
00659
00660 if (soundstr[0])
00661 {
00662 trap_S_StartLocalSound(trap_S_RegisterSound(soundstr), CHAN_ANNOUNCER);
00663 }
00664 }
00665 }
|
|
|
Definition at line 984 of file cg_saga.c. Referenced by CG_DrawSiegeInfo(), and CG_ParseSiegeExtendedDataEntry(). |
|
|
|
|
|
|
|
|
Definition at line 24 of file cg_saga.c. Referenced by CG_InitSiegeMode(), and CG_Player(). |
|
|
Definition at line 25 of file cg_saga.c. Referenced by CG_InitSiegeMode(), and CG_Player(). |
|
|
Definition at line 21 of file cg_saga.c. Referenced by CG_InitSiegeMode(). |
|
|
Definition at line 22 of file cg_saga.c. Referenced by CG_InitSiegeMode(). |