From aa02a6758a8c5933aca3d80b5d1c3a2af5c7f300 Mon Sep 17 00:00:00 2001 From: Benjamin Haisch Date: Mon, 26 May 2008 07:27:46 +0000 Subject: - Hopefully fixed 'responsiveness' of the mouse cursor/event handling - Disabled auto dirty rects which caused major gfx problems - Added default mouse cursor for Manhole: N&E - Fixed sound rate for Manhole: N&E - Don't automatically show mouse cursor when a new cursor was loaded svn-id: r32279 --- engines/made/made.cpp | 16 +++++++++++----- engines/made/screen.cpp | 6 ++++++ engines/made/screen.h | 22 ++++++++++++++++++++++ engines/made/scriptfuncs.cpp | 4 +++- 4 files changed, 42 insertions(+), 6 deletions(-) diff --git a/engines/made/made.cpp b/engines/made/made.cpp index 08d00af9f4..92efb881e2 100644 --- a/engines/made/made.cpp +++ b/engines/made/made.cpp @@ -109,7 +109,13 @@ MadeEngine::MadeEngine(OSystem *syst, const MadeGameDescription *gameDesc) : Eng _quit = false; - _soundRate = 8000; + // Set default sound frequency + // Return to Zork sets it itself via a script funtion + if (getGameID() == GID_MANHOLE) { + _soundRate = 11025; + } else { + _soundRate = 8000; + } } @@ -176,7 +182,7 @@ void MadeEngine::handleEvents() { Common::Event event; Common::EventManager *eventMan = _system->getEventManager(); - // NOTE: Don't reset _eventNum to 0 here or no events will come through to the scripts. + // NOTE: Don't reset _eventNum to 0 here or no events will get through to the scripts. while (eventMan->pollEvent(event)) { switch (event.type) { @@ -225,8 +231,6 @@ void MadeEngine::handleEvents() { } } - _system->updateScreen(); - } int MadeEngine::go() { @@ -265,13 +269,15 @@ int MadeEngine::go() { // FIXME: This should make things a little faster until proper dirty rectangles // are implemented. - _system->setFeatureState(OSystem::kFeatureAutoComputeDirtyRects, true); + // NOTE: Disabled again since it causes major graphics errors. + //_system->setFeatureState(OSystem::kFeatureAutoComputeDirtyRects, true); _eventNum = _eventKey = _eventMouseX = _eventMouseY = 0; #ifdef DUMP_SCRIPTS _script->dumpAllScripts(); #else + _screen->setDefaultMouseCursor(); _script->runScript(_dat->getMainCodeObjectIndex()); #endif diff --git a/engines/made/screen.cpp b/engines/made/screen.cpp index e85ca71c59..754a45016c 100644 --- a/engines/made/screen.cpp +++ b/engines/made/screen.cpp @@ -352,6 +352,8 @@ void Screen::updateSprites() { _vm->_system->copyRectToScreen((const byte*)_workScreen->pixels, _workScreen->pitch, 0, 0, _workScreen->w, _workScreen->h); + _vm->_system->updateScreen(); + } void Screen::clearChannels() { @@ -824,4 +826,8 @@ void Screen::clearSpriteList() { _spriteList.clear(); } +void Screen::setDefaultMouseCursor() { + CursorMan.replaceCursor(defaultMouseCursor, 16, 16, 9, 2, 0); +} + } // End of namespace Made diff --git a/engines/made/screen.h b/engines/made/screen.h index d0df3bf080..20085bebdc 100644 --- a/engines/made/screen.h +++ b/engines/made/screen.h @@ -31,6 +31,7 @@ #include "common/rect.h" #include "graphics/surface.h" +#include "graphics/cursorman.h" #include "made/resource.h" #include "made/screenfx.h" @@ -62,6 +63,25 @@ struct SpriteListItem { class MadeEngine; +static const byte defaultMouseCursor[256] = { + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 1, 15, 15, 1, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 1, 15, 15, 1, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 1, 15, 15, 1, 0, 0, 0, 0, 0, + 0, 1, 1, 1, 1, 1, 1, 1, 15, 15, 1, 0, 0, 0, 0, 0, + 1, 1, 15, 1, 15, 1, 15, 1, 15, 15, 1, 0, 0, 0, 0, 0, + 1, 15, 15, 1, 15, 1, 15, 1, 15, 15, 1, 0, 0, 0, 0, 0, + 1, 15, 15, 15, 15, 15, 15, 15, 15, 15, 1, 0, 1, 1, 1, 0, + 1, 15, 15, 15, 15, 15, 15, 15, 15, 15, 1, 1, 15, 15, 15, 1, + 1, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 1, 1, 1, + 1, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 1, 1, 0, 0, + 1, 1, 15, 15, 15, 15, 15, 15, 15, 15, 15, 1, 1, 0, 0, 0, + 0, 1, 1, 15, 15, 15, 15, 15, 15, 15, 1, 1, 0, 0, 0, 0, + 0, 0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 +}; + class Screen { public: Screen(MadeEngine *vm); @@ -166,6 +186,8 @@ public: int16 addToSpriteList(int16 index, int16 xofs, int16 yofs); SpriteListItem getFromSpriteList(int16 index); void clearSpriteList(); + + void setDefaultMouseCursor(); protected: MadeEngine *_vm; diff --git a/engines/made/scriptfuncs.cpp b/engines/made/scriptfuncs.cpp index f068e2619b..f67b7c89c6 100644 --- a/engines/made/scriptfuncs.cpp +++ b/engines/made/scriptfuncs.cpp @@ -195,6 +195,9 @@ int16 ScriptFunctions::sfShowPage(int16 argc, int16 *argv) { } int16 ScriptFunctions::sfPollEvent(int16 argc, int16 *argv) { + + _vm->_system->updateScreen(); + int16 eventNum = _vm->_eventNum; _vm->_eventNum = 0; return eventNum; @@ -487,7 +490,6 @@ int16 ScriptFunctions::sfLoadMouseCursor(int16 argc, int16 *argv) { if (flex) { Graphics::Surface *surf = flex->getPicture(); CursorMan.replaceCursor((const byte *)surf->pixels, surf->w, surf->h, argv[1], argv[0], 0); - CursorMan.showMouse(true); _vm->_res->freeResource(flex); } return 0; -- cgit v1.2.3