ScummVM API documentation
holomap.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_HOLOMAP_H
23 #define TWINE_PARSER_HOLOMAP_H
24 
25 #include "common/memstream.h"
26 #include "twine/parser/parser.h"
27 
28 namespace TwinE {
29 
30 enum HolomapVehicle {
31  FerryBoat = 31,
32  Motorbike = 33,
33  Car = 35,
34  FishingBoat = 37,
35  Catamaran = 39,
36  Hovercraft = 41,
37  Dino = 43,
38  ArmyBoat = 45,
39  HamalayiTransporter = 47
40 };
41 
42 struct TrajectoryPos {
43  int16 x = 0;
44  int16 y = 0;
45 };
46 
47 struct Trajectory {
48  int16 locationIdx = -1;
49  int16 trajLocationIdx = -1;
50  int16 vehicleIdx = -1;
51  IVec3 pos;
52  int16 numAnimFrames = 0;
53  TrajectoryPos positions[512];
54 
55  bool isValid() const {
56  return locationIdx != -1;
57  }
58 
63  int32 getModel() const {
64  return 2 * vehicleIdx + HolomapVehicle::FerryBoat;
65  }
66 
67  int32 getAnimation() const {
68  return getModel() + 1;
69  }
70 };
71 
72 class TrajectoryData : public Parser {
73 private:
74  Common::Array<Trajectory> _trajectories;
75 protected:
76  void reset() override;
77 public:
78  bool loadFromStream(Common::SeekableReadStream &stream, bool lba1) override;
79 
80  const Trajectory *getTrajectory(uint index) const {
81  if (index >= _trajectories.size()) {
82  return nullptr;
83  }
84  return &_trajectories[index];
85  }
86 
87  const Common::Array<Trajectory> &getTrajectories() const {
88  return _trajectories;
89  }
90 };
91 
92 } // End of namespace TwinE
93 
94 #endif
Definition: holomap.h:47
Definition: array.h:52
Definition: shared.h:120
int32 getModel() const
Definition: holomap.h:63
Definition: stream.h:745
Definition: holomap.h:72
Definition: achievements_tables.h:27
size_type size() const
Definition: array.h:315
Definition: holomap.h:42
Definition: parser.h:32