ScummVM API documentation
xanimation_set.h
1 /* ScummVM - Graphic Adventure Engine
2  *
3  * ScummVM is the legal property of its developers, whose names
4  * are too numerous to list here. Please refer to the COPYRIGHT
5  * file distributed with this source distribution.
6  *
7  * This program is free software: you can redistribute it and/or modify
8  * it under the terms of the GNU General Public License as published by
9  * the Free Software Foundation, either version 3 of the License, or
10  * (at your option) any later version.
11  *
12  * This program is distributed in the hope that it will be useful,
13  * but WITHOUT ANY WARRANTY; without even the implied warranty of
14  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15  * GNU General Public License for more details.
16  *
17  * You should have received a copy of the GNU General Public License
18  * along with this program. If not, see <http://www.gnu.org/licenses/>.
19  *
20  */
21 
22 /*
23  * This file is based on WME.
24  * http://dead-code.org/redir.php?target=wme
25  * Copyright (c) 2003-2013 Jan Nedoma and contributors
26  */
27 
28 #ifndef WINTERMUTE_ANIMATION_SET_H
29 #define WINTERMUTE_ANIMATION_SET_H
30 
31 #include "engines/wintermute/base/base_named_object.h"
32 #include "engines/wintermute/base/gfx/xanimation.h"
33 #include "engines/wintermute/base/gfx/xframe_node.h"
34 #include "engines/wintermute/utils/utils.h"
35 #include "engines/wintermute/coll_templ.h"
36 #include "engines/wintermute/persistent.h"
37 
38 namespace Wintermute {
39 
40 class XModel;
41 
42 class AnimationSet : public BaseNamedObject {
43 public:
46  public:
47  char *_eventName;
48  int32 _frame;
49 
50  AnimationEvent() {
51  _eventName = nullptr;
52  _frame = -1;
53  }
54 
55  AnimationEvent(char *name, int frame) {
56  _eventName = nullptr;
57  BaseUtils::setString(&_eventName, name);
58  _frame = frame;
59  }
60 
61  virtual ~AnimationEvent() {
62  if (_eventName) {
63  delete[] _eventName;
64  }
65  }
66 
67  bool persist(BasePersistenceManager *persistMgr) {
68  persistMgr->transferCharPtr(TMEMBER(_eventName));
69  persistMgr->transferSint32(TMEMBER(_frame));
70  return true;
71  }
72  };
73 
74  AnimationSet(BaseGame *inGame, XModel *model);
75  virtual ~AnimationSet();
76 
77  bool findBones(FrameNode *rootFrame);
78  bool addAnimation(Animation *anim);
79  bool addEvent(AnimationEvent *event);
80  bool update(int slot, uint32 localTime, float lerpValue);
81  bool onFrameChanged(int currentFrame, int prevFrame);
82 
83  int getFrameTime();
84  uint32 getTotalTime();
85 
86  bool _looping;
87 
88  bool persist(BasePersistenceManager *persistMgr);
89 
90 protected:
91  BaseArray<Animation *> _animations;
93 
94  int _frameTime;
95  uint32 _totalTime;
96  XModel *_model;
97 };
98 
99 } // namespace Wintermute
100 
101 #endif
Definition: base_game.h:75
Definition: base_persistence_manager.h:55
Definition: xanimation_set.h:42
Definition: xmodel.h:58
Definition: xanimation_set.h:45
Definition: coll_templ.h:63
Definition: base_named_object.h:36
Definition: xanimation.h:45
Definition: xframe_node.h:46
Definition: achievements_tables.h:27