From 956d584c9f194e59f50e017057aad7d78cddfd10 Mon Sep 17 00:00:00 2001 From: a1batross Date: Fri, 16 Sep 2016 22:23:18 +0300 Subject: [PATCH] Update script. Shutdown method for CHudBase. Fix BufferReader constructor call. Use pregenerated textures in radar. --- android/build | 2 +- android/update | 4 + cl_dll/cdll_int.cpp | 17 ++++ cl_dll/cs_wpn/cs_weapons.cpp | 8 +- cl_dll/hud/hud.cpp | 14 +-- cl_dll/hud/hud_msg.cpp | 8 +- cl_dll/hud/menu.cpp | 2 +- cl_dll/hud/message.cpp | 6 +- cl_dll/hud/money.cpp | 4 +- cl_dll/hud/nvg.cpp | 2 +- cl_dll/hud/radar.cpp | 187 +++++++++++++++++++++++++++++++--- cl_dll/hud/radio.cpp | 2 +- cl_dll/hud/saytext.cpp | 1 - cl_dll/hud/sniperscope.cpp | 6 ++ cl_dll/hud/spectator_gui.cpp | 9 +- cl_dll/hud/timer.cpp | 2 +- cl_dll/include/hud/hud.h | 13 ++- cl_dll/include/hud/radar.h | 4 + cl_dll/input.cpp | 10 +- cl_dll/rain.cpp | 2 +- cl_dll/studio/studio_util.cpp | 44 +++----- 21 files changed, 271 insertions(+), 76 deletions(-) create mode 100755 android/update diff --git a/android/build b/android/build index 8e01229..808d830 100755 --- a/android/build +++ b/android/build @@ -38,7 +38,7 @@ cp -r ../3rdparty/extras/* pak/ python2 makepak.py pak/ assets/extras.pak # Build -ndk-build -j8 NDK_TOOLCHAIN_VERSION=4.8 _CS16CLIENT_ENABLE_OPENMP=$OMP NDK_DEBUG=$RELEASE +ndk-build -j8 NDK_TOOLCHAIN_VERSION=4.8 _CS16CLIENT_ENABLE_OPENMP=$OMP NDK_DEBUG=$RELEASE V=1 ant $1 jarsigner -verbose -sigalg SHA1withRSA -digestalg SHA1 -keystore ../../myks.keystore bin/cs16-client-$1-unaligned.apk xashdroid -tsa https://timestamp.geotrust.com/tsa $HOME/.android/android-sdk-linux/build-tools/23.0.3/zipalign 4 bin/cs16-client-$1-unaligned.apk bin/cs16-client.apk diff --git a/android/update b/android/update new file mode 100755 index 0000000..81b043a --- /dev/null +++ b/android/update @@ -0,0 +1,4 @@ +#!/bin/bash + +echo " ------- UPDATING SUBMODULES ------- " +git submodule foreach git pull origin master diff --git a/cl_dll/cdll_int.cpp b/cl_dll/cdll_int.cpp index 26ec4f0..41c318c 100644 --- a/cl_dll/cdll_int.cpp +++ b/cl_dll/cdll_int.cpp @@ -29,6 +29,7 @@ //#include "interface.h" // not used here #include "render_api.h" #include "mobility_int.h" +#include "vgui_parser.h" cl_enginefunc_t gEngfuncs = { }; render_api_t gRenderAPI = { }; @@ -40,6 +41,7 @@ int g_iMobileAPIVersion = 0; void InitInput (void); void Game_HookEvents( void ); void IN_Commands( void ); +void Input_Shutdown (void); /* ========================== @@ -62,6 +64,21 @@ int DLLEXPORT Initialize( cl_enginefunc_t *pEnginefuncs, int iVersion ) return 1; } + +/* +============= +HUD_Shutdown + +============= +*/ +void DLLEXPORT HUD_Shutdown( void ) +{ + gHUD.Shutdown(); + Input_Shutdown(); + Localize_Free(); +} + + /* ================================ HUD_GetHullBounds diff --git a/cl_dll/cs_wpn/cs_weapons.cpp b/cl_dll/cs_wpn/cs_weapons.cpp index 0784831..0e87683 100644 --- a/cl_dll/cs_wpn/cs_weapons.cpp +++ b/cl_dll/cs_wpn/cs_weapons.cpp @@ -392,7 +392,10 @@ bool CBasePlayerWeapon::ShieldSecondaryFire(int up_anim, int down_anim) return true; } -void CBasePlayerWeapon::KickBack(float up_base, float lateral_base, float up_modifier, float lateral_modifier, float up_max, float lateral_max, int direction_change){} +void CBasePlayerWeapon::KickBack(float up_base, float lateral_base, float up_modifier, float lateral_modifier, float up_max, float lateral_max, int direction_change) +{ + +} void CBasePlayerWeapon::SetPlayerShieldAnim(void) { @@ -498,8 +501,7 @@ Animate weapon model void CBasePlayerWeapon::SendWeaponAnim( int iAnim, int skiplocal ) { m_pPlayer->pev->weaponanim = iAnim; - - HUD_SendWeaponAnim( iAnim, m_iId, m_pPlayer->pev->body, 0 ); + HUD_SendWeaponAnim( iAnim, m_iId, 0, 0 ); } Vector CBaseEntity::FireBullets3 ( Vector vecSrc, Vector vecDirShooting, float flSpread, float flDistance, int iPenetration, int iBulletType, int iDamage, float flRangeModifier, entvars_t *pevAttacker, bool bPistol, int shared_rand ) diff --git a/cl_dll/hud/hud.cpp b/cl_dll/hud/hud.cpp index 70fe3cb..8079b7d 100644 --- a/cl_dll/hud/hud.cpp +++ b/cl_dll/hud/hud.cpp @@ -55,8 +55,6 @@ const char *sPlayerModelFiles[12] = "models/player/militia/militia.mdl" // t }; -void ShutdownInput (void); - #define GHUD_DECLARE_MESSAGE(x) int __MsgFunc_##x(const char *pszName, int iSize, void *pbuf ) { return gHUD.MsgFunc_##x(pszName, iSize, pbuf); } GHUD_DECLARE_MESSAGE(Logo) @@ -215,10 +213,6 @@ CHud :: ~CHud() delete pList; } m_pHudList = NULL; - - //Localize_Free(); - - //ServersShutdown(); } void CHud :: VidInit( void ) @@ -343,6 +337,14 @@ void CHud :: VidInit( void ) m_SpectatorGui.VidInit(); } +void CHud::Shutdown( void ) +{ + for( HUDLIST *pList = m_pHudList; pList; pList = m_pHudList->pNext ) + { + pList->p->Shutdown(); + } +} + int CHud::MsgFunc_Logo(const char *pszName, int iSize, void *pbuf) { BufferReader reader( pszName, pbuf, iSize ); diff --git a/cl_dll/hud/hud_msg.cpp b/cl_dll/hud/hud_msg.cpp index 295e3f0..19c3fa4 100644 --- a/cl_dll/hud/hud_msg.cpp +++ b/cl_dll/hud/hud_msg.cpp @@ -119,7 +119,7 @@ int CHud :: MsgFunc_Concuss( const char *pszName, int iSize, void *pbuf ) int CHud::MsgFunc_BombDrop(const char *pszName, int iSize, void *pbuf) { - BufferReader reader(pbuf, iSize); + BufferReader reader( pszName, pbuf, iSize ); g_PlayerExtraInfo[33].origin.x = reader.ReadCoord(); g_PlayerExtraInfo[33].origin.y = reader.ReadCoord(); @@ -156,7 +156,7 @@ int CHud::MsgFunc_BombPickup(const char *pszName, int iSize, void *pbuf) int CHud::MsgFunc_HostagePos(const char *pszName, int iSize, void *pbuf) { - BufferReader reader(pbuf, iSize); + BufferReader reader( pszName, pbuf, iSize ); int Flag = reader.ReadByte(); int idx = reader.ReadByte(); if ( idx <= MAX_HOSTAGES ) @@ -179,7 +179,7 @@ int CHud::MsgFunc_HostagePos(const char *pszName, int iSize, void *pbuf) int CHud::MsgFunc_HostageK(const char *pszName, int iSize, void *pbuf) { - BufferReader reader(pbuf, iSize); + BufferReader reader( pszName, pbuf, iSize ); int idx = reader.ReadByte(); if ( idx <= MAX_HOSTAGES ) { @@ -193,7 +193,7 @@ int CHud::MsgFunc_HostageK(const char *pszName, int iSize, void *pbuf) int CHud::MsgFunc_ShadowIdx(const char *pszName, int iSize, void *pbuf) { - BufferReader reader(pbuf, iSize); + BufferReader reader( pszName, pbuf, iSize ); int idx = reader.ReadByte(); g_StudioRenderer.StudioSetShadowSprite(idx); diff --git a/cl_dll/hud/menu.cpp b/cl_dll/hud/menu.cpp index 72978a5..a28d484 100644 --- a/cl_dll/hud/menu.cpp +++ b/cl_dll/hud/menu.cpp @@ -241,7 +241,7 @@ int CHudMenu :: MsgFunc_ShowMenu( const char *pszName, int iSize, void *pbuf ) int CHudMenu::MsgFunc_VGUIMenu( const char *pszName, int iSize, void *pbuf ) { - BufferReader reader(pbuf, iSize); + BufferReader reader( pszName, pbuf, iSize ); int menuType = reader.ReadByte(); m_bitsValidSlots = reader.ReadShort(); // is ignored diff --git a/cl_dll/hud/message.cpp b/cl_dll/hud/message.cpp index d255275..ea10851 100644 --- a/cl_dll/hud/message.cpp +++ b/cl_dll/hud/message.cpp @@ -565,10 +565,10 @@ void CHudMessage::MessageAdd(client_textmessage_t * newMessage ) int CHudMessage::MsgFunc_HudTextPro( const char *pszName, int iSize, void *pbuf ) { const char *sz; - //int hint; - BufferReader reader(pbuf, iSize); + int hint; + BufferReader reader( pszName, pbuf, iSize ); sz = reader.ReadString(); - //hint = reader.ReadByte(); + hint = reader.ReadByte(); MessageAdd(sz, gHUD.m_flTime/*, hint, Newfont*/); // TODO diff --git a/cl_dll/hud/money.cpp b/cl_dll/hud/money.cpp index fd74ed5..a84b70c 100644 --- a/cl_dll/hud/money.cpp +++ b/cl_dll/hud/money.cpp @@ -147,7 +147,7 @@ int CHudMoney::Draw(float flTime) int CHudMoney::MsgFunc_Money(const char *pszName, int iSize, void *pbuf) { - BufferReader buf( pbuf, iSize ); + BufferReader buf( pszName, pbuf, iSize ); int iOldCount = m_iMoneyCount; m_iMoneyCount = buf.ReadLong(); m_iDelta = m_iMoneyCount - iOldCount; @@ -158,7 +158,7 @@ int CHudMoney::MsgFunc_Money(const char *pszName, int iSize, void *pbuf) int CHudMoney::MsgFunc_BlinkAcct(const char *pszName, int iSize, void *pbuf) { - BufferReader buf( pbuf, iSize ); + BufferReader buf( pszName, pbuf, iSize ); m_iBlinkAmt = buf.ReadByte(); m_fBlinkTime = 0; diff --git a/cl_dll/hud/nvg.cpp b/cl_dll/hud/nvg.cpp index 12e83f6..e4dc3a3 100644 --- a/cl_dll/hud/nvg.cpp +++ b/cl_dll/hud/nvg.cpp @@ -73,7 +73,7 @@ int CHudNVG::Draw(float flTime) int CHudNVG::MsgFunc_NVGToggle(const char *pszName, int iSize, void *pbuf) { - BufferReader reader(pbuf, iSize); + BufferReader reader( pszName, pbuf, iSize ); m_iEnable = reader.ReadByte(); return 1; diff --git a/cl_dll/hud/radar.cpp b/cl_dll/hud/radar.cpp index 180bde0..ca2cbf6 100644 --- a/cl_dll/hud/radar.cpp +++ b/cl_dll/hud/radar.cpp @@ -31,7 +31,7 @@ version. #include "cl_util.h" #include "parsemsg.h" #include "draw_util.h" - +#include "triangleapi.h" #ifndef M_PI #define M_PI 3.14159265358979323846 // matches value in gcc v2 math.h #endif @@ -41,6 +41,46 @@ DECLARE_COMMAND( m_Radar, HideRadar ) DECLARE_MESSAGE( m_Radar, Radar ) +static byte r_RadarCross[8][8] = +{ +{1,1,0,0,0,0,1,1}, +{1,1,1,0,0,1,1,1}, +{0,1,1,1,1,1,1,0}, +{0,0,1,1,1,1,0,0}, +{0,0,1,1,1,1,0,0}, +{0,1,1,1,1,1,1,0}, +{1,1,1,0,0,1,1,1}, +{1,1,0,0,0,0,1,1} +}; + +static byte r_RadarT[8][8] = +{ +{1,1,1,1,1,1,1,1}, +{1,1,1,1,1,1,1,1}, +{0,0,0,1,1,0,0,0}, +{0,0,0,1,1,0,0,0}, +{0,0,0,1,1,0,0,0}, +{0,0,0,1,1,0,0,0}, +{0,0,0,1,1,0,0,0}, +{0,0,0,1,1,0,0,0} +}; + +static byte r_RadarFlippedT[8][8] = +{ +{0,0,0,1,1,0,0,0}, +{0,0,0,1,1,0,0,0}, +{0,0,0,1,1,0,0,0}, +{0,0,0,1,1,0,0,0}, +{0,0,0,1,1,0,0,0}, +{0,0,0,1,1,0,0,0}, +{1,1,1,1,1,1,1,1}, +{1,1,1,1,1,1,1,1} +}; + +#define BLOCK_SIZE_MAX 1024 + +static byte data2D[BLOCK_SIZE_MAX*BLOCK_SIZE_MAX*4]; // intermediate texbuffer + int CHudRadar::Init() { HOOK_MESSAGE( Radar ); @@ -51,6 +91,8 @@ int CHudRadar::Init() cl_radartype = CVAR_CREATE( "cl_radartype", "0", FCVAR_ARCHIVE ); + bTexturesInitialized = bUseRenderAPI = false; + gHUD.AddHudElem( this ); return 1; } @@ -66,8 +108,82 @@ void CHudRadar::Reset() } } +static void Radar_InitBitmap( int w, int h, byte *buf ) +{ + for( int x = 0; x < w; x++ ) + { + for( int y = 0; y < h; y++ ) + { + data2D[(y * 8 + x) * 4 + 0] = 255; + data2D[(y * 8 + x) * 4 + 1] = 255; + data2D[(y * 8 + x) * 4 + 2] = 255; + data2D[(y * 8 + x) * 4 + 3] = buf[y*h + x] * 255; + } + } +} + +int CHudRadar::InitBuiltinTextures( void ) +{ + texFlags_t defFlags = (texFlags_t)(TF_NOMIPMAP | TF_NOPICMIP | TF_NEAREST | TF_CLAMP | TF_HAS_ALPHA); + + if( bTexturesInitialized ) + return 1; + + const struct + { + const char *name; + byte *buf; + int *texnum; + int w, h; + void (*init)( int w, int h, byte *buf ); + int texType; + } + textures[] = + { + { "radarT", (byte*)r_RadarT, &hT, 8, 8, Radar_InitBitmap, TEX_CUSTOM }, + { "radarcross", (byte*)r_RadarCross, &hCross, 8, 8, Radar_InitBitmap, TEX_CUSTOM }, + { "radarflippedT", (byte*)r_RadarFlippedT, &hFlippedT, 8, 8, Radar_InitBitmap, TEX_CUSTOM } + }; + size_t i, num_builtin_textures = sizeof( textures ) / sizeof( textures[0] ); + + for( i = 0; i < num_builtin_textures; i++ ) + { + textures[i].init( textures[i].w, textures[i].h, textures[i].buf ); + *textures[i].texnum = gRenderAPI.GL_CreateTexture( textures[i].name, textures[i].w, textures[i].h, data2D, defFlags ); + if( *textures[i].texnum == 0 ) + { + for( size_t j = 0; j < i; i++ ) + { + gRenderAPI.GL_FreeTexture( *textures[i].texnum ); + } + return 0; + } + + gRenderAPI.GL_SetTextureType( *textures[i].texnum, textures[i].texType ); + } + + hDot = gRenderAPI.GL_LoadTexture( "*white", NULL, 0, 0 ); + + bTexturesInitialized = true; + + return 1; +} + +void CHudRadar::Shutdown( void ) +{ + // GL_FreeTexture( hDot ); engine inner texture + if( bTexturesInitialized ) + { + gRenderAPI.GL_FreeTexture( hT ); + gRenderAPI.GL_FreeTexture( hFlippedT ); + gRenderAPI.GL_FreeTexture( hCross ); + } +} + int CHudRadar::VidInit(void) { + bUseRenderAPI = g_iXash && InitBuiltinTextures(); + m_hRadar.SetSpriteByName( "radar" ); m_hRadarOpaque.SetSpriteByName( "radaropaque" ); return 1; @@ -116,6 +232,14 @@ int CHudRadar::Draw(float flTime) SPR_DrawAdditive( 0, 0, 0, &m_hRadarOpaque.rect ); } + if( bUseRenderAPI ) + { + gEngfuncs.pTriAPI->RenderMode( kRenderTransAdd ); + gEngfuncs.pTriAPI->CullFace( TRI_NONE ); + gEngfuncs.pTriAPI->Brightness( 1 ); + gRenderAPI.GL_SelectTexture( 0 ); + } + for(int i = 0; i < 33; i++) { // skip local player and dead players @@ -255,29 +379,68 @@ void CHudRadar::DrawPlayerLocation() void CHudRadar::DrawRadarDot(int x, int y, int size, int r, int g, int b, int a) { - FillRGBA(62.5f + x - size/2.0f, 62.5f + y - size/2.0f, size, size, r, g, b, a); + if( bUseRenderAPI ) + { + gRenderAPI.GL_Bind( 0, hDot ); + gEngfuncs.pTriAPI->Color4ub( r, g, b, a ); + DrawUtils::Draw2DQuad( 62.5f + x - size/2, 62.5f + y - size/2, + 62.5f + x + size/2, 62.5f + y + size/2); + } + else + { + FillRGBA(62.5f + x - size/2.0f, 62.5f + y - size/2.0f, size, size, r, g, b, a); + } } void CHudRadar::DrawCross(int x, int y, int size, int r, int g, int b, int a) { - FillRGBA(62.5f + x, 62.5f + y, size, size, r, g, b, a); - FillRGBA(62.5f + x - size, 62.5f + y - size, size, size, r, g, b, a); - FillRGBA(62.5f + x - size, 62.5f + y + size, size, size, r, g, b, a); - FillRGBA(62.5f + x + size, 62.5f + y - size, size, size, r, g, b, a); - FillRGBA(62.5f + x + size, 62.5f + y + size, size, size, r, g, b, a); - + if( bUseRenderAPI ) + { + gRenderAPI.GL_Bind( 0, hCross ); + gEngfuncs.pTriAPI->Color4ub( r, g, b, a ); + DrawUtils::Draw2DQuad( 62.5f + x - size*2, 62.5f + y - size*2, + 62.5f + x + size*2, 62.5f + y + size*2); + } + else + { + FillRGBA(62.5f + x, 62.5f + y, size, size, r, g, b, a); + FillRGBA(62.5f + x - size, 62.5f + y - size, size, size, r, g, b, a); + FillRGBA(62.5f + x - size, 62.5f + y + size, size, size, r, g, b, a); + FillRGBA(62.5f + x + size, 62.5f + y - size, size, size, r, g, b, a); + FillRGBA(62.5f + x + size, 62.5f + y + size, size, size, r, g, b, a); + } } void CHudRadar::DrawT(int x, int y, int size, int r, int g, int b, int a) { - FillRGBA( 62.5f + x - size, 62.5 + y - size, 3*size, size, r, g, b, a); - FillRGBA( 62.5f + x, 62.5 + y, size, 2*size, r, g, b, a); + if( bUseRenderAPI ) + { + gRenderAPI.GL_Bind( 0, hT ); + gEngfuncs.pTriAPI->Color4ub( r, g, b, a ); + DrawUtils::Draw2DQuad( 62.5f + x - size*2, 62.5f + y - size*2, + 62.5f + x + size*2, 62.5f + y + size*2); + } + else + { + FillRGBA( 62.5f + x - size, 62.5 + y - size, 3*size, size, r, g, b, a); + FillRGBA( 62.5f + x, 62.5 + y, size, 2*size, r, g, b, a); + } } void CHudRadar::DrawFlippedT(int x, int y, int size, int r, int g, int b, int a) { - FillRGBA( 62.5f + x, 62.5 + y - size, size, 2*size, r, g, b, a); - FillRGBA( 62.5f + x - size, 62.5 + y + size, 3*size, size, r, g, b, a); + if( bUseRenderAPI ) + { + gRenderAPI.GL_Bind( 0, hFlippedT ); + gEngfuncs.pTriAPI->Color4ub( r, g, b, a ); + DrawUtils::Draw2DQuad( 62.5f + x - size*2, 62.5f + y - size*2, + 62.5f + x + size*2, 62.5f + y + size*2); + } + else + { + FillRGBA( 62.5f + x, 62.5 + y - size, size, 2*size, r, g, b, a); + FillRGBA( 62.5f + x - size, 62.5 + y + size, 3*size, size, r, g, b, a); + } } Vector CHudRadar::WorldToRadar(const Vector vPlayerOrigin, const Vector vObjectOrigin, const Vector vAngles ) diff --git a/cl_dll/hud/radio.cpp b/cl_dll/hud/radio.cpp index 578cde2..0a88656 100644 --- a/cl_dll/hud/radio.cpp +++ b/cl_dll/hud/radio.cpp @@ -100,7 +100,7 @@ void VoiceIconCallback(struct tempent_s *ent, float frametime, float currenttime int CHudRadio::MsgFunc_BotVoice( const char *pszName, int iSize, void *buf ) { - BufferReader reader( buf, iSize ); + BufferReader reader( pszName, buf, iSize ); int enable = reader.ReadByte(); int entIndex = reader.ReadByte(); diff --git a/cl_dll/hud/saytext.cpp b/cl_dll/hud/saytext.cpp index 23e41ab..c474eb6 100644 --- a/cl_dll/hud/saytext.cpp +++ b/cl_dll/hud/saytext.cpp @@ -81,7 +81,6 @@ int CHudSayText :: VidInit( void ) int ScrollTextUp( void ) { - ConsolePrint( g_szLineBuffer[0] ); // move the first line into the console buffer g_szLineBuffer[MAX_LINES][0] = 0; memmove( g_szLineBuffer[0], g_szLineBuffer[1], sizeof(g_szLineBuffer) - sizeof(g_szLineBuffer[0]) ); // overwrite the first line memmove( &g_pflNameColors[0], &g_pflNameColors[1], sizeof(g_pflNameColors) - sizeof(g_pflNameColors[0]) ); diff --git a/cl_dll/hud/sniperscope.cpp b/cl_dll/hud/sniperscope.cpp index 293d919..efdd977 100644 --- a/cl_dll/hud/sniperscope.cpp +++ b/cl_dll/hud/sniperscope.cpp @@ -101,3 +101,9 @@ int CHudSniperScope::Draw(float flTime) return 0; } + +void CHudSniperScope::Shutdown() +{ + for( int i = 0; i < 4; i++ ) + gRenderAPI.GL_FreeTexture( m_iScopeArc[i] ); +} diff --git a/cl_dll/hud/spectator_gui.cpp b/cl_dll/hud/spectator_gui.cpp index 380f141..6d77dd6 100644 --- a/cl_dll/hud/spectator_gui.cpp +++ b/cl_dll/hud/spectator_gui.cpp @@ -123,6 +123,11 @@ int CHudSpectatorGui::VidInit() return 1; } +void CHudSpectatorGui::Shutdown() +{ + gRenderAPI.GL_FreeTexture( m_hTimerTexture ); +} + inline void DrawButtonWithText( int x1, int y1, int wide, int tall, const char *sz, int r, int g, int b ) { DrawUtils::DrawRectangle(x1, y1, wide, tall); @@ -327,7 +332,7 @@ void CHudSpectatorGui::Reset() int CHudSpectatorGui::MsgFunc_SpecHealth(const char *pszName, int iSize, void *buf) { - BufferReader reader( buf, iSize ); + BufferReader reader( pszName, buf, iSize ); int health = reader.ReadByte(); @@ -339,7 +344,7 @@ int CHudSpectatorGui::MsgFunc_SpecHealth(const char *pszName, int iSize, void *b int CHudSpectatorGui::MsgFunc_SpecHealth2(const char *pszName, int iSize, void *buf) { - BufferReader reader( buf, iSize ); + BufferReader reader( pszName, buf, iSize ); int health = reader.ReadByte(); int client = reader.ReadByte(); diff --git a/cl_dll/hud/timer.cpp b/cl_dll/hud/timer.cpp index 1b24542..bb455c1 100644 --- a/cl_dll/hud/timer.cpp +++ b/cl_dll/hud/timer.cpp @@ -203,7 +203,7 @@ int CHudProgressBar::MsgFunc_BarTime2(const char *pszName, int iSize, void *pbuf BufferReader reader( pszName, pbuf, iSize ); m_iDuration = reader.ReadShort(); - m_fPercent = (float)reader.ReadShort() / 100.0f; + m_fPercent = m_iDuration * (float)reader.ReadShort() / 100.0f; m_fStartTime = gHUD.m_flTime; diff --git a/cl_dll/include/hud/hud.h b/cl_dll/include/hud/hud.h index bbfd709..cac6ae4 100644 --- a/cl_dll/include/hud/hud.h +++ b/cl_dll/include/hud/hud.h @@ -99,6 +99,7 @@ public: virtual void Think(void) {return;} virtual void Reset(void) {return;} virtual void InitHUDData( void ) {} // called every time a server is connected to + virtual void Shutdown( void ) {} }; @@ -758,6 +759,7 @@ public: int Init( void ); int VidInit( void ); int Draw( float flTime ); + void Shutdown( void ); private: float left, right, centerx, centery; @@ -796,6 +798,8 @@ public: int Draw( float flTime ); void InitHUDData(); void Reset(); + void Shutdown(); + CHudMsgFunc( SpecHealth ); CHudMsgFunc( SpecHealth2 ); @@ -846,7 +850,8 @@ public: void Init( void ); void VidInit( void ); - void Think(void); + void Think( void ); + void Shutdown( void ); int Redraw( float flTime, int intermission ); int UpdateClientData( client_data_t *cdata, float time ); void AddHudElem(CHudBase *p); @@ -891,6 +896,11 @@ public: return m_scrinfo.iCharHeight; } + inline bool IsCZero( ) + { + return m_bIsCZero; + } + float m_flTime; // the current client time float m_fOldTime; // the time at which the HUD was last redrawn @@ -992,6 +1002,7 @@ private: int m_iForceCamera; int m_iForceChaseCam; int m_iFadeToBlack; + bool m_bIsCZero; // the memory for these arrays are allocated in the first call to CHud::VidInit(), when the hud.txt and associated sprites are loaded. // freed in ~CHud() diff --git a/cl_dll/include/hud/radar.h b/cl_dll/include/hud/radar.h index 07dd924..2a8ff39 100644 --- a/cl_dll/include/hud/radar.h +++ b/cl_dll/include/hud/radar.h @@ -15,6 +15,7 @@ public: virtual int VidInit(); virtual int Draw( float flTime ); virtual void Reset(); + virtual void Shutdown(); int MsgFunc_Radar(const char *pszName, int iSize, void *pbuf); @@ -27,6 +28,7 @@ private: cvar_t *cl_radartype; + int InitBuiltinTextures(); void DrawPlayerLocation(); void DrawRadarDot(int x, int y, int size, int r, int g, int b, int a); void DrawCross(int x, int y, int size, int r, int g, int b, int a ); @@ -34,6 +36,8 @@ private: void DrawFlippedT( int x, int y, int size, int r, int g, int b, int a ); Vector WorldToRadar(const Vector vPlayerOrigin, const Vector vObjectOrigin, const Vector vAngles ); + bool bUseRenderAPI, bTexturesInitialized; + int hDot, hCross, hT, hFlippedT; }; #endif // RADAR_H diff --git a/cl_dll/input.cpp b/cl_dll/input.cpp index 95bad2f..cb4e3f6 100644 --- a/cl_dll/input.cpp +++ b/cl_dll/input.cpp @@ -984,17 +984,11 @@ void InitInput (void) /* ============ -ShutdownInput +Input_Shutdown ============ */ -void ShutdownInput (void) +void Input_Shutdown (void) { IN_Shutdown(); KB_Shutdown(); } - -void DLLEXPORT HUD_Shutdown( void ) -{ - ShutdownInput(); - Localize_Free(); -} diff --git a/cl_dll/rain.cpp b/cl_dll/rain.cpp index 3a073b4..2895f7c 100644 --- a/cl_dll/rain.cpp +++ b/cl_dll/rain.cpp @@ -452,7 +452,7 @@ void SetPoint( float x, float y, float z, float (*matrix)[4]) int CHud::MsgFunc_ReceiveW(const char *pszName, int iSize, void *pbuf) { - BufferReader reader(pbuf, iSize); + BufferReader reader( pszName, pbuf, iSize); int iWeatherType = reader.ReadByte(); diff --git a/cl_dll/studio/studio_util.cpp b/cl_dll/studio/studio_util.cpp index 38c752e..0a0b52f 100644 --- a/cl_dll/studio/studio_util.cpp +++ b/cl_dll/studio/studio_util.cpp @@ -148,30 +148,18 @@ ConcatTransforms */ void ConcatTransforms (float in1[3][4], float in2[3][4], float out[3][4]) { - out[0][0] = in1[0][0] * in2[0][0] + in1[0][1] * in2[1][0] + - in1[0][2] * in2[2][0]; - out[0][1] = in1[0][0] * in2[0][1] + in1[0][1] * in2[1][1] + - in1[0][2] * in2[2][1]; - out[0][2] = in1[0][0] * in2[0][2] + in1[0][1] * in2[1][2] + - in1[0][2] * in2[2][2]; - out[0][3] = in1[0][0] * in2[0][3] + in1[0][1] * in2[1][3] + - in1[0][2] * in2[2][3] + in1[0][3]; - out[1][0] = in1[1][0] * in2[0][0] + in1[1][1] * in2[1][0] + - in1[1][2] * in2[2][0]; - out[1][1] = in1[1][0] * in2[0][1] + in1[1][1] * in2[1][1] + - in1[1][2] * in2[2][1]; - out[1][2] = in1[1][0] * in2[0][2] + in1[1][1] * in2[1][2] + - in1[1][2] * in2[2][2]; - out[1][3] = in1[1][0] * in2[0][3] + in1[1][1] * in2[1][3] + - in1[1][2] * in2[2][3] + in1[1][3]; - out[2][0] = in1[2][0] * in2[0][0] + in1[2][1] * in2[1][0] + - in1[2][2] * in2[2][0]; - out[2][1] = in1[2][0] * in2[0][1] + in1[2][1] * in2[1][1] + - in1[2][2] * in2[2][1]; - out[2][2] = in1[2][0] * in2[0][2] + in1[2][1] * in2[1][2] + - in1[2][2] * in2[2][2]; - out[2][3] = in1[2][0] * in2[0][3] + in1[2][1] * in2[1][3] + - in1[2][2] * in2[2][3] + in1[2][3]; + out[0][0] = in1[0][0] * in2[0][0] + in1[0][1] * in2[1][0] + in1[0][2] * in2[2][0]; + out[0][1] = in1[0][0] * in2[0][1] + in1[0][1] * in2[1][1] + in1[0][2] * in2[2][1]; + out[0][2] = in1[0][0] * in2[0][2] + in1[0][1] * in2[1][2] + in1[0][2] * in2[2][2]; + out[0][3] = in1[0][0] * in2[0][3] + in1[0][1] * in2[1][3] + in1[0][2] * in2[2][3] + in1[0][3]; + out[1][0] = in1[1][0] * in2[0][0] + in1[1][1] * in2[1][0] + in1[1][2] * in2[2][0]; + out[1][1] = in1[1][0] * in2[0][1] + in1[1][1] * in2[1][1] + in1[1][2] * in2[2][1]; + out[1][2] = in1[1][0] * in2[0][2] + in1[1][1] * in2[1][2] + in1[1][2] * in2[2][2]; + out[1][3] = in1[1][0] * in2[0][3] + in1[1][1] * in2[1][3] + in1[1][2] * in2[2][3] + in1[1][3]; + out[2][0] = in1[2][0] * in2[0][0] + in1[2][1] * in2[1][0] + in1[2][2] * in2[2][0]; + out[2][1] = in1[2][0] * in2[0][1] + in1[2][1] * in2[1][1] + in1[2][2] * in2[2][1]; + out[2][2] = in1[2][0] * in2[0][2] + in1[2][1] * in2[1][2] + in1[2][2] * in2[2][2]; + out[2][3] = in1[2][0] * in2[0][3] + in1[2][1] * in2[1][3] + in1[2][2] * in2[2][3] + in1[2][3]; } // angles index are not the same as ROLL, PITCH, YAW @@ -207,10 +195,10 @@ void AngleQuaternion( float *angles, vec4_t quaternion ) cr = cos(angle); #endif - quaternion[0] = sr*cp*cy-cr*sp*sy; // X - quaternion[1] = cr*sp*cy+sr*cp*sy; // Y - quaternion[2] = cr*cp*sy-sr*sp*cy; // Z - quaternion[3] = cr*cp*cy+sr*sp*sy; // W + quaternion[0] = sr * cp * cy - cr * sp * sy; // X + quaternion[1] = cr * sp * cy + sr * cp * sy; // Y + quaternion[2] = cr * cp * sy - sr * sp * cy; // Z + quaternion[3] = cr * cp * cy + sr * sp * sy; // W } /*