diff --git a/stepmania/src/Banner.cpp b/stepmania/src/Banner.cpp index 646afc079b..fa10f442f1 100644 --- a/stepmania/src/Banner.cpp +++ b/stepmania/src/Banner.cpp @@ -88,8 +88,6 @@ void Banner::SetScrolling( bool bScroll, float Percent) void Banner::LoadFromSong( Song* pSong ) // NULL means no song { - Sprite::EnableShadow( false ); - if( pSong == NULL ) LoadFallback(); else if( pSong->HasBanner() ) Load( pSong->GetBannerPath() ); else LoadFallback(); diff --git a/stepmania/src/Character.cpp b/stepmania/src/Character.cpp index 131af6e111..89090b80cf 100644 --- a/stepmania/src/Character.cpp +++ b/stepmania/src/Character.cpp @@ -100,4 +100,16 @@ CString Character::GetIconPath() else return as[0]; } +CString Character::GetHeadPath() +{ + CStringArray as; + GetDirListing( m_sCharDir+"head*.png", as, false, true ); + GetDirListing( m_sCharDir+"head*.jpg", as, false, true ); + GetDirListing( m_sCharDir+"head*.gif", as, false, true ); + GetDirListing( m_sCharDir+"head*.bmp", as, false, true ); + if( as.empty() ) + return ""; + else + return as[0]; +} diff --git a/stepmania/src/Character.h b/stepmania/src/Character.h index 070e8f0ed6..dd72003319 100644 --- a/stepmania/src/Character.h +++ b/stepmania/src/Character.h @@ -38,9 +38,7 @@ public: CString m_sAttacks[NUM_ATTACK_LEVELS][NUM_ATTACKS_PER_LEVEL]; - CString GetNormalHeadPath(); - CString GetHappyHeadPath(); - CString GetAngryHeadPath(); + CString GetHeadPath(); }; diff --git a/stepmania/src/CharacterHead.cpp b/stepmania/src/CharacterHead.cpp new file mode 100644 index 0000000000..f8135b25f1 --- /dev/null +++ b/stepmania/src/CharacterHead.cpp @@ -0,0 +1,71 @@ +#include "global.h" +/* +----------------------------------------------------------------------------- + Class: CharacterHead + + Desc: See header. + + Copyright (c) 2001-2002 by the person(s) listed below. All rights reserved. + Chris Danford +----------------------------------------------------------------------------- +*/ + +#include "CharacterHead.h" +#include "RageUtil.h" +#include "GameConstantsAndTypes.h" +#include "MusicWheel.h" +#include "CharacterHead.h" +#include "RageTimer.h" +#include +#include "ThemeManager.h" +#include "GameState.h" +#include "Character.h" + + +const float SECONDS_TO_SHOW_FACE = 1.5f; + + +CharacterHead::CharacterHead() +{ +} + +void CharacterHead::LoadFromCharacter( Character* pCharacter ) +{ + CString sHeadPath = pCharacter->GetHeadPath(); + if( sHeadPath.empty() ) + return; + + Load( sHeadPath ); + ASSERT( this->GetNumStates() == NUM_FACES ); + StopAnimating(); + SetFace( normal ); +} + +void CharacterHead::Update( float fDelta ) +{ + if( m_fSecondsUntilReturnToNormal > 0 ) + { + m_fSecondsUntilReturnToNormal -= fDelta; + + if( m_fSecondsUntilReturnToNormal < 0 ) + { + m_fSecondsUntilReturnToNormal = 0; + this->SetState( normal ); + } + } + + if( GAMESTATE->m_fOpponentHealthPercent == 0 ) + this->SetState( defeated ); + + Sprite::Update( fDelta ); +} + +void CharacterHead::SetFace( Face face ) +{ + if( GAMESTATE->m_fOpponentHealthPercent == 0 ) + return; + + this->SetState( face ); + m_fSecondsUntilReturnToNormal = SECONDS_TO_SHOW_FACE; +} + diff --git a/stepmania/src/CharacterHead.h b/stepmania/src/CharacterHead.h new file mode 100644 index 0000000000..b99cf88bf9 --- /dev/null +++ b/stepmania/src/CharacterHead.h @@ -0,0 +1,34 @@ +#ifndef CharacterHead_H +#define CharacterHead_H +/* +----------------------------------------------------------------------------- + Class: CharacterHead + + Desc: A little graphic to the left of the song's text banner in the MusicWheel. + + Copyright (c) 2001-2002 by the person(s) listed below. All rights reserved. + Chris Danford +----------------------------------------------------------------------------- +*/ + + +#include "Sprite.h" +class Character; + +class CharacterHead : public Sprite +{ +public: + CharacterHead(); + + void LoadFromCharacter( Character* pCharacter ); + + virtual void Update( float fDelta ); + + enum Face { normal=0, taunt, attack, damage, defeated, reserved, NUM_FACES }; + void SetFace( Face face ); + +protected: + float m_fSecondsUntilReturnToNormal; +}; + +#endif diff --git a/stepmania/src/CombinedLifeMeterTug.cpp b/stepmania/src/CombinedLifeMeterTug.cpp index 1ef3811722..a5d55a28a5 100644 --- a/stepmania/src/CombinedLifeMeterTug.cpp +++ b/stepmania/src/CombinedLifeMeterTug.cpp @@ -14,17 +14,35 @@ #include "GameState.h" +const float METER_WIDTH = 550; + +const float FACE_X[NUM_PLAYERS] = { -300, +300 }; +const float FACE_Y[NUM_PLAYERS] = { 0, 0 }; + + CombinedLifeMeterTug::CombinedLifeMeterTug() { - for( int p=0; pGetPathToG(ssprintf("CombinedLifeMeterTug stream p%d",p+1)), 550 ); + m_Stream[p].Load( THEME->GetPathToG(ssprintf("CombinedLifeMeterTug stream p%d",p+1)), METER_WIDTH ); this->AddChild( &m_Stream[p] ); } m_Stream[PLAYER_2].SetZoomX( -1 ); m_sprFrame.Load( THEME->GetPathToG(ssprintf("CombinedLifeMeterTug frame")) ); this->AddChild( &m_sprFrame ); + + + for( p=0; pm_pCurCharacters[p]; + ASSERT( pCharacter ); + + m_Head[p].LoadFromCharacter( pCharacter ); + m_Head[p].SetXY( FACE_X[p], FACE_Y[p] ); + this->AddChild( &m_Head[p] ); + } } void CombinedLifeMeterTug::Update( float fDelta ) diff --git a/stepmania/src/CombinedLifeMeterTug.h b/stepmania/src/CombinedLifeMeterTug.h index 10d2e2f257..033721cd4a 100644 --- a/stepmania/src/CombinedLifeMeterTug.h +++ b/stepmania/src/CombinedLifeMeterTug.h @@ -14,6 +14,7 @@ #include "LifeMeter.h" #include "Sprite.h" #include "MeterDisplay.h" +#include "CharacterHead.h" class CombinedLifeMeterTug : public CombinedLifeMeter @@ -33,6 +34,8 @@ protected: MeterDisplay m_Stream[NUM_PLAYERS]; Sprite m_sprFrame; + + CharacterHead m_Head[NUM_PLAYERS]; }; #endif