Skip to content

Commit

Permalink
Merge branch 'develop' of https://github.com/etternagame/etterna into…
Browse files Browse the repository at this point in the history
… develop
  • Loading branch information
nico-abram committed Jul 24, 2018
2 parents 5de14f1 + adfccb9 commit 5266735
Show file tree
Hide file tree
Showing 11 changed files with 11 additions and 219 deletions.
2 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -107,3 +107,5 @@ tests/*.err

nsis_strings_temp\.inc
BatchRecalc/*

Xcode/Info\.Etterna\.plist
2 changes: 1 addition & 1 deletion src/DownloadManager.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ static Preference<RString> serverURL("UploadServerAPIURL", "https://api.etternao
static Preference<unsigned int> automaticSync("automaticScoreSync", 1);
static Preference<unsigned int> downloadPacksToAdditionalSongs("downloadPacksToAdditionalSongs", 0);
static const string TEMP_ZIP_MOUNT_POINT = "/@temp-zip/";
static const string CLIENT_DATA_KEY = "1C563ADA30BEDBFAABF885AF47E58BE012B21D421B421F3469A9898D0C6D6906";
static const string CLIENT_DATA_KEY = "6EE45A0D6997622C67A6064AFAE8D93A8CAEE575D17D5E16DA3EDBFC8D7D2477";
static const string DL_DIR = SpecialFiles::CACHE_DIR + "Downloads/";

size_t write_memory_buffer(void *contents, size_t size, size_t nmemb, void *userp)
Expand Down
6 changes: 2 additions & 4 deletions src/HighScore.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -291,10 +291,9 @@ XNode *HighScoreImpl::CreateNode() const
pNode->AppendChild("NoChordCohesion", bNoChordCohesion);
pNode->AppendChild("EtternaValid", bEtternaValid);
if (!uploaded.empty()) {
XNode *pServerNode = new XNode("Servers");
XNode *pServerNode = pNode->AppendChild("Servers");
for (auto server : uploaded)
pServerNode->AppendChild("server", server);
pNode->AppendChild(pServerNode);
}
if (vOffsetVector.size() > 1) {
pNode->AppendChild("Offsets", OffsetsToString(vOffsetVector));
Expand Down Expand Up @@ -360,10 +359,9 @@ XNode *HighScoreImpl::CreateEttNode() const {
pNode->AppendChild("DateTime", dateTime.GetString());
pNode->AppendChild("TopScore", TopScore);
if (!uploaded.empty()) {
XNode *pServerNode = new XNode("Servers");
XNode *pServerNode = pNode->AppendChild("Servers");
for (auto server : uploaded)
pServerNode->AppendChild("server", server);
pNode->AppendChild(pServerNode);
}

XNode* pTapNoteScores = pNode->AppendChild("TapNoteScores");
Expand Down
15 changes: 0 additions & 15 deletions src/NoteData.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -30,17 +30,6 @@ void NoteData::SetNumTracks( int iNewNumTracks )
CalcNumTracksLCD();
}

bool NoteData::IsComposite() const
{
return false;
for( int track = 0; track < GetNumTracks(); ++track )
{
FOREACHM_CONST( int, TapNote, m_TapNotes[track], tn )
if( tn->second.pn != PLAYER_INVALID )
return true;
}
}

// Clear (rowBegin,rowEnd).
void NoteData::ClearRangeForTrack( int rowBegin, int rowEnd, int iTrack )
{
Expand Down Expand Up @@ -790,10 +779,6 @@ int NoteData::GetNumFakes( int iStartIndex, int iEndIndex ) const

bool NoteData::IsPlayer1(const int track, const TapNote &tn) const
{
if (this->IsComposite())
{
return tn.pn == PLAYER_1;
}
return track < (this->GetNumTracks() / 2);
}

Expand Down
1 change: 0 additions & 1 deletion src/NoteData.h
Original file line number Diff line number Diff line change
Expand Up @@ -183,7 +183,6 @@ class NoteData

int GetNumTracks() const { return m_TapNotes.size(); }
void SetNumTracks( int iNewNumTracks );
bool IsComposite() const;
bool operator==( const NoteData &nd ) const { return m_TapNotes == nd.m_TapNotes; }
bool operator!=( const NoteData &nd ) const { return m_TapNotes != nd.m_TapNotes; }

Expand Down
110 changes: 3 additions & 107 deletions src/NoteDataUtil.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -496,7 +496,7 @@ void NoteDataUtil::LoadFromETTNoteDataString( NoteData& out, const RString &sSMN
out.RevalidateATIs(vector<int>(), false);
}

void NoteDataUtil::LoadFromSMNoteDataString( NoteData &out, const RString &sSMNoteData_, bool bComposite )
void NoteDataUtil::LoadFromSMNoteDataString( NoteData &out, const RString &sSMNoteData_)
{
// Load note data
RString sSMNoteData;
Expand All @@ -520,31 +520,7 @@ void NoteDataUtil::LoadFromSMNoteDataString( NoteData &out, const RString &sSMNo
int iNumTracks = out.GetNumTracks();
out.Init();
out.SetNumTracks( iNumTracks );

if( !bComposite )
{
LoadFromSMNoteDataStringWithPlayer( out, sSMNoteData, 0, sSMNoteData.size(),
PLAYER_INVALID, iNumTracks );
return;
}

int start = 0, size = -1;

vector<NoteData> vParts;
FOREACH_PlayerNumber( pn )
{
// Split in place.
split( sSMNoteData, "&", start, size, false );
if( unsigned(start) == sSMNoteData.size() )
break;
vParts.push_back( NoteData() );
NoteData &nd = vParts.back();

nd.SetNumTracks( iNumTracks );
LoadFromSMNoteDataStringWithPlayer( nd, sSMNoteData, start, size, pn, iNumTracks );
}
CombineCompositeNoteData( out, vParts );
out.RevalidateATIs(vector<int>(), false);
LoadFromSMNoteDataStringWithPlayer( out, sSMNoteData, 0, sSMNoteData.size(), PLAYER_INVALID, iNumTracks );
}

void NoteDataUtil::InsertHoldTails( NoteData &inout )
Expand Down Expand Up @@ -578,8 +554,6 @@ void NoteDataUtil::GetSMNoteDataString( const NoteData &in, RString &sRet )
vector<NoteData> parts;
float fLastBeat = -1.0f;

SplitCompositeNoteData( in, parts );

FOREACH( NoteData, parts, nd )
{
InsertHoldTails( *nd );
Expand Down Expand Up @@ -657,7 +631,6 @@ void NoteDataUtil::GetETTNoteDataString(const NoteData &in, RString &sRet) {
// Get note data
vector<NoteData> parts;
float fLastBeat = -1.f;
SplitCompositeNoteData(in, parts);

FOREACH(NoteData, parts, nd) {
fLastBeat = max(fLastBeat, nd->GetLastBeat());
Expand Down Expand Up @@ -810,72 +783,6 @@ void NoteDataUtil::GetETTNoteDataString(const NoteData &in, RString &sRet) {
sRet.shrink_to_fit();
}

void NoteDataUtil::SplitCompositeNoteData( const NoteData &in, vector<NoteData> &out )
{
if( !in.IsComposite() )
{
out.push_back( in );
return;
}

FOREACH_PlayerNumber( pn )
{
out.push_back( NoteData() );
out.back().SetNumTracks( in.GetNumTracks() );
}

for( int t = 0; t < in.GetNumTracks(); ++t )
{
for( NoteData::const_iterator iter = in.begin(t); iter != in.end(t); ++iter )
{
int row = iter->first;
TapNote tn = iter->second;
/*
XXX: This code is (hopefully) a temporary hack to make sure that
routine charts don't have any notes without players assigned to them.
I suspect this is due to a related bug that these problems were
occuring to begin with, but at this time, I am unsure how to deal with it.
Hopefully this hack can be removed soon. -- Jason "Wolfman2000" Felds
*/
const Style *curStyle = GAMESTATE->GetCurrentStyle(PLAYER_INVALID);
if( (curStyle == NULL || curStyle->m_StyleType == StyleType_TwoPlayersSharedSides )
&& static_cast<int>( tn.pn ) > NUM_PlayerNumber )
{
tn.pn = PLAYER_1;
}
unsigned index = static_cast<int>( tn.pn );

