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