aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorTravis Howell2008-12-13 03:12:56 +0000
committerTravis Howell2008-12-13 03:12:56 +0000
commite593015402c6b4990fda584164956132350d720a (patch)
tree1f3b6c0ba181f81b70e1b31bf4659a7b078d09cd
parent1cc08d8b6a3ee995ff130bf96d6e9217b41b856d (diff)
downloadscummvm-rg350-e593015402c6b4990fda584164956132350d720a.tar.gz
scummvm-rg350-e593015402c6b4990fda584164956132350d720a.tar.bz2
scummvm-rg350-e593015402c6b4990fda584164956132350d720a.zip
Cleanup.
svn-id: r35323
-rw-r--r--engines/agos/agos.h64
-rw-r--r--engines/agos/contain.cpp177
-rw-r--r--engines/agos/cursor.cpp66
-rw-r--r--engines/agos/debug.cpp122
-rw-r--r--engines/agos/icons.cpp36
-rw-r--r--engines/agos/items.cpp34
-rw-r--r--engines/agos/res.cpp27
-rw-r--r--engines/agos/saveload.cpp160
8 files changed, 397 insertions, 289 deletions
diff --git a/engines/agos/agos.h b/engines/agos/agos.h
index ada24fc032..b76a7857a0 100644
--- a/engines/agos/agos.h
+++ b/engines/agos/agos.h
@@ -572,9 +572,9 @@ public:
virtual ~AGOSEngine();
protected:
- uint16 to16Wrapper(uint value);
- uint16 readUint16Wrapper(const void *src);
- uint32 readUint32Wrapper(const void *src);
+ virtual uint16 to16Wrapper(uint value);
+ virtual uint16 readUint16Wrapper(const void *src);
+ virtual uint32 readUint32Wrapper(const void *src);
int allocGamePcVars(Common::SeekableReadStream *in);
void createPlayer();
@@ -722,14 +722,14 @@ protected:
Item *getExitOf_e1(Item *item, uint16 d);
virtual void moveDirn(Item *i, uint x);
- int canPlace(Item *x, Item *y);
+ virtual int canPlace(Item *x, Item *y);
int contains(Item *a, Item *b);
int sizeContents(Item *x);
- int sizeOfRec(Item *o, int d);
+ virtual int sizeOfRec(Item *o, int d);
int sizeRec(Item *x, int d);
int weighUp(Item *x);
int weightRec(Item *x, int d);
- int weightOf(Item *x);
+ virtual int weightOf(Item *x);
void xPlace(Item *x, Item *y);
void drawMenuStrip(uint windowNum, uint menuNum);
@@ -789,17 +789,17 @@ protected:
void displayBoxStars();
void invertBox(HitArea * ha, byte a, byte b, byte c, byte d);
- void initMouse();
+ virtual void initMouse();
virtual void handleMouseMoved();
virtual void drawMousePointer();
void drawArrow(uint16 x, uint16 y, int8 dir);
virtual void addArrows(WindowBlock *window, uint8 num);
- void removeArrows(WindowBlock *window, uint num);
+ virtual void removeArrows(WindowBlock *window, uint num);
virtual void drawIcon(WindowBlock *window, uint icon, uint x, uint y);
- bool hasIcon(Item *item);
- uint itemGetIconNumber(Item *item);
+ virtual bool hasIcon(Item *item);
+ virtual uint itemGetIconNumber(Item *item);
virtual uint setupIconHitArea(WindowBlock *window, uint num, uint x, uint y, Item *item_ptr);
virtual void drawIconArray(uint i, Item *item_ptr, int line, int classMask);
@@ -1171,7 +1171,7 @@ protected:
void displayScreen();
void dumpVideoScript(const byte *src, bool one_opcode_only);
- void dumpVgaFile(const byte *vga);
+ virtual void dumpVgaFile(const byte *vga);
void dumpVgaScript(const byte *ptr, uint res, uint sprite_id);
void dumpVgaScriptAlways(const byte *ptr, uint res, uint sprite_id);
void dumpVgaBitmaps(const byte *vga, byte *vga1, int res);
@@ -1224,7 +1224,7 @@ protected:
virtual void vcStopAnimation(uint16 zone, uint16 sprite);
- bool confirmOverWrite(WindowBlock *window);
+ virtual bool confirmOverWrite(WindowBlock *window);
int16 matchSaveGame(const char *name, uint16 max);
void disableFileBoxes();
virtual void userGame(bool load);
@@ -1381,12 +1381,18 @@ protected:
virtual bool loadGame(const char *filename, bool restartMode = false);
virtual bool saveGame(uint slot, const char *caption);
- virtual void drawIcon(WindowBlock *window, uint icon, uint x, uint y);
-
virtual void addArrows(WindowBlock *window, uint8 num);
+ virtual void removeArrows(WindowBlock *window, uint num);
+
+ virtual void drawIcon(WindowBlock *window, uint icon, uint x, uint y);
+ virtual bool hasIcon(Item *item);
+ virtual uint itemGetIconNumber(Item *item);
virtual uint setupIconHitArea(WindowBlock *window, uint num, uint x, uint y, Item *item_ptr);
virtual void moveDirn(Item *i, uint x);
+ virtual int canPlace(Item *x, Item *y);
+ virtual int sizeOfRec(Item *o, int d);
+ virtual int weightOf(Item *x);
int changeExitStates(SubSuperRoom *sr, int n, int d, uint16 s);
uint16 getExitState(Item *item, uint16 x, uint16 d);
@@ -1394,8 +1400,11 @@ protected:
void setSRExit(Item *i, int n, int d, uint16 s);
virtual void listSaveGames(char *dst);
+ virtual bool confirmOverWrite(WindowBlock *window);
virtual void userGame(bool load);
virtual int userGameGetKey(bool *b, char *buf, uint maxChar);
+
+ char *genSaveName(int slot);
};
class AGOSEngine_Waxworks : public AGOSEngine_Elvira2 {
@@ -1443,11 +1452,17 @@ protected:
virtual void drawIcon(WindowBlock *window, uint icon, uint x, uint y);
virtual void addArrows(WindowBlock *window, uint8 num);
+ virtual void removeArrows(WindowBlock *window, uint num);
+
virtual uint setupIconHitArea(WindowBlock *window, uint num, uint x, uint y, Item *item_ptr);
virtual bool loadTablesIntoMem(uint16 subr_id);
virtual void moveDirn(Item *i, uint x);
+
+ virtual bool confirmOverWrite(WindowBlock *window);
+
+ char *genSaveName(int slot);
};
class AGOSEngine_Simon1 : public AGOSEngine_Waxworks {
@@ -1492,13 +1507,18 @@ protected:
void drawMaskedImage(VC10_state *state);
void draw32ColorImage(VC10_state *state);
+ virtual void dumpVgaFile(const byte *vga);
+
virtual void clearName();
virtual void drawIcon(WindowBlock *window, uint icon, uint x, uint y);
+ virtual void initMouse();
virtual void handleMouseMoved();
virtual void addArrows(WindowBlock *window, uint8 num);
+ virtual void removeArrows(WindowBlock *window, uint num);
+
virtual uint setupIconHitArea(WindowBlock *window, uint num, uint x, uint y, Item *item_ptr);
virtual void playSpeech(uint16 speech_id, uint16 vga_sprite_id);
@@ -1510,6 +1530,8 @@ protected:
virtual void playMusic(uint16 music, uint16 track);
virtual void vcStopAnimation(uint16 zone, uint16 sprite);
+
+ char *genSaveName(int slot);
};
class AGOSEngine_Simon2 : public AGOSEngine_Simon1 {
@@ -1552,6 +1574,8 @@ protected:
virtual uint setupIconHitArea(WindowBlock *window, uint num, uint x, uint y, Item *item_ptr);
virtual void playSpeech(uint16 speech_id, uint16 vga_sprite_id);
+
+ char *genSaveName(int slot);
};
class AGOSEngine_Feeble : public AGOSEngine_Simon2 {
@@ -1608,10 +1632,15 @@ protected:
const OpcodeEntryFeeble *_opcodesFeeble;
+ virtual uint16 to16Wrapper(uint value);
+ virtual uint16 readUint16Wrapper(const void *src);
+ virtual uint32 readUint32Wrapper(const void *src);
+
virtual void drawImage(VC10_state *state);
void scaleClip(int16 h, int16 w, int16 y, int16 x, int16 scrollY);
void drawMousePart(int image, byte x, byte y);
+ virtual void initMouse();
virtual void drawMousePointer();
virtual void animateSprites();
@@ -1637,6 +1666,8 @@ protected:
virtual void colorWindow(WindowBlock *window);
+ virtual void dumpVgaFile(const byte *vga);
+
virtual void doOutput(const byte *src, uint len);
virtual void printScreenText(uint vga_sprite_id, uint color, const char *string_ptr, int16 x, int16 y, int16 width);
@@ -1668,6 +1699,8 @@ protected:
virtual void checkNoOverWrite();
virtual void checkAnims(uint a);
virtual void checkZonePtrs();
+
+ char *genSaveName(int slot);
};
class AGOSEngine_PuzzlePack : public AGOSEngine_Feeble {
@@ -1706,12 +1739,15 @@ protected:
const OpcodeEntryPuzzlePack *_opcodesPuzzlePack;
+ virtual void initMouse();
virtual void handleMouseMoved();
virtual void drawMousePointer();
virtual void resetVerbs();
void loadMouseImage();
+
+ char *genSaveName(int slot);
};
} // End of namespace AGOS
diff --git a/engines/agos/contain.cpp b/engines/agos/contain.cpp
index 24a6951b48..932557e798 100644
--- a/engines/agos/contain.cpp
+++ b/engines/agos/contain.cpp
@@ -30,55 +30,60 @@
namespace AGOS {
-int AGOSEngine::canPlace(Item *x, Item *y) {
+int AGOSEngine_Elvira2::canPlace(Item *x, Item *y) {
Item *z = derefItem(x->parent);
- if (getGameType() == GType_ELVIRA1) {
- SubPlayer *p = (SubPlayer *)findChildOfType(y, kPlayerType);
- SubContainer *c = (SubContainer *)findChildOfType(y, kContainerType);
- int cap = 0;
- int wt;
-
- if ((c == NULL) && (p == NULL))
- return 0; /* Fits Fine */
-
- xPlace(x, NULL); /* Avoid disturbing figures */
- if (c)
- cap = sizeContents(y);
-
- wt = weightOf(y);
- xPlace(x, z);
- if (c) {
- cap = c->volume - cap;
- cap -= sizeOfRec(x, 0); /* - size of item going in */
- if (cap < 0)
- return -1; /* Too big to fit */
- }
- if (p) {
- if (wt + weightOf(x) > p->strength * 10)
- return -2; /* Too heavy */
- }
- } else {
- SubObject *o = (SubObject *)findChildOfType(y, kObjectType);
- int ct;
- int cap = 0;
+ SubObject *o = (SubObject *)findChildOfType(y, kObjectType);
+ int ct;
+ int cap = 0;
- if (o == NULL)
- return 0; /* Fits Fine */
+ if (o == NULL)
+ return 0; /* Fits Fine */
- xPlace(x,NULL); /* Avoid disturbing figures */
- if (o)
- cap = sizeContents(y);
-
- xPlace(x, z);
- if ((o) && (o->objectFlags & kOFVolume)) {
- ct = getOffsetOfChild2Param(o, kOFVolume);
- cap = o->objectFlagValue[ct] - cap;
- cap -= sizeOfRec(x, 0); /* - size of item going in */
- if (cap < 0)
- return -1; /* Too big to fit */
- }
+ xPlace(x,NULL); /* Avoid disturbing figures */
+ if (o)
+ cap = sizeContents(y);
+
+ xPlace(x, z);
+ if ((o) && (o->objectFlags & kOFVolume)) {
+ ct = getOffsetOfChild2Param(o, kOFVolume);
+ cap = o->objectFlagValue[ct] - cap;
+ cap -= sizeOfRec(x, 0); /* - size of item going in */
+ if (cap < 0)
+ return -1; /* Too big to fit */
+ }
+
+ return 0;
+}
+
+int AGOSEngine::canPlace(Item *x, Item *y) {
+ Item *z = derefItem(x->parent);
+
+ SubPlayer *p = (SubPlayer *)findChildOfType(y, kPlayerType);
+ SubContainer *c = (SubContainer *)findChildOfType(y, kContainerType);
+ int cap = 0;
+ int wt;
+
+ if ((c == NULL) && (p == NULL))
+ return 0; /* Fits Fine */
+
+ xPlace(x, NULL); /* Avoid disturbing figures */
+ if (c)
+ cap = sizeContents(y);
+
+ wt = weightOf(y);
+ xPlace(x, z);
+ if (c) {
+ cap = c->volume - cap;
+ cap -= sizeOfRec(x, 0); /* - size of item going in */
+ if (cap < 0)
+ return -1; /* Too big to fit */
}
+ if (p) {
+ if (wt + weightOf(x) > p->strength * 10)
+ return -2; /* Too heavy */
+ }
+
return 0;
}
@@ -119,38 +124,43 @@ int AGOSEngine::sizeRec(Item *x, int d) {
return n;
}
+int AGOSEngine_Elvira2::sizeOfRec(Item *i, int d) {
+ SubObject *o = (SubObject *)findChildOfType(i, kObjectType);
+
+ int ct;
+ if ((o) && (o->objectFlags & kOFSoft)) {
+ if (o->objectFlags & kOFSize) {
+ ct = getOffsetOfChild2Param(o, kOFSize);
+ return o->objectFlagValue[ct] + sizeRec(i, d + 1);
+ }
+ return sizeRec(i, d + 1);
+ }
+ if ((o) && (o->objectFlags & kOFSize)) {
+ ct = getOffsetOfChild2Param(o, kOFSize);
+ return o->objectFlagValue[ct];
+ }
+
+ return 0;
+}
+
int AGOSEngine::sizeOfRec(Item *i, int d) {
SubObject *o = (SubObject *)findChildOfType(i, kObjectType);
- if (getGameType() == GType_ELVIRA1) {
- SubPlayer *p = (SubPlayer *)findChildOfType(i, kPlayerType);
- SubContainer *c = (SubContainer *)findChildOfType(i, kContainerType);
+ SubPlayer *p = (SubPlayer *)findChildOfType(i, kPlayerType);
+ SubContainer *c = (SubContainer *)findChildOfType(i, kContainerType);
- if ((c) && (c->flags & 1)) {
- if (o)
- return (o->objectSize + sizeRec(i, d + 1));
- if (p)
- return (p->size + sizeRec(i, d + 1));
- return (sizeRec(i, d + 1));
- }
+ if ((c) && (c->flags & 1)) {
if (o)
- return (o->objectWeight);
+ return (o->objectSize + sizeRec(i, d + 1));
if (p)
- return (p->weight);
- } else {
- int ct;
- if ((o) && (o->objectFlags & kOFSoft)) {
- if (o->objectFlags & kOFSize) {
- ct = getOffsetOfChild2Param(o, kOFSize);
- return o->objectFlagValue[ct] + sizeRec(i, d + 1);
- }
- return sizeRec(i, d + 1);
- }
- if ((o) && (o->objectFlags & kOFSize)) {
- ct = getOffsetOfChild2Param(o, kOFSize);
- return o->objectFlagValue[ct];
- }
+ return (p->size + sizeRec(i, d + 1));
+ return (sizeRec(i, d + 1));
}
+ if (o)
+ return (o->objectWeight);
+ if (p)
+ return (p->weight);
+
return 0;
}
@@ -173,21 +183,26 @@ int AGOSEngine::weightRec(Item *x, int d) {
return n;
}
-int AGOSEngine::weightOf(Item *x) {
+int AGOSEngine_Elvira2::weightOf(Item *x) {
SubObject *o = (SubObject *)findChildOfType(x, kObjectType);
- if (getGameType() == GType_ELVIRA1) {
- SubPlayer *p = (SubPlayer *)findChildOfType(x, kPlayerType);
- if (o)
- return o->objectWeight;
- if (p)
- return p->weight;
- } else {
- if ((o) && (o->objectFlags & kOFWeight)) {
- int ct = getOffsetOfChild2Param(o, kOFWeight);
- return (o->objectFlagValue[ct]);
- }
+ if ((o) && (o->objectFlags & kOFWeight)) {
+ int ct = getOffsetOfChild2Param(o, kOFWeight);
+ return (o->objectFlagValue[ct]);
}
+
+ return 0;
+}
+
+int AGOSEngine::weightOf(Item *x) {
+ SubObject *o = (SubObject *)findChildOfType(x, kObjectType);
+
+ SubPlayer *p = (SubPlayer *)findChildOfType(x, kPlayerType);
+ if (o)
+ return o->objectWeight;
+ if (p)
+ return p->weight;
+
return 0;
}
diff --git a/engines/agos/cursor.cpp b/engines/agos/cursor.cpp
index 1cbfdaed7b..d8c5793ba2 100644
--- a/engines/agos/cursor.cpp
+++ b/engines/agos/cursor.cpp
@@ -571,45 +571,49 @@ void AGOSEngine::mouseOn() {
_lockWord &= ~1;
}
-void AGOSEngine::initMouse() {
- if (getGameType() == GType_PP) {
- _maxCursorWidth = 75;
- _maxCursorHeight = 97;
- _mouseData = (byte *)calloc(_maxCursorWidth * _maxCursorHeight, 1);
- } else if (getGameType() == GType_FF) {
- _maxCursorWidth = 40;
- _maxCursorHeight = 40;
- _mouseData = (byte *)calloc(_maxCursorWidth * _maxCursorHeight, 1);
- } else if (getGameType() == GType_SIMON1) {
- _maxCursorWidth = 16;
- _maxCursorHeight = 16;
- _mouseData = (byte *)calloc(_maxCursorWidth * _maxCursorHeight, 1);
- memset(_mouseData, 0xFF, _maxCursorWidth * _maxCursorHeight);
+void AGOSEngine_PuzzlePack::initMouse() {
+ _maxCursorWidth = 75;
+ _maxCursorHeight = 97;
+ _mouseData = (byte *)calloc(_maxCursorWidth * _maxCursorHeight, 1);
+}
- uint8 color = 225;
- if (getPlatform() == Common::kPlatformAmiga)
- color = (getFeatures() & GF_32COLOR) ? 17 : 241;
+void AGOSEngine_Feeble::initMouse() {
+ _maxCursorWidth = 40;
+ _maxCursorHeight = 40;
+ _mouseData = (byte *)calloc(_maxCursorWidth * _maxCursorHeight, 1);
+}
- const uint16 *src = _common_mouseInfo;
- for (int i = 0; i < 16; i++) {
- for (int j = 0; j < 16; j++) {
- if (src[0] & (1 << (15 - (j % 16)))) {
- if (src[1] & (1 << (15 - (j % 16)))) {
- _mouseData[16 * i + j] = color;
- } else {
- _mouseData[16 * i + j] = 0;
- }
+void AGOSEngine_Simon1::initMouse() {
+ _maxCursorWidth = 16;
+ _maxCursorHeight = 16;
+ _mouseData = (byte *)calloc(_maxCursorWidth * _maxCursorHeight, 1);
+ memset(_mouseData, 0xFF, _maxCursorWidth * _maxCursorHeight);
+
+ uint8 color = 225;
+ if (getPlatform() == Common::kPlatformAmiga)
+ color = (getFeatures() & GF_32COLOR) ? 17 : 241;
+
+ const uint16 *src = _common_mouseInfo;
+ for (int i = 0; i < 16; i++) {
+ for (int j = 0; j < 16; j++) {
+ if (src[0] & (1 << (15 - (j % 16)))) {
+ if (src[1] & (1 << (15 - (j % 16)))) {
+ _mouseData[16 * i + j] = color;
+ } else {
+ _mouseData[16 * i + j] = 0;
}
}
- src += 2;
}
- } else {
- _maxCursorWidth = 16;
- _maxCursorHeight = 16;
- _mouseData = (byte *)calloc(_maxCursorWidth * _maxCursorHeight, 1);
+ src += 2;
}
}
+void AGOSEngine::initMouse() {
+ _maxCursorWidth = 16;
+ _maxCursorHeight = 16;
+ _mouseData = (byte *)calloc(_maxCursorWidth * _maxCursorHeight, 1);
+}
+
void AGOSEngine_PuzzlePack::loadMouseImage() {
loadZone(_variableArray[500]);
VgaPointersEntry *vpe = &_vgaBufferPointers[_variableArray[500]];
diff --git a/engines/agos/debug.cpp b/engines/agos/debug.cpp
index 2cf285d56a..d483275a9f 100644
--- a/engines/agos/debug.cpp
+++ b/engines/agos/debug.cpp
@@ -295,81 +295,93 @@ void AGOSEngine::dumpVgaScriptAlways(const byte *ptr, uint res, uint sprite_id)
printf("; end\n");
}
-void AGOSEngine::dumpVgaFile(const byte *vga) {
+void AGOSEngine_Feeble::dumpVgaFile(const byte *vga) {
const byte *pp;
const byte *p;
int count;
pp = vga;
- if (getGameType() == GType_FF || getGameType() == GType_PP) {
- p = pp + READ_LE_UINT16(pp + 2);
- count = READ_LE_UINT16(&((const VgaFileHeader2_Feeble *) p)->animationCount);
- p = pp + READ_LE_UINT16(&((const VgaFileHeader2_Feeble *) p)->animationTable);
+ p = pp + READ_LE_UINT16(pp + 2);
+ count = READ_LE_UINT16(&((const VgaFileHeader2_Feeble *) p)->animationCount);
+ p = pp + READ_LE_UINT16(&((const VgaFileHeader2_Feeble *) p)->animationTable);
- while (--count >= 0) {
- int id = READ_LE_UINT16(&((const AnimationHeader_Feeble *) p)->id);
+ while (--count >= 0) {
+ int id = READ_LE_UINT16(&((const AnimationHeader_Feeble *) p)->id);
- dumpVgaScriptAlways(vga + READ_LE_UINT16(&((const AnimationHeader_Feeble *) p)->scriptOffs), id / 100, id);
- p += sizeof(AnimationHeader_Feeble);
- }
- } else if (getGameType() == GType_SIMON1 || getGameType() == GType_SIMON2) {
- p = pp + READ_BE_UINT16(pp + 4);
- count = READ_BE_UINT16(&((const VgaFileHeader2_Common *) p)->animationCount);
- p = pp + READ_BE_UINT16(&((const VgaFileHeader2_Common *) p)->animationTable);
+ dumpVgaScriptAlways(vga + READ_LE_UINT16(&((const AnimationHeader_Feeble *) p)->scriptOffs), id / 100, id);
+ p += sizeof(AnimationHeader_Feeble);
+ }
- while (--count >= 0) {
- int id = READ_BE_UINT16(&((const AnimationHeader_Simon *) p)->id);
+ pp = vga;
+ p = pp + READ_LE_UINT16(pp + 2);
+ count = READ_LE_UINT16(&((const VgaFileHeader2_Feeble *) p)->imageCount);
+ p = pp + READ_LE_UINT16(&((const VgaFileHeader2_Feeble *) p)->imageTable);
- dumpVgaScriptAlways(vga + READ_BE_UINT16(&((const AnimationHeader_Simon *) p)->scriptOffs), id / 100, id);
- p += sizeof(AnimationHeader_Simon);
- }
- } else {
- p = pp + READ_BE_UINT16(pp + 10) + 20;
- count = READ_BE_UINT16(&((const VgaFileHeader2_Common *) p)->animationCount);
- p = pp + READ_BE_UINT16(&((const VgaFileHeader2_Common *) p)->animationTable);
+ while (--count >= 0) {
+ int id = READ_LE_UINT16(&((const ImageHeader_Feeble *) p)->id);
- while (--count >= 0) {
- int id = READ_BE_UINT16(&((const AnimationHeader_WW *) p)->id);
+ dumpVgaScriptAlways(vga + READ_LE_UINT16(&((const ImageHeader_Feeble *) p)->scriptOffs), id / 100, id);
+ p += sizeof(ImageHeader_Feeble);
+ }
+}
- dumpVgaScriptAlways(vga + READ_BE_UINT16(&((const AnimationHeader_WW *) p)->scriptOffs), id / 100, id);
- p += sizeof(AnimationHeader_WW);
- }
+void AGOSEngine_Simon1::dumpVgaFile(const byte *vga) {
+ const byte *pp;
+ const byte *p;
+ int count;
+
+ pp = vga;
+ p = pp + READ_BE_UINT16(pp + 4);
+ count = READ_BE_UINT16(&((const VgaFileHeader2_Common *) p)->animationCount);
+ p = pp + READ_BE_UINT16(&((const VgaFileHeader2_Common *) p)->animationTable);
+
+ while (--count >= 0) {
+ int id = READ_BE_UINT16(&((const AnimationHeader_Simon *) p)->id);
+
+ dumpVgaScriptAlways(vga + READ_BE_UINT16(&((const AnimationHeader_Simon *) p)->scriptOffs), id / 100, id);
+ p += sizeof(AnimationHeader_Simon);
}
pp = vga;
- if (getGameType() == GType_FF || getGameType() == GType_PP) {
- p = pp + READ_LE_UINT16(pp + 2);
- count = READ_LE_UINT16(&((const VgaFileHeader2_Feeble *) p)->imageCount);
- p = pp + READ_LE_UINT16(&((const VgaFileHeader2_Feeble *) p)->imageTable);
+ p = pp + READ_BE_UINT16(pp + 4);
+ count = READ_BE_UINT16(&((const VgaFileHeader2_Common *) p)->imageCount);
+ p = pp + READ_BE_UINT16(&((const VgaFileHeader2_Common *) p)->imageTable);
- while (--count >= 0) {
- int id = READ_LE_UINT16(&((const ImageHeader_Feeble *) p)->id);
+ while (--count >= 0) {
+ int id = READ_BE_UINT16(&((const ImageHeader_Simon *) p)->id);
- dumpVgaScriptAlways(vga + READ_LE_UINT16(&((const ImageHeader_Feeble *) p)->scriptOffs), id / 100, id);
- p += sizeof(ImageHeader_Feeble);
- }
- } else if (getGameType() == GType_SIMON1 || getGameType() == GType_SIMON2) {
- p = pp + READ_BE_UINT16(pp + 4);
- count = READ_BE_UINT16(&((const VgaFileHeader2_Common *) p)->imageCount);
- p = pp + READ_BE_UINT16(&((const VgaFileHeader2_Common *) p)->imageTable);
+ dumpVgaScriptAlways(vga + READ_BE_UINT16(&((const ImageHeader_Simon *) p)->scriptOffs), id / 100, id);
+ p += sizeof(ImageHeader_Simon);
+ }
+}
- while (--count >= 0) {
- int id = READ_BE_UINT16(&((const ImageHeader_Simon *) p)->id);
+void AGOSEngine::dumpVgaFile(const byte *vga) {
+ const byte *pp;
+ const byte *p;
+ int count;
- dumpVgaScriptAlways(vga + READ_BE_UINT16(&((const ImageHeader_Simon *) p)->scriptOffs), id / 100, id);
- p += sizeof(ImageHeader_Simon);
- }
- } else {
- p = pp + READ_BE_UINT16(pp + 10) + 20;
- count = READ_BE_UINT16(&((const VgaFileHeader2_Common *) p)->imageCount);
- p = pp + READ_BE_UINT16(&((const VgaFileHeader2_Common *) p)->imageTable);
+ pp = vga;
+ p = pp + READ_BE_UINT16(pp + 10) + 20;
+ count = READ_BE_UINT16(&((const VgaFileHeader2_Common *) p)->animationCount);
+ p = pp + READ_BE_UINT16(&((const VgaFileHeader2_Common *) p)->animationTable);
- while (--count >= 0) {
- int id = READ_BE_UINT16(&((const ImageHeader_WW *) p)->id);
+ while (--count >= 0) {
+ int id = READ_BE_UINT16(&((const AnimationHeader_WW *) p)->id);
- dumpVgaScriptAlways(vga + READ_BE_UINT16(&((const ImageHeader_WW *) p)->scriptOffs), id / 100, id);
- p += sizeof(ImageHeader_WW);
- }
+ dumpVgaScriptAlways(vga + READ_BE_UINT16(&((const AnimationHeader_WW *) p)->scriptOffs), id / 100, id);
+ p += sizeof(AnimationHeader_WW);
+ }
+
+ pp = vga;
+ p = pp + READ_BE_UINT16(pp + 10) + 20;
+ count = READ_BE_UINT16(&((const VgaFileHeader2_Common *) p)->imageCount);
+ p = pp + READ_BE_UINT16(&((const VgaFileHeader2_Common *) p)->imageTable);
+
+ while (--count >= 0) {
+ int id = READ_BE_UINT16(&((const ImageHeader_WW *) p)->id);
+
+ dumpVgaScriptAlways(vga + READ_BE_UINT16(&((const ImageHeader_WW *) p)->scriptOffs), id / 100, id);
+ p += sizeof(ImageHeader_WW);
}
}
diff --git a/engines/agos/icons.cpp b/engines/agos/icons.cpp
index 7875347d4a..3f90742891 100644
--- a/engines/agos/icons.cpp
+++ b/engines/agos/icons.cpp
@@ -921,23 +921,29 @@ void AGOSEngine::drawArrow(uint16 x, uint16 y, int8 dir) {
_system->unlockScreen();
}
-void AGOSEngine::removeArrows(WindowBlock *window, uint num) {
+void AGOSEngine_Simon1::removeArrows(WindowBlock *window, uint num) {
if (getGameType() == GType_SIMON1) {
restoreBlock(200, 320, 146, 304);
- } else if (getGameType() == GType_WW) {
- setBitFlag(22, false);
- setWindowImageEx(6, 103);
- } else if (getGameType() == GType_ELVIRA2) {
- setBitFlag(21, false);
- setWindowImageEx(6, 106);
- } else if (getGameType() == GType_ELVIRA1) {
- if (num != 2) {
- uint y = window->height * 4 + window->y - 19;
- uint x = window->width + window->x;
- restoreBlock(y + 38, x + 16, y, x);
- } else {
- colorBlock(window, 240, 151, 16, 38);
- }
+ }
+}
+
+void AGOSEngine_Waxworks::removeArrows(WindowBlock *window, uint num) {
+ setBitFlag(22, false);
+ setWindowImageEx(6, 103);
+}
+
+void AGOSEngine_Elvira2::removeArrows(WindowBlock *window, uint num) {
+ setBitFlag(21, false);
+ setWindowImageEx(6, 106);
+}
+
+void AGOSEngine::removeArrows(WindowBlock *window, uint num) {
+ if (num != 2) {
+ uint y = window->height * 4 + window->y - 19;
+ uint x = window->width + window->x;
+ restoreBlock(y + 38, x + 16, y, x);
+ } else {
+ colorBlock(window, 240, 151, 16, 38);
}
}
diff --git a/engines/agos/items.cpp b/engines/agos/items.cpp
index fed323e70e..b7ba729a0d 100644
--- a/engines/agos/items.cpp
+++ b/engines/agos/items.cpp
@@ -53,28 +53,28 @@ void AGOSEngine::allocItemHeap() {
_itemHeap.clear();
}
+bool AGOSEngine_Elvira2::hasIcon(Item *item) {
+ SubObject *child = (SubObject *)findChildOfType(item, kObjectType);
+ return (child && (child->objectFlags & kOFIcon) != 0);
+}
+
bool AGOSEngine::hasIcon(Item *item) {
- if (getGameType() == GType_ELVIRA1) {
- return (getUserFlag(item, 7) != 0);
- } else {
- SubObject *child = (SubObject *)findChildOfType(item, kObjectType);
- return (child && (child->objectFlags & kOFIcon) != 0);
- }
+ return (getUserFlag(item, 7) != 0);
}
-uint AGOSEngine::itemGetIconNumber(Item *item) {
- if (getGameType() == GType_ELVIRA1) {
- return getUserFlag(item, 7);
- } else {
- SubObject *child = (SubObject *)findChildOfType(item, kObjectType);
- uint offs;
+uint AGOSEngine_Elvira2::itemGetIconNumber(Item *item) {
+ SubObject *child = (SubObject *)findChildOfType(item, kObjectType);
+ uint offs;
- if (child == NULL || !(child->objectFlags & kOFIcon))
- return 0;
+ if (child == NULL || !(child->objectFlags & kOFIcon))
+ return 0;
- offs = getOffsetOfChild2Param(child, 0x10);
- return child->objectFlagValue[offs];
- }
+ offs = getOffsetOfChild2Param(child, 0x10);
+ return child->objectFlagValue[offs];
+}
+
+uint AGOSEngine::itemGetIconNumber(Item *item) {
+ return getUserFlag(item, 7);
}
void AGOSEngine::setItemState(Item *item, int value) {
diff --git a/engines/agos/res.cpp b/engines/agos/res.cpp
index cd0d8e7ef6..7b989d91b4 100644
--- a/engines/agos/res.cpp
+++ b/engines/agos/res.cpp
@@ -38,25 +38,28 @@ using Common::File;
namespace AGOS {
+uint16 AGOSEngine_Feeble::to16Wrapper(uint value) {
+ return TO_LE_16(value);
+}
+
uint16 AGOSEngine::to16Wrapper(uint value) {
- if (getGameType() == GType_FF || getGameType() == GType_PP)
- return TO_LE_16(value);
- else
- return TO_BE_16(value);
+ return TO_BE_16(value);
+}
+
+uint16 AGOSEngine_Feeble::readUint16Wrapper(const void *src) {
+ return READ_LE_UINT16(src);
}
uint16 AGOSEngine::readUint16Wrapper(const void *src) {
- if (getGameType() == GType_FF || getGameType() == GType_PP)
- return READ_LE_UINT16(src);
- else
- return READ_BE_UINT16(src);
+ return READ_BE_UINT16(src);
+}
+
+uint32 AGOSEngine_Feeble::readUint32Wrapper(const void *src) {
+ return READ_LE_UINT32(src);
}
uint32 AGOSEngine::readUint32Wrapper(const void *src) {
- if (getGameType() == GType_FF || getGameType() == GType_PP)
- return READ_LE_UINT32(src);
- else
- return READ_BE_UINT32(src);
+ return READ_BE_UINT32(src);
}
void AGOSEngine::decompressData(const char *srcName, byte *dst, uint32 offset, uint32 srcSize, uint32 dstSize) {
diff --git a/engines/agos/saveload.cpp b/engines/agos/saveload.cpp
index 9314d46a33..1e04b5224f 100644
--- a/engines/agos/saveload.cpp
+++ b/engines/agos/saveload.cpp
@@ -74,32 +74,60 @@ int AGOSEngine::countSaveGames() {
return i;
}
-char *AGOSEngine::genSaveName(int slot) {
+char *AGOSEngine_PuzzlePack::genSaveName(int slot) {
static char buf[20];
- if (getGameId() == GID_DIMP) {
+ if (getGameId() == GID_DIMP)
sprintf(buf, "dimp.sav");
- } else if (getGameType() == GType_PP) {
+ else
sprintf(buf, "swampy.sav");
- } else if (getGameType() == GType_FF) {
- sprintf(buf, "feeble.%.3d", slot);
- } else if (getGameType() == GType_SIMON2) {
- sprintf(buf, "simon2.%.3d", slot);
- } else if (getGameType() == GType_SIMON1) {
- sprintf(buf, "simon1.%.3d", slot);
- } else if (getGameType() == GType_WW) {
- if (getPlatform() == Common::kPlatformPC)
- sprintf(buf, "waxworks-pc.%.3d", slot);
- else
- sprintf(buf, "waxworks.%.3d", slot);
- } else if (getGameType() == GType_ELVIRA2) {
- if (getPlatform() == Common::kPlatformPC)
- sprintf(buf, "elvira2-pc.%.3d", slot);
- else
- sprintf(buf, "elvira2.%.3d", slot);
- } else if (getGameType() == GType_ELVIRA1) {
- sprintf(buf, "elvira1.%.3d", slot);
- }
+
+ return buf;
+}
+
+char *AGOSEngine_Feeble::genSaveName(int slot) {
+ static char buf[20];
+ sprintf(buf, "feeble.%.3d", slot);
+ return buf;
+}
+
+char *AGOSEngine_Simon2::genSaveName(int slot) {
+ static char buf[20];
+ sprintf(buf, "simon2.%.3d", slot);
+ return buf;
+}
+
+char *AGOSEngine_Simon1::genSaveName(int slot) {
+ static char buf[20];
+ sprintf(buf, "simon1.%.3d", slot);
+ return buf;
+}
+
+char *AGOSEngine_Waxworks::genSaveName(int slot) {
+ static char buf[20];
+
+ if (getPlatform() == Common::kPlatformPC)
+ sprintf(buf, "waxworks-pc.%.3d", slot);
+ else
+ sprintf(buf, "waxworks.%.3d", slot);
+
+ return buf;
+}
+
+char *AGOSEngine_Elvira2::genSaveName(int slot) {
+ static char buf[20];
+
+ if (getPlatform() == Common::kPlatformPC)
+ sprintf(buf, "elvira2-pc.%.3d", slot);
+ else
+ sprintf(buf, "elvira2.%.3d", slot);
+
+ return buf;
+}
+
+char *AGOSEngine::genSaveName(int slot) {
+ static char buf[20];
+ sprintf(buf, "elvira1.%.3d", slot);
return buf;
}
@@ -170,55 +198,59 @@ void AGOSEngine::quickLoadOrSave() {
_saveLoadType = 0;
}
-bool AGOSEngine::confirmOverWrite(WindowBlock *window) {
- if (getGameType() == GType_WW) {
- Subroutine *sub = getSubroutineByID(80);
- if (sub != NULL)
- startSubroutineEx(sub);
-
- if (_variableArray[253] == 0)
- return true;
- } else if (getGameType() == GType_ELVIRA2) {
- // Original verison never confirmed
+bool AGOSEngine_Waxworks::confirmOverWrite(WindowBlock *window) {
+ Subroutine *sub = getSubroutineByID(80);
+ if (sub != NULL)
+ startSubroutineEx(sub);
+
+ if (_variableArray[253] == 0)
return true;
- } else if (getGameType() == GType_ELVIRA1) {
- const char *message1, *message2, *message3;
- switch (_language) {
- case Common::FR_FRA:
- message1 = "\rFichier d/j; existant.\r\r";
- message2 = " Ecrire pardessus ?\r\r";
- message3 = " Oui Non";
- break;
- case Common::DE_DEU:
- message1 = "\rDatei existiert bereits.\r\r";
- message2 = " berschreiben ?\r\r";
- message3 = " Ja Nein";
- break;
- default:
- message1 = "\r File already exists.\r\r";
- message2 = " Overwrite it ?\r\r";
- message3 = " Yes No";
- break;
- }
+ return false;
+}
- printScroll();
- window->textColumn = 0;
- window->textRow = 0;
- window->textColumnOffset = 0;
- window->textLength = 0; // Difference
+bool AGOSEngine_Elvira2::confirmOverWrite(WindowBlock *window) {
+ // Original verison never confirmed
+ return true;
+}
- for (; *message1; message1++)
- windowPutChar(window, *message1);
- for (; *message2; message2++)
- windowPutChar(window, *message2);
- for (; *message3; message3++)
- windowPutChar(window, *message3);
+bool AGOSEngine::confirmOverWrite(WindowBlock *window) {
+ const char *message1, *message2, *message3;
- if (confirmYesOrNo(120, 78) == 0x7FFF)
- return true;
+ switch (_language) {
+ case Common::FR_FRA:
+ message1 = "\rFichier d/j; existant.\r\r";
+ message2 = " Ecrire pardessus ?\r\r";
+ message3 = " Oui Non";
+ break;
+ case Common::DE_DEU:
+ message1 = "\rDatei existiert bereits.\r\r";
+ message2 = " berschreiben ?\r\r";
+ message3 = " Ja Nein";
+ break;
+ default:
+ message1 = "\r File already exists.\r\r";
+ message2 = " Overwrite it ?\r\r";
+ message3 = " Yes No";
+ break;
}
+ printScroll();
+ window->textColumn = 0;
+ window->textRow = 0;
+ window->textColumnOffset = 0;
+ window->textLength = 0; // Difference
+
+ for (; *message1; message1++)
+ windowPutChar(window, *message1);
+ for (; *message2; message2++)
+ windowPutChar(window, *message2);
+ for (; *message3; message3++)
+ windowPutChar(window, *message3);
+
+ if (confirmYesOrNo(120, 78) == 0x7FFF)
+ return true;
+
return false;
}