Skip to content

Commit

Permalink
enable mirror if a chart is flagged as permamirror
Browse files Browse the repository at this point in the history
  • Loading branch information
MinaciousGrace committed May 28, 2017
1 parent 8791e91 commit c0c1333
Show file tree
Hide file tree
Showing 4 changed files with 20 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,10 @@
local modslevel = topscreen == "ScreenEditOptions" and "ModsLevel_Stage" or "ModsLevel_Preferred"
local playeroptions = GAMESTATE:GetPlayerState(PLAYER_1):GetPlayerOptions(modslevel)
playeroptions:Mini( 2 - playerConfig:get_data(pn_to_profile_slot(PLAYER_1)).ReceptorSize/50 )
local profile = PROFILEMAN:GetProfile(PLAYER_1)
if profile:IsCurrentChartPermamirror() then -- turn on mirror if song is flagged as perma mirror
playeroptions:Mirror( true )
end

local bgtype = playerConfig:get_data(pn_to_profile_slot(PLAYER_1)).BackgroundType
local songoptions = GAMESTATE:GetSongOptionsObject('ModsLevel_Preferred')
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,8 @@ t[#t+1] = Def.Actor{
alreadybroadcasted = true
end,
CurrentSongChangedMessageCommand=function(self)
if playerConfig:get_data(pn_to_profile_slot(PLAYER_1)).OneShotMirror then -- This will disable mirror when switching songs if OneShotMirror is enabled
-- This will disable mirror when switching songs if OneShotMirror is enabled or if permamirror is flagged on the chart (it is enabled if so in screengameplayunderlay/default)
if playerConfig:get_data(pn_to_profile_slot(PLAYER_1)).OneShotMirror or profile:IsCurrentChartPermamirror() then
local modslevel = topscreen == "ScreenEditOptions" and "ModsLevel_Stage" or "ModsLevel_Preferred"
local playeroptions = GAMESTATE:GetPlayerState(PLAYER_1):GetPlayerOptions(modslevel)
playeroptions:Mirror( false )
Expand Down
15 changes: 13 additions & 2 deletions src/Profile.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -2512,7 +2512,7 @@ class LunaProfile : public Luna<Profile>
return 1;
}

DEFINE_METHOD(GetGUID, m_sGuid);
DEFINE_METHOD(GetGUID, m_sGuid);
static int GetAllGoals(T* p, lua_State *L) {
lua_newtable(L);
int idx = 0;
Expand All @@ -2525,7 +2525,7 @@ class LunaProfile : public Luna<Profile>
tsg.PushSelf(L);
lua_rawseti(L, -2, idx + 1);
idx++;
}
}
}
return 1;
}
Expand All @@ -2539,6 +2539,16 @@ class LunaProfile : public Luna<Profile>
return 1;
}

static int IsCurrentChartPermamirror(T* p, lua_State *L) {
bool o = false;
const string& cck = GAMESTATE->m_pCurSteps[PLAYER_1]->ChartKey;
FOREACH(string, p->PermaMirrorCharts, ck)
if (*ck == cck)
o = true;

lua_pushboolean(L, o);
return 1;
}
LunaProfile()
{
ADD_METHOD( AddScreenshot );
Expand Down Expand Up @@ -2584,6 +2594,7 @@ class LunaProfile : public Luna<Profile>
ADD_METHOD( GetAllGoals );
ADD_METHOD(GetIgnoreStepCountCalories);
ADD_METHOD(CalculateCaloriesFromHeartRate);
ADD_METHOD(IsCurrentChartPermamirror);
}
};

Expand Down
1 change: 1 addition & 0 deletions src/Profile.h
Original file line number Diff line number Diff line change
Expand Up @@ -257,6 +257,7 @@ class Profile
int m_iNumStagesPassedByGrade[NUM_Grade];

// if anymore of these are added they should be enum'd to reduce copy pasta -mina
// and also should be sets
void AddToFavorites(const string& ck) { FavoritedCharts.emplace_back(ck); }
void AddToPermaMirror(const string& ck) { PermaMirrorCharts.emplace_back(ck); }
void RemoveFromFavorites(const string& ck);
Expand Down

0 comments on commit c0c1333

Please sign in to comment.