From 8fa66505b20bdd9d8f56b20fd5592f65e0a4e0d7 Mon Sep 17 00:00:00 2001 From: Meep-Eep Date: Sun, 15 Nov 2009 23:58:23 +0000 Subject: [PATCH] Fixed a bug introduced by my last patch. I forgot about the system-specific generate functions. git-svn-id: svn://svn.code.sf.net/p/sc2/code/trunk@3306 8092fc87-c524-0410-9efc-e669fe64eaf9 --- sc2/src/uqm/planets/gendru.c | 2 +- sc2/src/uqm/planets/genorz.c | 3 --- sc2/src/uqm/planets/genpku.c | 2 +- sc2/src/uqm/planets/gensol.c | 2 +- sc2/src/uqm/planets/gensup.c | 2 +- sc2/src/uqm/planets/genvault.c | 2 +- sc2/src/uqm/planets/genvux.c | 5 +---- sc2/src/uqm/planets/genwreck.c | 2 +- sc2/src/uqm/planets/lander.c | 25 ------------------------- sc2/src/uqm/planets/lander.h | 31 +++++++++++++++++++++++++++++++ sc2/src/uqm/planets/orbits.c | 12 ++++++------ sc2/src/uqm/planets/solarsys.c | 1 - 12 files changed, 44 insertions(+), 45 deletions(-) diff --git a/sc2/src/uqm/planets/gendru.c b/sc2/src/uqm/planets/gendru.c index a93db7fdd..9571bb5c8 100644 --- a/sc2/src/uqm/planets/gendru.c +++ b/sc2/src/uqm/planets/gendru.c @@ -61,7 +61,7 @@ GenerateDruuge (BYTE control) if (!GET_GAME_STATE (ROSY_SPHERE)) { - ((PLANETSIDE_DESC*)pMenuState->ModuleFrame)->InTransit = TRUE; + pLanderInputState->planetSideDesc->InTransit = TRUE; SET_GAME_STATE (ROSY_SPHERE, 1); SET_GAME_STATE (ROSY_SPHERE_ON_SHIP, 1); diff --git a/sc2/src/uqm/planets/genorz.c b/sc2/src/uqm/planets/genorz.c index 014ec73e5..0807487cf 100644 --- a/sc2/src/uqm/planets/genorz.c +++ b/sc2/src/uqm/planets/genorz.c @@ -69,9 +69,6 @@ GenerateAndrosynth (BYTE control) |= (1L << (i + 16)); if (pSolarSysState->SysInfo.PlanetInfo.DiscoveryString) { - PLANETSIDE_DESC *pPSD; - - pPSD = (PLANETSIDE_DESC*)pMenuState->ModuleFrame; UnbatchGraphics (); DoDiscoveryReport (MenuSounds); BatchGraphics (); diff --git a/sc2/src/uqm/planets/genpku.c b/sc2/src/uqm/planets/genpku.c index ca3ee6dad..2869492f1 100644 --- a/sc2/src/uqm/planets/genpku.c +++ b/sc2/src/uqm/planets/genpku.c @@ -61,7 +61,7 @@ GeneratePkunk (BYTE control) if (!GET_GAME_STATE (CLEAR_SPINDLE)) { - ((PLANETSIDE_DESC*)pMenuState->ModuleFrame)->InTransit = TRUE; + pLanderInputState->planetSideDesc->InTransit = TRUE; SET_GAME_STATE (CLEAR_SPINDLE, 1); SET_GAME_STATE (CLEAR_SPINDLE_ON_SHIP, 1); diff --git a/sc2/src/uqm/planets/gensol.c b/sc2/src/uqm/planets/gensol.c index 420b527f5..55976cce8 100644 --- a/sc2/src/uqm/planets/gensol.c +++ b/sc2/src/uqm/planets/gensol.c @@ -99,7 +99,7 @@ generate_energy_nodes (void) SET_GAME_STATE (FOUND_PLUTO_SPATHI, 1); pSolarSysState->SysInfo.PlanetInfo.ScanRetrieveMask[ENERGY_SCAN] &= ~(1L << 0); - ((PLANETSIDE_DESC*)pMenuState->ModuleFrame)->InTransit = TRUE; + pLanderInputState->planetSideDesc->InTransit = TRUE; } else if (pSolarSysState->CurNode == (COUNT)~0) pSolarSysState->CurNode = 1; diff --git a/sc2/src/uqm/planets/gensup.c b/sc2/src/uqm/planets/gensup.c index fa97ed921..276745515 100644 --- a/sc2/src/uqm/planets/gensup.c +++ b/sc2/src/uqm/planets/gensup.c @@ -60,7 +60,7 @@ GenerateSupox (BYTE control) if (!GET_GAME_STATE (ULTRON_CONDITION)) { - ((PLANETSIDE_DESC*)pMenuState->ModuleFrame)->InTransit = TRUE; + pLanderInputState->planetSideDesc->InTransit = TRUE; SET_GAME_STATE (ULTRON_CONDITION, 1); } diff --git a/sc2/src/uqm/planets/genvault.c b/sc2/src/uqm/planets/genvault.c index 5465b41ad..d4007a1a8 100644 --- a/sc2/src/uqm/planets/genvault.c +++ b/sc2/src/uqm/planets/genvault.c @@ -56,7 +56,7 @@ GenerateShipVault (BYTE control) &= ~(1L << 0); if (GET_GAME_STATE (SYREEN_SHUTTLE_ON_SHIP)) { - ((PLANETSIDE_DESC*)pMenuState->ModuleFrame)->InTransit = TRUE; + pLanderInputState->planetSideDesc->InTransit = TRUE; SET_GAME_STATE (SHIP_VAULT_UNLOCKED, 1); SET_GAME_STATE (SYREEN_SHUTTLE_ON_SHIP, 0); diff --git a/sc2/src/uqm/planets/genvux.c b/sc2/src/uqm/planets/genvux.c index 99636d826..e115f96a3 100644 --- a/sc2/src/uqm/planets/genvux.c +++ b/sc2/src/uqm/planets/genvux.c @@ -311,13 +311,10 @@ GenerateVUX (BYTE control) & (1L << i)) && !GET_GAME_STATE (VUX_BEAST)) { - PLANETSIDE_DESC *pPSD; - - pPSD = (PLANETSIDE_DESC*)pMenuState->ModuleFrame; UnbatchGraphics (); DoDiscoveryReport (MenuSounds); BatchGraphics (); - pPSD->InTransit = TRUE; + pLanderInputState->planetSideDesc->InTransit = TRUE; SET_GAME_STATE (VUX_BEAST, 1); SET_GAME_STATE (VUX_BEAST_ON_SHIP, 1); diff --git a/sc2/src/uqm/planets/genwreck.c b/sc2/src/uqm/planets/genwreck.c index 9138e756d..08e41dc7a 100644 --- a/sc2/src/uqm/planets/genwreck.c +++ b/sc2/src/uqm/planets/genwreck.c @@ -54,7 +54,7 @@ GenerateUrquanWreck (BYTE control) if (!GET_GAME_STATE (PORTAL_KEY)) { - ((PLANETSIDE_DESC*)pMenuState->ModuleFrame)->InTransit = TRUE; + pLanderInputState->planetSideDesc->InTransit = TRUE; SET_GAME_STATE (PORTAL_KEY, 1); SET_GAME_STATE (PORTAL_KEY_ON_SHIP, 1); diff --git a/sc2/src/uqm/planets/lander.c b/sc2/src/uqm/planets/lander.c index 06aa0d55d..99f0f49e3 100644 --- a/sc2/src/uqm/planets/lander.c +++ b/sc2/src/uqm/planets/lander.c @@ -48,31 +48,6 @@ // ONE_SECOND. #define PLANET_SIDE_RATE (ONE_SECOND / 35) -// This is a derived type from INPUT_STATE_DESC. -// Originally, the general MENU_STATE structure was used. Now, only the -// fields which are relevant are put in here. In the MENU_STATE structure, -// these fields were reused for all sorts of purposes, which had nothing -// to do with what the name suggests. Not all fields have been renamed yet -// in LanderInputState. -typedef struct LanderInputState LanderInputState; -struct LanderInputState { - BOOLEAN (*InputFunc) (LanderInputState *pMS); - COUNT MenuRepeatDelay; - - PLANETSIDE_DESC *planetSideDesc; - SIZE Initialized; - MENU_STATE *scanInputState; - - // The following fields need to be renamed: - BYTE CurState; - // High byte: ? - // Low byte: ? - SIZE delta_item; - // High byte: ? - // Low byte: bits 0-6: current lander crew count - // bit 7: set if damage was prevented by a shield -}; - LanderInputState *pLanderInputState; // Temporary, to replace the references to pMenuState. // Eventually, this should become a parameter to everything which diff --git a/sc2/src/uqm/planets/lander.h b/sc2/src/uqm/planets/lander.h index 21b69d3bd..8162f72ca 100644 --- a/sc2/src/uqm/planets/lander.h +++ b/sc2/src/uqm/planets/lander.h @@ -53,6 +53,37 @@ typedef struct BYTE FireChance; } PLANETSIDE_DESC; +// This is a derived type from INPUT_STATE_DESC. +// Originally, the general MENU_STATE structure was used. Now, only the +// fields which are relevant are put in here. In the MENU_STATE structure, +// these fields were reused for all sorts of purposes, which had nothing +// to do with what the name suggests. Not all fields have been renamed yet +// in LanderInputState. +typedef struct LanderInputState LanderInputState; +struct LanderInputState { + BOOLEAN (*InputFunc) (LanderInputState *pMS); + COUNT MenuRepeatDelay; + + PLANETSIDE_DESC *planetSideDesc; + SIZE Initialized; + MENU_STATE *scanInputState; + + // The following fields need to be renamed: + BYTE CurState; + // High byte: ? + // Low byte: ? + SIZE delta_item; + // High byte: ? + // Low byte: bits 0-6: current lander crew count + // bit 7: set if damage was prevented by a shield +}; + +extern LanderInputState *pLanderInputState; + // Temporary, to replace the references to pMenuState. + // Eventually, this should become a parameter to everything which + // needs it. + + extern CONTEXT ScanContext; extern MUSIC_REF LanderMusic; diff --git a/sc2/src/uqm/planets/orbits.c b/sc2/src/uqm/planets/orbits.c index 76ce2e485..4a9bd6ba8 100644 --- a/sc2/src/uqm/planets/orbits.c +++ b/sc2/src/uqm/planets/orbits.c @@ -37,7 +37,7 @@ enum static BYTE BlueDistribution (BYTE which_world) { - BYTE PlanetDistribution[NUMBER_OF_PLANET_TYPES] = + const BYTE PlanetDistribution[NUMBER_OF_PLANET_TYPES] = { PLANET_ALWAYS, /* OOLITE_WORLD */ PLANET_ALWAYS, /* YTTRIC_WORLD */ @@ -108,7 +108,7 @@ BlueDistribution (BYTE which_world) static BYTE GreenDistribution (BYTE which_world) { - BYTE PlanetDistribution[NUMBER_OF_PLANET_TYPES] = + const BYTE PlanetDistribution[NUMBER_OF_PLANET_TYPES] = { PLANET_NEVER, /* OOLITE_WORLD */ PLANET_NEVER, /* YTTRIC_WORLD */ @@ -179,7 +179,7 @@ GreenDistribution (BYTE which_world) static BYTE OrangeDistribution (BYTE which_world) { - BYTE PlanetDistribution[NUMBER_OF_PLANET_TYPES] = + const BYTE PlanetDistribution[NUMBER_OF_PLANET_TYPES] = { PLANET_NEVER, /* OOLITE_WORLD */ PLANET_NEVER, /* YTTRIC_WORLD */ @@ -250,7 +250,7 @@ OrangeDistribution (BYTE which_world) static BYTE RedDistribution (BYTE which_world) { - BYTE PlanetDistribution[NUMBER_OF_PLANET_TYPES] = + const BYTE PlanetDistribution[NUMBER_OF_PLANET_TYPES] = { PLANET_NEVER, /* OOLITE_WORLD */ PLANET_NEVER, /* YTTRIC_WORLD */ @@ -321,7 +321,7 @@ RedDistribution (BYTE which_world) static BYTE WhiteDistribution (BYTE which_world) { - BYTE PlanetDistribution[NUMBER_OF_PLANET_TYPES] = + const BYTE PlanetDistribution[NUMBER_OF_PLANET_TYPES] = { PLANET_ALWAYS, /* OOLITE_WORLD */ PLANET_ALWAYS, /* YTTRIC_WORLD */ @@ -392,7 +392,7 @@ WhiteDistribution (BYTE which_world) static BYTE YellowDistribution (BYTE which_world) { - BYTE PlanetDistribution[NUMBER_OF_PLANET_TYPES] = + const BYTE PlanetDistribution[NUMBER_OF_PLANET_TYPES] = { PLANET_NEVER, /* OOLITE_WORLD */ PLANET_NEVER, /* YTTRIC_WORLD */ diff --git a/sc2/src/uqm/planets/solarsys.c b/sc2/src/uqm/planets/solarsys.c index bfd373fdc..97ea3182b 100644 --- a/sc2/src/uqm/planets/solarsys.c +++ b/sc2/src/uqm/planets/solarsys.c @@ -1267,7 +1267,6 @@ IP_frame (void) select = PulsedInputState.menu[KEY_MENU_SELECT]; IP_input_state = (cancel << 1) | select; } - // JournalInput (InputState); } else {