Update HUD

This commit is contained in:
a1batross 2016-04-16 22:02:14 +03:00
parent 9c57e05b5a
commit c80a612417
3 changed files with 35 additions and 13 deletions

View File

@ -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,9 +113,9 @@ 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 );
@ -125,8 +123,6 @@ void CHud :: Init( void )
m_pCvarDraw = CVAR_CREATE( "hud_draw", "1", 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

View File

@ -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[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);

View File

@ -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 );