From fc670451804864d9b28065bf8b42c107d08dd31b Mon Sep 17 00:00:00 2001 From: Andrew Livy Date: Thu, 29 Aug 2002 01:12:39 +0000 Subject: [PATCH] ScreenStage Changes: Ez2dancer type fixed (apart from final stage number bug) --- stepmania/src/ScreenStage.cpp | 277 +++++++++++++++++++++------------- 1 file changed, 169 insertions(+), 108 deletions(-) diff --git a/stepmania/src/ScreenStage.cpp b/stepmania/src/ScreenStage.cpp index e1d155a1bb..0afbecdb59 100644 --- a/stepmania/src/ScreenStage.cpp +++ b/stepmania/src/ScreenStage.cpp @@ -102,7 +102,7 @@ ScreenStage::ScreenStage() // this->AddSubActor( &m_sprSongBackground ); // add background first so it draws bottom-most this->AddSubActor( &m_quadMask ); // add quad mask before stage so that it will block out the stage sprites - this->AddSubActor( &m_frameStage ); + this->AddSubActor( &m_frameStage ); for( int i=0; i<4; i++ ) { @@ -159,9 +159,12 @@ ScreenStage::ScreenStage() } m_sprStage.SetX( fStageCenterX ); - for( i=0; iGetStageIndex()+1; + int ez2Final=0; // if we're 0 it's not a final stage. if we're 1 it is. // why do this? Ez2dancer uses NORMAL for it's final stage but just re-arranges // the elements. so the following takes us into NORMAL and just re-arranges stuff // the ez2Final is so that when we're in normal we can go and see if we're really // FINAL or not. at the end of normal, if we WERE FINAL, we set it back to final // hacky or what? =) - if( g_StageType == STAGE_TYPE_EZ2 && stage_mode == MODE_FINAL ) + if( stage_mode == MODE_FINAL ) { for( int i=0; i<4; i++ ) { @@ -249,107 +253,125 @@ ScreenStage::ScreenStage() } - // - // Init Ez2 type-sepcific elements - // + ///////////////////////////////////////////////// + // START moving the numbers how ez2 wants them // + ///////////////////////////////////////////////// - ///////////////////////// - // EZ2 TYPE DEFINITION // - ///////////////////////// - - if ( g_StageType == STAGE_TYPE_EZ2) // Initialize and manipulate existing graphics for Ez2dancer Screen Type - { - for( i=0; iGetPathTo("Graphics","stage elements") ); m_sprbg[i].StopAnimating(); - m_sprbg[i].SetState( i+bg_modeoffset ); - } - if (ez2Final == 1) - { - m_sprbgxtra.Load( THEME->GetPathTo("Graphics","stage elements") ); - m_sprbgxtra.StopAnimating(); - m_sprbgxtra.SetState( bg_modeoffset ); - m_sprbgxtra.SetXY( fStageCenterX-30, 0+180); - m_sprbgxtra.SetHeight( 30 ); - m_sprbgxtra.SetWidth( SCREEN_WIDTH + 50 ); - m_sprbgxtra.SetRotation( -20 ); - m_sprbgxtra.BeginTweening(0.3f); - m_sprbgxtra.SetTweenRotationZ( 0 ); + m_sprbg[i].SetState( i+bg_modeoffset ); // We wanna use i to load in an element from the graphicmap OR the offset will + // give us alternative locations if we're in final } - - m_sprbg[0].SetXY( fStageCenterX-30, 0+150); - if (ez2Final == 1) - m_sprbg[0].SetXY( fStageCenterX-30, 0-160); - m_sprbg[0].SetHeight( 100 ); - if (ez2Final == 1) - m_sprbg[0].SetHeight( 30 ); - m_sprbg[0].SetWidth( SCREEN_WIDTH + 50 ); - m_sprbg[0].SetRotation( -20 ); - m_sprbg[0].BeginTweening(0.3f); - m_sprbg[0].SetTweenRotationZ( 0 ); + // Final mode is a little more special than our regular normal stage screen + // it has FOUR background elements. + // so if we should actually be on final stage + // setup this extra background element - m_sprbg[1].SetXY( fStageCenterX-(SCREEN_WIDTH/2)-20, 0+element_y_offsets); + if (ez2Final == 1) + { + m_sprbgxtra.Load( THEME->GetPathTo("Graphics","stage elements") ); // get the graphic + m_sprbgxtra.StopAnimating(); + m_sprbgxtra.SetState( bg_modeoffset ); // use the first element of the offset for this graphic + m_sprbgxtra.SetXY( CENTER_X-30, CENTER_Y+180); // set it's initial XY coordinates + m_sprbgxtra.SetHeight( 30 ); // set it's height and width. As we're only dealing with solid color + m_sprbgxtra.SetWidth( SCREEN_WIDTH + 50 ); // stretching shouldn't be a concern. + m_sprbgxtra.SetRotation( -20 ); // rotate this graphic + m_sprbgxtra.BeginTweening(0.3f); // start tweening + m_sprbgxtra.SetTweenRotationZ( 0 ); // set the rotation we want it to finally appear as + } + + + m_sprbg[0].SetXY( CENTER_X, CENTER_Y+150); // this is where we want the red bar graphic.... + if (ez2Final == 1) // however in final... + m_sprbg[0].SetXY( CENTER_X-30, CENTER_Y-160); // we want it somewhere else + m_sprbg[0].SetHeight( 100 ); // it's fairly high in normal + if (ez2Final == 1) // but in final... + m_sprbg[0].SetHeight( 30 ); // it needs to be a bit more squashed + m_sprbg[0].SetWidth( SCREEN_WIDTH + 50 ); // no matter what... it's this wide + m_sprbg[0].SetRotation( -20 ); // and is initially this rotation + m_sprbg[0].BeginTweening(0.3f); // start tweening + m_sprbg[0].SetTweenRotationZ( 0 ); // and set the rotation to where we want it to end up + + m_sprbg[1].SetXY( CENTER_X-(SCREEN_WIDTH/2)-20, CENTER_Y+element_y_offsets); m_sprbg[1].SetHeight( SCREEN_HEIGHT - 140 ); m_sprbg[1].SetWidth( 130 ); m_sprbg[1].SetRotation( -20 ); m_sprbg[1].BeginTweening(0.3f); m_sprbg[1].SetTweenRotationZ( 0 ); - m_sprbg[2].SetXY( fStageCenterX+430, 0+element_y_offsets); + m_sprbg[2].SetXY( CENTER_X+430, CENTER_Y+element_y_offsets); m_sprbg[2].SetHeight( SCREEN_HEIGHT - 140 ); m_sprbg[2].SetWidth( SCREEN_WIDTH + 50 ); m_sprbg[2].SetRotation( -20 ); m_sprbg[2].BeginTweening(0.3f); - m_sprbg[2].SetTweenX( fStageCenterX - 30 ); + m_sprbg[2].SetTweenX( CENTER_X ); m_sprbg[2].SetTweenRotationZ( 0 ); for (i=3; i>=0; i--) // work backwards as we wanna add em in reverse { - m_frameStage.AddSubActor( &m_sprbg[i] ); + m_frameStage.AddSubActor( &m_sprbg[i] ); } - if (ez2Final == 1) + + if (ez2Final == 1) // if we're in FINAL add that extra background element mentioned earlier. { m_frameStage.AddSubActor( &m_sprbgxtra ); } - // scroll in the name of the game (ez2dancer ukmove) across the top of the screen + + ///////////////////////// + // END Ez2 Backgrounds // + ///////////////////////// + + + ////////////////////////////// + // START stage description // + // and gamename tag display // + ////////////////////////////// + + // scroll in the name of the game ("ez2dancer ukmove" on arcade) across the top of the screen for (i=0; i<2; i++) // specify the font file. { @@ -359,104 +381,135 @@ ScreenStage::ScreenStage() m_stagedesc[i].TurnShadowOff(); } - m_ez2ukm[0].SetXY( fStageCenterX-400, 0-220 ); // set the intiial UKMOVE positions - m_ez2ukm[1].SetXY( fStageCenterX+400, 0+220 ); - m_stagedesc[0].SetXY( fStageCenterX-400, 0-150+element_y_offsets ); // set the intiial desc positions - m_stagedesc[1].SetXY( fStageCenterX+400, 0+70+element_y_offsets ); + m_ez2ukm[0].SetXY( CENTER_X-400, CENTER_Y-220 ); // set the intiial UKMOVE positions + m_ez2ukm[1].SetXY( CENTER_X+400, CENTER_Y+220 ); + + + m_stagedesc[0].SetXY( CENTER_X-400, CENTER_Y-150+element_y_offsets ); // set the intiial desc positions + m_stagedesc[1].SetXY( CENTER_X+400, CENTER_Y+70+element_y_offsets ); if (ez2Final == 1) { - m_stagedesc[1].SetY( 140.0f ); + m_stagedesc[1].SetY( CENTER_Y+140.0f ); // description text is in a different Y location on final stage } for (i=0; i<2; i++) // initialize the UK MOVE text and positions { - m_ez2ukm[i].SetText( "STEPMANIA EZ2 MOVE" ); - m_ez2ukm[i].SetDiffuseColor( D3DXCOLOR(1,1,1,1) ); - m_ez2ukm[i].BeginTweening(0.5f); + m_ez2ukm[i].SetText( "STEPMANIA EZ2 MOVE" ); // choose something better if you like ;) + m_ez2ukm[i].SetDiffuseColor( D3DXCOLOR(1,1,1,1) ); // it's white + m_ez2ukm[i].BeginTweening(0.5f); // start it tweening if (ez2Final == 1) { - m_stagedesc[i].SetText( "FINAL FINAL FINAL FINAL FINAL FINAL FINAL FINAL FINAL FINAL" ); - m_stagedesc[i].SetDiffuseColor( D3DXCOLOR(1.0f/225.0f*227.0f,1.0f/225.0f*228.0f,1/225.0f*255.0f,1) ); + m_stagedesc[i].SetText( "FINAL FINAL FINAL FINAL FINAL FINAL FINAL FINAL FINAL FINAL" ); // this is the desc text for final stage + m_stagedesc[i].SetDiffuseColor( D3DXCOLOR(1.0f/225.0f*227.0f,1.0f/225.0f*228.0f,1/225.0f*255.0f,1) ); // it's blueish } else { - m_stagedesc[i].SetText( "NEXT NEXT NEXT NEXT NEXT NEXT NEXT NEXT NEXT NEXT NEXT" ); - m_stagedesc[i].SetDiffuseColor( D3DXCOLOR(1.0f/225.0f*166.0f,1.0f/225.0f*83.0f,1/225.0f*16.0f,1) ); + m_stagedesc[i].SetText( "NEXT NEXT NEXT NEXT NEXT NEXT NEXT NEXT NEXT NEXT NEXT" ); // normal stages use this text + m_stagedesc[i].SetDiffuseColor( D3DXCOLOR(1.0f/225.0f*166.0f,1.0f/225.0f*83.0f,1/225.0f*16.0f,1) ); // it's orangey } - m_stagedesc[i].BeginTweening(0.5f); + m_stagedesc[i].BeginTweening(0.5f); // start tweening the descriptions } - m_ez2ukm[0].SetTweenX(fStageCenterX+90); // set their new locations - m_ez2ukm[1].SetTweenX(fStageCenterX-170); - m_stagedesc[0].SetTweenX(fStageCenterX+10); // set their new locations - m_stagedesc[1].SetTweenX(fStageCenterX-100); + m_ez2ukm[0].SetTweenX(CENTER_X+90); // set their new locations + m_ez2ukm[1].SetTweenX(CENTER_X-160); + m_stagedesc[0].SetTweenX(CENTER_X+10); // set their new locations + m_stagedesc[1].SetTweenX(CENTER_X-100); - for (i=0; i<2; i++) + for (i=0; i<2; i++) // add the actors { m_frameStage.AddSubActor( &m_ez2ukm[i] ); m_frameStage.AddSubActor( &m_stagedesc[i] ); } + + ////////////////////////////// + // END stage description // + // and gamename tag display // + ////////////////////////////// - + ////////////////////////////// + // START scrolling blobs // + ////////////////////////////// // 20 Scrolling Blobs come in one at a time from either side at the bottom in the following code: - for( int j=0; j<2; j++) + + // there are two sets of blobs, each with 20 elements in them + // they don't just scroll all together at the same time. + // theres an effect as if the'res a long line of them and they 'bump' into each other when the first one stops + // so take a careful look at the starting position and the final tween positions of these critters. + + for( int j=0; j<2; j++) // 2 sets..... { - for (i=0; i<20; i++) + for (i=0; i<20; i++) // 20 blobs... { - m_sprScrollingBlobs[j][i].Load( THEME->GetPathTo("Graphics","stage elements") ); + m_sprScrollingBlobs[j][i].Load( THEME->GetPathTo("Graphics","stage elements") ); // load the graphics m_sprScrollingBlobs[j][i].StopAnimating(); - m_sprScrollingBlobs[j][i].SetState( 3+bg_modeoffset ); + m_sprScrollingBlobs[j][i].SetState( 3+bg_modeoffset ); // shuffle the state according to offset + // (final uses different blobs) } } - for( j=0; j<2; j++) + for( j=0; j<2; j++) // 2 sets... { - for (i=0; i<20; i++) + for (i=0; i<20; i++) // 20 blobs.... { - if (j == 0) + if (j == 0) // if it's the first set { - m_sprScrollingBlobs[j][i].SetXY( fStageCenterX-(SCREEN_WIDTH/2)-500-((i*i)*4), 135 ); + m_sprScrollingBlobs[j][i].SetXY( CENTER_X-(SCREEN_WIDTH/2)-500-((i*i)*4), CENTER_Y + 135 ); // starting position if (ez2Final == 1) { - m_sprScrollingBlobs[j][i].SetY( 0-160); + m_sprScrollingBlobs[j][i].SetY( CENTER_Y-160); // different Y position for FINAL stage } } - else + else // if it's the second set { - m_sprScrollingBlobs[j][i].SetXY( fStageCenterX+(SCREEN_WIDTH/2)+500-((i*i)*4), 170 ); + m_sprScrollingBlobs[j][i].SetXY( CENTER_X+(SCREEN_WIDTH/2)+500-((i*i)*4), CENTER_Y+170 ); // starting position if (ez2Final == 1) { - m_sprScrollingBlobs[j][i].SetY( 180 ); + m_sprScrollingBlobs[j][i].SetY( CENTER_Y+180 ); // different Y position for FINAL stage } } } } - for( j=0; j<2; j++) + for( j=0; j<2; j++) // 2 sets... { - for (i=0; i<20; i++) + for (i=0; i<20; i++) // 20 blobs... { - m_sprScrollingBlobs[j][i].BeginTweening(0.2f * i / 7); - if (j == 0) - m_sprScrollingBlobs[j][i].SetTweenX(fStageCenterX-(SCREEN_WIDTH/2)+(i*30.0f)); - else - m_sprScrollingBlobs[j][i].SetTweenX(fStageCenterX+(SCREEN_WIDTH/2)-70-(i*30.0f)); + m_sprScrollingBlobs[j][i].BeginTweening(0.2f * i / 7); // start them tweening, different delay for each blob + if (j == 0) // set 1 + m_sprScrollingBlobs[j][i].SetTweenX(CENTER_X-(SCREEN_WIDTH/2)+30+(i*30.0f)); // keep them at equal distance when they arrive + else // set 2 + m_sprScrollingBlobs[j][i].SetTweenX(CENTER_X+(SCREEN_WIDTH/2)+30-70-(i*30.0f)); - m_frameStage.AddSubActor( &m_sprScrollingBlobs[j][i] ); + m_frameStage.AddSubActor( &m_sprScrollingBlobs[j][i] ); // add the actor } } + ////////////////////////////// + // END scrolling blobs // + ////////////////////////////// + + ////////////////////////////// + // START stage name // + ////////////////////////////// + + // in this bit we write the stage name onto the screen + // basically instead of 1st 2nd 3rd e.t.c. + // ez2dancer spells it fully + // The First Stage.... The Second Stage + // this is what this bit implements + + // write the stage name m_stagename.LoadFromFont( THEME->GetPathTo("Fonts","stage") ); m_stagename.TurnShadowOff(); - m_stagename.SetXY( fStageCenterX+400, 0-30+element_y_offsets ); + m_stagename.SetXY( CENTER_X+400, CENTER_Y-30+element_y_offsets ); // set initial position - switch (iStageNo) + switch (iStageNo) // from the stage number figure out which text to use { case 0: m_stagename.SetText( "THE NEXT STAGE" ); break; case 1: m_stagename.SetText( "THE FIRST STAGE" ); break; @@ -474,24 +527,32 @@ ScreenStage::ScreenStage() m_stagename.SetText( "" ); // make this text disappear. } - m_stagename.SetDiffuseColor( D3DXCOLOR(1.0f/225.0f*166.0f,1.0f/225.0f*83.0f,1/225.0f*16.0f,1) ); + m_stagename.SetDiffuseColor( D3DXCOLOR(1.0f/225.0f*166.0f,1.0f/225.0f*83.0f,1/225.0f*16.0f,1) ); // orangey colour - if (ez2Final == 1) + if (ez2Final == 1) // if we're final stage { - m_stagename.SetDiffuseColor( D3DXCOLOR(1.0f/225.0f*227.0f,1.0f/225.0f*228.0f,1/225.0f*255.0f,1) ); + m_stagename.SetDiffuseColor( D3DXCOLOR(1.0f/225.0f*227.0f,1.0f/225.0f*228.0f,1/225.0f*255.0f,1) ); // blueish colour m_stagename.SetText( "THE FINAL STAGE" ); stage_mode = MODE_FINAL; // set back to final again. ez2Final = 0; } - m_stagename.BeginTweening(0.5f); + m_stagename.BeginTweening(0.5f); // start tweening them to their new home - m_stagename.SetTweenX(fStageCenterX+70); // set their new locations - m_frameStage.AddSubActor( &m_stagename ); - } - */ - } + m_stagename.SetTweenX(CENTER_X+70); // set their new locations + m_frameStage.AddSubActor( &m_stagename ); //add the actor + ////////////////////////////// + // END stage name // + ////////////////////////////// + // Add in the number graphics that were neglected earlier + CString sStageNo = ssprintf("%d", iStageNo); + const int iNumChars = sStageNo.GetLength()+1; + for( i=0; iSendScreenMessage( SM_DoneFadingIn, 1.0f ); this->SendScreenMessage( SM_StartFadingOut, 4.0f );