mirror of
https://github.com/AquariaOSE/Aquaria.git
synced 2025-02-20 11:55:02 +00:00
Rix mouse button emulation that broke somewhere along the way
This commit is contained in:
parent
d49531f486
commit
15c78dd2e4
4 changed files with 49 additions and 50 deletions
|
@ -3788,11 +3788,50 @@ void DSQ::jiggleCursor()
|
||||||
SDL_ShowCursor(SDL_DISABLE);
|
SDL_ShowCursor(SDL_DISABLE);
|
||||||
}
|
}
|
||||||
|
|
||||||
float skipSfxVol = 1.0;
|
void DSQ::updateActionButtons()
|
||||||
|
{
|
||||||
|
// HACK: not optimal
|
||||||
|
|
||||||
|
// This must be done *before* Core::updateActionButtons()
|
||||||
|
// for LMB/RMB emulation to work properly -- fg
|
||||||
|
if (/*inputMode != INPUT_KEYBOARD &&*/ game->isActive())
|
||||||
|
{
|
||||||
|
for(size_t i = 0; i < almb.size(); ++i)
|
||||||
|
if (ActionMapper::getKeyState(almb[i]->key[0]) || ActionMapper::getKeyState(almb[i]->key[1]))
|
||||||
|
{
|
||||||
|
mouse.buttons.left = DOWN;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
for(size_t i = 0; i < armb.size(); ++i)
|
||||||
|
if (ActionMapper::getKeyState(armb[i]->key[0]) || ActionMapper::getKeyState(armb[i]->key[1]))
|
||||||
|
{
|
||||||
|
mouse.buttons.right = DOWN;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if (joystickAsMouse)
|
||||||
|
{
|
||||||
|
for(size_t i = 0; i < almb.size(); ++i)
|
||||||
|
if (ActionMapper::getKeyState(almb[i]->joy[0]))
|
||||||
|
{
|
||||||
|
mouse.buttons.left = DOWN;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
for(size_t i = 0; i < armb.size(); ++i)
|
||||||
|
if (ActionMapper::getKeyState(armb[i]->joy[0]))
|
||||||
|
{
|
||||||
|
mouse.buttons.right = DOWN;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
Core::updateActionButtons();
|
||||||
|
}
|
||||||
|
|
||||||
|
static float skipSfxVol = 1.0;
|
||||||
void DSQ::onUpdate(float dt)
|
void DSQ::onUpdate(float dt)
|
||||||
{
|
{
|
||||||
|
|
||||||
|
|
||||||
if (isSkippingCutscene())
|
if (isSkippingCutscene())
|
||||||
{
|
{
|
||||||
if (!isInCutscene())
|
if (!isInCutscene())
|
||||||
|
@ -3838,13 +3877,12 @@ void DSQ::onUpdate(float dt)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// This queries pressed keys and updates ActionMapper
|
||||||
Core::onUpdate(dt);
|
Core::onUpdate(dt);
|
||||||
|
|
||||||
|
|
||||||
mod.update(dt);
|
mod.update(dt);
|
||||||
|
|
||||||
lockMouse();
|
|
||||||
|
|
||||||
if (dsq->game && watchForQuit && isNested())
|
if (dsq->game && watchForQuit && isNested())
|
||||||
{
|
{
|
||||||
if (dsq->game->isActing(ACTION_ESC, -1))
|
if (dsq->game->isActing(ACTION_ESC, -1))
|
||||||
|
@ -3872,40 +3910,6 @@ void DSQ::onUpdate(float dt)
|
||||||
|
|
||||||
demo.update(dt);
|
demo.update(dt);
|
||||||
|
|
||||||
// HACK: not optimal
|
|
||||||
|
|
||||||
if (/*inputMode != INPUT_KEYBOARD &&*/ game->isActive())
|
|
||||||
{
|
|
||||||
for(size_t i = 0; i < almb.size(); ++i)
|
|
||||||
if (ActionMapper::getKeyState(almb[i]->key[0]) || ActionMapper::getKeyState(almb[i]->key[1]))
|
|
||||||
{
|
|
||||||
mouse.buttons.left = DOWN;
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
for(size_t i = 0; i < armb.size(); ++i)
|
|
||||||
if (ActionMapper::getKeyState(armb[i]->key[0]) || ActionMapper::getKeyState(armb[i]->key[1]))
|
|
||||||
{
|
|
||||||
mouse.buttons.right = DOWN;
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
if (joystickAsMouse)
|
|
||||||
{
|
|
||||||
for(size_t i = 0; i < almb.size(); ++i)
|
|
||||||
if (ActionMapper::getKeyState(almb[i]->joy[0]))
|
|
||||||
{
|
|
||||||
mouse.buttons.left = DOWN;
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
for(size_t i = 0; i < armb.size(); ++i)
|
|
||||||
if (ActionMapper::getKeyState(armb[i]->joy[0]))
|
|
||||||
{
|
|
||||||
mouse.buttons.right = DOWN;
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
if (joystickEnabled)
|
if (joystickEnabled)
|
||||||
{
|
{
|
||||||
if (dsq->inputMode != INPUT_JOYSTICK)
|
if (dsq->inputMode != INPUT_JOYSTICK)
|
||||||
|
@ -4024,7 +4028,7 @@ void DSQ::onUpdate(float dt)
|
||||||
os << '-';
|
os << '-';
|
||||||
os << "], (" << j->position.x << ", " << j->position.y << "), ("<< j->rightStick.x << ", " << j->rightStick.y << ")\n";
|
os << "], (" << j->position.x << ", " << j->position.y << "), ("<< j->rightStick.x << ", " << j->rightStick.y << ")\n";
|
||||||
}
|
}
|
||||||
os << "altState: " << core->getKeyState(KEY_LALT) << " | " << core->getKeyState(KEY_RALT) << std::endl;
|
os << "altState: " << core->getKeyState(KEY_LALT) << " | " << core->getKeyState(KEY_RALT) << " mb: " << mouse.buttons.left << mouse.buttons.middle << mouse.buttons.right << std::endl;
|
||||||
os << "PMFree: " << particleManager->getFree() << " Active: " << particleManager->getNumActive() << std::endl;
|
os << "PMFree: " << particleManager->getFree() << " Active: " << particleManager->getNumActive() << std::endl;
|
||||||
os << "cameraPos: (" << dsq->cameraPos.x << ", " << dsq->cameraPos.y << ")" << std::endl;
|
os << "cameraPos: (" << dsq->cameraPos.x << ", " << dsq->cameraPos.y << ")" << std::endl;
|
||||||
os << "worldType: " << continuity.getWorldType() << " worldPaused: " << game->isWorldPaused() << std::endl;
|
os << "worldType: " << continuity.getWorldType() << " worldPaused: " << game->isWorldPaused() << std::endl;
|
||||||
|
@ -4108,9 +4112,6 @@ void DSQ::onUpdate(float dt)
|
||||||
|
|
||||||
updatepecue(dt);
|
updatepecue(dt);
|
||||||
|
|
||||||
|
|
||||||
lockMouse();
|
|
||||||
|
|
||||||
Network::update();
|
Network::update();
|
||||||
|
|
||||||
Shot::clearShotGarbage();
|
Shot::clearShotGarbage();
|
||||||
|
@ -4118,10 +4119,6 @@ void DSQ::onUpdate(float dt)
|
||||||
AquariaGuiElement::UpdateGlobalFocus(dt);
|
AquariaGuiElement::UpdateGlobalFocus(dt);
|
||||||
}
|
}
|
||||||
|
|
||||||
void DSQ::lockMouse()
|
|
||||||
{
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
void DSQ::shakeCamera(float mag, float time)
|
void DSQ::shakeCamera(float mag, float time)
|
||||||
{
|
{
|
||||||
|
|
|
@ -210,8 +210,6 @@ public:
|
||||||
|
|
||||||
void applyParallaxUserSettings();
|
void applyParallaxUserSettings();
|
||||||
|
|
||||||
void lockMouse();
|
|
||||||
|
|
||||||
void nag(NagType type);
|
void nag(NagType type);
|
||||||
|
|
||||||
void action(int id, int state, int source);
|
void action(int id, int state, int source);
|
||||||
|
@ -557,6 +555,8 @@ protected:
|
||||||
virtual void onJoystickAdded(int deviceID);
|
virtual void onJoystickAdded(int deviceID);
|
||||||
virtual void onJoystickRemoved(int instanceID);
|
virtual void onJoystickRemoved(int instanceID);
|
||||||
|
|
||||||
|
virtual void updateActionButtons();
|
||||||
|
|
||||||
public:
|
public:
|
||||||
void fixupJoysticks();
|
void fixupJoysticks();
|
||||||
void initActionButtons();
|
void initActionButtons();
|
||||||
|
|
|
@ -686,6 +686,8 @@ void Core::onUpdate(float dt)
|
||||||
|
|
||||||
pollEvents(dt);
|
pollEvents(dt);
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
ActionMapper::onUpdate(dt);
|
ActionMapper::onUpdate(dt);
|
||||||
StateManager::onUpdate(dt);
|
StateManager::onUpdate(dt);
|
||||||
|
|
||||||
|
|
|
@ -552,7 +552,7 @@ protected:
|
||||||
std::string _extraDataDir;
|
std::string _extraDataDir;
|
||||||
|
|
||||||
std::vector<ActionButtonStatus*> actionStatus;
|
std::vector<ActionButtonStatus*> actionStatus;
|
||||||
void updateActionButtons();
|
virtual void updateActionButtons();
|
||||||
void clearActionButtons();
|
void clearActionButtons();
|
||||||
|
|
||||||
public:
|
public:
|
||||||
|
|
Loading…
Add table
Reference in a new issue