Releases: Spore-Community/Spore-ModAPI
ModAPI SDK v2.5.229
Big changes to the Resources namespace. This update introduces the concept of Database, which is a generalization of a .package file; this is because Spore actually supports two kinds of databases: packages (DatabasePackedFile) and disk folders, which are now support in the class DatabaseDirectoryFiles.
Additionally, some methods have been added to access existing databases: check the Resource::Paths namespace. For example:
// This returns EditorSaves.package
auto database = Resource::Paths::GetSaveArea(Resource::SaveAreaID::Creatures);
// This returns the path to the Spore folder in appdata
auto appdataPath = Resource::Paths::GetDirFromID(Resource::PathID::AppData);Also refactored the ResourceManager and PropManager classes.
ModAPI SDK v2.5.223
Completed many graphics classes and renamed many of them, based on some information found in a SimCity executable. Completed:
IEffectsManagerIEffectsWorldIVisualEffectISurfaceIModelManagerIModelWorldILightingWorldIShadowWorldIRenderer
Renamed:
SwarmManager->EffectsManagerIEffect->IVisualEffectIEffectWorld->IEffectsWorldRenderManager->RendererIRenderable->ILayerModelAsset->cMWModelInternalModelMesh->cModelInstance
ModAPI SDK v2.5.211
Terrain update! This update improves and adds many terrain classes like cTerrainSphere, cTerrainSphereQuad and cTerrainShaderMgr, including some of their rendering methods, like cTerrainSphereQuad::RenderWater. This update also completes the TextureManager class and improves the RenderTargetManager, allowing you to do more complex rendering.
And there's even more! To make modding the terrain easier, I've reconstructed some terrain rendering methods' source code: https://emd4600.github.io/Spore-ModAPI/_source_code-_terrain.html
For those interested in adding new star types, some star-related functions have also been reconstructed: https://emd4600.github.io/Spore-ModAPI/_source_code-_simulator.html
Added the following classes:
Terrain::cTerrainShaderMgrGraphics::cBufferDraw, a convenience class that can be used to draw rectangles (for example, to draw textures)Graphics::RenderStatisticsGraphics::cImageDataRaw
Improved the following classes:
Terrain::cTerrainSphereandTerrain::cTerrainSphereQuad, both with many rendering functions that can be detoured.Simulator::cCelestialBodycan be instantiated nowGraphics::ITextureManager, now it's completely finished!Graphics:I:RenderTargetManagerTerrain::cTerrainStateMgr::TerrainTextures
Added new functions:
- Many functions in the
Terrainnamespace, related with rendering. App::cViewer:SetViewWindow(),SetViewOffset(),SetViewport(),SetPerspectiveProjection(),SetParallelProjection(),Dispose()Graphics::Texture:IsLoaded(),GetLoadedRaster()Simulator::cBadgeManager:AddToBadgeProgress()Simulator::cPlanetRecord:GetPerihelion()Simulator::cSolarSystem:LoadBinaryStar(),LoadAsteroids()Simulator::cStar:GetStarType(),IsBinaryStar(),IsStarOrBinaryStar(),GetName()Math:IntRectangle
ModAPI SDK v2.5.209
Added several methods related with star properties:
GetBinarySystemStarTypesGetBinarySystemBaseRadiusGetSolarStarTemperatureGetSolarStarMassGetSolarStarRadiusGetSolarStarRotationRateGetSolarStarOrbitRadiusGetPlanetTemperatureTypeIsBinaryStarIsNotStarOrBinaryStar
For those that want to add new star types, detouring these star-related methods will be necessary.
The update also adds two new methods to the StarManager related with solar system generation:
RequirePlanetsForStar: Call this method when you want to access the planets of a star record. Planets are not generated when the galaxy is generated, but only when their star is first accessed; this method ensures the star will have planets.GeneratePlanetsForStar: Called byRequirePlanetsForStar, this method is the one that actually generates planets and adds them to a solar systemcStarRecord. Detour this function if you want to change how solar systems are generated.
Finally, a new class was added, Simulator::cSpaceGfx. This class has all the effects used to display the galaxy, the "skybox" in space, etc.
ModAPI SDK v2.5.205
This update contains many improvements to planets and stars:
- Added many fields to
cPlanetRecordandcStarRecord. - Improved
StarIDandPlanetID - Added class
SpaceNamesused to generate random names. - Added class
ResourceKeyGeneratorused to generate unique keys for creations/planets. - Now it is possible to create instances of
cPlanetRecordwith all the fields necessary. - Added some methods related with galaxy generation. One of them is
cStarManager::GenerateSolSystem(), which is called when generating the galaxy to create the Sol system (which contains the Earth, etc). This method can be detoured to add special stars or planets during galaxy creation. For example, this simple method adds the Jupiter moon "Io":
member_detour(GenerateSolSystem__detour, Simulator::cStarManager, void())
{
void detoured()
{
using namespace Simulator;
original_function(this);
auto solStar = GetSol();
// 0 is the Earth, 1 is the Moon, 2 is Mercury, 3 is Venus, 4 is Mars, 5 is asteroid belt,
// 6 is Jupiter,...
auto jupiter = solStar->GetPlanetRecord(6);
cPlanetRecordPtr planet;
cPlanetRecord::Create(PlanetID(solStar->GetID(), solStar->mPlanetCount), planet);
planet->mName = u"Io";
planet->mType = PlanetType::T0;
planet->mTechLevel = TechLevel::None;
StarManager.GenerateEllipticalOrbit(solStar, planet->mOrbit, 21.0, 23.0, jupiter);
planet->SetGeneratedTerrainKey(planet->GenerateTerrainKey());
// I just used a random terrain script here
TerrainResourceManager.SaveTerrain(planet->GetGeneratedTerrainKey(), id("crystal_hex"), 0x4184A200);
StarManager.CalculatePlanetScores(planet.get());
solStar->mPlanetCount++;
}
};
void AttachDetours()
{
attach_detour(GenerateSolSystem__detour, Simulator::cStarManager, GenerateSolSystem);
}ModAPI SDK v2.5.203
Several improvements to classes EditorRigblock, EditorModel, cEditorResource, EditorBaseHandle, TuningSpine. Apart from completing the structure and fields of these classes, several interesting methods have been added related to editor models. An example of what you can do:
auto resource = new Editors::cEditorResource();
Editor.GetEditorModel()->Save(resource);
// ...
// Later:
auto model = new Editors::EditorModel();
model->Load(resource);
Editor.SetEditorModel(model);This saves the current creation into the resource object. That creation can be later restored in the editor creating a new model, loading the resource and setting it in the Editor.
ModAPI SDK v2.5.199
Adventure editor! Added many classes and functions related to the adventure editor (adventures are known in Spore code as "scenarios"):
cScenarioDatacScenarioPlayModecScenarioTerraformModecScenarioEditHistorycScenarioPowerup
And many improvements to other classes. You can access most of this using ScenarioMode, like ScenarioMode.GetPlayMode()->SetCurrentAct(3); (to go to the fourth act when playing an adventure).
There have also been some improvements to audio support. Now it supports separate audio tracks which can play a single sound at a time, and a function to stop the sound. For example:
auto track = Audio::CreateAudioTrack();
Audio::PlayAudio(soundID, track);
// ... later ...
Audio::StopAudio(track);ModAPI SDK v2.5.197
Fixed compilation error related with cGameData.
ModAPI SDK v2.5.195
Fixed compilation error
ModAPI SDK v2.5.179
Multiple features, from now on releases will be more frequent.