Changed logic to allog ToastyTriggersAt to be a function that returns the next increment. Added ToastyMinTNS metric for controlling the TNS for a toasty.
This commit is contained in:
@@ -571,6 +571,7 @@ AvoidMineIncrementsCombo=false
|
|||||||
UseInternalScoring=true
|
UseInternalScoring=true
|
||||||
# When you hit it, you know.
|
# When you hit it, you know.
|
||||||
ToastyTriggersAt=250
|
ToastyTriggersAt=250
|
||||||
|
ToastyMinTNS='TapNoteScore_W2'
|
||||||
|
|
||||||
[GameState]
|
[GameState]
|
||||||
# Default song and sort. these don't really matter
|
# Default song and sort. these don't really matter
|
||||||
|
|||||||
+85
-52
@@ -51,12 +51,10 @@ void ScoreKeeperNormal::Load(
|
|||||||
m_AvoidMineIncrementsCombo.Load( "Gameplay", "AvoidMineIncrementsCombo" );
|
m_AvoidMineIncrementsCombo.Load( "Gameplay", "AvoidMineIncrementsCombo" );
|
||||||
m_UseInternalScoring.Load( "Gameplay", "UseInternalScoring" );
|
m_UseInternalScoring.Load( "Gameplay", "UseInternalScoring" );
|
||||||
|
|
||||||
// Toasty triggers (idea from 3.9+)
|
// This can be a function or a number, the type is checked when needed.
|
||||||
// Multiple toasty support doesn't seem to be working right now.
|
// -Kyz
|
||||||
// Since it's causing more problems than solutions, I'm going back to
|
m_toasty_trigger.Load("Gameplay", "ToastyTriggersAt");
|
||||||
// the old way of a single toasty trigger for now.
|
m_toasty_min_tns.Load("Gameplay", "ToastyMinTNS");
|
||||||
//m_vToastyTriggers.Load( "Gameplay", "ToastyTriggersAt" );
|
|
||||||
m_ToastyTrigger.Load( "Gameplay", "ToastyTriggersAt" );
|
|
||||||
|
|
||||||
// Fill in STATSMAN->m_CurStageStats, calculate multiplier
|
// Fill in STATSMAN->m_CurStageStats, calculate multiplier
|
||||||
int iTotalPossibleDancePoints = 0;
|
int iTotalPossibleDancePoints = 0;
|
||||||
@@ -103,9 +101,12 @@ void ScoreKeeperNormal::Load(
|
|||||||
m_pPlayerStageStats->m_iPossibleGradePoints = iTotalPossibleGradePoints;
|
m_pPlayerStageStats->m_iPossibleGradePoints = iTotalPossibleGradePoints;
|
||||||
|
|
||||||
m_iScoreRemainder = 0;
|
m_iScoreRemainder = 0;
|
||||||
m_iCurToastyCombo = 0;
|
m_cur_toasty_combo = 0;
|
||||||
//m_iCurToastyTrigger = 0;
|
m_cur_toasty_level= 0;
|
||||||
//m_iNextToastyAt = 0;
|
// Initialize m_next_toasty_at to 0 so that CalcNextToastyAt just needs to
|
||||||
|
// add the value. -Kyz
|
||||||
|
m_next_toasty_at= 0;
|
||||||
|
m_next_toasty_at= CalcNextToastyAt(m_cur_toasty_level);
|
||||||
m_iMaxScoreSoFar = 0;
|
m_iMaxScoreSoFar = 0;
|
||||||
m_iPointBonus = 0;
|
m_iPointBonus = 0;
|
||||||
m_iNumTapsAndHolds = 0;
|
m_iNumTapsAndHolds = 0;
|
||||||
@@ -329,6 +330,62 @@ void ScoreKeeperNormal::AddScoreInternal( TapNoteScore score )
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
int ScoreKeeperNormal::CalcNextToastyAt(int level)
|
||||||
|
{
|
||||||
|
Lua* L= LUA->Get();
|
||||||
|
m_toasty_trigger.PushSelf(L);
|
||||||
|
const int default_amount= 250;
|
||||||
|
int amount= default_amount;
|
||||||
|
bool erred= false;
|
||||||
|
switch(lua_type(L, 1))
|
||||||
|
{
|
||||||
|
case LUA_TNUMBER:
|
||||||
|
amount= lua_tointeger(L, 1);
|
||||||
|
break;
|
||||||
|
case LUA_TFUNCTION:
|
||||||
|
{
|
||||||
|
RString err= "Error running ToastyTriggersAt: ";
|
||||||
|
LuaHelpers::Push(L, m_pPlayerState->m_PlayerNumber);
|
||||||
|
lua_pushnumber(L, level);
|
||||||
|
if(LuaHelpers::RunScriptOnStack(L, err, 2, 1, true))
|
||||||
|
{
|
||||||
|
if(lua_isnumber(L, -1))
|
||||||
|
{
|
||||||
|
amount= lua_tointeger(L, -1);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
LuaHelpers::ReportScriptError("Gameplay::ToastyTriggersAt "
|
||||||
|
"function must return a number greater than 0.");
|
||||||
|
erred= true;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
erred= true;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
default:
|
||||||
|
LuaHelpers::ReportScriptError("Gameplay::ToastyTriggersAt metric has "
|
||||||
|
"a nonsensical type, it must be a number or a function.");
|
||||||
|
erred= true;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
if(amount <= 0)
|
||||||
|
{
|
||||||
|
if(!erred)
|
||||||
|
{
|
||||||
|
LuaHelpers::ReportScriptError("The ToastyTriggersAt value cannot be "
|
||||||
|
"less than or equal to 0 because that would be silly.");
|
||||||
|
}
|
||||||
|
amount= default_amount;
|
||||||
|
}
|
||||||
|
lua_settop(L, 0);
|
||||||
|
LUA->Release(L);
|
||||||
|
return m_next_toasty_at + amount;
|
||||||
|
}
|
||||||
|
|
||||||
void ScoreKeeperNormal::HandleTapScore( const TapNote &tn )
|
void ScoreKeeperNormal::HandleTapScore( const TapNote &tn )
|
||||||
{
|
{
|
||||||
TapNoteScore tns = tn.result.tns;
|
TapNoteScore tns = tn.result.tns;
|
||||||
@@ -504,66 +561,42 @@ void ScoreKeeperNormal::HandleTapRowScore( const NoteData &nd, int iRow )
|
|||||||
if( (GamePreferences::m_AutoPlay != PC_HUMAN || m_pPlayerState->m_PlayerOptions.GetCurrent().m_fPlayerAutoPlay != 0)
|
if( (GamePreferences::m_AutoPlay != PC_HUMAN || m_pPlayerState->m_PlayerOptions.GetCurrent().m_fPlayerAutoPlay != 0)
|
||||||
&& !GAMESTATE->m_bDemonstrationOrJukebox ) // cheaters always prosper >:D -aj comment edit
|
&& !GAMESTATE->m_bDemonstrationOrJukebox ) // cheaters always prosper >:D -aj comment edit
|
||||||
{
|
{
|
||||||
m_iCurToastyCombo = 0;
|
m_cur_toasty_combo = 0;
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
#endif //DEBUG
|
#endif //DEBUG
|
||||||
|
|
||||||
// Toasty combo
|
// Toasty combo
|
||||||
//vector<int> iToastyMilestones;
|
if(scoreOfLastTap >= m_toasty_min_tns)
|
||||||
switch( scoreOfLastTap )
|
|
||||||
{
|
{
|
||||||
case TNS_W1:
|
m_cur_toasty_combo += iNumTapsInRow;
|
||||||
case TNS_W2:
|
if(m_cur_toasty_combo > m_next_toasty_at &&
|
||||||
// TODO: Come up with a design for the theme to list a set of milestone
|
|
||||||
// values? Current behavior is to just happen at multiples of
|
|
||||||
// m_ToastyTrigger. -Kyz
|
|
||||||
/*
|
|
||||||
// compile the list of toasty triggers
|
|
||||||
{
|
|
||||||
Lua *L = LUA->Get();
|
|
||||||
m_vToastyTriggers.PushSelf(L);
|
|
||||||
LuaHelpers::ReadArrayFromTable(iToastyMilestones, L);
|
|
||||||
lua_pop( L, 1 );
|
|
||||||
LUA->Release(L);
|
|
||||||
}
|
|
||||||
// find out which one we're at.
|
|
||||||
if(m_iCurToastyTrigger <= int(iToastyMilestones.size()))
|
|
||||||
{
|
|
||||||
m_iNextToastyAt = iToastyMilestones[m_iCurToastyTrigger];
|
|
||||||
}
|
|
||||||
else // out of index value? then don't make it toasty!
|
|
||||||
{
|
|
||||||
m_iNextToastyAt = -1;
|
|
||||||
}
|
|
||||||
*/
|
|
||||||
{
|
|
||||||
int old_toastiness= m_iCurToastyCombo / m_ToastyTrigger;
|
|
||||||
m_iCurToastyCombo += iNumTapsInRow;
|
|
||||||
int new_toastiness= m_iCurToastyCombo / m_ToastyTrigger;
|
|
||||||
if(new_toastiness > old_toastiness &&
|
|
||||||
!GAMESTATE->m_bDemonstrationOrJukebox)
|
!GAMESTATE->m_bDemonstrationOrJukebox)
|
||||||
{
|
{
|
||||||
SCREENMAN->PostMessageToTopScreen( SM_PlayToasty, 0 );
|
++m_cur_toasty_level;
|
||||||
|
// Broadcast the message before posting the screen message so that the
|
||||||
|
// transition layer can catch the message to know the level and respond
|
||||||
|
// accordingly. -Kyz
|
||||||
Message msg("ToastyAchieved");
|
Message msg("ToastyAchieved");
|
||||||
msg.SetParam("PlayerNumber", m_pPlayerState->m_PlayerNumber);
|
msg.SetParam("PlayerNumber", m_pPlayerState->m_PlayerNumber);
|
||||||
msg.SetParam( "ToastyCombo", m_iCurToastyCombo );
|
msg.SetParam("ToastyCombo", m_cur_toasty_combo);
|
||||||
msg.SetParam( "Level", new_toastiness );
|
msg.SetParam("Level", m_cur_toasty_level);
|
||||||
MESSAGEMAN->Broadcast(msg);
|
MESSAGEMAN->Broadcast(msg);
|
||||||
|
|
||||||
// TODO: keep a pointer to the Profile. Don't index with m_PlayerNumber
|
// TODO: keep a pointer to the Profile. Don't index with m_PlayerNumber
|
||||||
|
SCREENMAN->PostMessageToTopScreen(SM_PlayToasty, 0);
|
||||||
PROFILEMAN->IncrementToastiesCount(m_pPlayerState->m_PlayerNumber);
|
PROFILEMAN->IncrementToastiesCount(m_pPlayerState->m_PlayerNumber);
|
||||||
|
m_next_toasty_at= CalcNextToastyAt(m_cur_toasty_level);
|
||||||
//m_iCurToastyTrigger++;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
break;
|
else
|
||||||
default:
|
{
|
||||||
m_iCurToastyCombo = 0;
|
m_cur_toasty_combo = 0;
|
||||||
|
m_cur_toasty_level= 0;
|
||||||
|
m_next_toasty_at= 0;
|
||||||
|
m_next_toasty_at= CalcNextToastyAt(m_cur_toasty_level);
|
||||||
Message msg("ToastyDropped");
|
Message msg("ToastyDropped");
|
||||||
msg.SetParam( "PlayerNumber", m_pPlayerState->m_PlayerNumber );
|
msg.SetParam( "PlayerNumber", m_pPlayerState->m_PlayerNumber );
|
||||||
MESSAGEMAN->Broadcast(msg);
|
MESSAGEMAN->Broadcast(msg);
|
||||||
break;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// TODO: Remove indexing with PlayerNumber
|
// TODO: Remove indexing with PlayerNumber
|
||||||
@@ -575,7 +608,7 @@ void ScoreKeeperNormal::HandleTapRowScore( const NoteData &nd, int iRow )
|
|||||||
Message msg( "ScoreChanged" );
|
Message msg( "ScoreChanged" );
|
||||||
msg.SetParam( "PlayerNumber", m_pPlayerState->m_PlayerNumber );
|
msg.SetParam( "PlayerNumber", m_pPlayerState->m_PlayerNumber );
|
||||||
msg.SetParam( "MultiPlayer", m_pPlayerState->m_mp );
|
msg.SetParam( "MultiPlayer", m_pPlayerState->m_mp );
|
||||||
msg.SetParam( "ToastyCombo", m_iCurToastyCombo );
|
msg.SetParam( "ToastyCombo", m_cur_toasty_combo );
|
||||||
MESSAGEMAN->Broadcast( msg );
|
MESSAGEMAN->Broadcast( msg );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -18,6 +18,7 @@ AutoScreenMessage( SM_PlayToasty );
|
|||||||
class ScoreKeeperNormal: public ScoreKeeper
|
class ScoreKeeperNormal: public ScoreKeeper
|
||||||
{
|
{
|
||||||
void AddScoreInternal( TapNoteScore score );
|
void AddScoreInternal( TapNoteScore score );
|
||||||
|
int CalcNextToastyAt(int level);
|
||||||
|
|
||||||
int m_iScoreRemainder;
|
int m_iScoreRemainder;
|
||||||
int m_iMaxPossiblePoints;
|
int m_iMaxPossiblePoints;
|
||||||
@@ -26,9 +27,9 @@ class ScoreKeeperNormal: public ScoreKeeper
|
|||||||
int m_iNumTapsAndHolds;
|
int m_iNumTapsAndHolds;
|
||||||
int m_iMaxScoreSoFar; // for nonstop scoring
|
int m_iMaxScoreSoFar; // for nonstop scoring
|
||||||
int m_iPointBonus; // the difference to award at the end
|
int m_iPointBonus; // the difference to award at the end
|
||||||
int m_iCurToastyCombo;
|
int m_cur_toasty_combo;
|
||||||
//int m_iCurToastyTrigger;
|
int m_cur_toasty_level;
|
||||||
//int m_iNextToastyAt;
|
int m_next_toasty_at;
|
||||||
bool m_bIsLastSongInCourse;
|
bool m_bIsLastSongInCourse;
|
||||||
bool m_bIsBeginner;
|
bool m_bIsBeginner;
|
||||||
|
|
||||||
@@ -43,8 +44,8 @@ class ScoreKeeperNormal: public ScoreKeeper
|
|||||||
ThemeMetric<bool> m_AvoidMineIncrementsCombo;
|
ThemeMetric<bool> m_AvoidMineIncrementsCombo;
|
||||||
ThemeMetric<bool> m_UseInternalScoring;
|
ThemeMetric<bool> m_UseInternalScoring;
|
||||||
|
|
||||||
//ThemeMetric<LuaReference> m_vToastyTriggers;
|
ThemeMetric<TapNoteScore> m_toasty_min_tns;
|
||||||
ThemeMetric<int> m_ToastyTrigger;
|
ThemeMetric<LuaReference> m_toasty_trigger;
|
||||||
|
|
||||||
vector<Steps*> m_apSteps;
|
vector<Steps*> m_apSteps;
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user