Skip to content

Commit

Permalink
define timingscales in gamestate to expose it to lua and "remove" j1-3
Browse files Browse the repository at this point in the history
  • Loading branch information
MinaciousGrace committed Apr 17, 2020
1 parent 1b04748 commit 7467944
Show file tree
Hide file tree
Showing 3 changed files with 18 additions and 6 deletions.
12 changes: 6 additions & 6 deletions src/Etterna/Screen/Options/ScreenOptionsMasterPrefs.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -450,12 +450,12 @@ InputDebounceTime(int& sel, bool to_sel, ConfOption const* conf_option)
static void
TimingWindowScale(int& sel, bool ToSel, const ConfOption* pConfOption)
{
// StepMania 5 values (implemented 2008/03/12)
// const float mapping[] = { 2.0f,1.66f,1.33f,1.00f,0.75f,0.50f,0.25f };

// StepMania 3.9 and 4.0 values:
const float mapping[] = { 1.50f, 1.33f, 1.16f, 1.00f, 0.84f,
0.66f, 0.50f, 0.33f, 0.20f };
// we are no longer supporting j1-3, they will be set to 1.f like j4
// to avoid issues with expected array sizes that i do not want to debug
auto& ts = GAMESTATE->timingscales;
float mapping[9]; // hardcodered because ide yell at me
for (size_t i = 0; i < ts.size(); ++i)
mapping[i] = ts[i];
MoveMap(sel, pConfOption, ToSel, mapping, ARRAYLEN(mapping));
}

Expand Down
6 changes: 6 additions & 0 deletions src/Etterna/Singletons/GameState.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1935,6 +1935,11 @@ class LunaGameState : public Luna<GameState>
p->TogglePracticeModeSafe(BArg(1));
return 0;
}
static int GetTimingScales(T* p, lua_State* L)
{
LuaHelpers::CreateTableFromArray(p->timingscales, L);
return 1;
}

DEFINE_METHOD(GetEtternaVersion, GetEtternaVersion())
DEFINE_METHOD(IsPracticeMode, IsPracticeMode())
Expand Down Expand Up @@ -2029,6 +2034,7 @@ class LunaGameState : public Luna<GameState>
ADD_METHOD(GetGameplayMode);
ADD_METHOD(IsPracticeMode);
ADD_METHOD(SetPracticeMode);
ADD_METHOD(GetTimingScales);
}
};

Expand Down
6 changes: 6 additions & 0 deletions src/Etterna/Singletons/GameState.h
Original file line number Diff line number Diff line change
Expand Up @@ -214,6 +214,12 @@ class GameState
int GetLoadingCourseSongIndex() const;

RString GetEtternaVersion() { return "0.69.0"; }

// is this the best place for this? it's not exactly a pref, and we shouldn't
// be copying and pasting these values everywhere as needed j1-j4 are now all 1.f
// to remove j1-3 without having to mess with expected array sizes in other areas
// yes i know this is lazy
vector<float> timingscales = { 1.00f, 1.00f, 1.00f, 1.00f, 0.84f, 0.66f, 0.50f, 0.33f, 0.20f };
bool isplaylistcourse = false;
bool IsPlaylistCourse() { return isplaylistcourse; }
bool CountNotesSeparately();
Expand Down

0 comments on commit 7467944

Please sign in to comment.