mirror of
https://github.com/AquariaOSE/Aquaria.git
synced 2024-11-29 12:03:51 +00:00
Merge branch 'tile-optimization' of github.com:AquariaOSE/Aquaria into tile-optimization
This commit is contained in:
commit
db8912cb16
7 changed files with 34 additions and 5 deletions
|
@ -40,6 +40,7 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
||||||
#include "GLLoad.h"
|
#include "GLLoad.h"
|
||||||
#include "RenderBase.h"
|
#include "RenderBase.h"
|
||||||
#include "Image.h"
|
#include "Image.h"
|
||||||
|
#include "TileRender.h"
|
||||||
|
|
||||||
#include <sys/stat.h>
|
#include <sys/stat.h>
|
||||||
|
|
||||||
|
|
|
@ -458,6 +458,8 @@ public:
|
||||||
void fixupJoysticks();
|
void fixupJoysticks();
|
||||||
void initActionButtons();
|
void initActionButtons();
|
||||||
void importActionButtons();
|
void importActionButtons();
|
||||||
|
|
||||||
|
TileRender *tileRenders[MAX_TILE_LAYERS];
|
||||||
};
|
};
|
||||||
|
|
||||||
extern DSQ *dsq;
|
extern DSQ *dsq;
|
||||||
|
|
|
@ -2491,6 +2491,7 @@ void Game::applyState()
|
||||||
{
|
{
|
||||||
TileRender *tr = new TileRender(dsq->tilemgr.tilestore[i]);
|
TileRender *tr = new TileRender(dsq->tilemgr.tilestore[i]);
|
||||||
addRenderObject(tr, LR_ELEMENTS1 + i);
|
addRenderObject(tr, LR_ELEMENTS1 + i);
|
||||||
|
dsq->tileRenders[i] = tr;
|
||||||
}
|
}
|
||||||
|
|
||||||
for (int i = LR_ELEMENTS1; i <= LR_ELEMENTS12; i++) // LR_ELEMENTS13 is darkness, stop before that
|
for (int i = LR_ELEMENTS1; i <= LR_ELEMENTS12; i++) // LR_ELEMENTS13 is darkness, stop before that
|
||||||
|
|
|
@ -31,7 +31,7 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
||||||
#include "GridRender.h"
|
#include "GridRender.h"
|
||||||
#include "Shot.h"
|
#include "Shot.h"
|
||||||
#include "Tile.h"
|
#include "Tile.h"
|
||||||
|
#include "TileRender.h"
|
||||||
|
|
||||||
#ifdef BBGE_BUILD_WINDOWS
|
#ifdef BBGE_BUILD_WINDOWS
|
||||||
#define WIN32_LEAN_AND_MEAN
|
#define WIN32_LEAN_AND_MEAN
|
||||||
|
@ -1678,6 +1678,11 @@ void SceneEditor::setActiveLayer(unsigned bglayer)
|
||||||
if(this->bgLayer == bglayer)
|
if(this->bgLayer == bglayer)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
|
for(size_t i = 0; i < MAX_TILE_LAYERS; ++i)
|
||||||
|
dsq->tileRenders[i]->renderBorders = false;
|
||||||
|
|
||||||
|
dsq->tileRenders[bglayer]->renderBorders = true;
|
||||||
|
|
||||||
destroyMultiTileHelper();
|
destroyMultiTileHelper();
|
||||||
clearSelection();
|
clearSelection();
|
||||||
this->bgLayer = bglayer;
|
this->bgLayer = bglayer;
|
||||||
|
@ -1697,12 +1702,14 @@ void SceneEditor::action(int id, int state, int source, InputDevice device)
|
||||||
|
|
||||||
if(editType == ET_ELEMENTS)
|
if(editType == ET_ELEMENTS)
|
||||||
{
|
{
|
||||||
|
bool change = true;
|
||||||
if(size_t N = selectedTiles.size())
|
if(size_t N = selectedTiles.size())
|
||||||
{
|
{
|
||||||
TileStorage& ts = getCurrentLayerTiles();
|
TileStorage& ts = getCurrentLayerTiles();
|
||||||
|
|
||||||
if (core->getCtrlState())
|
if (core->getCtrlState())
|
||||||
{
|
{
|
||||||
|
change = false;
|
||||||
if (id == ACTION_BGLAYEREND)
|
if (id == ACTION_BGLAYEREND)
|
||||||
{
|
{
|
||||||
ts.setEffect(dsq->tilemgr.tileEffects, -1, &selectedTiles[0], N);
|
ts.setEffect(dsq->tilemgr.tileEffects, -1, &selectedTiles[0], N);
|
||||||
|
@ -1728,13 +1735,13 @@ void SceneEditor::action(int id, int state, int source, InputDevice device)
|
||||||
for(size_t i = 0; i < N; ++i)
|
for(size_t i = 0; i < N; ++i)
|
||||||
selectedTiles.push_back(idx + i);
|
selectedTiles.push_back(idx + i);
|
||||||
//ts.changeFlags(TILEFLAG_SELECTED, 0, &selectedTiles[0], N); // they still have that flag
|
//ts.changeFlags(TILEFLAG_SELECTED, 0, &selectedTiles[0], N); // they still have that flag
|
||||||
|
change = false;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
setActiveLayer(newLayer);
|
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
if(change)
|
||||||
|
setActiveLayer(newLayer);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -2257,6 +2264,7 @@ void SceneEditor::toggle(bool on)
|
||||||
{
|
{
|
||||||
btnMenu->alpha = 1;
|
btnMenu->alpha = 1;
|
||||||
dsq->getRenderObjectLayer(LR_BLACKGROUND)->update = true;
|
dsq->getRenderObjectLayer(LR_BLACKGROUND)->update = true;
|
||||||
|
dsq->tileRenders[bgLayer]->renderBorders = true;
|
||||||
|
|
||||||
game->togglePause(on);
|
game->togglePause(on);
|
||||||
if (game->avatar)
|
if (game->avatar)
|
||||||
|
@ -2294,6 +2302,7 @@ void SceneEditor::toggle(bool on)
|
||||||
movingEntity = 0;
|
movingEntity = 0;
|
||||||
|
|
||||||
dsq->getRenderObjectLayer(LR_BLACKGROUND)->update = false;
|
dsq->getRenderObjectLayer(LR_BLACKGROUND)->update = false;
|
||||||
|
dsq->tileRenders[bgLayer]->renderBorders = false;
|
||||||
|
|
||||||
game->togglePause(on);
|
game->togglePause(on);
|
||||||
if (game->avatar)
|
if (game->avatar)
|
||||||
|
@ -2408,10 +2417,18 @@ void SceneEditor::update(float dt)
|
||||||
int sel = -1;
|
int sel = -1;
|
||||||
if (state == ES_SELECTING && !ismulti)
|
if (state == ES_SELECTING && !ismulti)
|
||||||
{
|
{
|
||||||
selectedTiles.clear();
|
|
||||||
sel = this->getTileAtCursor();
|
sel = this->getTileAtCursor();
|
||||||
|
//if(sel < 0 || (selectedTiles.size() == 1 && selectedTiles[0] != (size_t)sel))
|
||||||
|
{
|
||||||
|
selectedTiles.clear();
|
||||||
|
getCurrentLayerTiles().clearSelection();
|
||||||
|
}
|
||||||
if(sel >= 0)
|
if(sel >= 0)
|
||||||
|
{
|
||||||
selectedTiles.push_back(sel);
|
selectedTiles.push_back(sel);
|
||||||
|
const size_t idx = sel;
|
||||||
|
getCurrentLayerTiles().select(&idx, 1);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (sel >= 0 || ismulti)
|
if (sel >= 0 || ismulti)
|
||||||
|
|
|
@ -217,6 +217,11 @@ void TileStorage::changeFlags(unsigned flagsToSet, unsigned flagsToUnset, const
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void TileStorage::select(const size_t *indices, size_t n)
|
||||||
|
{
|
||||||
|
changeFlags(TILEFLAG_SELECTED, 0, indices, n);
|
||||||
|
}
|
||||||
|
|
||||||
size_t TileStorage::cloneSome(const TileEffectStorage& effstore, const size_t* indices, size_t n)
|
size_t TileStorage::cloneSome(const TileEffectStorage& effstore, const size_t* indices, size_t n)
|
||||||
{
|
{
|
||||||
const size_t ret = tiles.size(); // new starting index of clone tiles
|
const size_t ret = tiles.size(); // new starting index of clone tiles
|
||||||
|
|
|
@ -239,6 +239,7 @@ public:
|
||||||
void refreshAll(); // call this after changing properties or moving to front/back
|
void refreshAll(); // call this after changing properties or moving to front/back
|
||||||
void destroyAll();
|
void destroyAll();
|
||||||
|
|
||||||
|
void select(const size_t *indices, size_t n);
|
||||||
void clearSelection();
|
void clearSelection();
|
||||||
|
|
||||||
struct Sizes
|
struct Sizes
|
||||||
|
|
|
@ -172,6 +172,8 @@ void TileRender::onRender(const RenderState& rs) const
|
||||||
lastTexId = 0;
|
lastTexId = 0;
|
||||||
prevEff = ((TileEffectData*)NULL)+1;
|
prevEff = ((TileEffectData*)NULL)+1;
|
||||||
|
|
||||||
|
rs.gpu.setBlend(BLEND_DEFAULT);
|
||||||
|
|
||||||
if(grid && RenderObject::renderCollisionShape)
|
if(grid && RenderObject::renderCollisionShape)
|
||||||
{
|
{
|
||||||
grid->renderDebugPoints(rs);
|
grid->renderDebugPoints(rs);
|
||||||
|
|
Loading…
Reference in a new issue