Starbase menu is now accessible by a function.

The original game did a bunch of one-off specifics to enter the
starbase menu.  Since I want to make this available in multiple
places (even via script... and maybe by *building* new starbases),
I'll need a simple function to call.

I've tested it by making the Chmmr and Syreen starbase both call
this function -- it works.  (It's kinda neat to have starbases
all over the galaxy!  It totally makes for a different kind of
game.)

Of course, since I intend to make all planet stuff customizable
via Lua -- one can make their own game have whatever they want.
A main starbase, which might get conquered and then have to be
relocated could be interesting.  I aim to make "nearly anything"
possible.
This commit is contained in:
2024-04-24 10:09:49 -04:00
parent bdbd7158b9
commit 104cc02ed1
3 changed files with 23 additions and 9 deletions
+3 -9
View File
@@ -29,6 +29,8 @@
#include "../../state.h" #include "../../state.h"
#include "libs/mathlib.h" #include "libs/mathlib.h"
#include "../../starbase.h"
static bool GenerateSol_initNpcs (SOLARSYS_STATE *solarSys); static bool GenerateSol_initNpcs (SOLARSYS_STATE *solarSys);
static bool GenerateSol_reinitNpcs (SOLARSYS_STATE *solarSys); static bool GenerateSol_reinitNpcs (SOLARSYS_STATE *solarSys);
@@ -260,15 +262,7 @@ GenerateSol_generateOrbital (SOLARSYS_STATE *solarSys, PLANET_DESC *world)
if (matchWorld (solarSys, world, 2, 0)) if (matchWorld (solarSys, world, 2, 0))
{ {
/* Starbase */ return PrepareToVisitStarBase();
PutGroupInfo (GROUPS_RANDOM, GROUP_SAVE_IP);
ReinitQueue (&GLOBAL (ip_group_q));
assert (CountLinks (&GLOBAL (npc_built_ship_q)) == 0);
EncounterGroup = 0;
GLOBAL (CurrentActivity) |= START_ENCOUNTER;
SET_GAME_STATE (GLOBAL_FLAGS_AND_DATA, (BYTE)~0);
return true;
} }
DoPlanetaryAnalysis (&solarSys->SysInfo, world); DoPlanetaryAnalysis (&solarSys->SysInfo, world);
+18
View File
@@ -33,6 +33,11 @@
#include "libs/graphics/gfx_common.h" #include "libs/graphics/gfx_common.h"
#include "libs/tasklib.h" #include "libs/tasklib.h"
#include "encount.h"
#include "globdata.h"
#include "state.h"
#include "grpinfo.h"
static void CleanupAfterStarBase (void); static void CleanupAfterStarBase (void);
@@ -600,3 +605,16 @@ WrapText (const UNICODE *pStr, COUNT len, TEXT *tarray, SIZE field_width)
return (num_lines); return (num_lines);
} }
bool
PrepareToVisitStarBase( void )
{
PutGroupInfo (GROUPS_RANDOM, GROUP_SAVE_IP);
ReinitQueue (&GLOBAL (ip_group_q));
assert (CountLinks (&GLOBAL (npc_built_ship_q)) == 0);
EncounterGroup = 0;
GLOBAL (CurrentActivity) |= START_ENCOUNTER;
SET_GAME_STATE (GLOBAL_FLAGS_AND_DATA, (BYTE)~0);
return true;
}
+2
View File
@@ -48,6 +48,8 @@ extern COUNT WrapText (const UNICODE *pStr, COUNT len, TEXT *tarray, SIZE
field_width); field_width);
// XXX: Doesn't really belong in this file. // XXX: Doesn't really belong in this file.
extern bool PrepareToVisitStarBase( void );
#if defined(__cplusplus) #if defined(__cplusplus)
} }
#endif #endif