Skip to content

Commit

Permalink
Set failoff for all replays
Browse files Browse the repository at this point in the history
(galaxy brain)
  • Loading branch information
poco0317 committed Dec 4, 2018
1 parent 2a6d3ec commit a16f36d
Show file tree
Hide file tree
Showing 5 changed files with 59 additions and 2 deletions.
3 changes: 2 additions & 1 deletion src/GameManager.cpp
@@ -1,4 +1,4 @@
#include "global.h"
#include "global.h"
#include "Foreach.h"
#include "Game.h"
#include "GameConstantsAndTypes.h"
Expand Down Expand Up @@ -3227,6 +3227,7 @@ GameManager::GameManager()
m_fPreviousRate = 1.f;
m_sModsToReset;
m_vTurnsToReset;
m_iPreviousFail;
// Register with Lua.
{
Lua* L = LUA->Get();
Expand Down
3 changes: 2 additions & 1 deletion src/GameManager.h
@@ -1,4 +1,4 @@
/** @brief GameManager - Manages Games and Styles. */
/** @brief GameManager - Manages Games and Styles. */

#ifndef GAMEMANAGER_H
#define GAMEMANAGER_H
Expand Down Expand Up @@ -63,6 +63,7 @@ class GameManager
float m_fPreviousRate;
RString m_sModsToReset;
vector<RString> m_vTurnsToReset;
FailType m_iPreviousFail;

// Lua
void PushSelf(lua_State* L);
Expand Down
11 changes: 11 additions & 0 deletions src/ScreenEvaluation.cpp
Expand Up @@ -852,10 +852,21 @@ ScreenEvaluation::HandleMenuStart()
GAMESTATE->m_pPlayerState[PLAYER_1]->m_PlayerOptions.GetCurrent().FromString(mods);
GAMESTATE->m_pPlayerState[PLAYER_1]->m_PlayerOptions.GetPreferred().FromString(mods);
*/
FailType failreset = GAMEMAN->m_iPreviousFail;
GAMESTATE->m_pPlayerState[PLAYER_1]
->m_PlayerOptions.GetSong()
.m_FailType = failreset;
GAMESTATE->m_pPlayerState[PLAYER_1]
->m_PlayerOptions.GetCurrent()
.m_FailType = failreset;
GAMESTATE->m_pPlayerState[PLAYER_1]
->m_PlayerOptions.GetPreferred()
.m_FailType = failreset;
GAMESTATE->m_SongOptions.GetSong().m_fMusicRate = oldRate;
GAMESTATE->m_SongOptions.GetCurrent().m_fMusicRate = oldRate;
GAMESTATE->m_SongOptions.GetPreferred().m_fMusicRate = oldRate;
GAMEMAN->m_bResetModifiers = false;

const vector<RString> oldturns = GAMEMAN->m_vTurnsToReset;
if (GAMEMAN->m_bResetTurns) {
GAMESTATE->m_pPlayerState[PLAYER_1]
Expand Down
26 changes: 26 additions & 0 deletions src/ScreenGameplay.cpp
Expand Up @@ -1770,6 +1770,19 @@ ScreenGameplay::Update(float fDeltaTime)
oldRate;
GAMESTATE->m_SongOptions.GetPreferred()
.m_fMusicRate = oldRate;
FailType failreset = GAMEMAN->m_iPreviousFail;
GAMESTATE->m_pPlayerState[PLAYER_1]
->m_PlayerOptions.GetSong()
.m_FailType =
failreset;
GAMESTATE->m_pPlayerState[PLAYER_1]
->m_PlayerOptions.GetCurrent()
.m_FailType =
failreset;
GAMESTATE->m_pPlayerState[PLAYER_1]
->m_PlayerOptions.GetPreferred()
.m_FailType =
failreset;
GAMEMAN->m_bResetModifiers = false;
GAMEMAN->m_sModsToReset = "";
MESSAGEMAN->Broadcast("RateChanged");
Expand Down Expand Up @@ -2119,6 +2132,19 @@ ScreenGameplay::Input(const InputEventPlus& input)
oldRate;
GAMESTATE->m_SongOptions.GetPreferred().m_fMusicRate =
oldRate;
FailType failreset = GAMEMAN->m_iPreviousFail;
GAMESTATE->m_pPlayerState[PLAYER_1]
->m_PlayerOptions.GetSong()
.m_FailType =
failreset;
GAMESTATE->m_pPlayerState[PLAYER_1]
->m_PlayerOptions.GetCurrent()
.m_FailType =
failreset;
GAMESTATE->m_pPlayerState[PLAYER_1]
->m_PlayerOptions.GetPreferred()
.m_FailType =
failreset;
GAMEMAN->m_bResetModifiers = false;
GAMEMAN->m_sModsToReset = "";
MESSAGEMAN->Broadcast("RateChanged");
Expand Down
18 changes: 18 additions & 0 deletions src/ScreenSelectMusic.cpp
Expand Up @@ -1822,6 +1822,20 @@ class LunaScreenSelectMusic : public Luna<ScreenSelectMusic>
}
GAMEMAN->m_bResetTurns = true;
GAMEMAN->m_vTurnsToReset = oldTurns;
GAMEMAN->m_iPreviousFail = GAMESTATE->m_pPlayerState[PLAYER_1]
->m_PlayerOptions.GetSong()
.m_FailType;

// REALLY BAD way to set fail off for a replay
GAMESTATE->m_pPlayerState[PLAYER_1]
->m_PlayerOptions.GetSong()
.m_FailType = FailType_Off;
GAMESTATE->m_pPlayerState[PLAYER_1]
->m_PlayerOptions.GetCurrent()
.m_FailType = FailType_Off;
GAMESTATE->m_pPlayerState[PLAYER_1]
->m_PlayerOptions.GetPreferred()
.m_FailType = FailType_Off;

// lock the game into replay mode and GO
LOG->Trace("Viewing replay for score key %s",
Expand Down Expand Up @@ -1900,6 +1914,10 @@ class LunaScreenSelectMusic : public Luna<ScreenSelectMusic>
GAMESTATE->m_SongOptions.GetCurrent().m_fMusicRate = scoreRate;
GAMESTATE->m_SongOptions.GetPreferred().m_fMusicRate = scoreRate;
MESSAGEMAN->Broadcast("RateChanged");

GAMEMAN->m_iPreviousFail = GAMESTATE->m_pPlayerState[PLAYER_1]
->m_PlayerOptions.GetSong()
.m_FailType;

// go
LOG->Trace("Viewing evaluation screen for score key %s",
Expand Down

0 comments on commit a16f36d

Please sign in to comment.