diff --git a/stepmania/Themes/default/metrics.ini b/stepmania/Themes/default/metrics.ini index a525b0e068..d5c528a49b 100644 --- a/stepmania/Themes/default/metrics.ini +++ b/stepmania/Themes/default/metrics.ini @@ -376,7 +376,17 @@ DifficultyP2X=580 DifficultyP2Y=410 DifficultyP2ReverseY=58 DifficultyP2ExtraY=420 -DifficultyP2ExtraReverseY=420 +DifficultyP2ExtraReverseY=70 +ActiveItemsP1X=280 +ActiveItemsP1Y=370 +ActiveItemsP1ReverseY=98 +ActiveItemsP1ExtraY=380 +ActiveItemsP1ExtraReverseY=110 +ActiveItemsP2X=340 +ActiveItemsP2Y=370 +ActiveItemsP2ReverseY=98 +ActiveItemsP2ExtraY=380 +ActiveItemsP2ExtraReverseY=110 SurviveTimeX=320 SurviveTimeY=340 DebugX=320 @@ -721,7 +731,7 @@ ExtraColor=0.6,0.0,0.0,1 // dark red [GrayArrow] StepZoom=0.75 -StepSeconds=0.13 +StepSeconds=0.10 [CodeDetector] Easier1=Up,Up @@ -1007,9 +1017,15 @@ ModifiersHorizAlign=2 [Inventory] NumItemTypes=3 ItemDurationSeconds=10 -Item1Combo=50 +Item1Combo=25 Item1Effect=dizzy -Item2Combo=100 +Item2Combo=50 Item2Effect=sudden -Item3Combo=150 +Item3Combo=75 Item3Effect=expand + +[ActiveItemList] +TextHorizAlignP1=2 +TextHorizAlignP2=0 +TextZoom=0.8 +SpacingY=24 diff --git a/stepmania/src/ActiveItemList.cpp b/stepmania/src/ActiveItemList.cpp new file mode 100644 index 0000000000..6bf7228f1f --- /dev/null +++ b/stepmania/src/ActiveItemList.cpp @@ -0,0 +1,87 @@ +#include "global.h" +/* +----------------------------------------------------------------------------- + File: ActiveItemList.h + + Desc: A graphic displayed in the ActiveItemList during Dancing. + + Copyright (c) 2001-2002 by the person(s) listed below. All rights reserved. + Chris Danford +----------------------------------------------------------------------------- +*/ + +#include "ActiveItemList.h" +#include "RageUtil.h" +#include "GameState.h" +#include "ThemeManager.h" +#include "Inventory.h" +#include "RageTimer.h" + + +#define TEXT_HORIZ_ALIGN( p ) THEME->GetMetricI("ActiveItemList",ssprintf("TextHorizAlignP%d",p+1)) +#define TEXT_ZOOM THEME->GetMetricF("ActiveItemList","TextZoom") +#define SPACING_Y THEME->GetMetricF("ActiveItemList","SpacingY") + + +ActiveItemList::ActiveItemList() +{ + m_pInventory = NULL; + + for( int i=0; iGetPathTo("Fonts","normal") ); + m_text[i].SetZoom( TEXT_ZOOM ); +// m_text[i].SetText( "WWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWW" ); + this->AddChild( &m_text[i] ); + } +} + +void ActiveItemList::Init( PlayerNumber pn, Inventory* pInventory ) +{ + m_PlayerNumber = pn; + m_pInventory = pInventory; + + for( int i=0; im_PlayerOptions[pn].m_bReverseScroll; + float fHeight = SPACING_Y*MAX_ACTIVE_ITEMS_LINES * (bReverse ? 1 : -1 ); + float fY = SCALE(i,0.f,MAX_ACTIVE_ITEMS_LINES,0.f,fHeight); + m_text[i].SetY( fY ); + } + +} + + +void ActiveItemList::Update( float fDelta ) +{ + ActorFrame::Update( fDelta ); + + + if( m_pInventory ) + { + // refresh text only once every second + float fNowSeconds = RageTimer::GetTimeSinceStart(); + float fLastSeconds = RageTimer::GetTimeSinceStart() - fDelta; + + if( (int)fNowSeconds != (int)fLastSeconds ) + { + int iNumActiveItems = m_pInventory->m_ActiveItems[m_PlayerNumber].size(); + for( int i=0; im_ActiveItems[m_PlayerNumber][i]; + const Inventory::ItemDef& item_def = m_pInventory->m_ItemDefs[ active_item.iItemDefIndex ]; + + int iDisplaySecondsLeft = (int)(active_item.fSecondsLeft+1); + m_text[i].SetText( ssprintf("%s %02d:%02d", item_def.effect.GetString(), iDisplaySecondsLeft/60, iDisplaySecondsLeft%60) ); + } + else + { + m_text[i].SetText( "" ); + } + } + } + } +} diff --git a/stepmania/src/ActiveItemList.h b/stepmania/src/ActiveItemList.h new file mode 100644 index 0000000000..013748d31f --- /dev/null +++ b/stepmania/src/ActiveItemList.h @@ -0,0 +1,40 @@ +#ifndef _ActiveItemList_H_ +#define _ActiveItemList_H_ +/* +----------------------------------------------------------------------------- + File: ActiveItemList.h + + Desc: A graphic displayed in the ActiveItemList during Dancing. + + Copyright (c) 2001-2002 by the person(s) listed below. All rights reserved. + Chris Danford +----------------------------------------------------------------------------- +*/ + +#include "Sprite.h" +#include "ActorFrame.h" +#include "BitmapText.h" +#include "PlayerNumber.h" +class Inventory; + + +const int MAX_ACTIVE_ITEMS_LINES = 10; + + +class ActiveItemList : public ActorFrame +{ +public: + ActiveItemList(); + + void Init( PlayerNumber pn, Inventory* pInventory ); + + virtual void Update( float fDelta ); + +protected: + BitmapText m_text[MAX_ACTIVE_ITEMS_LINES]; + + PlayerNumber m_PlayerNumber; + Inventory* m_pInventory; +}; + +#endif diff --git a/stepmania/src/Combo.cpp b/stepmania/src/Combo.cpp index 088e30d5b9..8e6da804bb 100644 --- a/stepmania/src/Combo.cpp +++ b/stepmania/src/Combo.cpp @@ -159,13 +159,16 @@ void Combo::SetScore( TapNoteScore score, int iNumNotesInThisRow, Inventory* pIn case TNS_BOO: case TNS_MISS: { - // end combo - bool bItemAcquired = false; - if( pInventory ) - bItemAcquired = pInventory->OnComboBroken( m_PlayerNumber, m_iCurCombo ); - - if( !bItemAcquired && m_iCurCombo>50 ) // don't play "combo stopped" if we got an item - SCREENMAN->SendMessageToTopScreen( SM_ComboStopped, 0 ); + // don't play "combo stopped" in battle + switch( GAMESTATE->m_PlayMode ) + { + case PLAY_MODE_BATTLE: + if( pInventory ) + pInventory->OnComboBroken( m_PlayerNumber, m_iCurCombo ); + default: + if( m_iCurCombo>50 ) + SCREENMAN->SendMessageToTopScreen( SM_ComboStopped, 0 ); + } m_iCurCombo = 0; diff --git a/stepmania/src/Combo.h b/stepmania/src/Combo.h index 0d71f6f7d2..1b82e20f48 100644 --- a/stepmania/src/Combo.h +++ b/stepmania/src/Combo.h @@ -14,6 +14,7 @@ #include "ActorFrame.h" #include "Sprite.h" #include "BitmapText.h" +#include "PlayerNumber.h" #include "GameConstantsAndTypes.h" // for TapNoteScore class Inventory; diff --git a/stepmania/src/Course.h b/stepmania/src/Course.h index 819d377b5b..b6a293ab04 100644 --- a/stepmania/src/Course.h +++ b/stepmania/src/Course.h @@ -11,6 +11,7 @@ ----------------------------------------------------------------------------- */ +#include "PlayerNumber.h" #include "GameConstantsAndTypes.h" struct PlayerOptions; diff --git a/stepmania/src/DifficultyIcon.h b/stepmania/src/DifficultyIcon.h index b8fc964e86..20b1ef1f27 100644 --- a/stepmania/src/DifficultyIcon.h +++ b/stepmania/src/DifficultyIcon.h @@ -12,9 +12,10 @@ */ #include "Sprite.h" -#include "GameConstantsAndTypes.h" +#include "PlayerNumber.h" struct Notes; + class DifficultyIcon : public Sprite { public: diff --git a/stepmania/src/GameConstantsAndTypes.cpp b/stepmania/src/GameConstantsAndTypes.cpp index 8902536494..70ca9efc13 100644 --- a/stepmania/src/GameConstantsAndTypes.cpp +++ b/stepmania/src/GameConstantsAndTypes.cpp @@ -11,10 +11,7 @@ */ #include "GameConstantsAndTypes.h" -#include "ThemeManager.h" -#define COLOR_P1 THEME->GetMetricC("Common","ColorP1") -#define COLOR_P2 THEME->GetMetricC("Common","ColorP2") CString DifficultyToString( Difficulty dc ) @@ -75,21 +72,6 @@ PlayMode StringToPlayMode( CString s ) } -RageColor PlayerToColor( PlayerNumber pn ) -{ - switch( pn ) - { - case PLAYER_1: return COLOR_P1; - case PLAYER_2: return COLOR_P2; - default: ASSERT(0); return RageColor(0.5f,0.5f,0.5f,1); - } -}; - -RageColor PlayerToColor( int p ) -{ - return PlayerToColor( (PlayerNumber)p ); -} - RankingCategory AverageMeterToRankingCategory( float fAverageMeter ) { diff --git a/stepmania/src/GameConstantsAndTypes.h b/stepmania/src/GameConstantsAndTypes.h index 43760e5560..81d0b0596e 100644 --- a/stepmania/src/GameConstantsAndTypes.h +++ b/stepmania/src/GameConstantsAndTypes.h @@ -13,8 +13,6 @@ ----------------------------------------------------------------------------- */ -#include "RageTypes.h" // for RageColor - // // Screen Dimensions @@ -99,18 +97,6 @@ CString PlayModeToString( PlayMode pm ); PlayMode StringToPlayMode( CString s ); -// -// Player number stuff -// -enum PlayerNumber { - PLAYER_1 = 0, - PLAYER_2, - NUM_PLAYERS, // leave this at the end - PLAYER_INVALID -}; - -RageColor PlayerToColor( PlayerNumber pn ); -RageColor PlayerToColor( int p ); enum SongSortOrder { diff --git a/stepmania/src/GameManager.cpp b/stepmania/src/GameManager.cpp index a83f1eebbe..04fde0d2ee 100644 --- a/stepmania/src/GameManager.cpp +++ b/stepmania/src/GameManager.cpp @@ -128,10 +128,10 @@ GameDef g_GameDefs[NUM_GAMES] = -1, //no default key // DANCE_BUTTON_UPRIGHT, SDLK_RETURN, // DANCE_BUTTON_START, SDLK_ESCAPE, // DANCE_BUTTON_BACK - -1, //no default key // DANCE_BUTTON_MENULEFT - -1, //no default key // DANCE_BUTTON_MENURIGHT - SDLK_UP, // DANCE_BUTTON_MENUUP - SDLK_DOWN, // DANCE_BUTTON_MENUDOWN + SDLK_DELETE, // DANCE_BUTTON_MENULEFT + SDLK_PAGEDOWN, // DANCE_BUTTON_MENURIGHT + SDLK_HOME, // DANCE_BUTTON_MENUUP + SDLK_END, // DANCE_BUTTON_MENUDOWN SDLK_F1, // DANCE_BUTTON_COIN SDLK_SCROLLOCK // DANCE_BUTTON_OPERATOR }, @@ -144,10 +144,10 @@ GameDef g_GameDefs[NUM_GAMES] = SDLK_KP9, // DANCE_BUTTON_UPRIGHT, SDLK_KP_ENTER, // DANCE_BUTTON_START, SDLK_KP0, // DANCE_BUTTON_BACK - -1, //no default key // DANCE_BUTTON_MENULEFT - -1, //no default key // DANCE_BUTTON_MENURIGHT - -1, //no default key // DANCE_BUTTON_MENUUP - -1, //no default key // DANCE_BUTTON_MENUDOWN + SDLK_KP_DIVIDE, // DANCE_BUTTON_MENULEFT + SDLK_KP_MULTIPLY, // DANCE_BUTTON_MENURIGHT + SDLK_KP_MINUS, // DANCE_BUTTON_MENUUP + SDLK_KP_PLUS, // DANCE_BUTTON_MENUDOWN SDLK_F2, // DANCE_BUTTON_COIN -1 // DANCE_BUTTON_OPERATOR }, diff --git a/stepmania/src/GradeDisplay.h b/stepmania/src/GradeDisplay.h index 0995aa3f7b..4f6be1b983 100644 --- a/stepmania/src/GradeDisplay.h +++ b/stepmania/src/GradeDisplay.h @@ -14,7 +14,7 @@ #include "Sprite.h" #include "PrefsManager.h" #include "Grade.h" -#include "GameConstantsAndTypes.h" +#include "PlayerNumber.h" class GradeDisplay : public Sprite diff --git a/stepmania/src/Inventory.cpp b/stepmania/src/Inventory.cpp index a0b1a78a12..663b8c4a01 100644 --- a/stepmania/src/Inventory.cpp +++ b/stepmania/src/Inventory.cpp @@ -17,7 +17,7 @@ #define NUM_ITEM_TYPES THEME->GetMetricF("Inventory","NumItemTypes") -#define ITEM_DURATION_SECONDS THEME->GetMetricF("Inventory","ItemDuration") +#define ITEM_DURATION_SECONDS THEME->GetMetricF("Inventory","ItemDurationSeconds") #define ITEM_COMBO( i ) THEME->GetMetricI("Inventory",ssprintf("Item%dCombo",i+1)) #define ITEM_EFFECT( i ) THEME->GetMetric ("Inventory",ssprintf("Item%dEffect",i+1)) @@ -28,6 +28,7 @@ Inventory::Inventory() m_soundAcquireItem.Load( THEME->GetPathTo("Sounds","gameplay battle aquire item") ); m_soundUseItem.Load( THEME->GetPathTo("Sounds","gameplay battle use item") ); + m_soundItemEnding.Load( THEME->GetPathTo("Sounds","gameplay battle item ending") ); } void Inventory::RefreshPossibleItems() @@ -43,6 +44,32 @@ void Inventory::RefreshPossibleItems() } } + +void Inventory::Update( float fDelta ) +{ + for( int p=0; p=0; i-- ) + { + ActiveItem& active_item = m_ActiveItems[p][i]; + active_item.fSecondsLeft -= fDelta; + if( active_item.fSecondsLeft < 0 ) + { + m_ActiveItems[p].erase( m_ActiveItems[p].begin()+i ); + bActiveItemsChanged = true; + } + } + + if( bActiveItemsChanged ) + { + RebuildPlayerOptions( (PlayerNumber)p ); + m_soundItemEnding.Play(); + } + } +} + + bool Inventory::OnComboBroken( PlayerNumber pn, int iCombo ) { int* iItems = GAMESTATE->m_iItems[pn]; @@ -95,17 +122,18 @@ void Inventory::UseItem( PlayerNumber pn, int iSlot ) int iItemIndex = iItems[iSlot]; - const ItemDef& def = m_ItemDefs[iItemIndex]; - PlayerNumber pnToAttack; switch( pn ) { case PLAYER_1: pnToAttack = PLAYER_2; break; case PLAYER_2: pnToAttack = PLAYER_1; break; - default: ASSERT(0); pnToAttack = PLAYER_INVALID; break; + default: ASSERT(0); pnToAttack = PLAYER_1; break; } - GAMESTATE->m_PlayerOptions[pnToAttack].FromString( def.effect ); + ActiveItem ai = { ITEM_DURATION_SECONDS, iItemIndex }; + m_ActiveItems[pnToAttack].push_back( ai ); + + RebuildPlayerOptions( pnToAttack ); // remove the item iItems[iSlot] = ITEM_NONE; @@ -113,3 +141,21 @@ void Inventory::UseItem( PlayerNumber pn, int iSlot ) m_soundUseItem.Play(); } +void Inventory::RebuildPlayerOptions( PlayerNumber pn ) +{ + // rebuild player options + PlayerOptions po = GAMESTATE->m_SelectedOptions[pn]; + for( int i=0; i<(int)m_ActiveItems[pn].size(); i++ ) + { + int iItemDefIndex = m_ActiveItems[pn][i].iItemDefIndex; + po.FromString( m_ItemDefs[iItemDefIndex].effect ); + } + GAMESTATE->m_PlayerOptions[pn] = po; +} + + +void Inventory::RemoveAllActiveItems() +{ + for( int p=0; p m_ItemDefs; + struct ActiveItem + { + float fSecondsLeft; + int iItemDefIndex; + }; + vector m_ActiveItems[NUM_PLAYERS]; + +protected: + void RebuildPlayerOptions( PlayerNumber pn ); + RageSound m_soundAcquireItem; RageSound m_soundUseItem; + RageSound m_soundItemEnding; }; #endif diff --git a/stepmania/src/LifeMeter.h b/stepmania/src/LifeMeter.h index 664982dd7b..1b44a55cb0 100644 --- a/stepmania/src/LifeMeter.h +++ b/stepmania/src/LifeMeter.h @@ -11,6 +11,7 @@ ----------------------------------------------------------------------------- */ +#include "PlayerNumber.h" #include "GameConstantsAndTypes.h" #include "ActorFrame.h" diff --git a/stepmania/src/MenuInput.h b/stepmania/src/MenuInput.h index 5599788a2b..a700b33101 100644 --- a/stepmania/src/MenuInput.h +++ b/stepmania/src/MenuInput.h @@ -12,7 +12,7 @@ ----------------------------------------------------------------------------- */ -#include "GameConstantsAndTypes.h" +#include "PlayerNumber.h" enum MenuButton { diff --git a/stepmania/src/NoteData.cpp b/stepmania/src/NoteData.cpp index a0f63d8b49..ad8447a03c 100644 --- a/stepmania/src/NoteData.cpp +++ b/stepmania/src/NoteData.cpp @@ -1002,13 +1002,15 @@ void NoteDataUtil::SwapSides( NoteData &in ) void NoteDataUtil::Little(NoteData &in) { + int i; + // filter out all non-quarter notes int max_row = in.GetLastRow(); - for( int i=0; i<=max_row; i+=ROWS_PER_BEAT ) + for( i=0; i<=max_row; i+=ROWS_PER_BEAT ) for( int c=0; c=0; i-- ) + for( i=in.GetNumHoldNotes()-1; i>=0; i-- ) if( fmodf(in.GetHoldNote(i).fStartBeat,1) != 0 ) // doesn't start on a beat in.RemoveHoldNote( i ); } diff --git a/stepmania/src/NoteData.h b/stepmania/src/NoteData.h index 7d95495a2b..6c1db9ffe8 100644 --- a/stepmania/src/NoteData.h +++ b/stepmania/src/NoteData.h @@ -14,7 +14,7 @@ ----------------------------------------------------------------------------- */ -//#include "GameConstantsAndTypes.h" +#include "GameConstantsAndTypes.h" #include "NoteTypes.h" // '1' = tap note diff --git a/stepmania/src/NoteDisplay.h b/stepmania/src/NoteDisplay.h index 5d8a60a85f..ff5b3735f5 100644 --- a/stepmania/src/NoteDisplay.h +++ b/stepmania/src/NoteDisplay.h @@ -15,6 +15,7 @@ #include "Sprite.h" #include "NoteTypes.h" +#include "PlayerNumber.h" struct NoteMetricCache_t; diff --git a/stepmania/src/NoteSkinManager.h b/stepmania/src/NoteSkinManager.h index b2be9169cf..4af30b929f 100644 --- a/stepmania/src/NoteSkinManager.h +++ b/stepmania/src/NoteSkinManager.h @@ -14,7 +14,7 @@ #include "RageTypes.h" #include "Game.h" -#include "GameConstantsAndTypes.h" +#include "PlayerNumber.h" class IniFile; diff --git a/stepmania/src/NoteTypes.cpp b/stepmania/src/NoteTypes.cpp index 07aea678f4..3afa9c52d9 100644 --- a/stepmania/src/NoteTypes.cpp +++ b/stepmania/src/NoteTypes.cpp @@ -12,22 +12,6 @@ #include "NoteTypes.h" -RageColor NoteTypeToColor( NoteType nt ) -{ - switch( nt ) - { - case NOTE_TYPE_4TH: return RageColor(1,0,0,1); // red - case NOTE_TYPE_8TH: return RageColor(0,0,1,1); // blue - case NOTE_TYPE_12TH: return RageColor(1,0,1,1); // purple - case NOTE_TYPE_16TH: return RageColor(1,1,0,1); // yellow - case NOTE_TYPE_24TH: return RageColor(0,1,1,1); // light blue - default: - ASSERT(0); - case NOTE_TYPE_32ND: // fall through - return RageColor(0.5f,0.5f,0.5f,1); // gray - } -}; - float NoteTypeToBeat( NoteType nt ) { switch( nt ) @@ -77,13 +61,3 @@ bool IsNoteOfType( int iNoteIndex, NoteType t ) return GetNoteType(iNoteIndex) == t; } -RageColor GetNoteColorFromIndex( int iIndex ) -{ - return NoteTypeToColor( GetNoteType(iIndex) ); -} - -RageColor GetNoteColorFromBeat( float fBeat ) -{ - return GetNoteColorFromIndex( BeatToNoteRow(fBeat) ); -} - diff --git a/stepmania/src/NoteTypes.h b/stepmania/src/NoteTypes.h index 02a32e4f6c..e68f37d0de 100644 --- a/stepmania/src/NoteTypes.h +++ b/stepmania/src/NoteTypes.h @@ -11,7 +11,6 @@ ----------------------------------------------------------------------------- */ -#include "GameConstantsAndTypes.h" #include "PlayerOptions.h" // '1' = tap note @@ -68,13 +67,10 @@ enum NoteType NOTE_TYPE_INVALID }; -RageColor NoteTypeToColor( NoteType nt ); float NoteTypeToBeat( NoteType nt ); NoteType GetNoteType( int iNoteIndex ); NoteType BeatToNoteType( float fBeat ); bool IsNoteOfType( int iNoteIndex, NoteType t ); -RageColor GetNoteColorFromIndex( int iNoteIndex ); -RageColor GetNoteColorFromBeat( float fBeat ); CString NoteTypeToString( NoteType nt ); diff --git a/stepmania/src/Notes.h b/stepmania/src/Notes.h index 5f45225378..85e10cf15d 100644 --- a/stepmania/src/Notes.h +++ b/stepmania/src/Notes.h @@ -14,6 +14,7 @@ */ #include "GameConstantsAndTypes.h" +#include "PlayerNumber.h" #include "Grade.h" class NoteData; diff --git a/stepmania/src/OptionIcon.h b/stepmania/src/OptionIcon.h index 681bae81fb..4fbe58272a 100644 --- a/stepmania/src/OptionIcon.h +++ b/stepmania/src/OptionIcon.h @@ -14,7 +14,7 @@ #include "ActorFrame.h" #include "Sprite.h" #include "BitmapText.h" -#include "GameConstantsAndTypes.h" +#include "PlayerNumber.h" class OptionIcon : public ActorFrame diff --git a/stepmania/src/OptionsCursor.h b/stepmania/src/OptionsCursor.h index 859bf37d52..749f6c8a6b 100644 --- a/stepmania/src/OptionsCursor.h +++ b/stepmania/src/OptionsCursor.h @@ -13,7 +13,7 @@ #include "Sprite.h" #include "ActorFrame.h" -#include "GameConstantsAndTypes.h" +#include "PlayerNumber.h" class OptionsCursor : public ActorFrame diff --git a/stepmania/src/Player.cpp b/stepmania/src/Player.cpp index 5316fb4f19..565d24c623 100644 --- a/stepmania/src/Player.cpp +++ b/stepmania/src/Player.cpp @@ -573,7 +573,7 @@ void Player::HandleNoteScore( TapNoteScore score, int iNumTapsInRow ) #endif //DEBUG if(m_pScoreKeeper) - m_pScoreKeeper->HandleNoteScore(score, iNumTapsInRow); + m_pScoreKeeper->HandleTapScore(score, iNumTapsInRow); if (m_pScore) m_pScore->SetScore(GAMESTATE->m_CurStageStats.fScore[m_PlayerNumber]); @@ -594,7 +594,7 @@ void Player::HandleHoldNoteScore( HoldNoteScore score, TapNoteScore TapNoteScore #endif //DEBUG if(m_pScoreKeeper) { - m_pScoreKeeper->HandleHoldNoteScore(score, TapNoteScore); + m_pScoreKeeper->HandleHoldScore(score, TapNoteScore); } if (m_pScore) diff --git a/stepmania/src/PlayerNumber.cpp b/stepmania/src/PlayerNumber.cpp new file mode 100644 index 0000000000..687b489d25 --- /dev/null +++ b/stepmania/src/PlayerNumber.cpp @@ -0,0 +1,35 @@ +#include "global.h" +/* +----------------------------------------------------------------------------- + File: PlayerNumber.cpp + + Desc: See header. + + Copyright (c) 2001-2002 by the person(s) listed below. All rights reserved. + Chris Danford +----------------------------------------------------------------------------- +*/ + +#include "PlayerNumber.h" +#include "ThemeManager.h" + + +#define COLOR_P1 THEME->GetMetricC("Common","ColorP1") +#define COLOR_P2 THEME->GetMetricC("Common","ColorP2") + + +RageColor PlayerToColor( PlayerNumber pn ) +{ + switch( pn ) + { + case PLAYER_1: return COLOR_P1; + case PLAYER_2: return COLOR_P2; + default: ASSERT(0); return RageColor(0.5f,0.5f,0.5f,1); + } +}; + +RageColor PlayerToColor( int p ) +{ + return PlayerToColor( (PlayerNumber)p ); +} + diff --git a/stepmania/src/PlayerNumber.h b/stepmania/src/PlayerNumber.h new file mode 100644 index 0000000000..1a261ef4c8 --- /dev/null +++ b/stepmania/src/PlayerNumber.h @@ -0,0 +1,35 @@ +#ifndef PlayerNumber_H +#define PlayerNumber_H + +/* +----------------------------------------------------------------------------- + File: PlayerNumber.h + + Desc: Things that are used in many places and don't change often. + + Copyright (c) 2001-2003 by the person(s) listed below. All rights reserved. + Chris Danford + Chris Gomez +----------------------------------------------------------------------------- +*/ + +#include "RageTypes.h" // for RageColor + + + +// +// Player number stuff +// +enum PlayerNumber { + PLAYER_1 = 0, + PLAYER_2, + NUM_PLAYERS, // leave this at the end + PLAYER_INVALID +}; + +RageColor PlayerToColor( PlayerNumber pn ); +RageColor PlayerToColor( int p ); + + + +#endif diff --git a/stepmania/src/ScoreDisplay.h b/stepmania/src/ScoreDisplay.h index 44d818f0c0..20dd459ce6 100644 --- a/stepmania/src/ScoreDisplay.h +++ b/stepmania/src/ScoreDisplay.h @@ -11,7 +11,7 @@ ----------------------------------------------------------------------------- */ -#include "GameConstantsAndTypes.h" +#include "PlayerNumber.h" #include "ActorFrame.h" class ScoreDisplay : public ActorFrame diff --git a/stepmania/src/ScoreDisplayBattle.cpp b/stepmania/src/ScoreDisplayBattle.cpp index 845b57dc87..e243a7ca4c 100644 --- a/stepmania/src/ScoreDisplayBattle.cpp +++ b/stepmania/src/ScoreDisplayBattle.cpp @@ -37,7 +37,10 @@ ScoreDisplayBattle::ScoreDisplayBattle() m_sprItems[i].SetX( fX ); m_sprItems[i].Load( THEME->GetPathTo("Graphics","gameplay battle item icons") ); m_sprItems[i].StopAnimating(); + m_sprItems[i].SetZoom( 0 ); this->AddChild( &m_sprItems[i] ); + + m_iLastSeenItems[i] = ITEM_NONE; } } @@ -57,12 +60,14 @@ void ScoreDisplayBattle::Update( float fDelta ) if( iNewItem == ITEM_NONE ) { m_sprItems[s].StopTweening(); - m_sprItems[s].SetDiffuse( RageColor(1,1,1,0) ); + m_sprItems[s].BeginTweening( 0.25f, Actor::TWEEN_BOUNCE_BEGIN ); + m_sprItems[s].SetTweenZoom( 0 ); } else { m_sprItems[s].SetDiffuse( RageColor(1,1,1,1) ); m_sprItems[s].SetState( iNewItem ); + m_sprItems[s].SetZoom( 1 ); // blink m_sprItems[s].StopTweening(); diff --git a/stepmania/src/ScoreDisplayBattle.h b/stepmania/src/ScoreDisplayBattle.h index 5b64eeb3fb..8d1054dd95 100644 --- a/stepmania/src/ScoreDisplayBattle.h +++ b/stepmania/src/ScoreDisplayBattle.h @@ -13,7 +13,7 @@ #include "ScoreDisplay.h" #include "Sprite.h" -#include "Inventory.h" +#include "GameConstantsAndTypes.h" diff --git a/stepmania/src/ScoreKeeper.h b/stepmania/src/ScoreKeeper.h index 8f27d15399..9ea3aeecf3 100644 --- a/stepmania/src/ScoreKeeper.h +++ b/stepmania/src/ScoreKeeper.h @@ -19,9 +19,11 @@ */ #include "Actor.h" +#include "PlayerNumber.h" #include "GameConstantsAndTypes.h" -class ScoreKeeper: public Actor { +class ScoreKeeper: public Actor +{ protected: PlayerNumber m_PlayerNumber; @@ -35,8 +37,8 @@ public: ScoreKeeper(PlayerNumber pn) { m_PlayerNumber=pn; } virtual void DrawPrimitives() { } - virtual void HandleNoteScore( TapNoteScore score, int iNumTapsInRow ) { } - virtual void HandleHoldNoteScore( HoldNoteScore score, TapNoteScore TapNoteScore ) { } + virtual void HandleTapScore( TapNoteScore score, int iNumTapsInRow ) { } + virtual void HandleHoldScore( HoldNoteScore score, TapNoteScore TapNoteScore ) { } }; #endif diff --git a/stepmania/src/ScoreKeeperMAX2.cpp b/stepmania/src/ScoreKeeperMAX2.cpp index 96008d0e8f..8ab80bad0b 100644 --- a/stepmania/src/ScoreKeeperMAX2.cpp +++ b/stepmania/src/ScoreKeeperMAX2.cpp @@ -48,7 +48,7 @@ void ScoreKeeperMAX2::AddScore( TapNoteScore score ) void ScoreKeeperMAX2::HandleNoteScore( TapNoteScore score, int iNumTapsInRow ) { - ScoreKeeper::HandleNoteScore(score, iNumTapsInRow); + ScoreKeeper::HandleTapScore(score, iNumTapsInRow); ASSERT( iNumTapsInRow >= 1 ); diff --git a/stepmania/src/ScreenGameplay.cpp b/stepmania/src/ScreenGameplay.cpp index 54c8cd2ba5..70d88fbba7 100644 --- a/stepmania/src/ScreenGameplay.cpp +++ b/stepmania/src/ScreenGameplay.cpp @@ -66,6 +66,8 @@ #define SONG_OPTIONS_Y( e ) THEME->GetMetricF("ScreenGameplay",ssprintf("SongOptions%sY",e?"Extra":"")) #define DIFFICULTY_X( p ) THEME->GetMetricF("ScreenGameplay",ssprintf("DifficultyP%dX",p+1)) #define DIFFICULTY_Y( p, e, r ) THEME->GetMetricF("ScreenGameplay",ssprintf("DifficultyP%d%s%sY",p+1,e?"Extra":"",r?"Reverse":"")) +#define ACTIVE_ITEMS_X( p ) THEME->GetMetricF("ScreenGameplay",ssprintf("ActiveItemsP%dX",p+1)) +#define ACTIVE_ITEMS_Y( p, e, r ) THEME->GetMetricF("ScreenGameplay",ssprintf("ActiveItemsP%d%s%sY",p+1,e?"Extra":"",r?"Reverse":"")) #define DEBUG_X THEME->GetMetricF("ScreenGameplay","DebugX") #define DEBUG_Y THEME->GetMetricF("ScreenGameplay","DebugY") #define STATUS_ICONS_X THEME->GetMetricF("ScreenGameplay","StatusIconsX") @@ -201,6 +203,10 @@ ScreenGameplay::ScreenGameplay( bool bDemonstration ) m_Player[p].SetX( fPlayerX ); this->AddChild( &m_Player[p] ); + m_ActiveItemList[p].SetXY( ACTIVE_ITEMS_X(p), ACTIVE_ITEMS_Y(p,bExtra,bReverse[p]) ); + m_ActiveItemList[p].Init( (PlayerNumber)p, &m_Inventory ); + this->AddChild( &m_ActiveItemList[p] ); + m_sprOniGameOver[p].Load( THEME->GetPathTo("Graphics","gameplay oni gameover") ); m_sprOniGameOver[p].SetX( fPlayerX ); m_sprOniGameOver[p].SetY( SCREEN_TOP - m_sprOniGameOver[p].GetZoomedHeight()/2 ); @@ -474,6 +480,7 @@ ScreenGameplay::ScreenGameplay( bool bDemonstration ) } m_Inventory.RefreshPossibleItems(); + this->AddChild( &m_Inventory ); m_iRowLastCrossed = -1; @@ -1259,6 +1266,8 @@ void ScreenGameplay::HandleScreenMessage( const ScreenMessage SM ) } } + m_Inventory.RemoveAllActiveItems(); + for( p=0; pIsPlayerEnabled(p) ) diff --git a/stepmania/src/ScreenGameplay.h b/stepmania/src/ScreenGameplay.h index cb68adc075..90a71caeb9 100644 --- a/stepmania/src/ScreenGameplay.h +++ b/stepmania/src/ScreenGameplay.h @@ -30,6 +30,7 @@ #include "BPMDisplay.h" #include "FocusingSprite.h" #include "Inventory.h" +#include "ActiveItemList.h" // messages sent by Combo @@ -129,6 +130,7 @@ protected: Player m_Player[NUM_PLAYERS]; Inventory m_Inventory; + ActiveItemList m_ActiveItemList[NUM_PLAYERS]; DifficultyIcon m_DifficultyIcon[NUM_PLAYERS]; diff --git a/stepmania/src/ScreenSandbox.cpp b/stepmania/src/ScreenSandbox.cpp index e9571c297d..7617f49f35 100644 --- a/stepmania/src/ScreenSandbox.cpp +++ b/stepmania/src/ScreenSandbox.cpp @@ -15,8 +15,8 @@ ----------------------------------------------------------------------------- */ -#include "global.h" #include "ScreenSandbox.h" +#include "GameConstantsAndTypes.h" ScreenSandbox::ScreenSandbox() diff --git a/stepmania/src/ScreenTestFonts.cpp b/stepmania/src/ScreenTestFonts.cpp index cc06a25dc5..8f5725a3cc 100644 --- a/stepmania/src/ScreenTestFonts.cpp +++ b/stepmania/src/ScreenTestFonts.cpp @@ -4,6 +4,8 @@ #include "FontManager.h" #include "RageTextureManager.h" #include "ScreenManager.h" +#include "GameConstantsAndTypes.h" + static const float LineWidth = 400; static const float LineHeight = 50; diff --git a/stepmania/src/SmallGradeDisplay.h b/stepmania/src/SmallGradeDisplay.h index aeb2be64cc..baa2052dea 100644 --- a/stepmania/src/SmallGradeDisplay.h +++ b/stepmania/src/SmallGradeDisplay.h @@ -14,7 +14,7 @@ #include "Sprite.h" #include "Grade.h" -#include "GameConstantsAndTypes.h" +#include "PlayerNumber.h" diff --git a/stepmania/src/SnapDisplay.cpp b/stepmania/src/SnapDisplay.cpp index 05eb25a699..2782330df7 100644 --- a/stepmania/src/SnapDisplay.cpp +++ b/stepmania/src/SnapDisplay.cpp @@ -26,15 +26,12 @@ SnapDisplay::SnapDisplay() for( i=0; i<2; i++ ) { m_sprIndicators[i].Load( THEME->GetPathTo("Graphics","edit snap indicator") ); + ASSERT( m_sprIndicators[i].GetNumStates() == NUM_NOTE_TYPES ); this->AddChild( &m_sprIndicators[i] ); } m_NoteType = NOTE_TYPE_4TH; - RageColor color = NoteTypeToColor( m_NoteType ); - for( i=0; i<2; i++ ) - m_sprIndicators[i].SetDiffuse( color ); - m_iNumCols = 0; } @@ -71,12 +68,6 @@ bool SnapDisplay::NextSnapMode() void SnapDisplay::SnapModeChanged() { - RageColor color = NoteTypeToColor( m_NoteType ); - for( int i=0; i<2; i++ ) - { - m_sprIndicators[i].StopTweening(); - m_sprIndicators[i].BeginTweening( 0.3f ); - m_sprIndicators[i].SetTweenDiffuse( color ); - } + m_sprIndicators[i].SetState( m_NoteType ); } diff --git a/stepmania/src/StageStats.h b/stepmania/src/StageStats.h index 12013bf60f..f08b6327af 100644 --- a/stepmania/src/StageStats.h +++ b/stepmania/src/StageStats.h @@ -12,9 +12,9 @@ */ -#include "GameConstantsAndTypes.h" // for NUM_PLAYERS +#include "PlayerNumber.h" +#include "GameConstantsAndTypes.h" #include "Grade.h" - class Song; diff --git a/stepmania/src/StepMania.dsp b/stepmania/src/StepMania.dsp index 9906992afd..969bc28aca 100644 --- a/stepmania/src/StepMania.dsp +++ b/stepmania/src/StepMania.dsp @@ -57,10 +57,10 @@ LINK32=link.exe # SUBTRACT LINK32 /verbose /pdb:none # Begin Special Build Tool IntDir=.\../Release6 -TargetDir=\stepmania +TargetDir=\stepmania\stepmania TargetName=StepMania SOURCE="$(InputPath)" -PreLink_Cmds=disasm\verinc cl /Zl /nologo /c verstub.cpp /Fo$(IntDir)\ +PreLink_Cmds=disasm\verinc cl /Zl /nologo /c verstub.cpp /Fo$(IntDir)\ PostBuild_Cmds=disasm\mapconv $(IntDir)\$(TargetName).map $(TargetDir)\StepMania.vdi ia32.vdi # End Special Build Tool @@ -92,10 +92,10 @@ LINK32=link.exe # SUBTRACT LINK32 /verbose /profile /pdb:none /incremental:no /nodefaultlib # Begin Special Build Tool IntDir=.\../Debug6 -TargetDir=\stepmania +TargetDir=\stepmania\stepmania TargetName=StepMania-debug SOURCE="$(InputPath)" -PreLink_Cmds=disasm\verinc cl /Zl /nologo /c verstub.cpp /Fo$(IntDir)\ +PreLink_Cmds=disasm\verinc cl /Zl /nologo /c verstub.cpp /Fo$(IntDir)\ PostBuild_Cmds=disasm\mapconv $(IntDir)\$(TargetName).map $(TargetDir)\StepMania.vdi ia32.vdi # End Special Build Tool @@ -363,6 +363,14 @@ SOURCE=.\Grade.h # End Source File # Begin Source File +SOURCE=.\Inventory.cpp +# End Source File +# Begin Source File + +SOURCE=.\Inventory.h +# End Source File +# Begin Source File + SOURCE=.\NoteData.cpp # End Source File # Begin Source File @@ -451,11 +459,11 @@ SOURCE=.\NoteTypes.h # End Source File # Begin Source File -SOURCE=.\Player.cpp +SOURCE=.\PlayerNumber.cpp # End Source File # Begin Source File -SOURCE=.\Player.h +SOURCE=.\PlayerNumber.h # End Source File # Begin Source File @@ -1228,6 +1236,14 @@ SOURCE=.\TipDisplay.h # PROP Default_Filter "" # Begin Source File +SOURCE=.\ActiveItemList.cpp +# End Source File +# Begin Source File + +SOURCE=.\ActiveItemList.h +# End Source File +# Begin Source File + SOURCE=.\ArrowEffects.cpp # End Source File # Begin Source File @@ -1388,6 +1404,14 @@ SOURCE=.\NoteField.h # End Source File # Begin Source File +SOURCE=.\Player.cpp +# End Source File +# Begin Source File + +SOURCE=.\Player.h +# End Source File +# Begin Source File + SOURCE=.\ScoreDisplay.cpp # End Source File # Begin Source File @@ -1396,6 +1420,14 @@ SOURCE=.\ScoreDisplay.h # End Source File # Begin Source File +SOURCE=.\ScoreDisplayBattle.cpp +# End Source File +# Begin Source File + +SOURCE=.\ScoreDisplayBattle.h +# End Source File +# Begin Source File + SOURCE=.\ScoreDisplayNormal.cpp # End Source File # Begin Source File diff --git a/stepmania/src/StepMania.vcproj b/stepmania/src/StepMania.vcproj index a2fa44174d..5f3af5c554 100644 --- a/stepmania/src/StepMania.vcproj +++ b/stepmania/src/StepMania.vcproj @@ -631,6 +631,12 @@ cl /Zl /nologo /c verstub.cpp /Fo$(IntDir)\ + + + + @@ -1194,6 +1200,12 @@ cl /Zl /nologo /c verstub.cpp /Fo$(IntDir)\ + + + + diff --git a/stepmania/src/StyleDef.h b/stepmania/src/StyleDef.h index 652680d30d..98d8fea75b 100644 --- a/stepmania/src/StyleDef.h +++ b/stepmania/src/StyleDef.h @@ -25,6 +25,8 @@ #include "GameInput.h" #include "Game.h" #include "NoteTypes.h" +#include "PlayerNumber.h" +#include "GameConstantsAndTypes.h" const int MAX_COLS_PER_PLAYER = MAX_NOTE_TRACKS; diff --git a/stepmania/src/StyleInput.h b/stepmania/src/StyleInput.h index 34d9e27c3b..082f9a80f6 100644 --- a/stepmania/src/StyleInput.h +++ b/stepmania/src/StyleInput.h @@ -10,7 +10,9 @@ Chris Danford ----------------------------------------------------------------------------- */ -#include "GameConstantsAndTypes.h" + +#include "PlayerNumber.h" + struct StyleInput { diff --git a/stepmania/src/TransitionBackWipe.cpp b/stepmania/src/TransitionBackWipe.cpp index 3397b32e13..10f9f66dff 100644 --- a/stepmania/src/TransitionBackWipe.cpp +++ b/stepmania/src/TransitionBackWipe.cpp @@ -14,6 +14,7 @@ #include "RageUtil.h" #include "PrefsManager.h" #include "ThemeManager.h" +#include "GameConstantsAndTypes.h" #define RECTANGLE_WIDTH 20 diff --git a/stepmania/src/TransitionRectWipe.cpp b/stepmania/src/TransitionRectWipe.cpp index 6a11b416e0..c8310fe4b7 100644 --- a/stepmania/src/TransitionRectWipe.cpp +++ b/stepmania/src/TransitionRectWipe.cpp @@ -12,6 +12,7 @@ #include "RageUtil.h" #include "TransitionRectWipe.h" +#include "GameConstantsAndTypes.h" #define RECTANGLE_WIDTH 20 diff --git a/stepmania/src/song.h b/stepmania/src/song.h index 67fc41c759..5bb5de04b0 100644 --- a/stepmania/src/song.h +++ b/stepmania/src/song.h @@ -11,15 +11,17 @@ ----------------------------------------------------------------------------- */ +#include "PlayerNumber.h" #include "GameConstantsAndTypes.h" #include "Grade.h" - struct Notes; class StyleDef; class NotesLoader; + extern const int FILE_CACHE_VERSION; + struct BPMSegment { BPMSegment() { m_fStartBeat = m_fBPM = -1; };