ScummVM API documentation
base_stars.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 TITANIC_BASE_STARS_H
23 #define TITANIC_BASE_STARS_H
24 
25 #include "titanic/star_control/frange.h"
26 #include "common/array.h"
27 
28 namespace Common {
29 class SeekableReadStream;
30 }
31 
32 namespace Titanic {
33 
34 enum StarMode { MODE_STARFIELD = 0, MODE_PHOTO = 1 };
35 
36 class CCamera;
37 class CStarCloseup;
38 class CString;
39 class CSurfaceArea;
40 class SimpleFile;
41 
43  byte _red;
44  byte _green;
45  byte _blue;
46  byte _thickness;
47  double _value;
48  FVector _position;
49  uint _data[5];
50 
52 
56  void load(Common::SeekableReadStream &s);
57 
58  bool operator==(const CBaseStarEntry &s) const;
59 };
60 
61 struct CStarPosition : public Common::Point {
62  int _index1;
63  int _index2;
64  CStarPosition() : _index1(0), _index2(0) {}
65 
66  bool operator==(const CStarPosition &sp) const {
67  return x == sp.x && y == sp.y && _index1 == sp._index1 && _index2 == sp._index2;
68  }
69 };
70 
74 class CBaseStars {
75 private:
76  void draw1(CSurfaceArea *surfaceArea, CCamera *camera, CStarCloseup *closeup);
77  void draw2(CSurfaceArea *surfaceArea, CCamera *camera, CStarCloseup *closeup);
78  void draw3(CSurfaceArea *surfaceArea, CCamera *camera, CStarCloseup *closeup);
79  void draw4(CSurfaceArea *surfaceArea, CCamera *camera, CStarCloseup *closeup);
80 protected:
81  FRange _minMax;
82  double _minVal;
83  double _maxVal;
84  double _range;
85  double _value1, _value2;
86  double _value3, _value4;
87 protected:
91  void loadData(Common::SeekableReadStream &s);
92 
96  void loadData(const CString &resName);
97 
101  void resetEntry(CBaseStarEntry &entry);
102 public:
104 public:
105  CBaseStars();
106  virtual ~CBaseStars() {}
107 
111  virtual void draw(CSurfaceArea *surfaceArea, CCamera *camera, CStarCloseup *closeup);
112 
113  virtual bool loadYale(int v1) { return true; }
114 
118  virtual bool selectStar(CSurfaceArea *surfaceArea, CCamera *camera,
119  const Common::Point &pt, void *handler = nullptr) { return false; }
120 
124  virtual bool addStar(const CBaseStarEntry *entry) { return false; }
125 
126  virtual bool loadStar() { return false; }
127 
131  virtual void load(SimpleFile *file) {}
132 
136  virtual void save(SimpleFile *file, int indent) {}
137 
141  void clear();
142 
143  void initialize();
144 
145  int size() const { return _data.size(); }
146 
150  const CBaseStarEntry *getDataPtr(int index) const;
151 
156  int findStar(CSurfaceArea *surfaceArea, CCamera *camera,
157  const Common::Point &pt);
158 
159  int baseFn2(CSurfaceArea *surfaceArea, CCamera *camera);
160 };
161 
162 } // End of namespace Titanic
163 
164 #endif /* TITANIC_BASE_STARS_H */
Definition: surface_area.h:36
virtual void load(SimpleFile *file)
Definition: base_stars.h:131
Definition: star_closeup.h:39
Definition: array.h:52
Definition: stream.h:745
Definition: simple_file.h:49
virtual void save(SimpleFile *file, int indent)
Definition: base_stars.h:136
virtual bool addStar(const CBaseStarEntry *entry)
Definition: base_stars.h:124
Definition: camera.h:42
Definition: base_stars.h:61
virtual bool selectStar(CSurfaceArea *surfaceArea, CCamera *camera, const Common::Point &pt, void *handler=nullptr)
Definition: base_stars.h:118
Definition: frange.h:29
Definition: algorithm.h:29
Definition: rect.h:45
Definition: arm.h:30
Definition: string.h:40
size_type size() const
Definition: array.h:315
int16 x
Definition: rect.h:46
int16 y
Definition: rect.h:47
Definition: base_stars.h:42
Definition: base_stars.h:74
Definition: fvector.h:36