[PlayerState] The old GetPlayerOptions() binding is now GetPlayerOptionsString(). There is a new GetPlayerOptions() binding that gets the PlayerOptions object, which has a GetNoteSkin() binding (and hopefully more in the future).

This commit is contained in:
AJ Kelly
2011-02-27 18:36:05 -06:00
parent 1631074f8c
commit 18f7dea5f9
5 changed files with 43 additions and 4 deletions
+6
View File
@@ -13,6 +13,12 @@ _____________________________________________________________________________
sm-ssc v1.2.3 | 2011022?
--------------------------------------------------------------------------------
20110227
--------
* [PlayerState] The old GetPlayerOptions() binding is now GetPlayerOptionsString().
There is a new GetPlayerOptions() binding that gets the PlayerOptions object,
which has a GetNoteSkin() binding (and hopefully more in the future). [AJ]
20110226
--------
* [ScreenOptionsToggleSongs] The structure of this screen has now changed.
+18
View File
@@ -823,6 +823,24 @@ void PlayerOptions::ResetPrefs( ResetPrefsType type )
#undef CPY
}
// lua start
#include "LuaBinding.h"
/** @brief Allow Lua to have access to PlayerOptions. */
class LunaPlayerOptions: public Luna<PlayerOptions>
{
public:
DEFINE_METHOD( GetNoteSkin, m_sNoteSkin )
LunaPlayerOptions()
{
ADD_METHOD( GetNoteSkin );
}
};
LUA_REGISTER_CLASS( PlayerOptions )
// lua end
/*
* (c) 2001-2004 Chris Danford, Glenn Maynard
* All rights reserved.
+4 -1
View File
@@ -5,6 +5,7 @@ class Course;
class Song;
class Steps;
class Trail;
struct lua_State;
#include "GameConstantsAndTypes.h"
#include "PlayerNumber.h"
@@ -32,6 +33,9 @@ public:
void ChooseRandomModifiers();
bool ContainsTransformOrTurn() const;
// Lua
void PushSelf( lua_State *L );
bool operator==( const PlayerOptions &other ) const;
bool operator!=( const PlayerOptions &other ) const { return !operator==(other); }
@@ -188,7 +192,6 @@ public:
void SetOneScroll( Scroll s );
void ToggleOneTurn( Turn t );
// return true if any mods being used will make the song(s) easier
bool IsEasierForSongAndSteps( Song* pSong, Steps* pSteps, PlayerNumber pn ) const;
bool IsEasierForCourseAndTrail( Course* pCourse, Trail* pTrail ) const;
+10 -2
View File
@@ -210,8 +210,8 @@ public:
static int GetPlayerOptions( T* p, lua_State *L )
{
ModsLevel m = Enum::Check<ModsLevel>( L, 1 );
RString s = p->m_PlayerOptions.Get(m).GetString();
LuaHelpers::Push( L, s );
PlayerOptions po = p->m_PlayerOptions.Get(m);
po.PushSelf(L);
return 1;
}
static int GetPlayerOptionsArray( T* p, lua_State *L )
@@ -222,6 +222,13 @@ public:
LuaHelpers::CreateTableFromArray<RString>( s, L );
return 1;
}
static int GetPlayerOptionsString( T* p, lua_State *L )
{
ModsLevel m = Enum::Check<ModsLevel>( L, 1 );
RString s = p->m_PlayerOptions.Get(m).GetString();
LuaHelpers::Push( L, s );
return 1;
}
DEFINE_METHOD( GetHealthState, m_HealthState );
LunaPlayerState()
@@ -231,6 +238,7 @@ public:
ADD_METHOD( SetPlayerOptions );
ADD_METHOD( GetPlayerOptions );
ADD_METHOD( GetPlayerOptionsArray );
ADD_METHOD( GetPlayerOptionsString );
ADD_METHOD( GetHealthState );
}
};
+5 -1
View File
@@ -31,7 +31,11 @@ public:
* in PlayerState and callers should not use PlayerNumber to index into
* GameState. */
PlayerNumber m_PlayerNumber;
/**
* @brief The MultiPlayer number assigned to this Player, typically 1-32.
*
* This is only used if GAMESTATE->m_bMultiplayer is true.
*/
MultiPlayer m_mp;
/**