#include "cg_local.h"#include "../ui/ui_shared.h"#include "cg_lights.h"#include "holocronicons.h"#include "../namespace_begin.h"#include "../namespace_end.h"Go to the source code of this file.
|
|
|
|
|
Definition at line 3309 of file cg_main.c. Referenced by CG_StrPool_Alloc(). |
|
|
Definition at line 140 of file cg_main.c. Referenced by CG_CreateModelFromSpawnEnt(), and CG_MiscEnt(). |
|
|
|
Definition at line 1276 of file cg_main.c. References cg, and cg_t::time. Referenced by AnimateRiders().
|
|
||||||||||||||||||||
|
Definition at line 358 of file bg_misc.c.
00359 {
00360 BG_field_t *f;
00361 byte *b;
00362 float v;
00363 vec3_t vec;
00364
00365 for ( f=l_fields ; f->name ; f++ ) {
00366 if ( !Q_stricmp(f->name, key) ) {
00367 // found it
00368 b = (byte *)ent;
00369
00370 switch( f->type ) {
00371 case F_LSTRING:
00372 #ifdef QAGAME
00373 *(char **)(b+f->ofs) = G_NewString (value);
00374 #else
00375 *(char **)(b+f->ofs) = CG_NewString (value);
00376 #endif
00377 break;
00378 case F_VECTOR:
00379 sscanf (value, "%f %f %f", &vec[0], &vec[1], &vec[2]);
00380 ((float *)(b+f->ofs))[0] = vec[0];
00381 ((float *)(b+f->ofs))[1] = vec[1];
00382 ((float *)(b+f->ofs))[2] = vec[2];
00383 break;
00384 case F_INT:
00385 *(int *)(b+f->ofs) = atoi(value);
00386 break;
00387 case F_FLOAT:
00388 *(float *)(b+f->ofs) = atof(value);
00389 break;
00390 case F_ANGLEHACK:
00391 v = atof(value);
00392 ((float *)(b+f->ofs))[0] = 0;
00393 ((float *)(b+f->ofs))[1] = v;
00394 ((float *)(b+f->ofs))[2] = 0;
00395 break;
00396 #ifdef QAGAME
00397 case F_PARM1:
00398 case F_PARM2:
00399 case F_PARM3:
00400 case F_PARM4:
00401 case F_PARM5:
00402 case F_PARM6:
00403 case F_PARM7:
00404 case F_PARM8:
00405 case F_PARM9:
00406 case F_PARM10:
00407 case F_PARM11:
00408 case F_PARM12:
00409 case F_PARM13:
00410 case F_PARM14:
00411 case F_PARM15:
00412 case F_PARM16:
00413 Q3_SetParm( ((gentity_t *)(ent))->s.number, (f->type - F_PARM1), (char *) value );
00414 break;
00415 #endif
00416 default:
00417 case F_IGNORE:
00418 break;
00419 }
00420 return;
00421 }
00422 }
00423 }
|
|
|
Definition at line 1487 of file bg_vehicleLoad.c. References BG_SetSharedVehicleFunctions(), BG_TempAlloc(), BG_TempFree(), BG_VehicleClampData(), BG_VehicleSetDefaults(), BG_VehWeaponLoadParms(), Com_Error(), Com_Printf(), ERR_DROP, fileHandle_t, FS_READ, g_vehicleInfo, MAX_VEHICLE_DATA_SIZE, NULL, numVehicles, qtrue, strcat(), strlen(), trap_FS_FCloseFile(), trap_FS_FOpenFile(), trap_FS_GetFileList(), trap_FS_Read(), va(), VEHICLE_BASE, and VehicleParms. Referenced by CG_Init(), G_InitGame(), and VEH_LoadVehicle().
01488 {//HMM... only do this if there's a vehicle on the level?
01489 int len, totallen, vehExtFNLen, mainBlockLen, fileCnt, i;
01490 // const char *filename = "ext_data/vehicles.dat";
01491 char *holdChar, *marker;
01492 char vehExtensionListBuf[2048]; // The list of file names read in
01493 fileHandle_t f;
01494 char *tempReadBuffer;
01495
01496 len = 0;
01497
01498 //remember where to store the next one
01499 totallen = mainBlockLen = len;
01500 marker = VehicleParms+totallen;
01501 *marker = 0;
01502
01503 //now load in the extra .veh extensions
01504 #ifdef _JK2MP
01505 fileCnt = trap_FS_GetFileList("ext_data/vehicles", ".veh", vehExtensionListBuf, sizeof(vehExtensionListBuf) );
01506 #else
01507 fileCnt = gi.FS_GetFileList("ext_data/vehicles", ".veh", vehExtensionListBuf, sizeof(vehExtensionListBuf) );
01508 #endif
01509
01510 holdChar = vehExtensionListBuf;
01511
01512 #ifdef _JK2MP
01513 tempReadBuffer = (char *)BG_TempAlloc(MAX_VEHICLE_DATA_SIZE);
01514 #else
01515 tempReadBuffer = (char *)gi.Malloc( MAX_VEHICLE_DATA_SIZE, TAG_G_ALLOC, qtrue );
01516 #endif
01517
01518 // NOTE: Not use TempAlloc anymore...
01519 //Make ABSOLUTELY CERTAIN that BG_Alloc/etc. is not used before
01520 //the subsequent BG_TempFree or the pool will be screwed.
01521
01522 for ( i = 0; i < fileCnt; i++, holdChar += vehExtFNLen + 1 )
01523 {
01524 vehExtFNLen = strlen( holdChar );
01525
01526 // Com_Printf( "Parsing %s\n", holdChar );
01527
01528 #ifdef _JK2MP
01529 len = trap_FS_FOpenFile(va( "ext_data/vehicles/%s", holdChar), &f, FS_READ);
01530 #else
01531 // len = gi.FS_ReadFile( va( "ext_data/vehicles/%s", holdChar), (void **) &buffer );
01532 len = gi.FS_FOpenFile(va( "ext_data/vehicles/%s", holdChar), &f, FS_READ);
01533 #endif
01534
01535 if ( len == -1 )
01536 {
01537 Com_Printf( "error reading file\n" );
01538 }
01539 else
01540 {
01541 #ifdef _JK2MP
01542 trap_FS_Read(tempReadBuffer, len, f);
01543 tempReadBuffer[len] = 0;
01544 #else
01545 gi.FS_Read(tempReadBuffer, len, f);
01546 tempReadBuffer[len] = 0;
01547 #endif
01548
01549 // Don't let it end on a } because that should be a stand-alone token.
01550 if ( totallen && *(marker-1) == '}' )
01551 {
01552 strcat( marker, " " );
01553 totallen++;
01554 marker++;
01555 }
01556
01557 if ( totallen + len >= MAX_VEHICLE_DATA_SIZE ) {
01558 Com_Error(ERR_DROP, "Vehicle extensions (*.veh) are too large" );
01559 }
01560 strcat( marker, tempReadBuffer );
01561 #ifdef _JK2MP
01562 trap_FS_FCloseFile( f );
01563 #else
01564 gi.FS_FCloseFile( f );
01565 #endif
01566
01567 totallen += len;
01568 marker = VehicleParms+totallen;
01569 }
01570 }
01571
01572 #ifdef _JK2MP
01573 BG_TempFree(MAX_VEHICLE_DATA_SIZE);
01574 #else
01575 gi.Free(tempReadBuffer); tempReadBuffer = NULL;
01576 #endif
01577
01578 numVehicles = 1;//first one is null/default
01579 //set the first vehicle to default data
01580 BG_VehicleSetDefaults( &g_vehicleInfo[VEHICLE_BASE] );
01581 //sanity check and clamp the vehicle's data
01582 BG_VehicleClampData( &g_vehicleInfo[VEHICLE_BASE] );
01583 // Setup the shared function pointers.
01584 BG_SetSharedVehicleFunctions( &g_vehicleInfo[VEHICLE_BASE] );
01585
01586 //Load the Vehicle Weapons data, too
01587 BG_VehWeaponLoadParms();
01588 }
|
|
|
Definition at line 3515 of file cg_main.c. References CG_Error(), MAX_SPAWN_VARS_CHARS, memcpy(), and strlen(). Referenced by CG_ParseSpawnVars().
03516 {
03517 int l;
03518 char *dest;
03519
03520 l = strlen( string );
03521 if ( cg_numSpawnVarChars + l + 1 > MAX_SPAWN_VARS_CHARS ) {
03522 CG_Error( "CG_AddSpawnVarToken: MAX_SPAWN_VARS" );
03523 }
03524
03525 dest = cg_spawnVarChars + cg_numSpawnVarChars;
03526 memcpy( dest, string, l+1 );
03527
03528 cg_numSpawnVarChars += l + 1;
03529
03530 return dest;
03531 }
|
|
|
Definition at line 1263 of file cg_main.c. References MAX_STRING_CHARS, and trap_Argv(). Referenced by CG_ConsoleCommand(), CG_ParseSiegeExtendedData(), CG_TestModel_f(), CG_Weapon_f(), and CG_WeaponClean_f().
01263 {
01264 static char buffer[MAX_STRING_CHARS];
01265
01266 trap_Argv( arg, buffer, sizeof( buffer ) );
01267
01268 return buffer;
01269 }
|
|
|
Definition at line 2592 of file cg_main.c. References displayContextDef_t::Assets, cgDC, cachedAssets_t::cursor, cachedAssets_t::cursorStr, cachedAssets_t::fadeAmount, cachedAssets_t::fadeClamp, cachedAssets_t::fadeCycle, cachedAssets_t::gradientBar, cachedAssets_t::itemFocusSound, cachedAssets_t::menuBuzzSound, cachedAssets_t::menuEnterSound, cachedAssets_t::menuExitSound, PC_Color_Parse(), PC_Float_Parse(), PC_Int_Parse(), PC_String_Parse(), pc_token_t, Q_stricmp(), qboolean, qfalse, cachedAssets_t::qhBigFont, cachedAssets_t::qhMediumFont, cachedAssets_t::qhSmall2Font, cachedAssets_t::qhSmallFont, qtrue, displayContextDef_t::RegisterFont, cachedAssets_t::shadowColor, cachedAssets_t::shadowFadeClamp, cachedAssets_t::shadowX, cachedAssets_t::shadowY, pc_token_s::string, trap_PC_ReadToken(), trap_R_RegisterShaderNoMip(), and trap_S_RegisterSound(). Referenced by CG_ParseMenu().
02592 {
02593 pc_token_t token;
02594
02595 if (!trap_PC_ReadToken(handle, &token))
02596 return qfalse;
02597 if (Q_stricmp(token.string, "{") != 0) {
02598 return qfalse;
02599 }
02600
02601 while ( 1 ) {
02602 if (!trap_PC_ReadToken(handle, &token))
02603 return qfalse;
02604
02605 if (Q_stricmp(token.string, "}") == 0) {
02606 return qtrue;
02607 }
02608
02609 // font
02610 if (Q_stricmp(token.string, "font") == 0) {
02611 int pointSize;
02612 if (!trap_PC_ReadToken(handle, &token) || !PC_Int_Parse(handle, &pointSize)) {
02613 return qfalse;
02614 }
02615
02616 // cgDC.registerFont(token.string, pointSize, &cgDC.Assets.textFont);
02617 cgDC.Assets.qhMediumFont = cgDC.RegisterFont(token.string);
02618 continue;
02619 }
02620
02621 // smallFont
02622 if (Q_stricmp(token.string, "smallFont") == 0) {
02623 int pointSize;
02624 if (!trap_PC_ReadToken(handle, &token) || !PC_Int_Parse(handle, &pointSize)) {
02625 return qfalse;
02626 }
02627 // cgDC.registerFont(token.string, pointSize, &cgDC.Assets.smallFont);
02628 cgDC.Assets.qhSmallFont = cgDC.RegisterFont(token.string);
02629 continue;
02630 }
02631
02632 // smallFont
02633 if (Q_stricmp(token.string, "small2Font") == 0) {
02634 int pointSize;
02635 if (!trap_PC_ReadToken(handle, &token) || !PC_Int_Parse(handle, &pointSize)) {
02636 return qfalse;
02637 }
02638 // cgDC.registerFont(token.string, pointSize, &cgDC.Assets.smallFont);
02639 cgDC.Assets.qhSmall2Font = cgDC.RegisterFont(token.string);
02640 continue;
02641 }
02642
02643 // font
02644 if (Q_stricmp(token.string, "bigfont") == 0) {
02645 int pointSize;
02646 if (!trap_PC_ReadToken(handle, &token) || !PC_Int_Parse(handle, &pointSize)) {
02647 return qfalse;
02648 }
02649 // cgDC.registerFont(token.string, pointSize, &cgDC.Assets.bigFont);
02650 cgDC.Assets.qhBigFont = cgDC.RegisterFont(token.string);
02651 continue;
02652 }
02653
02654 // gradientbar
02655 if (Q_stricmp(token.string, "gradientbar") == 0) {
02656 if (!trap_PC_ReadToken(handle, &token)) {
02657 return qfalse;
02658 }
02659 cgDC.Assets.gradientBar = trap_R_RegisterShaderNoMip(token.string);
02660 continue;
02661 }
02662
02663 // enterMenuSound
02664 if (Q_stricmp(token.string, "menuEnterSound") == 0) {
02665 if (!trap_PC_ReadToken(handle, &token)) {
02666 return qfalse;
02667 }
02668 cgDC.Assets.menuEnterSound = trap_S_RegisterSound( token.string );
02669 continue;
02670 }
02671
02672 // exitMenuSound
02673 if (Q_stricmp(token.string, "menuExitSound") == 0) {
02674 if (!trap_PC_ReadToken(handle, &token)) {
02675 return qfalse;
02676 }
02677 cgDC.Assets.menuExitSound = trap_S_RegisterSound( token.string );
02678 continue;
02679 }
02680
02681 // itemFocusSound
02682 if (Q_stricmp(token.string, "itemFocusSound") == 0) {
02683 if (!trap_PC_ReadToken(handle, &token)) {
02684 return qfalse;
02685 }
02686 cgDC.Assets.itemFocusSound = trap_S_RegisterSound( token.string );
02687 continue;
02688 }
02689
02690 // menuBuzzSound
02691 if (Q_stricmp(token.string, "menuBuzzSound") == 0) {
02692 if (!trap_PC_ReadToken(handle, &token)) {
02693 return qfalse;
02694 }
02695 cgDC.Assets.menuBuzzSound = trap_S_RegisterSound( token.string );
02696 continue;
02697 }
02698
02699 if (Q_stricmp(token.string, "cursor") == 0) {
02700 if (!PC_String_Parse(handle, &cgDC.Assets.cursorStr)) {
02701 return qfalse;
02702 }
02703 cgDC.Assets.cursor = trap_R_RegisterShaderNoMip( cgDC.Assets.cursorStr);
02704 continue;
02705 }
02706
02707 if (Q_stricmp(token.string, "fadeClamp") == 0) {
02708 if (!PC_Float_Parse(handle, &cgDC.Assets.fadeClamp)) {
02709 return qfalse;
02710 }
02711 continue;
02712 }
02713
02714 if (Q_stricmp(token.string, "fadeCycle") == 0) {
02715 if (!PC_Int_Parse(handle, &cgDC.Assets.fadeCycle)) {
02716 return qfalse;
02717 }
02718 continue;
02719 }
02720
02721 if (Q_stricmp(token.string, "fadeAmount") == 0) {
02722 if (!PC_Float_Parse(handle, &cgDC.Assets.fadeAmount)) {
02723 return qfalse;
02724 }
02725 continue;
02726 }
02727
02728 if (Q_stricmp(token.string, "shadowX") == 0) {
02729 if (!PC_Float_Parse(handle, &cgDC.Assets.shadowX)) {
02730 return qfalse;
02731 }
02732 continue;
02733 }
02734
02735 if (Q_stricmp(token.string, "shadowY") == 0) {
02736 if (!PC_Float_Parse(handle, &cgDC.Assets.shadowY)) {
02737 return qfalse;
02738 }
02739 continue;
02740 }
02741
02742 if (Q_stricmp(token.string, "shadowColor") == 0) {
02743 if (!PC_Color_Parse(handle, &cgDC.Assets.shadowColor)) {
02744 return qfalse;
02745 }
02746 cgDC.Assets.shadowFadeClamp = cgDC.Assets.shadowColor[3];
02747 continue;
02748 }
02749 }
02750 return qfalse; // bk001204 - why not?
02751 }
|
|
|
|
Definition at line 2480 of file cg_main.c. References cg, CG_SiegeCountCvars(), cgs, cgs_t::clientinfo, clientInfo_t::infoValid, MAX_CLIENTS, clientInfo_t::name, Q_strcat(), cg_t::spectatorLen, cg_t::spectatorList, cg_t::spectatorWidth, strlen(), clientInfo_t::team, TEAM_SPECTATOR, and va().
02480 {
02481 int i;
02482 cg.spectatorList[0] = 0;
02483
02484 // Count up the number of players per team and per class
02485 CG_SiegeCountCvars();
02486
02487 for (i = 0; i < MAX_CLIENTS; i++) {
02488 if (cgs.clientinfo[i].infoValid && cgs.clientinfo[i].team == TEAM_SPECTATOR ) {
02489 Q_strcat(cg.spectatorList, sizeof(cg.spectatorList), va("%s ", cgs.clientinfo[i].name));
02490 }
02491 }
02492 i = strlen(cg.spectatorList);
02493 if (i != cg.spectatorLen) {
02494 cg.spectatorLen = i;
02495 cg.spectatorWidth = -1;
02496 }
02497 }
|
|
|
Definition at line 6876 of file cg_players.c.
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 }
|
|
|
Definition at line 3064 of file cg_ents.c.
03064 {
03065 qboolean goAway = qfalse;
03066
03067 // if this player does not want to see extrapolated players
03068 if ( !cg_smoothClients.integer ) {
03069 // make sure the clients use TR_INTERPOLATE
03070 if ( cent->currentState.number < MAX_CLIENTS ) {
03071 cent->currentState.pos.trType = TR_INTERPOLATE;
03072 cent->nextState.pos.trType = TR_INTERPOLATE;
03073 }
03074 }
03075
03076 if (cg.predictedPlayerState.m_iVehicleNum &&
03077 cg.predictedPlayerState.m_iVehicleNum == cent->currentState.number &&
03078 cent->currentState.eType == ET_NPC && cent->currentState.NPC_class == CLASS_VEHICLE)
03079 { //special case for vehicle we are riding
03080 centity_t *veh = &cg_entities[cg.predictedPlayerState.m_iVehicleNum];
03081
03082 if (veh->currentState.owner == cg.predictedPlayerState.clientNum)
03083 { //only do this if the vehicle is pilotted by this client and predicting properly
03084 BG_EvaluateTrajectory( ¢->currentState.pos, cg.time, cent->lerpOrigin );
03085 BG_EvaluateTrajectory( ¢->currentState.apos, cg.time, cent->lerpAngles );
03086 return;
03087 }
03088 }
03089
03090 if ( cent->interpolate && cent->currentState.pos.trType == TR_INTERPOLATE ) {
03091 CG_InterpolateEntityPosition( cent );
03092 return;
03093 }
03094
03095 // first see if we can interpolate between two snaps for
03096 // linear extrapolated clients
03097 if ( cent->interpolate && cent->currentState.pos.trType == TR_LINEAR_STOP &&
03098 cent->currentState.number < MAX_CLIENTS) {
03099 CG_InterpolateEntityPosition( cent );
03100 goAway = qtrue;
03101 }
03102 else if (cent->interpolate &&
03103 cent->currentState.eType == ET_NPC && cent->currentState.NPC_class == CLASS_VEHICLE)
03104 {
03105 CG_InterpolateEntityPosition( cent );
03106 goAway = qtrue;
03107 }
03108 else
03109 {
03110 // just use the current frame and evaluate as best we can
03111 BG_EvaluateTrajectory( ¢->currentState.pos, cg.time, cent->lerpOrigin );
03112 BG_EvaluateTrajectory( ¢->currentState.apos, cg.time, cent->lerpAngles );
03113 }
03114
03115 #if 0
03116 if (cent->hasRagOffset && cent->ragOffsetTime < cg.time)
03117 { //take all of the offsets from last frame and normalize the total direction and add it in
03118 vec3_t slideDir;
03119 vec3_t preOffset;
03120 vec3_t addedOffset;
03121 vec3_t playerMins = {-15, -15, DEFAULT_MINS_2};
03122 vec3_t playerMaxs = {15, 15, DEFAULT_MAXS_2};
03123 trace_t tr;
03124
03125 //VectorSubtract(cent->lerpOrigin, callData->bonePos, slideDir);
03126 VectorCopy(cent->ragOffsets, slideDir);
03127 VectorNormalize(slideDir);
03128
03129 //Store it in case we want to go back
03130 VectorCopy(cent->lerpOriginOffset, preOffset);
03131
03132 //just add a little at a time
03133 VectorMA(cent->lerpOriginOffset, 0.4f, slideDir, cent->lerpOriginOffset);
03134
03135 if (VectorLength(cent->lerpOriginOffset) > 10.0f)
03136 { //don't go too far away
03137 VectorCopy(preOffset, cent->lerpOriginOffset);
03138 }
03139 else
03140 {
03141 //Let's trace there to make sure we can make it
03142 VectorAdd(cent->lerpOrigin, cent->lerpOriginOffset, addedOffset);
03143 CG_Trace(&tr, cent->lerpOrigin, playerMins, playerMaxs, addedOffset, cent->currentState.number, MASK_PLAYERSOLID);
03144
03145 if (tr.startsolid || tr.allsolid || tr.fraction != 1.0f)
03146 { //can't get there
03147 VectorCopy(preOffset, cent->lerpOriginOffset);
03148 }
03149 else
03150 {
03151 /*
03152 if (cent->lerpOriginOffset[2] > 4.0f)
03153 { //don't go too far off the ground
03154 cent->lerpOriginOffset[2] = 4.0f;
03155 }
03156 */
03157 //I guess I just don't want this happening.
03158 cent->lerpOriginOffset[2] = 0.0f;
03159 }
03160 }
03161
03162 //done with this bit
03163 cent->hasRagOffset = qfalse;
03164 VectorClear(cent->ragOffsets);
03165 cent->ragOffsetTime = cg.time + 50;
03166 }
03167
03168 //See if we should add in the offset for ragdoll
03169 if (cent->isRagging && ((cent->currentState.eFlags & EF_DEAD) || (cent->currentState.eFlags & EF_RAG)))
03170 {
03171 VectorAdd(cent->lerpOrigin, cent->lerpOriginOffset, cent->lerpOrigin);
03172 }
03173 #endif
03174
03175 if (goAway)
03176 {
03177 return;
03178 }
03179
03180 // adjust for riding a mover if it wasn't rolled into the predicted
03181 // player state
03182 if ( cent->currentState.number != cg.predictedPlayerState.clientNum ) {
03183 CG_AdjustPositionForMover( cent->lerpOrigin, cent->currentState.groundEntityNum,
03184 cg.snap->serverTime, cg.time, cent->lerpOrigin );
03185 }
03186 }
|
|
|
Definition at line 7904 of file cg_players.c. References cg_g2JetpackInstance, NULL, and trap_G2API_CleanGhoul2Models(). Referenced by CG_DestroyAllGhoul2().
07905 {
07906 if (cg_g2JetpackInstance)
07907 {
07908 trap_G2API_CleanGhoul2Models(&cg_g2JetpackInstance);
07909 cg_g2JetpackInstance = NULL;
07910 }
07911 }
|
|
|
Definition at line 2535 of file cg_main.c. References CG_Error(), cgs, cgs_t::gameState, MAX_CONFIGSTRINGS, gameState_t::stringData, and gameState_t::stringOffsets. Referenced by CG_DrawActiveFrame(), CG_DrawInformation(), CG_DrawNewTeamInfo(), CG_DrawSiegeInfo(), CG_EntityEvent(), CG_G2AnimEntModelLoad(), CG_G2ServerBoneAngles(), CG_Init(), CG_LoadingClient(), CG_NewClientInfo(), CG_NewParticleArea(), CG_ParseServerinfo(), CG_PlayDoorLoopSound(), CG_PlayDoorSound(), CG_Player(), CG_SetConfigValues(), CG_SetLightstyle(), CG_ShaderStateChanged(), CG_StartMusic(), and TurretClientRun().
02535 {
02536 if ( index < 0 || index >= MAX_CONFIGSTRINGS ) {
02537 CG_Error( "CG_ConfigString: bad index: %i", index );
02538 }
02539 return cgs.gameState.stringData + cgs.gameState.stringOffsets[ index ];
02540 }
|
|
|
Definition at line 3440 of file cg_main.c. References cgSpawnEnt_t, cgSpawnEnt_s::maxs, cgSpawnEnt_s::mins, cgSpawnEnt_s::model, trap_R_ModelBounds(), and trap_R_RegisterModel(). Referenced by CG_CreateWeatherZoneFromSpawnEnt().
03441 {
03442 trap_R_ModelBounds(trap_R_RegisterModel(ent->model), ent->mins, ent->maxs);
03443 }
|
|
|
Definition at line 3452 of file cg_main.c. References cgSpawnEnt_s::angle, cgSpawnEnt_s::angles, AnglesToAxis(), refEntity_t::axis, cgSpawnEnt_t, Com_Error(), ERR_DROP, refEntity_t::frame, cgSpawnEnt_s::fScale, refEntity_t::hModel, refEntity_t::lightingOrigin, MAX_MISC_ENTS, memset(), cgSpawnEnt_s::model, refEntity_t::modelScale, refEntity_t::origin, cgSpawnEnt_s::origin, refEntity_t::reType, RT_MODEL, cgSpawnEnt_s::scale, ScaleModelAxis(), trap_R_ModelBounds(), trap_R_RegisterModel(), vec3_t, VectorCopy, VectorScaleVector, YAW, and cgSpawnEnt_s::zoffset. Referenced by CG_SpawnCGameEntFromVars().
03453 {
03454 int modelIndex;
03455 refEntity_t *RefEnt;
03456 vec3_t mins, maxs;
03457 float *radius;
03458 float *zOff;
03459
03460 if (NumMiscEnts >= MAX_MISC_ENTS)
03461 {
03462 Com_Error(ERR_DROP, "Too many misc_model_static's on level, ask a programmer to raise the limit (currently %i), or take some out.", MAX_MISC_ENTS);
03463 return;
03464 }
03465
03466 if (!ent || !ent->model || !ent->model[0])
03467 {
03468 Com_Error(ERR_DROP, "misc_model_static with no model.");
03469 return;
03470 }
03471
03472 radius = &Radius[NumMiscEnts];
03473 zOff = &zOffset[NumMiscEnts];
03474 RefEnt = &MiscEnts[NumMiscEnts++];
03475
03476 modelIndex = trap_R_RegisterModel(ent->model);
03477 if (modelIndex == 0)
03478 {
03479 Com_Error(ERR_DROP, "misc_model_static failed to load model '%s'",ent->model);
03480 return;
03481 }
03482
03483 memset(RefEnt, 0, sizeof(refEntity_t));
03484 RefEnt->reType = RT_MODEL;
03485 RefEnt->hModel = modelIndex;
03486 RefEnt->frame = 0;
03487 trap_R_ModelBounds(modelIndex, mins, maxs);
03488 VectorCopy(ent->scale, RefEnt->modelScale);
03489 if (ent->fScale)
03490 { //use same scale on each axis then
03491 RefEnt->modelScale[0] = RefEnt->modelScale[1] = RefEnt->modelScale[2] = ent->fScale;
03492 }
03493 VectorCopy(ent->origin, RefEnt->origin);
03494 VectorCopy(ent->origin, RefEnt->lightingOrigin);
03495
03496 VectorScaleVector(mins, ent->scale, mins);
03497 VectorScaleVector(maxs, ent->scale, maxs);
03498 *radius = Distance(mins, maxs);
03499 *zOff = ent->zoffset;
03500
03501 if (ent->angle)
03502 { //only yaw supplied...
03503 ent->angles[YAW] = ent->angle;
03504 }
03505
03506 AnglesToAxis( ent->angles, RefEnt->axis );
03507 ScaleModelAxis(RefEnt);
03508 }
|
|
|
Definition at line 3432 of file cg_main.c. References cg_skyOri, cg_skyOriPos, cg_skyOriScale, cgSpawnEnt_t, cgSpawnEnt_s::fScale, cgSpawnEnt_s::origin, qtrue, and VectorCopy. Referenced by CG_SpawnCGameEntFromVars().
03433 {
03434 cg_skyOri = qtrue;
03435 VectorCopy(ent->origin, cg_skyOriPos);
03436 cg_skyOriScale = ent->fScale;
03437 }
|
|
|
Definition at line 3418 of file cg_main.c. References cg_noFogOutsidePortal, cgSpawnEnt_t, cgSpawnEnt_s::onlyFogHere, and qtrue. Referenced by CG_SpawnCGameEntFromVars().
03419 {
03420 if (ent->onlyFogHere)
03421 { //only globally fog INSIDE the sky portal
03422 cg_noFogOutsidePortal = qtrue;
03423 }
03424 }
|
|
|
Definition at line 3445 of file cg_main.c. References CG_CreateBrushEntData(), cgSpawnEnt_t, cgSpawnEnt_s::maxs, cgSpawnEnt_s::mins, and trap_WE_AddWeatherZone(). Referenced by CG_SpawnCGameEntFromVars().
03446 {
03447 CG_CreateBrushEntData(ent);
03448 trap_WE_AddWeatherZone(ent->mins, ent->maxs);
03449 }
|
|
|
Definition at line 1189 of file cg_main.c. References cg, cg_t::crosshairClientNum, cg_t::crosshairClientTime, MAX_CLIENTS, and cg_t::time. Referenced by CG_TargetCommand_f(), and vmMain().
01189 {
01190 if ( cg.time > ( cg.crosshairClientTime + 1000 ) ) {
01191 return -1;
01192 }
01193
01194 if (cg.crosshairClientNum >= MAX_CLIENTS)
01195 {
01196 return -1;
01197 }
01198
01199 return cg.crosshairClientNum;
01200 }
|
|
|
Definition at line 3951 of file cg_main.c. References CG_CleanJetpackGhoul2(), cg_items, CG_KillCEntityG2(), CG_ShutDownG2Weapons(), itemInfo_t::g2Models, MAX_GENTITIES, MAX_ITEM_MODELS, MAX_ITEMS, NULL, trap_G2_HaveWeGhoul2Models(), and trap_G2API_CleanGhoul2Models(). Referenced by CG_Shutdown().
03952 {
03953 int i = 0;
03954 int j;
03955
03956 // Com_Printf("... CGameside GHOUL2 Cleanup\n");
03957 while (i < MAX_GENTITIES)
03958 { //free all dynamically allocated npc client info structs and ghoul2 instances
03959 CG_KillCEntityG2(i);
03960 i++;
03961 }
03962
03963 //Clean the weapon instances
03964 CG_ShutDownG2Weapons();
03965
03966 i = 0;
03967 while (i < MAX_ITEMS)
03968 { //and now for items
03969 j = 0;
03970 while (j < MAX_ITEM_MODELS)
03971 {
03972 if (cg_items[i].g2Models[j] && trap_G2_HaveWeGhoul2Models(cg_items[i].g2Models[j]))
03973 {
03974 trap_G2API_CleanGhoul2Models(&cg_items[i].g2Models[j]);
03975 cg_items[i].g2Models[j] = NULL;
03976 }
03977 j++;
03978 }
03979 i++;
03980 }
03981
03982 //Clean the global jetpack instance
03983 CG_CleanJetpackGhoul2();
03984 }
|
|
||||||||||||||||||||
|
Definition at line 2121 of file cg_view.c. References cg, CGCam_Shake(), cg_t::refdef, vec3_t, VectorNormalize(), VectorSubtract, and refdef_t::vieworg. Referenced by vmMain().
02122 {
02123 //FIXME: When exactly is the vieworg calculated in relation to the rest of the frame?s
02124
02125 vec3_t dir;
02126 float dist, intensityScale;
02127 float realIntensity;
02128
02129 VectorSubtract( cg.refdef.vieworg, origin, dir );
02130 dist = VectorNormalize( dir );
02131
02132 //Use the dir to add kick to the explosion
02133
02134 if ( dist > radius )
02135 return;
02136
02137 intensityScale = 1 - ( dist / (float) radius );
02138 realIntensity = intensity * intensityScale;
02139
02140 CGCam_Shake( realIntensity, time );
02141 }
|
|
|
Definition at line 624 of file cg_main.c. References snapshot_t::areamask, cg, cg_t::distanceCull, refEntity_t::origin, cg_t::refdef, cg_t::snap, trap_R_AddRefEntityToScene(), trap_R_inPVS(), vec3_t, VectorCopy, VectorSubtract, and refdef_t::vieworg. Referenced by CG_DrawActiveFrame().
00625 {
00626 int i;
00627 refEntity_t *RefEnt;
00628 float *radius, *zOff;
00629 vec3_t difference;
00630 vec3_t cullOrigin;
00631
00632 RefEnt = MiscEnts;
00633 radius = Radius;
00634 zOff = zOffset;
00635 for(i=0;i<NumMiscEnts;i++)
00636 {
00637 VectorCopy(RefEnt->origin, cullOrigin);
00638 cullOrigin[2] += 1.0f;
00639
00640 if (*zOff)
00641 {
00642 cullOrigin[2] += *zOff;
00643 }
00644
00645 if (cg.snap && trap_R_inPVS(cg.refdef.vieworg, cullOrigin, cg.snap->areamask))
00646 {
00647 VectorSubtract(RefEnt->origin, cg.refdef.vieworg, difference);
00648 if (VectorLength(difference)-(*radius) <= cg.distanceCull)
00649 {
00650 trap_R_AddRefEntityToScene(RefEnt);
00651 }
00652 }
00653 RefEnt++;
00654 radius++;
00655 zOff++;
00656 }
00657 }
|
|
||||||||||||
|
Definition at line 1220 of file cg_main.c. References QDECL, trap_Error(), va_end, va_list, va_start, and vsprintf(). Referenced by CG_AddLocalEntities(), CG_AddSpawnVarToken(), CG_ChatBox_ArrayInsert(), CG_ConfigString(), CG_DrawActive(), CG_DrawSkyBoxPortal(), CG_EntityEvent(), CG_FireWeapon(), CG_FreeLocalEntity(), CG_FreeMarkPoly(), CG_ImpactMark(), CG_Init(), CG_InitSiegeMode(), CG_LoadClientInfo(), CG_MakeExplosion(), CG_ParseSpawnVars(), CG_ParticleExplosion(), CG_Player(), CG_PrecacheSiegeObjectiveAssetsForTeam(), CG_ProcessSnapshots(), CG_RegisterItemVisuals(), CG_RegisterWeapon(), CG_SiegeObjectiveCompleted(), CG_SiegeRoundOver(), CG_SpawnCGameOnlyEnts(), Com_Error(), and vmMain().
01220 {
01221 va_list argptr;
01222 char text[1024];
01223
01224 va_start (argptr, msg);
01225 vsprintf (text, msg, argptr);
01226 va_end (argptr);
01227
01228 trap_Error( text );
01229 }
|
|
||||||||||||
|
Definition at line 263 of file cg_scoreboard.c. References bgSiegeClasses, cgs, siegeClass_t::classShader, cgs_t::clientinfo, clientInfo_t::infoValid, cgs_t::maxclients, clientInfo_t::siegeIndex, clientInfo_t::team, and team_t. Referenced by CG_SiegeCountCvars().
00264 {
00265 int i = 0;
00266 int count = 0;
00267 clientInfo_t *ci;
00268 siegeClass_t *scl;
00269
00270 for ( i = 0 ; i < cgs.maxclients ; i++ )
00271 {
00272 ci = &cgs.clientinfo[ i ];
00273
00274 if ((!ci->infoValid) || ( team != ci->team ))
00275 {
00276 continue;
00277 }
00278
00279 scl = &bgSiegeClasses[ci->siegeIndex];
00280
00281 // Correct class?
00282 if ( siegeClass != scl->classShader )
00283 {
00284 continue;
00285 }
00286
00287 count++;
00288 }
00289
00290 return count;
00291
00292 }
|
|
|
Definition at line 3936 of file cg_main.c. References trap_SP_GetStringTextString(). Referenced by CG_DrawNewTeamInfo().
03937 {
03938 static char text[1024]={0};
03939
03940 if (!loc || loc[0] != '@')
03941 { //just a raw string
03942 return loc;
03943 }
03944
03945 trap_SP_GetStringTextString(loc+1, text, sizeof(text));
03946 return text;
03947 }
|
|
|
Definition at line 2563 of file cg_main.c. References fileHandle_t, FS_READ, MAX_MENUFILE, NULL, S_COLOR_RED, trap_FS_FCloseFile(), trap_FS_FOpenFile(), trap_FS_Read(), trap_Print(), and va().
02563 {
02564 int len;
02565 fileHandle_t f;
02566 static char buf[MAX_MENUFILE];
02567
02568 len = trap_FS_FOpenFile( filename, &f, FS_READ );
02569 if ( !f ) {
02570 trap_Print( va( S_COLOR_RED "menu file not found: %s, using default\n", filename ) );
02571 return NULL;
02572 }
02573 if ( len >= MAX_MENUFILE ) {
02574 trap_Print( va( S_COLOR_RED "menu file too large: %s is %i, max allowed is %i", filename, len, MAX_MENUFILE ) );
02575 trap_FS_FCloseFile( f );
02576 return NULL;
02577 }
02578
02579 trap_FS_Read( buf, len, f );
02580 buf[len] = 0;
02581 trap_FS_FCloseFile( f );
02582
02583 return buf;
02584 }
|
|
||||||||||||
|
Definition at line 2429 of file cg_main.c. References trap_SP_GetStringTextString(), and va(). Referenced by CG_DrawActiveFrame(), CG_DrawForceSelect(), CG_DrawHUD(), CG_DrawInformation(), CG_DrawOldScoreboard(), CG_EntityEvent(), CG_GetGameStatusText(), CG_GetKillerText(), CG_GetStringForVoiceSound(), CG_LoadingItem(), and CG_PrintCTFMessage().
02430 {
02431 static char text[2][1024]={0}; //just incase it's nested
02432 static int index = 0;
02433
02434 index ^= 1;
02435 trap_SP_GetStringTextString(va("%s_%s", refSection, refName), text[index], sizeof(text[0]));
02436 return text[index];
02437 }
|
|
|
Definition at line 294 of file cg_scoreboard.c. References cgs, cgs_t::clientinfo, clientInfo_t::infoValid, cgs_t::maxclients, clientInfo_t::siegeDesiredTeam, clientInfo_t::team, and team_t. Referenced by CG_SiegeCountCvars().
00295 {
00296 int i = 0,count=0;
00297 clientInfo_t *ci;
00298
00299 for ( i = 0 ; i < cgs.maxclients ; i++ )
00300 {
00301 ci = &cgs.clientinfo[ i ];
00302
00303 if ( (!ci->infoValid) || (team != ci->team && team != ci->siegeDesiredTeam) )
00304 {
00305 continue;
00306 }
00307
00308 count++;
00309 }
00310
00311 return count;
00312 }
|
|
|
Definition at line 6817 of file cg_players.c.
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 }
|
|
||||||||||||||||
|
Definition at line 3704 of file cg_main.c. References displayContextDef_t::Assets, atoi(), cgMedia_t::bdecal_bodyburn1, cgMedia_t::bdecal_burn1, cgMedia_t::bdecal_saberglow, BG_FindItemForWeapon(), BG_InitAnimsets(), bg_itemlist, bg_numItems, BG_VehicleLoadParms(), cgs_t::blueflag, cg, CG_AssetCache(), CG_ClearLightStyles(), CG_ConfigString(), CG_Error(), CG_Init_CG(), CG_Init_CGents(), CG_InitConsoleCommands(), CG_InitItems(), CG_InitJetpackGhoul2(), CG_InitLocalEntities(), CG_InitMarkPolys(), CG_InitSiegeMode(), CG_LoadHudMenu(), CG_LoadingString(), CG_ParseServerinfo(), CG_PmoveClientPointerUpdate(), CG_RegisterCvars(), CG_SetConfigValues(), CG_ShaderStateChanged(), CG_SpawnCGameOnlyEnts(), CG_StartMusic(), CG_TransitionPermanent(), cg_weapons, cgDC, cgs, cgMedia_t::charsetShader, cg_t::clientNum, CS_GAME_VERSION, CS_LEVEL_START_TIME, cg_t::distanceCull, cgs_t::flagStatus, cg_t::forceHUDActive, cg_t::forceHUDNextFlashTime, cg_t::forceHUDTotalFlashTime, cgMedia_t::forceIconBackground, cgMedia_t::forcePowerIcons, cg_t::forceSelect, GAME_VERSION, cgs_t::gameState, gitem_s::giTag, gitem_t, gitem_s::giType, cgs_t::glconfig, HolocronIcons, gitem_s::icon, cg_t::infoScreenText, cgMedia_t::invenIcons, cgMedia_t::inventoryIconBackground, IT_HOLDABLE, cg_t::itemSelect, LAST_USEABLE_WEAPON, cgs_t::levelStartTime, cgMedia_t::loadBarLED, cgMedia_t::loadBarLEDCap, cgMedia_t::loadBarLEDSurround, cg_t::loading, cg_t::loadLCARSStage, cgs_t::mapname, cgs_t::media, memset(), cgMedia_t::mSaberDamageGlow, NUM_FORCE_POWERS, cgs_t::processedSnapshotNum, qfalse, cachedAssets_t::qhBigFont, cachedAssets_t::qhMediumFont, cachedAssets_t::qhSmallFont, qtrue, cgMedia_t::rageRecShader, cgs_t::redflag, cgs_t::screenXScale, cgs_t::screenYScale, cgs_t::serverCommandSequence, cg_t::sharedBuffer, strcmp(), String_Init(), trap_CG_RegisterSharedMemory(), trap_CM_LoadMap(), trap_Cvar_VariableStringBuffer(), trap_GetGameState(), trap_GetGlconfig(), trap_R_GetDistanceCull(), trap_R_InitWireframeAutomap(), trap_R_RegisterFont(), trap_R_RegisterShader(), trap_R_RegisterShaderNoMip(), trap_S_ClearLoopingSounds(), va(), glconfig_t::vidHeight, glconfig_t::vidWidth, cgMedia_t::weaponIconBackground, cgMedia_t::weaponIcons, cgMedia_t::weaponIcons_NA, cg_t::weaponSelect, cgMedia_t::whiteShader, WP_BRYAR_PISTOL, WP_NONE, and WP_SaberLoadParms(). Referenced by vmMain().
03705 {
03706 static gitem_t *item;
03707 char buf[64];
03708 const char *s;
03709 int i = 0;
03710
03711 BG_InitAnimsets(); //clear it out
03712
03713 trap_CG_RegisterSharedMemory(cg.sharedBuffer);
03714
03715 //Load external vehicle data
03716 BG_VehicleLoadParms();
03717
03718 // clear everything
03719 /*
03720 Ghoul2 Insert Start
03721 */
03722
03723 // memset( cg_entities, 0, sizeof( cg_entities ) );
03724 CG_Init_CGents();
03725 // this is a No-No now we have stl vector classes in here.
03726 // memset( &cg, 0, sizeof( cg ) );
03727 CG_Init_CG();
03728 CG_InitItems();
03729
03730 //create the global jetpack instance
03731 CG_InitJetpackGhoul2();
03732
03733 CG_PmoveClientPointerUpdate();
03734
03735 /*
03736 Ghoul2 Insert End
03737 */
03738
03739 //Load sabers.cfg data
03740 WP_SaberLoadParms();
03741
03742 // this is kinda dumb as well, but I need to pre-load some fonts in order to have the text available
03743 // to say I'm loading the assets.... which includes loading the fonts. So I'll set these up as reasonable
03744 // defaults, then let the menu asset parser (which actually specifies the ingame fonts) load over them
03745 // if desired during parse. Dunno how legal it is to store in these cgDC things, but it causes no harm
03746 // and even if/when they get overwritten they'll be legalised by the menu asset parser :-)
03747 // CG_LoadFonts();
03748 cgDC.Assets.qhSmallFont = trap_R_RegisterFont("ocr_a");
03749 cgDC.Assets.qhMediumFont = trap_R_RegisterFont("ergoec");
03750 cgDC.Assets.qhBigFont = cgDC.Assets.qhMediumFont;
03751
03752 memset( &cgs, 0, sizeof( cgs ) );
03753 memset( cg_weapons, 0, sizeof(cg_weapons) );
03754
03755 cg.clientNum = clientNum;
03756
03757 cgs.processedSnapshotNum = serverMessageNum;
03758 cgs.serverCommandSequence = serverCommandSequence;
03759
03760 cg.loadLCARSStage = 0;
03761
03762 cg.itemSelect = -1;
03763 cg.forceSelect = -1;
03764
03765 // load a few needed things before we do any screen updates
03766 cgs.media.charsetShader = trap_R_RegisterShaderNoMip( "gfx/2d/charsgrid_med" );
03767 cgs.media.whiteShader = trap_R_RegisterShader( "white" );
03768
03769 cgs.media.loadBarLED = trap_R_RegisterShaderNoMip( "gfx/hud/load_tick" );
03770 cgs.media.loadBarLEDCap = trap_R_RegisterShaderNoMip( "gfx/hud/load_tick_cap" );
03771 cgs.media.loadBarLEDSurround= trap_R_RegisterShaderNoMip( "gfx/hud/mp_levelload" );
03772
03773 // Force HUD set up
03774 cg.forceHUDActive = qtrue;
03775 cg.forceHUDTotalFlashTime = 0;
03776 cg.forceHUDNextFlashTime = 0;
03777
03778 i = WP_NONE+1;
03779 while (i <= LAST_USEABLE_WEAPON)
03780 {
03781 item = BG_FindItemForWeapon(i);
03782
03783 if (item && item->icon && item->icon[0])
03784 {
03785 cgs.media.weaponIcons[i] = trap_R_RegisterShaderNoMip(item->icon);
03786 cgs.media.weaponIcons_NA[i] = trap_R_RegisterShaderNoMip(va("%s_na", item->icon));
03787 }
03788 else
03789 { //make sure it is zero'd (default shader)
03790 cgs.media.weaponIcons[i] = 0;
03791 cgs.media.weaponIcons_NA[i] = 0;
03792 }
03793 i++;
03794 }
03795 trap_Cvar_VariableStringBuffer("com_buildscript", buf, sizeof(buf));
03796 if (atoi(buf))
03797 {
03798 trap_R_RegisterShaderNoMip("gfx/hud/w_icon_saberstaff");
03799 trap_R_RegisterShaderNoMip("gfx/hud/w_icon_duallightsaber");
03800 }
03801 i = 0;
03802
03803 // HUD artwork for cycling inventory,weapons and force powers
03804 cgs.media.weaponIconBackground = trap_R_RegisterShaderNoMip( "gfx/hud/background");
03805 cgs.media.forceIconBackground = trap_R_RegisterShaderNoMip( "gfx/hud/background_f");
03806 cgs.media.inventoryIconBackground = trap_R_RegisterShaderNoMip( "gfx/hud/background_i");
03807
03808 //rww - precache holdable item icons here
03809 while (i < bg_numItems)
03810 {
03811 if (bg_itemlist[i].giType == IT_HOLDABLE)
03812 {
03813 if (bg_itemlist[i].icon)
03814 {
03815 cgs.media.invenIcons[bg_itemlist[i].giTag] = trap_R_RegisterShaderNoMip(bg_itemlist[i].icon);
03816 }
03817 else
03818 {
03819 cgs.media.invenIcons[bg_itemlist[i].giTag] = 0;
03820 }
03821 }
03822
03823 i++;
03824 }
03825
03826 //rww - precache force power icons here
03827 i = 0;
03828
03829 while (i < NUM_FORCE_POWERS)
03830 {
03831 cgs.media.forcePowerIcons[i] = trap_R_RegisterShaderNoMip(HolocronIcons[i]);
03832
03833 i++;
03834 }
03835 cgs.media.rageRecShader = trap_R_RegisterShaderNoMip("gfx/mp/f_icon_ragerec");
03836
03837
03838 //body decal shaders -rww
03839 cgs.media.bdecal_bodyburn1 = trap_R_RegisterShader("gfx/damage/bodyburnmark1");
03840 cgs.media.bdecal_saberglow = trap_R_RegisterShader("gfx/damage/saberglowmark");
03841 cgs.media.bdecal_burn1 = trap_R_RegisterShader("gfx/damage/bodybigburnmark1");
03842 cgs.media.mSaberDamageGlow = trap_R_RegisterShader("gfx/effects/saberDamageGlow");
03843
03844 CG_RegisterCvars();
03845
03846 CG_InitConsoleCommands();
03847
03848 cg.weaponSelect = WP_BRYAR_PISTOL;
03849
03850 cgs.redflag = cgs.blueflag = -1; // For compatibily, default to unset for
03851 cgs.flagStatus = -1;
03852 // old servers
03853
03854 // get the rendering configuration from the client system
03855 trap_GetGlconfig( &cgs.glconfig );
03856 cgs.screenXScale = cgs.glconfig.vidWidth / 640.0;
03857 cgs.screenYScale = cgs.glconfig.vidHeight / 480.0;
03858
03859 // get the gamestate from the client system
03860 trap_GetGameState( &cgs.gameState );
03861
03862 CG_TransitionPermanent(); //rwwRMG - added
03863
03864 // check version
03865 s = CG_ConfigString( CS_GAME_VERSION );
03866 if ( strcmp( s, GAME_VERSION ) ) {
03867 CG_Error( "Client/Server game mismatch: %s/%s", GAME_VERSION, s );
03868 }
03869
03870 s = CG_ConfigString( CS_LEVEL_START_TIME );
03871 cgs.levelStartTime = atoi( s );
03872
03873 CG_ParseServerinfo();
03874
03875 // load the new map
03876 // CG_LoadingString( "collision map" );
03877
03878 trap_CM_LoadMap( cgs.mapname, qfalse );
03879
03880 String_Init();
03881
03882 cg.loading = qtrue; // force players to load instead of defer
03883
03884 //make sure saber data is loaded before this! (so we can precache the appropriate hilts)
03885 CG_InitSiegeMode();
03886
03887 CG_RegisterSounds();
03888
03889 // CG_LoadingString( "graphics" );
03890
03891 CG_RegisterGraphics();
03892
03893 // CG_LoadingString( "clients" );
03894
03895 CG_RegisterClients(); // if low on memory, some clients will be deferred
03896
03897 CG_AssetCache();
03898 CG_LoadHudMenu(); // load new hud stuff
03899
03900 cg.loading = qfalse; // future players will be deferred
03901
03902 CG_InitLocalEntities();
03903
03904 CG_InitMarkPolys();
03905
03906 // remove the last loading update
03907 cg.infoScreenText[0] = 0;
03908
03909 // Make sure we have update values (scores)
03910 CG_SetConfigValues();
03911
03912 CG_StartMusic(qfalse);
03913
03914 // CG_LoadingString( "Clearing light styles" );
03915 CG_ClearLightStyles();
03916
03917 // CG_LoadingString( "Creating automap data" );
03918 //init automap
03919 #ifndef _XBOX
03920 trap_R_InitWireframeAutomap();
03921 #endif
03922
03923 CG_LoadingString( "" );
03924
03925 CG_ShaderStateChanged();
03926
03927 trap_S_ClearLoopingSounds();
03928
03929 trap_R_GetDistanceCull(&cg.distanceCull);
03930
03931 //now get all the cgame only cents
03932 CG_SpawnCGameOnlyEnts();
03933 }
|
|
|
Definition at line 3254 of file cg_main.c. References cg, memset(), and qboolean. Referenced by CG_Init().
|
|
|
Definition at line 3274 of file cg_main.c. References cg_entities, and memset(). Referenced by CG_Init().
03275 {
03276
03277 memset(&cg_entities, 0, sizeof(cg_entities));
03278 }
|
|
|
Definition at line 3281 of file cg_main.c. References cg_items, and memset(). Referenced by CG_Init().
03282 {
03283 memset( cg_items, 0, sizeof( cg_items ) );
03284 }
|
|
|
Definition at line 7882 of file cg_players.c. References cg_g2JetpackInstance, JETPACK_MODEL, trap_G2API_AddBolt(), trap_G2API_InitGhoul2Model(), and trap_G2API_SetBoltInfo(). Referenced by CG_Init().
07883 {
07884 if (cg_g2JetpackInstance)
07885 {
07886 assert(!"Tried to init jetpack inst, already init'd");
07887 return;
07888 }
07889
07890 trap_G2API_InitGhoul2Model(&cg_g2JetpackInstance, JETPACK_MODEL, 0, 0, 0, 0, 0);
07891
07892 assert(cg_g2JetpackInstance);
07893
07894 //Indicate which bolt on the player we will be attached to
07895 //In this case bolt 0 is rhand, 1 is lhand, and 2 is the bolt
07896 //for the jetpack (*chestg)
07897 trap_G2API_SetBoltInfo(cg_g2JetpackInstance, 0, 2);
07898
07899 //Add the bolts jet effects will be played from
07900 trap_G2API_AddBolt(cg_g2JetpackInstance, 0, "torso_ljet");
07901 trap_G2API_AddBolt(cg_g2JetpackInstance, 0, "torso_rjet");
07902 }
|
|
|
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(¢->ghoul2);
00911 cent->ghoul2 = NULL;
00912 }
00913
00914 if (cent->grip_arm && trap_G2_HaveWeGhoul2Models(cent->grip_arm))
00915 {
00916 trap_G2API_CleanGhoul2Models(¢->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(¢->frame_hold);
00923 cent->frame_hold = NULL;
00924 }
00925
00926 if (cent->npcClient)
00927 {
00928 CG_DestroyNPCClient(¢->npcClient);
00929 }
00930
00931 cent->isRagging = qfalse; //just in case.
00932 cent->ikStatus = qfalse;
00933
00934 cent->localAnimIndex = 0;
00935 }
|
|
|
Definition at line 1202 of file cg_main.c. References cg_t::attackerTime, cg, PERS_ATTACKER, playerState_s::persistant, snapshot_t::ps, and cg_t::snap. Referenced by vmMain().
01202 {
01203 if ( !cg.attackerTime ) {
01204 return -1;
01205 }
01206 return cg.snap->ps.persistant[PERS_ATTACKER];
01207 }
|
|
|
Definition at line 2800 of file cg_main.c. References CG_ParseMenu(), COM_ParseExt(), Q_stricmp(), qboolean, qfalse, and qtrue. Referenced by CG_LoadMenus().
02801 {
02802
02803 char *token;
02804
02805 token = COM_ParseExt((const char **)p, qtrue);
02806
02807 if (token[0] != '{') {
02808 return qfalse;
02809 }
02810
02811 while ( 1 ) {
02812
02813 token = COM_ParseExt((const char **)p, qtrue);
02814
02815 if (Q_stricmp(token, "}") == 0) {
02816 return qtrue;
02817 }
02818
02819 if ( !token || token[0] == 0 ) {
02820 return qfalse;
02821 }
02822
02823 CG_ParseMenu(token);
02824 }
02825 return qfalse;
02826 }
|
|
|
|
Definition at line 3076 of file cg_main.c. References CG_Load_Menu(), COM_ParseExt(), fileHandle_t, FS_READ, MAX_MENUDEFFILE, Q_stricmp(), qtrue, S_COLOR_RED, trap_FS_FCloseFile(), trap_FS_FOpenFile(), trap_FS_Read(), trap_Print(), and va(). Referenced by CG_LoadHudMenu().
03077 {
03078 const char *token;
03079 const char *p;
03080 int len;
03081 fileHandle_t f;
03082 static char buf[MAX_MENUDEFFILE];
03083
03084 len = trap_FS_FOpenFile( menuFile, &f, FS_READ );
03085
03086 if ( !f )
03087 {
03088 trap_Print( va( S_COLOR_RED "menu file not found: %s, using default\n", menuFile ) );
03089
03090 len = trap_FS_FOpenFile( "ui/jahud.txt", &f, FS_READ );
03091 if (!f)
03092 {
03093 trap_Print( va( S_COLOR_RED "default menu file not found: ui/hud.txt, unable to continue!\n", menuFile ) );
03094 }
03095 }
03096
03097 if ( len >= MAX_MENUDEFFILE )
03098 {
03099 trap_Print( va( S_COLOR_RED "menu file too large: %s is %i, max allowed is %i", menuFile, len, MAX_MENUDEFFILE ) );
03100 trap_FS_FCloseFile( f );
03101 return;
03102 }
03103
03104 trap_FS_Read( buf, len, f );
03105 buf[len] = 0;
03106 trap_FS_FCloseFile( f );
03107
03108 p = buf;
03109
03110 while ( 1 )
03111 {
03112 token = COM_ParseExt( &p, qtrue );
03113 if( !token || token[0] == 0 || token[0] == '}')
03114 {
03115 break;
03116 }
03117
03118 if ( Q_stricmp( token, "}" ) == 0 )
03119 {
03120 break;
03121 }
03122
03123 if (Q_stricmp(token, "loadmenu") == 0)
03124 {
03125 if (CG_Load_Menu(&p))
03126 {
03127 continue;
03128 }
03129 else
03130 {
03131 break;
03132 }
03133 }
03134 }
03135
03136 //Com_Printf("UI menu load time = %d milli seconds\n", cgi_Milliseconds() - start);
03137 }
|
|
|
Definition at line 582 of file cg_main.c. References AnglesToAxis(), refEntity_t::axis, cg, Com_Error(), ERR_DROP, refEntity_t::frame, refEntity_t::hModel, TCGMiscEnt::mAngles, MAX_MISC_ENTS, memset(), TCGMiscEnt::mModel, refEntity_t::modelScale, TCGMiscEnt::mOrigin, TCGMiscEnt::mScale, refEntity_t::origin, refEntity_t::reType, RT_MODEL, ScaleModelAxis(), cg_t::sharedBuffer, trap_R_ModelBounds(), trap_R_RegisterModel(), vec3_t, VectorCopy, and VectorScaleVector. Referenced by vmMain().
00583 {
00584 int modelIndex;
00585 refEntity_t *RefEnt;
00586 TCGMiscEnt *data = (TCGMiscEnt *)cg.sharedBuffer;
00587 vec3_t mins, maxs;
00588 float *radius, *zOff;
00589
00590 if (NumMiscEnts >= MAX_MISC_ENTS)
00591 {
00592 return;
00593 }
00594
00595 radius = &Radius[NumMiscEnts];
00596 zOff = &zOffset[NumMiscEnts];
00597 RefEnt = &MiscEnts[NumMiscEnts++];
00598
00599 modelIndex = trap_R_RegisterModel(data->mModel);
00600 if (modelIndex == 0)
00601 {
00602 Com_Error(ERR_DROP, "client_model has invalid model definition");
00603 return;
00604 }
00605
00606 *zOff = 0;
00607
00608 memset(RefEnt, 0, sizeof(refEntity_t));
00609 RefEnt->reType = RT_MODEL;
00610 RefEnt->hModel = modelIndex;
00611 RefEnt->frame = 0;
00612 trap_R_ModelBounds(modelIndex, mins, maxs);
00613 VectorCopy(data->mScale, RefEnt->modelScale);
00614 VectorCopy(data->mOrigin, RefEnt->origin);
00615
00616 VectorScaleVector(mins, data->mScale, mins);
00617 VectorScaleVector(maxs, data->mScale, maxs);
00618 *radius = Distance(mins, maxs);
00619
00620 AnglesToAxis( data->mAngles, RefEnt->axis );
00621 ScaleModelAxis(RefEnt);
00622 }
|
|
|
Definition at line 3344 of file cg_main.c. References CG_StrPool_Alloc(), and strlen(). Referenced by BG_ParseField().
03345 {
03346 char *newb, *new_p;
03347 int i,l;
03348
03349 l = strlen(string) + 1;
03350
03351 newb = CG_StrPool_Alloc( l );
03352
03353 new_p = newb;
03354
03355 // turn \n into a real linefeed
03356 for ( i=0 ; i< l ; i++ ) {
03357 if (string[i] == '\\' && i < l-1) {
03358 i++;
03359 if (string[i] == 'n') {
03360 *new_p++ = '\n';
03361 } else {
03362 *new_p++ = '\\';
03363 }
03364 } else {
03365 *new_p++ = string[i];
03366 }
03367 }
03368
03369 return newb;
03370 }
|
|
|
|
|
Definition at line 159 of file cg_main.c. References cg, playerState_s::fd, forcedata_s::forcePowersKnown, FP_HEAL, FP_LEVITATION, FP_SABER_DEFENSE, FP_SABER_OFFENSE, FP_SABERTHROW, NUM_FORCE_POWERS, cg_t::predictedPlayerState, qboolean, qfalse, and qtrue. Referenced by CG_NextForcePower_f(), CG_PrevForcePower_f(), and vmMain().
00160 {
00161 int i = FP_HEAL;
00162 while (i < NUM_FORCE_POWERS)
00163 {
00164 if (i != FP_SABERTHROW &&
00165 i != FP_SABER_OFFENSE &&
00166 i != FP_SABER_DEFENSE &&
00167 i != FP_LEVITATION)
00168 { //valid selectable power
00169 if (cg.predictedPlayerState.fd.forcePowersKnown & (1 << i))
00170 { //we have it
00171 return qfalse;
00172 }
00173 }
00174 i++;
00175 }
00176
00177 //no useable force powers, I guess.
00178 return qtrue;
00179 }
|
|
|
Definition at line 2753 of file cg_main.c. References CG_Asset_Parse(), Menu_New(), pc_token_t, Q_stricmp(), pc_token_s::string, trap_PC_FreeSource(), trap_PC_LoadSource(), and trap_PC_ReadToken(). Referenced by CG_Load_Menu().
02753 {
02754 pc_token_t token;
02755 int handle;
02756
02757 handle = trap_PC_LoadSource(menuFile);
02758 if (!handle)
02759 handle = trap_PC_LoadSource("ui/testhud.menu");
02760 if (!handle)
02761 return;
02762
02763 while ( 1 ) {
02764 if (!trap_PC_ReadToken( handle, &token )) {
02765 break;
02766 }
02767
02768 //if ( Q_stricmp( token, "{" ) ) {
02769 // Com_Printf( "Missing { in menu file\n" );
02770 // break;
02771 //}
02772
02773 //if ( menuCount == MAX_MENUS ) {
02774 // Com_Printf( "Too many menus!\n" );
02775 // break;
02776 //}
02777
02778 if ( token.string[0] == '}' ) {
02779 break;
02780 }
02781
02782 if (Q_stricmp(token.string, "assetGlobalDef") == 0) {
02783 if (CG_Asset_Parse(handle)) {
02784 continue;
02785 } else {
02786 break;
02787 }
02788 }
02789
02790
02791 if (Q_stricmp(token.string, "menudef") == 0) {
02792 // start a new menu
02793 Menu_New(handle);
02794 }
02795 }
02796 trap_PC_FreeSource(handle);
02797 }
|
|
|
Definition at line 458 of file cg_saga.c.
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 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 }
|
|
|
Definition at line 3541 of file cg_main.c. References CG_AddSpawnVarToken(), CG_Error(), MAX_SPAWN_VARS, MAX_TOKEN_CHARS, qboolean, qfalse, qtrue, and trap_GetEntityToken(). Referenced by CG_SpawnCGameOnlyEnts().
03542 {
03543 char keyname[MAX_TOKEN_CHARS];
03544 char com_token[MAX_TOKEN_CHARS];
03545
03546 cg_numSpawnVars = 0;
03547 cg_numSpawnVarChars = 0;
03548
03549 // parse the opening brace
03550 if ( !trap_GetEntityToken( com_token, sizeof( com_token ) ) ) {
03551 // end of spawn string
03552 return qfalse;
03553 }
03554 if ( com_token[0] != '{' ) {
03555 CG_Error( "CG_ParseSpawnVars: found %s when expecting {",com_token );
03556 }
03557
03558 // go through all the key / value pairs
03559 while ( 1 )
03560 {
03561 // parse key
03562 if ( !trap_GetEntityToken( keyname, sizeof( keyname ) ) )
03563 {
03564 CG_Error( "CG_ParseSpawnVars: EOF without closing brace" );
03565 }
03566
03567 if ( keyname[0] == '}' )
03568 {
03569 break;
03570 }
03571
03572 // parse value
03573 if ( !trap_GetEntityToken( com_token, sizeof( com_token ) ) )
03574 { //this happens on mike's test level, I don't know why. Fixme?
03575 //CG_Error( "CG_ParseSpawnVars: EOF without closing brace" );
03576 break;
03577 }
03578
03579 if ( com_token[0] == '}' )
03580 {
03581 CG_Error( "CG_ParseSpawnVars: closing brace without data" );
03582 }
03583 if ( cg_numSpawnVars == MAX_SPAWN_VARS )
03584 {
03585 CG_Error( "CG_ParseSpawnVars: MAX_SPAWN_VARS" );
03586 }
03587 cg_spawnVars[ cg_numSpawnVars ][0] = CG_AddSpawnVarToken( keyname );
03588 cg_spawnVars[ cg_numSpawnVars ][1] = CG_AddSpawnVarToken( com_token );
03589 cg_numSpawnVars++;
03590 }
03591
03592 return qtrue;
03593 }
|
|
|
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 }
|
|
|
Definition at line 884 of file cg_predict.c. References pmove_t::baseEnt, bgEntity_t, centity_t, cg_entities, cgSendPS, cgSendPSPool, pmove_t::entSize, pmove_t::ghoul2, MAX_GENTITIES, memset(), NULL, and centity_s::playerState. Referenced by CG_Init().
00885 {
00886 int i;
00887
00888 memset(&cgSendPSPool[0], 0, sizeof(cgSendPSPool));
00889
00890 for ( i = 0 ; i < MAX_GENTITIES ; i++ )
00891 {
00892 #ifdef _XBOX
00893 cgSendPS[i] = NULL;
00894 #else
00895 cgSendPS[i] = &cgSendPSPool[i];
00896 #endif
00897
00898 // These will be invalid at this point on Xbox
00899 cg_entities[i].playerState = cgSendPS[i];
00900 }
00901
00902 #ifdef _XBOX
00903 for ( i = 0; i < CG_SEND_PS_POOL_SIZE - 1; i++ )
00904 {
00905 cgSendPSPool[i].next = &cgSendPSPool[i+1];
00906 }
00907
00908 // Last .next is already NULL from memset above
00909 cgSendPSFreeList = &cgSendPSPool[0];
00910 #endif
00911
00912 //Set up bg entity data
00913 cg_pmove.baseEnt = (bgEntity_t *)cg_entities;
00914 cg_pmove.entSize = sizeof(centity_t);
00915
00916 cg_pmove.ghoul2 = NULL;
00917 }
|
|
|
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 }
|
|
|
|
||||||||||||
|
Definition at line 1209 of file cg_main.c. References QDECL, trap_Print(), va_end, va_list, va_start, and vsprintf(). Referenced by CG_BloodPool(), CG_CheckChangedPredictableEvents(), CG_DrawActiveFrame(), CG_EntityEvent(), CG_OilSlickRemove(), CG_Particle_Bleed(), CG_Particle_OilParticle(), CG_Particle_OilSlick(), CG_ParticleBubble(), CG_ParticleImpactSmokePuff(), CG_ParticleMisc(), CG_ParticleSmoke(), CG_ParticleSnow(), CG_ParticleSnowFlurry(), CG_PredictPlayerState(), CG_ResetPlayerEntity(), CG_TestModel_f(), CG_TestModelNextFrame_f(), CG_TestModelNextSkin_f(), CG_TestModelPrevFrame_f(), CG_TestModelPrevSkin_f(), and Com_Printf().
01209 {
01210 va_list argptr;
01211 char text[1024];
01212
01213 va_start (argptr, msg);
01214 vsprintf (text, msg, argptr);
01215 va_end (argptr);
01216
01217 trap_Print( text );
01218 }
|
|
|
Definition at line 1062 of file cg_main.c. References atoi(), cg_forceModel, cgs, CVAR_ARCHIVE, CVAR_INTERNAL, CVAR_ROM, CVAR_USERINFO, DEFAULT_FORCEPOWERS, DEFAULT_MODEL, forceModelModificationCount, cgs_t::localServer, MAX_TOKEN_CHARS, vmCvar_t::modificationCount, NULL, trap_Cvar_Register(), and trap_Cvar_VariableStringBuffer(). Referenced by CG_Init().
01062 {
01063 int i;
01064 cvarTable_t *cv;
01065 char var[MAX_TOKEN_CHARS];
01066
01067 for ( i = 0, cv = cvarTable ; i < cvarTableSize ; i++, cv++ ) {
01068 trap_Cvar_Register( cv->vmCvar, cv->cvarName,
01069 cv->defaultString, cv->cvarFlags );
01070 }
01071
01072 // see if we are also running the server on this machine
01073 trap_Cvar_VariableStringBuffer( "sv_running", var, sizeof( var ) );
01074 cgs.localServer = atoi( var );
01075
01076 forceModelModificationCount = cg_forceModel.modificationCount;
01077
01078 trap_Cvar_Register(NULL, "model", DEFAULT_MODEL, CVAR_USERINFO | CVAR_ARCHIVE );
01079 trap_Cvar_Register(NULL, "forcepowers", DEFAULT_FORCEPOWERS, CVAR_USERINFO | CVAR_ARCHIVE );
01080
01081 // Cvars uses for transferring data between client and server
01082 trap_Cvar_Register(NULL, "ui_about_gametype", "0", CVAR_ROM|CVAR_INTERNAL );
01083 trap_Cvar_Register(NULL, "ui_about_fraglimit", "0", CVAR_ROM|CVAR_INTERNAL );
01084 trap_Cvar_Register(NULL, "ui_about_capturelimit", "0", CVAR_ROM|CVAR_INTERNAL );
01085 trap_Cvar_Register(NULL, "ui_about_duellimit", "0", CVAR_ROM|CVAR_INTERNAL );
01086 trap_Cvar_Register(NULL, "ui_about_timelimit", "0", CVAR_ROM|CVAR_INTERNAL );
01087 trap_Cvar_Register(NULL, "ui_about_maxclients", "0", CVAR_ROM|CVAR_INTERNAL );
01088 trap_Cvar_Register(NULL, "ui_about_dmflags", "0", CVAR_ROM|CVAR_INTERNAL );
01089 trap_Cvar_Register(NULL, "ui_about_mapname", "0", CVAR_ROM|CVAR_INTERNAL );
01090 trap_Cvar_Register(NULL, "ui_about_hostname", "0", CVAR_ROM|CVAR_INTERNAL );
01091 trap_Cvar_Register(NULL, "ui_about_needpass", "0", CVAR_ROM|CVAR_INTERNAL );
01092 trap_Cvar_Register(NULL, "ui_about_botminplayers", "0", CVAR_ROM|CVAR_INTERNAL );
01093
01094 trap_Cvar_Register(NULL, "ui_tm1_cnt", "0", CVAR_ROM | CVAR_INTERNAL );
01095 trap_Cvar_Register(NULL, "ui_tm2_cnt", "0", CVAR_ROM | CVAR_INTERNAL );
01096 trap_Cvar_Register(NULL, "ui_tm3_cnt", "0", CVAR_ROM | CVAR_INTERNAL );
01097
01098 trap_Cvar_Register(NULL, "ui_tm1_c0_cnt", "0", CVAR_ROM | CVAR_INTERNAL );
01099 trap_Cvar_Register(NULL, "ui_tm1_c1_cnt", "0", CVAR_ROM | CVAR_INTERNAL );
01100 trap_Cvar_Register(NULL, "ui_tm1_c2_cnt", "0", CVAR_ROM | CVAR_INTERNAL );
01101 trap_Cvar_Register(NULL, "ui_tm1_c3_cnt", "0", CVAR_ROM | CVAR_INTERNAL );
01102 trap_Cvar_Register(NULL, "ui_tm1_c4_cnt", "0", CVAR_ROM | CVAR_INTERNAL );
01103 trap_Cvar_Register(NULL, "ui_tm1_c5_cnt", "0", CVAR_ROM | CVAR_INTERNAL );
01104
01105 trap_Cvar_Register(NULL, "ui_tm2_c0_cnt", "0", CVAR_ROM | CVAR_INTERNAL );
01106 trap_Cvar_Register(NULL, "ui_tm2_c1_cnt", "0", CVAR_ROM | CVAR_INTERNAL );
01107 trap_Cvar_Register(NULL, "ui_tm2_c2_cnt", "0", CVAR_ROM | CVAR_INTERNAL );
01108 trap_Cvar_Register(NULL, "ui_tm2_c3_cnt", "0", CVAR_ROM | CVAR_INTERNAL );
01109 trap_Cvar_Register(NULL, "ui_tm2_c4_cnt", "0", CVAR_ROM | CVAR_INTERNAL );
01110 trap_Cvar_Register(NULL, "ui_tm2_c5_cnt", "0", CVAR_ROM | CVAR_INTERNAL );
01111
01112 }
|
|
||||||||||||
|
Definition at line 3539 of file cg_ents.c. References AngleVectors(), atof(), centity_t, CHAN_BODY, Com_Printf(), Com_sprintf(), centity_s::currentState, centity_s::lerpAngles, centity_s::lerpOrigin, entityState_s::number, strcmp(), trap_FX_PlayEffectID(), trap_FX_RegisterEffect(), trap_S_RegisterSound(), trap_S_StartSound(), vec3_t, VectorClear, and VectorCopy. Referenced by vmMain().
03540 {
03541 int i = 0, r = 0, objectID = 0, anglesGathered = 0, posoffsetGathered = 0;
03542 char type[256];
03543 char argument[512];
03544 char addlArg[512];
03545 char errMsg[256];
03546 char t[64];
03547 int addlArgs = 0;
03548 vec3_t parsedAngles, parsedOffset, useAngles, useOrigin, forward, right, up;
03549
03550 if (!cent || !notetrack)
03551 {
03552 return;
03553 }
03554
03555 //notetrack = "effect effects/explosion1.efx 0+0+64 0-0-1";
03556
03557 while (notetrack[i] && notetrack[i] != ' ')
03558 {
03559 type[i] = notetrack[i];
03560 i++;
03561 }
03562
03563 type[i] = '\0';
03564
03565 if (notetrack[i] != ' ')
03566 { //didn't pass in a valid notetrack type, or forgot the argument for it
03567 return;
03568 }
03569
03570 i++;
03571
03572 while (notetrack[i] && notetrack[i] != ' ')
03573 {
03574 argument[r] = notetrack[i];
03575 r++;
03576 i++;
03577 }
03578 argument[r] = '\0';
03579
03580 if (!r)
03581 {
03582 return;
03583 }
03584
03585 if (notetrack[i] == ' ')
03586 { //additional arguments...
03587 addlArgs = 1;
03588
03589 i++;
03590 r = 0;
03591 while (notetrack[i])
03592 {
03593 addlArg[r] = notetrack[i];
03594 r++;
03595 i++;
03596 }
03597 addlArg[r] = '\0';
03598 }
03599
03600 if (strcmp(type, "effect") == 0)
03601 {
03602 if (!addlArgs)
03603 {
03604 //sprintf(errMsg, "Offset position argument for 'effect' type is invalid.");
03605 //goto functionend;
03606 VectorClear(parsedOffset);
03607 goto defaultoffsetposition;
03608 }
03609
03610 i = 0;
03611
03612 while (posoffsetGathered < 3)
03613 {
03614 r = 0;
03615 while (addlArg[i] && addlArg[i] != '+' && addlArg[i] != ' ')
03616 {
03617 t[r] = addlArg[i];
03618 r++;
03619 i++;
03620 }
03621 t[r] = '\0';
03622 i++;
03623 if (!r)
03624 { //failure..
03625 //sprintf(errMsg, "Offset position argument for 'effect' type is invalid.");
03626 //goto functionend;
03627 VectorClear(parsedOffset);
03628 i = 0;
03629 goto defaultoffsetposition;
03630 }
03631 parsedOffset[posoffsetGathered] = atof(t);
03632 posoffsetGathered++;
03633 }
03634
03635 if (posoffsetGathered < 3)
03636 {
03637 Com_sprintf(errMsg, sizeof(errMsg), "Offset position argument for 'effect' type is invalid.");
03638 goto functionend;
03639 }
03640
03641 i--;
03642
03643 if (addlArg[i] != ' ')
03644 {
03645 addlArgs = 0;
03646 }
03647
03648 defaultoffsetposition:
03649
03650 objectID = trap_FX_RegisterEffect(argument);
03651
03652 if (objectID)
03653 {
03654 if (addlArgs)
03655 { //if there is an additional argument for an effect it is expected to be XANGLE-YANGLE-ZANGLE
03656 i++;
03657 while (anglesGathered < 3)
03658 {
03659 r = 0;
03660 while (addlArg[i] && addlArg[i] != '-')
03661 {
03662 t[r] = addlArg[i];
03663 r++;
03664 i++;
03665 }
03666 t[r] = '\0';
03667 i++;
03668
03669 if (!r)
03670 { //failed to get a new part of the vector
03671 anglesGathered = 0;
03672 break;
03673 }
03674
03675 parsedAngles[anglesGathered] = atof(t);
03676 anglesGathered++;
03677 }
03678
03679 if (anglesGathered)
03680 {
03681 VectorCopy(parsedAngles, useAngles);
03682 }
03683 else
03684 { //failed to parse angles from the extra argument provided..
03685 VectorCopy(cent->lerpAngles, useAngles);
03686 }
03687 }
03688 else
03689 { //if no constant angles, play in direction entity is facing
03690 VectorCopy(cent->lerpAngles, useAngles);
03691 }
03692
03693 AngleVectors(useAngles, forward, right, up);
03694
03695 VectorCopy(cent->lerpOrigin, useOrigin);
03696
03697 //forward
03698 useOrigin[0] += forward[0]*parsedOffset[0];
03699 useOrigin[1] += forward[1]*parsedOffset[0];
03700 useOrigin[2] += forward[2]*parsedOffset[0];
03701
03702 //right
03703 useOrigin[0] += right[0]*parsedOffset[1];
03704 useOrigin[1] += right[1]*parsedOffset[1];
03705 useOrigin[2] += right[2]*parsedOffset[1];
03706
03707 //up
03708 useOrigin[0] += up[0]*parsedOffset[2];
03709 useOrigin[1] += up[1]*parsedOffset[2];
03710 useOrigin[2] += up[2]*parsedOffset[2];
03711
03712 trap_FX_PlayEffectID(objectID, useOrigin, useAngles, -1, -1);
03713 }
03714 }
03715 else if (strcmp(type, "sound") == 0)
03716 {
03717 objectID = trap_S_RegisterSound(argument);
03718 trap_S_StartSound(cent->lerpOrigin, cent->currentState.number, CHAN_BODY, objectID);
03719 }
03720 else if (strcmp(type, "loop") == 0)
03721 { //handled server-side
03722 return;
03723 }
03724 //else if ...
03725 else
03726 {
03727 if (type[0])
03728 {
03729 Com_Printf("^3Warning: \"%s\" is an invalid ROFF notetrack function\n", type);
03730 }
03731 else
03732 {
03733 Com_Printf("^3Warning: Notetrack is missing function and/or arguments\n");
03734 }
03735 }
03736
03737 return;
03738
03739 functionend:
03740 Com_Printf("^3Type-specific notetrack error: %s\n", errMsg);
03741 return;
03742 }
|
|
|
Definition at line 2856 of file cg_main.c. References cg, cgs, score_t::client, playerState_s::clientNum, FEEDER_BLUETEAM_LIST, FEEDER_REDTEAM_LIST, FEEDER_SCOREBOARD, cgs_t::gametype, GT_TEAM, Menu_SetFeederSelection(), NULL, cg_t::numScores, playerState_t, snapshot_t::ps, cg_t::scores, cg_t::selectedScore, cg_t::snap, score_t::team, TEAM_BLUE, and TEAM_RED.
02856 {
02857 menuDef_t *menu = (menuDef_t*)p;
02858 playerState_t *ps = &cg.snap->ps;
02859 int i, red, blue;
02860 red = blue = 0;
02861 for (i = 0; i < cg.numScores; i++) {
02862 if (cg.scores[i].team == TEAM_RED) {
02863 red++;
02864 } else if (cg.scores[i].team == TEAM_BLUE) {
02865 blue++;
02866 }
02867 if (ps->clientNum == cg.scores[i].client) {
02868 cg.selectedScore = i;
02869 }
02870 }
02871
02872 if (menu == NULL) {
02873 // just interested in setting the selected score
02874 return;
02875 }
02876
02877 if ( cgs.gametype >= GT_TEAM ) {
02878 int feeder = FEEDER_REDTEAM_LIST;
02879 i = red;
02880 if (cg.scores[cg.selectedScore].team == TEAM_BLUE) {
02881 feeder = FEEDER_BLUETEAM_LIST;
02882 i = blue;
02883 }
02884 Menu_SetFeederSelection(menu, feeder, i, NULL);
02885 } else {
02886 Menu_SetFeederSelection(menu, FEEDER_SCOREBOARD, cg.selectedScore, NULL);
02887 }
02888 }
|
|
|
Definition at line 3993 of file cg_main.c. References BG_ClearAnimsets(), CG_DestroyAllGhoul2(), cgWeatherOverride, trap_FX_FreeSystem(), trap_R_WeatherContentsOverride(), trap_R_WorldEffectCommand(), trap_ROFF_Clean(), and UI_CleanupGhoul2(). Referenced by vmMain().
03994 {
03995 BG_ClearAnimsets(); //free all dynamic allocations made through the engine
03996
03997 CG_DestroyAllGhoul2();
03998
03999 // Com_Printf("... FX System Cleanup\n");
04000 trap_FX_FreeSystem();
04001 trap_ROFF_Clean();
04002
04003 if (cgWeatherOverride)
04004 {
04005 trap_R_WeatherContentsOverride(0); //rwwRMG - reset it engine-side
04006 }
04007
04008 //reset weather
04009 trap_R_WorldEffectCommand("die");
04010
04011 UI_CleanupGhoul2();
04012 //If there was any ghoul2 stuff in our side of the shared ui code, then remove it now.
04013
04014 // some mods may need to do cleanup work here,
04015 // like closing files or archiving session data
04016 }
|
|
|
Definition at line 2442 of file cg_main.c. References CG_GetClassCount(), CG_GetTeamNonScoreCount(), TEAM_BLUE, TEAM_RED, TEAM_SPECTATOR, trap_Cvar_Set(), trap_R_RegisterShaderNoMip(), and va(). Referenced by CG_BuildSpectatorString().
02443 {
02444 int classGfx[6];
02445
02446 trap_Cvar_Set( "ui_tm1_cnt",va("%d",CG_GetTeamNonScoreCount(TEAM_RED )));
02447 trap_Cvar_Set( "ui_tm2_cnt",va("%d",CG_GetTeamNonScoreCount(TEAM_BLUE )));
02448 trap_Cvar_Set( "ui_tm3_cnt",va("%d",CG_GetTeamNonScoreCount(TEAM_SPECTATOR )));
02449
02450 // This is because the only way we can match up classes is by the gfx handle.
02451 classGfx[0] = trap_R_RegisterShaderNoMip("gfx/mp/c_icon_infantry");
02452 classGfx[1] = trap_R_RegisterShaderNoMip("gfx/mp/c_icon_heavy_weapons");
02453 classGfx[2] = trap_R_RegisterShaderNoMip("gfx/mp/c_icon_demolitionist");
02454 classGfx[3] = trap_R_RegisterShaderNoMip("gfx/mp/c_icon_vanguard");
02455 classGfx[4] = trap_R_RegisterShaderNoMip("gfx/mp/c_icon_support");
02456 classGfx[5] = trap_R_RegisterShaderNoMip("gfx/mp/c_icon_jedi_general");
02457
02458 trap_Cvar_Set( "ui_tm1_c0_cnt",va("%d",CG_GetClassCount(TEAM_RED,classGfx[0])));
02459 trap_Cvar_Set( "ui_tm1_c1_cnt",va("%d",CG_GetClassCount(TEAM_RED,classGfx[1])));
02460 trap_Cvar_Set( "ui_tm1_c2_cnt",va("%d",CG_GetClassCount(TEAM_RED,classGfx[2])));
02461 trap_Cvar_Set( "ui_tm1_c3_cnt",va("%d",CG_GetClassCount(TEAM_RED,classGfx[3])));
02462 trap_Cvar_Set( "ui_tm1_c4_cnt",va("%d",CG_GetClassCount(TEAM_RED,classGfx[4])));
02463 trap_Cvar_Set( "ui_tm1_c5_cnt",va("%d",CG_GetClassCount(TEAM_RED,classGfx[5])));
02464
02465 trap_Cvar_Set( "ui_tm2_c0_cnt",va("%d",CG_GetClassCount(TEAM_BLUE,classGfx[0])));
02466 trap_Cvar_Set( "ui_tm2_c1_cnt",va("%d",CG_GetClassCount(TEAM_BLUE,classGfx[1])));
02467 trap_Cvar_Set( "ui_tm2_c2_cnt",va("%d",CG_GetClassCount(TEAM_BLUE,classGfx[2])));
02468 trap_Cvar_Set( "ui_tm2_c3_cnt",va("%d",CG_GetClassCount(TEAM_BLUE,classGfx[3])));
02469 trap_Cvar_Set( "ui_tm2_c4_cnt",va("%d",CG_GetClassCount(TEAM_BLUE,classGfx[4])));
02470 trap_Cvar_Set( "ui_tm2_c5_cnt",va("%d",CG_GetClassCount(TEAM_BLUE,classGfx[5])));
02471
02472 }
|
|
|
Definition at line 3608 of file cg_main.c. References BG_ParseField(), byte, CG_CreateModelFromSpawnEnt(), CG_CreateSkyOriFromSpawnEnt(), CG_CreateSkyPortalFromSpawnEnt(), CG_CreateWeatherZoneFromSpawnEnt(), cg_linearFogOverride, cg_radarRange, cg_spawnFields, CG_StrPool_Reset(), cgSpawnEnt_t, cgSpawnEnt_s::classname, cgSpawnEnt_s::fogstart, memset(), Q_stricmp(), and cgSpawnEnt_s::radarrange. Referenced by CG_SpawnCGameOnlyEnts().
03609 {
03610 int i;
03611 cgSpawnEnt_t ent;
03612
03613 memset(&ent, 0, sizeof(cgSpawnEnt_t));
03614
03615 for (i = 0; i < cg_numSpawnVars; i++)
03616 { //shove all this stuff into our data structure used specifically for getting spawn info
03617 BG_ParseField( cg_spawnFields, cg_spawnVars[i][0], cg_spawnVars[i][1], (byte *)&ent );
03618 }
03619
03620 if (ent.classname && ent.classname[0])
03621 { //we'll just stricmp this bastard, since there aren't all that many cgame-only things, and they all have special handling
03622 if (!Q_stricmp(ent.classname, "worldspawn"))
03623 { //I'd like some info off this guy
03624 if (ent.fogstart)
03625 { //linear fog method
03626 cg_linearFogOverride = ent.fogstart;
03627 }
03628 //get radarRange off of worldspawn
03629 if (ent.radarrange)
03630 { //linear fog method
03631 cg_radarRange = ent.radarrange;
03632 }
03633 }
03634 else if (!Q_stricmp(ent.classname, "misc_model_static"))
03635 { //we've got us a static model
03636 CG_CreateModelFromSpawnEnt(&ent);
03637 }
03638 else if (!Q_stricmp(ent.classname, "misc_skyportal_orient"))
03639 { //a sky portal orientation point
03640 CG_CreateSkyOriFromSpawnEnt(&ent);
03641 }
03642 else if (!Q_stricmp(ent.classname, "misc_skyportal"))
03643 { //might as well parse this thing cgame side for the extra info I want out of it
03644 CG_CreateSkyPortalFromSpawnEnt(&ent);
03645 }
03646 else if (!Q_stricmp(ent.classname, "misc_weather_zone"))
03647 { //might as well parse this thing cgame side for the extra info I want out of it
03648 CG_CreateWeatherZoneFromSpawnEnt(&ent);
03649 }
03650 }
03651
03652 //reset the string pool for the next entity, if there is one
03653 CG_StrPool_Reset();
03654 }
|
|
|
Definition at line 3664 of file cg_main.c. References CG_Error(), CG_ParseSpawnVars(), CG_SpawnCGameEntFromVars(), NULL, and trap_GetEntityToken(). Referenced by CG_Init().
03665 {
03666 //make sure it is reset
03667 trap_GetEntityToken(NULL, -1);
03668
03669 if (!CG_ParseSpawnVars())
03670 { //first one is gonna be the world spawn
03671 CG_Error("no entities for cgame parse");
03672 }
03673 else
03674 { //parse the world spawn info we want
03675 CG_SpawnCGameEntFromVars();
03676 }
03677
03678 while(CG_ParseSpawnVars())
03679 { //now run through the whole list, and look for things we care about cgame-side
03680 CG_SpawnCGameEntFromVars();
03681 }
03682 }
|
|
|
Definition at line 2550 of file cg_main.c. References CG_ConfigString(), COM_Parse(), CS_MUSIC, MAX_QPATH, Q_strncpyz(), and trap_S_StartBackgroundTrack(). Referenced by CG_EntityEvent(), and CG_Init().
02550 {
02551 char *s;
02552 char parm1[MAX_QPATH], parm2[MAX_QPATH];
02553
02554 // start the background music
02555 s = (char *)CG_ConfigString( CS_MUSIC );
02556 Q_strncpyz( parm1, COM_Parse( (const char **)&s ), sizeof( parm1 ) );
02557 Q_strncpyz( parm2, COM_Parse( (const char **)&s ), sizeof( parm2 ) );
02558
02559 trap_S_StartBackgroundTrack( parm1, parm2, !bForceStart );
02560 }
|
|
|
Definition at line 3313 of file cg_main.c. References Com_Error(), ERR_DROP, MAX_CGSTRPOOL_SIZE, and memset(). Referenced by CG_NewString().
03314 {
03315 char *giveThemThis;
03316
03317 if (cg_strPoolSize+size >= MAX_CGSTRPOOL_SIZE)
03318 {
03319 Com_Error(ERR_DROP, "You exceeded the cgame string pool size. Bad programmer!\n");
03320 }
03321
03322 giveThemThis = (char *) &cg_strPool[cg_strPoolSize];
03323 cg_strPoolSize += size;
03324
03325 //memset it for them, just to be nice.
03326 memset(giveThemThis, 0, size);
03327
03328 return giveThemThis;
03329 }
|
|
|
Definition at line 3331 of file cg_main.c. Referenced by CG_SpawnCGameEntFromVars().
03332 {
03333 cg_strPoolSize = 0;
03334 }
|
|
||||||||||||||||||||||||||||||||||||||||||||
|
Definition at line 3027 of file cg_main.c. References CG_Text_Paint(), and vec4_t. Referenced by CG_LoadHudMenu().
03027 {
03028 CG_Text_Paint(x, y, scale, color, text, 0, limit, style, iMenuFont);
03029 }
|
|
|
Definition at line 3286 of file cg_main.c. References entityState_s::angles, centity_t, cg_entities, cg_numpermanents, cg_permanents, centity_s::currentState, centity_s::currentValid, centity_s::lerpAngles, centity_s::lerpOrigin, MAX_GENTITIES, centity_s::nextState, entityState_s::origin, qtrue, trap_GetDefaultState(), and VectorCopy. Referenced by CG_Init().
03287 {
03288 centity_t *cent = cg_entities;
03289 int i;
03290
03291 cg_numpermanents = 0;
03292 for(i=0;i<MAX_GENTITIES;i++,cent++)
03293 {
03294 if (trap_GetDefaultState(i, ¢->currentState))
03295 {
03296 cent->nextState = cent->currentState;
03297 VectorCopy (cent->currentState.origin, cent->lerpOrigin);
03298 VectorCopy (cent->currentState.angles, cent->lerpAngles);
03299 cent->currentValid = qtrue;
03300
03301 cg_permanents[cg_numpermanents++] = cent;
03302 }
03303 }
03304 }
|
|
|
Definition at line 1157 of file cg_main.c. References cg_drawTeamOverlay, cg_forceModel, forceModelModificationCount, vmCvar_t::integer, vmCvar_t::modificationCount, trap_Cvar_Set(), and trap_Cvar_Update(). Referenced by CG_DrawActiveFrame().
01157 {
01158 int i;
01159 cvarTable_t *cv;
01160 static int drawTeamOverlayModificationCount = -1;
01161
01162 for ( i = 0, cv = cvarTable ; i < cvarTableSize ; i++, cv++ ) {
01163 trap_Cvar_Update( cv->vmCvar );
01164 }
01165
01166 // check for modications here
01167
01168 // If team overlay is on, ask for updates from the server. If its off,
01169 // let the server know so we don't receive it
01170 if ( drawTeamOverlayModificationCount != cg_drawTeamOverlay.modificationCount ) {
01171 drawTeamOverlayModificationCount = cg_drawTeamOverlay.modificationCount;
01172
01173 if ( cg_drawTeamOverlay.integer > 0 ) {
01174 trap_Cvar_Set( "teamoverlay", "1" );
01175 } else {
01176 trap_Cvar_Set( "teamoverlay", "0" );
01177 }
01178 // FIXME E3 HACK
01179 trap_Cvar_Set( "teamoverlay", "1" );
01180 }
01181
01182 // if force model changed
01183 if ( forceModelModificationCount != cg_forceModel.modificationCount ) {
01184 forceModelModificationCount = cg_forceModel.modificationCount;
01185 CG_ForceModelChange();
01186 }
01187 }
|
|
||||||||||||||||
|
Definition at line 1234 of file cg_main.c. Referenced by _UI_Init(), and CG_LoadHudMenu().
|
|
||||||||||||
|
Definition at line 1245 of file cg_main.c. Referenced by _UI_Init(), and CG_LoadHudMenu().
|
|
|
Definition at line 7539 of file ui_shared.c. Referenced by _UI_Shutdown(), and CG_Shutdown().
07540 {
07541 uiG2PtrTracker_t *next = ui_G2PtrTracker;
07542
07543 while (next)
07544 {
07545 if (next->ghoul2 && trap_G2_HaveWeGhoul2Models(next->ghoul2))
07546 { //found a g2 instance, clean it.
07547 trap_G2API_CleanGhoul2Models(&next->ghoul2);
07548 }
07549
07550 next = next->next;
07551 }
07552
07553 #ifdef _XBOX
07554 ui_G2PtrTracker = NULL;
07555 #endif
07556 }
|
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Definition at line 190 of file cg_main.c. References entityState_s::apos, cg, CG_AUTOMAP_INPUT, cg_autoMapAngle, cg_autoMapInput, cg_autoMapInputTime, CG_CALC_LERP_POSITIONS, CG_CalcEntityLerpPositions(), CG_CONSOLE_COMMAND, CG_ConsoleCommand(), CG_CROSSHAIR_PLAYER, CG_CrosshairPlayer(), CG_DoCameraShake(), CG_DRAW_ACTIVE_FRAME, CG_DrawActiveFrame(), cg_entities, CG_Error(), CG_EVENT_HANDLING, CG_EventHandling(), CG_FX_CAMERASHAKE, CG_G2MARK, CG_G2TRACE, CG_GET_ANGLE_TRAJECTORY, CG_GET_ANGLES, CG_GET_GHOUL2, CG_GET_LERP_DATA, CG_GET_LERP_ORIGIN, CG_GET_MODEL_LIST, CG_GET_ORIGIN, CG_GET_ORIGIN_TRAJECTORY, CG_GET_SORTED_FORCE_POWER, CG_GET_USEABLE_FORCE, CG_IMPACT_MARK, CG_INCOMING_CONSOLE_COMMAND, CG_Init(), CG_INIT, CG_KEY_EVENT, CG_KeyEvent(), CG_LAST_ATTACKER, CG_LastAttacker(), CG_MAP_CHANGE, CG_MISC_ENT, CG_MiscEnt(), CG_MOUSE_EVENT, CG_MouseEvent(), CG_NoUseableForce(), CG_POINT_CONTENTS, CG_RAG_CALLBACK, CG_ROFF_NOTETRACK_CALLBACK, CG_ROFF_NotetrackCallback(), CG_Shutdown(), CG_SHUTDOWN, CG_TRACE, cgDC, cgs, Com_Printf(), TCGIncomingConsoleCommand::conCommand, cgs_t::cursorX, displayContextDef_t::cursorx, cgs_t::cursorY, displayContextDef_t::cursory, forcePowerSorted, cgs_t::gameModels, centity_s::ghoul2, memcpy(), TCGCameraShake::mIntensity, cg_t::mMapChange, TCGCameraShake::mOrigin, TCGCameraShake::mRadius, TCGCameraShake::mTime, centity_s::nextState, PITCH, autoMapInput_t::pitch, entityState_s::pos, qtrue, cg_t::sharedBuffer, strcpy(), strstr(), cg_t::time, VectorCopy, YAW, and autoMapInput_t::yaw.
00190 {
00191
00192 switch ( command ) {
00193 case CG_INIT:
00194 CG_Init( arg0, arg1, arg2 );
00195 return 0;
00196 case CG_SHUTDOWN:
00197 CG_Shutdown();
00198 return 0;
00199 case CG_CONSOLE_COMMAND:
00200 return CG_ConsoleCommand();
00201 case CG_DRAW_ACTIVE_FRAME:
00202 CG_DrawActiveFrame( arg0, arg1, arg2 );
00203 return 0;
00204 case CG_CROSSHAIR_PLAYER:
00205 return CG_CrosshairPlayer();
00206 case CG_LAST_ATTACKER:
00207 return CG_LastAttacker();
00208 case CG_KEY_EVENT:
00209 CG_KeyEvent(arg0, arg1);
00210 return 0;
00211 case CG_MOUSE_EVENT:
00212 cgDC.cursorx = cgs.cursorX;
00213 cgDC.cursory = cgs.cursorY;
00214 CG_MouseEvent(arg0, arg1);
00215 return 0;
00216 case CG_EVENT_HANDLING:
00217 CG_EventHandling(arg0);
00218 return 0;
00219
00220 case CG_POINT_CONTENTS:
00221 return C_PointContents();
00222
00223 case CG_GET_LERP_ORIGIN:
00224 C_GetLerpOrigin();
00225 return 0;
00226
00227 case CG_GET_LERP_DATA:
00228 C_GetLerpData();
00229 return 0;
00230
00231 case CG_GET_GHOUL2:
00232 return (int)cg_entities[arg0].ghoul2; //NOTE: This is used by the effect bolting which is actually not used at all.
00233 //I'm fairly sure if you try to use it with vm's it will just give you total
00234 //garbage. In other words, use at your own risk.
00235
00236 case CG_GET_MODEL_LIST:
00237 return (int)cgs.gameModels;
00238
00239 case CG_CALC_LERP_POSITIONS:
00240 CG_CalcEntityLerpPositions( &cg_entities[arg0] );
00241 return 0;
00242
00243 case CG_TRACE:
00244 C_Trace();
00245 return 0;
00246 case CG_GET_SORTED_FORCE_POWER:
00247 return forcePowerSorted[arg0];
00248 case CG_G2TRACE:
00249 C_G2Trace();
00250 return 0;
00251
00252 case CG_G2MARK:
00253 C_G2Mark();
00254 return 0;
00255
00256 case CG_RAG_CALLBACK:
00257 return CG_RagCallback(arg0);
00258
00259 case CG_INCOMING_CONSOLE_COMMAND:
00260 //rww - let mod authors filter client console messages so they can cut them off if they want.
00261 //return 1 if the command is ok. Otherwise, you can set char 0 on the command str to 0 and return
00262 //0 to not execute anything, or you can fill conCommand in with something valid and return 0
00263 //in order to have that string executed in place. Some example code:
00264 #if 0
00265 {
00266 TCGIncomingConsoleCommand *icc = (TCGIncomingConsoleCommand *)cg.sharedBuffer;
00267 if (strstr(icc->conCommand, "wait"))
00268 { //filter out commands contaning wait
00269 Com_Printf("You can't use commands containing the string wait with MyMod v1.0\n");
00270 icc->conCommand[0] = 0;
00271 return 0;
00272 }
00273 else if (strstr(icc->conCommand, "blah"))
00274 { //any command containing the string "blah" is redirected to "quit"
00275 strcpy(icc->conCommand, "quit");
00276 return 0;
00277 }
00278 }
00279 #endif
00280 return 1;
00281
00282 case CG_GET_USEABLE_FORCE:
00283 return CG_NoUseableForce();
00284
00285 case CG_GET_ORIGIN:
00286 VectorCopy(cg_entities[arg0].currentState.pos.trBase, (float *)arg1);
00287 return 0;
00288
00289 case CG_GET_ANGLES:
00290 VectorCopy(cg_entities[arg0].currentState.apos.trBase, (float *)arg1);
00291 return 0;
00292
00293 case CG_GET_ORIGIN_TRAJECTORY:
00294 return (int)&cg_entities[arg0].nextState.pos;
00295
00296 case CG_GET_ANGLE_TRAJECTORY:
00297 return (int)&cg_entities[arg0].nextState.apos;
00298
00299 case CG_ROFF_NOTETRACK_CALLBACK:
00300 CG_ROFF_NotetrackCallback( &cg_entities[arg0], (const char *)arg1 );
00301 return 0;
00302
00303 case CG_IMPACT_MARK:
00304 C_ImpactMark();
00305 return 0;
00306
00307 case CG_MAP_CHANGE:
00308 // this trap map be called more than once for a given map change, as the
00309 // server is going to attempt to send out multiple broadcasts in hopes that
00310 // the client will receive one of them
00311 cg.mMapChange = qtrue;
00312 return 0;
00313
00314 case CG_AUTOMAP_INPUT:
00315 //special input during automap mode -rww
00316 {
00317 autoMapInput_t *autoInput = (autoMapInput_t *)cg.sharedBuffer;
00318
00319 memcpy(&cg_autoMapInput, autoInput, sizeof(autoMapInput_t));
00320
00321 if (!arg0)
00322 { //if this is non-0, it's actually a one-frame mouse event
00323 cg_autoMapInputTime = cg.time + 1000;
00324 }
00325 else
00326 {
00327 if (cg_autoMapInput.yaw)
00328 {
00329 cg_autoMapAngle[YAW] += cg_autoMapInput.yaw;
00330 }
00331
00332 if (cg_autoMapInput.pitch)
00333 {
00334 cg_autoMapAngle[PITCH] += cg_autoMapInput.pitch;
00335 }
00336 cg_autoMapInput.yaw = 0.0f;
00337 cg_autoMapInput.pitch = 0.0f;
00338 }
00339 }
00340 return 0;
00341
00342 case CG_MISC_ENT:
00343 CG_MiscEnt();
00344 return 0;
00345
00346 case CG_FX_CAMERASHAKE:
00347 {
00348 TCGCameraShake *data = (TCGCameraShake *)cg.sharedBuffer;
00349
00350 CG_DoCameraShake( data->mOrigin, data->mIntensity, data->mRadius, data->mTime );
00351 }
00352 return 0;
00353
00354 default:
00355 CG_Error( "vmMain: unknown command %i", command );
00356 break;
00357 }
00358 return -1;
00359 }
|
|
|
Definition at line 2738 of file bg_saberLoad.c. Referenced by CG_Init(), and G_InitGame().
02739 {
02740 int len, totallen, saberExtFNLen, mainBlockLen, fileCnt, i;
02741 //const char *filename = "ext_data/sabers.cfg";
02742 char *holdChar, *marker;
02743 char saberExtensionListBuf[2048]; // The list of file names read in
02744 fileHandle_t f;
02745
02746 len = 0;
02747
02748 //remember where to store the next one
02749 totallen = mainBlockLen = len;
02750 marker = SaberParms+totallen;
02751 *marker = 0;
02752
02753 //now load in the extra .sab extensions
02754 fileCnt = trap_FS_GetFileList("ext_data/sabers", ".sab", saberExtensionListBuf, sizeof(saberExtensionListBuf) );
02755
02756 holdChar = saberExtensionListBuf;
02757 for ( i = 0; i < fileCnt; i++, holdChar += saberExtFNLen + 1 )
02758 {
02759 saberExtFNLen = strlen( holdChar );
02760
02761 len = trap_FS_FOpenFile(va( "ext_data/sabers/%s", holdChar), &f, FS_READ);
02762
02763 if ( len == -1 )
02764 {
02765 Com_Printf( "error reading file\n" );
02766 }
02767 else
02768 {
02769 if ( (totallen + len + 1/*for the endline*/) >= MAX_SABER_DATA_SIZE ) {
02770 Com_Error(ERR_DROP, "Saber extensions (*.sab) are too large" );
02771 }
02772
02773 trap_FS_Read(bgSaberParseTBuffer, len, f);
02774 bgSaberParseTBuffer[len] = 0;
02775
02776 len = COM_Compress( bgSaberParseTBuffer );
02777
02778 Q_strcat( marker, MAX_SABER_DATA_SIZE-totallen, bgSaberParseTBuffer );
02779 trap_FS_FCloseFile(f);
02780
02781 //get around the stupid problem of not having an endline at the bottom
02782 //of a sab file -rww
02783 Q_strcat(marker, MAX_SABER_DATA_SIZE-totallen, "\n");
02784 len++;
02785
02786 totallen += len;
02787 marker = SaberParms+totallen;
02788 }
02789 }
02790 }
|
|
|
|
|
|
|
Definition at line 742 of file cg_main.c. Referenced by CG_AddMarks(), CG_CreateSaberMarks(), and CG_ImpactMark(). |
|
|
|
|
|
|
|
|
Definition at line 797 of file cg_main.c. Referenced by CG_Player(). |
|
|
Definition at line 763 of file cg_main.c. Referenced by CG_DrawAutoMap(). |
|
|
Definition at line 153 of file cg_main.c. Referenced by CG_DrawAutoMap(), and vmMain(). |
|
|
Definition at line 767 of file cg_main.c. Referenced by CG_DrawAutoMap(). |
|
|
Definition at line 151 of file cg_main.c. Referenced by CG_DrawAutoMap(), and vmMain(). |
|
|
Definition at line 152 of file cg_main.c. Referenced by CG_DrawAutoMap(), and vmMain(). |
|
|
Definition at line 766 of file cg_main.c. Referenced by CG_DrawAutoMap(). |
|
|
Definition at line 764 of file cg_main.c. Referenced by CG_DrawAutoMap(). |
|
|
Definition at line 765 of file cg_main.c. Referenced by CG_DrawAutoMap(). |
|
|
Definition at line 749 of file cg_main.c. Referenced by CG_OutOfAmmoChange(). |
|
|
|
|
|
Definition at line 826 of file cg_main.c. Referenced by CG_Bleed(). |
|
|
|
|
|
|
|
|
|
|
|
Definition at line 823 of file cg_main.c. Referenced by CG_CustomSound(), CG_LoadCISounds(), and CG_NewClientInfo(). |
|
|
Definition at line 846 of file cg_main.c. Referenced by CG_Player(). |
|
|
|
|
|
|
|
|
|
|
|
Definition at line 773 of file cg_main.c. Referenced by CG_ChatBox_AddString(). |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
Definition at line 864 of file cg_main.c. Referenced by CG_GetSelectedPlayer(), CG_OwnerDraw(), and CG_OwnerDrawVisible(). |
|
|
|
|
|
|
|
|
|
|
|
Definition at line 735 of file cg_main.c. Referenced by CG_EntityEvent(). |
|
|
Definition at line 734 of file cg_main.c. Referenced by CG_ResetPlayerEntity(). |
|
|
|
|
|
Definition at line 828 of file cg_main.c. Referenced by CG_NewClientInfo(). |
|
|
|
|
|
|
|
|
Definition at line 714 of file cg_main.c. Referenced by CG_Draw3DModel(), and CG_DrawFlagModel(). |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
Definition at line 831 of file cg_main.c. Referenced by CG_Player(). |
|
|
Definition at line 744 of file cg_main.c. Referenced by CG_AddViewWeapon(). |
|
|
Definition at line 715 of file cg_main.c. Referenced by CG_Draw3DModel(), and CG_DrawFlagModel(). |
|
|
|
|
|
|
|
|
|
|
|
|