More cleanups, some warnings removed.

git-svn-id: svn://svn.code.sf.net/p/sc2/code/trunk@1485 8092fc87-c524-0410-9efc-e669fe64eaf9
This commit is contained in:
meep-eep
2005-01-23 12:16:21 +00:00
parent 037b9433d4
commit 38f02deb92
12 changed files with 91 additions and 66 deletions
+10 -6
View File
@@ -138,7 +138,8 @@ TextRect (PTEXT lpText, PRECT pRect, PBYTE pdelta)
{ {
COORD top_y, bot_y; COORD top_y, bot_y;
SIZE width; SIZE width;
UNICODE next_ch, *pStr; UNICODE next_ch;
const UNICODE *pStr;
if (pdelta == 0) if (pdelta == 0)
{ {
@@ -164,7 +165,8 @@ TextRect (PTEXT lpText, PRECT pRect, PBYTE pdelta)
if ((next_ch = *pStr++) == '\0') if ((next_ch = *pStr++) == '\0')
num_chars = 0; num_chars = 0;
next_ch -= FIRST_CHAR; next_ch -= FIRST_CHAR;
if (ch < MAX_CHARS && GetFrameWidth (&FontPtr->CharDesc[ch])) if (ch < (UNICODE) MAX_CHARS &&
GetFrameWidth (&FontPtr->CharDesc[ch]))
{ {
COORD y; COORD y;
@@ -177,7 +179,7 @@ TextRect (PTEXT lpText, PRECT pRect, PBYTE pdelta)
width += GetFrameWidth (&FontPtr->CharDesc[ch]); width += GetFrameWidth (&FontPtr->CharDesc[ch]);
#if 0 #if 0
if (num_chars && next_ch < MAX_CHARS if (num_chars && next_ch < (UNICODE) MAX_CHARS
&& !(FontPtr->KernTab[ch] && !(FontPtr->KernTab[ch]
& (FontPtr->KernTab[next_ch] >> 2))) & (FontPtr->KernTab[next_ch] >> 2)))
width -= FontPtr->KernAmount; width -= FontPtr->KernAmount;
@@ -227,7 +229,8 @@ _text_blt (PRECT pClipRect, PRIMITIVEPTR PrimPtr)
if ((FontPtr = _CurFontPtr) != 0) if ((FontPtr = _CurFontPtr) != 0)
{ {
COUNT num_chars; COUNT num_chars;
UNICODE next_ch, *pStr; UNICODE next_ch;
const UNICODE *pStr;
TEXTPTR TextPtr; TEXTPTR TextPtr;
PRIMITIVE locPrim; PRIMITIVE locPrim;
TFB_Palette color; TFB_Palette color;
@@ -260,7 +263,8 @@ _text_blt (PRECT pClipRect, PRIMITIVEPTR PrimPtr)
num_chars = 0; num_chars = 0;
next_ch -= FIRST_CHAR; next_ch -= FIRST_CHAR;
locPrim.Object.Stamp.frame = &FontPtr->CharDesc[ch]; locPrim.Object.Stamp.frame = &FontPtr->CharDesc[ch];
if (ch < MAX_CHARS && GetFrameWidth (locPrim.Object.Stamp.frame)) if (ch < (UNICODE) MAX_CHARS &&
GetFrameWidth (locPrim.Object.Stamp.frame))
{ {
RECT r; RECT r;
@@ -289,7 +293,7 @@ _text_blt (PRECT pClipRect, PRIMITIVEPTR PrimPtr)
locPrim.Object.Stamp.origin.x += GetFrameWidth (locPrim.Object.Stamp.frame); locPrim.Object.Stamp.origin.x += GetFrameWidth (locPrim.Object.Stamp.frame);
#if 0 #if 0
if (num_chars && next_ch < MAX_CHARS if (num_chars && next_ch < (UNICODE) MAX_CHARS
&& !(FontPtr->KernTab[ch] && !(FontPtr->KernTab[ch]
& (FontPtr->KernTab[next_ch] >> 2))) & (FontPtr->KernTab[next_ch] >> 2)))
locPrim.Object.Stamp.origin.x -= FontPtr->KernAmount; locPrim.Object.Stamp.origin.x -= FontPtr->KernAmount;
+5 -8
View File
@@ -69,8 +69,7 @@ extern BOOLEAN DeleteResFile (uio_DirHandle *dir, const char *filename);
extern MEM_HANDLE InitResourceSystem (const char *resfile, extern MEM_HANDLE InitResourceSystem (const char *resfile,
COUNT resindex_type, BOOLEAN (*FileErrorFunc) (const char *filename)); COUNT resindex_type, BOOLEAN (*FileErrorFunc) (const char *filename));
extern BOOLEAN UninitResourceSystem (void); extern BOOLEAN UninitResourceSystem (void);
extern BOOLEAN InstallResTypeVectors ( extern BOOLEAN InstallResTypeVectors (COUNT res_type,
COUNT res_type,
MEM_HANDLE (*load_func) (uio_Stream *fp, DWORD len), MEM_HANDLE (*load_func) (uio_Stream *fp, DWORD len),
BOOLEAN (*free_func) (MEM_HANDLE handle)); BOOLEAN (*free_func) (MEM_HANDLE handle));
extern MEM_HANDLE res_GetResource (RESOURCE res); extern MEM_HANDLE res_GetResource (RESOURCE res);
@@ -78,15 +77,13 @@ extern MEM_HANDLE res_DetachResource (RESOURCE res);
extern BOOLEAN FreeResource (RESOURCE res); extern BOOLEAN FreeResource (RESOURCE res);
extern COUNT CountResourceTypes (void); extern COUNT CountResourceTypes (void);
extern MEM_HANDLE OpenResourceIndexFile (PVOID extern MEM_HANDLE OpenResourceIndexFile (const char *resfile);
resfile); extern MEM_HANDLE OpenResourceIndexInstance (DWORD res);
extern MEM_HANDLE OpenResourceIndexInstance (DWORD
res);
extern MEM_HANDLE SetResourceIndex (MEM_HANDLE hRH); extern MEM_HANDLE SetResourceIndex (MEM_HANDLE hRH);
extern BOOLEAN CloseResourceIndex (MEM_HANDLE hRH); extern BOOLEAN CloseResourceIndex (MEM_HANDLE hRH);
extern MEM_HANDLE GetResourceData (uio_Stream *fp, DWORD extern MEM_HANDLE GetResourceData (uio_Stream *fp, DWORD length,
length, MEM_FLAGS mem_flags); MEM_FLAGS mem_flags);
#define RESOURCE_PRIORITY DEFAULT_MEM_PRIORITY #define RESOURCE_PRIORITY DEFAULT_MEM_PRIORITY
#define RESOURCE_DATAPTR PBYTE #define RESOURCE_DATAPTR PBYTE
+10 -6
View File
@@ -87,7 +87,9 @@ MEM_HANDLE
_GetResFileData (uio_Stream *res_fp, DWORD flen) _GetResFileData (uio_Stream *res_fp, DWORD flen)
{ {
UWORD lo_word, hi_word; UWORD lo_word, hi_word;
DWORD res_offs, remainder; DWORD res_offs;
DWORD remainder = 0;
// Initialisation is to keep the compiler quiet.
MEM_SIZE HeaderSize; MEM_SIZE HeaderSize;
INDEX_HEADER h; INDEX_HEADER h;
INDEX_HEADERPTR ResHeaderPtr; INDEX_HEADERPTR ResHeaderPtr;
@@ -249,18 +251,20 @@ UninitResourceSystem (void)
} }
MEM_HANDLE MEM_HANDLE
OpenResourceIndexFile (PVOID resfile) OpenResourceIndexFile (const char *resfile)
{ {
uio_Stream *res_fp; uio_Stream *res_fp;
char fullname[256]; char fullname[256];
strcpy (fullname, resfile); strcpy (fullname, resfile);
if ((res_fp = res_OpenResFile (contentDir, fullname, "rb")) == 0) res_fp = res_OpenResFile (contentDir, fullname, "rb");
if (res_fp == 0)
{ {
sprintf (fullname, "%s.pkg", (char *) resfile); sprintf (fullname, "%s.pkg", resfile);
if ((res_fp = res_OpenResFile (contentDir, fullname, "rb")) == 0) res_fp = res_OpenResFile (contentDir, fullname, "rb");
if (res_fp == 0)
{ {
sprintf (fullname, "%s.ndx", (char *) resfile); sprintf (fullname, "%s.ndx", resfile);
res_fp = res_OpenResFile (contentDir, fullname, "rb"); res_fp = res_OpenResFile (contentDir, fullname, "rb");
} }
} }
+1 -1
View File
@@ -555,7 +555,7 @@ err:
uio_releaseStdioAccess(handles[i]); uio_releaseStdioAccess(handles[i]);
} }
uio_free(handles); uio_free(handles);
uio_free(newArgs); uio_free((void *) newArgs);
uio_closeDir(tempDir); uio_closeDir(tempDir);
return errCode; return errCode;
+2
View File
@@ -51,4 +51,6 @@ typedef struct tfb_videoclip
} TFB_VideoClip; } TFB_VideoClip;
extern VIDEO_REF _init_video_file(const char *pStr);
#endif // _UQM_VIDEO_H #endif // _UQM_VIDEO_H
+6 -6
View File
@@ -105,8 +105,8 @@ TFB_FadeClearScreen (void)
// audio-synced video playback task // audio-synced video playback task
// the frame rate and timing is dictated by the audio // the frame rate and timing is dictated by the audio
int static int
as_video_play_task (void* data) as_video_play_task (void *data)
{ {
Task task = (Task) data; Task task = (Task) data;
volatile TFB_VideoClip* vid; volatile TFB_VideoClip* vid;
@@ -218,8 +218,8 @@ as_video_play_task (void* data)
// audio-independent video playback task // audio-independent video playback task
// the frame rate and timing is dictated by the video decoder // the frame rate and timing is dictated by the video decoder
int static int
video_play_task (void* data) video_play_task (void *data)
{ {
Task task = (Task) data; Task task = (Task) data;
TFB_VideoClip* vid; TFB_VideoClip* vid;
@@ -397,7 +397,7 @@ TFB_VideoPlaying (VIDEO_REF VidRef)
return vid->playing; return vid->playing;
} }
BOOLEAN static BOOLEAN
TFB_DoVideoInput (PVOID pIS) TFB_DoVideoInput (PVOID pIS)
{ {
VIDEO_INPUT_STATE* pVIS = (VIDEO_INPUT_STATE*) pIS; VIDEO_INPUT_STATE* pVIS = (VIDEO_INPUT_STATE*) pIS;
@@ -528,6 +528,6 @@ vp_QueueBuffer (TFB_SoundSample* sample, audio_Object buffer)
//TFB_VideoClip* vid = sample->data; //TFB_VideoClip* vid = sample->data;
TFB_TagBuffer (sample, buffer, TFB_TagBuffer (sample, buffer,
(void*) SoundDecoder_GetFrame (sample->decoder)); (void *) SoundDecoder_GetFrame (sample->decoder));
} }
+1
View File
@@ -22,6 +22,7 @@
#include "colors.h" #include "colors.h"
#include "controls.h" #include "controls.h"
#include "file.h" #include "file.h"
#include "fmv.h"
#include "gamestr.h" #include "gamestr.h"
#include "globdata.h" #include "globdata.h"
#include "intel.h" #include "intel.h"
+3 -2
View File
@@ -33,7 +33,7 @@
//#define DEBUG_DEVICES //#define DEBUG_DEVICES
static COUNT static COUNT
lpstrchr (UNICODE *pStr, UNICODE ch) lpstrchr (const UNICODE *pStr, UNICODE ch)
{ {
COUNT skip_chars; COUNT skip_chars;
@@ -131,7 +131,8 @@ DrawDevices (PMENU_STATE pMS, BYTE OldDevice, BYTE NewDevice)
if (OldDevice != NewDevice) if (OldDevice != NewDevice)
{ {
t.baseline.y = cy; t.baseline.y = cy;
t.pStr = GAME_STRING (pDeviceMap[OldDevice] + DEVICE_STRING_BASE + 1); t.pStr = GAME_STRING (pDeviceMap[OldDevice] +
DEVICE_STRING_BASE + 1);
t.CharCount = lpstrchr (t.pStr, ' '); t.CharCount = lpstrchr (t.pStr, ' ');
font_DrawText (&t); font_DrawText (&t);
t.baseline.y += 7; t.baseline.y += 7;
+3 -2
View File
@@ -19,6 +19,7 @@
#include "colors.h" #include "colors.h"
#include "controls.h" #include "controls.h"
#include "encount.h" #include "encount.h"
#include "gameopt.h"
#include "gamestr.h" #include "gamestr.h"
#include "globdata.h" #include "globdata.h"
#include "options.h" #include "options.h"
@@ -57,8 +58,8 @@ void RepairBackRect (PRECT pRect);
static BOOLEAN transition_pending; static BOOLEAN transition_pending;
int static int
flash_cursor_func(void *data) flash_cursor_func (void *data)
{ {
BYTE c, val; BYTE c, val;
POINT universe; POINT universe;
+5 -4
View File
@@ -110,8 +110,8 @@ MakeReport (SOUND ReadOutSounds, UNICODE *pStr, COUNT StrLen)
while (StrLen) while (StrLen)
{ {
COUNT col_cells; COUNT col_cells;
UNICODE *pLastStr; const UNICODE *pLastStr;
UNICODE *pTempStr; const UNICODE *pTempStr;
COUNT lf_pos; COUNT lf_pos;
pLastStr = t.pStr; pLastStr = t.pStr;
@@ -137,7 +137,7 @@ MakeReport (SOUND ReadOutSounds, UNICODE *pStr, COUNT StrLen)
do do
{ {
COUNT word_chars; COUNT word_chars;
UNICODE *pStr; const UNICODE *pStr;
pStr = t.pStr; pStr = t.pStr;
while (isgraph (*pStr)) while (isgraph (*pStr))
@@ -166,7 +166,8 @@ MakeReport (SOUND ReadOutSounds, UNICODE *pStr, COUNT StrLen)
if (t.pStr[0] == ',') if (t.pStr[0] == ',')
TimeOut += ONE_SECOND / 4; TimeOut += ONE_SECOND / 4;
if (t.pStr[0] == '.' || t.pStr[0] == '!' || t.pStr[0] == '?') if (t.pStr[0] == '.' || t.pStr[0] == '!' ||
t.pStr[0] == '?')
TimeOut += ONE_SECOND / 2; TimeOut += ONE_SECOND / 2;
else else
TimeOut += ONE_SECOND / 20; TimeOut += ONE_SECOND / 20;
+41 -27
View File
@@ -104,16 +104,18 @@ EraseCoarseScan (void)
} }
static void static void
PrintScanTitlePC (TEXT *t, RECT *r, char *txt, int xpos) PrintScanTitlePC (TEXT *t, RECT *r, const char *txt, int xpos)
{ {
t->baseline.x = xpos; t->baseline.x = xpos;
SetContextForeGroundColor (BUILD_COLOR (MAKE_RGB15 (0x00, 0x00, 0x15), 0x3B)); SetContextForeGroundColor (
wsprintf (t->pStr, txt); BUILD_COLOR (MAKE_RGB15 (0x00, 0x00, 0x15), 0x3B));
t->pStr = txt;
t->CharCount = (COUNT)~0; t->CharCount = (COUNT)~0;
font_DrawText (t); font_DrawText (t);
TextRect (t, r, NULL_PTR); TextRect (t, r, NULL_PTR);
t->baseline.x += r->extent.width; t->baseline.x += r->extent.width;
SetContextForeGroundColor (BUILD_COLOR (MAKE_RGB15 (0xF, 0x00, 0x19), 0x3B)); SetContextForeGroundColor (
BUILD_COLOR (MAKE_RGB15 (0xF, 0x00, 0x19), 0x3B));
} }
static void static void
@@ -184,7 +186,8 @@ PrintCoarseScanPC (void)
t.pStr = buf; t.pStr = buf;
t.CharCount = (COUNT)~0; t.CharCount = (COUNT)~0;
SetContextForeGroundColor (BUILD_COLOR (MAKE_RGB15 (0x00, 0x00, 0x15), 0x3B)); SetContextForeGroundColor (BUILD_COLOR (
MAKE_RGB15 (0x00, 0x00, 0x15), 0x3B));
SetContextFont (MicroFont); SetContextFont (MicroFont);
font_DrawText (&t); font_DrawText (&t);
SetContextFont (TinyFont); SetContextFont (TinyFont);
@@ -198,7 +201,6 @@ PrintCoarseScanPC (void)
t.align = ALIGN_LEFT; t.align = ALIGN_LEFT;
LockMutex (GraphicsLock); LockMutex (GraphicsLock);
t.pStr = buf;
PrintScanTitlePC (&t, &r, "Orbit: ", LEFT_SIDE_BASELINE_X_PC); PrintScanTitlePC (&t, &r, "Orbit: ", LEFT_SIDE_BASELINE_X_PC);
temp = (SIZE)((pSolarSysState->SysInfo.PlanetInfo.PlanetToSunDist * 100L temp = (SIZE)((pSolarSysState->SysInfo.PlanetInfo.PlanetToSunDist * 100L
+ (EARTH_RADIUS >> 1)) / EARTH_RADIUS); + (EARTH_RADIUS >> 1)) / EARTH_RADIUS);
@@ -206,13 +208,13 @@ PrintCoarseScanPC (void)
wsprintf (buf, "%u.%u a.u.", temp / 100, (temp / 10) % 10); wsprintf (buf, "%u.%u a.u.", temp / 100, (temp / 10) % 10);
else else
wsprintf (buf, "%u.%02u a.u.", temp / 100, temp % 100); wsprintf (buf, "%u.%02u a.u.", temp / 100, temp % 100);
t.pStr = buf;
t.CharCount = (COUNT)~0; t.CharCount = (COUNT)~0;
font_DrawText (&t); font_DrawText (&t);
t.baseline.y += SCAN_LEADING_PC; t.baseline.y += SCAN_LEADING_PC;
UnlockMutex (GraphicsLock); UnlockMutex (GraphicsLock);
LockMutex (GraphicsLock); LockMutex (GraphicsLock);
t.pStr = buf;
PrintScanTitlePC (&t, &r, "Atmo: ", LEFT_SIDE_BASELINE_X_PC); PrintScanTitlePC (&t, &r, "Atmo: ", LEFT_SIDE_BASELINE_X_PC);
if (pSolarSysState->SysInfo.PlanetInfo.AtmoDensity == GAS_GIANT_ATMOSPHERE) if (pSolarSysState->SysInfo.PlanetInfo.AtmoDensity == GAS_GIANT_ATMOSPHERE)
wsprintf (buf, "Super Thick"); wsprintf (buf, "Super Thick");
@@ -227,39 +229,48 @@ PrintCoarseScanPC (void)
else else
wsprintf (buf, "%u.%02u atm", temp / 100, temp % 100); wsprintf (buf, "%u.%02u atm", temp / 100, temp % 100);
} }
t.pStr = buf;
t.CharCount = (COUNT)~0; t.CharCount = (COUNT)~0;
font_DrawText (&t); font_DrawText (&t);
t.baseline.y += SCAN_LEADING_PC; t.baseline.y += SCAN_LEADING_PC;
UnlockMutex (GraphicsLock); UnlockMutex (GraphicsLock);
LockMutex (GraphicsLock); LockMutex (GraphicsLock);
t.pStr = buf;
PrintScanTitlePC (&t, &r, "Temp: ", LEFT_SIDE_BASELINE_X_PC); PrintScanTitlePC (&t, &r, "Temp: ", LEFT_SIDE_BASELINE_X_PC);
wsprintf (buf, "%d^ c", pSolarSysState->SysInfo.PlanetInfo.SurfaceTemperature); wsprintf (buf, "%d^ c",
pSolarSysState->SysInfo.PlanetInfo.SurfaceTemperature);
t.pStr = buf;
t.CharCount = (COUNT)~0; t.CharCount = (COUNT)~0;
font_DrawText (&t); font_DrawText (&t);
t.baseline.y += SCAN_LEADING_PC; t.baseline.y += SCAN_LEADING_PC;
UnlockMutex (GraphicsLock); UnlockMutex (GraphicsLock);
LockMutex (GraphicsLock); LockMutex (GraphicsLock);
t.pStr = buf;
PrintScanTitlePC (&t, &r, "Weather: ", LEFT_SIDE_BASELINE_X_PC); PrintScanTitlePC (&t, &r, "Weather: ", LEFT_SIDE_BASELINE_X_PC);
if (pSolarSysState->SysInfo.PlanetInfo.AtmoDensity == 0) if (pSolarSysState->SysInfo.PlanetInfo.AtmoDensity == 0)
wsprintf (buf, "None"); t.pStr = "None";
else else
wsprintf (buf, "Class %u", pSolarSysState->SysInfo.PlanetInfo.Weather + 1); {
wsprintf (buf, "Class %u",
pSolarSysState->SysInfo.PlanetInfo.Weather + 1);
t.pStr = buf;
}
t.CharCount = (COUNT)~0; t.CharCount = (COUNT)~0;
font_DrawText (&t); font_DrawText (&t);
t.baseline.y += SCAN_LEADING_PC; t.baseline.y += SCAN_LEADING_PC;
UnlockMutex (GraphicsLock); UnlockMutex (GraphicsLock);
LockMutex (GraphicsLock); LockMutex (GraphicsLock);
t.pStr = buf;
PrintScanTitlePC (&t, &r, "Tectonics: ", LEFT_SIDE_BASELINE_X_PC); PrintScanTitlePC (&t, &r, "Tectonics: ", LEFT_SIDE_BASELINE_X_PC);
if (PLANSIZE (pSolarSysState->SysInfo.PlanetInfo.PlanDataPtr->Type) == GAS_GIANT) if (PLANSIZE (pSolarSysState->SysInfo.PlanetInfo.PlanDataPtr->Type) ==
wsprintf (buf, "None"); GAS_GIANT)
t.pStr = "None";
else else
wsprintf (buf, "Class %u", pSolarSysState->SysInfo.PlanetInfo.Tectonics + 1); {
wsprintf (buf, "Class %u",
pSolarSysState->SysInfo.PlanetInfo.Tectonics + 1);
t.pStr = buf;
}
t.CharCount = (COUNT)~0; t.CharCount = (COUNT)~0;
font_DrawText (&t); font_DrawText (&t);
UnlockMutex (GraphicsLock); UnlockMutex (GraphicsLock);
@@ -267,43 +278,44 @@ PrintCoarseScanPC (void)
t.baseline.y = SCAN_BASELINE_Y_PC; t.baseline.y = SCAN_BASELINE_Y_PC;
LockMutex (GraphicsLock); LockMutex (GraphicsLock);
t.pStr = buf;
PrintScanTitlePC (&t, &r, "Mass: ", RIGHT_SIDE_BASELINE_X_PC); PrintScanTitlePC (&t, &r, "Mass: ", RIGHT_SIDE_BASELINE_X_PC);
{ {
DWORD tr; DWORD tr;
tr = pSolarSysState->SysInfo.PlanetInfo.PlanetRadius; tr = pSolarSysState->SysInfo.PlanetInfo.PlanetRadius;
if ((tr = (tr * tr * tr / 100L tr = (tr * tr * tr / 100L
* (DWORD)pSolarSysState->SysInfo.PlanetInfo.PlanetDensity * (DWORD)pSolarSysState->SysInfo.PlanetInfo.PlanetDensity
+ (DWORD)((100L * 100L) >> 1)) + (DWORD)((100L * 100L) >> 1)) / (DWORD)(100L * 100L);
/ (DWORD)(100L * 100L)) == 0) if (tr == 0)
tr = 1; tr = 1;
if (tr >= 10 * 100) if (tr >= 10 * 100)
wsprintf (buf, "%lu.%lu e.s.", tr / 100, (tr / 10) % 10); wsprintf (buf, "%lu.%lu e.s.", tr / 100, (tr / 10) % 10);
else else
wsprintf (buf, "%lu.%02lu e.s.", tr / 100, tr % 100); wsprintf (buf, "%lu.%02lu e.s.", tr / 100, tr % 100);
} }
t.pStr = buf;
t.CharCount = (COUNT)~0; t.CharCount = (COUNT)~0;
font_DrawText (&t); font_DrawText (&t);
t.baseline.y += SCAN_LEADING_PC; t.baseline.y += SCAN_LEADING_PC;
UnlockMutex (GraphicsLock); UnlockMutex (GraphicsLock);
LockMutex (GraphicsLock); LockMutex (GraphicsLock);
t.pStr = buf;
PrintScanTitlePC (&t, &r, "Radius: ", RIGHT_SIDE_BASELINE_X_PC); PrintScanTitlePC (&t, &r, "Radius: ", RIGHT_SIDE_BASELINE_X_PC);
if ((temp = pSolarSysState->SysInfo.PlanetInfo.PlanetRadius) >= 10 * 100) temp = pSolarSysState->SysInfo.PlanetInfo.PlanetRadius;
if (temp >= 10 * 100)
wsprintf (buf, "%u.%u e.s.", temp / 100, (temp / 10) % 10); wsprintf (buf, "%u.%u e.s.", temp / 100, (temp / 10) % 10);
else else
wsprintf (buf, "%u.%02u e.s.", temp / 100, temp % 100); wsprintf (buf, "%u.%02u e.s.", temp / 100, temp % 100);
t.pStr = buf;
t.CharCount = (COUNT)~0; t.CharCount = (COUNT)~0;
font_DrawText (&t); font_DrawText (&t);
t.baseline.y += SCAN_LEADING_PC; t.baseline.y += SCAN_LEADING_PC;
UnlockMutex (GraphicsLock); UnlockMutex (GraphicsLock);
LockMutex (GraphicsLock); LockMutex (GraphicsLock);
t.pStr = buf;
PrintScanTitlePC (&t, &r, "Gravity: ", RIGHT_SIDE_BASELINE_X_PC); PrintScanTitlePC (&t, &r, "Gravity: ", RIGHT_SIDE_BASELINE_X_PC);
if ((temp = pSolarSysState->SysInfo.PlanetInfo.SurfaceGravity) >= 10 * 100) temp = pSolarSysState->SysInfo.PlanetInfo.SurfaceGravity;
if (temp >= 10 * 100)
wsprintf (buf, "%u.%u g.", temp / 100, (temp / 10) % 10); wsprintf (buf, "%u.%u g.", temp / 100, (temp / 10) % 10);
else else
{ {
@@ -311,17 +323,18 @@ PrintCoarseScanPC (void)
temp = 1; temp = 1;
wsprintf (buf, "%u.%02u g.", temp / 100, temp % 100); wsprintf (buf, "%u.%02u g.", temp / 100, temp % 100);
} }
t.pStr = buf;
t.CharCount = (COUNT)~0; t.CharCount = (COUNT)~0;
font_DrawText (&t); font_DrawText (&t);
t.baseline.y += SCAN_LEADING_PC; t.baseline.y += SCAN_LEADING_PC;
UnlockMutex (GraphicsLock); UnlockMutex (GraphicsLock);
LockMutex (GraphicsLock); LockMutex (GraphicsLock);
t.pStr = buf;
PrintScanTitlePC (&t, &r, "Day: ", RIGHT_SIDE_BASELINE_X_PC); PrintScanTitlePC (&t, &r, "Day: ", RIGHT_SIDE_BASELINE_X_PC);
if (pSolarSysState->SysInfo.PlanetInfo.RotationPeriod < 240 * 10) if (pSolarSysState->SysInfo.PlanetInfo.RotationPeriod < 240 * 10)
{ {
temp = (SIZE)(pSolarSysState->SysInfo.PlanetInfo.RotationPeriod * 10 / 24); temp = (SIZE)(pSolarSysState->SysInfo.PlanetInfo.RotationPeriod *
10 / 24);
wsprintf (buf, "%u.%02u days", temp / 100, temp % 100); wsprintf (buf, "%u.%02u days", temp / 100, temp % 100);
} }
else else
@@ -330,16 +343,17 @@ PrintCoarseScanPC (void)
+ (24 >> 1)) / 24); + (24 >> 1)) / 24);
wsprintf (buf, "%u.%u days", temp / 10, temp % 10); wsprintf (buf, "%u.%u days", temp / 10, temp % 10);
} }
t.pStr = buf;
t.CharCount = (COUNT)~0; t.CharCount = (COUNT)~0;
font_DrawText (&t); font_DrawText (&t);
t.baseline.y += SCAN_LEADING_PC; t.baseline.y += SCAN_LEADING_PC;
UnlockMutex (GraphicsLock); UnlockMutex (GraphicsLock);
LockMutex (GraphicsLock); LockMutex (GraphicsLock);
t.pStr = buf;
PrintScanTitlePC (&t, &r, "Tilt: ", RIGHT_SIDE_BASELINE_X_PC); PrintScanTitlePC (&t, &r, "Tilt: ", RIGHT_SIDE_BASELINE_X_PC);
if ((temp = pSolarSysState->SysInfo.PlanetInfo.AxialTilt) < 0) if ((temp = pSolarSysState->SysInfo.PlanetInfo.AxialTilt) < 0)
temp = -temp; temp = -temp;
t.pStr = buf;
wsprintf (buf, "%u^", temp); wsprintf (buf, "%u^", temp);
t.CharCount = (COUNT)~0; t.CharCount = (COUNT)~0;
font_DrawText (&t); font_DrawText (&t);
+4 -4
View File
@@ -95,17 +95,17 @@ extern int ScreenHeight;
static inline COORD static inline COORD
logxToUniverse (long lx) logxToUniverse (long lx)
{ {
return (lx * ((MAX_X_UNIVERSE + 1) >> 4)) * 10 return (COORD) ((lx * ((MAX_X_UNIVERSE + 1) >> 4)) * 10
/ ((long) ((LOG_SPACE_WIDTH) >> 4) * SECTOR_WIDTH); / ((long) ((LOG_SPACE_WIDTH) >> 4) * SECTOR_WIDTH));
} }
#define LOGX_TO_UNIVERSE(lx) \ #define LOGX_TO_UNIVERSE(lx) \
logxToUniverse (lx) logxToUniverse (lx)
static inline COORD static inline COORD
logyToUniverse (long ly) logyToUniverse (long ly)
{ {
return MAX_Y_UNIVERSE - return (COORD) (MAX_Y_UNIVERSE -
(COORD)(((long) (ly) * ((MAX_Y_UNIVERSE + 1) >> 4)) (COORD)(((long) (ly) * ((MAX_Y_UNIVERSE + 1) >> 4))
/ ((long) ((LOG_SPACE_HEIGHT) >> 4) * SECTOR_HEIGHT)); / ((long) ((LOG_SPACE_HEIGHT) >> 4) * SECTOR_HEIGHT)));
} }
#define LOGY_TO_UNIVERSE(ly) \ #define LOGY_TO_UNIVERSE(ly) \
logyToUniverse (ly) logyToUniverse (ly)