Skip to content
This repository has been archived by the owner on May 21, 2023. It is now read-only.

Commit

Permalink
How to add a new StarBase. Along with adding ruins to a planet
Browse files Browse the repository at this point in the history
Including a unique image for the StarBase and unique text reports for the StarBase & Ruins

This particular tutorial resides in the Microscopii at the first planet.
  • Loading branch information
Serosis committed Jul 23, 2021
1 parent 4aca75a commit 5aace8e
Show file tree
Hide file tree
Showing 15 changed files with 212 additions and 4 deletions.
4 changes: 4 additions & 0 deletions sc2/build/msvc6/UrQuanMasters.dsp

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

12 changes: 12 additions & 0 deletions sc2/content/base/lander/energy/destroyedbase.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
#(DESTROYED BASE)
---- REPORT FROM ORBIT ----

WE HAVE EXPLORED THE INTERIOR OF THE STARBASE. IT HAS BEEN COMPLETELY DESTROYED.

ACCORDING TO OUR XENO-FORENSICS EXPERTS, THE REACTOR ABOARD THE STARBASE RAN OUT OF FUEL AND SHUT DOWN, TERMINATING LIFE SUPPORT AND FORCING THE INHABITANTS INTO THE ESCAPE PODS, WHICH ARE NOWHERE TO BE FOUND. WE DON'T KNOW WHO THEY WERE OR WHAT THEY LOOKED LIKE, AS THEY LEFT THE STARBASE COMPLETELY EMPTY.

AND I MEAN EMPTY. THERE ARE NO BODIES, ANYTHING OF VALUE HAS BEEN RIPPED OUT OF THE WALLS, AND EVEN SOME OF THE SUPER-STRUCTURE IS MISSING. EVIDENCE OF ELECTRICAL SCORING IS EVERYWHERE, IT LOOKS AS THOUGH SOMEONE OR SOMETHING CAME THROUGH AND MELTED THE PLACE DOWN FOR RAW MATERIALS.

WE CAN FIND NOTHING ELSE HERE. RETURNING TO THE SHIP.

---- END OF REPORT ----
14 changes: 14 additions & 0 deletions sc2/content/base/lander/energy/shatteredruins.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
#(RUINS 1)
---- REPORT FROM SURFACE ----

EVERYONE AND EVERYTHING ON THIS PLANET HAS BEEN DESTROYED, CAPTAIN.

WE CAN ONLY SPECULATE TO THE EVENTS THAT TRANSPIRED HERE BUT IT LOOKS AS THOUGH A CATASTROPIC EVENT OF PLANETARY PREPORTIONS HAS RIPPED THIS WORLD TO SHREDS.

OF THE INFORMATION WE CAN GATHER FROM THE RUINS OF THIS CIVILIZATION IS THAT THEY PREPARED TO MOVE OFF-WORLD BY BUILDING A GIANT STARBASE IN FAR ORBIT, ALMOST IF THEY KNEW WHAT WAS GOING TO HAPPEN HERE.

UNFORTUNATELY THAT IS ALL WE CAN MANAGE TO LEARN HERE BECAUSE THE CONSTANT EARTHQUAKES ARE LEVELING WHAT IS LEFT OF THESE RUINS WHILE ALSO THREATENING TO TEAR THE LANDER APART.

CAPTAIN, IN REGARDS TO THE SAFETY OF THE CREW, WE ARE RETURNING TO THE SHIP.

