Uncouple DrawStatusMessage() from pMenuState (carry the required parameter forward)
git-svn-id: svn://svn.code.sf.net/p/sc2/code/trunk@3312 8092fc87-c524-0410-9efc-e669fe64eaf9
This commit is contained in:
@@ -194,6 +194,7 @@ static NUMBER_SPEECH_DESC melnorme_numbers_english =
|
||||
}
|
||||
};
|
||||
|
||||
static StatMsgMode prevMsgMode;
|
||||
|
||||
static void DoFirstMeeting (RESPONSE_REF R);
|
||||
|
||||
@@ -574,7 +575,7 @@ DeltaCredit (SIZE delta_credit)
|
||||
SET_GAME_STATE (MELNORME_CREDIT0, LOBYTE (Credit));
|
||||
SET_GAME_STATE (MELNORME_CREDIT1, HIBYTE (Credit));
|
||||
LockMutex (GraphicsLock);
|
||||
DrawStatusMessage ((UNICODE *)~0);
|
||||
DrawStatusMessage (NULL);
|
||||
UnlockMutex (GraphicsLock);
|
||||
}
|
||||
else
|
||||
@@ -1810,6 +1811,8 @@ DoMelnormeHate (RESPONSE_REF R)
|
||||
static void
|
||||
Intro (void)
|
||||
{
|
||||
prevMsgMode = SetStatusMessageMode (SMM_CREDITS);
|
||||
|
||||
if (GET_GAME_STATE (MET_MELNORME) == 0)
|
||||
{
|
||||
SET_GAME_STATE (MET_MELNORME, 1);
|
||||
@@ -1841,14 +1844,16 @@ Intro (void)
|
||||
static COUNT
|
||||
uninit_melnorme (void)
|
||||
{
|
||||
return (0);
|
||||
return 0;
|
||||
}
|
||||
|
||||
static void
|
||||
post_melnorme_enc (void)
|
||||
{
|
||||
LockMutex (GraphicsLock);
|
||||
DrawStatusMessage (0);
|
||||
if (prevMsgMode != SMM_UNDEFINED)
|
||||
SetStatusMessageMode (prevMsgMode);
|
||||
DrawStatusMessage (NULL);
|
||||
UnlockMutex (GraphicsLock);
|
||||
}
|
||||
|
||||
@@ -1868,6 +1873,8 @@ init_melnorme_comm (void)
|
||||
local_stack0 = 0;
|
||||
local_stack1 = 0;
|
||||
|
||||
prevMsgMode = SMM_UNDEFINED;
|
||||
|
||||
SET_GAME_STATE (BATTLE_SEGUE, 0);
|
||||
AskedToBuy = FALSE;
|
||||
retval = &melnorme_desc;
|
||||
|
||||
@@ -443,6 +443,7 @@ UninitEncounter (void)
|
||||
STAMP ship_s;
|
||||
const UNICODE *str1 = NULL;
|
||||
const UNICODE *str2 = NULL;
|
||||
StatMsgMode prevMsgMode;
|
||||
UNICODE buf[80];
|
||||
HSHIPFRAG hStarShip;
|
||||
SHIP_FRAGMENT *FragPtr;
|
||||
@@ -486,6 +487,7 @@ UninitEncounter (void)
|
||||
}
|
||||
UnlockShipFrag (&GLOBAL (npc_built_ship_q), hStarShip);
|
||||
|
||||
prevMsgMode = SetStatusMessageMode (SMM_RES_UNITS);
|
||||
Sleepy = TRUE;
|
||||
for (i = 0; i < NUM_SIDES; ++i)
|
||||
{
|
||||
@@ -539,7 +541,7 @@ UninitEncounter (void)
|
||||
{
|
||||
RecycleAmount = 0;
|
||||
|
||||
DrawStatusMessage ((UNICODE *)~0);
|
||||
DrawStatusMessage (NULL);
|
||||
|
||||
ship_s.origin.x = scavenge_r.corner.x + 32;
|
||||
ship_s.origin.y = scavenge_r.corner.y + 56;
|
||||
@@ -651,6 +653,7 @@ UninitEncounter (void)
|
||||
UnlockShipFrag (pQueue, hStarShip);
|
||||
}
|
||||
}
|
||||
SetStatusMessageMode (prevMsgMode);
|
||||
|
||||
if (VictoryState)
|
||||
{
|
||||
|
||||
@@ -376,10 +376,6 @@ Cargo (MENU_STATE *pMS)
|
||||
--pMS->Initialized;
|
||||
pMS->CurState = 1;
|
||||
|
||||
LockMutex (GraphicsLock);
|
||||
DrawStatusMessage ((UNICODE *)~0);
|
||||
UnlockMutex (GraphicsLock);
|
||||
|
||||
SetMenuSounds (MENU_SOUND_ARROWS, MENU_SOUND_SELECT);
|
||||
DoInput (pMS, TRUE);
|
||||
|
||||
|
||||
@@ -802,7 +802,6 @@ DoModifyShips (MENU_STATE *pMS)
|
||||
// refresh SIS display
|
||||
DeltaSISGauges (UNDEFINED_DELTA, UNDEFINED_DELTA,
|
||||
UNDEFINED_DELTA);
|
||||
DrawStatusMessage ((UNICODE *)~0);
|
||||
r.corner.x = pMS->flash_rect0.corner.x;
|
||||
r.corner.y = pMS->flash_rect0.corner.y;
|
||||
r.extent.width = SHIP_WIN_WIDTH;
|
||||
|
||||
+26
-19
@@ -33,6 +33,8 @@
|
||||
|
||||
#include <stdio.h>
|
||||
|
||||
static StatMsgMode curMsgMode = SMM_DEFAULT;
|
||||
|
||||
static const UNICODE *describeWeapon (BYTE moduleType);
|
||||
|
||||
void
|
||||
@@ -363,32 +365,38 @@ DrawStatusMessage (const UNICODE *pStr)
|
||||
BUILD_COLOR (MAKE_RGB15 (0x00, 0x08, 0x00), 0x6E));
|
||||
ClearDrawable ();
|
||||
|
||||
if (pStr == (UNICODE *)~0)
|
||||
if (!pStr)
|
||||
{
|
||||
if (curMsgMode == SMM_CREDITS)
|
||||
{
|
||||
if (pMenuState == 0
|
||||
&& CommData.ConversationPhrases /* Melnorme shenanigans */
|
||||
&& cur_comm == MELNORME_CONVERSATION)
|
||||
sprintf (buf, "%u %s", MAKE_WORD (
|
||||
GET_GAME_STATE (MELNORME_CREDIT0),
|
||||
GET_GAME_STATE (MELNORME_CREDIT1)
|
||||
), GAME_STRING (STATUS_STRING_BASE + 0)); // "Cr"
|
||||
else if (GET_GAME_STATE (CHMMR_BOMB_STATE) < 2)
|
||||
}
|
||||
else if (curMsgMode == SMM_RES_UNITS)
|
||||
{
|
||||
if (GET_GAME_STATE (CHMMR_BOMB_STATE) < 2)
|
||||
{
|
||||
sprintf (buf, "%u %s", GLOBAL_SIS (ResUnits),
|
||||
GAME_STRING (STATUS_STRING_BASE + 1)); // "RU"
|
||||
}
|
||||
else
|
||||
{
|
||||
sprintf (buf, "%s %s",
|
||||
(optWhichMenu == OPT_PC) ?
|
||||
GAME_STRING (STATUS_STRING_BASE + 2)
|
||||
: STR_INFINITY_SIGN, // "UNLIMITED"
|
||||
GAME_STRING (STATUS_STRING_BASE + 1)); // "RU"
|
||||
pStr = buf;
|
||||
}
|
||||
else if (pStr == 0)
|
||||
{
|
||||
}
|
||||
else
|
||||
{ // Just a date
|
||||
DateToString (buf, sizeof buf,
|
||||
GLOBAL (GameClock.month_index),
|
||||
GLOBAL (GameClock.day_index),
|
||||
GLOBAL (GameClock.year_index));
|
||||
}
|
||||
pStr = buf;
|
||||
}
|
||||
|
||||
@@ -409,6 +417,14 @@ DrawStatusMessage (const UNICODE *pStr)
|
||||
SetContext (OldContext);
|
||||
}
|
||||
|
||||
StatMsgMode
|
||||
SetStatusMessageMode (StatMsgMode newMode)
|
||||
{
|
||||
StatMsgMode oldMode = curMsgMode;
|
||||
curMsgMode = newMode;
|
||||
return oldMode;
|
||||
}
|
||||
|
||||
void
|
||||
DrawCaptainsName (void)
|
||||
{
|
||||
@@ -1041,7 +1057,8 @@ DeltaSISGauges (SIZE crew_delta, SIZE fuel_delta, int resunit_delta)
|
||||
else
|
||||
GLOBAL_SIS (ResUnits) += resunit_delta;
|
||||
|
||||
DrawStatusMessage ((UNICODE *)~0);
|
||||
assert (curMsgMode == SMM_RES_UNITS);
|
||||
DrawStatusMessage (NULL);
|
||||
}
|
||||
else
|
||||
{
|
||||
@@ -1052,16 +1069,6 @@ DeltaSISGauges (SIZE crew_delta, SIZE fuel_delta, int resunit_delta)
|
||||
SetContextForeGroundColor (
|
||||
BUILD_COLOR (MAKE_RGB15 (0x00, 0x08, 0x00), 0x6E));
|
||||
DrawFilledRectangle (&r);
|
||||
|
||||
if ((pMenuState == 0
|
||||
&& CommData.ConversationPhrases /* Melnorme shenanigans */
|
||||
&& cur_comm == MELNORME_CONVERSATION)
|
||||
|| (pMenuState
|
||||
&& (pMenuState->InputFunc == DoStarBase
|
||||
|| pMenuState->InputFunc == DoOutfit
|
||||
|| pMenuState->InputFunc == DoShipyard)))
|
||||
DrawStatusMessage ((UNICODE *)~0);
|
||||
else
|
||||
DrawStatusMessage (NULL);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -277,7 +277,20 @@ extern void DrawSISMessage (const UNICODE *pStr);
|
||||
extern void DrawGameDate (void);
|
||||
extern void DateToString (unsigned char *buf, size_t bufLen,
|
||||
BYTE month_index, BYTE day_index, COUNT year_index);
|
||||
|
||||
extern void DrawStatusMessage (const UNICODE *pStr);
|
||||
typedef enum
|
||||
{
|
||||
SMM_UNDEFINED = 0,
|
||||
SMM_DATE,
|
||||
SMM_RES_UNITS,
|
||||
SMM_CREDITS,
|
||||
|
||||
SMM_DEFAULT = SMM_DATE,
|
||||
} StatMsgMode;
|
||||
// Sets the new mode and return the previous
|
||||
extern StatMsgMode SetStatusMessageMode (StatMsgMode);
|
||||
|
||||
extern void DrawLanders (void);
|
||||
extern void DrawStorageBays (BOOLEAN Refresh);
|
||||
extern void GetGaugeRect (RECT *pRect, BOOLEAN IsCrewRect);
|
||||
|
||||
@@ -451,6 +451,7 @@ VisitStarBase (void)
|
||||
{
|
||||
MENU_STATE MenuState;
|
||||
CONTEXT OldContext;
|
||||
StatMsgMode prevMsgMode = SMM_UNDEFINED;
|
||||
|
||||
if (GET_GAME_STATE (CHMMR_BOMB_STATE) == 2)
|
||||
{
|
||||
@@ -497,6 +498,7 @@ TimePassage:
|
||||
}
|
||||
}
|
||||
|
||||
prevMsgMode = SetStatusMessageMode (SMM_RES_UNITS);
|
||||
pMenuState = &MenuState;
|
||||
|
||||
memset (&MenuState, 0, sizeof (MenuState));
|
||||
@@ -514,6 +516,7 @@ TimePassage:
|
||||
SetContext (OldContext);
|
||||
|
||||
pMenuState = 0;
|
||||
SetStatusMessageMode (prevMsgMode);
|
||||
|
||||
ExitStarBase:
|
||||
if (!(GLOBAL (CurrentActivity) & (CHECK_LOAD | CHECK_ABORT)))
|
||||
|
||||
@@ -209,6 +209,7 @@ while (--ac > 0)
|
||||
continue;
|
||||
}
|
||||
#endif
|
||||
SetStatusMessageMode (SMM_DEFAULT);
|
||||
|
||||
if (!((GLOBAL (CurrentActivity) | NextActivity) & CHECK_LOAD))
|
||||
ZeroVelocityComponents (&GLOBAL (velocity));
|
||||
|
||||
Reference in New Issue
Block a user