mirror of
https://gitlab.com/dosowisko.net/libsuperderpy.git
synced 2025-03-22 02:57:12 +01:00
don't live-reload gamestates that don't come from dynamic libraries
This commit is contained in:
parent
f4ca431238
commit
31f6b8454d
3 changed files with 14 additions and 9 deletions
|
@ -58,6 +58,7 @@ SYMBOL_EXPORT void RegisterGamestate(struct Game* game, const char* name, struct
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
gs->api = api;
|
gs->api = api;
|
||||||
|
gs->fromlib = false;
|
||||||
PrintConsole(game, "Gamestate \"%s\" registered.", name);
|
PrintConsole(game, "Gamestate \"%s\" registered.", name);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -49,6 +49,7 @@ struct Gamestate {
|
||||||
bool frozen;
|
bool frozen;
|
||||||
bool showLoading;
|
bool showLoading;
|
||||||
bool paused;
|
bool paused;
|
||||||
|
bool fromlib;
|
||||||
struct Gamestate* next;
|
struct Gamestate* next;
|
||||||
struct Gamestate_API* api;
|
struct Gamestate_API* api;
|
||||||
ALLEGRO_BITMAP* fb;
|
ALLEGRO_BITMAP* fb;
|
||||||
|
|
|
@ -340,6 +340,7 @@ SYMBOL_INTERNAL struct Gamestate* AllocateGamestate(struct Game* game, const cha
|
||||||
tmp->pending_unload = false;
|
tmp->pending_unload = false;
|
||||||
tmp->next = NULL;
|
tmp->next = NULL;
|
||||||
tmp->api = NULL;
|
tmp->api = NULL;
|
||||||
|
tmp->fromlib = true;
|
||||||
tmp->progressCount = 0;
|
tmp->progressCount = 0;
|
||||||
return tmp;
|
return tmp;
|
||||||
}
|
}
|
||||||
|
@ -543,6 +544,7 @@ SYMBOL_INTERNAL void ResumeExecution(struct Game* game) {
|
||||||
PrintConsole(game, "DEBUG: reloading the gamestates...");
|
PrintConsole(game, "DEBUG: reloading the gamestates...");
|
||||||
struct Gamestate* tmp = game->_priv.gamestates;
|
struct Gamestate* tmp = game->_priv.gamestates;
|
||||||
while (tmp) {
|
while (tmp) {
|
||||||
|
if (tmp->fromlib) {
|
||||||
char* name = strdup(tmp->name);
|
char* name = strdup(tmp->name);
|
||||||
CloseGamestate(game, tmp);
|
CloseGamestate(game, tmp);
|
||||||
tmp->name = name;
|
tmp->name = name;
|
||||||
|
@ -550,10 +552,11 @@ SYMBOL_INTERNAL void ResumeExecution(struct Game* game) {
|
||||||
if (tmp->api->Gamestate_Reload) {
|
if (tmp->api->Gamestate_Reload) {
|
||||||
tmp->api->Gamestate_Reload(game, tmp->data);
|
tmp->api->Gamestate_Reload(game, tmp->data);
|
||||||
}
|
}
|
||||||
if (!tmp->paused && tmp->api->Gamestate_Resume) {
|
|
||||||
tmp->api->Gamestate_Resume(game, tmp->data);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
if (!tmp->paused && tmp->loaded && tmp->api->Gamestate_Resume) {
|
||||||
|
tmp->api->Gamestate_Resume(game, tmp->data);
|
||||||
|
}
|
||||||
tmp = tmp->next;
|
tmp = tmp->next;
|
||||||
}
|
}
|
||||||
game->_priv.paused = false;
|
game->_priv.paused = false;
|
||||||
|
|
Loading…
Add table
Reference in a new issue