From fc38d375bb261e1b393315788bbbb5e8de353633 Mon Sep 17 00:00:00 2001 From: fgenesis Date: Fri, 27 Oct 2023 14:20:19 +0200 Subject: [PATCH 1/9] fix long-standing editor bug that would cause entities to be moved around This was caused by early deletion of entities. If new ones were spawned upon further editing of a map, it could re-use entity IDs and cause both new and old entities to be spawned in the position of the new entity (due to EntitySaveData of the old one still intact). This is now prevented by not touching the ID range of map entities. Should probably make an offline tool to recompress entity IDs... --- Aquaria/Game.cpp | 9 +++++++-- Aquaria/Game.h | 1 + 2 files changed, 8 insertions(+), 2 deletions(-) diff --git a/Aquaria/Game.cpp b/Aquaria/Game.cpp index e959ab1..9419eb3 100644 --- a/Aquaria/Game.cpp +++ b/Aquaria/Game.cpp @@ -228,6 +228,7 @@ Game::Game() : StateObject() doScreenTrans = false; noSceneTransitionFadeout = false; fullTilesetReload = false; + highestLoadedEntityID = 0; } Game::~Game() @@ -943,7 +944,7 @@ EntitySaveData *Game::getEntitySaveDataForEntity(Entity *e) int Game::findUnusedEntityID(bool temporary) const { const int inc = temporary ? -1 : 1; - int id = 0; + int id = temporary ? 0 : highestLoadedEntityID + 1; // never touch entity IDs that were in use in the map xml retry: id += inc; FOR_ENTITIES(i) @@ -1845,9 +1846,11 @@ bool Game::loadSceneXML(std::string scene) void Game::spawnEntities(const EntitySaveData *sav, size_t n) { std::vector conflicting, usable; + int highest = 0; for(size_t i = 0; i < n; ++i) { const EntitySaveData& es = sav[i]; + highest = std::max(es.id, highest); // check for ID conflicts int id = es.id; @@ -1870,6 +1873,8 @@ void Game::spawnEntities(const EntitySaveData *sav, size_t n) conflicting.push_back(i); } + highestLoadedEntityID = highest; + { std::ostringstream os; os << "Game::spawnEntities: Spawning " << usable.size() << " entities"; @@ -1888,7 +1893,7 @@ void Game::spawnEntities(const EntitySaveData *sav, size_t n) } // spawn and renumber the rest - int lastid = 0; + int lastid = highest; for(size_t i = 0; i < conflicting.size(); ++i) { // find an unused ID diff --git a/Aquaria/Game.h b/Aquaria/Game.h index 729ba1b..5cb2298 100644 --- a/Aquaria/Game.h +++ b/Aquaria/Game.h @@ -422,6 +422,7 @@ public: void onContinuityReset(); protected: + unsigned highestLoadedEntityID; void toggleHelpScreen(bool on, const std::string &label=""); void onToggleHelpScreen(); From ec5f50e41e38ab264aa6f3e5f1b5f2c15e0eb91f Mon Sep 17 00:00:00 2001 From: fgenesis Date: Sat, 28 Oct 2023 06:08:19 +0200 Subject: [PATCH 2/9] fix jittering when moving the camera around in map editor mode. This is related to a494a3f411c31489769c653 and should hopefully fix the last issues with this for good. Seems fine with SDL versions from 2022 and 2023 on windows; untested on linux. (The second window->handleInput() that got removed broke the sing circle if it was there. It was previously added as a mitigation and is no longer needed.) --- BBGE/Core.cpp | 64 +++++++++++++++++++++++++++++++++++---------------- BBGE/Core.h | 6 +++-- 2 files changed, 48 insertions(+), 22 deletions(-) diff --git a/BBGE/Core.cpp b/BBGE/Core.cpp index 6502c26..1b0c165 100644 --- a/BBGE/Core.cpp +++ b/BBGE/Core.cpp @@ -961,17 +961,18 @@ void Core::resetTimer() void Core::setMousePosition(const Vector &p) { - float px = p.x + virtualOffX; - float py = p.y; + int ix, iy; + virtualCoordsToPixelPos(ix, iy, p); SDL_Event ev = { sdlUserMouseEventID }; + ev.motion.x = ix; + ev.motion.y = iy; + ev.motion.xrel = 0; + ev.motion.yrel = 0; ev.motion.state = 0; SDL_PushEvent(&ev); - window->warpMouse( - px * (float(width)/float(virtualWidth)), - py * (float(height)/float(virtualHeight)) - ); + window->warpMouse(ix, iy); ev.motion.state = 1; SDL_PushEvent(&ev); @@ -1243,12 +1244,12 @@ void Core::setMouseConstraintCircle(const Vector& pos, float circle) -int Core::getVirtualOffX() +int Core::getVirtualOffX() const { return virtualOffX; } -int Core::getVirtualOffY() +int Core::getVirtualOffY() const { return virtualOffY; } @@ -1275,12 +1276,39 @@ bool Core::doMouseConstraint() return false; } +Vector Core::pixelPosToVirtualCoords(int x, int y) const +{ + const float mx = float(virtualWidth)/float(getWindowWidth()); + const float my = float(virtualHeight)/float(getWindowHeight()); + + return Vector( + (x * mx) - getVirtualOffX(), + y * my + ); +} + +void Core::virtualCoordsToPixelPos(int& x, int& y, const Vector& p) +{ + const float px = p.x + getVirtualOffX(); + const float py = p.y; + x = px * (float(getWindowWidth())/float(virtualWidth)); + y = py * (float(getWindowHeight())/float(virtualHeight)); +} + void Core::onEvent(const SDL_Event& event) { const bool focus = window->hasFocus(); if(event.type == sdlUserMouseEventID) { - mouse._enableMotionEvents = event.motion.state; + mouse._enableMotionEvents = !!event.motion.state; + if(event.motion.state) // If 1, the generated mouse move is done and the rest is true mouse events + { + // We just set the position, so lets make sure that this mouse move isn't picked up + // as a relative change, ie. there was no actual user mouse move. + // There may be regular mouse move events after this one, which will be picked up normally. + mouse.lastPosition = pixelPosToVirtualCoords(event.motion.x, event.motion.y); + goto motion; // All the needed data are there, use this like a regular motion event + } return; } @@ -1320,17 +1348,16 @@ void Core::onEvent(const SDL_Event& event) } break; + // This event is also sent when SDL sets the mouse position! + // Since there's no way to distinguish the generated event from a true "user moved the mouse" event, + // sdlUserMouseEventID (above) is used to guard a generated motion event. case SDL_MOUSEMOTION: { - if (focus) + if (focus && mouse._enableMotionEvents) { - const float mx = float(virtualWidth)/float(getWindowWidth()); - const float my = float(virtualHeight)/float(getWindowHeight()); - - mouse.position.x = ((event.motion.x) * mx) - getVirtualOffX(); - mouse.position.y = event.motion.y * my; - if(mouse._enableMotionEvents) - mouse._wasMoved = true; +motion: + mouse.position = pixelPosToVirtualCoords(event.motion.x, event.motion.y); + mouse._wasMoved = true; } } break; @@ -1434,10 +1461,7 @@ void Core::pollEvents(float dt) if(mouse._wasMoved) { if(doMouseConstraint()) - { setMousePosition(mouse.position); - window->handleInput(); - } mouse.change = mouse.position - mouse.lastPosition; } diff --git a/BBGE/Core.h b/BBGE/Core.h index e1e3ff3..28b3996 100644 --- a/BBGE/Core.h +++ b/BBGE/Core.h @@ -233,6 +233,8 @@ public: // state functions void setMousePosition(const Vector &p); + Vector pixelPosToVirtualCoords(int x, int y) const; + void virtualCoordsToPixelPos(int& x, int& y, const Vector& p); void setFullscreen(bool full); @@ -384,8 +386,8 @@ public: int getDisplayIndex(); int getRefreshRate(); - int getVirtualOffX(); - int getVirtualOffY(); + int getVirtualOffX() const; + int getVirtualOffY() const; void centerMouse(); From 04c7d84b2e3c2f60d6748435832679e9b4356b00 Mon Sep 17 00:00:00 2001 From: fgenesis Date: Fri, 17 Nov 2023 01:39:31 +0100 Subject: [PATCH 3/9] fix possible crash when leaving waterbubble while underwater --- Aquaria/Entity.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Aquaria/Entity.cpp b/Aquaria/Entity.cpp index 1d8faaa..ebc4ec4 100644 --- a/Aquaria/Entity.cpp +++ b/Aquaria/Entity.cpp @@ -2444,7 +2444,7 @@ bool Entity::doCollisionAvoidance(float dt, int search, float mod, Vector *vp, f Vector accum; int c = 0; bool isInWaterBubble = false; - if (waterBubble && isUnderWater()) + if (isUnderWater() && waterBubble) // isUnderWater() may set waterBubble { //debugLog("collision avoidance in bubble"); isInWaterBubble = true; From 4dc374c3679283403dd5b838b363f43c6456aeef Mon Sep 17 00:00:00 2001 From: fgenesis Date: Fri, 17 Nov 2023 01:39:46 +0100 Subject: [PATCH 4/9] forgot to make a method const --- BBGE/Core.cpp | 2 +- BBGE/Core.h | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/BBGE/Core.cpp b/BBGE/Core.cpp index 1b0c165..0602055 100644 --- a/BBGE/Core.cpp +++ b/BBGE/Core.cpp @@ -1287,7 +1287,7 @@ Vector Core::pixelPosToVirtualCoords(int x, int y) const ); } -void Core::virtualCoordsToPixelPos(int& x, int& y, const Vector& p) +void Core::virtualCoordsToPixelPos(int& x, int& y, const Vector& p) const { const float px = p.x + getVirtualOffX(); const float py = p.y; diff --git a/BBGE/Core.h b/BBGE/Core.h index 28b3996..1e17b1c 100644 --- a/BBGE/Core.h +++ b/BBGE/Core.h @@ -234,7 +234,7 @@ public: void setMousePosition(const Vector &p); Vector pixelPosToVirtualCoords(int x, int y) const; - void virtualCoordsToPixelPos(int& x, int& y, const Vector& p); + void virtualCoordsToPixelPos(int& x, int& y, const Vector& p) const; void setFullscreen(bool full); From 6d70204847eab03183216d49aabe86ad5e41c687 Mon Sep 17 00:00:00 2001 From: fgenesis Date: Sun, 19 Nov 2023 19:59:06 +0100 Subject: [PATCH 5/9] fixes for osx --- Aquaria/Game.cpp | 2 +- Aquaria/Game.h | 2 ++ BBGE/Precacher.cpp | 2 +- CMakeLists.txt | 1 + 4 files changed, 5 insertions(+), 2 deletions(-) diff --git a/Aquaria/Game.cpp b/Aquaria/Game.cpp index 9419eb3..79d21e7 100644 --- a/Aquaria/Game.cpp +++ b/Aquaria/Game.cpp @@ -1264,7 +1264,7 @@ Path *Game::getWaterbubbleAt(const Vector& pos, float rad) const UnderWaterResult Game::isUnderWater(const Vector& pos, float rad) const { - UnderWaterResult ret { false, NULL }; + UnderWaterResult ret = { false, NULL }; if (!game->useWaterLevel || game->waterLevel.x == 0 || (useWaterLevel && waterLevel.x > 0 && pos.y-rad > waterLevel.x)) { diff --git a/Aquaria/Game.h b/Aquaria/Game.h index 5cb2298..82dac8e 100644 --- a/Aquaria/Game.h +++ b/Aquaria/Game.h @@ -90,6 +90,8 @@ class ObsRow public: inline ObsRow(unsigned tx, unsigned ty, unsigned len) : tx(tx), ty(ty), len(len) {} + inline ObsRow(const ObsRow& o) + : tx(o.tx), ty(o.ty), len(o.len) {} const unsigned tx, ty, len; }; diff --git a/BBGE/Precacher.cpp b/BBGE/Precacher.cpp index bb4e417..1216c5d 100644 --- a/BBGE/Precacher.cpp +++ b/BBGE/Precacher.cpp @@ -90,7 +90,7 @@ void Precacher::doCache(ProgressCallback progress) debugLog(os.str()); std::vector tmp(todo.size()); core->texmgr.loadBatch(&tmp[0], &todo[0], todo.size(), TextureMgr::KEEP, - progress ? texLoadProgressCallback : NULL, progress); + progress ? texLoadProgressCallback : NULL, (void*)progress); todo.clear(); texkeep.reserve(texkeep.size() + tmp.size()); for(size_t i = 0; i < tmp.size(); ++i) diff --git a/CMakeLists.txt b/CMakeLists.txt index c6e7548..e38dbd7 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -1,5 +1,6 @@ CMAKE_MINIMUM_REQUIRED(VERSION 2.6...3.20) PROJECT(Aquaria) +SET(CMAKE_CXX_STANDARD 98) set(CMAKE_MODULE_PATH ${CMAKE_MODULE_PATH} "${CMAKE_SOURCE_DIR}/cmake/Modules/") From cd91ee51efeeebe205061987dd982fa109653803 Mon Sep 17 00:00:00 2001 From: fgenesis Date: Sun, 19 Nov 2023 20:00:01 +0100 Subject: [PATCH 6/9] attempt to fix ttvfs crashes on osx it's time to kick out the darn thing, but alas, not quite yet --- ExternalLibs/ttvfs/VFSDir.cpp | 4 ++-- ExternalLibs/ttvfs/VFSTools.h | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/ExternalLibs/ttvfs/VFSDir.cpp b/ExternalLibs/ttvfs/VFSDir.cpp index dc7fa3a..d2aa526 100644 --- a/ExternalLibs/ttvfs/VFSDir.cpp +++ b/ExternalLibs/ttvfs/VFSDir.cpp @@ -172,7 +172,7 @@ void DirBase::forEachDir(DirEnumCallback f, void *user /* = NULL */, bool safe / DirBase *DirBase::getDirByName(const char *dn, bool /* unused: lazyLoad = true */, bool useSubtrees /* = true */) { - if(!dn[0] || (dn[0] == '.' && !dn[1])) + if(!dn || !dn[0] || (dn[0] == '.' && !dn[1])) return this; Dirs::iterator it = _subdirs.find(dn); @@ -312,7 +312,7 @@ DirBase *Dir::getDirByName(const char *dn, bool lazyLoad /* = true */, bool useS return NULL; // Fix for absolute paths: No dir should have '/' (or any other absolute dirs) as subdir. - if(fullnameLen() && dn[0] == '/') + if(fullnameLen() && (dn && dn[0] == '/')) return NULL; // Lazy-load file if it's not in the tree yet diff --git a/ExternalLibs/ttvfs/VFSTools.h b/ExternalLibs/ttvfs/VFSTools.h index 2252ed5..2dd3992 100644 --- a/ExternalLibs/ttvfs/VFSTools.h +++ b/ExternalLibs/ttvfs/VFSTools.h @@ -65,7 +65,7 @@ template void SkipSelfPath(T *& s) inline std::string joinPath(std::string base, const char *sub) { - if(!*sub) + if(!sub || !*sub) return base; if(*sub != '/' && base.length() && base[base.length()-1] != '/') base += '/'; From cf2dc71a341b00f646388b0905285233c576107d Mon Sep 17 00:00:00 2001 From: fgenesis Date: Thu, 21 Dec 2023 06:04:09 +0100 Subject: [PATCH 7/9] add AC_SET_FH bone command; rework bone frames; some skel cleanups - bone frames are no longer separate quads. this is probably a leftover from when crossfading was planned, but this was never implemented. now it's a simple texture swap. - remove anim resetPassOnEnd attrib - instead, add resetOnEnd that applies to everything that was changed via bone command - resetOnEnd=true is the new default --- BBGE/SkeletalSprite.cpp | 108 +++++++++++++++------------------------- BBGE/SkeletalSprite.h | 10 ++-- 2 files changed, 46 insertions(+), 72 deletions(-) diff --git a/BBGE/SkeletalSprite.cpp b/BBGE/SkeletalSprite.cpp index 3ad7b5b..43da5bc 100644 --- a/BBGE/SkeletalSprite.cpp +++ b/BBGE/SkeletalSprite.cpp @@ -137,51 +137,16 @@ void Bone::createStrip(bool vert, int num) } -Quad* Bone::addFrame(const std::string &gfx) +void Bone::addFrame(const std::string &gfx) { - renderQuad = false; - Quad *q = new Quad(); - q->setTexture(gfx); - q->renderBeforeParent = 1; - addChild(q, PM_POINTER); - return q; + framegfx.push_back(gfx); } void Bone::showFrame(int idx) { - - int c = 0; - for (Children::iterator i = children.begin(); i != children.end(); i++) - { - RenderObject *r = (*i); - if (idx == c) - { - if (r->alpha == 0) - { - r->alpha = 1; - - // add option to turn on alpha fading - //r->alpha.interpolateTo(1, t); - } - else - { - r->alpha = 1; - } - } - else - { - if (r->alpha == 1) - { - r->alpha = 0; - //r->alpha.interpolateTo(0, t*2); - } - else - { - r->alpha = 0; - } - } - c++; - } + size_t i = idx; + if(i < framegfx.size()) + setTexture(framegfx[i]); } @@ -391,6 +356,11 @@ bool BoneCommand::parse(Bone *b, SimpleIStringStream &is) } else if(type == "AC_RESET_PASS") command = AC_RESET_PASS; + else if(type == "AC_SET_FH") + { + command = AC_SET_FH; + is >> slot; + } else // fail { std::ostringstream os; @@ -445,6 +415,19 @@ void BoneCommand::run() case AC_RESET_PASS: b->setRenderPass(b->originalRenderPass); break; + case AC_SET_FH: + { + bool should = false; + switch(slot) + { + case 0: should = b->originalFH; break; + case 1: should = !b->originalFH; break; + case 2: should = true; break; + default: should = false; break; + } + b->fhTo(should); + break; + } case AC_SEGS_START: case AC_SEGS_STOP: break; @@ -605,7 +588,7 @@ void AnimationLayer::createTransitionAnimation(Animation& to, float time) void AnimationLayer::stopAnimation() { - if(s->loaded && getCurrentAnimation()->resetPassOnEnd) + if(s->loaded && getCurrentAnimation()->resetOnEnd) resetPass(); animating = false; if (!enqueuedAnimation.empty()) @@ -627,7 +610,7 @@ float AnimationLayer::getAnimationLength() } Animation::Animation() -: resetPassOnEnd(false) +: resetOnEnd(true) { } @@ -980,7 +963,7 @@ bool SkeletalSprite::saveSkeletal(const std::string &fn) bone->SetAttribute("gfx", this->bones[i]->gfx.c_str()); bone->SetAttribute("pidx", this->bones[i]->pidx); bone->SetAttribute("name", this->bones[i]->name.c_str()); - bone->SetAttribute("fh", this->bones[i]->isfh()); + bone->SetAttribute("fh", this->bones[i]->originalFH); bone->SetAttribute("fv", this->bones[i]->isfv()); bone->SetAttribute("gc", this->bones[i]->generateCollisionMask); bone->SetAttribute("cr", this->bones[i]->collideRadius); @@ -1039,21 +1022,11 @@ bool SkeletalSprite::saveSkeletal(const std::string &fn) } - for (Children::iterator j = this->bones[i]->children.begin(); j != this->bones[i]->children.end(); j++) + for(size_t j = 0; j < this->bones[i]->framegfx.size(); ++j) { - Bone *b = dynamic_cast(*j); - Quad *q = dynamic_cast(*j); - Particle *p = dynamic_cast(*j); - if (q && !b && !p) - { - XMLElement *frame = xml->NewElement("Frame"); - frame->SetAttribute("gfx", q->texture->name.c_str()); - if (q->getRenderPass() != 0) - { - frame->SetAttribute("pass", q->getRenderPass()); - } - bone->InsertEndChild(frame); - } + XMLElement *frame = xml->NewElement("Frame"); + frame->SetAttribute("gfx", this->bones[i]->framegfx[j].c_str()); + bone->InsertEndChild(frame); } bones->InsertEndChild(bone); } @@ -1065,8 +1038,8 @@ bool SkeletalSprite::saveSkeletal(const std::string &fn) Animation *a = &this->animations[i]; XMLElement *animation = xml->NewElement("Animation"); animation->SetAttribute("name", a->name.c_str()); - if(a->resetPassOnEnd) - animation->SetAttribute("resetPassOnEnd", a->resetPassOnEnd); + if(!a->resetOnEnd) + animation->SetAttribute("resetOnEnd", a->resetOnEnd); for (size_t j = 0; j < a->interpolators.size(); ++j) { @@ -1205,6 +1178,7 @@ Bone *SkeletalSprite::initBone(int idx, std::string gfx, int pidx, bool rbp, std b->pidx = pidx; b->collideRadius = cr; b->name = name; + b->originalFH = fh; if (fh) b->flipHorizontal(); @@ -1491,19 +1465,11 @@ void SkeletalSprite::loadSkeletal(const std::string &fn) int frc=0; while(fr) { - Quad *q=0; std::string gfx; if (fr->Attribute("gfx")) { gfx = fr->Attribute("gfx"); - q = newb->addFrame(gfx); - } - if (fr->Attribute("pass")) - { - if (q) - { - q->setRenderPass(atoi(fr->Attribute("pass"))); - } + newb->addFrame(gfx); } fr = fr->NextSiblingElement("Frame"); frc++; @@ -1697,7 +1663,8 @@ void SkeletalSprite::loadSkeletal(const std::string &fn) { Animation newAnimation; newAnimation.name = animation->Attribute("name"); - newAnimation.resetPassOnEnd = animation->BoolAttribute("resetPassOnEnd"); + if(animation->Attribute("resetOnEnd")) + newAnimation.resetOnEnd = animation->BoolAttribute("resetOnEnd"); stringToLower(newAnimation.name); XMLElement *key = animation->FirstChildElement("Key"); @@ -1951,7 +1918,10 @@ void AnimationLayer::resetPass() { Bone *b = s->bones[i]; if (contains(b)) + { b->setRenderPass(b->originalRenderPass); + b->fhTo(b->originalFH); + } } } diff --git a/BBGE/SkeletalSprite.h b/BBGE/SkeletalSprite.h index 0ec689c..77ca9ab 100644 --- a/BBGE/SkeletalSprite.h +++ b/BBGE/SkeletalSprite.h @@ -37,7 +37,8 @@ enum AnimationCommand AC_SND_PLAY , AC_SEGS_STOP, AC_SET_PASS, - AC_RESET_PASS + AC_RESET_PASS, + AC_SET_FH }; class ParticleEffect; @@ -58,7 +59,7 @@ public: ANIM_ALL = ANIM_POS | ANIM_ROT }; void createStrip(bool vert, int num); - Quad* addFrame(const std::string &gfx); + void addFrame(const std::string &gfx); void showFrame(int i); void destroy() OVERRIDE; std::string gfx; @@ -93,6 +94,7 @@ public: bool fileRenderQuad; bool selectable; int originalRenderPass; // stores the render pass originally set in the XML file. For AC_RESET_PASS. + bool originalFH; void spawnParticlesFromCollisionMask(const char *p, unsigned intv, int layer, float rotz = 0); Vector getCollisionMaskNormal(Vector pos, float dist) const; @@ -107,6 +109,8 @@ public: std::vector collisionMask; std::vector transformedCollisionMask; float collisionMaskRadius; + std::vector framegfx; + }; class BoneCommand @@ -181,7 +185,7 @@ public: size_t getSkeletalKeyframeIndex(SkeletalKeyframe *skey); size_t getNumKeyframes(); void reverse(); - bool resetPassOnEnd; + bool resetOnEnd; BoneGridInterpolator *getBoneGridInterpolator(size_t boneIdx); typedef std::vector Interpolators; From f2219ef50ba0fe344196f8fc3220e81be5a0f821 Mon Sep 17 00:00:00 2001 From: fgenesis Date: Thu, 21 Dec 2023 06:04:51 +0100 Subject: [PATCH 8/9] attempt to allow some more input chars in DSQ::getUserInputString() --- Aquaria/DSQ.cpp | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/Aquaria/DSQ.cpp b/Aquaria/DSQ.cpp index 78c4cfe..c03bc8e 100644 --- a/Aquaria/DSQ.cpp +++ b/Aquaria/DSQ.cpp @@ -3207,6 +3207,10 @@ std::string DSQ::getUserInputString(std::string labelText, std::string t, bool a doAlphabetInputKey(KEY_MINUS, '-', (char*)&map, &text, '_'); doAlphabetInputKey(KEY_TILDE, '~', (char*)&map, &text, '~'); + doAlphabetInputKey(KEY_EQUALS, '=', (char*)&map, &text); + doAlphabetInputKey(KEY_LBRACKET, '(', (char*)&map, &text); + doAlphabetInputKey(KEY_RBRACKET, ')', (char*)&map, &text); + doAlphabetInputKey(KEY_SEMICOLON, ';', (char*)&map, &text); } if (getKeyState(KEY_BACKSPACE)) From 66968836bcc68cfa57fc560aac9a8596839dff77 Mon Sep 17 00:00:00 2001 From: fgenesis Date: Thu, 21 Dec 2023 06:05:18 +0100 Subject: [PATCH 9/9] yet another attempt to unfuck build and make sure assertions are enabled properly --- CMakeLists.txt | 22 ++++++++++++++-------- 1 file changed, 14 insertions(+), 8 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index e38dbd7..28b2b8b 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -57,6 +57,9 @@ OPTION(AQUARIA_USE_GLM "Use GLM for matrix math" TRUE) OPTION(AQUARIA_DEBUG_SHOW_PATHS "Show important paths upon game start to aid in finding path problems" FALSE) mark_as_advanced(AQUARIA_DEBUG_SHOW_PATHS) +#add_compile_options(-fsanitize=address) +#add_link_options(-fsanitize=address) + ################ Look for external libraries ### Pick one: SDL 1.2 or SDL2 @@ -138,14 +141,17 @@ ELSE(AQUARIA_DEMO_BUILD) ADD_DEFINITIONS(-DAQUARIA_BUILD_SCENEEDITOR=1) ENDIF(AQUARIA_DEMO_BUILD) -IF(CMAKE_BUILD_TYPE STREQUAL "Release") - ADD_DEFINITIONS(-DNDEBUG) # MSVC defines this in release mode by default, gcc/mingw do not - message(STATUS "This is a release build.") -ENDIF(CMAKE_BUILD_TYPE STREQUAL "Release") -IF(CMAKE_BUILD_TYPE STREQUAL "Debug") - ADD_DEFINITIONS(-D_DEBUG) # MSVC defines this in debug mode by default, gcc/mingw do not - message(STATUS "This is a debug build.") -ENDIF(CMAKE_BUILD_TYPE STREQUAL "Debug") +IF(NOT MSVC) + # MSVC defines these in release mode by default, gcc/mingw do not + IF(CMAKE_BUILD_TYPE STREQUAL "Release") + ADD_DEFINITIONS(-DNDEBUG) + message(STATUS "This is a release build.") + ENDIF(CMAKE_BUILD_TYPE STREQUAL "Release") + IF(CMAKE_BUILD_TYPE STREQUAL "Debug") + ADD_DEFINITIONS(-D_DEBUG) + message(STATUS "This is a debug build.") + ENDIF(CMAKE_BUILD_TYPE STREQUAL "Debug") +ENDIF(NOT MSVC) # FIXME: These should go IF(UNIX)