mirror of
https://github.com/TombEngine/TombEngine.git
synced 2025-05-02 09:47:58 +03:00
Remove PreSave and make OnSave take place before data is saved.
This commit is contained in:
parent
409cbf41a1
commit
7f13ac0ccd
5 changed files with 3 additions and 15 deletions
|
@ -3146,9 +3146,8 @@ namespace TEN::Gui
|
|||
if (GuiIsSelected())
|
||||
{
|
||||
SoundEffect(SFX_TR4_MENU_CHOOSE, nullptr, SoundEnvironment::Always);
|
||||
g_GameScript->PreSave();
|
||||
SaveGame::Save(SelectedSaveSlot);
|
||||
g_GameScript->OnSave();
|
||||
SaveGame::Save(SelectedSaveSlot);
|
||||
return true;
|
||||
}
|
||||
|
||||
|
|
|
@ -63,7 +63,6 @@ public:
|
|||
virtual void OnStart() = 0;
|
||||
virtual void OnLoad() = 0;
|
||||
virtual void OnControlPhase(float dt) = 0;
|
||||
virtual void PreSave() = 0;
|
||||
virtual void OnSave() = 0;
|
||||
virtual void OnEnd() = 0;
|
||||
virtual void ShortenTENCalls() = 0;
|
||||
|
|
|
@ -28,7 +28,6 @@ static constexpr char ScriptReserved_LevelFunc[] = "LevelFunc";
|
|||
// Built-in LevelFuncs
|
||||
static constexpr char ScriptReserved_OnStart[] = "OnStart";
|
||||
static constexpr char ScriptReserved_OnLoad[] = "OnLoad";
|
||||
static constexpr char ScriptReserved_PreSave[] = "PreSave";
|
||||
static constexpr char ScriptReserved_OnControlPhase[] = "OnControlPhase";
|
||||
static constexpr char ScriptReserved_OnSave[] = "OnSave";
|
||||
static constexpr char ScriptReserved_OnEnd[] = "OnEnd";
|
||||
|
|
|
@ -722,12 +722,6 @@ void LogicHandler::OnControlPhase(float dt)
|
|||
tryCall(name);
|
||||
}
|
||||
|
||||
void LogicHandler::PreSave()
|
||||
{
|
||||
if (m_preSave.valid())
|
||||
doCallback(m_preSave);
|
||||
}
|
||||
|
||||
void LogicHandler::OnSave()
|
||||
{
|
||||
if(m_onSave.valid())
|
||||
|
@ -836,11 +830,10 @@ __The order of loading is as follows:__
|
|||
5. The control loop, in which `OnControlPhase` will be called once per frame, begins.
|
||||
|
||||
@tfield function OnStart Will be called when a level is entered by completing a previous level or by selecting it in the menu. Will not be called when loaded from a saved game.
|
||||
@tfield function OnLoad Will be called whenoa saved game is loaded, just *after* data is loaded
|
||||
@tfield function OnLoad Will be called when a saved game is loaded, just *after* data is loaded
|
||||
@tfield function(float) OnControlPhase Will be called during the game's update loop,
|
||||
and provides the delta time (a float representing game time since last call) via its argument.
|
||||
@tfield function PreSave Will be called when the player saves the game, just *before* data is saved
|
||||
@tfield function OnSave Will be called when the player saves the game, just *after* data is saved
|
||||
@tfield function OnSave Will be called when the player saves the game, just *before* data is saved
|
||||
@tfield function OnEnd Will be called when leaving a level. This includes finishing it, exiting to the menu, or loading a save in a different level.
|
||||
@table LevelFuncs
|
||||
*/
|
||||
|
@ -874,7 +867,6 @@ void LogicHandler::InitCallbacks()
|
|||
assignCB(m_onStart, ScriptReserved_OnStart);
|
||||
assignCB(m_onLoad, ScriptReserved_OnLoad);
|
||||
assignCB(m_onControlPhase, ScriptReserved_OnControlPhase);
|
||||
assignCB(m_preSave, ScriptReserved_PreSave);
|
||||
assignCB(m_onSave, ScriptReserved_OnSave);
|
||||
assignCB(m_onEnd, ScriptReserved_OnEnd);
|
||||
}
|
||||
|
|
|
@ -100,7 +100,6 @@ public:
|
|||
void OnStart() override;
|
||||
void OnLoad() override;
|
||||
void OnControlPhase(float dt) override;
|
||||
void PreSave() override;
|
||||
void OnSave() override;
|
||||
void OnEnd() override;
|
||||
};
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue