some more opcodes (the fly tree is now operational) and some bug fixes

svn-id: r30903
This commit is contained in:
Florian Kagerer 2008-02-18 23:04:37 +00:00
parent ab40f56f47
commit bcdfe6ade0
5 changed files with 66 additions and 19 deletions

View file

@ -98,6 +98,7 @@ KyraEngine_v2::KyraEngine_v2(OSystem *system, const GameFlags &flags) : KyraEngi
_colorCodeFlag1 = 0;
_colorCodeFlag2 = -1;
_scriptCountDown = 0;
memset(&_sceneScriptData, 0, sizeof(_sceneScriptData));
@ -125,6 +126,15 @@ KyraEngine_v2::~KyraEngine_v2() {
delete _debugger;
delete _invWsa.wsa;
if (_sequenceSoundList) {
for (int i = 0; i < _sequenceSoundListSize; i++) {
if (_sequenceSoundList[i])
delete _sequenceSoundList[i];
}
delete [] _sequenceSoundList;
_sequenceSoundList = NULL;
}
if (_dlgBuffer)
delete [] _dlgBuffer;
for (int i = 0; i < 19; i++)
@ -1908,9 +1918,9 @@ void KyraEngine_v2::setupOpcodeTable() {
Opcode(o2_getDlgIndex),
Opcode(o2_defineRoom),
OpcodeUnImpl(),
OpcodeUnImpl(),
Opcode(o2_setCountDown),
// 0x7c
OpcodeUnImpl(),
Opcode(o2_getCountDown),
Opcode(o2_dummy),
Opcode(o2_dummy),
OpcodeUnImpl(),
@ -1922,8 +1932,8 @@ void KyraEngine_v2::setupOpcodeTable() {
// 0x84
Opcode(o2_getColorCodeFlag2),
Opcode(o2_setColorCodeFlag2),
OpcodeUnImpl(),
OpcodeUnImpl(),
Opcode(o2_getColorCodeValue),
Opcode(o2_setColorCodeValue),
// 0x88
Opcode(o2_countItemInstances),
OpcodeUnImpl(),
@ -1958,7 +1968,7 @@ void KyraEngine_v2::setupOpcodeTable() {
OpcodeUnImpl(),
OpcodeUnImpl(),
OpcodeUnImpl(),
OpcodeUnImpl(),
Opcode(o2_getBoolFromStack),
// 0xa4
OpcodeUnImpl(),
OpcodeUnImpl(),
@ -1996,3 +2006,4 @@ void KyraEngine_v2::setupOpcodeTable() {

View file

@ -862,11 +862,15 @@ protected:
int o2_setupDialogue(ScriptState *script);
int o2_getDlgIndex(ScriptState *script);
int o2_defineRoom(ScriptState *script);
int o2_setCountDown(ScriptState *script);
int o2_getCountDown(ScriptState *script);
int o2_objectChat(ScriptState *script);
int o2_getColorCodeFlag1(ScriptState *script);
int o2_setColorCodeFlag1(ScriptState *script);
int o2_getColorCodeFlag2(ScriptState *script);
int o2_setColorCodeFlag2(ScriptState *script);
int o2_getColorCodeValue(ScriptState *script);
int o2_setColorCodeValue(ScriptState *script);
int o2_countItemInstances(ScriptState *script);
int o2_initObject(ScriptState *script);
int o2_npcChat(ScriptState *script);
@ -879,6 +883,7 @@ protected:
int o2_getHiddenItemsEntry(ScriptState *script);
int o2_customChat(ScriptState *script);
int o2_customChatFinish(ScriptState *script);
int o2_getBoolFromStack(ScriptState *script);
int o2_setVocHigh(ScriptState *script);
int o2_getVocHigh(ScriptState *script);
int o2_zanthiaChat(ScriptState *script);
@ -981,9 +986,11 @@ protected:
Sequence *_sequences;
NestedSequence *_nSequences;
// these are used whenever the color code has to be entered
// color code related vars
int _colorCodeFlag1;
int _colorCodeFlag2;
uint8 _colorCode[7];
uint32 _scriptCountDown;
};
} // end of namespace Kyra
@ -992,3 +999,4 @@ protected:

View file

@ -233,6 +233,7 @@ void KyraEngine_v2::enterNewSceneUnk1(int facing, int unk1, int unk2) {
void KyraEngine_v2::enterNewSceneUnk2(int unk1) {
_unk3 = -1;
if (_flags.isTalkie) {
if (_mainCharX == -1 && _mainCharY == -1 && _mainCharacter.sceneId != 61 &&
!queryGameFlag(0x1F1) && !queryGameFlag(0x192) && !queryGameFlag(0x193) &&
_mainCharacter.sceneId != 70 && !queryGameFlag(0x159) && _mainCharacter.sceneId != 37) {
@ -240,6 +241,13 @@ void KyraEngine_v2::enterNewSceneUnk2(int unk1) {
updateCharacterAnim(0);
refreshAnimObjectsIfNeed();
}
} else if (_mainCharX != -1 && _mainCharY != -1) {
if (_characterFrameTable[_mainCharacter.facing] == 25)
_mainCharacter.facing = 5;
_mainCharacter.animFrame = _characterFrameTable[_mainCharacter.facing];
updateCharacterAnim(0);
refreshAnimObjectsIfNeed();
}
if (!unk1) {
runSceneScript4(0);

View file

@ -680,6 +680,18 @@ int KyraEngine_v2::o2_defineRoom(ScriptState *script) {
return 0;
}
int KyraEngine_v2::o2_setCountDown(ScriptState *script) {
debugC(3, kDebugLevelScriptFuncs, "o2_setCountDown(%p) (%d)", (const void *)script, stackPos(0));
_scriptCountDown = _system->getMillis() + stackPos(0) * _tickLength;
return 0;
}
int KyraEngine_v2::o2_getCountDown(ScriptState *script) {
debugC(3, kDebugLevelScriptFuncs, "o2_getCountDown(%p)", (const void *)script);
uint32 time = _system->getMillis();
return (time > _scriptCountDown) ? 0 : _scriptCountDown - time;
}
int KyraEngine_v2::o2_objectChat(ScriptState *script) {
debugC(3, kDebugLevelScriptFuncs, "o2_objectChat(%p) ('%s', %d)", (const void *)script, stackPosString(0), stackPos(1));
if (_flags.isTalkie)
@ -711,6 +723,17 @@ int KyraEngine_v2::o2_setColorCodeFlag2(ScriptState *script) {
return 0;
}
int KyraEngine_v2::o2_getColorCodeValue(ScriptState *script) {
debugC(3, kDebugLevelScriptFuncs, "o2_getColorCodeValue(%p) (%d)", (const void *)script, stackPos(0));
return _colorCode[stackPos(0)];
}
int KyraEngine_v2::o2_setColorCodeValue(ScriptState *script) {
debugC(3, kDebugLevelScriptFuncs, "o2_setColorCodeValue(%p) (%d, %d)", (const void *)script, stackPos(0), stackPos(1));
_colorCode[stackPos(0)] = stackPos(1) & 0xff;
return stackPos(1) & 0xff;
}
int KyraEngine_v2::o2_countItemInstances(ScriptState *script) {
debugC(3, kDebugLevelScriptFuncs, "o2_countItemInstances(%p) (%d)", (const void *)script, stackPos(0));
uint16 item = stackPos(0);
@ -819,6 +842,11 @@ int KyraEngine_v2::o2_customChatFinish(ScriptState *script) {
return 0;
}
int KyraEngine_v2::o2_getBoolFromStack(ScriptState *script) {
debugC(3, kDebugLevelScriptFuncs, "o2_getBoolFromStack(%p) ()", (const void *)script);
return stackPos(0) ? 1 : 0;
}
int KyraEngine_v2::o2_setVocHigh(ScriptState *script) {
debugC(3, kDebugLevelScriptFuncs, "o2_setVocHigh(%p) (%d)", (const void *)script, stackPos(0));
_vocHigh = stackPos(0);
@ -910,3 +938,4 @@ int KyraEngine_v2::o2t_setShapeFlag(ScriptState *script) {

View file

@ -2625,15 +2625,6 @@ void KyraEngine_v2::seq_uninit() {
delete [] _seqProcessedString;
_seqProcessedString = NULL;
if (_sequenceSoundList) {
for (int i = 0; i < _sequenceSoundListSize; i++) {
if (_sequenceSoundList[i])
delete _sequenceSoundList[i];
}
delete [] _sequenceSoundList;
_sequenceSoundList = NULL;
}
delete [] _activeWSA;
_activeWSA = NULL;