From 74ad8f7804aeb5fa98a386d6ff327e46f5c57d8c Mon Sep 17 00:00:00 2001 From: fgenesis Date: Thu, 25 May 2023 16:58:08 +0200 Subject: [PATCH] Build fixes for Linux, some warnings and compatibility fixes for C++17 and up --- Aquaria/Avatar.h | 35 +++++++++++++------------- Aquaria/Beam.h | 4 +-- Aquaria/CMakeLists.txt | 11 ++++---- Aquaria/DSQ.cpp | 1 - Aquaria/Element.h | 4 +-- Aquaria/Entity.h | 16 ++++++------ Aquaria/Game.cpp | 8 +++--- Aquaria/GridRender.h | 6 ++--- Aquaria/Hair.h | 2 +- Aquaria/Logo.cpp | 56 ----------------------------------------- Aquaria/Logo.h | 35 -------------------------- Aquaria/SceneEditor.cpp | 1 - Aquaria/SceneEditor.h | 2 +- Aquaria/Segmented.h | 4 +-- Aquaria/States.cpp | 2 +- Aquaria/Web.h | 4 +-- BBGE/BaseText.h | 10 ++++---- BBGE/BitmapFont.cpp | 8 +++--- BBGE/BitmapFont.h | 24 +++++++++--------- BBGE/Core.cpp | 16 +++++------- BBGE/Core.h | 6 ++--- BBGE/DebugFont.cpp | 8 +++--- BBGE/DebugFont.h | 18 ++++++------- BBGE/Gradient.h | 2 +- BBGE/Particles.h | 4 +-- BBGE/Quad.h | 12 ++++----- BBGE/QuadGrid.h | 4 +-- BBGE/RenderObject.cpp | 2 +- BBGE/RoundedRect.h | 4 +-- BBGE/ScreenTransition.h | 4 +-- BBGE/SkeletalSprite.cpp | 1 + BBGE/SkeletalSprite.h | 2 +- BBGE/StateManager.cpp | 5 ++-- BBGE/StateManager.h | 4 +-- BBGE/TTFFont.cpp | 8 +++--- BBGE/TTFFont.h | 18 ++++++------- 36 files changed, 126 insertions(+), 225 deletions(-) delete mode 100644 Aquaria/Logo.cpp delete mode 100644 Aquaria/Logo.h diff --git a/Aquaria/Avatar.h b/Aquaria/Avatar.h index 8662108..36d4f2a 100644 --- a/Aquaria/Avatar.h +++ b/Aquaria/Avatar.h @@ -137,8 +137,8 @@ class Avatar : public Entity, public ActionMapper public: Avatar(); virtual ~Avatar(); - void destroy(); - void action(int actionID, int state, int source, InputDevice device); + void destroy() OVERRIDE; + void action(int actionID, int state, int source, InputDevice device) OVERRIDE; AvatarState state; float burst, burstTimer; float burstDelay; @@ -151,8 +151,7 @@ public: void revive(); bool canWarp; - void entityDied(Entity *e); - void onCollide(Entity *e); + void entityDied(Entity *e) OVERRIDE; bool zoomOverriden; void clampPosition(); @@ -170,8 +169,8 @@ public: void refreshDualFormModel(); void switchDualFormMode(); - void enableInput(); - void disableInput(); + void enableInput() OVERRIDE; + void disableInput() OVERRIDE; void clearTargets(); bool singing; @@ -226,7 +225,7 @@ public: int getBurstDistance(); int getStopDistance(); int looking; - std::string getIdleAnimName(); + std::string getIdleAnimName() OVERRIDE; bool isRolling() { return rolling; } int rollDir; std::string getBurstAnimName(); @@ -253,7 +252,7 @@ public: Vector headPosition; void updatePosition(); float quickSongCastDelay; - void onAnimationKeyPassed(int key); + void onAnimationKeyPassed(int key) OVERRIDE; bool isSwimming(); @@ -301,7 +300,7 @@ public: Web *web; float rollDelay; - bool canSetBoneLock(); + bool canSetBoneLock() OVERRIDE; void revert(); void doBindSong(); @@ -341,8 +340,8 @@ protected: void checkUpgradeForShot(Shot *s); size_t getNumShots(); void lockToWallCommon(); - void onSetBoneLock(); - void onUpdateBoneLock(); + void onSetBoneLock() OVERRIDE; + void onUpdateBoneLock() OVERRIDE; void adjustHeadRot(); std::string lastHeadTexture; @@ -375,8 +374,8 @@ protected: Vector fallGravity; int lastOutOfWaterMaxSpeed; - void onIdle(); - void onHeal(int type); + void onIdle() OVERRIDE; + void onHeal(int type) OVERRIDE; ParticleEffect biteLeftEmitter, biteRightEmitter, swimEmitter, auraHitEmitter; ParticleEffect auraEmitter, auraLowEmitter, wakeEmitter, healEmitter, hitEmitter, rollLeftEmitter, rollRightEmitter, spiritBeaconEmitter, plungeEmitter; ParticleEffect speedEmitter, defenseEmitter, invincibleEmitter, regenEmitter; @@ -391,7 +390,7 @@ protected: int getQuadrantDirection(int lastQuad, int quad); void updateRoll(float dt); int lastQuad, lastQuadDir; - void onDamage(DamageData &d); + void onDamage(DamageData &d) OVERRIDE; void updateHair(float dt); void lostTarget(int i, Entity *e); @@ -400,7 +399,7 @@ protected: void updateAura(float dt); - void onHealthChange(float change); + void onHealthChange(float change) OVERRIDE; void startWallBurst(bool useCursor=true); void startBurst(); @@ -417,8 +416,8 @@ protected: void endCharge(); bool canMove; - void onEnterState(int action); - void onExitState(int action); + void onEnterState(int action) OVERRIDE; + void onExitState(int action) OVERRIDE; std::vectortargetQuads; Quad *blinder, *fader, *tripper; void applyBlindEffects(); @@ -432,7 +431,7 @@ protected: - void onUpdate(float dt); + void onUpdate(float dt) OVERRIDE; Quad *glow; bool swimming; diff --git a/Aquaria/Beam.h b/Aquaria/Beam.h index 29b5612..81134b2 100644 --- a/Aquaria/Beam.h +++ b/Aquaria/Beam.h @@ -28,8 +28,8 @@ public: protected: float beamWidth; void onRender(const RenderState& rs) const OVERRIDE; - void onEndOfLife(); - void onUpdate(float dt); + void onEndOfLife() OVERRIDE; + void onUpdate(float dt) OVERRIDE; }; #endif diff --git a/Aquaria/CMakeLists.txt b/Aquaria/CMakeLists.txt index 0c0dc63..35591e5 100644 --- a/Aquaria/CMakeLists.txt +++ b/Aquaria/CMakeLists.txt @@ -48,8 +48,6 @@ SET(AQUARIA_SRCS Ingredient.h Intro.cpp Intro.h - Logo.cpp - Logo.h Main.cpp ManaBall.cpp ManaBall.h @@ -113,12 +111,13 @@ SET(AQUARIA_SRCS set(EXETYPE) +option(AQUARIA_CONSOLE_WINDOW "Enable console output (always on in debug builds)" TRUE) +if(AQUARIA_CONSOLE_WINDOW OR (CMAKE_BUILD_TYPE STREQUAL "Debug")) + add_definitions(-DAQUARIA_ENABLE_CONSOLE_LOG) +endif() IF(WIN32) - option(AQUARIA_CONSOLE_WINDOW "Enable the console window (always on in debug builds)" FALSE) - if(AQUARIA_CONSOLE_WINDOW OR (CMAKE_BUILD_TYPE STREQUAL "Debug")) - add_definitions(-DAQUARIA_ENABLE_CONSOLE_LOG) - else() + if(NOT AQUARIA_CONSOLE_WINDOW) SET(EXETYPE WIN32) endif() SET(AQUARIA_SRCS ${AQUARIA_SRCS} aquaria.rc) diff --git a/Aquaria/DSQ.cpp b/Aquaria/DSQ.cpp index d599737..05f09c1 100644 --- a/Aquaria/DSQ.cpp +++ b/Aquaria/DSQ.cpp @@ -24,7 +24,6 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. #include "DSQ.h" #include "States.h" #include "Game.h" -#include "Logo.h" #include "Avatar.h" #include "Entity.h" #include "Avatar.h" diff --git a/Aquaria/Element.h b/Aquaria/Element.h index f362f9d..ce54bfb 100644 --- a/Aquaria/Element.h +++ b/Aquaria/Element.h @@ -61,8 +61,8 @@ class Element : public Quad public: Element(); ~Element(); - void destroy(); - void update(float dt); + void destroy() OVERRIDE; + void update(float dt) OVERRIDE; size_t templateIdx; int bgLayer; int tag; diff --git a/Aquaria/Entity.h b/Aquaria/Entity.h index 74752c4..1667ff5 100644 --- a/Aquaria/Entity.h +++ b/Aquaria/Entity.h @@ -76,7 +76,7 @@ public: ACT_CLICK = 0, ACT_RANGE = 1 }; - void destroy(); + void destroy() OVERRIDE; bool isEntityDead() const {return entityDead;} std::string name; @@ -84,7 +84,7 @@ public: InterpolatedVector vel2; float activationRadius; void render(const RenderState& rs) const OVERRIDE; - void update(float dt); + void update(float dt) OVERRIDE; void spawnParticlesFromCollisionMask(const char *p, unsigned intv=1, int layer = LR_PARTICLES, float rotz = 0); @@ -97,7 +97,7 @@ public: void push(const Vector &vec, float time, float maxSpeed, float dmg); - bool canSetState(int state); + bool canSetState(int state) OVERRIDE; virtual void message(const std::string &msg, int v) {} virtual int messageVariadic(lua_State *L, int nparams) { return 0; } @@ -361,12 +361,12 @@ protected: virtual void onDieEaten() {} IngredientData *ingredientData; int vs[EV_MAX]; - void onEndOfLife(); + void onEndOfLife() OVERRIDE; void updateLance(float dt); void onFHScale(); - void onFH(); + void onFH() OVERRIDE; float dieTimer; BounceType bounceType; Entity* riding; @@ -402,11 +402,11 @@ protected: void doDeathEffects(float manaBallEnergy=0, bool die=true); - void onEnterState(int action); - void onExitState(int action); + void onEnterState(int action) OVERRIDE; + void onExitState(int action) OVERRIDE; - void onUpdate(float dt); + void onUpdate(float dt) OVERRIDE; Vector pushVec; float pushDamage; diff --git a/Aquaria/Game.cpp b/Aquaria/Game.cpp index fb98c6e..2ee6874 100644 --- a/Aquaria/Game.cpp +++ b/Aquaria/Game.cpp @@ -910,8 +910,6 @@ void Game::ensureLimit(Entity *me, int num, int state) void Game::establishEntity(Entity *e, int id, Vector startPos) { - // e->layer must be set BEFORE calling this function! - assert(id); // 0 is invalid/reserved assert(!getEntityByID(id)); // must not already exist @@ -923,7 +921,9 @@ void Game::establishEntity(Entity *e, int id, Vector startPos) // otherwise the script is expected to set the render layer here if not using the default. e->init(); - addRenderObject(e, e->layer); // layer was just set in init() + unsigned layer = e->layer; // layer was either set in ctor, or in init() + e->layer = LR_NONE; // addRenderObject wants this to be not set + addRenderObject(e, layer); } Entity* Game::getEntityByID(int id) const @@ -1005,9 +1005,9 @@ Entity* Game::createEntityOnMap(const EntitySaveData& sav) ScriptedEntity *e = new ScriptedEntity(type, pos, ET_ENEMY); e->rotation.z = sav.rot; - int idx = getIdxForEntityType(type); EntitySaveData copy = sav; copy.name = type; + copy.idx = getIdxForEntityType(type); entitySaveData.push_back(copy); establishEntity(e, sav.id, pos); diff --git a/Aquaria/GridRender.h b/Aquaria/GridRender.h index f32fb75..d5175d4 100644 --- a/Aquaria/GridRender.h +++ b/Aquaria/GridRender.h @@ -38,7 +38,7 @@ public: GridRender(ObsType obsType); protected: ObsType obsType; - void onUpdate(float dt); + void onUpdate(float dt) OVERRIDE; void onRender(const RenderState& rs) const OVERRIDE; }; @@ -46,7 +46,7 @@ class MiniMapRender : public RenderObject { public: MiniMapRender(); - void destroy(); + void destroy() OVERRIDE; bool isCursorIn(); void slide(int slid); @@ -66,7 +66,7 @@ protected: bool mouseDown; bool doRender; float lightLevel; - void onUpdate(float dt); + void onUpdate(float dt) OVERRIDE; void onRender(const RenderState& rs) const OVERRIDE; void renderIcon(const MinimapIcon *ico, const Vector& pos) const; diff --git a/Aquaria/Hair.h b/Aquaria/Hair.h index 1bdc42d..e195040 100644 --- a/Aquaria/Hair.h +++ b/Aquaria/Hair.h @@ -55,7 +55,7 @@ public: HairNode *getHairNode(int idx); protected: float segmentLength; - void onUpdate(float dt); + void onUpdate(float dt) OVERRIDE; void onRender(const RenderState& rs) const OVERRIDE; }; diff --git a/Aquaria/Logo.cpp b/Aquaria/Logo.cpp deleted file mode 100644 index e811d81..0000000 --- a/Aquaria/Logo.cpp +++ /dev/null @@ -1,56 +0,0 @@ -/* -Copyright (C) 2007, 2010 - Bit-Blot - -This file is part of Aquaria. - -Aquaria is free software; you can redistribute it and/or -modify it under the terms of the GNU General Public License -as published by the Free Software Foundation; either version 2 -of the License, or (at your option) any later version. - -This program is distributed in the hope that it will be useful, -but WITHOUT ANY WARRANTY; without even the implied warranty of -MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. - -See the GNU General Public License for more details. - -You should have received a copy of the GNU General Public License -along with this program; if not, write to the Free Software -Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. -*/ -#include "Logo.h" - -void Logo::JumpTitle::act() -{ - -} - -Logo::Logo() : StateObject() -{ - registerState(this, "Logo"); -} - -void Logo::applyState() -{ - StateObject::applyState(); - - - core->setClearColor(Vector(1,1,1)); - - - - Quad *q = new Quad; - { - q->setTexture("sky"); - q->setWidthHeight(800, 600); - q->position = Vector(400,300); - q->alpha = 0; - q->alpha.interpolateTo(1, 3, 0); - } - addRenderObject(q); -} - -void Logo::removeState() -{ - StateObject::removeState(); -} diff --git a/Aquaria/Logo.h b/Aquaria/Logo.h deleted file mode 100644 index 2cf6504..0000000 --- a/Aquaria/Logo.h +++ /dev/null @@ -1,35 +0,0 @@ -/* -Copyright (C) 2007, 2010 - Bit-Blot - -This file is part of Aquaria. - -Aquaria is free software; you can redistribute it and/or -modify it under the terms of the GNU General Public License -as published by the Free Software Foundation; either version 2 -of the License, or (at your option) any later version. - -This program is distributed in the hope that it will be useful, -but WITHOUT ANY WARRANTY; without even the implied warranty of -MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. - -See the GNU General Public License for more details. - -You should have received a copy of the GNU General Public License -along with this program; if not, write to the Free Software -Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. -*/ -#ifndef __logo__ -#define __logo__ - -#include "DSQ.h" - -class Logo : public StateObject -{ -public: - Logo(); - EVENT(JumpTitle, jumpTitle) - void applyState(); - void removeState(); -}; - -#endif diff --git a/Aquaria/SceneEditor.cpp b/Aquaria/SceneEditor.cpp index f91600e..555ade9 100644 --- a/Aquaria/SceneEditor.cpp +++ b/Aquaria/SceneEditor.cpp @@ -496,7 +496,6 @@ void SceneEditor::init() dsq->game->addRenderObject(text, LR_HUD); text->alpha = 0; - selectedVariation = -1; on = false; addAction(MakeFunctionEvent(SceneEditor, loadScene), KEY_F1, 0); diff --git a/Aquaria/SceneEditor.h b/Aquaria/SceneEditor.h index facbb95..fa97793 100644 --- a/Aquaria/SceneEditor.h +++ b/Aquaria/SceneEditor.h @@ -236,7 +236,7 @@ protected: void mouseButtonLeft(); void mouseButtonRight(); - size_t curElement, selectedVariation, possibleSelectedIdx; + size_t curElement; Quad *placer; DebugFont *text; diff --git a/Aquaria/Segmented.h b/Aquaria/Segmented.h index 594b56a..7ab31c9 100644 --- a/Aquaria/Segmented.h +++ b/Aquaria/Segmented.h @@ -48,9 +48,9 @@ class Strand : public RenderObject, public Segmented { public: Strand(const Vector &position, size_t segs, size_t dist=32); - void destroy(); + void destroy() OVERRIDE; protected: - void onUpdate(float dt); + void onUpdate(float dt) OVERRIDE; void onRender(const RenderState& rs) const OVERRIDE; }; diff --git a/Aquaria/States.cpp b/Aquaria/States.cpp index 06a898b..b2f03f1 100644 --- a/Aquaria/States.cpp +++ b/Aquaria/States.cpp @@ -151,7 +151,7 @@ void GameOver::applyState() q->setWidthHeight(800, 600); q->position = Vector(400,300,-0.1f); } - addRenderObject(q); + addRenderObject(q, LR_ZERO); diff --git a/Aquaria/Web.h b/Aquaria/Web.h index 6ffa27a..56a6459 100644 --- a/Aquaria/Web.h +++ b/Aquaria/Web.h @@ -41,9 +41,9 @@ public: protected: float existence; Entity *parentEntity; - void onEndOfLife(); + void onEndOfLife() OVERRIDE; std::vector points; - void onUpdate(float dt); + void onUpdate(float dt) OVERRIDE; void onRender(const RenderState& rs) const OVERRIDE; }; diff --git a/BBGE/BaseText.h b/BBGE/BaseText.h index 0947cfa..28fabc2 100644 --- a/BBGE/BaseText.h +++ b/BBGE/BaseText.h @@ -13,11 +13,11 @@ public: virtual void setWidth(float width) = 0; virtual void setFontSize(float sz) = 0; virtual void setAlign(Align a) = 0; - virtual float getLineHeight() = 0; - virtual size_t getNumLines() = 0; - virtual float getHeight() = 0; // total height - virtual float getStringWidth(const std::string& text) = 0; // width of string when not auto-wrapped - virtual float getActualWidth() = 0; // width of text after wrapping + virtual float getLineHeight() const = 0; + virtual size_t getNumLines() const = 0; + virtual float getHeight() const = 0; // total height + virtual float getStringWidth(const std::string& text) const = 0; // width of string when not auto-wrapped + virtual float getActualWidth() const = 0; // width of text after wrapping }; #endif diff --git a/BBGE/BitmapFont.cpp b/BBGE/BitmapFont.cpp index d7225d3..7b6f013 100644 --- a/BBGE/BitmapFont.cpp +++ b/BBGE/BitmapFont.cpp @@ -124,13 +124,13 @@ float BitmapText::getSetWidth() return textWidth; } -float BitmapText::getHeight() +float BitmapText::getHeight() const { float sz = bmpFont->font->GetCharHeight('A') * bmpFont->scale; return lines.size()*sz; } -float BitmapText::getLineHeight() +float BitmapText::getLineHeight() const { return bmpFont->font->GetCharHeight('A') * bmpFont->scale; } @@ -349,12 +349,12 @@ bool BitmapText::isScrollingText() return scrolling; } -size_t BitmapText::getNumLines() +size_t BitmapText::getNumLines() const { return lines.size(); } -float BitmapText::getStringWidth(const std::string& text) +float BitmapText::getStringWidth(const std::string& text) const { std::string tmp; int maxsize = 0; diff --git a/BBGE/BitmapFont.h b/BBGE/BitmapFont.h index 1c9223e..8cecdf0 100644 --- a/BBGE/BitmapFont.h +++ b/BBGE/BitmapFont.h @@ -48,32 +48,32 @@ class BitmapText : public BaseText { public: BitmapText(BmpFont *bmpFont); - void setText(const std::string &text); - void setWidth(float width); + void setText(const std::string &text) OVERRIDE; + void setWidth(float width) OVERRIDE; float getSetWidth(); // get the width that was set void scrollText(const std::string &text, float scrollSpeed); - void setFontSize(float sz); + void setFontSize(float sz) OVERRIDE; bool isScrollingText(); void stopScrollingText(); bool isEmpty(); - virtual void setAlign(Align align); + virtual void setAlign(Align align) OVERRIDE; std::string getText(); int getWidthOnScreen(); Vector getColorIndex(size_t i, size_t j); void updateWordColoring(); void autoKern(); - virtual float getHeight(); - void unloadDevice(); - void reloadDevice(); - float getStringWidth(const std::string& text); - float getActualWidth() { return maxW; } - float getLineHeight(); - size_t getNumLines(); + virtual float getHeight() const OVERRIDE; + void unloadDevice() OVERRIDE; + void reloadDevice() OVERRIDE; + float getStringWidth(const std::string& text) const OVERRIDE; + float getActualWidth() const OVERRIDE { return maxW; } + float getLineHeight() const OVERRIDE; + size_t getNumLines() const OVERRIDE; protected: float scrollSpeed; BmpFont *bmpFont; - void onUpdate(float dt); + void onUpdate(float dt) OVERRIDE; float scrollDelay; bool scrolling; size_t currentScrollLine; diff --git a/BBGE/Core.cpp b/BBGE/Core.cpp index 68fc1c4..04f5314 100644 --- a/BBGE/Core.cpp +++ b/BBGE/Core.cpp @@ -2070,22 +2070,18 @@ CountedPtr Core::addTexture(const std::string &textureName) return ptex; } -void Core::addRenderObject(RenderObject *o, size_t layer) +void Core::addRenderObject(RenderObject *o, unsigned layer) { - if (!o) return; + assert(o->layer == LR_NONE); + assert(layer < renderObjectLayers.size()); o->layer = layer; - if (layer >= renderObjectLayers.size()) - { - std::ostringstream os; - os << "attempted to add render object to invalid layer [" << layer << "]"; - errorLog(os.str()); - } renderObjectLayers[layer].add(o); } -void Core::switchRenderObjectLayer(RenderObject *o, int toLayer) +void Core::switchRenderObjectLayer(RenderObject *o, unsigned toLayer) { - if (!o) return; + assert(o->layer != LR_NONE); + assert(toLayer < renderObjectLayers.size()); renderObjectLayers[o->layer].remove(o); renderObjectLayers[toLayer].add(o); o->layer = toLayer; diff --git a/BBGE/Core.h b/BBGE/Core.h index 28b3c4f..bd0e727 100644 --- a/BBGE/Core.h +++ b/BBGE/Core.h @@ -238,8 +238,8 @@ public: void setFullscreen(bool full); void enable2D(int pixelScaleX, int pixelScaleY); - void addRenderObject(RenderObject *o, size_t layer=0); - void switchRenderObjectLayer(RenderObject *o, int toLayer); + void addRenderObject(RenderObject *o, unsigned layer); + void switchRenderObjectLayer(RenderObject *o, unsigned toLayer); void addTexture(Texture *r); CountedPtr findTexture(const std::string &name); void removeTexture(Texture *res); @@ -523,7 +523,7 @@ public: Joystick *getJoystickForSourceID(int sourceID); private: std::vector joysticks; - int sdlUserMouseEventID; + unsigned sdlUserMouseEventID; }; extern Core *core; diff --git a/BBGE/DebugFont.cpp b/BBGE/DebugFont.cpp index f8f1555..cd09ab6 100644 --- a/BBGE/DebugFont.cpp +++ b/BBGE/DebugFont.cpp @@ -50,17 +50,17 @@ void DebugFont::setFontSize(float sz) fontDrawSize = sz; } -float DebugFont::getHeight() +float DebugFont::getHeight() const { return fontDrawSize * lines.size() * 1.5f; // vspc in render() } -float DebugFont::getLineHeight() +float DebugFont::getLineHeight() const { return fontDrawSize * 1.5f; // vspc in render() } -float DebugFont::getStringWidth(const std::string& text) +float DebugFont::getStringWidth(const std::string& text) const { int maxchars = 0; int c = 0; @@ -78,7 +78,7 @@ float DebugFont::getStringWidth(const std::string& text) return fontDrawSize * maxchars * (1.4f * 0.75f); } -float DebugFont::getActualWidth() +float DebugFont::getActualWidth() const { return maxW * (1.4f * 0.75f); // numbers taken from onRender() } diff --git a/BBGE/DebugFont.h b/BBGE/DebugFont.h index 762fba1..0200466 100644 --- a/BBGE/DebugFont.h +++ b/BBGE/DebugFont.h @@ -28,15 +28,15 @@ class DebugFont : public BaseText { public: DebugFont(int initFontSize=0, const std::string &initText=""); - void setText(const std::string &text); - void setWidth(float width); - void setFontSize(float sz); - size_t getNumLines() { return lines.size(); } - virtual void setAlign(Align align); - virtual float getHeight(); - virtual float getLineHeight(); - virtual float getStringWidth(const std::string& text); - virtual float getActualWidth(); + void setText(const std::string &text) OVERRIDE; + void setWidth(float width) OVERRIDE; + void setFontSize(float sz) OVERRIDE; + size_t getNumLines() const OVERRIDE { return lines.size(); } + virtual void setAlign(Align align) OVERRIDE; + virtual float getHeight() const OVERRIDE; + virtual float getLineHeight() const OVERRIDE; + virtual float getStringWidth(const std::string& text) const OVERRIDE; + virtual float getActualWidth() const OVERRIDE; protected: float fontDrawSize, textWidth; void formatText(); diff --git a/BBGE/Gradient.h b/BBGE/Gradient.h index 9335fcf..8b0c791 100644 --- a/BBGE/Gradient.h +++ b/BBGE/Gradient.h @@ -31,7 +31,7 @@ public: void makeVertical(Vector c1, Vector c2); void makeHorizontal(Vector c1, Vector c2); - void onUpdate(float dt); + void onUpdate(float dt) OVERRIDE; int autoWidth, autoHeight; protected: diff --git a/BBGE/Particles.h b/BBGE/Particles.h index 3517223..193ab4f 100644 --- a/BBGE/Particles.h +++ b/BBGE/Particles.h @@ -119,7 +119,7 @@ class Emitter : public Quad { public: Emitter(ParticleEffect *pe); - void destroy(); + void destroy() OVERRIDE; void addParticle(Particle *p); void removeParticle(Particle *p); @@ -138,7 +138,7 @@ protected: Vector currentSpawn, lastSpawn; void onRender(const RenderState& rs) const OVERRIDE; void spawnParticle(float perc=1); - void onUpdate(float dt); + void onUpdate(float dt) OVERRIDE; ParticleEffect *pe; diff --git a/BBGE/Quad.h b/BBGE/Quad.h index 3d5b4f6..bd4f89b 100644 --- a/BBGE/Quad.h +++ b/BBGE/Quad.h @@ -45,13 +45,13 @@ public: Quad(const std::string &tex, const Vector &pos); Quad(); void createGrid(int x, int y); - void destroy(); + void destroy() OVERRIDE; bool isCoordinateInside(Vector coord, int minSize=0) const; bool isCoordinateInsideWorld(const Vector &coord, int minSize=0) const; bool isCoordinateInsideWorldRect(const Vector &coord, int w, int h) const; - void flipVertical(); - void flipHorizontal(); + void flipVertical() OVERRIDE; + void flipHorizontal() OVERRIDE; void setWidthHeight(float w, float h=-1); void setWidth(float w); void setHeight(float h); @@ -67,7 +67,7 @@ public: Array2d& getDrawGrid() { return drawGrid; } const Array2d& getDrawGrid() const { return drawGrid; } - void reloadDevice(); + void reloadDevice() OVERRIDE; void deleteGrid(); @@ -122,9 +122,9 @@ protected: float drawGridTimeMultiplier; bool drawGridOut; - void onSetTexture(); + void onSetTexture() OVERRIDE; void onRender(const RenderState& rs) const OVERRIDE; - void onUpdate(float dt); + void onUpdate(float dt) OVERRIDE; public: GridDrawOrder drawOrder; diff --git a/BBGE/QuadGrid.h b/BBGE/QuadGrid.h index b483888..2dcdb70 100644 --- a/BBGE/QuadGrid.h +++ b/BBGE/QuadGrid.h @@ -43,8 +43,8 @@ public: } virtual void onRender(const RenderState& rs) const OVERRIDE; - virtual void onUpdate(float dt); - virtual void onSetTexture(); + virtual void onUpdate(float dt) OVERRIDE; + virtual void onSetTexture() OVERRIDE; void resetUV(float xmul = 1, float ymul = 1); void resetPos(float w, float h, float xoffs = 0, float yoffs = 0); diff --git a/BBGE/RenderObject.cpp b/BBGE/RenderObject.cpp index a777da2..88fda96 100644 --- a/BBGE/RenderObject.cpp +++ b/BBGE/RenderObject.cpp @@ -391,7 +391,7 @@ bool RenderObject::isVisibleInPass(int pass) const void RenderObject::render(const RenderState& rs) const { - assert(layer != LR_NONE); + assert(parent || layer != LR_NONE); if (isHidden()) return; /// new (breaks anything?) diff --git a/BBGE/RoundedRect.h b/BBGE/RoundedRect.h index 8c3bd6c..e048a81 100644 --- a/BBGE/RoundedRect.h +++ b/BBGE/RoundedRect.h @@ -42,7 +42,7 @@ public: protected: - void onUpdate(float dt); + void onUpdate(float dt) OVERRIDE; void onRender(const RenderState& rs) const OVERRIDE; bool canMove; @@ -60,7 +60,7 @@ public: EventPtr event; protected: - void onUpdate(float dt); + void onUpdate(float dt) OVERRIDE; void onRender(const RenderState& rs) const OVERRIDE; TTFText *label; diff --git a/BBGE/ScreenTransition.h b/BBGE/ScreenTransition.h index ee376d6..0d6e881 100644 --- a/BBGE/ScreenTransition.h +++ b/BBGE/ScreenTransition.h @@ -30,8 +30,8 @@ public: void go(float time); virtual void capture(); void transition(float time); - void reloadDevice(); - void unloadDevice(); + void reloadDevice() OVERRIDE; + void unloadDevice() OVERRIDE; bool isGoing(); protected: void createTexture(); diff --git a/BBGE/SkeletalSprite.cpp b/BBGE/SkeletalSprite.cpp index 0f7a300..78c2511 100644 --- a/BBGE/SkeletalSprite.cpp +++ b/BBGE/SkeletalSprite.cpp @@ -741,6 +741,7 @@ BoneGridInterpolator * Animation::getBoneGridInterpolator(size_t boneIdx) return &bgip; } } + return 0; } diff --git a/BBGE/SkeletalSprite.h b/BBGE/SkeletalSprite.h index 678f0b9..0ec689c 100644 --- a/BBGE/SkeletalSprite.h +++ b/BBGE/SkeletalSprite.h @@ -60,7 +60,7 @@ public: void createStrip(bool vert, int num); Quad* addFrame(const std::string &gfx); void showFrame(int i); - void destroy(); + void destroy() OVERRIDE; std::string gfx; std::string name; size_t boneIdx; diff --git a/BBGE/StateManager.cpp b/BBGE/StateManager.cpp index 2d5bc5a..0cc9d1e 100644 --- a/BBGE/StateManager.cpp +++ b/BBGE/StateManager.cpp @@ -44,7 +44,7 @@ void StateObject::removeState() } -void StateObject::addRenderObject(RenderObject *renderObject, int layer) +void StateObject::addRenderObject(RenderObject *renderObject, unsigned layer) { stateManager->getState(name)->addRenderObject(renderObject, layer); } @@ -75,12 +75,11 @@ StateData::~StateData() } } -void StateData::addRenderObject(RenderObject *renderObject, int layer) +void StateData::addRenderObject(RenderObject* renderObject, unsigned layer) { core->addRenderObject(renderObject, layer); renderObjects.push_back (renderObject); renderObject->setStateDataObject(this); - renderObject->layer = layer; } void StateData::removeRenderObject(RenderObject *renderObject) diff --git a/BBGE/StateManager.h b/BBGE/StateManager.h index 485578b..8bbdc61 100644 --- a/BBGE/StateManager.h +++ b/BBGE/StateManager.h @@ -43,7 +43,7 @@ public: StateObject *stateObject; void clearGarbage(); - void addRenderObject(RenderObject *renderObject, int layer); + void addRenderObject(RenderObject *renderObject, unsigned layer); void eraseRenderObjects(); void removeRenderObject(RenderObject *renderObject); void removeRenderObjectFromList(RenderObject *renderObject); @@ -61,7 +61,7 @@ public: virtual void removeState(); virtual void update(float dt); - void addRenderObject(RenderObject *renderObject, int layer=0); + void addRenderObject(RenderObject *renderObject, unsigned layer); void removeRenderObject(RenderObject *renderObject); std::string name; diff --git a/BBGE/TTFFont.cpp b/BBGE/TTFFont.cpp index c25c36a..8dee52d 100644 --- a/BBGE/TTFFont.cpp +++ b/BBGE/TTFFont.cpp @@ -110,17 +110,17 @@ void TTFText::updateAlign() } } -size_t TTFText::getNumLines() +size_t TTFText::getNumLines() const { return (int)text.size(); } -float TTFText::getHeight() +float TTFText::getHeight() const { return text.size()*lineHeight; } -float TTFText::getStringWidth(const std::string& s) +float TTFText::getStringWidth(const std::string& s) const { float w = 0; std::string cp = s; @@ -223,7 +223,7 @@ void TTFText::updateFormatting() lineHeight = font->font->LineHeight(); } -float TTFText::getLineHeight() +float TTFText::getLineHeight() const { return lineHeight; } diff --git a/BBGE/TTFFont.h b/BBGE/TTFFont.h index cf1448d..3c0c8c6 100644 --- a/BBGE/TTFFont.h +++ b/BBGE/TTFFont.h @@ -42,17 +42,17 @@ class TTFText : public BaseText { public: TTFText(TTFFont *font); - void setText(const std::string &txt); - void setAlign(Align align); - void setWidth(float width); - float getHeight(); - float getActualWidth() { return maxW; } - void setFontSize(float); // dummy - float getStringWidth(const std::string& s); + void setText(const std::string &txt) OVERRIDE; + void setAlign(Align align) OVERRIDE; + void setWidth(float width) OVERRIDE; + float getHeight() const OVERRIDE; + float getActualWidth() const OVERRIDE { return maxW; } + void setFontSize(float) OVERRIDE; // dummy + float getStringWidth(const std::string& s) const OVERRIDE; bool shadow; int findLine(const std::string &label); - float getLineHeight(); - size_t getNumLines(); + float getLineHeight() const OVERRIDE; + size_t getNumLines() const OVERRIDE; protected: float width; float lineHeight;