Let's see how this merge tree looks.

This commit is contained in:
Jason Felds
2011-02-27 20:41:49 -05:00
13 changed files with 156 additions and 39 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.
+4 -2
View File
@@ -476,7 +476,8 @@ Play=Play the course.
Save=Save the course.
Edit Course=Edit Course contents.
Shuffle=Shuffle the songs around.
#
GamePrefDefaultFail=Immediate fail causes a player to die when their life bar reaches 0. ImmediateContinue allows you to continue playing afterwards.
[OptionNames]
0=0
0.25x=0.25x
@@ -1036,7 +1037,8 @@ Max Minutes=Max Minutes
Play=Play
Edit Course=Edit Course
Shuffle=Shuffle
#
GamePrefDefaultFail=Default Fail Type
[PaneDisplay]
Steps=Steps
Holds=Holds
+16
View File
@@ -123,6 +123,22 @@ function table.deviation( t )
end
return offset
end
-- See if this exists
function table.search( t, sFind )
for i=1,#t do
if t[i] == sFind then
return true
end
end
end
-- Retreive the entry that has this
function table.find( t, sFind )
for i=1,#t do
if t[i] == sFind then
return i
end
end
end
function round(val, decimal)
if (decimal) then
@@ -1,6 +1,11 @@
-- sm-ssc Default Theme Preferences Handler
function InitGamePrefs()
local Prefs =
local Prefs =
{
{ "DefaultFail", "Immediate" },
};
local BPrefs =
{
{ "AutoSetStyle", false },
{ "NotePosition", true },
@@ -9,6 +14,12 @@ function InitGamePrefs()
};
for idx,pref in ipairs(Prefs) do
if GetGamePref( pref[1] ) == nil then
SetGamePref( pref[1], pref[2] );
end;
end;
for idx,pref in ipairs(BPrefs) do
if GetGamePrefB( pref[1] ) == nil then
SetGamePref( pref[1], pref[2] );
end;
@@ -456,3 +467,43 @@ function GamePrefNotePosition()
setmetatable( t, t );
return t;
end
function GamePrefDefaultFail()
local t = {
Name = "GamePrefDefaultFail";
LayoutType = "ShowAllInRow";
SelectType = "SelectOne";
OneChoiceForAllPlayers = true;
ExportOnChange = false;
Choices = { "Immediate","ImmediateContinue", "AtEnd", "Off" };
LoadSelections = function(self, list, pn)
if ReadGamePrefFromFile("DefaultFail") ~= nil then
if GetGamePref("DefaultFail") then
list[table.find( list, GetGamePref("DefaultFail") )] = true;
else
list[1] = true;
end;
else
WriteGamePrefToFile("DefaultFail","Immediate");
list[1] = true;
end;
end;
SaveSelections = function(self, list, pn)
-- This is so stupid.
local tChoices = { "Immediate","ImmediateContinue", "AtEnd", "Off" };
local val;
for i=1,#list do
if list[i] then
val = i;
else
val = 1;
end
end
WriteGamePrefToFile("DefaultFail",tChoices[val]);
MESSAGEMAN:Broadcast("PreferenceSet", { Message == "Set Preference" } );
THEME:ReloadMetrics();
end;
};
setmetatable( t, t );
return t;
end
+2 -1
View File
@@ -2732,7 +2732,8 @@ LineNames="2,3,4,8,11,13,14,15,16,28,29,30"
Line2="conf,ScoringType"
Line3="conf,TimingWindowScale"
Line4="conf,LifeDifficulty"
Line8="conf,DefaultFailType"
Line8="lua,GamePrefDefaultFail()"
# Line8="conf,DefaultFailType"
Line11="conf,AllowW1"
Line13="conf,HiddenSongs"
Line14="conf,EasterEggs"
@@ -33,7 +33,7 @@ local function CreateStats( pnPlayer )
--
local t = Def.ActorFrame {};
t[#t+1] = Def.ActorFrame {
InitCommand=cmd(y,-16);
InitCommand=cmd(y,-32);
LoadActor(THEME:GetPathG("ScreenTitleMenu","PreferenceFrame")) .. {
InitCommand=cmd(zoom,0.875;diffuse,PlayerColor( pnPlayer ));
};
@@ -43,7 +43,7 @@ local function CreateStats( pnPlayer )
aText .. { Text=string.format("%04i",tValues["ITG_MAX"]); InitCommand=cmd(x,32;y,5;vertalign,bottom;zoom,0.5); };
};
t[#t+1] = Def.ActorFrame {
InitCommand=cmd(y,16);
InitCommand=cmd(y,-16);
LoadActor(THEME:GetPathG("ScreenTitleMenu","PreferenceFrame")) .. {
InitCommand=cmd(zoom,0.875;diffuse,PlayerColor( pnPlayer ));
};
@@ -52,6 +52,14 @@ local function CreateStats( pnPlayer )
aText .. { Text="/"; InitCommand=cmd(x,28;y,5;vertalign,bottom;zoom,0.5;diffusealpha,0.5); };
aText .. { Text=string.format("%04i",tValues["MIGS_MAX"]); InitCommand=cmd(x,32;y,5;vertalign,bottom;zoom,0.5); };
};
t[#t+1] = Def.ActorFrame {
InitCommand=cmd(y,0);
LoadActor(THEME:GetPathG("ScreenTitleMenu","PreferenceFrame")) .. {
InitCommand=cmd(zoom,0.875;diffuse,PlayerColor( pnPlayer ));
};
aLabel .. { Text="Signed:"; InitCommand=cmd(x,-64) };
aText .. { Text=string.format( #(tPlayerData[PLAYER_1].SignedJudgments) ); InitCommand=cmd(x,-8;y,5;vertalign,bottom;zoom,0.675); };
};
return t
end;
local t = Def.ActorFrame {};
+7 -3
View File
@@ -15,7 +15,10 @@
#include <float.h>
static ThemeMetric<float> ARROW_SPACING( "ArrowEffects", "ArrowSpacing" );
static ThemeMetric<bool> QUANTIZE_ARROW_Y( "ArrowEffects", "QuantizeArrowYPosition");
static ThemeMetric<bool> HIDDEN_SUDDEN_PAST_RECEPTOR( "ArrowEffects", "DrawHiddenNotesAfterReceptor");
// Allow themes to modify effects. (Is this a good idea? -aj)
static ThemeMetric<float> BLINK_MOD_FREQUENCY( "ArrowEffects", "BlinkModFrequency" );
static ThemeMetric<float> BOOST_MOD_MIN_CLAMP( "ArrowEffects", "BoostModMinClamp" );
static ThemeMetric<float> BOOST_MOD_MAX_CLAMP( "ArrowEffects", "BoostModMaxClamp" );
@@ -50,7 +53,6 @@ static ThemeMetric<float> BEAT_OFFSET_HEIGHT( "ArrowEffects", "BeatOffsetHeight"
static ThemeMetric<float> BEAT_PI_HEIGHT( "ArrowEffects", "BeatPIHeight" );
static ThemeMetric<float> MINI_PERCENT_BASE( "ArrowEffects", "MiniPercentBase" );
static ThemeMetric<float> MINI_PERCENT_GATE( "ArrowEffects", "MiniPercentGate" );
static ThemeMetric<bool> QUANTIZE_ARROW_Y( "ArrowEffects", "QuantizeArrowYPosition");
static float GetNoteFieldHeight( const PlayerState* pPlayerState )
{
@@ -231,6 +233,8 @@ float ArrowEffects::GetYOffset( const PlayerState* pPlayerState, int iCol, float
fYOffset += fYOffsetTimeSpacing * pPlayerState->m_PlayerOptions.GetCurrent().m_fTimeSpacing;
}
// TODO: If we allow noteskins to have metricable row spacing
// (per issue 24), edit this to reflect that. -aj
fYOffset *= ARROW_SPACING;
// don't mess with the arrows after they've crossed 0
@@ -287,8 +291,8 @@ float ArrowEffects::GetYOffset( const PlayerState* pPlayerState, int iCol, float
seed = ((seed * 1664525u) + 1013904223u) & 0xFFFFFFFF;
float fRandom = seed / 4294967296.0f;
/* Random speed always increases speed: a random speed of 10 indicates [1,11].
* This keeps it consistent with other mods: 0 means no effect. */
/* Random speed always increases speed: a random speed of 10 indicates
* [1,11]. This keeps it consistent with other mods: 0 means no effect. */
fScrollSpeed *=
SCALE( fRandom,
0.0f, 1.0f,
+21 -25
View File
@@ -78,9 +78,9 @@ public:
* the three credits needed to begin the game. */
BroadcastOnChange<int> m_iCoins;
/** @brief The player number used with Styles where one player controls both sides. */
PlayerNumber m_MasterPlayerNumber;
bool m_bMultiplayer;
int m_iNumMultiplayerNoteFields;
PlayerNumber m_MasterPlayerNumber;
bool m_bMultiplayer;
int m_iNumMultiplayerNoteFields;
bool DifficultiesLocked() const;
bool ChangePreferredDifficultyAndStepsType( PlayerNumber pn, Difficulty dc, StepsType st );
bool ChangePreferredDifficulty( PlayerNumber pn, int dir );
@@ -90,24 +90,24 @@ public:
Difficulty GetClosestShownDifficulty( PlayerNumber pn ) const;
Difficulty GetEasiestStepsDifficulty() const;
Difficulty GetHardestStepsDifficulty() const;
RageTimer m_timeGameStarted; // from the moment the first player pressed Start
LuaTable *m_Environment;
RageTimer m_timeGameStarted; // from the moment the first player pressed Start
LuaTable *m_Environment;
// This is set to a random number per-game/round; it can be used for a random seed.
int m_iGameSeed, m_iStageSeed;
RString m_sStageGUID;
int m_iGameSeed, m_iStageSeed;
RString m_sStageGUID;
/**
* @brief Determine if a second player can join in at this time.
* @return true if a player can still enter the game, false otherwise. */
bool PlayersCanJoin() const;
int GetCoinsNeededToJoin() const;
bool EnoughCreditsToJoin() const { return m_iCoins >= GetCoinsNeededToJoin(); }
bool PlayersCanJoin() const;
int GetCoinsNeededToJoin() const;
bool EnoughCreditsToJoin() const { return m_iCoins >= GetCoinsNeededToJoin(); }
int GetNumSidesJoined() const;
const Game* GetCurrentGame();
const Style* GetCurrentStyle() const;
void SetCurrentStyle( const Style *pStyle );
void SetCurrentStyle( const Style *pStyle );
void GetPlayerInfo( PlayerNumber pn, bool& bIsEnabledOut, bool& bIsHumanOut );
bool IsPlayerEnabled( PlayerNumber pn ) const;
@@ -129,17 +129,17 @@ public:
BroadcastOnChange<RString> m_sPreferredSongGroup; // GROUP_ALL denotes no preferred group
BroadcastOnChange<RString> m_sPreferredCourseGroup; // GROUP_ALL denotes no preferred group
bool m_bChangedFailTypeOnScreenSongOptions; // true if FailType was changed in the song options screen
bool m_bChangedFailTypeOnScreenSongOptions; // true if FailType was changed in the song options screen
BroadcastOnChange<StepsType> m_PreferredStepsType;
BroadcastOnChange1D<Difficulty,NUM_PLAYERS> m_PreferredDifficulty;
BroadcastOnChange1D<CourseDifficulty,NUM_PLAYERS> m_PreferredCourseDifficulty;// used in nonstop
BroadcastOnChange<SortOrder> m_SortOrder; // set by MusicWheel
SortOrder m_PreferredSortOrder; // used by MusicWheel
EditMode m_EditMode;
bool IsEditing() const { return m_EditMode != EditMode_Invalid; }
bool m_bDemonstrationOrJukebox; // ScreenGameplay does special stuff when this is true
bool m_bJukeboxUsesModifiers;
int m_iNumStagesOfThisSong;
SortOrder m_PreferredSortOrder; // used by MusicWheel
EditMode m_EditMode;
bool IsEditing() const { return m_EditMode != EditMode_Invalid; }
bool m_bDemonstrationOrJukebox; // ScreenGameplay does special stuff when this is true
bool m_bJukeboxUsesModifiers;
int m_iNumStagesOfThisSong;
/**
* @brief Increase this every stage while not resetting on a continue.
*
@@ -159,8 +159,8 @@ public:
void CancelStage();
void CommitStageStats();
void FinishStage();
int GetNumStagesLeft( PlayerNumber pn ) const;
int GetSmallestNumStagesLeftForAnyHumanPlayer() const;
int GetNumStagesLeft( PlayerNumber pn ) const;
int GetSmallestNumStagesLeftForAnyHumanPlayer() const;
bool IsFinalStageForAnyHumanPlayer() const;
bool IsAnExtraStage() const;
bool IsAnExtraStageAndSelectionLocked() const;
@@ -173,7 +173,6 @@ public:
bool m_bLoadingNextSong;
int GetLoadingCourseSongIndex() const;
// State Info used during gameplay
// NULL on ScreenSelectMusic if the currently selected wheel item isn't a Song.
@@ -212,17 +211,14 @@ public:
BroadcastOnChange<bool> m_bGameplayLeadIn;
// Metricable noteskin things
//void LoadNoteSkinMetrics( PlayerNumber pn );
/*
void LoadNoteSkinMetrics( PlayerNumber pn );
int m_iNoteSkinColSpacing[NUM_PLAYERS];
int m_iNoteSkinArrowSize[NUM_PLAYERS];
*/
// not sure I want to let noteskins change row spacing, as that changes how
// the speed mods work... -aj
//int m_iNoteSkinRowSpacing[NUM_PLAYERS];
// what are these for, exactly? -aj
//bool m_bNoteSkinOverrideDim[NUM_PLAYERS];
//bool m_bNoteSkinOverrideBright[NUM_PLAYERS];
float m_fMusicSecondsVisible;
float m_fSongBeatVisible;
+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;
+1 -1
View File
@@ -187,7 +187,7 @@ Grade PlayerStageStats::GetGrade() const
//LOG->Trace( "GetGrade: Grade: %s, %i", GradeToString(grade).c_str(), GRADE_TIER02_IS_ALL_W2S );
// todo: move all these conditions to Lua. -aj
// TODO: Change these conditions to use Lua instead. -aj
if( GRADE_TIER02_IS_ALL_W2S )
{
if( FullComboOfScore(TNS_W1) )
+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;
/**