aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorFilippos Karapetis2012-12-01 21:53:33 +0200
committerFilippos Karapetis2012-12-01 21:53:33 +0200
commit3fdddd53b2b970aae3e967bebc0bff6e642a5111 (patch)
treed20ba561d9c2896e8b533440f9f614e5cd9d6c64
parent8e09661e247f9955df64eb98eae0f90390b5ba24 (diff)
downloadscummvm-rg350-3fdddd53b2b970aae3e967bebc0bff6e642a5111.tar.gz
scummvm-rg350-3fdddd53b2b970aae3e967bebc0bff6e642a5111.tar.bz2
scummvm-rg350-3fdddd53b2b970aae3e967bebc0bff6e642a5111.zip
TINSEL: Start handling the BE resources of the Mac versions of DW1
Refer to bug #3110936 This is still work in progress, but it doesn't affect the rest of the LE versions of DW1. Both the Mac demo and the full version still crash. The music in the Mac version is skipped for now, as it isn't MIDI
-rw-r--r--engines/tinsel/anim.cpp2
-rw-r--r--engines/tinsel/bg.cpp6
-rw-r--r--engines/tinsel/cursor.cpp8
-rw-r--r--engines/tinsel/font.cpp4
-rw-r--r--engines/tinsel/multiobj.cpp24
-rw-r--r--engines/tinsel/music.cpp4
-rw-r--r--engines/tinsel/palette.cpp2
-rw-r--r--engines/tinsel/play.cpp20
-rw-r--r--engines/tinsel/scene.cpp6
-rw-r--r--engines/tinsel/tinsel.h2
10 files changed, 42 insertions, 36 deletions
diff --git a/engines/tinsel/anim.cpp b/engines/tinsel/anim.cpp
index 034296ccc7..cfc2612a5c 100644
--- a/engines/tinsel/anim.cpp
+++ b/engines/tinsel/anim.cpp
@@ -189,7 +189,7 @@ SCRIPTSTATE DoNextFrame(ANIM *pAnim) {
default: // must be an actual animation frame handle
// set objects new animation frame
- pAnim->pObject->hShape = FROM_LE_32(pAni[pAnim->scriptIndex].hFrame);
+ pAnim->pObject->hShape = FROM_32(pAni[pAnim->scriptIndex].hFrame);
// re-shape the object
MultiReshape(pAnim->pObject);
diff --git a/engines/tinsel/bg.cpp b/engines/tinsel/bg.cpp
index a3e21a8227..0c0db12c32 100644
--- a/engines/tinsel/bg.cpp
+++ b/engines/tinsel/bg.cpp
@@ -124,7 +124,7 @@ static void BGmainProcess(CORO_PARAM, const void *param) {
pReel = (const FREEL *)param;
// Get the MULTI_INIT structure
- pmi = (const MULTI_INIT *)LockMem(FROM_LE_32(pReel->mobj));
+ pmi = (const MULTI_INIT *)LockMem(FROM_32(pReel->mobj));
// Initialize and insert the object, and initialize its script.
g_pBG[0] = MultiInitObject(pmi);
@@ -249,10 +249,10 @@ void StartupBackground(CORO_PARAM, SCNHANDLE hFilm) {
pim = GetImageFromFilm(hFilm, 0, NULL, NULL, &pfilm);
- SetBackPal(FROM_LE_32(pim->hImgPal));
+ SetBackPal(FROM_32(pim->hImgPal));
// Extract the film speed
- g_BGspeed = ONE_SECOND / FROM_LE_32(pfilm->frate);
+ g_BGspeed = ONE_SECOND / FROM_32(pfilm->frate);
// Start display process for each reel in the film
CoroScheduler.createProcess(PID_REEL, BGmainProcess, &pfilm->reels[0], sizeof(FREEL));
diff --git a/engines/tinsel/cursor.cpp b/engines/tinsel/cursor.cpp
index bf901c03b6..5b365fc3b1 100644
--- a/engines/tinsel/cursor.cpp
+++ b/engines/tinsel/cursor.cpp
@@ -324,14 +324,14 @@ IMAGE *GetImageFromReel(const FREEL *pfr, const MULTI_INIT **ppmi) {
const MULTI_INIT *pmi;
const FRAME *pFrame;
- pmi = (const MULTI_INIT *)LockMem(FROM_LE_32(pfr->mobj));
+ pmi = (const MULTI_INIT *)LockMem(FROM_32(pfr->mobj));
if (ppmi)
*ppmi = pmi;
- pFrame = (const FRAME *)LockMem(FROM_LE_32(pmi->hMulFrame));
+ pFrame = (const FRAME *)LockMem(FROM_32(pmi->hMulFrame));
// get pointer to image
- return (IMAGE *)LockMem(READ_LE_UINT32(pFrame));
+ return (IMAGE *)LockMem(READ_32(pFrame));
}
/**
@@ -620,7 +620,7 @@ void DwInitCursor(SCNHANDLE bfilm) {
g_hCursorFilm = bfilm;
pfilm = (const FILM *)LockMem(g_hCursorFilm);
- g_numTrails = FROM_LE_32(pfilm->numreels) - 1;
+ g_numTrails = FROM_32(pfilm->numreels) - 1;
assert(g_numTrails <= MAX_TRAILERS);
}
diff --git a/engines/tinsel/font.cpp b/engines/tinsel/font.cpp
index 54aa7cc15f..6f7c3919c9 100644
--- a/engines/tinsel/font.cpp
+++ b/engines/tinsel/font.cpp
@@ -102,14 +102,14 @@ void FettleFontPal(SCNHANDLE fontPal) {
assert(g_hTalkFont); // Talk font not declared
pFont = (const FONT *)LockMem(g_hTagFont);
- pImg = (IMAGE *)LockMem(FROM_LE_32(pFont->fontInit.hObjImg)); // get image for char 0
+ pImg = (IMAGE *)LockMem(FROM_32(pFont->fontInit.hObjImg)); // get image for char 0
if (!TinselV2)
pImg->hImgPal = TO_LE_32(fontPal);
else
pImg->hImgPal = 0;
pFont = (const FONT *)LockMem(g_hTalkFont);
- pImg = (IMAGE *)LockMem(FROM_LE_32(pFont->fontInit.hObjImg)); // get image for char 0
+ pImg = (IMAGE *)LockMem(FROM_32(pFont->fontInit.hObjImg)); // get image for char 0
if (!TinselV2)
pImg->hImgPal = TO_LE_32(fontPal);
else
diff --git a/engines/tinsel/multiobj.cpp b/engines/tinsel/multiobj.cpp
index c48fefdd22..37769a7819 100644
--- a/engines/tinsel/multiobj.cpp
+++ b/engines/tinsel/multiobj.cpp
@@ -40,22 +40,22 @@ OBJECT *MultiInitObject(const MULTI_INIT *pInitTbl) {
OBJECT *pFirst, *pObj; // object pointers
FRAME *pFrame; // list of images for the multi-part object
- if (FROM_LE_32(pInitTbl->hMulFrame)) {
+ if (FROM_32(pInitTbl->hMulFrame)) {
// we have a frame handle
- pFrame = (FRAME *)LockMem(FROM_LE_32(pInitTbl->hMulFrame));
+ pFrame = (FRAME *)LockMem(FROM_32(pInitTbl->hMulFrame));
- obj_init.hObjImg = READ_LE_UINT32(pFrame); // first objects shape
+ obj_init.hObjImg = READ_32(pFrame); // first objects shape
} else { // this must be a animation list for a NULL object
pFrame = NULL;
obj_init.hObjImg = 0; // first objects shape
}
// init the object init table
- obj_init.objFlags = (int)FROM_LE_32(pInitTbl->mulFlags); // all objects have same flags
- obj_init.objID = (int)FROM_LE_32(pInitTbl->mulID); // all objects have same ID
- obj_init.objX = (int)FROM_LE_32(pInitTbl->mulX); // all objects have same X ani pos
- obj_init.objY = (int)FROM_LE_32(pInitTbl->mulY); // all objects have same Y ani pos
- obj_init.objZ = (int)FROM_LE_32(pInitTbl->mulZ); // all objects have same Z pos
+ obj_init.objFlags = (int)FROM_32(pInitTbl->mulFlags); // all objects have same flags
+ obj_init.objID = (int)FROM_32(pInitTbl->mulID); // all objects have same ID
+ obj_init.objX = (int)FROM_32(pInitTbl->mulX); // all objects have same X ani pos
+ obj_init.objY = (int)FROM_32(pInitTbl->mulY); // all objects have same Y ani pos
+ obj_init.objZ = (int)FROM_32(pInitTbl->mulZ); // all objects have same Z pos
// create and init the first object
pObj = pFirst = InitObject(&obj_init);
@@ -65,9 +65,9 @@ OBJECT *MultiInitObject(const MULTI_INIT *pInitTbl) {
pFrame++;
- while (READ_LE_UINT32(pFrame) != 0) {
+ while (READ_32(pFrame) != 0) {
// set next objects shape
- obj_init.hObjImg = READ_LE_UINT32(pFrame);
+ obj_init.hObjImg = READ_32(pFrame);
// create next object and link to previous
pObj = pObj->pSlave = InitObject(&obj_init);
@@ -378,9 +378,9 @@ void MultiReshape(OBJECT *pMultiObj) {
// update previous
pMultiObj->hMirror = hFrame;
- while (READ_LE_UINT32(pFrame) != 0 && pMultiObj != NULL) {
+ while (READ_32(pFrame) != 0 && pMultiObj != NULL) {
// a normal image - update the current object with this image
- AnimateObject(pMultiObj, READ_LE_UINT32(pFrame));
+ AnimateObject(pMultiObj, READ_32(pFrame));
// move to next image for this frame
pFrame++;
diff --git a/engines/tinsel/music.cpp b/engines/tinsel/music.cpp
index b3bfbcc5dc..15406c5d43 100644
--- a/engines/tinsel/music.cpp
+++ b/engines/tinsel/music.cpp
@@ -281,6 +281,10 @@ void OpenMidiFiles() {
if (TinselV0 || TinselV2)
return;
+ // TODO: The Macintosh version does not use MIDI for music
+ if (TinselV1Mac)
+ return;
+
if (g_midiBuffer.pDat)
// already allocated
return;
diff --git a/engines/tinsel/palette.cpp b/engines/tinsel/palette.cpp
index e6c9467fab..544dc03893 100644
--- a/engines/tinsel/palette.cpp
+++ b/engines/tinsel/palette.cpp
@@ -546,7 +546,7 @@ void CreateTranslucentPalette(SCNHANDLE hPalette) {
// leave background color alone
g_transPalette[0] = 0;
- for (uint i = 0; i < FROM_LE_32(pPal->numColors); i++) {
+ for (uint i = 0; i < FROM_32(pPal->numColors); i++) {
// get the RGB color model values
uint8 red = TINSEL_GetRValue(pPal->palRGB[i]);
uint8 green = TINSEL_GetGValue(pPal->palRGB[i]);
diff --git a/engines/tinsel/play.cpp b/engines/tinsel/play.cpp
index 9e0baa749e..718ee7f0e3 100644
--- a/engines/tinsel/play.cpp
+++ b/engines/tinsel/play.cpp
@@ -81,7 +81,7 @@ static void PokeInPalette(SCNHANDLE hMulFrame) {
pFrame = (const FRAME *)LockMem(hMulFrame);
// get pointer to image
- pim = (IMAGE *)LockMem(READ_LE_UINT32(pFrame)); // handle to image
+ pim = (IMAGE *)LockMem(READ_32(pFrame)); // handle to image
pim->hImgPal = TO_LE_32(BgPal());
}
@@ -451,10 +451,10 @@ static void t1PlayReel(CORO_PARAM, const PPINIT *ppi) {
_ctx->pfreel = &pfilm->reels[ppi->column];
// Get the MULTI_INIT structure
- pmi = (const MULTI_INIT *)LockMem(FROM_LE_32(_ctx->pfreel->mobj));
+ pmi = (const MULTI_INIT *)LockMem(FROM_32(_ctx->pfreel->mobj));
// Save actor's ID
- _ctx->reelActor = (int32)FROM_LE_32(pmi->mulID);
+ _ctx->reelActor = (int32)FROM_32(pmi->mulID);
/**** New (experimental? bit 5/1/95 ****/
if (!TinselV0 && !actorAlive(_ctx->reelActor))
@@ -488,7 +488,7 @@ static void t1PlayReel(CORO_PARAM, const PPINIT *ppi) {
return;
// Poke in the background palette
- PokeInPalette(FROM_LE_32(pmi->hMulFrame));
+ PokeInPalette(FROM_32(pmi->hMulFrame));
// Set up and insert the multi-object
_ctx->pPlayObj = MultiInitObject(pmi);
@@ -534,7 +534,7 @@ static void t1PlayReel(CORO_PARAM, const PPINIT *ppi) {
if (ppi->actorid == 0 && !actorAlive(_ctx->reelActor))
_ctx->lifeNoMatter = true;
- InitStepAnimScript(&_ctx->thisAnim, _ctx->pPlayObj, FROM_LE_32(_ctx->pfreel->script), ppi->speed);
+ InitStepAnimScript(&_ctx->thisAnim, _ctx->pPlayObj, FROM_32(_ctx->pfreel->script), ppi->speed);
// If first column, set Z position as per
// Otherwise, column 0's + column number
@@ -952,10 +952,10 @@ void NewestFilm(SCNHANDLE film, const FREEL *reel) {
const MULTI_INIT *pmi; // MULTI_INIT structure
// Get the MULTI_INIT structure
- pmi = (const MULTI_INIT *)LockMem(FROM_LE_32(reel->mobj));
+ pmi = (const MULTI_INIT *)LockMem(FROM_32(reel->mobj));
- if (!TinselV2 || ((int32)FROM_LE_32(pmi->mulID) != -2))
- SetActorLatestFilm((int32)FROM_LE_32(pmi->mulID), film);
+ if (!TinselV2 || ((int32)FROM_32(pmi->mulID) != -2))
+ SetActorLatestFilm((int32)FROM_32(pmi->mulID), film);
}
// *******************************************************
@@ -988,7 +988,7 @@ void PlayFilm(CORO_PARAM, SCNHANDLE hFilm, int x, int y, int actorid, bool splay
ppi.y = y;
ppi.z = 0;
ppi.bRestore = false;
- ppi.speed = (ONE_SECOND / FROM_LE_32(pFilm->frate));
+ ppi.speed = (ONE_SECOND / FROM_32(pFilm->frate));
ppi.actorid = actorid;
ppi.splay = splay;
ppi.bTop = bTop;
@@ -997,7 +997,7 @@ void PlayFilm(CORO_PARAM, SCNHANDLE hFilm, int x, int y, int actorid, bool splay
ppi.myescEvent = myescEvent;
// Start display process for each reel in the film
- for (int i = FROM_LE_32(pFilm->numreels) - 1; i >= 0; i--) {
+ for (int i = FROM_32(pFilm->numreels) - 1; i >= 0; i--) {
NewestFilm(hFilm, &pFilm->reels[i]);
ppi.column = i;
diff --git a/engines/tinsel/scene.cpp b/engines/tinsel/scene.cpp
index c5444517f1..37088fd515 100644
--- a/engines/tinsel/scene.cpp
+++ b/engines/tinsel/scene.cpp
@@ -167,7 +167,7 @@ static void SceneTinselProcess(CORO_PARAM, const void *param) {
assert(_ctx->pInit->hTinselCode); // Must have some code to run
_ctx->pic = InitInterpretContext(GS_SCENE,
- READ_LE_UINT32(&_ctx->pInit->hTinselCode),
+ READ_32(&_ctx->pInit->hTinselCode),
TinselV2 ? _ctx->pInit->event : NOEVENT,
NOPOLY, // No polygon
0, // No actor
@@ -265,8 +265,8 @@ static void LoadScene(SCNHANDLE scene, int entry) {
StartTaggedActors(FROM_LE_32(ss->hTaggedActor), FROM_LE_32(ss->numTaggedActor), true);
// Run the appropriate entrance code (if any)
- es = (const ENTRANCE_STRUC *)LockMem(FROM_LE_32(ss->hEntrance));
- for (i = 0; i < FROM_LE_32(ss->numEntrance); i++) {
+ es = (const ENTRANCE_STRUC *)LockMem(FROM_32(ss->hEntrance));
+ for (i = 0; i < FROM_32(ss->numEntrance); i++) {
if (FROM_LE_32(es->eNumber) == (uint)entry) {
if (es->hScript) {
init.event = STARTUP;
diff --git a/engines/tinsel/tinsel.h b/engines/tinsel/tinsel.h
index 123249125e..02a0d0faf3 100644
--- a/engines/tinsel/tinsel.h
+++ b/engines/tinsel/tinsel.h
@@ -135,6 +135,8 @@ typedef bool (*KEYFPTR)(const Common::KeyState &);
#define READ_16(v) (TinselV1Mac ? READ_BE_UINT16(v) : READ_LE_UINT16(v))
#define READ_32(v) (TinselV1Mac ? READ_BE_UINT32(v) : READ_LE_UINT32(v))
+#define FROM_16(v) (TinselV1Mac ? FROM_BE_16(v) : FROM_LE_16(v))
+#define FROM_32(v) (TinselV1Mac ? FROM_BE_32(v) : FROM_LE_32(v))
// Global reference to the TinselEngine object
extern TinselEngine *_vm;