Skip to content

Commit

Permalink
mod loading stuff
Browse files Browse the repository at this point in the history
fix [LT] in language file to [ZL] (nintendo)

Signed-off-by: SheridanR <sheridan.rathbun@gmail.com>
  • Loading branch information
SheridanR committed Sep 25, 2023
1 parent b73871f commit ff5a79f
Show file tree
Hide file tree
Showing 5 changed files with 30 additions and 23 deletions.
2 changes: 1 addition & 1 deletion src/files.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,7 @@ HolidayTheme getCurrentHoliday() {
if (month == 10 || (month == 11 && day == 1)) {
return HolidayTheme::THEME_HALLOWEEN;
}
else if ((month == 11 && day >= 24) || (month == 12) || (month == 1 && day == 1)) {
else if (month == 12 || (month == 1 && day == 1)) {
return HolidayTheme::THEME_XMAS;
}
else {
Expand Down
12 changes: 3 additions & 9 deletions src/init.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -145,11 +145,8 @@ bool remountBaseDataFolders() {
// then mount base data folders
success = mountBaseDataFolders() ? success : false;

// now mount any desired mods
success = Mods::mountAllExistingPaths() ? success : false;

// and reload all content!
Mods::loadMods();
// reload files
Mods::unloadMods(true);

return success;
#endif
Expand Down Expand Up @@ -920,10 +917,7 @@ int Language::loadLanguage(char const * const lang, bool forceLoadBaseDirectory)
languageCode = lang;

tmpEntries.clear();
if ( forceLoadBaseDirectory )
{
entries.clear();
}
entries.clear();

// read file
Uint32 line;
Expand Down
35 changes: 24 additions & 11 deletions src/mod_tools.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -8267,7 +8267,7 @@ void Mods::loadModels(int start, int end) {
generateVBOs(start, end);
}

void Mods::unloadMods()
void Mods::unloadMods(bool force)
{
#ifndef EDITOR
isLoading = true;
Expand All @@ -8284,8 +8284,21 @@ void Mods::unloadMods()

updateLoadingScreen(10);
doLoadingScreen();

if ( Mods::modelsListRequiresReloadUnmodded || !Mods::modelsListModifiedIndexes.empty() )

if (force) {
modelsListModifiedIndexes.clear();
for (int c = 0; c < nummodels; ++c) {
modelsListModifiedIndexes.push_back(c);
}
for (int c = 0; c < numsounds; ++c) {
soundsListModifiedIndexes.push_back(c);
}
for (const auto& pair : systemResourceImages) {
Mods::systemResourceImagesToReload.push_back(pair);
}
}

if ( force || Mods::modelsListRequiresReloadUnmodded || !Mods::modelsListModifiedIndexes.empty() )
{
int modelsIndexUpdateStart = 1;
int modelsIndexUpdateEnd = nummodels;
Expand All @@ -8304,7 +8317,7 @@ void Mods::unloadMods()
updateLoadingScreen(20);
doLoadingScreen();

if ( Mods::soundListRequiresReloadUnmodded || !Mods::soundsListModifiedIndexes.empty() )
if ( force || Mods::soundListRequiresReloadUnmodded || !Mods::soundsListModifiedIndexes.empty() )
{
physfsReloadSounds(true);
Mods::soundListRequiresReloadUnmodded = false;
Expand All @@ -8315,7 +8328,7 @@ void Mods::unloadMods()
updateLoadingScreen(30);
doLoadingScreen();

if ( Mods::tileListRequireReloadUnmodded )
if ( force || Mods::tileListRequireReloadUnmodded )
{
physfsReloadTiles(true);
Mods::tileListRequireReloadUnmodded = false;
Expand All @@ -8324,7 +8337,7 @@ void Mods::unloadMods()
updateLoadingScreen(40);
doLoadingScreen();

if ( Mods::spriteImagesRequireReloadUnmodded )
if ( force || Mods::spriteImagesRequireReloadUnmodded )
{
physfsReloadSprites(true);
Mods::spriteImagesRequireReloadUnmodded = false;
Expand All @@ -8333,7 +8346,7 @@ void Mods::unloadMods()
updateLoadingScreen(50);
doLoadingScreen();

if ( Mods::booksRequireReloadUnmodded )
if ( force || Mods::booksRequireReloadUnmodded )
{
physfsReloadBooks();
Mods::booksRequireReloadUnmodded = false;
Expand All @@ -8342,7 +8355,7 @@ void Mods::unloadMods()
updateLoadingScreen(60);
doLoadingScreen();

if ( Mods::musicRequireReloadUnmodded )
if ( force || Mods::musicRequireReloadUnmodded )
{
gamemodsUnloadCustomThemeMusic();
bool reloadIntroMusic = false;
Expand All @@ -8359,7 +8372,7 @@ void Mods::unloadMods()
updateLoadingScreen(70);
doLoadingScreen();

if ( Mods::langRequireReloadUnmodded )
if ( force || Mods::langRequireReloadUnmodded )
{
Language::reset();
Language::reloadLanguage();
Expand All @@ -8369,7 +8382,7 @@ void Mods::unloadMods()
updateLoadingScreen(80);
doLoadingScreen();

if ( Mods::monsterLimbsRequireReloadUnmodded )
if ( force || Mods::monsterLimbsRequireReloadUnmodded )
{
physfsReloadMonsterLimbFiles();
Mods::monsterLimbsRequireReloadUnmodded = false;
Expand All @@ -8378,7 +8391,7 @@ void Mods::unloadMods()
updateLoadingScreen(85);
doLoadingScreen();

if ( Mods::systemImagesReloadUnmodded )
if ( force || Mods::systemImagesReloadUnmodded )
{
physfsReloadSystemImages();
Mods::systemImagesReloadUnmodded = false;
Expand Down
2 changes: 1 addition & 1 deletion src/mod_tools.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -3276,7 +3276,7 @@ struct Mods
static bool clearAllMountedPaths();
static bool removePathFromMountedFiles(std::string findStr);
static bool isPathInMountedFiles(std::string findStr);
static void unloadMods();
static void unloadMods(bool force = false);
static void loadMods();
static void loadModels(int start, int end);
static void verifyAchievements(const char* fullpath, bool ignoreBaseFolder);
Expand Down
2 changes: 1 addition & 1 deletion src/ui/MainMenu.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -2723,7 +2723,7 @@ namespace MainMenu {
*cvar_hold_to_activate = hold_to_activate_enabled;
bool oldDisableHoliday = *cvar_disableHoliday;
*cvar_disableHoliday = !holiday_themes_enabled;
if (oldDisableHoliday != *cvar_disableHoliday) {
if (initialized && oldDisableHoliday != *cvar_disableHoliday) {
(void)remountBaseDataFolders();
}
result |= video.save() ? VideoRefresh::Video : VideoRefresh::None;
Expand Down

0 comments on commit ff5a79f

Please sign in to comment.