aboutsummaryrefslogtreecommitdiff
path: root/engines
diff options
context:
space:
mode:
Diffstat (limited to 'engines')
-rw-r--r--engines/agi/predictive.cpp5
-rw-r--r--engines/cruise/cruise_main.cpp2
-rw-r--r--engines/cruise/ctp.cpp14
-rw-r--r--engines/cruise/dataLoader.cpp21
-rw-r--r--engines/cruise/overlay.cpp312
-rw-r--r--engines/cruise/overlay.h2
-rw-r--r--engines/cruise/saveload.cpp3
-rw-r--r--engines/cruise/vars.h3
-rw-r--r--engines/drascula/drascula.cpp12
-rw-r--r--engines/drascula/drascula.h2
-rw-r--r--engines/drascula/sound.cpp11
-rw-r--r--engines/drascula/talk.cpp44
-rw-r--r--engines/gob/detection.cpp13
-rw-r--r--engines/made/screen.cpp19
-rw-r--r--engines/made/scriptfuncs.cpp2
-rw-r--r--engines/parallaction/balloons.cpp2
-rw-r--r--engines/parallaction/saveload.cpp5
-rw-r--r--engines/saga/animation.cpp3
-rw-r--r--engines/saga/displayinfo.h8
-rw-r--r--engines/saga/interface.cpp17
-rw-r--r--engines/saga/interface.h5
-rw-r--r--engines/scumm/actor.cpp208
-rw-r--r--engines/scumm/actor.h69
-rw-r--r--engines/scumm/akos.cpp28
-rw-r--r--engines/scumm/charset-fontdata.cpp1
-rw-r--r--engines/scumm/detection.cpp19
-rw-r--r--engines/scumm/detection_tables.h1
-rw-r--r--engines/scumm/dialogs.cpp8
-rw-r--r--engines/scumm/file.cpp6
-rw-r--r--engines/scumm/file.h18
-rw-r--r--engines/scumm/file_nes.h6
-rw-r--r--engines/scumm/gfx.cpp13
-rw-r--r--engines/scumm/he/intern_he.h3
-rw-r--r--engines/scumm/he/resource_he.cpp25
-rw-r--r--engines/scumm/he/resource_he.h4
-rw-r--r--engines/scumm/he/script_v100he.cpp6
-rw-r--r--engines/scumm/he/script_v60he.cpp5
-rw-r--r--engines/scumm/he/script_v70he.cpp2
-rw-r--r--engines/scumm/he/script_v71he.cpp12
-rw-r--r--engines/scumm/he/script_v72he.cpp6
-rw-r--r--engines/scumm/he/script_v80he.cpp6
-rw-r--r--engines/scumm/he/script_v90he.cpp12
-rw-r--r--engines/scumm/object.cpp7
-rw-r--r--engines/scumm/scumm-md5.h8
-rw-r--r--engines/scumm/scumm.cpp2
-rw-r--r--engines/scumm/scumm.h2
-rw-r--r--engines/sword1/animation.cpp29
-rw-r--r--engines/sword1/animation.h9
-rw-r--r--engines/sword1/logic.cpp5
-rw-r--r--engines/sword1/logic.h4
-rw-r--r--engines/sword1/sword1.cpp2
51 files changed, 544 insertions, 487 deletions
diff --git a/engines/agi/predictive.cpp b/engines/agi/predictive.cpp
index 21f9256e70..09472235ad 100644
--- a/engines/agi/predictive.cpp
+++ b/engines/agi/predictive.cpp
@@ -491,7 +491,8 @@ void AgiEngine::loadDict(void) {
ConfMan.registerDefault("predictive_dictionary", "pred.dic");
uint32 time1 = _system->getMillis();
- if (!inFile.open(ConfMan.get("predictive_dictionary")))
+ Common::String inFileName(ConfMan.get("predictive_dictionary"));
+ if (!inFile.open(inFileName))
return;
char *ptr;
@@ -505,7 +506,7 @@ void AgiEngine::loadDict(void) {
inFile.read(_predictiveDictText, size);
_predictiveDictText[size] = 0;
uint32 time2 = _system->getMillis();
- debug("Time to read %s: %d bytes, %d ms", inFile.name(), size, time2-time1);
+ debug("Time to read %s: %d bytes, %d ms", inFileName.c_str(), size, time2-time1);
inFile.close();
ptr = _predictiveDictText;
diff --git a/engines/cruise/cruise_main.cpp b/engines/cruise/cruise_main.cpp
index 5d16c6e68a..7064f81a90 100644
--- a/engines/cruise/cruise_main.cpp
+++ b/engines/cruise/cruise_main.cpp
@@ -243,7 +243,7 @@ ovlData3Struct *scriptFunc1Sub2(int32 scriptNumber, int32 param) {
return NULL;
}
- return ((ovlData3Struct *) (ovlData->ptr1 + param * 0x1C));
+ return &ovlData->ptr1[param];
}
void scriptFunc2(int scriptNumber, scriptInstanceStruct * scriptHandle,
diff --git a/engines/cruise/ctp.cpp b/engines/cruise/ctp.cpp
index 6c7be713ef..b45b6dc866 100644
--- a/engines/cruise/ctp.cpp
+++ b/engines/cruise/ctp.cpp
@@ -153,8 +153,8 @@ void makeCtStruct(uint8* str, int16 table[][40], int num, int z) {
int16* a2;
a1 = a2 = (int16*)str;
- a2 += 4+sizeof(int16*); // skip header
-
+ a2 += sizeof(int16*) / sizeof(int16) + 6; // skip header
+
int16* XArray = XMIN_XMAX;
int minY = *XArray++;
@@ -178,8 +178,8 @@ void makeCtStruct(uint8* str, int16 table[][40], int num, int z) {
adrStructPoly = (uint8*)a2;
- *(uint16**)a2 = (uint16*)-1;
-
+ *(uint16**)a2 = (uint16*)-1; //chained list terminator
+
a1+=sizeof(int16*);
*a1++=num;
*a1++=walkboxColor[num];
@@ -339,20 +339,20 @@ int initCt(const char *ctpName) {
makeCtStruct(adrStructPoly, ctp_walkboxTable, i, 0 );
}
- polyStructExp = adrStructPoly += 4;
+ polyStructExp = adrStructPoly += sizeof(int16 *);
for(int i= numberOfWalkboxes-1; i >=0; i--) {
makeCtStruct(adrStructPoly, ctp_walkboxTable, i, walkboxZoom[i] * 20 );
}
- int ctSize = (adrStructPoly - ptr) + 4; // for now, the +4 is a safe zone
+ int ctSize = (adrStructPoly - ptr) + sizeof(int16 *); // for now, the +sizeof(int16 *) is a safe zone
adrStructPoly = polyStructNorm = polyStruct = (uint8 *) malloc(ctSize);
for(int i= numberOfWalkboxes-1; i >=0; i--) {
makeCtStruct(adrStructPoly, ctp_walkboxTable, i, 0);
}
- polyStructExp = adrStructPoly += 4;
+ polyStructExp = adrStructPoly += sizeof(int16 *);
for(int i= numberOfWalkboxes-1; i >=0; i--) {
makeCtStruct(adrStructPoly, ctp_walkboxTable, i, walkboxZoom[i] * 20);
diff --git a/engines/cruise/dataLoader.cpp b/engines/cruise/dataLoader.cpp
index 7ce69448a6..c274291142 100644
--- a/engines/cruise/dataLoader.cpp
+++ b/engines/cruise/dataLoader.cpp
@@ -24,6 +24,7 @@
*/
#include "cruise/cruise_main.h"
+#include "common/endian.h"
namespace Cruise {
@@ -412,7 +413,6 @@ int loadFNTSub(uint8 *ptr, int destIdx) {
}
int loadSetEntry(const char *name, uint8 *ptr, int currentEntryIdx, int currentDestEntry) {
- uint8 *ptr2;
uint8 *ptr3;
int offset;
int sec = 0;
@@ -422,28 +422,27 @@ int loadSetEntry(const char *name, uint8 *ptr, int currentEntryIdx, int currentD
sec = 1;
}
- ptr2 = ptr + 4;
-
- memcpy(&numIdx, ptr2, 2);
- flipShort(&numIdx);
+ numIdx = READ_BE_UINT16(ptr + 4);
ptr3 = ptr + 6;
offset = currentEntryIdx * 16;
{
- uint8 *ptr4;
int resourceSize;
int fileIndex;
setHeaderEntry localBuffer;
uint8 *ptr5;
- ptr4 = ptr + offset + 6;
-
- memcpy(&localBuffer, ptr4, sizeof(setHeaderEntry));
+ Common::MemoryReadStream s4(ptr + offset + 6, 16);
- flipLong((int32 *) & localBuffer.field_0);
- flipGen(&localBuffer.width, 12);
+ localBuffer.field_0 = s4.readUint32BE();
+ localBuffer.width = s4.readUint16BE();
+ localBuffer.height = s4.readUint16BE();
+ localBuffer.type = s4.readUint16BE();
+ localBuffer.transparency = s4.readUint16BE();
+ localBuffer.field_C = s4.readUint16BE();
+ localBuffer.field_E = s4.readUint16BE();
if (sec == 1) {
localBuffer.width = localBuffer.width - (localBuffer.type * 2); // Type 1: Width - (1*2) , Type 5: Width - (5*2)
diff --git a/engines/cruise/overlay.cpp b/engines/cruise/overlay.cpp
index d3cb93c37c..4d476ceaf1 100644
--- a/engines/cruise/overlay.cpp
+++ b/engines/cruise/overlay.cpp
@@ -23,6 +23,8 @@
*
*/
+#include "common/stream.h"
+
#include "cruise/cruise_main.h"
namespace Cruise {
@@ -50,8 +52,7 @@ int loadOverlay(const char *scriptName) {
char fileName[50];
int fileIdx;
int unpackedSize;
- char *unpackedBuffer;
- char *scriptPtr;
+ byte *unpackedBuffer;
ovlDataStruct *ovlData;
printf("Load overlay: %s\n", scriptName);
@@ -105,7 +106,7 @@ int loadOverlay(const char *scriptName) {
unpackedSize = volumePtrToFileDescriptor[fileIdx].extSize + 2;
// TODO: here, can unpack in gfx module buffer
- unpackedBuffer = (char *)mallocAndZero(unpackedSize);
+ unpackedBuffer = (byte *)mallocAndZero(unpackedSize);
if (!unpackedBuffer) {
return (-2);
@@ -127,12 +128,13 @@ int loadOverlay(const char *scriptName) {
printf("OVL loading done...\n");
- scriptPtr = unpackedBuffer;
+ Common::MemoryReadStream s(unpackedBuffer, unpackedSize);
ovlData = overlayTable[scriptIdx].ovlData;
- memcpy(ovlData, scriptPtr, sizeof(ovlDataStruct));
-
+ // Skip pointers
+ s.skip(60);
+
ovlData->arrayProc = NULL;
ovlData->ptr1 = NULL;
ovlData->arrayObject = NULL;
@@ -148,24 +150,22 @@ int loadOverlay(const char *scriptName) {
ovlData->arrayNameSymbGlob = NULL;
ovlData->data4Ptr = NULL;
ovlData->ptr8 = NULL;
- ovlData->numProc = readB16(scriptPtr + 60);
- ovlData->numRel = readB16(scriptPtr + 62);
- ovlData->numSymbGlob = readB16(scriptPtr + 64);
- ovlData->numRelocGlob = readB16(scriptPtr + 66);
- ovlData->numMsgRelHeader = readB16(scriptPtr + 68);
- ovlData->numObj = readB16(scriptPtr + 70);
- ovlData->numStrings = readB16(scriptPtr + 72);
- ovlData->size8 = readB16(scriptPtr + 74);
- ovlData->size9 = readB16(scriptPtr + 76);
- ovlData->nameExportSize = readB16(scriptPtr + 78);
- ovlData->exportNamesSize = readB16(scriptPtr + 80);
- ovlData->specialString2Length = readB16(scriptPtr + 82);
- ovlData->sizeOfData4 = readB16(scriptPtr + 84);
- ovlData->size12 = readB16(scriptPtr + 86);
- ovlData->specialString1Length = readB16(scriptPtr + 88);
- ovlData->scriptNumber = readB16(scriptPtr + 90);
-
- scriptPtr += 92;
+ ovlData->numProc = s.readUint16BE();
+ ovlData->numRel = s.readUint16BE();
+ ovlData->numSymbGlob = s.readUint16BE();
+ ovlData->numRelocGlob = s.readUint16BE();
+ ovlData->numMsgRelHeader = s.readUint16BE();
+ ovlData->numObj = s.readUint16BE();
+ ovlData->numStrings = s.readUint16BE();
+ ovlData->size8 = s.readUint16BE();
+ ovlData->size9 = s.readUint16BE();
+ ovlData->nameExportSize = s.readUint16BE();
+ ovlData->exportNamesSize = s.readUint16BE();
+ ovlData->specialString2Length = s.readUint16BE();
+ ovlData->sizeOfData4 = s.readUint16BE();
+ ovlData->size12 = s.readUint16BE();
+ ovlData->specialString1Length = s.readUint16BE();
+ ovlData->scriptNumber = s.readUint16BE();
if (ovlData->numSymbGlob) { // export data
int i;
@@ -177,13 +177,11 @@ int loadOverlay(const char *scriptName) {
}
for (i = 0; i < ovlData->numSymbGlob; i++) {
- ovlData->arraySymbGlob[i].var0 = readB16(scriptPtr);
- ovlData->arraySymbGlob[i].var2 = readB16(scriptPtr + 2);
- ovlData->arraySymbGlob[i].var4 = readB16(scriptPtr + 4);
- ovlData->arraySymbGlob[i].idx = readB16(scriptPtr + 6);
- ovlData->arraySymbGlob[i].offsetToName = readB16(scriptPtr + 8);
-
- scriptPtr += 10;
+ ovlData->arraySymbGlob[i].var0 = s.readUint16BE();
+ ovlData->arraySymbGlob[i].var2 = s.readUint16BE();
+ ovlData->arraySymbGlob[i].var4 = s.readUint16BE();
+ ovlData->arraySymbGlob[i].idx = s.readUint16BE();
+ ovlData->arraySymbGlob[i].offsetToName = s.readUint16BE();
}
}
@@ -194,8 +192,7 @@ int loadOverlay(const char *scriptName) {
return (-2);
}
- memcpy(ovlData->arrayNameSymbGlob, scriptPtr, ovlData->exportNamesSize);
- scriptPtr += ovlData->exportNamesSize;
+ s.read(ovlData->arrayNameSymbGlob, ovlData->exportNamesSize);
}
if (ovlData->numRelocGlob) { // import data
@@ -210,13 +207,11 @@ int loadOverlay(const char *scriptName) {
}
for (i = 0; i < ovlData->numRelocGlob; i++) {
- ovlData->arrayRelocGlob[i].var0 = readB16(scriptPtr);
- ovlData->arrayRelocGlob[i].var1 = readB16(scriptPtr + 2);
- ovlData->arrayRelocGlob[i].linkType = readB16(scriptPtr + 4);
- ovlData->arrayRelocGlob[i].linkIdx = readB16(scriptPtr + 6);
- ovlData->arrayRelocGlob[i].nameOffset = readB16(scriptPtr + 8);
-
- scriptPtr += 10;
+ ovlData->arrayRelocGlob[i].var0 = s.readUint16BE();
+ ovlData->arrayRelocGlob[i].var1 = s.readUint16BE();
+ ovlData->arrayRelocGlob[i].linkType = s.readUint16BE();
+ ovlData->arrayRelocGlob[i].linkIdx = s.readUint16BE();
+ ovlData->arrayRelocGlob[i].nameOffset = s.readUint16BE();
}
}
@@ -226,13 +221,12 @@ int loadOverlay(const char *scriptName) {
if (!ovlData->arrayNameRelocGlob) {
return (-2);
}
-
- memcpy(ovlData->arrayNameRelocGlob, scriptPtr,
- ovlData->nameExportSize);
- scriptPtr += ovlData->nameExportSize;
+
+ s.read(ovlData->arrayNameRelocGlob, ovlData->nameExportSize);
}
if (ovlData->numMsgRelHeader) { // link data
+ int i;
ASSERT(sizeof(linkDataStruct) == 0x22);
ovlData->arrayMsgRelHeader = (linkDataStruct *) mallocAndZero(ovlData->numMsgRelHeader * sizeof(linkDataStruct));
@@ -241,9 +235,30 @@ int loadOverlay(const char *scriptName) {
return (-2);
}
- memcpy(ovlData->arrayMsgRelHeader, scriptPtr, ovlData->numMsgRelHeader * sizeof(linkDataStruct));
- scriptPtr += ovlData->numMsgRelHeader * sizeof(linkDataStruct);
- flipGen(ovlData->arrayMsgRelHeader, ovlData->numMsgRelHeader * sizeof(linkDataStruct));
+ for (i = 0; i < ovlData->numMsgRelHeader; i++) {
+ ovlData->arrayMsgRelHeader[i].type = s.readUint16BE();
+ ovlData->arrayMsgRelHeader[i].id = s.readUint16BE();
+ ovlData->arrayMsgRelHeader[i].offsetVerbeName = s.readUint16BE();
+ ovlData->arrayMsgRelHeader[i].verbOverlay = s.readUint16BE();
+ ovlData->arrayMsgRelHeader[i].verbNumber = s.readUint16BE();
+
+ ovlData->arrayMsgRelHeader[i].obj1Overlay = s.readUint16BE();
+ ovlData->arrayMsgRelHeader[i].obj1Number = s.readUint16BE();
+ ovlData->arrayMsgRelHeader[i].obj2Overlay = s.readUint16BE();
+ ovlData->arrayMsgRelHeader[i].obj2Number = s.readUint16BE();
+
+ ovlData->arrayMsgRelHeader[i].trackX = s.readUint16BE();
+ ovlData->arrayMsgRelHeader[i].trackY = s.readUint16BE();
+
+ ovlData->arrayMsgRelHeader[i].obj1NewState = s.readUint16BE();
+ ovlData->arrayMsgRelHeader[i].obj2NewState = s.readUint16BE();
+
+ ovlData->arrayMsgRelHeader[i].obj1OldState = s.readUint16BE();
+ ovlData->arrayMsgRelHeader[i].obj2OldState = s.readUint16BE();
+
+ ovlData->arrayMsgRelHeader[i].trackDirection = s.readUint16BE();
+ ovlData->arrayMsgRelHeader[i].dialog = s.readUint16BE();
+ }
}
if (ovlData->numProc) { // script
@@ -251,53 +266,47 @@ int loadOverlay(const char *scriptName) {
int i;
ovlData->arrayProc =
- (ovlData3Struct *) mallocAndZero(ovlData->numProc *
- sizeof(ovlData3Struct));
+ (ovlData3Struct *) mallocAndZero(ovlData->numProc * sizeof(ovlData3Struct));
if (!ovlData->arrayProc) {
-/* releaseScript(scriptIdx,scriptName);
-
- if (freeIsNeeded) {
- freePtr(unpackedBuffer);
- } */
-
return (-2);
}
- memcpy(ovlData->arrayProc, scriptPtr,
- ovlData->numProc * sizeof(ovlData3Struct));
- scriptPtr += ovlData->numProc * 0x1C;
-
- flipGen(ovlData->arrayProc,
- ovlData->numProc * sizeof(ovlData3Struct));
+ for (i = 0; i < ovlData->numProc; i++) {
+ s.skip(4);
+ ovlData->arrayProc[i].dataPtr = NULL;
+ ovlData->arrayProc[i].sizeOfData = s.readUint16BE();
+ ovlData->arrayProc[i].offsetToSubData3 = s.readUint16BE();
+ ovlData->arrayProc[i].offsetToImportData = s.readUint16BE();
+ ovlData->arrayProc[i].offsetToSubData2 = s.readUint16BE();
+ ovlData->arrayProc[i].offsetToImportName = s.readUint16BE();
+ ovlData->arrayProc[i].offsetToSubData5 = s.readUint16BE();
+ ovlData->arrayProc[i].sysKey = s.readUint16BE();
+ ovlData->arrayProc[i].var12 = s.readUint16BE();
+ ovlData->arrayProc[i].numRelocGlob = s.readUint16BE();
+ ovlData->arrayProc[i].subData2Size = s.readUint16BE();
+ ovlData->arrayProc[i].var18 = s.readUint16BE();
+ ovlData->arrayProc[i].var1A = s.readUint16BE();
+ }
tempPtr = ovlData->arrayProc;
for (i = 0; i < ovlData->numProc; i++) {
- uint8 *ptr = tempPtr->dataPtr =
- (uint8 *) mallocAndZero(tempPtr->sizeOfData);
-
- if (!ptr) {
- /* releaseScript(scriptIdx,scriptName);
- *
- * if (freeIsNeeded)
- * {
- * freePtr(unpackedBuffer);
- * } */
+ tempPtr->dataPtr = (uint8 *) mallocAndZero(tempPtr->sizeOfData);
+ if (!tempPtr->dataPtr) {
return (-2);
}
- memcpy(ptr, scriptPtr, tempPtr->sizeOfData);
- scriptPtr += tempPtr->sizeOfData;
+ s.read(tempPtr->dataPtr, tempPtr->sizeOfData);
if (tempPtr->offsetToImportData) {
- flipGen(ptr + tempPtr->offsetToImportData,
+ flipGen(tempPtr->dataPtr + tempPtr->offsetToImportData,
tempPtr->numRelocGlob * 10);
}
if (tempPtr->offsetToSubData2) {
- flipGen(ptr + tempPtr->offsetToImportData,
+ flipGen(tempPtr->dataPtr + tempPtr->offsetToSubData2,
tempPtr->subData2Size * 10);
}
@@ -310,43 +319,47 @@ int loadOverlay(const char *scriptName) {
int i;
ovlData->ptr1 =
- (uint8 *) mallocAndZero(ovlData->numRel * 0x1C);
+ (ovlData3Struct *) mallocAndZero(ovlData->numRel * sizeof(ovlData3Struct));
if (!ovlData->ptr1) {
return (-2);
}
- memcpy(ovlData->ptr1, scriptPtr, ovlData->numRel * 0x1C);
- scriptPtr += ovlData->numRel * 0x1C;
- flipGen(ovlData->ptr1, ovlData->numRel * 0x1C);
-
+ for (i = 0; i < ovlData->numRel; i++) {
+ s.skip(4);
+ ovlData->ptr1[i].dataPtr = NULL;
+ ovlData->ptr1[i].sizeOfData = s.readUint16BE();
+ ovlData->ptr1[i].offsetToSubData3 = s.readUint16BE();
+ ovlData->ptr1[i].offsetToImportData = s.readUint16BE();
+ ovlData->ptr1[i].offsetToSubData2 = s.readUint16BE();
+ ovlData->ptr1[i].offsetToImportName = s.readUint16BE();
+ ovlData->ptr1[i].offsetToSubData5 = s.readUint16BE();
+ ovlData->ptr1[i].sysKey = s.readUint16BE();
+ ovlData->ptr1[i].var12 = s.readUint16BE();
+ ovlData->ptr1[i].numRelocGlob = s.readUint16BE();
+ ovlData->ptr1[i].subData2Size = s.readUint16BE();
+ ovlData->ptr1[i].var18 = s.readUint16BE();
+ ovlData->ptr1[i].var1A = s.readUint16BE();
+ }
+
tempPtr = (ovlData3Struct *) ovlData->ptr1;
for (i = 0; i < ovlData->numRel; i++) {
- uint8 *ptr = tempPtr->dataPtr =
- (uint8 *) mallocAndZero(tempPtr->sizeOfData);
-
- if (!ptr) {
- /* releaseScript(scriptIdx,scriptName);
- *
- * if (freeIsNeeded)
- * {
- * freePtr(unpackedBuffer);
- * } */
+ tempPtr->dataPtr = (uint8 *) mallocAndZero(tempPtr->sizeOfData);
+ if (!tempPtr->dataPtr) {
return (-2);
}
- memcpy(ptr, scriptPtr, tempPtr->sizeOfData);
- scriptPtr += tempPtr->sizeOfData;
+ s.read(tempPtr->dataPtr, tempPtr->sizeOfData);
if (tempPtr->offsetToImportData) {
- flipGen(ptr + tempPtr->offsetToImportData,
+ flipGen(tempPtr->dataPtr + tempPtr->offsetToImportData,
tempPtr->numRelocGlob * 10);
}
if (tempPtr->offsetToSubData2) {
- flipGen(ptr + tempPtr->offsetToImportData,
+ flipGen(tempPtr->dataPtr + tempPtr->offsetToSubData2,
tempPtr->subData2Size * 10);
}
@@ -367,8 +380,7 @@ int loadOverlay(const char *scriptName) {
return (-2);
}
- memcpy(ovlData->ptr8, scriptPtr, ovlData->size12);
- scriptPtr += ovlData->size12;
+ s.read(ovlData->ptr8, ovlData->size12);
}
if (ovlData->numObj) {
@@ -378,47 +390,20 @@ int loadOverlay(const char *scriptName) {
sizeof(objDataStruct));
if (!ovlData->arrayObject) {
-/* releaseScript(scriptIdx,scriptName);
-
- if (freeIsNeeded) {
- freePtr(unpackedBuffer);
- } */
-
return (-2);
}
for (i = 0; i < ovlData->numObj; i++) {
- ovlData->arrayObject[i]._type = *(int16 *) scriptPtr;
- scriptPtr += 2;
- flipShort(&ovlData->arrayObject[i]._type);
-
- int16 tempClass = *(int16 *) scriptPtr;
- flipShort(&tempClass);
- ovlData->arrayObject[i]._class = (eClass)tempClass;
- scriptPtr += 2;
-
- ovlData->arrayObject[i]._nameOffset = *(int16 *) scriptPtr;
- scriptPtr += 2;
- flipShort(&ovlData->arrayObject[i]._nameOffset);
-
- ovlData->arrayObject[i]._numStates = *(int16 *) scriptPtr;
- scriptPtr += 2;
- flipShort(&ovlData->arrayObject[i]._numStates);
-
- ovlData->arrayObject[i]._varTableIdx = *(int16 *) scriptPtr;
- scriptPtr += 2;
- flipShort(&ovlData->arrayObject[i]._varTableIdx);
-
- ovlData->arrayObject[i]._firstStateIdx = *(int16 *) scriptPtr;
- scriptPtr += 2;
- flipShort(&ovlData->arrayObject[i]._firstStateIdx);
-
- ovlData->arrayObject[i]._stateTableIdx = *(int16 *) scriptPtr;
- scriptPtr += 2;
- flipShort(&ovlData->arrayObject[i]._stateTableIdx);
+ ovlData->arrayObject[i]._type = s.readUint16BE();
+ ovlData->arrayObject[i]._class = (eClass) s.readUint16BE();
+ ovlData->arrayObject[i]._nameOffset = s.readUint16BE();
+ ovlData->arrayObject[i]._numStates = s.readUint16BE();
+ ovlData->arrayObject[i]._varTableIdx = s.readUint16BE();
+ ovlData->arrayObject[i]._firstStateIdx = s.readUint16BE();
+ ovlData->arrayObject[i]._stateTableIdx = s.readUint16BE();
}
- // allocte states for object with multiple states
+ // allocate states for object with multiple states
if (scriptNotLoadedBefore) {
overlayTable[scriptIdx].state = stateID;
@@ -430,38 +415,30 @@ int loadOverlay(const char *scriptName) {
ovlData->arrayObjVar =
(objectParams *) mallocAndZero(ovlData->size9 *
sizeof(objectParams));
- memset(ovlData->arrayObjVar, 0,
- ovlData->size9 * sizeof(objectParams));
if (!ovlData->arrayObjVar) {
-/* releaseScript(scriptIdx,scriptName);
-
- if (freeIsNeeded) {
- freePtr(unpackedBuffer);
- } */
-
return (-2);
}
}
if (ovlData->size8) {
+ int i;
ovlData->arrayStates =
(objectParams *) mallocAndZero(ovlData->size8 *
sizeof(objectParams));
if (!ovlData->arrayStates) {
-/* releaseScript(scriptIdx,scriptName);
-
- if (freeIsNeeded) {
- freePtr(unpackedBuffer);
- } */
-
return (-2);
}
- memcpy(ovlData->arrayStates, scriptPtr, ovlData->size8 * 12); // TODO: made read item by item
- scriptPtr += ovlData->size8 * 12;
- flipGen(ovlData->arrayStates, ovlData->size8 * 12);
+ for (i = 0; i < ovlData->size8; i++) {
+ ovlData->arrayStates[i].X = s.readUint16BE();
+ ovlData->arrayStates[i].Y = s.readUint16BE();
+ ovlData->arrayStates[i].Z = s.readUint16BE();
+ ovlData->arrayStates[i].frame = s.readUint16BE();
+ ovlData->arrayStates[i].scale = s.readUint16BE();
+ ovlData->arrayStates[i].state = s.readUint16BE();
+ }
}
if (ovlData->numStrings) {
@@ -472,23 +449,15 @@ int loadOverlay(const char *scriptName) {
sizeof(stringEntryStruct));
for (i = 0; i < ovlData->numStrings; i++) {
- ovlData->stringTable[i].idx = *(int16 *) scriptPtr;
- flipShort(&ovlData->stringTable[i].idx);
- scriptPtr += 2;
+ ovlData->stringTable[i].idx = s.readUint16BE();
}
}
-/* if (freeIsNeeded) {
- freePtr(unpackedBuffer);
- } */
-
if (ovlData->sizeOfData4) {
ovlData->data4Ptr =
(uint8 *) mallocAndZero(ovlData->sizeOfData4);
- memset(ovlData->data4Ptr, 0, ovlData->sizeOfData4);
if (!ovlData->data4Ptr) {
- //releaseScript(scriptIdx,scriptName);
return (-2);
}
}
@@ -516,7 +485,7 @@ int loadOverlay(const char *scriptName) {
unpackedSize = volumePtrToFileDescriptor[fileIdx].extSize + 2;
// TODO: here, can unpack in gfx module buffer
- unpackedBuffer = (char *)mallocAndZero(unpackedSize);
+ unpackedBuffer = (byte *)mallocAndZero(unpackedSize);
if (!unpackedBuffer) {
return (-2);
@@ -538,12 +507,9 @@ int loadOverlay(const char *scriptName) {
loadPakedFileToMem(fileIdx, (uint8 *) unpackedBuffer);
}
- scriptPtr = unpackedBuffer;
-
- memcpy(&ovlData->specialString1Length, scriptPtr, 2);
- scriptPtr += 2;
- flipShort(&ovlData->specialString1Length); // recheck if needed
+ Common::MemoryReadStream s2(unpackedBuffer, unpackedSize);
+ ovlData->specialString1Length = s2.readUint16BE();
if (ovlData->specialString1Length) {
ovlData->nameVerbGlob = (char *) mallocAndZero(ovlData->specialString1Length);
@@ -558,15 +524,10 @@ int loadOverlay(const char *scriptName) {
return (-2);
}
- memcpy(ovlData->nameVerbGlob, scriptPtr,
- ovlData->specialString1Length);
- scriptPtr += ovlData->specialString1Length;
+ s2.read(ovlData->nameVerbGlob, ovlData->specialString1Length);
}
- memcpy(&ovlData->specialString2Length, scriptPtr, 2);
- scriptPtr += 2;
- flipShort(&ovlData->specialString2Length); // recheck if needed
-
+ ovlData->specialString2Length = s2.readUint16BE();
if (ovlData->specialString2Length) {
ovlData->arrayNameObj = (char *) mallocAndZero(ovlData->specialString2Length);
@@ -581,15 +542,11 @@ int loadOverlay(const char *scriptName) {
return (-2);
}
- memcpy(ovlData->arrayNameObj, scriptPtr,
- ovlData->specialString2Length);
- scriptPtr += ovlData->specialString2Length;
+ s2.read(ovlData->arrayNameObj, ovlData->specialString2Length);
}
for (i = 0; i < ovlData->numStrings; i++) {
- ovlData->stringTable[i].length = *(int16 *) scriptPtr;
- scriptPtr += 2;
- flipShort(&ovlData->stringTable[i].length);
+ ovlData->stringTable[i].length = s2.readUint16BE();
if (ovlData->stringTable[i].length) {
ovlData->stringTable[i].string =
@@ -607,8 +564,7 @@ int loadOverlay(const char *scriptName) {
return (-2);
}
- memcpy(ovlData->stringTable[i].string, scriptPtr, ovlData->stringTable[i].length);
- scriptPtr += ovlData->stringTable[i].length;
+ s2.read(ovlData->stringTable[i].string, ovlData->stringTable[i].length);
}
}
}
diff --git a/engines/cruise/overlay.h b/engines/cruise/overlay.h
index 7d8b2051e1..7ba90a1449 100644
--- a/engines/cruise/overlay.h
+++ b/engines/cruise/overlay.h
@@ -129,7 +129,7 @@ struct objectParams {
struct ovlDataStruct {
ovlData3Struct *arrayProc;
- uint8 *ptr1;
+ ovlData3Struct *ptr1;
objDataStruct *arrayObject;
objectParams *arrayStates;
objectParams *arrayObjVar;
diff --git a/engines/cruise/saveload.cpp b/engines/cruise/saveload.cpp
index 63edf7cb36..3d8321e420 100644
--- a/engines/cruise/saveload.cpp
+++ b/engines/cruise/saveload.cpp
@@ -465,8 +465,7 @@ void saveCT(Common::OutSaveFile& currentSaveFile) {
void loadSavegameDataSub6(Common::InSaveFile& currentSaveFile) {
int32 var;
- var = currentSaveFile.readUint32LE();
- flipLong(&var);
+ var = currentSaveFile.readUint32BE();
if (var) {
int i;
diff --git a/engines/cruise/vars.h b/engines/cruise/vars.h
index 5f65446cc5..692d1baeb6 100644
--- a/engines/cruise/vars.h
+++ b/engines/cruise/vars.h
@@ -91,8 +91,7 @@ struct dataFileName {
};
struct setHeaderEntry {
- int16 field_0; // offset ptr part 1
- int16 field_2; // offset ptr part 2
+ int32 field_0; // offset ptr
int16 width;
int16 height;
int16 type; // resource type, ie. sprites 0,1,4,5 and 8
diff --git a/engines/drascula/drascula.cpp b/engines/drascula/drascula.cpp
index c1449ea2c9..fce4fa73c6 100644
--- a/engines/drascula/drascula.cpp
+++ b/engines/drascula/drascula.cpp
@@ -55,7 +55,7 @@ static const GameSettings drasculaSettings[] = {
DrasculaEngine::DrasculaEngine(OSystem *syst, const DrasculaGameDescription *gameDesc) : Engine(syst), _gameDescription(gameDesc) {
// Setup mixer
- _mixer->setVolumeForSoundType(Audio::Mixer::kSFXSoundType, ConfMan.getInt("sfx_volume"));
+ _mixer->setVolumeForSoundType(Audio::Mixer::kSpeechSoundType, ConfMan.getInt("speech_volume"));
_mixer->setVolumeForSoundType(Audio::Mixer::kMusicSoundType, ConfMan.getInt("music_volume"));
_rnd = new Common::RandomSource();
@@ -220,7 +220,7 @@ int DrasculaEngine::go() {
allocMemory();
- withVoices = 0;
+ _subtitlesDisabled = !ConfMan.getBool("subtitles");
selectionMade = 0;
if (currentChapter != 3)
@@ -560,12 +560,16 @@ bool DrasculaEngine::runCurrentChapter() {
} else if (key == Common::KEYCODE_F8) {
selectVerb(0);
} else if (key == Common::KEYCODE_v) {
- withVoices = 1;
+ _subtitlesDisabled = true;
+ ConfMan.setBool("subtitles", !_subtitlesDisabled);
+
print_abc(_textsys[2], 96, 86);
updateScreen();
delay(1410);
} else if (key == Common::KEYCODE_t) {
- withVoices = 0;
+ _subtitlesDisabled = false;
+ ConfMan.setBool("subtitles", !_subtitlesDisabled);
+
print_abc(_textsys[3], 94, 86);
updateScreen();
delay(1460);
diff --git a/engines/drascula/drascula.h b/engines/drascula/drascula.h
index 3b499f27a0..4a00d35d10 100644
--- a/engines/drascula/drascula.h
+++ b/engines/drascula/drascula.h
@@ -380,7 +380,7 @@ public:
int _destX[40], _destY[40], trackCharacter_alkeva[40], roomExits[40];
int x1[40], y1[40], x2[40], y2[40];
int takeObject, pickedObject;
- int withVoices;
+ bool _subtitlesDisabled;
int menuBar, menuScreen, hasName;
char textName[20];
int curExcuseLook;
diff --git a/engines/drascula/sound.cpp b/engines/drascula/sound.cpp
index 6a3d83cae6..51517280ba 100644
--- a/engines/drascula/sound.cpp
+++ b/engines/drascula/sound.cpp
@@ -26,6 +26,7 @@
#include "sound/mixer.h"
#include "sound/voc.h"
#include "sound/audiocd.h"
+#include "common/config-manager.h"
#include "drascula/drascula.h"
@@ -52,7 +53,7 @@ void DrasculaEngine::volumeControls() {
for (;;) {
int masterVolume = CLIP((_mixer->getVolumeForSoundType(Audio::Mixer::kPlainSoundType) / 16), 0, 15);
- int voiceVolume = CLIP((_mixer->getVolumeForSoundType(Audio::Mixer::kSFXSoundType) / 16), 0, 15);
+ int voiceVolume = CLIP((_mixer->getVolumeForSoundType(Audio::Mixer::kSpeechSoundType) / 16), 0, 15);
int musicVolume = CLIP((_mixer->getVolumeForSoundType(Audio::Mixer::kMusicSoundType) / 16), 0, 15);
int masterVolumeY = 72 + 61 - masterVolume * 4;
@@ -82,7 +83,7 @@ void DrasculaEngine::volumeControls() {
}
if (mouseX > 136 && mouseX < 178) {
- updateVolume(Audio::Mixer::kSFXSoundType, voiceVolumeY);
+ updateVolume(Audio::Mixer::kSpeechSoundType, voiceVolumeY);
}
if (mouseX > 192 && mouseX < 233) {
@@ -173,7 +174,11 @@ void DrasculaEngine::playFile(const char *fname) {
_arj.read(soundData, soundSize);
_arj.close();
- _mixer->playRaw(Audio::Mixer::kSFXSoundType, &_soundHandle, soundData, soundSize - 64,
+ _subtitlesDisabled = !ConfMan.getBool("subtitles");
+ if (ConfMan.getBool("speech_mute"))
+ memset(soundData, 0x80, soundSize); // Mute speech but keep the pause
+
+ _mixer->playRaw(Audio::Mixer::kSpeechSoundType, &_soundHandle, soundData, soundSize - 64,
11025, Audio::Mixer::FLAG_AUTOFREE | Audio::Mixer::FLAG_UNSIGNED);
} else
warning("playFile: Could not open %s", fname);
diff --git a/engines/drascula/talk.cpp b/engines/drascula/talk.cpp
index 7bf55b7c40..4ecc3e20f2 100644
--- a/engines/drascula/talk.cpp
+++ b/engines/drascula/talk.cpp
@@ -82,7 +82,7 @@ void DrasculaEngine::talk_igor(int index, int talkerType) {
copyBackground(igorX + 17, igorY, igorX + 17, igorY, 37, 24, bgSurface, screenSurface);
copyRect(x_talk0[face], 148, igorX + 17, igorY, 25, 24, frontSurface, screenSurface);
updateRefresh();
- if (withVoices == 0)
+ if (!_subtitlesDisabled)
centerText(said, igorX + 26, igorY);
updateScreen();
pause(3);
@@ -95,13 +95,13 @@ void DrasculaEngine::talk_igor(int index, int talkerType) {
copyBackground(igorX, igorY, igorX, igorY, 29, 25, bgSurface, screenSurface);
copyRect(x_talk1[face], 173, igorX, igorY, 29, 25, frontSurface, screenSurface);
updateRefresh();
- if (withVoices == 0)
+ if (!_subtitlesDisabled)
centerText(said, igorX + 26, igorY);
updateScreen();
pause(3);
} else if (talkerType == kIgorDoor) {
updateRoom();
- if (withVoices == 0)
+ if (!_subtitlesDisabled)
centerText(said, 87, 66);
updateScreen();
} else if (talkerType == kIgorSeated || talkerType == kIgorWig) {
@@ -111,7 +111,7 @@ void DrasculaEngine::talk_igor(int index, int talkerType) {
copyBackground(x_talk4[face], 78, 199, 94, 38, 27, drawSurface3, screenSurface);
moveCharacters();
updateRefresh();
- if (withVoices == 0)
+ if (!_subtitlesDisabled)
centerText(said, 221, 102);
updateScreen();
@@ -166,7 +166,7 @@ void DrasculaEngine::talk_drascula(int index, int talkerType) {
updateRefresh();
- if (withVoices == 0)
+ if (!_subtitlesDisabled)
centerText(said, drasculaX + 19, drasculaY);
updateScreen();
@@ -211,7 +211,7 @@ void DrasculaEngine::talk_drascula_big(int index) {
if (l == 7)
l = 0;
- if (withVoices == 0)
+ if (!_subtitlesDisabled)
centerText(said, 191, 69);
updateScreen();
@@ -237,7 +237,7 @@ void DrasculaEngine::talk_solo(const char *said, const char *filename) {
copyBackground();
do {
- if (withVoices == 0) {
+ if (!_subtitlesDisabled) {
if (currentChapter == 1)
centerText(said, 156, 90);
else if (currentChapter == 6)
@@ -300,7 +300,7 @@ void DrasculaEngine::talk_bartender(int index, int talkerType) {
moveCharacters();
updateRefresh();
- if (withVoices == 0)
+ if (!_subtitlesDisabled)
centerText(said, 132, 45);
updateScreen();
@@ -339,7 +339,7 @@ void DrasculaEngine::talk_bj(int index) {
moveCharacters();
updateRefresh();
- if (withVoices == 0)
+ if (!_subtitlesDisabled)
centerText(said, bjX + 7, bjY);
updateScreen();
@@ -348,7 +348,7 @@ void DrasculaEngine::talk_bj(int index) {
} else {
updateRoom();
- if (withVoices == 0)
+ if (!_subtitlesDisabled)
centerText(said, 93, 80);
updateScreen();
@@ -463,7 +463,7 @@ void DrasculaEngine::talk(const char *said, const char *filename) {
updateRefresh();
}
- if (withVoices == 0)
+ if (!_subtitlesDisabled)
centerText(said, curX, curY);
updateScreen();
@@ -555,7 +555,7 @@ void DrasculaEngine::talk_vonBraun(int index, int talkerType) {
updateRefresh();
}
- if (withVoices == 0)
+ if (!_subtitlesDisabled)
centerText(said, vonBraunX, 66);
updateScreen();
@@ -563,7 +563,7 @@ void DrasculaEngine::talk_vonBraun(int index, int talkerType) {
} else {
updateRoom();
- if (withVoices == 0)
+ if (!_subtitlesDisabled)
centerText(said, 150, 80);
updateScreen();
@@ -617,7 +617,7 @@ void DrasculaEngine::talk_blind(int index) {
copyRect(bX, 2, 73, 1, 126, h, frontSurface, screenSurface);
}
- if (withVoices == 0)
+ if (!_subtitlesDisabled)
centerText(said, 260, 71);
updateScreen();
@@ -639,7 +639,7 @@ void DrasculaEngine::talk_hacker(int index) {
talkInit(filename);
do {
- if (withVoices == 0)
+ if (!_subtitlesDisabled)
centerText(said, 156, 170);
updateScreen();
} while (!isTalkFinished());
@@ -700,7 +700,7 @@ void DrasculaEngine::talk_pen(const char *said, const char *filename, int talker
updateRefresh();
- if (withVoices == 0) {
+ if (!_subtitlesDisabled) {
if (talkerType == 0)
centerText(said, 160, 105);
else
@@ -741,7 +741,7 @@ void DrasculaEngine::talk_bj_bed(int index) {
moveCharacters();
updateRefresh();
- if (withVoices == 0)
+ if (!_subtitlesDisabled)
centerText(said, 104, 102);
updateScreen();
@@ -777,7 +777,7 @@ void DrasculaEngine::talk_htel(int index) {
else
copyBackground(x_talk[face], 1, 45, 24, 92, 108, backSurface, screenSurface);
- if (withVoices == 0)
+ if (!_subtitlesDisabled)
centerText(said, 90, 50);
updateScreen();
@@ -857,7 +857,7 @@ void DrasculaEngine::talk_sync(const char *said, const char *filename, const cha
updateRefresh();
}
- if (withVoices == 0)
+ if (!_subtitlesDisabled)
centerText(said, curX, curY);
updateScreen();
@@ -890,7 +890,7 @@ void DrasculaEngine::talk_trunk(int index) {
flags[19] = face;
updateRoom();
- if (withVoices == 0)
+ if (!_subtitlesDisabled)
centerText(said, 263, 69);
updateScreen();
@@ -917,7 +917,7 @@ void DrasculaEngine::talk_generic(const char* said, const char* filename, int* f
moveCharacters();
updateRefresh();
- if (withVoices == 0)
+ if (!_subtitlesDisabled)
centerText(said, coords[5], coords[6]);
updateScreen();
@@ -938,7 +938,7 @@ void DrasculaEngine::grr() {
updateRoom();
copyBackground(253, 110, 150, 65, 20, 30, drawSurface3, screenSurface);
- if (withVoices == 0)
+ if (!_subtitlesDisabled)
centerText("groaaarrrrgghhhh!", 153, 65);
updateScreen();
diff --git a/engines/gob/detection.cpp b/engines/gob/detection.cpp
index 2b0c015677..c871bdb976 100644
--- a/engines/gob/detection.cpp
+++ b/engines/gob/detection.cpp
@@ -992,6 +992,19 @@ static const GOBGameDescription gameDescriptions[] = {
kFeaturesAdlib,
"intro"
},
+ { // Supplied by goodoldgeorg in bug report #2105220
+ {
+ "lostintime",
+ "",
+ AD_ENTRY1s("intro.stk", "cd322cb3c64ef2ba2f2134aa2122cfe9", 3936700),
+ ES_ESP,
+ kPlatformPC,
+ Common::ADGF_NO_FLAGS
+ },
+ kGameTypeLostInTime,
+ kFeaturesAdlib,
+ "intro"
+ },
{
{
"lostintime",
diff --git a/engines/made/screen.cpp b/engines/made/screen.cpp
index 0c22d40259..38a4baffc5 100644
--- a/engines/made/screen.cpp
+++ b/engines/made/screen.cpp
@@ -174,13 +174,15 @@ void Screen::drawSurface(Graphics::Surface *sourceSurface, int x, int y, int16 f
if (_vm->getGameID() != GID_RTZ)
maskp = (byte*)_maskDrawCtx.destSurface->getBasePtr(x, y);
- int32 sourcePitch, linePtrAdd;
+ int32 sourcePitch, linePtrAdd, sourceAdd;
byte *linePtr;
if (flipX) {
linePtrAdd = -1;
+ sourceAdd = sourceSurface->w;
} else {
linePtrAdd = 1;
+ sourceAdd = 0;
}
if (flipY) {
@@ -191,11 +193,7 @@ void Screen::drawSurface(Graphics::Surface *sourceSurface, int x, int y, int16 f
}
for (int16 yc = 0; yc < clipHeight; yc++) {
- if (flipX) {
- linePtr = source + sourceSurface->w;
- } else {
- linePtr = source;
- }
+ linePtr = source + sourceAdd;
for (int16 xc = 0; xc < clipWidth; xc++) {
if (*linePtr && (_vm->getGameID() == GID_RTZ || (mask == 0 || maskp[xc] == 0))) {
if (*linePtr)
@@ -688,7 +686,7 @@ void Screen::printText(const char *text) {
for (int textPos = 0; textPos < textLen; textPos++) {
- uint c = ((byte*)text)[textPos];
+ uint c = ((const byte*)text)[textPos];
int charWidth = _font->getCharWidth(c);
if (c == 9) {
@@ -806,7 +804,12 @@ void Screen::showWorkScreen() {
void Screen::updateScreenAndWait(int delay) {
_vm->_system->updateScreen();
- _vm->_system->delayMillis(delay);
+ uint32 startTime = _vm->_system->getMillis();
+ while (_vm->_system->getMillis() < startTime + delay) {
+ _vm->handleEvents();
+ _vm->_system->updateScreen();
+ _vm->_system->delayMillis(5);
+ }
}
int16 Screen::addToSpriteList(int16 index, int16 xofs, int16 yofs) {
diff --git a/engines/made/scriptfuncs.cpp b/engines/made/scriptfuncs.cpp
index d697e24b04..0051b80dae 100644
--- a/engines/made/scriptfuncs.cpp
+++ b/engines/made/scriptfuncs.cpp
@@ -571,7 +571,7 @@ int16 ScriptFunctions::sfGetCdTime(int16 argc, int16 *argv) {
// This one is called loads of times, so it has been commented out to reduce spam
//warning("Unimplemented opcode: sfGetCdTime");
// TODO
- return 0;
+ return 32000;
}
int16 ScriptFunctions::sfPlayCdSegment(int16 argc, int16 *argv) {
diff --git a/engines/parallaction/balloons.cpp b/engines/parallaction/balloons.cpp
index 290aa5e625..70c3d5789e 100644
--- a/engines/parallaction/balloons.cpp
+++ b/engines/parallaction/balloons.cpp
@@ -79,7 +79,7 @@ public:
token = tokenizer.nextToken();
token = expand(token);
- if (token == '/') {
+ if (token == "/") {
tokenWidth = 0;
action();
textNewLine();
diff --git a/engines/parallaction/saveload.cpp b/engines/parallaction/saveload.cpp
index 9a787d7f00..8093d4f234 100644
--- a/engines/parallaction/saveload.cpp
+++ b/engines/parallaction/saveload.cpp
@@ -266,8 +266,6 @@ SaveLoadChooser::SaveLoadChooser(const String &title, const String &buttonLabel)
_list->setEditable(true);
_list->setNumberingMode(GUI::kListNumberingOne);
- _container = new GUI::ContainerWidget(this, 0, 0, 10, 10);
-
_gfxWidget = new GUI::GraphicsWidget(this, 0, 0, 10, 10);
_date = new GUI::StaticTextWidget(this, 0, 0, 10, 10, "No date saved", GUI::kTextAlignCenter);
@@ -278,6 +276,9 @@ SaveLoadChooser::SaveLoadChooser(const String &title, const String &buttonLabel)
new GUI::ButtonWidget(this, "ScummSaveLoad.Cancel", "Cancel", GUI::kCloseCmd, 0);
_chooseButton = new GUI::ButtonWidget(this, "ScummSaveLoad.Choose", buttonLabel, kChooseCmd, 0);
_chooseButton->setEnabled(false);
+
+ _container = new GUI::ContainerWidget(this, 0, 0, 10, 10);
+// _container->setHints(GUI::THEME_HINT_USE_SHADOW);
}
SaveLoadChooser::~SaveLoadChooser() {
diff --git a/engines/saga/animation.cpp b/engines/saga/animation.cpp
index e9e146013f..493c05022c 100644
--- a/engines/saga/animation.cpp
+++ b/engines/saga/animation.cpp
@@ -579,6 +579,9 @@ void Anim::play(uint16 animId, int vectorTime, bool playing) {
_vm->_events->queue(&event);
}
return;
+ } else {
+ anim->currentFrame = 0;
+ anim->completed = 0;
}
}
diff --git a/engines/saga/displayinfo.h b/engines/saga/displayinfo.h
index 3775e904ff..c85b5b830f 100644
--- a/engines/saga/displayinfo.h
+++ b/engines/saga/displayinfo.h
@@ -64,7 +64,7 @@ struct GameDisplayInfo {
int saveReminderWidth;
int saveReminderHeight;
int saveReminderFirstSpriteNumber;
- int saveReminderSecondSpriteNumber;
+ int saveReminderNumSprites;
int leftPortraitXOffset;
int leftPortraitYOffset;
@@ -230,7 +230,8 @@ static const GameDisplayInfo ITE_DisplayInfo = {
15, // status BG color
308,137, // save reminder pos
12,12, // save reminder w & h
- 6,7, // save reminder sprite numbers
+ 6, // save reminder first sprite number
+ 2, // number of save reminder sprites
5, 4, // left portrait x, y offset
274, 4, // right portrait x, y offset
@@ -376,7 +377,8 @@ static const GameDisplayInfo IHNM_DisplayInfo = {
250, // status BG color
616, 304, // save reminder pos
24, 24, // save reminder w&h
- 0,1, // save reminder sprite numbers
+ 0, // save reminder first sprite number
+ 16, // number of save reminder sprites
11, 12, // left portrait x, y offset
-1, -1, // right portrait x, y offset
diff --git a/engines/saga/interface.cpp b/engines/saga/interface.cpp
index abf8094533..38d126c5d4 100644
--- a/engines/saga/interface.cpp
+++ b/engines/saga/interface.cpp
@@ -358,15 +358,12 @@ void Interface::saveReminderCallback(void *refCon) {
}
void Interface::updateSaveReminder() {
- // TODO: finish this
- /*
if (_active && _panelMode == kPanelMain) {
- _vm->_timer->removeTimerProc(&saveReminderCallback);
- _saveReminderState = (_saveReminderState == 0) ? 1 : 0;
+ _saveReminderState = _saveReminderState % _vm->getDisplayInfo().saveReminderNumSprites + 1;
drawStatusBar();
- _vm->_timer->installTimerProc(&saveReminderCallback, TIMETOSAVE, this);
+ _vm->_timer->removeTimerProc(&saveReminderCallback);
+ _vm->_timer->installTimerProc(&saveReminderCallback, ((_vm->getGameType() == GType_ITE) ? TIMETOBLINK_ITE : TIMETOBLINK_IHNM), this);
}
- */
}
int Interface::activate() {
@@ -423,7 +420,7 @@ void Interface::setMode(int mode) {
if (mode == kPanelMain) {
_inMainMode = true;
- _saveReminderState = 1; //TODO: blinking timeout
+ _saveReminderState = 1;
} else if (mode == kPanelChapterSelection) {
_saveReminderState = 1;
} else if (mode == kPanelNull) {
@@ -1420,6 +1417,10 @@ void Interface::setSave(PanelButton *panelButton) {
fileName = _vm->calcSaveFileName(_vm->getSaveFile(_optionSaveFileTitleNumber)->slotNumber);
_vm->save(fileName, _textInputString);
}
+ _vm->_timer->removeTimerProc(&saveReminderCallback);
+ _vm->_timer->installTimerProc(&saveReminderCallback, TIMETOSAVE, this);
+ setSaveReminderState(1);
+
_textInput = false;
setMode(kPanelOption);
break;
@@ -1925,7 +1926,7 @@ void Interface::drawStatusBar() {
rect.right = rect.left + _vm->getDisplayInfo().saveReminderWidth;
rect.bottom = rect.top + _vm->getDisplayInfo().saveReminderHeight;
_vm->_sprite->draw(backBuffer, _vm->getDisplayClip(), _vm->_sprite->_saveReminderSprites,
- _saveReminderState == 1 ? _vm->getDisplayInfo().saveReminderFirstSpriteNumber : _vm->getDisplayInfo().saveReminderSecondSpriteNumber,
+ _vm->getDisplayInfo().saveReminderFirstSpriteNumber + _saveReminderState - 1,
rect, 256);
}
diff --git a/engines/saga/interface.h b/engines/saga/interface.h
index 2091c9f071..46df12ed51 100644
--- a/engines/saga/interface.h
+++ b/engines/saga/interface.h
@@ -59,8 +59,9 @@ enum InterfaceUpdateFlags {
#define RID_IHNM_BOSS_SCREEN 19 // not in demo
#define RID_ITE_TYCHO_MAP 1686
#define RID_ITE_SPR_CROSSHAIR (73 + 9)
-#define TIMETOSAVE (kScriptTimeTicksPerSecond * 1000 * 60 * 30)
-#define TIMETOBLINK (kScriptTimeTicksPerSecond * 1000 * 1)
+#define TIMETOSAVE (1000000 * 60 * 30) // 30 minutes
+#define TIMETOBLINK_ITE (1000000 * 1)
+#define TIMETOBLINK_IHNM (1000000 / 10)
// Converse-specific stuff
diff --git a/engines/scumm/actor.cpp b/engines/scumm/actor.cpp
index df6660523a..b2bb8be9c9 100644
--- a/engines/scumm/actor.cpp
+++ b/engines/scumm/actor.cpp
@@ -50,9 +50,11 @@ Actor::Actor(ScummEngine *scumm, int id) :
assert(_vm != 0);
}
-void Actor::initActor(int mode) {
- // begin HE specific
+void ActorHE::initActor(int mode) {
+ Actor::initActor(mode);
+
if (mode == -1) {
+ _heOffsX = _heOffsY = 0;
_heSkipLimbs = false;
memset(_heTalkQueue, 0, sizeof(_heTalkQueue));
}
@@ -70,11 +72,18 @@ void Actor::initActor(int mode) {
_hePaletteNum = 0;
_heFlags = 0;
_heTalking = false;
- // end HE specific
+ if (_vm->_game.heversion >= 61)
+ _flip = 0;
+
+ _clipOverride = _vm->_actorClipOverride;
+
+ _auxBlock.reset();
+}
+
+void Actor::initActor(int mode) {
if (mode == -1) {
- _offsX = _offsY = 0;
_top = _bottom = 0;
_needRedraw = false;
_needBgReset = false;
@@ -132,9 +141,6 @@ void Actor::initActor(int mode) {
_forceClip = (_vm->_game.version >= 7) ? 100 : 0;
_ignoreTurns = false;
- if (_vm->_game.heversion >= 61)
- _flip = 0;
-
_talkFrequency = 256;
_talkPan = 64;
_talkVolume = 127;
@@ -148,10 +154,6 @@ void Actor::initActor(int mode) {
_walkScript = 0;
_talkScript = 0;
- _clipOverride = _vm->_actorClipOverride;
-
- _auxBlock.reset();
-
_vm->_classData[_number] = (_vm->_game.version >= 7) ? _vm->_classData[0] : 0;
}
@@ -879,9 +881,9 @@ void Actor::putActor(int dstX, int dstY, int newRoom) {
_vm->stopTalk();
}
- // WORKAROUND: The green transparency of the tank in the Hall of Oddities is
- // is positioned one pixel too far to the left. This appears to be a
- // bug in the original game as well.
+ // WORKAROUND: The green transparency of the tank in the Hall of Oddities
+ // is positioned one pixel too far to the left. This appears to be a bug
+ // in the original game as well.
if (_vm->_game.id == GID_SAMNMAX && newRoom == 16 && _number == 5 && dstX == 235 && dstY == 236)
dstX++;
@@ -904,7 +906,7 @@ void Actor::putActor(int dstX, int dstY, int newRoom) {
} else {
#ifdef ENABLE_HE
if (_vm->_game.heversion >= 71)
- ((ScummEngine_v71he *)_vm)->queueAuxBlock(this);
+ ((ScummEngine_v71he *)_vm)->queueAuxBlock((ActorHE *)this);
#endif
hideActor();
}
@@ -1208,6 +1210,10 @@ void Actor::hideActor() {
_cost.soundCounter = 0;
_needRedraw = false;
_needBgReset = true;
+}
+
+void ActorHE::hideActor() {
+ Actor::hideActor();
_auxBlock.reset();
}
@@ -1434,39 +1440,28 @@ void Actor::drawActorCostume(bool hitTestMode) {
}
setupActorScale();
+
+ BaseCostumeRenderer *bcr = _vm->_costumeRenderer;
+ prepareDrawActorCostume(bcr);
- BaseCostumeRenderer* bcr = _vm->_costumeRenderer;
-
- bcr->_actorID = _number;
-
- bcr->_actorX = _pos.x + _offsX;
- bcr->_actorY = _pos.y + _offsY - _elevation;
-
- if (_vm->_game.version <= 2) {
- bcr->_actorX *= V12_X_MULTIPLIER;
- bcr->_actorY *= V12_Y_MULTIPLIER;
+ // If the actor is partially hidden, redraw it next frame.
+ if (bcr->drawCostume(_vm->_virtscr[kMainVirtScreen], _vm->_gdi->_numStrips, this, _drawToBackBuf) & 1) {
+ _needRedraw = (_vm->_game.version <= 6);
}
- bcr->_actorX -= _vm->_virtscr[kMainVirtScreen].xstart;
- if (_vm->_game.platform == Common::kPlatformNES) {
- // In the NES version, when the actor is facing right,
- // we need to shift it 8 pixels to the left
- if (_facing == 90)
- bcr->_actorX -= 8;
- } else if (_vm->_game.version <= 2) {
- // HACK: We have to adjust the x position by one strip (8 pixels) in
- // V2 games. However, it is not quite clear to me why. And to fully
- // match the original, it seems we have to offset by 2 strips if the
- // actor is facing left (270 degree).
- // V1 games are once again slightly different, here we only have
- // to adjust the 270 degree case...
- if (_facing == 270)
- bcr->_actorX += 16;
- else if (_vm->_game.version == 2)
- bcr->_actorX += 8;
+ if (!hitTestMode) {
+ // Record the vertical extent of the drawn actor
+ _top = bcr->_draw_top;
+ _bottom = bcr->_draw_bottom;
}
+}
- bcr->_clipOverride = _clipOverride;
+
+void Actor::prepareDrawActorCostume(BaseCostumeRenderer *bcr) {
+
+ bcr->_actorID = _number;
+ bcr->_actorX = _pos.x - _vm->_virtscr[kMainVirtScreen].xstart;
+ bcr->_actorY = _pos.y - _elevation;
if (_vm->_game.version == 4 && (_boxscale & 0x8000)) {
bcr->_scaleX = bcr->_scaleY = _vm->getScaleFromSlot((_boxscale & 0x7fff) + 1, _pos.x, _pos.y);
@@ -1478,8 +1473,6 @@ void Actor::drawActorCostume(bool hitTestMode) {
bcr->_shadow_mode = _shadowMode;
if (_vm->_game.version >= 5 && _vm->_game.heversion == 0) {
bcr->_shadow_table = _vm->_shadowPalette;
- } else if (_vm->_game.heversion == 70) {
- bcr->_shadow_table = _vm->_HEV7ActorPalette;
}
bcr->setCostume(_costume, _heXmapNum);
@@ -1510,6 +1503,19 @@ void Actor::drawActorCostume(bool hitTestMode) {
bcr->_draw_top = 0x7fffffff;
bcr->_draw_bottom = 0;
+}
+
+void ActorHE::prepareDrawActorCostume(BaseCostumeRenderer *bcr) {
+ Actor::prepareDrawActorCostume(bcr);
+
+ bcr->_actorX += _heOffsX;
+ bcr->_actorY += _heOffsY;
+
+ bcr->_clipOverride = _clipOverride;
+
+ if (_vm->_game.heversion == 70) {
+ bcr->_shadow_table = _vm->_HEV7ActorPalette;
+ }
bcr->_skipLimbs = (_heSkipLimbs != 0);
bcr->_paletteNum = _hePaletteNum;
@@ -1530,16 +1536,36 @@ void Actor::drawActorCostume(bool hitTestMode) {
}
}
_heNoTalkAnimation = 0;
+}
- // If the actor is partially hidden, redraw it next frame.
- if (bcr->drawCostume(_vm->_virtscr[kMainVirtScreen], _vm->_gdi->_numStrips, this, _drawToBackBuf) & 1) {
- _needRedraw = (_vm->_game.version <= 6);
+void Actor_v2::prepareDrawActorCostume(BaseCostumeRenderer *bcr) {
+ Actor::prepareDrawActorCostume(bcr);
+
+ bcr->_actorX = _pos.x;
+ bcr->_actorY = _pos.y - _elevation;
+
+ if (_vm->_game.version <= 2) {
+ bcr->_actorX *= V12_X_MULTIPLIER;
+ bcr->_actorY *= V12_Y_MULTIPLIER;
}
+ bcr->_actorX -= _vm->_virtscr[kMainVirtScreen].xstart;
- if (!hitTestMode) {
- // Record the vertical extent of the drawn actor
- _top = bcr->_draw_top;
- _bottom = bcr->_draw_bottom;
+ if (_vm->_game.platform == Common::kPlatformNES) {
+ // In the NES version, when the actor is facing right,
+ // we need to shift it 8 pixels to the left
+ if (_facing == 90)
+ bcr->_actorX -= 8;
+ } else if (_vm->_game.version <= 2) {
+ // HACK: We have to adjust the x position by one strip (8 pixels) in
+ // V2 games. However, it is not quite clear to me why. And to fully
+ // match the original, it seems we have to offset by 2 strips if the
+ // actor is facing left (270 degree).
+ // V1 games are once again slightly different, here we only have
+ // to adjust the 270 degree case...
+ if (_facing == 270)
+ bcr->_actorX += 16;
+ else if (_vm->_game.version == 2)
+ bcr->_actorX += 8;
}
}
@@ -1611,13 +1637,15 @@ void Actor::startAnimActor(int f) {
if (isInCurrentRoom() && _costume != 0) {
_animProgress = 0;
- _cost.animCounter = 0;
_needRedraw = true;
+ _cost.animCounter = 0;
// V1 - V2 games don't seem to need a _cost.reset() at this point.
// Causes Zak to lose his body in several scenes, see bug #771508
if (_vm->_game.version >= 3 && f == _initFrame) {
_cost.reset();
- _auxBlock.reset();
+ if (_vm->_game.heversion != 0) {
+ ((ActorHE *)this)->_auxBlock.reset();
+ }
}
_vm->_costumeLoader->costumeDecodeData(this, f, (uint) - 1);
_frame = f;
@@ -1758,7 +1786,7 @@ void ScummEngine::resetActorBgs() {
clearGfxUsageBit(strip, USAGE_BIT_DIRTY);
clearGfxUsageBit(strip, USAGE_BIT_RESTORED);
for (j = 1; j < _numActors; j++) {
- if (_actors[j]->_heFlags & 1)
+ if (_game.heversion != 0 && ((ActorHE *)_actors[j])->_heFlags & 1)
continue;
if (testGfxUsageBit(strip, j) &&
@@ -1776,7 +1804,7 @@ void ScummEngine::resetActorBgs() {
}
// HE specific
-void Actor::drawActorToBackBuf(int x, int y) {
+void ActorHE::drawActorToBackBuf(int x, int y) {
int curTop = _top;
int curBottom = _bottom;
@@ -1936,7 +1964,8 @@ void ScummEngine::actorTalk(const byte *msg) {
stopTalk();
}
setTalkingActor(a->_number);
- a->_heTalking = true;
+ if (_game.heversion != 0)
+ ((ActorHE *)a)->_heTalking = true;
if (!_string[0].no_talk_anim) {
a->runActorTalkScript(a->_talkStartFrame);
_useTalkAnims = true;
@@ -2009,7 +2038,8 @@ void ScummEngine::stopTalk() {
}
if (_game.version <= 7 && _game.heversion == 0)
setTalkingActor(0xFF);
- a->_heTalking = false;
+ if (_game.heversion != 0)
+ ((ActorHE *)a)->_heTalking = false;
}
if (_game.id == GID_DIG || _game.id == GID_CMI) {
@@ -2035,9 +2065,7 @@ void ScummEngine::stopTalk() {
#pragma mark -
-void Actor::setActorCostume(int c) {
- int i;
-
+void ActorHE::setActorCostume(int c) {
if (_vm->_game.heversion >= 61 && (c == -1 || c == -2)) {
_heSkipLimbs = (c == -1);
_needRedraw = true;
@@ -2049,27 +2077,43 @@ void Actor::setActorCostume(int c) {
if (_vm->_game.heversion == 61)
c &= 0xff;
- _costumeNeedsInit = true;
-
if (_vm->_game.features & GF_NEW_COSTUMES) {
- memset(_animVariable, 0, sizeof(_animVariable));
-
#ifdef ENABLE_HE
if (_vm->_game.heversion >= 71)
((ScummEngine_v71he *)_vm)->queueAuxBlock(this);
#endif
+ _auxBlock.reset();
+ if (_visible) {
+ if (_vm->_game.heversion >= 60)
+ _needRedraw = true;
+ }
+ }
+
+ Actor::setActorCostume(c);
+
+ if (_vm->_game.heversion >= 71 && _vm->getTalkingActor() == _number) {
+ if (_vm->_game.heversion <= 95 || (_vm->_game.heversion >= 98 && _vm->VAR(_vm->VAR_SKIP_RESET_TALK_ACTOR) == 0)) {
+ _vm->setTalkingActor(0);
+ }
+ }
+}
+
+void Actor::setActorCostume(int c) {
+ int i;
+
+ _costumeNeedsInit = true;
+
+ if (_vm->_game.features & GF_NEW_COSTUMES) {
+ memset(_animVariable, 0, sizeof(_animVariable));
_costume = c;
_cost.reset();
- _auxBlock.reset();
if (_visible) {
if (_costume) {
_vm->ensureResourceLoaded(rtCostume, _costume);
}
startAnimActor(_initFrame);
- if (_vm->_game.heversion >= 60)
- _needRedraw = true;
}
} else {
if (_visible) {
@@ -2104,12 +2148,6 @@ void Actor::setActorCostume(int c) {
for (i = 0; i < 32; i++)
_palette[i] = 0xFF;
}
-
- if (_vm->_game.heversion >= 71 && _vm->getTalkingActor() == _number) {
- if (_vm->_game.heversion <= 95 || (_vm->_game.heversion >= 98 && _vm->VAR(_vm->VAR_SKIP_RESET_TALK_ACTOR) == 0)) {
- _vm->setTalkingActor(0);
- }
- }
}
static const char* v0ActorNames[7] = {
@@ -2245,7 +2283,7 @@ bool Actor_v2::isPlayer() {
return _vm->VAR(42) <= _number && _number <= _vm->VAR(43);
}
-void Actor::setHEFlag(int bit, int set) {
+void ActorHE::setHEFlag(int bit, int set) {
// Note that condition is inverted
if (!set) {
_heFlags |= bit;
@@ -2254,7 +2292,7 @@ void Actor::setHEFlag(int bit, int set) {
}
}
-void Actor::setUserCondition(int slot, int set) {
+void ActorHE::setUserCondition(int slot, int set) {
const int condMaskCode = (_vm->_game.heversion >= 85) ? 0x1FFF : 0x3FF;
assertRange(1, slot, 32, "setUserCondition: Condition");
if (set == 0) {
@@ -2269,12 +2307,12 @@ void Actor::setUserCondition(int slot, int set) {
}
}
-bool Actor::isUserConditionSet(int slot) const {
+bool ActorHE::isUserConditionSet(int slot) const {
assertRange(1, slot, 32, "isUserConditionSet: Condition");
return (_heCondMask & (1 << (slot + 0xF))) != 0;
}
-void Actor::setTalkCondition(int slot) {
+void ActorHE::setTalkCondition(int slot) {
const int condMaskCode = (_vm->_game.heversion >= 85) ? 0x1FFF : 0x3FF;
assertRange(1, slot, 32, "setTalkCondition: Condition");
_heCondMask = (_heCondMask & ~condMaskCode) | 1;
@@ -2288,7 +2326,7 @@ void Actor::setTalkCondition(int slot) {
}
}
-bool Actor::isTalkConditionSet(int slot) const {
+bool ActorHE::isTalkConditionSet(int slot) const {
assertRange(1, slot, 32, "isTalkConditionSet: Condition");
return (_heCondMask & (1 << (slot - 1))) != 0;
}
@@ -2311,10 +2349,10 @@ void ScummEngine_v71he::postProcessAuxQueue() {
for (int i = 0; i < _auxEntriesNum; ++i) {
AuxEntry *ae = &_auxEntries[i];
if (ae->actorNum != -1) {
- Actor *a = derefActor(ae->actorNum, "postProcessAuxQueue");
+ ActorHE *a = (ActorHE *)derefActor(ae->actorNum, "postProcessAuxQueue");
const uint8 *cost = getResourceAddress(rtCostume, a->_costume);
- int dy = a->_offsY + a->getPos().y;
- int dx = a->_offsX + a->getPos().x;
+ int dy = a->_heOffsY + a->getPos().y;
+ int dx = a->_heOffsX + a->getPos().x;
if (_game.heversion >= 72)
dy -= a->getElevation();
@@ -2378,7 +2416,7 @@ void ScummEngine_v71he::postProcessAuxQueue() {
_auxEntriesNum = 0;
}
-void ScummEngine_v71he::queueAuxBlock(Actor *a) {
+void ScummEngine_v71he::queueAuxBlock(ActorHE *a) {
if (!a->_auxBlock.visible)
return;
@@ -2401,8 +2439,8 @@ void Actor::saveLoadWithSerializer(Serializer *ser) {
static const SaveLoadEntry actorEntries[] = {
MKLINE(Actor, _pos.x, sleInt16, VER(8)),
MKLINE(Actor, _pos.y, sleInt16, VER(8)),
- MKLINE(Actor, _offsX, sleInt16, VER(32)),
- MKLINE(Actor, _offsY, sleInt16, VER(32)),
+ MKLINE(Actor, _heOffsX, sleInt16, VER(32)),
+ MKLINE(Actor, _heOffsY, sleInt16, VER(32)),
MKLINE(Actor, _top, sleInt16, VER(8)),
MKLINE(Actor, _bottom, sleInt16, VER(8)),
MKLINE(Actor, _elevation, sleInt16, VER(8)),
diff --git a/engines/scumm/actor.h b/engines/scumm/actor.h
index 30dc7789d6..3e8fe6626b 100644
--- a/engines/scumm/actor.h
+++ b/engines/scumm/actor.h
@@ -61,6 +61,7 @@ struct CostumeData {
uint16 end[16];
uint16 frame[16];
+ /* HE specific */
uint16 heJumpOffsetTable[16];
uint16 heJumpCountTable[16];
uint32 heCondMaskTable[16];
@@ -95,10 +96,6 @@ protected:
Common::Point _pos;
public:
- /** HE specific: This rect is used to clip actor drawing. */
- Common::Rect _clipOverride;
-
- int _offsX, _offsY;
int _top, _bottom;
uint _width;
byte _number;
@@ -137,22 +134,11 @@ public:
CostumeData _cost;
/* HE specific */
- bool _heNoTalkAnimation;
+ int _heOffsX, _heOffsY;
bool _heSkipLimbs;
- bool _heTalking;
uint32 _heCondMask;
uint32 _hePaletteNum;
uint32 _heXmapNum;
- byte _heFlags;
-
- AuxBlock _auxBlock;
-
- struct {
- int16 posX;
- int16 posY;
- int16 color;
- byte sentence[128];
- } _heTalkQueue[16];
protected:
struct ActorWalkData {
@@ -187,7 +173,7 @@ public:
virtual ~Actor() {}
//protected:
- void hideActor();
+ virtual void hideActor();
void showActor();
virtual void initActor(int mode);
@@ -223,10 +209,10 @@ public:
void faceToObject(int obj);
void turnToDirection(int newdir);
virtual void walkActor();
- void drawActorToBackBuf(int x, int y);
void drawActorCostume(bool hitTestMode = false);
+ virtual void prepareDrawActorCostume(BaseCostumeRenderer *bcr);
void animateCostume();
- void setActorCostume(int c);
+ virtual void setActorCostume(int c);
void animateLimb(int limb, int f);
@@ -317,6 +303,27 @@ public:
void classChanged(int cls, bool value);
+ // Used by the save/load system:
+ void saveLoadWithSerializer(Serializer *ser);
+
+protected:
+ bool isInClass(int cls);
+
+ virtual bool isPlayer();
+
+ bool findPathTowards(byte box, byte box2, byte box3, Common::Point &foundPath);
+};
+
+class ActorHE : public Actor {
+public:
+ ActorHE(ScummEngine *scumm, int id) : Actor(scumm, id) {}
+
+ virtual void initActor(int mode);
+
+ virtual void hideActor();
+
+ void drawActorToBackBuf(int x, int y);
+
void setHEFlag(int bit, int set);
void setUserCondition(int slot, int set);
@@ -325,15 +332,26 @@ public:
void setTalkCondition(int slot);
bool isTalkConditionSet(int slot) const;
- // Used by the save/load system:
- void saveLoadWithSerializer(Serializer *ser);
+public:
+ /** This rect is used to clip actor drawing. */
+ Common::Rect _clipOverride;
-protected:
- bool isInClass(int cls);
+ bool _heNoTalkAnimation;
+ bool _heTalking;
+ byte _heFlags;
- virtual bool isPlayer();
+ AuxBlock _auxBlock;
- bool findPathTowards(byte box, byte box2, byte box3, Common::Point &foundPath);
+ struct {
+ int16 posX;
+ int16 posY;
+ int16 color;
+ byte sentence[128];
+ } _heTalkQueue[16];
+
+
+ virtual void prepareDrawActorCostume(BaseCostumeRenderer *bcr);
+ virtual void setActorCostume(int c);
};
class Actor_v3 : public Actor {
@@ -357,6 +375,7 @@ public:
protected:
virtual bool isPlayer();
+ virtual void prepareDrawActorCostume(BaseCostumeRenderer *bcr);
};
class ActorC64 : public Actor_v2 {
diff --git a/engines/scumm/akos.cpp b/engines/scumm/akos.cpp
index 8e8fff938d..19c7c3320b 100644
--- a/engines/scumm/akos.cpp
+++ b/engines/scumm/akos.cpp
@@ -1664,28 +1664,28 @@ bool ScummEngine_v6::akos_increaseAnim(Actor *a, int chan, const byte *aksq, con
akos_queCommand(9, a, a->_sound[a->getAnimVar(GB(2))], 0);
continue;
case AKC_C045:
- a->setUserCondition(GB(3), a->getAnimVar(GB(4)));
+ ((ActorHE *)a)->setUserCondition(GB(3), a->getAnimVar(GB(4)));
continue;
case AKC_C046:
- a->setAnimVar(GB(4), a->isUserConditionSet(GB(3)));
+ a->setAnimVar(GB(4), ((ActorHE *)a)->isUserConditionSet(GB(3)));
continue;
case AKC_C047:
- a->setTalkCondition(GB(3));
+ ((ActorHE *)a)->setTalkCondition(GB(3));
continue;
case AKC_C048:
- a->setAnimVar(GB(4), a->isTalkConditionSet(GB(3)));
+ a->setAnimVar(GB(4), ((ActorHE *)a)->isTalkConditionSet(GB(3)));
continue;
case AKC_C0A0:
akos_queCommand(8, a, GB(2), 0);
continue;
case AKC_C0A1:
- if (a->_heTalking != 0) {
+ if (((ActorHE *)a)->_heTalking != 0) {
curpos = GUW(2);
break;
}
continue;
case AKC_C0A2:
- if (a->_heTalking == 0) {
+ if (((ActorHE *)a)->_heTalking == 0) {
curpos = GUW(2);
break;
}
@@ -1763,8 +1763,8 @@ void ScummEngine_v6::akos_processQueue() {
a->_forceClip = param_1;
break;
case 6:
- a->_offsX = param_1;
- a->_offsY = param_2;
+ a->_heOffsX = param_1;
+ a->_heOffsY = param_2;
break;
case 7:
#ifdef ENABLE_HE
@@ -1775,13 +1775,13 @@ void ScummEngine_v6::akos_processQueue() {
case 8:
_actorToPrintStrFor = a->_number;
- a->_talkPosX = a->_heTalkQueue[param_1].posX;
- a->_talkPosY = a->_heTalkQueue[param_1].posY;
- a->_talkColor = a->_heTalkQueue[param_1].color;
+ a->_talkPosX = ((ActorHE *)a)->_heTalkQueue[param_1].posX;
+ a->_talkPosY = ((ActorHE *)a)->_heTalkQueue[param_1].posY;
+ a->_talkColor = ((ActorHE *)a)->_heTalkQueue[param_1].color;
_string[0].loadDefault();
_string[0].color = a->_talkColor;
- actorTalk(a->_heTalkQueue[param_1].sentence);
+ actorTalk(((ActorHE *)a)->_heTalkQueue[param_1].sentence);
break;
case 9:
@@ -1825,8 +1825,8 @@ void ScummEngine_v7::akos_processQueue() {
a->_forceClip = param_1;
break;
case 6:
- a->_offsX = param_1;
- a->_offsY = param_2;
+ a->_heOffsX = param_1;
+ a->_heOffsY = param_2;
break;
case 7:
if (param_1 != 0) {
diff --git a/engines/scumm/charset-fontdata.cpp b/engines/scumm/charset-fontdata.cpp
index 6a45d53139..e9a496f6ed 100644
--- a/engines/scumm/charset-fontdata.cpp
+++ b/engines/scumm/charset-fontdata.cpp
@@ -1070,6 +1070,7 @@ CharsetRendererV2::CharsetRendererV2(ScummEngine *vm, Common::Language language)
: CharsetRendererV3(vm) {
_fontHeight = 8;
+ _curId = 0;
switch (language) {
case Common::DE_DEU:
diff --git a/engines/scumm/detection.cpp b/engines/scumm/detection.cpp
index d3397fe208..b14f51cb14 100644
--- a/engines/scumm/detection.cpp
+++ b/engines/scumm/detection.cpp
@@ -25,6 +25,7 @@
#include "base/plugins.h"
+#include "common/archive.h"
#include "common/config-manager.h"
#include "common/fs.h"
#include "common/list.h"
@@ -211,9 +212,11 @@ static Common::Language detectLanguage(const Common::FSList &fslist, byte id) {
// ever determine that this is insufficient, we can still
// switch to MD5 based detection).
const char *filename = (id == GID_CMI) ? "LANGUAGE.TAB" : "LANGUAGE.BND";
- Common::File tmp;
+ Common::FilePtr tmp;
Common::FilesystemNode langFile;
- if (!searchFSNode(fslist, filename, langFile) || !tmp.open(langFile)) {
+ if (searchFSNode(fslist, filename, langFile))
+ tmp = Common::FilePtr(langFile.openForReading());
+ if (!tmp) {
// try loading in RESOURCE sub dir...
Common::FilesystemNode resDir;
Common::FSList tmpList;
@@ -221,11 +224,11 @@ static Common::Language detectLanguage(const Common::FSList &fslist, byte id) {
&& resDir.isDirectory()
&& resDir.getChildren(tmpList, Common::FilesystemNode::kListFilesOnly)
&& searchFSNode(tmpList, filename, langFile)) {
- tmp.open(langFile);
+ tmp = Common::FilePtr(langFile.openForReading());
}
}
- if (tmp.isOpen()) {
- uint size = tmp.size();
+ if (tmp) {
+ uint size = tmp->size();
if (id == GID_CMI) {
switch (size) {
case 439080: // 2daf3db71d23d99d19fc9a544fcf6431
@@ -450,8 +453,8 @@ static bool testGame(const GameSettings *g, const DescMap &fileMD5Map, const Com
// To do this, we take a close look at the detection file and
// try to filter out some cases.
- Common::File tmp;
- if (!tmp.open(d.node)) {
+ Common::FilePtr tmp(d.node.openForReading());
+ if (!tmp) {
warning("SCUMM testGame: failed to open '%s' for read access", d.node.getPath().c_str());
return false;
}
@@ -465,7 +468,7 @@ static bool testGame(const GameSettings *g, const DescMap &fileMD5Map, const Com
// Read a few bytes to narrow down the game.
byte buf[6];
- tmp.read(buf, 6);
+ tmp->read(buf, 6);
if (buf[0] == 0xbc && buf[1] == 0xb9) {
// The NES version of MM
diff --git a/engines/scumm/detection_tables.h b/engines/scumm/detection_tables.h
index d281364a77..8d70afecf2 100644
--- a/engines/scumm/detection_tables.h
+++ b/engines/scumm/detection_tables.h
@@ -713,6 +713,7 @@ static const GameFilenamePattern gameFilenamesTable[] = {
{ "puttrace", "racedemo", kGenHEPC, UNK_LANG, UNK, 0 },
{ "puttrace", "RaceDemo", kGenHEMac, UNK_LANG, Common::kPlatformMacintosh, 0 },
{ "puttrace", "Rennen", kGenHEPC, Common::DE_DEU, UNK, 0 },
+ { "puttrace", "PouceCourse", kGenHEPC, Common::FR_FRA, UNK, 0 },
{ "puttrace", "Putt500", kGenHEPC, Common::NL_NLD, UNK, 0 },
{ "puttrace", "Putt500", kGenHEMac, Common::NL_NLD, Common::kPlatformMacintosh, 0 },
{ "puttrace", "Putt500 demo", kGenHEMac, Common::NL_NLD, Common::kPlatformMacintosh, 0 },
diff --git a/engines/scumm/dialogs.cpp b/engines/scumm/dialogs.cpp
index ee1c0abf1c..382a0a9338 100644
--- a/engines/scumm/dialogs.cpp
+++ b/engines/scumm/dialogs.cpp
@@ -244,7 +244,10 @@ SaveLoadChooser::SaveLoadChooser(const String &title, const String &buttonLabel,
_list->setEditable(saveMode);
_list->setNumberingMode(saveMode ? GUI::kListNumberingOne : GUI::kListNumberingZero);
- _container = new GUI::ContainerWidget(this, 0, 0, 10, 10);
+// Tanoku: SVNMerge removed this. Unconvinient. ///////////////
+// _container = new GUI::ContainerWidget(this, 0, 0, 10, 10);
+///////////////////////////////////////////////////////////////
+
_gfxWidget = new GUI::GraphicsWidget(this, 0, 0, 10, 10);
_date = new StaticTextWidget(this, 0, 0, 10, 10, "No date saved", kTextAlignCenter);
@@ -255,6 +258,9 @@ SaveLoadChooser::SaveLoadChooser(const String &title, const String &buttonLabel,
new GUI::ButtonWidget(this, "ScummSaveLoad.Cancel", "Cancel", kCloseCmd, 0);
_chooseButton = new GUI::ButtonWidget(this, "ScummSaveLoad.Choose", buttonLabel, kChooseCmd, 0);
_chooseButton->setEnabled(false);
+
+ _container = new GUI::ContainerWidget(this, 0, 0, 10, 10);
+// _container->setHints(GUI::THEME_HINT_USE_SHADOW);
}
SaveLoadChooser::~SaveLoadChooser() {
diff --git a/engines/scumm/file.cpp b/engines/scumm/file.cpp
index f258ddd420..38c7a1a180 100644
--- a/engines/scumm/file.cpp
+++ b/engines/scumm/file.cpp
@@ -125,15 +125,15 @@ bool ScummFile::openSubFile(const Common::String &filename) {
}
-bool ScummFile::eos() {
+bool ScummFile::eos() const {
return _subFileLen ? (pos() >= _subFileLen) : File::eos(); // FIXME
}
-int32 ScummFile::pos() {
+int32 ScummFile::pos() const {
return File::pos() - _subFileStart;
}
-int32 ScummFile::size() {
+int32 ScummFile::size() const {
return _subFileLen ? _subFileLen : File::size();
}
diff --git a/engines/scumm/file.h b/engines/scumm/file.h
index 336f3cde12..e0ba7badff 100644
--- a/engines/scumm/file.h
+++ b/engines/scumm/file.h
@@ -39,9 +39,9 @@ public:
virtual bool open(const Common::String &filename) = 0;
virtual bool openSubFile(const Common::String &filename) = 0;
- virtual bool eos() = 0;
- virtual int32 pos() = 0;
- virtual int32 size() = 0;
+ virtual bool eos() const = 0;
+ virtual int32 pos() const = 0;
+ virtual int32 size() const = 0;
virtual bool seek(int32 offs, int whence = SEEK_SET) = 0;
virtual uint32 read(void *dataPtr, uint32 dataSize) = 0;
};
@@ -66,9 +66,9 @@ public:
bool ioFailed() const { return _myIoFailed || BaseScummFile::ioFailed(); }
void clearIOFailed() { _myIoFailed = false; BaseScummFile::clearIOFailed(); }
- bool eos();
- int32 pos();
- int32 size();
+ bool eos() const;
+ int32 pos() const;
+ int32 size() const;
bool seek(int32 offs, int whence = SEEK_SET);
uint32 read(void *dataPtr, uint32 dataSize);
};
@@ -111,9 +111,9 @@ public:
bool openSubFile(const Common::String &filename);
void close();
- bool eos() { return _stream->eos(); }
- int32 pos() { return _stream->pos(); }
- int32 size() { return _stream->size(); }
+ bool eos() const { return _stream->eos(); }
+ int32 pos() const { return _stream->pos(); }
+ int32 size() const { return _stream->size(); }
bool seek(int32 offs, int whence = SEEK_SET) { return _stream->seek(offs, whence); }
uint32 read(void *dataPtr, uint32 dataSize) { return _stream->read(dataPtr, dataSize); }
};
diff --git a/engines/scumm/file_nes.h b/engines/scumm/file_nes.h
index f1a07f8085..0a26ed9027 100644
--- a/engines/scumm/file_nes.h
+++ b/engines/scumm/file_nes.h
@@ -68,9 +68,9 @@ public:
bool openSubFile(const Common::String &filename);
void close();
- bool eos() { return _stream->eos(); }
- int32 pos() { return _stream->pos(); }
- int32 size() { return _stream->size(); }
+ bool eos() const { return _stream->eos(); }
+ int32 pos() const { return _stream->pos(); }
+ int32 size() const { return _stream->size(); }
bool seek(int32 offs, int whence = SEEK_SET) { return _stream->seek(offs, whence); }
uint32 read(void *dataPtr, uint32 dataSize) { return _stream->read(dataPtr, dataSize); }
};
diff --git a/engines/scumm/gfx.cpp b/engines/scumm/gfx.cpp
index 45b078b6f9..4e8c22479d 100644
--- a/engines/scumm/gfx.cpp
+++ b/engines/scumm/gfx.cpp
@@ -22,7 +22,6 @@
*
*/
-
#include "common/system.h"
#include "scumm/scumm.h"
#include "scumm/actor.h"
@@ -577,15 +576,12 @@ void ScummEngine::drawStripToScreen(VirtScreen *vs, int x, int width, int top, i
const byte *src = vs->getPixels(x, top);
int m = _textSurfaceMultiplier;
- byte *dst;
int vsPitch;
int pitch = vs->pitch;
if (_useCJKMode && _textSurfaceMultiplier == 2) {
- dst = _fmtownsBuf;
-
- scale2x(dst, _screenWidth * m, src, vs->pitch, width, height);
- src = dst;
+ scale2x(_fmtownsBuf, _screenWidth * m, src, vs->pitch, width, height);
+ src = _fmtownsBuf;
vsPitch = _screenWidth * m - width * m;
@@ -593,7 +589,6 @@ void ScummEngine::drawStripToScreen(VirtScreen *vs, int x, int width, int top, i
vsPitch = vs->pitch - width;
}
- dst = _compositeBuf;
if (_game.version < 7) {
// For The Dig, FT and COMI, we just blit everything to the screen at once.
@@ -613,12 +608,12 @@ void ScummEngine::drawStripToScreen(VirtScreen *vs, int x, int width, int top, i
// Compose the text over the game graphics
#ifdef USE_ARM_GFX_ASM
- asmDrawStripToScreen(height, width, text, src, dst, vs->pitch, width, _textSurface.pitch);
+ asmDrawStripToScreen(height, width, text, src, _compositeBuf, vs->pitch, width, _textSurface.pitch);
#else
// We blit four pixels at a time, for improved performance.
const uint32 *src32 = (const uint32 *)src;
const uint32 *text32 = (const uint32 *)text;
- uint32 *dst32 = (uint32 *)dst;
+ uint32 *dst32 = (uint32 *)_compositeBuf;
vsPitch >>= 2;
const int textPitch = (_textSurface.pitch - width * m) >> 2;
diff --git a/engines/scumm/he/intern_he.h b/engines/scumm/he/intern_he.h
index 72ba7edb85..8fd9122503 100644
--- a/engines/scumm/he/intern_he.h
+++ b/engines/scumm/he/intern_he.h
@@ -39,6 +39,7 @@ class WriteStream;
namespace Scumm {
+class ActorHE;
class ResExtractor;
#ifdef ENABLE_HE
class LogicHE;
@@ -243,7 +244,7 @@ public:
AuxEntry _auxEntries[16];
uint16 _auxEntriesNum;
- void queueAuxBlock(Actor *a);
+ void queueAuxBlock(ActorHE *a);
void queueAuxEntry(int actorNum, int subIndex);
void remapHEPalette(const uint8 *src, uint8 *dst);
diff --git a/engines/scumm/he/resource_he.cpp b/engines/scumm/he/resource_he.cpp
index f8fb1efca2..4f74a74b89 100644
--- a/engines/scumm/he/resource_he.cpp
+++ b/engines/scumm/he/resource_he.cpp
@@ -165,7 +165,6 @@ int Win32ResExtractor::extractResource_(const char *resType, char *resName, byte
_fileName = _vm->generateFilename(-3);
}
-
/* get file size */
fi.file->open(_fileName);
if (!fi.file->isOpen()) {
@@ -174,18 +173,18 @@ int Win32ResExtractor::extractResource_(const char *resType, char *resName, byte
fi.total_size = fi.file->size();
if (fi.total_size == -1) {
- error("Cannot get size of file %s", fi.file->name());
+ error("Cannot get size of file %s", _fileName.c_str());
goto cleanup;
}
if (fi.total_size == 0) {
- error("%s: file has a size of 0", fi.file->name());
+ error("%s: file has a size of 0", _fileName.c_str());
goto cleanup;
}
/* read all of file */
fi.memory = (byte *)malloc(fi.total_size);
if (fi.file->read(fi.memory, fi.total_size) == 0) {
- error("Cannot read from file %s", fi.file->name());
+ error("Cannot read from file %s", _fileName.c_str());
goto cleanup;
}
@@ -200,8 +199,10 @@ int Win32ResExtractor::extractResource_(const char *resType, char *resName, byte
/* free stuff and close file */
cleanup:
- if (fi.file != NULL)
+ if (fi.file != NULL) {
fi.file->close();
+ delete fi.file;
+ }
if (fi.memory != NULL)
free(fi.memory);
@@ -371,19 +372,19 @@ byte *Win32ResExtractor::extract_group_icon_cursor_resource(WinLibrary *fi, WinR
fwr = find_resource(fi, (is_icon ? "-3" : "-1"), name, lang, &level);
if (fwr == NULL) {
error("%s: could not find `%s' in `%s' resource.",
- fi->file->name(), &name[1], (is_icon ? "group_icon" : "group_cursor"));
+ _fileName.c_str(), &name[1], (is_icon ? "group_icon" : "group_cursor"));
return NULL;
}
if (get_resource_entry(fi, fwr, &iconsize) != NULL) {
if (iconsize == 0) {
- debugC(DEBUG_RESOURCE, "%s: icon resource `%s' is empty, skipping", fi->file->name(), name);
+ debugC(DEBUG_RESOURCE, "%s: icon resource `%s' is empty, skipping", _fileName.c_str(), name);
skipped++;
continue;
}
if ((uint32)iconsize != FROM_LE_32(icondir->entries[c].bytes_in_res)) {
debugC(DEBUG_RESOURCE, "%s: mismatch of size in icon resource `%s' and group (%d != %d)",
- fi->file->name(), name, iconsize, FROM_LE_32(icondir->entries[c].bytes_in_res));
+ _fileName.c_str(), name, iconsize, FROM_LE_32(icondir->entries[c].bytes_in_res));
}
size += iconsize; /* size += FROM_LE_32(icondir->entries[c].bytes_in_res); */
@@ -419,7 +420,7 @@ byte *Win32ResExtractor::extract_group_icon_cursor_resource(WinLibrary *fi, WinR
fwr = find_resource(fi, (is_icon ? "-3" : "-1"), name, lang, &level);
if (fwr == NULL) {
error("%s: could not find `%s' in `%s' resource.",
- fi->file->name(), &name[1], (is_icon ? "group_icon" : "group_cursor"));
+ _fileName.c_str(), &name[1], (is_icon ? "group_icon" : "group_cursor"));
return NULL;
}
@@ -675,7 +676,7 @@ bool Win32ResExtractor::read_library(WinLibrary *fi) {
LE32(mz_header->lfanew);
if (mz_header->lfanew < sizeof(DOSImageHeader)) {
- error("%s: not a Windows library", fi->file->name());
+ error("%s: not a Windows library", _fileName.c_str());
return false;
}
}
@@ -724,7 +725,7 @@ bool Win32ResExtractor::read_library(WinLibrary *fi) {
RETURN_IF_BAD_POINTER(false, pe_header->optional_header.data_directory[IMAGE_DIRECTORY_ENTRY_RESOURCE]);
Win32ImageDataDirectory *dir = pe_header->optional_header.data_directory + IMAGE_DIRECTORY_ENTRY_RESOURCE;
if (dir->size == 0) {
- error("%s: file contains no resources", fi->file->name());
+ error("%s: file contains no resources", _fileName.c_str());
return false;
}
@@ -735,7 +736,7 @@ bool Win32ResExtractor::read_library(WinLibrary *fi) {
}
/* other (unknown) header signature was found */
- error("%s: not a Windows library", fi->file->name());
+ error("%s: not a Windows library", _fileName.c_str());
return false;
}
diff --git a/engines/scumm/he/resource_he.h b/engines/scumm/he/resource_he.h
index a3237e7b3b..9f4b423d3d 100644
--- a/engines/scumm/he/resource_he.h
+++ b/engines/scumm/he/resource_he.h
@@ -102,10 +102,10 @@ namespace Scumm {
#endif
#define RETURN_IF_BAD_POINTER(r, x) \
- if (!check_offset(fi->memory, fi->total_size, fi->file->name(), &(x), sizeof(x))) \
+ if (!check_offset(fi->memory, fi->total_size, _fileName.c_str(), &(x), sizeof(x))) \
return (r);
#define RETURN_IF_BAD_OFFSET(r, x, s) \
- if (!check_offset(fi->memory, fi->total_size, fi->file->name(), x, s)) \
+ if (!check_offset(fi->memory, fi->total_size, _fileName.c_str(), x, s)) \
return (r);
class ScummEngine_v70he;
diff --git a/engines/scumm/he/script_v100he.cpp b/engines/scumm/he/script_v100he.cpp
index 5717d77640..f1a202e22c 100644
--- a/engines/scumm/he/script_v100he.cpp
+++ b/engines/scumm/he/script_v100he.cpp
@@ -23,8 +23,6 @@
*
*/
-
-
#include "common/system.h"
#include "scumm/actor.h"
@@ -381,7 +379,7 @@ const char *ScummEngine_v100he::getOpcodeDesc(byte i) {
}
void ScummEngine_v100he::o100_actorOps() {
- Actor *a;
+ ActorHE *a;
int i, j, k;
int args[32];
byte string[256];
@@ -392,7 +390,7 @@ void ScummEngine_v100he::o100_actorOps() {
return;
}
- a = derefActorSafe(_curActor, "o100_actorOps");
+ a = (ActorHE *)derefActorSafe(_curActor, "o100_actorOps");
if (!a)
return;
diff --git a/engines/scumm/he/script_v60he.cpp b/engines/scumm/he/script_v60he.cpp
index 9429f8d086..7f36d53791 100644
--- a/engines/scumm/he/script_v60he.cpp
+++ b/engines/scumm/he/script_v60he.cpp
@@ -23,7 +23,6 @@
*
*/
-
#include "common/savefile.h"
#include "scumm/actor.h"
@@ -623,7 +622,7 @@ void ScummEngine_v60he::swapObjects(int object1, int object2) {
}
void ScummEngine_v60he::o60_actorOps() {
- Actor *a;
+ ActorHE *a;
int i, j, k;
int args[8];
@@ -633,7 +632,7 @@ void ScummEngine_v60he::o60_actorOps() {
return;
}
- a = derefActorSafe(_curActor, "o60_actorOps");
+ a = (ActorHE *)derefActorSafe(_curActor, "o60_actorOps");
if (!a)
return;
diff --git a/engines/scumm/he/script_v70he.cpp b/engines/scumm/he/script_v70he.cpp
index 8fcb8b6fe8..577e7c3d99 100644
--- a/engines/scumm/he/script_v70he.cpp
+++ b/engines/scumm/he/script_v70he.cpp
@@ -23,8 +23,6 @@
*
*/
-
-
#include "common/config-manager.h"
#include "common/system.h"
diff --git a/engines/scumm/he/script_v71he.cpp b/engines/scumm/he/script_v71he.cpp
index 8b2823aa8c..1338ab3db8 100644
--- a/engines/scumm/he/script_v71he.cpp
+++ b/engines/scumm/he/script_v71he.cpp
@@ -23,8 +23,6 @@
*
*/
-
-
#include "scumm/actor.h"
#include "scumm/he/intern_he.h"
#include "scumm/scumm.h"
@@ -500,7 +498,7 @@ void ScummEngine_v71he::adjustRect(Common::Rect &rect) {
void ScummEngine_v71he::o71_kernelSetFunctions() {
int args[29];
int num;
- Actor *a;
+ ActorHE *a;
num = getStackList(args, ARRAYSIZE(args));
@@ -511,8 +509,8 @@ void ScummEngine_v71he::o71_kernelSetFunctions() {
virtScreenLoad(args[1], args[2], args[3], args[4], args[5]);
break;
case 20: // HE72+
- a = derefActor(args[1], "o71_kernelSetFunctions: 20");
- ((ScummEngine_v71he *)this)->queueAuxBlock(a);
+ a = (ActorHE *)derefActor(args[1], "o71_kernelSetFunctions: 20");
+ queueAuxBlock(a);
break;
case 21:
_skipDrawObject = 1;
@@ -533,14 +531,14 @@ void ScummEngine_v71he::o71_kernelSetFunctions() {
redrawAllActors();
break;
case 26:
- a = derefActor(args[1], "o71_kernelSetFunctions: 26");
+ a = (ActorHE *)derefActor(args[1], "o71_kernelSetFunctions: 26");
a->_auxBlock.r.left = 0;
a->_auxBlock.r.right = -1;
a->_auxBlock.r.top = 0;
a->_auxBlock.r.bottom = -2;
break;
case 30:
- a = derefActor(args[1], "o71_kernelSetFunctions: 30");
+ a = (ActorHE *)derefActor(args[1], "o71_kernelSetFunctions: 30");
a->_clipOverride.bottom = args[2];
break;
case 42:
diff --git a/engines/scumm/he/script_v72he.cpp b/engines/scumm/he/script_v72he.cpp
index 7e31383f4e..2fecc58bff 100644
--- a/engines/scumm/he/script_v72he.cpp
+++ b/engines/scumm/he/script_v72he.cpp
@@ -23,8 +23,6 @@
*
*/
-
-
#include "common/config-manager.h"
#include "common/savefile.h"
#include "common/system.h"
@@ -1021,7 +1019,7 @@ void ScummEngine_v72he::o72_roomOps() {
}
void ScummEngine_v72he::o72_actorOps() {
- Actor *a;
+ ActorHE *a;
int i, j, k;
int args[32];
byte string[256];
@@ -1032,7 +1030,7 @@ void ScummEngine_v72he::o72_actorOps() {
return;
}
- a = derefActorSafe(_curActor, "o72_actorOps");
+ a = (ActorHE *)derefActorSafe(_curActor, "o72_actorOps");
if (!a)
return;
diff --git a/engines/scumm/he/script_v80he.cpp b/engines/scumm/he/script_v80he.cpp
index 39ec715d94..46449d1683 100644
--- a/engines/scumm/he/script_v80he.cpp
+++ b/engines/scumm/he/script_v80he.cpp
@@ -23,8 +23,6 @@
*
*/
-
-
#include "common/config-file.h"
#include "common/config-manager.h"
#include "common/savefile.h"
@@ -646,7 +644,7 @@ void ScummEngine_v80he::drawLine(int x1, int y1, int x, int y, int step, int typ
if (type == 2) {
- Actor *a = derefActor(id, "drawLine");
+ ActorHE *a = (ActorHE *)derefActor(id, "drawLine");
a->drawActorToBackBuf(x, y);
} else if (type == 3) {
WizImage wi;
@@ -697,7 +695,7 @@ void ScummEngine_v80he::drawLine(int x1, int y1, int x, int y, int step, int typ
continue;
if (type == 2) {
- Actor *a = derefActor(id, "drawLine");
+ ActorHE *a = (ActorHE *)derefActor(id, "drawLine");
a->drawActorToBackBuf(x, y);
} else if (type == 3) {
WizImage wi;
diff --git a/engines/scumm/he/script_v90he.cpp b/engines/scumm/he/script_v90he.cpp
index 6d15303378..9829d0ecb5 100644
--- a/engines/scumm/he/script_v90he.cpp
+++ b/engines/scumm/he/script_v90he.cpp
@@ -23,8 +23,6 @@
*
*/
-
-
#include "scumm/actor.h"
#include "scumm/charset.h"
#include "scumm/he/animation_he.h"
@@ -1617,13 +1615,13 @@ void ScummEngine_v90he::o90_getWizData() {
}
void ScummEngine_v90he::o90_getActorData() {
- Actor *a;
+ ActorHE *a;
int subOp = pop();
int val = pop();
int act = pop();
- a = derefActor(act, "o90_getActorData");
+ a = (ActorHE *)derefActor(act, "o90_getActorData");
switch (subOp) {
case 1:
@@ -2570,13 +2568,13 @@ void ScummEngine_v90he::o90_kernelGetFunctions() {
void ScummEngine_v90he::o90_kernelSetFunctions() {
int args[29];
int num, tmp;
- Actor *a;
+ ActorHE *a;
num = getStackList(args, ARRAYSIZE(args));
switch (args[0]) {
case 20:
- a = derefActor(args[1], "o90_kernelSetFunctions: 20");
+ a = (ActorHE *)derefActor(args[1], "o90_kernelSetFunctions: 20");
queueAuxBlock(a);
break;
case 21:
@@ -2618,7 +2616,7 @@ void ScummEngine_v90he::o90_kernelSetFunctions() {
// Remote start script function
break;
case 1969:
- a = derefActor(args[1], "o90_kernelSetFunctions: 1969");
+ a = (ActorHE *)derefActor(args[1], "o90_kernelSetFunctions: 1969");
tmp = a->_heCondMask;
tmp ^= args[2];
tmp &= 0x7FFF0000;
diff --git a/engines/scumm/object.cpp b/engines/scumm/object.cpp
index 8bcd92fd3b..eaffbd04bb 100644
--- a/engines/scumm/object.cpp
+++ b/engines/scumm/object.cpp
@@ -109,6 +109,13 @@ void ScummEngine::setOwnerOf(int obj, int owner) {
int arg = (_game.version >= 6) ? obj : 0;
+ // WORKAROUND for bug #1917981: Game crash when finishing Indy3 demo.
+ // Script 94 tries to empty the inventory but does so in a bogus way.
+ // This causes it to try to remove object 0 from the inventory.
+ if (_game.id == GID_PASS && obj == 0 && vm.slot[_currentScript].number == 94)
+ return;
+ assert(obj > 0);
+
if (owner == 0) {
clearOwnerOf(obj);
diff --git a/engines/scumm/scumm-md5.h b/engines/scumm/scumm-md5.h
index 9c076ddfc8..ce40d808b1 100644
--- a/engines/scumm/scumm-md5.h
+++ b/engines/scumm/scumm-md5.h
@@ -1,5 +1,5 @@
/*
- This file was generated by the md5table tool on Sat Sep 06 07:02:46 2008
+ This file was generated by the md5table tool on Mon Sep 29 00:06:57 2008
DO NOT EDIT MANUALLY!
*/
@@ -187,7 +187,7 @@ static const MD5Table md5table[] = {
{ "47e75b1bdcb44c78cb94883d1731ccf8", "fbear", "HE 61", "Demo", 6203, Common::EN_ANY, Common::kPlatformPC },
{ "48b9f04b348bc5013327753f0d12a144", "loom", "EGA", "EGA", -1, Common::ES_ESP, Common::kPlatformAmiga },
{ "49210e124e4c2b30f1290a9ef6306301", "monkey", "EGA", "EGA", 8357, Common::EN_ANY, Common::kPlatformPC },
- { "4973bbc3899e3826dbf316e1d7271ec7", "zak", "V1", "", -1, Common::DE_DEU, Common::kPlatformC64 },
+ { "4973bbc3899e3826dbf316e1d7271ec7", "zak", "V1", "", 196608, Common::DE_DEU, Common::kPlatformC64 },
{ "499c958affc394f2a3868f1eb568c3ee", "freddi4", "HE 99", "Demo", -1, Common::NL_NLD, Common::kPlatformWindows },
{ "49a1739981a89066b1121fac04b710f4", "spyfox2", "HE CUP", "Preview", 5756234, Common::UNK_LANG, Common::kPlatformUnknown },
{ "4aa93cb30e485b728504ba3a693f12bf", "pajama", "HE 100", "", -1, Common::RU_RUS, Common::kPlatformWindows },
@@ -223,9 +223,10 @@ static const MD5Table md5table[] = {
{ "53e94115b55dd51d4b8ff0871aa1df1e", "spyfox", "", "Demo", 20103, Common::EN_ANY, Common::kPlatformUnknown },
{ "54a936ad06161ff7bfefcb96200f7bff", "monkey", "VGA", "VGA Demo", -1, Common::EN_ANY, Common::kPlatformAmiga },
{ "55518cd73cf9c6d23ea29c51ee06bdfe", "ft", "", "", -1, Common::IT_ITA, Common::kPlatformUnknown },
- { "55d3987641bf229c83bc729210173383", "zak", "V1", "", -1, Common::EN_ANY, Common::kPlatformC64 },
+ { "55d3987641bf229c83bc729210173383", "zak", "V1", "", 174848, Common::EN_ANY, Common::kPlatformC64 },
{ "55e4cc866ff9046824e1c638ba2b8c7f", "ft", "", "", -1, Common::RU_RUS, Common::kPlatformUnknown },
{ "566165a7338fa11029e7c14d94fa70d0", "freddi", "HE 73", "Demo", 9800, Common::EN_ANY, Common::kPlatformWindows },
+ { "5719fc8a13b4638b78d9d8d12f091f94", "puttrace", "HE 98.5", "", -1, Common::FR_FRA, Common::kPlatformWindows },
{ "5798972220cd458be2626d54c80f71d7", "atlantis", "", "Floppy", -1, Common::IT_ITA, Common::kPlatformAmiga },
{ "57a17febe2183f521250e55d55b83e60", "PuttTime", "HE 99", "", -1, Common::FR_FRA, Common::kPlatformWindows },
{ "57a5cfec9ef231a007043cc1917e8988", "freddi", "HE 100", "", -1, Common::EN_ANY, Common::kPlatformWii },
@@ -320,6 +321,7 @@ static const MD5Table md5table[] = {
{ "78bd5f036ea35a878b74e4f47941f784", "freddi4", "HE 99", "", -1, Common::RU_RUS, Common::kPlatformWindows },
{ "78c07ca088526d8d4446a4c2cb501203", "freddi3", "HE 99", "", -1, Common::FR_FRA, Common::kPlatformUnknown },
{ "7974365d3dc0f43a2748c975f91ff042", "monkey2", "", "", -1, Common::ES_ESP, Common::kPlatformPC },
+ { "7b60620558b8d6b7d7313b8ac7bb5a98", "zak", "V1", "", 174848, Common::IT_ITA, Common::kPlatformC64 },
{ "7bad72e332a59f9fcc1d437f4edad32a", "puttcircus", "", "", -1, Common::RU_RUS, Common::kPlatformUnknown },
{ "7c2e76087027eeee9c8f8985f93a1cc5", "freddi4", "", "Demo", 13584, Common::EN_ANY, Common::kPlatformUnknown },
{ "7c8100e360e8ef05f88069d4cfa0afd1", "puttrace", "HE 99", "Demo", 13108, Common::EN_GRB, Common::kPlatformWindows },
diff --git a/engines/scumm/scumm.cpp b/engines/scumm/scumm.cpp
index f87adfd9ac..a10af41145 100644
--- a/engines/scumm/scumm.cpp
+++ b/engines/scumm/scumm.cpp
@@ -1307,6 +1307,8 @@ void ScummEngine::resetScumm() {
_actors[i] = new Actor_v2(this, i);
else if (_game.version == 3)
_actors[i] = new Actor_v3(this, i);
+ else if (_game.heversion != 0)
+ _actors[i] = new ActorHE(this, i);
else
_actors[i] = new Actor(this, i);
_actors[i]->initActor(-1);
diff --git a/engines/scumm/scumm.h b/engines/scumm/scumm.h
index 27c8943fee..ec733d32f4 100644
--- a/engines/scumm/scumm.h
+++ b/engines/scumm/scumm.h
@@ -918,7 +918,7 @@ public:
// Generic costume code
bool isCostumeInUse(int i) const;
- Common::Rect _actorClipOverride;
+ Common::Rect _actorClipOverride; // HE specific
protected:
/* Should be in Graphics class? */
diff --git a/engines/sword1/animation.cpp b/engines/sword1/animation.cpp
index 3e15429e44..eb6b6d4dca 100644
--- a/engines/sword1/animation.cpp
+++ b/engines/sword1/animation.cpp
@@ -66,8 +66,8 @@ static const char *sequenceList[20] = {
// Basic movie player
///////////////////////////////////////////////////////////////////////////////
-MoviePlayer::MoviePlayer(Screen *screen, Text *textMan, Audio::Mixer *snd, OSystem *system)
- : _screen(screen), _textMan(textMan), _snd(snd), _system(system) {
+MoviePlayer::MoviePlayer(SwordEngine *vm, Screen *screen, Text *textMan, Audio::Mixer *snd, OSystem *system)
+ : _vm(vm), _screen(screen), _textMan(textMan), _snd(snd), _system(system) {
_bgSoundStream = NULL;
_ticks = 0;
_textSpriteBuf = NULL;
@@ -295,17 +295,20 @@ void MoviePlayer::play(void) {
handleScreenChanged();
break;
case Common::EVENT_KEYDOWN:
- if (event.kbd.keycode == Common::KEYCODE_ESCAPE) {
- _snd->stopHandle(_bgSoundHandle);
+ if (event.kbd.keycode == Common::KEYCODE_ESCAPE)
terminated = true;
- }
break;
default:
break;
}
}
+ if (_vm->quit())
+ terminated = true;
}
+ if (terminated)
+ _snd->stopHandle(_bgSoundHandle);
+
while (!_movieTexts.empty()) {
delete _movieTexts.remove_at(_movieTexts.size() - 1);
}
@@ -390,8 +393,8 @@ int SplittedAudioStream::readBuffer(int16 *buffer, const int numSamples) {
// Movie player for the new DXA movies
///////////////////////////////////////////////////////////////////////////////
-MoviePlayerDXA::MoviePlayerDXA(Screen *screen, Text *textMan, Audio::Mixer *snd, OSystem *system)
- : MoviePlayer(screen, textMan, snd, system) {
+MoviePlayerDXA::MoviePlayerDXA(SwordEngine *vm, Screen *screen, Text *textMan, Audio::Mixer *snd, OSystem *system)
+ : MoviePlayer(vm, screen, textMan, snd, system) {
debug(0, "Creating DXA cutscene player");
}
@@ -438,7 +441,7 @@ bool MoviePlayerDXA::decodeFrame(void) {
void MoviePlayerDXA::processFrame(void) {
// TODO: Handle the advanced cutscene packs. Do they really exist?
- // We cannot draw the text to _drawBuffer, sinzce ethat's one of the
+ // We cannot draw the text to _drawBuffer, since that's one of the
// decoder's internal buffers. Instead, we copy part of _drawBuffer
// to the text sprite.
@@ -492,8 +495,8 @@ void MoviePlayerDXA::updateScreen(void) {
// Movie player for the old MPEG movies
///////////////////////////////////////////////////////////////////////////////
-MoviePlayerMPEG::MoviePlayerMPEG(Screen *screen, Text *textMan, Audio::Mixer *snd, OSystem *system)
- : MoviePlayer(screen, textMan, snd, system) {
+MoviePlayerMPEG::MoviePlayerMPEG(SwordEngine *vm, Screen *screen, Text *textMan, Audio::Mixer *snd, OSystem *system)
+ : MoviePlayer(vm, screen, textMan, snd, system) {
#ifdef BACKEND_8BIT
debug(0, "Creating MPEG cutscene player (8-bit)");
#else
@@ -625,7 +628,7 @@ Audio::AudioStream *AnimationState::createAudioStream(const char *name, void *ar
// Factory function for creating the appropriate cutscene player
///////////////////////////////////////////////////////////////////////////////
-MoviePlayer *makeMoviePlayer(uint32 id, Screen *screen, Text *textMan, Audio::Mixer *snd, OSystem *system) {
+MoviePlayer *makeMoviePlayer(uint32 id, SwordEngine *vm, Screen *screen, Text *textMan, Audio::Mixer *snd, OSystem *system) {
#if defined(USE_ZLIB) || defined(USE_MPEG2)
char filename[20];
#endif
@@ -634,7 +637,7 @@ MoviePlayer *makeMoviePlayer(uint32 id, Screen *screen, Text *textMan, Audio::Mi
snprintf(filename, sizeof(filename), "%s.dxa", sequenceList[id]);
if (Common::File::exists(filename)) {
- return new MoviePlayerDXA(screen, textMan, snd, system);
+ return new MoviePlayerDXA(vm, screen, textMan, snd, system);
}
#endif
@@ -642,7 +645,7 @@ MoviePlayer *makeMoviePlayer(uint32 id, Screen *screen, Text *textMan, Audio::Mi
snprintf(filename, sizeof(filename), "%s.mp2", sequenceList[id]);
if (Common::File::exists(filename)) {
- return new MoviePlayerMPEG(screen, textMan, snd, system);
+ return new MoviePlayerMPEG(vm, screen, textMan, snd, system);
}
#endif
diff --git a/engines/sword1/animation.h b/engines/sword1/animation.h
index 0837814c69..fd9c774190 100644
--- a/engines/sword1/animation.h
+++ b/engines/sword1/animation.h
@@ -78,7 +78,7 @@ public:
class MoviePlayer {
public:
- MoviePlayer(Screen *screen, Text *textMan, Audio::Mixer *snd, OSystem *system);
+ MoviePlayer(SwordEngine *vm, Screen *screen, Text *textMan, Audio::Mixer *snd, OSystem *system);
virtual ~MoviePlayer(void);
virtual bool load(uint32 id);
void play(void);
@@ -86,6 +86,7 @@ public:
private:
bool checkSkipFrame(void);
protected:
+ SwordEngine *_vm;
Screen *_screen;
Text *_textMan;
Audio::Mixer *_snd;
@@ -122,7 +123,7 @@ class MoviePlayerDXA : public MoviePlayer, ::Graphics::DXAPlayer {
protected:
virtual void setPalette(byte *pal);
public:
- MoviePlayerDXA(Screen *screen, Text *textMan, Audio::Mixer *snd, OSystem *system);
+ MoviePlayerDXA(SwordEngine *vm, Screen *screen, Text *textMan, Audio::Mixer *snd, OSystem *system);
virtual ~MoviePlayerDXA(void);
bool load(uint32 id);
protected:
@@ -159,7 +160,7 @@ protected:
class MoviePlayerMPEG : public MoviePlayer {
public:
- MoviePlayerMPEG(Screen *screen, Text *textMan, Audio::Mixer *snd, OSystem *system);
+ MoviePlayerMPEG(SwordEngine *vm, Screen *screen, Text *textMan, Audio::Mixer *snd, OSystem *system);
virtual ~MoviePlayerMPEG(void);
bool load(uint32 id);
protected:
@@ -195,7 +196,7 @@ private:
FileQueue *_queue;
};
-MoviePlayer *makeMoviePlayer(uint32 id, Screen *screen, Text *textMan, Audio::Mixer *snd, OSystem *system);
+MoviePlayer *makeMoviePlayer(uint32 id, SwordEngine *vm, Screen *screen, Text *textMan, Audio::Mixer *snd, OSystem *system);
} // End of namespace Sword1
diff --git a/engines/sword1/logic.cpp b/engines/sword1/logic.cpp
index 2fa108ebdd..8950986b09 100644
--- a/engines/sword1/logic.cpp
+++ b/engines/sword1/logic.cpp
@@ -55,9 +55,10 @@ namespace Sword1 {
uint32 Logic::_scriptVars[NUM_SCRIPT_VARS];
-Logic::Logic(ObjectMan *pObjMan, ResMan *resMan, Screen *pScreen, Mouse *pMouse, Sound *pSound, Music *pMusic, Menu *pMenu, OSystem *system, Audio::Mixer *mixer) {
+Logic::Logic(SwordEngine *vm, ObjectMan *pObjMan, ResMan *resMan, Screen *pScreen, Mouse *pMouse, Sound *pSound, Music *pMusic, Menu *pMenu, OSystem *system, Audio::Mixer *mixer) {
g_system->getEventManager()->registerRandomSource(_rnd, "sword1");
+ _vm = vm;
_objMan = pObjMan;
_resMan = resMan;
_screen = pScreen;
@@ -963,7 +964,7 @@ int Logic::fnPlaySequence(Object *cpt, int32 id, int32 sequenceId, int32 d, int3
CreditsPlayer player(_system, _mixer);
player.play();
} else {
- MoviePlayer *player = makeMoviePlayer(sequenceId, _screen, _textMan, _mixer, _system);
+ MoviePlayer *player = makeMoviePlayer(sequenceId, _vm, _screen, _textMan, _mixer, _system);
if (player) {
if (player->load(sequenceId))
player->play();
diff --git a/engines/sword1/logic.h b/engines/sword1/logic.h
index 8e2f24ac83..6e3f08c4af 100644
--- a/engines/sword1/logic.h
+++ b/engines/sword1/logic.h
@@ -37,6 +37,7 @@ namespace Sword1 {
#define NON_ZERO_SCRIPT_VARS 95
#define NUM_SCRIPT_VARS 1179
+class SwordEngine;
class Text;
class Sound;
class EventManager;
@@ -51,7 +52,7 @@ typedef int (Logic::*BSMcodeTable)(Object *, int32, int32, int32, int32, int32,
class Logic {
public:
- Logic(ObjectMan *pObjMan, ResMan *resMan, Screen *pScreen, Mouse *pMouse, Sound *pSound, Music *pMusic, Menu *pMenu, OSystem *system, Audio::Mixer *mixer);
+ Logic(SwordEngine *vm, ObjectMan *pObjMan, ResMan *resMan, Screen *pScreen, Mouse *pMouse, Sound *pSound, Music *pMusic, Menu *pMenu, OSystem *system, Audio::Mixer *mixer);
~Logic(void);
void initialize(void);
void newScreen(uint32 screen);
@@ -64,6 +65,7 @@ public:
// public for mouse (menu looking)
int cfnPresetScript (Object *cpt, int32 id, int32 c, int32 d, int32 e, int32 f, int32 z, int32 x);
private:
+ SwordEngine *_vm;
ObjectMan *_objMan;
OSystem *_system;
Audio::Mixer *_mixer;
diff --git a/engines/sword1/sword1.cpp b/engines/sword1/sword1.cpp
index 9b79f59a32..42124d419e 100644
--- a/engines/sword1/sword1.cpp
+++ b/engines/sword1/sword1.cpp
@@ -303,7 +303,7 @@ int SwordEngine::init() {
_music = new Music(_mixer);
_sound = new Sound("", _mixer, _resMan);
_menu = new Menu(_screen, _mouse);
- _logic = new Logic(_objectMan, _resMan, _screen, _mouse, _sound, _music, _menu, _system, _mixer);
+ _logic = new Logic(this, _objectMan, _resMan, _screen, _mouse, _sound, _music, _menu, _system, _mixer);
_mouse->useLogicAndMenu(_logic, _menu);
syncSoundSettings();