Skip to content

Commit 6a0d8b2

Browse files
committed
fcc
1 parent bdeb134 commit 6a0d8b2

2 files changed

Lines changed: 5 additions & 19 deletions

File tree

src/game/server/basecombatcharacter.cpp

Lines changed: 3 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -3469,21 +3469,14 @@ float CBaseCombatCharacter::GetFogObscuredRatio( float range ) const
34693469
#ifdef NEO // Generic solution for NPCs
34703470
auto controller = FogSystem()->GetMasterFogController();
34713471

3472-
if (controller)
3472+
if ( controller )
34733473
{
3474-
fogparams_t fog;
3475-
fog = controller->m_fog;
3474+
const fogparams_t fog = controller->m_fog;
34763475

34773476
if ( !fog.enable )
34783477
return 0.0f;
34793478

3480-
if ( range <= fog.start )
3481-
return 0.0f;
3482-
3483-
if ( range >= fog.end )
3484-
return 1.0f;
3485-
3486-
float ratio = (range - fog.start) / (fog.end - fog.start);
3479+
float ratio = RemapValClamped( range, fog.start, fog.end, 0.0f, 1.0f );
34873480
ratio = MIN( ratio, fog.maxdensity );
34883481
return ratio;
34893482
}

src/game/server/neo/neo_player.cpp

Lines changed: 2 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1363,19 +1363,12 @@ float CNEO_Player::GetFogObscuredRatio( float range ) const
13631363

13641364
if ( controller )
13651365
{
1366-
fogparams_t fog;
1367-
fog = controller->m_fog;
1366+
const fogparams_t fog = controller->m_fog;
13681367

13691368
if ( !fog.enable )
13701369
return 0.0f;
13711370

1372-
if ( range <= fog.start )
1373-
return 0.0f;
1374-
1375-
if ( range >= fog.end )
1376-
return 1.0f;
1377-
1378-
float ratio = (range - fog.start) / (fog.end - fog.start);
1371+
float ratio = RemapValClamped( range, fog.start, fog.end, 0.0f, 1.0f );
13791372
ratio = MIN( ratio, fog.maxdensity );
13801373
return ratio;
13811374
}

0 commit comments

Comments
 (0)