mirror of
https://github.com/AquariaOSE/Aquaria.git
synced 2024-11-15 14:09:06 +00:00
Implement new (optional) world map reveal method.
This one doesn't give the whole map away already just after entering it.
This commit is contained in:
parent
6f05249fdc
commit
8cad58f0c4
2 changed files with 52 additions and 9 deletions
|
@ -67,6 +67,12 @@ protected:
|
|||
InterpolatedVector lerp;
|
||||
};
|
||||
|
||||
enum WorldMapRevealMethod
|
||||
{
|
||||
REVEAL_DEFAULT = 0,
|
||||
REVEAL_PARTIAL = 1 // Not visited areas have zero alpha (invisible)
|
||||
};
|
||||
|
||||
class WorldMapRender : public RenderObject, public ActionMapper
|
||||
{
|
||||
public:
|
||||
|
@ -86,6 +92,9 @@ public:
|
|||
void removeGem(GemMover *gemMover);
|
||||
void onToggleHelpScreen();
|
||||
bool isCursorOffHud();
|
||||
|
||||
static void setRevealMethod(WorldMapRevealMethod m);
|
||||
|
||||
protected:
|
||||
Quad *addHintQuad1, *addHintQuad2;
|
||||
AquariaMenuItem *helpButton;
|
||||
|
|
|
@ -44,11 +44,12 @@ namespace WorldMapRenderNamespace
|
|||
|
||||
enum VisMethod
|
||||
{
|
||||
VIS_VERTEX = 0,
|
||||
VIS_WRITE = 1
|
||||
VIS_VERTEX = 0, // Uses the RenderObject tile grid (RenderObject::setSegs()) to display visited areas
|
||||
VIS_WRITE = 1 // Uses render-to-texture instead
|
||||
};
|
||||
|
||||
VisMethod visMethod = VIS_VERTEX;
|
||||
WorldMapRevealMethod revMethod = REVEAL_DEFAULT;
|
||||
|
||||
std::vector<Quad *> tiles;
|
||||
|
||||
|
@ -84,6 +85,23 @@ WorldMapTile *activeTile=0;
|
|||
|
||||
const float beaconSpawnBitTime = 0.05;
|
||||
|
||||
|
||||
void WorldMapRender::setRevealMethod(WorldMapRevealMethod m)
|
||||
{
|
||||
switch(m)
|
||||
{
|
||||
case REVEAL_PARTIAL:
|
||||
revMethod = REVEAL_PARTIAL;
|
||||
baseMapSegAlpha = 0;
|
||||
break;
|
||||
|
||||
default:
|
||||
revMethod = REVEAL_DEFAULT;
|
||||
baseMapSegAlpha = 0.4;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
class WorldMapBoundQuad : public Quad
|
||||
{
|
||||
public:
|
||||
|
@ -731,8 +749,6 @@ WorldMapRender::WorldMapRender() : RenderObject(), ActionMapper()
|
|||
q->alphaMod = 0;
|
||||
|
||||
tile->q = q;
|
||||
|
||||
setProperTileColor(tile);
|
||||
|
||||
q->setWidthHeight(q->getWidth()*tile->scale, q->getHeight()*tile->scale);
|
||||
q->scale = Vector(0.25f*tile->scale2, 0.25f*tile->scale2);
|
||||
|
@ -740,10 +756,18 @@ WorldMapRender::WorldMapRender() : RenderObject(), ActionMapper()
|
|||
if (tile == activeTile)
|
||||
activeQuad = q;
|
||||
|
||||
if (activeQuad == q)
|
||||
if (revMethod == REVEAL_PARTIAL || activeQuad == q)
|
||||
{
|
||||
setVis(tile);
|
||||
}
|
||||
|
||||
setProperTileColor(tile);
|
||||
|
||||
if(activeQuad == q)
|
||||
{
|
||||
activeTile->q->color = Vector(1,1,1);
|
||||
activeTile->q->alphaMod = 1;
|
||||
}
|
||||
|
||||
addChild(q, PM_POINTER);
|
||||
|
||||
|
@ -861,7 +885,13 @@ void WorldMapRender::bindInput()
|
|||
|
||||
void WorldMapRender::destroy()
|
||||
{
|
||||
clearVis(activeTile);
|
||||
//clearVis(activeTile);
|
||||
for (int i = 0; i < dsq->continuity.worldMap.getNumWorldMapTiles(); i++)
|
||||
{
|
||||
WorldMapTile *tile = dsq->continuity.worldMap.getWorldMapTile(i);
|
||||
clearVis(tile);
|
||||
}
|
||||
|
||||
RenderObject::destroy();
|
||||
delete[] savedTexData;
|
||||
}
|
||||
|
@ -973,7 +1003,8 @@ void WorldMapRender::onUpdate(float dt)
|
|||
{
|
||||
if ((activeTile != selectedTile) && selectedTile->q)
|
||||
{
|
||||
clearVis(activeTile);
|
||||
if(revMethod == REVEAL_DEFAULT)
|
||||
clearVis(activeTile);
|
||||
|
||||
activeTile = selectedTile;
|
||||
activeQuad = activeTile->q;
|
||||
|
@ -1428,8 +1459,11 @@ void WorldMapRender::toggle(bool turnON)
|
|||
{
|
||||
if (activeTile != originalActiveTile)
|
||||
{
|
||||
clearVis(activeTile);
|
||||
setVis(originalActiveTile);
|
||||
if(revMethod == REVEAL_DEFAULT)
|
||||
{
|
||||
clearVis(activeTile);
|
||||
setVis(originalActiveTile);
|
||||
}
|
||||
activeTile = originalActiveTile;
|
||||
activeQuad = activeTile->q;
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue