mirror of
https://github.com/AquariaOSE/Aquaria.git
synced 2024-11-25 09:44:02 +00:00
More fixes for breakage introduced in 70b8dcdc3a
:
- fix typo that broke repeat-scale loading - fix broken tile effects loading - fix randomly shuffled world map tiles (as textures were loaded in a random order) - reload tileset on editor reload (because we want to edit textures duh)
This commit is contained in:
parent
478857f149
commit
825670f651
4 changed files with 19 additions and 6 deletions
|
@ -227,6 +227,7 @@ Game::Game() : StateObject()
|
|||
cookingScript = 0;
|
||||
doScreenTrans = false;
|
||||
noSceneTransitionFadeout = false;
|
||||
fullTilesetReload = false;
|
||||
}
|
||||
|
||||
Game::~Game()
|
||||
|
@ -1725,7 +1726,7 @@ bool Game::loadSceneXML(std::string scene)
|
|||
struct ElementDef
|
||||
{
|
||||
ElementDef(int lr)
|
||||
: layer(lr), idx(0), x(0), y(0), rot(0), fh(0), fv(0), flags(0), efxIdx(0), repeat(0)
|
||||
: layer(lr), idx(0), x(0), y(0), rot(0), fh(0), fv(0), flags(0), efxIdx(-1), repeat(0)
|
||||
, tag(0), sx(1), sy(1), rsx(1), rsy(1)
|
||||
{}
|
||||
|
||||
|
@ -1838,7 +1839,7 @@ bool Game::loadSceneXML(std::string scene)
|
|||
ElementDef& d = elemsDefs[i];
|
||||
if(d.repeat)
|
||||
{
|
||||
if(!(is >> d.rsx >> d.rsx))
|
||||
if(!(is >> d.rsx >> d.rsy))
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
@ -1856,6 +1857,14 @@ bool Game::loadSceneXML(std::string scene)
|
|||
simpleElements = simpleElements->NextSiblingElement("SE");
|
||||
}
|
||||
|
||||
if(fullTilesetReload)
|
||||
{
|
||||
fullTilesetReload = false;
|
||||
// used by SceneEditor
|
||||
// no elements exist right now -> textures will be cleared and reloaded
|
||||
dsq->texmgr.clearUnused();
|
||||
}
|
||||
|
||||
// figure out which textures in the tileset are used and preload those that are actually used
|
||||
{
|
||||
unsigned char usedIdx[1024] = {0};
|
||||
|
@ -1904,8 +1913,7 @@ bool Game::loadSceneXML(std::string scene)
|
|||
e->rotation.z = d.rot;
|
||||
e->repeatToFillScale.x = d.rsx;
|
||||
e->repeatToFillScale.y = d.rsy;
|
||||
if(d.efxIdx)
|
||||
e->setElementEffectByIndex(d.efxIdx);
|
||||
e->setElementEffectByIndex(d.efxIdx);
|
||||
if (d.repeat)
|
||||
e->repeatTextureToFill(true); // also applies repeatToFillScale
|
||||
e->setTag(d.tag);
|
||||
|
|
|
@ -350,6 +350,7 @@ public:
|
|||
bool loadingScene;
|
||||
bool doScreenTrans;
|
||||
bool noSceneTransitionFadeout;
|
||||
bool fullTilesetReload;
|
||||
|
||||
WaterSurfaceRender *waterSurfaceRender;
|
||||
|
||||
|
|
|
@ -1817,6 +1817,7 @@ void SceneEditor::loadSceneByName()
|
|||
if (!s.empty())
|
||||
{
|
||||
game->noSceneTransitionFadeout = true;
|
||||
game->fullTilesetReload = true;
|
||||
game->transitionToScene(s);
|
||||
}
|
||||
}
|
||||
|
@ -1825,6 +1826,7 @@ void SceneEditor::reloadScene()
|
|||
{
|
||||
debugLog("reloadScene");
|
||||
game->noSceneTransitionFadeout = true;
|
||||
game->fullTilesetReload = true;
|
||||
game->positionToAvatar = game->avatar->position;
|
||||
game->transitionToScene(game->sceneName);
|
||||
}
|
||||
|
|
|
@ -8,13 +8,14 @@
|
|||
|
||||
struct TexLoadTmp
|
||||
{
|
||||
TexLoadTmp() : loadmode(TextureMgr::KEEP), curTex(NULL), success(false) { img.pixels = NULL; }
|
||||
TexLoadTmp() : loadmode(TextureMgr::KEEP), curTex(NULL), success(false), arrayidx(0) { img.pixels = NULL; }
|
||||
std::string name, filename;
|
||||
ImageData img;
|
||||
TextureMgr::LoadMode loadmode;
|
||||
Texture *curTex; // immutable
|
||||
bool success; // if this is true and img.pixels is NULL, don't change anything
|
||||
//bool mipmap;
|
||||
size_t arrayidx;
|
||||
};
|
||||
|
||||
typedef ImageData (*ImageLoadFunc)(const char *fn);
|
||||
|
@ -289,6 +290,7 @@ void TextureMgr::loadBatch(Texture * pdst[], const std::string texnames[], size_
|
|||
for(size_t i = 0; i < n; ++i)
|
||||
{
|
||||
TexLoadTmp& tt = tmp[i];
|
||||
tt.arrayidx = i;
|
||||
tt.name = texnames[i];
|
||||
stringToLower(tt.name);
|
||||
TexCache::iterator it = cache.find(tt.name);
|
||||
|
@ -315,7 +317,7 @@ void TextureMgr::loadBatch(Texture * pdst[], const std::string texnames[], size_
|
|||
TexLoadTmp& tt = *(TexLoadTmp*)p;
|
||||
Texture *tex = finalize(tt);
|
||||
if(pdst)
|
||||
pdst[i] = tex;
|
||||
pdst[tt.arrayidx] = tex;
|
||||
if(cb)
|
||||
cb(++doneCB, cbUD);
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue