Monster spawning position and scripted sequence fixes. Also leave movetype of LEAVECORPSE scripted sequence entities alone or else it breaks of1a1's G-Man

This commit is contained in:
Marco Cawthorne 2023-09-20 22:42:11 -07:00
parent 5f7ea594b8
commit 4f699aae6e
Signed by: eukara
GPG key ID: CE2032F0A2882A22
9 changed files with 12 additions and 16 deletions

View file

@ -273,7 +273,7 @@ scripted_sequence::RunOnEntity(entity targ)
NSLog("\tType: SS_RUN (%i)", m_iMove); NSLog("\tType: SS_RUN (%i)", m_iMove);
return; return;
} else if (m_iMove == SS_INSTANTANEOUS) { } else if (m_iMove == SS_INSTANTANEOUS) {
setorigin(f, this.origin); f.SetOrigin(GetOrigin());
f.DropToFloor(); f.DropToFloor();
NSLog("\tType: SS_INSTANTANEOUS (%i)", m_iMove); NSLog("\tType: SS_INSTANTANEOUS (%i)", m_iMove);
} else if (m_iMove == SS_TURNTOFACE) { } else if (m_iMove == SS_TURNTOFACE) {

View file

@ -182,8 +182,6 @@ void NSEntity::ReceiveEntity( float flNew, float flChanged ) {
if ( flChanged & BASEFL_CHANGED_SIZE ) if ( flChanged & BASEFL_CHANGED_SIZE )
setsize( this, mins, maxs ); setsize( this, mins, maxs );
setorigin( this, origin );
} }
void NSEntity::postdraw( void ) { void NSEntity::postdraw( void ) {

View file

@ -1188,7 +1188,6 @@ NSMonster::FreeStateDead(void)
DropToFloor(); DropToFloor();
RemoveFlags(FL_MONSTER); RemoveFlags(FL_MONSTER);
SetMovetype(MOVETYPE_NONE);
SetSolid(SOLID_CORPSE); SetSolid(SOLID_CORPSE);
SetState(MONSTER_DEAD); SetState(MONSTER_DEAD);
FreeState(); FreeState();
@ -1678,6 +1677,14 @@ NSMonster::Hide(void)
void void
NSMonster::Respawn(void) NSMonster::Respawn(void)
{ {
/* we need to delay the DropToFloor() by at least a frame.
otherwise they may just fall through an entity (func_wall, func_train etc.)
that came after this entity in the lump. */
static void AdjustSpawnPos(void) {
SetOrigin(GetSpawnOrigin());
DropToFloor();
}
v_angle = GetSpawnAngles(); v_angle = GetSpawnAngles();
v_angle[0] = Math_FixDelta(v_angle[0]); v_angle[0] = Math_FixDelta(v_angle[0]);
v_angle[1] = Math_FixDelta(v_angle[1]); v_angle[1] = Math_FixDelta(v_angle[1]);
@ -1698,11 +1705,9 @@ NSMonster::Respawn(void)
SetMovetype(MOVETYPE_WALK); SetMovetype(MOVETYPE_WALK);
SetModel(GetSpawnModel()); SetModel(GetSpawnModel());
SetSize(base_mins, base_maxs); SetSize(base_mins, base_maxs);
//SetOrigin();
setorigin_safe(this, GetSpawnOrigin());
SetEyePos([0, 0, m_flEyeHeight]); SetEyePos([0, 0, m_flEyeHeight]);
ScheduleThink(AdjustSpawnPos, 0.0f);
DropToFloor();
if (m_bWeaponStartsDrawn) { if (m_bWeaponStartsDrawn) {
m_bWeaponDrawn = true; m_bWeaponDrawn = true;

View file

@ -297,7 +297,6 @@ NSPhysicsEntity::ReceiveEntity(float flNew, float flChanged)
if (flChanged & RDENT_CHANGED_BODY) if (flChanged & RDENT_CHANGED_BODY)
_UpdateGeomset(); _UpdateGeomset();
setorigin(this, origin);
movetype = MOVETYPE_NONE; movetype = MOVETYPE_NONE;
} }
#endif #endif

View file

@ -440,7 +440,7 @@ NSPortal::ReceiveEntity(float flNew, float flChanged)
m_vecTargetS = v_right; m_vecTargetS = v_right;
m_vecTargetT = v_up; m_vecTargetT = v_up;
} }
setorigin(this, origin);
_PortalUpdated(); _PortalUpdated();
drawmask = MASK_ENGINE; drawmask = MASK_ENGINE;
predraw = 0; predraw = 0;

View file

@ -836,7 +836,6 @@ NSProjectile::ReceiveEntity(float flNew, float flChanged)
READENTITY_COLOR(m_vecRenderColor[2], PROJ_CHANGED_RENDERCOLOR) READENTITY_COLOR(m_vecRenderColor[2], PROJ_CHANGED_RENDERCOLOR)
READENTITY_COLOR(m_flRenderAmt, PROJ_CHANGED_RENDERAMT) READENTITY_COLOR(m_flRenderAmt, PROJ_CHANGED_RENDERAMT)
setmodelindex(this, modelindex); setmodelindex(this, modelindex);
setorigin(this, origin);
} }
#endif #endif

View file

@ -298,8 +298,6 @@ NSRenderableEntity::ReceiveEntity(float flNew, float flChanged)
setsize(this, mins * scale, maxs * scale); setsize(this, mins * scale, maxs * scale);
if (flChanged & RDENT_CHANGED_BODY) if (flChanged & RDENT_CHANGED_BODY)
_UpdateGeomset(); _UpdateGeomset();
setorigin(this, origin);
} }
/* /*

View file

@ -384,8 +384,6 @@ NSSurfacePropEntity::ReceiveEntity(float flNew, float flChanged)
setsize(this, mins * scale, maxs * scale); setsize(this, mins * scale, maxs * scale);
if (flChanged & SRFENT_CHANGED_BODY) if (flChanged & SRFENT_CHANGED_BODY)
setcustomskin(this, "", sprintf("geomset 0 %i\ngeomset 1 %i\n", m_iBody, m_iBody)); setcustomskin(this, "", sprintf("geomset 0 %i\ngeomset 1 %i\n", m_iBody, m_iBody));
setorigin(this, origin);
} }
#endif #endif

View file

@ -643,6 +643,7 @@ void
NSTalkMonster::Respawn(void) NSTalkMonster::Respawn(void)
{ {
super::Respawn(); super::Respawn();
m_eFollowing = world; m_eFollowing = world;
m_eFollowingChain = world; m_eFollowingChain = world;
PlayerUse = OnPlayerUse; PlayerUse = OnPlayerUse;
@ -1026,8 +1027,6 @@ NSTalkMonster::ReceiveEntity(float flNew, float flChanged)
setsize(this, mins * scale, maxs * scale); setsize(this, mins * scale, maxs * scale);
if (flChanged & MONFL_CHANGED_BODY) if (flChanged & MONFL_CHANGED_BODY)
_UpdateGeomset(); _UpdateGeomset();
setorigin(this, origin);
} }
void void