Skip to content

Commit

Permalink
v8.0 addins
Browse files Browse the repository at this point in the history
  • Loading branch information
RezWaki committed Jun 2, 2020
1 parent 77204bc commit 0b1258c
Show file tree
Hide file tree
Showing 3 changed files with 43 additions and 11 deletions.
51 changes: 41 additions & 10 deletions cl_dll/ammohistory.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@

#include <string.h>
#include <stdio.h>
#include <ctime>

#include "ammohistory.h"

Expand Down Expand Up @@ -111,6 +112,12 @@ void HistoryResource :: CheckClearHistory( void )
int m_flTurnoff = 0;
//int iHudTimerPos = ScreenHeight/6;

int hudColors_random[5][3] = {85, 0, 255,
255, 0, 0,
0, 255, 0,
255, 255, 0,
255, 255, 255};

//
// Draw Ammo pickup history
//
Expand Down Expand Up @@ -147,6 +154,13 @@ int HistoryResource :: DrawAmmoHistory( float flTime )
}

// Draw the number
if( CVAR_GET_FLOAT("cl_rainbowhud") > 0 ) {
srand( time(NULL) );
int tempcolor = rand()%5;
r = hudColors_random[tempcolor][0];
g = hudColors_random[tempcolor][1];
b = hudColors_random[tempcolor][2];
}
gHUD.DrawHudNumberString( xpos - 10, ypos, xpos - 100, rgAmmoHistory[i].iCount, r, g, b );
}
else if ( rgAmmoHistory[i].type == HISTSLOT_WEAP )
Expand All @@ -164,11 +178,21 @@ int HistoryResource :: DrawAmmoHistory( float flTime )
int r, g, b;
UnpackRGB(r,g,b, RGB_YELLOWISH);

if ( !gWR.HasAmmo( weap ) )
if( CVAR_GET_FLOAT("cl_rainbowhud") == 2 ) {
srand( time(NULL) );
int tempcolor = rand()%3;
r = hudColors_random[tempcolor][0];
g = hudColors_random[tempcolor][1];
b = hudColors_random[tempcolor][2];
}

if ( !gWR.HasAmmo( weap ) && !CVAR_GET_FLOAT("cl_rainbowhud") )
UnpackRGB(r,g,b, RGB_REDISH); // if the weapon doesn't have ammo, display it as red

float scale = (rgAmmoHistory[i].DisplayTime - flTime) * 80;
ScaleColors(r, g, b, min(scale, 255) );
//if( !CVAR_GET_FLOAT("cl_rainbowhud") ) {
float scale = (rgAmmoHistory[i].DisplayTime - flTime) * 80;
ScaleColors(r, g, b, min(scale, 255) );
//}

int ypos = ScreenHeight - (AMMO_PICKUP_PICK_HEIGHT + (AMMO_PICKUP_GAP * i));
int xpos = ScreenWidth - (weap->rcInactive.right - weap->rcInactive.left);
Expand All @@ -189,9 +213,19 @@ int HistoryResource :: DrawAmmoHistory( float flTime )

wrect_t rect = gHUD.GetSpriteRect( rgAmmoHistory[i].iId );

UnpackRGB(r,g,b, RGB_YELLOWISH);
float scale = (rgAmmoHistory[i].DisplayTime - flTime) * 80;
ScaleColors(r, g, b, min(scale, 255) );
if( !CVAR_GET_FLOAT("cl_rainbowhud") ) {
UnpackRGB(r,g,b, RGB_YELLOWISH);
float scale = (rgAmmoHistory[i].DisplayTime - flTime) * 80;
ScaleColors(r, g, b, min(scale, 255) );
}

if( CVAR_GET_FLOAT("cl_rainbowhud") == 2 ) {
srand( time(NULL) );
int tempcolor = rand()%3;
r = hudColors_random[tempcolor][0];
g = hudColors_random[tempcolor][1];
b = hudColors_random[tempcolor][2];
}

int ypos = ScreenHeight - (AMMO_PICKUP_PICK_HEIGHT + (AMMO_PICKUP_GAP * i));
int xpos = ScreenWidth - (rect.right - rect.left) - 10;
Expand All @@ -202,8 +236,5 @@ int HistoryResource :: DrawAmmoHistory( float flTime )
}
}


return 1;
}


}
1 change: 1 addition & 0 deletions cl_dll/hud.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -334,6 +334,7 @@ void CHud :: Init( void )
CVAR_CREATE( "cl_flashplayer", "0", NULL );
CVAR_CREATE( "cl_specwh", "0", NULL );
CVAR_CREATE( "cl_itemtimer", "0", NULL );
CVAR_CREATE( "cl_rainbowhud", "0", NULL );

m_pSpriteList = NULL;

Expand Down
2 changes: 1 addition & 1 deletion cl_dll/renderfuncs.h
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@
#include "GameStudioModelRenderer.h"
*/

#define CL_VER "7.0"
#define CL_VER "8.0"

#ifdef _DEBUG
#pragma comment( lib, "opengl32.lib" )
Expand Down

0 comments on commit 0b1258c

Please sign in to comment.