Skip to content

Commit

Permalink
fix a few holiday cheer issues
Browse files Browse the repository at this point in the history
Sometimes the snow wouldn't appear because the table particles references hadn't initialized yet and was empty.  That should be fixed.

I moved the "holiday cheer check" into a global function in ./Script/SL-Helpers.lua rather than recreating the logic everywhere, and then used that function.

I also changed the color of a few BitmapText actors in the event of Holiday Cheer + RainbowMode.
  • Loading branch information
quietly-turning committed Dec 3, 2019
1 parent 31199a3 commit 30721be
Show file tree
Hide file tree
Showing 8 changed files with 69 additions and 64 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ return Def.ActorFrame{
self:x(115 * (player==PLAYER_1 and -1 or 1))
self:halign(pn):zoom(0.7)
-- darken the text for RainbowMode to make it more legible
if ThemePrefs.Get("RainbowMode") then self:diffuse(Color.Black) end
if (ThemePrefs.Get("RainbowMode") and not HolidayCheer()) then self:diffuse(Color.Black) end

local currentSteps = GAMESTATE:GetCurrentSteps(player)

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ return LoadFont("Common Normal")..{
InitCommand=function(self) self:zoom(0.7):xy(115,_screen.cy-80) end,
OnCommand=function(self)
-- darken the text for RainbowMode to make it more legible
if ThemePrefs.Get("RainbowMode") then self:diffuse(Color.Black) end
if (ThemePrefs.Get("RainbowMode") and not HolidayCheer()) then self:diffuse(Color.Black) end

if player == PLAYER_1 then
self:x( self:GetX() * -1 )
Expand Down
4 changes: 2 additions & 2 deletions BGAnimations/ScreenSelectStyle underlay/choice.lua
Original file line number Diff line number Diff line change
Expand Up @@ -155,7 +155,7 @@ local af = Def.ActorFrame{
InitCommand=function(self)
self:zoom(0.5):xy( frame_x, _screen.cy + WideScale(0,10) )

if ThemePrefs.Get("VisualTheme")=="Gay" then
if ThemePrefs.Get("VisualTheme")=="Gay" and not HolidayCheer() then
self:bob():effectmagnitude(0,0,0):effectclock('bgm'):effectperiod(0.666)
end
end,
Expand All @@ -166,7 +166,7 @@ local af = Def.ActorFrame{
end,
GainFocusCommand=function(self)
self:linear(0.125):zoom(1)
if ThemePrefs.Get("VisualTheme")=="Gay" then
if ThemePrefs.Get("VisualTheme")=="Gay" and not HolidayCheer() then
self:effectmagnitude(0,4,0)
end
end,
Expand Down
49 changes: 26 additions & 23 deletions BGAnimations/ScreenTitleMenu underlay/default.lua
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
local TextColor = ThemePrefs.Get("RainbowMode") and Color.Black or Color.White
local TextColor = (ThemePrefs.Get("RainbowMode") and (not HolidayCheer()) and Color.Black) or Color.White

local SongStats = SONGMAN:GetNumSongs() .. " songs in "
SongStats = SongStats .. SONGMAN:GetNumSongGroups() .. " groups, "
Expand Down Expand Up @@ -59,35 +59,38 @@ local af = Def.ActorFrame{
self:Center()
end,
OffCommand=function(self) self:linear(0.5):diffusealpha(0) end,
}

Def.ActorFrame{
InitCommand=function(self) self:zoom(0.8):y(-120):diffusealpha(0) end,
OnCommand=function(self) self:sleep(0.2):linear(0.4):diffusealpha(1) end,

LoadFont("Common Normal")..{
Text=sm_version .. " " .. sl_name .. (sl_version and (" v" .. sl_version) or ""),
InitCommand=function(self) self:y(-20):diffuse(TextColor) end,
},
LoadFont("Common Normal")..{
Text=SongStats,
InitCommand=function(self) self:diffuse(TextColor) end,
}
},
-- decorative arrows
af[#af+1] = LoadActor(THEME:GetPathG("", "_logos/" .. game))..{
InitCommand=function(self)
self:y(-16):zoom( game=="pump" and 0.2 or 0.205 )
end
}

LoadActor(THEME:GetPathG("", "_logos/" .. game))..{
InitCommand=function(self)
self:y(-16):zoom( game=="pump" and 0.2 or 0.205 )
end
},
-- SIMPLY [something]
af[#af+1] = LoadActor(THEME:GetPathG("", "_VisualStyles/"..style.."/"..image.." (doubleres).png"))..{
InitCommand=function(self) self:x(2):zoom(0.7):shadowlength(0.75) end,
OffCommand=function(self) self:linear(0.5):shadowlength(0) end
}

LoadActor(THEME:GetPathG("", "_VisualStyles/"..style.."/"..image.." (doubleres).png"))..{
InitCommand=function(self) self:x(2):zoom(0.7):shadowlength(0.75) end,
OffCommand=function(self) self:linear(0.5):shadowlength(0) end
-- SM version, SL version, song stats
af[#af+1] = Def.ActorFrame{
InitCommand=function(self) self:zoom(0.8):y(-120):diffusealpha(0) end,
OnCommand=function(self) self:sleep(0.2):linear(0.4):diffusealpha(1) end,

LoadFont("Common Normal")..{
Text=sm_version .. " " .. sl_name .. (sl_version and (" v" .. sl_version) or ""),
InitCommand=function(self) self:y(-20):diffuse(TextColor) end,
},
LoadFont("Common Normal")..{
Text=SongStats,
InitCommand=function(self) self:diffuse(TextColor) end,
}
}

-- the best way to spread holiday cheer is singing loud for all to hear
if PREFSMAN:GetPreference("EasterEggs") and MonthOfYear()==11 then
if HolidayCheer() then
af[#af+1] = Def.Sprite{
Texture=THEME:GetPathB("ScreenTitleMenu", "underlay/hat.png"),
InitCommand=function(self) self:zoom(0.225):xy( 130, -self:GetHeight()/2 ):rotationz(15):queuecommand("Drop") end,
Expand Down
2 changes: 1 addition & 1 deletion BGAnimations/_shared background/default.lua
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
-- the best way to spread holiday cheer is singing loud for all to hear
if PREFSMAN:GetPreference("EasterEggs") and MonthOfYear()==11 then
if HolidayCheer() then
return LoadActor( THEME:GetPathB("", "_shared background/Snow.lua") )
end

Expand Down
64 changes: 30 additions & 34 deletions BGAnimations/_shared background/snow.lua
Original file line number Diff line number Diff line change
Expand Up @@ -23,21 +23,17 @@ local wrap_buffer = 50 --how far offscreen should it be before it wraps

--we will need these later
local dbk_snow = {} --recycling is good for the environment
local dbk_sptr = 0 --it's a ''''pointer'''' to a snow object

local make_snow = function(obj)
table.insert( dbk_snow, {actor = obj, xspd = 0, yspd = 0, size = 0} ) --shovel snow
end

local Update = function(self, delta)
for i=1,table.getn(dbk_snow) do

for i=1,#dbk_snow do
local a = dbk_snow[i]

if a then
local b = a.actor
if b then

b:visible(true)
-- b:visible(true)
if b:getaux() < 1 then
b:aux( b:getaux() + delta )
b:diffusealpha( b:getaux() )
Expand All @@ -58,41 +54,41 @@ local Update = function(self, delta)
end

local af = Def.ActorFrame{
InitCommand=function(self) self:SetUpdateFunction( Update ) end,
OnCommand=function(self) self:sleep(0.02):queuecommand("Make") end,
MakeCommand=function(self)
for i=1,table.getn(dbk_snow) do
local a = dbk_snow[i]
if a then
a.xspd = math.random( min_vx, max_vx )
a.yspd = math.random( min_vy, max_vy )

a.size = math.random(min_size,max_size)+(i/table.getn(dbk_snow)) --configurable at top of file

local b = a.actor
if b then
b:x( math.random( -40, math.floor(_screen.w)+40 ) )
b:y( math.random( -40, math.floor(_screen.h)+40 ) )
b:zoomto( a.size, a.size )

if ThemePrefs.Get("VisualTheme") == "Gay" then b:effectoffset( math.random() ):rainbow() end
end
end
end
end
InitCommand=function(self) self:SetUpdateFunction( Update ) end
}

-- background Quad with a black-to-blue gradient
af[#af+1] = Def.Quad{
InitCommand=function(self) self:FullScreen():Center():diffusetopedge(Color.Black):diffusebottomedge(color("#061f4f")) end
}

local snow_af = Def.ActorFrame{
InitCommand=function(self) self:diffusealpha(0) end,
OnCommand=function(self) self:sleep(0.25):smooth(0.25):diffusealpha(1) end
}

for i=1,num_particles do
af[#af+1] = LoadActor( path_to_texture )..{
OnCommand=function(self) self:visible(false):queuecommand("Make") end,
HideCommand=function(self) self:visible(false) end,
MakeCommand=function(self) make_snow(self) end --use our function from earlier!
}
snow_af[#snow_af+1] = LoadActor( path_to_texture )..{
OnCommand=function(self) self:queuecommand("Make") end,
MakeCommand=function(self)
local _t = {
actor = self,
xspd = math.random( min_vx, max_vx ),
yspd = math.random( min_vy, max_vy ),
size = math.random( min_size,max_size)+(i/#dbk_snow),
}

table.insert( dbk_snow, _t )

self:x( math.random( -40, math.floor(_screen.w)+40 ) )
self:y( math.random( -40, math.floor(_screen.h)+40 ) )
self:zoomto( _t.size, _t.size )

if ThemePrefs.Get("VisualTheme") == "Gay" then self:effectoffset( math.random() ):rainbow() end
end
}
end

af[#af+1] = snow_af

return af
8 changes: 7 additions & 1 deletion Scripts/SL-Helpers.lua
Original file line number Diff line number Diff line change
Expand Up @@ -477,9 +477,15 @@ GetStepsCredit = function(player)
end

-- -----------------------------------------------------------------------

-- the best way to spread holiday cheer is singing loud for all to hear
HolidayCheer = function()
return (PREFSMAN:GetPreference("EasterEggs") and MonthOfYear()==11)
end

BrighterOptionRows = function()
if ThemePrefs.Get("RainbowMode") then return true end
if PREFSMAN:GetPreference("EasterEggs") and MonthOfYear()==11 then return true end -- holiday cheer
if HolidayCheer() then return true end
return false
end

Expand Down
2 changes: 1 addition & 1 deletion Sounds/ScreenEvaluationSummary music.lua
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
local audio_file = "_silent"

-- the best way to spread holiday cheer is singing loud for all to hear
if PREFSMAN:GetPreference("EasterEggs") and MonthOfYear()==11 then
if HolidayCheer() then
audio_file = "jinglebells.ogg"
end

Expand Down

0 comments on commit 30721be

Please sign in to comment.