FULLPIPE: Implement ModalFinal

This commit is contained in:
Eugene Sandulenko 2014-01-24 07:21:50 -08:00
parent ce383aca1e
commit 89640976c4
5 changed files with 141 additions and 2 deletions

View file

@ -157,6 +157,7 @@ public:
void stopSoundStream2();
void stopAllSoundStreams();
void stopAllSoundInstances(int id);
void updateSoundVolume();
int _sfxVolume;
@ -224,6 +225,8 @@ public:
int (*_updateScreenCallback)();
int (*_updateCursorCallback)();
void drawAlphaRectangle(int x1, int y1, int x2, int y2, int alpha);
int _cursorId;
int _minCursorId;
int _maxCursorId;

View file

@ -1295,4 +1295,8 @@ DynamicPhase *Shadows::findSize(int width, int height) {
return _items[idx].dynPhase;
}
void FullpipeEngine::drawAlphaRectangle(int x1, int y1, int x2, int y2, int alpha) {
warning("STUB: FullpipeEngine::drawAlphaRectangle()");
}
} // End of namespace Fullpipe

View file

@ -560,6 +560,103 @@ void FullpipeEngine::openMap() {
}
}
ModalFinal::ModalFinal() {
_flags = 0;
_counter = 255;
_sfxVolume = g_fp->_sfxVolume;
}
ModalFinal::~ModalFinal() {
if (g_vars->sceneFinal_var01) {
g_fp->_gameLoader->unloadScene(SC_FINAL2);
g_fp->_gameLoader->unloadScene(SC_FINAL3);
g_fp->_gameLoader->unloadScene(SC_FINAL4);
g_fp->_currentScene = g_fp->accessScene(SC_FINAL1);
g_fp->stopAllSounds();
g_vars->sceneFinal_var01 = 0;
}
g_fp->_sfxVolume = _sfxVolume;
}
bool ModalFinal::init(int counterdiff) {
if (g_vars->sceneFinal_var01) {
g_fp->_gameLoader->updateSystems(42);
return true;
}
if (_counter > 0) {
_flags |= 2u;
g_fp->_gameLoader->updateSystems(42);
return true;
}
unloadScenes();
g_fp->_modalObject = new ModalCredits();
return true;
}
void ModalFinal::unloadScenes() {
g_fp->_gameLoader->unloadScene(SC_FINAL2);
g_fp->_gameLoader->unloadScene(SC_FINAL3);
g_fp->_gameLoader->unloadScene(SC_FINAL4);
g_fp->_currentScene = g_fp->accessScene(SC_FINAL1);
g_fp->stopAllSounds();
}
bool ModalFinal::handleMessage(ExCommand *cmd) {
if (cmd->_messageKind == 17 && cmd->_messageNum == 36 && cmd->_keyCode == 27) {
g_fp->_modalObject = new ModalMainMenu();
g_fp->_modalObject->_parentObj = this;
return true;
}
return false;
}
void ModalFinal::update() {
if (g_fp->_currentScene) {
g_fp->_currentScene->draw();
if (_flags & 1) {
g_fp->drawAlphaRectangle(0, 0, 800, 600, 0xff - _counter);
_counter += 10;
if (_counter >= 255) {
_counter = 255;
_flags &= 0xfe;
}
} else {
if (!(_flags & 2))
return;
g_fp->drawAlphaRectangle(0, 0, 800, 600, 0xff - _counter);
_counter -= 10;
if (_counter <= 0) {
_counter = 0;
_flags &= 0xFD;
}
}
g_fp->_sfxVolume = _counter * (_sfxVolume + 3000) / 255 - 3000;
g_fp->updateSoundVolume();
}
}
void FullpipeEngine::openHelp() {
warning("STUB: FullpipeEngine::openHelp()");
}

View file

@ -107,9 +107,27 @@ class ModalMap : public BaseModalObject {
};
class ModalFinal : public BaseModalObject {
int _flags;
int _counter;
int _sfxVolume;
public:
ModalFinal() {}
virtual ~ModalFinal() {}
ModalFinal();
virtual ~ModalFinal();
virtual bool pollEvent() { return true; }
virtual bool handleMessage(ExCommand *message);
virtual bool init(int counterdiff);
virtual void update();
virtual void saveload() {}
void unloadScenes();
};
class ModalCredits : public BaseModalObject {
public:
ModalCredits() {}
virtual ~ModalCredits() {}
virtual bool pollEvent() { return true; }
virtual bool handleMessage(ExCommand *message) { return false; }
@ -118,6 +136,19 @@ class ModalFinal : public BaseModalObject {
virtual void saveload() {}
};
class ModalMainMenu : public BaseModalObject {
public:
ModalMainMenu() {}
virtual ~ModalMainMenu() {}
virtual bool pollEvent() { return true; }
virtual bool handleMessage(ExCommand *message) { return false; }
virtual bool init(int counterdiff) { return true; }
virtual void update() {}
virtual void saveload() {}
};
} // End of namespace Fullpipe
#endif /* FULLPIPE_MODAL_H */

View file

@ -199,4 +199,8 @@ void FullpipeEngine::stopAllSoundInstances(int id) {
}
}
void FullpipeEngine::updateSoundVolume() {
debug(3, "STUB FullpipeEngine::updateSoundVolume()");
}
} // End of namespace Fullpipe