Skip to content

Commit 7e6b9b9

Browse files
Don't make the viewmodel pitchblack
Co-Authored-By: Johan Ehrendahl <[email protected]>
1 parent e26efb8 commit 7e6b9b9

File tree

3 files changed

+23
-0
lines changed

3 files changed

+23
-0
lines changed

cl_dll/StudioModelRenderer.cpp

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -376,6 +376,17 @@ void CStudioModelRenderer::StudioSlerpBones( vec4_t q1[], float pos1[][3], vec4_
376376
}
377377
}
378378

379+
bool CStudioModelRenderer::DoesPlayerRequireLightingAdjustment(const alight_t& lighting)
380+
{
381+
if (!m_pCurrentEntity)
382+
return false;
383+
if (!m_pCurrentEntity->player)
384+
return false;
385+
if (lighting.shadelight < 60)
386+
return true;
387+
return false;
388+
}
389+
379390
/*
380391
====================
381392
StudioGetAnim
@@ -1274,6 +1285,10 @@ int CStudioModelRenderer::StudioDrawModel( int flags )
12741285

12751286
IEngineStudio.StudioEntityLight( &lighting );
12761287

1288+
// Override lighting to be more visible in darkness. -Johan
1289+
if (lighting.shadelight < 60)
1290+
lighting.shadelight = 60;
1291+
12771292
// model and frame independant
12781293
IEngineStudio.StudioSetupLighting (&lighting);
12791294

@@ -1824,6 +1839,10 @@ int CStudioModelRenderer::StudioDrawPlayer( int flags, entity_state_t *pplayer )
18241839

18251840
IEngineStudio.StudioEntityLight( &lighting );
18261841

1842+
// Override lighting to be more visible in darkness. -Johan
1843+
if (lighting.shadelight < 60)
1844+
lighting.shadelight = 60;
1845+
18271846
// model and frame independant
18281847
IEngineStudio.StudioSetupLighting (&lighting);
18291848

cl_dll/StudioModelRenderer.h

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -39,6 +39,9 @@ class CStudioModelRenderer
3939
// Local interfaces
4040
//
4141

42+
// Determine if lighting adjustments are needed for player model
43+
bool DoesPlayerRequireLightingAdjustment(const alight_t& lighting);
44+
4245
// Look up animation data for sequence
4346
virtual mstudioanim_t *StudioGetAnim ( model_t *m_pSubModel, mstudioseqdesc_t *pseqdesc );
4447

common/const.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -112,6 +112,7 @@
112112
#define EF_NIGHTVISION 256 // player nightvision
113113
#define EF_SNIPERLASER 512 // sniper laser effect
114114
#define EF_FIBERCAMERA 1024// fiber camera
115+
#define EF_REDLIGHT 2048 // red dlight from entity attachment 1
115116

116117

117118
// entity flags

0 commit comments

Comments
 (0)