Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- function ExpandfieldLoad()
- --SCREENMAN:GetTopScreen():GetChild("PlayerP1"):GetChild("NoteField"):visible(false)
- end
- OLDNSKIN = NOTESKIN
- function NoteskinLoader(pn,Button,Element)
- local Open_Common = RageFileUtil.CreateRageFile()
- local Open_Noteskin = RageFileUtil.CreateRageFile()
- local CommonDir = "/NoteSkins/common/common"
- local NoteskinDir = "/NoteSkins/"..GAMESTATE:GetCurrentGame():GetName().."/"..GAMESTATE:GetPlayerState(pn):GetPlayerOptions("ModsLevel_Current"):NoteSkin()
- function GetNoteskinFile(file)
- local Dir = FILEMAN:GetDirListing(NoteskinDir.."/")
- local Rvalue = {}
- for i = 1,#Dir do
- if file then
- file = file:gsub(".png",""):lower()
- Dir[i] = Dir[i]:lower()
- if string.find(Dir[i], file) then return NoteskinDir.."/"..Dir[i] end
- end
- end
- return THEME:GetPathG("","_missing")
- end
- Open_Common:Open(CommonDir.."/NoteSkin.lua", 1)
- Open_Noteskin:Open(NoteskinDir.."/NoteSkin.lua", 1)
- local Common = Open_Common:Read()
- local Common = Common:gsub('','local function thotmania(But,Elm) return "'..NoteskinDir..'/"..But.." "..Elm \n end \n',1)
- :gsub('Var "Button"','"'..Button..'"')
- :gsub('Var "Element"','"'..Element..'"')
- :gsub("NOTESKIN:GetPath",'thotmania')
- local Common = assert(loadstring(Common))
- local Noteskin = Open_Noteskin:Read()
- local Noteskin = Noteskin:gsub('','local function thotmania(But,Elm) return "'..NoteskinDir..'/"..But.." "..Elm \n end \n',1)
- :gsub('Var "Button"','"'..Button..'"')
- :gsub('Var "Element"','"'..Element..'"')
- :gsub("NOTESKIN:GetPath",'thotmania')
- local Noteskin = assert(loadstring(Noteskin))
- Open_Common:Close()
- Open_Noteskin:Close()
- NOTESKIN = {}
- NOTESKIN.GetPath = function(_,BUTTON,ELEMENT) return BUTTON.." "..ELEMENT..".png" end
- NOTESKIN.GetMetricA = function(...) return cmd(diffusealpha,1) end
- local Output = GetNoteskinFile(Noteskin(Common())["Load"]()["Texture"])
- local Rotation = Noteskin(Common())["Load"]()["BaseRotationZ"]
- if Output ~= THEME:GetPathG("","_missing") then
- Output = {Output}
- else
- RetVal = {}
- for i = 1,#Noteskin(Common())["Load"]() do
- RetVal[#RetVal+1] = GetNoteskinFile(Noteskin(Common())["Load"]()[1]["Texture"])
- end
- Output = RetVal
- end
- NOTESKIN = OLDNSKIN
- return Output, Rotation
- end
- function SMLoader(Steps)
- local Open_SM = RageFileUtil.CreateRageFile()
- local CurGS = ToEnumShortString(Steps:GetStepsType()):lower():gsub("_","-")
- local CurDiff = ToEnumShortString(Steps:GetDifficulty())
- local FBeat = GAMESTATE:GetCurrentSong():GetFirstBeat()
- local function CheckGS(Line)
- for i in string.gmatch(Line, "%s+(.-):") do
- if i == CurGS then
- return true
- end
- end
- return false
- end
- local function CheckDiff(Line)
- for i in string.gmatch(Line, "%s+(.-):") do
- if i == CurDiff then
- return true
- end
- end
- return false
- end
- Open_SM:Open(Steps:GetFilename(), 1)
- SM_File = Open_SM:Read()
- Output = {}
- for i in string.gmatch(SM_File, "#NOTES:.-;") do
- if CheckGS(i) and CheckDiff(i) then
- local Beat = 0
- for i2 in string.gmatch(i:gsub(".+:",""):gsub(";",","):gsub("//.-\n",""):gsub(" ",""), "%s(.-),") do
- Beat = Beat + 4
- AL = 0
- CL = 0
- for _ in string.gmatch(i2, "%w+") do
- AL = AL + 1
- end
- for i3 in string.gmatch(i2, "%w+") do
- SBeat = (Beat-4)+((4/AL)*CL)
- CL = CL + 1
- CI = 1
- for i4 in string.gmatch(i3, "%w") do
- if i4 == "1" or i4 == "2" then
- Output[#Output+1] = {SBeat,Exp_Buttons[GAMESTATE:GetCurrentGame():GetName()][GAMESTATE:GetCurrentStyle():GetName()][CI]}
- end
- CI = CI + 1
- end
- end
- end
- end
- end
- return Output
- end
- Exp_Buttons = {
- dance = {
- single = {"Left","Down","Up","Right"},
- solo = {"Left","UpLeft","Down","Up","UpRight","Right"},
- },
- pump = {},
- }
- Exp_Element = {
- "Receptor",
- }
- function PlayerField(pn)
- local Notes = SMLoader(GAMESTATE:GetCurrentSteps(pn))
- local Reverse = ((GAMESTATE:GetPlayerState(pn):GetPlayerOptions("ModsLevel_Current"):Reverse()-0.5)*2)*-1
- local CurBut = Exp_Buttons[GAMESTATE:GetCurrentGame():GetName()][GAMESTATE:GetCurrentStyle():GetName()]
- function ReceptorPos(Reverse)
- if Reverse == 1 then
- return THEME:GetMetric( "Player", "ReceptorArrowsYStandard" )
- else
- return THEME:GetMetric( "Player", "ReceptorArrowsYReverse" )
- end
- end
- function GetCount(Note)
- for i3 = 1,#CurBut do
- if CurBut[i3] == Notes[Note][2] then
- return i3
- end
- end
- return 1
- end
- local t = Def.ActorFrame{
- OnCommand=cmd(xy,SCREEN_CENTER_X,SCREEN_CENTER_Y+ReceptorPos(Reverse);zoom,1)
- }
- for i = 1,#CurBut do
- for i2 = 1,#Exp_Element do
- local Texture, Rotation = NoteskinLoader(pn,CurBut[i],Exp_Element[i2])
- for i3 = 1,#Texture do
- t[#t+1] = Def.ActorFrame{
- OnCommand=function(self)
- self:x((-(#CurBut*(96/2.5))+(i*(96/1.5)))-((96/1.5)/10))
- end,
- LoadActor(Texture[i3])..{
- OnCommand=function(self)
- self:rotationz(Rotation)
- end,
- },
- }
- end
- end
- end
- function TextureActors(Tex,Rot)
- local t2 = Def.ActorFrame{}
- for i = 1,#Tex do
- t2[#t2+1] = LoadActor(Tex[i])..{
- OnCommand=function(self)
- self:rotationz(Rot)
- :animate(false)
- :setstate(15)
- :xy(32,32)
- end,
- }
- end
- return t2
- end
- for i = 1,#CurBut do
- Texture, Rotation = NoteskinLoader(pn,CurBut[i],"Tap Note")
- t[#t+1] = Def.ActorFrameTexture {
- InitCommand=function(self)
- self:SetTextureName( "Tap Note "..CurBut[i] )
- :SetWidth( 64 )
- :SetHeight( 64 )
- :EnableAlphaBuffer( true )
- :xy(SCREEN_CENTER_X,SCREEN_CENTER_Y)
- :Create()
- end,
- TextureActors(Texture,Rotation)
- }
- end
- for i = 1,#Notes do
- local BPM = GAMESTATE:GetCurrentSong():GetTimingData():GetBPMAtBeat(0)
- local FBeat = GAMESTATE:GetCurrentSong():GetFirstBeat()
- local LBeat = GAMESTATE:GetCurrentSong():GetLastBeat()
- local FSecond = GAMESTATE:GetCurrentSong():GetFirstSecond()
- local LSecond = GAMESTATE:GetCurrentSong():GetLastSecond()
- local speedmod = 400 / BPM
- local speedmode = "cmod"
- local setmode
- if speedmode == "cmod" then
- setmode = 1
- elseif speedmod == "xmod" then
- setmode = i
- end
- local BPM = GAMESTATE:GetCurrentSong():GetTimingData():GetBPMAtBeat(Notes[setmode][1])
- local arrowsize = 64
- local arrowoffset = 0
- local offset = arrowsize+arrowoffset
- local GlobalNotes = (Notes[i][1]*(offset))*speedmod
- local EndNotes = ((LBeat*offset))*speedmod
- local NoteField = GlobalNotes+(offset*2)
- t[#t+1] = Def.ActorFrame{
- OnCommand=function(self)
- self:xy((-(#CurBut*(96/2.5))+(GetCount(i)*(96/1.5)))-((96/1.5)/10),(NoteField)*Reverse)
- :queuecommand("Scroller")
- end,
- ScrollerCommand=function(self)
- self:sleep(4.65+FSecond):linear(LSecond*2)
- :y((NoteField-(EndNotes*2))*Reverse)
- end,
- Def.Sprite{
- Texture="Tap Note "..Notes[i][2],
- OnCommand=function(self)
- self:visible(false)
- --:sleep(((Notes[i][1]/(GAMESTATE:GetSongBPS()))*(GAMESTATE:GetSongBPS()/2.55))-(GAMESTATE:GetCurrentSong():GetFirstBeat()*2.5))
- :queuecommand("Load")
- end,
- LoadCommand=function(self)
- self:visible(true)
- :sleep(4.5)
- --:queuecommand("UnLoad")
- --print("LOAD"..GAMESTATE:GetCurrentSong():GetFirstBeat())
- end,
- UnLoadCommand=function(self)
- self:visible(false)
- print("UNLOAD")
- end,
- },
- }
- end
- t[#t+1] = Def.Sound{
- File=GAMESTATE:GetCurrentSong():GetMusicPath();
- OnCommand=function(self)
- self:sleep(4.65)
- self:queuecommand("Play")
- print(GAMESTATE:GetCurrentSong():GetMusicPath());
- end;
- PlayCommand=function(self) self:play() end;
- }
- return t
- end
- function ExpandField()
- local t = Def.ActorFrame{
- PlayerField(PLAYER_1)
- }
- return t
- end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement