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 8 * modify it under the terms of the GNU General Public License 9 * as published by the Free Software Foundation; either version 2 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, write to the Free Software 19 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. 20 * 21 */ 22 23 #ifndef AGS_PLUGINS_AGS_SNOW_RAIN_WEATHER_H 24 #define AGS_PLUGINS_AGS_SNOW_RAIN_WEATHER_H 25 26 #include "ags/plugins/plugin_base.h" 27 #include "ags/plugins/serializer.h" 28 29 namespace AGS3 { 30 namespace Plugins { 31 namespace AGSSnowRain { 32 33 struct View { 34 int view = 0; 35 int loop = 0; 36 bool is_default = false; 37 BITMAP *bitmap = nullptr; 38 39 void syncGame(Serializer &s); 40 }; 41 42 struct Drop { 43 float x = 0; 44 float y = 0; 45 int alpha = 0; 46 float speed = 0; 47 int max_y = 0; 48 int kind_id = 0; 49 int drift = 0; 50 float drift_speed = 0; 51 float drift_offset = 0; 52 clearDrop53 void clear() { 54 x = 0; 55 y = 0; 56 alpha = 0; 57 speed = 0; 58 max_y = 0; 59 kind_id = 0; 60 drift = 0; 61 drift_speed = 0; 62 drift_offset = 0; 63 } 64 }; 65 66 class Weather { 67 private: 68 void ClipToRange(int &variable, int min, int max); 69 70 bool _mIsSnow; 71 int32 &_screenWidth; 72 int32 &_screenHeight; 73 IAGSEngine *&_engine; 74 75 int _mMinDrift = 0; 76 int _mMaxDrift = 0; 77 int _mDeltaDrift = 0; 78 79 int _mMinDriftSpeed = 0; 80 int _mMaxDriftSpeed = 0; 81 int _mDeltaDriftSpeed = 0; 82 83 int _mAmount = 0; 84 int _mTargetAmount = 0; 85 86 int _mMinAlpha = 0; 87 int _mMaxAlpha = 0; 88 int _mDeltaAlpha = 0; 89 90 float _mWindSpeed = 0; 91 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 void SetBaseline(int top, int bottom); 127 void SetAmount(int amount); 128 void SetFallSpeed(int min_value, int max_value); 129 }; 130 131 } // namespace AGSSnowRain 132 } // namespace Plugins 133 } // namespace AGS3 134 135 #endif 136