mirror of
https://github.com/AquariaOSE/Aquaria.git
synced 2025-10-15 11:00:46 +00:00
sync with icculus repo
This commit is contained in:
parent
3b39173397
commit
e64fb75f84
48 changed files with 21570 additions and 521 deletions
|
@ -44,20 +44,15 @@ Bone *lastSelectedBone = 0;
|
|||
void AnimationEditor::constrainMouse()
|
||||
{
|
||||
Vector mp=core->mouse.position;
|
||||
bool doit = false;
|
||||
if (mp.x < 200) { mp.x = 200; doit = true; }
|
||||
if (mp.x > 600) { mp.x = 600; doit = true; }
|
||||
if (mp.y < 100) { mp.y = 100; doit = true; }
|
||||
if (mp.y > 500) { mp.y = 500; doit = true; }
|
||||
if (mp.x < 200) mp.x = 200;
|
||||
if (mp.x > 600) mp.x = 600;
|
||||
if (mp.y < 100) mp.y = 100;
|
||||
if (mp.y > 500) mp.y = 500;
|
||||
core->setMousePosition(mp);
|
||||
|
||||
if(doit)
|
||||
{
|
||||
core->setMousePosition(mp);
|
||||
|
||||
std::ostringstream os;
|
||||
os << "mp(" << mp.x << ", " << mp.y << ")";
|
||||
debugLog(os.str());
|
||||
}
|
||||
std::ostringstream os;
|
||||
os << "mp(" << mp.x << ", " << mp.y << ")";
|
||||
debugLog(os.str());
|
||||
}
|
||||
|
||||
KeyframeWidget::KeyframeWidget(int key) : Quad()
|
||||
|
@ -412,11 +407,6 @@ void AnimationEditor::applyState()
|
|||
text->setFontSize(6);
|
||||
addRenderObject(text, LR_HUD);
|
||||
|
||||
text2 = new DebugFont();
|
||||
text2->position = Vector(200,510);
|
||||
text2->setFontSize(6);
|
||||
addRenderObject(text2, LR_HUD);
|
||||
|
||||
editSprite->setSelectedBone(0);
|
||||
|
||||
dsq->overlay->alpha.interpolateTo(0, 0.5);
|
||||
|
@ -666,24 +656,13 @@ void AnimationEditor::update(float dt)
|
|||
os << " keyTime: " << k->t;
|
||||
}
|
||||
|
||||
Vector ebdata;
|
||||
|
||||
if (editingBone)
|
||||
{
|
||||
os << " bone: " << editingBone->name;
|
||||
ebdata.x = editingBone->position.x;
|
||||
ebdata.y = editingBone->position.y;
|
||||
ebdata.z = editingBone->rotation.z;
|
||||
|
||||
}
|
||||
text->setText(os.str());
|
||||
|
||||
char t2buf[256];
|
||||
sprintf(t2buf, "Bone x: %.3f, y: %.3f, rot: %.3f, idx: %d", ebdata.x, ebdata.y,
|
||||
ebdata.z, editSprite->getSelectedBoneIdx());
|
||||
text2->setText(t2buf);
|
||||
|
||||
|
||||
|
||||
if (core->mouse.buttons.middle)
|
||||
{
|
||||
editSprite->position += core->mouse.change;
|
||||
|
@ -758,7 +737,7 @@ void AnimationEditor::update(float dt)
|
|||
}
|
||||
if (editingBone && boneEdit == 1)
|
||||
{
|
||||
editingBone->position = core->mouse.position - editSprite->position + cursorOffset;
|
||||
editingBone->position = core->mouse.position - editSprite->position + cursorOffset + core->getVirtualOffX();
|
||||
constrainMouse();
|
||||
}
|
||||
if (editingBone && boneEdit == 2)
|
||||
|
|
|
@ -23,7 +23,7 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
|||
#include "../BBGE/BitmapFont.h"
|
||||
#include "../BBGE/Quad.h"
|
||||
#include "../BBGE/ActionMapper.h"
|
||||
#include "tinyxml.h"
|
||||
#include "../ExternalLibs/tinyxml.h"
|
||||
#include "../BBGE/Slider.h"
|
||||
#include "../BBGE/DebugFont.h"
|
||||
#include "../BBGE/TTFFont.h"
|
||||
|
|
|
@ -517,10 +517,10 @@ void SongIcon::onUpdate(float dt)
|
|||
rippleTimer = 0.5f - (note/7.0f)*0.4f;
|
||||
|
||||
if (core->afterEffectManager)
|
||||
{
|
||||
{
|
||||
core->afterEffectManager->addEffect(new ShockEffect(position - Vector(400, 300) + Vector(core->width/2, core->height/2),
|
||||
core->screenCenter,0.009f,0.015f,18,0.2f, 0.9f + (note*0.08f) ));
|
||||
}
|
||||
core->screenCenter,0.009f,0.015f,18,0.2f, 0.9f + (note*0.08f) ));
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -4557,7 +4557,7 @@ Avatar::Avatar() : Entity(), ActionMapper()
|
|||
pullTarget = 0;
|
||||
revertTimer = 0;
|
||||
currentSongIdx = -1;
|
||||
leaches = 0;
|
||||
leaches = 0;
|
||||
|
||||
|
||||
debugLog("Avatar vars->");
|
||||
|
|
|
@ -354,7 +354,7 @@ public:
|
|||
|
||||
void revert();
|
||||
|
||||
int leaches;
|
||||
int leaches;
|
||||
|
||||
protected:
|
||||
void setSongIconPositions();
|
||||
|
|
|
@ -25,7 +25,7 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
|||
#include "AutoMap.h"
|
||||
#include "GridRender.h"
|
||||
|
||||
#include "tinyxml.h"
|
||||
#include "../ExternalLibs/tinyxml.h"
|
||||
|
||||
#define MAX_EATS 8
|
||||
|
||||
|
@ -1982,14 +1982,14 @@ void Continuity::applyWorldEffects(WorldType type, bool transition, bool affectM
|
|||
if (type == WT_SPIRIT)
|
||||
{
|
||||
|
||||
if(dsq->user.video.blur)
|
||||
{
|
||||
core->postProcessingFx.blendType = 1;
|
||||
core->postProcessingFx.intensity = 0.2f;
|
||||
core->postProcessingFx.layer = LR_AFTER_EFFECTS;//LR_AFTER_EFFECTS;
|
||||
core->postProcessingFx.renderLayer = LR_AFTER_EFFECTS;
|
||||
core->postProcessingFx.enable(FXT_RADIALBLUR);
|
||||
}
|
||||
if(dsq->user.video.blur)
|
||||
{
|
||||
core->postProcessingFx.blendType = 1;
|
||||
core->postProcessingFx.intensity = 0.2f;
|
||||
core->postProcessingFx.layer = LR_AFTER_EFFECTS;//LR_AFTER_EFFECTS;
|
||||
core->postProcessingFx.renderLayer = LR_AFTER_EFFECTS;
|
||||
core->postProcessingFx.enable(FXT_RADIALBLUR);
|
||||
}
|
||||
|
||||
dsq->game->avatar->canWarp = false;
|
||||
|
||||
|
@ -2886,7 +2886,7 @@ void Continuity::loadFile(int slot)
|
|||
//dsq->game->transitionToScene();
|
||||
}
|
||||
|
||||
loadSongBank();
|
||||
loadSongBank();
|
||||
}
|
||||
|
||||
void Continuity::setNaijaModel(std::string model)
|
||||
|
@ -3207,12 +3207,12 @@ void Continuity::reset()
|
|||
|
||||
loadTreasureData();
|
||||
|
||||
stringBank.load();
|
||||
stringBank.load("data/stringbank.txt");
|
||||
|
||||
gems.clear();
|
||||
beacons.clear();
|
||||
|
||||
worldMap.load();
|
||||
worldMap.load("data/worldmap.txt");
|
||||
|
||||
ingredients.clear();
|
||||
|
||||
|
@ -3227,7 +3227,7 @@ void Continuity::reset()
|
|||
if(dsq->mod.isActive())
|
||||
{
|
||||
//load mod ingredients
|
||||
loadIngredientData(dsq->mod.getPath() + "ingredients.txt");
|
||||
loadIngredientData(dsq->mod.getPath() + "data/ingredients.txt");
|
||||
}
|
||||
|
||||
//load ingredients for the main game
|
||||
|
|
|
@ -1241,9 +1241,9 @@ This build is not yet final, and as such there are a couple things lacking. They
|
|||
dsq->darkLayer.toggle(0);
|
||||
debugLog("done");
|
||||
|
||||
debugLog("post FX init");
|
||||
dsq->postProcessingFx.init();
|
||||
debugLog("done");
|
||||
debugLog("post FX init");
|
||||
dsq->postProcessingFx.init();
|
||||
debugLog("done");
|
||||
|
||||
|
||||
#ifdef AQUARIA_BUILD_CONSOLE
|
||||
|
|
|
@ -28,7 +28,7 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
|||
#include "../BBGE/BitmapFont.h"
|
||||
#include "../BBGE/ScreenTransition.h"
|
||||
#include "../BBGE/Precacher.h"
|
||||
#include "tinyxml.h"
|
||||
#include "../ExternalLibs/tinyxml.h"
|
||||
#include "AquariaMenuItem.h"
|
||||
#include "ScriptInterface.h"
|
||||
|
||||
|
@ -206,11 +206,10 @@ class StringBank
|
|||
{
|
||||
public:
|
||||
StringBank();
|
||||
void load();
|
||||
void load(const std::string &file);
|
||||
|
||||
std::string get(int idx);
|
||||
protected:
|
||||
void _load(const std::string &file);
|
||||
|
||||
typedef std::map<int, std::string> StringMap;
|
||||
StringMap stringMap;
|
||||
|
@ -261,7 +260,6 @@ public:
|
|||
|
||||
bool isActive();
|
||||
bool isDebugMenu();
|
||||
bool hasWorldMap();
|
||||
|
||||
std::string getPath();
|
||||
std::string getName();
|
||||
|
@ -271,7 +269,6 @@ public:
|
|||
protected:
|
||||
bool shuttingDown;
|
||||
bool active;
|
||||
bool hasMap;
|
||||
int doRecache;
|
||||
int debugMenu;
|
||||
int enqueueModStart;
|
||||
|
@ -584,8 +581,8 @@ protected:
|
|||
struct WorldMap
|
||||
{
|
||||
WorldMap();
|
||||
void load();
|
||||
void save();
|
||||
void load(const std::string &file);
|
||||
void save(const std::string &file);
|
||||
void hideMap();
|
||||
void revealMap(const std::string &name);
|
||||
WorldMapTile *getWorldMapTile(const std::string &name);
|
||||
|
@ -598,9 +595,6 @@ struct WorldMap
|
|||
int gw, gh;
|
||||
typedef std::vector<WorldMapTile> WorldMapTiles;
|
||||
WorldMapTiles worldMapTiles;
|
||||
|
||||
private:
|
||||
void _load(const std::string &file);
|
||||
};
|
||||
|
||||
class Path;
|
||||
|
|
|
@ -1723,10 +1723,10 @@ void Entity::clearDamageTargets()
|
|||
|
||||
void Entity::setDamageTarget(DamageType dt, bool v)
|
||||
{
|
||||
if (v)
|
||||
disabledDamageTypes.erase(dt);
|
||||
else
|
||||
disabledDamageTypes.insert(dt);
|
||||
if (v)
|
||||
disabledDamageTypes.erase(dt);
|
||||
else
|
||||
disabledDamageTypes.insert(dt);
|
||||
}
|
||||
|
||||
void Entity::setEatType(EatType et, const std::string &file)
|
||||
|
@ -1742,17 +1742,17 @@ void Entity::setEatType(EatType et, const std::string &file)
|
|||
|
||||
void Entity::setAllDamageTargets(bool v)
|
||||
{
|
||||
if (v)
|
||||
clearDamageTargets(); // clear all disabled -> all allowed now
|
||||
else
|
||||
{
|
||||
for (int i = DT_ENEMY; i < DT_ENEMY_REALMAX; i++)
|
||||
disabledDamageTypes.insert(DamageType(i));
|
||||
for (int i = DT_AVATAR; i < DT_AVATAR_REALMAX; i++)
|
||||
disabledDamageTypes.insert(DamageType(i));
|
||||
for (int i = DT_AVATAR_MAX; i < DT_REALMAX; i++)
|
||||
disabledDamageTypes.insert(DamageType(i));
|
||||
}
|
||||
if (v)
|
||||
clearDamageTargets(); // clear all disabled -> all allowed now
|
||||
else
|
||||
{
|
||||
for (int i = DT_ENEMY; i < DT_ENEMY_REALMAX; i++)
|
||||
disabledDamageTypes.insert(DamageType(i));
|
||||
for (int i = DT_AVATAR; i < DT_AVATAR_REALMAX; i++)
|
||||
disabledDamageTypes.insert(DamageType(i));
|
||||
for (int i = DT_AVATAR_MAX; i < DT_REALMAX; i++)
|
||||
disabledDamageTypes.insert(DamageType(i));
|
||||
}
|
||||
}
|
||||
|
||||
bool Entity::isDamageTarget(DamageType dt)
|
||||
|
|
|
@ -22,7 +22,7 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
|||
|
||||
#include "../BBGE/DFSprite.h"
|
||||
#include "../BBGE/StateMachine.h"
|
||||
#include "tinyxml.h"
|
||||
#include "../ExternalLibs/tinyxml.h"
|
||||
#include "../BBGE/SkeletalSprite.h"
|
||||
|
||||
#include "DSQ.h"
|
||||
|
|
|
@ -6983,10 +6983,8 @@ void Game::applyState()
|
|||
|
||||
core->sort();
|
||||
|
||||
if (dsq->mod.isActive())
|
||||
dsq->runScript(dsq->mod.getPath() + "scripts/premap_" + sceneName + ".lua", "init", true);
|
||||
else
|
||||
dsq->runScript("scripts/maps/premap_"+sceneName+".lua", "init", true);
|
||||
|
||||
dsq->runScript("scripts/maps/premap_"+sceneName+".lua", "init", true);
|
||||
|
||||
std::string musicToPlay = this->musicToPlay;
|
||||
if (!overrideMusic.empty())
|
||||
|
@ -7078,10 +7076,7 @@ void Game::applyState()
|
|||
dsq->subtitlePlayer.show(0.25);
|
||||
|
||||
if (verbose) debugLog("loading map init script");
|
||||
if (dsq->mod.isActive())
|
||||
dsq->runScript(dsq->mod.getPath() + "scripts/map_" + sceneName + ".lua", "init", true);
|
||||
else
|
||||
dsq->runScript("scripts/maps/map_"+sceneName+".lua", "init", true);
|
||||
dsq->runScript("scripts/maps/map_"+sceneName+".lua", "init", true);
|
||||
|
||||
if (!dsq->doScreenTrans && (dsq->overlay->alpha != 0 && !dsq->overlay->alpha.isInterpolating()))
|
||||
{
|
||||
|
|
|
@ -20,7 +20,7 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
|||
*/
|
||||
#pragma once
|
||||
|
||||
#include "tinyxml.h"
|
||||
#include "../ExternalLibs/tinyxml.h"
|
||||
#include "../BBGE/DebugFont.h"
|
||||
#include "../ExternalLibs/glpng.h"
|
||||
|
||||
|
|
|
@ -102,7 +102,6 @@ protected:
|
|||
unsigned char *savedTexData;
|
||||
bool mb;
|
||||
Vector lastMousePosition; // See FIXME in WorldMapRender.cpp --achurch
|
||||
void updateEditor();
|
||||
};
|
||||
|
||||
class PathRender : public RenderObject
|
||||
|
|
|
@ -243,7 +243,7 @@ void MiniMapRender::onUpdate(float dt)
|
|||
RenderObject::onUpdate(dt);
|
||||
|
||||
position.x = core->getVirtualWidth() - core->getVirtualOffX() - getMiniMapWidth()/2;
|
||||
position.y = core->getVirtualHeight() - getMiniMapHeight()/2;
|
||||
position.y = 600 - getMiniMapHeight()/2;
|
||||
position.z = 2.9;
|
||||
|
||||
waterSin += dt * (bitSizeLookupPeriod / (2*PI));
|
||||
|
@ -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())
|
||||
{
|
||||
|
|
|
@ -58,7 +58,6 @@ void Mod::clear()
|
|||
active = false;
|
||||
doRecache = 0;
|
||||
debugMenu = false;
|
||||
hasMap = false;
|
||||
}
|
||||
|
||||
bool Mod::isDebugMenu()
|
||||
|
@ -66,11 +65,6 @@ bool Mod::isDebugMenu()
|
|||
return debugMenu;
|
||||
}
|
||||
|
||||
bool Mod::hasWorldMap()
|
||||
{
|
||||
return hasMap;
|
||||
}
|
||||
|
||||
void Mod::loadModXML(TiXmlDocument *d, std::string modName)
|
||||
{
|
||||
d->LoadFile(baseModPath + modName + ".xml");
|
||||
|
@ -118,12 +112,6 @@ void Mod::load(const std::string &p)
|
|||
if (props->Attribute("debugMenu")) {
|
||||
props->Attribute("debugMenu", &debugMenu);
|
||||
}
|
||||
|
||||
if (props->Attribute("hasWorldMap")) {
|
||||
int t;
|
||||
props->Attribute("hasWorldMap", &t);
|
||||
hasMap = t;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -80,7 +80,7 @@ public:
|
|||
void songNoteDone(int note, float len);
|
||||
bool hasScript();
|
||||
std::string name; // full node string
|
||||
std::string label; // first part only (the actual node name)
|
||||
std::string label; // first part only (the actual node name)
|
||||
std::vector<PathNode>nodes;
|
||||
void removeNode(int idx);
|
||||
void addNode(int idx);
|
||||
|
|
|
@ -2429,15 +2429,19 @@ void SceneEditor::moveElementToLayer(Element *e, int bgLayer)
|
|||
{
|
||||
Element *e = selectedElements[i];
|
||||
core->removeRenderObject(e, Core::DO_NOT_DESTROY_RENDER_OBJECT);
|
||||
core->addRenderObject(e, LR_ELEMENTS1+bgLayer);
|
||||
dsq->removeElement(e);
|
||||
e->bgLayer = bgLayer;
|
||||
dsq->addElement(e);
|
||||
core->addRenderObject(e, LR_ELEMENTS1+bgLayer);
|
||||
}
|
||||
}
|
||||
else if (e)
|
||||
{
|
||||
core->removeRenderObject(e, Core::DO_NOT_DESTROY_RENDER_OBJECT);
|
||||
core->addRenderObject(e, LR_ELEMENTS1+bgLayer);
|
||||
dsq->removeElement(e);
|
||||
e->bgLayer = bgLayer;
|
||||
dsq->addElement(e);
|
||||
core->addRenderObject(e, LR_ELEMENTS1+bgLayer);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -2998,8 +3002,8 @@ void SceneEditor::doPrevElement()
|
|||
if (curElement < 0)
|
||||
curElement = dsq->game->elementTemplates.size()-1;
|
||||
|
||||
if(curElement < 0)
|
||||
return;
|
||||
if (curElement < 0)
|
||||
return;
|
||||
|
||||
if (dsq->game->elementTemplates[curElement].idx < 1024)
|
||||
{
|
||||
|
|
|
@ -280,10 +280,10 @@ static const char * const interfaceFunctions[] = {
|
|||
|
||||
static void scriptError(const std::string& msg)
|
||||
{
|
||||
if(loudScriptErrors)
|
||||
errorLog(msg);
|
||||
else
|
||||
debugLog(msg);
|
||||
if(loudScriptErrors)
|
||||
errorLog(msg);
|
||||
else
|
||||
debugLog(msg);
|
||||
}
|
||||
|
||||
static void luaErrorMsg(lua_State *L, const char *msg)
|
||||
|
@ -489,10 +489,10 @@ static SkeletalSprite *getSkeletalSprite(Entity *e)
|
|||
|
||||
static bool looksLikeGlobal(const char *s)
|
||||
{
|
||||
for( ; *s; ++s)
|
||||
if( !((*s >= 'A' && *s <= 'Z') || *s == '_' || (*s >= '0' && *s <= '9')) ) // accept any uppercase, number, and _ char
|
||||
return false;
|
||||
return true;
|
||||
for( ; *s; ++s)
|
||||
if( !((*s >= 'A' && *s <= 'Z') || *s == '_' || (*s >= '0' && *s <= '9')) ) // accept any uppercase, number, and _ char
|
||||
return false;
|
||||
return true;
|
||||
}
|
||||
|
||||
//----------------------------------//
|
||||
|
@ -634,31 +634,31 @@ luaFunc(indexWarnInstance)
|
|||
|
||||
static int dofile_helper(lua_State *L, const char *fname)
|
||||
{
|
||||
int n = lua_gettop(L);
|
||||
if (luaL_loadfile(L, fname) != 0) lua_error(L);
|
||||
lua_call(L, 0, LUA_MULTRET);
|
||||
return lua_gettop(L) - n;
|
||||
int n = lua_gettop(L);
|
||||
if (luaL_loadfile(L, fname) != 0) lua_error(L);
|
||||
lua_call(L, 0, LUA_MULTRET);
|
||||
return lua_gettop(L) - n;
|
||||
}
|
||||
|
||||
luaFunc(dofile_caseinsensitive)
|
||||
{
|
||||
// This is Lua's dofile(), with some tweaks. --ryan.
|
||||
const char *rawname = luaL_checkstring(L, 1);
|
||||
const char *rawname = luaL_checkstring(L, 1);
|
||||
std::string fname;
|
||||
|
||||
if (dsq->mod.isActive())
|
||||
{
|
||||
fname += dsq->mod.getPath();
|
||||
fname += '/';
|
||||
fname += rawname;
|
||||
fname = core->adjustFilenameCase(fname);
|
||||
if (exists(fname))
|
||||
return dofile_helper(L, fname.c_str());
|
||||
}
|
||||
if (dsq->mod.isActive())
|
||||
{
|
||||
fname += dsq->mod.getPath();
|
||||
fname += '/';
|
||||
fname += rawname;
|
||||
fname = core->adjustFilenameCase(fname);
|
||||
if (exists(fname))
|
||||
return dofile_helper(L, fname.c_str());
|
||||
}
|
||||
|
||||
// try absolute path
|
||||
fname = core->adjustFilenameCase(rawname);
|
||||
return dofile_helper(L, fname.c_str());
|
||||
// try absolute path
|
||||
fname = core->adjustFilenameCase(rawname);
|
||||
return dofile_helper(L, fname.c_str());
|
||||
}
|
||||
|
||||
luaFunc(randRange)
|
||||
|
@ -1039,8 +1039,8 @@ luaFunc(entity_setBoneLock)
|
|||
Entity *e = entity(L);
|
||||
Entity *e2 = entity(L, 2);
|
||||
Bone *b = 0;
|
||||
if (lua_isuserdata(L, 3))
|
||||
b = bone(L, 3);
|
||||
if (lua_isuserdata(L, 3))
|
||||
b = bone(L, 3);
|
||||
bool ret = false;
|
||||
if (e)
|
||||
{
|
||||
|
@ -2297,9 +2297,9 @@ luaFunc(entity_setColor)
|
|||
if (e)
|
||||
{
|
||||
//e->color = Vector(lua_tonumber(L, 2), lua_tonumber(L, 3), lua_tonumber(L, 4));
|
||||
e->color.interpolateTo(Vector(lua_tonumber(L, 2), lua_tonumber(L, 3), lua_tonumber(L, 4)),
|
||||
lua_tonumber(L, 5), lua_tonumber(L, 6), lua_tointeger(L, 7), lua_tointeger(L, 8));
|
||||
}
|
||||
e->color.interpolateTo(Vector(lua_tonumber(L, 2), lua_tonumber(L, 3), lua_tonumber(L, 4)),
|
||||
lua_tonumber(L, 5), lua_tonumber(L, 6), lua_tointeger(L, 7), lua_tointeger(L, 8));
|
||||
}
|
||||
luaReturnInt(0);
|
||||
}
|
||||
|
||||
|
@ -3289,13 +3289,13 @@ luaFunc(node_getName)
|
|||
|
||||
luaFunc(node_getLabel)
|
||||
{
|
||||
Path *p = path(L);
|
||||
const char *s = "";
|
||||
if (p)
|
||||
{
|
||||
s = p->label.c_str();
|
||||
}
|
||||
luaReturnStr(s);
|
||||
Path *p = path(L);
|
||||
const char *s = "";
|
||||
if (p)
|
||||
{
|
||||
s = p->label.c_str();
|
||||
}
|
||||
luaReturnStr(s);
|
||||
}
|
||||
|
||||
luaFunc(node_getPathPosition)
|
||||
|
@ -3575,7 +3575,7 @@ luaFunc(avatar_incrLeaches)
|
|||
luaFunc(avatar_decrLeaches)
|
||||
{
|
||||
if(dsq->game->avatar->leaches)
|
||||
dsq->game->avatar->leaches--;
|
||||
dsq->game->avatar->leaches--;
|
||||
luaReturnNum(0);
|
||||
}
|
||||
|
||||
|
@ -5079,8 +5079,8 @@ luaFunc(updateMusic)
|
|||
luaFunc(entity_grabTarget)
|
||||
{
|
||||
Entity *e = entity(L);
|
||||
if (e)
|
||||
e->attachEntity(e->getTargetEntity(), Vector(lua_tointeger(L, 2), lua_tointeger(L, 3)));
|
||||
if (e)
|
||||
e->attachEntity(e->getTargetEntity(), Vector(lua_tointeger(L, 2), lua_tointeger(L, 3)));
|
||||
luaReturnNum(0);
|
||||
}
|
||||
|
||||
|
@ -5116,8 +5116,8 @@ luaFunc(entity_checkSurface)
|
|||
luaFunc(entity_switchSurfaceDirection)
|
||||
{
|
||||
ScriptedEntity *e = scriptedEntity(L);
|
||||
if (!e)
|
||||
luaReturnNum(0);
|
||||
if (!e)
|
||||
luaReturnNum(0);
|
||||
|
||||
int n = -1;
|
||||
if (lua_isnumber(L, 2))
|
||||
|
@ -5337,8 +5337,8 @@ luaFunc(entity_rotateToSurfaceNormal)
|
|||
luaFunc(entity_releaseTarget)
|
||||
{
|
||||
Entity *e = entity(L);
|
||||
if (e)
|
||||
e->detachEntity(e->getTargetEntity());
|
||||
if (e)
|
||||
e->detachEntity(e->getTargetEntity());
|
||||
luaReturnNum(0);
|
||||
}
|
||||
|
||||
|
@ -5356,9 +5356,9 @@ luaFunc(egetv)
|
|||
{
|
||||
Entity *e = entity(L);
|
||||
EV ev = (EV)lua_tointeger(L, 2);
|
||||
int v = 0;
|
||||
if (e)
|
||||
v = e->getv(ev);
|
||||
int v = 0;
|
||||
if (e)
|
||||
v = e->getv(ev);
|
||||
luaReturnNum(v);
|
||||
}
|
||||
|
||||
|
@ -5375,13 +5375,13 @@ luaFunc(esetvf)
|
|||
luaFunc(egetvf)
|
||||
{
|
||||
Entity *e = entity(L);
|
||||
float vf = 0;
|
||||
if (e)
|
||||
{
|
||||
EV ev = (EV)lua_tointeger(L, 2);
|
||||
vf = e->getvf(ev);
|
||||
}
|
||||
luaReturnNum(vf);
|
||||
float vf = 0;
|
||||
if (e)
|
||||
{
|
||||
EV ev = (EV)lua_tointeger(L, 2);
|
||||
vf = e->getvf(ev);
|
||||
}
|
||||
luaReturnNum(vf);
|
||||
}
|
||||
|
||||
luaFunc(eisv)
|
||||
|
@ -5658,15 +5658,15 @@ luaFunc(entity_setActivation)
|
|||
{
|
||||
ScriptedEntity *e = scriptedEntity(L);
|
||||
if (e)
|
||||
{
|
||||
int type = lua_tonumber(L, 2);
|
||||
// cursor radius
|
||||
int activationRadius = lua_tonumber(L, 3);
|
||||
int range = lua_tonumber(L, 4);
|
||||
e->activationType = (Entity::ActivationType)type;
|
||||
e->activationRange = range;
|
||||
e->activationRadius = activationRadius;
|
||||
}
|
||||
{
|
||||
int type = lua_tonumber(L, 2);
|
||||
// cursor radius
|
||||
int activationRadius = lua_tonumber(L, 3);
|
||||
int range = lua_tonumber(L, 4);
|
||||
e->activationType = (Entity::ActivationType)type;
|
||||
e->activationRange = range;
|
||||
e->activationRadius = activationRadius;
|
||||
}
|
||||
|
||||
luaReturnNum(0);
|
||||
}
|
||||
|
@ -5684,8 +5684,8 @@ luaFunc(entity_setCullRadius)
|
|||
luaFunc(entity_setActivationType)
|
||||
{
|
||||
Entity *e = entity(L);
|
||||
if (e)
|
||||
e->activationType = (Entity::ActivationType)lua_tointeger(L, 2);
|
||||
if (e)
|
||||
e->activationType = (Entity::ActivationType)lua_tointeger(L, 2);
|
||||
|
||||
luaReturnInt(0);
|
||||
}
|
||||
|
@ -5837,11 +5837,11 @@ luaFunc(entity_setVelLen)
|
|||
|
||||
luaFunc(entity_getVel)
|
||||
{
|
||||
Entity *e = entity(L);
|
||||
Vector v;
|
||||
if (e)
|
||||
v = e->vel;
|
||||
luaReturnVec2(v.x, v.y);
|
||||
Entity *e = entity(L);
|
||||
Vector v;
|
||||
if (e)
|
||||
v = e->vel;
|
||||
luaReturnVec2(v.x, v.y);
|
||||
}
|
||||
|
||||
// entity dt speed dir
|
||||
|
@ -5973,8 +5973,8 @@ luaFunc(getEntityByID)
|
|||
luaFunc(node_setEffectOn)
|
||||
{
|
||||
Path *p = path(L, 1);
|
||||
if (p)
|
||||
p->setEffectOn(getBool(L, 2));
|
||||
if (p)
|
||||
p->setEffectOn(getBool(L, 2));
|
||||
luaReturnNum(0);
|
||||
}
|
||||
|
||||
|
@ -5994,19 +5994,19 @@ luaFunc(node_activate)
|
|||
luaFunc(node_setElementsInLayerActive)
|
||||
{
|
||||
Path *p = path(L);
|
||||
if (p)
|
||||
{
|
||||
int l = lua_tonumber(L, 2);
|
||||
bool v = getBool(L, 3);
|
||||
for (Element *e = dsq->getFirstElementOnLayer(l); e; e = e->bgLayerNext)
|
||||
{
|
||||
if (e && p->isCoordinateInside(e->position))
|
||||
{
|
||||
debugLog("setting an element to the value");
|
||||
e->setElementActive(v);
|
||||
}
|
||||
}
|
||||
}
|
||||
if (p)
|
||||
{
|
||||
int l = lua_tonumber(L, 2);
|
||||
bool v = getBool(L, 3);
|
||||
for (Element *e = dsq->getFirstElementOnLayer(l); e; e = e->bgLayerNext)
|
||||
{
|
||||
if (e && p->isCoordinateInside(e->position))
|
||||
{
|
||||
debugLog("setting an element to the value");
|
||||
e->setElementActive(v);
|
||||
}
|
||||
}
|
||||
}
|
||||
luaReturnNum(0);
|
||||
}
|
||||
|
||||
|
@ -6055,11 +6055,11 @@ luaFunc(node_getNearestEntity)
|
|||
|
||||
Vector pos = p->nodes[0].position;
|
||||
std::string name;
|
||||
Entity *ignore = 0;
|
||||
Entity *ignore = 0;
|
||||
if (lua_isstring(L, 2))
|
||||
name = lua_tostring(L, 2);
|
||||
if (lua_isuserdata(L, 3))
|
||||
ignore = entity(L, 3);
|
||||
if (lua_isuserdata(L, 3))
|
||||
ignore = entity(L, 3);
|
||||
|
||||
float smallestDist = HUGE_VALF;
|
||||
FOR_ENTITIES(i)
|
||||
|
@ -6091,7 +6091,7 @@ luaFunc(node_getNearestNode)
|
|||
std::string name;
|
||||
if (lua_isstring(L, 2))
|
||||
name = lua_tostring(L, 2);
|
||||
Path *ignore = path(L, 3);
|
||||
Path *ignore = path(L, 3);
|
||||
closest = dsq->game->getNearestPath(p->nodes[0].position, name, ignore);
|
||||
}
|
||||
luaReturnPtr(closest);
|
||||
|
@ -6122,15 +6122,15 @@ luaFunc(entity_getNearestBoneToPosition)
|
|||
luaFunc(entity_getNearestNode)
|
||||
{
|
||||
Entity *me = entity(L);
|
||||
Path *closest = 0;
|
||||
if (me)
|
||||
{
|
||||
std::string name;
|
||||
if (lua_isstring(L, 2))
|
||||
name = lua_tostring(L, 2);
|
||||
Path *ignore = path(L, 3);
|
||||
closest = dsq->game->getNearestPath(me->position, name, ignore);
|
||||
}
|
||||
Path *closest = 0;
|
||||
if (me)
|
||||
{
|
||||
std::string name;
|
||||
if (lua_isstring(L, 2))
|
||||
name = lua_tostring(L, 2);
|
||||
Path *ignore = path(L, 3);
|
||||
closest = dsq->game->getNearestPath(me->position, name, ignore);
|
||||
}
|
||||
luaReturnPtr(closest);
|
||||
}
|
||||
|
||||
|
@ -6144,8 +6144,8 @@ luaFunc(ing_hasIET)
|
|||
luaFunc(entity_getNearestEntity)
|
||||
{
|
||||
Entity *me = entity(L);
|
||||
if (!me)
|
||||
luaReturnPtr(0);
|
||||
if (!me)
|
||||
luaReturnPtr(0);
|
||||
|
||||
const char *name = 0;
|
||||
if (lua_isstring(L, 2))
|
||||
|
@ -6166,9 +6166,9 @@ luaFunc(entity_getNearestEntity)
|
|||
int type = lua_tointeger(L, 4);
|
||||
int damageTarget = lua_tointeger(L, 5);
|
||||
Entity *closest = 0;
|
||||
Entity *ignore = 0;
|
||||
if (lua_isuserdata(L, 6))
|
||||
ignore = entity(L, 6);
|
||||
Entity *ignore = 0;
|
||||
if (lua_isuserdata(L, 6))
|
||||
ignore = entity(L, 6);
|
||||
|
||||
float smallestDist = range ? sqr(range) : HUGE_VALF;
|
||||
FOR_ENTITIES(i)
|
||||
|
@ -6303,17 +6303,17 @@ luaFunc(entity_alpha)
|
|||
luaFunc(entity_partAlpha)
|
||||
{
|
||||
ScriptedEntity *e = scriptedEntity(L);
|
||||
if (e)
|
||||
{
|
||||
RenderObject *r = e->partMap[lua_tostring(L, 2)];
|
||||
if (r)
|
||||
{
|
||||
float start = lua_tonumber(L, 3);
|
||||
if (start != -1)
|
||||
r->alpha = start;
|
||||
r->alpha.interpolateTo(lua_tonumber(L, 4), lua_tonumber(L, 5), lua_tointeger(L, 6), lua_tointeger(L, 7), lua_tointeger(L, 8));
|
||||
}
|
||||
}
|
||||
if (e)
|
||||
{
|
||||
RenderObject *r = e->partMap[lua_tostring(L, 2)];
|
||||
if (r)
|
||||
{
|
||||
float start = lua_tonumber(L, 3);
|
||||
if (start != -1)
|
||||
r->alpha = start;
|
||||
r->alpha.interpolateTo(lua_tonumber(L, 4), lua_tonumber(L, 5), lua_tointeger(L, 6), lua_tointeger(L, 7), lua_tointeger(L, 8));
|
||||
}
|
||||
}
|
||||
|
||||
luaReturnNum(0);
|
||||
}
|
||||
|
@ -6321,22 +6321,22 @@ luaFunc(entity_partAlpha)
|
|||
luaFunc(entity_partBlendType)
|
||||
{
|
||||
ScriptedEntity *e = scriptedEntity(L);
|
||||
if (e)
|
||||
e->partMap[lua_tostring(L, 2)]->setBlendType(lua_tointeger(L, 3));
|
||||
if (e)
|
||||
e->partMap[lua_tostring(L, 2)]->setBlendType(lua_tointeger(L, 3));
|
||||
luaReturnInt(0);
|
||||
}
|
||||
|
||||
luaFunc(entity_partRotate)
|
||||
{
|
||||
ScriptedEntity *e = scriptedEntity(L);
|
||||
if (e)
|
||||
{
|
||||
RenderObject *r = e->partMap[lua_tostring(L, 2)];
|
||||
if (r)
|
||||
{
|
||||
r->rotation.interpolateTo(Vector(0,0,lua_tointeger(L, 3)), lua_tonumber(L, 4), lua_tointeger(L, 5), lua_tointeger(L, 6), lua_tointeger(L, 7));
|
||||
}
|
||||
}
|
||||
if (e)
|
||||
{
|
||||
RenderObject *r = e->partMap[lua_tostring(L, 2)];
|
||||
if (r)
|
||||
{
|
||||
r->rotation.interpolateTo(Vector(0,0,lua_tointeger(L, 3)), lua_tonumber(L, 4), lua_tointeger(L, 5), lua_tointeger(L, 6), lua_tointeger(L, 7));
|
||||
}
|
||||
}
|
||||
|
||||
luaReturnNum(0);
|
||||
}
|
||||
|
@ -6376,30 +6376,30 @@ luaFunc(entity_offsetUpdate)
|
|||
luaFunc(entity_scale)
|
||||
{
|
||||
Entity *e = entity(L);
|
||||
if (e)
|
||||
{
|
||||
float time = lua_tonumber(L, 4);
|
||||
//e->scale = Vector(lua_tonumber(L, 2), lua_tonumber(L, 3));
|
||||
e->scale.interpolateTo(Vector(lua_tonumber(L, 2), lua_tonumber(L, 3), 0), time, lua_tonumber(L, 5), lua_tonumber(L, 6), lua_tonumber(L, 7));
|
||||
}
|
||||
luaReturnNum(0);
|
||||
if (e)
|
||||
{
|
||||
float time = lua_tonumber(L, 4);
|
||||
//e->scale = Vector(lua_tonumber(L, 2), lua_tonumber(L, 3));
|
||||
e->scale.interpolateTo(Vector(lua_tonumber(L, 2), lua_tonumber(L, 3), 0), time, lua_tonumber(L, 5), lua_tonumber(L, 6), lua_tonumber(L, 7));
|
||||
}
|
||||
luaReturnNum(0);
|
||||
}
|
||||
|
||||
luaFunc(entity_switchLayer)
|
||||
{
|
||||
Entity *e = entity(L);
|
||||
if (e)
|
||||
{
|
||||
int lcode = lua_tonumber(L, 2);
|
||||
int toLayer = LR_ENTITIES;
|
||||
if (e)
|
||||
{
|
||||
int lcode = lua_tonumber(L, 2);
|
||||
int toLayer = LR_ENTITIES;
|
||||
|
||||
toLayer = dsq->getEntityLayerToLayer(lcode);
|
||||
toLayer = dsq->getEntityLayerToLayer(lcode);
|
||||
|
||||
if (e->getEntityType() == ET_AVATAR)
|
||||
toLayer = LR_ENTITIES;
|
||||
if (e->getEntityType() == ET_AVATAR)
|
||||
toLayer = LR_ENTITIES;
|
||||
|
||||
core->switchRenderObjectLayer(e, toLayer);
|
||||
}
|
||||
core->switchRenderObjectLayer(e, toLayer);
|
||||
}
|
||||
luaReturnNum(0);
|
||||
}
|
||||
|
||||
|
@ -6508,24 +6508,24 @@ luaFunc(entity_initPart)
|
|||
|
||||
|
||||
ScriptedEntity *e = scriptedEntity(L);
|
||||
if (e)
|
||||
{
|
||||
Quad *q = new Quad;
|
||||
q->setTexture(partTex);
|
||||
q->renderBeforeParent = !renderAfter;
|
||||
if (e)
|
||||
{
|
||||
Quad *q = new Quad;
|
||||
q->setTexture(partTex);
|
||||
q->renderBeforeParent = !renderAfter;
|
||||
|
||||
|
||||
q->position = partPosition;
|
||||
if (offsetInterpolateTo.x != 0 || offsetInterpolateTo.y != 0)
|
||||
q->offset.interpolateTo(offsetInterpolateTo, offsetInterpolateTime, -1, 1, 1);
|
||||
if (partFlipH)
|
||||
q->flipHorizontal();
|
||||
if (partFlipV)
|
||||
q->flipVertical();
|
||||
q->position = partPosition;
|
||||
if (offsetInterpolateTo.x != 0 || offsetInterpolateTo.y != 0)
|
||||
q->offset.interpolateTo(offsetInterpolateTo, offsetInterpolateTime, -1, 1, 1);
|
||||
if (partFlipH)
|
||||
q->flipHorizontal();
|
||||
if (partFlipV)
|
||||
q->flipVertical();
|
||||
|
||||
e->addChild(q, PM_POINTER);
|
||||
e->registerNewPart(q, partName);
|
||||
}
|
||||
e->addChild(q, PM_POINTER);
|
||||
e->registerNewPart(q, partName);
|
||||
}
|
||||
|
||||
luaReturnNum(0);
|
||||
}
|
||||
|
@ -7105,14 +7105,14 @@ luaFunc(entity_setFlag)
|
|||
|
||||
luaFunc(entity_getFlag)
|
||||
{
|
||||
Entity *e = entity(L);
|
||||
int v = lua_tonumber(L, 2);
|
||||
int ret = 0;
|
||||
if (e)
|
||||
{
|
||||
ret = dsq->continuity.getEntityFlag(dsq->game->sceneName, e->getID());
|
||||
}
|
||||
luaReturnNum(ret);
|
||||
Entity *e = entity(L);
|
||||
int v = lua_tonumber(L, 2);
|
||||
int ret = 0;
|
||||
if (e)
|
||||
{
|
||||
ret = dsq->continuity.getEntityFlag(dsq->game->sceneName, e->getID());
|
||||
}
|
||||
luaReturnNum(ret);
|
||||
}
|
||||
|
||||
luaFunc(isFlag)
|
||||
|
@ -7639,7 +7639,7 @@ static const struct {
|
|||
luaRegister(entity_moveAround),
|
||||
|
||||
luaRegister(entity_setVelLen),
|
||||
luaRegister(entity_getVel),
|
||||
luaRegister(entity_getVel),
|
||||
|
||||
luaRegister(entity_setMaxSpeed),
|
||||
luaRegister(entity_getMaxSpeed),
|
||||
|
@ -7828,7 +7828,7 @@ static const struct {
|
|||
|
||||
luaRegister(entity_isFlag),
|
||||
luaRegister(entity_setFlag),
|
||||
luaRegister(entity_getFlag),
|
||||
luaRegister(entity_getFlag),
|
||||
|
||||
luaRegister(node_isFlag),
|
||||
luaRegister(node_setFlag),
|
||||
|
@ -8002,7 +8002,7 @@ static const struct {
|
|||
|
||||
luaRegister(node_activate),
|
||||
luaRegister(node_getName),
|
||||
luaRegister(node_getLabel),
|
||||
luaRegister(node_getLabel),
|
||||
luaRegister(node_getPathPosition),
|
||||
luaRegister(node_getPosition),
|
||||
luaRegister(node_setPosition),
|
||||
|
@ -8175,10 +8175,10 @@ static const struct {
|
|||
luaRegister(getLastCollidePosition),
|
||||
|
||||
|
||||
// -- deprecated/compatibility related functions below here --
|
||||
// -- deprecated/compatibility related functions below here --
|
||||
|
||||
{"entity_incrTargetLeaches", l_avatar_incrLeaches},
|
||||
{"entity_decrTargetLeaches", l_avatar_decrLeaches},
|
||||
{"entity_incrTargetLeaches", l_avatar_incrLeaches},
|
||||
{"entity_decrTargetLeaches", l_avatar_decrLeaches},
|
||||
};
|
||||
|
||||
//============================================================================================
|
||||
|
@ -9039,9 +9039,9 @@ Script *ScriptInterface::openScript(const std::string &file, bool ignoremissing
|
|||
int result = luaL_loadfile(baseState, realFile.c_str());
|
||||
if (result != 0)
|
||||
{
|
||||
if(result != LUA_ERRFILE || (result == LUA_ERRFILE && !ignoremissing))
|
||||
scriptError("Error loading script [" + realFile + "]: " + lua_tostring(baseState, -1));
|
||||
lua_pop(baseState, 2);
|
||||
if(result != LUA_ERRFILE || (result == LUA_ERRFILE && !ignoremissing))
|
||||
scriptError("Error loading script [" + realFile + "]: " + lua_tostring(baseState, -1));
|
||||
lua_pop(baseState, 2);
|
||||
return NULL;
|
||||
}
|
||||
|
||||
|
|
|
@ -214,7 +214,7 @@ public:
|
|||
SkeletalSprite *editSprite;
|
||||
Bone *editingBone;
|
||||
int boneEdit;
|
||||
DebugFont *text, *text2;
|
||||
DebugFont *text;
|
||||
int ignoreBone;
|
||||
|
||||
void ignoreBone0();
|
||||
|
|
|
@ -24,18 +24,10 @@ StringBank::StringBank()
|
|||
{
|
||||
}
|
||||
|
||||
void StringBank::load()
|
||||
{
|
||||
stringMap.clear();
|
||||
|
||||
_load("data/stringbank.txt");
|
||||
if (dsq->mod.isActive())
|
||||
_load(dsq->mod.getPath() + "stringbank.txt");
|
||||
}
|
||||
|
||||
void StringBank::_load(const std::string &file)
|
||||
void StringBank::load(const std::string &file)
|
||||
{
|
||||
//debugLog("StringBank::load("+file+")");
|
||||
stringMap.clear();
|
||||
|
||||
std::ifstream in(file.c_str());
|
||||
|
||||
|
|
|
@ -25,7 +25,7 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
|||
#include "Game.h"
|
||||
#include "Avatar.h"
|
||||
#else
|
||||
#include "tinyxml.h"
|
||||
#include "../ExternalLibs/tinyxml.h"
|
||||
#endif
|
||||
|
||||
#ifdef BBGE_BUILD_WINDOWS
|
||||
|
|
|
@ -1029,61 +1029,59 @@ void WorldMapRender::onUpdate(float dt)
|
|||
internalOffset += mouseChange / scale.x;
|
||||
}
|
||||
|
||||
if(!editorActive)
|
||||
{
|
||||
float scrollSpeed = 2.0f;
|
||||
float amt = (400*dt)/scale.x;
|
||||
if (isActing(ACTION_SWIMLEFT))
|
||||
{
|
||||
internalOffset += Vector(amt, 0);
|
||||
}
|
||||
if (isActing(ACTION_SWIMRIGHT))
|
||||
{
|
||||
internalOffset += Vector(-amt, 0);
|
||||
}
|
||||
if (isActing(ACTION_SWIMDOWN))
|
||||
{
|
||||
if (core->getShiftState())
|
||||
{
|
||||
scale.stop();
|
||||
scale -= Vector(scrollSpeed*dt, scrollSpeed*dt);
|
||||
}
|
||||
else
|
||||
{
|
||||
internalOffset += Vector(0, -amt);
|
||||
}
|
||||
}
|
||||
if (isActing(ACTION_SWIMUP))
|
||||
{
|
||||
if (core->getShiftState())
|
||||
{
|
||||
scale.stop();
|
||||
scale += Vector(scrollSpeed*dt, scrollSpeed*dt);
|
||||
}
|
||||
else
|
||||
{
|
||||
internalOffset += Vector(0, amt);
|
||||
}
|
||||
}
|
||||
|
||||
float scrollSpeed = 2.0f;
|
||||
float amt = (400*dt)/scale.x;
|
||||
if (isActing(ACTION_SWIMLEFT))
|
||||
{
|
||||
internalOffset += Vector(amt, 0);
|
||||
}
|
||||
if (isActing(ACTION_SWIMRIGHT))
|
||||
{
|
||||
internalOffset += Vector(-amt, 0);
|
||||
}
|
||||
if (isActing(ACTION_SWIMDOWN))
|
||||
{
|
||||
if (core->getShiftState())
|
||||
{
|
||||
scale.stop();
|
||||
scale -= Vector(scrollSpeed*dt, scrollSpeed*dt);
|
||||
}
|
||||
else
|
||||
{
|
||||
internalOffset += Vector(0, -amt);
|
||||
}
|
||||
}
|
||||
if (isActing(ACTION_SWIMUP))
|
||||
{
|
||||
if (core->getShiftState())
|
||||
{
|
||||
scale.stop();
|
||||
scale += Vector(scrollSpeed*dt, scrollSpeed*dt);
|
||||
}
|
||||
else
|
||||
{
|
||||
internalOffset += Vector(0, amt);
|
||||
}
|
||||
}
|
||||
|
||||
if (core->joystickEnabled)
|
||||
{
|
||||
if (isActing(ACTION_SECONDARY))
|
||||
{
|
||||
if (core->joystick.position.y >= 0.6f)
|
||||
scale.interpolateTo(scale / 1.2f, 0.1f);
|
||||
else if (core->joystick.position.y <= -0.6f)
|
||||
scale.interpolateTo(scale * 1.2f, 0.1f);
|
||||
}
|
||||
else
|
||||
{
|
||||
// The negative multiplier is deliberate -- it makes the
|
||||
// map scroll as though the joystick was controlling the
|
||||
// cursor (which is fixed in the center of the screen).
|
||||
internalOffset += core->joystick.position * (-400*dt / scale.x);
|
||||
}
|
||||
}
|
||||
}
|
||||
if (core->joystickEnabled)
|
||||
{
|
||||
if (isActing(ACTION_SECONDARY))
|
||||
{
|
||||
if (core->joystick.position.y >= 0.6f)
|
||||
scale.interpolateTo(scale / 1.2f, 0.1f);
|
||||
else if (core->joystick.position.y <= -0.6f)
|
||||
scale.interpolateTo(scale * 1.2f, 0.1f);
|
||||
}
|
||||
else
|
||||
{
|
||||
// The negative multiplier is deliberate -- it makes the
|
||||
// map scroll as though the joystick was controlling the
|
||||
// cursor (which is fixed in the center of the screen).
|
||||
internalOffset += core->joystick.position * (-400*dt / scale.x);
|
||||
}
|
||||
}
|
||||
|
||||
if (activeTile && activeTile->layer == 1)
|
||||
{
|
||||
|
@ -1138,22 +1136,11 @@ void WorldMapRender::onUpdate(float dt)
|
|||
|
||||
if (core->getShiftState())
|
||||
{
|
||||
if (core->getCtrlState())
|
||||
a2 *= 10.0f;
|
||||
if (core->getKeyState(KEY_UP))
|
||||
activeTile->scale2 += -a2;
|
||||
if (core->getKeyState(KEY_DOWN))
|
||||
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
|
||||
{
|
||||
if (core->getCtrlState())
|
||||
|
@ -1172,23 +1159,19 @@ void WorldMapRender::onUpdate(float dt)
|
|||
|
||||
if (core->getKeyState(KEY_F2))
|
||||
{
|
||||
dsq->continuity.worldMap.save();
|
||||
dsq->continuity.worldMap.save("data/WorldMap.txt");
|
||||
}
|
||||
|
||||
activeQuad->position = activeTile->gridPos;
|
||||
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
|
||||
{
|
||||
#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 screenHeight = core->getVirtualHeight() * core->invGlobalScale;
|
||||
|
@ -1248,16 +1231,11 @@ Vector WorldMapRender::getAvatarWorldMapPosition()
|
|||
|
||||
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;
|
||||
p = Vector((position.x/TILE_SIZE) / (sizew*tile->scale), (position.y/TILE_SIZE) / (sizeh*tile->scale));
|
||||
p.x *= sizew*tile->scale*0.25f*tile->scale2;
|
||||
p.y *= sizeh*tile->scale*0.25f*tile->scale2;
|
||||
p = (position/TILE_SIZE) / (256*tile->scale);
|
||||
p *= 256*tile->scale*0.25f*tile->scale2;
|
||||
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)
|
||||
p += tile->gridPos;
|
||||
return p;
|
||||
|
@ -1320,7 +1298,7 @@ void WorldMapRender::toggle(bool turnON)
|
|||
if (dsq->game->miniMapRender->isRadarHide()) return;
|
||||
if (alpha.isInterpolating()) return;
|
||||
|
||||
if (dsq->mod.isActive() && !dsq->mod.hasWorldMap()) return;
|
||||
if (dsq->mod.isActive()) 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)
|
||||
{
|
||||
if (isOn())
|
||||
|
@ -1539,7 +1505,7 @@ void WorldMapRender::action (int id, int state)
|
|||
|
||||
if (editorActive)
|
||||
{
|
||||
updateEditor();
|
||||
areaLabel->setText("EDITING...");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -240,21 +240,13 @@ WorldMap::WorldMap()
|
|||
gw=gh=0;
|
||||
}
|
||||
|
||||
void WorldMap::load()
|
||||
{
|
||||
if (!dsq->mod.isActive())
|
||||
_load("data/worldmap.txt");
|
||||
else
|
||||
_load(dsq->mod.getPath() + "worldmap.txt");
|
||||
}
|
||||
|
||||
void WorldMap::_load(const std::string &file)
|
||||
void WorldMap::load(const std::string &file)
|
||||
{
|
||||
worldMapTiles.clear();
|
||||
|
||||
std::string line;
|
||||
|
||||
std::ifstream in(file.c_str());
|
||||
std::ifstream in(file.c_str());
|
||||
|
||||
while (std::getline(in, line))
|
||||
{
|
||||
|
@ -267,30 +259,15 @@ void WorldMap::_load(const std::string &file)
|
|||
}
|
||||
}
|
||||
|
||||
void WorldMap::save()
|
||||
void WorldMap::save(const std::string &file)
|
||||
{
|
||||
std::string fn;
|
||||
|
||||
if (dsq->mod.isActive())
|
||||
fn = dsq->mod.getPath() + "worldmap.txt";
|
||||
else
|
||||
fn = "data/worldmap.txt";
|
||||
|
||||
std::ofstream out(fn.c_str());
|
||||
|
||||
if (out)
|
||||
{
|
||||
for (int i = 0; i < worldMapTiles.size(); 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;
|
||||
}
|
||||
dsq->screenMessage("Saved worldmap data to " + fn);
|
||||
}
|
||||
else
|
||||
{
|
||||
dsq->screenMessage("Unable to save worldmap to " + fn);
|
||||
}
|
||||
std::ofstream out(file.c_str());
|
||||
|
||||
for (int i = 0; i < worldMapTiles.size(); i++)
|
||||
{
|
||||
WorldMapTile *t = &worldMapTiles[i];
|
||||
out << t->index << " " << t->name << " " << t->layer << " " << t->scale << " " << t->gridPos.x << " " << t->gridPos.y << " " << t->prerevealed << " " << t->scale2 << std::endl;
|
||||
}
|
||||
}
|
||||
|
||||
void WorldMap::revealMap(const std::string &name)
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue