Skip to content

Commit

Permalink
Merge branch 'master' of github.com:emd4600/Spore-ModAPI
Browse files Browse the repository at this point in the history
# Conflicts:
#	Spore ModAPI/Spore/Simulator/cTribe.h
  • Loading branch information
emd4600 committed Oct 10, 2024
2 parents 38745a9 + 4a4e52a commit 6a332bb
Show file tree
Hide file tree
Showing 11 changed files with 198 additions and 26 deletions.
1 change: 1 addition & 0 deletions Spore ModAPI/SourceCode/DLL/AddressesEditors.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -177,6 +177,7 @@ namespace Editors
DefineAddress(DisableBackground, SelectAddress(0x62F900, 0x62F950));
DefineAddress(Load, SelectAddress(0x62FC70, 0x62FCC0));
DefineAddress(LoadBackgroudFiles, SelectAddress(0x62FBA0, 0x62FBF0));
DefineAddress(LoadBackgroundFiles, SelectAddress(0x62FBA0, 0x62FBF0));
DefineAddress(HandleUIButton, SelectAddress(0x62F7D0, 0x62F820));
DefineAddress(ToggleBackgroundButtonHighlights, SelectAddress(0x62F320, 0x62F370));
DefineAddress(UpdatePageNumbers, SelectAddress(0x62F520, 0x62F570));
Expand Down
2 changes: 1 addition & 1 deletion Spore ModAPI/SourceCode/Editors/EditorPlayMode.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -111,7 +111,7 @@ namespace Editors
Args(PlayModeUI* a1, uint32_t a2, uint32_t a3, Graphics::ILightingWorld* a4, int8_t a5),
Args(a1, a2, a3, a4, a5));

auto_METHOD_VOID(PlayModeBackgrounds, LoadBackgroudFiles,
auto_METHOD_VOID(PlayModeBackgrounds, LoadBackgroundFiles,
Args(int8_t backgroundSet), Args(backgroundSet));

auto_METHOD(PlayModeBackgrounds, bool, HandleUIButton,
Expand Down
11 changes: 11 additions & 0 deletions Spore ModAPI/SourceCode/UTFWin/Window.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@
#include <Spore\UTFWin\Window.h>
#include <Spore\UTFWin\IWindowManager.h>
#include <Spore\UTFWin\IWinProc.h>
#include <Spore\UTFWin\IButton.h>
#include <Spore\UTFWin\Constants.h>
#include <Spore\UTFWin\WindowIterators.h>
#include <EASTL\internal\thread_support.h>
Expand Down Expand Up @@ -436,4 +437,14 @@ namespace UTFWin
return true;
}, pWinProc);
}

// Button Funcs

void IButton::SetButtonPressed(bool bValue) {
this->SetButtonFlag(kBtnStateSelected, bValue);
}

bool IButton::IsButtonPressed() {
return this->GetButtonStateFlags() & kBtnStateSelected;
}
}
5 changes: 3 additions & 2 deletions Spore ModAPI/Spore/Editors/PlayModeBackgrounds.h
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ namespace Editors

void Load(PlayModeUI* playModeUI, uint32_t entryEffectID, uint32_t crossFadeSnapEffectID, Graphics::ILightingWorld* lightingWorld, int8_t backgroundSet);

void LoadBackgroudFiles(int8_t backgroundSet);
void LoadBackgroundFiles(int8_t backgroundSet);

bool HandleUIButton(uint32_t controlID);

Expand Down Expand Up @@ -65,7 +65,8 @@ namespace Editors
DeclareAddress(SwitchBackground);
DeclareAddress(DisableBackground);
DeclareAddress(Load); // 0x62FC70 0x62FCC0
DeclareAddress(LoadBackgroudFiles); // 0x62FBA0 0x62FBF0
DeclareAddress(LoadBackgroundFiles); // 0x62FBA0 0x62FBF0
DeclareAddress(LoadBackgroudFiles); // legacy
DeclareAddress(HandleUIButton); // 0x62F7D0 0x62F820
DeclareAddress(ToggleBackgroundButtonHighlights); // 0x62F320 0x62F370
DeclareAddress(UpdatePageNumbers); // 0x62F520 0x62F570
Expand Down
2 changes: 1 addition & 1 deletion Spore ModAPI/Spore/Palettes/StandardItemUI.h
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ namespace Palettes

