Move base classes out of gs-entbase. This evolution only happened because classes such as CBaseMonster that once existed were replaced and it grew from there.

Tweak g_developer prints for scripted_sequences.
This commit is contained in:
Marco Cawthorne 2022-07-19 15:22:15 -07:00
parent 6ff42e4176
commit 2a220fb331
Signed by: eukara
GPG Key ID: CE2032F0A2882A22
41 changed files with 111 additions and 80 deletions

View File

@ -1,4 +1,5 @@
#includelist
NSInteractiveSurface.qc
fog.qc
font.qc
sky.qc

View File

@ -6,7 +6,6 @@
baseentity.h
decals.h
client/defs.h
shared/NSVehicle.h
client/env_cubemap.qc
client/env_glow.qc
client/env_sun.qc

View File

@ -5,8 +5,6 @@
#includelist
baseentity.h
decals.h
server/NSOutput.qc
shared/NSVehicle.h
server/info_null.qc
server/info_notnull.qc
server/info_intermission.qc

View File

@ -15,7 +15,6 @@
*/
#include "../shared/baseentity.h"
#include "NSOutput.h"
void FX_Spark(vector, vector);
void FX_BreakModel(int, vector, vector, vector, float);

View File

@ -206,22 +206,22 @@ scripted_sequence::RunOnEntity(entity targ)
f.m_iSequenceFlags = spawnflags;
if (m_iMove == SS_NO) {
dprint("\tType: SS_NO\n");
NSLog("\tType: SS_NO (%i)", m_iMove);
} else if (m_iMove == SS_WALK) {
f.NewRoute(origin);
f.m_flSequenceSpeed = f.GetWalkSpeed();
dprint("\tType: SS_WALK\n");
NSLog("\tType: SS_WALK (%i)", m_iMove);
return;
} else if (m_iMove == SS_RUN) {
f.NewRoute(origin);
f.m_flSequenceSpeed = f.GetRunSpeed();
dprint("\tType: SS_RUN\n");
NSLog("\tType: SS_RUN (%i)", m_iMove);
return;
} else if (m_iMove == SS_INSTANTANEOUS) {
setorigin(f, this.origin);
dprint("\tType: SS_INSTANTANEOUS\n");
NSLog("\tType: SS_INSTANTANEOUS (%i)", m_iMove);
} else if (m_iMove == SS_TURNTOFACE) {
dprint("\tType: SS_TURNTOFACE\n");
NSLog("\tType: SS_TURNTOFACE (%i)", m_iMove);
}
/* all the non-moving targets will do this at least */
@ -229,7 +229,7 @@ scripted_sequence::RunOnEntity(entity targ)
duration = frameduration(f.modelindex, f.m_flSequenceEnd);
f.nextthink = time + duration;
NSLog(
"\tAnimation: %s Duration: %f seconds (modelindex %d, frame %d)\n",
"\tAnimation: %s Duration: %f seconds (modelindex %d, frame %d)",
m_strActionAnim,
duration,
f.modelindex,
@ -238,7 +238,7 @@ scripted_sequence::RunOnEntity(entity targ)
} else {
f.nextthink = time;
NSLog(
"\t^1WARNING: %s skipping animation on script type %i\n",
"\t^1WARNING: %s skipping animation on script type %i",
f.targetname,
m_iMove
);

View File

@ -3,20 +3,6 @@
#endif
#includelist
shared/NSIO.qc
shared/NSTrigger.qc
shared/NSEntity.qc
shared/NSRenderableEntity.qc
shared/NSSurfacePropEntity.qc
shared/NSPhysicsEntity.qc
shared/NSBrushTrigger.qc
shared/NSPointTrigger.qc
shared/NSVehicle.qc
shared/NSNavAI.qc
shared/NSMonster.qc
shared/NSTalkMonster.qc
shared/NSProjectile.qc
shared/NSInteractiveSurface.qc
shared/ambient_generic.qc
shared/decals.qc
shared/spraylogo.qc

View File

@ -17,17 +17,5 @@
#ifndef BASEENTITY
#define BASEENTITY
#include "NSIO.h"
#include "NSTrigger.h"
#include "NSEntity.h"
#include "NSRenderableEntity.h"
#include "NSSurfacePropEntity.h"
#include "NSPhysicsEntity.h"
#include "NSBrushTrigger.h"
#include "NSPointTrigger.h"
#include "NSNavAI.h"
#include "NSMonster.h"
#include "NSTalkMonster.h"
#include "NSProjectile.h"
#include "env_sprite.h"
#endif

View File

@ -14,6 +14,7 @@
* OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
*/
#include "NSOutput.h"
#include "gamerules.h"
#include "sentences.h"
#include "skill.h"

View File

@ -1,4 +1,5 @@
#includelist
NSOutput.qc
plugins.qc
logging.qc
nodes.qc

View File

@ -36,6 +36,8 @@ enumflags
/* NSEntity is the lowest, user accessible class.
It's responsible for handling practically every entity in Nuclide.
Try to avoid using the built-in 'entity' type unless you know exactly
what you are doing.
*/
class NSEntity:NSTrigger
{

View File

@ -21,7 +21,6 @@
This is a very low-level class. You're never meant to use this.
Use NSEntity as a basis for your classes.
*/
class NSIO
{
void(void) NSIO;

View File

@ -20,10 +20,6 @@ NSIO::Respawn(void)
// Respawn code goes here...
}
#ifdef CLIENT
string __fullspawndata;
#endif
void
NSIO::Init(void)
{

View File

@ -294,6 +294,7 @@ class NSMonster:NSNavAI
#ifdef CLIENT
string Sentences_GetSamples(string);
string Sentences_ProcessSample(string);
void NSMonster_ReadEntity(bool);
#else
void NSMonster_AlertEnemyAlliance(vector pos, float radius, int alliance);
entity NSMonster_FindClosestPlayer(entity);

View File

@ -280,7 +280,7 @@ NSMonster::GetRunSpeed(void)
void
NSMonster::AttackThink(void)
{
if (m_iSequenceState != SEQUENCESTATE_NONE)
if (InSequence())
return;
if (m_flAttackThink > time)
@ -391,17 +391,17 @@ NSMonster::FreeState(void)
if (m_iSequenceRemove) {
Hide();
}
dprint("NSMonster::FreeState\n");
NSLog("^2%s::^3FreeState^7: (%i, %S)", classname, m_iSequenceRemove, to_trigger);
}
void
NSMonster::FreeStateMoved(void)
{
vector new_origin;
dprint("NSMonster::FreeStateMoved\n");
new_origin = gettaginfo(this, 1);
NSLog("^2%s::^3FreeStateMoved^7: moved to %v", classname, new_origin);
SetOrigin(new_origin);
droptofloor();
DropToFloor();
FreeState();
}
@ -410,21 +410,24 @@ NSMonster::RouteEnded(void)
{
super::RouteEnded();
if (GetSequenceState() != SEQUENCESTATE_ACTIVE)
return;
/* mark that we've ended a sequence, if we're in one and que anim */
if (m_iSequenceState == SEQUENCESTATE_ACTIVE) {
if (m_flSequenceEnd) {
float duration = frameduration(modelindex, m_flSequenceEnd);
m_iSequenceState = SEQUENCESTATE_ENDING;
think = (m_iSequenceFlags & SSFL_NOSCRIPTMOVE) ? FreeState : FreeStateMoved;
nextthink = time + duration;
NSLog("^2NSNavAI::^3CheckRoute^7: %s overriding anim for %f seconds (modelindex %d, frame %d)", this.targetname, duration, modelindex, m_flSequenceEnd);
} else {
/* we still need to trigger targets */
think = (m_iSequenceFlags & SSFL_NOSCRIPTMOVE) ? FreeState : FreeStateMoved;
nextthink = time;
NSLog("^2NSNavAI::^3CheckRoute^7: %s has no anim, finished sequence.", this.targetname);
}
}
if (m_flSequenceEnd) {
float duration = frameduration(modelindex, m_flSequenceEnd);
m_iSequenceState = SEQUENCESTATE_ENDING;
think = (m_iSequenceFlags & SSFL_NOSCRIPTMOVE) ? FreeState : FreeStateMoved;
nextthink = time + duration;
NSLog("^2%s::^3CheckRoute^7: %s overriding anim for %f seconds (modelindex %d, frame %d)", \
classname, this.targetname, duration, modelindex, m_flSequenceEnd);
} else {
/* we still need to trigger targets */
think = (m_iSequenceFlags & SSFL_NOSCRIPTMOVE) ? FreeState : FreeStateMoved;
nextthink = time;
NSLog("^2%s::^3CheckRoute^7: %s has no anim, finished sequence", \
classname, this.targetname);
}
}
void
@ -535,7 +538,8 @@ NSMonster::IsAlive(void)
void
NSMonster::StateChanged(monsterState_e oldState, monsterState_e newState)
{
print(sprintf("%s state changed from %d to %d\n", classname, oldState, newState));
NSLog("^2%s::^3StateChanged^7: state changed from %d to %d", \
classname, oldState, newState);
}
void

View File

@ -14,6 +14,9 @@
* OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
*/
/* NSNavAI is a moving/pathfinding object. It knows how to deal
with waypoint based nodes.
*/
class
NSNavAI:NSSurfacePropEntity
{

View File

@ -48,8 +48,8 @@ NSNavAI::CheckRoute(void)
flDist = floor(vlen(evenpos - origin));
if (flDist < 8) {
NSLog("^2NSNavAI::^3CheckRoute^7: " \
"%s reached node\n", this.targetname);
NSLog("^2%s::^3CheckRoute^7: " \
"%s reached node", classname, targetname);
m_iCurNode--;
velocity = [0,0,0]; /* clamp friction */
@ -60,8 +60,8 @@ NSNavAI::CheckRoute(void)
/* can we walk directly to our target destination? */
if (trace_fraction == 1.0) {
dprint("^2NSNavAI::^3CheckRoute^7: " \
"Walking directly to last node\n");
NSLog("^2%s::^3CheckRoute^7: Walking directly to last node at '%v'", \
classname, m_vecLastNode);
m_iCurNode = -1;
}
}
@ -78,6 +78,8 @@ NSNavAI::CheckRoute(void)
if (trace_fraction == 1.0f) {
evenpos = vecNextNode;
m_iCurNode = iNextNode;
NSLog("^2%s::^3CheckRoute^7: skipping to next node %i at '%v'", \
classname, iNextNode, vecNextNode);
}
}
@ -85,7 +87,7 @@ NSNavAI::CheckRoute(void)
if (m_iCurNode < -1) {
ClearRoute();
RouteEnded();
NSLog("^2NSNavAI::^3CheckRoute^7: %s reached end", this.targetname);
NSLog("^2%s::^3CheckRoute^7: %s reached end", classname, targetname);
}
/* crouch attempt */
@ -173,12 +175,12 @@ NSNavAI::NewRoute(vector destination)
/* can we walk directly to our target destination? */
if (trace_fraction == 1.0) {
dprint("^2NSNavAI::^3NewRoute^7: " \
"Walking directly to last node\n");
NSLog("^2%s::^3NewRoute^7: " \
"Walking directly to last node", classname);
p.m_iCurNode = -1;
} else {
dprint("^2NSNavAI::^3NewRoute^7: " \
"Path obstructed, calculating route\n");
NSLog("^2%s::^3NewRoute^7: " \
"Path obstructed, calculating route", classname);
/* run through all nodes, mark the closest direct path possible */
for (int i = 0; i < p.m_iNodes; i++) {

View File

@ -94,3 +94,7 @@ class NSPhysicsEntity:NSSurfacePropEntity
virtual void(vector) ApplyTorqueCenter;
virtual float(int, int) CalculateImpactDamage;
};
#ifdef CLIENT
void NSPhysicsEntity_ReadEntity(bool);
#endif

View File

@ -111,3 +111,7 @@ class NSRenderableEntity:NSEntity
vector m_oldvecRenderColor;
#endif
};
#ifdef CLIENT
void NSRenderableEntity_ReadEntity(bool)
#endif

View File

@ -104,5 +104,8 @@ class NSSurfacePropEntity:NSRenderableEntity
nonvirtual void(void) SurfaceDataFinish;
nonvirtual void(void) PropDataFinish;
#endif
};
#ifdef CLIENT
void NSSurfacePropEntity_ReadEntity(bool);
#endif

View File

@ -127,3 +127,8 @@ class NSTalkMonster:NSMonster
virtual void(float,float) ReceiveEntity;
#endif
};
#ifdef CLIENT
void NSTalkMonster_ParseSentence(void);
void NSTalkMonster_ReadEntity(bool);
#endif

View File

@ -20,7 +20,7 @@ void
NSTrigger::Trigger(entity act, int state)
{
NSLog("^2%s::^3Input^7: Triggerd by %s with no consequence",
this.classname, act.classname);
classname, act.classname);
}
void
@ -36,7 +36,7 @@ NSTrigger::UseTargets(entity act, int state, float fDelay)
if (fDelay > 0.0f) {
NSLog("^2%s::^3UseTargets^7: Triggering `%s`",
this.classname, target);
classname, target);
NSTrigger eTimer = spawn(NSTrigger);
eTimer.owner = act;
@ -53,8 +53,8 @@ NSTrigger::UseTargets(entity act, int state, float fDelay)
NSTrigger trigger = (NSTrigger)f;
NSLog("^2%s::^3UseTargets^7:" \
"Triggering %s `%s` from %s\n", \
this.classname, f.classname, \
"Triggering %s `%s` from %s", \
classname, f.classname, \
trigger.targetname, act.classname);
if (trigger.Trigger != __NULL__) {
@ -96,7 +96,7 @@ NSTrigger::GetMaster(void)
/* default to success */
if (!m_strMaster) {
/*NSLog("^2%s::^3GetMaster^7: No master, return success",
this.classname));*/
classname));*/
return (1);
}
@ -105,16 +105,16 @@ NSTrigger::GetMaster(void)
/* we couldn't find it, so let's not even bother going further */
if (!t) {
NSLog("^2%s::^3GetMaster^7: Invalid master (%s), return success",
this.classname, m_strMaster);
classname, m_strMaster);
return (1);
}
if (t.GetValue() == 1)
NSLog("^2%s::^3GetMaster^7: %s learns %s ^2POSITIVE",
this.classname, targetname, m_strMaster);
classname, targetname, m_strMaster);
else
NSLog("^2%s::^3GetMaster^7: %s learns %s ^1NEGATIVE",
this.classname, targetname, m_strMaster);
classname, targetname, m_strMaster);
return t.GetValue();
}

