Script cleanup, add aliases for SCREEN_* (_screen.w, etc, check alias.lua). [shakesoda]
This commit is contained in:
@@ -17,11 +17,13 @@ PLAYER_2 = "PlayerNumber_P2"
|
|||||||
NUM_PLAYERS = #PlayerNumber
|
NUM_PLAYERS = #PlayerNumber
|
||||||
|
|
||||||
function string:find_last( text )
|
function string:find_last( text )
|
||||||
local LastPos = 0;
|
local LastPos = 0
|
||||||
while true do
|
while true do
|
||||||
local p = string.find( self, text, LastPos+1, true );
|
local p = string.find( self, text, LastPos+1, true )
|
||||||
if not p then return LastPos end
|
if not p then
|
||||||
LastPos = p;
|
return LastPos
|
||||||
|
end
|
||||||
|
LastPos = p
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|||||||
@@ -6,9 +6,18 @@ wouldn't otherwise belong somewhere else.
|
|||||||
|
|
||||||
-- in fact, this probably belongs in Sprite.lua...
|
-- in fact, this probably belongs in Sprite.lua...
|
||||||
function Sprite:cropto(w,h)
|
function Sprite:cropto(w,h)
|
||||||
self:CropTo(w,h);
|
self:CropTo(w,h)
|
||||||
end;
|
end
|
||||||
|
|
||||||
function Actor:SetSize(w,h)
|
function Actor:SetSize(w,h)
|
||||||
self:setsize(w,h);
|
self:setsize(w,h)
|
||||||
end;
|
end
|
||||||
|
|
||||||
|
-- shorthand! this is tedious to type and makes things ugly so let's make it shorter.
|
||||||
|
-- screen.w, screen.h, etc.
|
||||||
|
local _screen = {
|
||||||
|
w = SCREEN_WIDTH,
|
||||||
|
h = SCREEN_HEIGHT,
|
||||||
|
cx = SCREEN_CENTER_X,
|
||||||
|
cy = SCREEN_CENTER_Y
|
||||||
|
}
|
||||||
@@ -5,77 +5,82 @@ Also, certain things are deprecated/removed from sm-ssc (and sometimes SM4 too).
|
|||||||
|
|
||||||
--[[ Actor ]]
|
--[[ Actor ]]
|
||||||
function Actor:hidden(bHide)
|
function Actor:hidden(bHide)
|
||||||
Warn("hidden is deprecated, use visible instead. (used on ".. self:GetName() ..")");
|
Warn("hidden is deprecated, use visible instead. (used on ".. self:GetName() ..")")
|
||||||
self:visible(not bHide);
|
self:visible(not bHide)
|
||||||
end;
|
end
|
||||||
|
|
||||||
-- for when horizalign and vertalign get killed:
|
-- for when horizalign and vertalign get killed by glenn:
|
||||||
--[[
|
--[[
|
||||||
function Actor:horizalign(v)
|
function Actor:horizalign(v)
|
||||||
local values = {
|
local values = {
|
||||||
left = 0;
|
left = 0,
|
||||||
center = 0.5;
|
center = 0.5,
|
||||||
right = 1;
|
right = 1
|
||||||
};
|
}
|
||||||
self:halign(values[v]);
|
self:halign(values[v])
|
||||||
end;
|
end
|
||||||
|
|
||||||
function Actor:vertalign(v)
|
function Actor:vertalign(v)
|
||||||
local values = {
|
local values = {
|
||||||
top = 0;
|
top = 0,
|
||||||
middle = 0.5;
|
middle = 0.5,
|
||||||
bottom = 1;
|
bottom = 1
|
||||||
};
|
}
|
||||||
self:valign(values[v]);
|
self:valign(values[v])
|
||||||
end;
|
end
|
||||||
--]]
|
--]]
|
||||||
|
|
||||||
--[[ ActorScroller: all of these got renamed, so alias the lowercase ones if
|
--[[ ActorScroller: all of these got renamed, so alias the lowercase ones if
|
||||||
things are going to look for them. ]]
|
things are going to look for them. ]]
|
||||||
function ActorScroller:getsecondtodestination()
|
function ActorScroller:getsecondtodestination()
|
||||||
self:GetSecondsToDestination();
|
self:GetSecondsToDestination()
|
||||||
end;
|
end
|
||||||
|
|
||||||
function ActorScroller:setsecondsperitem(secs)
|
function ActorScroller:setsecondsperitem(secs)
|
||||||
self:SetSecondsPerItem(secs);
|
self:SetSecondsPerItem(secs)
|
||||||
end;
|
end
|
||||||
|
|
||||||
function ActorScroller:setnumsubdivisions(subs)
|
function ActorScroller:setnumsubdivisions(subs)
|
||||||
self:SetNumSubdivisions(subs);
|
self:SetNumSubdivisions(subs)
|
||||||
end;
|
end
|
||||||
|
|
||||||
function ActorScroller:scrollthroughallitems()
|
function ActorScroller:scrollthroughallitems()
|
||||||
self:ScrollThroughAllItems();
|
self:ScrollThroughAllItems()
|
||||||
end;
|
end
|
||||||
|
|
||||||
function ActorScroller:scrollwithpadding(fPadStart,fPadEnd)
|
function ActorScroller:scrollwithpadding(fPadStart,fPadEnd)
|
||||||
self:ScrollWithPadding(fPadStart,fPadEnd);
|
self:ScrollWithPadding(fPadStart,fPadEnd)
|
||||||
end;
|
end
|
||||||
|
|
||||||
function ActorScroller:setfastcatchup(bFastCatchup)
|
function ActorScroller:setfastcatchup(bFastCatchup)
|
||||||
self:SetFastCatchup(bFastCatchup);
|
self:SetFastCatchup(bFastCatchup)
|
||||||
end;
|
end
|
||||||
|
|
||||||
-- renaming various StepMania functions to sm-ssc ones:
|
-- renaming various StepMania functions to sm-ssc ones:
|
||||||
if ScreenString then ScreenString = Screen.String; end;
|
if ScreenString then
|
||||||
if ScreenMetric then ScreenMetric = Screen.Metric; end;
|
ScreenString = Screen.String
|
||||||
|
end
|
||||||
|
|
||||||
|
if ScreenMetric then
|
||||||
|
ScreenMetric = Screen.Metric
|
||||||
|
end
|
||||||
|
|
||||||
-- SM4SVN r28330: "add IsFullCombo bindings" - Chris Danford
|
-- SM4SVN r28330: "add IsFullCombo bindings" - Chris Danford
|
||||||
-- Unfortunately we already bound FullComboOfScore(tns), meaning we're not
|
-- Unfortunately we already bound FullComboOfScore(tns), meaning we're not
|
||||||
-- going to go back and redefine bindings that match it. Alias them instead
|
-- going to go back and redefine bindings that match it. Alias them instead
|
||||||
-- for any themes expecting to use them:
|
-- for any themes expecting to use them:
|
||||||
function PlayerStageStats:IsFullComboW1()
|
function PlayerStageStats:IsFullComboW1()
|
||||||
return self:FullComboOfScore('TapNoteScore_W1');
|
return self:FullComboOfScore('TapNoteScore_W1')
|
||||||
end;
|
end
|
||||||
|
|
||||||
function PlayerStageStats:IsFullComboW2()
|
function PlayerStageStats:IsFullComboW2()
|
||||||
return self:FullComboOfScore('TapNoteScore_W2');
|
return self:FullComboOfScore('TapNoteScore_W2')
|
||||||
end;
|
end
|
||||||
|
|
||||||
function PlayerStageStats:IsFullComboW3()
|
function PlayerStageStats:IsFullComboW3()
|
||||||
return self:FullComboOfScore('TapNoteScore_W3');
|
return self:FullComboOfScore('TapNoteScore_W3')
|
||||||
end;
|
end
|
||||||
|
|
||||||
function PlayerStageStats:IsFullComboW4()
|
function PlayerStageStats:IsFullComboW4()
|
||||||
return self:FullComboOfScore('TapNoteScore_W4');
|
return self:FullComboOfScore('TapNoteScore_W4')
|
||||||
end;
|
end
|
||||||
@@ -123,27 +123,27 @@ This function will stretch any background up to 640x480]]
|
|||||||
function Actor:scale_or_crop_background()
|
function Actor:scale_or_crop_background()
|
||||||
--local bgAspectRatio = self:GetWidth() / self:GetHeight();
|
--local bgAspectRatio = self:GetWidth() / self:GetHeight();
|
||||||
if self:GetWidth() <= 640 and self:GetHeight() <= 480 then
|
if self:GetWidth() <= 640 and self:GetHeight() <= 480 then
|
||||||
self:stretchto( 0,0,SCREEN_WIDTH,SCREEN_HEIGHT );
|
self:stretchto( 0,0,SCREEN_WIDTH,SCREEN_HEIGHT )
|
||||||
else
|
else
|
||||||
self:scaletocover( 0,0,SCREEN_WIDTH,SCREEN_HEIGHT );
|
self:scaletocover( 0,0,SCREEN_WIDTH,SCREEN_HEIGHT )
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
-- Testing
|
-- Testing
|
||||||
function Actor:scale_or_crop_alternative()
|
function Actor:scale_or_crop_alternative()
|
||||||
if self:GetWidth() and self:GetHeight() then
|
if self:GetWidth() and self:GetHeight() then
|
||||||
local fRatio = self:GetWidth() / self:GetHeight();
|
local fRatio = self:GetWidth() / self:GetHeight()
|
||||||
if fRatio == 4/3 then
|
if fRatio == 4/3 then
|
||||||
self:stretchto( 0,0,SCREEN_WIDTH,SCREEN_HEIGHT );
|
self:stretchto( 0,0,SCREEN_WIDTH,SCREEN_HEIGHT )
|
||||||
else
|
else
|
||||||
self:scaletocover( 0,0,SCREEN_WIDTH,SCREEN_HEIGHT );
|
self:scaletocover( 0,0,SCREEN_WIDTH,SCREEN_HEIGHT )
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
function Actor:Center()
|
function Actor:Center()
|
||||||
self:x(SCREEN_CENTER_X);
|
self:x(SCREEN_CENTER_X)
|
||||||
self:y(SCREEN_CENTER_Y);
|
self:y(SCREEN_CENTER_Y)
|
||||||
end;
|
end
|
||||||
|
|
||||||
-- (c) 2006 Glenn Maynard
|
-- (c) 2006 Glenn Maynard
|
||||||
-- All rights reserved.
|
-- All rights reserved.
|
||||||
|
|||||||
@@ -1,42 +1,45 @@
|
|||||||
-- Convert "@/path/file" to "/path/".
|
-- Convert "@/path/file" to "/path/".
|
||||||
local function DebugPathToRealPath( p )
|
local function DebugPathToRealPath( p )
|
||||||
if not p or p:sub( 1, 1 ) ~= "@" then
|
if not p or p:sub( 1, 1 ) ~= "@" then
|
||||||
return nil;
|
return nil
|
||||||
end
|
end
|
||||||
|
|
||||||
local Path = p:sub( 2 );
|
local Path = p:sub( 2 )
|
||||||
local pos = Path:find_last( '/' );
|
local pos = Path:find_last( '/' )
|
||||||
return string.sub( Path, 1, pos );
|
return string.sub( Path, 1, pos )
|
||||||
end
|
end
|
||||||
|
|
||||||
local function MergeTables( left, right )
|
local function MergeTables( left, right )
|
||||||
local ret = { }
|
local ret = { }
|
||||||
for key, val in pairs(left) do
|
for key, val in pairs(left) do
|
||||||
ret[key] = val;
|
ret[key] = val
|
||||||
end
|
end
|
||||||
|
|
||||||
for key, val in pairs(right) do
|
for key, val in pairs(right) do
|
||||||
if ret[key] then
|
if ret[key] then
|
||||||
if type(val) == "function" and
|
if type(val) == "function" and
|
||||||
type(ret[key]) == "function" then
|
type(ret[key]) == "function" then
|
||||||
local f1 = ret[key];
|
local f1 = ret[key]
|
||||||
local f2 = val
|
local f2 = val
|
||||||
val = function(...) f1(...); return f2(...) end
|
val = function(...)
|
||||||
|
f1(...)
|
||||||
|
return f2(...)
|
||||||
|
end
|
||||||
else
|
else
|
||||||
Warn( string.format( "%s\n\nOverriding \"%s\": %s with %s",
|
Warn( string.format( "%s\n\nOverriding \"%s\": %s with %s",
|
||||||
debug.traceback(), key, type(ret[key]), type(val)) );
|
debug.traceback(), key, type(ret[key]), type(val)) )
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
ret[key] = val;
|
ret[key] = val
|
||||||
end
|
end
|
||||||
setmetatable( ret, getmetatable(left) );
|
setmetatable( ret, getmetatable(left) )
|
||||||
return ret
|
return ret
|
||||||
end
|
end
|
||||||
|
|
||||||
DefMetatable = {
|
DefMetatable = {
|
||||||
__concat = function(left, right)
|
__concat = function(left, right)
|
||||||
return MergeTables( left, right );
|
return MergeTables( left, right )
|
||||||
end
|
end
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -50,10 +53,10 @@ setmetatable( Def, {
|
|||||||
-- given to Def. Fill in standard fields.
|
-- given to Def. Fill in standard fields.
|
||||||
return function(t)
|
return function(t)
|
||||||
if not ActorUtil.IsRegisteredClass(Class) then
|
if not ActorUtil.IsRegisteredClass(Class) then
|
||||||
error( Class .. " is not a registered actor class", 2 );
|
error( Class .. " is not a registered actor class", 2 )
|
||||||
end
|
end
|
||||||
|
|
||||||
t.Class = Class;
|
t.Class = Class
|
||||||
|
|
||||||
local level = 2
|
local level = 2
|
||||||
if t._Level then
|
if t._Level then
|
||||||
@@ -62,30 +65,30 @@ setmetatable( Def, {
|
|||||||
local info = debug.getinfo(level,"Sl");
|
local info = debug.getinfo(level,"Sl");
|
||||||
|
|
||||||
-- Source file of caller:
|
-- Source file of caller:
|
||||||
local Source = info.source;
|
local Source = info.source
|
||||||
t._Source = Source;
|
t._Source = Source
|
||||||
|
|
||||||
t._Dir = DebugPathToRealPath( Source )
|
t._Dir = DebugPathToRealPath( Source )
|
||||||
|
|
||||||
-- Line number of caller:
|
-- Line number of caller:
|
||||||
t._Line = info.currentline;
|
t._Line = info.currentline
|
||||||
|
|
||||||
setmetatable( t, DefMetatable );
|
setmetatable( t, DefMetatable )
|
||||||
return t;
|
return t
|
||||||
end
|
end
|
||||||
end,
|
end,
|
||||||
});
|
})
|
||||||
|
|
||||||
function ResolveRelativePath( path, level )
|
function ResolveRelativePath( path, level )
|
||||||
if path:sub(1,1) ~= "/" then
|
if path:sub(1,1) ~= "/" then
|
||||||
-- "Working directory":
|
-- "Working directory":
|
||||||
local sDir = DebugPathToRealPath( debug.getinfo(level+1,"S").source )
|
local sDir = DebugPathToRealPath( debug.getinfo(level+1,"S").source )
|
||||||
assert( sDir );
|
assert( sDir )
|
||||||
|
|
||||||
path = sDir .. path
|
path = sDir .. path
|
||||||
end
|
end
|
||||||
|
|
||||||
path = ActorUtil.ResolvePath( path, level+1 );
|
path = ActorUtil.ResolvePath( path, level+1 )
|
||||||
return path
|
return path
|
||||||
end
|
end
|
||||||
|
|
||||||
@@ -94,21 +97,21 @@ function LoadActorFunc( path, level )
|
|||||||
level = level or 1
|
level = level or 1
|
||||||
|
|
||||||
if path == "" then
|
if path == "" then
|
||||||
error( "Passing in a blank filename is a great way to eat up RAM. Good thing we warn you about this." );
|
error( "Passing in a blank filename is a great way to eat up RAM. Good thing we warn you about this." )
|
||||||
end;
|
end
|
||||||
|
|
||||||
local ResolvedPath = ResolveRelativePath( path, level+1 );
|
local ResolvedPath = ResolveRelativePath( path, level+1 )
|
||||||
if not ResolvedPath then
|
if not ResolvedPath then
|
||||||
error( path .. ": not found", level+1 );
|
error( path .. ": not found", level+1 )
|
||||||
end
|
end
|
||||||
path = ResolvedPath
|
path = ResolvedPath
|
||||||
|
|
||||||
local Type = ActorUtil.GetFileType( path );
|
local Type = ActorUtil.GetFileType( path )
|
||||||
Trace( "Loading " .. path .. ", type " .. tostring(Type) );
|
Trace( "Loading " .. path .. ", type " .. tostring(Type) )
|
||||||
|
|
||||||
if Type == "FileType_Lua" then
|
if Type == "FileType_Lua" then
|
||||||
-- Load the file.
|
-- Load the file.
|
||||||
local chunk, errmsg = loadfile( path );
|
local chunk, errmsg = loadfile( path )
|
||||||
if not chunk then error(errmsg) end
|
if not chunk then error(errmsg) end
|
||||||
return chunk
|
return chunk
|
||||||
end
|
end
|
||||||
@@ -140,38 +143,38 @@ function LoadActorFunc( path, level )
|
|||||||
return function()
|
return function()
|
||||||
return Def.BGAnimation {
|
return Def.BGAnimation {
|
||||||
_Level = level+1,
|
_Level = level+1,
|
||||||
AniDir = path,
|
AniDir = path
|
||||||
}
|
}
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
error( path .. ": unknown file type (" .. tostring(Type) .. ")", level+1 );
|
error( path .. ": unknown file type (" .. tostring(Type) .. ")", level+1 )
|
||||||
end
|
end
|
||||||
|
|
||||||
-- Load and create an actor template.
|
-- Load and create an actor template.
|
||||||
function LoadActor( path, ... )
|
function LoadActor( path, ... )
|
||||||
local t = LoadActorFunc( path, 2 );
|
local t = LoadActorFunc( path, 2 )
|
||||||
assert(t);
|
assert(t)
|
||||||
return t(...);
|
return t(...)
|
||||||
end
|
end
|
||||||
|
|
||||||
function LoadActorWithParams( path, params, ... )
|
function LoadActorWithParams( path, params, ... )
|
||||||
local t = LoadActorFunc( path, 2 );
|
local t = LoadActorFunc( path, 2 )
|
||||||
assert(t);
|
assert(t)
|
||||||
return lua.RunWithThreadVariables( function(...) return t(...) end, params, ... );
|
return lua.RunWithThreadVariables( function(...) return t(...) end, params, ... )
|
||||||
end
|
end
|
||||||
|
|
||||||
function LoadFont(a, b)
|
function LoadFont(a, b)
|
||||||
local sSection = b and a or "";
|
local sSection = b and a or ""
|
||||||
local sFile = b or a;
|
local sFile = b or a
|
||||||
if (sFile == "" and sSection == "") or (sFile == nil and sSection == nil) then
|
if (sFile == "" and sSection == "") or (sFile == nil and sSection == nil) then
|
||||||
sSection = "Common";
|
sSection = "Common"
|
||||||
sFile = "normal";
|
sFile = "normal"
|
||||||
end;
|
end
|
||||||
local sPath = THEME:GetPathF(sSection, sFile);
|
local sPath = THEME:GetPathF(sSection, sFile)
|
||||||
return Def.BitmapText {
|
return Def.BitmapText {
|
||||||
_Level = 2;
|
_Level = 2,
|
||||||
File = sPath;
|
File = sPath
|
||||||
}
|
}
|
||||||
end
|
end
|
||||||
|
|
||||||
@@ -182,20 +185,23 @@ end
|
|||||||
function StandardDecorationFromTable( MetricsName, t )
|
function StandardDecorationFromTable( MetricsName, t )
|
||||||
if type(t) == "table" then
|
if type(t) == "table" then
|
||||||
t = t .. {
|
t = t .. {
|
||||||
InitCommand=function(self) self:name(MetricsName); ActorUtil.LoadAllCommandsAndSetXY(self,Var "LoadingScreen"); end;
|
InitCommand=function(self)
|
||||||
};
|
self:name(MetricsName)
|
||||||
|
ActorUtil.LoadAllCommandsAndSetXY(self,Var "LoadingScreen")
|
||||||
|
end
|
||||||
|
}
|
||||||
end
|
end
|
||||||
return t;
|
return t
|
||||||
end
|
end
|
||||||
|
|
||||||
function StandardDecorationFromFile( MetricsName, FileName )
|
function StandardDecorationFromFile( MetricsName, FileName )
|
||||||
local t = LoadActor( THEME:GetPathG(Var "LoadingScreen",FileName) );
|
local t = LoadActor( THEME:GetPathG(Var "LoadingScreen",FileName) )
|
||||||
return StandardDecorationFromTable( MetricsName, t );
|
return StandardDecorationFromTable( MetricsName, t )
|
||||||
end
|
end
|
||||||
|
|
||||||
function StandardDecorationFromFileOptional( MetricsName, FileName )
|
function StandardDecorationFromFileOptional( MetricsName, FileName )
|
||||||
if ShowStandardDecoration(MetricsName) then
|
if ShowStandardDecoration(MetricsName) then
|
||||||
return StandardDecorationFromFile( MetricsName, FileName );
|
return StandardDecorationFromFile( MetricsName, FileName )
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|||||||
@@ -9,34 +9,38 @@ If the line is a function, you'll have to use Branch.keyname() instead.
|
|||||||
-- used for various SMOnline-enabled screens:
|
-- used for various SMOnline-enabled screens:
|
||||||
function SMOnlineScreen()
|
function SMOnlineScreen()
|
||||||
for pn in ivalues(GAMESTATE:GetHumanPlayers()) do
|
for pn in ivalues(GAMESTATE:GetHumanPlayers()) do
|
||||||
if not IsSMOnlineLoggedIn(pn) then return "ScreenSMOnlineLogin" end;
|
if not IsSMOnlineLoggedIn(pn) then
|
||||||
end;
|
return "ScreenSMOnlineLogin"
|
||||||
|
end
|
||||||
|
end
|
||||||
return "ScreenNetRoom"
|
return "ScreenNetRoom"
|
||||||
end;
|
end
|
||||||
|
|
||||||
function SelectMusicOrCourse()
|
function SelectMusicOrCourse()
|
||||||
if IsNetSMOnline() then
|
if IsNetSMOnline() then
|
||||||
return "ScreenNetSelectMusic";
|
return "ScreenNetSelectMusic";
|
||||||
elseif GAMESTATE:IsCourseMode() then
|
elseif GAMESTATE:IsCourseMode() then
|
||||||
return "ScreenSelectCourse";
|
return "ScreenSelectCourse"
|
||||||
else
|
else
|
||||||
return "ScreenSelectMusic";
|
return "ScreenSelectMusic"
|
||||||
end;
|
end
|
||||||
end;
|
end
|
||||||
|
|
||||||
Branch = {
|
Branch = {
|
||||||
TitleMenu = function()
|
TitleMenu = function()
|
||||||
-- home mode is the most assumed use of sm-ssc.
|
-- home mode is the most assumed use of sm-ssc.
|
||||||
if GAMESTATE:GetCoinMode() == "CoinMode_Home" then return "ScreenTitleMenu" end;
|
if GAMESTATE:GetCoinMode() == "CoinMode_Home" then
|
||||||
|
return "ScreenTitleMenu"
|
||||||
|
end
|
||||||
-- arcade junk:
|
-- arcade junk:
|
||||||
if GAMESTATE:GetCoinsNeededToJoin() > GAMESTATE:GetCoins() then
|
if GAMESTATE:GetCoinsNeededToJoin() > GAMESTATE:GetCoins() then
|
||||||
-- if no credits are inserted, don't show the Join screen. SM4 has
|
-- if no credits are inserted, don't show the Join screen. SM4 has
|
||||||
-- this as the initial screen, but that means we'd be stuck in a
|
-- this as the initial screen, but that means we'd be stuck in a
|
||||||
-- loop with ScreenInit. No good.
|
-- loop with ScreenInit. No good.
|
||||||
return "ScreenDemonstration";
|
return "ScreenDemonstration"
|
||||||
else
|
else
|
||||||
return "ScreenTitleJoin"
|
return "ScreenTitleJoin"
|
||||||
end;
|
end
|
||||||
end,
|
end,
|
||||||
AfterProfileLoad = function()
|
AfterProfileLoad = function()
|
||||||
return "ScreenSelectProfile"
|
return "ScreenSelectProfile"
|
||||||
@@ -58,8 +62,12 @@ Branch = {
|
|||||||
ReportStyle()
|
ReportStyle()
|
||||||
GAMESTATE:ApplyGameCommand("playmode,regular")
|
GAMESTATE:ApplyGameCommand("playmode,regular")
|
||||||
end
|
end
|
||||||
if IsNetSMOnline() then return SMOnlineScreen() end
|
if IsNetSMOnline() then
|
||||||
if IsNetConnected() then return "ScreenNetRoom" end
|
return SMOnlineScreen()
|
||||||
|
end
|
||||||
|
if IsNetConnected() then
|
||||||
|
return "ScreenNetRoom"
|
||||||
|
end
|
||||||
return "ScreenSelectPlayMode"
|
return "ScreenSelectPlayMode"
|
||||||
end,
|
end,
|
||||||
AfterSelectStyle = function()
|
AfterSelectStyle = function()
|
||||||
@@ -82,8 +90,8 @@ Branch = {
|
|||||||
end
|
end
|
||||||
end,
|
end,
|
||||||
GetGameInformationScreen = function()
|
GetGameInformationScreen = function()
|
||||||
bTrue = PREFSMAN:GetPreference("ShowInstructions");
|
bTrue = PREFSMAN:GetPreference("ShowInstructions")
|
||||||
return (bTrue and GoToMusic() or "ScreenGameInformation");
|
return (bTrue and GoToMusic() or "ScreenGameInformation")
|
||||||
end,
|
end,
|
||||||
AfterSMOLogin = SMOnlineScreen(),
|
AfterSMOLogin = SMOnlineScreen(),
|
||||||
BackOutOfPlayerOptions = function()
|
BackOutOfPlayerOptions = function()
|
||||||
@@ -138,5 +146,5 @@ Branch = {
|
|||||||
QuickSetupB = "ScreenQuickSetupPhaseTwo",
|
QuickSetupB = "ScreenQuickSetupPhaseTwo",
|
||||||
QuickSetupC = "ScreenQuickSetupPhaseThree",
|
QuickSetupC = "ScreenQuickSetupPhaseThree",
|
||||||
QuickSetupD = "ScreenQuickSetupPhaseFour",
|
QuickSetupD = "ScreenQuickSetupPhaseFour",
|
||||||
QuickSetupFinished = "ScreenQuickSetupFinished",
|
QuickSetupFinished = "ScreenQuickSetupFinished"
|
||||||
};
|
}
|
||||||
@@ -1,5 +1,5 @@
|
|||||||
-- SSC Color Module and Library
|
-- SSC Color Module and Library
|
||||||
local nilColor = color("0,0,0,0");
|
local nilColor = color("0,0,0,0")
|
||||||
-- Original Color Module.
|
-- Original Color Module.
|
||||||
Color = {
|
Color = {
|
||||||
-- UI Colors
|
-- UI Colors
|
||||||
@@ -19,7 +19,7 @@ Color = {
|
|||||||
-- ( Do note that I want to remove '*Color' entirely, it'll look neater )
|
-- ( Do note that I want to remove '*Color' entirely, it'll look neater )
|
||||||
Player = {
|
Player = {
|
||||||
P1 = color("#ef403d"),
|
P1 = color("#ef403d"),
|
||||||
P2 = color("#0089cf"),
|
P2 = color("#0089cf")
|
||||||
},
|
},
|
||||||
Difficulty = {
|
Difficulty = {
|
||||||
--[[ These are for 'Custom' Difficulty Ranks. It can be very useful
|
--[[ These are for 'Custom' Difficulty Ranks. It can be very useful
|
||||||
@@ -42,7 +42,7 @@ Color = {
|
|||||||
Difficulty_Challenge = color("0.2,0.6,1.0,1"), -- light blue
|
Difficulty_Challenge = color("0.2,0.6,1.0,1"), -- light blue
|
||||||
Difficulty_Edit = color("0.8,0.8,0.8,1"), -- gray
|
Difficulty_Edit = color("0.8,0.8,0.8,1"), -- gray
|
||||||
Difficulty_Couple = color("#ed0972"), -- hot pink
|
Difficulty_Couple = color("#ed0972"), -- hot pink
|
||||||
Difficulty_Routine = color("#ff9a00"), -- orange
|
Difficulty_Routine = color("#ff9a00") -- orange
|
||||||
},
|
},
|
||||||
Course = {
|
Course = {
|
||||||
Beginner = color("0.0,0.9,1.0,1"), -- purple
|
Beginner = color("0.0,0.9,1.0,1"), -- purple
|
||||||
@@ -60,7 +60,7 @@ Color = {
|
|||||||
Difficulty_Easy = color("0.9,0.9,0.0,1"), -- green
|
Difficulty_Easy = color("0.9,0.9,0.0,1"), -- green
|
||||||
Difficulty_Medium = color("1.0,0.1,0.1,1"), -- yellow
|
Difficulty_Medium = color("1.0,0.1,0.1,1"), -- yellow
|
||||||
Difficulty_Hard = color("0.2,1.0,0.2,1"), -- red
|
Difficulty_Hard = color("0.2,1.0,0.2,1"), -- red
|
||||||
Difficulty_Challenge = color("0.2,0.6,1.0,1"), -- light blue
|
Difficulty_Challenge = color("0.2,0.6,1.0,1") -- light blue
|
||||||
},
|
},
|
||||||
CourseDifficultyColors = {
|
CourseDifficultyColors = {
|
||||||
Beginner = color("0.0,0.9,1.0,1"), -- purple
|
Beginner = color("0.0,0.9,1.0,1"), -- purple
|
||||||
@@ -78,7 +78,7 @@ Color = {
|
|||||||
Difficulty_Easy = color("0.9,0.9,0.0,1"), -- green
|
Difficulty_Easy = color("0.9,0.9,0.0,1"), -- green
|
||||||
Difficulty_Medium = color("1.0,0.1,0.1,1"), -- yellow
|
Difficulty_Medium = color("1.0,0.1,0.1,1"), -- yellow
|
||||||
Difficulty_Hard = color("0.2,1.0,0.2,1"), -- red
|
Difficulty_Hard = color("0.2,1.0,0.2,1"), -- red
|
||||||
Difficulty_Challenge = color("0.2,0.6,1.0,1"), -- light blue
|
Difficulty_Challenge = color("0.2,0.6,1.0,1") -- light blue
|
||||||
},
|
},
|
||||||
Stage = {
|
Stage = {
|
||||||
Stage_1st = color("#00ffc7"),
|
Stage_1st = color("#00ffc7"),
|
||||||
@@ -95,7 +95,7 @@ Color = {
|
|||||||
Stage_Oni = color("#FFFFFF"),
|
Stage_Oni = color("#FFFFFF"),
|
||||||
Stage_Endless = color("#FFFFFF"),
|
Stage_Endless = color("#FFFFFF"),
|
||||||
Stage_Event = color("#FFFFFF"),
|
Stage_Event = color("#FFFFFF"),
|
||||||
Stage_Demo = color("#FFFFFF"),
|
Stage_Demo = color("#FFFFFF")
|
||||||
},
|
},
|
||||||
Judgment = {
|
Judgment = {
|
||||||
JudgmentLine_W1 = color("#00ffc7"),
|
JudgmentLine_W1 = color("#00ffc7"),
|
||||||
@@ -105,7 +105,7 @@ Color = {
|
|||||||
JudgmentLine_W5 = color("#e44dff"),
|
JudgmentLine_W5 = color("#e44dff"),
|
||||||
JudgmentLine_Held = color("#FFFFFF"),
|
JudgmentLine_Held = color("#FFFFFF"),
|
||||||
JudgmentLine_Miss = color("#ff3c3c"),
|
JudgmentLine_Miss = color("#ff3c3c"),
|
||||||
JudgmentLine_MaxCombo = color("#ffc600"),
|
JudgmentLine_MaxCombo = color("#ffc600")
|
||||||
},
|
},
|
||||||
JudgmentLine = {
|
JudgmentLine = {
|
||||||
JudgmentLine_W1 = color("#00ffc7"),
|
JudgmentLine_W1 = color("#00ffc7"),
|
||||||
@@ -115,7 +115,7 @@ Color = {
|
|||||||
JudgmentLine_W5 = color("#e44dff"),
|
JudgmentLine_W5 = color("#e44dff"),
|
||||||
JudgmentLine_Held = color("#FFFFFF"),
|
JudgmentLine_Held = color("#FFFFFF"),
|
||||||
JudgmentLine_Miss = color("#ff3c3c"),
|
JudgmentLine_Miss = color("#ff3c3c"),
|
||||||
JudgmentLine_MaxCombo = color("#ffc600"),
|
JudgmentLine_MaxCombo = color("#ffc600")
|
||||||
},
|
},
|
||||||
Grade = {},
|
Grade = {},
|
||||||
Menu = {},
|
Menu = {},
|
||||||
@@ -125,11 +125,11 @@ Color = {
|
|||||||
StreakW1 = nilColor,
|
StreakW1 = nilColor,
|
||||||
StreakW2 = nilColor,
|
StreakW2 = nilColor,
|
||||||
StreakW3 = nilColor,
|
StreakW3 = nilColor,
|
||||||
Misses = nilColor,
|
Misses = nilColor
|
||||||
},
|
},
|
||||||
Song = {
|
Song = {
|
||||||
Extra = nilColor,
|
Extra = nilColor,
|
||||||
Unlock = nilColor,
|
Unlock = nilColor
|
||||||
},
|
},
|
||||||
-- Color Library
|
-- Color Library
|
||||||
-- These colors are pure swatch colors and are here purely to be used
|
-- These colors are pure swatch colors and are here purely to be used
|
||||||
@@ -157,15 +157,16 @@ Color = {
|
|||||||
Alpha = function(cColor,fAlpha)
|
Alpha = function(cColor,fAlpha)
|
||||||
local c = cColor;
|
local c = cColor;
|
||||||
return { c[1],c[2],c[3],fAlpha };
|
return { c[1],c[2],c[3],fAlpha };
|
||||||
end,
|
end
|
||||||
};
|
}
|
||||||
|
|
||||||
-- Remapped Color Module, since some themes are crazy
|
-- Remapped Color Module, since some themes are crazy
|
||||||
Colors = Color;
|
Colors = Color
|
||||||
|
|
||||||
local PlayerColors = {
|
local PlayerColors = {
|
||||||
PLAYER_1 = color("#ef403d"),
|
PLAYER_1 = color("#ef403d"),
|
||||||
PLAYER_2 = color("#0089cf"),
|
PLAYER_2 = color("#0089cf")
|
||||||
};
|
}
|
||||||
|
|
||||||
local DifficultyColors = {
|
local DifficultyColors = {
|
||||||
--[[ These are for 'Custom' Difficulty Ranks. It can be very useful
|
--[[ These are for 'Custom' Difficulty Ranks. It can be very useful
|
||||||
@@ -188,8 +189,9 @@ local DifficultyColors = {
|
|||||||
Difficulty_Challenge = color("#1cd8ff"), -- light blue
|
Difficulty_Challenge = color("#1cd8ff"), -- light blue
|
||||||
Difficulty_Edit = color("0.8,0.8,0.8,1"), -- gray
|
Difficulty_Edit = color("0.8,0.8,0.8,1"), -- gray
|
||||||
Difficulty_Couple = color("#ed0972"), -- hot pink
|
Difficulty_Couple = color("#ed0972"), -- hot pink
|
||||||
Difficulty_Routine = color("#ff9a00"), -- orange
|
Difficulty_Routine = color("#ff9a00") -- orange
|
||||||
};
|
}
|
||||||
|
|
||||||
local StageColors = {
|
local StageColors = {
|
||||||
Stage_1st = color("#00ffc7"),
|
Stage_1st = color("#00ffc7"),
|
||||||
Stage_2nd = color("#58ff00"),
|
Stage_2nd = color("#58ff00"),
|
||||||
@@ -205,8 +207,9 @@ local StageColors = {
|
|||||||
Stage_Oni = color("#FFFFFF"),
|
Stage_Oni = color("#FFFFFF"),
|
||||||
Stage_Endless = color("#FFFFFF"),
|
Stage_Endless = color("#FFFFFF"),
|
||||||
Stage_Event = color("#FFFFFF"),
|
Stage_Event = color("#FFFFFF"),
|
||||||
Stage_Demo = color("#FFFFFF"),
|
Stage_Demo = color("#FFFFFF")
|
||||||
};
|
}
|
||||||
|
|
||||||
local JudgmentColors = {
|
local JudgmentColors = {
|
||||||
JudgmentLine_W1 = color("#00ffc7"),
|
JudgmentLine_W1 = color("#00ffc7"),
|
||||||
JudgmentLine_W2 = color("#f6ff00"),
|
JudgmentLine_W2 = color("#f6ff00"),
|
||||||
@@ -215,77 +218,90 @@ local JudgmentColors = {
|
|||||||
JudgmentLine_W5 = color("#e44dff"),
|
JudgmentLine_W5 = color("#e44dff"),
|
||||||
JudgmentLine_Held = color("#FFFFFF"),
|
JudgmentLine_Held = color("#FFFFFF"),
|
||||||
JudgmentLine_Miss = color("#ff3c3c"),
|
JudgmentLine_Miss = color("#ff3c3c"),
|
||||||
JudgmentLine_MaxCombo = color("#ffc600"),
|
JudgmentLine_MaxCombo = color("#ffc600")
|
||||||
};
|
}
|
||||||
|
|
||||||
--[[ Fallbacks ]]
|
--[[ Fallbacks ]]
|
||||||
function Color(c)
|
function Color(c)
|
||||||
return Colors[c];
|
return Colors[c]
|
||||||
end;
|
end
|
||||||
|
|
||||||
function BoostColor( cColor, fBoost )
|
function BoostColor( cColor, fBoost )
|
||||||
local c = cColor;
|
local c = cColor
|
||||||
return { c[1]*fBoost, c[2]*fBoost, c[3]*fBoost, c[4] };
|
return { c[1]*fBoost, c[2]*fBoost, c[3]*fBoost, c[4] }
|
||||||
end;
|
end
|
||||||
|
|
||||||
function ColorLightTone(c)
|
function ColorLightTone(c)
|
||||||
return { c[1]+(c[1]/2), c[2]+(c[2]/2), c[3]+(c[3]/2), c[4] };
|
return { c[1]+(c[1]/2), c[2]+(c[2]/2), c[3]+(c[3]/2), c[4] }
|
||||||
end;
|
end
|
||||||
|
|
||||||
function ColorMidTone(c)
|
function ColorMidTone(c)
|
||||||
return { c[1]/1.5, c[2]/1.5, c[3]/1.5, c[4] };
|
return { c[1]/1.5, c[2]/1.5, c[3]/1.5, c[4] }
|
||||||
end;
|
end
|
||||||
|
|
||||||
function ColorDarkTone(c)
|
function ColorDarkTone(c)
|
||||||
return { c[1]/2, c[2]/2, c[3]/2, c[4] };
|
return { c[1]/2, c[2]/2, c[3]/2, c[4] }
|
||||||
end;
|
end
|
||||||
|
|
||||||
function PlayerColor( pn )
|
function PlayerColor( pn )
|
||||||
if pn == PLAYER_1 then return color("#ef403d") end -- pink-red
|
if pn == PLAYER_1 then
|
||||||
if pn == PLAYER_2 then return color("#0089cf") end -- sea-blue
|
return color("#ef403d") -- pink-red
|
||||||
|
end
|
||||||
|
if pn == PLAYER_2 then
|
||||||
|
return color("#0089cf") -- sea-blue
|
||||||
|
end
|
||||||
return color("1,1,1,1")
|
return color("1,1,1,1")
|
||||||
end
|
end
|
||||||
function PlayerScoreColor( pn )
|
function PlayerScoreColor( pn )
|
||||||
if pn == PLAYER_1 then return color("#ef403d") end -- pink-red
|
if pn == PLAYER_1 then
|
||||||
if pn == PLAYER_2 then return color("#0089cf") end -- sea-blue
|
return color("#ef403d") -- pink-red
|
||||||
|
end
|
||||||
|
if pn == PLAYER_2 then
|
||||||
|
return color("#0089cf") -- sea-blue
|
||||||
|
end
|
||||||
return color("1,1,1,1")
|
return color("1,1,1,1")
|
||||||
end
|
end
|
||||||
|
|
||||||
function CustomDifficultyToColor( sCustomDifficulty )
|
function CustomDifficultyToColor( sCustomDifficulty )
|
||||||
return DifficultyColors[sCustomDifficulty];
|
return DifficultyColors[sCustomDifficulty]
|
||||||
end
|
end
|
||||||
|
|
||||||
function CustomDifficultyToDarkColor( sCustomDifficulty )
|
function CustomDifficultyToDarkColor( sCustomDifficulty )
|
||||||
local c = DifficultyColors[sCustomDifficulty];
|
local c = DifficultyColors[sCustomDifficulty]
|
||||||
return { c[1]/2, c[2]/2, c[3]/2, c[4] };
|
return { c[1]/2, c[2]/2, c[3]/2, c[4] }
|
||||||
end
|
end
|
||||||
|
|
||||||
function CustomDifficultyToLightColor( sCustomDifficulty )
|
function CustomDifficultyToLightColor( sCustomDifficulty )
|
||||||
local c = DifficultyColors[sCustomDifficulty];
|
local c = DifficultyColors[sCustomDifficulty]
|
||||||
return { scale(c[1],0,1,0.5,1), scale(c[2],0,1,0.5,1), scale(c[3],0,1,0.5,1), c[4] };
|
return { scale(c[1],0,1,0.5,1), scale(c[2],0,1,0.5,1), scale(c[3],0,1,0.5,1), c[4] }
|
||||||
end
|
end
|
||||||
|
|
||||||
function StepsOrTrailToColor(StepsOrTrail)
|
function StepsOrTrailToColor(StepsOrTrail)
|
||||||
return CustomDifficultyToColor( StepsOrTrailToCustomDifficulty(stepsOrTrail) );
|
return CustomDifficultyToColor( StepsOrTrailToCustomDifficulty(stepsOrTrail) )
|
||||||
end
|
end
|
||||||
|
|
||||||
function StageToColor( stage )
|
function StageToColor( stage )
|
||||||
local c = Colors.Stage[stage];
|
local c = Colors.Stage[stage]
|
||||||
if c then return c end
|
if c then
|
||||||
return color("#000000");
|
return c
|
||||||
|
end
|
||||||
|
return color("#000000")
|
||||||
end
|
end
|
||||||
|
|
||||||
function StageToStrokeColor( stage )
|
function StageToStrokeColor( stage )
|
||||||
local c = StageColors[stage];
|
local c = StageColors[stage]
|
||||||
return { c[1]/2, c[2]/2, c[3]/2, c[4] };
|
return { c[1]/2, c[2]/2, c[3]/2, c[4] }
|
||||||
end
|
end
|
||||||
|
|
||||||
function JudgmentLineToColor( i )
|
function JudgmentLineToColor( i )
|
||||||
local c = JudgmentColors[i];
|
local c = JudgmentColors[i]
|
||||||
if c then return c end
|
if c then
|
||||||
return color("#000000");
|
return c
|
||||||
|
end
|
||||||
|
return color("#000000")
|
||||||
end
|
end
|
||||||
|
|
||||||
function JudgmentLineToStrokeColor( i )
|
function JudgmentLineToStrokeColor( i )
|
||||||
local c = JudgmentColors[i];
|
local c = JudgmentColors[i]
|
||||||
return { c[1]/2, c[2]/2, c[3]/2, c[4] };
|
return { c[1]/2, c[2]/2, c[3]/2, c[4] }
|
||||||
end
|
end
|
||||||
@@ -10,11 +10,20 @@ function debug.traceback(...)
|
|||||||
local thread = coroutine.running()
|
local thread = coroutine.running()
|
||||||
local msg = ""
|
local msg = ""
|
||||||
local level = 1
|
local level = 1
|
||||||
local args = {...};
|
local args = {...}
|
||||||
|
|
||||||
if type(args[1]) == "thread" then thread = args[1]; table.remove(args) end
|
if type(args[1]) == "thread" then
|
||||||
if type(args[1]) == "string" then msg = args[1]; table.remove(args) end
|
thread = args[1]
|
||||||
if type(args[1]) == "number" then level = args[1]; table.remove(args) end
|
table.remove(args)
|
||||||
|
end
|
||||||
|
if type(args[1]) == "string" then
|
||||||
|
msg = args[1]
|
||||||
|
table.remove(args)
|
||||||
|
end
|
||||||
|
if type(args[1]) == "number" then
|
||||||
|
level = args[1]
|
||||||
|
table.remove(args)
|
||||||
|
end
|
||||||
|
|
||||||
if thread == coroutine.running() then
|
if thread == coroutine.running() then
|
||||||
level = level + 1 -- skip this function
|
level = level + 1 -- skip this function
|
||||||
@@ -22,22 +31,22 @@ function debug.traceback(...)
|
|||||||
|
|
||||||
local stack = {}
|
local stack = {}
|
||||||
repeat
|
repeat
|
||||||
local info = debug.getinfo(level, "Sln");
|
local info = debug.getinfo(level, "Sln")
|
||||||
table.insert( stack, info );
|
table.insert( stack, info )
|
||||||
level = level + 1
|
level = level + 1
|
||||||
until not info
|
until not info
|
||||||
|
|
||||||
if #stack == 0 then
|
if #stack == 0 then
|
||||||
return "";
|
return ""
|
||||||
end
|
end
|
||||||
|
|
||||||
-- The original caller is usually C; remove it.
|
-- The original caller is usually C; remove it.
|
||||||
if( stack[#stack].what == "C" ) then
|
if( stack[#stack].what == "C" ) then
|
||||||
table.remove( stack );
|
table.remove( stack )
|
||||||
end
|
end
|
||||||
local function FormatFrame(level, frame)
|
local function FormatFrame(level, frame)
|
||||||
local sFrameInfo = ""
|
local sFrameInfo = ""
|
||||||
sFrameInfo = sFrameInfo .. "#" .. level .. " ";
|
sFrameInfo = sFrameInfo .. "#" .. level .. " "
|
||||||
if( frame.what == "tail" ) then
|
if( frame.what == "tail" ) then
|
||||||
-- sFrameInfo = sFrameInfo .. "(tail call)"
|
-- sFrameInfo = sFrameInfo .. "(tail call)"
|
||||||
-- return sFrameInfo
|
-- return sFrameInfo
|
||||||
@@ -46,7 +55,7 @@ function debug.traceback(...)
|
|||||||
elseif frame.name then
|
elseif frame.name then
|
||||||
sFrameInfo = sFrameInfo .. frame.name .. "() in "
|
sFrameInfo = sFrameInfo .. frame.name .. "() in "
|
||||||
else
|
else
|
||||||
sFrameInfo = sFrameInfo .. "... in ";
|
sFrameInfo = sFrameInfo .. "... in "
|
||||||
end
|
end
|
||||||
sFrameInfo = sFrameInfo .. frame.short_src
|
sFrameInfo = sFrameInfo .. frame.short_src
|
||||||
|
|
||||||
@@ -61,7 +70,7 @@ function debug.traceback(...)
|
|||||||
for level, frame in ipairs(stack) do
|
for level, frame in ipairs(stack) do
|
||||||
FrameInfo[level] = FormatFrame(level, frame)
|
FrameInfo[level] = FormatFrame(level, frame)
|
||||||
end
|
end
|
||||||
return table.concat( FrameInfo, "\n" );
|
return table.concat( FrameInfo, "\n" )
|
||||||
end
|
end
|
||||||
|
|
||||||
-- (c) 2006 Glenn Maynard
|
-- (c) 2006 Glenn Maynard
|
||||||
|
|||||||
@@ -1,23 +1,29 @@
|
|||||||
function Enum:Compare( e1, e2 )
|
function Enum:Compare( e1, e2 )
|
||||||
local Reverse = self:Reverse();
|
local Reverse = self:Reverse()
|
||||||
local Value1 = Reverse[e1];
|
local Value1 = Reverse[e1]
|
||||||
local Value2 = Reverse[e2];
|
local Value2 = Reverse[e2]
|
||||||
|
|
||||||
assert( Value1, tostring(e1) .. " is not an enum of type " .. self:GetName() );
|
assert( Value1, tostring(e1) .. " is not an enum of type " .. self:GetName() )
|
||||||
assert( Value2, tostring(e2) .. " is not an enum of type " .. self:GetName() );
|
assert( Value2, tostring(e2) .. " is not an enum of type " .. self:GetName() )
|
||||||
|
|
||||||
-- Nil enums correspond to "invalid". These compare greater
|
-- Nil enums correspond to "invalid". These compare greater
|
||||||
-- than any valid enum value, to line up with the equivalent
|
-- than any valid enum value, to line up with the equivalent
|
||||||
-- C++ code.
|
-- C++ code.
|
||||||
if not e1 then Value1 = 99999999 end;
|
|
||||||
if not e2 then Value2 = 99999999 end;
|
-- should this be changed to math.huge()? -shake
|
||||||
return Value1 - Value2;
|
if not e1 then
|
||||||
|
Value1 = 99999999
|
||||||
|
end
|
||||||
|
if not e2 then
|
||||||
|
Value2 = 99999999
|
||||||
|
end
|
||||||
|
return Value1 - Value2
|
||||||
end
|
end
|
||||||
|
|
||||||
function ToEnumShortString( e )
|
function ToEnumShortString( e )
|
||||||
local pos = string.find( e, '_' )
|
local pos = string.find( e, '_' )
|
||||||
assert( pos, "'" .. e .. "' is not an enum value" );
|
assert( pos, "'" .. e .. "' is not an enum value" )
|
||||||
return string.sub( e, pos+1 );
|
return string.sub( e, pos+1 )
|
||||||
end
|
end
|
||||||
|
|
||||||
-- (c) 2006 Glenn Maynard
|
-- (c) 2006 Glenn Maynard
|
||||||
|
|||||||
@@ -2,16 +2,16 @@ function HelpDisplay:setfromsongorcourse()
|
|||||||
local Artists = {}
|
local Artists = {}
|
||||||
local AltArtists = {}
|
local AltArtists = {}
|
||||||
|
|
||||||
local Song = GAMESTATE:GetCurrentSong();
|
local Song = GAMESTATE:GetCurrentSong()
|
||||||
local Trail = GAMESTATE:GetCurrentTrail( GAMESTATE:GetMasterPlayerNumber() );
|
local Trail = GAMESTATE:GetCurrentTrail( GAMESTATE:GetMasterPlayerNumber() )
|
||||||
if Song then
|
if Song then
|
||||||
table.insert( Artists, Song:GetDisplayArtist() );
|
table.insert( Artists, Song:GetDisplayArtist() )
|
||||||
table.insert( AltArtists, Song:GetTranslitArtist() );
|
table.insert( AltArtists, Song:GetTranslitArtist() )
|
||||||
elseif Trail then
|
elseif Trail then
|
||||||
Artists, AltArtists = Trail:GetArtists();
|
Artists, AltArtists = Trail:GetArtists()
|
||||||
end
|
end
|
||||||
|
|
||||||
self:settips( Artists, AltArtists );
|
self:settips( Artists, AltArtists )
|
||||||
end
|
end
|
||||||
|
|
||||||
-- (c) 2006 Glenn Maynard
|
-- (c) 2006 Glenn Maynard
|
||||||
|
|||||||
@@ -1,16 +1,18 @@
|
|||||||
function Actor:LyricCommand(side)
|
function Actor:LyricCommand(side)
|
||||||
self:settext( Var "LyricText" );
|
self:settext( Var "LyricText" )
|
||||||
|
|
||||||
self:stoptweening();
|
self:stoptweening()
|
||||||
self:shadowlengthx(0);
|
self:shadowlengthx(0)
|
||||||
self:shadowlengthy(5);
|
self:shadowlengthy(5)
|
||||||
self:strokecolor(color("#000000"));
|
self:strokecolor(color("#000000"))
|
||||||
|
|
||||||
local Zoom = SCREEN_WIDTH/(self:GetZoomedWidth()+1);
|
local Zoom = SCREEN_WIDTH / (self:GetZoomedWidth()+1)
|
||||||
if( Zoom > 1 ) then Zoom = 1 end
|
if( Zoom > 1 ) then
|
||||||
self:zoomx( Zoom );
|
Zoom = 1
|
||||||
|
end
|
||||||
|
self:zoomx( Zoom )
|
||||||
|
|
||||||
local lyricColor = Var "LyricColor";
|
local lyricColor = Var "LyricColor"
|
||||||
local Factor = 1
|
local Factor = 1
|
||||||
if side == "Back" then
|
if side == "Back" then
|
||||||
Factor = 0.5
|
Factor = 0.5
|
||||||
@@ -24,23 +26,23 @@ function Actor:LyricCommand(side)
|
|||||||
lyricColor[4] * Factor } )
|
lyricColor[4] * Factor } )
|
||||||
|
|
||||||
if side == "Front" then
|
if side == "Front" then
|
||||||
self:cropright(1);
|
self:cropright(1)
|
||||||
else
|
else
|
||||||
self:cropleft(0);
|
self:cropleft(0)
|
||||||
end
|
end
|
||||||
|
|
||||||
self:diffusealpha(0);
|
self:diffusealpha(0)
|
||||||
self:linear(0.2);
|
self:linear(0.2)
|
||||||
self:diffusealpha(0.75);
|
self:diffusealpha(0.75)
|
||||||
self:linear( Var "LyricDuration" * 0.75);
|
self:linear( Var "LyricDuration" * 0.75)
|
||||||
if side == "Front" then
|
if side == "Front" then
|
||||||
self:cropright(0);
|
self:cropright(0)
|
||||||
else
|
else
|
||||||
self:cropleft(1);
|
self:cropleft(1)
|
||||||
end
|
end
|
||||||
self:sleep( Var "LyricDuration" * 0.25 );
|
self:sleep( Var "LyricDuration" * 0.25 )
|
||||||
self:linear(0.2);
|
self:linear(0.2)
|
||||||
self:diffusealpha(0);
|
self:diffusealpha(0)
|
||||||
end
|
end
|
||||||
|
|
||||||
-- (c) 2006 Glenn Maynard
|
-- (c) 2006 Glenn Maynard
|
||||||
|
|||||||
@@ -31,8 +31,10 @@ function OptionsRowTest()
|
|||||||
-- Set list[1] to true if Option1 should be selected, and
|
-- Set list[1] to true if Option1 should be selected, and
|
||||||
-- list[2] if Option2 should be selected. This will be
|
-- list[2] if Option2 should be selected. This will be
|
||||||
-- called once per enabled player.
|
-- called once per enabled player.
|
||||||
LoadSelections = (function(self,list,pn) list[1] = true; end),
|
LoadSelections = function(self,list,pn)
|
||||||
SaveSelections = Set,
|
list[1] = true
|
||||||
|
end,
|
||||||
|
SaveSelections = Set
|
||||||
}
|
}
|
||||||
end
|
end
|
||||||
|
|
||||||
@@ -62,37 +64,35 @@ OptionRowTable =
|
|||||||
|
|
||||||
function OptionsRandomJukebox()
|
function OptionsRandomJukebox()
|
||||||
local function AllChoices()
|
local function AllChoices()
|
||||||
Trace('all choices');
|
Trace('all choices')
|
||||||
local ret = { }
|
local ret = { 'Off', 'Random' }
|
||||||
ret[1] = 'Off';
|
|
||||||
ret[2] = 'Random';
|
|
||||||
return ret
|
return ret
|
||||||
end
|
end
|
||||||
|
|
||||||
local t =
|
local t =
|
||||||
{
|
{
|
||||||
-- Name is used to retrieve the header and explanation text.
|
-- Name is used to retrieve the header and explanation text.
|
||||||
Name = "OptionsRandomJukebox";
|
Name = "OptionsRandomJukebox",
|
||||||
LayoutType = "ShowAllInRow";
|
LayoutType = "ShowAllInRow",
|
||||||
SelectType = "SelectOne";
|
SelectType = "SelectOne",
|
||||||
OneChoiceForAllPlayers = true;
|
OneChoiceForAllPlayers = true,
|
||||||
ExportOnChange = false;
|
ExportOnChange = false,
|
||||||
Choices = AllChoices();
|
Choices = AllChoices(),
|
||||||
LoadSelections = function(self, list, pn)
|
LoadSelections = function(self, list, pn)
|
||||||
list[1] = true
|
list[1] = true
|
||||||
end;
|
end,
|
||||||
SaveSelections = function(self, list, pn)
|
SaveSelections = function(self, list, pn)
|
||||||
local val;
|
local val
|
||||||
if list[1] then
|
if list[1] then
|
||||||
val = false;
|
val = false
|
||||||
else
|
else
|
||||||
val = true;
|
val = true
|
||||||
end
|
end
|
||||||
GAMESTATE:SetJukeboxUsesModifiers(val);
|
GAMESTATE:SetJukeboxUsesModifiers(val)
|
||||||
end;
|
end
|
||||||
};
|
}
|
||||||
setmetatable( t, t );
|
setmetatable( t, t )
|
||||||
return t;
|
return t
|
||||||
end
|
end
|
||||||
|
|
||||||
-- (c) 2005 Glenn Maynard
|
-- (c) 2005 Glenn Maynard
|
||||||
|
|||||||
@@ -1,9 +1,10 @@
|
|||||||
|
-- Can this be moved into some other file? Feels like clutter. -shake
|
||||||
-- Play the sound on the given player's side. Must set SupportPan = true
|
-- Play the sound on the given player's side. Must set SupportPan = true
|
||||||
-- on load.
|
-- on load.
|
||||||
function ActorSound:playforplayer(pn)
|
function ActorSound:playforplayer(pn)
|
||||||
local fBalance = SOUND:GetPlayerBalance(pn);
|
local fBalance = SOUND:GetPlayerBalance(pn)
|
||||||
self:get():SetProperty("Pan", fBalance);
|
self:get():SetProperty("Pan", fBalance)
|
||||||
self:play();
|
self:play()
|
||||||
end
|
end
|
||||||
|
|
||||||
-- (c) 2007 Glenn Maynard
|
-- (c) 2007 Glenn Maynard
|
||||||
|
|||||||
@@ -8,7 +8,7 @@ function Sprite:LoadFromSongBanner(song)
|
|||||||
self:LoadBanner( Path )
|
self:LoadBanner( Path )
|
||||||
else
|
else
|
||||||
self:LoadBanner( THEME:GetPathG("Common","fallback banner") )
|
self:LoadBanner( THEME:GetPathG("Common","fallback banner") )
|
||||||
end;
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
function Sprite:LoadFromSongBackground(song)
|
function Sprite:LoadFromSongBackground(song)
|
||||||
@@ -22,34 +22,33 @@ end
|
|||||||
|
|
||||||
function LoadSongBackground()
|
function LoadSongBackground()
|
||||||
return Def.Sprite {
|
return Def.Sprite {
|
||||||
InitCommand=cmd(x,SCREEN_CENTER_X;y,SCREEN_CENTER_Y);
|
InitCommand=cmd(x,SCREEN_CENTER_X;y,SCREEN_CENTER_Y),
|
||||||
BeginCommand=cmd(LoadFromSongBackground,GAMESTATE:GetCurrentSong();scale_or_crop_background);
|
BeginCommand=cmd(LoadFromSongBackground,GAMESTATE:GetCurrentSong();scale_or_crop_background)
|
||||||
};
|
}
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
||||||
function Sprite:position( f )
|
function Sprite:position( f )
|
||||||
self:GetTexture():position( f );
|
self:GetTexture():position( f )
|
||||||
end
|
end
|
||||||
|
|
||||||
function Sprite:loop( f )
|
function Sprite:loop( f )
|
||||||
self:GetTexture():loop( f );
|
self:GetTexture():loop( f )
|
||||||
end
|
end
|
||||||
|
|
||||||
function Sprite:rate( f )
|
function Sprite:rate( f )
|
||||||
self:GetTexture():rate( f );
|
self:GetTexture():rate( f )
|
||||||
end
|
end
|
||||||
|
|
||||||
function Sprite.LinearFrames(NumFrames, Seconds)
|
function Sprite.LinearFrames(NumFrames, Seconds)
|
||||||
local Frames = {};
|
local Frames = {}
|
||||||
for i = 0,NumFrames-1 do
|
for i = 0,NumFrames-1 do
|
||||||
Frames[#Frames+1] = {
|
Frames[#Frames+1] = {
|
||||||
Frame = i;
|
Frame = i,
|
||||||
Delay = (1/NumFrames)*Seconds;
|
Delay = (1/NumFrames)*Seconds
|
||||||
};
|
}
|
||||||
end
|
end
|
||||||
|
return Frames
|
||||||
return Frames;
|
|
||||||
end
|
end
|
||||||
|
|
||||||
-- (c) 2005 Glenn Maynard
|
-- (c) 2005 Glenn Maynard
|
||||||
|
|||||||
@@ -32,11 +32,11 @@ function ScreenSelectMusic:setupmusicstagemods()
|
|||||||
local song, steps = SONGMAN:GetExtraStageInfo( bExtra2, style )
|
local song, steps = SONGMAN:GetExtraStageInfo( bExtra2, style )
|
||||||
local po, so
|
local po, so
|
||||||
if bExtra2 then
|
if bExtra2 then
|
||||||
po = "default,1.5x,reverse";
|
po = "default,1.5x,reverse"
|
||||||
so = "suddendeath";
|
so = "suddendeath"
|
||||||
else
|
else
|
||||||
po = "default,1.5x,reverse";
|
po = "default,1.5x,reverse"
|
||||||
so = "norecover";
|
so = "norecover"
|
||||||
end
|
end
|
||||||
local difficulty = steps:GetDifficulty()
|
local difficulty = steps:GetDifficulty()
|
||||||
local Reverse = PlayerNumber:Reverse()
|
local Reverse = PlayerNumber:Reverse()
|
||||||
|
|||||||
@@ -58,7 +58,7 @@ function wrap(val,n)
|
|||||||
local x = val
|
local x = val
|
||||||
Trace( "wrap "..x.." "..n )
|
Trace( "wrap "..x.." "..n )
|
||||||
if x<0 then
|
if x<0 then
|
||||||
x = x + (math.ceil(-x/n)+1)*n;
|
x = x + (math.ceil(-x/n)+1)*n
|
||||||
end
|
end
|
||||||
Trace( "adjusted "..x )
|
Trace( "adjusted "..x )
|
||||||
local ret = math.mod(x,n)
|
local ret = math.mod(x,n)
|
||||||
@@ -67,21 +67,26 @@ function wrap(val,n)
|
|||||||
end
|
end
|
||||||
|
|
||||||
function fapproach( val, other_val, to_move )
|
function fapproach( val, other_val, to_move )
|
||||||
if val == other_val then return val end
|
if val == other_val then
|
||||||
local fDelta = other_val - val
|
return val -- already done!
|
||||||
local fSign = fDelta / math.abs( fDelta )
|
|
||||||
local fToMove = fSign*to_move
|
|
||||||
if math.abs(fToMove) > math.abs(fDelta) then
|
|
||||||
fToMove = fDelta -- snap
|
|
||||||
end
|
end
|
||||||
val = val + fToMove
|
|
||||||
|
local delta = other_val - val
|
||||||
|
local sign = delta / math.abs(delta)
|
||||||
|
local toMove = sign*to_move
|
||||||
|
|
||||||
|
if math.abs(toMove) > math.abs(delta) then
|
||||||
|
toMove = delta -- snap
|
||||||
|
end
|
||||||
|
|
||||||
|
val = val + toMove
|
||||||
return val
|
return val
|
||||||
end
|
end
|
||||||
|
|
||||||
function tableshuffle( t )
|
function tableshuffle( t )
|
||||||
local ret = { }
|
local ret = { }
|
||||||
for i=1,table.getn(t) do
|
for i=1,table.getn(t) do
|
||||||
table.insert( ret, math.random(i), t[i] );
|
table.insert( ret, math.random(i), t[i] )
|
||||||
end
|
end
|
||||||
return ret
|
return ret
|
||||||
end
|
end
|
||||||
@@ -89,7 +94,7 @@ end
|
|||||||
function tableslice( t, num )
|
function tableslice( t, num )
|
||||||
local ret = { }
|
local ret = { }
|
||||||
for i=1,table.getn(t) do
|
for i=1,table.getn(t) do
|
||||||
table.insert( ret, i, t[i] );
|
table.insert( ret, i, t[i] )
|
||||||
end
|
end
|
||||||
return ret
|
return ret
|
||||||
end
|
end
|
||||||
@@ -100,7 +105,9 @@ function GetRandomSongBackground()
|
|||||||
local song = SONGMAN:GetRandomSong()
|
local song = SONGMAN:GetRandomSong()
|
||||||
if song then
|
if song then
|
||||||
local path = song:GetBackgroundPath()
|
local path = song:GetBackgroundPath()
|
||||||
if path then return path end
|
if path then
|
||||||
|
return path
|
||||||
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
return THEME:GetPathG("", "_blank")
|
return THEME:GetPathG("", "_blank")
|
||||||
@@ -110,17 +117,19 @@ function GetSongBackground()
|
|||||||
local song = GAMESTATE:GetCurrentSong()
|
local song = GAMESTATE:GetCurrentSong()
|
||||||
if song then
|
if song then
|
||||||
local path = song:GetBackgroundPath()
|
local path = song:GetBackgroundPath()
|
||||||
if path then return path end
|
if path then
|
||||||
|
return path
|
||||||
|
end
|
||||||
end
|
end
|
||||||
return THEME:GetPathG("Common","fallback background")
|
return THEME:GetPathG("Common","fallback background")
|
||||||
end
|
end
|
||||||
|
|
||||||
function StepsOrTrailToCustomDifficulty( stepsOrTrail )
|
function StepsOrTrailToCustomDifficulty( stepsOrTrail )
|
||||||
if lua.CheckType("Steps", stepsOrTrail) then
|
if lua.CheckType("Steps", stepsOrTrail) then
|
||||||
return StepsToCustomDifficulty( stepsOrTrail );
|
return StepsToCustomDifficulty( stepsOrTrail )
|
||||||
end
|
end
|
||||||
if lua.CheckType("Trail", stepsOrTrail) then
|
if lua.CheckType("Trail", stepsOrTrail) then
|
||||||
return TrailToCustomDifficulty( stepsOrTrail );
|
return TrailToCustomDifficulty( stepsOrTrail )
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|||||||
@@ -46,36 +46,36 @@ anticipated future changes:
|
|||||||
-- ProfileDir(slot): gets the profile dir for slot,
|
-- ProfileDir(slot): gets the profile dir for slot,
|
||||||
-- where slot is a 'ProfileSlot_*' enum value.
|
-- where slot is a 'ProfileSlot_*' enum value.
|
||||||
local function ProfileDir(slot)
|
local function ProfileDir(slot)
|
||||||
local profileDir = PROFILEMAN:GetProfileDir(slot);
|
local profileDir = PROFILEMAN:GetProfileDir(slot)
|
||||||
return profileDir or nil;
|
return profileDir or nil
|
||||||
end;
|
end
|
||||||
|
|
||||||
-- Tries to parse the file at path. If successful, returns a table of mods.
|
-- Tries to parse the file at path. If successful, returns a table of mods.
|
||||||
-- If it can't open the file, it will write a fallback set of mods.
|
-- If it can't open the file, it will write a fallback set of mods.
|
||||||
local function ParseSpeedModFile(path)
|
local function ParseSpeedModFile(path)
|
||||||
local file = RageFileUtil.CreateRageFile();
|
local file = RageFileUtil.CreateRageFile()
|
||||||
if file:Open(path, 1) then
|
if file:Open(path, 1) then
|
||||||
-- success
|
-- success
|
||||||
local contents = file:Read();
|
local contents = file:Read()
|
||||||
mods = split(',',contents);
|
mods = split(',',contents)
|
||||||
|
|
||||||
-- strip any whitespace
|
-- strip any whitespace
|
||||||
for i=1,#mods do
|
for i=1,#mods do
|
||||||
string.gsub(mods[i], "%s", "");
|
string.gsub(mods[i], "%s", "")
|
||||||
end
|
end
|
||||||
|
|
||||||
file:destroy();
|
file:destroy()
|
||||||
return mods;
|
return mods
|
||||||
else
|
else
|
||||||
-- error; write a fallback mod file and return it
|
-- error; write a fallback mod file and return it
|
||||||
local fallbackString = "0.5x,1x,1.5x,2x,3x,4x,8x,C200,C400";
|
local fallbackString = "0.5x,1x,1.5x,2x,3x,4x,8x,C200,C400"
|
||||||
Trace("[CustomSpeedMods]: Could not read SpeedMods; writing fallback to "..path);
|
Trace("[CustomSpeedMods]: Could not read SpeedMods; writing fallback to "..path)
|
||||||
file:Open(path, 2);
|
file:Open(path, 2)
|
||||||
file:Write(fallbackString);
|
file:Write(fallbackString)
|
||||||
file:destroy();
|
file:destroy()
|
||||||
return split(',',fallbackString);
|
return split(',',fallbackString)
|
||||||
end;
|
end
|
||||||
end;
|
end
|
||||||
|
|
||||||
-- MarkDupes(src,parent)
|
-- MarkDupes(src,parent)
|
||||||
-- Marks duplicates in src from any matches in parent.
|
-- Marks duplicates in src from any matches in parent.
|
||||||
@@ -84,32 +84,34 @@ local function MarkDupes(src,parent)
|
|||||||
for iPar=1,#parent do
|
for iPar=1,#parent do
|
||||||
for iSrc=1,#src do
|
for iSrc=1,#src do
|
||||||
if parent[iPar] == src[iSrc] then
|
if parent[iPar] == src[iSrc] then
|
||||||
src[iSrc] = "XXX";
|
src[iSrc] = "XXX"
|
||||||
end;
|
end
|
||||||
end;
|
end
|
||||||
end;
|
end
|
||||||
return src;
|
return src
|
||||||
end;
|
end
|
||||||
|
|
||||||
-- RemoveMarked(src)
|
-- RemoveMarked(src)
|
||||||
-- Removes any values marked for deletion.
|
-- Removes any values marked for deletion.
|
||||||
local function RemoveMarked(src)
|
local function RemoveMarked(src)
|
||||||
for iSrc=1,#src do
|
for iSrc=1,#src do
|
||||||
if src[iSrc] == "XXX" then
|
if src[iSrc] == "XXX" then
|
||||||
table.remove(src,iSrc);
|
table.remove(src,iSrc)
|
||||||
end;
|
end
|
||||||
end;
|
end
|
||||||
return src;
|
return src
|
||||||
end;
|
end
|
||||||
|
|
||||||
-- MergeTables(parent,child)
|
-- MergeTables(parent,child)
|
||||||
-- Adds the child's contents to the parent.
|
-- Adds the child's contents to the parent.
|
||||||
-- the overall mods are usually used as the parent.
|
-- the overall mods are usually used as the parent.
|
||||||
local function MergeTables(parent,child)
|
local function MergeTables(parent,child)
|
||||||
child = RemoveMarked(child);
|
child = RemoveMarked(child)
|
||||||
if #child == 0 then return parent; end;
|
if #child == 0 then
|
||||||
|
return parent
|
||||||
|
end
|
||||||
|
|
||||||
local addMe = true;
|
local addMe = true
|
||||||
for iC=1,#child do
|
for iC=1,#child do
|
||||||
--[[
|
--[[
|
||||||
for iP=1,#parent do
|
for iP=1,#parent do
|
||||||
@@ -118,133 +120,137 @@ local function MergeTables(parent,child)
|
|||||||
-- why am I doing this anyways?
|
-- why am I doing this anyways?
|
||||||
-- by the time these tables are passed in,
|
-- by the time these tables are passed in,
|
||||||
-- dupes should be gone.
|
-- dupes should be gone.
|
||||||
end;
|
end
|
||||||
end;
|
end
|
||||||
]]
|
]]
|
||||||
if addMe then
|
if addMe then
|
||||||
table.insert(parent,child[iC]);
|
table.insert(parent,child[iC])
|
||||||
end;
|
end
|
||||||
end;
|
end
|
||||||
return parent;
|
return parent
|
||||||
end;
|
end
|
||||||
|
|
||||||
-- code in this function is based off of code in
|
-- code in this function is based off of code in
|
||||||
-- http://astrofra.com/weblog/files/sort.lua
|
-- http://astrofra.com/weblog/files/sort.lua
|
||||||
local function AnonSort(t)
|
local function AnonSort(t)
|
||||||
local index_min;
|
local index_min
|
||||||
for i=1,#t,1 do
|
for i=1,#t,1 do
|
||||||
index_min = i;
|
index_min = i
|
||||||
for j=i+1,#t,1 do
|
for j=i+1,#t,1 do
|
||||||
if (t[j] < t[index_min]) then
|
if (t[j] < t[index_min]) then
|
||||||
index_min = j;
|
index_min = j
|
||||||
end;
|
end
|
||||||
end;
|
end
|
||||||
t[i], t[index_min] = t[index_min], t[i];
|
t[i], t[index_min] = t[index_min], t[i]
|
||||||
end;
|
end
|
||||||
return t;
|
return t
|
||||||
end;
|
end
|
||||||
|
|
||||||
local function SpeedModSort(tab)
|
local function SpeedModSort(tab)
|
||||||
local xMods = {};
|
local xMods = {}
|
||||||
local cMods = {};
|
local cMods = {}
|
||||||
--local mMods = {};
|
--local mMods = {}
|
||||||
|
|
||||||
-- convert to numbers so sorting works:
|
-- convert to numbers so sorting works:
|
||||||
for i=1,#tab do
|
for i=1,#tab do
|
||||||
local typ,val;
|
local typ,val
|
||||||
-- xxx: If people use a floating point CMod (e.g. C420.50),
|
-- xxx: If people use a floating point CMod (e.g. C420.50),
|
||||||
-- it will get rounded. C420.50 gets rounded to 421, btw. -aj
|
-- it will get rounded. C420.50 gets rounded to 421, btw. -aj
|
||||||
if string.find(tab[i],"C%d") then
|
if string.find(tab[i],"C%d") then
|
||||||
typ = cMods;
|
typ = cMods
|
||||||
val = string.gsub(tab[i], "C", "");
|
val = string.gsub(tab[i], "C", "")
|
||||||
elseif string.find(tab[i],"M%d") then
|
elseif string.find(tab[i],"M%d") then
|
||||||
Trace("[CustomSpeedMods] OpenITG's M-Mods are not supported yet in sm-ssc.");
|
Trace("[CustomSpeedMods] OpenITG's M-Mods are not supported yet in sm-ssc.")
|
||||||
--typ = mMods;
|
--typ = mMods
|
||||||
--val = string.gsub(tab[i], "M", "");
|
--val = string.gsub(tab[i], "M", "")
|
||||||
else
|
else
|
||||||
typ = xMods;
|
typ = xMods
|
||||||
val = string.gsub(tab[i], "x", "");
|
val = string.gsub(tab[i], "x", "")
|
||||||
end;
|
end
|
||||||
table.insert(typ,tonumber(val));
|
table.insert(typ,tonumber(val))
|
||||||
end;
|
end
|
||||||
|
|
||||||
-- sort xMods
|
-- sort xMods
|
||||||
xMods = AnonSort(xMods);
|
xMods = AnonSort(xMods)
|
||||||
-- sort cMods
|
-- sort cMods
|
||||||
cMods = AnonSort(cMods);
|
cMods = AnonSort(cMods)
|
||||||
-- sort mMods
|
-- sort mMods
|
||||||
--mMods = AnonSort(mMods)
|
--mMods = AnonSort(mMods)
|
||||||
local fin = {};
|
local fin = {}
|
||||||
-- convert it back to a string since that's what it expects
|
-- convert it back to a string since that's what it expects
|
||||||
for i=1,#xMods do table.insert(fin, xMods[i].."x"); end;
|
for i=1,#xMods do
|
||||||
for i=1,#cMods do table.insert(fin, "C"..cMods[i]); end;
|
table.insert(fin, xMods[i].."x")
|
||||||
|
end
|
||||||
|
for i=1,#cMods do
|
||||||
|
table.insert(fin, "C"..cMods[i])
|
||||||
|
end
|
||||||
--for i=1,#mMods do table.insert(fin, "M"..mMods[i]); end;
|
--for i=1,#mMods do table.insert(fin, "M"..mMods[i]); end;
|
||||||
return fin;
|
return fin
|
||||||
end;
|
end
|
||||||
|
|
||||||
-- parse everything
|
-- parse everything
|
||||||
local function GetSpeedMods()
|
local function GetSpeedMods()
|
||||||
local finalMods = {};
|
local finalMods = {}
|
||||||
|
|
||||||
local baseFilename = "SpeedMods.txt"
|
local baseFilename = "SpeedMods.txt"
|
||||||
local profileDirs = {
|
local profileDirs = {
|
||||||
Fallback = "Data/",
|
Fallback = "Data/",
|
||||||
Machine = ProfileDir('ProfileSlot_Machine'),
|
Machine = ProfileDir('ProfileSlot_Machine'),
|
||||||
PlayerNumber_P1 = ProfileDir('ProfileSlot_Player1'),
|
PlayerNumber_P1 = ProfileDir('ProfileSlot_Player1'),
|
||||||
PlayerNumber_P2 = ProfileDir('ProfileSlot_Player2'),
|
PlayerNumber_P2 = ProfileDir('ProfileSlot_Player2')
|
||||||
};
|
}
|
||||||
|
|
||||||
-- figure out how many players we have to deal with.
|
-- figure out how many players we have to deal with.
|
||||||
local numPlayers = GAMESTATE:GetNumPlayersEnabled();
|
local numPlayers = GAMESTATE:GetNumPlayersEnabled()
|
||||||
-- load fallback
|
-- load fallback
|
||||||
local fallbackMods = ParseSpeedModFile(profileDirs.Fallback..baseFilename);
|
local fallbackMods = ParseSpeedModFile(profileDirs.Fallback..baseFilename)
|
||||||
|
|
||||||
-- load machine
|
-- load machine
|
||||||
local machineMods = ParseSpeedModFile(profileDirs.Machine..baseFilename);
|
local machineMods = ParseSpeedModFile(profileDirs.Machine..baseFilename)
|
||||||
|
|
||||||
local playerMods = {};
|
local playerMods = {}
|
||||||
for pn in ivalues(GAMESTATE:GetHumanPlayers()) do
|
for pn in ivalues(GAMESTATE:GetHumanPlayers()) do
|
||||||
-- file loading logic per player;
|
-- file loading logic per player;
|
||||||
-- only bother if it's not the machine profile though.
|
-- only bother if it's not the machine profile though.
|
||||||
if PROFILEMAN:IsPersistentProfile(pn) or
|
if PROFILEMAN:IsPersistentProfile(pn) or
|
||||||
MEMCARDMAN:GetCardState(pn) == 'MemoryCardState_ready' then
|
MEMCARDMAN:GetCardState(pn) == 'MemoryCardState_ready' then
|
||||||
playerMods[#playerMods+1] = ParseSpeedModFile(profileDirs[pn]..baseFilename);
|
playerMods[#playerMods+1] = ParseSpeedModFile(profileDirs[pn]..baseFilename)
|
||||||
end;
|
end
|
||||||
end;
|
end
|
||||||
|
|
||||||
-- with all loaded... the merging BEGINS!!
|
-- with all loaded... the merging BEGINS!!
|
||||||
finalMods = fallbackMods;
|
finalMods = fallbackMods
|
||||||
-- mine for duplicates, first pass (fallback <-> machine)
|
-- mine for duplicates, first pass (fallback <-> machine)
|
||||||
machineMods = MarkDupes(machineMods,finalMods);
|
machineMods = MarkDupes(machineMods,finalMods)
|
||||||
for ply=1,#playerMods do
|
for ply=1,#playerMods do
|
||||||
playerMods[ply] = MarkDupes(playerMods[ply],finalMods);
|
playerMods[ply] = MarkDupes(playerMods[ply],finalMods)
|
||||||
end;
|
end
|
||||||
-- remove XXX, first pass
|
-- remove XXX, first pass
|
||||||
machineMods = RemoveMarked(machineMods);
|
machineMods = RemoveMarked(machineMods);
|
||||||
for ply=1,#playerMods do
|
for ply=1,#playerMods do
|
||||||
playerMods[ply] = RemoveMarked(playerMods[ply]);
|
playerMods[ply] = RemoveMarked(playerMods[ply])
|
||||||
end;
|
end
|
||||||
-- mine for duplicates, second pass (machine <-> player)
|
-- mine for duplicates, second pass (machine <-> player)
|
||||||
for ply=1,#playerMods do
|
for ply=1,#playerMods do
|
||||||
playerMods[ply] = MarkDupes(playerMods[ply],machineMods);
|
playerMods[ply] = MarkDupes(playerMods[ply],machineMods)
|
||||||
end;
|
end
|
||||||
-- remove XXX, second pass
|
-- remove XXX, second pass
|
||||||
machineMods = RemoveMarked(machineMods);
|
machineMods = RemoveMarked(machineMods)
|
||||||
for ply=1,#playerMods do
|
for ply=1,#playerMods do
|
||||||
playerMods[ply] = RemoveMarked(playerMods[ply]);
|
playerMods[ply] = RemoveMarked(playerMods[ply])
|
||||||
end;
|
end
|
||||||
|
|
||||||
-- merge zone
|
-- merge zone
|
||||||
finalMods = MergeTables(finalMods,machineMods);
|
finalMods = MergeTables(finalMods,machineMods)
|
||||||
for ply=1,#playerMods do
|
for ply=1,#playerMods do
|
||||||
finalMods = MergeTables(finalMods,playerMods[ply]);
|
finalMods = MergeTables(finalMods,playerMods[ply])
|
||||||
end;
|
end
|
||||||
|
|
||||||
-- final removal of XXX before sorting
|
-- final removal of XXX before sorting
|
||||||
finalMods = RemoveMarked(finalMods);
|
finalMods = RemoveMarked(finalMods)
|
||||||
-- sort the mods before returning them
|
-- sort the mods before returning them
|
||||||
return SpeedModSort(finalMods);
|
return SpeedModSort(finalMods)
|
||||||
end;
|
end
|
||||||
|
|
||||||
function SpeedMods()
|
function SpeedMods()
|
||||||
-- here we see the option menu itself.
|
-- here we see the option menu itself.
|
||||||
@@ -257,36 +263,36 @@ function SpeedMods()
|
|||||||
Choices = GetSpeedMods(),
|
Choices = GetSpeedMods(),
|
||||||
|
|
||||||
LoadSelections = function(self, list, pn)
|
LoadSelections = function(self, list, pn)
|
||||||
local pMods = GAMESTATE:GetPlayerState(pn):GetPlayerOptions("ModsLevel_Preferred");
|
local pMods = GAMESTATE:GetPlayerState(pn):GetPlayerOptions("ModsLevel_Preferred")
|
||||||
for i = 1,table.getn(self.Choices) do
|
for i = 1,table.getn(self.Choices) do
|
||||||
if string.find(pMods, self.Choices[i]) then
|
if string.find(pMods, self.Choices[i]) then
|
||||||
list[i] = true;
|
list[i] = true
|
||||||
return;
|
return
|
||||||
end;
|
end
|
||||||
end;
|
end
|
||||||
|
|
||||||
-- if we've reached this point, try to find 1x or 1.0x instead,
|
-- if we've reached this point, try to find 1x or 1.0x instead,
|
||||||
-- in case the player has defined a speed mod under 1.0x
|
-- in case the player has defined a speed mod under 1.0x
|
||||||
for i = 1,table.getn(self.Choices) do
|
for i = 1,table.getn(self.Choices) do
|
||||||
if self.Choices[i] == "1x" or self.Choices[i] == "1.0x" then
|
if self.Choices[i] == "1x" or self.Choices[i] == "1.0x" then
|
||||||
list[i] = true;
|
list[i] = true
|
||||||
return;
|
return
|
||||||
end;
|
end
|
||||||
end;
|
end
|
||||||
end,
|
end,
|
||||||
SaveSelections = function(self, list, pn)
|
SaveSelections = function(self, list, pn)
|
||||||
for i = 1,table.getn(self.Choices) do
|
for i = 1,table.getn(self.Choices) do
|
||||||
if list[i] then
|
if list[i] then
|
||||||
local PlayerState = GAMESTATE:GetPlayerState(pn);
|
local PlayerState = GAMESTATE:GetPlayerState(pn)
|
||||||
PlayerState:SetPlayerOptions("ModsLevel_Preferred",self.Choices[i]);
|
PlayerState:SetPlayerOptions("ModsLevel_Preferred",self.Choices[i])
|
||||||
return
|
return
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
};
|
}
|
||||||
setmetatable( t, t );
|
setmetatable( t, t )
|
||||||
return t;
|
return t
|
||||||
end;
|
end
|
||||||
|
|
||||||
--[[
|
--[[
|
||||||
Copyright © 2008-2009 AJ Kelly/KKI Labs.
|
Copyright © 2008-2009 AJ Kelly/KKI Labs.
|
||||||
|
|||||||
@@ -46,26 +46,25 @@ local dateChars = {
|
|||||||
--[[ full datetime ]]
|
--[[ full datetime ]]
|
||||||
'c', -- ISO 8601 date
|
'c', -- ISO 8601 date
|
||||||
'r', -- RFC 2822 formatted date
|
'r', -- RFC 2822 formatted date
|
||||||
'U', -- Seconds since the Unix Epoch (January 1 1970 00:00:00 GMT)
|
'U' -- Seconds since the Unix Epoch (January 1 1970 00:00:00 GMT)
|
||||||
};
|
}
|
||||||
|
|
||||||
function date(format,...)
|
function date(format,...)
|
||||||
if ... then
|
if ... then
|
||||||
-- convert value
|
-- convert value
|
||||||
else
|
else
|
||||||
-- convert current time
|
-- convert current time
|
||||||
|
end
|
||||||
end;
|
end
|
||||||
end;
|
|
||||||
|
|
||||||
Date = {
|
Date = {
|
||||||
Today = function()
|
Today = function()
|
||||||
return string.format("%i%02i%02i", Year(), (MonthOfYear()+1), DayOfMonth());
|
return string.format("%i%02i%02i", Year(), (MonthOfYear()+1), DayOfMonth())
|
||||||
end;
|
end
|
||||||
};
|
}
|
||||||
|
|
||||||
Time = {
|
Time = {
|
||||||
Now = function()
|
Now = function()
|
||||||
return string.format( "%02i:%02i:%02i", Hour(), Minute(), Second() );
|
return string.format( "%02i:%02i:%02i", Hour(), Minute(), Second() )
|
||||||
end;
|
end
|
||||||
};
|
}
|
||||||
@@ -10,7 +10,7 @@ This new version should also work better and be less confusing.
|
|||||||
--]]
|
--]]
|
||||||
|
|
||||||
-- Env table global
|
-- Env table global
|
||||||
envTable = GAMESTATE:Env();
|
envTable = GAMESTATE:Env()
|
||||||
|
|
||||||
-- setenv(name,value)
|
-- setenv(name,value)
|
||||||
-- Sets aside an entry for /name/ and puts /value/ into it.
|
-- Sets aside an entry for /name/ and puts /value/ into it.
|
||||||
@@ -18,14 +18,14 @@ envTable = GAMESTATE:Env();
|
|||||||
-- If you need to store more than one value, you're welcome to use a
|
-- If you need to store more than one value, you're welcome to use a
|
||||||
-- table as /value/, it should work just fine.
|
-- table as /value/, it should work just fine.
|
||||||
function setenv(name,value)
|
function setenv(name,value)
|
||||||
envTable[name] = value;
|
envTable[name] = value
|
||||||
end;
|
end
|
||||||
|
|
||||||
-- getenv(name)
|
-- getenv(name)
|
||||||
-- This will return whatever value is at envTable[name].
|
-- This will return whatever value is at envTable[name].
|
||||||
function getenv(name)
|
function getenv(name)
|
||||||
return envTable[name];
|
return envTable[name]
|
||||||
end;
|
end
|
||||||
|
|
||||||
--[[
|
--[[
|
||||||
Copyright © 2008 AJ Kelly/KKI Labs
|
Copyright © 2008 AJ Kelly/KKI Labs
|
||||||
|
|||||||
@@ -2,10 +2,12 @@
|
|||||||
-- [en] This file is used to store settings that should be different in each
|
-- [en] This file is used to store settings that should be different in each
|
||||||
-- game mode.
|
-- game mode.
|
||||||
|
|
||||||
|
-- shakesoda calls this pump.lua
|
||||||
|
|
||||||
-- GameCompatibleModes:
|
-- GameCompatibleModes:
|
||||||
-- [en] returns possible modes for ScreenSelectPlayMode
|
-- [en] returns possible modes for ScreenSelectPlayMode
|
||||||
function GameCompatibleModes()
|
function GameCompatibleModes()
|
||||||
sGame = GAMESTATE:GetCurrentGame():GetName();
|
sGame = GAMESTATE:GetCurrentGame():GetName()
|
||||||
local Modes = {
|
local Modes = {
|
||||||
dance = "Single,Double,Solo,Versus,Couple",
|
dance = "Single,Double,Solo,Versus,Couple",
|
||||||
pump = "Single,Double,HalfDouble,Versus,Couple",
|
pump = "Single,Double,HalfDouble,Versus,Couple",
|
||||||
@@ -13,20 +15,20 @@ function GameCompatibleModes()
|
|||||||
kb7 = "KB7",
|
kb7 = "KB7",
|
||||||
para = "Single",
|
para = "Single",
|
||||||
techno = "Single4,Single5,Single8,Double4,Double8",
|
techno = "Single4,Single5,Single8,Double4,Double8",
|
||||||
lights = "Single", -- lights shouldn't be playable
|
lights = "Single" -- lights shouldn't be playable
|
||||||
};
|
}
|
||||||
return Modes[sGame];
|
return Modes[sGame]
|
||||||
end
|
end
|
||||||
|
|
||||||
function SelectProfileKeys()
|
function SelectProfileKeys()
|
||||||
local game = GAMESTATE:GetCurrentGame():GetName();
|
local game = GAMESTATE:GetCurrentGame():GetName()
|
||||||
return game == "dance" and "Up,Down,Start,Back,Up2,Down2" or "Up,Down,Start,Back";
|
return game == "dance" and "Up,Down,Start,Back,Up2,Down2" or "Up,Down,Start,Back"
|
||||||
end;
|
end
|
||||||
|
|
||||||
-- ScoreKeeperClass:
|
-- ScoreKeeperClass:
|
||||||
-- [en] Determines the correct ScoreKeeper class to use.
|
-- [en] Determines the correct ScoreKeeper class to use.
|
||||||
function ScoreKeeperClass()
|
function ScoreKeeperClass()
|
||||||
sGame = GAMESTATE:GetCurrentGame():GetName();
|
sGame = GAMESTATE:GetCurrentGame():GetName()
|
||||||
local ScoreKeepers = {
|
local ScoreKeepers = {
|
||||||
-- xxx: allow for ScoreKeeperShared when needed
|
-- xxx: allow for ScoreKeeperShared when needed
|
||||||
dance = "ScoreKeeperNormal",
|
dance = "ScoreKeeperNormal",
|
||||||
@@ -38,149 +40,159 @@ function ScoreKeeperClass()
|
|||||||
ez2 = "ScoreKeeperNormal",
|
ez2 = "ScoreKeeperNormal",
|
||||||
ds3ddx = "ScoreKeeperNormal",
|
ds3ddx = "ScoreKeeperNormal",
|
||||||
maniax = "ScoreKeeperNormal",
|
maniax = "ScoreKeeperNormal",
|
||||||
guitar = "ScoreKeeperGuitar",
|
guitar = "ScoreKeeperGuitar"
|
||||||
};
|
}
|
||||||
return ScoreKeepers[sGame]
|
return ScoreKeepers[sGame]
|
||||||
end;
|
end
|
||||||
|
|
||||||
-- ComboContinue:
|
-- ComboContinue:
|
||||||
-- [en]
|
-- [en]
|
||||||
function ComboContinue()
|
function ComboContinue()
|
||||||
sGame = GAMESTATE:GetCurrentGame():GetName();
|
sGame = GAMESTATE:GetCurrentGame():GetName()
|
||||||
local Continue = {
|
local Continue = {
|
||||||
dance = GAMESTATE:GetPlayMode() == "PlayMode_Oni" and "TapNoteScore_W2" or "TapNoteScore_W3",
|
dance = GAMESTATE:GetPlayMode() == "PlayMode_Oni" and "TapNoteScore_W2" or "TapNoteScore_W3",
|
||||||
pump = "TapNoteScore_W4",
|
pump = "TapNoteScore_W4",
|
||||||
beat = "TapNoteScore_W3",
|
beat = "TapNoteScore_W3",
|
||||||
kb7 = "TapNoteScore_W3",
|
kb7 = "TapNoteScore_W3",
|
||||||
para = "TapNoteScore_W4",
|
para = "TapNoteScore_W4"
|
||||||
};
|
}
|
||||||
return Continue[sGame]
|
return Continue[sGame]
|
||||||
end;
|
end
|
||||||
|
|
||||||
function ComboMaintain()
|
function ComboMaintain()
|
||||||
sGame = GAMESTATE:GetCurrentGame():GetName();
|
sGame = GAMESTATE:GetCurrentGame():GetName()
|
||||||
local Maintain = {
|
local Maintain = {
|
||||||
dance = "TapNoteScore_W3",
|
dance = "TapNoteScore_W3",
|
||||||
pump = "TapNoteScore_W4",
|
pump = "TapNoteScore_W4",
|
||||||
beat = "TapNoteScore_W3",
|
beat = "TapNoteScore_W3",
|
||||||
kb7 = "TapNoteScore_W3",
|
kb7 = "TapNoteScore_W3",
|
||||||
para = "TapNoteScore_W4",
|
para = "TapNoteScore_W4"
|
||||||
};
|
}
|
||||||
return Maintain[sGame]
|
return Maintain[sGame]
|
||||||
end;
|
end
|
||||||
|
|
||||||
function ComboPerRow()
|
function ComboPerRow()
|
||||||
sGame = GAMESTATE:GetCurrentGame():GetName();
|
sGame = GAMESTATE:GetCurrentGame():GetName()
|
||||||
if sGame == "pump" then
|
if sGame == "pump" then
|
||||||
return true;
|
return true
|
||||||
elseif GAMESTATE:GetPlayMode() == "PlayMode_Oni" then
|
elseif GAMESTATE:GetPlayMode() == "PlayMode_Oni" then
|
||||||
return true;
|
return true
|
||||||
else return false;
|
else
|
||||||
end;
|
return false
|
||||||
end;
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
-- these need cleanup really.
|
||||||
function HitCombo()
|
function HitCombo()
|
||||||
sGame = GAMESTATE:GetCurrentGame():GetName();
|
sGame = GAMESTATE:GetCurrentGame():GetName()
|
||||||
local Combo = {
|
local Combo = {
|
||||||
dance = 2,
|
dance = 2,
|
||||||
pump = 4,
|
pump = 4,
|
||||||
beat = 2,
|
beat = 2,
|
||||||
kb7 = 2,
|
kb7 = 2,
|
||||||
para = 2,
|
para = 2,
|
||||||
guitar = 2,
|
guitar = 2
|
||||||
};
|
}
|
||||||
return Combo[sGame]
|
return Combo[sGame]
|
||||||
end;
|
end
|
||||||
|
|
||||||
function MissCombo()
|
function MissCombo()
|
||||||
sGame = GAMESTATE:GetCurrentGame():GetName();
|
sGame = GAMESTATE:GetCurrentGame():GetName()
|
||||||
local Combo = {
|
local Combo = {
|
||||||
dance = 2,
|
dance = 2,
|
||||||
pump = 4,
|
pump = 4,
|
||||||
beat = 0,
|
beat = 0,
|
||||||
kb7 = 0,
|
kb7 = 0,
|
||||||
para = 0,
|
para = 0,
|
||||||
guitar = 0,
|
guitar = 0
|
||||||
};
|
}
|
||||||
return Combo[sGame]
|
return Combo[sGame]
|
||||||
end;
|
end
|
||||||
|
|
||||||
-- FailCombo:
|
-- FailCombo:
|
||||||
-- [en] The combo that causes game failure.
|
-- [en] The combo that causes game failure.
|
||||||
function FailCombo()
|
function FailCombo()
|
||||||
sGame = GAMESTATE:GetCurrentGame():GetName();
|
sGame = GAMESTATE:GetCurrentGame():GetName()
|
||||||
local Combo = {
|
local Combo = {
|
||||||
dance = -1, -- ITG uses 30
|
dance = -1, -- ITG uses 30
|
||||||
pump = 51, -- Pump Pro uses 30, real Pump uses 51
|
pump = 51, -- Pump Pro uses 30, real Pump uses 51
|
||||||
beat = -1,
|
beat = -1,
|
||||||
kb7 = -1,
|
kb7 = -1,
|
||||||
para = -1,
|
para = -1,
|
||||||
guitar = -1,
|
guitar = -1
|
||||||
};
|
}
|
||||||
return Combo[sGame]
|
return Combo[sGame]
|
||||||
end;
|
end
|
||||||
|
|
||||||
-- todo: use tables for some of these -aj
|
-- todo: use tables for some of these -aj
|
||||||
function HoldTiming()
|
function HoldTiming()
|
||||||
if GAMESTATE:GetCurrentGame():GetName() == "pump" then
|
if GAMESTATE:GetCurrentGame():GetName() == "pump" then
|
||||||
return 0;
|
return 0
|
||||||
else return PREFSMAN:GetPreference("TimingWindowSecondsHold");
|
else
|
||||||
end;
|
return PREFSMAN:GetPreference("TimingWindowSecondsHold")
|
||||||
end;
|
end
|
||||||
|
end
|
||||||
|
|
||||||
function ShowHoldJudgments()
|
function ShowHoldJudgments()
|
||||||
return not GAMESTATE:GetCurrentGame():GetName() == "pump";
|
return not GAMESTATE:GetCurrentGame():GetName() == "pump"
|
||||||
end;
|
end
|
||||||
|
|
||||||
function HoldHeadStep()
|
function HoldHeadStep()
|
||||||
if GAMESTATE:GetCurrentGame():GetName() == "pump" then
|
if GAMESTATE:GetCurrentGame():GetName() == "pump" then
|
||||||
return false;
|
return false
|
||||||
else return true;
|
else
|
||||||
end;
|
return true
|
||||||
end;
|
end
|
||||||
|
end
|
||||||
|
|
||||||
function InitialHoldLife()
|
function InitialHoldLife()
|
||||||
if GAMESTATE:GetCurrentGame():GetName() == "pump" then
|
if GAMESTATE:GetCurrentGame():GetName() == "pump" then
|
||||||
return 0.05;
|
return 0.05
|
||||||
else return 1;
|
else
|
||||||
end;
|
return 1
|
||||||
end;
|
end
|
||||||
|
end
|
||||||
|
|
||||||
function MaxHoldLife()
|
function MaxHoldLife()
|
||||||
if GAMESTATE:GetCurrentGame():GetName() == "pump" then
|
if GAMESTATE:GetCurrentGame():GetName() == "pump" then
|
||||||
return 0.05;
|
return 0.05
|
||||||
else return 1;
|
else
|
||||||
end;
|
return 1
|
||||||
end;
|
end
|
||||||
|
end
|
||||||
|
|
||||||
function ImmediateHoldLetGo()
|
function ImmediateHoldLetGo()
|
||||||
if GAMESTATE:GetCurrentGame():GetName() == "pump" then
|
if GAMESTATE:GetCurrentGame():GetName() == "pump" then
|
||||||
return false;
|
return false
|
||||||
else return true;
|
else
|
||||||
end;
|
return true
|
||||||
end;
|
end
|
||||||
|
end
|
||||||
|
|
||||||
function RollBodyIncrementsCombo()
|
function RollBodyIncrementsCombo()
|
||||||
return false
|
return false
|
||||||
--[[ if GAMESTATE:GetCurrentGame():GetName() == "pump" then
|
--[[ if GAMESTATE:GetCurrentGame():GetName() == "pump" then
|
||||||
return false;
|
return false
|
||||||
else return true;
|
else
|
||||||
end; --]]
|
return true
|
||||||
end;
|
end --]]
|
||||||
|
end
|
||||||
|
|
||||||
function CheckpointsTapsSeparateJudgment()
|
function CheckpointsTapsSeparateJudgment()
|
||||||
if GAMESTATE:GetCurrentGame():GetName() == "pump" then
|
if GAMESTATE:GetCurrentGame():GetName() == "pump" then
|
||||||
return false;
|
return false
|
||||||
else return true;
|
else
|
||||||
end;
|
return true
|
||||||
end;
|
end
|
||||||
|
end
|
||||||
|
|
||||||
function ScoreMissedHoldsAndRolls()
|
function ScoreMissedHoldsAndRolls()
|
||||||
if GAMESTATE:GetCurrentGame():GetName() == "pump" then
|
if GAMESTATE:GetCurrentGame():GetName() == "pump" then
|
||||||
return false;
|
return false
|
||||||
else return true;
|
else
|
||||||
end;
|
return true
|
||||||
end;
|
end
|
||||||
|
end
|
||||||
|
|
||||||
local tNotePositions = {
|
local tNotePositions = {
|
||||||
-- StepMania 3.9/4.0
|
-- StepMania 3.9/4.0
|
||||||
@@ -192,13 +204,14 @@ local tNotePositions = {
|
|||||||
Lower = {
|
Lower = {
|
||||||
-125,
|
-125,
|
||||||
145,
|
145,
|
||||||
},
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
function GetTapPosition( sType )
|
function GetTapPosition( sType )
|
||||||
bCategory = (sType == 'Standard') and 1 or 2;
|
bCategory = (sType == 'Standard') and 1 or 2
|
||||||
-- true: Normal
|
-- true: Normal
|
||||||
-- false: Lower
|
-- false: Lower
|
||||||
bPreference = GetUserPrefB("UserPrefNotePosition") and "Normal" or "Lower";
|
bPreference = GetUserPrefB("UserPrefNotePosition") and "Normal" or "Lower"
|
||||||
tNotePos = tNotePositions[bPreference];
|
tNotePos = tNotePositions[bPreference]
|
||||||
return tNotePos[bCategory]
|
return tNotePos[bCategory]
|
||||||
end
|
end
|
||||||
+115
-110
@@ -19,25 +19,30 @@ Saturation is different too.
|
|||||||
|
|
||||||
-- ColorToHSV(c)
|
-- ColorToHSV(c)
|
||||||
-- Takes in a normal color("") and returns a table with the HSV values.
|
-- Takes in a normal color("") and returns a table with the HSV values.
|
||||||
|
function HasAlpha(c)
|
||||||
|
if c[4] then
|
||||||
|
return c[4]
|
||||||
|
else
|
||||||
|
return 1
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
function ColorToHSV(c)
|
function ColorToHSV(c)
|
||||||
local r = c[1];
|
local r = c[1]
|
||||||
local g = c[2];
|
local g = c[2]
|
||||||
local b = c[3];
|
local b = c[3]
|
||||||
-- alpha requires error checking sometimes.
|
-- alpha requires error checking sometimes.
|
||||||
local a;
|
local a = HasAlpha(c)
|
||||||
if c[4] then a = c[4];
|
|
||||||
else a = 1;
|
|
||||||
end;
|
|
||||||
|
|
||||||
local h = 0;
|
local h = 0
|
||||||
local s = 0;
|
local s = 0
|
||||||
local v = 0;
|
local v = 0
|
||||||
|
|
||||||
local min = math.min( r, g, b );
|
local min = math.min( r, g, b )
|
||||||
local max = math.max( r, g, b );
|
local max = math.max( r, g, b )
|
||||||
v = max;
|
v = max
|
||||||
|
|
||||||
local delta = max - min;
|
local delta = max - min
|
||||||
|
|
||||||
-- xxx: how do we deal with complete black?
|
-- xxx: how do we deal with complete black?
|
||||||
if min == 0 and max == 0 then
|
if min == 0 and max == 0 then
|
||||||
@@ -47,137 +52,137 @@ function ColorToHSV(c)
|
|||||||
Sat = 0,
|
Sat = 0,
|
||||||
Value = 0,
|
Value = 0,
|
||||||
Alpha = a
|
Alpha = a
|
||||||
};
|
}
|
||||||
end;
|
end
|
||||||
|
|
||||||
if max ~= 0 then
|
if max ~= 0 then
|
||||||
s = delta / max; -- rofl deltamax :|
|
s = delta / max -- rofl deltamax :|
|
||||||
else
|
else
|
||||||
-- r = g = b = 0; s = 0, v is undefined
|
-- r = g = b = 0; s = 0, v is undefined
|
||||||
s = 0;
|
s = 0
|
||||||
h = -1;
|
h = -1
|
||||||
return {
|
return {
|
||||||
Hue = h,
|
Hue = h,
|
||||||
Sat = s,
|
Sat = s,
|
||||||
Value = v,
|
Value = v,
|
||||||
Alpha = 1
|
Alpha = 1
|
||||||
};
|
}
|
||||||
end;
|
end
|
||||||
|
|
||||||
if r == max then
|
if r == max then
|
||||||
h = ( g - b ) / delta; -- yellow/magenta
|
h = ( g - b ) / delta -- yellow/magenta
|
||||||
elseif g == max then
|
elseif g == max then
|
||||||
h = 2 + ( b - r ) / delta; -- cyan/yellow
|
h = 2 + ( b - r ) / delta -- cyan/yellow
|
||||||
else
|
else
|
||||||
h = 4 + ( r - g ) / delta; -- magenta/cyan
|
h = 4 + ( r - g ) / delta -- magenta/cyan
|
||||||
end;
|
end
|
||||||
|
|
||||||
h = h * 60; -- degrees
|
h = h * 60 -- degrees
|
||||||
|
|
||||||
if h < 0 then
|
if h < 0 then
|
||||||
h = h + 360;
|
h = h + 360
|
||||||
end;
|
end
|
||||||
|
|
||||||
return {
|
return {
|
||||||
Hue = h,
|
Hue = h,
|
||||||
Sat = s,
|
Sat = s,
|
||||||
Value = v,
|
Value = v,
|
||||||
Alpha = a
|
Alpha = a
|
||||||
};
|
}
|
||||||
end;
|
end
|
||||||
|
|
||||||
-- HSVToColor(hsv)
|
-- HSVToColor(hsv)
|
||||||
-- Converts a set of HSV values to a color. hsv is a table.
|
-- Converts a set of HSV values to a color. hsv is a table.
|
||||||
-- See also: HSV(h, s, v)
|
-- See also: HSV(h, s, v)
|
||||||
function HSVToColor(hsv)
|
function HSVToColor(hsv)
|
||||||
local i;
|
local i
|
||||||
local f, q, p, t;
|
local f, q, p, t
|
||||||
local r, g, b;
|
local r, g, b
|
||||||
local h, s, v;
|
local h, s, v
|
||||||
|
|
||||||
local a;
|
local a
|
||||||
|
|
||||||
s = hsv.Sat;
|
s = hsv.Sat
|
||||||
v = hsv.Value;
|
v = hsv.Value
|
||||||
|
|
||||||
if hsv.Alpha then a = hsv.Alpha;
|
if hsv.Alpha then
|
||||||
else a = 0;
|
a = hsv.Alpha
|
||||||
end;
|
else
|
||||||
|
a = 0
|
||||||
|
end
|
||||||
|
|
||||||
if s == 0 then
|
if s == 0 then
|
||||||
return { v, v, v, a };
|
return { v, v, v, a }
|
||||||
end;
|
end
|
||||||
|
|
||||||
h = hsv.Hue / 60;
|
h = hsv.Hue / 60
|
||||||
|
|
||||||
i = math.floor(h);
|
i = math.floor(h)
|
||||||
f = h - i;
|
f = h - i
|
||||||
p = v * (1-s);
|
p = v * (1-s)
|
||||||
q = v * (1-s*f);
|
q = v * (1-s*f)
|
||||||
t = v * (1-s*(1-f));
|
t = v * (1-s*(1-f))
|
||||||
|
|
||||||
if i == 0 then
|
if i == 0 then
|
||||||
return { v, t, p, a };
|
return { v, t, p, a }
|
||||||
elseif i == 1 then
|
elseif i == 1 then
|
||||||
return { q, v, p, a };
|
return { q, v, p, a }
|
||||||
elseif i == 2 then
|
elseif i == 2 then
|
||||||
return { p, v, t, a };
|
return { p, v, t, a }
|
||||||
elseif i == 3 then
|
elseif i == 3 then
|
||||||
return { p, q, v, a };
|
return { p, q, v, a }
|
||||||
elseif i == 4 then
|
elseif i == 4 then
|
||||||
return { t, p, v, a };
|
return { t, p, v, a }
|
||||||
else
|
else
|
||||||
return { v, p, q, a };
|
return { v, p, q, a }
|
||||||
end;
|
end
|
||||||
end;
|
end
|
||||||
|
|
||||||
-- ColorToHex(c)
|
-- ColorToHex(c)
|
||||||
-- Takes in a normal color("") and returns the hex representation.
|
-- Takes in a normal color("") and returns the hex representation.
|
||||||
-- Adapted from code in LuaBit (http://luaforge.net/projects/bit/),
|
-- Adapted from code in LuaBit (http://luaforge.net/projects/bit/),
|
||||||
-- which is MIT licensed and copyright (C) 2006~2007 hanzhao.
|
-- which is MIT licensed and copyright (C) 2006~2007 hanzhao.
|
||||||
function ColorToHex(c)
|
function ColorToHex(c)
|
||||||
local r = c[1];
|
local r = c[1]
|
||||||
local g = c[2];
|
local g = c[2]
|
||||||
local b = c[3];
|
local b = c[3]
|
||||||
local a;
|
local a = HasAlpha(c)
|
||||||
if c[4] then a = c[4];
|
|
||||||
else a = 1;
|
|
||||||
end;
|
|
||||||
|
|
||||||
local function hex(value)
|
local function hex(value)
|
||||||
value = math.ceil(value);
|
value = math.ceil(value)
|
||||||
|
|
||||||
local hexVals = {'A', 'B', 'C', 'D', 'E', 'F'}
|
local hexVals = { 'A', 'B', 'C', 'D', 'E', 'F' }
|
||||||
local out = "";
|
local out = ""
|
||||||
local last = 0;
|
local last = 0
|
||||||
|
|
||||||
while(value ~= 0) do
|
while(value ~= 0) do
|
||||||
last = math.mod(value, 16);
|
last = math.mod(value, 16)
|
||||||
if(last < 10) then
|
if(last < 10) then
|
||||||
out = tostring(last) .. out;
|
out = tostring(last) .. out
|
||||||
else
|
else
|
||||||
out = hexVals[(last-10)+1] .. out;
|
out = hexVals[(last-10)+1] .. out
|
||||||
end;
|
end
|
||||||
value = math.floor(value/16);
|
value = math.floor(value/16)
|
||||||
end;
|
end
|
||||||
|
|
||||||
if(out == "") then
|
if(out == "") then
|
||||||
return "00";
|
return "00"
|
||||||
end
|
end
|
||||||
return string.format( "%02X", tonumber(out,16) );
|
|
||||||
end;
|
|
||||||
|
|
||||||
local rX = hex( scale(r, 0, 1, 0, 255) );
|
return string.format( "%02X", tonumber(out,16) )
|
||||||
local gX = hex( scale(g, 0, 1, 0, 255) );
|
end
|
||||||
local bX = hex( scale(b, 0, 1, 0, 255) );
|
|
||||||
local aX = hex( scale(a, 0, 1, 0, 255) );
|
|
||||||
|
|
||||||
return rX .. gX .. bX .. aX;
|
local rX = hex( scale(r, 0, 1, 0, 255) )
|
||||||
end;
|
local gX = hex( scale(g, 0, 1, 0, 255) )
|
||||||
|
local bX = hex( scale(b, 0, 1, 0, 255) )
|
||||||
|
local aX = hex( scale(a, 0, 1, 0, 255) )
|
||||||
|
|
||||||
|
return rX .. gX .. bX .. aX
|
||||||
|
end
|
||||||
|
|
||||||
function HSVToHex(hsv)
|
function HSVToHex(hsv)
|
||||||
return ColorToHex( HSVToColor(hsv) );
|
return ColorToHex( HSVToColor(hsv) )
|
||||||
end;
|
end
|
||||||
|
|
||||||
--[[ you should mainly use these functions ]]
|
--[[ you should mainly use these functions ]]
|
||||||
|
|
||||||
@@ -188,9 +193,9 @@ function HSV(h, s, v)
|
|||||||
Sat = s,
|
Sat = s,
|
||||||
Value = v,
|
Value = v,
|
||||||
Alpha = 1
|
Alpha = 1
|
||||||
};
|
}
|
||||||
return HSVToColor(t);
|
return HSVToColor(t)
|
||||||
end;
|
end
|
||||||
|
|
||||||
-- here's the proper one
|
-- here's the proper one
|
||||||
function HSVA(h, s, v, a)
|
function HSVA(h, s, v, a)
|
||||||
@@ -199,43 +204,43 @@ function HSVA(h, s, v, a)
|
|||||||
Sat = s,
|
Sat = s,
|
||||||
Value = v,
|
Value = v,
|
||||||
Alpha = a
|
Alpha = a
|
||||||
};
|
}
|
||||||
return HSVToColor(t);
|
return HSVToColor(t)
|
||||||
end;
|
end
|
||||||
|
|
||||||
function Saturation(color,percent)
|
function Saturation(color,percent)
|
||||||
local c = ColorToHSV(color);
|
local c = ColorToHSV(color)
|
||||||
-- error checking
|
-- error checking
|
||||||
if percent < 0 then
|
if percent < 0 then
|
||||||
percent = 0.0;
|
percent = 0.0
|
||||||
elseif percent > 1 then
|
elseif percent > 1 then
|
||||||
percent = 1.0;
|
percent = 1.0
|
||||||
end;
|
end
|
||||||
c.Sat = percent;
|
c.Sat = percent
|
||||||
return HSVToColor(c);
|
return HSVToColor(c)
|
||||||
end;
|
end
|
||||||
|
|
||||||
function Brightness(color,percent)
|
function Brightness(color,percent)
|
||||||
local c = ColorToHSV(color);
|
local c = ColorToHSV(color)
|
||||||
-- error checking
|
-- error checking
|
||||||
if percent < 0 then
|
if percent < 0 then
|
||||||
percent = 0.0;
|
percent = 0.0
|
||||||
elseif percent > 1 then
|
elseif percent > 1 then
|
||||||
percent = 1.0;
|
percent = 1.0
|
||||||
end;
|
end
|
||||||
c.Value = percent;
|
c.Value = percent
|
||||||
return HSVToColor(c);
|
return HSVToColor(c)
|
||||||
end;
|
end
|
||||||
|
|
||||||
function Hue(color,newHue)
|
function Hue(color,newHue)
|
||||||
local c = ColorToHSV(color);
|
local c = ColorToHSV(color)
|
||||||
-- handle wrapping
|
-- handle wrapping
|
||||||
if newHue < 0 then
|
if newHue < 0 then
|
||||||
newHue = 360 + newHue;
|
newHue = 360 + newHue
|
||||||
elseif newHue > 360 then
|
elseif newHue > 360 then
|
||||||
--newHue = math.mod(newHue, 360); -- ?? untested
|
--newHue = math.mod(newHue, 360); -- ?? untested
|
||||||
newHue = newHue - 360;
|
newHue = newHue - 360
|
||||||
end;
|
end
|
||||||
c.Hue = newHue;
|
c.Hue = newHue
|
||||||
return HSVToColor(c);
|
return HSVToColor(c)
|
||||||
end;
|
end;
|
||||||
@@ -12,7 +12,7 @@ Blend = {
|
|||||||
Multiply = 'BlendMode_WeightedMultiply',
|
Multiply = 'BlendMode_WeightedMultiply',
|
||||||
Invert = 'BlendMode_InvertDest',
|
Invert = 'BlendMode_InvertDest',
|
||||||
NoEffect = 'BlendMode_NoEffect'
|
NoEffect = 'BlendMode_NoEffect'
|
||||||
};
|
}
|
||||||
|
|
||||||
-- Health Declarations
|
-- Health Declarations
|
||||||
-- Used primarily for lifebars.
|
-- Used primarily for lifebars.
|
||||||
@@ -21,37 +21,37 @@ Health = {
|
|||||||
Alive = 'HealthState_Alive',
|
Alive = 'HealthState_Alive',
|
||||||
Danger = 'HealthState_Danger',
|
Danger = 'HealthState_Danger',
|
||||||
Dead = 'HealthState_Dead'
|
Dead = 'HealthState_Dead'
|
||||||
};
|
}
|
||||||
|
|
||||||
--[[ Actor commands ]]
|
--[[ Actor commands ]]
|
||||||
function Actor:CenterX()
|
function Actor:CenterX()
|
||||||
self:x(SCREEN_CENTER_X);
|
self:x(SCREEN_CENTER_X)
|
||||||
end;
|
end
|
||||||
|
|
||||||
function Actor:CenterY()
|
function Actor:CenterY()
|
||||||
self:y(SCREEN_CENTER_Y);
|
self:y(SCREEN_CENTER_Y)
|
||||||
end;
|
end
|
||||||
|
|
||||||
-- xy(actorX,actorY)
|
-- xy(actorX,actorY)
|
||||||
-- Sets the x and y of an actor in one command.
|
-- Sets the x and y of an actor in one command.
|
||||||
function Actor:xy(actorX,actorY)
|
function Actor:xy(actorX,actorY)
|
||||||
self:x(actorX);
|
self:x(actorX)
|
||||||
self:y(actorY);
|
self:y(actorY)
|
||||||
end;
|
end
|
||||||
|
|
||||||
-- MaskSource([clearzbuffer])
|
-- MaskSource([clearzbuffer])
|
||||||
-- Sets an actor up as the source for a mask. Clears zBuffer by default.
|
-- Sets an actor up as the source for a mask. Clears zBuffer by default.
|
||||||
function Actor:MaskSource(_)
|
function Actor:MaskSource(noclear)
|
||||||
self:clearzbuffer(_ or true);
|
self:clearzbuffer(noclear or true)
|
||||||
self:zwrite(true);
|
self:zwrite(true)
|
||||||
self:blend('BlendMode_NoEffect');
|
self:blend('BlendMode_NoEffect')
|
||||||
end;
|
end
|
||||||
|
|
||||||
-- MaskDest()
|
-- MaskDest()
|
||||||
-- Sets an actor up to be masked by anything with MaskSource().
|
-- Sets an actor up to be masked by anything with MaskSource().
|
||||||
function Actor:MaskDest()
|
function Actor:MaskDest()
|
||||||
self:ztest(true);
|
self:ztest(true)
|
||||||
end;
|
end
|
||||||
|
|
||||||
-- Thump()
|
-- Thump()
|
||||||
-- A customized version of pulse that is more appealing for on-beat
|
-- A customized version of pulse that is more appealing for on-beat
|
||||||
@@ -59,13 +59,13 @@ end;
|
|||||||
function Actor:thump(fEffectPeriod)
|
function Actor:thump(fEffectPeriod)
|
||||||
self:pulse()
|
self:pulse()
|
||||||
if fEffectPeriod ~= nil then
|
if fEffectPeriod ~= nil then
|
||||||
self:effecttiming(0,0,0.75*fEffectPeriod,0.25*fEffectPeriod);
|
self:effecttiming(0,0,0.75*fEffectPeriod,0.25*fEffectPeriod)
|
||||||
else
|
else
|
||||||
self:effecttiming(0,0,0.75,0.25);
|
self:effecttiming(0,0,0.75,0.25)
|
||||||
end
|
end
|
||||||
-- The default effectmagnitude will make this effect look very bad.
|
-- The default effectmagnitude will make this effect look very bad.
|
||||||
self:effectmagnitude(1,1.125,1);
|
self:effectmagnitude(1,1.125,1)
|
||||||
end;
|
end
|
||||||
|
|
||||||
--[[ BitmapText commands ]]
|
--[[ BitmapText commands ]]
|
||||||
|
|
||||||
@@ -73,22 +73,23 @@ end;
|
|||||||
-- An alias that turns off texture filtering.
|
-- An alias that turns off texture filtering.
|
||||||
-- Named because it works best with pixel fonts.
|
-- Named because it works best with pixel fonts.
|
||||||
function BitmapText:PixelFont()
|
function BitmapText:PixelFont()
|
||||||
self:SetTextureFiltering(false);
|
self:SetTextureFiltering(false)
|
||||||
end;
|
end
|
||||||
|
|
||||||
-- Stroke(color)
|
-- Stroke(color)
|
||||||
-- Sets the text's stroke color.
|
-- Sets the text's stroke color.
|
||||||
function BitmapText:Stroke(c)
|
function BitmapText:Stroke(c)
|
||||||
self:strokecolor( c );
|
self:strokecolor( c )
|
||||||
end;
|
end
|
||||||
|
|
||||||
-- NoStroke()
|
-- NoStroke()
|
||||||
-- Removes any stroke.
|
-- Removes any stroke.
|
||||||
function BitmapText:NoStroke()
|
function BitmapText:NoStroke()
|
||||||
self:strokecolor( color("0,0,0,0") );
|
self:strokecolor( color("0,0,0,0") )
|
||||||
end;
|
end
|
||||||
|
|
||||||
-- Set Text With Format (contributed by Daisuke Master)
|
-- Set Text With Format (contributed by Daisuke Master)
|
||||||
|
-- this function is my hero - shake
|
||||||
function BitmapText:settextf(...)
|
function BitmapText:settextf(...)
|
||||||
self:settext(string.format(...))
|
self:settext(string.format(...))
|
||||||
end
|
end
|
||||||
@@ -96,8 +97,8 @@ end
|
|||||||
-- DiffuseAndStroke(diffuse,stroke)
|
-- DiffuseAndStroke(diffuse,stroke)
|
||||||
-- Set diffuse and stroke at the same time.
|
-- Set diffuse and stroke at the same time.
|
||||||
function BitmapText:DiffuseAndStroke(diffuseC,strokeC)
|
function BitmapText:DiffuseAndStroke(diffuseC,strokeC)
|
||||||
self:diffuse(diffuseC);
|
self:diffuse(diffuseC)
|
||||||
self:strokecolor(strokeC);
|
self:strokecolor(strokeC)
|
||||||
end;
|
end;
|
||||||
--[[ end BitmapText commands ]]
|
--[[ end BitmapText commands ]]
|
||||||
|
|
||||||
@@ -106,20 +107,24 @@ end;
|
|||||||
--[[ helper functions ]]
|
--[[ helper functions ]]
|
||||||
function tobool(v)
|
function tobool(v)
|
||||||
if type(v) == "string" then
|
if type(v) == "string" then
|
||||||
local cmp = string.lower(v);
|
local cmp = string.lower(v)
|
||||||
if cmp == "true" or cmp == "t" then
|
if cmp == "true" or cmp == "t" then
|
||||||
return true;
|
return true
|
||||||
elseif cmp == "false" or cmp == "f" then
|
elseif cmp == "false" or cmp == "f" then
|
||||||
return false;
|
return false
|
||||||
end;
|
end
|
||||||
elseif type(v) == "number" then
|
elseif type(v) == "number" then
|
||||||
if v == 0 then return false;
|
if v == 0 then
|
||||||
else return true;
|
return false
|
||||||
end;
|
else
|
||||||
end;
|
return true
|
||||||
end;
|
end
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
function pname(pn) return ToEnumShortString(pn); end;
|
function pname(pn)
|
||||||
|
return ToEnumShortString(pn)
|
||||||
|
end
|
||||||
|
|
||||||
-- from http://ardoris.wordpress.com/2008/11/07/rounding-to-a-certain-number-of-decimal-places-in-lua/
|
-- from http://ardoris.wordpress.com/2008/11/07/rounding-to-a-certain-number-of-decimal-places-in-lua/
|
||||||
function round(what, precision)
|
function round(what, precision)
|
||||||
|
|||||||
@@ -31,62 +31,62 @@ ThemeInfo is documented at http://kki.ajworld.net/wiki/ThemeInfo.lua
|
|||||||
|
|
||||||
After that's set up, read the docs.
|
After that's set up, read the docs.
|
||||||
]]
|
]]
|
||||||
local PrefPath = "Data/UserPrefs/".. THEME:GetThemeDisplayName() .."/";
|
local PrefPath = "Data/UserPrefs/".. THEME:GetThemeDisplayName() .."/"
|
||||||
|
|
||||||
--[[ begin internal stuff; no need to edit below this line. ]]
|
--[[ begin internal stuff; no need to edit below this line. ]]
|
||||||
|
|
||||||
-- Local internal function to write envs. ___Not for themer use.___
|
-- Local internal function to write envs. ___Not for themer use.___
|
||||||
local function WriteEnv(envName,envValue)
|
local function WriteEnv(envName,envValue)
|
||||||
return setenv(envName,envValue);
|
return setenv(envName,envValue)
|
||||||
end;
|
end
|
||||||
|
|
||||||
function ReadPrefFromFile(name)
|
function ReadPrefFromFile(name)
|
||||||
local f = RageFileUtil.CreateRageFile();
|
local f = RageFileUtil.CreateRageFile()
|
||||||
local fullFilename = PrefPath..name..".cfg";
|
local fullFilename = PrefPath..name..".cfg"
|
||||||
local option;
|
local option
|
||||||
|
|
||||||
if f:Open(fullFilename,1) then
|
if f:Open(fullFilename,1) then
|
||||||
option = tostring( f:Read() );
|
option = tostring( f:Read() )
|
||||||
WriteEnv(name,option);
|
WriteEnv(name,option)
|
||||||
f:destroy();
|
f:destroy()
|
||||||
return option;
|
return option
|
||||||
else
|
else
|
||||||
local fError = f:GetError();
|
local fError = f:GetError()
|
||||||
Trace( "[FileUtils] Error reading ".. fullFilename ..": ".. fError );
|
Trace( "[FileUtils] Error reading ".. fullFilename ..": ".. fError )
|
||||||
f:ClearError();
|
f:ClearError()
|
||||||
f:destroy();
|
f:destroy()
|
||||||
return nil;
|
return nil
|
||||||
end;
|
end
|
||||||
end;
|
end
|
||||||
|
|
||||||
function WritePrefToFile(name,value)
|
function WritePrefToFile(name,value)
|
||||||
local f = RageFileUtil.CreateRageFile();
|
local f = RageFileUtil.CreateRageFile()
|
||||||
local fullFilename = PrefPath..name..".cfg";
|
local fullFilename = PrefPath..name..".cfg"
|
||||||
|
|
||||||
if f:Open(fullFilename, 2) then
|
if f:Open(fullFilename, 2) then
|
||||||
f:Write( tostring(value) );
|
f:Write( tostring(value) )
|
||||||
WriteEnv(name,value);
|
WriteEnv(name,value)
|
||||||
else
|
else
|
||||||
local fError = f:GetError();
|
local fError = f:GetError()
|
||||||
Trace( "[FileUtils] Error writing to ".. fullFilename ..": ".. fError );
|
Trace( "[FileUtils] Error writing to ".. fullFilename ..": ".. fError )
|
||||||
f:ClearError();
|
f:ClearError()
|
||||||
f:destroy();
|
f:destroy()
|
||||||
return false;
|
return false
|
||||||
end;
|
end
|
||||||
|
|
||||||
f:destroy();
|
f:destroy()
|
||||||
return true;
|
return true
|
||||||
end;
|
end
|
||||||
|
|
||||||
--[[ end internal functions; still don't edit below this line ]]
|
--[[ end internal functions; still don't edit below this line ]]
|
||||||
|
|
||||||
function GetUserPref(name)
|
function GetUserPref(name)
|
||||||
return ReadPrefFromFile(name);
|
return ReadPrefFromFile(name)
|
||||||
end;
|
end
|
||||||
|
|
||||||
function SetUserPref(name,value)
|
function SetUserPref(name,value)
|
||||||
return WritePrefToFile(name,value);
|
return WritePrefToFile(name,value)
|
||||||
end;
|
end
|
||||||
|
|
||||||
--[[ type specific, for when you want to be lazy ]]
|
--[[ type specific, for when you want to be lazy ]]
|
||||||
-- XXX: make set funcs, since I hate dealing with colors and I know
|
-- XXX: make set funcs, since I hate dealing with colors and I know
|
||||||
@@ -95,41 +95,40 @@ end;
|
|||||||
-- GetUserPrefB: boolean
|
-- GetUserPrefB: boolean
|
||||||
function GetUserPrefB(name)
|
function GetUserPrefB(name)
|
||||||
-- this one is a bit trickier.
|
-- this one is a bit trickier.
|
||||||
local pref = ReadPrefFromFile(name);
|
local pref = ReadPrefFromFile(name)
|
||||||
|
|
||||||
if type(pref) == "string" then
|
if type(pref) == "string" then
|
||||||
pref = string.lower(pref);
|
pref = string.lower(pref)
|
||||||
if pref == "true" or cmp == "t" then
|
if pref == "true" or cmp == "t" then
|
||||||
return true;
|
return true
|
||||||
elseif pref == "false" or cmp == "f" then
|
elseif pref == "false" or cmp == "f" then
|
||||||
return false;
|
return false
|
||||||
else
|
else
|
||||||
Trace("Error in GetUserPrefB(".. name ..") converting from string" );
|
Trace("Error in GetUserPrefB(".. name ..") converting from string" )
|
||||||
return false;
|
return false
|
||||||
end;
|
end
|
||||||
|
|
||||||
elseif type(pref) == "number" then
|
elseif type(pref) == "number" then
|
||||||
-- both 0 and -1 are false; if you want to change this,
|
-- both 0 and -1 are false; if you want to change this,
|
||||||
-- feel free to remove "or pref == -1".
|
-- feel free to remove "or pref == -1".
|
||||||
if pref == 0 or pref == -1 then
|
if pref == 0 or pref == -1 then
|
||||||
return false;
|
|
||||||
else
|
else
|
||||||
return true;
|
return true
|
||||||
end;
|
end
|
||||||
end;
|
end
|
||||||
end;
|
end
|
||||||
|
|
||||||
-- GetUserPrefC: color
|
-- GetUserPrefC: color
|
||||||
function GetUserPrefC(name)
|
function GetUserPrefC(name)
|
||||||
-- XXX: make sure it's grabbing a string that can be turned into a color
|
-- XXX: make sure it's grabbing a string that can be turned into a color
|
||||||
-- and also possibly handle HSV values too.
|
-- and also possibly handle HSV values too.
|
||||||
return color( ReadPrefFromFile(name) );
|
return color( ReadPrefFromFile(name) )
|
||||||
end;
|
end
|
||||||
|
|
||||||
-- GetUserPrefN: numbers (integers, floats)
|
-- GetUserPrefN: numbers (integers, floats)
|
||||||
function GetUserPrefN(name)
|
function GetUserPrefN(name)
|
||||||
return tonumber( ReadPrefFromFile(name) );
|
return tonumber( ReadPrefFromFile(name) )
|
||||||
end;
|
end
|
||||||
|
|
||||||
--[[
|
--[[
|
||||||
Copyright © 2008-2009 AJ Kelly/KKI Labs
|
Copyright © 2008-2009 AJ Kelly/KKI Labs
|
||||||
|
|||||||
@@ -7,8 +7,8 @@ File = {
|
|||||||
f:destroy()
|
f:destroy()
|
||||||
return true
|
return true
|
||||||
else
|
else
|
||||||
Trace( "[FileUtils] Error writing to ".. path ..": ".. f:GetError() );
|
Trace( "[FileUtils] Error writing to ".. path ..": ".. f:GetError() )
|
||||||
f:ClearError();
|
f:ClearError()
|
||||||
f:destroy()
|
f:destroy()
|
||||||
return false
|
return false
|
||||||
end
|
end
|
||||||
@@ -21,12 +21,12 @@ File = {
|
|||||||
f:destroy()
|
f:destroy()
|
||||||
return ret
|
return ret
|
||||||
else
|
else
|
||||||
Trace( "[FileUtils] Error reading from ".. path ..": ".. f:GetError() );
|
Trace( "[FileUtils] Error reading from ".. path ..": ".. f:GetError() )
|
||||||
f:ClearError();
|
f:ClearError()
|
||||||
f:destroy()
|
f:destroy()
|
||||||
return nil
|
return nil
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
};
|
}
|
||||||
-- this code if public domain and/or has no copyright, depending on your
|
-- this code if public domain and/or has no copyright, depending on your
|
||||||
-- country's laws. I wish for you to use this code freely, without restriction.
|
-- country's laws. I wish for you to use this code freely, without restriction.
|
||||||
@@ -9,16 +9,18 @@ AspectRatios = {
|
|||||||
FourThree = 1.33333, --* 640x480
|
FourThree = 1.33333, --* 640x480
|
||||||
SixteenTen = 1.6, --* 720x480
|
SixteenTen = 1.6, --* 720x480
|
||||||
SixteenNine = 1.77778, --* 853x480
|
SixteenNine = 1.77778, --* 853x480
|
||||||
EightThree = 2.66666, -- 1280x480
|
EightThree = 2.66666 -- 1280x480
|
||||||
};
|
}
|
||||||
|
|
||||||
function IsUsingWideScreen()
|
function IsUsingWideScreen()
|
||||||
return GetScreenAspectRatio() >= 1.6;
|
return GetScreenAspectRatio() >= 1.6
|
||||||
end;
|
end
|
||||||
|
|
||||||
-- take and use it as you like, I don't care -aj
|
-- take and use it as you like, I don't care -aj
|
||||||
-- (although I should mention this file was specific to moonlight and was pretty
|
-- (although I should mention this file was specific to moonlight and was pretty
|
||||||
-- bad before some editing. -aj)
|
-- bad before some editing. -aj)
|
||||||
|
|
||||||
-- this one is good though:
|
-- this one is good though:
|
||||||
function WideScale(AR4_3, AR16_9) return scale( SCREEN_WIDTH, 640, 854, AR4_3, AR16_9 ); end
|
function WideScale(AR4_3, AR16_9)
|
||||||
|
return scale( SCREEN_WIDTH, 640, 854, AR4_3, AR16_9 )
|
||||||
|
end
|
||||||
Reference in New Issue
Block a user