Skip to content

Commit

Permalink
Merge pull request #9 from FMS-Cat/metamods
Browse files Browse the repository at this point in the history
Support Metamods
  • Loading branch information
Yutaka "FMS_Cat" Obuchi authored Apr 20, 2021
2 parents f5fdd14 + 95d4773 commit dee1497
Show file tree
Hide file tree
Showing 4 changed files with 122 additions and 4 deletions.
4 changes: 2 additions & 2 deletions BGAnimations/ScreenEvaluation overlay.xml
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@
/>

<Layer
Condition="modRate ~= 1"
Condition="SongOptionsLabel() ~= ''"
Type="Quad"
OnCommand="diffuse,#1E282F;stretchto,SCREEN_CENTER_X-139,153,SCREEN_CENTER_X+139,170;diffusealpha,0.85"
/>
Expand All @@ -42,7 +42,7 @@
Font="_misobold small"
OnCommand="y,87;zoom,.5;shadowlength,1;diffuse,#FFFFFF"
InitCommand="animate,0;playcommand,Update"
UpdateCommand="%function(self) RateBPMlabel(self) end"
UpdateCommand="%function(self) SongOptionsLabel(self) end"
/>
</children> </Layer>

Expand Down
17 changes: 17 additions & 0 deletions Languages/english.ini
Original file line number Diff line number Diff line change
Expand Up @@ -150,6 +150,9 @@ NoteSkin=Choose a different appearance for the arrows.
Handicap=Removes notes. Using these may invalidate a high score.
Handicap2=Removes notes. Using these may invalidate a high score.
Hide=Adjust the visibility of the targets.
MetaMods1=Apply mods that is not affected by mods in the chart.
MetaMods2=Apply mods that is not affected by mods in the chart.
MetaMods3=Apply mods that is not affected by mods in the chart.
Persp=Change the viewing angle of the arrow stream.
Perspective=Change the viewing angle of the arrow stream.
Steps=Adjust the difficulty of the steps.
Expand Down Expand Up @@ -283,6 +286,9 @@ Accel=Acceleration
Effect=Effect
Mini=Mini
Appearance=Fade
MetaMods1=MetaMods 1
MetaMods2=MetaMods 2
MetaMods3=MetaMods 3
Turn=Turn
InsertTaps=Insert
InsertOther=Other
Expand Down Expand Up @@ -449,6 +455,17 @@ Tornado=Tornado
Tipsy=Float
Beat=Beat

MetaFlip=MetaFlip
MetaInvert=MetaInvert
MetaVideogames=MetaVideogames
MetaMonocolumn=MetaMonocolumn
MetaReverse=MetaReverse
MetaDizzy=MetaDizzy
MetaOrient=MetaOrient
MetaBrake=MetaBrake
MetaHidden=MetaHidden
50% MetaStealth=50% MetaStealth

Normal=Normal
-30% Mini=Huge
20% Mini=20%
Expand Down
103 changes: 102 additions & 1 deletion Scripts/Mods.lua
Original file line number Diff line number Diff line change
Expand Up @@ -114,7 +114,7 @@
-- These will be the option rows available on the [nth] option screen. The 'NextScreen' row will be automatically added as long as there is more than 1 option screen.
playerOptions = {}
playerOptions[1] = { 'SpeedType','SpeedNumber','Mini','Perspective','NoteSkin','Turn','LifeBar','Compare','Rate' }
playerOptions[2] = { 'Turn','Accel','Scroll','Effect','Appearance','Handicap','InsertTaps','InsertOther','Hide','Ghost' }
playerOptions[2] = { 'MetaMods1','MetaMods2','MetaMods3','Turn','Accel','Scroll','Effect','Appearance','Handicap','InsertTaps','InsertOther','Hide','Ghost' }
playerOptions.Edit = { 'SpeedType','SpeedNumber','Mini','Perspective','NoteSkin','Turn' }
ShowAllInRow = false

Expand Down Expand Up @@ -729,10 +729,51 @@ end
-- BPM format and display functions
-------------------------------------

-- Intended to be used from ScreenEvaluation.
-- It will return a human-readable string consists of metamods and rate mods currently being used.
-- If BitmapText is given, this function will set the string to the BitmapText.
function SongOptionsLabel(self)
local t = {}

local bpm = RateBPMlabel()
if bpm ~= '' then table.insert(t, bpm) end

local meta = MetaModsText()
if meta ~= '' then table.insert(t, meta) end

s = table.concat(t, ', ')

if self then
self:settext(s)
else
return s
end
end

function BPMlabelRate(self) s = AdjustedBPM() .. ' BPM ' .. RateModAppend() if self then self:settext(s) else return s end end
function BPMandRate(self) s = AdjustedBPM() .. ' ' .. RateModAppend() if self then self:settext(s) else return s end end
function RateBPMlabel(self) s = RateModText() if s ~= '' then s = s .. ' (' .. AdjustedBPM() .. ' BPM)' end if self then self:settext(s) else return s end end

function MetaModsText(self)
mods = {}

for _, metaModsRow in ipairs(metaModsRows) do
for i, v in ipairs(metaModsRow.mods) do
if CheckMod(0, v) then
table.insert(mods, metaModsRow.modlist[i])
end
end
end

s = table.concat(mods, ', ')

if self then
self:settext(s)
else
return s
end
end

