64 bits fixes.
git-svn-id: svn://svn.code.sf.net/p/sc2/code/trunk@2306 8092fc87-c524-0410-9efc-e669fe64eaf9
This commit is contained in:
@@ -51,7 +51,7 @@ typedef struct
|
|||||||
|
|
||||||
EXTENDED_STAR_DESC SD;
|
EXTENDED_STAR_DESC SD;
|
||||||
|
|
||||||
long log_x, log_y;
|
SDWORD log_x, log_y;
|
||||||
} ENCOUNTER;
|
} ENCOUNTER;
|
||||||
typedef ENCOUNTER *PENCOUNTER;
|
typedef ENCOUNTER *PENCOUNTER;
|
||||||
|
|
||||||
|
|||||||
+19
-24
@@ -258,9 +258,7 @@ DrawDescriptionString (PMENU_STATE pMS, COUNT which_string, COUNT state)
|
|||||||
}
|
}
|
||||||
|
|
||||||
SetContextFont (Font);
|
SetContextFont (Font);
|
||||||
// XXX: nasty hack; CurString may not be large enough to
|
lf.pStr = ((GAME_DESC *)pMS->Extra)[rel_index];
|
||||||
// contain a pointer on some platforms
|
|
||||||
lf.pStr = ((GAME_DESC *)pMS->CurString)[rel_index];
|
|
||||||
lf.CharCount = (COUNT)~0;
|
lf.CharCount = (COUNT)~0;
|
||||||
|
|
||||||
if (!(state & DDSHS_EDIT))
|
if (!(state & DDSHS_EDIT))
|
||||||
@@ -382,12 +380,10 @@ DoNaming (PMENU_STATE pMS)
|
|||||||
// first_item.x - current cursor position
|
// first_item.x - current cursor position
|
||||||
// first_item.y - must be set to 0; DrawDescriptionString()
|
// first_item.y - must be set to 0; DrawDescriptionString()
|
||||||
// treats it as base index into array of strings
|
// treats it as base index into array of strings
|
||||||
// supplied in CurString
|
// supplied in Extra
|
||||||
pMS->first_item.x = 0;
|
pMS->first_item.x = 0;
|
||||||
pMS->first_item.y = 0;
|
pMS->first_item.y = 0;
|
||||||
// XXX: nasty hack; CurString may not be large enough to
|
pMS->Extra = buf;
|
||||||
// contain a pointer on some platforms
|
|
||||||
pMS->CurString = (STRING)buf;
|
|
||||||
DrawDescriptionString (pMS, 0, DDSHS_EDIT);
|
DrawDescriptionString (pMS, 0, DDSHS_EDIT);
|
||||||
|
|
||||||
LockMutex (GraphicsLock);
|
LockMutex (GraphicsLock);
|
||||||
@@ -586,7 +582,7 @@ DrawCargo (COUNT redraw_state)
|
|||||||
if (pLocMenuState->delta_item == SAVE_GAME)
|
if (pLocMenuState->delta_item == SAVE_GAME)
|
||||||
s.frame = DecFrameIndex (s.frame);
|
s.frame = DecFrameIndex (s.frame);
|
||||||
DrawStamp (&s);
|
DrawStamp (&s);
|
||||||
if (((SUMMARY_DESC *)pLocMenuState->CurString)
|
if (((SUMMARY_DESC *)pLocMenuState->Extra)
|
||||||
[pLocMenuState->CurState].year_index == 0)
|
[pLocMenuState->CurState].year_index == 0)
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
@@ -607,7 +603,7 @@ DrawCargo (COUNT redraw_state)
|
|||||||
);
|
);
|
||||||
if (redraw_state == 2
|
if (redraw_state == 2
|
||||||
|| (redraw_state == 1
|
|| (redraw_state == 1
|
||||||
/*&& !(((SUMMARY_DESC *)pLocMenuState->CurString)
|
/*&& !(((SUMMARY_DESC *)pLocMenuState->Extra)
|
||||||
[pLocMenuState->CurState].Flags & AFTER_BOMB_INSTALLED)*/))
|
[pLocMenuState->CurState].Flags & AFTER_BOMB_INSTALLED)*/))
|
||||||
{
|
{
|
||||||
s.origin.x = 7 + SUMMARY_X_OFFS - SUMMARY_SIDE_OFFS + 3;
|
s.origin.x = 7 + SUMMARY_X_OFFS - SUMMARY_SIDE_OFFS + 3;
|
||||||
@@ -945,7 +941,7 @@ DoPickGame (PMENU_STATE pMS)
|
|||||||
BatchGraphics ();
|
BatchGraphics ();
|
||||||
Restart:
|
Restart:
|
||||||
SetContext (SpaceContext);
|
SetContext (SpaceContext);
|
||||||
LoadGameDescriptions ((SUMMARY_DESC *)pMS->CurString);
|
LoadGameDescriptions ((SUMMARY_DESC *)pMS->Extra);
|
||||||
DrawCargo (1);
|
DrawCargo (1);
|
||||||
pMS->Initialized = TRUE;
|
pMS->Initialized = TRUE;
|
||||||
goto ChangeGameSelection;
|
goto ChangeGameSelection;
|
||||||
@@ -973,7 +969,7 @@ Restart:
|
|||||||
}
|
}
|
||||||
else if (PulsedInputState.key[KEY_MENU_SELECT])
|
else if (PulsedInputState.key[KEY_MENU_SELECT])
|
||||||
{
|
{
|
||||||
pSD = &((SUMMARY_DESC *)pMS->CurString)[pMS->CurState];
|
pSD = &((SUMMARY_DESC *)pMS->Extra)[pMS->CurState];
|
||||||
prev_save = pMS->CurState;
|
prev_save = pMS->CurState;
|
||||||
if (pMS->delta_item == SAVE_GAME || pSD->year_index)
|
if (pMS->delta_item == SAVE_GAME || pSD->year_index)
|
||||||
{
|
{
|
||||||
@@ -1076,24 +1072,24 @@ Restart:
|
|||||||
LockMutex (GraphicsLock);
|
LockMutex (GraphicsLock);
|
||||||
|
|
||||||
BatchGraphics ();
|
BatchGraphics ();
|
||||||
if (((SUMMARY_DESC *)pMS->CurString)[NewState].year_index != 0)
|
if (((SUMMARY_DESC *)pMS->Extra)[NewState].year_index != 0)
|
||||||
{
|
{
|
||||||
if (!(((SUMMARY_DESC *)pMS->CurString)[NewState].Flags
|
if (!(((SUMMARY_DESC *)pMS->Extra)[NewState].Flags
|
||||||
& AFTER_BOMB_INSTALLED))
|
& AFTER_BOMB_INSTALLED))
|
||||||
{
|
{
|
||||||
if (((SUMMARY_DESC *)pMS->CurString)[pMS->CurState].year_index == 0)
|
if (((SUMMARY_DESC *)pMS->Extra)[pMS->CurState].year_index == 0)
|
||||||
DrawCargo (1);
|
DrawCargo (1);
|
||||||
else if (((SUMMARY_DESC *)pMS->CurString)[pMS->CurState].Flags
|
else if (((SUMMARY_DESC *)pMS->Extra)[pMS->CurState].Flags
|
||||||
& AFTER_BOMB_INSTALLED)
|
& AFTER_BOMB_INSTALLED)
|
||||||
DrawCargo (2);
|
DrawCargo (2);
|
||||||
}
|
}
|
||||||
else if (((SUMMARY_DESC *)pMS->CurString)[pMS->CurState].year_index == 0)
|
else if (((SUMMARY_DESC *)pMS->Extra)[pMS->CurState].year_index == 0)
|
||||||
DrawCargo (3);
|
DrawCargo (3);
|
||||||
}
|
}
|
||||||
|
|
||||||
ChangeGameSelection:
|
ChangeGameSelection:
|
||||||
pMS->CurState = NewState;
|
pMS->CurState = NewState;
|
||||||
ShowSummary (&((SUMMARY_DESC *)pMS->CurString)[pMS->CurState]);
|
ShowSummary (&((SUMMARY_DESC *)pMS->Extra)[pMS->CurState]);
|
||||||
|
|
||||||
SetContextFont (TinyFont);
|
SetContextFont (TinyFont);
|
||||||
r.extent.width = 240;
|
r.extent.width = 240;
|
||||||
@@ -1146,14 +1142,14 @@ ChangeGameSelection:
|
|||||||
DrawRectangle (&r);
|
DrawRectangle (&r);
|
||||||
|
|
||||||
t.baseline.x = r.corner.x + 3;
|
t.baseline.x = r.corner.x + 3;
|
||||||
if (((SUMMARY_DESC *)pMS->CurString)[NewState - SHIFT + i].year_index == 0)
|
if (((SUMMARY_DESC *)pMS->Extra)[NewState - SHIFT + i].year_index == 0)
|
||||||
sprintf (buf, GAME_STRING (SAVEGAME_STRING_BASE + 3)); // "Empty Slot"
|
sprintf (buf, GAME_STRING (SAVEGAME_STRING_BASE + 3)); // "Empty Slot"
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
DateToString (buf2, sizeof buf2,
|
DateToString (buf2, sizeof buf2,
|
||||||
((SUMMARY_DESC *)pMS->CurString)[NewState - SHIFT + i].month_index,
|
((SUMMARY_DESC *)pMS->Extra)[NewState - SHIFT + i].month_index,
|
||||||
((SUMMARY_DESC *)pMS->CurString)[NewState - SHIFT + i].day_index,
|
((SUMMARY_DESC *)pMS->Extra)[NewState - SHIFT + i].day_index,
|
||||||
((SUMMARY_DESC *)pMS->CurString)[NewState - SHIFT + i].year_index);
|
((SUMMARY_DESC *)pMS->Extra)[NewState - SHIFT + i].year_index);
|
||||||
sprintf (buf, "%s %s", GAME_STRING (SAVEGAME_STRING_BASE + 4), buf2); // "Saved Game - Date:"
|
sprintf (buf, "%s %s", GAME_STRING (SAVEGAME_STRING_BASE + 4), buf2); // "Saved Game - Date:"
|
||||||
}
|
}
|
||||||
font_DrawText (&t);
|
font_DrawText (&t);
|
||||||
@@ -1214,12 +1210,11 @@ PickGame (PMENU_STATE pMS)
|
|||||||
DlgRect.extent.width = SIS_SCREEN_WIDTH;
|
DlgRect.extent.width = SIS_SCREEN_WIDTH;
|
||||||
DlgRect.extent.height = SIS_SCREEN_HEIGHT;
|
DlgRect.extent.height = SIS_SCREEN_HEIGHT;
|
||||||
DlgStamp.frame = CaptureDrawable (LoadDisplayPixmap (
|
DlgStamp.frame = CaptureDrawable (LoadDisplayPixmap (
|
||||||
&DlgRect, (FRAME)0)
|
&DlgRect, (FRAME)0));
|
||||||
);
|
|
||||||
|
|
||||||
pMS->Initialized = FALSE;
|
pMS->Initialized = FALSE;
|
||||||
pMS->InputFunc = DoPickGame;
|
pMS->InputFunc = DoPickGame;
|
||||||
pMS->CurString = (STRING)&desc_array[0];
|
pMS->Extra = desc_array;
|
||||||
UnlockMutex (GraphicsLock);
|
UnlockMutex (GraphicsLock);
|
||||||
|
|
||||||
DoInput (pMS, TRUE);
|
DoInput (pMS, TRUE);
|
||||||
|
|||||||
@@ -369,7 +369,7 @@ FreeHyperspace (void)
|
|||||||
static void
|
static void
|
||||||
ElementToUniverse (ELEMENTPTR ElementPtr, PPOINT pPt)
|
ElementToUniverse (ELEMENTPTR ElementPtr, PPOINT pPt)
|
||||||
{
|
{
|
||||||
long log_x, log_y;
|
SDWORD log_x, log_y;
|
||||||
|
|
||||||
log_x = GLOBAL_SIS (log_x)
|
log_x = GLOBAL_SIS (log_x)
|
||||||
+ (ElementPtr->next.location.x - (LOG_SPACE_WIDTH >> 1));
|
+ (ElementPtr->next.location.x - (LOG_SPACE_WIDTH >> 1));
|
||||||
|
|||||||
@@ -595,7 +595,7 @@ SpliceTrack (UNICODE *TrackName, UNICODE *TrackText, UNICODE *TimeStamp, TFB_Tra
|
|||||||
sound_sample->callbacks = trackCBs;
|
sound_sample->callbacks = trackCBs;
|
||||||
sound_sample->num_buffers = 8;
|
sound_sample->num_buffers = 8;
|
||||||
sound_sample->buffer_tag = HCalloc (sizeof (TFB_SoundTag) * sound_sample->num_buffers);
|
sound_sample->buffer_tag = HCalloc (sizeof (TFB_SoundTag) * sound_sample->num_buffers);
|
||||||
sound_sample->buffer = HMalloc (sizeof (uint32) * sound_sample->num_buffers);
|
sound_sample->buffer = HMalloc (sizeof (audio_Object) * sound_sample->num_buffers);
|
||||||
audio_GenBuffers (sound_sample->num_buffers, sound_sample->buffer);
|
audio_GenBuffers (sound_sample->num_buffers, sound_sample->buffer);
|
||||||
decoder = SoundDecoder_Load (contentDir, TrackName, 4096,
|
decoder = SoundDecoder_Load (contentDir, TrackName, 4096,
|
||||||
startTime, time_stamps[page_counter]);
|
startTime, time_stamps[page_counter]);
|
||||||
|
|||||||
+18
-2
@@ -163,6 +163,20 @@ LoadGame (COUNT which_game, SUMMARY_DESC *summary_desc)
|
|||||||
return TRUE;
|
return TRUE;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Crude check for big-endian/little-endian incompatibilities.
|
||||||
|
// year_index is suitable as it's a multi-byte value within
|
||||||
|
// a specific recognisable range.
|
||||||
|
if (summary_desc->year_index < START_YEAR ||
|
||||||
|
summary_desc->year_index >= START_YEAR +
|
||||||
|
YEARS_TO_KOHRAH_VICTORY + 1 /* Utwig intervention */ +
|
||||||
|
1 /* time to destroy all races, plenty */)
|
||||||
|
{
|
||||||
|
fprintf (stderr, "Warning: Savegame corrupt or from an "
|
||||||
|
"an incompatible platform.\n");
|
||||||
|
res_CloseResFile (in_fp);
|
||||||
|
return FALSE;
|
||||||
|
}
|
||||||
|
|
||||||
GlobData.SIS_state = summary_desc->SS;
|
GlobData.SIS_state = summary_desc->SS;
|
||||||
|
|
||||||
if ((fh = copen (in_fp, FILE_STREAM, STREAM_READ)) == 0)
|
if ((fh = copen (in_fp, FILE_STREAM, STREAM_READ)) == 0)
|
||||||
@@ -187,7 +201,8 @@ LoadGame (COUNT which_game, SUMMARY_DESC *summary_desc)
|
|||||||
memset ((PBYTE)&GLOBAL (GameState[0]),
|
memset ((PBYTE)&GLOBAL (GameState[0]),
|
||||||
0, sizeof (GLOBAL (GameState)));
|
0, sizeof (GLOBAL (GameState)));
|
||||||
Activity = GLOBAL (CurrentActivity);
|
Activity = GLOBAL (CurrentActivity);
|
||||||
cread ((PBYTE)&GlobData.Game_state, sizeof (GlobData.Game_state), 1, fh);
|
cread ((PBYTE)&GlobData.Game_state, sizeof (GlobData.Game_state), 1,
|
||||||
|
fh);
|
||||||
NextActivity = GLOBAL (CurrentActivity);
|
NextActivity = GLOBAL (CurrentActivity);
|
||||||
GLOBAL (CurrentActivity) = Activity;
|
GLOBAL (CurrentActivity) = Activity;
|
||||||
|
|
||||||
@@ -202,7 +217,8 @@ LoadGame (COUNT which_game, SUMMARY_DESC *summary_desc)
|
|||||||
// But if it does happen, it needs to be reset to 0, since on load
|
// But if it does happen, it needs to be reset to 0, since on load
|
||||||
// the clock semaphore is gauranteed to be 0
|
// the clock semaphore is gauranteed to be 0
|
||||||
if (GLOBAL (GameClock.TimeCounter) != 0)
|
if (GLOBAL (GameClock.TimeCounter) != 0)
|
||||||
fprintf (stderr, "Warning: Game clock wasn't stopped during save, Savegame may be corrupt!\n");
|
fprintf (stderr, "Warning: Game clock wasn't stopped during "
|
||||||
|
"save, Savegame may be corrupt!\n");
|
||||||
GLOBAL (GameClock.TimeCounter) = 0;
|
GLOBAL (GameClock.TimeCounter) = 0;
|
||||||
|
|
||||||
LoadShipQueue (fh, &GLOBAL (avail_race_q), FALSE);
|
LoadShipQueue (fh, &GLOBAL (avail_race_q), FALSE);
|
||||||
|
|||||||
@@ -43,6 +43,8 @@ typedef struct menu_state
|
|||||||
FRAME flash_frame0, flash_frame1;
|
FRAME flash_frame0, flash_frame1;
|
||||||
|
|
||||||
MUSIC_REF hMusic;
|
MUSIC_REF hMusic;
|
||||||
|
|
||||||
|
void *Extra;
|
||||||
} MENU_STATE;
|
} MENU_STATE;
|
||||||
|
|
||||||
typedef MENU_STATE *PMENU_STATE;
|
typedef MENU_STATE *PMENU_STATE;
|
||||||
|
|||||||
@@ -198,7 +198,7 @@ enum
|
|||||||
|
|
||||||
typedef struct
|
typedef struct
|
||||||
{
|
{
|
||||||
long log_x, log_y;
|
SDWORD log_x, log_y;
|
||||||
|
|
||||||
DWORD ResUnits;
|
DWORD ResUnits;
|
||||||
|
|
||||||
|
|||||||
+10
-10
@@ -93,36 +93,36 @@ extern int ScreenHeight;
|
|||||||
#define UNIT_SCREEN_HEIGHT 50
|
#define UNIT_SCREEN_HEIGHT 50
|
||||||
|
|
||||||
static inline COORD
|
static inline COORD
|
||||||
logxToUniverse (long lx)
|
logxToUniverse (SDWORD lx)
|
||||||
{
|
{
|
||||||
return (COORD) ((lx * ((MAX_X_UNIVERSE + 1) >> 4)) * 10
|
return (COORD) ((lx * ((MAX_X_UNIVERSE + 1) >> 4)) * 10
|
||||||
/ ((long) ((LOG_SPACE_WIDTH) >> 4) * SECTOR_WIDTH));
|
/ ((SDWORD) ((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 (SDWORD ly)
|
||||||
{
|
{
|
||||||
return (COORD) (MAX_Y_UNIVERSE -
|
return (COORD) (MAX_Y_UNIVERSE -
|
||||||
(COORD)(((long) (ly) * ((MAX_Y_UNIVERSE + 1) >> 4))
|
(COORD)(((SDWORD) (ly) * ((MAX_Y_UNIVERSE + 1) >> 4))
|
||||||
/ ((long) ((LOG_SPACE_HEIGHT) >> 4) * SECTOR_HEIGHT)));
|
/ ((SDWORD) ((LOG_SPACE_HEIGHT) >> 4) * SECTOR_HEIGHT)));
|
||||||
}
|
}
|
||||||
#define LOGY_TO_UNIVERSE(ly) \
|
#define LOGY_TO_UNIVERSE(ly) \
|
||||||
logyToUniverse (ly)
|
logyToUniverse (ly)
|
||||||
static inline long
|
static inline SDWORD
|
||||||
universeToLogx (COORD ux)
|
universeToLogx (COORD ux)
|
||||||
{
|
{
|
||||||
return ((long) ux * ((long) ((LOG_SPACE_WIDTH) >> 4) * SECTOR_WIDTH)
|
return ((SDWORD) ux * ((SDWORD) ((LOG_SPACE_WIDTH) >> 4) * SECTOR_WIDTH)
|
||||||
+ ((((MAX_X_UNIVERSE + 1) >> 4) * 10) >> 1))
|
+ ((((MAX_X_UNIVERSE + 1) >> 4) * 10) >> 1))
|
||||||
/ (((MAX_X_UNIVERSE + 1) >> 4) * 10);
|
/ (((MAX_X_UNIVERSE + 1) >> 4) * 10);
|
||||||
}
|
}
|
||||||
#define UNIVERSE_TO_LOGX(ux) \
|
#define UNIVERSE_TO_LOGX(ux) \
|
||||||
universeToLogx (ux)
|
universeToLogx (ux)
|
||||||
static inline long
|
static inline SDWORD
|
||||||
universeToLogy (COORD uy)
|
universeToLogy (COORD uy)
|
||||||
{
|
{
|
||||||
return ((long) (MAX_Y_UNIVERSE - uy)
|
return ((SDWORD) (MAX_Y_UNIVERSE - uy)
|
||||||
* ((long) ((LOG_SPACE_HEIGHT) >> 4) * SECTOR_HEIGHT)
|
* ((SDWORD) ((LOG_SPACE_HEIGHT) >> 4) * SECTOR_HEIGHT)
|
||||||
+ (((MAX_Y_UNIVERSE + 1) >> 4) >> 1))
|
+ (((MAX_Y_UNIVERSE + 1) >> 4) >> 1))
|
||||||
/ ((MAX_Y_UNIVERSE + 1) >> 4);
|
/ ((MAX_Y_UNIVERSE + 1) >> 4);
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user