From 60d320f09b8aafcceb1501cc7882a43fe3800263 Mon Sep 17 00:00:00 2001 From: avolkov Date: Thu, 29 Oct 2009 00:40:35 +0000 Subject: [PATCH] Fixed Melee menu timeouts after Load team and NET dialogs; bug #1067 git-svn-id: svn://svn.code.sf.net/p/sc2/code/trunk@3262 8092fc87-c524-0410-9efc-e669fe64eaf9 --- sc2/ChangeLog | 1 + sc2/src/uqm/loadmele.c | 1 + sc2/src/uqm/melee.c | 17 +++++++++-------- sc2/src/uqm/melee.h | 2 ++ 4 files changed, 13 insertions(+), 8 deletions(-) diff --git a/sc2/ChangeLog b/sc2/ChangeLog index f6d9b4f1a..9b2cf9425 100644 --- a/sc2/ChangeLog +++ b/sc2/ChangeLog @@ -1,4 +1,5 @@ Changes towards version 0.7: +- Fixed Melee menu timeout when both sides are Cyborgs (bug #1067) - Alex - Fixed AI ship not moving on warp in (bug #648) - Alex - Revert gfx settings entirely when a mode switch fails (bug #1056) - Alex - Fixed the Syreen lights-out scene timing (bug #1011) - Alex diff --git a/sc2/src/uqm/loadmele.c b/sc2/src/uqm/loadmele.c index 67273ffb8..21841cc04 100644 --- a/sc2/src/uqm/loadmele.c +++ b/sc2/src/uqm/loadmele.c @@ -365,6 +365,7 @@ DoLoadTeam (MELEE_STATE *pMS) } pMS->InputFunc = DoMelee; + pMS->LastInputTime = GetTimeCounter (); { RECT r; diff --git a/sc2/src/uqm/melee.c b/sc2/src/uqm/melee.c index f6220d747..77723f738 100644 --- a/sc2/src/uqm/melee.c +++ b/sc2/src/uqm/melee.c @@ -188,7 +188,6 @@ FRAME MeleeFrame; // Loaded from melee/melebkgd.ani static FRAME BuildPickFrame; // Constructed. -DWORD LastInputTime; MELEE_STATE *pMeleeState; BOOLEAN DoMelee (MELEE_STATE *pMS); @@ -1086,7 +1085,7 @@ DoEdit (MELEE_STATE *pMS) pMS->MeleeOption = START_MELEE; pMS->InputFunc = DoMelee; UnlockMutex (GraphicsLock); - LastInputTime = GetTimeCounter (); + pMS->LastInputTime = GetTimeCounter (); } else if (pMS->row < NUM_MELEE_ROWS && (PulsedInputState.menu[KEY_MENU_SELECT] || @@ -1936,6 +1935,7 @@ DoConnectingDialog (MELEE_STATE *pMS) } RedrawMeleeFrame (); pMS->InputFunc = DoMelee; + pMS->LastInputTime = GetTimeCounter (); if (!pMS->flash_task) { pMS->flash_task = AssignTask (flash_selection_func, 2048, @@ -1962,6 +1962,7 @@ DoConnectingDialog (MELEE_STATE *pMS) UpdateMeleeStatusMessage (which_side); pMS->InputFunc = DoMelee; + pMS->LastInputTime = GetTimeCounter (); Deselect (pMS->MeleeOption); pMS->MeleeOption = START_MELEE; if (!pMS->flash_task) @@ -2073,7 +2074,6 @@ MeleeOptionSelect (MELEE_STATE *pMS) pMS->Initialized = FALSE; pMS->side = pMS->MeleeOption == LOAD_TOP ? 0 : 1; DoLoadTeam (pMS); - LastInputTime = GetTimeCounter (); break; case SAVE_TOP: case SAVE_BOT: @@ -2102,6 +2102,7 @@ MeleeOptionSelect (MELEE_STATE *pMS) which_side = pMS->MeleeOption == NET_TOP ? 1 : 0; confirmed = MeleeConnectDialog (which_side); RedrawMeleeFrame (); + pMS->LastInputTime = GetTimeCounter (); if (confirmed) { pMS->Initialized = FALSE; @@ -2163,7 +2164,7 @@ DoMelee (MELEE_STATE *pMS) XFormColorMap ((COLORMAPPTR)clut_buf, ONE_SECOND / 2); } - LastInputTime = GetTimeCounter (); + pMS->LastInputTime = GetTimeCounter (); return TRUE; } @@ -2176,7 +2177,7 @@ DoMelee (MELEE_STATE *pMS) { // Start editing the teams. LockMutex (GraphicsLock); - LastInputTime = GetTimeCounter (); + pMS->LastInputTime = GetTimeCounter (); Deselect (pMS->MeleeOption); UnlockMutex (GraphicsLock); pMS->MeleeOption = EDIT_MELEE; @@ -2202,17 +2203,17 @@ DoMelee (MELEE_STATE *pMS) NewMeleeOption = pMS->MeleeOption; if (PulsedInputState.menu[KEY_MENU_UP]) { - LastInputTime = GetTimeCounter (); + pMS->LastInputTime = GetTimeCounter (); NewMeleeOption = MeleeOptionUp (pMS->MeleeOption); } else if (PulsedInputState.menu[KEY_MENU_DOWN]) { - LastInputTime = GetTimeCounter (); + pMS->LastInputTime = GetTimeCounter (); NewMeleeOption = MeleeOptionDown (pMS->MeleeOption); } if ((PlayerControl[0] & PlayerControl[1] & PSYTRON_CONTROL) - && GetTimeCounter () - LastInputTime > ONE_SECOND * 10) + && GetTimeCounter () - pMS->LastInputTime > ONE_SECOND * 10) { force_select = TRUE; NewMeleeOption = START_MELEE; diff --git a/sc2/src/uqm/melee.h b/sc2/src/uqm/melee.h index 0a19a0ded..9ec8d00d2 100644 --- a/sc2/src/uqm/melee.h +++ b/sc2/src/uqm/melee.h @@ -24,6 +24,7 @@ #include "libs/gfxlib.h" #include "libs/mathlib.h" #include "libs/sndlib.h" +#include "libs/timelib.h" #include "libs/reslib.h" #include "netplay/packet.h" // for NetplayAbortReason and NetplayResetReason. @@ -115,6 +116,7 @@ struct melee_state RandomContext *randomContext; /* RNG state for all local random decisions, i.e. those * decisions that are not shared among network parties. */ + TimeCount LastInputTime; MUSIC_REF hMusic; };