Go to the documentation of this file.00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023 #ifndef STARK_RESOURCES_ANIM_SCRIPT_H
00024 #define STARK_RESOURCES_ANIM_SCRIPT_H
00025
00026 #include "common/str.h"
00027
00028 #include "engines/stark/resources/object.h"
00029
00030 namespace Stark {
00031
00032 namespace Formats {
00033 class XRCReadStream;
00034 }
00035
00036 namespace Resources {
00037
00038 class Anim;
00039 class AnimScriptItem;
00040
00050 class AnimScript : public Object {
00051 public:
00052 static const Type::ResourceType TYPE = Type::kAnimScript;
00053
00054 AnimScript(Object *parent, byte subType, uint16 index, const Common::String &name);
00055 virtual ~AnimScript();
00056
00057
00058 void onAllLoaded() override;
00059 void onGameLoop() override;
00060 void saveLoad(ResourceSerializer *serializer) override;
00061
00063 void goToScriptItem(AnimScriptItem *item);
00064
00066 bool hasReached(AnimScriptItem *item);
00067
00069 bool isDone() const;
00070
00071 protected:
00072 void goToNextItem();
00073 int32 findItemIndex(AnimScriptItem *item);
00074
00075 Anim *_anim;
00076 Common::Array<AnimScriptItem *> _items;
00077
00078 int32 _nextItemIndex;
00079 int32 _msecsToNextUpdate;
00080 bool _done;
00081 };
00082
00089 class AnimScriptItem : public Object {
00090 public:
00091 static const Type::ResourceType TYPE = Type::kAnimScriptItem;
00092
00093 enum Opcodes {
00094 kDisplayFrame = 0,
00095 kPlayAnimSound = 1,
00096 kGoToItem = 2,
00097 kDisplayRandomFrame = 3,
00098 kSleepRandomDuration = 4,
00099 kPlayStockSound = 5
00100 };
00101
00102 AnimScriptItem(Object *parent, byte subType, uint16 index, const Common::String &name);
00103 virtual ~AnimScriptItem();
00104
00105
00106 void readData(Formats::XRCReadStream *stream) override;
00107
00109 uint32 getOpcode() const { return _opcode; }
00110
00112 uint32 getOperand() const { return _operand; }
00113
00115 uint32 getDuration() const { return _duration; }
00116
00117 protected:
00118 void printData() override;
00119
00120 uint32 _opcode;
00121 uint32 _operand;
00122 uint32 _duration;
00123 };
00124
00125 }
00126 }
00127
00128 #endif // STARK_RESOURCES_ANIM_SCRIPT_H