diff options
-rw-r--r-- | engines/kyra/animator_v3.cpp | 82 | ||||
-rw-r--r-- | engines/kyra/kyra_v3.cpp | 2 | ||||
-rw-r--r-- | engines/kyra/kyra_v3.h | 14 | ||||
-rw-r--r-- | engines/kyra/module.mk | 1 | ||||
-rw-r--r-- | engines/kyra/script_v3.cpp | 16 | ||||
-rw-r--r-- | engines/kyra/staticres.cpp | 8 |
6 files changed, 121 insertions, 2 deletions
diff --git a/engines/kyra/animator_v3.cpp b/engines/kyra/animator_v3.cpp index 8a88f24b3c..31f6d1bad3 100644 --- a/engines/kyra/animator_v3.cpp +++ b/engines/kyra/animator_v3.cpp @@ -378,6 +378,88 @@ void KyraEngine_v3::updateSceneAnim(int anim, int newFrame) { } } +void KyraEngine_v3::setupSceneAnimObject(int animId, uint16 flags, int x, int y, int x2, int y2, int w, + int h, int unk10, int specialSize, int unk14, int shape, const char *filename) { + restorePage3(); + SceneAnim &anim = _sceneAnims[animId]; + anim.flags = flags; + anim.x = x; + anim.y = y; + anim.x2 = x2; + anim.y2 = y2; + anim.width = w; + anim.height = h; + anim.unk10 = unk10; + anim.specialSize = specialSize; + anim.unk14 = unk14; + anim.shapeIndex = shape; + if (filename) + strcpy(anim.filename, filename); + + if (flags & 8) { + _sceneAnimMovie[animId]->open(filename, 1, 0); + musicUpdate(0); + if (_sceneAnimMovie[animId]->opened()) { + anim.wsaFlag = 1; + if (x2 == -1) + x2 = _sceneAnimMovie[animId]->xAdd(); + if (y2 == -1) + y2 = _sceneAnimMovie[animId]->yAdd(); + if (w == -1) + w = _sceneAnimMovie[animId]->width(); + if (h == -1) + h = _sceneAnimMovie[animId]->height(); + if (x == -1) + x = (w >> 1) + x2; + if (y == -1) + y = y2 + h - 1; + + anim.x = x; + anim.y = y; + anim.x2 = x2; + anim.y2 = y2; + anim.width = w; + anim.height = h; + } + } + + AnimObj *obj = &_animObjects[1+animId]; + obj->enabled = true; + obj->needRefresh = true; + + obj->unk8 = (anim.flags & 0x20) ? 1 : 0; + obj->flags = (anim.flags & 0x10) ? 0x800 : 0; + if (anim.flags & 2) + obj->flags |= 1; + + obj->xPos1 = anim.x; + obj->yPos1 = anim.y; + + if ((anim.flags & 4) && anim.shapeIndex != 0xFFFF) + obj->shapePtr = _sceneShapes[anim.shapeIndex]; + else + obj->shapePtr = 0; + + if (anim.flags & 8) { + obj->shapeIndex3 = anim.shapeIndex; + obj->animNum = animId; + } else { + obj->shapeIndex3 = 0xFFFF; + obj->animNum = 0xFFFF; + } + + obj->xPos3 = obj->xPos2 = anim.x2; + obj->yPos3 = obj->yPos2 = anim.y2; + obj->width = anim.width; + obj->height = anim.height; + obj->width2 = obj->height2 = anim.specialSize; + + if (_animList) + _animList = addToAnimListSorted(_animList, obj); + else + _animList = initAnimList(_animList, obj); +} + void KyraEngine_v3::removeSceneAnimObject(int anim, int refresh) { debugC(9, kDebugLevelAnimator, "KyraEngine_v3::removeSceneAnimObject(%d, %d)", anim, refresh); AnimObj *obj = &_animObjects[anim+1]; diff --git a/engines/kyra/kyra_v3.cpp b/engines/kyra/kyra_v3.cpp index b61f82f9dc..42207299d2 100644 --- a/engines/kyra/kyra_v3.cpp +++ b/engines/kyra/kyra_v3.cpp @@ -106,6 +106,8 @@ KyraEngine_v3::KyraEngine_v3(OSystem *system, const GameFlags &flags) : KyraEngi _charBackUpWidth = _charBackUpHeight = -1; _useActorBuffer = false; _curStudioSFX = 283; + _badConscienceShown = false; + _curChapter = 1; } KyraEngine_v3::~KyraEngine_v3() { diff --git a/engines/kyra/kyra_v3.h b/engines/kyra/kyra_v3.h index 739da1ee9c..a0c15463ce 100644 --- a/engines/kyra/kyra_v3.h +++ b/engines/kyra/kyra_v3.h @@ -216,6 +216,7 @@ private: void updateCharacterAnim(int charId); void updateSceneAnim(int anim, int newFrame); + void setupSceneAnimObject(int anim, uint16 flags, int x, int y, int x2, int y2, int w, int h, int unk10, int specialSize, int unk14, int shape, const char *filename); void removeSceneAnimObject(int anim, int refresh); int _charBackUpWidth2, _charBackUpHeight2; @@ -459,6 +460,16 @@ private: void objectChatProcess(const char *script); void objectChatWaitToFinish(); + // conscience + bool _badConscienceShown; + int _badConscienceAnim; + bool _badConsciencePosition; + + static const uint8 _badConscienceFrameTable[]; + + void showBadConscience(); + void hideBadConscience(); + // special script code bool _temporaryScriptExecBit; bool _useFrameTable; @@ -486,6 +497,7 @@ private: uint8 *_gfxBackUpRect; uint8 *_paletteOverlay; bool _useActorBuffer; + int _curChapter; int _unk3, _unk4, _unk5; @@ -498,6 +510,8 @@ private: int o3_defineObject(ScriptState *script); int o3_refreshCharacter(ScriptState *script); int o3_showSceneFileMessage(ScriptState *script); + int o3_showBadConscience(ScriptState *script); + int o3_hideBadConscience(ScriptState *script); int o3_objectChat(ScriptState *script); int o3_defineItem(ScriptState *script); int o3_queryGameFlag(ScriptState *script); diff --git a/engines/kyra/module.mk b/engines/kyra/module.mk index fd6bb9deef..8bd0fd71b6 100644 --- a/engines/kyra/module.mk +++ b/engines/kyra/module.mk @@ -36,6 +36,7 @@ MODULE_OBJS := \ seqplayer.o \ sequences_v1.o \ sequences_v2.o \ + sequences_v3.o \ sound_adlib.o \ sound_digital.o \ sound_towns.o \ diff --git a/engines/kyra/script_v3.cpp b/engines/kyra/script_v3.cpp index b7f0e80acc..a518f480a3 100644 --- a/engines/kyra/script_v3.cpp +++ b/engines/kyra/script_v3.cpp @@ -89,6 +89,18 @@ int KyraEngine_v3::o3_showSceneFileMessage(ScriptState *script) { return 0; } +int KyraEngine_v3::o3_showBadConscience(ScriptState *script) { + debugC(3, kDebugLevelScriptFuncs, "KyraEngine_v3::o3_showBadConscience(%p) ()", (const void *)script); + showBadConscience(); + return 0; +} + +int KyraEngine_v3::o3_hideBadConscience(ScriptState *script) { + debugC(3, kDebugLevelScriptFuncs, "KyraEngine_v3::o3_hideBadConscience(%p) ()", (const void *)script); + hideBadConscience(); + return 0; +} + int KyraEngine_v3::o3_objectChat(ScriptState *script) { debugC(3, kDebugLevelScriptFuncs, "KyraEngine_v3::o3_objectChat(%p) (%d)", (const void *)script, stackPos(0)); int id = stackPos(0); @@ -425,9 +437,9 @@ void KyraEngine_v3::setupOpcodeTable() { Opcode(o3_dummy), // 0x14 OpcodeUnImpl(), - OpcodeUnImpl(), + Opcode(o3_showBadConscience), Opcode(o3_dummy), - OpcodeUnImpl(), + Opcode(o3_hideBadConscience), // 0x18 OpcodeUnImpl(), OpcodeUnImpl(), diff --git a/engines/kyra/staticres.cpp b/engines/kyra/staticres.cpp index caafa8a8d1..94bc285302 100644 --- a/engines/kyra/staticres.cpp +++ b/engines/kyra/staticres.cpp @@ -2310,6 +2310,14 @@ const char *KyraEngine_v3::_sfxFileList[] = { const int KyraEngine_v3::_sfxFileListSize = ARRAYSIZE(KyraEngine_v3::_sfxFileList); +const uint8 KyraEngine_v3::_badConscienceFrameTable[] = { + 0x13, 0x13, 0x13, 0x18, 0x13, 0x13, 0x13, 0x13, + 0x13, 0x13, 0x13, 0x10, 0x13, 0x13, 0x13, 0x13, + 0x13, 0x13, 0x13, 0x18, 0x13, 0x13, 0x13, 0x13, + 0x15, 0x15, 0x14, 0x18, 0x14, 0x14, 0x14, 0x14, + 0x24, 0x24, 0x24, 0x24, 0x24, 0x1D, 0x1D, 0x1D +}; + } // End of namespace Kyra |