public:
/* 0Ch */ PaletteItemPtr mpItem;
/* 10h */ int field_10;
/* 10h */ uint32_t field_10;
/* 14h */ ItemViewerPtr mpViewer;
/* 18h */ IWindowPtr field_18;
/* 1Ch */ bool field_1C;
Expand Down
179 changes: 166 additions & 13 deletions Spore ModAPI/Spore/Simulator/SimulatorMessages.h
Original file line number Diff line number Diff line change
Expand Up @@ -32,11 +32,17 @@ namespace Simulator
/// Simulator::EnterEditorMessage; Enters the correct editor modifying the specified creation.
kMsgEnterEditor = 0x53850BAE,

/// Switches the editor. Use the desired editor ID as the message data .
kMsgSwitchEditor = 0x0212D3E7,

kMsgSwitchGameMode = 0x0212D3E7,

/// Saves the game, pausing the game and showing a dialog on success. Use with message data `1` (as in, an integer).
kMsgSaveGame = 0x1CD20F0,

/// Sent when loading a saved game.
kMessageLoadGame = 0xf8b1a2af,

/// Simulator::GameNounStatusChangedMessage
kMsgGameNounStatusChanged = 0x1A0219E,

Expand All @@ -46,6 +52,125 @@ namespace Simulator
/// Simulator::CombatantKilledMessage; called when a combatant is killed
kMsgCombatantKilled = 0x1622184,

/// kills persistant swarm effects. Used at the end of certain stages
kMsgKillPersistentEffects = 0x0667af52,

/// Simulator::DoCinematicActionMessage ; sent to execute a single action within a cinematic stage
kMsgDoCinematicAction = 0x4470A41,

//////////////////
// Cell Stage
//////////////////

// Sent when the cell stage intro cinematic effect ends
kMsgCinematicGGE2CLGEnds = 0x04065b23,

/// Sent when cell stage has begun
kMsgCellStageStart = 0x047c1d19,

/// Sent when cell stage is transitioning to creature stage
kMsgCellToCreatureTransition = 0x02A4f8f0,

//////////////////
// Creature Stage
//////////////////

/// Hatches the avatar creature's egg in creature stage
kMsgHatchAvatarEggs = 0x06566531,

/// Upgrades the player's nest to the current brain level(?) in creature stage. May be cutscene only.
kMsgUpgradeNest = 0x06555abc,

/// Respawns the avatar creature at their nest in creature stage
kMsgRestartAtNest = 0x04f60b92,

/// Loads the avatar into the creature editor
kEnterCreatureEditor = 0x04d9686f,

/// TODO, uses data
//kCinematicCRG2TRGPreload = 0x04b719d4,

/// Transitions from creature stage to tribal stage
kMsgCreatureToTribeTransition = 0x0477f66c,

///////////////
// Tribe Stage
///////////////

/// Upgrades the player tribe's main hut (Cutscene only)
kMsgTribeUpgradeHut = 0x0575116e,

/// Upgrades the player tribe's campfire and layout decal (Cutscene only)
kMsgTribeUpgradeCampfire = 0x0575116f,

/// Upgrades the player tribe's totem base and food mat (Cutscene only)
kMsgTribeUpgradeFoodMat = 0x05751170,

/// Sent to notify the game that a new tribal totem needs to be added (Cutscene only)
kMsgNotifyTotemNeeded = 0x05cd5482,

/// Sent to notify the game that the tribal upgrade or totem placement has finished so that game can save (Cutscene only)
kMsgNotifyUpgradeDone = 0x05cd5482,

/// Restarts the tribal stage (as though tribal hut has been destroyed)
kMsgTribeRestart = 0x0420e32a,

