From 239df3c33933f948255d0d17c2c3b12c77227b56 Mon Sep 17 00:00:00 2001 From: fgenesis Date: Tue, 17 Apr 2018 01:15:30 +0200 Subject: [PATCH] compiles again --- Aquaria/Avatar.cpp | 31 ++++++++++++++++--------------- Aquaria/DSQ.cpp | 20 ++++++++++---------- Aquaria/Game.cpp | 8 ++++---- 3 files changed, 30 insertions(+), 29 deletions(-) diff --git a/Aquaria/Avatar.cpp b/Aquaria/Avatar.cpp index f78f81e..d5016e8 100644 --- a/Aquaria/Avatar.cpp +++ b/Aquaria/Avatar.cpp @@ -2108,11 +2108,11 @@ void Avatar::updateTargetQuads(float dt) targetQuads[i]->position = cursorpos; if (dsq->continuity.form == FORM_ENERGY && isInputEnabled()) { - if (dsq->inputMode == INPUT_JOYSTICK && targetQuads[i]->isRunning()) + if (dsq->getInputMode() == INPUT_JOYSTICK && targetQuads[i]->isRunning()) { targetQuads[i]->stop(); } - else if (dsq->inputMode != INPUT_JOYSTICK && !targetQuads[i]->isRunning()) + else if (dsq->getInputMode() != INPUT_JOYSTICK && !targetQuads[i]->isRunning()) { targetQuads[i]->start(); } @@ -2189,7 +2189,7 @@ bool Avatar::fireAtNearestValidEntity(const std::string &shot) bool clearTargets = false; // allow autoAim if desired - if ((dsq->inputMode == INPUT_JOYSTICK && !aimAt) || dsq->user.control.autoAim) + if ((dsq->getInputMode() == INPUT_JOYSTICK && !aimAt) || dsq->user.control.autoAim) { if (targets.empty()) { @@ -4189,11 +4189,11 @@ Vector Avatar::getKeyDir() Vector Avatar::getFakeCursorPosition() { - if (dsq->inputMode == INPUT_KEYBOARD) + if (dsq->getInputMode() == INPUT_KEYBOARD) { return getKeyDir() * 350; } - if (dsq->inputMode == INPUT_JOYSTICK) + if (dsq->getInputMode() == INPUT_JOYSTICK) { float axisInput = 0; Joystick *j = 0; @@ -4219,7 +4219,7 @@ Vector Avatar::getVectorToCursorFromScreenCentre() return getVectorToCursor(); else { - if (dsq->inputMode != INPUT_MOUSE) + if (dsq->getInputMode() != INPUT_MOUSE) return getFakeCursorPosition(); return (core->mouse.position+offset) - Vector(400,300); } @@ -4231,7 +4231,7 @@ Vector Avatar::getVectorToCursor(bool trueMouse) Vector pos = dsq->getGameCursorPosition(); - if (!trueMouse && dsq->inputMode != INPUT_MOUSE) + if (!trueMouse && dsq->getInputMode() != INPUT_MOUSE) return getFakeCursorPosition(); return pos - (position+offset); @@ -4997,7 +4997,7 @@ void Avatar::updateRoll(float dt) stopRoll(); } - if (!core->mouse.buttons.left && dsq->inputMode == INPUT_MOUSE && !rollact) + if (!core->mouse.buttons.left && dsq->getInputMode() == INPUT_MOUSE && !rollact) { if (rolling) stopRoll(); @@ -5789,7 +5789,7 @@ void Avatar::onUpdate(float dt) // revert stuff float revertGrace = 0.4f; static bool revertButtonsAreDown = false; - if (inputEnabled && (dsq->inputMode == INPUT_KEYBOARD || dsq->inputMode == INPUT_MOUSE) && (!pathToActivate && !entityToActivate)) + if (inputEnabled && (dsq->getInputMode() == INPUT_KEYBOARD || dsq->getInputMode() == INPUT_MOUSE) && (!pathToActivate && !entityToActivate)) { if (dsq->continuity.form != FORM_NORMAL && (core->mouse.pure_buttons.left && core->mouse.pure_buttons.right) && getVectorToCursor(true).isLength2DIn(minMouse)) { @@ -6134,13 +6134,14 @@ void Avatar::onUpdate(float dt) if (dsq->isMiniMapCursorOkay() && !isActing(ACTION_ROLL, -1) && _isUnderWater && !riding && !boneLock.on && - (movingOn || ((dsq->inputMode == INPUT_JOYSTICK || dsq->inputMode== INPUT_KEYBOARD) || (core->mouse.buttons.left || bursting)))) + (movingOn || ((dsq->getInputMode() == INPUT_JOYSTICK || dsq->getInputMode()== INPUT_KEYBOARD) || (core->mouse.buttons.left || bursting)))) { - if (dsq->inputMode == INPUT_MOUSE || !this->singing) + const bool isMouse = dsq->getInputMode() == INPUT_MOUSE; + if (isMouse || !this->singing) { addVec = getVectorToCursorFromScreenCentre();//getVectorToCursor(); - if (dsq->inputMode == INPUT_MOUSE) + if (isMouse) { static Vector lastAddVec; if (!isActing(ACTION_PRIMARY, -1) && bursting) @@ -6156,7 +6157,7 @@ void Avatar::onUpdate(float dt) if (addVec.isLength2DIn(minMouse)) { - if (dsq->inputMode == INPUT_JOYSTICK) + if (dsq->getInputMode() == INPUT_JOYSTICK) addVec = Vector(0,0,0); } @@ -6185,7 +6186,7 @@ void Avatar::onUpdate(float dt) // For joystick/keyboard control, don't stop unless // the Swim (primary action) button is pressed with // no movement input. --achurch - if ((dsq->inputMode == INPUT_MOUSE || isActing(ACTION_PRIMARY, -1)) + if ((isMouse || isActing(ACTION_PRIMARY, -1)) && addVec.isLength2DIn(STOP_DISTANCE)) { vel *= 0.9f; @@ -6280,7 +6281,7 @@ void Avatar::onUpdate(float dt) else { float t = 0; - if (dsq->inputMode == INPUT_KEYBOARD) + if (dsq->getInputMode() == INPUT_KEYBOARD) t = 0.1f; rotateToVec(addVec, t); } diff --git a/Aquaria/DSQ.cpp b/Aquaria/DSQ.cpp index a94cd99..4b947d9 100644 --- a/Aquaria/DSQ.cpp +++ b/Aquaria/DSQ.cpp @@ -192,7 +192,7 @@ DSQ::DSQ(const std::string& fileSystem, const std::string& extraDataDir) subbox = 0; modSelectorScr = 0; blackout = 0; - inputMode = INPUT_MOUSE; + lastInputMode = INPUT_MOUSE; overlay = 0; recentSaveSlot = -1; arialFontData = 0; @@ -1684,8 +1684,8 @@ void DSQ::toggleVersionLabel(bool on) void DSQ::setInputMode(InputDevice mode) { - inputMode = mode; - switch(inputMode) + lastInputMode = mode; + switch(mode) { case INPUT_JOYSTICK: core->joystickAsMouse = true; @@ -3854,7 +3854,7 @@ void DSQ::onUpdate(float dt) if (joystickEnabled) { - if (dsq->inputMode != INPUT_JOYSTICK) + if (dsq->getInputMode() != INPUT_JOYSTICK) { const float thresh = JOY_AXIS_THRESHOLD; for(size_t i = 0; i < getNumJoysticks(); ++i) @@ -3866,7 +3866,7 @@ void DSQ::onUpdate(float dt) dsq->setInputMode(INPUT_JOYSTICK); } } - else if (dsq->inputMode != INPUT_MOUSE) + else if (dsq->getInputMode() != INPUT_MOUSE) { if ((!core->mouse.change.isLength2DIn(5) || (core->getMouseButtonState(0) || core->getMouseButtonState(1))) /*&& !core->joystick.anyButton()*/) { @@ -3891,7 +3891,7 @@ void DSQ::onUpdate(float dt) if (user.control.flipInputButtons) cb = 1; - if (dsq->inputMode == INPUT_KEYBOARD && (core->getMouseButtonState(cb))) + if (dsq->getInputMode() == INPUT_KEYBOARD && (core->getMouseButtonState(cb))) { dsq->setInputMode(INPUT_MOUSE); } @@ -3932,7 +3932,7 @@ void DSQ::onUpdate(float dt) os << " look: " << dsq->game->avatar->state.updateLookAtTime << " "; os << "inputMode: "; - switch(dsq->inputMode) + switch(dsq->getInputMode()) { case INPUT_MOUSE: os << "mouse"; @@ -4472,7 +4472,7 @@ void DSQ::resetLayerPasses() bool DSQ::isMiniMapCursorOkay() { - return ((inputMode != INPUT_MOUSE) || (!game->miniMapRender || !game->miniMapRender->isCursorIn())); + return (!useMouseInput() || (!game->miniMapRender || !game->miniMapRender->isCursorIn())); } void DSQ::onJoystickAdded(int deviceID) @@ -4571,7 +4571,7 @@ InputDevice DSQ::getInputMode(int source) const return _inputModes[source]; } -void DSQ::getInputModeSafe(int source) const +InputDevice DSQ::getInputModeSafe(int source) const { return source < 0 ? lastInputMode : (size_t(source) < _inputModes.size() ? _inputModes[source] : INPUT_NODEVICE); @@ -4585,4 +4585,4 @@ bool DSQ::useMouseInput() const bool DSQ::useJoystickInput() const { return lastInputMode == INPUT_JOYSTICK; -} \ No newline at end of file +} diff --git a/Aquaria/Game.cpp b/Aquaria/Game.cpp index c995830..0f36092 100644 --- a/Aquaria/Game.cpp +++ b/Aquaria/Game.cpp @@ -4245,13 +4245,13 @@ void Game::updateCursor(float dt) { bool rotate = false; - if (dsq->inputMode == INPUT_MOUSE) + if (dsq->getInputMode() == INPUT_MOUSE) { dsq->cursor->offset.stop(); dsq->cursor->offset = Vector(0,0); //debugLog("offset lerp stop in mouse!"); } - else if (dsq->inputMode == INPUT_JOYSTICK) + else if (dsq->getInputMode() == INPUT_JOYSTICK) { if (!dsq->game->isPaused() || dsq->game->isInGameMenu() || !dsq->game->avatar->isInputEnabled()) { @@ -4284,7 +4284,7 @@ void Game::updateCursor(float dt) // Don't show the cursor in keyboard/joystick mode if it's not // already visible (this keeps the cursor from appearing for an // instant during map fadeout). - if (dsq->inputMode == INPUT_MOUSE || isSceneEditorActive() || dsq->game->isPaused()) + if (dsq->getInputMode() == INPUT_MOUSE || isSceneEditorActive() || dsq->game->isPaused()) dsq->cursor->alphaMod = 0.5; /* @@ -4295,7 +4295,7 @@ void Game::updateCursor(float dt) else if (avatar) { //Vector v = avatar->getVectorToCursorFromScreenCentre(); - if (dsq->inputMode == INPUT_JOYSTICK)// && !avatar->isSinging() && !dsq->game->isInGameMenu() && !dsq->game->isPaused()) + if (dsq->getInputMode() == INPUT_JOYSTICK)// && !avatar->isSinging() && !dsq->game->isInGameMenu() && !dsq->game->isPaused()) { dsq->cursor->alphaMod = 0; if (!avatar->isSinging())