Use isNodeRetrieved(), setNodeRetrieved(), and setNodeNotRetrieved()

git-svn-id: svn://svn.code.sf.net/p/sc2/code/trunk@3581 8092fc87-c524-0410-9efc-e669fe64eaf9
This commit is contained in:
avolkov
2011-04-21 21:27:18 +00:00
parent 9cdd69fe46
commit 717a49ff6c
16 changed files with 116 additions and 97 deletions
-2
View File
@@ -43,8 +43,6 @@ typedef struct GenerateFunctions GenerateFunctions;
* solarSys->genFuncs->..., but use a function for this, which first * solarSys->genFuncs->..., but use a function for this, which first
* checks for solar system dependent handlers, and if this does not exist, * checks for solar system dependent handlers, and if this does not exist,
* or returns false, calls the default function. * or returns false, calls the default function.
* - use isNodeRetrieved, setNodeRetrieved, and setNodeNotRetrieved instead
* of manually messing with bit shifts, etc.
*/ */
// Any of these functions returning true means that the action has been // Any of these functions returning true means that the action has been
+29 -23
View File
@@ -19,6 +19,7 @@
#include "genall.h" #include "genall.h"
#include "../lander.h" #include "../lander.h"
#include "../planets.h" #include "../planets.h"
#include "../scan.h"
#include "../../globdata.h" #include "../../globdata.h"
#include "../../nameref.h" #include "../../nameref.h"
#include "../../resinst.h" #include "../../resinst.h"
@@ -71,7 +72,8 @@ GenerateAndrosynth_generateOrbital (SOLARSYS_STATE *solarSys, PLANET_DESC *world
{ {
if (matchWorld (solarSys, world, 1, MATCH_PLANET)) if (matchWorld (solarSys, world, 1, MATCH_PLANET))
{ {
UWORD retval; COUNT i;
COUNT visits = 0;
LoadStdLanderFont (&solarSys->SysInfo.PlanetInfo); LoadStdLanderFont (&solarSys->SysInfo.PlanetInfo);
solarSys->PlanetSideFrame[1] = solarSys->PlanetSideFrame[1] =
@@ -79,25 +81,28 @@ GenerateAndrosynth_generateOrbital (SOLARSYS_STATE *solarSys, PLANET_DESC *world
solarSys->SysInfo.PlanetInfo.DiscoveryString = solarSys->SysInfo.PlanetInfo.DiscoveryString =
CaptureStringTable ( CaptureStringTable (
LoadStringTable (ANDROSYNTH_RUINS_STRTAB)); LoadStringTable (ANDROSYNTH_RUINS_STRTAB));
retval = HIWORD ( // Androsynth ruins are a special case. The DiscoveryString contains
solarSys->SysInfo.PlanetInfo.ScanRetrieveMask[ENERGY_SCAN]); // several lander reports which form a story. Each report is given
while (retval) // when the player collides with a new city ruin. Ruins previously
{ // visited are marked in the upper 16 bits of ScanRetrieveMask, and
if (retval & 1) // the lower bits are cleared to keep the ruin nodes on the map.
{ for (i = 16; i < 32; ++i)
solarSys->SysInfo.PlanetInfo.DiscoveryString =
SetRelStringTableIndex (
solarSys->SysInfo.PlanetInfo.DiscoveryString, 1);
if (GetStringTableIndex (
solarSys->SysInfo.PlanetInfo.DiscoveryString) == 0)
{ {
if (isNodeRetrieved (&solarSys->SysInfo.PlanetInfo, ENERGY_SCAN, i))
++visits;
}
if (visits >= GetStringTableCount (
solarSys->SysInfo.PlanetInfo.DiscoveryString))
{ // All the reports were already given
DestroyStringTable (ReleaseStringTable ( DestroyStringTable (ReleaseStringTable (
solarSys->SysInfo.PlanetInfo.DiscoveryString)); solarSys->SysInfo.PlanetInfo.DiscoveryString));
solarSys->SysInfo.PlanetInfo.DiscoveryString = 0; solarSys->SysInfo.PlanetInfo.DiscoveryString = 0;
} }
} else
{ // Advance the report sequence to the first unread
retval >>= 1; solarSys->SysInfo.PlanetInfo.DiscoveryString =
SetRelStringTableIndex (
solarSys->SysInfo.PlanetInfo.DiscoveryString, visits);
} }
} }
@@ -139,23 +144,24 @@ GenerateAndrosynth_generateEnergy (SOLARSYS_STATE *solarSys, PLANET_DESC *world,
solarSys->SysInfo.PlanetInfo.CurType = 0; solarSys->SysInfo.PlanetInfo.CurType = 0;
solarSys->SysInfo.PlanetInfo.CurDensity = 0; solarSys->SysInfo.PlanetInfo.CurDensity = 0;
if (solarSys->SysInfo.PlanetInfo.ScanRetrieveMask[ENERGY_SCAN] if (isNodeRetrieved (&solarSys->SysInfo.PlanetInfo, ENERGY_SCAN, i))
& (1L << i))
{ {
solarSys->SysInfo.PlanetInfo.ScanRetrieveMask[ENERGY_SCAN] // Retrieval status is cleared to keep the node on the map
&= ~(1L << i); setNodeNotRetrieved (&solarSys->SysInfo.PlanetInfo, ENERGY_SCAN, i);
if (!(solarSys->SysInfo.PlanetInfo.ScanRetrieveMask[ENERGY_SCAN] // Ruins previously visited are marked in the upper 16 bits
& (1L << (i + 16)))) if (!isNodeRetrieved (&solarSys->SysInfo.PlanetInfo, ENERGY_SCAN,
i + 16))
{ {
SET_GAME_STATE (PLANETARY_CHANGE, 1); SET_GAME_STATE (PLANETARY_CHANGE, 1);
solarSys->SysInfo.PlanetInfo.ScanRetrieveMask[ENERGY_SCAN] setNodeRetrieved (&solarSys->SysInfo.PlanetInfo, ENERGY_SCAN,
|= (1L << (i + 16)); i + 16);
if (solarSys->SysInfo.PlanetInfo.DiscoveryString) if (solarSys->SysInfo.PlanetInfo.DiscoveryString)
{ {
UnbatchGraphics (); UnbatchGraphics ();
DoDiscoveryReport (MenuSounds); DoDiscoveryReport (MenuSounds);
BatchGraphics (); BatchGraphics ();
// Advance to the next report
solarSys->SysInfo.PlanetInfo.DiscoveryString = solarSys->SysInfo.PlanetInfo.DiscoveryString =
SetRelStringTableIndex ( SetRelStringTableIndex (
solarSys->SysInfo.PlanetInfo.DiscoveryString, solarSys->SysInfo.PlanetInfo.DiscoveryString,
+3 -4
View File
@@ -18,6 +18,7 @@
#include "genall.h" #include "genall.h"
#include "../planets.h" #include "../planets.h"
#include "../scan.h"
#include "../../globdata.h" #include "../../globdata.h"
#include "../../nameref.h" #include "../../nameref.h"
#include "../../resinst.h" #include "../../resinst.h"
@@ -179,8 +180,7 @@ GenerateBurvixese_generateEnergy (SOLARSYS_STATE *solarSys, PLANET_DESC *world,
(HIBYTE (LOWORD (rand_val)) % (MAP_HEIGHT - (8 << 1))) + 8; (HIBYTE (LOWORD (rand_val)) % (MAP_HEIGHT - (8 << 1))) + 8;
solarSys->SysInfo.PlanetInfo.CurDensity = 0; solarSys->SysInfo.PlanetInfo.CurDensity = 0;
solarSys->SysInfo.PlanetInfo.CurType = 0; solarSys->SysInfo.PlanetInfo.CurType = 0;
if (!(solarSys->SysInfo.PlanetInfo.ScanRetrieveMask[ENERGY_SCAN] if (!isNodeRetrieved (&solarSys->SysInfo.PlanetInfo, ENERGY_SCAN, 0)
& (1L << 0))
&& *whichNode == (COUNT)~0) && *whichNode == (COUNT)~0)
{ {
*whichNode = 1; *whichNode = 1;
@@ -188,8 +188,7 @@ GenerateBurvixese_generateEnergy (SOLARSYS_STATE *solarSys, PLANET_DESC *world,
else else
{ {
*whichNode = 0; *whichNode = 0;
if (solarSys->SysInfo.PlanetInfo.ScanRetrieveMask[ENERGY_SCAN] if (isNodeRetrieved (&solarSys->SysInfo.PlanetInfo, ENERGY_SCAN, 0))
& (1L << 0))
{ {
SET_GAME_STATE (BURVIXESE_BROADCASTERS, 1); SET_GAME_STATE (BURVIXESE_BROADCASTERS, 1);
SET_GAME_STATE (BURV_BROADCASTERS_ON_SHIP, 1); SET_GAME_STATE (BURV_BROADCASTERS_ON_SHIP, 1);
+6 -4
View File
@@ -19,6 +19,7 @@
#include "genall.h" #include "genall.h"
#include "../lander.h" #include "../lander.h"
#include "../planets.h" #include "../planets.h"
#include "../scan.h"
#include "../../build.h" #include "../../build.h"
#include "../../comm.h" #include "../../comm.h"
#include "../../globdata.h" #include "../../globdata.h"
@@ -149,11 +150,11 @@ GenerateDruuge_generateEnergy (SOLARSYS_STATE *solarSys, PLANET_DESC *world,
else else
solarSys->SysInfo.PlanetInfo.CurType = 1; solarSys->SysInfo.PlanetInfo.CurType = 1;
solarSys->SysInfo.PlanetInfo.CurDensity = 0; solarSys->SysInfo.PlanetInfo.CurDensity = 0;
if (solarSys->SysInfo.PlanetInfo.ScanRetrieveMask[ENERGY_SCAN]
& (1L << i)) if (isNodeRetrieved (&solarSys->SysInfo.PlanetInfo, ENERGY_SCAN, i))
{ {
solarSys->SysInfo.PlanetInfo.ScanRetrieveMask[ENERGY_SCAN] // Retrieval status is cleared to keep the node on the map
&= ~(1L << i); setNodeNotRetrieved (&solarSys->SysInfo.PlanetInfo, ENERGY_SCAN, i);
if (!GET_GAME_STATE (ROSY_SPHERE)) if (!GET_GAME_STATE (ROSY_SPHERE))
{ {
@@ -163,6 +164,7 @@ GenerateDruuge_generateEnergy (SOLARSYS_STATE *solarSys, PLANET_DESC *world,
SET_GAME_STATE (ROSY_SPHERE_ON_SHIP, 1); SET_GAME_STATE (ROSY_SPHERE_ON_SHIP, 1);
} }
} }
if (i >= *whichNode) if (i >= *whichNode)
break; break;
} }
+7 -10
View File
@@ -18,6 +18,7 @@
#include "genall.h" #include "genall.h"
#include "../planets.h" #include "../planets.h"
#include "../scan.h"
#include "../../build.h" #include "../../build.h"
#include "../../comm.h" #include "../../comm.h"
#include "../../encount.h" #include "../../encount.h"
@@ -161,8 +162,8 @@ GenerateMycon_generateOrbital (SOLARSYS_STATE *solarSys, PLANET_DESC *world)
if (GET_GAME_STATE (KNOW_ABOUT_SHATTERED) == 0) if (GET_GAME_STATE (KNOW_ABOUT_SHATTERED) == 0)
SET_GAME_STATE (KNOW_ABOUT_SHATTERED, 1); SET_GAME_STATE (KNOW_ABOUT_SHATTERED, 1);
if (!(solarSys->SysInfo.PlanetInfo.ScanRetrieveMask[ENERGY_SCAN] if (!isNodeRetrieved (&solarSys->SysInfo.PlanetInfo,
& (1L << 0))) ENERGY_SCAN, 0))
{ {
LoadStdLanderFont (&solarSys->SysInfo.PlanetInfo); LoadStdLanderFont (&solarSys->SysInfo.PlanetInfo);
solarSys->PlanetSideFrame[1] = solarSys->PlanetSideFrame[1] =
@@ -202,8 +203,7 @@ GenerateMycon_generateEnergy (SOLARSYS_STATE *solarSys, PLANET_DESC *world,
solarSys->SysInfo.PlanetInfo.CurType = 0; solarSys->SysInfo.PlanetInfo.CurType = 0;
if (CurStarDescPtr->Index == SUN_DEVICE_DEFINED) if (CurStarDescPtr->Index == SUN_DEVICE_DEFINED)
{ {
if (!(solarSys->SysInfo.PlanetInfo.ScanRetrieveMask[ENERGY_SCAN] if (!isNodeRetrieved (&solarSys->SysInfo.PlanetInfo, ENERGY_SCAN, 0)
& (1L << 0))
&& *whichNode == (COUNT)~0) && *whichNode == (COUNT)~0)
{ {
*whichNode = 1; *whichNode = 1;
@@ -211,8 +211,7 @@ GenerateMycon_generateEnergy (SOLARSYS_STATE *solarSys, PLANET_DESC *world,
else else
{ {
*whichNode = 0; *whichNode = 0;
if (solarSys->SysInfo.PlanetInfo.ScanRetrieveMask[ENERGY_SCAN] if (isNodeRetrieved (&solarSys->SysInfo.PlanetInfo, ENERGY_SCAN, 0))
& (1L << 0))
{ {
SET_GAME_STATE (SUN_DEVICE, 1); SET_GAME_STATE (SUN_DEVICE, 1);
SET_GAME_STATE (SUN_DEVICE_ON_SHIP, 1); SET_GAME_STATE (SUN_DEVICE_ON_SHIP, 1);
@@ -222,8 +221,7 @@ GenerateMycon_generateEnergy (SOLARSYS_STATE *solarSys, PLANET_DESC *world,
} }
else else
{ {
if (!(solarSys->SysInfo.PlanetInfo.ScanRetrieveMask[ENERGY_SCAN] if (!isNodeRetrieved (&solarSys->SysInfo.PlanetInfo, ENERGY_SCAN, 0)
& (1L << 0))
&& *whichNode == (COUNT)~0) && *whichNode == (COUNT)~0)
{ {
*whichNode = 1; *whichNode = 1;
@@ -233,8 +231,7 @@ GenerateMycon_generateEnergy (SOLARSYS_STATE *solarSys, PLANET_DESC *world,
*whichNode = 0; *whichNode = 0;
// XXX: Why does this also test the PlanetInfo.DiscoveryString? // XXX: Why does this also test the PlanetInfo.DiscoveryString?
// No other similar code ever tests the DiscoveryString. // No other similar code ever tests the DiscoveryString.
if ((solarSys->SysInfo.PlanetInfo.ScanRetrieveMask[ENERGY_SCAN] if (isNodeRetrieved (&solarSys->SysInfo.PlanetInfo, ENERGY_SCAN, 0)
& (1L << 0))
&& solarSys->SysInfo.PlanetInfo.DiscoveryString) && solarSys->SysInfo.PlanetInfo.DiscoveryString)
{ {
switch (CurStarDescPtr->Index) switch (CurStarDescPtr->Index)
+3 -4
View File
@@ -18,6 +18,7 @@
#include "genall.h" #include "genall.h"
#include "../planets.h" #include "../planets.h"
#include "../scan.h"
#include "../../build.h" #include "../../build.h"
#include "../../comm.h" #include "../../comm.h"
#include "../../encount.h" #include "../../encount.h"
@@ -181,8 +182,7 @@ GenerateOrz_generateEnergy (SOLARSYS_STATE *solarSys, PLANET_DESC *world,
(HIBYTE (LOWORD (rand_val)) % (MAP_HEIGHT - (8 << 1))) + 8; (HIBYTE (LOWORD (rand_val)) % (MAP_HEIGHT - (8 << 1))) + 8;
solarSys->SysInfo.PlanetInfo.CurDensity = 0; solarSys->SysInfo.PlanetInfo.CurDensity = 0;
solarSys->SysInfo.PlanetInfo.CurType = 0; solarSys->SysInfo.PlanetInfo.CurType = 0;
if (!(solarSys->SysInfo.PlanetInfo.ScanRetrieveMask[ENERGY_SCAN] if (!isNodeRetrieved (&solarSys->SysInfo.PlanetInfo, ENERGY_SCAN, 0)
& (1L << 0))
&& *whichNode == (COUNT)~0) && *whichNode == (COUNT)~0)
{ {
*whichNode = 1; *whichNode = 1;
@@ -190,8 +190,7 @@ GenerateOrz_generateEnergy (SOLARSYS_STATE *solarSys, PLANET_DESC *world,
else else
{ {
*whichNode = 0; *whichNode = 0;
if (solarSys->SysInfo.PlanetInfo.ScanRetrieveMask[ENERGY_SCAN] if (isNodeRetrieved (&solarSys->SysInfo.PlanetInfo, ENERGY_SCAN, 0))
& (1L << 0))
{ {
SET_GAME_STATE (TAALO_PROTECTOR, 1); SET_GAME_STATE (TAALO_PROTECTOR, 1);
SET_GAME_STATE (TAALO_PROTECTOR_ON_SHIP, 1); SET_GAME_STATE (TAALO_PROTECTOR_ON_SHIP, 1);
+6 -4
View File
@@ -19,6 +19,7 @@
#include "genall.h" #include "genall.h"
#include "../lander.h" #include "../lander.h"
#include "../planets.h" #include "../planets.h"
#include "../scan.h"
#include "../../build.h" #include "../../build.h"
#include "../../comm.h" #include "../../comm.h"
#include "../../globdata.h" #include "../../globdata.h"
@@ -139,11 +140,11 @@ GeneratePkunk_generateEnergy (SOLARSYS_STATE *solarSys, PLANET_DESC *world,
else else
solarSys->SysInfo.PlanetInfo.CurType = 1; solarSys->SysInfo.PlanetInfo.CurType = 1;
solarSys->SysInfo.PlanetInfo.CurDensity = 0; solarSys->SysInfo.PlanetInfo.CurDensity = 0;
if (solarSys->SysInfo.PlanetInfo.ScanRetrieveMask[ENERGY_SCAN]
& (1L << i)) if (isNodeRetrieved (&solarSys->SysInfo.PlanetInfo, ENERGY_SCAN, i))
{ {
solarSys->SysInfo.PlanetInfo.ScanRetrieveMask[ENERGY_SCAN] // Retrieval status is cleared to keep the node on the map
&= ~(1L << i); setNodeNotRetrieved (&solarSys->SysInfo.PlanetInfo, ENERGY_SCAN, i);
if (!GET_GAME_STATE (CLEAR_SPINDLE)) if (!GET_GAME_STATE (CLEAR_SPINDLE))
{ {
@@ -153,6 +154,7 @@ GeneratePkunk_generateEnergy (SOLARSYS_STATE *solarSys, PLANET_DESC *world,
SET_GAME_STATE (CLEAR_SPINDLE_ON_SHIP, 1); SET_GAME_STATE (CLEAR_SPINDLE_ON_SHIP, 1);
} }
} }
if (i >= *whichNode) if (i >= *whichNode)
break; break;
} }
+11 -8
View File
@@ -20,6 +20,7 @@
#include "../lander.h" #include "../lander.h"
#include "../lifeform.h" #include "../lifeform.h"
#include "../planets.h" #include "../planets.h"
#include "../scan.h"
#include "../../build.h" #include "../../build.h"
#include "../../encount.h" #include "../../encount.h"
#include "../../globdata.h" #include "../../globdata.h"
@@ -521,13 +522,17 @@ GenerateSol_generateEnergy (SOLARSYS_STATE *solarSys, PLANET_DESC *world,
solarSys->SysInfo.PlanetInfo.CurPt.y = MAP_HEIGHT - 8; solarSys->SysInfo.PlanetInfo.CurPt.y = MAP_HEIGHT - 8;
solarSys->SysInfo.PlanetInfo.CurDensity = 0; solarSys->SysInfo.PlanetInfo.CurDensity = 0;
solarSys->SysInfo.PlanetInfo.CurType = 2; solarSys->SysInfo.PlanetInfo.CurType = 2;
if (solarSys->SysInfo.PlanetInfo.ScanRetrieveMask[ENERGY_SCAN] if (isNodeRetrieved (&solarSys->SysInfo.PlanetInfo, ENERGY_SCAN, 0))
& (1L << 0))
{ {
SET_GAME_STATE (FOUND_PLUTO_SPATHI, 1); SET_GAME_STATE (FOUND_PLUTO_SPATHI, 1);
solarSys->SysInfo.PlanetInfo.ScanRetrieveMask[ENERGY_SCAN] // Retrieval status is cleared to keep the node on the map
&= ~(1L << 0); // 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);
SetLanderTakeoff (); SetLanderTakeoff ();
// XXX: This does NOT set *whichNode when the node is
// retrieved. Other similar pieces of code return the node
// count. See just below. AFAICT, the returned value is ignored.
} }
else if (*whichNode == (COUNT)~0) else if (*whichNode == (COUNT)~0)
*whichNode = 1; *whichNode = 1;
@@ -542,8 +547,7 @@ GenerateSol_generateEnergy (SOLARSYS_STATE *solarSys, PLANET_DESC *world,
solarSys->SysInfo.PlanetInfo.CurPt.y = MAP_HEIGHT * 1 / 4; solarSys->SysInfo.PlanetInfo.CurPt.y = MAP_HEIGHT * 1 / 4;
solarSys->SysInfo.PlanetInfo.CurDensity = 0; solarSys->SysInfo.PlanetInfo.CurDensity = 0;
solarSys->SysInfo.PlanetInfo.CurType = 0; solarSys->SysInfo.PlanetInfo.CurType = 0;
if (!(solarSys->SysInfo.PlanetInfo.ScanRetrieveMask[ENERGY_SCAN] if (!isNodeRetrieved (&solarSys->SysInfo.PlanetInfo, ENERGY_SCAN, 0)
& (1L << 0))
&& *whichNode == (COUNT)~0) && *whichNode == (COUNT)~0)
{ {
*whichNode = 1; *whichNode = 1;
@@ -551,8 +555,7 @@ GenerateSol_generateEnergy (SOLARSYS_STATE *solarSys, PLANET_DESC *world,
else else
{ {
*whichNode = 0; *whichNode = 0;
if (solarSys->SysInfo.PlanetInfo.ScanRetrieveMask[ENERGY_SCAN] if (isNodeRetrieved (&solarSys->SysInfo.PlanetInfo, ENERGY_SCAN, 0))
& (1L << 0))
{ {
SET_GAME_STATE (MOONBASE_DESTROYED, 1); SET_GAME_STATE (MOONBASE_DESTROYED, 1);
SET_GAME_STATE (MOONBASE_ON_SHIP, 1); SET_GAME_STATE (MOONBASE_ON_SHIP, 1);
+3 -4
View File
@@ -19,6 +19,7 @@
#include "genall.h" #include "genall.h"
#include "../lifeform.h" #include "../lifeform.h"
#include "../planets.h" #include "../planets.h"
#include "../scan.h"
#include "../../build.h" #include "../../build.h"
#include "../../comm.h" #include "../../comm.h"
#include "../../globdata.h" #include "../../globdata.h"
@@ -209,8 +210,7 @@ GenerateSpathi_generateEnergy (SOLARSYS_STATE *solarSys, PLANET_DESC *world,
(HIBYTE (LOWORD (rand_val)) % (MAP_HEIGHT - (8 << 1))) + 8; (HIBYTE (LOWORD (rand_val)) % (MAP_HEIGHT - (8 << 1))) + 8;
solarSys->SysInfo.PlanetInfo.CurDensity = 0; solarSys->SysInfo.PlanetInfo.CurDensity = 0;
solarSys->SysInfo.PlanetInfo.CurType = 0; solarSys->SysInfo.PlanetInfo.CurType = 0;
if (!(solarSys->SysInfo.PlanetInfo.ScanRetrieveMask[ENERGY_SCAN] if (!isNodeRetrieved (&solarSys->SysInfo.PlanetInfo, ENERGY_SCAN, 0)
& (1L << 0))
&& *whichNode == (COUNT)~0) && *whichNode == (COUNT)~0)
{ {
*whichNode = 1; *whichNode = 1;
@@ -218,8 +218,7 @@ GenerateSpathi_generateEnergy (SOLARSYS_STATE *solarSys, PLANET_DESC *world,
else else
{ {
*whichNode = 0; *whichNode = 0;
if (solarSys->SysInfo.PlanetInfo.ScanRetrieveMask[ENERGY_SCAN] if (isNodeRetrieved (&solarSys->SysInfo.PlanetInfo, ENERGY_SCAN, 0))
& (1L << 0))
{ {
SET_GAME_STATE (UMGAH_BROADCASTERS, 1); SET_GAME_STATE (UMGAH_BROADCASTERS, 1);
SET_GAME_STATE (UMGAH_BROADCASTERS_ON_SHIP, 1); SET_GAME_STATE (UMGAH_BROADCASTERS_ON_SHIP, 1);
+6 -4
View File
@@ -19,6 +19,7 @@
#include "genall.h" #include "genall.h"
#include "../lander.h" #include "../lander.h"
#include "../planets.h" #include "../planets.h"
#include "../scan.h"
#include "../../build.h" #include "../../build.h"
#include "../../comm.h" #include "../../comm.h"
#include "../../globdata.h" #include "../../globdata.h"
@@ -142,11 +143,11 @@ GenerateSupox_generateEnergy (SOLARSYS_STATE *solarSys, PLANET_DESC *world,
else else
solarSys->SysInfo.PlanetInfo.CurType = 1; solarSys->SysInfo.PlanetInfo.CurType = 1;
solarSys->SysInfo.PlanetInfo.CurDensity = 0; solarSys->SysInfo.PlanetInfo.CurDensity = 0;
if (solarSys->SysInfo.PlanetInfo.ScanRetrieveMask[ENERGY_SCAN]
& (1L << i)) if (isNodeRetrieved (&solarSys->SysInfo.PlanetInfo, ENERGY_SCAN, i))
{ {
solarSys->SysInfo.PlanetInfo.ScanRetrieveMask[ENERGY_SCAN] // Retrieval status is cleared to keep the node on the map
&= ~(1L << i); setNodeNotRetrieved (&solarSys->SysInfo.PlanetInfo, ENERGY_SCAN, i);
if (!GET_GAME_STATE (ULTRON_CONDITION)) if (!GET_GAME_STATE (ULTRON_CONDITION))
{ {
@@ -155,6 +156,7 @@ GenerateSupox_generateEnergy (SOLARSYS_STATE *solarSys, PLANET_DESC *world,
SET_GAME_STATE (ULTRON_CONDITION, 1); SET_GAME_STATE (ULTRON_CONDITION, 1);
} }
} }
if (i >= *whichNode) if (i >= *whichNode)
break; break;
} }
+4 -4
View File
@@ -18,6 +18,7 @@
#include "genall.h" #include "genall.h"
#include "../planets.h" #include "../planets.h"
#include "../scan.h"
#include "../../build.h" #include "../../build.h"
#include "../../comm.h" #include "../../comm.h"
#include "../../encount.h" #include "../../encount.h"
@@ -199,16 +200,15 @@ GenerateThraddash_generateEnergy (SOLARSYS_STATE *solarSys,
(HIBYTE (LOWORD (rand_val)) % (MAP_HEIGHT - (8 << 1))) + 8; (HIBYTE (LOWORD (rand_val)) % (MAP_HEIGHT - (8 << 1))) + 8;
solarSys->SysInfo.PlanetInfo.CurDensity = 0; solarSys->SysInfo.PlanetInfo.CurDensity = 0;
solarSys->SysInfo.PlanetInfo.CurType = 0; solarSys->SysInfo.PlanetInfo.CurType = 0;
if (!(solarSys->SysInfo.PlanetInfo.ScanRetrieveMask[ENERGY_SCAN] if (!isNodeRetrieved (&solarSys->SysInfo.PlanetInfo, ENERGY_SCAN, 0)
& (1L << 0)) && *whichNode == (COUNT)~0) && *whichNode == (COUNT)~0)
{ {
*whichNode = 1; *whichNode = 1;
} }
else else
{ {
*whichNode = 0; *whichNode = 0;
if (solarSys->SysInfo.PlanetInfo.ScanRetrieveMask[ENERGY_SCAN] if (isNodeRetrieved (&solarSys->SysInfo.PlanetInfo, ENERGY_SCAN, 0))
& (1L << 0))
{ {
SET_GAME_STATE (HELIX_VISITS, 0); SET_GAME_STATE (HELIX_VISITS, 0);
SET_GAME_STATE (AQUA_HELIX, 1); SET_GAME_STATE (AQUA_HELIX, 1);
+3 -4
View File
@@ -18,6 +18,7 @@
#include "genall.h" #include "genall.h"
#include "../planets.h" #include "../planets.h"
#include "../scan.h"
#include "../../build.h" #include "../../build.h"
#include "../../comm.h" #include "../../comm.h"
#include "../../encount.h" #include "../../encount.h"
@@ -251,8 +252,7 @@ GenerateUtwig_generateEnergy (SOLARSYS_STATE *solarSys, PLANET_DESC *world,
(HIBYTE (LOWORD (rand_val)) % (MAP_HEIGHT - (8 << 1))) + 8; (HIBYTE (LOWORD (rand_val)) % (MAP_HEIGHT - (8 << 1))) + 8;
solarSys->SysInfo.PlanetInfo.CurDensity = 0; solarSys->SysInfo.PlanetInfo.CurDensity = 0;
solarSys->SysInfo.PlanetInfo.CurType = 0; solarSys->SysInfo.PlanetInfo.CurType = 0;
if (!(solarSys->SysInfo.PlanetInfo.ScanRetrieveMask[ENERGY_SCAN] if (!isNodeRetrieved (&solarSys->SysInfo.PlanetInfo, ENERGY_SCAN, 0)
& (1L << 0))
&& *whichNode == (COUNT)~0) && *whichNode == (COUNT)~0)
{ {
*whichNode = 1; *whichNode = 1;
@@ -260,8 +260,7 @@ GenerateUtwig_generateEnergy (SOLARSYS_STATE *solarSys, PLANET_DESC *world,
else else
{ {
*whichNode = 0; *whichNode = 0;
if (solarSys->SysInfo.PlanetInfo.ScanRetrieveMask[ENERGY_SCAN] if (isNodeRetrieved (&solarSys->SysInfo.PlanetInfo, ENERGY_SCAN, 0))
& (1L << 0))
{ {
SET_GAME_STATE (UTWIG_BOMB, 1); SET_GAME_STATE (UTWIG_BOMB, 1);
SET_GAME_STATE (UTWIG_BOMB_ON_SHIP, 1); SET_GAME_STATE (UTWIG_BOMB_ON_SHIP, 1);
+9 -4
View File
@@ -19,6 +19,7 @@
#include "genall.h" #include "genall.h"
#include "../lander.h" #include "../lander.h"
#include "../planets.h" #include "../planets.h"
#include "../scan.h"
#include "../../globdata.h" #include "../../globdata.h"
#include "../../nameref.h" #include "../../nameref.h"
#include "../../resinst.h" #include "../../resinst.h"
@@ -95,13 +96,17 @@ GenerateVault_generateEnergy (SOLARSYS_STATE *solarSys, PLANET_DESC *world,
solarSys->SysInfo.PlanetInfo.CurType = 0; solarSys->SysInfo.PlanetInfo.CurType = 0;
else else
solarSys->SysInfo.PlanetInfo.CurType = 1; solarSys->SysInfo.PlanetInfo.CurType = 1;
// XXX: This node is always present, even after it is "picked up".
// Other similar pieces return the current node index when called
// by GeneratePlanetSide() to get the node info, and in that
// case the returned value is ignored AFAICT.
*whichNode = 1; *whichNode = 1;
if (solarSys->SysInfo.PlanetInfo.ScanRetrieveMask[ENERGY_SCAN] if (isNodeRetrieved (&solarSys->SysInfo.PlanetInfo, ENERGY_SCAN, 0))
& (1L << 0))
{ {
solarSys->SysInfo.PlanetInfo.ScanRetrieveMask[ENERGY_SCAN] // Retrieval status is cleared to keep the node on the map
&= ~(1L << 0); setNodeNotRetrieved (&solarSys->SysInfo.PlanetInfo, ENERGY_SCAN, 0);
if (GET_GAME_STATE (SYREEN_SHUTTLE_ON_SHIP)) if (GET_GAME_STATE (SYREEN_SHUTTLE_ON_SHIP))
{ {
SetLanderTakeoff (); SetLanderTakeoff ();
+9 -6
View File
@@ -20,6 +20,7 @@
#include "../lander.h" #include "../lander.h"
#include "../lifeform.h" #include "../lifeform.h"
#include "../planets.h" #include "../planets.h"
#include "../scan.h"
#include "../../build.h" #include "../../build.h"
#include "../../comm.h" #include "../../comm.h"
#include "../../encount.h" #include "../../encount.h"
@@ -216,8 +217,7 @@ GenerateVux_generateEnergy (SOLARSYS_STATE *solarSys, PLANET_DESC *world,
solarSys->SysInfo.PlanetInfo.CurPt.y = MAP_HEIGHT * 5 / 8; solarSys->SysInfo.PlanetInfo.CurPt.y = MAP_HEIGHT * 5 / 8;
solarSys->SysInfo.PlanetInfo.CurDensity = 0; solarSys->SysInfo.PlanetInfo.CurDensity = 0;
solarSys->SysInfo.PlanetInfo.CurType = 0; solarSys->SysInfo.PlanetInfo.CurType = 0;
if (!(solarSys->SysInfo.PlanetInfo.ScanRetrieveMask[ENERGY_SCAN] if (!isNodeRetrieved (&solarSys->SysInfo.PlanetInfo, ENERGY_SCAN, 0)
& (1L << 0))
&& *whichNode == (COUNT)~0) && *whichNode == (COUNT)~0)
{ {
*whichNode = 1; *whichNode = 1;
@@ -225,8 +225,7 @@ GenerateVux_generateEnergy (SOLARSYS_STATE *solarSys, PLANET_DESC *world,
else else
{ {
*whichNode = 0; *whichNode = 0;
if (solarSys->SysInfo.PlanetInfo.ScanRetrieveMask[ENERGY_SCAN] if (isNodeRetrieved (&solarSys->SysInfo.PlanetInfo, ENERGY_SCAN, 0))
& (1L << 0))
{ {
SET_GAME_STATE (SHOFIXTI_MAIDENS, 1); SET_GAME_STATE (SHOFIXTI_MAIDENS, 1);
SET_GAME_STATE (MAIDENS_ON_SHIP, 1); SET_GAME_STATE (MAIDENS_ON_SHIP, 1);
@@ -326,9 +325,12 @@ GenerateVux_generateLife (SOLARSYS_STATE *solarSys, PLANET_DESC *world,
else /* if (i <= 10) */ else /* if (i <= 10) */
/* {BEHAVIOR_UNPREDICTABLE | SPEED_SLOW | DANGER_NORMAL, MAKE_BYTE (3, 8)}, */ /* {BEHAVIOR_UNPREDICTABLE | SPEED_SLOW | DANGER_NORMAL, MAKE_BYTE (3, 8)}, */
solarSys->SysInfo.PlanetInfo.CurType = 8; solarSys->SysInfo.PlanetInfo.CurType = 8;
// XXX: This currently does not need to be done in a loop. When a
// node is retrieved, the func is called with *whichNode==~0
if (i == 0 if (i == 0
&& (solarSys->SysInfo.PlanetInfo.ScanRetrieveMask[BIOLOGICAL_SCAN] && isNodeRetrieved (&solarSys->SysInfo.PlanetInfo,
& (1L << i)) BIOLOGICAL_SCAN, 0)
&& !GET_GAME_STATE (VUX_BEAST)) && !GET_GAME_STATE (VUX_BEAST))
{ {
UnbatchGraphics (); UnbatchGraphics ();
@@ -339,6 +341,7 @@ GenerateVux_generateLife (SOLARSYS_STATE *solarSys, PLANET_DESC *world,
SET_GAME_STATE (VUX_BEAST, 1); SET_GAME_STATE (VUX_BEAST, 1);
SET_GAME_STATE (VUX_BEAST_ON_SHIP, 1); SET_GAME_STATE (VUX_BEAST_ON_SHIP, 1);
} }
if (i >= *whichNode) if (i >= *whichNode)
break; break;
} }
+9 -4
View File
@@ -19,6 +19,7 @@
#include "genall.h" #include "genall.h"
#include "../lander.h" #include "../lander.h"
#include "../planets.h" #include "../planets.h"
#include "../scan.h"
#include "../../globdata.h" #include "../../globdata.h"
#include "../../nameref.h" #include "../../nameref.h"
#include "../../resinst.h" #include "../../resinst.h"
@@ -89,12 +90,16 @@ GenerateWreck_generateEnergy (SOLARSYS_STATE *solarSys, PLANET_DESC *world,
solarSys->SysInfo.PlanetInfo.CurType = 0; solarSys->SysInfo.PlanetInfo.CurType = 0;
else else
solarSys->SysInfo.PlanetInfo.CurType = 1; solarSys->SysInfo.PlanetInfo.CurType = 1;
// XXX: This node is always present, even after it is "picked up".
// Other similar pieces return the current node index when called
// by GeneratePlanetSide() to get the node info, and in that
// case the returned value is ignored AFAICT.
*whichNode = 1; *whichNode = 1;
if (solarSys->SysInfo.PlanetInfo.ScanRetrieveMask[ENERGY_SCAN]
& (1L << 0)) if (isNodeRetrieved (&solarSys->SysInfo.PlanetInfo, ENERGY_SCAN, 0))
{ {
solarSys->SysInfo.PlanetInfo.ScanRetrieveMask[ENERGY_SCAN] // Retrieval status is cleared to keep the node on the map
&= ~(1L << 0); setNodeNotRetrieved (&solarSys->SysInfo.PlanetInfo, ENERGY_SCAN, 0);
if (!GET_GAME_STATE (PORTAL_KEY)) if (!GET_GAME_STATE (PORTAL_KEY))
{ {
+4 -4
View File
@@ -858,15 +858,15 @@ CheckObjectCollision (COUNT index)
} }
which_node = HIBYTE (ElementPtr->scan_node) - 1; which_node = HIBYTE (ElementPtr->scan_node) - 1;
pSolarSysState->SysInfo.PlanetInfo.ScanRetrieveMask[scan] |= setNodeRetrieved (&pSolarSysState->SysInfo.PlanetInfo, scan,
(1L << which_node); which_node);
allNodes = (COUNT)~0; allNodes = (COUNT)~0;
callGenerateForScanType (pSolarSysState, callGenerateForScanType (pSolarSysState,
pSolarSysState->pOrbitalDesc, pSolarSysState->pOrbitalDesc,
&allNodes, scan); &allNodes, scan);
if (!(pSolarSysState->SysInfo.PlanetInfo.ScanRetrieveMask[scan] & if (!isNodeRetrieved (&pSolarSysState->SysInfo.PlanetInfo, scan,
(1L << which_node))) which_node))
{ {
/* If our discovery strings have cycled, we're done */ /* If our discovery strings have cycled, we're done */
if (GetStringTableIndex ( if (GetStringTableIndex (