Implemented the sfGetMouseClicks and sfResetMouseClicks opcodes and created the skeleton for sfScriptStartVideo, sfScriptReturnFromVideo and sfScriptEndVideo opcodes

svn-id: r27145
This commit is contained in:
Filippos Karapetis 2007-06-06 19:46:10 +00:00
parent 9e651592ec
commit 9b14f5faed
8 changed files with 84 additions and 8 deletions

View File

@ -183,11 +183,16 @@ void Anim::returnFromCutaway(void) {
// Note that clearCutaway() sets _cutawayActive to false.
clearCutaway();
// TODO: Handle fade up, if we previously faded down
warning("TODO: Implement the rest of returnFromCutaway()");
// TODO: Restore the scene
// Handle fade up, if we previously faded down
// TODO
// TODO: Restore the animations
// Restore the scene
_vm->_scene->restoreScene();
// Restore the animations
// TODO
for (int i = 0; i < MAX_ANIMATIONS; i++) {
if (_animations[i] && _animations[i]->state == ANIM_PLAYING) {
@ -213,6 +218,37 @@ void Anim::clearCutaway(void) {
}
}
void Anim::startVideo(int vid, bool fade) {
debug(0, "startVideo(%d, %d)", vid, fade);
// TODO
warning(0, "TODO: Anim::startVideo(%d, %d)", vid, fade);
_videoActive = true;
}
void Anim::endVideo(void) {
debug(0, "endVideo()");
// TODO
warning("TODO: Anim::endVideo()");
_videoActive = false;
}
void Anim::returnFromVideo(void) {
debug(0, "returnFromVideo()");
// TODO
warning("TODO: Anim::returnFromVideo");
_videoActive = false;
}
void Anim::nextVideoFrame(void) {
// TODO
}
void Anim::load(uint16 animId, const byte *animResourceData, size_t animResourceLength) {
AnimationData *anim;
uint16 temp;

View File

@ -120,6 +120,11 @@ public:
void returnFromCutaway(void);
void clearCutaway(void);
void startVideo(int vid, bool fade);
void endVideo(void);
void returnFromVideo(void);
void nextVideoFrame(void);
void load(uint16 animId, const byte *animResourceData, size_t animResourceLength);
void freeId(uint16 animId);
void play(uint16 animId, int vectorTime, bool playing = true);
@ -137,6 +142,9 @@ public:
bool hasCutaway(void) {
return _cutawayActive;
}
bool hasVideo(void) {
return _videoActive;
}
bool hasAnimation(uint16 animId) {
if (animId >= MAX_ANIMATIONS) {
if (animId < MAX_ANIMATIONS + ARRAYSIZE(_cutawayAnimations))
@ -192,6 +200,7 @@ private:
Cutaway *_cutawayList;
int _cutawayListLength;
bool _cutawayActive;
bool _videoActive;
};
} // End of namespace Saga

View File

@ -87,6 +87,7 @@ SagaEngine::SagaEngine(OSystem *syst)
_frameCount = 0;
_globalFlags = 0;
_mouseClickCount = 0;
memset(_ethicsPoints, 0, sizeof(_ethicsPoints));
// The Linux version of Inherit the Earth puts all data files in an

View File

@ -559,6 +559,18 @@ public:
int processInput(void);
Point mousePos() const;
int getMouseClickCount() {
return _mouseClickCount;
}
void incrementMouseClickCount() {
_mouseClickCount++;
}
void resetMouseClickCount() {
_mouseClickCount = 0;
}
const bool leftMouseButtonPressed() const {
return _leftMouseButtonPressed;
}
@ -580,6 +592,7 @@ public:
bool _leftMouseButtonPressed;
bool _rightMouseButtonPressed;
int _mouseClickCount;
bool _quit;

View File

@ -1209,6 +1209,11 @@ void Scene::endScene() {
}
void Scene::restoreScene() {
// TODO
warning("TODO: restoreScene()");
}
void Scene::cmdSceneChange(int argc, const char **argv) {
int scene_num = 0;

View File

@ -224,6 +224,7 @@ class Scene {
void nextScene();
void skipScene();
void endScene();
void restoreScene();
void queueScene(LoadSceneParams *sceneQueue) {
_sceneQueue.push_back(*sceneQueue);
}

View File

@ -592,6 +592,7 @@ void Script::playfieldClick(const Point& mousePoint, bool leftButton) {
const HitZone *hitZone;
Point specialPoint;
_vm->incrementMouseClickCount();
_vm->_actor->abortSpeech();
if ((_vm->_actor->_protagonist->_currentAction != kActionWait) &&

View File

@ -1887,11 +1887,11 @@ void Script::sfEndCutAway(SCRIPTFUNC_PARAMS) {
}
void Script::sfGetMouseClicks(SCRIPTFUNC_PARAMS) {
SF_stub("sfGetMouseClicks", thread, nArgs);
thread->_returnValue = _vm->getMouseClickCount();
}
void Script::sfResetMouseClicks(SCRIPTFUNC_PARAMS) {
SF_stub("sfResetMouseClicks", thread, nArgs);
_vm->resetMouseClickCount();
}
// Used in IHNM only
@ -1927,15 +1927,25 @@ void Script::sfScriptFade(SCRIPTFUNC_PARAMS) {
}
void Script::sfScriptStartVideo(SCRIPTFUNC_PARAMS) {
SF_stub("sfScriptStartVideo", thread, nArgs);
int16 vid;
int16 fade;
vid = thread->pop();
fade = thread->pop();
_vm->_interface->setStatusText("");
_vm->_anim->startVideo(vid, fade != 0);
_vm->_interface->rememberMode();
_vm->_interface->setMode(kPanelVideo);
}
void Script::sfScriptReturnFromVideo(SCRIPTFUNC_PARAMS) {
SF_stub("sfScriptReturnFromVideo", thread, nArgs);
_vm->_anim->returnFromVideo();
_vm->_interface->restoreMode();
}
void Script::sfScriptEndVideo(SCRIPTFUNC_PARAMS) {
SF_stub("sfScriptEndVideo", thread, nArgs);
_vm->_anim->endVideo();
_vm->_interface->restoreMode();
}
void Script::sf87(SCRIPTFUNC_PARAMS) {