struct -> class

This commit is contained in:
Chris Danford
2005-08-23 20:49:30 +00:00
parent 20bb281e18
commit 5a19510ead
20 changed files with 60 additions and 29 deletions
+1 -1
View File
@@ -2,7 +2,7 @@
#define ACTIVE_ATTACK_LIST_H #define ACTIVE_ATTACK_LIST_H
#include "BitmapText.h" #include "BitmapText.h"
struct PlayerState; class PlayerState;
class ActiveAttackList : public BitmapText class ActiveAttackList : public BitmapText
{ {
+1 -1
View File
@@ -3,7 +3,7 @@
#ifndef ARROWEFFECTS_H #ifndef ARROWEFFECTS_H
#define ARROWEFFECTS_H #define ARROWEFFECTS_H
struct PlayerState; class PlayerState;
class ArrowEffects class ArrowEffects
{ {
+1 -1
View File
@@ -4,7 +4,7 @@
#include "GameConstantsAndTypes.h" #include "GameConstantsAndTypes.h"
#include "PlayerNumber.h" #include "PlayerNumber.h"
class Song; class Song;
struct PlayerState; class PlayerState;
struct Attack struct Attack
{ {
+1 -1
View File
@@ -6,7 +6,7 @@
#include "GameConstantsAndTypes.h" // for TapNoteScore #include "GameConstantsAndTypes.h" // for TapNoteScore
#include "RageTexturePreloader.h" #include "RageTexturePreloader.h"
struct PlayerState; class PlayerState;
class AttackDisplay : public ActorFrame class AttackDisplay : public ActorFrame
{ {
+2 -2
View File
@@ -8,8 +8,8 @@
#include "BitmapText.h" #include "BitmapText.h"
#include "PlayerNumber.h" #include "PlayerNumber.h"
#include "ThemeMetric.h" #include "ThemeMetric.h"
struct PlayerState; class PlayerState;
struct PlayerStageStats; class PlayerStageStats;
class Combo : public ActorFrame class Combo : public ActorFrame
{ {
+2 -2
View File
@@ -4,8 +4,8 @@
#include "ActorFrame.h" #include "ActorFrame.h"
#include "PlayerNumber.h" #include "PlayerNumber.h"
struct StageStats; class StageStats;
struct PlayerStageStats; class PlayerStageStats;
class ComboGraph: public ActorFrame class ComboGraph: public ActorFrame
{ {
+1 -1
View File
@@ -8,7 +8,7 @@
#include "HoldGhostArrow.h" #include "HoldGhostArrow.h"
#include "GameConstantsAndTypes.h" #include "GameConstantsAndTypes.h"
struct PlayerState; class PlayerState;
class GhostArrowRow : public ActorFrame class GhostArrowRow : public ActorFrame
{ {
+2 -2
View File
@@ -5,8 +5,8 @@
#include "RageTexture.h" #include "RageTexture.h"
#include "AutoActor.h" #include "AutoActor.h"
struct StageStats; class StageStats;
struct PlayerStageStats; class PlayerStageStats;
class GraphDisplay: public ActorFrame class GraphDisplay: public ActorFrame
{ {
+1 -1
View File
@@ -7,7 +7,7 @@
#include "PlayerNumber.h" #include "PlayerNumber.h"
#include "RageSound.h" #include "RageSound.h"
struct PlayerState; class PlayerState;
class Inventory : public Actor class Inventory : public Actor
{ {
+1 -1
View File
@@ -9,7 +9,7 @@ class Model;
struct HoldNoteResult; struct HoldNoteResult;
struct NoteMetricCache_t; struct NoteMetricCache_t;
struct PlayerState; class PlayerState;
#define NOTE_COLOR_IMAGES 8 #define NOTE_COLOR_IMAGES 8
+2 -1
View File
@@ -10,8 +10,9 @@ class Steps;
struct lua_State; struct lua_State;
struct PlayerStageStats class PlayerStageStats
{ {
public:
PlayerStageStats() { Init(); } PlayerStageStats() { Init(); }
void Init(); void Init();
+4 -1
View File
@@ -8,11 +8,13 @@
#include <map> #include <map>
#include "Attack.h" #include "Attack.h"
struct PlayerState class PlayerState
{ {
public:
PlayerState() PlayerState()
{ {
m_PlayerNumber = PLAYER_INVALID; m_PlayerNumber = PLAYER_INVALID;
m_mp = MultiPlayer_INVALID;
Reset(); Reset();
} }
void Reset() void Reset()
@@ -51,6 +53,7 @@ struct PlayerState
// in PlayerState and callers should not use PlayerNumber to index into // in PlayerState and callers should not use PlayerNumber to index into
// GameState. // GameState.
PlayerNumber m_PlayerNumber; PlayerNumber m_PlayerNumber;
MultiPlayer m_mp;
PlayerOptions m_CurrentPlayerOptions; // current approaches destination PlayerOptions m_CurrentPlayerOptions; // current approaches destination
+1 -1
View File
@@ -8,7 +8,7 @@
#include "PlayerNumber.h" #include "PlayerNumber.h"
#include "GameConstantsAndTypes.h" #include "GameConstantsAndTypes.h"
struct PlayerState; class PlayerState;
class ReceptorArrow : public ActorFrame class ReceptorArrow : public ActorFrame
{ {
+1 -1
View File
@@ -8,7 +8,7 @@
#include "GameConstantsAndTypes.h" #include "GameConstantsAndTypes.h"
#include "NoteTypes.h" #include "NoteTypes.h"
struct PlayerState; class PlayerState;
class ReceptorArrowRow : public ActorFrame class ReceptorArrowRow : public ActorFrame
{ {
+2 -2
View File
@@ -17,8 +17,8 @@ class NoteData;
class Inventory; class Inventory;
class Song; class Song;
class Steps; class Steps;
struct PlayerState; class PlayerState;
struct PlayerStageStats; class PlayerStageStats;
class ScoreKeeper class ScoreKeeper
+1 -1
View File
@@ -414,7 +414,7 @@ void ScreenNameEntryTraditional::Init()
SET_ON( display.m_DifficultyMeter ); SET_ON( display.m_DifficultyMeter );
this->AddChild( &display.m_DifficultyMeter ); this->AddChild( &display.m_DifficultyMeter );
display.m_textScore.Load( p, &ss.m_player[p], "ScreenNameEntryTraditional Percent", false ); display.m_textScore.Load( GAMESTATE->m_pPlayerState[p], &ss.m_player[p], "ScreenNameEntryTraditional Percent", false );
display.m_textScore.SetName( ssprintf("ScoreP%i",p+1) ); display.m_textScore.SetName( ssprintf("ScoreP%i",p+1) );
SET_ON( display.m_textScore ); SET_ON( display.m_textScore );
this->AddChild( &display.m_textScore ); this->AddChild( &display.m_textScore );
+19 -4
View File
@@ -36,6 +36,21 @@ void StageStats::AssertValid( PlayerNumber pn ) const
ASSERT( vpPossibleSongs.size() == m_player[pn].vpPossibleSteps.size() ); ASSERT( vpPossibleSongs.size() == m_player[pn].vpPossibleSteps.size() );
} }
void StageStats::AssertValid( MultiPlayer pn ) const
{
ASSERT( vpPlayedSongs.size() != 0 );
ASSERT( vpPossibleSongs.size() != 0 );
if( vpPlayedSongs[0] )
CHECKPOINT_M( vpPlayedSongs[0]->GetTranslitFullTitle() );
ASSERT( m_multiPlayer[pn].vpPlayedSteps.size() != 0 );
ASSERT( m_multiPlayer[pn].vpPlayedSteps[0] );
ASSERT_M( playMode < NUM_PLAY_MODES, ssprintf("playmode %i", playMode) );
ASSERT( pStyle != NULL );
ASSERT_M( m_player[pn].vpPlayedSteps[0]->GetDifficulty() < NUM_DIFFICULTIES, ssprintf("difficulty %i", m_player[pn].vpPlayedSteps[0]->GetDifficulty()) );
ASSERT( vpPlayedSongs.size() == m_player[pn].vpPlayedSteps.size() );
ASSERT( vpPossibleSongs.size() == m_player[pn].vpPossibleSteps.size() );
}
int StageStats::GetAverageMeter( PlayerNumber pn ) const int StageStats::GetAverageMeter( PlayerNumber pn ) const
{ {
@@ -65,13 +80,13 @@ void StageStats::AddStats( const StageStats& other )
fGameplaySeconds += other.fGameplaySeconds; fGameplaySeconds += other.fGameplaySeconds;
fStepsSeconds += other.fStepsSeconds; fStepsSeconds += other.fStepsSeconds;
FOREACH_PlayerNumber( p ) FOREACH_EnabledMultiPlayer( p )
m_player[p].AddStats( other.m_player[p] ); m_player[p].AddStats( other.m_player[p] );
} }
bool StageStats::OnePassed() const bool StageStats::OnePassed() const
{ {
FOREACH_HumanPlayer( p ) FOREACH_EnabledMultiPlayer( p )
if( !m_player[p].bFailed ) if( !m_player[p].bFailed )
return true; return true;
return false; return false;
@@ -79,7 +94,7 @@ bool StageStats::OnePassed() const
bool StageStats::AllFailed() const bool StageStats::AllFailed() const
{ {
FOREACH_EnabledPlayer( pn ) FOREACH_EnabledMultiPlayer( pn )
if( !m_player[pn].bFailed ) if( !m_player[pn].bFailed )
return false; return false;
return true; return true;
@@ -87,7 +102,7 @@ bool StageStats::AllFailed() const
bool StageStats::AllFailedEarlier() const bool StageStats::AllFailedEarlier() const
{ {
FOREACH_EnabledPlayer( p ) FOREACH_EnabledMultiPlayer( p )
if( !m_player[p].bFailedEarlier ) if( !m_player[p].bFailedEarlier )
return false; return false;
return true; return true;
+4 -1
View File
@@ -10,12 +10,14 @@ class Style;
struct lua_State; struct lua_State;
struct StageStats class StageStats
{ {
public:
StageStats(); StageStats();
void Init(); void Init();
void AssertValid( PlayerNumber pn ) const; void AssertValid( PlayerNumber pn ) const;
void AssertValid( MultiPlayer mp ) const;
void AddStats( const StageStats& other ); // accumulate void AddStats( const StageStats& other ); // accumulate
@@ -40,6 +42,7 @@ struct StageStats
float GetTotalPossibleStepsSeconds() const; // TODO: Scale this by the music rate float GetTotalPossibleStepsSeconds() const; // TODO: Scale this by the music rate
PlayerStageStats m_player[NUM_PLAYERS]; PlayerStageStats m_player[NUM_PLAYERS];
PlayerStageStats m_multiPlayer[NUM_MultiPlayer];
// Lua // Lua
void PushSelf( lua_State *L ); void PushSelf( lua_State *L );
+11 -4
View File
@@ -46,15 +46,22 @@ StageStats AccumStageStats( const vector<StageStats>& vss )
* and the rest, which are counters. */ * and the rest, which are counters. */
// FIXME: Weight each song by the number of stages it took to account for // FIXME: Weight each song by the number of stages it took to account for
// long, marathon. // long, marathon.
FOREACH_EnabledPlayer( pn ) FOREACH_EnabledPlayer( p )
{ {
for( int r = 0; r < RADAR_NUM_TAPS_AND_HOLDS; r++) for( int r = 0; r < RADAR_NUM_TAPS_AND_HOLDS; r++)
{ {
ssreturn.m_player[pn].radarPossible[r] /= uNumSongs; ssreturn.m_player[p].radarPossible[r] /= uNumSongs;
ssreturn.m_player[pn].radarActual[r] /= uNumSongs; ssreturn.m_player[p].radarActual[r] /= uNumSongs;
}
}
FOREACH_EnabledMultiPlayer( p )
{
for( int r = 0; r < RADAR_NUM_TAPS_AND_HOLDS; r++)
{
ssreturn.m_multiPlayer[p].radarPossible[r] /= uNumSongs;
ssreturn.m_multiPlayer[p].radarActual[r] /= uNumSongs;
} }
} }
return ssreturn; return ssreturn;
} }
+2
View File
@@ -25,6 +25,8 @@
void Style::GetTransformedNoteDataForStyle( PlayerNumber pn, const NoteData& original, NoteData& noteDataOut ) const void Style::GetTransformedNoteDataForStyle( PlayerNumber pn, const NoteData& original, NoteData& noteDataOut ) const
{ {
ASSERT( pn >=0 && pn <= NUM_PLAYERS );
int iNewToOriginalTrack[MAX_COLS_PER_PLAYER]; int iNewToOriginalTrack[MAX_COLS_PER_PLAYER];
for( int col=0; col<m_iColsPerPlayer; col++ ) for( int col=0; col<m_iColsPerPlayer; col++ )
{ {