From f5861bf3babe3f8b19ce0d911992fc7c0b5fd8f5 Mon Sep 17 00:00:00 2001 From: nillerusr Date: Thu, 17 Aug 2023 15:29:00 +0300 Subject: [PATCH] game: fix touch transparency mode for cut scenes --- game/client/touch.cpp | 40 ++++++++++++++++++++-------------------- 1 file changed, 20 insertions(+), 20 deletions(-) diff --git a/game/client/touch.cpp b/game/client/touch.cpp index 33a0817fa..ee6bd6073 100644 --- a/game/client/touch.cpp +++ b/game/client/touch.cpp @@ -375,6 +375,7 @@ void CTouchControls::Init() gridcolor = rgba_t(255, 0, 0, 50); m_bCutScene = false; + m_AlphaDiff = 0; showtexture = hidetexture = resettexture = closetexture = joytexture = 0; configchanged = false; @@ -577,7 +578,7 @@ void CTouchControls::ListButtons() for( it = btns.begin(); it != btns.end(); it++ ) { CTouchButton *b = *it; - + Msg( "%s %s %s %f %f %f %f %d %d %d %d %d\n", b->name, b->texturefile, b->command, b->x1, b->y1, b->x2, b->y2, @@ -625,13 +626,10 @@ void CTouchControls::Frame() C_BasePlayer *pPlayer = C_BasePlayer::GetLocalPlayer(); - if( pPlayer && (pPlayer->GetFlags() & FL_FROZEN || g_pIntroData != NULL) ) + if( !m_bCutScene && pPlayer && (pPlayer->GetFlags() & FL_FROZEN || g_pIntroData != NULL) ) { - if( !m_bCutScene ) - { - m_bCutScene = true; - m_AlphaDiff = 0; - } + m_bCutScene = true; + m_AlphaDiff = 0; } else if( !pPlayer ) { @@ -640,7 +638,10 @@ void CTouchControls::Frame() m_flHideTouch = 0; } else + { + m_AlphaDiff = 0; m_bCutScene = false; + } if( touch_enable.GetBool() && touch_draw.GetBool() && !enginevgui->IsGameUIVisible() ) Paint(); } @@ -667,20 +668,20 @@ void CTouchControls::Paint() { CTouchButton *btn = *it; - if( !(btn->flags & TOUCH_FL_NOEDIT) ) - { - if( touch_button_info.GetInt() ) - { - g_pMatSystemSurface->DrawColoredText( 2, btn->x1*screen_w, btn->y1*screen_h, 255, 255, 255, 255, "N: %s", btn->name ); // name - g_pMatSystemSurface->DrawColoredText( 2, btn->x1*screen_w, btn->y1*screen_h+10, 255, 255, 255, 255, "T: %s", btn->texturefile ); // texture - g_pMatSystemSurface->DrawColoredText( 2, btn->x1*screen_w, btn->y1*screen_h+20, 255, 255, 255, 255, "C: %s", btn->command ); // command - g_pMatSystemSurface->DrawColoredText( 2, btn->x1*screen_w, btn->y1*screen_h+30, 255, 255, 255, 255, "F: %i", btn->flags ); // flags - g_pMatSystemSurface->DrawColoredText( 2, btn->x1*screen_w, btn->y1*screen_h+40, 255, 255, 255, 255, "RGBA: %d %d %d %d", btn->color.r, btn->color.g, btn->color.b, btn->color.a );// color - } + if( btn->flags & TOUCH_FL_NOEDIT ) + continue; - vgui::surface()->DrawSetColor(gridcolor.r, gridcolor.g, gridcolor.b, gridcolor.a); // 255, 0, 0, 50 <- default here - vgui::surface()->DrawFilledRect( btn->x1*screen_w, btn->y1*screen_h, btn->x2*screen_w, btn->y2*screen_h ); + if( touch_button_info.GetInt() ) + { + g_pMatSystemSurface->DrawColoredText( 2, btn->x1*screen_w, btn->y1*screen_h, 255, 255, 255, 255, "N: %s", btn->name ); // name + g_pMatSystemSurface->DrawColoredText( 2, btn->x1*screen_w, btn->y1*screen_h+10, 255, 255, 255, 255, "T: %s", btn->texturefile ); // texture + g_pMatSystemSurface->DrawColoredText( 2, btn->x1*screen_w, btn->y1*screen_h+20, 255, 255, 255, 255, "C: %s", btn->command ); // command + g_pMatSystemSurface->DrawColoredText( 2, btn->x1*screen_w, btn->y1*screen_h+30, 255, 255, 255, 255, "F: %i", btn->flags ); // flags + g_pMatSystemSurface->DrawColoredText( 2, btn->x1*screen_w, btn->y1*screen_h+40, 255, 255, 255, 255, "RGBA: %d %d %d %d", btn->color.r, btn->color.g, btn->color.b, btn->color.a );// color } + + vgui::surface()->DrawSetColor(gridcolor.r, gridcolor.g, gridcolor.b, gridcolor.a); // 255, 0, 0, 50 <- default here + vgui::surface()->DrawFilledRect( btn->x1*screen_w, btn->y1*screen_h, btn->x2*screen_w, btn->y2*screen_h ); } } @@ -776,7 +777,6 @@ void CTouchControls::Paint() meshBuilder.End(); m_pMesh->Draw(); - if( m_flHideTouch < gpGlobals->curtime ) { if( m_bCutScene && m_AlphaDiff < 255-MIN_ALPHA_IN_CUTSCENE )