From dcd21b57bd525e5d3536d3e6c4b70441acb88f80 Mon Sep 17 00:00:00 2001 From: Valentin Ochs Date: Thu, 12 Jan 2017 22:14:26 +0100 Subject: [PATCH 1/5] Merge pull request #41 --- Aquaria/AnimationEditor.cpp | 4 +- Aquaria/AquariaMenuItem.cpp | 2 + Aquaria/Avatar.cpp | 86 ++++++++++++++++++++++++------ Aquaria/CollideEntity.cpp | 2 + Aquaria/Continuity.cpp | 15 +++++- Aquaria/DSQ.cpp | 6 +++ Aquaria/DSQ.h | 2 +- Aquaria/Element.cpp | 24 ++++----- Aquaria/Entity.cpp | 5 -- Aquaria/Game.cpp | 16 +++--- Aquaria/Game.h | 2 +- Aquaria/Ingredient.cpp | 18 +++++-- Aquaria/Logo.h | 2 +- Aquaria/MiniMapRender.cpp | 4 +- Aquaria/ModSelector.cpp | 27 +++++++--- Aquaria/Network.cpp | 2 +- Aquaria/Path.cpp | 6 +-- Aquaria/PathFinding.cpp | 4 +- Aquaria/SceneEditor.cpp | 19 ++++++- Aquaria/SchoolFish.cpp | 4 +- Aquaria/ScriptInterface.cpp | 24 +++------ Aquaria/StatsAndAchievements.cpp | 10 ++-- Aquaria/StatsAndAchievements.h | 2 +- BBGE/AfterEffect.cpp | 4 +- BBGE/AfterEffect.h | 1 + BBGE/Base.cpp | 28 +++++++--- BBGE/Core.cpp | 32 +---------- BBGE/DebugFont.cpp | 7 ++- BBGE/Effects.cpp | 6 ++- BBGE/Particles.h | 2 +- BBGE/QuadTrail.cpp | 5 +- BBGE/Shader.cpp | 36 ++++++------- BBGE/Shader.h | 8 +-- BBGE/SkeletalSprite.cpp | 7 ++- BBGE/SkeletalSprite.h | 2 +- BBGE/SoundManager.cpp | 5 +- BBGE/SoundManager.h | 5 +- BBGE/Texture.cpp | 2 +- ExternalLibs/ByteBuffer.h | 18 +++---- ExternalLibs/DeflateCompressor.cpp | 4 +- 40 files changed, 281 insertions(+), 177 deletions(-) diff --git a/Aquaria/AnimationEditor.cpp b/Aquaria/AnimationEditor.cpp index de82ab2..f1dff23 100644 --- a/Aquaria/AnimationEditor.cpp +++ b/Aquaria/AnimationEditor.cpp @@ -1111,8 +1111,8 @@ void AnimationEditor::flipRot() { BoneKeyframe *bcur = editSprite->getCurrentAnimation()->getKeyframe(currentKey)->getBoneKeyframe(editingBone->boneIdx); if (bcur) - { - int rotdiff = editingBone->rotation.z - bcur->rot; + { + // int rotdiff = editingBone->rotation.z - bcur->rot; if (!core->getCtrlState()) { for (int i = 0; i < editSprite->getCurrentAnimation()->getNumKeyframes(); ++i) diff --git a/Aquaria/AquariaMenuItem.cpp b/Aquaria/AquariaMenuItem.cpp index 8271b90..674a01d 100644 --- a/Aquaria/AquariaMenuItem.cpp +++ b/Aquaria/AquariaMenuItem.cpp @@ -695,6 +695,8 @@ void AquariaKeyConfig::onUpdate(float dt) } } break; + case INPUTSET_NONE: + break; } } diff --git a/Aquaria/Avatar.cpp b/Aquaria/Avatar.cpp index a07fabf..77f6713 100644 --- a/Aquaria/Avatar.cpp +++ b/Aquaria/Avatar.cpp @@ -54,7 +54,7 @@ int SongIcon::notesOpen = 0; Avatar *avatar = 0; const Vector BLIND_COLOR = Vector(0.1, 0.1, 0.1); const float ANIM_TRANSITION = 0.2; -const float MANA_RECHARGE_RATE = 1.0; +//const float MANA_RECHARGE_RATE = 1.0; const int AURA_SHIELD_RADIUS = 64; //const int TARGET_RANGE = 1024; const int TARGET_RANGE = 1024; // 650 @@ -69,7 +69,7 @@ const int BURST_DISTANCE = 200; const int STOP_DISTANCE = 48; const int maxMouse = BURST_DISTANCE; //const int SHOCK_RANGE = 700; -const int SHOCK_RANGE = 1000; +//const int SHOCK_RANGE = 1000; const int SPIRIT_RANGE = 2000; const float QUICK_SONG_CAST_DELAY = 0.4; @@ -81,9 +81,9 @@ const float BURST_ACCEL = 4000; //2000 // 1000 // Minimum time between two splash effects (seconds). const float SPLASH_INTERVAL = 0.2; -const float TUMMY_TIME = 6.0; +//const float TUMMY_TIME = 6.0; -const float chargeMax = 2.0; +//const float chargeMax = 2.0; // Axis input distance (0.0-1.0) at which we start moving. const float JOYSTICK_LOW_THRESHOLD = 0.2; @@ -861,7 +861,17 @@ std::string Avatar::getIdleAnimName() { case FORM_ENERGY: ret="energyidle"; - break; + break; + case FORM_NORMAL: + case FORM_BEAST: + case FORM_NATURE: + case FORM_SPIRIT: + case FORM_DUAL: + case FORM_FISH: + case FORM_SUN: + case FORM_MAX: + case FORM_NONE: + break; } return ret; } @@ -1231,7 +1241,11 @@ void Avatar::entityDied(Entity *e) { dsq->continuity.eatBeast(e->eatData); } - break; + break; + case EAT_DEFAULT: + case EAT_MAX: + case EAT_NONE: + break; } } @@ -1582,6 +1596,9 @@ void Avatar::changeForm(FormType form, bool effects, bool onInit, FormType lastF case FORM_DUAL: core->sound->playSfx("DualForm"); break; + case FORM_NONE: + case FORM_MAX: + break; } /* @@ -2819,6 +2836,10 @@ void Avatar::formAbility(int ability) } break; + case FORM_NORMAL: + case FORM_NONE: + case FORM_MAX: + break; } } @@ -2979,7 +3000,7 @@ void Avatar::doShock(const std::string &shotName) } } */ - Vector d = e->position - position; + // Vector d = e->position - position; /* float a = float(float(i)/float(sz))*PI*2; Vector aim(sinf(a), cosf(a)); @@ -3034,11 +3055,17 @@ void Avatar::formAbilityUpdate(float dt) } } break; - case FORM_ENERGY: - { - } - break; - } + case FORM_ENERGY: + case FORM_NORMAL: + case FORM_BEAST: + case FORM_NATURE: + case FORM_SPIRIT: + case FORM_DUAL: + case FORM_SUN: + case FORM_MAX: + case FORM_NONE: + break; + } } bool Avatar::isMouseInputEnabled() @@ -3128,7 +3155,13 @@ bool Avatar::canCharge(int ability) break; case FORM_SUN: return true; - break; + break; + case FORM_NORMAL: + case FORM_SPIRIT: + case FORM_FISH: + case FORM_MAX: + case FORM_NONE: + break; } return false; } @@ -4720,7 +4753,11 @@ void Avatar::updateAura(float dt) } } } - break; + break; + case AURA_THING: + case AURA_HEAL: + case AURA_NONE: + break; } auraTimer -= dt; @@ -4864,7 +4901,15 @@ void Avatar::updateFormVisualEffects(float dt) case FORM_SPIRIT: skeletalSprite.update(dt); skeletalSprite.position = bodyPosition; - break; + break; + case FORM_NORMAL: + case FORM_BEAST: + case FORM_NATURE: + case FORM_DUAL: + case FORM_FISH: + case FORM_MAX: + case FORM_NONE: + break; } } @@ -5975,7 +6020,7 @@ void Avatar::onUpdate(float dt) { if (state.spellCharge > 1.5f && chargeLevelAttained <1) { - chargeLevelAttained = 1.5; + chargeLevelAttained = 1; core->sound->playSfx("PowerUp"); chargingEmitter->load("ChargingEnergy2"); } @@ -6026,7 +6071,14 @@ void Avatar::onUpdate(float dt) chargingEmitter->start(); } } - break; + break; + case FORM_NORMAL: + case FORM_BEAST: + case FORM_SPIRIT: + case FORM_FISH: + case FORM_MAX: + case FORM_NONE: + break; } } /* diff --git a/Aquaria/CollideEntity.cpp b/Aquaria/CollideEntity.cpp index 717fe8d..f303062 100644 --- a/Aquaria/CollideEntity.cpp +++ b/Aquaria/CollideEntity.cpp @@ -93,6 +93,8 @@ void CollideEntity::bounce(float ba) } } break; + case BOUNCE_NONE: + break; } diff --git a/Aquaria/Continuity.cpp b/Aquaria/Continuity.cpp index 0cebb8b..237c2fa 100644 --- a/Aquaria/Continuity.cpp +++ b/Aquaria/Continuity.cpp @@ -607,6 +607,10 @@ std::string Continuity::getIEString(IngredientData *data, int i) return ret; } break; + case IET_NONE: + case IET_RANDOM: + case IET_MAX: + break; } return ""; @@ -1241,6 +1245,9 @@ std::string Continuity::getInternalFormName() return "sun"; case FORM_DUAL: return "dual"; + case FORM_NONE: + case FORM_MAX: + break; } return ""; } @@ -1634,8 +1641,12 @@ void Continuity::castSong(int num) case SONG_FISHFORM: dsq->game->avatar->changeForm(FORM_FISH); break; - case SONG_SONGDOOR1: - break; + case SONG_SONGDOOR1: + case SONG_SONGDOOR2: + case SONG_ANIMA: + case SONG_NONE: + case SONG_MAX: + break; #endif } } diff --git a/Aquaria/DSQ.cpp b/Aquaria/DSQ.cpp index 7841bf6..153a531 100644 --- a/Aquaria/DSQ.cpp +++ b/Aquaria/DSQ.cpp @@ -1782,6 +1782,8 @@ void DSQ::toggleInputMode() case INPUT_JOYSTICK: setInputMode(INPUT_MOUSE); break; + case INPUT_KEYBOARD: + break; } } @@ -1799,6 +1801,8 @@ void DSQ::setInputMode(InputMode mode) core->joystickAsMouse = false; updateCursorFromMouse = true; break; + case INPUT_KEYBOARD: + break; } } @@ -4091,6 +4095,8 @@ void DSQ::onUpdate(float dt) case INPUT_JOYSTICK: os << "joystick"; break; + case INPUT_KEYBOARD: + break; } os << std::endl; Bone *b = dsq->game->avatar->skeletalSprite.getBoneByIdx(1); diff --git a/Aquaria/DSQ.h b/Aquaria/DSQ.h index 6b7864e..6358b87 100644 --- a/Aquaria/DSQ.h +++ b/Aquaria/DSQ.h @@ -683,7 +683,7 @@ enum FoodSortType struct IngredientEffect { - IngredientEffect() : type(IET_NONE), magnitude(0) {} + IngredientEffect() : magnitude(0), type(IET_NONE) {} float magnitude; IngredientEffectType type; std::string string; diff --git a/Aquaria/Element.cpp b/Aquaria/Element.cpp index 670632e..613bd37 100644 --- a/Aquaria/Element.cpp +++ b/Aquaria/Element.cpp @@ -22,18 +22,18 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. #include "Game.h" ElementEffectData::ElementEffectData() - : elementEffectIndex(-1) - , wavyAngleOffset(0) - , wavyMagnitude(0) - , wavyLerpIn(0) - , wavyMin(0) - , wavyMax(0) - , hitPerc(0) - , effectMult(0) - , wavyWaving(false) - , wavyFlip(false) - , touching(false) - , elementEffectType(EFX_NONE) + : elementEffectType(EFX_NONE) + , wavyAngleOffset(0) + , wavyMagnitude(0) + , wavyLerpIn(0) + , wavyMin(0) + , wavyMax(0) + , hitPerc(0) + , effectMult(0) + , wavyWaving(false) + , wavyFlip(false) + , touching(false) + , elementEffectIndex(-1) { } diff --git a/Aquaria/Entity.cpp b/Aquaria/Entity.cpp index 2601550..baef273 100644 --- a/Aquaria/Entity.cpp +++ b/Aquaria/Entity.cpp @@ -998,11 +998,6 @@ bool Entity::touchAvatarDamage(int radius, float dmg, const Vector &override, fl const float sct = 0.15; -const float blurMax = 0.01; -const float blurMin = 0.0; - - - void Entity::onFHScale() { flipScale.interpolateTo(Vector(1, 1), sct); diff --git a/Aquaria/Game.cpp b/Aquaria/Game.cpp index 5abae96..19ce959 100644 --- a/Aquaria/Game.cpp +++ b/Aquaria/Game.cpp @@ -156,7 +156,7 @@ void PetSlot::onUpdate(float dt) } } -FoodHolder::FoodHolder(int slot, bool trash) : Quad(), slot(slot), trash(trash) +FoodHolder::FoodHolder(int slot, bool trash) : Quad(), trash(trash), slot(slot) { foodHolderIngredient = 0; buttonDown = false; @@ -1020,7 +1020,7 @@ public: Vector menuBgScale; -const int ITEMS_PER_PAGE = 12; +//const int ITEMS_PER_PAGE = 12; ObsRow::ObsRow(int tx, int ty, int len) : tx(tx), ty(ty), len(len) { @@ -2244,7 +2244,7 @@ float Game::getCoverage(Vector pos, int sampleArea) { if (x == t.x && y == t.y) continue; TileVector ct(x,y); - Vector vt = ct.worldVector(); + //Vector vt = ct.worldVector(); if (isObstructed(ct)) { covered++; @@ -8250,11 +8250,9 @@ void Game::playBurstSound(bool wallJump) sound->playSfx("Burst", 1); if (chance(50)) { - switch (dsq->continuity.form) - { - case FORM_BEAST: - sound->playSfx("BeastBurst", (128+rand()%64)/256.0f); - break; + if (dsq->continuity.form == FORM_BEAST) + { + sound->playSfx("BeastBurst", (128+rand()%64)/256.0f); } } } @@ -10404,7 +10402,7 @@ void Game::update(float dt) dsq->cameraPos = getCameraPositionFor(cameraInterp); constrainCamera(); - float dd = (dsq->cameraPos - oldCamPos).getLength2D(); + //float dd = (dsq->cameraPos - oldCamPos).getLength2D(); } cameraInterp.update(dt); diff --git a/Aquaria/Game.h b/Aquaria/Game.h index 687a120..526a1d8 100644 --- a/Aquaria/Game.h +++ b/Aquaria/Game.h @@ -363,7 +363,7 @@ class EntityClass { public: EntityClass(std::string name, bool script=false, int idx=-1, std::string prevGfx="", float prevScale=1) - : name(name), script(script), idx(idx), prevGfx(prevGfx), prevScale(prevScale) {} + : name(name), prevScale(prevScale), prevGfx(prevGfx), script(script), idx(idx) {} std::string name; float prevScale; std::string prevGfx; diff --git a/Aquaria/Ingredient.cpp b/Aquaria/Ingredient.cpp index 89a46f5..c18db82 100644 --- a/Aquaria/Ingredient.cpp +++ b/Aquaria/Ingredient.cpp @@ -22,9 +22,15 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. #include "Avatar.h" IngredientData::IngredientData(const std::string &name, const std::string &gfx, IngredientType type) -: name(name), gfx(gfx), amount(0), maxAmount(MAX_INGREDIENT_AMOUNT), held(0), type(type), marked(0), sorted(false) -, displayName(dsq->continuity.getIngredientDisplayName(name)) -, rotKind(!(type == IT_OIL || type == IT_EGG)) + : name(name) + , gfx(gfx) + , displayName(dsq->continuity.getIngredientDisplayName(name)) + , type(type) + , amount(0) + , maxAmount(MAX_INGREDIENT_AMOUNT) + , held(0) + , marked(0) + , rotKind(!(type == IT_OIL || type == IT_EGG)) { } @@ -44,7 +50,11 @@ bool IngredientData::hasIET(IngredientEffectType iet) } Ingredient::Ingredient(const Vector &pos, IngredientData *data, int amount) - : Entity(), data(data), amount(amount), gone(false), used(false) + : Entity() + , data(data) + , used(false) + , gone(false) + , amount(amount) { addType(SCO_INGREDIENT); entityType = ET_INGREDIENT; diff --git a/Aquaria/Logo.h b/Aquaria/Logo.h index f9392b3..2cf6504 100644 --- a/Aquaria/Logo.h +++ b/Aquaria/Logo.h @@ -27,7 +27,7 @@ class Logo : public StateObject { public: Logo(); - EVENT(JumpTitle, jumpTitle); + EVENT(JumpTitle, jumpTitle) void applyState(); void removeState(); }; diff --git a/Aquaria/MiniMapRender.cpp b/Aquaria/MiniMapRender.cpp index 824ac86..f6dc5eb 100644 --- a/Aquaria/MiniMapRender.cpp +++ b/Aquaria/MiniMapRender.cpp @@ -611,8 +611,8 @@ void MiniMapRender::onRender() } if (render) - { - renderIcon(p->minimapIcon, p->nodes[0].position); + { + renderIcon(p->minimapIcon, p->nodes[0].position); } } } diff --git a/Aquaria/ModSelector.cpp b/Aquaria/ModSelector.cpp index 3f95a16..c00a0aa 100644 --- a/Aquaria/ModSelector.cpp +++ b/Aquaria/ModSelector.cpp @@ -41,8 +41,13 @@ static bool _modname_cmp(const ModIcon *a, const ModIcon *b) return a->fname < b->fname; } -ModSelectorScreen::ModSelectorScreen() : Quad(), ActionMapper(), -currentPanel(-1), gotServerList(false), dlText(&dsq->smallFont), subtext(&dsq->subsFont) +ModSelectorScreen::ModSelectorScreen() + : Quad() + , ActionMapper() + , dlText(&dsq->smallFont) + , gotServerList(false) + , currentPanel(-1) + , subtext(&dsq->subsFont) { followCamera = 1; shareAlphaWithChildren = false; @@ -131,7 +136,7 @@ void ModSelectorScreen::showPanel(int id) if(id == currentPanel) return; - const float t = 0.2f; + //const float t = 0.2f; IconGridPanel *newgrid = panels[id]; // fade in selected panel @@ -478,7 +483,11 @@ void BasicIcon::onClick() dsq->sound->playSfx("denied"); } -MenuIcon::MenuIcon(int id) : SubtitleIcon(), iconId(id), cb(0), cb_data(0) +MenuIcon::MenuIcon(int id) + : SubtitleIcon() + , cb(0) + , cb_data(0) + , iconId(id) { } @@ -614,7 +623,13 @@ void ModIcon::updateStatus() ModIconOnline::ModIconOnline() -: SubtitleIcon(), pb(0), extraIcon(0), statusIcon(0), clickable(true), pkgtype(MPT_MOD), hasUpdate(false) + : SubtitleIcon() + , pb(0) + , extraIcon(0) + , statusIcon(0) + , pkgtype(MPT_MOD) + , clickable(true) + , hasUpdate(false) { label = desc; } @@ -872,7 +887,7 @@ void MenuIconBar::add(MenuIcon *ico) } IconGridPanel::IconGridPanel() -: spacing(0), y(0), x(0) +: spacing(0), x(0), y(0) { shareAlphaWithChildren = false; // patch selection icons need their own alpha, use fade() instead alphaMod = 0.01f; diff --git a/Aquaria/Network.cpp b/Aquaria/Network.cpp index df82275..d28ee7d 100644 --- a/Aquaria/Network.cpp +++ b/Aquaria/Network.cpp @@ -60,7 +60,7 @@ protected: minihttp::HttpSocket::_OnOpen(); - const Request& r = GetCurrentRequest(); + //const Request& r = GetCurrentRequest(); // TODO ?? } diff --git a/Aquaria/Path.cpp b/Aquaria/Path.cpp index f6aa65f..8bc1915 100644 --- a/Aquaria/Path.cpp +++ b/Aquaria/Path.cpp @@ -587,9 +587,9 @@ void Path::update(float dt) Vector start = nodes[0].position; Vector end = nodes[1].position; Vector v = end - start; - Vector left = v.getPerpendicularLeft(); - Vector right = v.getPerpendicularRight(); - Vector mid = (end-start) + start; + //Vector left = v.getPerpendicularLeft(); + //Vector right = v.getPerpendicularRight(); + //Vector mid = (end-start) + start; FOR_ENTITIES(i) { Entity *e = *i; diff --git a/Aquaria/PathFinding.cpp b/Aquaria/PathFinding.cpp index 750755a..1a29fa0 100644 --- a/Aquaria/PathFinding.cpp +++ b/Aquaria/PathFinding.cpp @@ -28,7 +28,7 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. class SearchGridRaw { public: - SearchGridRaw(ObsType blocking) : game(dsq->game), blockingObsBits(blocking) {} + SearchGridRaw(ObsType blocking) : blockingObsBits(blocking), game(dsq->game) {} inline bool operator()(unsigned x, unsigned y) const { return (game->getGridRaw(TileVector(x, y)) & blockingObsBits) == OT_EMPTY; @@ -80,7 +80,7 @@ void PathFinding::molestPath(VectorPath &path) Vector node = path.getPathNode(i)->value; float dist; int sample = 20; - float maxDist = sample * TILE_SIZE; + //float maxDist = sample * TILE_SIZE; { Vector n = dsq->game->getWallNormal(node, sample, &dist); if (dist != -1 && (n.x != 0 || n.y != 0)) diff --git a/Aquaria/SceneEditor.cpp b/Aquaria/SceneEditor.cpp index bd56924..9f5de6c 100644 --- a/Aquaria/SceneEditor.cpp +++ b/Aquaria/SceneEditor.cpp @@ -2863,6 +2863,9 @@ void SceneEditor::updateText() if (getSelectedPath()) os << " name: " << getSelectedPath()->name; break; + case ET_SELECTENTITY: + case ET_MAX: + break; } text->setText(os.str()); } @@ -2992,6 +2995,10 @@ void SceneEditor::update(float dt) else placer->alpha = 0.5; break; + case ET_PATHS: + case ET_SELECTENTITY: + case ET_MAX: + break; } updateText(); @@ -3099,6 +3106,9 @@ void SceneEditor::update(float dt) if (selectedIdx >= 0) dsq->game->getPath(selectedIdx)->nodes[selectedNode].position = dsq->getGameCursorPosition() + cursorOffset; break; + case ES_ROTATING: + case ES_MAX: + break; } } else if (editType == ET_ENTITIES) @@ -3126,6 +3136,11 @@ void SceneEditor::update(float dt) } } } + break; + case ES_SELECTING: + case ES_SCALING: + case ES_MAX: + break; } } else if (editType == ET_ELEMENTS) @@ -3193,7 +3208,7 @@ void SceneEditor::update(float dt) else if (cursorOffset.x < oldPosition.x-10) right = false; else - noSide++; + noSide = true; if (cursorOffset.y > oldPosition.y+10) down = true; else if (cursorOffset.y < oldPosition.y-10) @@ -3291,6 +3306,8 @@ void SceneEditor::update(float dt) } } break; + case ES_MAX: + break; } } } diff --git a/Aquaria/SchoolFish.cpp b/Aquaria/SchoolFish.cpp index 7d21e16..be7aa9a 100644 --- a/Aquaria/SchoolFish.cpp +++ b/Aquaria/SchoolFish.cpp @@ -25,10 +25,10 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. const float strengthSeparation = 1; const float strengthAlignment = 0.8f; -const float strengthAvoidance = 1; +//const float strengthAvoidance = 1; const float strengthCohesion = 0.5f; -const float avoidanceDistance = 128; +//const float avoidanceDistance = 128; const float separationDistance = 128; const float minUrgency = 5;//0.05; const float maxUrgency = 10;//0.1; diff --git a/Aquaria/ScriptInterface.cpp b/Aquaria/ScriptInterface.cpp index bec62c5..33f39e7 100644 --- a/Aquaria/ScriptInterface.cpp +++ b/Aquaria/ScriptInterface.cpp @@ -586,16 +586,6 @@ BaseText *getText(lua_State *L, int slot = 1) return q; } -static inline -Shader *getShader(lua_State *L, int slot = 1) -{ - Shader *q = (Shader*)lua_touserdata(L, slot); - ENSURE_TYPE(q, SCO_SHADER); - if (!q) - scriptDebug(L, "Invalid Shader"); - return q; -} - static SkeletalSprite *getSkeletalSprite(Entity *e) { return e ? &e->skeletalSprite : NULL; @@ -4542,7 +4532,7 @@ luaFunc(entity_getAnimationLoop) luaFunc(entity_move) { Entity *e = entity(L); - bool ease = lua_tointeger(L, 5); + //bool ease = lua_tointeger(L, 5); Vector p(lua_tonumber(L, 2), lua_tonumber(L, 3)); if (getBool(L, 6)) p = e->position + p; @@ -7703,7 +7693,7 @@ luaFunc(getNearestEntity) Vector p(lua_tonumber(L, 1), lua_tonumber(L, 2)); int radius = lua_tointeger(L, 3); Entity *ignore = lua_isuserdata(L, 4) ? entity(L, 4) : NULL; - EntityType et = lua_isnumber(L, 5) ? (EntityType)lua_tointeger(L, 5) : ET_NOTYPE; + //EntityType et = lua_isnumber(L, 5) ? (EntityType)lua_tointeger(L, 5) : ET_NOTYPE; DamageType dt = lua_isnumber(L, 6) ? (DamageType)lua_tointeger(L, 6) : DT_NONE; int lrStart = lua_isnumber(L, 7) ? lua_tointeger(L, 7) : -1; int lrEnd = lua_isnumber(L, 8) ? lua_tointeger(L, 8) : -1; @@ -9706,6 +9696,7 @@ static const struct { luaRegister(entity_setDeathParticleEffect), luaRegister(entity_setDeathSound), + luaRegister(entity_setStopSoundsOnDeath), luaRegister(entity_setDamageTarget), luaRegister(entity_setAllDamageTargets), @@ -9958,7 +9949,7 @@ static const struct { luaRegister(resetTimer), luaRegister(addInfluence), - luaRegister(setSuckPosition), + luaRegister(getSuckPosition), luaRegister(setSuckPosition), luaRegister(setNumSuckPositions), luaRegister(setupBasicEntity), @@ -10567,8 +10558,9 @@ static const struct { luaRegister(minimap_setWaterBitTex), luaRegister(minimap_setTopTex), luaRegister(minimap_setBottomTex), - luaRegister(minimap_setAvatarIconTex), - luaRegister(minimap_setHealthBarTex), + luaRegister(minimap_setAvatarIconTex), + luaRegister(minimap_setHealthBarTex), + luaRegister(minimap_setMaxHealthMarkerTex), luaRegister(entity_mmicon_delete), luaRegister(entity_mmicon_tex), luaRegister(entity_mmicon_size), @@ -10590,7 +10582,7 @@ static const struct { #undef MK_ALIAS #define MK_FUNC(base, getter, prefix, suffix) luaRegister(prefix##_##suffix), #define MK_STR(s) #s -#define MK_ALIAS(prefix, suffix, alias) {MK_STR(prefix)"_"MK_STR(alias), l_##prefix##_##suffix}, +#define MK_ALIAS(prefix, suffix, alias) {MK_STR(prefix) "_" MK_STR(alias), l_##prefix##_##suffix}, EXPAND_FUNC_PROTOTYPES diff --git a/Aquaria/StatsAndAchievements.cpp b/Aquaria/StatsAndAchievements.cpp index c133243..3d2c115 100644 --- a/Aquaria/StatsAndAchievements.cpp +++ b/Aquaria/StatsAndAchievements.cpp @@ -92,7 +92,7 @@ const int FLAG_SPIRIT_DRASK = 126; const int FLAG_SPIRIT_DRUNIAD = 127; const int FLAG_TRANSTURTLE_VEIL01 = 130; -const int FLAG_TRANSTURTLE_OPENWATER06 = 131; +//const int FLAG_TRANSTURTLE_OPENWATER06 = 131; const int FLAG_TRANSTURTLE_FOREST04 = 132; const int FLAG_TRANSTURTLE_OPENWATER03 = 133; const int FLAG_TRANSTURTLE_FOREST05 = 134; @@ -104,15 +104,15 @@ const int FLAG_TRANSTURTLE_FINALBOSS = 139; const int FLAG_SEAHORSEBESTTIME = 247; -const int FLAG_MINIBOSS_START = 700; -const int FLAG_MINIBOSS_NAUTILUSPRIME = 700; +//const int FLAG_MINIBOSS_START = 700; +//const int FLAG_MINIBOSS_NAUTILUSPRIME = 700; const int FLAG_MINIBOSS_KINGJELLY = 701; const int FLAG_MINIBOSS_MERGOG = 702; const int FLAG_MINIBOSS_CRAB = 703; const int FLAG_MINIBOSS_OCTOMUN = 704; const int FLAG_MINIBOSS_MANTISSHRIMP = 705; -const int FLAG_MINIBOSS_PRIESTS = 706; -const int FLAG_MINIBOSS_END = 720; +//const int FLAG_MINIBOSS_PRIESTS = 706; +//const int FLAG_MINIBOSS_END = 720; //----------------------------------------------------------------------------- diff --git a/Aquaria/StatsAndAchievements.h b/Aquaria/StatsAndAchievements.h index 8c37fc6..5d2ae1b 100644 --- a/Aquaria/StatsAndAchievements.h +++ b/Aquaria/StatsAndAchievements.h @@ -155,7 +155,7 @@ private: // Should we store stats this frame? bool storeStats; - PlayStats playStats; + // PlayStats playStats; // Current Stat details //float m_flGameFeetTraveled; diff --git a/BBGE/AfterEffect.cpp b/BBGE/AfterEffect.cpp index 3eaef3f..1159608 100644 --- a/BBGE/AfterEffect.cpp +++ b/BBGE/AfterEffect.cpp @@ -264,8 +264,8 @@ void AfterEffectManager::renderGrid() if (activeShader) activeShader->unbind(); - float width2 = float(vw)/2; - float height2 = float(vh)/2; + //float width2 = float(vw)/2; + //float height2 = float(vh)/2; if(firstShader != lastShader) diff --git a/BBGE/AfterEffect.h b/BBGE/AfterEffect.h index d28ec8a..463a533 100644 --- a/BBGE/AfterEffect.h +++ b/BBGE/AfterEffect.h @@ -28,6 +28,7 @@ class Effect { public: Effect(); + virtual ~Effect(){}; virtual void go(){} virtual void update(float dt, Vector ** drawGrid, int xDivs, int yDivs){} bool done; diff --git a/BBGE/Base.cpp b/BBGE/Base.cpp index d8731be..e397ba4 100644 --- a/BBGE/Base.cpp +++ b/BBGE/Base.cpp @@ -67,6 +67,13 @@ Vector getDirVector(Direction dir) case DIR_RIGHT: return Vector(1, 0); break; + case DIR_UPLEFT: + case DIR_UPRIGHT: + case DIR_DOWNLEFT: + case DIR_DOWNRIGHT: + case DIR_MAX: + case DIR_NONE: + break; } return Vector(0,0); } @@ -87,6 +94,13 @@ Direction getOppositeDir(Direction dir) case DIR_RIGHT: return DIR_LEFT; break; + case DIR_UPLEFT: + case DIR_UPRIGHT: + case DIR_DOWNLEFT: + case DIR_DOWNRIGHT: + case DIR_MAX: + case DIR_NONE: + break; } return DIR_NONE; @@ -108,6 +122,13 @@ Direction getNextDirClockwise(Direction dir) case DIR_RIGHT: return DIR_DOWN; break; + case DIR_UPLEFT: + case DIR_UPRIGHT: + case DIR_DOWNLEFT: + case DIR_DOWNRIGHT: + case DIR_MAX: + case DIR_NONE: + break; } return DIR_NONE; } @@ -200,11 +221,6 @@ static unsigned char charIsUpper(unsigned char c) return c == upperToLowerTable[c]; } -static unsigned char charIsLower(unsigned char c) -{ - return c == lowerToUpperTable[c]; -} - static unsigned char charToLower(unsigned char c) { return upperToLowerTable[c]; @@ -591,7 +607,7 @@ void forEachFile(std::string path, std::string type, void callback(const std::st dirent *file=0; while ( (file=readdir(dir)) != NULL ) { - if (file->d_name && strlen(file->d_name) > 4) + if (strlen(file->d_name) > 4) { debugLog(file->d_name); char *extension=strrchr(file->d_name,'.'); diff --git a/BBGE/Core.cpp b/BBGE/Core.cpp index dfb6ef5..9c4f0aa 100644 --- a/BBGE/Core.cpp +++ b/BBGE/Core.cpp @@ -1280,35 +1280,6 @@ bool Core::createWindow(int width, int height, int bits, bool fullscreen, std::s #define M_PI 3.14159265358979323846 #endif -static void -bbgePerspective(float fovy, float aspect, float zNear, float zFar) -{ - float sine, cotangent, deltaZ; - float radians = fovy / 2.0f * M_PI / 180.0f; - - deltaZ = zFar - zNear; - sine = sinf(radians); - if ((deltaZ == 0.0f) || (sine == 0.0f) || (aspect == 0.0f)) { - return; - } - cotangent = cosf(radians) / sine; - - GLfloat m[4][4] = { - { 1.0f, 0.0f, 0.0f, 0.0f }, - { 0.0f, 1.0f, 0.0f, 0.0f }, - { 0.0f, 0.0f, 1.0f, 0.0f }, - { 0.0f, 0.0f, 0.0f, 1.0f } - }; - m[0][0] = (GLfloat) (cotangent / aspect); - m[1][1] = (GLfloat) cotangent; - m[2][2] = (GLfloat) (-(zFar + zNear) / deltaZ); - m[2][3] = -1.0f; - m[3][2] = (GLfloat) (-2.0f * zNear * zFar / deltaZ); - m[3][3] = 0.0f; - - glMultMatrixf(&m[0][0]); -} - void Core::setPixelScale(int pixelScaleX, int pixelScaleY) { @@ -1564,8 +1535,7 @@ void Core::main(float runTime) float dt; float counter = 0; - int frames = 0; - float real_dt = 0; + int frames = 0; #if (!defined(_DEBUG) || defined(BBGE_BUILD_UNIX)) && defined(BBGE_BUILD_SDL) diff --git a/BBGE/DebugFont.cpp b/BBGE/DebugFont.cpp index f593bf9..4bf5b24 100644 --- a/BBGE/DebugFont.cpp +++ b/BBGE/DebugFont.cpp @@ -162,7 +162,12 @@ void DebugFont::setAlign(Align align) #include "../BBGE/Quad.h" DebugButton::DebugButton(int buttonID, DebugButtonReceiver *receiver, int bgWidth, int fsize, bool quitMain) - : RenderObject(), label(0), highlight(0), quitMain(quitMain), receiver(receiver), buttonID(buttonID) + : RenderObject() + , label(0) + , quitMain(quitMain) + , buttonID(buttonID) + , highlight(0) + , receiver(receiver) { if (bgWidth == 0) bgWidth = 150; diff --git a/BBGE/Effects.cpp b/BBGE/Effects.cpp index eed10fe..eb25a91 100644 --- a/BBGE/Effects.cpp +++ b/BBGE/Effects.cpp @@ -80,6 +80,10 @@ void PostProcessingFX::render() FXTypes type = (FXTypes)i; switch(type) { + case FTX_NONE: + break; + case FXT_MAX: + break; case FXT_RADIALBLUR: float windowW = core->getWindowWidth(); @@ -148,7 +152,7 @@ void PostProcessingFX::render() RenderObject::lastTextureApplied = 0; - break; + break; } glPopMatrix(); diff --git a/BBGE/Particles.h b/BBGE/Particles.h index 3ed6239..2b8a3a6 100644 --- a/BBGE/Particles.h +++ b/BBGE/Particles.h @@ -185,7 +185,7 @@ protected: struct ParticleInfluence { ParticleInfluence(Vector pos, float spd, float size, bool pull) - : pos(pos), spd(spd), size(size), pull(pull) + : pos(pos), size(size), spd(spd), pull(pull) {} ParticleInfluence() : size(0), spd(0), pull(false) {} Vector pos; diff --git a/BBGE/QuadTrail.cpp b/BBGE/QuadTrail.cpp index c6b06fc..24b2d16 100644 --- a/BBGE/QuadTrail.cpp +++ b/BBGE/QuadTrail.cpp @@ -22,7 +22,10 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. #include QuadTrail::QuadTrail(int maxPoints, float pointDist) -: RenderObject(), maxPoints(maxPoints), pointDist(pointDist), numPoints(0) + : RenderObject() + , numPoints(0) + , maxPoints(maxPoints) + , pointDist(pointDist) { quadTrailAlphaEffect = QTAE_NORMAL; cull = false; diff --git a/BBGE/Shader.cpp b/BBGE/Shader.cpp index d73b0d9..b9ff063 100644 --- a/BBGE/Shader.cpp +++ b/BBGE/Shader.cpp @@ -114,9 +114,9 @@ void Shader::staticInit() // everything fine when we are here _useShaders = true; -#endif -end: + end: +#endif if (_useShaders) debugLog("Shader support enabled."); @@ -329,14 +329,14 @@ void Shader::_setUniform(Uniform *u) { switch(u->type) { - case GL_FLOAT: glUniform1fvARB(u->location, 1, u->data.f); break; - case GL_FLOAT_VEC2_ARB: glUniform2fvARB(u->location, 1, u->data.f); break; - case GL_FLOAT_VEC3_ARB: glUniform3fvARB(u->location, 1, u->data.f); break; - case GL_FLOAT_VEC4_ARB: glUniform4fvARB(u->location, 1, u->data.f); break; - case GL_INT: glUniform1ivARB(u->location, 1, u->data.i); break; - case GL_INT_VEC2_ARB: glUniform2ivARB(u->location, 1, u->data.i); break; - case GL_INT_VEC3_ARB: glUniform3ivARB(u->location, 1, u->data.i); break; - case GL_INT_VEC4_ARB: glUniform4ivARB(u->location, 1, u->data.i); break; + case GL_FLOAT: glUniform1fvARB(u->location, 1, u->data.f.f); break; + case GL_FLOAT_VEC2_ARB: glUniform2fvARB(u->location, 1, u->data.f.f); break; + case GL_FLOAT_VEC3_ARB: glUniform3fvARB(u->location, 1, u->data.f.f); break; + case GL_FLOAT_VEC4_ARB: glUniform4fvARB(u->location, 1, u->data.f.f); break; + case GL_INT: glUniform1ivARB(u->location, 1, u->data.i.i); break; + case GL_INT_VEC2_ARB: glUniform2ivARB(u->location, 1, u->data.i.i); break; + case GL_INT_VEC3_ARB: glUniform3ivARB(u->location, 1, u->data.i.i); break; + case GL_INT_VEC4_ARB: glUniform4ivARB(u->location, 1, u->data.i.i); break; } u->dirty = false; } @@ -432,10 +432,10 @@ void Shader::setInt(const char *name, int x, int y /* = 0 */, int z /* = 0 */, i if(unsigned(idx) >= uniforms.size()) return; Uniform& u = uniforms[idx]; - u.data.i[0] = x; - u.data.i[1] = y; - u.data.i[2] = z; - u.data.i[3] = w; + u.data.i.i[0] = x; + u.data.i.i[1] = y; + u.data.i.i[2] = z; + u.data.i.i[3] = w; u.dirty = true; uniformsDirty = true; #endif @@ -450,10 +450,10 @@ void Shader::setFloat(const char *name, float x, float y /* = 0 */, float z /* = if(unsigned(idx) >= uniforms.size()) return; Uniform& u = uniforms[idx]; - u.data.f[0] = x; - u.data.f[1] = y; - u.data.f[2] = z; - u.data.f[3] = w; + u.data.f.f[0] = x; + u.data.f.f[1] = y; + u.data.f.f[2] = z; + u.data.f.f[3] = w; u.dirty = true; uniformsDirty = true; #endif diff --git a/BBGE/Shader.h b/BBGE/Shader.h index 762a794..88a9179 100644 --- a/BBGE/Shader.h +++ b/BBGE/Shader.h @@ -62,14 +62,14 @@ private: bool dirty; // need to flush if true union { - struct + struct si { int i[4]; - }; - struct + } i; + struct sf { float f[4]; - }; + } f; } data; char name[64]; diff --git a/BBGE/SkeletalSprite.cpp b/BBGE/SkeletalSprite.cpp index d878678..a057756 100644 --- a/BBGE/SkeletalSprite.cpp +++ b/BBGE/SkeletalSprite.cpp @@ -365,13 +365,16 @@ void BoneCommand::run() if (e) e->stop(); } - break; + break; case AC_SET_PASS: b->setRenderPass(slot); break; case AC_RESET_PASS: b->setRenderPass(b->originalRenderPass); - break; + break; + case AC_SEGS_START: + case AC_SEGS_STOP: + break; } } diff --git a/BBGE/SkeletalSprite.h b/BBGE/SkeletalSprite.h index 6e86a23..301a66c 100644 --- a/BBGE/SkeletalSprite.h +++ b/BBGE/SkeletalSprite.h @@ -105,7 +105,7 @@ public: class BoneKeyframe { public: - BoneKeyframe() : idx(0), x(0), y(0), rot(0), doScale(0), sx(1), sy(1) {} + BoneKeyframe() : idx(0), x(0), y(0), rot(0), sx(1), sy(1), doScale(0) {} int idx, x, y, rot; float sx, sy; bool doScale; diff --git a/BBGE/SoundManager.cpp b/BBGE/SoundManager.cpp index eec21c5..5c2e973 100644 --- a/BBGE/SoundManager.cpp +++ b/BBGE/SoundManager.cpp @@ -72,7 +72,7 @@ namespace SoundCore struct FadeCh { public: - FadeCh() : v(1), s(1), c(0), d(-1), to(0) {} + FadeCh() : c(0), v(1), s(1), to(0), d(-1) {} FMOD::Channel *c; float v,s,to; int d; @@ -410,6 +410,9 @@ void SoundManager::toggleEffectMusic(SoundEffectType effect, bool on) dspFlange->remove(); } break; + case SFX_NONE: + case SFX_MAX: + break; } } diff --git a/BBGE/SoundManager.h b/BBGE/SoundManager.h index bbd7c46..8bc23fd 100644 --- a/BBGE/SoundManager.h +++ b/BBGE/SoundManager.h @@ -84,9 +84,8 @@ enum SoundLoadType struct PlaySfx { - PlaySfx() : priority(0.5), handle(0), vol(1), fade(SFT_NONE), - time(0), freq(1), loops(0), - maxdist(0), x(0), y(0), relative(true), positional(false) {} + PlaySfx() : handle(0), vol(1), time(0), freq(1), loops(0), priority(0.5), + maxdist(0), fade(SFT_NONE), x(0), y(0), relative(true), positional(false) {} std::string name; intptr_t handle; diff --git a/BBGE/Texture.cpp b/BBGE/Texture.cpp index 8597fdb..67ad512 100644 --- a/BBGE/Texture.cpp +++ b/BBGE/Texture.cpp @@ -230,7 +230,7 @@ bool Texture::load(std::string file) size_t pos = file.find_last_of('.'); - if ((pos != std::string::npos) && (pos >= 0)) + if (pos != std::string::npos) { // make sure this didn't catch the '.' in /home/username/.Aquaria/* --ryan. const std::string userdata = core->getUserDataFolder(); diff --git a/ExternalLibs/ByteBuffer.h b/ExternalLibs/ByteBuffer.h index 7e172d2..9bb8a49 100644 --- a/ExternalLibs/ByteBuffer.h +++ b/ExternalLibs/ByteBuffer.h @@ -148,26 +148,26 @@ public: ByteBuffer() - : _rpos(0), _wpos(0), _buf(NULL), _size(0), _growable(true), _res(0), _mybuf(false), _delfunc(NULL), - _allocfunc(NULL) + : _buf(NULL), _rpos(0), _wpos(0), _res(0), _size(0), _delfunc(NULL), + _allocfunc(NULL), _mybuf(false), _growable(true) { } ByteBuffer(uint32 res) - : _rpos(0), _wpos(0), _buf(NULL), _size(0), _growable(true), _res(0), _mybuf(false), _delfunc(NULL), - _allocfunc(NULL) + : _buf(NULL), _rpos(0), _wpos(0), _res(0), _size(0), _delfunc(NULL), + _allocfunc(NULL), _mybuf(false), _growable(true) { _allocate(res); } ByteBuffer(ByteBuffer &buf, Mode mode = COPY, uint32 extra = 0) - : _rpos(0), _wpos(0), _buf(NULL), _size(0), _growable(true), _res(0), _mybuf(false), _delfunc(NULL), - _allocfunc(NULL) - { + : _buf(NULL), _rpos(0), _wpos(0), _res(0), _size(0), _delfunc(NULL), + _allocfunc(NULL), _mybuf(false), _growable(true) + { init(buf, mode, extra); } // del param only used with TAKE_OVER, extra only used with COPY ByteBuffer(void *buf, uint32 size, Mode mode = COPY, delete_func del = NULL, uint32 extra = 0) - : _rpos(0), _wpos(0), _size(size), _buf(NULL), _growable(true), _delfunc(del), - _mybuf(false), _allocfunc(NULL) // for mode == REUSE + : _buf(NULL), _rpos(0), _wpos(0), _res(0), _size(0), _delfunc(NULL), + _allocfunc(NULL), _mybuf(false), _growable(true) // for mode == REUSE { init(buf, size, mode, del, extra); } diff --git a/ExternalLibs/DeflateCompressor.cpp b/ExternalLibs/DeflateCompressor.cpp index 071be17..db91f9a 100644 --- a/ExternalLibs/DeflateCompressor.cpp +++ b/ExternalLibs/DeflateCompressor.cpp @@ -9,9 +9,9 @@ DeflateCompressor::DeflateCompressor() : _windowBits(-MAX_WBITS), // negative, because we want a raw deflate stream, and not zlib-wrapped + _real_size(0), _forceCompress(false), - _iscompressed(false), - _real_size(0) + _iscompressed(false) { } From 8af953cb63142a9b78247e8c2a5179368b490ac2 Mon Sep 17 00:00:00 2001 From: fgenesis Date: Thu, 12 Jan 2017 22:51:46 +0100 Subject: [PATCH 2/5] Replace spaces with tabs (future self: i'm sorry) In most places, that is. Left some files unchanges because they are a mess. --- Aquaria/AnimationEditor.cpp | 3 +- Aquaria/AquariaCompileConfig.h | 10 +- Aquaria/AquariaMenuItem.cpp | 4 +- Aquaria/Avatar.cpp | 130 ++++----- Aquaria/CollideEntity.cpp | 4 +- Aquaria/Continuity.cpp | 26 +- Aquaria/DSQ.cpp | 134 +++++----- Aquaria/DSQ.h | 2 +- Aquaria/Element.cpp | 24 +- Aquaria/Game.cpp | 33 ++- Aquaria/Game.h | 2 +- Aquaria/Ingredient.cpp | 28 +- Aquaria/Main.cpp | 56 ++-- Aquaria/MiniMapRender.cpp | 8 +- Aquaria/ModSelector.cpp | 36 +-- Aquaria/Network.cpp | 2 +- Aquaria/Path.cpp | 3 - Aquaria/PathFinding.cpp | 5 +- Aquaria/SceneEditor.cpp | 78 +++--- Aquaria/SchoolFish.cpp | 6 +- Aquaria/StatsAndAchievements.cpp | 2 +- Aquaria/StatsAndAchievements.h | 2 +- BBGE/AfterEffect.cpp | 4 - BBGE/AfterEffect.h | 2 +- BBGE/Base.cpp | 438 +++++++++++++++---------------- BBGE/Base.h | 8 +- BBGE/Core.cpp | 66 ++--- BBGE/Core.h | 52 ++-- BBGE/DebugFont.cpp | 12 +- BBGE/Effects.cpp | 8 +- BBGE/Effects.h | 1 - BBGE/Event.h | 4 +- BBGE/Particles.h | 2 +- BBGE/Precacher.cpp | 2 +- BBGE/QuadTrail.cpp | 8 +- BBGE/Shader.cpp | 68 ++--- BBGE/Shader.h | 8 +- BBGE/SkeletalSprite.cpp | 16 +- BBGE/SkeletalSprite.h | 2 +- BBGE/SoundManager.cpp | 84 +++--- BBGE/SoundManager.h | 4 +- BBGE/Texture.cpp | 10 +- 42 files changed, 691 insertions(+), 706 deletions(-) diff --git a/Aquaria/AnimationEditor.cpp b/Aquaria/AnimationEditor.cpp index f1dff23..a5aa7a2 100644 --- a/Aquaria/AnimationEditor.cpp +++ b/Aquaria/AnimationEditor.cpp @@ -1111,8 +1111,7 @@ void AnimationEditor::flipRot() { BoneKeyframe *bcur = editSprite->getCurrentAnimation()->getKeyframe(currentKey)->getBoneKeyframe(editingBone->boneIdx); if (bcur) - { - // int rotdiff = editingBone->rotation.z - bcur->rot; + { if (!core->getCtrlState()) { for (int i = 0; i < editSprite->getCurrentAnimation()->getNumKeyframes(); ++i) diff --git a/Aquaria/AquariaCompileConfig.h b/Aquaria/AquariaCompileConfig.h index 64ea423..663ff5a 100644 --- a/Aquaria/AquariaCompileConfig.h +++ b/Aquaria/AquariaCompileConfig.h @@ -6,13 +6,13 @@ #ifndef BBGE_SKIP_CONFIG_HEADERS - #define AQUARIA_BUILD_CONSOLE 1 - #define AQUARIA_BUILD_SCENEEDITOR 1 + #define AQUARIA_BUILD_CONSOLE 1 + #define AQUARIA_BUILD_SCENEEDITOR 1 - #define AQUARIA_CUSTOM_BUILD_ID (" Build " __DATE__ " - " __TIME__) + #define AQUARIA_CUSTOM_BUILD_ID (" Build " __DATE__ " - " __TIME__) - // If defined, this is shown instead of "Aquaria vx.x.x ..." on the title screen. - //#define AQUARIA_OVERRIDE_VERSION_STRING "Aquaria OSE v1.001" + // If defined, this is shown instead of "Aquaria vx.x.x ..." on the title screen. + //#define AQUARIA_OVERRIDE_VERSION_STRING "Aquaria OSE v1.001" #endif diff --git a/Aquaria/AquariaMenuItem.cpp b/Aquaria/AquariaMenuItem.cpp index 674a01d..f2f5eb2 100644 --- a/Aquaria/AquariaMenuItem.cpp +++ b/Aquaria/AquariaMenuItem.cpp @@ -695,8 +695,8 @@ void AquariaKeyConfig::onUpdate(float dt) } } break; - case INPUTSET_NONE: - break; + case INPUTSET_NONE: + break; } } diff --git a/Aquaria/Avatar.cpp b/Aquaria/Avatar.cpp index 77f6713..0ff37d2 100644 --- a/Aquaria/Avatar.cpp +++ b/Aquaria/Avatar.cpp @@ -861,17 +861,17 @@ std::string Avatar::getIdleAnimName() { case FORM_ENERGY: ret="energyidle"; - break; - case FORM_NORMAL: - case FORM_BEAST: - case FORM_NATURE: - case FORM_SPIRIT: - case FORM_DUAL: - case FORM_FISH: - case FORM_SUN: - case FORM_MAX: - case FORM_NONE: - break; + break; + case FORM_NORMAL: + case FORM_BEAST: + case FORM_NATURE: + case FORM_SPIRIT: + case FORM_DUAL: + case FORM_FISH: + case FORM_SUN: + case FORM_MAX: + case FORM_NONE: + break; } return ret; } @@ -1241,11 +1241,11 @@ void Avatar::entityDied(Entity *e) { dsq->continuity.eatBeast(e->eatData); } - break; - case EAT_DEFAULT: - case EAT_MAX: - case EAT_NONE: - break; + break; + case EAT_DEFAULT: + case EAT_MAX: + case EAT_NONE: + break; } } @@ -1596,9 +1596,9 @@ void Avatar::changeForm(FormType form, bool effects, bool onInit, FormType lastF case FORM_DUAL: core->sound->playSfx("DualForm"); break; - case FORM_NONE: - case FORM_MAX: - break; + case FORM_NONE: + case FORM_MAX: + break; } /* @@ -2836,10 +2836,10 @@ void Avatar::formAbility(int ability) } break; - case FORM_NORMAL: - case FORM_NONE: - case FORM_MAX: - break; + case FORM_NORMAL: + case FORM_NONE: + case FORM_MAX: + break; } } @@ -3000,7 +3000,7 @@ void Avatar::doShock(const std::string &shotName) } } */ - // Vector d = e->position - position; + // Vector d = e->position - position; /* float a = float(float(i)/float(sz))*PI*2; Vector aim(sinf(a), cosf(a)); @@ -3055,17 +3055,17 @@ void Avatar::formAbilityUpdate(float dt) } } break; - case FORM_ENERGY: - case FORM_NORMAL: - case FORM_BEAST: - case FORM_NATURE: - case FORM_SPIRIT: - case FORM_DUAL: - case FORM_SUN: - case FORM_MAX: - case FORM_NONE: - break; - } + case FORM_ENERGY: + case FORM_NORMAL: + case FORM_BEAST: + case FORM_NATURE: + case FORM_SPIRIT: + case FORM_DUAL: + case FORM_SUN: + case FORM_MAX: + case FORM_NONE: + break; + } } bool Avatar::isMouseInputEnabled() @@ -3155,13 +3155,13 @@ bool Avatar::canCharge(int ability) break; case FORM_SUN: return true; - break; - case FORM_NORMAL: - case FORM_SPIRIT: - case FORM_FISH: - case FORM_MAX: - case FORM_NONE: - break; + break; + case FORM_NORMAL: + case FORM_SPIRIT: + case FORM_FISH: + case FORM_MAX: + case FORM_NONE: + break; } return false; } @@ -4753,11 +4753,11 @@ void Avatar::updateAura(float dt) } } } - break; - case AURA_THING: - case AURA_HEAL: - case AURA_NONE: - break; + break; + case AURA_THING: + case AURA_HEAL: + case AURA_NONE: + break; } auraTimer -= dt; @@ -4901,15 +4901,15 @@ void Avatar::updateFormVisualEffects(float dt) case FORM_SPIRIT: skeletalSprite.update(dt); skeletalSprite.position = bodyPosition; - break; - case FORM_NORMAL: - case FORM_BEAST: - case FORM_NATURE: - case FORM_DUAL: - case FORM_FISH: - case FORM_MAX: - case FORM_NONE: - break; + break; + case FORM_NORMAL: + case FORM_BEAST: + case FORM_NATURE: + case FORM_DUAL: + case FORM_FISH: + case FORM_MAX: + case FORM_NONE: + break; } } @@ -6020,7 +6020,7 @@ void Avatar::onUpdate(float dt) { if (state.spellCharge > 1.5f && chargeLevelAttained <1) { - chargeLevelAttained = 1; + chargeLevelAttained = 1; core->sound->playSfx("PowerUp"); chargingEmitter->load("ChargingEnergy2"); } @@ -6071,14 +6071,14 @@ void Avatar::onUpdate(float dt) chargingEmitter->start(); } } - break; - case FORM_NORMAL: - case FORM_BEAST: - case FORM_SPIRIT: - case FORM_FISH: - case FORM_MAX: - case FORM_NONE: - break; + break; + case FORM_NORMAL: + case FORM_BEAST: + case FORM_SPIRIT: + case FORM_FISH: + case FORM_MAX: + case FORM_NONE: + break; } } /* diff --git a/Aquaria/CollideEntity.cpp b/Aquaria/CollideEntity.cpp index f303062..d3012e4 100644 --- a/Aquaria/CollideEntity.cpp +++ b/Aquaria/CollideEntity.cpp @@ -93,8 +93,8 @@ void CollideEntity::bounce(float ba) } } break; - case BOUNCE_NONE: - break; + case BOUNCE_NONE: + break; } diff --git a/Aquaria/Continuity.cpp b/Aquaria/Continuity.cpp index 237c2fa..0e7904f 100644 --- a/Aquaria/Continuity.cpp +++ b/Aquaria/Continuity.cpp @@ -607,10 +607,10 @@ std::string Continuity::getIEString(IngredientData *data, int i) return ret; } break; - case IET_NONE: - case IET_RANDOM: - case IET_MAX: - break; + case IET_NONE: + case IET_RANDOM: + case IET_MAX: + break; } return ""; @@ -1245,9 +1245,9 @@ std::string Continuity::getInternalFormName() return "sun"; case FORM_DUAL: return "dual"; - case FORM_NONE: - case FORM_MAX: - break; + case FORM_NONE: + case FORM_MAX: + break; } return ""; } @@ -1641,12 +1641,12 @@ void Continuity::castSong(int num) case SONG_FISHFORM: dsq->game->avatar->changeForm(FORM_FISH); break; - case SONG_SONGDOOR1: - case SONG_SONGDOOR2: - case SONG_ANIMA: - case SONG_NONE: - case SONG_MAX: - break; + case SONG_SONGDOOR1: + case SONG_SONGDOOR2: + case SONG_ANIMA: + case SONG_NONE: + case SONG_MAX: + break; #endif } } diff --git a/Aquaria/DSQ.cpp b/Aquaria/DSQ.cpp index 153a531..d0f0773 100644 --- a/Aquaria/DSQ.cpp +++ b/Aquaria/DSQ.cpp @@ -57,74 +57,74 @@ static void Linux_CopyTree(const char *src, const char *dst) { - struct stat statbuf; - if (stat(src, &statbuf) == -1) - return; + struct stat statbuf; + if (stat(src, &statbuf) == -1) + return; - if (S_ISDIR(statbuf.st_mode)) - { - createDir(dst); // don't care if this fails. - DIR *dirp = opendir(src); - if (dirp == NULL) - return; + if (S_ISDIR(statbuf.st_mode)) + { + createDir(dst); // don't care if this fails. + DIR *dirp = opendir(src); + if (dirp == NULL) + return; - struct dirent *dent; - while ((dent = readdir(dirp)) != NULL) - { - if ((strcmp(dent->d_name, ".") == 0) || (strcmp(dent->d_name, "..") == 0)) - continue; - const size_t srclen = strlen(src) + strlen(dent->d_name) + 2; - char *subsrc = new char[srclen]; - snprintf(subsrc, srclen, "%s/%s", src, dent->d_name); - const size_t dstlen = strlen(dst) + strlen(dent->d_name) + 2; - char *subdst = new char[dstlen]; - snprintf(subdst, dstlen, "%s/%s", dst, dent->d_name); - Linux_CopyTree(subsrc, subdst); - delete[] subdst; - delete[] subsrc; - } - closedir(dirp); - } + struct dirent *dent; + while ((dent = readdir(dirp)) != NULL) + { + if ((strcmp(dent->d_name, ".") == 0) || (strcmp(dent->d_name, "..") == 0)) + continue; + const size_t srclen = strlen(src) + strlen(dent->d_name) + 2; + char *subsrc = new char[srclen]; + snprintf(subsrc, srclen, "%s/%s", src, dent->d_name); + const size_t dstlen = strlen(dst) + strlen(dent->d_name) + 2; + char *subdst = new char[dstlen]; + snprintf(subdst, dstlen, "%s/%s", dst, dent->d_name); + Linux_CopyTree(subsrc, subdst); + delete[] subdst; + delete[] subsrc; + } + closedir(dirp); + } - else if (S_ISREG(statbuf.st_mode)) - { - const int in = open(src, O_RDONLY); - if (in == -1) - return; + else if (S_ISREG(statbuf.st_mode)) + { + const int in = open(src, O_RDONLY); + if (in == -1) + return; - // fail if it already exists. That's okay in this case. - const int out = open(dst, O_WRONLY | O_CREAT | O_EXCL, 0600); - if (out == -1) - { - close(in); - return; - } + // fail if it already exists. That's okay in this case. + const int out = open(dst, O_WRONLY | O_CREAT | O_EXCL, 0600); + if (out == -1) + { + close(in); + return; + } - const size_t buflen = 256 * 1024; - char *buf = new char[buflen]; - bool failed = false; - ssize_t br = 0; - while ( (!failed) && ((br = read(in, buf, buflen)) > 0) ) - failed = (write(out, buf, br) != br); + const size_t buflen = 256 * 1024; + char *buf = new char[buflen]; + bool failed = false; + ssize_t br = 0; + while ( (!failed) && ((br = read(in, buf, buflen)) > 0) ) + failed = (write(out, buf, br) != br); - if (br < 0) - failed = true; + if (br < 0) + failed = true; - delete[] buf; + delete[] buf; - if (close(out) < 0) - failed = true; + if (close(out) < 0) + failed = true; - close(in); + close(in); - if (failed) - unlink(dst); - } + if (failed) + unlink(dst); + } - else - { - fprintf(stderr, "WARNING: we should have copied %s to %s, but it's not a dir or file! Skipped it.\n", src, dst); - } + else + { + fprintf(stderr, "WARNING: we should have copied %s to %s, but it's not a dir or file! Skipped it.\n", src, dst); + } } #endif @@ -800,11 +800,11 @@ static bool sdlVideoModeOK(const int w, const int h, const int bpp) const int modecount = SDL_GetNumDisplayModes(0); for (int i = 0; i < modecount; i++) { SDL_GetDisplayMode(0, i, &mode); - if (!mode.w || !mode.h || (w >= mode.w && h >= mode.h)) { + if (!mode.w || !mode.h || (w >= mode.w && h >= mode.h)) { return true; - } - } - return false; + } + } + return false; #else return SDL_VideoModeOK(w, h, bpp, SDL_OPENGL | SDL_FULLSCREEN); #endif @@ -1782,8 +1782,8 @@ void DSQ::toggleInputMode() case INPUT_JOYSTICK: setInputMode(INPUT_MOUSE); break; - case INPUT_KEYBOARD: - break; + case INPUT_KEYBOARD: + break; } } @@ -1801,8 +1801,8 @@ void DSQ::setInputMode(InputMode mode) core->joystickAsMouse = false; updateCursorFromMouse = true; break; - case INPUT_KEYBOARD: - break; + case INPUT_KEYBOARD: + break; } } @@ -4095,8 +4095,8 @@ void DSQ::onUpdate(float dt) case INPUT_JOYSTICK: os << "joystick"; break; - case INPUT_KEYBOARD: - break; + case INPUT_KEYBOARD: + break; } os << std::endl; Bone *b = dsq->game->avatar->skeletalSprite.getBoneByIdx(1); diff --git a/Aquaria/DSQ.h b/Aquaria/DSQ.h index 6358b87..13c0698 100644 --- a/Aquaria/DSQ.h +++ b/Aquaria/DSQ.h @@ -683,7 +683,7 @@ enum FoodSortType struct IngredientEffect { - IngredientEffect() : magnitude(0), type(IET_NONE) {} + IngredientEffect() : magnitude(0), type(IET_NONE) {} float magnitude; IngredientEffectType type; std::string string; diff --git a/Aquaria/Element.cpp b/Aquaria/Element.cpp index 613bd37..59e86d3 100644 --- a/Aquaria/Element.cpp +++ b/Aquaria/Element.cpp @@ -22,18 +22,18 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. #include "Game.h" ElementEffectData::ElementEffectData() - : elementEffectType(EFX_NONE) - , wavyAngleOffset(0) - , wavyMagnitude(0) - , wavyLerpIn(0) - , wavyMin(0) - , wavyMax(0) - , hitPerc(0) - , effectMult(0) - , wavyWaving(false) - , wavyFlip(false) - , touching(false) - , elementEffectIndex(-1) + : elementEffectType(EFX_NONE) + , wavyAngleOffset(0) + , wavyMagnitude(0) + , wavyLerpIn(0) + , wavyMin(0) + , wavyMax(0) + , hitPerc(0) + , effectMult(0) + , wavyWaving(false) + , wavyFlip(false) + , touching(false) + , elementEffectIndex(-1) { } diff --git a/Aquaria/Game.cpp b/Aquaria/Game.cpp index 19ce959..0ed28cd 100644 --- a/Aquaria/Game.cpp +++ b/Aquaria/Game.cpp @@ -2244,7 +2244,6 @@ float Game::getCoverage(Vector pos, int sampleArea) { if (x == t.x && y == t.y) continue; TileVector ct(x,y); - //Vector vt = ct.worldVector(); if (isObstructed(ct)) { covered++; @@ -2531,7 +2530,7 @@ void Game::loadEntityTypeList() // entityGroups.push_back(newGroup); curGroup = entityGroups.size()-1; - } + } else if (!line.empty()) { EntityGroupEntity ent; @@ -5461,7 +5460,7 @@ bool Game::saveScene(std::string scene) { std::ostringstream& SE_rs = simpleElements_repeatScale[e->bgLayer]; SE_rs << e->repeatToFillScale.x << " " - << e->repeatToFillScale.y << " "; + << e->repeatToFillScale.y << " "; } } @@ -5757,10 +5756,10 @@ void Game::switchBgLoop(int v) case 0: if (!bgSfxLoop.empty()) { - PlaySfx sfx; - sfx.name = bgSfxLoop; - sfx.vol = bgSfxVol; - sfx.loops = -1; + PlaySfx sfx; + sfx.name = bgSfxLoop; + sfx.vol = bgSfxVol; + sfx.loops = -1; sfx.priority = 0.8; dsq->loops.bg = core->sound->playSfx(sfx); } @@ -5768,10 +5767,10 @@ void Game::switchBgLoop(int v) case 1: if (!airSfxLoop.empty()) { - PlaySfx sfx; - sfx.name = airSfxLoop; - sfx.vol = bgSfxVol; - sfx.loops = -1; + PlaySfx sfx; + sfx.name = airSfxLoop; + sfx.vol = bgSfxVol; + sfx.loops = -1; sfx.priority = 0.8; dsq->loops.bg = core->sound->playSfx(sfx); } @@ -8250,9 +8249,9 @@ void Game::playBurstSound(bool wallJump) sound->playSfx("Burst", 1); if (chance(50)) { - if (dsq->continuity.form == FORM_BEAST) - { - sound->playSfx("BeastBurst", (128+rand()%64)/256.0f); + if (dsq->continuity.form == FORM_BEAST) + { + sound->playSfx("BeastBurst", (128+rand()%64)/256.0f); } } } @@ -8691,7 +8690,7 @@ void Game::updateCurrentVisuals(float dt) */ /* - if (dsq->game->getPath(i)->name == "CURRENT" && dsq->game->getPath(i)->nodes.size() >= 2) + if (dsq->game->getPath(i)->name == "CURRENT" && dsq->game->getPath(i)->nodes.size() >= 2) { Vector dir = dsq->game->getPath(i)->nodes[1].position - dsq->game->getPath(i)->nodes[0].position; dir.setLength2D(800); @@ -10401,8 +10400,6 @@ void Game::update(float dt) cameraInterp.interpolateTo(dest, cameraLerpDelay); dsq->cameraPos = getCameraPositionFor(cameraInterp); constrainCamera(); - - //float dd = (dsq->cameraPos - oldCamPos).getLength2D(); } cameraInterp.update(dt); @@ -10582,7 +10579,7 @@ ElementTemplate Game::getElementTemplateForLetter(int i) void Game::loadElementTemplates(std::string pack) { - stringToLower(pack); + stringToLower(pack); /* std::string fn = ("data/"+pack+".xml"); if (!exists(fn)) diff --git a/Aquaria/Game.h b/Aquaria/Game.h index 526a1d8..f39c947 100644 --- a/Aquaria/Game.h +++ b/Aquaria/Game.h @@ -363,7 +363,7 @@ class EntityClass { public: EntityClass(std::string name, bool script=false, int idx=-1, std::string prevGfx="", float prevScale=1) - : name(name), prevScale(prevScale), prevGfx(prevGfx), script(script), idx(idx) {} + : name(name), prevScale(prevScale), prevGfx(prevGfx), script(script), idx(idx) {} std::string name; float prevScale; std::string prevGfx; diff --git a/Aquaria/Ingredient.cpp b/Aquaria/Ingredient.cpp index c18db82..974d627 100644 --- a/Aquaria/Ingredient.cpp +++ b/Aquaria/Ingredient.cpp @@ -22,15 +22,15 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. #include "Avatar.h" IngredientData::IngredientData(const std::string &name, const std::string &gfx, IngredientType type) - : name(name) - , gfx(gfx) - , displayName(dsq->continuity.getIngredientDisplayName(name)) - , type(type) - , amount(0) - , maxAmount(MAX_INGREDIENT_AMOUNT) - , held(0) - , marked(0) - , rotKind(!(type == IT_OIL || type == IT_EGG)) + : name(name) + , gfx(gfx) + , displayName(dsq->continuity.getIngredientDisplayName(name)) + , type(type) + , amount(0) + , maxAmount(MAX_INGREDIENT_AMOUNT) + , held(0) + , marked(0) + , rotKind(!(type == IT_OIL || type == IT_EGG)) { } @@ -50,11 +50,11 @@ bool IngredientData::hasIET(IngredientEffectType iet) } Ingredient::Ingredient(const Vector &pos, IngredientData *data, int amount) - : Entity() - , data(data) - , used(false) - , gone(false) - , amount(amount) + : Entity() + , data(data) + , used(false) + , gone(false) + , amount(amount) { addType(SCO_INGREDIENT); entityType = ET_INGREDIENT; diff --git a/Aquaria/Main.cpp b/Aquaria/Main.cpp index 6bb1661..077dafb 100644 --- a/Aquaria/Main.cpp +++ b/Aquaria/Main.cpp @@ -30,38 +30,38 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. static void MakeRan(void) { #ifdef BBGE_BUILD_WINDOWS - std::ofstream out("ran"); - if(out) - { - for (int i = 0; i < 32; i++) - out << rand()%1000; - out.close(); - } + std::ofstream out("ran"); + if(out) + { + for (int i = 0; i < 32; i++) + out << rand()%1000; + out.close(); + } #endif } static void StartAQConfig() { #if defined(BBGE_BUILD_WINDOWS) - if (!exists("ran", false, true)) - { - MakeRan(); - if(exists("AQConfig.exe", false, true)) - { - ShellExecute(NULL, "open", "AQConfig.exe", NULL, NULL, SW_SHOWNORMAL); - exit(0); - } - } - remove("ran"); + if (!exists("ran", false, true)) + { + MakeRan(); + if(exists("AQConfig.exe", false, true)) + { + ShellExecute(NULL, "open", "AQConfig.exe", NULL, NULL, SW_SHOWNORMAL); + exit(0); + } + } + remove("ran"); #endif } static void CheckConfig(void) { #ifdef BBGE_BUILD_WINDOWS - bool hasCfg = exists("usersettings.xml", false, true); - if(!hasCfg) - StartAQConfig(); + bool hasCfg = exists("usersettings.xml", false, true); + if(!hasCfg) + StartAQConfig(); #endif } @@ -89,16 +89,16 @@ static void CheckConfig(void) #endif - CheckConfig(); + CheckConfig(); - { - DSQ dsql(dsqParam, extraDataDir); - dsql.init(); - dsql.main(); - dsql.shutdown(); - } + { + DSQ dsql(dsqParam, extraDataDir); + dsql.init(); + dsql.main(); + dsql.shutdown(); + } - MakeRan(); + MakeRan(); return (0); } diff --git a/Aquaria/MiniMapRender.cpp b/Aquaria/MiniMapRender.cpp index f6dc5eb..be4fed0 100644 --- a/Aquaria/MiniMapRender.cpp +++ b/Aquaria/MiniMapRender.cpp @@ -285,12 +285,12 @@ void MiniMapRender::toggle(int t) float MiniMapRender::getMiniMapWidth() const { - return scale.x * miniMapSize; + return scale.x * miniMapSize; } float MiniMapRender::getMiniMapHeight() const { - return scale.y * miniMapSize; + return scale.y * miniMapSize; } void MiniMapRender::onUpdate(float dt) @@ -611,8 +611,8 @@ void MiniMapRender::onRender() } if (render) - { - renderIcon(p->minimapIcon, p->nodes[0].position); + { + renderIcon(p->minimapIcon, p->nodes[0].position); } } } diff --git a/Aquaria/ModSelector.cpp b/Aquaria/ModSelector.cpp index c00a0aa..b74ee5d 100644 --- a/Aquaria/ModSelector.cpp +++ b/Aquaria/ModSelector.cpp @@ -42,12 +42,12 @@ static bool _modname_cmp(const ModIcon *a, const ModIcon *b) } ModSelectorScreen::ModSelectorScreen() - : Quad() - , ActionMapper() - , dlText(&dsq->smallFont) - , gotServerList(false) - , currentPanel(-1) - , subtext(&dsq->subsFont) + : Quad() + , ActionMapper() + , dlText(&dsq->smallFont) + , gotServerList(false) + , currentPanel(-1) + , subtext(&dsq->subsFont) { followCamera = 1; shareAlphaWithChildren = false; @@ -136,7 +136,7 @@ void ModSelectorScreen::showPanel(int id) if(id == currentPanel) return; - //const float t = 0.2f; + //const float t = 0.2f; IconGridPanel *newgrid = panels[id]; // fade in selected panel @@ -484,10 +484,10 @@ void BasicIcon::onClick() } MenuIcon::MenuIcon(int id) - : SubtitleIcon() - , cb(0) - , cb_data(0) - , iconId(id) + : SubtitleIcon() + , cb(0) + , cb_data(0) + , iconId(id) { } @@ -623,13 +623,13 @@ void ModIcon::updateStatus() ModIconOnline::ModIconOnline() - : SubtitleIcon() - , pb(0) - , extraIcon(0) - , statusIcon(0) - , pkgtype(MPT_MOD) - , clickable(true) - , hasUpdate(false) + : SubtitleIcon() + , pb(0) + , extraIcon(0) + , statusIcon(0) + , pkgtype(MPT_MOD) + , clickable(true) + , hasUpdate(false) { label = desc; } diff --git a/Aquaria/Network.cpp b/Aquaria/Network.cpp index d28ee7d..b2ac90f 100644 --- a/Aquaria/Network.cpp +++ b/Aquaria/Network.cpp @@ -60,7 +60,7 @@ protected: minihttp::HttpSocket::_OnOpen(); - //const Request& r = GetCurrentRequest(); + //const Request& r = GetCurrentRequest(); // TODO ?? } diff --git a/Aquaria/Path.cpp b/Aquaria/Path.cpp index 8bc1915..0f6cd4b 100644 --- a/Aquaria/Path.cpp +++ b/Aquaria/Path.cpp @@ -587,9 +587,6 @@ void Path::update(float dt) Vector start = nodes[0].position; Vector end = nodes[1].position; Vector v = end - start; - //Vector left = v.getPerpendicularLeft(); - //Vector right = v.getPerpendicularRight(); - //Vector mid = (end-start) + start; FOR_ENTITIES(i) { Entity *e = *i; diff --git a/Aquaria/PathFinding.cpp b/Aquaria/PathFinding.cpp index 1a29fa0..f9c10a1 100644 --- a/Aquaria/PathFinding.cpp +++ b/Aquaria/PathFinding.cpp @@ -28,7 +28,7 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. class SearchGridRaw { public: - SearchGridRaw(ObsType blocking) : blockingObsBits(blocking), game(dsq->game) {} + SearchGridRaw(ObsType blocking) : blockingObsBits(blocking), game(dsq->game) {} inline bool operator()(unsigned x, unsigned y) const { return (game->getGridRaw(TileVector(x, y)) & blockingObsBits) == OT_EMPTY; @@ -79,8 +79,7 @@ void PathFinding::molestPath(VectorPath &path) { Vector node = path.getPathNode(i)->value; float dist; - int sample = 20; - //float maxDist = sample * TILE_SIZE; + const int sample = 20; { Vector n = dsq->game->getWallNormal(node, sample, &dist); if (dist != -1 && (n.x != 0 || n.y != 0)) diff --git a/Aquaria/SceneEditor.cpp b/Aquaria/SceneEditor.cpp index 9f5de6c..9223b3a 100644 --- a/Aquaria/SceneEditor.cpp +++ b/Aquaria/SceneEditor.cpp @@ -460,28 +460,28 @@ void SceneEditor::openMainMenu() core->main(FRAME_TIME); } - addMainMenuItem("LOAD LEVEL... (SHIFT-F1)", 100); - addMainMenuItem("RELOAD LEVEL (F1)", 101); - addMainMenuItem("SAVE LEVEL (F2)", 102); - addMainMenuItem("EDIT TILES (F5)", 106); - addMainMenuItem("EDIT ENTITIES (F6)", 107); - addMainMenuItem("EDIT NODES (F7)", 108); - addMainMenuItem("REGEN COLLISIONS (ALT-R)", 103); - addMainMenuItem("RECACHE TEXTURES (CTRL-R)", 130); + addMainMenuItem("LOAD LEVEL... (SHIFT-F1)", 100); + addMainMenuItem("RELOAD LEVEL (F1)", 101); + addMainMenuItem("SAVE LEVEL (F2)", 102); + addMainMenuItem("EDIT TILES (F5)", 106); + addMainMenuItem("EDIT ENTITIES (F6)", 107); + addMainMenuItem("EDIT NODES (F7)", 108); + addMainMenuItem("REGEN COLLISIONS (ALT-R)", 103); + addMainMenuItem("RECACHE TEXTURES (CTRL-R)", 130); - addMainMenuItem("REGEN ROCK FROM MAPTEMPLATE (F11+F12)", 116); + addMainMenuItem("REGEN ROCK FROM MAPTEMPLATE (F11+F12)", 116); - addMainMenuItem("SET BG GRADIENT", 110); - addMainMenuItem("SET MUSIC", 111); - addMainMenuItem("ENTITY GROUPS (CTRL-E)", 112); + addMainMenuItem("SET BG GRADIENT", 110); + addMainMenuItem("SET MUSIC", 111); + addMainMenuItem("ENTITY GROUPS (CTRL-E)", 112); if (dsq->game->gridRender) - addMainMenuItem(std::string("TOGGLE TILE COLLISION RENDER ") + ((dsq->game->gridRender->alpha!=0) ? "OFF" : "ON ") + std::string(" (F9)"), 113); - addMainMenuItem("SCREENSHOT ", 114); + addMainMenuItem(std::string("TOGGLE TILE COLLISION RENDER ") + ((dsq->game->gridRender->alpha!=0) ? "OFF" : "ON ") + std::string(" (F9)"), 113); + addMainMenuItem("SCREENSHOT ", 114); - addMainMenuItem("PARTICLE VIEWER ", 120); - addMainMenuItem("ANIMATION EDITOR ", 115); + addMainMenuItem("PARTICLE VIEWER ", 120); + addMainMenuItem("ANIMATION EDITOR ", 115); while (1 && !core->getKeyState(KEY_TAB)) { @@ -868,11 +868,11 @@ void SceneEditor::toggleWarpAreaRender() void SceneEditor::setGridPattern(int gi) { - if (selectedElements.size()) - for (int i = 0; i < selectedElements.size(); ++i) - selectedElements[i]->setElementEffectByIndex(gi); - else if (editingElement) - editingElement->setElementEffectByIndex(gi); + if (selectedElements.size()) + for (int i = 0; i < selectedElements.size(); ++i) + selectedElements[i]->setElementEffectByIndex(gi); + else if (editingElement) + editingElement->setElementEffectByIndex(gi); } void SceneEditor::setGridPattern0() @@ -2863,9 +2863,9 @@ void SceneEditor::updateText() if (getSelectedPath()) os << " name: " << getSelectedPath()->name; break; - case ET_SELECTENTITY: - case ET_MAX: - break; + case ET_SELECTENTITY: + case ET_MAX: + break; } text->setText(os.str()); } @@ -2995,10 +2995,10 @@ void SceneEditor::update(float dt) else placer->alpha = 0.5; break; - case ET_PATHS: - case ET_SELECTENTITY: - case ET_MAX: - break; + case ET_PATHS: + case ET_SELECTENTITY: + case ET_MAX: + break; } updateText(); @@ -3106,9 +3106,9 @@ void SceneEditor::update(float dt) if (selectedIdx >= 0) dsq->game->getPath(selectedIdx)->nodes[selectedNode].position = dsq->getGameCursorPosition() + cursorOffset; break; - case ES_ROTATING: - case ES_MAX: - break; + case ES_ROTATING: + case ES_MAX: + break; } } else if (editType == ET_ENTITIES) @@ -3136,11 +3136,11 @@ void SceneEditor::update(float dt) } } } - break; - case ES_SELECTING: - case ES_SCALING: - case ES_MAX: - break; + break; + case ES_SELECTING: + case ES_SCALING: + case ES_MAX: + break; } } else if (editType == ET_ELEMENTS) @@ -3208,7 +3208,7 @@ void SceneEditor::update(float dt) else if (cursorOffset.x < oldPosition.x-10) right = false; else - noSide = true; + noSide = true; if (cursorOffset.y > oldPosition.y+10) down = true; else if (cursorOffset.y < oldPosition.y-10) @@ -3306,8 +3306,8 @@ void SceneEditor::update(float dt) } } break; - case ES_MAX: - break; + case ES_MAX: + break; } } } diff --git a/Aquaria/SchoolFish.cpp b/Aquaria/SchoolFish.cpp index be7aa9a..ae36f1e 100644 --- a/Aquaria/SchoolFish.cpp +++ b/Aquaria/SchoolFish.cpp @@ -317,12 +317,12 @@ void SchoolFish::applySeparation(Vector &accumulator) if (!change.isZero()) { change.setLength2D(-ratio); - accumulator += change; + accumulator += change; } } - // Are we too far from nearest flockmate? Then Move Closer + // Are we too far from nearest flockmate? Then Move Closer /* - else if (dist > separationDistance) + else if (dist > separationDistance) change |= ratio; */ } diff --git a/Aquaria/StatsAndAchievements.cpp b/Aquaria/StatsAndAchievements.cpp index 3d2c115..be5f35d 100644 --- a/Aquaria/StatsAndAchievements.cpp +++ b/Aquaria/StatsAndAchievements.cpp @@ -777,7 +777,7 @@ void StatsAndAchievements::UnlockAchievement( Achievement &achievement ) achievement.iconImage = 0; #ifdef BBGE_BUILD_ACHIEVEMENTS_INTERNAL - unlockedToBeDisplayed.push( std::string(achievement.name) ); + unlockedToBeDisplayed.push( std::string(achievement.name) ); #endif // Store stats end of frame diff --git a/Aquaria/StatsAndAchievements.h b/Aquaria/StatsAndAchievements.h index 5d2ae1b..e01647c 100644 --- a/Aquaria/StatsAndAchievements.h +++ b/Aquaria/StatsAndAchievements.h @@ -155,7 +155,7 @@ private: // Should we store stats this frame? bool storeStats; - // PlayStats playStats; + // PlayStats playStats; // Current Stat details //float m_flGameFeetTraveled; diff --git a/BBGE/AfterEffect.cpp b/BBGE/AfterEffect.cpp index 1159608..ca74cb1 100644 --- a/BBGE/AfterEffect.cpp +++ b/BBGE/AfterEffect.cpp @@ -264,10 +264,6 @@ void AfterEffectManager::renderGrid() if (activeShader) activeShader->unbind(); - //float width2 = float(vw)/2; - //float height2 = float(vh)/2; - - if(firstShader != lastShader) { // From here on: secondary shader passes. diff --git a/BBGE/AfterEffect.h b/BBGE/AfterEffect.h index 463a533..217ed7a 100644 --- a/BBGE/AfterEffect.h +++ b/BBGE/AfterEffect.h @@ -28,7 +28,7 @@ class Effect { public: Effect(); - virtual ~Effect(){}; + virtual ~Effect(){}; virtual void go(){} virtual void update(float dt, Vector ** drawGrid, int xDivs, int yDivs){} bool done; diff --git a/BBGE/Base.cpp b/BBGE/Base.cpp index e397ba4..f21a2e0 100644 --- a/BBGE/Base.cpp +++ b/BBGE/Base.cpp @@ -46,7 +46,7 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. #ifdef BBGE_BUILD_VFS # include "ttvfs.h" # ifndef VFS_IGNORE_CASE -# error Must define VFS_IGNORE_CASE, see VFSDefines.h +# error Must define VFS_IGNORE_CASE, see VFSDefines.h # endif ttvfs::Root vfs; // extern #endif @@ -67,13 +67,13 @@ Vector getDirVector(Direction dir) case DIR_RIGHT: return Vector(1, 0); break; - case DIR_UPLEFT: - case DIR_UPRIGHT: - case DIR_DOWNLEFT: - case DIR_DOWNRIGHT: - case DIR_MAX: - case DIR_NONE: - break; + case DIR_UPLEFT: + case DIR_UPRIGHT: + case DIR_DOWNLEFT: + case DIR_DOWNRIGHT: + case DIR_MAX: + case DIR_NONE: + break; } return Vector(0,0); } @@ -94,13 +94,13 @@ Direction getOppositeDir(Direction dir) case DIR_RIGHT: return DIR_LEFT; break; - case DIR_UPLEFT: - case DIR_UPRIGHT: - case DIR_DOWNLEFT: - case DIR_DOWNRIGHT: - case DIR_MAX: - case DIR_NONE: - break; + case DIR_UPLEFT: + case DIR_UPRIGHT: + case DIR_DOWNLEFT: + case DIR_DOWNRIGHT: + case DIR_MAX: + case DIR_NONE: + break; } return DIR_NONE; @@ -122,13 +122,13 @@ Direction getNextDirClockwise(Direction dir) case DIR_RIGHT: return DIR_DOWN; break; - case DIR_UPLEFT: - case DIR_UPRIGHT: - case DIR_DOWNLEFT: - case DIR_DOWNRIGHT: - case DIR_MAX: - case DIR_NONE: - break; + case DIR_UPLEFT: + case DIR_UPRIGHT: + case DIR_DOWNLEFT: + case DIR_DOWNRIGHT: + case DIR_MAX: + case DIR_NONE: + break; } return DIR_NONE; } @@ -173,12 +173,12 @@ std::string removeSpaces(const std::string &input) unsigned hash(const std::string &string) { - unsigned hash = 5381; + unsigned hash = 5381; - for (int i = 0; i < string.size(); i++) - hash = ((hash << 5) + hash) + (unsigned char)string[i]; + for (int i = 0; i < string.size(); i++) + hash = ((hash << 5) + hash) + (unsigned char)string[i]; - return hash; + return hash; } @@ -298,8 +298,8 @@ void stringToLowerUserData(std::string &s) const std::string userdata = core->getUserDataFolder(); const size_t len = userdata.length(); const bool match = (s.length() > len) && - ((s[len] == '/') || (s[len] == '\\')) && - !strncmp(userdata.c_str(), s.c_str(), len); + ((s[len] == '/') || (s[len] == '\\')) && + !strncmp(userdata.c_str(), s.c_str(), len); if (!match) stringToLower(s); else @@ -319,18 +319,18 @@ int nocasecmp(const std::string &s1, const std::string &s2) //stop when either string's end has been reached while ( *it1 && *it2 ) { - if(charToUpper(*it1) != charToUpper(*it2)) //letters differ? - // return -1 to indicate smaller than, 1 otherwise - return (charToUpper(*it1) < charToUpper(*it2)) ? -1 : 1; - //proceed to the next character in each string - ++it1; - ++it2; + if(charToUpper(*it1) != charToUpper(*it2)) //letters differ? + // return -1 to indicate smaller than, 1 otherwise + return (charToUpper(*it1) < charToUpper(*it2)) ? -1 : 1; + //proceed to the next character in each string + ++it1; + ++it2; } size_t size1=s1.size(), size2=s2.size();// cache lengths //return -1,0 or 1 according to strings' lengths - if (size1==size2) - return 0; - return (size1ext) - { - const char *e = strrchr(vf->name(), '.'); - if(e && nocasecmp(d->ext, e)) - return; - } - d->callback(*(d->path) + vf->name(), d->param); + vfscallback_s *d = (vfscallback_s*)user; + if(d->ext) + { + const char *e = strrchr(vf->name(), '.'); + if(e && nocasecmp(d->ext, e)) + return; + } + d->callback(*(d->path) + vf->name(), d->param); } #endif @@ -604,45 +604,45 @@ void forEachFile(std::string path, std::string type, void callback(const std::st dir = opendir(path.c_str()); if (dir) { - dirent *file=0; + dirent *file=0; while ( (file=readdir(dir)) != NULL ) { - if (strlen(file->d_name) > 4) - { - debugLog(file->d_name); - char *extension=strrchr(file->d_name,'.'); - if (extension) - { - debugLog(extension); - if (extension!=NULL) - { - if (strcasecmp(extension,type.c_str())==0) - { - callback(path + std::string(file->d_name), param); - } - } - } - } + if (strlen(file->d_name) > 4) + { + debugLog(file->d_name); + char *extension=strrchr(file->d_name,'.'); + if (extension) + { + debugLog(extension); + if (extension!=NULL) + { + if (strcasecmp(extension,type.c_str())==0) + { + callback(path + std::string(file->d_name), param); + } + } + } + } } closedir(dir); } else { - debugLog("FAILED TO OPEN DIR"); + debugLog("FAILED TO OPEN DIR"); } #endif #ifdef BBGE_BUILD_WINDOWS - BOOL fFinished; - HANDLE hList; - TCHAR szDir[MAX_PATH+1]; - WIN32_FIND_DATA FileData; + BOOL fFinished; + HANDLE hList; + TCHAR szDir[MAX_PATH+1]; + WIN32_FIND_DATA FileData; int end = path.size()-1; if (path[end] != '/') path[end] += '/'; - // Get the proper directory path + // Get the proper directory path // \\ %s\\* @@ -658,21 +658,21 @@ void forEachFile(std::string path, std::string type, void callback(const std::st stringToUpper(type); - // Get the first file - hList = FindFirstFile(szDir, &FileData); - if (hList == INVALID_HANDLE_VALUE) - { + // Get the first file + hList = FindFirstFile(szDir, &FileData); + if (hList == INVALID_HANDLE_VALUE) + { debugLog("No files of type " + type + " found in path " + path); - } - else - { - // Traverse through the directory structure - fFinished = FALSE; - while (!fFinished) - { - // Check the object is a directory or not - //printf("%*s%s\n", indent, "", FileData.cFileName); + } + else + { + // Traverse through the directory structure + fFinished = FALSE; + while (!fFinished) + { + // Check the object is a directory or not + //printf("%*s%s\n", indent, "", FileData.cFileName); std::string filename = FileData.cFileName; if (filename.size()>4) @@ -688,15 +688,15 @@ void forEachFile(std::string path, std::string type, void callback(const std::st } - if (!FindNextFile(hList, &FileData)) - { + if (!FindNextFile(hList, &FileData)) + { fFinished = TRUE; - } - } - } + } + } + } - FindClose(hList); + FindClose(hList); #endif } @@ -705,29 +705,29 @@ std::vector getFileList(std::string path, std::string type, int par std::vector list; #ifdef BBGE_BUILD_WINDOWS - BOOL fFinished; - HANDLE hList; - TCHAR szDir[MAX_PATH+1]; - WIN32_FIND_DATA FileData; + BOOL fFinished; + HANDLE hList; + TCHAR szDir[MAX_PATH+1]; + WIN32_FIND_DATA FileData; - // Get the proper directory path - sprintf(szDir, "%s\\*", path.c_str()); + // Get the proper directory path + sprintf(szDir, "%s\\*", path.c_str()); - // Get the first file - hList = FindFirstFile(szDir, &FileData); - if (hList == INVALID_HANDLE_VALUE) - { - printf("No files found\n\n"); - } - else - { - // Traverse through the directory structure - fFinished = FALSE; - while (!fFinished) - { - // Check the object is a directory or not - //printf("%*s%s\n", indent, "", FileData.cFileName); + // Get the first file + hList = FindFirstFile(szDir, &FileData); + if (hList == INVALID_HANDLE_VALUE) + { + printf("No files found\n\n"); + } + else + { + // Traverse through the directory structure + fFinished = FALSE; + while (!fFinished) + { + // Check the object is a directory or not + //printf("%*s%s\n", indent, "", FileData.cFileName); std::string filename = FileData.cFileName; if (filename.size()>4 && filename.substr(filename.size()-4, filename.size())==type) { @@ -736,15 +736,15 @@ std::vector getFileList(std::string path, std::string type, int par } - if (!FindNextFile(hList, &FileData)) - { + if (!FindNextFile(hList, &FileData)) + { fFinished = TRUE; - } - } - } + } + } + } - FindClose(hList); + FindClose(hList); #endif return list; @@ -757,7 +757,7 @@ void cocoaMessageBox(const std::string &title, const std::string &msg); void messageBox(const std::string& title, const std::string &msg) { #ifdef BBGE_BUILD_WINDOWS - MessageBox (0,msg.c_str(),title.c_str(),MB_OK); + MessageBox (0,msg.c_str(),title.c_str(),MB_OK); #elif SDL_VERSION_ATLEAST(2,0,0) SDL_ShowSimpleMessageBox(SDL_MESSAGEBOX_BUTTON_RETURNKEY_DEFAULT, title.c_str(), msg.c_str(), NULL); @@ -803,24 +803,24 @@ Vector getNearestPointOnLine(Vector a, Vector b, Vector c) bool isTouchingLine(Vector lineStart, Vector lineEnd, Vector point, int radius, Vector *closestP) { - Vector dir = lineEnd - lineStart; - Vector diff = point - lineStart; - Vector closest; - if (!dir.isZero()) { + Vector dir = lineEnd - lineStart; + Vector diff = point - lineStart; + Vector closest; + if (!dir.isZero()) { float t = diff.dot2D(dir) / dir.dot2D(dir); if (t < 0.0f) - t = 0.0f; + t = 0.0f; if (t > 1.0f) - t = 1.0f; + t = 1.0f; closest = lineStart + t * dir; - } else { + } else { closest = lineStart; - } - Vector d = point - closest; - float distsqr = d.dot2D(d); + } + Vector d = point - closest; + float distsqr = d.dot2D(d); if (closestP) (*closestP) = closest; - return distsqr <= radius*radius; + return distsqr <= radius*radius; } @@ -899,56 +899,56 @@ int packFile(const std::string &sourcef, const std::string &destf, int level) if (!source || !dest) return 0; - int ret, flush; - unsigned have; - z_stream strm; - unsigned char in[CHUNK]; - unsigned char out[CHUNK]; + int ret, flush; + unsigned have; + z_stream strm; + unsigned char in[CHUNK]; + unsigned char out[CHUNK]; - /* allocate deflate state */ - strm.zalloc = Z_NULL; - strm.zfree = Z_NULL; - strm.opaque = Z_NULL; - ret = deflateInit(&strm, level); - if (ret != Z_OK) - return ret; + /* allocate deflate state */ + strm.zalloc = Z_NULL; + strm.zfree = Z_NULL; + strm.opaque = Z_NULL; + ret = deflateInit(&strm, level); + if (ret != Z_OK) + return ret; - /* compress until end of file */ - do { - strm.avail_in = fread(in, 1, CHUNK, source); - if (ferror(source)) { - (void)deflateEnd(&strm); - return Z_ERRNO; - } - flush = feof(source) ? Z_FINISH : Z_NO_FLUSH; - strm.next_in = in; + /* compress until end of file */ + do { + strm.avail_in = fread(in, 1, CHUNK, source); + if (ferror(source)) { + (void)deflateEnd(&strm); + return Z_ERRNO; + } + flush = feof(source) ? Z_FINISH : Z_NO_FLUSH; + strm.next_in = in; - /* run deflate() on input until output buffer not full, finish - compression if all of source has been read in */ - do { - strm.avail_out = CHUNK; - strm.next_out = out; - ret = deflate(&strm, flush); /* no bad return value */ - assert(ret != Z_STREAM_ERROR); /* state not clobbered */ - have = CHUNK - strm.avail_out; - if (fwrite(out, 1, have, dest) != have || ferror(dest)) { - (void)deflateEnd(&strm); - return Z_ERRNO; - } - } while (strm.avail_out == 0); - assert(strm.avail_in == 0); /* all input will be used */ + /* run deflate() on input until output buffer not full, finish + compression if all of source has been read in */ + do { + strm.avail_out = CHUNK; + strm.next_out = out; + ret = deflate(&strm, flush); /* no bad return value */ + assert(ret != Z_STREAM_ERROR); /* state not clobbered */ + have = CHUNK - strm.avail_out; + if (fwrite(out, 1, have, dest) != have || ferror(dest)) { + (void)deflateEnd(&strm); + return Z_ERRNO; + } + } while (strm.avail_out == 0); + assert(strm.avail_in == 0); /* all input will be used */ - /* done when last data in file processed */ - } while (flush != Z_FINISH); - assert(ret == Z_STREAM_END); /* stream will be complete */ + /* done when last data in file processed */ + } while (flush != Z_FINISH); + assert(ret == Z_STREAM_END); /* stream will be complete */ - /* clean up and return */ - (void)deflateEnd(&strm); + /* clean up and return */ + (void)deflateEnd(&strm); fclose(source); fclose(dest); - return Z_OK; + return Z_OK; } /* Decompress from file source to file dest until stream ends or EOF. @@ -965,64 +965,64 @@ int unpackFile(const std::string &sourcef, const std::string &destf) if (!source || !dest) return 0; - int ret; - unsigned have; - z_stream strm; - unsigned char in[CHUNK]; - unsigned char out[CHUNK]; + int ret; + unsigned have; + z_stream strm; + unsigned char in[CHUNK]; + unsigned char out[CHUNK]; - /* allocate inflate state */ - strm.zalloc = Z_NULL; - strm.zfree = Z_NULL; - strm.opaque = Z_NULL; - strm.avail_in = 0; - strm.next_in = Z_NULL; - ret = inflateInit(&strm); - if (ret != Z_OK) - return ret; + /* allocate inflate state */ + strm.zalloc = Z_NULL; + strm.zfree = Z_NULL; + strm.opaque = Z_NULL; + strm.avail_in = 0; + strm.next_in = Z_NULL; + ret = inflateInit(&strm); + if (ret != Z_OK) + return ret; - /* decompress until deflate stream ends or end of file */ - do { - strm.avail_in = fread(in, 1, CHUNK, source); - if (ferror(source)) { - (void)inflateEnd(&strm); - return Z_ERRNO; - } - if (strm.avail_in == 0) - break; - strm.next_in = in; + /* decompress until deflate stream ends or end of file */ + do { + strm.avail_in = fread(in, 1, CHUNK, source); + if (ferror(source)) { + (void)inflateEnd(&strm); + return Z_ERRNO; + } + if (strm.avail_in == 0) + break; + strm.next_in = in; - /* run inflate() on input until output buffer not full */ - do { - strm.avail_out = CHUNK; - strm.next_out = out; - ret = inflate(&strm, Z_NO_FLUSH); - assert(ret != Z_STREAM_ERROR); /* state not clobbered */ - switch (ret) { - case Z_NEED_DICT: - ret = Z_DATA_ERROR; /* and fall through */ - case Z_DATA_ERROR: - case Z_MEM_ERROR: - (void)inflateEnd(&strm); - return ret; - } - have = CHUNK - strm.avail_out; - if (fwrite(out, 1, have, dest) != have || ferror(dest)) { - (void)inflateEnd(&strm); - return Z_ERRNO; - } - } while (strm.avail_out == 0); + /* run inflate() on input until output buffer not full */ + do { + strm.avail_out = CHUNK; + strm.next_out = out; + ret = inflate(&strm, Z_NO_FLUSH); + assert(ret != Z_STREAM_ERROR); /* state not clobbered */ + switch (ret) { + case Z_NEED_DICT: + ret = Z_DATA_ERROR; /* and fall through */ + case Z_DATA_ERROR: + case Z_MEM_ERROR: + (void)inflateEnd(&strm); + return ret; + } + have = CHUNK - strm.avail_out; + if (fwrite(out, 1, have, dest) != have || ferror(dest)) { + (void)inflateEnd(&strm); + return Z_ERRNO; + } + } while (strm.avail_out == 0); - /* done when inflate() says it's done */ - } while (ret != Z_STREAM_END); + /* done when inflate() says it's done */ + } while (ret != Z_STREAM_END); - /* clean up and return */ - (void)inflateEnd(&strm); + /* clean up and return */ + (void)inflateEnd(&strm); fclose(source); fclose(dest); - return ret == Z_STREAM_END ? Z_OK : Z_DATA_ERROR; + return ret == Z_STREAM_END ? Z_OK : Z_DATA_ERROR; } #endif diff --git a/BBGE/Base.h b/BBGE/Base.h index 2a4a404..c50ce40 100644 --- a/BBGE/Base.h +++ b/BBGE/Base.h @@ -29,10 +29,10 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. #undef min #undef max - #ifdef _MSC_VER - #define strtof (float)strtod - #define snprintf _snprintf - #endif + #ifdef _MSC_VER + #define strtof (float)strtod + #define snprintf _snprintf + #endif #endif #include "BBGECompileConfig.h" diff --git a/BBGE/Core.cpp b/BBGE/Core.cpp index 9c4f0aa..2a0093a 100644 --- a/BBGE/Core.cpp +++ b/BBGE/Core.cpp @@ -337,7 +337,7 @@ Core::Core(const std::string &filesystem, const std::string& extraDataDir, int n #if defined(BBGE_BUILD_UNIX) const char *envr = getenv("HOME"); if (envr == NULL) - envr = "."; // oh well. + envr = "."; // oh well. const std::string home(envr); createDir(home); // just in case. @@ -626,7 +626,7 @@ std::string Core::adjustFilenameCase(const char *_buf) if (strcmp(_buf, buf) != 0) { fprintf(stderr, "Corrected filename case: '%s' => '%s (%s)'\n", - _buf, buf, rc ? "found" : "not found"); + _buf, buf, rc ? "found" : "not found"); } #endif @@ -918,10 +918,10 @@ unsigned int Core::dbg_numRenderCalls = 0; #ifdef BBGE_BUILD_OPENGL_DYNAMIC #define GL_FUNC(ret,fn,params,call,rt) \ - extern "C" { \ - static ret (GLAPIENTRY *p##fn) params = NULL; \ - ret GLAPIENTRY fn params { ++Core::dbg_numRenderCalls; rt p##fn call; } \ - } + extern "C" { \ + static ret (GLAPIENTRY *p##fn) params = NULL; \ + ret GLAPIENTRY fn params { ++Core::dbg_numRenderCalls; rt p##fn call; } \ + } #include "OpenGLStubs.h" #undef GL_FUNC @@ -1001,7 +1001,7 @@ bool Core::initGraphicsLibrary(int width, int height, bool fullscreen, int vsync setWindowCaption(appName, appName); initIcon(); - // Create window + // Create window setSDLGLAttributes(); @@ -1242,22 +1242,22 @@ void Core::applyState(const std::string &state) #ifdef BBGE_BUILD_WINDOWS void centerWindow(HWND hwnd) { - int x, y; - HWND hwndDeskTop; - RECT rcWnd, rcDeskTop; - // Get a handle to the desktop window - hwndDeskTop = ::GetDesktopWindow(); - // Get dimension of desktop in a rect - ::GetWindowRect(hwndDeskTop, &rcDeskTop); - // Get dimension of main window in a rect - ::GetWindowRect(hwnd, &rcWnd); - // Find center of desktop + int x, y; + HWND hwndDeskTop; + RECT rcWnd, rcDeskTop; + // Get a handle to the desktop window + hwndDeskTop = ::GetDesktopWindow(); + // Get dimension of desktop in a rect + ::GetWindowRect(hwndDeskTop, &rcDeskTop); + // Get dimension of main window in a rect + ::GetWindowRect(hwnd, &rcWnd); + // Find center of desktop x = (rcDeskTop.right - rcDeskTop.left)/2; y = (rcDeskTop.bottom - rcDeskTop.top)/2; - x -= (rcWnd.right - rcWnd.left)/2; + x -= (rcWnd.right - rcWnd.left)/2; y -= (rcWnd.bottom - rcWnd.top)/2; - // Set top and left to center main window on desktop - ::SetWindowPos(hwnd, HWND_TOP, x, y, 0, 0, SWP_NOSIZE); + // Set top and left to center main window on desktop + ::SetWindowPos(hwnd, HWND_TOP, x, y, 0, 0, SWP_NOSIZE); } #endif @@ -1277,7 +1277,7 @@ bool Core::createWindow(int width, int height, int bits, bool fullscreen, std::s // No longer part of C/C++ standard #ifndef M_PI -#define M_PI 3.14159265358979323846 +#define M_PI 3.14159265358979323846 #endif void Core::setPixelScale(int pixelScaleX, int pixelScaleY) @@ -1337,7 +1337,7 @@ void Core::enable2DWide(int rx, int ry) static void bbgeOrtho2D(float left, float right, float bottom, float top) { - glOrtho(left, right, bottom, top, -1.0, 1.0); + glOrtho(left, right, bottom, top, -1.0, 1.0); } void Core::enable2D(int pixelScaleX, int pixelScaleY, bool forcePixelScale) @@ -1345,12 +1345,12 @@ void Core::enable2D(int pixelScaleX, int pixelScaleY, bool forcePixelScale) - GLint viewPort[4]; - glGetIntegerv(GL_VIEWPORT, viewPort); + GLint viewPort[4]; + glGetIntegerv(GL_VIEWPORT, viewPort); - glMatrixMode(GL_PROJECTION); + glMatrixMode(GL_PROJECTION); - glLoadIdentity(); + glLoadIdentity(); float vw=0,vh=0; @@ -1377,9 +1377,9 @@ void Core::enable2D(int pixelScaleX, int pixelScaleY, bool forcePixelScale) - glMatrixMode(GL_MODELVIEW); + glMatrixMode(GL_MODELVIEW); - glLoadIdentity(); + glLoadIdentity(); setupRenderPositionAndScale(); @@ -1482,7 +1482,7 @@ std::string getScreenshotFilename() std::ostringstream os; os << core->getUserDataFolder() << "/screenshots/screen" << screenshotNum << ".tga"; screenshotNum ++; - std::string str(os.str()); + std::string str(os.str()); if (!core->exists(str)) // keep going until we hit an unused filename. return str; } @@ -1535,7 +1535,7 @@ void Core::main(float runTime) float dt; float counter = 0; - int frames = 0; + int frames = 0; #if (!defined(_DEBUG) || defined(BBGE_BUILD_UNIX)) && defined(BBGE_BUILD_SDL) @@ -2729,9 +2729,9 @@ void Core::shutdown() void Core::instantQuit() { - SDL_Event event; - event.type = SDL_QUIT; - SDL_PushEvent(&event); + SDL_Event event; + event.type = SDL_QUIT; + SDL_PushEvent(&event); } bool Core::exists(const std::string &filename) diff --git a/BBGE/Core.h b/BBGE/Core.h index fc4e0dc..be5faa6 100644 --- a/BBGE/Core.h +++ b/BBGE/Core.h @@ -126,17 +126,17 @@ enum GameKeys KEY_RBRACKET, KEY_TILDE, - KEY_0, - KEY_1, - KEY_2, - KEY_3, - KEY_4, - KEY_5, - KEY_6, - KEY_7, - KEY_8, - KEY_9, - KEY_A, + KEY_0, + KEY_1, + KEY_2, + KEY_3, + KEY_4, + KEY_5, + KEY_6, + KEY_7, + KEY_8, + KEY_9, + KEY_A, KEY_B, KEY_C, KEY_D, @@ -188,21 +188,21 @@ enum GameKeys KEY_END, KEY_COMMA, KEY_SLASH, - KEY_F1, - KEY_F2, - KEY_F3, - KEY_F4, - KEY_F5, - KEY_F6, - KEY_F7, - KEY_F8, - KEY_F9, - KEY_F10, - KEY_F11, - KEY_F12, - KEY_F13, - KEY_F14, - KEY_F15, + KEY_F1, + KEY_F2, + KEY_F3, + KEY_F4, + KEY_F5, + KEY_F6, + KEY_F7, + KEY_F8, + KEY_F9, + KEY_F10, + KEY_F11, + KEY_F12, + KEY_F13, + KEY_F14, + KEY_F15, KEY_ESCAPE, KEY_ANYKEY, KEY_MAXARRAY diff --git a/BBGE/DebugFont.cpp b/BBGE/DebugFont.cpp index 4bf5b24..bc6777a 100644 --- a/BBGE/DebugFont.cpp +++ b/BBGE/DebugFont.cpp @@ -162,12 +162,12 @@ void DebugFont::setAlign(Align align) #include "../BBGE/Quad.h" DebugButton::DebugButton(int buttonID, DebugButtonReceiver *receiver, int bgWidth, int fsize, bool quitMain) - : RenderObject() - , label(0) - , quitMain(quitMain) - , buttonID(buttonID) - , highlight(0) - , receiver(receiver) + : RenderObject() + , label(0) + , quitMain(quitMain) + , buttonID(buttonID) + , highlight(0) + , receiver(receiver) { if (bgWidth == 0) bgWidth = 150; diff --git a/BBGE/Effects.cpp b/BBGE/Effects.cpp index eb25a91..936e272 100644 --- a/BBGE/Effects.cpp +++ b/BBGE/Effects.cpp @@ -80,10 +80,8 @@ void PostProcessingFX::render() FXTypes type = (FXTypes)i; switch(type) { - case FTX_NONE: - break; - case FXT_MAX: - break; + case FXT_MAX: + break; case FXT_RADIALBLUR: float windowW = core->getWindowWidth(); @@ -152,7 +150,7 @@ void PostProcessingFX::render() RenderObject::lastTextureApplied = 0; - break; + break; } glPopMatrix(); diff --git a/BBGE/Effects.h b/BBGE/Effects.h index debf7d0..9951831 100644 --- a/BBGE/Effects.h +++ b/BBGE/Effects.h @@ -26,7 +26,6 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. enum FXTypes { - FTX_NONE =-1, FXT_RADIALBLUR =0, FXT_MAX }; diff --git a/BBGE/Event.h b/BBGE/Event.h index 070c152..6330737 100644 --- a/BBGE/Event.h +++ b/BBGE/Event.h @@ -50,7 +50,7 @@ public: private: T *callee; - void (T::*callback)(void); + void (T::*callback)(void); }; template @@ -67,7 +67,7 @@ public: private: T *callee; - void (T::*callback)(Event *e); + void (T::*callback)(Event *e); }; #define EVENT(x,y) class x : public Event { public: void act(); }; x y; diff --git a/BBGE/Particles.h b/BBGE/Particles.h index 2b8a3a6..4673257 100644 --- a/BBGE/Particles.h +++ b/BBGE/Particles.h @@ -185,7 +185,7 @@ protected: struct ParticleInfluence { ParticleInfluence(Vector pos, float spd, float size, bool pull) - : pos(pos), size(size), spd(spd), pull(pull) + : pos(pos), size(size), spd(spd), pull(pull) {} ParticleInfluence() : size(0), spd(0), pull(false) {} Vector pos; diff --git a/BBGE/Precacher.cpp b/BBGE/Precacher.cpp index 84c46a3..b4d9b5c 100644 --- a/BBGE/Precacher.cpp +++ b/BBGE/Precacher.cpp @@ -141,7 +141,7 @@ void Precacher::precacheList(const std::string &list, void progressCallback()) t = t.substr(0,t.size()-1); debugLog("precache["+t+"]"); #endif - stringToLower(t); + stringToLower(t); precacheTex(t); } } diff --git a/BBGE/QuadTrail.cpp b/BBGE/QuadTrail.cpp index 24b2d16..5a669cb 100644 --- a/BBGE/QuadTrail.cpp +++ b/BBGE/QuadTrail.cpp @@ -22,10 +22,10 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. #include QuadTrail::QuadTrail(int maxPoints, float pointDist) - : RenderObject() - , numPoints(0) - , maxPoints(maxPoints) - , pointDist(pointDist) + : RenderObject() + , numPoints(0) + , maxPoints(maxPoints) + , pointDist(pointDist) { quadTrailAlphaEffect = QTAE_NORMAL; cull = false; diff --git a/BBGE/Shader.cpp b/BBGE/Shader.cpp index b9ff063..b793383 100644 --- a/BBGE/Shader.cpp +++ b/BBGE/Shader.cpp @@ -25,25 +25,25 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. #ifdef BBGE_BUILD_SHADERS // GL_ARB_shader_objects PFNGLCREATEPROGRAMOBJECTARBPROC glCreateProgramObjectARB = NULL; - PFNGLDELETEOBJECTARBPROC glDeleteObjectARB = NULL; - PFNGLUSEPROGRAMOBJECTARBPROC glUseProgramObjectARB = NULL; + PFNGLDELETEOBJECTARBPROC glDeleteObjectARB = NULL; + PFNGLUSEPROGRAMOBJECTARBPROC glUseProgramObjectARB = NULL; PFNGLCREATESHADEROBJECTARBPROC glCreateShaderObjectARB = NULL; - PFNGLSHADERSOURCEARBPROC glShaderSourceARB = NULL; - PFNGLCOMPILESHADERARBPROC glCompileShaderARB = NULL; + PFNGLSHADERSOURCEARBPROC glShaderSourceARB = NULL; + PFNGLCOMPILESHADERARBPROC glCompileShaderARB = NULL; PFNGLGETOBJECTPARAMETERIVARBPROC glGetObjectParameterivARB = NULL; - PFNGLATTACHOBJECTARBPROC glAttachObjectARB = NULL; - PFNGLGETINFOLOGARBPROC glGetInfoLogARB = NULL; - PFNGLLINKPROGRAMARBPROC glLinkProgramARB = NULL; + PFNGLATTACHOBJECTARBPROC glAttachObjectARB = NULL; + PFNGLGETINFOLOGARBPROC glGetInfoLogARB = NULL; + PFNGLLINKPROGRAMARBPROC glLinkProgramARB = NULL; PFNGLGETUNIFORMLOCATIONARBPROC glGetUniformLocationARB = NULL; - PFNGLGETACTIVEUNIFORMARBPROC glGetActiveUniformARB = NULL; - PFNGLUNIFORM1FVARBPROC glUniform1fvARB = NULL; - PFNGLUNIFORM2FVARBPROC glUniform2fvARB = NULL; - PFNGLUNIFORM3FVARBPROC glUniform3fvARB = NULL; - PFNGLUNIFORM4FVARBPROC glUniform4fvARB = NULL; - PFNGLUNIFORM1IVARBPROC glUniform1ivARB = NULL; - PFNGLUNIFORM2IVARBPROC glUniform2ivARB = NULL; - PFNGLUNIFORM3IVARBPROC glUniform3ivARB = NULL; - PFNGLUNIFORM4IVARBPROC glUniform4ivARB = NULL; + PFNGLGETACTIVEUNIFORMARBPROC glGetActiveUniformARB = NULL; + PFNGLUNIFORM1FVARBPROC glUniform1fvARB = NULL; + PFNGLUNIFORM2FVARBPROC glUniform2fvARB = NULL; + PFNGLUNIFORM3FVARBPROC glUniform3fvARB = NULL; + PFNGLUNIFORM4FVARBPROC glUniform4fvARB = NULL; + PFNGLUNIFORM1IVARBPROC glUniform1ivARB = NULL; + PFNGLUNIFORM2IVARBPROC glUniform2ivARB = NULL; + PFNGLUNIFORM3IVARBPROC glUniform3ivARB = NULL; + PFNGLUNIFORM4IVARBPROC glUniform4ivARB = NULL; #endif @@ -115,7 +115,7 @@ void Shader::staticInit() _useShaders = true; - end: + end: #endif if (_useShaders) @@ -228,7 +228,7 @@ void Shader::load(const std::string &file, const std::string &fragFile) this->vertFile = file; this->fragFile = fragFile; - char *vertCode = file.length() ? readFile(file) : NULL; + char *vertCode = file.length() ? readFile(file) : NULL; char *fragCode = fragFile.length() ? readFile(fragFile) : NULL; loadSrc(vertCode, fragCode); @@ -329,14 +329,14 @@ void Shader::_setUniform(Uniform *u) { switch(u->type) { - case GL_FLOAT: glUniform1fvARB(u->location, 1, u->data.f.f); break; - case GL_FLOAT_VEC2_ARB: glUniform2fvARB(u->location, 1, u->data.f.f); break; - case GL_FLOAT_VEC3_ARB: glUniform3fvARB(u->location, 1, u->data.f.f); break; - case GL_FLOAT_VEC4_ARB: glUniform4fvARB(u->location, 1, u->data.f.f); break; - case GL_INT: glUniform1ivARB(u->location, 1, u->data.i.i); break; - case GL_INT_VEC2_ARB: glUniform2ivARB(u->location, 1, u->data.i.i); break; - case GL_INT_VEC3_ARB: glUniform3ivARB(u->location, 1, u->data.i.i); break; - case GL_INT_VEC4_ARB: glUniform4ivARB(u->location, 1, u->data.i.i); break; + case GL_FLOAT: glUniform1fvARB(u->location, 1, u->data.f.f); break; + case GL_FLOAT_VEC2_ARB: glUniform2fvARB(u->location, 1, u->data.f.f); break; + case GL_FLOAT_VEC3_ARB: glUniform3fvARB(u->location, 1, u->data.f.f); break; + case GL_FLOAT_VEC4_ARB: glUniform4fvARB(u->location, 1, u->data.f.f); break; + case GL_INT: glUniform1ivARB(u->location, 1, u->data.i.i); break; + case GL_INT_VEC2_ARB: glUniform2ivARB(u->location, 1, u->data.i.i); break; + case GL_INT_VEC3_ARB: glUniform3ivARB(u->location, 1, u->data.i.i); break; + case GL_INT_VEC4_ARB: glUniform4ivARB(u->location, 1, u->data.i.i); break; } u->dirty = false; } @@ -432,10 +432,10 @@ void Shader::setInt(const char *name, int x, int y /* = 0 */, int z /* = 0 */, i if(unsigned(idx) >= uniforms.size()) return; Uniform& u = uniforms[idx]; - u.data.i.i[0] = x; - u.data.i.i[1] = y; - u.data.i.i[2] = z; - u.data.i.i[3] = w; + u.data.i.i[0] = x; + u.data.i.i[1] = y; + u.data.i.i[2] = z; + u.data.i.i[3] = w; u.dirty = true; uniformsDirty = true; #endif @@ -450,10 +450,10 @@ void Shader::setFloat(const char *name, float x, float y /* = 0 */, float z /* = if(unsigned(idx) >= uniforms.size()) return; Uniform& u = uniforms[idx]; - u.data.f.f[0] = x; - u.data.f.f[1] = y; - u.data.f.f[2] = z; - u.data.f.f[3] = w; + u.data.f.f[0] = x; + u.data.f.f[1] = y; + u.data.f.f[2] = z; + u.data.f.f[3] = w; u.dirty = true; uniformsDirty = true; #endif diff --git a/BBGE/Shader.h b/BBGE/Shader.h index 88a9179..9e112f0 100644 --- a/BBGE/Shader.h +++ b/BBGE/Shader.h @@ -62,14 +62,14 @@ private: bool dirty; // need to flush if true union { - struct si + struct si { int i[4]; - } i; - struct sf + } i; + struct sf { float f[4]; - } f; + } f; } data; char name[64]; diff --git a/BBGE/SkeletalSprite.cpp b/BBGE/SkeletalSprite.cpp index a057756..ba191af 100644 --- a/BBGE/SkeletalSprite.cpp +++ b/BBGE/SkeletalSprite.cpp @@ -365,16 +365,16 @@ void BoneCommand::run() if (e) e->stop(); } - break; + break; case AC_SET_PASS: b->setRenderPass(slot); break; case AC_RESET_PASS: b->setRenderPass(b->originalRenderPass); - break; - case AC_SEGS_START: - case AC_SEGS_STOP: - break; + break; + case AC_SEGS_START: + case AC_SEGS_STOP: + break; } } @@ -407,8 +407,8 @@ void AnimationLayer::playCurrentAnimation(int loop) void AnimationLayer::animate(const std::string &a, int loop) { - std::string animation = a; - stringToLower(animation); + std::string animation = a; + stringToLower(animation); bool played = false; for (int i = 0; i < s->animations.size(); i++) @@ -456,7 +456,7 @@ void AnimationLayer::enqueueAnimation(const std::string& anim, int loop) float AnimationLayer::transitionAnimate(std::string anim, float time, int loop) { - stringToLower(anim); + stringToLower(anim); float totalTime =0; if (createTransitionAnimation(anim, time)) { diff --git a/BBGE/SkeletalSprite.h b/BBGE/SkeletalSprite.h index 301a66c..f37ca3b 100644 --- a/BBGE/SkeletalSprite.h +++ b/BBGE/SkeletalSprite.h @@ -105,7 +105,7 @@ public: class BoneKeyframe { public: - BoneKeyframe() : idx(0), x(0), y(0), rot(0), sx(1), sy(1), doScale(0) {} + BoneKeyframe() : idx(0), x(0), y(0), rot(0), sx(1), sy(1), doScale(0) {} int idx, x, y, rot; float sx, sy; bool doScale; diff --git a/BBGE/SoundManager.cpp b/BBGE/SoundManager.cpp index 5c2e973..f387be6 100644 --- a/BBGE/SoundManager.cpp +++ b/BBGE/SoundManager.cpp @@ -24,13 +24,13 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. #include "Base.h" #ifdef BBGE_BUILD_FMOD_OPENAL_BRIDGE - #include "FmodOpenALBridge.h" + #include "FmodOpenALBridge.h" #else - #include - #include - #ifdef BBGE_BUILD_WINDOWS + #include + #include + #ifdef BBGE_BUILD_WINDOWS #pragma comment(lib, "fmodex_vc.lib") - #endif + #endif #endif @@ -72,7 +72,7 @@ namespace SoundCore struct FadeCh { public: - FadeCh() : c(0), v(1), s(1), to(0), d(-1) {} + FadeCh() : c(0), v(1), s(1), to(0), d(-1) {} FMOD::Channel *c; float v,s,to; int d; @@ -111,17 +111,17 @@ using namespace SoundCore; /* - TIPS: + TIPS: - 1. use F_CALLBACK. Do NOT force cast your own function to fmod's callback type. - 2. return FMOD_ERR_FILE_NOTFOUND in open as required. - 3. return number of bytes read in read callback. Do not get the size and count - around the wrong way in fread for example, this would return 1 instead of the number of bytes read. + 1. use F_CALLBACK. Do NOT force cast your own function to fmod's callback type. + 2. return FMOD_ERR_FILE_NOTFOUND in open as required. + 3. return number of bytes read in read callback. Do not get the size and count + around the wrong way in fread for example, this would return 1 instead of the number of bytes read. - QUESTIONS: + QUESTIONS: - 1. Why does fmod seek to the end and read? Because it is looking for ID3V1 tags. - Use FMOD_IGNORETAGS in System::createSound / System::createStream if you don't like this behaviour. + 1. Why does fmod seek to the end and read? Because it is looking for ID3V1 tags. + Use FMOD_IGNORETAGS in System::createSound / System::createStream if you don't like this behaviour. */ @@ -278,54 +278,54 @@ SoundManager::SoundManager(const std::string &defaultDevice) int channels = 128; - unsigned int version; - FMOD_SPEAKERMODE speakermode; - FMOD_CAPS caps; + unsigned int version; + FMOD_SPEAKERMODE speakermode; + FMOD_CAPS caps; debugLog("system::create"); result = FMOD::System_Create(&SoundCore::system); - if (checkError()) goto get_out; + if (checkError()) goto get_out; debugLog("getVersion"); - result = SoundCore::system->getVersion(&version); - if (checkError()) goto get_out; + result = SoundCore::system->getVersion(&version); + if (checkError()) goto get_out; - if (version < FMOD_VERSION) - { + if (version < FMOD_VERSION) + { char str[256]; - sprintf(str, "Error! You are using an old version of FMOD %08x. This program requires %08x\n", version, FMOD_VERSION); + sprintf(str, "Error! You are using an old version of FMOD %08x. This program requires %08x\n", version, FMOD_VERSION); debugLog(str); goto get_out; - } + } debugLog("driver caps"); - result = SoundCore::system->getDriverCaps(0, &caps, 0, 0, &speakermode); - if (checkError()) goto get_out; + result = SoundCore::system->getDriverCaps(0, &caps, 0, 0, &speakermode); + if (checkError()) goto get_out; debugLog("set speaker mode"); - result = SoundCore::system->setSpeakerMode(speakermode); /* Set the user selected speaker mode. */ + result = SoundCore::system->setSpeakerMode(speakermode); /* Set the user selected speaker mode. */ if (checkError()) goto get_out; debugLog("check caps"); - if (caps & FMOD_CAPS_HARDWARE_EMULATED) /* The user has the 'Acceleration' slider set to off! This is really bad for latency!. */ - { /* You might want to warn the user about this. */ + if (caps & FMOD_CAPS_HARDWARE_EMULATED) /* The user has the 'Acceleration' slider set to off! This is really bad for latency!. */ + { /* You might want to warn the user about this. */ debugLog("acceleration slider is off"); - result = SoundCore::system->setDSPBufferSize(1024, 10); /* At 48khz, the latency between issuing an fmod command and hearing it will now be about 213ms. */ - if (checkError()) goto get_out; - } + result = SoundCore::system->setDSPBufferSize(1024, 10); /* At 48khz, the latency between issuing an fmod command and hearing it will now be about 213ms. */ + if (checkError()) goto get_out; + } debugLog("init"); - result = SoundCore::system->init(channels, FMOD_INIT_NORMAL, 0); /* Replace with whatever channel count and flags you use! */ - if (result == FMOD_ERR_OUTPUT_CREATEBUFFER) /* Ok, the speaker mode selected isn't supported by this soundcard. Switch it back to stereo... */ - { + result = SoundCore::system->init(channels, FMOD_INIT_NORMAL, 0); /* Replace with whatever channel count and flags you use! */ + if (result == FMOD_ERR_OUTPUT_CREATEBUFFER) /* Ok, the speaker mode selected isn't supported by this soundcard. Switch it back to stereo... */ + { debugLog("err_output_createbuffer, speaker mode"); result = SoundCore::system->setSpeakerMode(FMOD_SPEAKERMODE_STEREO); - if (checkError()) goto get_out; + if (checkError()) goto get_out; debugLog("init 2"); - result = SoundCore::system->init(channels, FMOD_INIT_NORMAL, 0); /* Replace with whatever channel count and flags you use! */ + result = SoundCore::system->init(channels, FMOD_INIT_NORMAL, 0); /* Replace with whatever channel count and flags you use! */ if (checkError()) goto get_out; - } + } #ifdef BBGE_BUILD_FMOD_OPENAL_BRIDGE SoundCore::system->getNumChannels(&channels); @@ -335,7 +335,7 @@ SoundManager::SoundManager(const std::string &defaultDevice) debugLog("set file system"); result = SoundCore::system->setFileSystem(myopen, myclose, myread, myseek, 2048); - if (checkError()) goto get_out; + if (checkError()) goto get_out; debugLog("create channel group vox"); result = SoundCore::system->createChannelGroup("vox", &group_vox); @@ -410,9 +410,9 @@ void SoundManager::toggleEffectMusic(SoundEffectType effect, bool on) dspFlange->remove(); } break; - case SFX_NONE: - case SFX_MAX: - break; + case SFX_NONE: + case SFX_MAX: + break; } } diff --git a/BBGE/SoundManager.h b/BBGE/SoundManager.h index 8bc23fd..4230a98 100644 --- a/BBGE/SoundManager.h +++ b/BBGE/SoundManager.h @@ -84,8 +84,8 @@ enum SoundLoadType struct PlaySfx { - PlaySfx() : handle(0), vol(1), time(0), freq(1), loops(0), priority(0.5), - maxdist(0), fade(SFT_NONE), x(0), y(0), relative(true), positional(false) {} + PlaySfx() : handle(0), vol(1), time(0), freq(1), loops(0), priority(0.5), + maxdist(0), fade(SFT_NONE), x(0), y(0), relative(true), positional(false) {} std::string name; intptr_t handle; diff --git a/BBGE/Texture.cpp b/BBGE/Texture.cpp index 67ad512..bd57538 100644 --- a/BBGE/Texture.cpp +++ b/BBGE/Texture.cpp @@ -230,7 +230,7 @@ bool Texture::load(std::string file) size_t pos = file.find_last_of('.'); - if (pos != std::string::npos) + if (pos != std::string::npos) { // make sure this didn't catch the '.' in /home/username/.Aquaria/* --ryan. const std::string userdata = core->getUserDataFolder(); @@ -526,8 +526,8 @@ ImageTGA *Texture::TGAloadMem(void *mem, int size) // files are stored as BGR instead of RGB (or use GL_BGR_EXT verses GL_RGB) for(i = 0; i < stride; i += channels) { - int temp = pLine[i]; - pLine[i] = pLine[i + 2]; + int temp = pLine[i]; + pLine[i] = pLine[i + 2]; pLine[i + 2] = temp; } } @@ -679,8 +679,8 @@ ImageTGA *Texture::TGAloadMem(void *mem, int size) // Fill in our tImageTGA structure to pass back pImageData->channels = channels; - pImageData->sizeX = width; - pImageData->sizeY = height; + pImageData->sizeX = width; + pImageData->sizeY = height; // Return the TGA data (remember, you must free this data after you are done) return pImageData; From 585489611b6866fed0f08e818b23999732cfe3a2 Mon Sep 17 00:00:00 2001 From: Valentin Ochs Date: Thu, 12 Jan 2017 23:35:10 +0100 Subject: [PATCH 3/5] [foodholders] Foodholder changes - Add convenience functions toggleValid() and isValid() to wrap around the alpha/alphaMod members - Fix bug #37 that allows cooking with the third slot at all times --- Aquaria/Game.cpp | 32 +++++++++++++++++++------------- Aquaria/Game.h | 2 ++ 2 files changed, 21 insertions(+), 13 deletions(-) diff --git a/Aquaria/Game.cpp b/Aquaria/Game.cpp index 19ce959..dae84d0 100644 --- a/Aquaria/Game.cpp +++ b/Aquaria/Game.cpp @@ -212,6 +212,11 @@ bool FoodHolder::isEmpty() return (foodHolderIngredient == 0); } +bool FoodHolder::isValid() +{ + return this->alpha.x > 0 && this->alphaMod > 0; +} + IngredientData *FoodHolder::getIngredient() { return foodHolderIngredient; @@ -264,6 +269,10 @@ void FoodHolder::setIngredient(IngredientData *i, bool effects) } } +void FoodHolder::toggleValid(bool v) { + this->alpha = this->alphaMod = (float) v; +} + void Game::enqueuePreviewRecipe() { enqueuedPreviewRecipe = 1; @@ -477,7 +486,7 @@ void FoodSlot::moveRight() for (int i = foodHolders.size()-1; i >= 0; i--) { - if (foodHolders[i]->alpha.x > 0 && foodHolders[i]->alphaMod > 0 && foodHolders[i]->isEmpty() && !foodHolders[i]->isTrash()) + if (foodHolders[i]->isValid() && foodHolders[i]->isEmpty() && !foodHolders[i]->isTrash()) { foodHolders[i]->setIngredient(ingredient); inCookSlot = true; @@ -564,7 +573,7 @@ void FoodSlot::onUpdate(float dt) break; //return; } - else if (foodHolders[i]->isEmpty()) + else if (foodHolders[i]->isEmpty() && foodHolders[i]->isValid()) { foodHolders[i]->setIngredient(ingredient); inCookSlot = true; @@ -3746,7 +3755,7 @@ void Game::createInGameMenu() for (i = 0; i < foodHolders.size(); i++) { foodHolders[i] = new FoodHolder(i); - foodHolders[i]->alpha = 0; + foodHolders[i]->toggleValid(false); float angle = (float(holders)/float(foodHolders.size()))*PI*2; foodHolders[i]->position = rightCenter + Vector(sinf(angle), cosf(angle))*radius; @@ -3833,7 +3842,7 @@ void Game::createInGameMenu() foodHolders.resize(4); foodHolders[3] = new FoodHolder(-1, true); - foodHolders[3]->alpha = 0; + foodHolders[3]->toggleValid(false); foodHolders[3]->position = rightCenter + Vector(96, 150); menuBg->addChild(foodHolders[3], PM_POINTER); @@ -6079,7 +6088,7 @@ void Game::action(int id, int state) int trashIndex = -1; for (int i = 0; i < foodHolders.size(); i++) { - if (foodHolders[i]->alpha.x > 0 && foodHolders[i]->alphaMod > 0 && foodHolders[i]->isTrash()) + if (foodHolders[i]->isValid() && foodHolders[i]->isTrash()) { trashIndex = i; break; @@ -7394,7 +7403,7 @@ void Game::onCook() longAnim = false; for (int i = foodHolders.size()-1; i >= 0; i--) - if (foodHolders[i]->alpha.x > 0 && !foodHolders[i]->isEmpty() && !foodHolders[i]->isTrash()) + if (foodHolders[i]->isValid() && !foodHolders[i]->isEmpty() && !foodHolders[i]->isTrash()) foodHolders[i]->animateLid(true, longAnim); //dsq->main(0.2); @@ -7482,7 +7491,7 @@ void Game::onCook() dsq->sound->playSfx("Cook"); for (int i = 0; i < foodHolders.size(); i++) - if (foodHolders[i]->alpha.x > 0 && !foodHolders[i]->isTrash()) + if (foodHolders[i]->isValid() && !foodHolders[i]->isTrash()) foodHolders[i]->animateLid(false); dsq->spawnParticleEffect("cook-food", Vector(575,250), 0, 0, LR_HUD3, 1); @@ -9066,10 +9075,7 @@ void Game::toggleFoodMenu(bool f) for (int i = 0; i < foodHolders.size(); i++) { - if (f) - foodHolders[i]->alpha = 1; - else - foodHolders[i]->alpha = 0; + foodHolders[i]->toggleValid(f); } if (f) @@ -9082,11 +9088,11 @@ void Game::toggleFoodMenu(bool f) && p->isCoordinateInside(dsq->game->avatar->position))) { //cook->alpha = 1; - foodHolders[0]->alpha = 1; + foodHolders[0]->toggleValid(true); } else { - foodHolders[0]->alpha = 0; + foodHolders[0]->toggleValid(false); } } } diff --git a/Aquaria/Game.h b/Aquaria/Game.h index 526a1d8..e7c07e4 100644 --- a/Aquaria/Game.h +++ b/Aquaria/Game.h @@ -283,7 +283,9 @@ public: bool isEmpty(); bool isTrash(); + bool isValid(); void setIngredient(IngredientData *i, bool effects=true); + void toggleValid(bool v); void dropFood(); IngredientData *getIngredient(); void animateLid(bool down, bool longAnim=true); From ffa26e4105c7cc216cfd7b9e4d726e72fddb1603 Mon Sep 17 00:00:00 2001 From: fgenesis Date: Thu, 12 Jan 2017 23:52:59 +0100 Subject: [PATCH 4/5] Update inlcuded ttvfs --- ExternalLibs/ttvfs/CMakeLists.txt | 7 ++ ExternalLibs/ttvfs/VFSDebug.cpp | 72 ++++++++++++ ExternalLibs/ttvfs/VFSDebug.h | 22 ++++ ExternalLibs/ttvfs/VFSDefines.h | 39 +++++-- ExternalLibs/ttvfs/VFSDir.cpp | 23 ++-- ExternalLibs/ttvfs/VFSDir.h | 36 ++++-- ExternalLibs/ttvfs/VFSDirInternal.cpp | 6 - ExternalLibs/ttvfs/VFSFile.cpp | 2 +- ExternalLibs/ttvfs/VFSFile.h | 5 +- ExternalLibs/ttvfs/VFSFileFuncs.cpp | 4 +- ExternalLibs/ttvfs/VFSInternal.h | 6 + ExternalLibs/ttvfs/VFSRefcounted.h | 1 + ExternalLibs/ttvfs/VFSRoot.cpp | 115 +++++++++----------- ExternalLibs/ttvfs/VFSRoot.h | 96 +++++++++++----- ExternalLibs/ttvfs_cfileapi/CMakeLists.txt | 4 + ExternalLibs/ttvfs_cfileapi/ttvfs_stdio.cpp | 6 - ExternalLibs/ttvfs_cfileapi/ttvfs_stdio.h | 7 +- ExternalLibs/ttvfs_zip/CMakeLists.txt | 8 ++ ExternalLibs/ttvfs_zip/VFSDirZip.cpp | 2 +- ExternalLibs/ttvfs_zip/VFSFileZip.cpp | 11 +- ExternalLibs/ttvfs_zip/miniz.c | 2 +- ExternalLibs/ttvfs_zip/ttvfs_zip.h | 6 + 22 files changed, 327 insertions(+), 153 deletions(-) create mode 100644 ExternalLibs/ttvfs/VFSDebug.cpp create mode 100644 ExternalLibs/ttvfs/VFSDebug.h create mode 100644 ExternalLibs/ttvfs_zip/ttvfs_zip.h diff --git a/ExternalLibs/ttvfs/CMakeLists.txt b/ExternalLibs/ttvfs/CMakeLists.txt index d25bf2c..1c7c5fc 100644 --- a/ExternalLibs/ttvfs/CMakeLists.txt +++ b/ExternalLibs/ttvfs/CMakeLists.txt @@ -4,6 +4,8 @@ set(ttvfs_SRC VFSArchiveLoader.h VFSBase.cpp VFSBase.h + VFSDebug.cpp + VFSDebug.h VFSDefines.h VFSDir.cpp VFSDir.h @@ -28,3 +30,8 @@ set(ttvfs_SRC ) add_library(ttvfs ${ttvfs_SRC}) + +install(TARGETS ttvfs DESTINATION lib) + +install(DIRECTORY ./ DESTINATION include/ttvfs + FILES_MATCHING PATTERN "*.h") diff --git a/ExternalLibs/ttvfs/VFSDebug.cpp b/ExternalLibs/ttvfs/VFSDebug.cpp new file mode 100644 index 0000000..9703ba0 --- /dev/null +++ b/ExternalLibs/ttvfs/VFSDebug.cpp @@ -0,0 +1,72 @@ +#include "VFSDebug.h" +#include "VFSInternal.h" +#include "VFSRoot.h" +#include "VFSDir.h" +#include "VFSFile.h" +#include "VFSTools.h" + +#include +#include + + +VFS_NAMESPACE_START +namespace debug { + + +struct _DbgParams +{ + _DbgParams(std::ostream& os_, const std::string& path, const std::string& sp_) + : os(os_), mypath(path), sp(sp_) {} + + std::ostream& os; + std::string mypath; + const std::string& sp; + std::set dirnames; +}; + +static void _DumpFile(File *vf, void *user) +{ + _DbgParams& p = *((_DbgParams*)user); + p.os << p.sp << " F:" << vf->fullname() << " [" << vf->getType() << ", ref " << vf->getRefCount() << ", 0x" << vf << "]" << std::endl; +} + + +static void _DumpDir(DirBase *vd, void *user) +{ + _DbgParams& p = *((_DbgParams*)user); + if(!(vd->fullname()[0] == '/' && vd->fullnameLen() == 1)) // don't recurse down the root dir. + p.dirnames.insert(vd->name()); + p.os << p.sp << "D : " << vd->fullname() << " [" << vd->getType() << ", ref " << vd->getRefCount() << ", 0x" << vd << "]" << std::endl; +} + +static void _DumpTree(_DbgParams& p, Root& vfs, int level) +{ + p.os << ">> [" << p.mypath << "]" << std::endl; + + vfs.ForEach(p.mypath.c_str(), _DumpFile, _DumpDir); + + if(!level) + return; + + std::string sub = p.sp + " "; + for(std::set::iterator it = p.dirnames.begin(); it != p.dirnames.end(); ++it) + { + _DbgParams recP(p.os, joinPath(p.mypath, it->c_str()), sub); + _DumpTree(recP, vfs, level - 1); + } +} + +void dumpTree(Root& root, std::ostream& os, const char *path /* = NULL */, int level /* = -1 */) +{ + if(!path) + path = ""; + os << ">>> FILE TREE DUMP <<<" << std::endl; + _DbgParams recP(os, path, ""); + _DumpTree(recP, root, level); +} + + +} // end namespace debug + +VFS_NAMESPACE_END + diff --git a/ExternalLibs/ttvfs/VFSDebug.h b/ExternalLibs/ttvfs/VFSDebug.h new file mode 100644 index 0000000..e5da11d --- /dev/null +++ b/ExternalLibs/ttvfs/VFSDebug.h @@ -0,0 +1,22 @@ +#ifndef TTVFS_DEBUG_H +#define TTVFS_DEBUG_H + +#include "VFSDefines.h" +#include + +VFS_NAMESPACE_START +class Root; + +namespace debug { + +/** Dump tree structure with debug information to a stream. + path specifies the subdir to dump; use "" or NULL to dump the whole tree. + Set level to >= 0 to limit the recursion depth. + Level < 0 recurses as deep as the tree goes. */ +void dumpTree(Root& root, std::ostream& os, const char *path = NULL, int level = -1); + + +} // end namespace debug +VFS_NAMESPACE_END + +#endif diff --git a/ExternalLibs/ttvfs/VFSDefines.h b/ExternalLibs/ttvfs/VFSDefines.h index d0cf3cc..d8fcfaa 100644 --- a/ExternalLibs/ttvfs/VFSDefines.h +++ b/ExternalLibs/ttvfs/VFSDefines.h @@ -28,30 +28,39 @@ #define VFS_NAMESPACE_END } -#if !defined(_MSC_VER) -# include +// Important that this is included outside of the namespace. +// Note that stdint.h is intentionally NOT included if possible, +// because on gcc it pulls in features.h, which in turn checks for +// _FILE_OFFSET_BITS presence. That means to enable 64bit file I/O, +// _FILE_OFFSET_BITS would have to be defined here. +// For the sake of not polluting the includer, use other means to define +// a 64 bit type. +#if !defined(_MSC_VER) && !defined(__GNUC__) +# include // Hope it works. #endif VFS_NAMESPACE_START -#ifdef VFS_LARGEFILE_SUPPORT -# if defined(_MSC_VER) - typedef __int64 vfspos; -# else -# include - typedef int64_t vfspos; -# endif +// vfspos type (signed 64bit integer if possible, 32bit otherwise) +#if defined(_MSC_VER) + typedef __int64 vfspos; +#elif defined(__GNUC__) + __extension__ // suppress warnings about long long + typedef long long int vfspos; +#elif defined(VFS_LARGEFILE_SUPPORT) + // fallback using stdint. h, but only if necessary + typedef int64_t vfspos; #else - typedef unsigned int vfspos; + // If all else fails + typedef long int vfspos; // what fseek() uses, no guarantees whether 64 or 32 bits #endif #if defined(_MSC_VER) || defined(__MINGW32__) || defined(__MINGW64__) # define VFS_STRICMP _stricmp - static const vfspos npos = vfspos(-1i64); #else # define VFS_STRICMP strcasecmp - static const vfspos npos = vfspos(-1LL); #endif +static const vfspos npos = ~vfspos(0); typedef void (*delete_func)(void *); @@ -63,6 +72,12 @@ struct _AbiCheck int nocase; }; +class File; +class DirBase; + +typedef void (*FileEnumCallback)(File *vf, void *user); +typedef void (*DirEnumCallback)(DirBase *vd, void *user); + VFS_NAMESPACE_END diff --git a/ExternalLibs/ttvfs/VFSDir.cpp b/ExternalLibs/ttvfs/VFSDir.cpp index 9809fa3..dc7fa3a 100644 --- a/ExternalLibs/ttvfs/VFSDir.cpp +++ b/ExternalLibs/ttvfs/VFSDir.cpp @@ -59,7 +59,6 @@ std::pair DirBase::_getDirEx(const char *subdir, const char return std::make_pair(this, this); DirBase *ret = NULL; - DirBase *last = NULL; char *slashpos = (char *)strchr(subdir, '/'); // if there is a '/' in the string, descend into subdir and continue there @@ -239,12 +238,13 @@ void Dir::forEachDir(DirEnumCallback f, void *user /* = NULL */, bool safe /* = } - bool Dir::add(File *f) { - if(!f) - return false; + return _addRecursiveSkip(f, 0); +} +bool Dir::_addSingle(File *f) +{ Files::iterator it = _files.find(f->name()); if(it != _files.end()) @@ -260,11 +260,8 @@ bool Dir::add(File *f) return true; } -bool Dir::addRecursive(File *f, size_t skip /* = 0 */) +bool Dir::_addRecursiveSkip(File *f, size_t skip /* = 0 */) { - if(!f) - return false; - Dir *vdir = this; if(f->fullnameLen() - f->nameLen() > skip) { @@ -285,7 +282,7 @@ bool Dir::addRecursive(File *f, size_t skip /* = 0 */) } } - return vdir->add(f); + return vdir->_addSingle(f); } void Dir::clearGarbage() @@ -374,4 +371,12 @@ void DiskDir::load() } } + +// ----- MemDir start here ----- + +MemDir *MemDir::createNew(const char *dir) const +{ + return new MemDir(dir); +} + VFS_NAMESPACE_END diff --git a/ExternalLibs/ttvfs/VFSDir.h b/ExternalLibs/ttvfs/VFSDir.h index 395fa90..8e6a33d 100644 --- a/ExternalLibs/ttvfs/VFSDir.h +++ b/ExternalLibs/ttvfs/VFSDir.h @@ -59,9 +59,6 @@ class DirView; class File; class VFSLoader; -typedef void (*FileEnumCallback)(File *vf, void *user); -typedef void (*DirEnumCallback)(DirBase *vd, void *user); - // Avoid using std::string as key. // The file names are known to remain constant during each object's lifetime, @@ -125,14 +122,12 @@ public: virtual ~Dir(); /** Adds a file directly to this directory, allows any name. - If another file with this name already exists, drop the old one out. - Returns whether the file was actually added (false if the same file already existed) */ + If the file name contains a path, descend the tree to the target dir. + Not-existing subdirs are created on the way. + If another file with this name already exists, drop the old one out. + Returns whether the file was actually added (false if the same file already existed) */ bool add(File *f); - /** Like add(), but if the file name contains a path, descend the tree to the target dir. - Not-existing subdirs are created on the way. */ - bool addRecursive(File *f, size_t skip = 0); - /** Enumerate directory with given path. Clears previously loaded entries. */ virtual void load() = 0; @@ -146,9 +141,12 @@ public: File *getFileByName(const char *fn, bool lazyLoad = true); File *getFileFromSubdir(const char *subdir, const char *file); + bool _addRecursiveSkip(File *f, size_t skip = 0); protected: + bool _addSingle(File *f); + inline VFSLoader *getLoader() const { return _loader; } Files _files; @@ -162,9 +160,23 @@ class DiskDir : public Dir public: DiskDir(const char *path, VFSLoader *ldr); virtual ~DiskDir() {}; - virtual void load(); - virtual DiskDir *createNew(const char *dir) const; - virtual const char *getType() const { return "DiskDir"; } + + // virtual overloads + void load(); + DiskDir *createNew(const char *dir) const; + const char *getType() const { return "DiskDir"; } +}; + +class MemDir : public Dir +{ +public: + MemDir(const char *fullpath) : Dir(fullpath, NULL) {} + virtual ~MemDir() {} + + // virtual overloads + void load() {} + MemDir *createNew(const char *dir) const; + const char *getType() const { return "MemDir"; } }; VFS_NAMESPACE_END diff --git a/ExternalLibs/ttvfs/VFSDirInternal.cpp b/ExternalLibs/ttvfs/VFSDirInternal.cpp index 01a3c0a..96cfa28 100644 --- a/ExternalLibs/ttvfs/VFSDirInternal.cpp +++ b/ExternalLibs/ttvfs/VFSDirInternal.cpp @@ -106,12 +106,6 @@ void InternalDir::forEachFile(FileEnumCallback f, void *user /* = NULL */, bool f(it->second, user); } -static void _iterDirs(Dirs &m, DirEnumCallback f, void *user) -{ - for(Dirs::iterator it = m.begin(); it != m.end(); ++it) - f(it->second.content(), user); -} - void InternalDir::forEachDir(DirEnumCallback f, void *user /* = NULL */, bool safe /* = false */) { for(MountedDirs::reverse_iterator it = _mountedDirs.rbegin(); it != _mountedDirs.rend(); ++it) diff --git a/ExternalLibs/ttvfs/VFSFile.cpp b/ExternalLibs/ttvfs/VFSFile.cpp index 6ededee..86437d2 100644 --- a/ExternalLibs/ttvfs/VFSFile.cpp +++ b/ExternalLibs/ttvfs/VFSFile.cpp @@ -95,7 +95,7 @@ vfspos DiskFile::size() // ------------- MemFile ----------------------- MemFile::MemFile(const char *name, void *buf, unsigned int size, delete_func delfunc /* = NULL */, DeleteMode delmode /* = ON_CLOSE */) -: File(name), _pos(0), _size(size), _buf(buf), _delfunc(delfunc), _delmode(delmode) +: File(name), _buf(buf), _pos(0), _size(size), _delfunc(delfunc), _delmode(delmode) { } diff --git a/ExternalLibs/ttvfs/VFSFile.h b/ExternalLibs/ttvfs/VFSFile.h index 69ed644..16df724 100644 --- a/ExternalLibs/ttvfs/VFSFile.h +++ b/ExternalLibs/ttvfs/VFSFile.h @@ -88,13 +88,14 @@ public: ON_CLOSE, ON_DESTROY }; - /* Creates a virtual file from a memory buffer. The buffer is passed as-is, + /** Creates a virtual file from a memory buffer. The buffer is passed as-is, so for text files you should make sure it ends with a \0 character. A deletor function can be passed optionally, that the buffer will be passed to when the memory file is destroyed. Pass NULL or leave away to keep the buffer alive. */ MemFile(const char *name, void *buf, unsigned int size, delete_func delfunc = NULL, DeleteMode delmode = ON_CLOSE); virtual ~MemFile(); - virtual bool open(const char *mode = NULL) { return true; } + /** In order not to modify the passed buffer, MemFile does NOT respect the mode parameter. */ + virtual bool open(const char *mode = NULL) { return !!_buf; } virtual bool isopen() const { return !!_buf; } // always open virtual bool iseof() const { return _pos >= _size; } virtual void close(); diff --git a/ExternalLibs/ttvfs/VFSFileFuncs.cpp b/ExternalLibs/ttvfs/VFSFileFuncs.cpp index 183bf75..9357efc 100644 --- a/ExternalLibs/ttvfs/VFSFileFuncs.cpp +++ b/ExternalLibs/ttvfs/VFSFileFuncs.cpp @@ -8,10 +8,12 @@ VFS_NAMESPACE_START // Compile time assertion to make sure things work as expected #if defined(VFS_LARGEFILE_SUPPORT) -static void _dummy_() +TTVFS_UNUSED static void _dummy_() { + // Ensure vfspos is 64 bits in largefile mode. switch(0) { case 0:; case 4: case sizeof(vfspos): ; } #ifndef _MSC_VER + // Ensure the _FILE_OFFSET_BITS=64 setting in VFSInternal.h is effective switch(0) { case 0:; case 4: case sizeof(off_t): ; } #endif } diff --git a/ExternalLibs/ttvfs/VFSInternal.h b/ExternalLibs/ttvfs/VFSInternal.h index 54ec5f2..dc62253 100644 --- a/ExternalLibs/ttvfs/VFSInternal.h +++ b/ExternalLibs/ttvfs/VFSInternal.h @@ -37,6 +37,12 @@ # endif #endif +#ifdef __GNUC__ +# define TTVFS_UNUSED __attribute__((unused)) +#else +# define TTVFS_UNUSED +#endif + // These are used for small, temporary memory allocations that can remain on the stack. // If alloca is available, this is the preferred way. #include diff --git a/ExternalLibs/ttvfs/VFSRefcounted.h b/ExternalLibs/ttvfs/VFSRefcounted.h index 6d53a64..baf0b1e 100644 --- a/ExternalLibs/ttvfs/VFSRefcounted.h +++ b/ExternalLibs/ttvfs/VFSRefcounted.h @@ -37,6 +37,7 @@ public: { int val = s_getRef(_refcount); assert(val == 0 && "Object was deleted with refcount != 0"); + (void)val; } inline void incref() diff --git a/ExternalLibs/ttvfs/VFSRoot.cpp b/ExternalLibs/ttvfs/VFSRoot.cpp index f35aea5..f6854d2 100644 --- a/ExternalLibs/ttvfs/VFSRoot.cpp +++ b/ExternalLibs/ttvfs/VFSRoot.cpp @@ -1,8 +1,6 @@ // VFSRoot.cpp - glues it all together and makes use simple // For conditions of distribution and use, see copyright notice in VFS.h -#include - #include "VFSInternal.h" #include "VFSRoot.h" #include "VFSTools.h" @@ -13,9 +11,6 @@ #include "VFSArchiveLoader.h" #include "VFSDirView.h" -//#include -#include - #ifdef _DEBUG # include # define DEBUG_ASSERT(x) assert(x) @@ -64,11 +59,12 @@ void Root::Clear() loaders.clear(); archLdrs.clear(); + loadersInfo.clear(); } void Root::Mount(const char *src, const char *dest) { - AddVFSDir(GetDir(src, true), dest); + return AddVFSDir(GetDir(src, true), dest); } void Root::AddVFSDir(DirBase *dir, const char *subdir /* = NULL */) @@ -79,26 +75,54 @@ void Root::AddVFSDir(DirBase *dir, const char *subdir /* = NULL */) into->_addMountDir(dir); } -bool Root::Unmount(const char *src, const char *dest) +bool Root::RemoveVFSDir(DirBase *dir, const char *subdir /* = NULL */) { - DirBase *vdsrc = GetDir(src, false); - InternalDir *vddest = safecast(GetDir(dest, false)); - if(!vdsrc || !vddest) + if(!subdir) + subdir = dir->fullname(); + InternalDir *vddest = safecast(GetDir(subdir, false)); + if(!vddest) return false; - vddest->_removeMountDir(vdsrc); + vddest->_removeMountDir(dir); return true; } -void Root::AddLoader(VFSLoader *ldr, const char *path /* = NULL */) +bool Root::Unmount(const char *src, const char *dest) { - loaders.push_back(ldr); - AddVFSDir(ldr->getRoot(), path); + DirBase *vdsrc = GetDir(src, false); + if(!vdsrc) + return false; + + return RemoveVFSDir(vdsrc, dest); } -void Root::AddArchiveLoader(VFSArchiveLoader *ldr) +int Root::AddLoader(VFSLoader *ldr, const char *path /* = NULL */) { + DEBUG_ASSERT(ldr != NULL); + loaders.push_back(ldr); + loadersInfo.push_back(path); + AddVFSDir(ldr->getRoot(), path); + return (int)(loaders.size() - 1); +} + +void Root::RemoveLoader(int index, const char *path /* = NULL */) +{ + VFSLoader *ldr = loaders[index]; + RemoveVFSDir(ldr->getRoot(), loadersInfo[index].getPath()); + loaders.erase(loaders.begin() + index); + loadersInfo.erase(loadersInfo.begin() + index); +} + +int Root::AddArchiveLoader(VFSArchiveLoader *ldr) +{ + DEBUG_ASSERT(ldr != NULL); archLdrs.push_back(ldr); + return (int)(archLdrs.size() - 1); +} + +void Root::RemoveArchiveLoader(int index) +{ + archLdrs.erase(archLdrs.begin() + index); } Dir *Root::AddArchive(const char *arch, void *opaque /* = NULL */) @@ -133,7 +157,7 @@ inline static File *VFSHelper_GetFileByLoader(VFSLoader *ldr, const char *fn, co return NULL; File *vf = ldr->Load(fn, unmangled); if(vf) - ldr->getRoot()->addRecursive(vf); + ldr->getRoot()->add(vf); return vf; } @@ -217,62 +241,21 @@ void Root::ClearGarbage() merged->clearGarbage(); } - - -// DEBUG STUFF - -struct _DbgParams +bool Root::ForEach(const char *path, FileEnumCallback fileCallback /* = NULL */, DirEnumCallback dirCallback /* = NULL */, + void *user /* = NULL */, bool safe /* = false */) { - _DbgParams(std::ostream& os_, const std::string& path, const std::string& sp_) - : os(os_), mypath(path), sp(sp_) {} - - std::ostream& os; - std::string mypath; - const std::string& sp; - std::set dirnames; -}; - -static void _DumpFile(File *vf, void *user) -{ - _DbgParams& p = *((_DbgParams*)user); - p.os << p.sp << " F:" << vf->fullname() << " [" << vf->getType() << ", ref " << vf->getRefCount() << ", 0x" << vf << "]" << std::endl; -} - - -static void _DumpDir(DirBase *vd, void *user) -{ - _DbgParams& p = *((_DbgParams*)user); - if(!(vd->fullname()[0] == '/' && vd->fullnameLen() == 1)) // don't recurse down the root dir. - p.dirnames.insert(vd->name()); - p.os << p.sp << "D : " << vd->fullname() << " [" << vd->getType() << ", ref " << vd->getRefCount() << ", 0x" << vd << "]" << std::endl; -} - -static void _DumpTree(_DbgParams& p, Root& vfs, int level) -{ - p.os << ">> [" << p.mypath << "]" << std::endl; DirView view; - vfs.FillDirView(p.mypath.c_str(), view); + if(!FillDirView(path, view)) + return false; - view.forEachDir(_DumpDir, &p); - view.forEachFile(_DumpFile, &p); + if(dirCallback) + view.forEachDir(dirCallback, user, safe); + if(fileCallback) + view.forEachFile(fileCallback, user, safe); - if(!level) - return; - - std::string sub = p.sp + " "; - for(std::set::iterator it = p.dirnames.begin(); it != p.dirnames.end(); ++it) - { - _DbgParams recP(p.os, joinPath(p.mypath, it->c_str()), sub); - _DumpTree(recP, vfs, level - 1); - } + return true; } -void Root::debugDumpTree(std::ostream& os, const char *path, int level) -{ - os << ">>> FILE TREE DUMP <<<" << std::endl; - _DbgParams recP(os, path, ""); - _DumpTree(recP, *this, level); -} VFS_NAMESPACE_END diff --git a/ExternalLibs/ttvfs/VFSRoot.h b/ExternalLibs/ttvfs/VFSRoot.h index 407e957..2a23daa 100644 --- a/ExternalLibs/ttvfs/VFSRoot.h +++ b/ExternalLibs/ttvfs/VFSRoot.h @@ -7,7 +7,6 @@ #include #include #include -#include #include "VFSRefcounted.h" @@ -23,7 +22,12 @@ class VFSArchiveLoader; class DirView; -/** Root - extensible class to simplify working with the VFS tree */ +/** Root - simplify working with the VFS tree. + + Everything is reference-counted. If you store pointers to contained objects externally, + use ttvfs::CountedPtr<>. + To enumerate the file tree for debugging, use ttvfs::debug::dumpTree(). +*/ class Root { public: @@ -31,28 +35,24 @@ public: virtual ~Root(); /** Reset an instance to its initial state. - Drops all archives, loaders, archive loaders, mount points, internal trees, ...*/ + Drops all subdirs, loaders, archive loaders, mount points, ...*/ virtual void Clear(); /** Do cleanups from time to time. For internal classes, this is a no-op. Extensions may wish to override this method do do cleanup jobs. */ virtual void ClearGarbage(); - /** Mount a directory in the tree to a different location. Requires a previous call to Prepare(). - This can be imagined like the contents of a directory appearing in a different location. + /** Mount a directory in the tree to a different location. + This means that the contents of src will appear in dest. Be careful not to create circles! */ void Mount(const char *src, const char *dest); - /** Drops a directory from the tree. Internally, this calls Reload(false), - which is a heavy operation compared to Mount(). Be warned. */ + /** Like Mount(), but in reverse. + Returns true if the mount point does not exist after the call, + (that is, if it was removed or it never existed in the first place), + false if src or dst do not exist. */ bool Unmount(const char *src, const char *dest); - /** Adds a Dir object into the merged tree. If subdir is NULL (the default), - add into the subdir stored in the Dir object. The tree will be extended if target dir does not exist. - Files in the tree will be replaced if already existing. - Like with Mount(); be careful not to create cycles. */ - void AddVFSDir(DirBase *dir, const char *subdir = NULL); - /** Add an archive file to the tree, which can then be addressed like a folder, e.g. "path/to/example.zip/file.txt". Returns a pointer to the actual Dir object that represents the added archive, or NULL if failed. @@ -60,18 +60,31 @@ public: such as a password to open the file. Read the comments in VFSArchiveLoader.h for an explanation how it works. If you have no idea, leave it NULL, because it can easily cause a crash if not used carefully. */ - Dir *AddArchive(const char *arch, void *opaque = NULL); Dir *AddArchive(File *file, const char *path = NULL, void *opaque = NULL); + /** Add an archive by file name. This is a quick convenience method using the method above. */ + Dir *AddArchive(const char *arch, void *opaque = NULL); + /** Add a loader that can look for files on demand. - Do not add more then once instance of a loader type. */ - void AddLoader(VFSLoader *ldr, const char *path = NULL); + Do not add more than one instance of a loader type. + The optional path parameter is experimental, do not use it. + Returns the index of the added loader, which is required for RemoveLoader(). + If the loader will not be removed, ignore the return value.*/ + int AddLoader(VFSLoader *ldr, const char *path = NULL); + + /** Remove a previously added loader. Use the index returned by AddLoader(). */ + void RemoveLoader(int index, const char *path = NULL); /** Add an archive loader that can open archives of various types. Whenever an archive file is requested to be opened by AddArchive(), - it is sent through each registered loader until one of them can recognize - the format and open it. */ - void AddArchiveLoader(VFSArchiveLoader *ldr); + it is sent through each registered loader until one of them recognizes + the format and can open it. + Returns the index of the added loader, which is required for RemoveArchiveLoader(). + If the loader will not be removed, ignore the return value.*/ + int AddArchiveLoader(VFSArchiveLoader *ldr); + + /** Remove a previously added archive loader. Use the index returned by AddArchiveLoader(). */ + void RemoveArchiveLoader(int index); /** Get a file from the merged tree. Asks loaders if the file is not in the tree. If found by a loader, the file will be added to the tree. */ @@ -79,18 +92,37 @@ public: /** Fills a DirView object with a list of directories that match the specified path. This is the preferred way to enumerate directories, as it respects and collects - mount points during traversal. The DirView instance can be re-used until an (un-)mounting - operation takes place. If the content of directories changes, this is reflected in the view. + mount points during traversal. The DirView instance can be re-used until any mount or unmount + operation takes place. If the content of a contained directory changes, this is reflected in the view. (Added dirs or files will appear, removed ones disappear). Use DirView::forEachFile() or DirView::forEachDir() to iterate. */ bool FillDirView(const char *path, DirView& view); + /** Convenience method to iterate over all files and subdirs of a given path. + Returns true if the path exists and iteration was successful. + Both callback functions are optional, pass NULL if not interested. + user is an opaque pointer passed to the callbacks. + Set safe = true if the file tree is modified by a callback function. */ + bool ForEach(const char *path, FileEnumCallback fileCallback = NULL, DirEnumCallback dirCallback = NULL, void *user = NULL, bool safe = false); + /** Remove a file or directory from the tree */ //bool Remove(File *vf); //bool Remove(Dir *dir); //bool Remove(const char *name); // TODO: CODE ME + // --- Less common functions below --- + + /** Adds a Dir object into the merged tree. If subdir is NULL (the default), + use the full path of dir. The tree will be extended if target dir does not exist. + Files in the tree will be overridden if already existing. + Like with Mount(); be careful not to create cycles. */ + void AddVFSDir(DirBase *dir, const char *subdir = NULL); + + /** Removes a dir from a given path previously added to via AddVFSDir(). + Returns true if dir does not exist at subdir after the call. */ + bool RemoveVFSDir(DirBase *dir, const char *subdir /* = NULL */); + /** Returns the tree root, which is usually the working directory. Same as GetDir(""). You will most likely not need this function. */ @@ -99,25 +131,31 @@ public: /** Get a directory from the merged tree. If create is true and the directory does not exist, build the tree structure and return the newly created dir. NULL otherwise. You will most likely not need this function. - Use FillDirView() on a DirView object to iterate over directory contents. */ + Use FillDirView() on a DirView object or ForEach() to iterate over directory contents. */ DirBase *GetDir(const char* dn, bool create = false); - // DEBUG STUFF - void debugDumpTree(std::ostream& os, const char *path, int level); - protected: InternalDir *_GetDirByLoader(VFSLoader *ldr, const char *fn, const char *unmangled); + class _LoaderInfo + { + public: + _LoaderInfo(const char *path) : isnull(path == NULL), pathstr(path ? path : "") {} + inline const char *getPath() { return isnull ? NULL : pathstr.c_str(); } + private: + bool isnull; + std::string pathstr; + }; + typedef std::vector > LoaderArray; typedef std::vector > ArchiveLoaderArray; + typedef std::vector<_LoaderInfo> ArchiveLoaderInfoArray; - // If files are not in the tree, maybe one of these is able to find it. - LoaderArray loaders; - + LoaderArray loaders; // If files are not in the tree, maybe one of these is able to find it. CountedPtr merged; // contains the merged virtual/actual file system tree - ArchiveLoaderArray archLdrs; + ArchiveLoaderInfoArray loadersInfo; }; VFS_NAMESPACE_END diff --git a/ExternalLibs/ttvfs_cfileapi/CMakeLists.txt b/ExternalLibs/ttvfs_cfileapi/CMakeLists.txt index 40c993a..9b25d8b 100644 --- a/ExternalLibs/ttvfs_cfileapi/CMakeLists.txt +++ b/ExternalLibs/ttvfs_cfileapi/CMakeLists.txt @@ -10,3 +10,7 @@ add_library(ttvfs_cfileapi ${cfileapi_SRC}) target_link_libraries(ttvfs_cfileapi ttvfs) +install(TARGETS ttvfs_cfileapi DESTINATION lib) + +install(DIRECTORY ./ DESTINATION include/ttvfs + FILES_MATCHING PATTERN "*.h") diff --git a/ExternalLibs/ttvfs_cfileapi/ttvfs_stdio.cpp b/ExternalLibs/ttvfs_cfileapi/ttvfs_stdio.cpp index 7493244..2481002 100644 --- a/ExternalLibs/ttvfs_cfileapi/ttvfs_stdio.cpp +++ b/ExternalLibs/ttvfs_cfileapi/ttvfs_stdio.cpp @@ -16,12 +16,6 @@ void ttvfs_setroot(ttvfs::Root *root) VFILE *vfopen(const char *fn, const char *mode) { - if (strchr(mode, 'w')) - { - assert(0 && "ttvfs_stdio: File writing via VFS not yet supported!"); - return NULL; - } - VFILE *vf = vfs->GetFile(fn); if (!vf || !vf->open(mode)) return NULL; diff --git a/ExternalLibs/ttvfs_cfileapi/ttvfs_stdio.h b/ExternalLibs/ttvfs_cfileapi/ttvfs_stdio.h index 9cddb6c..6754ae3 100644 --- a/ExternalLibs/ttvfs_cfileapi/ttvfs_stdio.h +++ b/ExternalLibs/ttvfs_cfileapi/ttvfs_stdio.h @@ -6,13 +6,14 @@ // * Define VFS_ENABLE_C_API to 1 to use ttvfs overrides. /* - This file is a minimal wrapper to replace the C API and std::ifstream. - Note that if you have an advanced needs, this wrapper API is not for you. + This file is a poor man's wrapper to replace the C API and std::ifstream. + Note that if you have any advanced needs, this wrapper API is not for you. To use it, go through your code and rename all FILE* to VFILE*, and fopen() and related to vfopen() (so just put a 'v' in front). Instead of std::ifstream, use InStream. If you use std::fstream for reading ONLY, also use InStream. + Make sure that a FILE* is not opened twice at any time - this is not supported. Note that the seek and tell functions do not offer 64 bit offsets in this API. */ @@ -35,6 +36,8 @@ typedef ttvfs::File VFILE; void ttvfs_setroot(ttvfs::Root *root); +// Note that vfopen() returns the same pointer for the same file name, +// so effectively a file is a singleton object. VFILE *vfopen(const char *fn, const char *mode); size_t vfread(void *ptr, size_t size, size_t count, VFILE *vf); int vfclose(VFILE *vf); diff --git a/ExternalLibs/ttvfs_zip/CMakeLists.txt b/ExternalLibs/ttvfs_zip/CMakeLists.txt index fb0aa0c..1480abb 100644 --- a/ExternalLibs/ttvfs_zip/CMakeLists.txt +++ b/ExternalLibs/ttvfs_zip/CMakeLists.txt @@ -10,8 +10,16 @@ set(ttvfs_zip_SRC VFSZipArchiveRef.h miniz.c miniz.h + ttvfs_zip.h ) include_directories(${TTVFS_INCLUDE_DIRS}) add_library(ttvfs_zip ${ttvfs_zip_SRC}) + +install(TARGETS ttvfs_zip DESTINATION lib) + +install(FILES miniz.c DESTINATION include/ttvfs) + +install(DIRECTORY ./ DESTINATION include/ttvfs + FILES_MATCHING PATTERN "*.h") diff --git a/ExternalLibs/ttvfs_zip/VFSDirZip.cpp b/ExternalLibs/ttvfs_zip/VFSDirZip.cpp index 7d6524d..b586ee9 100644 --- a/ExternalLibs/ttvfs_zip/VFSDirZip.cpp +++ b/ExternalLibs/ttvfs_zip/VFSDirZip.cpp @@ -65,7 +65,7 @@ void ZipDir::load() continue; ZipFile *vf = new ZipFile(fs.m_filename, _archiveHandle, fs.m_file_index); - addRecursive(vf, len); + _addRecursiveSkip(vf, len); } _canLoad = false; diff --git a/ExternalLibs/ttvfs_zip/VFSFileZip.cpp b/ExternalLibs/ttvfs_zip/VFSFileZip.cpp index 0917bd7..d41e53d 100644 --- a/ExternalLibs/ttvfs_zip/VFSFileZip.cpp +++ b/ExternalLibs/ttvfs_zip/VFSFileZip.cpp @@ -30,6 +30,8 @@ bool ZipFile::open(const char *mode /* = NULL */) _pos = 0; if(!mode) mode = "rb"; + else if(strchr(mode, 'w') || strchr(mode, 'a')) + return false; // writing not yet supported if(_mode != mode) { delete [] _buf; @@ -53,7 +55,7 @@ void ZipFile::close() { //flush(); // TODO: write to zip file on close - delete []_buf; + delete [] _buf; _buf = NULL; _bufSize = 0; } @@ -143,16 +145,15 @@ bool ZipFile::unpack() close(); // delete the buffer const vfspos sz = size(); // will reopen the file - if(sz < 0) + if(sz == npos) return false; - _buf = new char[sz + 1]; + _buf = new char[size_t(sz) + 1]; if(!_buf) return false; - if(!mz_zip_reader_extract_to_mem(MZ, _fileIdx, _buf, sz, 0)) + if(!mz_zip_reader_extract_to_mem(MZ, _fileIdx, _buf, (size_t)sz, 0)) { - //assert(0 && "ZipFile unpack: Failed mz_zip_reader_extract_to_mem"); delete [] _buf; _buf = NULL; return false; // this should not happen diff --git a/ExternalLibs/ttvfs_zip/miniz.c b/ExternalLibs/ttvfs_zip/miniz.c index 92ccde9..4bd06f4 100644 --- a/ExternalLibs/ttvfs_zip/miniz.c +++ b/ExternalLibs/ttvfs_zip/miniz.c @@ -144,7 +144,7 @@ // If all macros here are defined the only functionality remaining will be CRC-32, adler-32, tinfl, and tdefl. // Define MINIZ_NO_STDIO to disable all usage and any functions which rely on stdio for file I/O. -#define MINIZ_NO_STDIO +//#define MINIZ_NO_STDIO // If MINIZ_NO_TIME is specified then the ZIP archive functions will not be able to get the current time, or // get/set file times. diff --git a/ExternalLibs/ttvfs_zip/ttvfs_zip.h b/ExternalLibs/ttvfs_zip/ttvfs_zip.h new file mode 100644 index 0000000..594f067 --- /dev/null +++ b/ExternalLibs/ttvfs_zip/ttvfs_zip.h @@ -0,0 +1,6 @@ +#ifndef TTVFS_ZIP_INC_H +#define TTVFS_ZIP_INC_H + +#include "VFSZipArchiveLoader.h" + +#endif From d84a8bb2c2e808459137b4e8a68b520c762be403 Mon Sep 17 00:00:00 2001 From: fgenesis Date: Thu, 12 Jan 2017 23:57:21 +0100 Subject: [PATCH 5/5] fix possible startup crash --- Aquaria/UserSettings.cpp | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/Aquaria/UserSettings.cpp b/Aquaria/UserSettings.cpp index bb7a6ab..4300987 100644 --- a/Aquaria/UserSettings.cpp +++ b/Aquaria/UserSettings.cpp @@ -482,12 +482,10 @@ void UserSettings::load(bool doApply, const std::string &overrideFile) xml_action = xml_actionSet->FirstChildElement(); while (xml_action) { - std::string name = xml_action->Attribute("name"); - - if (!name.empty()) + const char *name = xml_action->Attribute("name"); + if (name && *name) { ActionInput *ai = control.actionSet.addActionInput(name); - ai->fromString(xml_action->Attribute("input")); } xml_action = xml_action->NextSiblingElement();