コード例 #1
0
ファイル: world.cpp プロジェクト: ET-NiK/amxxgroup
void CWorld :: Precache( void )
{
	g_pLastSpawn = NULL;
	
	CVAR_SET_STRING("sv_gravity", "800"); // 67ft/sec
	CVAR_SET_STRING("sv_stepsize", "18");
	CVAR_SET_STRING("room_type", "0"); // clear DSP

	// Create all the arenas
	for (int i = 0; i < MAX_ARENAS; i++)
	{
		g_pArenaList[i] = GetClassPtr( ( CDiscArena *)NULL );
		g_pArenaList[i]->Spawn();
	}

	// Set up game rules
	if (g_pGameRules)
	{
		delete g_pGameRules;
	}

	g_pGameRules = InstallGameRules( );

	//!!!UNDONE why is there so much Spawn code in the Precache function? I'll just keep it here 

	///!!!LATER - do we want a sound ent in deathmatch? (sjb)
	//pSoundEnt = CBaseEntity::Create( "soundent", g_vecZero, g_vecZero, edict() );
	pSoundEnt = GetClassPtr( ( CSoundEnt *)NULL );
	pSoundEnt->Spawn();

	if ( !pSoundEnt )
	{
		ALERT ( at_console, "**COULD NOT CREATE SOUNDENT**\n" );
	}

	InitBodyQue();
	
// init sentence group playback stuff from sentences.txt.
// ok to call this multiple times, calls after first are ignored.

	SENTENCEG_Init();

// init texture type array from materials.txt

	TEXTURETYPE_Init();


// the area based ambient sounds MUST be the first precache_sounds

// player precaches     
	W_Precache ();									// get weapon precaches

	ClientPrecache();

// sounds used from C physics code
	PRECACHE_SOUND("common/null.wav");				// clears sound channels

	PRECACHE_SOUND( "items/suitchargeok1.wav" );//!!! temporary sound for respawning weapons.
	PRECACHE_SOUND( "items/gunpickup2.wav" );// player picks up a gun.

	PRECACHE_SOUND( "common/bodydrop3.wav" );// dead bodies hitting the ground (animation events)
	PRECACHE_SOUND( "common/bodydrop4.wav" );

	PRECACHE_SOUND( "r_tele1.wav" );	// respawn sound
	PRECACHE_SOUND( "scream1.wav" );	// falling scream sound
	PRECACHE_SOUND( "scream2.wav" );	// falling scream sound
	PRECACHE_SOUND( "scream3.wav" );	// falling scream sound
	PRECACHE_SOUND( "decap.wav" );		// decapitation sound
	PRECACHE_SOUND( "shatter.wav" );	// freeze decapitation sound
	PRECACHE_MODEL( "models/head.mdl" ); // head
	
	g_Language = (int)CVAR_GET_FLOAT( "sv_language" );
	if ( g_Language == LANGUAGE_GERMAN )
	{
		PRECACHE_MODEL( "models/germangibs.mdl" );
	}
	else
	{
		PRECACHE_MODEL( "models/hgibs.mdl" );
		PRECACHE_MODEL( "models/agibs.mdl" );
	}

	PRECACHE_SOUND ("weapons/ric1.wav");
	PRECACHE_SOUND ("weapons/ric2.wav");
	PRECACHE_SOUND ("weapons/ric3.wav");
	PRECACHE_SOUND ("weapons/ric4.wav");
	PRECACHE_SOUND ("weapons/ric5.wav");
//
// Setup light animation tables. 'a' is total darkness, 'z' is maxbright.
//

	// 0 normal
	LIGHT_STYLE(0, "m");
	
	// 1 FLICKER (first variety)
	LIGHT_STYLE(1, "mmnmmommommnonmmonqnmmo");
	
	// 2 SLOW STRONG PULSE
	LIGHT_STYLE(2, "abcdefghijklmnopqrstuvwxyzyxwvutsrqponmlkjihgfedcba");
	
	// 3 CANDLE (first variety)
	LIGHT_STYLE(3, "mmmmmaaaaammmmmaaaaaabcdefgabcdefg");
	
	// 4 FAST STROBE
	LIGHT_STYLE(4, "mamamamamama");
	
	// 5 GENTLE PULSE 1
	LIGHT_STYLE(5,"jklmnopqrstuvwxyzyxwvutsrqponmlkj");
	
	// 6 FLICKER (second variety)
	LIGHT_STYLE(6, "nmonqnmomnmomomno");
	
	// 7 CANDLE (second variety)
	LIGHT_STYLE(7, "mmmaaaabcdefgmmmmaaaammmaamm");
	
	// 8 CANDLE (third variety)
	LIGHT_STYLE(8, "mmmaaammmaaammmabcdefaaaammmmabcdefmmmaaaa");
	
	// 9 SLOW STROBE (fourth variety)
	LIGHT_STYLE(9, "aaaaaaaazzzzzzzz");
	
	// 10 FLUORESCENT FLICKER
	LIGHT_STYLE(10, "mmamammmmammamamaaamammma");

	// 11 SLOW PULSE NOT FADE TO BLACK
	LIGHT_STYLE(11, "abcdefghijklmnopqrrqponmlkjihgfedcba");
	
	// 12 UNDERWATER LIGHT MUTATION
	// this light only distorts the lightmap - no contribution
	// is made to the brightness of affected surfaces
	LIGHT_STYLE(12, "mmnnmmnnnmmnn");
	
	// styles 32-62 are assigned by the light program for switchable lights

	// 63 testing
	LIGHT_STYLE(63, "a");

	for ( i = 0; i < ARRAYSIZE(gDecals); i++ )
		gDecals[i].index = DECAL_INDEX( gDecals[i].name );

// init the WorldGraph.
	WorldGraph.InitGraph();

// make sure the .NOD file is newer than the .BSP file.
	if ( !WorldGraph.CheckNODFile ( ( char * )STRING( gpGlobals->mapname ) ) )
	{// NOD file is not present, or is older than the BSP file.
		WorldGraph.AllocNodes ();
	}
	else
	{// Load the node graph for this level
		if ( !WorldGraph.FLoadGraph ( (char *)STRING( gpGlobals->mapname ) ) )
		{// couldn't load, so alloc and prepare to build a graph.
			ALERT ( at_console, "*Error opening .NOD file\n" );
			WorldGraph.AllocNodes ();
		}
		else
		{
			ALERT ( at_console, "\n*Graph Loaded!\n" );
		}
	}

	if ( pev->speed > 0 )
		CVAR_SET_FLOAT( "sv_zmax", pev->speed );
	else
		CVAR_SET_FLOAT( "sv_zmax", 4096 );

	if ( pev->netname )
	{
		ALERT( at_aiconsole, "Chapter title: %s\n", STRING(pev->netname) );
		CBaseEntity *pEntity = CBaseEntity::Create( "env_message", g_vecZero, g_vecZero, NULL );
		if ( pEntity )
		{
			pEntity->SetThink( SUB_CallUseToggle );
			pEntity->pev->message = pev->netname;
			pev->netname = 0;
			pEntity->pev->nextthink = gpGlobals->time + 0.3;
			pEntity->pev->spawnflags = SF_MESSAGE_ONCE;
		}
	}

	if ( pev->spawnflags & SF_WORLD_DARK )
		CVAR_SET_FLOAT( "v_dark", 1.0 );
	else
		CVAR_SET_FLOAT( "v_dark", 0.0 );

	if ( pev->spawnflags & SF_WORLD_TITLE )
		gDisplayTitle = TRUE;		// display the game title if this key is set
	else
		gDisplayTitle = FALSE;

	if ( pev->spawnflags & SF_WORLD_FORCETEAM )
	{
		CVAR_SET_FLOAT( "mp_defaultteam", 1 );
	}
	else
	{
		CVAR_SET_FLOAT( "mp_defaultteam", 0 );
	}

	// Discwar
	if ( g_iPlayersPerTeam < 1 )
		g_iPlayersPerTeam = CVAR_GET_FLOAT("rc_playersperteam");
}
コード例 #2
0
ファイル: g_spawn.c プロジェクト: yquake2/ctf
/*QUAKED worldspawn (0 0 0) ?
 *
 * Only used for the world.
 * "sky"	environment map name
 * "skyaxis"	vector axis for rotating sky
 * "skyrotate"	speed of rotation in degrees/second
 * "sounds"	music cd track number
 * "gravity"	800 is default gravity
 * "message"	text to print at user logon
 */