function RateModText(self) s = '' if modRate ~= 1 then s = string.format('%01.1f',modRate) .. 'x Music Rate' end if self then self:settext(s) else return s end end
function RateModAppend(self) s = RateModText() if s ~= '' then s = '(' .. s .. ')' end if self then self:settext(s) else return s end end

Expand Down Expand Up @@ -774,6 +815,24 @@ end
baseSpeed = { "C700", "C800", "C900", "C1000", "C1100", "C1200", "C1300", "C1400", "1x", "2x", "3x", "4x", "5x", "6x", "7x", "C400", "C500", "C600" }
extraSpeed = { "0", "+C10", "+C20", "+C30", "+C40", "+C50", "+C60", "+C70", "+C80", "+C90", "+.75x", "+.50x", "+.25x" }

metaModsRows = {
{
modlist = {'MetaFlip', 'MetaInvert', 'MetaVideogames', 'MetaMonocolumn'},
default = 'no metaflip, no metainvert, no metavideogames, no metamonocolumn',
mods = {'metaflip', 'metainvert', 'metavideogames', 'metamonocolumn'}
},
{
modlist = {'MetaReverse', 'MetaDizzy', 'MetaOrient', 'MetaBrake'},
default = 'no metareverse, no metadizzy, no metaorient, no metabrake',
mods = {'metareverse', 'metadizzy', 'metaorient', 'metabrake'}
},
{
modlist = {'MetaHidden', '50% MetaStealth'},
default = 'no metahidden, no metastealth',
mods = {'metahidden', '50% metastealth'}
}
}

rateMods = { "1.0x", "1.1x", "1.2x", "1.3x", "1.4x", "1.5x", "1.6x", "1.7x", "1.8x", "1.9x", "2.0x" }
rateModsEdit = { "1.0x", "1.1x", "1.2x", "1.3x", "1.4x", "1.5x", "1.6x", "1.7x", "1.8x", "1.9x", "2.0x", "0.3x", "0.4x", "0.5x", "0.6x", "0.7x", "0.8x", "0.9x" }

Expand Down Expand Up @@ -816,6 +875,9 @@ ModsMaster.Tipsy = { float = true }
ModsMaster.Beat = { float = true }
ModsMaster.Mini = { float = true }

ModsMaster.MetaMods1 = { fnctn = 'MetaMods1' }
ModsMaster.MetaMods2 = { fnctn = 'MetaMods2' }
ModsMaster.MetaMods3 = { fnctn = 'MetaMods3' }
ModsMaster.SpeedType = { fnctn = 'SpeedType' }
ModsMaster.SpeedNumber = { fnctn = 'SpeedNumber' }
ModsMaster.Next = { fnctn = 'NextScreenOption' }
Expand Down Expand Up @@ -998,6 +1060,45 @@ do
end
end

function MetaMods( s, iRow )
local metaModsRow = metaModsRows[ iRow ]
local t = OptionRowBase('MetaMods' .. iRow, metaModsRow.modlist)

t.SelectType = 'SelectMultiple'
t.OneChoiceForAllPlayers = true

t.LoadSelections = function(self, list, pn)
for i, v in ipairs(metaModsRow.mods) do
list[i] = CheckMod(pn, v)
end
end

t.SaveSelections = function(self, list, pn)
if pn ~= 0 then return end -- in OneChoiceForAllPlayers row, list in other players than player 1 is not valid

ApplyMod(metaModsRow.default, pn+1)
for i, v in ipairs(list) do
if v then
ApplyMod(metaModsRow.mods[i], pn+1)
end
end
end

return t
end

function MetaMods1( s )
return MetaMods( s, 1 )
end

function MetaMods2( s )
return MetaMods( s, 2 )
end

function MetaMods3( s )
return MetaMods( s, 3 )
end

function NextScreenOption()
local t = OptionRowBase('Next Screen',{'Gameplay','Select Music','More Options'})
t.OneChoiceForAllPlayers = true
Expand Down
2 changes: 1 addition & 1 deletion Scripts/Theme.lua
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ rateModsFree = { "1.0x", "1.1x", "1.2x", "1.3x", "1.4x", "1.5x", "1.6x", "1.7x",
screenList = { Gameplay = 'ScreenStage' , SelectMusic = 'ScreenSelectMusic' , PlayerOptions = 'ScreenPlayerOptions' , TitleMenu = ScreenTitleBranch , NameEntry = 'ScreenNameEntryTraditional' , Evaluation = SelectEvaluationScreen , Summary = 'Summary' , Ending = SelectEndingScreen }

playerOptions[1] = { 'SpeedType','SpeedNumber','Mini','Perspective','NoteSkin','Turn','JudgmentFont','Voice','Rate' }
playerOptions[2] = { 'Accel','Scroll','Effect','Appearance','Handicap','InsertTaps','InsertOther','Hide','Ghost','Compare','Measure','LifeBar' }
playerOptions[2] = { 'MetaMods1','MetaMods2','MetaMods3','Accel','Scroll','Effect','Appearance','Handicap','InsertTaps','InsertOther','Hide','Ghost','Compare','Measure','LifeBar' }

function CompareTextFormat(self,n) self:zoom(.3) end -- This is added on top of the base positioning etc.

Expand Down

0 comments on commit dee1497

Please sign in to comment.