/// Moves the tribal camera to point towards the center of your tribe
kMsgTribeMoveCameraToTribe = 0x056cf231,

/// TRG2CVG - Shows the city hall (Cutscene only)
kMsgCinematicTRG2CVGShowCityHall = 0x069479a8,

/// TRG2CVG - Hides the city hall (Cutscene only)
kMsgCinematicTRG2CVGHideCityHall = 0x0694797d,

/////////////
// Civ Stage
/////////////

/// Sent when the cutscene for a new city appearing plays in civ stage
kMsgCinematicNewCityAppears = 0x05668f43,

/// Sent when the captured city's buildings restart their runtime effects in civ stage
kMsgCinematicCityChangeStartBuildingsEffects = 0x05f4d02a,

/// Sent when the captured city's buildings swap their models in civ stage
kMsgCinematicCityChangeSwapBuildings = 0x05dfb77f,

/// Sent when the captured city's wall color changes in civ stage
kMsgCinematicCityChangeChangeWallColor = 0x05dfb782,

/// Sent when the captured city's civilization ownership changes in civ stage
kMsgCinematicCityChangeChangeCivilization = 0x05dbc31e,

/// Sent when a tier 3 superweapon cutscene begins in civ stage (?)
kMsgCivTriggerSuperweapon = 0x06524f8f,

/// Sent when the UFO appears at the very end of civ stage
kMsgShowUFOForTransition = 0x0590cd26,

///////////////
// Space Stage
///////////////

/// Sent when launching a space stage game form the main menu
kMsgSpaceGameFromLaunchScreen = 0x02364016,

/// Sent when the player gets new tools in a space stage cutscene (TODO: Does this also get called outside of cutscenes?)
kMsgCinematicSpaceGetTools = 0x06526395,

/// Sent from the cutscene where the player first picks up spice in space stage
kMsgCinematicSpaceFirstSpicePickup = 0x06834927,

/// Plays the "UFO Effect" of swirly lights appearing around the player's ship in a space stage cutscene
kMsgCinematicSpaceUFOEffect = 0x0665e639,

/// Sent when a new badge appears on the screen in space stage
kMsgCinematicScreenBadgeEffect = 0x0665e1ab,

/// Sent when the atmosphere dome goes down on a space stage colony (TODO: Does this also get called outside of cutscenes?)
kMsgCinematicSpaceColonyAtmosphereDomeDown = 0x065e622c,

/// Simulator::PlayerEmpireAlliedMessage; called when the player empire makes a new alliance
kMsgPlayerEmpireAllied = 0x4445D43,

Expand All @@ -58,17 +183,6 @@ namespace Simulator
/// Simulator::ToolOnHitMessage; called when a space tool hits a target
kMsgToolOnHit = 0x56690BB,

/// Simulator::ScenarioCreatureHealedMessage; called when a creature is healed (either by natural heal rate, or using a medkit) in Scenario mode
kMsgScenarioCreatureHealed = 0x7C789F8,

/// Simulator::ScenarioEnergyConsumedMessage; sent when the player consumes captain energy
kMsgScenarioEnergyConsumed = 0x7C7A52E,

/// No data, called when pressing the undo button in the scenario editor
kMsgScenarioUndo = 0xC9D86390,
/// No data, called when pressing the redo button in the scenario editor
kMsgScenarioRedo = 0xC9D86391,

/// Message emitted by the galaxy generation effect to create stars of StarType::StarG (yellow) type.
kMsgGalaxyGenerateStarG = 0x35B2B15,
/// Message emitted by the galaxy generation effect to create stars of StarType::StarO (blue) type.
Expand Down Expand Up @@ -102,8 +216,47 @@ namespace Simulator
/// Sent when the ownership of some star changes. No parameters.
kMsgStarOwnershipChanged = 0x55BD8F7,

/// Simulator::DoCinematicActionMessage ; sent to execute a single action within a cinematic stage
kMsgDoCinematicAction = 0x4470A41,
/////////////////
// Scenario Mode
/////////////////

/// Simulator::ScenarioCreatureHealedMessage; called when a creature is healed (either by natural heal rate, or using a medkit) in Scenario mode
kMsgScenarioCreatureHealed = 0x7C789F8,

/// Simulator::ScenarioEnergyConsumedMessage; sent when the player consumes captain energy
kMsgScenarioEnergyConsumed = 0x7C7A52E,

/// No data, called when pressing the undo button in the scenario editor
kMsgScenarioUndo = 0xC9D86390,
/// No data, called when pressing the redo button in the scenario editor
kMsgScenarioRedo = 0xC9D86391,

/// Called when the captain is finished beaming down in scenario mode
kMsgCinematicScenarioBeamDownComplete = 0x078eab55,

/// Removes the avatar from a scenario cutscene
kMsgCinematicScenarioClearAvatar = 0x07b509fe,

/// Called when the size of the talked-to creature or object is being calculated. (TODO: Seems to generate one of 3 values, how to access these?)
kMsgCinematicTalkToSizeSetup = 0x07d0c530,

/// Called when the greeting style of the talked-to creature is being determined. (TODO: Seems to generate one of 5 values, how to access these?)
kMsgCinematicTalkToGreetSetup = 0x07da0410,

/// Called when the textbox style of the talked-to creature or object is being determined. (TODO: Seems to generate one of 5 values, how to access these?)
kMsgCinematicTalkToTextSetup = 0x0754ae8a,

/// Called when the animation style (sentient, animal, epic) of the talked-to creature is being determined. (TODO: Seems to generate one of 3 values, how to access these?)
kMsgCinematicTalkToAnimStyleSetup = 0x07688cad,

/// Called when the animation emotion of the talked-to creature is being determined. (TODO: Seems to generate one of 5 values, how to access these?)
kMsgCinematicTalkToAnimEmotionSetup = 0x07688cad,

/// Called when the page waiting style (wait for next or wait for last) of the talk-to dialogue is being determined (TODO: Seems to generate one of 2 values, how to access these?)
kMsgCinematicTalkToPageSetup = 0x0750d732,

/// Called when the talk-to dialogue skips a blank page
kMsgCinematicTalkToSkipBlankPage = 0x07aaa58c,
};

class IMessageParameters
Expand Down
2 changes: 1 addition & 1 deletion Spore ModAPI/Spore/Simulator/cCityWalls.h
Original file line number Diff line number Diff line change
Expand Up @@ -89,7 +89,7 @@ namespace Simulator
/* 260h */ float mCityHallDiasHeight;
/* 264h */ eastl::intrusive_ptr<cCity> mpCity;
/* 268h */ Vector3 field_268; // 1, 1, 1
/// A matrix teling which building slots are connected to which slots
/// A matrix telling which building slots are connected to which slots
/* 274h */ bool mBuildingLinks[MAX_LAYOUT_SLOTS][MAX_LAYOUT_SLOTS];
/* 338h */ Vector3 mCenterAxis; // not initialized
/* 344h */ uint32_t mStyle; // 0x9181A19
Expand Down
2 changes: 1 addition & 1 deletion Spore ModAPI/Spore/Simulator/cCommunity.h
Original file line number Diff line number Diff line change
Expand Up @@ -77,7 +77,7 @@ namespace Simulator
/* 68h */ virtual void func68h();
/* 6Ch */ virtual cCityWalls* GetCityWalls(); // returns 0
/* 70h */ virtual eastl::vector<ObjectPtr>& GetPopulation();
/* 74h */ virtual int GetPopulationCount(); // returns the count of vector returned by func70h
/* 74h */ virtual int GetPopulationCount(); // returns the count of vector returned by GetPopulation()
/* 78h */ virtual void func78h();
/* 7Ch */ virtual eastl::string16& GetCommunityName();
/* 80h */ virtual void func80h();
Expand Down
11 changes: 6 additions & 5 deletions Spore ModAPI/Spore/Simulator/cTribe.h
Original file line number Diff line number Diff line change
Expand Up @@ -73,9 +73,10 @@ namespace Simulator
/// Returns a vector of all selectable members of the tribe
/* 94h */ virtual eastl::vector<cSpatialObjectPtr>& GetSelectableMembers();
/* 98h */ virtual cCreatureCitizen* SpawnMember(int);
/* 9Ch */ virtual void func9Ch(int, bool);
/// Removes a member of the tribe. index seems to cause issues if not 0.
/* 9Ch */ virtual void func9Ch(int index, bool);
/// Calls func9Ch() with second parameter true
/* A0h */ virtual void funcA0h(int);
/* A0h */ virtual void funcA0h(int index);
/* A4h */ virtual int GetTotalFood();
/* A8h */ virtual void funcA8h();
/* ACh */ virtual cTribeHut* GetHut();
Expand Down Expand Up @@ -139,7 +140,7 @@ namespace Simulator
/* 36Ch */ eastl::vector<cTribeToolPtr> mTools;
/* 380h */ eastl::vector<cTribeToolPtr> mSocialTools;
/* 394h */ eastl::hash_map<int, cCommunityLayout> field_394;
/* 3B4h */ cCommunityLayout field_3B4;
/* 3B4h */ cCommunityLayout mTribeLayout;
/* 418h */ eastl::fixed_vector<int, 45> field_418;
/* 4E4h */ eastl::hash_map<int, eastl::deque<ObjectPtr>> field_4E4;
/* 504h */ int field_504; // not initialized
Expand All @@ -150,7 +151,7 @@ namespace Simulator
/* 550h */ int mTribeArchetype; //TODO
/* 554h */ bool field_554;
/* 555h */ bool field_555;
/* 556h */ bool field_556;
/* 556h */ bool mbMembersFlee; // if true, creatures run away in fear
/* 557h */ bool mGoodyPopped;
/* 558h */ char _padding_558[0x1310];
/* 1868h */ int field_1868;
Expand All @@ -173,7 +174,7 @@ namespace Simulator
/* 18A4h */ int field_18A4; // -1
/* 18A8h */ bool field_18A8;
/* 18A9h */ bool field_18A9;
/* 18ACh */ int field_18AC; // not initialized
/* 18ACh */ uint32_t field_18AC; // not initialized
/* 18B0h */ int field_18B0;
/* 18B4h */ int field_18B4;
/* 18B8h */ int field_18B8;
Expand Down
7 changes: 6 additions & 1 deletion Spore ModAPI/Spore/UTFWin/IButton.h
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ namespace UTFWin
kBtnFlagFixedHeight = 0x00000004
};

/// Flags relted to the state of a button that can be set to an UTFWin::IButton.
/// Flags related to the state of a button that can be set to an UTFWin::IButton.
enum ButtonStateFlags
{
kBtnStateSelected = 4
Expand Down Expand Up @@ -177,6 +177,11 @@ namespace UTFWin
/// @param format
/* 6Ch */ virtual void SetTextOutline(OutlineFormat& format) = 0;

/// Custom method that sets if the button is pressed or not.
void SetButtonPressed(bool bValue);
/// Custom method that returns if the button is pressed or not.
bool IsButtonPressed();


static IButton* Create();
};
Expand Down
2 changes: 1 addition & 1 deletion Spore ModAPI/Spore/UTFWin/IWindow.h
Original file line number Diff line number Diff line change
Expand Up @@ -176,7 +176,7 @@ namespace UTFWin
/* 4Ch */ virtual int func19() const = 0;

///
/// Sets the unique ID of this object. This ID is used to identfy windows, as it is the one used by FindWindowByID().
/// Sets the unique ID of this object. This ID is used to identify windows, as it is the one used by FindWindowByID().
/// This ID can also be used on message handling, to check what window raised the message.
/// @param controlID The new value of the 'controlID' property.
///
Expand Down

0 comments on commit 6a332bb

Please sign in to comment.