void
SP_worldspawn(edict_t *ent)
{
    ent->movetype = MOVETYPE_PUSH;
    ent->solid = SOLID_BSP;
    ent->inuse = true; /* since the world doesn't use G_Spawn() */
    ent->s.modelindex = 1; /* world model is always index 1 */

    /* --------------- */

    /* reserve some spots for dead player bodies for coop / deathmatch */
    InitBodyQue();

    /* set configstrings for items */
    SetItemNames();

    if (st.nextmap)
    {
        strcpy(level.nextmap, st.nextmap);
    }

    /* make some data visible to the server */
    if (ent->message && ent->message[0])
    {
        gi.configstring(CS_NAME, ent->message);
        strncpy(level.level_name, ent->message, sizeof(level.level_name));
    }
    else
    {
        strncpy(level.level_name, level.mapname, sizeof(level.level_name));
    }

    if (st.sky && st.sky[0])
    {
        gi.configstring(CS_SKY, st.sky);
    }
    else
    {
        gi.configstring(CS_SKY, "unit1_");
    }

    gi.configstring(CS_SKYROTATE, va("%f", st.skyrotate));

    gi.configstring(CS_SKYAXIS, va("%f %f %f", st.skyaxis[0], st.skyaxis[1], st.skyaxis[2]));

    gi.configstring(CS_CDTRACK, va("%i", ent->sounds));

    gi.configstring(CS_MAXCLIENTS, va("%i", (int)(maxclients->value)));

    /* status bar program */
    if (deathmatch->value)
    {
        if (ctf->value)
        {
            gi.configstring(CS_STATUSBAR, ctf_statusbar);
            CTFPrecache();
        }
        else
        {
            gi.configstring(CS_STATUSBAR, dm_statusbar);
        }
    }
    else
    {
        gi.configstring(CS_STATUSBAR, single_statusbar);
    }

    /* --------------- */

    /* help icon for statusbar */
    gi.imageindex("i_help");
    level.pic_health = gi.imageindex("i_health");
    gi.imageindex("help");
    gi.imageindex("field_3");

    if (!st.gravity)
    {
        gi.cvar_set("sv_gravity", "800");
    }
    else
    {
        gi.cvar_set("sv_gravity", st.gravity);
    }

    snd_fry = gi.soundindex("player/fry.wav");  /* standing in lava / slime */

    PrecacheItem(FindItem("Blaster"));

    gi.soundindex("player/lava1.wav");
    gi.soundindex("player/lava2.wav");

    gi.soundindex("misc/pc_up.wav");
    gi.soundindex("misc/talk1.wav");

    gi.soundindex("misc/udeath.wav");

    /* gibs */
    gi.soundindex("items/respawn1.wav");

    /* sexed sounds */
    gi.soundindex("*death1.wav");
    gi.soundindex("*death2.wav");
    gi.soundindex("*death3.wav");
    gi.soundindex("*death4.wav");
    gi.soundindex("*fall1.wav");
    gi.soundindex("*fall2.wav");
    gi.soundindex("*gurp1.wav"); /* drowning damage */
    gi.soundindex("*gurp2.wav");
    gi.soundindex("*jump1.wav"); /* player jump */
    gi.soundindex("*pain25_1.wav");
    gi.soundindex("*pain25_2.wav");
    gi.soundindex("*pain50_1.wav");
    gi.soundindex("*pain50_2.wav");
    gi.soundindex("*pain75_1.wav");
    gi.soundindex("*pain75_2.wav");
    gi.soundindex("*pain100_1.wav");
    gi.soundindex("*pain100_2.wav");

    /* sexed models */
    gi.modelindex("#w_blaster.md2");
    gi.modelindex("#w_shotgun.md2");
    gi.modelindex("#w_sshotgun.md2");
    gi.modelindex("#w_machinegun.md2");
    gi.modelindex("#w_chaingun.md2");
    gi.modelindex("#a_grenades.md2");
    gi.modelindex("#w_glauncher.md2");
    gi.modelindex("#w_rlauncher.md2");
    gi.modelindex("#w_hyperblaster.md2");
    gi.modelindex("#w_railgun.md2");
    gi.modelindex("#w_bfg.md2");
    gi.modelindex("#w_grapple.md2");

    /* ------------------- */

    gi.soundindex("player/gasp1.wav");      /* gasping for air */
    gi.soundindex("player/gasp2.wav");      /* head breaking surface, not gasping */

    gi.soundindex("player/watr_in.wav");    /* feet hitting water */
    gi.soundindex("player/watr_out.wav");   /* feet leaving water */

    gi.soundindex("player/watr_un.wav");    /* head going underwater */

    gi.soundindex("player/u_breath1.wav");
    gi.soundindex("player/u_breath2.wav");

    gi.soundindex("items/pkup.wav");        /* bonus item pickup */
    gi.soundindex("world/land.wav");        /* landing thud */
    gi.soundindex("misc/h2ohit1.wav");      /* landing splash */

    gi.soundindex("items/damage.wav");
    gi.soundindex("items/protect.wav");
    gi.soundindex("items/protect4.wav");
    gi.soundindex("weapons/noammo.wav");

    gi.soundindex("infantry/inflies1.wav");

    sm_meat_index = gi.modelindex("models/objects/gibs/sm_meat/tris.md2");
    gi.modelindex("models/objects/gibs/arm/tris.md2");
    gi.modelindex("models/objects/gibs/bone/tris.md2");
    gi.modelindex("models/objects/gibs/bone2/tris.md2");
    gi.modelindex("models/objects/gibs/chest/tris.md2");
    gi.modelindex("models/objects/gibs/skull/tris.md2");
    gi.modelindex("models/objects/gibs/head2/tris.md2");

    /* Setup light animation tables. 'a' is total darkness, 'z' is doublebright. */

    /* 0 normal */
    gi.configstring(CS_LIGHTS + 0, "m");

    /* 1 FLICKER (first variety) */
    gi.configstring(CS_LIGHTS + 1, "mmnmmommommnonmmonqnmmo");

    /* 2 SLOW STRONG PULSE */
    gi.configstring(CS_LIGHTS + 2, "abcdefghijklmnopqrstuvwxyzyxwvutsrqponmlkjihgfedcba");

    /* 3 CANDLE (first variety) */
    gi.configstring(CS_LIGHTS + 3, "mmmmmaaaaammmmmaaaaaabcdefgabcdefg");

    /* 4 FAST STROBE */
    gi.configstring(CS_LIGHTS + 4, "mamamamamama");

    /* 5 GENTLE PULSE 1 */
    gi.configstring(CS_LIGHTS + 5, "jklmnopqrstuvwxyzyxwvutsrqponmlkj");

    /* 6 FLICKER (second variety) */
    gi.configstring(CS_LIGHTS + 6, "nmonqnmomnmomomno");

    /* 7 CANDLE (second variety) */
    gi.configstring(CS_LIGHTS + 7, "mmmaaaabcdefgmmmmaaaammmaamm");

    /* 8 CANDLE (third variety) */
    gi.configstring(CS_LIGHTS + 8, "mmmaaammmaaammmabcdefaaaammmmabcdefmmmaaaa");

    /* 9 SLOW STROBE (fourth variety) */
    gi.configstring(CS_LIGHTS + 9, "aaaaaaaazzzzzzzz");

    /* 10 FLUORESCENT FLICKER */
    gi.configstring(CS_LIGHTS + 10, "mmamammmmammamamaaamammma");

    /* 11 SLOW PULSE NOT FADE TO BLACK */
    gi.configstring(CS_LIGHTS + 11, "abcdefghijklmnopqrrqponmlkjihgfedcba");

    /* styles 32-62 are assigned by the light program for switchable lights */

    /* 63 testing */
    gi.configstring(CS_LIGHTS + 63, "a");
}
コード例 #3
0
ファイル: world.cpp プロジェクト: DeadFuze/swarm-sdk
void CWorld::Precache( void )
{
	COM_TimestampedLog( "CWorld::Precache - Start" );

	g_WorldEntity = this;
	g_fGameOver = false;
	g_pLastSpawn = NULL;
	g_Language.SetValue( LANGUAGE_ENGLISH );	// TODO use VGUI to get current language

#ifndef INFESTED_DLL
	ConVarRef stepsize( "sv_stepsize" );
	stepsize.SetValue( 24 );
#endif

	ConVarRef roomtype( "room_type" );
	roomtype.SetValue( 0 );

	// Set up game rules
	Assert( !g_pGameRules );
	if (g_pGameRules)
	{
		delete g_pGameRules;
	}

	InstallGameRules();
	Assert( g_pGameRules );
	g_pGameRules->Init();

	CSoundEnt::InitSoundEnt();

	// UNDONE: Make most of these things server systems or precache_registers
	// =================================================
	//	Activities
	// =================================================
	ActivityList_Free();
	RegisterSharedActivities();

	EventList_Free();
	RegisterSharedEvents();

	// Only allow precaching between LevelInitPreEntity and PostEntity
	CBaseEntity::SetAllowPrecache( true );

	COM_TimestampedLog( "IGameSystem::LevelInitPreEntityAllSystems" );
	IGameSystem::LevelInitPreEntityAllSystems( STRING( GetModelName() ) );

	COM_TimestampedLog( "g_pGameRules->CreateStandardEntities()" );
	// Create the player resource
	g_pGameRules->CreateStandardEntities();

	COM_TimestampedLog( "InitBodyQue()" );
	InitBodyQue();
	
	COM_TimestampedLog( "SENTENCEG_Init()" );
	// init sentence group playback stuff from sentences.txt.
	// ok to call this multiple times, calls after first are ignored.
	SENTENCEG_Init();

	COM_TimestampedLog( "PrecacheStandardParticleSystems()" );
	// Precache standard particle systems
	PrecacheStandardParticleSystems( );

	// the area based ambient sounds MUST be the first precache_sounds

	COM_TimestampedLog( "W_Precache()" );
	// player precaches     
	W_Precache ();									// get weapon precaches
	COM_TimestampedLog( "ClientPrecache()" );
	ClientPrecache();
	
	COM_TimestampedLog( "PrecacheTempEnts()" );
	// precache all temp ent stuff
	CBaseTempEntity::PrecacheTempEnts();

	COM_TimestampedLog( "LightStyles" );
	//
	// Setup light animation tables. 'a' is total darkness, 'z' is maxbright.
	//
	for ( int i = 0; i < ARRAYSIZE(g_DefaultLightstyles); i++ )
	{
		engine->LightStyle( i, GetDefaultLightstyleString(i) );
	}

	// styles 32-62 are assigned by the light program for switchable lights

	// 63 testing
	engine->LightStyle(63, "a");

	COM_TimestampedLog( "InitializeAINetworks" );
	// =================================================
	//	Load and Init AI Networks
	// =================================================
	CAI_NetworkManager::InitializeAINetworks();
	// =================================================
	//	Load and Init AI Schedules
	// =================================================
	COM_TimestampedLog( "LoadAllSchedules" );
	g_AI_SchedulesManager.LoadAllSchedules();
	// =================================================
	//	Initialize NPC Relationships
	// =================================================
	COM_TimestampedLog( "InitDefaultAIRelationships" );
	g_pGameRules->InitDefaultAIRelationships();
	COM_TimestampedLog( "InitInteractionSystem" );
	CBaseCombatCharacter::InitInteractionSystem();

	COM_TimestampedLog( "g_pGameRules->Precache" );
	// Call the gamerules precache after the AI precache so that games can precache NPCs that are always loaded
	g_pGameRules->Precache();
	
	if ( m_iszChapterTitle != NULL_STRING )
	{
		DevMsg( 2, "Chapter title: %s\n", STRING(m_iszChapterTitle) );
		CMessage *pMessage = (CMessage *)CBaseEntity::Create( "env_message", vec3_origin, vec3_angle, NULL );
		if ( pMessage )
		{
			pMessage->SetMessage( m_iszChapterTitle );
			m_iszChapterTitle = NULL_STRING;

			// send the message entity a play message command, delayed by 1 second
			pMessage->AddSpawnFlags( SF_MESSAGE_ONCE );
			pMessage->SetThink( &CMessage::SUB_CallUseToggle );
			pMessage->SetNextThink( gpGlobals->curtime + 1.0f );
		}
	}

	g_iszFuncBrushClassname = AllocPooledString("func_brush");

	if ( m_iszDetailSpriteMaterial.Get() != NULL_STRING )
	{
		PrecacheMaterial( STRING( m_iszDetailSpriteMaterial.Get() ) );
	}

	COM_TimestampedLog( "CWorld::Precache - Finish" );
}
コード例 #4
0
/*
============
G_InitGame

============
*/
void G_InitGame( int levelTime, int randomSeed, int restart ) {
	int					i;

	G_Printf ("------- Game Initialization -------\n");
	G_Printf ("gamename: %s\n", GAMEVERSION);
	G_Printf ("gamedate: %s\n", __DATE__);

	srand( randomSeed );

	G_RegisterCvars();

	G_ProcessIPBans();

	G_InitMemory();

	// set some level globals
	memset( &level, 0, sizeof( level ) );
	level.time = levelTime;
	level.startTime = levelTime;

	level.snd_fry = G_SoundIndex("sound/player/fry.wav");	// FIXME standing in lava / slime

	if ( g_gametype.integer != GT_SINGLE_PLAYER && g_logfile.string[0] ) {
		if ( g_logfileSync.integer ) {
			trap_FS_FOpenFile( g_logfile.string, &level.logFile, FS_APPEND_SYNC );
		} else {
			trap_FS_FOpenFile( g_logfile.string, &level.logFile, FS_APPEND );
		}
		if ( !level.logFile ) {
			G_Printf( "WARNING: Couldn't open logfile: %s\n", g_logfile.string );
		} else {
			char	serverinfo[MAX_INFO_STRING];

			trap_GetServerinfo( serverinfo, sizeof( serverinfo ) );

			G_LogPrintf("------------------------------------------------------------\n" );
			G_LogPrintf("InitGame: %s\n", serverinfo );
		}
	} else {
		G_Printf( "Not logging to disk.\n" );
	}

	G_InitWorldSession();

	// initialize all entities for this game
	memset( g_entities, 0, MAX_GENTITIES * sizeof(g_entities[0]) );
	level.gentities = g_entities;

	// initialize all clients for this game
	level.maxclients = g_maxclients.integer;
	memset( g_clients, 0, MAX_CLIENTS * sizeof(g_clients[0]) );
	level.clients = g_clients;

	// set client fields on player ents
	for ( i=0 ; i<level.maxclients ; i++ ) {
		g_entities[i].client = level.clients + i;
	}

	// always leave room for the max number of clients,
	// even if they aren't all used, so numbers inside that
	// range are NEVER anything but clients
	level.num_entities = MAX_CLIENTS;

	for ( i=0 ; i<MAX_CLIENTS ; i++ ) {
		g_entities[i].classname = "clientslot";
	}

	// let the server system know where the entites are
	trap_LocateGameData( level.gentities, level.num_entities, sizeof( gentity_t ), 
		&level.clients[0].ps, sizeof( level.clients[0] ) );

	// reserve some spots for dead player bodies
	InitBodyQue();

	ClearRegisteredItems();

	// parse the key/value pairs and spawn gentities
	G_SpawnEntitiesFromString();

	// general initialization
	G_FindTeams();

	// make sure we have flags for CTF, etc
	if( g_gametype.integer >= GT_TEAM ) {
		G_CheckTeamItems();
	}

	SaveRegisteredItems();

	G_Printf ("-----------------------------------\n");

	if( g_gametype.integer == GT_SINGLE_PLAYER || trap_Cvar_VariableIntegerValue( "com_buildScript" ) ) {
		G_ModelIndex( SP_PODIUM_MODEL );
	}

	if ( trap_Cvar_VariableIntegerValue( "bot_enable" ) ) {
		BotAISetup( restart );
		BotAILoadMap( restart );
		G_InitBots( restart );
	}

	G_RemapTeamShaders();

}
コード例 #5
0
ファイル: g_spawn.c プロジェクト: qbism/qbq2
/*QUAKED worldspawn (0 0 0) ?

Only used for the world.
"sky"	environment map name
"skyaxis"	vector axis for rotating sky
"skyrotate"	speed of rotation in degrees/second
"sounds"	music cd track number
"gravity"	800 is default gravity
"message"	text to print at user logon
*/
void SP_worldspawn (edict_t *ent)
{
	ent->movetype = MOVETYPE_PUSH;
	ent->solid = SOLID_BSP;
	ent->inuse = true;			// since the world doesn't use G_Spawn()
	ent->s.modelindex = 1;		// world model is always index 1

	//---------------

	// reserve some spots for dead player bodies for coop / deathmatch
	InitBodyQue ();

	// set configstrings for items
	SetItemNames ();

	if (st.nextmap)
		strcpy (level.nextmap, st.nextmap);

	// make some data visible to the server

	if (ent->message && ent->message[0])
	{
		gi.configstring (CS_NAME, ent->message);
		strncpy (level.level_name, ent->message, sizeof(level.level_name));
	}
	else
		strncpy (level.level_name, level.mapname, sizeof(level.level_name));

	if (st.sky && st.sky[0])
		gi.configstring (CS_SKY, st.sky);
	else
		gi.configstring (CS_SKY, "unit1_");

	gi.configstring (CS_SKYROTATE, va("%f", st.skyrotate) );

	gi.configstring (CS_SKYAXIS, va("%f %f %f",
		st.skyaxis[0], st.skyaxis[1], st.skyaxis[2]) );

	// Knightmare- if a named soundtrack is specified, play it instead of from CD
	if (ent->musictrack && strlen(ent->musictrack))
		gi.configstring (CS_CDTRACK, ent->musictrack);
	else
		gi.configstring (CS_CDTRACK, va("%i", ent->sounds) );
	// end Knightmare

	gi.configstring (CS_MAXCLIENTS, va("%i", (int)(maxclients->value) ) );

	// status bar program
	if (deathmatch->value)
		gi.configstring (CS_STATUSBAR, dm_statusbar);
	else
		gi.configstring (CS_STATUSBAR, single_statusbar);

	//---------------


	// help icon for statusbar
	gi.imageindex ("i_help");
	level.pic_health = gi.imageindex ("i_health");
	gi.imageindex ("help");
	gi.imageindex ("field_3");

	if (!st.gravity)
		gi.cvar_set("sv_gravity", "800");
	else
		gi.cvar_set("sv_gravity", st.gravity);

	snd_fry = gi.soundindex ("player/fry.wav");	// standing in lava / slime

	PrecacheItem (FindItem ("Blaster"));

	gi.soundindex ("player/lava1.wav");
	gi.soundindex ("player/lava2.wav");

	gi.soundindex ("misc/pc_up.wav");
	gi.soundindex ("misc/talk1.wav");

	gi.soundindex ("misc/udeath.wav");

	// gibs
	gi.soundindex ("items/respawn1.wav");

	// sexed sounds
	gi.soundindex ("*death1.wav");
	gi.soundindex ("*death2.wav");
	gi.soundindex ("*death3.wav");
	gi.soundindex ("*death4.wav");
	gi.soundindex ("*fall1.wav");
	gi.soundindex ("*fall2.wav");	
	gi.soundindex ("*gurp1.wav");		// drowning damage
	gi.soundindex ("*gurp2.wav");	
	gi.soundindex ("*jump1.wav");		// player jump
	gi.soundindex ("*pain25_1.wav");
	gi.soundindex ("*pain25_2.wav");
	gi.soundindex ("*pain50_1.wav");
	gi.soundindex ("*pain50_2.wav");
	gi.soundindex ("*pain75_1.wav");
	gi.soundindex ("*pain75_2.wav");
	gi.soundindex ("*pain100_1.wav");
	gi.soundindex ("*pain100_2.wav");

	// sexed models
	// THIS ORDER MUST MATCH THE DEFINES IN g_local.h
	// you can add more, max 15
	gi.modelindex ("#w_blaster.md2");
	gi.modelindex ("#w_shotgun.md2");
	gi.modelindex ("#w_sshotgun.md2");
	gi.modelindex ("#w_machinegun.md2");
	gi.modelindex ("#w_chaingun.md2");
	gi.modelindex ("#a_grenades.md2");
	gi.modelindex ("#w_glauncher.md2");
	gi.modelindex ("#w_rlauncher.md2");
	gi.modelindex ("#w_hyperblaster.md2");
	gi.modelindex ("#w_railgun.md2");
	gi.modelindex ("#w_bfg.md2");

	//-------------------

	gi.soundindex ("player/gasp1.wav");		// gasping for air
	gi.soundindex ("player/gasp2.wav");		// head breaking surface, not gasping

	gi.soundindex ("player/watr_in.wav");	// feet hitting water
	gi.soundindex ("player/watr_out.wav");	// feet leaving water

	gi.soundindex ("player/watr_un.wav");	// head going underwater
	
	gi.soundindex ("player/u_breath1.wav");
	gi.soundindex ("player/u_breath2.wav");

	gi.soundindex ("items/pkup.wav");		// bonus item pickup
	gi.soundindex ("world/land.wav");		// landing thud
	gi.soundindex ("misc/h2ohit1.wav");		// landing splash

	gi.soundindex ("items/damage.wav");
	gi.soundindex ("items/protect.wav");
	gi.soundindex ("items/protect4.wav");
	gi.soundindex ("weapons/noammo.wav");

	gi.soundindex ("infantry/inflies1.wav");

	sm_meat_index = gi.modelindex ("models/objects/gibs/sm_meat/tris.md2");
	gi.modelindex ("models/objects/gibs/arm/tris.md2");
	gi.modelindex ("models/objects/gibs/bone/tris.md2");
	gi.modelindex ("models/objects/gibs/bone2/tris.md2");
	gi.modelindex ("models/objects/gibs/chest/tris.md2");
	gi.modelindex ("models/objects/gibs/skull/tris.md2");
	gi.modelindex ("models/objects/gibs/head2/tris.md2");

//
// Setup light animation tables. 'a' is total darkness, 'z' is doublebright.
//

	// 0 normal
	gi.configstring(CS_LIGHTS+0, "m");
	
	// 1 FLICKER (first variety)
	gi.configstring(CS_LIGHTS+1, "mmnmmommommnonmmonqnmmo");
	
	// 2 SLOW STRONG PULSE
	gi.configstring(CS_LIGHTS+2, "abcdefghijklmnopqrstuvwxyzyxwvutsrqponmlkjihgfedcba");
	
	// 3 CANDLE (first variety)
	gi.configstring(CS_LIGHTS+3, "mmmmmaaaaammmmmaaaaaabcdefgabcdefg");
	
	// 4 FAST STROBE
	gi.configstring(CS_LIGHTS+4, "mamamamamama");
	
	// 5 GENTLE PULSE 1
	gi.configstring(CS_LIGHTS+5,"jklmnopqrstuvwxyzyxwvutsrqponmlkj");
	
	// 6 FLICKER (second variety)
	gi.configstring(CS_LIGHTS+6, "nmonqnmomnmomomno");
	
	// 7 CANDLE (second variety)
	gi.configstring(CS_LIGHTS+7, "mmmaaaabcdefgmmmmaaaammmaamm");
	
	// 8 CANDLE (third variety)
	gi.configstring(CS_LIGHTS+8, "mmmaaammmaaammmabcdefaaaammmmabcdefmmmaaaa");
	
	// 9 SLOW STROBE (fourth variety)
	gi.configstring(CS_LIGHTS+9, "aaaaaaaazzzzzzzz");
	
	// 10 FLUORESCENT FLICKER
	gi.configstring(CS_LIGHTS+10, "mmamammmmammamamaaamammma");

	// 11 SLOW PULSE NOT FADE TO BLACK
	gi.configstring(CS_LIGHTS+11, "abcdefghijklmnopqrrqponmlkjihgfedcba");
	
	// styles 32-62 are assigned by the light program for switchable lights

	// 63 testing
	gi.configstring(CS_LIGHTS+63, "a");
}
コード例 #6
0
ファイル: g_spawn.c プロジェクト: darkshade9/aq2-tng-alpha
void SP_worldspawn (edict_t * ent)
{
	int i;

	ent->movetype = MOVETYPE_PUSH;
	ent->solid = SOLID_BSP;
	ent->inuse = true;		// since the world doesn't use G_Spawn()
	ent->s.modelindex = 1;	// world model is always index 1

	// reserve some spots for dead player bodies for coop / deathmatch
	InitBodyQue ();

	// set configstrings for items
	SetItemNames ();

	if (st.nextmap)
		strcpy (level.nextmap, st.nextmap);

	// make some data visible to the server

	if (ent->message && ent->message[0])
	{
		Q_strncpyz(level.level_name, ent->message, sizeof(level.level_name));
		gi.configstring (CS_NAME, level.level_name);
	}
	else {
		strcpy(level.level_name, level.mapname);
	}

	if (st.sky && st.sky[0])
		gi.configstring (CS_SKY, st.sky);
	else
		gi.configstring (CS_SKY, "unit1_");

	gi.configstring(CS_SKYROTATE, va("%f", st.skyrotate));

	gi.configstring(CS_SKYAXIS, va("%f %f %f", st.skyaxis[0], st.skyaxis[1], st.skyaxis[2]));

	gi.configstring(CS_CDTRACK, va("%i", ent->sounds));

	gi.configstring(CS_MAXCLIENTS, va("%i", (int)(maxclients->value)));

//FIREBLADE
	if (nohud->value)
	{
		gi.configstring (CS_STATUSBAR, "");
	}
	else
	//FIREBLADE
	{
		// status bar program
		if (!deathmatch->value)
		{
			gi.configstring (CS_STATUSBAR, single_statusbar);
		}
		else if (ctf->value)
		{
			gi.configstring (CS_STATUSBAR, ctf_statusbar);
			//precaches
			gi.imageindex ("sbfctf1");
			gi.imageindex ("sbfctf2");
			gi.imageindex ("i_ctf1");
			gi.imageindex ("i_ctf2");
			gi.imageindex ("i_ctf1d");
			gi.imageindex ("i_ctf2d");
			gi.imageindex ("i_ctf1t");
			gi.imageindex ("i_ctf2t");
		}
		else if (noscore->value && teamplay->value)
		{
			gi.configstring (CS_STATUSBAR, dm_noscore_statusbar);
		}
		else
		{
			gi.configstring (CS_STATUSBAR, dm_statusbar);
		}
	}

	//---------------


	// help icon for statusbar
	gi.imageindex ("i_help");
	level.pic_health = gi.imageindex ("i_health");
	gi.imageindex ("help");
	gi.imageindex ("field_3");

	// zucc - preload sniper stuff
	gi.imageindex ("scope2x");
	gi.imageindex ("scope4x");
	gi.imageindex ("scope6x");

	//FIREBLADE
	gi.soundindex ("atl/lights.wav");
	gi.soundindex ("atl/camera.wav");
	gi.soundindex ("atl/action.wav");
	gi.imageindex ("tag1");
	gi.imageindex ("tag2");
	gi.imageindex ("tag3");

	if (teamplay->value)
	{
		for(i = TEAM1; i < TEAM_TOP; i++)
		{
			if (teams[i].skin_index[0] == 0)
			{
				gi.dprintf ("No skin was specified for team %i in config file. Exiting.\n", i);
				exit (1);
			}
			gi.imageindex (teams[i].skin_index);
		}
	}

	// AQ2:TNG - Igor adding precache for sounds
	gi.soundindex ("tng/no_team_wins.wav");
	gi.soundindex ("tng/team1_wins.wav");
	gi.soundindex ("tng/team2_wins.wav");
	gi.soundindex ("tng/team3_wins.wav");
	gi.soundindex ("tng/1_minute.wav");
	gi.soundindex ("tng/3_minutes.wav");
	gi.soundindex ("tng/1_frag.wav");
	gi.soundindex ("tng/2_frags.wav");
	gi.soundindex ("tng/3_frags.wav");
	gi.soundindex ("tng/impressive.wav");
	gi.soundindex ("tng/excellent.wav");
	gi.soundindex ("tng/accuracy.wav");
	gi.soundindex ("tng/clanwar.wav");
	gi.soundindex ("tng/disabled.wav");
	gi.soundindex ("tng/enabled.wav");
	gi.soundindex ("misc/flashlight.wav"); // Caching Flashlight
	// AQ2:TNG - end of precache sounds

	gi.soundindex("boss3/bs3idle1.wav");
	gi.soundindex("user/letsrock.wav");
	gi.soundindex("makron/laf4.wav");
	gi.soundindex("world/xian1.wav");
	gi.soundindex("world/elv.wav");
	gi.soundindex("misc/secret.wav"); // used for ctf swap sound

	PrecacheRadioSounds ();
	//PG BUND - Begin
	PrecacheUserSounds ();
	//AQ2:TNG - Slicer Old location support
	//DescListInit(level.mapname);
	//AQ2:TNG END
	TourneyInit ();
	vInitLevel ();
	//PG BUND - End


	if (!st.gravity)
		gi.cvar_set ("sv_gravity", "800");
	else
		gi.cvar_set ("sv_gravity", st.gravity);

	snd_fry = gi.soundindex ("player/fry.wav");	// standing in lava / slime

	PrecacheItem (FindItem ("Blaster"));

	gi.soundindex ("player/lava1.wav");
	gi.soundindex ("player/lava2.wav");

	gi.soundindex ("misc/pc_up.wav");
	gi.soundindex ("misc/talk1.wav");

	gi.soundindex ("misc/udeath.wav");

	// gibs
	gi.soundindex ("items/respawn1.wav");

	// sexed sounds
	gi.soundindex ("*death1.wav");
	gi.soundindex ("*death2.wav");
	gi.soundindex ("*death3.wav");
	gi.soundindex ("*death4.wav");
	gi.soundindex ("*fall1.wav");
	gi.soundindex ("*fall2.wav");
	gi.soundindex ("*gurp1.wav");	// drowning damage
	gi.soundindex ("*gurp2.wav");
	gi.soundindex ("*jump1.wav");	// player jump
	gi.soundindex ("*pain25_1.wav");
	gi.soundindex ("*pain25_2.wav");
	gi.soundindex ("*pain50_1.wav");
	gi.soundindex ("*pain50_2.wav");
	gi.soundindex ("*pain75_1.wav");
	gi.soundindex ("*pain75_2.wav");
	gi.soundindex ("*pain100_1.wav");
	gi.soundindex ("*pain100_2.wav");

	//-------------------

	// precache vwep models
	gi.modelindex ("#w_mk23.md2");
	gi.modelindex ("#w_mp5.md2");
	gi.modelindex ("#w_m4.md2");
	gi.modelindex ("#w_cannon.md2");
	gi.modelindex ("#w_super90.md2");
	gi.modelindex ("#w_sniper.md2");
	gi.modelindex ("#w_akimbo.md2");
	gi.modelindex ("#w_knife.md2");
	gi.modelindex ("#a_m61frag.md2");

	gi.soundindex ("player/gasp1.wav");	// gasping for air
	gi.soundindex ("player/gasp2.wav");	// head breaking surface, not gasping

	gi.soundindex ("player/watr_in.wav");	// feet hitting water
	gi.soundindex ("player/watr_out.wav");	// feet leaving water

	gi.soundindex ("player/watr_un.wav");	// head going underwater

	gi.soundindex ("player/u_breath1.wav");
	gi.soundindex ("player/u_breath2.wav");

	gi.soundindex ("items/pkup.wav");	// bonus item pickup
	gi.soundindex ("world/land.wav");	// landing thud
	gi.soundindex ("misc/h2ohit1.wav");	// landing splash

	gi.soundindex ("items/damage.wav");
	gi.soundindex ("items/protect.wav");
	gi.soundindex ("items/protect4.wav");
	gi.soundindex ("weapons/noammo.wav");

	gi.soundindex ("infantry/inflies1.wav");

	sm_meat_index = gi.modelindex ("models/objects/gibs/sm_meat/tris.md2");
	gi.modelindex ("models/objects/gibs/arm/tris.md2");
	gi.modelindex ("models/objects/gibs/bone/tris.md2");
	gi.modelindex ("models/objects/gibs/bone2/tris.md2");
	gi.modelindex ("models/objects/gibs/chest/tris.md2");
	gi.modelindex ("models/objects/gibs/skull/tris.md2");
	gi.modelindex ("models/objects/gibs/head2/tris.md2");


//
// Setup light animation tables. 'a' is total darkness, 'z' is doublebright.
//

	/*
		Darkmatch.
		Darkmatch has three settings:
		0 - normal, no changes to lights
		1 - all lights are off.
		2 - dusk/dawn mode.
		3 - using the day_cycle to change the lights every xx seconds as defined by day_cycle
	*/
	if (darkmatch->value == 1)
		gi.configstring (CS_LIGHTS + 0, "a");	// Pitch Black
	else if (darkmatch->value == 2)
		gi.configstring (CS_LIGHTS + 0, "b");	// Dusk
	else
		gi.configstring (CS_LIGHTS + 0, "m");	// 0 normal

	gi.configstring (CS_LIGHTS + 1, "mmnmmommommnonmmonqnmmo");	// 1 FLICKER (first variety)
	gi.configstring (CS_LIGHTS + 2,
			"abcdefghijklmnopqrstuvwxyzyxwvutsrqponmlkjihgfedcba");	// 2 SLOW STRONG PULSE
	gi.configstring (CS_LIGHTS + 3, "mmmmmaaaaammmmmaaaaaabcdefgabcdefg");	// 3 CANDLE (first variety)
	gi.configstring (CS_LIGHTS + 4, "mamamamamama");	// 4 FAST STROBE
	gi.configstring (CS_LIGHTS + 5, "jklmnopqrstuvwxyzyxwvutsrqponmlkj");	// 5 GENTLE PULSE 1
	gi.configstring (CS_LIGHTS + 6, "nmonqnmomnmomomno");	// 6 FLICKER (second variety)
	gi.configstring (CS_LIGHTS + 7, "mmmaaaabcdefgmmmmaaaammmaamm");	// 7 CANDLE (second variety)
	gi.configstring (CS_LIGHTS + 8, "mmmaaammmaaammmabcdefaaaammmmabcdefmmmaaaa");	// 8 CANDLE (third variety)
	gi.configstring (CS_LIGHTS + 9, "aaaaaaaazzzzzzzz");	// 9 SLOW STROBE (fourth variety)
	gi.configstring (CS_LIGHTS + 10, "mmamammmmammamamaaamammma");	// 10 FLUORESCENT FLICKER
	gi.configstring (CS_LIGHTS + 11, "abcdefghijklmnopqrrqponmlkjihgfedcba");	// 11 SLOW PULSE NOT FADE TO BLACK
	// styles 32-62 are assigned by the light program for switchable lights
	gi.configstring (CS_LIGHTS + 63, "a");	// 63 testing

	//FB 6/2/99
	if (took_damage != NULL)
		gi.TagFree (took_damage);
	took_damage = (int *)gi.TagMalloc (sizeof (int) * game.maxclients, TAG_GAME);
	//FB 6/2/99
}
コード例 #7
0
void CWorld::Precache( void )
{
	g_WorldEntity = this;
	g_fGameOver = false;
	g_pLastSpawn = NULL;

	ConVar *gravity = ( ConVar * )cvar->FindVar( "sv_gravity" );
	if ( gravity )
	{
// UNDONE: Disabled this.  This makes sv_gravity reset of each level.  Is that what we want?
//		gravity->SetValue( 800 );// 67ft/sec^2
	}

	ConVar *stepsize = ( ConVar * )cvar->FindVar( "sv_stepsize" );
	if ( stepsize )
	{
		stepsize->SetValue( 18 );
	}

	ConVar *roomtype = ( ConVar * )cvar->FindVar( "room_type" );
	if ( roomtype )
	{
		roomtype->SetValue( 0 );
	}

	// Set up game rules
	Assert( !g_pGameRules );
	if (g_pGameRules)
	{
		delete g_pGameRules;
	}

	g_pGameRules = InstallGameRules( );
	Assert( g_pGameRules );
	g_pGameRules->LevelInit();

	CSoundEnt::InitSoundEnt();

	IGameSystem::LevelInitPreEntityAllSystems( STRING( GetModelName() ) );

	// UNDONE: Make most of these things server systems or precache_registers
	// =================================================
	//	Activities
	// =================================================
	ActivityList_Free();
	RegisterSharedActivities();

	InitBodyQue();
// init sentence group playback stuff from sentences.txt.
// ok to call this multiple times, calls after first are ignored.

	SENTENCEG_Init();

// the area based ambient sounds MUST be the first precache_sounds

// player precaches     
	W_Precache ();									// get weapon precaches
	ClientPrecache();
	g_pGameRules->Precache();
	// precache all temp ent stuff
	CBaseTempEntity::PrecacheTempEnts();

	// sounds used from C physics code
	enginesound->PrecacheSound("common/null.wav");				// clears sound channels

	ConVar const *language = cvar->FindVar( "sv_language" );

	g_Language = language ? language->GetInt() : LANGUAGE_ENGLISH;
	if ( g_Language == LANGUAGE_GERMAN )
	{
		engine->PrecacheModel( "models/germangibs.mdl" );
	}
	else
	{
		engine->PrecacheModel( "models/gibs/hgibs.mdl" );
	}

//
// Setup light animation tables. 'a' is total darkness, 'z' is maxbright.
//
	// 0 normal
	engine->LightStyle(0, "m");
	
	// 1 FLICKER (first variety)
	engine->LightStyle(1, "mmnmmommommnonmmonqnmmo");
	
	// 2 SLOW STRONG PULSE
	engine->LightStyle(2, "abcdefghijklmnopqrstuvwxyzyxwvutsrqponmlkjihgfedcba");
	
	// 3 CANDLE (first variety)
	engine->LightStyle(3, "mmmmmaaaaammmmmaaaaaabcdefgabcdefg");
	
	// 4 FAST STROBE
	engine->LightStyle(4, "mamamamamama");
	
	// 5 GENTLE PULSE 1
	engine->LightStyle(5,"jklmnopqrstuvwxyzyxwvutsrqponmlkj");
	
	// 6 FLICKER (second variety)
	engine->LightStyle(6, "nmonqnmomnmomomno");
	
	// 7 CANDLE (second variety)
	engine->LightStyle(7, "mmmaaaabcdefgmmmmaaaammmaamm");
	
	// 8 CANDLE (third variety)
	engine->LightStyle(8, "mmmaaammmaaammmabcdefaaaammmmabcdefmmmaaaa");
	
	// 9 SLOW STROBE (fourth variety)
	engine->LightStyle(9, "aaaaaaaazzzzzzzz");
	
	// 10 FLUORESCENT FLICKER
	engine->LightStyle(10, "mmamammmmammamamaaamammma");

	// 11 SLOW PULSE NOT FADE TO BLACK
	engine->LightStyle(11, "abcdefghijklmnopqrrqponmlkjihgfedcba");
	
	// 12 UNDERWATER LIGHT MUTATION
	// this light only distorts the lightmap - no contribution
	// is made to the brightness of affected surfaces
	engine->LightStyle(12, "mmnnmmnnnmmnn");
	
	// styles 32-62 are assigned by the light program for switchable lights

	// 63 testing
	engine->LightStyle(63, "a");

	// =================================================
	//	Load and Init AI Networks
	// =================================================
	CAI_NetworkManager::InitializeAINetworks();
	// =================================================
	//	Load and Init AI Schedules
	// =================================================
	g_AI_SchedulesManager.LoadAllSchedules();
	// =================================================
	//	Initialize NPC Relationships
	// =================================================
	g_pGameRules->InitDefaultAIRelationships();
	CBaseCombatCharacter::InitInteractionSystem();

	// Call all registered precachers.
	CPrecacheRegister::Precache();	

	if ( m_iszChapterTitle != NULL_STRING )
	{
		DevMsg( 2, "Chapter title: %s\n", STRING(m_iszChapterTitle) );
		CMessage *pMessage = (CMessage *)CBaseEntity::Create( "env_message", vec3_origin, vec3_angle, NULL );
		if ( pMessage )
		{
			pMessage->SetMessage( m_iszChapterTitle );
			m_iszChapterTitle = NULL_STRING;

			// send the message entity a play message command, delayed by 0.3 seconds
			pMessage->AddSpawnFlags( SF_MESSAGE_ONCE );
			pMessage->SetThink( &CMessage::SUB_CallUseToggle );
			pMessage->SetNextThink( gpGlobals->curtime + 0.3 );
		}
	}
}
コード例 #8
0
ファイル: g_spawn.c プロジェクト: ptitSeb/gravitybone-pandora
//void SetChromakey();
void SP_worldspawn (edict_t *ent)
{
// ACEBOT_ADD
	static char current_map[55];
// ACEBOT_END

	ent->movetype = MOVETYPE_PUSH;
	ent->solid = SOLID_BSP;
	ent->inuse = true;			// since the world doesn't use G_Spawn()
	ent->s.modelindex = 1;		// world model is always index 1

	//---------------

	// Knightmare- DM pause starts off
	paused = false;

	// reserve some spots for dead player bodies for coop / deathmatch
	InitBodyQue ();

	// set configstrings for items
	SetItemNames ();

	if (st.nextmap)
		strcpy (level.nextmap, st.nextmap);

	// make some data visible to the server

	if (ent->message && ent->message[0])
	{
		gi.configstring (CS_NAME, ent->message);
		strncpy (level.level_name, ent->message, sizeof(level.level_name));
	}
	else
		strncpy (level.level_name, level.mapname, sizeof(level.level_name));

	if (st.sky && st.sky[0])
		gi.configstring (CS_SKY, st.sky);
	else
		gi.configstring (CS_SKY, "unit1_");

	gi.configstring (CS_SKYROTATE, va("%f", st.skyrotate) );

	gi.configstring (CS_SKYAXIS, va("%f %f %f",
		st.skyaxis[0], st.skyaxis[1], st.skyaxis[2]) );

	// Knightmare- if a named soundtrack is specified, play it instead of from CD
	if (ent->musictrack && strlen(ent->musictrack))
		gi.configstring (CS_CDTRACK, ent->musictrack);
	else
		gi.configstring (CS_CDTRACK, va("%i", ent->sounds) );

	gi.configstring (CS_MAXCLIENTS, va("%i", (int)(maxclients->value) ) );

	// Knightmare added
	if (ttctf->value)
	{
		gi.cvar_forceset("ctf", "1");
		gi.cvar_forceset("deathmatch", "1");
	}
	else if (ctf->value)
		gi.cvar_forceset("deathmatch", "1");

	// status bar program
	if (deathmatch->value)
	{
//ZOID
		if (ctf->value) {
			if (ttctf->value) // Knightmare added
				gi.configstring (CS_STATUSBAR, ttctf_statusbar);
			else
				gi.configstring (CS_STATUSBAR, ctf_statusbar);
			CTFPrecache();
		} else
			gi.configstring (CS_STATUSBAR, dm_statusbar);
	}
//ZOID
	else
		gi.configstring (CS_STATUSBAR, single_statusbar);
	//---------------

// ACEBOT_ADD
	// If the map changes on us, init and reload the nodes
	if (deathmatch->value && strcmp(level.mapname,current_map))
	{
		
		ACEND_InitNodes();
		ACEND_LoadNodes();
		//ACESP_LoadBots(); // Knightmare- removed this
		ACESP_LoadBotInfo(); // Knightmare- load bot info file
		strcpy(current_map,level.mapname);
	}
// ACEBOT_END

	// help icon for statusbar
	gi.imageindex ("i_help");
	level.pic_health = gi.imageindex ("i_health");
	gi.imageindex ("help");
	gi.imageindex ("field_3");

	if (!st.gravity)
		gi.cvar_set("sv_gravity", "800");
	else
		gi.cvar_set("sv_gravity", st.gravity);

	snd_fry = gi.soundindex ("player/fry.wav");	// standing in lava / slime

	PrecacheItem (FindItem ("Blaster"));

	gi.soundindex ("player/lava1.wav");
	gi.soundindex ("player/lava2.wav");

	gi.soundindex ("misc/pc_up.wav");
	gi.soundindex ("misc/talk1.wav");

	gi.soundindex ("misc/udeath.wav");

	// gibs
	gi.soundindex ("items/respawn1.wav");

	// sexed sounds
	gi.soundindex ("*death1.wav");
	gi.soundindex ("*death2.wav");
	gi.soundindex ("*death3.wav");
	gi.soundindex ("*death4.wav");
	gi.soundindex ("*fall1.wav");
	gi.soundindex ("*fall2.wav");	
	gi.soundindex ("*gurp1.wav");		// drowning damage
	gi.soundindex ("*gurp2.wav");	
	gi.soundindex ("*jump1.wav");		// player jump
	gi.soundindex ("*pain25_1.wav");
	gi.soundindex ("*pain25_2.wav");
	gi.soundindex ("*pain50_1.wav");
	gi.soundindex ("*pain50_2.wav");
	gi.soundindex ("*pain75_1.wav");
	gi.soundindex ("*pain75_2.wav");
	gi.soundindex ("*pain100_1.wav");
	gi.soundindex ("*pain100_2.wav");

	// sexed models
	// THIS ORDER MUST MATCH THE DEFINES IN g_local.h
	// you can add more, max 64
	if (use_vwep->value || deathmatch->value)
	{
		gi.modelindex ("#w_blaster.md2");
		gi.modelindex ("#w_shotgun.md2");
		gi.modelindex ("#w_sshotgun.md2");
		gi.modelindex ("#w_machinegun.md2");
		gi.modelindex ("#w_chaingun.md2");
		gi.modelindex ("#a_grenades.md2");
		gi.modelindex ("#w_glauncher.md2");
		gi.modelindex ("#w_rlauncher.md2");
		gi.modelindex ("#w_hyperblaster.md2");
		gi.modelindex ("#w_railgun.md2");
		gi.modelindex ("#w_bfg.md2");
		if (ctf->value)
			gi.modelindex ("#w_grapple.md2");
	}

	//-------------------

	gi.soundindex ("player/gasp1.wav");		// gasping for air
	gi.soundindex ("player/gasp2.wav");		// head breaking surface, not gasping

	gi.soundindex ("player/watr_in.wav");	// feet hitting water
	gi.soundindex ("player/watr_out.wav");	// feet leaving water

	gi.soundindex ("player/watr_un.wav");	// head going underwater
	
	gi.soundindex ("player/u_breath1.wav");
	gi.soundindex ("player/u_breath2.wav");

	gi.soundindex ("items/pkup.wav");		// bonus item pickup
	gi.soundindex ("world/land.wav");		// landing thud
	gi.soundindex ("misc/h2ohit1.wav");		// landing splash

	gi.soundindex ("items/damage.wav");
	gi.soundindex ("items/protect.wav");
	gi.soundindex ("items/protect4.wav");
	gi.soundindex ("weapons/noammo.wav");

	gi.soundindex ("infantry/inflies1.wav");

	sm_meat_index = gi.modelindex ("models/objects/gibs/sm_meat/tris.md2");
	gi.modelindex ("models/objects/gibs/arm/tris.md2");
	gi.modelindex ("models/objects/gibs/bone/tris.md2");
	gi.modelindex ("models/objects/gibs/bone2/tris.md2");
	gi.modelindex ("models/objects/gibs/chest/tris.md2");
	gi.modelindex ("models/objects/gibs/skull/tris.md2");
	gi.modelindex ("models/objects/gibs/head2/tris.md2");

	gi.soundindex ("mud/mud_in2.wav");
	gi.soundindex ("mud/mud_out1.wav");
	gi.soundindex ("mud/mud_un1.wav");
	gi.soundindex ("mud/wade_mud1.wav");
	gi.soundindex ("mud/wade_mud2.wav");

	Lights();

	// Fog clipping - if "fogclip" is non-zero, force gl_clear to a good
	// value for obscuring HOM with fog... "good" is driver-dependent
	if(ent->fogclip)
	{
		if(gl_driver && !Q_stricmp(gl_driver->string,"3dfxgl"))
			gi.cvar_forceset("gl_clear", "0");
		else
			gi.cvar_forceset("gl_clear", "1");
	}

	// cvar overrides for effects flags:
	if(alert_sounds->value)
		world->effects |= FX_WORLDSPAWN_ALERTSOUNDS;
	if(corpse_fade->value)
		world->effects |= FX_WORLDSPAWN_CORPSEFADE;
	if(jump_kick->value)
		world->effects |= FX_WORLDSPAWN_JUMPKICK;
}
コード例 #9
0
/*QUAKED worldspawn (0 0 0) ?

Only used for the world.
"sky"   environment map name
"skyaxis"   vector axis for rotating sky
"skyrotate" speed of rotation in degrees/second
"sounds"    music cd track number
"gravity"   800 is default gravity
"message"   text to print at user logon
*/
void SP_worldspawn(edict_t *ent)
{
    char buffer[MAX_QPATH];

    ent->movetype = MOVETYPE_PUSH;
    ent->solid = SOLID_BSP;
    ent->inuse = qtrue;         // since the world doesn't use G_Spawn()
    ent->s.modelindex = 1;      // world model is always index 1

    //---------------

    // reserve some spots for dead player bodies for coop / deathmatch
    InitBodyQue();

    // set configstrings for items
    SetItemNames();

    //if (st.nextmap)
    //  strcpy(level.nextmap, st.nextmap);

    // make some data visible to the server

    if (ent->message && ent->message[0]) {
        gi.configstring(CS_NAME, ent->message);
    }
    ent->message = NULL;

    if (st.sky && st.sky[0])
        gi.configstring(CS_SKY, st.sky);
    else
        gi.configstring(CS_SKY, "unit1_");

    gi.configstring(CS_SKYROTATE, va("%f", st.skyrotate));

    gi.configstring(CS_SKYAXIS, va("%f %f %f", st.skyaxis[0], st.skyaxis[1], st.skyaxis[2]));

    gi.configstring(CS_CDTRACK, va("%i", ent->sounds));

    gi.configstring(CS_MAXCLIENTS, va("%i", (int)(maxclients->value)));

    // status bar program
    gi.configstring(CS_STATUSBAR, dm_statusbar);

    gi.configstring(CS_OBSERVE, "SPECT");

    G_HighlightStr(buffer, "SPECTATOR MODE", sizeof(buffer));
    gi.configstring(CS_SPECMODE, buffer);

    G_HighlightStr(buffer, "Press ATTACK to join", sizeof(buffer));
    gi.configstring(CS_PREGAME, buffer);

    //---------------


    // help icon for statusbar
    gi.imageindex("i_help");
    level.images.health = gi.imageindex("i_health");
    gi.imageindex("help");
    gi.imageindex("field_3");

    level.images.powershield = gi.imageindex("i_powershield");
    level.images.quad = gi.imageindex("p_quad");
    level.images.invulnerability = gi.imageindex("p_invulnerability");
    level.images.envirosuit = gi.imageindex("p_envirosuit");
    level.images.rebreather = gi.imageindex("p_rebreather");

    if (!st.gravity)
        gi.cvar_set("sv_gravity", "800");
    else
        gi.cvar_set("sv_gravity", st.gravity);

    level.sounds.fry = gi.soundindex("player/fry.wav");     // standing in lava / slime
    level.sounds.lava_in = gi.soundindex("player/lava_in.wav");
    level.sounds.burn[0] = gi.soundindex("player/burn1.wav");
    level.sounds.burn[1] = gi.soundindex("player/burn2.wav");
    level.sounds.drown = gi.soundindex("player/drown1.wav");

    PrecacheItem(INDEX_ITEM(ITEM_BLASTER));

    gi.soundindex("player/lava1.wav");
    gi.soundindex("player/lava2.wav");

    gi.soundindex("misc/pc_up.wav");
    gi.soundindex("misc/talk1.wav");
    level.sounds.secret = gi.soundindex("misc/secret.wav");
    level.sounds.count = gi.soundindex("world/10_0.wav");

    level.sounds.udeath = gi.soundindex("misc/udeath.wav");

    gi.soundindex("items/respawn1.wav");

    // sexed sounds
    level.sounds.death[0] = gi.soundindex("*death1.wav");
    level.sounds.death[1] = gi.soundindex("*death2.wav");
    level.sounds.death[2] = gi.soundindex("*death3.wav");
    level.sounds.death[3] = gi.soundindex("*death4.wav");
    level.sounds.fall[0] = gi.soundindex("*fall1.wav");
    level.sounds.fall[1] = gi.soundindex("*fall2.wav");
    level.sounds.gurp[0] = gi.soundindex("*gurp1.wav");         // drowning damage
    level.sounds.gurp[1] = gi.soundindex("*gurp2.wav");
    level.sounds.jump = gi.soundindex("*jump1.wav");        // player jump
    level.sounds.pain[0][0] = gi.soundindex("*pain25_1.wav");
    level.sounds.pain[0][1] = gi.soundindex("*pain25_2.wav");
    level.sounds.pain[1][0] = gi.soundindex("*pain50_1.wav");
    level.sounds.pain[1][1] = gi.soundindex("*pain50_2.wav");
    level.sounds.pain[2][0] = gi.soundindex("*pain75_1.wav");
    level.sounds.pain[2][1] = gi.soundindex("*pain75_2.wav");
    level.sounds.pain[3][0] = gi.soundindex("*pain100_1.wav");
    level.sounds.pain[3][1] = gi.soundindex("*pain100_2.wav");

    level.sounds.rg_hum = gi.soundindex("weapons/rg_hum.wav");
    level.sounds.bfg_hum = gi.soundindex("weapons/bfg_hum.wav");

    // sexed models
    // THIS ORDER MUST MATCH THE DEFINES IN g_local.h
    // you can add more, max 15
    gi.modelindex("#w_blaster.md2");
    gi.modelindex("#w_shotgun.md2");
    gi.modelindex("#w_sshotgun.md2");
    gi.modelindex("#w_machinegun.md2");
    gi.modelindex("#w_chaingun.md2");
    gi.modelindex("#a_grenades.md2");
    gi.modelindex("#w_glauncher.md2");
    gi.modelindex("#w_rlauncher.md2");
    gi.modelindex("#w_hyperblaster.md2");
    gi.modelindex("#w_railgun.md2");
    gi.modelindex("#w_bfg.md2");

    //-------------------

    level.sounds.gasp[0] = gi.soundindex("player/gasp1.wav");       // gasping for air
    level.sounds.gasp[1] = gi.soundindex("player/gasp2.wav");       // head breaking surface, not gasping

    level.sounds.watr_in = gi.soundindex("player/watr_in.wav");     // feet hitting water
    level.sounds.watr_out = gi.soundindex("player/watr_out.wav");   // feet leaving water

    level.sounds.watr_un = gi.soundindex("player/watr_un.wav");     // head going underwater

    level.sounds.breath[0] = gi.soundindex("player/u_breath1.wav");
    level.sounds.breath[1] = gi.soundindex("player/u_breath2.wav");

    gi.soundindex("items/pkup.wav");        // bonus item pickup
    gi.soundindex("world/land.wav");        // landing thud
    gi.soundindex("misc/h2ohit1.wav");      // landing splash

    gi.soundindex("items/damage.wav");
    gi.soundindex("items/protect.wav");
    gi.soundindex("items/protect4.wav");
    level.sounds.noammo = gi.soundindex("weapons/noammo.wav");

    gi.soundindex("infantry/inflies1.wav");

    level.sounds.xian = gi.soundindex("world/xian1.wav");
    level.sounds.makron = gi.soundindex("makron/laf4.wav");

    // gibs
    level.models.meat = gi.modelindex("models/objects/gibs/sm_meat/tris.md2");
    /*level.models.arm = gi.modelindex("models/objects/gibs/arm/tris.md2");
    level.models.bones[0] = gi.modelindex("models/objects/gibs/bone/tris.md2");
    level.models.bones[1] = gi.modelindex("models/objects/gibs/bone2/tris.md2");
    level.models.chest = gi.modelindex("models/objects/gibs/chest/tris.md2");
    level.models.skull = gi.modelindex("models/objects/gibs/skull/tris.md2");*/
    level.models.head = gi.modelindex("models/objects/gibs/head2/tris.md2");

//
// Setup light animation tables. 'a' is total darkness, 'z' is doublebright.
//

    // 0 normal
    gi.configstring(CS_LIGHTS + 0, "m");

    // 1 FLICKER (first variety)
    gi.configstring(CS_LIGHTS + 1, "mmnmmommommnonmmonqnmmo");

    // 2 SLOW STRONG PULSE
    gi.configstring(CS_LIGHTS + 2, "abcdefghijklmnopqrstuvwxyzyxwvutsrqponmlkjihgfedcba");

    // 3 CANDLE (first variety)
    gi.configstring(CS_LIGHTS + 3, "mmmmmaaaaammmmmaaaaaabcdefgabcdefg");

    // 4 FAST STROBE
    gi.configstring(CS_LIGHTS + 4, "mamamamamama");

    // 5 GENTLE PULSE 1
    gi.configstring(CS_LIGHTS + 5, "jklmnopqrstuvwxyzyxwvutsrqponmlkj");

    // 6 FLICKER (second variety)
    gi.configstring(CS_LIGHTS + 6, "nmonqnmomnmomomno");

    // 7 CANDLE (second variety)
    gi.configstring(CS_LIGHTS + 7, "mmmaaaabcdefgmmmmaaaammmaamm");

    // 8 CANDLE (third variety)
    gi.configstring(CS_LIGHTS + 8, "mmmaaammmaaammmabcdefaaaammmmabcdefmmmaaaa");

    // 9 SLOW STROBE (fourth variety)
    gi.configstring(CS_LIGHTS + 9, "aaaaaaaazzzzzzzz");

    // 10 FLUORESCENT FLICKER
    gi.configstring(CS_LIGHTS + 10, "mmamammmmammamamaaamammma");

    // 11 SLOW PULSE NOT FADE TO BLACK
    gi.configstring(CS_LIGHTS + 11, "abcdefghijklmnopqrrqponmlkjihgfedcba");

    // styles 32-62 are assigned by the light program for switchable lights

    // 63 testing
    gi.configstring(CS_LIGHTS + 63, "a");
}
コード例 #10
0
void G_ResetLevel(void)
{
    gclient_t *client;
    edict_t *ent;
    int i;

    gi.FreeTags(TAG_LEVEL);

#if USE_SQLITE
    G_LogClients();
#endif

    G_FinishVote();

    // clear level
    level.framenum = 0;
    level.time = 0;
    level.intermission_framenum = 0;
    level.intermission_exit = 0;
    level.vote.proposal = 0;
    level.nextmap[0] = 0;
    level.record = 0;
    level.players_in = level.players_out = 0;

    // free all edicts
    for (i = game.maxclients + 1; i < globals.num_edicts; i++) {
        ent = &g_edicts[i];
        if (ent->inuse) {
            G_FreeEdict(ent);
        }
    }
    globals.num_edicts = game.maxclients + 1;

    InitBodyQue();

    // respawn all edicts
    G_ParseString();
    G_FindTeams();
    //G_UpdateItemBans();

    // respawn all clients
    for (i = 0; i < game.maxclients; i++) {
        client = &game.clients[i];
        if (!client->pers.connected) {
            continue;
        }
        memset(&client->resp, 0, sizeof(client->resp));
        memset(&client->level.vote, 0, sizeof(client->level.vote));
        if (client->pers.connected == CONN_SPAWNED) {
            ent = client->edict;
            G_ScoreChanged(ent);
            ent->movetype = MOVETYPE_NOCLIP; // do not leave body
            respawn(ent);
        }
    }

    G_UpdateRanks();

    if (timelimit->value > 0) {
        int remaining = timelimit->value * 60 - level.time;

        G_WriteTime(remaining);
        gi.multicast(NULL, MULTICAST_ALL);
    }

    // allow everything to settle
    G_RunFrame();
    G_RunFrame();

    // make sure movers are not interpolated
    for (i = game.maxclients + 1; i < globals.num_edicts; i++) {
        ent = &g_edicts[i];
        if (ent->inuse && ent->movetype) {
            ent->s.event = EV_OTHER_TELEPORT;
        }
    }
}
コード例 #11
0
ファイル: world.cpp プロジェクト: RichardRohac/hl-amnesia-src
void CWorld :: Precache( void )
{
	//LRC - set up the world lists
	g_pWorld = this;
	m_pAssistLink = NULL;
	m_pFirstAlias = NULL;
//	ALERT(at_console, "Clearing AssistList\n");

	g_pLastSpawn = NULL;
	
#if 1
	CVAR_SET_STRING("sv_gravity", "800"); // 67ft/sec
	CVAR_SET_STRING("sv_stepsize", "18");
#else
	CVAR_SET_STRING("sv_gravity", "384"); // 32ft/sec
	CVAR_SET_STRING("sv_stepsize", "24");
#endif

	CVAR_SET_STRING("room_type", "0");// clear DSP

	// Set up game rules
	if (g_pGameRules)
	{
		delete g_pGameRules;
	}

	g_pGameRules = InstallGameRules( );

	//!!!UNDONE why is there so much Spawn code in the Precache function? I'll just keep it here 

	///!!!LATER - do we want a sound ent in deathmatch? (sjb)
	//pSoundEnt = CBaseEntity::Create( "soundent", g_vecZero, g_vecZero, edict() );
	pSoundEnt = GetClassPtr( ( CSoundEnt *)NULL );
	pSoundEnt->Spawn();

	if ( !pSoundEnt )
	{
		ALERT ( at_debug, "**COULD NOT CREATE SOUNDENT**\n" );
	}

	InitBodyQue();
	
// init sentence group playback stuff from sentences.txt.
// ok to call this multiple times, calls after first are ignored.

	SENTENCEG_Init();

// init texture type array from materials.txt

	TEXTURETYPE_Init();


// the area based ambient sounds MUST be the first precache_sounds

// player precaches     
	W_Precache ();									// get weapon precaches

	ClientPrecache();

// sounds used from C physics code
	PRECACHE_SOUND("common/null.wav");				// clears sound channels

	PRECACHE_SOUND( "items/suitchargeok1.wav" );//!!! temporary sound for respawning weapons.
	PRECACHE_SOUND( "items/gunpickup2.wav" );// player picks up a gun.

	PRECACHE_SOUND( "common/bodydrop3.wav" );// dead bodies hitting the ground (animation events)
	PRECACHE_SOUND( "common/bodydrop4.wav" );
	
	g_Language = (int)CVAR_GET_FLOAT( "sv_language" );
	if ( g_Language == LANGUAGE_GERMAN )
	{
		PRECACHE_MODEL( "models/germangibs.mdl" );
	}
	else
	{
		PRECACHE_MODEL( "models/hgibs.mdl" );
		PRECACHE_MODEL( "models/agibs.mdl" );
	}

	PRECACHE_SOUND ("weapons/ric1.wav");
	PRECACHE_SOUND ("weapons/ric2.wav");
	PRECACHE_SOUND ("weapons/ric3.wav");
	PRECACHE_SOUND ("weapons/ric4.wav");
	PRECACHE_SOUND ("weapons/ric5.wav");

	PRECACHE_MODEL( "sprites/null.spr" ); //LRC

//
// Setup light animation tables. 'a' is total darkness, 'z' is maxbright.
//
	int i;

	// 0 normal
	for (i = 0; i <= 13; i++)
	{
		LIGHT_STYLE(i, (char*)STRING(GetStdLightStyle(i)));
	}
	
	// styles 32-62 are assigned by the light program for switchable lights

	// 63 testing
	LIGHT_STYLE(63, "a");

	for (i = 0; i < ARRAYSIZE(gDecals); i++ )
		gDecals[i].index = DECAL_INDEX( gDecals[i].name );

// init the WorldGraph.
	WorldGraph.InitGraph();

// make sure the .NOD file is newer than the .BSP file.
	if ( !WorldGraph.CheckNODFile ( ( char * )STRING( gpGlobals->mapname ) ) )
	{// NOD file is not present, or is older than the BSP file.
		WorldGraph.AllocNodes ();
	}
	else
	{// Load the node graph for this level
		if ( !WorldGraph.FLoadGraph ( (char *)STRING( gpGlobals->mapname ) ) )
		{// couldn't load, so alloc and prepare to build a graph.
			ALERT ( at_debug, "*Error opening .NOD file\n" );
			WorldGraph.AllocNodes ();
		}
		else
		{
			ALERT ( at_debug, "\n*Graph Loaded!\n" );
		}
	}

	if ( pev->speed > 0 )
		CVAR_SET_FLOAT( "sv_zmax", pev->speed );
	else
		CVAR_SET_FLOAT( "sv_zmax", 4096 );

	if ( pev->netname )
	{
		ALERT( at_aiconsole, "Chapter title: %s\n", STRING(pev->netname) );
		CBaseEntity *pEntity = CBaseEntity::Create( "env_message", g_vecZero, g_vecZero, NULL );
		if ( pEntity )
		{
			pEntity->SetThink(&CWorld::SUB_CallUseToggle );
			pEntity->pev->message = pev->netname;
			pev->netname = 0;
			pEntity->SetNextThink( 0.3 );
			pEntity->pev->spawnflags = SF_MESSAGE_ONCE;
		}
	}

	if ( pev->spawnflags & SF_WORLD_DARK )
		CVAR_SET_FLOAT( "v_dark", 1.0 );
	else
		CVAR_SET_FLOAT( "v_dark", 0.0 );

	if ( pev->spawnflags & SF_WORLD_TITLE )
		gDisplayTitle = TRUE;		// display the game title if this key is set
	else
		gDisplayTitle = FALSE;

	if ( pev->spawnflags & SF_WORLD_FORCETEAM )
	{
		CVAR_SET_FLOAT( "mp_defaultteam", 1 );
	}
	else
	{
		CVAR_SET_FLOAT( "mp_defaultteam", 0 );
	}
}
コード例 #12
0
ファイル: g_spawn.c プロジェクト: MaddTheSane/Quake2-Action
/*QUAKED worldspawn (0 0 0) ?

Only used for the world.
"sky"   environment map name
"skyaxis"       vector axis for rotating sky
"skyrotate"     speed of rotation in degrees/second
"sounds"        music cd track number
"gravity"       800 is default gravity
"message"       text to print at user logon
*/
void SP_worldspawn (edict_t *ent)
{
        ent->movetype = MOVETYPE_PUSH;
        ent->solid = SOLID_BSP;
        ent->inuse = true;                      // since the world doesn't use G_Spawn()
        ent->s.modelindex = 1;          // world model is always index 1

        //---------------

        // reserve some spots for dead player bodies for coop / deathmatch
        InitBodyQue ();

        // set configstrings for items
        SetItemNames ();

        if (st.nextmap)
                strcpy (level.nextmap, st.nextmap);

        // make some data visible to the server

        if (ent->message && ent->message[0])
        {
                gi.configstring (CS_NAME, ent->message);
                strncpy (level.level_name, ent->message, sizeof(level.level_name));
        }
        else
                strncpy (level.level_name, level.mapname, sizeof(level.level_name));

        if (st.sky && st.sky[0])
                gi.configstring (CS_SKY, st.sky);
        else
                gi.configstring (CS_SKY, "unit1_");

        gi.configstring (CS_SKYROTATE, va("%f", st.skyrotate) );

        gi.configstring (CS_SKYAXIS, va("%f %f %f",
                st.skyaxis[0], st.skyaxis[1], st.skyaxis[2]) );

        gi.configstring (CS_CDTRACK, va("%i", ent->sounds) );

        gi.configstring (CS_MAXCLIENTS, va("%i", (int)(maxclients->value) ) );

//FIREBLADE
        if (nohud->value)
        {
                gi.configstring(CS_STATUSBAR, "");
        }
                else
//FIREBLADE
        {
                // status bar program
                if (deathmatch->value)
//FIREBLADE
                {
                        if (noscore->value && teamplay->value)
                        {
                        gi.configstring (CS_STATUSBAR, dm_noscore_statusbar);
                        }
                                else
                        {
                        gi.configstring (CS_STATUSBAR, dm_statusbar);
                        }
                }
//FIREBLADE
                else
                        gi.configstring (CS_STATUSBAR, single_statusbar);
        }

        //---------------


        // help icon for statusbar
        gi.imageindex ("i_help");
        level.pic_health = gi.imageindex ("i_health");
        gi.imageindex ("help");
        gi.imageindex ("field_3");

        // zucc - preload sniper stuff
        gi.imageindex ("scope2x");
        gi.imageindex ("scope4x");
        gi.imageindex ("scope6x");

//FIREBLADE
        gi.soundindex("atl/lights.wav");
        gi.soundindex("atl/camera.wav");
        gi.soundindex("atl/action.wav");
        gi.imageindex("tag1");
        gi.imageindex("tag2");
        gi.imageindex("tag3");
        if (teamplay->value)
        {
                if (team1_skin_index[0] == 0)
                {
                        gi.dprintf("No skin was specified for team 1 in config file.  Exiting.\n");
                        exit(1);
                }
                gi.imageindex(team1_skin_index);
                if (team2_skin_index[0] == 0)
                {
                        gi.dprintf("No skin was specified for team 2 in config file.  Exiting.\n");
                        exit(1);
                }
                gi.imageindex(team2_skin_index);
        }
        PrecacheRadioSounds();

        team_round_going = 0;
        lights_camera_action = 0;
        holding_on_tie_check = 0;
        team_round_countdown = 0;
//FIREBLADE

        if (!st.gravity)
                gi.cvar_set("sv_gravity", "800");
        else
                gi.cvar_set("sv_gravity", st.gravity);

        snd_fry = gi.soundindex ("player/fry.wav");     // standing in lava / slime

        PrecacheItem (FindItem ("Blaster"));

        gi.soundindex ("player/lava1.wav");
        gi.soundindex ("player/lava2.wav");

        gi.soundindex ("misc/pc_up.wav");
        gi.soundindex ("misc/talk1.wav");

        gi.soundindex ("misc/udeath.wav");

        // gibs
        gi.soundindex ("items/respawn1.wav");

        // sexed sounds
        gi.soundindex ("*death1.wav");
        gi.soundindex ("*death2.wav");
        gi.soundindex ("*death3.wav");
        gi.soundindex ("*death4.wav");
        gi.soundindex ("*fall1.wav");
        gi.soundindex ("*fall2.wav");   
        gi.soundindex ("*gurp1.wav");           // drowning damage
        gi.soundindex ("*gurp2.wav");   
        gi.soundindex ("*jump1.wav");           // player jump
        gi.soundindex ("*pain25_1.wav");
        gi.soundindex ("*pain25_2.wav");
        gi.soundindex ("*pain50_1.wav");
        gi.soundindex ("*pain50_2.wav");
        gi.soundindex ("*pain75_1.wav");
        gi.soundindex ("*pain75_2.wav");
        gi.soundindex ("*pain100_1.wav");
        gi.soundindex ("*pain100_2.wav");

        //-------------------

        // precache vwep models
        gi.modelindex( "#w_mk23.md2");
        gi.modelindex( "#w_mp5.md2");
        gi.modelindex( "#w_m4.md2");
        gi.modelindex( "#w_cannon.md2");
        gi.modelindex( "#w_super90.md2");
        gi.modelindex( "#w_sniper.md2");
        gi.modelindex( "#w_akimbo.md2");
        gi.modelindex( "#w_knife.md2"); 
        gi.modelindex( "#a_m61frag.md2");

        gi.soundindex ("player/gasp1.wav");             // gasping for air
        gi.soundindex ("player/gasp2.wav");             // head breaking surface, not gasping

        gi.soundindex ("player/watr_in.wav");   // feet hitting water
        gi.soundindex ("player/watr_out.wav");  // feet leaving water

        gi.soundindex ("player/watr_un.wav");   // head going underwater
        
        gi.soundindex ("player/u_breath1.wav");
        gi.soundindex ("player/u_breath2.wav");

        gi.soundindex ("items/pkup.wav");               // bonus item pickup
        gi.soundindex ("world/land.wav");               // landing thud
        gi.soundindex ("misc/h2ohit1.wav");             // landing splash

        gi.soundindex ("items/damage.wav");
        gi.soundindex ("items/protect.wav");
        gi.soundindex ("items/protect4.wav");
        gi.soundindex ("weapons/noammo.wav");

        gi.soundindex ("infantry/inflies1.wav");

        sm_meat_index = gi.modelindex ("models/objects/gibs/sm_meat/tris.md2");
        gi.modelindex ("models/objects/gibs/arm/tris.md2");
        gi.modelindex ("models/objects/gibs/bone/tris.md2");
        gi.modelindex ("models/objects/gibs/bone2/tris.md2");
        gi.modelindex ("models/objects/gibs/chest/tris.md2");
        gi.modelindex ("models/objects/gibs/skull/tris.md2");
        gi.modelindex ("models/objects/gibs/head2/tris.md2");

//
// Setup light animation tables. 'a' is total darkness, 'z' is doublebright.
//

        // 0 normal
        gi.configstring(CS_LIGHTS+0, "m");
        
        // 1 FLICKER (first variety)
        gi.configstring(CS_LIGHTS+1, "mmnmmommommnonmmonqnmmo");
        
        // 2 SLOW STRONG PULSE
        gi.configstring(CS_LIGHTS+2, "abcdefghijklmnopqrstuvwxyzyxwvutsrqponmlkjihgfedcba");
        
        // 3 CANDLE (first variety)
        gi.configstring(CS_LIGHTS+3, "mmmmmaaaaammmmmaaaaaabcdefgabcdefg");
        
        // 4 FAST STROBE
        gi.configstring(CS_LIGHTS+4, "mamamamamama");
        
        // 5 GENTLE PULSE 1
        gi.configstring(CS_LIGHTS+5,"jklmnopqrstuvwxyzyxwvutsrqponmlkj");
        
        // 6 FLICKER (second variety)
        gi.configstring(CS_LIGHTS+6, "nmonqnmomnmomomno");
        
        // 7 CANDLE (second variety)
        gi.configstring(CS_LIGHTS+7, "mmmaaaabcdefgmmmmaaaammmaamm");
        
        // 8 CANDLE (third variety)
        gi.configstring(CS_LIGHTS+8, "mmmaaammmaaammmabcdefaaaammmmabcdefmmmaaaa");
        
        // 9 SLOW STROBE (fourth variety)
        gi.configstring(CS_LIGHTS+9, "aaaaaaaazzzzzzzz");
        
        // 10 FLUORESCENT FLICKER
        gi.configstring(CS_LIGHTS+10, "mmamammmmammamamaaamammma");

        // 11 SLOW PULSE NOT FADE TO BLACK
        gi.configstring(CS_LIGHTS+11, "abcdefghijklmnopqrrqponmlkjihgfedcba");
        
        // styles 32-62 are assigned by the light program for switchable lights

        // 63 testing
        gi.configstring(CS_LIGHTS+63, "a");

//FB 6/2/99
        if (took_damage != NULL)
                gi.TagFree(took_damage);
        took_damage = (int *)gi.TagMalloc(sizeof(int) * game.maxclients, TAG_GAME);
//FB 6/2/99
}
コード例 #13
0
ファイル: g_spawn.c プロジェクト: jar3817/opentdm-pf
/*QUAKED worldspawn (0 0 0) ?

Only used for the world.
"sky"	environment map name
"skyaxis"	vector axis for rotating sky
"skyrotate"	speed of rotation in degrees/second
"sounds"	music cd track number
"gravity"	800 is default gravity
"message"	text to print at user logon
*/
void SP_worldspawn (edict_t *ent)
{
	ent->movetype = MOVETYPE_PUSH;
	ent->solid = SOLID_BSP;
	ent->inuse = true;			// since the world doesn't use G_Spawn()
	ent->s.modelindex = 1;		// world model is always index 1

	//---------------

	// reserve some spots for dead player bodies for coop / deathmatch
	InitBodyQue ();

	// set configstrings for items
	SetItemNames ();

	if (st.nextmap)
		strcpy (level.nextmap, st.nextmap);

	// make some data visible to the server

	if (ent->message && ent->message[0])
	{
		gi.configstring (CS_NAME, ent->message);
		strncpy (level.level_name, ent->message, sizeof(level.level_name));
	}
	else
		strncpy (level.level_name, level.mapname, sizeof(level.level_name));

	if (st.sky && st.sky[0])
		gi.configstring (CS_SKY, st.sky);
	else
		gi.configstring (CS_SKY, "unit1_");

	gi.configstring (CS_SKYROTATE, va("%f", st.skyrotate) );

	gi.configstring (CS_SKYAXIS, va("%f %f %f",
		st.skyaxis[0], st.skyaxis[1], st.skyaxis[2]) );

	gi.configstring (CS_CDTRACK, va("%i", ent->sounds) );

	gi.configstring (CS_MAXCLIENTS, va("%i", game.maxclients ) );

	// status bar program
	// wision: we send this as unicast on every player's connect
	// r1: but we send it globally too to avoid bugging out gtv/etc
	gi.configstring (CS_STATUSBAR, TDM_CreateSpectatorStatusBar(NULL));

	//---------------

	// help icon for statusbar
	gi.imageindex ("i_help");
	level.pic_health = gi.imageindex ("i_health");
	gi.imageindex ("help");
	gi.imageindex ("field_3");

	if (!st.gravity)
		gi.cvar_set("sv_gravity", "800");
	else
		gi.cvar_set("sv_gravity", st.gravity);

	snd_fry = gi.soundindex ("player/fry.wav");	// standing in lava / slime

	PrecacheItem (GETITEM (ITEM_WEAPON_BLASTER));

	gi.soundindex ("player/lava1.wav");
	gi.soundindex ("player/lava2.wav");

	gi.soundindex ("misc/pc_up.wav");
	gi.soundindex ("misc/talk1.wav");

	gi.soundindex ("misc/udeath.wav");

	// gibs
	gi.soundindex ("items/respawn1.wav");

	// sexed sounds
	//ugly hack for tdm / invisible eyes mode, we reserve soundindexes directly

	/*gi.soundindex ("*death1.wav");
	gi.soundindex ("*death2.wav");
	gi.soundindex ("*death3.wav");
	gi.soundindex ("*death4.wav");
	gi.soundindex ("*fall1.wav");
	gi.soundindex ("*fall2.wav");	
	gi.soundindex ("*gurp1.wav");		// drowning damage
	gi.soundindex ("*gurp2.wav");	
	gi.soundindex ("*jump1.wav");		// player jump
	gi.soundindex ("*pain25_1.wav");
	gi.soundindex ("*pain25_2.wav");
	gi.soundindex ("*pain50_1.wav");
	gi.soundindex ("*pain50_2.wav");
	gi.soundindex ("*pain75_1.wav");
	gi.soundindex ("*pain75_2.wav");
	gi.soundindex ("*pain100_1.wav");
	gi.soundindex ("*pain100_2.wav");*/


	// sexed models
	// THIS ORDER MUST MATCH THE DEFINES IN g_local.h
	// you can add more, max 15
	gi.modelindex ("#w_blaster.md2");
	gi.modelindex ("#w_shotgun.md2");
	gi.modelindex ("#w_sshotgun.md2");
	gi.modelindex ("#w_machinegun.md2");
	gi.modelindex ("#w_chaingun.md2");
	gi.modelindex ("#a_grenades.md2");
	gi.modelindex ("#w_glauncher.md2");
	gi.modelindex ("#w_rlauncher.md2");
	gi.modelindex ("#w_hyperblaster.md2");
	gi.modelindex ("#w_railgun.md2");
	gi.modelindex ("#w_bfg.md2");

	//-------------------

	gi.soundindex ("player/gasp1.wav");		// gasping for air
	gi.soundindex ("player/gasp2.wav");		// head breaking surface, not gasping

	gi.soundindex ("player/watr_in.wav");	// feet hitting water
	gi.soundindex ("player/watr_out.wav");	// feet leaving water

	gi.soundindex ("player/watr_un.wav");	// head going underwater
	
	gi.soundindex ("player/u_breath1.wav");
	gi.soundindex ("player/u_breath2.wav");

	gi.soundindex ("items/pkup.wav");		// bonus item pickup
	gi.soundindex ("world/land.wav");		// landing thud
	gi.soundindex ("misc/h2ohit1.wav");		// landing splash

	gi.soundindex ("items/damage.wav");
	gi.soundindex ("items/protect.wav");
	gi.soundindex ("items/protect4.wav");
	gi.soundindex ("weapons/noammo.wav");

	gi.soundindex ("infantry/inflies1.wav");

	sm_meat_index = gi.modelindex ("models/objects/gibs/sm_meat/tris.md2");
	gi.modelindex ("models/objects/gibs/arm/tris.md2");
	gi.modelindex ("models/objects/gibs/bone/tris.md2");
	gi.modelindex ("models/objects/gibs/bone2/tris.md2");
	gi.modelindex ("models/objects/gibs/chest/tris.md2");
	gi.modelindex ("models/objects/gibs/skull/tris.md2");
	gi.modelindex ("models/objects/gibs/head2/tris.md2");

	gi.soundindex (g_vote_attention_sound->string);

	//this is to force precache of the opentdm 'invisible player' model so it
	//is auto downloaded (hopefully!)
	//gi.modelindex ("players/opentdm/tris.md2");
	//gi.modelindex ("players/opentdm/weapon.md2");

	//gi.configstring (CS_PLAYERSKINS+255, "null\\opentdm/null");

//
// Setup light animation tables. 'a' is total darkness, 'z' is doublebright.
//

	// 0 normal
	gi.configstring(CS_LIGHTS+0, "m");
	
	// 1 FLICKER (first variety)
	gi.configstring(CS_LIGHTS+1, "mmnmmommommnonmmonqnmmo");
	
	// 2 SLOW STRONG PULSE
	gi.configstring(CS_LIGHTS+2, "abcdefghijklmnopqrstuvwxyzyxwvutsrqponmlkjihgfedcba");
	
	// 3 CANDLE (first variety)
	gi.configstring(CS_LIGHTS+3, "mmmmmaaaaammmmmaaaaaabcdefgabcdefg");
	
	// 4 FAST STROBE
	gi.configstring(CS_LIGHTS+4, "mamamamamama");
	
	// 5 GENTLE PULSE 1
	gi.configstring(CS_LIGHTS+5,"jklmnopqrstuvwxyzyxwvutsrqponmlkj");
	
	// 6 FLICKER (second variety)
	gi.configstring(CS_LIGHTS+6, "nmonqnmomnmomomno");
	
	// 7 CANDLE (second variety)
	gi.configstring(CS_LIGHTS+7, "mmmaaaabcdefgmmmmaaaammmaamm");
	
	// 8 CANDLE (third variety)
	gi.configstring(CS_LIGHTS+8, "mmmaaammmaaammmabcdefaaaammmmabcdefmmmaaaa");
	
	// 9 SLOW STROBE (fourth variety)
	gi.configstring(CS_LIGHTS+9, "aaaaaaaazzzzzzzz");
	
	// 10 FLUORESCENT FLICKER
	gi.configstring(CS_LIGHTS+10, "mmamammmmammamamaaamammma");

	// 11 SLOW PULSE NOT FADE TO BLACK
	gi.configstring(CS_LIGHTS+11, "abcdefghijklmnopqrrqponmlkjihgfedcba");
	
	// styles 32-62 are assigned by the light program for switchable lights

	// 63 testing
	gi.configstring(CS_LIGHTS+63, "a");
}