Created SongOptions Lua interface with a similar design to the PlayerOptions interface. Moved enums that were inside SongOptions out and made them Lua accessible. Removed sAutosyncType and associated things from AdjustSync.cpp because it was unused. Added DefaultNilArgs and FArgGTEZero to LuaBinding as helpers. Moved INTERFACE defines from PlayerOptions.cpp to OptionsBinding.h.

This commit is contained in:
Kyzentun
2014-05-03 19:27:32 -06:00
parent b6b840187d
commit 0dfb131291
20 changed files with 384 additions and 258 deletions
+57 -29
View File
@@ -3,43 +3,68 @@
#ifndef SONG_OPTIONS_H
#define SONG_OPTIONS_H
#include "EnumHelper.h"
enum LifeType
{
LifeType_Bar,
LifeType_Battery,
LifeType_Time,
NUM_LifeType,
LifeType_Invalid
};
const RString& LifeTypeToString( LifeType cat );
const RString& LifeTypeToLocalizedString( LifeType cat );
LuaDeclareType( LifeType );
enum DrainType
{
DrainType_Normal,
DrainType_NoRecover,
DrainType_SuddenDeath,
NUM_DrainType,
DrainType_Invalid
};
const RString& DrainTypeToString( DrainType cat );
const RString& DrainTypeToLocalizedString( DrainType cat );
LuaDeclareType( DrainType );
enum AutosyncType
{
AutosyncType_Off,
AutosyncType_Song,
AutosyncType_Machine,
AutosyncType_Tempo,
NUM_AutosyncType,
AutosyncType_Invalid
};
const RString& AutosyncTypeToString( AutosyncType cat );
const RString& AutosyncTypeToLocalizedString( AutosyncType cat );
LuaDeclareType( AutosyncType );
enum SoundEffectType
{
SoundEffectType_Off,
SoundEffectType_Speed,
SoundEffectType_Pitch,
NUM_SoundEffectType,
SoundEffectType_Invalid
};
const RString& SoundEffectTypeToString( SoundEffectType cat );
const RString& SoundEffectTypeToLocalizedString( SoundEffectType cat );
LuaDeclareType( SoundEffectType );
class SongOptions
{
public:
enum LifeType
{
LIFE_BAR=0,
LIFE_BATTERY,
LIFE_TIME,
NUM_LIFE_TYPES
};
LifeType m_LifeType;
enum DrainType
{
DRAIN_NORMAL,
DRAIN_NO_RECOVER,
DRAIN_SUDDEN_DEATH
};
DrainType m_DrainType; // only used with LifeBar
int m_iBatteryLives;
bool m_bAssistClap;
bool m_bAssistMetronome;
float m_fMusicRate, m_SpeedfMusicRate;
float m_fHaste, m_SpeedfHaste;
enum AutosyncType {
AUTOSYNC_OFF,
AUTOSYNC_SONG,
AUTOSYNC_MACHINE,
AUTOSYNC_TEMPO,
NUM_AUTOSYNC_TYPES
};
AutosyncType m_AutosyncType;
enum SoundEffectType {
SOUNDEFFECT_OFF,
SOUNDEFFECT_SPEED,
SOUNDEFFECT_PITCH,
NUM_SOUNDEFFECT
};
SoundEffectType m_SoundEffectType;
bool m_bStaticBackground;
bool m_bRandomBGOnly;
@@ -51,12 +76,12 @@ public:
*
* This is taken from Init(), but uses the intended
* initialization lists. */
SongOptions(): m_LifeType(LIFE_BAR), m_DrainType(DRAIN_NORMAL),
SongOptions(): m_LifeType(LifeType_Bar), m_DrainType(DrainType_Normal),
m_iBatteryLives(4), m_bAssistClap(false),
m_bAssistMetronome(false), m_fMusicRate(1.0f),
m_SpeedfMusicRate(1.0f), m_fHaste(0.0f),
m_SpeedfHaste(1.0f), m_AutosyncType(AUTOSYNC_OFF),
m_SoundEffectType(SOUNDEFFECT_OFF),
m_SpeedfHaste(1.0f), m_AutosyncType(AutosyncType_Off),
m_SoundEffectType(SoundEffectType_Off),
m_bStaticBackground(false), m_bRandomBGOnly(false),
m_bSaveScore(true), m_bSaveReplay(false) {};
void Init();
@@ -70,6 +95,9 @@ public:
bool operator==( const SongOptions &other ) const;
bool operator!=( const SongOptions &other ) const { return !operator==(other); }
// Lua
void PushSelf( lua_State *L );
};
#endif