aboutsummaryrefslogtreecommitdiff
path: root/engines/kyra
diff options
context:
space:
mode:
authorFlorian Kagerer2009-12-26 19:02:16 +0000
committerFlorian Kagerer2009-12-26 19:02:16 +0000
commit2a0b03218c3d6afffac9bebff798850c27f67bd0 (patch)
tree44cf168fef6b93ee28e7a003c148b263cc2d9170 /engines/kyra
parent78d268b21a65bcf4e7909f87374a08bec22c7ffe (diff)
downloadscummvm-rg350-2a0b03218c3d6afffac9bebff798850c27f67bd0.tar.gz
scummvm-rg350-2a0b03218c3d6afffac9bebff798850c27f67bd0.tar.bz2
scummvm-rg350-2a0b03218c3d6afffac9bebff798850c27f67bd0.zip
LOL: - added workaround for portrait speech animations which would sometimes "freeze"
- renamed some stuff svn-id: r46601
Diffstat (limited to 'engines/kyra')
-rw-r--r--engines/kyra/gui_lol.cpp10
-rw-r--r--engines/kyra/lol.cpp40
-rw-r--r--engines/kyra/lol.h10
-rw-r--r--engines/kyra/saveload_lol.cpp8
-rw-r--r--engines/kyra/scene_lol.cpp2
-rw-r--r--engines/kyra/script_lol.cpp10
-rw-r--r--engines/kyra/script_tim.cpp2
-rw-r--r--engines/kyra/staticres.cpp2
-rw-r--r--engines/kyra/text_lol.cpp10
9 files changed, 51 insertions, 43 deletions
diff --git a/engines/kyra/gui_lol.cpp b/engines/kyra/gui_lol.cpp
index c9036e9ff0..78eebe3c3b 100644
--- a/engines/kyra/gui_lol.cpp
+++ b/engines/kyra/gui_lol.cpp
@@ -473,11 +473,11 @@ void LoLEngine::gui_drawBox(int x, int y, int w, int h, int frameColor1, int fra
}
void LoLEngine::gui_drawCharFaceShape(int charNum, int x, int y, int pageNum) {
- if (_characters[charNum].curFaceFrame < 7 && _characters[charNum].defaultFaceFrame)
- _characters[charNum].curFaceFrame = _characters[charNum].defaultFaceFrame;
+ if (_characters[charNum].curFaceFrame < 7 && _characters[charNum].tempFaceFrame)
+ _characters[charNum].curFaceFrame = _characters[charNum].tempFaceFrame;
- if (_characters[charNum].defaultFaceFrame == 0 && _characters[charNum].curFaceFrame > 1 && _characters[charNum].curFaceFrame < 7)
- _characters[charNum].curFaceFrame = _characters[charNum].defaultFaceFrame;
+ if (_characters[charNum].tempFaceFrame == 0 && _characters[charNum].curFaceFrame > 1 && _characters[charNum].curFaceFrame < 7)
+ _characters[charNum].curFaceFrame = _characters[charNum].tempFaceFrame;
int frm = (_characters[charNum].flags & 0x1108 && _characters[charNum].curFaceFrame < 7) ? 1 : _characters[charNum].curFaceFrame;
@@ -1596,7 +1596,7 @@ int LoLEngine::clickedOptions(Button *button) {
clickedExitCharInventory(&b);
initTextFading(0, 1);
- updatePortraits();
+ stopPortraitSpeechAnim();
setLampMode(true);
setMouseCursorToIcon(0);
disableSysTimer(2);
diff --git a/engines/kyra/lol.cpp b/engines/kyra/lol.cpp
index c44f5b8e8d..a441874134 100644
--- a/engines/kyra/lol.cpp
+++ b/engines/kyra/lol.cpp
@@ -114,7 +114,7 @@ LoLEngine::LoLEngine(OSystem *system, const GameFlags &flags) : KyraEngine_v1(sy
_spellProperties = 0;
_updateFlags = 0;
_selectedSpell = 0;
- _updateCharNum = _updatePortraitSpeechAnimDuration = _portraitSpeechAnimMode = _updateCharV3 = _textColorFlag = _needSceneRestore = 0;
+ _updateCharNum = _updatePortraitSpeechAnimDuration = _portraitSpeechAnimMode = _resetPortraitAfterSpeechAnim = _textColorFlag = _needSceneRestore = 0;
_fadeText = false;
_palUpdateTimer = _updatePortraitNext = 0;
_lampStatusTimer = 0xffffffff;
@@ -1114,7 +1114,7 @@ bool LoLEngine::addCharacter(int id) {
}
void LoLEngine::setTemporaryFaceFrame(int charNum, int frame, int updateDelay, int redraw) {
- _characters[charNum].defaultFaceFrame = frame;
+ _characters[charNum].tempFaceFrame = frame;
if (frame || updateDelay)
setCharacterUpdateEvent(charNum, 6, updateDelay, 1);
if (redraw)
@@ -1200,9 +1200,15 @@ void LoLEngine::updatePortraitSpeechAnim() {
if (speechEnabled()) {
if (snd_updateCharacterSpeech() == 2)
- _updatePortraitSpeechAnimDuration = 2;
+ // WORKAROUND for portrait speech animations which would "freeze" in some situations
+ if (_resetPortraitAfterSpeechAnim == 2)
+ _resetPortraitAfterSpeechAnim = 1;
+ else
+ _updatePortraitSpeechAnimDuration = 2;
else
_updatePortraitSpeechAnimDuration = 1;
+ } else if (_resetPortraitAfterSpeechAnim == 2) {
+ _resetPortraitAfterSpeechAnim = 1;
}
_updatePortraitSpeechAnimDuration--;
@@ -1214,7 +1220,7 @@ void LoLEngine::updatePortraitSpeechAnim() {
else
gui_drawCharFaceShape(_updateCharNum, x, y, 0);
_updatePortraitNext = _system->getMillis() + 10 * _tickLength;
- } else if (_updateCharV3 != 0) {
+ } else if (_resetPortraitAfterSpeechAnim != 0) {
faceFrameRefresh(_updateCharNum);
if (redraw) {
gui_drawCharPortraitWithStats(_updateCharNum);
@@ -1226,11 +1232,13 @@ void LoLEngine::updatePortraitSpeechAnim() {
}
}
-void LoLEngine::updatePortraits() {
+void LoLEngine::stopPortraitSpeechAnim() {
if (_updateCharNum == -1)
return;
- _updatePortraitSpeechAnimDuration = _updateCharV3 = 1;
+ _updatePortraitSpeechAnimDuration = 1;
+ // WORKAROUND for portrait speech animations which would "freeze" in some situations
+ _resetPortraitAfterSpeechAnim = 2;
updatePortraitSpeechAnim();
_updatePortraitSpeechAnimDuration = 1;
_updateCharNum = -1;
@@ -1248,7 +1256,7 @@ void LoLEngine::initTextFading(int textType, int clearField) {
if (!clearField)
return;
- updatePortraits();
+ stopPortraitSpeechAnim();
if (_needSceneRestore)
_screen->setScreenDim(_txt->clearDim(3));
@@ -1264,7 +1272,7 @@ void LoLEngine::faceFrameRefresh(int charNum) {
if (_characters[charNum].curFaceFrame == 1)
setTemporaryFaceFrame(charNum, 0, 0, 0);
else if (_characters[charNum].curFaceFrame == 6)
- if (_characters[charNum].defaultFaceFrame != 5)
+ if (_characters[charNum].tempFaceFrame != 5)
setTemporaryFaceFrame(charNum, 0, 0, 0);
else
_characters[charNum].curFaceFrame = 5;
@@ -1597,7 +1605,7 @@ void LoLEngine::initDialogueSequence(int controlMode, int pageNum) {
_portraitSpeechAnimMode = 2;
_updateCharNum = i;
_screen->drawShape(0, _gameShapes[88], _activeCharsXpos[_updateCharNum] + 8, 142, 0, 0);
- updatePortraits();
+ stopPortraitSpeechAnim();
}
}
@@ -1618,7 +1626,7 @@ void LoLEngine::restoreAfterDialogueSequence(int controlMode) {
if (!_dialogueField)
return;
- updatePortraits();
+ stopPortraitSpeechAnim();
_currentControlMode = controlMode;
calcCharPortraitXpos();
@@ -1839,10 +1847,10 @@ int LoLEngine::characterSays(int track, int charId, bool redraw) {
bool r = snd_playCharacterSpeech(track, charId, 0);
if (r && redraw) {
- updatePortraits();
+ stopPortraitSpeechAnim();
_updateCharNum = charId;
_portraitSpeechAnimMode = 0;
- _updateCharV3 = 1;
+ _resetPortraitAfterSpeechAnim = 1;
_fadeText = false;
updatePortraitSpeechAnim();
}
@@ -1850,7 +1858,7 @@ int LoLEngine::characterSays(int track, int charId, bool redraw) {
return r ? (textEnabled() ? 1 : 0) : 1;
}
-int LoLEngine::playCharacterScriptChat(int charId, int mode, int unk1, char *str, EMCState *script, const uint16 *paramList, int16 paramIndex) {
+int LoLEngine::playCharacterScriptChat(int charId, int mode, int restorePortrait, char *str, EMCState *script, const uint16 *paramList, int16 paramIndex) {
int ch = 0;
bool skipAnim = false;
@@ -1859,7 +1867,7 @@ int LoLEngine::playCharacterScriptChat(int charId, int mode, int unk1, char *str
else
charId ^= 0x70;
- updatePortraits();
+ stopPortraitSpeechAnim();
if (charId < 0) {
charId = ch = (_rnd.getRandomNumber(0x7fff) * countActiveCharacters()) / 0x8000;
@@ -1888,7 +1896,7 @@ int LoLEngine::playCharacterScriptChat(int charId, int mode, int unk1, char *str
_updateCharNum = charId;
_portraitSpeechAnimMode = mode;
_updatePortraitSpeechAnimDuration = strlen(str) >> 1;
- _updateCharV3 = unk1;
+ _resetPortraitAfterSpeechAnim = restorePortrait;
}
if (script)
@@ -3577,7 +3585,7 @@ void LoLEngine::checkForPartyDeath() {
restoreAfterSpecialScene(0, 1, 1, 0);
snd_playTrack(325);
- updatePortraits();
+ stopPortraitSpeechAnim();
initTextFading(0, 1);
setMouseCursorToIcon(0);
_updateFlags |= 4;
diff --git a/engines/kyra/lol.h b/engines/kyra/lol.h
index 2fa916ce94..f7fe2c5c28 100644
--- a/engines/kyra/lol.h
+++ b/engines/kyra/lol.h
@@ -49,7 +49,7 @@ struct LoLCharacter {
uint8 raceClassSex;
int16 id;
uint8 curFaceFrame;
- uint8 defaultFaceFrame;
+ uint8 tempFaceFrame;
uint8 screamSfx;
const uint16 *defaultModifiers;
uint16 itemsMight[8];
@@ -629,7 +629,7 @@ private:
// text
int characterSays(int track, int charId, bool redraw);
- int playCharacterScriptChat(int charId, int mode, int unk1, char *str, EMCState *script, const uint16 *paramList, int16 paramIndex);
+ int playCharacterScriptChat(int charId, int mode, int restorePortrait, char *str, EMCState *script, const uint16 *paramList, int16 paramIndex);
TextDisplayer_LoL *_txt;
@@ -747,7 +747,7 @@ private:
int olol_characterSkillTest(EMCState *script);
int olol_countAllMonsters(EMCState *script);
int olol_playEndSequence(EMCState *script);
- int olol_updatePortraits(EMCState *script);
+ int olol_stopPortraitSpeechAnim(EMCState *script);
int olol_setPaletteBrightness(EMCState *script);
int olol_calcInflictableDamage(EMCState *script);
int olol_getInflictedDamage(EMCState *script);
@@ -921,7 +921,7 @@ private:
void calcCharPortraitXpos();
void updatePortraitSpeechAnim();
- void updatePortraits();
+ void stopPortraitSpeechAnim();
void initTextFading(int textType, int clearField);
void setCharFaceFrame(int charNum, int frameNum);
void faceFrameRefresh(int charNum);
@@ -940,7 +940,7 @@ private:
int _updateCharNum;
int _updatePortraitSpeechAnimDuration;
int _portraitSpeechAnimMode;
- int _updateCharV3;
+ int _resetPortraitAfterSpeechAnim;
int _textColorFlag;
bool _fadeText;
int _needSceneRestore;
diff --git a/engines/kyra/saveload_lol.cpp b/engines/kyra/saveload_lol.cpp
index 23bde6edb7..54beb7a98a 100644
--- a/engines/kyra/saveload_lol.cpp
+++ b/engines/kyra/saveload_lol.cpp
@@ -63,7 +63,7 @@ Common::Error LoLEngine::loadGameState(int slot) {
c->raceClassSex = in.readByte();
c->id = in.readSint16BE();
c->curFaceFrame = in.readByte();
- c->defaultFaceFrame = in.readByte();
+ c->tempFaceFrame = in.readByte();
c->screamSfx = in.readByte();
for (int ii = 0; ii < 8; ii++)
c->itemsMight[ii] = in.readUint16BE();
@@ -153,7 +153,7 @@ Common::Error LoLEngine::loadGameState(int slot) {
_globalScriptVars[i] = in.readUint16BE();
_brightness = in.readByte();
_lampOilStatus = in.readByte();
- _lampEffect = in.readByte();
+ _lampEffect = in.readSByte();
_credits = in.readUint16BE();
for (int i = 0; i < 8; i++)
_globalScriptVars2[i] = in.readUint16BE();
@@ -291,7 +291,7 @@ Common::Error LoLEngine::saveGameState(int slot, const char *saveName, const Gra
out->writeByte(c->raceClassSex);
out->writeSint16BE(c->id);
out->writeByte(c->curFaceFrame);
- out->writeByte(c->defaultFaceFrame);
+ out->writeByte(c->tempFaceFrame);
out->writeByte(c->screamSfx);
for (int ii = 0; ii < 8; ii++)
out->writeUint16BE(c->itemsMight[ii]);
@@ -350,7 +350,7 @@ Common::Error LoLEngine::saveGameState(int slot, const char *saveName, const Gra
out->writeUint16BE(_globalScriptVars[i]);
out->writeByte(_brightness);
out->writeByte(_lampOilStatus);
- out->writeByte(_lampEffect);
+ out->writeSByte(_lampEffect);
out->writeUint16BE(_credits);
for (int i = 0; i < 8; i++)
out->writeUint16BE(_globalScriptVars2[i]);
diff --git a/engines/kyra/scene_lol.cpp b/engines/kyra/scene_lol.cpp
index c16f18ae36..3d4910fd68 100644
--- a/engines/kyra/scene_lol.cpp
+++ b/engines/kyra/scene_lol.cpp
@@ -42,7 +42,7 @@ void LoLEngine::loadLevel(int index) {
snd_stopMusic();
- updatePortraits();
+ stopPortraitSpeechAnim();
for (int i = 0; i < 400; i++) {
delete[] _levelShapes[i];
diff --git a/engines/kyra/script_lol.cpp b/engines/kyra/script_lol.cpp
index 6e515f4959..b18fb37344 100644
--- a/engines/kyra/script_lol.cpp
+++ b/engines/kyra/script_lol.cpp
@@ -1295,7 +1295,7 @@ int LoLEngine::olol_playCharacterScriptChat(EMCState *script) {
debugC(3, kDebugLevelScriptFuncs, "LoLEngine::olol_playCharacterScriptChat(%p) (%d, %d, %d)", (const void *)script, stackPos(0), stackPos(1), stackPos(2));
if (_flags.isTalkie) {
snd_stopSpeech(1);
- updatePortraits();
+ stopPortraitSpeechAnim();
}
return playCharacterScriptChat(stackPos(0), stackPos(1), 1, getLangString(stackPos(2)), script, 0, 3);
}
@@ -1440,11 +1440,11 @@ int LoLEngine::olol_playEndSequence(EMCState *script){
return 0;
}
-int LoLEngine::olol_updatePortraits(EMCState *script) {
- debugC(3, kDebugLevelScriptFuncs, "LoLEngine::olol_updatePortraits(%p)", (const void *)script);
+int LoLEngine::olol_stopPortraitSpeechAnim(EMCState *script) {
+ debugC(3, kDebugLevelScriptFuncs, "LoLEngine::olol_stopPortraitSpeechAnim(%p)", (const void *)script);
if (_flags.isTalkie)
snd_stopSpeech(1);
- updatePortraits();
+ stopPortraitSpeechAnim();
return 1;
}
@@ -2863,7 +2863,7 @@ void LoLEngine::setupOpcodeTable() {
// 0x68
Opcode(olol_countAllMonsters);
Opcode(olol_playEndSequence);
- Opcode(olol_updatePortraits);
+ Opcode(olol_stopPortraitSpeechAnim);
Opcode(olol_setPaletteBrightness);
// 0x6C
diff --git a/engines/kyra/script_tim.cpp b/engines/kyra/script_tim.cpp
index a43393afb7..edfd5a37a0 100644
--- a/engines/kyra/script_tim.cpp
+++ b/engines/kyra/script_tim.cpp
@@ -1112,7 +1112,7 @@ uint16 TIMInterpreter_LoL::processDialogue() {
if (res == 0)
return 0;
- _vm->updatePortraits();
+ _vm->stopPortraitSpeechAnim();
if (!_vm->textEnabled() && _vm->_currentControlMode) {
_screen->setScreenDim(5);
diff --git a/engines/kyra/staticres.cpp b/engines/kyra/staticres.cpp
index 56cac117f6..38526cb997 100644
--- a/engines/kyra/staticres.cpp
+++ b/engines/kyra/staticres.cpp
@@ -654,7 +654,7 @@ bool StaticResource::loadCharData(Common::SeekableReadStream &stream, void *&ptr
t->raceClassSex = stream.readByte();
t->id = stream.readSint16LE();
t->curFaceFrame = stream.readByte();
- t->defaultFaceFrame = stream.readByte();
+ t->tempFaceFrame = stream.readByte();
t->screamSfx = stream.readByte();
stream.readUint32LE();
for (int ii = 0; ii < 8; ii++)
diff --git a/engines/kyra/text_lol.cpp b/engines/kyra/text_lol.cpp
index 2deb2d6fdf..8f6b04afb9 100644
--- a/engines/kyra/text_lol.cpp
+++ b/engines/kyra/text_lol.cpp
@@ -211,7 +211,7 @@ void TextDisplayer_LoL::printMessage(uint16 type, const char *str, ...) {
if (type & 4)
type ^= 4;
else
- _vm->updatePortraits();
+ _vm->stopPortraitSpeechAnim();
uint16 col = textColors[type & 0x7fff];
@@ -706,12 +706,12 @@ void TextDisplayer_LoL::textPageBreak() {
_vm->_timer->pauseSingleTimer(11, true);
_vm->_fadeText = false;
- int updateCharV3 = 0;
+ int resetPortraitAfterSpeechAnim = 0;
int updatePortraitSpeechAnimDuration = 0;
if (_vm->_updateCharNum != -1) {
- updateCharV3 = _vm->_updateCharV3;
- _vm->_updateCharV3 = 0;
+ resetPortraitAfterSpeechAnim = _vm->_resetPortraitAfterSpeechAnim;
+ _vm->_resetPortraitAfterSpeechAnim = 0;
updatePortraitSpeechAnimDuration = _vm->_updatePortraitSpeechAnimDuration;
if (_vm->_updatePortraitSpeechAnimDuration > 36)
_vm->_updatePortraitSpeechAnimDuration = 36;
@@ -794,7 +794,7 @@ void TextDisplayer_LoL::textPageBreak() {
_vm->_timer->pauseSingleTimer(11, false);
if (_vm->_updateCharNum != -1) {
- _vm->_updateCharV3 = updateCharV3;
+ _vm->_resetPortraitAfterSpeechAnim = resetPortraitAfterSpeechAnim;
if (updatePortraitSpeechAnimDuration > 36)
updatePortraitSpeechAnimDuration -= 36;
else