| 1 | /* |
| 2 | * Descent 3 |
| 3 | * Copyright (C) 2024 Parallax Software |
| 4 | * |
| 5 | * This program is free software: you can redistribute it and/or modify |
| 6 | * it under the terms of the GNU General Public License as published by |
| 7 | * the Free Software Foundation, either version 3 of the License, or |
| 8 | * (at your option) any later version. |
| 9 | * |
| 10 | * This program is distributed in the hope that it will be useful, |
| 11 | * but WITHOUT ANY WARRANTY; without even the implied warranty of |
| 12 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
| 13 | * GNU General Public License for more details. |
| 14 | * |
| 15 | * You should have received a copy of the GNU General Public License |
| 16 | * along with this program. If not, see <http://www.gnu.org/licenses/>. |
| 17 | */ |
| 18 | |
| 19 | #include "pserror.h"cxx . . $ `<file>/misc/pserror.h`/ |
| 20 | #include "pstypes.h"cxx . . $ `<file>/lib/pstypes.h`/ |
| 21 | #include "fireball.h"cxx . . $ `<file>/Descent3/fireball.h`/ |
| 22 | #include "weather.h"cxx . . $ `<file>/Descent3/weather.h`/ |
| 23 | #include "viseffect.h"cxx . . $ `<file>/Descent3/viseffect.h`/ |
| 24 | #include "object.h"cxx . . $ `<file>/Descent3/object.h`/ |
| 25 | #include "terrain.h"cxx . . $ `<file>/Descent3/terrain.h`/ |
| 26 | #include "room.h"cxx . . $ `<file>/Descent3/room.h`/ |
| 27 | #include "game.h"cxx . . $ `<file>/Descent3/game.h`/ |
| 28 | #include "soundload.h"cxx . . $ `<file>/sndlib/soundload.h`/ |
| 29 | #include "hlsoundlib.h"cxx . . $ `<file>/sndlib/hlsoundlib.h`/ |
| 30 | #include "sounds.h"cxx . . $ `<file>/Descent3/sounds.h`/ |
| 31 | |
| 32 | #include <stdlib.h> |
| 33 | |
| 34 | #include "psrand.h"cxx . . $ `<file>/misc/psrand.h`/ |
| 35 | weathercxx . . $ weather# Weathercxx . . $ Weather. = {0}; |
| 36 | |
| 37 | int ThunderA_sound_handlecxx . . $ ThunderA_sound_handle. = -1; |
| 38 | int ThunderB_sound_handlecxx . . $ ThunderB_sound_handle. = -1; |
| 39 | |
| 40 | // resets the weather so there is nothing happening |
| 41 | void ResetWeathercxx . . $ ResetWeather(49f6e7a06ebc5aa8).() { |
| 42 | Weathercxx . . $ Weather..flagscxx . . $ weather#flags. = 0; |
| 43 | Weathercxx . . $ Weather..last_lightning_evaluation_timecxx . . $ weather#last_lightning_evaluation_time. = 0; |
| 44 | } |
| 45 | |
| 46 | // Makes droplets appear on the windshield, plus makes rain fall in the distance |
| 47 | void DoRainEffectcxx . . $ DoRainEffect(49f6e7a06ebc5aa8).() { |
| 48 | // See how many droplets to create on the windshield |
| 49 | // This is dependant on how fast the player is moving forward |
| 50 | int randval = 1 + ((1.0 - Weathercxx . . $ Weather..rain_intensity_scalarcxx . . $ weather#rain_intensity_scalar.) * MAX_RAIN_INTENSITYcxx . . $ `Descent3/weather.h:26:9`!); |
| 51 | |
| 52 | if (randval < 20) |
| 53 | randval = 20; |
| 54 | |
| 55 | vectorcxx . . $ vector# vel = Viewer_objectcxx . . $ Viewer_object.->mtypecxx . . $ object#mtype..phys_infocxx . . $ object#$anonymous_type_8#phys_info..velocitycxx . . $ physics_info#velocity.; |
| 56 | float mag = vm_GetMagnitudeFastcxx . . $ vm_GetMagnitudeFast(4939a7e530383cd4).(&vel); |
| 57 | vel /=cxx . . $ `operator/=`(f132838b2cd11d6). mag; |
| 58 | |
| 59 | float scalar = vm_DotProductcxx . . $ vm_DotProduct(e65d563e2b53cc54).(&vel, &Viewer_objectcxx . . $ Viewer_object.->orientcxx . . $ object#orient..fveccxx . . $ matrix#fvec.); |
| 60 | |
| 61 | vectorcxx . . $ vector# upvec = {0, 1.0, 0}; |
| 62 | |
| 63 | scalar *= (1 + (mag / 100)); |
| 64 | |
| 65 | randval -= scalar * 10; |
| 66 | |
| 67 | if (randval < 2) |
| 68 | randval = 2; |
| 69 | else if (randval > 80) |
| 70 | randval = 80; |
| 71 | |
| 72 | if ((upvec *cxx . . $ `operator*`(4a721543d64e126a). Viewer_objectcxx . . $ Viewer_object.->orientcxx . . $ object#orient..uveccxx . . $ matrix#uvec.) < 0) |
| 73 | randval = 8000; // Make sure rain does fall upwards |
| 74 | |
| 75 | if (Viewer_objectcxx . . $ Viewer_object.->typecxx . . $ object#type. == OBJ_PLAYERcxx . . $ `Descent3/object_external.h:164:9`! && OBJECT_OUTSIDEcxx . . $ `lib/object_external_struct.h:130:9`!(Viewer_object) && (ps_randcxx . . $ ps_rand(b126dc7c1de90089).() % randval) == 0) { |
| 76 | // Put some droplets on the windshield |
| 77 | vectorcxx . . $ vector# pos = {0, 0, 0}; |
| 78 | |
| 79 | pos.xcxx . . $ vector#x. = ((ps_randcxx . . $ ps_rand(b126dc7c1de90089).() % 1000) - 500) / 250.0; |
| 80 | pos.ycxx . . $ vector#y. = ((ps_randcxx . . $ ps_rand(b126dc7c1de90089).() % 1000) - 500) / 350.0; |
| 81 | pos.zcxx . . $ vector#z. = 3.0; |
| 82 | |
| 83 | int visnum = VisEffectCreatecxx . . $ VisEffectCreate(20e4831b18f6895c).(VIS_FIREBALLcxx . . $ `Descent3/viseffect_external.h:61:9`!, RAINDROP_INDEXcxx . . $ `Descent3/fireball_external.h:50:9`!, Viewer_objectcxx . . $ Viewer_object.->roomnumcxx . . $ object#roomnum., &pos); |
| 84 | if (visnum >= 0) { |
| 85 | vis_effectcxx . . $ vis_effect# *vis = &VisEffectscxx . . $ VisEffects.[visnum]; |
| 86 | float life = .4 + ((ps_randcxx . . $ ps_rand(b126dc7c1de90089).() % 500) / 1000.0); |
| 87 | vis->lifeleftcxx . . $ vis_effect#lifeleft. = life; |
| 88 | vis->lifetimecxx . . $ vis_effect#lifetime. = life; |
| 89 | vis->sizecxx . . $ vis_effect#size. = .01 + ((ps_randcxx . . $ ps_rand(b126dc7c1de90089).() % 500) / 3000.0); |
| 90 | |
| 91 | if (vis->sizecxx . . $ vis_effect#size. > .05) { |
| 92 | Sound_systemcxx . . $ Sound_system..Play2dSoundcxx . . $ hlsSystem#Play2dSound(d251026853493025).(SOUND_RAINDROPcxx . . $ `Descent3/sounds.h:129:9`!); |
| 93 | } |
| 94 | |
| 95 | vis->flagscxx . . $ vis_effect#flags. |= VF_WINDSHIELD_EFFECTcxx . . $ `Descent3/viseffect_external.h:65:9`!; |
| 96 | } |
| 97 | } |
| 98 | |
| 99 | // Create some rain in the distance |
| 100 | |
| 101 | if (OBJECT_OUTSIDEcxx . . $ `lib/object_external_struct.h:130:9`!(Viewer_object)) { |
| 102 | int num = 20 + (ps_randcxx . . $ ps_rand(b126dc7c1de90089).() % 15); |
| 103 | angveccxx . . $ angvec# angs; |
| 104 | int i; |
| 105 | |
| 106 | vm_ExtractAnglesFromMatrixcxx . . $ vm_ExtractAnglesFromMatrix(5f9a6d6f613ae256).(&angs, &Viewer_objectcxx . . $ Viewer_object.->orientcxx . . $ object#orient.); |
| 107 | matrixcxx . . $ matrix# mat; |
| 108 | vm_AnglesToMatrixcxx . . $ vm_AnglesToMatrix(654fa9e3c9c3be99).(&mat, 0, angs.hcxx . . $ angvec#h., 0); |
| 109 | |
| 110 | for (i = 0; i < num; i++) { |
| 111 | vectorcxx . . $ vector# pos = Viewer_objectcxx . . $ Viewer_object.->poscxx . . $ object#pos.; |
| 112 | |
| 113 | float z = ((ps_randcxx . . $ ps_rand(b126dc7c1de90089).() % 1000) / 1000.0) * 700; |
| 114 | float x = (((ps_randcxx . . $ ps_rand(b126dc7c1de90089).() % 1000) - 500) / 500.0) * 300; |
| 115 | float y = (((ps_randcxx . . $ ps_rand(b126dc7c1de90089).() % 1000) - 500) / 500.0) * 200; |
| 116 | |
| 117 | pos +=cxx . . $ `operator+=`(801a8d6f7ab7bef9). x *cxx . . $ `operator*`(9d6577ff3e9faa29). mat.rveccxx . . $ matrix#rvec.; |
| 118 | pos +=cxx . . $ `operator+=`(801a8d6f7ab7bef9). y *cxx . . $ `operator*`(9d6577ff3e9faa29). mat.uveccxx . . $ matrix#uvec.; |
| 119 | pos +=cxx . . $ `operator+=`(801a8d6f7ab7bef9). z *cxx . . $ `operator*`(9d6577ff3e9faa29). mat.fveccxx . . $ matrix#fvec.; |
| 120 | |
| 121 | // Create falling rain |
| 122 | int visnum = VisEffectCreatecxx . . $ VisEffectCreate(20e4831b18f6895c).(VIS_FIREBALLcxx . . $ `Descent3/viseffect_external.h:61:9`!, FADING_LINE_INDEXcxx . . $ `Descent3/fireball_external.h:41:9`!, Viewer_objectcxx . . $ Viewer_object.->roomnumcxx . . $ object#roomnum., &pos); |
| 123 | if (visnum >= 0) { |
| 124 | vis_effectcxx . . $ vis_effect# *vis = &VisEffectscxx . . $ VisEffects.[visnum]; |
| 125 | float life = .001f; |
| 126 | vis->lifeleftcxx . . $ vis_effect#lifeleft. = life; |
| 127 | vis->lifetimecxx . . $ vis_effect#lifetime. = life; |
| 128 | vis->lighting_colorcxx . . $ vis_effect#lighting_color. = GR_RGB16cxx . . $ GR_RGB16(6461fafb79bad5b9).(200, 200, 255); |
| 129 | vis->end_poscxx . . $ vis_effect#end_pos. =cxx . . $ vector#`operator=`(a48bc7e93a8dae5e). pos; |
| 130 | vis->end_poscxx . . $ vis_effect#end_pos..ycxx . . $ vector#y. += 20; |
| 131 | vis->flagscxx . . $ vis_effect#flags. |= VF_WINDSHIELD_EFFECTcxx . . $ `Descent3/viseffect_external.h:65:9`!; |
| 132 | vis->poscxx . . $ vis_effect#pos. -=cxx . . $ `operator-=`(801a8d6f7ab7bef9). (Viewer_objectcxx . . $ Viewer_object.->mtypecxx . . $ object#mtype..phys_infocxx . . $ object#$anonymous_type_8#phys_info..velocitycxx . . $ physics_info#velocity. /cxx . . $ `operator/`(252247219a31502c). 2); |
| 133 | } |
| 134 | } |
| 135 | |
| 136 | num /= 2; |
| 137 | for (i = 0; i < num; i++) { |
| 138 | vectorcxx . . $ vector# pos = Viewer_objectcxx . . $ Viewer_object.->poscxx . . $ object#pos.; |
| 139 | |
| 140 | float z = ((ps_randcxx . . $ ps_rand(b126dc7c1de90089).() % 1000) / 1000.0) * 700; |
| 141 | float x = (((ps_randcxx . . $ ps_rand(b126dc7c1de90089).() % 1000) - 500) / 500.0) * 300; |
| 142 | float y = (((ps_randcxx . . $ ps_rand(b126dc7c1de90089).() % 1000) - 500) / 500.0) * 200; |
| 143 | |
| 144 | pos +=cxx . . $ `operator+=`(801a8d6f7ab7bef9). x *cxx . . $ `operator*`(9d6577ff3e9faa29). mat.rveccxx . . $ matrix#rvec.; |
| 145 | pos +=cxx . . $ `operator+=`(801a8d6f7ab7bef9). y *cxx . . $ `operator*`(9d6577ff3e9faa29). mat.uveccxx . . $ matrix#uvec.; |
| 146 | pos +=cxx . . $ `operator+=`(801a8d6f7ab7bef9). z *cxx . . $ `operator*`(9d6577ff3e9faa29). mat.fveccxx . . $ matrix#fvec.; |
| 147 | |
| 148 | if (pos.zcxx . . $ vector#z. < 0 || pos.zcxx . . $ vector#z. >= TERRAIN_DEPTHcxx . . $ `Descent3/terrain.h:32:9`! * TERRAIN_SIZEcxx . . $ `Descent3/terrain.h:33:9`!) |
| 149 | continue; |
| 150 | if (pos.xcxx . . $ vector#x. < 0 || pos.xcxx . . $ vector#x. >= TERRAIN_WIDTHcxx . . $ `Descent3/terrain.h:31:9`! * TERRAIN_SIZEcxx . . $ `Descent3/terrain.h:33:9`!) |
| 151 | continue; |
| 152 | |
| 153 | // Create puddle drops on the terrain |
| 154 | vectorcxx . . $ vector# norm; |
| 155 | float ypos = GetTerrainGroundPointcxx . . $ GetTerrainGroundPoint(a0b9c8659ecc16b8).(&pos, &norm); |
| 156 | pos.ycxx . . $ vector#y. = ypos; |
| 157 | int visnum = VisEffectCreatecxx . . $ VisEffectCreate(20e4831b18f6895c).(VIS_FIREBALLcxx . . $ `Descent3/viseffect_external.h:61:9`!, PUDDLEDROP_INDEXcxx . . $ `Descent3/fireball_external.h:51:9`!, Viewer_objectcxx . . $ Viewer_object.->roomnumcxx . . $ object#roomnum., &pos); |
| 158 | if (visnum >= 0) { |
| 159 | vis_effectcxx . . $ vis_effect# *vis = &VisEffectscxx . . $ VisEffects.[visnum]; |
| 160 | float life = .2f; |
| 161 | float size = .7 + ((ps_randcxx . . $ ps_rand(b126dc7c1de90089).() % 10) / 20.0); |
| 162 | vis->lifeleftcxx . . $ vis_effect#lifeleft. = life; |
| 163 | vis->lifetimecxx . . $ vis_effect#lifetime. = life; |
| 164 | vis->end_poscxx . . $ vis_effect#end_pos. =cxx . . $ vector#`operator=`(a48bc7e93a8dae5e). norm; |
| 165 | vis->flagscxx . . $ vis_effect#flags. |= VF_PLANARcxx . . $ `Descent3/viseffect_external.h:67:9`!; |
| 166 | } |
| 167 | } |
| 168 | } |
| 169 | } |
| 170 | |
| 171 | // Creates snow for this frame |
| 172 | void DoSnowEffectcxx . . $ DoSnowEffect(49f6e7a06ebc5aa8).() { |
| 173 | if (OBJECT_OUTSIDEcxx . . $ `lib/object_external_struct.h:130:9`!(Viewer_object)) { |
| 174 | int num = 20 + (ps_randcxx . . $ ps_rand(b126dc7c1de90089).() % 15); |
| 175 | |
| 176 | if (Weathercxx . . $ Weather..snowflakes_to_createcxx . . $ weather#snowflakes_to_create. + num > 250) { |
| 177 | num = 250 - Weathercxx . . $ Weather..snowflakes_to_createcxx . . $ weather#snowflakes_to_create.; |
| 178 | |
| 179 | if (num < 1) { |
| 180 | Weathercxx . . $ Weather..snowflakes_to_createcxx . . $ weather#snowflakes_to_create. = 0; |
| 181 | return; |
| 182 | } |
| 183 | } |
| 184 | |
| 185 | // angvec angs; |
| 186 | matrixcxx . . $ matrix# mat; |
| 187 | |
| 188 | // vm_ExtractAnglesFromMatrix (&angs,&Viewer_object->orient); |
| 189 | // vm_AnglesToMatrix (&mat,0,angs.h,0); |
| 190 | |
| 191 | mat =cxx . . $ matrix#`operator=`(4c6f8b29806742). Viewer_objectcxx . . $ Viewer_object.->orientcxx . . $ object#orient.; |
| 192 | |
| 193 | for (int i = 0; i < num; i++) { |
| 194 | vectorcxx . . $ vector# pos = Viewer_objectcxx . . $ Viewer_object.->poscxx . . $ object#pos.; |
| 195 | |
| 196 | float z = ((ps_randcxx . . $ ps_rand(b126dc7c1de90089).() % 1000) / 1000.0) * 300; |
| 197 | float x = (((ps_randcxx . . $ ps_rand(b126dc7c1de90089).() % 1000) - 500) / 500.0) * 200; |
| 198 | int y = (ps_randcxx . . $ ps_rand(b126dc7c1de90089).() % 80); |
| 199 | |
| 200 | pos +=cxx . . $ `operator+=`(801a8d6f7ab7bef9). x *cxx . . $ `operator*`(9d6577ff3e9faa29). mat.rveccxx . . $ matrix#rvec.; |
| 201 | pos +=cxx . . $ `operator+=`(801a8d6f7ab7bef9). y *cxx . . $ `operator*`(9d6577ff3e9faa29). mat.uveccxx . . $ matrix#uvec.; |
| 202 | pos +=cxx . . $ `operator+=`(801a8d6f7ab7bef9). z *cxx . . $ `operator*`(9d6577ff3e9faa29). mat.fveccxx . . $ matrix#fvec.; |
| 203 | |
| 204 | if (pos.zcxx . . $ vector#z. < 0 || pos.zcxx . . $ vector#z. >= TERRAIN_DEPTHcxx . . $ `Descent3/terrain.h:32:9`! * TERRAIN_SIZEcxx . . $ `Descent3/terrain.h:33:9`!) |
| 205 | continue; |
| 206 | if (pos.xcxx . . $ vector#x. < 0 || pos.xcxx . . $ vector#x. >= TERRAIN_WIDTHcxx . . $ `Descent3/terrain.h:31:9`! * TERRAIN_SIZEcxx . . $ `Descent3/terrain.h:33:9`!) |
| 207 | continue; |
| 208 | |
| 209 | // Create falling rain |
| 210 | vectorcxx . . $ vector# down_vec = {0, -30, 0}; |
| 211 | int visnum = VisEffectCreatecxx . . $ VisEffectCreate(20e4831b18f6895c).(VIS_FIREBALLcxx . . $ `Descent3/viseffect_external.h:61:9`!, SNOWFLAKE_INDEXcxx . . $ `Descent3/fireball_external.h:61:9`!, Viewer_objectcxx . . $ Viewer_object.->roomnumcxx . . $ object#roomnum., &pos); |
| 212 | if (visnum >= 0) { |
| 213 | vis_effectcxx . . $ vis_effect# *vis = &VisEffectscxx . . $ VisEffects.[visnum]; |
| 214 | float life = 1.5 + ((ps_randcxx . . $ ps_rand(b126dc7c1de90089).() % 100) / 100.0); |
| 215 | vis->lifeleftcxx . . $ vis_effect#lifeleft. = life; |
| 216 | vis->lifetimecxx . . $ vis_effect#lifetime. = life; |
| 217 | vis->lighting_colorcxx . . $ vis_effect#lighting_color. = GR_RGB16cxx . . $ GR_RGB16(6461fafb79bad5b9).(200, 200, (ps_randcxx . . $ ps_rand(b126dc7c1de90089).() % 50) + 200); |
| 218 | vis->sizecxx . . $ vis_effect#size. = ((ps_randcxx . . $ ps_rand(b126dc7c1de90089).() % 1000) / 1000.0) + .5; |
| 219 | |
| 220 | vis->flagscxx . . $ vis_effect#flags. |= VF_WINDSHIELD_EFFECTcxx . . $ `Descent3/viseffect_external.h:65:9`! | VF_USES_LIFELEFTcxx . . $ `Descent3/viseffect_external.h:64:9`!; |
| 221 | |
| 222 | vis->velocitycxx . . $ vis_effect#velocity. =cxx . . $ vector#`operator=`(a48bc7e93a8dae5e). down_vec; |
| 223 | } |
| 224 | } |
| 225 | } |
| 226 | |
| 227 | Weathercxx . . $ Weather..snowflakes_to_createcxx . . $ weather#snowflakes_to_create. = 0; |
| 228 | } |
| 229 | |
| 230 | // does all the weather stuff that is going to be done for this frame |
| 231 | void DoWeatherForFramecxx . . $ DoWeatherForFrame(49f6e7a06ebc5aa8).() { |
| 232 | int i; |
| 233 | int hear_thunder = 0; |
| 234 | |
| 235 | if (OBJECT_OUTSIDEcxx . . $ `lib/object_external_struct.h:130:9`!(Player_object)) |
| 236 | hear_thunder = 1; |
| 237 | else { |
| 238 | int roomnum = Player_objectcxx . . $ Player_object.->roomnumcxx . . $ object#roomnum.; |
| 239 | roomcxx . . $ room# *rp = &Roomscxx . . $ Rooms.[roomnum]; |
| 240 | |
| 241 | for (i = 0; i < rp->num_portalscxx . . $ room#num_portals. && hear_thunder == 0; i++) { |
| 242 | if (rp->portalscxx . . $ room#portals.[i].croomcxx . . $ portal#croom. == -1) |
| 243 | hear_thunder = 1; |
| 244 | else if (Roomscxx . . $ Rooms.[rp->portalscxx . . $ room#portals.[i].croomcxx . . $ portal#croom.].flagscxx . . $ room#flags. & RF_EXTERNALcxx . . $ `Descent3/room_external.h:177:9`!) |
| 245 | hear_thunder = 1; |
| 246 | } |
| 247 | } |
| 248 | |
| 249 | if (Weathercxx . . $ Weather..flagscxx . . $ weather#flags. & WEATHER_FLAGS_RAINcxx . . $ `Descent3/weather.h:22:9`!) |
| 250 | DoRainEffectcxx . . $ DoRainEffect(49f6e7a06ebc5aa8).(); |
| 251 | |
| 252 | if (Weathercxx . . $ Weather..flagscxx . . $ weather#flags. & WEATHER_FLAGS_SNOWcxx . . $ `Descent3/weather.h:24:9`!) |
| 253 | DoSnowEffectcxx . . $ DoSnowEffect(49f6e7a06ebc5aa8).(); |
| 254 | |
| 255 | if (Weathercxx . . $ Weather..flagscxx . . $ weather#flags. & WEATHER_FLAGS_LIGHTNINGcxx . . $ `Descent3/weather.h:23:9`!) { |
| 256 | if ((Gametimecxx . . $ Gametime. - Weathercxx . . $ Weather..last_lightning_evaluation_timecxx . . $ weather#last_lightning_evaluation_time.) > Weathercxx . . $ Weather..lightning_interval_timecxx . . $ weather#lightning_interval_time.) { |
| 257 | // Check to see if we should draw some lightning |
| 258 | Weathercxx . . $ Weather..last_lightning_evaluation_timecxx . . $ weather#last_lightning_evaluation_time. = Gametimecxx . . $ Gametime.; |
| 259 | ASSERTcxx . . $ `misc/pserror.h:246:9`!(Weather.lightning_rand_value > 0); |
| 260 | if (ps_randcxx . . $ ps_rand(b126dc7c1de90089).() <= Weathercxx . . $ Weather..lightning_rand_valuecxx . . $ weather#lightning_rand_value.) { |
| 261 | // Start the lightning sequence |
| 262 | Weathercxx . . $ Weather..lightning_sequencecxx . . $ weather#lightning_sequence. = 1; |
| 263 | |
| 264 | if ((ps_randcxx . . $ ps_rand(b126dc7c1de90089).() % 7) == 0 && hear_thunder) |
| 265 | Sound_systemcxx . . $ Sound_system..Play2dSoundcxx . . $ hlsSystem#Play2dSound(d251026853493025).(SOUND_LIGHTNINGcxx . . $ `Descent3/sounds.h:130:9`!); |
| 266 | } |
| 267 | |
| 268 | if (hear_thunder && (ps_randcxx . . $ ps_rand(b126dc7c1de90089).() % (Weathercxx . . $ Weather..lightning_rand_valuecxx . . $ weather#lightning_rand_value. * 3)) == 0) { |
| 269 | if (ThunderA_sound_handlecxx . . $ ThunderA_sound_handle. == -1) |
| 270 | ThunderA_sound_handlecxx . . $ ThunderA_sound_handle. = FindSoundNamecxx . . $ FindSoundName(5c4306d8553b3696).("ThunderA"); |
| 271 | if (ThunderB_sound_handlecxx . . $ ThunderB_sound_handle. == -1) |
| 272 | ThunderB_sound_handlecxx . . $ ThunderB_sound_handle. = FindSoundNamecxx . . $ FindSoundName(5c4306d8553b3696).("ThunderB"); |
| 273 | |
| 274 | if (ps_randcxx . . $ ps_rand(b126dc7c1de90089).() % 2) |
| 275 | Sound_systemcxx . . $ Sound_system..Play2dSoundcxx . . $ hlsSystem#Play2dSound(d251026853493025).(ThunderA_sound_handlecxx . . $ ThunderA_sound_handle.); |
| 276 | else |
| 277 | Sound_systemcxx . . $ Sound_system..Play2dSoundcxx . . $ hlsSystem#Play2dSound(d251026853493025).(ThunderB_sound_handlecxx . . $ ThunderB_sound_handle.); |
| 278 | } |
| 279 | } |
| 280 | } |
| 281 | } |
| 282 | |
| 283 | // Sets the state of the rain to on or off, plus sets the intensity of the rain (0 to 1) |
| 284 | void SetRainStatecxx . . $ SetRainState(43c79ee2f1b9aefe).(int on, float intensity) { |
| 285 | if (on) { |
| 286 | Weathercxx . . $ Weather..flagscxx . . $ weather#flags. |= WEATHER_FLAGS_RAINcxx . . $ `Descent3/weather.h:22:9`!; |
| 287 | Weathercxx . . $ Weather..rain_intensity_scalarcxx . . $ weather#rain_intensity_scalar. = intensity; |
| 288 | } else { |
| 289 | Weathercxx . . $ Weather..flagscxx . . $ weather#flags. &= ~WEATHER_FLAGS_RAINcxx . . $ `Descent3/weather.h:22:9`!; |
| 290 | } |
| 291 | } |
| 292 | |
| 293 | // Sets the state of the rain to on or off, plus sets the intensity of the rain (0 to 1) |
| 294 | void SetSnowStatecxx . . $ SetSnowState(43c79ee2f1b9aefe).(int on, float intensity) { |
| 295 | if (on) { |
| 296 | Weathercxx . . $ Weather..flagscxx . . $ weather#flags. |= WEATHER_FLAGS_SNOWcxx . . $ `Descent3/weather.h:24:9`!; |
| 297 | Weathercxx . . $ Weather..snow_intensity_scalarcxx . . $ weather#snow_intensity_scalar. = intensity; |
| 298 | } else { |
| 299 | Weathercxx . . $ Weather..flagscxx . . $ weather#flags. &= ~WEATHER_FLAGS_SNOWcxx . . $ `Descent3/weather.h:24:9`!; |
| 300 | } |
| 301 | } |
| 302 | |
| 303 | // Sets the state of lightning to on or off, plus allows the setting of how often to check |
| 304 | // for lightning and the randomness at which lightning happens |
| 305 | void SetLightningStatecxx . . $ SetLightningState(d6d7ce2c0b3115db).(int on, float interval_time, int randval) { |
| 306 | if (on) { |
| 307 | Weathercxx . . $ Weather..flagscxx . . $ weather#flags. |= WEATHER_FLAGS_LIGHTNINGcxx . . $ `Descent3/weather.h:23:9`!; |
| 308 | Weathercxx . . $ Weather..lightning_sequencecxx . . $ weather#lightning_sequence. = 0; |
| 309 | Weathercxx . . $ Weather..lightning_rand_valuecxx . . $ weather#lightning_rand_value. = randval; |
| 310 | Weathercxx . . $ Weather..lightning_interval_timecxx . . $ weather#lightning_interval_time. = interval_time; |
| 311 | } else { |
| 312 | Weathercxx . . $ Weather..flagscxx . . $ weather#flags. &= ~WEATHER_FLAGS_LIGHTNINGcxx . . $ `Descent3/weather.h:23:9`!; |
| 313 | } |
| 314 | } |