Changed LifeMeterTime to not crash when not in course mode. Changed _fallback's life settings back to forcing together. Added ForceImmediateFailForBattery theme metric. Gave up on FailFadeRemovePlayer lua function and removed it.

This commit is contained in:
Kyzentun
2014-08-19 23:58:35 -06:00
parent 7e73892e6e
commit 8ae17b4422
5 changed files with 43 additions and 36 deletions
-1
View File
@@ -1326,7 +1326,6 @@
</Class> </Class>
<Class base='ScreenWithMenuElements' name='ScreenGameplay'> <Class base='ScreenWithMenuElements' name='ScreenGameplay'>
<Function name='Center1Player'/> <Function name='Center1Player'/>
<Function name='FailFadeRemovePlayer'/>
<Function name='GetDummyPlayerInfo'/> <Function name='GetDummyPlayerInfo'/>
<Function name='GetHasteRate'/> <Function name='GetHasteRate'/>
<Function name='GetLifeMeter'/> <Function name='GetLifeMeter'/>
-3
View File
@@ -3791,9 +3791,6 @@ save yourself some time, copy this for undocumented things:
<Function name='Center1Player' return='bool' arguments=''> <Function name='Center1Player' return='bool' arguments=''>
Returns <code>true</code> if a single <Link class='Player' /> has its NoteField centered. Returns <code>true</code> if a single <Link class='Player' /> has its NoteField centered.
</Function> </Function>
<Function name='FailFadeRemovePlayer' return='void' arguments='PlayerNumber pn'>
Removes the notes for the specified player.
</Function>
<Function name='GetDummyPlayerInfo' return='PlayerInfo' arguments='int index'> <Function name='GetDummyPlayerInfo' return='PlayerInfo' arguments='int index'>
Returns a dummy PlayerInfo for the specified index. Returns a dummy PlayerInfo for the specified index.
</Function> </Function>
+4 -3
View File
@@ -2540,19 +2540,19 @@ Persp,5="mod,distant;name,Distant"
# Song options # Song options
# LifeType="3" # LifeType="3"
LifeType=(GAMESTATE:IsCourseMode() and 3 or 2).."" LifeType=(GAMESTATE:IsCourseMode() and 3 or 2)..";together"
LifeTypeDefault="" LifeTypeDefault=""
LifeType,1="mod,bar;name,Bar" LifeType,1="mod,bar;name,Bar"
LifeType,2="mod,battery;name,Battery" LifeType,2="mod,battery;name,Battery"
LifeType,3="mod,lifetime;name,LifeTime" LifeType,3="mod,lifetime;name,LifeTime"
# #
BarDrain="3" BarDrain="3;together"
BarDrainDefault="" BarDrainDefault=""
BarDrain,1="mod,normal-drain;name,Normal" BarDrain,1="mod,normal-drain;name,Normal"
BarDrain,2="mod,norecover;name,NoRecover" BarDrain,2="mod,norecover;name,NoRecover"
BarDrain,3="mod,suddendeath;name,SuddenDeath" BarDrain,3="mod,suddendeath;name,SuddenDeath"
# #
BatLives="10" BatLives="10;together"
BatLivesDefault="" BatLivesDefault=""
BatLives,1="mod,1 life;name,1" BatLives,1="mod,1 life;name,1"
BatLives,2="mod,2 lives;name,2" BatLives,2="mod,2 lives;name,2"
@@ -3301,6 +3301,7 @@ UnpauseWithStart=true
InitialBackgroundBrightness=1.0 InitialBackgroundBrightness=1.0
SecondsBetweenComments=10.0 SecondsBetweenComments=10.0
ScoreKeeperClass=ScoreKeeperClass() ScoreKeeperClass=ScoreKeeperClass()
ForceImmediateFailForBattery=true
TickEarlySeconds=0 TickEarlySeconds=0
LightsMode="LightsMode_Gameplay" LightsMode="LightsMode_Gameplay"
SurvivalModOverride=true SurvivalModOverride=true
+28 -2
View File
@@ -1,6 +1,7 @@
#include "global.h" #include "global.h"
#include "LifeMeterTime.h" #include "LifeMeterTime.h"
#include "ThemeManager.h" #include "ThemeManager.h"
#include "Song.h"
#include "Steps.h" #include "Steps.h"
#include "ActorUtil.h" #include "ActorUtil.h"
#include "Course.h" #include "Course.h"
@@ -94,11 +95,36 @@ void LifeMeterTime::OnLoadSong()
if( GetLifeSeconds() <= 0 && GAMESTATE->GetCourseSongIndex() > 0 ) if( GetLifeSeconds() <= 0 && GAMESTATE->GetCourseSongIndex() > 0 )
return; return;
float fOldLife = m_fLifeTotalLostSeconds;
float fGainSeconds = 0;
if(GAMESTATE->IsCourseMode())
{
Course* pCourse = GAMESTATE->m_pCurCourse; Course* pCourse = GAMESTATE->m_pCurCourse;
ASSERT( pCourse != NULL ); ASSERT( pCourse != NULL );
fGainSeconds= pCourse->m_vEntries[GAMESTATE->GetCourseSongIndex()].fGainSeconds;
}
else
{
// Placeholderish, at least this way it won't crash when someone tries it
// out in non-course mode. -Kyz
Song* song= GAMESTATE->m_pCurSong;
ASSERT(song != NULL);
float song_len= song->m_fMusicLengthSeconds;
Steps* steps= GAMESTATE->m_pCurSteps[m_pPlayerState->m_PlayerNumber];
ASSERT(steps != NULL);
RadarValues radars= steps->GetRadarValues(m_pPlayerState->m_PlayerNumber);
float scorable_things= radars[RadarCategory_TapsAndHolds] +
radars[RadarCategory_Lifts];
if(g_fTimeMeterSecondsChange[SE_Held] > 0.0f)
{
scorable_things+= radars[RadarCategory_Holds] +
radars[RadarCategory_Rolls];
}
// Calculate the amount of time to give for the player to need 80% W1.
float gainable_score_time= scorable_things * g_fTimeMeterSecondsChange[SE_W1];
fGainSeconds= song_len - (gainable_score_time * INITIAL_VALUE);
}
float fOldLife = m_fLifeTotalLostSeconds;
float fGainSeconds = pCourse->m_vEntries[GAMESTATE->GetCourseSongIndex()].fGainSeconds;
if( MIN_LIFE_TIME > fGainSeconds ) if( MIN_LIFE_TIME > fGainSeconds )
fGainSeconds = MIN_LIFE_TIME; fGainSeconds = MIN_LIFE_TIME;
m_fLifeTotalGainedSeconds += fGainSeconds; m_fLifeTotalGainedSeconds += fGainSeconds;
+6 -22
View File
@@ -71,6 +71,7 @@
static ThemeMetric<float> INITIAL_BACKGROUND_BRIGHTNESS ("ScreenGameplay","InitialBackgroundBrightness"); static ThemeMetric<float> INITIAL_BACKGROUND_BRIGHTNESS ("ScreenGameplay","InitialBackgroundBrightness");
static ThemeMetric<float> SECONDS_BETWEEN_COMMENTS ("ScreenGameplay","SecondsBetweenComments"); static ThemeMetric<float> SECONDS_BETWEEN_COMMENTS ("ScreenGameplay","SecondsBetweenComments");
static ThemeMetric<RString> SCORE_KEEPER_CLASS ("ScreenGameplay","ScoreKeeperClass"); static ThemeMetric<RString> SCORE_KEEPER_CLASS ("ScreenGameplay","ScoreKeeperClass");
static ThemeMetric<bool> FORCE_IMMEDIATE_FAIL_FOR_BATTERY("ScreenGameplay", "ForceImmediateFailForBattery");
AutoScreenMessage( SM_PlayGo ); AutoScreenMessage( SM_PlayGo );
@@ -1095,8 +1096,9 @@ void ScreenGameplay::LoadNextSong()
// No need to do this here. We do it in SongFinished(). // No need to do this here. We do it in SongFinished().
//GAMESTATE->RemoveAllActiveAttacks(); //GAMESTATE->RemoveAllActiveAttacks();
/* If we're in battery mode, force FailImmediate. We assume in Player::Step // Force immediate fail behavior changed to theme metric by Kyz.
* that failed players can't step. */ if(FORCE_IMMEDIATE_FAIL_FOR_BATTERY)
{
FOREACH_EnabledPlayerInfo( m_vPlayerInfo, pi ) FOREACH_EnabledPlayerInfo( m_vPlayerInfo, pi )
{ {
if(pi->GetPlayerState()->m_PlayerOptions.GetStage().m_LifeType == LifeType_Battery) if(pi->GetPlayerState()->m_PlayerOptions.GetStage().m_LifeType == LifeType_Battery)
@@ -1104,6 +1106,7 @@ void ScreenGameplay::LoadNextSong()
PO_GROUP_ASSIGN(pi->GetPlayerState()->m_PlayerOptions, ModsLevel_Song, m_FailType, FailType_Immediate); PO_GROUP_ASSIGN(pi->GetPlayerState()->m_PlayerOptions, ModsLevel_Song, m_FailType, FailType_Immediate);
} }
} }
}
m_textSongOptions.SetText( GAMESTATE->m_SongOptions.GetCurrent().GetString() ); m_textSongOptions.SetText( GAMESTATE->m_SongOptions.GetCurrent().GetString() );
@@ -1652,7 +1655,6 @@ void ScreenGameplay::Update( float fDeltaTime )
FailType ft = GAMESTATE->GetPlayerFailType( pi->GetPlayerState() ); FailType ft = GAMESTATE->GetPlayerFailType( pi->GetPlayerState() );
LifeType lt = pi->GetPlayerState()->m_PlayerOptions.GetStage().m_LifeType; LifeType lt = pi->GetPlayerState()->m_PlayerOptions.GetStage().m_LifeType;
if( ft == FailType_Off || ft == FailType_EndOfSong ) if( ft == FailType_Off || ft == FailType_EndOfSong )
continue; continue;
@@ -1820,10 +1822,7 @@ void ScreenGameplay::Update( float fDeltaTime )
if( !GAMESTATE->IsCpuPlayer(pi->m_pn) ) if( !GAMESTATE->IsCpuPlayer(pi->m_pn) )
continue; continue;
SOUND->PlayOnceFromDir( THEME->GetPathS(m_sName,"oni die") ); FailFadeRemovePlayer(&*pi);
pi->ShowOniGameOver();
pi->m_NoteData.Init(); // remove all notes and scoring
pi->m_pPlayer->FadeToFail(); // tell the NoteField to fade to white
} }
} }
} }
@@ -1926,14 +1925,6 @@ void ScreenGameplay::FailFadeRemovePlayer(PlayerInfo* pi)
pi->m_pPlayer->FadeToFail(); // tell the NoteField to fade to white pi->m_pPlayer->FadeToFail(); // tell the NoteField to fade to white
} }
void ScreenGameplay::FailFadeRemovePlayer(PlayerNumber pn)
{
if(pn < m_vPlayerInfo.size())
{
FailFadeRemovePlayer(&m_vPlayerInfo[pn]);
}
}
float ScreenGameplay::GetHasteRate() float ScreenGameplay::GetHasteRate()
{ {
return m_fCurrHasteRate; return m_fCurrHasteRate;
@@ -3004,12 +2995,6 @@ public:
lua_pushnumber(L, true_bps); lua_pushnumber(L, true_bps);
return 1; return 1;
} }
static int FailFadeRemovePlayer(T* p, lua_State* L)
{
PlayerNumber pn= Enum::Check<PlayerNumber>(L, 1);
p->FailFadeRemovePlayer(pn);
return 0;
}
LunaScreenGameplay() LunaScreenGameplay()
{ {
@@ -3027,7 +3012,6 @@ public:
ADD_METHOD( HasteTimeBetweenUpdates ); ADD_METHOD( HasteTimeBetweenUpdates );
ADD_METHOD( HasteLifeSwitchPoint ); ADD_METHOD( HasteLifeSwitchPoint );
ADD_METHOD( GetTrueBPS ); ADD_METHOD( GetTrueBPS );
ADD_METHOD( FailFadeRemovePlayer );
} }
}; };