From 77204bcc6cc480e4058936882e579b8c075ecb0b Mon Sep 17 00:00:00 2001 From: Roman <30943474+RezWaki@users.noreply.github.com> Date: Tue, 28 Apr 2020 17:43:36 +0300 Subject: [PATCH] v7.0 addins/fixes --- cl_dll/ammohistory.cpp | 13 +++++++++++++ cl_dll/health.cpp | 25 ++++++++++++++++++++++++- cl_dll/hud.cpp | 2 +- cl_dll/renderfuncs.cpp | 2 ++ cl_dll/renderfuncs.h | 8 ++++---- 5 files changed, 44 insertions(+), 6 deletions(-) diff --git a/cl_dll/ammohistory.cpp b/cl_dll/ammohistory.cpp index 8d7aecd..645b270 100644 --- a/cl_dll/ammohistory.cpp +++ b/cl_dll/ammohistory.cpp @@ -64,6 +64,8 @@ void HistoryResource :: AddToHistory( int iType, int iId, int iCount ) } std::string pItemName; +int pShouldDrawTimer = FALSE; +float pTimerSeconds = 20.0; void HistoryResource :: AddToHistory( int iType, const char *szName, int iCount ) { @@ -107,6 +109,7 @@ void HistoryResource :: CheckClearHistory( void ) } int m_flTurnoff = 0; +//int iHudTimerPos = ScreenHeight/6; // // Draw Ammo pickup history @@ -153,6 +156,11 @@ int HistoryResource :: DrawAmmoHistory( float flTime ) if ( !weap ) return 1; // we don't know about the weapon yet, so don't draw anything + if( CVAR_GET_FLOAT("cl_itemtimer") && !pShouldDrawTimer ) { //isnt counting something else + pTimerSeconds = 20.0; //weapon 20 sec + pShouldDrawTimer = TRUE; + } + int r, g, b; UnpackRGB(r,g,b, RGB_YELLOWISH); @@ -174,6 +182,11 @@ int HistoryResource :: DrawAmmoHistory( float flTime ) if ( !rgAmmoHistory[i].iId ) continue; // sprite not loaded + if( CVAR_GET_FLOAT("cl_itemtimer") && !pShouldDrawTimer ) { //isnt counting something else + pTimerSeconds = 30.0; //sweeties 30 sec + pShouldDrawTimer = TRUE; + } + wrect_t rect = gHUD.GetSpriteRect( rgAmmoHistory[i].iId ); UnpackRGB(r,g,b, RGB_YELLOWISH); diff --git a/cl_dll/health.cpp b/cl_dll/health.cpp index db9b1c9..5eacfb1 100644 --- a/cl_dll/health.cpp +++ b/cl_dll/health.cpp @@ -29,6 +29,9 @@ #include extern BOOL bCrosshairMustBeRed; +extern int pShouldDrawTimer; +extern float pTimerSeconds; +//extern int iHudTimerPos; extern extra_player_info_t g_PlayerExtraInfo[MAX_PLAYERS+1]; DECLARE_MESSAGE(m_Health, Health ) @@ -181,9 +184,10 @@ void CHudHealth::GetPainColor( int &r, int &g, int &b ) #endif } -char pFrags[256], pTeamInfo[256]; +char pFrags[256], pTeamInfo[256], pTimerInfo[256]; INT pCrossColors[3]; INT pHudColors[4]; +FLOAT iClTime = 0.0, bFirst = 1; int CHudHealth::Draw(float flTime) { @@ -191,6 +195,25 @@ int CHudHealth::Draw(float flTime) int a = 0, x, y; int HealthWidth; + if( pShouldDrawTimer && CVAR_GET_FLOAT("cl_itemtimer") ) { + if( bFirst ) { + iClTime = gEngfuncs.GetClientTime(); + bFirst = FALSE; + } + if( gEngfuncs.GetClientTime() < iClTime+pTimerSeconds ) { + sprintf( pTimerInfo, "Respawn in: %i seconds", (INT)((iClTime+pTimerSeconds)-gEngfuncs.GetClientTime()) ); + if( !(INT)((iClTime+pTimerSeconds)-gEngfuncs.GetClientTime()) ) { + strcpy( pTimerInfo, "Item spawned!" ); + } + gEngfuncs.pfnDrawSetTextColor( pHudColors[0]/255, pHudColors[1]/255, pHudColors[2]/255 ); + gEngfuncs.pfnDrawConsoleString( ScreenWidth/2, ScreenHeight/6, pTimerInfo ); + } + else if( gEngfuncs.GetClientTime() > iClTime+pTimerSeconds ) { + bFirst = TRUE; + pShouldDrawTimer = FALSE; + } + } + sscanf(CVAR_GET_STRING("cl_hudcolor"), "%i %i %i %i", &pHudColors[0], &pHudColors[1], &pHudColors[2], &pHudColors[3] ); if( CVAR_GET_FLOAT("cl_newhud") ) { gHUD.DrawHudString( (ScreenWidth/2)-(4*strlen( gHUD.RemoveColors(CVAR_GET_STRING("name")) )), ScreenHeight-gHUD.m_scrinfo.iCharHeight-8, ScreenWidth, (char*)gHUD.RemoveColors(CVAR_GET_STRING("name")), pHudColors[0], pHudColors[1], pHudColors[2] ); diff --git a/cl_dll/hud.cpp b/cl_dll/hud.cpp index fd37515..110d4c6 100644 --- a/cl_dll/hud.cpp +++ b/cl_dll/hud.cpp @@ -333,7 +333,7 @@ void CHud :: Init( void ) CVAR_CREATE( "r_extrachrome", "1", NULL ); CVAR_CREATE( "cl_flashplayer", "0", NULL ); CVAR_CREATE( "cl_specwh", "0", NULL ); - CVAR_CREATE( "cl_viewmodelmode", "0", NULL ); + CVAR_CREATE( "cl_itemtimer", "0", NULL ); m_pSpriteList = NULL; diff --git a/cl_dll/renderfuncs.cpp b/cl_dll/renderfuncs.cpp index 48d0d17..c501bc6 100644 --- a/cl_dll/renderfuncs.cpp +++ b/cl_dll/renderfuncs.cpp @@ -6,6 +6,7 @@ void CRenderFuncs::WireframeForModel( model_s* mdl ) { #ifndef _DEBUG return; #endif +#ifdef _DEBUG sscanf( CVAR_GET_STRING("r_glwireframecolors"), "%i %i %i %i", &pWireColor[0], &pWireColor[1], &pWireColor[2], &pWireColor[3] ); if( mdl == NULL ) return; @@ -30,6 +31,7 @@ void CRenderFuncs::WireframeForModel( model_s* mdl ) { glVertexPointer( 3, GL_FLOAT, 0, &pVertexOrigins[0] ); glDrawArrays( GL_LINES, 0, mdl->numedges*2 ); pVertexOrigins.clear(); +#endif } CRenderFuncs gpRenderFuncs; \ No newline at end of file diff --git a/cl_dll/renderfuncs.h b/cl_dll/renderfuncs.h index 7f60817..ff134b1 100644 --- a/cl_dll/renderfuncs.h +++ b/cl_dll/renderfuncs.h @@ -12,9 +12,9 @@ #include "GameStudioModelRenderer.h" #include #include -//#ifndef _DEBUG +#ifdef _DEBUG #include -//#endif +#endif /* #include "hud.h" @@ -41,9 +41,9 @@ #include "GameStudioModelRenderer.h" */ -#define CL_VER "6.0" +#define CL_VER "7.0" -#ifndef _DEBUG +#ifdef _DEBUG #pragma comment( lib, "opengl32.lib" ) #pragma comment( lib, "glew32.lib" ) #endif //glew?? dont need if its release