Melee menu flash selection task retired
git-svn-id: svn://svn.code.sf.net/p/sc2/code/trunk@3298 8092fc87-c524-0410-9efc-e669fe64eaf9
This commit is contained in:
+26
-1
@@ -263,7 +263,7 @@ FillFileView (MELEE_STATE *pMS)
|
||||
#define FILE_STRING_ORIGIN_Y 34
|
||||
#define ENTRY_HEIGHT 32
|
||||
|
||||
void
|
||||
static void
|
||||
SelectFileString (MELEE_STATE *pMS, bool hilite)
|
||||
{
|
||||
CONTEXT OldContext;
|
||||
@@ -325,6 +325,29 @@ RefocusView (MELEE_STATE *pMS, COUNT index)
|
||||
pMS->load.top = index - LOAD_TEAM_VIEW_SIZE / 2;
|
||||
}
|
||||
|
||||
static void
|
||||
flashSelectedTeam (MELEE_STATE *pMS)
|
||||
{
|
||||
#define FLASH_RATE (ONE_SECOND / 9)
|
||||
static TimeCount NextTime = 0;
|
||||
static int hilite = 0;
|
||||
TimeCount Now = GetTimeCounter ();
|
||||
|
||||
if (Now >= NextTime)
|
||||
{
|
||||
CONTEXT OldContext;
|
||||
|
||||
NextTime = Now + FLASH_RATE;
|
||||
hilite ^= 1;
|
||||
|
||||
LockMutex (GraphicsLock);
|
||||
OldContext = SetContext (SpaceContext);
|
||||
SelectFileString (pMS, hilite);
|
||||
SetContext (OldContext);
|
||||
UnlockMutex (GraphicsLock);
|
||||
}
|
||||
}
|
||||
|
||||
BOOLEAN
|
||||
DoLoadTeam (MELEE_STATE *pMS)
|
||||
{
|
||||
@@ -440,6 +463,8 @@ DoLoadTeam (MELEE_STATE *pMS)
|
||||
}
|
||||
}
|
||||
|
||||
flashSelectedTeam (pMS);
|
||||
|
||||
SleepThreadUntil (TimeIn + ONE_SECOND / 30);
|
||||
|
||||
return TRUE;
|
||||
|
||||
@@ -53,7 +53,6 @@ BOOLEAN DoLoadTeam (MELEE_STATE *pMS);
|
||||
BOOLEAN DoSaveTeam (MELEE_STATE *pMS);
|
||||
bool ReadTeamImage (TEAM_IMAGE *pTI, uio_Stream *load_fp);
|
||||
int WriteTeamImage (TEAM_IMAGE *pTI, uio_Stream *save_fp);
|
||||
void SelectFileString (MELEE_STATE *pMS, bool hilite);
|
||||
void LoadTeamList (MELEE_STATE *pMS);
|
||||
|
||||
#endif /* _LOADMELE_H */
|
||||
|
||||
+25
-77
@@ -703,13 +703,10 @@ Deselect (BYTE opt)
|
||||
DrawMeleeIcon (25); /* "Battle!" (not highlighted) */
|
||||
break;
|
||||
case LOAD_TOP:
|
||||
DrawMeleeIcon (17); /* "Load" (top, not highlighted) */
|
||||
break;
|
||||
case LOAD_BOT:
|
||||
if (pMeleeState->InputFunc != DoLoadTeam)
|
||||
DrawMeleeIcon (opt == LOAD_TOP ? 17 : 22);
|
||||
/* 17: "Load" (top, not highlighted) */
|
||||
/* 22: "Load" (bottom, not highlighted) */
|
||||
else
|
||||
SelectFileString (pMeleeState, false);
|
||||
DrawMeleeIcon (22); /* "Load" (bottom, not highlighted) */
|
||||
break;
|
||||
case SAVE_TOP:
|
||||
DrawMeleeIcon (18); /* "Save" (top, not highlighted) */
|
||||
@@ -765,13 +762,10 @@ Select (BYTE opt)
|
||||
DrawMeleeIcon (26); /* "Battle!" (highlighted) */
|
||||
break;
|
||||
case LOAD_TOP:
|
||||
DrawMeleeIcon (19); /* "Load" (top, highlighted) */
|
||||
break;
|
||||
case LOAD_BOT:
|
||||
if (pMeleeState->InputFunc != DoLoadTeam)
|
||||
DrawMeleeIcon (opt == LOAD_TOP ? 19 : 24);
|
||||
/* 19: "Load" (top, highlighted) */
|
||||
/* 24: "Load" (bottom, highlighted) */
|
||||
else
|
||||
SelectFileString (pMeleeState, true);
|
||||
DrawMeleeIcon (24); /* "Load" (bottom, highlighted) */
|
||||
break;
|
||||
case SAVE_TOP:
|
||||
DrawMeleeIcon (20); /* "Save" (top; highlighted) */
|
||||
@@ -814,39 +808,30 @@ Select (BYTE opt)
|
||||
}
|
||||
}
|
||||
|
||||
static int
|
||||
flash_selection_func (void *data)
|
||||
static void
|
||||
flashSelection (MELEE_STATE *pMS)
|
||||
{
|
||||
DWORD TimeIn;
|
||||
Task task = (Task) data;
|
||||
volatile MELEE_STATE *pMS = pMeleeState;
|
||||
#define FLASH_RATE (ONE_SECOND / 9)
|
||||
static TimeCount NextTime = 0;
|
||||
static bool select = false;
|
||||
TimeCount Now = GetTimeCounter ();
|
||||
|
||||
TimeIn = GetTimeCounter ();
|
||||
while (!Task_ReadState (task, TASK_EXIT))
|
||||
if (Now >= NextTime)
|
||||
{
|
||||
#define FLASH_RATE (ONE_SECOND / 8)
|
||||
CONTEXT OldContext;
|
||||
|
||||
NextTime = Now + FLASH_RATE;
|
||||
select ^= true;
|
||||
|
||||
LockMutex (GraphicsLock);
|
||||
OldContext = SetContext (SpaceContext);
|
||||
if (select)
|
||||
Select (pMS->MeleeOption);
|
||||
else
|
||||
Deselect (pMS->MeleeOption);
|
||||
SetContext (OldContext);
|
||||
UnlockMutex (GraphicsLock);
|
||||
SleepThreadUntil (TimeIn + FLASH_RATE);
|
||||
TimeIn = GetTimeCounter ();
|
||||
|
||||
LockMutex (GraphicsLock);
|
||||
OldContext = SetContext (SpaceContext);
|
||||
Select (pMS->MeleeOption);
|
||||
SetContext (OldContext);
|
||||
UnlockMutex (GraphicsLock);
|
||||
SleepThreadUntil (TimeIn + FLASH_RATE);
|
||||
TimeIn = GetTimeCounter ();
|
||||
}
|
||||
|
||||
FinishTask (task);
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
static void
|
||||
@@ -867,9 +852,6 @@ InitMelee (MELEE_STATE *pMS)
|
||||
|
||||
r.corner.x = r.corner.y = 0;
|
||||
RedrawMeleeFrame ();
|
||||
|
||||
pMS->flash_task = AssignTask (flash_selection_func, 2048,
|
||||
"flash melee selection");
|
||||
}
|
||||
|
||||
static void
|
||||
@@ -1220,6 +1202,8 @@ DoEdit (MELEE_STATE *pMS)
|
||||
flushPacketQueues ();
|
||||
#endif
|
||||
|
||||
flashSelection (pMS);
|
||||
|
||||
SleepThreadUntil (TimeIn + ONE_SECOND / 30);
|
||||
|
||||
return (TRUE);
|
||||
@@ -1290,11 +1274,7 @@ DoPickShip (MELEE_STATE *pMS)
|
||||
else if (PulsedInputState.menu[KEY_MENU_SPECIAL]
|
||||
&& (pMeleeState->CurIndex != (BYTE)~0))
|
||||
{
|
||||
BOOLEAN (*InputFunc) (struct melee_state *pInputState);
|
||||
InputFunc = pMS->InputFunc;
|
||||
pMS->InputFunc = 0; /* disable ship flashing */
|
||||
DoShipSpin (pMS->CurIndex, (MUSIC_REF)0);
|
||||
pMS->InputFunc = InputFunc;
|
||||
|
||||
return (TRUE);
|
||||
}
|
||||
@@ -1342,6 +1322,8 @@ DoPickShip (MELEE_STATE *pMS)
|
||||
}
|
||||
}
|
||||
|
||||
flashSelection (pMS);
|
||||
|
||||
SleepThreadUntil (TimeIn + ONE_SECOND / 30);
|
||||
|
||||
return (TRUE);
|
||||
@@ -1554,11 +1536,6 @@ LoadMeleeInfo (MELEE_STATE *pMS)
|
||||
static void
|
||||
FreeMeleeInfo (MELEE_STATE *pMS)
|
||||
{
|
||||
if (pMS->flash_task)
|
||||
{
|
||||
ConcludeTask (pMS->flash_task);
|
||||
pMS->flash_task = 0;
|
||||
}
|
||||
DestroyDirEntryTable (ReleaseDirEntryTable (pMS->load.dirEntries));
|
||||
pMS->load.dirEntries = 0;
|
||||
|
||||
@@ -1696,12 +1673,6 @@ BuildAndDrawShipList (MELEE_STATE *pMS)
|
||||
static void
|
||||
StartMelee (MELEE_STATE *pMS)
|
||||
{
|
||||
if (pMS->flash_task)
|
||||
{
|
||||
ConcludeTask (pMS->flash_task);
|
||||
pMS->flash_task = 0;
|
||||
}
|
||||
|
||||
{
|
||||
BYTE black_buf[] = {FadeAllToBlack};
|
||||
|
||||
@@ -1926,11 +1897,6 @@ DoConnectingDialog (MELEE_STATE *pMS)
|
||||
RedrawMeleeFrame ();
|
||||
pMS->InputFunc = DoMelee;
|
||||
pMS->LastInputTime = GetTimeCounter ();
|
||||
if (!pMS->flash_task)
|
||||
{
|
||||
pMS->flash_task = AssignTask (flash_selection_func, 2048,
|
||||
"flash melee selection");
|
||||
}
|
||||
|
||||
flushPacketQueues ();
|
||||
|
||||
@@ -1955,11 +1921,6 @@ DoConnectingDialog (MELEE_STATE *pMS)
|
||||
pMS->LastInputTime = GetTimeCounter ();
|
||||
Deselect (pMS->MeleeOption);
|
||||
pMS->MeleeOption = START_MELEE;
|
||||
if (!pMS->flash_task)
|
||||
{
|
||||
pMS->flash_task = AssignTask (flash_selection_func, 2048,
|
||||
"flash melee selection");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -2083,12 +2044,6 @@ MeleeOptionSelect (MELEE_STATE *pMS)
|
||||
COUNT which_side;
|
||||
BOOLEAN confirmed;
|
||||
|
||||
if (pMS->flash_task)
|
||||
{
|
||||
ConcludeTask (pMS->flash_task);
|
||||
pMS->flash_task = 0;
|
||||
}
|
||||
|
||||
which_side = pMS->MeleeOption == NET_TOP ? 1 : 0;
|
||||
confirmed = MeleeConnectDialog (which_side);
|
||||
RedrawMeleeFrame ();
|
||||
@@ -2098,15 +2053,6 @@ MeleeOptionSelect (MELEE_STATE *pMS)
|
||||
pMS->Initialized = FALSE;
|
||||
pMS->InputFunc = DoConnectingDialog;
|
||||
}
|
||||
else
|
||||
{
|
||||
if (!pMS->flash_task)
|
||||
{
|
||||
pMS->flash_task = AssignTask (flash_selection_func,
|
||||
2048, "flash melee selection");
|
||||
}
|
||||
}
|
||||
|
||||
break;
|
||||
}
|
||||
#endif /* NETPLAY */
|
||||
@@ -2248,6 +2194,8 @@ DoMelee (MELEE_STATE *pMS)
|
||||
check_for_disconnections (pMS);
|
||||
#endif
|
||||
|
||||
flashSelection (pMS);
|
||||
|
||||
SleepThreadUntil (TimeIn + ONE_SECOND / 30);
|
||||
|
||||
return (TRUE);
|
||||
|
||||
@@ -20,7 +20,6 @@
|
||||
#define _MELEE_H
|
||||
|
||||
#include "init.h"
|
||||
#include "libs/tasklib.h"
|
||||
#include "libs/gfxlib.h"
|
||||
#include "libs/mathlib.h"
|
||||
#include "libs/sndlib.h"
|
||||
@@ -112,7 +111,6 @@ struct melee_state
|
||||
struct melee_side_state SideState[NUM_SIDES];
|
||||
struct melee_load_state load;
|
||||
COUNT CurIndex;
|
||||
Task flash_task;
|
||||
RandomContext *randomContext;
|
||||
/* RNG state for all local random decisions, i.e. those
|
||||
* decisions that are not shared among network parties. */
|
||||
|
||||
Reference in New Issue
Block a user