1
0
Fork 0
mirror of https://github.com/AquariaOSE/Aquaria.git synced 2024-11-25 17:53:47 +00:00

Get rid of MenuUp, MenuDown, MenuLeft, MenuRight action entries

This makes ACTION_MENU* internal and non-configurable, but Lua code
can still rely on those actions being sent so that controller input
can be interpreted as menu input where appropriate.

Closes #58.
This commit is contained in:
fgenesis 2017-02-20 03:02:58 +01:00
parent d0bb8746ae
commit 4e7e0df524
5 changed files with 17 additions and 13 deletions

View file

@ -382,7 +382,9 @@ bool AquariaSlider::doSliderInput(float dt)
float inputAmount; // How much to adjust by?
Vector jpos;
// disabled the jaxis threshold check;
// ACTION_MENU* should be sent automatically when above the threshold -- fg
/*Vector jpos;
for(size_t i = 0; i < core->getNumJoysticks(); ++i)
if(Joystick *j = core->getJoystick(i))
if(j->isEnabled())
@ -390,14 +392,14 @@ bool AquariaSlider::doSliderInput(float dt)
jpos = core->getJoystick(i)->position;
if(fabsf(jpos.x) > SLIDER_JOY_THRESHOLD)
break;
}
}*/
StateObject *obj = dsq->getTopStateObject();
if (jpos.x <= -SLIDER_JOY_THRESHOLD)
/*if (jpos.x <= -SLIDER_JOY_THRESHOLD)
inputAmount = -0.1f;
else if (jpos.x >= SLIDER_JOY_THRESHOLD)
inputAmount = +0.1f;
else if (obj && obj->isActing(ACTION_MENULEFT, -1))
else*/ if (obj && obj->isActing(ACTION_MENULEFT, -1))
inputAmount = -0.1f;
else if (obj && obj->isActing(ACTION_MENURIGHT, -1))
inputAmount = +0.1f;

View file

@ -2564,6 +2564,16 @@ void Game::action(int id, int state, int source, InputDevice device)
{
if (id == ACTION_TOGGLEGRID && !state) toggleGridRender();
}
// Forward these to Lua scripts (because digital swim movement should be seen as menu movement as well)
if(id == ACTION_SWIMLEFT)
action(ACTION_MENULEFT, state, source, device);
else if(id == ACTION_SWIMRIGHT)
action(ACTION_MENURIGHT, state, source, device);
else if(id == ACTION_SWIMUP)
action(ACTION_MENUUP, state, source, device);
else if(id == ACTION_SWIMDOWN)
action(ACTION_MENUDOWN, state, source, device);
}
void Game::toggleWorldMap()

View file

@ -60,6 +60,7 @@ enum AquariaActions
ACTION_TOGGLEGRID =5,
// Automatically sent on either ACTION_SWIM* or sufficient analog controller input
ACTION_MENULEFT =6,
ACTION_MENURIGHT =7,
ACTION_MENUUP =8,

View file

@ -948,7 +948,6 @@ void InGameMenu::bindInput()
as.importAction(this, "MenuDown", ACTION_MENUDOWN, sourceID);
as.importAction(this, "MenuLeft", ACTION_MENULEFT, sourceID);
as.importAction(this, "MenuRight", ACTION_MENURIGHT, sourceID);
}
}
@ -2165,10 +2164,6 @@ void InGameMenu::create()
addKeyConfigLine(kk, SB(2116), "Escape", offx, y+=yi, true);
addKeyConfigLine(kk, SB(2128), "ToggleHelp", offx, y+=yi);
addKeyConfigLine(kk, SB(2135), "MenuUp", offx, y+=yi);
addKeyConfigLine(kk, SB(2136), "MenuDown", offx, y+=yi);
addKeyConfigLine(kk, SB(2137), "MenuLeft", offx, y+=yi);
addKeyConfigLine(kk, SB(2138), "MenuRight", offx, y+=yi);
addKeyConfigLine(kk, SB(2121), "PrevPage", offx, y+=yi);
addKeyConfigLine(kk, SB(2122), "NextPage", offx, y+=yi);
addKeyConfigLine(kk, SB(2123), "CookFood", offx, y+=yi);

View file

@ -286,10 +286,6 @@ static void ensureDefaultActions(ActionSet& as)
as.addActionInput("SwimDown");
as.addActionInput("SwimLeft");
as.addActionInput("SwimRight");
as.addActionInput("MenuUp");
as.addActionInput("MenuDown");
as.addActionInput("MenuLeft");
as.addActionInput("MenuRight");
as.addActionInput("Roll");
as.addActionInput("Revert");
as.addActionInput("WorldMap");