aboutsummaryrefslogtreecommitdiff
path: root/engines
diff options
context:
space:
mode:
authorGregory Montoir2006-11-18 01:20:41 +0000
committerGregory Montoir2006-11-18 01:20:41 +0000
commitdd075b312f161b3f3f6f89355a05b7bc05e3f52d (patch)
treee7833018a542e3ffd791f404f06df3efa813c862 /engines
parent51a964d05683f8a96d57aa747249650351925879 (diff)
downloadscummvm-rg350-dd075b312f161b3f3f6f89355a05b7bc05e3f52d.tar.gz
scummvm-rg350-dd075b312f161b3f3f6f89355a05b7bc05e3f52d.tar.bz2
scummvm-rg350-dd075b312f161b3f3f6f89355a05b7bc05e3f52d.zip
fixed palette glitches during introduction/on restart, cleanup
svn-id: r24728
Diffstat (limited to 'engines')
-rw-r--r--engines/touche/opcodes.cpp31
-rw-r--r--engines/touche/resource.cpp16
-rw-r--r--engines/touche/touche.cpp28
-rw-r--r--engines/touche/touche.h1
4 files changed, 32 insertions, 44 deletions
diff --git a/engines/touche/opcodes.cpp b/engines/touche/opcodes.cpp
index b8832799cc..28cb2ddb61 100644
--- a/engines/touche/opcodes.cpp
+++ b/engines/touche/opcodes.cpp
@@ -414,7 +414,8 @@ void ToucheEngine::op_setFlag() {
case 618:
showCursor(val == 0);
break;
- default:
+ case 619:
+ debug(0, "Unknown music flag %d", val);
break;
}
}
@@ -468,32 +469,6 @@ void ToucheEngine::op_initKeyCharTalk() {
void ToucheEngine::op_loadRoom() {
debugC(9, kDebugOpcodes, "ToucheEngine::op_loadRoom()");
int16 num = _script.readNextWord();
- if (_currentEpisodeNum == 27 && num == 34 && _currentRoomNum != 58) {
- //
- // Workaround to what appears to be a scripting bug. The script
- // 27 triggers a palette fading just after loading the room 34.
- // Set flag 115, so that only *one* palette refresh occurs.
- //
- // [0086] (13) ST[0] = 1
- // [0089] (1E) FLAGS[606] = ST[0]
- // [008C] (34) LOAD_ROOM(34)
- // [xxxx] ...
- // [00B4] (84) START_PALETTE_FADE_IN(20)
- //
- _flagsTable[115] = 1;
- }
- if (_currentEpisodeNum == 100 && num == 1 && _currentRoomNum == 2) {
- //
- // Same problem in script 100...
- //
- // [021F] (34) LOAD_ROOM(1)
- // [xxxx] ...
- // [023D] (13) ST[0] = 1
- // [0240] (1E) FLAGS[604] = ST[0]
- // [0243] (84) START_PALETTE_FADE_IN(2)
- //
- _flagsTable[115] = 1;
- }
res_loadRoom(num);
}
@@ -740,7 +715,7 @@ void ToucheEngine::op_setupWaitingKeyChars() {
}
void ToucheEngine::op_updateRoomAreas() {
- debugC(9, kDebugOpcodes, "ToucheEngine::op_setupWaitingKeyChars()");
+ debugC(9, kDebugOpcodes, "ToucheEngine::op_updateRoomAreas()");
int16 area = _script.readNextWord();
updateRoomAreas(area, 1);
}
diff --git a/engines/touche/resource.cpp b/engines/touche/resource.cpp
index 5850762848..f0edfcf5f6 100644
--- a/engines/touche/resource.cpp
+++ b/engines/touche/resource.cpp
@@ -409,6 +409,8 @@ void ToucheEngine::res_loadRoom(int num) {
_currentRoomNum = num;
_updatedRoomAreasTable[0] = 1;
+ debug(0, "Setting up room %d", num);
+
const uint32 offsInfo = res_getDataOffset(kResourceTypeRoomInfo, num);
_fData.seek(offsInfo);
_fData.skip(2);
@@ -423,9 +425,21 @@ void ToucheEngine::res_loadRoom(int num) {
_fData.seek(offsImage);
res_loadBackdrop();
- if (_flagsTable[115] == 0) {
+ bool updateScreenPalette = _flagsTable[115] == 0;
+
+ // Workaround to what appears to be a scripting bug. Scripts 27 and 100 triggers
+ // a palette fading just after loading a room. Catch this, so that only *one*
+ // palette refresh occurs.
+ if ((_currentEpisodeNum == 27 && num == 34) || (_currentEpisodeNum == 100 && num == 1)) {
+ updateScreenPalette = false;
+ }
+
+ if (updateScreenPalette) {
updatePalette();
+ } else {
+ setPalette(0, 255, 0, 0, 0);
}
+
_fullRedrawCounter = 1;
_roomNeedRedraw = true;
diff --git a/engines/touche/touche.cpp b/engines/touche/touche.cpp
index 7efd80a16d..f4b2ec21ea 100644
--- a/engines/touche/touche.cpp
+++ b/engines/touche/touche.cpp
@@ -41,10 +41,11 @@ ToucheEngine::ToucheEngine(OSystem *system, Common::Language language)
_screenRect = Common::Rect(640, 400);
_roomAreaRect = Common::Rect(640, 352);
- clearDirtyRects();
memset(_flagsTable, 0, sizeof(_flagsTable));
+ clearDirtyRects();
+
_playSoundCounter = 0;
_processRandomPaletteCounter = 0;
@@ -114,6 +115,8 @@ void ToucheEngine::restart() {
memset(_flagsTable, 0, sizeof(_flagsTable));
+ clearDirtyRects();
+
_currentKeyCharNum = 0;
initKeyChars(-1);
@@ -183,6 +186,7 @@ void ToucheEngine::restart() {
memset(_conversationChoicesTable, 0, sizeof(_conversationChoicesTable));
_flagsTable[901] = 1;
+// _flagsTable[902] = 1;
if (_language == Common::FR_FRA) {
_flagsTable[621] = 1;
}
@@ -1660,14 +1664,14 @@ void ToucheEngine::handleMouseClickOnRoom(int flag) {
}
}
} else {
- if (flag) {
+ if (flag == 0) {
drawHitBoxes();
}
}
}
void ToucheEngine::handleMouseClickOnInventory(int flag) {
- if (flag) {
+ if (flag == 0) {
drawHitBoxes();
}
if (_hideInventoryTexts && _giveItemToCounter == 0) {
@@ -1873,7 +1877,6 @@ void ToucheEngine::addRoomArea(int num, int flag) {
debugC(9, kDebugEngine, "ToucheEngine::addRoomArea(%d, %d)", num, flag);
if (_flagsTable[flag] == 20000) {
Area area = _programBackgroundTable[num].area;
- addToDirtyRect(area.r);
area.r.translate(-_flagsTable[614], -_flagsTable[615]);
addToDirtyRect(area.r);
}
@@ -1899,9 +1902,10 @@ void ToucheEngine::updateRoomAreas(int num, int flags) {
area.r.width(), area.r.height(),
Graphics::kTransparent);
if (flags != 0) {
- addToDirtyRect(area.r);
- area.r.translate(-_flagsTable[614], -_flagsTable[615]);
- addToDirtyRect(area.r);
+ debug(0, "updateRoomAreas(num=%d index=%d)", num, i);
+ redrawRoomRegion(i, true);
+// area.r.translate(-_flagsTable[614], -_flagsTable[615]);
+// addToDirtyRect(area.r);
}
}
}
@@ -1920,7 +1924,7 @@ void ToucheEngine::findAndRedrawRoomRegion(int num) {
debugC(9, kDebugEngine, "ToucheEngine::findAndRedrawRoomRegion(%d)", num);
for (uint i = 0; i < _programAreaTable.size(); ++i) {
if (_programAreaTable[i].id == num) {
- redrawRoomRegion(i, 0);
+ redrawRoomRegion(i, false);
break;
}
}
@@ -3201,7 +3205,7 @@ void ToucheEngine::addToDirtyRect(const Common::Rect &r) {
if (index != -1) {
_dirtyRectsTable[index].extend(dirtyRect);
} else if (_dirtyRectsTableCount == NUM_DIRTY_RECTS) {
- // trigger full screen redraw
+ debug(0, "Too many dirty rects, performing full screen update");
_fullRedrawCounter = 1;
} else {
_dirtyRectsTable[_dirtyRectsTableCount] = dirtyRect;
@@ -3256,11 +3260,7 @@ void ToucheEngine::updateDirtyScreenAreas() {
for (int i = 0; i < _dirtyRectsTableCount; ++i) {
const Common::Rect &r = _dirtyRectsTable[i];
#if 0
- const int pts[4] = { r.left, r.top, r.right - 1, r.bottom - 1 };
- Graphics::drawLine(_offscreenBuffer, 640, pts[0], pts[1], pts[2], pts[1], 0xFF);
- Graphics::drawLine(_offscreenBuffer, 640, pts[2], pts[1], pts[2], pts[3], 0xFF);
- Graphics::drawLine(_offscreenBuffer, 640, pts[0], pts[3], pts[2], pts[3], 0xFF);
- Graphics::drawLine(_offscreenBuffer, 640, pts[0], pts[1], pts[0], pts[3], 0xFF);
+ Graphics::drawRect(_offscreenBuffer, 640, r.left, r.top, r.width(), r.height(), 0xFF, 0xFF);
#endif
_system->copyRectToScreen(_offscreenBuffer + r.top * 640 + r.left, 640, r.left, r.top, r.width(), r.height());
}
diff --git a/engines/touche/touche.h b/engines/touche/touche.h
index 8bc52fbada..9284374b19 100644
--- a/engines/touche/touche.h
+++ b/engines/touche/touche.h
@@ -321,7 +321,6 @@ public:
enum {
NUM_FLAGS = 2000,
NUM_KEYCHARS = 32,
- NUM_AREAS = 10,
NUM_SPRITES = 7,
NUM_SEQUENCES = 7,
NUM_CONVERSATION_CHOICES = 40,