GS-Entbase: Expose Base* class headers at the global scope.

This commit is contained in:
Marco Cawthorne 2020-10-17 16:30:36 +02:00
parent 88f490a1c5
commit e803ddbceb
11 changed files with 327 additions and 256 deletions

View File

@ -50,12 +50,14 @@ void env_sprite::ReadEntity(float flChanged)
framerate = readfloat();
scale = readfloat();
#ifdef GS_RENDERFX
m_iRenderFX = readbyte();
m_iRenderMode = readbyte();
m_vecRenderColor[0] = readfloat();
m_vecRenderColor[1] = readfloat();
m_vecRenderColor[2] = readfloat();
m_flRenderAmt = readfloat();
#endif
drawmask = MASK_ENGINE;
nextthink = time + (1 / framerate);
@ -84,12 +86,16 @@ void EnvSprite_ParseEvent(void)
spr.modelindex = readfloat();
spr.framerate = readfloat();
spr.scale = readfloat();
#ifdef GS_RENDERFX
spr.m_iRenderFX = readbyte();
spr.m_iRenderMode = readbyte();
spr.m_vecRenderColor[0] = readfloat();
spr.m_vecRenderColor[1] = readfloat();
spr.m_vecRenderColor[2] = readfloat();
spr.m_flRenderAmt = readfloat();
#endif
spr.drawmask = MASK_ENGINE;
spr.nextthink = time + (1 / spr.framerate);
spr.maxframe = modelframecount(spr.modelindex);

View File

