diff options
author | Arnaud Boutonné | 2009-04-29 16:36:08 +0000 |
---|---|---|
committer | Arnaud Boutonné | 2009-04-29 16:36:08 +0000 |
commit | 93e2e75a9e6d6d56c024e6a87d24d92ad89c8a1d (patch) | |
tree | d44e1dedd56b25c15738d8c639be0713f2add3b6 | |
parent | 4ff69f6cd0aec143525bb7693846748c39fbc2cc (diff) | |
download | scummvm-rg350-93e2e75a9e6d6d56c024e6a87d24d92ad89c8a1d.tar.gz scummvm-rg350-93e2e75a9e6d6d56c024e6a87d24d92ad89c8a1d.tar.bz2 scummvm-rg350-93e2e75a9e6d6d56c024e6a87d24d92ad89c8a1d.zip |
- Added a game_fascin skeletton, as specificities are now proven
- Added a new game time, adibouunknown, used to reference the ADI/Adibou/Addy generic environments
- Replace oFascin_cdUnknown10 by a real function
- Fix a detail in oFascin_cdUnknown11
- Suppress double declaration for types Gob2 and Ween
svn-id: r40207
-rw-r--r-- | engines/gob/game.h | 9 | ||||
-rw-r--r-- | engines/gob/game_fascin.cpp | 204 | ||||
-rw-r--r-- | engines/gob/gob.cpp | 18 | ||||
-rw-r--r-- | engines/gob/gob.h | 3 | ||||
-rw-r--r-- | engines/gob/inter.h | 4 | ||||
-rw-r--r-- | engines/gob/inter_fascin.cpp | 23 |
6 files changed, 235 insertions, 26 deletions
diff --git a/engines/gob/game.h b/engines/gob/game.h index 6a8a256c8a..3264288a32 100644 --- a/engines/gob/game.h +++ b/engines/gob/game.h @@ -339,6 +339,15 @@ protected: void collSubReenter(); }; +class Game_Fascination : public Game_v2 { +public: + virtual int16 checkCollisions(byte handleMouse, int16 deltaTime, + int16 *pResId, int16 *pResIndex); + + Game_Fascination(GobEngine *vm); + virtual ~Game_Fascination() {} +}; + } // End of namespace Gob #endif // GOB_GAME_H diff --git a/engines/gob/game_fascin.cpp b/engines/gob/game_fascin.cpp new file mode 100644 index 0000000000..8e77141ce6 --- /dev/null +++ b/engines/gob/game_fascin.cpp @@ -0,0 +1,204 @@ +/* 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. + * + * $URL$ + * $Id$ + * + */ + +#include "common/endian.h" +#include "common/stream.h" + +#include "gob/gob.h" +#include "gob/game.h" +#include "gob/global.h" +#include "gob/util.h" +#include "gob/dataio.h" +#include "gob/draw.h" +#include "gob/goblin.h" +#include "gob/inter.h" +#include "gob/mult.h" +#include "gob/parse.h" +#include "gob/scenery.h" +#include "gob/video.h" +#include "gob/videoplayer.h" +#include "gob/sound/sound.h" + +namespace Gob { + +Game_Fascination::Game_Fascination(GobEngine *vm) : Game_v2(vm) { +} + +int16 Game_Fascination::checkCollisions(byte handleMouse, int16 deltaTime, int16 *pResId, + int16 *pResIndex) { + int16 resIndex; + int16 key; + int16 oldIndex; + int16 oldId; + int16 newkey; + uint32 timeKey; + + _scrollHandleMouse = handleMouse != 0; + + if (deltaTime >= -1) { + _lastCollKey = 0; + _lastCollAreaIndex = 0; + _lastCollId = 0; + } + + if (pResId != 0) + *pResId = 0; + + resIndex = 0; + + if ((_vm->_draw->_cursorIndex == -1) && + (handleMouse != 0) && (_lastCollKey == 0)) { + _lastCollKey = checkMousePoint(1, &_lastCollId, &_lastCollAreaIndex); + + if ((_lastCollKey != 0) && (_lastCollId & 0x8000)) + collAreaSub(_lastCollAreaIndex, 1); + } + + if (handleMouse != 0) { + if ((handleMouse==1) && (_vm->_draw->_renderFlags & RENDERFLAG_UNKNOWN)) + warning("checkCollisions : RENDERFLAG_UNKNOWN - Unknown behavior"); + _vm->_draw->animateCursor(-1); + } + + timeKey = _vm->_util->getTimeKey(); + while (1) { + if (_vm->_inter->_terminate || _vm->shouldQuit()) { + if (handleMouse) + _vm->_draw->blitCursor(); + return 0; + } + + if (!_vm->_draw->_noInvalidated) { + if (handleMouse != 0) + _vm->_draw->animateCursor(-1); + else + _vm->_draw->blitInvalidated(); + _vm->_video->waitRetrace(); + } + + key = checkKeys(&_vm->_global->_inter_mouseX, + &_vm->_global->_inter_mouseY, &_mouseButtons, handleMouse); + + if ((handleMouse == 0) && (_mouseButtons != 0)) { + _vm->_util->waitMouseRelease(0); + key = 3; + } + + if (key != 0) { + + if (handleMouse & 1) + _vm->_draw->blitCursor(); + + if (pResId != 0) + *pResId = 0; + + if (pResIndex != 0) + *pResIndex = 0; + + if (_lastCollKey != 0) + collAreaSub(_lastCollAreaIndex, 0); + + _lastCollKey = 0; + if (key != 0) + return key; + } + + if (handleMouse != 0) { + if (_mouseButtons != 0) { + if (deltaTime > 0) { + _vm->_draw->animateCursor(2); + _vm->_util->delay(deltaTime); + } else if (handleMouse & 1) + _vm->_util->waitMouseRelease(1); + _vm->_draw->animateCursor(-1); + + if (pResId != 0) + *pResId = 0; + + key = checkMousePoint(0, pResId, &resIndex); + if (pResIndex != 0) + *pResIndex = resIndex; + + if ((key != 0) || ((pResId != 0) && (*pResId != 0))) { + if ((handleMouse & 1) && + ((deltaTime <= 0) || (_mouseButtons == 0))) + _vm->_draw->blitCursor(); + + if ((_lastCollKey != 0) && (key != _lastCollKey)) + collAreaSub(_lastCollAreaIndex, 0); + + _lastCollKey = 0; + return key; + } + + if (handleMouse & 4) + return 0; + + if (_lastCollKey != 0) + collAreaSub(_lastCollAreaIndex, 0); + + _lastCollKey = checkMousePoint(1, &_lastCollId, &_lastCollAreaIndex); + if ((_lastCollKey != 0) && (_lastCollId & 0x8000)) + collAreaSub(_lastCollAreaIndex, 1); + } else if ((_vm->_global->_inter_mouseX != _vm->_draw->_cursorX) || + (_vm->_global->_inter_mouseY != _vm->_draw->_cursorY)) { + + oldIndex = _lastCollAreaIndex; + oldId = _lastCollId; + newkey = checkMousePoint(1, &_lastCollId, &_lastCollAreaIndex); + + if (newkey != _lastCollKey) { + if ((_lastCollKey != 0) && (oldId & 0x8000)) + collAreaSub(oldIndex, 0); + + _lastCollKey = newkey; + + if ((newkey != 0) && (_lastCollId & 0x8000)) + collAreaSub(_lastCollAreaIndex, 1); + } + } + } + + if ((deltaTime < 0) && (key == 0) && (_mouseButtons == 0)) { + uint32 curtime = _vm->_util->getTimeKey(); + if ((curtime + deltaTime) > timeKey) { + if (pResId != 0) + *pResId = 0; + + if (pResIndex != 0) + *pResIndex = 0; + + return 0; + } + } + + if (handleMouse != 0) + _vm->_draw->animateCursor(-1); + + _vm->_util->delay(10); + } +} + +} // End of namespace Gob diff --git a/engines/gob/gob.cpp b/engines/gob/gob.cpp index 5e06d896a2..05ab2d9b5a 100644 --- a/engines/gob/gob.cpp +++ b/engines/gob/gob.cpp @@ -295,6 +295,7 @@ bool GobEngine::initGameParts() { switch (_gameType) { case kGameTypeGeisha: + case kGameTypeAdibouUnknown: case kGameTypeGob1: _init = new Init_v1(this); _video = new Video_v1(this); @@ -315,13 +316,14 @@ bool GobEngine::initGameParts() { _parse = new Parse_v1(this); _mult = new Mult_v2(this); _draw = new Draw_v2(this); - _game = new Game_v2(this); + _game = new Game_Fascination(this); _map = new Map_v2(this); _goblin = new Goblin_v2(this); _scenery = new Scenery_v2(this); _saveLoad = new SaveLoad_v2(this, _targetName.c_str()); break; + case kGameTypeWeen: case kGameTypeGob2: _init = new Init_v2(this); _video = new Video_v2(this); @@ -350,20 +352,6 @@ bool GobEngine::initGameParts() { _saveLoad = new SaveLoad_v2(this, _targetName.c_str()); break; - case kGameTypeWeen: - _init = new Init_v2(this); - _video = new Video_v2(this); - _inter = new Inter_v2(this); - _parse = new Parse_v2(this); - _mult = new Mult_v2(this); - _draw = new Draw_v2(this); - _game = new Game_v2(this); - _map = new Map_v2(this); - _goblin = new Goblin_v2(this); - _scenery = new Scenery_v2(this); - _saveLoad = new SaveLoad_v2(this, _targetName.c_str()); - break; - case kGameTypeGob3: case kGameTypeInca2: _init = new Init_v3(this); diff --git a/engines/gob/gob.h b/engines/gob/gob.h index f8f3605426..d5ef25b7d2 100644 --- a/engines/gob/gob.h +++ b/engines/gob/gob.h @@ -100,7 +100,8 @@ enum GameType { kGameTypeSpirou, kGameTypeFascination, kGameTypeGeisha, - kGameTypeAdibou4 + kGameTypeAdibou4, + kGameTypeAdibouUnknown }; enum Features { diff --git a/engines/gob/inter.h b/engines/gob/inter.h index 9be2c605cf..1ba98141f4 100644 --- a/engines/gob/inter.h +++ b/engines/gob/inter.h @@ -501,12 +501,14 @@ protected: void oFascin_geUnknown11(OpGobParams ¶ms); void oFascin_geUnknown1000(OpGobParams ¶ms); void oFascin_geUnknown1001(OpGobParams ¶ms); + void oFascin_geUnknown1002(OpGobParams ¶ms); bool oFascin_feUnknown4(OpFuncParams ¶ms); + bool oFascin_feUnknown27(OpFuncParams ¶ms); void oFascin_cdUnknown3(); void oFascin_cdUnknown4(); void oFascin_cdUnknown5(); void oFascin_cdUnknown6(); - void oFascin_cdUnknown10(); + void oFascin_setRenderFlags(); void oFascin_cdUnknown11(); }; diff --git a/engines/gob/inter_fascin.cpp b/engines/gob/inter_fascin.cpp index e468fe73ee..0ee873e407 100644 --- a/engines/gob/inter_fascin.cpp +++ b/engines/gob/inter_fascin.cpp @@ -79,7 +79,7 @@ void Inter_Fascination::setupOpcodes() { /* 08 */ OPCODE(o1_initCursorAnim), OPCODE(o1_clearCursorAnim), - OPCODE(oFascin_cdUnknown10), + OPCODE(oFascin_setRenderFlags), OPCODE(oFascin_cdUnknown11), /* 0C */ {NULL, ""}, @@ -438,7 +438,7 @@ void Inter_Fascination::setupOpcodes() { OPCODE(o1_putPixel), OPCODE(o2_goblinFunc), OPCODE(o1_createSprite), - OPCODE(o1_freeSprite), + OPCODE(oFascin_feUnknown27),//OPCODE(o1_freeSprite), /* 28 */ {NULL, ""}, {NULL, ""}, @@ -510,9 +510,7 @@ void Inter_Fascination::setupOpcodes() { /* 0C */ OPCODE(oFascin_geUnknown1000), OPCODE(oFascin_geUnknown1001), //protrackerPlay doesn't play correctly "mod.extasy" - // NULL should be replaced by "OPCODE(o2_stopProtracker)," when protrackerPlay plays correctly "mod.extasy" - {NULL, ""}, - + OPCODE(oFascin_geUnknown1002), //to be replaced by o2_stopProtracker when protrackerPlay is fixed }; _opcodesDrawFascination = opcodesDraw; @@ -620,11 +618,20 @@ void Inter_Fascination::oFascin_geUnknown1001(OpGobParams ¶ms) { warning("Fascination oFascin_playProtracker - MOD not compatible, ToBeFixed"); } +void Inter_Fascination::oFascin_geUnknown1002(OpGobParams ¶ms) { + warning("Fascination o2_stopProtracker - Commented out"); +} + bool Inter_Fascination::oFascin_feUnknown4(OpFuncParams ¶ms) { warning("Fascination Unknown FE Function 4"); return true; } +bool Inter_Fascination::oFascin_feUnknown27(OpFuncParams ¶ms) { + warning("Fascination Unknown FE Function 27h"); + return true; +} + void Inter_Fascination::oFascin_cdUnknown3() { uint16 resVar, resVar2; int16 retVal1, retVal2, retVal3, retVal4, retVal5, retVal6, retVal7; @@ -667,7 +674,7 @@ void Inter_Fascination::oFascin_cdUnknown6() { warning ("evalExpr: %d Variable index %d, the rest is not yet implemented",expr, retVal1); } -void Inter_Fascination::oFascin_cdUnknown10() { +void Inter_Fascination::oFascin_setRenderFlags() { int16 expr; warning("Fascination oFascin_cdUnknown10 (set render flags)"); evalExpr(&expr); @@ -676,10 +683,8 @@ void Inter_Fascination::oFascin_cdUnknown10() { } void Inter_Fascination::oFascin_cdUnknown11() { - int16 expr; warning("Fascination oFascin_cdUnknown11 (set variable)"); - evalExpr(&expr); - warning("evalExpr: %d",expr); + evalExpr(0); } bool Inter_Fascination::executeFuncOpcode(byte i, byte j, OpFuncParams ¶ms) { |