#include "q_shared.h"Go to the source code of this file.
Data Structures | |
| union | _FloatByteUnion |
Functions | |
| int | GetIDForString (stringID_table_t *table, const char *string) |
| const char * | GetStringForID (stringID_table_t *table, int id) |
| int | Com_Clampi (int min, int max, int value) |
| float | Com_Clamp (float min, float max, float value) |
| char * | COM_SkipPath (char *pathname) |
| void | COM_StripExtension (const char *in, char *out) |
| void | COM_DefaultExtension (char *path, int maxSize, const char *extension) |
| short | ShortSwap (short l) |
| short | ShortNoSwap (short l) |
| int | LongSwap (int l) |
| int | LongNoSwap (int l) |
| qint64 | Long64Swap (qint64 ll) |
| qint64 | Long64NoSwap (qint64 ll) |
| float | FloatSwap (const float *f) |
| float | FloatNoSwap (const float *f) |
| void | COM_BeginParseSession (const char *name) |
| int | COM_GetCurrentParseLine (void) |
| char * | COM_Parse (const char **data_p) |
| void | COM_ParseError (char *format,...) |
| void | COM_ParseWarning (char *format,...) |
| const char * | SkipWhitespace (const char *data, qboolean *hasNewLines) |
| int | COM_Compress (char *data_p) |
| char * | COM_ParseExt (const char **data_p, qboolean allowLineBreaks) |
| qboolean | COM_ParseString (const char **data, const char **s) |
| qboolean | COM_ParseInt (const char **data, int *i) |
| qboolean | COM_ParseFloat (const char **data, float *f) |
| qboolean | COM_ParseVec4 (const char **buffer, vec4_t *c) |
| void | COM_MatchToken (const char **buf_p, char *match) |
| void | SkipBracedSection (const char **program) |
| void | SkipRestOfLine (const char **data) |
| void | Parse1DMatrix (const char **buf_p, int x, float *m) |
| void | Parse2DMatrix (const char **buf_p, int y, int x, float *m) |
| void | Parse3DMatrix (const char **buf_p, int z, int y, int x, float *m) |
| int | Q_isprint (int c) |
| int | Q_islower (int c) |
| int | Q_isupper (int c) |
| int | Q_isalpha (int c) |
| char * | Q_strrchr (const char *string, int c) |
| void | Q_strncpyz (char *dest, const char *src, int destsize) |
| int | Q_stricmpn (const char *s1, const char *s2, int n) |
| int | Q_strncmp (const char *s1, const char *s2, int n) |
| int | Q_stricmp (const char *s1, const char *s2) |
| char * | Q_strlwr (char *s1) |
| char * | Q_strupr (char *s1) |
| void | Q_strcat (char *dest, int size, const char *src) |
| int | Q_PrintStrlen (const char *string) |
| char * | Q_CleanStr (char *string) |
| void QDECL | Com_sprintf (char *dest, int size, const char *fmt,...) |
| char *QDECL | va (const char *format,...) |
| char * | Info_ValueForKey (const char *s, const char *key) |
| void | Info_NextPair (const char **head, char *key, char *value) |
| void | Info_RemoveKey (char *s, const char *key) |
| void | Info_RemoveKey_Big (char *s, const char *key) |
| qboolean | Info_Validate (const char *s) |
| void | Info_SetValueForKey (char *s, const char *key, const char *value) |
| void | Info_SetValueForKey_Big (char *s, const char *key, const char *value) |
|
|
Definition at line 284 of file q_shared.c. References Com_sprintf(), and name. Referenced by NPC_ParseParms(), NPC_Precache(), NPC_PrecacheAnimationCFG(), UI_SaberGetHiltInfo(), UI_SaberParseParm(), VEH_LoadVehicle(), VEH_LoadVehWeapon(), WP_SaberParseParm(), and WP_SaberParseParms().
00285 {
00286 com_lines = 0;
00287 Com_sprintf(com_parsename, sizeof(com_parsename), "%s", name);
00288 }
|
|
||||||||||||||||
|
Definition at line 64 of file q_shared.c. References min.
|
|
||||||||||||||||
|
Definition at line 51 of file q_shared.c. References min.
|
|
|
Definition at line 353 of file q_shared.c. References qboolean, qfalse, and qtrue. Referenced by NPC_LoadParms(), UI_SaberLoadParms(), and WP_SaberLoadParms().
00353 {
00354 char *in, *out;
00355 int c;
00356 qboolean newline = qfalse, whitespace = qfalse;
00357
00358 in = out = data_p;
00359 if (in) {
00360 while ((c = *in) != 0) {
00361 // skip double slash comments
00362 if ( c == '/' && in[1] == '/' ) {
00363 while (*in && *in != '\n') {
00364 in++;
00365 }
00366 // skip /* */ comments
00367 } else if ( c == '/' && in[1] == '*' ) {
00368 while ( *in && ( *in != '*' || in[1] != '/' ) )
00369 in++;
00370 if ( *in )
00371 in += 2;
00372 // record when we hit a newline
00373 } else if ( c == '\n' || c == '\r' ) {
00374 newline = qtrue;
00375 in++;
00376 // record when we hit whitespace
00377 } else if ( c == ' ' || c == '\t') {
00378 whitespace = qtrue;
00379 in++;
00380 // an actual token
00381 } else {
00382 // if we have a pending newline, emit it (and it counts as whitespace)
00383 if (newline) {
00384 *out++ = '\n';
00385 newline = qfalse;
00386 whitespace = qfalse;
00387 } if (whitespace) {
00388 *out++ = ' ';
00389 whitespace = qfalse;
00390 }
00391
00392 // copy quoted strings unmolested
00393 if (c == '"') {
00394 *out++ = c;
00395 in++;
00396 while (1) {
00397 c = *in;
00398 if (c && c != '"') {
00399 *out++ = c;
00400 in++;
00401 } else {
00402 break;
00403 }
00404 }
00405 if (c == '"') {
00406 *out++ = c;
00407 in++;
00408 }
00409 } else {
00410 *out = c;
00411 out++;
00412 in++;
00413 }
00414 }
00415 }
00416 }
00417 *out = 0;
00418 return out - data_p;
00419 }
|
|
||||||||||||||||
|
Definition at line 112 of file q_shared.c. References Com_sprintf(), MAX_QPATH, Q_strncpyz(), and strlen().
00112 {
00113 char oldPath[MAX_QPATH];
00114 char *src;
00115
00116 //
00117 // if path doesn't have a .EXT, append extension
00118 // (extension should include the .)
00119 //
00120 src = path + strlen(path) - 1;
00121
00122 while (*src != '/' && src != path) {
00123 if ( *src == '.' ) {
00124 return; // it has an extension
00125 }
00126 src--;
00127 }
00128
00129 Q_strncpyz( oldPath, path, sizeof( oldPath ) );
00130 Com_sprintf( path, maxSize, "%s%s", oldPath, extension );
00131 }
|
|
|
Definition at line 290 of file q_shared.c.
00291 {
00292 return com_lines;
00293 }
|
|
||||||||||||
|
Definition at line 666 of file q_shared.c. References Com_Error(), COM_Parse(), ERR_DROP, and strcmp(). Referenced by Parse1DMatrix(), Parse2DMatrix(), and Parse3DMatrix().
|
|
|
Definition at line 295 of file q_shared.c. References COM_ParseExt(), and qtrue. Referenced by BG_ParseAnimationEvtFile(), BG_ParseAnimationFile(), CG_NewParticleArea(), CG_StartMusic(), COM_MatchToken(), G_ParseInfos(), Parse1DMatrix(), ParseAnimationEvtBlock(), UI_ParseAnimationFile(), and UI_ParseInfos().
00296 {
00297 return COM_ParseExt( data_p, qtrue );
00298 }
|
|
||||||||||||
|
Definition at line 300 of file q_shared.c. References Com_Printf(), va_end, va_list, va_start, and vsprintf().
00301 {
00302 va_list argptr;
00303 static char string[4096];
00304
00305 va_start (argptr, format);
00306 vsprintf (string, format, argptr);
00307 va_end (argptr);
00308
00309 Com_Printf("ERROR: %s, line %d: %s\n", com_parsename, com_lines, string);
00310 }
|
|
||||||||||||
|
Definition at line 421 of file q_shared.c. References MAX_TOKEN_CHARS, NULL, qboolean, qfalse, and SkipWhitespace(). Referenced by Asset_Parse(), BG_ParseAnimationFile(), BG_ParseLiteral(), CG_DrawSkyBoxPortal(), CG_Load_Menu(), CG_LoadMenus(), CG_ParseSurfsFile(), COM_Parse(), COM_ParseFloat(), COM_ParseInt(), COM_ParseString(), Float_Parse(), G_ParseInfos(), Int_Parse(), NPC_ParseParms(), NPC_Precache(), NPC_PrecacheAnimationCFG(), ParseAnimationEvtBlock(), SkipBracedSection(), String_Parse(), UI_ParseInfos(), UI_ParseLiteral(), UI_ParseLiteralSilent(), UI_SaberGetHiltInfo(), UI_SaberParseParm(), VEH_LoadVehicle(), VEH_LoadVehWeapon(), WP_SaberParseParm(), and WP_SaberParseParms().
00422 {
00423 int c = 0, len;
00424 qboolean hasNewLines = qfalse;
00425 const char *data;
00426
00427 data = *data_p;
00428 len = 0;
00429 com_token[0] = 0;
00430
00431 // make sure incoming data is valid
00432 if ( !data )
00433 {
00434 *data_p = NULL;
00435 return com_token;
00436 }
00437
00438 while ( 1 )
00439 {
00440 // skip whitespace
00441 data = SkipWhitespace( data, &hasNewLines );
00442 if ( !data )
00443 {
00444 *data_p = NULL;
00445 return com_token;
00446 }
00447 if ( hasNewLines && !allowLineBreaks )
00448 {
00449 *data_p = data;
00450 return com_token;
00451 }
00452
00453 c = *data;
00454
00455 // skip double slash comments
00456 if ( c == '/' && data[1] == '/' )
00457 {
00458 data += 2;
00459 while (*data && *data != '\n') {
00460 data++;
00461 }
00462 }
00463 // skip /* */ comments
00464 else if ( c=='/' && data[1] == '*' )
00465 {
00466 data += 2;
00467 while ( *data && ( *data != '*' || data[1] != '/' ) )
00468 {
00469 data++;
00470 }
00471 if ( *data )
00472 {
00473 data += 2;
00474 }
00475 }
00476 else
00477 {
00478 break;
00479 }
00480 }
00481
00482 // handle quoted strings
00483 if (c == '\"')
00484 {
00485 data++;
00486 while (1)
00487 {
00488 c = *data++;
00489 if (c=='\"' || !c)
00490 {
00491 com_token[len] = 0;
00492 *data_p = ( char * ) data;
00493 return com_token;
00494 }
00495 if (len < MAX_TOKEN_CHARS)
00496 {
00497 com_token[len] = c;
00498 len++;
00499 }
00500 }
00501 }
00502
00503 // parse a regular word
00504 do
00505 {
00506 if (len < MAX_TOKEN_CHARS)
00507 {
00508 com_token[len] = c;
00509 len++;
00510 }
00511 data++;
00512 c = *data;
00513 if ( c == '\n' )
00514 com_lines++;
00515 } while (c>32);
00516
00517 if (len == MAX_TOKEN_CHARS)
00518 {
00519 // Com_Printf ("Token exceeded %i chars, discarded.\n", MAX_TOKEN_CHARS);
00520 len = 0;
00521 }
00522 com_token[len] = 0;
00523
00524 *data_p = ( char * ) data;
00525 return com_token;
00526 }
|
|
||||||||||||
|
Definition at line 625 of file q_shared.c. References atof(), COM_ParseExt(), Com_Printf(), qboolean, qfalse, and qtrue. Referenced by COM_ParseVec4(), NPC_ParseParms(), ParseRect(), Script_Transition2(), and WP_SaberParseParms().
00626 {
00627 const char *token;
00628
00629 token = COM_ParseExt( data, qfalse );
00630 if ( token[0] == 0 )
00631 {
00632 Com_Printf( "unexpected EOF\n" );
00633 return qtrue;
00634 }
00635
00636 *f = atof( token );
00637 return qfalse;
00638 }
|
|
||||||||||||
|
Definition at line 605 of file q_shared.c. References atoi(), COM_ParseExt(), Com_Printf(), qboolean, qfalse, and qtrue. Referenced by NPC_ParseParms(), and WP_SaberParseParms().
00606 {
00607 const char *token;
00608
00609 token = COM_ParseExt( data, qfalse );
00610 if ( token[0] == 0 )
00611 {
00612 Com_Printf( "unexpected EOF\n" );
00613 return qtrue;
00614 }
00615
00616 *i = atoi( token );
00617 return qfalse;
00618 }
|
|
||||||||||||
|
Definition at line 588 of file q_shared.c. References COM_ParseExt(), Com_Printf(), qboolean, qfalse, and qtrue. Referenced by CG_ParseSurfsFile(), NPC_ParseParms(), NPC_Precache(), NPC_PrecacheAnimationCFG(), UI_SaberParseParm(), WP_SaberParseParm(), and WP_SaberParseParms().
00589 {
00590 // *s = COM_ParseExt( data, qtrue );
00591 *s = COM_ParseExt( data, qfalse );
00592 if ( s[0] == 0 )
00593 {
00594 Com_Printf("unexpected EOF\n");
00595 return qtrue;
00596 }
00597 return qfalse;
00598 }
|
|
||||||||||||
|
Definition at line 645 of file q_shared.c. References COM_ParseFloat(), qboolean, qfalse, qtrue, and vec4_t.
00646 {
00647 int i;
00648 float f;
00649
00650 for (i = 0; i < 4; i++)
00651 {
00652 if (COM_ParseFloat(buffer, &f))
00653 {
00654 return qtrue;
00655 }
00656 (*c)[i] = f;
00657 }
00658 return qfalse;
00659 }
|
|
||||||||||||
|
Definition at line 312 of file q_shared.c. References Com_Printf(), va_end, va_list, va_start, and vsprintf().
00313 {
00314 va_list argptr;
00315 static char string[4096];
00316
00317 va_start (argptr, format);
00318 vsprintf (string, format, argptr);
00319 va_end (argptr);
00320
00321 Com_Printf("WARNING: %s, line %d: %s\n", com_parsename, com_lines, string);
00322 }
|
|
|
Definition at line 80 of file q_shared.c.
00081 {
00082 char *last;
00083
00084 last = pathname;
00085 while (*pathname)
00086 {
00087 if (*pathname=='/')
00088 last = pathname+1;
00089 pathname++;
00090 }
00091 return last;
00092 }
|
|
||||||||||||||||||||
|
||||||||||||
|
Definition at line 99 of file q_shared.c. Referenced by CG_CustomSound(), CG_LoadCISounds(), CG_RegisterWeapon(), Q3_PlaySound(), and UI_LoadForceConfig_List().
00099 {
00100 while ( *in && *in != '.' ) {
00101 *out++ = *in++;
00102 }
00103 *out = 0;
00104 }
|
|
|
Definition at line 230 of file q_shared.c.
00231 {
00232 return *f;
00233 }
|
|
|
Definition at line 220 of file q_shared.c. References _FloatByteUnion::f, _FloatByteUnion::i, and LongSwap().
00220 {
00221 const _FloatByteUnion *in;
00222 _FloatByteUnion out;
00223
00224 in = (_FloatByteUnion *)f;
00225 out.i = LongSwap(in->i);
00226
00227 return out.f;
00228 }
|
|
||||||||||||
|
Definition at line 13 of file q_shared.c. References stringID_table_s::id, stringID_table_s::name, name, NULL, Q_stricmp(), and stringID_table_t. Referenced by BG_ParseAnimationFile(), G_ActivateBehavior(), NPC_Kill_f(), NPC_ParseParms(), NPC_Precache(), ParseAnimationEvtBlock(), Q3_GetFloat(), Q3_GetString(), Q3_GetVector(), Q3_Set(), SP_misc_weapon_shooter(), UI_ParseAnimationFile(), vmMain(), and WP_SaberParseParms().
|
|
||||||||||||
|
Definition at line 35 of file q_shared.c. References stringID_table_s::id, stringID_table_s::name, NULL, and stringID_table_t. Referenced by G_ActivateBehavior().
|
|
||||||||||||||||
|
Definition at line 1108 of file q_shared.c.
01108 {
01109 char *o;
01110 const char *s;
01111
01112 s = *head;
01113
01114 if ( *s == '\\' ) {
01115 s++;
01116 }
01117 key[0] = 0;
01118 value[0] = 0;
01119
01120 o = key;
01121 while ( *s != '\\' ) {
01122 if ( !*s ) {
01123 *o = 0;
01124 *head = s;
01125 return;
01126 }
01127 *o++ = *s++;
01128 }
01129 *o = 0;
01130 s++;
01131
01132 o = value;
01133 while ( *s != '\\' && *s ) {
01134 *o++ = *s++;
01135 }
01136 *o = 0;
01137
01138 *head = s;
01139 }
|
|
||||||||||||
|
Definition at line 1147 of file q_shared.c. References Com_Error(), ERR_DROP, MAX_INFO_KEY, MAX_INFO_STRING, MAX_INFO_VALUE, strchr(), strcmp(), strcpy(), and strlen(). Referenced by Info_SetValueForKey().
01147 {
01148 char *start;
01149 char pkey[MAX_INFO_KEY];
01150 char value[MAX_INFO_VALUE];
01151 char *o;
01152
01153 if ( strlen( s ) >= MAX_INFO_STRING ) {
01154 Com_Error( ERR_DROP, "Info_RemoveKey: oversize infostring" );
01155 }
01156
01157 if (strchr (key, '\\')) {
01158 return;
01159 }
01160
01161 while (1)
01162 {
01163 start = s;
01164 if (*s == '\\')
01165 s++;
01166 o = pkey;
01167 while (*s != '\\')
01168 {
01169 if (!*s)
01170 return;
01171 *o++ = *s++;
01172 }
01173 *o = 0;
01174 s++;
01175
01176 o = value;
01177 while (*s != '\\' && *s)
01178 {
01179 if (!*s)
01180 return;
01181 *o++ = *s++;
01182 }
01183 *o = 0;
01184
01185 if (!strcmp (key, pkey) )
01186 {
01187 strcpy (start, s); // remove this part
01188 return;
01189 }
01190
01191 if (!*s)
01192 return;
01193 }
01194
01195 }
|
|
||||||||||||
|
Definition at line 1202 of file q_shared.c. References BIG_INFO_KEY, BIG_INFO_STRING, BIG_INFO_VALUE, Com_Error(), ERR_DROP, strchr(), strcmp(), strcpy(), and strlen(). Referenced by Info_SetValueForKey_Big().
01202 {
01203 char *start;
01204 char pkey[BIG_INFO_KEY];
01205 char value[BIG_INFO_VALUE];
01206 char *o;
01207
01208 if ( strlen( s ) >= BIG_INFO_STRING ) {
01209 Com_Error( ERR_DROP, "Info_RemoveKey_Big: oversize infostring" );
01210 }
01211
01212 if (strchr (key, '\\')) {
01213 return;
01214 }
01215
01216 while (1)
01217 {
01218 start = s;
01219 if (*s == '\\')
01220 s++;
01221 o = pkey;
01222 while (*s != '\\')
01223 {
01224 if (!*s)
01225 return;
01226 *o++ = *s++;
01227 }
01228 *o = 0;
01229 s++;
01230
01231 o = value;
01232 while (*s != '\\' && *s)
01233 {
01234 if (!*s)
01235 return;
01236 *o++ = *s++;
01237 }
01238 *o = 0;
01239
01240 if (!strcmp (key, pkey) )
01241 {
01242 strcpy (start, s); // remove this part
01243 return;
01244 }
01245
01246 if (!*s)
01247 return;
01248 }
01249
01250 }
|
|
||||||||||||||||
|
Definition at line 1280 of file q_shared.c. References Com_Error(), Com_Printf(), Com_sprintf(), ERR_DROP, Info_RemoveKey(), MAX_INFO_STRING, strcat(), strchr(), strcpy(), and strlen(). Referenced by ClientBegin(), ClientSpawn(), ClientUserinfoChanged(), Cmd_TeamTask_f(), G_ParseInfos(), SetTeamQuick(), SP_terrain(), and UI_ParseInfos().
01280 {
01281 char newi[MAX_INFO_STRING];
01282
01283 if ( strlen( s ) >= MAX_INFO_STRING ) {
01284 Com_Error( ERR_DROP, "Info_SetValueForKey: oversize infostring" );
01285 }
01286
01287 if (strchr (key, '\\') || strchr (value, '\\'))
01288 {
01289 Com_Printf ("Can't use keys or values with a \\\n");
01290 return;
01291 }
01292
01293 if (strchr (key, ';') || strchr (value, ';'))
01294 {
01295 Com_Printf ("Can't use keys or values with a semicolon\n");
01296 return;
01297 }
01298
01299 if (strchr (key, '\"') || strchr (value, '\"'))
01300 {
01301 Com_Printf ("Can't use keys or values with a \"\n");
01302 return;
01303 }
01304
01305 Info_RemoveKey (s, key);
01306 if (!value || !strlen(value))
01307 return;
01308
01309 Com_sprintf (newi, sizeof(newi), "\\%s\\%s", key, value);
01310
01311 if (strlen(newi) + strlen(s) > MAX_INFO_STRING)
01312 {
01313 Com_Printf ("Info string length exceeded\n");
01314 return;
01315 }
01316
01317 strcat (newi, s);
01318 strcpy (s, newi);
01319 }
|
|
||||||||||||||||
|
Definition at line 1328 of file q_shared.c. References BIG_INFO_STRING, Com_Error(), Com_Printf(), Com_sprintf(), ERR_DROP, Info_RemoveKey_Big(), strcat(), strchr(), and strlen().
01328 {
01329 char newi[BIG_INFO_STRING];
01330
01331 if ( strlen( s ) >= BIG_INFO_STRING ) {
01332 Com_Error( ERR_DROP, "Info_SetValueForKey: oversize infostring" );
01333 }
01334
01335 if (strchr (key, '\\') || strchr (value, '\\'))
01336 {
01337 Com_Printf ("Can't use keys or values with a \\\n");
01338 return;
01339 }
01340
01341 if (strchr (key, ';') || strchr (value, ';'))
01342 {
01343 Com_Printf ("Can't use keys or values with a semicolon\n");
01344 return;
01345 }
01346
01347 if (strchr (key, '\"') || strchr (value, '\"'))
01348 {
01349 Com_Printf ("Can't use keys or values with a \"\n");
01350 return;
01351 }
01352
01353 Info_RemoveKey_Big (s, key);
01354 if (!value || !strlen(value))
01355 return;
01356
01357 Com_sprintf (newi, sizeof(newi), "\\%s\\%s", key, value);
01358
01359 if (strlen(newi) + strlen(s) > BIG_INFO_STRING)
01360 {
01361 Com_Printf ("BIG Info string length exceeded\n");
01362 return;
01363 }
01364
01365 strcat (s, newi);
01366 }
|
|
|
Definition at line 1263 of file q_shared.c. References qboolean, qfalse, qtrue, and strchr(). Referenced by ClientUserinfoChanged().
|
|
||||||||||||
|
Definition at line 1051 of file q_shared.c. References BIG_INFO_KEY, BIG_INFO_STRING, BIG_INFO_VALUE, Com_Error(), ERR_DROP, Q_stricmp(), and strlen(). Referenced by CG_DrawInformation(), CG_DrawSiegeInfo(), CG_LoadingClient(), CG_NewClientInfo(), CG_ParseServerinfo(), ClientBegin(), ClientConnect(), ClientSpawn(), ClientUserinfoChanged(), Cmd_CallVote_f(), G_AddRandomBot(), G_BotConnect(), G_DoesMapSupportGametype(), G_GetArenaInfoByMap(), G_GetBotInfoByName(), G_InitSessionData(), G_LogWeaponOutput(), G_RefreshNextMap(), Svcmd_BotList_f(), UI_DrawConnectScreen(), UI_FeederSelection(), UI_ForceConfigHandle(), UI_ForceSide_HandleKey(), UI_GetBotInfoByName(), UI_GetBotNameByNumber(), UI_HasSetSaberOnly(), UI_LoadArenas(), UI_ParseInfos(), UI_ReadLegalForce(), UI_SetSiegeTeams(), UI_TrueJediEnabled(), UpdateForceStatus(), and WP_InitForcePowers().
01051 {
01052 char pkey[BIG_INFO_KEY];
01053 static char value[2][BIG_INFO_VALUE]; // use two buffers so compares
01054 // work without stomping on each other
01055 static int valueindex = 0;
01056 char *o;
01057
01058 if ( !s || !key ) {
01059 return "";
01060 }
01061
01062 if ( strlen( s ) >= BIG_INFO_STRING ) {
01063 Com_Error( ERR_DROP, "Info_ValueForKey: oversize infostring" );
01064 }
01065
01066 valueindex ^= 1;
01067 if (*s == '\\')
01068 s++;
01069 while (1)
01070 {
01071 o = pkey;
01072 while (*s != '\\')
01073 {
01074 if (!*s)
01075 return "";
01076 *o++ = *s++;
01077 }
01078 *o = 0;
01079 s++;
01080
01081 o = value[valueindex];
01082
01083 while (*s != '\\' && *s)
01084 {
01085 *o++ = *s++;
01086 }
01087 *o = 0;
01088
01089 if (!Q_stricmp (key, pkey) )
01090 return value[valueindex];
01091
01092 if (!*s)
01093 break;
01094 s++;
01095 }
01096
01097 return "";
01098 }
|
|
|
Definition at line 210 of file q_shared.c.
00211 {
00212 return ll;
00213 }
|
|
|
Definition at line 194 of file q_shared.c. References qint64::b0, qint64::b1, qint64::b2, qint64::b3, qint64::b4, qint64::b5, qint64::b6, and qint64::b7.
|
|
|
Definition at line 189 of file q_shared.c.
00190 {
00191 return l;
00192 }
|
|
|
Definition at line 177 of file q_shared.c. References byte. Referenced by FloatSwap().
00178 {
00179 byte b1,b2,b3,b4;
00180
00181 b1 = l&255;
00182 b2 = (l>>8)&255;
00183 b3 = (l>>16)&255;
00184 b4 = (l>>24)&255;
00185
00186 return ((int)b1<<24) + ((int)b2<<16) + ((int)b3<<8) + b4;
00187 }
|
|
||||||||||||||||
|
Definition at line 724 of file q_shared.c. References atof(), COM_MatchToken(), and COM_Parse(). Referenced by Parse2DMatrix().
00724 {
00725 char *token;
00726 int i;
00727
00728 COM_MatchToken( buf_p, "(" );
00729
00730 for (i = 0 ; i < x ; i++) {
00731 token = COM_Parse(buf_p);
00732 m[i] = atof(token);
00733 }
00734
00735 COM_MatchToken( buf_p, ")" );
00736 }
|
|
||||||||||||||||||||
|
Definition at line 738 of file q_shared.c. References COM_MatchToken(), and Parse1DMatrix(). Referenced by Parse3DMatrix().
00738 {
00739 int i;
00740
00741 COM_MatchToken( buf_p, "(" );
00742
00743 for (i = 0 ; i < y ; i++) {
00744 Parse1DMatrix (buf_p, x, m + i * x);
00745 }
00746
00747 COM_MatchToken( buf_p, ")" );
00748 }
|
|
||||||||||||||||||||||||
|
Definition at line 750 of file q_shared.c. References COM_MatchToken(), and Parse2DMatrix().
00750 {
00751 int i;
00752
00753 COM_MatchToken( buf_p, "(" );
00754
00755 for (i = 0 ; i < z ; i++) {
00756 Parse2DMatrix (buf_p, y, x, m + i * x*y);
00757 }
00758
00759 COM_MatchToken( buf_p, ")" );
00760 }
|
|
|
Definition at line 963 of file q_shared.c. References Q_IsColorString. Referenced by CG_DrawInformation(), CG_LoadingClient(), Cmd_CallTeamVote_f(), G_AddRandomBot(), G_KickAllBots(), and G_RemoveRandomBot().
00963 {
00964 char* d;
00965 char* s;
00966 int c;
00967
00968 s = string;
00969 d = string;
00970 while ((c = *s) != 0 ) {
00971 if ( Q_IsColorString( s ) ) {
00972 s++;
00973 }
00974 else if ( c >= 0x20 && c <= 0x7E ) {
00975 *d++ = c;
00976 }
00977 s++;
00978 }
00979 *d = '\0';
00980
00981 return string;
00982 }
|
|
|
Definition at line 792 of file q_shared.c.
00793 {
00794 if ((c >= 'a' && c <= 'z') || (c >= 'A' && c <= 'Z'))
00795 return ( 1 );
00796 return ( 0 );
00797 }
|
|
|
Definition at line 778 of file q_shared.c.
00779 {
00780 if (c >= 'a' && c <= 'z')
00781 return ( 1 );
00782 return ( 0 );
00783 }
|
|
|
Definition at line 771 of file q_shared.c.
00772 {
00773 if ( c >= 0x20 && c <= 0x7E )
00774 return ( 1 );
00775 return ( 0 );
00776 }
|
|
|
Definition at line 785 of file q_shared.c.
00786 {
00787 if (c >= 'A' && c <= 'Z')
00788 return ( 1 );
00789 return ( 0 );
00790 }
|
|
|
Definition at line 940 of file q_shared.c. References Q_IsColorString.
00940 {
00941 int len;
00942 const char *p;
00943
00944 if( !string ) {
00945 return 0;
00946 }
00947
00948 len = 0;
00949 p = string;
00950 while( *p ) {
00951 if( Q_IsColorString( p ) ) {
00952 p += 2;
00953 continue;
00954 }
00955 p++;
00956 len++;
00957 }
00958
00959 return len;
00960 }
|
|
||||||||||||||||
|
Definition at line 929 of file q_shared.c. References Com_Error(), ERR_FATAL, Q_strncpyz(), and strlen(). Referenced by BG_LegalizedForcePowers(), BG_ValidateSkinForTeam(), BuildShaderStateConfig(), CG_BuildSpectatorString(), CG_ParseSurfsFile(), CG_PrintCTFMessage(), G_SendG2KillQueue(), G_SiegeClientExData(), InitSiegeMode(), Item_RunScript(), NPC_ParseParms(), PC_Script_Parse(), and WP_SaberLoadParms().
00929 {
00930 int l1;
00931
00932 l1 = strlen( dest );
00933 if ( l1 >= size ) {
00934 Com_Error( ERR_FATAL, "Q_strcat: already overflowed" );
00935 }
00936 Q_strncpyz( dest + l1, src, size - l1 );
00937 }
|
|
||||||||||||
|
||||||||||||||||
|
Definition at line 842 of file q_shared.c. References NULL. Referenced by BG_ValidateSkinForTeam(), CG_PlayerAnimEventDo(), ParseAnimationEvtBlock(), Q_stricmp(), and WP_SaberParseParms().
00842 {
00843 int c1, c2;
00844
00845 // bk001129 - moved in 1.17 fix not in id codebase
00846 if ( s1 == NULL ) {
00847 if ( s2 == NULL )
00848 return 0;
00849 else
00850 return -1;
00851 }
00852 else if ( s2==NULL )
00853 return 1;
00854
00855
00856
00857 do {
00858 c1 = *s1++;
00859 c2 = *s2++;
00860
00861 if (!n--) {
00862 return 0; // strings are equal until end point
00863 }
00864
00865 if (c1 != c2) {
00866 if (c1 >= 'a' && c1 <= 'z') {
00867 c1 -= ('a' - 'A');
00868 }
00869 if (c2 >= 'a' && c2 <= 'z') {
00870 c2 -= ('a' - 'A');
00871 }
00872 if (c1 != c2) {
00873 return c1 < c2 ? -1 : 1;
00874 }
00875 }
00876 } while (c1);
00877
00878 return 0; // strings are equal
00879 }
|
|
|
Definition at line 905 of file q_shared.c. References tolower(). Referenced by NPC_Spawn_Do(), and TAG_Add().
00905 {
00906 char *s;
00907
00908 s = s1;
00909 while ( *s ) {
00910 *s = tolower(*s);
00911 s++;
00912 }
00913 return s1;
00914 }
|
|
||||||||||||||||
|
Definition at line 881 of file q_shared.c. Referenced by BG_ValidateSkinForTeam(), CheckTeamVote(), G_GetHitLocFromSurfName(), G_SpawnGEntityFromSpawnVars(), NPC_SpawnType(), NPC_WeaponsForTeam(), and Q3_Set().
00881 {
00882 int c1, c2;
00883
00884 do {
00885 c1 = *s1++;
00886 c2 = *s2++;
00887
00888 if (!n--) {
00889 return 0; // strings are equal until end point
00890 }
00891
00892 if (c1 != c2) {
00893 return c1 < c2 ? -1 : 1;
00894 }
00895 } while (c1);
00896
00897 return 0; // strings are equal
00898 }
|
|
||||||||||||||||
|
||||||||||||
|
Definition at line 799 of file q_shared.c. Referenced by CG_CacheG2AnimInfo(), CG_G2AnimEntModelLoad(), CG_G2EvIndexForModel(), CG_G2SkelForModel(), CG_HandleAppendedSkin(), ItemParse_asset_model_go(), NPC_VehiclePrecache(), and SetupGameGhoul2Model().
00800 {
00801 char cc = c;
00802 char *s;
00803 char *sp=(char *)0;
00804
00805 s = (char*)string;
00806
00807 while (*s)
00808 {
00809 if (*s == cc)
00810 sp = s;
00811 s++;
00812 }
00813 if (cc == 0)
00814 sp = s;
00815
00816 return sp;
00817 }
|
|
|
Definition at line 916 of file q_shared.c. References toupper(). Referenced by CG_DrawInvenSelect(), CG_DrawWeaponSelect(), CG_LoadingItem(), and Q3_PlaySound().
00916 {
00917 char *s;
00918
00919 s = s1;
00920 while ( *s ) {
00921 *s = toupper(*s);
00922 s++;
00923 }
00924 return s1;
00925 }
|
|
|
Definition at line 172 of file q_shared.c.
00173 {
00174 return l;
00175 }
|
|
|
Definition at line 162 of file q_shared.c. References byte.
00163 {
00164 byte b1,b2;
00165
00166 b1 = l&255;
00167 b2 = (l>>8)&255;
00168
00169 return (b1<<8) + b2;
00170 }
|
|
|
Definition at line 685 of file q_shared.c. References COM_ParseExt(), and qtrue. Referenced by NPC_ParseParms(), NPC_Precache(), NPC_PrecacheAnimationCFG(), UI_SaberGetHiltInfo(), UI_SaberParseParm(), VEH_LoadVehicle(), VEH_LoadVehWeapon(), WP_SaberParseParm(), and WP_SaberParseParms().
00685 {
00686 char *token;
00687 int depth;
00688
00689 depth = 0;
00690 do {
00691 token = COM_ParseExt( program, qtrue );
00692 if( token[1] == 0 ) {
00693 if( token[0] == '{' ) {
00694 depth++;
00695 }
00696 else if( token[0] == '}' ) {
00697 depth--;
00698 }
00699 }
00700 } while( depth && *program );
00701 }
|
|
|
Definition at line 708 of file q_shared.c. Referenced by NPC_ParseParms(), ParseAnimationEvtBlock(), UI_SaberGetHiltInfo(), UI_SaberParseParm(), VEH_LoadVehicle(), VEH_LoadVehWeapon(), WP_SaberParseParm(), and WP_SaberParseParms().
00708 {
00709 const char *p;
00710 int c;
00711
00712 p = *data;
00713 while ( (c = *p++) != 0 ) {
00714 if ( c == '\n' ) {
00715 com_lines++;
00716 break;
00717 }
00718 }
00719
00720 *data = p;
00721 }
|
|
||||||||||||
|
Definition at line 336 of file q_shared.c. Referenced by COM_ParseExt().
|
|
||||||||||||