[Scummvm-cvs-logs] SF.net SVN: scummvm:[46601] scummvm/trunk/engines/kyra
athrxx at users.sourceforge.net
athrxx at users.sourceforge.net
Sat Dec 26 20:02:16 CET 2009
Revision: 46601
http://scummvm.svn.sourceforge.net/scummvm/?rev=46601&view=rev
Author: athrxx
Date: 2009-12-26 19:02:16 +0000 (Sat, 26 Dec 2009)
Log Message:
-----------
LOL: - added workaround for portrait speech animations which would sometimes "freeze"
- renamed some stuff
Modified Paths:
--------------
scummvm/trunk/engines/kyra/gui_lol.cpp
scummvm/trunk/engines/kyra/lol.cpp
scummvm/trunk/engines/kyra/lol.h
scummvm/trunk/engines/kyra/saveload_lol.cpp
scummvm/trunk/engines/kyra/scene_lol.cpp
scummvm/trunk/engines/kyra/script_lol.cpp
scummvm/trunk/engines/kyra/script_tim.cpp
scummvm/trunk/engines/kyra/staticres.cpp
scummvm/trunk/engines/kyra/text_lol.cpp
Modified: scummvm/trunk/engines/kyra/gui_lol.cpp
===================================================================
--- scummvm/trunk/engines/kyra/gui_lol.cpp 2009-12-26 18:41:13 UTC (rev 46600)
+++ scummvm/trunk/engines/kyra/gui_lol.cpp 2009-12-26 19:02:16 UTC (rev 46601)
@@ -473,11 +473,11 @@
}
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 @@
clickedExitCharInventory(&b);
initTextFading(0, 1);
- updatePortraits();
+ stopPortraitSpeechAnim();
setLampMode(true);
setMouseCursorToIcon(0);
disableSysTimer(2);
Modified: scummvm/trunk/engines/kyra/lol.cpp
===================================================================
--- scummvm/trunk/engines/kyra/lol.cpp 2009-12-26 18:41:13 UTC (rev 46600)
+++ scummvm/trunk/engines/kyra/lol.cpp 2009-12-26 19:02:16 UTC (rev 46601)
@@ -114,7 +114,7 @@
_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 @@
}
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 @@
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 @@
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::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 @@
if (!clearField)
return;
- updatePortraits();
+ stopPortraitSpeechAnim();
if (_needSceneRestore)
_screen->setScreenDim(_txt->clearDim(3));
@@ -1264,7 +1272,7 @@
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 @@
_portraitSpeechAnimMode = 2;
_updateCharNum = i;
_screen->drawShape(0, _gameShapes[88], _activeCharsXpos[_updateCharNum] + 8, 142, 0, 0);
- updatePortraits();
+ stopPortraitSpeechAnim();
}
}
@@ -1618,7 +1626,7 @@
if (!_dialogueField)
return;
- updatePortraits();
+ stopPortraitSpeechAnim();
_currentControlMode = controlMode;
calcCharPortraitXpos();
@@ -1839,10 +1847,10 @@
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 @@
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 @@
else
charId ^= 0x70;
- updatePortraits();
+ stopPortraitSpeechAnim();
if (charId < 0) {
charId = ch = (_rnd.getRandomNumber(0x7fff) * countActiveCharacters()) / 0x8000;
@@ -1888,7 +1896,7 @@
_updateCharNum = charId;
_portraitSpeechAnimMode = mode;
_updatePortraitSpeechAnimDuration = strlen(str) >> 1;
- _updateCharV3 = unk1;
+ _resetPortraitAfterSpeechAnim = restorePortrait;
}
if (script)
@@ -3577,7 +3585,7 @@
restoreAfterSpecialScene(0, 1, 1, 0);
snd_playTrack(325);
- updatePortraits();
+ stopPortraitSpeechAnim();
initTextFading(0, 1);
setMouseCursorToIcon(0);
_updateFlags |= 4;
Modified: scummvm/trunk/engines/kyra/lol.h
===================================================================
--- scummvm/trunk/engines/kyra/lol.h 2009-12-26 18:41:13 UTC (rev 46600)
+++ scummvm/trunk/engines/kyra/lol.h 2009-12-26 19:02:16 UTC (rev 46601)
@@ -49,7 +49,7 @@
uint8 raceClassSex;
int16 id;
uint8 curFaceFrame;
- uint8 defaultFaceFrame;
+ uint8 tempFaceFrame;
uint8 screamSfx;
const uint16 *defaultModifiers;
uint16 itemsMight[8];
@@ -629,7 +629,7 @@
// 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 @@
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 @@
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 @@
int _updateCharNum;
int _updatePortraitSpeechAnimDuration;
int _portraitSpeechAnimMode;
- int _updateCharV3;
+ int _resetPortraitAfterSpeechAnim;
int _textColorFlag;
bool _fadeText;
int _needSceneRestore;
Modified: scummvm/trunk/engines/kyra/saveload_lol.cpp
===================================================================
--- scummvm/trunk/engines/kyra/saveload_lol.cpp 2009-12-26 18:41:13 UTC (rev 46600)
+++ scummvm/trunk/engines/kyra/saveload_lol.cpp 2009-12-26 19:02:16 UTC (rev 46601)
@@ -63,7 +63,7 @@
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 @@
_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 @@
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 @@
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]);
Modified: scummvm/trunk/engines/kyra/scene_lol.cpp
===================================================================
--- scummvm/trunk/engines/kyra/scene_lol.cpp 2009-12-26 18:41:13 UTC (rev 46600)
+++ scummvm/trunk/engines/kyra/scene_lol.cpp 2009-12-26 19:02:16 UTC (rev 46601)
@@ -42,7 +42,7 @@
snd_stopMusic();
- updatePortraits();
+ stopPortraitSpeechAnim();
for (int i = 0; i < 400; i++) {
delete[] _levelShapes[i];
Modified: scummvm/trunk/engines/kyra/script_lol.cpp
===================================================================
--- scummvm/trunk/engines/kyra/script_lol.cpp 2009-12-26 18:41:13 UTC (rev 46600)
+++ scummvm/trunk/engines/kyra/script_lol.cpp 2009-12-26 19:02:16 UTC (rev 46601)
@@ -1295,7 +1295,7 @@
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 @@
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 @@
// 0x68
Opcode(olol_countAllMonsters);
Opcode(olol_playEndSequence);
- Opcode(olol_updatePortraits);
+ Opcode(olol_stopPortraitSpeechAnim);
Opcode(olol_setPaletteBrightness);
// 0x6C
Modified: scummvm/trunk/engines/kyra/script_tim.cpp
===================================================================
--- scummvm/trunk/engines/kyra/script_tim.cpp 2009-12-26 18:41:13 UTC (rev 46600)
+++ scummvm/trunk/engines/kyra/script_tim.cpp 2009-12-26 19:02:16 UTC (rev 46601)
@@ -1112,7 +1112,7 @@
if (res == 0)
return 0;
- _vm->updatePortraits();
+ _vm->stopPortraitSpeechAnim();
if (!_vm->textEnabled() && _vm->_currentControlMode) {
_screen->setScreenDim(5);
Modified: scummvm/trunk/engines/kyra/staticres.cpp
===================================================================
--- scummvm/trunk/engines/kyra/staticres.cpp 2009-12-26 18:41:13 UTC (rev 46600)
+++ scummvm/trunk/engines/kyra/staticres.cpp 2009-12-26 19:02:16 UTC (rev 46601)
@@ -654,7 +654,7 @@
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++)
Modified: scummvm/trunk/engines/kyra/text_lol.cpp
===================================================================
--- scummvm/trunk/engines/kyra/text_lol.cpp 2009-12-26 18:41:13 UTC (rev 46600)
+++ scummvm/trunk/engines/kyra/text_lol.cpp 2009-12-26 19:02:16 UTC (rev 46601)
@@ -211,7 +211,7 @@
if (type & 4)
type ^= 4;
else
- _vm->updatePortraits();
+ _vm->stopPortraitSpeechAnim();
uint16 col = textColors[type & 0x7fff];
@@ -706,12 +706,12 @@
_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 @@
_vm->_timer->pauseSingleTimer(11, false);
if (_vm->_updateCharNum != -1) {
- _vm->_updateCharV3 = updateCharV3;
+ _vm->_resetPortraitAfterSpeechAnim = resetPortraitAfterSpeechAnim;
if (updatePortraitSpeechAnimDuration > 36)
updatePortraitSpeechAnimDuration -= 36;
else
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
More information about the Scummvm-git-logs
mailing list