Skip to content

Commit

Permalink
Added cl_autostop
Browse files Browse the repository at this point in the history
  • Loading branch information
Elinsrc committed Nov 2, 2024
1 parent 37608ee commit 9d6a166
Show file tree
Hide file tree
Showing 4 changed files with 18 additions and 2 deletions.
4 changes: 2 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# Client-Mod

* **Client-Mod** is a small modification of the **Half-Life** client part for **Xash3D FWGS and GoldSource**
* **Client-Mod** is a modification of the **Half-Life** client part for **Xash3D FWGS and GoldSource**

Added server name to no vgui scoreboard, player model name (included in vgui), curent map name and number of current players.

Expand All @@ -9,7 +9,7 @@ Added commands:
```
cl_autojump [0/1] - Will jump automatically as soon as you touch the ground while +jump is held. Taken from OpenAG.
```
* **When this command is enabled the jump button may not work**, solved by command **cl_lw 1**.
* When **cl_autojump** is enabled, the jump button may not work, solved by command **cl_lw 1**.
```
+ducktap — Performs a duck tap automatically as soon as you touch the ground (presses +duck for 1 frame). Taken from OpenAG.
Expand Down
1 change: 1 addition & 0 deletions cl_dll/ui/hud/hud.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -503,6 +503,7 @@ void CHud::Init( void )
// OpenAG
m_pCvarColor = CVAR_CREATE( "hud_color", "", FCVAR_ARCHIVE );
CVAR_CREATE( "hud_weapon", "0", FCVAR_ARCHIVE );
m_pCvarAutostop = CVAR_CREATE("cl_autostop", "0", FCVAR_ARCHIVE);
m_pCvarDrawDeathNoticesAlways = CVAR_CREATE( "cl_draw_deathnotices_always", "0", FCVAR_ARCHIVE );
m_pCvarDrawMessagesAlways = CVAR_CREATE( "cl_draw_messages_always", "0", FCVAR_ARCHIVE );
//
Expand Down
1 change: 1 addition & 0 deletions cl_dll/ui/hud/hud.h
Original file line number Diff line number Diff line change
Expand Up @@ -588,6 +588,7 @@ class CHud
cvar_t *m_pCvarDraw;
cvar_t *m_pCvarDrawDeathNoticesAlways;
cvar_t *m_pCvarDrawMessagesAlways;
cvar_t *m_pCvarAutostop;

// OpenAg
cvar_t* m_pCvarColor;
Expand Down
14 changes: 14 additions & 0 deletions cl_dll/ui/hud/hud_redraw.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -102,6 +102,7 @@ int CHud::Redraw( float flTime, int intermission )
m_flTime = flTime;
m_flTimeDelta = (double)( m_flTime - m_fOldTime );
static float m_flShotTime = 0;
static float m_flStopTime = 0;

// Clock was reset, reset delta
if( m_flTimeDelta < 0 )
Expand Down Expand Up @@ -131,6 +132,9 @@ int CHud::Redraw( float flTime, int intermission )
// Take a screenshot if the client's got the cvar set
if( CVAR_GET_FLOAT( "hud_takesshots" ) != 0 )
m_flShotTime = flTime + 1.0; // Take a screenshot in a second

if ( m_pCvarAutostop->value > 0.0f )
m_flStopTime = flTime + 3.0; // Stop demo recording in three seconds
}
}
#else
Expand All @@ -139,6 +143,9 @@ int CHud::Redraw( float flTime, int intermission )
// Take a screenshot if the client's got the cvar set
if( CVAR_GET_FLOAT( "hud_takesshots" ) != 0 )
m_flShotTime = flTime + 1.0f; // Take a screenshot in a second

if ( m_pCvarAutostop->value > 0.0f )
m_flStopTime = flTime + 3.0; // Stop demo recording in three seconds
}
#endif
if( m_flShotTime && m_flShotTime < flTime )
Expand All @@ -147,6 +154,13 @@ int CHud::Redraw( float flTime, int intermission )
m_flShotTime = 0;
}

if (m_flStopTime && m_flStopTime < flTime)
{
gEngfuncs.pfnClientCmd("stop");
m_flStopTime = 0;
}


m_iIntermission = intermission;

// if no redrawing is necessary
Expand Down

0 comments on commit 9d6a166

Please sign in to comment.