Lifebar colors for ez2dancer inplace

This commit is contained in:
Andrew Livy
2002-07-12 17:46:15 +00:00
parent 31cb5e8260
commit 47bd0d1532
7 changed files with 92 additions and 10 deletions
+26 -5
View File
@@ -12,7 +12,7 @@
#include "LifeMeterBar.h"
#include "ThemeManager.h"
#include "GameManager.h"
const int NUM_SECTIONS = 3;
const float SECTION_WIDTH = 1.0f/NUM_SECTIONS;
@@ -94,7 +94,14 @@ void LifeMeterBar::Update( float fDeltaTime )
m_fTrailingLifePercentage = clamp( m_fTrailingLifePercentage, 0, 1 );
}
const D3DXCOLOR COLOR_EZ2NORMAL_1 = D3DXCOLOR(0.7f,0.4f,0,1);
const D3DXCOLOR COLOR_EZ2NORMAL_2 = D3DXCOLOR(0.8f,0.4f,0,1);
const D3DXCOLOR COLOR_EZ2NEARFULL_1 = D3DXCOLOR(0.7f,0.6f,0,1);
const D3DXCOLOR COLOR_EZ2NEARFULL_2 = D3DXCOLOR(0.8f,0.7f,0,1);
const D3DXCOLOR COLOR_EZ2NEARFAIL_1 = D3DXCOLOR(0.9f,0.0f,0,1);
const D3DXCOLOR COLOR_EZ2NEARFAIL_2 = D3DXCOLOR(0.8f,0.1f,0,1);
const D3DXCOLOR COLOR_EZ2FULL_1 = D3DXCOLOR(0.3f,0.9f,0.4f,1);
const D3DXCOLOR COLOR_EZ2FULL_2 = D3DXCOLOR(0.2f,0.7f,0.3f,1);
const D3DXCOLOR COLOR_NORMAL_1 = D3DXCOLOR(1,1,1,1);
const D3DXCOLOR COLOR_NORMAL_2 = D3DXCOLOR(0,1,0,1);
const D3DXCOLOR COLOR_FULL_1 = D3DXCOLOR(1,0,0,1);
@@ -104,10 +111,24 @@ D3DXCOLOR LifeMeterBar::GetColor( float fPercentIntoSection )
{
float fPercentColor1 = fabsf( fPercentIntoSection*2 - 1 );
fPercentColor1 *= fPercentColor1 * fPercentColor1 * fPercentColor1; // make the color bunch around one side
if( m_fLifePercentage == 1 )
return COLOR_FULL_1 * fPercentColor1 + COLOR_FULL_2 * (1-fPercentColor1);
if (GAMEMAN->m_CurGame != GAME_EZ2)
{
if( m_fLifePercentage == 1 )
return COLOR_FULL_1 * fPercentColor1 + COLOR_FULL_2 * (1-fPercentColor1);
else
return COLOR_NORMAL_1 * fPercentColor1 + COLOR_NORMAL_2 * (1-fPercentColor1);
}
else
return COLOR_NORMAL_1 * fPercentColor1 + COLOR_NORMAL_2 * (1-fPercentColor1);
{
if( m_fLifePercentage == 1 )
return COLOR_EZ2FULL_1 * fPercentColor1 + COLOR_EZ2FULL_2 * (1-fPercentColor1);
else if ( m_fLifePercentage > 0.60 )
return COLOR_EZ2NEARFULL_1 * fPercentColor1 + COLOR_EZ2NEARFULL_2 * (1-fPercentColor1);
else if ( m_fLifePercentage < 0.25 )
return COLOR_EZ2NEARFAIL_1 * fPercentColor1 + COLOR_EZ2NEARFAIL_2 * (1-fPercentColor1);
else
return COLOR_EZ2NORMAL_1 * fPercentColor1 + COLOR_EZ2NORMAL_2 * (1-fPercentColor1);
}
}
void LifeMeterBar::DrawPrimitives()
+7 -1
View File
@@ -58,7 +58,7 @@ ScreenEz2SelectPlayer::ScreenEz2SelectPlayer()
LOG->WriteLine( "ScreenEz2SelectPlayer::ScreenEz2SelectPlayer()" );
ez2_lasttimercheck[0] = TIMER->GetTimeSinceStart();
ez2_lasttimercheck[1] = 0.0f;
m_iSelectedStyle=0;
m_iSelectedStyle=3; // set to invalid style
GAMEMAN->m_CurStyle = STYLE_NONE;
GAMEMAN->m_sMasterPlayerNumber = PLAYER_INVALID;
@@ -280,6 +280,11 @@ presses the button bound to start
************************************/
void ScreenEz2SelectPlayer::MenuStart( PlayerNumber p )
{
//disallow multiple presses of the menu start.
if (m_iSelectedStyle == 0 && p == PLAYER_1 || m_iSelectedStyle == 1 && p == PLAYER_2)
{
return;
}
// figure out whether we should add a player into the fray or not
if( GAMEMAN->m_sMasterPlayerNumber != PLAYER_2 && GAMEMAN->m_sMasterPlayerNumber != PLAYER_1 )
@@ -301,6 +306,7 @@ void ScreenEz2SelectPlayer::MenuStart( PlayerNumber p )
m_iSelectedStyle = 2;
m_soundSelect.PlayRandom();
}
TweenOffScreen();
}
+4 -1
View File
@@ -3,6 +3,9 @@ ScreenEzSelectPlayer,cpp
Desc: See Header
Copyright (C):
Andrew Livy
NOTES: Needs a good cleanup. Code is messy
and sloppy and err needs cleaning up ;)
*****************************************/
/* Includes */
@@ -27,7 +30,7 @@ Andrew Livy
/* Constants */
const CString BG_ANIMS_DIR = "BGAnimations\\";
// const CString BG_ANIMS_DIR = "BGAnimations\\";
const ScreenMessage SM_GoToPrevState = ScreenMessage(SM_User + 1);
const ScreenMessage SM_GoToNextState = ScreenMessage(SM_User + 2);
+3
View File
@@ -802,6 +802,9 @@ void ScreenGameplay::HandleScreenMessage( const ScreenMessage SM )
m_sprFailed.SetTweenZoom( 1.0f ); // come to rest
m_sprFailed.SetTweenDiffuseColor( D3DXCOLOR(1,1,1,0.7f) ); // and fade in
// BUGFIX by ANDY: Stage will now reset back to 0 when game ends.
PREFSMAN->m_iCurrentStageIndex = 0;
SCREENMAN->SendMessageToTopScreen( SM_PlayFailComment, 1.5f );
SCREENMAN->SendMessageToTopScreen( SM_HideFailed, 3.0f );
break;
+2 -1
View File
@@ -44,6 +44,7 @@ const CString CREDIT_LINES[] =
"TofuBoy (Lucas Tang)",
"SPiGuMuS",
"DJ McFox (Ryan McKanna)",
"Cloud34 (Lamden Travis)",
"",
"",
"",
@@ -122,7 +123,7 @@ ScreenMusicScroll::ScreenMusicScroll()
{
LOG->WriteLine( "ScreenMusicScroll::ScreenMusicScroll()" );
int i;
int i;
// BUGFIX by ANDY: Stage will now reset back to 0 when game ends.
PREFSMAN->m_iCurrentStageIndex = 0;
+44 -2
View File
@@ -80,7 +80,12 @@ void ScreenSelectGame::ExportOptions()
case GAME_DANCE:
GAMEMAN->m_CurStyle = STYLE_DANCE_SINGLE;
GAMEMAN->m_CurGame = GAME_DANCE;
ANNOUNCER->SwitchAnnouncer( "default" );
ANNOUNCER->SwitchAnnouncer( "default" );
// Does anyone wanna code something fancy that 'remembers' each
// announcer preference per game type?, I think it would be better than
// resetting the annoncer to a default each time?
//
// - Andy.
break;
case GAME_PUMP:
GAMEMAN->m_CurStyle = STYLE_PUMP_SINGLE;
@@ -99,7 +104,44 @@ void ScreenSelectGame::ExportOptions()
CStringArray asGameNames;
GAMEMAN->GetGameNames( asGameNames );
CString sGameName = asGameNames[game];
THEME->SwitchTheme( sGameName );
THEME->SwitchTheme( sGameName );
// THE NEXT FEW LINES OF CODE:
// Figure out all the valid skin names for the game and....
// Chooses the first one and loads it in
// This is needed because otherwise ALL gametypes will be looking
// for a MAX skin. Ez2dancer MAX? Pump It Up MAX? Not likely.
// This was stolen from ScreenAppearance Options, if you can do a cleaner
// version PLEASE DO!!!
//
// - Andy.
CStringArray arraySkinNames;
GAMEMAN->GetSkinNames( arraySkinNames );
m_OptionLineData[0].iNumOptions = arraySkinNames.GetSize();
for(int i=0; i<arraySkinNames.GetSize(); i++ )
strcpy( m_OptionLineData[0].szOptionsText[i], arraySkinNames[i] );
m_iSelectedOption[0][0] = -1;
for( i=0; i<m_OptionLineData[0].iNumOptions; i++ )
{
if( stricmp(m_OptionLineData[0].szOptionsText[i], GAMEMAN->m_sCurrentSkin)==0 )
{
m_iSelectedOption[0][0] = i;
break;
}
}
if( m_iSelectedOption[0][0] == -1 )
m_iSelectedOption[0][0] = 0;
int iSelectedSkin = m_iSelectedOption[0][0];
CString sNewSkin = m_OptionLineData[0].szOptionsText[iSelectedSkin];
PREFSMAN->m_sNoteSkin = sNewSkin;
GAMEMAN->m_sCurrentSkin = sNewSkin;
}
void ScreenSelectGame::GoToPrevState()
+6
View File
@@ -153,6 +153,12 @@ ScreenTitleMenu::ScreenTitleMenu()
// Cheers
// -- dro kulix
// Good call, actually, I made this change when announcer switching wasn't possible.
// or rather, announcer switching WASN'T possible from the title menu (it used to be
// in song options)
// but since it is now changed before we get here,
// care needs to be taken to ensure the player can still switch.
SOUND->PlayOnceStreamedFromDir( ANNOUNCER->GetPathTo(ANNOUNCER_TITLE_MENU_GAME_NAME) );
m_soundAttract.Load( ANNOUNCER->GetPathTo(ANNOUNCER_TITLE_MENU_ATTRACT) );