34 #include "../idlib/precompiled.h"
72 for( i = 0; i < targets.Num(); i++ ) {
73 ent = targets[
i ].GetEntity();
105 for( i = 0; i < targets.Num(); i++ ) {
106 ent = targets[
i ].GetEntity();
139 damage = spawnArgs.GetString(
"def_damage",
"damage_generic" );
140 for( i = 0; i < targets.Num(); i++ ) {
141 ent = targets[
i ].GetEntity();
193 if ( spawnArgs.GetBool(
"endOfGame" ) ) {
199 if ( spawnArgs.GetBool(
"endOfGame" ) ) {
205 if ( !spawnArgs.GetString(
"nextMap",
"", nextMap ) ) {
206 gameLocal.
Printf(
"idTarget_SessionCommand::Event_Activate: no nextMap key\n" );
210 if ( spawnArgs.GetInt(
"devmap",
"0" ) ) {
239 BecomeInactive( TH_THINK );
243 BecomeActive( TH_THINK );
286 int parm = spawnArgs.GetInt(
"globalParm" );
318 if ( spawnArgs.GetVector(
"_color",
"1 1 1", color ) ) {
319 for( i = 0; i < targets.Num(); i++ ) {
320 ent = targets[
i ].GetEntity();
322 ent->
SetColor( color[ 0 ], color[ 1 ], color[ 2 ] );
329 if ( spawnArgs.GetFloat(
va(
"shaderParm%d", parmnum ),
"0", value ) ) {
330 for( i = 0; i < targets.Num(); i++ ) {
331 ent = targets[
i ].GetEntity();
336 if (spawnArgs.GetBool(
"toggle") && (value == 0 || value == 1)) {
340 spawnArgs.SetFloat(
va(
"shaderParm%d", parmnum), value);
370 for( i = 0; i < targets.Num(); i++ ) {
371 ent = targets[
i ].GetEntity();
374 if ( ent->
IsType( idLight::Type ) ) {
513 if ( !targets.Num() ) {
517 time = spawnArgs.GetFloat(
"fadetime" );
519 for( i = 0; i < targets.Num(); i++ ) {
520 ent = targets[
i ].GetEntity();
524 if ( ent->
IsType( idLight::Type ) ) {
525 light =
static_cast<idLight *
>( ent );
556 if ( !targets.Num() ) {
560 time = spawnArgs.GetFloat(
"fadetime" );
562 for( i = 0; i < targets.Num(); i++ ) {
563 ent = targets[
i ].GetEntity();
567 if ( ent->
IsType( idLight::Type ) ) {
568 light =
static_cast<idLight *
>( ent );
594 if ( spawnArgs.GetBool(
"onSpawn" ) ) {
595 PostEventMS( &EV_Activate, 50 );
610 static int giveNum = 0;
619 d2.
Set(
"name",
va(
"givenitem_%i", giveNum++ ) );
687 model = spawnArgs.GetString(
"newmodel" );
741 switchToCamera =
NULL;
743 restoreOnTrigger =
false;
793 savefile->
WriteInt( savedGuiList.Num() );
794 for( i = 0; i < savedGuiList.Num(); i++ ) {
796 savefile->
WriteUserInterface(savedGuiList[i].gui[
j], savedGuiList[i].gui[j] ? savedGuiList[i].gui[j]->IsUniqued() :
false);
813 for( i = 0; i <
num; i++ ) {
819 for( i = 0; i <
num; i++ ) {
825 for( i = 0; i <
num; i++ ) {
831 for ( i = 0; i <
num; i++ ) {
860 for( i = 0; i <
num; i++ ) {
865 savedGuiList.Append( temp );
924 int i, listedEntities;
939 savedGuiList.Clear();
943 lights = sounds = guis = models = vision =
true;
948 for ( i = 0; i < listedEntities; i++ ) {
956 for( i = 0; i < listedEntities; i++ ) {
971 savedGuiList.Append(temp);
1041 if ( parm && *parm ) {
1057 if ( ent ==
NULL ) {
1061 color =
generic->spawnArgs.GetVector(
"color_demonic" );
1062 colorTo.
Set( color.
x, color.
y, color.
z, 1.0f );
1068 if ( ent ==
NULL || !ent->
IsType( idLight::Type ) ) {
1071 light =
static_cast<idLight *
>(ent);
1073 if ( parm && *parm ) {
1079 colorTo.
Set( color.
x, color.
y, color.
z, 1.0f );
1085 if ( ent ==
NULL || !ent->
IsType( idSound::Type ) ) {
1088 sound =
static_cast<idSound *
>(ent);
1090 if ( parm && *parm ) {
1140 if ( parm && *parm ) {
1195 if ( ent ==
NULL ) {
1199 colorTo.
Set( 1.0
f, 1.0
f, 1.0
f, 1.0
f );
1205 if ( ent ==
NULL || !ent->
IsType( idLight::Type ) ) {
1208 light =
static_cast<idLight *
>(ent);
1214 colorTo.
Set( color.
x, color.
y, color.
z, 1.0f );
1220 if ( ent ==
NULL || !ent->
IsType( idSound::Type ) ) {
1223 sound =
static_cast<idSound *
>(ent);
1286 for( i = 0; i < targets.Num(); i++ ) {
1287 ent = targets[
i ].GetEntity();
1289 kv = spawnArgs.MatchPrefix(
"keyval");
1305 kv = spawnArgs.MatchPrefix(
"keyval", kv );
1334 savefile->WriteFloat( fovSetting.GetStartTime() );
1335 savefile->WriteFloat( fovSetting.GetDuration() );
1336 savefile->WriteFloat( fovSetting.GetStartValue() );
1337 savefile->WriteFloat( fovSetting.GetEndValue() );
1439 lock = spawnArgs.GetInt(
"locked",
"1" );
1440 for( i = 0; i < targets.Num(); i++ ) {
1441 ent = targets[
i ].GetEntity();
1442 if ( ent && ent->
IsType( idDoor::Type ) ) {
1443 if ( static_cast<idDoor *>( ent )->IsLocked() ) {
1444 static_cast<idDoor *
>( ent )->Lock( 0 );
1446 static_cast<idDoor *
>( ent )->Lock( lock );
1473 const char *funcName;
1476 funcName = spawnArgs.GetString(
"call" );
1477 for( i = 0; i < targets.Num(); i++ ) {
1478 ent = targets[
i ].GetEntity();
1482 gameLocal.
Error(
"Function '%s' not found on entity '%s' for function call from '%s'", funcName, ent->
name.
c_str(),
name.c_str() );
1485 gameLocal.
Error(
"Function '%s' on entity '%s' has the wrong number of parameters for function call from '%s'", funcName, ent->
name.
c_str(),
name.c_str() );
1488 gameLocal.
Error(
"Function '%s' on entity '%s' is the wrong type for function call from '%s'", funcName, ent->
name.
c_str(),
name.c_str() );
1522 if ( spawnArgs.GetBool(
"disable" ) ) {
1529 weap = spawnArgs.GetString(
"weapon" );
1533 if ( weap && weap[ 0 ] ) {
1633 if ( v.
Length() > 96.0f ) {
1662 player->
GiveSecurity( spawnArgs.GetString(
"text_security" ) );
1691 kv = spawnArgs.MatchPrefix(
"weapon", kv );
1720 player->
SetLevelTrigger( spawnArgs.GetString(
"levelName" ), spawnArgs.GetString(
"triggerName" ) );
1747 if ( spawnArgs.GetBool(
"enable" ) ) {
1776 float fadeTime = spawnArgs.GetFloat(
"fadeTime" );
1777 float fadeDB = spawnArgs.GetFloat(
"fadeDB" );
1778 float fadeDuration = spawnArgs.GetFloat(
"fadeDuration" );
1779 int fadeClass = spawnArgs.GetInt(
"fadeClass" );
1783 if ( fadeDuration ) {
1784 PostEventSec( &EV_RestoreVolume, fadeDuration );
virtual const idVec3 & GetOrigin(int id=0) const =0
idPlayer * GetLocalPlayer() const
void Fade(const idVec4 &to, float fadeTime)
float GetFloat(const char *key, const char *defaultString="0") const
GLsizei const GLfloat * value
void WriteString(const char *string)
int GetInt(const char *key, const char *defaultString="0") const
bool PostEventSec(const idEventDef *ev, float time)
idCVar g_fov("g_fov","90", CVAR_GAME|CVAR_INTEGER|CVAR_NOCHEAT,"")
virtual const idSoundShader * FindSound(const char *name, bool makeDefault=true)=0
virtual void StateChanged(int time, bool redraw=false)=0
const idDict * FindEntityDefDict(const char *name, bool makeDefault=true) const
idCVarSystem * cvarSystem
void SetInfluenceLevel(int level)
void SetShader(const char *shadername)
const int MAX_GLOBAL_SHADER_PARMS
void CallFunction(const function_t *func, bool clearStack)
void WriteObject(const idClass *obj)
const idEventDef EV_TipOff("<TipOff>")
idTypeDef * GetTypeDef(void) const
void Printf(const char *fmt,...) const id_attribute((format(printf
virtual void SetStateString(const char *varName, const char *value)=0
void lock(CURL *handle, curl_lock_data data, curl_lock_access access, void *useptr)
virtual void virtual void virtual const idLangDict * GetLanguageDict(void)=0
void SetShaderParm(int parmnum, float value)
void Restore(idRestoreGame *savefile)
float GetFloat(void) const
void Event_GatherEntities()
const idEventDef EV_Activate("activate","e")
const idEventDef EV_Player_DisableWeapon("disableWeapon")
const idEventDef EV_Player_EnableWeapon("enableWeapon")
void void void void void Error(const char *fmt,...) const id_attribute((format(printf
idScriptObject scriptObject
bool IsType(const idTypeInfo &c) const
void Event_Activate(idEntity *activator)
bool HasObject(void) const
void WriteVec4(const idVec4 &vec)
void SetAngles(const idAngles &ang)
idEntity * FindEntity(const char *name) const
idList< idEntityPtr< idEntity > > targets
const idEventDef EV_Player_SelectWeapon("selectWeapon","s")
const idEventDef EV_GatherEntities("<GatherEntities>")
const idKeyValue * MatchPrefix(const char *prefix, const idKeyValue *lastMatch=NULL) const
bool ProcessEvent(const idEventDef *ev)
void RemoveWeapon(const char *weap)
void ReadBool(bool &value)
void Event_Activate(idEntity *activator)
void SetInfluenceFov(float fov)
const char * Left(int len, idStr &result) const
idInterpolate< float > fovSetting
void SetInfluenceView(const char *mtr, const char *skinname, float radius, idEntity *ent)
float GetDuration(void) const
virtual const idMaterial * FindMaterial(const char *name, bool makeDefault=true)=0
void Set(const char *key, const char *value)
int NumParameters(void) const
idUserInterfaceManager * uiManager
void Restore(idRestoreGame *savefile)
const idEventDef EV_ClearFlash("<ClearFlash>","f")
idList< int > genericList
void WriteVec3(const idVec3 &vec)
virtual void SetModel(const char *modelname)
void Copy(const idDict &other)
void SetGlobalMaterial(const idMaterial *mat)
idSoundWorld * gameSoundWorld
const type & GetEndValue(void) const
#define EVENT(event, function)
const int MAX_ENTITY_SHADER_PARMS
void Save(idSaveGame *savefile) const
void WriteBool(const bool value)
virtual idUserInterface * FindGui(const char *qpath, bool autoLoad=false, bool needUnique=false, bool forceUnique=false)=0
idCVar developer("developer","0", CVAR_GAME|CVAR_BOOL,"")
void Event_Activate(idEntity *activator)
virtual void GetColor(idVec3 &out) const
int Icmpn(const char *text, int n) const
const idEventDef EV_RestoreVolume("<RestoreVolume>")
bool StartSoundShader(const idSoundShader *shader, const s_channelType channel, int soundShaderFlags, bool broadcast, int *length)
void Restore(idRestoreGame *savefile)
class idPlayerView playerView
const idEventDef EV_Flash("<Flash>","fd")
virtual bool GiveToPlayer(idPlayer *player)
virtual cmHandle_t LoadModel(const char *modelName, const bool precache)=0
idPhysics * GetPhysics(void) const
void Event_RestoreVolume()
const char * GetString(const char *key, const char *defaultString="") const
bool SpawnEntityDef(const idDict &args, idEntity **ent=NULL, bool setDefaults=true)
void ReadFloat(float &value)
void SetSound(const char *sound, int channel=SND_CHANNEL_ANY)
bool StartSound(const char *soundName, const s_channelType channel, int soundShaderFlags, bool broadcast, int *length)
idVec3 vec3_origin(0.0f, 0.0f, 0.0f)
idInterpolate< int > fovSetting
virtual renderEntity_t * GetRenderEntity(void)
void SetStartTime(float time)
void WriteFloat(const float value)
bool IsDone(float time) const
bool GetBool(const char *key, const char *defaultString="0") const
virtual void UpdateChangeableSpawnArgs(const idDict *source)
virtual idRenderModel * FindModel(const char *modelName)=0
virtual const idDecl * FindType(declType_t type, const char *name, bool makeDefault=true)=0
void SetStartValue(const type &startValue)
virtual void SetCVarBool(const char *name, const bool value, int flags=0)=0
int GetInteger(void) const
idVec3 GetVector(const char *key, const char *defaultString=NULL) const
const int MAX_RENDERENTITY_GUI
float GetStartTime(void) const
void Event_GetPlayerPos(void)
virtual void FadeSoundClasses(const int soundClass, const float to, const float over)=0
void GiveEmail(const char *emailName)
void ReadVec4(idVec4 &vec)
const char * GetString(const char *str) const
void ReadUserInterface(idUserInterface *&ui)
void Event_RestoreInfluence()
const idStr & GetValue(void) const
int EntitiesWithinRadius(const idVec3 org, float radius, idEntity **entityList, int maxCount) const
const char * Right(int len, idStr &result) const
int Find(const char c, int start=0, int end=-1) const
idTypeDef * GetParmType(int parmNumber) const
void Event_Activate(idEntity *activator)
void SetBool(const char *key, bool val)
const int SHADERPARM_TIMEOFFSET
void SetViewAngles(const idAngles &angles)
void Init(const float startTime, const float duration, const type &startValue, const type &endValue)
virtual void Damage(idEntity *inflictor, idEntity *attacker, const idVec3 &dir, const char *damageDefName, const float damageScale, const int location)
const idKeyValue * FindKey(const char *key) const
type GetCurrentValue(float time) const
bool Inherits(const idTypeDef *basetype) const
const char * ToString(int precision=2) const
void WriteInt(const int value)
virtual void Present(void)
idDeclManager * declManager
idEntity * entities[MAX_GENTITIES]
void Event_Flash(float flash, int out)
const type & GetStartValue(void) const
void Save(idSaveGame *savefile) const
int Append(const type &obj)
void Fade(idVec4 color, int time)
void GiveSecurity(const char *security)
float globalShaderParms[MAX_GLOBAL_SHADER_PARMS]
idRenderModelManager * renderModelManager
void SetLevelTrigger(const char *levelName, const char *triggerName)
void Event_Activate(idEntity *activator)
const idDeclPDA * GetPDA(void) const
void Lerp(const idVec4 &v1, const idVec4 &v2, const float l)
void Save(idSaveGame *savefile) const
virtual void SetColor(float red, float green, float blue)
const function_t * GetFunction(const char *name) const
#define CLASS_DECLARATION(nameofsuperclass, nameofclass)
void Event_Activate(idEntity *activator)
const char * GetName(void) const
void ReadVec3(idVec3 &vec)
float DefaultFov(void) const
class idUserInterface * gui[MAX_RENDERENTITY_GUI]
const char * c_str(void) const
void SetEndValue(const type &endValue)
idEntity * switchToCamera
void BecomeActive(int flags)
const idEventDef EV_Remove("<immediateremove>", NULL)
const idEventDef EV_StartSoundShader("startSoundShader","sd", 'f')
const idEventDef EV_GetPlayerPos("<getplayerpos>")
void Restore(idRestoreGame *savefile)
char * va(const char *fmt,...)
void SelectWeapon(int num, bool force)
bool PostEventMS(const idEventDef *ev, int time)
idUserInterface * objectiveSystem
void ShowTip(const char *title, const char *tip, bool autoHide)
void SetFloat(const float value)
void Event_Activate(idEntity *activator)
void SetDuration(float duration)
void Set(const float x, const float y, const float z, const float w)
void ReadString(idStr &string)
void BecomeInactive(int flags)
void Event_ClearFlash(float flash)
idCollisionModelManager * collisionModelManager
void ActivateTargets(idEntity *activator) const
const idEventDef EV_RestoreInfluence("<RestoreInfluece>")
void StopSound(const s_channelType channel, bool broadcast)
void WriteUserInterface(const idUserInterface *ui, bool unique)
void ReadObject(idClass *&obj)
idCVar pm_stamina("pm_stamina","24", CVAR_GAME|CVAR_NETWORKSYNC|CVAR_FLOAT,"length of time player can run")