more work on Battle

This commit is contained in:
Chris Danford
2003-02-25 02:51:04 +00:00
parent 5f15c92404
commit 1fca3d67c5
17 changed files with 171 additions and 120 deletions
+6 -4
View File
@@ -596,7 +596,7 @@ ColorNotSelectedDefault=0.1,0.5,0.1,1 // grayed green
HelpText=&UP; &DOWN; to change line &LEFT; &RIGHT; to select between options then press START HelpText=&UP; &DOWN; to change line &LEFT; &RIGHT; to select between options then press START
[ScreenMapControllers] [ScreenMapControllers]
HelpText=Use arrow keys to navigate, ENTER to assign, SPACE to clear, ESCAPE when done. HelpText=Use arrow keys to navigate, ENTER to assign, SPACE to clear, ESCAPE when done.::Some USB adaptors require that you chage "Ignore Joy Axes" in the Input Options screen.
[GhostArrow] [GhostArrow]
ShowSeconds=0.12 ShowSeconds=0.12
@@ -1002,9 +1002,11 @@ ModifiersZoom=0.5
ModifiersHorizAlign=2 ModifiersHorizAlign=2
[Inventory] [Inventory]
NumItemTypes=2 NumItemTypes=3
ItemDurationSeconds=10 ItemDurationSeconds=10
Item1Combo=50 Item1Combo=50
Item1Effect=boost Item1Effect=dizzy
Item2Combo=100 Item2Combo=100
Item2Effect=expand Item2Effect=sudden
Item3Combo=150
Item3Effect=expand
+19 -26
View File
@@ -22,8 +22,6 @@ Actor::Actor()
{ {
m_bFirstUpdate = true; m_bFirstUpdate = true;
m_iNumTweenStates = 0;
m_baseRotation = RageVector3( 0, 0, 0 ); m_baseRotation = RageVector3( 0, 0, 0 );
m_baseScale = RageVector3( 1, 1, 1 ); m_baseScale = RageVector3( 1, 1, 1 );
m_size = RageVector2( 1, 1 ); m_size = RageVector2( 1, 1 );
@@ -166,7 +164,7 @@ void Actor::EndDraw()
void Actor::UpdateTweening( float fDeltaTime ) void Actor::UpdateTweening( float fDeltaTime )
{ {
// update tweening // update tweening
if( m_iNumTweenStates == 0 ) if( m_TweenStates.empty() )
return; return;
// we are performing a tween // we are performing a tween
@@ -186,12 +184,8 @@ void Actor::UpdateTweening( float fDeltaTime )
m_current = TS; m_current = TS;
// delete the head tween // delete the head tween
for( int i=0; i<m_iNumTweenStates-1; i++ ) m_TweenStates.erase( m_TweenStates.begin() );
{ m_TweenInfo.erase( m_TweenInfo.begin() );
m_TweenStates[i] = m_TweenStates[i+1];
m_TweenInfo[i] = m_TweenInfo[i+1];
}
m_iNumTweenStates--;
} }
else // in the middle of tweening. Recalcute the current position. else // in the middle of tweening. Recalcute the current position.
{ {
@@ -266,25 +260,21 @@ void Actor::BeginTweening( float time, TweenType tt )
{ {
ASSERT( time >= 0 ); ASSERT( time >= 0 );
// HACK to keep from out of bounds access.. ASSERT( m_TweenStates.size() < 50 ); // there's no reason for the number of tweens to ever go this large
if( m_iNumTweenStates == MAX_TWEEN_STATES )
{
for( int i=0; i<m_iNumTweenStates-1; i++ )
{
m_TweenStates[i] = m_TweenStates[i+1];
m_TweenInfo[i] = m_TweenInfo[i+1];
}
}
// add a new TweenState to the tail, and initialize it // add a new TweenState to the tail, and initialize it
m_iNumTweenStates++; m_TweenStates.resize( m_TweenStates.size()+1 );
TweenState &TS = m_TweenStates[m_iNumTweenStates-1]; // latest m_TweenInfo.resize( m_TweenInfo.size()+1 );
TweenInfo &TI = m_TweenInfo[m_iNumTweenStates-1]; // latest
if( m_iNumTweenStates >= 2 ) // if there was already a TS on the stack ASSERT( m_TweenStates.size() == m_TweenInfo.size() )
TweenState &TS = m_TweenStates.back(); // latest
TweenInfo &TI = m_TweenInfo.back(); // latest
if( m_TweenStates.size() >= 2 ) // if there was already a TS on the stack
{ {
// initialize the new TS from the last TS in the list // initialize the new TS from the last TS in the list
TS = m_TweenStates[m_iNumTweenStates-2]; TS = m_TweenStates[m_TweenStates.size()-2];
} }
else else
{ {
@@ -300,7 +290,8 @@ void Actor::BeginTweening( float time, TweenType tt )
void Actor::StopTweening() void Actor::StopTweening()
{ {
m_iNumTweenStates = 0; m_TweenStates.clear();
m_TweenInfo.clear();
} }
@@ -329,7 +320,9 @@ void Actor::SetTweenGlow( RageColor c ) { LatestTween().glow = c; };
Actor::TweenState Actor::GetDestTweenState() Actor::TweenState Actor::GetDestTweenState()
{ {
if(!m_iNumTweenStates) return m_current; if( m_TweenStates.empty() ) // not tweening
return m_current;
else
return LatestTween(); return LatestTween();
} }
@@ -571,7 +564,7 @@ float Actor::TweenTime() const
{ {
float tot = 0; float tot = 0;
for(int i = 0; i < m_iNumTweenStates; ++i) for( unsigned i=0; i<m_TweenInfo.size(); ++i )
tot += m_TweenInfo[i].m_fTimeLeftInTween; tot += m_TweenInfo[i].m_fTimeLeftInTween;
return tot; return tot;
+3 -6
View File
@@ -14,8 +14,6 @@
#include "RageTypes.h" #include "RageTypes.h"
const int MAX_TWEEN_STATES = 10;
class Actor class Actor
{ {
public: public:
@@ -251,10 +249,9 @@ protected:
RageVector2 m_size; RageVector2 m_size;
TweenState m_current; TweenState m_current;
TweenState m_start; TweenState m_start;
TweenState m_TweenStates[MAX_TWEEN_STATES]; vector<TweenState> m_TweenStates;
TweenInfo m_TweenInfo[MAX_TWEEN_STATES]; vector<TweenInfo> m_TweenInfo;
int m_iNumTweenStates; TweenState& LatestTween() { ASSERT(m_TweenStates.size()>0); return m_TweenStates.back(); };
TweenState& LatestTween() { ASSERT(m_iNumTweenStates>0 && m_iNumTweenStates<MAX_TWEEN_STATES); return m_TweenStates[m_iNumTweenStates-1]; };
// //
// Temporary variables that are filled just before drawing // Temporary variables that are filled just before drawing
+6 -4
View File
@@ -77,7 +77,7 @@ void Combo::Reset()
m_sprCombo.SetDiffuse( RageColor(1,1,1,0) ); // invisible m_sprCombo.SetDiffuse( RageColor(1,1,1,0) ); // invisible
} }
void Combo::SetScore( TapNoteScore score, int iNumNotesInThisRow ) void Combo::SetScore( TapNoteScore score, int iNumNotesInThisRow, Inventory* pInventory )
{ {
#ifndef DEBUG #ifndef DEBUG
if( PREFSMAN->m_bAutoPlay && !GAMESTATE->m_bDemonstration ) // cheaters never prosper if( PREFSMAN->m_bAutoPlay && !GAMESTATE->m_bDemonstration ) // cheaters never prosper
@@ -158,16 +158,18 @@ void Combo::SetScore( TapNoteScore score, int iNumNotesInThisRow )
case TNS_GOOD: case TNS_GOOD:
case TNS_BOO: case TNS_BOO:
case TNS_MISS: case TNS_MISS:
{
// end combo // end combo
if( m_iCurCombo > 50 ) bool bItemAcquired = pInventory->OnComboBroken( m_PlayerNumber, m_iCurCombo );
SCREENMAN->SendMessageToTopScreen( SM_ComboStopped, 0 );
GAMESTATE->m_Inventory[m_PlayerNumber].OnComboBroken( m_iCurCombo ); if( !bItemAcquired && m_iCurCombo>50 ) // don't play "combo stopped" if we got an item
SCREENMAN->SendMessageToTopScreen( SM_ComboStopped, 0 );
m_iCurCombo = 0; m_iCurCombo = 0;
m_textComboNumber.SetDiffuse( RageColor(1,1,1,0) ); // invisible m_textComboNumber.SetDiffuse( RageColor(1,1,1,0) ); // invisible
m_sprCombo.SetDiffuse( RageColor(1,1,1,0) ); // invisible m_sprCombo.SetDiffuse( RageColor(1,1,1,0) ); // invisible
}
break; break;
default: default:
ASSERT(0); ASSERT(0);
+2 -2
View File
@@ -15,7 +15,7 @@
#include "Sprite.h" #include "Sprite.h"
#include "BitmapText.h" #include "BitmapText.h"
#include "GameConstantsAndTypes.h" // for TapNoteScore #include "GameConstantsAndTypes.h" // for TapNoteScore
class Inventory;
class Combo : public ActorFrame class Combo : public ActorFrame
@@ -25,7 +25,7 @@ public:
void Init( PlayerNumber pn ) { m_PlayerNumber = pn; } void Init( PlayerNumber pn ) { m_PlayerNumber = pn; }
void SetScore( TapNoteScore score, int iNumNotesInThisRow ); void SetScore( TapNoteScore score, int iNumNotesInThisRow, Inventory* pInventory );
int GetCurrentCombo() const { return m_iCurCombo; } int GetCurrentCombo() const { return m_iCurCombo; }
int GetMaxCombo() const { return m_iMaxCombo; } int GetMaxCombo() const { return m_iMaxCombo; }
+7
View File
@@ -218,4 +218,11 @@ const int MAX_RANKING_NAME_LENGTH = 4;
const CString GROUP_ALL_MUSIC = ""; const CString GROUP_ALL_MUSIC = "";
//
// Battle stuff
//
const int ITEM_NONE = -1;
const int NUM_ITEM_SLOTS = 3;
#endif #endif
+2 -1
View File
@@ -115,7 +115,8 @@ void GameState::ResetMusicStatistics()
m_bPastHereWeGo = false; m_bPastHereWeGo = false;
for( int p=0; p<NUM_PLAYERS; p++ ) for( int p=0; p<NUM_PLAYERS; p++ )
m_Inventory[p].Reset(); for( int s=0; s<NUM_ITEM_SLOTS; s++ )
m_iItems[p][s] = ITEM_NONE;
} }
void GameState::UpdateSongPosition(float fPositionSeconds) void GameState::UpdateSongPosition(float fPositionSeconds)
+1 -2
View File
@@ -18,7 +18,6 @@
#include "Style.h" #include "Style.h"
#include "Grade.h" #include "Grade.h"
#include "StageStats.h" #include "StageStats.h"
#include "Inventory.h"
class Song; class Song;
@@ -124,7 +123,7 @@ public:
// courses separately from the active options. // courses separately from the active options.
SongOptions m_SongOptions; SongOptions m_SongOptions;
Inventory m_Inventory[NUM_PLAYERS]; int m_iItems[NUM_PLAYERS][NUM_ITEM_SLOTS];
bool HasEarnedExtraStage(); bool HasEarnedExtraStage();
bool m_bAllow2ndExtraStage; //only used when "Allow Selection of Extra Stage is on" bool m_bAllow2ndExtraStage; //only used when "Allow Selection of Extra Stage is on"
+25 -27
View File
@@ -22,26 +22,12 @@
#define ITEM_EFFECT( i ) THEME->GetMetric ("Inventory",ssprintf("Item%dEffect",i+1)) #define ITEM_EFFECT( i ) THEME->GetMetric ("Inventory",ssprintf("Item%dEffect",i+1))
bool ItemDef::operator<( const ItemDef& other )
{
return comboLevel < other.comboLevel;
}
void ItemDef::Sort( vector<ItemDef>& items )
{
sort( items.begin(), items.end() );
}
Inventory::Inventory() Inventory::Inventory()
{ {
Reset(); RefreshPossibleItems();
}
void Inventory::Reset() m_soundAcquireItem.Load( THEME->GetPathTo("Sounds","gameplay battle aquire item") );
{ m_soundUseItem.Load( THEME->GetPathTo("Sounds","gameplay battle use item") );
for( int i=0; i<NUM_ITEM_SLOTS; i++ )
m_iItems[i] = ITEM_NONE;
} }
void Inventory::RefreshPossibleItems() void Inventory::RefreshPossibleItems()
@@ -57,8 +43,10 @@ void Inventory::RefreshPossibleItems()
} }
} }
void Inventory::OnComboBroken( int iCombo ) bool Inventory::OnComboBroken( PlayerNumber pn, int iCombo )
{ {
int* iItems = GAMESTATE->m_iItems[pn];
// search for the item acquired // search for the item acquired
for( int item=0; item<(int)m_ItemDefs.size(); item++ ) for( int item=0; item<(int)m_ItemDefs.size(); item++ )
if( m_ItemDefs[item].comboLevel > iCombo ) if( m_ItemDefs[item].comboLevel > iCombo )
@@ -67,7 +55,7 @@ void Inventory::OnComboBroken( int iCombo )
item--; // back up because we went one too far item--; // back up because we went one too far
if( item == -1 ) // no item acquired if( item == -1 ) // no item acquired
return; return false;
else else
{ {
// give them an item // give them an item
@@ -75,12 +63,12 @@ void Inventory::OnComboBroken( int iCombo )
// search for the first open slot // search for the first open slot
int iOpenSlot = -1; int iOpenSlot = -1;
if( m_iItems[NUM_ITEM_SLOTS/2] == ITEM_NONE ) if( iItems[NUM_ITEM_SLOTS/2] == ITEM_NONE )
iOpenSlot = NUM_ITEM_SLOTS/2; iOpenSlot = NUM_ITEM_SLOTS/2;
else else
{ {
for( int s=0; s<NUM_ITEM_SLOTS; s++ ) for( int s=0; s<NUM_ITEM_SLOTS; s++ )
if( m_iItems[s] == ITEM_NONE ) if( iItems[s] == ITEM_NONE )
{ {
iOpenSlot = s; iOpenSlot = s;
break; break;
@@ -88,18 +76,26 @@ void Inventory::OnComboBroken( int iCombo )
} }
if( iOpenSlot != -1 ) if( iOpenSlot != -1 )
m_iItems[iOpenSlot] = item; {
else iItems[iOpenSlot] = item;
; // not enough room to insert item m_soundAcquireItem.Play();
} }
// else not enough room to insert item
}
return true;
} }
void Inventory::UseItem( PlayerNumber pn, int iSlot ) void Inventory::UseItem( PlayerNumber pn, int iSlot )
{ {
if( m_iItems[iSlot] == ITEM_NONE ) int* iItems = GAMESTATE->m_iItems[pn];
if( iItems[iSlot] == ITEM_NONE )
return; return;
const ItemDef& def = m_ItemDefs[iSlot]; int iItemIndex = iItems[iSlot];
const ItemDef& def = m_ItemDefs[iItemIndex];
PlayerNumber pnToAttack; PlayerNumber pnToAttack;
switch( pn ) switch( pn )
@@ -112,6 +108,8 @@ void Inventory::UseItem( PlayerNumber pn, int iSlot )
GAMESTATE->m_PlayerOptions[pnToAttack].FromString( def.effect ); GAMESTATE->m_PlayerOptions[pnToAttack].FromString( def.effect );
// remove the item // remove the item
m_iItems[iSlot] = ITEM_NONE; iItems[iSlot] = ITEM_NONE;
m_soundUseItem.Play();
} }
+13 -12
View File
@@ -12,19 +12,10 @@
*/ */
#include "GameConstantsAndTypes.h" #include "GameConstantsAndTypes.h"
#include "RageSound.h"
const int ITEM_NONE = -1;
const int NUM_ITEM_SLOTS = 3;
const int MAX_ITEM_TYPES = 20; const int MAX_ITEM_TYPES = 20;
struct ItemDef
{
int comboLevel;
CString effect;
bool operator<( const ItemDef& other );
void Sort( vector<ItemDef>& items );
};
class Inventory class Inventory
{ {
@@ -33,11 +24,21 @@ public:
void Reset(); void Reset();
void RefreshPossibleItems(); void RefreshPossibleItems();
void OnComboBroken( int iCombo ); bool OnComboBroken( PlayerNumber pn, int iCombo );
void UseItem( PlayerNumber pn, int iSlot ); void UseItem( PlayerNumber pn, int iSlot );
struct ItemDef
{
int comboLevel;
CString effect;
bool operator<( const ItemDef& other ) { return comboLevel < other.comboLevel; }
void Sort( vector<ItemDef>& items ) { sort( items.begin(), items.end() ); }
};
vector<ItemDef> m_ItemDefs; vector<ItemDef> m_ItemDefs;
int m_iItems[NUM_ITEM_SLOTS];
RageSound m_soundAcquireItem;
RageSound m_soundUseItem;
}; };
#endif #endif
+15 -11
View File
@@ -27,6 +27,8 @@
#include "RageDisplay.h" #include "RageDisplay.h"
#include "ThemeManager.h" #include "ThemeManager.h"
#include "Combo.h" #include "Combo.h"
#include "ScoreDisplay.h"
#include "LifeMeter.h"
#define GRAY_ARROWS_Y THEME->GetMetricF("Player","GrayArrowsY") #define GRAY_ARROWS_Y THEME->GetMetricF("Player","GrayArrowsY")
#define JUDGMENT_Y THEME->GetMetricF("Player","JudgmentY") #define JUDGMENT_Y THEME->GetMetricF("Player","JudgmentY")
@@ -45,7 +47,8 @@ Player::Player()
m_pLifeMeter = NULL; m_pLifeMeter = NULL;
m_pScore = NULL; m_pScore = NULL;
m_ScoreKeeper = NULL; m_pScoreKeeper = NULL;
m_pInventory = NULL;
m_iOffsetSample = 0; m_iOffsetSample = 0;
@@ -65,16 +68,17 @@ int Player::GetPlayersMaxCombo()
Player::~Player() Player::~Player()
{ {
delete m_ScoreKeeper; delete m_pScoreKeeper;
} }
void Player::Load( PlayerNumber pn, NoteData* pNoteData, LifeMeter* pLM, ScoreDisplay* pScore ) void Player::Load( PlayerNumber pn, NoteData* pNoteData, LifeMeter* pLM, ScoreDisplay* pScore, Inventory* pInventory )
{ {
//LOG->Trace( "Player::Load()", ); //LOG->Trace( "Player::Load()", );
m_PlayerNumber = pn; m_PlayerNumber = pn;
m_pLifeMeter = pLM; m_pLifeMeter = pLM;
m_pScore = pScore; m_pScore = pScore;
m_pInventory = pInventory;
const StyleDef* pStyleDef = GAMESTATE->GetCurrentStyleDef(); const StyleDef* pStyleDef = GAMESTATE->GetCurrentStyleDef();
@@ -94,8 +98,8 @@ void Player::Load( PlayerNumber pn, NoteData* pNoteData, LifeMeter* pLM, ScoreDi
m_Combo.Init( pn ); m_Combo.Init( pn );
m_Judgment.Reset(); m_Judgment.Reset();
if(m_ScoreKeeper) delete m_ScoreKeeper; if(m_pScoreKeeper) delete m_pScoreKeeper;
m_ScoreKeeper = new ScoreKeeperMAX2(GAMESTATE->m_pCurNotes[m_PlayerNumber], *this, pn); m_pScoreKeeper = new ScoreKeeperMAX2(GAMESTATE->m_pCurNotes[m_PlayerNumber], *this, pn);
if( m_pScore ) if( m_pScore )
m_pScore->Init( pn ); m_pScore->Init( pn );
@@ -489,7 +493,7 @@ void Player::OnRowDestroyed( int iIndexThatWasSteppedOn )
if( iNumNotesInThisRow > 0 ) if( iNumNotesInThisRow > 0 )
{ {
HandleNoteScore( score, iNumNotesInThisRow ); // update score HandleNoteScore( score, iNumNotesInThisRow ); // update score
m_Combo.SetScore( score, iNumNotesInThisRow ); m_Combo.SetScore( score, iNumNotesInThisRow, m_pInventory );
GAMESTATE->m_CurStageStats.iMaxCombo[m_PlayerNumber] = max( GAMESTATE->m_CurStageStats.iMaxCombo[m_PlayerNumber], m_Combo.GetCurrentCombo() ); GAMESTATE->m_CurStageStats.iMaxCombo[m_PlayerNumber] = max( GAMESTATE->m_CurStageStats.iMaxCombo[m_PlayerNumber], m_Combo.GetCurrentCombo() );
} }
@@ -531,7 +535,7 @@ int Player::UpdateTapNotesMissedOlderThan( float fMissIfOlderThanSeconds )
if( iNumMissesThisRow > 0 ) if( iNumMissesThisRow > 0 )
{ {
HandleNoteScore( TNS_MISS, iNumMissesThisRow ); HandleNoteScore( TNS_MISS, iNumMissesThisRow );
m_Combo.SetScore( TNS_MISS, iNumMissesThisRow ); m_Combo.SetScore( TNS_MISS, iNumMissesThisRow, m_pInventory );
} }
} }
@@ -568,8 +572,8 @@ void Player::HandleNoteScore( TapNoteScore score, int iNumTapsInRow )
return; return;
#endif //DEBUG #endif //DEBUG
if(m_ScoreKeeper) if(m_pScoreKeeper)
m_ScoreKeeper->HandleNoteScore(score, iNumTapsInRow); m_pScoreKeeper->HandleNoteScore(score, iNumTapsInRow);
if (m_pScore) if (m_pScore)
m_pScore->SetScore(GAMESTATE->m_CurStageStats.fScore[m_PlayerNumber]); m_pScore->SetScore(GAMESTATE->m_CurStageStats.fScore[m_PlayerNumber]);
@@ -589,8 +593,8 @@ void Player::HandleHoldNoteScore( HoldNoteScore score, TapNoteScore TapNoteScore
return; return;
#endif //DEBUG #endif //DEBUG
if(m_ScoreKeeper) { if(m_pScoreKeeper) {
m_ScoreKeeper->HandleHoldNoteScore(score, TapNoteScore); m_pScoreKeeper->HandleHoldNoteScore(score, TapNoteScore);
} }
if (m_pScore) if (m_pScore)
+7 -5
View File
@@ -22,8 +22,6 @@
#include "HoldGhostArrow.h" #include "HoldGhostArrow.h"
#include "ActorFrame.h" #include "ActorFrame.h"
#include "RandomSample.h" #include "RandomSample.h"
#include "ScoreDisplay.h"
#include "LifeMeterBar.h"
#include "Judgment.h" #include "Judgment.h"
#include "HoldJudgment.h" #include "HoldJudgment.h"
#include "Combo.h" #include "Combo.h"
@@ -31,7 +29,10 @@
#include "GrayArrowRow.h" #include "GrayArrowRow.h"
#include "GhostArrowRow.h" #include "GhostArrowRow.h"
#include "NoteDataWithScoring.h" #include "NoteDataWithScoring.h"
#include "ScoreKeeper.h" class ScoreDisplay;
class LifeMeter;
class ScoreKeeper;
class Inventory;
#define SAMPLE_COUNT 16 #define SAMPLE_COUNT 16
@@ -44,7 +45,7 @@ public:
virtual void DrawPrimitives(); virtual void DrawPrimitives();
~Player(); ~Player();
void Load( PlayerNumber player_no, NoteData* pNoteData, LifeMeter* pLM, ScoreDisplay* pScore ); void Load( PlayerNumber player_no, NoteData* pNoteData, LifeMeter* pLM, ScoreDisplay* pScore, Inventory* pInventory );
void CrossedRow( int iNoteRow ); void CrossedRow( int iNoteRow );
void Step( int col ); void Step( int col );
int GetPlayersMaxCombo(); int GetPlayersMaxCombo();
@@ -79,7 +80,8 @@ protected:
LifeMeter* m_pLifeMeter; LifeMeter* m_pLifeMeter;
ScoreDisplay* m_pScore; ScoreDisplay* m_pScore;
ScoreKeeper* m_ScoreKeeper; ScoreKeeper* m_pScoreKeeper;
Inventory* m_pInventory;
}; };
#endif #endif
+45 -6
View File
@@ -45,15 +45,54 @@ void ScoreDisplayBattle::Update( float fDelta )
{ {
ScoreDisplay::Update( fDelta ); ScoreDisplay::Update( fDelta );
for( int i=0; i<NUM_ITEM_SLOTS; i++ ) for( int s=0; s<NUM_ITEM_SLOTS; s++ )
{ {
int item = GAMESTATE->m_Inventory[m_PlayerNumber].m_iItems[i]; int iNewItem = GAMESTATE->m_iItems[m_PlayerNumber][s];
if( item == ITEM_NONE ) int iOldItem = m_iLastSeenItems[s];
m_sprItems[i].SetDiffuse( RageColor(1,1,1,0) );
m_iLastSeenItems[s] = iNewItem;
if( iNewItem != iOldItem ) // there was a change of items
{
if( iNewItem == ITEM_NONE )
{
m_sprItems[s].StopTweening();
m_sprItems[s].SetDiffuse( RageColor(1,1,1,0) );
}
else else
{ {
m_sprItems[i].SetDiffuse( RageColor(1,1,1,1) ); m_sprItems[s].SetDiffuse( RageColor(1,1,1,1) );
m_sprItems[i].SetState( item ); m_sprItems[s].SetState( iNewItem );
// blink
m_sprItems[s].StopTweening();
m_sprItems[s].BeginTweening( 0.1f ); // sleep
m_sprItems[s].SetTweenDiffuse( RageColor(1,1,1,1) );
m_sprItems[s].BeginTweening( 0.1f ); // sleep
m_sprItems[s].BeginTweening( 0.001f ); // snap
m_sprItems[s].SetTweenDiffuse( RageColor(1,1,1,0) );
m_sprItems[s].BeginTweening( 0.1f ); // sleep
m_sprItems[s].BeginTweening( 0.001f ); // snap
m_sprItems[s].SetTweenDiffuse( RageColor(1,1,1,1) );
m_sprItems[s].BeginTweening( 0.1f ); // sleep
m_sprItems[s].BeginTweening( 0.001f ); // snap
m_sprItems[s].SetTweenDiffuse( RageColor(1,1,1,0) );
m_sprItems[s].BeginTweening( 0.1f ); // sleep
m_sprItems[s].BeginTweening( 0.001f ); // snap
m_sprItems[s].SetTweenDiffuse( RageColor(1,1,1,1) );
m_sprItems[s].BeginTweening( 0.1f ); // sleep
m_sprItems[s].BeginTweening( 0.001f ); // snap
m_sprItems[s].SetTweenDiffuse( RageColor(1,1,1,0) );
m_sprItems[s].BeginTweening( 0.1f ); // sleep
m_sprItems[s].BeginTweening( 0.001f ); // snap
m_sprItems[s].SetTweenDiffuse( RageColor(1,1,1,1) );
m_sprItems[s].BeginTweening( 0.1f ); // sleep
m_sprItems[s].BeginTweening( 0.001f ); // snap
m_sprItems[s].SetTweenDiffuse( RageColor(1,1,1,0) );
m_sprItems[s].BeginTweening( 0.1f ); // sleep
m_sprItems[s].BeginTweening( 0.001f ); // snap
m_sprItems[s].SetTweenDiffuse( RageColor(1,1,1,1) );
}
} }
} }
} }
+2
View File
@@ -27,6 +27,8 @@ public:
protected: protected:
Sprite m_sprFrames[NUM_ITEM_SLOTS]; Sprite m_sprFrames[NUM_ITEM_SLOTS];
Sprite m_sprItems[NUM_ITEM_SLOTS]; Sprite m_sprItems[NUM_ITEM_SLOTS];
int m_iLastSeenItems[NUM_ITEM_SLOTS];
}; };
#endif #endif
+2 -2
View File
@@ -252,7 +252,7 @@ ScreenEdit::ScreenEdit()
NOTESKIN->SwitchNoteSkin( PLAYER_1, "default" ); // change noteskin back to default before loading player NOTESKIN->SwitchNoteSkin( PLAYER_1, "default" ); // change noteskin back to default before loading player
m_Player.Load( PLAYER_1, &noteData, NULL, NULL ); m_Player.Load( PLAYER_1, &noteData, NULL, NULL, NULL );
m_Player.SetXY( PLAYER_X, PLAYER_Y ); m_Player.SetXY( PLAYER_X, PLAYER_Y );
m_Fade.SetClosed(); m_Fade.SetClosed();
@@ -1312,7 +1312,7 @@ void ScreenEdit::HandleAreaMenuChoice( AreaMenuChoice c, int* iAnswers )
m_EditMode = MODE_PLAYING; m_EditMode = MODE_PLAYING;
m_Player.Load( PLAYER_1, (NoteData*)&m_NoteFieldEdit, NULL, NULL ); m_Player.Load( PLAYER_1, (NoteData*)&m_NoteFieldEdit, NULL, NULL, NULL );
m_rectRecordBack.StopTweening(); m_rectRecordBack.StopTweening();
m_rectRecordBack.BeginTweening( 0.5f ); m_rectRecordBack.BeginTweening( 0.5f );
+4 -4
View File
@@ -330,8 +330,6 @@ ScreenGameplay::ScreenGameplay( bool bDemonstration )
ASSERT(0); ASSERT(0);
} }
GAMESTATE->m_Inventory[p].RefreshPossibleItems();
m_pScoreDisplay[p]->Init( (PlayerNumber)p ); m_pScoreDisplay[p]->Init( (PlayerNumber)p );
m_pScoreDisplay[p]->SetXY( SCORE_X(p), SCORE_Y(p,bExtra) ); m_pScoreDisplay[p]->SetXY( SCORE_X(p), SCORE_Y(p,bExtra) );
m_pScoreDisplay[p]->SetZoom( SCORE_ZOOM ); m_pScoreDisplay[p]->SetZoom( SCORE_ZOOM );
@@ -475,6 +473,8 @@ ScreenGameplay::ScreenGameplay( bool bDemonstration )
StartPlayingSong( 0, 0 ); StartPlayingSong( 0, 0 );
} }
m_Inventory.RefreshPossibleItems();
m_iRowLastCrossed = -1; m_iRowLastCrossed = -1;
@@ -589,7 +589,7 @@ void ScreenGameplay::LoadNextSong()
NoteData pNewNoteData; NoteData pNewNoteData;
pStyleDef->GetTransformedNoteDataForStyle( (PlayerNumber)p, &pOriginalNoteData, &pNewNoteData ); pStyleDef->GetTransformedNoteDataForStyle( (PlayerNumber)p, &pOriginalNoteData, &pNewNoteData );
m_Player[p].Load( (PlayerNumber)p, &pNewNoteData, m_pLifeMeter[p], m_pScoreDisplay[p] ); m_Player[p].Load( (PlayerNumber)p, &pNewNoteData, m_pLifeMeter[p], m_pScoreDisplay[p], &m_Inventory );
} }
/* Set up song-specific graphics. */ /* Set up song-specific graphics. */
@@ -1027,7 +1027,7 @@ void ScreenGameplay::Input( const DeviceInput& DeviceI, const InputEventType typ
} }
if( iItemSlot != -1 ) if( iItemSlot != -1 )
GAMESTATE->m_Inventory[MenuI.player].UseItem( MenuI.player, iItemSlot ); m_Inventory.UseItem( MenuI.player, iItemSlot );
} }
} }
+4
View File
@@ -29,6 +29,8 @@
#include "DifficultyIcon.h" #include "DifficultyIcon.h"
#include "BPMDisplay.h" #include "BPMDisplay.h"
#include "FocusingSprite.h" #include "FocusingSprite.h"
#include "Inventory.h"
// messages sent by Combo // messages sent by Combo
const ScreenMessage SM_BeginToasty = ScreenMessage(SM_User+104); const ScreenMessage SM_BeginToasty = ScreenMessage(SM_User+104);
@@ -126,6 +128,8 @@ protected:
Player m_Player[NUM_PLAYERS]; Player m_Player[NUM_PLAYERS];
Inventory m_Inventory;
DifficultyIcon m_DifficultyIcon[NUM_PLAYERS]; DifficultyIcon m_DifficultyIcon[NUM_PLAYERS];
Sprite m_sprOniGameOver[NUM_PLAYERS]; Sprite m_sprOniGameOver[NUM_PLAYERS];