Skip to content

Commit

Permalink
Fix wrong bpm issues and improve rate display (eval view/replay)
Browse files Browse the repository at this point in the history
This doesn't unset the rate, though. Maybe we can figure that out later.
  • Loading branch information
poco0317 authored Sep 6, 2018
1 parent b4debb0 commit dbe67c7
Showing 1 changed file with 24 additions and 1 deletion.
25 changes: 24 additions & 1 deletion src/ScreenSelectMusic.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1872,21 +1872,33 @@ class LunaScreenSelectMusic : public Luna<ScreenSelectMusic>

static int PlayReplay(T* p, lua_State *L)
{
// get the highscore from lua and make the AI load it
HighScore* hs = Luna<HighScore>::check(L, 1);
PlayerAI::SetScoreData(hs);

GAMESTATE->m_SongOptions.GetPreferred().m_fMusicRate = hs->GetMusicRate();
// set the heck out of the current rate to make sure everything runs correctly
float scoreRate = hs->GetMusicRate();
GAMESTATE->m_SongOptions.GetSong().m_fMusicRate = scoreRate;
GAMESTATE->m_SongOptions.GetCurrent().m_fMusicRate = scoreRate;
GAMESTATE->m_SongOptions.GetPreferred().m_fMusicRate = scoreRate;
MESSAGEMAN->Broadcast("RateChanged");

// lock the game into replay mode and GO
GamePreferences::m_AutoPlay.Set(PC_REPLAY);
p->SelectCurrent(PLAYER_1);
return 1;
}

static int ShowEvalScreenForScore(T* p, lua_State *L)
{
// get the highscore from lua and fake it to the most recent score
HighScore* hs = Luna<HighScore>::check(L, 1);
SCOREMAN->PutScoreAtTheTop(hs->GetScoreKey());

// set to replay mode to disable score saving
GamePreferences::m_AutoPlay.Set(PC_REPLAY);

// construct the current stage stats and stuff to the best of our ability
StageStats ss;
ss.Init();
auto score = SCOREMAN->GetMostRecentScore();
Expand Down Expand Up @@ -1914,6 +1926,17 @@ class LunaScreenSelectMusic : public Luna<ScreenSelectMusic>
ss.m_vpPlayedSongs.emplace_back(GAMESTATE->m_pCurSong);
STATSMAN->m_CurStageStats = ss;
STATSMAN->m_vPlayedStageStats.emplace_back(ss);

// set the rate so the MSD and rate display doesnt look weird
// this might confuse the player after leaving eval screen because of the new rate
// but whatever, for now
float scoreRate = hs->GetMusicRate();
GAMESTATE->m_SongOptions.GetSong().m_fMusicRate = scoreRate;
GAMESTATE->m_SongOptions.GetCurrent().m_fMusicRate = scoreRate;
GAMESTATE->m_SongOptions.GetPreferred().m_fMusicRate = scoreRate;
MESSAGEMAN->Broadcast("RateChanged");

// go
SCREENMAN->SetNewScreen("ScreenEvaluationNormal");
return 1;
}
Expand Down

0 comments on commit dbe67c7

Please sign in to comment.