ScummVM API documentation
actorresource.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 ILLUSIONS_ACTORRESOURCE_H
23 #define ILLUSIONS_ACTORRESOURCE_H
24 
25 #include "illusions/graphics.h"
26 #include "illusions/resourcesystem.h"
27 #include "graphics/surface.h"
28 
29 namespace Illusions {
30 
31 class IllusionsEngine;
32 
34 public:
35  ActorResourceLoader(IllusionsEngine *vm) : _vm(vm) {}
36  ~ActorResourceLoader() override {}
37  void load(Resource *resource) override;
38  bool isFlag(int flag) override;
39 protected:
40  IllusionsEngine *_vm;
41 };
42 
43 struct Frame {
44  uint16 _flags;
45  byte *_pointsConfig;
46  SurfInfo _surfInfo;
47  byte *_compressedPixels;
48  void load(byte *dataStart, Common::SeekableReadStream &stream);
49 };
50 
51 struct Sequence {
52  uint32 _sequenceId;
53  uint32 _unk4;
54  byte *_sequenceCode;
55  void load(byte *dataStart, Common::SeekableReadStream &stream);
56 };
57 
58 struct ActorType {
59  uint32 _actorTypeId;
60  SurfInfo _surfInfo;
61  byte *_pointsConfig;
62  NamedPoints _namedPoints;
63  RGB _color;
64  byte _scale;
65  byte _priority;
66  int16 _value1E;
67  uint16 _pathWalkPointsIndex;
68  uint16 _scaleLayerIndex;
69  uint16 _pathWalkRectIndex;
70  uint16 _priorityLayerIndex;
71  uint16 _regionLayerIndex;
72  uint16 _flags;
73  void load(byte *dataStart, Common::SeekableReadStream &stream);
74 };
75 
76 class FramesList : public Common::Array<Frame> {
77 };
78 
80 public:
81  ActorResource();
82  ~ActorResource();
83  void load(Resource *resource);
84  bool containsSequence(Sequence *sequence);
85  bool findNamedPoint(uint32 namedPointId, Common::Point &pt);
86 public:
87  uint32 _totalSize;
88  Common::Array<ActorType> _actorTypes;
89  Common::Array<Sequence> _sequences;
90  FramesList _frames;
91  NamedPoints _namedPoints;
92 };
93 
95 public:
97  void load(Resource *resource) override;
98  void unload() override;
99  void pause() override;
100  void unpause() override;
101 public:
102  IllusionsEngine *_vm;
103  uint32 _sceneId;
104  int _pauseCtr;
105  ActorResource *_actorResource;
106 protected:
107  void initActorTypes(int gameId);
108  void registerResources();
109  void unregisterResources();
110 };
111 
113 public:
116  ActorInstance *createActorInstance(Resource *resource);
117  void removeActorInstance(ActorInstance *actorInstance);
118  void pauseBySceneId(uint32 sceneId);
119  void unpauseBySceneId(uint32 sceneId);
120  FramesList *findSequenceFrames(Sequence *sequence);
121  ActorInstance *findActorByResource(ActorResource *actorResource);
122  bool findNamedPoint(uint32 namedPointId, Common::Point &pt);
123 protected:
126  IllusionsEngine *_vm;
127  Items _items;
128 };
129 
130 } // End of namespace Illusions
131 
132 #endif // ILLUSIONS_ACTORRESOURCE_H
Definition: array.h:52
Definition: graphics.h:59
Definition: actor.h:34
Definition: stream.h:745
Definition: actorresource.h:79
Definition: resourcesystem.h:51
Definition: graphics.h:38
Definition: actorresource.h:94
Definition: rect.h:45
Definition: actorresource.h:58
Definition: resourcesystem.h:42
Definition: resourcesystem.h:78
Definition: actorresource.h:43
Definition: actorresource.h:51
Definition: list_intern.h:51
Definition: actorresource.h:112
Definition: graphics.h:49
Definition: actorresource.h:33
Definition: illusions.h:92
Definition: actorresource.h:76