m_EffectType is now a bitfield, so we can have multiple effects on

at once.

There's no interface to this, but it works with courses.

drunk, dizzy, dark is amusing. "That arrow goes WHERE?"
This commit is contained in:
Glenn Maynard
2002-08-31 03:04:38 +00:00
parent 7ffc481c63
commit ad5f294ae4
7 changed files with 85 additions and 45 deletions
+17 -17
View File
@@ -25,15 +25,22 @@ float ArrowGetYOffset( PlayerNumber pn, float fNoteBeat )
float fSongBeat = GAMESTATE->m_fSongBeat;
float fBeatsUntilStep = fNoteBeat - fSongBeat;
float fYOffset = fBeatsUntilStep * ARROW_GAP;
switch( GAMESTATE->m_PlayerOptions[pn].m_EffectType )
{
case PlayerOptions::EFFECT_BOOST:
/* With both boost and wave enabled, the effect is that the
* notes "bufferr" at the bottom of the screen and shoot out
* at high speed.
*
* With wave first, the boost appears halfway down the screen.
* With boost first, it appears about 1/4 down the screen.
*
* I'm not sure which is better. - glenn
*/
int EffectType = GAMESTATE->m_PlayerOptions[pn].m_EffectType;
if ( EffectType & PlayerOptions::EFFECT_BOOST )
fYOffset *= 1.4f / ((fYOffset+SCREEN_HEIGHT/1.6f)/SCREEN_HEIGHT);
break;
case PlayerOptions::EFFECT_WAVE:
if ( EffectType & PlayerOptions::EFFECT_WAVE )
fYOffset += 15.0f*sinf( fYOffset/38.0f );
break;
}
return fYOffset;
}
@@ -42,12 +49,9 @@ float ArrowGetXPos( PlayerNumber pn, int iColNum, float fYPos )
float fSongBeat = GAMESTATE->m_fSongBeat;
float fPixelOffsetFromCenter = GAMESTATE->GetCurrentStyleDef()->m_ColumnInfo[PLAYER_1][iColNum].fXOffset;
switch( GAMESTATE->m_PlayerOptions[pn].m_EffectType )
{
case PlayerOptions::EFFECT_DRUNK:
if( GAMESTATE->m_PlayerOptions[pn].m_EffectType & PlayerOptions::EFFECT_DRUNK )
fPixelOffsetFromCenter += cosf( TIMER->GetTimeSinceStart() + iColNum*0.2f + fYPos*6/SCREEN_HEIGHT) * ARROW_SIZE*0.5f;
break;
}
return fPixelOffsetFromCenter;
}
@@ -55,12 +59,8 @@ float ArrowGetRotation( PlayerNumber pn, int iColNum, float fYOffset )
{
float fRotation = 0; //StyleDef.m_ColumnToRotation[iColNum];
switch( GAMESTATE->m_PlayerOptions[pn].m_EffectType )
{
case PlayerOptions::EFFECT_DIZZY:
if( GAMESTATE->m_PlayerOptions[pn].m_EffectType & PlayerOptions::EFFECT_DIZZY)
fRotation += fYOffset/SCREEN_HEIGHT*6;
break;
}
return fRotation;
}
+13 -6
View File
@@ -140,10 +140,17 @@ void Player::Load( PlayerNumber pn, NoteData* pNoteData, LifeMeter* pLM, ScoreDi
int iPixelsToDrawBefore = 96;
int iPixelsToDrawAfter = 384;
switch( GAMESTATE->m_PlayerOptions[pn].m_EffectType )
// If both options are on, we *do* need to multiply it twice.
if( GAMESTATE->m_PlayerOptions[pn].m_EffectType & PlayerOptions::EFFECT_MINI)
{
case PlayerOptions::EFFECT_MINI: iPixelsToDrawBefore *= 2; iPixelsToDrawAfter *= 2; break;
case PlayerOptions::EFFECT_SPACE: iPixelsToDrawBefore *= 2; iPixelsToDrawAfter *= 2; break;
iPixelsToDrawBefore *= 2;
iPixelsToDrawAfter *= 2;
}
if( GAMESTATE->m_PlayerOptions[pn].m_EffectType & PlayerOptions::EFFECT_SPACE)
{
iPixelsToDrawBefore *= 2;
iPixelsToDrawAfter *= 2;
}
m_NoteField.Load( (NoteData*)this, pn, iPixelsToDrawBefore, iPixelsToDrawAfter );
@@ -165,7 +172,7 @@ void Player::Load( PlayerNumber pn, NoteData* pNoteData, LifeMeter* pLM, ScoreDi
m_GrayArrowRow.SetY( GAMESTATE->m_PlayerOptions[pn].m_bReverseScroll ? SCREEN_HEIGHT - ARROWS_Y : ARROWS_Y );
m_GhostArrowRow.SetY( GAMESTATE->m_PlayerOptions[pn].m_bReverseScroll ? SCREEN_HEIGHT - ARROWS_Y : ARROWS_Y );
if( GAMESTATE->m_PlayerOptions[pn].m_EffectType == PlayerOptions::EFFECT_MINI )
if( GAMESTATE->m_PlayerOptions[pn].m_EffectType & PlayerOptions::EFFECT_MINI )
{
m_NoteField.SetZoom( 0.5f );
m_GrayArrowRow.SetZoom( 0.5f );
@@ -271,7 +278,7 @@ void Player::DrawPrimitives()
D3DXMATRIX matOldView, matOldProj;
if( GAMESTATE->m_PlayerOptions[m_PlayerNumber].m_EffectType == PlayerOptions::EFFECT_SPACE )
if( GAMESTATE->m_PlayerOptions[m_PlayerNumber].m_EffectType & PlayerOptions::EFFECT_SPACE )
{
// save old view and projection
DISPLAY->GetViewTransform( &matOldView );
@@ -305,7 +312,7 @@ void Player::DrawPrimitives()
m_NoteField.Draw();
m_GhostArrowRow.Draw();
if( GAMESTATE->m_PlayerOptions[m_PlayerNumber].m_EffectType == PlayerOptions::EFFECT_SPACE )
if( GAMESTATE->m_PlayerOptions[m_PlayerNumber].m_EffectType & PlayerOptions::EFFECT_SPACE )
{
// restire old view and projection
DISPLAY->SetViewTransform( &matOldView );
+12 -17
View File
@@ -26,17 +26,12 @@ CString PlayerOptions::GetString()
sReturn += s + "X, ";
}
switch( m_EffectType )
{
case EFFECT_NONE: break;
case EFFECT_BOOST: sReturn += "Boost, "; break;
case EFFECT_WAVE: sReturn += "Wave, "; break;
case EFFECT_DRUNK: sReturn += "Drunk, "; break;
case EFFECT_DIZZY: sReturn += "Dizzy, "; break;
case EFFECT_SPACE: sReturn += "Space, "; break;
case EFFECT_MINI: sReturn += "Mini, "; break;
default: ASSERT(0); // invalid EFFECT
}
if( m_EffectType & EFFECT_BOOST ) sReturn += "Boost, ";
if( m_EffectType & EFFECT_WAVE ) sReturn += "Wave, ";
if( m_EffectType & EFFECT_DRUNK ) sReturn += "Drunk, ";
if( m_EffectType & EFFECT_DIZZY ) sReturn += "Dizzy, ";
if( m_EffectType & EFFECT_SPACE ) sReturn += "Space, ";
if( m_EffectType & EFFECT_MINI ) sReturn += "Mini, ";
switch( m_AppearanceType )
{
@@ -104,12 +99,12 @@ void PlayerOptions::FromString( CString sOptions )
else if( sBit == "4.0x" ) m_fArrowScrollSpeed = 4.0f;
else if( sBit == "5.0x" ) m_fArrowScrollSpeed = 5.0f;
else if( sBit == "8.0x" ) m_fArrowScrollSpeed = 8.0f;
else if( sBit == "boost" ) m_EffectType = EFFECT_BOOST;
else if( sBit == "wave" ) m_EffectType = EFFECT_WAVE;
else if( sBit == "drunk" ) m_EffectType = EFFECT_DRUNK;
else if( sBit == "dizzy" ) m_EffectType = EFFECT_DIZZY;
else if( sBit == "space" ) m_EffectType = EFFECT_SPACE;
else if( sBit == "mini" ) m_EffectType = EFFECT_MINI;
else if( sBit == "boost" ) m_EffectType |= EFFECT_BOOST;
else if( sBit == "wave" ) m_EffectType |= EFFECT_WAVE;
else if( sBit == "drunk" ) m_EffectType |= EFFECT_DRUNK;
else if( sBit == "dizzy" ) m_EffectType |= EFFECT_DIZZY;
else if( sBit == "space" ) m_EffectType |= EFFECT_SPACE;
else if( sBit == "mini" ) m_EffectType |= EFFECT_MINI;
else if( sBit == "hidden" ) m_AppearanceType = APPEARANCE_HIDDEN;
else if( sBit == "sudden" ) m_AppearanceType = APPEARANCE_SUDDEN;
else if( sBit == "stealth" ) m_AppearanceType = APPEARANCE_STEALTH;
+10 -2
View File
@@ -13,8 +13,16 @@
struct PlayerOptions
{
float m_fArrowScrollSpeed;
enum EffectType { EFFECT_NONE=0, EFFECT_BOOST, EFFECT_WAVE, EFFECT_DRUNK, EFFECT_DIZZY, EFFECT_SPACE, EFFECT_MINI, NUM_EFFECT_TYPES };
EffectType m_EffectType;
enum EffectType {
EFFECT_NONE =0,
EFFECT_BOOST =1<<0,
EFFECT_WAVE =1<<1,
EFFECT_DRUNK =1<<2,
EFFECT_DIZZY =1<<3,
EFFECT_SPACE =1<<4,
EFFECT_MINI =1<<5,
NUM_EFFECT_TYPES };
int m_EffectType;
enum AppearanceType { APPEARANCE_VISIBLE=0, APPEARANCE_HIDDEN, APPEARANCE_SUDDEN, APPEARANCE_STEALTH, APPEARANCE_BLINK, NUM_APPEARANCE_TYPES };
AppearanceType m_AppearanceType;
enum TurnType { TURN_NONE=0, TURN_MIRROR, TURN_LEFT, TURN_RIGHT, TURN_SHUFFLE };
+2
View File
@@ -397,6 +397,8 @@ ScreenGameplay::ScreenGameplay()
TweenOnScreen();
/* XXX: We set m_textPlayerOptions[p] above, so that won't
* include options set by the course. Should it? -glenn */
LoadNextSong( true );
+22 -2
View File
@@ -84,7 +84,18 @@ void ScreenPlayerOptions::ImportOptions()
else if( po.m_fArrowScrollSpeed == 8.0f ) m_iSelectedOption[p][PO_SPEED] = 8;
else m_iSelectedOption[p][PO_SPEED] = 2;
m_iSelectedOption[p][PO_EFFECT] = po.m_EffectType;
switch(po.m_EffectType)
{
case PlayerOptions::EFFECT_NONE: m_iSelectedOption[p][PO_EFFECT]=0; break;
case PlayerOptions::EFFECT_BOOST: m_iSelectedOption[p][PO_EFFECT]=1; break;
case PlayerOptions::EFFECT_WAVE: m_iSelectedOption[p][PO_EFFECT]=2; break;
case PlayerOptions::EFFECT_DRUNK: m_iSelectedOption[p][PO_EFFECT]=3; break;
case PlayerOptions::EFFECT_DIZZY: m_iSelectedOption[p][PO_EFFECT]=4; break;
case PlayerOptions::EFFECT_SPACE: m_iSelectedOption[p][PO_EFFECT]=5; break;
case PlayerOptions::EFFECT_MINI: m_iSelectedOption[p][PO_EFFECT]=6; break;
default: ; break;
}
m_iSelectedOption[p][PO_APPEAR] = po.m_AppearanceType;
m_iSelectedOption[p][PO_TURN] = po.m_TurnType;
m_iSelectedOption[p][PO_LITTLE] = po.m_bLittle ? 1 : 0;
@@ -114,8 +125,17 @@ void ScreenPlayerOptions::ExportOptions()
case 8: po.m_fArrowScrollSpeed = 8.0f; break;
}
switch(m_iSelectedOption[p][PO_EFFECT])
{
case 0: po.m_EffectType = PlayerOptions::EFFECT_NONE; break;
case 1: po.m_EffectType = PlayerOptions::EFFECT_BOOST; break;
case 2: po.m_EffectType = PlayerOptions::EFFECT_WAVE; break;
case 3: po.m_EffectType = PlayerOptions::EFFECT_DRUNK; break;
case 4: po.m_EffectType = PlayerOptions::EFFECT_DIZZY; break;
case 5: po.m_EffectType = PlayerOptions::EFFECT_SPACE; break;
case 6: po.m_EffectType = PlayerOptions::EFFECT_MINI; break;
}
po.m_EffectType = (PlayerOptions::EffectType)m_iSelectedOption[p][PO_EFFECT];
po.m_AppearanceType = (PlayerOptions::AppearanceType)m_iSelectedOption[p][PO_APPEAR];
po.m_TurnType = (PlayerOptions::TurnType)m_iSelectedOption[p][PO_TURN];
po.m_bLittle = m_iSelectedOption[p][PO_LITTLE] == 1;
+9 -1
View File
@@ -253,8 +253,16 @@ void ScreenTitleMenu::HandleScreenMessage( const ScreenMessage SM )
if( RandomFloat(0,1)>0.8f )
GAMESTATE->m_PlayerOptions[p].m_fArrowScrollSpeed = 1.5f;
/* This is a bitfield; choose a bit. 1<<0 chooses the first
* option, 1<<1 the second, and so on. NUM_EFFECT_TYPES is one
* greater than the number of options (since it includes NONE);
* we'll actually NONE if we choose NUM_EFFECT_TYPES, since that'll
* do 1<<(NUM_EFFECT_TYPES-1), which will turn on a bit that doesn't
* do anything.
*
* It's simple, but it's a hack. FIXME -glenn */
GAMESTATE->m_PlayerOptions[p].m_EffectType =
PlayerOptions::EffectType(rand()%PlayerOptions::NUM_EFFECT_TYPES);
1 << (rand()%PlayerOptions::NUM_EFFECT_TYPES) ;
if( RandomFloat(0,1)>0.9f )
GAMESTATE->m_PlayerOptions[p].m_AppearanceType = PlayerOptions::APPEARANCE_HIDDEN;
if( RandomFloat(0,1)>0.9f )