Skip to content
New issue

Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? # to your account

Added cl_viewmodel_disable_idle to disable idle/fidget animations on the viewmodel models #124

Merged
merged 1 commit into from
Jun 28, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
26 changes: 25 additions & 1 deletion cl_dll/StudioModelRenderer.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,9 @@ void CStudioModelRenderer::Init( void )
m_pCvarHiModels = IEngineStudio.GetCvar( "cl_himodels" );
m_pCvarDeveloper = IEngineStudio.GetCvar( "developer" );
m_pCvarDrawEntities = IEngineStudio.GetCvar( "r_drawentities" );
m_pCvarViewmodelFov = gEngfuncs.pfnRegisterVariable( "cl_viewmodel_fov","0", FCVAR_ARCHIVE );
m_pCvarViewmodelFov = gEngfuncs.pfnRegisterVariable( "cl_viewmodel_fov", "0", FCVAR_ARCHIVE );
m_pCvarViewmodelNoIdle = gEngfuncs.pfnRegisterVariable( "cl_viewmodel_disable_idle", "0", FCVAR_ARCHIVE );
m_pCvarViewmodelNoEquip = gEngfuncs.pfnRegisterVariable( "cl_viewmodel_disable_equip", "0", FCVAR_ARCHIVE );

m_pChromeSprite = IEngineStudio.GetChromeSprite();

Expand Down Expand Up @@ -816,6 +818,28 @@ void CStudioModelRenderer::StudioSetupBones ( void )
}

pseqdesc = (mstudioseqdesc_t *)((byte *)m_pStudioHeader + m_pStudioHeader->seqindex) + m_pCurrentEntity->curstate.sequence;
if (m_pCurrentEntity == gEngfuncs.GetViewModel())
{
if (m_pCvarViewmodelNoIdle->value != 0.0f)
{
if (strstr(pseqdesc->label, "idle") != NULL || strstr(pseqdesc->label, "fidget") != NULL)
{
m_pCurrentEntity->curstate.frame = 0; // set current state to first frame
m_pCurrentEntity->curstate.framerate = 0; // don't animate at all
}
}
if (m_pCvarViewmodelNoEquip->value != 0.0f)
{
if (strstr(pseqdesc->label, "holster") != NULL || strstr(pseqdesc->label, "draw") != NULL ||
strstr(pseqdesc->label, "deploy") != NULL)
{
m_pCurrentEntity->curstate.sequence = 0; // instead set to idle sequence
pseqdesc = (mstudioseqdesc_t *)((byte *)m_pStudioHeader + m_pStudioHeader->seqindex) + m_pCurrentEntity->curstate.sequence;
pseqdesc->numframes = 1;
pseqdesc->fps = 1;
}
}
}

// always want new gait sequences to start on frame zero
/* if ( m_pPlayerInfo )
Expand Down
4 changes: 4 additions & 0 deletions cl_dll/StudioModelRenderer.h
Original file line number Diff line number Diff line change
Expand Up @@ -132,6 +132,10 @@ class CStudioModelRenderer
cvar_t *m_pCvarDrawEntities;
// Change viewmodel FOV
cvar_t *m_pCvarViewmodelFov;
// Disable viewmodel idle/fidget animations on viewmodels
cvar_t *m_pCvarViewmodelNoIdle;
// Disable viewmodel draw/holster/deploy animations on viewmodels
cvar_t *m_pCvarViewmodelNoEquip;
// The entity which we are currently rendering.
cl_entity_t *m_pCurrentEntity;

Expand Down