Clean up DeltaSISGauges a bit more.
git-svn-id: svn://svn.code.sf.net/p/sc2/code/trunk@3374 8092fc87-c524-0410-9efc-e669fe64eaf9
This commit is contained in:
+84
-48
@@ -971,47 +971,12 @@ DrawSupportShips (void)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
static void
|
||||||
DeltaSISGauges (SIZE crew_delta, SIZE fuel_delta, int resunit_delta)
|
DeltaSISGauges_crewDelta (SIZE crew_delta)
|
||||||
{
|
{
|
||||||
STAMP s;
|
if (crew_delta == 0)
|
||||||
RECT r;
|
|
||||||
TEXT t;
|
|
||||||
UNICODE buf[60];
|
|
||||||
CONTEXT OldContext;
|
|
||||||
|
|
||||||
if (crew_delta == 0 && fuel_delta == 0 && resunit_delta == 0)
|
|
||||||
return;
|
return;
|
||||||
|
|
||||||
OldContext = SetContext (StatusContext);
|
|
||||||
|
|
||||||
BatchGraphics ();
|
|
||||||
if (crew_delta == UNDEFINED_DELTA)
|
|
||||||
{
|
|
||||||
s.origin.x = 0;
|
|
||||||
s.origin.y = 0;
|
|
||||||
s.frame = FlagStatFrame;
|
|
||||||
DrawStamp (&s);
|
|
||||||
|
|
||||||
if (optWhichFonts == OPT_PC)
|
|
||||||
DrawPC_SIS();
|
|
||||||
|
|
||||||
DrawThrusters ();
|
|
||||||
DrawTurningJets ();
|
|
||||||
DrawModules ();
|
|
||||||
|
|
||||||
UnlockMutex (GraphicsLock);
|
|
||||||
DrawSupportShips ();
|
|
||||||
LockMutex (GraphicsLock);
|
|
||||||
}
|
|
||||||
|
|
||||||
t.baseline.x = STATUS_WIDTH >> 1;
|
|
||||||
t.align = ALIGN_CENTER;
|
|
||||||
t.pStr = buf;
|
|
||||||
SetContextFont (TinyFont);
|
|
||||||
|
|
||||||
if (crew_delta != 0)
|
|
||||||
{
|
|
||||||
if (crew_delta != UNDEFINED_DELTA)
|
if (crew_delta != UNDEFINED_DELTA)
|
||||||
{
|
{
|
||||||
COUNT CrewCapacity;
|
COUNT CrewCapacity;
|
||||||
@@ -1028,22 +993,38 @@ DeltaSISGauges (SIZE crew_delta, SIZE fuel_delta, int resunit_delta)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
{
|
||||||
|
TEXT t;
|
||||||
|
UNICODE buf[60];
|
||||||
|
RECT r;
|
||||||
|
|
||||||
snprintf (buf, sizeof buf, "%u", GLOBAL_SIS (CrewEnlisted));
|
snprintf (buf, sizeof buf, "%u", GLOBAL_SIS (CrewEnlisted));
|
||||||
|
|
||||||
GetGaugeRect (&r, TRUE);
|
GetGaugeRect (&r, TRUE);
|
||||||
|
|
||||||
|
t.baseline.x = STATUS_WIDTH >> 1;
|
||||||
t.baseline.y = r.corner.y + r.extent.height;
|
t.baseline.y = r.corner.y + r.extent.height;
|
||||||
|
t.align = ALIGN_CENTER;
|
||||||
|
t.pStr = buf;
|
||||||
t.CharCount = (COUNT)~0;
|
t.CharCount = (COUNT)~0;
|
||||||
|
|
||||||
SetContextForeGroundColor (BLACK_COLOR);
|
SetContextForeGroundColor (BLACK_COLOR);
|
||||||
DrawFilledRectangle (&r);
|
DrawFilledRectangle (&r);
|
||||||
SetContextForeGroundColor (
|
SetContextForeGroundColor (
|
||||||
BUILD_COLOR (MAKE_RGB15 (0x00, 0x0E, 0x00), 0x6C));
|
BUILD_COLOR (MAKE_RGB15 (0x00, 0x0E, 0x00), 0x6C));
|
||||||
font_DrawText (&t);
|
font_DrawText (&t);
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
if (fuel_delta != 0)
|
static void
|
||||||
|
DeltaSISGauges_fuelDelta (SIZE fuel_delta)
|
||||||
{
|
{
|
||||||
COUNT old_coarse_fuel;
|
COUNT old_coarse_fuel;
|
||||||
COUNT new_coarse_fuel;
|
COUNT new_coarse_fuel;
|
||||||
|
|
||||||
|
if (fuel_delta == 0)
|
||||||
|
return;
|
||||||
|
|
||||||
if (fuel_delta == UNDEFINED_DELTA)
|
if (fuel_delta == UNDEFINED_DELTA)
|
||||||
old_coarse_fuel = (COUNT)~0;
|
old_coarse_fuel = (COUNT)~0;
|
||||||
else
|
else
|
||||||
@@ -1069,10 +1050,20 @@ DeltaSISGauges (SIZE crew_delta, SIZE fuel_delta, int resunit_delta)
|
|||||||
GLOBAL_SIS (FuelOnBoard) / FUEL_TANK_SCALE);
|
GLOBAL_SIS (FuelOnBoard) / FUEL_TANK_SCALE);
|
||||||
if (new_coarse_fuel != old_coarse_fuel)
|
if (new_coarse_fuel != old_coarse_fuel)
|
||||||
{
|
{
|
||||||
|
TEXT t;
|
||||||
|
UNICODE buf[60];
|
||||||
|
RECT r;
|
||||||
|
|
||||||
snprintf (buf, sizeof buf, "%u", new_coarse_fuel);
|
snprintf (buf, sizeof buf, "%u", new_coarse_fuel);
|
||||||
|
|
||||||
GetGaugeRect (&r, FALSE);
|
GetGaugeRect (&r, FALSE);
|
||||||
|
|
||||||
|
t.baseline.x = STATUS_WIDTH >> 1;
|
||||||
t.baseline.y = r.corner.y + r.extent.height;
|
t.baseline.y = r.corner.y + r.extent.height;
|
||||||
|
t.align = ALIGN_CENTER;
|
||||||
|
t.pStr = buf;
|
||||||
t.CharCount = (COUNT)~0;
|
t.CharCount = (COUNT)~0;
|
||||||
|
|
||||||
SetContextForeGroundColor (BLACK_COLOR);
|
SetContextForeGroundColor (BLACK_COLOR);
|
||||||
DrawFilledRectangle (&r);
|
DrawFilledRectangle (&r);
|
||||||
SetContextForeGroundColor (
|
SetContextForeGroundColor (
|
||||||
@@ -1081,16 +1072,12 @@ DeltaSISGauges (SIZE crew_delta, SIZE fuel_delta, int resunit_delta)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (crew_delta == UNDEFINED_DELTA)
|
static void
|
||||||
|
DeltaSISGauges_resunitDelta (SIZE resunit_delta)
|
||||||
{
|
{
|
||||||
DrawFlagshipName (TRUE);
|
if (resunit_delta == 0)
|
||||||
DrawCaptainsName ();
|
return;
|
||||||
DrawLanders ();
|
|
||||||
DrawStorageBays (FALSE);
|
|
||||||
}
|
|
||||||
|
|
||||||
if (resunit_delta != 0)
|
|
||||||
{
|
|
||||||
if (resunit_delta != UNDEFINED_DELTA)
|
if (resunit_delta != UNDEFINED_DELTA)
|
||||||
{
|
{
|
||||||
if (resunit_delta < 0
|
if (resunit_delta < 0
|
||||||
@@ -1100,10 +1087,11 @@ DeltaSISGauges (SIZE crew_delta, SIZE fuel_delta, int resunit_delta)
|
|||||||
GLOBAL_SIS (ResUnits) += resunit_delta;
|
GLOBAL_SIS (ResUnits) += resunit_delta;
|
||||||
|
|
||||||
assert (curMsgMode == SMM_RES_UNITS);
|
assert (curMsgMode == SMM_RES_UNITS);
|
||||||
DrawStatusMessage (NULL);
|
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
RECT r;
|
||||||
|
|
||||||
r.corner.x = 2;
|
r.corner.x = 2;
|
||||||
r.corner.y = 130;
|
r.corner.y = 130;
|
||||||
r.extent.width = STATUS_MESSAGE_WIDTH;
|
r.extent.width = STATUS_MESSAGE_WIDTH;
|
||||||
@@ -1111,9 +1099,57 @@ 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);
|
DrawStatusMessage (NULL);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void
|
||||||
|
DeltaSISGauges (SIZE crew_delta, SIZE fuel_delta, int resunit_delta)
|
||||||
|
{
|
||||||
|
CONTEXT OldContext;
|
||||||
|
|
||||||
|
if (crew_delta == 0 && fuel_delta == 0 && resunit_delta == 0)
|
||||||
|
return;
|
||||||
|
|
||||||
|
OldContext = SetContext (StatusContext);
|
||||||
|
|
||||||
|
BatchGraphics ();
|
||||||
|
if (crew_delta == UNDEFINED_DELTA)
|
||||||
|
{
|
||||||
|
STAMP s;
|
||||||
|
s.origin.x = 0;
|
||||||
|
s.origin.y = 0;
|
||||||
|
s.frame = FlagStatFrame;
|
||||||
|
DrawStamp (&s);
|
||||||
|
|
||||||
|
if (optWhichFonts == OPT_PC)
|
||||||
|
DrawPC_SIS();
|
||||||
|
|
||||||
|
DrawThrusters ();
|
||||||
|
DrawTurningJets ();
|
||||||
|
DrawModules ();
|
||||||
|
|
||||||
|
UnlockMutex (GraphicsLock);
|
||||||
|
DrawSupportShips ();
|
||||||
|
LockMutex (GraphicsLock);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
SetContextFont (TinyFont);
|
||||||
|
|
||||||
|
DeltaSISGauges_crewDelta (crew_delta);
|
||||||
|
DeltaSISGauges_fuelDelta (fuel_delta);
|
||||||
|
|
||||||
|
if (crew_delta == UNDEFINED_DELTA)
|
||||||
|
{
|
||||||
|
DrawFlagshipName (TRUE);
|
||||||
|
DrawCaptainsName ();
|
||||||
|
DrawLanders ();
|
||||||
|
DrawStorageBays (FALSE);
|
||||||
|
}
|
||||||
|
|
||||||
|
DeltaSISGauges_resunitDelta (resunit_delta);
|
||||||
|
|
||||||
UnbatchGraphics ();
|
UnbatchGraphics ();
|
||||||
|
|
||||||
SetContext (OldContext);
|
SetContext (OldContext);
|
||||||
|
|||||||
Reference in New Issue
Block a user