From c80a6124178b21b4be5668c779bc1bba10f934bd Mon Sep 17 00:00:00 2001 From: a1batross Date: Sat, 16 Apr 2016 22:02:14 +0300 Subject: [PATCH] Update HUD --- cl_dll/hud/hud.cpp | 31 ++++++++++++++++++++++--------- cl_dll/hud/sniperscope.cpp | 12 ++++++++++-- cl_dll/hud/spectator_gui.cpp | 5 +++-- 3 files changed, 35 insertions(+), 13 deletions(-) diff --git a/cl_dll/hud/hud.cpp b/cl_dll/hud/hud.cpp index a8763b5..98c3b40 100644 --- a/cl_dll/hud/hud.cpp +++ b/cl_dll/hud/hud.cpp @@ -77,19 +77,17 @@ GHUD_DECLARE_MESSAGE(BombPickup) GHUD_DECLARE_MESSAGE(HostagePos) GHUD_DECLARE_MESSAGE(ShadowIdx) -#ifdef _CS16CLIENT_ALLOW_SPECIAL_SCRIPTING void __CmdFunc_InputCommandSpecial() { +#ifdef _CS16CLIENT_ALLOW_SPECIAL_SCRIPTING gEngfuncs.pfnClientCmd("_special"); -} #endif +} // This is called every time the DLL is loaded void CHud :: Init( void ) { -#ifdef _CS16CLIENT_ALLOW_SPECIAL_SCRIPTING HOOK_COMMAND( "special", InputCommandSpecial ); -#endif HOOK_MESSAGE( Logo ); HOOK_MESSAGE( ResetHUD ); @@ -115,17 +113,15 @@ void CHud :: Init( void ) hud_textmode = CVAR_CREATE( "hud_textmode", "0", FCVAR_ARCHIVE ); cl_righthand = CVAR_CREATE( "hand", "1", FCVAR_ARCHIVE ); cl_weather = CVAR_CREATE( "cl_weather", "1", FCVAR_ARCHIVE ); - cl_minmodels = CVAR_CREATE( "cl_minmodels", "1", FCVAR_ARCHIVE ); + cl_minmodels = CVAR_CREATE( "cl_minmodels", "0", FCVAR_ARCHIVE ); cl_min_t = CVAR_CREATE( "cl_min_t", "1", FCVAR_ARCHIVE ); - cl_min_ct = CVAR_CREATE( "cl_min_ct", "1", FCVAR_ARCHIVE ); + cl_min_ct = CVAR_CREATE( "cl_min_ct", "2", FCVAR_ARCHIVE ); cl_lw = gEngfuncs.pfnGetCvarPointer( "cl_lw" ); cl_shadows = CVAR_CREATE( "cl_shadows", "1", FCVAR_ARCHIVE ); default_fov = CVAR_CREATE( "default_fov", "90", 0 ); m_pCvarStealMouse = CVAR_CREATE( "hud_capturemouse", "1", FCVAR_ARCHIVE ); m_pCvarDraw = CVAR_CREATE( "hud_draw", "1", FCVAR_ARCHIVE ); - fastsprites = CVAR_CREATE( "fastsprites", "0", FCVAR_ARCHIVE ); - - + fastsprites = CVAR_CREATE( "fastsprites", "0", FCVAR_ARCHIVE ); m_iLogo = 0; m_iFOV = 0; @@ -189,6 +185,22 @@ void CHud :: Init( void ) //ServersInit(); + gEngfuncs.Cvar_SetValue( "hand", 1 ); + gEngfuncs.Cvar_SetValue( "sv_skipshield", 1.0f ); +#ifdef __ANDROID__ + gEngfuncs.Cvar_SetValue( "hud_fastswitch", 1 ); +#endif + + if( g_iMobileAPIVersion ) + { + static byte color[] = {255, 255, 255, 255}; + gMobileAPI.pfnTouchResetDefaultButtons(); + gMobileAPI.pfnTouchAddDefaultButton("_settings", "touch_defaults/settings.tga", "menu_touchoptions", + 0.4, 0.4, 0.6, 0.6, color, 0, 1.0f, TOUCH_FL_NOEDIT | TOUCH_FL_DEF_SHOW ); + gEngfuncs.pfnClientCmd("alias touch_loaddefaults menu_touchoptions"); + } + + MsgFunc_ResetHUD(0, 0, NULL ); } @@ -272,6 +284,7 @@ void CHud :: VidInit( void ) gEngfuncs.Cvar_SetValue("hud_scale", 1.0f ); } GetScreenInfo(&m_scrinfo); + m_iRes = 640; // Only load this once diff --git a/cl_dll/hud/sniperscope.cpp b/cl_dll/hud/sniperscope.cpp index 8a14a80..158cf06 100644 --- a/cl_dll/hud/sniperscope.cpp +++ b/cl_dll/hud/sniperscope.cpp @@ -45,14 +45,20 @@ int CHudSniperScope::VidInit() { if( g_iXash == 0 ) { - ConsolePrint("^3No Xash Found Warning^7: CHudSniperScope is disabled! "); + ConsolePrint("^3No Xash Found Warning^7: CHudSniperScope is disabled!\n"); m_iFlags = 0; return 0; } + m_iScopeArc[0] = gRenderAPI.GL_LoadTexture("sprites/scope_arc_nw.tga", NULL, 0, TF_NEAREST |TF_NOPICMIP|TF_NOMIPMAP|TF_CLAMP); m_iScopeArc[1] = gRenderAPI.GL_LoadTexture("sprites/scope_arc_ne.tga", NULL, 0, TF_NEAREST |TF_NOPICMIP|TF_NOMIPMAP|TF_CLAMP); - m_iScopeArc[2] = gRenderAPI.GL_LoadTexture("sprites/scope_arc.tga", NULL, 0, TF_NEAREST |TF_NOPICMIP|TF_NOMIPMAP|TF_CLAMP); + m_iScopeArc[2] = gRenderAPI.GL_LoadTexture("sprites/scope_arc.tga", NULL, 0, TF_NEAREST |TF_NOPICMIP|TF_NOMIPMAP|TF_CLAMP); m_iScopeArc[3] = gRenderAPI.GL_LoadTexture("sprites/scope_arc_sw.tga", NULL, 0, TF_NEAREST |TF_NOPICMIP|TF_NOMIPMAP|TF_CLAMP); + + if( !m_iScopeArc[0] || !m_iScopeArc[1] || !m_iScopeArc[2] || !m_iScopeArc[3] ) + { + gRenderAPI.Host_Error( "^3Error^7: Cannot load Sniper Scope arcs. Check sprites/scope_arc*.tga files\n" ); + } left = (TrueWidth - TrueHeight)/2; right = left + TrueHeight; centerx = TrueWidth/2; @@ -69,6 +75,8 @@ int CHudSniperScope::Draw(float flTime) gEngfuncs.pTriAPI->Color4ub(0, 0, 0, 255); gEngfuncs.pTriAPI->CullFace(TRI_NONE); + gRenderAPI.GL_SelectTexture(0); + gRenderAPI.GL_Bind(0, m_iScopeArc[0]); DrawUtils::Draw2DQuad(left, 0, centerx, centery); diff --git a/cl_dll/hud/spectator_gui.cpp b/cl_dll/hud/spectator_gui.cpp index fb6920c..22e9594 100644 --- a/cl_dll/hud/spectator_gui.cpp +++ b/cl_dll/hud/spectator_gui.cpp @@ -117,7 +117,7 @@ int CHudSpectatorGui::VidInit() m_fTextScale = ScreenWidth / 1024.0f; if( m_fTextScale < 1.0f ) m_fTextScale = 1.0f; - m_hTimerTexture = gRenderAPI.GL_LoadTexture("gfx/vgui/timer.tga", NULL, 0, 0 ); + m_hTimerTexture = gRenderAPI.GL_LoadTexture("gfx/vgui/timer.tga", NULL, 0, TF_NEAREST |TF_NOPICMIP|TF_NOMIPMAP|TF_CLAMP ); return 1; } @@ -169,7 +169,8 @@ int CHudSpectatorGui::Draw( float flTime ) { if( m_hTimerTexture ) { - gRenderAPI.GL_Bind( 0, m_hTimerTexture ); + gRenderAPI.GL_SelectTexture( 0 ); + gRenderAPI.GL_Bind(0, m_hTimerTexture); gEngfuncs.pTriAPI->RenderMode( kRenderTransAlpha ); DrawUtils::Draw2DQuad( INT_XPOS(12.5) + 10, INT_YPOS(2) * 0.5, INT_XPOS(12.5) + 10 + gHUD.GetCharHeight() * m_fTextScale, INT_YPOS(2) * 0.5 + gHUD.GetCharHeight() * m_fTextScale );