From 10ec759022330d1b500a8aa47990b23a544f89fb Mon Sep 17 00:00:00 2001 From: avolkov Date: Thu, 15 Dec 2005 00:29:25 +0000 Subject: [PATCH] Random code cleanups: prototypes, formatting; generalized api for LoadPlanet() to take planet surface definition FRAME rather than IsEarth hack git-svn-id: svn://svn.code.sf.net/p/sc2/code/trunk@2074 8092fc87-c524-0410-9efc-e669fe64eaf9 --- sc2/src/sc2code/cleanup.c | 31 ++++----- sc2/src/sc2code/comm.c | 2 +- sc2/src/sc2code/comm/melnorm/melnorm.c | 7 +-- sc2/src/sc2code/comm/starbas/starbas.c | 9 +-- sc2/src/sc2code/controls.h | 1 + sc2/src/sc2code/gameopt.c | 6 +- sc2/src/sc2code/hyper.c | 8 --- sc2/src/sc2code/load.c | 1 + sc2/src/sc2code/load.h | 3 + sc2/src/sc2code/melee.c | 6 +- sc2/src/sc2code/menustat.h | 54 ++++++++++++++++ sc2/src/sc2code/mouse_err.c | 1 + sc2/src/sc2code/outfit.c | 1 + sc2/src/sc2code/planets/cargo.c | 3 +- sc2/src/sc2code/planets/devices.c | 3 +- sc2/src/sc2code/planets/genburv.c | 2 +- sc2/src/sc2code/planets/gencol.c | 2 +- sc2/src/sc2code/planets/gensol.c | 5 +- sc2/src/sc2code/planets/genspa.c | 4 +- sc2/src/sc2code/planets/gentopo.c | 1 + sc2/src/sc2code/planets/lander.c | 15 +---- sc2/src/sc2code/planets/lander.h | 7 +++ sc2/src/sc2code/planets/pl_stuff.c | 23 +++---- sc2/src/sc2code/planets/planets.c | 14 ++--- sc2/src/sc2code/planets/planets.h | 15 ++++- sc2/src/sc2code/planets/plangen.c | 87 ++++++++++++++------------ sc2/src/sc2code/planets/pstarmap.c | 15 +---- sc2/src/sc2code/planets/report.c | 1 - sc2/src/sc2code/planets/roster.c | 3 +- sc2/src/sc2code/planets/scan.c | 18 ++---- sc2/src/sc2code/planets/scan.h | 3 + sc2/src/sc2code/planets/solarsys.c | 16 ++--- sc2/src/sc2code/restart.c | 25 ++------ sc2/src/sc2code/save.c | 3 +- sc2/src/sc2code/setup.c | 7 +-- sc2/src/sc2code/shipcont.h | 36 +++++++++++ sc2/src/sc2code/shipyard.c | 1 + sc2/src/sc2code/sis.c | 7 ++- sc2/src/sc2code/starbase.c | 3 +- sc2/src/sc2code/starbase.h | 30 +-------- sc2/src/sc2code/starcon.c | 4 +- sc2/src/sc2code/starcon.h | 3 +- sc2/src/sc2code/util.c | 1 + sc2/src/sc2code/util.h | 1 + 44 files changed, 247 insertions(+), 241 deletions(-) create mode 100755 sc2/src/sc2code/menustat.h create mode 100755 sc2/src/sc2code/shipcont.h diff --git a/sc2/src/sc2code/cleanup.c b/sc2/src/sc2code/cleanup.c index fa459d3f0..2c21610f1 100644 --- a/sc2/src/sc2code/cleanup.c +++ b/sc2/src/sc2code/cleanup.c @@ -22,22 +22,17 @@ #include "reslib.h" #include "gamestr.h" #include "init.h" +#include "hyper.h" +#include "planets/lander.h" +#include "starcon.h" #include "setup.h" #include "sounds.h" #include "libs/sndlib.h" #include "libs/vidlib.h" -//Added by Chris - -void FreeSC2Data (void); - -void FreeLanderData (void); - -void FreeIPData (void); - -void FreeHyperData (void); - -//End Added by Chris +// XXX: we do not current have a header for this prototype to live in +// should be something like solarsys.h +extern void FreeIPData (void); static void UninitContexts (void); static void UninitKernel (BOOLEAN ships); @@ -95,16 +90,22 @@ UninitKernel (BOOLEAN ships) ActivityFrame = 0; } +void +FreeGameData (void) +{ + FreeSC2Data (); + FreeLanderData (); + FreeIPData (); + FreeHyperData (); +} + static void UninitGameKernel (void) { // XXX: this function is never called. Why not? (BUG?) if (ActivityFrame) { - FreeSC2Data (); - FreeLanderData (); - FreeIPData (); - FreeHyperData (); + FreeGameData (); UninitKernel (FALSE); UninitContexts (); diff --git a/sc2/src/sc2code/comm.c b/sc2/src/sc2code/comm.c index eea57b44c..30e565046 100644 --- a/sc2/src/sc2code/comm.c +++ b/sc2/src/sc2code/comm.c @@ -25,6 +25,7 @@ #include "endian_uqm.h" #include "gamestr.h" #include "options.h" +#include "load.h" #include "oscill.h" #include "resinst.h" #include "settings.h" @@ -2096,7 +2097,6 @@ RaceCommunication (void) { RACE_COMMUNICATION }; - extern ACTIVITY NextActivity; if (LOBYTE (GLOBAL (CurrentActivity)) == IN_LAST_BATTLE) { diff --git a/sc2/src/sc2code/comm/melnorm/melnorm.c b/sc2/src/sc2code/comm/melnorm/melnorm.c index 2fa762d56..8b39e41cf 100644 --- a/sc2/src/sc2code/comm/melnorm/melnorm.c +++ b/sc2/src/sc2code/comm/melnorm/melnorm.c @@ -22,16 +22,11 @@ #include "gameev.h" #include "setup.h" +#include "shipcont.h" #include "libs/inplib.h" #include "libs/mathlib.h" -//Added by Chris - -void DrawCargoStrings (BYTE OldElement, BYTE NewElement); - -//End Added by Chris - #define NUM_HISTORY_ITEMS 9 #define NUM_EVENT_ITEMS 8 #define NUM_ALIEN_RACE_ITEMS 16 diff --git a/sc2/src/sc2code/comm/starbas/starbas.c b/sc2/src/sc2code/comm/starbas/starbas.c index a19bf9c5d..6a85b65b2 100644 --- a/sc2/src/sc2code/comm/starbas/starbas.c +++ b/sc2/src/sc2code/comm/starbas/starbas.c @@ -22,6 +22,7 @@ #include "build.h" #include "setup.h" +#include "shipcont.h" #include "libs/graphics/gfx_common.h" #include "libs/inplib.h" #include "libs/mathlib.h" @@ -29,14 +30,6 @@ #include "libs/sound/sound.h" -//Added by Chris - -void ShowRemainingCapacity (void); - -void DrawCargoStrings (BYTE OldElement, BYTE NewElement); - -//End Added by Chris - static void TellMission (RESPONSE_REF R); static void SellMinerals (RESPONSE_REF R); diff --git a/sc2/src/sc2code/controls.h b/sc2/src/sc2code/controls.h index 25a6a29ee..1745786bf 100644 --- a/sc2/src/sc2code/controls.h +++ b/sc2/src/sc2code/controls.h @@ -91,6 +91,7 @@ BOOLEAN PauseGame (void); BOOLEAN DoConfirmExit (void); void TFB_Abort (void); BOOLEAN WaitAnyButtonOrQuit (BOOLEAN CheckSpecial); +extern void WaitForNoInput (SIZE Duration); extern BOOLEAN ConfirmExit (void); extern void DoInput (PVOID pInputState, BOOLEAN resetInput); diff --git a/sc2/src/sc2code/gameopt.c b/sc2/src/sc2code/gameopt.c index 99ee01246..de9d126a8 100644 --- a/sc2/src/sc2code/gameopt.c +++ b/sc2/src/sc2code/gameopt.c @@ -23,11 +23,13 @@ #include "commglue.h" #include "controls.h" #include "encount.h" +#include "planets/lander.h" #include "gamestr.h" #include "inplib.h" #include "load.h" #include "options.h" #include "save.h" +#include "starbase.h" #include "settings.h" #include "setup.h" #include "sounds.h" @@ -1343,14 +1345,10 @@ PickGame (PMENU_STATE pMS) { if (pSolarSysState->MenuState.Initialized < 3) { - extern MUSIC_REF SpaceMusic; - PlayMusic (SpaceMusic, TRUE, 1); } else { - extern MUSIC_REF LanderMusic; - PlayMusic (LanderMusic, TRUE, 1); } } diff --git a/sc2/src/sc2code/hyper.c b/sc2/src/sc2code/hyper.c index 56840ae8a..3e7fa93a5 100644 --- a/sc2/src/sc2code/hyper.c +++ b/sc2/src/sc2code/hyper.c @@ -33,14 +33,6 @@ #include "libs/mathlib.h" -//Added by Chris - -void WaitForNoInput (SIZE Duration); - -//End Added by Chris - -static void LoadHyperData (void); - #define XOFFS ((RADAR_SCAN_WIDTH + (UNIT_SCREEN_WIDTH << 2)) >> 1) #define YOFFS ((RADAR_SCAN_HEIGHT + (UNIT_SCREEN_HEIGHT << 2)) >> 1) diff --git a/sc2/src/sc2code/load.c b/sc2/src/sc2code/load.c index 41fd49364..2fabf56bb 100644 --- a/sc2/src/sc2code/load.c +++ b/sc2/src/sc2code/load.c @@ -23,6 +23,7 @@ #include "encount.h" #include "file.h" #include "globdata.h" +#include "load.h" #include "options.h" #include "setup.h" #include "state.h" diff --git a/sc2/src/sc2code/load.h b/sc2/src/sc2code/load.h index 120b15361..2de0010b5 100644 --- a/sc2/src/sc2code/load.h +++ b/sc2/src/sc2code/load.h @@ -19,6 +19,9 @@ #include "sis.h" #include "libs/compiler.h" +#include "globdata.h" + +extern ACTIVITY NextActivity; extern BOOLEAN LoadGame (COUNT which_game, SUMMARY_DESC *summary_desc); diff --git a/sc2/src/sc2code/melee.c b/sc2/src/sc2code/melee.c index c389fa197..8d1e53d8c 100644 --- a/sc2/src/sc2code/melee.c +++ b/sc2/src/sc2code/melee.c @@ -32,6 +32,7 @@ #include "resinst.h" #include "save.h" #include "settings.h" +#include "gameopt.h" #include "setup.h" #include "sounds.h" #include "util.h" @@ -46,11 +47,6 @@ #include -//Added by Chris - -void ConfirmSaveLoad (STAMP *MsgStamp); - -//End Added by Chris static void DrawMeleeShipStrings (PMELEE_STATE pMS, BYTE NewStarShip); diff --git a/sc2/src/sc2code/menustat.h b/sc2/src/sc2code/menustat.h new file mode 100755 index 000000000..2c465b9e4 --- /dev/null +++ b/sc2/src/sc2code/menustat.h @@ -0,0 +1,54 @@ +//Copyright Paul Reiche, Fred Ford. 1992-2002 + +/* + * 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 _MENUSTAT_H +#define _MENUSTAT_H + +#include "libs/gfxlib.h" +#include "libs/sndlib.h" +#include "libs/tasklib.h" + + +typedef struct menu_state +{ + BOOLEAN (*InputFunc) (struct menu_state *pMS); + COUNT MenuRepeatDelay; + + SIZE Initialized; + + BYTE CurState; + FRAME CurFrame; + STRING CurString; + POINT first_item; + SIZE delta_item; + + FRAME ModuleFrame; + Task flash_task; + RECT flash_rect0, flash_rect1; + FRAME flash_frame0, flash_frame1; + + MUSIC_REF hMusic; +} MENU_STATE; + +typedef MENU_STATE *PMENU_STATE; + +extern PMENU_STATE pMenuState; + +#endif /* _MENUSTAT_H */ + + diff --git a/sc2/src/sc2code/mouse_err.c b/sc2/src/sc2code/mouse_err.c index 696394312..b08aea1e6 100644 --- a/sc2/src/sc2code/mouse_err.c +++ b/sc2/src/sc2code/mouse_err.c @@ -22,6 +22,7 @@ #include "libs/graphics/gfx_common.h" #include "libs/graphics/widgets.h" #include "libs/graphics/tfb_draw.h" +#include "util.h" typedef struct mouse_error_state { BOOLEAN (*InputFunc) (struct mouse_error_state *pInputState); diff --git a/sc2/src/sc2code/outfit.c b/sc2/src/sc2code/outfit.c index c12525075..1b548cac9 100644 --- a/sc2/src/sc2code/outfit.c +++ b/sc2/src/sc2code/outfit.c @@ -23,6 +23,7 @@ #include "gamestr.h" #include "resinst.h" #include "settings.h" +#include "starbase.h" #include "setup.h" #include "sis.h" #include "sounds.h" diff --git a/sc2/src/sc2code/planets/cargo.c b/sc2/src/sc2code/planets/cargo.c index ac37c04df..96791bece 100644 --- a/sc2/src/sc2code/planets/cargo.c +++ b/sc2/src/sc2code/planets/cargo.c @@ -19,13 +19,12 @@ #include "colors.h" #include "controls.h" #include "gamestr.h" +#include "shipcont.h" #include "setup.h" #include "sounds.h" #include "util.h" -void DrawCargoStrings (BYTE OldElement, BYTE NewElement); - void ShowRemainingCapacity (void) { diff --git a/sc2/src/sc2code/planets/devices.c b/sc2/src/sc2code/planets/devices.c index 778d3bc43..f0171fd6d 100644 --- a/sc2/src/sc2code/planets/devices.c +++ b/sc2/src/sc2code/planets/devices.c @@ -21,6 +21,8 @@ #include "gamestr.h" #include "controls.h" #include "settings.h" +#include "shipcont.h" +#include "load.h" #include "setup.h" #include "state.h" #include "sounds.h" @@ -194,7 +196,6 @@ static UWORD DeviceFailed (BYTE which_device) { BYTE val; - extern ACTIVITY NextActivity; switch (which_device) { diff --git a/sc2/src/sc2code/planets/genburv.c b/sc2/src/sc2code/planets/genburv.c index ad3ed131c..7b7da59a2 100644 --- a/sc2/src/sc2code/planets/genburv.c +++ b/sc2/src/sc2code/planets/genburv.c @@ -175,7 +175,7 @@ GenerateBurvixes (BYTE control) CaptureStringTable ( LoadStringTable (BURV_BCS_STRTAB)); } - LoadPlanet (FALSE); + LoadPlanet (NULL); break; } default: diff --git a/sc2/src/sc2code/planets/gencol.c b/sc2/src/sc2code/planets/gencol.c index bad0e46b3..d07e02fea 100644 --- a/sc2/src/sc2code/planets/gencol.c +++ b/sc2/src/sc2code/planets/gencol.c @@ -106,7 +106,7 @@ GenerateColony (BYTE control) pSolarSysState->SysInfo.PlanetInfo.Tectonics = 0; pSolarSysState->SysInfo.PlanetInfo.SurfaceTemperature = 28; - LoadPlanet (FALSE); + LoadPlanet (NULL); break; } default: diff --git a/sc2/src/sc2code/planets/gensol.c b/sc2/src/sc2code/planets/gensol.c index 2855778dc..30d9a915c 100644 --- a/sc2/src/sc2code/planets/gensol.c +++ b/sc2/src/sc2code/planets/gensol.c @@ -323,7 +323,8 @@ generate_orbital (void) pSolarSysState->SysInfo.PlanetInfo.SurfaceGravity = CalcGravity (pSolarSysState->SysInfo.PlanetInfo.PlanetDensity, pSolarSysState->SysInfo.PlanetInfo.PlanetRadius); - LoadPlanet (i == 2); + LoadPlanet (i == 2 ? CaptureDrawable (LoadGraphic (EARTH_MASK_ANIM)) + : NULL); } else { @@ -415,7 +416,7 @@ generate_orbital (void) pSolarSysState->SysInfo.PlanetInfo.SurfaceGravity = CalcGravity (pSolarSysState->SysInfo.PlanetInfo.PlanetDensity, pSolarSysState->SysInfo.PlanetInfo.PlanetRadius); - LoadPlanet (FALSE); + LoadPlanet (NULL); } } diff --git a/sc2/src/sc2code/planets/genspa.c b/sc2/src/sc2code/planets/genspa.c index 997e829da..f7aca49e1 100644 --- a/sc2/src/sc2code/planets/genspa.c +++ b/sc2/src/sc2code/planets/genspa.c @@ -206,7 +206,7 @@ GenerateSpathi (BYTE control) LoadStringTable (UMGAH_BCS_STRTAB) ); } - LoadPlanet (FALSE); + LoadPlanet (NULL); break; } else if (pSolarSysState->pOrbitalDesc == &pSolarSysState->PlanetDesc[0]) @@ -230,7 +230,7 @@ GenerateSpathi (BYTE control) pSolarSysState->SysInfo.PlanetInfo.Tectonics = 0; pSolarSysState->SysInfo.PlanetInfo.SurfaceTemperature = 31; - LoadPlanet (FALSE); + LoadPlanet (NULL); break; } default: diff --git a/sc2/src/sc2code/planets/gentopo.c b/sc2/src/sc2code/planets/gentopo.c index 75ef7192b..d470c4088 100644 --- a/sc2/src/sc2code/planets/gentopo.c +++ b/sc2/src/sc2code/planets/gentopo.c @@ -18,6 +18,7 @@ #include "gfxlib.h" #include "mathlib.h" +#include "planets.h" void DeltaTopography (COUNT num_iterations, PSBYTE DepthArray, PRECT pRect, diff --git a/sc2/src/sc2code/planets/lander.c b/sc2/src/sc2code/planets/lander.c index 9562cf93a..313a771db 100644 --- a/sc2/src/sc2code/planets/lander.c +++ b/sc2/src/sc2code/planets/lander.c @@ -22,6 +22,7 @@ #include "gamestr.h" #include "lander.h" #include "lifeform.h" +#include "scan.h" #include "nameref.h" #include "resinst.h" #include "setup.h" @@ -43,19 +44,6 @@ // ONE_SECOND. #define PLANET_SIDE_RATE (ONE_SECOND / 35) -//Added by Chris - -void -DrawPlanet(int x, int y, int dy, unsigned int rgb); - -void RepairBackRect (PRECT pRect); - -void -SetPlanetTilt (int da); - -//End Added by Chris - -extern void DrawScannedObjects (BOOLEAN Reversed); FRAME LanderFrame[8]; static SOUND LanderSounds; @@ -1152,7 +1140,6 @@ RepairScan (void) { CONTEXT OldContext; HELEMENT hElement, hNextElement; - extern void DrawScannedObjects (BOOLEAN Reversed); OldContext = SetContext (ScanContext); diff --git a/sc2/src/sc2code/planets/lander.h b/sc2/src/sc2code/planets/lander.h index 890753080..af6921cd4 100644 --- a/sc2/src/sc2code/planets/lander.h +++ b/sc2/src/sc2code/planets/lander.h @@ -23,6 +23,7 @@ #include "libs/compiler.h" #include "libs/gfxlib.h" #include "libs/sndlib.h" +#include "menustat.h" #define NUM_TEXT_FRAMES 32 @@ -50,8 +51,14 @@ typedef struct typedef PLANETSIDE_DESC *PPLANETSIDE_DESC; extern CONTEXT ScanContext; +extern MUSIC_REF LanderMusic; +extern void PlanetSide (PMENU_STATE pMS); extern void DoDiscoveryReport (SOUND ReadOutSounds); +extern void SetPlanetMusic (BYTE planet_type); +extern void LoadLanderData (void); +extern void FreeLanderData (void); + #endif /* _LANDER_H */ diff --git a/sc2/src/sc2code/planets/pl_stuff.c b/sc2/src/sc2code/planets/pl_stuff.c index 8dd918bfb..1d71fe43b 100644 --- a/sc2/src/sc2code/planets/pl_stuff.c +++ b/sc2/src/sc2code/planets/pl_stuff.c @@ -20,6 +20,7 @@ #include "setup.h" #include "libs/graphics/gfx_common.h" #include "libs/graphics/drawable.h" +#include "planets/scan.h" #include @@ -30,21 +31,15 @@ #define USE_ADDITIVE_SCAN_BLIT -DWORD frame_mapRGBA (FRAME FramePtr,UBYTE r, UBYTE g, UBYTE b, UBYTE a); +// XXX: these are currently defined in libs/graphics/sdl/3do_getbody.c +// they should be sorted out and cleaned up at some point +extern DWORD frame_mapRGBA (FRAME FramePtr, UBYTE r, UBYTE g, + UBYTE b, UBYTE a); +extern void fill_frame_rgb (FRAME FramePtr, DWORD color, int x0, int y0, + int x, int y); +extern void arith_frame_blit (FRAME srcFrame, RECT *rsrc, FRAME dstFrame, + RECT *rdst, int num, int denom); -DWORD frame_mapRGBA (FRAME FramePtr,UBYTE r, UBYTE g, UBYTE b, UBYTE a); - -void process_rgb_bmp (FRAME FramePtr, DWORD *rgba, int maxx, int maxy); - -void fill_frame_rgb (FRAMEPTR FramePtr, DWORD color, int x0, int y0, int x, int y); - -void arith_frame_blit (FRAMEPTR srcFrame, RECT *rsrc, FRAMEPTR dstFrame, RECT *rdst, int num, int denom); - -extern FRAME stretch_frame (FRAME FramePtr, int neww, int newh,int destroy); - -extern void RenderLevelMasks (int); - -void RepairBackRect (PRECT pRect); // RotatePlanet // This will take care of zooming into a planet on orbit, generating the planet frames diff --git a/sc2/src/sc2code/planets/planets.c b/sc2/src/sc2code/planets/planets.c index 4b0b6c209..42b105a3c 100644 --- a/sc2/src/sc2code/planets/planets.c +++ b/sc2/src/sc2code/planets/planets.c @@ -18,6 +18,7 @@ #include "element.h" #include "scan.h" +#include "lander.h" #include "settings.h" #include "setup.h" #include "uqmdebug.h" @@ -25,13 +26,8 @@ #include "resinst.h" -extern void DrawPlanet (int x, int y, int dy, unsigned int rgb); -extern void GeneratePlanetSide (void); -extern void GeneratePlanetMask (PPLANET_DESC pPlanetDesc, BOOLEAN IsEarth); -extern void SetPlanetMusic (BYTE planet_type); -extern int rotate_planet_task (PVOID Blah); +extern int rotate_planet_task (PVOID data); -extern MUSIC_REF LanderMusic; void DrawScannedObjects (BOOLEAN Reversed) @@ -127,7 +123,7 @@ DrawOrbitalDisplay (DRAW_ORBITAL_MODE Mode) // IsDefined is true only when the planet comes with its own bitmap, // namely for Earth. void -LoadPlanet (BOOLEAN IsDefined) +LoadPlanet (FRAME SurfDefFrame) { BOOLEAN WaitMode; @@ -169,7 +165,7 @@ LoadPlanet (BOOLEAN IsDefined) LoadLanderData (); */ - GeneratePlanetMask (pPlanetDesc, IsDefined); + GeneratePlanetMask (pPlanetDesc, SurfDefFrame); SetPlanetMusic ((UBYTE)(pPlanetDesc->data_index & ~PLANET_SHIELDED)); if (pPlanetDesc->pPrevDesc != &pSolarSysState->SunDesc[0]) @@ -254,7 +250,7 @@ FreePlanet (void) DestroyDrawable (ReleaseDrawable (Orbit->ShieldFrame)); Orbit->ShieldFrame = 0; - if (Orbit->lpTopoMap!=0) + if (Orbit->lpTopoMap != 0) { HFree (Orbit->lpTopoMap); Orbit->lpTopoMap = 0; diff --git a/sc2/src/sc2code/planets/planets.h b/sc2/src/sc2code/planets/planets.h index 2ad71e0f8..f330febdc 100644 --- a/sc2/src/sc2code/planets/planets.h +++ b/sc2/src/sc2code/planets/planets.h @@ -19,7 +19,7 @@ #ifndef _PLANETS_H #define _PLANETS_H -#include "starbase.h" +#include "menustat.h" #include "units.h" #define END_INTERPLANETARY START_INTERPLANETARY @@ -203,9 +203,10 @@ typedef struct solarsys_state typedef SOLARSYS_STATE *PSOLARSYS_STATE; extern PSOLARSYS_STATE pSolarSysState; +extern MUSIC_REF SpaceMusic; -extern void LoadPlanet (BOOLEAN IsDefined); -extern void DrawPlanet(int x, int y, int dy, unsigned int rgb); +extern void LoadPlanet (FRAME SurfDefFrame); +extern void DrawPlanet (int x, int y, int dy, unsigned int rgb); extern void FreePlanet (void); extern void LoadStdLanderFont (PLANET_INFO *info); extern void FreeLanderFont (PLANET_INFO *info); @@ -231,5 +232,13 @@ extern BOOLEAN ValidateOrbits (void); extern void IP_reset (void); extern void IP_frame (void); +extern PRECT RotatePlanet (int x, int dx, int dy, COUNT scale_amt, + UBYTE zoom_from, PRECT r); +extern void SetPlanetTilt (int da); +extern void DrawScannedObjects (BOOLEAN Reversed); +extern void GeneratePlanetMask (PPLANET_DESC pPlanetDesc, FRAME SurfDefFrame); +extern void DeltaTopography (COUNT num_iterations, PSBYTE DepthArray, + PRECT pRect, SIZE depth_delta); + #endif /* _PLANETS_H */ diff --git a/sc2/src/sc2code/planets/plangen.c b/sc2/src/sc2code/planets/plangen.c index 76b7bb892..7b3659b32 100644 --- a/sc2/src/sc2code/planets/plangen.c +++ b/sc2/src/sc2code/planets/plangen.c @@ -20,7 +20,9 @@ #include "resinst.h" #include "setup.h" #include "planets/planets.h" +#include "planets/scan.h" #include "libs/graphics/gfx_common.h" +#include "libs/graphics/drawable.h" #include "libs/mathlib.h" #include @@ -37,28 +39,19 @@ // an additive overlay for the shield effect #undef USE_ALPHA_SHIELD -extern void DeltaTopography (COUNT num_iterations, PSBYTE DepthArray, - PRECT pRect, SIZE depth_delta); - -void SetPlanetTilt (int da); - -void RepairBackRect (PRECT pRect); - -PRECT RotatePlanet (int x, int dx, int dy, COUNT scale_amt, UBYTE zoom_from, - PRECT r); - -DWORD frame_mapRGBA (FRAME FramePtr,UBYTE r, UBYTE g, UBYTE b, UBYTE a); - -void process_rgb_bmp (FRAME FramePtr, DWORD *rgba, int maxx, int maxy); - -FRAME stretch_frame (FRAME FramePtr, int neww, int newh,int destroy); - -void fill_frame_rgb (FRAME FramePtr, DWORD color, int x0, int y0, +// XXX: these are currently defined in libs/graphics/sdl/3do_getbody.c +// they should be sorted out and cleaned up at some point +extern DWORD frame_mapRGBA (FRAME FramePtr, UBYTE r, UBYTE g, + UBYTE b, UBYTE a); +extern void process_rgb_bmp (FRAME FramePtr, DWORD *rgba, int maxx, int maxy); +extern FRAME stretch_frame (FRAME FramePtr, int neww, int newh, int destroy); +extern void fill_frame_rgb (FRAME FramePtr, DWORD color, int x0, int y0, int x, int y); +extern void arith_frame_blit (FRAME srcFrame, RECT *rsrc, FRAME dstFrame, + RECT *rdst, int num, int denom); +extern void getpixelarray (DWORD *array, FRAME FramePtr, + int width, int height); -void arith_frame_blit (FRAME srcFrame, RECT *rsrc, FRAME dstFrame, RECT *rdst, int num, int denom); - -void getpixelarray(DWORD *array, FRAME FramePtr, int width, int height); #define SHIELD_GLOW_COMP 120 #define SHIELD_REFLECT_COMP 100 @@ -226,7 +219,7 @@ TransformTopography (FRAME DstFrame, PBYTE pTopoData, int w, int h) SetContext (OldContext); } -void +static void RenderTopography (BOOLEAN Reconstruct) // Reconstruct arg was not used on 3DO and is not needed here either { @@ -1222,7 +1215,8 @@ ValidateMap (PSBYTE DepthArray) } while (--i); } -void planet_orbit_init () +void +planet_orbit_init () { PLANET_ORBIT *Orbit = &pSolarSysState->Orbit; @@ -1241,9 +1235,9 @@ void planet_orbit_init () Orbit->TopoZoomFrame = CaptureDrawable ( CreateDrawable (WANT_PIXMAP, (COUNT)(MAP_WIDTH << 2), (COUNT)(MAP_HEIGHT << 2), 1)); - Orbit->lpTopoMap = (DWORD *)HMalloc (sizeof(DWORD) + Orbit->lpTopoMap = HMalloc (sizeof (DWORD) * (MAP_HEIGHT * (MAP_WIDTH + MAP_HEIGHT))); - Orbit->ScratchArray = (DWORD *)HMalloc (sizeof (DWORD *) + Orbit->ScratchArray = HMalloc (sizeof (DWORD) * (SHIELD_DIAM) * (SHIELD_DIAM)); } @@ -1468,7 +1462,7 @@ TopoScale4x (PBYTE pDstTopo, PBYTE pSrcTopo, int num_faults, int fault_var) } void -GeneratePlanetMask (PPLANET_DESC pPlanetDesc, BOOLEAN IsEarth) +GeneratePlanetMask (PPLANET_DESC pPlanetDesc, FRAME SurfDefFrame) { RECT r; DWORD old_seed; @@ -1483,15 +1477,22 @@ GeneratePlanetMask (PPLANET_DESC pPlanetDesc, BOOLEAN IsEarth) OldContext = SetContext (TaskContext); planet_orbit_init (); - if (IsEarth) - { - //Earth uses a pixmap for the topography - pSolarSysState->TopoFrame = CaptureDrawable ( - LoadGraphic (EARTH_MASK_ANIM)); - pSolarSysState->TopoFrame = stretch_frame ( - pSolarSysState->TopoFrame, MAP_WIDTH, MAP_HEIGHT, 1); - } else { + if (SurfDefFrame) + { // This is a defined planet; pixmap for the topography and + // elevation data is supplied in Surface Definition frame + + // surface pixmap + SurfDefFrame = SetAbsFrameIndex (SurfDefFrame, 0); + if (GetFrameWidth (SurfDefFrame) != MAP_WIDTH + || GetFrameHeight (SurfDefFrame) != MAP_HEIGHT) + pSolarSysState->TopoFrame = stretch_frame (SurfDefFrame, + MAP_WIDTH, MAP_HEIGHT, 1); + else + pSolarSysState->TopoFrame = SurfDefFrame; + } + else + { // Generate planet surface elevation data and look PlanDataPtr = &PlanData[pPlanetDesc->data_index & ~PLANET_SHIELDED]; r.corner.x = r.corner.y = 0; @@ -1611,15 +1612,17 @@ GeneratePlanetMask (PPLANET_DESC pPlanetDesc, BOOLEAN IsEarth) y += MAP_WIDTH + MAP_HEIGHT) for (x = 0; x < MAP_HEIGHT; x++) Orbit->lpTopoMap[y + x + MAP_WIDTH] = Orbit->lpTopoMap[y + x]; + if (pSolarSysState->pOrbitalDesc->pPrevDesc == &pSolarSysState->SunDesc[0]) - { - // This is a planet. Get its location + { // this is a planet -- get its location loc = pSolarSysState->pOrbitalDesc->location; - } else { - // This is a moon. Get its planet's location + } + else + { // this is a moon -- get its planet's location loc = pSolarSysState->pOrbitalDesc->pPrevDesc->location; } + RenderPhongMask (loc); if (pPlanetDesc->data_index & PLANET_SHIELDED) @@ -1655,7 +1658,6 @@ rotate_planet_task (void *data) // SetPlanetTilt ((pSS->SysInfo.PlanetInfo.AxialTilt << 8) / 360); SetPlanetTilt (pSS->SysInfo.PlanetInfo.AxialTilt); -// angle=pSS->SysInfo.PlanetInfo.AxialTilt; i = 1 - ((pSS->SysInfo.PlanetInfo.AxialTilt & 1) << 1); init_x = (i == 1) ? (0) : (MAP_WIDTH - 1); @@ -1689,7 +1691,7 @@ rotate_planet_task (void *data) // to guarantee that PauseRotate doesn't change while waiting // to acquire the graphics lock LockMutex (GraphicsLock); - if (*(volatile UBYTE *)&pSS->PauseRotate !=1 + if (*(volatile UBYTE *)&pSS->PauseRotate != 1 // if (((PSOLARSYS_STATE volatile)pSS)->MenuState.Initialized <= 3 && !(GLOBAL (CurrentActivity) & CHECK_ABORT)) { @@ -1707,15 +1709,18 @@ rotate_planet_task (void *data) ++pSS->MenuState.Initialized; } x += i; - } else + } + else view_index++; UnlockMutex (GraphicsLock); // If this frame hasn't been generted, generate it - if (! pSolarSysState->Orbit.isPFADefined[x]) { + if (! pSolarSysState->Orbit.isPFADefined[x]) + { RenderLevelMasks (x); pSolarSysState->Orbit.isPFADefined[x] = 1; } + if (zooming) { frame_num++; diff --git a/sc2/src/sc2code/planets/pstarmap.c b/sc2/src/sc2code/planets/pstarmap.c index 58254866e..dec428ed9 100644 --- a/sc2/src/sc2code/planets/pstarmap.c +++ b/sc2/src/sc2code/planets/pstarmap.c @@ -23,6 +23,8 @@ #include "gamestr.h" #include "globdata.h" #include "options.h" +#include "scan.h" +#include "shipcont.h" #include "settings.h" #include "setup.h" #include "sounds.h" @@ -33,11 +35,6 @@ #include "libs/mathlib.h" -//Added by Chris - -void RepairBackRect (PRECT pRect); - -//End Added by Chris #define UNIVERSE_TO_DISPX(ux) \ (COORD)(((((long)(ux) - pMenuState->flash_rect1.corner.x) \ @@ -1239,8 +1236,6 @@ DoFlagshipCommands (PMENU_STATE pMS) break; case EQUIP_DEVICE: { - extern BOOLEAN Devices (PMENU_STATE pMS); - pMenuState = pMS; if (!Devices (pMS)) select = FALSE; @@ -1254,15 +1249,11 @@ DoFlagshipCommands (PMENU_STATE pMS) } case CARGO: { - extern void Cargo (PMENU_STATE pMS); - Cargo (pMS); break; } case ROSTER: { - extern BOOLEAN Roster (void); - if (!Roster ()) select = FALSE; break; @@ -1299,7 +1290,7 @@ DoFlagshipCommands (PMENU_STATE pMS) if (!AutoPilotSet && pMS->Initialized >= 3) { - LoadPlanet (FALSE); + LoadPlanet (NULL); --pMS->Initialized; pSolarSysState->PauseRotate = 0; LockMutex (GraphicsLock); diff --git a/sc2/src/sc2code/planets/report.c b/sc2/src/sc2code/planets/report.c index 64ebae610..cc01c6908 100644 --- a/sc2/src/sc2code/planets/report.c +++ b/sc2/src/sc2code/planets/report.c @@ -239,7 +239,6 @@ DoDiscoveryReport (SOUND ReadOutSounds) { POINT old_curs; CONTEXT OldContext; - extern void DrawScannedObjects (BOOLEAN Reversed); #ifdef DEBUG if (disableInteractivity) diff --git a/sc2/src/sc2code/planets/roster.c b/sc2/src/sc2code/planets/roster.c index fec550508..b66493895 100644 --- a/sc2/src/sc2code/planets/roster.c +++ b/sc2/src/sc2code/planets/roster.c @@ -20,13 +20,14 @@ #include "colors.h" #include "controls.h" #include "races.h" +#include "shipcont.h" #include "setup.h" #include "sounds.h" #include "libs/gfxlib.h" #include "libs/tasklib.h" -int +static int flash_ship_task (void *data) { DWORD TimeIn; diff --git a/sc2/src/sc2code/planets/scan.c b/sc2/src/sc2code/planets/scan.c index 6d348f8de..58416d1d8 100644 --- a/sc2/src/sc2code/planets/scan.c +++ b/sc2/src/sc2code/planets/scan.c @@ -25,6 +25,9 @@ #include "options.h" #include "resinst.h" #include "settings.h" +#include "load.h" +#include "util.h" +#include "lander.h" #include "setup.h" #include "sounds.h" #include "state.h" @@ -33,14 +36,7 @@ #include "libs/mathlib.h" -//Added by Chris - -void -DrawPlanet(int x, int y, int dy, unsigned int rgb); - -void WaitForNoInput (SIZE Duration); - -//End Added by Chris +extern FRAME SpaceJunkFrame; // define SPIN_ON_SCAN to allow the planet to spin // while scaning is going on @@ -50,8 +46,6 @@ void WaitForNoInput (SIZE Duration); #define FLASH_WIDTH 9 #define FLASH_HEIGHT 9 -extern void DrawScannedObjects (BOOLEAN Reversed); - CONTEXT ScanContext; void @@ -73,7 +67,6 @@ static void EraseCoarseScan (void) { RECT r, tr; - extern FRAME SpaceJunkFrame; const int leftScanWidth = 80; const int rightScanWidth = 80; const int leftScanOffset = 5; @@ -368,7 +361,6 @@ PrintCoarseScan3DO (void) TEXT t; STAMP s; UNICODE buf[40]; - extern FRAME SpaceJunkFrame; LockMutex (GraphicsLock); SetContext (SpaceContext); @@ -746,7 +738,6 @@ PickPlanetSide (PMENU_STATE pMS) else { COUNT fuel_required; - extern void PlanetSide (PMENU_STATE pMS); fuel_required = (COUNT)( pSolarSysState->SysInfo.PlanetInfo.SurfaceGravity << 1 @@ -771,7 +762,6 @@ PickPlanetSide (PMENU_STATE pMS) if (GET_GAME_STATE (FOUND_PLUTO_SPATHI) == 1) { HSTARSHIP hStarShip; - extern ACTIVITY NextActivity; if (pMenuState->flash_task) { diff --git a/sc2/src/sc2code/planets/scan.h b/sc2/src/sc2code/planets/scan.h index e5c2ea5f9..624902e2f 100644 --- a/sc2/src/sc2code/planets/scan.h +++ b/sc2/src/sc2code/planets/scan.h @@ -43,5 +43,8 @@ typedef SCAN_BLOCK *PSCAN_BLOCK; #define SCALED_ROOT_TWO 92682L /* root 2 * (1 << 16) */ #define SCALE_FACTOR 16 +extern void RepairBackRect (PRECT pRect); +extern void GeneratePlanetSide (void); + #endif /* _SCAN_H */ diff --git a/sc2/src/sc2code/planets/solarsys.c b/sc2/src/sc2code/planets/solarsys.c index 1e1d7ba58..763baf869 100644 --- a/sc2/src/sc2code/planets/solarsys.c +++ b/sc2/src/sc2code/planets/solarsys.c @@ -25,6 +25,8 @@ #include "nameref.h" #include "resinst.h" #include "settings.h" +#include "lander.h" +#include "load.h" #include "setup.h" #include "sounds.h" #include "state.h" @@ -36,13 +38,6 @@ //#define DEBUG_SOLARSYS -//Added by Chris - -void LoadLanderData (void); - -void RenderTopography (BOOLEAN Reconstruct); - -//End Added by Chris PSOLARSYS_STATE pSolarSysState; FRAME SISIPFrame, SunFrame, OrbitalFrame, SpaceJunkFrame; @@ -807,8 +802,6 @@ flagship_inertial_thrust (COUNT CurrentAngle) } } -extern void DrawIPRadar (BOOLEAN FirstTime); - static void ProcessShipControls (void) { @@ -871,6 +864,7 @@ UndrawShip (void) BOOLEAN LeavingInnerSystem; #ifdef SHOW_RADAR + extern void DrawIPRadar (BOOLEAN FirstTime); DrawIPRadar (FALSE); #endif /* SHOW_RADAR */ @@ -1470,8 +1464,6 @@ InitSolarSys (void) if ((LastActivity & (CHECK_LOAD | CHECK_RESTART)) == LastActivity) { - extern ACTIVITY NextActivity; - DrawSISFrame (); if (NextActivity) LastActivity &= ~(CHECK_LOAD | CHECK_RESTART); @@ -1627,7 +1619,7 @@ GenerateRandomIP (BYTE control) pSolarSysState->SysInfo.PlanetInfo.ScanSeed[ENERGY_SCAN] = rand_val; - LoadPlanet (FALSE); + LoadPlanet (NULL); break; } case GENERATE_NAME: diff --git a/sc2/src/sc2code/restart.c b/sc2/src/sc2code/restart.c index b3e1828e4..0ff27577d 100644 --- a/sc2/src/sc2code/restart.c +++ b/sc2/src/sc2code/restart.c @@ -28,25 +28,16 @@ #include "melee.h" #include "resinst.h" #include "settings.h" +#include "load.h" #include "setup.h" #include "sounds.h" #include "setupmenu.h" #include "util.h" +#include "starcon.h" #include "uqmversion.h" #include "libs/graphics/gfx_common.h" #include "libs/inplib.h" -//Added by Chris - -void FreeHyperData (void); - -void FreeIPData (void); - -void FreeSC2Data (void); - -void FreeLanderData (void); - -//End Added by Chris enum { @@ -120,7 +111,6 @@ DWORD InTime; static BOOLEAN DoRestart (PMENU_STATE pMS) { - extern void MouseError (void); static DWORD InactTimeOut; /* Cancel any presses of the Pause key. */ @@ -289,7 +279,6 @@ TimedOut: { DWORD TimeOut; BYTE black_buf[1]; - extern ACTIVITY NextActivity; TryAgain: ReinitQueue (&race_q[0]); @@ -330,10 +319,7 @@ LastActivity = WON_LAST_BATTLE; OutTakes (); Credits (); - FreeSC2Data (); - FreeLanderData (); - FreeIPData (); - FreeHyperData (); + FreeGameData (); TimeOut = ONE_SECOND / 2; GLOBAL (CurrentActivity) = CHECK_ABORT; @@ -382,10 +368,7 @@ LastActivity = WON_LAST_BATTLE; if (LOBYTE (GLOBAL (CurrentActivity)) == SUPER_MELEE) { -FreeSC2Data (); -FreeLanderData (); -FreeIPData (); -FreeHyperData (); + FreeGameData (); Melee (); MenuState.Initialized = FALSE; goto TryAgain; diff --git a/sc2/src/sc2code/save.c b/sc2/src/sc2code/save.c index 3162f4c0b..b76700acf 100644 --- a/sc2/src/sc2code/save.c +++ b/sc2/src/sc2code/save.c @@ -27,6 +27,7 @@ #include "globdata.h" #include "options.h" #include "races.h" +#include "shipcont.h" #include "setup.h" #include "state.h" #include "util.h" @@ -87,8 +88,6 @@ SaveShipQueue (DECODE_REF fh, PQUEUE pQueue) static void PrepareSummary (SUMMARY_DESC *summary_desc) { - extern SIZE InventoryDevices (BYTE *pDeviceMap); - summary_desc->SS = GlobData.SIS_state; switch (summary_desc->Activity = LOBYTE (GLOBAL (CurrentActivity))) diff --git a/sc2/src/sc2code/setup.c b/sc2/src/sc2code/setup.c index b5d7ed6d8..b7bf44b52 100644 --- a/sc2/src/sc2code/setup.c +++ b/sc2/src/sc2code/setup.c @@ -31,18 +31,13 @@ #include "libs/file.h" #include "libs/graphics/gfx_common.h" #include "libs/threadlib.h" +#include "libs/vidlib.h" #include #include #include -//Added by Chris - -extern BOOLEAN InitVideo (BOOLEAN UseCDROM); - -//End Added by Chris - ACTIVITY LastActivity; BYTE PlayerControl[NUM_PLAYERS]; diff --git a/sc2/src/sc2code/shipcont.h b/sc2/src/sc2code/shipcont.h new file mode 100755 index 000000000..fc7268d5a --- /dev/null +++ b/sc2/src/sc2code/shipcont.h @@ -0,0 +1,36 @@ +//Copyright Paul Reiche, Fred Ford. 1992-2002 + +/* + * 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 _SHIPCONT_H +#define _SHIPCONT_H + +#include "menustat.h" + +#define FIELD_WIDTH (STATUS_WIDTH - 5) + +extern void Cargo (PMENU_STATE pMS); +extern BOOLEAN Roster (void); +extern BOOLEAN Devices (PMENU_STATE pMS); + +extern void DrawCargoStrings (BYTE OldElement, BYTE NewElement); +extern void ShowRemainingCapacity (void); + +extern SIZE InventoryDevices (BYTE *pDeviceMap); + +#endif /* _SHIPCONT_H */ + diff --git a/sc2/src/sc2code/shipyard.c b/sc2/src/sc2code/shipyard.c index 5ca158b50..fa2b4c472 100644 --- a/sc2/src/sc2code/shipyard.c +++ b/sc2/src/sc2code/shipyard.c @@ -28,6 +28,7 @@ #include "nameref.h" #include "resinst.h" #include "settings.h" +#include "starbase.h" #include "setup.h" #include "sis.h" #include "sounds.h" diff --git a/sc2/src/sc2code/sis.c b/sc2/src/sc2code/sis.c index 9a32b6954..aaa0f243e 100644 --- a/sc2/src/sc2code/sis.c +++ b/sc2/src/sc2code/sis.c @@ -21,6 +21,7 @@ #include "encount.h" #include "gamestr.h" #include "options.h" +#include "starbase.h" #include "setup.h" #include "state.h" #include "libs/graphics/gfx_common.h" @@ -1174,8 +1175,10 @@ static FRAME flash_frame; static FRAME flash_screen_frame = 0; static int flash_changed; Mutex flash_mutex = 0; -void arith_frame_blit (FRAME srcFrame, RECT *rsrc, FRAME dstFrame, - RECT *rdst, int num, int denom); +// XXX: these are currently defined in libs/graphics/sdl/3do_getbody.c +// they should be sorted out and cleaned up at some point +extern void arith_frame_blit (FRAME srcFrame, RECT *rsrc, FRAME dstFrame, + RECT *rdst, int num, int denom); static int flash_rect_func (void *data) diff --git a/sc2/src/sc2code/starbase.c b/sc2/src/sc2code/starbase.c index af015b775..90aa649fc 100644 --- a/sc2/src/sc2code/starbase.c +++ b/sc2/src/sc2code/starbase.c @@ -21,6 +21,8 @@ #include "controls.h" #include "encount.h" #include "gamestr.h" +#include "load.h" +#include "starbase.h" #include "resinst.h" #include "settings.h" #include "setup.h" @@ -29,7 +31,6 @@ #include "libs/tasklib.h" #include "libs/inplib.h" -extern ACTIVITY NextActivity; PMENU_STATE pMenuState; diff --git a/sc2/src/sc2code/starbase.h b/sc2/src/sc2code/starbase.h index 6ee74bd9f..d62bd34ff 100644 --- a/sc2/src/sc2code/starbase.h +++ b/sc2/src/sc2code/starbase.h @@ -19,10 +19,7 @@ #ifndef _STARBASE_H #define _STARBASE_H -#include "libs/gfxlib.h" -#include "libs/sndlib.h" -#include "libs/tasklib.h" - +#include "menustat.h" enum { @@ -33,31 +30,6 @@ enum }; typedef BYTE STARBASE_STATE; -#define FIELD_WIDTH (STATUS_WIDTH - 5) - -typedef struct menu_state -{ - BOOLEAN (*InputFunc) (struct menu_state *pMS); - COUNT MenuRepeatDelay; - - SIZE Initialized; - - BYTE CurState; - FRAME CurFrame; - STRING CurString; - POINT first_item; - SIZE delta_item; - - FRAME ModuleFrame; - Task flash_task; - RECT flash_rect0, flash_rect1; - FRAME flash_frame0, flash_frame1; - - MUSIC_REF hMusic; -} MENU_STATE; -typedef MENU_STATE *PMENU_STATE; - -extern PMENU_STATE pMenuState; extern void InstallBombAtEarth (void); extern void VisitStarBase (void); diff --git a/sc2/src/sc2code/starcon.c b/sc2/src/sc2code/starcon.c index ff836b14e..0cd3e8f0d 100644 --- a/sc2/src/sc2code/starcon.c +++ b/sc2/src/sc2code/starcon.c @@ -23,8 +23,10 @@ #include "gameev.h" #include "types.h" #include "globdata.h" +#include "load.h" #include "resinst.h" #include "restart.h" +#include "starbase.h" #include "setup.h" #include "starcon.h" #include "uqmdebug.h" @@ -135,8 +137,6 @@ while (--ac > 0) AddInitialGameEvents(); do { - extern ACTIVITY NextActivity; - SuspendGameClock (); #ifdef DEBUG diff --git a/sc2/src/sc2code/starcon.h b/sc2/src/sc2code/starcon.h index a5eb2f910..62048cd96 100644 --- a/sc2/src/sc2code/starcon.h +++ b/sc2/src/sc2code/starcon.h @@ -17,7 +17,8 @@ #ifndef _STARCON_H #define _STARCON_H -extern int Starcon2Main(void *threadArg); +extern int Starcon2Main (void *threadArg); +extern void FreeGameData (void); #endif /* _STARCON_H */ diff --git a/sc2/src/sc2code/util.c b/sc2/src/sc2code/util.c index 4a14e188e..bc5e659bf 100644 --- a/sc2/src/sc2code/util.c +++ b/sc2/src/sc2code/util.c @@ -19,6 +19,7 @@ #include "commglue.h" #include "comm.h" #include "controls.h" +#include "util.h" #include "setup.h" #include "libs/inplib.h" #include "libs/sound/trackplayer.h" diff --git a/sc2/src/sc2code/util.h b/sc2/src/sc2code/util.h index 03f5d1c6d..ea8b66e3b 100644 --- a/sc2/src/sc2code/util.h +++ b/sc2/src/sc2code/util.h @@ -25,6 +25,7 @@ extern void DrawStarConBox (PRECT pRect, SIZE BorderWidth, COLOR InteriorColor); extern DWORD SeedRandomNumbers (void); +extern void MouseError (void); #endif /* _UTIL_H */