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