From 35b52af0ac340c4eaa4947c85a31c4d96a2335a8 Mon Sep 17 00:00:00 2001 From: fgenesis Date: Mon, 19 Sep 2011 19:38:01 +0200 Subject: [PATCH] ParallaxLock fix + little layer hiding improvement Fixed an oversight where not all parallax layers got their parallaxLock status cleared in case the map file was missing this attribute, or not all affected layers were listed there. The editor does now no longer switch to a layer when hiding it (Alt+Layer key). It is still possible to edit invisible layers, though. --- Aquaria/Game.cpp | 4 ++-- Aquaria/SceneEditor.cpp | 22 ++++++---------------- 2 files changed, 8 insertions(+), 18 deletions(-) diff --git a/Aquaria/Game.cpp b/Aquaria/Game.cpp index 5ee8fc0..d9c4fa9 100644 --- a/Aquaria/Game.cpp +++ b/Aquaria/Game.cpp @@ -6442,7 +6442,7 @@ void Game::applyState() dsq->overlay->color = 0; - for (i = LR_ELEMENTS1; i <= LR_ELEMENTS12; i++) + for (i = LR_ELEMENTS1; i <= LR_ELEMENTS12; i++) // LR_ELEMENTS13 is darkness, stop before that { dsq->game->setElementLayerVisible(i-LR_ELEMENTS1, true); } @@ -6453,7 +6453,7 @@ void Game::applyState() cameraConstrained = true; // reset parallax RenderObjectLayer *l = 0; - for (i = LR_ELEMENTS10; i <= LR_ELEMENTS12; i++) + for (i = LR_ELEMENTS10; i <= LR_ELEMENTS16; i++) { l = &dsq->renderObjectLayers[i]; l->followCamera = 0; diff --git a/Aquaria/SceneEditor.cpp b/Aquaria/SceneEditor.cpp index debf4c2..e17d33e 100644 --- a/Aquaria/SceneEditor.cpp +++ b/Aquaria/SceneEditor.cpp @@ -2499,36 +2499,26 @@ void SceneEditor::action(int id, int state) } else if (editType == ET_ELEMENTS && state && id >= ACTION_BGLAYER1 && id < ACTION_BGLAYEREND) { - /* - std::string copy = action; - copy = copy.substr(std::string("bgLayer").length(), action.length()); - std::istringstream is(copy); - int v; - is >> v; - this->bgLayer = v-1; - */ - - int v = id - ACTION_BGLAYER1; - this->bgLayer = v; + int newLayer = id - ACTION_BGLAYER1; updateText(); if (core->getAltState()) { - dsq->game->setElementLayerVisible(bgLayer, !dsq->game->isElementLayerVisible(bgLayer)); - //core->getRenderObjectLayer(LR_ELEMENTS1+bgLayer)->visible = !core->getRenderObjectLayer(LR_ELEMENTS1+bgLayer)->visible; + dsq->game->setElementLayerVisible(newLayer, !dsq->game->isElementLayerVisible(newLayer)); + return; // do not switch to the layer that was just hidden } else if (core->getShiftState() && (editingElement || !selectedElements.empty())) { - moveElementToLayer(editingElement, bgLayer); - //editingElement->bgLayer - //editingElement->bgLayer = this->bgLayer; + moveElementToLayer(editingElement, newLayer); } else { selectedElements.clear(); } + this->bgLayer = newLayer; + } /* Vector multiSelectPoint, secondMultiSelectPoint;