Better location descriptions in savegame summaries; bug #844
git-svn-id: svn://svn.code.sf.net/p/sc2/code/trunk@3185 8092fc87-c524-0410-9efc-e669fe64eaf9
This commit is contained in:
@@ -1,4 +1,5 @@
|
||||
Changes towards version 0.7:
|
||||
- Better location description in savegame summaries (bug #844) - Alex
|
||||
- Fixed crash when saving a game into the last slot while having
|
||||
too many devices on board - Alex
|
||||
- Allow any sound data format to be graphed by comm oscilloscope; also
|
||||
|
||||
@@ -1625,6 +1625,8 @@ Planet XV
|
||||
#(Planet XVI)
|
||||
Planet XVI
|
||||
|
||||
#(Sa-Matra)
|
||||
Sa-Matra
|
||||
|
||||
#(JAN)
|
||||
JAN
|
||||
|
||||
@@ -804,17 +804,26 @@ ShowSummary (SUMMARY_DESC *pSD)
|
||||
t.CharCount = (COUNT)~0;
|
||||
font_DrawText (&t);
|
||||
t.align = ALIGN_CENTER;
|
||||
t.baseline.x = SIS_SCREEN_WIDTH - SIS_TITLE_BOX_WIDTH - 3
|
||||
t.baseline.x = SIS_SCREEN_WIDTH - SIS_TITLE_BOX_WIDTH - 4
|
||||
+ (SIS_TITLE_WIDTH >> 1);
|
||||
if (pSD->Activity == IN_STARBASE)
|
||||
utf8StringCopy (buf, sizeof (buf),
|
||||
switch (pSD->Activity)
|
||||
{
|
||||
case IN_STARBASE:
|
||||
utf8StringCopy (buf, sizeof (buf), // Starbase
|
||||
GAME_STRING (STARBASE_STRING_BASE));
|
||||
else if (pSD->Activity == IN_PLANET_ORBIT)
|
||||
break;
|
||||
case IN_LAST_BATTLE:
|
||||
utf8StringCopy (buf, sizeof (buf), // Sa-Matra
|
||||
GAME_STRING (PLANET_NUMBER_BASE + 32));
|
||||
break;
|
||||
case IN_PLANET_ORBIT:
|
||||
utf8StringCopy (buf, sizeof (buf), GLOBAL_SIS (PlanetName));
|
||||
else
|
||||
break;
|
||||
default:
|
||||
sprintf (buf, "%03u.%01u : %03u.%01u",
|
||||
r.corner.x / 10, r.corner.x % 10,
|
||||
r.corner.y / 10, r.corner.y % 10);
|
||||
}
|
||||
t.CharCount = (COUNT)~0;
|
||||
font_DrawText (&t);
|
||||
|
||||
|
||||
@@ -31,7 +31,7 @@
|
||||
#define ELEMENTS_STRING_COUNT 133
|
||||
#define SCAN_STRING_COUNT 56
|
||||
#define STAR_NUMBER_COUNT 14
|
||||
#define PLANET_NUMBER_COUNT 32
|
||||
#define PLANET_NUMBER_COUNT 33
|
||||
#define MONTHS_STRING_COUNT 12
|
||||
#define FEEDBACK_STRING_COUNT 2
|
||||
#define STARBASE_STRING_COUNT 5
|
||||
|
||||
@@ -255,5 +255,8 @@ extern void GeneratePlanetMask (PLANET_DESC *pPlanetDesc, FRAME SurfDefFrame);
|
||||
extern void DeltaTopography (COUNT num_iterations, SBYTE *DepthArray,
|
||||
RECT *pRect, SIZE depth_delta);
|
||||
|
||||
extern UNICODE* GetNamedPlanetaryBody (void);
|
||||
extern void GetPlanetOrMoonName (UNICODE *buf, COUNT bufsize);
|
||||
|
||||
#endif /* _PLANETS_H */
|
||||
|
||||
|
||||
+31
-115
@@ -124,6 +124,33 @@ MakeScanValue (UNICODE *buf, long val, const UNICODE *extra)
|
||||
}
|
||||
}
|
||||
|
||||
static void
|
||||
GetPlanetTitle (UNICODE *buf, COUNT bufsize)
|
||||
{
|
||||
int val;
|
||||
UNICODE *named = GetNamedPlanetaryBody ();
|
||||
if (named)
|
||||
{
|
||||
utf8StringCopy (buf, bufsize, named);
|
||||
return;
|
||||
}
|
||||
|
||||
// Unnamed body, use world type
|
||||
val = pSolarSysState->pOrbitalDesc->data_index & ~PLANET_SHIELDED;
|
||||
if (val >= FIRST_GAS_GIANT)
|
||||
{
|
||||
sprintf (buf, "%s", GAME_STRING (SCAN_STRING_BASE + 4 + 51));
|
||||
// Gas Giant
|
||||
}
|
||||
else
|
||||
{
|
||||
sprintf (buf, "%s %s",
|
||||
GAME_STRING (SCAN_STRING_BASE + 4 + val),
|
||||
GAME_STRING (SCAN_STRING_BASE + 4 + 50));
|
||||
// World
|
||||
}
|
||||
}
|
||||
|
||||
static void
|
||||
PrintCoarseScanPC (void)
|
||||
{
|
||||
@@ -133,67 +160,11 @@ PrintCoarseScanPC (void)
|
||||
RECT r;
|
||||
UNICODE buf[200];
|
||||
|
||||
GetPlanetTitle (buf, sizeof (buf));
|
||||
|
||||
LockMutex (GraphicsLock);
|
||||
SetContext (SpaceContext);
|
||||
|
||||
if (CurStarDescPtr->Index == SOL_DEFINED)
|
||||
{
|
||||
if (pSolarSysState->pOrbitalDesc->pPrevDesc ==
|
||||
&pSolarSysState->SunDesc[0])
|
||||
utf8StringCopy (buf, sizeof (buf), GLOBAL_SIS (PlanetName));
|
||||
else
|
||||
{
|
||||
switch (pSolarSysState->pOrbitalDesc->pPrevDesc
|
||||
- pSolarSysState->PlanetDesc)
|
||||
{
|
||||
case 2: /* EARTH */
|
||||
utf8StringCopy (buf, sizeof (buf),
|
||||
GAME_STRING (PLANET_NUMBER_BASE + 9));
|
||||
break;
|
||||
case 4: /* JUPITER */
|
||||
switch (pSolarSysState->pOrbitalDesc
|
||||
- pSolarSysState->MoonDesc)
|
||||
{
|
||||
case 0:
|
||||
utf8StringCopy (buf, sizeof (buf),
|
||||
GAME_STRING (PLANET_NUMBER_BASE + 10));
|
||||
break;
|
||||
case 1:
|
||||
utf8StringCopy (buf, sizeof (buf),
|
||||
GAME_STRING (PLANET_NUMBER_BASE + 11));
|
||||
break;
|
||||
case 2:
|
||||
utf8StringCopy (buf, sizeof (buf),
|
||||
GAME_STRING (PLANET_NUMBER_BASE + 12));
|
||||
break;
|
||||
case 3:
|
||||
utf8StringCopy (buf, sizeof (buf),
|
||||
GAME_STRING (PLANET_NUMBER_BASE + 13));
|
||||
break;
|
||||
}
|
||||
break;
|
||||
case 5: /* SATURN */
|
||||
utf8StringCopy (buf, sizeof (buf),
|
||||
GAME_STRING (PLANET_NUMBER_BASE + 14));
|
||||
break;
|
||||
case 7: /* NEPTUNE */
|
||||
utf8StringCopy (buf, sizeof (buf),
|
||||
GAME_STRING (PLANET_NUMBER_BASE + 15));
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
val = pSolarSysState->pOrbitalDesc->data_index & ~PLANET_SHIELDED;
|
||||
if (val >= FIRST_GAS_GIANT)
|
||||
sprintf (buf, "%s", GAME_STRING (SCAN_STRING_BASE + 4 + 51));
|
||||
else
|
||||
sprintf (buf, "%s %s",
|
||||
GAME_STRING (SCAN_STRING_BASE + 4 + val),
|
||||
GAME_STRING (SCAN_STRING_BASE + 4 + 50));
|
||||
}
|
||||
|
||||
t.align = ALIGN_CENTER;
|
||||
t.baseline.x = SIS_SCREEN_WIDTH >> 1;
|
||||
t.baseline.y = 13;
|
||||
@@ -375,66 +346,11 @@ PrintCoarseScan3DO (void)
|
||||
STAMP s;
|
||||
UNICODE buf[200];
|
||||
|
||||
GetPlanetTitle (buf, sizeof (buf));
|
||||
|
||||
LockMutex (GraphicsLock);
|
||||
SetContext (SpaceContext);
|
||||
|
||||
if (CurStarDescPtr->Index == SOL_DEFINED)
|
||||
{
|
||||
if (pSolarSysState->pOrbitalDesc->pPrevDesc == &pSolarSysState->SunDesc[0])
|
||||
utf8StringCopy (buf, sizeof (buf), GLOBAL_SIS (PlanetName));
|
||||
else
|
||||
{
|
||||
switch (pSolarSysState->pOrbitalDesc->pPrevDesc
|
||||
- pSolarSysState->PlanetDesc)
|
||||
{
|
||||
case 2: /* EARTH */
|
||||
utf8StringCopy (buf, sizeof (buf),
|
||||
GAME_STRING (PLANET_NUMBER_BASE + 9));
|
||||
break;
|
||||
case 4: /* JUPITER */
|
||||
switch (pSolarSysState->pOrbitalDesc
|
||||
- pSolarSysState->MoonDesc)
|
||||
{
|
||||
case 0:
|
||||
utf8StringCopy (buf, sizeof (buf),
|
||||
GAME_STRING (PLANET_NUMBER_BASE + 10));
|
||||
break;
|
||||
case 1:
|
||||
utf8StringCopy (buf, sizeof (buf),
|
||||
GAME_STRING (PLANET_NUMBER_BASE + 11));
|
||||
break;
|
||||
case 2:
|
||||
utf8StringCopy (buf, sizeof (buf),
|
||||
GAME_STRING (PLANET_NUMBER_BASE + 12));
|
||||
break;
|
||||
case 3:
|
||||
utf8StringCopy (buf, sizeof (buf),
|
||||
GAME_STRING (PLANET_NUMBER_BASE + 13));
|
||||
break;
|
||||
}
|
||||
break;
|
||||
case 5: /* SATURN */
|
||||
utf8StringCopy (buf, sizeof (buf),
|
||||
GAME_STRING (PLANET_NUMBER_BASE + 14));
|
||||
break;
|
||||
case 7: /* NEPTUNE */
|
||||
utf8StringCopy (buf, sizeof (buf),
|
||||
GAME_STRING (PLANET_NUMBER_BASE + 15));
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
val = pSolarSysState->pOrbitalDesc->data_index & ~PLANET_SHIELDED;
|
||||
if (val >= FIRST_GAS_GIANT)
|
||||
sprintf (buf, "%s", GAME_STRING (SCAN_STRING_BASE + 4 + 51));
|
||||
else
|
||||
sprintf (buf, "%s %s",
|
||||
GAME_STRING (SCAN_STRING_BASE + 4 + val),
|
||||
GAME_STRING (SCAN_STRING_BASE + 4 + 50));
|
||||
}
|
||||
|
||||
t.align = ALIGN_CENTER;
|
||||
t.baseline.x = SIS_SCREEN_WIDTH >> 1;
|
||||
t.baseline.y = 13;
|
||||
|
||||
@@ -1937,4 +1937,112 @@ ExploreSolarSys (void)
|
||||
pSolarSysState = 0;
|
||||
}
|
||||
|
||||
UNICODE *
|
||||
GetNamedPlanetaryBody (void)
|
||||
{
|
||||
int planet;
|
||||
int moon;
|
||||
int parent_planet;
|
||||
|
||||
if (!CurStarDescPtr || !pSolarSysState || !pSolarSysState->pOrbitalDesc)
|
||||
return NULL; // Not inside an inner system, so no name
|
||||
|
||||
planet = pSolarSysState->pOrbitalDesc - pSolarSysState->PlanetDesc;
|
||||
moon = pSolarSysState->pOrbitalDesc - pSolarSysState->MoonDesc;
|
||||
parent_planet = pSolarSysState->pOrbitalDesc->pPrevDesc
|
||||
- pSolarSysState->PlanetDesc;
|
||||
|
||||
if (CurStarDescPtr->Index == SOL_DEFINED)
|
||||
{ // Planets and moons in Sol
|
||||
if (pSolarSysState->pOrbitalDesc->pPrevDesc == pSolarSysState->SunDesc)
|
||||
{ // A planet
|
||||
return GAME_STRING (PLANET_NUMBER_BASE + planet);
|
||||
}
|
||||
// Moons
|
||||
switch (parent_planet)
|
||||
{
|
||||
case 2: // Earth
|
||||
switch (moon)
|
||||
{
|
||||
case 0: // Starbase
|
||||
return GAME_STRING (STARBASE_STRING_BASE + 0);
|
||||
case 1: // Luna
|
||||
return GAME_STRING (PLANET_NUMBER_BASE + 9);
|
||||
}
|
||||
break;
|
||||
case 4: // Jupiter
|
||||
switch (moon)
|
||||
{
|
||||
case 0: // Io
|
||||
return GAME_STRING (PLANET_NUMBER_BASE + 10);
|
||||
case 1: // Europa
|
||||
return GAME_STRING (PLANET_NUMBER_BASE + 11);
|
||||
case 2: // Ganymede
|
||||
return GAME_STRING (PLANET_NUMBER_BASE + 12);
|
||||
case 3: // Callisto
|
||||
return GAME_STRING (PLANET_NUMBER_BASE + 13);
|
||||
}
|
||||
break;
|
||||
case 5: // Saturn
|
||||
if (moon == 0) // Titan
|
||||
return GAME_STRING (PLANET_NUMBER_BASE + 14);
|
||||
break;
|
||||
case 7: // Neptune
|
||||
if (moon == 0) // Triton
|
||||
return GAME_STRING (PLANET_NUMBER_BASE + 15);
|
||||
break;
|
||||
}
|
||||
}
|
||||
else if (CurStarDescPtr->Index == SPATHI_DEFINED)
|
||||
{
|
||||
if (pSolarSysState->pOrbitalDesc->pPrevDesc == pSolarSysState->SunDesc)
|
||||
{ // A planet
|
||||
#ifdef NOTYET
|
||||
if (planet == 0)
|
||||
return "Spathiwa";
|
||||
#endif // NOTYET
|
||||
}
|
||||
}
|
||||
else if (CurStarDescPtr->Index == SAMATRA_DEFINED)
|
||||
{
|
||||
if (parent_planet == 4 && moon == 0) // Sa-Matra
|
||||
return GAME_STRING (PLANET_NUMBER_BASE + 32);
|
||||
}
|
||||
|
||||
return NULL;
|
||||
}
|
||||
|
||||
void
|
||||
GetPlanetOrMoonName (UNICODE *buf, COUNT bufsize)
|
||||
{
|
||||
UNICODE *named;
|
||||
int moon;
|
||||
int i;
|
||||
|
||||
named = GetNamedPlanetaryBody ();
|
||||
if (named)
|
||||
{
|
||||
utf8StringCopy (buf, bufsize, named);
|
||||
return;
|
||||
}
|
||||
|
||||
// Either not named or we already have a name
|
||||
utf8StringCopy (buf, bufsize, GLOBAL_SIS (PlanetName));
|
||||
|
||||
if (!pSolarSysState || !pSolarSysState->pOrbitalDesc ||
|
||||
pSolarSysState->pOrbitalDesc->pPrevDesc == pSolarSysState->SunDesc)
|
||||
{ // Outer or inner system or orbiting a planet
|
||||
return;
|
||||
}
|
||||
|
||||
// Orbiting an unnamed moon
|
||||
i = strlen (buf);
|
||||
buf += i;
|
||||
bufsize -= i;
|
||||
moon = pSolarSysState->pOrbitalDesc - pSolarSysState->MoonDesc;
|
||||
if (bufsize >= 3)
|
||||
{
|
||||
snprintf (buf, bufsize, "-%c", 'A' + moon);
|
||||
buf[bufsize - 1] = '\0';
|
||||
}
|
||||
}
|
||||
|
||||
+10
-1
@@ -467,18 +467,27 @@ PrepareSummary (SUMMARY_DESC *SummPtr)
|
||||
{
|
||||
SummPtr->SS = GlobData.SIS_state;
|
||||
|
||||
switch (SummPtr->Activity = LOBYTE (GLOBAL (CurrentActivity)))
|
||||
SummPtr->Activity = LOBYTE (GLOBAL (CurrentActivity));
|
||||
switch (SummPtr->Activity)
|
||||
{
|
||||
case IN_HYPERSPACE:
|
||||
if (GET_GAME_STATE (ARILOU_SPACE_SIDE) > 1)
|
||||
SummPtr->Activity = IN_QUASISPACE;
|
||||
break;
|
||||
case IN_INTERPLANETARY:
|
||||
// Get a better planet name for summary
|
||||
GetPlanetOrMoonName (SummPtr->SS.PlanetName,
|
||||
sizeof (SummPtr->SS.PlanetName));
|
||||
if (GET_GAME_STATE (GLOBAL_FLAGS_AND_DATA) == (BYTE)~0)
|
||||
SummPtr->Activity = IN_STARBASE;
|
||||
else if (pSolarSysState && pSolarSysState->MenuState.Initialized >= 3)
|
||||
SummPtr->Activity = IN_PLANET_ORBIT;
|
||||
break;
|
||||
case IN_LAST_BATTLE:
|
||||
utf8StringCopy (SummPtr->SS.PlanetName,
|
||||
sizeof (SummPtr->SS.PlanetName),
|
||||
GAME_STRING (PLANET_NUMBER_BASE + 32)); // Sa-Matra
|
||||
break;
|
||||
}
|
||||
|
||||
SummPtr->MCreditLo = GET_GAME_STATE (MELNORME_CREDIT0);
|
||||
|
||||
Reference in New Issue
Block a user