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
-3
View File
@@ -11,9 +11,6 @@ ________________________________________________________________________________
2016/06/24
----------
* [Gameplay] Added UsePauseMenuInsteadOfGiveUp theme metric. If this metric
is true, Select, Back, and Start cannot be held to exit a song. This is
for themes that provide a pause menu for these choices. [kyzentun]
* [SelectMusic] Added AllowHoldForOptions preference to disable holding start
to go to the player options screen. [kyzentun]
* [General] Back button will only back out of the screen on a press, not when
+15 -4
View File
@@ -29,10 +29,21 @@ Pressing MenuLeft and MenuRight at the same time is another way to pause.
# Theme Logic
### Metric
Set the ScreenGameplay::UsePauseMenuInsteadOfGiveUp theme metric to true to
disable the normal backing out logic. Then it won't interfere with using the
pause menu.
### Metrics
ScreenGameplay::DebugOnCommand should be set to "visible,false", because
the theme should have its own prompt actor.
Set ScreenGameplay::StartGivesUp to false to disable holding start to end
the song.
Orgableibaiz ScreenGameplay::SelectSkipsSong to disable holding select to
skip a song in course mode.
```
DebugOnCommand=visible,false
StartGivesUp=false
UnpauseWithStart=false
SelectSkipsSong=false
```
## Overview
-1
View File
@@ -3465,7 +3465,6 @@ PlayerInitCommand=y,SCREEN_CENTER_Y;zoom,(THEME:GetMetric("Common","ScreenHeight
StartGivesUp=true
BackGivesUp=false
GiveUpSeconds=2.5
UsePauseMenuInsteadOfGiveUp=false
# rage
AllowCenter1Player=true
#
+3 -1
View File
@@ -1610,8 +1610,10 @@ ActiveAttackListP2OffCommand=
#
# Disable the normal start and select button actions to enable a custom pause
# menu
UsePauseMenuInsteadOfGiveUp=true
DebugOnCommand=visible,false
StartGivesUp=false
UnpauseWithStart=false
SelectSkipsSong=false
StopCourseEarly=check_stop_course_early()
[ScreenGameplayShared]
+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() )
{