Fix crashes in Rave/Battle mode.
This commit is contained in:
+16
-1
@@ -694,7 +694,9 @@ void GameState::BeginStage()
|
||||
ASSERT( m_iNumStagesOfThisSong != -1 );
|
||||
FOREACH_EnabledPlayer( p )
|
||||
{
|
||||
if( !IsEventMode() )
|
||||
// only do this check with human players, assume CPU players (Rave)
|
||||
// always have tokens. -aj (this could probably be moved below, even.)
|
||||
if( !IsEventMode() && !IsCpuPlayer(p) )
|
||||
ASSERT( m_iPlayerStageTokens[p] >= m_iNumStagesOfThisSong );
|
||||
m_iPlayerStageTokens[p] -= m_iNumStagesOfThisSong;
|
||||
}
|
||||
@@ -959,6 +961,13 @@ void GameState::UpdateSongPosition( float fPositionSeconds, const TimingData &ti
|
||||
// "Crash reason : -243478.890625 -48695.773438"
|
||||
ASSERT_M( m_fSongBeat > -2000, ssprintf("Song beat %f at %f seconds", m_fSongBeat, fPositionSeconds) );
|
||||
|
||||
//if( m_iWarpBeginRow != -1 || m_iWarpEndRow == -1 )
|
||||
if( m_iWarpBeginRow != -1 && m_iWarpEndRow == -1 )
|
||||
{
|
||||
// we got a warp in this section.
|
||||
LOG->Trace("warp at %i jumps to %i",m_iWarpBeginRow,m_iWarpEndRow);
|
||||
// i hate this part because how the shit do i convert rows to seconds?
|
||||
}
|
||||
/*
|
||||
// xxx testing: only do this on monotune survivor
|
||||
if( m_pCurSong && m_pCurSong->GetDisplayFullTitle() == "monotune survivor" )
|
||||
@@ -2169,6 +2178,11 @@ public:
|
||||
DEFINE_METHOD( GetPlayerDisplayName, GetPlayerDisplayName(Enum::Check<PlayerNumber>(L, 1)) )
|
||||
DEFINE_METHOD( GetMasterPlayerNumber, m_MasterPlayerNumber )
|
||||
DEFINE_METHOD( GetMultiplayer, m_bMultiplayer )
|
||||
static int SetMultiplayer( T* p, lua_State *L )
|
||||
{
|
||||
p->m_bMultiplayer = BArg(1);
|
||||
return 0;
|
||||
}
|
||||
DEFINE_METHOD( GetNumMultiplayerNoteFields, m_iNumMultiplayerNoteFields )
|
||||
DEFINE_METHOD( ShowW1, ShowW1() )
|
||||
|
||||
@@ -2444,6 +2458,7 @@ public:
|
||||
ADD_METHOD( GetPlayerDisplayName );
|
||||
ADD_METHOD( GetMasterPlayerNumber );
|
||||
ADD_METHOD( GetMultiplayer );
|
||||
ADD_METHOD( SetMultiplayer );
|
||||
ADD_METHOD( GetNumMultiplayerNoteFields );
|
||||
ADD_METHOD( SetNumMultiplayerNoteFields );
|
||||
ADD_METHOD( ShowW1 );
|
||||
|
||||
+11
-9
@@ -401,6 +401,15 @@ void ScreenGameplay::Init()
|
||||
/* Called once per stage (single song or single course). */
|
||||
GAMESTATE->BeginStage();
|
||||
|
||||
if(!GAMESTATE->IsCourseMode() && !GAMESTATE->m_bDemonstrationOrJukebox)
|
||||
{
|
||||
// fill in difficulty of CPU players with that of the first human player
|
||||
FOREACH_PotentialCpuPlayer(p)
|
||||
GAMESTATE->m_pCurSteps[p].Set( GAMESTATE->m_pCurSteps[ GAMESTATE->GetFirstHumanPlayer() ] );
|
||||
|
||||
FOREACH_EnabledPlayer(p)
|
||||
ASSERT( GAMESTATE->m_pCurSteps[p].Get() );
|
||||
}
|
||||
|
||||
/* Increment the course play count. */
|
||||
if( GAMESTATE->IsCourseMode() && !GAMESTATE->m_bDemonstrationOrJukebox )
|
||||
@@ -734,6 +743,7 @@ void ScreenGameplay::Init()
|
||||
pi->GetPlayerStageStats()->m_vpPossibleSteps = pi->m_vpStepsQueue;
|
||||
}
|
||||
|
||||
LOG->Trace("[ScreenGameplay::Init] loading scorekeepers");
|
||||
FOREACH_EnabledPlayerInfo( m_vPlayerInfo, pi )
|
||||
{
|
||||
ASSERT( !pi->m_vpStepsQueue.empty() );
|
||||
@@ -802,8 +812,6 @@ bool ScreenGameplay::Center1Player() const
|
||||
// fill in m_apSongsQueue, m_vpStepsQueue, m_asModifiersQueue
|
||||
void ScreenGameplay::InitSongQueues()
|
||||
{
|
||||
LOG->Trace("InitSongQueues");
|
||||
|
||||
if( GAMESTATE->IsCourseMode() )
|
||||
{
|
||||
Course* pCourse = GAMESTATE->m_pCurCourse;
|
||||
@@ -936,6 +944,7 @@ bool ScreenGameplay::IsLastSong()
|
||||
|
||||
void ScreenGameplay::SetupSong( int iSongIndex )
|
||||
{
|
||||
LOG->Trace("[ScreenGameplay::SetupSong] begin");
|
||||
FOREACH_EnabledPlayerInfo( m_vPlayerInfo, pi )
|
||||
{
|
||||
/* This is the first beat that can be changed without it being visible. Until
|
||||
@@ -1028,13 +1037,6 @@ void ScreenGameplay::SetupSong( int iSongIndex )
|
||||
/* Hack: Course modifiers that are set to start immediately shouldn't tween on. */
|
||||
pi->GetPlayerState()->m_PlayerOptions.SetCurrentToLevel( ModsLevel_Stage );
|
||||
}
|
||||
|
||||
// fill in difficulty of CPU players with that of the first human player
|
||||
FOREACH_PotentialCpuPlayer(p)
|
||||
GAMESTATE->m_pCurSteps[p].Set( GAMESTATE->m_pCurSteps[ GAMESTATE->GetFirstHumanPlayer() ] );
|
||||
|
||||
FOREACH_EnabledPlayer(p)
|
||||
ASSERT( GAMESTATE->m_pCurSteps[p].Get() );
|
||||
}
|
||||
|
||||
void ScreenGameplay::ReloadCurrentSong()
|
||||
|
||||
Reference in New Issue
Block a user