diff --git a/dlls/env/CEnvWeather.cpp b/dlls/env/CEnvWeather.cpp index a87d190b..ea4d5b8a 100644 --- a/dlls/env/CEnvWeather.cpp +++ b/dlls/env/CEnvWeather.cpp @@ -58,6 +58,11 @@ #define SF_WEATHER_START_OFF 1 +// don't auto adjust fog minimum distance, for when you're sure that there will be no issues +// with transparent entities in the map (for instance if fog is only active during a cutscene, +// or if there is no way for a player to move fast from longjumps or falling). +#define SF_WEATHER_FOG_NO_ADJUST 1024 + extern "C" uint32_t g_fog_palette[61][256]; extern "C" int g_fog_skins; @@ -678,8 +683,15 @@ void CEnvWeather::Spawn(void) int newMax = V_max(newMin + 100, m_fogEndDist); // fog won't look nice if too compacted if (newMin > m_fogStartDist || newMax > m_fogEndDist) { - ALERT(at_console, "env_weather: fog distance increased to prevent rendering errors. [%d - %d] -> [%d - %d]\n", - m_fogStartDist, m_fogEndDist, newMin, newMax); + if (pev->spawnflags & SF_WEATHER_FOG_NO_ADJUST) { + newMin = m_fogStartDist; + newMax = m_fogEndDist; + ALERT(at_console, "env_weather: fog distance adjustment disabled via flag. Rendering errors may occur.\n"); + } + else { + ALERT(at_console, "env_weather: fog distance increased to prevent rendering errors. [%d - %d] -> [%d - %d]\n", + m_fogStartDist, m_fogEndDist, newMin, newMax); + } } m_fogStartDist = newMin; diff --git a/dlls/func/CFuncTrain.cpp b/dlls/func/CFuncTrain.cpp index 38da110e..268fa95a 100644 --- a/dlls/func/CFuncTrain.cpp +++ b/dlls/func/CFuncTrain.cpp @@ -29,6 +29,7 @@ class CFuncTrain : public CBasePlatTrain static TYPEDESCRIPTION m_SaveData[]; entvars_t* m_pevCurrentTarget; + EHANDLE m_previousTarget; int m_sounds; int m_activated; // 0 = never activated, 1 = activated, 2 = toggled off after activate }; @@ -161,8 +162,10 @@ void CFuncTrain::Next(void) return; } - if (m_activated != 2 && ENT(m_pevCurrentTarget) == pTarg->edict()) { - return; // prevent infinite recursion + + edict_t* prevTarg = m_previousTarget.GetEdict(); + if (prevTarg == ENT(m_pevCurrentTarget) && prevTarg == pTarg->edict()) { + return; // prevent infinite recursion (path_corner targeting itself with no distance to move) } // Save last target in case we need to find it again @@ -176,6 +179,7 @@ void CFuncTrain::Next(void) pev->speed = m_pevCurrentTarget->speed; ALERT(at_aiconsole, "Train %s speed to %4.2f\n", STRING(pev->targetname), pev->speed); } + m_previousTarget = ENT(m_pevCurrentTarget); m_pevCurrentTarget = pTarg->pev;// keep track of this since path corners change our target for us. pev->enemy = pTarg->edict();//hack diff --git a/dlls/monster/CBaseMonster.cpp b/dlls/monster/CBaseMonster.cpp index 935af9b9..a3c4655f 100644 --- a/dlls/monster/CBaseMonster.cpp +++ b/dlls/monster/CBaseMonster.cpp @@ -3032,10 +3032,10 @@ void CBaseMonster::HandleAnimEvent(MonsterEvent_t* pEvent) if (flash.sprite) { Vector origin, angles; - if (flash.attachment != -1) { + if (flash.attachment != (uint8_t)-1) { GetAttachment(flash.attachment, origin, angles); } - else if (flash.bone != -1) { + else if (flash.bone != (uint8_t)-1) { GetBonePosition(flash.bone, origin, angles); origin = origin + flash.offset; } diff --git a/dlls/player/CBasePlayer.cpp b/dlls/player/CBasePlayer.cpp index c416b3ed..5648d28c 100644 --- a/dlls/player/CBasePlayer.cpp +++ b/dlls/player/CBasePlayer.cpp @@ -4679,12 +4679,6 @@ void CBasePlayer :: UpdateClientData( void ) if ( !II->iId ) continue; - const char *pszName; - if (!II->pszName) - pszName = "Empty"; - else - pszName = II->pszName; - MESSAGE_BEGIN(MSG_ONE, gmsgWeaponList, NULL, pev); WRITE_STRING(II->pszName); // string weapon name WRITE_BYTE(GetAmmoIndex(II->pszAmmo1)); // byte Ammo Type @@ -6427,8 +6421,6 @@ void CBasePlayer::ResolveWeaponSlotConflict(int wepId) { int CBasePlayer::GetCurrentIdForConflictedSlot(int wepId) { int mask = g_weaponSlotMasks[wepId]; - ItemInfo& II = CBasePlayerItem::ItemInfoArray[wepId]; - if (count_bits_set(mask) <= 1) { return wepId; // impossible for there to be a conflict } diff --git a/dlls/triggers/CBaseTrigger.cpp b/dlls/triggers/CBaseTrigger.cpp index 69991a6e..ca9a9ac4 100644 --- a/dlls/triggers/CBaseTrigger.cpp +++ b/dlls/triggers/CBaseTrigger.cpp @@ -103,7 +103,6 @@ void CBaseTrigger::ActivateMultiTrigger(CBaseEntity* pActivator, bool isUntouch) else if (pev->spawnflags & (SF_TRIGGER_FIRE_ON_ENTER | SF_TRIGGER_FIRE_ON_EXIT)) { int emptySlot = -1; - bool alreadyTouching = false; for (int i = 0; i < MAX_TOUCHERS; i++) { if (m_touchers[i].GetEntity() == pActivator) { return; diff --git a/dlls/util/eng_wrappers.cpp b/dlls/util/eng_wrappers.cpp index 56c3ee19..39a3ecb3 100644 --- a/dlls/util/eng_wrappers.cpp +++ b/dlls/util/eng_wrappers.cpp @@ -234,6 +234,10 @@ int PRECACHE_SOUND_ENT(CBaseEntity* ent, const char* path) { } } + if (!path || !path[0]) { + return g_engfuncs.pfnPrecacheSound(NOT_PRECACHED_SOUND); + } + g_tryPrecacheSounds.insert(path); if (g_tryPrecacheSounds.size() <= MAX_PRECACHE_SOUND) {