---- END OF REPORT ----
Binary file added sc2/content/base/nav/orbitbackground-022.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
1 change: 1 addition & 0 deletions sc2/content/base/nav/orbitbackground.ani
Original file line number Diff line number Diff line change
Expand Up @@ -20,3 +20,4 @@ orbitbackground-018.png 0 57 0 0
orbitbackground-019.png 0 57 9 6
orbitbackground-020.png 0 57 2 -15
orbitbackground-021.png 0 57 0 0
orbitbackground-022.png 0 57 7 8
2 changes: 2 additions & 0 deletions sc2/content/uqm.rmp
Original file line number Diff line number Diff line change
Expand Up @@ -943,13 +943,15 @@ text.aquahelix = STRTAB:base/lander/energy/aquahelix.txt
text.burvixcaster = STRTAB:base/lander/energy/burvixcaster.txt
text.burvixeseruins = STRTAB:base/lander/energy/burvixeseruins.txt
text.chmmrbase = STRTAB:base/lander/energy/chmmrbase.txt
text.destroyedstarbase = STRTAB:base/lander/energy/destroyedbase.txt
text.eggcase = STRTAB:base/lander/energy/eggcase.txt
text.fwiffo = STRTAB:base/lander/energy/fwiffo.txt
text.joyalpha = STRTAB:base/ui/joyalpha.txt
text.maidens = STRTAB:base/lander/energy/maidens.txt
text.moonbase = STRTAB:base/lander/energy/moonbase.txt
text.ruins = STRTAB:base/lander/energy/ruins.txt
text.setupmenu = STRTAB:base/ui/setupmenu.txt
text.shatteredruins = STRTAB:base/lander/energy/shatteredruins.txt
text.sphere = STRTAB:base/lander/energy/sphere.txt
text.spindle = STRTAB:base/lander/energy/spindle.txt
text.starcon = STRTAB:base/gamestrings.txt
Expand Down
3 changes: 3 additions & 0 deletions sc2/src/uqm/gendef.c
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,7 @@ extern GenerateFunctions generateShofixtiFunctions;
extern GenerateFunctions generateSlylandroFunctions;
extern GenerateFunctions generateSolFunctions;
extern GenerateFunctions generateSpathiFunctions;
extern GenerateFunctions generateStarBaseFunctions; // Add reference to the struct in genbase.c
extern GenerateFunctions generateSupoxFunctions;
extern GenerateFunctions generateSyreenFunctions;
extern GenerateFunctions generateTalkingPetFunctions;
Expand Down Expand Up @@ -130,6 +131,8 @@ getGenerateFunctions (BYTE Index)
return &generateRainbowWorldFunctions;
case ILWRATH_DEFINED:
return &generateIlwrathFunctions;
case STARBASE_DEFINED: // Add your new enum element STARBASE_DEFINED here
return &generateStarBaseFunctions; // While making sure to return the function from genbase.c
default:
return &generateDefaultFunctions;
}
Expand Down
3 changes: 2 additions & 1 deletion sc2/src/uqm/gendef.h
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,8 @@ enum
RAINBOW_DEFINED,
ILWRATH_DEFINED,
ANDROSYNTH_DEFINED,
MYCON_TRAP_DEFINED
MYCON_TRAP_DEFINED,
STARBASE_DEFINED // Add definition that can be used to populate a star with your new starbase
};

#define UMGAH_DEFINED TALKING_PET_DEFINED
Expand Down
2 changes: 2 additions & 0 deletions sc2/src/uqm/istrtab.h
Original file line number Diff line number Diff line change
Expand Up @@ -119,12 +119,14 @@
#define SETUP_MENU_STRTAB "text.setupmenu"
#define SHATTERED_COLOR_TAB "planet.shattered.colortable"
#define SHATTERED_XLAT_TAB "planet.shattered.translatetable"
#define SHATTERED_RUINS_STRTAB "text.shatteredruins" // Create a new macro to load the text for the Shattered World ruins
#define SPAPLUTO_STRTAB "text.fwiffo"
#define STARCON_COLOR_MAP "colortable.main"
#define STARCON_GAME_STRINGS "text.starcon"
#define SUN_DEVICE_STRTAB "text.sundevice"
#define SUPER_DENSE_COLOR_TAB "planet.superdense.colortable"
#define SUPER_DENSE_XLAT_TAB "planet.superdense.translatetable"
#define STARBASE_RUINS_STRTAB "text.destroyedstarbase" // Create a new macro to load the text for the ruined starbase
#define SUPOX_RUINS_STRTAB "text.ultron"
#define TAALO_DEVICE_STRTAB "text.taalodevice"
#define TELLURIC_COLOR_TAB "planet.telluric.colortable"
Expand Down
2 changes: 1 addition & 1 deletion sc2/src/uqm/plandata.c
Original file line number Diff line number Diff line change
Expand Up @@ -530,7 +530,7 @@ STAR_DESC starmap_array[] =
{{1020, 9937}, MAKE_STAR (DWARF_STAR, RED_BODY, -1), 0, 7, 27},
{{ 83, 9979}, MAKE_STAR (DWARF_STAR, RED_BODY, -1), 0, 6, 27},
{{1937, 9979}, MAKE_STAR (DWARF_STAR, RED_BODY, -1), 0, 1, 103},
{{4395, 9979}, MAKE_STAR (DWARF_STAR, GREEN_BODY, -1), 0, 0, 52},
{{4395, 9979}, MAKE_STAR (DWARF_STAR, GREEN_BODY, -1), STARBASE_DEFINED, 0, 52}, // I chose Microscopii for the new starbase

{{MAX_X_UNIVERSE << 1, MAX_Y_UNIVERSE << 1}, 0, 0, 0, 0},

