31 #include "laStagesJR.h"
33 stageIntro::stageIntro(
void)
39 strcpy(_strTitle,
"Untitled Intro");
40 strcpy(_strNarrator,
"Unknown Narrator");
42 _bNarrator_AutoEmotions = _bNarrator_AutoEmotions_OnCompletion = M_TRUE;
44 _ttEmotionSwitch.parameters(0.5);
45 _ttEmotionSwitch.force();
47 _mkEnter.set(KEY_RETURN, 0.4, 1);
48 _mkEscape.set(KEY_ESCAPE, 0.4, 1);
51 stageIntro::~stageIntro(
void) {
64 fp->readText(_strTitle);
65 fp->readText(_strNarrator);
66 fp->readBool(&_bNarrator_AutoEmotions);
67 fp->readBool(&_bNarrator_AutoEmotions_OnCompletion);
70 fp->readObj(&_fxNarratorText, M_FALSE);
71 _fxNarratorText.parameters(
72 laSystemIntegrator::getRenderer()->font(
"plain"),
73 15, 1.7, laColor(255,255,255, 200));
76 _fxNarratorText.enableRambleFX();
80 void stageIntro::onInit()
82 _uiDesktop.create(
"ui\\desktop-mm.dsk");
87 _pb->create( laPoint3(), laPoint3(100, 50) );
88 _pb->setText(
"CONTINUE");
89 _uiDesktop.insert( _pb );
90 _pb->move( laPoint3(0, 40),
M_AC,
M_AB);
94 void stageIntro::onFini(){
99 void stageIntro::onActivate()
101 ASSERT(_pTS,
"Nil tileset");
103 laSystemIntegrator::getEnvironment()->setTitle(_strTitle);
104 _uiDesktop.getMousePointer()->show();
105 _uiDesktop.get(1)->hide();
109 unsigned nNaratorID = _pTS->getElementIndex(_strNarrator);
110 if( nNaratorID >= _pTS->getElementCnt() )
throw laError(
"stageIntro::onFrame(): Narrator of type '%s' is not present in the TS", _strNarrator);
111 laElement* pNaratorElement = _pTS->getElement(nNaratorID);
114 _pNarrator->setTS(_pTS);
115 _pNarrator->setObject(nNaratorID, (
laElement*)pNaratorElement);
116 _pNarrator->create();
117 _pNarrator->setOutline(
laOutline(M_TRUE, laColor(250,250,250)) );
120 void stageIntro::onDeactivate()
122 ASSERT(_pTS,
"Nil tileset");
123 ASSERT(_pNarrator,
"Nil narrator object");
133 ASSERT(_pTS,
"Nil tileset");
134 ASSERT(_pNarrator,
"Nil narrator object");
139 _uiDesktop.drawBackground();
145 _mkEnter.animate(pi, *pt);
146 _mkEscape.animate(pi, *pt);
148 if( _mkEnter.isActivated() || _mkEscape.isActivated() )
153 if( _fxNarratorText.isFinished() )
154 ::laSystemIntegrator::getGame()->setStage(M_STAGE_GAME);
157 _fxNarratorText.force();
158 if(_bNarrator_AutoEmotions_OnCompletion) _bNarrator_AutoEmotions = M_TRUE;
164 double w = laSystemIntegrator::getSettings()->graphics_resolution_w;
165 double h = laSystemIntegrator::getSettings()->graphics_resolution_h;
166 double y_min = h - _fxNarratorText.height() - 150;
168 _fxNarratorText.draw(pr, laPoint3(w/2, y_min, 0));
169 _fxNarratorText.animate( *pt );
171 if( _fxNarratorText.visibleCount() >= _fxNarratorText.totalCount() ) _uiDesktop.get(1)->show();
176 pr->transRotate( -10, laPoint3(1,0,0) );
179 pr->styleSet( laColor(255, 255, 255, 255) );
182 pr->lightAmbient(0, laColor(100,100,100,255) );
183 pr->lightMakeSunlight(0, laPoint3( 0, 0, -
M_UNIT*10 ) );
185 _pNarrator->drawGeometry( pr, laPoint3() );
186 _pNarrator->animate( *pt );
190 _pTS->getBackgroundElement()->drawGeometry(pr);
191 _pTS->getBackgroundElement()->drawFx(pr);
196 _ttEmotionSwitch.animate( *pt );
198 if( !_bNarrator_AutoEmotions )
200 _pNarrator->state( _fxNarratorText.currentEmotion() );
202 else if( _ttEmotionSwitch.isElapsed())
204 _pNarrator->state( rand()% (_pNarrator->getObject()->getModelCnt()) );
206 _ttEmotionSwitch.parameters( 1 + (rand()%10)/10.0 );
207 _ttEmotionSwitch.reset();
#define M_AB
Text align bottom.
#define M_UNIT
Unit of 1 meter.
virtual void onCommand(unsigned long uID, unsigned long nCmd)
Command event handler.
Base Class for Tileset Elements.
Multi-state Level Object.
Object outline properties.
#define M_AC
Text align center.
Virtual interface for the Engine graphics renderer.
virtual void modeInterface()=0
Switch to interface rendering (2D projection mode)
virtual void modeLight(M_BOOL bOn)=0
Enable/disable lighting.
virtual void modeWorld(const laPoint3 &pos, const laPoint3 &ang=laPoint3())=0
Switch to "world rendering" (3D projection mode)