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