UsePauseMenuInsteadOfGiveUp wasn't necessary for making start not give up on a song. Changed png load back to use setjmp/longjmp.

This commit is contained in:
Kyzentun Keeslala
2016-07-12 21:00:54 -06:00
parent 8e6d44edce
commit ccc26c305a
6 changed files with 36 additions and 33 deletions
+14 -16
View File
@@ -50,10 +50,7 @@ void PNG_Error( png_struct *png, const char *error )
strncpy( info->err, error, 1024 );
info->err[1023] = 0;
LOG->Trace( "loading \"%s\": err: %s", info->fn, info->err );
// This exception is just thrown to go to the catch block for cleanup. The
// message has already been printed, so the exception value can be ignored.
// -Kyz
throw int(1);
longjmp( png_jmpbuf(png), 1 );
}
void PNG_Warning( png_struct *png, const char *warning )
@@ -92,8 +89,20 @@ static RageSurface *RageSurface_Load_PNG( RageFile *f, const char *fn, char erro
CHECKPOINT_M("Potential issue with png jump about to be analyzed.");
png_byte** row_pointers= NULL;
try
// Throwing an exception in the error callback would make the exception
// pass through C code, which is undefined behavior. Works fine on Linux,
// and on OS X with C++11, but does not work on OS X without C++11. -Kyz
if(setjmp(png_jmpbuf(png)))
{
png_destroy_read_struct(&png, &info_ptr, NULL);
delete img;
if(row_pointers != NULL)
{
delete[] row_pointers;
}
return NULL;
}
png_set_read_fn( png, f, RageFile_png_read );
@@ -241,17 +250,6 @@ static RageSurface *RageSurface_Load_PNG( RageFile *f, const char *fn, char erro
png_read_end( png, info_ptr );
png_destroy_read_struct( &png, &info_ptr, NULL );
}
catch(int e)
{
png_destroy_read_struct(&png, &info_ptr, NULL);
delete img;
if(row_pointers != NULL)
{
delete[] row_pointers;
}
return NULL;
}
return img;
}
+4 -8
View File
@@ -67,7 +67,6 @@
#define SHOW_SCORE_IN_RAVE THEME->GetMetricB(m_sName,"ShowScoreInRave")
#define SONG_POSITION_METER_WIDTH THEME->GetMetricF(m_sName,"SongPositionMeterWidth")
#define STOP_COURSE_EARLY THEME->GetMetricB(m_sName,"StopCourseEarly") // evaluate this every time it's used
#define USE_PAUSE_MENU_INSTEAD_OF_GIVE_UP THEME->GetMetricB(m_sName, "UsePauseMenuInsteadOfGiveUp")
static ThemeMetric<float> INITIAL_BACKGROUND_BRIGHTNESS ("ScreenGameplay","InitialBackgroundBrightness");
static ThemeMetric<float> SECONDS_BETWEEN_COMMENTS ("ScreenGameplay","SecondsBetweenComments");
@@ -1937,12 +1936,9 @@ void ScreenGameplay::Update( float fDeltaTime )
// update give up
bool bGiveUpTimerFired = false;
if(!USE_PAUSE_MENU_INSTEAD_OF_GIVE_UP)
{
bGiveUpTimerFired= !m_GiveUpTimer.IsZero() && m_GiveUpTimer.Ago() > GIVE_UP_SECONDS;
m_gave_up= bGiveUpTimerFired;
m_skipped_song= !m_SkipSongTimer.IsZero() && m_SkipSongTimer.Ago() > GIVE_UP_SECONDS;
}
bGiveUpTimerFired= !m_GiveUpTimer.IsZero() && m_GiveUpTimer.Ago() > GIVE_UP_SECONDS;
m_gave_up= bGiveUpTimerFired;
m_skipped_song= !m_SkipSongTimer.IsZero() && m_SkipSongTimer.Ago() > GIVE_UP_SECONDS;
bool bAllHumanHaveBigMissCombo = true;
@@ -2451,7 +2447,7 @@ bool ScreenGameplay::Input( const InputEventPlus &input )
return false;
}
if(!USE_PAUSE_MENU_INSTEAD_OF_GIVE_UP && m_DancingState != STATE_OUTRO &&
if(m_DancingState != STATE_OUTRO &&
GAMESTATE->IsHumanPlayer(input.pn) &&
!m_Cancel.IsTransitioning() )
{