ScummVM API documentation
weather.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 NUVIE_CORE_WEATHER_H
23 #define NUVIE_CORE_WEATHER_H
24 
25 #include "ultima/nuvie/core/nuvie_defs.h"
26 #include "ultima/nuvie/misc/call_back.h"
27 #include "ultima/nuvie/core/map.h"
28 
29 namespace Ultima {
30 namespace Nuvie {
31 
32 class Configuration;
33 class NuvieIO;
34 class CallBack;
35 class GameClock;
36 class GameTimedCallback;
37 
38 //our callbacks
39 
40 #define WEATHER_CB_CHANGE_WIND_DIR 1
41 #define WEATHER_CB_END_ECLIPSE 2
42 #define WEATHER_WIND_CALM 8
43 
44 class Weather: public CallBack {
45  const Configuration *config;
46  GameClock *_clock;
47  nuvie_game_t gametype; // what game is being played?
48 
49  NuvieDir wind_dir;
50  Common::List<CallBack *>wind_change_notification_list;
51 
52  GameTimedCallback *wind_timer;
53 
54 public:
55 
56  Weather(const Configuration *cfg, GameClock *c, nuvie_game_t type);
57  ~Weather() override;
58 
59  bool load(NuvieIO *objlist);
60  bool save(NuvieIO *objlist);
61 
62  Common::String get_wind_dir_str() const;
63  NuvieDir get_wind_dir() const {
64  return wind_dir;
65  }
66  bool is_displaying_from_wind_dir() const {
67  return display_from_wind_dir;
68  }
69  bool set_wind_dir(NuvieDir new_wind_dir);
70  bool add_wind_change_notification_callback(CallBack *caller);
71  bool set_moonstone(uint8 moonstone, MapCoord where);
72  MapCoord get_moonstone(uint8 moonstone);
73  void update_moongates();
74 
75  bool is_eclipse() const;
76  bool is_moon_visible() const;
77 
78  uint16 callback(uint16 msg, CallBack *caller, void *data = nullptr) override;
79 
80 protected:
81 
82  NuvieDir load_wind(NuvieIO *objlist);
83  bool save_wind(NuvieIO *objlist);
84  void change_wind_dir();
85  inline void set_wind_change_callback();
86  inline void send_wind_change_notification_callback();
87  void clear_wind();
88  bool display_from_wind_dir;
89 };
90 
91 } // End of namespace Nuvie
92 } // End of namespace Ultima
93 
94 #endif
Definition: str.h:59
Definition: configuration.h:61
Definition: game_clock.h:47
Definition: list.h:44
Definition: timed_event.h:221
Definition: detection.h:27
Definition: call_back.h:50
Definition: map.h:84
Definition: weather.h:44
Definition: nuvie_io.h:32