ASSERT_M( index < NUM_PlayerNumber, ssprintf("We have a note not assigned to a player. The note in question is on beat %f, column %i.", NoteRowToBeat(row), t + 1) );
tn.pn = PLAYER_INVALID;
out[index].SetTapNote( t, row, tn );
}
}
}

void NoteDataUtil::CombineCompositeNoteData( NoteData &out, const vector<NoteData> &in )
{
FOREACH_CONST( NoteData, in, nd )
{
const int iMaxTracks = min( out.GetNumTracks(), nd->GetNumTracks() );

for( int track = 0; track < iMaxTracks; ++track )
{
for( NoteData::const_iterator i = nd->begin(track); i != nd->end(track); ++i )
{
int row = i->first;
if( out.IsHoldNoteAtRow(track, i->first) )
continue;
if( i->second.type == TapNoteType_HoldHead )
out.AddHoldNote( track, row, row + i->second.iDuration, i->second );
else
out.SetTapNote( track, row, i->second );
}
}
}
out.RevalidateATIs(vector<int>(), false);
}


void NoteDataUtil::LoadTransformedSlidingWindow( const NoteData &in, NoteData &out, int iNewNumTracks )
{
// reset all notes
Expand Down Expand Up @@ -1282,18 +1189,7 @@ void NoteDataUtil::RemoveSimultaneousNotes( NoteData &in, int iMaxSimultaneous,
// given time. Never touch data outside of the range given; if many hold notes are overlapping
// iStartIndex, and we'd have to change those holds to obey iMaxSimultaneous, just do the best
// we can without doing so.
if( in.IsComposite() )
{
// Do this per part.
vector<NoteData> vParts;

SplitCompositeNoteData( in, vParts );
FOREACH( NoteData, vParts, nd )
RemoveSimultaneousNotes( *nd, iMaxSimultaneous, iStartIndex, iEndIndex );
in.Init();
in.SetNumTracks( vParts.front().GetNumTracks() );
CombineCompositeNoteData( in, vParts );
}

FOREACH_NONEMPTY_ROW_ALL_TRACKS_RANGE( in, r, iStartIndex, iEndIndex )
{
set<int> viTracksHeld;
Expand Down
4 changes: 1 addition & 3 deletions src/NoteDataUtil.h
Original file line number Diff line number Diff line change
Expand Up @@ -24,12 +24,10 @@ namespace NoteDataUtil
{
NoteType GetSmallestNoteTypeForMeasure( const NoteData &nd, int iMeasureIndex );
NoteType GetSmallestNoteTypeInRange( const NoteData &nd, int iStartIndex, int iEndIndex );
void LoadFromSMNoteDataString( NoteData &out, const RString &sSMNoteData, bool bComposite );
void LoadFromSMNoteDataString( NoteData &out, const RString &sSMNoteData);
void LoadFromETTNoteDataString(NoteData& out, const RString &sSMNoteData);
void GetSMNoteDataString( const NoteData &in, RString &notes_out );
void GetETTNoteDataString(const NoteData &in, RString &notes_out);
void SplitCompositeNoteData( const NoteData &in, vector<NoteData> &out );
void CombineCompositeNoteData( NoteData &out, const vector<NoteData> &in );
/**
* @brief Autogenerate notes from one type to another.
*
Expand Down
1 change: 1 addition & 0 deletions src/PlayerStageStats.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -70,6 +70,7 @@ void PlayerStageStats::InternalInit()
filehadnegbpms = false;
filegotmines = false;
gaveuplikeadumbass = false;
filegotholds = false;

ZERO( m_iTapNoteScores );
ZERO( m_iHoldNoteScores );
Expand Down
74 changes: 0 additions & 74 deletions src/ScreenGameplay.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -329,7 +329,6 @@ void ScreenGameplay::Init()
}

m_pSoundMusic = NULL;
set_paused_internal(false);

if( GAMESTATE->m_pCurSong == NULL)
return; // ScreenDemonstration will move us to the next screen. We just need to survive for one update without crashing.
Expand Down Expand Up @@ -1168,8 +1167,6 @@ void ScreenGameplay::StartPlayingSong( float fMinTimeToNotes, float fMinTimeToMu
}
}
m_pSoundMusic->Play(false, &p);
if( m_bPaused )
m_pSoundMusic->Pause( true );

/* Make sure GAMESTATE->m_fMusicSeconds is set up. */
GAMESTATE->m_Position.m_fMusicSeconds = -5000;
Expand All @@ -1185,42 +1182,6 @@ void ScreenGameplay::StartPlayingSong( float fMinTimeToNotes, float fMinTimeToMu
}
}

void ScreenGameplay::set_paused_internal(bool p)
{
m_bPaused= p;
GAMESTATE->SetPaused(p);
}

void ScreenGameplay::PauseGame( bool bPause, GameController gc ) {
return; // completely disable the functionality of this rather than various avenues to it (pending full removal) -mina

if( m_bPaused == bPause )
{
LOG->Trace( "ScreenGameplay::PauseGame(%i) received, but already in that state; ignored", bPause );
return;
}

// Don't pause if we're already tweening out.
if( bPause && m_DancingState == STATE_OUTRO )
return;

ResetGiveUpTimers(false);

set_paused_internal(bPause);
m_PauseController = gc;

m_pSoundMusic->Pause( bPause );
if( bPause )
this->PlayCommand( "Pause" );
else
this->PlayCommand( "Unpause" );

FOREACH_EnabledPlayerInfo( m_vPlayerInfo, pi )
{
pi->m_pPlayer->SetPaused( m_bPaused );
}
}

// play assist ticks
void ScreenGameplay::PlayTicks()
{
Expand Down Expand Up @@ -1374,10 +1335,6 @@ void ScreenGameplay::Update( float fDeltaTime )
if( SCREENMAN->GetTopScreen() != this )
return;

/* Update actors when paused, but never move on to another state. */
if( m_bPaused )
return;

//LOG->Trace( "m_fOffsetInBeats = %f, m_fBeatsPerSecond = %f, m_Music.GetPositionSeconds = %f", m_fOffsetInBeats, m_fBeatsPerSecond, m_Music.GetPositionSeconds() );

m_AutoKeysounds.Update(fDeltaTime);
Expand Down Expand Up @@ -1869,24 +1826,6 @@ bool ScreenGameplay::Input( const InputEventPlus &input )
if( m_Codes.InputMessage(input, msg) )
this->HandleMessage( msg );

if( m_bPaused )
{
/* If we're paused, only accept GAME_BUTTON_START to unpause. */
if( GAMESTATE->IsHumanPlayer(input.pn) && input.MenuI == GAME_BUTTON_START && input.type == IET_FIRST_PRESS )
{
if( m_PauseController == GameController_Invalid || m_PauseController == input.GameI.controller )
{
// IMO, it's better to have this configurable. -DaisuMaster
if( UNPAUSE_WITH_START )
{
this->PauseGame( false );
return true;
}
}
}
return false;
}

if(m_DancingState != STATE_OUTRO &&
GAMESTATE->IsHumanPlayer(input.pn) &&
!m_Cancel.IsTransitioning() )
Expand Down Expand Up @@ -2382,15 +2321,6 @@ void ScreenGameplay::HandleScreenMessage( const ScreenMessage SM )

SOUND->PlayOnceFromAnnouncer( "gameplay failed" );
}
else if( SM == SM_Pause )
{
// Ignore SM_Pause when in demonstration.
if( GAMESTATE->m_bDemonstrationOrJukebox )
return;

if( !m_bPaused )
PauseGame( true );
}

ScreenWithMenuElements::HandleScreenMessage( SM );
}
Expand Down Expand Up @@ -2581,8 +2511,6 @@ class LunaScreenGameplay: public Luna<ScreenGameplay>
pi->PushSelf( L );
return 1;
}
static int PauseGame( T* p, lua_State *L ) { p->Pause( BArg(1)); return 0; }
static int IsPaused( T* p, lua_State *L ) { lua_pushboolean( L, p->IsPaused() ); return 1; }
static bool TurningPointsValid(lua_State* L, int index)
{
size_t size= lua_objlen(L, index);
Expand Down Expand Up @@ -2630,8 +2558,6 @@ class LunaScreenGameplay: public Luna<ScreenGameplay>
ADD_METHOD( GetPlayerInfo );
ADD_METHOD( GetDummyPlayerInfo );
// sm-ssc additions:
ADD_METHOD( PauseGame );
ADD_METHOD( IsPaused );
ADD_METHOD(begin_backing_out);
ADD_METHOD( GetTrueBPS );
}
Expand Down
Loading

0 comments on commit 5266735

Please sign in to comment.