Portable Half-Life SDK. GoldSource and Xash3D. Crossplatform.
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

719 lines
18 KiB

7 years ago
/***
*
* Copyright (c) 1996-2002, Valve LLC. All rights reserved.
*
* This product contains software technology licensed from Id
* Software, Inc. ("Id Technology"). Id Technology (c) 1996 Id Software, Inc.
* All Rights Reserved.
*
* Use, distribution, and modification of this source code and/or resulting
* object code is restricted to non-commercial enhancements to products from
* Valve LLC. All other use, distribution, or modification is prohibited
* without written permission from Valve LLC.
*
****/
/*
===== world.cpp ========================================================
precaches and defs for entities and other data that must always be available.
*/
#include "extdll.h"
#include "util.h"
#include "cbase.h"
#include "nodes.h"
#include "soundent.h"
#include "client.h"
#include "decals.h"
#include "skill.h"
#include "effects.h"
#include "player.h"
#include "weapons.h"
#include "gamerules.h"
#include "teamplay_gamerules.h"
#include "movewith.h" //LRC
extern CGraph WorldGraph;
extern CSoundEnt *pSoundEnt;
extern CBaseEntity *g_pLastSpawn;
DLL_GLOBAL edict_t *g_pBodyQueueHead;
CGlobalState gGlobalState;
8 years ago
extern DLL_GLOBAL int gDisplayTitle;
7 years ago
8 years ago
extern void W_Precache( void );
7 years ago
//
// This must match the list in util.h
//
DLL_DECALLIST gDecals[] = {
8 years ago
{ "{shot1", 0 }, // DECAL_GUNSHOT1
{ "{shot2", 0 }, // DECAL_GUNSHOT2
{ "{shot3", 0 }, // DECAL_GUNSHOT3
{ "{shot4", 0 }, // DECAL_GUNSHOT4
{ "{shot5", 0 }, // DECAL_GUNSHOT5
7 years ago
{ "{lambda01", 0 }, // DECAL_LAMBDA1
{ "{lambda02", 0 }, // DECAL_LAMBDA2
{ "{lambda03", 0 }, // DECAL_LAMBDA3
{ "{lambda04", 0 }, // DECAL_LAMBDA4
{ "{lambda05", 0 }, // DECAL_LAMBDA5
{ "{lambda06", 0 }, // DECAL_LAMBDA6
{ "{scorch1", 0 }, // DECAL_SCORCH1
{ "{scorch2", 0 }, // DECAL_SCORCH2
{ "{blood1", 0 }, // DECAL_BLOOD1
{ "{blood2", 0 }, // DECAL_BLOOD2
{ "{blood3", 0 }, // DECAL_BLOOD3
{ "{blood4", 0 }, // DECAL_BLOOD4
{ "{blood5", 0 }, // DECAL_BLOOD5
{ "{blood6", 0 }, // DECAL_BLOOD6
{ "{yblood1", 0 }, // DECAL_YBLOOD1
{ "{yblood2", 0 }, // DECAL_YBLOOD2
{ "{yblood3", 0 }, // DECAL_YBLOOD3
{ "{yblood4", 0 }, // DECAL_YBLOOD4
{ "{yblood5", 0 }, // DECAL_YBLOOD5
{ "{yblood6", 0 }, // DECAL_YBLOOD6
{ "{break1", 0 }, // DECAL_GLASSBREAK1
{ "{break2", 0 }, // DECAL_GLASSBREAK2
{ "{break3", 0 }, // DECAL_GLASSBREAK3
{ "{bigshot1", 0 }, // DECAL_BIGSHOT1
{ "{bigshot2", 0 }, // DECAL_BIGSHOT2
{ "{bigshot3", 0 }, // DECAL_BIGSHOT3
{ "{bigshot4", 0 }, // DECAL_BIGSHOT4
{ "{bigshot5", 0 }, // DECAL_BIGSHOT5
{ "{spit1", 0 }, // DECAL_SPIT1
{ "{spit2", 0 }, // DECAL_SPIT2
{ "{bproof1", 0 }, // DECAL_BPROOF1
8 years ago
{ "{gargstomp", 0 }, // DECAL_GARGSTOMP1, // Gargantua stomp crack
{ "{smscorch1", 0 }, // DECAL_SMALLSCORCH1, // Small scorch mark
{ "{smscorch2", 0 }, // DECAL_SMALLSCORCH2, // Small scorch mark
{ "{smscorch3", 0 }, // DECAL_SMALLSCORCH3, // Small scorch mark
{ "{mommablob", 0 }, // DECAL_MOMMABIRTH // BM Birth spray
{ "{mommablob", 0 }, // DECAL_MOMMASPLAT // BM Mortar spray?? need decal
7 years ago
};
/*
==============================================================================
BODY QUE
==============================================================================
*/
#define SF_DECAL_NOTINDEATHMATCH 2048
class CDecal : public CBaseEntity
{
public:
8 years ago
void Spawn( void );
void KeyValue( KeyValueData *pkvd );
void EXPORT StaticDecal( void );
void EXPORT TriggerDecal( CBaseEntity *pActivator, CBaseEntity *pCaller, USE_TYPE useType, float value );
7 years ago
};
LINK_ENTITY_TO_CLASS( infodecal, CDecal )
7 years ago
// UNDONE: These won't get sent to joining players in multi-player
8 years ago
void CDecal::Spawn( void )
7 years ago
{
8 years ago
if( pev->skin < 0 || ( gpGlobals->deathmatch && FBitSet( pev->spawnflags, SF_DECAL_NOTINDEATHMATCH ) ) )
7 years ago
{
8 years ago
REMOVE_ENTITY( ENT( pev ) );
7 years ago
return;
}
8 years ago
if( FStringNull( pev->targetname ) )
7 years ago
{
9 years ago
SetThink( &CDecal::StaticDecal );
7 years ago
// if there's no targetname, the decal will spray itself on as soon as the world is done spawning.
SetNextThink( 0 );
}
else
{
// if there IS a targetname, the decal sprays itself on when it is triggered.
SetThink(&CDecal :: SUB_DoNothing );
8 years ago
SetUse( &CDecal::TriggerDecal );
7 years ago
}
}
8 years ago
void CDecal::TriggerDecal( CBaseEntity *pActivator, CBaseEntity *pCaller, USE_TYPE useType, float value )
7 years ago
{
// this is set up as a USE function for infodecals that have targetnames, so that the
// decal doesn't get applied until it is fired. (usually by a scripted sequence)
TraceResult trace;
8 years ago
int entityIndex;
7 years ago
8 years ago
UTIL_TraceLine( pev->origin - Vector( 5, 5, 5 ), pev->origin + Vector( 5, 5, 5 ), ignore_monsters, ENT( pev ), &trace );
7 years ago
8 years ago
MESSAGE_BEGIN( MSG_BROADCAST, SVC_TEMPENTITY );
7 years ago
WRITE_BYTE( TE_BSPDECAL );
WRITE_COORD( pev->origin.x );
WRITE_COORD( pev->origin.y );
WRITE_COORD( pev->origin.z );
WRITE_SHORT( (int)pev->skin );
8 years ago
entityIndex = (short)ENTINDEX( trace.pHit );
7 years ago
WRITE_SHORT( entityIndex );
8 years ago
if( entityIndex )
WRITE_SHORT( (int)VARS( trace.pHit )->modelindex );
7 years ago
MESSAGE_END();
SetThink( &CDecal::SUB_Remove );
SetNextThink( 0.1f );
7 years ago
}
8 years ago
void CDecal::StaticDecal( void )
7 years ago
{
TraceResult trace;
8 years ago
int entityIndex, modelIndex;
7 years ago
8 years ago
UTIL_TraceLine( pev->origin - Vector( 5, 5, 5 ), pev->origin + Vector( 5, 5, 5 ), ignore_monsters, ENT( pev ), &trace );
7 years ago
8 years ago
entityIndex = (short)ENTINDEX( trace.pHit );
if( entityIndex )
modelIndex = (int)VARS( trace.pHit )->modelindex;
7 years ago
else
modelIndex = 0;
g_engfuncs.pfnStaticDecal( pev->origin, (int)pev->skin, entityIndex, modelIndex );
SUB_Remove();
}
8 years ago
void CDecal::KeyValue( KeyValueData *pkvd )
7 years ago
{
8 years ago
if( FStrEq( pkvd->szKeyName, "texture" ) )
7 years ago
{
pev->skin = DECAL_INDEX( pkvd->szValue );
7 years ago
// Found
8 years ago
if( pev->skin >= 0 )
7 years ago
return;
9 years ago
ALERT( at_console, "Can't find decal %s\n", pkvd->szValue );
7 years ago
}
else
CBaseEntity::KeyValue( pkvd );
}
// Body queue class here.... It's really just CBaseEntity
class CCorpse : public CBaseEntity
{
virtual int ObjectCaps( void ) { return FCAP_DONT_SAVE; }
};
LINK_ENTITY_TO_CLASS( bodyque, CCorpse )
7 years ago
8 years ago
static void InitBodyQue( void )
7 years ago
{
8 years ago
string_t istrClassname = MAKE_STRING( "bodyque" );
7 years ago
g_pBodyQueueHead = CREATE_NAMED_ENTITY( istrClassname );
8 years ago
entvars_t *pev = VARS( g_pBodyQueueHead );
7 years ago
// Reserve 3 more slots for dead bodies
8 years ago
for( int i = 0; i < 3; i++ )
7 years ago
{
pev->owner = CREATE_NAMED_ENTITY( istrClassname );
8 years ago
pev = VARS( pev->owner );
7 years ago
}
7 years ago
pev->owner = g_pBodyQueueHead;
}
//
// make a body que entry for the given ent so the ent can be respawned elsewhere
//
// GLOBALS ASSUMED SET: g_eoBodyQueueHead
//
8 years ago
void CopyToBodyQue( entvars_t *pev )
7 years ago
{
8 years ago
if( pev->effects & EF_NODRAW )
7 years ago
return;
8 years ago
entvars_t *pevHead = VARS( g_pBodyQueueHead );
7 years ago
pevHead->angles = pev->angles;
pevHead->model = pev->model;
pevHead->modelindex = pev->modelindex;
pevHead->frame = pev->frame;
pevHead->colormap = pev->colormap;
pevHead->movetype = MOVETYPE_TOSS;
pevHead->velocity = pev->velocity;
pevHead->flags = 0;
pevHead->deadflag = pev->deadflag;
pevHead->renderfx = kRenderFxDeadPlayer;
pevHead->renderamt = ENTINDEX( ENT( pev ) );
8 years ago
pevHead->effects = pev->effects | EF_NOINTERP;
7 years ago
//pevHead->goalstarttime = pev->goalstarttime;
8 years ago
//pevHead->goalframe = pev->goalframe;
7 years ago
//pevHead->goalendtime = pev->goalendtime ;
7 years ago
pevHead->sequence = pev->sequence;
pevHead->animtime = pev->animtime;
UTIL_SetEdictOrigin(g_pBodyQueueHead, pev->origin);
8 years ago
UTIL_SetSize( pevHead, pev->mins, pev->maxs );
7 years ago
g_pBodyQueueHead = pevHead->owner;
}
CGlobalState::CGlobalState( void )
{
Reset();
}
void CGlobalState::Reset( void )
{
m_pList = NULL;
m_listCount = 0;
}
8 years ago
globalentity_t *CGlobalState::Find( string_t globalname )
7 years ago
{
8 years ago
if( !globalname )
7 years ago
return NULL;
globalentity_t *pTest;
8 years ago
const char *pEntityName = STRING( globalname );
7 years ago
pTest = m_pList;
8 years ago
while( pTest )
7 years ago
{
8 years ago
if( FStrEq( pEntityName, pTest->name ) )
7 years ago
break;
7 years ago
pTest = pTest->pNext;
}
return pTest;
}
// This is available all the time now on impulse 104, remove later
4 years ago
//#if _DEBUG
8 years ago
void CGlobalState::DumpGlobals( void )
7 years ago
{
static const char *estates[] = { "Off", "On", "Dead" };
7 years ago
globalentity_t *pTest;
9 years ago
ALERT( at_console, "-- Globals --\n" );
7 years ago
pTest = m_pList;
8 years ago
while( pTest )
7 years ago
{
9 years ago
ALERT( at_console, "%s: %s (%s)\n", pTest->name, pTest->levelName, estates[pTest->state] );
7 years ago
pTest = pTest->pNext;
}
}
//#endif
8 years ago
void CGlobalState::EntityAdd( string_t globalname, string_t mapName, GLOBALESTATE state )
7 years ago
{
8 years ago
ASSERT( !Find( globalname ) );
7 years ago
globalentity_t *pNewEntity = (globalentity_t *)calloc( sizeof( globalentity_t ), 1 );
ASSERT( pNewEntity != NULL );
pNewEntity->pNext = m_pList;
m_pList = pNewEntity;
strcpy( pNewEntity->name, STRING( globalname ) );
8 years ago
strcpy( pNewEntity->levelName, STRING( mapName ) );
7 years ago
pNewEntity->state = state;
m_listCount++;
}
8 years ago
void CGlobalState::EntitySetState( string_t globalname, GLOBALESTATE state )
7 years ago
{
globalentity_t *pEnt = Find( globalname );
8 years ago
if( pEnt )
7 years ago
pEnt->state = state;
}
const globalentity_t *CGlobalState :: EntityFromTable( string_t globalname )
{
globalentity_t *pEnt = Find( globalname );
return pEnt;
}
8 years ago
GLOBALESTATE CGlobalState::EntityGetState( string_t globalname )
7 years ago
{
globalentity_t *pEnt = Find( globalname );
8 years ago
if( pEnt )
7 years ago
return pEnt->state;
return GLOBAL_OFF;
}
// Global Savedata for Delay
TYPEDESCRIPTION CGlobalState::m_SaveData[] =
7 years ago
{
DEFINE_FIELD( CGlobalState, m_listCount, FIELD_INTEGER ),
};
// Global Savedata for Delay
TYPEDESCRIPTION gGlobalEntitySaveData[] =
7 years ago
{
DEFINE_ARRAY( globalentity_t, name, FIELD_CHARACTER, 64 ),
DEFINE_ARRAY( globalentity_t, levelName, FIELD_CHARACTER, 32 ),
DEFINE_FIELD( globalentity_t, state, FIELD_INTEGER ),
};
int CGlobalState::Save( CSave &save )
{
int i;
globalentity_t *pEntity;
if ( !save.WriteFields( "cGLOBAL", "GLOBAL", this, m_SaveData, ARRAYSIZE(m_SaveData) ) )
return 0;
pEntity = m_pList;
8 years ago
for( i = 0; i < m_listCount && pEntity; i++ )
7 years ago
{
if ( !save.WriteFields( "cGENT", "GENT", pEntity, gGlobalEntitySaveData, ARRAYSIZE(gGlobalEntitySaveData) ) )
return 0;
pEntity = pEntity->pNext;
}
return 1;
}
int CGlobalState::Restore( CRestore &restore )
{
int i, listCount;
globalentity_t tmpEntity;
ClearStates();
8 years ago
if( !restore.ReadFields( "GLOBAL", this, m_SaveData, ARRAYSIZE( m_SaveData ) ) )
7 years ago
return 0;
7 years ago
listCount = m_listCount; // Get new list count
m_listCount = 0; // Clear loaded data
8 years ago
for( i = 0; i < listCount; i++ )
7 years ago
{
8 years ago
if( !restore.ReadFields( "GENT", &tmpEntity, gGlobalEntitySaveData, ARRAYSIZE( gGlobalEntitySaveData ) ) )
7 years ago
return 0;
8 years ago
EntityAdd( MAKE_STRING( tmpEntity.name ), MAKE_STRING( tmpEntity.levelName ), tmpEntity.state );
7 years ago
}
return 1;
}
void CGlobalState::EntityUpdate( string_t globalname, string_t mapname )
{
globalentity_t *pEnt = Find( globalname );
8 years ago
if( pEnt )
strcpy( pEnt->levelName, STRING( mapname ) );
7 years ago
}
void CGlobalState::ClearStates( void )
{
globalentity_t *pFree = m_pList;
8 years ago
while( pFree )
7 years ago
{
globalentity_t *pNext = pFree->pNext;
free( pFree );
pFree = pNext;
}
Reset();
}
void SaveGlobalState( SAVERESTOREDATA *pSaveData )
{
CSave saveHelper( pSaveData );
gGlobalState.Save( saveHelper );
}
void RestoreGlobalState( SAVERESTOREDATA *pSaveData )
{
CRestore restoreHelper( pSaveData );
gGlobalState.Restore( restoreHelper );
}
void ResetGlobalState( void )
{
gGlobalState.ClearStates();
gInitHUD = TRUE; // Init the HUD on a new game / load game
}
// moved CWorld class definition to cbase.h
//=======================
// CWorld
//
// This spawns first when each level begins.
//=======================
LINK_ENTITY_TO_CLASS( worldspawn, CWorld )
7 years ago
#define SF_WORLD_DARK 0x0001 // Fade from black at startup
#define SF_WORLD_TITLE 0x0002 // Display game title at startup
#define SF_WORLD_FORCETEAM 0x0004 // Force teams
//#define SF_WORLD_STARTSUIT 0x0008 // LRC- Start this level with an HEV suit!
extern DLL_GLOBAL BOOL g_fGameOver;
BOOL g_startSuit; //LRC
8 years ago
void CWorld::Spawn( void )
7 years ago
{
g_fGameOver = FALSE;
8 years ago
Precache();
7 years ago
}
8 years ago
void CWorld::Precache( void )
7 years ago
{
//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
8 years ago
CVAR_SET_STRING( "sv_gravity", "800" ); // 67ft/sec
CVAR_SET_STRING( "sv_stepsize", "18" );
7 years ago
#else
8 years ago
CVAR_SET_STRING( "sv_gravity", "384" ); // 32ft/sec
CVAR_SET_STRING( "sv_stepsize", "24" );
7 years ago
#endif
8 years ago
CVAR_SET_STRING( "room_type", "0" );// clear DSP
7 years ago
// Set up game rules
8 years ago
if( g_pGameRules )
7 years ago
{
delete g_pGameRules;
8 years ago
g_pGameRules = NULL;
7 years ago
}
8 years ago
g_pGameRules = InstallGameRules();
7 years ago
//!!!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 );
if( pSoundEnt )
7 years ago
{
pSoundEnt->Spawn();
}
else
9 years ago
{
ALERT ( at_console, "**COULD NOT CREATE SOUNDENT**\n" );
7 years ago
}
InitBodyQue();
// init sentence group playback stuff from sentences.txt.
// ok to call this multiple times, calls after first are ignored.
7 years ago
SENTENCEG_Init();
// the area based ambient sounds MUST be the first precache_sounds
// player precaches
8 years ago
W_Precache(); // get weapon precaches
7 years ago
ClientPrecache();
// sounds used from C physics code
8 years ago
PRECACHE_SOUND( "common/null.wav" );// clears sound channels
7 years ago
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" );
8 years ago
if( g_Language == LANGUAGE_GERMAN )
7 years ago
{
PRECACHE_MODEL( "models/germangibs.mdl" );
}
else
{
PRECACHE_MODEL( "models/hgibs.mdl" );
PRECACHE_MODEL( "models/agibs.mdl" );
}
8 years ago
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" );
7 years ago
PRECACHE_MODEL( "sprites/null.spr" ); //LRC
//
// Setup light animation tables. 'a' is total darkness, 'z' is maxbright.
//
7 years ago
int i;
// 0 normal
for (i = 0; i <= 13; i++)
{
LIGHT_STYLE(i, (char*)STRING(GetStdLightStyle(i)));
}
7 years ago
// styles 32-62 are assigned by the light program for switchable lights
// 63 testing
8 years ago
LIGHT_STYLE( 63, "a" );
7 years ago
for( i = 0; i < (int)ARRAYSIZE( gDecals ); i++ )
7 years ago
gDecals[i].index = DECAL_INDEX( gDecals[i].name );
// init the WorldGraph.
7 years ago
WorldGraph.InitGraph();
// make sure the .NOD file is newer than the .BSP file.
if( !WorldGraph.CheckNODFile( STRING( gpGlobals->mapname ) ) )
{
// NOD file is not present, or is older than the BSP file.
8 years ago
WorldGraph.AllocNodes();
7 years ago
}
else
{
// Load the node graph for this level
if( !WorldGraph.FLoadGraph( STRING( gpGlobals->mapname ) ) )
{
// couldn't load, so alloc and prepare to build a graph.
8 years ago
ALERT( at_console, "*Error opening .NOD file\n" );
WorldGraph.AllocNodes();
7 years ago
}
else
{
8 years ago
ALERT( at_console, "\n*Graph Loaded!\n" );
7 years ago
}
}
8 years ago
if( pev->speed > 0 )
7 years ago
CVAR_SET_FLOAT( "sv_zmax", pev->speed );
else
CVAR_SET_FLOAT( "sv_zmax", 4096 );
9 years ago
// g-cont. moved here to right restore global WaveHeight on save\restore level
CVAR_SET_FLOAT( "sv_wateramp", pev->scale );
8 years ago
if( pev->netname )
7 years ago
{
8 years ago
ALERT( at_aiconsole, "Chapter title: %s\n", STRING( pev->netname ) );
7 years ago
CBaseEntity *pEntity = CBaseEntity::Create( "env_message", g_vecZero, g_vecZero, NULL );
8 years ago
if( pEntity )
7 years ago
{
pEntity->SetThink(&CWorld::SUB_CallUseToggle );
pEntity->pev->message = pev->netname;
pev->netname = 0;
pEntity->SetNextThink( 0.3f );
7 years ago
pEntity->pev->spawnflags = SF_MESSAGE_ONCE;
}
}
8 years ago
if( pev->spawnflags & SF_WORLD_DARK )
CVAR_SET_FLOAT( "v_dark", 1.0f );
7 years ago
else
CVAR_SET_FLOAT( "v_dark", 0.0f );
7 years ago
9 years ago
pev->spawnflags &= ~SF_WORLD_DARK; // g-cont. don't apply fade after save\restore
8 years ago
if( pev->spawnflags & SF_WORLD_TITLE )
7 years ago
gDisplayTitle = TRUE; // display the game title if this key is set
else
gDisplayTitle = FALSE;
9 years ago
pev->spawnflags &= ~SF_WORLD_TITLE; // g-cont. don't show logo after save\restore
8 years ago
if( pev->spawnflags & SF_WORLD_FORCETEAM )
7 years ago
{
CVAR_SET_FLOAT( "mp_defaultteam", 1.0f );
7 years ago
}
else
{
CVAR_SET_FLOAT( "mp_defaultteam", 0.0f );
7 years ago
}
9 years ago
}
7 years ago
//
// Just to ignore the "wad" field.
//
8 years ago
void CWorld::KeyValue( KeyValueData *pkvd )
7 years ago
{
8 years ago
if( FStrEq( pkvd->szKeyName, "skyname" ) )
7 years ago
{
// Sent over net now.
CVAR_SET_STRING( "sv_skyname", pkvd->szValue );
pkvd->fHandled = TRUE;
}
8 years ago
else if( FStrEq( pkvd->szKeyName, "sounds" ) )
7 years ago
{
8 years ago
gpGlobals->cdAudioTrack = atoi( pkvd->szValue );
7 years ago
pkvd->fHandled = TRUE;
}
8 years ago
else if( FStrEq(pkvd->szKeyName, "WaveHeight" ) )
7 years ago
{
// Sent over net now.
pev->scale = atof( pkvd->szValue ) * ( 1.0f / 8.0f );
7 years ago
pkvd->fHandled = TRUE;
CVAR_SET_FLOAT( "sv_wateramp", pev->scale );
}
8 years ago
else if( FStrEq( pkvd->szKeyName, "MaxRange" ) )
7 years ago
{
8 years ago
pev->speed = atof( pkvd->szValue );
7 years ago
pkvd->fHandled = TRUE;
}
8 years ago
else if( FStrEq( pkvd->szKeyName, "chaptertitle" ) )
7 years ago
{
8 years ago
pev->netname = ALLOC_STRING( pkvd->szValue );
7 years ago
pkvd->fHandled = TRUE;
}
8 years ago
else if( FStrEq( pkvd->szKeyName, "startdark" ) )
7 years ago
{
// UNDONE: This is a gross hack!!! The CVAR is NOT sent over the client/sever link
// but it will work for single player
8 years ago
int flag = atoi( pkvd->szValue );
7 years ago
pkvd->fHandled = TRUE;
8 years ago
if( flag )
7 years ago
pev->spawnflags |= SF_WORLD_DARK;
}
8 years ago
else if( FStrEq(pkvd->szKeyName, "newunit") )
7 years ago
{
// Single player only. Clear save directory if set
8 years ago
if( atoi( pkvd->szValue ) )
7 years ago
CVAR_SET_FLOAT( "sv_newunit", 1 );
pkvd->fHandled = TRUE;
}
8 years ago
else if( FStrEq(pkvd->szKeyName, "gametitle" ) )
7 years ago
{
8 years ago
if( atoi( pkvd->szValue ) )
7 years ago
pev->spawnflags |= SF_WORLD_TITLE;
pkvd->fHandled = TRUE;
}
8 years ago
else if( FStrEq( pkvd->szKeyName, "mapteams" ) )
7 years ago
{
pev->team = ALLOC_STRING( pkvd->szValue );
pkvd->fHandled = TRUE;
}
8 years ago
else if( FStrEq( pkvd->szKeyName, "defaultteam" ) )
7 years ago
{
8 years ago
if( atoi( pkvd->szValue ) )
7 years ago
{
pev->spawnflags |= SF_WORLD_FORCETEAM;
}
pkvd->fHandled = TRUE;
}
//LRC- let map designers start the player with his suit already on
7 years ago
else if ( FStrEq(pkvd->szKeyName, "startsuit") )
{
g_startSuit = atoi(pkvd->szValue);
pkvd->fHandled = TRUE;
}
else if ( FStrEq(pkvd->szKeyName, "allowmonsters") )
{
CVAR_SET_FLOAT( "mp_allowmonsters", atof(pkvd->szValue) );
pkvd->fHandled = TRUE;
}
//LRC- ends
else
CBaseEntity::KeyValue( pkvd );
}
9 years ago