Added versus comparison functionality, tentative
authorMark Cannon <vyhdycokio@gmail.com>
Tue, 20 May 2008 03:01:36 +0000 (03:01 +0000)
committerMark Cannon <vyhdycokio@gmail.com>
Tue, 20 May 2008 03:01:36 +0000 (03:01 +0000)
git-svn-id: https://openitg.svn.sourceforge.net/svnroot/openitg@340 83fadc84-e282-4d84-a09a-c4228d6ae7e5

ToDo.txt
changelog.txt
src/ScreenGameplay.cpp
src/ScreenGameplay.h

index b32611a..6d20e83 100644 (file)
--- a/ToDo.txt
+++ b/ToDo.txt
@@ -2,7 +2,7 @@
 \r
 /* Major bug fixing */\r
 -X11 full-screen causes scrolling brackets + desktop resize\r
--Switching from free to home on the main menu causes OpenITG to hang\r
+-Switching modes on the main menu causes OpenITG to hang\r
 \r
 /* Things to test on the arcade */\r
 -See if separate coin counters have separate bit mappings\r
@@ -16,7 +16,6 @@
 -Include ThemeInfo.ini support\r
 -Add Windows code for network diagnostics\r
 -Implement "CustomSongsUseGraphics" (use song BG/banner, not fallbacks)\r
--Implement colors percentages in Versus to show who's ahead\r
 \r
 /* Major feature additions */\r
 -Implement custom courses from USB drive\r
index bd0aeea..2bb37a5 100755 (executable)
@@ -1,17 +1,19 @@
 OpenITG, alpha 6 (in development)
 ---------------------------------
--Feature addition:
-    Added the feature "Clear Credits". It works the same as
-    Insert Credit does in the operators menu. You can add it
-    in the theme if you can figure out how Insert Credit works.
-    The command is simply "ClearCredits".
 -Code structure changes:
     Reverted InputFilter - too little gain for too many problems
     Backported and modified 4.0's X11 code (Linux window/input)
+-New metrics in ScreenGameplay (event mode, same difficulty, versus):
+    "ScorePxAheadCommand" - played when player's score is higher
+    "ScorePxBehindCommand" - played when player's score is lower
+-New game commands:
+    "clearcredits" - clears credits on the machine (useful for testing)
 -Fixed bugs:
+    Editor eats Edit charts
     Some custom songs end immediately after start
     Repeating menu input error on ScreenSelectMusic
     Editor doesn't draw properly, causes failed asserts
+    Song wheel doesn't "budge" when attempting to move ofter Chance
     "Revert from Disk" in editor causes duplicate charts, crashes
 
 OpenITG, alpha 5 (April 30th, 2008)
index de20a01..f5a0ee5 100755 (executable)
@@ -161,6 +161,14 @@ void ScreenGameplay::Init()
                        GAMESTATE->SaveCurrentSettingsToProfile(pn);
        }
 
+       /* See if we should be comparing scores during updates: we only do this
+        * during versus in event mode, if both players have the same difficulty */
+
+       m_bCompareScores = GAMESTATE->IsEventMode() && GAMESTATE->GetCurrentStyle()->m_StyleType == TWO_PLAYERS_TWO_SIDES &&
+               GAMESTATE->m_pCurSteps[PLAYER_1]->GetDifficulty() == GAMESTATE->m_pCurSteps[PLAYER_2]->GetDifficulty();
+
+       m_LeadingPlayer = PLAYER_INVALID;
+
        /* Called once per stage (single song or single course). */
        GAMESTATE->BeginStage();
 
@@ -1204,6 +1212,44 @@ void ScreenGameplay::PauseGame( bool bPause, GameController gc )
                m_Player[p].SetPaused( m_bPaused );
 }
 
+void ScreenGameplay::CompareScores()
+{
+       if( !m_bCompareScores )
+               return;
+
+       static float fP1Score, fP2Score;
+       PlayerNumber pn_higher;
+       
+       fP1Score = STATSMAN->m_CurStageStats.m_player[PLAYER_1].GetPercentDancePoints();
+       fP2Score = STATSMAN->m_CurStageStats.m_player[PLAYER_2].GetPercentDancePoints();
+
+       if( fP1Score != fP2Score )
+               pn_higher = fP1Score > fP2Score ? PLAYER_1 : PLAYER_2;
+       else
+               pn_higher = PLAYER_INVALID; /* a bit hacky...used to mark ties. */
+
+       if( m_LeadingPlayer == pn_higher )
+               return;
+
+       m_LeadingPlayer = pn_higher;
+
+       /* mark the secondary player as ahead, too */
+       if( pn_higher == PLAYER_INVALID )
+       {
+               FOREACH_EnabledPlayer( p )
+                       if( p != pn_higher ) m_pPrimaryScoreDisplay[p]->PlayCommand( "Ahead" );
+
+               return;
+       }
+
+       /* set each player accordingly */
+       FOREACH_EnabledPlayer( p )
+               m_pPrimaryScoreDisplay[p]->PlayCommand( (p == pn_higher) ? "Ahead" : "Behind" );
+}
+
+       
+
+
 // play assist ticks
 void ScreenGameplay::PlayTicks()
 {
@@ -1651,6 +1697,8 @@ void ScreenGameplay::Update( float fDeltaTime )
                m_BPMDisplay.SetConstantBpm( GAMESTATE->m_fCurBPS * 60.0f );
        }
 
+       CompareScores();
+
        PlayTicks();
 
        UpdateLights();
index 5930feb..ffa0b25 100755 (executable)
@@ -72,6 +72,7 @@ protected:
        void SendCrossedMessages();
        void BackOutFromGameplay();
 
+       void CompareScores();
        void PlayTicks();
        void UpdateSongPosition( float fDeltaTime );
        void UpdateLyrics( float fDeltaTime );
@@ -170,6 +171,10 @@ protected:
        BeginnerHelper  m_BeginnerHelper;
 
        NoteData                m_CabinetLightsNoteData;
+
+       /* used for Event Mode comparison messages */
+       bool                    m_bCompareScores;
+       PlayerNumber            m_LeadingPlayer;
 };