Skip to content

Commit

Permalink
game: fix touch transparency mode for cut scenes
Browse files Browse the repository at this point in the history
  • Loading branch information
nillerusr committed Aug 17, 2023
1 parent 4f10928 commit f5861bf
Showing 1 changed file with 20 additions and 20 deletions.
40 changes: 20 additions & 20 deletions game/client/touch.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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;

Expand Down Expand Up @@ -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,
Expand Down Expand Up @@ -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 )
{
Expand All @@ -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();
}
Expand All @@ -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 );
}
}

Expand Down Expand Up @@ -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 )
Expand Down

0 comments on commit f5861bf

Please sign in to comment.