ReGameDLL_CS/regamedll/dlls/plats.h

247 lines
7.2 KiB
C
Raw Normal View History

2015-06-30 12:46:07 +03:00
/*
*
* This program is free software; you can redistribute it and/or modify it
* under the terms of the GNU General Public License as published by the
* Free Software Foundation; either version 2 of the License, or (at
* your option) any later version.
*
* This program is distributed in the hope that it will be useful, but
* WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software Foundation,
* Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*
* In addition, as a special exception, the author gives permission to
* link the code of this program with the Half-Life Game Engine ("HL
* Engine") and Modified Game Libraries ("MODs") developed by Valve,
* L.L.C ("Valve"). You must obey the GNU General Public License in all
* respects for all of the code used other than the HL Engine and MODs
* from Valve. If you modify this file, you may extend this exception
* to your version of the file, but you are not obligated to do so. If
* you do not wish to do so, delete this exception statement from your
* version.
*
*/
#pragma once
2017-10-12 17:50:56 +03:00
#define SF_PLAT_TOGGLE BIT(0) // The lift is no more automatically called from top and activated by stepping on it.
// It required trigger to do so.
2015-06-30 12:46:07 +03:00
class CBasePlatTrain: public CBaseToggle
{
public:
virtual void Precache();
2015-09-16 23:19:21 +03:00
virtual void KeyValue(KeyValueData *pkvd);
virtual int Save(CSave &save);
virtual int Restore(CRestore &restore);
virtual int ObjectCaps() { return CBaseEntity::ObjectCaps() & ~FCAP_ACROSS_TRANSITION; }
2015-06-30 12:46:07 +03:00
// This is done to fix spawn flag collisions between this class and a derived class
virtual BOOL IsTogglePlat() { return (pev->spawnflags & SF_PLAT_TOGGLE) != 0; }
2015-06-30 12:46:07 +03:00
public:
static TYPEDESCRIPTION m_SaveData[];
2015-06-30 12:46:07 +03:00
byte m_bMoveSnd;
byte m_bStopSnd;
2015-06-30 12:46:07 +03:00
float m_volume;
};
2015-06-30 12:46:07 +03:00
class CFuncPlat: public CBasePlatTrain
{
public:
virtual void Spawn();
virtual void Precache();
2015-09-16 23:19:21 +03:00
virtual void Blocked(CBaseEntity *pOther);
virtual void GoUp();
virtual void GoDown();
virtual void HitTop();
virtual void HitBottom();
2015-06-30 12:46:07 +03:00
public:
void Setup();
2015-09-16 23:19:21 +03:00
void EXPORT PlatUse(CBaseEntity *pActivator, CBaseEntity *pCaller, USE_TYPE useType, float value);
void EXPORT CallGoDown();
void EXPORT CallHitTop();
void EXPORT CallHitBottom();
};
2015-06-30 12:46:07 +03:00
class CPlatTrigger: public CBaseEntity
{
public:
virtual int ObjectCaps() { return (CBaseEntity::ObjectCaps() & ~FCAP_ACROSS_TRANSITION) | FCAP_DONT_SAVE; }
2015-09-16 23:19:21 +03:00
virtual void Touch(CBaseEntity *pOther);
2015-06-30 12:46:07 +03:00
public:
2015-09-16 23:19:21 +03:00
void SpawnInsideTrigger(CFuncPlat *pPlatform);
2015-06-30 12:46:07 +03:00
CFuncPlat *m_pPlatform;
};
2015-06-30 12:46:07 +03:00
class CFuncPlatRot: public CFuncPlat
{
public:
virtual void Spawn();
2015-09-16 23:19:21 +03:00
virtual int Save(CSave &save);
virtual int Restore(CRestore &restore);
2015-06-30 12:46:07 +03:00
virtual void GoUp();
virtual void GoDown();
virtual void HitTop();
virtual void HitBottom();
2015-06-30 12:46:07 +03:00
public:
void SetupRotation();
2015-09-16 23:19:21 +03:00
void RotMove(Vector &destAngle, float time);
2015-06-30 12:46:07 +03:00
public:
static TYPEDESCRIPTION m_SaveData[];
2015-06-30 12:46:07 +03:00
Vector m_end;
Vector m_start;
};
2015-06-30 12:46:07 +03:00
2017-10-12 17:50:56 +03:00
#define SF_TRAIN_WAIT_RETRIGGER BIT(0)
#define SF_TRAIN_START_ON BIT(2) // Train is initially moving
#define SF_TRAIN_PASSABLE BIT(3) // Train is not solid -- used to make water trains
2015-06-30 12:46:07 +03:00
class CFuncTrain: public CBasePlatTrain
{
public:
virtual void Spawn();
virtual void Precache();
virtual void Restart();
2015-09-16 23:19:21 +03:00
virtual void KeyValue(KeyValueData *pkvd);
virtual int Save(CSave &save);
virtual int Restore(CRestore &restore);
virtual void Activate();
virtual void OverrideReset();
2015-09-16 23:19:21 +03:00
virtual void Use(CBaseEntity *pActivator, CBaseEntity *pCaller, USE_TYPE useType, float value);
virtual void Blocked(CBaseEntity *pOther);
2015-06-30 12:46:07 +03:00
public:
void EXPORT Wait();
void EXPORT Next();
2015-06-30 12:46:07 +03:00
public:
static TYPEDESCRIPTION m_SaveData[];
2015-06-30 12:46:07 +03:00
Vector m_vStartPosition;
entvars_t *m_pevFirstTarget;
entvars_t *m_pevCurrentTarget;
int m_sounds;
BOOL m_activated;
};
2015-06-30 12:46:07 +03:00
2017-10-12 17:50:56 +03:00
// This class defines the volume of space that the player must stand in to control the train
2015-06-30 12:46:07 +03:00
class CFuncTrainControls: public CBaseEntity
{
public:
virtual void Spawn();
virtual int ObjectCaps() { return CBaseEntity::ObjectCaps() & ~FCAP_ACROSS_TRANSITION; }
2015-06-30 12:46:07 +03:00
public:
void EXPORT Find();
};
2015-06-30 12:46:07 +03:00
2017-10-12 17:50:56 +03:00
#define SF_TRACK_ACTIVATETRAIN BIT(0)
#define SF_TRACK_RELINK BIT(1)
#define SF_TRACK_ROTMOVE BIT(2)
#define SF_TRACK_STARTBOTTOM BIT(3)
#define SF_TRACK_DONT_MOVE BIT(4)
enum TRAIN_CODE { TRAIN_SAFE, TRAIN_BLOCKING, TRAIN_FOLLOWING };
// This entity is a rotating/moving platform that will carry a train to a new track.
// It must be larger in X-Y planar area than the train, since it must contain the
// train within these dimensions in order to operate when the train is near it.
2015-06-30 12:46:07 +03:00
class CFuncTrackChange: public CFuncPlatRot
{
public:
virtual void Spawn();
virtual void Precache();
2015-09-16 23:19:21 +03:00
virtual void KeyValue(KeyValueData *pkvd);
virtual int Save(CSave &save);
virtual int Restore(CRestore &restore);
virtual void OverrideReset();
2015-09-16 23:19:21 +03:00
virtual void Touch(CBaseEntity *pOther);
virtual void Use(CBaseEntity *pActivator, CBaseEntity *pCaller, USE_TYPE useType, float value);
virtual BOOL IsTogglePlat() { return TRUE; };
2015-09-16 23:19:21 +03:00
virtual void EXPORT GoUp();
virtual void EXPORT GoDown();
2015-09-16 23:19:21 +03:00
virtual void HitTop();
virtual void HitBottom();
2015-09-16 23:19:21 +03:00
virtual void UpdateAutoTargets(int toggleState);
2015-06-30 12:46:07 +03:00
public:
void EXPORT Find();
2015-09-16 23:19:21 +03:00
TRAIN_CODE EvaluateTrain(CPathTrack *pcurrent);
void UpdateTrain(Vector &dest);
2015-06-30 12:46:07 +03:00
void DisableUse() { m_use = 0; }
void EnableUse() { m_use = 1; }
int UseEnabled() const { return m_use; }
2015-06-30 12:46:07 +03:00
public:
static TYPEDESCRIPTION m_SaveData[];
2015-06-30 12:46:07 +03:00
CPathTrack *m_trackTop;
CPathTrack *m_trackBottom;
CFuncTrackTrain *m_train;
int m_trackTopName;
int m_trackBottomName;
int m_trainName;
TRAIN_CODE m_code;
int m_targetState;
int m_use;
};
2015-06-30 12:46:07 +03:00
class CFuncTrackAuto: public CFuncTrackChange
{
public:
2015-09-16 23:19:21 +03:00
virtual void Use(CBaseEntity *pActivator, CBaseEntity *pCaller, USE_TYPE useType, float value);
virtual void UpdateAutoTargets(int toggleState);
};
2015-06-30 12:46:07 +03:00
2017-10-12 17:50:56 +03:00
// pev->speed is the travel speed
// pev->health is current health
// pev->max_health is the amount to reset to each time it starts
#define SF_GUNTARGET_START_ON BIT(0)
2015-06-30 12:46:07 +03:00
class CGunTarget: public CBaseMonster
{
public:
virtual void Spawn();
2015-09-16 23:19:21 +03:00
virtual int Save(CSave &save);
virtual int Restore(CRestore &restore);
virtual int ObjectCaps() { return (CBaseEntity::ObjectCaps() & ~FCAP_ACROSS_TRANSITION); }
virtual void Activate();
virtual int Classify() { return CLASS_MACHINE; }
virtual BOOL TakeDamage(entvars_t *pevInflictor, entvars_t *pevAttacker, float flDamage, int bitsDamageType);
virtual int BloodColor() { return DONT_BLEED; }
2015-09-16 23:19:21 +03:00
virtual void Use(CBaseEntity *pActivator, CBaseEntity *pCaller, USE_TYPE useType, float value);
virtual Vector BodyTarget(const Vector &posSrc) { return pev->origin; }
2015-06-30 12:46:07 +03:00
public:
void EXPORT Next();
void EXPORT Start();
void EXPORT Wait();
void Stop();
2015-06-30 12:46:07 +03:00
public:
static TYPEDESCRIPTION m_SaveData[];
2015-06-30 12:46:07 +03:00
private:
BOOL m_on;
};