From: Holger Schemel Date: Thu, 30 Aug 2018 19:46:11 +0000 (+0200) Subject: added (and set) identifier and level number to global levelset structure X-Git-Tag: 4.1.1.0~48 X-Git-Url: https://git.artsoft.org/?a=commitdiff_plain;h=796c49130a11576aeb603104bdd25a6020598761;p=rocksndiamonds.git added (and set) identifier and level number to global levelset structure --- diff --git a/src/init.c b/src/init.c index ad660e35..6db427ff 100644 --- a/src/init.c +++ b/src/init.c @@ -5489,6 +5489,8 @@ static void InitLevelInfo() if (leveldir_current == NULL) leveldir_current = getFirstValidTreeInfoEntry(leveldir_first); } + + SetLevelSetInfo(leveldir_current->identifier, level_nr); } static void InitLevelArtworkInfo() diff --git a/src/libgame/system.h b/src/libgame/system.h index 76169efa..29a98017 100644 --- a/src/libgame/system.h +++ b/src/libgame/system.h @@ -1569,6 +1569,9 @@ struct MouseActionInfo struct LevelSetInfo { int music[MAX_LEVELS]; + + char *identifier; + int level_nr; }; struct LevelStats diff --git a/src/network.c b/src/network.c index 57480978..bf12567b 100644 --- a/src/network.c +++ b/src/network.c @@ -694,6 +694,8 @@ static void Handle_OP_START_PLAYING() level_nr = new_level_nr; } + SetLevelSetInfo(new_leveldir_identifier, new_level_nr); + /* needed if level set of network game changed graphics, sounds or music */ ReloadCustomArtwork(0); diff --git a/src/screens.c b/src/screens.c index 337bd565..4ee8179d 100644 --- a/src/screens.c +++ b/src/screens.c @@ -1591,6 +1591,8 @@ void DrawMainMenu() init_last = init; /* switch to new busy animation */ + SetLevelSetInfo(leveldir_current->identifier, level_nr); + /* needed if last screen (level choice) changed graphics, sounds or music */ ReloadCustomArtwork(0); diff --git a/src/tools.c b/src/tools.c index db2e193a..e6f09e1c 100644 --- a/src/tools.c +++ b/src/tools.c @@ -9391,6 +9391,13 @@ void ResetFontStatus() SetFontStatus(-1); } +void SetLevelSetInfo(char *identifier, int level_nr) +{ + setString(&levelset.identifier, identifier); + + levelset.level_nr = level_nr; +} + boolean CheckIfPlayfieldViewportHasChanged() { // if game status has not changed, playfield viewport has not changed either diff --git a/src/tools.h b/src/tools.h index a5e348a6..b67f23b0 100644 --- a/src/tools.h +++ b/src/tools.h @@ -278,6 +278,8 @@ void SetGameStatus(int); void SetFontStatus(int); void ResetFontStatus(); +void SetLevelSetInfo(char *, int); + void ToggleFullscreenOrChangeWindowScalingIfNeeded(); void ChangeViewportPropertiesIfNeeded();