scripted_sequence: More work to make c1a3 and t0a0a work properly

This commit is contained in:
Marco Cawthorne 2022-01-21 17:24:39 -08:00
parent 82b1cb68fa
commit 709f0a2297
Signed by: eukara
GPG Key ID: C196CD8BA993248A
5 changed files with 25 additions and 2 deletions

View File

@ -61,6 +61,7 @@ monster_generic::monster_generic(void)
base_mins = [-16,-16,0];
base_maxs = [16,16,72];
}
base_health = 100;
spawnflags |= MSF_MULTIPLAYER;
super::NSTalkMonster();

View File

@ -200,6 +200,10 @@ scripted_sequence::RunOnEntity(entity targ)
/* seems to be active at all times? contrary to SS_TURNTOFACE existing? */
f.m_vecSequenceAngle = angles;
f.m_iSequenceFlags = spawnflags;
if (spawnflags & SSFL_REPEATABLE)
f.SetOrigin(origin);
if (m_iMove == SS_NO) {
dprint("\tType: SS_NO\n");
@ -207,10 +211,12 @@ scripted_sequence::RunOnEntity(entity targ)
f.NewRoute(origin);
f.m_flSequenceSpeed = 64;
dprint("\tType: SS_WALK\n");
return;
} else if (m_iMove == SS_RUN) {
f.NewRoute(origin);
f.m_flSequenceSpeed = 200;
dprint("\tType: SS_RUN\n");
return;
} else if (m_iMove == SS_INSTANTANEOUS) {
setorigin(f, this.origin);
dprint("\tType: SS_INSTANTANEOUS\n");

View File

@ -193,6 +193,7 @@ class NSMonster:NSSurfacePropEntity
float m_flSequenceSpeed;
vector m_vecSequenceAngle;
vector m_vecTurnAngle;
int m_iSequenceFlags;
int m_iTriggerCondition;
string m_strTriggerTarget;

View File

@ -268,6 +268,7 @@ NSMonster::FreeState(void)
string to_trigger;
m_flSequenceEnd = 0;
m_iSequenceState = SEQUENCESTATE_NONE;
m_iSequenceFlags = 0;
/* we're clearing m_strRouteEnded early, because m_strRouteEnded
might change when .Trigger is executed. It could be another scripted
@ -288,14 +289,17 @@ NSMonster::FreeState(void)
if (m_iSequenceRemove) {
Hide();
}
dprint("NSMonster::FreeState\n");
}
void
NSMonster::FreeStateMoved(void)
{
vector new_origin;
dprint("NSMonster::FreeStateMoved\n");
new_origin = gettaginfo(this, 1);
SetOrigin(new_origin);
droptofloor(this);
FreeState();
}
@ -348,12 +352,12 @@ NSMonster::CheckRoute(void)
if (m_flSequenceEnd) {
float duration = frameduration(modelindex, m_flSequenceEnd);
m_iSequenceState = SEQUENCESTATE_ENDING;
think = FreeState;
think = (m_iSequenceFlags & SSFL_NOSCRIPTMOVE) ? FreeState : FreeStateMoved;
nextthink = time + duration;
dprint(sprintf("^2NSMonster::^3CheckRoute^7: %s overriding anim for %f seconds (modelindex %d, frame %d)\n", this.targetname, duration, modelindex, m_flSequenceEnd));
} else {
/* we still need to trigger targets */
think = FreeState;
think = (m_iSequenceFlags & SSFL_NOSCRIPTMOVE) ? FreeState : FreeStateMoved;
nextthink = time;
dprint(sprintf("^2NSMonster::^3CheckRoute^7: %s has no anim, finished sequence.\n", this.targetname));
}

View File

@ -176,6 +176,17 @@ Nodes_Init(void)
Node_AutoLink(n);
}
for (entity a = world; (a = find(a, ::classname, "scripted_sequence"));) {
int iID = g_iNodes++;
g_pNodes = (node_t *)memrealloc(g_pNodes, sizeof(node_t), iID, g_iNodes);
node_t *n = g_pNodes + iID;
n->origin = a.origin;
n->nb = __NULL__;
n->nb_count = 0;
n->radius = 32;
Node_AutoLink(n);
}
dprint(" ^2DONE\n");
dprint(sprintf("[^2NODES^7] %i nodes found.\n", g_iNodes));