Energy and some bio generation code refactoring: generation funcs perform all action neccessary upon energy node pickup, Fwiffo hacks removed, duplicated code made into funcs; fixes bugs 1118/1028
git-svn-id: svn://svn.code.sf.net/p/sc2/code/trunk@3583 8092fc87-c524-0410-9efc-e669fe64eaf9
This commit is contained in:
@@ -1,4 +1,5 @@
|
||||
Changes towards version 0.7:
|
||||
- Fixed Syreen Vault lander report infinite loop (bug #1118) - Alex
|
||||
- Same captain names are used on both net sides (bug #989) - Alex
|
||||
- Fixed sync loss in netplay games having duplicate ships (bug #1081) - Alex
|
||||
- Fixed loading of melee.cfg (bug #1099) - Alex
|
||||
|
||||
@@ -120,45 +120,31 @@ GenerateAndrosynth_generateOrbital (SOLARSYS_STATE *solarSys, PLANET_DESC *world
|
||||
return true;
|
||||
}
|
||||
|
||||
static bool
|
||||
onRuinPickedUp (SOLARSYS_STATE *solarSys, COUNT whichNode)
|
||||
{
|
||||
PLANET_INFO *planetInfo = &solarSys->SysInfo.PlanetInfo;
|
||||
|
||||
// Ruins previously visited are marked in the upper 16 bits
|
||||
if (isNodeRetrieved (planetInfo, ENERGY_SCAN, whichNode + 16))
|
||||
return false; // already visited this ruin before, no report
|
||||
|
||||
setNodeRetrieved (planetInfo, ENERGY_SCAN, whichNode + 16);
|
||||
// We set the retrieved bit manually here and need to indicate
|
||||
// the change to the solar system state functions
|
||||
SET_GAME_STATE (PLANETARY_CHANGE, 1);
|
||||
|
||||
return true; // give whatever report is next
|
||||
}
|
||||
|
||||
static bool
|
||||
GenerateAndrosynth_generateEnergy (SOLARSYS_STATE *solarSys, PLANET_DESC *world,
|
||||
COUNT *whichNode)
|
||||
{
|
||||
if (matchWorld (solarSys, world, 1, MATCH_PLANET))
|
||||
{
|
||||
COUNT i;
|
||||
|
||||
GenerateRandomRuins (&solarSys->SysInfo, 0, whichNode);
|
||||
|
||||
for (i = 0; i < 16; ++i)
|
||||
{
|
||||
if (isNodeRetrieved (&solarSys->SysInfo.PlanetInfo, ENERGY_SCAN, i))
|
||||
{
|
||||
// Retrieval status is cleared to keep the node on the map
|
||||
setNodeNotRetrieved (&solarSys->SysInfo.PlanetInfo, ENERGY_SCAN, i);
|
||||
// Ruins previously visited are marked in the upper 16 bits
|
||||
if (!isNodeRetrieved (&solarSys->SysInfo.PlanetInfo, ENERGY_SCAN,
|
||||
i + 16))
|
||||
{
|
||||
SET_GAME_STATE (PLANETARY_CHANGE, 1);
|
||||
|
||||
setNodeRetrieved (&solarSys->SysInfo.PlanetInfo, ENERGY_SCAN,
|
||||
i + 16);
|
||||
if (solarSys->SysInfo.PlanetInfo.DiscoveryString)
|
||||
{
|
||||
UnbatchGraphics ();
|
||||
DoDiscoveryReport (MenuSounds);
|
||||
BatchGraphics ();
|
||||
// Advance to the next report
|
||||
solarSys->SysInfo.PlanetInfo.DiscoveryString =
|
||||
SetRelStringTableIndex (
|
||||
solarSys->SysInfo.PlanetInfo.DiscoveryString,
|
||||
1);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
GenerateDefault_generateRuins (solarSys, whichNode);
|
||||
GenerateDefault_pickupRuins (solarSys, onRuinPickedUp);
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
@@ -17,6 +17,7 @@
|
||||
*/
|
||||
|
||||
#include "genall.h"
|
||||
#include "../lander.h"
|
||||
#include "../planets.h"
|
||||
#include "../scan.h"
|
||||
#include "../../globdata.h"
|
||||
@@ -139,11 +140,10 @@ static bool
|
||||
GenerateBurvixese_generateEnergy (SOLARSYS_STATE *solarSys, PLANET_DESC *world,
|
||||
COUNT *whichNode)
|
||||
{
|
||||
DWORD old_rand;
|
||||
|
||||
if (matchWorld (solarSys, world, 0, MATCH_PLANET))
|
||||
{
|
||||
GenerateRandomRuins (&solarSys->SysInfo, 1, whichNode);
|
||||
GenerateDefault_generateRuins (solarSys, whichNode);
|
||||
GenerateDefault_pickupRuins (solarSys, NULL);
|
||||
return true;
|
||||
}
|
||||
|
||||
@@ -155,22 +155,17 @@ GenerateBurvixese_generateEnergy (SOLARSYS_STATE *solarSys, PLANET_DESC *world,
|
||||
return true;
|
||||
}
|
||||
|
||||
old_rand = TFB_SeedRandom (
|
||||
solarSys->SysInfo.PlanetInfo.ScanSeed[ENERGY_SCAN]);
|
||||
|
||||
GenerateRandomLocation (&solarSys->SysInfo);
|
||||
solarSys->SysInfo.PlanetInfo.CurDensity = 0;
|
||||
solarSys->SysInfo.PlanetInfo.CurType = 0;
|
||||
|
||||
*whichNode = 1; // only matters when count is requested
|
||||
GenerateDefault_generateArtifact (solarSys, whichNode);
|
||||
|
||||
if (isNodeRetrieved (&solarSys->SysInfo.PlanetInfo, ENERGY_SCAN, 0))
|
||||
{
|
||||
SET_GAME_STATE (BURVIXESE_BROADCASTERS, 1);
|
||||
SET_GAME_STATE (BURV_BROADCASTERS_ON_SHIP, 1);
|
||||
|
||||
GenerateDefault_landerReport (solarSys);
|
||||
SetLanderTakeoff ();
|
||||
}
|
||||
|
||||
TFB_SeedRandom (old_rand);
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
@@ -16,12 +16,15 @@
|
||||
|
||||
#include "genall.h"
|
||||
#include "../planets.h"
|
||||
#include "../scan.h"
|
||||
#include "../lander.h"
|
||||
#include "../../encount.h"
|
||||
#include "../../gamestr.h"
|
||||
#include "../../globdata.h"
|
||||
#include "../../grpinfo.h"
|
||||
#include "../../races.h"
|
||||
#include "../../state.h"
|
||||
#include "../../sounds.h"
|
||||
#include "libs/mathlib.h"
|
||||
|
||||
|
||||
@@ -191,6 +194,99 @@ GenerateDefault_generateLife (SOLARSYS_STATE *solarSys, PLANET_DESC *world,
|
||||
return true;
|
||||
}
|
||||
|
||||
bool
|
||||
GenerateDefault_generateArtifact (SOLARSYS_STATE *solarSys, COUNT *whichNode)
|
||||
{
|
||||
// Generate an energy node at a random location
|
||||
GenerateRandomNodes (&solarSys->SysInfo, ENERGY_SCAN, 1, 0, whichNode);
|
||||
return true;
|
||||
}
|
||||
|
||||
bool
|
||||
GenerateDefault_generateRuins (SOLARSYS_STATE *solarSys, COUNT *whichNode)
|
||||
{
|
||||
// Generate a standard spread of city ruins of a destroyed civilization
|
||||
GenerateRandomNodes (&solarSys->SysInfo, ENERGY_SCAN, NUM_RACE_RUINS,
|
||||
0, whichNode);
|
||||
return true;
|
||||
}
|
||||
|
||||
bool
|
||||
GenerateDefault_pickupRuins (SOLARSYS_STATE *solarSys,
|
||||
PickupRuinCallback callback)
|
||||
{
|
||||
PLANET_INFO *planetInfo = &solarSys->SysInfo.PlanetInfo;
|
||||
COUNT i;
|
||||
|
||||
for (i = 0; i < NUM_RACE_RUINS; ++i)
|
||||
{
|
||||
if (!isNodeRetrieved (planetInfo, ENERGY_SCAN, i))
|
||||
continue;
|
||||
|
||||
// Retrieval status is cleared to keep the node on the map
|
||||
setNodeNotRetrieved (planetInfo, ENERGY_SCAN, i);
|
||||
|
||||
if (callback && !callback (solarSys, i))
|
||||
continue; // no lander report wanted
|
||||
|
||||
// Some ruins have more than one lander report, like when
|
||||
// you fish artifacts out of the ruins.
|
||||
GenerateDefault_landerReportCycle (solarSys);
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
static inline void
|
||||
runLanderReport (void)
|
||||
{
|
||||
UnbatchGraphics ();
|
||||
DoDiscoveryReport (MenuSounds);
|
||||
BatchGraphics ();
|
||||
}
|
||||
|
||||
bool
|
||||
GenerateDefault_landerReport (SOLARSYS_STATE *solarSys)
|
||||
{
|
||||
PLANET_INFO *planetInfo = &solarSys->SysInfo.PlanetInfo;
|
||||
|
||||
if (!planetInfo->DiscoveryString)
|
||||
return false;
|
||||
|
||||
runLanderReport ();
|
||||
|
||||
// XXX: A non-cycling report is given only once and has to be deleted
|
||||
// in some circumstances (like the Syreen Vault). It does not
|
||||
// hurt to simply delete it in all cases. Nothing should rely on
|
||||
// the presence of DiscoveryString, but the Syreen Vault and the
|
||||
// Mycon Egg Cases rely on its absence.
|
||||
DestroyStringTable (ReleaseStringTable (planetInfo->DiscoveryString));
|
||||
planetInfo->DiscoveryString = 0;
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
bool
|
||||
GenerateDefault_landerReportCycle (SOLARSYS_STATE *solarSys)
|
||||
{
|
||||
PLANET_INFO *planetInfo = &solarSys->SysInfo.PlanetInfo;
|
||||
|
||||
if (!planetInfo->DiscoveryString)
|
||||
return false;
|
||||
|
||||
runLanderReport ();
|
||||
// Advance to the next report
|
||||
planetInfo->DiscoveryString = SetRelStringTableIndex (
|
||||
planetInfo->DiscoveryString, 1);
|
||||
|
||||
// If our discovery strings have cycled, we're done
|
||||
if (GetStringTableIndex (planetInfo->DiscoveryString) == 0)
|
||||
{
|
||||
DestroyStringTable (ReleaseStringTable (planetInfo->DiscoveryString));
|
||||
planetInfo->DiscoveryString = 0;
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
// NB. This function modifies the RNG state.
|
||||
static void
|
||||
|
||||
@@ -38,6 +38,17 @@ bool GenerateDefault_generateEnergy (SOLARSYS_STATE *solarSys,
|
||||
bool GenerateDefault_generateLife (SOLARSYS_STATE *solarSys,
|
||||
PLANET_DESC *world, COUNT *whichNode);
|
||||
|
||||
// Ruin callback returns 'true' if a lander report should be given
|
||||
typedef bool (*PickupRuinCallback)(SOLARSYS_STATE *solarSys,
|
||||
COUNT whichNode);
|
||||
|
||||
bool GenerateDefault_generateArtifact (SOLARSYS_STATE *, COUNT *whichNode);
|
||||
bool GenerateDefault_generateRuins (SOLARSYS_STATE *, COUNT *whichNode);
|
||||
bool GenerateDefault_pickupRuins (SOLARSYS_STATE *, PickupRuinCallback);
|
||||
bool GenerateDefault_landerReport (SOLARSYS_STATE *);
|
||||
bool GenerateDefault_landerReportCycle (SOLARSYS_STATE *);
|
||||
|
||||
|
||||
extern const GenerateFunctions generateDefaultFunctions;
|
||||
|
||||
#endif /* GENDEFAULT_H */
|
||||
|
||||
@@ -19,7 +19,6 @@
|
||||
#include "genall.h"
|
||||
#include "../lander.h"
|
||||
#include "../planets.h"
|
||||
#include "../scan.h"
|
||||
#include "../../build.h"
|
||||
#include "../../comm.h"
|
||||
#include "../../globdata.h"
|
||||
@@ -114,9 +113,11 @@ GenerateDruuge_generateOrbital (SOLARSYS_STATE *solarSys, PLANET_DESC *world)
|
||||
CaptureStringTable (
|
||||
LoadStringTable (DRUUGE_RUINS_STRTAB));
|
||||
if (GET_GAME_STATE (ROSY_SPHERE))
|
||||
{ // Already picked up Rosy Sphere, skip the report
|
||||
solarSys->SysInfo.PlanetInfo.DiscoveryString =
|
||||
SetAbsStringTableIndex (
|
||||
solarSys->SysInfo.PlanetInfo.DiscoveryString, 1);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -125,35 +126,31 @@ GenerateDruuge_generateOrbital (SOLARSYS_STATE *solarSys, PLANET_DESC *world)
|
||||
return true;
|
||||
}
|
||||
|
||||
static bool
|
||||
onRuinPickedUp (SOLARSYS_STATE *solarSys, COUNT whichNode)
|
||||
{
|
||||
if (!GET_GAME_STATE (ROSY_SPHERE))
|
||||
{ // Just picked up the Rosy Sphere from a ruin
|
||||
SetLanderTakeoff ();
|
||||
|
||||
SET_GAME_STATE (ROSY_SPHERE, 1);
|
||||
SET_GAME_STATE (ROSY_SPHERE_ON_SHIP, 1);
|
||||
}
|
||||
|
||||
(void) solarSys;
|
||||
(void) whichNode;
|
||||
|
||||
return true; // give whatever report is next
|
||||
}
|
||||
|
||||
static bool
|
||||
GenerateDruuge_generateEnergy (SOLARSYS_STATE *solarSys, PLANET_DESC *world,
|
||||
COUNT *whichNode)
|
||||
{
|
||||
if (matchWorld (solarSys, world, 0, MATCH_PLANET))
|
||||
{
|
||||
COUNT i;
|
||||
COUNT type;
|
||||
|
||||
type = GET_GAME_STATE (ROSY_SPHERE) ? 1 : 0;
|
||||
GenerateRandomRuins (&solarSys->SysInfo, type, whichNode);
|
||||
|
||||
for (i = 0; i < 16; ++i)
|
||||
{
|
||||
if (isNodeRetrieved (&solarSys->SysInfo.PlanetInfo, ENERGY_SCAN, i))
|
||||
{
|
||||
// Retrieval status is cleared to keep the node on the map
|
||||
setNodeNotRetrieved (&solarSys->SysInfo.PlanetInfo, ENERGY_SCAN, i);
|
||||
|
||||
if (!GET_GAME_STATE (ROSY_SPHERE))
|
||||
{
|
||||
SetLanderTakeoff ();
|
||||
|
||||
SET_GAME_STATE (ROSY_SPHERE, 1);
|
||||
SET_GAME_STATE (ROSY_SPHERE_ON_SHIP, 1);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
GenerateDefault_generateRuins (solarSys, whichNode);
|
||||
GenerateDefault_pickupRuins (solarSys, onRuinPickedUp);
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
@@ -123,7 +123,8 @@ GenerateIlwrath_generateEnergy (SOLARSYS_STATE *solarSys, PLANET_DESC *world,
|
||||
{
|
||||
if (matchWorld (solarSys, world, 0, MATCH_PLANET))
|
||||
{
|
||||
GenerateRandomRuins (&solarSys->SysInfo, 1, whichNode);
|
||||
GenerateDefault_generateRuins (solarSys, whichNode);
|
||||
GenerateDefault_pickupRuins (solarSys, NULL);
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
@@ -17,6 +17,7 @@
|
||||
*/
|
||||
|
||||
#include "genall.h"
|
||||
#include "../lander.h"
|
||||
#include "../planets.h"
|
||||
#include "../scan.h"
|
||||
#include "../../build.h"
|
||||
@@ -185,8 +186,6 @@ static bool
|
||||
GenerateMycon_generateEnergy (SOLARSYS_STATE *solarSys, PLANET_DESC *world,
|
||||
COUNT *whichNode)
|
||||
{
|
||||
DWORD old_rand;
|
||||
|
||||
if (CurStarDescPtr->Index == SUN_DEVICE_DEFINED
|
||||
&& matchWorld (solarSys, world, 0, MATCH_PLANET))
|
||||
{
|
||||
@@ -196,23 +195,18 @@ GenerateMycon_generateEnergy (SOLARSYS_STATE *solarSys, PLANET_DESC *world,
|
||||
return true;
|
||||
}
|
||||
|
||||
old_rand = TFB_SeedRandom (
|
||||
solarSys->SysInfo.PlanetInfo.ScanSeed[ENERGY_SCAN]);
|
||||
|
||||
GenerateRandomLocation (&solarSys->SysInfo);
|
||||
solarSys->SysInfo.PlanetInfo.CurDensity = 0;
|
||||
solarSys->SysInfo.PlanetInfo.CurType = 0;
|
||||
|
||||
*whichNode = 1; // only matters when count is requested
|
||||
GenerateDefault_generateArtifact (solarSys, whichNode);
|
||||
|
||||
if (isNodeRetrieved (&solarSys->SysInfo.PlanetInfo, ENERGY_SCAN, 0))
|
||||
{
|
||||
SET_GAME_STATE (SUN_DEVICE, 1);
|
||||
SET_GAME_STATE (SUN_DEVICE_ON_SHIP, 1);
|
||||
SET_GAME_STATE (MYCON_VISITS, 0);
|
||||
|
||||
GenerateDefault_landerReport (solarSys);
|
||||
SetLanderTakeoff ();
|
||||
}
|
||||
|
||||
TFB_SeedRandom (old_rand);
|
||||
return true;
|
||||
}
|
||||
|
||||
@@ -230,14 +224,7 @@ GenerateMycon_generateEnergy (SOLARSYS_STATE *solarSys, PLANET_DESC *world,
|
||||
return true;
|
||||
}
|
||||
|
||||
old_rand = TFB_SeedRandom (
|
||||
solarSys->SysInfo.PlanetInfo.ScanSeed[ENERGY_SCAN]);
|
||||
|
||||
GenerateRandomLocation (&solarSys->SysInfo);
|
||||
solarSys->SysInfo.PlanetInfo.CurDensity = 0;
|
||||
solarSys->SysInfo.PlanetInfo.CurType = 0;
|
||||
|
||||
*whichNode = 1; // only matters when count is requested
|
||||
GenerateDefault_generateArtifact (solarSys, whichNode);
|
||||
|
||||
if (isNodeRetrieved (&solarSys->SysInfo.PlanetInfo, ENERGY_SCAN, 0))
|
||||
{
|
||||
@@ -253,9 +240,11 @@ GenerateMycon_generateEnergy (SOLARSYS_STATE *solarSys, PLANET_DESC *world,
|
||||
SET_GAME_STATE (EGG_CASE2_ON_SHIP, 1);
|
||||
break;
|
||||
}
|
||||
|
||||
GenerateDefault_landerReport (solarSys);
|
||||
SetLanderTakeoff ();
|
||||
}
|
||||
|
||||
TFB_SeedRandom (old_rand);
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
@@ -17,6 +17,7 @@
|
||||
*/
|
||||
|
||||
#include "genall.h"
|
||||
#include "../lander.h"
|
||||
#include "../planets.h"
|
||||
#include "../scan.h"
|
||||
#include "../../build.h"
|
||||
@@ -165,8 +166,6 @@ static bool
|
||||
GenerateOrz_generateEnergy (SOLARSYS_STATE *solarSys, PLANET_DESC *world,
|
||||
COUNT *whichNode)
|
||||
{
|
||||
DWORD old_rand;
|
||||
|
||||
if (CurStarDescPtr->Index == TAALO_PROTECTOR_DEFINED
|
||||
&& matchWorld (solarSys, world, 1, 2))
|
||||
{
|
||||
@@ -176,29 +175,25 @@ GenerateOrz_generateEnergy (SOLARSYS_STATE *solarSys, PLANET_DESC *world,
|
||||
return true;
|
||||
}
|
||||
|
||||
old_rand = TFB_SeedRandom (
|
||||
solarSys->SysInfo.PlanetInfo.ScanSeed[ENERGY_SCAN]);
|
||||
|
||||
GenerateRandomLocation (&solarSys->SysInfo);
|
||||
solarSys->SysInfo.PlanetInfo.CurDensity = 0;
|
||||
solarSys->SysInfo.PlanetInfo.CurType = 0;
|
||||
|
||||
*whichNode = 1; // only matters when count is requested
|
||||
GenerateDefault_generateArtifact (solarSys, whichNode);
|
||||
|
||||
if (isNodeRetrieved (&solarSys->SysInfo.PlanetInfo, ENERGY_SCAN, 0))
|
||||
{
|
||||
SET_GAME_STATE (TAALO_PROTECTOR, 1);
|
||||
SET_GAME_STATE (TAALO_PROTECTOR_ON_SHIP, 1);
|
||||
|
||||
GenerateDefault_landerReport (solarSys);
|
||||
SetLanderTakeoff ();
|
||||
}
|
||||
|
||||
TFB_SeedRandom (old_rand);
|
||||
return true;
|
||||
}
|
||||
|
||||
if (CurStarDescPtr->Index == ORZ_DEFINED
|
||||
&& matchWorld (solarSys, world, 0, MATCH_PLANET))
|
||||
{
|
||||
GenerateRandomRuins (&solarSys->SysInfo, 1, whichNode);
|
||||
GenerateDefault_generateRuins (solarSys, whichNode);
|
||||
GenerateDefault_pickupRuins (solarSys, NULL);
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
@@ -160,7 +160,8 @@ GenerateTalkingPet_generateEnergy (SOLARSYS_STATE *solarSys, PLANET_DESC *world,
|
||||
{
|
||||
if (matchWorld (solarSys, world, 0, MATCH_PLANET))
|
||||
{
|
||||
GenerateRandomRuins (&solarSys->SysInfo, 1, whichNode);
|
||||
GenerateDefault_generateRuins (solarSys, whichNode);
|
||||
GenerateDefault_pickupRuins (solarSys, NULL);
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
@@ -19,7 +19,6 @@
|
||||
#include "genall.h"
|
||||
#include "../lander.h"
|
||||
#include "../planets.h"
|
||||
#include "../scan.h"
|
||||
#include "../../build.h"
|
||||
#include "../../comm.h"
|
||||
#include "../../globdata.h"
|
||||
@@ -105,9 +104,11 @@ GeneratePkunk_generateOrbital (SOLARSYS_STATE *solarSys, PLANET_DESC *world)
|
||||
solarSys->SysInfo.PlanetInfo.DiscoveryString =
|
||||
CaptureStringTable (LoadStringTable (PKUNK_RUINS_STRTAB));
|
||||
if (GET_GAME_STATE (CLEAR_SPINDLE))
|
||||
{ // Already picked up the Clear Spindle, skip the report
|
||||
solarSys->SysInfo.PlanetInfo.DiscoveryString =
|
||||
SetAbsStringTableIndex (
|
||||
solarSys->SysInfo.PlanetInfo.DiscoveryString, 1);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -115,35 +116,31 @@ GeneratePkunk_generateOrbital (SOLARSYS_STATE *solarSys, PLANET_DESC *world)
|
||||
return true;
|
||||
}
|
||||
|
||||
static bool
|
||||
onRuinPickedUp (SOLARSYS_STATE *solarSys, COUNT whichNode)
|
||||
{
|
||||
if (!GET_GAME_STATE (CLEAR_SPINDLE))
|
||||
{ // Just picked up the Clear Spindle from a ruin
|
||||
SetLanderTakeoff ();
|
||||
|
||||
SET_GAME_STATE (CLEAR_SPINDLE, 1);
|
||||
SET_GAME_STATE (CLEAR_SPINDLE_ON_SHIP, 1);
|
||||
}
|
||||
|
||||
(void) solarSys;
|
||||
(void) whichNode;
|
||||
|
||||
return true; // give whatever report is next
|
||||
}
|
||||
|
||||
static bool
|
||||
GeneratePkunk_generateEnergy (SOLARSYS_STATE *solarSys, PLANET_DESC *world,
|
||||
COUNT *whichNode)
|
||||
{
|
||||
if (matchWorld (solarSys, world, 0, MATCH_PLANET))
|
||||
{
|
||||
COUNT i;
|
||||
COUNT type;
|
||||
|
||||
type = GET_GAME_STATE (CLEAR_SPINDLE) ? 1 : 0;
|
||||
GenerateRandomRuins (&solarSys->SysInfo, type, whichNode);
|
||||
|
||||
for (i = 0; i < 16; ++i)
|
||||
{
|
||||
if (isNodeRetrieved (&solarSys->SysInfo.PlanetInfo, ENERGY_SCAN, i))
|
||||
{
|
||||
// Retrieval status is cleared to keep the node on the map
|
||||
setNodeNotRetrieved (&solarSys->SysInfo.PlanetInfo, ENERGY_SCAN, i);
|
||||
|
||||
if (!GET_GAME_STATE (CLEAR_SPINDLE))
|
||||
{
|
||||
SetLanderTakeoff ();
|
||||
|
||||
SET_GAME_STATE (CLEAR_SPINDLE, 1);
|
||||
SET_GAME_STATE (CLEAR_SPINDLE_ON_SHIP, 1);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
GenerateDefault_generateRuins (solarSys, whichNode);
|
||||
GenerateDefault_pickupRuins (solarSys, onRuinPickedUp);
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
@@ -524,18 +524,23 @@ GenerateSol_generateEnergy (SOLARSYS_STATE *solarSys, PLANET_DESC *world,
|
||||
|
||||
solarSys->SysInfo.PlanetInfo.CurPt.x = 20;
|
||||
solarSys->SysInfo.PlanetInfo.CurPt.y = MAP_HEIGHT - 8;
|
||||
solarSys->SysInfo.PlanetInfo.CurDensity = 0;
|
||||
solarSys->SysInfo.PlanetInfo.CurType = 2;
|
||||
|
||||
*whichNode = 1; // only matters when count is requested
|
||||
|
||||
if (isNodeRetrieved (&solarSys->SysInfo.PlanetInfo, ENERGY_SCAN, 0))
|
||||
{
|
||||
SET_GAME_STATE (FOUND_PLUTO_SPATHI, 1);
|
||||
{ // Ran into Fwiffo on Pluto
|
||||
// Retrieval status is cleared to keep the node on the map
|
||||
// while the lander is taking off. FOUND_PLUTO_SPATHI bit
|
||||
// will keep the node from showing up on subsequent visits.
|
||||
setNodeNotRetrieved (&solarSys->SysInfo.PlanetInfo, ENERGY_SCAN, 0);
|
||||
|
||||
#define FWIFFO_FRAGS 8
|
||||
if (!KillLanderCrewSeq (FWIFFO_FRAGS, ONE_SECOND / 20))
|
||||
return true; // lander probably died
|
||||
|
||||
SET_GAME_STATE (FOUND_PLUTO_SPATHI, 1);
|
||||
|
||||
GenerateDefault_landerReport (solarSys);
|
||||
SetLanderTakeoff ();
|
||||
}
|
||||
|
||||
@@ -553,8 +558,6 @@ GenerateSol_generateEnergy (SOLARSYS_STATE *solarSys, PLANET_DESC *world,
|
||||
|
||||
solarSys->SysInfo.PlanetInfo.CurPt.x = MAP_WIDTH * 3 / 4;
|
||||
solarSys->SysInfo.PlanetInfo.CurPt.y = MAP_HEIGHT * 1 / 4;
|
||||
solarSys->SysInfo.PlanetInfo.CurDensity = 0;
|
||||
solarSys->SysInfo.PlanetInfo.CurType = 0;
|
||||
|
||||
*whichNode = 1; // only matters when count is requested
|
||||
|
||||
@@ -562,6 +565,9 @@ GenerateSol_generateEnergy (SOLARSYS_STATE *solarSys, PLANET_DESC *world,
|
||||
{
|
||||
SET_GAME_STATE (MOONBASE_DESTROYED, 1);
|
||||
SET_GAME_STATE (MOONBASE_ON_SHIP, 1);
|
||||
|
||||
GenerateDefault_landerReport (solarSys);
|
||||
SetLanderTakeoff ();
|
||||
}
|
||||
|
||||
return true;
|
||||
|
||||
@@ -18,6 +18,7 @@
|
||||
|
||||
#include "genall.h"
|
||||
#include "../lifeform.h"
|
||||
#include "../lander.h"
|
||||
#include "../planets.h"
|
||||
#include "../scan.h"
|
||||
#include "../../build.h"
|
||||
@@ -196,30 +197,23 @@ GenerateSpathi_generateEnergy (SOLARSYS_STATE *solarSys, PLANET_DESC *world,
|
||||
{
|
||||
if (matchWorld (solarSys, world, 0, 0))
|
||||
{
|
||||
DWORD old_rand;
|
||||
|
||||
if (GET_GAME_STATE (UMGAH_BROADCASTERS))
|
||||
{ // already picked up
|
||||
*whichNode = 0;
|
||||
return true;
|
||||
}
|
||||
|
||||
old_rand = TFB_SeedRandom (
|
||||
solarSys->SysInfo.PlanetInfo.ScanSeed[ENERGY_SCAN]);
|
||||
|
||||
GenerateRandomLocation (&solarSys->SysInfo);
|
||||
solarSys->SysInfo.PlanetInfo.CurDensity = 0;
|
||||
solarSys->SysInfo.PlanetInfo.CurType = 0;
|
||||
|
||||
*whichNode = 1; // only matters when count is requested
|
||||
GenerateDefault_generateArtifact (solarSys, whichNode);
|
||||
|
||||
if (isNodeRetrieved (&solarSys->SysInfo.PlanetInfo, ENERGY_SCAN, 0))
|
||||
{
|
||||
SET_GAME_STATE (UMGAH_BROADCASTERS, 1);
|
||||
SET_GAME_STATE (UMGAH_BROADCASTERS_ON_SHIP, 1);
|
||||
|
||||
GenerateDefault_landerReport (solarSys);
|
||||
SetLanderTakeoff ();
|
||||
}
|
||||
|
||||
TFB_SeedRandom (old_rand);
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
@@ -19,7 +19,6 @@
|
||||
#include "genall.h"
|
||||
#include "../lander.h"
|
||||
#include "../planets.h"
|
||||
#include "../scan.h"
|
||||
#include "../../build.h"
|
||||
#include "../../comm.h"
|
||||
#include "../../globdata.h"
|
||||
@@ -104,8 +103,8 @@ GenerateSupox_generateOrbital (SOLARSYS_STATE *solarSys, PLANET_DESC *world)
|
||||
CaptureDrawable (LoadGraphic (RUINS_MASK_PMAP_ANIM));
|
||||
solarSys->SysInfo.PlanetInfo.DiscoveryString =
|
||||
CaptureStringTable (LoadStringTable (RUINS_STRTAB));
|
||||
if (!GET_GAME_STATE (ULTRON_CONDITION))
|
||||
{
|
||||
if (GET_GAME_STATE (ULTRON_CONDITION))
|
||||
{ // Already picked up the Ultron, skip the report
|
||||
solarSys->SysInfo.PlanetInfo.DiscoveryString =
|
||||
SetAbsStringTableIndex (
|
||||
solarSys->SysInfo.PlanetInfo.DiscoveryString, 1);
|
||||
@@ -118,34 +117,30 @@ GenerateSupox_generateOrbital (SOLARSYS_STATE *solarSys, PLANET_DESC *world)
|
||||
return true;
|
||||
}
|
||||
|
||||
static bool
|
||||
onRuinPickedUp (SOLARSYS_STATE *solarSys, COUNT whichNode)
|
||||
{
|
||||
if (!GET_GAME_STATE (ULTRON_CONDITION))
|
||||
{ // Just picked up the Ultron from a ruin
|
||||
SetLanderTakeoff ();
|
||||
|
||||
SET_GAME_STATE (ULTRON_CONDITION, 1);
|
||||
}
|
||||
|
||||
(void) solarSys;
|
||||
(void) whichNode;
|
||||
|
||||
return true; // give whatever report is next
|
||||
}
|
||||
|
||||
static bool
|
||||
GenerateSupox_generateEnergy (SOLARSYS_STATE *solarSys, PLANET_DESC *world,
|
||||
COUNT *whichNode)
|
||||
{
|
||||
if (matchWorld (solarSys, world, 0, MATCH_PLANET))
|
||||
{
|
||||
COUNT i;
|
||||
COUNT type;
|
||||
|
||||
type = GET_GAME_STATE (ULTRON_CONDITION) ? 1 : 0;
|
||||
GenerateRandomRuins (&solarSys->SysInfo, type, whichNode);
|
||||
|
||||
for (i = 0; i < 16; ++i)
|
||||
{
|
||||
if (isNodeRetrieved (&solarSys->SysInfo.PlanetInfo, ENERGY_SCAN, i))
|
||||
{
|
||||
// Retrieval status is cleared to keep the node on the map
|
||||
setNodeNotRetrieved (&solarSys->SysInfo.PlanetInfo, ENERGY_SCAN, i);
|
||||
|
||||
if (!GET_GAME_STATE (ULTRON_CONDITION))
|
||||
{
|
||||
SetLanderTakeoff ();
|
||||
|
||||
SET_GAME_STATE (ULTRON_CONDITION, 1);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
GenerateDefault_generateRuins (solarSys, whichNode);
|
||||
GenerateDefault_pickupRuins (solarSys, onRuinPickedUp);
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
@@ -17,6 +17,7 @@
|
||||
*/
|
||||
|
||||
#include "genall.h"
|
||||
#include "../lander.h"
|
||||
#include "../planets.h"
|
||||
#include "../scan.h"
|
||||
#include "../../build.h"
|
||||
@@ -158,12 +159,11 @@ static bool
|
||||
GenerateThraddash_generateEnergy (SOLARSYS_STATE *solarSys,
|
||||
PLANET_DESC *world, COUNT *whichNode)
|
||||
{
|
||||
DWORD old_rand;
|
||||
|
||||
if (CurStarDescPtr->Index == THRADD_DEFINED
|
||||
&& matchWorld (solarSys, world, 0, MATCH_PLANET))
|
||||
{
|
||||
GenerateRandomRuins (&solarSys->SysInfo, 1, whichNode);
|
||||
GenerateDefault_generateRuins (solarSys, whichNode);
|
||||
GenerateDefault_pickupRuins (solarSys, NULL);
|
||||
return true;
|
||||
}
|
||||
|
||||
@@ -176,14 +176,7 @@ GenerateThraddash_generateEnergy (SOLARSYS_STATE *solarSys,
|
||||
return true;
|
||||
}
|
||||
|
||||
old_rand = TFB_SeedRandom (
|
||||
solarSys->SysInfo.PlanetInfo.ScanSeed[ENERGY_SCAN]);
|
||||
|
||||
GenerateRandomLocation (&solarSys->SysInfo);
|
||||
solarSys->SysInfo.PlanetInfo.CurDensity = 0;
|
||||
solarSys->SysInfo.PlanetInfo.CurType = 0;
|
||||
|
||||
*whichNode = 1; // only matters when count is requested
|
||||
GenerateDefault_generateArtifact (solarSys, whichNode);
|
||||
|
||||
if (isNodeRetrieved (&solarSys->SysInfo.PlanetInfo, ENERGY_SCAN, 0))
|
||||
{
|
||||
@@ -191,9 +184,11 @@ GenerateThraddash_generateEnergy (SOLARSYS_STATE *solarSys,
|
||||
SET_GAME_STATE (AQUA_HELIX, 1);
|
||||
SET_GAME_STATE (AQUA_HELIX_ON_SHIP, 1);
|
||||
SET_GAME_STATE (HELIX_UNPROTECTED, 1);
|
||||
|
||||
GenerateDefault_landerReport (solarSys);
|
||||
SetLanderTakeoff ();
|
||||
}
|
||||
|
||||
TFB_SeedRandom (old_rand);
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
@@ -17,6 +17,7 @@
|
||||
*/
|
||||
|
||||
#include "genall.h"
|
||||
#include "../lander.h"
|
||||
#include "../planets.h"
|
||||
#include "../scan.h"
|
||||
#include "../../build.h"
|
||||
@@ -209,12 +210,11 @@ static bool
|
||||
GenerateUtwig_generateEnergy (SOLARSYS_STATE *solarSys, PLANET_DESC *world,
|
||||
COUNT *whichNode)
|
||||
{
|
||||
DWORD old_rand;
|
||||
|
||||
if (CurStarDescPtr->Index == UTWIG_DEFINED
|
||||
&& matchWorld (solarSys, world, 0, MATCH_PLANET))
|
||||
{
|
||||
GenerateRandomRuins (&solarSys->SysInfo, 1, whichNode);
|
||||
GenerateDefault_generateRuins (solarSys, whichNode);
|
||||
GenerateDefault_pickupRuins (solarSys, NULL);
|
||||
return true;
|
||||
}
|
||||
|
||||
@@ -227,14 +227,7 @@ GenerateUtwig_generateEnergy (SOLARSYS_STATE *solarSys, PLANET_DESC *world,
|
||||
return true;
|
||||
}
|
||||
|
||||
old_rand = TFB_SeedRandom (
|
||||
solarSys->SysInfo.PlanetInfo.ScanSeed[ENERGY_SCAN]);
|
||||
|
||||
GenerateRandomLocation (&solarSys->SysInfo);
|
||||
solarSys->SysInfo.PlanetInfo.CurDensity = 0;
|
||||
solarSys->SysInfo.PlanetInfo.CurType = 0;
|
||||
|
||||
*whichNode = 1; // only matters when count is requested
|
||||
GenerateDefault_generateArtifact (solarSys, whichNode);
|
||||
|
||||
if (isNodeRetrieved (&solarSys->SysInfo.PlanetInfo, ENERGY_SCAN, 0))
|
||||
{
|
||||
@@ -243,9 +236,11 @@ GenerateUtwig_generateEnergy (SOLARSYS_STATE *solarSys, PLANET_DESC *world,
|
||||
SET_GAME_STATE (DRUUGE_MANNER, 1);
|
||||
SET_GAME_STATE (DRUUGE_VISITS, 0);
|
||||
SET_GAME_STATE (DRUUGE_HOME_VISITS, 0);
|
||||
|
||||
GenerateDefault_landerReport (solarSys);
|
||||
SetLanderTakeoff ();
|
||||
}
|
||||
|
||||
TFB_SeedRandom (old_rand);
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
@@ -80,42 +80,40 @@ GenerateVault_generateEnergy (SOLARSYS_STATE *solarSys, PLANET_DESC *world,
|
||||
{
|
||||
if (matchWorld (solarSys, world, 0, 0))
|
||||
{
|
||||
DWORD old_rand;
|
||||
PLANET_INFO *planetInfo = &solarSys->SysInfo.PlanetInfo;
|
||||
|
||||
old_rand = TFB_SeedRandom (
|
||||
solarSys->SysInfo.PlanetInfo.ScanSeed[ENERGY_SCAN]);
|
||||
GenerateDefault_generateArtifact (solarSys, whichNode);
|
||||
|
||||
GenerateRandomLocation (&solarSys->SysInfo);
|
||||
solarSys->SysInfo.PlanetInfo.CurDensity = 0;
|
||||
if (!GET_GAME_STATE (SHIP_VAULT_UNLOCKED))
|
||||
solarSys->SysInfo.PlanetInfo.CurType = 0;
|
||||
else
|
||||
solarSys->SysInfo.PlanetInfo.CurType = 1;
|
||||
|
||||
// This node is always present, even after it is "picked up".
|
||||
*whichNode = 1; // only matters when count is requested
|
||||
|
||||
if (isNodeRetrieved (&solarSys->SysInfo.PlanetInfo, ENERGY_SCAN, 0))
|
||||
if (isNodeRetrieved (planetInfo, ENERGY_SCAN, 0))
|
||||
{
|
||||
// Retrieval status is cleared to keep the node on the map
|
||||
setNodeNotRetrieved (&solarSys->SysInfo.PlanetInfo, ENERGY_SCAN, 0);
|
||||
setNodeNotRetrieved (planetInfo, ENERGY_SCAN, 0);
|
||||
|
||||
if (GET_GAME_STATE (SYREEN_SHUTTLE_ON_SHIP))
|
||||
if (GET_GAME_STATE (SHIP_VAULT_UNLOCKED))
|
||||
{ // Give the final report, "omg empty" and whatnot
|
||||
GenerateDefault_landerReportCycle (solarSys);
|
||||
}
|
||||
else if (GET_GAME_STATE (SYREEN_SHUTTLE_ON_SHIP))
|
||||
{
|
||||
GenerateDefault_landerReportCycle (solarSys);
|
||||
SetLanderTakeoff ();
|
||||
|
||||
SET_GAME_STATE (SHIP_VAULT_UNLOCKED, 1);
|
||||
SET_GAME_STATE (SYREEN_SHUTTLE_ON_SHIP, 0);
|
||||
SET_GAME_STATE (SYREEN_HOME_VISITS, 0);
|
||||
}
|
||||
else if (!GET_GAME_STATE (KNOW_SYREEN_VAULT))
|
||||
else
|
||||
{
|
||||
SET_GAME_STATE (KNOW_SYREEN_VAULT, 1);
|
||||
SET_GAME_STATE (SYREEN_HOME_VISITS, 0);
|
||||
GenerateDefault_landerReport (solarSys);
|
||||
|
||||
if (!GET_GAME_STATE (KNOW_SYREEN_VAULT))
|
||||
{
|
||||
SET_GAME_STATE (KNOW_SYREEN_VAULT, 1);
|
||||
SET_GAME_STATE (SYREEN_HOME_VISITS, 0);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
TFB_SeedRandom (old_rand);
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
@@ -218,13 +218,14 @@ GenerateVux_generateEnergy (SOLARSYS_STATE *solarSys, PLANET_DESC *world,
|
||||
|
||||
solarSys->SysInfo.PlanetInfo.CurPt.x = MAP_WIDTH / 3;
|
||||
solarSys->SysInfo.PlanetInfo.CurPt.y = MAP_HEIGHT * 5 / 8;
|
||||
solarSys->SysInfo.PlanetInfo.CurDensity = 0;
|
||||
solarSys->SysInfo.PlanetInfo.CurType = 0;
|
||||
|
||||
*whichNode = 1; // only matters when count is requested
|
||||
|
||||
if (isNodeRetrieved (&solarSys->SysInfo.PlanetInfo, ENERGY_SCAN, 0))
|
||||
{
|
||||
GenerateDefault_landerReport (solarSys);
|
||||
SetLanderTakeoff ();
|
||||
|
||||
SET_GAME_STATE (SHOFIXTI_MAIDENS, 1);
|
||||
SET_GAME_STATE (MAIDENS_ON_SHIP, 1);
|
||||
}
|
||||
@@ -235,7 +236,8 @@ GenerateVux_generateEnergy (SOLARSYS_STATE *solarSys, PLANET_DESC *world,
|
||||
if (CurStarDescPtr->Index == VUX_DEFINED
|
||||
&& matchWorld (solarSys, world, 0, MATCH_PLANET))
|
||||
{
|
||||
GenerateRandomRuins (&solarSys->SysInfo, 1, whichNode);
|
||||
GenerateDefault_generateRuins (solarSys, whichNode);
|
||||
GenerateDefault_pickupRuins (solarSys, NULL);
|
||||
return true;
|
||||
}
|
||||
|
||||
@@ -300,9 +302,7 @@ GenerateVux_generateLife (SOLARSYS_STATE *solarSys, PLANET_DESC *world,
|
||||
if (isNodeRetrieved (&solarSys->SysInfo.PlanetInfo, BIOLOGICAL_SCAN, 0)
|
||||
&& !GET_GAME_STATE (VUX_BEAST))
|
||||
{ // Picked up Zex' Beauty
|
||||
UnbatchGraphics ();
|
||||
DoDiscoveryReport (MenuSounds);
|
||||
BatchGraphics ();
|
||||
GenerateDefault_landerReport (solarSys);
|
||||
SetLanderTakeoff ();
|
||||
|
||||
SET_GAME_STATE (VUX_BEAST, 1);
|
||||
|
||||
@@ -57,7 +57,7 @@ GenerateWreck_generateOrbital (SOLARSYS_STATE *solarSys, PLANET_DESC *world)
|
||||
solarSys->SysInfo.PlanetInfo.DiscoveryString =
|
||||
CaptureStringTable (LoadStringTable (WRECK_STRTAB));
|
||||
if (GET_GAME_STATE (PORTAL_KEY))
|
||||
{
|
||||
{ // Already picked it up, skip the first report
|
||||
solarSys->SysInfo.PlanetInfo.DiscoveryString =
|
||||
SetAbsStringTableIndex (
|
||||
solarSys->SysInfo.PlanetInfo.DiscoveryString, 1);
|
||||
@@ -74,26 +74,15 @@ GenerateWreck_generateEnergy (SOLARSYS_STATE *solarSys, PLANET_DESC *world,
|
||||
{
|
||||
if (matchWorld (solarSys, world, 6, MATCH_PLANET))
|
||||
{
|
||||
DWORD old_rand;
|
||||
|
||||
old_rand = TFB_SeedRandom (
|
||||
solarSys->SysInfo.PlanetInfo.ScanSeed[ENERGY_SCAN]);
|
||||
|
||||
GenerateRandomLocation (&solarSys->SysInfo);
|
||||
solarSys->SysInfo.PlanetInfo.CurDensity = 0;
|
||||
if (!GET_GAME_STATE (PORTAL_KEY))
|
||||
solarSys->SysInfo.PlanetInfo.CurType = 0;
|
||||
else
|
||||
solarSys->SysInfo.PlanetInfo.CurType = 1;
|
||||
|
||||
// This node is always present, even after it is "picked up".
|
||||
*whichNode = 1; // only matters when count is requested
|
||||
GenerateDefault_generateArtifact (solarSys, whichNode);
|
||||
|
||||
if (isNodeRetrieved (&solarSys->SysInfo.PlanetInfo, ENERGY_SCAN, 0))
|
||||
{
|
||||
// Retrieval status is cleared to keep the node on the map
|
||||
setNodeNotRetrieved (&solarSys->SysInfo.PlanetInfo, ENERGY_SCAN, 0);
|
||||
|
||||
GenerateDefault_landerReportCycle (solarSys);
|
||||
|
||||
if (!GET_GAME_STATE (PORTAL_KEY))
|
||||
{
|
||||
SetLanderTakeoff ();
|
||||
@@ -103,7 +92,6 @@ GenerateWreck_generateEnergy (SOLARSYS_STATE *solarSys, PLANET_DESC *world,
|
||||
}
|
||||
}
|
||||
|
||||
TFB_SeedRandom (old_rand);
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
@@ -113,7 +113,8 @@ GenerateYehat_generateEnergy (SOLARSYS_STATE *solarSys, PLANET_DESC *world,
|
||||
{
|
||||
if (matchWorld (solarSys, world, 0, MATCH_PLANET))
|
||||
{
|
||||
GenerateRandomRuins (&solarSys->SysInfo, 1, whichNode);
|
||||
GenerateDefault_generateRuins (solarSys, whichNode);
|
||||
GenerateDefault_pickupRuins (solarSys, NULL);
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
@@ -143,7 +143,8 @@ GenerateZoqFotPik_generateEnergy (SOLARSYS_STATE *solarSys, PLANET_DESC *world,
|
||||
{
|
||||
if (matchWorld (solarSys, world, 0, MATCH_PLANET))
|
||||
{
|
||||
GenerateRandomRuins (&solarSys->SysInfo, 1, whichNode);
|
||||
GenerateDefault_generateRuins (solarSys, whichNode);
|
||||
GenerateDefault_pickupRuins (solarSys, NULL);
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
@@ -745,39 +745,7 @@ CheckObjectCollision (COUNT index)
|
||||
}
|
||||
else if (scan == ENERGY_SCAN)
|
||||
{
|
||||
if (ElementPtr->mass_points == 1)
|
||||
{
|
||||
#define FWIFFO_FRAGS 8
|
||||
DWORD TimeIn;
|
||||
int i;
|
||||
|
||||
/* Ran into Spathi on Pluto */
|
||||
TimeIn = GetTimeCounter ();
|
||||
for (i = 0; i < FWIFFO_FRAGS && crew_left; ++i)
|
||||
{
|
||||
DeltaLanderCrew (-1, LANDER_INJURED);
|
||||
SleepThreadUntil (TimeIn + ONE_SECOND / 20);
|
||||
TimeIn = GetTimeCounter();
|
||||
}
|
||||
}
|
||||
|
||||
if (crew_left
|
||||
&& pSolarSysState->SysInfo.PlanetInfo.DiscoveryString
|
||||
&& CurStarDescPtr->Index != ANDROSYNTH_DEFINED)
|
||||
{
|
||||
UnbatchGraphics ();
|
||||
DoDiscoveryReport (MenuSounds);
|
||||
BatchGraphics ();
|
||||
}
|
||||
if (ElementPtr->mass_points == 0)
|
||||
{
|
||||
DestroyStringTable (ReleaseStringTable (
|
||||
pSolarSysState->SysInfo.PlanetInfo.DiscoveryString
|
||||
));
|
||||
pSolarSysState->SysInfo.PlanetInfo.DiscoveryString = 0;
|
||||
UnlockElement (hElement);
|
||||
continue;
|
||||
}
|
||||
// noop; handled by generation funcs, see below
|
||||
}
|
||||
else if (scan == BIOLOGICAL_SCAN && ElementPtr->hit_points)
|
||||
{
|
||||
@@ -865,24 +833,11 @@ CheckObjectCollision (COUNT index)
|
||||
pSolarSysState->pOrbitalDesc,
|
||||
&allNodes, scan);
|
||||
|
||||
if (!isNodeRetrieved (&pSolarSysState->SysInfo.PlanetInfo, scan,
|
||||
// Generation func above may reset the retrieved status bit
|
||||
// to keep the node on the map
|
||||
if (isNodeRetrieved (&pSolarSysState->SysInfo.PlanetInfo, scan,
|
||||
which_node))
|
||||
{
|
||||
/* If our discovery strings have cycled, we're done */
|
||||
if (GetStringTableIndex (
|
||||
pSolarSysState->SysInfo.PlanetInfo.DiscoveryString) == 0)
|
||||
{
|
||||
if (DestroyStringTable (ReleaseStringTable (
|
||||
pSolarSysState->SysInfo.PlanetInfo.DiscoveryString
|
||||
)))
|
||||
pSolarSysState->SysInfo.PlanetInfo.DiscoveryString = 0;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
if (NumRetrieved && scan == ENERGY_SCAN)
|
||||
pPSD->InTransit = TRUE;
|
||||
|
||||
SET_GAME_STATE (PLANETARY_CHANGE, 1);
|
||||
ElementPtr->state_flags |= DISAPPEARING;
|
||||
}
|
||||
@@ -1892,6 +1847,24 @@ SetLanderTakeoff (void)
|
||||
planetSideDesc->InTransit = TRUE;
|
||||
}
|
||||
|
||||
// Returns whether the lander is still alive at the end of the sequence
|
||||
bool
|
||||
KillLanderCrewSeq (COUNT numKilled, DWORD period)
|
||||
{
|
||||
TimeCount TimeOut;
|
||||
COUNT i;
|
||||
|
||||
TimeOut = GetTimeCounter ();
|
||||
for (i = 0; i < numKilled && crew_left; ++i)
|
||||
{
|
||||
TimeOut += period;
|
||||
DeltaLanderCrew (-1, LANDER_INJURED);
|
||||
SleepThreadUntil (TimeOut);
|
||||
}
|
||||
|
||||
return crew_left > 0;
|
||||
}
|
||||
|
||||
void
|
||||
PlanetSide (POINT planetLoc)
|
||||
{
|
||||
|
||||
@@ -67,6 +67,7 @@ extern void FreeLanderData (void);
|
||||
extern void object_animation (ELEMENT *ElementPtr);
|
||||
|
||||
extern void SetLanderTakeoff (void);
|
||||
extern bool KillLanderCrewSeq (COUNT numKilled, DWORD period);
|
||||
|
||||
// ELEMENT.playerNr constants
|
||||
enum
|
||||
|
||||
@@ -293,9 +293,7 @@ typedef struct
|
||||
// NUM_CREATURE_TYPES is an Evil One
|
||||
// NUM_CREATURE_TYPES + 1 is a Brainbox Bulldozer
|
||||
// NUM_CREATURE_TYPES + 2 is Zex' Beauty
|
||||
// For energy: 0 - Liftoff on collision
|
||||
// 1 - No liftoff on collision
|
||||
// 2 - (special case) Fwiffo
|
||||
// For energy: undefined
|
||||
|
||||
STRING DiscoveryString;
|
||||
FONT LanderFont;
|
||||
|
||||
@@ -82,6 +82,8 @@ enum
|
||||
// XXX: -9 to match the original, but why? I have no idea
|
||||
#define PLANET_ORG_Y ((SCAN_SCREEN_HEIGHT - 9) / 2)
|
||||
|
||||
#define NUM_RACE_RUINS 16
|
||||
|
||||
typedef struct planet_desc PLANET_DESC;
|
||||
typedef struct star_desc STAR_DESC;
|
||||
typedef struct planet_orbit PLANET_ORBIT;
|
||||
|
||||
@@ -1396,17 +1396,7 @@ GeneratePlanetSide (void)
|
||||
NodeElementPtr->preprocess_func = object_animation;
|
||||
if (scan == ENERGY_SCAN)
|
||||
{
|
||||
if (pSolarSysState->SysInfo.PlanetInfo.CurType == 1)
|
||||
{
|
||||
NodeElementPtr->mass_points = 0;
|
||||
}
|
||||
else if (pSolarSysState->SysInfo.PlanetInfo.CurType == 2)
|
||||
{
|
||||
// Special case: Fwiffo
|
||||
NodeElementPtr->mass_points = 1;
|
||||
}
|
||||
else
|
||||
NodeElementPtr->mass_points = MAX_SCROUNGED;
|
||||
NodeElementPtr->mass_points = MAX_SCROUNGED;
|
||||
DisplayArray[NodeElementPtr->PrimIndex].Object.Stamp.frame =
|
||||
pSolarSysState->PlanetSideFrame[1];
|
||||
}
|
||||
|
||||
@@ -46,7 +46,6 @@ extern DWORD GenerateLifeForms (SYSTEM_INFO *SysInfoPtr, COUNT *pwhich_life);
|
||||
extern void GenerateRandomLocation (SYSTEM_INFO *);
|
||||
extern DWORD GenerateRandomNodes (SYSTEM_INFO *, COUNT scan, COUNT numNodes,
|
||||
COUNT type, COUNT *whichNode);
|
||||
extern DWORD GenerateRandomRuins (SYSTEM_INFO *, COUNT type, COUNT *whichNode);
|
||||
|
||||
#define DWARF_ELEMENT_DENSITY 1
|
||||
#define GIANT_ELEMENT_DENSITY 3
|
||||
|
||||
@@ -268,7 +268,9 @@ GenerateRandomNodes (SYSTEM_INFO *SysInfoPtr, COUNT scan, COUNT numNodes,
|
||||
for (i = 0; i < numNodes; ++i)
|
||||
{
|
||||
GenerateRandomLocation (SysInfoPtr);
|
||||
// CurType is irrelevant for energy nodes
|
||||
SysInfoPtr->PlanetInfo.CurType = type;
|
||||
// CurDensity is irrelevant for energy and bio nodes
|
||||
SysInfoPtr->PlanetInfo.CurDensity = 0;
|
||||
|
||||
if (i >= *whichNode)
|
||||
@@ -279,9 +281,3 @@ GenerateRandomNodes (SYSTEM_INFO *SysInfoPtr, COUNT scan, COUNT numNodes,
|
||||
|
||||
return (TFB_SeedRandom (old_rand));
|
||||
}
|
||||
|
||||
DWORD
|
||||
GenerateRandomRuins (SYSTEM_INFO *SysInfoPtr, COUNT type, COUNT *whichNode)
|
||||
{
|
||||
return GenerateRandomNodes (SysInfoPtr, ENERGY_SCAN, 16, type, whichNode);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user