Skip to content

Commit

Permalink
Remove legacy replay stuff
Browse files Browse the repository at this point in the history
  • Loading branch information
nico-abram committed Apr 19, 2020
1 parent 6a2283d commit 59cb2d4
Show file tree
Hide file tree
Showing 4 changed files with 0 additions and 82 deletions.
5 changes: 0 additions & 5 deletions src/Etterna/Models/Songs/SongOptions.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,6 @@ SongOptions::Init()
m_bStaticBackground = false;
m_bRandomBGOnly = false;
m_bSaveScore = true;
m_bSaveReplay = false; // don't save replays by default?
}

void
Expand All @@ -52,7 +51,6 @@ SongOptions::Approach(const SongOptions& other, float fDeltaSeconds)
DO_COPY(m_bStaticBackground);
DO_COPY(m_bRandomBGOnly);
DO_COPY(m_bSaveScore);
DO_COPY(m_bSaveReplay);
#undef APPROACH
#undef DO_COPY
}
Expand Down Expand Up @@ -198,8 +196,6 @@ SongOptions::FromOneModString(const RString& sOneMod, RString& sErrorOut)
m_bRandomBGOnly = on;
else if (sBit == "savescore")
m_bSaveScore = on;
else if (sBit == "savereplay")
m_bSaveReplay = on;
else
return false;

Expand All @@ -222,7 +218,6 @@ SongOptions::operator==(const SongOptions& other) const
COMPARE(m_bStaticBackground);
COMPARE(m_bRandomBGOnly);
COMPARE(m_bSaveScore);
COMPARE(m_bSaveReplay);
#undef COMPARE
return true;
}
Expand Down
1 change: 0 additions & 1 deletion src/Etterna/Models/Songs/SongOptions.h
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,6 @@ class SongOptions
bool m_bStaticBackground{ false };
bool m_bRandomBGOnly{ false };
bool m_bSaveScore{ true };
bool m_bSaveReplay{ false };

/**
* @brief Set up the SongOptions with reasonable defaults.
Expand Down
75 changes: 0 additions & 75 deletions src/Etterna/Screen/Gameplay/ScreenGameplay.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1726,10 +1726,6 @@ ScreenGameplay::HandleScreenMessage(const ScreenMessage SM)
{
replaying = true;
}
// only save replays if the player chose to
if (GAMESTATE->m_SongOptions.GetCurrent().m_bSaveReplay && !syncing &&
!replaying)
SaveReplay();

if (syncing)
ScreenSaveSync::PromptSaveSync(SM_GoToPrevScreen);
Expand Down Expand Up @@ -1809,77 +1805,6 @@ ScreenGameplay::GetPlayerInfo(PlayerNumber pn)
return NULL;
}

void
ScreenGameplay::SaveReplay()
{
/* Replay data TODO:
* Add more player information (?)
* Add AutoGen flag if steps were autogen?
* Add proper steps hash?
* Add modifiers used
* Add date played, machine played on, etc.
* Hash of some stuff to validate data (see Profile)
*/
Profile* pTempProfile = PROFILEMAN->GetProfile(PLAYER_1);

XNode* p = new XNode("ReplayData");
// append version number (in case the format changes)
p->AppendAttr("Version", 0);

// song information node
SongID songID;
songID.FromSong(GAMESTATE->m_pCurSong);
XNode* pSongInfoNode = songID.CreateNode();
pSongInfoNode->AppendChild("Title",
GAMESTATE->m_pCurSong->GetDisplayFullTitle());
pSongInfoNode->AppendChild("Artist",
GAMESTATE->m_pCurSong->GetDisplayArtist());
p->AppendChild(pSongInfoNode);

// steps information
StepsID stepsID;
stepsID.FromSteps(GAMESTATE->m_pCurSteps);
XNode* pStepsInfoNode = stepsID.CreateNode();
// hashing = argh
// pStepsInfoNode->AppendChild("StepsHash",
// stepsID.ToSteps(GAMESTATE->m_pCurSong,false)->GetHash());
p->AppendChild(pStepsInfoNode);

// player information node (rival data sup)
XNode* pPlayerInfoNode = new XNode("Player");
pPlayerInfoNode->AppendChild("DisplayName", pTempProfile->m_sDisplayName);
pPlayerInfoNode->AppendChild("Guid", pTempProfile->m_sGuid);
p->AppendChild(pPlayerInfoNode);

// the timings.
p->AppendChild(m_vPlayerInfo.m_pPlayer->GetNoteData().CreateNode());

// Find a file name for the replay
vector<RString> files;
GetDirListing("Save/Replays/replay*", files, false, false);
sort(files.begin(), files.end());

// Files should be of the form "replay#####.xml".
int iIndex = 0;

for (int i = files.size() - 1; i >= 0; --i) {
static Regex re("^replay([0-9]{5})\\....$");
vector<RString> matches;
if (!re.Compare(files[i], matches))
continue;

ASSERT(matches.size() == 1);
iIndex = StringToInt(matches[0]) + 1;
break;
}

RString sFileName = ssprintf("replay%05d.xml", iIndex);

XmlFileUtil::SaveToFile(p, "Save/Replays/" + sFileName);
SAFE_DELETE(p);
return;
}

const float
ScreenGameplay::GetSongPosition()
{
Expand Down
1 change: 0 additions & 1 deletion src/Etterna/Screen/Gameplay/ScreenGameplay.h
Original file line number Diff line number Diff line change
Expand Up @@ -108,7 +108,6 @@ class ScreenGameplay : public ScreenWithMenuElements
void SongFinished();
virtual void SaveStats();
virtual void StageFinished(bool bBackedOut);
void SaveReplay();
bool AllAreFailing();

void RestartGameplay();
Expand Down

0 comments on commit 59cb2d4

Please sign in to comment.