Expand Down
2 changes: 1 addition & 1 deletion sc2/src/uqm/planets/generate/Makeinfo
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
uqm_CFILES="gendefault.c genand.c genburv.c genchmmr.c gencol.c gendru.c
uqm_CFILES="gendefault.c genand.c genbase.c genburv.c genchmmr.c gencol.c gendru.c
genilw.c genmel.c genmyc.c genorz.c genpet.c genpku.c genrain.c
gensam.c genshof.c gensly.c gensol.c genspa.c gensup.c gensyr.c
genthrad.c gentrap.c genutw.c genvault.c genvux.c genwreck.c
Expand Down
154 changes: 154 additions & 0 deletions sc2/src/uqm/planets/generate/genbase.c
Original file line number Diff line number Diff line change
@@ -0,0 +1,154 @@
//Copyright Paul Reiche, Fred Ford. 1992-2002

/*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
*/

#include "genall.h"
#include "../lander.h"
#include "../planets.h"
#include "../../build.h"
#include "../../comm.h"
#include "../../globdata.h"
#include "../../nameref.h"
#include "../../setup.h"
#include "../../sounds.h"
#include "../../state.h"
#include "libs/mathlib.h"

static bool GenerateBase_generatePlanets (SOLARSYS_STATE *solarSys);
static bool GenerateBase_generateMoons (SOLARSYS_STATE *solarSys,
PLANET_DESC *planet);
static bool GenerateBase_generateOrbital (SOLARSYS_STATE *solarSys,
PLANET_DESC *world);
static COUNT GenerateBase_generateEnergy (const SOLARSYS_STATE *,
const PLANET_DESC *world, COUNT whichNode, NODE_INFO *);
static bool GenerateBase_pickupEnergy (SOLARSYS_STATE *solarSys,
PLANET_DESC *world, COUNT whichNode);

// This struct contains all the functions necessary to generate your star system
const GenerateFunctions generateStarBaseFunctions = {
/* .initNpcs = */ GenerateDefault_initNpcs,
/* .reinitNpcs = */ GenerateDefault_reinitNpcs,
/* .uninitNpcs = */ GenerateDefault_uninitNpcs,
/* .generatePlanets = */ GenerateBase_generatePlanets,
/* .generateMoons = */ GenerateBase_generateMoons,
/* .generateName = */ GenerateDefault_generateName,
/* .generateOrbital = */ GenerateBase_generateOrbital,
/* .generateMinerals = */ GenerateDefault_generateMinerals,
/* .generateEnergy = */ GenerateBase_generateEnergy,
/* .generateLife = */ GenerateDefault_generateLife,
/* .pickupMinerals = */ GenerateDefault_pickupMinerals,
/* .pickupEnergy = */ GenerateBase_pickupEnergy,
/* .pickupLife = */ GenerateDefault_pickupLife,
};


static bool
GenerateBase_generatePlanets (SOLARSYS_STATE *solarSys)
{
GenerateDefault_generatePlanets (solarSys); // Procedurally generates the planets for this system based on star location and type

solarSys->PlanetDesc[0].data_index = SHATTERED_WORLD; // Type of world for the specified planet in array
solarSys->PlanetDesc[0].NumPlanets = MAX_MOONS; // Number of moons for specific planet in the array [MAX_MOONS is 4]

return true;
}

static bool
GenerateBase_generateMoons (SOLARSYS_STATE *solarSys, PLANET_DESC *planet)
{
GenerateDefault_generateMoons (solarSys, planet);

// matchWorld (solarSys, planet, Which_Planet, Which_Moon_of_Planet)
// alternatively instead of Which_Moon you can just put "MATCH_PLANET"
// to only match the planet itself and not the moons
if (matchWorld (solarSys, planet, 0, MATCH_PLANET))
{
solarSys->MoonDesc[3].data_index = DESTROYED_STARBASE; // Type of world for the specified moon
}

return true;
}

static bool
GenerateBase_generateOrbital (SOLARSYS_STATE *solarSys, PLANET_DESC *world)
{
// matchWorld (solarSys, planet, Which_Planet, Which_Moon_of_Planet)
// alternatively instead of Which_Moon you can just put "MATCH_PLANET"
// to only match the planet itself and not the moons
if (matchWorld (solarSys, world, 0, 3))
{ // Since we're in orbit we have to load the lander reports manually
/* Starbase */
LoadStdLanderFont (&solarSys->SysInfo.PlanetInfo); // Loads the lander font
solarSys->SysInfo.PlanetInfo.DiscoveryString =
CaptureStringTable (LoadStringTable (STARBASE_RUINS_STRTAB)); // Loads the text file for reading

DoDiscoveryReport (MenuSounds); // Loads the lander report UI and reads the report

// This destroys all things lander report related that we loaded to free up memory
DestroyStringTable (ReleaseStringTable (
solarSys->SysInfo.PlanetInfo.DiscoveryString));
solarSys->SysInfo.PlanetInfo.DiscoveryString = 0;
FreeLanderFont (&solarSys->SysInfo.PlanetInfo);

return true;
}

if (matchWorld(solarSys, world, 0, MATCH_PLANET))
{
LoadStdLanderFont (&solarSys->SysInfo.PlanetInfo); // Loads the lander font
solarSys->PlanetSideFrame[1] =
CaptureDrawable (LoadGraphic (RUINS_MASK_PMAP_ANIM)); // Loads the images for the planetary ruins
solarSys->SysInfo.PlanetInfo.DiscoveryString =
CaptureStringTable (
LoadStringTable (SHATTERED_RUINS_STRTAB)); // Loads the text file for reading
}

GenerateDefault_generateOrbital (solarSys, world);

return true;
}

