# HG changeset patch # User kasoroth # Date 1297641034 18000 # Node ID a923c372e54d72ccc05ddce65cb1314c5595c064 # Parent f08b7288f92c8311b52545aa7225857a153d008c Updated loadSkin so that only the file name (not the whole path) is converted to lower case. This fixes skin loading on case sensitive file systems with capital letters in the path. diff -r f08b7288f92c -r a923c372e54d BBGE/SkeletalSprite.cpp --- a/BBGE/SkeletalSprite.cpp Wed Jun 16 15:56:18 2010 -0400 +++ b/BBGE/SkeletalSprite.cpp Sun Feb 13 18:50:34 2011 -0500 @@ -1135,20 +1135,20 @@ { TiXmlDocument d; + std::string fnl = fn; + stringToLower(fnl); std::string file; if (!secondaryAnimationPath.empty()) { - file = secondaryAnimationPath + skinPath + fn + ".xml"; + file = secondaryAnimationPath + skinPath + fnl + ".xml"; } if (file.empty() || !exists(file, false)) { - file = animationPath + skinPath + fn + ".xml"; + file = animationPath + skinPath + fnl + ".xml"; } - stringToLower(file); - if (!exists(file,1)) { errorLog("Could not load skin[" + file + "]"); # HG changeset patch # User kasoroth # Date 1297739385 18000 # Node ID 088d604f7ec358421bdd296f4c2e3c5cd8230ec1 # Parent a923c372e54d72ccc05ddce65cb1314c5595c064 Allow loading of treasures.txt, stringbank.txt, and menu-treasures.lua from a mod instead of the main game folders. Also allow number of pages on the treasure menu to be calculated from the actual number of entries in treasures.txt, instead of locked at a constant 32 treasures, and fix the calculation for displaying the max page number. diff -r a923c372e54d -r 088d604f7ec3 Aquaria/Continuity.cpp --- a/Aquaria/Continuity.cpp Sun Feb 13 18:50:34 2011 -0500 +++ b/Aquaria/Continuity.cpp Mon Feb 14 22:09:45 2011 -0500 @@ -859,7 +859,15 @@ std::string line, gfx; int num, use; float sz; - std::ifstream in2("data/treasures.txt"); + std::ifstream in2; + + if (dsq->mod.isActive()) { + in2.open( (dsq->mod.getPath() + "data/treasures.txt").c_str() ); + if( !in2.is_open() ) in2.open("data/treasures.txt"); + } + else + in2.open("data/treasures.txt"); + while (std::getline(in2, line)) { std::istringstream is(line); diff -r a923c372e54d -r 088d604f7ec3 Aquaria/Game.cpp --- a/Aquaria/Game.cpp Sun Feb 13 18:50:34 2011 -0500 +++ b/Aquaria/Game.cpp Mon Feb 14 22:09:45 2011 -0500 @@ -826,8 +826,13 @@ if (doubleClickTimer > 0) { doubleClickTimer = 0; - - dsq->runScriptNum("scripts/global/menu-treasures.lua", "useTreasure", flag); + + if (dsq->mod.isActive()) { + if( !dsq->runScriptNum(dsq->mod.getPath() + "scripts/menu-treasures.lua", "useTreasure", flag) ) + dsq->runScriptNum("scripts/global/menu-treasures.lua", "useTreasure", flag); + } + else + dsq->runScriptNum("scripts/global/menu-treasures.lua", "useTreasure", flag); } else { @@ -7115,10 +7120,9 @@ return false; } -const int numTreasures = 16*2; - void Game::onPrevTreasurePage() { + int numTreasures = dsq->continuity.treasureData.size(); if ((treasurePage-1) * treasurePageSize >= 0) { dsq->sound->playSfx("menu-switch", 0.5); @@ -7141,6 +7145,7 @@ void Game::onNextTreasurePage() { + int numTreasures = dsq->continuity.treasureData.size(); if ((treasurePage+1)*treasurePageSize < numTreasures) { dsq->sound->playSfx("menu-switch", 0.5); @@ -7223,7 +7228,12 @@ if (selectedTreasureFlag != -1) { - dsq->runScriptNum("scripts/global/menu-treasures.lua", "useTreasure", selectedTreasureFlag); + if (dsq->mod.isActive()) { + if( !dsq->runScriptNum(dsq->mod.getPath() + "scripts/menu-treasures.lua", "useTreasure", selectedTreasureFlag) ) + dsq->runScriptNum("scripts/global/menu-treasures.lua", "useTreasure", selectedTreasureFlag); + } + else + dsq->runScriptNum("scripts/global/menu-treasures.lua", "useTreasure", selectedTreasureFlag); } } @@ -9747,8 +9757,9 @@ } if (treasureMenu) { + int numTreasures = dsq->continuity.treasureData.size(); std::ostringstream os; - os << (treasurePage+1) << "/" << (numTreasures/treasurePageSize); + os << (treasurePage+1) << "/" << (((numTreasures-1)/treasurePageSize)+1); circlePageNum->setText(os.str()); } // HACK: move this later diff -r a923c372e54d -r 088d604f7ec3 Aquaria/StringBank.cpp --- a/Aquaria/StringBank.cpp Sun Feb 13 18:50:34 2011 -0500 +++ b/Aquaria/StringBank.cpp Mon Feb 14 22:09:45 2011 -0500 @@ -29,7 +29,14 @@ //debugLog("StringBank::load("+file+")"); stringMap.clear(); - std::ifstream in(file.c_str()); + std::ifstream in; + + if (dsq->mod.isActive()) { + in.open( (dsq->mod.getPath() + file).c_str() ); + if( !in.is_open() ) in.open( file.c_str() ); + } + else + in.open( file.c_str() ); std::string line; int idx;