Skip to content

Commit

Permalink
create framework for skillset specific difficulties
Browse files Browse the repository at this point in the history
  • Loading branch information
MinaciousGrace committed Dec 19, 2016
1 parent 201ef16 commit 39559e0
Show file tree
Hide file tree
Showing 5 changed files with 60 additions and 8 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -314,7 +314,7 @@ t[#t+1] = LoadFont("Common Large") .. {
BeginCommand=cmd(queuecommand,"Set"),
SetCommand=function(self)
if song then
local meter = GAMESTATE:GetCurrentSteps(PLAYER_1):GetMSD(getCurRateValue())
local meter = GAMESTATE:GetCurrentSteps(PLAYER_1):GetMSD(getCurRateValue(), 0)
self:settextf("%05.2f",meter)
self:diffuse(byDifficultyMeter(meter))
else
Expand All @@ -325,6 +325,54 @@ t[#t+1] = LoadFont("Common Large") .. {
CurrentRateChangedMessageCommand=cmd(queuecommand,"Set"),
}

t[#t+1] = LoadFont("Common Large") .. {
InitCommand=cmd(xy,frameX+158,frameY-150;halign,0.5;zoom,0.6;maxwidth,110/0.6),
BeginCommand=cmd(queuecommand,"Set"),
SetCommand=function(self)
if song then
local meter = GAMESTATE:GetCurrentSteps(PLAYER_1):GetMSD(getCurRateValue(), 1)
self:settextf("Speed: %05.2f",meter)
self:diffuse(byDifficultyMeter(meter))
else
self:settext("")
end
end,
RefreshChartInfoMessageCommand=cmd(queuecommand,"Set"),
CurrentRateChangedMessageCommand=cmd(queuecommand,"Set"),
}

t[#t+1] = LoadFont("Common Large") .. {
InitCommand=cmd(xy,frameX+158,frameY-120;halign,0.5;zoom,0.6;maxwidth,110/0.6),
BeginCommand=cmd(queuecommand,"Set"),
SetCommand=function(self)
if song then
local meter = GAMESTATE:GetCurrentSteps(PLAYER_1):GetMSD(getCurRateValue(), 2)
self:settextf("Stam %05.2f",meter)
self:diffuse(byDifficultyMeter(meter))
else
self:settext("")
end
end,
RefreshChartInfoMessageCommand=cmd(queuecommand,"Set"),
CurrentRateChangedMessageCommand=cmd(queuecommand,"Set"),
}

t[#t+1] = LoadFont("Common Large") .. {
InitCommand=cmd(xy,frameX+158,frameY-90;halign,0.5;zoom,0.6;maxwidth,110/0.6),
BeginCommand=cmd(queuecommand,"Set"),
SetCommand=function(self)
if song then
local meter = GAMESTATE:GetCurrentSteps(PLAYER_1):GetMSD(getCurRateValue(), 3)
self:settextf("Jack %05.2f",meter)
self:diffuse(byDifficultyMeter(meter))
else
self:settext("")
end
end,
RefreshChartInfoMessageCommand=cmd(queuecommand,"Set"),
CurrentRateChangedMessageCommand=cmd(queuecommand,"Set"),
}

-- Song duration
t[#t+1] = LoadFont("Common Large") .. {
InitCommand=cmd(xy,(capWideScale(get43size(384),384))+62,SCREEN_BOTTOM-85;visible,true;halign,1;zoom,capWideScale(get43size(0.6),0.6);maxwidth,capWideScale(get43size(360),360)/capWideScale(get43size(0.45),0.45)),
Expand Down
Binary file modified extern/MinaCalc/MinaCalc.lib
Binary file not shown.
8 changes: 4 additions & 4 deletions src/NotesLoaderSSC.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -526,10 +526,11 @@ void SetChartKey(StepsTagInfo& info) {

void strsplit(vector<float>& o, RString& s, size_t i) {
size_t j = s.find(",", i);
if (i != s.npos) {
if (j != s.npos) {
o.push_back(StringToFloat(s.substr(i, j - 1)));
strsplit(o, s, j + 1);
} else
o.push_back(StringToFloat(s.substr(i, j - 1)));
strsplit(o, s, j);
}
}

void SetMSDValues(StepsTagInfo& info) {
Expand All @@ -538,7 +539,6 @@ void SetMSDValues(StepsTagInfo& info) {
// Optimize by calling those only once instead of multiple times inside the loop.
auto params = (*info.params);
auto size = params.params.size();

// Start from index 1
for (size_t i = 1; i <= size; i++) {
vector<float> diffs;
Expand Down
3 changes: 2 additions & 1 deletion src/Steps.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -819,8 +819,9 @@ class LunaSteps: public Luna<Steps>
static int GetMSD(T* p, lua_State *L)
{
float rate = FArg(1);
int index = IArg(2);
CLAMP(rate, 0.7f, 2.f);
lua_pushnumber(L, p->GetMSD(rate));
lua_pushnumber(L, p->GetMSD(rate, index));
return 1;
}

Expand Down
7 changes: 5 additions & 2 deletions src/Steps.h
Original file line number Diff line number Diff line change
Expand Up @@ -173,12 +173,15 @@ class Steps
RString ChartKey = "Invalid";
RString ChartKeyRecord = "Invalid";
RString GetChartKey() const { return ChartKey; }
MinaSD stuffnthings = { { 0.f },{ 0.f } ,{ 0.f },{ 0.f },{ 0.f },{ 0.f },{ 0.f },{ 0.f },{ 0.f },{ 0.f },{ 0.f },{ 0.f },{ 0.f },{ 0.f },{ 0.f },{ 0.f },{ 0.f },{ 0.f },{ 0.f },{ 0.f },{ 0.f } };
vector<float> thestuffs = { 0.f,0.f,0.f,0.f };
MinaSD stuffnthings = { thestuffs, thestuffs, thestuffs, thestuffs, thestuffs, thestuffs, thestuffs, thestuffs, thestuffs, thestuffs, thestuffs, thestuffs, thestuffs, thestuffs, thestuffs, thestuffs, thestuffs, thestuffs, thestuffs, thestuffs, thestuffs };
RString GetChartKeyRecord() const;
void SetChartKey(const RString &k) { ChartKey = k; }
void SetAllMSD(const MinaSD &msd) { stuffnthings = msd; }
MinaSD GetAllMSD() const { return stuffnthings; }
float GetMSD(float x) const { return stuffnthings[lround(x*10)][0]; }

// prolly needs an enum or something idk - mina
float GetMSD(float x, int i) const { return stuffnthings[lround(x*10)][i]; }

/* This is a reimplementation of the lua version of the script to generate chart keys, except this time
using the notedata stored in game memory immediately after reading it than parsing it using lua. - Mina */
Expand Down

0 comments on commit 39559e0

Please sign in to comment.