From 7d3e5b3511e4e8f624ca3c87cf69920a19b29a30 Mon Sep 17 00:00:00 2001 From: avolkov Date: Sat, 21 Nov 2009 01:15:21 +0000 Subject: [PATCH] Header and name cleanup: moved stuff around to relevant headers; removed some irrelevant #includes; better names git-svn-id: svn://svn.code.sf.net/p/sc2/code/trunk@3333 8092fc87-c524-0410-9efc-e669fe64eaf9 --- sc2/src/uqm/build.c | 1 + sc2/src/uqm/clock.c | 2 + sc2/src/uqm/cnctdlg.c | 1 + sc2/src/uqm/comm.c | 2 + sc2/src/uqm/comm.h | 1 + sc2/src/uqm/comm/chmmr/chmmrc.c | 2 + sc2/src/uqm/comm/comandr/comandr.c | 2 + sc2/src/uqm/comm/druuge/druugec.c | 2 + sc2/src/uqm/comm/melnorm/melnorm.c | 7 +- sc2/src/uqm/comm/starbas/starbas.c | 2 + sc2/src/uqm/cons_res.c | 4 + sc2/src/uqm/encount.c | 3 + sc2/src/uqm/gameopt.c | 8 +- sc2/src/uqm/globdata.c | 16 ++-- sc2/src/uqm/globdata.h | 6 +- sc2/src/uqm/grpinfo.c | 1 - sc2/src/uqm/grpinfo.h | 3 + sc2/src/uqm/hyper.c | 6 +- sc2/src/uqm/hyper.h | 32 ++++++++ sc2/src/uqm/init.c | 1 + sc2/src/uqm/intro.c | 2 + sc2/src/uqm/load.h | 1 + sc2/src/uqm/melee.c | 2 + sc2/src/uqm/menu.c | 3 + sc2/src/uqm/menustat.h | 72 ++++++++++++++++- sc2/src/uqm/oscill.c | 4 +- sc2/src/uqm/outfit.c | 4 + sc2/src/uqm/pickship.c | 1 + sc2/src/uqm/planets/cargo.c | 3 + sc2/src/uqm/planets/devices.c | 2 + sc2/src/uqm/planets/lander.c | 1 + sc2/src/uqm/planets/lander.h | 3 + sc2/src/uqm/planets/planets.c | 2 + sc2/src/uqm/planets/pstarmap.c | 5 ++ sc2/src/uqm/planets/roster.c | 6 +- sc2/src/uqm/planets/scan.c | 2 + sc2/src/uqm/planets/scan.h | 6 +- sc2/src/uqm/planets/solarsys.c | 3 + sc2/src/uqm/process.c | 1 + sc2/src/uqm/races.h | 20 ----- sc2/src/uqm/restart.c | 1 + sc2/src/uqm/save.h | 1 + sc2/src/uqm/ships/sis_ship/sis_ship.c | 3 +- sc2/src/uqm/shipyard.c | 5 +- sc2/src/uqm/sis.c | 8 +- sc2/src/uqm/sis.h | 112 +------------------------- sc2/src/uqm/starbase.c | 1 + sc2/src/uqm/starbase.h | 3 - sc2/src/uqm/starcon.c | 10 ++- sc2/src/uqm/units.h | 20 +++++ sc2/src/uqm/uqmdebug.c | 1 + sc2/src/uqm/util.c | 1 + 52 files changed, 247 insertions(+), 164 deletions(-) diff --git a/sc2/src/uqm/build.c b/sc2/src/uqm/build.c index 83cc1755d..5d327379f 100644 --- a/sc2/src/uqm/build.c +++ b/sc2/src/uqm/build.c @@ -20,6 +20,7 @@ #include "races.h" #include "master.h" +#include "sis.h" #include "setup.h" #include "libs/compiler.h" #include "libs/mathlib.h" diff --git a/sc2/src/uqm/clock.c b/sc2/src/uqm/clock.c index 0527b7edc..c45deffb8 100644 --- a/sc2/src/uqm/clock.c +++ b/sc2/src/uqm/clock.c @@ -19,6 +19,8 @@ #include #include "gameev.h" #include "globdata.h" +#include "sis.h" + // for DrawStatusMessage() #include "setup.h" #include "libs/compiler.h" #include "libs/gfxlib.h" diff --git a/sc2/src/uqm/cnctdlg.c b/sc2/src/uqm/cnctdlg.c index 10b97bc0f..5b92019c1 100644 --- a/sc2/src/uqm/cnctdlg.c +++ b/sc2/src/uqm/cnctdlg.c @@ -23,6 +23,7 @@ #include "colors.h" #include "gamestr.h" #include "setup.h" +#include "units.h" #include "resinst.h" #include "nameref.h" #include "libs/graphics/widgets.h" diff --git a/sc2/src/uqm/comm.c b/sc2/src/uqm/comm.c index 58c6a4f1c..88550d5da 100644 --- a/sc2/src/uqm/comm.c +++ b/sc2/src/uqm/comm.c @@ -24,6 +24,8 @@ #include "commglue.h" #include "controls.h" #include "colors.h" +#include "sis.h" +#include "units.h" #include "encount.h" #include "endian_uqm.h" #include "gamestr.h" diff --git a/sc2/src/uqm/comm.h b/sc2/src/uqm/comm.h index ef99dbe74..4cd1b0841 100644 --- a/sc2/src/uqm/comm.h +++ b/sc2/src/uqm/comm.h @@ -18,6 +18,7 @@ #define _COMM_H #include "globdata.h" +#include "units.h" #include "libs/compiler.h" #include "libs/gfxlib.h" #include "commglue.h" diff --git a/sc2/src/uqm/comm/chmmr/chmmrc.c b/sc2/src/uqm/comm/chmmr/chmmrc.c index f08e449ea..2c15d6305 100644 --- a/sc2/src/uqm/comm/chmmr/chmmrc.c +++ b/sc2/src/uqm/comm/chmmr/chmmrc.c @@ -21,6 +21,8 @@ #include "strings.h" #include "uqm/build.h" +#include "uqm/hyper.h" + // for SOL_X/SOL_Y static LOCDATA chmmr_desc = diff --git a/sc2/src/uqm/comm/comandr/comandr.c b/sc2/src/uqm/comm/comandr/comandr.c index d1a78c72f..3018edf64 100644 --- a/sc2/src/uqm/comm/comandr/comandr.c +++ b/sc2/src/uqm/comm/comandr/comandr.c @@ -21,6 +21,8 @@ #include "strings.h" #include "uqm/setup.h" +#include "uqm/sis.h" + // for DeltaSISGauges(), DrawLanders() #include "libs/graphics/gfx_common.h" static LOCDATA commander_desc = diff --git a/sc2/src/uqm/comm/druuge/druugec.c b/sc2/src/uqm/comm/druuge/druugec.c index c00447af6..0251f8671 100644 --- a/sc2/src/uqm/comm/druuge/druugec.c +++ b/sc2/src/uqm/comm/druuge/druugec.c @@ -22,6 +22,8 @@ #include "uqm/build.h" #include "uqm/setup.h" +#include "uqm/sis.h" + // for DeltaSISGauges() static LOCDATA druuge_desc = diff --git a/sc2/src/uqm/comm/melnorm/melnorm.c b/sc2/src/uqm/comm/melnorm/melnorm.c index 70fdcbaa7..586c4da27 100644 --- a/sc2/src/uqm/comm/melnorm/melnorm.c +++ b/sc2/src/uqm/comm/melnorm/melnorm.c @@ -26,8 +26,11 @@ #include "libs/inplib.h" #include "libs/mathlib.h" -// XXX: temporary, for SOL_X/SOL_Y -#include "uqm/races.h" +#include "uqm/hyper.h" + // for SOL_X/SOL_Y +#include "uqm/planets/planets.h" + // for xxx_DISASTER +#include "uqm/sis.h" #define NUM_HISTORY_ITEMS 9 diff --git a/sc2/src/uqm/comm/starbas/starbas.c b/sc2/src/uqm/comm/starbas/starbas.c index 2e21d9342..6d0bb1f42 100644 --- a/sc2/src/uqm/comm/starbas/starbas.c +++ b/sc2/src/uqm/comm/starbas/starbas.c @@ -23,6 +23,8 @@ #include "uqm/build.h" #include "uqm/setup.h" #include "uqm/shipcont.h" +#include "uqm/sis.h" + // for DeltaSISGauges() #include "libs/graphics/gfx_common.h" #include "libs/mathlib.h" #include "libs/inplib.h" diff --git a/sc2/src/uqm/cons_res.c b/sc2/src/uqm/cons_res.c index 6ee770f5c..9db925852 100644 --- a/sc2/src/uqm/cons_res.c +++ b/sc2/src/uqm/cons_res.c @@ -22,6 +22,10 @@ #include "resinst.h" #include "nameref.h" #include "setup.h" +#include "units.h" + // for NUM_VIEWS +#include "planets/planets.h" + // for NUMBER_OF_PLANET_TYPES, PLANET_SHIELDED static const char *planet_types[] = { "oolite", "yttric", "quasidegenerate", "lanthanide", "treasure", diff --git a/sc2/src/uqm/encount.c b/sc2/src/uqm/encount.c index 8b7bc98a4..8292cefde 100644 --- a/sc2/src/uqm/encount.c +++ b/sc2/src/uqm/encount.c @@ -24,9 +24,12 @@ #include "colors.h" #include "cons_res.h" #include "controls.h" +#include "menustat.h" #include "gameopt.h" #include "gamestr.h" #include "globdata.h" +#include "sis.h" + // for DrawStatusMessage(), SetStatusMessageMode() #include "init.h" #include "pickship.h" #include "intel.h" diff --git a/sc2/src/uqm/gameopt.c b/sc2/src/uqm/gameopt.c index b8bae91d9..7d63c8818 100644 --- a/sc2/src/uqm/gameopt.c +++ b/sc2/src/uqm/gameopt.c @@ -20,21 +20,19 @@ #include "build.h" #include "colors.h" -#include "commglue.h" - // for CommData #include "controls.h" // XXX: for FindStart(), GetClusterName() #include "encount.h" -#include "planets/lander.h" +#include "menustat.h" +#include "sis.h" +#include "units.h" #include "gamestr.h" #include "load.h" #include "options.h" #include "save.h" -#include "starbase.h" #include "settings.h" #include "setup.h" #include "sounds.h" -#include "state.h" #include "util.h" #include "libs/graphics/gfx_common.h" diff --git a/sc2/src/uqm/globdata.c b/sc2/src/uqm/globdata.c index 9b2fd6f3e..153a71577 100644 --- a/sc2/src/uqm/globdata.c +++ b/sc2/src/uqm/globdata.c @@ -22,6 +22,8 @@ #include "encount.h" #include "master.h" #include "setup.h" +#include "units.h" +#include "hyper.h" #include "resinst.h" #include "nameref.h" #include "build.h" @@ -42,7 +44,7 @@ FRAME PlayFrame; GLOBDATA GlobData; -BOOLEAN initedSIS = 0; +static BOOLEAN initedGameStructs = FALSE; BYTE @@ -184,7 +186,7 @@ copyFleetInfo (FLEET_INFO *dst, SHIP_INFO *src, FLEET_STUFF *fleet) } BOOLEAN -InitSIS (void) +InitGameStructures (void) { COUNT i; @@ -351,8 +353,8 @@ InitSIS (void) * than once, as you can't remove the atexit function (when the full game * ends). */ - initedSIS = TRUE; - atexit (UninitSIS); + initedGameStructs = TRUE; + atexit (UninitGameStructures); return (TRUE); } @@ -371,11 +373,11 @@ FreeSC2Data (void) } void -UninitSIS (void) +UninitGameStructures (void) { HFLEETINFO hStarShip; - if (!initedSIS) + if (!initedGameStructs) return; UninitQueue (&GLOBAL (encounter_q)); @@ -405,7 +407,7 @@ UninitSIS (void) DestroyDrawable (ReleaseDrawable (PlayFrame)); PlayFrame = 0; - initedSIS = FALSE; + initedGameStructs = FALSE; } void diff --git a/sc2/src/uqm/globdata.h b/sc2/src/uqm/globdata.h index 1a696edd9..8392a6ab7 100644 --- a/sc2/src/uqm/globdata.h +++ b/sc2/src/uqm/globdata.h @@ -22,6 +22,7 @@ #include "clock.h" #include "libs/gfxlib.h" #include "libs/reslib.h" +#include "libs/sndlib.h" #include "sis.h" #include "velocity.h" #include "commanim.h" @@ -961,6 +962,7 @@ extern GLOBDATA GlobData; #define GLOBAL_SIS(f) GlobData.SIS_state.f #define MAX_ENCOUNTERS 16 +#define MAX_BATTLE_GROUPS 32 //#define STATE_DEBUG @@ -1002,8 +1004,10 @@ extern CONTEXT RadarContext; extern void FreeSC2Data (void); extern BOOLEAN LoadSC2Data (void); -void InitGlobData (void); +extern void InitGlobData (void); +extern BOOLEAN InitGameStructures (void); +extern void UninitGameStructures (void); #endif /* _GLOBDATA_H */ diff --git a/sc2/src/uqm/grpinfo.c b/sc2/src/uqm/grpinfo.c index c5e3ef18e..f2757425f 100644 --- a/sc2/src/uqm/grpinfo.c +++ b/sc2/src/uqm/grpinfo.c @@ -22,7 +22,6 @@ #include "libs/file.h" #include "globdata.h" #include "intel.h" -#include "sis.h" #include "state.h" #include "grpinfo.h" diff --git a/sc2/src/uqm/grpinfo.h b/sc2/src/uqm/grpinfo.h index 5e5bda825..867525377 100644 --- a/sc2/src/uqm/grpinfo.h +++ b/sc2/src/uqm/grpinfo.h @@ -24,6 +24,9 @@ // for POINT #include +// XXX: Needed to maintain savegame compatibility +#define NUM_SAVED_BATTLE_GROUPS 64 + typedef HLINK HIPGROUP; typedef struct diff --git a/sc2/src/uqm/hyper.c b/sc2/src/uqm/hyper.c index c5d32de60..3dd06996a 100644 --- a/sc2/src/uqm/hyper.c +++ b/sc2/src/uqm/hyper.c @@ -22,10 +22,14 @@ #include "collide.h" #include "colors.h" #include "controls.h" +#include "menustat.h" + // for DrawMenuStateStrings() #include "encount.h" #include "ship.h" #include "process.h" #include "globdata.h" +#include "sis.h" +#include "units.h" #include "init.h" #include "nameref.h" #include "resinst.h" @@ -1595,7 +1599,7 @@ SeedUniverse (void) } void -DoMenuOptions (void) +HyperspaceMenu (void) { COLOR OldColor; CONTEXT OldContext; diff --git a/sc2/src/uqm/hyper.h b/sc2/src/uqm/hyper.h index 1b2393c43..193247c96 100644 --- a/sc2/src/uqm/hyper.h +++ b/sc2/src/uqm/hyper.h @@ -20,10 +20,42 @@ #define _HYPER_H #include "element.h" +#include "units.h" + // for UNIT_SCREEN_WIDTH/HEIGHT + +#define NUM_RADAR_SCREENS 12 + +#define RADAR_SCAN_WIDTH (UNIT_SCREEN_WIDTH * NUM_RADAR_SCREENS) +#define RADAR_SCAN_HEIGHT (UNIT_SCREEN_HEIGHT * NUM_RADAR_SCREENS) + +// Hyperspace coordinates of the naturally occuring portal into QuasiSpace +#define ARILOU_SPACE_X 438 +#define ARILOU_SPACE_Y 6372 + +// QuasiSpace coordinates of the same portal +#define QUASI_SPACE_X 5000 +#define QUASI_SPACE_Y 5000 + +// QuasiSpace coordinates of the Arilou home world +#define ARILOU_HOME_X (QUASI_SPACE_X + ((RADAR_SCAN_WIDTH >> 1) * 3)) +#define ARILOU_HOME_Y (QUASI_SPACE_Y + ((RADAR_SCAN_HEIGHT >> 1) * 3)) + +// Hyperspace coordinates of the Sol system +// Should be the same as in plandata.c +#define SOL_X 1752 +#define SOL_Y 1450 + + +extern BOOLEAN LoadHyperspace (void); +extern BOOLEAN FreeHyperspace (void); +extern void SeedUniverse (void); +extern void MoveSIS (SIZE *pdx, SIZE *pdy); extern void FreeHyperData (void); extern void check_hyperspace_encounter (void); extern BOOLEAN hyper_transition (ELEMENT *ElementPtr); +extern void HyperspaceMenu (void); + #endif /* _HYPER_H */ diff --git a/sc2/src/uqm/init.c b/sc2/src/uqm/init.c index a0862f4ce..932b319b2 100644 --- a/sc2/src/uqm/init.c +++ b/sc2/src/uqm/init.c @@ -25,6 +25,7 @@ #include "pickship.h" #include "process.h" #include "globdata.h" +#include "hyper.h" #include "init.h" #include "port.h" #include "resinst.h" diff --git a/sc2/src/uqm/intro.c b/sc2/src/uqm/intro.c index 99a0ed67d..576ee2d58 100644 --- a/sc2/src/uqm/intro.c +++ b/sc2/src/uqm/intro.c @@ -19,6 +19,8 @@ #include "controls.h" #include "options.h" #include "settings.h" +#include "globdata.h" +#include "sis.h" #include "setup.h" #include "sounds.h" #include "fmv.h" diff --git a/sc2/src/uqm/load.h b/sc2/src/uqm/load.h index 2de0010b5..c3859db5d 100644 --- a/sc2/src/uqm/load.h +++ b/sc2/src/uqm/load.h @@ -18,6 +18,7 @@ #define _LOAD_H #include "sis.h" + // for SUMMARY_DESC #include "libs/compiler.h" #include "globdata.h" diff --git a/sc2/src/uqm/melee.c b/sc2/src/uqm/melee.c index 634f20b55..d473c046c 100644 --- a/sc2/src/uqm/melee.c +++ b/sc2/src/uqm/melee.c @@ -46,6 +46,8 @@ #include "setup.h" #include "sounds.h" #include "util.h" +#include "planets/planets.h" + // for NUMBER_OF_PLANET_TYPES #include "libs/graphics/drawable.h" #include "libs/gfxlib.h" #include "libs/mathlib.h" diff --git a/sc2/src/uqm/menu.c b/sc2/src/uqm/menu.c index 60dd4be90..33f2b0f0d 100644 --- a/sc2/src/uqm/menu.c +++ b/sc2/src/uqm/menu.c @@ -16,8 +16,11 @@ * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ +#include "menustat.h" + #include "colors.h" #include "controls.h" +#include "units.h" #include "options.h" #include "setup.h" #include "gamestr.h" diff --git a/sc2/src/uqm/menustat.h b/sc2/src/uqm/menustat.h index 43db640fd..f614259d5 100644 --- a/sc2/src/uqm/menustat.h +++ b/sc2/src/uqm/menustat.h @@ -48,6 +48,76 @@ typedef struct menu_state void *Extra; } MENU_STATE; +// XXX: Should probably go to menu.h (does not yet exist) +enum +{ + PM_SCAN = 0, + PM_STARMAP, + PM_DEVICES, + PM_CARGO, + PM_ROSTER, + PM_SAVE_LOAD0, + PM_NAVIGATE, + + PM_MIN_SCAN, + PM_ENE_SCAN, + PM_BIO_SCAN, + PM_EXIT_MENU0, + PM_AUTO_SCAN, + PM_LAUNCH_LANDER, + + PM_SAVE_GAME, + PM_LOAD_GAME, + PM_QUIT_GAME, + PM_CHANGE_SETTINGS, + PM_EXIT_MENU1, + + PM_CONVERSE, + PM_ATTACK, + PM_SAVE_LOAD1, + + PM_FUEL, + PM_MODULE, + PM_SAVE_LOAD2, + PM_EXIT_MENU2, + + PM_CREW, + PM_SAVE_LOAD3, + PM_EXIT_MENU3, + + PM_SOUND_ON, + PM_SOUND_OFF, + PM_MUSIC_ON, + PM_MUSIC_OFF, + PM_CYBORG_OFF, + PM_CYBORG_NORMAL, + PM_CYBORG_DOUBLE, + PM_CYBORG_SUPER, + PM_CHANGE_CAPTAIN, + PM_CHANGE_SHIP, + PM_EXIT_MENU4, + + PM_ALT_SCAN, + PM_ALT_STARMAP, + PM_ALT_MANIFEST, + PM_ALT_SAVE0, + PM_ALT_NAVIGATE, + + PM_ALT_CARGO, + PM_ALT_DEVICES, + PM_ALT_ROSTER, + PM_ALT_EXITMENU0, + + PM_ALT_MSCAN, + PM_ALT_ESCAN, + PM_ALT_BSCAN, + PM_ALT_ASCAN, + PM_ALT_DISPATCH, + PM_ALT_EXITMENU1 +}; + +extern BOOLEAN DoMenuChooser (MENU_STATE *pMS, BYTE BaseState); +extern void DrawMenuStateStrings (BYTE beg_index, SWORD NewState); + #endif /* _MENUSTAT_H */ - diff --git a/sc2/src/uqm/oscill.c b/sc2/src/uqm/oscill.c index eed60e1d0..e2022ce22 100644 --- a/sc2/src/uqm/oscill.c +++ b/sc2/src/uqm/oscill.c @@ -18,7 +18,9 @@ #include "oscill.h" -#include "sis.h" +// XXX: we should not refer to units.h here because we should not be +// using RADAR_WIDTH constants! +#include "units.h" #include "libs/graphics/gfx_common.h" #include "libs/graphics/drawable.h" #include "libs/sound/sound.h" diff --git a/sc2/src/uqm/outfit.c b/sc2/src/uqm/outfit.c index bce4c33dc..8cb9a7ea9 100644 --- a/sc2/src/uqm/outfit.c +++ b/sc2/src/uqm/outfit.c @@ -19,6 +19,7 @@ #include "options.h" #include "colors.h" #include "controls.h" +#include "menustat.h" #include "gameopt.h" #include "gamestr.h" #include "resinst.h" @@ -27,7 +28,10 @@ #include "starbase.h" #include "setup.h" #include "sis.h" +#include "units.h" #include "sounds.h" +#include "planets/planets.h" + // for xxx_DISASTER #include "libs/graphics/gfx_common.h" diff --git a/sc2/src/uqm/pickship.c b/sc2/src/uqm/pickship.c index e77432bd1..90534da9a 100644 --- a/sc2/src/uqm/pickship.c +++ b/sc2/src/uqm/pickship.c @@ -21,6 +21,7 @@ #include "build.h" #include "colors.h" #include "controls.h" +#include "menustat.h" #include "pickmele.h" #include "battle.h" #include "races.h" diff --git a/sc2/src/uqm/planets/cargo.c b/sc2/src/uqm/planets/cargo.c index 701ff1465..9a7ea85ca 100644 --- a/sc2/src/uqm/planets/cargo.c +++ b/sc2/src/uqm/planets/cargo.c @@ -23,6 +23,9 @@ #include "../setup.h" #include "../sounds.h" #include "../util.h" +#include "../sis.h" + // for ClearSISRect(), DrawStatusMessage() +#include "planets.h" void diff --git a/sc2/src/uqm/planets/devices.c b/sc2/src/uqm/planets/devices.c index c6e47c740..8bee1a1aa 100644 --- a/sc2/src/uqm/planets/devices.c +++ b/sc2/src/uqm/planets/devices.c @@ -25,6 +25,8 @@ #include "../load.h" #include "../setup.h" #include "../state.h" +#include "../sis.h" + // for ClearSISRect(), SaveFlagshipState() #include "../grpinfo.h" #include "../sounds.h" #include "../util.h" diff --git a/sc2/src/uqm/planets/lander.c b/sc2/src/uqm/planets/lander.c index 4b7b98cbe..30c630228 100644 --- a/sc2/src/uqm/planets/lander.c +++ b/sc2/src/uqm/planets/lander.c @@ -26,6 +26,7 @@ // XXX: for CurStarDescPtr and XXX_DEFINED #include "../encount.h" #include "../process.h" +#include "../units.h" #include "../gamestr.h" #include "../nameref.h" #include "../resinst.h" diff --git a/sc2/src/uqm/planets/lander.h b/sc2/src/uqm/planets/lander.h index 10db17166..ee33a1c5f 100644 --- a/sc2/src/uqm/planets/lander.h +++ b/sc2/src/uqm/planets/lander.h @@ -27,6 +27,9 @@ #include "../element.h" +// Surface magnification shift (x4) +#define MAG_SHIFT 2 + #define NUM_TEXT_FRAMES 32 typedef struct diff --git a/sc2/src/uqm/planets/planets.c b/sc2/src/uqm/planets/planets.c index 4aa989b6d..9db3cfbe5 100644 --- a/sc2/src/uqm/planets/planets.c +++ b/sc2/src/uqm/planets/planets.c @@ -16,6 +16,8 @@ * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ +#include "planets.h" + #include "scan.h" #include "lander.h" #include "../element.h" diff --git a/sc2/src/uqm/planets/pstarmap.c b/sc2/src/uqm/planets/pstarmap.c index 4d5987a68..ea2ec52e0 100644 --- a/sc2/src/uqm/planets/pstarmap.c +++ b/sc2/src/uqm/planets/pstarmap.c @@ -19,6 +19,7 @@ #include "scan.h" #include "../colors.h" #include "../controls.h" +#include "../menustat.h" // XXX: for stuff that does not belong there #include "../encount.h" #include "../races.h" @@ -26,6 +27,10 @@ #include "../gamestr.h" #include "../globdata.h" #include "../shipcont.h" +#include "../units.h" +#include "../hyper.h" +#include "../sis.h" + // for DrawHyperCoords(), DrawStatusMessage() #include "../settings.h" #include "../setup.h" #include "../sounds.h" diff --git a/sc2/src/uqm/planets/roster.c b/sc2/src/uqm/planets/roster.c index d3ab8608a..36ad454ac 100644 --- a/sc2/src/uqm/planets/roster.c +++ b/sc2/src/uqm/planets/roster.c @@ -20,6 +20,8 @@ #include "../colors.h" #include "../controls.h" #include "../races.h" +#include "../units.h" +#include "../sis.h" #include "../shipcont.h" #include "../setup.h" #include "../sounds.h" @@ -30,7 +32,7 @@ #include // Ship icon positions in status display around the flagship -static const POINT ship_pos[MAX_COMBAT_SHIPS] = +static const POINT ship_pos[MAX_BUILT_SHIPS] = { SUPPORT_SHIP_PTS }; @@ -38,7 +40,7 @@ static const POINT ship_pos[MAX_COMBAT_SHIPS] = // Ship icon positions split into (lower half) left and right (upper) // and sorted in the Y coord. These are used for navigation around the // escort positions. -static POINT sorted_ship_pos[MAX_COMBAT_SHIPS]; +static POINT sorted_ship_pos[MAX_BUILT_SHIPS]; static SHIP_FRAGMENT* LockSupportShip (MENU_STATE *pMS, HSHIPFRAG *phFrag); diff --git a/sc2/src/uqm/planets/scan.c b/sc2/src/uqm/planets/scan.c index 689297664..2e13251a6 100644 --- a/sc2/src/uqm/planets/scan.c +++ b/sc2/src/uqm/planets/scan.c @@ -21,6 +21,7 @@ #include "../build.h" #include "../cons_res.h" #include "../controls.h" +#include "../menustat.h" #include "../encount.h" // for EncounterGroup #include "../gamestr.h" @@ -33,6 +34,7 @@ #include "../setup.h" #include "../sounds.h" #include "../state.h" +#include "../sis.h" #include "options.h" #include "libs/graphics/gfx_common.h" #include "libs/graphics/drawable.h" diff --git a/sc2/src/uqm/planets/scan.h b/sc2/src/uqm/planets/scan.h index 4880b979f..fc035c947 100644 --- a/sc2/src/uqm/planets/scan.h +++ b/sc2/src/uqm/planets/scan.h @@ -19,8 +19,8 @@ #ifndef _SCAN_H #define _SCAN_H +#include "libs/compiler.h" #include "libs/gfxlib.h" -#include "../menustat.h" typedef struct @@ -39,10 +39,6 @@ typedef struct SCAN_DESC *scan_base; } SCAN_BLOCK; -#define SAME_SCAN (1 << 16) -#define SCALED_ROOT_TWO 92682L /* root 2 * (1 << 16) */ -#define SCALE_FACTOR 16 - extern void RepairBackRect (RECT *pRect); extern void GeneratePlanetSide (void); diff --git a/sc2/src/uqm/planets/solarsys.c b/sc2/src/uqm/planets/solarsys.c index bd45774a6..ced8acc9f 100644 --- a/sc2/src/uqm/planets/solarsys.c +++ b/sc2/src/uqm/planets/solarsys.c @@ -19,10 +19,13 @@ #include "lander.h" #include "../colors.h" #include "../controls.h" +#include "../menustat.h" + // for DrawMenuStateStrings() #include "../encount.h" #include "../races.h" #include "../gamestr.h" #include "../globdata.h" +#include "../sis.h" #include "../init.h" #include "../nameref.h" #include "../resinst.h" diff --git a/sc2/src/uqm/process.c b/sc2/src/uqm/process.c index a579a64b0..a5b0e82c0 100644 --- a/sc2/src/uqm/process.c +++ b/sc2/src/uqm/process.c @@ -24,6 +24,7 @@ #include "settings.h" #include "setup.h" #include "sounds.h" +#include "hyper.h" #include "element.h" #include "battle.h" #include "weapon.h" diff --git a/sc2/src/uqm/races.h b/sc2/src/uqm/races.h index 7a17e4d73..a0d6a2dbe 100644 --- a/sc2/src/uqm/races.h +++ b/sc2/src/uqm/races.h @@ -664,25 +664,5 @@ enum BUILD_COLOR (MAKE_RGB15 (0x06, 0x06, 0x06), 0x20), /* BLACK_URQUAN_SHIP */ \ BUILD_COLOR (MAKE_RGB15 (0x14, 0x07, 0x1F), 0x39), /* YEHAT_REBEL_SHIP */ -#define RADAR_SCAN_WIDTH (UNIT_SCREEN_WIDTH * NUM_RADAR_SCREENS) -#define RADAR_SCAN_HEIGHT (UNIT_SCREEN_HEIGHT * NUM_RADAR_SCREENS) - -// Hyperspace coordinates of the naturally occuring portal into QuasiSpace -#define ARILOU_SPACE_X 438 -#define ARILOU_SPACE_Y 6372 - -// QuasiSpace coordinates of the same portal -#define QUASI_SPACE_X 5000 -#define QUASI_SPACE_Y 5000 - -// QuasiSpace coordinates of the Arilou home world -#define ARILOU_HOME_X (QUASI_SPACE_X + ((RADAR_SCAN_WIDTH >> 1) * 3)) -#define ARILOU_HOME_Y (QUASI_SPACE_Y + ((RADAR_SCAN_HEIGHT >> 1) * 3)) - -// Hyperspace coordinates of the Sol system -// Should be the same as in plandata.c -#define SOL_X 1752 -#define SOL_Y 1450 - #endif /* _RACES_H */ diff --git a/sc2/src/uqm/restart.c b/sc2/src/uqm/restart.c index 5d161ab4d..6fbb7ad0e 100644 --- a/sc2/src/uqm/restart.c +++ b/sc2/src/uqm/restart.c @@ -24,6 +24,7 @@ // XXX: for star_array[] #include "encount.h" #include "fmv.h" +#include "menustat.h" #include "gamestr.h" #include "globdata.h" #include "intel.h" diff --git a/sc2/src/uqm/save.h b/sc2/src/uqm/save.h index 3c9924f12..020fdb68e 100644 --- a/sc2/src/uqm/save.h +++ b/sc2/src/uqm/save.h @@ -18,6 +18,7 @@ #define _SAVE_H #include "sis.h" + // for SUMMARY_DESC #include "libs/compiler.h" extern void SaveProblem (void); diff --git a/sc2/src/uqm/ships/sis_ship/sis_ship.c b/sc2/src/uqm/ships/sis_ship/sis_ship.c index e78c8945d..94b54aad5 100644 --- a/sc2/src/uqm/ships/sis_ship/sis_ship.c +++ b/sc2/src/uqm/ships/sis_ship/sis_ship.c @@ -22,6 +22,7 @@ #include "uqm/colors.h" #include "uqm/controls.h" #include "uqm/globdata.h" +#include "uqm/hyper.h" #include "libs/mathlib.h" @@ -303,7 +304,7 @@ sis_hyper_postprocess (ELEMENT *ElementPtr) && StarShipPtr->special_counter == 0) { #define MENU_DELAY 10 - DoMenuOptions (); + HyperspaceMenu (); StarShipPtr->cur_status_flags &= ~SHIP_AT_MAX_SPEED; StarShipPtr->special_counter = MENU_DELAY; } diff --git a/sc2/src/uqm/shipyard.c b/sc2/src/uqm/shipyard.c index fb9e904dd..11d4da018 100644 --- a/sc2/src/uqm/shipyard.c +++ b/sc2/src/uqm/shipyard.c @@ -19,6 +19,7 @@ #include "build.h" #include "colors.h" #include "controls.h" +#include "menustat.h" #include "fmv.h" #include "gameopt.h" #include "gamestr.h" @@ -32,8 +33,8 @@ #include "starbase.h" #include "setup.h" #include "sis.h" +#include "units.h" #include "sounds.h" -#include "state.h" #include "libs/graphics/gfx_common.h" #include "libs/inplib.h" @@ -296,7 +297,7 @@ ShowCombatShip (MENU_STATE *pMS, COUNT which_window, SHIP_FRAGMENT *StarShipPtr; POINT finished_s; STAMP ship_s, lfdoor_s, rtdoor_s; - } ship_win_info[MAX_COMBAT_SHIPS], *pship_win_info; + } ship_win_info[MAX_BUILT_SHIPS], *pship_win_info; num_ships = 1; pship_win_info = &ship_win_info[0]; diff --git a/sc2/src/uqm/sis.c b/sc2/src/uqm/sis.c index 43eaf3d75..eeba40f43 100644 --- a/sc2/src/uqm/sis.c +++ b/sc2/src/uqm/sis.c @@ -16,13 +16,17 @@ * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ +#include "sis.h" + #include "colors.h" #include "races.h" // XXX: including encount.h for stuff that does not belong there #include "encount.h" +#include "units.h" +#include "menustat.h" + // for DrawMenuStateStrings() #include "gamestr.h" #include "options.h" -#include "starbase.h" #include "battle.h" // For BATTLE_FRAME_RATE #include "element.h" @@ -941,7 +945,7 @@ DeltaSISGauges (SIZE crew_delta, SIZE fuel_delta, int resunit_delta) { HSHIPFRAG hStarShip, hNextShip; POINT *pship_pos; - POINT ship_pos[MAX_COMBAT_SHIPS] = + POINT ship_pos[MAX_BUILT_SHIPS] = { SUPPORT_SHIP_PTS }; diff --git a/sc2/src/uqm/sis.h b/sc2/src/uqm/sis.h index 08d06d800..2d66fc0ef 100644 --- a/sc2/src/uqm/sis.h +++ b/sc2/src/uqm/sis.h @@ -1,90 +1,16 @@ #ifndef _SIS_H #define _SIS_H -#include "planets/planets.h" - -enum -{ - PM_SCAN = 0, - PM_STARMAP, - PM_DEVICES, - PM_CARGO, - PM_ROSTER, - PM_SAVE_LOAD0, - PM_NAVIGATE, - - PM_MIN_SCAN, - PM_ENE_SCAN, - PM_BIO_SCAN, - PM_EXIT_MENU0, - PM_AUTO_SCAN, - PM_LAUNCH_LANDER, - - PM_SAVE_GAME, - PM_LOAD_GAME, - PM_QUIT_GAME, - PM_CHANGE_SETTINGS, - PM_EXIT_MENU1, - - PM_CONVERSE, - PM_ATTACK, - PM_SAVE_LOAD1, - - PM_FUEL, - PM_MODULE, - PM_SAVE_LOAD2, - PM_EXIT_MENU2, - - PM_CREW, - PM_SAVE_LOAD3, - PM_EXIT_MENU3, - - PM_SOUND_ON, - PM_SOUND_OFF, - PM_MUSIC_ON, - PM_MUSIC_OFF, - PM_CYBORG_OFF, - PM_CYBORG_NORMAL, - PM_CYBORG_DOUBLE, - PM_CYBORG_SUPER, - PM_CHANGE_CAPTAIN, - PM_CHANGE_SHIP, - PM_EXIT_MENU4, - - PM_ALT_SCAN, - PM_ALT_STARMAP, - PM_ALT_MANIFEST, - PM_ALT_SAVE0, - PM_ALT_NAVIGATE, - - PM_ALT_CARGO, - PM_ALT_DEVICES, - PM_ALT_ROSTER, - PM_ALT_EXITMENU0, - - PM_ALT_MSCAN, - PM_ALT_ESCAN, - PM_ALT_BSCAN, - PM_ALT_ASCAN, - PM_ALT_DISPATCH, - PM_ALT_EXITMENU1 -}; +#include "libs/compiler.h" +#include "libs/gfxlib.h" +#include "planets/elemdata.h" + // for NUM_ELEMENT_CATEGORIES #define CLEAR_SIS_RADAR (1 << 2) #define DRAW_SIS_DISPLAY (1 << 3) #define UNDEFINED_DELTA 0x7FFF -#define RADAR_X (4 + (SCREEN_WIDTH - STATUS_WIDTH - SAFE_X)) -#define RADAR_WIDTH (STATUS_WIDTH - 8) -#define RADAR_HEIGHT 53 -#define RADAR_Y (SIS_ORG_Y + SIS_SCREEN_HEIGHT - RADAR_HEIGHT) -#define NUM_RADAR_SCREENS 12 -#define MAG_SHIFT 2 /* driving on planet */ - -#define SHIP_NAME_WIDTH 60 -#define SHIP_NAME_HEIGHT 7 - #define NUM_DRIVE_SLOTS 11 #define NUM_JET_SLOTS 8 #define NUM_MODULE_SLOTS 16 @@ -105,18 +31,10 @@ enum #define FUEL_VOLUME_PER_ROW (HEFUEL_TANK_CAPACITY / MAX_FUEL_BARS) #define FUEL_RESERVE FUEL_VOLUME_PER_ROW -#define MAX_COMBAT_SHIPS 12 -#define MAX_BATTLE_GROUPS 32 - -// XXX: Needed to maintain savegame compatibility -#define NUM_SAVED_BATTLE_GROUPS 64 - #define IP_SHIP_THRUST_INCREMENT 8 #define IP_SHIP_TURN_WAIT 17 #define IP_SHIP_TURN_DECREMENT 2 -#define BOGUS_MASS 5 - #define BIO_CREDIT_VALUE 2 enum @@ -189,17 +107,6 @@ enum {3 + 0, 30 + (5 * 16)}, \ {3 + 42, 30 + (5 * 16)}, -#define SIS_TITLE_BOX_WIDTH 57 -#define SIS_TITLE_WIDTH (SIS_TITLE_BOX_WIDTH - 2) -#define SIS_TITLE_HEIGHT 8 -#define SIS_SPACER_BOX_WIDTH 12 -#define SIS_MESSAGE_BOX_WIDTH (SIS_SCREEN_WIDTH - SIS_TITLE_BOX_WIDTH \ - - SIS_SPACER_BOX_WIDTH) -#define SIS_MESSAGE_WIDTH (SIS_MESSAGE_BOX_WIDTH - 2) -#define SIS_MESSAGE_HEIGHT SIS_TITLE_HEIGHT -#define STATUS_MESSAGE_WIDTH (STATUS_WIDTH - 4) -#define STATUS_MESSAGE_HEIGHT 7 - #define SIS_NAME_SIZE 16 typedef struct @@ -250,13 +157,6 @@ typedef struct #define OVERRIDE_LANDER_FLAGS (1 << 7) #define AFTER_BOMB_INSTALLED (1 << 7) -extern BOOLEAN InitSIS (void); -extern void UninitSIS (void); - -extern void SeedUniverse (void); -extern BOOLEAN LoadHyperspace (void); -extern BOOLEAN FreeHyperspace (void); -extern void MoveSIS (SIZE *pdx, SIZE *pdy); extern void RepairSISBorder (void); extern void InitSISContexts (void); extern void DrawSISFrame (void); @@ -274,7 +174,6 @@ extern BOOLEAN DrawSISMessageEx (const UNICODE *pStr, SIZE CurPos, #define DSME_BLOCKCUR (1 << 2) #define DSME_MYCOLOR (1 << 3) extern void DrawSISMessage (const UNICODE *pStr); -extern void DrawGameDate (void); extern void DateToString (unsigned char *buf, size_t bufLen, BYTE month_index, BYTE day_index, COUNT year_index); @@ -307,9 +206,6 @@ extern COUNT GetSBayCapacity (POINT *ppt); extern DWORD GetFTankCapacity (POINT *ppt); extern COUNT CountSISPieces (BYTE piece_type); -extern BOOLEAN DoMenuChooser (MENU_STATE *pMS, BYTE BaseState); -extern void DrawMenuStateStrings (BYTE beg_index, SWORD NewState); -extern void DoMenuOptions (void); extern void DrawFlagshipName (BOOLEAN InStatusArea); extern void DrawCaptainsName (void); diff --git a/sc2/src/uqm/starbase.c b/sc2/src/uqm/starbase.c index 6754bdb44..6f1ae00e8 100644 --- a/sc2/src/uqm/starbase.c +++ b/sc2/src/uqm/starbase.c @@ -25,6 +25,7 @@ #include "gamestr.h" #include "load.h" #include "starbase.h" +#include "sis.h" #include "resinst.h" #include "nameref.h" #include "settings.h" diff --git a/sc2/src/uqm/starbase.h b/sc2/src/uqm/starbase.h index 7faa2a695..ef6f0fe45 100644 --- a/sc2/src/uqm/starbase.h +++ b/sc2/src/uqm/starbase.h @@ -44,8 +44,5 @@ extern COUNT WrapText (const UNICODE *pStr, COUNT len, TEXT *tarray, SIZE field_width); // XXX: Doesn't really belong in this file. -extern const char starbase_str_array[][20]; - #endif /* _STARBASE_H */ - diff --git a/sc2/src/uqm/starcon.c b/sc2/src/uqm/starcon.c index 1fa271aa9..7c919703e 100644 --- a/sc2/src/uqm/starcon.c +++ b/sc2/src/uqm/starcon.c @@ -32,6 +32,12 @@ #include "master.h" #include "controls.h" #include "starcon.h" +#include "clock.h" + // for GameClockTick() +#include "hyper.h" + // for SeedUniverse() +#include "planets/planets.h" + // for ExploreSolarSys() #include "uqmdebug.h" #include "libs/tasklib.h" #include "libs/log.h" @@ -191,7 +197,7 @@ while (--ac > 0) log_add (log_Fatal, "Could not set player input."); explode (); // Does not return; } - InitSIS (); + InitGameStructures (); InitGameClock (); AddInitialGameEvents(); @@ -281,7 +287,7 @@ while (--ac > 0) StopSound (); UninitGameClock (); - UninitSIS (); + UninitGameStructures (); ClearPlayerInputAll (); } // CloseJournal (); diff --git a/sc2/src/uqm/units.h b/sc2/src/uqm/units.h index e1db71f10..5a0ae5ffc 100644 --- a/sc2/src/uqm/units.h +++ b/sc2/src/uqm/units.h @@ -44,7 +44,25 @@ extern int ScreenHeight; /* Width of the usable part of the space "window" */ #define SIS_SCREEN_HEIGHT (SPACE_HEIGHT - 13) /* Height of the usable part of the space "window" */ +#define RADAR_X (4 + (SCREEN_WIDTH - STATUS_WIDTH - SAFE_X)) +#define RADAR_WIDTH (STATUS_WIDTH - 8) +#define RADAR_HEIGHT 53 +#define RADAR_Y (SIS_ORG_Y + SIS_SCREEN_HEIGHT - RADAR_HEIGHT) +#define SIS_TITLE_BOX_WIDTH 57 +#define SIS_TITLE_WIDTH (SIS_TITLE_BOX_WIDTH - 2) +#define SIS_TITLE_HEIGHT 8 +#define SIS_SPACER_BOX_WIDTH 12 +#define SIS_MESSAGE_BOX_WIDTH (SIS_SCREEN_WIDTH - SIS_TITLE_BOX_WIDTH \ + - SIS_SPACER_BOX_WIDTH) +#define SIS_MESSAGE_WIDTH (SIS_MESSAGE_BOX_WIDTH - 2) +#define SIS_MESSAGE_HEIGHT SIS_TITLE_HEIGHT + +#define STATUS_MESSAGE_WIDTH (STATUS_WIDTH - 4) +#define STATUS_MESSAGE_HEIGHT 7 + +#define SHIP_NAME_WIDTH (STATUS_WIDTH - 4) +#define SHIP_NAME_HEIGHT 7 #define MAX_REDUCTION 3 #define MAX_VIS_REDUCTION 2 @@ -87,6 +105,8 @@ extern int ScreenHeight; #define MAX_FLEET_STRENGTH (254 * SPHERE_RADIUS_INCREMENT) +// XXX: These corrected for the weird screen aspect ratio on DOS +// In part because of them, hyperflight is slower vertically #define UNIT_SCREEN_WIDTH 63 #define UNIT_SCREEN_HEIGHT 50 diff --git a/sc2/src/uqm/uqmdebug.c b/sc2/src/uqm/uqmdebug.c index 1f4b42a85..f8632a6c7 100644 --- a/sc2/src/uqm/uqmdebug.c +++ b/sc2/src/uqm/uqmdebug.c @@ -24,6 +24,7 @@ #include "clock.h" #include "encount.h" #include "element.h" +#include "sis.h" #include "status.h" #include "gamestr.h" #include "gameev.h" diff --git a/sc2/src/uqm/util.c b/sc2/src/uqm/util.c index c4c6e17d3..c57d3d4cd 100644 --- a/sc2/src/uqm/util.c +++ b/sc2/src/uqm/util.c @@ -19,6 +19,7 @@ #include "controls.h" #include "util.h" #include "setup.h" +#include "units.h" #include "settings.h" #include "libs/inplib.h" #include "libs/sound/trackplayer.h"