[Scummvm-cvs-logs] SF.net SVN: scummvm: [31766] scummvm/trunk/engines/kyra
lordhoto at users.sourceforge.net
lordhoto at users.sourceforge.net
Mon Apr 28 22:45:22 CEST 2008
Revision: 31766
http://scummvm.svn.sourceforge.net/scummvm/?rev=31766&view=rev
Author: lordhoto
Date: 2008-04-28 13:45:22 -0700 (Mon, 28 Apr 2008)
Log Message:
-----------
- Fixed some delay times
- Implemented opcodes:
-> 99: o3_showGoodConscience
-> 100: o3_goodConscienceChat
-> 101: o3_hideGoodConscience
Modified Paths:
--------------
scummvm/trunk/engines/kyra/items_v3.cpp
scummvm/trunk/engines/kyra/kyra_v3.cpp
scummvm/trunk/engines/kyra/kyra_v3.h
scummvm/trunk/engines/kyra/script_v3.cpp
scummvm/trunk/engines/kyra/sequences_v3.cpp
scummvm/trunk/engines/kyra/staticres.cpp
scummvm/trunk/engines/kyra/text_v3.cpp
Modified: scummvm/trunk/engines/kyra/items_v3.cpp
===================================================================
--- scummvm/trunk/engines/kyra/items_v3.cpp 2008-04-28 20:34:44 UTC (rev 31765)
+++ scummvm/trunk/engines/kyra/items_v3.cpp 2008-04-28 20:45:22 UTC (rev 31766)
@@ -499,7 +499,7 @@
for (int i = 109; i <= 141; ++i) {
_animObjects[animObjIndex].shapeIndex = i+248;
_animObjects[animObjIndex].needRefresh = true;
- delay(1, true);
+ delay(1*_tickLength, true);
}
deleteItemAnimEntry(itemSlot);
@@ -549,7 +549,7 @@
// Unlike the original we give points for when combining with scene items
if (resItem == 7) {
updateScore(35, 100);
- delay(60, true);
+ delay(60*_tickLength, true);
}
return true;
@@ -574,7 +574,7 @@
_screen->drawShape(2, getShapePtr(i+248), 0, 144, 0, 0);
_screen->copyRegion(0, 144, _inventoryX[invSlot], _inventoryY[invSlot], 24, 20, 2, 0, Screen::CR_NO_P_CHECK);
_screen->updateScreen();
- delay(1, true);
+ delay(1*_tickLength, true);
}
_mainCharacter.inventory[invSlot] = 0xFFFF;
@@ -610,7 +610,7 @@
// Unlike the original we give points for every language
if (resItem == 7) {
updateScore(35, 100);
- delay(60, true);
+ delay(60*_tickLength, true);
}
return true;
Modified: scummvm/trunk/engines/kyra/kyra_v3.cpp
===================================================================
--- scummvm/trunk/engines/kyra/kyra_v3.cpp 2008-04-28 20:34:44 UTC (rev 31765)
+++ scummvm/trunk/engines/kyra/kyra_v3.cpp 2008-04-28 20:45:22 UTC (rev 31766)
@@ -136,6 +136,9 @@
_mainButtonList = 0;
_mainButtonListInitialized = false;
_enableInventory = true;
+ _goodConscienceShown = false;
+ _goodConscienceAnim = -1;
+ _goodConsciencePosition = false;
}
KyraEngine_v3::~KyraEngine_v3() {
Modified: scummvm/trunk/engines/kyra/kyra_v3.h
===================================================================
--- scummvm/trunk/engines/kyra/kyra_v3.h 2008-04-28 20:34:44 UTC (rev 31765)
+++ scummvm/trunk/engines/kyra/kyra_v3.h 2008-04-28 20:45:22 UTC (rev 31766)
@@ -575,6 +575,9 @@
void badConscienceChat(const char *str, int vocHigh, int vocLow);
void badConscienceChatWaitToFinish();
+ void goodConscienceChat(const char *str, int vocHigh, int vocLow);
+ void goodConscienceChatWaitToFinish();
+
void malcolmSceneStartupChat();
byte _newSceneDlgState[40];
@@ -622,6 +625,15 @@
void showBadConscience();
void hideBadConscience();
+ bool _goodConscienceShown;
+ int _goodConscienceAnim;
+ bool _goodConsciencePosition;
+
+ static const uint8 _goodConscienceFrameTable[];
+
+ void showGoodConscience();
+ void hideGoodConscience();
+
// special script code
bool _temporaryScriptExecBit;
bool _useFrameTable;
@@ -763,6 +775,9 @@
int o3_showSceneStringsMessage(ScriptState *script);
int o3_getRand(ScriptState *script);
int o3_setDeathHandler(ScriptState *script);
+ int o3_showGoodConscience(ScriptState *script);
+ int o3_goodConscienceChat(ScriptState *script);
+ int o3_hideGoodConscience(ScriptState *script);
int o3_waitForConfirmationClick(ScriptState *script);
int o3_defineRoomEntrance(ScriptState *script);
int o3_runTemporaryScript(ScriptState *script);
Modified: scummvm/trunk/engines/kyra/script_v3.cpp
===================================================================
--- scummvm/trunk/engines/kyra/script_v3.cpp 2008-04-28 20:34:44 UTC (rev 31765)
+++ scummvm/trunk/engines/kyra/script_v3.cpp 2008-04-28 20:45:22 UTC (rev 31766)
@@ -936,6 +936,26 @@
return 0;
}
+int KyraEngine_v3::o3_showGoodConscience(ScriptState *script) {
+ debugC(3, kDebugLevelScriptFuncs, "KyraEngine_v3::o3_showGoodConscience(%p) ()", (const void *)script);
+ showGoodConscience();
+ return 0;
+}
+
+int KyraEngine_v3::o3_goodConscienceChat(ScriptState *script) {
+ debugC(3, kDebugLevelScriptFuncs, "KyraEngine_v3::o3_goodConscienceChat(%p) (%d)", (const void *)script, stackPos(0));
+ int id = stackPos(0);
+ const char *str = (const char*)getTableEntry(_useActorBuffer ? _actorFile : _sceneStrings, id);
+ goodConscienceChat(str, _vocHigh, id);
+ return 0;
+}
+
+int KyraEngine_v3::o3_hideGoodConscience(ScriptState *script) {
+ debugC(3, kDebugLevelScriptFuncs, "KyraEngine_v3::o3_hideGoodConscience(%p) ()", (const void *)script);
+ hideGoodConscience();
+ return 0;
+}
+
int KyraEngine_v3::o3_waitForConfirmationClick(ScriptState *script) {
debugC(3, kDebugLevelScriptFuncs, "KyraEngine_v3::o2_waitForConfirmationClick(%p) (%d)", (const void *)script, stackPos(0));
resetSkipFlag();
@@ -1545,10 +1565,10 @@
Opcode(o3_getRand);
Opcode(o3_dummy);
Opcode(o3_setDeathHandler);
- OpcodeUnImpl();
+ Opcode(o3_showGoodConscience);
// 0x64
- OpcodeUnImpl();
- OpcodeUnImpl();
+ Opcode(o3_goodConscienceChat);
+ Opcode(o3_hideGoodConscience);
Opcode(o3_dummy);
Opcode(o3_dummy);
// 0x68
Modified: scummvm/trunk/engines/kyra/sequences_v3.cpp
===================================================================
--- scummvm/trunk/engines/kyra/sequences_v3.cpp 2008-04-28 20:34:44 UTC (rev 31765)
+++ scummvm/trunk/engines/kyra/sequences_v3.cpp 2008-04-28 20:45:22 UTC (rev 31766)
@@ -48,8 +48,8 @@
_badConsciencePosition = (_mainCharacter.x1 <= 160);
- //if (_goodConscienceShown)
- // _badConsciencePosition = !_goodConsciencePosition;
+ if (_goodConscienceShown)
+ _badConsciencePosition = !_goodConsciencePosition;
int anim = _badConscienceAnim + (_badConsciencePosition ? 0 : 8);
TalkObject &talkObject = _talkObjectList[1];
@@ -109,6 +109,80 @@
setNextIdleAnimTimer();
}
+void KyraEngine_v3::showGoodConscience() {
+ debugC(9, kDebugLevelMain, "KyraEngine_v3::showGoodConscience()");
+
+ if (_goodConscienceShown)
+ return;
+
+ _goodConscienceShown = true;
+ ++_goodConscienceAnim;
+ _goodConscienceAnim %= 5;
+
+ setNextIdleAnimTimer();
+ _goodConsciencePosition = (_mainCharacter.x1 <= 160);
+
+ if (_badConscienceShown)
+ _goodConsciencePosition = !_badConsciencePosition;
+
+ int anim = _goodConscienceAnim + (_goodConsciencePosition ? 0 : 5);
+ TalkObject &talkObject = _talkObjectList[87];
+
+ if (_goodConsciencePosition)
+ talkObject.x = 290;
+ else
+ talkObject.x = 30;
+ talkObject.y = 30;
+
+ static const char *animFilenames[] = {
+ "STUFL00.WSA", "STUFL02.WSA", "STUFL04.WSA", "STUFL03.WSA", "STUFL01.WSA",
+ "STUFR00.WSA", "STUFR02.WSA", "STUFR04.WSA", "STUFR03.WSA", "STUFR01.WSA"
+ };
+
+ setupSceneAnimObject(0x0F, 9, 0, 187, -1, -1, -1, -1, 0, 0, 0, -1, animFilenames[anim]);
+ for (uint i = 0; i <= _goodConscienceFrameTable[_goodConscienceAnim]; ++i) {
+ if (i == 10)
+ playSoundEffect(0x7F, 0xC8);
+ updateSceneAnim(0x0F, i);
+ delay(2*_tickLength, true);
+ }
+
+ if (_mainCharacter.animFrame < 50 || _mainCharacter.animFrame > 87)
+ return;
+
+ if (_mainCharacter.y1 == -1 || (_mainCharacter.x1 != -1 && _mainCharacter.animFrame == 87) || _mainCharacter.animFrame == 87) {
+ _mainCharacter.animFrame = 87;
+ } else {
+ if (_goodConsciencePosition)
+ _mainCharacter.facing = 3;
+ else
+ _mainCharacter.facing = 5;
+ _mainCharacter.animFrame = _characterFrameTable[_mainCharacter.facing];
+ }
+
+ updateCharacterAnim(0);
+ refreshAnimObjectsIfNeed();
+}
+
+void KyraEngine_v3::hideGoodConscience() {
+ debugC(9, kDebugLevelMain, "KyraEngine_v3::hideGoodConscience()");
+ if (!_goodConscienceShown)
+ return;
+
+ _goodConscienceShown = false;
+ for (int frame = _goodConscienceFrameTable[_goodConscienceAnim+5]; frame >= 0; --frame) {
+ if (frame == 17)
+ playSoundEffect(0x31, 0xC8);
+ updateSceneAnim(0x0F, frame);
+ delay(1*_tickLength, true);
+ }
+
+ updateSceneAnim(0x0F, -1);
+ update();
+ removeSceneAnimObject(0x0F, 1);
+ setNextIdleAnimTimer();
+}
+
void KyraEngine_v3::runTemporaryScript(const char *filename, int allowSkip, int resetChar, int newShapes, int shapeUnload) {
debugC(9, kDebugLevelMain, "KyraEngine_v3::runTemporaryScript('%s', %d, %d, %d, %d)", filename, allowSkip, resetChar, newShapes, shapeUnload);
memset(&_temporaryScriptData, 0, sizeof(_temporaryScriptData));
Modified: scummvm/trunk/engines/kyra/staticres.cpp
===================================================================
--- scummvm/trunk/engines/kyra/staticres.cpp 2008-04-28 20:34:44 UTC (rev 31765)
+++ scummvm/trunk/engines/kyra/staticres.cpp 2008-04-28 20:45:22 UTC (rev 31766)
@@ -2344,6 +2344,14 @@
0x24, 0x24, 0x24, 0x24, 0x24, 0x1D, 0x1D, 0x1D
};
+const uint8 KyraEngine_v3::_goodConscienceFrameTable[] = {
+ 0x13, 0x13, 0x13, 0x13, 0x13,
+ 0x13, 0x13, 0x13, 0x13, 0x13,
+ 0x13, 0x13, 0x13, 0x13, 0x13,
+ 0x15, 0x15, 0x15, 0x15, 0x15,
+ 0x1E, 0x1E, 0x1E, 0x1E, 0x1E
+};
+
const uint8 KyraEngine_v3::_chapterLowestScene[] = {
0x00, 0x00, 0x19, 0x2B, 0x33, 0x3B
};
Modified: scummvm/trunk/engines/kyra/text_v3.cpp
===================================================================
--- scummvm/trunk/engines/kyra/text_v3.cpp 2008-04-28 20:34:44 UTC (rev 31765)
+++ scummvm/trunk/engines/kyra/text_v3.cpp 2008-04-28 20:45:22 UTC (rev 31766)
@@ -438,6 +438,64 @@
}
}
+void KyraEngine_v3::goodConscienceChat(const char *str, int vocHigh, int vocLow) {
+ debugC(9, kDebugLevelMain, "KyraEngine_v3::goodConscienceChat('%s', %d, %d)", str, vocHigh, vocLow);
+ if (!_goodConscienceShown)
+ return;
+
+ setNextIdleAnimTimer();
+ _chatVocHigh = _chatVocLow = -1;
+ objectChatInit(str, 87, vocHigh, vocLow);
+ _chatText = str;
+ _chatObject = 87;
+ goodConscienceChatWaitToFinish();
+ updateSceneAnim(0x0F, _goodConscienceFrameTable[_goodConscienceAnim+10]);
+ _text->restoreScreen();
+ update();
+ _chatText = 0;
+ _chatObject = -1;
+}
+
+void KyraEngine_v3::goodConscienceChatWaitToFinish() {
+ debugC(9, kDebugLevelMain, "KyraEngine_v3::goodConscienceChatWaitToFinish()");
+ if (_chatVocHigh) {
+ playVoice(_chatVocHigh, _chatVocLow);
+ _chatVocHigh = _chatVocLow = -1;
+ }
+
+ bool running = true;
+ const uint32 endTime = _chatEndTime;
+ resetSkipFlag();
+
+ uint32 nextFrame = _system->getMillis() + _rnd.getRandomNumberRng(3, 6) * _tickLength;
+
+ int frame = _goodConscienceFrameTable[_goodConscienceAnim+15];
+ while (running && !_quitFlag) {
+ if (nextFrame < _system->getMillis()) {
+ ++frame;
+ if (_goodConscienceFrameTable[_goodConscienceAnim+20] < frame)
+ frame = _goodConscienceFrameTable[_goodConscienceAnim+15];
+
+ updateSceneAnim(0x0F, frame);
+ updateWithText();
+
+ nextFrame = _system->getMillis() + _rnd.getRandomNumberRng(3, 6) * _tickLength;
+ }
+
+ updateWithText();
+
+ const uint32 curTime = _system->getMillis();
+ if ((textEnabled() && !speechEnabled() && curTime > endTime) || (speechEnabled() && !snd_voiceIsPlaying()) || skipFlag()) {
+ snd_stopVoice();
+ resetSkipFlag();
+ nextFrame = curTime;
+ running = false;
+ }
+
+ delay(10);
+ }
+}
+
void KyraEngine_v3::malcolmSceneStartupChat() {
debugC(9, kDebugLevelMain, "KyraEngine_v3::malcolmSceneStartupChat()");
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