aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorEugene Sandulenko2004-02-02 22:40:20 +0000
committerEugene Sandulenko2004-02-02 22:40:20 +0000
commit8a2496d6c5b11db615ab4d44a04b19e7dd9fef4c (patch)
treeeba631069495044c4d224d4616f018025765c18c
parentc40474322fba82e9715d1f4b5453c7bd03012eb6 (diff)
downloadscummvm-rg350-8a2496d6c5b11db615ab4d44a04b19e7dd9fef4c.tar.gz
scummvm-rg350-8a2496d6c5b11db615ab4d44a04b19e7dd9fef4c.tar.bz2
scummvm-rg350-8a2496d6c5b11db615ab4d44a04b19e7dd9fef4c.zip
Fixed most bugs, so only cosmetic visual things left.
o Support transparency for characters. Needed for cockpit rendering o Fixed bug in NUT renderer which drawed transparent characters garbled o Fixed long-standing (and outstanding) bug with SAUD error o Previous fix fixed music in some cases (scene transitions) o Fixed bug with palette being reset when smush video is rewind o Made debug level for insane adjustable at compile time (maybe I will remove it later) svn-id: r12717
-rw-r--r--scumm/insane/insane.cpp27
-rw-r--r--scumm/insane/insane.h9
-rw-r--r--scumm/insane/insane_ben.cpp12
-rw-r--r--scumm/insane/insane_iact.cpp32
-rw-r--r--scumm/insane/insane_scenes.cpp87
-rw-r--r--scumm/nut_renderer.cpp6
-rw-r--r--scumm/smush/saud_channel.cpp11
-rw-r--r--scumm/smush/smush_mixer.cpp1
-rw-r--r--scumm/smush/smush_player.cpp21
-rw-r--r--scumm/smush/smush_player.h1
10 files changed, 113 insertions, 94 deletions
diff --git a/scumm/insane/insane.cpp b/scumm/insane/insane.cpp
index ec76723db6..d05d6b8a6d 100644
--- a/scumm/insane/insane.cpp
+++ b/scumm/insane/insane.cpp
@@ -39,9 +39,8 @@
#include "scumm/insane/insane.h"
// TODO (in no particular order):
-// o SAUD complaining again
-// o Insane::postCase16() has workaround. Cockpit is not transparent so it is
-// disabled now
+// o Long TRS messages get rendered just in one line, so text overlaps
+// o Approaching enemy animation is wrong sometimes
// o Code review/cleanup
// o DOS demo INSANE
@@ -149,8 +148,8 @@ void Insane::initvars(void) {
_posFatherTorque = 0;
_posCave = 0;
_posVista = 0;
- _roadLeftBranch = false;
- _roadRightBranch = false;
+ _roadBranch = false;
+ _roadStop = false;
_carIsBroken = false;
_benHasGoggles = false;
_mineCaveIsNear = false;
@@ -756,7 +755,7 @@ int32 Insane::idx2Tweak(void) {
}
void Insane::smush_setToFinish(void) {
- debug(5, "Video is set to finish");
+ debug(INSANE_DBG, "Video is set to finish");
_vm->_videoFinished = 1;
}
@@ -800,7 +799,7 @@ void Insane::prepareScenePropScene(int32 scenePropNum, bool arg_4, bool arg_8) {
int tmp, idx = scenePropIdx[scenePropNum];
- debug(5, "Insane::prepareScenePropScene(%d, %d, %d)", scenePropNum, arg_4, arg_8);
+ debug(INSANE_DBG, "Insane::prepareScenePropScene(%d, %d, %d)", scenePropNum, arg_4, arg_8);
if (!loadScenePropSounds(idx))
return;
@@ -842,7 +841,7 @@ void Insane::queueSceneSwitch(int32 sceneId, byte *fluPtr, const char *filename,
int32 arg_C, int32 arg_10, int32 startFrame, int32 numFrames) {
int32 tmp;
- debug(5, "queueSceneSwitch(%d, *, %s, %d, %d, %d, %d)", sceneId, filename, arg_C, arg_10,
+ debug(INSANE_DBG, "queueSceneSwitch(%d, *, %s, %d, %d, %d, %d)", sceneId, filename, arg_C, arg_10,
startFrame, numFrames);
if (_needSceneSwitch || _sceneData1Loaded)
return;
@@ -861,7 +860,7 @@ void Insane::queueSceneSwitch(int32 sceneId, byte *fluPtr, const char *filename,
}
void Insane::smush_rewindCurrentSan(int arg_0, int arg_4, int arg_8) {
- debug(5, "smush_rewindCurrentSan(%d, %d, %d)", arg_0, arg_4, arg_8);
+ debug(INSANE_DBG, "smush_rewindCurrentSan(%d, %d, %d)", arg_0, arg_4, arg_8);
_smush_setupsan2 = arg_0;
smush_setupSanFile(0, 8, 0);
@@ -958,7 +957,7 @@ void Insane::escapeKeyHandler(void) {
if (_needSceneSwitch || _keyboardDisable)
return;
- debug(5, "scene: %d", _currSceneId);
+ debug(INSANE_DBG, "scene: %d", _currSceneId);
switch (_currSceneId) {
case 1:
queueSceneSwitch(1, _smush_minedrivFlu, "minedriv.san", 64, 0, _continueFrame1, 1300);
@@ -1184,7 +1183,6 @@ void Insane::smlayer_setActorLayer(int actornum, int actnum, int layer) {
}
void Insane::smlayer_setFluPalette(byte *pal, int shut_flag) {
- // FIXME. We can't run it without SmushPlayer object
// if (shut_flag)
// // FIXME: shut colors and make picture appear smoothly
// SmushPlayer::setPalette(pal);
@@ -1340,7 +1338,7 @@ void Insane::smlayer_setActorFacing(int actornum, int actnum, int frame, int dir
}
const char *Insane::handleTrsTag(int32 trsId) {
- debug(5, "Insane::handleTrsTag(%d)", trsId);
+ debug(INSANE_DBG, "Insane::handleTrsTag(%d)", trsId);
return _player->getString(trsId);
}
@@ -1392,7 +1390,7 @@ void Insane::smush_setupSanWithFlu(const char *filename, int32 setupsan2, int32
byte *tmp = fluPtr;
int32 offset;
- debug(5, "smush_setupSanWithFlu(%s, %d, %d, %d, %d, %lx, %d)", filename, setupsan2,
+ debug(INSANE_DBG, "smush_setupSanWithFlu(%s, %d, %d, %d, %d, %lx, %d)", filename, setupsan2,
step1, step2, setupsan1, fluPtr, numFrames);
_smush_setupsan1 = setupsan1;
@@ -1428,6 +1426,7 @@ void Insane::smush_setupSanWithFlu(const char *filename, int32 setupsan2, int32
void Insane::smush_setupSanFromStart(const char *filename, int32 setupsan2, int32 step1,
int32 step2, int32 setupsan1) {
+ debug(INSANE_DBG, "Insane::smush_setupFromStart(%s)", filename);
_smush_setupsan1 = setupsan1;
_smush_setupsan2 = setupsan2;
smush_setupSanFile(filename, 8, 0);
@@ -1443,7 +1442,7 @@ void Insane::smush_setFrameSteps(int32 step1, int32 step2) {
}
void Insane::smush_setupSanFile(const char *filename, int32 offset, int32 contFrame) {
- debug(5, "smush_setupSanFile(%s, %x, %d)", filename, offset, contFrame);
+ debug(INSANE_DBG, "Insane::smush_setupSanFile(%s, %x, %d)", filename, offset, contFrame);
_player->seekSan(filename, _vm->getGameDataPath(), offset, contFrame);
diff --git a/scumm/insane/insane.h b/scumm/insane/insane.h
index 94dc28c446..ef2134dcd7 100644
--- a/scumm/insane/insane.h
+++ b/scumm/insane/insane.h
@@ -51,6 +51,8 @@ namespace Scumm {
#define EN_TORQUE 8 // Father Torque
#define EN_BEN 9 // used only with handler
+#define INSANE_DBG 5
+
class Insane {
public:
Insane(ScummEngine_v6 *scumm);
@@ -163,8 +165,8 @@ class Insane {
int16 _posFatherTorque;
int16 _posCave;
int16 _posVista;
- bool _roadLeftBranch;
- bool _roadRightBranch;
+ bool _roadBranch;
+ bool _roadStop;
bool _carIsBroken;
bool _benHasGoggles;
bool _mineCaveIsNear;
@@ -268,9 +270,6 @@ class Insane {
void readFileToMem(const char *name, byte **buf);
void startVideo(const char *filename, int num, int argC, int frameRate,
int doMainLoop, byte *fluPtr = 0, int32 numFrames = 0);
- void smush_proc39(void);
- void smush_proc40(void);
- void smush_proc41(void);
void smush_warpMouse(int x, int y, int buttons);
void putActors(void);
void readState(void);
diff --git a/scumm/insane/insane_ben.cpp b/scumm/insane/insane_ben.cpp
index a270ca46c4..717ddc4230 100644
--- a/scumm/insane/insane_ben.cpp
+++ b/scumm/insane/insane_ben.cpp
@@ -254,7 +254,7 @@ void Insane::mineChooseRoad(int32 buttons) {
smush_setToFinish();
}
- if (_roadLeftBranch && !_needSceneSwitch) {
+ if (_roadBranch && !_needSceneSwitch) {
_iactSceneId2 = _iactSceneId;
queueSceneSwitch(2, 0, "mineexit.san", 64, 0, 0, 0);
}
@@ -275,7 +275,7 @@ void Insane::mineChooseRoad(int32 buttons) {
drawSpeedyActor(buttons);
- if ((buttons & 1) && _currSceneId == 1 && _roadLeftBranch && !_needSceneSwitch) {
+ if ((buttons & 1) && _currSceneId == 1 && _roadBranch && !_needSceneSwitch) {
_iactSceneId2 = _iactSceneId;
queueSceneSwitch(2, 0, "mineexit.san", 64, 0, 0, 0);
}
@@ -301,7 +301,7 @@ void Insane::mineChooseRoad(int32 buttons) {
if ((buttons & 1) == 0)
return;
- if (_roadLeftBranch && !_needSceneSwitch) {
+ if (_roadBranch && !_needSceneSwitch) {
_iactSceneId2 = _iactSceneId;
if (readArray(4) && _val211d < 3) {
@@ -312,7 +312,7 @@ void Insane::mineChooseRoad(int32 buttons) {
}
}
- if (_roadRightBranch) {
+ if (_roadStop) {
writeArray(1, _posBrokenTruck);
writeArray(3, _val57d);
smush_setToFinish();
@@ -338,7 +338,7 @@ void Insane::mineChooseRoad(int32 buttons) {
if ((buttons & 1) == 0)
return;
- if (_roadLeftBranch && !_needSceneSwitch) {
+ if (_roadBranch && !_needSceneSwitch) {
_iactSceneId2 = _iactSceneId;
if (readArray(4) && _val211d < 3) {
@@ -349,7 +349,7 @@ void Insane::mineChooseRoad(int32 buttons) {
}
}
- if (_roadRightBranch) {
+ if (_roadStop) {
writeArray(1, _posBrokenTruck);
writeArray(3, _posVista);
smush_setToFinish();
diff --git a/scumm/insane/insane_iact.cpp b/scumm/insane/insane_iact.cpp
index 1d5aaf099a..155bb9b3eb 100644
--- a/scumm/insane/insane_iact.cpp
+++ b/scumm/insane/insane_iact.cpp
@@ -133,20 +133,18 @@ void Insane::iactScene1(byte *renderBitmap, int32 codecparam, int32 setupsan12,
case 6:
switch (par2) {
case 38:
- // left branch sign
smlayer_drawSomething(renderBitmap, codecparam, 50-19, 20-13, 3,
_smush_iconsNut, 7, 0, 0);
- _roadLeftBranch = true;
+ _roadBranch = true;
_iactSceneId = par4;
break;
case 7:
if (readArray(4) != 0)
return;
- // right branch sign
- smlayer_drawSomething(renderBitmap, codecparam, 160-19, 20-13, 3,
+ smlayer_drawSomething(renderBitmap, codecparam, 160-13, 20-10, 3, // QW
_smush_icons2Nut, 8, 0, 0);
- _roadRightBranch = true;
+ _roadStop = true;
break;
case 8:
if (readArray(4) == 0 || readArray(6) == 0)
@@ -437,16 +435,16 @@ void Insane::iactScene4(byte *renderBitmap, int32 codecparam, int32 setupsan12,
smlayer_drawSomething(renderBitmap, codecparam, 270-19, 20-13, 3,
_smush_icons2Nut, 10, 0, 0);
- _roadLeftBranch = true;
+ _roadBranch = true;
_iactSceneId = par4;
break;
case 7:
if (readArray(4) != 0)
return;
- smlayer_drawSomething(renderBitmap, codecparam, 160-19, 20-13, 3,
+ smlayer_drawSomething(renderBitmap, codecparam, 160-13, 20-10, 3, // QW
_smush_icons2Nut, 8, 0, 0);
- _roadRightBranch = true;
+ _roadStop = true;
break;
case 8:
if (readArray(4) == 0 || readArray(6) == 0)
@@ -462,13 +460,13 @@ void Insane::iactScene4(byte *renderBitmap, int32 codecparam, int32 setupsan12,
return;
_carIsBroken = true;
- smlayer_drawSomething(renderBitmap, codecparam, 160-12, 20-10, 3,
+ smlayer_drawSomething(renderBitmap, codecparam, 160-13, 20-10, 3, // QW
_smush_icons2Nut, 8, 0, 0);
break;
case 11:
smlayer_drawSomething(renderBitmap, codecparam, 50-19, 20-13, 3,
_smush_icons2Nut, 9, 0, 0);
- _roadLeftBranch = true;
+ _roadBranch = true;
_iactSceneId = par4;
break;
}
@@ -528,15 +526,15 @@ void Insane::iactScene6(byte *renderBitmap, int32 codecparam, int32 setupsan12,
case 38:
smlayer_drawSomething(renderBitmap, codecparam, 270-19, 20-13, 3,
_smush_icons2Nut, 10, 0, 0);
- _roadLeftBranch = true;
+ _roadBranch = true;
_iactSceneId = par4;
break;
case 7:
if (readArray(4) != 0)
return;
- _roadRightBranch = true;
- smlayer_drawSomething(renderBitmap, codecparam, 160-19, 20-13, 3,
+ _roadStop = true;
+ smlayer_drawSomething(renderBitmap, codecparam, 160-13, 20-10, 3, //QW
_smush_icons2Nut, 8, 0, 0);
break;
case 8:
@@ -553,13 +551,13 @@ void Insane::iactScene6(byte *renderBitmap, int32 codecparam, int32 setupsan12,
return;
_carIsBroken = true;
- smlayer_drawSomething(renderBitmap, codecparam, 160-12, 20-10, 3,
+ smlayer_drawSomething(renderBitmap, codecparam, 160-13, 20-10, 3, //QW
_smush_icons2Nut, 8, 0, 0);
break;
case 11:
smlayer_drawSomething(renderBitmap, codecparam, 50-19, 20-13, 3,
_smush_icons2Nut, 9, 0, 0);
- _roadLeftBranch = true;
+ _roadBranch = true;
_iactSceneId = par4;
break;
}
@@ -591,7 +589,7 @@ void Insane::iactScene17(byte *renderBitmap, int32 codecparam, int32 setupsan12,
case 38:
smlayer_drawSomething(renderBitmap, codecparam, 28, 48, 1,
_smush_iconsNut, 6, 0, 0);
- _roadLeftBranch = true;
+ _roadBranch = true;
_iactSceneId = par4;
if (_counter1 <= 4) {
if (_counter1 == 4)
@@ -602,7 +600,7 @@ void Insane::iactScene17(byte *renderBitmap, int32 codecparam, int32 setupsan12,
}
_objectDetected = true;
break;
- case 11:
+ case 10:
smlayer_drawSomething(renderBitmap, codecparam, 28, 48, 1,
_smush_iconsNut, 6, 0, 0);
if (_counter1 <= 4) {
diff --git a/scumm/insane/insane_scenes.cpp b/scumm/insane/insane_scenes.cpp
index 7fde2c1b2b..daa15be229 100644
--- a/scumm/insane/insane_scenes.cpp
+++ b/scumm/insane/insane_scenes.cpp
@@ -55,7 +55,7 @@ void Insane::runScene(int arraynum) {
putActors();
readState();
- debug(5, "INSANE Arg: %d", readArray(0));
+ debug(INSANE_DBG, "INSANE Arg: %d", readArray(0));
switch (readArray(0)) {
case 1:
@@ -164,7 +164,7 @@ void Insane::runScene(int arraynum) {
}
int Insane::initScene(int sceneId) {
- debug(5, "initScene(%d)", sceneId);
+ debug(INSANE_DBG, "initScene(%d)", sceneId);
if (_needSceneSwitch)
return 1;
@@ -186,7 +186,7 @@ int Insane::initScene(int sceneId) {
void Insane::stopSceneSounds(int sceneId) {
int flag = 0;
- debug(5, "stopSceneSounds(%d)", sceneId);
+ debug(INSANE_DBG, "stopSceneSounds(%d)", sceneId);
switch (sceneId) {
case 1:
@@ -278,7 +278,7 @@ void Insane::stopSceneSounds(int sceneId) {
}
void Insane::shutCurrentScene(void) {
- debug(5, "shutCurrentScene()");
+ debug(INSANE_DBG, "shutCurrentScene()");
_currScenePropIdx = 0;
_currTrsMsg = 0;
@@ -307,7 +307,7 @@ void Insane::shutCurrentScene(void) {
int Insane::loadSceneData(int scene, int flag, int phase) {
int retvalue = 1;
- debug(5, "Insane::loadSceneData(%d, %d, %d)", scene, flag, phase);
+ debug(INSANE_DBG, "Insane::loadSceneData(%d, %d, %d)", scene, flag, phase);
//if (phase == 1) /// FIXME
// insane_unlock();
switch (scene) {
@@ -601,7 +601,7 @@ int Insane::loadSceneData(int scene, int flag, int phase) {
}
void Insane::setSceneCostumes(int sceneId) {
- debug(5, "Insane::setSceneCostumes(%d)", sceneId);
+ debug(INSANE_DBG, "Insane::setSceneCostumes(%d)", sceneId);
switch (sceneId) {
case 1:
@@ -651,7 +651,7 @@ void Insane::setSceneCostumes(int sceneId) {
void Insane::setEnemyCostumes(void) {
int i;
- debug(5, "setEnemyCostumes(%d)", _currEnemy);
+ debug(INSANE_DBG, "setEnemyCostumes(%d)", _currEnemy);
smlayer_setActorCostume(0, 2, readArray(12));
smlayer_setActorCostume(0, 0, readArray(14));
@@ -987,8 +987,8 @@ void Insane::postCase11(byte *renderBitmap, int32 codecparam, int32 setupsan12,
_continueFrame, 1300);
}
}
- _roadLeftBranch = false;
- _roadRightBranch = false;
+ _roadBranch = false;
+ _roadStop = false;
}
void Insane::postCase0(byte *renderBitmap, int32 codecparam, int32 setupsan12,
@@ -1002,8 +1002,8 @@ void Insane::postCase0(byte *renderBitmap, int32 codecparam, int32 setupsan12,
smush_rewindCurrentSan(1088, -1, -1);
_roadBumps = false;
- _roadLeftBranch = false;
- _roadRightBranch = false;
+ _roadBranch = false;
+ _roadStop = false;
_benHasGoggles = false;
_mineCaveIsNear = false;
_continueFrame1 = curFrame;
@@ -1022,8 +1022,8 @@ void Insane::postCase17(byte *renderBitmap, int32 codecparam, int32 setupsan12,
writeArray(9, 0);
}
}
- _roadLeftBranch = false;
- _roadRightBranch = false;
+ _roadBranch = false;
+ _roadStop = false;
}
void Insane::postCase16(byte *renderBitmap, int32 codecparam, int32 setupsan12,
@@ -1043,11 +1043,10 @@ void Insane::postCase16(byte *renderBitmap, int32 codecparam, int32 setupsan12,
smlayer_showStatusMsg(-1, renderBitmap, codecparam, 202, 168, 1, 2, 0, "%s", buf);
sprintf(buf, "^f01%02o", curFrame & 0xff);
- smlayer_showStatusMsg(-1, renderBitmap, codecparam, 140, 168, 1, 2, 0, "%s", buf);
+ smlayer_showStatusMsg(-1, renderBitmap, codecparam, 240, 168, 1, 2, 0, "%s", buf);
smlayer_showStatusMsg(-1, renderBitmap, codecparam, 170, 43, 1, 2, 0, "%s", buf);
- // FIXME: it should be transparent, so now it is disabled
- //smlayer_drawSomething(renderBitmap, codecparam, 0, 0, 1, _smush_bensgoggNut, 0, 0, 0);
+ smlayer_drawSomething(renderBitmap, codecparam, 0, 0, 1, _smush_bensgoggNut, 0, 0, 0);
if (!_objectDetected)
smlayer_drawSomething(renderBitmap, codecparam, 24, 170, 1,
@@ -1062,8 +1061,8 @@ void Insane::postCase16(byte *renderBitmap, int32 codecparam, int32 setupsan12,
}
_roadBumps = false;
_mineCaveIsNear = false;
- _roadLeftBranch = false;
- _roadRightBranch = false;
+ _roadBranch = false;
+ _roadStop = false;
_objectDetected = false;
_counter1++;
_continueFrame1 = curFrame;
@@ -1080,8 +1079,8 @@ void Insane::postCase1(byte *renderBitmap, int32 codecparam, int32 setupsan12,
queueSceneSwitch(flu->sceneId, *flu->fluPtr, flu->filenamePtr, 64, 0,
flu->startFrame, flu->numFrames);
}
- _roadLeftBranch = false;
- _roadRightBranch = false;
+ _roadBranch = false;
+ _roadStop = false;
}
void Insane::postCase2(byte *renderBitmap, int32 codecparam, int32 setupsan12,
@@ -1096,8 +1095,8 @@ void Insane::postCase2(byte *renderBitmap, int32 codecparam, int32 setupsan12,
smush_rewindCurrentSan(1088, -1, -1);
_roadBumps = false;
- _roadLeftBranch = false;
- _roadRightBranch = false;
+ _roadBranch = false;
+ _roadStop = false;
_continueFrame = curFrame;
}
@@ -1110,8 +1109,8 @@ void Insane::postCase20(byte *renderBitmap, int32 codecparam, int32 setupsan12,
smush_rewindCurrentSan(1088, -1, -1);
_roadBumps = false;
- _roadLeftBranch = false;
- _roadRightBranch = false;
+ _roadBranch = false;
+ _roadStop = false;
_continueFrame = curFrame;
}
@@ -1154,8 +1153,8 @@ void Insane::postCase3(byte *renderBitmap, int32 codecparam, int32 setupsan12,
}
_carIsBroken = false;
- _roadRightBranch = false;
- _roadLeftBranch = false;
+ _roadStop = false;
+ _roadBranch = false;
_iactSceneId = 0;
}
@@ -1186,8 +1185,8 @@ void Insane::postCase5(byte *renderBitmap, int32 codecparam, int32 setupsan12,
}
_carIsBroken = false;
- _roadRightBranch = false;
- _roadLeftBranch = false;
+ _roadStop = false;
+ _roadBranch = false;
_iactSceneId = 0;
}
@@ -1204,8 +1203,8 @@ void Insane::postCase6(byte *renderBitmap, int32 codecparam, int32 setupsan12,
queueSceneSwitch(flu->sceneId, *flu->fluPtr, flu->filenamePtr, 64, 0,
flu->startFrame, flu->numFrames);
}
- _roadLeftBranch = false;
- _roadRightBranch = false;
+ _roadBranch = false;
+ _roadStop = false;
}
void Insane::postCase8(byte *renderBitmap, int32 codecparam, int32 setupsan12,
@@ -1226,8 +1225,8 @@ void Insane::postCase8(byte *renderBitmap, int32 codecparam, int32 setupsan12,
}
}
- _roadLeftBranch = false;
- _roadRightBranch = false;
+ _roadBranch = false;
+ _roadStop = false;
}
void Insane::postCase9(byte *renderBitmap, int32 codecparam, int32 setupsan12,
@@ -1237,8 +1236,8 @@ void Insane::postCase9(byte *renderBitmap, int32 codecparam, int32 setupsan12,
queueSceneSwitch(1, _smush_minedrivFlu, "minedriv.san", 64, 0,
_continueFrame1, 1300);
}
- _roadLeftBranch = false;
- _roadRightBranch = false;
+ _roadBranch = false;
+ _roadStop = false;
}
void Insane::postCase10(byte *renderBitmap, int32 codecparam, int32 setupsan12,
@@ -1287,8 +1286,8 @@ void Insane::postCase10(byte *renderBitmap, int32 codecparam, int32 setupsan12,
}
}
- _roadLeftBranch = false;
- _roadRightBranch = false;
+ _roadBranch = false;
+ _roadStop = false;
}
void Insane::postCase12(byte *renderBitmap, int32 codecparam, int32 setupsan12,
@@ -1373,8 +1372,8 @@ void Insane::postCase12(byte *renderBitmap, int32 codecparam, int32 setupsan12,
if (curFrame >= maxFrame)
smush_rewindCurrentSan(1088, -1, -1);
- _roadLeftBranch = false;
- _roadRightBranch = false;
+ _roadBranch = false;
+ _roadStop = false;
_continueFrame = curFrame;
}
@@ -1390,8 +1389,8 @@ void Insane::postCase23(byte *renderBitmap, int32 codecparam, int32 setupsan12,
queueSceneSwitch(5, 0, "tovista2.san", 64, 0, 0, 290);
}
}
- _roadLeftBranch = false;
- _roadRightBranch = false;
+ _roadBranch = false;
+ _roadStop = false;
}
void Insane::postCase14(byte *renderBitmap, int32 codecparam, int32 setupsan12,
@@ -1415,8 +1414,8 @@ void Insane::postCase14(byte *renderBitmap, int32 codecparam, int32 setupsan12,
}
}
- _roadLeftBranch = false;
- _roadRightBranch = false;
+ _roadBranch = false;
+ _roadStop = false;
}
void Insane::postCaseAll(byte *renderBitmap, int32 codecparam, int32 setupsan12,
@@ -1462,8 +1461,8 @@ void Insane::postCaseAll(byte *renderBitmap, int32 codecparam, int32 setupsan12,
}
}
}
- _roadLeftBranch = false;
- _roadRightBranch = false;
+ _roadBranch = false;
+ _roadStop = false;
_continueFrame = curFrame;
}
diff --git a/scumm/nut_renderer.cpp b/scumm/nut_renderer.cpp
index 428f361b06..d85222b9e2 100644
--- a/scumm/nut_renderer.cpp
+++ b/scumm/nut_renderer.cpp
@@ -159,6 +159,10 @@ bool NutRenderer::loadFont(const char *filename, const char *directory) {
_chars[l].width = READ_LE_UINT16(dataSrc + offset + 14);
_chars[l].height = READ_LE_UINT16(dataSrc + offset + 16);
_chars[l].src = new byte[(_chars[l].width + 2) * _chars[l].height + 1000];
+ // If characters have transparency, then bytes just get skipped and
+ // so there may appear some garbage. That's why we have to fill it
+ // with zeroes first.
+ memset(_chars[l].src, 0, (_chars[l].width + 2) * _chars[l].height + 1000);
if ((codec == 44) || (codec == 21))
decoded_length = decodeCodec44(_chars[l].src, dataSrc + offset + 22, READ_BE_UINT32(dataSrc + offset + 4) - 14);
else if (codec == 1) {
@@ -304,7 +308,7 @@ void NutRenderer::drawFrame(byte *dst, int c, int x, int y) {
for (int ty = minY; ty < height; ty++) {
for (int tx = minX; tx < width; tx++) {
bits = src[tx];
- if (bits != 231) {
+ if (bits != 231 && bits) {
dst[tx] = bits;
}
}
diff --git a/scumm/smush/saud_channel.cpp b/scumm/smush/saud_channel.cpp
index 629ab95fc5..166e8ea8fc 100644
--- a/scumm/smush/saud_channel.cpp
+++ b/scumm/smush/saud_channel.cpp
@@ -75,7 +75,7 @@ bool SaudChannel::handleSubTags(int32 &offset) {
} else
return false;
break;
- case TYPE_SDAT:
+ case TYPE_SDAT:
_inData = true;
_dataSize = size;
offset += 8;
@@ -103,7 +103,7 @@ bool SaudChannel::processBuffer() {
} else if (_inData) {
if (_dataSize < _tbufferSize) {
int32 offset = _dataSize;
- while (handleSubTags(offset));
+ while (handleSubTags(offset)) ;
_sbufferSize = _dataSize;
_sbuffer = _tbuffer;
if (offset < _tbufferSize) {
@@ -171,12 +171,17 @@ SaudChannel::SaudChannel(int32 track, int32 freq) :
}
SaudChannel::~SaudChannel() {
+ _dataSize = 0;
+ _tbufferSize = 0;
+ _sbufferSize = 0;
+ _markReached = true;
if (_tbuffer)
delete []_tbuffer;
if (_sbuffer) {
- warning("this should never happen !!!! (_sbuffer not NULL here)");
+ // _sbuffer can be not empty here with insane when it seeks in video
delete []_sbuffer;
}
+ _sbuffer = 0;
}
bool SaudChannel::isTerminated() const {
diff --git a/scumm/smush/smush_mixer.cpp b/scumm/smush/smush_mixer.cpp
index d329804f5f..ea6e39b887 100644
--- a/scumm/smush/smush_mixer.cpp
+++ b/scumm/smush/smush_mixer.cpp
@@ -139,6 +139,7 @@ bool SmushMixer::stop() {
delete _channels[i].chan;
_channels[i].id = -1;
_channels[i].chan = NULL;
+ _mixer->endStream(_channels[i].handle);
}
}
return true;
diff --git a/scumm/smush/smush_player.cpp b/scumm/smush/smush_player.cpp
index 0a395f9d03..13c0c677f3 100644
--- a/scumm/smush/smush_player.cpp
+++ b/scumm/smush/smush_player.cpp
@@ -236,6 +236,7 @@ SmushPlayer::SmushPlayer(ScummEngine_v6 *scumm, int speed) {
_speed = speed;
_insanity = false;
_middleAudio = false;
+ _skipPalette = false;
}
SmushPlayer::~SmushPlayer() {
@@ -657,6 +658,9 @@ void SmushPlayer::handleNewPalette(Chunk &b) {
checkBlock(b, TYPE_NPAL, 0x300);
debug(6, "SmushPlayer::handleNewPalette()");
+ if (_skipPalette)
+ return;
+
readPalette(_pal, b);
setPalette(_pal);
}
@@ -786,7 +790,6 @@ void SmushPlayer::handleFrame(Chunk &b) {
delete sub;
}
- // FIXME: Check either parameters are valid
if (_insanity) {
_vm->_insane->procPostRendering(_dst, 0, 0, 0, _frame, _nbframes-1);
}
@@ -808,8 +811,10 @@ void SmushPlayer::handleAnimHeader(Chunk &b) {
_version = b.getWord();
_nbframes = b.getWord();
b.getWord();
- readPalette(_pal, b);
- setPalette(_pal);
+ if (!_skipPalette) {
+ readPalette(_pal, b);
+ setPalette(_pal);
+ }
}
void SmushPlayer::setupAnim(const char *file, const char *directory) {
@@ -972,9 +977,14 @@ void SmushPlayer::insanity(bool flag) {
}
void SmushPlayer::seekSan(const char *file, const char *directory, int32 pos, int32 contFrame) {
+ if(_smixer)
+ _smixer->stop();
+
if (file) {
- if (_base)
+ if (_base) {
+ _base->seek(0, FileChunk::seek_end);
delete _base;
+ }
_base = new FileChunk(file, directory);
// In this case we need to get palette and number of frames
@@ -986,8 +996,11 @@ void SmushPlayer::seekSan(const char *file, const char *directory, int32 pos, in
}
if (pos >= 8)
pos -= 8;
+
+ _skipPalette = false;
} else {
_base->reinit(pos);
+ _skipPalette = true;
}
if (pos != 8 && pos) {
diff --git a/scumm/smush/smush_player.h b/scumm/smush/smush_player.h
index e3048c80d8..b790f93ab1 100644
--- a/scumm/smush/smush_player.h
+++ b/scumm/smush/smush_player.h
@@ -68,6 +68,7 @@ private:
bool _updateNeeded;
bool _insanity;
bool _middleAudio;
+ bool _skipPalette;
public:
SmushPlayer(ScummEngine_v6 *scumm, int speed);