Move some player-specific data out of the bloated GameState class.
Have gameplay objects hold a PlayerState pointer instead of a PlayerNumber and indexing back into GameState. This will simplify off-screen players (e.g. CPU ghosts, network replicated human players, >2 players using one NoteField)
This commit is contained in:
@@ -4,23 +4,25 @@
|
|||||||
#include "GameState.h"
|
#include "GameState.h"
|
||||||
#include "Inventory.h"
|
#include "Inventory.h"
|
||||||
#include "RageTimer.h"
|
#include "RageTimer.h"
|
||||||
|
#include "PlayerOptions.h"
|
||||||
|
#include "PlayerState.h"
|
||||||
|
|
||||||
|
|
||||||
ActiveAttackList::ActiveAttackList()
|
ActiveAttackList::ActiveAttackList()
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
void ActiveAttackList::Init( PlayerNumber pn )
|
void ActiveAttackList::Init( const PlayerState* pPlayerState )
|
||||||
{
|
{
|
||||||
m_PlayerNumber = pn;
|
m_pPlayerState = pPlayerState;
|
||||||
}
|
}
|
||||||
|
|
||||||
void ActiveAttackList::Update( float fDelta )
|
void ActiveAttackList::Update( float fDelta )
|
||||||
{
|
{
|
||||||
bool bTimeToRefresh =
|
bool bTimeToRefresh =
|
||||||
IsFirstUpdate() || // check this before running Actor::Update()
|
IsFirstUpdate() || // check this before running Actor::Update()
|
||||||
GAMESTATE->m_bAttackBeganThisUpdate[m_PlayerNumber] ||
|
m_pPlayerState->m_bAttackBeganThisUpdate ||
|
||||||
GAMESTATE->m_bAttackEndedThisUpdate[m_PlayerNumber];
|
m_pPlayerState->m_bAttackEndedThisUpdate;
|
||||||
|
|
||||||
BitmapText::Update( fDelta );
|
BitmapText::Update( fDelta );
|
||||||
|
|
||||||
@@ -32,7 +34,7 @@ void ActiveAttackList::Refresh()
|
|||||||
{
|
{
|
||||||
CString s;
|
CString s;
|
||||||
|
|
||||||
const AttackArray& attacks = GAMESTATE->m_ActiveAttacks[m_PlayerNumber]; // NUM_INVENTORY_SLOTS
|
const AttackArray& attacks = m_pPlayerState->m_ActiveAttacks;
|
||||||
|
|
||||||
// clear all lines, then add all active attacks
|
// clear all lines, then add all active attacks
|
||||||
for( unsigned i=0; i<attacks.size(); i++ )
|
for( unsigned i=0; i<attacks.size(); i++ )
|
||||||
|
|||||||
@@ -2,22 +2,21 @@
|
|||||||
#define ACTIVE_ATTACK_LIST_H
|
#define ACTIVE_ATTACK_LIST_H
|
||||||
|
|
||||||
#include "BitmapText.h"
|
#include "BitmapText.h"
|
||||||
#include "PlayerNumber.h"
|
struct PlayerState;
|
||||||
|
|
||||||
|
|
||||||
class ActiveAttackList : public BitmapText
|
class ActiveAttackList : public BitmapText
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
ActiveAttackList();
|
ActiveAttackList();
|
||||||
|
|
||||||
void Init( PlayerNumber pn );
|
void Init( const PlayerState* pPlayerState );
|
||||||
|
|
||||||
virtual void Update( float fDelta );
|
virtual void Update( float fDelta );
|
||||||
|
|
||||||
void Refresh();
|
void Refresh();
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
PlayerNumber m_PlayerNumber;
|
const PlayerState* m_pPlayerState;
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|||||||
@@ -3,63 +3,65 @@
|
|||||||
#include "Steps.h"
|
#include "Steps.h"
|
||||||
#include "GameConstantsAndTypes.h"
|
#include "GameConstantsAndTypes.h"
|
||||||
#include "GameManager.h"
|
#include "GameManager.h"
|
||||||
#include "GameState.h"
|
|
||||||
#include "RageException.h"
|
#include "RageException.h"
|
||||||
#include "RageTimer.h"
|
#include "RageTimer.h"
|
||||||
#include "NoteDisplay.h"
|
#include "NoteDisplay.h"
|
||||||
#include "song.h"
|
#include "song.h"
|
||||||
#include "RageMath.h"
|
#include "RageMath.h"
|
||||||
#include "ScreenDimensions.h"
|
#include "ScreenDimensions.h"
|
||||||
|
#include "PlayerState.h"
|
||||||
|
#include "GameState.h"
|
||||||
|
#include "Style.h"
|
||||||
|
|
||||||
const float ARROW_SPACING = ARROW_SIZE;// + 2;
|
const float ARROW_SPACING = ARROW_SIZE;// + 2;
|
||||||
|
|
||||||
float g_fExpandSeconds = 0;
|
float g_fExpandSeconds = 0;
|
||||||
|
|
||||||
static float GetNoteFieldHeight( PlayerNumber pn )
|
static float GetNoteFieldHeight( const PlayerState* pPlayerState )
|
||||||
{
|
{
|
||||||
return SCREEN_HEIGHT + fabsf(GAMESTATE->m_CurrentPlayerOptions[pn].m_fPerspectiveTilt)*200;
|
return SCREEN_HEIGHT + fabsf(pPlayerState->m_CurrentPlayerOptions.m_fPerspectiveTilt)*200;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* For visibility testing: if bAbsolute is false, random modifiers must return the
|
/* For visibility testing: if bAbsolute is false, random modifiers must return the
|
||||||
* minimum possible scroll speed. */
|
* minimum possible scroll speed. */
|
||||||
float ArrowGetYOffset( PlayerNumber pn, int iCol, float fNoteBeat, bool bAbsolute )
|
float ArrowEffects::GetYOffset( const PlayerState* pPlayerState, int iCol, float fNoteBeat, bool bAbsolute )
|
||||||
{
|
{
|
||||||
float fYOffset = 0;
|
float fYOffset = 0;
|
||||||
|
|
||||||
/* Usually, fTimeSpacing is 0 or 1, in which case we use entirely beat spacing or
|
/* Usually, fTimeSpacing is 0 or 1, in which case we use entirely beat spacing or
|
||||||
* entirely time spacing (respectively). Occasionally, we tween between them. */
|
* entirely time spacing (respectively). Occasionally, we tween between them. */
|
||||||
if( GAMESTATE->m_CurrentPlayerOptions[pn].m_fTimeSpacing != 1.0f )
|
if( pPlayerState->m_CurrentPlayerOptions.m_fTimeSpacing != 1.0f )
|
||||||
{
|
{
|
||||||
float fSongBeat = GAMESTATE->m_fSongBeat;
|
float fSongBeat = GAMESTATE->m_fSongBeat;
|
||||||
float fBeatsUntilStep = fNoteBeat - fSongBeat;
|
float fBeatsUntilStep = fNoteBeat - fSongBeat;
|
||||||
float fYOffsetBeatSpacing = fBeatsUntilStep * ARROW_SPACING;
|
float fYOffsetBeatSpacing = fBeatsUntilStep * ARROW_SPACING;
|
||||||
fYOffset += fYOffsetBeatSpacing * (1-GAMESTATE->m_CurrentPlayerOptions[pn].m_fTimeSpacing);
|
fYOffset += fYOffsetBeatSpacing * (1-pPlayerState->m_CurrentPlayerOptions.m_fTimeSpacing);
|
||||||
}
|
}
|
||||||
|
|
||||||
if( GAMESTATE->m_CurrentPlayerOptions[pn].m_fTimeSpacing != 0.0f )
|
if( pPlayerState->m_CurrentPlayerOptions.m_fTimeSpacing != 0.0f )
|
||||||
{
|
{
|
||||||
float fSongSeconds = GAMESTATE->m_fMusicSeconds;
|
float fSongSeconds = GAMESTATE->m_fMusicSeconds;
|
||||||
float fNoteSeconds = GAMESTATE->m_pCurSong->GetElapsedTimeFromBeat(fNoteBeat);
|
float fNoteSeconds = GAMESTATE->m_pCurSong->GetElapsedTimeFromBeat(fNoteBeat);
|
||||||
float fSecondsUntilStep = fNoteSeconds - fSongSeconds;
|
float fSecondsUntilStep = fNoteSeconds - fSongSeconds;
|
||||||
float fBPM = GAMESTATE->m_CurrentPlayerOptions[pn].m_fScrollBPM;
|
float fBPM = pPlayerState->m_CurrentPlayerOptions.m_fScrollBPM;
|
||||||
float fBPS = fBPM/60.f;
|
float fBPS = fBPM/60.f;
|
||||||
float fYOffsetTimeSpacing = fSecondsUntilStep * fBPS * ARROW_SPACING;
|
float fYOffsetTimeSpacing = fSecondsUntilStep * fBPS * ARROW_SPACING;
|
||||||
fYOffset += fYOffsetTimeSpacing * GAMESTATE->m_CurrentPlayerOptions[pn].m_fTimeSpacing;
|
fYOffset += fYOffsetTimeSpacing * pPlayerState->m_CurrentPlayerOptions.m_fTimeSpacing;
|
||||||
}
|
}
|
||||||
|
|
||||||
// don't mess with the arrows after they've crossed 0
|
// don't mess with the arrows after they've crossed 0
|
||||||
if( fYOffset < 0 )
|
if( fYOffset < 0 )
|
||||||
return fYOffset * GAMESTATE->m_CurrentPlayerOptions[pn].m_fScrollSpeed;
|
return fYOffset * pPlayerState->m_CurrentPlayerOptions.m_fScrollSpeed;
|
||||||
|
|
||||||
const float* fAccels = GAMESTATE->m_CurrentPlayerOptions[pn].m_fAccels;
|
const float* fAccels = pPlayerState->m_CurrentPlayerOptions.m_fAccels;
|
||||||
//const float* fEffects = GAMESTATE->m_CurrentPlayerOptions[pn].m_fEffects;
|
//const float* fEffects = pPlayerState->m_CurrentPlayerOptions.m_fEffects;
|
||||||
|
|
||||||
|
|
||||||
float fYAdjust = 0; // fill this in depending on PlayerOptions
|
float fYAdjust = 0; // fill this in depending on PlayerOptions
|
||||||
|
|
||||||
if( fAccels[PlayerOptions::ACCEL_BOOST] > 0 )
|
if( fAccels[PlayerOptions::ACCEL_BOOST] > 0 )
|
||||||
{
|
{
|
||||||
float fEffectHeight = GetNoteFieldHeight(pn);
|
float fEffectHeight = GetNoteFieldHeight(pPlayerState);
|
||||||
float fNewYOffset = fYOffset * 1.5f / ((fYOffset+fEffectHeight/1.2f)/fEffectHeight);
|
float fNewYOffset = fYOffset * 1.5f / ((fYOffset+fEffectHeight/1.2f)/fEffectHeight);
|
||||||
float fAccelYAdjust = fAccels[PlayerOptions::ACCEL_BOOST] * (fNewYOffset - fYOffset);
|
float fAccelYAdjust = fAccels[PlayerOptions::ACCEL_BOOST] * (fNewYOffset - fYOffset);
|
||||||
// TRICKY: Clamp this value, or else BOOST+BOOMERANG will draw a ton of arrows on the screen.
|
// TRICKY: Clamp this value, or else BOOST+BOOMERANG will draw a ton of arrows on the screen.
|
||||||
@@ -68,7 +70,7 @@ float ArrowGetYOffset( PlayerNumber pn, int iCol, float fNoteBeat, bool bAbsolut
|
|||||||
}
|
}
|
||||||
if( fAccels[PlayerOptions::ACCEL_BRAKE] > 0 )
|
if( fAccels[PlayerOptions::ACCEL_BRAKE] > 0 )
|
||||||
{
|
{
|
||||||
float fEffectHeight = GetNoteFieldHeight(pn);
|
float fEffectHeight = GetNoteFieldHeight(pPlayerState);
|
||||||
float fScale = SCALE( fYOffset, 0.f, fEffectHeight, 0, 1.f );
|
float fScale = SCALE( fYOffset, 0.f, fEffectHeight, 0, 1.f );
|
||||||
float fNewYOffset = fYOffset * fScale;
|
float fNewYOffset = fYOffset * fScale;
|
||||||
float fBrakeYAdjust = fAccels[PlayerOptions::ACCEL_BRAKE] * (fNewYOffset - fYOffset);
|
float fBrakeYAdjust = fAccels[PlayerOptions::ACCEL_BRAKE] * (fNewYOffset - fYOffset);
|
||||||
@@ -84,8 +86,8 @@ float ArrowGetYOffset( PlayerNumber pn, int iCol, float fNoteBeat, bool bAbsolut
|
|||||||
if( fAccels[PlayerOptions::ACCEL_BOOMERANG] > 0 )
|
if( fAccels[PlayerOptions::ACCEL_BOOMERANG] > 0 )
|
||||||
fYOffset += fAccels[PlayerOptions::ACCEL_BOOMERANG] * (fYOffset * SCALE( fYOffset, 0.f, SCREEN_HEIGHT, 1.5f, 0.5f )- fYOffset);
|
fYOffset += fAccels[PlayerOptions::ACCEL_BOOMERANG] * (fYOffset * SCALE( fYOffset, 0.f, SCREEN_HEIGHT, 1.5f, 0.5f )- fYOffset);
|
||||||
|
|
||||||
float fScrollSpeed = GAMESTATE->m_CurrentPlayerOptions[pn].m_fScrollSpeed;
|
float fScrollSpeed = pPlayerState->m_CurrentPlayerOptions.m_fScrollSpeed;
|
||||||
if( GAMESTATE->m_CurrentPlayerOptions[pn].m_fRandomSpeed > 0 && !bAbsolute )
|
if( pPlayerState->m_CurrentPlayerOptions.m_fRandomSpeed > 0 && !bAbsolute )
|
||||||
{
|
{
|
||||||
int seed = GAMESTATE->m_iRoundSeed + ( BeatToNoteRow( fNoteBeat ) << 8 ) + (iCol * 100);
|
int seed = GAMESTATE->m_iRoundSeed + ( BeatToNoteRow( fNoteBeat ) << 8 ) + (iCol * 100);
|
||||||
|
|
||||||
@@ -99,7 +101,7 @@ float ArrowGetYOffset( PlayerNumber pn, int iCol, float fNoteBeat, bool bAbsolut
|
|||||||
fScrollSpeed *=
|
fScrollSpeed *=
|
||||||
SCALE( fRandom,
|
SCALE( fRandom,
|
||||||
0.0f, 1.0f,
|
0.0f, 1.0f,
|
||||||
1.0f, GAMESTATE->m_CurrentPlayerOptions[pn].m_fRandomSpeed + 1.0f );
|
1.0f, pPlayerState->m_CurrentPlayerOptions.m_fRandomSpeed + 1.0f );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@@ -121,50 +123,50 @@ float ArrowGetYOffset( PlayerNumber pn, int iCol, float fNoteBeat, bool bAbsolut
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
static void ArrowGetReverseShiftAndScale( PlayerNumber pn, int iCol, float fYReverseOffsetPixels, float &fShiftOut, float &fScaleOut )
|
void ArrowGetReverseShiftAndScale( const PlayerState* pPlayerState, int iCol, float fYReverseOffsetPixels, float &fShiftOut, float &fScaleOut )
|
||||||
{
|
{
|
||||||
/* XXX: Hack: we need to scale the reverse shift by the zoom. */
|
/* XXX: Hack: we need to scale the reverse shift by the zoom. */
|
||||||
float fMiniPercent = GAMESTATE->m_CurrentPlayerOptions[pn].m_fEffects[PlayerOptions::EFFECT_MINI];
|
float fMiniPercent = pPlayerState->m_CurrentPlayerOptions.m_fEffects[PlayerOptions::EFFECT_MINI];
|
||||||
float fZoom = 1 - fMiniPercent*0.5f;
|
float fZoom = 1 - fMiniPercent*0.5f;
|
||||||
|
|
||||||
float fPercentReverse = GAMESTATE->m_CurrentPlayerOptions[pn].GetReversePercentForColumn(iCol);
|
float fPercentReverse = pPlayerState->m_CurrentPlayerOptions.GetReversePercentForColumn(iCol);
|
||||||
fShiftOut = SCALE( fPercentReverse, 0.f, 1.f, -fYReverseOffsetPixels/fZoom/2, fYReverseOffsetPixels/fZoom/2 );
|
fShiftOut = SCALE( fPercentReverse, 0.f, 1.f, -fYReverseOffsetPixels/fZoom/2, fYReverseOffsetPixels/fZoom/2 );
|
||||||
float fPercentCentered = GAMESTATE->m_CurrentPlayerOptions[pn].m_fScrolls[PlayerOptions::SCROLL_CENTERED];
|
float fPercentCentered = pPlayerState->m_CurrentPlayerOptions.m_fScrolls[PlayerOptions::SCROLL_CENTERED];
|
||||||
fShiftOut = SCALE( fPercentCentered, 0.f, 1.f, fShiftOut, 0.5f );
|
fShiftOut = SCALE( fPercentCentered, 0.f, 1.f, fShiftOut, 0.5f );
|
||||||
|
|
||||||
fScaleOut = SCALE( fPercentReverse, 0.f, 1.f, 1.f, -1.f);
|
fScaleOut = SCALE( fPercentReverse, 0.f, 1.f, 1.f, -1.f);
|
||||||
}
|
}
|
||||||
|
|
||||||
float ArrowGetYPos( PlayerNumber pn, int iCol, float fYOffset, float fYReverseOffsetPixels, bool WithReverse )
|
float ArrowEffects::GetYPos( const PlayerState* pPlayerState, int iCol, float fYOffset, float fYReverseOffsetPixels, bool WithReverse )
|
||||||
{
|
{
|
||||||
float f = fYOffset;
|
float f = fYOffset;
|
||||||
|
|
||||||
if( WithReverse )
|
if( WithReverse )
|
||||||
{
|
{
|
||||||
float fShift, fScale;
|
float fShift, fScale;
|
||||||
ArrowGetReverseShiftAndScale( pn, iCol, fYReverseOffsetPixels, fShift, fScale );
|
ArrowGetReverseShiftAndScale( pPlayerState, iCol, fYReverseOffsetPixels, fShift, fScale );
|
||||||
|
|
||||||
f *= fScale;
|
f *= fScale;
|
||||||
f += fShift;
|
f += fShift;
|
||||||
}
|
}
|
||||||
|
|
||||||
const float* fEffects = GAMESTATE->m_CurrentPlayerOptions[pn].m_fEffects;
|
const float* fEffects = pPlayerState->m_CurrentPlayerOptions.m_fEffects;
|
||||||
|
|
||||||
if( fEffects[PlayerOptions::EFFECT_TIPSY] > 0 )
|
if( fEffects[PlayerOptions::EFFECT_TIPSY] > 0 )
|
||||||
f += fEffects[PlayerOptions::EFFECT_TIPSY] * ( cosf( RageTimer::GetTimeSinceStart()*1.2f + iCol*1.8f) * ARROW_SIZE*0.4f );
|
f += fEffects[PlayerOptions::EFFECT_TIPSY] * ( cosf( RageTimer::GetTimeSinceStart()*1.2f + iCol*1.8f) * ARROW_SIZE*0.4f );
|
||||||
return f;
|
return f;
|
||||||
}
|
}
|
||||||
|
|
||||||
float ArrowGetYOffsetFromYPos( PlayerNumber pn, int iCol, float YPos, float fYReverseOffsetPixels )
|
float ArrowEffects::GetYOffsetFromYPos( const PlayerState* pPlayerState, int iCol, float YPos, float fYReverseOffsetPixels )
|
||||||
{
|
{
|
||||||
float f = YPos;
|
float f = YPos;
|
||||||
|
|
||||||
const float* fEffects = GAMESTATE->m_CurrentPlayerOptions[pn].m_fEffects;
|
const float* fEffects = pPlayerState->m_CurrentPlayerOptions.m_fEffects;
|
||||||
if( fEffects[PlayerOptions::EFFECT_TIPSY] > 0 )
|
if( fEffects[PlayerOptions::EFFECT_TIPSY] > 0 )
|
||||||
f -= fEffects[PlayerOptions::EFFECT_TIPSY] * ( cosf( RageTimer::GetTimeSinceStart()*1.2f + iCol*2.f) * ARROW_SIZE*0.4f );
|
f -= fEffects[PlayerOptions::EFFECT_TIPSY] * ( cosf( RageTimer::GetTimeSinceStart()*1.2f + iCol*2.f) * ARROW_SIZE*0.4f );
|
||||||
|
|
||||||
float fShift, fScale;
|
float fShift, fScale;
|
||||||
ArrowGetReverseShiftAndScale( pn, iCol, fYReverseOffsetPixels, fShift, fScale );
|
ArrowGetReverseShiftAndScale( pPlayerState, iCol, fYReverseOffsetPixels, fShift, fScale );
|
||||||
|
|
||||||
f -= fShift;
|
f -= fShift;
|
||||||
if( fScale )
|
if( fScale )
|
||||||
@@ -173,11 +175,11 @@ float ArrowGetYOffsetFromYPos( PlayerNumber pn, int iCol, float YPos, float fYRe
|
|||||||
return f;
|
return f;
|
||||||
}
|
}
|
||||||
|
|
||||||
float ArrowGetXPos( PlayerNumber pn, int iColNum, float fYOffset )
|
float ArrowEffects::GetXPos( const PlayerState* pPlayerState, int iColNum, float fYOffset )
|
||||||
{
|
{
|
||||||
float fPixelOffsetFromCenter = 0;
|
float fPixelOffsetFromCenter = 0;
|
||||||
|
|
||||||
const float* fEffects = GAMESTATE->m_CurrentPlayerOptions[pn].m_fEffects;
|
const float* fEffects = pPlayerState->m_CurrentPlayerOptions.m_fEffects;
|
||||||
|
|
||||||
if( fEffects[PlayerOptions::EFFECT_TORNADO] > 0 )
|
if( fEffects[PlayerOptions::EFFECT_TORNADO] > 0 )
|
||||||
{
|
{
|
||||||
@@ -195,6 +197,10 @@ float ArrowGetXPos( PlayerNumber pn, int iColNum, float fYOffset )
|
|||||||
|
|
||||||
float fMinX = +100000;
|
float fMinX = +100000;
|
||||||
float fMaxX = -100000;
|
float fMaxX = -100000;
|
||||||
|
|
||||||
|
// TODO: Don't index by PlayerNumber.
|
||||||
|
PlayerNumber pn = pPlayerState->m_PlayerNumber;
|
||||||
|
|
||||||
for( int i=iStartCol; i<=iEndCol; i++ )
|
for( int i=iStartCol; i<=iEndCol; i++ )
|
||||||
{
|
{
|
||||||
fMinX = min( fMinX, pStyle->m_ColumnInfo[pn][i].fXOffset );
|
fMinX = min( fMinX, pStyle->m_ColumnInfo[pn][i].fXOffset );
|
||||||
@@ -215,6 +221,9 @@ float ArrowGetXPos( PlayerNumber pn, int iColNum, float fYOffset )
|
|||||||
fPixelOffsetFromCenter += fEffects[PlayerOptions::EFFECT_DRUNK] * ( cosf( RageTimer::GetTimeSinceStart() + iColNum*0.2f + fYOffset*10/SCREEN_HEIGHT) * ARROW_SIZE*0.5f );
|
fPixelOffsetFromCenter += fEffects[PlayerOptions::EFFECT_DRUNK] * ( cosf( RageTimer::GetTimeSinceStart() + iColNum*0.2f + fYOffset*10/SCREEN_HEIGHT) * ARROW_SIZE*0.5f );
|
||||||
if( fEffects[PlayerOptions::EFFECT_FLIP] > 0 )
|
if( fEffects[PlayerOptions::EFFECT_FLIP] > 0 )
|
||||||
{
|
{
|
||||||
|
// TODO: Don't index by PlayerNumber.
|
||||||
|
PlayerNumber pn = pPlayerState->m_PlayerNumber;
|
||||||
|
|
||||||
// fPixelOffsetFromCenter *= SCALE(fEffects[PlayerOptions::EFFECT_FLIP], 0.f, 1.f, 1.f, -1.f);
|
// fPixelOffsetFromCenter *= SCALE(fEffects[PlayerOptions::EFFECT_FLIP], 0.f, 1.f, 1.f, -1.f);
|
||||||
const float fRealPixelOffset = GAMESTATE->GetCurrentStyle()->m_ColumnInfo[pn][iColNum].fXOffset;
|
const float fRealPixelOffset = GAMESTATE->GetCurrentStyle()->m_ColumnInfo[pn][iColNum].fXOffset;
|
||||||
const float fDistance = -fRealPixelOffset * 2;
|
const float fDistance = -fRealPixelOffset * 2;
|
||||||
@@ -268,13 +277,13 @@ float ArrowGetXPos( PlayerNumber pn, int iColNum, float fYOffset )
|
|||||||
return fPixelOffsetFromCenter;
|
return fPixelOffsetFromCenter;
|
||||||
}
|
}
|
||||||
|
|
||||||
float ArrowGetRotation( PlayerNumber pn, float fNoteBeat )
|
float ArrowEffects::GetRotation( const PlayerState* pPlayerState, float fNoteBeat )
|
||||||
{
|
{
|
||||||
if( GAMESTATE->m_CurrentPlayerOptions[pn].m_fEffects[PlayerOptions::EFFECT_DIZZY] > 0 )
|
if( pPlayerState->m_CurrentPlayerOptions.m_fEffects[PlayerOptions::EFFECT_DIZZY] > 0 )
|
||||||
{
|
{
|
||||||
const float fSongBeat = GAMESTATE->m_fSongBeat;
|
const float fSongBeat = GAMESTATE->m_fSongBeat;
|
||||||
float fDizzyRotation = fNoteBeat - fSongBeat;
|
float fDizzyRotation = fNoteBeat - fSongBeat;
|
||||||
fDizzyRotation *= GAMESTATE->m_CurrentPlayerOptions[pn].m_fEffects[PlayerOptions::EFFECT_DIZZY];
|
fDizzyRotation *= pPlayerState->m_CurrentPlayerOptions.m_fEffects[PlayerOptions::EFFECT_DIZZY];
|
||||||
fDizzyRotation = fmodf( fDizzyRotation, 2*PI );
|
fDizzyRotation = fmodf( fDizzyRotation, 2*PI );
|
||||||
fDizzyRotation *= 180/PI;
|
fDizzyRotation *= 180/PI;
|
||||||
return fDizzyRotation;
|
return fDizzyRotation;
|
||||||
@@ -287,9 +296,9 @@ float ArrowGetRotation( PlayerNumber pn, float fNoteBeat )
|
|||||||
#define CENTER_LINE_Y 160 // from fYOffset == 0
|
#define CENTER_LINE_Y 160 // from fYOffset == 0
|
||||||
#define FADE_DIST_Y 40
|
#define FADE_DIST_Y 40
|
||||||
|
|
||||||
static float GetCenterLine( PlayerNumber pn )
|
static float GetCenterLine( const PlayerState* pPlayerState )
|
||||||
{
|
{
|
||||||
const float fMiniPercent = GAMESTATE->m_CurrentPlayerOptions[pn].m_fEffects[PlayerOptions::EFFECT_MINI];
|
const float fMiniPercent = pPlayerState->m_CurrentPlayerOptions.m_fEffects[PlayerOptions::EFFECT_MINI];
|
||||||
const float fZoom = 1 - fMiniPercent*0.5f;
|
const float fZoom = 1 - fMiniPercent*0.5f;
|
||||||
|
|
||||||
/* Another mini hack: if EFFECT_MINI is on, then our center line is at eg. 320,
|
/* Another mini hack: if EFFECT_MINI is on, then our center line is at eg. 320,
|
||||||
@@ -297,9 +306,9 @@ static float GetCenterLine( PlayerNumber pn )
|
|||||||
return CENTER_LINE_Y / fZoom;
|
return CENTER_LINE_Y / fZoom;
|
||||||
}
|
}
|
||||||
|
|
||||||
static float GetHiddenSudden( PlayerNumber pn )
|
static float GetHiddenSudden( const PlayerState* pPlayerState )
|
||||||
{
|
{
|
||||||
const float* fAppearances = GAMESTATE->m_CurrentPlayerOptions[pn].m_fAppearances;
|
const float* fAppearances = pPlayerState->m_CurrentPlayerOptions.m_fAppearances;
|
||||||
return fAppearances[PlayerOptions::APPEARANCE_HIDDEN] *
|
return fAppearances[PlayerOptions::APPEARANCE_HIDDEN] *
|
||||||
fAppearances[PlayerOptions::APPEARANCE_SUDDEN];
|
fAppearances[PlayerOptions::APPEARANCE_SUDDEN];
|
||||||
}
|
}
|
||||||
@@ -316,50 +325,50 @@ static float GetHiddenSudden( PlayerNumber pn )
|
|||||||
// ...invisible...
|
// ...invisible...
|
||||||
//
|
//
|
||||||
// TRICKY: We fudge hidden and sudden to be farther apart if they're both on.
|
// TRICKY: We fudge hidden and sudden to be farther apart if they're both on.
|
||||||
static float GetHiddenEndLine( PlayerNumber pn )
|
static float GetHiddenEndLine( const PlayerState* pPlayerState )
|
||||||
{
|
{
|
||||||
return GetCenterLine( pn ) + FADE_DIST_Y * SCALE( GetHiddenSudden(pn), 0.f, 1.f, -1.0f, -1.25f );
|
return GetCenterLine( pPlayerState ) + FADE_DIST_Y * SCALE( GetHiddenSudden(pPlayerState), 0.f, 1.f, -1.0f, -1.25f );
|
||||||
}
|
}
|
||||||
|
|
||||||
static float GetHiddenStartLine( PlayerNumber pn )
|
static float GetHiddenStartLine( const PlayerState* pPlayerState )
|
||||||
{
|
{
|
||||||
return GetCenterLine( pn ) + FADE_DIST_Y * SCALE( GetHiddenSudden(pn), 0.f, 1.f, +0.0f, -0.25f );
|
return GetCenterLine( pPlayerState ) + FADE_DIST_Y * SCALE( GetHiddenSudden(pPlayerState), 0.f, 1.f, +0.0f, -0.25f );
|
||||||
}
|
}
|
||||||
|
|
||||||
static float GetSuddenEndLine( PlayerNumber pn )
|
static float GetSuddenEndLine( const PlayerState* pPlayerState )
|
||||||
{
|
{
|
||||||
return GetCenterLine( pn ) + FADE_DIST_Y * SCALE( GetHiddenSudden(pn), 0.f, 1.f, -0.0f, +0.25f );
|
return GetCenterLine( pPlayerState ) + FADE_DIST_Y * SCALE( GetHiddenSudden(pPlayerState), 0.f, 1.f, -0.0f, +0.25f );
|
||||||
}
|
}
|
||||||
|
|
||||||
static float GetSuddenStartLine( PlayerNumber pn )
|
static float GetSuddenStartLine( const PlayerState* pPlayerState )
|
||||||
{
|
{
|
||||||
return GetCenterLine( pn ) + FADE_DIST_Y * SCALE( GetHiddenSudden(pn), 0.f, 1.f, +1.0f, +1.25f );
|
return GetCenterLine( pPlayerState ) + FADE_DIST_Y * SCALE( GetHiddenSudden(pPlayerState), 0.f, 1.f, +1.0f, +1.25f );
|
||||||
}
|
}
|
||||||
|
|
||||||
// used by ArrowGetAlpha and ArrowGetGlow below
|
// used by ArrowGetAlpha and ArrowGetGlow below
|
||||||
static float ArrowGetPercentVisible( PlayerNumber pn, int iCol, float fYOffset, float fYReverseOffsetPixels )
|
float ArrowGetPercentVisible( const PlayerState* pPlayerState, int iCol, float fYOffset, float fYReverseOffsetPixels )
|
||||||
{
|
{
|
||||||
/* Get the YPos without reverse (that is, factor in EFFECT_TIPSY). */
|
/* Get the YPos without reverse (that is, factor in EFFECT_TIPSY). */
|
||||||
float fYPos = ArrowGetYPos( pn, iCol, fYOffset, fYReverseOffsetPixels, false );
|
float fYPos = ArrowEffects::GetYPos( pPlayerState, iCol, fYOffset, fYReverseOffsetPixels, false );
|
||||||
|
|
||||||
const float fDistFromCenterLine = fYPos - GetCenterLine( pn );
|
const float fDistFromCenterLine = fYPos - GetCenterLine( pPlayerState );
|
||||||
|
|
||||||
if( fYPos < 0 ) // past Gray Arrows
|
if( fYPos < 0 ) // past Gray Arrows
|
||||||
return 1; // totally visible
|
return 1; // totally visible
|
||||||
|
|
||||||
const float* fAppearances = GAMESTATE->m_CurrentPlayerOptions[pn].m_fAppearances;
|
const float* fAppearances = pPlayerState->m_CurrentPlayerOptions.m_fAppearances;
|
||||||
|
|
||||||
float fVisibleAdjust = 0;
|
float fVisibleAdjust = 0;
|
||||||
|
|
||||||
if( fAppearances[PlayerOptions::APPEARANCE_HIDDEN] > 0 )
|
if( fAppearances[PlayerOptions::APPEARANCE_HIDDEN] > 0 )
|
||||||
{
|
{
|
||||||
float fHiddenVisibleAdjust = SCALE( fYPos, GetHiddenStartLine(pn), GetHiddenEndLine(pn), 0, -1 );
|
float fHiddenVisibleAdjust = SCALE( fYPos, GetHiddenStartLine(pPlayerState), GetHiddenEndLine(pPlayerState), 0, -1 );
|
||||||
CLAMP( fHiddenVisibleAdjust, -1, 0 );
|
CLAMP( fHiddenVisibleAdjust, -1, 0 );
|
||||||
fVisibleAdjust += fAppearances[PlayerOptions::APPEARANCE_HIDDEN] * fHiddenVisibleAdjust;
|
fVisibleAdjust += fAppearances[PlayerOptions::APPEARANCE_HIDDEN] * fHiddenVisibleAdjust;
|
||||||
}
|
}
|
||||||
if( fAppearances[PlayerOptions::APPEARANCE_SUDDEN] > 0 )
|
if( fAppearances[PlayerOptions::APPEARANCE_SUDDEN] > 0 )
|
||||||
{
|
{
|
||||||
float fSuddenVisibleAdjust = SCALE( fYPos, GetSuddenStartLine(pn), GetSuddenEndLine(pn), -1, 0 );
|
float fSuddenVisibleAdjust = SCALE( fYPos, GetSuddenStartLine(pPlayerState), GetSuddenEndLine(pPlayerState), -1, 0 );
|
||||||
CLAMP( fSuddenVisibleAdjust, -1, 0 );
|
CLAMP( fSuddenVisibleAdjust, -1, 0 );
|
||||||
fVisibleAdjust += fAppearances[PlayerOptions::APPEARANCE_SUDDEN] * fSuddenVisibleAdjust;
|
fVisibleAdjust += fAppearances[PlayerOptions::APPEARANCE_SUDDEN] * fSuddenVisibleAdjust;
|
||||||
}
|
}
|
||||||
@@ -382,9 +391,9 @@ static float ArrowGetPercentVisible( PlayerNumber pn, int iCol, float fYOffset,
|
|||||||
return clamp( 1+fVisibleAdjust, 0, 1 );
|
return clamp( 1+fVisibleAdjust, 0, 1 );
|
||||||
}
|
}
|
||||||
|
|
||||||
float ArrowGetAlpha( PlayerNumber pn, int iCol, float fYOffset, float fPercentFadeToFail, float fYReverseOffsetPixels )
|
float ArrowEffects::GetAlpha( const PlayerState* pPlayerState, int iCol, float fYOffset, float fPercentFadeToFail, float fYReverseOffsetPixels )
|
||||||
{
|
{
|
||||||
float fPercentVisible = ArrowGetPercentVisible(pn,iCol,fYOffset,fYReverseOffsetPixels);
|
float fPercentVisible = ArrowGetPercentVisible(pPlayerState,iCol,fYOffset,fYReverseOffsetPixels);
|
||||||
|
|
||||||
if( fPercentFadeToFail != -1 )
|
if( fPercentFadeToFail != -1 )
|
||||||
fPercentVisible = 1 - fPercentFadeToFail;
|
fPercentVisible = 1 - fPercentFadeToFail;
|
||||||
@@ -392,9 +401,9 @@ float ArrowGetAlpha( PlayerNumber pn, int iCol, float fYOffset, float fPercentFa
|
|||||||
return (fPercentVisible>0.5f) ? 1.0f : 0.0f;
|
return (fPercentVisible>0.5f) ? 1.0f : 0.0f;
|
||||||
}
|
}
|
||||||
|
|
||||||
float ArrowGetGlow( PlayerNumber pn, int iCol, float fYOffset, float fPercentFadeToFail, float fYReverseOffsetPixels )
|
float ArrowEffects::GetGlow( const PlayerState* pPlayerState, int iCol, float fYOffset, float fPercentFadeToFail, float fYReverseOffsetPixels )
|
||||||
{
|
{
|
||||||
float fPercentVisible = ArrowGetPercentVisible(pn,iCol,fYOffset,fYReverseOffsetPixels);
|
float fPercentVisible = ArrowGetPercentVisible(pPlayerState,iCol,fYOffset,fYReverseOffsetPixels);
|
||||||
|
|
||||||
if( fPercentFadeToFail != -1 )
|
if( fPercentFadeToFail != -1 )
|
||||||
fPercentVisible = 1 - fPercentFadeToFail;
|
fPercentVisible = 1 - fPercentFadeToFail;
|
||||||
@@ -403,7 +412,7 @@ float ArrowGetGlow( PlayerNumber pn, int iCol, float fYOffset, float fPercentFad
|
|||||||
return SCALE( fDistFromHalf, 0, 0.5f, 1.3f, 0 );
|
return SCALE( fDistFromHalf, 0, 0.5f, 1.3f, 0 );
|
||||||
}
|
}
|
||||||
|
|
||||||
float ArrowGetBrightness( PlayerNumber pn, float fNoteBeat )
|
float ArrowEffects::GetBrightness( const PlayerState* pPlayerState, float fNoteBeat )
|
||||||
{
|
{
|
||||||
if( GAMESTATE->m_bEditing )
|
if( GAMESTATE->m_bEditing )
|
||||||
return 1;
|
return 1;
|
||||||
@@ -417,10 +426,10 @@ float ArrowGetBrightness( PlayerNumber pn, float fNoteBeat )
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
float ArrowGetZPos( PlayerNumber pn, int iCol, float fYOffset )
|
float ArrowEffects::GetZPos( const PlayerState* pPlayerState, int iCol, float fYOffset )
|
||||||
{
|
{
|
||||||
float fZPos=0;
|
float fZPos=0;
|
||||||
const float* fEffects = GAMESTATE->m_CurrentPlayerOptions[pn].m_fEffects;
|
const float* fEffects = pPlayerState->m_CurrentPlayerOptions.m_fEffects;
|
||||||
|
|
||||||
if( fEffects[PlayerOptions::EFFECT_BUMPY] > 0 )
|
if( fEffects[PlayerOptions::EFFECT_BUMPY] > 0 )
|
||||||
fZPos += fEffects[PlayerOptions::EFFECT_BUMPY] * 40*sinf( fYOffset/16.0f );
|
fZPos += fEffects[PlayerOptions::EFFECT_BUMPY] * 40*sinf( fYOffset/16.0f );
|
||||||
@@ -428,16 +437,16 @@ float ArrowGetZPos( PlayerNumber pn, int iCol, float fYOffset )
|
|||||||
return fZPos;
|
return fZPos;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool ArrowsNeedZBuffer( PlayerNumber pn )
|
bool ArrowEffects::NeedZBuffer( const PlayerState* pPlayerState )
|
||||||
{
|
{
|
||||||
const float* fEffects = GAMESTATE->m_CurrentPlayerOptions[pn].m_fEffects;
|
const float* fEffects = pPlayerState->m_CurrentPlayerOptions.m_fEffects;
|
||||||
if( fEffects[PlayerOptions::EFFECT_BUMPY] > 0 )
|
if( fEffects[PlayerOptions::EFFECT_BUMPY] > 0 )
|
||||||
return true;
|
return true;
|
||||||
|
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
float ArrowGetZoom( PlayerNumber pn )
|
float ArrowEffects::GetZoom( const PlayerState* pPlayerState )
|
||||||
{
|
{
|
||||||
// FIXME: Move the zoom values into Style
|
// FIXME: Move the zoom values into Style
|
||||||
if( GAMESTATE->m_pCurStyle->m_bNeedsZoomOutWith2Players &&
|
if( GAMESTATE->m_pCurStyle->m_bNeedsZoomOutWith2Players &&
|
||||||
|
|||||||
@@ -3,56 +3,58 @@
|
|||||||
#ifndef ARROWEFFECTS_H
|
#ifndef ARROWEFFECTS_H
|
||||||
#define ARROWEFFECTS_H
|
#define ARROWEFFECTS_H
|
||||||
|
|
||||||
|
struct PlayerState;
|
||||||
|
|
||||||
#include "GameConstantsAndTypes.h"
|
class ArrowEffects
|
||||||
#include "Style.h"
|
{
|
||||||
|
public:
|
||||||
|
|
||||||
// fYOffset is a vertical position in pixels relative to the center.
|
// fYOffset is a vertical position in pixels relative to the center.
|
||||||
// (positive if has not yet been stepped on, negative if has already passed).
|
// (positive if has not yet been stepped on, negative if has already passed).
|
||||||
// The ArrowEffect and ScrollSpeed is applied in this stage.
|
// The ArrowEffect and ScrollSpeed is applied in this stage.
|
||||||
float ArrowGetYOffset( PlayerNumber pn, int iCol, float fNoteBeat, bool bAbsolute=false );
|
static float GetYOffset( const PlayerState* pPlayerState, int iCol, float fNoteBeat, bool bAbsolute=false );
|
||||||
|
|
||||||
/* Actual display position, with reverse and post-reverse-effects factored in
|
/* Actual display position, with reverse and post-reverse-effects factored in
|
||||||
* (fYOffset -> YPos). */
|
* (fYOffset -> YPos). */
|
||||||
float ArrowGetYPos( PlayerNumber pn, int iCol, float fYOffset, float fYReverseOffsetPixels, bool WithReverse = true );
|
static float GetYPos( const PlayerState* pPlayerState, int iCol, float fYOffset, float fYReverseOffsetPixels, bool WithReverse = true );
|
||||||
|
|
||||||
// Inverse of ArrowGetYPos (YPos -> fYOffset).
|
// Inverse of ArrowGetYPos (YPos -> fYOffset).
|
||||||
float ArrowGetYOffsetFromYPos( PlayerNumber pn, int iCol, float YPos, float fYReverseOffsetPixels );
|
static float GetYOffsetFromYPos( const PlayerState* pPlayerState, int iCol, float YPos, float fYReverseOffsetPixels );
|
||||||
|
|
||||||
|
|
||||||
// fRotation is Z rotation of an arrow. This will depend on the column of
|
// fRotation is Z rotation of an arrow. This will depend on the column of
|
||||||
// the arrow and possibly the Arrow effect and the fYOffset (in the case of
|
// the arrow and possibly the Arrow effect and the fYOffset (in the case of
|
||||||
// EFFECT_DIZZY).
|
// EFFECT_DIZZY).
|
||||||
float ArrowGetRotation( PlayerNumber pn, float fNoteBeat );
|
static float GetRotation( const PlayerState* pPlayerState, float fNoteBeat );
|
||||||
|
|
||||||
|
|
||||||
// fXPos is a horizontal position in pixels relative to the center of the field.
|
// fXPos is a horizontal position in pixels relative to the center of the field.
|
||||||
// This depends on the column of the arrow and possibly the Arrow effect and
|
// This depends on the column of the arrow and possibly the Arrow effect and
|
||||||
// fYPos (in the case of EFFECT_DRUNK).
|
// fYPos (in the case of EFFECT_DRUNK).
|
||||||
float ArrowGetXPos( PlayerNumber pn, int iCol, float fYOffset );
|
static float GetXPos( const PlayerState* pPlayerState, int iCol, float fYOffset );
|
||||||
|
|
||||||
// Z position; normally 0. Only visible in perspective modes.
|
// Z position; normally 0. Only visible in perspective modes.
|
||||||
float ArrowGetZPos( PlayerNumber pn, int iCol, float fYPos );
|
static float GetZPos( const PlayerState* pPlayerState, int iCol, float fYPos );
|
||||||
|
|
||||||
// Enable this if any ZPos effects are enabled.
|
// Enable this if any ZPos effects are enabled.
|
||||||
bool ArrowsNeedZBuffer( PlayerNumber pn );
|
static bool NeedZBuffer( const PlayerState* pPlayerState );
|
||||||
|
|
||||||
// fAlpha is the transparency of the arrow. It depends on fYPos and the
|
// fAlpha is the transparency of the arrow. It depends on fYPos and the
|
||||||
// AppearanceType.
|
// AppearanceType.
|
||||||
float ArrowGetAlpha( PlayerNumber pn, int iCol, float fYPos, float fPercentFadeToFail, float fYReverseOffsetPixels );
|
static float GetAlpha( const PlayerState* pPlayerState, int iCol, float fYPos, float fPercentFadeToFail, float fYReverseOffsetPixels );
|
||||||
|
|
||||||
|
|
||||||
// fAlpha is the transparency of the arrow. It depends on fYPos and the
|
// fAlpha is the transparency of the arrow. It depends on fYPos and the
|
||||||
// AppearanceType.
|
// AppearanceType.
|
||||||
float ArrowGetGlow( PlayerNumber pn, int iCol, float fYPos, float fPercentFadeToFail, float fYReverseOffsetPixels );
|
static float GetGlow( const PlayerState* pPlayerState, int iCol, float fYPos, float fPercentFadeToFail, float fYReverseOffsetPixels );
|
||||||
|
|
||||||
|
|
||||||
// Depends on fYOffset.
|
// Depends on fYOffset.
|
||||||
float ArrowGetBrightness( PlayerNumber pn, float fNoteBeat );
|
static float GetBrightness( const PlayerState* pPlayerState, float fNoteBeat );
|
||||||
|
|
||||||
// This is the zoom of the individual tracks, not of the whole Player.
|
// This is the zoom of the individual tracks, not of the whole Player.
|
||||||
float ArrowGetZoom( PlayerNumber pn );
|
static float GetZoom( const PlayerState* pPlayerState );
|
||||||
|
};
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
|||||||
@@ -4,8 +4,9 @@
|
|||||||
#include "RageUtil.h"
|
#include "RageUtil.h"
|
||||||
#include "song.h"
|
#include "song.h"
|
||||||
#include "Foreach.h"
|
#include "Foreach.h"
|
||||||
|
#include "PlayerOptions.h"
|
||||||
|
|
||||||
void Attack::GetAttackBeats( const Song *song, PlayerNumber pn, float &fStartBeat, float &fEndBeat ) const
|
void Attack::GetAttackBeats( const Song *song, const PlayerState* pPlayerState, float &fStartBeat, float &fEndBeat ) const
|
||||||
{
|
{
|
||||||
ASSERT( song );
|
ASSERT( song );
|
||||||
|
|
||||||
@@ -14,17 +15,21 @@ void Attack::GetAttackBeats( const Song *song, PlayerNumber pn, float &fStartBea
|
|||||||
CHECKPOINT;
|
CHECKPOINT;
|
||||||
fStartBeat = song->GetBeatFromElapsedTime( fStartSecond );
|
fStartBeat = song->GetBeatFromElapsedTime( fStartSecond );
|
||||||
fEndBeat = song->GetBeatFromElapsedTime( fStartSecond+fSecsRemaining );
|
fEndBeat = song->GetBeatFromElapsedTime( fStartSecond+fSecsRemaining );
|
||||||
} else {
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
CHECKPOINT;
|
CHECKPOINT;
|
||||||
/* If fStartSecond < 0, then the attack starts right off the screen; this requires
|
/* If fStartSecond < 0, then the attack starts right off the screen; this requires
|
||||||
* that a song actually be playing. Pre-queued course attacks must always have
|
* that a song actually be playing. Pre-queued course attacks must always have
|
||||||
* fStartSecond >= 0. */
|
* fStartSecond >= 0. */
|
||||||
ASSERT( GAMESTATE->m_pCurSong );
|
ASSERT( GAMESTATE->m_pCurSong );
|
||||||
|
|
||||||
|
ASSERT( pPlayerState );
|
||||||
|
|
||||||
/* We're setting this effect on the fly. If it's an arrow-changing effect
|
/* We're setting this effect on the fly. If it's an arrow-changing effect
|
||||||
* (transform or note skin), apply it in the future, after what's currently on
|
* (transform or note skin), apply it in the future, after what's currently on
|
||||||
* screen, so new arrows will scroll on screen with this effect. */
|
* screen, so new arrows will scroll on screen with this effect. */
|
||||||
GAMESTATE->GetUndisplayedBeats( pn, fSecsRemaining, fStartBeat, fEndBeat );
|
GAMESTATE->GetUndisplayedBeats( pPlayerState, fSecsRemaining, fStartBeat, fEndBeat );
|
||||||
}
|
}
|
||||||
|
|
||||||
ASSERT_M( fEndBeat >= fStartBeat, ssprintf("%f >= %f", fEndBeat, fStartBeat) );
|
ASSERT_M( fEndBeat >= fStartBeat, ssprintf("%f >= %f", fEndBeat, fStartBeat) );
|
||||||
|
|||||||
@@ -4,6 +4,7 @@
|
|||||||
#include "GameConstantsAndTypes.h"
|
#include "GameConstantsAndTypes.h"
|
||||||
#include "PlayerNumber.h"
|
#include "PlayerNumber.h"
|
||||||
class Song;
|
class Song;
|
||||||
|
struct PlayerState;
|
||||||
|
|
||||||
struct Attack
|
struct Attack
|
||||||
{
|
{
|
||||||
@@ -32,8 +33,8 @@ struct Attack
|
|||||||
bGlobal = bGlobal_;
|
bGlobal = bGlobal_;
|
||||||
}
|
}
|
||||||
|
|
||||||
void GetAttackBeats( const Song *song, PlayerNumber pn, float &fStartBeat, float &fEndBeat ) const;
|
void GetAttackBeats( const Song *song, const PlayerState* pPlayerState, float &fStartBeat, float &fEndBeat ) const;
|
||||||
bool IsBlank() { return sModifier.empty(); }
|
bool IsBlank() const { return sModifier.empty(); }
|
||||||
bool operator== ( const Attack &rhs ) const;
|
bool operator== ( const Attack &rhs ) const;
|
||||||
bool ContainsTransformOrTurn() const;
|
bool ContainsTransformOrTurn() const;
|
||||||
};
|
};
|
||||||
|
|||||||
@@ -7,6 +7,7 @@
|
|||||||
#include "RageLog.h"
|
#include "RageLog.h"
|
||||||
#include "RageTextureManager.h"
|
#include "RageTextureManager.h"
|
||||||
#include <set>
|
#include <set>
|
||||||
|
#include "PlayerState.h"
|
||||||
|
|
||||||
CString GetAttackPath( const CString &sAttack )
|
CString GetAttackPath( const CString &sAttack )
|
||||||
{
|
{
|
||||||
@@ -25,14 +26,17 @@ AttackDisplay::AttackDisplay()
|
|||||||
GAMESTATE->m_PlayMode != PLAY_MODE_RAVE )
|
GAMESTATE->m_PlayMode != PLAY_MODE_RAVE )
|
||||||
return;
|
return;
|
||||||
|
|
||||||
m_sprAttack.SetName( ssprintf("TextP%d",m_PlayerNumber+1) );
|
|
||||||
m_sprAttack.SetDiffuseAlpha( 0 ); // invisible
|
m_sprAttack.SetDiffuseAlpha( 0 ); // invisible
|
||||||
this->AddChild( &m_sprAttack );
|
this->AddChild( &m_sprAttack );
|
||||||
}
|
}
|
||||||
|
|
||||||
void AttackDisplay::Init( PlayerNumber pn )
|
void AttackDisplay::Init( const PlayerState* pPlayerState )
|
||||||
{
|
{
|
||||||
m_PlayerNumber = pn;
|
m_pPlayerState = pPlayerState;
|
||||||
|
|
||||||
|
// TODO: Remove use of PlayerNumber.
|
||||||
|
PlayerNumber pn = m_pPlayerState->m_PlayerNumber;
|
||||||
|
m_sprAttack.SetName( ssprintf("TextP%d",pn+1) );
|
||||||
|
|
||||||
if( GAMESTATE->m_PlayMode != PLAY_MODE_BATTLE &&
|
if( GAMESTATE->m_PlayMode != PLAY_MODE_BATTLE &&
|
||||||
GAMESTATE->m_PlayMode != PLAY_MODE_RAVE )
|
GAMESTATE->m_PlayMode != PLAY_MODE_RAVE )
|
||||||
@@ -71,22 +75,24 @@ void AttackDisplay::Update( float fDelta )
|
|||||||
GAMESTATE->m_PlayMode != PLAY_MODE_RAVE )
|
GAMESTATE->m_PlayMode != PLAY_MODE_RAVE )
|
||||||
return;
|
return;
|
||||||
|
|
||||||
if( !GAMESTATE->m_bAttackBeganThisUpdate[m_PlayerNumber] )
|
if( !m_pPlayerState->m_bAttackBeganThisUpdate )
|
||||||
return;
|
return;
|
||||||
// don't handle this again
|
// don't handle this again
|
||||||
|
|
||||||
for( unsigned s=0; s<GAMESTATE->m_ActiveAttacks[m_PlayerNumber].size(); s++ )
|
for( unsigned s=0; s<m_pPlayerState->m_ActiveAttacks.size(); s++ )
|
||||||
{
|
{
|
||||||
if( GAMESTATE->m_ActiveAttacks[m_PlayerNumber][s].fStartSecond >= 0 )
|
const Attack& attack = m_pPlayerState->m_ActiveAttacks[s];
|
||||||
|
|
||||||
|
if( attack.fStartSecond >= 0 )
|
||||||
continue; /* hasn't started yet */
|
continue; /* hasn't started yet */
|
||||||
|
|
||||||
if( GAMESTATE->m_ActiveAttacks[m_PlayerNumber][s].fSecsRemaining <= 0 )
|
if( attack.fSecsRemaining <= 0 )
|
||||||
continue; /* ended already */
|
continue; /* ended already */
|
||||||
|
|
||||||
if( GAMESTATE->m_ActiveAttacks[m_PlayerNumber][s].IsBlank() )
|
if( attack.IsBlank() )
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
SetAttack( GAMESTATE->m_ActiveAttacks[m_PlayerNumber][s].sModifier );
|
SetAttack( attack.sModifier );
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -99,7 +105,11 @@ void AttackDisplay::SetAttack( const CString &sText )
|
|||||||
|
|
||||||
m_sprAttack.SetDiffuseAlpha( 1 );
|
m_sprAttack.SetDiffuseAlpha( 1 );
|
||||||
m_sprAttack.Load( path );
|
m_sprAttack.Load( path );
|
||||||
const CString sName = ssprintf( "%sP%i", sText.c_str(), m_PlayerNumber+1 );
|
|
||||||
|
// TODO: Remove use of PlayerNumber.
|
||||||
|
PlayerNumber pn = m_pPlayerState->m_PlayerNumber;
|
||||||
|
|
||||||
|
const CString sName = ssprintf( "%sP%i", sText.c_str(), pn+1 );
|
||||||
m_sprAttack.RunCommands( THEME->GetMetricA("AttackDisplay", sName + "OnCommand" ) );
|
m_sprAttack.RunCommands( THEME->GetMetricA("AttackDisplay", sName + "OnCommand" ) );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -3,22 +3,22 @@
|
|||||||
|
|
||||||
#include "ActorFrame.h"
|
#include "ActorFrame.h"
|
||||||
#include "Sprite.h"
|
#include "Sprite.h"
|
||||||
#include "PlayerNumber.h"
|
|
||||||
#include "GameConstantsAndTypes.h" // for TapNoteScore
|
#include "GameConstantsAndTypes.h" // for TapNoteScore
|
||||||
|
|
||||||
|
struct PlayerState;
|
||||||
|
|
||||||
class AttackDisplay : public ActorFrame
|
class AttackDisplay : public ActorFrame
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
AttackDisplay();
|
AttackDisplay();
|
||||||
|
|
||||||
void Init( PlayerNumber pn );
|
void Init( const PlayerState* pPlayerState );
|
||||||
void SetAttack( const CString &mod );
|
void SetAttack( const CString &mod );
|
||||||
|
|
||||||
virtual void Update( float fDelta );
|
virtual void Update( float fDelta );
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
PlayerNumber m_PlayerNumber;
|
const PlayerState* m_pPlayerState;
|
||||||
|
|
||||||
Sprite m_sprAttack;
|
Sprite m_sprAttack;
|
||||||
};
|
};
|
||||||
|
|||||||
@@ -16,6 +16,7 @@
|
|||||||
#include "StageStats.h"
|
#include "StageStats.h"
|
||||||
#include "ScreenDimensions.h"
|
#include "ScreenDimensions.h"
|
||||||
#include "ThemeMetric.h"
|
#include "ThemeMetric.h"
|
||||||
|
#include "PlayerState.h"
|
||||||
|
|
||||||
#include <set>
|
#include <set>
|
||||||
|
|
||||||
@@ -632,14 +633,14 @@ bool Background::IsDangerPlayerVisible( PlayerNumber pn )
|
|||||||
return false;
|
return false;
|
||||||
if( !PREFSMAN->m_bShowDanger )
|
if( !PREFSMAN->m_bShowDanger )
|
||||||
return false;
|
return false;
|
||||||
return GAMESTATE->m_HealthState[pn] == GameState::DANGER;
|
return GAMESTATE->m_pPlayerState[pn]->m_HealthState == PlayerState::DANGER;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool Background::IsDeadPlayerVisible( PlayerNumber pn )
|
bool Background::IsDeadPlayerVisible( PlayerNumber pn )
|
||||||
{
|
{
|
||||||
if( GAMESTATE->m_SongOptions.m_FailType == SongOptions::FAIL_OFF )
|
if( GAMESTATE->m_SongOptions.m_FailType == SongOptions::FAIL_OFF )
|
||||||
return false;
|
return false;
|
||||||
return GAMESTATE->m_HealthState[pn] == GameState::DEAD;
|
return GAMESTATE->m_pPlayerState[pn]->m_HealthState == PlayerState::DEAD;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@@ -670,8 +671,8 @@ void BrightnessOverlay::Update( float fDeltaTime )
|
|||||||
|
|
||||||
void BrightnessOverlay::SetActualBrightness()
|
void BrightnessOverlay::SetActualBrightness()
|
||||||
{
|
{
|
||||||
float fLeftBrightness = 1-GAMESTATE->m_PlayerOptions[PLAYER_1].m_fCover;
|
float fLeftBrightness = 1-GAMESTATE->m_pPlayerState[PLAYER_1]->m_PlayerOptions.m_fCover;
|
||||||
float fRightBrightness = 1-GAMESTATE->m_PlayerOptions[PLAYER_2].m_fCover;
|
float fRightBrightness = 1-GAMESTATE->m_pPlayerState[PLAYER_2]->m_PlayerOptions.m_fCover;
|
||||||
|
|
||||||
fLeftBrightness *= PREFSMAN->m_fBGBrightness;
|
fLeftBrightness *= PREFSMAN->m_fBGBrightness;
|
||||||
fRightBrightness *= PREFSMAN->m_fBGBrightness;
|
fRightBrightness *= PREFSMAN->m_fBGBrightness;
|
||||||
|
|||||||
@@ -10,6 +10,7 @@
|
|||||||
#include "Style.h"
|
#include "Style.h"
|
||||||
#include "RageUtil.h"
|
#include "RageUtil.h"
|
||||||
#include "PrefsManager.h"
|
#include "PrefsManager.h"
|
||||||
|
#include "PlayerState.h"
|
||||||
|
|
||||||
const CString g_sCodeNames[CodeDetector::NUM_CODES] = {
|
const CString g_sCodeNames[CodeDetector::NUM_CODES] = {
|
||||||
"Easier1",
|
"Easier1",
|
||||||
@@ -220,8 +221,8 @@ bool CodeDetector::EnteredModeMenu( GameController controller )
|
|||||||
#define INCREMENT_SCROLL_SPEED(s) (s==0.5f) ? s=0.75f : (s==0.75f) ? s=1.0f : (s==1.0f) ? s=1.5f : (s==1.5f) ? s=2.0f : (s==2.0f) ? s=3.0f : (s==3.0f) ? s=4.0f : (s==4.0f) ? s=5.0f : (s==5.0f) ? s=8.0f : s=0.5f;
|
#define INCREMENT_SCROLL_SPEED(s) (s==0.5f) ? s=0.75f : (s==0.75f) ? s=1.0f : (s==1.0f) ? s=1.5f : (s==1.5f) ? s=2.0f : (s==2.0f) ? s=3.0f : (s==3.0f) ? s=4.0f : (s==4.0f) ? s=5.0f : (s==5.0f) ? s=8.0f : s=0.5f;
|
||||||
#define DECREMENT_SCROLL_SPEED(s) (s==0.75f) ? s=0.5f : (s==1.0f) ? s=0.75f : (s==1.5f) ? s=1.0f : (s==2.0f) ? s=1.5f : (s==3.0f) ? s=2.0f : (s==4.0f) ? s=3.0f : (s==5.0f) ? s=4.0f : (s==8.0f) ? s=4.0f : s=8.0f;
|
#define DECREMENT_SCROLL_SPEED(s) (s==0.75f) ? s=0.5f : (s==1.0f) ? s=0.75f : (s==1.5f) ? s=1.0f : (s==2.0f) ? s=1.5f : (s==3.0f) ? s=2.0f : (s==4.0f) ? s=3.0f : (s==5.0f) ? s=4.0f : (s==8.0f) ? s=4.0f : s=8.0f;
|
||||||
|
|
||||||
#define TOGGLE_HIDDEN ZERO(GAMESTATE->m_PlayerOptions[pn].m_fAppearances); GAMESTATE->m_PlayerOptions[pn].m_fAppearances[PlayerOptions::APPEARANCE_HIDDEN] = 1;
|
#define TOGGLE_HIDDEN ZERO(GAMESTATE->m_pPlayerState[pn]->m_PlayerOptions.m_fAppearances); GAMESTATE->m_pPlayerState[pn]->m_PlayerOptions.m_fAppearances[PlayerOptions::APPEARANCE_HIDDEN] = 1;
|
||||||
#define TOGGLE_RANDOMVANISH ZERO(GAMESTATE->m_PlayerOptions[pn].m_fAppearances); GAMESTATE->m_PlayerOptions[pn].m_fAppearances[PlayerOptions::APPEARANCE_RANDOMVANISH] = 1;
|
#define TOGGLE_RANDOMVANISH ZERO(GAMESTATE->m_pPlayerState[pn]->m_PlayerOptions.m_fAppearances); GAMESTATE->m_pPlayerState[pn]->m_PlayerOptions.m_fAppearances[PlayerOptions::APPEARANCE_RANDOMVANISH] = 1;
|
||||||
|
|
||||||
bool CodeDetector::DetectAndAdjustMusicOptions( GameController controller )
|
bool CodeDetector::DetectAndAdjustMusicOptions( GameController controller )
|
||||||
{
|
{
|
||||||
@@ -232,32 +233,34 @@ bool CodeDetector::DetectAndAdjustMusicOptions( GameController controller )
|
|||||||
{
|
{
|
||||||
Code code = (Code)c;
|
Code code = (Code)c;
|
||||||
|
|
||||||
|
PlayerOptions& po = GAMESTATE->m_pPlayerState[pn]->m_PlayerOptions;
|
||||||
|
|
||||||
if( EnteredCode(controller,code) )
|
if( EnteredCode(controller,code) )
|
||||||
{
|
{
|
||||||
switch( code )
|
switch( code )
|
||||||
{
|
{
|
||||||
case CODE_MIRROR: GAMESTATE->m_PlayerOptions[pn].ToggleOneTurn( PlayerOptions::TURN_MIRROR ); break;
|
case CODE_MIRROR: po.ToggleOneTurn( PlayerOptions::TURN_MIRROR ); break;
|
||||||
case CODE_LEFT: GAMESTATE->m_PlayerOptions[pn].ToggleOneTurn( PlayerOptions::TURN_LEFT ); break;
|
case CODE_LEFT: po.ToggleOneTurn( PlayerOptions::TURN_LEFT ); break;
|
||||||
case CODE_RIGHT: GAMESTATE->m_PlayerOptions[pn].ToggleOneTurn( PlayerOptions::TURN_RIGHT ); break;
|
case CODE_RIGHT: po.ToggleOneTurn( PlayerOptions::TURN_RIGHT ); break;
|
||||||
case CODE_SHUFFLE: GAMESTATE->m_PlayerOptions[pn].ToggleOneTurn( PlayerOptions::TURN_SHUFFLE ); break;
|
case CODE_SHUFFLE: po.ToggleOneTurn( PlayerOptions::TURN_SHUFFLE ); break;
|
||||||
case CODE_SUPER_SHUFFLE: GAMESTATE->m_PlayerOptions[pn].ToggleOneTurn( PlayerOptions::TURN_SUPER_SHUFFLE ); break;
|
case CODE_SUPER_SHUFFLE: po.ToggleOneTurn( PlayerOptions::TURN_SUPER_SHUFFLE ); break;
|
||||||
case CODE_NEXT_TRANSFORM: GAMESTATE->m_PlayerOptions[pn].NextTransform(); break;
|
case CODE_NEXT_TRANSFORM: po.NextTransform(); break;
|
||||||
case CODE_NEXT_SCROLL_SPEED:INCREMENT_SCROLL_SPEED( GAMESTATE->m_PlayerOptions[pn].m_fScrollSpeed ); break;
|
case CODE_NEXT_SCROLL_SPEED: INCREMENT_SCROLL_SPEED( po.m_fScrollSpeed ); break;
|
||||||
case CODE_PREVIOUS_SCROLL_SPEED:DECREMENT_SCROLL_SPEED( GAMESTATE->m_PlayerOptions[pn].m_fScrollSpeed ); break;
|
case CODE_PREVIOUS_SCROLL_SPEED: DECREMENT_SCROLL_SPEED( po.m_fScrollSpeed ); break;
|
||||||
case CODE_NEXT_ACCEL: GAMESTATE->m_PlayerOptions[pn].NextAccel(); break;
|
case CODE_NEXT_ACCEL: po.NextAccel(); break;
|
||||||
case CODE_NEXT_EFFECT: GAMESTATE->m_PlayerOptions[pn].NextEffect(); break;
|
case CODE_NEXT_EFFECT: po.NextEffect(); break;
|
||||||
case CODE_NEXT_APPEARANCE: GAMESTATE->m_PlayerOptions[pn].NextAppearance(); break;
|
case CODE_NEXT_APPEARANCE: po.NextAppearance(); break;
|
||||||
case CODE_NEXT_TURN: GAMESTATE->m_PlayerOptions[pn].NextTurn(); break;
|
case CODE_NEXT_TURN: po.NextTurn(); break;
|
||||||
case CODE_REVERSE: GAMESTATE->m_PlayerOptions[pn].NextScroll(); break;
|
case CODE_REVERSE: po.NextScroll(); break;
|
||||||
case CODE_HOLDS: TOGGLE( GAMESTATE->m_PlayerOptions[pn].m_bTransforms[PlayerOptions::TRANSFORM_NOHOLDS], true, false ); break;
|
case CODE_HOLDS: TOGGLE( po.m_bTransforms[PlayerOptions::TRANSFORM_NOHOLDS], true, false ); break;
|
||||||
case CODE_MINES: TOGGLE( GAMESTATE->m_PlayerOptions[pn].m_bTransforms[PlayerOptions::TRANSFORM_NOMINES], true, false ); break;
|
case CODE_MINES: TOGGLE( po.m_bTransforms[PlayerOptions::TRANSFORM_NOMINES], true, false ); break;
|
||||||
case CODE_DARK: FLOAT_TOGGLE( GAMESTATE->m_PlayerOptions[pn].m_fDark ); break;
|
case CODE_DARK: FLOAT_TOGGLE( po.m_fDark ); break;
|
||||||
case CODE_CANCEL_ALL: GAMESTATE->m_PlayerOptions[pn].Init();
|
case CODE_CANCEL_ALL: po.Init();
|
||||||
GAMESTATE->m_PlayerOptions[pn].FromString( PREFSMAN->m_sDefaultModifiers ); break;
|
po.FromString( PREFSMAN->m_sDefaultModifiers ); break;
|
||||||
case CODE_HIDDEN: TOGGLE_HIDDEN; break;
|
case CODE_HIDDEN: TOGGLE_HIDDEN; break;
|
||||||
case CODE_RANDOMVANISH: TOGGLE_RANDOMVANISH; break;
|
case CODE_RANDOMVANISH: TOGGLE_RANDOMVANISH; break;
|
||||||
|
|
||||||
// GAMESTATE->m_PlayerOptions[pn].SetOneAppearance(GAMESTATE->m_PlayerOptions[pn].GetFirstAppearance()); break;
|
// po.SetOneAppearance(po.GetFirstAppearance()); break;
|
||||||
default: ;
|
default: ;
|
||||||
}
|
}
|
||||||
return true; // don't check any more
|
return true; // don't check any more
|
||||||
|
|||||||
@@ -13,6 +13,7 @@
|
|||||||
#include "RageFile.h"
|
#include "RageFile.h"
|
||||||
#include "StageStats.h"
|
#include "StageStats.h"
|
||||||
#include "Steps.h"
|
#include "Steps.h"
|
||||||
|
#include "PlayerState.h"
|
||||||
|
|
||||||
ConditionalBGA::ConditionalBGA()
|
ConditionalBGA::ConditionalBGA()
|
||||||
{
|
{
|
||||||
@@ -397,7 +398,7 @@ void ConditionalBGA::CheckBgaRequirements(BgaCondInfo info)
|
|||||||
unsigned md;
|
unsigned md;
|
||||||
for(md=0;md<PlayerOptions::NUM_ACCELS;md++)
|
for(md=0;md<PlayerOptions::NUM_ACCELS;md++)
|
||||||
{
|
{
|
||||||
if(po.m_fAccels[md] != 0.0f && GAMESTATE->m_PlayerOptions[pn].m_fAccels[md] != 0.0f)
|
if(po.m_fAccels[md] != 0.0f && GAMESTATE->m_pPlayerState[pn]->m_PlayerOptions.m_fAccels[md] != 0.0f)
|
||||||
{
|
{
|
||||||
bModsValid=false;
|
bModsValid=false;
|
||||||
LOG->Info("Found Invalid Accel Mod");
|
LOG->Info("Found Invalid Accel Mod");
|
||||||
@@ -405,7 +406,7 @@ void ConditionalBGA::CheckBgaRequirements(BgaCondInfo info)
|
|||||||
}
|
}
|
||||||
for(md=0;md<PlayerOptions::NUM_EFFECTS;md++)
|
for(md=0;md<PlayerOptions::NUM_EFFECTS;md++)
|
||||||
{
|
{
|
||||||
if(po.m_fEffects[md] != 0.0f && GAMESTATE->m_PlayerOptions[pn].m_fEffects[md] != 0.0f)
|
if(po.m_fEffects[md] != 0.0f && GAMESTATE->m_pPlayerState[pn]->m_PlayerOptions.m_fEffects[md] != 0.0f)
|
||||||
{
|
{
|
||||||
bModsValid=false;
|
bModsValid=false;
|
||||||
LOG->Info("Found Invalid Effect Mod");
|
LOG->Info("Found Invalid Effect Mod");
|
||||||
@@ -413,7 +414,7 @@ void ConditionalBGA::CheckBgaRequirements(BgaCondInfo info)
|
|||||||
}
|
}
|
||||||
for(md=0;md<PlayerOptions::NUM_APPEARANCES;md++)
|
for(md=0;md<PlayerOptions::NUM_APPEARANCES;md++)
|
||||||
{
|
{
|
||||||
if(po.m_fAppearances[md] != 0.0f && GAMESTATE->m_PlayerOptions[pn].m_fAppearances[md] != 0.0f)
|
if(po.m_fAppearances[md] != 0.0f && GAMESTATE->m_pPlayerState[pn]->m_PlayerOptions.m_fAppearances[md] != 0.0f)
|
||||||
{
|
{
|
||||||
bModsValid=false;
|
bModsValid=false;
|
||||||
LOG->Info("Found Invalid Appearance Mod");
|
LOG->Info("Found Invalid Appearance Mod");
|
||||||
@@ -421,7 +422,7 @@ void ConditionalBGA::CheckBgaRequirements(BgaCondInfo info)
|
|||||||
}
|
}
|
||||||
for(md=0;md<PlayerOptions::NUM_TURNS;md++)
|
for(md=0;md<PlayerOptions::NUM_TURNS;md++)
|
||||||
{
|
{
|
||||||
if(po.m_bTurns[md] != 0.0f && GAMESTATE->m_PlayerOptions[pn].m_bTurns[md] != 0.0f)
|
if(po.m_bTurns[md] != 0.0f && GAMESTATE->m_pPlayerState[pn]->m_PlayerOptions.m_bTurns[md] != 0.0f)
|
||||||
{
|
{
|
||||||
bModsValid=false;
|
bModsValid=false;
|
||||||
LOG->Info("Found Invalid Turn Mod");
|
LOG->Info("Found Invalid Turn Mod");
|
||||||
@@ -429,7 +430,7 @@ void ConditionalBGA::CheckBgaRequirements(BgaCondInfo info)
|
|||||||
}
|
}
|
||||||
for(md=0;md<PlayerOptions::NUM_TRANSFORMS;md++)
|
for(md=0;md<PlayerOptions::NUM_TRANSFORMS;md++)
|
||||||
{
|
{
|
||||||
if(po.m_bTransforms[md] != 0.0f && GAMESTATE->m_PlayerOptions[pn].m_bTransforms[md] != 0.0f)
|
if(po.m_bTransforms[md] != 0.0f && GAMESTATE->m_pPlayerState[pn]->m_PlayerOptions.m_bTransforms[md] != 0.0f)
|
||||||
{
|
{
|
||||||
bModsValid=false;
|
bModsValid=false;
|
||||||
LOG->Info("Found Invalid Transform Mod");
|
LOG->Info("Found Invalid Transform Mod");
|
||||||
|
|||||||
@@ -10,6 +10,7 @@
|
|||||||
#include "Course.h"
|
#include "Course.h"
|
||||||
#include "ScreenMiniMenu.h"
|
#include "ScreenMiniMenu.h"
|
||||||
#include "ScreenManager.h"
|
#include "ScreenManager.h"
|
||||||
|
#include "PlayerState.h"
|
||||||
|
|
||||||
//
|
//
|
||||||
// Defines specific to EditCoursesMenu
|
// Defines specific to EditCoursesMenu
|
||||||
@@ -326,8 +327,8 @@ void EditCoursesMenu::Start()
|
|||||||
case ROW_ENTRY_PLAYER_OPTIONS:
|
case ROW_ENTRY_PLAYER_OPTIONS:
|
||||||
SCREENMAN->PlayStartSound();
|
SCREENMAN->PlayStartSound();
|
||||||
|
|
||||||
GAMESTATE->m_PlayerOptions[PLAYER_1] = PlayerOptions();
|
GAMESTATE->m_pPlayerState[PLAYER_1]->m_PlayerOptions = PlayerOptions();
|
||||||
GAMESTATE->m_PlayerOptions[PLAYER_1].FromString( pEntry->modifiers );
|
GAMESTATE->m_pPlayerState[PLAYER_1]->m_PlayerOptions.FromString( pEntry->modifiers );
|
||||||
|
|
||||||
SCREENMAN->AddNewScreenToTop( "ScreenPlayerOptions", SM_BackFromPlayerOptions );
|
SCREENMAN->AddNewScreenToTop( "ScreenPlayerOptions", SM_BackFromPlayerOptions );
|
||||||
break;
|
break;
|
||||||
@@ -365,7 +366,7 @@ void EditCoursesMenu::HandleScreenMessage( const ScreenMessage SM )
|
|||||||
case SM_BackFromPlayerOptions:
|
case SM_BackFromPlayerOptions:
|
||||||
case SM_BackFromSongOptions:
|
case SM_BackFromSongOptions:
|
||||||
// coming back from PlayerOptions or SongOptions
|
// coming back from PlayerOptions or SongOptions
|
||||||
pEntry->modifiers = GAMESTATE->m_PlayerOptions[PLAYER_1].GetString() + "," + GAMESTATE->m_SongOptions.GetString();
|
pEntry->modifiers = GAMESTATE->m_pPlayerState[PLAYER_1]->m_PlayerOptions.GetString() + "," + GAMESTATE->m_SongOptions.GetString();
|
||||||
OnRowValueChanged( ROW_ENTRY_PLAYER_OPTIONS );
|
OnRowValueChanged( ROW_ENTRY_PLAYER_OPTIONS );
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -23,6 +23,7 @@
|
|||||||
#include "UnlockSystem.h"
|
#include "UnlockSystem.h"
|
||||||
#include "GameSoundManager.h"
|
#include "GameSoundManager.h"
|
||||||
#include "ThemeManager.h"
|
#include "ThemeManager.h"
|
||||||
|
#include "PlayerState.h"
|
||||||
|
|
||||||
void GameCommand::Init()
|
void GameCommand::Init()
|
||||||
{
|
{
|
||||||
@@ -91,12 +92,12 @@ bool GameCommand::DescribesCurrentMode( PlayerNumber pn ) const
|
|||||||
if( m_sModifiers != "" )
|
if( m_sModifiers != "" )
|
||||||
{
|
{
|
||||||
/* Apply modifiers. */
|
/* Apply modifiers. */
|
||||||
PlayerOptions po = GAMESTATE->m_PlayerOptions[pn];
|
PlayerOptions po = GAMESTATE->m_pPlayerState[pn]->m_PlayerOptions;
|
||||||
SongOptions so = GAMESTATE->m_SongOptions;
|
SongOptions so = GAMESTATE->m_SongOptions;
|
||||||
po.FromString( m_sModifiers );
|
po.FromString( m_sModifiers );
|
||||||
so.FromString( m_sModifiers );
|
so.FromString( m_sModifiers );
|
||||||
|
|
||||||
if( po != GAMESTATE->m_PlayerOptions[pn] )
|
if( po != GAMESTATE->m_pPlayerState[pn]->m_PlayerOptions )
|
||||||
return false;
|
return false;
|
||||||
if( so != GAMESTATE->m_SongOptions )
|
if( so != GAMESTATE->m_SongOptions )
|
||||||
return false;
|
return false;
|
||||||
|
|||||||
+77
-65
@@ -28,6 +28,7 @@
|
|||||||
#include "StepMania.h"
|
#include "StepMania.h"
|
||||||
#include "CommonMetrics.h"
|
#include "CommonMetrics.h"
|
||||||
#include "Actor.h"
|
#include "Actor.h"
|
||||||
|
#include "PlayerState.h"
|
||||||
|
|
||||||
#include <ctime>
|
#include <ctime>
|
||||||
#include <set>
|
#include <set>
|
||||||
@@ -57,6 +58,12 @@ GameState::GameState()
|
|||||||
FOREACH_PlayerNumber( p )
|
FOREACH_PlayerNumber( p )
|
||||||
m_bSideIsJoined[p] = false; // used by GetNumSidesJoined before the first screen
|
m_bSideIsJoined[p] = false; // used by GetNumSidesJoined before the first screen
|
||||||
|
|
||||||
|
FOREACH_PlayerNumber( p )
|
||||||
|
{
|
||||||
|
m_pPlayerState[p] = new PlayerState;
|
||||||
|
m_pPlayerState[p]->m_PlayerNumber = p;
|
||||||
|
}
|
||||||
|
|
||||||
/* Don't reset yet; let the first screen do it, so we can
|
/* Don't reset yet; let the first screen do it, so we can
|
||||||
* use PREFSMAN and THEME. */
|
* use PREFSMAN and THEME. */
|
||||||
// Reset();
|
// Reset();
|
||||||
@@ -64,9 +71,12 @@ GameState::GameState()
|
|||||||
|
|
||||||
GameState::~GameState()
|
GameState::~GameState()
|
||||||
{
|
{
|
||||||
delete m_pPosition;
|
SAFE_DELETE( m_pPosition );
|
||||||
for( unsigned i=0; i<m_pCharacters.size(); i++ )
|
for( unsigned i=0; i<m_pCharacters.size(); i++ )
|
||||||
delete m_pCharacters[i];
|
SAFE_DELETE( m_pCharacters[i] );
|
||||||
|
|
||||||
|
FOREACH_PlayerNumber( p )
|
||||||
|
SAFE_DELETE( m_pPlayerState[p] );
|
||||||
}
|
}
|
||||||
|
|
||||||
void GameState::ApplyCmdline()
|
void GameState::ApplyCmdline()
|
||||||
@@ -146,7 +156,7 @@ void GameState::Reset()
|
|||||||
m_pPosition = new NoteFieldPositioning("Positioning.ini");
|
m_pPosition = new NoteFieldPositioning("Positioning.ini");
|
||||||
|
|
||||||
FOREACH_PlayerNumber( p )
|
FOREACH_PlayerNumber( p )
|
||||||
m_bAttackBeganThisUpdate[p] = false;
|
m_pPlayerState[p]->m_bAttackBeganThisUpdate = false;
|
||||||
|
|
||||||
ResetMusicStatistics();
|
ResetMusicStatistics();
|
||||||
ResetStageStatistics();
|
ResetStageStatistics();
|
||||||
@@ -162,9 +172,9 @@ void GameState::Reset()
|
|||||||
|
|
||||||
FOREACH_PlayerNumber( p )
|
FOREACH_PlayerNumber( p )
|
||||||
{
|
{
|
||||||
m_CurrentPlayerOptions[p].Init();
|
m_pPlayerState[p]->m_CurrentPlayerOptions.Init();
|
||||||
m_PlayerOptions[p].Init();
|
m_pPlayerState[p]->m_PlayerOptions.Init();
|
||||||
m_StoredPlayerOptions[p].Init();
|
m_pPlayerState[p]->m_StoredPlayerOptions.Init();
|
||||||
}
|
}
|
||||||
m_SongOptions.Init();
|
m_SongOptions.Init();
|
||||||
|
|
||||||
@@ -192,8 +202,8 @@ void GameState::Reset()
|
|||||||
|
|
||||||
FOREACH_PlayerNumber(p)
|
FOREACH_PlayerNumber(p)
|
||||||
{
|
{
|
||||||
m_fSuperMeterGrowthScale[p] = 1;
|
m_pPlayerState[p]->m_fSuperMeterGrowthScale = 1;
|
||||||
m_iCpuSkill[p] = 5;
|
m_pPlayerState[p]->m_iCpuSkill = 5;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@@ -253,7 +263,7 @@ void GameState::PlayersFinalized()
|
|||||||
* sets a default of "reverse", and the player turns it off, we should
|
* sets a default of "reverse", and the player turns it off, we should
|
||||||
* set it off. However, don't reset modifiers that aren't saved by the
|
* set it off. However, don't reset modifiers that aren't saved by the
|
||||||
* profile, so we don't ignore unsaved modifiers when a profile is in use. */
|
* profile, so we don't ignore unsaved modifiers when a profile is in use. */
|
||||||
GAMESTATE->m_PlayerOptions[pn].ResetSavedPrefs();
|
GAMESTATE->m_pPlayerState[pn]->m_PlayerOptions.ResetSavedPrefs();
|
||||||
GAMESTATE->ApplyModifiers( pn, sModifiers );
|
GAMESTATE->ApplyModifiers( pn, sModifiers );
|
||||||
}
|
}
|
||||||
// Only set the sort order if it wasn't already set by a GameCommand (or by an earlier profile)
|
// Only set the sort order if it wasn't already set by a GameCommand (or by an earlier profile)
|
||||||
@@ -391,7 +401,7 @@ void GameState::SaveCurrentSettingsToProfile( PlayerNumber pn )
|
|||||||
|
|
||||||
Profile* pProfile = PROFILEMAN->GetProfile(pn);
|
Profile* pProfile = PROFILEMAN->GetProfile(pn);
|
||||||
|
|
||||||
pProfile->SetDefaultModifiers( this->m_pCurGame, m_PlayerOptions[pn].GetSavedPrefsString() );
|
pProfile->SetDefaultModifiers( this->m_pCurGame, m_pPlayerState[pn]->m_PlayerOptions.GetSavedPrefsString() );
|
||||||
if( IsSongSort(m_SortOrder) )
|
if( IsSongSort(m_SortOrder) )
|
||||||
pProfile->m_SortOrder = m_SortOrder;
|
pProfile->m_SortOrder = m_SortOrder;
|
||||||
if( m_PreferredDifficulty[pn] != DIFFICULTY_INVALID )
|
if( m_PreferredDifficulty[pn] != DIFFICULTY_INVALID )
|
||||||
@@ -408,19 +418,19 @@ void GameState::Update( float fDelta )
|
|||||||
{
|
{
|
||||||
FOREACH_PlayerNumber( p )
|
FOREACH_PlayerNumber( p )
|
||||||
{
|
{
|
||||||
m_CurrentPlayerOptions[p].Approach( m_PlayerOptions[p], fDelta );
|
m_pPlayerState[p]->m_CurrentPlayerOptions.Approach( m_pPlayerState[p]->m_PlayerOptions, fDelta );
|
||||||
|
|
||||||
// TRICKY: GAMESTATE->Update is run before any of the Screen update's,
|
// TRICKY: GAMESTATE->Update is run before any of the Screen update's,
|
||||||
// so we'll clear these flags here and let them get turned on later
|
// so we'll clear these flags here and let them get turned on later
|
||||||
m_bAttackBeganThisUpdate[p] = false;
|
m_pPlayerState[p]->m_bAttackBeganThisUpdate = false;
|
||||||
m_bAttackEndedThisUpdate[p] = false;
|
m_pPlayerState[p]->m_bAttackEndedThisUpdate = false;
|
||||||
|
|
||||||
bool bRebuildPlayerOptions = false;
|
bool bRebuildPlayerOptions = false;
|
||||||
|
|
||||||
/* See if any delayed attacks are starting or ending. */
|
/* See if any delayed attacks are starting or ending. */
|
||||||
for( unsigned s=0; s<m_ActiveAttacks[p].size(); s++ )
|
for( unsigned s=0; s<m_pPlayerState[p]->m_ActiveAttacks.size(); s++ )
|
||||||
{
|
{
|
||||||
Attack &attack = m_ActiveAttacks[p][s];
|
Attack &attack = m_pPlayerState[p]->m_ActiveAttacks[s];
|
||||||
|
|
||||||
// -1 is the "starts now" sentinel value. You must add the attack
|
// -1 is the "starts now" sentinel value. You must add the attack
|
||||||
// by calling GameState::LaunchAttack, or else the -1 won't be
|
// by calling GameState::LaunchAttack, or else the -1 won't be
|
||||||
@@ -432,24 +442,24 @@ void GameState::Update( float fDelta )
|
|||||||
( attack.fStartSecond < this->m_fMusicSeconds &&
|
( attack.fStartSecond < this->m_fMusicSeconds &&
|
||||||
m_fMusicSeconds < attack.fStartSecond+attack.fSecsRemaining );
|
m_fMusicSeconds < attack.fStartSecond+attack.fSecsRemaining );
|
||||||
|
|
||||||
if( m_ActiveAttacks[p][s].bOn == bCurrentlyEnabled )
|
if( m_pPlayerState[p]->m_ActiveAttacks[s].bOn == bCurrentlyEnabled )
|
||||||
continue; /* OK */
|
continue; /* OK */
|
||||||
|
|
||||||
if( m_ActiveAttacks[p][s].bOn && !bCurrentlyEnabled )
|
if( m_pPlayerState[p]->m_ActiveAttacks[s].bOn && !bCurrentlyEnabled )
|
||||||
m_bAttackEndedThisUpdate[p] = true;
|
m_pPlayerState[p]->m_bAttackEndedThisUpdate = true;
|
||||||
else if( !m_ActiveAttacks[p][s].bOn && bCurrentlyEnabled )
|
else if( !m_pPlayerState[p]->m_ActiveAttacks[s].bOn && bCurrentlyEnabled )
|
||||||
m_bAttackBeganThisUpdate[p] = true;
|
m_pPlayerState[p]->m_bAttackBeganThisUpdate = true;
|
||||||
|
|
||||||
bRebuildPlayerOptions = true;
|
bRebuildPlayerOptions = true;
|
||||||
|
|
||||||
m_ActiveAttacks[p][s].bOn = bCurrentlyEnabled;
|
m_pPlayerState[p]->m_ActiveAttacks[s].bOn = bCurrentlyEnabled;
|
||||||
}
|
}
|
||||||
|
|
||||||
if( bRebuildPlayerOptions )
|
if( bRebuildPlayerOptions )
|
||||||
RebuildPlayerOptionsFromActiveAttacks( (PlayerNumber)p );
|
RebuildPlayerOptionsFromActiveAttacks( (PlayerNumber)p );
|
||||||
|
|
||||||
if( m_fSecondsUntilAttacksPhasedOut[p] > 0 )
|
if( m_pPlayerState[p]->m_fSecondsUntilAttacksPhasedOut > 0 )
|
||||||
m_fSecondsUntilAttacksPhasedOut[p] = max( 0, m_fSecondsUntilAttacksPhasedOut[p] - fDelta );
|
m_pPlayerState[p]->m_fSecondsUntilAttacksPhasedOut = max( 0, m_pPlayerState[p]->m_fSecondsUntilAttacksPhasedOut - fDelta );
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -531,11 +541,11 @@ void GameState::ResetStageStatistics()
|
|||||||
m_fTugLifePercentP1 = 0.5f;
|
m_fTugLifePercentP1 = 0.5f;
|
||||||
FOREACH_PlayerNumber( p )
|
FOREACH_PlayerNumber( p )
|
||||||
{
|
{
|
||||||
m_fSuperMeter[p] = 0;
|
m_pPlayerState[p]->m_fSuperMeter = 0;
|
||||||
m_HealthState[p] = ALIVE;
|
m_pPlayerState[p]->m_HealthState = PlayerState::ALIVE;
|
||||||
|
|
||||||
m_iLastPositiveSumOfAttackLevels[p] = 0;
|
m_pPlayerState[p]->m_iLastPositiveSumOfAttackLevels = 0;
|
||||||
m_fSecondsUntilAttacksPhasedOut[p] = 0; // PlayerAI not affected
|
m_pPlayerState[p]->m_fSecondsUntilAttacksPhasedOut = 0; // PlayerAI not affected
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@@ -1082,7 +1092,7 @@ void GameState::ApplyModifiers( PlayerNumber pn, CString sModifiers )
|
|||||||
{
|
{
|
||||||
const SongOptions::FailType ft = this->m_SongOptions.m_FailType;
|
const SongOptions::FailType ft = this->m_SongOptions.m_FailType;
|
||||||
|
|
||||||
m_PlayerOptions[pn].FromString( sModifiers );
|
m_pPlayerState[pn]->m_PlayerOptions.FromString( sModifiers );
|
||||||
m_SongOptions.FromString( sModifiers );
|
m_SongOptions.FromString( sModifiers );
|
||||||
|
|
||||||
if( ft != this->m_SongOptions.m_FailType )
|
if( ft != this->m_SongOptions.m_FailType )
|
||||||
@@ -1094,7 +1104,7 @@ void GameState::ApplyModifiers( PlayerNumber pn, CString sModifiers )
|
|||||||
void GameState::StoreSelectedOptions()
|
void GameState::StoreSelectedOptions()
|
||||||
{
|
{
|
||||||
FOREACH_PlayerNumber( p )
|
FOREACH_PlayerNumber( p )
|
||||||
this->m_StoredPlayerOptions[p] = this->m_PlayerOptions[p];
|
m_pPlayerState[p]->m_StoredPlayerOptions = m_pPlayerState[p]->m_PlayerOptions;
|
||||||
m_StoredSongOptions = m_SongOptions;
|
m_StoredSongOptions = m_SongOptions;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -1105,7 +1115,7 @@ void GameState::StoreSelectedOptions()
|
|||||||
void GameState::RestoreSelectedOptions()
|
void GameState::RestoreSelectedOptions()
|
||||||
{
|
{
|
||||||
FOREACH_PlayerNumber( p )
|
FOREACH_PlayerNumber( p )
|
||||||
this->m_PlayerOptions[p] = this->m_StoredPlayerOptions[p];
|
m_pPlayerState[p]->m_PlayerOptions = m_pPlayerState[p]->m_StoredPlayerOptions;
|
||||||
m_SongOptions = m_StoredSongOptions;
|
m_SongOptions = m_StoredSongOptions;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -1116,13 +1126,13 @@ bool GameState::IsDisqualified( PlayerNumber pn )
|
|||||||
|
|
||||||
if( GAMESTATE->IsCourseMode() )
|
if( GAMESTATE->IsCourseMode() )
|
||||||
{
|
{
|
||||||
return GAMESTATE->m_PlayerOptions[pn].IsEasierForCourseAndTrail(
|
return GAMESTATE->m_pPlayerState[pn]->m_PlayerOptions.IsEasierForCourseAndTrail(
|
||||||
GAMESTATE->m_pCurCourse,
|
GAMESTATE->m_pCurCourse,
|
||||||
GAMESTATE->m_pCurTrail[pn] );
|
GAMESTATE->m_pCurTrail[pn] );
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
return GAMESTATE->m_PlayerOptions[pn].IsEasierForSongAndSteps(
|
return GAMESTATE->m_pPlayerState[pn]->m_PlayerOptions.IsEasierForSongAndSteps(
|
||||||
GAMESTATE->m_pCurSong,
|
GAMESTATE->m_pCurSong,
|
||||||
GAMESTATE->m_pCurSteps[pn] );
|
GAMESTATE->m_pCurSteps[pn] );
|
||||||
}
|
}
|
||||||
@@ -1138,8 +1148,8 @@ void GameState::ResetNoteSkins()
|
|||||||
|
|
||||||
void GameState::ResetNoteSkinsForPlayer( PlayerNumber pn )
|
void GameState::ResetNoteSkinsForPlayer( PlayerNumber pn )
|
||||||
{
|
{
|
||||||
m_BeatToNoteSkin[pn].clear();
|
m_pPlayerState[pn]->m_BeatToNoteSkin.clear();
|
||||||
m_BeatToNoteSkin[pn][-1000] = this->m_PlayerOptions[pn].m_sNoteSkin;
|
m_pPlayerState[pn]->m_BeatToNoteSkin[-1000] = m_pPlayerState[pn]->m_PlayerOptions.m_sNoteSkin;
|
||||||
|
|
||||||
++m_BeatToNoteSkinRev;
|
++m_BeatToNoteSkinRev;
|
||||||
}
|
}
|
||||||
@@ -1148,7 +1158,7 @@ void GameState::GetAllUsedNoteSkins( vector<CString> &out ) const
|
|||||||
{
|
{
|
||||||
FOREACH_EnabledPlayer( pn )
|
FOREACH_EnabledPlayer( pn )
|
||||||
{
|
{
|
||||||
out.push_back( this->m_PlayerOptions[pn].m_sNoteSkin );
|
out.push_back( m_pPlayerState[pn]->m_PlayerOptions.m_sNoteSkin );
|
||||||
|
|
||||||
switch( this->m_PlayMode )
|
switch( this->m_PlayMode )
|
||||||
{
|
{
|
||||||
@@ -1171,18 +1181,18 @@ void GameState::GetAllUsedNoteSkins( vector<CString> &out ) const
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
for( map<float,CString>::const_iterator it = m_BeatToNoteSkin[pn].begin();
|
for( map<float,CString>::const_iterator it = m_pPlayerState[pn]->m_BeatToNoteSkin.begin();
|
||||||
it != m_BeatToNoteSkin[pn].end(); ++it )
|
it != m_pPlayerState[pn]->m_BeatToNoteSkin.end(); ++it )
|
||||||
out.push_back( it->second );
|
out.push_back( it->second );
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/* From NoteField: */
|
/* From NoteField: */
|
||||||
|
|
||||||
void GameState::GetUndisplayedBeats( PlayerNumber pn, float TotalSeconds, float &StartBeat, float &EndBeat ) const
|
void GameState::GetUndisplayedBeats( const PlayerState* pPlayerState, float TotalSeconds, float &StartBeat, float &EndBeat ) const
|
||||||
{
|
{
|
||||||
/* If reasonable, push the attack forward so notes on screen don't change suddenly. */
|
/* If reasonable, push the attack forward so notes on screen don't change suddenly. */
|
||||||
StartBeat = min( this->m_fSongBeat+BEATS_PER_MEASURE*2, m_fLastDrawnBeat[pn] );
|
StartBeat = min( m_fSongBeat+BEATS_PER_MEASURE*2, pPlayerState->m_fLastDrawnBeat );
|
||||||
StartBeat = truncf(StartBeat)+1;
|
StartBeat = truncf(StartBeat)+1;
|
||||||
|
|
||||||
const float StartSecond = this->m_pCurSong->GetElapsedTimeFromBeat( StartBeat );
|
const float StartSecond = this->m_pCurSong->GetElapsedTimeFromBeat( StartBeat );
|
||||||
@@ -1192,9 +1202,9 @@ void GameState::GetUndisplayedBeats( PlayerNumber pn, float TotalSeconds, float
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void GameState::SetNoteSkinForBeatRange( PlayerNumber pn, CString sNoteSkin, float StartBeat, float EndBeat )
|
void GameState::SetNoteSkinForBeatRange( PlayerState* pPlayerState, const CString& sNoteSkin, float StartBeat, float EndBeat )
|
||||||
{
|
{
|
||||||
map<float,CString> &BeatToNoteSkin = m_BeatToNoteSkin[pn];
|
map<float,CString> &BeatToNoteSkin = pPlayerState->m_BeatToNoteSkin;
|
||||||
|
|
||||||
/* Erase any other note skin settings in this range. */
|
/* Erase any other note skin settings in this range. */
|
||||||
map<float,CString>::iterator it = BeatToNoteSkin.lower_bound( StartBeat );
|
map<float,CString>::iterator it = BeatToNoteSkin.lower_bound( StartBeat );
|
||||||
@@ -1213,7 +1223,7 @@ void GameState::SetNoteSkinForBeatRange( PlayerNumber pn, CString sNoteSkin, flo
|
|||||||
BeatToNoteSkin[StartBeat] = sNoteSkin;
|
BeatToNoteSkin[StartBeat] = sNoteSkin;
|
||||||
|
|
||||||
/* Return to the default note skin after the duration. */
|
/* Return to the default note skin after the duration. */
|
||||||
BeatToNoteSkin[EndBeat] = m_StoredPlayerOptions[pn].m_sNoteSkin;
|
BeatToNoteSkin[EndBeat] = pPlayerState->m_StoredPlayerOptions.m_sNoteSkin;
|
||||||
|
|
||||||
++m_BeatToNoteSkinRev;
|
++m_BeatToNoteSkinRev;
|
||||||
}
|
}
|
||||||
@@ -1230,21 +1240,21 @@ void GameState::LaunchAttack( PlayerNumber target, const Attack& a )
|
|||||||
* mark the real time it's starting (now), so Update() can know when the attack started
|
* mark the real time it's starting (now), so Update() can know when the attack started
|
||||||
* so it can be removed later. For m_ModsToApply, leave the -1 in, so Player::Update
|
* so it can be removed later. For m_ModsToApply, leave the -1 in, so Player::Update
|
||||||
* knows to apply attack transforms correctly. (yuck) */
|
* knows to apply attack transforms correctly. (yuck) */
|
||||||
m_ModsToApply[target].push_back( attack );
|
m_pPlayerState[target]->m_ModsToApply.push_back( attack );
|
||||||
if( attack.fStartSecond == -1 )
|
if( attack.fStartSecond == -1 )
|
||||||
attack.fStartSecond = this->m_fMusicSeconds;
|
attack.fStartSecond = this->m_fMusicSeconds;
|
||||||
m_ActiveAttacks[target].push_back( attack );
|
m_pPlayerState[target]->m_ActiveAttacks.push_back( attack );
|
||||||
|
|
||||||
this->RebuildPlayerOptionsFromActiveAttacks( target );
|
this->RebuildPlayerOptionsFromActiveAttacks( target );
|
||||||
}
|
}
|
||||||
|
|
||||||
void GameState::RemoveActiveAttacksForPlayer( PlayerNumber pn, AttackLevel al )
|
void GameState::RemoveActiveAttacksForPlayer( PlayerNumber pn, AttackLevel al )
|
||||||
{
|
{
|
||||||
for( unsigned s=0; s<m_ActiveAttacks[pn].size(); s++ )
|
for( unsigned s=0; s<m_pPlayerState[pn]->m_ActiveAttacks.size(); s++ )
|
||||||
{
|
{
|
||||||
if( al != NUM_ATTACK_LEVELS && al != m_ActiveAttacks[pn][s].level )
|
if( al != NUM_ATTACK_LEVELS && al != m_pPlayerState[pn]->m_ActiveAttacks[s].level )
|
||||||
continue;
|
continue;
|
||||||
m_ActiveAttacks[pn].erase( m_ActiveAttacks[pn].begin()+s, m_ActiveAttacks[pn].begin()+s+1 );
|
m_pPlayerState[pn]->m_ActiveAttacks.erase( m_pPlayerState[pn]->m_ActiveAttacks.begin()+s, m_pPlayerState[pn]->m_ActiveAttacks.begin()+s+1 );
|
||||||
--s;
|
--s;
|
||||||
}
|
}
|
||||||
RebuildPlayerOptionsFromActiveAttacks( pn );
|
RebuildPlayerOptionsFromActiveAttacks( pn );
|
||||||
@@ -1253,36 +1263,38 @@ void GameState::RemoveActiveAttacksForPlayer( PlayerNumber pn, AttackLevel al )
|
|||||||
void GameState::RemoveAllInventory()
|
void GameState::RemoveAllInventory()
|
||||||
{
|
{
|
||||||
FOREACH_PlayerNumber( p )
|
FOREACH_PlayerNumber( p )
|
||||||
|
{
|
||||||
for( int s=0; s<NUM_INVENTORY_SLOTS; s++ )
|
for( int s=0; s<NUM_INVENTORY_SLOTS; s++ )
|
||||||
{
|
{
|
||||||
m_Inventory[p][s].fSecsRemaining = 0;
|
m_pPlayerState[p]->m_Inventory[s].fSecsRemaining = 0;
|
||||||
m_Inventory[p][s].sModifier = "";
|
m_pPlayerState[p]->m_Inventory[s].sModifier = "";
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void GameState::RebuildPlayerOptionsFromActiveAttacks( PlayerNumber pn )
|
void GameState::RebuildPlayerOptionsFromActiveAttacks( PlayerNumber pn )
|
||||||
{
|
{
|
||||||
// rebuild player options
|
// rebuild player options
|
||||||
PlayerOptions po = m_StoredPlayerOptions[pn];
|
PlayerOptions po = m_pPlayerState[pn]->m_StoredPlayerOptions;
|
||||||
for( unsigned s=0; s<m_ActiveAttacks[pn].size(); s++ )
|
for( unsigned s=0; s<m_pPlayerState[pn]->m_ActiveAttacks.size(); s++ )
|
||||||
{
|
{
|
||||||
if( !m_ActiveAttacks[pn][s].bOn )
|
if( !m_pPlayerState[pn]->m_ActiveAttacks[s].bOn )
|
||||||
continue; /* hasn't started yet */
|
continue; /* hasn't started yet */
|
||||||
po.FromString( m_ActiveAttacks[pn][s].sModifier );
|
po.FromString( m_pPlayerState[pn]->m_ActiveAttacks[s].sModifier );
|
||||||
}
|
}
|
||||||
m_PlayerOptions[pn] = po;
|
m_pPlayerState[pn]->m_PlayerOptions = po;
|
||||||
|
|
||||||
|
|
||||||
int iSumOfAttackLevels = GetSumOfActiveAttackLevels( pn );
|
int iSumOfAttackLevels = GetSumOfActiveAttackLevels( pn );
|
||||||
if( iSumOfAttackLevels > 0 )
|
if( iSumOfAttackLevels > 0 )
|
||||||
{
|
{
|
||||||
m_iLastPositiveSumOfAttackLevels[pn] = iSumOfAttackLevels;
|
m_pPlayerState[pn]->m_iLastPositiveSumOfAttackLevels = iSumOfAttackLevels;
|
||||||
m_fSecondsUntilAttacksPhasedOut[pn] = 10000; // any positive number that won't run out before the attacks
|
m_pPlayerState[pn]->m_fSecondsUntilAttacksPhasedOut = 10000; // any positive number that won't run out before the attacks
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
// don't change! m_iLastPositiveSumOfAttackLevels[p] = iSumOfAttackLevels;
|
// don't change! m_iLastPositiveSumOfAttackLevels[p] = iSumOfAttackLevels;
|
||||||
m_fSecondsUntilAttacksPhasedOut[pn] = 2; // 2 seconds to phase out
|
m_pPlayerState[pn]->m_fSecondsUntilAttacksPhasedOut = 2; // 2 seconds to phase out
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -1296,9 +1308,9 @@ int GameState::GetSumOfActiveAttackLevels( PlayerNumber pn ) const
|
|||||||
{
|
{
|
||||||
int iSum = 0;
|
int iSum = 0;
|
||||||
|
|
||||||
for( unsigned s=0; s<m_ActiveAttacks[pn].size(); s++ )
|
for( unsigned s=0; s<m_pPlayerState[pn]->m_ActiveAttacks.size(); s++ )
|
||||||
if( m_ActiveAttacks[pn][s].fSecsRemaining > 0 && m_ActiveAttacks[pn][s].level != NUM_ATTACK_LEVELS )
|
if( m_pPlayerState[pn]->m_ActiveAttacks[s].fSecsRemaining > 0 && m_pPlayerState[pn]->m_ActiveAttacks[s].level != NUM_ATTACK_LEVELS )
|
||||||
iSum += m_ActiveAttacks[pn][s].level;
|
iSum += m_pPlayerState[pn]->m_ActiveAttacks[s].level;
|
||||||
|
|
||||||
return iSum;
|
return iSum;
|
||||||
}
|
}
|
||||||
@@ -1674,7 +1686,7 @@ void GameState::StoreRankingName( PlayerNumber pn, CString name )
|
|||||||
bool GameState::AllAreInDangerOrWorse() const
|
bool GameState::AllAreInDangerOrWorse() const
|
||||||
{
|
{
|
||||||
FOREACH_EnabledPlayer( p )
|
FOREACH_EnabledPlayer( p )
|
||||||
if( m_HealthState[p] < DANGER )
|
if( m_pPlayerState[p]->m_HealthState < PlayerState::DANGER )
|
||||||
return false;
|
return false;
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
@@ -1682,7 +1694,7 @@ bool GameState::AllAreInDangerOrWorse() const
|
|||||||
bool GameState::AllAreDead() const
|
bool GameState::AllAreDead() const
|
||||||
{
|
{
|
||||||
FOREACH_EnabledPlayer( p )
|
FOREACH_EnabledPlayer( p )
|
||||||
if( m_HealthState[p] < DEAD )
|
if( m_pPlayerState[p]->m_HealthState < PlayerState::DEAD )
|
||||||
return false;
|
return false;
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
@@ -1698,7 +1710,7 @@ bool GameState::AllHaveComboOf30OrMoreMisses() const
|
|||||||
bool GameState::OneIsHot() const
|
bool GameState::OneIsHot() const
|
||||||
{
|
{
|
||||||
FOREACH_EnabledPlayer( p )
|
FOREACH_EnabledPlayer( p )
|
||||||
if( m_HealthState[p] == HOT )
|
if( m_pPlayerState[p]->m_HealthState == PlayerState::HOT )
|
||||||
return true;
|
return true;
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
@@ -1870,12 +1882,12 @@ Difficulty GameState::GetEasiestNotesDifficulty() const
|
|||||||
|
|
||||||
bool PlayerIsUsingModifier( PlayerNumber pn, const CString sModifier )
|
bool PlayerIsUsingModifier( PlayerNumber pn, const CString sModifier )
|
||||||
{
|
{
|
||||||
PlayerOptions po = GAMESTATE->m_PlayerOptions[pn];
|
PlayerOptions po = GAMESTATE->m_pPlayerState[pn]->m_PlayerOptions;
|
||||||
SongOptions so = GAMESTATE->m_SongOptions;
|
SongOptions so = GAMESTATE->m_SongOptions;
|
||||||
po.FromString( sModifier );
|
po.FromString( sModifier );
|
||||||
so.FromString( sModifier );
|
so.FromString( sModifier );
|
||||||
|
|
||||||
return po == GAMESTATE->m_PlayerOptions[pn] && so == GAMESTATE->m_SongOptions;
|
return po == GAMESTATE->m_pPlayerState[pn]->m_PlayerOptions && so == GAMESTATE->m_SongOptions;
|
||||||
}
|
}
|
||||||
|
|
||||||
#include "LuaFunctions.h"
|
#include "LuaFunctions.h"
|
||||||
|
|||||||
@@ -4,7 +4,6 @@
|
|||||||
#define GAMESTATE_H
|
#define GAMESTATE_H
|
||||||
|
|
||||||
#include "GameConstantsAndTypes.h"
|
#include "GameConstantsAndTypes.h"
|
||||||
#include "PlayerOptions.h"
|
|
||||||
#include "SongOptions.h"
|
#include "SongOptions.h"
|
||||||
#include "Grade.h"
|
#include "Grade.h"
|
||||||
#include "Attack.h"
|
#include "Attack.h"
|
||||||
@@ -24,6 +23,7 @@ class NoteFieldPositioning;
|
|||||||
class Character;
|
class Character;
|
||||||
class TimingData;
|
class TimingData;
|
||||||
struct StageStats;
|
struct StageStats;
|
||||||
|
struct PlayerState;
|
||||||
|
|
||||||
class GameState
|
class GameState
|
||||||
{
|
{
|
||||||
@@ -89,13 +89,6 @@ public:
|
|||||||
Character* GameState::GetRandomCharacter();
|
Character* GameState::GetRandomCharacter();
|
||||||
Character* GameState::GetDefaultCharacter();
|
Character* GameState::GetDefaultCharacter();
|
||||||
|
|
||||||
PlayerController m_PlayerController[NUM_PLAYERS];
|
|
||||||
|
|
||||||
// Used in Battle and Rave
|
|
||||||
int m_iCpuSkill[NUM_PLAYERS]; // only used when m_PlayerController is PC_CPU
|
|
||||||
// Used in Rave
|
|
||||||
float m_fSuperMeterGrowthScale[NUM_PLAYERS];
|
|
||||||
|
|
||||||
|
|
||||||
bool IsCourseMode() const;
|
bool IsCourseMode() const;
|
||||||
bool IsBattleMode() const; /* not Rave */
|
bool IsBattleMode() const; /* not Rave */
|
||||||
@@ -155,9 +148,7 @@ public:
|
|||||||
bool m_bFreeze; // in the middle of a freeze
|
bool m_bFreeze; // in the middle of a freeze
|
||||||
RageTimer m_LastBeatUpdate; // time of last m_fSongBeat, etc. update
|
RageTimer m_LastBeatUpdate; // time of last m_fSongBeat, etc. update
|
||||||
bool m_bPastHereWeGo;
|
bool m_bPastHereWeGo;
|
||||||
float m_fLastDrawnBeat[NUM_PLAYERS]; // set by NoteField
|
|
||||||
|
|
||||||
map<float,CString> m_BeatToNoteSkin[NUM_PLAYERS];
|
|
||||||
int m_BeatToNoteSkinRev; /* hack: incremented whenever m_BeatToNoteSkin changes */
|
int m_BeatToNoteSkinRev; /* hack: incremented whenever m_BeatToNoteSkin changes */
|
||||||
void ResetNoteSkins();
|
void ResetNoteSkins();
|
||||||
void ResetNoteSkinsForPlayer( PlayerNumber pn );
|
void ResetNoteSkinsForPlayer( PlayerNumber pn );
|
||||||
@@ -169,36 +160,21 @@ public:
|
|||||||
void UpdateSongPosition( float fPositionSeconds, const TimingData &timing, const RageTimer ×tamp = RageZeroTimer );
|
void UpdateSongPosition( float fPositionSeconds, const TimingData &timing, const RageTimer ×tamp = RageZeroTimer );
|
||||||
float GetSongPercent( float beat ) const;
|
float GetSongPercent( float beat ) const;
|
||||||
|
|
||||||
enum HealthState { HOT, ALIVE, DANGER, DEAD };
|
|
||||||
HealthState m_HealthState[NUM_PLAYERS];
|
|
||||||
bool AllAreInDangerOrWorse() const;
|
bool AllAreInDangerOrWorse() const;
|
||||||
bool AllAreDead() const;
|
bool AllAreDead() const;
|
||||||
bool AllHaveComboOf30OrMoreMisses() const;
|
bool AllHaveComboOf30OrMoreMisses() const;
|
||||||
bool OneIsHot() const;
|
bool OneIsHot() const;
|
||||||
|
|
||||||
// used in PLAY_MODE_BATTLE and PLAY_MODE_RAVE
|
// used in PLAY_MODE_BATTLE and PLAY_MODE_RAVE
|
||||||
AttackArray m_ActiveAttacks[NUM_PLAYERS];
|
void SetNoteSkinForBeatRange( PlayerState* pPlayerState, const CString& sNoteSkin, float StartBeat, float EndBeat );
|
||||||
|
|
||||||
// Attacks take a while to transition out of use. Account for this in PlayerAI
|
|
||||||
// by still penalizing it for 1 second after the player options are rebuilt.
|
|
||||||
int m_iLastPositiveSumOfAttackLevels[NUM_PLAYERS];
|
|
||||||
float m_fSecondsUntilAttacksPhasedOut[NUM_PLAYERS]; // positive means PlayerAI is still affected
|
|
||||||
|
|
||||||
vector<Attack> m_ModsToApply[NUM_PLAYERS];
|
|
||||||
|
|
||||||
void SetNoteSkinForBeatRange( PlayerNumber pn, CString sNoteSkin, float StartBeat, float EndBeat );
|
|
||||||
|
|
||||||
// used in PLAY_MODE_BATTLE
|
// used in PLAY_MODE_BATTLE
|
||||||
Attack m_Inventory[NUM_PLAYERS][NUM_INVENTORY_SLOTS];
|
|
||||||
float m_fOpponentHealthPercent;
|
float m_fOpponentHealthPercent;
|
||||||
|
|
||||||
// used in PLAY_MODE_RAVE
|
// used in PLAY_MODE_RAVE
|
||||||
float m_fTugLifePercentP1;
|
float m_fTugLifePercentP1;
|
||||||
float m_fSuperMeter[NUM_PLAYERS]; // between 0 and NUM_ATTACK_LEVELS
|
|
||||||
|
|
||||||
bool m_bAttackBeganThisUpdate[NUM_PLAYERS]; // flag for other objects to watch (play sounds)
|
void GetUndisplayedBeats( const PlayerState* pPlayerState, float TotalSeconds, float &StartBeat, float &EndBeat ) const; // only meaningful when a NoteField is in use
|
||||||
bool m_bAttackEndedThisUpdate[NUM_PLAYERS]; // flag for other objects to watch (play sounds)
|
|
||||||
void GetUndisplayedBeats( PlayerNumber pn, float TotalSeconds, float &StartBeat, float &EndBeat ) const; // only meaningful when a NoteField is in use
|
|
||||||
void LaunchAttack( PlayerNumber target, const Attack& a );
|
void LaunchAttack( PlayerNumber target, const Attack& a );
|
||||||
void RebuildPlayerOptionsFromActiveAttacks( PlayerNumber pn );
|
void RebuildPlayerOptionsFromActiveAttacks( PlayerNumber pn );
|
||||||
void RemoveAllActiveAttacks(); // called on end of song
|
void RemoveAllActiveAttacks(); // called on end of song
|
||||||
@@ -216,9 +192,6 @@ public:
|
|||||||
// Options stuff
|
// Options stuff
|
||||||
//
|
//
|
||||||
|
|
||||||
PlayerOptions m_CurrentPlayerOptions[NUM_PLAYERS]; // current approaches destination
|
|
||||||
PlayerOptions m_PlayerOptions[NUM_PLAYERS]; // change this, and current will move gradually toward it
|
|
||||||
PlayerOptions m_StoredPlayerOptions[NUM_PLAYERS]; // user's choices on the PlayerOptions screen
|
|
||||||
SongOptions m_SongOptions;
|
SongOptions m_SongOptions;
|
||||||
SongOptions m_StoredSongOptions;
|
SongOptions m_StoredSongOptions;
|
||||||
|
|
||||||
@@ -292,6 +265,11 @@ public:
|
|||||||
//
|
//
|
||||||
void GetDifficultiesToShow( set<Difficulty> &AddTo );
|
void GetDifficultiesToShow( set<Difficulty> &AddTo );
|
||||||
void GetCourseDifficultiesToShow( set<CourseDifficulty> &AddTo );
|
void GetCourseDifficultiesToShow( set<CourseDifficulty> &AddTo );
|
||||||
|
|
||||||
|
//
|
||||||
|
// PlayerState
|
||||||
|
//
|
||||||
|
PlayerState* m_pPlayerState[NUM_PLAYERS];
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@@ -9,6 +9,7 @@
|
|||||||
#include "PrefsManager.h"
|
#include "PrefsManager.h"
|
||||||
#include "NoteFieldPositioning.h"
|
#include "NoteFieldPositioning.h"
|
||||||
#include "Game.h"
|
#include "Game.h"
|
||||||
|
#include "PlayerState.h"
|
||||||
|
|
||||||
|
|
||||||
GhostArrowRow::GhostArrowRow()
|
GhostArrowRow::GhostArrowRow()
|
||||||
@@ -16,11 +17,11 @@ GhostArrowRow::GhostArrowRow()
|
|||||||
m_iNumCols = 0;
|
m_iNumCols = 0;
|
||||||
}
|
}
|
||||||
#include "RageLog.h"
|
#include "RageLog.h"
|
||||||
void GhostArrowRow::Load( PlayerNumber pn, CString NoteSkin, float fYReverseOffset )
|
void GhostArrowRow::Load( const PlayerState* pPlayerState, CString NoteSkin, float fYReverseOffset )
|
||||||
{
|
{
|
||||||
Unload();
|
Unload();
|
||||||
|
|
||||||
m_PlayerNumber = pn;
|
m_pPlayerState = pPlayerState;
|
||||||
m_fYReverseOffsetPixels = fYReverseOffset;
|
m_fYReverseOffsetPixels = fYReverseOffset;
|
||||||
|
|
||||||
const Style* pStyle = GAMESTATE->GetCurrentStyle();
|
const Style* pStyle = GAMESTATE->GetCurrentStyle();
|
||||||
@@ -30,6 +31,8 @@ void GhostArrowRow::Load( PlayerNumber pn, CString NoteSkin, float fYReverseOffs
|
|||||||
// init arrows
|
// init arrows
|
||||||
for( int c=0; c<m_iNumCols; c++ )
|
for( int c=0; c<m_iNumCols; c++ )
|
||||||
{
|
{
|
||||||
|
// TODO: Remove indexing by PlayerNumber;
|
||||||
|
PlayerNumber pn = pPlayerState->m_PlayerNumber;
|
||||||
NoteFieldMode &mode = g_NoteFieldMode[pn];
|
NoteFieldMode &mode = g_NoteFieldMode[pn];
|
||||||
CString Button = mode.GhostButtonNames[c];
|
CString Button = mode.GhostButtonNames[c];
|
||||||
if( Button == "" )
|
if( Button == "" )
|
||||||
@@ -78,9 +81,9 @@ void GhostArrowRow::Update( float fDeltaTime )
|
|||||||
m_GhostBright[c]->Update( fDeltaTime );
|
m_GhostBright[c]->Update( fDeltaTime );
|
||||||
m_HoldGhost[c]->Update( fDeltaTime );
|
m_HoldGhost[c]->Update( fDeltaTime );
|
||||||
|
|
||||||
const float fX = ArrowGetXPos( m_PlayerNumber, c, 0 );
|
const float fX = ArrowEffects::GetXPos( m_pPlayerState, c, 0 );
|
||||||
const float fY = ArrowGetYPos( m_PlayerNumber, c, 0, m_fYReverseOffsetPixels );
|
const float fY = ArrowEffects::GetYPos( m_pPlayerState, c, 0, m_fYReverseOffsetPixels );
|
||||||
const float fZ = ArrowGetZPos( m_PlayerNumber, c, 0 );
|
const float fZ = ArrowEffects::GetZPos( m_pPlayerState, c, 0 );
|
||||||
|
|
||||||
m_GhostDim[c]->SetX( fX );
|
m_GhostDim[c]->SetX( fX );
|
||||||
m_GhostBright[c]->SetX( fX );
|
m_GhostBright[c]->SetX( fX );
|
||||||
@@ -94,7 +97,7 @@ void GhostArrowRow::Update( float fDeltaTime )
|
|||||||
m_GhostBright[c]->SetZ( fZ );
|
m_GhostBright[c]->SetZ( fZ );
|
||||||
m_HoldGhost[c]->SetZ( fZ );
|
m_HoldGhost[c]->SetZ( fZ );
|
||||||
|
|
||||||
const float fZoom = ArrowGetZoom( m_PlayerNumber );
|
const float fZoom = ArrowEffects::GetZoom( m_pPlayerState );
|
||||||
m_GhostDim[c]->SetZoom( fZoom );
|
m_GhostDim[c]->SetZoom( fZoom );
|
||||||
m_GhostBright[c]->SetZoom( fZoom );
|
m_GhostBright[c]->SetZoom( fZoom );
|
||||||
m_HoldGhost[c]->SetZoom( fZoom );
|
m_HoldGhost[c]->SetZoom( fZoom );
|
||||||
@@ -105,13 +108,16 @@ void GhostArrowRow::DrawPrimitives()
|
|||||||
{
|
{
|
||||||
for( int c=0; c<m_iNumCols; c++ )
|
for( int c=0; c<m_iNumCols; c++ )
|
||||||
{
|
{
|
||||||
g_NoteFieldMode[m_PlayerNumber].BeginDrawTrack(c);
|
// TODO: Remove indexing by PlayerNumber.
|
||||||
|
PlayerNumber pn = m_pPlayerState->m_PlayerNumber;
|
||||||
|
|
||||||
|
g_NoteFieldMode[pn].BeginDrawTrack(c);
|
||||||
|
|
||||||
m_GhostDim[c]->Draw();
|
m_GhostDim[c]->Draw();
|
||||||
m_GhostBright[c]->Draw();
|
m_GhostBright[c]->Draw();
|
||||||
m_HoldGhost[c]->Draw();
|
m_HoldGhost[c]->Draw();
|
||||||
|
|
||||||
g_NoteFieldMode[m_PlayerNumber].EndDrawTrack(c);
|
g_NoteFieldMode[pn].EndDrawTrack(c);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -7,9 +7,8 @@
|
|||||||
#include "GhostArrow.h"
|
#include "GhostArrow.h"
|
||||||
#include "HoldGhostArrow.h"
|
#include "HoldGhostArrow.h"
|
||||||
#include "GameConstantsAndTypes.h"
|
#include "GameConstantsAndTypes.h"
|
||||||
#include "Style.h"
|
|
||||||
|
|
||||||
|
|
||||||
|
struct PlayerState;
|
||||||
|
|
||||||
class GhostArrowRow : public ActorFrame
|
class GhostArrowRow : public ActorFrame
|
||||||
{
|
{
|
||||||
@@ -20,7 +19,7 @@ public:
|
|||||||
virtual void DrawPrimitives();
|
virtual void DrawPrimitives();
|
||||||
virtual void CopyTweening( const GhostArrowRow &from );
|
virtual void CopyTweening( const GhostArrowRow &from );
|
||||||
|
|
||||||
void Load( PlayerNumber pn, CString NoteSkin, float fYReverseOffset );
|
void Load( const PlayerState* pPlayerState, CString NoteSkin, float fYReverseOffset );
|
||||||
void Unload();
|
void Unload();
|
||||||
|
|
||||||
void DidTapNote( int iCol, TapNoteScore score, bool bBright );
|
void DidTapNote( int iCol, TapNoteScore score, bool bBright );
|
||||||
@@ -29,7 +28,7 @@ public:
|
|||||||
protected:
|
protected:
|
||||||
int m_iNumCols;
|
int m_iNumCols;
|
||||||
float m_fYReverseOffsetPixels;
|
float m_fYReverseOffsetPixels;
|
||||||
PlayerNumber m_PlayerNumber;
|
const PlayerState* m_pPlayerState;
|
||||||
|
|
||||||
vector<GhostArrow *> m_GhostDim;
|
vector<GhostArrow *> m_GhostDim;
|
||||||
vector<GhostArrow *> m_GhostBright;
|
vector<GhostArrow *> m_GhostBright;
|
||||||
|
|||||||
+23
-16
@@ -10,6 +10,7 @@
|
|||||||
#include "ScreenGameplay.h"
|
#include "ScreenGameplay.h"
|
||||||
#include "StageStats.h"
|
#include "StageStats.h"
|
||||||
#include "ThemeMetric.h"
|
#include "ThemeMetric.h"
|
||||||
|
#include "PlayerState.h"
|
||||||
|
|
||||||
|
|
||||||
#define NUM_ITEM_TYPES THEME->GetMetricF("Inventory","NumItemTypes")
|
#define NUM_ITEM_TYPES THEME->GetMetricF("Inventory","NumItemTypes")
|
||||||
@@ -61,11 +62,11 @@ Inventory::~Inventory()
|
|||||||
m_vpSoundUseItem.clear();
|
m_vpSoundUseItem.clear();
|
||||||
}
|
}
|
||||||
|
|
||||||
void Inventory::Load( PlayerNumber pn )
|
void Inventory::Load( PlayerState* pPlayerState )
|
||||||
{
|
{
|
||||||
ReloadItems();
|
ReloadItems();
|
||||||
|
|
||||||
m_PlayerNumber = pn;
|
m_pPlayerState = pPlayerState;
|
||||||
m_iLastSeenCombo = 0;
|
m_iLastSeenCombo = 0;
|
||||||
|
|
||||||
// don't load battle sounds if they're not going to be used
|
// don't load battle sounds if they're not going to be used
|
||||||
@@ -87,10 +88,11 @@ void Inventory::Load( PlayerNumber pn )
|
|||||||
|
|
||||||
void Inventory::Update( float fDelta )
|
void Inventory::Update( float fDelta )
|
||||||
{
|
{
|
||||||
if( GAMESTATE->m_bAttackEndedThisUpdate[m_PlayerNumber] )
|
if( m_pPlayerState->m_bAttackEndedThisUpdate )
|
||||||
m_soundItemEnding.Play();
|
m_soundItemEnding.Play();
|
||||||
|
|
||||||
PlayerNumber pn = m_PlayerNumber;
|
// TODO: remove use of PlayerNumber
|
||||||
|
PlayerNumber pn = m_pPlayerState->m_PlayerNumber;
|
||||||
|
|
||||||
// check to see if they deserve a new item
|
// check to see if they deserve a new item
|
||||||
if( g_CurStageStats.iCurCombo[pn] != m_iLastSeenCombo )
|
if( g_CurStageStats.iCurCombo[pn] != m_iLastSeenCombo )
|
||||||
@@ -120,7 +122,7 @@ void Inventory::Update( float fDelta )
|
|||||||
|
|
||||||
|
|
||||||
// use items if this player is CPU-controlled
|
// use items if this player is CPU-controlled
|
||||||
if( GAMESTATE->m_PlayerController[m_PlayerNumber] != PC_HUMAN &&
|
if( m_pPlayerState->m_PlayerController != PC_HUMAN &&
|
||||||
GAMESTATE->m_fSongBeat < GAMESTATE->m_pCurSong->m_fLastBeat )
|
GAMESTATE->m_fSongBeat < GAMESTATE->m_pCurSong->m_fLastBeat )
|
||||||
{
|
{
|
||||||
// every 1 seconds, try to use an item
|
// every 1 seconds, try to use an item
|
||||||
@@ -129,7 +131,7 @@ void Inventory::Update( float fDelta )
|
|||||||
if( iLastSecond != iThisSecond )
|
if( iLastSecond != iThisSecond )
|
||||||
{
|
{
|
||||||
for( int s=0; s<NUM_INVENTORY_SLOTS; s++ )
|
for( int s=0; s<NUM_INVENTORY_SLOTS; s++ )
|
||||||
if( !GAMESTATE->m_Inventory[m_PlayerNumber][s].IsBlank() )
|
if( !m_pPlayerState->m_Inventory[s].IsBlank() )
|
||||||
if( randomf(0,1) < ITEM_USE_PROBABILITY )
|
if( randomf(0,1) < ITEM_USE_PROBABILITY )
|
||||||
UseItem( s );
|
UseItem( s );
|
||||||
}
|
}
|
||||||
@@ -140,26 +142,30 @@ void Inventory::AwardItem( int iItemIndex )
|
|||||||
{
|
{
|
||||||
// CPU player is vanity only. It should have no effect on gameplay
|
// CPU player is vanity only. It should have no effect on gameplay
|
||||||
// and should not aquire/launch attacks.
|
// and should not aquire/launch attacks.
|
||||||
if( GAMESTATE->IsCpuPlayer(m_PlayerNumber) )
|
if( m_pPlayerState->m_PlayerController == PC_CPU )
|
||||||
return;
|
return;
|
||||||
|
|
||||||
|
|
||||||
// search for the first open slot
|
// search for the first open slot
|
||||||
int iOpenSlot = -1;
|
int iOpenSlot = -1;
|
||||||
|
|
||||||
Attack* asInventory = GAMESTATE->m_Inventory[m_PlayerNumber]; //[NUM_INVENTORY_SLOTS]
|
Attack* pInventory = m_pPlayerState->m_Inventory; //[NUM_INVENTORY_SLOTS]
|
||||||
|
|
||||||
if( asInventory[NUM_INVENTORY_SLOTS/2].IsBlank() )
|
if( pInventory[NUM_INVENTORY_SLOTS/2].IsBlank() )
|
||||||
|
{
|
||||||
iOpenSlot = NUM_INVENTORY_SLOTS/2;
|
iOpenSlot = NUM_INVENTORY_SLOTS/2;
|
||||||
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
for( int s=0; s<NUM_INVENTORY_SLOTS; s++ )
|
for( int s=0; s<NUM_INVENTORY_SLOTS; s++ )
|
||||||
if( asInventory[s].IsBlank() )
|
{
|
||||||
|
if( pInventory[s].IsBlank() )
|
||||||
{
|
{
|
||||||
iOpenSlot = s;
|
iOpenSlot = s;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
if( iOpenSlot != -1 )
|
if( iOpenSlot != -1 )
|
||||||
{
|
{
|
||||||
@@ -167,7 +173,7 @@ void Inventory::AwardItem( int iItemIndex )
|
|||||||
a.sModifier = g_Items[iItemIndex].sModifier;
|
a.sModifier = g_Items[iItemIndex].sModifier;
|
||||||
a.fSecsRemaining = ITEM_DURATION_SECONDS;
|
a.fSecsRemaining = ITEM_DURATION_SECONDS;
|
||||||
a.level = g_Items[iItemIndex].level;
|
a.level = g_Items[iItemIndex].level;
|
||||||
asInventory[iOpenSlot] = a;
|
pInventory[iOpenSlot] = a;
|
||||||
m_soundAcquireItem.Play();
|
m_soundAcquireItem.Play();
|
||||||
}
|
}
|
||||||
// else not enough room to insert item
|
// else not enough room to insert item
|
||||||
@@ -175,16 +181,17 @@ void Inventory::AwardItem( int iItemIndex )
|
|||||||
|
|
||||||
void Inventory::UseItem( int iSlot )
|
void Inventory::UseItem( int iSlot )
|
||||||
{
|
{
|
||||||
Attack* asInventory = GAMESTATE->m_Inventory[m_PlayerNumber]; //[NUM_INVENTORY_SLOTS]
|
Attack* pInventory = m_pPlayerState->m_Inventory; //[NUM_INVENTORY_SLOTS]
|
||||||
|
|
||||||
if( asInventory[iSlot].IsBlank() )
|
if( pInventory[iSlot].IsBlank() )
|
||||||
return;
|
return;
|
||||||
|
|
||||||
PlayerNumber pnToAttack = OPPOSITE_PLAYER[m_PlayerNumber];
|
PlayerNumber pn = m_pPlayerState->m_PlayerNumber;
|
||||||
Attack a = asInventory[iSlot];
|
PlayerNumber pnToAttack = OPPOSITE_PLAYER[pn];
|
||||||
|
Attack a = pInventory[iSlot];
|
||||||
|
|
||||||
// remove the item
|
// remove the item
|
||||||
asInventory[iSlot].MakeBlank();
|
pInventory[iSlot].MakeBlank();
|
||||||
m_vpSoundUseItem[a.level]->Play();
|
m_vpSoundUseItem[a.level]->Play();
|
||||||
|
|
||||||
GAMESTATE->LaunchAttack( pnToAttack, a );
|
GAMESTATE->LaunchAttack( pnToAttack, a );
|
||||||
|
|||||||
@@ -7,13 +7,14 @@
|
|||||||
#include "PlayerNumber.h"
|
#include "PlayerNumber.h"
|
||||||
#include "RageSound.h"
|
#include "RageSound.h"
|
||||||
|
|
||||||
|
struct PlayerState;
|
||||||
|
|
||||||
class Inventory : public Actor
|
class Inventory : public Actor
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
Inventory();
|
Inventory();
|
||||||
~Inventory();
|
~Inventory();
|
||||||
void Load( PlayerNumber pn );
|
void Load( PlayerState* pPlayerState );
|
||||||
|
|
||||||
virtual void Update( float fDelta );
|
virtual void Update( float fDelta );
|
||||||
virtual void DrawPrimitives() {};
|
virtual void DrawPrimitives() {};
|
||||||
@@ -23,7 +24,7 @@ public:
|
|||||||
protected:
|
protected:
|
||||||
void AwardItem( int iItemIndex );
|
void AwardItem( int iItemIndex );
|
||||||
|
|
||||||
PlayerNumber m_PlayerNumber;
|
PlayerState* m_pPlayerState;
|
||||||
int m_iLastSeenCombo;
|
int m_iLastSeenCombo;
|
||||||
|
|
||||||
RageSound m_soundAcquireItem;
|
RageSound m_soundAcquireItem;
|
||||||
|
|||||||
@@ -9,6 +9,7 @@
|
|||||||
#include "song.h"
|
#include "song.h"
|
||||||
#include "StageStats.h"
|
#include "StageStats.h"
|
||||||
#include "ThemeMetric.h"
|
#include "ThemeMetric.h"
|
||||||
|
#include "PlayerState.h"
|
||||||
|
|
||||||
|
|
||||||
static ThemeMetric<float> METER_WIDTH ("LifeMeterBar","MeterWidth");
|
static ThemeMetric<float> METER_WIDTH ("LifeMeterBar","MeterWidth");
|
||||||
@@ -466,9 +467,9 @@ void LifeMeterBar::AfterLifeChanged()
|
|||||||
|
|
||||||
bool LifeMeterBar::IsPastPassmark() const
|
bool LifeMeterBar::IsPastPassmark() const
|
||||||
{
|
{
|
||||||
if( GAMESTATE->m_PlayerOptions[m_PlayerNumber].m_fPassmark > 0 )
|
if( GAMESTATE->m_pPlayerState[m_PlayerNumber]->m_PlayerOptions.m_fPassmark > 0 )
|
||||||
{
|
{
|
||||||
return m_fLifePercentage >= GAMESTATE->m_PlayerOptions[m_PlayerNumber].m_fPassmark;
|
return m_fLifePercentage >= GAMESTATE->m_pPlayerState[m_PlayerNumber]->m_PlayerOptions.m_fPassmark;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -65,7 +65,7 @@ NoteFieldPositioning.cpp NoteFieldPositioning.h NoteTypes.cpp NoteTypes.h NotesL
|
|||||||
NotesLoaderBMS.cpp NotesLoaderBMS.h NotesLoaderDWI.cpp NotesLoaderDWI.h NotesLoaderKSF.cpp NotesLoaderKSF.h \
|
NotesLoaderBMS.cpp NotesLoaderBMS.h NotesLoaderDWI.cpp NotesLoaderDWI.h NotesLoaderKSF.cpp NotesLoaderKSF.h \
|
||||||
NotesLoaderSM.cpp NotesLoaderSM.h NotesWriterDWI.cpp NotesWriterDWI.h NotesWriterSM.cpp NotesWriterSM.h \
|
NotesLoaderSM.cpp NotesLoaderSM.h NotesWriterDWI.cpp NotesWriterDWI.h NotesWriterSM.cpp NotesWriterSM.h \
|
||||||
PlayerAI.cpp PlayerAI.h PlayerNumber.cpp PlayerNumber.h PlayerOptions.cpp PlayerOptions.h \
|
PlayerAI.cpp PlayerAI.h PlayerNumber.cpp PlayerNumber.h PlayerOptions.cpp PlayerOptions.h \
|
||||||
Preference.cpp Preference.h Profile.cpp Profile.h \
|
PlayerState.cpp PlayerState.h Preference.cpp Preference.h Profile.cpp Profile.h \
|
||||||
RandomSample.cpp RandomSample.h RadarValues.cpp RadarValues.h ScreenDimensions.h ScreenDimensions.cpp \
|
RandomSample.cpp RandomSample.h RadarValues.cpp RadarValues.h ScreenDimensions.h ScreenDimensions.cpp \
|
||||||
ScoreKeeper.h ScoreKeeperMAX2.cpp ScoreKeeperMAX2.h \
|
ScoreKeeper.h ScoreKeeperMAX2.cpp ScoreKeeperMAX2.h \
|
||||||
ScoreKeeperRave.cpp ScoreKeeperRave.h Song.cpp song.h SongCacheIndex.cpp SongCacheIndex.h \
|
ScoreKeeperRave.cpp ScoreKeeperRave.h Song.cpp song.h SongCacheIndex.cpp SongCacheIndex.h \
|
||||||
|
|||||||
@@ -24,6 +24,7 @@
|
|||||||
#include "Foreach.h"
|
#include "Foreach.h"
|
||||||
#include "Style.h"
|
#include "Style.h"
|
||||||
#include "ThemeMetric.h"
|
#include "ThemeMetric.h"
|
||||||
|
#include "PlayerState.h"
|
||||||
|
|
||||||
|
|
||||||
#define FADE_SECONDS THEME->GetMetricF("MusicWheel","FadeSeconds")
|
#define FADE_SECONDS THEME->GetMetricF("MusicWheel","FadeSeconds")
|
||||||
@@ -142,15 +143,12 @@ void MusicWheel::Load()
|
|||||||
po,
|
po,
|
||||||
so );
|
so );
|
||||||
GAMESTATE->m_pCurSong = GAMESTATE->m_pPreferredSong = pSong;
|
GAMESTATE->m_pCurSong = GAMESTATE->m_pPreferredSong = pSong;
|
||||||
FOREACH_PlayerNumber( p )
|
FOREACH_HumanPlayer( p )
|
||||||
{
|
|
||||||
if( GAMESTATE->IsHumanPlayer(p) )
|
|
||||||
{
|
{
|
||||||
GAMESTATE->m_pCurSteps[p] = pSteps;
|
GAMESTATE->m_pCurSteps[p] = pSteps;
|
||||||
GAMESTATE->m_PlayerOptions[p] = po;
|
GAMESTATE->m_pPlayerState[p]->m_PlayerOptions = po;
|
||||||
GAMESTATE->m_PreferredDifficulty[p] = pSteps->GetDifficulty();
|
GAMESTATE->m_PreferredDifficulty[p] = pSteps->GetDifficulty();
|
||||||
}
|
}
|
||||||
}
|
|
||||||
GAMESTATE->m_SongOptions = so;
|
GAMESTATE->m_SongOptions = so;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -39,6 +39,7 @@ void NetworkSyncManager::SelectUserSong() { }
|
|||||||
#include "ScreenMessage.h"
|
#include "ScreenMessage.h"
|
||||||
#include "GameManager.h"
|
#include "GameManager.h"
|
||||||
#include "arch/LoadingWindow/LoadingWindow.h"
|
#include "arch/LoadingWindow/LoadingWindow.h"
|
||||||
|
#include "PlayerState.h"
|
||||||
|
|
||||||
const ScreenMessage SM_AddToChat = ScreenMessage(SM_User+4);
|
const ScreenMessage SM_AddToChat = ScreenMessage(SM_User+4);
|
||||||
const ScreenMessage SM_ChangeSong = ScreenMessage(SM_User+5);
|
const ScreenMessage SM_ChangeSong = ScreenMessage(SM_User+5);
|
||||||
@@ -418,7 +419,7 @@ void NetworkSyncManager::StartRequest(short position)
|
|||||||
FOREACH_PlayerNumber (p)
|
FOREACH_PlayerNumber (p)
|
||||||
{
|
{
|
||||||
++players;
|
++players;
|
||||||
m_packet.WriteNT(GAMESTATE->m_PlayerOptions[p].GetString());
|
m_packet.WriteNT(GAMESTATE->m_pPlayerState[p]->m_PlayerOptions.GetString());
|
||||||
}
|
}
|
||||||
for (int i=0; i<2-players; ++i)
|
for (int i=0; i<2-players; ++i)
|
||||||
m_packet.WriteNT(""); //Write a NULL if no player
|
m_packet.WriteNT(""); //Write a NULL if no player
|
||||||
@@ -697,7 +698,7 @@ void NetworkSyncManager::ReportPlayerOptions()
|
|||||||
m_packet.ClearPacket();
|
m_packet.ClearPacket();
|
||||||
m_packet.Write1( NSCUPOpts );
|
m_packet.Write1( NSCUPOpts );
|
||||||
FOREACH_PlayerNumber (pn)
|
FOREACH_PlayerNumber (pn)
|
||||||
m_packet.WriteNT( GAMESTATE->m_PlayerOptions[pn].GetString() );
|
m_packet.WriteNT( GAMESTATE->m_pPlayerState[pn]->m_PlayerOptions.GetString() );
|
||||||
NetPlayerClient->SendPack((char*)&m_packet.Data, m_packet.Position);
|
NetPlayerClient->SendPack((char*)&m_packet.Data, m_packet.Position);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -1580,7 +1580,7 @@ void NoteDataUtil::TransformNoteData( NoteData &nd, const AttackArray &aa, Steps
|
|||||||
if( po.ContainsTransformOrTurn() )
|
if( po.ContainsTransformOrTurn() )
|
||||||
{
|
{
|
||||||
float fStartBeat, fEndBeat;
|
float fStartBeat, fEndBeat;
|
||||||
a->GetAttackBeats( pSong, PLAYER_INVALID, fStartBeat, fEndBeat );
|
a->GetAttackBeats( pSong, NULL, fStartBeat, fEndBeat );
|
||||||
|
|
||||||
NoteDataUtil::TransformNoteData( nd, po, st, fStartBeat, fEndBeat );
|
NoteDataUtil::TransformNoteData( nd, po, st, fStartBeat, fEndBeat );
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -13,6 +13,7 @@
|
|||||||
#include "ActorUtil.h"
|
#include "ActorUtil.h"
|
||||||
#include "NoteDataWithScoring.h"
|
#include "NoteDataWithScoring.h"
|
||||||
#include "Game.h"
|
#include "Game.h"
|
||||||
|
#include "PlayerState.h"
|
||||||
|
|
||||||
enum part
|
enum part
|
||||||
{
|
{
|
||||||
@@ -224,12 +225,14 @@ NoteDisplay::~NoteDisplay()
|
|||||||
delete cache;
|
delete cache;
|
||||||
}
|
}
|
||||||
|
|
||||||
void NoteDisplay::Load( int iColNum, PlayerNumber pn, CString NoteSkin, float fYReverseOffsetPixels )
|
void NoteDisplay::Load( int iColNum, const PlayerState* pPlayerState, CString NoteSkin, float fYReverseOffsetPixels )
|
||||||
{
|
{
|
||||||
m_PlayerNumber = pn;
|
m_pPlayerState = pPlayerState;
|
||||||
m_fYReverseOffsetPixels = fYReverseOffsetPixels;
|
m_fYReverseOffsetPixels = fYReverseOffsetPixels;
|
||||||
|
|
||||||
/* Normally, this is empty and we use the style table entry via ColToButtonName. */
|
/* Normally, this is empty and we use the style table entry via ColToButtonName. */
|
||||||
|
// TODO: Remove indexing with PlayerNumber.
|
||||||
|
PlayerNumber pn = m_pPlayerState->m_PlayerNumber;
|
||||||
NoteFieldMode &mode = g_NoteFieldMode[pn];
|
NoteFieldMode &mode = g_NoteFieldMode[pn];
|
||||||
CString Button = mode.NoteButtonNames[iColNum];
|
CString Button = mode.NoteButtonNames[iColNum];
|
||||||
if( Button == "" )
|
if( Button == "" )
|
||||||
@@ -555,12 +558,12 @@ Actor* NoteDisplay::GetHoldTailActor( float fNoteBeat, bool bIsBeingHeld )
|
|||||||
return pActorOut;
|
return pActorOut;
|
||||||
}
|
}
|
||||||
|
|
||||||
static float ArrowGetAlphaOrGlow( bool bGlow, PlayerNumber pn, int iCol, float fYOffset, float fPercentFadeToFail, float fYReverseOffsetPixels )
|
static float ArrowGetAlphaOrGlow( bool bGlow, const PlayerState* pPlayerState, int iCol, float fYOffset, float fPercentFadeToFail, float fYReverseOffsetPixels )
|
||||||
{
|
{
|
||||||
if( bGlow )
|
if( bGlow )
|
||||||
return ArrowGetGlow( pn, iCol, fYOffset, fPercentFadeToFail, fYReverseOffsetPixels );
|
return ArrowEffects::GetGlow( pPlayerState, iCol, fYOffset, fPercentFadeToFail, fYReverseOffsetPixels );
|
||||||
else
|
else
|
||||||
return ArrowGetAlpha( pn, iCol, fYOffset, fPercentFadeToFail, fYReverseOffsetPixels );
|
return ArrowEffects::GetAlpha( pPlayerState, iCol, fYOffset, fPercentFadeToFail, fYReverseOffsetPixels );
|
||||||
}
|
}
|
||||||
|
|
||||||
struct StripBuffer
|
struct StripBuffer
|
||||||
@@ -590,7 +593,7 @@ void NoteDisplay::DrawHoldTopCap( const HoldNote& hn, const bool bIsBeingHeld, f
|
|||||||
|
|
||||||
Sprite* pSprTopCap = GetHoldTopCapSprite( hn.GetStartBeat(), bIsBeingHeld );
|
Sprite* pSprTopCap = GetHoldTopCapSprite( hn.GetStartBeat(), bIsBeingHeld );
|
||||||
|
|
||||||
pSprTopCap->SetZoom( ArrowGetZoom( m_PlayerNumber ) );
|
pSprTopCap->SetZoom( ArrowEffects::GetZoom( m_pPlayerState ) );
|
||||||
|
|
||||||
// draw manually in small segments
|
// draw manually in small segments
|
||||||
RageTexture* pTexture = pSprTopCap->GetTexture();
|
RageTexture* pTexture = pSprTopCap->GetTexture();
|
||||||
@@ -622,16 +625,16 @@ void NoteDisplay::DrawHoldTopCap( const HoldNote& hn, const bool bIsBeingHeld, f
|
|||||||
bLast = true;
|
bLast = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
const float fYOffset = ArrowGetYOffsetFromYPos( m_PlayerNumber, iCol, fY, m_fYReverseOffsetPixels );
|
const float fYOffset = ArrowEffects::GetYOffsetFromYPos( m_pPlayerState, iCol, fY, m_fYReverseOffsetPixels );
|
||||||
const float fZ = ArrowGetZPos( m_PlayerNumber, iCol, fYOffset );
|
const float fZ = ArrowEffects::GetZPos( m_pPlayerState, iCol, fYOffset );
|
||||||
const float fX = ArrowGetXPos( m_PlayerNumber, iCol, fYOffset );
|
const float fX = ArrowEffects::GetXPos( m_pPlayerState, iCol, fYOffset );
|
||||||
const float fXLeft = fX - fFrameWidth/2;
|
const float fXLeft = fX - fFrameWidth/2;
|
||||||
const float fXRight = fX + fFrameWidth/2;
|
const float fXRight = fX + fFrameWidth/2;
|
||||||
const float fTopDistFromHeadTop = fY - fYCapTop;
|
const float fTopDistFromHeadTop = fY - fYCapTop;
|
||||||
const float fTexCoordTop = SCALE( fTopDistFromHeadTop, 0, fFrameHeight, pRect->top, pRect->bottom );
|
const float fTexCoordTop = SCALE( fTopDistFromHeadTop, 0, fFrameHeight, pRect->top, pRect->bottom );
|
||||||
const float fTexCoordLeft = pRect->left;
|
const float fTexCoordLeft = pRect->left;
|
||||||
const float fTexCoordRight = pRect->right;
|
const float fTexCoordRight = pRect->right;
|
||||||
const float fAlpha = ArrowGetAlphaOrGlow( bGlow, m_PlayerNumber, iCol, fYOffset, fPercentFadeToFail, m_fYReverseOffsetPixels );
|
const float fAlpha = ArrowGetAlphaOrGlow( bGlow, m_pPlayerState, iCol, fYOffset, fPercentFadeToFail, m_fYReverseOffsetPixels );
|
||||||
const RageColor color = RageColor(fColorScale,fColorScale,fColorScale,fAlpha);
|
const RageColor color = RageColor(fColorScale,fColorScale,fColorScale,fAlpha);
|
||||||
|
|
||||||
if( fAlpha > 0 )
|
if( fAlpha > 0 )
|
||||||
@@ -665,7 +668,7 @@ void NoteDisplay::DrawHoldBody( const HoldNote& hn, const bool bIsBeingHeld, flo
|
|||||||
|
|
||||||
Sprite* pSprBody = GetHoldBodySprite( hn.GetStartBeat(), bIsBeingHeld );
|
Sprite* pSprBody = GetHoldBodySprite( hn.GetStartBeat(), bIsBeingHeld );
|
||||||
|
|
||||||
pSprBody->SetZoom( ArrowGetZoom( m_PlayerNumber ) );
|
pSprBody->SetZoom( ArrowEffects::GetZoom( m_pPlayerState ) );
|
||||||
|
|
||||||
// draw manually in small segments
|
// draw manually in small segments
|
||||||
RageTexture* pTexture = pSprBody->GetTexture();
|
RageTexture* pTexture = pSprBody->GetTexture();
|
||||||
@@ -682,7 +685,7 @@ void NoteDisplay::DrawHoldBody( const HoldNote& hn, const bool bIsBeingHeld, flo
|
|||||||
const float fYBodyTop = fYHead + cache->m_iStartDrawingHoldBodyOffsetFromHead;
|
const float fYBodyTop = fYHead + cache->m_iStartDrawingHoldBodyOffsetFromHead;
|
||||||
const float fYBodyBottom = fYTail + cache->m_iStopDrawingHoldBodyOffsetFromTail;
|
const float fYBodyBottom = fYTail + cache->m_iStopDrawingHoldBodyOffsetFromTail;
|
||||||
|
|
||||||
const bool bReverse = GAMESTATE->m_CurrentPlayerOptions[m_PlayerNumber].GetReversePercentForColumn(iCol) > 0.5;
|
const bool bReverse = m_pPlayerState->m_CurrentPlayerOptions.GetReversePercentForColumn(iCol) > 0.5;
|
||||||
bool bAnchorToBottom = bReverse && cache->m_bFlipHeadAndTailWhenReverse;
|
bool bAnchorToBottom = bReverse && cache->m_bFlipHeadAndTailWhenReverse;
|
||||||
|
|
||||||
if( bGlow )
|
if( bGlow )
|
||||||
@@ -699,9 +702,9 @@ void NoteDisplay::DrawHoldBody( const HoldNote& hn, const bool bIsBeingHeld, flo
|
|||||||
bLast = true;
|
bLast = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
const float fYOffset = ArrowGetYOffsetFromYPos( m_PlayerNumber, iCol, fY, m_fYReverseOffsetPixels );
|
const float fYOffset = ArrowEffects::GetYOffsetFromYPos( m_pPlayerState, iCol, fY, m_fYReverseOffsetPixels );
|
||||||
const float fZ = ArrowGetZPos( m_PlayerNumber, iCol, fYOffset );
|
const float fZ = ArrowEffects::GetZPos( m_pPlayerState, iCol, fYOffset );
|
||||||
const float fX = ArrowGetXPos( m_PlayerNumber, iCol, fYOffset );
|
const float fX = ArrowEffects::GetXPos( m_pPlayerState, iCol, fYOffset );
|
||||||
const float fXLeft = fX - fFrameWidth/2;
|
const float fXLeft = fX - fFrameWidth/2;
|
||||||
const float fXRight = fX + fFrameWidth/2;
|
const float fXRight = fX + fFrameWidth/2;
|
||||||
const float fDistFromBodyBottom = fYBodyBottom - fY;
|
const float fDistFromBodyBottom = fYBodyBottom - fY;
|
||||||
@@ -709,7 +712,7 @@ void NoteDisplay::DrawHoldBody( const HoldNote& hn, const bool bIsBeingHeld, flo
|
|||||||
const float fTexCoordTop = SCALE( bAnchorToBottom ? fDistFromBodyTop : fDistFromBodyBottom, 0, fFrameHeight, pRect->bottom, pRect->top );
|
const float fTexCoordTop = SCALE( bAnchorToBottom ? fDistFromBodyTop : fDistFromBodyBottom, 0, fFrameHeight, pRect->bottom, pRect->top );
|
||||||
const float fTexCoordLeft = pRect->left;
|
const float fTexCoordLeft = pRect->left;
|
||||||
const float fTexCoordRight = pRect->right;
|
const float fTexCoordRight = pRect->right;
|
||||||
const float fAlpha = ArrowGetAlphaOrGlow( bGlow, m_PlayerNumber, iCol, fYOffset, fPercentFadeToFail, m_fYReverseOffsetPixels );
|
const float fAlpha = ArrowGetAlphaOrGlow( bGlow, m_pPlayerState, iCol, fYOffset, fPercentFadeToFail, m_fYReverseOffsetPixels );
|
||||||
const RageColor color = RageColor(fColorScale,fColorScale,fColorScale,fAlpha);
|
const RageColor color = RageColor(fColorScale,fColorScale,fColorScale,fAlpha);
|
||||||
|
|
||||||
if( fAlpha > 0 )
|
if( fAlpha > 0 )
|
||||||
@@ -743,7 +746,7 @@ void NoteDisplay::DrawHoldBottomCap( const HoldNote& hn, const bool bIsBeingHeld
|
|||||||
|
|
||||||
Sprite* pBottomCap = GetHoldBottomCapSprite( hn.GetStartBeat(), bIsBeingHeld );
|
Sprite* pBottomCap = GetHoldBottomCapSprite( hn.GetStartBeat(), bIsBeingHeld );
|
||||||
|
|
||||||
pBottomCap->SetZoom( ArrowGetZoom( m_PlayerNumber ) );
|
pBottomCap->SetZoom( ArrowEffects::GetZoom( m_pPlayerState ) );
|
||||||
|
|
||||||
// draw manually in small segments
|
// draw manually in small segments
|
||||||
RageTexture* pTexture = pBottomCap->GetTexture();
|
RageTexture* pTexture = pBottomCap->GetTexture();
|
||||||
@@ -774,16 +777,16 @@ void NoteDisplay::DrawHoldBottomCap( const HoldNote& hn, const bool bIsBeingHeld
|
|||||||
bLast = true;
|
bLast = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
const float fYOffset = ArrowGetYOffsetFromYPos( m_PlayerNumber, iCol, fY, m_fYReverseOffsetPixels );
|
const float fYOffset = ArrowEffects::GetYOffsetFromYPos( m_pPlayerState, iCol, fY, m_fYReverseOffsetPixels );
|
||||||
const float fZ = ArrowGetZPos( m_PlayerNumber, iCol, fYOffset );
|
const float fZ = ArrowEffects::GetZPos( m_pPlayerState, iCol, fYOffset );
|
||||||
const float fX = ArrowGetXPos( m_PlayerNumber, iCol, fYOffset );
|
const float fX = ArrowEffects::GetXPos( m_pPlayerState, iCol, fYOffset );
|
||||||
const float fXLeft = fX - fFrameWidth/2;
|
const float fXLeft = fX - fFrameWidth/2;
|
||||||
const float fXRight = fX + fFrameWidth/2;
|
const float fXRight = fX + fFrameWidth/2;
|
||||||
const float fTopDistFromTail = fY - fYCapTop;
|
const float fTopDistFromTail = fY - fYCapTop;
|
||||||
const float fTexCoordTop = SCALE( fTopDistFromTail, 0, fFrameHeight, pRect->top, pRect->bottom );
|
const float fTexCoordTop = SCALE( fTopDistFromTail, 0, fFrameHeight, pRect->top, pRect->bottom );
|
||||||
const float fTexCoordLeft = pRect->left;
|
const float fTexCoordLeft = pRect->left;
|
||||||
const float fTexCoordRight = pRect->right;
|
const float fTexCoordRight = pRect->right;
|
||||||
const float fAlpha = ArrowGetAlphaOrGlow( bGlow, m_PlayerNumber, iCol, fYOffset, fPercentFadeToFail, m_fYReverseOffsetPixels );
|
const float fAlpha = ArrowGetAlphaOrGlow( bGlow, m_pPlayerState, iCol, fYOffset, fPercentFadeToFail, m_fYReverseOffsetPixels );
|
||||||
const RageColor color = RageColor(fColorScale,fColorScale,fColorScale,fAlpha);
|
const RageColor color = RageColor(fColorScale,fColorScale,fColorScale,fAlpha);
|
||||||
|
|
||||||
if( fAlpha > 0 )
|
if( fAlpha > 0 )
|
||||||
@@ -814,14 +817,14 @@ void NoteDisplay::DrawHoldTail( const HoldNote& hn, bool bIsBeingHeld, float fYT
|
|||||||
//
|
//
|
||||||
Actor* pSprTail = GetHoldTailActor( hn.GetStartBeat(), bIsBeingHeld );
|
Actor* pSprTail = GetHoldTailActor( hn.GetStartBeat(), bIsBeingHeld );
|
||||||
|
|
||||||
pSprTail->SetZoom( ArrowGetZoom( m_PlayerNumber ) );
|
pSprTail->SetZoom( ArrowEffects::GetZoom( m_pPlayerState ) );
|
||||||
|
|
||||||
const float fY = fYTail;
|
const float fY = fYTail;
|
||||||
const float fYOffset = ArrowGetYOffsetFromYPos( m_PlayerNumber, iCol, fY, m_fYReverseOffsetPixels );
|
const float fYOffset = ArrowEffects::GetYOffsetFromYPos( m_pPlayerState, iCol, fY, m_fYReverseOffsetPixels );
|
||||||
const float fX = ArrowGetXPos( m_PlayerNumber, iCol, fYOffset );
|
const float fX = ArrowEffects::GetXPos( m_pPlayerState, iCol, fYOffset );
|
||||||
const float fZ = ArrowGetZPos( m_PlayerNumber, iCol, fYOffset );
|
const float fZ = ArrowEffects::GetZPos( m_pPlayerState, iCol, fYOffset );
|
||||||
const float fAlpha = ArrowGetAlpha( m_PlayerNumber, iCol, fYOffset, fPercentFadeToFail, m_fYReverseOffsetPixels );
|
const float fAlpha = ArrowEffects::GetAlpha( m_pPlayerState, iCol, fYOffset, fPercentFadeToFail, m_fYReverseOffsetPixels );
|
||||||
const float fGlow = ArrowGetGlow( m_PlayerNumber, iCol, fYOffset, fPercentFadeToFail, m_fYReverseOffsetPixels );
|
const float fGlow = ArrowEffects::GetGlow( m_pPlayerState, iCol, fYOffset, fPercentFadeToFail, m_fYReverseOffsetPixels );
|
||||||
const RageColor colorDiffuse= RageColor(fColorScale,fColorScale,fColorScale,fAlpha);
|
const RageColor colorDiffuse= RageColor(fColorScale,fColorScale,fColorScale,fAlpha);
|
||||||
const RageColor colorGlow = RageColor(1,1,1,fGlow);
|
const RageColor colorGlow = RageColor(1,1,1,fGlow);
|
||||||
|
|
||||||
@@ -866,15 +869,15 @@ void NoteDisplay::DrawHoldHead( const HoldNote& hn, bool bIsBeingHeld, float fYH
|
|||||||
//
|
//
|
||||||
Actor* pActor = GetHoldHeadActor( hn.GetStartBeat(), bIsBeingHeld );
|
Actor* pActor = GetHoldHeadActor( hn.GetStartBeat(), bIsBeingHeld );
|
||||||
|
|
||||||
pActor->SetZoom( ArrowGetZoom( m_PlayerNumber ) );
|
pActor->SetZoom( ArrowEffects::GetZoom( m_pPlayerState ) );
|
||||||
|
|
||||||
// draw with normal Sprite
|
// draw with normal Sprite
|
||||||
const float fY = fYHead;
|
const float fY = fYHead;
|
||||||
const float fYOffset = ArrowGetYOffsetFromYPos( m_PlayerNumber, iCol, fY, m_fYReverseOffsetPixels );
|
const float fYOffset = ArrowEffects::GetYOffsetFromYPos( m_pPlayerState, iCol, fY, m_fYReverseOffsetPixels );
|
||||||
const float fX = ArrowGetXPos( m_PlayerNumber, iCol, fYOffset );
|
const float fX = ArrowEffects::GetXPos( m_pPlayerState, iCol, fYOffset );
|
||||||
const float fZ = ArrowGetZPos( m_PlayerNumber, iCol, fYOffset );
|
const float fZ = ArrowEffects::GetZPos( m_pPlayerState, iCol, fYOffset );
|
||||||
const float fAlpha = ArrowGetAlpha( m_PlayerNumber, iCol, fYOffset, fPercentFadeToFail, m_fYReverseOffsetPixels );
|
const float fAlpha = ArrowEffects::GetAlpha( m_pPlayerState, iCol, fYOffset, fPercentFadeToFail, m_fYReverseOffsetPixels );
|
||||||
const float fGlow = ArrowGetGlow( m_PlayerNumber, iCol, fYOffset, fPercentFadeToFail, m_fYReverseOffsetPixels );
|
const float fGlow = ArrowEffects::GetGlow( m_pPlayerState, iCol, fYOffset, fPercentFadeToFail, m_fYReverseOffsetPixels );
|
||||||
const RageColor colorDiffuse= RageColor(fColorScale,fColorScale,fColorScale,fAlpha);
|
const RageColor colorDiffuse= RageColor(fColorScale,fColorScale,fColorScale,fAlpha);
|
||||||
const RageColor colorGlow = RageColor(1,1,1,fGlow);
|
const RageColor colorGlow = RageColor(1,1,1,fGlow);
|
||||||
|
|
||||||
@@ -918,22 +921,22 @@ void NoteDisplay::DrawHold( const HoldNote& hn, bool bIsBeingHeld, bool bIsActiv
|
|||||||
// bDrawGlowOnly is a little hacky. We need to draw the diffuse part and the glow part one pass at a time to minimize state changes
|
// bDrawGlowOnly is a little hacky. We need to draw the diffuse part and the glow part one pass at a time to minimize state changes
|
||||||
|
|
||||||
int iCol = hn.iTrack;
|
int iCol = hn.iTrack;
|
||||||
bool bReverse = GAMESTATE->m_CurrentPlayerOptions[m_PlayerNumber].GetReversePercentForColumn(iCol) > 0.5;
|
bool bReverse = m_pPlayerState->m_CurrentPlayerOptions.GetReversePercentForColumn(iCol) > 0.5;
|
||||||
float fStartYOffset = ArrowGetYOffset( m_PlayerNumber, iCol, Result.GetLastHeldBeat() );
|
float fStartYOffset = ArrowEffects::GetYOffset( m_pPlayerState, iCol, Result.GetLastHeldBeat() );
|
||||||
|
|
||||||
// HACK: If active, don't allow the top of the hold to go above the receptor
|
// HACK: If active, don't allow the top of the hold to go above the receptor
|
||||||
if( bIsActive )
|
if( bIsActive )
|
||||||
fStartYOffset = 0;
|
fStartYOffset = 0;
|
||||||
|
|
||||||
float fStartYPos = ArrowGetYPos( m_PlayerNumber, iCol, fStartYOffset, fReverseOffsetPixels );
|
float fStartYPos = ArrowEffects::GetYPos( m_pPlayerState, iCol, fStartYOffset, fReverseOffsetPixels );
|
||||||
float fEndYOffset = ArrowGetYOffset( m_PlayerNumber, iCol, hn.GetEndBeat() );
|
float fEndYOffset = ArrowEffects::GetYOffset( m_pPlayerState, iCol, hn.GetEndBeat() );
|
||||||
float fEndYPos = ArrowGetYPos( m_PlayerNumber, iCol, fEndYOffset, fReverseOffsetPixels );
|
float fEndYPos = ArrowEffects::GetYPos( m_pPlayerState, iCol, fEndYOffset, fReverseOffsetPixels );
|
||||||
|
|
||||||
const float fYHead = bReverse ? fEndYPos : fStartYPos; // the center of the head
|
const float fYHead = bReverse ? fEndYPos : fStartYPos; // the center of the head
|
||||||
const float fYTail = bReverse ? fStartYPos : fEndYPos; // the center the tail
|
const float fYTail = bReverse ? fStartYPos : fEndYPos; // the center the tail
|
||||||
|
|
||||||
// const bool bWavy = GAMESTATE->m_PlayerOptions[m_PlayerNumber].m_fEffects[PlayerOptions::EFFECT_DRUNK] > 0;
|
// const bool bWavy = GAMESTATE->m_PlayerOptions[m_PlayerNumber].m_fEffects[PlayerOptions::EFFECT_DRUNK] > 0;
|
||||||
const bool WavyPartsNeedZBuffer = ArrowsNeedZBuffer( m_PlayerNumber );
|
const bool WavyPartsNeedZBuffer = ArrowEffects::NeedZBuffer( m_pPlayerState );
|
||||||
/* Hack: Z effects need a finer grain step. */
|
/* Hack: Z effects need a finer grain step. */
|
||||||
const int fYStep = WavyPartsNeedZBuffer? 4: 16; //bWavy ? 16 : 128; // use small steps only if wavy
|
const int fYStep = WavyPartsNeedZBuffer? 4: 16; //bWavy ? 16 : 128; // use small steps only if wavy
|
||||||
|
|
||||||
@@ -974,15 +977,15 @@ void NoteDisplay::DrawHold( const HoldNote& hn, bool bIsBeingHeld, bool bIsActiv
|
|||||||
|
|
||||||
void NoteDisplay::DrawActor( Actor* pActor, int iCol, float fBeat, float fPercentFadeToFail, float fLife, float fReverseOffsetPixels, bool bUseLighting )
|
void NoteDisplay::DrawActor( Actor* pActor, int iCol, float fBeat, float fPercentFadeToFail, float fLife, float fReverseOffsetPixels, bool bUseLighting )
|
||||||
{
|
{
|
||||||
const float fYOffset = ArrowGetYOffset( m_PlayerNumber, iCol, fBeat );
|
const float fYOffset = ArrowEffects::GetYOffset( m_pPlayerState, iCol, fBeat );
|
||||||
const float fYPos = ArrowGetYPos( m_PlayerNumber, iCol, fYOffset, fReverseOffsetPixels );
|
const float fYPos = ArrowEffects::GetYPos( m_pPlayerState, iCol, fYOffset, fReverseOffsetPixels );
|
||||||
const float fRotation = ArrowGetRotation( m_PlayerNumber, fBeat );
|
const float fRotation = ArrowEffects::GetRotation( m_pPlayerState, fBeat );
|
||||||
const float fXPos = ArrowGetXPos( m_PlayerNumber, iCol, fYOffset );
|
const float fXPos = ArrowEffects::GetXPos( m_pPlayerState, iCol, fYOffset );
|
||||||
const float fZPos = ArrowGetZPos( m_PlayerNumber, iCol, fYOffset );
|
const float fZPos = ArrowEffects::GetZPos( m_pPlayerState, iCol, fYOffset );
|
||||||
const float fAlpha = ArrowGetAlpha( m_PlayerNumber, iCol, fYOffset, fPercentFadeToFail, m_fYReverseOffsetPixels );
|
const float fAlpha = ArrowEffects::GetAlpha( m_pPlayerState, iCol, fYOffset, fPercentFadeToFail, m_fYReverseOffsetPixels );
|
||||||
const float fGlow = ArrowGetGlow( m_PlayerNumber, iCol, fYOffset, fPercentFadeToFail, m_fYReverseOffsetPixels );
|
const float fGlow = ArrowEffects::GetGlow( m_pPlayerState, iCol, fYOffset, fPercentFadeToFail, m_fYReverseOffsetPixels );
|
||||||
const float fColorScale = ArrowGetBrightness( m_PlayerNumber, fBeat ) * SCALE(fLife,0,1,0.2f,1);
|
const float fColorScale = ArrowEffects::GetBrightness( m_pPlayerState, fBeat ) * SCALE(fLife,0,1,0.2f,1);
|
||||||
const float fZoom = ArrowGetZoom( m_PlayerNumber );
|
const float fZoom = ArrowEffects::GetZoom( m_pPlayerState );
|
||||||
RageColor diffuse = RageColor(fColorScale,fColorScale,fColorScale,fAlpha);
|
RageColor diffuse = RageColor(fColorScale,fColorScale,fColorScale,fAlpha);
|
||||||
RageColor glow = RageColor(1,1,1,fGlow);
|
RageColor glow = RageColor(1,1,1,fGlow);
|
||||||
|
|
||||||
|
|||||||
@@ -6,10 +6,10 @@
|
|||||||
#include "Sprite.h"
|
#include "Sprite.h"
|
||||||
class Model;
|
class Model;
|
||||||
#include "NoteTypes.h"
|
#include "NoteTypes.h"
|
||||||
#include "PlayerNumber.h"
|
|
||||||
|
|
||||||
struct HoldNoteResult;
|
struct HoldNoteResult;
|
||||||
struct NoteMetricCache_t;
|
struct NoteMetricCache_t;
|
||||||
|
struct PlayerState;
|
||||||
|
|
||||||
class NoteDisplay
|
class NoteDisplay
|
||||||
{
|
{
|
||||||
@@ -17,7 +17,7 @@ public:
|
|||||||
NoteDisplay();
|
NoteDisplay();
|
||||||
~NoteDisplay();
|
~NoteDisplay();
|
||||||
|
|
||||||
void Load( int iColNum, PlayerNumber pn, CString NoteSkin, float fYReverseOffsetPixels );
|
void Load( int iColNum, const PlayerState* pPlayerState, CString NoteSkin, float fYReverseOffsetPixels );
|
||||||
|
|
||||||
static void Update( float fDeltaTime );
|
static void Update( float fDeltaTime );
|
||||||
|
|
||||||
@@ -42,7 +42,7 @@ protected:
|
|||||||
void DrawHoldTail( const HoldNote& hn, const bool bIsBeingHeld, float fYTail, int iCol, float fPercentFadeToFail, float fColorScale, bool bGlow );
|
void DrawHoldTail( const HoldNote& hn, const bool bIsBeingHeld, float fYTail, int iCol, float fPercentFadeToFail, float fColorScale, bool bGlow );
|
||||||
void DrawHoldHead( const HoldNote& hn, const bool bIsBeingHeld, float fYHead, int iCol, float fPercentFadeToFail, float fColorScale, bool bGlow );
|
void DrawHoldHead( const HoldNote& hn, const bool bIsBeingHeld, float fYHead, int iCol, float fPercentFadeToFail, float fColorScale, bool bGlow );
|
||||||
|
|
||||||
PlayerNumber m_PlayerNumber; // to look up PlayerOptions
|
const PlayerState* m_pPlayerState; // to look up PlayerOptions
|
||||||
|
|
||||||
struct NoteMetricCache_t *cache;
|
struct NoteMetricCache_t *cache;
|
||||||
|
|
||||||
|
|||||||
+55
-41
@@ -15,6 +15,7 @@
|
|||||||
#include "NoteSkinManager.h"
|
#include "NoteSkinManager.h"
|
||||||
#include "song.h"
|
#include "song.h"
|
||||||
#include "ScreenDimensions.h"
|
#include "ScreenDimensions.h"
|
||||||
|
#include "PlayerState.h"
|
||||||
|
|
||||||
NoteField::NoteField()
|
NoteField::NoteField()
|
||||||
{
|
{
|
||||||
@@ -55,9 +56,9 @@ void NoteField::CacheNoteSkin( CString skin )
|
|||||||
LOG->Trace("NoteField::CacheNoteSkin: cache %s", skin.c_str() );
|
LOG->Trace("NoteField::CacheNoteSkin: cache %s", skin.c_str() );
|
||||||
NoteDisplayCols *nd = new NoteDisplayCols( GetNumTracks() );
|
NoteDisplayCols *nd = new NoteDisplayCols( GetNumTracks() );
|
||||||
for( int c=0; c<GetNumTracks(); c++ )
|
for( int c=0; c<GetNumTracks(); c++ )
|
||||||
nd->display[c].Load( c, m_PlayerNumber, skin, m_fYReverseOffsetPixels );
|
nd->display[c].Load( c, m_pPlayerState, skin, m_fYReverseOffsetPixels );
|
||||||
nd->m_ReceptorArrowRow.Load( m_PlayerNumber, skin, m_fYReverseOffsetPixels );
|
nd->m_ReceptorArrowRow.Load( m_pPlayerState, skin, m_fYReverseOffsetPixels );
|
||||||
nd->m_GhostArrowRow.Load( m_PlayerNumber, skin, m_fYReverseOffsetPixels );
|
nd->m_GhostArrowRow.Load( m_pPlayerState, skin, m_fYReverseOffsetPixels );
|
||||||
|
|
||||||
m_NoteDisplays[ skin ] = nd;
|
m_NoteDisplays[ skin ] = nd;
|
||||||
}
|
}
|
||||||
@@ -71,11 +72,16 @@ void NoteField::CacheAllUsedNoteSkins()
|
|||||||
CacheNoteSkin( skins[i] );
|
CacheNoteSkin( skins[i] );
|
||||||
}
|
}
|
||||||
|
|
||||||
void NoteField::Load( const NoteData* pNoteData, PlayerNumber pn, int iFirstPixelToDraw, int iLastPixelToDraw, float fYReverseOffsetPixels )
|
void NoteField::Load(
|
||||||
|
const NoteData* pNoteData,
|
||||||
|
const PlayerState* pPlayerState,
|
||||||
|
int iFirstPixelToDraw,
|
||||||
|
int iLastPixelToDraw,
|
||||||
|
float fYReverseOffsetPixels )
|
||||||
{
|
{
|
||||||
Unload();
|
Unload();
|
||||||
|
|
||||||
m_PlayerNumber = pn;
|
m_pPlayerState = pPlayerState;
|
||||||
m_iStartDrawingPixel = iFirstPixelToDraw;
|
m_iStartDrawingPixel = iFirstPixelToDraw;
|
||||||
m_iEndDrawingPixel = iLastPixelToDraw;
|
m_iEndDrawingPixel = iLastPixelToDraw;
|
||||||
m_fYReverseOffsetPixels = fYReverseOffsetPixels;
|
m_fYReverseOffsetPixels = fYReverseOffsetPixels;
|
||||||
@@ -103,16 +109,17 @@ void NoteField::RefreshBeatToNoteSkin()
|
|||||||
m_LastSeenBeatToNoteSkinRev = GAMESTATE->m_BeatToNoteSkinRev;
|
m_LastSeenBeatToNoteSkinRev = GAMESTATE->m_BeatToNoteSkinRev;
|
||||||
|
|
||||||
/* Set by GameState::ResetNoteSkins(): */
|
/* Set by GameState::ResetNoteSkins(): */
|
||||||
ASSERT( !GAMESTATE->m_BeatToNoteSkin[m_PlayerNumber].empty() );
|
ASSERT( !m_pPlayerState->m_BeatToNoteSkin.empty() );
|
||||||
|
|
||||||
m_BeatToNoteDisplays.clear();
|
m_BeatToNoteDisplays.clear();
|
||||||
|
|
||||||
/* GAMESTATE->m_BeatToNoteSkin[pn] maps from song beats to note skins. Maintain
|
/* GAMESTATE->m_BeatToNoteSkin[pn] maps from song beats to note skins. Maintain
|
||||||
* m_BeatToNoteDisplays, to map from song beats to NoteDisplay*s, so we don't
|
* m_BeatToNoteDisplays, to map from song beats to NoteDisplay*s, so we don't
|
||||||
* have to do it while rendering. */
|
* have to do it while rendering. */
|
||||||
map<float,CString>::iterator it;
|
|
||||||
for( it = GAMESTATE->m_BeatToNoteSkin[m_PlayerNumber].begin();
|
for( map<float,CString>::const_iterator it = m_pPlayerState->m_BeatToNoteSkin.begin();
|
||||||
it != GAMESTATE->m_BeatToNoteSkin[m_PlayerNumber].end(); ++it )
|
it != m_pPlayerState->m_BeatToNoteSkin.end();
|
||||||
|
++it )
|
||||||
{
|
{
|
||||||
const float Beat = it->first;
|
const float Beat = it->first;
|
||||||
const CString &Skin = it->second;
|
const CString &Skin = it->second;
|
||||||
@@ -169,7 +176,9 @@ void NoteField::Update( float fDeltaTime )
|
|||||||
* Update all NoteDisplays. Hack: We need to call this once per frame, not
|
* Update all NoteDisplays. Hack: We need to call this once per frame, not
|
||||||
* once per player.
|
* once per player.
|
||||||
*/
|
*/
|
||||||
if( m_PlayerNumber == GAMESTATE->m_MasterPlayerNumber )
|
// TODO: Remove use of PlayerNumber.
|
||||||
|
PlayerNumber pn = m_pPlayerState->m_PlayerNumber;
|
||||||
|
if( pn == GAMESTATE->m_MasterPlayerNumber )
|
||||||
NoteDisplay::Update( fDeltaTime );
|
NoteDisplay::Update( fDeltaTime );
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -177,7 +186,8 @@ float NoteField::GetWidth()
|
|||||||
{
|
{
|
||||||
const Style* pStyle = GAMESTATE->GetCurrentStyle();
|
const Style* pStyle = GAMESTATE->GetCurrentStyle();
|
||||||
float fMinX, fMaxX;
|
float fMinX, fMaxX;
|
||||||
pStyle->GetMinAndMaxColX( m_PlayerNumber, fMinX, fMaxX );
|
// TODO: Remove use of PlayerNumber.
|
||||||
|
pStyle->GetMinAndMaxColX( m_pPlayerState->m_PlayerNumber, fMinX, fMaxX );
|
||||||
|
|
||||||
return fMaxX - fMinX + ARROW_SIZE;
|
return fMaxX - fMinX + ARROW_SIZE;
|
||||||
}
|
}
|
||||||
@@ -190,8 +200,8 @@ void NoteField::DrawBeatBar( const float fBeat )
|
|||||||
|
|
||||||
NoteType nt = BeatToNoteType( fBeat );
|
NoteType nt = BeatToNoteType( fBeat );
|
||||||
|
|
||||||
const float fYOffset = ArrowGetYOffset( m_PlayerNumber, 0, fBeat );
|
const float fYOffset = ArrowEffects::GetYOffset( m_pPlayerState, 0, fBeat );
|
||||||
const float fYPos = ArrowGetYPos( m_PlayerNumber, 0, fYOffset, m_fYReverseOffsetPixels );
|
const float fYPos = ArrowEffects::GetYPos( m_pPlayerState, 0, fYOffset, m_fYReverseOffsetPixels );
|
||||||
|
|
||||||
float fAlpha;
|
float fAlpha;
|
||||||
int iState;
|
int iState;
|
||||||
@@ -203,7 +213,7 @@ void NoteField::DrawBeatBar( const float fBeat )
|
|||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
float fScrollSpeed = GAMESTATE->m_CurrentPlayerOptions[m_PlayerNumber].m_fScrollSpeed;
|
float fScrollSpeed = m_pPlayerState->m_CurrentPlayerOptions.m_fScrollSpeed;
|
||||||
switch( nt )
|
switch( nt )
|
||||||
{
|
{
|
||||||
default: ASSERT(0);
|
default: ASSERT(0);
|
||||||
@@ -239,8 +249,8 @@ void NoteField::DrawBeatBar( const float fBeat )
|
|||||||
|
|
||||||
void NoteField::DrawMarkerBar( const float fBeat )
|
void NoteField::DrawMarkerBar( const float fBeat )
|
||||||
{
|
{
|
||||||
const float fYOffset = ArrowGetYOffset( m_PlayerNumber, 0, fBeat );
|
const float fYOffset = ArrowEffects::GetYOffset( m_pPlayerState, 0, fBeat );
|
||||||
const float fYPos = ArrowGetYPos( m_PlayerNumber, 0, fYOffset, m_fYReverseOffsetPixels );
|
const float fYPos = ArrowEffects::GetYPos( m_pPlayerState, 0, fYOffset, m_fYReverseOffsetPixels );
|
||||||
|
|
||||||
|
|
||||||
m_rectMarkerBar.StretchTo( RectF(-GetWidth()/2, fYPos-ARROW_SIZE/2, GetWidth()/2, fYPos+ARROW_SIZE/2) );
|
m_rectMarkerBar.StretchTo( RectF(-GetWidth()/2, fYPos-ARROW_SIZE/2, GetWidth()/2, fYPos+ARROW_SIZE/2) );
|
||||||
@@ -249,10 +259,10 @@ void NoteField::DrawMarkerBar( const float fBeat )
|
|||||||
|
|
||||||
void NoteField::DrawAreaHighlight( const float fStartBeat, const float fEndBeat )
|
void NoteField::DrawAreaHighlight( const float fStartBeat, const float fEndBeat )
|
||||||
{
|
{
|
||||||
float fYStartOffset = ArrowGetYOffset( m_PlayerNumber, 0, fStartBeat );
|
float fYStartOffset = ArrowEffects::GetYOffset( m_pPlayerState, 0, fStartBeat );
|
||||||
float fYStartPos = ArrowGetYPos( m_PlayerNumber, 0, fYStartOffset, m_fYReverseOffsetPixels );
|
float fYStartPos = ArrowEffects::GetYPos( m_pPlayerState, 0, fYStartOffset, m_fYReverseOffsetPixels );
|
||||||
float fYEndOffset = ArrowGetYOffset( m_PlayerNumber, 0, fEndBeat );
|
float fYEndOffset = ArrowEffects::GetYOffset( m_pPlayerState, 0, fEndBeat );
|
||||||
float fYEndPos = ArrowGetYPos( m_PlayerNumber, 0, fYEndOffset, m_fYReverseOffsetPixels );
|
float fYEndPos = ArrowEffects::GetYPos( m_pPlayerState, 0, fYEndOffset, m_fYReverseOffsetPixels );
|
||||||
|
|
||||||
// Something in OpenGL crashes if this is values are too large. Strange. -Chris
|
// Something in OpenGL crashes if this is values are too large. Strange. -Chris
|
||||||
fYStartPos = max( fYStartPos, -1000 );
|
fYStartPos = max( fYStartPos, -1000 );
|
||||||
@@ -267,8 +277,8 @@ void NoteField::DrawAreaHighlight( const float fStartBeat, const float fEndBeat
|
|||||||
|
|
||||||
void NoteField::DrawBPMText( const float fBeat, const float fBPM )
|
void NoteField::DrawBPMText( const float fBeat, const float fBPM )
|
||||||
{
|
{
|
||||||
const float fYOffset = ArrowGetYOffset( m_PlayerNumber, 0, fBeat );
|
const float fYOffset = ArrowEffects::GetYOffset( m_pPlayerState, 0, fBeat );
|
||||||
const float fYPos = ArrowGetYPos( m_PlayerNumber, 0, fYOffset, m_fYReverseOffsetPixels );
|
const float fYPos = ArrowEffects::GetYPos( m_pPlayerState, 0, fYOffset, m_fYReverseOffsetPixels );
|
||||||
|
|
||||||
m_textMeasureNumber.SetHorizAlign( Actor::align_right );
|
m_textMeasureNumber.SetHorizAlign( Actor::align_right );
|
||||||
m_textMeasureNumber.SetDiffuse( RageColor(1,0,0,1) );
|
m_textMeasureNumber.SetDiffuse( RageColor(1,0,0,1) );
|
||||||
@@ -280,8 +290,8 @@ void NoteField::DrawBPMText( const float fBeat, const float fBPM )
|
|||||||
|
|
||||||
void NoteField::DrawFreezeText( const float fBeat, const float fSecs )
|
void NoteField::DrawFreezeText( const float fBeat, const float fSecs )
|
||||||
{
|
{
|
||||||
const float fYOffset = ArrowGetYOffset( m_PlayerNumber, 0, fBeat );
|
const float fYOffset = ArrowEffects::GetYOffset( m_pPlayerState, 0, fBeat );
|
||||||
const float fYPos = ArrowGetYPos( m_PlayerNumber, 0, fYOffset, m_fYReverseOffsetPixels );
|
const float fYPos = ArrowEffects::GetYPos( m_pPlayerState, 0, fYOffset, m_fYReverseOffsetPixels );
|
||||||
|
|
||||||
m_textMeasureNumber.SetHorizAlign( Actor::align_right );
|
m_textMeasureNumber.SetHorizAlign( Actor::align_right );
|
||||||
m_textMeasureNumber.SetDiffuse( RageColor(0.8f,0.8f,0,1) );
|
m_textMeasureNumber.SetDiffuse( RageColor(0.8f,0.8f,0,1) );
|
||||||
@@ -293,8 +303,8 @@ void NoteField::DrawFreezeText( const float fBeat, const float fSecs )
|
|||||||
|
|
||||||
void NoteField::DrawBGChangeText( const float fBeat, const CString sNewBGName )
|
void NoteField::DrawBGChangeText( const float fBeat, const CString sNewBGName )
|
||||||
{
|
{
|
||||||
const float fYOffset = ArrowGetYOffset( m_PlayerNumber, 0, fBeat );
|
const float fYOffset = ArrowEffects::GetYOffset( m_pPlayerState, 0, fBeat );
|
||||||
const float fYPos = ArrowGetYPos( m_PlayerNumber, 0, fYOffset, m_fYReverseOffsetPixels );
|
const float fYPos = ArrowEffects::GetYPos( m_pPlayerState, 0, fYOffset, m_fYReverseOffsetPixels );
|
||||||
|
|
||||||
m_textMeasureNumber.SetHorizAlign( Actor::align_left );
|
m_textMeasureNumber.SetHorizAlign( Actor::align_left );
|
||||||
m_textMeasureNumber.SetDiffuse( RageColor(0,1,0,1) );
|
m_textMeasureNumber.SetDiffuse( RageColor(0,1,0,1) );
|
||||||
@@ -348,13 +358,13 @@ NoteField::NoteDisplayCols *NoteField::SearchForBeat( float Beat )
|
|||||||
|
|
||||||
// CPU OPTIMIZATION OPPORTUNITY:
|
// CPU OPTIMIZATION OPPORTUNITY:
|
||||||
// change this probing to binary search
|
// change this probing to binary search
|
||||||
float FindFirstDisplayedBeat( PlayerNumber pn, int iFirstPixelToDraw )
|
float FindFirstDisplayedBeat( const PlayerState* pPlayerState, int iFirstPixelToDraw )
|
||||||
{
|
{
|
||||||
float fFirstBeatToDraw = GAMESTATE->m_fSongBeat-4; // Adjust to balance off performance and showing enough notes.
|
float fFirstBeatToDraw = GAMESTATE->m_fSongBeat-4; // Adjust to balance off performance and showing enough notes.
|
||||||
|
|
||||||
while( fFirstBeatToDraw < GAMESTATE->m_fSongBeat )
|
while( fFirstBeatToDraw < GAMESTATE->m_fSongBeat )
|
||||||
{
|
{
|
||||||
float fYOffset = ArrowGetYOffset( pn, 0, fFirstBeatToDraw, true );
|
float fYOffset = ArrowEffects::GetYOffset( pPlayerState, 0, fFirstBeatToDraw, true );
|
||||||
if( fYOffset < iFirstPixelToDraw ) // off screen
|
if( fYOffset < iFirstPixelToDraw ) // off screen
|
||||||
fFirstBeatToDraw += 0.1f; // move toward fSongBeat
|
fFirstBeatToDraw += 0.1f; // move toward fSongBeat
|
||||||
else // on screen
|
else // on screen
|
||||||
@@ -364,7 +374,7 @@ float FindFirstDisplayedBeat( PlayerNumber pn, int iFirstPixelToDraw )
|
|||||||
return fFirstBeatToDraw;
|
return fFirstBeatToDraw;
|
||||||
}
|
}
|
||||||
|
|
||||||
float FindLastDisplayedBeat( PlayerNumber pn, int iLastPixelToDraw )
|
float FindLastDisplayedBeat( const PlayerState* pPlayerState, int iLastPixelToDraw )
|
||||||
{
|
{
|
||||||
//
|
//
|
||||||
// Probe for last note to draw.
|
// Probe for last note to draw.
|
||||||
@@ -378,7 +388,7 @@ float FindLastDisplayedBeat( PlayerNumber pn, int iLastPixelToDraw )
|
|||||||
|
|
||||||
for( int i=0; i<NUM_ITERATIONS; i++ )
|
for( int i=0; i<NUM_ITERATIONS; i++ )
|
||||||
{
|
{
|
||||||
float fYOffset = ArrowGetYOffset( pn, 0, fLastBeatToDraw, true );
|
float fYOffset = ArrowEffects::GetYOffset( pPlayerState, 0, fLastBeatToDraw, true );
|
||||||
|
|
||||||
if( fYOffset > iLastPixelToDraw ) // off screen
|
if( fYOffset > iLastPixelToDraw ) // off screen
|
||||||
fLastBeatToDraw -= fSearchDistance;
|
fLastBeatToDraw -= fSearchDistance;
|
||||||
@@ -402,7 +412,7 @@ void NoteField::DrawPrimitives()
|
|||||||
NoteDisplayCols *cur = SearchForSongBeat();
|
NoteDisplayCols *cur = SearchForSongBeat();
|
||||||
cur->m_ReceptorArrowRow.Draw();
|
cur->m_ReceptorArrowRow.Draw();
|
||||||
|
|
||||||
const PlayerOptions ¤t_po = GAMESTATE->m_CurrentPlayerOptions[m_PlayerNumber];
|
const PlayerOptions ¤t_po = m_pPlayerState->m_CurrentPlayerOptions;
|
||||||
|
|
||||||
//
|
//
|
||||||
// Adjust draw range depending on some effects
|
// Adjust draw range depending on some effects
|
||||||
@@ -420,18 +430,20 @@ void NoteField::DrawPrimitives()
|
|||||||
fDrawScale *= 1 + 0.5f * fabsf( current_po.m_fPerspectiveTilt );
|
fDrawScale *= 1 + 0.5f * fabsf( current_po.m_fPerspectiveTilt );
|
||||||
fDrawScale *= 1 + fabsf( current_po.m_fEffects[PlayerOptions::EFFECT_MINI] );
|
fDrawScale *= 1 + fabsf( current_po.m_fEffects[PlayerOptions::EFFECT_MINI] );
|
||||||
|
|
||||||
float fFirstDrawScale = g_NoteFieldMode[m_PlayerNumber].m_fFirstPixelToDrawScale;
|
// TODO: Remove use of PlayerNumber.
|
||||||
float fLastDrawScale = g_NoteFieldMode[m_PlayerNumber].m_fLastPixelToDrawScale;
|
PlayerNumber pn = m_pPlayerState->m_PlayerNumber;
|
||||||
|
float fFirstDrawScale = g_NoteFieldMode[pn].m_fFirstPixelToDrawScale;
|
||||||
|
float fLastDrawScale = g_NoteFieldMode[pn].m_fLastPixelToDrawScale;
|
||||||
|
|
||||||
iFirstPixelToDraw = (int)(iFirstPixelToDraw * fFirstDrawScale * fDrawScale);
|
iFirstPixelToDraw = (int)(iFirstPixelToDraw * fFirstDrawScale * fDrawScale);
|
||||||
iLastPixelToDraw = (int)(iLastPixelToDraw * fLastDrawScale * fDrawScale);
|
iLastPixelToDraw = (int)(iLastPixelToDraw * fLastDrawScale * fDrawScale);
|
||||||
|
|
||||||
|
|
||||||
// Probe for first and last notes on the screen
|
// Probe for first and last notes on the screen
|
||||||
float fFirstBeatToDraw = FindFirstDisplayedBeat( m_PlayerNumber, iFirstPixelToDraw );
|
float fFirstBeatToDraw = FindFirstDisplayedBeat( m_pPlayerState, iFirstPixelToDraw );
|
||||||
float fLastBeatToDraw = FindLastDisplayedBeat( m_PlayerNumber, iLastPixelToDraw );
|
float fLastBeatToDraw = FindLastDisplayedBeat( m_pPlayerState, iLastPixelToDraw );
|
||||||
|
|
||||||
GAMESTATE->m_fLastDrawnBeat[m_PlayerNumber] = fLastBeatToDraw;
|
m_pPlayerState->m_fLastDrawnBeat = fLastBeatToDraw;
|
||||||
|
|
||||||
const int iFirstIndexToDraw = BeatToNoteRow(fFirstBeatToDraw);
|
const int iFirstIndexToDraw = BeatToNoteRow(fFirstBeatToDraw);
|
||||||
const int iLastIndexToDraw = BeatToNoteRow(fLastBeatToDraw);
|
const int iLastIndexToDraw = BeatToNoteRow(fLastBeatToDraw);
|
||||||
@@ -518,7 +530,9 @@ void NoteField::DrawPrimitives()
|
|||||||
|
|
||||||
for( int c=0; c<GetNumTracks(); c++ ) // for each arrow column
|
for( int c=0; c<GetNumTracks(); c++ ) // for each arrow column
|
||||||
{
|
{
|
||||||
g_NoteFieldMode[m_PlayerNumber].BeginDrawTrack(c);
|
// TODO: Remove use of PlayerNumber.
|
||||||
|
PlayerNumber pn = m_pPlayerState->m_PlayerNumber;
|
||||||
|
g_NoteFieldMode[pn].BeginDrawTrack(c);
|
||||||
|
|
||||||
//
|
//
|
||||||
// Draw all HoldNotes in this column (so that they appear under the tap notes)
|
// Draw all HoldNotes in this column (so that they appear under the tap notes)
|
||||||
@@ -543,8 +557,8 @@ void NoteField::DrawPrimitives()
|
|||||||
// TRICKY: If boomerang is on, then all notes in the range
|
// TRICKY: If boomerang is on, then all notes in the range
|
||||||
// [iFirstIndexToDraw,iLastIndexToDraw] aren't necessarily visible.
|
// [iFirstIndexToDraw,iLastIndexToDraw] aren't necessarily visible.
|
||||||
// Test every note to make sure it's on screen before drawing
|
// Test every note to make sure it's on screen before drawing
|
||||||
float fYStartOffset = ArrowGetYOffset( m_PlayerNumber, c, NoteRowToBeat(hn.iStartRow) );
|
float fYStartOffset = ArrowEffects::GetYOffset( m_pPlayerState, c, NoteRowToBeat(hn.iStartRow) );
|
||||||
float fYEndOffset = ArrowGetYOffset( m_PlayerNumber, c, NoteRowToBeat(hn.iEndRow) );
|
float fYEndOffset = ArrowEffects::GetYOffset( m_pPlayerState, c, NoteRowToBeat(hn.iEndRow) );
|
||||||
if( !( iFirstPixelToDraw <= fYEndOffset && fYEndOffset <= iLastPixelToDraw ||
|
if( !( iFirstPixelToDraw <= fYEndOffset && fYEndOffset <= iLastPixelToDraw ||
|
||||||
iFirstPixelToDraw <= fYStartOffset && fYStartOffset <= iLastPixelToDraw ||
|
iFirstPixelToDraw <= fYStartOffset && fYStartOffset <= iLastPixelToDraw ||
|
||||||
fYStartOffset < iFirstPixelToDraw && fYEndOffset > iLastPixelToDraw ) )
|
fYStartOffset < iFirstPixelToDraw && fYEndOffset > iLastPixelToDraw ) )
|
||||||
@@ -588,7 +602,7 @@ void NoteField::DrawPrimitives()
|
|||||||
// TRICKY: If boomerang is on, then all notes in the range
|
// TRICKY: If boomerang is on, then all notes in the range
|
||||||
// [iFirstIndexToDraw,iLastIndexToDraw] aren't necessarily visible.
|
// [iFirstIndexToDraw,iLastIndexToDraw] aren't necessarily visible.
|
||||||
// Test every note to make sure it's on screen before drawing
|
// Test every note to make sure it's on screen before drawing
|
||||||
float fYOffset = ArrowGetYOffset( m_PlayerNumber, c, NoteRowToBeat(i) );
|
float fYOffset = ArrowEffects::GetYOffset( m_pPlayerState, c, NoteRowToBeat(i) );
|
||||||
if( fYOffset > iLastPixelToDraw ) // off screen
|
if( fYOffset > iLastPixelToDraw ) // off screen
|
||||||
continue; // skip
|
continue; // skip
|
||||||
if( fYOffset < iFirstPixelToDraw ) // off screen
|
if( fYOffset < iFirstPixelToDraw ) // off screen
|
||||||
@@ -633,7 +647,7 @@ void NoteField::DrawPrimitives()
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
g_NoteFieldMode[m_PlayerNumber].EndDrawTrack(c);
|
g_NoteFieldMode[pn].EndDrawTrack(c);
|
||||||
}
|
}
|
||||||
|
|
||||||
cur->m_GhostArrowRow.Draw();
|
cur->m_GhostArrowRow.Draw();
|
||||||
|
|||||||
@@ -5,7 +5,6 @@
|
|||||||
#include "ActorFrame.h"
|
#include "ActorFrame.h"
|
||||||
#include "BitmapText.h"
|
#include "BitmapText.h"
|
||||||
#include "PrefsManager.h"
|
#include "PrefsManager.h"
|
||||||
#include "Style.h"
|
|
||||||
#include "BitmapText.h"
|
#include "BitmapText.h"
|
||||||
#include "Quad.h"
|
#include "Quad.h"
|
||||||
#include "NoteDataWithScoring.h"
|
#include "NoteDataWithScoring.h"
|
||||||
@@ -24,7 +23,12 @@ public:
|
|||||||
virtual void Update( float fDeltaTime );
|
virtual void Update( float fDeltaTime );
|
||||||
virtual void DrawPrimitives();
|
virtual void DrawPrimitives();
|
||||||
|
|
||||||
virtual void Load( const NoteData* pNoteData, PlayerNumber pn, int iStartDrawingPixel, int iEndDrawingPixel, float fYReverseOffsetPixels );
|
virtual void Load(
|
||||||
|
const NoteData* pNoteData,
|
||||||
|
const PlayerState* pPlayerState,
|
||||||
|
int iStartDrawingPixel,
|
||||||
|
int iEndDrawingPixel,
|
||||||
|
float fYReverseOffsetPixels );
|
||||||
virtual void Unload();
|
virtual void Unload();
|
||||||
void RemoveTapNoteRow( int iIndex );
|
void RemoveTapNoteRow( int iIndex );
|
||||||
|
|
||||||
@@ -56,7 +60,7 @@ protected:
|
|||||||
|
|
||||||
float m_fPercentFadeToFail; // -1 of not fading to fail
|
float m_fPercentFadeToFail; // -1 of not fading to fail
|
||||||
|
|
||||||
PlayerNumber m_PlayerNumber;
|
const PlayerState* m_pPlayerState;
|
||||||
int m_iStartDrawingPixel; // this should be a negative number
|
int m_iStartDrawingPixel; // this should be a negative number
|
||||||
int m_iEndDrawingPixel; // this should be a positive number
|
int m_iEndDrawingPixel; // this should be a positive number
|
||||||
float m_fYReverseOffsetPixels;
|
float m_fYReverseOffsetPixels;
|
||||||
|
|||||||
@@ -11,6 +11,7 @@
|
|||||||
#include "IniFile.h"
|
#include "IniFile.h"
|
||||||
#include "Game.h"
|
#include "Game.h"
|
||||||
#include "ScreenDimensions.h"
|
#include "ScreenDimensions.h"
|
||||||
|
#include "PlayerState.h"
|
||||||
|
|
||||||
/* Copies of the current mode. Update this by calling Load. */
|
/* Copies of the current mode. Update this by calling Load. */
|
||||||
NoteFieldMode g_NoteFieldMode[NUM_PLAYERS];
|
NoteFieldMode g_NoteFieldMode[NUM_PLAYERS];
|
||||||
@@ -134,7 +135,7 @@ void NoteFieldPositioning::Load(PlayerNumber pn)
|
|||||||
}
|
}
|
||||||
|
|
||||||
/* Is there a custom mode with the current name that fits the current game? */
|
/* Is there a custom mode with the current name that fits the current game? */
|
||||||
const int ModeNum = GetID(GAMESTATE->m_PlayerOptions[pn].m_sPositioning);
|
const int ModeNum = GetID(GAMESTATE->m_pPlayerState[pn]->m_PlayerOptions.m_sPositioning);
|
||||||
if(ModeNum == -1)
|
if(ModeNum == -1)
|
||||||
return; /* No, only use the style table settings. */
|
return; /* No, only use the style table settings. */
|
||||||
|
|
||||||
|
|||||||
@@ -4,6 +4,7 @@
|
|||||||
#include "PlayerOptions.h"
|
#include "PlayerOptions.h"
|
||||||
#include "GameState.h"
|
#include "GameState.h"
|
||||||
#include "RageLog.h"
|
#include "RageLog.h"
|
||||||
|
#include "PlayerState.h"
|
||||||
|
|
||||||
|
|
||||||
#define SPACING_X THEME->GetMetricF("OptionIconRow","SpacingX")
|
#define SPACING_X THEME->GetMetricF("OptionIconRow","SpacingX")
|
||||||
@@ -95,7 +96,7 @@ void OptionIconRow::Refresh()
|
|||||||
for( unsigned i=0; i<NUM_OPTION_COLS; i++ )
|
for( unsigned i=0; i<NUM_OPTION_COLS; i++ )
|
||||||
m_OptionIcon[i].Load( m_PlayerNumber, "", i==0 );
|
m_OptionIcon[i].Load( m_PlayerNumber, "", i==0 );
|
||||||
|
|
||||||
CString sOptions = GAMESTATE->m_PlayerOptions[m_PlayerNumber].GetString();
|
CString sOptions = GAMESTATE->m_pPlayerState[m_PlayerNumber]->m_PlayerOptions.GetString();
|
||||||
CStringArray asOptions;
|
CStringArray asOptions;
|
||||||
split( sOptions, ", ", asOptions, true );
|
split( sOptions, ", ", asOptions, true );
|
||||||
|
|
||||||
|
|||||||
+156
-91
@@ -30,6 +30,7 @@
|
|||||||
#include "ScreenDimensions.h"
|
#include "ScreenDimensions.h"
|
||||||
#include "RageSoundManager.h"
|
#include "RageSoundManager.h"
|
||||||
#include "ThemeMetric.h"
|
#include "ThemeMetric.h"
|
||||||
|
#include "PlayerState.h"
|
||||||
|
|
||||||
ThemeMetric<float> GRAY_ARROWS_Y_STANDARD ("Player","ReceptorArrowsYStandard");
|
ThemeMetric<float> GRAY_ARROWS_Y_STANDARD ("Player","ReceptorArrowsYStandard");
|
||||||
ThemeMetric<float> GRAY_ARROWS_Y_REVERSE ("Player","ReceptorArrowsYReverse");
|
ThemeMetric<float> GRAY_ARROWS_Y_REVERSE ("Player","ReceptorArrowsYReverse");
|
||||||
@@ -59,7 +60,7 @@ static const float StepSearchDistance = 1.0f;
|
|||||||
|
|
||||||
PlayerMinus::PlayerMinus()
|
PlayerMinus::PlayerMinus()
|
||||||
{
|
{
|
||||||
m_PlayerNumber = PLAYER_INVALID;
|
m_pPlayerState = NULL;
|
||||||
m_fNoteFieldHeight = 0;
|
m_fNoteFieldHeight = 0;
|
||||||
|
|
||||||
m_pLifeMeter = NULL;
|
m_pLifeMeter = NULL;
|
||||||
@@ -89,7 +90,7 @@ PlayerMinus::~PlayerMinus()
|
|||||||
}
|
}
|
||||||
|
|
||||||
void PlayerMinus::Load(
|
void PlayerMinus::Load(
|
||||||
PlayerNumber pn,
|
PlayerState* pPlayerState,
|
||||||
const NoteData& noteData,
|
const NoteData& noteData,
|
||||||
LifeMeter* pLM,
|
LifeMeter* pLM,
|
||||||
CombinedLifeMeter* pCombinedLM,
|
CombinedLifeMeter* pCombinedLM,
|
||||||
@@ -102,9 +103,7 @@ void PlayerMinus::Load(
|
|||||||
{
|
{
|
||||||
m_iDCState = AS2D_IDLE;
|
m_iDCState = AS2D_IDLE;
|
||||||
|
|
||||||
GAMESTATE->ResetNoteSkinsForPlayer( pn );
|
m_pPlayerState = pPlayerState;
|
||||||
|
|
||||||
m_PlayerNumber = pn;
|
|
||||||
m_pLifeMeter = pLM;
|
m_pLifeMeter = pLM;
|
||||||
m_pCombinedLifeMeter = pCombinedLM;
|
m_pCombinedLifeMeter = pCombinedLM;
|
||||||
m_pScoreDisplay = pScoreDisplay;
|
m_pScoreDisplay = pScoreDisplay;
|
||||||
@@ -116,6 +115,11 @@ void PlayerMinus::Load(
|
|||||||
m_iRowLastCrossed = BeatToNoteRowNotRounded( GAMESTATE->m_fSongBeat ) - 1; // why this?
|
m_iRowLastCrossed = BeatToNoteRowNotRounded( GAMESTATE->m_fSongBeat ) - 1; // why this?
|
||||||
m_iMineRowLastCrossed = BeatToNoteRowNotRounded( GAMESTATE->m_fSongBeat ) - 1; // why this?
|
m_iMineRowLastCrossed = BeatToNoteRowNotRounded( GAMESTATE->m_fSongBeat ) - 1; // why this?
|
||||||
|
|
||||||
|
// TODO: Remove use of PlayerNumber.
|
||||||
|
PlayerNumber pn = pPlayerState->m_PlayerNumber;
|
||||||
|
|
||||||
|
GAMESTATE->ResetNoteSkinsForPlayer( pn );
|
||||||
|
|
||||||
/* Ensure that this is up-to-date. */
|
/* Ensure that this is up-to-date. */
|
||||||
GAMESTATE->m_pPosition->Load(pn);
|
GAMESTATE->m_pPosition->Load(pn);
|
||||||
|
|
||||||
@@ -133,8 +137,8 @@ void PlayerMinus::Load(
|
|||||||
m_Judgment.StopTweening();
|
m_Judgment.StopTweening();
|
||||||
// m_Combo.Reset(); // don't reset combos between songs in a course!
|
// m_Combo.Reset(); // don't reset combos between songs in a course!
|
||||||
m_Combo.Init( pn );
|
m_Combo.Init( pn );
|
||||||
m_Combo.SetCombo( g_CurStageStats.iCurCombo[m_PlayerNumber], g_CurStageStats.iCurMissCombo[m_PlayerNumber] ); // combo can persist between songs and games
|
m_Combo.SetCombo( g_CurStageStats.iCurCombo[pn], g_CurStageStats.iCurMissCombo[pn] ); // combo can persist between songs and games
|
||||||
m_AttackDisplay.Init( pn );
|
m_AttackDisplay.Init( m_pPlayerState );
|
||||||
m_Judgment.Reset();
|
m_Judgment.Reset();
|
||||||
|
|
||||||
/* Don't re-init this; that'll reload graphics. Add a separate Reset() call
|
/* Don't re-init this; that'll reload graphics. Add a separate Reset() call
|
||||||
@@ -143,7 +147,7 @@ void PlayerMinus::Load(
|
|||||||
// m_pScore->Init( pn );
|
// m_pScore->Init( pn );
|
||||||
|
|
||||||
/* Apply transforms. */
|
/* Apply transforms. */
|
||||||
NoteDataUtil::TransformNoteData( m_NoteData, GAMESTATE->m_PlayerOptions[pn], GAMESTATE->GetCurrentStyle()->m_StepsType );
|
NoteDataUtil::TransformNoteData( m_NoteData, GAMESTATE->m_pPlayerState[pn]->m_PlayerOptions, GAMESTATE->GetCurrentStyle()->m_StepsType );
|
||||||
|
|
||||||
switch( GAMESTATE->m_PlayMode )
|
switch( GAMESTATE->m_PlayMode )
|
||||||
{
|
{
|
||||||
@@ -151,7 +155,7 @@ void PlayerMinus::Load(
|
|||||||
case PLAY_MODE_BATTLE:
|
case PLAY_MODE_BATTLE:
|
||||||
{
|
{
|
||||||
// ugly, ugly, ugly. Works only w/ dance.
|
// ugly, ugly, ugly. Works only w/ dance.
|
||||||
NoteDataUtil::TransformNoteData( m_NoteData, GAMESTATE->m_PlayerOptions[pn], GAMESTATE->GetCurrentStyle()->m_StepsType );
|
NoteDataUtil::TransformNoteData( m_NoteData, GAMESTATE->m_pPlayerState[pn]->m_PlayerOptions, GAMESTATE->GetCurrentStyle()->m_StepsType );
|
||||||
|
|
||||||
// shuffle either p1 or p2
|
// shuffle either p1 or p2
|
||||||
static int count = 0;
|
static int count = 0;
|
||||||
@@ -186,18 +190,18 @@ void PlayerMinus::Load(
|
|||||||
|
|
||||||
m_pNoteField->SetY( fNoteFieldMidde );
|
m_pNoteField->SetY( fNoteFieldMidde );
|
||||||
m_fNoteFieldHeight = GRAY_ARROWS_Y_REVERSE-GRAY_ARROWS_Y_STANDARD;
|
m_fNoteFieldHeight = GRAY_ARROWS_Y_REVERSE-GRAY_ARROWS_Y_STANDARD;
|
||||||
m_pNoteField->Load( &m_NoteData, pn, iStartDrawingAtPixels, iStopDrawingAtPixels, m_fNoteFieldHeight );
|
m_pNoteField->Load( &m_NoteData, m_pPlayerState, iStartDrawingAtPixels, iStopDrawingAtPixels, m_fNoteFieldHeight );
|
||||||
m_ArrowBackdrop.SetPlayer( pn );
|
m_ArrowBackdrop.SetPlayer( pn );
|
||||||
|
|
||||||
const bool bReverse = GAMESTATE->m_PlayerOptions[pn].GetReversePercentForColumn(0) == 1;
|
const bool bReverse = GAMESTATE->m_pPlayerState[pn]->m_PlayerOptions.GetReversePercentForColumn(0) == 1;
|
||||||
bool bPlayerUsingBothSides = GAMESTATE->GetCurrentStyle()->m_StyleType==ONE_PLAYER_TWO_SIDES;
|
bool bPlayerUsingBothSides = GAMESTATE->GetCurrentStyle()->m_StyleType==ONE_PLAYER_TWO_SIDES;
|
||||||
m_Combo.SetX( COMBO_X(m_PlayerNumber,bPlayerUsingBothSides) );
|
m_Combo.SetX( COMBO_X(pn,bPlayerUsingBothSides) );
|
||||||
m_Combo.SetY( bReverse ? COMBO_Y_REVERSE : COMBO_Y );
|
m_Combo.SetY( bReverse ? COMBO_Y_REVERSE : COMBO_Y );
|
||||||
m_AttackDisplay.SetX( ATTACK_DISPLAY_X(m_PlayerNumber,bPlayerUsingBothSides) - 40 );
|
m_AttackDisplay.SetX( ATTACK_DISPLAY_X(pn,bPlayerUsingBothSides) - 40 );
|
||||||
m_AttackDisplay.SetY( bReverse ? ATTACK_DISPLAY_Y_REVERSE : ATTACK_DISPLAY_Y );
|
m_AttackDisplay.SetY( bReverse ? ATTACK_DISPLAY_Y_REVERSE : ATTACK_DISPLAY_Y );
|
||||||
m_Judgment.SetX( JUDGMENT_X(m_PlayerNumber,bPlayerUsingBothSides) );
|
m_Judgment.SetX( JUDGMENT_X(pn,bPlayerUsingBothSides) );
|
||||||
m_Judgment.SetY( bReverse ? JUDGMENT_Y_REVERSE : JUDGMENT_Y );
|
m_Judgment.SetY( bReverse ? JUDGMENT_Y_REVERSE : JUDGMENT_Y );
|
||||||
m_ProTimingDisplay.SetX( JUDGMENT_X(m_PlayerNumber,bPlayerUsingBothSides) );
|
m_ProTimingDisplay.SetX( JUDGMENT_X(pn,bPlayerUsingBothSides) );
|
||||||
m_ProTimingDisplay.SetY( bReverse ? SCREEN_BOTTOM-JUDGMENT_Y : SCREEN_TOP+JUDGMENT_Y );
|
m_ProTimingDisplay.SetY( bReverse ? SCREEN_BOTTOM-JUDGMENT_Y : SCREEN_TOP+JUDGMENT_Y );
|
||||||
|
|
||||||
/* These commands add to the above positioning, and are usually empty. */
|
/* These commands add to the above positioning, and are usually empty. */
|
||||||
@@ -236,7 +240,7 @@ void PlayerMinus::Load(
|
|||||||
if( GAMESTATE->GetNumPlayersEnabled() == 2 )
|
if( GAMESTATE->GetNumPlayersEnabled() == 2 )
|
||||||
{
|
{
|
||||||
/* Two players are active. Play sounds on this player's side. */
|
/* Two players are active. Play sounds on this player's side. */
|
||||||
p.m_Balance = (m_PlayerNumber == PLAYER_1)? -1.0f:1.0f;
|
p.m_Balance = (pn == PLAYER_1)? -1.0f:1.0f;
|
||||||
}
|
}
|
||||||
m_soundMine.SetParams( p );
|
m_soundMine.SetParams( p );
|
||||||
m_soundAttackLaunch.SetParams( p );
|
m_soundAttackLaunch.SetParams( p );
|
||||||
@@ -265,9 +269,9 @@ void PlayerMinus::Update( float fDeltaTime )
|
|||||||
if( GAMESTATE->m_pCurSong==NULL )
|
if( GAMESTATE->m_pCurSong==NULL )
|
||||||
return;
|
return;
|
||||||
|
|
||||||
if( GAMESTATE->m_bAttackBeganThisUpdate[m_PlayerNumber] )
|
if( m_pPlayerState->m_bAttackBeganThisUpdate )
|
||||||
m_soundAttackLaunch.Play();
|
m_soundAttackLaunch.Play();
|
||||||
if( GAMESTATE->m_bAttackEndedThisUpdate[m_PlayerNumber] )
|
if( m_pPlayerState->m_bAttackEndedThisUpdate )
|
||||||
m_soundAttackEnding.Play();
|
m_soundAttackEnding.Play();
|
||||||
|
|
||||||
|
|
||||||
@@ -282,12 +286,12 @@ void PlayerMinus::Update( float fDeltaTime )
|
|||||||
{
|
{
|
||||||
for( int c=0; c<GAMESTATE->GetCurrentStyle()->m_iColsPerPlayer; c++ )
|
for( int c=0; c<GAMESTATE->GetCurrentStyle()->m_iColsPerPlayer; c++ )
|
||||||
{
|
{
|
||||||
float fPercentReverse = GAMESTATE->m_CurrentPlayerOptions[m_PlayerNumber].GetReversePercentForColumn(c);
|
float fPercentReverse = m_pPlayerState->m_CurrentPlayerOptions.GetReversePercentForColumn(c);
|
||||||
float fHoldJudgeYPos = SCALE( fPercentReverse, 0.f, 1.f, HOLD_JUDGMENT_Y_STANDARD, HOLD_JUDGMENT_Y_REVERSE );
|
float fHoldJudgeYPos = SCALE( fPercentReverse, 0.f, 1.f, HOLD_JUDGMENT_Y_STANDARD, HOLD_JUDGMENT_Y_REVERSE );
|
||||||
// float fGrayYPos = SCALE( fPercentReverse, 0.f, 1.f, GRAY_ARROWS_Y_STANDARD, GRAY_ARROWS_Y_REVERSE );
|
// float fGrayYPos = SCALE( fPercentReverse, 0.f, 1.f, GRAY_ARROWS_Y_STANDARD, GRAY_ARROWS_Y_REVERSE );
|
||||||
|
|
||||||
const float fX = ArrowGetXPos( m_PlayerNumber, c, 0 );
|
const float fX = ArrowEffects::GetXPos( m_pPlayerState, c, 0 );
|
||||||
const float fZ = ArrowGetZPos( m_PlayerNumber, c, 0 );
|
const float fZ = ArrowEffects::GetZPos( m_pPlayerState, c, 0 );
|
||||||
|
|
||||||
m_HoldJudgment[c].SetX( fX );
|
m_HoldJudgment[c].SetX( fX );
|
||||||
m_HoldJudgment[c].SetY( fHoldJudgeYPos );
|
m_HoldJudgment[c].SetY( fHoldJudgeYPos );
|
||||||
@@ -295,14 +299,14 @@ void PlayerMinus::Update( float fDeltaTime )
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
float fPercentReverse = GAMESTATE->m_CurrentPlayerOptions[m_PlayerNumber].GetReversePercentForColumn(0);
|
float fPercentReverse = m_pPlayerState->m_CurrentPlayerOptions.GetReversePercentForColumn(0);
|
||||||
float fGrayYPos = SCALE( fPercentReverse, 0.f, 1.f, GRAY_ARROWS_Y_STANDARD, GRAY_ARROWS_Y_REVERSE );
|
float fGrayYPos = SCALE( fPercentReverse, 0.f, 1.f, GRAY_ARROWS_Y_STANDARD, GRAY_ARROWS_Y_REVERSE );
|
||||||
m_ArrowBackdrop.SetY( fGrayYPos );
|
m_ArrowBackdrop.SetY( fGrayYPos );
|
||||||
|
|
||||||
// NoteField accounts for reverse on its own now.
|
// NoteField accounts for reverse on its own now.
|
||||||
// m_pNoteField->SetY( fGrayYPos );
|
// m_pNoteField->SetY( fGrayYPos );
|
||||||
|
|
||||||
float fMiniPercent = GAMESTATE->m_CurrentPlayerOptions[m_PlayerNumber].m_fEffects[PlayerOptions::EFFECT_MINI];
|
float fMiniPercent = m_pPlayerState->m_CurrentPlayerOptions.m_fEffects[PlayerOptions::EFFECT_MINI];
|
||||||
float fNoteFieldZoom = 1 - fMiniPercent*0.5f;
|
float fNoteFieldZoom = 1 - fMiniPercent*0.5f;
|
||||||
float fJudgmentZoom = 1 - fMiniPercent*0.25f;
|
float fJudgmentZoom = 1 - fMiniPercent*0.25f;
|
||||||
m_pNoteField->SetZoom( fNoteFieldZoom );
|
m_pNoteField->SetZoom( fNoteFieldZoom );
|
||||||
@@ -320,12 +324,15 @@ void PlayerMinus::Update( float fDeltaTime )
|
|||||||
ASSERT_M( iNumCols < MAX_COLS_PER_PLAYER, ssprintf("%i >= %i", iNumCols, MAX_COLS_PER_PLAYER) );
|
ASSERT_M( iNumCols < MAX_COLS_PER_PLAYER, ssprintf("%i >= %i", iNumCols, MAX_COLS_PER_PLAYER) );
|
||||||
for( int col=0; col < iNumCols; ++col )
|
for( int col=0; col < iNumCols; ++col )
|
||||||
{
|
{
|
||||||
|
// TODO: Remove use of PlayerNumber.
|
||||||
|
PlayerNumber pn = m_pPlayerState->m_PlayerNumber;
|
||||||
|
|
||||||
CHECKPOINT_M( ssprintf("%i %i", col, iNumCols) );
|
CHECKPOINT_M( ssprintf("%i %i", col, iNumCols) );
|
||||||
const StyleInput StyleI( m_PlayerNumber, col );
|
const StyleInput StyleI( pn, col );
|
||||||
const GameInput GameI = GAMESTATE->GetCurrentStyle()->StyleInputToGameInput( StyleI );
|
const GameInput GameI = GAMESTATE->GetCurrentStyle()->StyleInputToGameInput( StyleI );
|
||||||
bool bIsHoldingButton = INPUTMAPPER->IsButtonDown( GameI );
|
bool bIsHoldingButton = INPUTMAPPER->IsButtonDown( GameI );
|
||||||
// TODO: Make this work for non-human-controlled players
|
// TODO: Make this work for non-human-controlled players
|
||||||
if( bIsHoldingButton && !GAMESTATE->m_bDemonstrationOrJukebox && GAMESTATE->m_PlayerController[m_PlayerNumber]==PC_HUMAN )
|
if( bIsHoldingButton && !GAMESTATE->m_bDemonstrationOrJukebox && m_pPlayerState->m_PlayerController==PC_HUMAN )
|
||||||
m_pNoteField->SetPressed( col );
|
m_pNoteField->SetPressed( col );
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -346,7 +353,10 @@ void PlayerMinus::Update( float fDeltaTime )
|
|||||||
if( iSongRow < hn.iStartRow )
|
if( iSongRow < hn.iStartRow )
|
||||||
continue; // hold hasn't happened yet
|
continue; // hold hasn't happened yet
|
||||||
|
|
||||||
const StyleInput StyleI( m_PlayerNumber, hn.iTrack );
|
// TODO: Remove use of PlayerNumber.
|
||||||
|
PlayerNumber pn = m_pPlayerState->m_PlayerNumber;
|
||||||
|
|
||||||
|
const StyleInput StyleI( pn, hn.iTrack );
|
||||||
const GameInput GameI = GAMESTATE->GetCurrentStyle()->StyleInputToGameInput( StyleI );
|
const GameInput GameI = GAMESTATE->GetCurrentStyle()->StyleInputToGameInput( StyleI );
|
||||||
|
|
||||||
// if they got a bad score or haven't stepped on the corresponding tap yet
|
// if they got a bad score or haven't stepped on the corresponding tap yet
|
||||||
@@ -361,7 +371,7 @@ void PlayerMinus::Update( float fDeltaTime )
|
|||||||
bool bIsHoldingButton = INPUTMAPPER->IsButtonDown( GameI );
|
bool bIsHoldingButton = INPUTMAPPER->IsButtonDown( GameI );
|
||||||
|
|
||||||
// TODO: Make the CPU miss sometimes.
|
// TODO: Make the CPU miss sometimes.
|
||||||
if( GAMESTATE->m_PlayerController[m_PlayerNumber] != PC_HUMAN )
|
if( m_pPlayerState->m_PlayerController != PC_HUMAN )
|
||||||
bIsHoldingButton = true;
|
bIsHoldingButton = true;
|
||||||
|
|
||||||
// set hold flag so NoteField can do intelligent drawing
|
// set hold flag so NoteField can do intelligent drawing
|
||||||
@@ -423,7 +433,10 @@ void PlayerMinus::Update( float fDeltaTime )
|
|||||||
|
|
||||||
int ms_error = (hns == HNS_OK)? 0:MAX_PRO_TIMING_ERROR;
|
int ms_error = (hns == HNS_OK)? 0:MAX_PRO_TIMING_ERROR;
|
||||||
|
|
||||||
g_CurStageStats.iTotalError[m_PlayerNumber] += ms_error;
|
// TODO: Remove use of PlayerNumber.
|
||||||
|
PlayerNumber pn = m_pPlayerState->m_PlayerNumber;
|
||||||
|
|
||||||
|
g_CurStageStats.iTotalError[pn] += ms_error;
|
||||||
if( hns == HNS_NG ) /* don't show a 0 for an OK */
|
if( hns == HNS_NG ) /* don't show a 0 for an OK */
|
||||||
m_ProTimingDisplay.SetJudgment( ms_error, TNS_MISS );
|
m_ProTimingDisplay.SetJudgment( ms_error, TNS_MISS );
|
||||||
}
|
}
|
||||||
@@ -435,6 +448,9 @@ void PlayerMinus::Update( float fDeltaTime )
|
|||||||
m_NoteData.SetHoldNoteScore(hn, hns);
|
m_NoteData.SetHoldNoteScore(hn, hns);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// TODO: Remove use of PlayerNumber.
|
||||||
|
PlayerNumber pn = m_pPlayerState->m_PlayerNumber;
|
||||||
|
|
||||||
{
|
{
|
||||||
// Why was this originally "BeatToNoteRowNotRounded"? It should be rounded. -Chris
|
// Why was this originally "BeatToNoteRowNotRounded"? It should be rounded. -Chris
|
||||||
/* We want to send the crossed row message exactly when we cross the row--not
|
/* We want to send the crossed row message exactly when we cross the row--not
|
||||||
@@ -444,7 +460,7 @@ void PlayerMinus::Update( float fDeltaTime )
|
|||||||
if( iRowNow >= 0 )
|
if( iRowNow >= 0 )
|
||||||
{
|
{
|
||||||
for( ; m_iRowLastCrossed <= iRowNow; m_iRowLastCrossed++ ) // for each index we crossed since the last update
|
for( ; m_iRowLastCrossed <= iRowNow; m_iRowLastCrossed++ ) // for each index we crossed since the last update
|
||||||
if( GAMESTATE->IsPlayerEnabled(m_PlayerNumber) )
|
if( GAMESTATE->IsPlayerEnabled(pn) )
|
||||||
CrossedRow( m_iRowLastCrossed );
|
CrossedRow( m_iRowLastCrossed );
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -458,7 +474,7 @@ void PlayerMinus::Update( float fDeltaTime )
|
|||||||
if( iRowNow >= 0 )
|
if( iRowNow >= 0 )
|
||||||
{
|
{
|
||||||
for( ; m_iMineRowLastCrossed <= iRowNow; m_iMineRowLastCrossed++ ) // for each index we crossed since the last update
|
for( ; m_iMineRowLastCrossed <= iRowNow; m_iMineRowLastCrossed++ ) // for each index we crossed since the last update
|
||||||
if( GAMESTATE->IsPlayerEnabled(m_PlayerNumber) )
|
if( GAMESTATE->IsPlayerEnabled(pn) )
|
||||||
CrossedMineRow( m_iMineRowLastCrossed );
|
CrossedMineRow( m_iMineRowLastCrossed );
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -477,9 +493,9 @@ void PlayerMinus::Update( float fDeltaTime )
|
|||||||
|
|
||||||
void PlayerMinus::ApplyWaitingTransforms()
|
void PlayerMinus::ApplyWaitingTransforms()
|
||||||
{
|
{
|
||||||
for( unsigned j=0; j<GAMESTATE->m_ModsToApply[m_PlayerNumber].size(); j++ )
|
for( unsigned j=0; j<m_pPlayerState->m_ModsToApply.size(); j++ )
|
||||||
{
|
{
|
||||||
const Attack &mod = GAMESTATE->m_ModsToApply[m_PlayerNumber][j];
|
const Attack &mod = m_pPlayerState->m_ModsToApply[j];
|
||||||
PlayerOptions po;
|
PlayerOptions po;
|
||||||
/* Should this default to "" always? need it blank so we know if mod.sModifier
|
/* Should this default to "" always? need it blank so we know if mod.sModifier
|
||||||
* changes the note skin. */
|
* changes the note skin. */
|
||||||
@@ -487,31 +503,34 @@ void PlayerMinus::ApplyWaitingTransforms()
|
|||||||
po.FromString( mod.sModifier );
|
po.FromString( mod.sModifier );
|
||||||
|
|
||||||
float fStartBeat, fEndBeat;
|
float fStartBeat, fEndBeat;
|
||||||
mod.GetAttackBeats( GAMESTATE->m_pCurSong, m_PlayerNumber, fStartBeat, fEndBeat );
|
mod.GetAttackBeats( GAMESTATE->m_pCurSong, m_pPlayerState, fStartBeat, fEndBeat );
|
||||||
fEndBeat = min( fEndBeat, m_NoteData.GetLastBeat() );
|
fEndBeat = min( fEndBeat, m_NoteData.GetLastBeat() );
|
||||||
|
|
||||||
LOG->Trace( "Applying transform '%s' from %f to %f to '%s'", mod.sModifier.c_str(), fStartBeat, fEndBeat,
|
LOG->Trace( "Applying transform '%s' from %f to %f to '%s'", mod.sModifier.c_str(), fStartBeat, fEndBeat,
|
||||||
GAMESTATE->m_pCurSong->GetTranslitMainTitle().c_str() );
|
GAMESTATE->m_pCurSong->GetTranslitMainTitle().c_str() );
|
||||||
if( po.m_sNoteSkin != "" )
|
if( po.m_sNoteSkin != "" )
|
||||||
GAMESTATE->SetNoteSkinForBeatRange( m_PlayerNumber, po.m_sNoteSkin, fStartBeat, fEndBeat );
|
GAMESTATE->SetNoteSkinForBeatRange( m_pPlayerState, po.m_sNoteSkin, fStartBeat, fEndBeat );
|
||||||
|
|
||||||
NoteDataUtil::TransformNoteData( m_NoteData, po, GAMESTATE->GetCurrentStyle()->m_StepsType, fStartBeat, fEndBeat );
|
NoteDataUtil::TransformNoteData( m_NoteData, po, GAMESTATE->GetCurrentStyle()->m_StepsType, fStartBeat, fEndBeat );
|
||||||
m_pNoteField->CopyRange( m_NoteData, BeatToNoteRow(fStartBeat), BeatToNoteRow(fEndBeat), BeatToNoteRow(fStartBeat) );
|
m_pNoteField->CopyRange( m_NoteData, BeatToNoteRow(fStartBeat), BeatToNoteRow(fEndBeat), BeatToNoteRow(fStartBeat) );
|
||||||
}
|
}
|
||||||
GAMESTATE->m_ModsToApply[m_PlayerNumber].clear();
|
m_pPlayerState->m_ModsToApply.clear();
|
||||||
}
|
}
|
||||||
|
|
||||||
void PlayerMinus::DrawPrimitives()
|
void PlayerMinus::DrawPrimitives()
|
||||||
{
|
{
|
||||||
|
// TODO: Remove use of PlayerNumber.
|
||||||
|
PlayerNumber pn = m_pPlayerState->m_PlayerNumber;
|
||||||
|
|
||||||
// May have both players in doubles (for battle play); only draw primary player.
|
// May have both players in doubles (for battle play); only draw primary player.
|
||||||
if( GAMESTATE->GetCurrentStyle()->m_StyleType == ONE_PLAYER_TWO_SIDES &&
|
if( GAMESTATE->GetCurrentStyle()->m_StyleType == ONE_PLAYER_TWO_SIDES &&
|
||||||
m_PlayerNumber != GAMESTATE->m_MasterPlayerNumber )
|
pn != GAMESTATE->m_MasterPlayerNumber )
|
||||||
return;
|
return;
|
||||||
|
|
||||||
|
|
||||||
// Draw these below everything else.
|
// Draw these below everything else.
|
||||||
m_ArrowBackdrop.Draw();
|
m_ArrowBackdrop.Draw();
|
||||||
if( GAMESTATE->m_PlayerOptions[m_PlayerNumber].m_fBlind == 0 )
|
if( m_pPlayerState->m_PlayerOptions.m_fBlind == 0 )
|
||||||
m_Combo.Draw();
|
m_Combo.Draw();
|
||||||
|
|
||||||
m_AttackDisplay.Draw();
|
m_AttackDisplay.Draw();
|
||||||
@@ -522,9 +541,9 @@ void PlayerMinus::DrawPrimitives()
|
|||||||
if( HOLD_JUDGMENTS_UNDER_FIELD )
|
if( HOLD_JUDGMENTS_UNDER_FIELD )
|
||||||
DrawHoldJudgments();
|
DrawHoldJudgments();
|
||||||
|
|
||||||
float fTilt = GAMESTATE->m_CurrentPlayerOptions[m_PlayerNumber].m_fPerspectiveTilt;
|
float fTilt = m_pPlayerState->m_CurrentPlayerOptions.m_fPerspectiveTilt;
|
||||||
float fSkew = GAMESTATE->m_CurrentPlayerOptions[m_PlayerNumber].m_fSkew;
|
float fSkew = m_pPlayerState->m_CurrentPlayerOptions.m_fSkew;
|
||||||
bool bReverse = GAMESTATE->m_CurrentPlayerOptions[m_PlayerNumber].GetReversePercentForColumn(0)>0.5;
|
bool bReverse = m_pPlayerState->m_CurrentPlayerOptions.GetReversePercentForColumn(0)>0.5;
|
||||||
|
|
||||||
|
|
||||||
DISPLAY->CameraPushMatrix();
|
DISPLAY->CameraPushMatrix();
|
||||||
@@ -539,7 +558,7 @@ void PlayerMinus::DrawPrimitives()
|
|||||||
float fTiltDegrees = SCALE(fTilt,-1.f,+1.f,+30,-30) * (bReverse?-1:1);
|
float fTiltDegrees = SCALE(fTilt,-1.f,+1.f,+30,-30) * (bReverse?-1:1);
|
||||||
|
|
||||||
|
|
||||||
float fZoom = SCALE( GAMESTATE->m_CurrentPlayerOptions[m_PlayerNumber].m_fEffects[PlayerOptions::EFFECT_MINI], 0.f, 1.f, 1.f, 0.5f );
|
float fZoom = SCALE( m_pPlayerState->m_CurrentPlayerOptions.m_fEffects[PlayerOptions::EFFECT_MINI], 0.f, 1.f, 1.f, 0.5f );
|
||||||
if( fTilt > 0 )
|
if( fTilt > 0 )
|
||||||
fZoom *= SCALE( fTilt, 0.f, 1.f, 1.f, 0.9f );
|
fZoom *= SCALE( fTilt, 0.f, 1.f, 1.f, 0.9f );
|
||||||
else
|
else
|
||||||
@@ -571,10 +590,10 @@ void PlayerMinus::DrawPrimitives()
|
|||||||
|
|
||||||
void PlayerMinus::DrawTapJudgments()
|
void PlayerMinus::DrawTapJudgments()
|
||||||
{
|
{
|
||||||
if( GAMESTATE->m_PlayerOptions[m_PlayerNumber].m_fBlind > 0 )
|
if( m_pPlayerState->m_PlayerOptions.m_fBlind > 0 )
|
||||||
return;
|
return;
|
||||||
|
|
||||||
if( GAMESTATE->m_PlayerOptions[m_PlayerNumber].m_bProTiming )
|
if( m_pPlayerState->m_PlayerOptions.m_bProTiming )
|
||||||
m_ProTimingDisplay.Draw();
|
m_ProTimingDisplay.Draw();
|
||||||
else
|
else
|
||||||
m_Judgment.Draw();
|
m_Judgment.Draw();
|
||||||
@@ -582,16 +601,19 @@ void PlayerMinus::DrawTapJudgments()
|
|||||||
|
|
||||||
void PlayerMinus::DrawHoldJudgments()
|
void PlayerMinus::DrawHoldJudgments()
|
||||||
{
|
{
|
||||||
if( GAMESTATE->m_PlayerOptions[m_PlayerNumber].m_fBlind > 0 )
|
if( m_pPlayerState->m_PlayerOptions.m_fBlind > 0 )
|
||||||
return;
|
return;
|
||||||
|
|
||||||
|
// TODO: Remove use of PlayerNumber.
|
||||||
|
PlayerNumber pn = m_pPlayerState->m_PlayerNumber;
|
||||||
|
|
||||||
for( int c=0; c<m_NoteData.GetNumTracks(); c++ )
|
for( int c=0; c<m_NoteData.GetNumTracks(); c++ )
|
||||||
{
|
{
|
||||||
g_NoteFieldMode[m_PlayerNumber].BeginDrawTrack(c);
|
g_NoteFieldMode[pn].BeginDrawTrack(c);
|
||||||
|
|
||||||
m_HoldJudgment[c].Draw();
|
m_HoldJudgment[c].Draw();
|
||||||
|
|
||||||
g_NoteFieldMode[m_PlayerNumber].EndDrawTrack(c);
|
g_NoteFieldMode[pn].EndDrawTrack(c);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -648,7 +670,10 @@ int PlayerMinus::GetClosestNote( int col, float fBeat, float fMaxBeatsAhead, flo
|
|||||||
|
|
||||||
void PlayerMinus::Step( int col, RageTimer tm )
|
void PlayerMinus::Step( int col, RageTimer tm )
|
||||||
{
|
{
|
||||||
if( GAMESTATE->m_SongOptions.m_LifeType == SongOptions::LIFE_BATTERY && g_CurStageStats.bFailed[m_PlayerNumber] ) // Oni dead
|
// TODO: Remove use of PlayerNumber.
|
||||||
|
PlayerNumber pn = m_pPlayerState->m_PlayerNumber;
|
||||||
|
|
||||||
|
if( GAMESTATE->m_SongOptions.m_LifeType == SongOptions::LIFE_BATTERY && g_CurStageStats.bFailed[pn] ) // Oni dead
|
||||||
return; // do nothing
|
return; // do nothing
|
||||||
|
|
||||||
//LOG->Trace( "PlayerMinus::HandlePlayerStep()" );
|
//LOG->Trace( "PlayerMinus::HandlePlayerStep()" );
|
||||||
@@ -699,7 +724,7 @@ void PlayerMinus::Step( int col, RageTimer tm )
|
|||||||
|
|
||||||
TapNote tn = m_NoteData.GetTapNote( col, iIndexOverlappingNote );
|
TapNote tn = m_NoteData.GetTapNote( col, iIndexOverlappingNote );
|
||||||
|
|
||||||
switch( GAMESTATE->m_PlayerController[m_PlayerNumber] )
|
switch( m_pPlayerState->m_PlayerController )
|
||||||
{
|
{
|
||||||
case PC_HUMAN:
|
case PC_HUMAN:
|
||||||
|
|
||||||
@@ -714,8 +739,12 @@ void PlayerMinus::Step( int col, RageTimer tm )
|
|||||||
|
|
||||||
if( m_pLifeMeter )
|
if( m_pLifeMeter )
|
||||||
m_pLifeMeter->ChangeLifeMine();
|
m_pLifeMeter->ChangeLifeMine();
|
||||||
|
|
||||||
|
// TODO: Remove use of PlayerNumber.
|
||||||
|
PlayerNumber pn = m_pPlayerState->m_PlayerNumber;
|
||||||
|
|
||||||
if( m_pCombinedLifeMeter )
|
if( m_pCombinedLifeMeter )
|
||||||
m_pCombinedLifeMeter->ChangeLifeMine(m_PlayerNumber);
|
m_pCombinedLifeMeter->ChangeLifeMine( pn );
|
||||||
m_pNoteField->SetTapNote(col, iIndexOverlappingNote, TAP_EMPTY); // remove from NoteField
|
m_pNoteField->SetTapNote(col, iIndexOverlappingNote, TAP_EMPTY); // remove from NoteField
|
||||||
m_pNoteField->DidTapNote( col, score, false );
|
m_pNoteField->DidTapNote( col, score, false );
|
||||||
}
|
}
|
||||||
@@ -736,7 +765,11 @@ void PlayerMinus::Step( int col, RageTimer tm )
|
|||||||
true,
|
true,
|
||||||
false
|
false
|
||||||
);
|
);
|
||||||
GAMESTATE->LaunchAttack( OPPOSITE_PLAYER[m_PlayerNumber], attack );
|
|
||||||
|
// TODO: Remove use of PlayerNumber
|
||||||
|
PlayerNumber pn = m_pPlayerState->m_PlayerNumber;
|
||||||
|
|
||||||
|
GAMESTATE->LaunchAttack( OPPOSITE_PLAYER[pn], attack );
|
||||||
|
|
||||||
// remove all TapAttacks on this row
|
// remove all TapAttacks on this row
|
||||||
for( int t=0; t<m_NoteData.GetNumTracks(); t++ )
|
for( int t=0; t<m_NoteData.GetNumTracks(); t++ )
|
||||||
@@ -763,10 +796,10 @@ void PlayerMinus::Step( int col, RageTimer tm )
|
|||||||
|
|
||||||
case PC_CPU:
|
case PC_CPU:
|
||||||
case PC_AUTOPLAY:
|
case PC_AUTOPLAY:
|
||||||
switch( GAMESTATE->m_PlayerController[m_PlayerNumber] )
|
switch( m_pPlayerState->m_PlayerController )
|
||||||
{
|
{
|
||||||
case PC_CPU:
|
case PC_CPU:
|
||||||
score = PlayerAI::GetTapNoteScore( m_PlayerNumber );
|
score = PlayerAI::GetTapNoteScore( m_pPlayerState );
|
||||||
break;
|
break;
|
||||||
case PC_AUTOPLAY:
|
case PC_AUTOPLAY:
|
||||||
score = TNS_MARVELOUS;
|
score = TNS_MARVELOUS;
|
||||||
@@ -801,8 +834,12 @@ void PlayerMinus::Step( int col, RageTimer tm )
|
|||||||
m_soundMine.Play();
|
m_soundMine.Play();
|
||||||
if( m_pLifeMeter )
|
if( m_pLifeMeter )
|
||||||
m_pLifeMeter->ChangeLifeMine();
|
m_pLifeMeter->ChangeLifeMine();
|
||||||
|
|
||||||
|
// Remove use of PlayerNumber.
|
||||||
|
PlayerNumber pn = m_pPlayerState->m_PlayerNumber;
|
||||||
|
|
||||||
if( m_pCombinedLifeMeter )
|
if( m_pCombinedLifeMeter )
|
||||||
m_pCombinedLifeMeter->ChangeLifeMine(m_PlayerNumber);
|
m_pCombinedLifeMeter->ChangeLifeMine( pn );
|
||||||
m_pNoteField->SetTapNote(col, iIndexOverlappingNote, TAP_EMPTY); // remove from NoteField
|
m_pNoteField->SetTapNote(col, iIndexOverlappingNote, TAP_EMPTY); // remove from NoteField
|
||||||
m_pNoteField->DidTapNote( col, score, false );
|
m_pNoteField->DidTapNote( col, score, false );
|
||||||
}
|
}
|
||||||
@@ -830,7 +867,11 @@ void PlayerMinus::Step( int col, RageTimer tm )
|
|||||||
true,
|
true,
|
||||||
false
|
false
|
||||||
);
|
);
|
||||||
GAMESTATE->LaunchAttack( OPPOSITE_PLAYER[m_PlayerNumber], attack );
|
|
||||||
|
// TODO: Remove use of PlayerNumber.
|
||||||
|
PlayerNumber pn = m_pPlayerState->m_PlayerNumber;
|
||||||
|
|
||||||
|
GAMESTATE->LaunchAttack( OPPOSITE_PLAYER[pn], attack );
|
||||||
|
|
||||||
// remove all TapAttacks on this row
|
// remove all TapAttacks on this row
|
||||||
for( int t=0; t<m_NoteData.GetNumTracks(); t++ )
|
for( int t=0; t<m_NoteData.GetNumTracks(); t++ )
|
||||||
@@ -868,8 +909,11 @@ void PlayerMinus::Step( int col, RageTimer tm )
|
|||||||
int ms_error = (int) roundf( fSecondsFromPerfect * 1000 );
|
int ms_error = (int) roundf( fSecondsFromPerfect * 1000 );
|
||||||
ms_error = min( ms_error, MAX_PRO_TIMING_ERROR );
|
ms_error = min( ms_error, MAX_PRO_TIMING_ERROR );
|
||||||
|
|
||||||
g_CurStageStats.iTotalError[m_PlayerNumber] += ms_error;
|
// TODO: Remove use of PlayerNumber.
|
||||||
if (!GAMESTATE->m_PlayerOptions[m_PlayerNumber].m_fBlind)
|
PlayerNumber pn = m_pPlayerState->m_PlayerNumber;
|
||||||
|
|
||||||
|
g_CurStageStats.iTotalError[pn] += ms_error;
|
||||||
|
if (!m_pPlayerState->m_PlayerOptions.m_fBlind)
|
||||||
m_ProTimingDisplay.SetJudgment( ms_error, score );
|
m_ProTimingDisplay.SetJudgment( ms_error, score );
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -885,12 +929,15 @@ void PlayerMinus::Step( int col, RageTimer tm )
|
|||||||
if( score != TNS_NONE )
|
if( score != TNS_NONE )
|
||||||
m_NoteData.SetTapNoteOffset(col, iIndexOverlappingNote, -fNoteOffset);
|
m_NoteData.SetTapNoteOffset(col, iIndexOverlappingNote, -fNoteOffset);
|
||||||
|
|
||||||
if( GAMESTATE->m_PlayerController[m_PlayerNumber] == PC_HUMAN &&
|
if( m_pPlayerState->m_PlayerController == PC_HUMAN &&
|
||||||
score >= TNS_GREAT )
|
score >= TNS_GREAT )
|
||||||
HandleAutosync(fNoteOffset);
|
HandleAutosync(fNoteOffset);
|
||||||
|
|
||||||
|
// TODO: Remove use of PlayerNumber.
|
||||||
|
PlayerNumber pn = m_pPlayerState->m_PlayerNumber;
|
||||||
|
|
||||||
//Keep this here so we get the same data as Autosync
|
//Keep this here so we get the same data as Autosync
|
||||||
NSMAN->ReportTiming(fNoteOffset,m_PlayerNumber);
|
NSMAN->ReportTiming(fNoteOffset,pn);
|
||||||
|
|
||||||
if( m_pPrimaryScoreKeeper )
|
if( m_pPrimaryScoreKeeper )
|
||||||
m_pPrimaryScoreKeeper->HandleTapScore( score );
|
m_pPrimaryScoreKeeper->HandleTapScore( score );
|
||||||
@@ -998,15 +1045,18 @@ void PlayerMinus::OnRowCompletelyJudged( int iIndexThatWasSteppedOn )
|
|||||||
|
|
||||||
// If the score is great or better, remove the note from the screen to
|
// If the score is great or better, remove the note from the screen to
|
||||||
// indicate success. (Or always if blind is on.)
|
// indicate success. (Or always if blind is on.)
|
||||||
if( score >= TNS_GREAT || GAMESTATE->m_PlayerOptions[m_PlayerNumber].m_fBlind )
|
if( score >= TNS_GREAT || m_pPlayerState->m_PlayerOptions.m_fBlind )
|
||||||
m_pNoteField->SetTapNote(c, iIndexThatWasSteppedOn, TAP_EMPTY);
|
m_pNoteField->SetTapNote(c, iIndexThatWasSteppedOn, TAP_EMPTY);
|
||||||
|
|
||||||
// show the ghost arrow for this column
|
// show the ghost arrow for this column
|
||||||
if (GAMESTATE->m_PlayerOptions[m_PlayerNumber].m_fBlind)
|
if (m_pPlayerState->m_PlayerOptions.m_fBlind)
|
||||||
m_pNoteField->DidTapNote( c, TNS_MARVELOUS, false );
|
m_pNoteField->DidTapNote( c, TNS_MARVELOUS, false );
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
bool bBright = g_CurStageStats.iCurCombo[m_PlayerNumber]>(int)BRIGHT_GHOST_COMBO_THRESHOLD;
|
// TODO: Remove use of PlayerNumber.
|
||||||
|
PlayerNumber pn = m_pPlayerState->m_PlayerNumber;
|
||||||
|
|
||||||
|
bool bBright = g_CurStageStats.iCurCombo[pn]>(int)BRIGHT_GHOST_COMBO_THRESHOLD;
|
||||||
m_pNoteField->DidTapNote( c, score, bBright );
|
m_pNoteField->DidTapNote( c, score, bBright );
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -1064,7 +1114,11 @@ void PlayerMinus::UpdateTapNotesMissedOlderThan( float fMissIfOlderThanSeconds )
|
|||||||
// A normal note. Penalize for not stepping on it.
|
// A normal note. Penalize for not stepping on it.
|
||||||
MissedNoteOnThisRow = true;
|
MissedNoteOnThisRow = true;
|
||||||
m_NoteData.SetTapNoteScore( t, r, TNS_MISS );
|
m_NoteData.SetTapNoteScore( t, r, TNS_MISS );
|
||||||
g_CurStageStats.iTotalError[m_PlayerNumber] += MAX_PRO_TIMING_ERROR;
|
|
||||||
|
// TODO: Remove use of PlayerNumber.
|
||||||
|
PlayerNumber pn = m_pPlayerState->m_PlayerNumber;
|
||||||
|
|
||||||
|
g_CurStageStats.iTotalError[pn] += MAX_PRO_TIMING_ERROR;
|
||||||
m_ProTimingDisplay.SetJudgment( MAX_PRO_TIMING_ERROR, TNS_MISS );
|
m_ProTimingDisplay.SetJudgment( MAX_PRO_TIMING_ERROR, TNS_MISS );
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -1084,12 +1138,12 @@ void PlayerMinus::UpdateTapNotesMissedOlderThan( float fMissIfOlderThanSeconds )
|
|||||||
void PlayerMinus::CrossedRow( int iNoteRow )
|
void PlayerMinus::CrossedRow( int iNoteRow )
|
||||||
{
|
{
|
||||||
// If we're doing random vanish, randomise notes on the fly.
|
// If we're doing random vanish, randomise notes on the fly.
|
||||||
if(GAMESTATE->m_CurrentPlayerOptions[m_PlayerNumber].m_fAppearances[PlayerOptions::APPEARANCE_RANDOMVANISH]==1)
|
if(m_pPlayerState->m_CurrentPlayerOptions.m_fAppearances[PlayerOptions::APPEARANCE_RANDOMVANISH]==1)
|
||||||
RandomizeNotes( iNoteRow );
|
RandomizeNotes( iNoteRow );
|
||||||
|
|
||||||
// check to see if there's a note at the crossed row
|
// check to see if there's a note at the crossed row
|
||||||
RageTimer now;
|
RageTimer now;
|
||||||
if( GAMESTATE->m_PlayerController[m_PlayerNumber] != PC_HUMAN )
|
if( m_pPlayerState->m_PlayerController != PC_HUMAN )
|
||||||
{
|
{
|
||||||
for( int t=0; t<m_NoteData.GetNumTracks(); t++ )
|
for( int t=0; t<m_NoteData.GetNumTracks(); t++ )
|
||||||
{
|
{
|
||||||
@@ -1108,7 +1162,10 @@ void PlayerMinus::CrossedMineRow( int iNoteRow )
|
|||||||
{
|
{
|
||||||
if( m_NoteData.GetTapNote(t,iNoteRow).type == TapNote::mine )
|
if( m_NoteData.GetTapNote(t,iNoteRow).type == TapNote::mine )
|
||||||
{
|
{
|
||||||
const StyleInput StyleI( m_PlayerNumber, t );
|
// TODO: Remove use of PlayerNumber.
|
||||||
|
PlayerNumber pn = m_pPlayerState->m_PlayerNumber;
|
||||||
|
|
||||||
|
const StyleInput StyleI( pn, t );
|
||||||
const GameInput GameI = GAMESTATE->GetCurrentStyle()->StyleInputToGameInput( StyleI );
|
const GameInput GameI = GAMESTATE->GetCurrentStyle()->StyleInputToGameInput( StyleI );
|
||||||
if( PREFSMAN->m_fPadStickSeconds > 0 )
|
if( PREFSMAN->m_fPadStickSeconds > 0 )
|
||||||
{
|
{
|
||||||
@@ -1132,7 +1189,7 @@ void PlayerMinus::RandomizeNotes( int iNoteRow )
|
|||||||
/* This is incorrect: if m_fScrollSpeed is 0.5, we'll never change
|
/* This is incorrect: if m_fScrollSpeed is 0.5, we'll never change
|
||||||
* any odd rows, and if it's 2, we'll shuffle each row twice. */
|
* any odd rows, and if it's 2, we'll shuffle each row twice. */
|
||||||
int iNewNoteRow = iNoteRow + ROWS_PER_BEAT*2;
|
int iNewNoteRow = iNoteRow + ROWS_PER_BEAT*2;
|
||||||
iNewNoteRow = int( iNewNoteRow / GAMESTATE->m_PlayerOptions[m_PlayerNumber].m_fScrollSpeed );
|
iNewNoteRow = int( iNewNoteRow / m_pPlayerState->m_PlayerOptions.m_fScrollSpeed );
|
||||||
|
|
||||||
int iNumOfTracks = m_NoteData.GetNumTracks();
|
int iNumOfTracks = m_NoteData.GetNumTracks();
|
||||||
for( int t=0; t+1 < iNumOfTracks; t++ )
|
for( int t=0; t+1 < iNumOfTracks; t++ )
|
||||||
@@ -1183,22 +1240,25 @@ void PlayerMinus::HandleTapRowScore( unsigned row )
|
|||||||
if(GAMESTATE->m_bDemonstrationOrJukebox)
|
if(GAMESTATE->m_bDemonstrationOrJukebox)
|
||||||
NoCheating = false;
|
NoCheating = false;
|
||||||
// don't accumulate points if AutoPlay is on.
|
// don't accumulate points if AutoPlay is on.
|
||||||
if( NoCheating && GAMESTATE->m_PlayerController[m_PlayerNumber] == PC_AUTOPLAY )
|
if( NoCheating && m_pPlayerState->m_PlayerController == PC_AUTOPLAY )
|
||||||
return;
|
return;
|
||||||
|
|
||||||
|
// TODO: Remove use of PlayerNumber.
|
||||||
|
PlayerNumber pn = m_pPlayerState->m_PlayerNumber;
|
||||||
|
|
||||||
/* Update miss combo, and handle "combo stopped" messages. */
|
/* Update miss combo, and handle "combo stopped" messages. */
|
||||||
int &iCurCombo = g_CurStageStats.iCurCombo[m_PlayerNumber];
|
int &iCurCombo = g_CurStageStats.iCurCombo[pn];
|
||||||
switch( scoreOfLastTap )
|
switch( scoreOfLastTap )
|
||||||
{
|
{
|
||||||
case TNS_MARVELOUS:
|
case TNS_MARVELOUS:
|
||||||
case TNS_PERFECT:
|
case TNS_PERFECT:
|
||||||
case TNS_GREAT:
|
case TNS_GREAT:
|
||||||
g_CurStageStats.iCurMissCombo[m_PlayerNumber] = 0;
|
g_CurStageStats.iCurMissCombo[pn] = 0;
|
||||||
SCREENMAN->PostMessageToTopScreen( SM_MissComboAborted, 0 );
|
SCREENMAN->PostMessageToTopScreen( SM_MissComboAborted, 0 );
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case TNS_MISS:
|
case TNS_MISS:
|
||||||
++g_CurStageStats.iCurMissCombo[m_PlayerNumber];
|
++g_CurStageStats.iCurMissCombo[pn];
|
||||||
m_iDCState = AS2D_MISS; // update dancing 2d characters that may have missed a note
|
m_iDCState = AS2D_MISS; // update dancing 2d characters that may have missed a note
|
||||||
case TNS_GOOD:
|
case TNS_GOOD:
|
||||||
case TNS_BOO:
|
case TNS_BOO:
|
||||||
@@ -1212,14 +1272,14 @@ void PlayerMinus::HandleTapRowScore( unsigned row )
|
|||||||
}
|
}
|
||||||
|
|
||||||
/* The score keeper updates the hit combo. Remember the old combo for handling announcers. */
|
/* The score keeper updates the hit combo. Remember the old combo for handling announcers. */
|
||||||
const int iOldCombo = g_CurStageStats.iCurCombo[m_PlayerNumber];
|
const int iOldCombo = g_CurStageStats.iCurCombo[pn];
|
||||||
|
|
||||||
if(m_pPrimaryScoreKeeper)
|
if(m_pPrimaryScoreKeeper)
|
||||||
m_pPrimaryScoreKeeper->HandleTapRowScore(scoreOfLastTap, iNumTapsInRow );
|
m_pPrimaryScoreKeeper->HandleTapRowScore(scoreOfLastTap, iNumTapsInRow );
|
||||||
if(m_pSecondaryScoreKeeper)
|
if(m_pSecondaryScoreKeeper)
|
||||||
m_pSecondaryScoreKeeper->HandleTapRowScore(scoreOfLastTap, iNumTapsInRow );
|
m_pSecondaryScoreKeeper->HandleTapRowScore(scoreOfLastTap, iNumTapsInRow );
|
||||||
|
|
||||||
m_Combo.SetCombo( g_CurStageStats.iCurCombo[m_PlayerNumber], g_CurStageStats.iCurMissCombo[m_PlayerNumber] );
|
m_Combo.SetCombo( g_CurStageStats.iCurCombo[pn], g_CurStageStats.iCurMissCombo[pn] );
|
||||||
|
|
||||||
#define CROSSED( x ) (iOldCombo<x && iCurCombo>=x)
|
#define CROSSED( x ) (iOldCombo<x && iCurCombo>=x)
|
||||||
if ( CROSSED(100) )
|
if ( CROSSED(100) )
|
||||||
@@ -1247,12 +1307,12 @@ void PlayerMinus::HandleTapRowScore( unsigned row )
|
|||||||
#undef CROSSED
|
#undef CROSSED
|
||||||
|
|
||||||
// new max combo
|
// new max combo
|
||||||
g_CurStageStats.iMaxCombo[m_PlayerNumber] = max(g_CurStageStats.iMaxCombo[m_PlayerNumber], iCurCombo);
|
g_CurStageStats.iMaxCombo[pn] = max(g_CurStageStats.iMaxCombo[pn], iCurCombo);
|
||||||
|
|
||||||
/* Use the real current beat, not the beat we've been passed. That's because we
|
/* Use the real current beat, not the beat we've been passed. That's because we
|
||||||
* want to record the current life/combo to the current time; eg. if it's a MISS,
|
* want to record the current life/combo to the current time; eg. if it's a MISS,
|
||||||
* the beat we're registering is in the past, but the life is changing now. */
|
* the beat we're registering is in the past, but the life is changing now. */
|
||||||
g_CurStageStats.UpdateComboList( m_PlayerNumber, g_CurStageStats.fAliveSeconds[m_PlayerNumber], false );
|
g_CurStageStats.UpdateComboList( pn, g_CurStageStats.fAliveSeconds[pn], false );
|
||||||
|
|
||||||
float life = -1;
|
float life = -1;
|
||||||
if( m_pLifeMeter )
|
if( m_pLifeMeter )
|
||||||
@@ -1260,24 +1320,24 @@ void PlayerMinus::HandleTapRowScore( unsigned row )
|
|||||||
else if( m_pCombinedLifeMeter )
|
else if( m_pCombinedLifeMeter )
|
||||||
{
|
{
|
||||||
life = GAMESTATE->m_fTugLifePercentP1;
|
life = GAMESTATE->m_fTugLifePercentP1;
|
||||||
if( m_PlayerNumber == PLAYER_2 )
|
if( pn == PLAYER_2 )
|
||||||
life = 1.0f - life;
|
life = 1.0f - life;
|
||||||
}
|
}
|
||||||
if( life != -1 )
|
if( life != -1 )
|
||||||
g_CurStageStats.SetLifeRecordAt( m_PlayerNumber, life, g_CurStageStats.fAliveSeconds[m_PlayerNumber] );
|
g_CurStageStats.SetLifeRecordAt( pn, life, g_CurStageStats.fAliveSeconds[pn] );
|
||||||
|
|
||||||
if (m_pScoreDisplay)
|
if (m_pScoreDisplay)
|
||||||
m_pScoreDisplay->SetScore(g_CurStageStats.iScore[m_PlayerNumber]);
|
m_pScoreDisplay->SetScore(g_CurStageStats.iScore[pn]);
|
||||||
if (m_pSecondaryScoreDisplay)
|
if (m_pSecondaryScoreDisplay)
|
||||||
m_pSecondaryScoreDisplay->SetScore(g_CurStageStats.iScore[m_PlayerNumber]);
|
m_pSecondaryScoreDisplay->SetScore(g_CurStageStats.iScore[pn]);
|
||||||
|
|
||||||
if( m_pLifeMeter ) {
|
if( m_pLifeMeter ) {
|
||||||
m_pLifeMeter->ChangeLife( scoreOfLastTap );
|
m_pLifeMeter->ChangeLife( scoreOfLastTap );
|
||||||
m_pLifeMeter->OnDancePointsChange(); // update oni life meter
|
m_pLifeMeter->OnDancePointsChange(); // update oni life meter
|
||||||
}
|
}
|
||||||
if( m_pCombinedLifeMeter ) {
|
if( m_pCombinedLifeMeter ) {
|
||||||
m_pCombinedLifeMeter->ChangeLife( m_PlayerNumber, scoreOfLastTap );
|
m_pCombinedLifeMeter->ChangeLife( pn, scoreOfLastTap );
|
||||||
m_pCombinedLifeMeter->OnDancePointsChange( m_PlayerNumber ); // update oni life meter
|
m_pCombinedLifeMeter->OnDancePointsChange( pn ); // update oni life meter
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -1292,7 +1352,7 @@ void PlayerMinus::HandleHoldScore( HoldNoteScore holdScore, TapNoteScore tapScor
|
|||||||
if(GAMESTATE->m_bDemonstrationOrJukebox)
|
if(GAMESTATE->m_bDemonstrationOrJukebox)
|
||||||
NoCheating = false;
|
NoCheating = false;
|
||||||
// don't accumulate points if AutoPlay is on.
|
// don't accumulate points if AutoPlay is on.
|
||||||
if( NoCheating && GAMESTATE->m_PlayerController[m_PlayerNumber] == PC_AUTOPLAY )
|
if( NoCheating && m_pPlayerState->m_PlayerController == PC_AUTOPLAY )
|
||||||
return;
|
return;
|
||||||
|
|
||||||
if(m_pPrimaryScoreKeeper)
|
if(m_pPrimaryScoreKeeper)
|
||||||
@@ -1300,18 +1360,23 @@ void PlayerMinus::HandleHoldScore( HoldNoteScore holdScore, TapNoteScore tapScor
|
|||||||
if(m_pSecondaryScoreKeeper)
|
if(m_pSecondaryScoreKeeper)
|
||||||
m_pSecondaryScoreKeeper->HandleHoldScore(holdScore, tapScore );
|
m_pSecondaryScoreKeeper->HandleHoldScore(holdScore, tapScore );
|
||||||
|
|
||||||
if (m_pScoreDisplay)
|
// TODO: Remove use of PlayerNumber.
|
||||||
m_pScoreDisplay->SetScore(g_CurStageStats.iScore[m_PlayerNumber]);
|
PlayerNumber pn = m_pPlayerState->m_PlayerNumber;
|
||||||
if (m_pSecondaryScoreDisplay)
|
|
||||||
m_pSecondaryScoreDisplay->SetScore(g_CurStageStats.iScore[m_PlayerNumber]);
|
|
||||||
|
|
||||||
if( m_pLifeMeter ) {
|
if (m_pScoreDisplay)
|
||||||
|
m_pScoreDisplay->SetScore(g_CurStageStats.iScore[pn]);
|
||||||
|
if (m_pSecondaryScoreDisplay)
|
||||||
|
m_pSecondaryScoreDisplay->SetScore(g_CurStageStats.iScore[pn]);
|
||||||
|
|
||||||
|
if( m_pLifeMeter )
|
||||||
|
{
|
||||||
m_pLifeMeter->ChangeLife( holdScore, tapScore );
|
m_pLifeMeter->ChangeLife( holdScore, tapScore );
|
||||||
m_pLifeMeter->OnDancePointsChange();
|
m_pLifeMeter->OnDancePointsChange();
|
||||||
}
|
}
|
||||||
if( m_pCombinedLifeMeter ) {
|
if( m_pCombinedLifeMeter )
|
||||||
m_pCombinedLifeMeter->ChangeLife( m_PlayerNumber, holdScore, tapScore );
|
{
|
||||||
m_pCombinedLifeMeter->OnDancePointsChange( m_PlayerNumber );
|
m_pCombinedLifeMeter->ChangeLife( pn, holdScore, tapScore );
|
||||||
|
m_pCombinedLifeMeter->OnDancePointsChange( pn );
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -1328,7 +1393,7 @@ void PlayerMinus::FadeToFail()
|
|||||||
/* XXX: Why's m_NoteField in a separate class, again? Is that still needed? */
|
/* XXX: Why's m_NoteField in a separate class, again? Is that still needed? */
|
||||||
/* It was used to have an invisible computer player in PLAY_MODE_BATTLE. -Chris */
|
/* It was used to have an invisible computer player in PLAY_MODE_BATTLE. -Chris */
|
||||||
void Player::Load(
|
void Player::Load(
|
||||||
PlayerNumber player_no,
|
PlayerState* pPlayerState,
|
||||||
const NoteData& noteData,
|
const NoteData& noteData,
|
||||||
LifeMeter* pLM,
|
LifeMeter* pLM,
|
||||||
CombinedLifeMeter* pCombinedLM,
|
CombinedLifeMeter* pCombinedLM,
|
||||||
@@ -1339,7 +1404,7 @@ void Player::Load(
|
|||||||
ScoreKeeper* pSecondaryScoreKeeper )
|
ScoreKeeper* pSecondaryScoreKeeper )
|
||||||
{
|
{
|
||||||
PlayerMinus::Load(
|
PlayerMinus::Load(
|
||||||
player_no,
|
pPlayerState,
|
||||||
noteData,
|
noteData,
|
||||||
pLM,
|
pLM,
|
||||||
pCombinedLM,
|
pCombinedLM,
|
||||||
|
|||||||
@@ -39,7 +39,7 @@ public:
|
|||||||
virtual void DrawPrimitives();
|
virtual void DrawPrimitives();
|
||||||
|
|
||||||
void Load(
|
void Load(
|
||||||
PlayerNumber player_no,
|
PlayerState* pPlayerState,
|
||||||
const NoteData& noteData,
|
const NoteData& noteData,
|
||||||
LifeMeter* pLM,
|
LifeMeter* pLM,
|
||||||
CombinedLifeMeter* pCombinedLM,
|
CombinedLifeMeter* pCombinedLM,
|
||||||
@@ -74,7 +74,7 @@ protected:
|
|||||||
int GetClosestNoteDirectional( int col, int iStartRow, int iMaxRowsAhead, bool bAllowGraded, bool bForward ) const;
|
int GetClosestNoteDirectional( int col, int iStartRow, int iMaxRowsAhead, bool bAllowGraded, bool bForward ) const;
|
||||||
int GetClosestNote( int col, float fBeat, float fMaxBeatsAhead, float fMaxBeatsBehind, bool bAllowGraded ) const;
|
int GetClosestNote( int col, float fBeat, float fMaxBeatsAhead, float fMaxBeatsBehind, bool bAllowGraded ) const;
|
||||||
|
|
||||||
PlayerNumber m_PlayerNumber;
|
PlayerState* m_pPlayerState;
|
||||||
float m_fNoteFieldHeight;
|
float m_fNoteFieldHeight;
|
||||||
|
|
||||||
float m_fOffset[SAMPLE_COUNT]; // for AutoSync
|
float m_fOffset[SAMPLE_COUNT]; // for AutoSync
|
||||||
@@ -115,7 +115,7 @@ class Player : public PlayerMinus
|
|||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
void Load(
|
void Load(
|
||||||
PlayerNumber player_no,
|
PlayerState* pPlayerState,
|
||||||
const NoteData& noteData,
|
const NoteData& noteData,
|
||||||
LifeMeter* pLM,
|
LifeMeter* pLM,
|
||||||
CombinedLifeMeter* pCombinedLM,
|
CombinedLifeMeter* pCombinedLM,
|
||||||
|
|||||||
@@ -5,6 +5,7 @@
|
|||||||
#include "RageException.h"
|
#include "RageException.h"
|
||||||
#include "GameState.h"
|
#include "GameState.h"
|
||||||
#include "arch/arch.h"
|
#include "arch/arch.h"
|
||||||
|
#include "PlayerState.h"
|
||||||
|
|
||||||
#define AI_PATH "Data/AI.ini"
|
#define AI_PATH "Data/AI.ini"
|
||||||
|
|
||||||
@@ -60,17 +61,16 @@ void PlayerAI::InitFromDisk()
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
TapNoteScore PlayerAI::GetTapNoteScore( PlayerNumber pn )
|
TapNoteScore PlayerAI::GetTapNoteScore( const PlayerState* pPlayerState )
|
||||||
{
|
{
|
||||||
|
int iCpuSkill = pPlayerState->m_iCpuSkill;
|
||||||
int iCpuSkill = GAMESTATE->m_iCpuSkill[pn];
|
|
||||||
int iSumOfAttackLevels =
|
int iSumOfAttackLevels =
|
||||||
GAMESTATE->m_fSecondsUntilAttacksPhasedOut[pn] > 0 ?
|
pPlayerState->m_fSecondsUntilAttacksPhasedOut > 0 ?
|
||||||
GAMESTATE->m_iLastPositiveSumOfAttackLevels[pn] :
|
pPlayerState->m_iLastPositiveSumOfAttackLevels :
|
||||||
0;
|
0;
|
||||||
|
|
||||||
ASSERT_M( iCpuSkill>=0 && iCpuSkill<NUM_SKILL_LEVELS, ssprintf("%i", iCpuSkill) );
|
ASSERT_M( iCpuSkill>=0 && iCpuSkill<NUM_SKILL_LEVELS, ssprintf("%i", iCpuSkill) );
|
||||||
ASSERT_M( GAMESTATE->m_PlayerController[pn] == PC_CPU, ssprintf("%i", GAMESTATE->m_PlayerController[pn]) );
|
ASSERT_M( pPlayerState->m_PlayerController == PC_CPU, ssprintf("%i", pPlayerState->m_PlayerController) );
|
||||||
|
|
||||||
iCpuSkill -= iSumOfAttackLevels*3;
|
iCpuSkill -= iSumOfAttackLevels*3;
|
||||||
CLAMP( iCpuSkill, 0, NUM_SKILL_LEVELS-1 );
|
CLAMP( iCpuSkill, 0, NUM_SKILL_LEVELS-1 );
|
||||||
|
|||||||
@@ -3,6 +3,8 @@
|
|||||||
|
|
||||||
#include "GameConstantsAndTypes.h"
|
#include "GameConstantsAndTypes.h"
|
||||||
|
|
||||||
|
struct PlayerState;
|
||||||
|
|
||||||
const int NUM_SKILL_LEVELS = 6; // 0-5
|
const int NUM_SKILL_LEVELS = 6; // 0-5
|
||||||
|
|
||||||
class PlayerAI
|
class PlayerAI
|
||||||
@@ -10,7 +12,7 @@ class PlayerAI
|
|||||||
public:
|
public:
|
||||||
|
|
||||||
static void InitFromDisk();
|
static void InitFromDisk();
|
||||||
static TapNoteScore GetTapNoteScore( PlayerNumber pn );
|
static TapNoteScore GetTapNoteScore( const PlayerState* pPlayerState );
|
||||||
|
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|||||||
@@ -484,7 +484,7 @@ void PlayerOptions::ToggleOneTurn( Turn t )
|
|||||||
m_bTurns[t] = !bWasOn;
|
m_bTurns[t] = !bWasOn;
|
||||||
}
|
}
|
||||||
|
|
||||||
float PlayerOptions::GetReversePercentForColumn( int iCol )
|
float PlayerOptions::GetReversePercentForColumn( int iCol ) const
|
||||||
{
|
{
|
||||||
float f = 0;
|
float f = 0;
|
||||||
int iNumCols = GAMESTATE->GetCurrentStyle()->m_iColsPerPlayer;
|
int iNumCols = GAMESTATE->GetCurrentStyle()->m_iColsPerPlayer;
|
||||||
|
|||||||
@@ -92,7 +92,7 @@ struct PlayerOptions
|
|||||||
SCROLL_CENTERED,
|
SCROLL_CENTERED,
|
||||||
NUM_SCROLLS
|
NUM_SCROLLS
|
||||||
};
|
};
|
||||||
float GetReversePercentForColumn( int iCol ); // accounts for all Directions
|
float GetReversePercentForColumn( int iCol ) const; // accounts for all Directions
|
||||||
|
|
||||||
/* All floats have a corresponding speed setting, which determines how fast
|
/* All floats have a corresponding speed setting, which determines how fast
|
||||||
* PlayerOptions::Approach approaches. */
|
* PlayerOptions::Approach approaches. */
|
||||||
|
|||||||
@@ -0,0 +1,28 @@
|
|||||||
|
#include "global.h"
|
||||||
|
#include "PlayerState.h"
|
||||||
|
|
||||||
|
|
||||||
|
/*
|
||||||
|
* (c) 2001-2004 Chris Danford, Chris Gomez
|
||||||
|
* All rights reserved.
|
||||||
|
*
|
||||||
|
* Permission is hereby granted, free of charge, to any person obtaining a
|
||||||
|
* copy of this software and associated documentation files (the
|
||||||
|
* "Software"), to deal in the Software without restriction, including
|
||||||
|
* without limitation the rights to use, copy, modify, merge, publish,
|
||||||
|
* distribute, and/or sell copies of the Software, and to permit persons to
|
||||||
|
* whom the Software is furnished to do so, provided that the above
|
||||||
|
* copyright notice(s) and this permission notice appear in all copies of
|
||||||
|
* the Software and that both the above copyright notice(s) and this
|
||||||
|
* permission notice appear in supporting documentation.
|
||||||
|
*
|
||||||
|
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
|
||||||
|
* OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
||||||
|
* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT OF
|
||||||
|
* THIRD PARTY RIGHTS. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR HOLDERS
|
||||||
|
* INCLUDED IN THIS NOTICE BE LIABLE FOR ANY CLAIM, OR ANY SPECIAL INDIRECT
|
||||||
|
* OR CONSEQUENTIAL DAMAGES, OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS
|
||||||
|
* OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR
|
||||||
|
* OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
|
||||||
|
* PERFORMANCE OF THIS SOFTWARE.
|
||||||
|
*/
|
||||||
@@ -0,0 +1,84 @@
|
|||||||
|
/* PlayerNumber */
|
||||||
|
|
||||||
|
#ifndef PlayerState_H
|
||||||
|
#define PlayerState_H
|
||||||
|
|
||||||
|
#include "PlayerNumber.h"
|
||||||
|
#include "PlayerOptions.h"
|
||||||
|
#include <map>
|
||||||
|
#include "Attack.h"
|
||||||
|
|
||||||
|
struct PlayerState
|
||||||
|
{
|
||||||
|
// TODO: Remove use of PlayerNumber. All data about the player should live
|
||||||
|
// in PlayerState and callers should not use PlayerNumber to index into
|
||||||
|
// GameState.
|
||||||
|
PlayerNumber m_PlayerNumber;
|
||||||
|
|
||||||
|
|
||||||
|
PlayerOptions m_CurrentPlayerOptions; // current approaches destination
|
||||||
|
PlayerOptions m_PlayerOptions; // change this, and current will move gradually toward it
|
||||||
|
PlayerOptions m_StoredPlayerOptions; // user's choices on the PlayerOptions screen
|
||||||
|
|
||||||
|
//
|
||||||
|
// Used in Gameplay
|
||||||
|
//
|
||||||
|
map<float,CString> m_BeatToNoteSkin;
|
||||||
|
mutable float m_fLastDrawnBeat; // Set by NoteField. Used to push NoteSkin-changing modifers back so that the NoteSkin doesn't pop.
|
||||||
|
|
||||||
|
enum HealthState { HOT, ALIVE, DANGER, DEAD };
|
||||||
|
HealthState m_HealthState;
|
||||||
|
|
||||||
|
PlayerController m_PlayerController;
|
||||||
|
|
||||||
|
//
|
||||||
|
// Used in Battle and Rave
|
||||||
|
//
|
||||||
|
int m_iCpuSkill; // only used when m_PlayerController is PC_CPU
|
||||||
|
// Attacks take a while to transition out of use. Account for this in PlayerAI
|
||||||
|
// by still penalizing it for 1 second after the player options are rebuilt.
|
||||||
|
int m_iLastPositiveSumOfAttackLevels;
|
||||||
|
float m_fSecondsUntilAttacksPhasedOut; // positive means PlayerAI is still affected
|
||||||
|
bool m_bAttackBeganThisUpdate; // flag for other objects to watch (play sounds)
|
||||||
|
bool m_bAttackEndedThisUpdate; // flag for other objects to watch (play sounds)
|
||||||
|
AttackArray m_ActiveAttacks;
|
||||||
|
vector<Attack> m_ModsToApply;
|
||||||
|
|
||||||
|
//
|
||||||
|
// Used in Rave
|
||||||
|
//
|
||||||
|
float m_fSuperMeter; // between 0 and NUM_ATTACK_LEVELS
|
||||||
|
float m_fSuperMeterGrowthScale;
|
||||||
|
|
||||||
|
//
|
||||||
|
// Used in Battle
|
||||||
|
//
|
||||||
|
Attack m_Inventory[NUM_INVENTORY_SLOTS];
|
||||||
|
};
|
||||||
|
|
||||||
|
#endif
|
||||||
|
|
||||||
|
/*
|
||||||
|
* (c) 2001-2004 Chris Danford, Chris Gomez
|
||||||
|
* All rights reserved.
|
||||||
|
*
|
||||||
|
* Permission is hereby granted, free of charge, to any person obtaining a
|
||||||
|
* copy of this software and associated documentation files (the
|
||||||
|
* "Software"), to deal in the Software without restriction, including
|
||||||
|
* without limitation the rights to use, copy, modify, merge, publish,
|
||||||
|
* distribute, and/or sell copies of the Software, and to permit persons to
|
||||||
|
* whom the Software is furnished to do so, provided that the above
|
||||||
|
* copyright notice(s) and this permission notice appear in all copies of
|
||||||
|
* the Software and that both the above copyright notice(s) and this
|
||||||
|
* permission notice appear in supporting documentation.
|
||||||
|
*
|
||||||
|
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
|
||||||
|
* OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
||||||
|
* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT OF
|
||||||
|
* THIRD PARTY RIGHTS. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR HOLDERS
|
||||||
|
* INCLUDED IN THIS NOTICE BE LIABLE FOR ANY CLAIM, OR ANY SPECIAL INDIRECT
|
||||||
|
* OR CONSEQUENTIAL DAMAGES, OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS
|
||||||
|
* OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR
|
||||||
|
* OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
|
||||||
|
* PERFORMANCE OF THIS SOFTWARE.
|
||||||
|
*/
|
||||||
@@ -8,6 +8,7 @@
|
|||||||
#include "RageLog.h"
|
#include "RageLog.h"
|
||||||
#include "RageUtil.h"
|
#include "RageUtil.h"
|
||||||
#include "Game.h"
|
#include "Game.h"
|
||||||
|
#include "PlayerState.h"
|
||||||
|
|
||||||
|
|
||||||
ReceptorArrow::ReceptorArrow()
|
ReceptorArrow::ReceptorArrow()
|
||||||
@@ -16,11 +17,14 @@ ReceptorArrow::ReceptorArrow()
|
|||||||
StopAnimating();
|
StopAnimating();
|
||||||
}
|
}
|
||||||
|
|
||||||
bool ReceptorArrow::Load( CString NoteSkin, PlayerNumber pn, int iColNo )
|
bool ReceptorArrow::Load( CString NoteSkin, const PlayerState* pPlayerState, int iColNo )
|
||||||
{
|
{
|
||||||
m_PlayerNumber = pn;
|
m_pPlayerState = pPlayerState;
|
||||||
m_iColNo = iColNo;
|
m_iColNo = iColNo;
|
||||||
|
|
||||||
|
// TODO: Remove use of PlayerNumber.
|
||||||
|
PlayerNumber pn = m_pPlayerState->m_PlayerNumber;
|
||||||
|
|
||||||
NoteFieldMode &mode = g_NoteFieldMode[pn];
|
NoteFieldMode &mode = g_NoteFieldMode[pn];
|
||||||
CString sButton = mode.GrayButtonNames[iColNo];
|
CString sButton = mode.GrayButtonNames[iColNo];
|
||||||
if( sButton == "" )
|
if( sButton == "" )
|
||||||
@@ -55,7 +59,7 @@ void ReceptorArrow::Update( float fDeltaTime )
|
|||||||
ActorFrame::Update( fDeltaTime );
|
ActorFrame::Update( fDeltaTime );
|
||||||
|
|
||||||
// update pressblock alignment based on scroll direction
|
// update pressblock alignment based on scroll direction
|
||||||
bool bReverse = GAMESTATE->m_PlayerOptions[m_PlayerNumber].GetReversePercentForColumn(m_iColNo) > 0.5;
|
bool bReverse = m_pPlayerState->m_PlayerOptions.GetReversePercentForColumn(m_iColNo) > 0.5;
|
||||||
m_pPressBlock->SetVertAlign( bReverse ? Actor::align_bottom : Actor::align_top );
|
m_pPressBlock->SetVertAlign( bReverse ? Actor::align_bottom : Actor::align_top );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -8,11 +8,13 @@
|
|||||||
#include "PlayerNumber.h"
|
#include "PlayerNumber.h"
|
||||||
#include "GameConstantsAndTypes.h"
|
#include "GameConstantsAndTypes.h"
|
||||||
|
|
||||||
|
struct PlayerState;
|
||||||
|
|
||||||
class ReceptorArrow : public ActorFrame
|
class ReceptorArrow : public ActorFrame
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
ReceptorArrow();
|
ReceptorArrow();
|
||||||
bool Load( CString NoteSkin, PlayerNumber pn, int iColNo );
|
bool Load( CString NoteSkin, const PlayerState* pPlayerState, int iColNo );
|
||||||
|
|
||||||
virtual void DrawPrimitives();
|
virtual void DrawPrimitives();
|
||||||
virtual void Update( float fDeltaTime );
|
virtual void Update( float fDeltaTime );
|
||||||
@@ -20,7 +22,7 @@ public:
|
|||||||
void SetPressed() { m_bIsPressed = true; };
|
void SetPressed() { m_bIsPressed = true; };
|
||||||
private:
|
private:
|
||||||
|
|
||||||
PlayerNumber m_PlayerNumber;
|
const PlayerState* m_pPlayerState;
|
||||||
int m_iColNo;
|
int m_iColNo;
|
||||||
|
|
||||||
AutoActor m_pReceptorWaiting;
|
AutoActor m_pReceptorWaiting;
|
||||||
|
|||||||
@@ -7,6 +7,7 @@
|
|||||||
#include "GameState.h"
|
#include "GameState.h"
|
||||||
#include "PrefsManager.h"
|
#include "PrefsManager.h"
|
||||||
#include "NoteFieldPositioning.h"
|
#include "NoteFieldPositioning.h"
|
||||||
|
#include "PlayerState.h"
|
||||||
|
|
||||||
|
|
||||||
ReceptorArrowRow::ReceptorArrowRow()
|
ReceptorArrowRow::ReceptorArrowRow()
|
||||||
@@ -14,9 +15,9 @@ ReceptorArrowRow::ReceptorArrowRow()
|
|||||||
m_iNumCols = 0;
|
m_iNumCols = 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
void ReceptorArrowRow::Load( PlayerNumber pn, CString NoteSkin, float fYReverseOffset )
|
void ReceptorArrowRow::Load( const PlayerState* pPlayerState, CString NoteSkin, float fYReverseOffset )
|
||||||
{
|
{
|
||||||
m_PlayerNumber = pn;
|
m_pPlayerState = pPlayerState;
|
||||||
m_fYReverseOffsetPixels = fYReverseOffset;
|
m_fYReverseOffsetPixels = fYReverseOffset;
|
||||||
|
|
||||||
const Style* pStyle = GAMESTATE->GetCurrentStyle();
|
const Style* pStyle = GAMESTATE->GetCurrentStyle();
|
||||||
@@ -26,7 +27,7 @@ void ReceptorArrowRow::Load( PlayerNumber pn, CString NoteSkin, float fYReverseO
|
|||||||
for( int c=0; c<m_iNumCols; c++ )
|
for( int c=0; c<m_iNumCols; c++ )
|
||||||
{
|
{
|
||||||
m_ReceptorArrow[c].SetName( "ReceptorArrow" );
|
m_ReceptorArrow[c].SetName( "ReceptorArrow" );
|
||||||
m_ReceptorArrow[c].Load( NoteSkin, m_PlayerNumber, c );
|
m_ReceptorArrow[c].Load( NoteSkin, m_pPlayerState, c );
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -35,28 +36,31 @@ void ReceptorArrowRow::Update( float fDeltaTime )
|
|||||||
for( int c=0; c<m_iNumCols; c++ )
|
for( int c=0; c<m_iNumCols; c++ )
|
||||||
{
|
{
|
||||||
m_ReceptorArrow[c].Update( fDeltaTime );
|
m_ReceptorArrow[c].Update( fDeltaTime );
|
||||||
m_ReceptorArrow[c].SetDiffuse( RageColor(1,1,1,1 - GAMESTATE->m_CurrentPlayerOptions[m_PlayerNumber].m_fDark) );
|
m_ReceptorArrow[c].SetDiffuse( RageColor(1,1,1,1 - m_pPlayerState->m_CurrentPlayerOptions.m_fDark) );
|
||||||
|
|
||||||
// set arrow XYZ
|
// set arrow XYZ
|
||||||
const float fX = ArrowGetXPos( m_PlayerNumber, c, 0 );
|
const float fX = ArrowEffects::GetXPos( m_pPlayerState, c, 0 );
|
||||||
const float fY = ArrowGetYPos( m_PlayerNumber, c, 0, m_fYReverseOffsetPixels );
|
const float fY = ArrowEffects::GetYPos( m_pPlayerState, c, 0, m_fYReverseOffsetPixels );
|
||||||
const float fZ = ArrowGetZPos( m_PlayerNumber, c, 0 );
|
const float fZ = ArrowEffects::GetZPos( m_pPlayerState, c, 0 );
|
||||||
m_ReceptorArrow[c].SetX( fX );
|
m_ReceptorArrow[c].SetX( fX );
|
||||||
m_ReceptorArrow[c].SetY( fY );
|
m_ReceptorArrow[c].SetY( fY );
|
||||||
m_ReceptorArrow[c].SetZ( fZ );
|
m_ReceptorArrow[c].SetZ( fZ );
|
||||||
|
|
||||||
const float fZoom = ArrowGetZoom( m_PlayerNumber );
|
const float fZoom = ArrowEffects::GetZoom( m_pPlayerState );
|
||||||
m_ReceptorArrow[c].SetZoom( fZoom );
|
m_ReceptorArrow[c].SetZoom( fZoom );
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void ReceptorArrowRow::DrawPrimitives()
|
void ReceptorArrowRow::DrawPrimitives()
|
||||||
{
|
{
|
||||||
|
// TODO: Remove use of PlayerNumber.
|
||||||
|
PlayerNumber pn = m_pPlayerState->m_PlayerNumber;
|
||||||
|
|
||||||
for( int c=0; c<m_iNumCols; c++ )
|
for( int c=0; c<m_iNumCols; c++ )
|
||||||
{
|
{
|
||||||
g_NoteFieldMode[m_PlayerNumber].BeginDrawTrack(c);
|
g_NoteFieldMode[pn].BeginDrawTrack(c);
|
||||||
m_ReceptorArrow[c].Draw();
|
m_ReceptorArrow[c].Draw();
|
||||||
g_NoteFieldMode[m_PlayerNumber].EndDrawTrack(c);
|
g_NoteFieldMode[pn].EndDrawTrack(c);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -5,16 +5,17 @@
|
|||||||
|
|
||||||
#include "ReceptorArrow.h"
|
#include "ReceptorArrow.h"
|
||||||
#include "ActorFrame.h"
|
#include "ActorFrame.h"
|
||||||
#include "Style.h"
|
|
||||||
#include "GameConstantsAndTypes.h"
|
#include "GameConstantsAndTypes.h"
|
||||||
|
#include "NoteTypes.h"
|
||||||
|
|
||||||
|
struct PlayerState;
|
||||||
|
|
||||||
class ReceptorArrowRow : public ActorFrame
|
class ReceptorArrowRow : public ActorFrame
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
ReceptorArrowRow();
|
ReceptorArrowRow();
|
||||||
|
|
||||||
void Load( PlayerNumber pn, CString NoteSkin, float fYReverseOffset );
|
void Load( const PlayerState* pPlayerState, CString NoteSkin, float fYReverseOffset );
|
||||||
|
|
||||||
virtual void Update( float fDeltaTime );
|
virtual void Update( float fDeltaTime );
|
||||||
virtual void DrawPrimitives();
|
virtual void DrawPrimitives();
|
||||||
@@ -25,7 +26,7 @@ public:
|
|||||||
|
|
||||||
protected:
|
protected:
|
||||||
int m_iNumCols;
|
int m_iNumCols;
|
||||||
PlayerNumber m_PlayerNumber;
|
const PlayerState* m_pPlayerState;
|
||||||
float m_fYReverseOffsetPixels;
|
float m_fYReverseOffsetPixels;
|
||||||
|
|
||||||
ReceptorArrow m_ReceptorArrow[MAX_NOTE_TRACKS];
|
ReceptorArrow m_ReceptorArrow[MAX_NOTE_TRACKS];
|
||||||
|
|||||||
@@ -4,15 +4,17 @@
|
|||||||
#include "PlayerNumber.h"
|
#include "PlayerNumber.h"
|
||||||
#include "ActorFrame.h"
|
#include "ActorFrame.h"
|
||||||
|
|
||||||
|
struct PlayerState;
|
||||||
|
|
||||||
class ScoreDisplay : public ActorFrame
|
class ScoreDisplay : public ActorFrame
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
virtual void Init( PlayerNumber pn ) { m_PlayerNumber = pn; };
|
virtual void Init( const PlayerState* pPlayerState ) { m_pPlayerState = pPlayerState; }
|
||||||
|
|
||||||
virtual void SetScore( int iNewScore ) {};
|
virtual void SetScore( int iNewScore ) {}
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
PlayerNumber m_PlayerNumber; // needed to look up statistics in GAMESTATE
|
const PlayerState* m_pPlayerState; // needed to look up statistics in GAMESTATE
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|||||||
@@ -7,6 +7,7 @@
|
|||||||
#include "GameState.h"
|
#include "GameState.h"
|
||||||
#include "ThemeManager.h"
|
#include "ThemeManager.h"
|
||||||
#include "RageTextureManager.h"
|
#include "RageTextureManager.h"
|
||||||
|
#include "PlayerState.h"
|
||||||
|
|
||||||
#define ITEM_X( i ) THEME->GetMetricF("ScoreDisplayBattle",ssprintf("Item%dX",i+1))
|
#define ITEM_X( i ) THEME->GetMetricF("ScoreDisplayBattle",ssprintf("Item%dX",i+1))
|
||||||
#define ITEM_Y( i ) THEME->GetMetricF("ScoreDisplayBattle",ssprintf("Item%dY",i+1))
|
#define ITEM_Y( i ) THEME->GetMetricF("ScoreDisplayBattle",ssprintf("Item%dY",i+1))
|
||||||
@@ -31,9 +32,9 @@ ScoreDisplayBattle::ScoreDisplayBattle()
|
|||||||
TEXTUREMAN->CacheTexture( asIconPaths[j] );
|
TEXTUREMAN->CacheTexture( asIconPaths[j] );
|
||||||
}
|
}
|
||||||
|
|
||||||
void ScoreDisplayBattle::Init( PlayerNumber pn )
|
void ScoreDisplayBattle::Init( const PlayerState* pPlayerState )
|
||||||
{
|
{
|
||||||
ScoreDisplay::Init( pn );
|
ScoreDisplay::Init( pPlayerState );
|
||||||
}
|
}
|
||||||
|
|
||||||
void ScoreDisplayBattle::Update( float fDelta )
|
void ScoreDisplayBattle::Update( float fDelta )
|
||||||
@@ -42,7 +43,7 @@ void ScoreDisplayBattle::Update( float fDelta )
|
|||||||
|
|
||||||
for( int s=0; s<NUM_INVENTORY_SLOTS; s++ )
|
for( int s=0; s<NUM_INVENTORY_SLOTS; s++ )
|
||||||
{
|
{
|
||||||
Attack attack = GAMESTATE->m_Inventory[m_PlayerNumber][s];
|
const Attack& attack = m_pPlayerState->m_Inventory[s];
|
||||||
CString sNewModifier = attack.sModifier;
|
CString sNewModifier = attack.sModifier;
|
||||||
|
|
||||||
if( sNewModifier != m_iLastSeenInventory[s] )
|
if( sNewModifier != m_iLastSeenInventory[s] )
|
||||||
|
|||||||
@@ -10,7 +10,7 @@ class ScoreDisplayBattle : public ScoreDisplay
|
|||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
ScoreDisplayBattle();
|
ScoreDisplayBattle();
|
||||||
virtual void Init( PlayerNumber pn );
|
virtual void Init( const PlayerState* pPlayerState );
|
||||||
|
|
||||||
virtual void Update( float fDelta );
|
virtual void Update( float fDelta );
|
||||||
|
|
||||||
|
|||||||
@@ -5,6 +5,7 @@
|
|||||||
#include "PrefsManager.h"
|
#include "PrefsManager.h"
|
||||||
#include "GameState.h"
|
#include "GameState.h"
|
||||||
#include "ThemeManager.h"
|
#include "ThemeManager.h"
|
||||||
|
#include "PlayerState.h"
|
||||||
|
|
||||||
|
|
||||||
const float SCORE_TWEEN_TIME = 0.2f;
|
const float SCORE_TWEEN_TIME = 0.2f;
|
||||||
@@ -33,9 +34,13 @@ ScoreDisplayNormal::ScoreDisplayNormal()
|
|||||||
this->AddChild( &m_text );
|
this->AddChild( &m_text );
|
||||||
}
|
}
|
||||||
|
|
||||||
void ScoreDisplayNormal::Init( PlayerNumber pn )
|
void ScoreDisplayNormal::Init( const PlayerState* pPlayerState )
|
||||||
{
|
{
|
||||||
ScoreDisplay::Init( pn );
|
ScoreDisplay::Init( pPlayerState );
|
||||||
|
|
||||||
|
// TODO: Remove use of PlayerNumber.
|
||||||
|
PlayerNumber pn = pPlayerState->m_PlayerNumber;
|
||||||
|
|
||||||
m_text.SetDiffuse( PlayerToColor(pn) );
|
m_text.SetDiffuse( PlayerToColor(pn) );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -13,7 +13,7 @@ class ScoreDisplayNormal : public ScoreDisplay
|
|||||||
public:
|
public:
|
||||||
ScoreDisplayNormal();
|
ScoreDisplayNormal();
|
||||||
|
|
||||||
virtual void Init( PlayerNumber pn );
|
virtual void Init( const PlayerState* pPlayerState );
|
||||||
|
|
||||||
virtual void Update( float fDeltaTime );
|
virtual void Update( float fDeltaTime );
|
||||||
|
|
||||||
|
|||||||
@@ -7,6 +7,7 @@
|
|||||||
#include "GameState.h"
|
#include "GameState.h"
|
||||||
#include "ThemeManager.h"
|
#include "ThemeManager.h"
|
||||||
#include "StageStats.h"
|
#include "StageStats.h"
|
||||||
|
#include "PlayerState.h"
|
||||||
|
|
||||||
|
|
||||||
ScoreDisplayOni::ScoreDisplayOni()
|
ScoreDisplayOni::ScoreDisplayOni()
|
||||||
@@ -22,9 +23,13 @@ ScoreDisplayOni::ScoreDisplayOni()
|
|||||||
this->AddChild( &m_text );
|
this->AddChild( &m_text );
|
||||||
}
|
}
|
||||||
|
|
||||||
void ScoreDisplayOni::Init( PlayerNumber pn )
|
void ScoreDisplayOni::Init( const PlayerState* pPlayerState )
|
||||||
{
|
{
|
||||||
ScoreDisplay::Init( pn );
|
ScoreDisplay::Init( pPlayerState );
|
||||||
|
|
||||||
|
// TODO: Remove use of PlayerNumber.
|
||||||
|
PlayerNumber pn = pPlayerState->m_PlayerNumber;
|
||||||
|
|
||||||
m_text.SetDiffuse( PlayerToColor(pn) );
|
m_text.SetDiffuse( PlayerToColor(pn) );
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -33,9 +38,12 @@ void ScoreDisplayOni::Update( float fDelta )
|
|||||||
{
|
{
|
||||||
ScoreDisplay::Update( fDelta );
|
ScoreDisplay::Update( fDelta );
|
||||||
|
|
||||||
|
// TODO: Remove use of PlayerNumber.
|
||||||
|
PlayerNumber pn = m_pPlayerState->m_PlayerNumber;
|
||||||
|
|
||||||
float fSecsIntoPlay = 0;
|
float fSecsIntoPlay = 0;
|
||||||
if( GAMESTATE->IsPlayerEnabled(m_PlayerNumber) )
|
if( GAMESTATE->IsPlayerEnabled(pn) )
|
||||||
fSecsIntoPlay = g_CurStageStats.fAliveSeconds[m_PlayerNumber];
|
fSecsIntoPlay = g_CurStageStats.fAliveSeconds[pn];
|
||||||
|
|
||||||
m_text.SetText( SecondsToMMSSMsMs(fSecsIntoPlay) );
|
m_text.SetText( SecondsToMMSSMsMs(fSecsIntoPlay) );
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -12,7 +12,7 @@ class ScoreDisplayOni : public ScoreDisplay
|
|||||||
public:
|
public:
|
||||||
ScoreDisplayOni();
|
ScoreDisplayOni();
|
||||||
|
|
||||||
virtual void Init( PlayerNumber pn );
|
virtual void Init( const PlayerState* pPlayerState );
|
||||||
|
|
||||||
virtual void Update( float fDelta );
|
virtual void Update( float fDelta );
|
||||||
|
|
||||||
|
|||||||
@@ -3,6 +3,7 @@
|
|||||||
#include "ScoreDisplayPercentage.h"
|
#include "ScoreDisplayPercentage.h"
|
||||||
#include "ThemeManager.h"
|
#include "ThemeManager.h"
|
||||||
#include "StageStats.h"
|
#include "StageStats.h"
|
||||||
|
#include "PlayerState.h"
|
||||||
|
|
||||||
ScoreDisplayPercentage::ScoreDisplayPercentage()
|
ScoreDisplayPercentage::ScoreDisplayPercentage()
|
||||||
{
|
{
|
||||||
@@ -13,9 +14,9 @@ ScoreDisplayPercentage::ScoreDisplayPercentage()
|
|||||||
this->AddChild( &m_Percent );
|
this->AddChild( &m_Percent );
|
||||||
}
|
}
|
||||||
|
|
||||||
void ScoreDisplayPercentage::Init( PlayerNumber pn )
|
void ScoreDisplayPercentage::Init( const PlayerState* pPlayerState )
|
||||||
{
|
{
|
||||||
m_Percent.Load( pn, &g_CurStageStats, true );
|
m_Percent.Load( pPlayerState->m_PlayerNumber, &g_CurStageStats, true );
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
|
|||||||
@@ -8,7 +8,7 @@ class ScoreDisplayPercentage : public ScoreDisplay
|
|||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
ScoreDisplayPercentage();
|
ScoreDisplayPercentage();
|
||||||
void Init( PlayerNumber pn );
|
void Init( const PlayerState* pPlayerState );
|
||||||
|
|
||||||
private:
|
private:
|
||||||
PercentageDisplay m_Percent;
|
PercentageDisplay m_Percent;
|
||||||
|
|||||||
@@ -7,6 +7,7 @@
|
|||||||
#include "GameState.h"
|
#include "GameState.h"
|
||||||
#include "ThemeManager.h"
|
#include "ThemeManager.h"
|
||||||
#include "ActorUtil.h"
|
#include "ActorUtil.h"
|
||||||
|
#include "PlayerState.h"
|
||||||
|
|
||||||
|
|
||||||
ScoreDisplayRave::ScoreDisplayRave()
|
ScoreDisplayRave::ScoreDisplayRave()
|
||||||
@@ -34,9 +35,11 @@ ScoreDisplayRave::ScoreDisplayRave()
|
|||||||
this->AddChild( &m_textLevel );
|
this->AddChild( &m_textLevel );
|
||||||
}
|
}
|
||||||
|
|
||||||
void ScoreDisplayRave::Init( PlayerNumber pn )
|
void ScoreDisplayRave::Init( const PlayerState* pPlayerState )
|
||||||
{
|
{
|
||||||
ScoreDisplay::Init( pn );
|
ScoreDisplay::Init( pPlayerState );
|
||||||
|
|
||||||
|
PlayerNumber pn = pPlayerState->m_PlayerNumber;
|
||||||
|
|
||||||
m_sprFrameBase.Load( THEME->GetPathToG(ssprintf("ScoreDisplayRave frame base p%d",pn+1)) );
|
m_sprFrameBase.Load( THEME->GetPathToG(ssprintf("ScoreDisplayRave frame base p%d",pn+1)) );
|
||||||
m_sprFrameOverlay.Load( THEME->GetPathToG(ssprintf("ScoreDisplayRave frame overlay p%d",pn+1)) );
|
m_sprFrameOverlay.Load( THEME->GetPathToG(ssprintf("ScoreDisplayRave frame overlay p%d",pn+1)) );
|
||||||
@@ -55,7 +58,9 @@ void ScoreDisplayRave::Update( float fDelta )
|
|||||||
{
|
{
|
||||||
ScoreDisplay::Update( fDelta );
|
ScoreDisplay::Update( fDelta );
|
||||||
|
|
||||||
float fLevel = GAMESTATE->m_fSuperMeter[m_PlayerNumber];
|
PlayerNumber pn = m_pPlayerState->m_PlayerNumber;
|
||||||
|
|
||||||
|
float fLevel = m_pPlayerState->m_fSuperMeter;
|
||||||
AttackLevel level = (AttackLevel)(int)fLevel;
|
AttackLevel level = (AttackLevel)(int)fLevel;
|
||||||
|
|
||||||
if( level != m_lastLevelSeen )
|
if( level != m_lastLevelSeen )
|
||||||
|
|||||||
@@ -11,7 +11,7 @@ class ScoreDisplayRave : public ScoreDisplay
|
|||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
ScoreDisplayRave();
|
ScoreDisplayRave();
|
||||||
virtual void Init( PlayerNumber pn );
|
virtual void Init( const PlayerState* pPlayerState );
|
||||||
|
|
||||||
virtual void Update( float fDelta );
|
virtual void Update( float fDelta );
|
||||||
|
|
||||||
|
|||||||
@@ -12,17 +12,17 @@
|
|||||||
*/
|
*/
|
||||||
|
|
||||||
#include "Actor.h"
|
#include "Actor.h"
|
||||||
#include "PlayerNumber.h"
|
|
||||||
#include "GameConstantsAndTypes.h" // for TapNoteScore and HoldNoteScore
|
#include "GameConstantsAndTypes.h" // for TapNoteScore and HoldNoteScore
|
||||||
class NoteData;
|
class NoteData;
|
||||||
class Inventory;
|
class Inventory;
|
||||||
class Steps;
|
class Steps;
|
||||||
|
struct PlayerState;
|
||||||
|
|
||||||
|
|
||||||
class ScoreKeeper: public Actor
|
class ScoreKeeper: public Actor
|
||||||
{
|
{
|
||||||
protected:
|
protected:
|
||||||
PlayerNumber m_PlayerNumber;
|
PlayerState* m_pPlayerState;
|
||||||
|
|
||||||
/* Common toggles that this class handles directly: */
|
/* Common toggles that this class handles directly: */
|
||||||
|
|
||||||
@@ -31,7 +31,7 @@ protected:
|
|||||||
// bool Stats_DoublesCount;
|
// bool Stats_DoublesCount;
|
||||||
|
|
||||||
public:
|
public:
|
||||||
ScoreKeeper(PlayerNumber pn) { m_PlayerNumber=pn; }
|
ScoreKeeper(PlayerState* pPlayerState) { m_pPlayerState=pPlayerState; }
|
||||||
virtual void DrawPrimitives() { }
|
virtual void DrawPrimitives() { }
|
||||||
virtual void Update( float fDelta ) { }
|
virtual void Update( float fDelta ) { }
|
||||||
|
|
||||||
|
|||||||
@@ -14,9 +14,11 @@
|
|||||||
#include "StageStats.h"
|
#include "StageStats.h"
|
||||||
#include "ProfileManager.h"
|
#include "ProfileManager.h"
|
||||||
#include "NetworkSyncManager.h"
|
#include "NetworkSyncManager.h"
|
||||||
|
#include "PlayerState.h"
|
||||||
|
#include "Style.h"
|
||||||
|
|
||||||
ScoreKeeperMAX2::ScoreKeeperMAX2( const vector<Song*>& apSongs, const vector<Steps*>& apSteps_, const vector<AttackArray> &asModifiers, PlayerNumber pn_ ):
|
ScoreKeeperMAX2::ScoreKeeperMAX2( const vector<Song*>& apSongs, const vector<Steps*>& apSteps_, const vector<AttackArray> &asModifiers, PlayerState* pPlayerState ):
|
||||||
ScoreKeeper(pn_), apSteps(apSteps_)
|
ScoreKeeper(pPlayerState), apSteps(apSteps_)
|
||||||
{
|
{
|
||||||
ASSERT( apSongs.size() == apSteps_.size() );
|
ASSERT( apSongs.size() == apSteps_.size() );
|
||||||
ASSERT( apSongs.size() == asModifiers.size() );
|
ASSERT( apSongs.size() == asModifiers.size() );
|
||||||
@@ -37,7 +39,7 @@ ScoreKeeperMAX2::ScoreKeeperMAX2( const vector<Song*>& apSongs, const vector<Ste
|
|||||||
|
|
||||||
const Style* pStyle = GAMESTATE->GetCurrentStyle();
|
const Style* pStyle = GAMESTATE->GetCurrentStyle();
|
||||||
NoteData nd;
|
NoteData nd;
|
||||||
pStyle->GetTransformedNoteDataForStyle( pn_, ndTemp, nd );
|
pStyle->GetTransformedNoteDataForStyle( pPlayerState->m_PlayerNumber, ndTemp, nd );
|
||||||
|
|
||||||
/* Compute RadarValues before applying any user-selected mods. Apply
|
/* Compute RadarValues before applying any user-selected mods. Apply
|
||||||
* Course mods and count them in the "pre" RadarValues because they're
|
* Course mods and count them in the "pre" RadarValues because they're
|
||||||
@@ -54,13 +56,18 @@ ScoreKeeperMAX2::ScoreKeeperMAX2( const vector<Song*>& apSongs, const vector<Ste
|
|||||||
* have eg. GAMESTATE->GetOptionsForCourse(po,so,pn) to get options based on
|
* have eg. GAMESTATE->GetOptionsForCourse(po,so,pn) to get options based on
|
||||||
* the last call to StoreSelectedOptions and the modifiers list, but that'd
|
* the last call to StoreSelectedOptions and the modifiers list, but that'd
|
||||||
* mean moving the queues in ScreenGameplay to GameState ... */
|
* mean moving the queues in ScreenGameplay to GameState ... */
|
||||||
NoteDataUtil::TransformNoteData( nd, GAMESTATE->m_PlayerOptions[pn_], pSteps->m_StepsType );
|
NoteDataUtil::TransformNoteData( nd, pPlayerState->m_PlayerOptions, pSteps->m_StepsType );
|
||||||
RadarValues rvPost;
|
RadarValues rvPost;
|
||||||
NoteDataUtil::GetRadarValues( nd, pSong->m_fMusicLengthSeconds, rvPost );
|
NoteDataUtil::GetRadarValues( nd, pSong->m_fMusicLengthSeconds, rvPost );
|
||||||
|
|
||||||
iTotalPossibleDancePoints += this->GetPossibleDancePoints( rvPre, rvPost );
|
iTotalPossibleDancePoints += this->GetPossibleDancePoints( rvPre, rvPost );
|
||||||
}
|
}
|
||||||
g_CurStageStats.iPossibleDancePoints[pn_] = iTotalPossibleDancePoints;
|
|
||||||
|
// TODO: Move StageStats numbers into PlayerState.
|
||||||
|
{
|
||||||
|
PlayerNumber pn = m_pPlayerState->m_PlayerNumber;
|
||||||
|
g_CurStageStats.iPossibleDancePoints[pn] = iTotalPossibleDancePoints;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
m_iScoreRemainder = 0;
|
m_iScoreRemainder = 0;
|
||||||
@@ -197,7 +204,9 @@ static int GetScore(int p, int B, int S, int n)
|
|||||||
|
|
||||||
void ScoreKeeperMAX2::AddScore( TapNoteScore score )
|
void ScoreKeeperMAX2::AddScore( TapNoteScore score )
|
||||||
{
|
{
|
||||||
int &iScore = g_CurStageStats.iScore[m_PlayerNumber];
|
// TODO: Move StageStats numbers into PlayerState.
|
||||||
|
PlayerNumber pn = m_pPlayerState->m_PlayerNumber;
|
||||||
|
int &iScore = g_CurStageStats.iScore[pn];
|
||||||
/*
|
/*
|
||||||
http://www.aaroninjapan.com/ddr2.html
|
http://www.aaroninjapan.com/ddr2.html
|
||||||
|
|
||||||
@@ -257,7 +266,7 @@ void ScoreKeeperMAX2::AddScore( TapNoteScore score )
|
|||||||
const int B = m_iMaxPossiblePoints/10;
|
const int B = m_iMaxPossiblePoints/10;
|
||||||
|
|
||||||
// Don't use a multiplier if the player has failed
|
// Don't use a multiplier if the player has failed
|
||||||
if( g_CurStageStats.bFailedEarlier[m_PlayerNumber] )
|
if( g_CurStageStats.bFailedEarlier[pn] )
|
||||||
{
|
{
|
||||||
iScore += p;
|
iScore += p;
|
||||||
// make score evenly divisible by 5
|
// make score evenly divisible by 5
|
||||||
@@ -270,8 +279,8 @@ void ScoreKeeperMAX2::AddScore( TapNoteScore score )
|
|||||||
else
|
else
|
||||||
{
|
{
|
||||||
iScore += GetScore(p, B, sum, m_iTapNotesHit);
|
iScore += GetScore(p, B, sum, m_iTapNotesHit);
|
||||||
const int &iCurrentCombo = g_CurStageStats.iCurCombo[m_PlayerNumber];
|
const int &iCurrentCombo = g_CurStageStats.iCurCombo[pn];
|
||||||
g_CurStageStats.iBonus[m_PlayerNumber] += m_ComboBonusFactor[score] * iCurrentCombo;
|
g_CurStageStats.iBonus[pn] += m_ComboBonusFactor[score] * iCurrentCombo;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Subtract the maximum this step could have been worth from the bonus. */
|
/* Subtract the maximum this step could have been worth from the bonus. */
|
||||||
@@ -279,7 +288,7 @@ void ScoreKeeperMAX2::AddScore( TapNoteScore score )
|
|||||||
|
|
||||||
if ( m_iTapNotesHit == m_iNumTapsAndHolds && score >= TNS_PERFECT )
|
if ( m_iTapNotesHit == m_iNumTapsAndHolds && score >= TNS_PERFECT )
|
||||||
{
|
{
|
||||||
if (!g_CurStageStats.bFailedEarlier[m_PlayerNumber])
|
if (!g_CurStageStats.bFailedEarlier[pn])
|
||||||
iScore += m_iPointBonus;
|
iScore += m_iPointBonus;
|
||||||
if ( m_bIsLastSongInCourse )
|
if ( m_bIsLastSongInCourse )
|
||||||
{
|
{
|
||||||
@@ -305,11 +314,14 @@ void ScoreKeeperMAX2::AddScore( TapNoteScore score )
|
|||||||
|
|
||||||
void ScoreKeeperMAX2::HandleTapScore( TapNoteScore score )
|
void ScoreKeeperMAX2::HandleTapScore( TapNoteScore score )
|
||||||
{
|
{
|
||||||
|
// TODO: Move StageStats numbers into PlayerState.
|
||||||
|
PlayerNumber pn = m_pPlayerState->m_PlayerNumber;
|
||||||
|
|
||||||
if( score == TNS_HIT_MINE )
|
if( score == TNS_HIT_MINE )
|
||||||
{
|
{
|
||||||
if( GAMESTATE->m_HealthState[m_PlayerNumber] != GameState::DEAD )
|
if( m_pPlayerState->m_HealthState != PlayerState::DEAD )
|
||||||
g_CurStageStats.iActualDancePoints[m_PlayerNumber] += TapNoteScoreToDancePoints( TNS_HIT_MINE );
|
g_CurStageStats.iActualDancePoints[pn] += TapNoteScoreToDancePoints( TNS_HIT_MINE );
|
||||||
g_CurStageStats.iTapNoteScores[m_PlayerNumber][TNS_HIT_MINE] += 1;
|
g_CurStageStats.iTapNoteScores[pn][TNS_HIT_MINE] += 1;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -317,11 +329,14 @@ void ScoreKeeperMAX2::HandleTapRowScore( TapNoteScore scoreOfLastTap, int iNumTa
|
|||||||
{
|
{
|
||||||
ASSERT( iNumTapsInRow >= 1 );
|
ASSERT( iNumTapsInRow >= 1 );
|
||||||
|
|
||||||
|
// TODO: Move StageStats numbers into PlayerState.
|
||||||
|
PlayerNumber pn = m_pPlayerState->m_PlayerNumber;
|
||||||
|
|
||||||
// Update dance points.
|
// Update dance points.
|
||||||
if( GAMESTATE->m_HealthState[m_PlayerNumber] != GameState::DEAD )
|
if( m_pPlayerState->m_HealthState != PlayerState::DEAD )
|
||||||
g_CurStageStats.iActualDancePoints[m_PlayerNumber] += TapNoteScoreToDancePoints( scoreOfLastTap );
|
g_CurStageStats.iActualDancePoints[pn] += TapNoteScoreToDancePoints( scoreOfLastTap );
|
||||||
// update judged row totals
|
// update judged row totals
|
||||||
g_CurStageStats.iTapNoteScores[m_PlayerNumber][scoreOfLastTap] += 1;
|
g_CurStageStats.iTapNoteScores[pn][scoreOfLastTap] += 1;
|
||||||
|
|
||||||
//
|
//
|
||||||
// Regular combo
|
// Regular combo
|
||||||
@@ -352,7 +367,7 @@ void ScoreKeeperMAX2::HandleTapRowScore( TapNoteScore scoreOfLastTap, int iNumTa
|
|||||||
TapNoteScore MinScoreToContinueCombo = GAMESTATE->m_PlayMode == PLAY_MODE_ONI? TNS_PERFECT:TNS_GREAT;
|
TapNoteScore MinScoreToContinueCombo = GAMESTATE->m_PlayMode == PLAY_MODE_ONI? TNS_PERFECT:TNS_GREAT;
|
||||||
|
|
||||||
if( scoreOfLastTap >= MinScoreToContinueCombo )
|
if( scoreOfLastTap >= MinScoreToContinueCombo )
|
||||||
g_CurStageStats.iCurCombo[m_PlayerNumber] += ComboCountIfHit;
|
g_CurStageStats.iCurCombo[pn] += ComboCountIfHit;
|
||||||
|
|
||||||
AddScore( scoreOfLastTap ); // only score once per row
|
AddScore( scoreOfLastTap ); // only score once per row
|
||||||
|
|
||||||
@@ -381,7 +396,9 @@ void ScoreKeeperMAX2::HandleTapRowScore( TapNoteScore scoreOfLastTap, int iNumTa
|
|||||||
!GAMESTATE->m_bDemonstrationOrJukebox )
|
!GAMESTATE->m_bDemonstrationOrJukebox )
|
||||||
{
|
{
|
||||||
SCREENMAN->PostMessageToTopScreen( SM_PlayToasty, 0 );
|
SCREENMAN->PostMessageToTopScreen( SM_PlayToasty, 0 );
|
||||||
PROFILEMAN->IncrementToastiesCount( m_PlayerNumber );
|
|
||||||
|
// TODO: keep a pointer to the Profile. Don't index with m_PlayerNumber
|
||||||
|
PROFILEMAN->IncrementToastiesCount( m_pPlayerState->m_PlayerNumber );
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
@@ -390,25 +407,29 @@ void ScoreKeeperMAX2::HandleTapRowScore( TapNoteScore scoreOfLastTap, int iNumTa
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
NSMAN->ReportScore(m_PlayerNumber, scoreOfLastTap,
|
// TODO: Remove indexing with PlayerNumber
|
||||||
g_CurStageStats.iScore[m_PlayerNumber],
|
NSMAN->ReportScore(pn, scoreOfLastTap,
|
||||||
g_CurStageStats.iCurCombo[m_PlayerNumber]);
|
g_CurStageStats.iScore[pn],
|
||||||
|
g_CurStageStats.iCurCombo[pn]);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void ScoreKeeperMAX2::HandleHoldScore( HoldNoteScore holdScore, TapNoteScore tapScore )
|
void ScoreKeeperMAX2::HandleHoldScore( HoldNoteScore holdScore, TapNoteScore tapScore )
|
||||||
{
|
{
|
||||||
|
// TODO: Move StageStats numbers into PlayerState.
|
||||||
|
PlayerNumber pn = m_pPlayerState->m_PlayerNumber;
|
||||||
|
|
||||||
// update dance points totals
|
// update dance points totals
|
||||||
if( GAMESTATE->m_HealthState[m_PlayerNumber] != GameState::DEAD )
|
if( m_pPlayerState->m_HealthState != PlayerState::DEAD )
|
||||||
g_CurStageStats.iActualDancePoints[m_PlayerNumber] += HoldNoteScoreToDancePoints( holdScore );
|
g_CurStageStats.iActualDancePoints[pn] += HoldNoteScoreToDancePoints( holdScore );
|
||||||
g_CurStageStats.iHoldNoteScores[m_PlayerNumber][holdScore] ++;
|
g_CurStageStats.iHoldNoteScores[pn][holdScore] ++;
|
||||||
|
|
||||||
if( holdScore == HNS_OK )
|
if( holdScore == HNS_OK )
|
||||||
AddScore( TNS_MARVELOUS );
|
AddScore( TNS_MARVELOUS );
|
||||||
|
|
||||||
NSMAN->ReportScore(m_PlayerNumber, holdScore+7,
|
NSMAN->ReportScore(pn, holdScore+7,
|
||||||
g_CurStageStats.iScore[m_PlayerNumber],
|
g_CurStageStats.iScore[pn],
|
||||||
g_CurStageStats.iCurCombo[m_PlayerNumber]);
|
g_CurStageStats.iCurCombo[pn]);
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -29,7 +29,7 @@ class ScoreKeeperMAX2: public ScoreKeeper
|
|||||||
int m_ComboBonusFactor[NUM_TAP_NOTE_SCORES];
|
int m_ComboBonusFactor[NUM_TAP_NOTE_SCORES];
|
||||||
|
|
||||||
public:
|
public:
|
||||||
ScoreKeeperMAX2( const vector<Song*>& apSongs, const vector<Steps*>& apSteps, const vector<AttackArray> &asModifiers, PlayerNumber pn);
|
ScoreKeeperMAX2( const vector<Song*>& apSongs, const vector<Steps*>& apSteps, const vector<AttackArray> &asModifiers, PlayerState* pPlayerState);
|
||||||
|
|
||||||
// before a song plays (called multiple times if course)
|
// before a song plays (called multiple times if course)
|
||||||
void OnNextSong( int iSongInCourseIndex, const Steps* pSteps, const NoteData* pNoteData );
|
void OnNextSong( int iSongInCourseIndex, const Steps* pSteps, const NoteData* pNoteData );
|
||||||
|
|||||||
@@ -7,11 +7,13 @@
|
|||||||
#include "ScreenManager.h"
|
#include "ScreenManager.h"
|
||||||
#include "PrefsManager.h"
|
#include "PrefsManager.h"
|
||||||
#include "ThemeMetric.h"
|
#include "ThemeMetric.h"
|
||||||
|
#include "PlayerState.h"
|
||||||
|
|
||||||
|
|
||||||
ThemeMetric<float> ATTACK_DURATION_SECONDS ("ScoreKeeperRave","AttackDurationSeconds");
|
ThemeMetric<float> ATTACK_DURATION_SECONDS ("ScoreKeeperRave","AttackDurationSeconds");
|
||||||
|
|
||||||
|
|
||||||
ScoreKeeperRave::ScoreKeeperRave(PlayerNumber pn) : ScoreKeeper(pn)
|
ScoreKeeperRave::ScoreKeeperRave( PlayerState* pPlayerState ) : ScoreKeeper(pPlayerState)
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -63,7 +65,7 @@ void ScoreKeeperRave::AddSuperMeterDelta( float fUnscaledPercentChange )
|
|||||||
{
|
{
|
||||||
if( PREFSMAN->m_bMercifulDrain && fUnscaledPercentChange<0 )
|
if( PREFSMAN->m_bMercifulDrain && fUnscaledPercentChange<0 )
|
||||||
{
|
{
|
||||||
float fSuperPercentage = GAMESTATE->m_fSuperMeter[m_PlayerNumber] / NUM_ATTACK_LEVELS;
|
float fSuperPercentage = m_pPlayerState->m_fSuperMeter / NUM_ATTACK_LEVELS;
|
||||||
fUnscaledPercentChange *= SCALE( fSuperPercentage, 0.f, 1.f, 0.5f, 1.f);
|
fUnscaledPercentChange *= SCALE( fSuperPercentage, 0.f, 1.f, 0.5f, 1.f);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -71,7 +73,7 @@ void ScoreKeeperRave::AddSuperMeterDelta( float fUnscaledPercentChange )
|
|||||||
if( PREFSMAN->m_bMercifulSuperMeter )
|
if( PREFSMAN->m_bMercifulSuperMeter )
|
||||||
{
|
{
|
||||||
float fLifePercentage = 0;
|
float fLifePercentage = 0;
|
||||||
switch( m_PlayerNumber )
|
switch( m_pPlayerState->m_PlayerNumber )
|
||||||
{
|
{
|
||||||
case PLAYER_1: fLifePercentage = GAMESTATE->m_fTugLifePercentP1; break;
|
case PLAYER_1: fLifePercentage = GAMESTATE->m_fTugLifePercentP1; break;
|
||||||
case PLAYER_2: fLifePercentage = 1 - GAMESTATE->m_fTugLifePercentP1; break;
|
case PLAYER_2: fLifePercentage = 1 - GAMESTATE->m_fTugLifePercentP1; break;
|
||||||
@@ -87,35 +89,35 @@ void ScoreKeeperRave::AddSuperMeterDelta( float fUnscaledPercentChange )
|
|||||||
|
|
||||||
// mercy: drop super meter faster if at a higher level
|
// mercy: drop super meter faster if at a higher level
|
||||||
if( fUnscaledPercentChange < 0 )
|
if( fUnscaledPercentChange < 0 )
|
||||||
fUnscaledPercentChange *= SCALE( GAMESTATE->m_fSuperMeter[m_PlayerNumber], 0.f, 1.f, 0.01f, 1.f );
|
fUnscaledPercentChange *= SCALE( m_pPlayerState->m_fSuperMeter, 0.f, 1.f, 0.01f, 1.f );
|
||||||
|
|
||||||
AttackLevel oldAL = (AttackLevel)(int)GAMESTATE->m_fSuperMeter[m_PlayerNumber];
|
AttackLevel oldAL = (AttackLevel)(int)m_pPlayerState->m_fSuperMeter;
|
||||||
|
|
||||||
float fPercentToMove = fUnscaledPercentChange;
|
float fPercentToMove = fUnscaledPercentChange;
|
||||||
GAMESTATE->m_fSuperMeter[m_PlayerNumber] += fPercentToMove * GAMESTATE->m_fSuperMeterGrowthScale[m_PlayerNumber];
|
m_pPlayerState->m_fSuperMeter += fPercentToMove * m_pPlayerState->m_fSuperMeterGrowthScale;
|
||||||
CLAMP( GAMESTATE->m_fSuperMeter[m_PlayerNumber], 0.f, NUM_ATTACK_LEVELS );
|
CLAMP( m_pPlayerState->m_fSuperMeter, 0.f, NUM_ATTACK_LEVELS );
|
||||||
|
|
||||||
AttackLevel newAL = (AttackLevel)(int)GAMESTATE->m_fSuperMeter[m_PlayerNumber];
|
AttackLevel newAL = (AttackLevel)(int)m_pPlayerState->m_fSuperMeter;
|
||||||
|
|
||||||
if( newAL > oldAL )
|
if( newAL > oldAL )
|
||||||
{
|
{
|
||||||
LaunchAttack( oldAL );
|
LaunchAttack( oldAL );
|
||||||
if( newAL == NUM_ATTACK_LEVELS ) // hit upper bounds of meter
|
if( newAL == NUM_ATTACK_LEVELS ) // hit upper bounds of meter
|
||||||
GAMESTATE->m_fSuperMeter[m_PlayerNumber] -= 1.f;
|
m_pPlayerState->m_fSuperMeter -= 1.f;
|
||||||
}
|
}
|
||||||
|
|
||||||
// mercy: if losing remove attacks on life drain
|
// mercy: if losing remove attacks on life drain
|
||||||
if( fUnscaledPercentChange < 0 )
|
if( fUnscaledPercentChange < 0 )
|
||||||
{
|
{
|
||||||
bool bWinning;
|
bool bWinning;
|
||||||
switch( m_PlayerNumber )
|
switch( m_pPlayerState->m_PlayerNumber )
|
||||||
{
|
{
|
||||||
case PLAYER_1: bWinning = GAMESTATE->m_fTugLifePercentP1 > 0.5f; break;
|
case PLAYER_1: bWinning = GAMESTATE->m_fTugLifePercentP1 > 0.5f; break;
|
||||||
case PLAYER_2: bWinning = GAMESTATE->m_fTugLifePercentP1 < 0.5f; break;
|
case PLAYER_2: bWinning = GAMESTATE->m_fTugLifePercentP1 < 0.5f; break;
|
||||||
default: ASSERT(0);
|
default: ASSERT(0);
|
||||||
}
|
}
|
||||||
if( !bWinning )
|
if( !bWinning )
|
||||||
GAMESTATE->RemoveActiveAttacksForPlayer( m_PlayerNumber );
|
GAMESTATE->RemoveActiveAttacksForPlayer( m_pPlayerState->m_PlayerNumber );
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -126,10 +128,12 @@ void ScoreKeeperRave::Update( float fDelta )
|
|||||||
|
|
||||||
void ScoreKeeperRave::LaunchAttack( AttackLevel al )
|
void ScoreKeeperRave::LaunchAttack( AttackLevel al )
|
||||||
{
|
{
|
||||||
CString* asAttacks = GAMESTATE->m_pCurCharacters[m_PlayerNumber]->m_sAttacks[al]; // [NUM_ATTACKS_PER_LEVEL]
|
PlayerNumber pn = m_pPlayerState->m_PlayerNumber;
|
||||||
|
|
||||||
|
CString* asAttacks = GAMESTATE->m_pCurCharacters[pn]->m_sAttacks[al]; // [NUM_ATTACKS_PER_LEVEL]
|
||||||
CString sAttackToGive;
|
CString sAttackToGive;
|
||||||
|
|
||||||
if (GAMESTATE->m_pCurCharacters[m_PlayerNumber] != NULL)
|
if (GAMESTATE->m_pCurCharacters[pn] != NULL)
|
||||||
sAttackToGive = asAttacks[ rand()%NUM_ATTACKS_PER_LEVEL ];
|
sAttackToGive = asAttacks[ rand()%NUM_ATTACKS_PER_LEVEL ];
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
@@ -138,7 +142,7 @@ void ScoreKeeperRave::LaunchAttack( AttackLevel al )
|
|||||||
sAttackToGive = DefaultAttacks[ rand()%8 ];
|
sAttackToGive = DefaultAttacks[ rand()%8 ];
|
||||||
}
|
}
|
||||||
|
|
||||||
PlayerNumber pnToAttack = OPPOSITE_PLAYER[m_PlayerNumber];
|
PlayerNumber pnToAttack = OPPOSITE_PLAYER[pn];
|
||||||
|
|
||||||
Attack a;
|
Attack a;
|
||||||
a.level = al;
|
a.level = al;
|
||||||
|
|||||||
@@ -11,7 +11,7 @@ class ScoreKeeperRave : public ScoreKeeper
|
|||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
// Overrides
|
// Overrides
|
||||||
ScoreKeeperRave(PlayerNumber pn);
|
ScoreKeeperRave( PlayerState* pPlayerState );
|
||||||
void Update( float fDelta );
|
void Update( float fDelta );
|
||||||
void OnNextSong( int iSongInCourseIndex, const Steps* pSteps, const NoteData* pNoteData ); // before a song plays (called multiple times if course)
|
void OnNextSong( int iSongInCourseIndex, const Steps* pSteps, const NoteData* pNoteData ); // before a song plays (called multiple times if course)
|
||||||
void HandleTapScore( TapNoteScore score );
|
void HandleTapScore( TapNoteScore score );
|
||||||
|
|||||||
@@ -25,6 +25,7 @@
|
|||||||
#include "Foreach.h"
|
#include "Foreach.h"
|
||||||
#include "ScreenDimensions.h"
|
#include "ScreenDimensions.h"
|
||||||
#include "ThemeMetric.h"
|
#include "ThemeMetric.h"
|
||||||
|
#include "PlayerState.h"
|
||||||
|
|
||||||
const float RECORD_HOLD_SECONDS = 0.3f;
|
const float RECORD_HOLD_SECONDS = 0.3f;
|
||||||
|
|
||||||
@@ -404,11 +405,11 @@ ScreenEdit::ScreenEdit( CString sName ) : Screen( sName )
|
|||||||
GAMESTATE->m_fSongBeat = 0;
|
GAMESTATE->m_fSongBeat = 0;
|
||||||
m_fTrailingBeat = GAMESTATE->m_fSongBeat;
|
m_fTrailingBeat = GAMESTATE->m_fSongBeat;
|
||||||
|
|
||||||
GAMESTATE->m_PlayerOptions[PLAYER_1].m_fScrollSpeed = 1;
|
GAMESTATE->m_pPlayerState[PLAYER_1]->m_PlayerOptions.m_fScrollSpeed = 1;
|
||||||
GAMESTATE->m_SongOptions.m_fMusicRate = 1;
|
GAMESTATE->m_SongOptions.m_fMusicRate = 1;
|
||||||
/* Not all games have a noteskin named "note" ... */
|
/* Not all games have a noteskin named "note" ... */
|
||||||
if( NOTESKIN->DoesNoteSkinExist("note") )
|
if( NOTESKIN->DoesNoteSkinExist("note") )
|
||||||
GAMESTATE->m_PlayerOptions[PLAYER_1].m_sNoteSkin = "note"; // change noteskin before loading all of the edit Actors
|
GAMESTATE->m_pPlayerState[PLAYER_1]->m_PlayerOptions.m_sNoteSkin = "note"; // change noteskin before loading all of the edit Actors
|
||||||
GAMESTATE->ResetNoteSkins();
|
GAMESTATE->ResetNoteSkins();
|
||||||
GAMESTATE->StoreSelectedOptions();
|
GAMESTATE->StoreSelectedOptions();
|
||||||
|
|
||||||
@@ -421,29 +422,29 @@ ScreenEdit::ScreenEdit( CString sName ) : Screen( sName )
|
|||||||
|
|
||||||
m_NoteFieldEdit.SetXY( EDIT_X, PLAYER_Y );
|
m_NoteFieldEdit.SetXY( EDIT_X, PLAYER_Y );
|
||||||
m_NoteFieldEdit.SetZoom( 0.5f );
|
m_NoteFieldEdit.SetZoom( 0.5f );
|
||||||
m_NoteFieldEdit.Load( ¬eData, PLAYER_1, -240, 800, PLAYER_HEIGHT*2 );
|
m_NoteFieldEdit.Load( ¬eData, GAMESTATE->m_pPlayerState[PLAYER_1], -240, 800, PLAYER_HEIGHT*2 );
|
||||||
|
|
||||||
m_rectRecordBack.StretchTo( RectF(SCREEN_LEFT, SCREEN_TOP, SCREEN_RIGHT, SCREEN_BOTTOM) );
|
m_rectRecordBack.StretchTo( RectF(SCREEN_LEFT, SCREEN_TOP, SCREEN_RIGHT, SCREEN_BOTTOM) );
|
||||||
m_rectRecordBack.SetDiffuse( RageColor(0,0,0,0) );
|
m_rectRecordBack.SetDiffuse( RageColor(0,0,0,0) );
|
||||||
|
|
||||||
m_NoteFieldRecord.SetXY( EDIT_X, PLAYER_Y );
|
m_NoteFieldRecord.SetXY( EDIT_X, PLAYER_Y );
|
||||||
m_NoteFieldRecord.SetZoom( 1.0f );
|
m_NoteFieldRecord.SetZoom( 1.0f );
|
||||||
m_NoteFieldRecord.Load( ¬eData, PLAYER_1, -150, 350, 350 );
|
m_NoteFieldRecord.Load( ¬eData, GAMESTATE->m_pPlayerState[PLAYER_1], -150, 350, 350 );
|
||||||
|
|
||||||
m_Clipboard.SetNumTracks( m_NoteFieldEdit.GetNumTracks() );
|
m_Clipboard.SetNumTracks( m_NoteFieldEdit.GetNumTracks() );
|
||||||
|
|
||||||
|
|
||||||
GAMESTATE->m_PlayerOptions[PLAYER_1].Init(); // don't allow weird options in editor. It doesn't handle reverse well.
|
GAMESTATE->m_pPlayerState[PLAYER_1]->m_PlayerOptions.Init(); // don't allow weird options in editor. It doesn't handle reverse well.
|
||||||
// Set NoteSkin to note if available.
|
// Set NoteSkin to note if available.
|
||||||
// Change noteskin back to default before loading player.
|
// Change noteskin back to default before loading player.
|
||||||
if( NOTESKIN->DoesNoteSkinExist("note") )
|
if( NOTESKIN->DoesNoteSkinExist("note") )
|
||||||
GAMESTATE->m_PlayerOptions[PLAYER_1].m_sNoteSkin = "note";
|
GAMESTATE->m_pPlayerState[PLAYER_1]->m_PlayerOptions.m_sNoteSkin = "note";
|
||||||
GAMESTATE->ResetNoteSkins();
|
GAMESTATE->ResetNoteSkins();
|
||||||
|
|
||||||
/* XXX: Do we actually have to send real note data here, and to m_NoteFieldRecord?
|
/* XXX: Do we actually have to send real note data here, and to m_NoteFieldRecord?
|
||||||
* (We load again on play/record.) */
|
* (We load again on play/record.) */
|
||||||
m_Player.Load( PLAYER_1, noteData, NULL, NULL, NULL, NULL, NULL, NULL, NULL );
|
m_Player.Load( GAMESTATE->m_pPlayerState[PLAYER_1], noteData, NULL, NULL, NULL, NULL, NULL, NULL, NULL );
|
||||||
GAMESTATE->m_PlayerController[PLAYER_1] = PC_HUMAN;
|
GAMESTATE->m_pPlayerState[PLAYER_1]->m_PlayerController = PC_HUMAN;
|
||||||
m_Player.SetXY( PLAYER_X, PLAYER_Y );
|
m_Player.SetXY( PLAYER_X, PLAYER_Y );
|
||||||
|
|
||||||
m_In.Load( THEME->GetPathToB("ScreenEdit in") );
|
m_In.Load( THEME->GetPathToB("ScreenEdit in") );
|
||||||
@@ -636,7 +637,7 @@ void ScreenEdit::Update( float fDeltaTime )
|
|||||||
else
|
else
|
||||||
{
|
{
|
||||||
float fSign = fDelta / fabsf(fDelta);
|
float fSign = fDelta / fabsf(fDelta);
|
||||||
float fMoveDelta = fSign*fDeltaTime*40 / GAMESTATE->m_CurrentPlayerOptions[PLAYER_1].m_fScrollSpeed;
|
float fMoveDelta = fSign*fDeltaTime*40 / GAMESTATE->m_pPlayerState[PLAYER_1]->m_CurrentPlayerOptions.m_fScrollSpeed;
|
||||||
if( fabsf(fMoveDelta) > fabsf(fDelta) )
|
if( fabsf(fMoveDelta) > fabsf(fDelta) )
|
||||||
fMoveDelta = fDelta;
|
fMoveDelta = fDelta;
|
||||||
m_fTrailingBeat += fMoveDelta;
|
m_fTrailingBeat += fMoveDelta;
|
||||||
@@ -884,7 +885,7 @@ void ScreenEdit::InputEdit( const DeviceInput& DeviceI, const InputEventType typ
|
|||||||
if(lIsHeld)
|
if(lIsHeld)
|
||||||
#endif
|
#endif
|
||||||
{
|
{
|
||||||
float& fScrollSpeed = GAMESTATE->m_PlayerOptions[PLAYER_1].m_fScrollSpeed;
|
float& fScrollSpeed = GAMESTATE->m_pPlayerState[PLAYER_1]->m_PlayerOptions.m_fScrollSpeed;
|
||||||
float fNewScrollSpeed = fScrollSpeed;
|
float fNewScrollSpeed = fScrollSpeed;
|
||||||
|
|
||||||
if( DeviceI.button == KEY_UP )
|
if( DeviceI.button == KEY_UP )
|
||||||
@@ -1399,9 +1400,8 @@ void ScreenEdit::InputPlay( const DeviceInput& DeviceI, const InputEventType typ
|
|||||||
case KEY_F8:
|
case KEY_F8:
|
||||||
{
|
{
|
||||||
PREFSMAN->m_bAutoPlay = !PREFSMAN->m_bAutoPlay;
|
PREFSMAN->m_bAutoPlay = !PREFSMAN->m_bAutoPlay;
|
||||||
FOREACH_PlayerNumber( p )
|
FOREACH_HumanPlayer( p )
|
||||||
if( GAMESTATE->IsHumanPlayer(p) )
|
GAMESTATE->m_pPlayerState[p]->m_PlayerController = PREFSMAN->m_bAutoPlay?PC_AUTOPLAY:PC_HUMAN;
|
||||||
GAMESTATE->m_PlayerController[p] = PREFSMAN->m_bAutoPlay?PC_AUTOPLAY:PC_HUMAN;
|
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
case KEY_F11:
|
case KEY_F11:
|
||||||
@@ -1466,7 +1466,7 @@ void ScreenEdit::TransitionToEdit()
|
|||||||
/* Stop displaying course attacks, if any. */
|
/* Stop displaying course attacks, if any. */
|
||||||
GAMESTATE->RemoveAllActiveAttacks();
|
GAMESTATE->RemoveAllActiveAttacks();
|
||||||
GAMESTATE->RebuildPlayerOptionsFromActiveAttacks( PLAYER_1 );
|
GAMESTATE->RebuildPlayerOptionsFromActiveAttacks( PLAYER_1 );
|
||||||
GAMESTATE->m_CurrentPlayerOptions[PLAYER_1] = GAMESTATE->m_PlayerOptions[PLAYER_1];
|
GAMESTATE->m_pPlayerState[PLAYER_1]->m_CurrentPlayerOptions = GAMESTATE->m_pPlayerState[PLAYER_1]->m_PlayerOptions;
|
||||||
}
|
}
|
||||||
|
|
||||||
void ScreenEdit::TransitionFromRecordToEdit()
|
void ScreenEdit::TransitionFromRecordToEdit()
|
||||||
@@ -1553,7 +1553,7 @@ void ScreenEdit::HandleScreenMessage( const ScreenMessage SM )
|
|||||||
break;
|
break;
|
||||||
case SM_BackFromInsertAttackModifiers:
|
case SM_BackFromInsertAttackModifiers:
|
||||||
{
|
{
|
||||||
PlayerOptions poChosen = GAMESTATE->m_PlayerOptions[PLAYER_1];
|
PlayerOptions poChosen = GAMESTATE->m_pPlayerState[PLAYER_1]->m_PlayerOptions;
|
||||||
CString sMods = poChosen.GetString();
|
CString sMods = poChosen.GetString();
|
||||||
const int row = BeatToNoteRow( GAMESTATE->m_fSongBeat );
|
const int row = BeatToNoteRow( GAMESTATE->m_fSongBeat );
|
||||||
|
|
||||||
@@ -2095,8 +2095,8 @@ void ScreenEdit::HandleAreaMenuChoice( AreaMenuChoice c, int* iAnswers )
|
|||||||
|
|
||||||
SetupCourseAttacks();
|
SetupCourseAttacks();
|
||||||
|
|
||||||
m_Player.Load( PLAYER_1, m_NoteFieldEdit, NULL, NULL, NULL, NULL, NULL, NULL, NULL );
|
m_Player.Load( GAMESTATE->m_pPlayerState[PLAYER_1], m_NoteFieldEdit, NULL, NULL, NULL, NULL, NULL, NULL, NULL );
|
||||||
GAMESTATE->m_PlayerController[PLAYER_1] = PREFSMAN->m_bAutoPlay?PC_AUTOPLAY:PC_HUMAN;
|
GAMESTATE->m_pPlayerState[PLAYER_1]->m_PlayerController = PREFSMAN->m_bAutoPlay?PC_AUTOPLAY:PC_HUMAN;
|
||||||
|
|
||||||
m_rectRecordBack.StopTweening();
|
m_rectRecordBack.StopTweening();
|
||||||
m_rectRecordBack.BeginTweening( 0.5f );
|
m_rectRecordBack.BeginTweening( 0.5f );
|
||||||
@@ -2141,7 +2141,7 @@ void ScreenEdit::HandleAreaMenuChoice( AreaMenuChoice c, int* iAnswers )
|
|||||||
GAMESTATE->ResetNoteSkins();
|
GAMESTATE->ResetNoteSkins();
|
||||||
|
|
||||||
// initialize m_NoteFieldRecord
|
// initialize m_NoteFieldRecord
|
||||||
m_NoteFieldRecord.Load( &m_NoteFieldEdit, PLAYER_1, -150, 350, 350 );
|
m_NoteFieldRecord.Load( &m_NoteFieldEdit, GAMESTATE->m_pPlayerState[PLAYER_1], -150, 350, 350 );
|
||||||
m_NoteFieldRecord.SetNumTracks( m_NoteFieldEdit.GetNumTracks() );
|
m_NoteFieldRecord.SetNumTracks( m_NoteFieldEdit.GetNumTracks() );
|
||||||
|
|
||||||
m_rectRecordBack.StopTweening();
|
m_rectRecordBack.StopTweening();
|
||||||
@@ -2350,10 +2350,10 @@ void ScreenEdit::SetupCourseAttacks()
|
|||||||
{
|
{
|
||||||
/* This is the first beat that can be changed without it being visible. Until
|
/* This is the first beat that can be changed without it being visible. Until
|
||||||
* we draw for the first time, any beat can be changed. */
|
* we draw for the first time, any beat can be changed. */
|
||||||
GAMESTATE->m_fLastDrawnBeat[PLAYER_1] = -100;
|
GAMESTATE->m_pPlayerState[PLAYER_1]->m_fLastDrawnBeat = -100;
|
||||||
|
|
||||||
// Put course options into effect.
|
// Put course options into effect.
|
||||||
GAMESTATE->m_ModsToApply[PLAYER_1].clear();
|
GAMESTATE->m_pPlayerState[PLAYER_1]->m_ModsToApply.clear();
|
||||||
GAMESTATE->RemoveActiveAttacksForPlayer( PLAYER_1 );
|
GAMESTATE->RemoveActiveAttacksForPlayer( PLAYER_1 );
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@@ -16,6 +16,7 @@
|
|||||||
#include "ScreenManager.h"
|
#include "ScreenManager.h"
|
||||||
#include "PrefsManager.h"
|
#include "PrefsManager.h"
|
||||||
#include "StageStats.h"
|
#include "StageStats.h"
|
||||||
|
#include "PlayerState.h"
|
||||||
|
|
||||||
|
|
||||||
#define SCROLL_DELAY THEME->GetMetricF("ScreenEnding","ScrollDelay")
|
#define SCROLL_DELAY THEME->GetMetricF("ScreenEnding","ScrollDelay")
|
||||||
@@ -152,11 +153,11 @@ ScreenEnding::ScreenEnding( CString sClassName ) : ScreenAttract( sClassName, fa
|
|||||||
GAMESTATE->m_pCurSteps[PLAYER_2] = GAMESTATE->m_pCurSong->GetAllSteps()[0];
|
GAMESTATE->m_pCurSteps[PLAYER_2] = GAMESTATE->m_pCurSong->GetAllSteps()[0];
|
||||||
g_CurStageStats.vpSteps[PLAYER_1].push_back( GAMESTATE->m_pCurSteps[PLAYER_1] );
|
g_CurStageStats.vpSteps[PLAYER_1].push_back( GAMESTATE->m_pCurSteps[PLAYER_1] );
|
||||||
g_CurStageStats.vpSteps[PLAYER_2].push_back( GAMESTATE->m_pCurSteps[PLAYER_2] );
|
g_CurStageStats.vpSteps[PLAYER_2].push_back( GAMESTATE->m_pCurSteps[PLAYER_2] );
|
||||||
GAMESTATE->m_PlayerOptions[PLAYER_1].m_fScrollSpeed = 2;
|
GAMESTATE->m_pPlayerState[PLAYER_1]->m_PlayerOptions.m_fScrollSpeed = 2;
|
||||||
GAMESTATE->m_PlayerOptions[PLAYER_2].m_fScrollSpeed = 2;
|
GAMESTATE->m_pPlayerState[PLAYER_2]->m_PlayerOptions.m_fScrollSpeed = 2;
|
||||||
GAMESTATE->m_iCurrentStageIndex = 0;
|
GAMESTATE->m_iCurrentStageIndex = 0;
|
||||||
GAMESTATE->m_PlayerOptions[PLAYER_1].ChooseRandomMofifiers();
|
GAMESTATE->m_pPlayerState[PLAYER_1]->m_PlayerOptions.ChooseRandomMofifiers();
|
||||||
GAMESTATE->m_PlayerOptions[PLAYER_2].ChooseRandomMofifiers();
|
GAMESTATE->m_pPlayerState[PLAYER_2]->m_PlayerOptions.ChooseRandomMofifiers();
|
||||||
|
|
||||||
for( float f = 0; f < 100.0f; f += 1.0f )
|
for( float f = 0; f < 100.0f; f += 1.0f )
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -28,6 +28,7 @@
|
|||||||
#include "CryptManager.h"
|
#include "CryptManager.h"
|
||||||
#include "Style.h"
|
#include "Style.h"
|
||||||
#include "MemoryCardManager.h"
|
#include "MemoryCardManager.h"
|
||||||
|
#include "PlayerState.h"
|
||||||
|
|
||||||
const int NUM_SCORE_DIGITS = 9;
|
const int NUM_SCORE_DIGITS = 9;
|
||||||
|
|
||||||
@@ -113,11 +114,11 @@ void ScreenEvaluation::Init()
|
|||||||
GAMESTATE->m_pCurSteps[PLAYER_2] = GAMESTATE->m_pCurSong->GetAllSteps()[0];
|
GAMESTATE->m_pCurSteps[PLAYER_2] = GAMESTATE->m_pCurSong->GetAllSteps()[0];
|
||||||
g_CurStageStats.vpSteps[PLAYER_1].push_back( GAMESTATE->m_pCurSteps[PLAYER_1] );
|
g_CurStageStats.vpSteps[PLAYER_1].push_back( GAMESTATE->m_pCurSteps[PLAYER_1] );
|
||||||
g_CurStageStats.vpSteps[PLAYER_2].push_back( GAMESTATE->m_pCurSteps[PLAYER_2] );
|
g_CurStageStats.vpSteps[PLAYER_2].push_back( GAMESTATE->m_pCurSteps[PLAYER_2] );
|
||||||
GAMESTATE->m_PlayerOptions[PLAYER_1].m_fScrollSpeed = 2;
|
GAMESTATE->m_pPlayerState[PLAYER_1]->m_PlayerOptions.m_fScrollSpeed = 2;
|
||||||
GAMESTATE->m_PlayerOptions[PLAYER_2].m_fScrollSpeed = 2;
|
GAMESTATE->m_pPlayerState[PLAYER_2]->m_PlayerOptions.m_fScrollSpeed = 2;
|
||||||
GAMESTATE->m_iCurrentStageIndex = 0;
|
GAMESTATE->m_iCurrentStageIndex = 0;
|
||||||
GAMESTATE->m_PlayerOptions[PLAYER_1].ChooseRandomMofifiers();
|
GAMESTATE->m_pPlayerState[PLAYER_1]->m_PlayerOptions.ChooseRandomMofifiers();
|
||||||
GAMESTATE->m_PlayerOptions[PLAYER_2].ChooseRandomMofifiers();
|
GAMESTATE->m_pPlayerState[PLAYER_2]->m_PlayerOptions.ChooseRandomMofifiers();
|
||||||
|
|
||||||
for( float f = 0; f < 100.0f; f += 1.0f )
|
for( float f = 0; f < 100.0f; f += 1.0f )
|
||||||
{
|
{
|
||||||
@@ -410,7 +411,7 @@ void ScreenEvaluation::Init()
|
|||||||
this->AddChild( &m_DifficultyMeter[p] );
|
this->AddChild( &m_DifficultyMeter[p] );
|
||||||
|
|
||||||
m_textPlayerOptions[p].LoadFromFont( THEME->GetPathToF("Common normal") );
|
m_textPlayerOptions[p].LoadFromFont( THEME->GetPathToF("Common normal") );
|
||||||
CString sPO = GAMESTATE->m_PlayerOptions[p].GetThemedString();
|
CString sPO = GAMESTATE->m_pPlayerState[p]->m_PlayerOptions.GetThemedString();
|
||||||
sPO.Replace( ", ", PLAYER_OPTIONS_SEPARATOR );
|
sPO.Replace( ", ", PLAYER_OPTIONS_SEPARATOR );
|
||||||
m_textPlayerOptions[p].SetName( ssprintf("PlayerOptionsP%d",p+1) );
|
m_textPlayerOptions[p].SetName( ssprintf("PlayerOptionsP%d",p+1) );
|
||||||
SET_XY_AND_ON_COMMAND( m_textPlayerOptions[p] );
|
SET_XY_AND_ON_COMMAND( m_textPlayerOptions[p] );
|
||||||
@@ -930,7 +931,7 @@ void ScreenEvaluation::CommitScores(
|
|||||||
hs.iScore = stageStats.iScore[p];
|
hs.iScore = stageStats.iScore[p];
|
||||||
hs.fPercentDP = stageStats.GetPercentDancePoints( p );
|
hs.fPercentDP = stageStats.GetPercentDancePoints( p );
|
||||||
hs.fSurviveSeconds = stageStats.fAliveSeconds[p];
|
hs.fSurviveSeconds = stageStats.fAliveSeconds[p];
|
||||||
hs.sModifiers = GAMESTATE->m_PlayerOptions[p].GetString();
|
hs.sModifiers = GAMESTATE->m_pPlayerState[p]->m_PlayerOptions.GetString();
|
||||||
hs.dateTime = DateTime::GetNowDateTime();
|
hs.dateTime = DateTime::GetNowDateTime();
|
||||||
hs.sPlayerGuid = PROFILEMAN->IsUsingProfile(p) ? PROFILEMAN->GetProfile(p)->m_sGuid : CString("");
|
hs.sPlayerGuid = PROFILEMAN->IsUsingProfile(p) ? PROFILEMAN->GetProfile(p)->m_sGuid : CString("");
|
||||||
hs.sMachineGuid = PROFILEMAN->GetMachineProfile()->m_sGuid;
|
hs.sMachineGuid = PROFILEMAN->GetMachineProfile()->m_sGuid;
|
||||||
|
|||||||
@@ -17,6 +17,7 @@
|
|||||||
#include "MenuTimer.h"
|
#include "MenuTimer.h"
|
||||||
#include "StepsUtil.h"
|
#include "StepsUtil.h"
|
||||||
#include "ScreenDimensions.h"
|
#include "ScreenDimensions.h"
|
||||||
|
#include "PlayerState.h"
|
||||||
|
|
||||||
#define SCROLLING_LIST_X THEME->GetMetricF("ScreenEz2SelectMusic","ScrollingListX")
|
#define SCROLLING_LIST_X THEME->GetMetricF("ScreenEz2SelectMusic","ScrollingListX")
|
||||||
#define SCROLLING_LIST_Y THEME->GetMetricF("ScreenEz2SelectMusic","ScrollingListY")
|
#define SCROLLING_LIST_Y THEME->GetMetricF("ScreenEz2SelectMusic","ScrollingListY")
|
||||||
@@ -309,7 +310,7 @@ void ScreenEz2SelectMusic::Input( const DeviceInput& DeviceI, const InputEventTy
|
|||||||
|
|
||||||
void ScreenEz2SelectMusic::UpdateOptions(PlayerNumber pn, int nosound)
|
void ScreenEz2SelectMusic::UpdateOptions(PlayerNumber pn, int nosound)
|
||||||
{
|
{
|
||||||
sOptions = GAMESTATE->m_PlayerOptions[pn].GetString();
|
sOptions = GAMESTATE->m_pPlayerState[pn]->m_PlayerOptions.GetString();
|
||||||
|
|
||||||
#ifdef DEBUG
|
#ifdef DEBUG
|
||||||
m_debugtext.SetText( "DEBUG: " + sOptions );
|
m_debugtext.SetText( "DEBUG: " + sOptions );
|
||||||
|
|||||||
@@ -13,6 +13,7 @@
|
|||||||
#include "GameSoundManager.h"
|
#include "GameSoundManager.h"
|
||||||
#include "Model.h"
|
#include "Model.h"
|
||||||
#include "ThemeMetric.h"
|
#include "ThemeMetric.h"
|
||||||
|
#include "PlayerState.h"
|
||||||
|
|
||||||
static const ThemeMetric<float> SECONDS_TO_SHOW ("ScreenHowToPlay","SecondsToShow");
|
static const ThemeMetric<float> SECONDS_TO_SHOW ("ScreenHowToPlay","SecondsToShow");
|
||||||
static const ThemeMetric<CString> STEPFILE ("ScreenHowToPlay","Stepfile");
|
static const ThemeMetric<CString> STEPFILE ("ScreenHowToPlay","Stepfile");
|
||||||
@@ -147,16 +148,16 @@ ScreenHowToPlay::ScreenHowToPlay( CString sName ) : ScreenAttract( sName )
|
|||||||
|
|
||||||
GAMESTATE->m_pCurSong = &m_Song;
|
GAMESTATE->m_pCurSong = &m_Song;
|
||||||
GAMESTATE->m_bPastHereWeGo = true;
|
GAMESTATE->m_bPastHereWeGo = true;
|
||||||
GAMESTATE->m_PlayerController[PLAYER_1] = PC_AUTOPLAY;
|
GAMESTATE->m_pPlayerState[PLAYER_1]->m_PlayerController = PC_AUTOPLAY;
|
||||||
|
|
||||||
m_pPlayer = new Player;
|
m_pPlayer = new Player;
|
||||||
m_pPlayer->Load( PLAYER_1, m_NoteData, m_pLifeMeterBar, NULL, NULL, NULL, NULL, NULL, NULL );
|
m_pPlayer->Load( GAMESTATE->m_pPlayerState[PLAYER_1], m_NoteData, m_pLifeMeterBar, NULL, NULL, NULL, NULL, NULL, NULL );
|
||||||
m_pPlayer->SetName( "Player" );
|
m_pPlayer->SetName( "Player" );
|
||||||
this->AddChild( m_pPlayer );
|
this->AddChild( m_pPlayer );
|
||||||
SET_XY_AND_ON_COMMAND( m_pPlayer );
|
SET_XY_AND_ON_COMMAND( m_pPlayer );
|
||||||
|
|
||||||
// Don't show judgement
|
// Don't show judgement
|
||||||
GAMESTATE->m_PlayerOptions[PLAYER_1].m_fBlind = 1;
|
GAMESTATE->m_pPlayerState[PLAYER_1]->m_PlayerOptions.m_fBlind = 1;
|
||||||
GAMESTATE->m_MasterPlayerNumber = PLAYER_1;
|
GAMESTATE->m_MasterPlayerNumber = PLAYER_1;
|
||||||
GAMESTATE->m_bDemonstrationOrJukebox = true;
|
GAMESTATE->m_bDemonstrationOrJukebox = true;
|
||||||
}
|
}
|
||||||
@@ -250,7 +251,7 @@ void ScreenHowToPlay::Update( float fDelta )
|
|||||||
// switch the controller to HUMAN. since we aren't taking input,
|
// switch the controller to HUMAN. since we aren't taking input,
|
||||||
// the steps will always be misses.
|
// the steps will always be misses.
|
||||||
if(m_iPerfects > m_iNumPerfects)
|
if(m_iPerfects > m_iNumPerfects)
|
||||||
GAMESTATE->m_PlayerController[PLAYER_1] = PC_HUMAN;
|
GAMESTATE->m_pPlayerState[PLAYER_1]->m_PlayerController = PC_HUMAN;
|
||||||
|
|
||||||
if ( m_pmCharacter )
|
if ( m_pmCharacter )
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -14,6 +14,8 @@
|
|||||||
#include "UnlockSystem.h"
|
#include "UnlockSystem.h"
|
||||||
#include "Course.h"
|
#include "Course.h"
|
||||||
#include "ThemeManager.h"
|
#include "ThemeManager.h"
|
||||||
|
#include "Style.h"
|
||||||
|
#include "PlayerState.h"
|
||||||
|
|
||||||
// HACK: This belongs in ScreenDemonstration
|
// HACK: This belongs in ScreenDemonstration
|
||||||
#define DIFFICULTIES_TO_SHOW THEME->GetMetric ("ScreenDemonstration","DifficultiesToShow")
|
#define DIFFICULTIES_TO_SHOW THEME->GetMetric ("ScreenDemonstration","DifficultiesToShow")
|
||||||
@@ -133,10 +135,10 @@ bool ScreenJukebox::PrepareForJukebox( bool bDemonstration ) // always return t
|
|||||||
|
|
||||||
/* Lots and lots of arrows. This might even bias to arrows a little
|
/* Lots and lots of arrows. This might even bias to arrows a little
|
||||||
* too much. */
|
* too much. */
|
||||||
GAMESTATE->m_PlayerOptions[p] = PlayerOptions();
|
GAMESTATE->m_pPlayerState[p]->m_PlayerOptions = PlayerOptions();
|
||||||
GAMESTATE->m_PlayerOptions[p].m_fScrollSpeed = .25f;
|
GAMESTATE->m_pPlayerState[p]->m_PlayerOptions.m_fScrollSpeed = .25f;
|
||||||
GAMESTATE->m_PlayerOptions[p].m_fPerspectiveTilt = -1;
|
GAMESTATE->m_pPlayerState[p]->m_PlayerOptions.m_fPerspectiveTilt = -1;
|
||||||
GAMESTATE->m_PlayerOptions[p].m_fEffects[ PlayerOptions::EFFECT_MINI ] = 1;
|
GAMESTATE->m_pPlayerState[p]->m_PlayerOptions.m_fEffects[ PlayerOptions::EFFECT_MINI ] = 1;
|
||||||
}
|
}
|
||||||
GAMESTATE->m_SongOptions.m_LifeType = SongOptions::LIFE_BATTERY;
|
GAMESTATE->m_SongOptions.m_LifeType = SongOptions::LIFE_BATTERY;
|
||||||
GAMESTATE->m_SongOptions.m_FailType = SongOptions::FAIL_OFF;
|
GAMESTATE->m_SongOptions.m_FailType = SongOptions::FAIL_OFF;
|
||||||
@@ -149,9 +151,9 @@ bool ScreenJukebox::PrepareForJukebox( bool bDemonstration ) // always return t
|
|||||||
|
|
||||||
if( GAMESTATE->m_bJukeboxUsesModifiers )
|
if( GAMESTATE->m_bJukeboxUsesModifiers )
|
||||||
{
|
{
|
||||||
GAMESTATE->m_PlayerOptions[p].Init();
|
GAMESTATE->m_pPlayerState[p]->m_PlayerOptions.Init();
|
||||||
GAMESTATE->m_PlayerOptions[p].FromString( PREFSMAN->m_sDefaultModifiers );
|
GAMESTATE->m_pPlayerState[p]->m_PlayerOptions.FromString( PREFSMAN->m_sDefaultModifiers );
|
||||||
GAMESTATE->m_PlayerOptions[p].ChooseRandomMofifiers();
|
GAMESTATE->m_pPlayerState[p]->m_PlayerOptions.ChooseRandomMofifiers();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -18,6 +18,7 @@
|
|||||||
#include "StageStats.h"
|
#include "StageStats.h"
|
||||||
#include "Game.h"
|
#include "Game.h"
|
||||||
#include "ScreenDimensions.h"
|
#include "ScreenDimensions.h"
|
||||||
|
#include "PlayerState.h"
|
||||||
|
|
||||||
|
|
||||||
//
|
//
|
||||||
@@ -123,7 +124,7 @@ ScreenNameEntry::ScreenNameEntry( CString sClassName ) : Screen( sClassName )
|
|||||||
// reset Player and Song Options
|
// reset Player and Song Options
|
||||||
{
|
{
|
||||||
FOREACH_PlayerNumber( p )
|
FOREACH_PlayerNumber( p )
|
||||||
GAMESTATE->m_PlayerOptions[p] = PlayerOptions();
|
GAMESTATE->m_pPlayerState[p]->m_PlayerOptions = PlayerOptions();
|
||||||
GAMESTATE->m_SongOptions = SongOptions();
|
GAMESTATE->m_SongOptions = SongOptions();
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -173,7 +174,7 @@ ScreenNameEntry::ScreenNameEntry( CString sClassName ) : Screen( sClassName )
|
|||||||
continue; // skip
|
continue; // skip
|
||||||
|
|
||||||
// remove modifiers that may have been on the last song
|
// remove modifiers that may have been on the last song
|
||||||
GAMESTATE->m_PlayerOptions[p] = PlayerOptions();
|
GAMESTATE->m_pPlayerState[p]->m_PlayerOptions = PlayerOptions();
|
||||||
|
|
||||||
ASSERT( GAMESTATE->IsHumanPlayer(p) ); // they better be enabled if they made a high score!
|
ASSERT( GAMESTATE->IsHumanPlayer(p) ); // they better be enabled if they made a high score!
|
||||||
|
|
||||||
@@ -182,7 +183,7 @@ ScreenNameEntry::ScreenNameEntry( CString sClassName ) : Screen( sClassName )
|
|||||||
|
|
||||||
float fPlayerX = PLAYER_X(p,GAMESTATE->GetCurrentStyle()->m_StyleType);
|
float fPlayerX = PLAYER_X(p,GAMESTATE->GetCurrentStyle()->m_StyleType);
|
||||||
|
|
||||||
m_ReceptorArrowRow[p].Load( p, GAMESTATE->m_PlayerOptions[p].m_sNoteSkin, 0 );
|
m_ReceptorArrowRow[p].Load( GAMESTATE->m_pPlayerState[p], GAMESTATE->m_pPlayerState[p]->m_PlayerOptions.m_sNoteSkin, 0 );
|
||||||
m_ReceptorArrowRow[p].SetX( fPlayerX );
|
m_ReceptorArrowRow[p].SetX( fPlayerX );
|
||||||
m_ReceptorArrowRow[p].SetY( SCREEN_TOP + 100 );
|
m_ReceptorArrowRow[p].SetY( SCREEN_TOP + 100 );
|
||||||
this->AddChild( &m_ReceptorArrowRow[p] );
|
this->AddChild( &m_ReceptorArrowRow[p] );
|
||||||
|
|||||||
@@ -11,6 +11,7 @@
|
|||||||
#include "CodeDetector.h"
|
#include "CodeDetector.h"
|
||||||
#include "ScreenDimensions.h"
|
#include "ScreenDimensions.h"
|
||||||
#include "Style.h"
|
#include "Style.h"
|
||||||
|
#include "PlayerState.h"
|
||||||
|
|
||||||
|
|
||||||
#define PREV_SCREEN THEME->GetMetric ("ScreenPlayerOptions","PrevScreen")
|
#define PREV_SCREEN THEME->GetMetric ("ScreenPlayerOptions","PrevScreen")
|
||||||
@@ -123,8 +124,8 @@ void ScreenPlayerOptions::Input( const DeviceInput& DeviceI, const InputEventTyp
|
|||||||
SOUND->PlayOnce( THEME->GetPathToS("ScreenPlayerOptions cancel all") );
|
SOUND->PlayOnce( THEME->GetPathToS("ScreenPlayerOptions cancel all") );
|
||||||
|
|
||||||
// apply the game default mods, but not the Profile saved mods
|
// apply the game default mods, but not the Profile saved mods
|
||||||
GAMESTATE->m_PlayerOptions[pn].Init();
|
GAMESTATE->m_pPlayerState[pn]->m_PlayerOptions.Init();
|
||||||
GAMESTATE->m_PlayerOptions[pn].FromString( PREFSMAN->m_sDefaultModifiers );
|
GAMESTATE->m_pPlayerState[pn]->m_PlayerOptions.FromString( PREFSMAN->m_sDefaultModifiers );
|
||||||
|
|
||||||
UtilCommand( m_sprCancelAll[pn], m_sName, "Show" );
|
UtilCommand( m_sprCancelAll[pn], m_sName, "Show" );
|
||||||
|
|
||||||
@@ -176,7 +177,7 @@ void ScreenPlayerOptions::UpdateDisqualified()
|
|||||||
|
|
||||||
FOREACH_PlayerNumber( p )
|
FOREACH_PlayerNumber( p )
|
||||||
{
|
{
|
||||||
po[p] = GAMESTATE->m_PlayerOptions[p];
|
po[p] = GAMESTATE->m_pPlayerState[p]->m_PlayerOptions;
|
||||||
}
|
}
|
||||||
|
|
||||||
// export the currently selection options, which will fill GAMESTATE->m_PlayerOptions
|
// export the currently selection options, which will fill GAMESTATE->m_PlayerOptions
|
||||||
@@ -189,7 +190,7 @@ void ScreenPlayerOptions::UpdateDisqualified()
|
|||||||
m_sprDisqualify[p]->SetHidden( !bIsHandicap );
|
m_sprDisqualify[p]->SetHidden( !bIsHandicap );
|
||||||
|
|
||||||
// restore previous player options in case the user escapes back after this
|
// restore previous player options in case the user escapes back after this
|
||||||
GAMESTATE->m_PlayerOptions[p] = po[p];
|
GAMESTATE->m_pPlayerState[p]->m_PlayerOptions = po[p];
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -24,6 +24,7 @@
|
|||||||
#include "StepsUtil.h"
|
#include "StepsUtil.h"
|
||||||
#include "Foreach.h"
|
#include "Foreach.h"
|
||||||
#include "Style.h"
|
#include "Style.h"
|
||||||
|
#include "PlayerState.h"
|
||||||
|
|
||||||
|
|
||||||
const int NUM_SCORE_DIGITS = 9;
|
const int NUM_SCORE_DIGITS = 9;
|
||||||
@@ -1727,7 +1728,7 @@ void ScreenSelectMusic::UpdateOptionsDisplays()
|
|||||||
{
|
{
|
||||||
m_OptionIconRow[p].Refresh();
|
m_OptionIconRow[p].Refresh();
|
||||||
|
|
||||||
CString s = GAMESTATE->m_PlayerOptions[p].GetString();
|
CString s = GAMESTATE->m_pPlayerState[p]->m_PlayerOptions.GetString();
|
||||||
s.Replace( ", ", "\n" );
|
s.Replace( ", ", "\n" );
|
||||||
// m_textPlayerOptions[p].SetText( s );
|
// m_textPlayerOptions[p].SetText( s );
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -23,6 +23,7 @@
|
|||||||
#include "CommonMetrics.h"
|
#include "CommonMetrics.h"
|
||||||
#include "Game.h"
|
#include "Game.h"
|
||||||
#include "ScreenOptionsMasterPrefs.h"
|
#include "ScreenOptionsMasterPrefs.h"
|
||||||
|
#include "PlayerState.h"
|
||||||
|
|
||||||
|
|
||||||
#define LOGO_ON_COMMAND THEME->GetMetricA("ScreenTitleMenu","LogoOnCommand")
|
#define LOGO_ON_COMMAND THEME->GetMetricA("ScreenTitleMenu","LogoOnCommand")
|
||||||
@@ -362,7 +363,7 @@ void ScreenTitleMenu::HandleScreenMessage( const ScreenMessage SM )
|
|||||||
{
|
{
|
||||||
// apply default options
|
// apply default options
|
||||||
FOREACH_PlayerNumber( p )
|
FOREACH_PlayerNumber( p )
|
||||||
GAMESTATE->m_PlayerOptions[p].FromString( PREFSMAN->m_sDefaultModifiers );
|
GAMESTATE->m_pPlayerState[p]->m_PlayerOptions.FromString( PREFSMAN->m_sDefaultModifiers );
|
||||||
GAMESTATE->m_SongOptions.FromString( PREFSMAN->m_sDefaultModifiers );
|
GAMESTATE->m_SongOptions.FromString( PREFSMAN->m_sDefaultModifiers );
|
||||||
}
|
}
|
||||||
m_aGameCommands[m_Choice].ApplyToAllPlayers();
|
m_aGameCommands[m_Choice].ApplyToAllPlayers();
|
||||||
|
|||||||
@@ -964,6 +964,14 @@ SOURCE=.\PlayerOptions.h
|
|||||||
# End Source File
|
# End Source File
|
||||||
# Begin Source File
|
# Begin Source File
|
||||||
|
|
||||||
|
SOURCE=.\PlayerState.cpp
|
||||||
|
# End Source File
|
||||||
|
# Begin Source File
|
||||||
|
|
||||||
|
SOURCE=.\PlayerState.h
|
||||||
|
# End Source File
|
||||||
|
# Begin Source File
|
||||||
|
|
||||||
SOURCE=.\Preference.cpp
|
SOURCE=.\Preference.cpp
|
||||||
# End Source File
|
# End Source File
|
||||||
# Begin Source File
|
# Begin Source File
|
||||||
|
|||||||
@@ -797,6 +797,12 @@ cl /Zl /nologo /c verstub.cpp /Fo"$(IntDir)"\
|
|||||||
<File
|
<File
|
||||||
RelativePath="PlayerOptions.h">
|
RelativePath="PlayerOptions.h">
|
||||||
</File>
|
</File>
|
||||||
|
<File
|
||||||
|
RelativePath="PlayerState.cpp">
|
||||||
|
</File>
|
||||||
|
<File
|
||||||
|
RelativePath="PlayerState.h">
|
||||||
|
</File>
|
||||||
<File
|
<File
|
||||||
RelativePath="Preference.cpp">
|
RelativePath="Preference.cpp">
|
||||||
</File>
|
</File>
|
||||||
|
|||||||
Reference in New Issue
Block a user