Skip to content

Commit 5913de9

Browse files
authored
New Thumbnail_cImportExport function and expanded cScenarioPlayMode documentation (#49)
* New `Thumbnail_cImportExport` function and expanded `cScenarioPlayMode` documentation * Applied suggested changes to #49 - Renamed ReadPNG to ImportPNG - Created enum class ScenarioPlayModeState - Reverted back some changes to comments in cScenarioPlayMode.h
1 parent 42028ec commit 5913de9

File tree

5 files changed

+51
-12
lines changed

5 files changed

+51
-12
lines changed

Spore ModAPI/SourceCode/App/App.cpp

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,8 @@ namespace App
2222
bool forceReplace, bool disableSteganography),
2323
Args(pResource, pImage, pDBPF, forceReplace, disableSteganography));
2424

25+
auto_METHOD(Thumbnail_cImportExport, bool, ImportPNG,
26+
Args(const char16_t* path, ResourceKey& key), Args(path, key));
2527

2628

2729
auto_STATIC_METHOD_(cIDGenerator, cIDGenerator*, Get);

Spore ModAPI/SourceCode/DLL/AddressesApp.cpp

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -405,6 +405,7 @@ namespace App
405405
DefineAddress(GetFolderPath, SelectAddress(0x5F9140, 0x5F92C0));
406406
DefineAddress(FolderPathFromLocale, SelectAddress(0x5F9220, 0x5F93A0));
407407
DefineAddress(SavePNG, SelectAddress(0x5FA7E0, 0x5FA960));
408+
DefineAddress(ImportPNG, SelectAddress(0x5FC240, 0x5FC3C0));
408409
}
409410

410411
namespace Addresses(cLocaleManager)

Spore ModAPI/Spore/App/Thumbnail_cImportExport.h

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -51,6 +51,13 @@ namespace App
5151
bool SavePNG(Resource::ResourceObject* pResource, RenderWare::Raster* pImage, Resource::Database* database,
5252
bool forceReplace = false, bool disableSteganography = false);
5353

54+
/// Reads the PNG file from the given file path, and adds the creation found within to the Sporepedia if it hasn't been added yet.
55+
///
56+
/// @param path The full path to the file being read.
57+
/// @param key Resource key to the creation being read.
58+
/// @returns 'true' on success, 'false' if something failed.
59+
bool ImportPNG(const char16_t* path, ResourceKey& key);
60+
5461
static Thumbnail_cImportExport* Get();
5562

5663
// Not finished yet, but it's not important
@@ -70,5 +77,6 @@ namespace App
7077
DeclareAddress(GetFolderPath);
7178
DeclareAddress(FolderPathFromLocale);
7279
DeclareAddress(SavePNG);
80+
DeclareAddress(ImportPNG);
7381
}
7482
}

Spore ModAPI/Spore/Simulator/SimulatorEnums.h

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -550,6 +550,26 @@ namespace Simulator
550550
Defend = 11,
551551
};
552552

