More restructuring, cleanups.

git-svn-id: svn://svn.code.sf.net/p/sc2/code/trunk@1480 8092fc87-c524-0410-9efc-e669fe64eaf9
This commit is contained in:
meep-eep
2005-01-22 21:40:47 +00:00
parent e6879b8ae1
commit 90dc0352fe
82 changed files with 888 additions and 508 deletions
+36
View File
@@ -151,6 +151,10 @@ SOURCE=..\sc2code\libs\file\temp.c
# Begin Group "graphics"
# PROP Default_Filter ""
# Begin Source File
SOURCE=..\sc2code\libs\graphics\prim.h
# End Source File
# Begin Group "sdl"
# PROP Default_Filter ""
@@ -3350,6 +3354,10 @@ SOURCE=..\sc2code\gameopt.c
# End Source File
# Begin Source File
SOURCE=..\sc2code\gameopt.h
# End Source File
# Begin Source File
SOURCE=..\sc2code\gamestr.h
# End Source File
# Begin Source File
@@ -3434,6 +3442,10 @@ SOURCE=..\sc2code\load.c
# End Source File
# Begin Source File
SOURCE=..\sc2code\load.h
# End Source File
# Begin Source File
SOURCE=..\sc2code\loadship.c
# End Source File
# Begin Source File
@@ -3442,6 +3454,10 @@ SOURCE=..\sc2code\master.c
# End Source File
# Begin Source File
SOURCE=..\sc2code\master.h
# End Source File
# Begin Source File
SOURCE=..\sc2code\melee.c
# End Source File
# Begin Source File
@@ -3478,6 +3494,10 @@ SOURCE=..\sc2code\pickmele.c
# End Source File
# Begin Source File
SOURCE=..\sc2code\pickmele.h
# End Source File
# Begin Source File
SOURCE=..\sc2code\pickship.c
# End Source File
# Begin Source File
@@ -3490,6 +3510,10 @@ SOURCE=..\sc2code\process.c
# End Source File
# Begin Source File
SOURCE=..\sc2code\process.h
# End Source File
# Begin Source File
SOURCE=..\sc2code\races.h
# End Source File
# Begin Source File
@@ -3506,6 +3530,10 @@ SOURCE=..\sc2code\restart.c
# End Source File
# Begin Source File
SOURCE=..\sc2code\restart.h
# End Source File
# Begin Source File
SOURCE=..\sc2code\restypes.h
# End Source File
# Begin Source File
@@ -3514,6 +3542,10 @@ SOURCE=..\sc2code\save.c
# End Source File
# Begin Source File
SOURCE=..\sc2code\save.h
# End Source File
# Begin Source File
SOURCE=..\sc2code\settings.c
# End Source File
# Begin Source File
@@ -3582,6 +3614,10 @@ SOURCE=..\sc2code\starcon.c
# End Source File
# Begin Source File
SOURCE=..\sc2code\starcon.h
# End Source File
# Begin Source File
SOURCE=..\sc2code\starmap.c
# End Source File
# Begin Source File
-2
View File
@@ -223,8 +223,6 @@ BOOLEAN
Battle (void)
{
SIZE num_ships;
extern SIZE InitShips (void);
void UninitShips (void);
LockMutex (GraphicsLock);
+6 -7
View File
@@ -17,9 +17,11 @@
*/
#include "battle.h"
#include "master.h"
#include "nameref.h"
#include "reslib.h"
#include "gamestr.h"
#include "init.h"
#include "setup.h"
#include "sounds.h"
#include "libs/sndlib.h"
@@ -33,23 +35,18 @@ void FreeLanderData (void);
void FreeIPData (void);
void FreeMasterShipList (void);
void UninitSpace (void);
void FreeHyperData (void);
//End Added by Chris
static void UninitContexts (void);
static void UninitKernel (BOOLEAN ships);
static void UninitGameKernel (void);
void
FreeKernel (void)
{
extern void UninitPlayerInput (void);
UninitKernel (TRUE);
UninitContexts ();
@@ -100,9 +97,10 @@ UninitKernel (BOOLEAN ships)
ActivityFrame = 0;
}
void
static void
UninitGameKernel (void)
{
// XXX: this function is never called. Why not? (BUG?)
if (ActivityFrame)
{
FreeSC2Data ();
@@ -115,3 +113,4 @@ UninitGameKernel (void)
}
}
+3 -1
View File
@@ -32,9 +32,11 @@
#define IsLeapYear(yi) (!((yi) & 3) && (((yi) % 100) || ((yi) % 400)))
static int clock_task_func(void* data);
static Mutex clock_mutex;
int clock_task_func(void* data)
static int clock_task_func(void* data)
{
BOOLEAN LastPilot;
DWORD LastTime;
+20 -16
View File
@@ -25,6 +25,7 @@
#include "endian_uqm.h"
#include "gamestr.h"
#include "options.h"
#include "oscill.h"
#include "resinst.h"
#include "settings.h"
#include "setup.h"
@@ -40,12 +41,12 @@
#include <ctype.h>
void InitOscilloscope (int x, int y, int width, int height, FRAME_DESC *f);
void SetSliderImage (void *f);
void InitSlider (int x, int y, int width, int height,
int bwidth, int bheight, void *f);
void Oscilloscope (int grab_data);
void Slider (void);
static void init_xform_control (void);
static void uninit_xform_control (void);
static void xform_complete (void);
static void xform_PLUT_step (SIZE TDelta);
static void FlushPLUTXForms (void);
static int ambient_anim_task (void *data);
#define MAX_RESPONSES 8
@@ -120,7 +121,7 @@ enum
static int subtitle_state = DONE_SUBTITLE;
static Mutex subtitle_mutex;
static volatile UNICODE *last_subtitle;
static const UNICODE * volatile last_subtitle;
static TFB_Image *subtitle_cache;
/* _count_lines - mostly stolen from add_text, just sees how many lines
@@ -129,7 +130,8 @@ static TFB_Image *subtitle_cache;
static int _count_lines (PTEXT pText)
{
COUNT maxchars = (COUNT)~0;
UNICODE ch, *pStr;
UNICODE ch;
const UNICODE *pStr;
SIZE text_width;
int num = 0;
@@ -186,7 +188,8 @@ add_text (int status, PTEXT pTextIn)
TEXT locText;
PTEXT pText;
SIZE leading;
UNICODE ch, *pStr;
UNICODE ch;
const UNICODE *pStr;
SIZE text_width;
int num_lines = 0;
static COORD last_baseline;
@@ -496,7 +499,7 @@ static struct {
Mutex XFormLock;
} XFormControl;
void
static void
init_xform_control (void)
{
XFormControl.XFormCurrent = XFormControl.XFormInsertPoint = 0;
@@ -504,13 +507,13 @@ init_xform_control (void)
XFormControl.XFormLock = CreateMutex ("Transform Lock", SYNC_CLASS_TOPLEVEL | SYNC_CLASS_VIDEO);
}
void
static void
uninit_xform_control (void)
{
DestroyMutex (XFormControl.XFormLock);
}
void
static void
xform_complete (void)
{
LockMutex (XFormControl.XFormLock);
@@ -557,7 +560,7 @@ static volatile BOOLEAN SummaryChange;
static volatile BOOLEAN ClearSubtitle;
/* Only one thread should ever be allowed to be calling this at any time */
void
static void
xform_PLUT_step (SIZE TDelta)
{
XFORM_CONTROL *control;
@@ -640,7 +643,7 @@ xform_PLUT_step (SIZE TDelta)
* writes are atomic anyway, and Flush is the only routine that writes
* XFormFlush. */
void
static void
FlushPLUTXForms (void)
{
while (XFormControl.XFormsPending)
@@ -859,7 +862,8 @@ UpdateSpeechGraphics (BOOLEAN Initialize)
SetContext (OldContext);
}
int ambient_anim_task(void* data)
static int
ambient_anim_task (void *data)
{
SIZE TalkAlarm;
FRAME TalkFrame;
@@ -1725,7 +1729,7 @@ DoCommunication (PENCOUNTER_STATE pES)
while (wstrlen (temp) > (unsigned int) SUMMARY_CHARS
&& !(GLOBAL (CurrentActivity) & CHECK_ABORT))
{
int space_index;
int space_index = SUMMARY_CHARS;
// find last space before it goes over the max chars per line
for (i = SUMMARY_CHARS - 1; i > 0; i--)
{
+1 -13
View File
@@ -21,6 +21,7 @@
* much.
*/
#include "dummy.h"
#include "coderes.h"
#include "races.h"
@@ -381,16 +382,3 @@ CreatePixmapRegion (FRAME Frame, PPOINT lpOrg, SIZE width, SIZE height)
}
void
SetPrimNextLink (PPRIMITIVE pPrim, COUNT Link)
{
SetPrimLinks (pPrim, END_OF_LIST, Link);
}
COUNT
GetPrimNextLink (PPRIMITIVE pPrim)
{
return (GetSuccLink (GetPrimLinks (pPrim)));
}
+5 -3
View File
@@ -17,12 +17,14 @@
#ifndef _DUMMY_H
#define _DUMMY_H
#include "libs/compiler.h"
#include "libs/gfxlib.h"
//extern MEM_HANDLE LoadVidInstance (DWORD res);
extern MEM_HANDLE LoadVidInstance (DWORD res);
extern MEM_HANDLE LoadCodeResFile (PSTR pStr);
//extern DRAWABLE CreatePixmapRegion (FRAME Frame, PPOINT pOrg, SIZE width,
// SIZE height);
extern DRAWABLE CreatePixmapRegion (FRAME Frame, PPOINT lpOrg, SIZE width,
SIZE height);
extern void SetPrimNextLink (PPRIMITIVE pPrim, COUNT Link);
extern COUNT GetPrimNextLink (PPRIMITIVE pPrim);
+44 -39
View File
@@ -22,6 +22,7 @@
#include "build.h"
#include "colors.h"
#include "controls.h"
#include "gameopt.h"
#include "gamestr.h"
#include "globdata.h"
#include "init.h"
@@ -31,12 +32,15 @@
#include "settings.h"
#include "setup.h"
#include "sounds.h"
#include "state.h"
#include "libs/graphics/gfx_common.h"
#include "libs/mathlib.h"
#include "libs/inplib.h"
static void DrawFadeText (const UNICODE *str1, const UNICODE *str2,
BOOLEAN fade_in, PRECT pRect);
static BOOLEAN
DoSelectAction (PMENU_STATE pMS)
{
@@ -348,8 +352,8 @@ InitEncounter (void)
}
static void
DrawFadeText (UNICODE *str1, UNICODE *str2, BOOLEAN fade_in, PRECT
pRect)
DrawFadeText (const UNICODE *str1, const UNICODE *str2, BOOLEAN fade_in,
PRECT pRect)
{
SIZE i;
DWORD TimeIn;
@@ -408,7 +412,8 @@ DrawFadeText (UNICODE *str1, UNICODE *str2, BOOLEAN fade_in, PRECT
SleepThreadUntil (TimeIn + (ONE_SECOND / 20));
TimeIn = GetTimeCounter ();
}
SetContextForeGroundColor (BUILD_COLOR (MAKE_RGB15 (0xA, 0xA, 0xA), 0x08));
SetContextForeGroundColor (BUILD_COLOR (MAKE_RGB15 (0xA, 0xA, 0xA),
0x08));
font_DrawText (&t1);
font_DrawText (&t2);
}
@@ -440,12 +445,14 @@ UninitEncounter (void)
BOOLEAN Sleepy;
DWORD Time;
SIZE VictoryState;
COUNT RecycleAmount;
COUNT RecycleAmount = 0;
SIZE i;
RECT r, scavenge_r;
TEXT t;
STAMP ship_s;
UNICODE *str1, *str2, buf[20];
const UNICODE *str1 = NULL;
const UNICODE *str2 = NULL;
UNICODE buf[20];
HSTARSHIP hStarShip;
SHIP_FRAGMENTPTR FragPtr;
COLOR fade_ship_cycle[] =
@@ -461,7 +468,9 @@ UninitEncounter (void)
BUILD_COLOR (MAKE_RGB15 (0x1B, 0x00, 0x00), 0x2A),
BUILD_COLOR (MAKE_RGB15 (0x17, 0x00, 0x00), 0x2B),
};
#define NUM_SHIP_FADES (sizeof (fade_ship_cycle) / sizeof (fade_ship_cycle[0]))
#define NUM_SHIP_FADES (sizeof (fade_ship_cycle) / \
sizeof (fade_ship_cycle[0]))
COUNT race_bounty[] =
{
RACE_SHIP_COST
@@ -476,12 +485,11 @@ UninitEncounter (void)
) ? 0 : 1;
hStarShip = GetHeadLink (&GLOBAL (npc_built_ship_q));
FragPtr = (SHIP_FRAGMENTPTR)LockStarShip (&GLOBAL (npc_built_ship_q), hStarShip);
FragPtr = (SHIP_FRAGMENTPTR)LockStarShip (&GLOBAL (npc_built_ship_q),
hStarShip);
battle_counter = GET_RACE_ID (FragPtr) + 1;
if (GetStarShipFromIndex (
&GLOBAL (avail_race_q),
(COUNT)(battle_counter - 1)
) == 0)
if (GetStarShipFromIndex (&GLOBAL (avail_race_q),
(COUNT)(battle_counter - 1)) == 0)
{
VictoryState = -1;
InitSISContexts ();
@@ -508,9 +516,7 @@ UninitEncounter (void)
DrawSISMessage (NULL_PTR);
if (LOBYTE (GLOBAL (CurrentActivity)) == IN_HYPERSPACE)
DrawHyperCoords (
GLOBAL (ShipStamp.origin)
);
DrawHyperCoords (GLOBAL (ShipStamp.origin));
else if (HIWORD (GLOBAL (ShipStamp.frame)) == 0)
DrawHyperCoords (CurStarDescPtr->star_pt);
else
@@ -525,7 +531,8 @@ UninitEncounter (void)
ReinitQueue (&race_q[(NUM_SIDES - 1) - i]);
for (hStarShip = GetHeadLink (pQueue); hStarShip; hStarShip = hNextShip)
for (hStarShip = GetHeadLink (pQueue); hStarShip;
hStarShip = hNextShip)
{
FragPtr = (SHIP_FRAGMENTPTR)LockStarShip (pQueue, hStarShip);
hNextShip = _GetSuccLink (FragPtr);
@@ -549,14 +556,16 @@ UninitEncounter (void)
ship_s.origin.x = scavenge_r.corner.x + 32;
ship_s.origin.y = scavenge_r.corner.y + 56;
ship_s.frame = IncFrameIndex (FragPtr->ShipInfo.icons);
ship_s.frame = IncFrameIndex (
FragPtr->ShipInfo.icons);
DrawStamp (&ship_s);
SetContextForeGroundColor (BUILD_COLOR (MAKE_RGB15 (0x8, 0x8, 0x8), 0x1F));
SetContextForeGroundColor (BUILD_COLOR (
MAKE_RGB15 (0x8, 0x8, 0x8), 0x1F));
SetContextFont (TinyFont);
GetStringContents (
FragPtr->ShipInfo.race_strings, (STRINGPTR)buf, FALSE
);
FragPtr->ShipInfo.race_strings,
(STRINGPTR)buf, FALSE);
wstrupr (buf);
t.baseline.x = scavenge_r.corner.x + 100;
@@ -566,19 +575,19 @@ UninitEncounter (void)
t.CharCount = (COUNT)~0;
font_DrawText (&t);
t.baseline.y += 6;
t.pStr = GAME_STRING (ENCOUNTER_STRING_BASE + 3);
t.pStr = GAME_STRING (
ENCOUNTER_STRING_BASE + 3);
t.CharCount = (COUNT)~0;
font_DrawText (&t);
ship_s.frame = FragPtr->ShipInfo.icons;
SetContextFont (MicroFont);
DrawFadeText (
str1 = GAME_STRING (ENCOUNTER_STRING_BASE + 4),
str2 = GAME_STRING (ENCOUNTER_STRING_BASE + 5),
TRUE,
&scavenge_r
);
str1 = GAME_STRING (
ENCOUNTER_STRING_BASE + 4);
str2 = GAME_STRING (
ENCOUNTER_STRING_BASE + 5),
DrawFadeText (str1, str2, TRUE, &scavenge_r);
}
r.corner.y = scavenge_r.corner.y + 9;
@@ -587,7 +596,8 @@ UninitEncounter (void)
SetContextForeGroundColor (BLACK_COLOR);
r.extent.width = 34;
r.corner.x = scavenge_r.corner.x + scavenge_r.extent.width
r.corner.x = scavenge_r.corner.x +
scavenge_r.extent.width
- (10 + r.extent.width);
DrawFilledRectangle (&r);
@@ -600,9 +610,8 @@ UninitEncounter (void)
t.align = ALIGN_RIGHT;
t.pStr = buf;
t.CharCount = (COUNT)~0;
SetContextForeGroundColor (
BUILD_COLOR (MAKE_RGB15 (0x00, 0x00, 0x18), 0x50)
);
SetContextForeGroundColor (BUILD_COLOR (
MAKE_RGB15 (0x00, 0x00, 0x18), 0x50));
font_DrawText (&t);
DeltaSISGauges (0, 0, j);
@@ -681,16 +690,12 @@ UninitEncounter (void)
t.pStr = buf;
t.CharCount = (COUNT)~0;
SetContextForeGroundColor (
BUILD_COLOR (MAKE_RGB15 (0x00, 0x00, 0x18), 0x50)
);
BUILD_COLOR (MAKE_RGB15 (0x00, 0x00, 0x18), 0x50));
font_DrawText (&t);
DrawFadeText (
str1 = GAME_STRING (ENCOUNTER_STRING_BASE + 6),
str2 = GAME_STRING (ENCOUNTER_STRING_BASE + 7),
TRUE,
&scavenge_r
);
str1 = GAME_STRING (ENCOUNTER_STRING_BASE + 6);
str2 = GAME_STRING (ENCOUNTER_STRING_BASE + 7);
DrawFadeText (str1, str2, TRUE, &scavenge_r);
Time = GetTimeCounter () + ONE_SECOND * 2;
UnlockMutex (GraphicsLock);
while (!(AnyButtonPress (TRUE))
+3 -7
View File
@@ -21,6 +21,7 @@
#include "controls.h"
#include "hyper.h"
#include "options.h"
#include "master.h"
#include "resinst.h"
#include "settings.h"
#include "setup.h"
@@ -29,16 +30,10 @@
#include "libs/inplib.h"
//Added by Chris
BOOLEAN InitGameKernel (void);
void LoadMasterShipList (void);
//End Added by Chris
void
DoShipSpin (COUNT index, MUSIC_REF hMusic)
{
#ifdef WANT_SHIP_SPINS
char buf[30];
BYTE clut_buf[1];
RECT old_r, r;
@@ -72,6 +67,7 @@ DoShipSpin (COUNT index, MUSIC_REF hMusic)
clut_buf[0] = FadeAllToColor;
SleepThreadUntil (XFormColorMap ((COLORMAPPTR)clut_buf, ONE_SECOND / 4));
FlushColorXForms ();
#endif /* WANT_SHIP_SPINS */
}
void
+9 -2
View File
@@ -17,13 +17,20 @@
#ifndef _FMV_H
#define _FMV_H
#include "libs/compiler.h"
extern void Logo (void);
extern void Introduction (void);
extern void Victory (void);
#ifdef WANT_SHIP_SPINS
#include "libs/sndlib.h"
extern void DoShipSpin (COUNT index, MUSIC_REF hMusic);
#endif
extern BOOLEAN DoFMV (const char *name, const char *loopname,
BOOLEAN uninit);
extern BOOLEAN ShowPresentation (const char *name);
#endif /* _FMV_H */
+3
View File
@@ -18,6 +18,7 @@
#define _GAMEEV_H
#include "libs/compiler.h"
#include "libs/gfxlib.h"
enum
@@ -52,6 +53,8 @@ typedef enum
extern void AddInitialGameEvents (void);
extern void EventHandler (BYTE selector);
extern void SetRaceDest (BYTE which_race, COORD x, COORD y, BYTE days_left,
BYTE func_index);
#endif /* _GAMEEV_H */
+1
View File
@@ -21,6 +21,7 @@
#include "planets/planets.h"
#include "settings.h"
#include "sounds.h"
#include "libs/inplib.h"
#include "libs/timelib.h"
#include "libs/threadlib.h"
+8 -16
View File
@@ -16,14 +16,18 @@
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
*/
#include "gameopt.h"
#include "build.h"
#include "colors.h"
#include "commglue.h"
#include "controls.h"
#include "encount.h"
#include "gamestr.h"
#include "options.h"
#include "inplib.h"
#include "load.h"
#include "options.h"
#include "save.h"
#include "settings.h"
#include "setup.h"
#include "sounds.h"
@@ -34,12 +38,6 @@
#include <ctype.h>
//Added by Chris
void SaveProblem (void);
//End Added by Chris
#define MAX_SAVED_GAMES 50
#define SUMMARY_X_OFFS 14
#define SUMMARY_SIDE_OFFS 7
@@ -977,9 +975,6 @@ LoadGameDescriptions (SUMMARY_DESC *pSD)
for (i = 0; i < MAX_SAVED_GAMES; ++i, ++pSD)
{
extern BOOLEAN LoadGame (COUNT which_game,
SUMMARY_DESC *summary_desc);
if (!LoadGame (i, pSD))
pSD->year_index = 0;
}
@@ -1059,9 +1054,6 @@ Restart:
if (pMS->delta_item == SAVE_GAME)
{
STAMP MsgStamp;
extern BOOLEAN SaveGame (COUNT
which_game, SUMMARY_DESC
*summary_desc);
ConfirmSaveLoad (&MsgStamp);
if (SaveGame ((COUNT)pMS->CurState, pSD))
@@ -1099,8 +1091,6 @@ Restart:
}
else
{
extern BOOLEAN LoadGame (COUNT which_game, SUMMARY_DESC *summary_desc);
ConfirmSaveLoad (0);
if (LoadGame ((COUNT)pMS->CurState, NULL_PTR))
GLOBAL (CurrentActivity) |= CHECK_LOAD;
@@ -1405,7 +1395,9 @@ DoGameOptions (PMENU_STATE pMS)
case SAVE_GAME:
case LOAD_GAME:
pMS->CurFrame = (FRAME)FadeMusic (0, ONE_SECOND >> 1);
return (PickGame (pMS));
// XXX: what is going on here? A DWORD is cast
// to a FRAME.
return PickGame (pMS);
case QUIT_GAME:
pMS->Initialized = FALSE;
pMS->CurState = NO_QUIT_MENU;
+26
View File
@@ -0,0 +1,26 @@
/*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*/
#ifndef _GAMEOPT_H
#define _GAMEOPT_H
#include "compiler.h"
#include "libs/gfxlib.h"
extern void ConfirmSaveLoad (STAMP *MsgStamp);
extern BOOLEAN GameOptions (void);
#endif /* _GAMEOPT_H */
+27 -12
View File
@@ -20,6 +20,7 @@
#include "coderes.h"
#include "encount.h"
#include "master.h"
#include "setup.h"
#include "resinst.h"
#include "build.h"
@@ -28,11 +29,8 @@
#include <stdlib.h>
//Added by Chris
void InitGlobData (void);
//End Added by Chris
static void CreateRadar (void);
CONTEXT RadarContext;
FRAME PlayFrame;
@@ -42,7 +40,7 @@ GLOBDATA GlobData;
extern FRAME flagship_status, misc_data;
BOOLEAN initedSIS = 0;
void
static void
CreateRadar (void)
{
if (RadarContext == 0)
@@ -135,11 +133,9 @@ InitSIS (void)
{
SHIP_FRAGMENTPTR FragPtr;
EXTENDED_SHIP_FRAGMENTPTR ExtFragPtr;
extern HSTARSHIP FindMasterShip (DWORD ship_ref);
FragPtr = (SHIP_FRAGMENTPTR)LockStarShip (
&GLOBAL (avail_race_q), hStarShip
);
&GLOBAL (avail_race_q), hStarShip);
if (i < num_ships - 1)
{
HSTARSHIP hMasterShip;
@@ -147,7 +143,8 @@ InitSIS (void)
hMasterShip = FindMasterShip (ship_ref);
MasterShipPtr = LockStarShip (&master_q, hMasterShip);
FragPtr->ShipInfo = ((SHIP_FRAGMENTPTR)MasterShipPtr)->ShipInfo;
FragPtr->ShipInfo =
((SHIP_FRAGMENTPTR)MasterShipPtr)->ShipInfo;
UnlockStarShip (&master_q, hMasterShip);
}
else
@@ -177,9 +174,7 @@ InitSIS (void)
ExtFragPtr->ShipInfo.days_left = 0;
FragPtr->RaceDescPtr = (RACE_DESCPTR)&ExtFragPtr->ShipInfo;
UnlockStarShip (
&GLOBAL (avail_race_q), hStarShip
);
UnlockStarShip (&GLOBAL (avail_race_q), hStarShip);
}
}
}
@@ -322,3 +317,23 @@ UninitSIS (void)
initedSIS = FALSE;
}
void
InitGlobData (void)
{
COUNT i;
i = GLOBAL (glob_flags);
memset ((PBYTE)&GlobData, 0, sizeof (GlobData));
GLOBAL (glob_flags) = (BYTE)i;
GLOBAL (DisplayArray) = DisplayArray;
// The clock semaphore was initially initialized as '1'
// but it is always cleared before set, so it toggled between
// 2 and 1, which doesn't actually do anything.
GLOBAL (GameClock.clock_sem) =
CreateSemaphore(0, "Clock", SYNC_CLASS_TOPLEVEL);
}
+2
View File
@@ -972,6 +972,8 @@ extern void RetrieveStarMap (void);
extern void FreeSC2Data (void);
extern BOOLEAN LoadSC2Data (void);
void InitGlobData (void);
#endif /* _GLOBDATA_H */
+1
View File
@@ -16,6 +16,7 @@
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
*/
#include "element.h"
#include "resinst.h"
#include "setup.h"
+2 -1
View File
@@ -137,7 +137,8 @@ BuildGroups (void)
// XXX: BUG: i is redefined in the line below, so the assignment
// to i a few lines ago is useless.
// EncounterPercent is never used in practice. - SvdB
// EncounterPercent is never used in practice.
// BestIndex may be used uninitialised. - SvdB
if ((i = HomeWorld[Index]) && CurStarDescPtr->Index == (BYTE)i)
{
BestIndex = Index;
+6 -1
View File
@@ -16,6 +16,8 @@
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
*/
#include "hyper.h"
#include "build.h"
#include "collide.h"
#include "colors.h"
@@ -37,6 +39,9 @@ void WaitForNoInput (SIZE Duration);
//End Added by Chris
static void LoadHyperData (void);
#define XOFFS ((RADAR_SCAN_WIDTH + (UNIT_SCREEN_WIDTH << 2)) >> 1)
#define YOFFS ((RADAR_SCAN_HEIGHT + (UNIT_SCREEN_HEIGHT << 2)) >> 1)
@@ -279,7 +284,7 @@ FreeHyperData (void)
hypercmaps[1] = 0;
}
void
static void
LoadHyperData (void)
{
if (hyperstars[0] == 0)
+5 -22
View File
@@ -27,10 +27,11 @@
#include "units.h"
FRAME stars_in_space,
asteroid[NUM_VIEWS],
blast[NUM_VIEWS],
explosion[NUM_VIEWS];
FRAME stars_in_space;
FRAME asteroid[NUM_VIEWS];
FRAME blast[NUM_VIEWS];
FRAME explosion[NUM_VIEWS];
BOOLEAN
load_animation (PFRAME pixarray, DWORD big_res, DWORD med_res, DWORD
@@ -261,21 +262,3 @@ UninitShips (void)
}
}
void
InitGlobData (void)
{
COUNT i;
i = GLOBAL (glob_flags);
memset ((PBYTE)&GlobData, 0, sizeof (GlobData));
GLOBAL (glob_flags) = (BYTE)i;
GLOBAL (DisplayArray) = DisplayArray;
// The clock semaphore was initially initialized as '1'
// but it is always cleared before set, so it toggled between
// 2 and 1, which doesn't actually do anything.
GLOBAL (GameClock.clock_sem) =
CreateSemaphore(0, "Clock", SYNC_CLASS_TOPLEVEL);
}
+5
View File
@@ -24,6 +24,11 @@
extern FRAME stars_in_space;
extern BOOLEAN InitSpace (void);
extern void UninitSpace (void);
extern SIZE InitShips (void);
extern void UninitShips (void);
#endif /* _INIT_H */
+12 -2
View File
@@ -22,6 +22,8 @@
#include "globdata.h"
#include "setup.h"
#include <stdio.h>
SIZE cur_player;
@@ -29,8 +31,9 @@ BATTLE_INPUT_STATE
computer_intelligence (void)
{
BATTLE_INPUT_STATE InputState;
if (LOBYTE (GLOBAL (CurrentActivity)) == IN_LAST_BATTLE)
return (0);
return 0;
if (CyborgDescPtr)
{
@@ -51,8 +54,15 @@ computer_intelligence (void)
InputState = BATTLE_WEAPON; /* pick a random ship */
break;
}
default:
// Should not happen. Satisfying compiler.
fprintf (stderr, "Warning: Unexpected state in "
"computer_intelligence().");
InputState = 0;
break;
}
}
return (InputState);
return InputState;
}
+12 -10
View File
@@ -21,9 +21,10 @@
#include "settings.h"
#include "setup.h"
#include "sounds.h"
#include "fmv.h"
#include "libs/graphics/gfx_common.h"
#include "libs/sound/sound.h"
#include "libs/vidlib.h"
//#include "libs/vidlib.h"
#include "libs/inplib.h"
#include <ctype.h>
@@ -59,8 +60,12 @@ typedef struct
} PRESENTATION_INPUT_STATE, *PPRESENTATION_INPUT_STATE;
static BOOLEAN DoPresentation (PVOID pIS);
BOOLEAN
DoFMV (char *name, char *loopname, BOOLEAN uninit)
DoFMV (const char *name, const char *loopname, BOOLEAN uninit)
{
VIDEO_REF VidRef;
@@ -90,8 +95,7 @@ ParseColorString (const char *Src, COLOR* pColor)
return FALSE;
*pColor = BUILD_COLOR (MAKE_RGB15 (
(clr >> 19) & 0x1f, (clr >> 11) & 0x1f, (clr >> 3) & 0x1f),
0);
(clr >> 19) & 0x1f, (clr >> 11) & 0x1f, (clr >> 3) & 0x1f), 0);
return TRUE;
}
@@ -102,8 +106,7 @@ DoFadeScreen (PRESENTATION_INPUT_STATE* pPIS, const char *Src, BYTE FadeType)
int msecs;
if (1 == sscanf (Src, "%d", &msecs))
{
pPIS->TimeOut = XFormColorMap (
(COLORMAPPTR) xform_buf,
pPIS->TimeOut = XFormColorMap ((COLORMAPPTR) xform_buf,
(SIZE)(msecs * ONE_SECOND / 1000)) + ONE_SECOND / 10;
pPIS->TimeOutOnSkip = FALSE;
}
@@ -171,7 +174,7 @@ Present_UnbatchGraphics (PRESENTATION_INPUT_STATE* pPIS, BOOLEAN bYield)
}
}
BOOLEAN
static BOOLEAN
DoPresentation (PVOID pIS)
{
PRESENTATION_INPUT_STATE* pPIS = (PRESENTATION_INPUT_STATE*) pIS;
@@ -504,7 +507,7 @@ DoPresentation (PVOID pIS)
}
BOOLEAN
ShowPresentation (char *name)
ShowPresentation (const char *name)
{
CONTEXT OldContext;
FONT OldFont;
@@ -513,8 +516,7 @@ ShowPresentation (char *name)
RECT r = {{0, 0}, {SCREEN_WIDTH, SCREEN_HEIGHT}};
pis.SlideShow = CaptureStringTable (
LoadStringTableFile (contentDir, name)
);
LoadStringTableFile (contentDir, name));
if (!pis.SlideShow)
return FALSE;
pis.SlideShow = SetAbsStringTableIndex (pis.SlideShow, 0);
+2 -56
View File
@@ -102,7 +102,7 @@ typedef enum
typedef struct text
{
POINT baseline;
UNICODE *pStr;
const UNICODE *pStr;
TEXT_ALIGN align;
TEXT_VALIGN valign;
COUNT CharCount;
@@ -115,61 +115,7 @@ typedef STRING_TABLE COLORMAP_REF;
typedef STRING COLORMAP;
typedef STRINGPTR COLORMAPPTR;
enum gfx_object
{
POINT_PRIM = 0,
STAMP_PRIM,
STAMPFILL_PRIM,
LINE_PRIM,
TEXT_PRIM,
RECT_PRIM,
RECTFILL_PRIM,
NUM_PRIMS
};
typedef BYTE GRAPHICS_PRIM;
typedef union
{
POINT Point;
STAMP Stamp;
LINE Line;
TEXT Text;
RECT Rect;
} PRIM_DESC;
typedef PRIM_DESC *PPRIM_DESC;
typedef DWORD PRIM_LINKS;
typedef struct
{
PRIM_LINKS Links;
DWORD TypeAndColor;
PRIM_DESC Object;
} PRIMITIVE;
typedef PRIMITIVE *PPRIMITIVE;
#define END_OF_LIST ((COUNT)0xFFFF)
#define PRIM_COLOR_SHIFT 8
#define PRIM_COLOR_MASK ((DWORD)~0L << PRIM_COLOR_SHIFT)
#define PRIM_TYPE_MASK (~PRIM_COLOR_MASK)
#define GetPredLink(l) LOWORD(l)
#define GetSuccLink(l) HIWORD(l)
#define MakeLinks MAKE_DWORD
#define SetPrimLinks(pPrim,p,s) ((pPrim)->Links = MakeLinks (p, s))
#define GetPrimLinks(pPrim) ((pPrim)->Links)
#define SetPrimType(pPrim,t) \
((pPrim)->TypeAndColor = ((pPrim)->TypeAndColor & PRIM_COLOR_MASK) \
| ((t) & PRIM_TYPE_MASK))
#define GetPrimType(pPrim) \
((GRAPHICS_PRIM)LOBYTE ((pPrim)->TypeAndColor))
#define SetPrimColor(pPrim,c) \
((pPrim)->TypeAndColor = ((pPrim)->TypeAndColor & PRIM_TYPE_MASK) \
| ((c) << PRIM_COLOR_SHIFT))
#define GetPrimColor(pPrim) \
((COLOR)((pPrim)->TypeAndColor >> PRIM_COLOR_SHIFT))
#include "graphics/prim.h"
typedef BYTE BATCH_FLAGS;
+1 -1
View File
@@ -18,8 +18,8 @@
#include "gfxintrn.h"
#include "options.h"
#include "libs/reslib.h"
extern char *_cur_resfile_name;
DWORD
LoadCelFile (PVOID pStr)
@@ -77,8 +77,6 @@ extern int ScreenWidthActual;
extern int ScreenHeightActual;
extern int GraphicsDriver;
int Starcon2Main (void *);
#include "cmap.h"
#endif
+91
View File
@@ -0,0 +1,91 @@
/*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*/
#ifndef _PRIM_H
#define _PRIM_H
enum gfx_object
{
POINT_PRIM = 0,
STAMP_PRIM,
STAMPFILL_PRIM,
LINE_PRIM,
TEXT_PRIM,
RECT_PRIM,
RECTFILL_PRIM,
NUM_PRIMS
};
typedef BYTE GRAPHICS_PRIM;
typedef union
{
POINT Point;
STAMP Stamp;
LINE Line;
TEXT Text;
RECT Rect;
} PRIM_DESC;
typedef PRIM_DESC *PPRIM_DESC;
typedef DWORD PRIM_LINKS;
typedef struct
{
PRIM_LINKS Links;
DWORD TypeAndColor;
PRIM_DESC Object;
} PRIMITIVE;
typedef PRIMITIVE *PPRIMITIVE;
#define END_OF_LIST ((COUNT)0xFFFF)
#define PRIM_COLOR_SHIFT 8
#define PRIM_COLOR_MASK ((DWORD)~0L << PRIM_COLOR_SHIFT)
#define PRIM_TYPE_MASK (~PRIM_COLOR_MASK)
#define GetPredLink(l) LOWORD(l)
#define GetSuccLink(l) HIWORD(l)
#define MakeLinks MAKE_DWORD
#define SetPrimLinks(pPrim,p,s) ((pPrim)->Links = MakeLinks (p, s))
#define GetPrimLinks(pPrim) ((pPrim)->Links)
#define SetPrimType(pPrim,t) \
((pPrim)->TypeAndColor = ((pPrim)->TypeAndColor & PRIM_COLOR_MASK) \
| ((t) & PRIM_TYPE_MASK))
#define GetPrimType(pPrim) \
((GRAPHICS_PRIM)LOBYTE ((pPrim)->TypeAndColor))
#define SetPrimColor(pPrim,c) \
((pPrim)->TypeAndColor = ((pPrim)->TypeAndColor & PRIM_TYPE_MASK) \
| ((c) << PRIM_COLOR_SHIFT))
#define GetPrimColor(pPrim) \
((COLOR)((pPrim)->TypeAndColor >> PRIM_COLOR_SHIFT))
static inline void
SetPrimNextLink (PPRIMITIVE pPrim, COUNT Link)
{
SetPrimLinks (pPrim, END_OF_LIST, Link);
}
static inline COUNT
GetPrimNextLink (PPRIMITIVE pPrim)
{
return GetSuccLink (GetPrimLinks (pPrim));
}
#endif /* PRIM_H */
@@ -23,12 +23,14 @@
#endif
#include <fcntl.h>
#include "options.h"
#include "port.h"
#include "sdl_common.h"
#include "primitives.h"
#include "sdluio.h"
#include "libs/file.h"
#include "options.h"
#include "libs/reslib.h"
#include "primitives.h"
typedef struct anidata
{
@@ -39,8 +41,6 @@ typedef struct anidata
} AniData;
extern char *_cur_resfile_name;
static void
process_image (FRAMEPTR FramePtr, SDL_Surface *img[], AniData *ani, int cel_ct)
{
+4 -2
View File
@@ -51,6 +51,8 @@ typedef COUNT RES_PACKAGE;
((RESOURCE)(i) << TYPE_BITS) | \
((RESOURCE)(t)))
const char *_cur_resfile_name;
extern uio_Stream *res_OpenResFile (uio_DirHandle *dir, const char *filename,
const char *mode);
extern int ReadResFile (PVOID lpBuf, COUNT size, COUNT count, uio_Stream *fp);
@@ -64,8 +66,8 @@ extern long LengthResFile (uio_Stream *fp);
extern BOOLEAN res_CloseResFile (uio_Stream *fp);
extern BOOLEAN DeleteResFile (uio_DirHandle *dir, const char *filename);
extern MEM_HANDLE InitResourceSystem (PVOID resfile, COUNT resindex_type,
BOOLEAN (*FileErrorFunc) (PVOID filename));
extern MEM_HANDLE InitResourceSystem (const char *resfile,
COUNT resindex_type, BOOLEAN (*FileErrorFunc) (const char *filename));
extern BOOLEAN UninitResourceSystem (void);
extern BOOLEAN InstallResTypeVectors (
COUNT res_type,
+2 -1
View File
@@ -20,7 +20,8 @@
#include "port.h"
#include "options.h"
char *_cur_resfile_name;
const char *_cur_resfile_name;
static BOOLEAN
ValidResource (INDEX_HEADERPTR ResHeaderPtr, RESOURCE res)
+2 -2
View File
@@ -215,8 +215,8 @@ _GetResFileData (uio_Stream *res_fp, DWORD flen)
}
MEM_HANDLE
InitResourceSystem (PVOID resfile, COUNT resindex_type, BOOLEAN
(*FileErrorFunc) (PVOID filename))
InitResourceSystem (const char *resfile, COUNT resindex_type, BOOLEAN
(*FileErrorFunc) (const char *filename))
{
MEM_HANDLE h;
-1
View File
@@ -74,7 +74,6 @@ extern MEM_HANDLE _GetResFileData (uio_Stream *res_fp, DWORD flen);
extern void _set_current_index_header (INDEX_HEADERPTR ResHeaderPtr);
extern INDEX_HEADERPTR _get_current_index_header (void);
extern char *_cur_resfile_name;
#endif /* _RESINTRN_H */
+1 -1
View File
@@ -18,8 +18,8 @@
#include "sndintrn.h"
#include "options.h"
#include "reslib.h"
extern char *_cur_resfile_name;
SOUND_REF
LoadSoundFile (PVOID pStr)
+4 -3
View File
@@ -14,9 +14,11 @@
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
*/
#include "sound.h"
#include "options.h"
#include "file.h"
#include "options.h"
#include "sound.h"
#include "libs/reslib.h"
static MUSIC_REF curMusicRef;
@@ -110,7 +112,6 @@ MEM_HANDLE
_GetMusicData (uio_Stream *fp, DWORD length)
{
MEM_HANDLE h;
extern char *_cur_resfile_name;
h = 0;
if (_cur_resfile_name && (h = AllocMusicData (sizeof (void *))))
@@ -19,7 +19,10 @@
#ifdef HAVE_OPENAL
#include "audiodrv_openal.h"
#include "libs/tasklib.h"
ALCcontext *alcContext = NULL;
ALCdevice *alcDevice = NULL;
+4 -3
View File
@@ -14,13 +14,15 @@
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
*/
#include "options.h"
#include "sound.h"
#include "libs/reslib.h"
#ifdef WIN32
#include <io.h>
#endif
#include <fcntl.h>
#include "sound.h"
#include "options.h"
static void CheckFinishedChannels (void);
@@ -179,7 +181,6 @@ _GetSoundBankData (uio_Stream *fp, DWORD length)
{
char *s1, *s2;
extern char *_cur_resfile_name;
if (_cur_resfile_name == 0
|| (((s2 = 0), (s1 = strrchr (_cur_resfile_name, '/')) == 0)
+6 -3
View File
@@ -174,7 +174,7 @@ fade_task (void *data)
FadeTask = 0;
FinishTask (task);
return (1);
return 1;
}
DWORD
@@ -192,7 +192,8 @@ FadeMusic (BYTE end_vol, SIZE TimeInterval)
TaskSwitch ();
}
if ((TTotal = TimeInterval) <= 0)
TTotal = TimeInterval;
if (TTotal <= 0)
TTotal = 1; /* prevent divide by zero and negative fade */
volume_end = end_vol;
@@ -207,5 +208,7 @@ FadeMusic (BYTE end_vol, SIZE TimeInterval)
TimeOut = GetTimeCounter ();
}
return (TimeOut);
return TimeOut;
}
+3 -2
View File
@@ -16,14 +16,16 @@
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
*/
#include "options.h"
#include "strintrn.h"
#include "libs/graphics/gfx_common.h"
#include "options.h"
#include "libs/reslib.h"
#ifdef WIN32
#include <io.h>
#endif
#include <fcntl.h>
static void
dword_convert (PDWORD dword_array, COUNT num_dwords)
{
@@ -46,7 +48,6 @@ _GetStringData (uio_Stream *fp, DWORD length)
{
char *s;
extern char *_cur_resfile_name;
if (_cur_resfile_name && (s = strrchr (_cur_resfile_name, '.')) &&
stricmp (s, ".txt") == 0)
+2 -2
View File
@@ -19,11 +19,11 @@
#include "port.h"
#include "strintrn.h"
#include "uio.h"
#include "libs/reslib.h"
extern char *_cur_resfile_name;
STRING_TABLE
LoadStringTableFile (uio_DirHandle *dir, char *fileName)
LoadStringTableFile (uio_DirHandle *dir, const char *fileName)
{
uio_Stream *fp;
+1 -1
View File
@@ -30,7 +30,7 @@ typedef PBYTE STRINGPTR;
extern BOOLEAN InstallStringTableResType (COUNT string_type);
extern STRING_TABLE LoadStringTableInstance (DWORD res);
extern STRING_TABLE LoadStringTableFile (uio_DirHandle *dir,
char *fileName);
const char *fileName);
extern BOOLEAN DestroyStringTable (STRING_TABLE StringTable);
extern STRING CaptureStringTable (STRING_TABLE StringTable);
extern STRING_TABLE ReleaseStringTable (STRING String);
+3 -4
View File
@@ -17,13 +17,12 @@
*/
#include "vidlib.h"
#include "video.h"
VIDEO_REF
LoadVideoFile (PVOID pStr)
LoadVideoFile (const char *pStr)
{
extern VIDEO_REF _init_video_file (PVOID pStr);
return (_init_video_file (pStr));
return _init_video_file (pStr);
}
+5 -4
View File
@@ -14,8 +14,9 @@
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
*/
#include "setup.h"
#include "video.h"
#include "setup.h"
#include "vidplayer.h"
#include "libs/inplib.h"
@@ -72,7 +73,7 @@ VidPlaying ()
}
VIDEO_TYPE
VidPlay (VIDEO_REF VidRef, char *loopname, BOOLEAN uninit)
VidPlay (VIDEO_REF VidRef, const char *loopname, BOOLEAN uninit)
// uninit was used to uninit the game kernel
// before spawning duck exe
{
@@ -118,12 +119,12 @@ VidDoInput (void)
}
VIDEO_REF
_init_video_file(PVOID pStr)
_init_video_file(const char *pStr)
{
TFB_VideoClip* vid;
TFB_VideoDecoder* dec;
dec = VideoDecoder_Load (contentDir, (const char*)pStr);
dec = VideoDecoder_Load (contentDir, pStr);
if (!dec)
return NULL_VIDEO_REF;
+3 -8
View File
@@ -38,17 +38,12 @@ extern void UninitVideo (void);
extern BYTE SetVideoMode (BYTE new_mode);
extern BYTE GetVideoMode (void);
extern VIDEO_REF LoadVideoFile (PVOID pStr);
extern VIDEO_REF LoadVideoFile (const char *pStr);
extern BOOLEAN DestroyVideo (VIDEO_REF VideoRef);
extern VIDEO_TYPE VidPlay (VIDEO_REF VidRef, char *loopname, BOOLEAN
uninit);
extern VIDEO_TYPE VidPlay (VIDEO_REF VidRef, const char *loopname,
BOOLEAN uninit);
extern void VidStop (void);
extern VIDEO_REF VidPlaying (void);
extern void VidDoInput (void);
extern BOOLEAN DoFMV (char *name, char *loopname, BOOLEAN uninit);
extern BOOLEAN ShowPresentation(char *name);
#endif /* _VIDLIB_H */
+13 -12
View File
@@ -16,6 +16,8 @@
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
*/
#include "load.h"
#include "build.h"
#include "declib.h"
#include "encount.h"
@@ -32,6 +34,8 @@
ACTIVITY NextActivity;
static BOOLEAN LoadSummary (uio_Stream *in_fp);
static void
LoadShipQueue (DECODE_REF fh, PQUEUE pQueue, BOOLEAN MakeQ)
{
@@ -68,8 +72,7 @@ LoadShipQueue (DECODE_REF fh, PQUEUE pQueue, BOOLEAN MakeQ)
Ptr = ((PBYTE)&FragPtr->ShipInfo) - Offset;
cread ((PBYTE)Ptr,
((PBYTE)&FragPtr->ShipInfo.race_strings) - Ptr,
1, fh);
((PBYTE)&FragPtr->ShipInfo.race_strings) - Ptr, 1, fh);
if (Offset == 0)
{
EXTENDED_SHIP_FRAGMENTPTR ExtFragPtr;
@@ -83,9 +86,10 @@ LoadShipQueue (DECODE_REF fh, PQUEUE pQueue, BOOLEAN MakeQ)
}
}
BOOLEAN
static BOOLEAN
LoadSummary (uio_Stream *in_fp)
{
// XXX: This function seems to be unused.
SUMMARY_DESC S;
return (ReadResFile (&S, sizeof (S), 1, in_fp) == sizeof (S));
@@ -118,7 +122,7 @@ LoadGame (COUNT which_game, SUMMARY_DESC *summary_desc)
{
memcpy (summary_desc, buf, sizeof (*summary_desc));
res_CloseResFile (in_fp);
return (TRUE);
return TRUE;
}
GlobData.SIS_state = summary_desc->SS;
@@ -126,7 +130,7 @@ LoadGame (COUNT which_game, SUMMARY_DESC *summary_desc)
if ((fh = copen (in_fp, FILE_STREAM, STREAM_READ)) == 0)
{
res_CloseResFile (in_fp);
return (FALSE);
return FALSE;
}
ReinitQueue (&GLOBAL (GameClock.event_q));
@@ -216,8 +220,7 @@ LoadGame (COUNT which_game, SUMMARY_DESC *summary_desc)
hStarShip = GetStarShipFromIndex (
&GLOBAL (avail_race_q),
EncounterPtr->SD.ShipList[i].var1
);
EncounterPtr->SD.ShipList[i].var1);
TemplatePtr = (SHIP_FRAGMENTPTR)LockStarShip (
&GLOBAL (avail_race_q), hStarShip
);
@@ -227,9 +230,7 @@ LoadGame (COUNT which_game, SUMMARY_DESC *summary_desc)
TemplatePtr->ShipInfo.icons;
EncounterPtr->SD.ShipList[i].melee_icon =
TemplatePtr->ShipInfo.melee_icon;
UnlockStarShip (
&GLOBAL (avail_race_q), hStarShip
);
UnlockStarShip (&GLOBAL (avail_race_q), hStarShip);
}
UnlockEncounter (hEncounter);
@@ -309,10 +310,10 @@ LoadGame (COUNT which_game, SUMMARY_DESC *summary_desc)
GLOBAL (DisplayArray) = DisplayArray;
return (TRUE);
return TRUE;
}
return (FALSE);
return FALSE;
}
+27
View File
@@ -0,0 +1,27 @@
/*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*/
#ifndef _LOAD_H
#define _LOAD_H
#include "sis.h"
#include "libs/compiler.h"
extern BOOLEAN LoadGame (COUNT which_game, SUMMARY_DESC *summary_desc);
#endif /* _LOAD_H */
+2
View File
@@ -16,6 +16,8 @@
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
*/
#include "master.h"
#include "build.h"
#include "resinst.h"
#include "displist.h"
+29
View File
@@ -0,0 +1,29 @@
/*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*/
#ifndef _MASTER_H
#define _MASTER_H
#include "races.h"
#include "libs/compiler.h"
extern void LoadMasterShipList (void);
extern void FreeMasterShipList (void);
extern HSTARSHIP FindMasterShip (DWORD ship_ref);
#endif /* _MASTER_H */
+18 -12
View File
@@ -23,11 +23,13 @@
#include "controls.h"
#include "file.h"
#include "gamestr.h"
#include "globdata.h"
#include "intel.h"
#include "nameref.h"
#include "options.h"
#include "races.h"
#include "resinst.h"
#include "save.h"
#include "settings.h"
#include "setup.h"
#include "sounds.h"
@@ -47,18 +49,11 @@
void ConfirmSaveLoad (STAMP *MsgStamp);
void SaveProblem (void);
void DoShipSpin (COUNT index, MUSIC_REF hMusic);
BOOLEAN InitSpace (void);
void UninitSpace (void);
void InitGlobData (void);
//End Added by Chris
static int flash_selection_func (void *data);
enum
{
CONTROLS_TOP,
@@ -233,6 +228,10 @@ DrawControls (COUNT which_side, BOOLEAN HiLite)
case AWESOME_RATING:
which_icon = 3;
break;
default:
// Should not happen. Satisfying compiler.
which_icon = 0;
break;
}
}
@@ -542,7 +541,8 @@ Select (BYTE opt)
}
}
int flash_selection_func(void* data)
static int
flash_selection_func (void *data)
{
DWORD TimeIn;
Task task = (Task) data;
@@ -572,7 +572,7 @@ int flash_selection_func(void* data)
FinishTask (task);
return(0);
return 0;
}
static void
@@ -993,6 +993,7 @@ DoLoadTeam (PMELEE_STATE pMS)
return (TRUE);
}
// XXX: TODO: to be merged with DoTextEntry in gameopt.c
static UWORD
DoTextEntry (PMELEE_STATE pMS)
{
@@ -1006,6 +1007,11 @@ DoTextEntry (PMELEE_STATE pMS)
pBaseStr = pMS->TeamImage[pMS->side].TeamName;
max_chars = MAX_TEAM_CHARS;
}
else
{
// Should not happen. Satisfying compiler.
return 0;
}
ch = GetCharacter ();
+3
View File
@@ -102,5 +102,8 @@ typedef MELEE_STATE *PMELEE_STATE;
extern PMELEE_STATE volatile pMeleeState;
extern void Melee (void);
#endif /* _MELEE_H */
+15 -6
View File
@@ -27,6 +27,15 @@
extern Task flash_task;
extern RECT flash_rect;
static BYTE GetEndMenuState (BYTE BaseState);
static BYTE GetBeginMenuState (BYTE BaseState);
static BYTE FixMenuState (BYTE BadState);
static BYTE NextMenuState (BYTE BaseState, BYTE CurState);
static BYTE PreviousMenuState (BYTE BaseState, BYTE CurState);
static BOOLEAN GetAlternateMenu (BYTE *BaseState, BYTE *CurState);
static BYTE ConvertAlternateMenu (BYTE BaseState, BYTE NewState);
/* Draw the blue background for PC Menu Text */
static void
DrawPCMenuFrame (RECT *r)
@@ -170,7 +179,7 @@ DrawPCMenu (BYTE beg_index, BYTE end_index, BYTE NewState, BYTE hilite, RECT *r)
}
/* Determine the last text item to display */
BYTE
static BYTE
GetEndMenuState (BYTE BaseState)
{
switch (BaseState)
@@ -214,14 +223,14 @@ GetEndMenuState (BYTE BaseState)
return BaseState;
}
BYTE
static BYTE
GetBeginMenuState (BYTE BaseState)
{
return BaseState;
}
/* Correct Menu State for cases where the Menu shouldn't move */
BYTE
static BYTE
FixMenuState (BYTE BadState)
{
switch (BadState)
@@ -244,7 +253,7 @@ FixMenuState (BYTE BadState)
}
/* Choose the next menu to hilight in the 'forward' direction */
BYTE
static BYTE
NextMenuState (BYTE BaseState, BYTE CurState)
{
BYTE NextState;
@@ -315,7 +324,7 @@ PreviousMenuState (BYTE BaseState, BYTE CurState)
/* When using PC hierarchy, convert 3do->PC */
BOOLEAN
static BOOLEAN
GetAlternateMenu (BYTE *BaseState, BYTE *CurState)
{
BYTE AdjBase = *BaseState;
@@ -403,7 +412,7 @@ GetAlternateMenu (BYTE *BaseState, BYTE *CurState)
}
/* When using PC hierarchy, convert PC->3DO */
BYTE
static BYTE
ConvertAlternateMenu (BYTE BaseState, BYTE NewState)
{
switch (BaseState + NewState)
+15 -6
View File
@@ -16,11 +16,14 @@
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
*/
#include "oscill.h"
#include "sis.h"
#include "libs/graphics/gfx_common.h"
#include "libs/graphics/drawable.h"
#include "libs/sound/trackplayer.h"
static FRAMEPTR scope_frame;
static int scope_init = 0;
static TFB_Image *scope_bg = NULL;
@@ -28,17 +31,19 @@ static TFB_Image *scope_surf = NULL;
static UBYTE scope_data[RADAR_WIDTH - 2];
void
InitOscilloscope (DWORD x, DWORD y, DWORD width, DWORD height, FRAME_DESC *f)
InitOscilloscope (DWORD x, DWORD y, DWORD width, DWORD height, FRAME f)
{
scope_frame = f;
if (!scope_init)
{
TFB_Canvas scope_bg_canvas, scope_surf_canvas;
scope_bg_canvas = TFB_DrawCanvas_New_Paletted (width, height, f->image->Palette, -1);
scope_bg_canvas = TFB_DrawCanvas_New_Paletted (width, height,
scope_frame->image->Palette, -1);
scope_bg = TFB_DrawImage_New (scope_bg_canvas);
scope_surf_canvas = TFB_DrawCanvas_New_Paletted (width, height, f->image->Palette, -1);
scope_surf_canvas = TFB_DrawCanvas_New_Paletted (width, height,
scope_frame->image->Palette, -1);
scope_surf = TFB_DrawImage_New (scope_surf_canvas);
TFB_DrawImage_Image (f->image, 0, 0, 0, NULL, scope_bg);
TFB_DrawImage_Image (scope_frame->image, 0, 0, 0, NULL, scope_bg);
scope_init = 1;
}
/* remove compiler warnings */
@@ -49,6 +54,7 @@ InitOscilloscope (DWORD x, DWORD y, DWORD width, DWORD height, FRAME_DESC *f)
void
UninitOscilloscope (void)
{
// XXX: Is never called (BUG?)
if (scope_bg)
{
TFB_DrawImage_Delete (scope_bg);
@@ -79,7 +85,8 @@ Oscilloscope (DWORD grab_data)
g = scope_surf->Palette[238].g;
b = scope_surf->Palette[238].b;
for (i = 0; i < RADAR_WIDTH - 3; ++i)
TFB_DrawImage_Line (i + 1, scope_data[i], i + 2, scope_data[i + 1], r, g, b, scope_surf);
TFB_DrawImage_Line (i + 1, scope_data[i], i + 2,
scope_data[i + 1], r, g, b, scope_surf);
}
TFB_DrawImage_Image (scope_surf, 0, 0, 0, NULL, scope_frame->image);
@@ -134,7 +141,8 @@ Slider (void)
if (sliderDisabled)
return;
if ((offs = GetSoundInfo (sliderSpace)) != last_offs ||sliderChanged)
offs = GetSoundInfo (sliderSpace);
if (offs != last_offs || sliderChanged)
{
sliderChanged = FALSE;
last_offs = offs;
@@ -145,3 +153,4 @@ Slider (void)
UnbatchGraphics ();
}
}
+19
View File
@@ -14,4 +14,23 @@
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
*/
#ifndef _OSCILL_H
#define _OSCILL_H
#include "libs/compiler.h"
#include "libs/gfxlib.h"
extern BOOLEAN sliderDisabled;
extern void InitOscilloscope (DWORD x, DWORD y, DWORD width, DWORD height,
FRAME f);
extern void Oscilloscope (DWORD grab_data);
extern void UninitOscilloscope (void);
extern void InitSlider (int x, int y, int width, int height,
int bwidth, int bheight, FRAME f);
extern void SetSliderImage (FRAME f);
void Slider (void);
#endif /* _OSCILL_H */
+5 -7
View File
@@ -19,13 +19,13 @@
#include "options.h"
#include "colors.h"
#include "controls.h"
#include "gameopt.h"
#include "gamestr.h"
#include "resinst.h"
#include "settings.h"
#include "setup.h"
#include "sis.h"
#include "sounds.h"
#include "state.h"
#include "libs/graphics/gfx_common.h"
@@ -38,6 +38,7 @@ enum
OUTFIT_DOFUEL
};
static void
DrawModuleStrings (PMENU_STATE pMS, BYTE NewModule)
{
@@ -167,8 +168,6 @@ DisplayLanders (PMENU_STATE pMS)
static BOOLEAN
DoInstallModule (PMENU_STATE pMS)
{
extern void DrawFlagshipStats (void);
BYTE NewState, new_slot_piece, old_slot_piece;
SIZE FirstItem, LastItem;
BOOLEAN select, cancel, motion;
@@ -520,8 +519,9 @@ InitFlash:
return (TRUE);
}
void
ChangeFuelQuantity ()
static void
ChangeFuelQuantity (void)
{
RECT r;
@@ -591,8 +591,6 @@ DoOutfit (PMENU_STATE pMS)
{
COUNT num_frames;
STAMP s;
extern void DrawFlagshipName (BOOLEAN InStatusArea);
extern void DrawFlagshipStats (void);
pMS->CurFrame = CaptureDrawable (
LoadGraphic (MODULES_PMAP_ANIM));
+26 -13
View File
@@ -16,6 +16,8 @@
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
*/
#include "pickmele.h"
#include "build.h"
#include "controls.h"
#include "intel.h"
@@ -66,27 +68,37 @@ DoGetMelee (GETMELEE_STATE *gms)
if (PlayerInput[which_player] == ComputerInput)
{
/* TODO: Make this a frame-by-frame thing. This code is currently copied
* from intel.c's computer_intelligence */
/* TODO: Make this a frame-by-frame thing. This code is currently
* copied from intel.c's computer_intelligence */
SleepThread (ONE_SECOND >> 1);
left = right = up = down = FALSE;
select = TRUE;
}
else if (which_player == 0)
{
left = PulsedInputState.key[KEY_P1_LEFT] || PulsedInputState.key[KEY_MENU_LEFT];
right = PulsedInputState.key[KEY_P1_RIGHT] || PulsedInputState.key[KEY_MENU_RIGHT];
up = PulsedInputState.key[KEY_P1_THRUST] || PulsedInputState.key[KEY_MENU_UP];
down = PulsedInputState.key[KEY_P1_DOWN] || PulsedInputState.key[KEY_MENU_DOWN];
select = PulsedInputState.key[KEY_P1_WEAPON] || PulsedInputState.key[KEY_MENU_SELECT];
left = PulsedInputState.key[KEY_P1_LEFT] ||
PulsedInputState.key[KEY_MENU_LEFT];
right = PulsedInputState.key[KEY_P1_RIGHT] ||
PulsedInputState.key[KEY_MENU_RIGHT];
up = PulsedInputState.key[KEY_P1_THRUST] ||
PulsedInputState.key[KEY_MENU_UP];
down = PulsedInputState.key[KEY_P1_DOWN] ||
PulsedInputState.key[KEY_MENU_DOWN];
select = PulsedInputState.key[KEY_P1_WEAPON] ||
PulsedInputState.key[KEY_MENU_SELECT];
}
else
{
left = PulsedInputState.key[KEY_P2_LEFT] || PulsedInputState.key[KEY_MENU_LEFT];
right = PulsedInputState.key[KEY_P2_RIGHT] || PulsedInputState.key[KEY_MENU_RIGHT];
up = PulsedInputState.key[KEY_P2_THRUST] || PulsedInputState.key[KEY_MENU_UP];
down = PulsedInputState.key[KEY_P2_DOWN] || PulsedInputState.key[KEY_MENU_DOWN];
select = PulsedInputState.key[KEY_P2_WEAPON] || PulsedInputState.key[KEY_MENU_SELECT];
left = PulsedInputState.key[KEY_P2_LEFT] ||
PulsedInputState.key[KEY_MENU_LEFT];
right = PulsedInputState.key[KEY_P2_RIGHT] ||
PulsedInputState.key[KEY_MENU_RIGHT];
up = PulsedInputState.key[KEY_P2_THRUST] ||
PulsedInputState.key[KEY_MENU_UP];
down = PulsedInputState.key[KEY_P2_DOWN] ||
PulsedInputState.key[KEY_MENU_DOWN];
select = PulsedInputState.key[KEY_P2_WEAPON] ||
PulsedInputState.key[KEY_MENU_SELECT];
}
if (GLOBAL (CurrentActivity) & CHECK_ABORT)
@@ -347,7 +359,8 @@ GetMeleeStarShip (STARSHIPPTR LastStarShipPtr, COUNT which_player)
StarShipPtr->captains_name_index = 0;
UnlockStarShip (&race_q[which_player], gmstate.hBattleShip);
PlaySoundEffect (SetAbsSoundIndex (MenuSounds, 1), 0, NotPositional (), NULL, 0);
PlaySoundEffect (SetAbsSoundIndex (MenuSounds, 1), 0,
NotPositional (), NULL, 0);
WaitForSoundEnd (0);
}
+28
View File
@@ -0,0 +1,28 @@
/*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*/
#ifndef _PICKMELE_H
#define _PICKMELE_H
#include "races.h"
#include "libs/compiler.h"
HSTARSHIP GetMeleeStarShip (STARSHIPPTR LastStarShipPtr,
COUNT which_player);
#endif /* _PICKMELE_H */
+5 -3
View File
@@ -19,6 +19,7 @@
#include "build.h"
#include "colors.h"
#include "controls.h"
#include "pickmele.h"
#include "races.h"
#include "resinst.h"
#include "setup.h"
@@ -159,7 +160,11 @@ ChangeSelection:
DrawFilledRectangle (&r);
if (hBattleShip == 0)
{
crew_level = 0;
max_crew = 0;
// Satisfy compiler.
}
else
{
SetContextFont (TinyFont);
@@ -290,9 +295,6 @@ GetEncounterStarShip (STARSHIPPTR LastStarShipPtr, COUNT which_player)
hBattleShip = GetHeadLink (&race_q[which_player]);
else if (LOBYTE (GLOBAL (CurrentActivity)) == SUPER_MELEE)
{
extern HSTARSHIP GetMeleeStarShip (STARSHIPPTR LastStarShipPtr,
COUNT which_player);
hBattleShip = GetMeleeStarShip (LastStarShipPtr, which_player);
}
else
-1
View File
@@ -195,7 +195,6 @@ DeviceFailed (BYTE which_device)
{
BYTE val;
extern ACTIVITY NextActivity;
extern void SaveFlagshipState (void);
switch (which_device)
{
-1
View File
@@ -17,7 +17,6 @@
*/
#include "units.h"
#include "dummy.h"
#include "libs/gfxlib.h"
#include "graphics/context.h"
#include "graphics/drawable.h"
-1
View File
@@ -16,7 +16,6 @@
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
*/
#include "dummy.h"
#include "nameref.h"
#include "resinst.h"
#include "setup.h"
-1
View File
@@ -18,7 +18,6 @@
#include "colors.h"
#include "controls.h"
#include "dummy.h"
#include "gamestr.h"
#include "options.h"
#include "setup.h"
-2
View File
@@ -18,7 +18,6 @@
#include "build.h"
#include "controls.h"
#include "dummy.h"
#include "encount.h"
#include "gamestr.h"
#include "lifeform.h"
@@ -759,7 +758,6 @@ PickPlanetSide (PMENU_STATE pMS)
{
HSTARSHIP hStarShip;
extern ACTIVITY NextActivity;
extern void SaveFlagshipState (void);
if (pMenuState->flash_task)
{
-4
View File
@@ -349,11 +349,7 @@ FreeSolarSys (void)
pSolarSysState->MenuState.flash_task = 0;
LockMutex (GraphicsLock);
if (!(GLOBAL (CurrentActivity) & (CHECK_ABORT | CHECK_LOAD)))
{
extern void SaveFlagshipState (void);
SaveFlagshipState ();
}
UnlockMutex (GraphicsLock);
}
}
+8 -6
View File
@@ -16,6 +16,8 @@
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
*/
#include "process.h"
#include "build.h"
#include "collide.h"
#include "options.h"
@@ -873,12 +875,12 @@ PostProcessQueue (VIEW_STATE view_state, SIZE scroll_x,
UnlockElement (hPostElement);
} while ((hPostElement = hNextElement) != 0);
scroll_x = scroll_y = 0;
delta.x = delta.y = 0; /* because these are
* newly added elements
* that are already in
* adjusted coordinates
*/
scroll_x = 0;
scroll_y = 0;
delta.x = 0;
delta.y = 0;
/* because these are newly added elements that are
* already in adjusted coordinates */
state_flags = ElementPtr->state_flags;
}
+26
View File
@@ -0,0 +1,26 @@
/*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*/
#ifndef _PROCESS_H
#define _PROCESS_H
#include "libs/compiler.h"
#include "libs/gfxlib.h"
extern void InsertPrim (PRIM_LINKS *pLinks, COUNT primIndex, COUNT iPI);
#endif /* _PROCESS_H */
-1
View File
@@ -521,7 +521,6 @@ enum
#define SOL_Y 1450
extern BOOLEAN InitKernel (void);
extern void UninitKernel (BOOLEAN ships);
extern void DrawCaptainsWindow (STARSHIPPTR
StarShipPtr);
+3 -4
View File
@@ -16,6 +16,8 @@
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
*/
#include "restart.h"
#include "colors.h"
#include "controls.h"
#include "credits.h"
@@ -23,6 +25,7 @@
#include "fmv.h"
#include "globdata.h"
#include "intel.h"
#include "melee.h"
#include "resinst.h"
#include "settings.h"
#include "setup.h"
@@ -36,8 +39,6 @@
//Added by Chris
void Melee (void);
void FreeHyperData (void);
void FreeIPData (void);
@@ -46,8 +47,6 @@ void FreeSC2Data (void);
void FreeLanderData (void);
BOOLEAN InitGameKernel (void);
//End Added by Chris
enum
+26
View File
@@ -0,0 +1,26 @@
/*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*/
#ifndef _RESTART_H
#define _RESTART_H
#include "libs/compiler.h"
extern BOOLEAN StartGame (void);
#endif /* _RESTART_H */
+19 -11
View File
@@ -16,6 +16,8 @@
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
*/
#include "save.h"
#include "build.h"
#include "declib.h"
#include "controls.h"
@@ -66,8 +68,7 @@ SaveShipQueue (DECODE_REF fh, PQUEUE pQueue)
cwrite ((PBYTE)&Index, sizeof (Index), 1, fh);
Ptr = ((PBYTE)&FragPtr->ShipInfo) - Offset;
cwrite ((PBYTE)Ptr,
((PBYTE)&FragPtr->ShipInfo.race_strings) - Ptr,
cwrite ((PBYTE)Ptr, ((PBYTE)&FragPtr->ShipInfo.race_strings) - Ptr,
1, fh);
if (Offset == 0)
{
@@ -193,7 +194,8 @@ SaveProblemMessage (STAMP *MsgStamp)
BUILD_COLOR (MAKE_RGB15 (0x10, 0x10, 0x10), 0x19),
BUILD_COLOR (MAKE_RGB15 (0x8, 0x8, 0x8), 0x1F),
TRUE, BUILD_COLOR (MAKE_RGB15 (0xA, 0xA, 0xA), 0x08));
SetContextForeGroundColor (BUILD_COLOR (MAKE_RGB15 (0x14, 0x14, 0x14), 0x0F));
SetContextForeGroundColor (
BUILD_COLOR (MAKE_RGB15 (0x14, 0x14, 0x14), 0x0F));
for (i = 0; i < MAX_MSG_LINES; ++i)
{
@@ -224,7 +226,8 @@ SaveProblem (void)
{
TaskSwitch ();
UpdateInputState ();
} while (!(PulsedInputState.key[KEY_MENU_SELECT] || PulsedInputState.key[KEY_MENU_SPECIAL] ||
} while (!(PulsedInputState.key[KEY_MENU_SELECT] ||
PulsedInputState.key[KEY_MENU_SPECIAL] ||
(GLOBAL (CurrentActivity) & CHECK_ABORT)));
LockMutex (GraphicsLock);
@@ -250,7 +253,8 @@ SaveGame (COUNT which_game, SUMMARY_DESC *summary_desc)
made_room = FALSE;
RetrySave:
h = mem_request (10 * 1024);
if ((out_fp = mem_lock (h)) == 0
out_fp = mem_lock (h);
if (out_fp == 0
|| (fh = copen (out_fp, MEMORY_STREAM, STREAM_WRITE)) == 0)
{
if (success)
@@ -276,15 +280,18 @@ RetrySave:
POINT pt;
STAR_DESC SD;
char buf[256], file[PATH_MAX];
extern void SaveFlagshipState (void);
success = TRUE;
if (CurStarDescPtr)
SD = *CurStarDescPtr;
else
{
SD.star_pt.x = SD.star_pt.y = 0;
SD.Type = SD.Index = SD.Prefix = SD.Postfix = 0;
SD.star_pt.x = 0;
SD.star_pt.y = 0;
SD.Type = 0;
SD.Index = 0;
SD.Prefix = 0;
SD.Postfix = 0;
}
frame = GLOBAL (ShipStamp.frame);
@@ -412,9 +419,9 @@ RetrySave:
PrepareSummary (summary_desc);
success = (BOOLEAN)(WriteResFile (
summary_desc, sizeof (*summary_desc), 1, out_fp
) != 0);
if (success && WriteResFile (mem_lock (h), (COUNT)flen, 1, out_fp) == 0)
summary_desc, sizeof (*summary_desc), 1, out_fp) != 0);
if (success && WriteResFile (mem_lock (h), (COUNT)flen, 1,
out_fp) == 0)
success = FALSE;
mem_unlock (h);
@@ -438,3 +445,4 @@ RetrySave:
return (success);
}
+27
View File
@@ -0,0 +1,27 @@
/*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*/
#ifndef _SAVE_H
#define _SAVE_H
#include "sis.h"
#include "libs/compiler.h"
extern void SaveProblem (void);
extern BOOLEAN SaveGame (COUNT which_game, SUMMARY_DESC *summary_desc);
#endif /* _SAVE_H */
-2
View File
@@ -39,8 +39,6 @@
//Added by Chris
BOOLEAN InitSpace (void);
extern BOOLEAN InitVideo (BOOLEAN UseCDROM);
//End Added by Chris
+4 -2
View File
@@ -52,9 +52,11 @@ extern BYTE PlayerControl[];
extern SIZE cur_player;
extern BOOLEAN InitContexts (void);
extern void UninitPlayerInput (void);
extern BOOLEAN InitGameKernel (void);
int initIO (void);
void uninitIO (void);
extern int initIO (void);
extern void uninitIO (void);
extern void SetPlayerInput (void);
+10 -8
View File
@@ -39,17 +39,19 @@ typedef struct setup_menu_state {
typedef SETUP_MENU_STATE *PSETUP_MENU_STATE;
typedef struct {
char *optname;
char *tooltip[3];
const char *optname;
const char *tooltip[3];
} OPTION;
typedef struct {
char *category;
const char *category;
int numopts;
OPTION * options;
OPTION *options;
int selected;
} MENU_CATEGORY;
static BOOLEAN DoSetupMenu (PSETUP_MENU_STATE pInputState);
static OPTION scaler_opts[] = {
{ "None",
{ "No scaling.",
@@ -163,9 +165,9 @@ static OPTION subtitles_opts[] = {
//static char *title_str = "Ur-Quan Masters Setup";
//static char *subtitle_str = "Graphics Options";
static char *title_str = "Use arrows and fire to select options";
static char *subtitle_str = "Press cancel when done";
static char **tooltip;
static const char *title_str = "Use arrows and fire to select options";
static const char *subtitle_str = "Press cancel when done";
static const char **tooltip;
#define NUM_OPTS 6
static MENU_CATEGORY cmdline_opts[] = {
@@ -336,7 +338,7 @@ DrawMenu (PSETUP_MENU_STATE pInputState)
SetContextForeGroundColor (oldtext);
}
BOOLEAN
static BOOLEAN
DoSetupMenu (PSETUP_MENU_STATE pInputState)
{
if (!pInputState->initialized)
+94 -121
View File
@@ -20,6 +20,7 @@
#include "colors.h"
#include "controls.h"
#include "fmv.h"
#include "gameopt.h"
#include "gamestr.h"
#include "melee.h"
#include "options.h"
@@ -70,7 +71,8 @@ enum
SHIPYARD_EXIT
};
int hangar_anim_func (void* data)
static int
hangar_anim_func (void *data)
{
DWORD TimeIn;
STAMP s;
@@ -112,7 +114,7 @@ int hangar_anim_func (void* data)
}
FinishTask (task);
return(0);
return 0;
}
#ifdef WANT_SHIP_SPINS
@@ -158,18 +160,15 @@ GetAvailableRaceCount (void)
SHIP_FRAGMENTPTR StarShipPtr;
StarShipPtr = (SHIP_FRAGMENTPTR)LockStarShip (
&GLOBAL (avail_race_q), hStarShip
);
&GLOBAL (avail_race_q), hStarShip);
if (StarShipPtr->ShipInfo.ship_flags & GOOD_GUY)
++Index;
hNextShip = _GetSuccLink (StarShipPtr);
UnlockStarShip (
&GLOBAL (avail_race_q), hStarShip
);
UnlockStarShip (&GLOBAL (avail_race_q), hStarShip);
}
return (Index);
return Index;
}
static HSTARSHIP
@@ -182,24 +181,19 @@ GetAvailableRaceFromIndex (BYTE Index)
{
SHIP_FRAGMENTPTR StarShipPtr;
StarShipPtr = (SHIP_FRAGMENTPTR)LockStarShip (
&GLOBAL (avail_race_q), hStarShip
);
StarShipPtr = (SHIP_FRAGMENTPTR)LockStarShip (&GLOBAL (avail_race_q),
hStarShip);
if ((StarShipPtr->ShipInfo.ship_flags & GOOD_GUY) && Index-- == 0)
{
UnlockStarShip (
&GLOBAL (avail_race_q), hStarShip
);
return (hStarShip);
UnlockStarShip (&GLOBAL (avail_race_q), hStarShip);
return hStarShip;
}
hNextShip = _GetSuccLink (StarShipPtr);
UnlockStarShip (
&GLOBAL (avail_race_q), hStarShip
);
UnlockStarShip (&GLOBAL (avail_race_q), hStarShip);
}
return (0);
return 0;
}
static void
@@ -221,12 +215,14 @@ DrawRaceStrings (BYTE NewRaceItem)
r.extent.height = 11;
BatchGraphics ();
ClearSISRect (CLEAR_SIS_RADAR);
SetContextForeGroundColor (BUILD_COLOR (MAKE_RGB15 (0xA, 0xA, 0xA), 0x08));
SetContextForeGroundColor (BUILD_COLOR (
MAKE_RGB15 (0xA, 0xA, 0xA), 0x08));
DrawFilledRectangle (&r);
r.corner = s.origin;
r.extent.width = RADAR_WIDTH;
r.extent.height = RADAR_HEIGHT;
SetContextForeGroundColor (BUILD_COLOR (MAKE_RGB15 (0x00, 0x00, 0x00), 0x00));
SetContextForeGroundColor (BUILD_COLOR (
MAKE_RGB15 (0x00, 0x00, 0x00), 0x00));
DrawFilledRectangle (&r);
if (NewRaceItem != (BYTE)~0)
{
@@ -240,8 +236,10 @@ DrawRaceStrings (BYTE NewRaceItem)
};
hStarShip = GetAvailableRaceFromIndex (NewRaceItem);
NewRaceItem = GetIndexFromStarShip (&GLOBAL (avail_race_q), hStarShip);
s.frame = SetAbsFrameIndex (pMenuState->ModuleFrame, 3 + NewRaceItem);
NewRaceItem = GetIndexFromStarShip (&GLOBAL (avail_race_q),
hStarShip);
s.frame = SetAbsFrameIndex (pMenuState->ModuleFrame,
3 + NewRaceItem);
DrawStamp (&s);
StarShipPtr = LockStarShip (&GLOBAL (avail_race_q), hStarShip);
s.frame = StarShipPtr->RaceDescPtr->ship_info.melee_icon;
@@ -257,7 +255,8 @@ DrawRaceStrings (BYTE NewRaceItem)
t.pStr = buf;
wsprintf (buf, "%u", ShipCost[NewRaceItem]);
SetContextFont (TinyFont);
SetContextForeGroundColor (BUILD_COLOR (MAKE_RGB15 (0x00, 0x1F, 0x00), 0x02));
SetContextForeGroundColor (BUILD_COLOR (MAKE_RGB15 (
0x00, 0x1F, 0x00), 0x02));
font_DrawText (&t);
}
UnbatchGraphics ();
@@ -290,13 +289,10 @@ ShowShipCrew (SHIP_FRAGMENTPTR StarShipPtr, PRECT pRect)
HSTARSHIP hTemplate;
SHIP_FRAGMENTPTR TemplatePtr;
hTemplate = GetStarShipFromIndex (
&GLOBAL (avail_race_q),
GET_RACE_ID (StarShipPtr)
);
hTemplate = GetStarShipFromIndex (&GLOBAL (avail_race_q),
GET_RACE_ID (StarShipPtr));
TemplatePtr = (SHIP_FRAGMENTPTR)LockStarShip (
&GLOBAL (avail_race_q), hTemplate
);
&GLOBAL (avail_race_q), hTemplate);
if (StarShipPtr->ShipInfo.crew_level >=
TemplatePtr->RaceDescPtr->ship_info.crew_level)
wsprintf (buf, "%u", StarShipPtr->ShipInfo.crew_level);
@@ -306,9 +302,7 @@ ShowShipCrew (SHIP_FRAGMENTPTR StarShipPtr, PRECT pRect)
wsprintf (buf, "%u/%u",
StarShipPtr->ShipInfo.crew_level,
TemplatePtr->RaceDescPtr->ship_info.crew_level);
UnlockStarShip (
&GLOBAL (avail_race_q), hTemplate
);
UnlockStarShip (&GLOBAL (avail_race_q), hTemplate);
r = *pRect;
t.baseline.x = r.corner.x + (r.extent.width >> 1);
@@ -391,33 +385,21 @@ ShowCombatShip (COUNT which_window, SHIP_FRAGMENTPTR YankedStarShipPtr)
);
if (GET_GROUP_LOC (StarShipPtr) > which_window)
{
UnlockStarShip (
&GLOBAL (built_ship_q),
hStarShip
);
UnlockStarShip (&GLOBAL (built_ship_q), hStarShip);
break;
}
hNextShip = _GetSuccLink (StarShipPtr);
UnlockStarShip (
&GLOBAL (built_ship_q),
hStarShip
);
UnlockStarShip (&GLOBAL (built_ship_q), hStarShip);
hStarShip = hNextShip;
}
InsertQueue (&GLOBAL (built_ship_q),
hTailShip, hStarShip);
InsertQueue (&GLOBAL (built_ship_q), hTailShip, hStarShip);
hStarShip = hTailShip;
StarShipPtr = (SHIP_FRAGMENTPTR)LockStarShip (
&GLOBAL (built_ship_q),
hStarShip
);
&GLOBAL (built_ship_q), hStarShip);
SET_GROUP_LOC (StarShipPtr, which_window);
UnlockStarShip (
&GLOBAL (built_ship_q),
hStarShip
);
UnlockStarShip (&GLOBAL (built_ship_q), hStarShip);
}
for (i = 0; i < num_ships; ++i)
@@ -501,8 +483,10 @@ ShowCombatShip (COUNT which_window, SHIP_FRAGMENTPTR YankedStarShipPtr)
{
RECT ClipRect;
ClipRect.corner.x = SIS_ORG_X + pship_win_info->finished_s.x;
ClipRect.corner.y = SIS_ORG_Y + pship_win_info->finished_s.y;
ClipRect.corner.x = SIS_ORG_X +
pship_win_info->finished_s.x;
ClipRect.corner.y = SIS_ORG_Y +
pship_win_info->finished_s.y;
ClipRect.extent.width = SHIP_WIN_WIDTH;
ClipRect.extent.height = SHIP_WIN_HEIGHT;
SetContextClipRect (&ClipRect);
@@ -546,8 +530,7 @@ CrewTransaction (SIZE crew_delta)
crew_bought = (SIZE)MAKE_WORD (
GET_GAME_STATE (CREW_PURCHASED0),
GET_GAME_STATE (CREW_PURCHASED1)
) + crew_delta;
GET_GAME_STATE (CREW_PURCHASED1)) + crew_delta;
if (crew_bought < 0)
{
if (crew_delta < 0)
@@ -579,9 +562,7 @@ CrewTransaction (SIZE crew_delta)
LockMutex (GraphicsLock);
}
}
if (!(ActivateStarShip (
SHOFIXTI_SHIP, CHECK_ALLIANCE
) & GOOD_GUY))
if (!(ActivateStarShip (SHOFIXTI_SHIP, CHECK_ALLIANCE) & GOOD_GUY))
{
SET_GAME_STATE (CREW_PURCHASED0, LOBYTE (crew_bought));
SET_GAME_STATE (CREW_PURCHASED1, HIBYTE (crew_bought));
@@ -615,7 +596,7 @@ DoModifyShips (PMENU_STATE pMS)
if (GLOBAL (CurrentActivity) & CHECK_ABORT)
{
pMS->InputFunc = DoShipyard;
return (TRUE);
return TRUE;
}
if (!pMS->Initialized)
@@ -631,7 +612,8 @@ DoModifyShips (PMENU_STATE pMS)
}
else
{
SBYTE dx = 0, dy = 0;
SBYTE dx = 0;
SBYTE dy = 0;
BYTE NewState;
if (!(pMS->delta_item & MODIFY_CREW_FLAG))
@@ -677,10 +659,9 @@ DoModifyShips (PMENU_STATE pMS)
NewState = (BYTE)(pMS->CurState - NewState + dx);
}
#ifdef WANT_SHIP_SPINS
if (select || cancel || special
#else
if (select || cancel
#ifdef WANT_SHIP_SPINS
|| special
#endif
|| NewState != pMS->CurState
|| ((pMS->delta_item & MODIFY_CREW_FLAG) && (dx || dy)))
@@ -689,25 +670,21 @@ DoModifyShips (PMENU_STATE pMS)
hStarShip; hStarShip = hNextShip)
{
StarShipPtr = (SHIP_FRAGMENTPTR)LockStarShip (
&GLOBAL (built_ship_q), hStarShip
);
&GLOBAL (built_ship_q), hStarShip);
if (GET_GROUP_LOC (StarShipPtr) == pMS->CurState)
{
UnlockStarShip (
&GLOBAL (built_ship_q), hStarShip
);
UnlockStarShip (&GLOBAL (built_ship_q), hStarShip);
break;
}
hNextShip = _GetSuccLink (StarShipPtr);
UnlockStarShip (
&GLOBAL (built_ship_q), hStarShip
);
UnlockStarShip (&GLOBAL (built_ship_q), hStarShip);
}
if ((pMS->delta_item & MODIFY_CREW_FLAG) && (hStarShip))
{
SetMenuSounds (MENU_SOUND_UP | MENU_SOUND_DOWN, MENU_SOUND_SELECT | MENU_SOUND_CANCEL);
SetMenuSounds (MENU_SOUND_UP | MENU_SOUND_DOWN,
MENU_SOUND_SELECT | MENU_SOUND_CANCEL);
}
else
{
@@ -724,8 +701,7 @@ DoModifyShips (PMENU_STATE pMS)
if ((hSpinShip = hStarShip)
|| (HINIBBLE (pMS->CurState) == 0
&& (hSpinShip = GetAvailableRaceFromIndex (
LOBYTE (pMS->delta_item)
))))
LOBYTE (pMS->delta_item)))))
{
SetFlashRect (NULL_PTR, (FRAME)0);
SpinStarShip (hSpinShip);
@@ -754,7 +730,7 @@ DoModifyShips (PMENU_STATE pMS)
{
pMS->delta_item = MODIFY_CREW_FLAG;
DrawRaceStrings (0);
return (TRUE);
return TRUE;
}
else if (cancel)
{
@@ -767,16 +743,16 @@ DoModifyShips (PMENU_STATE pMS)
}
else if (select)
{
Index = GetIndexFromStarShip (
&GLOBAL (avail_race_q),
GetAvailableRaceFromIndex (LOBYTE (pMS->delta_item))
);
Index = GetIndexFromStarShip (&GLOBAL (avail_race_q),
GetAvailableRaceFromIndex (
LOBYTE (pMS->delta_item)));
if (GLOBAL_SIS (ResUnits) >= (DWORD)ShipCost[Index]
&& CloneShipFragment (Index,
&GLOBAL (built_ship_q), 1))
{
ShowCombatShip ((COUNT)pMS->CurState, (SHIP_FRAGMENTPTR)0);
ShowCombatShip ((COUNT)pMS->CurState,
(SHIP_FRAGMENTPTR) 0);
//Reset flash rectangle
LockMutex (GraphicsLock);
SetFlashRect ((PRECT)~0L, (FRAME)0);
@@ -795,9 +771,10 @@ DoModifyShips (PMENU_STATE pMS)
SetFlashRect (&r, (FRAME)0);
UnlockMutex (GraphicsLock);
}
SetMenuSounds (MENU_SOUND_UP | MENU_SOUND_DOWN, MENU_SOUND_SELECT | MENU_SOUND_CANCEL);
SetMenuSounds (MENU_SOUND_UP | MENU_SOUND_DOWN,
MENU_SOUND_SELECT | MENU_SOUND_CANCEL);
return (TRUE);
return TRUE;
}
else
{
@@ -820,7 +797,7 @@ DoModifyShips (PMENU_STATE pMS)
pMS->delta_item = NewState | MODIFY_CREW_FLAG;
}
return (TRUE);
return TRUE;
}
LockMutex (GraphicsLock);
goto ChangeFlashRect;
@@ -860,7 +837,8 @@ DoModifyShips (PMENU_STATE pMS)
GetGaugeRect (&r, TRUE);
SetFlashRect (&r, (FRAME)0);
SetContext (SpaceContext);
SetMenuSounds (MENU_SOUND_UP | MENU_SOUND_DOWN, MENU_SOUND_SELECT | MENU_SOUND_CANCEL);
SetMenuSounds (MENU_SOUND_UP | MENU_SOUND_DOWN,
MENU_SOUND_SELECT | MENU_SOUND_CANCEL);
}
else
{
@@ -871,7 +849,8 @@ DoModifyShips (PMENU_STATE pMS)
r.extent.height = 5;
SetContext (SpaceContext);
SetFlashRect (&r, (FRAME)0);
SetMenuSounds (MENU_SOUND_UP | MENU_SOUND_DOWN, MENU_SOUND_SELECT | MENU_SOUND_CANCEL);
SetMenuSounds (MENU_SOUND_UP | MENU_SOUND_DOWN,
MENU_SOUND_SELECT | MENU_SOUND_CANCEL);
}
}
else if (pMS->delta_item & MODIFY_CREW_FLAG)
@@ -880,10 +859,10 @@ DoModifyShips (PMENU_STATE pMS)
if (hStarShip)
StarShipPtr = (SHIP_FRAGMENTPTR)LockStarShip (
&GLOBAL (built_ship_q), hStarShip
);
&GLOBAL (built_ship_q), hStarShip);
SetMenuSounds (MENU_SOUND_UP | MENU_SOUND_DOWN, MENU_SOUND_SELECT | MENU_SOUND_CANCEL);
SetMenuSounds (MENU_SOUND_UP | MENU_SOUND_DOWN,
MENU_SOUND_SELECT | MENU_SOUND_CANCEL);
crew_delta = 0;
if (dy < 0)
{
@@ -910,24 +889,22 @@ DoModifyShips (PMENU_STATE pMS)
hTemplate = GetStarShipFromIndex (
&GLOBAL (avail_race_q),
GET_RACE_ID (StarShipPtr)
);
GET_RACE_ID (StarShipPtr));
TemplatePtr = (SHIP_FRAGMENTPTR)LockStarShip (
&GLOBAL (avail_race_q), hTemplate
);
if (GLOBAL_SIS (ResUnits) >= (DWORD)GLOBAL (CrewCost)
&GLOBAL (avail_race_q), hTemplate);
if (GLOBAL_SIS (ResUnits) >=
(DWORD)GLOBAL (CrewCost)
&& StarShipPtr->ShipInfo.crew_level <
StarShipPtr->ShipInfo.max_crew &&
StarShipPtr->ShipInfo.crew_level <
TemplatePtr->RaceDescPtr->ship_info.crew_level)
TemplatePtr->RaceDescPtr->ship_info.
crew_level)
{
if (StarShipPtr->ShipInfo.crew_level > 0)
DeltaSISGauges (0, 0, -GLOBAL (CrewCost));
else
DeltaSISGauges (0, 0,
-(COUNT)ShipCost[
GET_RACE_ID (StarShipPtr)
]);
DeltaSISGauges (0, 0, -(COUNT)ShipCost[
GET_RACE_ID (StarShipPtr) ]);
++StarShipPtr->ShipInfo.crew_level;
crew_delta = 1;
ShowShipCrew (StarShipPtr, &pMS->flash_rect0);
@@ -939,17 +916,15 @@ DoModifyShips (PMENU_STATE pMS)
SetContext (SpaceContext);
SetFlashRect (&r, (FRAME)0);
}
UnlockStarShip (
&GLOBAL (avail_race_q), hTemplate
);
UnlockStarShip (&GLOBAL (avail_race_q),
hTemplate);
}
}
else if (dy > 0)
{
crew_bought = (SIZE)MAKE_WORD (
GET_GAME_STATE (CREW_PURCHASED0),
GET_GAME_STATE (CREW_PURCHASED1)
);
GET_GAME_STATE (CREW_PURCHASED1));
if (hStarShip == 0)
{
if (GetCrewCount ())
@@ -978,10 +953,8 @@ DoModifyShips (PMENU_STATE pMS)
- (crew_bought ==
CREW_EXPENSE_THRESHOLD ? 2 : 0));
else
DeltaSISGauges (0, 0,
(COUNT)ShipCost[
GET_RACE_ID (StarShipPtr)
]);
DeltaSISGauges (0, 0, (COUNT)ShipCost[
GET_RACE_ID (StarShipPtr)]);
crew_delta = -1;
--StarShipPtr->ShipInfo.crew_level;
}
@@ -998,9 +971,7 @@ DoModifyShips (PMENU_STATE pMS)
if (hStarShip)
{
UnlockStarShip (
&GLOBAL (built_ship_q), hStarShip
);
UnlockStarShip (&GLOBAL (built_ship_q), hStarShip);
// clear out the bought ship index
// so that flash rects work correctly
@@ -1019,7 +990,7 @@ DoModifyShips (PMENU_STATE pMS)
SetFlashRect ((PRECT)~0L, (FRAME)0);
UnlockMutex (GraphicsLock);
return (TRUE);
return TRUE;
}
else
{
@@ -1048,7 +1019,7 @@ ChangeFlashRect:
}
}
return (TRUE);
return TRUE;
}
static void
@@ -1068,7 +1039,8 @@ DrawBluePrint (PMENU_STATE pMS)
s.origin.x = s.origin.y = 0;
s.frame = DecFrameIndex (pMS->ModuleFrame);
SetContextForeGroundColor (BUILD_COLOR (MAKE_RGB15 (0x00, 0x00, 0x16), 0x01));
SetContextForeGroundColor (BUILD_COLOR (
MAKE_RGB15 (0x00, 0x00, 0x16), 0x01));
DrawFilledStamp (&s);
for (num_frames = 0; num_frames < NUM_DRIVE_SLOTS; ++num_frames)
@@ -1091,7 +1063,8 @@ DrawBluePrint (PMENU_STATE pMS)
DrawShipPiece (pMS, which_piece, num_frames, TRUE);
}
SetContextForeGroundColor (BUILD_COLOR (MAKE_RGB15 (0xA, 0xA, 0x1F), 0x09));
SetContextForeGroundColor (BUILD_COLOR (
MAKE_RGB15 (0xA, 0xA, 0x1F), 0x09));
for (num_frames = 0; num_frames < NUM_MODULE_SLOTS; ++num_frames)
{
BYTE which_piece;
@@ -1154,7 +1127,8 @@ DrawBluePrint (PMENU_STATE pMS)
r.corner.x += r.extent.width + 1;
DrawPoint (&r.corner);
r.corner.x -= r.extent.width;
SetContextForeGroundColor (SetContextBackGroundColor (BLACK_COLOR));
SetContextForeGroundColor (
SetContextBackGroundColor (BLACK_COLOR));
DrawFilledRectangle (&r);
m = FuelVolume < FUEL_VOLUME_PER_ROW ?
(COUNT)FuelVolume : FUEL_VOLUME_PER_ROW;
@@ -1171,7 +1145,7 @@ DrawBluePrint (PMENU_STATE pMS)
UnlockMutex (GraphicsLock);
}
void
static void
BeginHangarAnim (PMENU_STATE pMS)
{
#ifdef WANT_HANGAR_ANIMATION
@@ -1192,7 +1166,7 @@ BeginHangarAnim (PMENU_STATE pMS)
#endif
}
void
static void
EndHangarAnim (PMENU_STATE pMS)
{
if (pMS->flash_task)
@@ -1221,9 +1195,7 @@ DoShipyard (PMENU_STATE pMS)
STAMP s;
RECT r, old_r;
s.frame = CaptureDrawable (
LoadGraphic (SHIPYARD_PMAP_ANIM)
);
s.frame = CaptureDrawable (LoadGraphic (SHIPYARD_PMAP_ANIM));
pMS->CurString = CaptureColorMap (LoadColorMapFile (
contentDir, "lbm/dockpani.ct"));
@@ -1297,7 +1269,7 @@ ExitShipyard:
pMS->CurString = 0;
UnlockMutex (GraphicsLock);
return (FALSE);
return FALSE;
}
else if (select)
{
@@ -1321,5 +1293,6 @@ ExitShipyard:
else
DoMenuChooser (pMS, PM_CREW);
return (TRUE);
return TRUE;
}
+7 -4
View File
@@ -705,7 +705,8 @@ GetGaugeRect (PRECT pRect, BOOLEAN IsCrewRect)
pRect->corner.y = IsCrewRect ? 117 : 38;
}
void DrawPC_SIS (void)
static void
DrawPC_SIS (void)
{
TEXT t;
RECT r;
@@ -1201,9 +1202,10 @@ static FRAME flash_screen_frame = 0;
static int flash_changed;
Mutex flash_mutex = 0;
void arith_frame_blit (FRAME srcFrame, RECT *rsrc, FRAME dstFrame,
RECT *rdst, int num,int denom);
RECT *rdst, int num, int denom);
int flash_rect_func(void *data)
static int
flash_rect_func (void *data)
{
#define NORMAL_STRENGTH 4
#define NORMAL_F_STRENGTH 0
@@ -1211,7 +1213,8 @@ int flash_rect_func(void *data)
DWORD TimeIn, WaitTime;
SIZE strength, fstrength, incr;
RECT cached_rect, framesize_rect;
FRAME cached_frame, cached_screen_frame = 0;
FRAME cached_frame = 0;
FRAME cached_screen_frame = 0;
Task task = (Task)data;
int cached[CACHE_SIZE];
STAMP cached_stamp[CACHE_SIZE];
+2
View File
@@ -260,6 +260,8 @@ extern void DrawStatusMessage (UNICODE *pStr);
extern void DrawLanders (void);
extern void DrawStorageBays (BOOLEAN Refresh);
extern void GetGaugeRect (PRECT pRect, BOOLEAN IsCrewRect);
extern void DrawFlagshipStats (void);
extern void SaveFlagshipState (void);
extern void DeltaSISGauges (SIZE crew_delta, SIZE fuel_delta, int
resunit_delta);
+4 -3
View File
@@ -76,7 +76,7 @@ void
DrawShipPiece (PMENU_STATE pMS, COUNT which_piece, COUNT which_slot,
BOOLEAN DrawBluePrint)
{
COLOR OldColor;
COLOR OldColor = 0; // Initialisation is to keep the compiler silent.
RECT r;
STAMP Side, Top;
SBYTE RepairSlot;
@@ -251,7 +251,8 @@ DrawShipPiece (PMENU_STATE pMS, COUNT which_piece, COUNT which_slot,
}
}
int rotate_starbase(void* data)
static int
rotate_starbase(void *data)
{
DWORD TimeIn;
STAMP s;
@@ -528,7 +529,7 @@ ExitStarBase:
// XXX: Doesn't really belong in this file.
COUNT
WrapText (UNICODE *pStr, COUNT len, TEXT *tarray, SIZE field_width)
WrapText (const UNICODE *pStr, COUNT len, TEXT *tarray, SIZE field_width)
{
COUNT num_lines;
+1 -1
View File
@@ -66,7 +66,7 @@ extern BOOLEAN DoShipyard (PMENU_STATE pMS);
extern void DrawShipPiece (PMENU_STATE pMS, COUNT which_piece, COUNT
which_slot, BOOLEAN DrawBluePrint);
extern COUNT WrapText (UNICODE *pStr, COUNT len, TEXT *tarray, SIZE
extern COUNT WrapText (const UNICODE *pStr, COUNT len, TEXT *tarray, SIZE
field_width);
// XXX: Doesn't really belong in this file.
+6 -4
View File
@@ -24,7 +24,9 @@
#include "types.h"
#include "globdata.h"
#include "resinst.h"
#include "restart.h"
#include "setup.h"
#include "starcon.h"
#include "libs/tasklib.h"
@@ -32,7 +34,8 @@
// A seperate thread is always inside this function when the player
// is in hyperspace. This thread awakens every BATTLE_FRAME_RATE seconds.
// It then changes the appearant portal size when necessary.
int arilou_gate_task(void* data)
static int
arilou_gate_task(void *data)
{
BYTE counter;
DWORD TimeIn;
@@ -75,7 +78,8 @@ int arilou_gate_task(void* data)
/* TODO: Remove these declarations once threading is gone. */
extern int snddriver, soundflags;
int Starcon2Main(void *threadArg)
int
Starcon2Main (void *threadArg)
{
#if DEBUG_PSYTRON || CREATE_JOURNAL
{
@@ -117,8 +121,6 @@ while (--ac > 0)
if (LoadKernel (0,0))
{
extern BOOLEAN StartGame (void);
fprintf (stderr, "We've loaded the Kernel\n");
Logo ();
+23
View File
@@ -0,0 +1,23 @@
/*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*/
#ifndef _STARCON_H
#define _STARCON_H
extern int Starcon2Main(void *threadArg);
#endif /* _STARCON_H */
-2
View File
@@ -32,8 +32,6 @@ extern BOOLEAN GetGroupInfo (DWORD offset, BYTE which_group);
extern DWORD PutGroupInfo (DWORD offset, BYTE which_group);
extern void BuildGroups (void);
extern BOOLEAN GameOptions (void);
#define MAX_DESC_CHARS 60
typedef UNICODE GAME_DESC[MAX_DESC_CHARS + 1];
+6 -1
View File
@@ -427,7 +427,8 @@ PostProcessStatus (PELEMENT ShipPtr)
else
{
SetContextForeGroundColor (BLACK_COLOR);
if ((i -= 5) <= 14)
i -= 5;
if (i <= 14)
{
COLOR flash_tab1[] =
{
@@ -494,6 +495,10 @@ PostProcessStatus (PELEMENT ShipPtr)
r.extent.width = 2;
c = BUILD_COLOR (MAKE_RGB15 (0x1F, 0x50, 0x5), 0x28);
break;
default:
// Should not happen.
c = 0; // Keeping compiler quiet.
break;
}
DrawFilledRectangle (&r);
r.corner.x += i + r.extent.width;
+34 -10
View File
@@ -39,6 +39,7 @@
#include "uqmversion.h"
#include "comm.h"
#include "setup.h"
#include "starcon.h"
#if defined(GFXMODULE_SDL)
@@ -83,7 +84,7 @@ static int preParseOptions(int argc, char *argv[],
struct options_struct *options);
static int parseOptions(int argc, char *argv[],
struct options_struct *options);
static void usage (FILE *out);
static void usage (FILE *out, const struct options_struct *defaultOptions);
static int parseIntOption (const char *str, int *result,
const char *optName);
static int parseFloatOption (const char *str, float *f,
@@ -92,6 +93,7 @@ static int parseVolume (const char *str, float *vol, const char *optName);
static int InvalidArgument(const char *supplied, const char *opt_name);
static int Check_PC_3DO_opt (const char *value, DWORD mask, const char *opt,
int *result);
static const char *PC_3DO_optString (DWORD optMask);
/* TODO: Remove these global variables once threading is gone. */
int snddriver, soundflags;
@@ -153,7 +155,7 @@ main (int argc, char *argv[])
if (options.runMode == runMode_usage)
{
usage (stdout);
usage (stdout, &options);
return EXIT_SUCCESS;
}
@@ -651,7 +653,7 @@ parseFloatOption (const char *str, float *f, const char *optName)
}
static void
usage (FILE *out)
usage (FILE *out, const struct options_struct *defaultOptions)
{
fprintf (out, "Options:\n");
fprintf (out, " -r, --res=WIDTHxHEIGHT (default 640x480, bigger "
@@ -677,7 +679,7 @@ usage (FILE *out)
fprintf (out, " -u, --nosubtitles\n");
fprintf (out, " -l, --logfile=FILE (sends console output to logfile "
"FILE)\n");
fprintf (out, " --addon <addon> (using a specific addon; "
fprintf (out, " --addon ADDON (using a specific addon; "
"may be specified multiple times)\n");
fprintf (out, " --sound=DRIVER (openal, mixsdl, none; default "
"mixsdl)\n");
@@ -685,15 +687,20 @@ usage (FILE *out)
"currently only for openal)\n");
fprintf (out, "The following options can take either '3do' or 'pc' "
"as an option:\n");
fprintf (out, " -m, --music : Music version (default 3do)\n");
fprintf (out, " -i, --intro : Intro/ending version (default 3do)\n");
fprintf (out, " -m, --music : Music version (default %s)\n",
PC_3DO_optString(defaultOptions->whichMusic));
fprintf (out, " -i, --intro : Intro/ending version (default %s)\n",
PC_3DO_optString(defaultOptions->whichIntro));
fprintf (out, " --cscan : coarse-scan display, pc=text, "
"3do=hieroglyphs (default 3do)\n");
"3do=hieroglyphs (default %s)\n",
PC_3DO_optString(defaultOptions->whichCoarseScan));
fprintf (out, " --menu : menu type, pc=text, 3do=graphical "
"(default 3do)\n");
fprintf (out, " --font : font types and colors (default pc)\n");
"(default %s)\n", PC_3DO_optString(defaultOptions->whichMenu));
fprintf (out, " --font : font types and colors (default %s)\n",
PC_3DO_optString(defaultOptions->whichFonts));
fprintf (out, " --scroll : ff/frev during comm. pc=per-page, "
"3do=smooth (default pc)\n");
"3do=smooth (default %s)\n",
PC_3DO_optString(defaultOptions->smoothScroll));
}
static int
@@ -729,4 +736,21 @@ Check_PC_3DO_opt (const char *value, DWORD mask, const char *optName,
return -1;
}
static const char *
PC_3DO_optString(DWORD optMask) {
if (optMask & OPT_3DO)
{
if (optMask & OPT_PC)
return "both";
return "3do";
}
else
{
if (optMask & OPT_PC)
return "pc";
return "none";
}
}