From 31de8a8b5ca552398cb2cba3d35371c65eb3c10f Mon Sep 17 00:00:00 2001 From: mittorn Date: Wed, 7 Nov 2018 16:21:06 +0700 Subject: [PATCH] Automatic changelevel confirmation without touching trigger again --- dlls/coop.cpp | 12 ++++++++++++ dlls/gravgunmod.h | 1 + 2 files changed, 13 insertions(+) diff --git a/dlls/coop.cpp b/dlls/coop.cpp index 6b946647..22879bfd 100644 --- a/dlls/coop.cpp +++ b/dlls/coop.cpp @@ -863,6 +863,7 @@ bool COOP_ConfirmMenu(CBaseEntity *pTrigger, CBaseEntity *pActivator, int count2 pPlayer->m_ggm.iLocalConfirm = 1; if( pPlayer->m_ggm.iLocalConfirm < 3 ) { + pPlayer->m_ggm.pChangeLevel = pTrigger->edict(); pPlayer->m_ggm.menu.New("This will change map back", false) .Add("Confirm", "confirmchangelevel") .Add("Cancel", "") @@ -872,6 +873,7 @@ bool COOP_ConfirmMenu(CBaseEntity *pTrigger, CBaseEntity *pActivator, int count2 { g_GlobalVote.ConfirmMenu(pPlayer, pTrigger, mapname ); pPlayer->m_ggm.iLocalConfirm = 0; + pPlayer->m_ggm.pChangeLevel = NULL; } } return false; @@ -1000,7 +1002,17 @@ bool COOP_ClientCommand( edict_t *pEntity ) else if( FStrEq( pcmd, "confirmchangelevel" ) ) { if( pPlayer->m_ggm.iLocalConfirm ) + { pPlayer->m_ggm.iLocalConfirm++; + if( pPlayer->m_ggm.pChangeLevel ) + { + edict_t *pChangeLevel = pPlayer->m_ggm.pChangeLevel; + pPlayer->m_ggm.pChangeLevel = NULL; + DispatchTouch( pChangeLevel, pPlayer->edict() ); + } + return true; + + } else return false; } diff --git a/dlls/gravgunmod.h b/dlls/gravgunmod.h index 8950cbd0..a59278ae 100644 --- a/dlls/gravgunmod.h +++ b/dlls/gravgunmod.h @@ -172,6 +172,7 @@ struct GGMData PlayerState iState; bool fTouchMenu; int iLocalConfirm; + edict_t *pChangeLevel; float flEntScore; float flEntTime; GGM_PlayerMenu menu;