Merge branch 'master' of https://github.com/stepmania/stepmania
This commit is contained in:
+2
-1
@@ -57,6 +57,7 @@ src/stamp-h1
|
||||
Docs/doxygen
|
||||
PBProject/build
|
||||
Xcode/build
|
||||
Xcode/*.xcodeproj/xcuserdata/
|
||||
*.xcodeproj/xcuserdata
|
||||
*.xcodeproj/project.xcworkspace
|
||||
src/build-*
|
||||
@@ -129,4 +130,4 @@ bundle/ffmpeg/*/*.ver
|
||||
bundle/ffmpeg/*/*.def
|
||||
bundle/ffmpeg/*/*.orig.def
|
||||
bundle/ffmpeg/*/*.dll.a
|
||||
bundle/ffmpeg/*/*.lib
|
||||
bundle/ffmpeg/*/*.lib
|
||||
|
||||
@@ -4809,6 +4809,22 @@ save yourself some time, copy this for undocumented things:
|
||||
</Function>
|
||||
</Class>
|
||||
<Class name='TimingData'>
|
||||
<Description>
|
||||
GetBPMsAndTimes, GetStops, GetDelays, GetLabels, GetWarps, GetCombos, GetTimeSignatures, GetTickcounts, GetFakes, GetScrolls, and GetSpeeds all have two different modes.<br />
|
||||
If the metric TimingData:GetReturnsNumbers is false (the default), they return tables of strings. The strings are numbers separated by '='.<br />
|
||||
If the metric TimingData:GetReturnsNumbers is true, they return tables of tables, and the inner tables contain numbers as described for each function.<br />
|
||||
The first form is kept around and is the default for compatibility with older themes. The advantage of the second form is that you no longer need to have a bit of code in your theme to transform the string into a table of numbers before you can use it.<br />
|
||||
Example:<br />
|
||||
local bpmsand= timing_data:GetBPMsAndTimes()<br />
|
||||
for i, s in ipairs(bpmsand) do<br />
|
||||
local sand= split("=", s)<br />
|
||||
bpmsand[i]= {tonumber(sand[1]), tonumber(sand[2])}<br />
|
||||
end<br />
|
||||
-- do something that looks at all the bpms and times. <br />
|
||||
Becomes:<br />
|
||||
local bpmsand= timing_data:GetBPMsAndTimes()<br />
|
||||
-- do something that looks at all the bpms and times. <br />
|
||||
</Description>
|
||||
<Function name='GetActualBPM' return='{float}' arguments=''>
|
||||
Returns the minimum and maximum BPM of the song in a table (in that order).
|
||||
</Function>
|
||||
@@ -4818,44 +4834,44 @@ save yourself some time, copy this for undocumented things:
|
||||
<Function name='GetBPMAtBeat' return='float' arguments='float fBeat'>
|
||||
Returns the BPM at <code>fBeat</code>.
|
||||
</Function>
|
||||
<Function name='GetBPMs' return='{string}' arguments=''>
|
||||
Returns a table of the BPMs as strings.
|
||||
<Function name='GetBPMs' return='{float}' arguments=''>
|
||||
Returns a table of the BPMs as floats.
|
||||
</Function>
|
||||
<Function name='GetBPMsAndTimes' return='{string}' arguments=''>
|
||||
Returns a table of the BPMs and the times they happen as strings with the format "<code>beat=BPM</code>".
|
||||
<Function name='GetBPMsAndTimes' return='{{float, float}}' arguments=''>
|
||||
Returns a table of the BPMs and the times they happen as tables. The first value is the beat. The second value is the bpm.
|
||||
</Function>
|
||||
<Function name='GetElapsedTimeFromBeat' return='float' arguments='float fBeat'>
|
||||
Returns the elapsed time from <code>fBeat</code>.
|
||||
</Function>
|
||||
<Function name='GetStops' return='{string}' arguments=''>
|
||||
Returns a table of the Stops and the times they happen as strings with the format "<code>beat=stop seconds</code>".
|
||||
<Function name='GetStops' return='{{float, float}}' arguments=''>
|
||||
Returns a table of the Stops and the times they happen as tables. The first value is the beat. The second value is the length.
|
||||
</Function>
|
||||
<Function name='GetDelays' return='{string}' arguments=''>
|
||||
Returns a table of the Delays and the times they happen as strings with the format "<code>beat=stop seconds</code>".
|
||||
<Function name='GetDelays' return='{{float, float}}' arguments=''>
|
||||
Returns a table of the Delays and the times they happen as tables. The first value is the beat. The second value is the length.
|
||||
</Function>
|
||||
<Function name='GetLabels' return='{string}' arguments=''>
|
||||
Returns a table of the Labels and the times they happen as strings with the format "<code>beat=label name</code>."
|
||||
<Function name='GetLabels' return='{{float, string}}' arguments=''>
|
||||
Returns a table of the Labels and the times they happen as tables. The first value is the beat. The second value is the label.
|
||||
</Function>
|
||||
<Function name='GetWarps' return='{string}' arguments=''>
|
||||
Returns a table of the Warps and the times they happen as strings with the format "<code>beat=number of beats warped over</code>."
|
||||
<Function name='GetWarps' return='{{float, float}}' arguments=''>
|
||||
Returns a table of the Warps and the times they happen as tables. The first value is the beat. The second value is the number of beats to warp over.
|
||||
</Function>
|
||||
<Function name='GetCombos' return='{string}' arguments=''>
|
||||
Returns a table of the Combos and the times they happen as strings with the format "<code>beat=combo value</code>."
|
||||
<Function name='GetCombos' return='{{float, float, float}}' arguments=''>
|
||||
Returns a table of the Combos and the times they happen as tables. The first value is the beat. The second value is the combo. The third value is the miss combo.
|
||||
</Function>
|
||||
<Function name='GetTimeSignatures' return='{string}' arguments=''>
|
||||
Returns a table of the Time Signatures and the times they happen as strings with the format "<code>beat=beats per measure (numerator)=denominator</code>."
|
||||
<Function name='GetTimeSignatures' return='{{float, float, float}}' arguments=''>
|
||||
Returns a table of the Time Signatures and the times they happen as tables. The first value is the beat. The second value is the numerator. The third value is the denominator.
|
||||
</Function>
|
||||
<Function name='GetTickcounts' return='{string}' arguments=''>
|
||||
Returns a table of the Tickcountss and the times they happen as strings with the format "<code>beat=number of ticks per beat</code>."
|
||||
<Function name='GetTickcounts' return='{{float, float}}' arguments=''>
|
||||
Returns a table of the Tickcounts and the times they happen as tables. The first value is the beat. The second value is the number of ticks per beat.
|
||||
</Function>
|
||||
<Function name='GetFakes' return='{string}' arguments=''>
|
||||
Returns a table of the Fakes and the times they happen as strings with the format "<code>beat=number of beats to not judge</code>."
|
||||
<Function name='GetFakes' return='{{float, float}}' arguments=''>
|
||||
Returns a table of the Fakes and the times they happen as tables. The first value is the beat. The second value is the number of beats to not judge.
|
||||
</Function>
|
||||
<Function name='GetScrolls' return='{string}' arguments=''>
|
||||
Returns a table of the Scrolls and the times they happen as strings with the format "<code>beat=scroll rate ratio</code>."
|
||||
<Function name='GetScrolls' return='{{float, float}}' arguments=''>
|
||||
Returns a table of the Scrolls and the times they happen as tables. The first value is the beat. The second value is the scroll rate ratio.
|
||||
</Function>
|
||||
<Function name='GetSpeeds' return='{string}' arguments=''>
|
||||
Returns a table of the Speeds and the times they happen as strings with the format "<code>beat=scroll rate ratio=length of time to fully activate=unit of activation (0 for beats, 1 for seconds)</code>."
|
||||
<Function name='GetSpeeds' return='{{float, float}}' arguments=''>
|
||||
Returns a table of the Speeds and the times they happen as tables. The first value is the beat. The second value is the scroll rate ratio. The third value is the length of time to fully activate. The fourth value is the unit of activation (0 for beats, 1 for seconds).
|
||||
</Function>
|
||||
<Function name='HasBPMChanges' return='bool' arguments=''>
|
||||
Returns <code>true</code> if the TimingData contains BPM changes.
|
||||
|
||||
@@ -659,7 +659,7 @@ Double for 1 Credit=Double for 1 Credit
|
||||
Drunk=Drunk
|
||||
Dynamic Random=Dynamic Random
|
||||
Echo=Echo
|
||||
End of Song=End of Song
|
||||
EndOfSong=End of Song
|
||||
FailAtEnd=Fail at end
|
||||
EffectSpeed=Speed
|
||||
EffectPitch=Pitch
|
||||
|
||||
@@ -10,28 +10,6 @@ function AreStageSongModsForced()
|
||||
return GAMESTATE:IsAnExtraStage() or bOni or bBattle or bRave
|
||||
end
|
||||
|
||||
local default_fail_applied= {}
|
||||
|
||||
function ResetDefaultFail()
|
||||
default_fail_applied= {}
|
||||
end
|
||||
|
||||
function SetFail()
|
||||
local sFail = ""
|
||||
if GetGamePref("DefaultFail") then
|
||||
sFail = string.format("FailType_%s", GetGamePref("DefaultFail"))
|
||||
else
|
||||
sFail = "FailType_Off"
|
||||
end
|
||||
for pn in ivalues(GAMESTATE:GetHumanPlayers()) do
|
||||
if not default_fail_applied[pn] then
|
||||
GAMESTATE:GetPlayerState(pn):GetPlayerOptions("ModsLevel_Preferred"):FailSetting(sFail)
|
||||
default_fail_applied[pn]= true
|
||||
MESSAGEMAN:Broadcast( "PlayerOptionsChanged", {PlayerNumber = pn} )
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
function ScreenSelectMusic:setupmusicstagemods()
|
||||
Trace( "setupmusicstagemods" )
|
||||
local pm = GAMESTATE:GetPlayMode()
|
||||
|
||||
@@ -2,7 +2,6 @@
|
||||
function InitGamePrefs()
|
||||
local Prefs =
|
||||
{
|
||||
{ "DefaultFail", "Immediate" },
|
||||
};
|
||||
|
||||
local BPrefs =
|
||||
@@ -150,82 +149,3 @@ end;
|
||||
--[[ end themeoption rows ]]
|
||||
|
||||
--[[ game option rows ]]
|
||||
local fail_choices= { "Immediate","ImmediateContinue", "EndOfSong", "Off" }
|
||||
function GamePrefDefaultFail()
|
||||
return {
|
||||
Name = "GamePrefDefaultFail";
|
||||
LayoutType = "ShowAllInRow";
|
||||
SelectType = "SelectOne";
|
||||
OneChoiceForAllPlayers = true;
|
||||
ExportOnChange = false;
|
||||
Choices = fail_choices;
|
||||
LoadSelections = function(self, list, pn)
|
||||
if ReadGamePrefFromFile("DefaultFail") ~= nil then
|
||||
local default= GetGamePref("DefaultFail")
|
||||
if default then
|
||||
if default == "Immediate" then
|
||||
list[1] = true
|
||||
elseif default == "ImmediateContinue" then
|
||||
list[2] = true
|
||||
elseif default == "EndOfSong" or default == "AtEnd" then
|
||||
list[3] = true
|
||||
elseif default == "Off" then
|
||||
list[4] = true
|
||||
else
|
||||
list[1] = true
|
||||
end
|
||||
else
|
||||
list[1] = true
|
||||
end
|
||||
else
|
||||
WriteGamePrefToFile("DefaultFail","Immediate")
|
||||
list[1] = true
|
||||
end
|
||||
end;
|
||||
SaveSelections = function(self, list, pn)
|
||||
local val
|
||||
if list[1] then
|
||||
val = fail_choices[1]
|
||||
elseif list[2] then
|
||||
val = fail_choices[2]
|
||||
elseif list[3] then
|
||||
val = fail_choices[3]
|
||||
elseif list[4] then
|
||||
val = fail_choices[4]
|
||||
else
|
||||
val = fail_choices[1]
|
||||
end
|
||||
WriteGamePrefToFile("DefaultFail",val)
|
||||
MESSAGEMAN:Broadcast("PreferenceSet", { Message == "Set Preference" } )
|
||||
THEME:ReloadMetrics()
|
||||
end;
|
||||
}
|
||||
end
|
||||
|
||||
function SongPrefFail()
|
||||
-- Apply the default fail type to any players that haven't had it applied.
|
||||
SetFail()
|
||||
return {
|
||||
Name= "Fail",
|
||||
LayoutType= "ShowAllInRow",
|
||||
SelectType= "SelectOne",
|
||||
OneChoiceForAllPlayers= false,
|
||||
ExportOnChange= false,
|
||||
Choices= fail_choices,
|
||||
LoadSelections= function(self, list, pn)
|
||||
local fail= GAMESTATE:GetPlayerState(pn):GetPlayerOptions("ModsLevel_Preferred"):FailSetting():sub(10)
|
||||
for i, c in ipairs(self.Choices) do
|
||||
if c == fail then
|
||||
list[i]= true
|
||||
end
|
||||
end
|
||||
end,
|
||||
SaveSelections= function(self, list, pn)
|
||||
for i, c in ipairs(self.Choices) do
|
||||
if list[i] then
|
||||
GAMESTATE:GetPlayerState(pn):GetPlayerOptions("ModsLevel_Preferred"):FailSetting("FailType_" .. c)
|
||||
end
|
||||
end
|
||||
end
|
||||
}
|
||||
end
|
||||
|
||||
@@ -1816,7 +1816,7 @@ Fallback="ScreenSelectMaster"
|
||||
PrevScreen="ScreenInit"
|
||||
NextScreen="ScreenInit"
|
||||
#
|
||||
ScreenBeginCommand=%ResetDefaultFail
|
||||
ScreenBeginCommand=
|
||||
StopMusicOnBack=true
|
||||
#
|
||||
CoinModeChangeScreen=Branch.TitleMenu()
|
||||
@@ -2955,7 +2955,7 @@ Line6="conf,SoundVolume"
|
||||
Line7="conf,TimingWindowScale"
|
||||
Line8="conf,LifeDifficulty"
|
||||
Line9="conf,AllowW1"
|
||||
LineFA="lua,GamePrefDefaultFail()"
|
||||
LineFA="conf,DefaultFailType"
|
||||
Line10="conf,AutogenSteps"
|
||||
Line11="conf,ShowBanners"
|
||||
Line12="conf,ShowCaution"
|
||||
@@ -3005,7 +3005,7 @@ LineNames="3,4,8,SI,SM,11,13,14,15,16,28,29,30,31"
|
||||
#LineScore="lua,UserPrefScoringMode()"
|
||||
Line3="conf,TimingWindowScale"
|
||||
Line4="conf,LifeDifficulty"
|
||||
Line8="lua,GamePrefDefaultFail()"
|
||||
Line8="conf,DefaultFailType"
|
||||
LineSI="lua,SpeedModIncSize()"
|
||||
LineSM="lua,SpeedModIncLarge()"
|
||||
Line11="conf,AllowW1"
|
||||
@@ -3198,7 +3198,6 @@ LineNames="1,2,3,4,5,6,7,8,9,10"
|
||||
Line1="list,LifeType"
|
||||
Line2="list,BarDrain"
|
||||
Line3="list,BatLives"
|
||||
##Line4="lua,GamePrefDefaultFail()"
|
||||
Line5="list,Assist"
|
||||
Line6="list,Rate"
|
||||
Line7="list,SoundEffect"
|
||||
@@ -3206,7 +3205,7 @@ Line8="list,AutoAdjust"
|
||||
Line9="list,Background"
|
||||
Line10="list,SaveScores"
|
||||
Line11="list,SaveReplays"
|
||||
Line4="lua,SongPrefFail()"
|
||||
Line4="list,Fail"
|
||||
|
||||
[ScreenSplash]
|
||||
Class="ScreenSplash"
|
||||
@@ -4688,3 +4687,6 @@ TimerOnCommand=visible,false
|
||||
|
||||
[PaneDisplay]
|
||||
NullCountString=""
|
||||
|
||||
[TimingData]
|
||||
GetReturnsNumbers=false
|
||||
|
||||
@@ -91,45 +91,38 @@ local function CreateSegments(Player)
|
||||
end;
|
||||
|
||||
for i=2,#bpms do
|
||||
local data = split("=",bpms[i]);
|
||||
bpmFrame[#bpmFrame+1] = CreateLine(data[1], 0,
|
||||
bpmFrame[#bpmFrame+1] = CreateLine(bpms[i][1], 0,
|
||||
"#00808077", "#00808077", "#00808077", "#FF634777", "#FF000077");
|
||||
end;
|
||||
|
||||
for i=1,#delays do
|
||||
local data = split("=",delays[i]);
|
||||
delayFrame[#delayFrame+1] = CreateLine(data[1], data[2],
|
||||
delayFrame[#delayFrame+1] = CreateLine(delays[i][1], delays[i][2],
|
||||
"#FFFF0077", "#FFFF0077", "#FFFF0077", "#00FF0077", "#FF000077");
|
||||
end;
|
||||
|
||||
for i=1,#stops do
|
||||
local data = split("=",stops[i]);
|
||||
stopFrame[#stopFrame+1] = CreateLine(data[1], data[2],
|
||||
stopFrame[#stopFrame+1] = CreateLine(stops[i][1], stops[i][2],
|
||||
"#FFFFFF77", "#FFFFFF77", "#FFFFFF77", "#FFA50077", "#FF000077");
|
||||
end;
|
||||
|
||||
for i=1,#scrolls do
|
||||
local data = split("=",scrolls[i]);
|
||||
scrollFrame[#scrollFrame+1] = CreateLine(data[1], 0,
|
||||
scrollFrame[#scrollFrame+1] = CreateLine(scrolls[i][1], 0,
|
||||
"#4169E177", "#4169E177", "#4169E177", "#0000FF77", "#FF000077");
|
||||
end;
|
||||
|
||||
for i=1,#speeds do
|
||||
local data = split("=",speeds[i]);
|
||||
-- TODO: Turn beats into seconds for this calculation?
|
||||
speedFrame[#speedFrame+1] = CreateLine(data[1], 0,
|
||||
speedFrame[#speedFrame+1] = CreateLine(speeds[i][1], 0,
|
||||
"#ADFF2F77", "#ADFF2F77", "#ADFF2F77", "#7CFC0077", "#FF000077");
|
||||
end;
|
||||
|
||||
for i=1,#warps do
|
||||
local data = split("=",warps[i]);
|
||||
warpFrame[#warpFrame+1] = CreateLine(data[1], 0,
|
||||
warpFrame[#warpFrame+1] = CreateLine(warps[i][1], 0,
|
||||
"#CC00CC77", "#CC00CC77", "#CC00CC77", "#FF33CC77", "#FF000077");
|
||||
end;
|
||||
|
||||
for i=1,#fakes do
|
||||
local data = split("=",fakes[i]);
|
||||
fakeFrame[#fakeFrame+1] = CreateLine(data[1], 0,
|
||||
fakeFrame[#fakeFrame+1] = CreateLine(fakes[i][1], 0,
|
||||
"#BC8F8F77", "#BC8F8F77", "#BC8F8F77", "#F4A46077", "#FF000077");
|
||||
end;
|
||||
end;
|
||||
|
||||
@@ -2335,3 +2335,6 @@ ShowBPMDisplay=false
|
||||
[ScreenJukebox]
|
||||
|
||||
[ScreenCredits]
|
||||
|
||||
[TimingData]
|
||||
GetReturnsNumbers=true
|
||||
|
||||
@@ -499,6 +499,7 @@ static const char *FailTypeNames[] = {
|
||||
};
|
||||
XToString( FailType );
|
||||
XToLocalizedString( FailType );
|
||||
StringToX( FailType );
|
||||
LuaXType( FailType );
|
||||
|
||||
/*
|
||||
|
||||
+21
-5
@@ -7,6 +7,8 @@
|
||||
#include "RageThreads.h"
|
||||
#include "Preference.h"
|
||||
#include "Foreach.h"
|
||||
#include "GameInput.h"
|
||||
#include "InputMapper.h"
|
||||
// for mouse stuff: -aj
|
||||
#include "PrefsManager.h"
|
||||
#include "ScreenDimensions.h"
|
||||
@@ -229,12 +231,26 @@ void InputFilter::CheckButtonChange( ButtonState &bs, DeviceInput di, const Rage
|
||||
{
|
||||
if( bs.m_BeingHeld == bs.m_bLastReportedHeld )
|
||||
return;
|
||||
|
||||
GameInput gi;
|
||||
|
||||
/* If the last IET_FIRST_PRESS or IET_RELEASE event was sent too recently,
|
||||
* wait a while before sending it. */
|
||||
if( now - bs.m_LastReportTime < g_fInputDebounceTime )
|
||||
return;
|
||||
|
||||
/* Possibly apply debounce,
|
||||
* If the input was coin, possibly apply distinct coin debounce in the else below. */
|
||||
if (! INPUTMAPPER->DeviceToGame(di, gi) || gi.button != GAME_BUTTON_COIN )
|
||||
{
|
||||
/* If the last IET_FIRST_PRESS or IET_RELEASE event was sent too recently,
|
||||
* wait a while before sending it. */
|
||||
if( now - bs.m_LastReportTime < g_fInputDebounceTime )
|
||||
{
|
||||
return;
|
||||
}
|
||||
} else {
|
||||
if( now - bs.m_LastReportTime < PREFSMAN->m_fDebounceCoinInputTime )
|
||||
{
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
bs.m_LastReportTime = now;
|
||||
bs.m_bLastReportedHeld = bs.m_BeingHeld;
|
||||
bs.m_fSecsHeld = 0;
|
||||
|
||||
@@ -74,7 +74,7 @@ void PlayerOptions::Init()
|
||||
ZERO( m_bTurns );
|
||||
ZERO( m_bTransforms );
|
||||
m_bMuteOnError = false;
|
||||
m_FailType = FailType_Immediate;
|
||||
m_FailType = PREFSMAN->m_DefaultFailType;
|
||||
m_sNoteSkin = "";
|
||||
}
|
||||
|
||||
|
||||
@@ -254,6 +254,7 @@ PrefsManager::PrefsManager() :
|
||||
m_bAllowMultipleHighScoreWithSameName ( "AllowMultipleHighScoreWithSameName", true ),
|
||||
m_bCelShadeModels ( "CelShadeModels", false ), // Work-In-Progress.. disable by default.
|
||||
m_bPreferredSortUsesGroups ( "PreferredSortUsesGroups", true ),
|
||||
m_fDebounceCoinInputTime ( "DebounceCoinInputTime", 0 ),
|
||||
|
||||
m_fPadStickSeconds ( "PadStickSeconds", 0 ),
|
||||
m_bForceMipMaps ( "ForceMipMaps", false ),
|
||||
@@ -285,6 +286,7 @@ PrefsManager::PrefsManager() :
|
||||
m_sCoursesToShowRanking ( "CoursesToShowRanking", "" ),
|
||||
|
||||
m_bQuirksMode ( "QuirksMode", false ),
|
||||
m_DefaultFailType("DefaultFailtype", FailType_ImmediateContinue),
|
||||
|
||||
/* Debug: */
|
||||
m_bLogToDisk ( "LogToDisk", true ),
|
||||
|
||||
+3
-1
@@ -2,6 +2,7 @@
|
||||
#define PREFSMANAGER_H
|
||||
|
||||
#include "Preference.h"
|
||||
#include "GameConstantsAndTypes.h"
|
||||
|
||||
class IniFile;
|
||||
|
||||
@@ -245,6 +246,7 @@ public:
|
||||
Preference<bool> m_bAllowMultipleHighScoreWithSameName;
|
||||
Preference<bool> m_bCelShadeModels;
|
||||
Preference<bool> m_bPreferredSortUsesGroups;
|
||||
Preference<float> m_fDebounceCoinInputTime; // allow users to apply a distinct debounce to coin input
|
||||
|
||||
// Number of seconds it takes for a button on the controller to release
|
||||
// after pressed.
|
||||
@@ -292,7 +294,7 @@ public:
|
||||
|
||||
/** @brief Enable some quirky behavior used by some older versions of StepMania. */
|
||||
Preference<bool> m_bQuirksMode;
|
||||
// Preference<RString> m_sDefaultFailType; // XXX: Fix fail bug?
|
||||
Preference<FailType> m_DefaultFailType;
|
||||
|
||||
// Debug:
|
||||
Preference<bool> m_bLogToDisk;
|
||||
|
||||
@@ -480,37 +480,6 @@ static int GetLifeDifficulty()
|
||||
LuaFunction( GetLifeDifficulty, GetLifeDifficulty() );
|
||||
|
||||
|
||||
static void DefaultFailType( int &sel, bool ToSel, const ConfOption *pConfOption )
|
||||
{
|
||||
if( ToSel )
|
||||
{
|
||||
PlayerOptions po;
|
||||
po.FromString( PREFSMAN->m_sDefaultModifiers );
|
||||
sel = po.m_FailType;
|
||||
}
|
||||
else
|
||||
{
|
||||
PlayerOptions po;
|
||||
SongOptions so;
|
||||
GetPrefsDefaultModifiers( po, so );
|
||||
|
||||
switch( sel )
|
||||
{
|
||||
case 0: po.m_FailType = FailType_Immediate; break;
|
||||
case 1: po.m_FailType = FailType_ImmediateContinue; break;
|
||||
case 2: po.m_FailType = FailType_EndOfSong; break;
|
||||
case 3: po.m_FailType = FailType_Off; break;
|
||||
default:
|
||||
{
|
||||
LOG->Warn("Invalid fail type %d! Going to use the default...", sel);
|
||||
po.m_FailType = FailType_Immediate; break;
|
||||
}
|
||||
}
|
||||
|
||||
SetPrefsDefaultModifiers( po, so );
|
||||
}
|
||||
}
|
||||
|
||||
// Graphic options
|
||||
struct res_t
|
||||
{
|
||||
@@ -739,7 +708,7 @@ static void InitializeConfOptions()
|
||||
ADD( ConfOption( "ProgressiveLifebar", MovePref<int>, "Off","|1","|2","|3","|4","|5","|6","|7","|8") );
|
||||
ADD( ConfOption( "ProgressiveStageLifebar", MovePref<int>, "Off","|1","|2","|3","|4","|5","|6","|7","|8","Insanity") );
|
||||
ADD( ConfOption( "ProgressiveNonstopLifebar", MovePref<int>, "Off","|1","|2","|3","|4","|5","|6","|7","|8","Insanity") );
|
||||
ADD( ConfOption( "DefaultFailType", DefaultFailType, "Immediate","ImmediateContinue","EndOfSong","Off" ) );
|
||||
ADD( ConfOption( "DefaultFailType", MovePref<FailType>, "Immediate","ImmediateContinue","EndOfSong","Off" ) );
|
||||
ADD( ConfOption( "CoinsPerCredit", CoinsPerCredit, "|1","|2","|3","|4","|5","|6","|7","|8","|9","|10","|11","|12","|13","|14","|15","|16" ) );
|
||||
ADD( ConfOption( "Premium", MovePref<Premium>, "Off","Double for 1 Credit","2 Players for 1 Credit" ) );
|
||||
ADD( ConfOption( "JointPremium", JointPremium, "Off","2 Players for 1 Credit" ) );
|
||||
|
||||
+65
-54
@@ -3,6 +3,7 @@
|
||||
#include "PrefsManager.h"
|
||||
#include "RageUtil.h"
|
||||
#include "RageLog.h"
|
||||
#include "ThemeManager.h"
|
||||
#include "NoteTypes.h"
|
||||
#include "Foreach.h"
|
||||
#include <float.h>
|
||||
@@ -991,6 +992,45 @@ vector<RString> TimingData::ToVectorString(TimingSegmentType tst, int dec) const
|
||||
// lua start
|
||||
#include "LuaBinding.h"
|
||||
|
||||
#define TIMING_DATA_RETURNS_NUMBERS THEME->GetMetricB("TimingData", "GetReturnsNumbers")
|
||||
|
||||
// This breaks encapsulation just as much as TimingData::ToVectorString does.
|
||||
// But, it exists solely for the purpose of providing lua access, so it's as okay as all the other lua stuff that reaches past the encapsulation.
|
||||
void TimingSegmentSetToLuaTable(TimingData* td, TimingSegmentType tst, lua_State *L);
|
||||
void TimingSegmentSetToLuaTable(TimingData* td, TimingSegmentType tst, lua_State *L)
|
||||
{
|
||||
const vector<TimingSegment*> segs= td->GetTimingSegments(tst);
|
||||
lua_createtable(L, segs.size(), 0);
|
||||
if(tst == SEGMENT_LABEL)
|
||||
{
|
||||
for(size_t i= 0; i < segs.size(); ++i)
|
||||
{
|
||||
lua_createtable(L, 2, 0);
|
||||
lua_pushnumber(L, segs[i]->GetBeat());
|
||||
lua_rawseti(L, -2, 1);
|
||||
lua_pushstring(L, (ToLabel(segs[i]))->GetLabel().c_str());
|
||||
lua_rawseti(L, -2, 2);
|
||||
lua_rawseti(L, -2, i+1);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
for(size_t i= 0; i < segs.size(); ++i)
|
||||
{
|
||||
vector<float> values= segs[i]->GetValues();
|
||||
lua_createtable(L, values.size()+1, 0);
|
||||
lua_pushnumber(L, segs[i]->GetBeat());
|
||||
lua_rawseti(L, -2, 1);
|
||||
for(size_t v= 0; v < values.size(); ++v)
|
||||
{
|
||||
lua_pushnumber(L, values[v]);
|
||||
lua_rawseti(L, -2, v+2);
|
||||
}
|
||||
lua_rawseti(L, -2, i+1);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/** @brief Allow Lua to have access to the TimingData. */
|
||||
class LunaTimingData: public Luna<TimingData>
|
||||
{
|
||||
@@ -1002,51 +1042,32 @@ public:
|
||||
static int HasFakes( T* p, lua_State *L ) { lua_pushboolean(L, p->HasFakes()); return 1; }
|
||||
static int HasSpeedChanges( T* p, lua_State *L ) { lua_pushboolean(L, p->HasSpeedChanges()); return 1; }
|
||||
static int HasScrollChanges( T* p, lua_State *L ) { lua_pushboolean(L, p->HasScrollChanges()); return 1; }
|
||||
static int GetWarps( T* p, lua_State *L )
|
||||
{
|
||||
LuaHelpers::CreateTableFromArray(p->ToVectorString(SEGMENT_WARP), L);
|
||||
return 1;
|
||||
}
|
||||
static int GetFakes( T* p, lua_State *L )
|
||||
{
|
||||
LuaHelpers::CreateTableFromArray(p->ToVectorString(SEGMENT_FAKE), L);
|
||||
return 1;
|
||||
}
|
||||
static int GetScrolls( T* p, lua_State *L )
|
||||
{
|
||||
LuaHelpers::CreateTableFromArray(p->ToVectorString(SEGMENT_SCROLL), L);
|
||||
return 1;
|
||||
}
|
||||
static int GetSpeeds( T* p, lua_State *L )
|
||||
{
|
||||
LuaHelpers::CreateTableFromArray(p->ToVectorString(SEGMENT_SPEED), L);
|
||||
return 1;
|
||||
}
|
||||
static int GetTimeSignatures( T* p, lua_State *L )
|
||||
{
|
||||
LuaHelpers::CreateTableFromArray(p->ToVectorString(SEGMENT_TIME_SIG), L);
|
||||
return 1;
|
||||
}
|
||||
static int GetCombos( T* p, lua_State *L )
|
||||
{
|
||||
LuaHelpers::CreateTableFromArray(p->ToVectorString(SEGMENT_COMBO), L);
|
||||
return 1;
|
||||
}
|
||||
static int GetTickcounts( T* p, lua_State *L )
|
||||
{
|
||||
LuaHelpers::CreateTableFromArray(p->ToVectorString(SEGMENT_TICKCOUNT), L);
|
||||
return 1;
|
||||
}
|
||||
static int GetStops( T* p, lua_State *L )
|
||||
{
|
||||
LuaHelpers::CreateTableFromArray(p->ToVectorString(SEGMENT_STOP), L);
|
||||
return 1;
|
||||
}
|
||||
static int GetDelays( T* p, lua_State *L )
|
||||
{
|
||||
LuaHelpers::CreateTableFromArray(p->ToVectorString(SEGMENT_DELAY), L);
|
||||
return 1;
|
||||
#define GET_FUNCTION(get_name, segment_name) \
|
||||
static int get_name(T* p, lua_State* L) \
|
||||
{ \
|
||||
if(TIMING_DATA_RETURNS_NUMBERS) \
|
||||
{ \
|
||||
TimingSegmentSetToLuaTable(p, segment_name, L); \
|
||||
} \
|
||||
else \
|
||||
{ \
|
||||
LuaHelpers::CreateTableFromArray(p->ToVectorString(segment_name), L); \
|
||||
} \
|
||||
return 1; \
|
||||
}
|
||||
|
||||
GET_FUNCTION(GetWarps, SEGMENT_WARP);
|
||||
GET_FUNCTION(GetFakes, SEGMENT_FAKE);
|
||||
GET_FUNCTION(GetScrolls, SEGMENT_SCROLL);
|
||||
GET_FUNCTION(GetSpeeds, SEGMENT_SPEED);
|
||||
GET_FUNCTION(GetTimeSignatures, SEGMENT_TIME_SIG);
|
||||
GET_FUNCTION(GetCombos, SEGMENT_COMBO);
|
||||
GET_FUNCTION(GetTickcounts, SEGMENT_TICKCOUNT);
|
||||
GET_FUNCTION(GetStops, SEGMENT_STOP);
|
||||
GET_FUNCTION(GetDelays, SEGMENT_DELAY);
|
||||
GET_FUNCTION(GetLabels, SEGMENT_LABEL);
|
||||
GET_FUNCTION(GetBPMsAndTimes, SEGMENT_BPM);
|
||||
#undef GET_FUNCTION
|
||||
static int GetBPMs( T* p, lua_State *L )
|
||||
{
|
||||
vector<float> vBPMs;
|
||||
@@ -1058,16 +1079,6 @@ public:
|
||||
LuaHelpers::CreateTableFromArray(vBPMs, L);
|
||||
return 1;
|
||||
}
|
||||
static int GetLabels( T* p, lua_State *L )
|
||||
{
|
||||
LuaHelpers::CreateTableFromArray(p->ToVectorString(SEGMENT_LABEL), L);
|
||||
return 1;
|
||||
}
|
||||
static int GetBPMsAndTimes( T* p, lua_State *L )
|
||||
{
|
||||
LuaHelpers::CreateTableFromArray(p->ToVectorString(SEGMENT_BPM), L);
|
||||
return 1;
|
||||
}
|
||||
static int GetActualBPM( T* p, lua_State *L )
|
||||
{
|
||||
// certainly there's a better way to do it than this? -aj
|
||||
|
||||
@@ -170,6 +170,14 @@ RString ComboSegment::ToString(int dec) const
|
||||
return ssprintf(str.c_str(), GetBeat(), GetCombo(), GetMissCombo());
|
||||
}
|
||||
|
||||
vector<float> ComboSegment::GetValues() const
|
||||
{
|
||||
vector<float> ret;
|
||||
ret.push_back(GetCombo());
|
||||
ret.push_back(GetMissCombo());
|
||||
return ret;
|
||||
}
|
||||
|
||||
RString LabelSegment::ToString(int dec) const
|
||||
{
|
||||
const RString str = "%.0" + IntToString(dec) + "f=%s";
|
||||
@@ -189,6 +197,14 @@ RString TimeSignatureSegment::ToString(int dec) const
|
||||
return ssprintf(str.c_str(), GetBeat(), GetNum(), GetDen());
|
||||
}
|
||||
|
||||
vector<float> TimeSignatureSegment::GetValues() const
|
||||
{
|
||||
vector<float> ret;
|
||||
ret.push_back(GetNum());
|
||||
ret.push_back(GetDen());
|
||||
return ret;
|
||||
}
|
||||
|
||||
RString SpeedSegment::ToString(int dec) const
|
||||
{
|
||||
const RString str = "%.0" + IntToString(dec)
|
||||
@@ -198,6 +214,15 @@ RString SpeedSegment::ToString(int dec) const
|
||||
GetDelay(), GetUnit());
|
||||
}
|
||||
|
||||
vector<float> SpeedSegment::GetValues() const
|
||||
{
|
||||
vector<float> ret;
|
||||
ret.push_back(GetRatio());
|
||||
ret.push_back(GetDelay());
|
||||
ret.push_back(GetUnit());
|
||||
return ret;
|
||||
}
|
||||
|
||||
void SpeedSegment::Scale( int start, int oldLength, int newLength )
|
||||
{
|
||||
if( GetUnit() == 0 )
|
||||
|
||||
@@ -83,6 +83,11 @@ struct TimingSegment
|
||||
return FloatToString(GetBeat());
|
||||
}
|
||||
|
||||
virtual vector<float> GetValues() const
|
||||
{
|
||||
return vector<float>(0);
|
||||
}
|
||||
|
||||
bool operator<( const TimingSegment &other ) const
|
||||
{
|
||||
return GetRow() < other.GetRow();
|
||||
@@ -148,6 +153,7 @@ struct FakeSegment : public TimingSegment
|
||||
void Scale( int start, int length, int newLength );
|
||||
|
||||
RString ToString( int dec ) const;
|
||||
vector<float> GetValues() const { return vector<float>(1, GetLength()); }
|
||||
|
||||
bool operator==( const FakeSegment &other ) const
|
||||
{
|
||||
@@ -205,6 +211,7 @@ struct WarpSegment : public TimingSegment
|
||||
|
||||
void Scale( int start, int length, int newLength );
|
||||
RString ToString( int dec ) const;
|
||||
vector<float> GetValues() const { return vector<float>(1, GetLength()); }
|
||||
|
||||
bool operator==( const WarpSegment &other ) const
|
||||
{
|
||||
@@ -259,6 +266,7 @@ struct TickcountSegment : public TimingSegment
|
||||
void SetTicks( int iTicks ) { m_iTicksPerBeat = iTicks; }
|
||||
|
||||
RString ToString( int dec ) const;
|
||||
vector<float> GetValues() const { return vector<float>(1, GetTicks()); }
|
||||
|
||||
bool operator==( const TickcountSegment &other ) const
|
||||
{
|
||||
@@ -310,6 +318,7 @@ struct ComboSegment : public TimingSegment
|
||||
void SetMissCombo( int iCombo ) { m_iMissCombo = iCombo; }
|
||||
|
||||
RString ToString( int dec ) const;
|
||||
vector<float> GetValues() const;
|
||||
|
||||
bool operator==( const ComboSegment &other ) const
|
||||
{
|
||||
@@ -361,6 +370,8 @@ struct LabelSegment : public TimingSegment
|
||||
void SetLabel( const RString& sLabel ) { m_sLabel.assign(sLabel); }
|
||||
|
||||
RString ToString( int dec ) const;
|
||||
// Use the default definition for GetValues because the value for a LabelSegment is not a float or set of floats.
|
||||
// TimingSegmentSetToLuaTable in TimingData.cpp has a special case for labels to handle this.
|
||||
|
||||
bool operator==( const LabelSegment &other ) const
|
||||
{
|
||||
@@ -408,6 +419,7 @@ struct BPMSegment : public TimingSegment
|
||||
void SetBPM( float fBPM ) { m_fBPS = fBPM / 60.0f; }
|
||||
|
||||
RString ToString( int dec ) const;
|
||||
vector<float> GetValues() const { return vector<float>(1, GetBPM()); }
|
||||
|
||||
bool operator==( const BPMSegment &other ) const
|
||||
{
|
||||
@@ -464,6 +476,7 @@ struct TimeSignatureSegment : public TimingSegment
|
||||
void Set( int num, int den ) { m_iNumerator = num; m_iDenominator = den; }
|
||||
|
||||
RString ToString( int dec ) const;
|
||||
vector<float> GetValues() const;
|
||||
|
||||
/**
|
||||
* @brief Retrieve the number of note rows per measure within the TimeSignatureSegment.
|
||||
@@ -545,6 +558,7 @@ struct SpeedSegment : public TimingSegment
|
||||
void Scale( int start, int length, int newLength );
|
||||
|
||||
RString ToString( int dec ) const;
|
||||
vector<float> GetValues() const;
|
||||
|
||||
bool operator==( const SpeedSegment &other ) const
|
||||
{
|
||||
@@ -604,6 +618,7 @@ struct ScrollSegment : public TimingSegment
|
||||
void SetRatio( float fRatio ) { m_fRatio = fRatio; }
|
||||
|
||||
RString ToString( int dec ) const;
|
||||
vector<float> GetValues() const { return vector<float>(1, GetRatio()); }
|
||||
|
||||
bool operator==( const ScrollSegment &other ) const
|
||||
{
|
||||
@@ -648,6 +663,7 @@ struct StopSegment : public TimingSegment
|
||||
void SetPause( float fSeconds ) { m_fSeconds = fSeconds; }
|
||||
|
||||
RString ToString( int dec ) const;
|
||||
vector<float> GetValues() const { return vector<float>(1, GetPause()); }
|
||||
|
||||
bool operator==( const StopSegment &other ) const
|
||||
{
|
||||
@@ -691,6 +707,7 @@ struct DelaySegment : public TimingSegment
|
||||
void SetPause( float fSeconds ) { m_fSeconds = fSeconds; }
|
||||
|
||||
RString ToString( int dec ) const;
|
||||
vector<float> GetValues() const { return vector<float>(1, GetPause()); }
|
||||
|
||||
bool operator==( const DelaySegment &other ) const
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user