aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorTravis Howell2006-09-30 02:15:02 +0000
committerTravis Howell2006-09-30 02:15:02 +0000
commit702de78cdef025b2515341258863f28b517a9d64 (patch)
tree874b34f354e61a313158b6d9c502af3c26b2c900
parentbdfbd9b04906fb4b5e56420ee750d1d3d1f9764c (diff)
downloadscummvm-rg350-702de78cdef025b2515341258863f28b517a9d64.tar.gz
scummvm-rg350-702de78cdef025b2515341258863f28b517a9d64.tar.bz2
scummvm-rg350-702de78cdef025b2515341258863f28b517a9d64.zip
Add changes and stubs for Elvira 1
svn-id: r24023
-rw-r--r--engines/agos/agos.cpp55
-rw-r--r--engines/agos/agos.h6
-rw-r--r--engines/agos/intern.h17
-rw-r--r--engines/agos/items.cpp35
-rw-r--r--engines/agos/res.cpp56
-rw-r--r--engines/agos/vga.cpp63
6 files changed, 154 insertions, 78 deletions
diff --git a/engines/agos/agos.cpp b/engines/agos/agos.cpp
index 5463a556a1..d07579f2ef 100644
--- a/engines/agos/agos.cpp
+++ b/engines/agos/agos.cpp
@@ -575,6 +575,18 @@ void AGOSEngine::setupGame() {
_soundIndexBase = 1660 / 4;
_vgaBaseDelay = 1;
_numVars = 256;
+ } else if (getGameType() == GType_ELVIRA) {
+ gss = PTR(simon1_settings);
+ _numTextBoxes = 20;
+ _numVideoOpcodes = 56;
+#ifndef PALMOS_68K
+ _vgaMemSize = 1000000;
+#else
+ _vgaMemSize = gVars->memory[kMemSimon1Games];
+#endif
+ _tableMemSize = 150000;
+ _vgaBaseDelay = 1;
+ _numVars = 512;
} else {
gss = PTR(simon1_settings);
_tableIndexBase = 1576 / 4;
@@ -779,10 +791,14 @@ uint AGOSEngine::getNextStringID() {
}
uint AGOSEngine::getVarOrByte() {
- uint a = *_codePtr++;
- if (a != 255)
- return a;
- return readVariable(*_codePtr++);
+ if (getGameType() == GType_ELVIRA) {
+ return getVarOrWord();
+ } else {
+ uint a = *_codePtr++;
+ if (a != 255)
+ return a;
+ return readVariable(*_codePtr++);
+ }
}
uint AGOSEngine::getVarOrWord() {
@@ -801,7 +817,7 @@ uint AGOSEngine::getVarOrWord() {
}
uint AGOSEngine::getVarWrapper() {
- if (getGameType() == GType_PP)
+ if (getGameType() == GType_ELVIRA || getGameType() == GType_PP)
return getVarOrWord();
else
return getVarOrByte();
@@ -809,7 +825,6 @@ uint AGOSEngine::getVarWrapper() {
Item *AGOSEngine::getNextItemPtr() {
int a = getNextWord();
-
switch (a) {
case -1:
return _subjectItem;
@@ -969,10 +984,8 @@ void AGOSEngine::unlinkItem(Item *item) {
for (;;) {
if (!first)
error("unlinkItem: parent empty");
- if (first->sibling == 0) {
- warning("unlinkItem: parent does not contain child");
- return;
- }
+ if (first->sibling == 0)
+ error("unlinkItem: parent does not contain child");
next = derefItem(first->sibling);
if (next == item) {
@@ -1563,7 +1576,7 @@ void AGOSEngine::set_video_mode_internal(uint16 mode, uint16 vga_res_id) {
clearBackFromTop(134);
_usePaletteDelay = true;
}
- } else {
+ } else if (getGameType() == GType_SIMON2 || getGameType() == GType_FF) {
_scrollX = 0;
_scrollY = 0;
_scrollXMax = 0;
@@ -1716,11 +1729,11 @@ uint AGOSEngine::itemPtrToID(Item *id) {
bool AGOSEngine::isSpriteLoaded(uint16 id, uint16 zoneNum) {
VgaSprite *vsp = _vgaSprites;
while (vsp->id) {
- if (getGameType() == GType_SIMON1 || getGameType() == GType_WW) {
- if (vsp->id == id)
+ if (getGameType() == GType_SIMON2 || getGameType() == GType_FF || getGameType() == GType_PP) {
+ if (vsp->id == id && vsp->zoneNum == zoneNum)
return true;
} else {
- if (vsp->id == id && vsp->zoneNum == zoneNum)
+ if (vsp->id == id)
return true;
}
vsp++;
@@ -1876,16 +1889,16 @@ void AGOSEngine::loadSprite(uint windowNum, uint zoneNum, uint vgaSpriteId, uint
vsp->y = y;
vsp->x = x;
vsp->image = 0;
- if (getGameType() == GType_WW)
+ if (getGameType() == GType_ELVIRA || getGameType() == GType_ELVIRA2 || getGameType() == GType_WW)
vsp->palette = 0;
else
vsp->palette = palette;
vsp->id = vgaSpriteId;
- if (getGameType() == GType_SIMON1 || getGameType() == GType_WW)
- vsp->zoneNum = zoneNum = vgaSpriteId / 100;
- else
- vsp->zoneNum = zoneNum;
+ if (getGameType() == GType_SIMON2 || getGameType() == GType_FF || getGameType() == GType_PP)
+ vsp->zoneNum = zoneNum;
+ else
+ vsp->zoneNum = zoneNum = vgaSpriteId / 100;
for (;;) {
vpe = &_vgaBufferPointers[zoneNum];
@@ -2229,7 +2242,7 @@ void AGOSEngine::loadMusic(uint music) {
}
midi.startTrack (0);
- } else {
+ } else if (getGameType() == GType_ELVIRA2 || getGameType() == GType_WW) {
midi.stop();
midi.setLoop (true); // Must do this BEFORE loading music. (GMF may have its own override.)
@@ -2242,6 +2255,8 @@ void AGOSEngine::loadMusic(uint music) {
midi.loadS1D (&f);
midi.startTrack (0);
+ } else {
+ warning("Old music type not support");
}
}
diff --git a/engines/agos/agos.h b/engines/agos/agos.h
index 8dd0cc945d..0b5db6cd96 100644
--- a/engines/agos/agos.h
+++ b/engines/agos/agos.h
@@ -973,6 +973,12 @@ public:
uint16 getDoorState(Item *item, uint16 d);
uint16 getExitOf(Item *item, uint16 d);
+ // Opcodes, Elvira 1 only
+ void oe1_setFF();
+ void oe1_zoneDisk();
+ void oe1_opcode176();
+ void oe1_opcode178();
+
// Opcodes, Waxworks only
void oww_whereTo();
void oww_menu();
diff --git a/engines/agos/intern.h b/engines/agos/intern.h
index 13ed39156f..3883d36c6b 100644
--- a/engines/agos/intern.h
+++ b/engines/agos/intern.h
@@ -35,6 +35,9 @@ struct SubRoom : Child {
uint16 subroutine_id;
uint16 roomExitStates;
uint16 roomExit[1];
+ uint16 roomShort;
+ uint16 roomLong;
+ uint16 flags;
};
struct SubObject : Child {
@@ -55,7 +58,19 @@ struct SubUserInherit : Child {
struct SubUserFlag : Child {
uint16 subroutine_id;
- uint16 userFlags[4];
+ uint16 userFlags[8];
+ uint16 userItems[1];
+};
+
+struct SubContainer : Child {
+ uint16 subroutine_id;
+ uint16 volume;
+ uint16 flags;
+};
+
+struct SubGenExit : Child {
+ uint16 subroutine_id;
+ uint16 dest[6];
};
enum {
diff --git a/engines/agos/items.cpp b/engines/agos/items.cpp
index 4513e83b19..cf12a41cde 100644
--- a/engines/agos/items.cpp
+++ b/engines/agos/items.cpp
@@ -321,6 +321,7 @@ void AGOSEngine::setupOpcodes() {
opcode_table[56] = &AGOSEngine::o_copyff;
+ opcode_table[60] = &AGOSEngine::oe1_setFF;
opcode_table[61] = &AGOSEngine::o_clear;
opcode_table[64] = &AGOSEngine::o_let;
@@ -418,6 +419,9 @@ void AGOSEngine::setupOpcodes() {
opcode_table[173] = NULL;
opcode_table[174] = NULL;
+ opcode_table[176] = &AGOSEngine::oe1_opcode176;
+
+ opcode_table[178] = &AGOSEngine::oe1_opcode178;
opcode_table[179] = NULL;
opcode_table[182] = NULL;
@@ -497,6 +501,7 @@ void AGOSEngine::setupOpcodes() {
opcode_table[265] = &AGOSEngine::o_ifEndTune;
opcode_table[266] = &AGOSEngine::o_setAdjNoun;
+ opcode_table[267] = &AGOSEngine::oe1_zoneDisk;
opcode_table[268] = &AGOSEngine::o_saveUserGame;
opcode_table[269] = &AGOSEngine::o_loadUserGame;
opcode_table[271] = &AGOSEngine::o_stopTune;
@@ -827,7 +832,7 @@ void AGOSEngine::o_state() {
void AGOSEngine::o_oflag() {
// 28: item has prop
SubObject *subObject = (SubObject *)findChildOfType(getNextItemPtr(), 2);
- byte num = getVarOrByte();
+ uint num = getVarOrByte();
setScriptCondition(subObject != NULL && (subObject->objectFlags & (1 << num)) != 0);
}
@@ -1806,7 +1811,33 @@ void AGOSEngine::o_unfreezeZones() {
}
// -----------------------------------------------------------------------
-// Waxworks 1 Opcodes
+// Elvira 1 Opcodes
+// -----------------------------------------------------------------------
+
+void AGOSEngine::oe1_setFF() {
+ writeNextVarContents(0xFF);
+}
+
+void AGOSEngine::oe1_zoneDisk() {
+ getVarOrWord();
+ getVarOrWord();
+}
+
+void AGOSEngine::oe1_opcode176() {
+ getNextItemPtr();
+ getVarOrWord();
+ getNextItemPtr();
+}
+
+
+void AGOSEngine::oe1_opcode178() {
+ getNextItemPtr();
+ getVarOrWord();
+}
+
+
+// -----------------------------------------------------------------------
+// Waxworks Opcodes
// -----------------------------------------------------------------------
void AGOSEngine::oww_whereTo() {
diff --git a/engines/agos/res.cpp b/engines/agos/res.cpp
index 8d6ba275f9..6d87ad494f 100644
--- a/engines/agos/res.cpp
+++ b/engines/agos/res.cpp
@@ -255,7 +255,7 @@ void AGOSEngine::loadOffsets(const char *filename, int number, uint32 &file, uin
int AGOSEngine::allocGamePcVars(File *in) {
uint item_array_size, item_array_inited, stringtable_num;
uint32 version;
- uint i, start;
+ uint i, firstItem;
item_array_size = in->readUint32BE();
version = in->readUint32BE();
@@ -264,11 +264,11 @@ int AGOSEngine::allocGamePcVars(File *in) {
if (getGameType() == GType_ELVIRA || getGameType() == GType_ELVIRA2) {
item_array_inited = item_array_size;
- start = 0;
+ firstItem = 0;
} else {
item_array_inited += 2; // first two items are predefined
item_array_size += 2;
- start = 1;
+ firstItem = 1;
}
if (version != 0x80)
@@ -281,7 +281,7 @@ int AGOSEngine::allocGamePcVars(File *in) {
_itemArraySize = item_array_size;
_itemArrayInited = item_array_inited;
- for (i = start; i < item_array_inited; i++) {
+ for (i = firstItem; i < item_array_inited; i++) {
_itemArrayPtr[i] = (Item *)allocateItem(sizeof(Item));
}
@@ -308,14 +308,8 @@ void AGOSEngine::loadGamePcFile() {
createPlayer();
readGamePcText(&in);
- int start;
- if (getGameType() == GType_ELVIRA || getGameType() == GType_ELVIRA2) {
- start = 0;
- } else {
- start = 2;
- }
-
- for (i = start; i < num_inited_objects; i++) {
+ int firstItem = (getGameType() == GType_ELVIRA || getGameType() == GType_ELVIRA2) ? 0 : 2;
+ for (i = firstItem; i < num_inited_objects; i++) {
readItemFromGamePc(&in, _itemArrayPtr[i]);
}
@@ -449,11 +443,11 @@ void AGOSEngine::readItemFromGamePc(Common::File *in, Item *item) {
void AGOSEngine::readItemChildren(Common::File *in, Item *item, uint type) {
if (type == 1) {
- if (getGameType() == GType_ELVIRA || getGameType() == GType_ELVIRA2) {
- // FIXME
- in->readUint32BE();
- in->readUint32BE();
- in->readUint16BE();
+ if (getGameType() == GType_ELVIRA) {
+ SubRoom *subRoom = (SubRoom *)allocateChildBlock(item, 1, sizeof(SubRoom));
+ subRoom->roomShort = in->readUint32BE();
+ subRoom->roomLong = in->readUint32BE();
+ subRoom->flags = in->readUint16BE();
} else {
uint fr1 = in->readUint16BE();
uint fr2 = in->readUint16BE();
@@ -497,13 +491,13 @@ void AGOSEngine::readItemChildren(Common::File *in, Item *item, uint type) {
subObject->objectName = (uint16)in->readUint32BE();
} else if (type == 4) {
- // FIXME
- fileReadItemID(in);
- fileReadItemID(in);
- fileReadItemID(in);
- fileReadItemID(in);
- fileReadItemID(in);
- fileReadItemID(in);
+ SubGenExit *genExit = (SubGenExit *)allocateChildBlock(item, 4, sizeof(SubGenExit));
+ genExit->dest[0] = (uint16)fileReadItemID(in);
+ genExit->dest[1] = (uint16)fileReadItemID(in);
+ genExit->dest[2] = (uint16)fileReadItemID(in);
+ genExit->dest[3] = (uint16)fileReadItemID(in);
+ genExit->dest[4] = (uint16)fileReadItemID(in);
+ genExit->dest[5] = (uint16)fileReadItemID(in);
fileReadItemID(in);
fileReadItemID(in);
fileReadItemID(in);
@@ -511,9 +505,9 @@ void AGOSEngine::readItemChildren(Common::File *in, Item *item, uint type) {
fileReadItemID(in);
fileReadItemID(in);
} else if (type == 7) {
- // FIXME
- in->readUint16BE();
- in->readUint16BE();
+ SubContainer *container = (SubContainer *)allocateChildBlock(item, 7, sizeof(SubContainer));
+ container->volume = in->readUint16BE();
+ container->flags = in->readUint16BE();
} else if (type == 8) {
SubUserChain *chain = (SubUserChain *)allocateChildBlock(item, 8, sizeof(SubUserChain));
chain->chChained = (uint16)fileReadItemID(in);
@@ -522,13 +516,13 @@ void AGOSEngine::readItemChildren(Common::File *in, Item *item, uint type) {
setUserFlag(item, 1, in->readUint16BE());
setUserFlag(item, 2, in->readUint16BE());
setUserFlag(item, 3, in->readUint16BE());
- if (getGameType() == GType_ELVIRA || getGameType() == GType_ELVIRA2) {
+ if (getGameType() == GType_ELVIRA) {
setUserFlag(item, 4, in->readUint16BE());
setUserFlag(item, 5, in->readUint16BE());
setUserFlag(item, 6, in->readUint16BE());
setUserFlag(item, 7, in->readUint16BE());
- // FIXME
- fileReadItemID(in);
+ SubUserFlag *subUserFlag = (SubUserFlag *) findChildOfType(item, 9);
+ subUserFlag->userItems[0] = (uint16)fileReadItemID(in);
fileReadItemID(in);
fileReadItemID(in);
fileReadItemID(in);
@@ -889,7 +883,7 @@ byte *AGOSEngine::loadVGAFile(uint id, uint type, uint32 &dstSize) {
else
sprintf(filename, "%.3d%d.pkd", id / 2, type);
} else {
- if (getGameType() == GType_WW) {
+ if (getGameType() == GType_ELVIRA || getGameType() == GType_ELVIRA2 || getGameType() == GType_WW) {
sprintf(filename, "%.2d%d.VGA", id / 2, type);
} else {
sprintf(filename, "%.3d%d.VGA", id / 2, type);
diff --git a/engines/agos/vga.cpp b/engines/agos/vga.cpp
index 5095c9a108..dbfa73229e 100644
--- a/engines/agos/vga.cpp
+++ b/engines/agos/vga.cpp
@@ -137,11 +137,11 @@ void AGOSEngine::runVgaScript() {
}
}
- if (getGameType() == GType_SIMON1 || getGameType() == GType_WW) {
+ if (getGameType() == GType_SIMON2 || getGameType() == GType_FF || getGameType() == GType_PP) {
+ opcode = *_vcPtr++;
+ } else {
opcode = READ_BE_UINT16(_vcPtr);
_vcPtr += 2;
- } else {
- opcode = *_vcPtr++;
}
if (opcode >= _numVideoOpcodes)
@@ -195,11 +195,11 @@ bool AGOSEngine::vc_maybe_skip_proc_1(uint16 a, int16 b) {
VgaSprite *AGOSEngine::findCurSprite() {
VgaSprite *vsp = _vgaSprites;
while (vsp->id) {
- if (getGameType() == GType_SIMON1 || getGameType() == GType_WW) {
- if (vsp->id == _vgaCurSpriteId)
+ if (getGameType() == GType_SIMON2 || getGameType() == GType_FF || getGameType() == GType_PP) {
+ if (vsp->id == _vgaCurSpriteId && vsp->zoneNum == _vgaCurZoneNum)
break;
} else {
- if (vsp->id == _vgaCurSpriteId && vsp->zoneNum == _vgaCurZoneNum)
+ if (vsp->id == _vgaCurSpriteId)
break;
}
vsp++;
@@ -236,6 +236,18 @@ void AGOSEngine::vcWriteVar(uint var, int16 value) {
}
void AGOSEngine::vcSkipNextInstruction() {
+
+ static const byte opcodeParamLenElvira1[] = {
+ 0, 6, 2, 10, 6, 4, 2, 2,
+ 4, 4, 8, 2, 0, 2, 2, 2,
+ 2, 2, 2, 2, 0, 4, 2, 2,
+ 2, 8, 0, 10, 0, 8, 0, 2,
+ 2, 0, 0, 0, 0, 2, 4, 2,
+ 4, 4, 0, 0, 2, 2, 2, 4,
+ 4, 0, 18, 2, 4, 4, 4, 0,
+ 4
+ };
+
static const byte opcodeParamLenWW[] = {
0, 6, 2, 10, 6, 4, 2, 2,
4, 4, 8, 2, 2, 2, 2, 2,
@@ -295,9 +307,12 @@ void AGOSEngine::vcSkipNextInstruction() {
} else if (getGameType() == GType_SIMON1) {
opcode = vcReadNextWord();
_vcPtr += opcodeParamLenSimon1[opcode];
- } else {
+ } else if (getGameType() == GType_WW) {
opcode = vcReadNextWord();
_vcPtr += opcodeParamLenWW[opcode];
+ } else {
+ opcode = vcReadNextWord();
+ _vcPtr += opcodeParamLenElvira1[opcode];
}
if (_continousVgaScript)
@@ -405,12 +420,12 @@ void AGOSEngine::vc3_loadSprite() {
windowNum = vcReadNextWord(); /* 0 */
- if (getGameType() == GType_SIMON1 || getGameType() == GType_WW) {
+ if (getGameType() == GType_SIMON2 || getGameType() == GType_FF || getGameType() == GType_PP) {
+ zoneNum = vcReadNextWord(); /* 0 */
vgaSpriteId = vcReadNextWord(); /* 2 */
- zoneNum = vgaSpriteId / 100;
} else {
- zoneNum = vcReadNextWord(); /* 0 */
vgaSpriteId = vcReadNextWord(); /* 2 */
+ zoneNum = vgaSpriteId / 100;
}
x = vcReadNextWord(); /* 4 */
@@ -424,7 +439,7 @@ void AGOSEngine::vc3_loadSprite() {
while (vsp->id)
vsp++;
- if (getGameType() == GType_WW)
+ if (getGameType() == GType_ELVIRA || getGameType() == GType_ELVIRA2 || getGameType() == GType_WW)
vsp->palette = 0;
else
vsp->palette = palette;
@@ -843,10 +858,10 @@ void AGOSEngine::vc10_draw() {
state.y = (int16)vcReadNextWord();
state.y -= _scrollY;
- if (getGameType() == GType_SIMON1 || getGameType() == GType_WW) {
- state.flags = vcReadNextWord();
- } else {
+ if (getGameType() == GType_SIMON2 || getGameType() == GType_FF || getGameType() == GType_PP) {
state.flags = vcReadNextByte();
+ } else {
+ state.flags = vcReadNextWord();
}
if (state.image < 0)
@@ -904,7 +919,7 @@ void AGOSEngine::vc10_draw() {
return;
}
- if (getGameType() == GType_SIMON1 || getGameType() == GType_SIMON2 || getGameType() == GType_WW) {
+ if (getGameType() != GType_FF && getGameType() != GType_PP) {
if (state.flags & kDFCompressedFlip) {
state.depack_src = vc10_uncompressFlip(state.depack_src, width, height);
} else if (state.flags & kDFFlip) {
@@ -932,7 +947,7 @@ bool AGOSEngine::drawImages_clip(VC10_state *state) {
vlut = &_video_windows[_windowNum * 4];
- if (getGameType() == GType_SIMON1 || getGameType() == GType_SIMON2 || getGameType() == GType_WW) {
+ if (getGameType() != GType_FF && getGameType() != GType_PP) {
state->draw_width = state->width * 2;
}
@@ -976,7 +991,7 @@ bool AGOSEngine::drawImages_clip(VC10_state *state) {
assert(state->draw_width != 0 && state->draw_height != 0);
- if (getGameType() == GType_SIMON1 || getGameType() == GType_SIMON2 || getGameType() == GType_WW) {
+ if (getGameType() != GType_FF && getGameType() != GType_PP) {
state->draw_width *= 4;
}
@@ -1228,7 +1243,7 @@ void AGOSEngine::drawImages(VC10_state *state) {
/* vc10_helper_5 */
} else if ((((_lockWord & 0x20) && state->palette == 0) || state->palette == 0xC0) &&
- getGameType() != GType_WW) {
+ (getGameType() == GType_SIMON1 || getGameType() == GType_SIMON2)) {
const byte *src;
byte *dst;
uint h, i;
@@ -1608,10 +1623,10 @@ void AGOSEngine::vc20_setRepeat() {
void AGOSEngine::vc21_endRepeat() {
int16 a = vcReadNextWord();
const byte *tmp = _vcPtr + a;
- if (getGameType() == GType_SIMON1 || getGameType() == GType_WW)
- tmp += 4;
- else
+ if (getGameType() == GType_SIMON2 || getGameType() == GType_FF || getGameType() == GType_PP)
tmp += 3;
+ else
+ tmp += 4;
uint16 val = READ_LE_UINT16(tmp);
if (val != 0) {
@@ -1713,10 +1728,10 @@ void AGOSEngine::vc24_setSpriteXY() {
vsp->x += (int16)vcReadNextWord();
vsp->y += (int16)vcReadNextWord();
- if (getGameType() == GType_SIMON1 || getGameType() == GType_WW) {
- vsp->flags = vcReadNextWord();
- } else {
+ if (getGameType() == GType_SIMON2 || getGameType() == GType_FF || getGameType() == GType_PP) {
vsp->flags = vcReadNextByte();
+ } else {
+ vsp->flags = vcReadNextWord();
}
_vgaSpriteChanged++;