View File

@ -32,6 +32,9 @@
#define ATTR_CHANGED(x) (x ##_net != x)
#define VEC_CHANGED(x,y) (x ##_net[y] != x[y])
#ifdef CLIENT
string __fullspawndata;
#endif
#include "global.h"
#include "sound.h"
@ -43,10 +46,27 @@
#endif
#include "../gs-entbase/shared/baseentity.h"
#include "NSIO.h"
#include "NSTrigger.h"
#include "NSEntity.h"
#include "NSRenderableEntity.h"
#include "NSSurfacePropEntity.h"
#include "NSPhysicsEntity.h"
#include "NSBrushTrigger.h"
#include "NSPointTrigger.h"
#include "NSNavAI.h"
#include "NSMonster.h"
#include "NSTalkMonster.h"
#include "NSProjectile.h"
#include "../xr/defs.h"
#include "NSClient.h"
#include "NSClientSpectator.h"
#include "NSClientPlayer.h"
#include "NSVehicle.h"
#include "NSMaterial.h"
#include "damage.h"
#include "flags.h"

View File

@ -1,4 +1,19 @@
#includelist
NSIO.qc
NSTrigger.qc
NSEntity.qc
NSRenderableEntity.qc
NSSurfacePropEntity.qc
NSPhysicsEntity.qc
NSBrushTrigger.qc
NSPointTrigger.qc
NSVehicle.qc
NSNavAI.qc
NSMonster.qc
NSTalkMonster.qc
NSProjectile.qc
NSClient.qc
NSClientSpectator.qc
pmove.qc

View File

@ -482,7 +482,7 @@ PMoveCustom_Move(void)
if (trace_startsolid) {
if (!PMoveCustom_Fix_Origin()) {
dprint("PHYSICS ERROR: We are stuck!\n");
dprint(sprintf("%s PHYSICS ERROR: We are stuck!\n", self.classname));
return;
}
continue;