Skip to content

Commit

Permalink
more filter reorganization/updates
Browse files Browse the repository at this point in the history
  • Loading branch information
MinaciousGrace committed Jan 13, 2017
1 parent d974464 commit 14fd529
Show file tree
Hide file tree
Showing 6 changed files with 22 additions and 18 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -91,7 +91,7 @@ local f = Def.ActorFrame{
LoadFont("Common Large")..{
InitCommand=cmd(xy,frameX+frameWidth/2,175;zoom,textzoom;halign,0),
SetCommand=function(self)
self:settext("Max Rate: "..1)
self:settext("Max Rate: 1.5x")
end,
},
LoadFont("Common Large")..{
Expand All @@ -103,7 +103,7 @@ local f = Def.ActorFrame{
LoadFont("Common Large")..{
InitCommand=cmd(xy,frameX+frameWidth/2,175 + spacingY*2;zoom,textzoom;halign,0),
SetCommand=function(self)
self:settext("Highest SS: ".."False")
self:settext("Highest SS Only : ".."Off")
end,
},
}
Expand Down
9 changes: 9 additions & 0 deletions src/GameState.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -176,7 +176,11 @@ GameState::GameState() :
// Don't reset yet; let the first screen do it, so we can use PREFSMAN and THEME.
//Reset();


// filter stuff - mina
ZERO( SkillsetFilters );
MaxFilterRate = 1.5;


// Register with Lua.
{
Expand Down Expand Up @@ -3238,6 +3242,10 @@ class LunaGameState: public Luna<GameState>
p->m_autogen_fargs[si]= v;
COMMON_RETURN_SELF;
}
static int SetMaxFilterRate(T* p, lua_State* L) {
p->MaxFilterRate = FArg(1);
return 1;
}

LunaGameState()
{
Expand Down Expand Up @@ -3366,6 +3374,7 @@ class LunaGameState: public Luna<GameState>
ADD_METHOD( SetStepsForEditMode );
ADD_METHOD( GetAutoGenFarg );
ADD_METHOD( SetAutoGenFarg );
ADD_METHOD( SetMaxFilterRate );
}
};

Expand Down
4 changes: 3 additions & 1 deletion src/GameState.h
Original file line number Diff line number Diff line change
Expand Up @@ -243,8 +243,10 @@ class GameState
int GetLoadingCourseSongIndex() const;


// mina was here - mina
// mina was here to drop in some temporary(?) filter things that need to persist - mina
float SkillsetFilters[NUM_Skillset];
float MaxFilterRate;
void SetMaxFilterRate(float v) { MaxFilterRate; }

// State Info used during gameplay

Expand Down
13 changes: 2 additions & 11 deletions src/MusicWheel.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -533,22 +533,18 @@ void MusicWheel::FilterBySearch(vector<Song*>& inv, RString findme) {
size_t fart = findme.find("artist=");
size_t faux = findme.find("author=");
size_t fitty = findme.find("title=");
size_t jack = findme.find("jack=");
RString findfart = "";
RString findfaux = "";
RString findfitty = "";
int findjack = -1.f;

if (fart != findme.npos || faux != findme.npos || fitty != findme.npos || jack != findme.npos) {
if (fart != findme.npos || faux != findme.npos || fitty != findme.npos) {
super_search = true;
if (fart != findme.npos)
findfart = findme.substr(fart + 7, findme.find(fart, ';') - fart);
if (faux != findme.npos)
findfaux = findme.substr(faux + 7, findme.find(faux, ';') - faux);
if (fitty != findme.npos)
findfitty = findme.substr(fitty + 6, findme.find(fitty, ';') - fitty);
if (jack != findme.npos)
findjack = StringToInt(findme.substr(jack + 5, findme.find(jack, ';') - jack));
}

vector<Song*> tmp;
Expand Down Expand Up @@ -585,11 +581,6 @@ void MusicWheel::FilterBySearch(vector<Song*>& inv, RString findme) {
if (gimmie != fittyS.npos)
tmp.emplace_back(inv[i]);
}
if (findjack != -1.f) {
float jackR = inv[i]->GetHighestSkillsetAllSteps(3);
if(jackR > findjack)
tmp.emplace_back(inv[i]);
}
}
}

Expand All @@ -607,7 +598,7 @@ void MusicWheel::FilterBySkillsets(vector<Song*>& inv) {
bool addsong = false;
FOREACH_ENUM(Skillset, ss) {
if (SkillsetFilters[ss] > 0.f) {
float val = inv[i]->GetHighestSkillsetAllSteps(static_cast<int>(ss));
float val = inv[i]->GetHighestOfSkillsetAllSteps(static_cast<int>(ss), GAMESTATE->MaxFilterRate);
if (val > SkillsetFilters[ss])
addsong = addsong || true;
}
Expand Down
6 changes: 3 additions & 3 deletions src/Song.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1732,12 +1732,12 @@ float Song::GetPreviewStartSeconds() const
return 0.0f;
}

float Song::GetHighestSkillsetAllSteps(int x) {
float Song::GetHighestOfSkillsetAllSteps(int x, float rate) {
float o = 0.f;
vector<Steps*> vsteps = GetAllSteps();
FOREACH(Steps*, vsteps, steps)
if ((*steps)->GetMSD(1, x) > o)
o = (*steps)->GetMSD(1, x);
if ((*steps)->GetMSD(rate, x) > o)
o = (*steps)->GetMSD(rate, x);
return o;
}

Expand Down
4 changes: 3 additions & 1 deletion src/Song.h
Original file line number Diff line number Diff line change
Expand Up @@ -273,7 +273,9 @@ class Song
float GetPreviewStartSeconds() const;

// how have i not jammed anything here yet - mina
float GetHighestSkillsetAllSteps(int x);

// Get the highest value for a specific skillset across all the steps objects for the song at a given rate
float GetHighestOfSkillsetAllSteps(int x, float rate);

// For loading only:
bool m_bHasMusic, m_bHasBanner, m_bHasBackground;
Expand Down

0 comments on commit 14fd529

Please sign in to comment.