/* =============== CG_ParseTrailSystem Parse a trail system section =============== */ static bool CG_ParseTrailSystem( baseTrailSystem_t *bts, const char **text_p, const char *name ) { char *token; // read optional parameters while ( 1 ) { token = COM_Parse( text_p ); if ( !*token ) { return false; } if ( !Q_stricmp( token, "{" ) ) { CG_InitialiseBaseTrailBeam( &baseTrailBeams[ numBaseTrailBeams ] ); if ( !CG_ParseTrailBeam( &baseTrailBeams[ numBaseTrailBeams ], text_p ) ) { Log::Warn( "failed to parse trail beam" ); return false; } if ( bts->numBeams == MAX_BEAMS_PER_SYSTEM ) { Log::Warn( "trail system has > %d beams", MAX_BEAMS_PER_SYSTEM ); return false; } else if ( numBaseTrailBeams == MAX_BASETRAIL_BEAMS ) { Log::Warn( "maximum number of trail beams (%d) reached", MAX_BASETRAIL_BEAMS ); return false; } else { //start parsing beams again bts->beams[ bts->numBeams ] = &baseTrailBeams[ numBaseTrailBeams ]; bts->numBeams++; numBaseTrailBeams++; } continue; } else if ( !Q_stricmp( token, "thirdPersonOnly" ) ) { bts->thirdPersonOnly = true; } else if ( !Q_stricmp( token, "lifeTime" ) ) { token = COM_Parse( text_p ); if ( !*token ) { break; } bts->lifeTime = atoi_neg( token, false ); continue; } else if ( !Q_stricmp( token, "beam" ) ) //acceptable text { continue; } else if ( !Q_stricmp( token, "}" ) ) { if ( cg_debugTrails.integer >= 1 ) { Log::Warn( "Parsed trail system %s", name ); } return true; //reached the end of this trail system } else { Log::Warn( "unknown token '%s' in trail system %s", token, bts->name ); return false; } } return false; }
/* =============== CG_ParseTrailSystem Parse a trail system section =============== */ static bool CG_ParseTrailSystem( baseTrailSystem_t *bts, char **text_p, const char *name ) { char *token; // read optional parameters while( 1 ) { token = COM_Parse( text_p ); if( !Q_stricmp( token, "" ) ) return false; if( !Q_stricmp( token, "{" ) ) { CG_InitialiseBaseTrailBeam( &baseTrailBeams[ numBaseTrailBeams ] ); if( !CG_ParseTrailBeam( &baseTrailBeams[ numBaseTrailBeams ], text_p ) ) { CG_Printf( S_COLOR_RED "ERROR: failed to parse trail beam\n" ); return false; } if( bts->numBeams == MAX_BEAMS_PER_SYSTEM ) { CG_Printf( S_COLOR_RED "ERROR: trail system has > %d beams\n", MAX_BEAMS_PER_SYSTEM ); return false; } else if( numBaseTrailBeams == MAX_BASETRAIL_BEAMS ) { CG_Printf( S_COLOR_RED "ERROR: maximum number of trail beams (%d) reached\n", MAX_BASETRAIL_BEAMS ); return false; } else { //start parsing beams again bts->beams[ bts->numBeams ] = &baseTrailBeams[ numBaseTrailBeams ]; bts->numBeams++; numBaseTrailBeams++; } continue; } else if( !Q_stricmp( token, "thirdPersonOnly" ) ) bts->thirdPersonOnly = true; else if( !Q_stricmp( token, "beam" ) ) //acceptable text continue; else if( !Q_stricmp( token, "}" ) ) { if( cg_debugTrails.integer >= 1 ) CG_Printf( "Parsed trail system %s\n", name ); return true; //reached the end of this trail system } else { CG_Printf( S_COLOR_RED "ERROR: unknown token '%s' in trail system %s\n", token, bts->name ); return false; } } return false; }