@ -14,134 +14,6 @@
* OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
*/
typedef struct
{
vector m_vecDest;
int m_iFlags;
} nodeslist_t;
/* movement states */
enum
{
MONSTER_IDLE,
MONSTER_FOLLOWING,
MONSTER_CHASING,
MONSTER_AIMING,
MONSTER_DEAD,
MONSTER_GIBBED
};
/* scripted sequence states */
enum
{
SEQUENCESTATE_NONE,
SEQUENCESTATE_IDLE,
SEQUENCESTATE_ACTIVE,
SEQUENCESTATE_ENDING
};
/* monster flags */
enumflags
{
MSF_WAITTILLSEEN,
MSF_GAG,
MSF_MONSTERCLIP,
MSF_RESERVED1,
MSF_PRISONER,
MSF_RESERVED2,
MSF_RESERVED3,
MSF_WAITFORSCRIPT,
MSF_PREDISASTER,
MSF_FADECORPSE,
MSF_MULTIPLAYER
};
/* alliance state */
enum
{
MAL_FRIEND, /* friendly towards the player */
MAL_ENEMY, /* unfriendly towards the player */
MAL_ALIEN, /* unfriendly towards anyone but themselves */
MAL_ROGUE /* no allies, not even amongst themselves */
};
.int m_iAlliance;
class CBaseMonster:CBaseEntity
{
vector oldnet_velocity;
float m_flPitch;
int m_iFlags;
vector base_mins;
vector base_maxs;
int base_health;
/* sequences */
string m_strRouteEnded;
int m_iSequenceRemove;
int m_iSequenceState;
float m_flSequenceEnd;
float m_flSequenceSpeed;
vector m_vecSequenceAngle;
vector m_vecTurnAngle;
/* model events */
float m_flBaseTime;
/* attack/alliance system */
entity m_eEnemy;
float m_flFOV;
float m_flAttackThink;
int m_iMState;
vector m_vecLKPos; /* last-known pos */
/* pathfinding */
int m_iNodes;
int m_iCurNode;
nodeslist_t *m_pRoute;
vector m_vecLastNode;
void(void) CBaseMonster;
virtual void(void) touch;
virtual void(void) Hide;
virtual void(void) Respawn;
virtual void(void) PlayerUse;
virtual void(void) Pain;
virtual void(void) Death;
virtual void(void) Physics;
virtual void(void) IdleNoise;
virtual void(void) Gib;
virtual void(string) Sound;
virtual void(float, int, string) ModelEvent;
/* see/hear subsystem */
float m_flSeeTime;
virtual void(void) SeeThink;
virtual float(void) SeeFOV;
/* attack system */
virtual void(void) AttackDraw;
virtual void(void) AttackHolster;
virtual void(void) AttackThink;
virtual int(void) AttackMelee;
virtual int(void) AttackRanged;
/* sequences */
virtual void(void) FreeState;
virtual void(void) FreeStateMoved;
virtual void(void) ClearRoute;
virtual void(void) CheckRoute;
virtual void(void) WalkRoute;
virtual void(vector) NewRoute;
/* animation cycles */
float m_flAnimTime;
virtual int(void) AnimIdle;
virtual int(void) AnimWalk;
virtual int(void) AnimRun;
virtual void(float) AnimPlay;
};
int
CBaseMonster::AnimIdle(void)
{

View File

@ -0,0 +1,143 @@
/*
* Copyright (c) 2016-2020 Marco Hladik <marco@icculus.org>
*
* Permission to use, copy, modify, and distribute this software for any
* purpose with or without fee is hereby granted, provided that the above
* copyright notice and this permission notice appear in all copies.
*
* THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
* WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
* MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
* ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
* WHATSOEVER RESULTING FROM LOSS OF MIND, USE, DATA OR PROFITS, WHETHER
* IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING
* OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
*/
typedef struct
{
vector m_vecDest;
int m_iFlags;
} nodeslist_t;
/* movement states */
enum
{
MONSTER_IDLE,
MONSTER_FOLLOWING,
MONSTER_CHASING,
MONSTER_AIMING,
MONSTER_DEAD,
MONSTER_GIBBED
};
/* scripted sequence states */
enum
{
SEQUENCESTATE_NONE,
SEQUENCESTATE_IDLE,
SEQUENCESTATE_ACTIVE,
SEQUENCESTATE_ENDING
};
/* monster flags */
enumflags
{
MSF_WAITTILLSEEN,
MSF_GAG,
MSF_MONSTERCLIP,
MSF_RESERVED1,
MSF_PRISONER,
MSF_RESERVED2,
MSF_RESERVED3,
MSF_WAITFORSCRIPT,
MSF_PREDISASTER,
MSF_FADECORPSE,
MSF_MULTIPLAYER
};
/* alliance state */
enum
{
MAL_FRIEND, /* friendly towards the player */
MAL_ENEMY, /* unfriendly towards the player */
MAL_ALIEN, /* unfriendly towards anyone but themselves */
MAL_ROGUE /* no allies, not even amongst themselves */
};
.int m_iAlliance;
class CBaseMonster:CBaseEntity
{
vector oldnet_velocity;
float m_flPitch;
int m_iFlags;
vector base_mins;
vector base_maxs;
int base_health;
/* sequences */
string m_strRouteEnded;
int m_iSequenceRemove;
int m_iSequenceState;
float m_flSequenceEnd;
float m_flSequenceSpeed;
vector m_vecSequenceAngle;
vector m_vecTurnAngle;
/* model events */
float m_flBaseTime;
/* attack/alliance system */
entity m_eEnemy;
float m_flFOV;
float m_flAttackThink;
int m_iMState;
vector m_vecLKPos; /* last-known pos */
/* pathfinding */
int m_iNodes;
int m_iCurNode;
nodeslist_t *m_pRoute;
vector m_vecLastNode;
void(void) CBaseMonster;
virtual void(void) touch;
virtual void(void) Hide;
virtual void(void) Respawn;
virtual void(void) PlayerUse;
virtual void(void) Pain;
virtual void(void) Death;
virtual void(void) Physics;
virtual void(void) IdleNoise;
virtual void(void) Gib;
virtual void(string) Sound;
virtual void(float, int, string) ModelEvent;
/* see/hear subsystem */
float m_flSeeTime;
virtual void(void) SeeThink;
virtual float(void) SeeFOV;
/* attack system */
virtual void(void) AttackDraw;
virtual void(void) AttackHolster;
virtual void(void) AttackThink;
virtual int(void) AttackMelee;
virtual int(void) AttackRanged;
/* sequences */
virtual void(void) FreeState;
virtual void(void) FreeStateMoved;
virtual void(void) ClearRoute;
virtual void(void) CheckRoute;
virtual void(void) WalkRoute;
virtual void(vector) NewRoute;
/* animation cycles */
float m_flAnimTime;
virtual int(void) AnimIdle;
virtual int(void) AnimWalk;
virtual int(void) AnimRun;
virtual void(float) AnimPlay;
};

View File

@ -14,90 +14,6 @@
* OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
*/
/* NPCs are more advanced than regular monsters in that they express emotions
* and are able to interact more with the environment */
#define PLAYER_DETECT_RADIUS 512
enumflags
{
MONSTER_USED,
MONSTER_FEAR,
MONSTER_METPLAYER,
MONSTER_FALLING,
MONSTER_CANFOLLOW
};
class CBaseNPC:CBaseMonster
{
/* our NPCs can have a unique pitch to their voice */
float m_flPitch;
float m_flNextSentence;
int m_iFlags;
entity m_eFollowing;
entity m_eFollowingChain;
vector m_vecLastUserPos;
float m_flChangePath;
float m_flTraceTime;
/* sentences identifiers */
string m_talkAnswer; /* random answer to whenever a question is asked */
string m_talkAsk; /* asks a random generic question */
string m_talkAllyShot; /* asks to not shoot an ally further */
string m_talkGreet; /* greet other NPCs */
string m_talkIdle; /* idle chatter */
string m_talkHearing; /* what did we just hear? */
string m_talkSmelling; /* is something smelling bad? */
string m_talkStare; /* when NPC is being stared at */
string m_talkSurvived; /* we're near death */
string m_talkWounded; /* we've sustained light wounds */
/* things that NPCs will only say to the player */
string m_talkPlayerAsk; /* ask player some question */
string m_talkPlayerGreet; /* say hello to the player */
string m_talkPlayerIdle; /* idle chatter with the player */
string m_talkPlayerWounded1; /* slightly wounded player comment */
string m_talkPlayerWounded2; /* a bit worse */
string m_talkPlayerWounded3; /* yup, got thus far */
string m_talkUnfollow; /* when the player asks us to stop following */
string m_talkFollow; /* whenever player asks the NPC to follow */
string m_talkStopFollow; /* we have to stop following */
void(void) CBaseNPC;
virtual void(string) Speak;
virtual void(string) Sentence;
virtual void(void) WarnAllies;
virtual void(void) FollowPlayer;
virtual void(void) FollowChain;
virtual void(void) Physics;
virtual void(void) PlayerUse;
virtual void(void) PanicFrame;
virtual void(void) Hide;
virtual void(void) Respawn;
/*virtual void(void) TalkAnswer;
virtual void(void) TalkAsk;
virtual void(void) TalkAllyShot;
virtual void(void) TalkGreet;
virtual void(void) TalkIdle;
virtual void(void) TalkHearing;
virtual void(void) TalkSmelling;
virtual void(void) TalkStare;
virtual void(void) TalkSurvived;
virtual void(void) TalkWounded;*/
virtual void(void) TalkPlayerAsk;
virtual void(void) TalkPlayerGreet;
virtual void(void) TalkPlayerIdle;
virtual void(void) TalkPlayerWounded1;
virtual void(void) TalkPlayerWounded2;
virtual void(void) TalkPlayerWounded3;
virtual void(void) TalkUnfollow;
virtual void(void) TalkFollow;
virtual void(void) TalkStopFollow;
virtual void(string, string) SpawnKey;
};
void
CBaseNPC::WarnAllies(void)
{

View File

@ -0,0 +1,99 @@
/*
* Copyright (c) 2016-2020 Marco Hladik <marco@icculus.org>
*
* Permission to use, copy, modify, and distribute this software for any
* purpose with or without fee is hereby granted, provided that the above
* copyright notice and this permission notice appear in all copies.
*
* THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
* WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
* MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
* ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
* WHATSOEVER RESULTING FROM LOSS OF MIND, USE, DATA OR PROFITS, WHETHER
* IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING
* OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
*/
/* NPCs are more advanced than regular monsters in that they express emotions
* and are able to interact more with the environment */
#define PLAYER_DETECT_RADIUS 512
enumflags
{
MONSTER_USED,
MONSTER_FEAR,
MONSTER_METPLAYER,
MONSTER_FALLING,
MONSTER_CANFOLLOW
};
class CBaseNPC:CBaseMonster
{
/* our NPCs can have a unique pitch to their voice */
float m_flPitch;
float m_flNextSentence;
int m_iFlags;
entity m_eFollowing;
entity m_eFollowingChain;
vector m_vecLastUserPos;
float m_flChangePath;
float m_flTraceTime;
/* sentences identifiers */
string m_talkAnswer; /* random answer to whenever a question is asked */
string m_talkAsk; /* asks a random generic question */
string m_talkAllyShot; /* asks to not shoot an ally further */
string m_talkGreet; /* greet other NPCs */
string m_talkIdle; /* idle chatter */
string m_talkHearing; /* what did we just hear? */
string m_talkSmelling; /* is something smelling bad? */
string m_talkStare; /* when NPC is being stared at */
string m_talkSurvived; /* we're near death */
string m_talkWounded; /* we've sustained light wounds */
/* things that NPCs will only say to the player */
string m_talkPlayerAsk; /* ask player some question */
string m_talkPlayerGreet; /* say hello to the player */
string m_talkPlayerIdle; /* idle chatter with the player */
string m_talkPlayerWounded1; /* slightly wounded player comment */
string m_talkPlayerWounded2; /* a bit worse */
string m_talkPlayerWounded3; /* yup, got thus far */
string m_talkUnfollow; /* when the player asks us to stop following */
string m_talkFollow; /* whenever player asks the NPC to follow */
string m_talkStopFollow; /* we have to stop following */
void(void) CBaseNPC;
virtual void(string) Speak;
virtual void(string) Sentence;
virtual void(void) WarnAllies;
virtual void(void) FollowPlayer;
virtual void(void) FollowChain;
virtual void(void) Physics;
virtual void(void) PlayerUse;
virtual void(void) PanicFrame;
virtual void(void) Hide;
virtual void(void) Respawn;
/*virtual void(void) TalkAnswer;
virtual void(void) TalkAsk;
virtual void(void) TalkAllyShot;
virtual void(void) TalkGreet;
virtual void(void) TalkIdle;
virtual void(void) TalkHearing;
virtual void(void) TalkSmelling;
virtual void(void) TalkStare;
virtual void(void) TalkSurvived;
virtual void(void) TalkWounded;*/
virtual void(void) TalkPlayerAsk;
virtual void(void) TalkPlayerGreet;
virtual void(void) TalkPlayerIdle;
virtual void(void) TalkPlayerWounded1;
virtual void(void) TalkPlayerWounded2;
virtual void(void) TalkPlayerWounded3;
virtual void(void) TalkUnfollow;
virtual void(void) TalkFollow;
virtual void(void) TalkStopFollow;
virtual void(string, string) SpawnKey;
};

View File

@ -14,27 +14,6 @@
* OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
*/
/* inspired by https://developer.valvesoftware.com/wiki/Inputs_and_Outputs
a lot of the action also happens in CBaseTrigger.
*/
/* modern trigger architecture */
class CBaseOutput:CBaseEntity
{
entity m_eActivator;
string m_strTarget;
string m_strInput;
string m_strData;
float m_flDelay;
int m_iCount;
int m_iOldCount;
void(void) CBaseOutput;
virtual void(void) TriggerOutput;
virtual void(void) SpawnInit;
virtual void(void) Respawn;
};
void
CBaseOutput::TriggerOutput(void)
{

View File

@ -0,0 +1,36 @@
/*
* Copyright (c) 2016-2020 Marco Hladik <marco@icculus.org>
*
* Permission to use, copy, modify, and distribute this software for any
* purpose with or without fee is hereby granted, provided that the above
* copyright notice and this permission notice appear in all copies.
*
* THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
* WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
* MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
* ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
* WHATSOEVER RESULTING FROM LOSS OF MIND, USE, DATA OR PROFITS, WHETHER
* IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING
* OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
*/
/* inspired by https://developer.valvesoftware.com/wiki/Inputs_and_Outputs
a lot of the action also happens in CBaseTrigger.
*/
/* modern trigger architecture */
class CBaseOutput:CBaseEntity
{
entity m_eActivator;
string m_strTarget;
string m_strInput;
string m_strData;
float m_flDelay;
int m_iCount;
int m_iOldCount;
void(void) CBaseOutput;
virtual void(void) TriggerOutput;
virtual void(void) SpawnInit;
virtual void(void) Respawn;
};

View File

@ -14,29 +14,6 @@
* OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
*/
enum
{
PHYSM_BOX,
PHYSM_SPHERE,
PHYSM_CAPSULE,
PHYSM_TRIMESH,
PHYSM_CYLINDER
};
class CBasePhysics:CBaseEntity
{
int m_iShape;
int m_iMaterial;
float m_flMass;
void(void) CBasePhysics;
virtual void(void) Respawn;
virtual void(void) touch;
virtual void(void) TouchThink;
virtual void(void) Pain;
virtual void(string, string) SpawnKey;
};
void
CBasePhysics::TouchThink(void)
{

View File

@ -0,0 +1,38 @@
/*
* Copyright (c) 2016-2020 Marco Hladik <marco@icculus.org>
*
* Permission to use, copy, modify, and distribute this software for any
* purpose with or without fee is hereby granted, provided that the above
* copyright notice and this permission notice appear in all copies.
*
* THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
* WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
* MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
* ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
* WHATSOEVER RESULTING FROM LOSS OF MIND, USE, DATA OR PROFITS, WHETHER
* IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING
* OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
*/
enum
{
PHYSM_BOX,
PHYSM_SPHERE,
PHYSM_CAPSULE,
PHYSM_TRIMESH,
PHYSM_CYLINDER
};
class CBasePhysics:CBaseEntity
{
int m_iShape;
int m_iMaterial;
float m_flMass;
void(void) CBasePhysics;
virtual void(void) Respawn;
virtual void(void) touch;
virtual void(void) TouchThink;
virtual void(void) Pain;
virtual void(string, string) SpawnKey;
};

View File

@ -16,6 +16,10 @@
#include "baseentity.h"
#include "basetrigger.h"
#include "basemonster.h"
#include "basenpc.h"
#include "baseoutput.h"
#include "basephysics.h"
void FX_Spark(vector, vector);
void FX_BreakModel(int, vector, vector, vector, float);

View File

@ -213,6 +213,7 @@ monstermaker::SpawnKey(string strKey, string strValue)
case "netname":
m_strChildName = strValue;
netname = __NULL__;
break;
default:
CBaseTrigger::SpawnKey(strKey, strValue);
}