void SP_worldspawn( void ) {
	char    *s;

	CG_SpawnString( "classname", "", &s );
	if ( Q_stricmp( s, "worldspawn" ) ) {
		CG_Error( "SP_worldspawn: The first entity isn't 'worldspawn'" );
	}

	CG_SpawnString( "enableDust", "0", &s );
	trap_Cvar_Set( "cg_enableDust", s );

	CG_SpawnString( "enableBreath", "0", &s );
	trap_Cvar_Set( "cg_enableBreath", s );

	if ( CG_SpawnVector2D( "mapcoordsmins", "-128 128", cg.mapcoordsMins ) &&  // top left
		 CG_SpawnVector2D( "mapcoordsmaxs", "128 -128", cg.mapcoordsMaxs ) ) { // bottom right
		cg.mapcoordsValid = qtrue;
	} else {
		cg.mapcoordsValid = qfalse;
	}

#if 0
	cg.mapcoordsScale[0] = 1 / ( cg.mapcoordsMaxs[0] - cg.mapcoordsMins[0] );
	cg.mapcoordsScale[1] = 1 / ( cg.mapcoordsMaxs[1] - cg.mapcoordsMins[1] );

	BG_InitLocations( cg.mapcoordsMins, cg.mapcoordsMaxs );
#endif

	CG_SpawnString( "atmosphere", "", &s );
	CG_EffectParse( s );

	CG_SpawnFloat( "skyalpha", "1", &cg.skyAlpha );
}
Beispiel #2
0
void SP_info_train_spline_main( void ) {
	char* targetname;
	char* target;
	char* control;
	vec3_t origin;
	int i;
	char* end;
	splinePath_t* spline;

	if ( !CG_SpawnVector( "origin", "0 0 0", origin ) ) {
		CG_Error( "info_train_spline_main with no origin\n" );
	}

	if ( !CG_SpawnString( "targetname", "", &targetname ) ) {
		CG_Error( "info_train_spline_main with no targetname at %s\n", vtos( origin ) );
	}

	CG_SpawnString( "target", "", &target );

	spline = BG_AddSplinePath( targetname, target, origin );

	if ( CG_SpawnString( "end", "", &end ) ) {
		spline->isEnd = true;
	} else if ( CG_SpawnString( "start", "", &end ) ) {
		spline->isStart = true;
	}

	for ( i = 1;; i++ ) {
		if ( !CG_SpawnString( i == 1 ? va( "control" ) : va( "control%i", i ), "", &control ) ) {
			break;
		}

		BG_AddSplineControl( spline, control );
	}
}
Beispiel #3
0
void SP_trigger_objective_info( void ) {
	char* temp;

	CG_SpawnString( "infoAllied", "^1No Text Supplied", &temp );
	Q_strncpyz( cg.oidTriggerInfoAllies[cg.numOIDtriggers2], temp, 256 );

	CG_SpawnString( "infoAxis", "^1No Text Supplied", &temp );
	Q_strncpyz( cg.oidTriggerInfoAxis[cg.numOIDtriggers2], temp, 256 );

	cg.numOIDtriggers2++;
}
/*
===================
CG_ParseEntityFromSpawnVars

Spawn an entity and fill in all of the level fields from
cg.spawnVars[], then call the class specfic spawn function
===================
*/
void CG_ParseEntityFromSpawnVars( void ) {
	spawn_t *s;
	int i;
	char *classname;
	char *p, *value, *gametypeName;
	static char *gametypeNames [] = { "ffa", "duel", "powerduel", "single", "team", "ctf", "cty" };

	// check for "notsingle" flag
	if( cgs.gametype == GT_SINGLE_PLAYER ) {
		CG_SpawnInt( "notsingle", "0", &i );
		if( i ) {
			return;
		}
	}

	// check for "notteam" flag (GT_FFA, GT_DUEL, GT_SINGLE_PLAYER)
	if( cgs.gametype >= GT_TEAM ) {
		CG_SpawnInt( "notteam", "0", &i );
		if( i ) {
			return;
		}
	}
	else {
		CG_SpawnInt( "notfree", "0", &i );
		if( i ) {
			return;
		}
	}

	if( CG_SpawnString( "gametype", NULL, &value ) ) {
		if( cgs.gametype >= GT_FFA && cgs.gametype < GT_MAX_GAME_TYPE ) {
			gametypeName = gametypeNames[cgs.gametype];

			p = strstr( value, gametypeName );
			if( !p ) {
				return;
			}
		}
	}

	if( CG_SpawnString( "classname", "", &classname ) ) {
		for( s = spawns; s->name; s++ ) {
			if( !Q_stricmp( s->name, classname ) ) {
				s->spawn();
				break;
			}
		}
	}
}
Beispiel #5
0
/*
===================
CG_ParseEntityFromSpawnVars

Spawn an entity and fill in all of the level fields from
cg.spawnVars[], then call the class specfic spawn function
===================
*/
void CG_ParseEntityFromSpawnVars(void)
{
    int  i;
    char *classname;

    // check for "notteam" / "notfree" flags
    CG_SpawnInt("notteam", "0", &i);
    if (i)
    {
        return;
    }

    if (CG_SpawnString("classname", "", &classname))
    {
        for (i = 0; i < NUMSPAWNS; i++)
        {
            if (!Q_stricmp(spawns[i].name, classname))
            {
                spawns[i].spawn();
                break;
            }
        }
    }

}
Beispiel #6
0
bool CG_SpawnFloat( const char *key, const char *defaultString, float *out ) {
	char        *s;
	bool present;

	present = CG_SpawnString( key, defaultString, &s );
	*out = atof( s );
	return present;
}
Beispiel #7
0
bool CG_SpawnInt( const char *key, const char *defaultString, int *out ) {
	char        *s;
	bool present;

	present = CG_SpawnString( key, defaultString, &s );
	*out = atoi( s );
	return present;
}
Beispiel #8
0
bool CG_SpawnVector2D( const char *key, const char *defaultString, float *out ) {
	char        *s;
	bool present;

	present = CG_SpawnString( key, defaultString, &s );
	sscanf( s, "%f %f", &out[0], &out[1] );
	return present;
}
void SP_worldspawn( void ) {
	char *s;

	CG_SpawnString( "classname", "", &s );
	if( Q_stricmp( s, "worldspawn" ) ) {
		CG_Error( "SP_worldspawn: The first entity isn't 'worldspawn'" );
	}

	CG_SpawnFloat( "fogstart", "0", &cg_linearFogOverride );
	CG_SpawnFloat( "radarrange", "2500", &cg_radarRange );
}
Beispiel #10
0
void SP_worldspawn(void) {
	char *s;

	CG_SpawnString("classname", "", &s);
	if (Q_stricmp(s, "worldspawn")) {
		CG_Error("SP_worldspawn: The first entity isn't 'worldspawn'");
	}

	if (CG_SpawnVector2D("mapcoordsmins", "-128 128", cg.mapcoordsMins) &&     // top left
	    CG_SpawnVector2D("mapcoordsmaxs", "128 -128", cg.mapcoordsMaxs)) {     // bottom right
		cg.mapcoordsValid = qtrue;
	} else {
		cg.mapcoordsValid = qfalse;
	}

	CG_ParseSpawns();

	BG_InitLocations(cg.mapcoordsMins, cg.mapcoordsMaxs);

	CG_SpawnString("atmosphere", "", &s);
	CG_EffectParse(s);
}
void SP_misc_weather_zone( void ) {
	char *model;
	vec3_t mins, maxs;

	CG_SpawnString( "model", "", &model );

	if( !model || !model[0] ) {
		CG_Error( "misc_weather_zone with invalid brush model data." );
		return;
	}

	trap_R_ModelBounds( trap_R_RegisterModel( model ), mins, maxs );

	trap_WE_AddWeatherZone( mins, maxs );
}
qboolean CG_SpawnBoolean( const char *key, const char *defaultString, qboolean *out ) {
	char *s;
	qboolean present;

	present = CG_SpawnString( key, defaultString, &s );
	if( !Q_stricmp( s, "qfalse" ) || !Q_stricmp( s, "false" ) || !Q_stricmp( s, "no" ) || !Q_stricmp( s, "0" ) ) {
		*out = qfalse;
	}
	else if( !Q_stricmp( s, "qtrue" ) || !Q_stricmp( s, "true" ) || !Q_stricmp( s, "yes" ) || !Q_stricmp( s, "1" ) ) {
		*out = qtrue;
	}
	else {
		*out = qfalse;
	}

	return present;
}
Beispiel #13
0
void SP_path_corner_2( void ) {
	char* targetname;
	vec3_t origin;

	CG_SpawnString( "targetname", "", &targetname );
	CG_SpawnVector( "origin", "0 0 0", origin );

	if ( !*targetname ) {
		CG_Error( "path_corner_2 with no targetname at %s\n", vtos( origin ) );
		return;
	}

	if ( numPathCorners >= MAX_PATH_CORNERS ) {
		CG_Error( "Maximum path_corners hit\n" );
		return;
	}

	BG_AddPathCorner( targetname, origin );
}
Beispiel #14
0
/*
===================
CG_ParseEntityFromSpawnVars

Spawn an entity and fill in all of the level fields from
cg.spawnVars[], then call the class specfic spawn function
===================
*/
void CG_ParseEntityFromSpawnVars( void ) {
	int i;
	char    *classname;
	bgEntitySpawnInfo_t spawnInfo;

	spawnInfo.gametype = cgs.gametype;
	spawnInfo.spawnInt = CG_SpawnInt;
	spawnInfo.spawnString = CG_SpawnString;

	// check "notsingle", "notfree", "notteam", etc
	if ( !BG_CheckSpawnEntity( &spawnInfo ) ) {
		return;
	}

	if ( CG_SpawnString( "classname", "", &classname ) ) {
		for ( i = 0; i < numSpawns; i++ ) {
			if ( !Q_stricmp( spawns[i].name, classname ) ) {
				spawns[i].spawn();
				break;
			}
		}
	}

}
Beispiel #15
0
void SP_misc_gamemodel( void ) {
	char* model;
	char* skin;
	vec_t angle;
	vec3_t angles;

	vec_t scale;
	vec3_t vScale;

	vec3_t org;

	cg_gamemodel_t* gamemodel;

	int i;

#if 0 // ZTM: Note: Spearmint's game always drops misc_gamemodels. Also, RTCW has targetname set though I'm not sure what, if anything, it's used for.
	if ( CG_SpawnString( "targetname", "", &model ) || CG_SpawnString( "scriptname", "", &model ) || CG_SpawnString( "spawnflags", "", &model ) ) {
		// Gordon: this model may not be static, so let the server handle it
		return;
	}
#endif

	if ( cg.numMiscGameModels >= MAX_STATIC_GAMEMODELS ) {
		CG_Error( "^1MAX_STATIC_GAMEMODELS(%i) hit", MAX_STATIC_GAMEMODELS );
	}

	CG_SpawnString( "model", "", &model );

	CG_SpawnString( "skin", "", &skin );

	CG_SpawnVector( "origin", "0 0 0", org );

	if ( !CG_SpawnVector( "angles", "0 0 0", angles ) ) {
		if ( CG_SpawnFloat( "angle", "0", &angle ) ) {
			angles[YAW] = angle;
		}
	}

	if ( !CG_SpawnVector( "modelscale_vec", "1 1 1", vScale ) ) {
		if ( CG_SpawnFloat( "modelscale", "1", &scale ) ) {
			VectorSet( vScale, scale, scale, scale );
		}
	}

	gamemodel = &cgs.miscGameModels[cg.numMiscGameModels++];
	gamemodel->model = trap_R_RegisterModel( model );

	if ( *skin ) {
		CG_RegisterSkin( skin, &gamemodel->skin, qfalse );
	}

	AnglesToAxis( angles, gamemodel->axes );
	for ( i = 0; i < 3; i++ ) {
		VectorScale( gamemodel->axes[i], vScale[i], gamemodel->axes[i] );
	}
	VectorCopy( org, gamemodel->org );

	if ( gamemodel->model ) {
		vec3_t mins, maxs;

		trap_R_ModelBounds( gamemodel->model, mins, maxs, 0, 0, 0 );

		for ( i = 0; i < 3; i++ ) {
			mins[i] *= vScale[i];
			maxs[i] *= vScale[i];
		}

		gamemodel->radius = RadiusFromBounds( mins, maxs );
	} else {
		gamemodel->radius = 0;
	}
}
void SP_misc_model_static( void ) {
	char* model;
	vec_t angle;
	vec3_t angles;
	vec_t scale;
	vec3_t vScale;
	vec3_t org;
	vec_t zoffset;
	int i;
	int modelIndex;
	cg_staticmodel_t *staticmodel;

	if( cgs.numMiscStaticModels >= MAX_STATIC_MODELS ) {
		CG_Error( "MAX_STATIC_MODELS(%i) hit", MAX_STATIC_MODELS );
	}

	CG_SpawnString( "model", "", &model );

	if( !model || !model[0] ) {
		CG_Error( "misc_model_static with no model." );
	}

	CG_SpawnVector( "origin", "0 0 0", org );
	CG_SpawnFloat( "zoffset", "0", &zoffset );

	if( !CG_SpawnVector( "angles", "0 0 0", angles ) ) {
		if( CG_SpawnFloat( "angle", "0", &angle ) ) {
			angles[YAW] = angle;
		}
	}

	if( !CG_SpawnVector( "modelscale_vec", "1 1 1", vScale ) ) {
		if( CG_SpawnFloat( "modelscale", "1", &scale ) ) {
			VectorSet( vScale, scale, scale, scale );
		}
	}

	modelIndex = trap_R_RegisterModel( model );
	if( modelIndex == 0 ) {
		CG_Error( "misc_model_static failed to load model '%s'", model );
		return;
	}

	staticmodel		= &cgs.miscStaticModels[cgs.numMiscStaticModels++];
	staticmodel->model	= modelIndex;
	AnglesToAxis( angles, staticmodel->axes );
	for( i = 0; i < 3; i++ ) {
		VectorScale( staticmodel->axes[i], vScale[i], staticmodel->axes[i] );
	}

	VectorCopy( org, staticmodel->org );
	staticmodel->zoffset = zoffset;

	if( staticmodel->model ) {
		vec3_t mins, maxs;

		trap_R_ModelBounds( staticmodel->model, mins, maxs );

		VectorScaleVector( mins, vScale, mins );
		VectorScaleVector( maxs, vScale, maxs );

		staticmodel->radius = RadiusFromBounds( mins, maxs );
	}
	else {
		staticmodel->radius = 0;
	}
}
Beispiel #17
0
void SP_worldspawn( void ) {
	char    *s;
	int i;

	CG_SpawnString( "classname", "", &s );
	if ( Q_stricmp( s, "worldspawn" ) ) {
		CG_Error( "SP_worldspawn: The first entity isn't 'worldspawn'" );
	}

	cgs.ccLayers = 0;

	if ( CG_SpawnVector2D( "mapcoordsmins", "-128 128", cg.mapcoordsMins ) &&  // top left
		 CG_SpawnVector2D( "mapcoordsmaxs", "128 -128", cg.mapcoordsMaxs ) ) { // bottom right
		cg.mapcoordsValid = true;
	} else {
		cg.mapcoordsValid = false;
	}

	CG_ParseSpawns();

	CG_SpawnString( "cclayers", "0", &s );
	cgs.ccLayers = atoi( s );

	for ( i = 0; i < cgs.ccLayers; i++ ) {
		CG_SpawnString( va( "cclayerceil%i",i ), "0", &s );
		cgs.ccLayerCeils[i] = atoi( s );
	}

	cg.mapcoordsScale[0] = 1 / ( cg.mapcoordsMaxs[0] - cg.mapcoordsMins[0] );
	cg.mapcoordsScale[1] = 1 / ( cg.mapcoordsMaxs[1] - cg.mapcoordsMins[1] );

	BG_InitLocations( cg.mapcoordsMins, cg.mapcoordsMaxs );

	CG_SpawnString( "atmosphere", "", &s );
	CG_EffectParse( s );

	cg.fiveMinuteSound_g[0] = \
		cg.fiveMinuteSound_a[0] = \
			cg.twoMinuteSound_g[0] = \
				cg.twoMinuteSound_a[0] = \
					cg.thirtySecondSound_g[0] =	\
						cg.thirtySecondSound_a[0] = '\0';

	CG_SpawnString( "twoMinuteSound_axis", "axis_hq_5minutes", &s );
	Q_strncpyz( cg.fiveMinuteSound_g, s, sizeof( cg.fiveMinuteSound_g ) );
	CG_SpawnString( "twoMinuteSound_allied", "allies_hq_5minutes", &s );
	Q_strncpyz( cg.fiveMinuteSound_a, s, sizeof( cg.fiveMinuteSound_a ) );

	CG_SpawnString( "twoMinuteSound_axis", "axis_hq_2minutes", &s );
	Q_strncpyz( cg.twoMinuteSound_g, s, sizeof( cg.twoMinuteSound_g ) );
	CG_SpawnString( "twoMinuteSound_allied", "allies_hq_2minutes", &s );
	Q_strncpyz( cg.twoMinuteSound_a, s, sizeof( cg.twoMinuteSound_a ) );

	CG_SpawnString( "thirtySecondSound_axis", "axis_hq_30seconds", &s );
	Q_strncpyz( cg.thirtySecondSound_g, s, sizeof( cg.thirtySecondSound_g ) );
	CG_SpawnString( "thirtySecondSound_allied", "allies_hq_30seconds", &s );
	Q_strncpyz( cg.thirtySecondSound_a, s, sizeof( cg.thirtySecondSound_a ) );

	// 5 minute axis
	if ( !*cg.fiveMinuteSound_g ) {
		cgs.media.fiveMinuteSound_g = 0;
	} else if ( strstr( cg.fiveMinuteSound_g, ".wav" ) ) {
		cgs.media.fiveMinuteSound_g = trap_S_RegisterSound( cg.fiveMinuteSound_g, true );
	} else {
		cgs.media.fiveMinuteSound_g = -1;
	}

	// 5 minute allied
	if ( !*cg.fiveMinuteSound_a ) {
		cgs.media.fiveMinuteSound_a = 0;
	} else if ( strstr( cg.fiveMinuteSound_a, ".wav" ) ) {
		cgs.media.fiveMinuteSound_a = trap_S_RegisterSound( cg.fiveMinuteSound_a, true );
	} else {
		cgs.media.fiveMinuteSound_a = -1;
	}

	// 2 minute axis
	if ( !*cg.twoMinuteSound_g ) {
		cgs.media.twoMinuteSound_g = 0;
	} else if ( strstr( cg.twoMinuteSound_g, ".wav" ) ) {
		cgs.media.twoMinuteSound_g = trap_S_RegisterSound( cg.twoMinuteSound_g, true );
	} else {
		cgs.media.twoMinuteSound_g = -1;
	}

	// 2 minute allied
	if ( !*cg.twoMinuteSound_a ) {
		cgs.media.twoMinuteSound_a = 0;
	} else if ( strstr( cg.twoMinuteSound_a, ".wav" ) ) {
		cgs.media.twoMinuteSound_a = trap_S_RegisterSound( cg.twoMinuteSound_a, true );
	} else {
		cgs.media.twoMinuteSound_a = -1;
	}

	// 30 seconds axis
	if ( !*cg.thirtySecondSound_g ) {
		cgs.media.thirtySecondSound_g = 0;
	} else if ( strstr( cg.thirtySecondSound_g, ".wav" ) ) {
		cgs.media.thirtySecondSound_g = trap_S_RegisterSound( cg.thirtySecondSound_g, true );
	} else {
		cgs.media.thirtySecondSound_g = -1;
	}

	// 30 seconds allied
	if ( !*cg.thirtySecondSound_a ) {
		cgs.media.thirtySecondSound_a = 0;
	} else if ( strstr( cg.thirtySecondSound_a, ".wav" ) ) {
		cgs.media.thirtySecondSound_a = trap_S_RegisterSound( cg.thirtySecondSound_a, true );
	} else {
		cgs.media.thirtySecondSound_a = -1;
	}
}
Beispiel #18
0
void SP_misc_gamemodel( void ) {
	char* model;
	vec_t angle;
	vec3_t angles;

	vec_t scale;
	vec3_t vScale;

	vec3_t org;

	cg_gamemodel_t* gamemodel;

	int i;

	if ( CG_SpawnString( "targetname", "", &model ) || CG_SpawnString( "scriptname", "", &model ) || CG_SpawnString( "spawnflags", "", &model ) ) {
		// Gordon: this model may not be static, so let the server handle it
		return;
	}

	if ( cg.numMiscGameModels >= MAX_STATIC_GAMEMODELS ) {
		CG_Error( "^1MAX_STATIC_GAMEMODELS(%i) hit", MAX_STATIC_GAMEMODELS );
	}

	CG_SpawnString( "model", "", &model );

	CG_SpawnVector( "origin", "0 0 0", org );

	if ( !CG_SpawnVector( "angles", "0 0 0", angles ) ) {
		if ( CG_SpawnFloat( "angle", "0", &angle ) ) {
			angles[YAW] = angle;
		}
	}

	if ( !CG_SpawnVector( "modelscale_vec", "1 1 1", vScale ) ) {
		if ( CG_SpawnFloat( "modelscale", "1", &scale ) ) {
			VectorSet( vScale, scale, scale, scale );
		}
	}

	gamemodel = &cgs.miscGameModels[cg.numMiscGameModels++];
	gamemodel->model = trap_R_RegisterModel( model );
	AnglesToAxis( angles, gamemodel->axes );
	for ( i = 0; i < 3; i++ ) {
		VectorScale( gamemodel->axes[i], vScale[i], gamemodel->axes[i] );
	}
	VectorCopy( org, gamemodel->org );

	if ( gamemodel->model ) {
		vec3_t mins, maxs;

		trap_R_ModelBounds( gamemodel->model, mins, maxs );

		for ( i = 0; i < 3; i++ ) {
			mins[i] *= vScale[i];
			maxs[i] *= vScale[i];
		}

		gamemodel->radius = RadiusFromBounds( mins, maxs );
	} else {
		gamemodel->radius = 0;
	}
}