From 2a871cfef20d1a55abea1be090ed6473f43019e0 Mon Sep 17 00:00:00 2001 From: Sven Hesse Date: Sun, 4 Mar 2007 15:34:58 +0000 Subject: - Some minor fixes - Added the Gob2 Mac version fac76 reported in bug #1673397 svn-id: r25977 --- engines/gob/detection.cpp | 16 ++++++++++++++ engines/gob/draw_v2.cpp | 55 +++++++++++++++++++++-------------------------- engines/gob/game_v2.cpp | 5 ----- engines/gob/init_v2.cpp | 9 ++++++-- engines/gob/inter_v2.cpp | 20 +++++++---------- engines/gob/mult_v2.cpp | 5 +---- 6 files changed, 56 insertions(+), 54 deletions(-) diff --git a/engines/gob/detection.cpp b/engines/gob/detection.cpp index 9b48407a10..89f563a415 100644 --- a/engines/gob/detection.cpp +++ b/engines/gob/detection.cpp @@ -356,6 +356,22 @@ static const GOBGameDescription gameDescriptions[] = { GF_GOB2, "intro" }, + { // Supplied by fac76 in bug report #1673397 + { + "gob2", + "", + { + {"intro.stk", 0, "b45b984ee8017efd6ea965b9becd4d66", 828443}, + {"musmac1.mid", 0, "7f96f491448c7a001b32df89cf8d2af2", 1658}, + {NULL, 0, NULL, 0} + }, + UNK_LANG, + kPlatformMacintosh, + Common::ADGF_NO_FLAGS + }, + GF_GOB2, + "intro" + }, { { "gob2", diff --git a/engines/gob/draw_v2.cpp b/engines/gob/draw_v2.cpp index 49069c2861..4a764fd257 100644 --- a/engines/gob/draw_v2.cpp +++ b/engines/gob/draw_v2.cpp @@ -41,9 +41,9 @@ Draw_v2::Draw_v2(GobEngine *vm) : Draw_v1(vm) { void Draw_v2::printText(void) { int i; - char *dataPtr; - char *ptr; - char *ptr2; + byte *dataPtr; + byte *ptr; + byte *ptr2; char mask[80]; char str[80]; char buf[50]; @@ -86,39 +86,32 @@ void Draw_v2::printText(void) { } size = _vm->_game->_totTextData->items[index].size; - dataPtr = _vm->_game->_totTextData->dataPtr + _vm->_game->_totTextData->items[index].offset; + dataPtr = ((byte *) _vm->_game->_totTextData->dataPtr) + + _vm->_game->_totTextData->items[index].offset; ptr = dataPtr; if ((_renderFlags & 0x400) && (ptr[1] & 0x80)) return; + destX = READ_LE_UINT16(ptr) & 0x7FFF; + destY = READ_LE_UINT16(ptr + 2); + spriteRight = READ_LE_UINT16(ptr + 4); + spriteBottom = READ_LE_UINT16(ptr + 6); + ptr += 8; + if (_renderFlags & RENDERFLAG_CAPTUREPUSH) { - _destSpriteX = READ_LE_UINT16(ptr) & 0x7FFF; - _destSpriteY = READ_LE_UINT16(ptr + 2); - _spriteRight = READ_LE_UINT16(ptr + 4) - _destSpriteX + 1; - _spriteBottom = READ_LE_UINT16(ptr + 6) - _destSpriteY + 1; - _vm->_game->capturePush(_destSpriteX, _destSpriteY, - _spriteRight, _spriteBottom); + _vm->_game->capturePush(destX, destY, + spriteRight - destX + 1, spriteBottom - destY + 1); (*_vm->_scenery->_pCaptureCounter)++; } - - _destSpriteX = READ_LE_UINT16(ptr) & 0x7FFF; - destX = _destSpriteX; - - _destSpriteY = READ_LE_UINT16(ptr + 2); - destY = _destSpriteY; - - _spriteRight = READ_LE_UINT16(ptr + 4); - spriteRight = _spriteRight; - - _spriteBottom = READ_LE_UINT16(ptr + 6); - spriteBottom = _spriteBottom; + _destSpriteX = destX; + _destSpriteY = destY; + _spriteRight = spriteRight; + _spriteBottom = spriteBottom; _destSurface = 21; - ptr += 8; - - _backColor = (byte) *ptr++; + _backColor = *ptr++; _transparency = 1; spriteOperation(DRAW_CLEARRECT); @@ -151,7 +144,7 @@ void Draw_v2::printText(void) { // Adding the boundary check *shouldn't* pose any problems, since access behind // that point should be forbidden anyway. - for (i = 0, ptr2 = ptr; ((ptr2 - dataPtr) < size) && (*ptr2 != 1); ptr2++, i++) { + for (i = 0, ptr2 = ptr; ((ptr2 - dataPtr) < size) && (*ptr2 != 1); i++) { if ((_vm->_game->_totFileData[0x29] < 0x32) && (*ptr2 > 3) && (*ptr2 < 32)) *ptr2 = 32; @@ -171,7 +164,7 @@ void Draw_v2::printText(void) { case 6: ptr2++; - switch (*ptr & 0xC0) { + switch (*ptr2 & 0xC0) { case 0x40: ptr2 += 9; break; @@ -188,7 +181,7 @@ void Draw_v2::printText(void) { break; case 10: - ptr2 += (((byte) ptr2[1]) * 2) + 2; + ptr2 += (ptr2[1] * 2) + 2; break; default: @@ -214,7 +207,7 @@ void Draw_v2::printText(void) { _transparency = 1; while (true) { - if ((*ptr >= 1) && ((*ptr <= 7) || (*ptr == 10)) && (strPos != 0)) { + if ((((*ptr >= 1) && (*ptr <= 7)) || (*ptr == 10)) && (strPos != 0)) { str[MAX(strPos, strPos2)] = 0; strPosBak = strPos; width = strlen(str) * _fonts[fontIndex]->itemWidth; @@ -299,7 +292,7 @@ void Draw_v2::printText(void) { case 4: ptr++; - frontColor = (byte) *ptr++; + frontColor = *ptr++; break; case 6: @@ -341,7 +334,7 @@ void Draw_v2::printText(void) { case 10: // loc_12C93 str[0] = (char)255; - WRITE_LE_UINT16((uint16*)(str+1), ptr - _vm->_game->_totTextData->dataPtr); + WRITE_LE_UINT16((uint16*)(str+1), ((char *) ptr) - _vm->_game->_totTextData->dataPtr); str[3] = 0; ptr++; i = *ptr++; diff --git a/engines/gob/game_v2.cpp b/engines/gob/game_v2.cpp index 11d3743320..0f6a62da32 100644 --- a/engines/gob/game_v2.cpp +++ b/engines/gob/game_v2.cpp @@ -74,11 +74,6 @@ void Game_v2::playTot(int16 skipPlay) { while (!_vm->_quitRequested) { if (_vm->_global->_inter_variables != 0) _vm->_draw->animateCursor(4); - if (_vm->_platform == Common::kPlatformMacintosh) { - if (_vm->_adlib) - _vm->_adlib->stopPlay(); - } else - _vm->_cdrom->stopPlaying(); if (skipPlay != -1) { _vm->_inter->initControlVars(1); diff --git a/engines/gob/init_v2.cpp b/engines/gob/init_v2.cpp index e8ab0283da..1c5c8790fd 100644 --- a/engines/gob/init_v2.cpp +++ b/engines/gob/init_v2.cpp @@ -53,8 +53,13 @@ void Init_v2::soundVideo(int32 smallHeap, int16 flag) { _vm->_global->_sprAllocated = 0; _vm->_gtimer->enableTimer(); - if ((_vm->_global->_videoMode == 0x13) || (_vm->_global->_videoMode == 0x14)) - _vm->_global->_colorCount = 256; + if ((_vm->_platform == Common::kPlatformPC) || (_vm->_platform == Common::kPlatformMacintosh)) { + if ((_vm->_global->_videoMode == 0x13) || (_vm->_global->_videoMode == 0x14)) + _vm->_global->_colorCount = 256; + else + _vm->_global->_colorCount = 16; + } else + _vm->_global->_colorCount = 16; _vm->_global->_pPaletteDesc = &_vm->_global->_paletteStruct; _vm->_global->_pPaletteDesc->vgaPal = _vm->_draw->_vgaPalette; diff --git a/engines/gob/inter_v2.cpp b/engines/gob/inter_v2.cpp index 987fe597ca..2bcf2deeec 100644 --- a/engines/gob/inter_v2.cpp +++ b/engines/gob/inter_v2.cpp @@ -1545,7 +1545,6 @@ bool Inter_v2::o2_playSound(char &cmdCount, int16 &counter, int16 &retFlag) { repCount = _vm->_parse->parseValExpr(); frequency = _vm->_parse->parseValExpr(); - warning("playSound(%d, %d, %d)", index, repCount, frequency); _soundEndTimeKey = 0; if (_vm->_game->_soundSamples[index] == 0) return false; @@ -1715,56 +1714,55 @@ bool Inter_v2::o2_palLoad(char &cmdCount, int16 &counter, int16 &retFlag) { switch (cmd & 0x7f) { case 48: - if ((_vm->_global->_videoMode < 0x32) || (_vm->_global->_videoMode > 0x63)) { + if ((_vm->_global->_fakeVideoMode < 0x32) || (_vm->_global->_fakeVideoMode > 0x63)) { _vm->_global->_inter_execPtr += 48; return false; } break; case 49: - if ((_vm->_global->_videoMode != 5) && (_vm->_global->_videoMode != 7)) { + if ((_vm->_global->_fakeVideoMode != 5) && (_vm->_global->_fakeVideoMode != 7)) { _vm->_global->_inter_execPtr += 18; return false; } break; case 50: - if ((_vm->_global->_videoMode != 0x0D) || (_vm->_global->_colorCount == 256)) { + if (_vm->_global->_colorCount == 256) { _vm->_global->_inter_execPtr += 16; return false; } break; case 51: - if (_vm->_global->_videoMode < 0x64) { + if (_vm->_global->_fakeVideoMode < 0x64) { _vm->_global->_inter_execPtr += 2; return false; } break; case 52: - if ((_vm->_platform == Common::kPlatformPC) && - ((_vm->_global->_videoMode != 0x0D) || (_vm->_global->_colorCount == 256))) { + if (_vm->_global->_colorCount == 256) { _vm->_global->_inter_execPtr += 48; return false; } break; case 53: - if (_vm->_global->_videoMode < 0x13) { + if (_vm->_global->_colorCount != 256) { _vm->_global->_inter_execPtr += 2; return false; } break; case 54: - if (_vm->_global->_videoMode < 0x13) { + if (_vm->_global->_fakeVideoMode < 0x13) { return false; } break; case 61: - if (_vm->_global->_videoMode < 0x13) { + if (_vm->_global->_fakeVideoMode < 0x13) { *_vm->_global->_inter_execPtr += 4; return false; } @@ -1832,8 +1830,6 @@ bool Inter_v2::o2_palLoad(char &cmdCount, int16 &counter, int16 &retFlag) { _vm->_draw->_vgaPalette[i].green = _vm->_global->_inter_execPtr[1]; _vm->_draw->_vgaPalette[i].blue = _vm->_global->_inter_execPtr[2]; } - if ((_vm->_platform == Common::kPlatformPC) && _vm->_global->_videoMode >= 0x13) - return false; break; case 53: diff --git a/engines/gob/mult_v2.cpp b/engines/gob/mult_v2.cpp index 4a0e4fcfd6..7c1a2ec392 100644 --- a/engines/gob/mult_v2.cpp +++ b/engines/gob/mult_v2.cpp @@ -410,7 +410,6 @@ void Mult_v2::playMult(int16 startFrame, int16 endFrame, char checkEscape, _palFadingBlue = 0; _oldPalette = _vm->_global->_pPaletteDesc->vgaPal; -// memcpy((char *)_palAnimPalette, (char *)_vm->_global->_pPaletteDesc->vgaPal, 768); if (_vm->_anim->_animSurf == 0) { _vm->_util->setFrameRate(_multData->frameRate); @@ -694,9 +693,6 @@ char Mult_v2::prepPalAnim(char stop) { stop = 0; _doPalSubst = 0; _vm->_global->_pPaletteDesc->vgaPal = _oldPalette; - - memcpy((char *)_palAnimPalette, (char *)_vm->_global->_pPaletteDesc->vgaPal, 768); - _vm->_video->setFullPalette(_vm->_global->_pPaletteDesc); } else { stop = 0; @@ -708,6 +704,7 @@ char Mult_v2::prepPalAnim(char stop) { _multData->palAnimIndices[2] = 0; _multData->palAnimIndices[3] = 0; + memcpy((char *)_palAnimPalette, (char *)_vm->_global->_pPaletteDesc->vgaPal, 768); _vm->_global->_pPaletteDesc->vgaPal = _palAnimPalette; } return stop; -- cgit v1.2.3