Skip to content

Commit

Permalink
add env_fog
Browse files Browse the repository at this point in the history
The hackiest solution for fog ever. It works using multiple overlapping spheres surrounding the player with different scales and transparencies.

Scale is controlled by animations, and color by submodels which map to a single pixel in a swappable texture. An offset is applied so that the model can be made full bright with the EF_BRIGHTLIGHT effect, without the light being visible.

It looks good with 64 layers, but that's too much entity data to send. These can't be attached to players with aiment because then the animations break. So, it uses 16 layers for now. It looks very retro, even for HL.

Transparent entities are bugged with fog. Anything in the fog volume is made invisible unless changing rendermode back to normal. This will happen for everything except beams. Sprites mostly look correct. Windows will suddenly become solid sometimes, especially if multiple are tied together to form a large bounding box.
  • Loading branch information
wootguy committed Dec 8, 2024
1 parent f21f5ce commit bb66fc0
Show file tree
Hide file tree
Showing 8 changed files with 463 additions and 73 deletions.
5 changes: 5 additions & 0 deletions dlls/CBaseEntity.h
Original file line number Diff line number Diff line change
Expand Up @@ -176,6 +176,8 @@ class EXPORT CBaseEntity
virtual BOOL IsNetClient(void) { return FALSE; }
virtual BOOL IsBreakable(void) { return FALSE; }
virtual BOOL IsMachine(void) { return FALSE; };
virtual BOOL IsWeather(void) { return FALSE; };
virtual BOOL IsBeam(void) { return FALSE; };
virtual const char* TeamID(void) { return ""; }
virtual const char* DisplayName() { return STRING(pev->classname); }
virtual const char* GetDeathNoticeWeapon() { return STRING(pev->classname); };
Expand Down Expand Up @@ -387,10 +389,13 @@ class EXPORT CBaseEntity
InventoryRules m_inventoryRules;
bool m_isFadingOut; // is a corpse fading out

Vector m_fakeFollowOffset; // offset applied to player origin when entity is fake following

uint32_t m_pasPlayers; // players in the audible set of this entity (invalid for invisible ents)
uint32_t m_pvsPlayers; // players in the visible set of this entity (invalid for invisible ents)
uint32_t m_netPlayers; // players this entity has been networked to (AddToFullPack returned 1)
uint32_t m_hidePlayers; // players this entity will be hidden from (AddToFullPack)
uint32_t m_fakeFollow; // players this entity will attach to, ignoring true origin (AddToFullPack)

private:
bool TestInventoryRules(CBaseMonster* mon, std::unordered_set<CItemInventory*>& usedItems, const char** errorMsg);
Expand Down
1 change: 1 addition & 0 deletions dlls/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -164,6 +164,7 @@ set(ENV_SRC
env/CSprayCan.cpp
env/CSprite.cpp
env/CTestEffect.cpp
env/fog_colors.cpp
)

set(ITEM_HDR
Expand Down
1 change: 1 addition & 0 deletions dlls/env/CBeam.h
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@ class CBeam : public CBaseEntity
return (CBaseEntity::ObjectCaps() & ~FCAP_ACROSS_TRANSITION) | flags;
}
virtual const char* DisplayName() { return "Laser"; }
virtual BOOL IsBeam(void) { return TRUE; };

void EXPORT TriggerTouch(CBaseEntity* pOther);

Expand Down
Loading

0 comments on commit bb66fc0

Please sign in to comment.