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  * of the License, or(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 AGS_PLUGINS_AGS_SNOW_RAIN_WEATHER_H
23 #define AGS_PLUGINS_AGS_SNOW_RAIN_WEATHER_H
24 
25 #include "ags/plugins/plugin_base.h"
26 #include "ags/plugins/serializer.h"
27 
28 namespace AGS3 {
29 namespace Plugins {
30 namespace AGSSnowRain {
31 
32 struct View {
33  int view = 0;
34  int loop = 0;
35  bool is_default = false;
36  BITMAP *bitmap = nullptr;
37 
38  void syncGame(Serializer &s);
39 };
40 
41 struct Drop {
42  float x = 0;
43  float y = 0;
44  int alpha = 0;
45  float speed = 0;
46  int max_y = 0;
47  int kind_id = 0;
48  int drift = 0;
49  float drift_speed = 0;
50  float drift_offset = 0;
51 
52  void clear() {
53  x = 0;
54  y = 0;
55  alpha = 0;
56  speed = 0;
57  max_y = 0;
58  kind_id = 0;
59  drift = 0;
60  drift_speed = 0;
61  drift_offset = 0;
62  }
63 };
64 
65 class Weather {
66 private:
67  void ClipToRange(int &variable, int min, int max);
68 
69  bool _mIsSnow;
70  int32 &_screenWidth;
71  int32 &_screenHeight;
72  IAGSEngine *&_engine;
73 
74  int _mMinDrift = 0;
75  int _mMaxDrift = 0;
76  int _mDeltaDrift = 0;
77 
78  int _mMinDriftSpeed = 0;
79  int _mMaxDriftSpeed = 0;
80  int _mDeltaDriftSpeed = 0;
81 
82  int _mAmount = 0;
83  int _mTargetAmount = 0;
84 
85  int _mMinAlpha = 0;
86  int _mMaxAlpha = 0;
87  int _mDeltaAlpha = 0;
88 
89  float _mWindSpeed = 0;
90 
91  bool _mBaselineFixed;
92  int _mTopBaseline = 0;
93  int _mBottomBaseline = 0;
94  int _mDeltaBaseline = 0;
95 
96  int _mMinFallSpeed = 0;
97  int _mMaxFallSpeed = 0;
98  int _mDeltaFallSpeed = 0;
99 
100  Drop _mParticles[2000];
101  View _mViews[5];
102 
103  bool _mViewsInitialized;
104 
105 public:
106  Weather(bool IsSnow, int32 &scrWidth, int32 &scrHeight, IAGSEngine *&engine);
107 
108  void Initialize();
109  void InitializeParticles();
110 
111  void syncGame(Serializer &s);
112  bool ReinitializeViews();
113 
114  bool IsActive();
115  void Update();
116  void UpdateWithDrift();
117  void EnterRoom();
118 
119  void SetDriftRange(int min_value, int max_value);
120  void SetDriftSpeed(int min_value, int max_value);
121  void ChangeAmount(int amount);
122  void SetView(int kind_id, int event, int view, int loop);
123  void SetDefaultView(int view, int loop);
124  void SetTransparency(int min_value, int max_value);
125  void SetWindSpeed(int value);
126  // Sets baseline and marks baseline as fixed
127  void SetBaseline(int top, int bottom);
128  // Resets baselines to the (0, screen_height);
129  // marks baseline for auto-update on screen change
130  void ResetBaseline();
131  void SetAmount(int amount);
132  void SetFallSpeed(int min_value, int max_value);
133 };
134 
135 } // namespace AGSSnowRain
136 } // namespace Plugins
137 } // namespace AGS3
138 
139 #endif
Definition: serializer.h:32
Definition: weather.h:65
Definition: weather.h:32
Definition: surface.h:32
Definition: ags_plugin.h:328
Definition: weather.h:41
Definition: ags.h:40