diff --git a/Aquaria/Element.cpp b/Aquaria/Element.cpp index ffa9b87..18af377 100644 --- a/Aquaria/Element.cpp +++ b/Aquaria/Element.cpp @@ -42,7 +42,7 @@ Element::Element() : Quad() elementFlag = EF_NONE; elementActive = true; bgLayer = 0; - templateIdx = ~0UL; + templateIdx = -1; eff = NULL; setStatic(true); diff --git a/Aquaria/Game.cpp b/Aquaria/Game.cpp index ac7434e..f6802e8 100644 --- a/Aquaria/Game.cpp +++ b/Aquaria/Game.cpp @@ -1049,7 +1049,7 @@ int Game::getNumberOfEntitiesNamed(const std::string &name) void Game::playSongInMenu(size_t songType, bool override) { - if (playingSongInMenu == ~0UL || override) + if (playingSongInMenu == -1 || override) { playingSongInMenu = songType; currentSongMenuNote = 0; @@ -6091,7 +6091,7 @@ void Game::action(int id, int state) } if (trashIndex >= 0) { - size_t ingrIndex = ~0UL; + size_t ingrIndex = -1; for (size_t i = 0; i < foodSlots.size(); i++) { if (foodSlots[i]->isCursorIn() && foodSlots[i]->getIngredient()) @@ -6100,7 +6100,7 @@ void Game::action(int id, int state) break; } } - if (ingrIndex != ~0UL) + if (ingrIndex != -1) { foodSlots[ingrIndex]->discard(); } @@ -9621,7 +9621,7 @@ void Game::updateInGameMenu(float dt) } // HACK: move this later updateOptionsMenu(dt); - if (playingSongInMenu != ~0UL) + if (playingSongInMenu != -1) { songMenuPlayDelay += dt; diff --git a/Aquaria/ModSelector.cpp b/Aquaria/ModSelector.cpp index 1542c06..db76af8 100644 --- a/Aquaria/ModSelector.cpp +++ b/Aquaria/ModSelector.cpp @@ -46,7 +46,7 @@ ModSelectorScreen::ModSelectorScreen() , ActionMapper() , dlText(&dsq->smallFont) , gotServerList(false) - , currentPanel(~0) + , currentPanel(-1) , subtext(&dsq->subsFont) { followCamera = 1; @@ -140,7 +140,7 @@ void ModSelectorScreen::showPanel(size_t id) IconGridPanel *newgrid = panels[id]; // fade in selected panel - if(currentPanel == ~0U) // just bringing up? + if(currentPanel == -1) // just bringing up? { newgrid->scale = Vector(0.8f,0.8f); newgrid->alpha = 0; diff --git a/Aquaria/SceneEditor.cpp b/Aquaria/SceneEditor.cpp index df1f5ba..fc1ecbf 100644 --- a/Aquaria/SceneEditor.cpp +++ b/Aquaria/SceneEditor.cpp @@ -145,7 +145,7 @@ void WarpAreaRender::onRender() SceneEditor::SceneEditor() : ActionMapper(), on(false) { autoSaveFile = 0; - selectedIdx = ~0UL; + selectedIdx = -1; } void SceneEditor::setBackgroundGradient() @@ -945,7 +945,7 @@ void SceneEditor::moveToBack() void SceneEditor::editModeElements() { - selectedIdx = ~0UL; + selectedIdx = -1; editType = ET_ELEMENTS; if (curElement < dsq->game->elementTemplates.size()) { @@ -960,7 +960,7 @@ void SceneEditor::editModeElements() void SceneEditor::editModeEntities() { - selectedIdx = ~0UL; + selectedIdx = -1; //HACK: methinks target is useless now //target->alpha.interpolateTo(0, 0.5); editType = ET_ENTITIES; @@ -976,7 +976,7 @@ void SceneEditor::editModeEntities() void SceneEditor::editModePaths() { - selectedIdx = ~0UL; + selectedIdx = -1; editType = ET_PATHS; placer->alpha = 0; pathRender->alpha = 0.5; @@ -1074,13 +1074,13 @@ void SceneEditor::deleteSelected() } else { - if (selectedIdx != ~0UL) + if (selectedIdx != -1) { Path *p = dsq->game->getPath(selectedIdx); if (p->nodes.size() == 1) { dsq->game->removePath(selectedIdx); - selectedIdx = ~0UL; + selectedIdx = -1; } else p->removeNode(selectedNode); @@ -1464,7 +1464,7 @@ void SceneEditor::mouseButtonLeft() } else if (editType == ET_PATHS) { - if (selectedIdx != ~0UL) + if (selectedIdx != -1) { Path *p = getSelectedPath(); editingPath = p; @@ -1498,7 +1498,7 @@ void SceneEditor::mouseButtonRight() } if (editType == ET_PATHS) { - if (selectedIdx != ~0UL) + if (selectedIdx != -1) { debugLog("path scaling HERE!"); Path *p = dsq->game->getPath(selectedIdx); @@ -2189,7 +2189,7 @@ void SceneEditor::saveScene() void SceneEditor::deleteSelectedElement() { deleteElement(selectedIdx); - selectedIdx = ~0UL; + selectedIdx = -1; } void SceneEditor::deleteElement(int selectedIdx) @@ -2421,7 +2421,7 @@ Element* SceneEditor::cycleElementPrev(Element *e1) } ce = idx; ce--; - if (ce == ~0UL) + if (ce == -1) ce = dsq->game->elementTemplates.size()-1; idx = dsq->game->elementTemplates[ce].idx; if (idx < 1024) @@ -3060,8 +3060,8 @@ void SceneEditor::update(float dt) { case ES_SELECTING: { - selectedIdx = ~0UL; - selectedNode = ~0UL; + selectedIdx = -1; + selectedNode = -1; float smallestDist = sqr(64); for (size_t i = 0; i < dsq->game->getNumPaths(); i++) { diff --git a/BBGE/ParticleManager.cpp b/BBGE/ParticleManager.cpp index ac67281..88f3a8a 100644 --- a/BBGE/ParticleManager.cpp +++ b/BBGE/ParticleManager.cpp @@ -216,7 +216,7 @@ void ParticleManager::prevFree(int jump) void ParticleManager::setFree(size_t free) { - if (free != ~0UL) + if (free != -1) { this->free = free; } diff --git a/BBGE/RenderObjectLayer.cpp b/BBGE/RenderObjectLayer.cpp index d339d07..bc50580 100644 --- a/BBGE/RenderObjectLayer.cpp +++ b/BBGE/RenderObjectLayer.cpp @@ -101,7 +101,7 @@ void RenderObjectLayer::remove(RenderObject* r) objectCount--; if (idx < firstFreeIdx) firstFreeIdx = idx; - r->setIdx(~0UL); + r->setIdx(-1); clearDisplayList(); } diff --git a/BBGE/SkeletalSprite.cpp b/BBGE/SkeletalSprite.cpp index bc726b7..597605b 100644 --- a/BBGE/SkeletalSprite.cpp +++ b/BBGE/SkeletalSprite.cpp @@ -487,7 +487,7 @@ void AnimationLayer::setSkeletalSprite(SkeletalSprite *s) Animation* AnimationLayer::getCurrentAnimation() { - if (currentAnimation == ~0UL) + if (currentAnimation == -1) return &blendAnimation; if (currentAnimation >= s->animations.size()) { @@ -652,7 +652,7 @@ size_t Animation::getSkeletalKeyframeIndex(SkeletalKeyframe *skey) if (&keyframes[i] == skey) return i; } - return ~0UL; + return -1; } BoneKeyframe *SkeletalKeyframe::getBoneKeyframe(size_t idx) @@ -669,7 +669,7 @@ BoneKeyframe *SkeletalKeyframe::getBoneKeyframe(size_t idx) SkeletalKeyframe *Animation::getPrevKeyframe(float t) { - size_t kf = ~0UL; + size_t kf = -1; for (size_t i = keyframes.size(); i-- > 0; ) { if (t >= keyframes[i].t) @@ -678,7 +678,7 @@ SkeletalKeyframe *Animation::getPrevKeyframe(float t) break; } } - if (kf == ~0UL) + if (kf == -1) return 0; if (kf >= keyframes.size()) kf = keyframes.size()-1; @@ -687,7 +687,7 @@ SkeletalKeyframe *Animation::getPrevKeyframe(float t) SkeletalKeyframe *Animation::getNextKeyframe(float t) { - size_t kf = ~0UL; + size_t kf = -1; for (size_t i = 0; i < keyframes.size(); i++) { if (t <= keyframes[i].t) @@ -697,7 +697,7 @@ SkeletalKeyframe *Animation::getNextKeyframe(float t) } } - if (kf == ~0UL) + if (kf == -1) return 0; if (kf >= keyframes.size()) kf = keyframes.size()-1; @@ -1011,7 +1011,7 @@ size_t SkeletalSprite::getBoneIdx(Bone *b) if (bones[i] == b) return i; } - return ~0UL; + return -1; } void SkeletalSprite::toggleBone(size_t idx, int v) diff --git a/BBGE/Texture.cpp b/BBGE/Texture.cpp index edc50b9..92dfbc4 100644 --- a/BBGE/Texture.cpp +++ b/BBGE/Texture.cpp @@ -156,7 +156,7 @@ int Texture::getPixelWidth() if (!data) return 0; - size_t smallestx = ~0UL, largestx = 0; + size_t smallestx = -1, largestx = 0; for (unsigned int x = 0; x < unsigned(w); x++) { for (unsigned int y = 0; y < unsigned(h); y++) @@ -183,7 +183,7 @@ int Texture::getPixelHeight() if (!data) return 0; - size_t smallesty = ~0UL, largesty = 0; + size_t smallesty = -1, largesty = 0; for (unsigned int x = 0; x < unsigned(w); x++) { for (unsigned int y = 0; y < unsigned(h); y++)