Skip to content

Commit

Permalink
Merge branch 'songsearch'
Browse files Browse the repository at this point in the history
  • Loading branch information
MinaciousGrace committed Dec 7, 2016
2 parents 8edfc38 + 9543b49 commit 4795319
Show file tree
Hide file tree
Showing 15 changed files with 228 additions and 285 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -103,6 +103,9 @@ d = Def.ActorFrame{
self:settextf("%5.2f", tDiff)
end
},
Def.Quad{InitCommand=cmd(xy,60,(SCREEN_HEIGHT*0.62)-90;zoomto,60,16;diffuse,color("0,0,0,0.4");horizalign,left;vertalign,top)},

-- Displays your current percentage score
LoadFont("Common Large")..{
Name = "DisplayPercent",
InitCommand=cmd(xy,115,220;zoom,0.3;halign,1;valign,1),
Expand All @@ -112,7 +115,7 @@ d = Def.ActorFrame{
JudgmentMessageCommand=function(self,msg)
self:settextf("%05.2f%%", msg.WifePercent)
end
}
},
}

if playerConfig:get_data(pn_to_profile_slot(PLAYER_1)).TargetTracker then
Expand Down Expand Up @@ -172,7 +175,7 @@ local j = Def.ActorFrame{


-- Background
j[#j+1] = Def.Quad{InitCommand=cmd(xy,frameX,frameY;zoomto,frameWidth,frameHeight;diffuse,color("0,0,0,0.4");horizalign,left;vertalign,top)}
j[#j+1] = Def.Quad{InitCommand=cmd(xy,frameX,frameY+16;zoomto,frameWidth,frameHeight+16;diffuse,color("0,0,0,0.4");horizalign,left;vertalign,top)}

-- Build judgeboard
for i=1,#jdgT do
Expand Down Expand Up @@ -335,7 +338,7 @@ local alpha = 0.3
p = Def.ActorFrame{
InitCommand=cmd(xy,frameX,frameY),
Def.Quad{InitCommand=cmd(zoomto,width,height;diffuse,color("#666666");diffusealpha,alpha)}, -- background
Def.Quad{InitCommand=cmd(x,1+width/2;zoomto,1,height;diffuse,color("#666666"))}, -- ending indicator
Def.Quad{InitCommand=cmd(x,1+width/2;zoomto,1,height;diffuse,color("#555555"))}, -- ending indicator
Def.SongMeterDisplay{
InitCommand=function(self)
self:SetUpdateRate(0.5)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -257,19 +257,20 @@ end;

local function Update(self)
t.InitCommand=cmd(SetUpdateFunction,Update);
self:SetUpdateRate(0.5)
if enabledP1 then
if moveDownP1 then
if isReverseP1 then
heightP1 = math.min(SCREEN_BOTTOM,math.max(0,heightP1+1))
heightP1 = math.min(SCREEN_BOTTOM,math.max(0,heightP1+0.1))
else
heightP1 = math.min(SCREEN_BOTTOM,math.max(0,heightP1-1))
heightP1 = math.min(SCREEN_BOTTOM,math.max(0,heightP1-0.1))
end;
end;
if moveUpP1 then
if isReverseP1 then
heightP1 = math.min(SCREEN_BOTTOM,math.max(0,heightP1-1))
heightP1 = math.min(SCREEN_BOTTOM,math.max(0,heightP1-0.1))
else
heightP1 = math.min(SCREEN_BOTTOM,math.max(0,heightP1+1))
heightP1 = math.min(SCREEN_BOTTOM,math.max(0,heightP1+0.1))
end;
end;

Expand Down
4 changes: 0 additions & 4 deletions Themes/Til Death/BGAnimations/ScreenPlayerOptions overlay.lua
Original file line number Diff line number Diff line change
Expand Up @@ -8,10 +8,6 @@ local t = Def.ActorFrame{
Name="PlayerAvatar";
};


-- ugh, for preventing song search from sending you back to a search result if you scroll somewhere else, enter, and then quit
storeSongSearchResult(GAMESTATE:GetCurrentSong(), GAMESTATE:GetCurrentSteps(PLAYER_1))

local profileP1
local profileP2

Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
local t = Def.ActorFrame{}

t[#t+1] = LoadActor("wifetwirl");
--t[#t+1] = LoadActor("songsearch")
t[#t+1] = LoadActor("songsearch")
t[#t+1] = LoadActor("tabs")
t[#t+1] = LoadActor("songinfo");
t[#t+1] = LoadActor("score");
Expand Down
Original file line number Diff line number Diff line change
@@ -1,198 +1,108 @@
--[[ Really hacky song search, don't want to use existing textinput because search results should update dynamically rather than requiring new input;
need to do efficiency and organizational rewrites or better yet take a different approach altogether, i mean they did say not to do this in the
first place because blah blah asian people sanskrit moonelmorunestar type but you know, whatever, murica.
Will probably will merge this into a tab so there can be a nice display of search string/instructions and displayed results regardless
Don't think i need to add more characters but maybe later if it seems i do, also artist search isnt enabled in any way atm
note to self: searching by best player grade might be useful, such as all songs for which the best grade is failed
--]]

-- need to redo this whole mess

local searchstring = ""
local englishes = {"0", "1", "2", "3", "4", "5", "6", "7", "8", "9", "a", "b", "c", "d", "e","f", "g", "h", "i", "j", "k", "l", "m", "n", "o", "p", "q", "r", "s", "t", "u", "v", "w", "x", "y", "z"}
if not storedSearchInfo() then
storeSearchInfo(SONGMAN:GetAllSongs())
end

local allSongs
local allTitles
local allArtists
local results = {}
local resultsindex = {}
local curResult = 1
local englishes = {"a", "b", "c", "d", "e","f", "g", "h", "i", "j", "k", "l", "m", "n", "o", "p", "q", "r", "s", "t", "u", "v", "w", "x", "y", "z"}
local frameX = 10
local frameY = 180+capWideScale(get43size(120),120)
local active = false
local whee

local function searchInput(event)
local hurrr = false
if event.type ~= "InputEventType_Release" then
if event.type ~= "InputEventType_Release" and active == true then
if event.button == "Back" then
SCREENMAN:set_input_redirected(PLAYER_1, false)
SCREENMAN:GetTopScreen():RemoveInputCallback(searchInput)
ms.ok("Search Cancelled")
storeSongSearchResult(nil, nil)
SCREENMAN:SetNewScreen("ScreenSelectMusic")
resetTabIndex(0)
MESSAGEMAN:Broadcast("TabChanged")
elseif event.button == "Start" then
SCREENMAN:set_input_redirected(PLAYER_1, false) -- make sure we store the song found so we can retrieve it and set the music wheel in the new music select screen to it
SCREENMAN:GetTopScreen():RemoveInputCallback(searchInput) -- this is because setting and removing input callbacks on the same screen more than once for some reason prevents the
ms.ok("Search Finished") -- subsequent input callbacks to not recieve any inputs, effectively forcing a game restart since input_redirected is true
storeSongSearchResult(GAMESTATE:GetCurrentSong(),GAMESTATE:GetCurrentSteps(PLAYER_1))
SCREENMAN:SetNewScreen("ScreenSelectMusic")
elseif event.DeviceInput.button == "DeviceButton_space" then -- add space to the string
SCREENMAN:set_input_redirected(PLAYER_1, false)
active = false
elseif event.DeviceInput.button == "DeviceButton_space" then -- add space to the string
searchstring = searchstring.." "
MESSAGEMAN:Broadcast("SearchUpdate")
elseif event.DeviceInput.button == "DeviceButton_backspace" or event.DeviceInput.button == "DeviceButton_delete" then
searchstring = searchstring:sub(1, -2) -- remove the last element of the string
MESSAGEMAN:Broadcast("SearchUpdate")
elseif event.DeviceInput.button == "DeviceButton_backspace"then
searchstring = searchstring:sub(1, -2) -- remove the last element of the string
elseif event.DeviceInput.button == "DeviceButton_delete" then
searchstring = ""
else
for i=1,#englishes do -- add standard characters to string
if event.DeviceInput.button == "DeviceButton_"..englishes[i] then
searchstring = searchstring..englishes[i]
MESSAGEMAN:Broadcast("SearchUpdate")
hurrr = true
end
end
end
end

if hurrr then
if event.button == "Left" then -- need to be here so that only the arrrow keys swap search results, not left binds such as "a"
MESSAGEMAN:Broadcast("SwitchResultsLeft")
elseif event.button == "Right" then
MESSAGEMAN:Broadcast("SwitchResultsRight")
end
end
return true
MESSAGEMAN:Broadcast("UpdateString")
whee:SongSearch(searchstring)
end

local t = Def.ActorFrame{
CodeMessageCommand=function(self,params)
if params.Name == "SongSearch" then
OnCommand=function(self)
whee = SCREENMAN:GetTopScreen():GetMusicWheel()
SCREENMAN:GetTopScreen():AddInputCallback(searchInput)
self:visible(false)
end,
SetCommand=function(self)
self:finishtweening()
if getTabIndex() == 3 then
ms.ok("Song search activated")
allSongs = getAllSongs()
allTitles = getAllTitles()
allArtists = getAllArtists()
storeSongSearchResult(GAMESTATE:GetCurrentSong()) -- store current song so we can get back to it if search is cancelled, rather than having the most recently played song load
SCREENMAN:GetTopScreen():AddInputCallback(searchInput)
self:visible(true)
active = true
SCREENMAN:set_input_redirected(PLAYER_1, true)
MESSAGEMAN:Broadcast("RefreshSearchResults")
end
end
}

-- oh boy.. auto set the wheel to any search result that is stored and then clear it away if so, cant do this earlier in the script since music wheel doesn't exist yet
-- this garbage is to make sure the preview music of the most recently played song doesnt play instead of the song search match... and even then.. if you hold tab....
if recallSearchResult() then
t[#t+1] = Def.Actor{
OnCommand=function(self)
setSongFromCompletedSearch()
MESSAGEMAN:Broadcast("UpdateChart")
MESSAGEMAN:Broadcast("RefreshChartInfo")
end,
}
end

t[#t+1] = Def.Actor{
SearchUpdateMessageCommand=cmd(sleep,0;queuecommand,"Set"),
SetCommand=function(self)
self:finishtweening()
results = {}
resultsindex = {}

for i =1, #allTitles do
if string.find(allTitles[i], searchstring) then
results[#results+1] = allTitles[i]
resultsindex[#resultsindex+1] = i
end
end

curResult = 1
setSongFromSearch(allSongs[resultsindex[curResult]])
end,
SwitchResultsLeftMessageCommand=function(self)
if curResult == 1 then
curResult = #results
else
curResult = curResult-1
end

setSongFromSearch(allSongs[resultsindex[curResult]])
end,
SwitchResultsRightMessageCommand=function(self)
if curResult == #results then
curResult = 1
else
curResult = curResult+1
end

setSongFromSearch(allSongs[resultsindex[curResult]])
end,
}

t[#t+1] = LoadFont("Common Normal")..{
InitCommand=cmd(xy,frameX,frameY-90;zoom,0.5;halign,0),
BeginCommand=function(self)
self:settext("")
end,
SetCommand=function(self)
self:settext("Searching for:")
end,
RefreshSearchResultsMessageCommand=cmd(queuecommand,"Set"),
SearchEndMessageCommand=cmd(queuecommand,"Begin"),
}

t[#t+1] = LoadFont("Common Normal")..{
InitCommand=cmd(xy,frameX+15,frameY-70;zoom,0.7;halign,0;maxwidth,470),
BeginCommand=function(self)
self:settext("")
end,
SetCommand=function(self)
self:settext(searchstring)
end,
RefreshSearchResultsMessageCommand=cmd(queuecommand,"Set"),
SearchEndMessageCommand=cmd(queuecommand,"Begin"),
}

t[#t+1] = LoadFont("Common Normal")..{
InitCommand=cmd(xy,frameX,frameY-50;zoom,0.4;halign,0),
BeginCommand=function(self)
self:settext("")
end,
SetCommand=function(self)
if #results ~= 0 then
self:settext("Showing Match:"..curResult.." of "..#results)
elseif searchstring == "" then
self:settext("No search string to match")
else
self:settext("No matches for current query. Backspace or delete to alter search string.")
searchstring = ""
else
self:visible(false)
self:queuecommand("Off")
active = false
SCREENMAN:set_input_redirected(PLAYER_1, false)
end
end,
RefreshSearchResultsMessageCommand=cmd(queuecommand,"Set"),
SearchEndMessageCommand=cmd(queuecommand,"Begin"),
}
t[#t+1] = LoadFont("Common Normal")..{
InitCommand=cmd(xy,frameX,frameY-40;zoom,0.35;halign,0),
BeginCommand=function(self)
self:settext("")
end,
SetCommand=function(self)
self:settext("Left or Right to change selection.")
end,
RefreshSearchResultsMessageCommand=cmd(queuecommand,"Set"),
SearchEndMessageCommand=cmd(queuecommand,"Begin"),
}

t[#t+1] = LoadFont("Common Normal")..{
InitCommand=cmd(xy,frameX,frameY-31;zoom,0.35;halign,0),
BeginCommand=function(self)
self:settext("")
end,
SetCommand=function(self)
self:settext("Back or Start to exit search.")
end,
RefreshSearchResultsMessageCommand=cmd(queuecommand,"Set"),
SearchEndMessageCommand=cmd(queuecommand,"Begin"),
TabChangedMessageCommand=cmd(queuecommand,"Set"),

LoadFont("Common Large")..{
InitCommand=cmd(xy,frameX+250-capWideScale(get43size(120),120),frameY-90;zoom,0.7;halign,0.5;maxwidth,470),
SetCommand=function(self)
if active then
self:settext("Search Active:")
self:diffuse(getGradeColor("Grade_Tier03"))
else
self:settext("Search Complete:")
self:diffuse(byJudgment("TapNoteScore_Miss"))
end
end,
UpdateStringMessageCommand=cmd(queuecommand,"Set"),
},
LoadFont("Common Large")..{
InitCommand=cmd(xy,frameX+250-capWideScale(get43size(120),120),frameY-50;zoom,0.7;halign,0.5;maxwidth,470),
SetCommand=function(self)
self:settext(searchstring)
end,
UpdateStringMessageCommand=cmd(queuecommand,"Set"),
},
LoadFont("Common Large")..{
InitCommand=cmd(xy,frameX+20,frameY-200;zoom,0.5;halign,0),
SetCommand=function(self)
self:settext("Start releases input redirect.")
end,
UpdateStringMessageCommand=cmd(queuecommand,"Set"),
},
LoadFont("Common Large")..{
InitCommand=cmd(xy,frameX+20,frameY-175;zoom,0.5;halign,0),
SetCommand=function(self)
self:settext("Delete resets search query.")
end,
UpdateStringMessageCommand=cmd(queuecommand,"Set"),
},
LoadFont("Common Large")..{
InitCommand=cmd(xy,frameX+20,frameY-150;zoom,0.5;halign,0),
SetCommand=function(self)
self:settext("Back returns to general tab.")
end,
UpdateStringMessageCommand=cmd(queuecommand,"Set"),
},
LoadFont("Common Normal")..{
InitCommand=cmd(xy,frameX+20,frameY+70;zoom,0.5;halign,0),
SetCommand=function(self)
self:settext("Currently supports standard english alphabet only.")
end,
UpdateStringMessageCommand=cmd(queuecommand,"Set"),
},
}

return t
Original file line number Diff line number Diff line change
Expand Up @@ -416,7 +416,7 @@ t[#t+1] = LoadFont("Common Large") .. {
InitCommand=cmd(xy,frameX,frameY-120;halign,0;zoom,0.4);
BeginCommand=cmd(queuecommand,"Set");
SetCommand=function(self)
--self:settext(steps:GetChartKey())
self:settext("")
end,
CurrentStepsP1ChangedMessageCommand=cmd(queuecommand,"Set"),
RefreshChartInfoMessageCommand=cmd(queuecommand,"Set"),
Expand Down
5 changes: 5 additions & 0 deletions Themes/Til Death/Languages/en.ini
Original file line number Diff line number Diff line change
Expand Up @@ -77,6 +77,11 @@ DivideByZero=DivideByZero (Noteskin)
1.85x=1.85x
1.9x=1.9x
1.95x=1.95x
2.1x=2.1x
2.2x=2.2x
2.3x=2.3x
2.4x=2.4x
2.5x=2.5x

39% Mini= 39% Mini
40% Mini= 40% Mini
Expand Down
2 changes: 1 addition & 1 deletion Themes/Til Death/Scripts/00 ThemeInfo.lua
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

themeInfo = {
Name = "'Til Death",
Version = "1.03",
Version = "1.04",
Date = "20161121",
};

Expand Down
Loading

0 comments on commit 4795319

Please sign in to comment.