From d254f1bd0e8d49e761ca81e6ecf9db0b1cab2db7 Mon Sep 17 00:00:00 2001 From: mittorn Date: Tue, 1 Mar 2016 20:18:42 +0000 Subject: [PATCH] Improve client --- Android.mk | 1 + cl_dll/MOTD.cpp | 17 ++++----- cl_dll/ammo.cpp | 2 +- cl_dll/cl_util.h | 54 +++++++++++++++++----------- cl_dll/death.cpp | 12 +++---- cl_dll/hl/hl_weapons.cpp | 8 ++++- cl_dll/hud.cpp | 17 ++++----- cl_dll/hud.h | 9 ++--- cl_dll/hud_redraw.cpp | 78 ++++++++++++++++++++++++---------------- cl_dll/hud_spectator.cpp | 10 +++--- cl_dll/in_camera.cpp | 6 ++-- cl_dll/input_xash3d.cpp | 16 ++++----- cl_dll/saytext.cpp | 4 +-- cl_dll/scoreboard.cpp | 14 ++++---- cl_dll/statusbar.cpp | 4 +-- 15 files changed, 148 insertions(+), 104 deletions(-) create mode 100644 Android.mk diff --git a/Android.mk b/Android.mk new file mode 100644 index 00000000..5053e7d6 --- /dev/null +++ b/Android.mk @@ -0,0 +1 @@ +include $(call all-subdir-makefiles) diff --git a/cl_dll/MOTD.cpp b/cl_dll/MOTD.cpp index 94a06eea..68030cf9 100644 --- a/cl_dll/MOTD.cpp +++ b/cl_dll/MOTD.cpp @@ -1,9 +1,9 @@ /*** * * Copyright (c) 1999, Valve LLC. All rights reserved. -* -* This product contains software technology licensed from Id -* Software, Inc. ("Id Technology"). Id Technology (c) 1996 Id Software, Inc. +* +* This product contains software technology licensed from Id +* Software, Inc. ("Id Technology"). Id Technology (c) 1996 Id Software, Inc. * All Rights Reserved. * * Use, distribution, and modification of this source code and/or resulting @@ -90,8 +90,9 @@ int CHudMOTD :: Draw( float fTime ) gHUD.DrawDarkRectangle(xpos-5, ypos_r - 5, xmax - xpos+10, height + 10); while ( *ch ) { + char *next_line; int line_length = 0; // count the length of the current line - for ( char *next_line = ch; *next_line != '\n' && *next_line != 0; next_line++ ) + for ( next_line = ch; *next_line != '\n' && *next_line != 0; next_line++ ) line_length += gHUD.m_scrinfo.charWidths[ *next_line ]; char *top = next_line; if ( *top == '\n' ) @@ -105,7 +106,7 @@ int CHudMOTD :: Draw( float fTime ) ypos += LINE_HEIGHT; - if ( top ) // restore + if ( top ) // restore *top = '\n'; ch = next_line; if ( *ch == '\n' ) @@ -114,7 +115,7 @@ int CHudMOTD :: Draw( float fTime ) if ( ypos > (ScreenHeight - 20) ) break; // don't let it draw too low } - + return 1; } @@ -133,7 +134,7 @@ int CHudMOTD :: MsgFunc_MOTD( const char *pszName, int iSize, void *pbuf ) if ( is_finished ) { int length = 0; - + m_iMaxLength = 0; m_iFlags |= HUD_ACTIVE; @@ -151,7 +152,7 @@ int CHudMOTD :: MsgFunc_MOTD( const char *pszName, int iSize, void *pbuf ) } length++; } - + m_iLines++; if( length > m_iMaxLength ) { diff --git a/cl_dll/ammo.cpp b/cl_dll/ammo.cpp index 48309bd3..147709bc 100644 --- a/cl_dll/ammo.cpp +++ b/cl_dll/ammo.cpp @@ -108,7 +108,7 @@ void WeaponsResource :: LoadWeaponSprites( WEAPON *pWeapon ) pWeapon->rcCrosshair = p->rc; } else - pWeapon->hCrosshair = NULL; + pWeapon->hCrosshair = 0; p = GetSpriteList(pList, "autoaim", iRes, i); if (p) diff --git a/cl_dll/cl_util.h b/cl_dll/cl_util.h index e949e2c5..17e22ee6 100644 --- a/cl_dll/cl_util.h +++ b/cl_dll/cl_util.h @@ -24,21 +24,21 @@ #endif // Macros to hook function calls into the HUD object - -#define HOOK_MESSAGE(x) gEngfuncs.pfnHookUserMsg(#x, __MsgFunc_##x ); - -#define DECLARE_MESSAGE(y, x) int __MsgFunc_##x(const char *pszName, int iSize, void *pbuf) \ - { \ - return gHUD.y.MsgFunc_##x(pszName, iSize, pbuf ); \ - } - - -#define HOOK_COMMAND(x, y) gEngfuncs.pfnAddCommand( x, __CmdFunc_##y ); -#define DECLARE_COMMAND(y, x) void __CmdFunc_##x( void ) \ - { \ - gHUD.y.UserCmd_##x( ); \ - } - + +#define HOOK_MESSAGE(x) gEngfuncs.pfnHookUserMsg(#x, __MsgFunc_##x ); + +#define DECLARE_MESSAGE(y, x) int __MsgFunc_##x(const char *pszName, int iSize, void *pbuf) \ + { \ + return gHUD.y.MsgFunc_##x(pszName, iSize, pbuf ); \ + } + + +#define HOOK_COMMAND(x, y) gEngfuncs.pfnAddCommand( x, __CmdFunc_##y ); +#define DECLARE_COMMAND(y, x) void __CmdFunc_##x( void ) \ + { \ + gHUD.y.UserCmd_##x( ); \ + } + inline float CVAR_GET_FLOAT( const char *x ) { return gEngfuncs.pfnGetCvarFloat( (char*)x ); } inline char* CVAR_GET_STRING( const char *x ) { return gEngfuncs.pfnGetCvarString( (char*)x ); } @@ -82,31 +82,45 @@ inline struct cvar_s *CVAR_CREATE( const char *cv, const char *val, const int fl #define ClientCmd (*gEngfuncs.pfnClientCmd) #define SetCrosshair (*gEngfuncs.pfnSetCrosshair) #define AngleVectors (*gEngfuncs.pfnAngleVectors) - - +extern cvar_t *hud_textmode; +extern float g_hud_text_color[3]; +inline int DrawSetTextColor(float r, float g, float b) +{ + if( hud_textmode->value == 1 ) + g_hud_text_color[0]=r, g_hud_text_color[1] = g, g_hud_text_color[2] = b; + else + gEngfuncs.pfnDrawSetTextColor( r, g, b ); +} // Gets the height & width of a sprite, at the specified frame inline int SPR_Height( HSPRITE x, int f ) { return gEngfuncs.pfnSPR_Height(x, f); } inline int SPR_Width( HSPRITE x, int f ) { return gEngfuncs.pfnSPR_Width(x, f); } inline client_textmessage_t *TextMessageGet( const char *pName ) { return gEngfuncs.pfnTextMessageGet( pName ); } inline int TextMessageDrawChar( int x, int y, int number, int r, int g, int b ) -{ +{ return gEngfuncs.pfnDrawCharacter( x, y, number, r, g, b ); } inline int DrawConsoleString( int x, int y, const char *string ) { + if( hud_textmode->value == 1 ) + return gHUD.DrawHudString( x, y, 9999, (char*)string, 255*g_hud_text_color[0], 255*g_hud_text_color[1], 255*g_hud_text_color[2]); return gEngfuncs.pfnDrawConsoleString( x, y, (char*) string ); } inline void GetConsoleStringSize( const char *string, int *width, int *height ) { - gEngfuncs.pfnDrawConsoleStringLen( string, width, height ); + if( hud_textmode->value == 1 ) + *height = 13, *width = gHUD.DrawHudStringLen(string); + else + gEngfuncs.pfnDrawConsoleStringLen( (char*)string, width, height ); } inline int ConsoleStringLen( const char *string ) { - int _width, _height; + int _width = 0, _height = 0; + if( hud_textmode->value == 1 ) + return gHUD.DrawHudStringLen((char*)string); GetConsoleStringSize( string, &_width, &_height ); return _width; } diff --git a/cl_dll/death.cpp b/cl_dll/death.cpp index bd940f86..760b005c 100644 --- a/cl_dll/death.cpp +++ b/cl_dll/death.cpp @@ -110,7 +110,7 @@ int CHudDeathNotice :: Draw( float flTime ) rgDeathNoticeList[i].flDisplayTime = min( rgDeathNoticeList[i].flDisplayTime, gHUD.m_flTime + DEATHNOTICE_DISPLAY_TIME ); // Only draw if the viewport will let me - // vgui dropped out + // vgui dropped out //if ( gViewPort && gViewPort->AllowedToPrintText() ) { // Draw the death notice @@ -125,7 +125,7 @@ int CHudDeathNotice :: Draw( float flTime ) // Draw killers name if ( rgDeathNoticeList[i].KillerColor ) - gEngfuncs.pfnDrawSetTextColor( rgDeathNoticeList[i].KillerColor[0], rgDeathNoticeList[i].KillerColor[1], rgDeathNoticeList[i].KillerColor[2] ); + DrawSetTextColor( rgDeathNoticeList[i].KillerColor[0], rgDeathNoticeList[i].KillerColor[1], rgDeathNoticeList[i].KillerColor[2] ); x = 5 + DrawConsoleString( x, y, rgDeathNoticeList[i].szKiller ); } @@ -145,7 +145,7 @@ int CHudDeathNotice :: Draw( float flTime ) if (rgDeathNoticeList[i].iNonPlayerKill == FALSE) { if ( rgDeathNoticeList[i].VictimColor ) - gEngfuncs.pfnDrawSetTextColor( rgDeathNoticeList[i].VictimColor[0], rgDeathNoticeList[i].VictimColor[1], rgDeathNoticeList[i].VictimColor[2] ); + DrawSetTextColor( rgDeathNoticeList[i].VictimColor[0], rgDeathNoticeList[i].VictimColor[1], rgDeathNoticeList[i].VictimColor[2] ); x = DrawConsoleString( x, y, rgDeathNoticeList[i].szVictim ); } } @@ -184,8 +184,8 @@ int CHudDeathNotice :: MsgFunc_DeathMsg( const char *pszName, int iSize, void *p //if (gViewPort) // gViewPort->GetAllPlayersInfo(); - gHUD.m_Scoreboard.GetAllPlayersInfo(); - + gHUD.m_Scoreboard.GetAllPlayersInfo(); + // Get the Killer's name char *killer_name = g_PlayerInfoList[ killer ].name; @@ -279,7 +279,7 @@ int CHudDeathNotice :: MsgFunc_DeathMsg( const char *pszName, int iSize, void *p ConsolePrint( rgDeathNoticeList[i].szVictim ); } - if ( killedwith && *killedwith && (*killedwith > 13 ) && strcmp( killedwith, "d_world" ) && !rgDeathNoticeList[i].iTeamKill ) + if ( *killedwith && (*killedwith > 13 ) && strcmp( killedwith, "d_world" ) && !rgDeathNoticeList[i].iTeamKill ) { ConsolePrint( " with " ); diff --git a/cl_dll/hl/hl_weapons.cpp b/cl_dll/hl/hl_weapons.cpp index 820e49ff..3572bdaa 100644 --- a/cl_dll/hl/hl_weapons.cpp +++ b/cl_dll/hl/hl_weapons.cpp @@ -579,6 +579,12 @@ void CBasePlayerWeapon::PrintState( void ) COM_Log( "c:\\hl.log", "%i ", m_iClip ); } +int RandomLong( int a, int b ) +{ + return gEngfuncs.pfnRandomLong(a, b); +} + + /* ===================== HUD_InitClientWeapons @@ -615,7 +621,7 @@ void HUD_InitClientWeapons( void ) // Pass through to engine g_engfuncs.pfnPrecacheEvent = gEngfuncs.pfnPrecacheEvent; g_engfuncs.pfnRandomFloat = gEngfuncs.pfnRandomFloat; - g_engfuncs.pfnRandomLong = gEngfuncs.pfnRandomLong; + g_engfuncs.pfnRandomLong = RandomLong; // Allocate a slot for the local player HUD_PrepEntity( &player , NULL ); diff --git a/cl_dll/hud.cpp b/cl_dll/hud.cpp index 374f3b9d..36bb50ad 100644 --- a/cl_dll/hud.cpp +++ b/cl_dll/hud.cpp @@ -24,12 +24,13 @@ #include #include "parsemsg.h" #include "hud_servers.h" - + #include "demo.h" #include "demo_api.h" - +cvar_t *hud_textmode; +float g_hud_text_color[3]; extern client_sprite_t *GetSpriteList(client_sprite_t *pList, const char *psz, int iRes, int iCount); @@ -186,7 +187,7 @@ void CHud :: Init( void ) CVAR_CREATE( "hud_classautokill", "1", FCVAR_ARCHIVE | FCVAR_USERINFO ); // controls whether or not to suicide immediately on TF class switch CVAR_CREATE( "hud_takesshots", "0", FCVAR_ARCHIVE ); // controls whether or not to automatically take screenshots at the end of a round - + hud_textmode = CVAR_CREATE ( "hud_textmode", "0", FCVAR_ARCHIVE ); m_iLogo = 0; m_iFOV = 0; @@ -229,8 +230,8 @@ void CHud :: Init( void ) m_AmmoSecondary.Init(); m_TextMessage.Init(); m_StatusIcons.Init(); - m_MOTD.Init(); - m_Scoreboard.Init(); + m_MOTD.Init(); + m_Scoreboard.Init(); m_Menu.Init(); @@ -258,7 +259,7 @@ CHud :: ~CHud() m_pHudList = NULL; } - + } // GetSpriteIndex() @@ -400,8 +401,8 @@ void CHud :: VidInit( void ) m_AmmoSecondary.VidInit(); m_TextMessage.VidInit(); m_StatusIcons.VidInit(); - m_Scoreboard.VidInit(); - m_MOTD.VidInit(); + m_Scoreboard.VidInit(); + m_MOTD.VidInit(); } diff --git a/cl_dll/hud.h b/cl_dll/hud.h index 2078ea3e..e2d56f26 100644 --- a/cl_dll/hud.h +++ b/cl_dll/hud.h @@ -256,7 +256,7 @@ public: void GetAllPlayersInfo( void ); }; - + // //----------------------------------------------------- @@ -610,7 +610,8 @@ public: int DrawHudStringReverse( int xpos, int ypos, int iMinX, char *szString, int r, int g, int b ); int DrawHudNumberString( int xpos, int ypos, int iMinX, int iNumber, int r, int g, int b ); int GetNumWidth(int iNumber, int iFlags); - void DrawDarkRectangle( int x, int y, int wide, int tall); + int DrawHudStringLen( char *szIt ); + void DrawDarkRectangle( int x, int y, int wide, int tall); private: // the memory for these arrays are allocated in the first call to CHud::VidInit(), when the hud.txt and associated sprites are loaded. @@ -651,7 +652,7 @@ public: CHudStatusIcons m_StatusIcons; CHudScoreboard m_Scoreboard; CHudMOTD m_MOTD; - + void Init( void ); void VidInit( void ); @@ -682,7 +683,7 @@ public: // sprite indexes int m_HUD_number_0; - int m_iNoConsolePrint; + int m_iNoConsolePrint; void AddHudElem(CHudBase *p); diff --git a/cl_dll/hud_redraw.cpp b/cl_dll/hud_redraw.cpp index ad6999d8..0d7ecba0 100644 --- a/cl_dll/hud_redraw.cpp +++ b/cl_dll/hud_redraw.cpp @@ -18,7 +18,7 @@ #include #include "hud.h" #include "cl_util.h" -#include "triangleapi.h" +//#include "triangleapi.h" #define MAX_LOGO_FRAMES 56 @@ -182,22 +182,58 @@ void ScaleColors( int &r, int &g, int &b, int a ) b = (int)(b * x); } +const unsigned char colors[8][3] = +{ +{127, 127, 127}, // additive cannot be black +{255, 0, 0}, +{ 0, 255, 0}, +{255, 255, 0}, +{ 0, 0, 255}, +{ 0, 255, 255}, +{255, 0, 255}, +{240, 180, 24} +}; + int CHud :: DrawHudString(int xpos, int ypos, int iMaxX, char *szIt, int r, int g, int b ) { + if( hud_textmode->value == 2 ) + { + gEngfuncs.pfnDrawSetTextColor( r/255.0, g/255.0, b/255.0 ); + return gEngfuncs.pfnDrawConsoleString( xpos, ypos, (char*) szIt ); + } // draw the string until we hit the null character or a newline character for ( ; *szIt != 0 && *szIt != '\n'; szIt++ ) { - int next = xpos + gHUD.m_scrinfo.charWidths[ *szIt ]; // variable-width fonts look cool - if ( next > iMaxX ) + int w = gHUD.m_scrinfo.charWidths[ 'M' ]; + if ( xpos + w > iMaxX ) return xpos; + if( *szIt == '^' && *(szIt + 1) >= '0' && *(szIt + 1) <= '7' ) + { + szIt++; + r = colors[ *szIt - '0' ][0]; + g = colors[ *szIt - '0' ][1]; + b = colors[ *szIt - '0' ][2]; + if( !*(++szIt)) + return xpos; + } - TextMessageDrawChar( xpos, ypos, *szIt, r, g, b ); - xpos = next; + xpos += TextMessageDrawChar( xpos, ypos, *szIt, r, g, b ); } return xpos; } +int CHud :: DrawHudStringLen( char *szIt ) +{ + int l = 0; + for ( ; *szIt != 0 && *szIt != '\n'; szIt++ ) + { + l += gHUD.m_scrinfo.charWidths[ (unsigned int)*szIt ]; + } + return l; +} + + int CHud :: DrawHudNumberString( int xpos, int ypos, int iMinX, int iNumber, int r, int g, int b ) { char szString[32]; @@ -210,21 +246,11 @@ int CHud :: DrawHudNumberString( int xpos, int ypos, int iMinX, int iNumber, int int CHud :: DrawHudStringReverse( int xpos, int ypos, int iMinX, char *szString, int r, int g, int b ) { // find the end of the string - for ( char *szIt = szString; *szIt != 0; szIt++ ) - { // we should count the length? - } - - // iterate throug the string in reverse - for ( szIt--; szIt != (szString-1); szIt-- ) - { - int next = xpos - gHUD.m_scrinfo.charWidths[ *szIt ]; // variable-width fonts look cool - if ( next < iMinX ) - return xpos; - xpos = next; - - TextMessageDrawChar( xpos, ypos, *szIt, r, g, b ); - } - + for( char *szIt = szString; *szIt != 0; szIt++ ) + xpos -= gHUD.m_scrinfo.charWidths[ (unsigned char) *szIt ]; + if( xpos < iMinX ) + xpos = iMinX; + DrawHudString( xpos, ypos, gHUD.m_scrinfo.iWidth, szString, r, g, b ); return xpos; } @@ -325,16 +351,8 @@ int CHud::GetNumWidth( int iNumber, int iFlags ) void CHud::DrawDarkRectangle( int x, int y, int wide, int tall ) { - FillRGBA( x, y, wide, tall, 0, 0, 0, 0 ); - float m_flScale = 1; - gEngfuncs.pTriAPI->RenderMode( kRenderTransTexture ); - gEngfuncs.pTriAPI->Begin(TRI_QUADS); - gEngfuncs.pTriAPI->Color4f(0.0, 0.0, 0.0, 0.6); - gEngfuncs.pTriAPI->Vertex3f(x * m_flScale, (y+tall)*m_flScale, 0); - gEngfuncs.pTriAPI->Vertex3f(x * m_flScale, y*m_flScale, 0); - gEngfuncs.pTriAPI->Vertex3f((x + wide)*m_flScale, y*m_flScale, 0); - gEngfuncs.pTriAPI->Vertex3f((x + wide)*m_flScale, (y+tall)*m_flScale, 0); - gEngfuncs.pTriAPI->End(); + //gEngfuncs.pTriAPI->RenderMode( kRenderTransTexture ); + gEngfuncs.pfnFillRGBABlend( x, y, wide, tall, 0, 0, 0, 255 * 0.6 ); FillRGBA( x+1, y, wide-1, 1, 255, 140, 0, 255 ); FillRGBA( x, y, 1, tall-1, 255, 140, 0, 255 ); FillRGBA( x+wide-1, y+1, 1, tall-1, 255, 140, 0, 255 ); diff --git a/cl_dll/hud_spectator.cpp b/cl_dll/hud_spectator.cpp index e174ca51..be6d45e8 100644 --- a/cl_dll/hud_spectator.cpp +++ b/cl_dll/hud_spectator.cpp @@ -406,8 +406,8 @@ int CHudSpectator::Draw(float flTime) // make sure we have player info //gViewPort->GetAllPlayersInfo(); - gHUD.m_Scoreboard.GetAllPlayersInfo(); - + gHUD.m_Scoreboard.GetAllPlayersInfo(); + // loop through all the players and draw additional infos to their sprites on the map @@ -434,7 +434,7 @@ int CHudSpectator::Draw(float flTime) lx = strlen(string)*3; // 3 is avg. character length :) - gEngfuncs.pfnDrawSetTextColor( color[0], color[1], color[2] ); + DrawSetTextColor( color[0], color[1], color[2] ); DrawConsoleString( m_vPlayerPos[i][0]-lx,m_vPlayerPos[i][1], string); } @@ -609,8 +609,8 @@ void CHudSpectator::FindNextPlayer(bool bReverse) // make sure we have player info //gViewPort->GetAllPlayersInfo(); - gHUD.m_Scoreboard.GetAllPlayersInfo(); - + gHUD.m_Scoreboard.GetAllPlayersInfo(); + do diff --git a/cl_dll/in_camera.cpp b/cl_dll/in_camera.cpp index 26551864..c85631c3 100644 --- a/cl_dll/in_camera.cpp +++ b/cl_dll/in_camera.cpp @@ -94,7 +94,7 @@ float MoveToward( float cur, float goal, float maxspeed ) { if( cur != goal ) { - if( abs( cur - goal ) > 180.0 ) + if( fabs( cur - goal ) > 180.0 ) { if( cur < goal ) cur += 360.0; @@ -376,7 +376,7 @@ void DLLEXPORT CAM_Think( void ) if( camAngles[ PITCH ] - viewangles[ PITCH ] != cam_idealpitch->value ) camAngles[ PITCH ] = MoveToward( camAngles[ PITCH ], cam_idealpitch->value + viewangles[ PITCH ], CAM_ANGLE_SPEED ); - if( abs( camAngles[ 2 ] - cam_idealdist->value ) < 2.0 ) + if( fabs( camAngles[ 2 ] - cam_idealdist->value ) < 2.0 ) camAngles[ 2 ] = cam_idealdist->value; else camAngles[ 2 ] += ( cam_idealdist->value - camAngles[ 2 ] ) / 4.0; @@ -617,4 +617,4 @@ int DLLEXPORT CL_IsThirdPerson( void ) void DLLEXPORT CL_CameraOffset( float *ofs ) { VectorCopy( cam_ofs, ofs ); -} \ No newline at end of file +} diff --git a/cl_dll/input_xash3d.cpp b/cl_dll/input_xash3d.cpp index c3737c8f..e1023872 100644 --- a/cl_dll/input_xash3d.cpp +++ b/cl_dll/input_xash3d.cpp @@ -44,12 +44,12 @@ int ac_movecount; float rel_yaw; float rel_pitch; -#define F 1<<0 // Forward -#define B 1<<1 // Back -#define L 1<<2 // Left -#define R 1<<3 // Right -#define T 1<<4 // Forward stop -#define S 1<<5 // Side stop +#define F 1U<<0 // Forward +#define B 1U<<1 // Back +#define L 1U<<2 // Left +#define R 1U<<3 // Right +#define T 1U<<4 // Forward stop +#define S 1U<<5 // Side stop #define BUTTON_DOWN 1 #define IMPULSE_DOWN 2 @@ -58,7 +58,7 @@ float rel_pitch; void IN_ToggleButtons( float forwardmove, float sidemove ) { - static uint moveflags = T | S; + static unsigned int moveflags = T | S; if( forwardmove ) moveflags &= ~T; @@ -180,7 +180,7 @@ void IN_Move( float frametime, usercmd_t *cmd ) viewangles[YAW] += rel_yaw; if( fLadder ) { - if( ( cl_laddermode->value == 1 ) ) + if( cl_laddermode->value == 1 ) viewangles[YAW] -= ac_sidemove * 5; ac_sidemove = 0; } diff --git a/cl_dll/saytext.cpp b/cl_dll/saytext.cpp index 47ebb142..3a7616a5 100644 --- a/cl_dll/saytext.cpp +++ b/cl_dll/saytext.cpp @@ -130,7 +130,7 @@ int CHudSayText :: Draw( float flTime ) // draw the first x characters in the player color strncpy( buf, g_szLineBuffer[i], min(g_iNameLengths[i], MAX_PLAYER_NAME_LENGTH+32) ); buf[ min(g_iNameLengths[i], MAX_PLAYER_NAME_LENGTH+31) ] = 0; - gEngfuncs.pfnDrawSetTextColor( g_pflNameColors[i][0], g_pflNameColors[i][1], g_pflNameColors[i][2] ); + DrawSetTextColor( g_pflNameColors[i][0], g_pflNameColors[i][1], g_pflNameColors[i][2] ); int x = DrawConsoleString( LINE_START, y, buf ); // color is reset after each string draw @@ -309,4 +309,4 @@ void CHudSayText :: EnsureTextFitsInOneLineAndWrapIfHaveTo( int line ) } } } -} \ No newline at end of file +} diff --git a/cl_dll/scoreboard.cpp b/cl_dll/scoreboard.cpp index 15aa9f2e..c7431328 100644 --- a/cl_dll/scoreboard.cpp +++ b/cl_dll/scoreboard.cpp @@ -113,7 +113,7 @@ int SCOREBOARD_WIDTH = 320; int CHudScoreboard :: Draw( float fTime ) { - int can_show_packetloss = 0; + int i, j, can_show_packetloss = 0; int FAR_RIGHT; gHUD.m_iNoConsolePrint &= ~( 1 << 0 ); @@ -178,7 +178,7 @@ int CHudScoreboard :: Draw( float fTime ) } // clear out team scores - for ( int i = 1; i <= m_iNumTeams; i++ ) + for ( i = 1; i <= m_iNumTeams; i++ ) { if ( !g_TeamInfo[i].scores_overriden ) g_TeamInfo[i].frags = g_TeamInfo[i].deaths = 0; @@ -195,7 +195,7 @@ int CHudScoreboard :: Draw( float fTime ) continue; // skip over players who are not in a team // find what team this player is in - for ( int j = 1; j <= m_iNumTeams; j++ ) + for ( j = 1; j <= m_iNumTeams; j++ ) { if ( !stricmp( g_PlayerExtraInfo[i].teamname, g_TeamInfo[j].name ) ) break; @@ -485,6 +485,7 @@ int CHudScoreboard :: MsgFunc_ScoreInfo( const char *pszName, int iSize, void *p // string: client team name int CHudScoreboard :: MsgFunc_TeamInfo( const char *pszName, int iSize, void *pbuf ) { + int i, j; BEGIN_READ( pbuf, iSize ); short cl = READ_BYTE(); @@ -496,7 +497,7 @@ int CHudScoreboard :: MsgFunc_TeamInfo( const char *pszName, int iSize, void *pb // rebuild the list of teams // clear out player counts from teams - for ( int i = 1; i <= m_iNumTeams; i++ ) + for ( i = 1; i <= m_iNumTeams; i++ ) { g_TeamInfo[i].players = 0; } @@ -513,7 +514,7 @@ int CHudScoreboard :: MsgFunc_TeamInfo( const char *pszName, int iSize, void *pb continue; // skip over players who are not in a team // is this player in an existing team? - for ( int j = 1; j <= m_iNumTeams; j++ ) + for ( j = 1; j <= m_iNumTeams; j++ ) { if ( g_TeamInfo[j].name[0] == '\0' ) break; @@ -559,9 +560,10 @@ int CHudScoreboard :: MsgFunc_TeamScore( const char *pszName, int iSize, void *p { BEGIN_READ( pbuf, iSize ); char *TeamName = READ_STRING(); + int i; // find the team matching the name - for ( int i = 1; i <= m_iNumTeams; i++ ) + for ( i = 1; i <= m_iNumTeams; i++ ) { if ( !stricmp( TeamName, g_TeamInfo[i].name ) ) break; diff --git a/cl_dll/statusbar.cpp b/cl_dll/statusbar.cpp index 28018da9..e940187f 100644 --- a/cl_dll/statusbar.cpp +++ b/cl_dll/statusbar.cpp @@ -203,7 +203,7 @@ int CHudStatusBar :: Draw( float fTime ) } if ( m_pflNameColors[i] ) - gEngfuncs.pfnDrawSetTextColor( m_pflNameColors[i][0], m_pflNameColors[i][1], m_pflNameColors[i][2] ); + DrawSetTextColor( m_pflNameColors[i][0], m_pflNameColors[i][1], m_pflNameColors[i][2] ); DrawConsoleString( x, y, m_szStatusBar[i] ); } @@ -262,4 +262,4 @@ int CHudStatusBar :: MsgFunc_StatusValue( const char *pszName, int iSize, void * m_bReparseString = TRUE; return 1; -} \ No newline at end of file +}