From 47b8c75dcbfe8a8e947adb41ec09f2ed14abcd1e Mon Sep 17 00:00:00 2001 From: fgenesis Date: Wed, 11 Dec 2013 03:06:38 +0100 Subject: [PATCH 1/5] Fix linux/osx build --- BBGE/Vector.h | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/BBGE/Vector.h b/BBGE/Vector.h index 033f827..19e6b15 100644 --- a/BBGE/Vector.h +++ b/BBGE/Vector.h @@ -21,7 +21,7 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. #ifndef BBGE_VECTOR_H #define BBGE_VECTOR_H -#include +#include #include #include #include "Event.h" @@ -374,7 +374,7 @@ public: #ifdef BBGE_BUILD_WINDOWS return _isnan(x) || _isnan(y) || _isnan(z); #elif defined(BBGE_BUILD_UNIX) - return isnan(x) || isnan(y) || isnan(z); + return std::isnan(x) || std::isnan(y) || std::isnan(z); #else return false; #endif From 82ab3fa60c6718ddc5fb752756d406cab809c6f0 Mon Sep 17 00:00:00 2001 From: fgenesis Date: Wed, 11 Dec 2013 03:06:59 +0100 Subject: [PATCH 2/5] Fix OSX build with SDL1.2 (nasty, nasty) --- BBGE/Core.cpp | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/BBGE/Core.cpp b/BBGE/Core.cpp index f6fa00a..ad60431 100644 --- a/BBGE/Core.cpp +++ b/BBGE/Core.cpp @@ -3561,7 +3561,11 @@ void Core::pollEvents() case SDL_KEYDOWN: { #if __APPLE__ - if ((event.key.keysym.sym == SDLK_q) && (event.key.keysym.mod & KMOD_GUI)) + #if SDL_VERSION_ATLEAST(2, 0, 0) + if ((event.key.keysym.sym == SDLK_q) && (event.key.keysym.mod & KMOD_GUI)) + #else + if ((event.key.keysym.sym == SDLK_q) && (event.key.keysym.mod & KMOD_META)) + #endif #else if ((event.key.keysym.sym == SDLK_F4) && (event.key.keysym.mod & KMOD_ALT)) #endif From 5336c8d35086dc5e7494d2d2803a16e4c55a1ba0 Mon Sep 17 00:00:00 2001 From: fgenesis Date: Wed, 11 Dec 2013 03:36:44 +0100 Subject: [PATCH 3/5] Fix linux build, once more, now for real --- Aquaria/ModSelector.cpp | 5 +++-- Aquaria/ScriptInterface.cpp | 7 ++++--- 2 files changed, 7 insertions(+), 5 deletions(-) diff --git a/Aquaria/ModSelector.cpp b/Aquaria/ModSelector.cpp index 22f2a88..6a7f222 100644 --- a/Aquaria/ModSelector.cpp +++ b/Aquaria/ModSelector.cpp @@ -24,6 +24,7 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. #include "AquariaProgressBar.h" #include "tinyxml.h" #include "ModSelector.h" +#include #ifdef BBGE_BUILD_VFS #include "ModDownloader.h" @@ -684,7 +685,7 @@ bool ModIconOnline::fixIcon() statusIcon = new Quad("modselect/ico_update", pos); statusIcon->alpha.interpolateTo(0.5f, 0.5f, -1, true, true); } - else + else statusIcon = new Quad("modselect/ico_check", pos); } @@ -819,7 +820,7 @@ void MenuIconBar::init() MenuIcon *ico; int y = (-height / 2) - 35; - + ico = new MenuIcon(0); ico->label = dsq->continuity.stringBank.get(2027); ico->useQuad("modselect/installed"); diff --git a/Aquaria/ScriptInterface.cpp b/Aquaria/ScriptInterface.cpp index cac06a1..5d92b50 100644 --- a/Aquaria/ScriptInterface.cpp +++ b/Aquaria/ScriptInterface.cpp @@ -36,6 +36,7 @@ extern "C" #include "Web.h" #include "GridRender.h" #include "AfterEffect.h" +#include #include "../BBGE/MathFunctions.h" @@ -2502,7 +2503,7 @@ luaFunc(entity_setBoneLock) Bone *b = 0; if (lua_isuserdata(L, 3)) b = bone(L, 3); - + bl.entity = e2; bl.bone = b; bl.on = true; @@ -2926,7 +2927,7 @@ luaFunc(entity_playSfx) if(sfx.vol <= 0) sfx.vol = 1; sfx.loops = lua_tonumber(L, 5); - + float fadeOut = lua_tonumber(L, 6); sfx.maxdist = lua_tonumber(L, 7); sfx.relative = false; @@ -8690,7 +8691,7 @@ luaFunc(shader_setAsAfterEffect) if(core->afterEffectManager) done = core->afterEffectManager->setShaderPipelinePos(handle, pos); - + luaReturnBool(done); } From 201b3a76bc7e2e5fd7260358058109dfa787ec6d Mon Sep 17 00:00:00 2001 From: fgenesis Date: Thu, 12 Dec 2013 23:14:17 +0100 Subject: [PATCH 4/5] Add Lua functions (+ related text class changes): - text_getHeight() - getUserInputString() --- Aquaria/ScriptInterface.cpp | 13 +++++++++++++ BBGE/BaseText.h | 1 + BBGE/BitmapFont.h | 2 +- BBGE/DebugFont.cpp | 5 +++++ BBGE/DebugFont.h | 1 + 5 files changed, 21 insertions(+), 1 deletion(-) diff --git a/Aquaria/ScriptInterface.cpp b/Aquaria/ScriptInterface.cpp index 5d92b50..79f264f 100644 --- a/Aquaria/ScriptInterface.cpp +++ b/Aquaria/ScriptInterface.cpp @@ -8507,6 +8507,11 @@ luaFunc(castLine) return 3; } +luaFunc(getUserInputString) +{ + luaReturnStr(dsq->getUserInputString(getString(L, 1), getString(L, 2), true).c_str()); +} + luaFunc(inv_isFull) { @@ -8658,6 +8663,12 @@ luaFunc(text_setAlign) luaReturnNil(); } +luaFunc(text_getHeight) +{ + BaseText *txt = getText(L); + luaReturnNum(txt ? txt->getHeight() : 0.0f); +} + luaFunc(loadShader) { int handle = 0; @@ -9314,6 +9325,7 @@ static const struct { luaRegister(getObstruction), luaRegister(findPath), luaRegister(castLine), + luaRegister(getUserInputString), luaRegister(isFlag), @@ -9706,6 +9718,7 @@ static const struct { luaRegister(text_setFontSize), luaRegister(text_setWidth), luaRegister(text_setAlign), + luaRegister(text_getHeight), luaRegister(loadShader), luaRegister(createShader), diff --git a/BBGE/BaseText.h b/BBGE/BaseText.h index a3be629..203bf18 100644 --- a/BBGE/BaseText.h +++ b/BBGE/BaseText.h @@ -13,6 +13,7 @@ public: virtual void setWidth(int width) = 0; virtual void setFontSize(int sz) = 0; virtual void setAlign(Align a) = 0; + virtual float getHeight() = 0; }; diff --git a/BBGE/BitmapFont.h b/BBGE/BitmapFont.h index 730e265..613faf9 100644 --- a/BBGE/BitmapFont.h +++ b/BBGE/BitmapFont.h @@ -72,7 +72,7 @@ public: void autoKern(); void setBitmapFontEffect(BitmapFontEffect bfe); void render(); - float getHeight(); + virtual float getHeight(); void unloadDevice(); void reloadDevice(); diff --git a/BBGE/DebugFont.cpp b/BBGE/DebugFont.cpp index d7611cc..f1ffc69 100644 --- a/BBGE/DebugFont.cpp +++ b/BBGE/DebugFont.cpp @@ -47,6 +47,11 @@ void DebugFont::setFontSize(int sz) fontDrawSize = sz; } +float DebugFont::getHeight() +{ + return fontDrawSize * lines.size() * 1.5f; // vspc in render() +} + void DebugFont::formatText() { std::string text; diff --git a/BBGE/DebugFont.h b/BBGE/DebugFont.h index c8620fd..2a1d5bc 100644 --- a/BBGE/DebugFont.h +++ b/BBGE/DebugFont.h @@ -33,6 +33,7 @@ public: void setFontSize(int sz); int getNumLines() { return lines.size(); } virtual void setAlign(Align align); + virtual float getHeight(); protected: int fontDrawSize, textWidth; void formatText(); From 900b481f999a9b0742ad63f9b1263b79b6b06e13 Mon Sep 17 00:00:00 2001 From: fgenesis Date: Thu, 12 Dec 2013 23:14:37 +0100 Subject: [PATCH 5/5] Reload stringbank on map editor map reload --- Aquaria/SceneEditor.cpp | 1 + 1 file changed, 1 insertion(+) diff --git a/Aquaria/SceneEditor.cpp b/Aquaria/SceneEditor.cpp index 739179b..bd22623 100644 --- a/Aquaria/SceneEditor.cpp +++ b/Aquaria/SceneEditor.cpp @@ -2365,6 +2365,7 @@ void SceneEditor::loadScene() dsq->game->loadEntityTypeList(); dsq->loadElementEffects(); dsq->continuity.loadSongBank(); + dsq->continuity.stringBank.load(); } void SceneEditor::saveScene()