From 4a4e52a2527b23cc4047cf52d4b5fc65f001980f Mon Sep 17 00:00:00 2001 From: Allison Ghost Date: Thu, 10 Oct 2024 09:47:18 -0700 Subject: [PATCH] Simulator Messages, Typo fixes, Tribe documentation, button funcs (#73) * add function definition for AddCreature * Add MouthTypes to CommonIDs.h * Add name for Unk10 in enum CreaturePersonality * Add definitions to Cursors.h * Fix typo, remove duplicate of auto_METHOD(cEditor, bool, AddCreature, add comment to funcC0h in cTribe.h * Add enum of identity colors to cIdentityColorable * Add several more cursors * ammend comment * remove mouthtypes commit * Add space game cursors * fix compile error in cursors.h * remove erroneous comment * change mIDColorID to use IdentityColors * Add 2 new dev cheats (devEffectLog & PrintCursor), add support for palette subcategories in part icon capture. NOTE: UNTESTED! For those who can, please compile this and test it ingame before accepting/rejecting PR. * fix improper effects detour * document several part unlocking related fields * add comment to cCollectibleItems::sub_597BC0 * Add cursors, Document string format for CursorManager::Load * fix typo * Add Math::GetDistance * Revert "Add Math::GetDistance" This reverts commit cc145adc60fd44f4152fc10adb26073bd5a0e30e. * Begin redoing EP1 object system * Revert "change mIDColorID to use IdentityColors" This reverts commit 489f3ad9e1a5f1c6d2c9c2d1bf8a8757d2179e23. * Update cIdentityColorable.h * cTribeHut - Document field_218 * cTribeHut - document field_21C * Resolve 4/5 PR change requests * add 'class' to identitycolor enum * SpawnNpcTribe's 4rd interger arg = foodAmount * fix typo * fix typo in LoadBackgroundFiles * Add message enums to SimulatorMessages.h, organize by stage * fix typo * Clarify new simulator messages * Clarify more messages * Add messages, change 1 type * Update SimulatorMessages.h * Update SimulatorMessages.h * fix typo * Document tribe vars * Document cTribe.mbMembersFlee, add Button funcs, fix documentation comments * Annotate unknown func * Resolve PR issues * Revert cTribeTool temp fix --- .../SourceCode/DLL/AddressesEditors.cpp | 1 + .../SourceCode/Editors/EditorPlayMode.cpp | 2 +- Spore ModAPI/SourceCode/UTFWin/Window.cpp | 11 ++ .../Spore/Editors/PlayModeBackgrounds.h | 5 +- Spore ModAPI/Spore/Palettes/StandardItemUI.h | 2 +- .../Spore/Simulator/SimulatorMessages.h | 179 ++++++++++++++++-- Spore ModAPI/Spore/Simulator/cCityWalls.h | 2 +- Spore ModAPI/Spore/Simulator/cCommunity.h | 2 +- Spore ModAPI/Spore/Simulator/cTribe.h | 11 +- Spore ModAPI/Spore/UTFWin/IButton.h | 7 +- Spore ModAPI/Spore/UTFWin/IWindow.h | 2 +- 11 files changed, 198 insertions(+), 26 deletions(-) diff --git a/Spore ModAPI/SourceCode/DLL/AddressesEditors.cpp b/Spore ModAPI/SourceCode/DLL/AddressesEditors.cpp index e6553820..bd3f3a74 100644 --- a/Spore ModAPI/SourceCode/DLL/AddressesEditors.cpp +++ b/Spore ModAPI/SourceCode/DLL/AddressesEditors.cpp @@ -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)); diff --git a/Spore ModAPI/SourceCode/Editors/EditorPlayMode.cpp b/Spore ModAPI/SourceCode/Editors/EditorPlayMode.cpp index 9c3c3c94..2fd30c5b 100644 --- a/Spore ModAPI/SourceCode/Editors/EditorPlayMode.cpp +++ b/Spore ModAPI/SourceCode/Editors/EditorPlayMode.cpp @@ -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, diff --git a/Spore ModAPI/SourceCode/UTFWin/Window.cpp b/Spore ModAPI/SourceCode/UTFWin/Window.cpp index 7245d308..f8704ea7 100644 --- a/Spore ModAPI/SourceCode/UTFWin/Window.cpp +++ b/Spore ModAPI/SourceCode/UTFWin/Window.cpp @@ -20,6 +20,7 @@ #include #include #include +#include #include #include #include @@ -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; + } } diff --git a/Spore ModAPI/Spore/Editors/PlayModeBackgrounds.h b/Spore ModAPI/Spore/Editors/PlayModeBackgrounds.h index a78a7fe0..61e45a30 100644 --- a/Spore ModAPI/Spore/Editors/PlayModeBackgrounds.h +++ b/Spore ModAPI/Spore/Editors/PlayModeBackgrounds.h @@ -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); @@ -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 diff --git a/Spore ModAPI/Spore/Palettes/StandardItemUI.h b/Spore ModAPI/Spore/Palettes/StandardItemUI.h index 6c400ae4..1881c513 100644 --- a/Spore ModAPI/Spore/Palettes/StandardItemUI.h +++ b/Spore ModAPI/Spore/Palettes/StandardItemUI.h @@ -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; diff --git a/Spore ModAPI/Spore/Simulator/SimulatorMessages.h b/Spore ModAPI/Spore/Simulator/SimulatorMessages.h index 2a16f4b6..caff5595 100644 --- a/Spore ModAPI/Spore/Simulator/SimulatorMessages.h +++ b/Spore ModAPI/Spore/Simulator/SimulatorMessages.h @@ -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, @@ -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, @@ -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. @@ -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 diff --git a/Spore ModAPI/Spore/Simulator/cCityWalls.h b/Spore ModAPI/Spore/Simulator/cCityWalls.h index 7c4a54c3..25c04814 100644 --- a/Spore ModAPI/Spore/Simulator/cCityWalls.h +++ b/Spore ModAPI/Spore/Simulator/cCityWalls.h @@ -89,7 +89,7 @@ namespace Simulator /* 260h */ float mCityHallDiasHeight; /* 264h */ eastl::intrusive_ptr 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 diff --git a/Spore ModAPI/Spore/Simulator/cCommunity.h b/Spore ModAPI/Spore/Simulator/cCommunity.h index f7d3578d..e1f790bb 100644 --- a/Spore ModAPI/Spore/Simulator/cCommunity.h +++ b/Spore ModAPI/Spore/Simulator/cCommunity.h @@ -77,7 +77,7 @@ namespace Simulator /* 68h */ virtual void func68h(); /* 6Ch */ virtual cCityWalls* GetCityWalls(); // returns 0 /* 70h */ virtual eastl::vector& 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(); diff --git a/Spore ModAPI/Spore/Simulator/cTribe.h b/Spore ModAPI/Spore/Simulator/cTribe.h index c4b874f2..aad0674b 100644 --- a/Spore ModAPI/Spore/Simulator/cTribe.h +++ b/Spore ModAPI/Spore/Simulator/cTribe.h @@ -73,9 +73,10 @@ namespace Simulator /// Returns a vector of all selectable members of the tribe /* 94h */ virtual eastl::vector& GetSelectableMembers(); /* 98h */ virtual cCreatureCitizen* SpawnMember(); - /* 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(); @@ -137,7 +138,7 @@ namespace Simulator /* 36Ch */ eastl::vector mTools; /* 380h */ eastl::vector mSocialTools; /* 394h */ eastl::hash_map field_394; - /* 3B4h */ cCommunityLayout field_3B4; + /* 3B4h */ cCommunityLayout mTribeLayout; /* 418h */ eastl::fixed_vector field_418; /* 4E4h */ eastl::hash_map> field_4E4; /* 504h */ int field_504; // not initialized @@ -148,7 +149,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; @@ -171,7 +172,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; diff --git a/Spore ModAPI/Spore/UTFWin/IButton.h b/Spore ModAPI/Spore/UTFWin/IButton.h index 9c9207c4..b76572f1 100644 --- a/Spore ModAPI/Spore/UTFWin/IButton.h +++ b/Spore ModAPI/Spore/UTFWin/IButton.h @@ -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 @@ -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(); }; diff --git a/Spore ModAPI/Spore/UTFWin/IWindow.h b/Spore ModAPI/Spore/UTFWin/IWindow.h index c2f30b40..18a691f6 100644 --- a/Spore ModAPI/Spore/UTFWin/IWindow.h +++ b/Spore ModAPI/Spore/UTFWin/IWindow.h @@ -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. ///