add [MusicWheel] RecentSongsToShow metric

--------
cleanup
small amount of work on guitar-five (still incomplete)
add more commented out stuff for replay data playback
debug trace combo in order to find out issues with smo-ssc
added old packet names as comments in NetworkSyncManager.h
This commit is contained in:
AJ Kelly
2010-02-05 13:42:55 -06:00
parent f9b01e9c93
commit f2f7d2ceeb
15 changed files with 92 additions and 56 deletions
+1
View File
@@ -585,6 +585,7 @@ ShowRandom=false
ShowPortal=false
#
MostPlayedSongsToShow=30
RecentSongsToShow=30
#
ModeMenuChoiceNames="Preferred,Group,Title,Bpm,Popularity,TopGrades,Artist,EasyMeter,MediumMeter,HardMeter,ChallengeMeter,DoubleEasyMeter,DoubleMediumMeter,DoubleHardMeter,DoubleChallengeMeter,Genre,Length,Recent,NormalMode,BattleMode"
ChoicePreferred="sort,Preferred"
-2
View File
@@ -29,9 +29,7 @@ public:
virtual void DrawPrimitives();
//
// Commands
//
virtual void PushSelf( lua_State *L );
private:
+1 -1
View File
@@ -267,7 +267,7 @@ void StepsDisplayList::SetFromGameState()
{
vector<Steps*> vpSteps;
SongUtil::GetPlayableSteps( pSong, vpSteps );
/* Should match the sort in ScreenSelectMusic::AfterMusicChange. */
// Should match the sort in ScreenSelectMusic::AfterMusicChange.
m_Rows.resize( vpSteps.size() );
FOREACH_CONST( Steps*, vpSteps, s )
+40 -11
View File
@@ -1074,7 +1074,7 @@ static const Style g_Style_Ez2_Real =
{ TRACK_5, +EZ2_REAL_COL_SPACING*0.9f, NULL },
{ TRACK_6, +EZ2_REAL_COL_SPACING*1.6f, NULL },
{ TRACK_7, +EZ2_REAL_COL_SPACING*2.3f, NULL },
},
},
},
{ // m_iInputColumn[NUM_GameController][NUM_GameButton]
{ 0, 6, 3, 2, 4, 1, 5, Style::END_MAPPING },
@@ -1145,7 +1145,7 @@ static const Style g_Style_Ez2_Real_Versus =
{ TRACK_5, +EZ2_REAL_COL_SPACING*0.9f, NULL },
{ TRACK_6, +EZ2_REAL_COL_SPACING*1.6f, NULL },
{ TRACK_7, +EZ2_REAL_COL_SPACING*2.3f, NULL },
},
},
{ // PLAYER_2
{ TRACK_1, -EZ2_REAL_COL_SPACING*2.3f, NULL },
{ TRACK_2, -EZ2_REAL_COL_SPACING*1.6f, NULL },
@@ -1154,7 +1154,7 @@ static const Style g_Style_Ez2_Real_Versus =
{ TRACK_5, +EZ2_REAL_COL_SPACING*0.9f, NULL },
{ TRACK_6, +EZ2_REAL_COL_SPACING*1.6f, NULL },
{ TRACK_7, +EZ2_REAL_COL_SPACING*2.3f, NULL },
},
},
},
{ // m_iInputColumn[NUM_GameController][NUM_GameButton]
{ 0, 6, 3, 2, 4, 1, 5, Style::END_MAPPING },
@@ -1185,8 +1185,8 @@ static const Style g_Style_Ez2_Double =
{ TRACK_3, -EZ2_COL_SPACING*2.5f, NULL },
{ TRACK_4, -EZ2_COL_SPACING*1.5f, NULL },
{ TRACK_5, -EZ2_COL_SPACING*0.5f, NULL },
{ TRACK_6, +EZ2_COL_SPACING*0.5f, NULL },
{ TRACK_7, +EZ2_COL_SPACING*1.5f, NULL },
{ TRACK_6, +EZ2_COL_SPACING*0.5f, NULL },
{ TRACK_7, +EZ2_COL_SPACING*1.5f, NULL },
{ TRACK_8, +EZ2_COL_SPACING*2.5f, NULL },
{ TRACK_9, +EZ2_COL_SPACING*3.5f, NULL },
{ TRACK_10, +EZ2_COL_SPACING*4.5f, NULL },
@@ -1197,8 +1197,8 @@ static const Style g_Style_Ez2_Double =
{ TRACK_3, -EZ2_COL_SPACING*2.5f, NULL },
{ TRACK_4, -EZ2_COL_SPACING*1.5f, NULL },
{ TRACK_5, -EZ2_COL_SPACING*0.5f, NULL },
{ TRACK_6, +EZ2_COL_SPACING*0.5f, NULL },
{ TRACK_7, +EZ2_COL_SPACING*1.5f, NULL },
{ TRACK_6, +EZ2_COL_SPACING*0.5f, NULL },
{ TRACK_7, +EZ2_COL_SPACING*1.5f, NULL },
{ TRACK_8, +EZ2_COL_SPACING*2.5f, NULL },
{ TRACK_9, +EZ2_COL_SPACING*3.5f, NULL },
{ TRACK_10, +EZ2_COL_SPACING*4.5f, NULL },
@@ -2519,7 +2519,7 @@ static const Style g_Style_Guitar_Five =
true, // m_bUsedForEdit
true, // m_bUsedForDemonstration
true, // m_bUsedForHowToPlay
"five", // m_szName
"guitar-five", // m_szName
StepsType_guitar_five, // m_StepsType
StyleType_OnePlayerOneSide, // m_StyleType
5, // m_iColsPerPlayer
@@ -2561,6 +2561,34 @@ static const Style *g_apGame_Guitar_Styles[] =
static const Game g_Game_Guitar =
{
"guitar", // m_szName
g_apGame_Guitar_Styles, // m_apStyles
true, // m_bCountNotesSeparately
true, // m_bAllowHopos
{ // m_InputScheme
"guitar", // m_szName
NUM_GUITAR_BUTTONS, // m_iButtonsPerController
{ // m_szButtonNames
{ "Button Name", GameButton_Invalid },
},
&g_AutoKeyMappings_Guitar
},
{
{ GameButtonType_Step },
{ GameButtonType_Step },
{ GameButtonType_Step },
{ GameButtonType_Step },
{ GameButtonType_Step },
{ GameButtonType_Step },
{ GameButtonType_Step },
{ GameButtonType_Step },
{ GameButtonType_Step },
},
TNS_W1, // m_mapW1To
TNS_W1, // m_mapW2To
TNS_W1, // m_mapW3To
TNS_W1, // m_mapW4To
TNS_Miss, // m_mapW5To
};
*/
/** Karaoke ******************************************************************/
@@ -2903,7 +2931,7 @@ const Style *GameManager::GetFirstCompatibleStyle( const Game *pGame, int iNumPl
FOREACH_CONST( const Style*, vpStyles, s )
if( (*s)->m_StepsType == st )
return *s;
FAIL_M( ssprintf("No compatible styles for %s - %s with %d player%s.", pGame->m_szName,
FAIL_M( ssprintf("No compatible styles for %s - %s with %d player%s.", pGame->m_szName,
GetStepsTypeInfo(st).szName, iNumPlayers, iNumPlayers==1?"":"s") );
return NULL;
}
@@ -2972,12 +3000,13 @@ StepsType GameManager::StringToStepsType( RString sStepsType )
sStepsType.MakeLower();
// TODO: Format specific hacks should be moved into the file loader for that format.
// If i'm assuming this correctly, these only apply to .sm files: -aj
// HACK! We eliminated "ez2-single-hard", but we should still handle it.
// HACK: We eliminated "ez2-single-hard", but we should still handle it.
if( sStepsType == "ez2-single-hard" )
sStepsType = "ez2-single";
// HACK! "para-single" used to be called just "para"
// HACK: "para-single" used to be called just "para"
if( sStepsType == "para" )
sStepsType = "para-single";
+9 -3
View File
@@ -138,11 +138,17 @@ void Inventory::Update( float fDelta )
void Inventory::AwardItem( int iItemIndex )
{
// CPU player is vanity only. It should have no effect on gameplay
// and should not aquire/launch attacks.
/* CPU players and replay data are vanity only. They should not effect
* gameplay by acquiring/launching attacks. */
if( m_pPlayerState->m_PlayerController == PC_CPU )
return;
/*
if( m_pPlayerState->m_PlayerController == PC_CPU ||
m_pPlayerState->m_PlayerController == PC_REPLAY)
{
return;
}
*/
// search for the first open slot
int iOpenSlot = -1;
+4
View File
@@ -74,6 +74,7 @@ void MusicWheel::Load( RString sType )
SHOW_PORTAL .Load(sType,"ShowPortal");
RANDOM_PICKS_LOCKED_SONGS .Load(sType,"RandomPicksLockedSongs");
MOST_PLAYED_SONGS_TO_SHOW .Load(sType,"MostPlayedSongsToShow");
RECENT_SONGS_TO_SHOW .Load(sType,"RecentSongsToShow");
MODE_MENU_CHOICE_NAMES .Load(sType,"ModeMenuChoiceNames");
SORT_ORDERS .Load(sType,"SortOrders");
SHOW_EASY_FLAG .Load(sType,"UseEasyMarkerFlag");
@@ -484,6 +485,9 @@ void MusicWheel::BuildWheelItemDatas( vector<MusicWheelItemData *> &arrayWheelIt
break;
case SORT_RECENT:
SongUtil::SortByMostRecentlyPlayedForMachine( arraySongs );
if( (int) arraySongs.size() > RECENT_SONGS_TO_SHOW )
arraySongs.erase( arraySongs.begin()+RECENT_SONGS_TO_SHOW, arraySongs.end() );
bUseSections = false;
break;
case SORT_BEGINNER_METER:
case SORT_EASY_METER:
+1
View File
@@ -75,6 +75,7 @@ protected:
ThemeMetric<bool> SHOW_PORTAL;
ThemeMetric<bool> RANDOM_PICKS_LOCKED_SONGS;
ThemeMetric<int> MOST_PLAYED_SONGS_TO_SHOW;
ThemeMetric<int> RECENT_SONGS_TO_SHOW;
ThemeMetric<RString> MODE_MENU_CHOICE_NAMES;
ThemeMetricMap<RString> CHOICE;
ThemeMetric1D<RageColor> SECTION_COLORS;
+2 -2
View File
@@ -158,7 +158,7 @@ void MusicWheelItem::LoadFromWheelItemData( const WheelItemBaseData *pData, int
WheelItemBase::LoadFromWheelItemData( pData, iIndex, bHasFocus, iDrawIndex );
const MusicWheelItemData *pWID = dynamic_cast<const MusicWheelItemData*>( pData );
// hide all
FOREACH_ENUM( MusicWheelItemType, i )
{
@@ -186,7 +186,7 @@ void MusicWheelItem::LoadFromWheelItemData( const WheelItemBaseData *pData, int
type = MusicWheelItemType_Song;
m_TextBanner.SetFromSong( pWID->m_pSong );
// We can do this manually..
// We can do this manually if we wanted... maybe have a metric for overrides? -aj
m_TextBanner.SetDiffuse( pWID->m_color );
m_TextBanner.SetVisible( true );
+6 -9
View File
@@ -278,6 +278,7 @@ void NetworkSyncManager::ReportScore(int playerID, int step, int score, int comb
if( !useSMserver ) //Make sure that we are using the network
return;
LOG->Trace( ssprintf("Player ID %i combo = %i", playerID, combo) );
m_packet.ClearPacket();
m_packet.Write1( NSCGSU );
@@ -291,18 +292,15 @@ void NetworkSyncManager::ReportScore(int playerID, int step, int score, int comb
ctr = uint8_t( 112 ); //Code for failed (failed constant seems not to work)
m_packet.Write1( ctr );
m_packet.Write4( score );
m_packet.Write2( (uint16_t)combo );
m_packet.Write2( (uint16_t)m_playerLife[playerID] );
// Offset Info
// Note: if a 0 is sent, then disregard data.
// ASSUMED: No step will be more than 16 seconds off center
// If assumption false: read 16 seconds either direction
// ASSUMED: No step will be more than 16 seconds off center.
// If this assumption is false, read 16 seconds in either direction.
int iOffset = int( (offset+16.384)*2000.0f );
if( iOffset>65535 )
@@ -310,7 +308,7 @@ void NetworkSyncManager::ReportScore(int playerID, int step, int score, int comb
if( iOffset<1 )
iOffset=1;
//Report 0 if hold, or miss (don't forget mines should report)
// Report 0 if hold, or miss (don't forget mines should report)
if( step == SMOST_HITMINE || step > SMOST_W1 )
iOffset = 0;
@@ -390,7 +388,7 @@ void NetworkSyncManager::StartRequest( short position )
ctr = uint8_t( ctr + (int)tSteps->GetDifficulty() );
m_packet.Write1( ctr );
//Notify server if this is for sync or not.
ctr = char( position*16 );
m_packet.Write1( ctr );
@@ -444,7 +442,6 @@ void NetworkSyncManager::StartRequest( short position )
m_packet.ClearPacket();
while (dontExit)
{
m_packet.ClearPacket();
@@ -494,7 +491,7 @@ void NetworkSyncManager::Update(float fDeltaTime)
{
NetServerInfo ThisServer;
BroadIn.Position = 0;
if ( BroadIn.Read1() == 141 )
if ( BroadIn.Read1() == 141 ) // SMLS_Info?
{
ThisServer.Name = BroadIn.ReadNT();
int port = BroadIn.Read2();
+15 -14
View File
@@ -13,23 +13,24 @@ const int NETPROTOCOLVERSION=3;
const int NETMAXBUFFERSIZE=1020; //1024 - 4 bytes for EzSockets
const int NETNUMTAPSCORES=8;
// [SMLClientCommands name]
enum NSCommand
{
NSCPing = 0,
NSCPingR, //1
NSCHello, //2
NSCGSR, //3
NSCGON, //4
NSCGSU, //5
NSCSU, //6
NSCCM, //7
NSCRSG, //8
NSCUUL, //9
NSCSMS, //10
NSCUPOpts, //11
NSCSMOnline, //12
NSCFormatted, //13
NSCAttack, //14
NSCPingR, // 1 [SMLC_PingR]
NSCHello, // 2 [SMLC_Hello]
NSCGSR, // 3 [SMLC_GameStart]
NSCGON, // 4 [SMLC_GameOver]
NSCGSU, // 5 [SMLC_GameStatusUpdate]
NSCSU, // 6 [SMLC_StyleUpdate]
NSCCM, // 7 [SMLC_Chat]
NSCRSG, // 8 [SMLC_RequestStart]
NSCUUL, // 9 [SMLC_Reserved1]
NSCSMS, // 10 [SMLC_MusicSelect]
NSCUPOpts, // 11 [SMLC_PlayerOpts]
NSCSMOnline, // 12 [SMLC_SMO]
NSCFormatted, // 13 [SMLC_RESERVED1]
NSCAttack, // 14 [SMLC_RESERVED2]
NUM_NS_COMMANDS
};
+2 -1
View File
@@ -517,7 +517,7 @@ void ScreenGameplay::Init()
pi->m_pLifeMeter->Load( pi->GetPlayerState(), pi->GetPlayerStageStats() );
pi->m_pLifeMeter->SetName( ssprintf("Life%s",pi->GetName().c_str()) );
LOAD_ALL_COMMANDS_AND_SET_XY( pi->m_pLifeMeter );
this->AddChild( pi->m_pLifeMeter );
this->AddChild( pi->m_pLifeMeter );
}
break;
case PLAY_MODE_BATTLE:
@@ -2757,6 +2757,7 @@ void ScreenGameplay::SaveReplay()
FOREACH_EnabledPlayerInfo( m_vPlayerInfo, pi )
{
XNode *p = new XNode("ReplayData");
// todo: add version number, since this will change in the future -aj
// song information node
SongID songID;
+2 -2
View File
@@ -32,7 +32,7 @@ namespace
void ScreenMiniMenu::MiniMenu( const MenuDef* pDef, ScreenMessage SM_SendOnOK, ScreenMessage SM_SendOnCancel, float fX, float fY )
{
PrepareToLoadScreen( pDef->sClassName );
g_pMenuDef = pDef;
g_SendOnOK = SM_SendOnOK;
g_SendOnCancel = SM_SendOnCancel;
@@ -97,7 +97,7 @@ void ScreenMiniMenu::AfterChangeValueOrRow( PlayerNumber pn )
vpns.push_back( p );
for( unsigned i=0; i<m_pRows.size(); i++ )
ExportOptions( i, vpns );
// Changing one option can affect whether other options are available.
for( unsigned i=0; i<m_pRows.size(); i++ )
{
+5 -5
View File
@@ -11,14 +11,14 @@ typedef bool (*MenuRowUpdateEnabled)();
struct MenuRowDef
{
int iRowCode;
RString sName;
bool bEnabled;
RString sName;
bool bEnabled;
MenuRowUpdateEnabled pfnEnabled; // if ! NULL, used instead of bEnabled
EditMode emShowIn;
EditMode emShowIn;
int iDefaultChoice;
vector<RString> choices;
bool bThemeTitle;
bool bThemeItems;
bool bThemeTitle;
bool bThemeItems;
MenuRowDef() {}
MenuRowDef( int r, RString n, MenuRowUpdateEnabled pe, EditMode s, bool bTT, bool bTI, int d, const char *c0=NULL, const char *c1=NULL, const char *c2=NULL, const char *c3=NULL, const char *c4=NULL, const char *c5=NULL, const char *c6=NULL, const char *c7=NULL, const char *c8=NULL, const char *c9=NULL, const char *c10=NULL, const char *c11=NULL, const char *c12=NULL, const char *c13=NULL, const char *c14=NULL, const char *c15=NULL, const char *c16=NULL, const char *c17=NULL, const char *c18=NULL, const char *c19=NULL, const char *c20=NULL, const char *c21=NULL, const char *c22=NULL, const char *c23=NULL, const char *c24=NULL, const char *c25=NULL )
+1 -1
View File
@@ -114,7 +114,7 @@ void ScreenWithMenuElements::Init()
this->AddChild( &m_Cancel );
LOAD_ALL_COMMANDS( m_Cancel );
/* Grab the music path here; don't GetPath during BeginScreen. */
// Grab the music path here; don't GetPath during BeginScreen.
if( PLAY_MUSIC )
m_sPathToMusic = THEME->GetPathS( m_sName, "music" );
}
+3 -5
View File
@@ -596,7 +596,7 @@ RString SongUtil::GetSectionNameFromSongAndSort( const Song* pSong, SortOrder so
return ssprintf( "%s-%s", SecondsToMMSS(iMinLength).c_str(), SecondsToMMSS(iMaxLength).c_str() );
}
case SORT_POPULARITY:
case SORT_RECENT: // todo: make recent split into two groups: top X, and "the rest" -aj
case SORT_RECENT:
return RString();
case SORT_TOP_GRADES:
{
@@ -740,7 +740,7 @@ RString SongUtil::MakeUniqueEditDescription( const Song *pSong, StepsType st, co
if( IsEditDescriptionUnique(pSong, st, sTemp, NULL) )
return sTemp;
}
// Edit limit guards should keep us from ever having more than 1000 edits per song.
ASSERT(0);
return RString();
@@ -800,7 +800,6 @@ bool SongUtil::ValidateCurrentStepsDescription( const RString &sAnswer, RString
if( pSteps->GetDescription() == sAnswer )
return true;
if( pSteps->IsAnEdit() )
{
return SongUtil::ValidateCurrentEditStepsDescription( sAnswer, sErrorOut );
@@ -869,8 +868,7 @@ void SongUtil::GetPlayableStepsTypes( const Song *pSong, set<StepsType> &vOut )
vStepsTypes.insert( (*s)->m_StepsType );
/* filter out hidden StepsTypes, and remove steps that we don't
* have enough stages left to play.
*/
* have enough stages left to play. */
// this being const may have caused some problems... -aj
const vector<StepsType> &vstToShow = CommonMetrics::STEPS_TYPES_TO_SHOW.GetValue();
FOREACHS( StepsType, vStepsTypes, st )