ResidualVM logo ResidualVM website - Forums - Contact us BuildBot - Doxygen - Wiki curved edge

animscript.h

Go to the documentation of this file.
00001 /* ResidualVM - A 3D game interpreter
00002  *
00003  * ResidualVM is the legal property of its developers, whose names
00004  * are too numerous to list here. Please refer to the AUTHORS
00005  * file distributed with this source distribution.
00006  *
00007  * This program is free software; you can redistribute it and/or
00008  * modify it under the terms of the GNU General Public License
00009  * as published by the Free Software Foundation; either version 2
00010  * of the License, or (at your option) any later version.
00011  *
00012  * This program is distributed in the hope that it will be useful,
00013  * but WITHOUT ANY WARRANTY; without even the implied warranty of
00014  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
00015  * GNU General Public License for more details.
00016  *
00017  * You should have received a copy of the GNU General Public License
00018  * along with this program; if not, write to the Free Software
00019  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
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     // Resource API
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     // Resource API
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 } // End of namespace Resources
00126 } // End of namespace Stark
00127 
00128 #endif // STARK_RESOURCES_ANIM_SCRIPT_H


Generated on Sat Mar 16 2019 05:01:19 for ResidualVM by doxygen 1.7.1
curved edge   curved edge