From 705612ab9790961203b5d45bf72858111dca9f10 Mon Sep 17 00:00:00 2001 From: MinaciousGrace Date: Sun, 18 Dec 2016 23:28:01 -0500 Subject: [PATCH] look who's purging now --- .../ScreenEvaluation decorations/default.lua | 51 ++- .../scoreboard.lua | 99 ++--- .../wifeScold.lua | 27 +- .../WifeJudgmentSpotting.lua | 1 - Themes/Til Death/Scripts/DataDumper.lua | 303 +------------- Themes/Til Death/Scripts/Wife.lua | 373 +----------------- Themes/Til Death/Scripts/WifeKeys.lua | 88 +---- Themes/Til Death/Scripts/WifePointTables.lua | 71 +--- Themes/Til Death/Scripts/WifeScores.lua | 146 +------ Themes/Til Death/Scripts/WifeSearch.lua | 76 +--- Themes/Til Death/Scripts/WifeSundries.lua | 172 ++------ src/RageDisplay_D3D.cpp | 4 +- 12 files changed, 131 insertions(+), 1280 deletions(-) diff --git a/Themes/Til Death/BGAnimations/ScreenEvaluation decorations/default.lua b/Themes/Til Death/BGAnimations/ScreenEvaluation decorations/default.lua index 8aa0621fd7..c6fbcddfe2 100644 --- a/Themes/Til Death/BGAnimations/ScreenEvaluation decorations/default.lua +++ b/Themes/Til Death/BGAnimations/ScreenEvaluation decorations/default.lua @@ -64,7 +64,6 @@ end --ScoreBoard local judges = {'TapNoteScore_W1','TapNoteScore_W2','TapNoteScore_W3','TapNoteScore_W4','TapNoteScore_W5','TapNoteScore_Miss'} -local score = getCurScore() local pssP1 = STATSMAN:GetCurStageStats():GetPlayerStageStats(PLAYER_1) local frameX = 20 @@ -77,12 +76,58 @@ function scoreBoard(pn,position) BeginCommand=function(self) if position == 1 then self:x(SCREEN_WIDTH-(frameX*2)-frameWidth) - end; - end; + end + end } local pss = STATSMAN:GetCurStageStats():GetPlayerStageStats(pn) + t[#t+1] = Def.Quad{InitCommand=cmd(xy,frameX-5,frameY;zoomto,frameWidth+10,220;halign,0;valign,0;diffuse,color("#333333CC"))}; + t[#t+1] = Def.Quad{InitCommand=cmd(xy,frameX,frameY+30;zoomto,frameWidth,2;halign,0;diffuse,getMainColor('highlight');diffusealpha,0.5)}; + t[#t+1] = Def.Quad{InitCommand=cmd(xy,frameX,frameY+55;zoomto,frameWidth,2;halign,0;diffuse,getMainColor('highlight');diffusealpha,0.5)}; + + t[#t+1] = LoadFont("Common Large")..{ + InitCommand=cmd(xy,frameWidth+frameX,frameY+32;zoom,0.5;halign,1;valign,0;maxwidth,200), + BeginCommand=cmd(queuecommand,"Set"), + SetCommand=function(self) + local meter = pss:GetSSR() + self:settextf("%5.2f", meter) + self:diffuse(byDifficultyMeter(meter)) + end, + }; + + t[#t+1] = LoadFont("Common Large") .. { + InitCommand=cmd(xy,frameWidth+frameX,frameY+7;zoom,0.5;halign,1;valign,0;maxwidth,200), + BeginCommand=cmd(queuecommand,"Set"), + SetCommand=function(self) + local steps = GAMESTATE:GetCurrentSteps(PLAYER_1) + local diff = getDifficulty(steps:GetDifficulty()) + self:settext(getShortDifficulty(diff)) + self:diffuse(getDifficultyColor(GetCustomDifficulty(steps:GetStepsType(),steps:GetDifficulty()))) + end + }; + + -- Wife percent + t[#t+1] = LoadFont("Common Large")..{ + InitCommand=cmd(xy,frameX+5,frameY+9;zoom,0.45;halign,0;valign,0), + BeginCommand=cmd(queuecommand,"Set"), + SetCommand=function(self) + self:diffuse(getGradeColor(pss:GetWifeGrade())) + self:settextf("%05.2f%% (%s)",notShit.floor(pss:GetWifeScore()*10000)/100, "Wife") + end, + }; + + -- DP percent + t[#t+1] = LoadFont("Common Large")..{ + InitCommand=cmd(xy,frameX+5,frameY+34;zoom,0.45;halign,0;valign,0), + BeginCommand=cmd(queuecommand,"Set"), + SetCommand=function(self) + local score = getScoreFromTable(getScoreList(PLAYER_1),pss:GetPersonalHighScoreIndex()+1) + self:diffuse(getGradeColor(pss:GetGrade())) + self:settextf("%05.2f%% (%s)",GetPercentDP(score), "DP") + end, + } + t[#t+1] = LoadFont("Common Normal")..{ InitCommand=cmd(xy,frameX+5,frameY+63;zoom,0.40;halign,0;maxwidth,frameWidth/0.4), BeginCommand=cmd(queuecommand,"Set"), diff --git a/Themes/Til Death/BGAnimations/ScreenEvaluation decorations/scoreboard.lua b/Themes/Til Death/BGAnimations/ScreenEvaluation decorations/scoreboard.lua index 0eadf6734b..802ea86c32 100644 --- a/Themes/Til Death/BGAnimations/ScreenEvaluation decorations/scoreboard.lua +++ b/Themes/Til Death/BGAnimations/ScreenEvaluation decorations/scoreboard.lua @@ -1,5 +1,3 @@ - - function gradestring(tier) --to be moved if tier == "Grade_Tier01" then return 'AAAA' @@ -19,8 +17,8 @@ function gradestring(tier) --to be moved return 'F' else return tier - end; -end; + end +end local lines = 5 -- number of scores to display local framex = SCREEN_WIDTH-capWideScale(get43size(230),230) @@ -45,7 +43,7 @@ if GAMESTATE:IsPlayerEnabled(player) then profile = GetPlayerOrMachineProfile(player) steps = STATSMAN:GetCurStageStats():GetPlayerStageStats(player):GetPlayedSteps()[1] origTable = getScoresByKey(player) - score = STATSMAN:GetCurStageStats():GetPlayerStageStats(player):GetHighScore()--origTable[STATSMAN:GetCurStageStats():GetPlayerStageStats(player):GetPersonalHighScoreIndex()+1] + score = STATSMAN:GetCurStageStats():GetPlayerStageStats(player):GetHighScore() rtTable = getRateTable(origTable) if themeConfig:get_data().global.RateSort then hsTable = sortScore(rtTable[getRate(score)] or {},0) @@ -66,18 +64,18 @@ local function input(event) scoreBoard:GetChild("scoreItem"..tostring(i)):GetChild("judge"):visible(not scoreBoard:GetChild("scoreItem"..tostring(i)):GetChild("judge"):GetVisible()) scoreBoard:GetChild("scoreItem"..tostring(i)):GetChild("date"):visible(not scoreBoard:GetChild("scoreItem"..tostring(i)):GetChild("date"):GetVisible()) scoreBoard:GetChild("scoreItem"..tostring(i)):GetChild("option"):visible(not scoreBoard:GetChild("scoreItem"..tostring(i)):GetChild("option"):GetVisible()) - end; - end; - end; + end + end + end end -return false; +return false end local t = Def.ActorFrame{ - Name="scoreBoard"; + Name="scoreBoard", OnCommand=function(self) SCREENMAN:GetTopScreen():AddInputCallback(input) end -}; +} local function scoreitem(pn,index,scoreIndex,drawindex) @@ -91,23 +89,23 @@ local function scoreitem(pn,index,scoreIndex,drawindex) -- local t = Def.ActorFrame { - Name="scoreItem"..tostring(drawindex); + Name="scoreItem"..tostring(drawindex), --The main quad Def.Quad{ - InitCommand=cmd(xy,framex,framey+(drawindex*spacing)-4;zoomto,frameWidth,30;halign,0;valign,0;diffuse,color("#333333");diffusealpha,1;diffuserightedge,color("#33333333")); + InitCommand=cmd(xy,framex,framey+(drawindex*spacing)-4;zoomto,frameWidth,30;halign,0;valign,0;diffuse,color("#333333");diffusealpha,1;diffuserightedge,color("#33333333")), BeginCommand=function(self) - self:visible(GAMESTATE:IsHumanPlayer(pn)); - end; - }; + self:visible(GAMESTATE:IsHumanPlayer(pn)) + end + }, --Highlight quad for the current score Def.Quad{ - InitCommand=cmd(xy,framex,framey+(drawindex*spacing)-4;zoomto,frameWidth,30;halign,0;valign,0;diffuse,color("#ffffff");diffusealpha,0.3;diffuserightedge,color("#33333300")); + InitCommand=cmd(xy,framex,framey+(drawindex*spacing)-4;zoomto,frameWidth,30;halign,0;valign,0;diffuse,color("#ffffff");diffusealpha,0.3;diffuserightedge,color("#33333300")), BeginCommand=function(self) - self:visible(GAMESTATE:IsHumanPlayer(pn) and equals); - end; - }; + self:visible(GAMESTATE:IsHumanPlayer(pn) and equals) + end + }, --Quad that will act as the bounding box for mouse rollover/click stuff. Def.Quad{ @@ -143,8 +141,8 @@ local function scoreitem(pn,index,scoreIndex,drawindex) -- DP grade and %score LoadFont("Common normal")..{ - Name="grade"; - InitCommand=cmd(xy,framex+10,framey+(drawindex*spacing)+2;zoom,0.35;halign,0;maxwidth,(frameWidth-15)/0.3); + Name="grade", + InitCommand=cmd(xy,framex+10,framey+(drawindex*spacing)+2;zoom,0.35;halign,0;maxwidth,(frameWidth-15)/0.3), BeginCommand=function(self) local curscore = getScore(hsTable[index]) local maxscore = getMaxScore(pn,0) @@ -152,9 +150,9 @@ local function scoreitem(pn,index,scoreIndex,drawindex) maxscore = 1 end; local pscore = (curscore/maxscore) - self:settextf("%.2f%% (%s)",math.floor((pscore)*10000)/100,"DP"); - end; - }; + self:settextf("%.2f%% (%s)",math.floor((pscore)*10000)/100,"DP") + end + }, -- Wife grade and %score LoadFont("Common normal")..{ @@ -169,16 +167,15 @@ local function scoreitem(pn,index,scoreIndex,drawindex) end }, - --mods LoadFont("Common normal")..{ - Name="option"; - InitCommand=cmd(xy,framex+10,framey+11+(drawindex*spacing);zoom,0.35;halign,0;maxwidth,(frameWidth-15)/0.35); + Name="option", + InitCommand=cmd(xy,framex+10,framey+11+(drawindex*spacing);zoom,0.35;halign,0;maxwidth,(frameWidth-15)/0.35), BeginCommand=function(self) - self:settext(hsTable[index]:GetModifiers()); + self:settext(hsTable[index]:GetModifiers()) self:visible(false) - end; - }; + end + }, --grade text LoadFont("Common normal")..{ @@ -241,8 +238,8 @@ local function scoreitem(pn,index,scoreIndex,drawindex) end }, - }; - return t; + } + return t end --can't have more lines than the # of scores huehuehu @@ -264,28 +261,14 @@ elseif scoreIndex>math.floor(lines/2) then startind = scoreIndex - math.floor(lines/2) else startind = scoreIndex - math.floor(lines/2)+1 - end; -end; + end +end while drawindex<#hsTable and startind<=finishind do t[#t+1] = scoreitem(player,startind,scoreIndex,drawindex) startind = startind+1 drawindex = drawindex+1 -end; - ---Text that sits above the scoreboard with some info -t[#t+1] = LoadFont("Common normal")..{ - InitCommand=cmd(xy,SCREEN_CENTER_X,framey+95;zoom,0.5;halign,0.5;); - BeginCommand=function(self) - local text = "" - text = getRate(score) - self:settext(text) - if text == "1.0x" then - self:diffusealpha(0) - end - end; -}; - +end if tonumber(PREFSMAN:GetPreference("MaxHighScoresPerListForPlayer")) ~= 3 then themeConfig:get_data().global.ScoreBoardNag = false @@ -295,7 +278,7 @@ end if themeConfig:get_data().global.ScoreBoardNag and #origTable == tonumber(PREFSMAN:GetPreference("MaxHighScoresPerListForPlayer")) then t[#t+1] = LoadFont("Common normal")..{ - InitCommand=cmd(xy,framex+frameWidth/2,framey+4*spacing;zoom,0.30;valign,0;diffusealpha,0.8;maxwidth,frameWidth/0.30); + InitCommand=cmd(xy,framex+frameWidth/2,framey+4*spacing;zoom,0.30;valign,0;diffusealpha,0.8;maxwidth,frameWidth/0.30), BeginCommand=function(self) local text = string.format("You have reached the maximum number of saved scores for this chart.".. " \n Lower ranked scores will be removed as you save more scores.\n\n".. @@ -304,7 +287,7 @@ if themeConfig:get_data().global.ScoreBoardNag and #origTable == tonumber(PREFSM "This will no longer appear once the limit is set to any non-default value.\n(You may change back afterwards if you want)\n\n".. "The current limit is %s. (Default is 3)",PREFSMAN:GetPreference("MaxHighScoresPerListForPlayer") or 0) self:settext(text) - end; + end } end @@ -325,14 +308,4 @@ local function Update(self) end t.InitCommand=cmd(SetUpdateFunction,Update) - ---[[ -t[#t+1] = LoadFont("Common normal")..{ - InitCommand=cmd(xy,framex,framey+10+(spacing);zoom,1;halign,0); - BeginCommand=function(self) - self:settext(scoreIndex) - end; -}; ---]] - -return t; \ No newline at end of file +return t \ No newline at end of file diff --git a/Themes/Til Death/BGAnimations/ScreenEvaluation decorations/wifeScold.lua b/Themes/Til Death/BGAnimations/ScreenEvaluation decorations/wifeScold.lua index 07ff1ddda4..23c5397bf7 100644 --- a/Themes/Til Death/BGAnimations/ScreenEvaluation decorations/wifeScold.lua +++ b/Themes/Til Death/BGAnimations/ScreenEvaluation decorations/wifeScold.lua @@ -1,26 +1 @@ --- should be merged with other stuff later and need to test to make sure it //actually// does nothing if scores aren't 4k - -storeSongSearchResult(nil) - -local score -local Scores -local RateScores -local newScore - -if not getCurKey() then -- these are probably fairly redundant checks but oh well for now - ms.ok("No chart key detected (probably never generated)... skipping wife calculations...") -else - if STATSMAN:GetCurStageStats():GetPlayerStageStats(PLAYER_1):GetPlayedSteps()[1]:GetStepsType() == "StepsType_Dance_Single" then - score = STATSMAN:GetCurStageStats():GetPlayerStageStats(PLAYER_1):GetHighScore() - Scores = getCurChart().Scores - RateScores = formLink(Scores, getRate(score)) - newScore = formLink(RateScores, fashionScoreKey(score)) - newScore = buildPlayerScore(newScore, score, devianceTable, NoteRowTable) - setCurScore(newScore) - saveCurChart() - SCREENMAN:SystemMessage("Wife: Score Saved") - else - SCREENMAN:SystemMessage("Wife: Not 4k singles, Stop wasting my time") - end -end -return \ No newline at end of file +-- gone \ No newline at end of file diff --git a/Themes/Til Death/BGAnimations/ScreenGameplay overlay/WifeJudgmentSpotting.lua b/Themes/Til Death/BGAnimations/ScreenGameplay overlay/WifeJudgmentSpotting.lua index 20b7da58ee..647fd2bbab 100644 --- a/Themes/Til Death/BGAnimations/ScreenGameplay overlay/WifeJudgmentSpotting.lua +++ b/Themes/Til Death/BGAnimations/ScreenGameplay overlay/WifeJudgmentSpotting.lua @@ -20,7 +20,6 @@ local jdgT = { -- Table of judgments for the judgecounter "HoldNoteScore_LetGo", } -local sT = scoringTypes[themeConfig:get_data().global.DefaultScoreType] local dvCur local jdgCur -- Note: only for judgments with OFFSETS, might reorganize a bit later local positive = getMainColor("positive") diff --git a/Themes/Til Death/Scripts/DataDumper.lua b/Themes/Til Death/Scripts/DataDumper.lua index db55f34de2..6407456961 100644 --- a/Themes/Til Death/Scripts/DataDumper.lua +++ b/Themes/Til Death/Scripts/DataDumper.lua @@ -1,302 +1 @@ - - - - - ---[[ DataDumper.lua -Copyright (c) 2007 Olivetti-Engineering SA - -Permission is hereby granted, free of charge, to any person -obtaining a copy of this software and associated documentation -files (the "Software"), to deal in the Software without -restriction, including without limitation the rights to use, -copy, modify, merge, publish, distribute, sublicense, and/or sell -copies of the Software, and to permit persons to whom the -Software is furnished to do so, subject to the following -conditions: - -The above copyright notice and this permission notice shall be -included in all copies or substantial portions of the Software. - -THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, -EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES -OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND -NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT -HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, -WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING -FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR -OTHER DEALINGS IN THE SOFTWARE. -]] - --- Stripped down to only what was originally fast mode - -local dumplua_closure = [[ -local closures = {} -local function closure(t) - closures[#closures+1] = t - t[1] = assert(loadstring(t[1])) - return t[1] -end - -for _,t in pairs(closures) do - for i = 2,#t do - debug.setupvalue(t[1], i-1, t[i]) - end -end -]] - -local lua_reserved_keywords = { - 'and', 'break', 'do', 'else', 'elseif', 'end', 'false', 'for', - 'function', 'if', 'in', 'local', 'nil', 'not', 'or', 'repeat', - 'return', 'then', 'true', 'until', 'while' } - -local function keys(t) - local res = {} - local oktypes = { stringstring = true, numbernumber = true } - local function cmpfct(a,b) - if oktypes[type(a)..type(b)] then - return a < b - else - return type(a) < type(b) - end - end - for k in pairs(t) do - res[#res+1] = k - end - table.sort(res, cmpfct) - return res -end - -function DataDumper(value, varname, ident) - local defined, dumplua = {} - -- Local variables for speed optimization - local string_format, type, string_dump, string_rep = - string.format, type, string.dump, string.rep - local tostring, pairs, table_concat = - tostring, pairs, table.concat - local keycache, strvalcache, out, closure_cnt = {}, {}, {}, 0 - setmetatable(strvalcache, {__index = function(t,value) - local res = string_format('%q', value) - t[value] = res - return res - end}) - local fcts = { - string = function(value) return strvalcache[value] end, - number = function(value) return value end, - boolean = function(value) return tostring(value) end, - ['nil'] = function(value) return 'nil' end, - ['function'] = function(value) - return string_format("loadstring(%q)", string_dump(value)) - end, - userdata = function() error("Cannot dump userdata") end, - thread = function() error("Cannot dump threads") end, - } - local function test_defined(value, path) - if defined[value] then - if path:match("^getmetatable.*%)$") then - out[#out+1] = string_format("s%s, %s)\n", path:sub(2,-2), defined[value]) - else - out[#out+1] = path .. " = " .. defined[value] .. "\n" - end - return true - end - defined[value] = path - end - local function make_key(t, key) - local s - if type(key) == 'string' and key:match('^[_%a][_%w]*$') then - s = key .. "=" - else - s = "[" .. dumplua(key, 0) .. "]=" - end - t[key] = s - return s - end - for _,k in ipairs(lua_reserved_keywords) do - keycache[k] = '["'..k..'"] = ' - end - fcts.table = function (value) - -- Table value - local numidx = 1 - out[#out+1] = "{" - for key,val in pairs(value) do - if key == numidx then - numidx = numidx + 1 - else - out[#out+1] = keycache[key] - end - local str = dumplua(val) - out[#out+1] = str.."," - end - if string.sub(out[#out], -1) == "," then - out[#out] = string.sub(out[#out], 1, -2); - end - out[#out+1] = "}" - return "" - end - function dumplua(value, ident, path) - return fcts[type(value)](value, ident, path) - end - if varname == nil then - varname = "return " - elseif varname:match("^[%a_][%w_]*$") then - varname = varname .. " = " - end - setmetatable(keycache, {__index = make_key }) - out[1] = varname - table.insert(out,dumplua(value, 0)) - return table.concat(out) -end - - - --- original but without the c libs for output readability -function DataDumperSlow(value, varname, fastmode, ident) - local defined, dumplua = {} - -- Local variables for speed optimization - local string_format, type, string_dump, string_rep = - string.format, type, string.dump, string.rep - local tostring, pairs, table_concat = - tostring, pairs, table.concat - local keycache, strvalcache, out, closure_cnt = {}, {}, {}, 0 - setmetatable(strvalcache, {__index = function(t,value) - local res = string_format('%q', value) - t[value] = res - return res - end}) - local fcts = { - string = function(value) return strvalcache[value] end, - number = function(value) return value end, - boolean = function(value) return tostring(value) end, - ['nil'] = function(value) return 'nil' end, - ['function'] = function(value) - return string_format("loadstring(%q)", string_dump(value)) - end, - userdata = function() error("Cannot dump userdata") end, - thread = function() error("Cannot dump threads") end, - } - local function test_defined(value, path) - if defined[value] then - if path:match("^getmetatable.*%)$") then - out[#out+1] = string_format("s%s, %s)\n", path:sub(2,-2), defined[value]) - else - out[#out+1] = path .. " = " .. defined[value] .. "\n" - end - return true - end - defined[value] = path - end - local function make_key(t, key) - local s - if type(key) == 'string' and key:match('^[_%a][_%w]*$') then - s = key .. "=" - else - s = "[" .. dumplua(key, 0) .. "]=" - end - t[key] = s - return s - end - for _,k in ipairs(lua_reserved_keywords) do - keycache[k] = '["'..k..'"] = ' - end - if fastmode then - fcts.table = function (value) - -- Table value - local numidx = 1 - out[#out+1] = "{" - for key,val in pairs(value) do - if key == numidx then - numidx = numidx + 1 - else - out[#out+1] = keycache[key] - end - local str = dumplua(val) - out[#out+1] = str.."," - end - if string.sub(out[#out], -1) == "," then - out[#out] = string.sub(out[#out], 1, -2); - end - out[#out+1] = "}" - return "" - end - else - fcts.table = function (value, ident, path) - if test_defined(value, path) then return "nil" end - -- Table value - local sep, str, numidx, totallen = " ", {}, 1, 0 - local meta, metastr = (debug or getfenv()).getmetatable(value) - if meta then - ident = ident + 1 - metastr = dumplua(meta, ident, "getmetatable("..path..")") - totallen = totallen + #metastr + 16 - end - for _,key in pairs(keys(value)) do - local val = value[key] - local s = "" - local subpath = path or "" - if key == numidx then - subpath = subpath .. "[" .. numidx .. "]" - numidx = numidx + 1 - else - s = keycache[key] - if not s:match "^%[" then subpath = subpath .. "." end - subpath = subpath .. s:gsub("%s*=%s*$","") - end - s = s .. dumplua(val, ident+1, subpath) - str[#str+1] = s - totallen = totallen + #s + 2 - end - if totallen > 80 then - sep = "\n" .. string_rep(" ", ident+1) - end - str = "{"..sep..table_concat(str, ","..sep).." "..sep:sub(1,-3).."}" - if meta then - sep = sep:sub(1,-3) - return "setmetatable("..sep..str..","..sep..metastr..sep:sub(1,-3)..")" - end - return str - end - fcts['function'] = function (value, ident, path) - if test_defined(value, path) then return "nil" end - closure_cnt = closure_cnt + 1 - local res = {string.dump(value)} - for i = 1,math.huge do - local name, v = debug.getupvalue(value,i) - if name == nil then break end - res[i+1] = v - end - return "closure " .. dumplua(res, ident, "closures["..closure_cnt.."]") - end - end - function dumplua(value, ident, path) - return fcts[type(value)](value, ident, path) - end - if varname == nil then - varname = "return " - elseif varname:match("^[%a_][%w_]*$") then - varname = varname .. " = " - end - if fastmode then - setmetatable(keycache, {__index = make_key }) - out[1] = varname - table.insert(out,dumplua(value, 0)) - return table.concat(out) - else - setmetatable(keycache, {__index = make_key }) - local items = {} - for i=1,10 do items[i] = '' end - items[3] = dumplua(value, ident or 0, "t") - if closure_cnt > 0 then - items[1], items[6] = dumplua_closure:match("(.*\n)\n(.*)") - out[#out+1] = "" - end - if #out > 0 then - items[2], items[4] = "local t = ", "\n" - items[5] = table.concat(out) - items[7] = varname .. "t" - else - items[2] = varname - end - return table.concat(items) - end -end \ No newline at end of file +--gone \ No newline at end of file diff --git a/Themes/Til Death/Scripts/Wife.lua b/Themes/Til Death/Scripts/Wife.lua index 7f6c28890b..23c5397bf7 100644 --- a/Themes/Til Death/Scripts/Wife.lua +++ b/Themes/Til Death/Scripts/Wife.lua @@ -1,372 +1 @@ --- **Parameters for all the scoring types** --- Aggregate these so we aren't writing 10 years worth of if statements in every function --- global here -scoringTypes = { - { -- Score Weights for DP score (MAX2) vvvv is all this shit really necessary??? vvvv - TapNoteScore_W1 = THEME:GetMetric("ScoreKeeperNormal","GradeWeightW1"), -- 2 - TapNoteScore_W2 = THEME:GetMetric("ScoreKeeperNormal","GradeWeightW2"), -- 2 - TapNoteScore_W3 = THEME:GetMetric("ScoreKeeperNormal","GradeWeightW3"), -- 1 - TapNoteScore_W4 = THEME:GetMetric("ScoreKeeperNormal","GradeWeightW4"), -- 0 - TapNoteScore_W5 = THEME:GetMetric("ScoreKeeperNormal","GradeWeightW5"), -- -4 - TapNoteScore_Miss = THEME:GetMetric("ScoreKeeperNormal","GradeWeightMiss"), -- -8 - HoldNoteScore_Held = THEME:GetMetric("ScoreKeeperNormal","GradeWeightHeld"), -- 6 - TapNoteScore_HitMine = THEME:GetMetric("ScoreKeeperNormal","GradeWeightHitMine"), -- -8 - HoldNoteScore_LetGo = THEME:GetMetric("ScoreKeeperNormal","GradeWeightLetGo"), -- 0 - HoldNoteScore_MissedHold = THEME:GetMetric("ScoreKeeperNormal","GradeWeightMissedHold"), - TapNoteScore_AvoidMine = 0, - TapNoteScore_CheckpointHit = THEME:GetMetric("ScoreKeeperNormal","GradeWeightCheckpointHit"), -- 0 - TapNoteScore_CheckpointMiss = THEME:GetMetric("ScoreKeeperNormal","GradeWeightCheckpointMiss"), -- 0 - isMSBased = 0, -- Flag so the calc knows which point table function to use - PointTable = {}, -}, - { -- Score Weights for percentage scores (EX oni) - TapNoteScore_W1 = THEME:GetMetric("ScoreKeeperNormal","PercentScoreWeightW1"), - TapNoteScore_W2 = THEME:GetMetric("ScoreKeeperNormal","PercentScoreWeightW2"), - TapNoteScore_W3 = THEME:GetMetric("ScoreKeeperNormal","PercentScoreWeightW3"), - TapNoteScore_W4 = THEME:GetMetric("ScoreKeeperNormal","PercentScoreWeightW4"), - TapNoteScore_W5 = THEME:GetMetric("ScoreKeeperNormal","PercentScoreWeightW5"), - TapNoteScore_Miss = THEME:GetMetric("ScoreKeeperNormal","PercentScoreWeightMiss"), - HoldNoteScore_Held = THEME:GetMetric("ScoreKeeperNormal","PercentScoreWeightHeld"), - TapNoteScore_HitMine = THEME:GetMetric("ScoreKeeperNormal","PercentScoreWeightHitMine"), - HoldNoteScore_LetGo = THEME:GetMetric("ScoreKeeperNormal","PercentScoreWeightLetGo"), - HoldNoteScore_MissedHold = THEME:GetMetric("ScoreKeeperNormal","PercentScoreWeightMissedHold"), - TapNoteScore_AvoidMine = 0, - TapNoteScore_CheckpointHit = THEME:GetMetric("ScoreKeeperNormal","PercentScoreWeightCheckpointHit"), - TapNoteScore_CheckpointMiss = THEME:GetMetric("ScoreKeeperNormal","PercentScoreWeightCheckpointMiss"), - isMSBased = 0, -- Flag so the calc knows which point table function to use - PointTable = {}, -}, - { -- Score Weights for MIGS score (terrible scoring system) - TapNoteScore_W1 = 3, - TapNoteScore_W2 = 2, - TapNoteScore_W3 = 1, - TapNoteScore_W4 = 0, - TapNoteScore_W5 = -4, - TapNoteScore_Miss = -8, - HoldNoteScore_Held = 6, - TapNoteScore_HitMine = -8, - HoldNoteScore_LetGo = 0, - HoldNoteScore_MissedHold = 0, - TapNoteScore_AvoidMine = 0, - TapNoteScore_CheckpointHit = 2, - TapNoteScore_CheckpointMiss = -8, - isMSBased = 0, - PointTable = {}, - }, - { -- Measurements for Wife - curveBegin = 18, -- Ms values below this point are assigned maxPointValue - curveEnd = 150, -- Ms values above this point are assigned maxPenalty - linPenaltyFac = 9.5, -- Linear strength of the curve (can be thought of as max penalty, see below) - expPenaltyFac = 2, -- Exponential strength of the curve. Wow. Such 2, much convenient, very prime even number. - maxPointValue = 2, -- Maximum point value per tap, same as MAX DP for consistency - maxPenalty =-7.5, -- Maximum penalty, can also be though of as maxPointValue - linPenaltyFac (minimum points) - TapNoteScore_W1 = 2, -- An alias for maxPointValue, for compatability with the multiscoring wrapper - TapNoteScore_Miss =-7.5, -- Non timed judgments are evaluated identically to the existing systems - HoldNoteScore_Held = 0, - TapNoteScore_HitMine =-7.5, - HoldNoteScore_LetGo = -6, - HoldNoteScore_MissedHold = -6, - TapNoteScore_AvoidMine = 0, - TapNoteScore_CheckpointHit = 0, - TapNoteScore_CheckpointMiss = 0, - isMSBased = 1, -- Flag so the calc knows which point table function to use - PointTable = {}, - }, - { -- Measurements for Waifu - curveBegin = 36, -- Ms values below this point are assigned maxPointValue - curveEnd = 180, -- Ms values above this point are assigned maxPenalty - linPenaltyFac = 9.5, -- Linear strength of the curve (can be thought of as max penalty, see below) - expPenaltyFac = 2, -- Exponential strength of the curve. Wow. Such 2, much convenient, very prime even number. - maxPointValue = 2, -- Maximum point value per tap, same as MAX DP for consistency - maxPenalty =-7.5, -- Maximum penalty, can also be though of as maxPointValue - linPenaltyFac (minimum points) - TapNoteScore_W1 = 2, -- An alias for maxPointValue, for compatability with the multiscoring wrapper - TapNoteScore_Miss =-7.5, -- Non timed judgments are evaluated identically to the existing systems - HoldNoteScore_Held = 0, - TapNoteScore_HitMine =-7.5, - HoldNoteScore_LetGo = -6, - HoldNoteScore_MissedHold = -6, - TapNoteScore_AvoidMine = 0, - TapNoteScore_CheckpointHit = 0, - TapNoteScore_CheckpointMiss = 0, - isMSBased = 1, -- Flag so the calc knows which point table function to use - PointTable = {}, - }, -} - --- **stuff that needs to go into options later** -local fallbackscoreType = 1 -- this indicates the theme to search for and return scoringTypes[x] scores if no scoringTypes[default] scores can be found -function getfallbackscoreType() - return fallbackscoreType -end --- end of stuff that needs to go into options later - --- returns a string of keys for a table -function showKeys(t) - local o={} - for k,v in pairs(t) do - o[#o+1]=k - end - return table.concat(o, ",") -- apparently theres an alias for this in this game who knew -end - --- same but returns a table (array) -function tableKeys(t) - local o={} - for k,v in pairs(t) do - o[#o+1]=k - end - return o -end - --- **Scoring functions** --- Need to integer encode everything later when new system is constructed --- edit: no i dont hahahahahhahahahaha it takes like 50mb on the disk in total, but this still should be reorganized --- fairly certain it's simply unnecessary to have so many nested tables -function buildPlayerScore(newScore, score, td, nrd) -- score == playerstagestats or a score loaded from the existing hs table - local function fillMetadata(s) -- td = deviance timing data, if nil we're converting from an existing score - s.DateAchieved = score:GetDate() - s.Grade = score:GetGrade() - s.MaxCombo = score:GetMaxCombo() - s.Mods = score:GetModifiers() - s.Rate = getRate(score) -- need to deal with this in a more rubust fashion eventually - s.JudgeAchievedOn = 0 -- put this in only if score is non converted - return(s) - end - local function fillTimedJudgments(s, score, td) -- These are all "taps" - if not td then - s.TimingData = "Converted" -- No timing data means we're converting from a pre-existing score - s.TimedJudgments = ms.convertJudgmentsToMs(score) --- aaa need to redo this eventually - s.JudgmentRow = "NA" - else - s.TimingData = ms.round(td,4) -- moving the int round into the freq function so digits can be preserved for the original data set, out to 4 for now - s.TimedJudgments = ms.freq(td) -- also considering removing abs from the above process to preserve early/late info--//And then frequency them - s.TimingData = table.concat(td, ",") - s.JudgmentRow = table.concat(nrd, ",") - end - s.TimedJudgments = ms.tableConcat(s.TimedJudgments) -- stringit, technically we don't need to but im testing the packer and unpacker - return(s) -- although there are probably libs that do this faster and without fail - end - local function fillNonTimedJudgments(s) - for i=1,#ms.nonTimedTaps do - s[ms.nonTimedTaps[i]] = score:GetTapNoteScore(ms.nonTimedTaps[i]) - end - for i=1,#ms.nonTimedHolds do - s[ms.nonTimedHolds[i]] = score:GetHoldNoteScore(ms.nonTimedHolds[i]) - end - return(s) - end - local function fillWindowJudgments(s) -- Original game judgments - for i=1, #ms.timedJudgments do - s[ms.timedJudgments[i]] = score:GetTapNoteScore(ms.timedJudgments[i]) - end - return s - end - local function fillAllOldJudgments(s) -- shorten this crap later - for i=1,#TapNoteScore do - s[TapNoteScore[i]] = score:GetTapNoteScore(TapNoteScore[i]) - end - for i=1,#HoldNoteScore do - s[HoldNoteScore[i]] = score:GetHoldNoteScore(HoldNoteScore[i]) - end - return(s) - end - local function batchCalcScores(s, td) -- Calculate score for each scoringType so we can save them all now and retrieve later - for i=1,3 do -- Standard scoring - s[#s+1] = calcPlayerScore(newScore, i) - end - if td then -- Only calculate ms based scores if we have timing data - for i=4,#scoringTypes do -- indexes got screwed up and ScoreTable[4] would return as nil despite existing in the file??? - s[#s+1] = calcPlayerScore(newScore, i) -- Should probably make this more flexible - end - end - return(s) - end - - if newScore.Metadata ~= nil then - return newScore - end - newScore = fillTimedJudgments(newScore, score, td) -- Fill in the original offset data and the freq table - newScore.Metadata = fillMetadata({}) -- General score metadata such as song title etc etc - newScore.NonTimedJudgments = fillNonTimedJudgments({}) -- Misses/mines etc - newScore.WindowJudgments = fillWindowJudgments({}) -- Might as well - newScore.AllOldJudgments = fillAllOldJudgments({}) -- oh fuck it - newScore.ScoreTable = batchCalcScores({}, td) -- Will contain percent values for all scoring types as well as the judge value calc'd under - --newScore.Msd = {} -- Future stuff maybe - if newScore.TimingData == "Converted" then -- can use the judgments to ms unpacker for recalcing later, don't need to save this - newScore.TimedJudgments = "Converted" - end - return newScore -end - --- A single function to calculate score percentages for any system whoa --- also super needs to be rewritten, whoa -function calcPlayerScore(score, scoreType) - local st = scoringTypes[scoreType] -- First grab the parameters table for whichever scoring system is being called - local tj = ms.split(score.TimedJudgments) -- Split the timed judgments string - local s = {} - local o = 0 - local ntj = score.NonTimedJudgments - - s.Percent = 0 -- actual % score - s.Points = {} -- various point values (player, total, etc) - s.JudgeCalc = GetTimingDifficulty() -- judge value the score was calculated under, not necessary for ms based systems but whatever for now - s.ParamsHash = SHA1StringHex(stringDatTable(st)) -- string hash for the scoring type parameters at the time of calculation//need to remember to - -- hash the function for ms scoring as well - -- Player points first - local pt = st.PointTable -- Get the point table for the current scoring system - for i=0, #tj do -- Multiply the recorded judgments against their point weight - o = o + (tj[i] * (pt[i] or pt[#pt])) -- Anything for i>#pt is assigned pt[#pt], the assumption here is that - end -- the final value of the curve is the same as the miss value (may not necessarily be true in the future) - -- **note: this is like, HILARIOUSLY inefficient for converting old scores, by a factor of 300 or more* - -- however this is a factor being applied to negligible calculation times - s.Points.playerTimedPoints = o -- Gotta make this score type specific eventually (prolly score.PointTable) //did this - for i=1, #ms.nonTimedScored do -- Now nontimed judgments (mines/misses/holds etc) - o = o + st[ms.nonTimedScored[i]] * ntj[ms.nonTimedScored[i]] - end - s.Points.playerTotalPoints = o - - -- Calculate the maximum attainable points for the given score/song and scoring system based on currently played (unused atm) - local function calcMaxPointsFromPlayed() - local taps = (st.TapNoteScore_W1 * (ms.tableSum(tj) + ntj.TapNoteScore_Miss)) - local holds = (st.HoldNoteScore_Held * (ntj.HoldNoteScore_Held + ntj.HoldNoteScore_MissedHold)) or 0 - return taps + holds - end - s.Points.maxTapPoints = st.TapNoteScore_W1 * getMaxNotes(PLAYER_1) -- need to remove dependency on getMaxNotes and getMaxHolds functions - s.Points.maxHoldPoints = st.HoldNoteScore_Held * getMaxHolds(PLAYER_1) - s.Points.maxTotalPoints = s.Points.maxTapPoints + s.Points.maxHoldPoints - s.Percent = notShit.round(s.Points.playerTotalPoints/s.Points.maxTotalPoints*100, 2) - if scoreType == 4 then - s.Percent = dafinalscoreYO - end - return s -end - --- **Functions related to the storage and retrieval of chart data and score data** --- whole section should be redone eventually -function formLink(x, y) x[y] = x[y] or {} return x[y] end -local curChart -local cutScore -function msTableChartUpdate(song, steps) - local function msTableChartInit(song, steps) - local function fillChartMeta(c) - c.SongTitle = song:GetDisplayMainTitle() - c.Duration = notShit.floor(song:GetLastSecond() - song:GetFirstSecond(), 2) - c.StepsDifficulty = steps:GetDifficulty() - c.RadarValues = {} - for i=1,#ms.RelevantRadars do -- Grabbing the relevant radar values i.e not that voltage garbage no one has cared about for almost 2 decades - c.RadarValues[ms.RelevantRadars[i]] = steps:GetRadarValues(PLAYER_1):GetValue(ms.RelevantRadars[i]) - end - return c - end - local function fillMsdData(c) - c.MsdDifficulty = "" - c.PrimaryFileType = "" - c.SecondaryFileType = "" - c.StaminaIntensity = "" - return c - end - local function fillFluxRecord(c) - c.OriginalBpmLine = "" - c.RedundanciesRemoved = "" - c.MsOffsets = "" - return c - end - - local c = {} - c.ChartMeta = fillChartMeta({}) -- General inforomatienne - --c.Msd = fillMsdData({}) -- Later stuff possibly - --c.FluxRecord = fillFluxRecord({}) -- Later stuff possibly - c.Scores = {} -- Scores housed here for now and by rate, too, wow - c.PlayerOptions = {} -- for AlwaysPlayMirror later - return(c) - end - - local chartKey = getCurKey() - local Chart - - if not doesCurChartTableExist() then - Chart = msTableChartInit(song, steps) - else - Chart = getCurChartByKey(chartKey) - end - - local needsave = convertOldHighScoreList(Chart.Scores) - curChart = Chart - if needsave == true then - saveCurChart() - end -end - -function saveCurChart() - if getCurKey() ~= "Invalid" then - File.Write("/wife/"..getCurKey()..".lua",DataDumperSlow(getCurChart())) - end -end - --- should probably find an alternative not involving loadstring since apparently its the most expensive option literally in the universe -function load_conf_file(fname) - local file= RageFileUtil.CreateRageFile() - local ret= {} - if file:Open(fname, 1) then - local data= loadstring(file:Read()) - setfenv(data, {}) - local success, data_ret= pcall(data) - if success then - ret= data_ret - end - file:Close() - end - file:destroy() - return ret -end - -function doesCurChartTableExist() - return FILEMAN:DoesFileExist("/wife/"..getCurKey()..".lua") -end - -function getCurChartByKey() -- Should split chart info and score info at some point - return load_conf_file("/wife/"..getCurKey()..".lua") -end - -function getCurChart() -- Should split chart info and score info at some point - return curChart -end - -function convertOldHighScoreList(Scores) -- should have a better system that checks whether or not scores need to be converted - local o = false - local oldScores = getScoreList(PLAYER_1) - for i=1, #oldScores do - local oldscore = oldScores[i] - local RateScores = formLink(Scores, getRate(oldscore)) - local scoreKey = fashionScoreKey(oldscore) - if not RateScores[scoreKey] then - o = true - local newScore = formLink(RateScores, scoreKey) -- newScore.ScoreTable == Chart.Scores[getRate(oldscore)][fashionScoreKey(oldscore)].ScoreTable) - newScore = buildPlayerScore(newScore, oldscore, nil) -- nil == converted score - end - end - return o -end - -function getCurScore() - return curScore -end - -function setCurScore(score) - curScore = score -end - -function getCurRateString() - local rate = GAMESTATE:GetSongOptions('ModsLevel_Song') - if rate == "" then - rate = "1.0x" - elseif rate == "2.0xMusic" then - rate = "2.0x" - end - rate = string.gsub(rate,"Music","") - return rate -end - -function getCurRateScores() - return getCurChart().Scores[getCurRateString()] -end \ No newline at end of file +-- gone \ No newline at end of file diff --git a/Themes/Til Death/Scripts/WifeKeys.lua b/Themes/Til Death/Scripts/WifeKeys.lua index 8910d66e8a..23c5397bf7 100644 --- a/Themes/Til Death/Scripts/WifeKeys.lua +++ b/Themes/Til Death/Scripts/WifeKeys.lua @@ -1,87 +1 @@ -local curScoreKey - -local difficultyconvert = { -- need to double check these - Beginner = "Novice", - Easy = "Light", - Medium = "Standard", - Hard = "Heavy", - Challenge = "Oni", -} - -function getCurKey() - return GAMESTATE:GetCurrentSteps(PLAYER_1):GetChartKey() -end - -function fashionChartKey(song, steps) - local rv = 3 - local d = string.sub(steps:GetDifficulty(), 12) -- not using that short string bullshit with 3 function calls of unnecessary overhead, gotta cut the fat where u can aite - - local s = song:GetSongFilePath() - s = string.gsub(s, "ssc$", "sm") -- so the thing is .ssc files are virtually identical to .sm files in terms of their abhorrent information:space ratio however one of the few aspects - s = File.Read(s) -- in which they are not identical happens to be the assumption of data organization that the below pattern is built on. What a surprise. - s = string.match(s, "single[^;]+"..d..".-(\n[^\r\n][^\r\n][^\r\n][^\r\n]\r.-);") or string.match(s, "single[^;]+"..difficultyconvert[d]..".-(\n[^\r\n][^\r\n][^\r\n][^\r\n]\r.-);") -- man patterns are cool - if not s then return nil end -- so for now forget .ssc files, afaik every .ssc generates a .sm as well and we'll just read that instead. really it makes sense to just use a file format - -- that isn't total garbage in the first place, but whatever - local sb = notShit.round(song:GetFirstBeat()) - local eb = notShit.round(song:GetLastBeat()) - local o,l,b,t,k = {},{},{},{},{} - local n - local j - - if not string.find(s, ",") then -- for those 1 meaure files... - for y in string.gmatch(s, '\n(....)\r') do - k[#k+1] = y - end - return "X"..SHA1StringHex(table.concat(k)) - end - - j = 0 - k = realsplit(s, ",") - for i=1,#k do - t.y,t.l = {},{} - n = 0 - if not string.find(k[i], '\n(....)\r') then break end -- stop at the last measure that actually has notes - for y in string.gmatch(k[i], '\n(....)\r') do -- i -really- didnt want to have to do that - n = n + 1 - if y ~= "0000" then - t.y[#t.y+1] = y - t.l[#t.l+1] = n - end - end - for ix=1, #t.y do - o[#o+1] = t.y[ix] - l[#l+1] = t.l[ix] + j - end - for ix=1, n, n/4 do - if intab(ix, t.l) then - b[#b+1] = t.y[getvalkey(ix, t.l)] - else - b[#b+1] = "0000" - end - end - j = j + n - end - - l.s,l.e = {},{} - for i=sb,eb do - l.e[#l.e+1] = song:GetTimingData():GetElapsedTimeFromBeat(i+1) - l.s[#l.s+1] = song:GetTimingData():GetElapsedTimeFromBeat(i) - end - - for i=1, math.min(eb-sb-1,#b-sb) do - o[#o+1] = b[i+sb]..":"..notShit.round(l.e[i]-l.s[i], rv) - end - - --File.Write(song:GetSongDir().."keyrecord.txt", table.concat(o, "\n")) - --File.Write(song:GetSongDir().."key.txt", "X"..SHA1StringHex(table.concat(o))) -- remove later - return "X"..SHA1StringHex(table.concat(o)) -end - -function fashionScoreKey(score) - curScoreKey = "S"..SHA1StringHex(score:GetDate()) - return curScoreKey -end - -function getCurScoreKey() - return curScoreKey -end \ No newline at end of file +-- gone \ No newline at end of file diff --git a/Themes/Til Death/Scripts/WifePointTables.lua b/Themes/Til Death/Scripts/WifePointTables.lua index cff02a9058..6407456961 100644 --- a/Themes/Til Death/Scripts/WifePointTables.lua +++ b/Themes/Til Death/Scripts/WifePointTables.lua @@ -1,70 +1 @@ --- **Stuff to do with point tables** -local CalculatedPointTableJudge -- So we know whether or not our point tables need to be updated - --- Only need to run on standard scoring systems (1:3) can write something to automate checking scoring methods later -function updatePointTables() - for i=1, 3 do - buildPointTable(scoringTypes[i]) - end - CalculatedPointTableJudge = GetTimingDifficulty() -end - --- Initialize point tables and spit the judge value calculated under -function initPointTables() - for i=1, #scoringTypes do - buildPointTable(scoringTypes[i]) - end - CalculatedPointTableJudge = GetTimingDifficulty() -end - -function isJudgeSame() - return CalculatedPointTableJudge == GetTimingDifficulty() -end - -function isScoreJudgeSame() -- For recalcing scores if judge values change, finish later - return 1 -- CalculatedPointTableJudge == GetTimingDifficulty() -end - --- For a given scoring type output a table for which k = msoffset and v = pointvalue (only for timed judgments) --- This is pretty inefficient however it's only done once per game load/judge switch -function buildPointTable(st) - local timedWindows = {22.5,45,90,135,180} -- kind of annoying but for now this'll be the solution to adjusting the eval display to account for judge value - local function StandardPointTables(pt) -- Wrapper for the existing scoring systems - local function judgeIt(x) -- Since we'll be storing ms values we can now recalc the same score on different judge values - for i=1, #timedWindows do -- not sure if there's a less obnoxious way to do this in lua - if x <= timedWindows[i] then -- this is like, really bad - return st[ms.timedJudgments[i]] - end - end - end - for i=0, timedWindows[5] do -- Build the point table, beginning at index 0 for 0ms out to 180 for now - pt[i] = judgeIt(i) - end - return pt - end - local function msScoringPointTables(pt) -- Don't technically need a wrapper for this however we can accomodate basic variants easily so we might as well - local function WifesCurves(x) -- should move to something based in normal distribution later - return notShit.floor(st.maxPointValue - (st.linPenaltyFac * math.pow((x - st.curveBegin)/ - (st.curveEnd - st.curveBegin), st.expPenaltyFac)), 2) -- little bit of a mouthful, explanation at ~ - end -- also should maybe use rond now that i have it - for i=0, st.curveBegin-1 do -- first the "free zone", or, any values for which max points are automatically assigned - pt[i] = st.maxPointValue - end - for i=st.curveBegin,st.curveEnd do -- then curve out to the minimum points, or max penalty (same thing) - pt[i] = WifesCurves(i) - end - return pt - end - local function adjustTimingWindows(ts) -- Adjust timing windows for the curent judge value (timing scale) - for i=1, #timedWindows do -- We'll be modifying the local that gets reconstructed each time - timedWindows[i] = timedWindows[i] * ts - end - end - - adjustTimingWindows(PREFSMAN:GetPreference("TimingWindowScale")) - if st.isMSBased == 1 then -- Initialize the point table based on scoring method - msScoringPointTables(st.PointTable) -- make this more elegant later - else - StandardPointTables(st.PointTable) - end -end \ No newline at end of file +--gone \ No newline at end of file diff --git a/Themes/Til Death/Scripts/WifeScores.lua b/Themes/Til Death/Scripts/WifeScores.lua index 04557edd2d..23c5397bf7 100644 --- a/Themes/Til Death/Scripts/WifeScores.lua +++ b/Themes/Til Death/Scripts/WifeScores.lua @@ -1,145 +1 @@ --- later on much of this should be conducted at the point of score saving and the results stored in the chart table itself --- so we can just grab a "score display priority" table from the chart upon loading it - -local isfallbackscoreType - -function isFallbackScoreType() - return isfallbackscoreType -end - - --- Grab only the scores for the current rate -function getCurRateScores() - return getCurChart().Scores[getCurRateString()] -end - --- Functions involving grabbing highscores under varying circumstances -function getAlternativeBestRateScores(scoreType) - local all = getCurChart().Scores - local rates = tableKeys(all) - local o - table.sort(rates) - - for i=#rates, 1, -1 do - o = getRateScoresBestScore(all[rates[i]], scoreType, "Grade_Failed") - if o then return o end - end - - o = getRateScoresBestScore(getCurRateScores(), scoreType, nil) - if o then return o end - - for i=#rates, 1, -1 do - o = getRateScoresBestScore(all[rates[i]], scoreType, nil) - if o then return o end - end - return nil -end - -function getRateScoresBestScore(RateScores, scoreType, filter) -- filter by grade - isfallbackscoreType = false - if not RateScores then return nil end - local n, o = -math.huge - for k,v in pairs(RateScores) do - if v.Metadata.Grade ~= filter then - v = v.ScoreTable[scoreType] - if v and v.Percent > n then - n, o = v.Percent, k - end - end - end - - if not o then - for k,v in pairs(RateScores) do - if v.Metadata.Grade ~= filter then - v = v.ScoreTable[getfallbackscoreType()] - if v and v.Percent > n then - n, o = v.Percent, k - end - if not o then - return nil - end - end - end - isfallbackscoreType = true - end - return RateScores[o] -end - -function getCurRateScoresBestScore(scoreType) -- not used atm - isfallbackscoreType = false - local RateScores = getCurRateScores() - - if not RateScores then return nil end - local n, o = -math.huge - for k,v in pairs(RateScores) do - v = v.ScoreTable[scoreType] - if v and v.Percent > n then - n, o = v.Percent, k - end - end - - if not o then - for k,v in pairs(RateScores) do - v = v.ScoreTable[getfallbackscoreType()] - if v and v.Percent > n then - n, o = v.Percent, k - end - if not o then - isfallbackscoreType = nil - return nil - end - end - isfallbackscoreType = true - end - return RateScores[o] -end - --- for making the music wheel show all grades... one day... the dream... -local gradeTiers = { - Grade_Tier01 = 0, - Grade_Tier02 = 1, - Grade_Tier03 = 2, - Grade_Tier04 = 3, - Grade_Tier05 = 4, - Grade_Tier06 = 5, - Grade_Tier07 = 6, - Grade_Tier08 = 7, - Grade_Tier09 = 8, - Grade_Tier10 = 9, - Grade_Tier11 = 10, - Grade_Tier12 = 11, - Grade_Tier13 = 12, - Grade_Tier14 = 13, - Grade_Tier15 = 14, - Grade_Tier16 = 15, - Grade_Tier17 = 16, - Grade_Tier18 = 17, - Grade_Tier19 = 18, - Grade_Tier20 = 19, - Grade_Failed = 20 -} - -function getBestGradeBySong(song) - if not song then return nil end -- shouldn't ever be the case - - local highest = 21 - local indexScore - local grade = "Grade_None" - local temp = 0 - local scoretable - local profile = GetPlayerOrMachineProfile(PLAYER_1) - local steps4k = song:GetStepsByStepsType('StepsType_Dance_Single') - - for ix=1,#steps4k do - scoretable = profile:GetHighScoreList(song,steps4k[ix]):GetHighScores() - for i=1, #scoretable do - indexScore = scoretable[i] - temp = gradeTiers[indexScore:GetGrade()] or 21 - if temp <= highest and isScoreValid(PLAYER_1,steps4k[ix],indexScore) then - grade = getScoreGrade(indexScore) - highest = temp - end - end - end - return grade -end \ No newline at end of file +-- gone \ No newline at end of file diff --git a/Themes/Til Death/Scripts/WifeSearch.lua b/Themes/Til Death/Scripts/WifeSearch.lua index d6079b3f07..23c5397bf7 100644 --- a/Themes/Til Death/Scripts/WifeSearch.lua +++ b/Themes/Til Death/Scripts/WifeSearch.lua @@ -1,75 +1 @@ --- turns out its a million times easier to do this internally wow who knew - --- local allSongs --- local allTitles = {} --- local allArtists = {} --- local songSearchResult = {nil, nil} --- local prevResultSong - - --- function changePreviewMusic(song) -- jesus christ did i really have to do this, like, you guys couldn't just have built this into the setsong function????? - -- SOUND:StopMusic() - -- SOUND:PlayMusicPart(song:GetPreviewMusicPath(),song:GetSampleStart(),song:GetSampleLength(),1,0.3,true,true,true) - -- prevResultSong = song --- end - --- function setSongFromSearch(resultSong) -- should probably move more of the stuff in songsearch.lua here since this stuff is here anyway - -- if resultSong then -- im really starting to not like this - -- for i=1, 2 do - -- SCREENMAN:GetTopScreen():GetMusicWheel():SelectSong(resultSong) - -- end - - -- GAMESTATE:SetCurrentSong(resultSong) - -- GAMESTATE:SetCurrentSteps(PLAYER_1, resultSong:GetAllSteps()[1]) - -- if not prevResultSong then - -- changePreviewMusic(resultSong) - -- elseif prevResultSong ~= resultSong and prevResultSong:GetMainTitle() ~= resultSong:GetMainTitle() then -- probably irritating if you're switching between a few results for the same song trying to figure out which version you want to play - -- changePreviewMusic(resultSong) -- and the music keeps resetting, granted, this isn't going to catch the same songs with slightly different titles but oh well - -- end -- maybe disable this if i find people identify which chart they want to play by the preview music point - -- end - -- MESSAGEMAN:Broadcast("RefreshSearchResults") --- end - --- function setSongFromCompletedSearch() - -- for i=1, 2 do - -- SCREENMAN:GetTopScreen():GetMusicWheel():SelectSong(songSearchResult[1]) - -- end - -- GAMESTATE:SetCurrentSong(songSearchResult[1]) - -- GAMESTATE:SetCurrentSteps(PLAYER_1, songSearchResult[2]) - -- local MusicWheel = SCREENMAN:GetTopScreen():GetChild("MusicWheel"); - -- MusicWheel:Move(-1); - -- MusicWheel:Move(1); - -- MusicWheel:Move(0); --- end - --- function storeSongSearchResult(song, steps) -- either a song and steps object if the search was concluded through start or nil if the search was cancelled through back - -- songSearchResult = {song, steps} --- end - --- function recallSearchResult() - -- return songSearchResult[1] --- end - --- function storedSearchInfo() - -- return allSongs --- end - --- function storeSearchInfo(songs) - -- allSongs = songs - -- for i=1, #allSongs do - -- allTitles[i] = allSongs[i]:GetMainTitle():lower() - -- allArtists[i] = allSongs[i]:GetDisplayArtist():lower() - -- end --- end - --- function getAllSongs() - -- return allSongs --- end - --- function getAllTitles() - -- return allTitles --- end - --- function getAllArtists() - -- return allArtists --- end \ No newline at end of file +-- gone \ No newline at end of file diff --git a/Themes/Til Death/Scripts/WifeSundries.lua b/Themes/Til Death/Scripts/WifeSundries.lua index b033f13238..23e482feee 100644 --- a/Themes/Til Death/Scripts/WifeSundries.lua +++ b/Themes/Til Death/Scripts/WifeSundries.lua @@ -5,47 +5,6 @@ ms = {} -- *Values and stuff* -- Make the distinction between ms timed and non-timed judgments -ms.timedJudgments = { - "TapNoteScore_W1", - "TapNoteScore_W2", - "TapNoteScore_W3", - "TapNoteScore_W4", - "TapNoteScore_W5", -} - --- J4 assumed, used for conversion -ms.timedWindows = { - 22.5, - 45, - 90, - 135, - 180, -} - --- Non timed notes and holds -ms.nonTimedTaps = { - "TapNoteScore_Miss", - "TapNoteScore_HitMine", - "TapNoteScore_AvoidMine", - "TapNoteScore_None", - "TapNoteScore_CheckpointMiss", - "TapNoteScore_CheckpointHit", -} -ms.nonTimedHolds = { - "HoldNoteScore_Held", - "HoldNoteScore_MissedHold", - "HoldNoteScore_LetGo", - "HoldNoteScore_None", -} - --- Nontimed judgments that are scored -ms.nonTimedScored ={ - "TapNoteScore_Miss", - "TapNoteScore_HitMine", - "HoldNoteScore_Held", - "HoldNoteScore_MissedHold", - "HoldNoteScore_LetGo", -} -- Radar values people on earth actually care about ms.RelevantRadarsShort = { @@ -108,71 +67,7 @@ function ms.type(m) SCREENMAN:SystemMessage(type(m)) end --- Calculates ms frequency of the rounded timing data -function ms.freq(td) - local c - local o = ms.freqTableInit(200) -- oops.... - for i=1,#td do -- moved the rounding to integer values here so digits can be preserved in the original data - c = notShit.round(math.abs(td[i])) - o[c] = o[c] + 1 - end - return o -end - --- Reset tables that begin at 0 rather than 1 -function ms.tableReset(t) - local o = t - for i=0, #t do - o[i] = 0 - end - return o -end - --- Wrapper for full timing data tables -function ms.round(t, y) - for i=1,#t do - t[i] = notShit.round(t[i], y) - end - return(t) -end - --- **pretty sure like 90% of this is unnecessary** --- Same as table.concat but doesnt blow up because there's a 0 index -function ms.tableConcat(t) -- need to deal with this better later - local z = t[0] - t[0] = nil - local o = z..","..table.concat(t, ",") - t[0] = z - return o -end - --- Unpack ms frequency strings where the index must begin at 0 -function ms.split(s) - local o = {} - local function split(i,j) - j = string.find(s,",",j+1) - if not j then - o[#o+1] = string.sub(s,i+1) - return o - end - o[#o+1] = string.sub(s,i+1,j-1) - return split(j,j) - end - local j = string.find(s,",") - o[0] = string.sub(s,1,j-1) - return split(j,j) -end - --- Init frequency tables to n, or the max ms to be tracked (for now it will be 180) -function ms.freqTableInit(n) - local o = {} - for i=0,n do - o[i] = 0 - end - return o -end - --- Table sum designed for ms tables (optional starting position, default to 0, and absolute value flag) +--- Table sum designed for ms tables (optional starting position, default to 0, and absolute value flag) function ms.tableSum(t, n, abs) local o = 0 for i=n or 0, #t do @@ -195,7 +90,7 @@ function wifeMean(t) return o/c end -function wifeStd(t) +function wifeSd(t) local u = wifeMean(t) local u2 = 0 for i=1,#t do @@ -217,20 +112,13 @@ function wifeRange(t) return x,y end --- for converting old scores -function ms.convertJudgmentsToMs(score) - local timedWindows = {22.5,45,90,135,180} -- k this is getting opague to the point of disaster... the conversion process assumes everything is j4 however the point tables are calculated - local function adjustTimingWindows(ts) -- on current judge which means we need to assume it by using the current point tables, either that or a j4 conversion table is initiated and - for i=1, #timedWindows do -- permanent (this is probably the best solution but w.e), another solution is just to write a general function for conversion that isn't garbage - timedWindows[i] = timedWindows[i] * ts -- like all of the existing ones.... +function IndexOf(t, x) + for k,v in pairs(t) do + if v == x then + return k end end - adjustTimingWindows(PREFSMAN:GetPreference("TimingWindowScale")) - local o = ms.freqTableInit(200) -- Only grab timed judgments (marv-boo) - for i=1, #ms.timedJudgments do -- Since we don't know what judge level the scores were achieved on we have to assume j4 - o[math.floor(timedWindows[i])] = getScoreTapNoteScore(score,ms.timedJudgments[i]) -- Assign them to the max integer ms value for their respective windows - end - return o + return nil end -- **Very slight efficiency rewrites** @@ -251,27 +139,43 @@ function notShit.round(x, y) return math.floor(x*y+0.5)/y end --- more bullshit, pretty sure theres something that does this already but its faster to write it than find it (only used for hashing scoring prefs) -function stringDatTable(t) - local o = {} - for k,v in pairs(t) do - if type(v) ~= "table" then -- should probably move the point tables to a separate object so i dont need to do this - o[#o+1] = k..v - end - end - return table.concat(o) -end - --- old msd rate thing --- Grabs the currently selected rate as a string in the form of "r.rx" +-- Grabs the currently selected rate as a string in the form of "r.rrx" while dropping trailing 0s function getCurRateString() - return string.format("%.1f",getCurRateValue()).."x" + return string.format("%.2f", getCurRateValue()):gsub("%.?0+$", "").."x" end function getCurRateDisplayString() - return string.format("%.1f",getCurRateValue()).."xMusic" + local o = getCurRateString() + if o == "1x" then + o = "1.0x" + elseif o == "2x" then + o = "2.0x" + end + return o.."Music" end function getCurRateValue() return notShit.round(GAMESTATE:GetSongOptionsObject('ModsLevel_Current'):MusicRate(),3) +end + +function getCurKey() + return GAMESTATE:GetCurrentSteps(PLAYER_1):GetChartKey() +end + +-- returns a string of keys for a table +function showKeys(t) + local o={} + for k,v in pairs(t) do + o[#o+1]=k + end + return table.concat(o, ",") -- apparently theres an alias for this in this game who knew +end + +-- same but returns a table (array) +function tableKeys(t) + local o={} + for k,v in pairs(t) do + o[#o+1]=k + end + return o end \ No newline at end of file diff --git a/src/RageDisplay_D3D.cpp b/src/RageDisplay_D3D.cpp index 16cec5de2a..81ef4cce15 100644 --- a/src/RageDisplay_D3D.cpp +++ b/src/RageDisplay_D3D.cpp @@ -1441,8 +1441,8 @@ void RageDisplay_D3D::UpdateTexture( D3DSURFACE_DESC desc; pTex->GetLevelDesc(0, &desc); - ASSERT( xoffset+width <= int(desc.Width) ); - ASSERT( yoffset+height <= int(desc.Height) ); + ASSERT( xoffset+width <= static_cast(desc.Width) ); + ASSERT( yoffset+height <= static_cast(desc.Height) ); // Copy bits int texpixfmt;