Skip to content

Commit

Permalink
v7.0 addins/fixes
Browse files Browse the repository at this point in the history
  • Loading branch information
RezWaki committed Apr 28, 2020
1 parent 6dc4f97 commit 77204bc
Show file tree
Hide file tree
Showing 5 changed files with 44 additions and 6 deletions.
13 changes: 13 additions & 0 deletions cl_dll/ammohistory.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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 )
{
Expand Down Expand Up @@ -107,6 +109,7 @@ void HistoryResource :: CheckClearHistory( void )
}

int m_flTurnoff = 0;
//int iHudTimerPos = ScreenHeight/6;

//
// Draw Ammo pickup history
Expand Down Expand Up @@ -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);

Expand All @@ -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);
Expand Down
25 changes: 24 additions & 1 deletion cl_dll/health.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,9 @@
#include <Windows.h>

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 )
Expand Down Expand Up @@ -181,16 +184,36 @@ 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)
{
int r, g, b;
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] );
Expand Down
2 changes: 1 addition & 1 deletion cl_dll/hud.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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;

Expand Down
2 changes: 2 additions & 0 deletions cl_dll/renderfuncs.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand All @@ -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;
8 changes: 4 additions & 4 deletions cl_dll/renderfuncs.h
Original file line number Diff line number Diff line change
Expand Up @@ -12,9 +12,9 @@
#include "GameStudioModelRenderer.h"
#include <Windows.h>
#include <vector>
//#ifndef _DEBUG
#ifdef _DEBUG
#include <GL\glew.h>
//#endif
#endif

/*
#include "hud.h"
Expand All @@ -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
Expand Down

0 comments on commit 77204bc

Please sign in to comment.