288 lines
6.2 KiB
C++
288 lines
6.2 KiB
C++
|
|
#ifndef __GAME_TRIGGER_H__
|
|
#define __GAME_TRIGGER_H__
|
|
|
|
extern const idEventDef EV_Enable;
|
|
extern const idEventDef EV_Disable;
|
|
|
|
/*
|
|
===============================================================================
|
|
|
|
Trigger base.
|
|
|
|
===============================================================================
|
|
*/
|
|
|
|
class idTrigger : public idEntity {
|
|
public:
|
|
CLASS_PROTOTYPE( idTrigger );
|
|
|
|
static void DrawDebugInfo( void );
|
|
|
|
idTrigger();
|
|
void Spawn( void );
|
|
|
|
const function_t * GetScriptFunction( void ) const;
|
|
|
|
void Save( idSaveGame *savefile ) const;
|
|
void Restore( idRestoreGame *savefile );
|
|
|
|
virtual void Enable( void );
|
|
virtual void Disable( void );
|
|
|
|
protected:
|
|
// RAVEN BEGIN
|
|
// abahr: removed const from function
|
|
void CallScript( idEntity* scriptEntity );
|
|
// RAVEN END
|
|
|
|
void Event_Enable( void );
|
|
void Event_Disable( void );
|
|
|
|
// RAVEN BEGIN
|
|
// abahr: changed to allow parms to be passed
|
|
idList<rvScriptFuncUtility> scriptFunctions;
|
|
//const function_t * scriptFunction;
|
|
// RAVEN END
|
|
};
|
|
|
|
|
|
/*
|
|
===============================================================================
|
|
|
|
Trigger which can be activated multiple times.
|
|
|
|
===============================================================================
|
|
*/
|
|
|
|
class idTrigger_Multi : public idTrigger {
|
|
public:
|
|
CLASS_PROTOTYPE( idTrigger_Multi );
|
|
|
|
idTrigger_Multi( void );
|
|
|
|
void Spawn( void );
|
|
|
|
void Save( idSaveGame *savefile ) const;
|
|
void Restore( idRestoreGame *savefile );
|
|
virtual void Think( void );
|
|
|
|
private:
|
|
float wait;
|
|
float random;
|
|
float delay;
|
|
float random_delay;
|
|
int nextTriggerTime;
|
|
idStr requires;
|
|
int removeItem;
|
|
bool touchClient;
|
|
bool touchOther;
|
|
bool touchVehicle;
|
|
bool triggerFirst;
|
|
bool triggerWithSelf;
|
|
int buyZoneTrigger;
|
|
int controlZoneTrigger;
|
|
int prevZoneController;
|
|
|
|
idList<idPlayer*> playersInTrigger;
|
|
|
|
bool CheckFacing( idEntity *activator );
|
|
void HandleControlZoneTrigger();
|
|
|
|
// RAVEN BEGIN
|
|
// kfuller: want trigger_relays entities to be able to respond to earthquakes
|
|
void Event_EarthQuake (float requiresLOS);
|
|
// RAVEN END
|
|
|
|
void TriggerAction( idEntity *activator );
|
|
void Event_TriggerAction( idEntity *activator );
|
|
void Event_Trigger( idEntity *activator );
|
|
void Event_Touch( idEntity *other, trace_t *trace );
|
|
};
|
|
|
|
|
|
/*
|
|
===============================================================================
|
|
|
|
Trigger which can only be activated by an entity with a specific name.
|
|
|
|
===============================================================================
|
|
*/
|
|
|
|
class idTrigger_EntityName : public idTrigger {
|
|
public:
|
|
CLASS_PROTOTYPE( idTrigger_EntityName );
|
|
|
|
idTrigger_EntityName( void );
|
|
|
|
void Save( idSaveGame *savefile ) const;
|
|
void Restore( idRestoreGame *savefile );
|
|
|
|
void Spawn( void );
|
|
|
|
private:
|
|
float wait;
|
|
float random;
|
|
float delay;
|
|
float random_delay;
|
|
int nextTriggerTime;
|
|
bool triggerFirst;
|
|
idStr entityName;
|
|
|
|
void TriggerAction( idEntity *activator );
|
|
void Event_TriggerAction( idEntity *activator );
|
|
void Event_Trigger( idEntity *activator );
|
|
void Event_Touch( idEntity *other, trace_t *trace );
|
|
};
|
|
|
|
/*
|
|
===============================================================================
|
|
|
|
Trigger which repeatedly fires targets.
|
|
|
|
===============================================================================
|
|
*/
|
|
|
|
class idTrigger_Timer : public idTrigger {
|
|
public:
|
|
CLASS_PROTOTYPE( idTrigger_Timer );
|
|
|
|
idTrigger_Timer( void );
|
|
|
|
void Save( idSaveGame *savefile ) const;
|
|
void Restore( idRestoreGame *savefile );
|
|
|
|
void Spawn( void );
|
|
|
|
virtual void Enable( void );
|
|
virtual void Disable( void );
|
|
|
|
private:
|
|
float random;
|
|
float wait;
|
|
bool on;
|
|
float delay;
|
|
idStr onName;
|
|
idStr offName;
|
|
|
|
void Event_Timer( void );
|
|
void Event_Use( idEntity *activator );
|
|
};
|
|
|
|
|
|
/*
|
|
===============================================================================
|
|
|
|
Trigger which fires targets after being activated a specific number of times.
|
|
|
|
===============================================================================
|
|
*/
|
|
|
|
class idTrigger_Count : public idTrigger {
|
|
public:
|
|
CLASS_PROTOTYPE( idTrigger_Count );
|
|
|
|
idTrigger_Count( void );
|
|
|
|
void Save( idSaveGame *savefile ) const;
|
|
void Restore( idRestoreGame *savefile );
|
|
|
|
void Spawn( void );
|
|
|
|
private:
|
|
int goal;
|
|
int count;
|
|
float delay;
|
|
|
|
void Event_Trigger( idEntity *activator );
|
|
void Event_TriggerAction( idEntity *activator );
|
|
};
|
|
|
|
|
|
/*
|
|
===============================================================================
|
|
|
|
Trigger which hurts touching entities.
|
|
|
|
===============================================================================
|
|
*/
|
|
|
|
class idTrigger_Hurt : public idTrigger {
|
|
public:
|
|
CLASS_PROTOTYPE( idTrigger_Hurt );
|
|
|
|
idTrigger_Hurt( void );
|
|
|
|
void Save( idSaveGame *savefile ) const;
|
|
void Restore( idRestoreGame *savefile );
|
|
|
|
void Spawn( void );
|
|
|
|
private:
|
|
bool on;
|
|
float delay;
|
|
int nextTime;
|
|
|
|
// RAVEN BEGIN
|
|
// kfuller: added playeronly
|
|
bool playerOnly;
|
|
// RAVEN END
|
|
|
|
void Event_Touch( idEntity *other, trace_t *trace );
|
|
void Event_Toggle( idEntity *activator );
|
|
};
|
|
|
|
|
|
/*
|
|
===============================================================================
|
|
|
|
Trigger which fades the player view.
|
|
|
|
===============================================================================
|
|
*/
|
|
|
|
class idTrigger_Fade : public idTrigger {
|
|
public:
|
|
|
|
CLASS_PROTOTYPE( idTrigger_Fade );
|
|
|
|
private:
|
|
void Event_Trigger( idEntity *activator );
|
|
};
|
|
|
|
|
|
/*
|
|
===============================================================================
|
|
|
|
Trigger which continuously tests whether other entities are touching it.
|
|
|
|
===============================================================================
|
|
*/
|
|
|
|
class idTrigger_Touch : public idTrigger {
|
|
public:
|
|
|
|
CLASS_PROTOTYPE( idTrigger_Touch );
|
|
|
|
idTrigger_Touch( void );
|
|
~idTrigger_Touch( );
|
|
|
|
void Spawn( void );
|
|
virtual void Think( void );
|
|
|
|
void Save( idSaveGame *savefile );
|
|
void Restore( idRestoreGame *savefile );
|
|
|
|
virtual void Enable( void );
|
|
virtual void Disable( void );
|
|
|
|
void TouchEntities( void );
|
|
|
|
private:
|
|
idClipModel * clipModel;
|
|
int filterTeam;
|
|
|
|
void Event_Trigger( idEntity *activator );
|
|
};
|
|
|
|
#endif /* !__GAME_TRIGGER_H__ */
|