553+
/// The different states in which an adventure can be while being played (beginning, active, completed, failed etc).
554+
/// Used by Simulator::cScenarioPlayMode.
555+
enum class ScenarioPlayModeState : int
556+
{
557+
/// When beginning adventure from the editor, it will skip the opening cinematic to immediately begin the adventure.
558+
EditorStart = 0,
559+
/// When the opening cinematic is running.
560+
OpeningCinematic = 1,
561+
/// When loading the adventure from quick play or (presumably) space stage. Opening cinematic will run.
562+
MissionStart = 2,
563+
/// The adventure is currently active.
564+
Active = 3,
565+
/// When the adventure is completed successfully, the victory cinematic will play and Spore points will be rewarded (if eligible).
566+
/// If applicable, the player captain will act joyful and perhaps dance in the results screen as Spore points are rewarded to them.
567+
Completed = 5,
568+
/// If the adventure wasn't successfully cleared, the failure or death cinematic will play, depending on the type of failure.
569+
/// Spore points will not be rewarded, and if applicable, the player captain will appear sad in the results screen.
570+
Failed = 6
571+
572+
};
553573
/// Possible motive (health & hunger) states for a creature; what is considered "low" and "critical" depends on the `MotiveTuning` settings
554574
enum class CreatureMotive : int
555575
{

Spore ModAPI/Spore/Simulator/cScenarioPlayMode.h

Lines changed: 20 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -67,9 +67,12 @@ namespace Simulator
6767
/* 64h */ eastl::vector<cScenarioPlayModeGoal> mCurrentGoals;
6868
/* 78h */ int field_78; // not initialized
6969
/* 7Ch */ App::MessageListenerData mMessageListenerData;
70-
/* 90h */ int field_90; // not initialized, current state? fail reason?
71-
/* 94h */ int field_94; // not initialized
72-
/// The clock activates upon triggering the adventure's end. It counts up to around 2000 units (milliseconds), after which the ending cinematic activates
70+
/// Current state of the adventure play mode.
71+
/// 0 is pre-init in editor play mode, 1 is intro, 2 seems to be pre-init in quick-play, 3 is gameplay, 5 is adventure completed and 6 is adventure failed (death or failed/invalid goals)
72+
/* 90h */ ScenarioPlayModeState mCurrentPlayModeState; // not initialized
73+
/// Controls what state the ending cinematic of the adventure is in. Set to 0 when ending procedure begins, 1 when cinematic activates, and 2 after player leaves the cinematic sequence.
74+
/* 94h */ int mCurrentEndCinematicState; // not initialized
75+
/// The clock activates when mCurrentEndCinematicState is set to 0. It counts up to around 2000 units (milliseconds), after which the ending cinematic activates and mCurrentEndCinematicState is set to 1.
7376
/* 98h */ Clock mCinematicDelay;
7477
/* B0h */ int field_B0; // not initialized
7578
/* B4h */ int field_B4; // not initialized
@@ -80,22 +83,27 @@ namespace Simulator
8083
/// The playtime of the current adventure in milliseconds. It pauses counting when the game is paused, and it records its count to display it at the results screen.
8184
/// If the adventure is shared, it will also be sent to the adventure's high scores in the Spore servers if the player is logged in.
8285
/* C0h */ int mCurrentTimeMS;
83-
/// The amount of Spore points the captain is rewarded at the end of a successful adventure.
84-
/// Not initialized.
85-
/* C4h */ int mAdventurePoints;
86+
/// The amount of Spore points the captain is rewarded at the end of a successful adventure.
87+
/* C4h */ int mAdventurePoints; // not initialized
8688
/* C8h */ int field_C8; // not initialized
8789
/* CCh */ int field_CC; // not initialized
8890
/* D0h */ int field_D0; // not initialized
89-
/* D4h */ int field_D4; // not initialized
91+
/// Index of the dialog box being displayed during talk-to goal cinematic (-1 is the initial fade-in + creature greeting animation, 0 is first dialog box, 1 is second etc.)
92+
/* D4h */ int mCurrentDialogBoxIndex; // not initialized
9093
/* D8h */ int field_D8; // not initialized
91-
/* DCh */ float field_DC;
92-
/* E0h */ Math::Vector3 field_E0;
94+
/// Used for move-to goals. Distance of the nearest target to the player.
95+
/* DCh */ float mDistanceToClosestMoveToTarget;
96+
/// Coordinates of the move-to goal target's location.
97+
/* E0h */ Math::Vector3 mMoveToGoalLocation;
9398
/* ECh */ bool field_EC;
9499
/* F0h */ Audio::AudioTrack mMusicTrack;
95100
/* F4h */ uint32_t mCurrentMusicId;
96-
/* F8h */ float field_F8;
97-
/* FCh */ bool field_FC;
98-
/* FDh */ bool field_FD;
101+
/// The duration the captain fade-in effect is active during intro cutscene. Counts down to 0.
102+
/* F8h */ float mIntroFadeinTimer;
103+
/// Set to true when mIntroFadeinTimer begins counting. Set to false when mIntroBeamdownTimer is less than or equal to 0.
104+
/* FCh */ bool mIsIntroFadeinActive;
105+
/// Initially set to false but set to true when adventure begins.
106+
/* FDh */ bool mIsAdventureActive;
99107
/* 100h */ int field_100;
100108
};
101109
ASSERT_SIZE(cScenarioPlayMode, 0x108);

0 commit comments

Comments
 (0)