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 base='ScreenWithMenuElements' name='ScreenGameplay'>
<Function name='Center1Player'/>
<Function name='FailFadeRemovePlayer'/>
<Function name='GetDummyPlayerInfo'/>
<Function name='GetHasteRate'/>
<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=''>
Returns <code>true</code> if a single <Link class='Player' /> has its NoteField centered.
</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'>
Returns a dummy PlayerInfo for the specified index.
</Function>
+4 -3
View File
@@ -2540,19 +2540,19 @@ Persp,5="mod,distant;name,Distant"
# Song options
# LifeType="3"
LifeType=(GAMESTATE:IsCourseMode() and 3 or 2)..""
LifeType=(GAMESTATE:IsCourseMode() and 3 or 2)..";together"
LifeTypeDefault=""
LifeType,1="mod,bar;name,Bar"
LifeType,2="mod,battery;name,Battery"
LifeType,3="mod,lifetime;name,LifeTime"
#
BarDrain="3"
BarDrain="3;together"
BarDrainDefault=""
BarDrain,1="mod,normal-drain;name,Normal"
BarDrain,2="mod,norecover;name,NoRecover"
BarDrain,3="mod,suddendeath;name,SuddenDeath"
#
BatLives="10"
BatLives="10;together"
BatLivesDefault=""
BatLives,1="mod,1 life;name,1"
BatLives,2="mod,2 lives;name,2"
@@ -3301,6 +3301,7 @@ UnpauseWithStart=true
InitialBackgroundBrightness=1.0
SecondsBetweenComments=10.0
ScoreKeeperClass=ScoreKeeperClass()
ForceImmediateFailForBattery=true
TickEarlySeconds=0
LightsMode="LightsMode_Gameplay"
SurvivalModOverride=true
+30 -4
View File
@@ -1,6 +1,7 @@
#include "global.h"
#include "LifeMeterTime.h"
#include "ThemeManager.h"
#include "Song.h"
#include "Steps.h"
#include "ActorUtil.h"
#include "Course.h"
@@ -94,11 +95,36 @@ void LifeMeterTime::OnLoadSong()
if( GetLifeSeconds() <= 0 && GAMESTATE->GetCourseSongIndex() > 0 )
return;
Course* pCourse = GAMESTATE->m_pCurCourse;
ASSERT( pCourse != NULL );
float fOldLife = m_fLifeTotalLostSeconds;
float fGainSeconds = pCourse->m_vEntries[GAMESTATE->GetCourseSongIndex()].fGainSeconds;
float fGainSeconds = 0;
if(GAMESTATE->IsCourseMode())
{
Course* pCourse = GAMESTATE->m_pCurCourse;
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);
}
if( MIN_LIFE_TIME > fGainSeconds )
fGainSeconds = MIN_LIFE_TIME;
m_fLifeTotalGainedSeconds += fGainSeconds;
+9 -25
View File
@@ -71,6 +71,7 @@
static ThemeMetric<float> INITIAL_BACKGROUND_BRIGHTNESS ("ScreenGameplay","InitialBackgroundBrightness");
static ThemeMetric<float> SECONDS_BETWEEN_COMMENTS ("ScreenGameplay","SecondsBetweenComments");
static ThemeMetric<RString> SCORE_KEEPER_CLASS ("ScreenGameplay","ScoreKeeperClass");
static ThemeMetric<bool> FORCE_IMMEDIATE_FAIL_FOR_BATTERY("ScreenGameplay", "ForceImmediateFailForBattery");
AutoScreenMessage( SM_PlayGo );
@@ -1095,13 +1096,15 @@ void ScreenGameplay::LoadNextSong()
// No need to do this here. We do it in SongFinished().
//GAMESTATE->RemoveAllActiveAttacks();
/* If we're in battery mode, force FailImmediate. We assume in Player::Step
* that failed players can't step. */
FOREACH_EnabledPlayerInfo( m_vPlayerInfo, pi )
// Force immediate fail behavior changed to theme metric by Kyz.
if(FORCE_IMMEDIATE_FAIL_FOR_BATTERY)
{
if(pi->GetPlayerState()->m_PlayerOptions.GetStage().m_LifeType == LifeType_Battery)
FOREACH_EnabledPlayerInfo( m_vPlayerInfo, pi )
{
PO_GROUP_ASSIGN(pi->GetPlayerState()->m_PlayerOptions, ModsLevel_Song, m_FailType, FailType_Immediate);
if(pi->GetPlayerState()->m_PlayerOptions.GetStage().m_LifeType == LifeType_Battery)
{
PO_GROUP_ASSIGN(pi->GetPlayerState()->m_PlayerOptions, ModsLevel_Song, m_FailType, FailType_Immediate);
}
}
}
@@ -1652,7 +1655,6 @@ void ScreenGameplay::Update( float fDeltaTime )
FailType ft = GAMESTATE->GetPlayerFailType( pi->GetPlayerState() );
LifeType lt = pi->GetPlayerState()->m_PlayerOptions.GetStage().m_LifeType;
if( ft == FailType_Off || ft == FailType_EndOfSong )
continue;
@@ -1820,10 +1822,7 @@ void ScreenGameplay::Update( float fDeltaTime )
if( !GAMESTATE->IsCpuPlayer(pi->m_pn) )
continue;
SOUND->PlayOnceFromDir( THEME->GetPathS(m_sName,"oni die") );
pi->ShowOniGameOver();
pi->m_NoteData.Init(); // remove all notes and scoring
pi->m_pPlayer->FadeToFail(); // tell the NoteField to fade to white
FailFadeRemovePlayer(&*pi);
}
}
}
@@ -1926,14 +1925,6 @@ void ScreenGameplay::FailFadeRemovePlayer(PlayerInfo* pi)
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()
{
return m_fCurrHasteRate;
@@ -3004,12 +2995,6 @@ public:
lua_pushnumber(L, true_bps);
return 1;
}
static int FailFadeRemovePlayer(T* p, lua_State* L)
{
PlayerNumber pn= Enum::Check<PlayerNumber>(L, 1);
p->FailFadeRemovePlayer(pn);
return 0;
}
LunaScreenGameplay()
{
@@ -3027,7 +3012,6 @@ public:
ADD_METHOD( HasteTimeBetweenUpdates );
ADD_METHOD( HasteLifeSwitchPoint );
ADD_METHOD( GetTrueBPS );
ADD_METHOD( FailFadeRemovePlayer );
}
};