diff options
author | Eugene Sandulenko | 2004-11-20 00:05:50 +0000 |
---|---|---|
committer | Eugene Sandulenko | 2004-11-20 00:05:50 +0000 |
commit | e5cc4c629aac5d40f629155679c0c6cd8dc169e4 (patch) | |
tree | 9caf4b0e0b5df0bdc0bec81d4daf9fc663bfb1f2 | |
parent | 5748227adcc17e76eab0c33e99bb978b170b3de0 (diff) | |
download | scummvm-rg350-e5cc4c629aac5d40f629155679c0c6cd8dc169e4.tar.gz scummvm-rg350-e5cc4c629aac5d40f629155679c0c6cd8dc169e4.tar.bz2 scummvm-rg350-e5cc4c629aac5d40f629155679c0c6cd8dc169e4.zip |
o Restore cursor after walkthrough
o Add cursor events
o Hide cursor during intro
svn-id: r15844
-rw-r--r-- | saga/events.cpp | 11 | ||||
-rw-r--r-- | saga/events.h | 8 | ||||
-rw-r--r-- | saga/gfx.cpp | 5 | ||||
-rw-r--r-- | saga/gfx.h | 2 | ||||
-rw-r--r-- | saga/input.cpp | 4 | ||||
-rw-r--r-- | saga/scene.cpp | 16 |
6 files changed, 42 insertions, 4 deletions
diff --git a/saga/events.cpp b/saga/events.cpp index b1ee1bdfcd..435256517f 100644 --- a/saga/events.cpp +++ b/saga/events.cpp @@ -408,6 +408,17 @@ int Events::handleOneShot(EVENT *event) { _vm->_script->SThreadCompleteThread(); break; + case CURSOR_EVENT: + switch (event->op) { + case EVENT_SHOW: + _vm->_gfx->showCursor(true); + break; + case EVENT_HIDE: + _vm->_gfx->showCursor(false); + break; + default: + break; + } default: break; } diff --git a/saga/events.h b/saga/events.h index aaf72e6f85..30976f476e 100644 --- a/saga/events.h +++ b/saga/events.h @@ -52,8 +52,9 @@ enum EVENT_CODES { TRANSITION_EVENT, INTERFACE_EVENT, CONSOLE_EVENT, - ACTOEVENT, - SCRIPT_EVENT + ACTOR_EVENT, + SCRIPT_EVENT, + CURSOR_EVENT }; enum EVENT_OPS { @@ -83,6 +84,9 @@ enum EVENT_OPS { // SCRIPT events EVENT_BLOCKING = 1, EVENT_NONBLOCKING = 2, + // CURSOR events + EVENT_SHOW = 1, + // EVENT_HIDE = 2, // reused // CONTINUOUS events // PALETTE events diff --git a/saga/gfx.cpp b/saga/gfx.cpp index ab3342e8f2..7a7a5397c6 100644 --- a/saga/gfx.cpp +++ b/saga/gfx.cpp @@ -1029,6 +1029,11 @@ int Gfx::blackToPal(SURFACE *surface, PALENTRY *src_pal, double percent) { return SUCCESS; } +void Gfx::showCursor(bool state) { + updateCursor(); + g_system->showMouse(state); +} + void Gfx::setCursor(int best_white) { int i; byte keycolor = (best_white == 0) ? 1 : 0; diff --git a/saga/gfx.h b/saga/gfx.h index 3adb33243f..8bccae32c8 100644 --- a/saga/gfx.h +++ b/saga/gfx.h @@ -107,6 +107,8 @@ public: int getCurrentPal(PALENTRY *src_pal); int palToBlack(SURFACE *surface, PALENTRY *src_pal, double percent); int blackToPal(SURFACE *surface, PALENTRY *src_pal, double percent); + void updateCursor() { setCursor(getWhite()); } + void showCursor(bool state); private: void setCursor(int best_white); diff --git a/saga/input.cpp b/saga/input.cpp index 0cf467fb96..88d4c7193f 100644 --- a/saga/input.cpp +++ b/saga/input.cpp @@ -42,8 +42,10 @@ int SagaEngine::processInput() { switch (event.event_code) { case OSystem::EVENT_KEYDOWN: - if ((event.kbd.flags == OSystem::KBD_CTRL) && (event.kbd.keycode == 'w')) + if ((event.kbd.flags == OSystem::KBD_CTRL) && (event.kbd.keycode == 'w')) { _walkthroughDialog->runModal(); + _gfx->updateCursor(); + } if (_vm->_console->isActive()) { in_char = event.kbd.ascii; switch (event.kbd.keycode) { diff --git a/saga/scene.cpp b/saga/scene.cpp index 8b91cfbd94..3e423dbd19 100644 --- a/saga/scene.cpp +++ b/saga/scene.cpp @@ -174,6 +174,7 @@ int Scene::clearSceneQueue() { int Scene::startScene() { YS_DL_NODE *node; SCENE_QUEUE *scene_qdat; + EVENT event; assert(_initialized); @@ -187,6 +188,12 @@ int Scene::startScene() { return FAILURE; } + // Hide cursor during intro + event.type = ONESHOT_EVENT; + event.code = CURSOR_EVENT; + event.op = EVENT_HIDE; + _vm->_events->queue(&event); + switch (GAME_GetGameType()) { case GID_ITE: ITEStartProc(); @@ -965,6 +972,7 @@ static void CF_objectinfo(int argc, char *argv[], void *refCon) { int Scene::defaultScene(int param, SCENE_INFO *scene_info) { EVENT event; + EVENT *q_event; switch (param) { case SCENE_BEGIN: @@ -1011,8 +1019,14 @@ int Scene::defaultScene(int param, SCENE_INFO *scene_info) { event.op = EVENT_CYCLESTART; event.time = 0; - _vm->_events->queue(&event); + q_event = _vm->_events->queue(&event); + // Show cursor + event.type = ONESHOT_EVENT; + event.code = CURSOR_EVENT; + event.op = EVENT_SHOW; + _vm->_events->chain(q_event, &event); + // Start scene animations _vm->_anim->setFlag(0, ANIM_LOOP); _vm->_anim->play(0, 0); |