mirror of
https://github.com/AquariaOSE/Aquaria.git
synced 2025-07-03 14:34:34 +00:00
Revert "Added support for world maps in mods."
This reverts commit b0d9fdc1cc
.
This commit is contained in:
parent
2bc86c21ee
commit
7d0c2351ed
9 changed files with 80 additions and 169 deletions
|
@ -3203,12 +3203,12 @@ void Continuity::reset()
|
||||||
|
|
||||||
loadTreasureData();
|
loadTreasureData();
|
||||||
|
|
||||||
stringBank.load();
|
stringBank.load("data/stringbank.txt");
|
||||||
|
|
||||||
gems.clear();
|
gems.clear();
|
||||||
beacons.clear();
|
beacons.clear();
|
||||||
|
|
||||||
worldMap.load();
|
worldMap.load("data/worldmap.txt");
|
||||||
|
|
||||||
ingredients.clear();
|
ingredients.clear();
|
||||||
|
|
||||||
|
|
|
@ -206,11 +206,10 @@ class StringBank
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
StringBank();
|
StringBank();
|
||||||
void load();
|
void load(const std::string &file);
|
||||||
|
|
||||||
std::string get(int idx);
|
std::string get(int idx);
|
||||||
protected:
|
protected:
|
||||||
void _load(const std::string &file);
|
|
||||||
|
|
||||||
typedef std::map<int, std::string> StringMap;
|
typedef std::map<int, std::string> StringMap;
|
||||||
StringMap stringMap;
|
StringMap stringMap;
|
||||||
|
@ -261,7 +260,6 @@ public:
|
||||||
|
|
||||||
bool isActive();
|
bool isActive();
|
||||||
bool isDebugMenu();
|
bool isDebugMenu();
|
||||||
bool hasWorldMap();
|
|
||||||
|
|
||||||
std::string getPath();
|
std::string getPath();
|
||||||
std::string getName();
|
std::string getName();
|
||||||
|
@ -271,7 +269,6 @@ public:
|
||||||
protected:
|
protected:
|
||||||
bool shuttingDown;
|
bool shuttingDown;
|
||||||
bool active;
|
bool active;
|
||||||
bool hasMap;
|
|
||||||
int doRecache;
|
int doRecache;
|
||||||
int debugMenu;
|
int debugMenu;
|
||||||
int enqueueModStart;
|
int enqueueModStart;
|
||||||
|
@ -584,8 +581,8 @@ protected:
|
||||||
struct WorldMap
|
struct WorldMap
|
||||||
{
|
{
|
||||||
WorldMap();
|
WorldMap();
|
||||||
void load();
|
void load(const std::string &file);
|
||||||
void save();
|
void save(const std::string &file);
|
||||||
void hideMap();
|
void hideMap();
|
||||||
void revealMap(const std::string &name);
|
void revealMap(const std::string &name);
|
||||||
WorldMapTile *getWorldMapTile(const std::string &name);
|
WorldMapTile *getWorldMapTile(const std::string &name);
|
||||||
|
@ -598,9 +595,6 @@ struct WorldMap
|
||||||
int gw, gh;
|
int gw, gh;
|
||||||
typedef std::vector<WorldMapTile> WorldMapTiles;
|
typedef std::vector<WorldMapTile> WorldMapTiles;
|
||||||
WorldMapTiles worldMapTiles;
|
WorldMapTiles worldMapTiles;
|
||||||
|
|
||||||
private:
|
|
||||||
void _load(const std::string &file);
|
|
||||||
};
|
};
|
||||||
|
|
||||||
class Path;
|
class Path;
|
||||||
|
|
|
@ -6986,9 +6986,7 @@ void Game::applyState()
|
||||||
|
|
||||||
core->sort();
|
core->sort();
|
||||||
|
|
||||||
if (dsq->mod.isActive())
|
|
||||||
dsq->runScript(dsq->mod.getPath() + "scripts/premap_" + sceneName + ".lua", "init");
|
|
||||||
else
|
|
||||||
dsq->runScript("scripts/maps/premap_"+sceneName+".lua", "init");
|
dsq->runScript("scripts/maps/premap_"+sceneName+".lua", "init");
|
||||||
|
|
||||||
std::string musicToPlay = this->musicToPlay;
|
std::string musicToPlay = this->musicToPlay;
|
||||||
|
@ -7081,9 +7079,6 @@ void Game::applyState()
|
||||||
dsq->subtitlePlayer.show(0.25);
|
dsq->subtitlePlayer.show(0.25);
|
||||||
|
|
||||||
if (verbose) debugLog("loading map init script");
|
if (verbose) debugLog("loading map init script");
|
||||||
if (dsq->mod.isActive())
|
|
||||||
dsq->runScript(dsq->mod.getPath() + "scripts/map_" + sceneName + ".lua", "init");
|
|
||||||
else
|
|
||||||
dsq->runScript("scripts/maps/map_"+sceneName+".lua", "init");
|
dsq->runScript("scripts/maps/map_"+sceneName+".lua", "init");
|
||||||
|
|
||||||
if (!dsq->doScreenTrans && (dsq->overlay->alpha != 0 && !dsq->overlay->alpha.isInterpolating()))
|
if (!dsq->doScreenTrans && (dsq->overlay->alpha != 0 && !dsq->overlay->alpha.isInterpolating()))
|
||||||
|
|
|
@ -102,7 +102,6 @@ protected:
|
||||||
unsigned char *savedTexData;
|
unsigned char *savedTexData;
|
||||||
bool mb;
|
bool mb;
|
||||||
Vector lastMousePosition; // See FIXME in WorldMapRender.cpp --achurch
|
Vector lastMousePosition; // See FIXME in WorldMapRender.cpp --achurch
|
||||||
void updateEditor();
|
|
||||||
};
|
};
|
||||||
|
|
||||||
class PathRender : public RenderObject
|
class PathRender : public RenderObject
|
||||||
|
|
|
@ -359,7 +359,7 @@ void MiniMapRender::onUpdate(float dt)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!btn && !radarHide && (!dsq->mod.isActive() || dsq->mod.hasWorldMap()))
|
if (!btn && !dsq->mod.isActive() && !radarHide)
|
||||||
{
|
{
|
||||||
if (dsq->game->worldMapRender->isOn())
|
if (dsq->game->worldMapRender->isOn())
|
||||||
{
|
{
|
||||||
|
|
|
@ -58,7 +58,6 @@ void Mod::clear()
|
||||||
active = false;
|
active = false;
|
||||||
doRecache = 0;
|
doRecache = 0;
|
||||||
debugMenu = false;
|
debugMenu = false;
|
||||||
hasMap = false;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
bool Mod::isDebugMenu()
|
bool Mod::isDebugMenu()
|
||||||
|
@ -66,11 +65,6 @@ bool Mod::isDebugMenu()
|
||||||
return debugMenu;
|
return debugMenu;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool Mod::hasWorldMap()
|
|
||||||
{
|
|
||||||
return hasMap;
|
|
||||||
}
|
|
||||||
|
|
||||||
void Mod::loadModXML(TiXmlDocument *d, std::string modName)
|
void Mod::loadModXML(TiXmlDocument *d, std::string modName)
|
||||||
{
|
{
|
||||||
d->LoadFile(baseModPath + modName + ".xml");
|
d->LoadFile(baseModPath + modName + ".xml");
|
||||||
|
@ -118,12 +112,6 @@ void Mod::load(const std::string &p)
|
||||||
if (props->Attribute("debugMenu")) {
|
if (props->Attribute("debugMenu")) {
|
||||||
props->Attribute("debugMenu", &debugMenu);
|
props->Attribute("debugMenu", &debugMenu);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (props->Attribute("hasWorldMap")) {
|
|
||||||
int t;
|
|
||||||
props->Attribute("hasWorldMap", &t);
|
|
||||||
hasMap = t;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -24,18 +24,10 @@ StringBank::StringBank()
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
void StringBank::load()
|
void StringBank::load(const std::string &file)
|
||||||
{
|
|
||||||
stringMap.clear();
|
|
||||||
|
|
||||||
_load("data/stringbank.txt");
|
|
||||||
if (dsq->mod.isActive())
|
|
||||||
_load(dsq->mod.getPath() + "data/stringbank.txt");
|
|
||||||
}
|
|
||||||
|
|
||||||
void StringBank::_load(const std::string &file)
|
|
||||||
{
|
{
|
||||||
//debugLog("StringBank::load("+file+")");
|
//debugLog("StringBank::load("+file+")");
|
||||||
|
stringMap.clear();
|
||||||
|
|
||||||
std::ifstream in(file.c_str());
|
std::ifstream in(file.c_str());
|
||||||
|
|
||||||
|
|
|
@ -1029,8 +1029,7 @@ void WorldMapRender::onUpdate(float dt)
|
||||||
internalOffset += mouseChange / scale.x;
|
internalOffset += mouseChange / scale.x;
|
||||||
}
|
}
|
||||||
|
|
||||||
if(!editorActive)
|
|
||||||
{
|
|
||||||
float scrollSpeed = 2.0f;
|
float scrollSpeed = 2.0f;
|
||||||
float amt = (400*dt)/scale.x;
|
float amt = (400*dt)/scale.x;
|
||||||
if (isActing(ACTION_SWIMLEFT))
|
if (isActing(ACTION_SWIMLEFT))
|
||||||
|
@ -1083,7 +1082,6 @@ void WorldMapRender::onUpdate(float dt)
|
||||||
internalOffset += core->joystick.position * (-400*dt / scale.x);
|
internalOffset += core->joystick.position * (-400*dt / scale.x);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
if (activeTile && activeTile->layer == 1)
|
if (activeTile && activeTile->layer == 1)
|
||||||
{
|
{
|
||||||
|
@ -1138,22 +1136,11 @@ void WorldMapRender::onUpdate(float dt)
|
||||||
|
|
||||||
if (core->getShiftState())
|
if (core->getShiftState())
|
||||||
{
|
{
|
||||||
if (core->getCtrlState())
|
|
||||||
a2 *= 10.0f;
|
|
||||||
if (core->getKeyState(KEY_UP))
|
if (core->getKeyState(KEY_UP))
|
||||||
activeTile->scale2 += -a2;
|
activeTile->scale2 += -a2;
|
||||||
if (core->getKeyState(KEY_DOWN))
|
if (core->getKeyState(KEY_DOWN))
|
||||||
activeTile->scale2 += a2;
|
activeTile->scale2 += a2;
|
||||||
}
|
}
|
||||||
else if (core->getAltState())
|
|
||||||
{
|
|
||||||
if (core->getCtrlState())
|
|
||||||
a2 *= 10.0f;
|
|
||||||
if (core->getKeyState(KEY_UP))
|
|
||||||
activeTile->scale += -a2;
|
|
||||||
if (core->getKeyState(KEY_DOWN))
|
|
||||||
activeTile->scale += a2;
|
|
||||||
}
|
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
if (core->getCtrlState())
|
if (core->getCtrlState())
|
||||||
|
@ -1172,23 +1159,19 @@ void WorldMapRender::onUpdate(float dt)
|
||||||
|
|
||||||
if (core->getKeyState(KEY_F2))
|
if (core->getKeyState(KEY_F2))
|
||||||
{
|
{
|
||||||
dsq->continuity.worldMap.save();
|
dsq->continuity.worldMap.save("data/WorldMap.txt");
|
||||||
}
|
}
|
||||||
|
|
||||||
activeQuad->position = activeTile->gridPos;
|
activeQuad->position = activeTile->gridPos;
|
||||||
activeQuad->scale = Vector(0.25f*activeTile->scale2, 0.25f*activeTile->scale2);
|
activeQuad->scale = Vector(0.25f*activeTile->scale2, 0.25f*activeTile->scale2);
|
||||||
if(activeQuad->texture)
|
|
||||||
activeQuad->setWidthHeight(activeQuad->texture->width*activeTile->scale, // FG: HACK force resize proper
|
|
||||||
activeQuad->texture->height*activeTile->scale);
|
|
||||||
}
|
}
|
||||||
updateEditor();
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
#ifdef AQUARIA_BUILD_MAPVIS
|
#ifdef AQUARIA_BUILD_MAPVIS
|
||||||
if (!dsq->isInCutscene() && dsq->game->avatar && activeTile && !dsq->game->sceneEditor.isOn())
|
if (!dsq->isInCutscene() && dsq->game->avatar && activeTile)
|
||||||
{
|
{
|
||||||
const float screenWidth = core->getVirtualWidth() * core->invGlobalScale;
|
const float screenWidth = core->getVirtualWidth() * core->invGlobalScale;
|
||||||
const float screenHeight = core->getVirtualHeight() * core->invGlobalScale;
|
const float screenHeight = core->getVirtualHeight() * core->invGlobalScale;
|
||||||
|
@ -1248,16 +1231,11 @@ Vector WorldMapRender::getAvatarWorldMapPosition()
|
||||||
|
|
||||||
Vector WorldMapRender::getWorldToTile(WorldMapTile *tile, Vector position, bool fromCenter, bool tilePos)
|
Vector WorldMapRender::getWorldToTile(WorldMapTile *tile, Vector position, bool fromCenter, bool tilePos)
|
||||||
{
|
{
|
||||||
const float sizew = (float)tile->q->texture->width;
|
|
||||||
const float halfw = sizew / 2.0f;
|
|
||||||
const float sizeh = (float)tile->q->texture->height;
|
|
||||||
const float halfh = sizeh / 2.0f;
|
|
||||||
Vector p;
|
Vector p;
|
||||||
p = Vector((position.x/TILE_SIZE) / (sizew*tile->scale), (position.y/TILE_SIZE) / (sizeh*tile->scale));
|
p = (position/TILE_SIZE) / (256*tile->scale);
|
||||||
p.x *= sizew*tile->scale*0.25f*tile->scale2;
|
p *= 256*tile->scale*0.25f*tile->scale2;
|
||||||
p.y *= sizeh*tile->scale*0.25f*tile->scale2;
|
|
||||||
if (fromCenter)
|
if (fromCenter)
|
||||||
p -= Vector((halfw*tile->scale)*(0.25f*tile->scale2), (halfh*tile->scale)*(0.25f*tile->scale2));
|
p -= Vector((128*tile->scale)*(0.25f*tile->scale2), (128*tile->scale)*(0.25f*tile->scale2));
|
||||||
if (tilePos)
|
if (tilePos)
|
||||||
p += tile->gridPos;
|
p += tile->gridPos;
|
||||||
return p;
|
return p;
|
||||||
|
@ -1320,7 +1298,7 @@ void WorldMapRender::toggle(bool turnON)
|
||||||
if (dsq->game->miniMapRender->isRadarHide()) return;
|
if (dsq->game->miniMapRender->isRadarHide()) return;
|
||||||
if (alpha.isInterpolating()) return;
|
if (alpha.isInterpolating()) return;
|
||||||
|
|
||||||
if (dsq->mod.isActive() && !dsq->mod.hasWorldMap()) return;
|
if (dsq->mod.isActive()) return;
|
||||||
|
|
||||||
if (dsq->isNested()) return;
|
if (dsq->isNested()) return;
|
||||||
|
|
||||||
|
@ -1511,18 +1489,6 @@ void WorldMapRender::createGemHint(const std::string &gfx)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void WorldMapRender::updateEditor()
|
|
||||||
{
|
|
||||||
std::ostringstream os;
|
|
||||||
os << "EDITING... ";
|
|
||||||
if(activeTile)
|
|
||||||
{
|
|
||||||
os << "x=" << activeTile->gridPos.x << "; y=" << activeTile->gridPos.y << std::endl;
|
|
||||||
os << "scale=" << activeTile->scale << "; scale2=" << activeTile->scale2;
|
|
||||||
}
|
|
||||||
areaLabel->setText(os.str());
|
|
||||||
}
|
|
||||||
|
|
||||||
void WorldMapRender::action (int id, int state)
|
void WorldMapRender::action (int id, int state)
|
||||||
{
|
{
|
||||||
if (isOn())
|
if (isOn())
|
||||||
|
@ -1539,7 +1505,7 @@ void WorldMapRender::action (int id, int state)
|
||||||
|
|
||||||
if (editorActive)
|
if (editorActive)
|
||||||
{
|
{
|
||||||
updateEditor();
|
areaLabel->setText("EDITING...");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -240,15 +240,7 @@ WorldMap::WorldMap()
|
||||||
gw=gh=0;
|
gw=gh=0;
|
||||||
}
|
}
|
||||||
|
|
||||||
void WorldMap::load()
|
void WorldMap::load(const std::string &file)
|
||||||
{
|
|
||||||
if (!dsq->mod.isActive())
|
|
||||||
_load("data/worldmap.txt");
|
|
||||||
else
|
|
||||||
_load(dsq->mod.getPath() + "data/worldmap.txt");
|
|
||||||
}
|
|
||||||
|
|
||||||
void WorldMap::_load(const std::string &file)
|
|
||||||
{
|
{
|
||||||
worldMapTiles.clear();
|
worldMapTiles.clear();
|
||||||
|
|
||||||
|
@ -267,29 +259,14 @@ void WorldMap::_load(const std::string &file)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void WorldMap::save()
|
void WorldMap::save(const std::string &file)
|
||||||
{
|
{
|
||||||
std::string fn;
|
std::ofstream out(file.c_str());
|
||||||
|
|
||||||
if (dsq->mod.isActive())
|
|
||||||
fn = dsq->mod.getPath() + "data/worldmap.txt";
|
|
||||||
else
|
|
||||||
fn = "data/worldmap.txt";
|
|
||||||
|
|
||||||
std::ofstream out(fn.c_str());
|
|
||||||
|
|
||||||
if (out)
|
|
||||||
{
|
|
||||||
for (int i = 0; i < worldMapTiles.size(); i++)
|
for (int i = 0; i < worldMapTiles.size(); i++)
|
||||||
{
|
{
|
||||||
WorldMapTile *t = &worldMapTiles[i];
|
WorldMapTile *t = &worldMapTiles[i];
|
||||||
out << t->index << " " << t->stringIndex << " " << t->name << " " << t->layer << " " << t->scale << " " << t->gridPos.x << " " << t->gridPos.y << " " << t->prerevealed << " " << t->scale2 << std::endl;
|
out << t->index << " " << t->name << " " << t->layer << " " << t->scale << " " << t->gridPos.x << " " << t->gridPos.y << " " << t->prerevealed << " " << t->scale2 << std::endl;
|
||||||
}
|
|
||||||
dsq->screenMessage("Saved worldmap data to " + fn);
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
dsq->screenMessage("Unable to save worldmap to " + fn);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue