From e20b90543d05b8e2c6e97004be36e43d5c671aa7 Mon Sep 17 00:00:00 2001 From: Sven Hesse Date: Fri, 26 Aug 2011 06:09:56 +0200 Subject: GOB: Fix the Geisha cursor --- engines/gob/draw_v1.cpp | 4 ++-- engines/gob/game.cpp | 3 --- engines/gob/gob.cpp | 2 +- engines/gob/init.h | 8 ++++++++ engines/gob/init_geisha.cpp | 47 ++++++++++++++++++++++++++++++++++++++++++++ engines/gob/init_v1.cpp | 4 ++++ engines/gob/init_v2.cpp | 4 ++++ engines/gob/inter.h | 1 + engines/gob/inter_geisha.cpp | 10 ++++++++++ engines/gob/module.mk | 1 + 10 files changed, 78 insertions(+), 6 deletions(-) create mode 100644 engines/gob/init_geisha.cpp diff --git a/engines/gob/draw_v1.cpp b/engines/gob/draw_v1.cpp index 3873a99d5f..064c74958a 100644 --- a/engines/gob/draw_v1.cpp +++ b/engines/gob/draw_v1.cpp @@ -44,8 +44,8 @@ void Draw_v1::initScreen() { _backSurface = _vm->_video->initSurfDesc(320, 200); _frontSurface = _vm->_global->_primarySurfDesc; - _cursorSprites = _vm->_video->initSurfDesc(32, 16, 2); - _scummvmCursor = _vm->_video->initSurfDesc(16, 16, SCUMMVM_CURSOR); + _cursorSprites = _vm->_video->initSurfDesc(_cursorWidth * 2, _cursorHeight, 2); + _scummvmCursor = _vm->_video->initSurfDesc(_cursorWidth , _cursorHeight, SCUMMVM_CURSOR); } void Draw_v1::closeScreen() { diff --git a/engines/gob/game.cpp b/engines/gob/game.cpp index 926027e15d..7b43e9c4d7 100644 --- a/engines/gob/game.cpp +++ b/engines/gob/game.cpp @@ -492,9 +492,6 @@ void Game::prepareStart() { _vm->_draw->_noInvalidated = true; _vm->_draw->_applyPal = false; _vm->_draw->_paletteCleared = false; - _vm->_draw->_cursorWidth = 16; - _vm->_draw->_cursorHeight = 16; - _vm->_draw->_transparentCursor = 1; for (int i = 0; i < 40; i++) { _vm->_draw->_cursorAnimLow[i] = -1; diff --git a/engines/gob/gob.cpp b/engines/gob/gob.cpp index 59a96951dd..7bb7928406 100644 --- a/engines/gob/gob.cpp +++ b/engines/gob/gob.cpp @@ -414,7 +414,7 @@ bool GobEngine::initGameParts() { break; case kGameTypeGeisha: - _init = new Init_v1(this); + _init = new Init_Geisha(this); _video = new Video_v1(this); _inter = new Inter_Geisha(this); _mult = new Mult_v1(this); diff --git a/engines/gob/init.h b/engines/gob/init.h index 1cb2904099..e8c948c72e 100644 --- a/engines/gob/init.h +++ b/engines/gob/init.h @@ -56,6 +56,14 @@ public: void initVideo(); }; +class Init_Geisha : public Init_v1 { +public: + Init_Geisha(GobEngine *vm); + ~Init_Geisha(); + + void initVideo(); +}; + class Init_v2 : public Init_v1 { public: Init_v2(GobEngine *vm); diff --git a/engines/gob/init_geisha.cpp b/engines/gob/init_geisha.cpp new file mode 100644 index 0000000000..01081a5af6 --- /dev/null +++ b/engines/gob/init_geisha.cpp @@ -0,0 +1,47 @@ +/* ScummVM - Graphic Adventure Engine + * + * ScummVM is the legal property of its developers, whose names + * are too numerous to list here. Please refer to the COPYRIGHT + * file distributed with this source distribution. + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * as published by the Free Software Foundation; either version 2 + * of the License, or (at your option) any later version. + + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. + * + */ + +#include "common/endian.h" + +#include "gob/gob.h" +#include "gob/init.h" +#include "gob/global.h" +#include "gob/draw.h" +#include "gob/video.h" + +namespace Gob { + +Init_Geisha::Init_Geisha(GobEngine *vm) : Init_v1(vm) { +} + +Init_Geisha::~Init_Geisha() { +} + +void Init_Geisha::initVideo() { + Init_v1::initVideo(); + + _vm->_draw->_cursorWidth = 16; + _vm->_draw->_cursorHeight = 23; + _vm->_draw->_transparentCursor = 1; +} + +} // End of namespace Gob diff --git a/engines/gob/init_v1.cpp b/engines/gob/init_v1.cpp index 6772a13eb0..25d521aca6 100644 --- a/engines/gob/init_v1.cpp +++ b/engines/gob/init_v1.cpp @@ -52,6 +52,10 @@ void Init_v1::initVideo() { _vm->_global->_pPaletteDesc->unused2 = _vm->_global->_unusedPalette2; _vm->_video->initSurfDesc(320, 200, PRIMARY_SURFACE); + + _vm->_draw->_cursorWidth = 16; + _vm->_draw->_cursorHeight = 16; + _vm->_draw->_transparentCursor = 1; } } // End of namespace Gob diff --git a/engines/gob/init_v2.cpp b/engines/gob/init_v2.cpp index f10d586a34..1289d561ea 100644 --- a/engines/gob/init_v2.cpp +++ b/engines/gob/init_v2.cpp @@ -62,6 +62,10 @@ void Init_v2::initVideo() { _vm->_global->_pPaletteDesc->unused2 = _vm->_global->_unusedPalette2; _vm->_video->initSurfDesc(_vm->_video->_surfWidth, _vm->_video->_surfHeight, PRIMARY_SURFACE); + + _vm->_draw->_cursorWidth = 16; + _vm->_draw->_cursorHeight = 16; + _vm->_draw->_transparentCursor = 1; } } // End of namespace Gob diff --git a/engines/gob/inter.h b/engines/gob/inter.h index ecbf22610d..dc509b6f22 100644 --- a/engines/gob/inter.h +++ b/engines/gob/inter.h @@ -344,6 +344,7 @@ protected: virtual void setupOpcodesFunc(); virtual void setupOpcodesGob(); + void oGeisha_loadCursor(OpFuncParams ¶ms); void oGeisha_loadSound(OpFuncParams ¶ms); int16 loadSound(int16 slot); diff --git a/engines/gob/inter_geisha.cpp b/engines/gob/inter_geisha.cpp index e3f3a24a98..98e904a11c 100644 --- a/engines/gob/inter_geisha.cpp +++ b/engines/gob/inter_geisha.cpp @@ -26,7 +26,9 @@ #include "gob/inter.h" #include "gob/dataio.h" #include "gob/script.h" +#include "gob/resources.h" #include "gob/game.h" +#include "gob/draw.h" #include "gob/sound/sound.h" #include "gob/sound/sounddesc.h" @@ -47,12 +49,20 @@ void Inter_Geisha::setupOpcodesDraw() { void Inter_Geisha::setupOpcodesFunc() { Inter_v1::setupOpcodesFunc(); + OPCODEFUNC(0x03, oGeisha_loadCursor); OPCODEFUNC(0x3A, oGeisha_loadSound); } void Inter_Geisha::setupOpcodesGob() { } +void Inter_Geisha::oGeisha_loadCursor(OpFuncParams ¶ms) { + if (_vm->_game->_script->peekByte(1) & 0x80) + warning("Geisha Stub: oGeisha_loadCursor: script[1] & 0x80"); + + o1_loadCursor(params); +} + void Inter_Geisha::oGeisha_loadSound(OpFuncParams ¶ms) { loadSound(-1); } diff --git a/engines/gob/module.mk b/engines/gob/module.mk index 7c634dfaa1..b85c387734 100644 --- a/engines/gob/module.mk +++ b/engines/gob/module.mk @@ -25,6 +25,7 @@ MODULE_OBJS := \ iniconfig.o \ init.o \ init_v1.o \ + init_geisha.o \ init_v2.o \ init_fascin.o \ init_v3.o \ -- cgit v1.2.3