various commits from SM4 SVN, courtesy of Glenn and Vyhd.

This commit is contained in:
AJ Kelly
2010-02-14 23:02:34 -06:00
parent 3c09722d3c
commit 75861f22a1
36 changed files with 760 additions and 120 deletions
+2 -30
View File
@@ -38,7 +38,6 @@
#include "UnlockManager.h"
#include "ScreenManager.h"
#include "Screen.h"
#include "GameConstantsAndTypes.h"
#include <ctime>
#include <set>
@@ -2162,35 +2161,8 @@ public:
}
static int GetCurrentSteps( T* p, lua_State *L )
{
// XXX: this will crash in certain situations, but if the PlayerNumber
// is checked for, difficulty displays will break... what to do? -aj
PlayerNumber pn = Enum::Check<PlayerNumber>(L, 1);
Steps* pSteps;
if( p->m_pCurSong.Get() != NULL )
{
// try our preferred steps type and difficulty first
pSteps = SongUtil::GetOneSteps( p->m_pCurSong.Get(), GAMESTATE->m_PreferredStepsType, GAMESTATE->m_PreferredDifficulty[pn] );
// no matches for preferred stepstype? try the current style
if( pSteps == NULL )
pSteps = SongUtil::GetOneSteps( p->m_pCurSong.Get(), GAMESTATE->GetCurrentStyle()->m_StepsType, GAMESTATE->m_PreferredDifficulty[pn] );
// nothing found with preferred difficulty? try with closest.
// closest seems to return 'easy' when prefrred difficulty is 'medium'
// even if the song has medium steps?
if( pSteps == NULL )
pSteps = SongUtil::GetOneSteps( p->m_pCurSong.Get(), GAMESTATE->GetCurrentStyle()->m_StepsType, GAMESTATE->GetClosestShownDifficulty(pn) );
}
else
{
pSteps = p->m_pCurSteps[pn];
}
// if you're on the music select and change song, the current steps are not
// updated correctly/in time for CurrentSongChangedMessageCommand
// (as such the returned steps are that of the previous song)
Steps *pSteps = p->m_pCurSteps[pn];
if( pSteps ) { pSteps->PushSelf(L); }
else { lua_pushnil(L); }
return 1;
@@ -2200,7 +2172,7 @@ public:
PlayerNumber pn = Enum::Check<PlayerNumber>(L, 1);
if( lua_isnil(L,2) ) { p->m_pCurSteps[pn].Set( NULL ); }
else { Steps *pS = Luna<Steps>::check(L,2); p->m_pCurSteps[pn].Set( pS ); }
// Why Broadcast again? This is double-broadcasting. -Chris
MESSAGEMAN->Broadcast( (MessageID)(Message_CurrentStepsP1Changed+pn) );
return 0;