aboutsummaryrefslogtreecommitdiff
path: root/scumm
diff options
context:
space:
mode:
authorJames Brown2004-01-16 10:45:56 +0000
committerJames Brown2004-01-16 10:45:56 +0000
commitac5b7036c28a4137d4b7af7385d97e6e485f0767 (patch)
treeb9453259912d5f2c462d8107280ef83303e5fd14 /scumm
parentbd3f51dfdfd563532a7cc228139dd60d8f6451a4 (diff)
downloadscummvm-rg350-ac5b7036c28a4137d4b7af7385d97e6e485f0767.tar.gz
scummvm-rg350-ac5b7036c28a4137d4b7af7385d97e6e485f0767.tar.bz2
scummvm-rg350-ac5b7036c28a4137d4b7af7385d97e6e485f0767.zip
Fix for bug #862263 - Maniac actors never stop talking. I know this could probably be neater :)
svn-id: r12430
Diffstat (limited to 'scumm')
-rw-r--r--scumm/actor.cpp32
-rw-r--r--scumm/debugger.cpp2
-rw-r--r--scumm/script_v5.cpp2
-rw-r--r--scumm/script_v6.cpp2
-rw-r--r--scumm/scumm.h6
-rw-r--r--scumm/scummvm.cpp2
-rw-r--r--scumm/sound.cpp2
-rw-r--r--scumm/string.cpp6
8 files changed, 36 insertions, 18 deletions
diff --git a/scumm/actor.cpp b/scumm/actor.cpp
index b2b5b2cf28..7018c980b8 100644
--- a/scumm/actor.cpp
+++ b/scumm/actor.cpp
@@ -561,7 +561,7 @@ void Actor::setDirection(int direction) {
}
void Actor::putActor(int dstX, int dstY, byte newRoom) {
- if (visible && _vm->_currentRoom != newRoom && _vm->VAR(_vm->VAR_TALK_ACTOR) == number) {
+ if (visible && _vm->_currentRoom != newRoom && _vm->talkingActor() == number) {
_vm->clearMsgQueue();
}
@@ -781,6 +781,22 @@ void Actor::showActor() {
needRedraw = true;
}
+// Maniac doesn't have a ScummVar for VAR_TALK_ACTOR, and just uses
+// an internal variable. Emulate this to prevent overwriting script vars...
+int ScummEngine::talkingActor() {
+ if (_gameId == GID_MANIAC)
+ return _V1_talkingActor;
+ else
+ return VAR(VAR_TALK_ACTOR);
+};
+
+void ScummEngine::talkingActor(int value) {
+ if (_gameId == GID_MANIAC)
+ _V1_talkingActor = value;
+ else
+ VAR(VAR_TALK_ACTOR) = value;
+};
+
void ScummEngine::showActors() {
int i;
@@ -1138,7 +1154,7 @@ void ScummEngine::actorTalk() {
if (_actorToPrintStrFor == 0xFF) {
if (!_keepText)
stopTalk();
- VAR(VAR_TALK_ACTOR) = 0xFF;
+ talkingActor(0xFF);
} else {
int oldact;
@@ -1154,21 +1170,21 @@ void ScummEngine::actorTalk() {
} else {
if (!_keepText)
stopTalk();
- VAR(VAR_TALK_ACTOR) = a->number;
+ talkingActor(a->number);
if (!_string[0].no_talk_anim) {
a->startAnimActor(a->talkStartFrame);
_useTalkAnims = true;
}
- oldact = VAR(VAR_TALK_ACTOR);
+ oldact = talkingActor();
}
if (oldact >= 0x80)
return;
}
- if (((_gameId == GID_MANIAC) && (_version == 1)) || VAR(VAR_TALK_ACTOR) > 0x7F) {
+ if (((_gameId == GID_MANIAC) && (_version == 1)) || talkingActor() > 0x7F) {
_charsetColor = (byte)_string[0].color;
} else {
- a = derefActor(VAR(VAR_TALK_ACTOR), "actorTalk(2)");
+ a = derefActor(talkingActor(), "actorTalk(2)");
_charsetColor = a->talkColor;
}
_charsetBufPos = 0;
@@ -1188,14 +1204,14 @@ void ScummEngine::stopTalk() {
_haveMsg = 0;
_talkDelay = 0;
- act = VAR(VAR_TALK_ACTOR);
+ act = talkingActor();
if (act && act < 0x80) {
Actor *a = derefActor(act, "stopTalk");
if ((a->isInCurrentRoom() && _useTalkAnims) || (_features & GF_NEW_COSTUMES)) {
a->startAnimActor(a->talkStopFrame);
_useTalkAnims = false;
}
- VAR(VAR_TALK_ACTOR) = 0xFF;
+ talkingActor(0xFF);
}
_keepText = false;
_charset->restoreCharsetBg();
diff --git a/scumm/debugger.cpp b/scumm/debugger.cpp
index 065474be20..f8484ee0d9 100644
--- a/scumm/debugger.cpp
+++ b/scumm/debugger.cpp
@@ -56,7 +56,7 @@ void CDECL debugC(int channel, const char *s, ...) {
vsprintf(buf, s, va);
va_end(va);
- debug(g_debugLevel, buf);
+ debug(buf);
};
ScummDebugger::ScummDebugger(ScummEngine *s)
diff --git a/scumm/script_v5.cpp b/scumm/script_v5.cpp
index 9d93ac4b93..52343096f4 100644
--- a/scumm/script_v5.cpp
+++ b/scumm/script_v5.cpp
@@ -1648,7 +1648,7 @@ void ScummEngine_v5::o5_putActorInRoom() {
a = derefActor(act, "o5_putActorInRoom");
- if (a->visible && _currentRoom != room && VAR(VAR_TALK_ACTOR) == a->number) {
+ if (a->visible && _currentRoom != room && talkingActor() == a->number) {
clearMsgQueue();
}
a->room = room;
diff --git a/scumm/script_v6.cpp b/scumm/script_v6.cpp
index a8ccf68e6e..722afbcccd 100644
--- a/scumm/script_v6.cpp
+++ b/scumm/script_v6.cpp
@@ -1069,7 +1069,7 @@ void ScummEngine_v6::o6_putActorAtXY() {
if (room == 0xFF || room == 0x7FFFFFFF) {
room = a->room;
} else {
- if (a->visible && _currentRoom != room && VAR(VAR_TALK_ACTOR) == a->number) {
+ if (a->visible && _currentRoom != room && talkingActor() == a->number) {
clearMsgQueue();
}
if (room != 0)
diff --git a/scumm/scumm.h b/scumm/scumm.h
index 1c4545b2d7..af0110d60a 100644
--- a/scumm/scumm.h
+++ b/scumm/scumm.h
@@ -771,14 +771,16 @@ protected:
public:
/* Actor talking stuff */
- byte _actorToPrintStrFor;
+ byte _actorToPrintStrFor, _V1_talkingActor;
int _sentenceNum;
SentenceTab _sentence[NUM_SENTENCE];
StringTab _string[6];
int16 _talkDelay;
void actorTalk();
void stopTalk();
-
+ int talkingActor(); // Wrapper around VAR_TALK_ACTOR for V1/V2 purposes
+ void talkingActor(int variable);
+
// Costume class
void cost_decodeData(Actor *a, int frame, uint usemask);
int cost_frameToAnim(Actor *a, int frame);
diff --git a/scumm/scummvm.cpp b/scumm/scummvm.cpp
index 139748189c..70e46b323b 100644
--- a/scumm/scummvm.cpp
+++ b/scumm/scummvm.cpp
@@ -1237,7 +1237,7 @@ void ScummEngine::initScummVars() {
}
VAR(VAR_CHARINC) = 4;
- VAR(VAR_TALK_ACTOR) = 0;
+ talkingActor(0);
}
#pragma mark -
diff --git a/scumm/sound.cpp b/scumm/sound.cpp
index 5f6c6c711f..5b7b7d13d3 100644
--- a/scumm/sound.cpp
+++ b/scumm/sound.cpp
@@ -414,7 +414,7 @@ void Sound::processSfxQueues() {
_talk_sound_mode = 0;
}
- const int act = _vm->VAR(_vm->VAR_TALK_ACTOR);
+ const int act = _vm->talkingActor();
if ((_sfxMode & 2) && act != 0) {
Actor *a;
bool b, finished;
diff --git a/scumm/string.cpp b/scumm/string.cpp
index 56a67d787b..64aca168fb 100644
--- a/scumm/string.cpp
+++ b/scumm/string.cpp
@@ -103,14 +103,14 @@ void ScummEngine::CHARSET_1() {
if (!_haveMsg)
return;
- if (!(_features & GF_NEW_CAMERA) && !(_gameId == GID_ZAK256 && VAR(VAR_TALK_ACTOR) == 0xff)) {
+ if (!(_features & GF_NEW_CAMERA) && !(_gameId == GID_ZAK256 && talkingActor() == 0xFF)) {
if ((camera._dest.x / 8) != (camera._cur.x / 8) || camera._cur.x != camera._last.x)
return;
}
a = NULL;
- if (VAR(VAR_TALK_ACTOR) != 0xFF)
- a = derefActorSafe(VAR(VAR_TALK_ACTOR), "CHARSET_1");
+ if (talkingActor() != 0xFF)
+ a = derefActorSafe(talkingActor(), "CHARSET_1");
if (a && _string[0].overhead != 0) {
if (_version <= 5) {