Files
itgmania212121/Themes/default/Graphics/Player judgment/default.lua
T

209 lines
7.4 KiB
Lua
Raw Normal View History

2010-01-26 21:00:30 -06:00
local c;
local player = Var "Player";
2010-07-23 18:57:48 -05:00
local bShowProtiming = GetUserPrefB("UserPrefProtiming" .. ToEnumShortString(player) );
2010-08-05 18:13:34 -05:00
local function MakeAverage( t )
local sum = 0;
for i=1,#t do
sum = sum + t[i];
end
return sum / #t
end
local tTotalJudgments = {};
2010-01-26 21:00:30 -06:00
local JudgeCmds = {
TapNoteScore_W1 = THEME:GetMetric( "Judgment", "JudgmentW1Command" );
TapNoteScore_W2 = THEME:GetMetric( "Judgment", "JudgmentW2Command" );
TapNoteScore_W3 = THEME:GetMetric( "Judgment", "JudgmentW3Command" );
TapNoteScore_W4 = THEME:GetMetric( "Judgment", "JudgmentW4Command" );
TapNoteScore_W5 = THEME:GetMetric( "Judgment", "JudgmentW5Command" );
TapNoteScore_Miss = THEME:GetMetric( "Judgment", "JudgmentMissCommand" );
};
local ProtimingCmds = {
TapNoteScore_W1 = THEME:GetMetric( "Protiming", "ProtimingW1Command" );
TapNoteScore_W2 = THEME:GetMetric( "Protiming", "ProtimingW2Command" );
TapNoteScore_W3 = THEME:GetMetric( "Protiming", "ProtimingW3Command" );
TapNoteScore_W4 = THEME:GetMetric( "Protiming", "ProtimingW4Command" );
TapNoteScore_W5 = THEME:GetMetric( "Protiming", "ProtimingW5Command" );
TapNoteScore_Miss = THEME:GetMetric( "Protiming", "ProtimingMissCommand" );
};
2010-08-05 18:13:34 -05:00
local AverageCmds = {
Pulse = THEME:GetMetric( "Protiming", "AveragePulseCommand" );
};
2010-01-26 21:00:30 -06:00
local TNSFrames = {
TapNoteScore_W1 = 0;
TapNoteScore_W2 = 1;
TapNoteScore_W3 = 2;
TapNoteScore_W4 = 3;
TapNoteScore_W5 = 4;
TapNoteScore_Miss = 5;
};
local t = Def.ActorFrame {};
t[#t+1] = Def.ActorFrame {
LoadActor(THEME:GetPathG("Judgment","Normal")) .. {
Name="Judgment";
InitCommand=cmd(pause;visible,false);
OnCommand=THEME:GetMetric("Judgment","JudgmentOnCommand");
ResetCommand=cmd(finishtweening;stopeffect;visible,false);
};
2010-07-23 18:57:48 -05:00
LoadFont("Combo Numbers") .. {
2010-01-26 21:00:30 -06:00
Name="ProtimingDisplay";
Text="";
InitCommand=cmd(visible,false);
OnCommand=THEME:GetMetric("Protiming","ProtimingOnCommand");
ResetCommand=cmd(finishtweening;stopeffect;visible,false);
};
2010-08-05 18:13:34 -05:00
LoadFont("Common Normal") .. {
Name="ProtimingAverage";
Text="";
InitCommand=cmd(visible,false);
OnCommand=THEME:GetMetric("Protiming","AverageOnCommand");
ResetCommand=cmd(finishtweening;stopeffect;visible,false);
};
2010-08-22 12:32:59 -05:00
Def.Quad {
Name="ProtimingGraphBG";
InitCommand=cmd(visible,false;y,32;zoomto,192,16);
ResetCommand=cmd(finishtweening;diffusealpha,0.8;visible,false);
OnCommand=cmd(diffuse,Color("Black");diffusetopedge,color("0.1,0.1,0.1,1");diffusealpha,0.8;shadowlength,2;);
};
2010-09-04 11:32:26 -05:00
Def.Quad {
Name="ProtimingGraphWindowW3";
InitCommand=cmd(visible,false;y,32;zoomto,192-4,16-4);
ResetCommand=cmd(finishtweening;diffusealpha,1;visible,false);
OnCommand=cmd(diffuse,GameColor.Judgment["JudgmentLine_W3"];);
};
Def.Quad {
Name="ProtimingGraphWindowW2";
InitCommand=cmd(visible,false;y,32;zoomto,scale(PREFSMAN:GetPreference("TimingWindowSecondsW2"),0,PREFSMAN:GetPreference("TimingWindowSecondsW3"),0,192-4),16-4);
ResetCommand=cmd(finishtweening;diffusealpha,1;visible,false);
OnCommand=cmd(diffuse,GameColor.Judgment["JudgmentLine_W2"];);
};
Def.Quad {
Name="ProtimingGraphWindowW1";
InitCommand=cmd(visible,false;y,32;zoomto,scale(PREFSMAN:GetPreference("TimingWindowSecondsW1"),0,PREFSMAN:GetPreference("TimingWindowSecondsW3"),0,192-4),16-4);
ResetCommand=cmd(finishtweening;diffusealpha,1;visible,false);
OnCommand=cmd(diffuse,GameColor.Judgment["JudgmentLine_W1"];);
};
2010-08-22 12:32:59 -05:00
Def.Quad {
Name="ProtimingGraphUnderlay";
InitCommand=cmd(visible,false;y,32;zoomto,192-4,16-4);
2010-09-04 11:32:26 -05:00
ResetCommand=cmd(finishtweening;diffusealpha,0.25;visible,false);
OnCommand=cmd(diffuse,Color("Black");diffusealpha,0.25);
2010-08-22 12:32:59 -05:00
};
Def.Quad {
Name="ProtimingGraphFill";
InitCommand=cmd(visible,false;y,32;zoomto,0,16-4;horizalign,left;);
ResetCommand=cmd(finishtweening;diffusealpha,1;visible,false);
2010-09-04 11:32:26 -05:00
OnCommand=cmd(diffuse,Color("Red"););
2010-08-22 12:32:59 -05:00
};
Def.Quad {
Name="ProtimingGraphAverage";
InitCommand=cmd(visible,false;y,32;zoomto,2,7;);
2010-09-27 22:41:11 -07:00
ResetCommand=cmd(finishtweening;diffusealpha,0.85;visible,false);
OnCommand=cmd(diffuse,Color("Orange");diffusealpha,0.85);
2010-08-22 12:32:59 -05:00
};
Def.Quad {
Name="ProtimingGraphCenter";
InitCommand=cmd(visible,false;y,32;zoomto,2,16-4;);
ResetCommand=cmd(finishtweening;diffusealpha,1;visible,false);
OnCommand=cmd(diffuse,Color("White");diffusealpha,1);
};
2010-01-26 21:00:30 -06:00
InitCommand = function(self)
c = self:GetChildren();
end;
JudgmentMessageCommand=function(self, param)
if param.Player ~= player then return end;
if param.HoldNoteScore then return end;
2010-07-25 12:15:00 -05:00
2010-01-26 21:00:30 -06:00
local iNumStates = c.Judgment:GetNumStates();
local iFrame = TNSFrames[param.TapNoteScore];
if not iFrame then return end
if iNumStates == 12 then
iFrame = iFrame * 2;
if not param.Early then
iFrame = iFrame + 1;
end
end
2010-08-14 19:22:44 -05:00
local fTapNoteOffset = param.TapNoteOffset;
2010-07-25 12:15:00 -05:00
if param.HoldNoteScore then
2010-08-14 19:22:44 -05:00
fTapNoteOffset = 1;
2010-07-25 12:15:00 -05:00
else
2010-08-14 19:22:44 -05:00
fTapNoteOffset = param.TapNoteOffset;
2010-07-25 12:15:00 -05:00
end
2010-08-14 19:22:44 -05:00
if param.TapNoteScore == 'TapNoteScore_Miss' then
fTapNoteOffset = 1;
2010-08-17 00:40:02 -05:00
bUseNegative = true;
2010-08-14 19:22:44 -05:00
else
2010-08-17 00:40:02 -05:00
-- fTapNoteOffset = fTapNoteOffset;
bUseNegative = false;
2010-08-14 19:22:44 -05:00
end;
2010-09-27 22:41:11 -07:00
if fTapNoteOffset ~= 1 then
-- we're safe, you can push the values
tTotalJudgments[#tTotalJudgments+1] = bUseNegative and fTapNoteOffset or math.abs( fTapNoteOffset );
end
2010-08-14 19:22:44 -05:00
2010-01-26 21:00:30 -06:00
self:playcommand("Reset");
2010-07-23 18:57:48 -05:00
c.Judgment:visible( not bShowProtiming );
2010-01-26 21:00:30 -06:00
c.Judgment:setstate( iFrame );
JudgeCmds[param.TapNoteScore](c.Judgment);
2010-07-23 18:57:48 -05:00
c.ProtimingDisplay:visible( bShowProtiming );
c.ProtimingDisplay:settextf("%i",math.abs(fTapNoteOffset * 1000));
2010-01-26 21:00:30 -06:00
ProtimingCmds[param.TapNoteScore](c.ProtimingDisplay);
2010-08-05 18:13:34 -05:00
c.ProtimingAverage:visible( bShowProtiming );
2010-08-14 19:22:44 -05:00
c.ProtimingAverage:settextf("%.2f%%",clamp(100 - MakeAverage( tTotalJudgments ) * 1000 ,0,100));
2010-08-05 18:13:34 -05:00
AverageCmds['Pulse'](c.ProtimingAverage);
2010-08-22 12:32:59 -05:00
c.ProtimingGraphBG:visible( bShowProtiming );
c.ProtimingGraphUnderlay:visible( bShowProtiming );
2010-09-04 11:32:26 -05:00
c.ProtimingGraphWindowW3:visible( bShowProtiming );
c.ProtimingGraphWindowW2:visible( bShowProtiming );
c.ProtimingGraphWindowW1:visible( bShowProtiming );
2010-08-22 12:32:59 -05:00
c.ProtimingGraphFill:visible( bShowProtiming );
c.ProtimingGraphFill:finishtweening();
2010-09-04 11:32:26 -05:00
c.ProtimingGraphFill:decelerate(1/60);
-- c.ProtimingGraphFill:zoomtowidth( clamp(fTapNoteOffset * 188,-188/2,188/2) );
c.ProtimingGraphFill:zoomtowidth( clamp(
scale(
fTapNoteOffset,
0,PREFSMAN:GetPreference("TimingWindowSecondsW3"),
0,188/2),
-188/2,188/2)
);
2010-08-22 12:32:59 -05:00
c.ProtimingGraphAverage:visible( bShowProtiming );
2010-09-04 11:32:26 -05:00
c.ProtimingGraphAverage:zoomtowidth( clamp(
scale(
MakeAverage( tTotalJudgments ),
0,PREFSMAN:GetPreference("TimingWindowSecondsW3"),
0,188),
0,188)
);
-- c.ProtimingGraphAverage:zoomtowidth( clamp(MakeAverage( tTotalJudgments ) * 1880,0,188) );
2010-08-22 12:32:59 -05:00
c.ProtimingGraphCenter:visible( bShowProtiming );
(cmd(sleep,2;linear,0.5;diffusealpha,0))(c.ProtimingGraphBG);
(cmd(sleep,2;linear,0.5;diffusealpha,0))(c.ProtimingGraphUnderlay);
2010-09-04 11:32:26 -05:00
(cmd(sleep,2;linear,0.5;diffusealpha,0))(c.ProtimingGraphWindowW3);
(cmd(sleep,2;linear,0.5;diffusealpha,0))(c.ProtimingGraphWindowW2);
(cmd(sleep,2;linear,0.5;diffusealpha,0))(c.ProtimingGraphWindowW1);
2010-08-22 12:32:59 -05:00
(cmd(sleep,2;linear,0.5;diffusealpha,0))(c.ProtimingGraphFill);
(cmd(sleep,2;linear,0.5;diffusealpha,0))(c.ProtimingGraphAverage);
(cmd(sleep,2;linear,0.5;diffusealpha,0))(c.ProtimingGraphCenter);
2010-01-26 21:00:30 -06:00
end;
2010-08-22 12:32:59 -05:00
2010-01-26 21:00:30 -06:00
};
return t;