#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 }
0 |