static bool
GenerateBase_pickupEnergy (SOLARSYS_STATE *solarSys, PLANET_DESC *world,
COUNT whichNode)
{
if (matchWorld (solarSys, world, 0, MATCH_PLANET))
{ // Does what it says on the tin, generates lander report UI that displays
// the lander report specified in GenerateBase_generateOrbital
// when it matches the correct planet
GenerateDefault_landerReportCycle (solarSys);

SetLanderTakeoff ();

return false; // do not remove the node
}

(void) whichNode;
return false;
}

static COUNT
GenerateBase_generateEnergy (const SOLARSYS_STATE *solarSys,
const PLANET_DESC *world, COUNT whichNode, NODE_INFO *info)
{
if (matchWorld (solarSys, world, 0, MATCH_PLANET))
{ // This generates ruins on the matched planet
return GenerateDefault_generateRuins (solarSys, whichNode, info);
}

return 0;
}
1 change: 1 addition & 0 deletions sc2/src/uqm/planets/plandata.h
Original file line number Diff line number Diff line change
Expand Up @@ -190,6 +190,7 @@ enum

HIERARCHY_STARBASE = 127 | WORLD_TYPE_SPECIAL,
SA_MATRA = 126 | WORLD_TYPE_SPECIAL,
DESTROYED_STARBASE = 125 | WORLD_TYPE_SPECIAL,
};

#define NUMBER_OF_SMALL_ROCKY_WORLDS (LAST_SMALL_ROCKY_WORLD - FIRST_SMALL_ROCKY_WORLD + 1)
Expand Down
4 changes: 4 additions & 0 deletions sc2/src/uqm/planets/solarsys.c
Original file line number Diff line number Diff line change
Expand Up @@ -732,6 +732,10 @@ ValidateOrbit (PLANET_DESC *planet, int sizeNumer, int dyNumer, int denom)
{
planet->image.frame = SetAbsFrameIndex (SpaceJunkFrame, 19);
}
else if (planet->data_index == DESTROYED_STARBASE)
{ // Add the new destroyed starbase image into the code
planet->image.frame = SetAbsFrameIndex (SpaceJunkFrame, 22);
}
}

static void
Expand Down
12 changes: 11 additions & 1 deletion sc2/src/uqm/uqmdebug.c
Original file line number Diff line number Diff line change
Expand Up @@ -734,7 +734,9 @@ moonRecurse (STAR_DESC *star, SOLARSYS_STATE *system, PLANET_DESC *planet,
if (universeRecurseArg->moonFunc != NULL)
{
system->pOrbitalDesc = moon;
if (moon->data_index != HIERARCHY_STARBASE && moon->data_index != SA_MATRA)
if (moon->data_index != HIERARCHY_STARBASE
&& moon->data_index != SA_MATRA
&& moon->data_index != DESTROYED_STARBASE)
{
DoPlanetaryAnalysis (&system->SysInfo, moon);
// When GenerateDefaultFunctions is used as genFuncs,
Expand Down Expand Up @@ -1009,6 +1011,10 @@ dumpMoon (FILE *out, const PLANET_DESC *moon)
{
typeStr = "Sa-Matra";
}
else if (moon->data_index == DESTROYED_STARBASE)
{
typeStr = "Destroyed StarBase";
}
else
{
typeStr = planetTypeString (moon->data_index & ~PLANET_SHIELDED);
Expand All @@ -1032,6 +1038,10 @@ dumpWorld (FILE *out, const PLANET_DESC *world)
return;
}

if (world->data_index == DESTROYED_STARBASE) {
return;
}

info = &pSolarSysState->SysInfo.PlanetInfo;
fprintf(out, " AxialTilt: %d\n", info->AxialTilt);
fprintf(out, " Tectonics: %d\n", info->Tectonics);
Expand Down

0 comments on commit 5aace8e

Please sign in to comment.