From a7d69d791b1aeb8f89b6416b9d298ea8aebd6d5a Mon Sep 17 00:00:00 2001 From: AJ Kelly Date: Mon, 26 Sep 2011 13:53:30 -0500 Subject: [PATCH] move compatibility aliases into 01 alias.lua --- Themes/_fallback/Scripts/01 alias.lua | 54 ++++++++++++++++++++++---- Themes/_fallback/Scripts/01 compat.lua | 46 ---------------------- 2 files changed, 47 insertions(+), 53 deletions(-) delete mode 100644 Themes/_fallback/Scripts/01 compat.lua diff --git a/Themes/_fallback/Scripts/01 alias.lua b/Themes/_fallback/Scripts/01 alias.lua index 126d9c69ef..1999c6e010 100644 --- a/Themes/_fallback/Scripts/01 alias.lua +++ b/Themes/_fallback/Scripts/01 alias.lua @@ -1,23 +1,63 @@ ---[[ sm-ssc aliases (non-compatibility) -This is mainly here for making commands case-insensitive without needing to -clutter up the C++ code. It can also be used to add custom functions that -wouldn't otherwise belong somewhere else. ---]] +--[[ command aliases ]] --- in fact, this probably belongs in Sprite.lua... +-- (this probably belongs in Sprite.lua) function Sprite:cropto(w,h) self:CropTo(w,h) end +-- (this probably belongs in Actor.lua) function Actor:SetSize(w,h) self:setsize(w,h) end -- shorthand! this is tedious to type and makes things ugly so let's make it shorter. -- screen.w, screen.h, etc. -local _screen = { +_screen = { w = SCREEN_WIDTH, h = SCREEN_HEIGHT, cx = SCREEN_CENTER_X, cy = SCREEN_CENTER_Y } + +--[[ compatibility aliases ]] + +--[[ Actor ]] +function Actor:hidden(bHide) + Warn("hidden is deprecated, use visible instead. (used on ".. self:GetName() ..")") + self:visible(not bHide) +end + +--[[ ActorScroller: all of these got renamed, so alias the lowercase ones if +themes are going to look for them. ]] +ActorScroller.getsecondtodestination = ActorScroller.GetSecondsToDestination +ActorScroller.setsecondsperitem = ActorScroller.SetSecondsPerItem +ActorScroller.setnumsubdivisions = ActorScroller.SetNumSubdivisions +ActorScroller.scrollthroughallitems = ActorScroller.ScrollThroughAllItems +ActorScroller.scrollwithpadding = ActorScroller.ScrollWithPadding +ActorScroller.setfastcatchup = ActorScroller.SetFastCatchup + +--[[ MenuTimer: just some case changes. ]] +MenuTimer.setseconds = MenuTimer.SetSeconds + +--[[ GameState ]] +--[[ Aliases for old GAMESTATE timing functions. These have been converted to +SongPosition, but most themes still use these old functions. ]] +function GameState:GetSongBeat() return self:GetSongPosition():GetSongBeat() end +function GameState:GetSongBeatNoOffset() return self:GetSongPosition():GetSongBeatNoOffset() end +function GameState:GetSongBPS() return self:GetSongPosition():GetCurBPS() end +function GameState:GetSongDelay() return self:GetSongPosition():GetDelay() end +function GameState:GetSongFreeze() return self:GetSongPosition():GetFreeze() end + +--[[ 3.9 Conditionals ]] +Condition = { + Hour = function() return Hour() end, + IsDemonstration = function() return GAMESTATE:IsDemonstration() end, + CurSong = function(sSongName) + return GAMESTATE:GetCurrentSong():GetDisplayMainTitle() == sSongName + end, + DayOfMonth = function() return DayOfMonth() end, + MonthOfYear = function() return MonthOfYear() end, + UsingModifier = function(pnPlayer, sModifier) + return GAMESTATE:PlayerIsUsingModifier( pnPlayer, sModifier ); + end, +} \ No newline at end of file diff --git a/Themes/_fallback/Scripts/01 compat.lua b/Themes/_fallback/Scripts/01 compat.lua deleted file mode 100644 index 1c4aee360c..0000000000 --- a/Themes/_fallback/Scripts/01 compat.lua +++ /dev/null @@ -1,46 +0,0 @@ ---[[ sm-ssc compatibility helpers -sm-ssc changes quite a few things which would make various SM4 content break. -Also, certain things are deprecated/removed from sm-ssc (and sometimes SM4 too). ---]] - ---[[ Actor ]] -function Actor:hidden(bHide) - Warn("hidden is deprecated, use visible instead. (used on ".. self:GetName() ..")") - self:visible(not bHide) -end - ---[[ ActorScroller: all of these got renamed, so alias the lowercase ones if -things are going to look for them. ]] -ActorScroller.getsecondtodestination = ActorScroller.GetSecondsToDestination -ActorScroller.setsecondsperitem = ActorScroller.SetSecondsPerItem -ActorScroller.setnumsubdivisions = ActorScroller.SetNumSubdivisions -ActorScroller.scrollthroughallitems = ActorScroller.ScrollThroughAllItems -ActorScroller.scrollwithpadding = ActorScroller.ScrollWithPadding -ActorScroller.setfastcatchup = ActorScroller.SetFastCatchup - ---[[ MenuTimer: just some case changes. ]] -MenuTimer.setseconds = MenuTimer.SetSeconds - ---[[ GameState ]] ---Aliases for old GAMESTATE timing functions. ---These have been converted to SongPosition, but most themes still use these old functions. - -function GameState:GetSongBeat() return self:GetSongPosition():GetSongBeat() end -function GameState:GetSongBeatNoOffset() return self:GetSongPosition():GetSongBeatNoOffset() end -function GameState:GetSongBPS() return self:GetSongPosition():GetCurBPS() end -function GameState:GetSongDelay() return self:GetSongPosition():GetDelay() end -function GameState:GetSongFreeze() return self:GetSongPosition():GetFreeze() end - ---[[ 3.9 Conditionals ]] -Condition = { - Hour = function() return Hour() end, - IsDemonstration = function() return GAMESTATE:IsDemonstration() end, - CurSong = function(sSongName) - return GAMESTATE:GetCurrentSong():GetDisplayMainTitle() == sSongName - end, - DayOfMonth = function() return DayOfMonth() end, - MonthOfYear = function() return MonthOfYear() end, - UsingModifier = function(pnPlayer, sModifier) - return GAMESTATE:PlayerIsUsingModifier( pnPlayer, sModifier ); - end, -} \ No newline at end of file