Skip to content

Commit

Permalink
fixes
Browse files Browse the repository at this point in the history
- doors in the wrong place or completely missing
- pushables not affected by xbow bolts (con3hl_1)
- keycards respawning
- text menus having a max of 2 options
- medkit reviving spectators
- held weapons sometimes being usable
  • Loading branch information
wootguy committed Dec 22, 2024
1 parent 7392727 commit eaf3745
Show file tree
Hide file tree
Showing 6 changed files with 19 additions and 11 deletions.
14 changes: 8 additions & 6 deletions dlls/func/CBaseDoor.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -306,6 +306,13 @@ 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");

if (FBitSet(pev->spawnflags, SF_DOOR_START_OPEN))
{ // swap pos1 and pos2, put door at pos2
UTIL_SetOrigin(pev, m_vecPosition2);
m_vecPosition2 = m_vecPosition1;
m_vecPosition1 = pev->origin;
}

InitDoorTriggers();

m_toggle_state = TS_AT_BOTTOM;
Expand Down Expand Up @@ -334,12 +341,7 @@ void CBaseDoor::InitDoorTriggers() {
if (m_fireOnStartMode == 2) m_fireOnCloseEndMode = USE_TOGGLE;
if (m_fireOnStopMode == 2) m_fireOnCloseEndMode = USE_TOGGLE;

if (FBitSet(pev->spawnflags, SF_DOOR_START_OPEN))
{ // swap pos1 and pos2, put door at pos2
UTIL_SetOrigin(pev, m_vecPosition2);
m_vecPosition2 = m_vecPosition1;
m_vecPosition1 = pev->origin;

if (FBitSet(pev->spawnflags, SF_DOOR_START_OPEN)) {
SWAP(m_fireOnCloseStart, m_fireOnOpenStart, string_t);
SWAP(m_fireOnCloseEnd, m_fireOnOpenEnd, string_t);
SWAP(m_fireOnCloseStartMode, m_fireOnOpenStartMode, USE_TYPE);
Expand Down
5 changes: 3 additions & 2 deletions dlls/func/CPushable.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -278,12 +278,13 @@ void CPushable::UpdatePushDir(CBaseEntity* pOther, int push) {
m_onMovingPlatform = true;
}
else {
Vector flatObjectDir = pOther->pev->origin - pev->origin;
Vector flatObjectDir = pOther->Center() - Center();
flatObjectDir.z = 0;
Vector flatOtherVel = pOther->pev->velocity;
flatOtherVel.z = 0;
float dot = DotProduct(flatObjectDir.Normalize(), flatOtherVel.Normalize());

if (DotProduct(flatObjectDir, flatOtherVel) > 0) {
if (dot > 0 && toucherVelocity.Length()) {
// if toucher is moving in the opposite direction of me, don't get pulled along with it.
// this can happen a pushable with lower friction touches one with higher friction
factor = 0;
Expand Down
2 changes: 1 addition & 1 deletion dlls/item/CItem.h
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ class EXPORT CItem : public CBaseAnimating
void Materialize(void);
virtual void ItemUse(CBaseEntity* pActivator, CBaseEntity* pCaller, USE_TYPE useType, float value);
virtual BOOL MyTouch(CBasePlayer* pPlayer) { return FALSE; };
BOOL ShouldRespawn();
virtual BOOL ShouldRespawn();
virtual CBaseEntity* Respawn(void);
const char* GetModel();
void SetSize(Vector defaultMins, Vector defaultMaxs);
Expand Down
3 changes: 2 additions & 1 deletion dlls/util/TextMenu.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -199,7 +199,8 @@ void TextMenu::Open(uint8_t duration, uint8_t page, CBasePlayer* player) {
lastPage = page;
lastDuration = duration;

int limitPerPage = isPaginated() ? ItemsPerPage() : ItemsPerPage();
int maxItemsWithoutPagination = MAX_PAGE_OPTIONS - (noexit ? 0 : 1);
int limitPerPage = isPaginated() ? ItemsPerPage() : maxItemsWithoutPagination;
int itemOffset = page * ItemsPerPage();
int totalPages = (numOptions+(ItemsPerPage() -1)) / ItemsPerPage();

Expand Down
2 changes: 1 addition & 1 deletion dlls/weapon/CBasePlayerItem.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -300,7 +300,7 @@ void CBasePlayerItem::DefaultUse(CBaseEntity* pActivator, CBaseEntity* pCaller,
}

int CBasePlayerItem::ObjectCaps() {
if (pev->effects == MOVETYPE_FOLLOW || (pev->effects & EF_NODRAW)) {
if (pev->movetype == MOVETYPE_FOLLOW || (pev->effects & EF_NODRAW)) {
return CBaseEntity::ObjectCaps();
}
else {
Expand Down
4 changes: 4 additions & 0 deletions dlls/weapon/CMedkit.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -231,6 +231,10 @@ void CMedkit::SecondaryAttack()
continue;
}

if (mon->IsPlayer() && mon->pev->iuser1) {
continue; // don't revive spectators
}

float dist = (mon->pev->origin - m_pPlayer->pev->origin).Length();

if (bestTarget == NULL) {
Expand Down

0 comments on commit eaf3745

Please sign in to comment.