more fixes to Oni and courses
This commit is contained in:
@@ -1,11 +1,12 @@
|
||||
#include "stdafx.h"
|
||||
/*
|
||||
-----------------------------------------------------------------------------
|
||||
File: ScreenPrompt.h
|
||||
Class: ScreenPrompt
|
||||
|
||||
Desc: Area for testing.
|
||||
Desc: See header.
|
||||
|
||||
Copyright (c) 2001-2002 by the person(s) listed below. All rights reserved.
|
||||
Chris Danford
|
||||
-----------------------------------------------------------------------------
|
||||
*/
|
||||
|
||||
@@ -18,51 +19,40 @@
|
||||
#include "GameConstantsAndTypes.h"
|
||||
#include "PrefsManager.h"
|
||||
|
||||
ScreenPrompt::ScreenPrompt( CString sText, PromptType pt, bool* pbAnswer )
|
||||
const float QUESTION_X = CENTER_X;
|
||||
const float QUESTION_Y = CENTER_Y - 60;
|
||||
|
||||
const float PROMPT_X = CENTER_X;
|
||||
const float PROMPT_Y = CENTER_Y + 120;
|
||||
|
||||
|
||||
ScreenPrompt::ScreenPrompt( ScreenMessage SM_SendWhenDone, CString sText, PromptType pt, bool bDefaultAnswer, void(*OnYes)(void* pContext), void(*OnNo)(void* pContext) )
|
||||
{
|
||||
|
||||
static bool bThrowAway;
|
||||
|
||||
if( pbAnswer == NULL )
|
||||
pbAnswer = &bThrowAway;
|
||||
|
||||
m_SMSendWhenDone = SM_SendWhenDone;
|
||||
m_pOnYes = OnYes;
|
||||
m_pOnNo = OnNo;
|
||||
|
||||
m_PromptType = pt;
|
||||
m_pbAnswer = pbAnswer;
|
||||
|
||||
ASSERT( !(pt == PROMPT_YES_NO && pt == NULL) );
|
||||
m_bAnswer = bDefaultAnswer;
|
||||
|
||||
m_Fade.SetTransitionTime( 0.5f );
|
||||
m_Fade.SetColor( D3DXCOLOR(0,0,0,0.7f) );
|
||||
m_Fade.SetOpened();
|
||||
m_Fade.CloseWipingRight();
|
||||
m_Fade.SetZ(-2);
|
||||
this->AddSubActor( &m_Fade );
|
||||
|
||||
CStringArray arrayTextLines;
|
||||
split( sText, "\n", arrayTextLines );
|
||||
for( int i=0; i<arrayTextLines.GetSize(); i++ )
|
||||
{
|
||||
m_textQuestion[i].Load( THEME->GetPathTo(FONT_HEADER1) );
|
||||
m_textQuestion[i].SetText( arrayTextLines[i] );
|
||||
m_textQuestion[i].SetXY( CENTER_X, CENTER_Y-50 + i*27 - arrayTextLines.GetSize()*27/2 );
|
||||
m_textQuestion[i].SetZ(-2);
|
||||
this->AddSubActor( &m_textQuestion[i] );
|
||||
}
|
||||
m_textQuestion.Load( THEME->GetPathTo(FONT_NORMAL) );
|
||||
m_textQuestion.SetText( sText );
|
||||
m_textQuestion.SetXY( QUESTION_X, QUESTION_Y );
|
||||
this->AddSubActor( &m_textQuestion );
|
||||
|
||||
m_rectAnswerBox.SetDiffuseColor( D3DXCOLOR(0.5f,0.5f,1.0f,0.7f) );
|
||||
m_rectAnswerBox.SetXY( m_textAnswer[*m_pbAnswer].GetX(), m_textAnswer[*m_pbAnswer].GetY() );
|
||||
m_rectAnswerBox.SetZoomX( m_textAnswer[*m_pbAnswer].GetWidestLineWidthInSourcePixels()+10.0f );
|
||||
m_rectAnswerBox.SetZoomY( 30 );
|
||||
m_rectAnswerBox.SetZ(-2);
|
||||
this->AddSubActor( &m_rectAnswerBox );
|
||||
|
||||
m_textAnswer[0].Load( THEME->GetPathTo(FONT_HEADER1) );
|
||||
m_textAnswer[1].Load( THEME->GetPathTo(FONT_HEADER1) );
|
||||
m_textAnswer[0].SetY( CENTER_Y+120 );
|
||||
m_textAnswer[1].SetY( CENTER_Y+120 );
|
||||
m_textAnswer[0].SetZ(-2);
|
||||
m_textAnswer[1].SetZ(-2);
|
||||
m_textAnswer[0].SetY( PROMPT_Y );
|
||||
m_textAnswer[1].SetY( PROMPT_Y );
|
||||
this->AddSubActor( &m_textAnswer[0] );
|
||||
this->AddSubActor( &m_textAnswer[1] );
|
||||
|
||||
@@ -72,23 +62,21 @@ ScreenPrompt::ScreenPrompt( CString sText, PromptType pt, bool* pbAnswer )
|
||||
{
|
||||
case PROMPT_OK:
|
||||
m_textAnswer[0].SetText( "OK" );
|
||||
m_textAnswer[0].SetX( CENTER_X );
|
||||
m_textAnswer[0].SetX( PROMPT_X );
|
||||
break;
|
||||
case PROMPT_YES_NO:
|
||||
m_textAnswer[0].SetText( "NO" );
|
||||
m_textAnswer[1].SetText( "YES" );
|
||||
m_textAnswer[0].SetX( CENTER_X+50 );
|
||||
m_textAnswer[1].SetX( CENTER_X-50 );
|
||||
m_textAnswer[0].SetX( PROMPT_X+50 );
|
||||
m_textAnswer[1].SetX( PROMPT_X-50 );
|
||||
break;
|
||||
}
|
||||
|
||||
m_rectAnswerBox.SetXY( m_textAnswer[*m_pbAnswer].GetX(), m_textAnswer[*m_pbAnswer].GetY() );
|
||||
m_rectAnswerBox.SetZoomX( m_textAnswer[*m_pbAnswer].GetWidestLineWidthInSourcePixels()+10.0f );
|
||||
m_rectAnswerBox.SetXY( m_textAnswer[m_bAnswer].GetX(), m_textAnswer[m_bAnswer].GetY() );
|
||||
m_rectAnswerBox.SetZoomX( m_textAnswer[m_bAnswer].GetWidestLineWidthInSourcePixels()+10.0f );
|
||||
m_rectAnswerBox.SetZoomY( 30 );
|
||||
|
||||
m_textAnswer[*m_pbAnswer].SetEffectGlowing();
|
||||
|
||||
|
||||
m_soundSelect.Load( THEME->GetPathTo(SOUND_MENU_START) );
|
||||
m_textAnswer[m_bAnswer].SetEffectGlowing();
|
||||
}
|
||||
|
||||
void ScreenPrompt::Update( float fDeltaTime )
|
||||
@@ -120,7 +108,7 @@ void ScreenPrompt::HandleScreenMessage( const ScreenMessage SM )
|
||||
case SM_DoneOpeningWipingLeft:
|
||||
break;
|
||||
case SM_DoneOpeningWipingRight:
|
||||
SCREENMAN->PopTopScreen();
|
||||
SCREENMAN->PopTopScreen( m_SMSendWhenDone );
|
||||
break;
|
||||
}
|
||||
}
|
||||
@@ -138,33 +126,28 @@ void ScreenPrompt::MenuRight( const PlayerNumber p )
|
||||
if( m_PromptType == PROMPT_OK )
|
||||
return;
|
||||
|
||||
m_textAnswer[*m_pbAnswer].SetEffectNone();
|
||||
*m_pbAnswer = !*m_pbAnswer;
|
||||
m_textAnswer[*m_pbAnswer].SetEffectGlowing();
|
||||
m_textAnswer[m_bAnswer].SetEffectNone();
|
||||
m_bAnswer = !m_bAnswer;
|
||||
m_textAnswer[m_bAnswer].SetEffectGlowing();
|
||||
|
||||
m_rectAnswerBox.BeginTweening( 0.2f );
|
||||
m_rectAnswerBox.SetTweenXY( m_textAnswer[*m_pbAnswer].GetX(), m_textAnswer[*m_pbAnswer].GetY() );
|
||||
m_rectAnswerBox.SetTweenZoomX( m_textAnswer[*m_pbAnswer].GetWidestLineWidthInSourcePixels()+10.0f );
|
||||
m_rectAnswerBox.SetTweenXY( m_textAnswer[m_bAnswer].GetX(), m_textAnswer[m_bAnswer].GetY() );
|
||||
m_rectAnswerBox.SetTweenZoomX( m_textAnswer[m_bAnswer].GetWidestLineWidthInSourcePixels()+10.0f );
|
||||
|
||||
SOUND->PlayOnceStreamed( THEME->GetPathTo(SOUND_EDIT_CHANGE_LINE) );
|
||||
}
|
||||
|
||||
void ScreenPrompt::MenuStart( const PlayerNumber p )
|
||||
{
|
||||
m_Fade.OpenWipingRight( SM_DoneOpeningWipingRight );
|
||||
|
||||
m_textTitle.BeginTweening( 0.2f );
|
||||
m_textTitle.SetTweenDiffuseColor( D3DXCOLOR(1,1,1,0) );
|
||||
|
||||
for( int i=0; i<NUM_QUESTION_LINES; i++ )
|
||||
{
|
||||
m_textQuestion[i].BeginTweening( 0.2f );
|
||||
m_textQuestion[i].SetTweenDiffuseColor( D3DXCOLOR(1,1,1,0) );
|
||||
}
|
||||
m_textQuestion.BeginTweening( 0.2f );
|
||||
m_textQuestion.SetTweenDiffuseColor( D3DXCOLOR(1,1,1,0) );
|
||||
|
||||
m_rectAnswerBox.BeginTweening( 0.2f );
|
||||
m_rectAnswerBox.SetTweenDiffuseColor( D3DXCOLOR(1,1,1,0) );
|
||||
|
||||
m_textAnswer[*m_pbAnswer].SetEffectNone();
|
||||
m_textAnswer[m_bAnswer].SetEffectNone();
|
||||
|
||||
m_textAnswer[0].BeginTweening( 0.2f );
|
||||
m_textAnswer[0].SetTweenDiffuseColor( D3DXCOLOR(1,1,1,0) );
|
||||
@@ -172,7 +155,7 @@ void ScreenPrompt::MenuStart( const PlayerNumber p )
|
||||
m_textAnswer[1].SetTweenDiffuseColor( D3DXCOLOR(1,1,1,0) );
|
||||
|
||||
|
||||
m_soundSelect.PlayRandom();
|
||||
SOUND->PlayOnceStreamed( THEME->GetPathTo(SOUND_MENU_START) );
|
||||
}
|
||||
|
||||
void ScreenPrompt::MenuBack( const PlayerNumber p )
|
||||
|
||||
Reference in New Issue
Block a user