Skip to content

Commit

Permalink
fixes
Browse files Browse the repository at this point in the history
- rpgs following invisible lasers (your dot is still active but hidden while reloading)
- rotating doors not firing their open/close targets (bridge_the_gap softlock)
- monstermaker dropping monsters into the void if stuck in the floor (sectore_2 softlock)
- satchel gravity too high
  • Loading branch information
wootguy committed Dec 9, 2024
1 parent 2c03928 commit c472a01
Show file tree
Hide file tree
Showing 6 changed files with 39 additions and 17 deletions.
24 changes: 14 additions & 10 deletions dlls/func/CBaseDoor.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -306,6 +306,20 @@ void CBaseDoor::Spawn()
m_vecPosition2 = m_vecPosition1 + (pev->movedir * (fabs(pev->movedir.x * (pev->size.x - 2)) + fabs(pev->movedir.y * (pev->size.y - 2)) + fabs(pev->movedir.z * (pev->size.z - 2)) - m_flLip));
ASSERTSZ(m_vecPosition1 != m_vecPosition2, "door start/end positions are equal\n");

InitDoorTriggers();

m_toggle_state = TS_AT_BOTTOM;

// if the door is flagged for USE button activation only, use NULL touch function
if (FBitSet(pev->spawnflags, SF_DOOR_USE_ONLY))
{
SetTouch(NULL);
}
else // touchable button
SetTouch(&CBaseDoor::DoorTouch);
}

void CBaseDoor::InitDoorTriggers() {
// TODO: ripent this stuff
if (pev->netname && !m_fireOnCloseEnd) {
// legacy fire on opened/closed keys
Expand All @@ -331,16 +345,6 @@ void CBaseDoor::Spawn()
SWAP(m_fireOnCloseStartMode, m_fireOnOpenStartMode, USE_TYPE);
SWAP(m_fireOnCloseEndMode, m_fireOnOpenEndMode, USE_TYPE);
}

m_toggle_state = TS_AT_BOTTOM;

// if the door is flagged for USE button activation only, use NULL touch function
if (FBitSet(pev->spawnflags, SF_DOOR_USE_ONLY))
{
SetTouch(NULL);
}
else // touchable button
SetTouch(&CBaseDoor::DoorTouch);
}


Expand Down
1 change: 1 addition & 0 deletions dlls/func/CBaseDoor.h
Original file line number Diff line number Diff line change
Expand Up @@ -50,6 +50,7 @@ class CBaseDoor : public CBaseToggle
virtual void Use(CBaseEntity* pActivator, CBaseEntity* pCaller, USE_TYPE useType, float value);
virtual void Blocked(CBaseEntity* pOther);
virtual const char* DisplayName() { return "Door"; }
void InitDoorTriggers();


virtual int ObjectCaps(void)
Expand Down
2 changes: 2 additions & 0 deletions dlls/func/CRotDoor.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -95,6 +95,8 @@ void CRotDoor::Spawn(void)
pev->movedir = pev->movedir * -1;
}

InitDoorTriggers();

m_toggle_state = TS_AT_BOTTOM;

if (FBitSet(pev->spawnflags, SF_DOOR_USE_ONLY))
Expand Down
19 changes: 14 additions & 5 deletions dlls/monster/CMonsterMaker.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -447,20 +447,29 @@ void CMonsterMaker::MakeMonster( void )
pevCreate->targetname = pev->netname;
}

// unstuck monsters if spawned inside the ceiling
// unstuck monsters if spawned inside the floor/ceiling
// (unless it's a barnacle/turret or smth that doesn't move)
if (pent->v.movetype == MOVETYPE_STEP) {
TraceResult tr;
TRACE_MONSTER_HULL(pent, pent->v.origin, pent->v.origin, ignore_monsters, pent, &tr);
TRACE_MONSTER_HULL(pent, pent->v.origin, pent->v.origin + Vector(0, 0, maxs.z), ignore_monsters, pent, &tr);

if (tr.fStartSolid) {
TRACE_MONSTER_HULL(pent, pent->v.origin, pent->v.origin - Vector(0, 0, 4096), ignore_monsters, pent, &tr);
UTIL_SetOrigin(&pent->v, tr.vecEndPos);
if (tr.fAllSolid) {
Vector upPos = tr.vecEndPos;
TRACE_MONSTER_HULL(pent, upPos, upPos - Vector(0, 0, 4096), ignore_monsters, pent, &tr);

if (!tr.fAllSolid)
UTIL_SetOrigin(&pent->v, tr.vecEndPos);

// not using this because it will send the monster through solid entities if the monster is spawning
// inside of another monster (startSolid)
//DROP_TO_FLOOR(pent);
}
else if (tr.fStartSolid) {
// was stuck in the floor, drop from the upward trace position
TRACE_MONSTER_HULL(pent, tr.vecEndPos, tr.vecEndPos - Vector(0, 0, maxs.z), ignore_monsters, pent, &tr);
if (!tr.fAllSolid)
UTIL_SetOrigin(&pent->v, tr.vecEndPos);
}
}

m_cLiveChildren++;// count this monster
Expand Down
4 changes: 4 additions & 0 deletions dlls/weapon/CRpg.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -294,6 +294,10 @@ void CRpgRocket :: FollowThink( void )
// Examine all entities within a reasonable radius
while ((pOther = UTIL_FindEntityByClassname( pOther, "laser_spot" )) != NULL)
{
if (pOther->pev->effects & EF_NODRAW) {
continue; // laser isn't removed when a player reloads
}

Vector vSpotLocation = pOther->pev->origin;

if (UTIL_PointContents(vSpotLocation) == CONTENTS_SKY)
Expand Down
6 changes: 4 additions & 2 deletions dlls/weapon/CSatchel.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,8 @@ IMPLEMENT_SAVERESTORE(CSatchel, CBasePlayerWeapon)
LINK_ENTITY_TO_CLASS(weapon_satchel, CSatchel)
LINK_ENTITY_TO_CLASS(monster_satchel, CSatchelCharge)

#define SATCHEL_GRAVITY 0.5f

//=========================================================
// Deactivate - do whatever it is we do to an orphaned
// satchel when we don't want it in the world anymore.
Expand Down Expand Up @@ -77,7 +79,7 @@ void CSatchelCharge :: Spawn( void )
SetThink( &CSatchelCharge::SatchelThink );
pev->nextthink = gpGlobals->time + 0.1;

pev->gravity = 0.5;
pev->gravity = SATCHEL_GRAVITY;
pev->friction = 0.8;

float dmg_mult = GetDamageModifier();
Expand Down Expand Up @@ -140,7 +142,7 @@ void CSatchelCharge :: SatchelThink( void )
}
else if (pev->waterlevel == 0)
{
pev->gravity = 0;
pev->gravity = SATCHEL_GRAVITY;
}
else
{
Expand Down

0 comments on commit c472a01

Please sign in to comment.