Split game engines, to allow further cleanups.

svn-id: r26481
This commit is contained in:
Travis Howell 2007-04-15 05:04:48 +00:00
parent 1c00843f2b
commit 2d3e77db85
20 changed files with 192 additions and 90 deletions

View file

@ -72,6 +72,35 @@ static const GameSpecificSettings puzzlepack_settings = {
}; };
#endif #endif
AGOSEngine_PuzzlePack::AGOSEngine_PuzzlePack(OSystem *system)
: AGOSEngine_Feeble(system) {
}
AGOSEngine_Feeble::AGOSEngine_Feeble(OSystem *system)
: AGOSEngine_Simon2(system) {
}
AGOSEngine_Simon2::AGOSEngine_Simon2(OSystem *system)
: AGOSEngine_Simon1(system) {
}
AGOSEngine_Simon1::AGOSEngine_Simon1(OSystem *system)
: AGOSEngine_Waxworks(system) {
}
AGOSEngine_Waxworks::AGOSEngine_Waxworks(OSystem *system)
: AGOSEngine_Elvira2(system) {
}
AGOSEngine_Elvira2::AGOSEngine_Elvira2(OSystem *system)
: AGOSEngine_Elvira1(system) {
}
AGOSEngine_Elvira1::AGOSEngine_Elvira1(OSystem *system)
: AGOSEngine(system) {
}
AGOSEngine::AGOSEngine(OSystem *syst) AGOSEngine::AGOSEngine(OSystem *syst)
: Engine(syst) { : Engine(syst) {
_vcPtr = 0; _vcPtr = 0;

View file

@ -130,17 +130,10 @@ class AGOSEngine : public Engine {
GUI::Debugger *getDebugger(); GUI::Debugger *getDebugger();
public:
typedef void (AGOSEngine::*OpcodeProc) (); typedef void (AGOSEngine::*OpcodeProc) ();
void setupCommonOpcodes(OpcodeProc *op); virtual void setupOpcodes(OpcodeProc *op);
void setupElvira1Opcodes(OpcodeProc *op);
void setupElvira2Opcodes(OpcodeProc *op);
void setupWaxworksOpcodes(OpcodeProc *op);
void setupSimon1Opcodes(OpcodeProc *op);
void setupSimon2Opcodes(OpcodeProc *op);
void setupFeebleOpcodes(OpcodeProc *op);
void setupPuzzleOpcodes(OpcodeProc *op);
void setupOpcodes(); void setupOpcodes();
OpcodeProc _opcode_table[300]; OpcodeProc _opcode_table[300];
@ -152,16 +145,8 @@ class AGOSEngine : public Engine {
VgaOpcodeProc _vga_opcode_table[100]; VgaOpcodeProc _vga_opcode_table[100];
uint _numVideoOpcodes; uint _numVideoOpcodes;
void setupCommonVideoOpcodes(VgaOpcodeProc *op); virtual void setupVideoOpcodes(VgaOpcodeProc *op);
void setupElvira1VideoOpcodes(VgaOpcodeProc *op);
void setupElvira2VideoOpcodes(VgaOpcodeProc *op);
void setupWaxworksVideoOpcodes(VgaOpcodeProc *op);
void setupSimon1VideoOpcodes(VgaOpcodeProc *op);
void setupSimon2VideoOpcodes(VgaOpcodeProc *op);
void setupFeebleVideoOpcodes(VgaOpcodeProc *op);
public:
const AGOSGameDescription *_gameDescription; const AGOSGameDescription *_gameDescription;
bool initGame(void); bool initGame(void);
@ -777,8 +762,7 @@ protected:
void handleMouseMoved(); void handleMouseMoved();
void initMouse(); void initMouse();
void loadMouseImage(); void loadMouseImage();
void drawMousePointer(); virtual void drawMousePointer();
void drawMousePointer_FF();
void drawMousePart(int image, byte x, byte y); void drawMousePart(int image, byte x, byte y);
void addArrows(WindowBlock *window); void addArrows(WindowBlock *window);
@ -788,9 +772,10 @@ protected:
bool hasIcon(Item *item); bool hasIcon(Item *item);
uint itemGetIconNumber(Item *item); uint itemGetIconNumber(Item *item);
uint setupIconHitArea(WindowBlock *window, uint num, uint x, uint y, Item *item_ptr); uint setupIconHitArea(WindowBlock *window, uint num, uint x, uint y, Item *item_ptr);
void drawIconArray(uint i, Item *item_ptr, int line, int classMask);
void drawIconArray_FF(uint i, Item *item_ptr, int line, int classMask); virtual void drawIconArray(uint i, Item *item_ptr, int line, int classMask);
void drawIconArray_Simon(uint i, Item *item_ptr, int line, int classMask);
void removeIconArray(uint num); void removeIconArray(uint num);
void loadIconData(); void loadIconData();
@ -1425,6 +1410,82 @@ protected:
char *genSaveName(int slot); char *genSaveName(int slot);
}; };
class AGOSEngine_Elvira1 : public AGOSEngine {
public:
AGOSEngine_Elvira1(OSystem *system);
//~AGOSEngine_Elvira1();
virtual void setupOpcodes(OpcodeProc *op);
virtual void setupVideoOpcodes(VgaOpcodeProc *op);
private:
};
class AGOSEngine_Elvira2 : public AGOSEngine_Elvira1 {
public:
AGOSEngine_Elvira2(OSystem *system);
//~AGOSEngine_Elvira2();
virtual void setupOpcodes(OpcodeProc *op);
virtual void setupVideoOpcodes(VgaOpcodeProc *op);
private:
};
class AGOSEngine_Waxworks : public AGOSEngine_Elvira2 {
public:
AGOSEngine_Waxworks(OSystem *system);
//~AGOSEngine_Waxworks();
virtual void setupOpcodes(OpcodeProc *op);
virtual void setupVideoOpcodes(VgaOpcodeProc *op);
private:
};
class AGOSEngine_Simon1 : public AGOSEngine_Waxworks {
public:
AGOSEngine_Simon1(OSystem *system);
//~AGOSEngine_Simon1();
virtual void setupOpcodes(OpcodeProc *op);
virtual void setupVideoOpcodes(VgaOpcodeProc *op);
private:
};
class AGOSEngine_Simon2 : public AGOSEngine_Simon1 {
public:
AGOSEngine_Simon2(OSystem *system);
//~AGOSEngine_Simon2();
virtual void setupOpcodes(OpcodeProc *op);
virtual void setupVideoOpcodes(VgaOpcodeProc *op);
private:
};
class AGOSEngine_Feeble : public AGOSEngine_Simon2 {
public:
AGOSEngine_Feeble(OSystem *system);
//~AGOSEngine_Feeble();
virtual void setupOpcodes(OpcodeProc *op);
virtual void setupVideoOpcodes(VgaOpcodeProc *op);
virtual void drawMousePointer();
protected:
virtual void drawIconArray(uint i, Item *item_ptr, int line, int classMask);
private:
};
class AGOSEngine_PuzzlePack : public AGOSEngine_Feeble {
public:
AGOSEngine_PuzzlePack(OSystem *system);
//~AGOSEngine_PuzzlePack();
virtual void setupOpcodes(OpcodeProc *op);
private:
};
} // End of namespace AGOS } // End of namespace AGOS
#endif #endif

View file

@ -436,9 +436,6 @@ boxstuff:
_lastHitArea3 = (HitArea *) -1; _lastHitArea3 = (HitArea *) -1;
get_out: get_out:
if (getGameType() == GType_FF)
drawMousePointer_FF();
else
drawMousePointer(); drawMousePointer();
_needHitAreaRecalc = 0; _needHitAreaRecalc = 0;
@ -545,7 +542,7 @@ void AGOSEngine::drawMousePointer() {
} }
} }
void AGOSEngine::drawMousePointer_FF() { void AGOSEngine_Feeble::drawMousePointer() {
uint cursor; uint cursor;
int image, offs; int image, offs;

View file

@ -96,7 +96,6 @@ void AGOSEngine::animateSprites() {
void AGOSEngine::animateSpritesDebug() { void AGOSEngine::animateSpritesDebug() {
VgaSprite *vsp; VgaSprite *vsp;
VgaPointersEntry *vpe; VgaPointersEntry *vpe;
VC10_state state;
if (_paletteFlag == 2) if (_paletteFlag == 2)
_paletteFlag = 1; _paletteFlag = 1;
@ -127,7 +126,6 @@ void AGOSEngine::animateSpritesDebug() {
void AGOSEngine::animateSpritesByY() { void AGOSEngine::animateSpritesByY() {
VgaSprite *vsp; VgaSprite *vsp;
VgaPointersEntry *vpe; VgaPointersEntry *vpe;
VC10_state state;
int16 spriteTable[180][2]; int16 spriteTable[180][2];
byte *src; byte *src;

View file

@ -26,6 +26,7 @@
#include "base/plugins.h" #include "base/plugins.h"
#include "common/advancedDetector.h" #include "common/advancedDetector.h"
#include "common/config-manager.h"
#include "agos/agos.h" #include "agos/agos.h"
@ -102,7 +103,53 @@ static const Common::ADParams detectionParams = {
Common::kADFlagAugmentPreferredTarget Common::kADFlagAugmentPreferredTarget
}; };
ADVANCED_DETECTOR_DEFINE_PLUGIN(AGOS, AGOS::AGOSEngine, detectionParams); GameList Engine_AGOS_gameIDList() {
return GameList(simonGames);
}
GameDescriptor Engine_AGOS_findGameID(const char *gameid) {
return Common::AdvancedDetector::findGameID(gameid, detectionParams);
}
GameList Engine_AGOS_detectGames(const FSList &fslist) {
return Common::AdvancedDetector::detectAllGames(fslist, detectionParams);
}
PluginError Engine_AGOS_create(OSystem *syst, Engine **engine) {
assert(engine);
const char *gameid = ConfMan.get("gameid").c_str();
//const AGOSGameDescription gd = (const AGOSGameDescription *)Common::AdvancedDetector::detectBestMatchingGame(detectionParams);
//if (gd == 0) {
// return kNoGameDataFoundError;
//}
if (!scumm_stricmp("elvira1", gameid)) {
*engine = new AGOS::AGOSEngine_Elvira1(syst);
} else if (!scumm_stricmp("elvira2", gameid)) {
*engine = new AGOS::AGOSEngine_Elvira2(syst);
} else if (!scumm_stricmp("waxworks", gameid)) {
*engine = new AGOS::AGOSEngine_Waxworks(syst);
} else if (!scumm_stricmp("simon1", gameid)) {
*engine = new AGOS::AGOSEngine_Simon1(syst);
} else if (!scumm_stricmp("simon2", gameid)) {
*engine = new AGOS::AGOSEngine_Simon2(syst);
} else if (!scumm_stricmp("feeble", gameid)) {
*engine = new AGOS::AGOSEngine_Feeble(syst);
} else if (!scumm_stricmp("jumble", gameid)) {
*engine = new AGOS::AGOSEngine_PuzzlePack(syst);
} else if (!scumm_stricmp("puzzle", gameid)) {
*engine = new AGOS::AGOSEngine_PuzzlePack(syst);
} else if (!scumm_stricmp("swampy", gameid)) {
*engine = new AGOS::AGOSEngine_PuzzlePack(syst);
} else {
error("AGOS engine created with invalid gameid");
}
return kNoError;
}
REGISTER_PLUGIN(AGOS, "AGOS", "AGOS (C) Adventure Soft"); REGISTER_PLUGIN(AGOS, "AGOS", "AGOS (C) Adventure Soft");

View file

@ -243,14 +243,6 @@ void AGOSEngine::drawIcon(WindowBlock *window, uint icon, uint x, uint y) {
} }
void AGOSEngine::drawIconArray(uint num, Item *itemRef, int line, int classMask) { void AGOSEngine::drawIconArray(uint num, Item *itemRef, int line, int classMask) {
if (getGameType() == GType_FF) {
drawIconArray_FF(num, itemRef, line, classMask);
} else {
drawIconArray_Simon(num, itemRef, line, classMask);
}
}
void AGOSEngine::drawIconArray_Simon(uint num, Item *itemRef, int line, int classMask) {
Item *item_ptr_org = itemRef; Item *item_ptr_org = itemRef;
WindowBlock *window; WindowBlock *window;
uint width, height; uint width, height;
@ -350,7 +342,7 @@ void AGOSEngine::drawIconArray_Simon(uint num, Item *itemRef, int line, int clas
} }
} }
void AGOSEngine::drawIconArray_FF(uint num, Item *itemRef, int line, int classMask) { void AGOSEngine_Feeble::drawIconArray(uint num, Item *itemRef, int line, int classMask) {
Item *item_ptr_org = itemRef; Item *item_ptr_org = itemRef;
WindowBlock *window; WindowBlock *window;
uint16 flagnumber = 201; uint16 flagnumber = 201;

View file

@ -36,7 +36,7 @@ extern bool isSmartphone(void);
namespace AGOS { namespace AGOS {
void AGOSEngine::setupCommonOpcodes(OpcodeProc *op) { void AGOSEngine::setupOpcodes(OpcodeProc *op) {
// A common set of opcodes for Elvira 2 and later. // A common set of opcodes for Elvira 2 and later.
op[1] = &AGOSEngine::o_at; op[1] = &AGOSEngine::o_at;
@ -147,25 +147,13 @@ void AGOSEngine::setupOpcodes() {
switch (getGameType()) { switch (getGameType()) {
case GType_ELVIRA1: case GType_ELVIRA1:
setupElvira1Opcodes(_opcode_table);
break;
case GType_ELVIRA2: case GType_ELVIRA2:
setupElvira2Opcodes(_opcode_table);
break;
case GType_WW: case GType_WW:
setupWaxworksOpcodes(_opcode_table);
break;
case GType_SIMON1: case GType_SIMON1:
setupSimon1Opcodes(_opcode_table);
break;
case GType_SIMON2: case GType_SIMON2:
setupSimon2Opcodes(_opcode_table);
break;
case GType_FF: case GType_FF:
setupFeebleOpcodes(_opcode_table);
break;
case GType_PP: case GType_PP:
setupPuzzleOpcodes(_opcode_table); setupOpcodes(_opcode_table);
break; break;
default: default:
error("setupOpcodes: Unknown game"); error("setupOpcodes: Unknown game");

View file

@ -28,7 +28,7 @@
namespace AGOS { namespace AGOS {
void AGOSEngine::setupElvira1Opcodes(OpcodeProc *op) { void AGOSEngine_Elvira1::setupOpcodes(OpcodeProc *op) {
op[0] = &AGOSEngine::o_at; op[0] = &AGOSEngine::o_at;
op[1] = &AGOSEngine::o_notAt; op[1] = &AGOSEngine::o_notAt;
op[2] = &AGOSEngine::oe1_present; op[2] = &AGOSEngine::oe1_present;

View file

@ -27,8 +27,8 @@
namespace AGOS { namespace AGOS {
void AGOSEngine::setupElvira2Opcodes(OpcodeProc *op) { void AGOSEngine_Elvira2::setupOpcodes(OpcodeProc *op) {
setupCommonOpcodes(op); AGOSEngine::setupOpcodes(op);
op[8] = &AGOSEngine::oe1_isNotAt; op[8] = &AGOSEngine::oe1_isNotAt;
op[9] = &AGOSEngine::oe1_sibling; op[9] = &AGOSEngine::oe1_sibling;

View file

@ -30,8 +30,8 @@
namespace AGOS { namespace AGOS {
void AGOSEngine::setupFeebleOpcodes(OpcodeProc *op) { void AGOSEngine_Feeble::setupOpcodes(OpcodeProc *op) {
setupCommonOpcodes(op); AGOSEngine::setupOpcodes(op);
op[23] = &AGOSEngine::off_chance; op[23] = &AGOSEngine::off_chance;
op[37] = &AGOSEngine::off_jumpOut; op[37] = &AGOSEngine::off_jumpOut;

View file

@ -29,8 +29,8 @@
namespace AGOS { namespace AGOS {
void AGOSEngine::setupPuzzleOpcodes(OpcodeProc *op) { void AGOSEngine_PuzzlePack::setupOpcodes(OpcodeProc *op) {
setupCommonOpcodes(op); AGOSEngine::setupOpcodes(op);
op[23] = &AGOSEngine::off_chance; op[23] = &AGOSEngine::off_chance;
op[30] = &AGOSEngine::opp_iconifyWindow; op[30] = &AGOSEngine::opp_iconifyWindow;

View file

@ -33,8 +33,8 @@ extern bool isSmartphone(void);
namespace AGOS { namespace AGOS {
void AGOSEngine::setupSimon1Opcodes(OpcodeProc *op) { void AGOSEngine_Simon1::setupOpcodes(OpcodeProc *op) {
setupCommonOpcodes(op); AGOSEngine::setupOpcodes(op);
op[65] = &AGOSEngine::oww_addTextBox; op[65] = &AGOSEngine::oww_addTextBox;
op[66] = &AGOSEngine::oww_setShortText; op[66] = &AGOSEngine::oww_setShortText;

View file

@ -27,8 +27,8 @@
namespace AGOS { namespace AGOS {
void AGOSEngine::setupSimon2Opcodes(OpcodeProc *op) { void AGOSEngine_Simon2::setupOpcodes(OpcodeProc *op) {
setupCommonOpcodes(op); AGOSEngine::setupOpcodes(op);
op[65] = &AGOSEngine::oww_addTextBox; op[65] = &AGOSEngine::oww_addTextBox;
op[66] = &AGOSEngine::oww_setShortText; op[66] = &AGOSEngine::oww_setShortText;

View file

@ -29,8 +29,8 @@
namespace AGOS { namespace AGOS {
void AGOSEngine::setupWaxworksOpcodes(OpcodeProc *op) { void AGOSEngine_Waxworks::setupOpcodes(OpcodeProc *op) {
setupCommonOpcodes(op); AGOSEngine::setupOpcodes(op);
op[8] = &AGOSEngine::oe1_isNotAt; op[8] = &AGOSEngine::oe1_isNotAt;
op[9] = &AGOSEngine::oe1_sibling; op[9] = &AGOSEngine::oe1_sibling;

View file

@ -33,7 +33,7 @@
namespace AGOS { namespace AGOS {
// Opcode tables // Opcode tables
void AGOSEngine::setupCommonVideoOpcodes(VgaOpcodeProc *op) { void AGOSEngine::setupVideoOpcodes(VgaOpcodeProc *op) {
op[1] = &AGOSEngine::vc1_fadeOut; op[1] = &AGOSEngine::vc1_fadeOut;
op[2] = &AGOSEngine::vc2_call; op[2] = &AGOSEngine::vc2_call;
op[3] = &AGOSEngine::vc3_loadSprite; op[3] = &AGOSEngine::vc3_loadSprite;
@ -81,7 +81,7 @@ void AGOSEngine::setupCommonVideoOpcodes(VgaOpcodeProc *op) {
op[55] = &AGOSEngine::vc55_moveBox; op[55] = &AGOSEngine::vc55_moveBox;
} }
void AGOSEngine::setupElvira1VideoOpcodes(VgaOpcodeProc *op) { void AGOSEngine_Elvira1::setupVideoOpcodes(VgaOpcodeProc *op) {
op[1] = &AGOSEngine::vc1_fadeOut; op[1] = &AGOSEngine::vc1_fadeOut;
op[2] = &AGOSEngine::vc2_call; op[2] = &AGOSEngine::vc2_call;
op[3] = &AGOSEngine::vc3_loadSprite; op[3] = &AGOSEngine::vc3_loadSprite;
@ -130,23 +130,13 @@ void AGOSEngine::setupVgaOpcodes() {
switch (getGameType()) { switch (getGameType()) {
case GType_ELVIRA1: case GType_ELVIRA1:
setupElvira1VideoOpcodes(_vga_opcode_table);
break;
case GType_ELVIRA2: case GType_ELVIRA2:
setupElvira2VideoOpcodes(_vga_opcode_table);
break;
case GType_WW: case GType_WW:
setupWaxworksVideoOpcodes(_vga_opcode_table);
break;
case GType_SIMON1: case GType_SIMON1:
setupSimon1VideoOpcodes(_vga_opcode_table);
break;
case GType_SIMON2: case GType_SIMON2:
setupSimon2VideoOpcodes(_vga_opcode_table);
break;
case GType_FF: case GType_FF:
case GType_PP: case GType_PP:
setupFeebleVideoOpcodes(_vga_opcode_table); setupVideoOpcodes(_vga_opcode_table);
break; break;
default: default:
error("setupVgaOpcodes: Unknown game"); error("setupVgaOpcodes: Unknown game");

View file

@ -31,8 +31,8 @@
namespace AGOS { namespace AGOS {
void AGOSEngine::setupElvira2VideoOpcodes(VgaOpcodeProc *op) { void AGOSEngine_Elvira2::setupVideoOpcodes(VgaOpcodeProc *op) {
setupCommonVideoOpcodes(op); AGOSEngine::setupVideoOpcodes(op);
op[17] = &AGOSEngine::vc17_waitEnd; op[17] = &AGOSEngine::vc17_waitEnd;
op[19] = &AGOSEngine::vc19_loop; op[19] = &AGOSEngine::vc19_loop;

View file

@ -28,8 +28,8 @@
namespace AGOS { namespace AGOS {
void AGOSEngine::setupFeebleVideoOpcodes(VgaOpcodeProc *op) { void AGOSEngine_Feeble::setupVideoOpcodes(VgaOpcodeProc *op) {
setupSimon2VideoOpcodes(op); AGOSEngine_Simon2::setupVideoOpcodes(op);
op[75] = &AGOSEngine::vc75_setScale; op[75] = &AGOSEngine::vc75_setScale;
op[76] = &AGOSEngine::vc76_setScaleXOffs; op[76] = &AGOSEngine::vc76_setScaleXOffs;

View file

@ -29,8 +29,8 @@
namespace AGOS { namespace AGOS {
void AGOSEngine::setupSimon1VideoOpcodes(VgaOpcodeProc *op) { void AGOSEngine_Simon1::setupVideoOpcodes(VgaOpcodeProc *op) {
setupCommonVideoOpcodes(op); AGOSEngine::setupVideoOpcodes(op);
op[11] = &AGOSEngine::vc11_clearPathFinder; op[11] = &AGOSEngine::vc11_clearPathFinder;
op[17] = &AGOSEngine::vc17_setPathfinderItem; op[17] = &AGOSEngine::vc17_setPathfinderItem;

View file

@ -28,8 +28,8 @@
namespace AGOS { namespace AGOS {
void AGOSEngine::setupSimon2VideoOpcodes(VgaOpcodeProc *op) { void AGOSEngine_Simon2::setupVideoOpcodes(VgaOpcodeProc *op) {
setupSimon1VideoOpcodes(op); AGOSEngine_Simon1::setupVideoOpcodes(op);
op[56] = &AGOSEngine::vc56_delayLong; op[56] = &AGOSEngine::vc56_delayLong;
op[58] = &AGOSEngine::vc58_changePriority; op[58] = &AGOSEngine::vc58_changePriority;

View file

@ -31,8 +31,8 @@
namespace AGOS { namespace AGOS {
void AGOSEngine::setupWaxworksVideoOpcodes(VgaOpcodeProc *op) { void AGOSEngine_Waxworks::setupVideoOpcodes(VgaOpcodeProc *op) {
setupElvira2VideoOpcodes(op); AGOSEngine_Elvira2::setupVideoOpcodes(op);
op[58] = &AGOSEngine::vc58_checkCodeWheel; op[58] = &AGOSEngine::vc58_checkCodeWheel;
op[60] = &AGOSEngine::vc60_stopAnimation; op[60] = &AGOSEngine::vc60_stopAnimation;