aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorPaul Gilbert2008-12-07 07:44:52 +0000
committerPaul Gilbert2008-12-07 07:44:52 +0000
commit87a097618583e6044c8c9d08e32b6a28932f7815 (patch)
tree46a3285492a668651990509f8583ba43ce6eb809
parent5d1e3fd03e21e9486168783b31d18d8738b2a559 (diff)
downloadscummvm-rg350-87a097618583e6044c8c9d08e32b6a28932f7815.tar.gz
scummvm-rg350-87a097618583e6044c8c9d08e32b6a28932f7815.tar.bz2
scummvm-rg350-87a097618583e6044c8c9d08e32b6a28932f7815.zip
Added code differences for DW1 demo to allow the first game screen to start
svn-id: r35268
-rw-r--r--engines/tinsel/bg.cpp3
-rw-r--r--engines/tinsel/dialogs.cpp17
-rw-r--r--engines/tinsel/dw.h10
-rw-r--r--engines/tinsel/graphics.cpp4
-rw-r--r--engines/tinsel/strres.cpp4
-rw-r--r--engines/tinsel/tinlib.cpp11
6 files changed, 35 insertions, 14 deletions
diff --git a/engines/tinsel/bg.cpp b/engines/tinsel/bg.cpp
index 41628a55e8..a5b4170673 100644
--- a/engines/tinsel/bg.cpp
+++ b/engines/tinsel/bg.cpp
@@ -250,8 +250,7 @@ void StartupBackground(CORO_PARAM, SCNHANDLE hFilm) {
pim = GetImageFromFilm(hFilm, 0, NULL, NULL, &pfilm);
- if (!TinselV0)
- SetBackPal(FROM_LE_32(pim->hImgPal));
+ SetBackPal(FROM_LE_32(pim->hImgPal));
// Extract the film speed
BGspeed = ONE_SECOND / FROM_LE_32(pfilm->frate);
diff --git a/engines/tinsel/dialogs.cpp b/engines/tinsel/dialogs.cpp
index 7118c6a784..986a4bf936 100644
--- a/engines/tinsel/dialogs.cpp
+++ b/engines/tinsel/dialogs.cpp
@@ -3887,6 +3887,10 @@ void SetMenuGlobals(CONFINIT *ci) {
void OpenMenu(CONFTYPE menuType) {
int curX, curY;
+ // In the DW 1 demo, don't allow any menu to be opened
+ if (TinselV0)
+ return;
+
if (InventoryState != IDLE_INV)
return;
@@ -5523,7 +5527,18 @@ void RegisterIcons(void *cptr, int num) {
numObjects = num;
invObjects = (INV_OBJECT *) cptr;
- if (TinselV2) {
+ if (TinselV0) {
+ // In Tinsel 0, the INV_OBJECT structure doesn't have an attributes field, so we
+ // need to 'unpack' the source structures into the standard Tinsel v1/v2 format
+ invObjects = (INV_OBJECT *)MemoryAlloc(DWM_FIXED, numObjects * sizeof(INV_OBJECT));
+ byte *srcP = (byte *)cptr;
+ INV_OBJECT *destP = (INV_OBJECT *)invObjects;
+
+ for (int i = 0; i < num; ++i, ++destP, srcP += 12) {
+ memmove(destP, srcP, 12);
+ destP->attribute = 0;
+ }
+ } else if (TinselV2) {
if (invFilms == NULL)
// First time - allocate memory
invFilms = (SCNHANDLE *)MemoryAlloc(DWM_FIXED | DWM_ZEROINIT, numObjects * sizeof(SCNHANDLE));
diff --git a/engines/tinsel/dw.h b/engines/tinsel/dw.h
index af5ce99d29..aa7fa26080 100644
--- a/engines/tinsel/dw.h
+++ b/engines/tinsel/dw.h
@@ -57,14 +57,8 @@ typedef int HPOLYGON;
// the maximum value a integer number can have
#define MAX_INT (~MIN_INT)
-// TODO: v1->v2 scene files
-#ifdef FILE_SPLIT
-// each scene is split into 2 files
-#define INV_OBJ_SCNHANDLE (2 << SCNHANDLE_SHIFT) // inventory object handle (if there are inventory objects)
-#else
-#define INV_OBJ_SCNHANDLE (1 << SCNHANDLE_SHIFT) // inventory object handle (if there are inventory objects)
-#endif
-
+// inventory object handle (if there are inventory objects)
+#define INV_OBJ_SCNHANDLE (TinselV0 ? (2 << SCNHANDLE_SHIFT) : (1 << SCNHANDLE_SHIFT))
#define FIELD_WORLD 0
#define FIELD_STATUS 1
diff --git a/engines/tinsel/graphics.cpp b/engines/tinsel/graphics.cpp
index 8790075375..a15f5aa0dd 100644
--- a/engines/tinsel/graphics.cpp
+++ b/engines/tinsel/graphics.cpp
@@ -623,6 +623,10 @@ void DrawObject(DRAWOBJECT *pObj) {
case 0x48:
WrtAll(pObj, srcPtr, destPtr, typeId >= 0x40);
break;
+ case 0x84:
+ case 0xC4:
+ WrtTrans(pObj, destPtr, (typeId & 0x40) != 0);
+ break;
default:
error("Unknown drawing type %d", typeId);
}
diff --git a/engines/tinsel/strres.cpp b/engines/tinsel/strres.cpp
index 0997d68fbe..979b05fb8d 100644
--- a/engines/tinsel/strres.cpp
+++ b/engines/tinsel/strres.cpp
@@ -170,6 +170,10 @@ static byte *FindStringBase(int id) {
// pointer to strings
pText = pText + index;
+ // For Tinsel 0 Ids, reduce the skip amount by 1
+ if (TinselV0 && (strSkip != 0))
+ --strSkip;
+
// skip to the correct string
while (strSkip-- != 0) {
// skip to next string
diff --git a/engines/tinsel/tinlib.cpp b/engines/tinsel/tinlib.cpp
index 241a319360..5076008292 100644
--- a/engines/tinsel/tinlib.cpp
+++ b/engines/tinsel/tinlib.cpp
@@ -180,7 +180,7 @@ enum MASTER_LIB_CODES {
const MASTER_LIB_CODES DW1DEMO_CODES[] = {
ACTORREF, ACTORXPOS, ACTORYPOS, ADDTOPIC, ADDINV1, ADDINV2, AUXSCALE, BACKGROUND,
CAMERA, CONTROL, CONVERSATION, CONVTOPIC, HIGHEST_LIBCODE, CURSORXPOS, CURSORYPOS,
- DECCONVW, DECCURSOR, DECFLAGS, DECINVW, DECINV1, DECINV2, DECLEAD, DELICON,
+ DECCONVW, DECCURSOR, DECTAGFONT, DECINVW, DECINV1, DECINV2, DECLEAD, DELICON,
DELINV, EVENT, HIGHEST_LIBCODE, HELDOBJECT, HIDEACTOR, ININVENTORY, HIGHEST_LIBCODE,
INVENTORY, HIGHEST_LIBCODE, KILLACTOR, KILLBLOCK, KILLTAG, SCREENXPOS,
HIGHEST_LIBCODE, MOVECURSOR, NEWSCENE, NOSCROLL, OBJECTHELD, OFFSET, HIGHEST_LIBCODE,
@@ -987,6 +987,8 @@ static void DecScale(int actor, int scale,
*/
static void DecTagFont(SCNHANDLE hf) {
SetTagFontHandle(hf); // Store the font handle
+ if (TinselV0)
+ SetTalkFontHandle(hf); // Also re-use for talk text
}
/**
@@ -2371,6 +2373,9 @@ static int RandomFn(int n1, int n2, int norpt) {
int i = 0;
uint32 value;
+ // In DW1 demo, upper/lower limit can be reversed
+ if (n2 < n1) SWAP(n1, n2);
+
do {
value = n1 + _vm->getRandomNumber(n2 - n1);
} while ((lastValue == value) && (norpt == RAND_NORPT) && (++i <= 10));
@@ -3719,7 +3724,7 @@ static void WaitKey(CORO_PARAM, bool escOn, int myEscape) {
for (;;) {
_ctx->startEvent = getUserEvents();
- if (!TinselV2) {
+ if (TinselV1) {
// Store cursor position
while (!GetCursorXYNoWait(&_ctx->startX, &_ctx->startY, false))
CORO_SLEEP(1);
@@ -3729,7 +3734,7 @@ static void WaitKey(CORO_PARAM, bool escOn, int myEscape) {
CORO_SLEEP(1);
// Not necessary to monitor escape as it's an event anyway
- if (!TinselV2) {
+ if (TinselV1) {
int curX, curY;
GetCursorXY(&curX, &curY, false); // Store cursor position
if (curX != _ctx->startX || curY != _ctx->startY)