- 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
This commit is contained in:
Arnaud Boutonné 2009-04-29 16:36:08 +00:00
parent 4ff69f6cd0
commit 93e2e75a9e
6 changed files with 235 additions and 26 deletions

View File

@ -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

204
engines/gob/game_fascin.cpp Normal file
View File

@ -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

View File

@ -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);

View File

@ -100,7 +100,8 @@ enum GameType {
kGameTypeSpirou,
kGameTypeFascination,
kGameTypeGeisha,
kGameTypeAdibou4
kGameTypeAdibou4,
kGameTypeAdibouUnknown
};
enum Features {

View File

@ -501,12 +501,14 @@ protected:
void oFascin_geUnknown11(OpGobParams &params);
void oFascin_geUnknown1000(OpGobParams &params);
void oFascin_geUnknown1001(OpGobParams &params);
void oFascin_geUnknown1002(OpGobParams &params);
bool oFascin_feUnknown4(OpFuncParams &params);
bool oFascin_feUnknown27(OpFuncParams &params);
void oFascin_cdUnknown3();
void oFascin_cdUnknown4();
void oFascin_cdUnknown5();
void oFascin_cdUnknown6();
void oFascin_cdUnknown10();
void oFascin_setRenderFlags();
void oFascin_cdUnknown11();
};

View File

@ -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 &params) {
warning("Fascination oFascin_playProtracker - MOD not compatible, ToBeFixed");
}
void Inter_Fascination::oFascin_geUnknown1002(OpGobParams &params) {
warning("Fascination o2_stopProtracker - Commented out");
}
bool Inter_Fascination::oFascin_feUnknown4(OpFuncParams &params) {
warning("Fascination Unknown FE Function 4");
return true;
}
bool Inter_Fascination::oFascin_feUnknown27(OpFuncParams &params) {
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 &params) {