ScummVM API documentation
entity.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 #ifndef TWINE_PARSER_ENTITY_H
23 #define TWINE_PARSER_ENTITY_H
24 
25 #include "common/array.h"
26 #include "common/memstream.h"
27 #include "common/stream.h"
28 #include "twine/parser/body.h"
29 #include "twine/parser/parser.h"
30 #include "twine/shared.h"
31 
32 namespace TwinE {
33 
34 struct EntityBody {
35  int index;
36  ActorBoundingBox actorBoundingBox;
38  BodyData body;
39 };
40 
41 struct EntityAnim {
42  AnimationTypes animation;
43  int animIndex;
44 
45  struct Action {
46  ActionType type = ActionType::ACTION_NOP;
47  uint8 animFrame = 0;
48  uint8 lastAnimFrame = 0;
49  int8 weight = 0;
50  byte sampleVolume = 0;
51  int16 pointIndex = 0;
52  int16 spriteIndex = 0;
53  uint8 targetActor = 0;
54  int16 sampleIndex = 0;
55  int16 frequency = 0;
56  int16 xAngle = 0;
57  int16 yAngle = 0;
58  int16 xRotPoint = 0;
59  int16 extraAngle = 0;
60  int16 finalAngle = 0;
61  int16 strength = 0;
62  int16 distanceX = 0;
63  int16 distanceY = 0;
64  int16 distanceZ = 0;
65  int16 yHeight = 0;
66  int16 repeat = 0;
67  int16 speed = 0;
68  int16 superHitX = 0;
69  int16 superHitY = 0;
70  int16 superHitZ = 0;
71  int16 sizeSuperHit = 0;
72  int16 decal = 0;
73  int32 scale = 0;
74  BoundingBox bbox;
75  };
76 
77  Common::Array<Action> _actions;
78 };
79 
83 class EntityData : public Parser {
84 private:
86  Common::Array<EntityAnim> _animations;
87 
88  bool loadBody(Common::SeekableReadStream &stream, bool lba1);
89  bool loadAnim(Common::SeekableReadStream &stream, bool lba1);
90 
91 protected:
92  void reset() override;
93 
94 public:
95  bool loadFromStream(Common::SeekableReadStream &stream, bool lba1) override;
96 
97  const Common::Array<EntityAnim::Action> *getActions(AnimationTypes animation) const;
98  const EntityBody *getEntityBody(const int index) const;
99  BodyData &getBody(int index);
100  int32 getAnimIndex(AnimationTypes animation) const;
101 
102  const Common::Array<EntityBody> &getBodies() const {
103  return _bodies;
104  }
105  const Common::Array<EntityAnim> &getAnimations() const {
106  return _animations;
107  }
108 
109  Common::Array<EntityBody> &getBodies() {
110  return _bodies;
111  }
112  Common::Array<EntityAnim> &getAnimations() {
113  return _animations;
114  }
115 };
116 
117 } // End of namespace TwinE
118 
119 #endif
Definition: array.h:52
Definition: entity.h:34
Definition: stream.h:745
int index
Definition: entity.h:35
Graphics::Surface * scale(const Graphics::Surface &srcImage, int xSize, int ySize)
Associate 3d models from body hqr with animations from anim.hqr for the game characters.
Definition: entity.h:83
Definition: achievements_tables.h:27
int hqrBodyIndex
Definition: entity.h:37
Definition: parser.h:32
Axis aligned bounding box.
Definition: shared.h:188
Definition: entity.h:41
Definition: shared.h:197
Definition: entity.h:45
Definition: body.h:35