ScummVM API documentation
te_warp.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 TETRAEDGE_TE_TE_WARP_H
23 #define TETRAEDGE_TE_TE_WARP_H
24 
25 #include "common/file.h"
26 
27 #include "tetraedge/te/te_3d_object2.h"
28 #include "tetraedge/te/te_camera.h"
29 #include "tetraedge/te/te_frustum.h"
30 #include "tetraedge/te/te_pick_mesh.h"
31 #include "tetraedge/te/te_quaternion.h"
32 #include "tetraedge/te/te_warp_marker.h"
33 #include "tetraedge/te/te_warp_bloc.h"
34 
35 namespace Tetraedge {
36 
37 // Note: Only used in Amerzone
38 class TeWarp : public Te3DObject2 {
39 public:
40  struct FrameData {
41  Common::Array<TeWarpBloc> _warpBlocs;
42  TePickMesh _pickMesh;
43  int _loadedTexCount;
44  // Note: dropped "minblock" param from original as it's only
45  // ever set to 0
46  void loadTextures(const TeFrustum &frustum, Common::File &file, const Common::String &fileType);
47  void unloadTextures();
48  };
49 
50  class AnimData {
51  public:
52  AnimData() : _fps(15.0f), _enabled(false), _curFrameNo(0), _repCount(0), _firstFrameNo(0), _endFrameNo(0) {}
54  float _fps;
55  int _repCount;
56  int _firstFrameNo;
57  int _endFrameNo;
58  int _curFrameNo;
59  bool _enabled;
60  TeTimer _timer;
61  Common::String _name;
62  Common::Array<FrameData> _frameDatas;
63  };
64 
65  struct Block {
66  TeWarpBloc::CubeFace _face;
67  int _x;
68  int _y;
69  TeVector2s32 _offset;
70  };
71 
72  struct Exit {
73  Exit() : _camAngleX(0), _camAngleY(0), _markerId(0) {}
74  Common::String _name;
75  Common::String _linkedWarpPath;
76  float _camAngleX;
77  float _camAngleY;
78  long _markerId;
79  Common::List<Block> _warpBlockList;
80  };
81 
82  TeWarp();
83  ~TeWarp();
84 
85  void activeMarkers(bool active);
86  uint addQuadToPickMesh(TePickMesh &pickmesh, uint trinum, TeWarpBloc::CubeFace face,
87  const TeVector2s32 &param_4, uint param_5, uint param_6);
88  TeMarker *allocMarker(unsigned long *nMarkers);
89  void configMarker(const Common::String &objname, int markerImgNo, long markerId);
90  void checkObjectEvents();
91  void clear();
92  //void entry(); // unused
93  AnimData *findAnimation(const Common::String &name);
94  Exit *findExit(const Common::String &name, bool flag);
95  //int getAnimationFrame(const Common::String &name); // unused
96  bool hasObjectOrAnim(const Common::String &name) const;
97  void init();
98  void load(const Common::Path &path, bool flag);
99  //void loadTextures(); // unused
100  //void preload(const Common::Path &path); // unused
101  void putObject(const Common::String &name, bool enable);
102  void update();
103  void render();
104  void rotateCamera(const TeQuaternion &rot);
105  void sendExit(Exit &exit);
106  void sendMarker(const Common::String &name, unsigned long markerId);
107  void setColor(const TeColor &col) override;
108  void setMarkersOpacity(float opacity);
109  void setMouseLeftUpForMakers();
110  void setFov(float fov);
111  void setVisible(bool v1, bool v2);
112  void startAnimationPart(const Common::String &name, int x, int y, int z, bool flag);
113  void takeObject(const Common::String &name);
114  void unload();
115  void unloadTextures();
116  void updateCamera(const TeVector3f32 &screen);
117 
118  static bool debug;
119 
120  TeSignal1Param<const Common::String &> &markerValidatedSignal() { return _markerValidatedSignal; }
121  TeSignal1Param<const Common::String &> &animFinishedSignal() { return _animFinishedSignal; }
122  bool markersActive() const { return _markersActive; }
123 
124 private:
125  bool onMouseLeftDown(const Common::Point &pt);
126  bool onMarkerValidated(const Common::String &name);
127 
128  Common::File _file;
129  Common::Path _warpPath;
130  TeCamera _camera;
131  bool _markersActive;
132  bool _visible1;
133  bool _loaded;
134  bool _preloaded;
135  bool _renderWarpBlocs;
136 
137  const TePickMesh *_clickedPickMesh;
138  const AnimData *_clickedAnimData;
139 
140  TeFrustum _frustum;
141 
142  Common::Array<TeWarpMarker *> _warpMarkers;
143  // FIXME: Seems useless
145  Common::Array<AnimData *> _putAnimData;
146  Common::List<TeWarp::Exit> _exitList;
147  uint _someXVal;
148  uint _someYVal;
149  uint _someMeshX;
150  uint _someMeshY;
151  uint _xCount;
152  uint _yCount;
153  Common::Array<TeWarpBloc> _warpBlocs;
154  Common::Array<TePickMesh *> _pickMeshes2;
155  Common::Array<AnimData> _loadedAnimData;
156  TeSignal1Param<const Common::String &> _markerValidatedSignal;
157  TeSignal1Param<const Common::String &> _animFinishedSignal;
158  Common::String _texEncodingType;
159 };
160 
161 } // end namespace Tetraedge
162 
163 #endif // TETRAEDGE_TE_TE_WARP_H
Definition: te_camera.h:38
Definition: str.h:59
Definition: detection.h:27
Definition: te_warp.h:40
Definition: te_warp.h:65
Definition: te_quaternion.h:32
Definition: array.h:52
Definition: te_pick_mesh.h:31
Definition: te_color.h:30
Definition: path.h:52
Definition: te_warp.h:38
Definition: te_timer.h:33
void debug(MSVC_PRINTF const char *s,...) GCC_PRINTF(1
Definition: file.h:47
Definition: te_3d_object2.h:36
Definition: rect.h:45
Definition: te_warp.h:50
Definition: te_vector2s32.h:31
Definition: te_vector3f32.h:33
Definition: te_warp.h:72
Definition: te_signal.h:80
Definition: te_frustum.h:33
Definition: te_marker.h:32