本文整理汇总了C++中COM_Parse函数的典型用法代码示例。如果您正苦于以下问题:C++ COM_Parse函数的具体用法?C++ COM_Parse怎么用?C++ COM_Parse使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了COM_Parse函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: G_ParseMapCommandSection
/*
===============
G_ParseCommandSection
Parse a map rotation command section
===============
*/
static bool G_ParseMapCommandSection( mapRotationEntry_t *mre, char **text_p )
{
char *token;
// read optional parameters
while( 1 )
{
token = COM_Parse( text_p );
if( !token )
break;
if( !Q_stricmp( token, "" ) )
return false;
if( !Q_stricmp( token, "}" ) )
return true; //reached the end of this command section
Q_strncpyz( mre->postCmds[ mre->numCmds ], token, sizeof( mre->postCmds[ 0 ] ) );
Q_strcat( mre->postCmds[ mre->numCmds ], sizeof( mre->postCmds[ 0 ] ), " " );
token = COM_ParseExt( text_p, false );
while( token && token[ 0 ] != 0 )
{
Q_strcat( mre->postCmds[ mre->numCmds ], sizeof( mre->postCmds[ 0 ] ), token );
Q_strcat( mre->postCmds[ mre->numCmds ], sizeof( mre->postCmds[ 0 ] ), " " );
token = COM_ParseExt( text_p, false );
}
if( mre->numCmds == MAX_MAP_COMMANDS )
{
G_Printf( S_COLOR_RED "ERROR: maximum number of map commands (%d) reached\n",
MAX_MAP_COMMANDS );
return false;
}
else
mre->numCmds++;
}
return false;
}
示例2: ML_GetFullnameFromMap
/*
* ML_GetFullnameFromMap
* Get fullname of map from file or worldspawn (slow)
*/
static void ML_GetFullnameFromMap( const char *filename, char *fullname, size_t len )
{
char *buffer;
*fullname = '\0';
// Try and load fullname from a file
FS_LoadFile( va( "maps/%s.txt", filename ), ( void ** )&buffer, NULL, 0 );
if( buffer )
{
char *line = buffer;
Q_strncpyz( fullname, COM_Parse( &line ), len );
FS_FreeFile( buffer );
return;
}
// Try and load fullname from worldspawn
CM_LoadMapMessage( va( "maps/%s.bsp", filename ), fullname, len );
COM_RemoveColorTokens( fullname );
}
示例3: SV_ValidateClientCommand
/*
===================
SV_ValidateClientCommand
Determine if passed in user command is valid.
===================
*/
int SV_ValidateClientCommand( char *pszCommand )
{
char *p;
int i = 0;
COM_Parse( pszCommand );
p = clcommands[i].command;
while ( p != NULL )
{
if ( Q_strcasecmp( com_token, p ) == 0 )
{
return 1;
}
i++;
p = clcommands[i].command;
}
return 0;
}
示例4: Cmd_TokenizeString
static void
Cmd_TokenizeString(const char* text, int text_len)
{
int start;
int com_token_start;
int com_token_length;
cmd_argc = 0;
start = 0;
while (start < text_len) {
/* skip whitespace up to a \n */
while (*text && *text <= ' ' && *text != '\n' && start < text_len) {
text++;
start++;
}
if (*text == '\n') {
/* a newline separates commands in the buffer */
text++;
break;
}
if ((!*text) || (start == text_len))
return;
text = COM_Parse (text, text_len-start, &com_token_start, &com_token_length);
if (!text)
return;
if (cmd_argc < MAX_ARGS) {
cmd_argv[cmd_argc] = (char*)text;
cmd_argv_start[cmd_argc] = start + com_token_start;
cmd_argv_length[cmd_argc] = com_token_length;
cmd_argc++;
}
start += com_token_start + com_token_length;
}
}
示例5: G_ScriptAction_StartCam
/*
===================
G_ScriptAction_StartCam
syntax: startcam <camera filename>
===================
*/
qboolean G_ScriptAction_StartCam( gentity_t *ent, char *params ) {
char *pString, *token;
gentity_t *player;
pString = params;
token = COM_Parse( &pString );
if ( !token[0] ) {
G_Error( "G_ScriptAction_Cam: filename parameter required\n" );
}
// turn off noclient flag
ent->r.svFlags &= ~SVF_NOCLIENT;
// issue a start camera command to the client
player = AICast_FindEntityForName( "player" );
if ( !player ) {
G_Error( "player not found, perhaps you should give them more time to spawn in" );
}
trap_SendServerCommand( player->s.number, va( "startCam %s", token ) );
return qtrue;
}
示例6: QRY_FL_CheckVarsModified
// check if "masters_filter_servers" cvar changed and do appropriate action
static void QRY_FL_CheckVarsModified(void)
{
char *mlist;
// "masters_filter_servers" was not modified, do nothing
if (!masters_filter_servers->modified)
return;
// clear filters
QRY_FL_Init();
// add all filters
for ( mlist = masters_filter_servers->string; (mlist = COM_Parse(mlist)); )
{
QRY_FL_AddFilter(com_token);
}
// remove filtered servers if any.
QRY_FL_RemoveFilteredServers();
masters_filter_servers->modified = false;
}
示例7: COM_Parse2
bool AnimDelta::ParseConfiguration(clientInfo_t* ci, const char* token2, const char** data_p)
{
if ( Q_stricmp( token2, "handBones" ) ) return false;
char* token = COM_Parse2( data_p );
if ( !token || token[0] != '{' )
{
Log::Notice( "^1ERROR^7: Expected '{' but found '%s' in %s's character.cfg", token, ci->modelName );
return false;
}
while ( 1 )
{
token = COM_Parse( data_p );
if ( !token || token[0] == '}' ) break;
int index = trap_R_BoneIndex( ci->bodyModel, token );
if ( index < 0 )
{
Log::Warn("AnimDelta: Error finding bone '%s' in %s", token, ci->modelName );
}
boneIndicies_.push_back( index );
}
return true;
}
示例8: DrawTris
/*
================
DrawTris
Draws triangle outlines for debugging
================
*/
static void DrawTris( shaderCommands_t *input ) {
char *s = r_trisColor->string;
vec4_t trisColor = { 1, 1, 1, 1 };
unsigned int stateBits = 0;
GL_Bind( tr.whiteImage );
if ( *s == '0' && ( *( s + 1 ) == 'x' || *( s + 1 ) == 'X' ) ) {
s += 2;
if ( Q_IsHexColorString( s ) ) {
trisColor[0] = ( (float)( gethex( *( s ) ) * 16 + gethex( *( s + 1 ) ) ) ) / 255.00;
trisColor[1] = ( (float)( gethex( *( s + 2 ) ) * 16 + gethex( *( s + 3 ) ) ) ) / 255.00;
trisColor[2] = ( (float)( gethex( *( s + 4 ) ) * 16 + gethex( *( s + 5 ) ) ) ) / 255.00;
if ( Q_HexColorStringHasAlpha( s ) ) {
trisColor[3] = ( (float)( gethex( *( s + 6 ) ) * 16 + gethex( *( s + 7 ) ) ) ) / 255.00;
}
}
} else {
int i;
char *token;
for ( i = 0 ; i < 4 ; i++ ) {
token = COM_Parse( &s );
if ( token ) {
trisColor[i] = atof( token );
} else {
trisColor[i] = 1.f;
}
}
if ( !trisColor[3] ) {
trisColor[3] = 1.f;
}
}
if ( trisColor[3] < 1.f ) {
stateBits |= ( GLS_SRCBLEND_SRC_ALPHA | GLS_DSTBLEND_ONE_MINUS_SRC_ALPHA );
}
qglColor4fv( trisColor );
// ydnar r_showtris 2
if ( r_showtris->integer == 2 ) {
stateBits |= ( GLS_POLYMODE_LINE | GLS_DEPTHMASK_TRUE );
GL_State( stateBits );
qglDepthRange( 0, 0 );
}
#ifdef CELSHADING_HACK
else if ( r_showtris->integer == 3 ) {
stateBits |= ( GLS_POLYMODE_LINE | GLS_DEPTHMASK_TRUE );
GL_State( stateBits );
qglEnable( GL_POLYGON_OFFSET_LINE );
qglPolygonOffset( 4.0, 0.5 );
qglLineWidth( 5.0 );
}
#endif
else
{
stateBits |= ( GLS_POLYMODE_LINE );
GL_State( stateBits );
qglEnable( GL_POLYGON_OFFSET_LINE );
qglPolygonOffset( r_offsetFactor->value, r_offsetUnits->value );
}
qglDisableClientState( GL_COLOR_ARRAY );
qglDisableClientState( GL_TEXTURE_COORD_ARRAY );
qglVertexPointer( 3, GL_FLOAT, 16, input->xyz ); // padded for SIMD
if ( qglLockArraysEXT ) {
qglLockArraysEXT( 0, input->numVertexes );
GLimp_LogComment( "glLockArraysEXT\n" );
}
R_DrawElements( input->numIndexes, input->indexes );
if ( qglUnlockArraysEXT ) {
qglUnlockArraysEXT();
GLimp_LogComment( "glUnlockArraysEXT\n" );
}
qglDepthRange( 0, 1 );
qglDisable( GL_POLYGON_OFFSET_LINE );
}
示例9: trigger_entdist_use
void trigger_entdist_use( gentity_t *self, gentity_t *other, gentity_t *activator )
{
vec3_t diff;
gentity_t *found = NULL;
gentity_t *owner = NULL;
qboolean useflag;
const char *token, *holdString;
if ( self->svFlags & SVF_INACTIVE ) // Don't use INACTIVE
return;
G_ActivateBehavior(self,BSET_USE);
if(self->ownername && self->ownername[0])
{
owner = G_Find(NULL, FOFS(targetname), self->ownername);
}
if(owner == NULL)
{
owner = self;
}
self->activator = activator;
useflag = qfalse;
self->svFlags |= SVF_INACTIVE; // Make it inactive after one use
if (self->spawnflags & ENTDIST_PLAYER) // Look for player???
{
found = &g_entities[0];
if (found)
{
VectorSubtract(owner->currentOrigin, found->currentOrigin, diff);
if(VectorLength(diff) < self->count)
{
useflag = qtrue;
}
}
}
if ((self->spawnflags & ENTDIST_NPC) && (!useflag))
{
holdString = self->NPC_target;
while (holdString)
{
token = COM_Parse( &holdString);
if ( !token ) // Nothing left to look at
{
break;
}
found = G_Find(found, FOFS(targetname), token); // Look for the specified NPC
if (found) //Found???
{
VectorSubtract(owner->currentOrigin, found->currentOrigin, diff);
if(VectorLength(diff) < self->count) // Within distance
{
useflag = qtrue;
break;
}
}
}
}
if (useflag)
{
G_UseTargets2 (self, self->activator, self->target);
}
else if (self->target2)
{
// This is the negative target
G_UseTargets2 (self, self->activator, self->target2);
}
}
示例10: SV_LoadGame_f
void SV_LoadGame_f (void) {
char name[MAX_OSPATH], mapname[MAX_QPATH], str[32 * 1024], *start;
FILE *f;
float time, tfloat, spawn_parms[NUM_SPAWN_PARMS];
edict_t *ent;
int entnum, version, r;
unsigned int i;
if (Cmd_Argc() != 2) {
Com_Printf ("Usage: %s <savename> : load a game\n", Cmd_Argv(0));
return;
}
snprintf (name, sizeof (name), "%s/save/%s", com_gamedir, Cmd_Argv(1));
COM_DefaultExtension (name, ".sav");
Com_Printf ("Loading game from %s...\n", name);
if (!(f = fopen (name, "rb"))) {
Com_Printf ("ERROR: couldn't open.\n");
return;
}
fscanf (f, "%i\n", &version);
if (version != SAVEGAME_VERSION) {
fclose (f);
Com_Printf ("Savegame is version %i, not %i\n", version, SAVEGAME_VERSION);
return;
}
fscanf (f, "%s\n", str);
for (i = 0; i < NUM_SPAWN_PARMS; i++)
fscanf (f, "%f\n", &spawn_parms[i]);
// this silliness is so we can load 1.06 save files, which have float skill values
fscanf (f, "%f\n", &tfloat);
current_skill = (int)(tfloat + 0.1);
Cvar_Set (&skill, va("%i", current_skill));
Cvar_SetValue (&deathmatch, 0);
Cvar_SetValue (&coop, 0);
Cvar_SetValue (&teamplay, 0);
Cvar_SetValue (&maxclients, 1);
fscanf (f, "%s\n", mapname);
fscanf (f, "%f\n", &time);
Host_EndGame();
CL_BeginLocalConnection ();
SV_SpawnServer (mapname, false);
if (sv.state != ss_active) {
Com_Printf ("Couldn't load map\n");
return;
}
Cvar_ForceSet (&sv_paused, "1"); // pause until all clients connect
sv.loadgame = true;
// load the light styles
for (i = 0; i < MAX_LIGHTSTYLES; i++) {
fscanf (f, "%s\n", str);
sv.lightstyles[i] = (char *) Hunk_Alloc (strlen(str) + 1);
strlcpy (sv.lightstyles[i], str, strlen(str) + 1);
}
// load the edicts out of the savegame file
entnum = -1; // -1 is the globals
while (!feof(f)) {
for (i = 0; i < sizeof(str) - 1; i++) {
r = fgetc (f);
if (r == EOF || !r)
break;
str[i] = r;
if (r == '}') {
i++;
break;
}
}
if (i == sizeof(str)-1)
Host_Error ("Loadgame buffer overflow");
str[i] = 0;
start = str;
start = COM_Parse(str);
if (!com_token[0])
break; // end of file
if (strcmp(com_token,"{"))
Host_Error ("First token isn't a brace");
if (entnum == -1) {
// parse the global vars
ED_ParseGlobals (start);
} else {
// parse an edict
ent = EDICT_NUM(entnum);
memset (&ent->v, 0, progs->entityfields * 4);
ent->free = false;
ED_ParseEdict (start, ent);
//.........这里部分代码省略.........
示例11: SCR_ExecuteLayoutString
/*
================
SCR_ExecuteLayoutString
================
*/
void SCR_ExecuteLayoutString (char *s)
{
int x, y;
int value;
char *token;
int width;
int index;
clientinfo_t *ci;
if (cls.state != ca_active || !cl.refresh_prepped)
return;
if (!s[0])
return;
x = 0;
y = 0;
width = 3;
while (s)
{
token = COM_Parse (&s);
if (!strcmp(token, "xl"))
{
token = COM_Parse (&s);
x = atoi(token);
continue;
}
if (!strcmp(token, "xr"))
{
token = COM_Parse (&s);
x = viddef.width + atoi(token);
continue;
}
if (!strcmp(token, "xv"))
{
token = COM_Parse (&s);
x = viddef.width/2 - 160 + atoi(token);
continue;
}
if (!strcmp(token, "yt"))
{
token = COM_Parse (&s);
y = atoi(token);
continue;
}
if (!strcmp(token, "yb"))
{
token = COM_Parse (&s);
y = viddef.height + atoi(token);
continue;
}
if (!strcmp(token, "yv"))
{
token = COM_Parse (&s);
y = viddef.height/2 - 120 + atoi(token);
continue;
}
if (!strcmp(token, "pic"))
{ // draw a pic from a stat number
token = COM_Parse (&s);
value = cl.frame.playerstate.stats[atoi(token)];
if (value >= MAX_IMAGES)
Com_Error (ERR_DROP, "Pic >= MAX_IMAGES");
if (cl.configstrings[CS_IMAGES+value])
{
SCR_AddDirtyPoint (x, y);
SCR_AddDirtyPoint (x+23, y+23);
re.DrawPic (x, y, cl.configstrings[CS_IMAGES+value]);
}
continue;
}
if (!strcmp(token, "client"))
{ // draw a deathmatch client block
int score, ping, time;
token = COM_Parse (&s);
x = viddef.width/2 - 160 + atoi(token);
token = COM_Parse (&s);
y = viddef.height/2 - 120 + atoi(token);
SCR_AddDirtyPoint (x, y);
SCR_AddDirtyPoint (x+159, y+31);
token = COM_Parse (&s);
value = atoi(token);
if (value >= MAX_CLIENTS || value < 0)
Com_Error (ERR_DROP, "client >= MAX_CLIENTS");
ci = &cl.clientinfo[value];
token = COM_Parse (&s);
score = atoi(token);
//.........这里部分代码省略.........
示例12: VM_LoadSymbols
/*
===============
VM_LoadSymbols
===============
*/
void VM_LoadSymbols( vm_t *vm ) {
int len;
char *mapfile, *text_p, *token;
char name[MAX_QPATH];
char symbols[MAX_QPATH];
vmSymbol_t **prev, *sym;
int count;
int value;
int chars;
int segment;
int numInstructions;
// don't load symbols if not developer
if ( !com_developer->integer ) {
return;
}
COM_StripExtension( vm->name, name );
Com_sprintf( symbols, sizeof( symbols ), "vm/%s.map", name );
len = FS_ReadFile( symbols, (void **)&mapfile );
if ( !mapfile ) {
Com_Printf( "Couldn't load symbol file: %s\n", symbols );
return;
}
numInstructions = vm->instructionPointersLength >> 2;
// parse the symbols
text_p = mapfile;
prev = &vm->symbols;
count = 0;
while ( 1 ) {
token = COM_Parse( &text_p );
if ( !token[0] ) {
break;
}
segment = ParseHex( token );
if ( segment ) {
COM_Parse( &text_p );
COM_Parse( &text_p );
continue; // only load code segment values
}
token = COM_Parse( &text_p );
if ( !token[0] ) {
Com_Printf( "WARNING: incomplete line at end of file\n" );
break;
}
value = ParseHex( token );
token = COM_Parse( &text_p );
if ( !token[0] ) {
Com_Printf( "WARNING: incomplete line at end of file\n" );
break;
}
chars = strlen( token );
sym = Hunk_Alloc( sizeof( *sym ) + chars, h_high );
*prev = sym;
prev = &sym->next;
sym->next = NULL;
// convert value from an instruction number to a code offset
if ( value >= 0 && value < numInstructions ) {
value = vm->instructionPointers[value];
}
sym->symValue = value;
Q_strncpyz( sym->symName, token, chars + 1 );
count++;
}
vm->numSymbols = count;
Com_Printf( "%i symbols parsed from %s\n", count, symbols );
FS_FreeFile( mapfile );
}
示例13: IN_IsConsoleKey
static qboolean IN_IsConsoleKey(keyNum_t key, int character)
{
typedef struct consoleKey_s
{
enum
{
KEY,
CHARACTER
} type;
union
{
keyNum_t key;
int character;
} u;
} consoleKey_t;
static consoleKey_t consoleKeys[MAX_CONSOLE_KEYS];
static int numConsoleKeys = 0;
int i;
// Only parse the variable when it changes
if (cl_consoleKeys->modified)
{
char *text_p, *token;
cl_consoleKeys->modified = qfalse;
text_p = cl_consoleKeys->string;
numConsoleKeys = 0;
while (numConsoleKeys < MAX_CONSOLE_KEYS)
{
consoleKey_t *c = &consoleKeys[numConsoleKeys];
int charCode = 0;
token = COM_Parse(&text_p);
if (!token[0])
{
break;
}
if (strlen(token) == 4)
{
charCode = Com_HexStrToInt(token);
}
if (charCode > 0)
{
c->type = CHARACTER;
c->u.character = charCode;
}
else
{
c->type = KEY;
c->u.key = Key_StringToKeynum(token);
// 0 isn't a key
if (c->u.key <= 0)
{
continue;
}
}
numConsoleKeys++;
}
}
// If the character is the same as the key, prefer the character
if (key == character)
{
key = 0;
}
for (i = 0; i < numConsoleKeys; i++)
{
consoleKey_t *c = &consoleKeys[i];
switch (c->type)
{
case KEY:
if (key && c->u.key == key)
{
return qtrue;
}
break;
case CHARACTER:
if (c->u.character == character)
{
return qtrue;
}
break;
}
}
return qfalse;
}
示例14: AnimParseAnimConfig
/*
============
AnimParseAnimConfig
returns qfalse if error, qtrue otherwise
============
*/
static qboolean AnimParseAnimConfig( playerInfo_t *animModelInfo, const char *filename, const char *input ) {
char *text_p, *token;
animation_t *animations;
// headAnimation_t *headAnims;
int i, fps, skip = -1;
// if (!weaponStringsInited) {
// BG_InitWeaponStrings();
// }
// globalFilename = (char *)filename;
animations = animModelInfo->animations;
animModelInfo->numAnimations = 0;
// headAnims = animModelInfo->headAnims;
text_p = (char *)input;
COM_BeginParseSession( "AnimParseAnimConfig" );
animModelInfo->footsteps = FOOTSTEP_NORMAL;
VectorClear( animModelInfo->headOffset );
animModelInfo->gender = GENDER_MALE;
animModelInfo->isSkeletal = qfalse;
animModelInfo->version = 0;
// read optional parameters
while ( 1 ) {
token = COM_Parse( &text_p );
if ( !token ) {
break;
}
if ( !Q_stricmp( token, "footsteps" ) ) {
token = COM_Parse( &text_p );
if ( !token ) {
break;
}
if ( !Q_stricmp( token, "default" ) || !Q_stricmp( token, "normal" ) ) {
animModelInfo->footsteps = FOOTSTEP_NORMAL;
} else if ( !Q_stricmp( token, "boot" ) ) {
animModelInfo->footsteps = FOOTSTEP_BOOT;
} else if ( !Q_stricmp( token, "flesh" ) ) {
animModelInfo->footsteps = FOOTSTEP_FLESH;
} else if ( !Q_stricmp( token, "mech" ) ) {
animModelInfo->footsteps = FOOTSTEP_MECH;
} else if ( !Q_stricmp( token, "energy" ) ) {
animModelInfo->footsteps = FOOTSTEP_ENERGY;
} else {
// BG_AnimParseError( "Bad footsteps parm '%s'\n", token );
}
continue;
} else if ( !Q_stricmp( token, "headoffset" ) ) {
for ( i = 0 ; i < 3 ; i++ ) {
token = COM_Parse( &text_p );
if ( !token ) {
break;
}
animModelInfo->headOffset[i] = atof( token );
}
continue;
} else if ( !Q_stricmp( token, "sex" ) ) {
token = COM_Parse( &text_p );
if ( !token ) {
break;
}
if ( token[0] == 'f' || token[0] == 'F' ) {
animModelInfo->gender = GENDER_FEMALE;
} else if ( token[0] == 'n' || token[0] == 'N' ) {
animModelInfo->gender = GENDER_NEUTER;
} else {
animModelInfo->gender = GENDER_MALE;
}
continue;
} else if ( !Q_stricmp( token, "version" ) ) {
token = COM_Parse( &text_p );
if ( !token ) {
break;
}
animModelInfo->version = atoi( token );
continue;
} else if ( !Q_stricmp( token, "skeletal" ) ) {
animModelInfo->isSkeletal = qtrue;
continue;
}
if ( animModelInfo->version < 2 ) {
// if it is a number, start parsing animations
if ( Q_isnumeric( token[0] ) ) {
text_p -= strlen( token ); // unget the token
break;
}
}
// STARTANIMS marks the start of the animations
//.........这里部分代码省略.........
示例15: AICast_ScriptParse
void AICast_ScriptParse( cast_state_t *cs ) {
#define MAX_SCRIPT_EVENTS 64
gentity_t *ent;
char *pScript;
char *token;
qboolean wantName;
qboolean inScript;
int eventNum;
cast_script_event_t events[MAX_SCRIPT_EVENTS];
int numEventItems;
cast_script_event_t *curEvent;
char params[MAX_QPATH];
cast_script_stack_action_t *action;
int i;
int bracketLevel;
qboolean buildScript; //----(SA) added
if ( !level.scriptAI ) {
return;
}
ent = &g_entities[cs->entityNum];
if ( !ent->aiName ) {
return;
}
buildScript = trap_Cvar_VariableIntegerValue( "com_buildScript" );
buildScript = qtrue;
pScript = level.scriptAI;
wantName = qtrue;
inScript = qfalse;
COM_BeginParseSession( "AICast_ScriptParse" );
bracketLevel = 0;
numEventItems = 0;
memset( events, 0, sizeof( events ) );
while ( 1 )
{
token = COM_Parse( &pScript );
if ( !token[0] ) {
if ( !wantName ) {
G_Error( "AICast_ScriptParse(), Error (line %d): '}' expected, end of script found.\n", COM_GetCurrentParseLine() );
}
break;
}
// end of script
if ( token[0] == '}' ) {
if ( inScript ) {
break;
}
if ( wantName ) {
G_Error( "AICast_ScriptParse(), Error (line %d): '}' found, but not expected.\n", COM_GetCurrentParseLine() );
}
wantName = qtrue;
} else if ( token[0] == '{' ) {
if ( wantName ) {
G_Error( "AICast_ScriptParse(), Error (line %d): '{' found, NAME expected.\n", COM_GetCurrentParseLine() );
}
} else if ( wantName ) {
if ( !Q_strcasecmp( ent->aiName, token ) ) {
inScript = qtrue;
numEventItems = 0;
}
wantName = qfalse;
} else if ( inScript ) {
if ( !Q_strcasecmp( token, "attributes" ) ) {
// read in all the attributes
AICast_CheckLevelAttributes( cs, ent, &pScript );
continue;
}
eventNum = AICast_EventForString( token );
if ( eventNum < 0 ) {
G_Error( "AICast_ScriptParse(), Error (line %d): unknown event: %s.\n", COM_GetCurrentParseLine(), token );
}
if ( numEventItems >= MAX_SCRIPT_EVENTS ) {
G_Error( "AICast_ScriptParse(), Error (line %d): MAX_SCRIPT_EVENTS reached (%d)\n", COM_GetCurrentParseLine(), MAX_SCRIPT_EVENTS );
}
// if this is a "friendlysightcorpse" event, then disable corpse vis sharing
if ( !Q_stricmp( token, "friendlysightcorpse" ) ) {
cs->aiFlags &= ~AIFL_CORPSESIGHTING;
}
curEvent = &events[numEventItems];
curEvent->eventNum = eventNum;
memset( params, 0, sizeof( params ) );
// parse any event params before the start of this event's actions
while ( ( token = COM_Parse( &pScript ) ) && ( token[0] != '{' ) )
{
if ( !token[0] ) {
G_Error( "AICast_ScriptParse(), Error (line %d): '}' expected, end of script found.\n", COM_GetCurrentParseLine() );
}
if ( eventNum == 13 ) { // statechange event, check params
if ( strlen( token ) > 1 ) {
//.........这里部分代码省略.........