Added '-a' switch to support 'PC-style' course-scan (i.e. use text instead
of images) git-svn-id: svn://svn.code.sf.net/p/sc2/code/trunk@531 8092fc87-c524-0410-9efc-e669fe64eaf9
This commit is contained in:
@@ -1,4 +1,5 @@
|
|||||||
Changes towards version 0.2:
|
Changes towards version 0.2:
|
||||||
|
- Added an option ('-a') to display 'PC-style' course-scan -PhracturedBlue
|
||||||
- Fixed deadlock races in new FlushGraphics method -PhracturedBlue
|
- Fixed deadlock races in new FlushGraphics method -PhracturedBlue
|
||||||
- FlushGraphics now waits and notifies on a per-thread level
|
- FlushGraphics now waits and notifies on a per-thread level
|
||||||
- No longer using SHGetFolderPath on Windows - SvdB
|
- No longer using SHGetFolderPath on Windows - SvdB
|
||||||
|
|||||||
@@ -130,7 +130,6 @@ Stuff still to do (medium size):
|
|||||||
- Convert bulky media files into more compact representations
|
- Convert bulky media files into more compact representations
|
||||||
- Proper uninitialization of everything when quitting
|
- Proper uninitialization of everything when quitting
|
||||||
- Currently pretty nonexistant, got only some atexit callbacks
|
- Currently pretty nonexistant, got only some atexit callbacks
|
||||||
- Option to display the planet statistics as text instead of images?
|
|
||||||
- Rewrite game pausing to be an event-level thing
|
- Rewrite game pausing to be an event-level thing
|
||||||
|
|
||||||
Stuff still to do (small):
|
Stuff still to do (small):
|
||||||
|
|||||||
@@ -31,6 +31,7 @@
|
|||||||
int optWhichMusic = MUSIC_3DO;
|
int optWhichMusic = MUSIC_3DO;
|
||||||
char *configDir, *saveDir, *meleeDir;
|
char *configDir, *saveDir, *meleeDir;
|
||||||
BOOLEAN optSubtitles = TRUE;
|
BOOLEAN optSubtitles = TRUE;
|
||||||
|
BOOLEAN optPCscan = FALSE;
|
||||||
|
|
||||||
void
|
void
|
||||||
prepareConfigDir (void) {
|
prepareConfigDir (void) {
|
||||||
|
|||||||
@@ -35,6 +35,8 @@ extern int optWhichMusic;
|
|||||||
|
|
||||||
extern BOOLEAN optSubtitles;
|
extern BOOLEAN optSubtitles;
|
||||||
|
|
||||||
|
extern BOOLEAN optPCscan;
|
||||||
|
|
||||||
extern char *configDir;
|
extern char *configDir;
|
||||||
extern char *meleeDir;
|
extern char *meleeDir;
|
||||||
extern char *saveDir;
|
extern char *saveDir;
|
||||||
|
|||||||
@@ -19,7 +19,7 @@
|
|||||||
#include "starcon.h"
|
#include "starcon.h"
|
||||||
#include "lifeform.h"
|
#include "lifeform.h"
|
||||||
#include "libs/graphics/gfx_common.h"
|
#include "libs/graphics/gfx_common.h"
|
||||||
|
#include "options.h"
|
||||||
//Added by Chris
|
//Added by Chris
|
||||||
|
|
||||||
void
|
void
|
||||||
@@ -91,7 +91,251 @@ EraseCoarseScan (void)
|
|||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
PrintCoarseScan (void)
|
PrintScanTitlePC (TEXT *t, RECT *r, char *txt, int xpos)
|
||||||
|
{
|
||||||
|
t->baseline.x = xpos;
|
||||||
|
SetContextForeGroundColor (BUILD_COLOR (MAKE_RGB15 (0x00, 0x00, 0x15), 0x3B));
|
||||||
|
wsprintf (t->pStr, txt);
|
||||||
|
t->CharCount = (COUNT)~0;
|
||||||
|
DrawText (t);
|
||||||
|
TextRect (t, r, NULL_PTR);
|
||||||
|
t->baseline.x += r->extent.width;
|
||||||
|
SetContextForeGroundColor (BUILD_COLOR (MAKE_RGB15 (0xF, 0x00, 0x19), 0x3B));
|
||||||
|
}
|
||||||
|
|
||||||
|
static void
|
||||||
|
PrintCoarseScanPC (void)
|
||||||
|
{
|
||||||
|
#define SCAN_LEADING_PC 14
|
||||||
|
SIZE temp;
|
||||||
|
TEXT t;
|
||||||
|
RECT r;
|
||||||
|
STAMP s;
|
||||||
|
UNICODE buf[40];
|
||||||
|
|
||||||
|
SetSemaphore (GraphicsSem);
|
||||||
|
SetContext (SpaceContext);
|
||||||
|
|
||||||
|
if (CurStarDescPtr->Index == SOL_DEFINED)
|
||||||
|
{
|
||||||
|
if (pSolarSysState->pOrbitalDesc->pPrevDesc == &pSolarSysState->SunDesc[0])
|
||||||
|
wstrcpy (buf, GLOBAL_SIS (PlanetName));
|
||||||
|
else
|
||||||
|
{
|
||||||
|
switch (pSolarSysState->pOrbitalDesc->pPrevDesc
|
||||||
|
- pSolarSysState->PlanetDesc)
|
||||||
|
{
|
||||||
|
case 2: /* EARTH */
|
||||||
|
wstrcpy (buf, GAME_STRING (PLANET_NUMBER_BASE + 9));
|
||||||
|
break;
|
||||||
|
case 4: /* JUPITER */
|
||||||
|
switch (pSolarSysState->pOrbitalDesc
|
||||||
|
- pSolarSysState->MoonDesc)
|
||||||
|
{
|
||||||
|
case 0:
|
||||||
|
wstrcpy (buf, GAME_STRING (PLANET_NUMBER_BASE + 10));
|
||||||
|
break;
|
||||||
|
case 1:
|
||||||
|
wstrcpy (buf, GAME_STRING (PLANET_NUMBER_BASE + 11));
|
||||||
|
break;
|
||||||
|
case 2:
|
||||||
|
wstrcpy (buf, GAME_STRING (PLANET_NUMBER_BASE + 12));
|
||||||
|
break;
|
||||||
|
case 3:
|
||||||
|
wstrcpy (buf, GAME_STRING (PLANET_NUMBER_BASE + 13));
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
case 5:
|
||||||
|
wstrcpy (buf, GAME_STRING (PLANET_NUMBER_BASE + 14));
|
||||||
|
break;
|
||||||
|
case 7:
|
||||||
|
wstrcpy (buf, GAME_STRING (PLANET_NUMBER_BASE + 15));
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
temp = pSolarSysState->pOrbitalDesc->data_index & ~PLANET_SHIELDED;
|
||||||
|
if (temp >= FIRST_GAS_GIANT)
|
||||||
|
wsprintf (buf, "%s", GAME_STRING (SCAN_STRING_BASE + 4 + 51));
|
||||||
|
else
|
||||||
|
wsprintf (buf, "%s %s",
|
||||||
|
GAME_STRING (SCAN_STRING_BASE + 4 + temp),
|
||||||
|
GAME_STRING (SCAN_STRING_BASE + 4 + 50));
|
||||||
|
}
|
||||||
|
|
||||||
|
t.align = ALIGN_CENTER;
|
||||||
|
t.baseline.x = SIS_SCREEN_WIDTH >> 1;
|
||||||
|
t.baseline.y = 13;
|
||||||
|
t.pStr = buf;
|
||||||
|
t.CharCount = (COUNT)~0;
|
||||||
|
|
||||||
|
SetContextForeGroundColor (BUILD_COLOR (MAKE_RGB15 (0x00, 0x00, 0x15), 0x3B));
|
||||||
|
SetContextFont (MicroFont);
|
||||||
|
DrawText (&t);
|
||||||
|
SetContextFont (TinyFont);
|
||||||
|
ClearSemaphore (GraphicsSem);
|
||||||
|
|
||||||
|
#define LEFT_SIDE_BASELINE_X_PC 5
|
||||||
|
#define RIGHT_SIDE_BASELINE_X_PC (SIS_SCREEN_WIDTH - 75)
|
||||||
|
#define SCAN_BASELINE_Y_PC 40
|
||||||
|
|
||||||
|
t.baseline.y = SCAN_BASELINE_Y_PC;
|
||||||
|
t.align = ALIGN_LEFT;
|
||||||
|
|
||||||
|
SetSemaphore (GraphicsSem);
|
||||||
|
t.pStr = buf;
|
||||||
|
PrintScanTitlePC (&t, &r, "Orbit: ", LEFT_SIDE_BASELINE_X_PC);
|
||||||
|
temp = (SIZE)((pSolarSysState->SysInfo.PlanetInfo.PlanetToSunDist * 100L
|
||||||
|
+ (EARTH_RADIUS >> 1)) / EARTH_RADIUS);
|
||||||
|
if (temp >= 10 * 100)
|
||||||
|
wsprintf (buf, "%u.%u a.u.", temp / 100, (temp / 10) % 10);
|
||||||
|
else
|
||||||
|
wsprintf (buf, "%u.%02u a.u", temp / 100, temp % 100);
|
||||||
|
t.CharCount = (COUNT)~0;
|
||||||
|
DrawText (&t);
|
||||||
|
t.baseline.y += SCAN_LEADING_PC;
|
||||||
|
ClearSemaphore (GraphicsSem);
|
||||||
|
|
||||||
|
SetSemaphore (GraphicsSem);
|
||||||
|
t.pStr = buf;
|
||||||
|
PrintScanTitlePC (&t, &r, "Atmo: ", LEFT_SIDE_BASELINE_X_PC);
|
||||||
|
if (pSolarSysState->SysInfo.PlanetInfo.AtmoDensity == GAS_GIANT_ATMOSPHERE)
|
||||||
|
wsprintf (buf, "Super Thick");
|
||||||
|
else if (pSolarSysState->SysInfo.PlanetInfo.AtmoDensity == 0)
|
||||||
|
wsprintf (buf, "Vacuum");
|
||||||
|
else
|
||||||
|
{
|
||||||
|
temp = (pSolarSysState->SysInfo.PlanetInfo.AtmoDensity * 100
|
||||||
|
+ (EARTH_ATMOSPHERE >> 1)) / EARTH_ATMOSPHERE;
|
||||||
|
if (temp >= 10 * 100)
|
||||||
|
wsprintf (buf, "%u.%u atm", temp / 100, (temp / 10) % 10);
|
||||||
|
else
|
||||||
|
wsprintf (buf, "%u.%02u atm", temp / 100, temp % 100);
|
||||||
|
}
|
||||||
|
t.CharCount = (COUNT)~0;
|
||||||
|
DrawText (&t);
|
||||||
|
t.baseline.y += SCAN_LEADING_PC;
|
||||||
|
ClearSemaphore (GraphicsSem);
|
||||||
|
|
||||||
|
SetSemaphore (GraphicsSem);
|
||||||
|
t.pStr = buf;
|
||||||
|
PrintScanTitlePC (&t, &r, "Temp: ", LEFT_SIDE_BASELINE_X_PC);
|
||||||
|
wsprintf (buf, "%d^ c", pSolarSysState->SysInfo.PlanetInfo.SurfaceTemperature);
|
||||||
|
t.CharCount = (COUNT)~0;
|
||||||
|
DrawText (&t);
|
||||||
|
t.baseline.y += SCAN_LEADING_PC;
|
||||||
|
ClearSemaphore (GraphicsSem);
|
||||||
|
|
||||||
|
SetSemaphore (GraphicsSem);
|
||||||
|
t.pStr = buf;
|
||||||
|
PrintScanTitlePC (&t, &r, "Weather: ", LEFT_SIDE_BASELINE_X_PC);
|
||||||
|
if (pSolarSysState->SysInfo.PlanetInfo.AtmoDensity == 0)
|
||||||
|
wsprintf (buf, "None");
|
||||||
|
else
|
||||||
|
wsprintf (buf, "Class %u", pSolarSysState->SysInfo.PlanetInfo.Weather + 1);
|
||||||
|
t.CharCount = (COUNT)~0;
|
||||||
|
DrawText (&t);
|
||||||
|
t.baseline.y += SCAN_LEADING_PC;
|
||||||
|
ClearSemaphore (GraphicsSem);
|
||||||
|
|
||||||
|
SetSemaphore (GraphicsSem);
|
||||||
|
t.pStr = buf;
|
||||||
|
PrintScanTitlePC (&t, &r, "Tectonics: ", LEFT_SIDE_BASELINE_X_PC);
|
||||||
|
if (PLANSIZE (pSolarSysState->SysInfo.PlanetInfo.PlanDataPtr->Type) == GAS_GIANT)
|
||||||
|
wsprintf (buf, "None");
|
||||||
|
else
|
||||||
|
wsprintf (buf, "Class %u", pSolarSysState->SysInfo.PlanetInfo.Tectonics + 1);
|
||||||
|
t.CharCount = (COUNT)~0;
|
||||||
|
DrawText (&t);
|
||||||
|
ClearSemaphore (GraphicsSem);
|
||||||
|
|
||||||
|
t.baseline.y = SCAN_BASELINE_Y_PC;
|
||||||
|
|
||||||
|
SetSemaphore (GraphicsSem);
|
||||||
|
t.pStr = buf;
|
||||||
|
PrintScanTitlePC (&t, &r, "Mass: ", RIGHT_SIDE_BASELINE_X_PC);
|
||||||
|
{
|
||||||
|
DWORD tr;
|
||||||
|
|
||||||
|
tr = pSolarSysState->SysInfo.PlanetInfo.PlanetRadius;
|
||||||
|
if ((tr = (tr * tr * tr / 100L
|
||||||
|
* (DWORD)pSolarSysState->SysInfo.PlanetInfo.PlanetDensity
|
||||||
|
+ (DWORD)((100L * 100L) >> 1))
|
||||||
|
/ (DWORD)(100L * 100L)) == 0)
|
||||||
|
tr = 1;
|
||||||
|
if (tr >= 10 * 100)
|
||||||
|
wsprintf (buf, "%lu.%lu e.s", tr / 100, (tr / 10) % 10);
|
||||||
|
else
|
||||||
|
wsprintf (buf, "%lu.%02lu e.s", tr / 100, tr % 100);
|
||||||
|
}
|
||||||
|
t.CharCount = (COUNT)~0;
|
||||||
|
DrawText (&t);
|
||||||
|
t.baseline.y += SCAN_LEADING_PC;
|
||||||
|
ClearSemaphore (GraphicsSem);
|
||||||
|
|
||||||
|
SetSemaphore (GraphicsSem);
|
||||||
|
t.pStr = buf;
|
||||||
|
PrintScanTitlePC (&t, &r, "Radius: ", RIGHT_SIDE_BASELINE_X_PC);
|
||||||
|
if ((temp = pSolarSysState->SysInfo.PlanetInfo.PlanetRadius) >= 10 * 100)
|
||||||
|
wsprintf (buf, "%u.%u e.s.", temp / 100, (temp / 10) % 10);
|
||||||
|
else
|
||||||
|
wsprintf (buf, "%u.%02u e.s", temp / 100, temp % 100);
|
||||||
|
t.CharCount = (COUNT)~0;
|
||||||
|
DrawText (&t);
|
||||||
|
t.baseline.y += SCAN_LEADING_PC;
|
||||||
|
ClearSemaphore (GraphicsSem);
|
||||||
|
|
||||||
|
SetSemaphore (GraphicsSem);
|
||||||
|
t.pStr = buf;
|
||||||
|
PrintScanTitlePC (&t, &r, "Gravity: ", RIGHT_SIDE_BASELINE_X_PC);
|
||||||
|
if ((temp = pSolarSysState->SysInfo.PlanetInfo.SurfaceGravity) >= 10 * 100)
|
||||||
|
wsprintf (buf, "%u.%u g.", temp / 100, (temp / 10) % 10);
|
||||||
|
else
|
||||||
|
{
|
||||||
|
if (temp == 0)
|
||||||
|
temp = 1;
|
||||||
|
wsprintf (buf, "%u.%02u g.", temp / 100, temp % 100);
|
||||||
|
}
|
||||||
|
t.CharCount = (COUNT)~0;
|
||||||
|
DrawText (&t);
|
||||||
|
t.baseline.y += SCAN_LEADING_PC;
|
||||||
|
ClearSemaphore (GraphicsSem);
|
||||||
|
|
||||||
|
SetSemaphore (GraphicsSem);
|
||||||
|
t.pStr = buf;
|
||||||
|
PrintScanTitlePC (&t, &r, "Day: ", RIGHT_SIDE_BASELINE_X_PC);
|
||||||
|
if (pSolarSysState->SysInfo.PlanetInfo.RotationPeriod < 240 * 10)
|
||||||
|
{
|
||||||
|
temp = (SIZE)(pSolarSysState->SysInfo.PlanetInfo.RotationPeriod * 10 / 24);
|
||||||
|
wsprintf (buf, "%u.%02u days", temp / 100, temp % 100);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
temp = (SIZE)((pSolarSysState->SysInfo.PlanetInfo.RotationPeriod
|
||||||
|
+ (24 >> 1)) / 24);
|
||||||
|
wsprintf (buf, "%u.%u days", temp / 10, temp % 10);
|
||||||
|
}
|
||||||
|
t.CharCount = (COUNT)~0;
|
||||||
|
DrawText (&t);
|
||||||
|
t.baseline.y += SCAN_LEADING_PC;
|
||||||
|
ClearSemaphore (GraphicsSem);
|
||||||
|
|
||||||
|
SetSemaphore (GraphicsSem);
|
||||||
|
t.pStr = buf;
|
||||||
|
PrintScanTitlePC (&t, &r, "Tilt: ", RIGHT_SIDE_BASELINE_X_PC);
|
||||||
|
if ((temp = pSolarSysState->SysInfo.PlanetInfo.AxialTilt) < 0)
|
||||||
|
temp = -temp;
|
||||||
|
wsprintf (buf, "%u^", temp);
|
||||||
|
t.CharCount = (COUNT)~0;
|
||||||
|
DrawText (&t);
|
||||||
|
ClearSemaphore (GraphicsSem);
|
||||||
|
}
|
||||||
|
|
||||||
|
static void
|
||||||
|
PrintCoarseScan3DO (void)
|
||||||
{
|
{
|
||||||
#define SCAN_LEADING 19
|
#define SCAN_LEADING 19
|
||||||
SIZE temp;
|
SIZE temp;
|
||||||
@@ -540,7 +784,10 @@ PickPlanetSide (INPUT_STATE InputState, PMENU_STATE pMS)
|
|||||||
return (FALSE);
|
return (FALSE);
|
||||||
}
|
}
|
||||||
|
|
||||||
PrintCoarseScan ();
|
if (optPCscan)
|
||||||
|
PrintCoarseScanPC ();
|
||||||
|
else
|
||||||
|
PrintCoarseScan3DO ();
|
||||||
}
|
}
|
||||||
|
|
||||||
DrawMenuStateStrings (PM_MIN_SCAN, DISPATCH_SHUTTLE);
|
DrawMenuStateStrings (PM_MIN_SCAN, DISPATCH_SHUTTLE);
|
||||||
@@ -994,7 +1241,10 @@ ScanSystem (void)
|
|||||||
|
|
||||||
DrawMenuStateStrings (PM_MIN_SCAN, MenuState.CurState);
|
DrawMenuStateStrings (PM_MIN_SCAN, MenuState.CurState);
|
||||||
|
|
||||||
PrintCoarseScan ();
|
if (optPCscan)
|
||||||
|
PrintCoarseScanPC ();
|
||||||
|
else
|
||||||
|
PrintCoarseScan3DO ();
|
||||||
|
|
||||||
pMenuState = &MenuState;
|
pMenuState = &MenuState;
|
||||||
DoInput ((PVOID)&MenuState);
|
DoInput ((PVOID)&MenuState);
|
||||||
|
|||||||
+6
-1
@@ -87,6 +87,7 @@ main (int argc, char *argv[])
|
|||||||
{"pcmusic", 0, NULL, 'm'},
|
{"pcmusic", 0, NULL, 'm'},
|
||||||
{"audioquality", 1, NULL, 'q'},
|
{"audioquality", 1, NULL, 'q'},
|
||||||
{"nosubtitles", 0, NULL, 'u'},
|
{"nosubtitles", 0, NULL, 'u'},
|
||||||
|
{"pcscan", 0, NULL, 'a'},
|
||||||
{0, 0, 0, 0}
|
{0, 0, 0, 0}
|
||||||
};
|
};
|
||||||
|
|
||||||
@@ -100,7 +101,7 @@ main (int argc, char *argv[])
|
|||||||
strcpy (contentdir, "content");
|
strcpy (contentdir, "content");
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
while ((c = getopt_long(argc, argv, "r:d:foc:spn:?hM:S:T:emq:u", long_options, &option_index)) != -1)
|
while ((c = getopt_long(argc, argv, "r:d:foc:spn:?hM:S:T:emq:ua", long_options, &option_index)) != -1)
|
||||||
{
|
{
|
||||||
switch (c) {
|
switch (c) {
|
||||||
case 'r':
|
case 'r':
|
||||||
@@ -184,6 +185,9 @@ main (int argc, char *argv[])
|
|||||||
case 'u':
|
case 'u':
|
||||||
optSubtitles = FALSE;
|
optSubtitles = FALSE;
|
||||||
break;
|
break;
|
||||||
|
case 'a':
|
||||||
|
optPCscan = TRUE;
|
||||||
|
break;
|
||||||
default:
|
default:
|
||||||
printf ("\nOption %s not found!\n", long_options[option_index].name);
|
printf ("\nOption %s not found!\n", long_options[option_index].name);
|
||||||
case '?':
|
case '?':
|
||||||
@@ -204,6 +208,7 @@ main (int argc, char *argv[])
|
|||||||
printf(" -m, --pcmusic\n");
|
printf(" -m, --pcmusic\n");
|
||||||
printf(" -q, --audioquality=QUALITY (high, medium or low, default medium)\n");
|
printf(" -q, --audioquality=QUALITY (high, medium or low, default medium)\n");
|
||||||
printf(" -u, --nosubtitles\n");
|
printf(" -u, --nosubtitles\n");
|
||||||
|
printf(" -a --pcscan\n");
|
||||||
return 0;
|
return 0;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user