Improved three-key support. Default theme should be completely usable with three-key cabinets if ThreeKeyNavigation pref is true. Added ThreeKeyNavigation pref. ScreenOptions:NavigationMode metric now uses that pref to decide between normal and toggle modes. Added GoToFirstOnStart to OptionRowHandlerLua so an option row can control that behavior. Rewrote input for default's ScreenSelectProfile to use an input callback to take advantage of menu button mapping. Fixed inconsistent indentation in ORHL documentation.

This commit is contained in:
Kyzentun
2014-08-02 00:38:46 -07:00
committed by Jonathan Payne
parent ea74aa74bc
commit 3945a4a34b
16 changed files with 141 additions and 79 deletions
@@ -23,6 +23,11 @@ function FooMods()
-- the entry in the "OptionTitles" section of the language file.
Name= "Foo",
-- A boolean that controls whether this row goes to the "next row"
-- element when NavigationMode for the screen is "toggle" and the
-- ArcadeOptionsNavigation preference is 1.
GoToFirstOnStart= false,
-- A boolean controlling whether the choice affects all players.
OneChoiceForAllPlayers= false,
+5
View File
@@ -489,6 +489,7 @@ Test Input=Test the responsiveness of connected joysticks.
Test Lights=Test the responsiveness of connected lights.
TextureColorDepth=Choose the color depth of textures. 32 bit textures use more memory, but look nicer.
Theme=Choose from this list of installed theme packs.
ThreeKeyNavigation=&oq;Five Key&oq;: L/R/D/U menu buttons and Start. &oq;Three Key&oq;: L/R menu buttons and Start.
TimingWindowScale=Increase this value to cause your steps to be judged more strictly (i.e. shrink the timing window).
Toggle Song=Toggle Song
Turn=Turn
@@ -663,6 +664,7 @@ Expand 2->3=Expand 2->3
Expand 2x=Expand 2x
Expand 3->4=Expand 3->4
Fast=Fast
Five Key Menu=Five Key
Flat=Flat
Flip=Flip
Floored=Floored
@@ -702,6 +704,7 @@ Mirror=Mirror
N/A=N/A
Native Language=Native Language
Never=Never
NextRow=&nextrow;
New=New
NewEdit=-New Edit-
No=No
@@ -784,6 +787,7 @@ Swap Sides=Swap Sides
Sync Machine=Sync Machine
Sync Song=Sync Song
Sync Tempo=Sync Tempo
Three Key Menu=Three Key
Tiny=Tiny
Tipsy=Tipsy
Title Only=Title Only
@@ -1119,6 +1123,7 @@ Test Input=Test Input
Test Lights=Test Lights
TextureColorDepth=Texture Color
Theme=Theme
ThreeKeyNavigation=Menu Navigation
TimingWindowScale=Judge Difficulty
Transform=Transform
Transfer Edits to USB=Transfer Edits to USB
+8
View File
@@ -133,6 +133,14 @@ function Song:GetStageCost()
return self:IsMarathon() and 3 or self:IsLong() and 2 or 1
end
function OptionsNavigationMode()
if PREFSMAN:GetPreference("ThreeKeyNavigation") then
return "toggle"
else
return "normal"
end
end
-- (c) 2005 Chris Danford
-- All rights reserved.
--
@@ -439,6 +439,7 @@ function ArbitrarySpeedMods()
NumPlayers= 0 -- for ease when adjusting for the status elements.
}
for i, pn in ipairs(GAMESTATE:GetEnabledPlayers()) do
if GAMESTATE:IsHumanPlayer(pn) then
local poptions= GAMESTATE:GetPlayerState(pn):GetPlayerOptions("ModsLevel_Preferred")
local speed= nil
local mode= nil
@@ -455,6 +456,7 @@ function ArbitrarySpeedMods()
ret.CurValues[pn]= {mode= mode, speed= speed}
ret.NumPlayers= ret.NumPlayers + 1
end
end
ret:GenChoices()
return ret
end
+4 -3
View File
@@ -2218,7 +2218,7 @@ ScreenBeginCommand=
[ScreenOptions]
Fallback="ScreenWithMenuElements"
NavigationMode="normal"
NavigationMode=OptionsNavigationMode()
InputMode="individual"
ForceAllPlayers=false
#
@@ -3002,12 +3002,13 @@ Line14="conf,ShowSongOptions"
Fallback="ScreenOptionsServiceChild"
NextScreen="ScreenOptionsService"
PrevScreen="ScreenOptionsService"
LineNames="1,2,3,4,5"
LineNames="1,2,3,4,5,6"
Line1="conf,AutoMapOnJoyChange"
Line2="conf,OnlyDedicatedMenuButtons"
Line3="conf,DelayedBack"
Line4="conf,ArcadeOptionsNavigation"
Line5="conf,MusicWheelSwitchSpeed"
Line5="conf,ThreeKeyNavigation"
Line6="conf,MusicWheelSwitchSpeed"
[ScreenOptionsArcade]
Fallback="ScreenOptionsServiceChild"
@@ -193,53 +193,67 @@ function UpdateInternal3(self, Player)
end;
end;
-- Will be set to the main ActorFrame for the screen in its OnCommand.
local main_frame= false
local function input(event)
if event.type == "InputEventType_Release" then return end
local pn= event.PlayerNumber
local code= event.GameButton
if not pn or not code then return end
local input_functions= {
Start= function()
MESSAGEMAN:Broadcast("StartButton")
if not GAMESTATE:IsHumanPlayer(pn) then
SCREENMAN:GetTopScreen():SetProfileIndex(pn, -1)
else
SCREENMAN:GetTopScreen():Finish()
end
end,
Back= function()
if GAMESTATE:GetNumPlayersEnabled()==0 then
SCREENMAN:GetTopScreen():Cancel()
else
MESSAGEMAN:Broadcast("BackButton")
SCREENMAN:GetTopScreen():SetProfileIndex(pn, -2)
end
end,
MenuUp= function()
if GAMESTATE:IsHumanPlayer(pn) then
local ind = SCREENMAN:GetTopScreen():GetProfileIndex(pn)
if ind > 1 then
if SCREENMAN:GetTopScreen():SetProfileIndex(pn, ind - 1) then
MESSAGEMAN:Broadcast("DirectionButton")
main_frame:queuecommand('UpdateInternal2')
end
end
end
end,
MenuDown= function()
if GAMESTATE:IsHumanPlayer(pn) then
local ind = SCREENMAN:GetTopScreen():GetProfileIndex(pn)
if ind > 0 then
if SCREENMAN:GetTopScreen():SetProfileIndex(pn, ind + 1) then
MESSAGEMAN:Broadcast("DirectionButton")
main_frame:queuecommand('UpdateInternal2')
end
end
end
end
}
input_functions.MenuLeft= input_functions.MenuUp
input_functions.MenuRight= input_functions.MenuDown
if input_functions[code] then
input_functions[code]()
end
end
local t = Def.ActorFrame {
StorageDevicesChangedMessageCommand=function(self, params)
self:queuecommand('UpdateInternal2');
end;
CodeMessageCommand = function(self, params)
if params.Name == 'Start' or params.Name == 'Center' then
MESSAGEMAN:Broadcast("StartButton");
if not GAMESTATE:IsHumanPlayer(params.PlayerNumber) then
SCREENMAN:GetTopScreen():SetProfileIndex(params.PlayerNumber, -1);
else
SCREENMAN:GetTopScreen():Finish();
end;
end;
if params.Name == 'Up' or params.Name == 'Up2' or params.Name == 'DownLeft' then
if GAMESTATE:IsHumanPlayer(params.PlayerNumber) then
local ind = SCREENMAN:GetTopScreen():GetProfileIndex(params.PlayerNumber);
if ind > 1 then
if SCREENMAN:GetTopScreen():SetProfileIndex(params.PlayerNumber, ind - 1 ) then
MESSAGEMAN:Broadcast("DirectionButton");
self:queuecommand('UpdateInternal2');
end;
end;
end;
end;
if params.Name == 'Down' or params.Name == 'Down2' or params.Name == 'DownRight' then
if GAMESTATE:IsHumanPlayer(params.PlayerNumber) then
local ind = SCREENMAN:GetTopScreen():GetProfileIndex(params.PlayerNumber);
if ind > 0 then
if SCREENMAN:GetTopScreen():SetProfileIndex(params.PlayerNumber, ind + 1 ) then
MESSAGEMAN:Broadcast("DirectionButton");
self:queuecommand('UpdateInternal2');
end;
end;
end;
end;
if params.Name == 'Back' then
if GAMESTATE:GetNumPlayersEnabled()==0 then
SCREENMAN:GetTopScreen():Cancel();
else
MESSAGEMAN:Broadcast("BackButton");
SCREENMAN:GetTopScreen():SetProfileIndex(params.PlayerNumber, -2);
end;
end;
end;
PlayerJoinedMessageCommand=function(self, params)
self:queuecommand('UpdateInternal2');
end;
@@ -249,6 +263,8 @@ local t = Def.ActorFrame {
end;
OnCommand=function(self, params)
main_frame= self:GetParent()
SCREENMAN:GetTopScreen():AddInputCallback(input)
self:queuecommand('UpdateInternal2');
end;
+6 -1
View File
@@ -803,7 +803,7 @@ bool OptionRow::SetSelected( PlayerNumber pn, int iChoice, bool b )
bool OptionRow::NotifyHandlerOfSelection(PlayerNumber pn, int choice)
{
bool changed= m_pHand->NotifyOfSelection(pn, choice);
bool changed= m_pHand->NotifyOfSelection(pn, choice - m_bFirstItemGoesDown);
if(changed)
{
ChoicesChanged(m_RowType, false);
@@ -820,6 +820,11 @@ bool OptionRow::NotifyHandlerOfSelection(PlayerNumber pn, int choice)
return changed;
}
bool OptionRow::GoToFirstOnStart()
{
return m_pHand->GoToFirstOnStart();
}
void OptionRow::SetExitText( RString sExitText )
{
BitmapText *bt = m_textItems.back();
+1
View File
@@ -112,6 +112,7 @@ public:
// ScreenOptions calls positions m_FrameDestination, then m_Frame tween to that same TweenState.
unsigned GetTextItemsSize() const { return m_textItems.size(); }
bool GetFirstItemGoesDown() const { return m_bFirstItemGoesDown; }
bool GoToFirstOnStart();
RString GetThemedItemText( int iChoice ) const;
+10 -1
View File
@@ -833,8 +833,9 @@ public:
LuaReference m_EnabledForPlayersFunc;
bool m_TableIsSane;
bool m_GoToFirstOnStart;
OptionRowHandlerLua(): m_TableIsSane(false)
OptionRowHandlerLua(): m_TableIsSane(false), m_GoToFirstOnStart(false)
{ m_pLuaTable = new LuaReference; Init(); }
virtual ~OptionRowHandlerLua() { delete m_pLuaTable; }
void Init()
@@ -1030,6 +1031,10 @@ public:
m_Def.m_sName = pStr;
lua_pop( L, 1 );
lua_getfield(L, -1, "GoToFirstOnStart");
m_GoToFirstOnStart= lua_toboolean(L, -1);
lua_pop(L, 1);
lua_getfield(L, -1, "OneChoiceForAllPlayers");
m_Def.m_bOneChoiceForAllPlayers = lua_toboolean( L, -1 );
lua_pop( L, 1 );
@@ -1253,6 +1258,10 @@ public:
LUA->Release(L);
return changed;
}
virtual bool GoToFirstOnStart()
{
return m_GoToFirstOnStart;
}
};
class OptionRowHandlerConfig : public OptionRowHandler
+1
View File
@@ -180,6 +180,7 @@ public:
virtual RString GetScreen( int /* iChoice */ ) const { return RString(); }
// Exists so that a lua function can act on the selection. Returns true if the choices should be reloaded.
virtual bool NotifyOfSelection(PlayerNumber pn, int choice) { return false; }
virtual bool GoToFirstOnStart() { return true; }
};
/** @brief Utilities for the OptionRowHandlers. */
+1
View File
@@ -199,6 +199,7 @@ PrefsManager::PrefsManager() :
m_bShowCaution ( "ShowCaution", true ),
m_bShowNativeLanguage ( "ShowNativeLanguage", true ),
m_iArcadeOptionsNavigation ( "ArcadeOptionsNavigation", 0 ),
m_ThreeKeyNavigation("ThreeKeyNavigation", false),
m_MusicWheelUsesSections ( "MusicWheelUsesSections", MusicWheelUsesSections_ALWAYS ),
m_iMusicWheelSwitchSpeed ( "MusicWheelSwitchSpeed", 15 ),
m_AllowW1 ( "AllowW1", ALLOW_W1_EVERYWHERE ),
+1
View File
@@ -191,6 +191,7 @@ public:
Preference<bool> m_bShowCaution;
Preference<bool> m_bShowNativeLanguage;
Preference<int> m_iArcadeOptionsNavigation;
Preference<bool> m_ThreeKeyNavigation;
Preference<MusicWheelUsesSections> m_MusicWheelUsesSections;
Preference<int> m_iMusicWheelSwitchSpeed;
Preference<AllowW1> m_AllowW1; // this should almost always be on, given use cases. -aj
+6
View File
@@ -79,6 +79,11 @@ public:
lua_pushnumber( L, pRect->bottom );
return 4;
}
static int GetNumFrames(T* p, lua_State* L)
{
lua_pushnumber(L, p->GetNumFrames());
return 1;
}
LunaRageTexture()
{
@@ -86,6 +91,7 @@ public:
ADD_METHOD( loop );
ADD_METHOD( rate );
ADD_METHOD( GetTextureCoordRect );
ADD_METHOD( GetNumFrames );
}
};
+1 -1
View File
@@ -916,7 +916,7 @@ void ScreenOptions::ProcessMenuStart( const InputEventPlus &input )
msg.SetParam( "Selected", bSelected );
MESSAGEMAN->Broadcast( msg );
if( row.GetFirstItemGoesDown() )
if(row.GetFirstItemGoesDown() && row.GoToFirstOnStart())
{
// move to the first choice in the row
ChangeValueInRowRelative( m_iCurrentRow[pn], pn, -row.GetChoiceInRowWithFocus(pn), input.type != IET_FIRST_PRESS );
+1
View File
@@ -705,6 +705,7 @@ static void InitializeConfOptions()
ADD( ConfOption( "AutoPlay", MovePref<PlayerController>, "Off","On","CPU-Controlled" ) );
ADD( ConfOption( "DelayedBack", MovePref<bool>, "Instant","Hold" ) );
ADD( ConfOption( "ArcadeOptionsNavigation", MovePref<bool>, "StepMania Style","Arcade Style" ) );
ADD( ConfOption( "ThreeKeyNavigation", MovePref<bool>, "Five Key Menu", "Three Key Menu" ) );
ADD( ConfOption( "MusicWheelSwitchSpeed", MusicWheelSwitchSpeed, "Slow","Normal","Fast","Really Fast" ) );
// Gameplay options