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 );
}
/*QUAKED worldspawn (0 0 0) ? NO_GT_WOLF NO_GT_STOPWATCH NO_GT_CHECKPOINT NO_LMS

Every map should have exactly one worldspawn.
"music"     Music wav file
"gravity"   800 is default gravity
"message" Text to print during connection process
"ambient"  Ambient light value (must use '_color')
"_color"    Ambient light color (must be used with 'ambient')
"sun"        Shader to use for 'sun' image
*/
void SP_worldspawn( void ) {
	char    *s;

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

	// make some data visible to connecting client
	trap_SetConfigstring( CS_GAME_VERSION, GAME_VERSION );

	trap_SetConfigstring( CS_LEVEL_START_TIME, va( "%i", level.startTime ) );

	G_SpawnString( "music", "", &s );
	trap_SetConfigstring( CS_MUSIC, s );

	G_SpawnString( "message", "", &s );
	trap_SetConfigstring( CS_MESSAGE, s );              // map specific message

	G_SpawnString( "cclayers", "0", &s );
	if ( atoi( s ) ) {
		level.ccLayers = qtrue;
	}

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

	BG_InitLocations( level.mapcoordsMins, level.mapcoordsMaxs );

	trap_SetConfigstring( CS_MOTD, g_motd.string );     // message of the day

	G_SpawnString( "gravity", "800", &s );
	trap_Cvar_Set( "g_gravity", s );

	G_SpawnString( "spawnflags", "0", &s );
	g_entities[ENTITYNUM_WORLD].spawnflags = atoi( s );
	g_entities[ENTITYNUM_WORLD].r.worldflags = g_entities[ENTITYNUM_WORLD].spawnflags;

	g_entities[ENTITYNUM_WORLD].s.number = ENTITYNUM_WORLD;
	g_entities[ENTITYNUM_WORLD].classname = "worldspawn";

	// see if we want a warmup time
	trap_SetConfigstring( CS_WARMUP, "" );
	if ( g_restarted.integer ) {
		trap_Cvar_Set( "g_restarted", "0" );
		level.warmupTime = 0;
	}

	if ( g_gamestate.integer == GS_PLAYING ) {
		G_initMatch();
	}
}
Exemple #3
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);
}
Exemple #4
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;
	}
}