| 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 | --- HISTORICAL COMMENTS FOLLOW --- |
| 19 | |
| 20 | * $Logfile: /DescentIII/main/viseffect.cpp $ |
| 21 | * $Revision: 145 $ |
| 22 | * $Date: 4/19/00 5:26p $ |
| 23 | * $Author: Matt $ |
| 24 | * |
| 25 | * System for creating small visual effects visects |
| 26 | * |
| 27 | * $Log: /DescentIII/main/viseffect.cpp $ |
| 28 | * |
| 29 | * 145 4/19/00 5:26p Matt |
| 30 | * From Duane for 1.4 |
| 31 | * Changes to InitVisEffects() |
| 32 | * |
| 33 | * 144 3/21/00 9:58a Matt |
| 34 | * Changed to Mac-only the code that sets a variable number of vis effects |
| 35 | * based on texture quality. |
| 36 | * |
| 37 | * 143 3/20/00 2:33p Matt |
| 38 | * Merge of Duane's post-1.3 changes. |
| 39 | * Small change in freeing viseffect memory. |
| 40 | * Fixed botched change with sine wave code. |
| 41 | * |
| 42 | * 141 11/05/99 3:17p Jeff |
| 43 | * fixed visalloc bug for pc |
| 44 | * |
| 45 | * 140 10/22/99 2:38p Jay |
| 46 | * Update for the FinalBoss Laser Effect |
| 47 | * |
| 48 | * 139 10/21/99 9:29p Jeff |
| 49 | * B.A. Macintosh code merge |
| 50 | * |
| 51 | * 138 10/12/99 11:08a Jeff |
| 52 | * grey lightning effect |
| 53 | * |
| 54 | * 137 9/21/99 2:54p Jeff |
| 55 | * grey spark's want lighting |
| 56 | * |
| 57 | * 136 7/20/99 1:00p Jason |
| 58 | * added auto katmai support |
| 59 | * |
| 60 | * 135 5/17/99 6:11p Jason |
| 61 | * moved center of lightning effect |
| 62 | * |
| 63 | * 134 5/14/99 12:15p Jason |
| 64 | * fixed vis effect problem for luke |
| 65 | * |
| 66 | * 133 5/13/99 3:42p Ardussi |
| 67 | * changes for compiling on the Mac |
| 68 | * |
| 69 | * 132 5/10/99 8:20a Chris |
| 70 | * Fixed bug with weather lightning effects and Non-render objects |
| 71 | * |
| 72 | * 131 5/10/99 1:53a Jason |
| 73 | * add blackshark explosion |
| 74 | * |
| 75 | * 130 5/05/99 6:30p Jason |
| 76 | * toned down mass driver effect |
| 77 | * |
| 78 | * 129 5/04/99 7:30p Jason |
| 79 | * fixed viseffect linking problem |
| 80 | * |
| 81 | * 128 5/02/99 4:14p Jason |
| 82 | * fixed bug with attached viseffects |
| 83 | * |
| 84 | * 127 5/02/99 1:36a Jason |
| 85 | * added moving object lighting viseffects |
| 86 | * |
| 87 | * 126 5/02/99 12:21a Jason |
| 88 | * fixed crash bug with napalm vis effects |
| 89 | * |
| 90 | * 125 5/01/99 4:58p Jason |
| 91 | * made real viseffects not get created if not seen |
| 92 | * |
| 93 | * 124 4/30/99 7:51p Jason |
| 94 | * fixed lighting coming from controlled viseffects |
| 95 | * |
| 96 | * 123 4/30/99 6:21p Jeff |
| 97 | * fixed autotile (Jason) |
| 98 | * |
| 99 | * 122 4/30/99 5:42p Jason |
| 100 | * changes for blast rings |
| 101 | * |
| 102 | * 121 4/28/99 11:28a Jason |
| 103 | * made real viseffects not cast light |
| 104 | * |
| 105 | * 120 4/26/99 7:42p Jason |
| 106 | * fixed spew effect |
| 107 | * |
| 108 | * 119 4/21/99 11:05a Kevin |
| 109 | * new ps_rand and ps_srand to replace rand & srand |
| 110 | * |
| 111 | * 118 4/19/99 3:18p Jason |
| 112 | * made real vis effects work |
| 113 | * |
| 114 | * 117 4/19/99 3:47a Jeff |
| 115 | * fixed min/max for Linux |
| 116 | * |
| 117 | * 116 4/14/99 3:57a Jeff |
| 118 | * fixed case mismatch in #includes |
| 119 | * |
| 120 | * 115 4/13/99 12:16p Jason |
| 121 | * more tweaks for the mass driver |
| 122 | * |
| 123 | * 114 4/09/99 7:49p Jason |
| 124 | * yet more mass driver fixes |
| 125 | * |
| 126 | * 113 4/09/99 7:26p Jason |
| 127 | * added better mass driver effect |
| 128 | * |
| 129 | * 112 4/07/99 3:53p Jason |
| 130 | * fixed lightning autotile problem |
| 131 | * |
| 132 | * 111 4/06/99 6:25p Jason |
| 133 | * more mass driver tweaks |
| 134 | * |
| 135 | * 110 4/06/99 4:14p Jason |
| 136 | * made mass driver a little cooler |
| 137 | * |
| 138 | * 109 4/06/99 1:51p Jason |
| 139 | * added new mass driver effect |
| 140 | * |
| 141 | * 108 4/05/99 4:39p Jason |
| 142 | * added groovy new smoke trails |
| 143 | * |
| 144 | * 107 4/03/99 4:25p Jason |
| 145 | * sped up attached vis effects by a large amount |
| 146 | * |
| 147 | * 106 4/02/99 3:58p Jason |
| 148 | * sped up vis effect stuff |
| 149 | * |
| 150 | * 105 4/01/99 1:10p Jason |
| 151 | * made vis effects better for the lighting system |
| 152 | * |
| 153 | * 104 3/31/99 1:20p Kevin |
| 154 | * Fix for Demos and Gamegauge -- to deal with situations where time goes |
| 155 | * backwards |
| 156 | * |
| 157 | * 103 3/31/99 11:42a Jason |
| 158 | * added support for attached thick lightning |
| 159 | * |
| 160 | * 102 3/30/99 7:18p Jason |
| 161 | * made blast rings more noticeable |
| 162 | * |
| 163 | * 101 3/30/99 6:01p Jason |
| 164 | * added new procedural effect |
| 165 | * |
| 166 | * 100 3/30/99 5:19p Jason |
| 167 | * fixed saturation of thicklighting |
| 168 | * |
| 169 | * 99 3/29/99 7:30p Jason |
| 170 | * added cool new energy effect |
| 171 | * |
| 172 | * 98 3/27/99 2:15p Jason |
| 173 | * added better thick lightining |
| 174 | * |
| 175 | * 97 3/25/99 3:30p Jason |
| 176 | * |
| 177 | * 96 3/24/99 6:28p Jason |
| 178 | * fixed size with thick lightning |
| 179 | * |
| 180 | * 95 3/23/99 4:10p Jason |
| 181 | * more tweaks for line sparks |
| 182 | * |
| 183 | * 94 3/23/99 3:52p Jason |
| 184 | * fixed sine wave bug |
| 185 | * |
| 186 | * 93 3/23/99 12:50p Jason |
| 187 | * added line sparks |
| 188 | * |
| 189 | * 92 3/22/99 11:17a Jason |
| 190 | * Katmai enhancements |
| 191 | * |
| 192 | * 91 2/25/99 11:01a Matt |
| 193 | * Added new explosion system. |
| 194 | * |
| 195 | * 90 2/15/99 4:10p Jason |
| 196 | * made non-vis objects kill all their attach sounds/objects |
| 197 | * |
| 198 | * 89 2/09/99 2:39p Jason |
| 199 | * added destroyable faces |
| 200 | * |
| 201 | * 88 1/26/99 6:39p Jason |
| 202 | * added wall effects code |
| 203 | * |
| 204 | * 87 1/21/99 11:15p Jeff |
| 205 | * pulled out some structs and defines from header files and moved them |
| 206 | * into seperate header files so that multiplayer dlls don't require major |
| 207 | * game headers, just those new headers. Side effect is a shorter build |
| 208 | * time. Also cleaned up some header file #includes that weren't needed. |
| 209 | * This affected polymodel.h, object.h, player.h, vecmat.h, room.h, |
| 210 | * manage.h and multi.h |
| 211 | * |
| 212 | * 86 12/11/98 5:08p Jason |
| 213 | * changed mass driver effect |
| 214 | * |
| 215 | * 85 11/19/98 6:38p Jason |
| 216 | * made a better black shark effect |
| 217 | * |
| 218 | * 84 11/18/98 2:54p Jason |
| 219 | * added snow effect |
| 220 | * |
| 221 | * 83 11/10/98 3:28p Jason |
| 222 | * made dynamic lighting work more sensibly |
| 223 | * |
| 224 | * 82 10/21/98 12:47p Jason |
| 225 | * fixed stupid bug with my last rev |
| 226 | * |
| 227 | * 81 10/20/98 9:52p Jason |
| 228 | * took out assert |
| 229 | * |
| 230 | * 80 10/05/98 11:35p Matt |
| 231 | * Added assert |
| 232 | * |
| 233 | * 79 10/05/98 7:29p Jason |
| 234 | * added cool black smoke |
| 235 | * |
| 236 | * 78 9/30/98 2:26p Jason |
| 237 | * fixed billboard bug |
| 238 | * |
| 239 | * 77 9/30/98 12:59p Jason |
| 240 | * added some cool matcen effects |
| 241 | * |
| 242 | * 76 9/29/98 7:15p Jason |
| 243 | * added axis billboards |
| 244 | * |
| 245 | * 75 9/29/98 12:49p Jason |
| 246 | * worked on matcen effects and lightning |
| 247 | * |
| 248 | * 74 9/28/98 4:41p Jason |
| 249 | * made explosions give dynamic light |
| 250 | * |
| 251 | * 73 9/24/98 12:57p Jason |
| 252 | * more state limited optimizations |
| 253 | * |
| 254 | * 72 9/21/98 7:01p Jason |
| 255 | * miscellaneous visual tweaks |
| 256 | * |
| 257 | * 71 9/21/98 6:53p Sean |
| 258 | * took out stupid debug assert |
| 259 | * |
| 260 | * 70 9/18/98 8:23p Jason |
| 261 | * fixed insidious vis effect errors |
| 262 | * |
| 263 | * 69 9/18/98 11:18a Jason |
| 264 | * fixed miscellaneous bugs with camera system |
| 265 | * |
| 266 | * 68 9/17/98 6:08p Jason |
| 267 | * more tweaks for effects |
| 268 | * |
| 269 | * 67 9/17/98 3:03p Jason |
| 270 | * added lightning and invul hit effects |
| 271 | * |
| 272 | * 66 9/15/98 6:39p Jason |
| 273 | * made medium smoke saturate |
| 274 | * |
| 275 | * 65 9/15/98 4:31p Jason |
| 276 | * added more functionality for the dedicated server |
| 277 | * |
| 278 | * 64 9/09/98 4:49p Jason |
| 279 | * tweaked black shark lightning effect |
| 280 | * |
| 281 | * 63 9/09/98 4:30p Jason |
| 282 | * fixed a remaining (and insidious) bug with gunpoint instancing |
| 283 | * |
| 284 | * 62 9/09/98 4:28p Jason |
| 285 | * added better weapon effects |
| 286 | * |
| 287 | * 61 8/17/98 12:10p Chris |
| 288 | * Fixed MAJOR bug in getting gunpoint positions |
| 289 | * |
| 290 | * 60 8/03/98 11:12a Jason |
| 291 | * fixed some zero foward vector errors |
| 292 | * |
| 293 | * 59 6/24/98 3:56p Jason |
| 294 | * added code for new omega cannon |
| 295 | * |
| 296 | * 58 6/23/98 3:34p Jason |
| 297 | * added cool lighting effect to gravity field |
| 298 | * |
| 299 | * 57 6/22/98 6:52p Jason |
| 300 | * changed gravity field effect somewhat |
| 301 | * |
| 302 | * 56 6/22/98 6:26p Jason |
| 303 | * added gravity field effect for weapons |
| 304 | * |
| 305 | * 55 6/12/98 5:14p Jason |
| 306 | * made viseffects deal with zbuffer better |
| 307 | * |
| 308 | * 54 6/10/98 4:47p Jason |
| 309 | * smoke trail test |
| 310 | * |
| 311 | * 53 6/02/98 11:02a Jason |
| 312 | * Post E3 Checkin |
| 313 | * |
| 314 | * 52 5/27/98 5:17p Jason |
| 315 | * fixed some bugs for the E3 Demo |
| 316 | * |
| 317 | * 51 5/26/98 6:54p Jason |
| 318 | * viseffect optimizations |
| 319 | * |
| 320 | * 50 5/26/98 6:36p Jason |
| 321 | * made particle viseffects not relink |
| 322 | * |
| 323 | * 49 5/15/98 11:22a Jason |
| 324 | * make smoke trail saturation settable by designers |
| 325 | * |
| 326 | * 48 5/13/98 12:05p Jason |
| 327 | * made napalm explosions bigger for bigger objects |
| 328 | * |
| 329 | * 47 5/06/98 1:25p Jason |
| 330 | * more viseffect tweaks |
| 331 | * |
| 332 | * 46 5/06/98 12:55p Jason |
| 333 | * did some vis effect optimizations |
| 334 | * |
| 335 | * 45 5/01/98 6:23p Jason |
| 336 | * made better puddle rain |
| 337 | * |
| 338 | * 44 4/30/98 6:45p Jason |
| 339 | * more changes for weather |
| 340 | * |
| 341 | * 43 4/30/98 3:39p Jason |
| 342 | * don't make non-billowingfireballs rotate |
| 343 | * |
| 344 | * 42 4/30/98 11:55a Jason |
| 345 | * weather tweaks |
| 346 | * |
| 347 | * 41 4/29/98 3:27p Jason |
| 348 | * added weather engine |
| 349 | * |
| 350 | * 40 4/29/98 12:50p Jason |
| 351 | * more rain changes |
| 352 | * |
| 353 | * 39 4/29/98 11:38a Jason |
| 354 | * added some weather effects (first pass) |
| 355 | * |
| 356 | * 38 4/23/98 6:38p Jason |
| 357 | * made bitmaps use 1555 format |
| 358 | * |
| 359 | * 37 4/20/98 3:58p Jason |
| 360 | * made viseffects attach to subobjects other than zero |
| 361 | * |
| 362 | * 36 4/19/98 5:00p Jason |
| 363 | * added cool napalm effect, plus made object effects dynamically |
| 364 | * allocated |
| 365 | * |
| 366 | * 35 4/17/98 12:45p Jason |
| 367 | * various changes for multiplayer |
| 368 | * |
| 369 | * 34 4/15/98 2:33p Jason |
| 370 | * changed some smoke trail stuff |
| 371 | * |
| 372 | * 33 4/15/98 12:22p Jason |
| 373 | * lots of miscellaneous stuff pertaining to lighting and vis effects |
| 374 | * |
| 375 | * 32 4/10/98 12:39p Jason |
| 376 | * added expanding explosion bitmaps |
| 377 | * |
| 378 | * 31 4/09/98 4:53p Jason |
| 379 | * fixed particle bug |
| 380 | * |
| 381 | * 30 4/07/98 3:31p Jason |
| 382 | * got particle effects working with weapons |
| 383 | * |
| 384 | * 29 4/07/98 12:54p Jason |
| 385 | * changes for viseffects and multiplayer dll |
| 386 | * |
| 387 | * 28 4/02/98 12:24p Jason |
| 388 | * trimmed some fat from our structures |
| 389 | * |
| 390 | * 27 3/31/98 2:22p Jason |
| 391 | * bug fix for dead vis effects |
| 392 | * |
| 393 | * 26 3/30/98 12:46a Jason |
| 394 | * sped up deletion of vis effects |
| 395 | * |
| 396 | * 25 3/09/98 1:00p Jason |
| 397 | * toned down explosion lighting |
| 398 | * |
| 399 | * 24 3/05/98 6:56p Jason |
| 400 | * temp fix for out of bound errors on viseffects |
| 401 | * |
| 402 | * 23 2/26/98 3:20p Jason |
| 403 | * changes for faster lighting |
| 404 | * |
| 405 | * 22 2/25/98 4:59p Jason |
| 406 | * got dynamic explosion lighting working with vis-effects |
| 407 | * |
| 408 | * 21 2/25/98 4:31p Jason |
| 409 | * changes for explosions |
| 410 | * |
| 411 | * 20 2/17/98 1:50p Jason |
| 412 | * fixed viseffect zbias problem |
| 413 | * |
| 414 | * 19 2/17/98 1:00p Jason |
| 415 | * fixed viseffect clipping |
| 416 | * |
| 417 | * 18 2/16/98 2:37p Jason |
| 418 | * added real viseffects |
| 419 | * |
| 420 | * 17 2/06/98 1:00p Jason |
| 421 | * did some state setting for blast rings |
| 422 | * |
| 423 | * 16 2/05/98 6:53p Jason |
| 424 | * added new weapon slot |
| 425 | * |
| 426 | * 15 2/05/98 2:54p Jason |
| 427 | * changes for explosions |
| 428 | * |
| 429 | * 14 2/05/98 12:37p Jason |
| 430 | * added more weapon effects |
| 431 | * |
| 432 | * 13 2/04/98 9:28p Jason |
| 433 | * added some new weapons effects |
| 434 | * |
| 435 | * 12 2/04/98 6:09p Matt |
| 436 | * Changed object room number to indicate a terrain cell via a flag. Got |
| 437 | * rid of the object flag which used to indicate terrain. |
| 438 | * |
| 439 | */ |
| 440 | |
| 441 | #include <algorithm> |
| 442 | #include <cstdlib> |
| 443 | #include <memory.h> |
| 444 | |
| 445 | #include "config.h"cxx . . $ `<file>/Descent3/config.h`/ |
| 446 | #include "dedicated_server.h"cxx . . $ `<file>/lib/dedicated_server.h`/ |
| 447 | #include "fireball.h"cxx . . $ `<file>/Descent3/fireball.h`/ |
| 448 | #include "game.h"cxx . . $ `<file>/Descent3/game.h`/ |
| 449 | #include "gametexture.h"cxx . . $ `<file>/Descent3/gametexture.h`/ |
| 450 | #include "lighting.h"cxx . . $ `<file>/Descent3/lighting.h`/ |
| 451 | #include "mem.h"cxx . . $ `<file>/mem/mem.h`/ |
| 452 | #include "object.h"cxx . . $ `<file>/Descent3/object.h`/ |
| 453 | #include "physics.h"cxx . . $ `<file>/physics/physics.h`/ |
| 454 | #include "player.h"cxx . . $ `<file>/Descent3/player.h`/ |
| 455 | #include "polymodel.h"cxx . . $ `<file>/model/polymodel.h`/ |
| 456 | #include "psrand.h"cxx . . $ `<file>/misc/psrand.h`/ |
| 457 | #include "room.h"cxx . . $ `<file>/Descent3/room.h`/ |
| 458 | #include "terrain.h"cxx . . $ `<file>/Descent3/terrain.h`/ |
| 459 | #include "vclip.h"cxx . . $ `<file>/Descent3/vclip.h`/ |
| 460 | #include "viseffect.h"cxx . . $ `<file>/Descent3/viseffect.h`/ |
| 461 | #include "weapon.h"cxx . . $ `<file>/Descent3/weapon.h`/ |
| 462 | #include "weather.h"cxx . . $ `<file>/Descent3/weather.h`/ |
| 463 | |
| 464 | // DAJ vis_effect VisEffects[max_vis_effects]; |
| 465 | // DAJ uint16_t VisDeadList[max_vis_effects]; |
| 466 | // DAJ static int16_t Vis_free_list[max_vis_effects]; |
| 467 | |
| 468 | vis_effectcxx . . $ vis_effect# *VisEffectscxx . . $ VisEffects. = NULLcxx . . $ `<external>/15298297234472979974/stddef.h:416:9`!; |
| 469 | |
| 470 | static int16_t *Vis_free_listcxx . . $ Vis_free_list. = NULLcxx . . $ `<external>/15298297234472979974/stddef.h:416:9`!; |
| 471 | uint16_tcxx . . $ uint16_t# *VisDeadListcxx . . $ VisDeadList. = NULLcxx . . $ `<external>/15298297234472979974/stddef.h:416:9`!; |
| 472 | |
| 473 | uint16_tcxx . . $ uint16_t# max_vis_effectscxx . . $ max_vis_effects. = 0; |
| 474 | |
| 475 | int NumVisDeadcxx . . $ NumVisDead. = 0; |
| 476 | int Highest_vis_effect_indexcxx . . $ Highest_vis_effect_index. = 0; |
| 477 | int Num_vis_effectscxx . . $ Num_vis_effects. = 0; |
| 478 | |
| 479 | void ShutdownVisEffectscxx . . $ ShutdownVisEffects(49f6e7a06ebc5aa8).() { |
| 480 | if (VisEffectscxx . . $ VisEffects.) |
| 481 | mem_freecxx . . $ `mem/mem.h:80:9`!(VisEffects); |
| 482 | if (VisDeadListcxx . . $ VisDeadList.) |
| 483 | mem_freecxx . . $ `mem/mem.h:80:9`!(VisDeadList); |
| 484 | if (Vis_free_listcxx . . $ Vis_free_list.) |
| 485 | mem_freecxx . . $ `mem/mem.h:80:9`!(Vis_free_list); |
| 486 | } |
| 487 | |
| 488 | // Goes through our array and clears the slots out |
| 489 | void InitVisEffectscxx . . $ InitVisEffects(49f6e7a06ebc5aa8).() { |
| 490 | static uint16_tcxx . . $ uint16_t# old_max_vis = 0; |
| 491 | max_vis_effectscxx . . $ max_vis_effects. = MAX_VIS_EFFECTScxx . . $ `Descent3/viseffect_external.h:57:9`!; // always peg to max on PC |
| 492 | |
| 493 | if (old_max_vis == max_vis_effectscxx . . $ max_vis_effects.) |
| 494 | return; |
| 495 | |
| 496 | if (VisEffectscxx . . $ VisEffects. != NULLcxx . . $ `<external>/15298297234472979974/stddef.h:416:9`!) { |
| 497 | VisEffectscxx . . $ VisEffects. = (vis_effectcxx . . $ vis_effect# *)mem_realloccxx . . $ `mem/mem.h:83:9`!(VisEffects, sizeof(vis_effect) * max_vis_effects); |
| 498 | VisDeadListcxx . . $ VisDeadList. = (uint16_tcxx . . $ uint16_t# *)mem_realloccxx . . $ `mem/mem.h:83:9`!(VisDeadList, sizeof(uint16_t) * max_vis_effects); |
| 499 | Vis_free_listcxx . . $ Vis_free_list. = (int16_t *)mem_realloccxx . . $ `mem/mem.h:83:9`!(Vis_free_list, sizeof(int16_t) * max_vis_effects); |
| 500 | } else if (VisEffectscxx . . $ VisEffects. == NULLcxx . . $ `<external>/15298297234472979974/stddef.h:416:9`!) { |
| 501 | VisEffectscxx . . $ VisEffects. = (vis_effectcxx . . $ vis_effect# *)mem_malloccxx . . $ `mem/mem.h:79:9`!(sizeof(vis_effect) * max_vis_effects); |
| 502 | VisDeadListcxx . . $ VisDeadList. = (uint16_tcxx . . $ uint16_t# *)mem_malloccxx . . $ `mem/mem.h:79:9`!(sizeof(uint16_t) * max_vis_effects); |
| 503 | Vis_free_listcxx . . $ Vis_free_list. = (int16_t *)mem_malloccxx . . $ `mem/mem.h:79:9`!(sizeof(int16_t) * max_vis_effects); |
| 504 | } |
| 505 | for (int i = 0; i < max_vis_effectscxx . . $ max_vis_effects.; i++) { |
| 506 | VisEffectscxx . . $ VisEffects.[i].typecxx . . $ vis_effect#type. = VIS_NONEcxx . . $ `Descent3/viseffect_external.h:60:9`!; |
| 507 | VisEffectscxx . . $ VisEffects.[i].roomnumcxx . . $ vis_effect#roomnum. = -1; |
| 508 | VisEffectscxx . . $ VisEffects.[i].prevcxx . . $ vis_effect#prev. = -1; |
| 509 | VisEffectscxx . . $ VisEffects.[i].nextcxx . . $ vis_effect#next. = -1; |
| 510 | Vis_free_listcxx . . $ Vis_free_list.[i] = i; |
| 511 | } |
| 512 | old_max_vis = max_vis_effectscxx . . $ max_vis_effects.; |
| 513 | Num_vis_effectscxx . . $ Num_vis_effects. = 0; |
| 514 | Highest_vis_effect_indexcxx . . $ Highest_vis_effect_index. = 0; |
| 515 | |
| 516 | atexitcxx . . $ atexit(cc8c495369588262).(ShutdownVisEffectscxx . . $ ShutdownVisEffects(49f6e7a06ebc5aa8).); |
| 517 | } |
| 518 | |
| 519 | // Returns the next free viseffect |
| 520 | int VisEffectAllocatecxx . . $ VisEffectAllocate(b126dc7c1de90089).() { |
| 521 | if (Num_vis_effectscxx . . $ Num_vis_effects. == max_vis_effectscxx . . $ max_vis_effects.) { |
| 522 | mprintfcxx . . $ `ddebug/mono.h:82:9`!(0, "Couldn't allocate vis effect!\n"); |
| 523 | return -1; |
| 524 | } |
| 525 | |
| 526 | int n = Vis_free_listcxx . . $ Vis_free_list.[Num_vis_effectscxx . . $ Num_vis_effects.++]; |
| 527 | ASSERTcxx . . $ `misc/pserror.h:246:9`!(VisEffects[n].type == VIS_NONEcxx . . $ `Descent3/viseffect_external.h:60:9`!); // Get Jason |
| 528 | |
| 529 | if (n > Highest_vis_effect_indexcxx . . $ Highest_vis_effect_index.) { |
| 530 | Highest_vis_effect_indexcxx . . $ Highest_vis_effect_index. = n; |
| 531 | } |
| 532 | |
| 533 | return n; |
| 534 | } |
| 535 | |
| 536 | // Frees up a viseffect for use |
| 537 | int VisEffectFreecxx . . $ VisEffectFree(7864480464b09eea).(int visnum) { |
| 538 | ASSERTcxx . . $ `misc/pserror.h:246:9`!(visnum >= 0 && visnum <= max_vis_effects); |
| 539 | |
| 540 | Vis_free_listcxx . . $ Vis_free_list.[--Num_vis_effectscxx . . $ Num_vis_effects.] = visnum; |
| 541 | VisEffectscxx . . $ VisEffects.[visnum].typecxx . . $ vis_effect#type. = VIS_NONEcxx . . $ `Descent3/viseffect_external.h:60:9`!; |
| 542 | |
| 543 | if (visnum == Highest_vis_effect_indexcxx . . $ Highest_vis_effect_index.) { |
| 544 | while (VisEffectscxx . . $ VisEffects.[Highest_vis_effect_indexcxx . . $ Highest_vis_effect_index.].typecxx . . $ vis_effect#type. != VIS_NONEcxx . . $ `Descent3/viseffect_external.h:60:9`! && Highest_vis_effect_indexcxx . . $ Highest_vis_effect_index. > 0) |
| 545 | Highest_vis_effect_indexcxx . . $ Highest_vis_effect_index.--; |
| 546 | } |
| 547 | |
| 548 | return 1; |
| 549 | } |
| 550 | |
| 551 | int VisEffectInitTypecxx . . $ VisEffectInitType(9a333b99fc25925f).(vis_effectcxx . . $ vis_effect# *vis) { |
| 552 | int ret = 1; |
| 553 | |
| 554 | vis->sizecxx . . $ vis_effect#size. = Fireballscxx . . $ Fireballs.[vis->idcxx . . $ vis_effect#id.].sizecxx . . $ fireball#size.; |
| 555 | vis->flagscxx . . $ vis_effect#flags. |= VF_USES_LIFELEFTcxx . . $ `Descent3/viseffect_external.h:64:9`!; |
| 556 | vis->lifeleftcxx . . $ vis_effect#lifeleft. = Fireballscxx . . $ Fireballs.[vis->idcxx . . $ vis_effect#id.].total_lifecxx . . $ fireball#total_life.; |
| 557 | vis->lifetimecxx . . $ vis_effect#lifetime. = vis->lifeleftcxx . . $ vis_effect#lifeleft.; |
| 558 | |
| 559 | if (Fireballscxx . . $ Fireballs.[vis->idcxx . . $ vis_effect#id.].typecxx . . $ fireball#type. == FT_EXPLOSIONcxx . . $ `Descent3/fireball_external.h:77:9`! && vis->idcxx . . $ vis_effect#id. != CUSTOM_EXPLOSION_INDEXcxx . . $ `Descent3/fireball_external.h:33:9`! && vis->idcxx . . $ vis_effect#id. != NAPALM_BALL_INDEXcxx . . $ `Descent3/fireball_external.h:47:9`!) |
| 560 | vis->lighting_colorcxx . . $ vis_effect#lighting_color. = OPAQUE_FLAGcxx . . $ `lib/grdefs.h:72:9`! | GR_RGB16cxx . . $ GR_RGB16(6461fafb79bad5b9).(255, 180, 20); |
| 561 | |
| 562 | return ret; |
| 563 | } |
| 564 | |
| 565 | // initialize a new viseffect. adds to the list for the given room |
| 566 | // returns the vis number |
| 567 | int VisEffectCreatecxx . . $ VisEffectCreate(20e4831b18f6895c).(uint8_tcxx . . $ uint8_t# type, uint8_tcxx . . $ uint8_t# id, int roomnum, vectorcxx . . $ vector# *pos) { |
| 568 | int visnum; |
| 569 | vis_effectcxx . . $ vis_effect# *vis; |
| 570 | |
| 571 | if ((Game_modecxx . . $ Game_mode. & GM_MULTIcxx . . $ `Descent3/game.h:288:9`!) && Dedicated_servercxx . . $ Dedicated_server.) |
| 572 | return -1; // Dedicated servers don't need to create vis effects |
| 573 | |
| 574 | if (ROOMNUM_OUTSIDEcxx . . $ `lib/object_external_struct.h:127:9`!(roomnum)) { |
| 575 | if (CELLNUMcxx . . $ `lib/object_external_struct.h:121:9`!(roomnum) > TERRAIN_WIDTHcxx . . $ `Descent3/terrain.h:31:9`! * TERRAIN_DEPTHcxx . . $ `Descent3/terrain.h:32:9`!) |
| 576 | return -1; |
| 577 | if (CELLNUMcxx . . $ `lib/object_external_struct.h:121:9`!(roomnum) < 0) |
| 578 | return -1; |
| 579 | |
| 580 | if (Gametimecxx . . $ Gametime. - Last_terrain_render_timecxx . . $ Last_terrain_render_time. > 5.0) |
| 581 | return -1; |
| 582 | } else { |
| 583 | ASSERTcxx . . $ `misc/pserror.h:246:9`!(roomnum >= 0 && roomnum <= Highest_room_index && Rooms[roomnum].used); |
| 584 | |
| 585 | // Don't create viseffects in rooms we haven't seen in a while |
| 586 | if (Gametimecxx . . $ Gametime. - Roomscxx . . $ Rooms.[roomnum].last_render_timecxx . . $ room#last_render_time. > 5.0) |
| 587 | return -1; |
| 588 | } |
| 589 | |
| 590 | // Find next free object |
| 591 | visnum = VisEffectAllocatecxx . . $ VisEffectAllocate(b126dc7c1de90089).(); |
| 592 | |
| 593 | if (visnum == -1) // no free objects |
| 594 | return -1; |
| 595 | |
| 596 | ASSERTcxx . . $ `misc/pserror.h:246:9`!(VisEffects[visnum].type == VIS_NONEcxx . . $ `Descent3/viseffect_external.h:60:9`!); // make sure unused |
| 597 | |
| 598 | vis = &VisEffectscxx . . $ VisEffects.[visnum]; |
| 599 | |
| 600 | ASSERTcxx . . $ `misc/pserror.h:246:9`!(vis->roomnum == -1); |
| 601 | |
| 602 | memset(vis, 0, sizeof(vis_effectcxx . . $ vis_effect#)); |
| 603 | |
| 604 | // Fill in fields |
| 605 | vis->typecxx . . $ vis_effect#type. = VIS_FIREBALLcxx . . $ `Descent3/viseffect_external.h:61:9`!; |
| 606 | vis->idcxx . . $ vis_effect#id. = id; |
| 607 | vis->poscxx . . $ vis_effect#pos. =cxx . . $ vector#`operator=`(a48bc7e93a8dae5e). *pos; |
| 608 | vis->flagscxx . . $ vis_effect#flags. = 0; |
| 609 | vis->phys_flagscxx . . $ vis_effect#phys_flags. = 0; |
| 610 | vis->roomnumcxx . . $ vis_effect#roomnum. = roomnum; |
| 611 | vis->movement_typecxx . . $ vis_effect#movement_type. = MT_NONEcxx . . $ `Descent3/object_external.h:233:9`!; |
| 612 | vis->attach_infocxx . . $ vis_effect#attach_info..end_vertnumcxx . . $ vis_attach_info#end_vertnum. = -1; |
| 613 | vis->nextcxx . . $ vis_effect#next. = -1; |
| 614 | vis->prevcxx . . $ vis_effect#prev. = -1; |
| 615 | vis->lighting_colorcxx . . $ vis_effect#lighting_color. = 0; |
| 616 | |
| 617 | ASSERTcxx . . $ `misc/pserror.h:246:9`!(roomnum != -1); |
| 618 | |
| 619 | vis->creation_timecxx . . $ vis_effect#creation_time. = Gametimecxx . . $ Gametime.; |
| 620 | |
| 621 | // Initialize all the type-specific info |
| 622 | VisEffectInitTypecxx . . $ VisEffectInitType(9a333b99fc25925f).(vis); |
| 623 | |
| 624 | VisEffectLinkcxx . . $ VisEffectLink(3e454b8ccf442868).(visnum, roomnum); |
| 625 | |
| 626 | return visnum; |
| 627 | } |
| 628 | |
| 629 | // Creates vis effects but has the caller set their parameters |
| 630 | // initialize a new viseffect. adds to the list for the given room |
| 631 | // returns the vis number |
| 632 | int VisEffectCreateControlledcxx . . $ VisEffectCreateControlled(2aaf2e89dfc906a6).(uint8_tcxx . . $ uint8_t# type, objectcxx . . $ object# *parent, uint8_tcxx . . $ uint8_t# id, int roomnum, vectorcxx . . $ vector# *pos, float lifetime, |
| 633 | vectorcxx . . $ vector# *velocity, int phys_flags, float size, float drag, float mass, bool isreal) { |
| 634 | int visnum; |
| 635 | vis_effectcxx . . $ vis_effect# *vis; |
| 636 | static int napalm_id = -1; |
| 637 | |
| 638 | if (napalm_id == -1) |
| 639 | napalm_id = FindWeaponNamecxx . . $ FindWeaponName(5c4306d8553b3696).("Napalm"); |
| 640 | |
| 641 | if (isreal) { |
| 642 | ASSERTcxx . . $ `misc/pserror.h:246:9`!(parent != NULLcxx . . $ `<external>/15298297234472979974/stddef.h:416:9`!); // You have a spew that has no parent object? |
| 643 | |
| 644 | if (ROOMNUM_OUTSIDEcxx . . $ `lib/object_external_struct.h:127:9`!(roomnum)) { |
| 645 | if (CELLNUMcxx . . $ `lib/object_external_struct.h:121:9`!(roomnum) > TERRAIN_WIDTHcxx . . $ `Descent3/terrain.h:31:9`! * TERRAIN_DEPTHcxx . . $ `Descent3/terrain.h:32:9`!) |
| 646 | return -1; |
| 647 | if (CELLNUMcxx . . $ `lib/object_external_struct.h:121:9`!(roomnum) < 0) |
| 648 | return -1; |
| 649 | |
| 650 | if (Gametimecxx . . $ Gametime. - Last_terrain_render_timecxx . . $ Last_terrain_render_time. > 5.0) |
| 651 | return -1; |
| 652 | } else { |
| 653 | ASSERTcxx . . $ `misc/pserror.h:246:9`!(roomnum >= 0 && roomnum <= Highest_room_index && Rooms[roomnum].used); |
| 654 | |
| 655 | // Don't create real objects in rooms we haven't seen in a while |
| 656 | if (Gametimecxx . . $ Gametime. - Roomscxx . . $ Rooms.[roomnum].last_render_timecxx . . $ room#last_render_time. > 5.0) |
| 657 | return -1; |
| 658 | } |
| 659 | |
| 660 | int objnum = CreateAndFireWeaponcxx . . $ CreateAndFireWeapon(8720b471d3264b3b).(pos, velocity, parent, napalm_id); |
| 661 | if (objnum >= 0) { |
| 662 | objectcxx . . $ object# *obj = &Objectscxx . . $ Objects.[objnum]; |
| 663 | |
| 664 | obj->lifeleftcxx . . $ object#lifeleft. = lifetime; |
| 665 | obj->lifetimecxx . . $ object#lifetime. = lifetime; |
| 666 | obj->movement_typecxx . . $ object#movement_type. = MT_PHYSICScxx . . $ `Descent3/object_external.h:234:9`!; |
| 667 | |
| 668 | if (mass > 0 && drag > 0) { |
| 669 | obj->mtypecxx . . $ object#mtype..phys_infocxx . . $ object#$anonymous_type_8#phys_info..masscxx . . $ physics_info#mass. = mass; |
| 670 | obj->mtypecxx . . $ object#mtype..phys_infocxx . . $ object#$anonymous_type_8#phys_info..dragcxx . . $ physics_info#drag. = drag; |
| 671 | } |
| 672 | |
| 673 | if (size > 0) |
| 674 | obj->sizecxx . . $ object#size. = size; |
| 675 | |
| 676 | obj->mtypecxx . . $ object#mtype..phys_infocxx . . $ object#$anonymous_type_8#phys_info..velocitycxx . . $ physics_info#velocity. =cxx . . $ vector#`operator=`(a48bc7e93a8dae5e). *velocity; |
| 677 | |
| 678 | if (phys_flags) |
| 679 | obj->mtypecxx . . $ object#mtype..phys_infocxx . . $ object#$anonymous_type_8#phys_info..flagscxx . . $ physics_info#flags. = phys_flags; |
| 680 | |
| 681 | obj->ctypecxx . . $ object#ctype..laser_infocxx . . $ object#$anonymous_type_9#laser_info..casts_lightcxx . . $ laser_info_s#casts_light. = false; |
| 682 | } |
| 683 | |
| 684 | return objnum; |
| 685 | } |
| 686 | |
| 687 | visnum = VisEffectCreatecxx . . $ VisEffectCreate(20e4831b18f6895c).(type, id, roomnum, pos); |
| 688 | |
| 689 | if (visnum < 0) |
| 690 | return -1; // No vis effects free |
| 691 | |
| 692 | vis = &VisEffectscxx . . $ VisEffects.[visnum]; |
| 693 | |
| 694 | vis->lifeleftcxx . . $ vis_effect#lifeleft. = lifetime; |
| 695 | vis->lifetimecxx . . $ vis_effect#lifetime. = lifetime; |
| 696 | vis->movement_typecxx . . $ vis_effect#movement_type. = MT_PHYSICScxx . . $ `Descent3/object_external.h:234:9`!; |
| 697 | vis->masscxx . . $ vis_effect#mass. = mass; |
| 698 | vis->dragcxx . . $ vis_effect#drag. = drag; |
| 699 | |
| 700 | if (size > 0) |
| 701 | vis->sizecxx . . $ vis_effect#size. = size; |
| 702 | |
| 703 | vis->velocitycxx . . $ vis_effect#velocity. =cxx . . $ vector#`operator=`(a48bc7e93a8dae5e). *velocity; |
| 704 | |
| 705 | // float mag=vm_GetMagnitudeFast (&vis->velocity); |
| 706 | // mprintf(0,"CREATION:Velocity mag is %f\n",mag); |
| 707 | |
| 708 | if (phys_flags) |
| 709 | vis->phys_flagscxx . . $ vis_effect#phys_flags. = phys_flags; |
| 710 | |
| 711 | if (ROOMNUM_OUTSIDEcxx . . $ `lib/object_external_struct.h:127:9`!(roomnum)) |
| 712 | vis->phys_flagscxx . . $ vis_effect#phys_flags. |= PF_NO_COLLIDEcxx . . $ `Descent3/object_external.h:331:9`!; |
| 713 | |
| 714 | vis->flagscxx . . $ vis_effect#flags. |= VF_NO_Z_ADJUSTcxx . . $ `Descent3/viseffect_external.h:71:9`!; |
| 715 | vis->lighting_colorcxx . . $ vis_effect#lighting_color. &= ~(0x8000); |
| 716 | |
| 717 | return visnum; |
| 718 | } |
| 719 | |
| 720 | // link the viseffect into the list for its room |
| 721 | // Does nothing for effects over terrain |
| 722 | void VisEffectLinkcxx . . $ VisEffectLink(3e454b8ccf442868).(int visnum, int roomnum) { |
| 723 | vis_effectcxx . . $ vis_effect# *vis = &VisEffectscxx . . $ VisEffects.[visnum]; |
| 724 | |
| 725 | ASSERTcxx . . $ `misc/pserror.h:246:9`!(visnum != -1); |
| 726 | |
| 727 | if (!ROOMNUM_OUTSIDEcxx . . $ `lib/object_external_struct.h:127:9`!(vis->roomnum)) |
| 728 | ASSERTcxx . . $ `misc/pserror.h:246:9`!(roomnum >= 0 && roomnum <= Highest_room_index); |
| 729 | |
| 730 | vis->roomnumcxx . . $ vis_effect#roomnum. = roomnum; |
| 731 | |
| 732 | if (ROOMNUM_OUTSIDEcxx . . $ `lib/object_external_struct.h:127:9`!(vis->roomnum)) |
| 733 | return; |
| 734 | |
| 735 | vis->nextcxx . . $ vis_effect#next. = Roomscxx . . $ Rooms.[roomnum].vis_effectscxx . . $ room#vis_effects.; |
| 736 | Roomscxx . . $ Rooms.[roomnum].vis_effectscxx . . $ room#vis_effects. = visnum; |
| 737 | ASSERTcxx . . $ `misc/pserror.h:246:9`!(vis->next != visnum); |
| 738 | |
| 739 | vis->prevcxx . . $ vis_effect#prev. = -1; |
| 740 | |
| 741 | if (vis->nextcxx . . $ vis_effect#next. != -1) |
| 742 | VisEffectscxx . . $ VisEffects.[vis->nextcxx . . $ vis_effect#next.].prevcxx . . $ vis_effect#prev. = visnum; |
| 743 | } |
| 744 | |
| 745 | // Unlinks a viseffect from a room |
| 746 | // Does nothing for terrain |
| 747 | void VisEffectUnlinkcxx . . $ VisEffectUnlink(d4f767463ce0a6b3).(int visnum) { |
| 748 | vis_effectcxx . . $ vis_effect# *vis = &VisEffectscxx . . $ VisEffects.[visnum]; |
| 749 | |
| 750 | ASSERTcxx . . $ `misc/pserror.h:246:9`!(visnum != -1); |
| 751 | |
| 752 | if (ROOMNUM_OUTSIDEcxx . . $ `lib/object_external_struct.h:127:9`!(vis->roomnum)) |
| 753 | return; |
| 754 | else { |
| 755 | |
| 756 | roomcxx . . $ room# *rp = &Roomscxx . . $ Rooms.[vis->roomnumcxx . . $ vis_effect#roomnum.]; |
| 757 | |
| 758 | if (vis->prevcxx . . $ vis_effect#prev. == -1) |
| 759 | rp->vis_effectscxx . . $ room#vis_effects. = vis->nextcxx . . $ vis_effect#next.; |
| 760 | else |
| 761 | VisEffectscxx . . $ VisEffects.[vis->prevcxx . . $ vis_effect#prev.].nextcxx . . $ vis_effect#next. = vis->nextcxx . . $ vis_effect#next.; |
| 762 | |
| 763 | if (vis->nextcxx . . $ vis_effect#next. != -1) |
| 764 | VisEffectscxx . . $ VisEffects.[vis->nextcxx . . $ vis_effect#next.].prevcxx . . $ vis_effect#prev. = vis->prevcxx . . $ vis_effect#prev.; |
| 765 | |
| 766 | vis->roomnumcxx . . $ vis_effect#roomnum. = -1; |
| 767 | } |
| 768 | } |
| 769 | |
| 770 | // when an effect has moved into a new room, this function unlinks it |
| 771 | // from its old room and links it into the new room |
| 772 | void VisEffectRelinkcxx . . $ VisEffectRelink(3e454b8ccf442868).(int visnum, int newroomnum) { |
| 773 | ASSERTcxx . . $ `misc/pserror.h:246:9`!(visnum >= 0 && visnum < max_vis_effects); |
| 774 | |
| 775 | VisEffectUnlinkcxx . . $ VisEffectUnlink(d4f767463ce0a6b3).(visnum); |
| 776 | VisEffectLinkcxx . . $ VisEffectLink(3e454b8ccf442868).(visnum, newroomnum); |
| 777 | } |
| 778 | |
| 779 | // Kills all the effects that are dead |
| 780 | void VisEffectDeleteDeadcxx . . $ VisEffectDeleteDead(49f6e7a06ebc5aa8).() { |
| 781 | int i; |
| 782 | for (i = 0; i < NumVisDeadcxx . . $ NumVisDead.; i++) { |
| 783 | VisEffectDeletecxx . . $ VisEffectDelete(d4f767463ce0a6b3).(VisDeadListcxx . . $ VisDeadList.[i]); |
| 784 | } |
| 785 | |
| 786 | NumVisDeadcxx . . $ NumVisDead. = 0; |
| 787 | } |
| 788 | |
| 789 | // remove viseffect from the world |
| 790 | void VisEffectDeletecxx . . $ VisEffectDelete(d4f767463ce0a6b3).(int visnum) { |
| 791 | vis_effectcxx . . $ vis_effect# *vis = &VisEffectscxx . . $ VisEffects.[visnum]; |
| 792 | |
| 793 | ASSERTcxx . . $ `misc/pserror.h:246:9`!(visnum != -1); |
| 794 | ASSERTcxx . . $ `misc/pserror.h:246:9`!(vis->type != VIS_NONEcxx . . $ `Descent3/viseffect_external.h:60:9`!); |
| 795 | |
| 796 | VisEffectUnlinkcxx . . $ VisEffectUnlink(d4f767463ce0a6b3).(visnum); |
| 797 | |
| 798 | vis->typecxx . . $ vis_effect#type. = VIS_NONEcxx . . $ `Descent3/viseffect_external.h:60:9`!; // unused! |
| 799 | vis->roomnumcxx . . $ vis_effect#roomnum. = -1; // zero it! |
| 800 | |
| 801 | VisEffectFreecxx . . $ VisEffectFree(7864480464b09eea).(visnum); |
| 802 | } |
| 803 | |
| 804 | // Frees all the objects that are currently in use |
| 805 | void FreeAllVisEffectscxx . . $ FreeAllVisEffects(49f6e7a06ebc5aa8).() { |
| 806 | |
| 807 | for (int i = 0; i < max_vis_effectscxx . . $ max_vis_effects.; i++) |
| 808 | if (VisEffectscxx . . $ VisEffects.[i].typecxx . . $ vis_effect#type. != VIS_NONEcxx . . $ `Descent3/viseffect_external.h:60:9`!) |
| 809 | VisEffectDeletecxx . . $ VisEffectDelete(d4f767463ce0a6b3).(i); |
| 810 | } |
| 811 | |
| 812 | // Creates a some sparks that go in random directions |
| 813 | void CreateRandomLineSparkscxx . . $ CreateRandomLineSparks(79b173f5af69382).(int num_sparks, vectorcxx . . $ vector# *pos, int roomnum, uint16_tcxx . . $ uint16_t# color, float force_scalar) { |
| 814 | // Make more sparks if Katmai |
| 815 | if (Katmaicxx . . $ Katmai.) |
| 816 | num_sparks *= 2; |
| 817 | |
| 818 | // Create some sparks |
| 819 | for (int i = 0; i < num_sparks; i++) { |
| 820 | int visnum = VisEffectCreatecxx . . $ VisEffectCreate(20e4831b18f6895c).(VIS_FIREBALLcxx . . $ `Descent3/viseffect_external.h:61:9`!, FADING_LINE_INDEXcxx . . $ `Descent3/fireball_external.h:41:9`!, roomnum, pos); |
| 821 | if (visnum >= 0) { |
| 822 | vis_effectcxx . . $ vis_effect# *vis = &VisEffectscxx . . $ VisEffects.[visnum]; |
| 823 | |
| 824 | vis->movement_typecxx . . $ vis_effect#movement_type. = MT_PHYSICScxx . . $ `Descent3/object_external.h:234:9`!; |
| 825 | vis->masscxx . . $ vis_effect#mass. = 500; |
| 826 | vis->dragcxx . . $ vis_effect#drag. = .001f; |
| 827 | vis->phys_flagscxx . . $ vis_effect#phys_flags. |= PF_GRAVITYcxx . . $ `Descent3/object_external.h:320:9`! | PF_NO_COLLIDEcxx . . $ `Descent3/object_external.h:331:9`!; |
| 828 | |
| 829 | vis->velocitycxx . . $ vis_effect#velocity..xcxx . . $ vector#x. = (ps_randcxx . . $ ps_rand(b126dc7c1de90089).() % 100) - 50; |
| 830 | vis->velocitycxx . . $ vis_effect#velocity..ycxx . . $ vector#y. = (ps_randcxx . . $ ps_rand(b126dc7c1de90089).() % 100); |
| 831 | vis->velocitycxx . . $ vis_effect#velocity..zcxx . . $ vector#z. = (ps_randcxx . . $ ps_rand(b126dc7c1de90089).() % 100) - 50; |
| 832 | |
| 833 | vm_NormalizeVectorFastcxx . . $ vm_NormalizeVectorFast(4939a7e530383cd4).(&vis->velocitycxx . . $ vis_effect#velocity.); |
| 834 | |
| 835 | vis->velocitycxx . . $ vis_effect#velocity. *=cxx . . $ `operator*=`(f132838b2cd11d6). 20 + (ps_randcxx . . $ ps_rand(b126dc7c1de90089).() % 10); |
| 836 | vis->velocitycxx . . $ vis_effect#velocity. *=cxx . . $ `operator*=`(f132838b2cd11d6). force_scalar; |
| 837 | vis->sizecxx . . $ vis_effect#size. = .7 + ((ps_randcxx . . $ ps_rand(b126dc7c1de90089).() % 10) * .04); |
| 838 | vis->flagscxx . . $ vis_effect#flags. |= VF_USES_LIFELEFTcxx . . $ `Descent3/viseffect_external.h:64:9`!; |
| 839 | float lifetime = 1 + ((ps_randcxx . . $ ps_rand(b126dc7c1de90089).() % 10) * .15); |
| 840 | vis->lifeleftcxx . . $ vis_effect#lifeleft. = lifetime; |
| 841 | vis->lifetimecxx . . $ vis_effect#lifetime. = lifetime; |
| 842 | |
| 843 | if (color == 0) |
| 844 | vis->lighting_colorcxx . . $ vis_effect#lighting_color. = GR_RGB16cxx . . $ GR_RGB16(6461fafb79bad5b9).(200 + (ps_randcxx . . $ ps_rand(b126dc7c1de90089).() % 50), 150 + (ps_randcxx . . $ ps_rand(b126dc7c1de90089).() % 50), ps_randcxx . . $ ps_rand(b126dc7c1de90089).() % 50); |
| 845 | else |
| 846 | vis->lighting_colorcxx . . $ vis_effect#lighting_color. = color; |
| 847 | } |
| 848 | } |
| 849 | } |
| 850 | |
| 851 | // Creates a some sparks that go in random directions |
| 852 | void CreateRandomSparkscxx . . $ CreateRandomSparks(3e6b82e54d72ee3b).(int num_sparks, vectorcxx . . $ vector# *pos, int roomnum, int which_index, float force_scalar) { |
| 853 | // Make more sparks if Katmai |
| 854 | if (Katmaicxx . . $ Katmai.) |
| 855 | num_sparks *= 2; |
| 856 | |
| 857 | // Create some sparks |
| 858 | for (int i = 0; i < num_sparks; i++) { |
| 859 | int sparknum; |
| 860 | int index; |
| 861 | |
| 862 | if (ps_randcxx . . $ ps_rand(b126dc7c1de90089).() % 2) |
| 863 | index = HOT_SPARK_INDEXcxx . . $ `Descent3/fireball_external.h:37:9`!; |
| 864 | else |
| 865 | index = COOL_SPARK_INDEXcxx . . $ `Descent3/fireball_external.h:38:9`!; |
| 866 | |
| 867 | if (which_index != -1) |
| 868 | index = which_index; |
| 869 | |
| 870 | sparknum = VisEffectCreatecxx . . $ VisEffectCreate(20e4831b18f6895c).(VIS_FIREBALLcxx . . $ `Descent3/viseffect_external.h:61:9`!, index, roomnum, pos); |
| 871 | |
| 872 | if (sparknum >= 0) { |
| 873 | vis_effectcxx . . $ vis_effect# *vis = &VisEffectscxx . . $ VisEffects.[sparknum]; |
| 874 | |
| 875 | vis->movement_typecxx . . $ vis_effect#movement_type. = MT_PHYSICScxx . . $ `Descent3/object_external.h:234:9`!; |
| 876 | vis->masscxx . . $ vis_effect#mass. = 100; |
| 877 | vis->dragcxx . . $ vis_effect#drag. = .1f; |
| 878 | |
| 879 | vis->phys_flagscxx . . $ vis_effect#phys_flags. |= PF_GRAVITYcxx . . $ `Descent3/object_external.h:320:9`! | PF_NO_COLLIDEcxx . . $ `Descent3/object_external.h:331:9`!; |
| 880 | |
| 881 | vis->velocitycxx . . $ vis_effect#velocity..xcxx . . $ vector#x. = (ps_randcxx . . $ ps_rand(b126dc7c1de90089).() % 100) - 50; |
| 882 | vis->velocitycxx . . $ vis_effect#velocity..ycxx . . $ vector#y. = (ps_randcxx . . $ ps_rand(b126dc7c1de90089).() % 100); |
| 883 | vis->velocitycxx . . $ vis_effect#velocity..zcxx . . $ vector#z. = (ps_randcxx . . $ ps_rand(b126dc7c1de90089).() % 100) - 50; |
| 884 | |
| 885 | vm_NormalizeVectorFastcxx . . $ vm_NormalizeVectorFast(4939a7e530383cd4).(&vis->velocitycxx . . $ vis_effect#velocity.); |
| 886 | vis->velocitycxx . . $ vis_effect#velocity. *=cxx . . $ `operator*=`(f132838b2cd11d6). 10 + (ps_randcxx . . $ ps_rand(b126dc7c1de90089).() % 10); |
| 887 | vis->velocitycxx . . $ vis_effect#velocity. *=cxx . . $ `operator*=`(f132838b2cd11d6). force_scalar; |
| 888 | vis->sizecxx . . $ vis_effect#size. = .2 + ((ps_randcxx . . $ ps_rand(b126dc7c1de90089).() % 10) * .01); |
| 889 | vis->flagscxx . . $ vis_effect#flags. |= VF_USES_LIFELEFTcxx . . $ `Descent3/viseffect_external.h:64:9`!; |
| 890 | float lifetime = 1 + ((ps_randcxx . . $ ps_rand(b126dc7c1de90089).() % 10) * .15); |
| 891 | vis->lifeleftcxx . . $ vis_effect#lifeleft. = lifetime; |
| 892 | vis->lifetimecxx . . $ vis_effect#lifetime. = lifetime; |
| 893 | } |
| 894 | } |
| 895 | } |
| 896 | |
| 897 | // Creates a some particles that go in random directions |
| 898 | void CreateRandomParticlescxx . . $ CreateRandomParticles(7b2877c745efbbf9).(int num_sparks, vectorcxx . . $ vector# *pos, int roomnum, int bm_handle, float size, float life) { |
| 899 | // Create some sparks |
| 900 | float tenth_life = life / 10.0; |
| 901 | float tenth_size = size / 10.0; |
| 902 | |
| 903 | for (int i = 0; i < num_sparks; i++) { |
| 904 | int sparknum; |
| 905 | |
| 906 | sparknum = VisEffectCreatecxx . . $ VisEffectCreate(20e4831b18f6895c).(VIS_FIREBALLcxx . . $ `Descent3/viseffect_external.h:61:9`!, PARTICLE_INDEXcxx . . $ `Descent3/fireball_external.h:45:9`!, roomnum, pos); |
| 907 | |
| 908 | if (sparknum >= 0) { |
| 909 | vis_effectcxx . . $ vis_effect# *vis = &VisEffectscxx . . $ VisEffects.[sparknum]; |
| 910 | |
| 911 | vis->movement_typecxx . . $ vis_effect#movement_type. = MT_PHYSICScxx . . $ `Descent3/object_external.h:234:9`!; |
| 912 | vis->masscxx . . $ vis_effect#mass. = 100; |
| 913 | vis->dragcxx . . $ vis_effect#drag. = .1f; |
| 914 | |
| 915 | vis->phys_flagscxx . . $ vis_effect#phys_flags. |= PF_GRAVITYcxx . . $ `Descent3/object_external.h:320:9`! | PF_NO_COLLIDEcxx . . $ `Descent3/object_external.h:331:9`!; |
| 916 | |
| 917 | vis->velocitycxx . . $ vis_effect#velocity..xcxx . . $ vector#x. = (ps_randcxx . . $ ps_rand(b126dc7c1de90089).() % 100) - 50; |
| 918 | vis->velocitycxx . . $ vis_effect#velocity..ycxx . . $ vector#y. = (ps_randcxx . . $ ps_rand(b126dc7c1de90089).() % 100); |
| 919 | vis->velocitycxx . . $ vis_effect#velocity..zcxx . . $ vector#z. = (ps_randcxx . . $ ps_rand(b126dc7c1de90089).() % 100) - 50; |
| 920 | |
| 921 | vm_NormalizeVectorFastcxx . . $ vm_NormalizeVectorFast(4939a7e530383cd4).(&vis->velocitycxx . . $ vis_effect#velocity.); |
| 922 | vis->velocitycxx . . $ vis_effect#velocity. *=cxx . . $ `operator*=`(f132838b2cd11d6). 10 + (ps_randcxx . . $ ps_rand(b126dc7c1de90089).() % 10); |
| 923 | vis->sizecxx . . $ vis_effect#size. = size + (((ps_randcxx . . $ ps_rand(b126dc7c1de90089).() % 11) - 5) * tenth_size); |
| 924 | vis->flagscxx . . $ vis_effect#flags. |= VF_USES_LIFELEFTcxx . . $ `Descent3/viseffect_external.h:64:9`!; |
| 925 | float lifetime = life + (((ps_randcxx . . $ ps_rand(b126dc7c1de90089).() % 11) - 5) * tenth_life); |
| 926 | vis->lifeleftcxx . . $ vis_effect#lifeleft. = lifetime; |
| 927 | vis->lifetimecxx . . $ vis_effect#lifetime. = lifetime; |
| 928 | vis->custom_handlecxx . . $ vis_effect#custom_handle. = bm_handle; |
| 929 | } |
| 930 | } |
| 931 | } |
| 932 | |
| 933 | // Draws a weapons fading line |
| 934 | void DrawVisFadingLinecxx . . $ DrawVisFadingLine(6089e83781d51a35).(vis_effectcxx . . $ vis_effect# *vis) { |
| 935 | float norm_time; |
| 936 | float time_live = Gametimecxx . . $ Gametime. - vis->creation_timecxx . . $ vis_effect#creation_time.; |
| 937 | float size = vis->sizecxx . . $ vis_effect#size.; |
| 938 | |
| 939 | int visnum = vis - VisEffectscxx . . $ VisEffects.; |
| 940 | norm_time = time_live / vis->lifetimecxx . . $ vis_effect#lifetime.; |
| 941 | |
| 942 | if (norm_time >= 1) |
| 943 | norm_time = .99999f; // don't go over! |
| 944 | |
| 945 | rend_SetAlphaTypecxx . . $ rend_SetAlphaType(4af4fd0e2b26c4ac).(AT_SATURATE_VERTEXcxx . . $ `lib/renderer.h:411:9`!); |
| 946 | rend_SetTextureTypecxx . . $ rend_SetTextureType(cccd9781d96f97ff).(TT_FLATcxx . . $ TT_FLAT.); |
| 947 | rend_SetLightingcxx . . $ rend_SetLighting(e55526c9d3dd1656).(LS_GOURAUDcxx . . $ LS_GOURAUD.); |
| 948 | rend_SetColorModelcxx . . $ rend_SetColorModel(e3c5062d5af601c7).(CM_RGBcxx . . $ CM_RGB.); |
| 949 | rend_SetOverlayTypecxx . . $ rend_SetOverlayType(ac50b47256ae7414).(OT_NONEcxx . . $ `lib/renderer.h:333:9`!); |
| 950 | |
| 951 | vectorcxx . . $ vector# vecs[2]; |
| 952 | g3Pointcxx . . $ g3Point# pnts[2]; |
| 953 | int i; |
| 954 | |
| 955 | vecs[0] =cxx . . $ vector#`operator=`(a48bc7e93a8dae5e). vis->poscxx . . $ vis_effect#pos.; |
| 956 | vecs[1] =cxx . . $ vector#`operator=`(a48bc7e93a8dae5e). vis->end_poscxx . . $ vis_effect#end_pos.; |
| 957 | |
| 958 | if (!(vis->flagscxx . . $ vis_effect#flags. & VF_WINDSHIELD_EFFECTcxx . . $ `Descent3/viseffect_external.h:65:9`!)) // bash end position |
| 959 | { |
| 960 | vectorcxx . . $ vector# vel = -cxx . . $ operator-(9e07539e219c6f20).vis->velocitycxx . . $ vis_effect#velocity.; |
| 961 | vm_NormalizeVectorFastcxx . . $ vm_NormalizeVectorFast(4939a7e530383cd4).(&vel); |
| 962 | vecs[1] =cxx . . $ vector#`operator=`(c0842353a20857d). vis->poscxx . . $ vis_effect#pos. +cxx . . $ operator+(b77b703cd1e43e33). (vel *cxx . . $ `operator*`(252247219a31502c). vis->sizecxx . . $ vis_effect#size.); |
| 963 | } |
| 964 | |
| 965 | ddgr_colorcxx . . $ ddgr_color# color = GR_16_TO_COLORcxx . . $ GR_16_TO_COLOR(909d59720f161188).(vis->lighting_colorcxx . . $ vis_effect#lighting_color.); |
| 966 | int r = GR_COLOR_REDcxx . . $ GR_COLOR_RED(4c679297bf94b9eb).(color); |
| 967 | int g = GR_COLOR_GREENcxx . . $ GR_COLOR_GREEN(4c679297bf94b9eb).(color); |
| 968 | int b = GR_COLOR_BLUEcxx . . $ GR_COLOR_BLUE(4c679297bf94b9eb).(color); |
| 969 | |
| 970 | for (i = 0; i < 2; i++) { |
| 971 | g3_RotatePointcxx . . $ g3_RotatePoint(fd2e8930c920e2b9).(&pnts[i], &vecs[i]); |
| 972 | pnts[i].p3_flagscxx . . $ g3Point#p3_flags. |= PF_RGBAcxx . . $ `lib/3d.h:219:9`!; |
| 973 | pnts[i].p3_rcxx . . $ `lib/3d.h:253:9`! = (r / 255.0); |
| 974 | pnts[i].p3_gcxx . . $ `lib/3d.h:254:9`! = (g / 255.0); |
| 975 | ; |
| 976 | pnts[i].p3_bcxx . . $ `lib/3d.h:255:9`! = (b / 255.0); |
| 977 | ; |
| 978 | } |
| 979 | |
| 980 | if (vis->flagscxx . . $ vis_effect#flags. & VF_WINDSHIELD_EFFECTcxx . . $ `Descent3/viseffect_external.h:65:9`!) |
| 981 | pnts[0].p3_acxx . . $ `lib/3d.h:256:9`! = .3f; |
| 982 | else |
| 983 | pnts[0].p3_acxx . . $ `lib/3d.h:256:9`! = 1.0 - norm_time; |
| 984 | |
| 985 | pnts[1].p3_acxx . . $ `lib/3d.h:256:9`! = 0.0; |
| 986 | |
| 987 | g3_DrawSpecialLinecxx . . $ g3_DrawSpecialLine(1b637e6b3e24914d).(&pnts[0], &pnts[1]); |
| 988 | } |
| 989 | |
| 990 | // Draws a blast ring vis effect |
| 991 | void DrawVisBlastRingcxx . . $ DrawVisBlastRing(6089e83781d51a35).(vis_effectcxx . . $ vis_effect# *vis) { |
| 992 | vectorcxx . . $ vector# inner_vecs[30], outer_vecs[30]; |
| 993 | g3Pointcxx . . $ g3Point# inner_points[30], outer_points[30]; |
| 994 | float lifenorm = (vis->lifetimecxx . . $ vis_effect#lifetime. - vis->lifeleftcxx . . $ vis_effect#lifeleft.) / vis->lifetimecxx . . $ vis_effect#lifetime.; |
| 995 | float cur_size = lifenorm * vis->sizecxx . . $ vis_effect#size.; |
| 996 | int i; |
| 997 | g3Pointcxx . . $ g3Point# *pntlist[4]; |
| 998 | matrixcxx . . $ matrix# orient; |
| 999 | vectorcxx . . $ vector# fvec; |
| 1000 | |
| 1001 | if (vis->flagscxx . . $ vis_effect#flags. & VF_REVERSEcxx . . $ `Descent3/viseffect_external.h:68:9`!) { |
| 1002 | lifenorm = 1 - lifenorm; |
| 1003 | cur_size = lifenorm * vis->sizecxx . . $ vis_effect#size.; |
| 1004 | } |
| 1005 | |
| 1006 | if (vis->flagscxx . . $ vis_effect#flags. & VF_PLANARcxx . . $ `Descent3/viseffect_external.h:67:9`!) |
| 1007 | fvec =cxx . . $ vector#`operator=`(a48bc7e93a8dae5e). vis->end_poscxx . . $ vis_effect#end_pos.; |
| 1008 | else { |
| 1009 | fvec =cxx . . $ vector#`operator=`(c0842353a20857d). Viewer_objectcxx . . $ Viewer_object.->poscxx . . $ object#pos. -cxx . . $ operator-(b77b703cd1e43e33). vis->poscxx . . $ vis_effect#pos.; |
| 1010 | vm_NormalizeVectorFastcxx . . $ vm_NormalizeVectorFast(4939a7e530383cd4).(&fvec); |
| 1011 | } |
| 1012 | |
| 1013 | if (vm_GetMagnitudeFastcxx . . $ vm_GetMagnitudeFast(4939a7e530383cd4).(&fvec) < .5) |
| 1014 | return; |
| 1015 | vm_VectorToMatrixcxx . . $ vm_VectorToMatrix(543233b88555916d).(&orient, &fvec, NULLcxx . . $ `<external>/15298297234472979974/stddef.h:416:9`!, NULLcxx . . $ `<external>/15298297234472979974/stddef.h:416:9`!); |
| 1016 | |
| 1017 | int num_segments = 20; |
| 1018 | |
| 1019 | int ring_increment = 65536 / num_segments; |
| 1020 | int ring_angle = 0; |
| 1021 | |
| 1022 | if (lifenorm > 1.0) |
| 1023 | lifenorm = 1.0; |
| 1024 | |
| 1025 | rend_SetAlphaTypecxx . . $ rend_SetAlphaType(4af4fd0e2b26c4ac).(AT_SATURATE_TEXTURE_VERTEXcxx . . $ `lib/renderer.h:413:9`!); |
| 1026 | rend_SetOverlayTypecxx . . $ rend_SetOverlayType(ac50b47256ae7414).(OT_NONEcxx . . $ `lib/renderer.h:333:9`!); |
| 1027 | rend_SetTextureTypecxx . . $ rend_SetTextureType(cccd9781d96f97ff).(TT_LINEARcxx . . $ TT_LINEAR.); |
| 1028 | rend_SetLightingcxx . . $ rend_SetLighting(e55526c9d3dd1656).(LS_NONEcxx . . $ LS_NONE.); |
| 1029 | rend_SetZBiascxx . . $ rend_SetZBias(9364e6e7bff7660).(-1.0); |
| 1030 | rend_SetZBufferWriteMaskcxx . . $ rend_SetZBufferWriteMask(d4f767463ce0a6b3).(0); |
| 1031 | |
| 1032 | ring_angle = 0; |
| 1033 | |
| 1034 | for (i = 0; i < num_segments; i++, ring_angle += ring_increment) { |
| 1035 | float ring_sin = FixSincxx . . $ FixSin(9a38df040a81ca35).(ring_angle); |
| 1036 | float ring_cos = FixCoscxx . . $ FixCos(9a38df040a81ca35).(ring_angle); |
| 1037 | |
| 1038 | inner_vecs[i] =cxx . . $ vector#`operator=`(c0842353a20857d). orient.rveccxx . . $ matrix#rvec. *cxx . . $ `operator*`(252247219a31502c). (ring_cos * (cur_size / 2)); |
| 1039 | inner_vecs[i] +=cxx . . $ `operator+=`(801a8d6f7ab7bef9). orient.uveccxx . . $ matrix#uvec. *cxx . . $ `operator*`(252247219a31502c). (ring_sin * (cur_size / 2)); |
| 1040 | inner_vecs[i] +=cxx . . $ `operator+=`(801a8d6f7ab7bef9). vis->poscxx . . $ vis_effect#pos.; |
| 1041 | |
| 1042 | outer_vecs[i] =cxx . . $ vector#`operator=`(c0842353a20857d). orient.rveccxx . . $ matrix#rvec. *cxx . . $ `operator*`(252247219a31502c). (ring_cos * cur_size); |
| 1043 | outer_vecs[i] +=cxx . . $ `operator+=`(801a8d6f7ab7bef9). orient.uveccxx . . $ matrix#uvec. *cxx . . $ `operator*`(252247219a31502c). (ring_sin * cur_size); |
| 1044 | outer_vecs[i] +=cxx . . $ `operator+=`(801a8d6f7ab7bef9). vis->poscxx . . $ vis_effect#pos.; |
| 1045 | |
| 1046 | g3_RotatePointcxx . . $ g3_RotatePoint(fd2e8930c920e2b9).(&inner_points[i], &inner_vecs[i]); |
| 1047 | g3_RotatePointcxx . . $ g3_RotatePoint(fd2e8930c920e2b9).(&outer_points[i], &outer_vecs[i]); |
| 1048 | outer_points[i].p3_flagscxx . . $ g3Point#p3_flags. |= PF_UVcxx . . $ `lib/3d.h:217:9`! | PF_RGBAcxx . . $ `lib/3d.h:219:9`!; |
| 1049 | inner_points[i].p3_flagscxx . . $ g3Point#p3_flags. |= PF_UVcxx . . $ `lib/3d.h:217:9`! | PF_RGBAcxx . . $ `lib/3d.h:219:9`!; |
| 1050 | |
| 1051 | outer_points[i].p3_acxx . . $ `lib/3d.h:256:9`! = (1.0 - lifenorm); |
| 1052 | inner_points[i].p3_acxx . . $ `lib/3d.h:256:9`! = 0; |
| 1053 | inner_points[i].p3_lcxx . . $ `lib/3d.h:252:9`! = 1; |
| 1054 | inner_points[i].p3_lcxx . . $ `lib/3d.h:252:9`! = 1; |
| 1055 | } |
| 1056 | |
| 1057 | for (i = 0; i < num_segments; i++) { |
| 1058 | int next = (i + 1) % num_segments; |
| 1059 | |
| 1060 | outer_points[i].p3_ucxx . . $ `lib/3d.h:250:9`! = 0 + lifenorm; |
| 1061 | outer_points[next].p3_ucxx . . $ `lib/3d.h:250:9`! = 1.0 + lifenorm; |
| 1062 | outer_points[i].p3_vcxx . . $ `lib/3d.h:251:9`! = 0; |
| 1063 | outer_points[next].p3_vcxx . . $ `lib/3d.h:251:9`! = 0; |
| 1064 | |
| 1065 | inner_points[i].p3_ucxx . . $ `lib/3d.h:250:9`! = 0 + lifenorm; |
| 1066 | inner_points[next].p3_ucxx . . $ `lib/3d.h:250:9`! = 1.0 + lifenorm; |
| 1067 | inner_points[i].p3_vcxx . . $ `lib/3d.h:251:9`! = 1; |
| 1068 | inner_points[next].p3_vcxx . . $ `lib/3d.h:251:9`! = 1; |
| 1069 | |
| 1070 | pntlist[0] = &outer_points[i]; |
| 1071 | pntlist[1] = &outer_points[next]; |
| 1072 | pntlist[2] = &inner_points[next]; |
| 1073 | pntlist[3] = &inner_points[i]; |
| 1074 | |
| 1075 | g3_DrawPolycxx . . $ g3_DrawPoly(eaf0a58e8bd7fbdc).(4, pntlist, vis->custom_handlecxx . . $ vis_effect#custom_handle.); |
| 1076 | } |
| 1077 | |
| 1078 | rend_SetZBufferWriteMaskcxx . . $ rend_SetZBufferWriteMask(d4f767463ce0a6b3).(1); |
| 1079 | rend_SetZBiascxx . . $ rend_SetZBias(9364e6e7bff7660).(0); |
| 1080 | } |
| 1081 | |
| 1082 | // Draws a raindrop on the players windshield |
| 1083 | void DrawVisRainDropcxx . . $ DrawVisRainDrop(6089e83781d51a35).(vis_effectcxx . . $ vis_effect# *vis) { |
| 1084 | float norm_time; |
| 1085 | float time_live = Gametimecxx . . $ Gametime. - vis->creation_timecxx . . $ vis_effect#creation_time.; |
| 1086 | float size = vis->sizecxx . . $ vis_effect#size.; |
| 1087 | |
| 1088 | int visnum = vis - VisEffectscxx . . $ VisEffects.; |
| 1089 | int bm_handle; |
| 1090 | fireballcxx . . $ fireball# *fb = &Fireballscxx . . $ Fireballs.[vis->idcxx . . $ vis_effect#id.]; |
| 1091 | |
| 1092 | norm_time = time_live / vis->lifetimecxx . . $ vis_effect#lifetime.; |
| 1093 | |
| 1094 | if (norm_time >= 1) |
| 1095 | norm_time = .99999f; // don't go over! |
| 1096 | |
| 1097 | size *= (1 - (norm_time / 2)); |
| 1098 | |
| 1099 | bm_handle = fb->bm_handlecxx . . $ fireball#bm_handle.; |
| 1100 | |
| 1101 | float val; |
| 1102 | if (norm_time > .5) |
| 1103 | val = 1.0 - ((norm_time - .5) / .5); |
| 1104 | else if (norm_time < .1) |
| 1105 | val = norm_time / .1; |
| 1106 | else |
| 1107 | val = 1.0; |
| 1108 | |
| 1109 | rend_SetAlphaValuecxx . . $ rend_SetAlphaValue(ac50b47256ae7414).(val * .4 * 255); |
| 1110 | rend_SetOverlayTypecxx . . $ rend_SetOverlayType(ac50b47256ae7414).(OT_NONEcxx . . $ `lib/renderer.h:333:9`!); |
| 1111 | rend_SetWrapTypecxx . . $ rend_SetWrapType(da524b148887c0e7).(WT_CLAMPcxx . . $ WT_CLAMP.); |
| 1112 | rend_SetLightingcxx . . $ rend_SetLighting(e55526c9d3dd1656).(LS_NONEcxx . . $ LS_NONE.); |
| 1113 | |
| 1114 | // Set position |
| 1115 | vectorcxx . . $ vector# pos; |
| 1116 | |
| 1117 | if (vis->idcxx . . $ vis_effect#id. == RAINDROP_INDEXcxx . . $ `Descent3/fireball_external.h:50:9`!) { |
| 1118 | rend_SetZBufferStatecxx . . $ rend_SetZBufferState(4af4fd0e2b26c4ac).(0); |
| 1119 | rend_SetAlphaTypecxx . . $ rend_SetAlphaType(4af4fd0e2b26c4ac).(AT_SATURATE_TEXTUREcxx . . $ `lib/renderer.h:408:9`!); |
| 1120 | rend_SetAlphaValuecxx . . $ rend_SetAlphaValue(ac50b47256ae7414).(val * .4 * 255); |
| 1121 | |
| 1122 | pos =cxx . . $ vector#`operator=`(a48bc7e93a8dae5e). Viewer_objectcxx . . $ Viewer_object.->poscxx . . $ object#pos.; |
| 1123 | pos +=cxx . . $ `operator+=`(801a8d6f7ab7bef9). Viewer_objectcxx . . $ Viewer_object.->orientcxx . . $ object#orient..rveccxx . . $ matrix#rvec. *cxx . . $ `operator*`(252247219a31502c). vis->poscxx . . $ vis_effect#pos..xcxx . . $ vector#x.; |
| 1124 | pos +=cxx . . $ `operator+=`(801a8d6f7ab7bef9). Viewer_objectcxx . . $ Viewer_object.->orientcxx . . $ object#orient..uveccxx . . $ matrix#uvec. *cxx . . $ `operator*`(252247219a31502c). vis->poscxx . . $ vis_effect#pos..ycxx . . $ vector#y.; |
| 1125 | pos +=cxx . . $ `operator+=`(801a8d6f7ab7bef9). Viewer_objectcxx . . $ Viewer_object.->orientcxx . . $ object#orient..fveccxx . . $ matrix#fvec. *cxx . . $ `operator*`(252247219a31502c). vis->poscxx . . $ vis_effect#pos..zcxx . . $ vector#z.; |
| 1126 | g3_DrawRotatedBitmapcxx . . $ g3_DrawRotatedBitmap(b3c51db2a67f6227).(&pos, 0, size, (size * bm_hcxx . . $ bm_h(9b79fb6aee4c0440).(bm_handle, 0)) / bm_wcxx . . $ bm_w(9b79fb6aee4c0440).(bm_handle, 0), bm_handle); |
| 1127 | rend_SetZBufferStatecxx . . $ rend_SetZBufferState(4af4fd0e2b26c4ac).(1); |
| 1128 | } else { |
| 1129 | rend_SetAlphaTypecxx . . $ rend_SetAlphaType(4af4fd0e2b26c4ac).(AT_SATURATE_TEXTUREcxx . . $ `lib/renderer.h:408:9`!); |
| 1130 | rend_SetAlphaValuecxx . . $ rend_SetAlphaValue(ac50b47256ae7414).(val * .2 * 255); |
| 1131 | rend_SetZBufferWriteMaskcxx . . $ rend_SetZBufferWriteMask(d4f767463ce0a6b3).(0); |
| 1132 | pos =cxx . . $ vector#`operator=`(a48bc7e93a8dae5e). vis->poscxx . . $ vis_effect#pos.; |
| 1133 | ASSERTcxx . . $ `misc/pserror.h:246:9`!(!((vis->end_pos.x == 0.0) && (vis->end_pos.y == 0.0) && (vis->end_pos.z == 0.0))); |
| 1134 | g3_DrawPlanarRotatedBitmapcxx . . $ g3_DrawPlanarRotatedBitmap(71c6e0d12bc5318b).(&pos, &vis->end_poscxx . . $ vis_effect#end_pos., 0, size, (size * bm_hcxx . . $ bm_h(9b79fb6aee4c0440).(bm_handle, 0)) / bm_wcxx . . $ bm_w(9b79fb6aee4c0440).(bm_handle, 0), |
| 1135 | bm_handle); |
| 1136 | rend_SetZBufferWriteMaskcxx . . $ rend_SetZBufferWriteMask(d4f767463ce0a6b3).(1); |
| 1137 | } |
| 1138 | |
| 1139 | rend_SetWrapTypecxx . . $ rend_SetWrapType(da524b148887c0e7).(WT_WRAPcxx . . $ WT_WRAP.); |
| 1140 | } |
| 1141 | |
| 1142 | // Draws a snowflake |
| 1143 | void DrawVisSnowflakecxx . . $ DrawVisSnowflake(6089e83781d51a35).(vis_effectcxx . . $ vis_effect# *vis) { |
| 1144 | float norm_time; |
| 1145 | float time_live = Gametimecxx . . $ Gametime. - vis->creation_timecxx . . $ vis_effect#creation_time.; |
| 1146 | float size = vis->sizecxx . . $ vis_effect#size.; |
| 1147 | |
| 1148 | int visnum = vis - VisEffectscxx . . $ VisEffects.; |
| 1149 | int bm_handle; |
| 1150 | fireballcxx . . $ fireball# *fb = &Fireballscxx . . $ Fireballs.[vis->idcxx . . $ vis_effect#id.]; |
| 1151 | |
| 1152 | norm_time = time_live / vis->lifetimecxx . . $ vis_effect#lifetime.; |
| 1153 | |
| 1154 | if (norm_time >= 1) |
| 1155 | norm_time = .99999f; // don't go over! |
| 1156 | |
| 1157 | // size*=(1-(norm_time/2)); |
| 1158 | |
| 1159 | bm_handle = fb->bm_handlecxx . . $ fireball#bm_handle.; |
| 1160 | |
| 1161 | float val; |
| 1162 | |
| 1163 | val = 1.0 - (norm_time); |
| 1164 | |
| 1165 | rend_SetAlphaValuecxx . . $ rend_SetAlphaValue(ac50b47256ae7414).(val * .6 * 255); |
| 1166 | rend_SetOverlayTypecxx . . $ rend_SetOverlayType(ac50b47256ae7414).(OT_NONEcxx . . $ `lib/renderer.h:333:9`!); |
| 1167 | // rend_SetWrapType (WT_CLAMP); |
| 1168 | rend_SetLightingcxx . . $ rend_SetLighting(e55526c9d3dd1656).(LS_NONEcxx . . $ LS_NONE.); |
| 1169 | // rend_SetZBufferState (0); |
| 1170 | rend_SetAlphaTypecxx . . $ rend_SetAlphaType(4af4fd0e2b26c4ac).(AT_SATURATE_TEXTUREcxx . . $ `lib/renderer.h:408:9`!); |
| 1171 | |
| 1172 | ddgr_colorcxx . . $ ddgr_color# color = GR_16_TO_COLORcxx . . $ GR_16_TO_COLOR(909d59720f161188).(vis->lighting_colorcxx . . $ vis_effect#lighting_color.); |
| 1173 | g3_DrawBitmapcxx . . $ g3_DrawBitmap(8d67c7afa700cf9).(&vis->poscxx . . $ vis_effect#pos., size, (size * bm_hcxx . . $ bm_h(9b79fb6aee4c0440).(bm_handle, 0)) / bm_wcxx . . $ bm_w(9b79fb6aee4c0440).(bm_handle, 0), bm_handle, color); |
| 1174 | |
| 1175 | // rend_SetZBufferState (1); |
| 1176 | // rend_SetWrapType (WT_WRAP); |
| 1177 | } |
| 1178 | |
| 1179 | // Draws a lighting bolt from one area to another |
| 1180 | // Velocity.x is how much randomness goes into drawing |
| 1181 | // Velocity.y is the scalar that effects how many segments to draw |
| 1182 | void DrawVisLightningBoltcxx . . $ DrawVisLightningBolt(6089e83781d51a35).(vis_effectcxx . . $ vis_effect# *vis) { |
| 1183 | vectorcxx . . $ vector# line_norm; |
| 1184 | float line_mag; |
| 1185 | int num_segs; |
| 1186 | float lightning_mag; |
| 1187 | |
| 1188 | g3Pointcxx . . $ g3Point# pnt1, pnt2; |
| 1189 | |
| 1190 | line_norm =cxx . . $ vector#`operator=`(c0842353a20857d). vis->poscxx . . $ vis_effect#pos. -cxx . . $ operator-(b77b703cd1e43e33). vis->end_poscxx . . $ vis_effect#end_pos.; |
| 1191 | line_mag = vm_GetMagnitudeFastcxx . . $ vm_GetMagnitudeFast(4939a7e530383cd4).(&line_norm); |
| 1192 | |
| 1193 | line_norm /=cxx . . $ `operator/=`(f132838b2cd11d6). line_mag; |
| 1194 | |
| 1195 | if (line_mag < 1) |
| 1196 | return; |
| 1197 | |
| 1198 | float alpha_norm; |
| 1199 | |
| 1200 | if (vis->flagscxx . . $ vis_effect#flags. & VF_EXPANDcxx . . $ `Descent3/viseffect_external.h:69:9`!) { |
| 1201 | num_segs = line_mag * vis->velocitycxx . . $ vis_effect#velocity..ycxx . . $ vector#y.; |
| 1202 | lightning_mag = vis->velocitycxx . . $ vis_effect#velocity..xcxx . . $ vector#x.; |
| 1203 | |
| 1204 | alpha_norm = vis->lifeleftcxx . . $ vis_effect#lifeleft. / vis->lifetimecxx . . $ vis_effect#lifetime.; |
| 1205 | } else { |
| 1206 | num_segs = line_mag * vis->velocitycxx . . $ vis_effect#velocity..ycxx . . $ vector#y.; |
| 1207 | lightning_mag = vis->velocitycxx . . $ vis_effect#velocity..xcxx . . $ vector#x.; |
| 1208 | |
| 1209 | alpha_norm = .7f; |
| 1210 | |
| 1211 | // Make it powerup up based on distance |
| 1212 | if (line_mag > 30 && (vis->flagscxx . . $ vis_effect#flags. & VF_NO_Z_ADJUSTcxx . . $ `Descent3/viseffect_external.h:71:9`!)) { |
| 1213 | float scalar = 1.0 - ((line_mag - 30) / 150.0); |
| 1214 | if (scalar < 0) |
| 1215 | return; |
| 1216 | |
| 1217 | alpha_norm *= scalar; |
| 1218 | } |
| 1219 | } |
| 1220 | |
| 1221 | if (num_segs < 2) |
| 1222 | return; |
| 1223 | |
| 1224 | // Set some states |
| 1225 | |
| 1226 | rend_SetTextureTypecxx . . $ rend_SetTextureType(cccd9781d96f97ff).(TT_FLATcxx . . $ TT_FLAT.); |
| 1227 | rend_SetAlphaTypecxx . . $ rend_SetAlphaType(4af4fd0e2b26c4ac).(AT_SATURATE_VERTEXcxx . . $ `lib/renderer.h:411:9`!); |
| 1228 | rend_SetLightingcxx . . $ rend_SetLighting(e55526c9d3dd1656).(LS_NONEcxx . . $ LS_NONE.); |
| 1229 | rend_SetZBufferWriteMaskcxx . . $ rend_SetZBufferWriteMask(d4f767463ce0a6b3).(0); |
| 1230 | |
| 1231 | if (vis->idcxx . . $ vis_effect#id. == GRAY_LIGHTNING_BOLT_INDEXcxx . . $ `Descent3/fireball_external.h:73:9`!) { |
| 1232 | // get the color from the struct |
| 1233 | rend_SetFlatColorcxx . . $ rend_SetFlatColor(cb2f890c2fdad230).(GR_16_TO_COLORcxx . . $ GR_16_TO_COLOR(909d59720f161188).(vis->lighting_colorcxx . . $ vis_effect#lighting_color.)); |
| 1234 | } else { |
| 1235 | rend_SetFlatColorcxx . . $ rend_SetFlatColor(cb2f890c2fdad230).(GR_RGBcxx . . $ GR_RGB(530956271a9518a5).(10, 60, 200)); |
| 1236 | } |
| 1237 | |
| 1238 | pnt1.p3_acxx . . $ `lib/3d.h:256:9`! = alpha_norm; |
| 1239 | pnt2.p3_acxx . . $ `lib/3d.h:256:9`! = alpha_norm; |
| 1240 | |
| 1241 | vectorcxx . . $ vector# vecs[50]; |
| 1242 | |
| 1243 | num_segs = std::mincxx . . $ std/min(2a338fce5842aa6a).(num_segs, 50); |
| 1244 | |
| 1245 | CreateLightningRodPositionscxx . . $ CreateLightningRodPositions(c85cffa0e4e6c674).(&vis->poscxx . . $ vis_effect#pos., &vis->end_poscxx . . $ vis_effect#end_pos., vecs, num_segs, lightning_mag, false); |
| 1246 | |
| 1247 | for (int i = 0; i < num_segs - 1; i++) { |
| 1248 | g3_RotatePointcxx . . $ g3_RotatePoint(fd2e8930c920e2b9).(&pnt1, &vecs[i]); |
| 1249 | g3_RotatePointcxx . . $ g3_RotatePoint(fd2e8930c920e2b9).(&pnt2, &vecs[i + 1]); |
| 1250 | |
| 1251 | pnt1.p3_flagscxx . . $ g3Point#p3_flags. |= PF_RGBAcxx . . $ `lib/3d.h:219:9`!; |
| 1252 | pnt2.p3_flagscxx . . $ g3Point#p3_flags. |= PF_RGBAcxx . . $ `lib/3d.h:219:9`!; |
| 1253 | |
| 1254 | g3_DrawSpecialLinecxx . . $ g3_DrawSpecialLine(1b637e6b3e24914d).(&pnt1, &pnt2); |
| 1255 | } |
| 1256 | |
| 1257 | rend_SetZBufferWriteMaskcxx . . $ rend_SetZBufferWriteMask(d4f767463ce0a6b3).(1); |
| 1258 | } |
| 1259 | |
| 1260 | // Draws a lighting bolt sine wave from one area to another |
| 1261 | // Velocity.x represents how many increments to take (a scalar) |
| 1262 | // Velocity.y represents how "wide" the arcs are from the center of the line |
| 1263 | void DrawVisSineWavecxx . . $ DrawVisSineWave(6089e83781d51a35).(vis_effectcxx . . $ vis_effect# *vis) { |
| 1264 | vectorcxx . . $ vector# line_norm; |
| 1265 | float line_mag; |
| 1266 | matrixcxx . . $ matrix# mat; |
| 1267 | int num_segs; |
| 1268 | |
| 1269 | vectorcxx . . $ vector# from, to, base_from, rvec, uvec; |
| 1270 | g3Pointcxx . . $ g3Point# pnt1, pnt2; |
| 1271 | |
| 1272 | line_norm =cxx . . $ vector#`operator=`(c0842353a20857d). vis->poscxx . . $ vis_effect#pos. -cxx . . $ operator-(b77b703cd1e43e33). vis->end_poscxx . . $ vis_effect#end_pos.; |
| 1273 | line_mag = vm_GetMagnitudeFastcxx . . $ vm_GetMagnitudeFast(4939a7e530383cd4).(&line_norm); |
| 1274 | if (line_mag < .1) |
| 1275 | return; |
| 1276 | |
| 1277 | line_norm /=cxx . . $ `operator/=`(f132838b2cd11d6). line_mag; |
| 1278 | |
| 1279 | float alpha_norm; |
| 1280 | |
| 1281 | if (vis->flagscxx . . $ vis_effect#flags. & VF_EXPANDcxx . . $ `Descent3/viseffect_external.h:69:9`!) |
| 1282 | alpha_norm = vis->lifeleftcxx . . $ vis_effect#lifeleft. / vis->lifetimecxx . . $ vis_effect#lifetime.; |
| 1283 | |
| 1284 | num_segs = vis->velocitycxx . . $ vis_effect#velocity..xcxx . . $ vector#x. * line_mag; // /2 |
| 1285 | line_norm /=cxx . . $ `operator/=`(f132838b2cd11d6). vis->velocitycxx . . $ vis_effect#velocity..xcxx . . $ vector#x.; // *2 |
| 1286 | |
| 1287 | alpha_norm = vis->lifeleftcxx . . $ vis_effect#lifeleft. / vis->lifetimecxx . . $ vis_effect#lifetime.; |
| 1288 | |
| 1289 | vm_VectorToMatrixcxx . . $ vm_VectorToMatrix(543233b88555916d).(&mat, &line_norm, &vis->velocitycxx . . $ vis_effect#velocity., NULLcxx . . $ `<external>/15298297234472979974/stddef.h:416:9`!); |
| 1290 | rvec =cxx . . $ vector#`operator=`(c0842353a20857d). mat.rveccxx . . $ matrix#rvec. *cxx . . $ `operator*`(252247219a31502c). vis->velocitycxx . . $ vis_effect#velocity..ycxx . . $ vector#y.; // /4 |
| 1291 | uvec =cxx . . $ vector#`operator=`(c0842353a20857d). mat.uveccxx . . $ matrix#uvec. *cxx . . $ `operator*`(252247219a31502c). vis->velocitycxx . . $ vis_effect#velocity..ycxx . . $ vector#y.; // /4 |
| 1292 | |
| 1293 | // Set some states |
| 1294 | |
| 1295 | rend_SetTextureTypecxx . . $ rend_SetTextureType(cccd9781d96f97ff).(TT_FLATcxx . . $ TT_FLAT.); |
| 1296 | rend_SetAlphaTypecxx . . $ rend_SetAlphaType(4af4fd0e2b26c4ac).(AT_SATURATE_VERTEXcxx . . $ `lib/renderer.h:411:9`!); |
| 1297 | rend_SetLightingcxx . . $ rend_SetLighting(e55526c9d3dd1656).(LS_NONEcxx . . $ LS_NONE.); |
| 1298 | rend_SetZBufferWriteMaskcxx . . $ rend_SetZBufferWriteMask(d4f767463ce0a6b3).(0); |
| 1299 | rend_SetFlatColorcxx . . $ rend_SetFlatColor(cb2f890c2fdad230).(GR_RGBcxx . . $ GR_RGB(530956271a9518a5).(10, 60, 200)); |
| 1300 | int cur_sin = (vis - VisEffectscxx . . $ VisEffects.) * 5000; |
| 1301 | |
| 1302 | cur_sin += (FrameCountcxx . . $ FrameCount. * 2000); |
| 1303 | |
| 1304 | base_from =cxx . . $ vector#`operator=`(a48bc7e93a8dae5e). vis->end_poscxx . . $ vis_effect#end_pos.; |
| 1305 | from =cxx . . $ vector#`operator=`(a48bc7e93a8dae5e). base_from; |
| 1306 | |
| 1307 | pnt1.p3_acxx . . $ `lib/3d.h:256:9`! = alpha_norm; |
| 1308 | pnt2.p3_acxx . . $ `lib/3d.h:256:9`! = alpha_norm; |
| 1309 | |
| 1310 | for (int i = 0; i < num_segs; i++, base_from +=cxx . . $ `operator+=`(801a8d6f7ab7bef9). line_norm) { |
| 1311 | to =cxx . . $ vector#`operator=`(c0842353a20857d). base_from +cxx . . $ operator+(b77b703cd1e43e33). line_norm +cxx . . $ operator+(b77b703cd1e43e33). (FixSincxx . . $ FixSin(9a38df040a81ca35).((cur_sin) % 65536) *cxx . . $ `operator*`(9d6577ff3e9faa29). uvec); |
| 1312 | to +=cxx . . $ `operator+=`(801a8d6f7ab7bef9). (FixCoscxx . . $ FixCos(9a38df040a81ca35).((cur_sin) % 65536) *cxx . . $ `operator*`(9d6577ff3e9faa29). rvec); |
| 1313 | |
| 1314 | g3_RotatePointcxx . . $ g3_RotatePoint(fd2e8930c920e2b9).(&pnt1, &from); |
| 1315 | g3_RotatePointcxx . . $ g3_RotatePoint(fd2e8930c920e2b9).(&pnt2, &to); |
| 1316 | |
| 1317 | pnt1.p3_flagscxx . . $ g3Point#p3_flags. |= PF_RGBAcxx . . $ `lib/3d.h:219:9`!; |
| 1318 | pnt2.p3_flagscxx . . $ g3Point#p3_flags. |= PF_RGBAcxx . . $ `lib/3d.h:219:9`!; |
| 1319 | |
| 1320 | g3_DrawSpecialLinecxx . . $ g3_DrawSpecialLine(1b637e6b3e24914d).(&pnt1, &pnt2); |
| 1321 | |
| 1322 | from =cxx . . $ vector#`operator=`(a48bc7e93a8dae5e). to; |
| 1323 | |
| 1324 | cur_sin += 4000; |
| 1325 | } |
| 1326 | |
| 1327 | rend_SetZBufferWriteMaskcxx . . $ rend_SetZBufferWriteMask(d4f767463ce0a6b3).(1); |
| 1328 | } |
| 1329 | |
| 1330 | // Calculates the corners for a billboard |
| 1331 | // Returns 0 if off screen, or 1 if we should draw |
| 1332 | int GetBillboardCornerscxx . . $ GetBillboardCorners(262217bcda1aca79).(g3Pointcxx . . $ g3Point# *pnts, g3Pointcxx . . $ g3Point# *top_point, g3Pointcxx . . $ g3Point# *bot_point, float width) { |
| 1333 | // get the camera's world position |
| 1334 | vectorcxx . . $ vector# viewerPos; |
| 1335 | g3_GetViewPositioncxx . . $ g3_GetViewPosition(ec8cf6451c36d470).(&viewerPos); |
| 1336 | |
| 1337 | // calculate the vector from the top point to the bottom point |
| 1338 | ASSERTcxx . . $ `misc/pserror.h:246:9`!(bot_point->p3_flags & PF_ORIGPOINTcxx . . $ `lib/3d.h:221:9`!); |
| 1339 | ASSERTcxx . . $ `misc/pserror.h:246:9`!(top_point->p3_flags & PF_ORIGPOINTcxx . . $ `lib/3d.h:221:9`!); |
| 1340 | vectorcxx . . $ vector# deltaVec = bot_point->p3_vecPreRotcxx . . $ g3Point#p3_vecPreRot. -cxx . . $ operator-(b77b703cd1e43e33). top_point->p3_vecPreRotcxx . . $ g3Point#p3_vecPreRot.; |
| 1341 | vm_NormalizeVectorcxx . . $ vm_NormalizeVector(4939a7e530383cd4).(&deltaVec); |
| 1342 | |
| 1343 | // get the vector from the camera to the top point |
| 1344 | vectorcxx . . $ vector# top = top_point->p3_vecPreRotcxx . . $ g3Point#p3_vecPreRot. -cxx . . $ operator-(b77b703cd1e43e33). viewerPos; |
| 1345 | vm_NormalizeVectorcxx . . $ vm_NormalizeVector(4939a7e530383cd4).(&top); |
| 1346 | |
| 1347 | // calculate the vector out from the 'rod' that is facing the camera |
| 1348 | vectorcxx . . $ vector# rodNorm; |
| 1349 | vm_CrossProductcxx . . $ vm_CrossProduct(af83aca25ba5b41c).(&rodNorm, &deltaVec, &top); |
| 1350 | vm_NormalizeVectorcxx . . $ vm_NormalizeVector(4939a7e530383cd4).(&rodNorm); |
| 1351 | |
| 1352 | // get the offset vector |
| 1353 | vectorcxx . . $ vector# tempv = rodNorm *cxx . . $ `operator*`(252247219a31502c). width; |
| 1354 | |
| 1355 | // setup the points |
| 1356 | int i, codesAND = 0xFF; |
| 1357 | for (i = 0; i < 4; ++i) { |
| 1358 | float scale = (i == 0 || i == 3) ? -1.0f : 1.0f; |
| 1359 | vectorcxx . . $ vector# bbPt = ((i < 2) ? top_point->p3_vecPreRotcxx . . $ g3Point#p3_vecPreRot. : bot_point->p3_vecPreRotcxx . . $ g3Point#p3_vecPreRot.) +cxx . . $ operator+(b77b703cd1e43e33). (tempv *cxx . . $ `operator*`(252247219a31502c). scale); |
| 1360 | |
| 1361 | // initialize the point |
| 1362 | codesAND &= g3_RotatePointcxx . . $ g3_RotatePoint(fd2e8930c920e2b9).(&pnts[i], &bbPt); |
| 1363 | } |
| 1364 | |
| 1365 | if (codesAND) |
| 1366 | return 0; |
| 1367 | |
| 1368 | return 1; |
| 1369 | } |
| 1370 | |
| 1371 | // Draws a thick lighting bolt from one area to another |
| 1372 | // Velocity.x is how many times to saturate |
| 1373 | // Velocity.y is how fast the lightning moves across the v component |
| 1374 | // Velocity.z is how many times the effect is tiled across the v component |
| 1375 | // If Billboard_info.texture is not zero, it does autotiling |
| 1376 | void DrawVisThickLightningcxx . . $ DrawVisThickLightning(6089e83781d51a35).(vis_effectcxx . . $ vis_effect# *vis) { |
| 1377 | // compute the corners of a rod. fills in vertbuf. |
| 1378 | g3Pointcxx . . $ g3Point# top_point, bot_point; |
| 1379 | g3Pointcxx . . $ g3Point# pnts[4], *pntlist[4]; |
| 1380 | |
| 1381 | g3_RotatePointcxx . . $ g3_RotatePoint(fd2e8930c920e2b9).(&top_point, &vis->poscxx . . $ vis_effect#pos.); |
| 1382 | g3_RotatePointcxx . . $ g3_RotatePoint(fd2e8930c920e2b9).(&bot_point, &vis->end_poscxx . . $ vis_effect#end_pos.); |
| 1383 | |
| 1384 | if (!GetBillboardCornerscxx . . $ GetBillboardCorners(262217bcda1aca79).(pnts, &top_point, &bot_point, vis->billboard_infocxx . . $ vis_effect#billboard_info..widthcxx . . $ axis_billboard_info#width.)) |
| 1385 | return; |
| 1386 | |
| 1387 | vectorcxx . . $ vector# line_norm = vis->end_poscxx . . $ vis_effect#end_pos. -cxx . . $ operator-(b77b703cd1e43e33). vis->poscxx . . $ vis_effect#pos.; |
| 1388 | float line_mag = vm_GetMagnitudeFastcxx . . $ vm_GetMagnitudeFast(4939a7e530383cd4).(&line_norm); |
| 1389 | |
| 1390 | line_norm /=cxx . . $ `operator/=`(f132838b2cd11d6). line_mag; |
| 1391 | |
| 1392 | if (line_mag < 1) |
| 1393 | return; |
| 1394 | |
| 1395 | int texnum = vis->custom_handlecxx . . $ vis_effect#custom_handle.; |
| 1396 | int bm_handle = GetTextureBitmapcxx . . $ GetTextureBitmap(6009f2e2e1989200).(texnum, 0, true); |
| 1397 | float tile_factor = vis->velocitycxx . . $ vis_effect#velocity..zcxx . . $ vector#z.; |
| 1398 | float alpha_norm; |
| 1399 | int i, codes_and; |
| 1400 | |
| 1401 | if (vis->flagscxx . . $ vis_effect#flags. & VF_EXPANDcxx . . $ `Descent3/viseffect_external.h:69:9`!) |
| 1402 | alpha_norm = vis->lifeleftcxx . . $ vis_effect#lifeleft. / vis->lifetimecxx . . $ vis_effect#lifetime.; |
| 1403 | else |
| 1404 | alpha_norm = .7f; |
| 1405 | |
| 1406 | rend_SetOverlayTypecxx . . $ rend_SetOverlayType(ac50b47256ae7414).(OT_NONEcxx . . $ `lib/renderer.h:333:9`!); |
| 1407 | rend_SetTextureTypecxx . . $ rend_SetTextureType(cccd9781d96f97ff).(TT_LINEARcxx . . $ TT_LINEAR.); |
| 1408 | rend_SetLightingcxx . . $ rend_SetLighting(e55526c9d3dd1656).(LS_FLAT_GOURAUDcxx . . $ LS_FLAT_GOURAUD.); |
| 1409 | rend_SetAlphaTypecxx . . $ rend_SetAlphaType(4af4fd0e2b26c4ac).(AT_SATURATE_TEXTUREcxx . . $ `lib/renderer.h:408:9`!); |
| 1410 | rend_SetWrapTypecxx . . $ rend_SetWrapType(da524b148887c0e7).(WT_WRAPcxx . . $ WT_WRAP.); |
| 1411 | rend_SetFlatColorcxx . . $ rend_SetFlatColor(cb2f890c2fdad230).(GR_16_TO_COLORcxx . . $ GR_16_TO_COLOR(909d59720f161188).(vis->lighting_colorcxx . . $ vis_effect#lighting_color.)); |
| 1412 | rend_SetAlphaValuecxx . . $ rend_SetAlphaValue(ac50b47256ae7414).(255 * alpha_norm); |
| 1413 | rend_SetZBufferWriteMaskcxx . . $ rend_SetZBufferWriteMask(d4f767463ce0a6b3).(0); |
| 1414 | |
| 1415 | for (i = 0, codes_and = 0xff; i < 4; i++) { |
| 1416 | pntlist[i] = &pnts[i]; |
| 1417 | } |
| 1418 | |
| 1419 | if (vis->billboard_infocxx . . $ vis_effect#billboard_info..texturecxx . . $ axis_billboard_info#texture.) // do autotiling |
| 1420 | { |
| 1421 | float ratio = line_mag / (float)vis->billboard_infocxx . . $ vis_effect#billboard_info..widthcxx . . $ axis_billboard_info#width.; |
| 1422 | tile_factor *= ratio; |
| 1423 | } |
| 1424 | |
| 1425 | pnts[0].p3_ucxx . . $ `lib/3d.h:250:9`! = 0; |
| 1426 | pnts[0].p3_vcxx . . $ `lib/3d.h:251:9`! = 0; |
| 1427 | |
| 1428 | pnts[1].p3_ucxx . . $ `lib/3d.h:250:9`! = 1; |
| 1429 | pnts[1].p3_vcxx . . $ `lib/3d.h:251:9`! = 0; |
| 1430 | |
| 1431 | pnts[2].p3_ucxx . . $ `lib/3d.h:250:9`! = 1; |
| 1432 | pnts[2].p3_vcxx . . $ `lib/3d.h:251:9`! = tile_factor; |
| 1433 | |
| 1434 | pnts[3].p3_ucxx . . $ `lib/3d.h:250:9`! = 0; |
| 1435 | pnts[3].p3_vcxx . . $ `lib/3d.h:251:9`! = tile_factor; |
| 1436 | |
| 1437 | float vchange = 0; |
| 1438 | |
| 1439 | if (vis->velocitycxx . . $ vis_effect#velocity..ycxx . . $ vector#y. != 0) { |
| 1440 | int int_time = Gametimecxx . . $ Gametime. / vis->velocitycxx . . $ vis_effect#velocity..ycxx . . $ vector#y.; |
| 1441 | float norm_time = Gametimecxx . . $ Gametime. - (int_time * vis->velocitycxx . . $ vis_effect#velocity..ycxx . . $ vector#y.); |
| 1442 | norm_time /= vis->velocitycxx . . $ vis_effect#velocity..ycxx . . $ vector#y.; |
| 1443 | |
| 1444 | vchange = norm_time; |
| 1445 | } |
| 1446 | |
| 1447 | for (i = 0; i < 4; i++) { |
| 1448 | pnts[i].p3_vcxx . . $ `lib/3d.h:251:9`! += vchange; |
| 1449 | pnts[i].p3_flagscxx . . $ g3Point#p3_flags. |= PF_UVcxx . . $ `lib/3d.h:217:9`!; |
| 1450 | } |
| 1451 | |
| 1452 | // Now draw this thing! |
| 1453 | for (i = 0; i < vis->velocitycxx . . $ vis_effect#velocity..xcxx . . $ vector#x.; i++) { |
| 1454 | g3_DrawPolycxx . . $ g3_DrawPoly(eaf0a58e8bd7fbdc).(4, pntlist, bm_handle); |
| 1455 | } |
| 1456 | |
| 1457 | rend_SetZBufferWriteMaskcxx . . $ rend_SetZBufferWriteMask(d4f767463ce0a6b3).(1); |
| 1458 | } |
| 1459 | |
| 1460 | // Draws a bitmap that can orient around an axis |
| 1461 | void DrawVisAxisBillboardcxx . . $ DrawVisAxisBillboard(6089e83781d51a35).(vis_effectcxx . . $ vis_effect# *vis) { |
| 1462 | float norm_time, alpha_norm = 1; |
| 1463 | float uchange = 0, vchange = 0; |
| 1464 | float time_live = Gametimecxx . . $ Gametime. - vis->creation_timecxx . . $ vis_effect#creation_time.; |
| 1465 | float size = vis->sizecxx . . $ vis_effect#size.; |
| 1466 | |
| 1467 | int visnum = vis - VisEffectscxx . . $ VisEffects.; |
| 1468 | int bm_handle; |
| 1469 | int i; |
| 1470 | |
| 1471 | // Get corners of this billboard |
| 1472 | g3Pointcxx . . $ g3Point# top_point, bot_point; |
| 1473 | g3Pointcxx . . $ g3Point# pnts[4], *pntlist[4]; |
| 1474 | |
| 1475 | g3_RotatePointcxx . . $ g3_RotatePoint(fd2e8930c920e2b9).(&top_point, &vis->poscxx . . $ vis_effect#pos.); |
| 1476 | g3_RotatePointcxx . . $ g3_RotatePoint(fd2e8930c920e2b9).(&bot_point, &vis->end_poscxx . . $ vis_effect#end_pos.); |
| 1477 | |
| 1478 | if (!GetBillboardCornerscxx . . $ GetBillboardCorners(262217bcda1aca79).(pnts, &top_point, &bot_point, vis->billboard_infocxx . . $ vis_effect#billboard_info..widthcxx . . $ axis_billboard_info#width.)) |
| 1479 | return; |
| 1480 | |
| 1481 | for (i = 0; i < 4; i++) { |
| 1482 | pnts[i].p3_flagscxx . . $ g3Point#p3_flags. |= PF_UVcxx . . $ `lib/3d.h:217:9`!; |
| 1483 | pntlist[i] = &pnts[i]; |
| 1484 | } |
| 1485 | |
| 1486 | fireballcxx . . $ fireball# *fb = &Fireballscxx . . $ Fireballs.[vis->idcxx . . $ vis_effect#id.]; |
| 1487 | |
| 1488 | norm_time = time_live / vis->lifetimecxx . . $ vis_effect#lifetime.; |
| 1489 | |
| 1490 | if (vis->flagscxx . . $ vis_effect#flags. & VF_EXPANDcxx . . $ `Descent3/viseffect_external.h:69:9`!) |
| 1491 | alpha_norm = vis->lifeleftcxx . . $ vis_effect#lifeleft. / vis->lifetimecxx . . $ vis_effect#lifetime.; |
| 1492 | |
| 1493 | if (norm_time >= 1) |
| 1494 | norm_time = 0.99999f; // don't go over! |
| 1495 | |
| 1496 | if (vis->billboard_infocxx . . $ vis_effect#billboard_info..texturecxx . . $ axis_billboard_info#texture.) // If its a texture, get image from texture |
| 1497 | { |
| 1498 | int texnum = vis->custom_handlecxx . . $ vis_effect#custom_handle.; |
| 1499 | if (GameTexturescxx . . $ GameTextures.[texnum].flagscxx . . $ texture#flags. & TF_ANIMATEDcxx . . $ `Descent3/gametexture.h:207:9`!) { |
| 1500 | vclipcxx . . $ vclip# *vc = &GameVClipscxx . . $ GameVClips.[GameTexturescxx . . $ GameTextures.[texnum].bm_handlecxx . . $ texture#bm_handle.]; |
| 1501 | int int_frame = vc->num_framescxx . . $ vclip#num_frames. * norm_time; |
| 1502 | bm_handle = vc->framescxx . . $ vclip#frames.[int_frame]; |
| 1503 | } else |
| 1504 | bm_handle = GetTextureBitmapcxx . . $ GetTextureBitmap(6009f2e2e1989200).(texnum, 0); |
| 1505 | |
| 1506 | if (GameTexturescxx . . $ GameTextures.[texnum].flagscxx . . $ texture#flags. & TF_SATURATEcxx . . $ `Descent3/gametexture.h:222:9`!) |
| 1507 | rend_SetAlphaTypecxx . . $ rend_SetAlphaType(4af4fd0e2b26c4ac).(AT_SATURATE_TEXTUREcxx . . $ `lib/renderer.h:408:9`!); |
| 1508 | else |
| 1509 | rend_SetAlphaTypecxx . . $ rend_SetAlphaType(4af4fd0e2b26c4ac).(ATF_CONSTANTcxx . . $ `lib/renderer.h:394:9`! + ATF_TEXTUREcxx . . $ `lib/renderer.h:395:9`!); |
| 1510 | |
| 1511 | rend_SetAlphaValuecxx . . $ rend_SetAlphaValue(ac50b47256ae7414).(alpha_norm * GameTexturescxx . . $ GameTextures.[texnum].alphacxx . . $ texture#alpha. * 255); |
| 1512 | |
| 1513 | if (GameTexturescxx . . $ GameTextures.[texnum].slide_ucxx . . $ texture#slide_u. != 0) { |
| 1514 | int int_time = Gametimecxx . . $ Gametime. / GameTexturescxx . . $ GameTextures.[texnum].slide_ucxx . . $ texture#slide_u.; |
| 1515 | float norm_time = Gametimecxx . . $ Gametime. - (int_time * GameTexturescxx . . $ GameTextures.[texnum].slide_ucxx . . $ texture#slide_u.); |
| 1516 | norm_time /= GameTexturescxx . . $ GameTextures.[texnum].slide_ucxx . . $ texture#slide_u.; |
| 1517 | |
| 1518 | uchange = norm_time; |
| 1519 | } |
| 1520 | |
| 1521 | if (GameTexturescxx . . $ GameTextures.[texnum].slide_vcxx . . $ texture#slide_v. != 0) { |
| 1522 | int int_time = Gametimecxx . . $ Gametime. / GameTexturescxx . . $ GameTextures.[texnum].slide_vcxx . . $ texture#slide_v.; |
| 1523 | float norm_time = Gametimecxx . . $ Gametime. - (int_time * GameTexturescxx . . $ GameTextures.[texnum].slide_vcxx . . $ texture#slide_v.); |
| 1524 | norm_time /= GameTexturescxx . . $ GameTextures.[texnum].slide_vcxx . . $ texture#slide_v.; |
| 1525 | vchange = norm_time; |
| 1526 | } |
| 1527 | } else { |
| 1528 | bm_handle = vis->custom_handlecxx . . $ vis_effect#custom_handle.; |
| 1529 | rend_SetAlphaTypecxx . . $ rend_SetAlphaType(4af4fd0e2b26c4ac).(ATF_CONSTANTcxx . . $ `lib/renderer.h:394:9`! + ATF_TEXTUREcxx . . $ `lib/renderer.h:395:9`!); |
| 1530 | rend_SetAlphaValuecxx . . $ rend_SetAlphaValue(ac50b47256ae7414).(alpha_norm * 255); |
| 1531 | } |
| 1532 | |
| 1533 | rend_SetOverlayTypecxx . . $ rend_SetOverlayType(ac50b47256ae7414).(OT_NONEcxx . . $ `lib/renderer.h:333:9`!); |
| 1534 | |
| 1535 | rend_SetZBufferWriteMaskcxx . . $ rend_SetZBufferWriteMask(d4f767463ce0a6b3).(0); |
| 1536 | |
| 1537 | if (uchange == 0 && vchange == 0) |
| 1538 | rend_SetWrapTypecxx . . $ rend_SetWrapType(da524b148887c0e7).(WT_CLAMPcxx . . $ WT_CLAMP.); |
| 1539 | else |
| 1540 | rend_SetWrapTypecxx . . $ rend_SetWrapType(da524b148887c0e7).(WT_WRAPcxx . . $ WT_WRAP.); |
| 1541 | |
| 1542 | rend_SetLightingcxx . . $ rend_SetLighting(e55526c9d3dd1656).(LS_NONEcxx . . $ LS_NONE.); |
| 1543 | rend_SetColorModelcxx . . $ rend_SetColorModel(e3c5062d5af601c7).(CM_MONOcxx . . $ CM_MONO.); |
| 1544 | rend_SetTextureTypecxx . . $ rend_SetTextureType(cccd9781d96f97ff).(TT_LINEARcxx . . $ TT_LINEAR.); |
| 1545 | |
| 1546 | pnts[0].p3_ucxx . . $ `lib/3d.h:250:9`! = 0; |
| 1547 | pnts[0].p3_vcxx . . $ `lib/3d.h:251:9`! = 0; |
| 1548 | |
| 1549 | pnts[1].p3_ucxx . . $ `lib/3d.h:250:9`! = 1; |
| 1550 | pnts[1].p3_vcxx . . $ `lib/3d.h:251:9`! = 0; |
| 1551 | |
| 1552 | pnts[2].p3_ucxx . . $ `lib/3d.h:250:9`! = 1; |
| 1553 | pnts[2].p3_vcxx . . $ `lib/3d.h:251:9`! = 1; |
| 1554 | |
| 1555 | pnts[3].p3_ucxx . . $ `lib/3d.h:250:9`! = 0; |
| 1556 | pnts[3].p3_vcxx . . $ `lib/3d.h:251:9`! = 1; |
| 1557 | |
| 1558 | for (i = 0; i < 4; i++) { |
| 1559 | pnts[i].p3_ucxx . . $ `lib/3d.h:250:9`! += uchange; |
| 1560 | pnts[i].p3_vcxx . . $ `lib/3d.h:251:9`! += vchange; |
| 1561 | } |
| 1562 | |
| 1563 | g3_DrawPolycxx . . $ g3_DrawPoly(eaf0a58e8bd7fbdc).(4, pntlist, bm_handle); |
| 1564 | |
| 1565 | rend_SetZBufferWriteMaskcxx . . $ rend_SetZBufferWriteMask(d4f767463ce0a6b3).(1); |
| 1566 | |
| 1567 | rend_SetWrapTypecxx . . $ rend_SetWrapType(da524b148887c0e7).(WT_WRAPcxx . . $ WT_WRAP.); |
| 1568 | } |
| 1569 | |
| 1570 | // Draws a bitmap that can orient around an axis |
| 1571 | void DrawVisBillboardSmoketrailcxx . . $ DrawVisBillboardSmoketrail(6089e83781d51a35).(vis_effectcxx . . $ vis_effect# *vis) { |
| 1572 | float norm_time, alpha_norm = 1; |
| 1573 | float uchange = 0, vchange = 0; |
| 1574 | float time_live = Gametimecxx . . $ Gametime. - vis->creation_timecxx . . $ vis_effect#creation_time.; |
| 1575 | float size = vis->sizecxx . . $ vis_effect#size.; |
| 1576 | |
| 1577 | int visnum = vis - VisEffectscxx . . $ VisEffects.; |
| 1578 | int bm_handle; |
| 1579 | |
| 1580 | // Get corners of this billboard |
| 1581 | g3Pointcxx . . $ g3Point# top_point, bot_point; |
| 1582 | g3Pointcxx . . $ g3Point# pnts[4], *pntlist[4]; |
| 1583 | |
| 1584 | g3_RotatePointcxx . . $ g3_RotatePoint(fd2e8930c920e2b9).(&top_point, &vis->poscxx . . $ vis_effect#pos.); |
| 1585 | g3_RotatePointcxx . . $ g3_RotatePoint(fd2e8930c920e2b9).(&bot_point, &vis->end_poscxx . . $ vis_effect#end_pos.); |
| 1586 | |
| 1587 | norm_time = time_live / vis->lifetimecxx . . $ vis_effect#lifetime.; |
| 1588 | alpha_norm = vis->lifeleftcxx . . $ vis_effect#lifeleft. / vis->lifetimecxx . . $ vis_effect#lifetime.; |
| 1589 | float width = vis->billboard_infocxx . . $ vis_effect#billboard_info..widthcxx . . $ axis_billboard_info#width. * alpha_norm; |
| 1590 | |
| 1591 | if (alpha_norm > 0.8f) { |
| 1592 | // Make this smoke puff a bit smaller at the beginning of its life |
| 1593 | float newnorm = 1.0f - ((alpha_norm - 0.8f) / 0.2f); |
| 1594 | width *= newnorm; |
| 1595 | } |
| 1596 | |
| 1597 | alpha_norm *= 0.7f; |
| 1598 | |
| 1599 | if (!GetBillboardCornerscxx . . $ GetBillboardCorners(262217bcda1aca79).(pnts, &top_point, &bot_point, width)) |
| 1600 | return; |
| 1601 | |
| 1602 | fireballcxx . . $ fireball# *fb = &Fireballscxx . . $ Fireballs.[vis->idcxx . . $ vis_effect#id.]; |
| 1603 | |
| 1604 | for (int i = 0; i < 4; i++) { |
| 1605 | pnts[i].p3_flagscxx . . $ g3Point#p3_flags. |= PF_UVcxx . . $ `lib/3d.h:217:9`! | PF_RGBAcxx . . $ `lib/3d.h:219:9`!; |
| 1606 | pntlist[i] = &pnts[i]; |
| 1607 | pnts[i].p3_acxx . . $ `lib/3d.h:256:9`! = alpha_norm; |
| 1608 | } |
| 1609 | |
| 1610 | if (norm_time >= 1) |
| 1611 | norm_time = 0.99999f; // don't go over! |
| 1612 | |
| 1613 | int texnum = vis->custom_handlecxx . . $ vis_effect#custom_handle.; |
| 1614 | if (GameTexturescxx . . $ GameTextures.[texnum].flagscxx . . $ texture#flags. & TF_ANIMATEDcxx . . $ `Descent3/gametexture.h:207:9`!) { |
| 1615 | vclipcxx . . $ vclip# *vc = &GameVClipscxx . . $ GameVClips.[GameTexturescxx . . $ GameTextures.[texnum].bm_handlecxx . . $ texture#bm_handle.]; |
| 1616 | int int_frame = vc->num_framescxx . . $ vclip#num_frames. * norm_time; |
| 1617 | bm_handle = vc->framescxx . . $ vclip#frames.[int_frame]; |
| 1618 | } else |
| 1619 | bm_handle = GetTextureBitmapcxx . . $ GetTextureBitmap(6009f2e2e1989200).(texnum, 0); |
| 1620 | |
| 1621 | if (GameTexturescxx . . $ GameTextures.[texnum].flagscxx . . $ texture#flags. & TF_SATURATEcxx . . $ `Descent3/gametexture.h:222:9`!) |
| 1622 | rend_SetAlphaTypecxx . . $ rend_SetAlphaType(4af4fd0e2b26c4ac).(AT_SATURATE_TEXTURE_VERTEXcxx . . $ `lib/renderer.h:413:9`!); |
| 1623 | else |
| 1624 | rend_SetAlphaTypecxx . . $ rend_SetAlphaType(4af4fd0e2b26c4ac).(AT_TEXTURE_VERTEXcxx . . $ `lib/renderer.h:405:9`!); |
| 1625 | |
| 1626 | rend_SetOverlayTypecxx . . $ rend_SetOverlayType(ac50b47256ae7414).(OT_NONEcxx . . $ `lib/renderer.h:333:9`!); |
| 1627 | |
| 1628 | rend_SetZBufferWriteMaskcxx . . $ rend_SetZBufferWriteMask(d4f767463ce0a6b3).(0); |
| 1629 | |
| 1630 | rend_SetFlatColorcxx . . $ rend_SetFlatColor(cb2f890c2fdad230).(GR_16_TO_COLORcxx . . $ GR_16_TO_COLOR(909d59720f161188).(vis->lighting_colorcxx . . $ vis_effect#lighting_color.)); |
| 1631 | rend_SetColorModelcxx . . $ rend_SetColorModel(e3c5062d5af601c7).(CM_MONOcxx . . $ CM_MONO.); |
| 1632 | rend_SetTextureTypecxx . . $ rend_SetTextureType(cccd9781d96f97ff).(TT_LINEARcxx . . $ TT_LINEAR.); |
| 1633 | rend_SetLightingcxx . . $ rend_SetLighting(e55526c9d3dd1656).(LS_FLAT_GOURAUDcxx . . $ LS_FLAT_GOURAUD.); |
| 1634 | |
| 1635 | pnts[0].p3_ucxx . . $ `lib/3d.h:250:9`! = 0; |
| 1636 | pnts[0].p3_vcxx . . $ `lib/3d.h:251:9`! = 0; |
| 1637 | |
| 1638 | pnts[1].p3_ucxx . . $ `lib/3d.h:250:9`! = 1; |
| 1639 | pnts[1].p3_vcxx . . $ `lib/3d.h:251:9`! = 0; |
| 1640 | |
| 1641 | pnts[2].p3_ucxx . . $ `lib/3d.h:250:9`! = 1; |
| 1642 | pnts[2].p3_vcxx . . $ `lib/3d.h:251:9`! = 1; |
| 1643 | |
| 1644 | pnts[3].p3_ucxx . . $ `lib/3d.h:250:9`! = 0; |
| 1645 | pnts[3].p3_vcxx . . $ `lib/3d.h:251:9`! = 1; |
| 1646 | |
| 1647 | g3_DrawPolycxx . . $ g3_DrawPoly(eaf0a58e8bd7fbdc).(4, pntlist, bm_handle); |
| 1648 | |
| 1649 | rend_SetZBufferWriteMaskcxx . . $ rend_SetZBufferWriteMask(d4f767463ce0a6b3).(1); |
| 1650 | } |
| 1651 | |
| 1652 | // Draws a long "stick" to represent the mass driver trail |
| 1653 | void DrawVisMassDriverEffectcxx . . $ DrawVisMassDriverEffect(d8651ef0f4ca24f7).(vis_effectcxx . . $ vis_effect# *vis, bool f_boss) { |
| 1654 | int i, t, k; |
| 1655 | static int masstrail = -1; |
| 1656 | |
| 1657 | if (masstrail == -1) |
| 1658 | masstrail = FindTextureNamecxx . . $ FindTextureName(5c4306d8553b3696).("MassTrail"); |
| 1659 | ASSERTcxx . . $ `misc/pserror.h:246:9`!(masstrail != -1); // DAJ -1FIX |
| 1660 | |
| 1661 | vectorcxx . . $ vector# center_vecs[2]; |
| 1662 | g3Pointcxx . . $ g3Point# arc_points[32], *pntlist[32]; |
| 1663 | |
| 1664 | center_vecs[0] =cxx . . $ vector#`operator=`(a48bc7e93a8dae5e). vis->poscxx . . $ vis_effect#pos.; |
| 1665 | center_vecs[1] =cxx . . $ vector#`operator=`(a48bc7e93a8dae5e). vis->end_poscxx . . $ vis_effect#end_pos.; |
| 1666 | |
| 1667 | vectorcxx . . $ vector# normvec = center_vecs[1] -cxx . . $ operator-(b77b703cd1e43e33). center_vecs[0]; |
| 1668 | matrixcxx . . $ matrix# orient; |
| 1669 | |
| 1670 | vm_NormalizeVectorcxx . . $ vm_NormalizeVector(4939a7e530383cd4).(&normvec); |
| 1671 | vm_VectorToMatrixcxx . . $ vm_VectorToMatrix(543233b88555916d).(&orient, &normvec, NULLcxx . . $ `<external>/15298297234472979974/stddef.h:416:9`!, NULLcxx . . $ `<external>/15298297234472979974/stddef.h:416:9`!); |
| 1672 | |
| 1673 | float size = ((float)vis->billboard_infocxx . . $ vis_effect#billboard_info..widthcxx . . $ axis_billboard_info#width.) * .25; |
| 1674 | int circle_pieces = 16; |
| 1675 | |
| 1676 | if (f_boss) { |
| 1677 | size *= 3.0f; |
| 1678 | } |
| 1679 | |
| 1680 | float mag = vm_VectorDistanceQuickcxx . . $ vm_VectorDistanceQuick(a0b9c8659ecc16b8).(&vis->poscxx . . $ vis_effect#pos., &vis->end_poscxx . . $ vis_effect#end_pos.); |
| 1681 | vectorcxx . . $ vector# dir_norm = (vis->end_poscxx . . $ vis_effect#end_pos. -cxx . . $ operator-(b77b703cd1e43e33). vis->poscxx . . $ vis_effect#pos.) /cxx . . $ `operator/`(252247219a31502c). mag; |
| 1682 | float alpha_norm = (vis->lifeleftcxx . . $ vis_effect#lifeleft. / vis->lifetimecxx . . $ vis_effect#lifetime.) * .5; |
| 1683 | int bm_handle = GetTextureBitmapcxx . . $ GetTextureBitmap(6009f2e2e1989200).(vis->custom_handlecxx . . $ vis_effect#custom_handle., 0); |
| 1684 | |
| 1685 | rend_SetAlphaTypecxx . . $ rend_SetAlphaType(4af4fd0e2b26c4ac).(AT_SATURATE_TEXTUREcxx . . $ `lib/renderer.h:408:9`!); |
| 1686 | rend_SetOverlayTypecxx . . $ rend_SetOverlayType(ac50b47256ae7414).(OT_NONEcxx . . $ `lib/renderer.h:333:9`!); |
| 1687 | rend_SetTextureTypecxx . . $ rend_SetTextureType(cccd9781d96f97ff).(TT_LINEARcxx . . $ TT_LINEAR.); |
| 1688 | rend_SetLightingcxx . . $ rend_SetLighting(e55526c9d3dd1656).(LS_FLAT_GOURAUDcxx . . $ LS_FLAT_GOURAUD.); |
| 1689 | rend_SetZBufferWriteMaskcxx . . $ rend_SetZBufferWriteMask(d4f767463ce0a6b3).(0); |
| 1690 | if (f_boss) |
| 1691 | rend_SetFlatColorcxx . . $ rend_SetFlatColor(cb2f890c2fdad230).(GR_RGBcxx . . $ GR_RGB(530956271a9518a5).(255, 170, 170)); |
| 1692 | else |
| 1693 | rend_SetFlatColorcxx . . $ rend_SetFlatColor(cb2f890c2fdad230).(GR_RGBcxx . . $ GR_RGB(530956271a9518a5).(200, 200, 255)); |
| 1694 | |
| 1695 | rend_SetAlphaValuecxx . . $ rend_SetAlphaValue(ac50b47256ae7414).(255 * alpha_norm); |
| 1696 | |
| 1697 | for (i = 0; i < 2; i++) { |
| 1698 | for (t = 0; t < circle_pieces; t++) { |
| 1699 | float norm = (float)t / (float)circle_pieces; |
| 1700 | vectorcxx . . $ vector# arc_vec = center_vecs[i]; |
| 1701 | |
| 1702 | arc_vec +=cxx . . $ `operator+=`(801a8d6f7ab7bef9). (orient.uveccxx . . $ matrix#uvec. *cxx . . $ `operator*`(252247219a31502c). (size / 4) *cxx . . $ `operator*`(252247219a31502c). FixSincxx . . $ FixSin(9a38df040a81ca35).(norm * 65536)); |
| 1703 | arc_vec -=cxx . . $ `operator-=`(801a8d6f7ab7bef9). (orient.rveccxx . . $ matrix#rvec. *cxx . . $ `operator*`(252247219a31502c). (size / 4) *cxx . . $ `operator*`(252247219a31502c). FixCoscxx . . $ FixCos(9a38df040a81ca35).(norm * 65536)); |
| 1704 | |
| 1705 | g3_RotatePointcxx . . $ g3_RotatePoint(fd2e8930c920e2b9).(&arc_points[i * circle_pieces + t], &arc_vec); |
| 1706 | arc_points[i * circle_pieces + t].p3_flagscxx . . $ g3Point#p3_flags. |= PF_UVcxx . . $ `lib/3d.h:217:9`! | PF_RGBAcxx . . $ `lib/3d.h:219:9`!; |
| 1707 | } |
| 1708 | } |
| 1709 | |
| 1710 | for (k = 0; k < circle_pieces; k++) { |
| 1711 | int next = (k + 1) % circle_pieces; |
| 1712 | arc_points[k].p3_ucxx . . $ `lib/3d.h:250:9`! = 0; |
| 1713 | arc_points[k].p3_vcxx . . $ `lib/3d.h:251:9`! = mag / 2; |
| 1714 | |
| 1715 | arc_points[k + circle_pieces].p3_ucxx . . $ `lib/3d.h:250:9`! = 0; |
| 1716 | arc_points[k + circle_pieces].p3_vcxx . . $ `lib/3d.h:251:9`! = 0; |
| 1717 | |
| 1718 | arc_points[next + circle_pieces].p3_ucxx . . $ `lib/3d.h:250:9`! = 1; |
| 1719 | arc_points[next + circle_pieces].p3_vcxx . . $ `lib/3d.h:251:9`! = 0; |
| 1720 | |
| 1721 | arc_points[next].p3_ucxx . . $ `lib/3d.h:250:9`! = 1; |
| 1722 | arc_points[next].p3_vcxx . . $ `lib/3d.h:251:9`! = mag / 2; |
| 1723 | |
| 1724 | pntlist[0] = &arc_points[t + k]; |
| 1725 | pntlist[1] = &arc_points[t + k - circle_pieces]; |
| 1726 | pntlist[2] = &arc_points[t + next - circle_pieces]; |
| 1727 | pntlist[3] = &arc_points[t + next]; |
| 1728 | |
| 1729 | g3_DrawPolycxx . . $ g3_DrawPoly(eaf0a58e8bd7fbdc).(4, pntlist, bm_handle); |
| 1730 | } |
| 1731 | |
| 1732 | for (i = 0; i < 2; i++) { |
| 1733 | for (t = 0; t < circle_pieces; t++) { |
| 1734 | float norm = (float)t / (float)circle_pieces; |
| 1735 | vectorcxx . . $ vector# arc_vec = center_vecs[i]; |
| 1736 | |
| 1737 | arc_vec +=cxx . . $ `operator+=`(801a8d6f7ab7bef9). (orient.uveccxx . . $ matrix#uvec. *cxx . . $ `operator*`(252247219a31502c). (size)*cxx . . $ `operator*`(252247219a31502c).FixSincxx . . $ FixSin(9a38df040a81ca35).(norm * 65536)); |
| 1738 | arc_vec -=cxx . . $ `operator-=`(801a8d6f7ab7bef9). (orient.rveccxx . . $ matrix#rvec. *cxx . . $ `operator*`(252247219a31502c). (size)*cxx . . $ `operator*`(252247219a31502c).FixCoscxx . . $ FixCos(9a38df040a81ca35).(norm * 65536)); |
| 1739 | |
| 1740 | g3_RotatePointcxx . . $ g3_RotatePoint(fd2e8930c920e2b9).(&arc_points[i * circle_pieces + t], &arc_vec); |
| 1741 | arc_points[i * circle_pieces + t].p3_flagscxx . . $ g3Point#p3_flags. |= PF_UVcxx . . $ `lib/3d.h:217:9`!; |
| 1742 | } |
| 1743 | } |
| 1744 | |
| 1745 | rend_SetFlatColorcxx . . $ rend_SetFlatColor(cb2f890c2fdad230).(GR_16_TO_COLORcxx . . $ GR_16_TO_COLOR(909d59720f161188).(vis->lighting_colorcxx . . $ vis_effect#lighting_color.)); |
| 1746 | rend_SetAlphaValuecxx . . $ rend_SetAlphaValue(ac50b47256ae7414).(255 * alpha_norm); |
| 1747 | |
| 1748 | for (k = 0; k < circle_pieces; k++) { |
| 1749 | int next = (k + 1) % circle_pieces; |
| 1750 | arc_points[k].p3_ucxx . . $ `lib/3d.h:250:9`! = 0; |
| 1751 | arc_points[k].p3_vcxx . . $ `lib/3d.h:251:9`! = mag / 2; |
| 1752 | |
| 1753 | arc_points[k + circle_pieces].p3_ucxx . . $ `lib/3d.h:250:9`! = 0; |
| 1754 | arc_points[k + circle_pieces].p3_vcxx . . $ `lib/3d.h:251:9`! = 0; |
| 1755 | |
| 1756 | arc_points[next + circle_pieces].p3_ucxx . . $ `lib/3d.h:250:9`! = 1; |
| 1757 | arc_points[next + circle_pieces].p3_vcxx . . $ `lib/3d.h:251:9`! = 0; |
| 1758 | |
| 1759 | arc_points[next].p3_ucxx . . $ `lib/3d.h:250:9`! = 1; |
| 1760 | arc_points[next].p3_vcxx . . $ `lib/3d.h:251:9`! = mag / 2; |
| 1761 | |
| 1762 | pntlist[0] = &arc_points[t + k]; |
| 1763 | pntlist[1] = &arc_points[t + k - circle_pieces]; |
| 1764 | pntlist[2] = &arc_points[t + next - circle_pieces]; |
| 1765 | pntlist[3] = &arc_points[t + next]; |
| 1766 | |
| 1767 | if (!g3_DrawPolycxx . . $ g3_DrawPoly(eaf0a58e8bd7fbdc).(4, pntlist, bm_handle)) |
| 1768 | return; |
| 1769 | } |
| 1770 | |
| 1771 | // Now draw some rings |
| 1772 | int rings = mag / 3; |
| 1773 | float fsize = 3; |
| 1774 | |
| 1775 | if (rings > 400) { |
| 1776 | rings = 400; |
| 1777 | fsize = mag / 400.0; |
| 1778 | } |
| 1779 | |
| 1780 | rend_SetLightingcxx . . $ rend_SetLighting(e55526c9d3dd1656).(LS_NONEcxx . . $ LS_NONE.); |
| 1781 | rend_SetAlphaTypecxx . . $ rend_SetAlphaType(4af4fd0e2b26c4ac).(AT_SATURATE_TEXTUREcxx . . $ `lib/renderer.h:408:9`!); |
| 1782 | rend_SetAlphaValuecxx . . $ rend_SetAlphaValue(ac50b47256ae7414).(255 * alpha_norm); |
| 1783 | |
| 1784 | bm_handle = GetTextureBitmapcxx . . $ GetTextureBitmap(6009f2e2e1989200).(masstrail, 0); |
| 1785 | |
| 1786 | int int_gametime = Gametimecxx . . $ Gametime.; |
| 1787 | int frameroll = (Gametimecxx . . $ Gametime. - int_gametime) * -(65536 * 4); |
| 1788 | |
| 1789 | if (!f_boss) { |
| 1790 | for (i = 1; i < rings; i++) { |
| 1791 | int rot_angle = (i * 2000) % 65536; |
| 1792 | vectorcxx . . $ vector# pos = vis->poscxx . . $ vis_effect#pos. +cxx . . $ operator+(b77b703cd1e43e33). (dir_norm *cxx . . $ `operator*`(252247219a31502c). (i * fsize)); |
| 1793 | float new_size = 1.0; |
| 1794 | new_size += FixSincxx . . $ FixSin(9a38df040a81ca35).((i * 9000) + frameroll) * .3; |
| 1795 | |
| 1796 | g3_DrawPlanarRotatedBitmapcxx . . $ g3_DrawPlanarRotatedBitmap(71c6e0d12bc5318b).(&pos, &dir_norm, rot_angle, new_size, |
| 1797 | (new_size * bm_hcxx . . $ bm_h(9b79fb6aee4c0440).(bm_handle, 0)) / bm_wcxx . . $ bm_w(9b79fb6aee4c0440).(bm_handle, 0), bm_handle); |
| 1798 | } |
| 1799 | } |
| 1800 | rend_SetZBufferWriteMaskcxx . . $ rend_SetZBufferWriteMask(d4f767463ce0a6b3).(1); |
| 1801 | } |
| 1802 | |
| 1803 | // Renders a vis effect |
| 1804 | void DrawVisEffectcxx . . $ DrawVisEffect(6089e83781d51a35).(vis_effectcxx . . $ vis_effect# *vis) { |
| 1805 | ASSERTcxx . . $ `misc/pserror.h:246:9`!(vis->type != VIS_NONEcxx . . $ `Descent3/viseffect_external.h:60:9`!); |
| 1806 | |
| 1807 | // First check to see if these are special types |
| 1808 | |
| 1809 | if (vis->idcxx . . $ vis_effect#id. == LIGHTNING_BOLT_INDEXcxx . . $ `Descent3/fireball_external.h:53:9`! || vis->idcxx . . $ vis_effect#id. == GRAY_LIGHTNING_BOLT_INDEXcxx . . $ `Descent3/fireball_external.h:73:9`!) { |
| 1810 | DrawVisLightningBoltcxx . . $ DrawVisLightningBolt(6089e83781d51a35).(vis); |
| 1811 | return; |
| 1812 | } else if (vis->idcxx . . $ vis_effect#id. == MASSDRIVER_EFFECT_INDEXcxx . . $ `Descent3/fireball_external.h:70:9`!) { |
| 1813 | DrawVisMassDriverEffectcxx . . $ DrawVisMassDriverEffect(d8651ef0f4ca24f7).(vis, false); |
| 1814 | return; |
| 1815 | } else if (vis->idcxx . . $ vis_effect#id. == MERCBOSS_MASSDRIVER_EFFECT_INDEXcxx . . $ `Descent3/fireball_external.h:74:9`!) { |
| 1816 | DrawVisMassDriverEffectcxx . . $ DrawVisMassDriverEffect(d8651ef0f4ca24f7).(vis, true); |
| 1817 | return; |
| 1818 | } else if (vis->idcxx . . $ vis_effect#id. == BILLBOARD_SMOKETRAIL_INDEXcxx . . $ `Descent3/fireball_external.h:69:9`!) { |
| 1819 | DrawVisBillboardSmoketrailcxx . . $ DrawVisBillboardSmoketrail(6089e83781d51a35).(vis); |
| 1820 | return; |
| 1821 | } else if (vis->idcxx . . $ vis_effect#id. == THICK_LIGHTNING_INDEXcxx . . $ `Descent3/fireball_external.h:62:9`!) { |
| 1822 | DrawVisThickLightningcxx . . $ DrawVisThickLightning(6089e83781d51a35).(vis); |
| 1823 | return; |
| 1824 | } else if (vis->idcxx . . $ vis_effect#id. == SINE_WAVE_INDEXcxx . . $ `Descent3/fireball_external.h:55:9`!) { |
| 1825 | DrawVisSineWavecxx . . $ DrawVisSineWave(6089e83781d51a35).(vis); |
| 1826 | return; |
| 1827 | } else if (vis->idcxx . . $ vis_effect#id. == BLAST_RING_INDEXcxx . . $ `Descent3/fireball_external.h:31:9`!) { |
| 1828 | DrawVisBlastRingcxx . . $ DrawVisBlastRing(6089e83781d51a35).(vis); |
| 1829 | return; |
| 1830 | } else if (vis->idcxx . . $ vis_effect#id. == FADING_LINE_INDEXcxx . . $ `Descent3/fireball_external.h:41:9`!) { |
| 1831 | DrawVisFadingLinecxx . . $ DrawVisFadingLine(6089e83781d51a35).(vis); |
| 1832 | return; |
| 1833 | } else if (vis->idcxx . . $ vis_effect#id. == SNOWFLAKE_INDEXcxx . . $ `Descent3/fireball_external.h:61:9`!) { |
| 1834 | DrawVisSnowflakecxx . . $ DrawVisSnowflake(6089e83781d51a35).(vis); |
| 1835 | return; |
| 1836 | } else if (vis->idcxx . . $ vis_effect#id. == RAINDROP_INDEXcxx . . $ `Descent3/fireball_external.h:50:9`! || vis->idcxx . . $ vis_effect#id. == PUDDLEDROP_INDEXcxx . . $ `Descent3/fireball_external.h:51:9`!) { |
| 1837 | DrawVisRainDropcxx . . $ DrawVisRainDrop(6089e83781d51a35).(vis); |
| 1838 | return; |
| 1839 | } else if (vis->idcxx . . $ vis_effect#id. == AXIS_BILLBOARD_INDEXcxx . . $ `Descent3/fireball_external.h:56:9`!) { |
| 1840 | DrawVisAxisBillboardcxx . . $ DrawVisAxisBillboard(6089e83781d51a35).(vis); |
| 1841 | return; |
| 1842 | } |
| 1843 | |
| 1844 | float norm_time; |
| 1845 | float time_live = Gametimecxx . . $ Gametime. - vis->creation_timecxx . . $ vis_effect#creation_time.; |
| 1846 | |
| 1847 | // This hack is needed for the demo system and Gamegauge, since it adjusts gametime during |
| 1848 | // the game there are times when this could be a negative number (which would be bad) |
| 1849 | if (time_live < 0) |
| 1850 | time_live = 0; |
| 1851 | |
| 1852 | float size = vis->sizecxx . . $ vis_effect#size.; |
| 1853 | |
| 1854 | // Bigger explosions for Katmai |
| 1855 | if (Katmaicxx . . $ Katmai.) { |
| 1856 | if (vis->idcxx . . $ vis_effect#id. == BIG_EXPLOSION_INDEXcxx . . $ `Descent3/fireball_external.h:26:9`! || vis->idcxx . . $ vis_effect#id. == MED_EXPLOSION_INDEXcxx . . $ `Descent3/fireball_external.h:24:9`! || vis->idcxx . . $ vis_effect#id. == MED_EXPLOSION_INDEX2cxx . . $ `Descent3/fireball_external.h:22:9`! || |
| 1857 | vis->idcxx . . $ vis_effect#id. == MED_EXPLOSION_INDEX3cxx . . $ `Descent3/fireball_external.h:25:9`!) |
| 1858 | size *= 1.8f; |
| 1859 | } |
| 1860 | |
| 1861 | int visnum = vis - VisEffectscxx . . $ VisEffects.; |
| 1862 | int rot_angle; |
| 1863 | int bm_handle; |
| 1864 | |
| 1865 | fireballcxx . . $ fireball# *fb = &Fireballscxx . . $ Fireballs.[vis->idcxx . . $ vis_effect#id.]; |
| 1866 | |
| 1867 | if (fb->typecxx . . $ fireball#type. == FT_BILLOWcxx . . $ `Descent3/fireball_external.h:80:9`!) |
| 1868 | rot_angle = ((visnum * 5000) + (FrameCountcxx . . $ FrameCount. * 160)) % 65536; |
| 1869 | else if (vis->flagscxx . . $ vis_effect#flags. & VF_ATTACHEDcxx . . $ `Descent3/viseffect_external.h:70:9`!) |
| 1870 | rot_angle = 0; |
| 1871 | else if (vis->idcxx . . $ vis_effect#id. == RUBBLE1_INDEXcxx . . $ `Descent3/fireball_external.h:64:9`! || vis->idcxx . . $ vis_effect#id. == RUBBLE2_INDEXcxx . . $ `Descent3/fireball_external.h:65:9`!) |
| 1872 | rot_angle = ((visnum * 5000) + (FrameCountcxx . . $ FrameCount. * 860)) % 65536; |
| 1873 | else if (vis->idcxx . . $ vis_effect#id. == SUN_CORONA_INDEXcxx . . $ `Descent3/fireball_external.h:60:9`!) { |
| 1874 | rot_angle = ((visnum * 5000) + (FrameCountcxx . . $ FrameCount. * 500)) % 65536; |
| 1875 | size *= 1.0 + ((randcxx . . $ rand(9efc7249d839d30e).() % 10) / 100); |
| 1876 | } else |
| 1877 | rot_angle = (visnum * 5000) % 65536; |
| 1878 | |
| 1879 | norm_time = time_live / vis->lifetimecxx . . $ vis_effect#lifetime.; |
| 1880 | |
| 1881 | // TEMP!! |
| 1882 | if (vis->flagscxx . . $ vis_effect#flags. & VF_ATTACHEDcxx . . $ `Descent3/viseffect_external.h:70:9`!) { |
| 1883 | int int_time_live = time_live; |
| 1884 | norm_time = time_live - int_time_live; |
| 1885 | } |
| 1886 | |
| 1887 | if (norm_time >= 1) |
| 1888 | norm_time = .99999f; // don't go over! |
| 1889 | |
| 1890 | if (vis->flagscxx . . $ vis_effect#flags. & VF_EXPANDcxx . . $ `Descent3/viseffect_external.h:69:9`!) { |
| 1891 | size = (vis->sizecxx . . $ vis_effect#size. / 2) + ((vis->sizecxx . . $ vis_effect#size. * norm_time) / 2); |
| 1892 | } |
| 1893 | |
| 1894 | if (vis->idcxx . . $ vis_effect#id. == SMOKE_TRAIL_INDEXcxx . . $ `Descent3/fireball_external.h:32:9`!) // If its a smoke trail, get image from texture |
| 1895 | { |
| 1896 | int texnum = vis->custom_handlecxx . . $ vis_effect#custom_handle.; |
| 1897 | if (GameTexturescxx . . $ GameTextures.[texnum].flagscxx . . $ texture#flags. & TF_ANIMATEDcxx . . $ `Descent3/gametexture.h:207:9`!) { |
| 1898 | vclipcxx . . $ vclip# *vc = &GameVClipscxx . . $ GameVClips.[GameTexturescxx . . $ GameTextures.[texnum].bm_handlecxx . . $ texture#bm_handle.]; |
| 1899 | int int_frame = vc->num_framescxx . . $ vclip#num_frames. * norm_time; |
| 1900 | bm_handle = vc->framescxx . . $ vclip#frames.[int_frame]; |
| 1901 | } else |
| 1902 | bm_handle = GameTexturescxx . . $ GameTextures.[texnum].bm_handlecxx . . $ texture#bm_handle.; |
| 1903 | } else if (vis->idcxx . . $ vis_effect#id. == SPRAY_INDEXcxx . . $ `Descent3/fireball_external.h:40:9`!) { |
| 1904 | int vnum = vis->custom_handlecxx . . $ vis_effect#custom_handle.; |
| 1905 | vclipcxx . . $ vclip# *vc = &GameVClipscxx . . $ GameVClips.[vnum]; |
| 1906 | int int_frame = vc->num_framescxx . . $ vclip#num_frames. * norm_time; |
| 1907 | bm_handle = vc->framescxx . . $ vclip#frames.[int_frame]; |
| 1908 | |
| 1909 | // if (norm_time<.5) |
| 1910 | // size=1+((vis->size-1)*(norm_time)); |
| 1911 | } else if (vis->idcxx . . $ vis_effect#id. == CUSTOM_EXPLOSION_INDEXcxx . . $ `Descent3/fireball_external.h:33:9`! || vis->idcxx . . $ vis_effect#id. == PARTICLE_INDEXcxx . . $ `Descent3/fireball_external.h:45:9`!) // Do custom |
| 1912 | { |
| 1913 | if ((GameTexturescxx . . $ GameTextures.[vis->custom_handlecxx . . $ vis_effect#custom_handle.].flagscxx . . $ texture#flags. & TF_ANIMATEDcxx . . $ `Descent3/gametexture.h:207:9`!)) { |
| 1914 | int vnum = GameTexturescxx . . $ GameTextures.[vis->custom_handlecxx . . $ vis_effect#custom_handle.].bm_handlecxx . . $ texture#bm_handle.; |
| 1915 | vclipcxx . . $ vclip# *vc = &GameVClipscxx . . $ GameVClips.[vnum]; |
| 1916 | int int_frame = vc->num_framescxx . . $ vclip#num_frames. * norm_time; |
| 1917 | bm_handle = vc->framescxx . . $ vclip#frames.[int_frame]; |
| 1918 | } else |
| 1919 | bm_handle = GetTextureBitmapcxx . . $ GetTextureBitmap(6009f2e2e1989200).(vis->custom_handlecxx . . $ vis_effect#custom_handle., 0); |
| 1920 | } else if (fb->typecxx . . $ fireball#type. == FT_SPARKcxx . . $ `Descent3/fireball_external.h:81:9`!) // Do spark |
| 1921 | { |
| 1922 | bm_handle = fb->bm_handlecxx . . $ fireball#bm_handle.; |
| 1923 | size *= (1.0 - norm_time); |
| 1924 | |
| 1925 | } else if (vis->idcxx . . $ vis_effect#id. == SUN_CORONA_INDEXcxx . . $ `Descent3/fireball_external.h:60:9`! || vis->idcxx . . $ vis_effect#id. == MUZZLE_FLASH_INDEXcxx . . $ `Descent3/fireball_external.h:42:9`! || vis->idcxx . . $ vis_effect#id. == RUBBLE1_INDEXcxx . . $ `Descent3/fireball_external.h:64:9`! || |
| 1926 | vis->idcxx . . $ vis_effect#id. == RUBBLE2_INDEXcxx . . $ `Descent3/fireball_external.h:65:9`!) { |
| 1927 | bm_handle = fb->bm_handlecxx . . $ fireball#bm_handle.; |
| 1928 | } else { |
| 1929 | vclipcxx . . $ vclip# *vc = &GameVClipscxx . . $ GameVClips.[fb->bm_handlecxx . . $ fireball#bm_handle.]; |
| 1930 | int int_frame = vc->num_framescxx . . $ vclip#num_frames. * norm_time; |
| 1931 | bm_handle = vc->framescxx . . $ vclip#frames.[int_frame]; |
| 1932 | } |
| 1933 | |
| 1934 | if (fb->typecxx . . $ fireball#type. == FT_SMOKEcxx . . $ `Descent3/fireball_external.h:78:9`!) { |
| 1935 | if (norm_time > .3) { |
| 1936 | float temp_time = (norm_time - .3); |
| 1937 | temp_time /= .7f; |
| 1938 | |
| 1939 | if (vis->flagscxx . . $ vis_effect#flags. & VF_REVERSEcxx . . $ `Descent3/viseffect_external.h:68:9`!) |
| 1940 | size /= (1 + (temp_time * 2.3)); |
| 1941 | else |
| 1942 | size *= (1 + (temp_time * 2.3)); |
| 1943 | } |
| 1944 | } |
| 1945 | |
| 1946 | // Set some alpha |
| 1947 | if (vis->idcxx . . $ vis_effect#id. == SMOKE_TRAIL_INDEXcxx . . $ `Descent3/fireball_external.h:32:9`! || vis->idcxx . . $ vis_effect#id. == CUSTOM_EXPLOSION_INDEXcxx . . $ `Descent3/fireball_external.h:33:9`! || vis->idcxx . . $ vis_effect#id. == PARTICLE_INDEXcxx . . $ `Descent3/fireball_external.h:45:9`!) { |
| 1948 | if (GameTexturescxx . . $ GameTextures.[vis->custom_handlecxx . . $ vis_effect#custom_handle.].flagscxx . . $ texture#flags. & TF_SATURATEcxx . . $ `Descent3/gametexture.h:222:9`!) |
| 1949 | rend_SetAlphaTypecxx . . $ rend_SetAlphaType(4af4fd0e2b26c4ac).(AT_SATURATE_TEXTUREcxx . . $ `lib/renderer.h:408:9`!); |
| 1950 | else |
| 1951 | rend_SetAlphaTypecxx . . $ rend_SetAlphaType(4af4fd0e2b26c4ac).(ATF_CONSTANTcxx . . $ `lib/renderer.h:394:9`! + ATF_TEXTUREcxx . . $ `lib/renderer.h:395:9`!); |
| 1952 | } else if (vis->idcxx . . $ vis_effect#id. == BLACK_SMOKE_INDEXcxx . . $ `Descent3/fireball_external.h:30:9`!) { |
| 1953 | rend_SetAlphaTypecxx . . $ rend_SetAlphaType(4af4fd0e2b26c4ac).(AT_LIGHTMAP_BLENDcxx . . $ `lib/renderer.h:407:9`!); |
| 1954 | } else if ((fb->typecxx . . $ fireball#type. == FT_SMOKEcxx . . $ `Descent3/fireball_external.h:78:9`! && vis->idcxx . . $ vis_effect#id. != MED_SMOKE_INDEXcxx . . $ `Descent3/fireball_external.h:29:9`!) || vis->idcxx . . $ vis_effect#id. == RUBBLE1_INDEXcxx . . $ `Descent3/fireball_external.h:64:9`! || |
| 1955 | vis->idcxx . . $ vis_effect#id. == RUBBLE2_INDEXcxx . . $ `Descent3/fireball_external.h:65:9`!) { |
| 1956 | rend_SetAlphaTypecxx . . $ rend_SetAlphaType(4af4fd0e2b26c4ac).(ATF_CONSTANTcxx . . $ `lib/renderer.h:394:9`! + ATF_TEXTUREcxx . . $ `lib/renderer.h:395:9`!); |
| 1957 | } else |
| 1958 | rend_SetAlphaTypecxx . . $ rend_SetAlphaType(4af4fd0e2b26c4ac).(AT_SATURATE_TEXTUREcxx . . $ `lib/renderer.h:408:9`!); |
| 1959 | |
| 1960 | float val; |
| 1961 | if (norm_time > .5) |
| 1962 | val = 1.0 - ((norm_time - .5) / .5); |
| 1963 | else |
| 1964 | val = 1.0; |
| 1965 | |
| 1966 | // Cap size |
| 1967 | if (size > MAX_FIREBALL_SIZEcxx . . $ `Descent3/fireball.h:173:9`!) |
| 1968 | size = MAX_FIREBALL_SIZEcxx . . $ `Descent3/fireball.h:173:9`!; |
| 1969 | if ((vis->idcxx . . $ vis_effect#id. != BIG_EXPLOSION_INDEXcxx . . $ `Descent3/fireball_external.h:26:9`! && vis->idcxx . . $ vis_effect#id. != BLUE_EXPLOSION_INDEXcxx . . $ `Descent3/fireball_external.h:71:9`!) && size > (MAX_FIREBALL_SIZEcxx . . $ `Descent3/fireball.h:173:9`! / 2)) |
| 1970 | size = MAX_FIREBALL_SIZEcxx . . $ `Descent3/fireball.h:173:9`! / 2; |
| 1971 | |
| 1972 | if (vis->idcxx . . $ vis_effect#id. == SMOKE_TRAIL_INDEXcxx . . $ `Descent3/fireball_external.h:32:9`! || vis->idcxx . . $ vis_effect#id. == CUSTOM_EXPLOSION_INDEXcxx . . $ `Descent3/fireball_external.h:33:9`! || vis->idcxx . . $ vis_effect#id. == PARTICLE_INDEXcxx . . $ `Descent3/fireball_external.h:45:9`!) |
| 1973 | rend_SetAlphaValuecxx . . $ rend_SetAlphaValue(ac50b47256ae7414).(val * GameTexturescxx . . $ GameTextures.[vis->custom_handlecxx . . $ vis_effect#custom_handle.].alphacxx . . $ texture#alpha. * 255); |
| 1974 | else if (fb->typecxx . . $ fireball#type. == FT_SMOKEcxx . . $ `Descent3/fireball_external.h:78:9`!) |
| 1975 | rend_SetAlphaValuecxx . . $ rend_SetAlphaValue(ac50b47256ae7414).(val * SMOKE_ALPHAcxx . . $ `Descent3/fireball.h:171:9`! * 255); |
| 1976 | else if (vis->idcxx . . $ vis_effect#id. == RUBBLE1_INDEXcxx . . $ `Descent3/fireball_external.h:64:9`! || vis->idcxx . . $ vis_effect#id. == RUBBLE2_INDEXcxx . . $ `Descent3/fireball_external.h:65:9`!) |
| 1977 | rend_SetAlphaValuecxx . . $ rend_SetAlphaValue(ac50b47256ae7414).(255); |
| 1978 | else if (vis->idcxx . . $ vis_effect#id. == MUZZLE_FLASH_INDEXcxx . . $ `Descent3/fireball_external.h:42:9`!) |
| 1979 | rend_SetAlphaValuecxx . . $ rend_SetAlphaValue(ac50b47256ae7414).(128); |
| 1980 | else if (vis->flagscxx . . $ vis_effect#flags. & VF_ATTACHEDcxx . . $ `Descent3/viseffect_external.h:70:9`!) |
| 1981 | rend_SetAlphaValuecxx . . $ rend_SetAlphaValue(ac50b47256ae7414).(FIREBALL_ALPHAcxx . . $ `Descent3/fireball.h:169:9`! * 255); |
| 1982 | else |
| 1983 | rend_SetAlphaValuecxx . . $ rend_SetAlphaValue(ac50b47256ae7414).(val * FIREBALL_ALPHAcxx . . $ `Descent3/fireball.h:169:9`! * 255); |
| 1984 | |
| 1985 | rend_SetOverlayTypecxx . . $ rend_SetOverlayType(ac50b47256ae7414).(OT_NONEcxx . . $ `lib/renderer.h:333:9`!); |
| 1986 | |
| 1987 | if (!(vis->flagscxx . . $ vis_effect#flags. & VF_NO_Z_ADJUSTcxx . . $ `Descent3/viseffect_external.h:71:9`!)) |
| 1988 | rend_SetZBiascxx . . $ rend_SetZBias(9364e6e7bff7660).(-size); |
| 1989 | |
| 1990 | rend_SetZBufferWriteMaskcxx . . $ rend_SetZBufferWriteMask(d4f767463ce0a6b3).(0); |
| 1991 | rend_SetWrapTypecxx . . $ rend_SetWrapType(da524b148887c0e7).(WT_CLAMPcxx . . $ WT_CLAMP.); |
| 1992 | rend_SetLightingcxx . . $ rend_SetLighting(e55526c9d3dd1656).(LS_NONEcxx . . $ LS_NONE.); |
| 1993 | |
| 1994 | // Draw!! |
| 1995 | if (vis->idcxx . . $ vis_effect#id. == RUBBLE1_INDEXcxx . . $ `Descent3/fireball_external.h:64:9`! || vis->idcxx . . $ vis_effect#id. == RUBBLE2_INDEXcxx . . $ `Descent3/fireball_external.h:65:9`! || vis->idcxx . . $ vis_effect#id. == GRAY_SPARK_INDEXcxx . . $ `Descent3/fireball_external.h:72:9`!) { |
| 1996 | int color = GR_16_TO_COLORcxx . . $ GR_16_TO_COLOR(909d59720f161188).(vis->lighting_colorcxx . . $ vis_effect#lighting_color.); |
| 1997 | g3_DrawRotatedBitmapcxx . . $ g3_DrawRotatedBitmap(b3c51db2a67f6227).(&vis->poscxx . . $ vis_effect#pos., rot_angle, size, (size * bm_hcxx . . $ bm_h(9b79fb6aee4c0440).(bm_handle, 0)) / bm_wcxx . . $ bm_w(9b79fb6aee4c0440).(bm_handle, 0), bm_handle, |
| 1998 | color); |
| 1999 | } else { |
| 2000 | if (vis->flagscxx . . $ vis_effect#flags. & VF_PLANARcxx . . $ `Descent3/viseffect_external.h:67:9`!) |
| 2001 | g3_DrawPlanarRotatedBitmapcxx . . $ g3_DrawPlanarRotatedBitmap(71c6e0d12bc5318b).(&vis->poscxx . . $ vis_effect#pos., &vis->end_poscxx . . $ vis_effect#end_pos., rot_angle, size, |
| 2002 | (size * bm_hcxx . . $ bm_h(9b79fb6aee4c0440).(bm_handle, 0)) / bm_wcxx . . $ bm_w(9b79fb6aee4c0440).(bm_handle, 0), bm_handle); |
| 2003 | else |
| 2004 | g3_DrawRotatedBitmapcxx . . $ g3_DrawRotatedBitmap(b3c51db2a67f6227).(&vis->poscxx . . $ vis_effect#pos., rot_angle, size, (size * bm_hcxx . . $ bm_h(9b79fb6aee4c0440).(bm_handle, 0)) / bm_wcxx . . $ bm_w(9b79fb6aee4c0440).(bm_handle, 0), bm_handle); |
| 2005 | } |
| 2006 | |
| 2007 | rend_SetZBiascxx . . $ rend_SetZBias(9364e6e7bff7660).(0.0f); |
| 2008 | rend_SetZBufferWriteMaskcxx . . $ rend_SetZBufferWriteMask(d4f767463ce0a6b3).(1); |
| 2009 | |
| 2010 | rend_SetWrapTypecxx . . $ rend_SetWrapType(da524b148887c0e7).(WT_WRAPcxx . . $ WT_WRAP.); |
| 2011 | } |
| 2012 | |
| 2013 | void VisEffectSetDeadFlagcxx . . $ VisEffectSetDeadFlag(6089e83781d51a35).(vis_effectcxx . . $ vis_effect# *vis) { |
| 2014 | if (vis->flagscxx . . $ vis_effect#flags. & VF_DEADcxx . . $ `Descent3/viseffect_external.h:66:9`!) |
| 2015 | return; |
| 2016 | if (vis->typecxx . . $ vis_effect#type. == VIS_NONEcxx . . $ `Descent3/viseffect_external.h:60:9`!) |
| 2017 | return; |
| 2018 | |
| 2019 | vis->flagscxx . . $ vis_effect#flags. |= VF_DEADcxx . . $ `Descent3/viseffect_external.h:66:9`!; |
| 2020 | |
| 2021 | VisDeadListcxx . . $ VisDeadList.[NumVisDeadcxx . . $ NumVisDead.++] = vis - VisEffectscxx . . $ VisEffects.; |
| 2022 | } |
| 2023 | |
| 2024 | // Moves |
| 2025 | void VisEffectMoveOnecxx . . $ VisEffectMoveOne(6089e83781d51a35).(vis_effectcxx . . $ vis_effect# *vis) { |
| 2026 | if (vis->flagscxx . . $ vis_effect#flags. & VF_USES_LIFELEFTcxx . . $ `Descent3/viseffect_external.h:64:9`!) |
| 2027 | vis->lifeleftcxx . . $ vis_effect#lifeleft. -= Frametimecxx . . $ Frametime.; //...inevitable countdown towards death |
| 2028 | |
| 2029 | // Chris, do your stuff here |
| 2030 | if (vis->movement_typecxx . . $ vis_effect#movement_type. == MT_PHYSICScxx . . $ `Descent3/object_external.h:234:9`!) |
| 2031 | do_vis_physics_simcxx . . $ do_vis_physics_sim(6089e83781d51a35).(vis); |
| 2032 | |
| 2033 | if (vis->flagscxx . . $ vis_effect#flags. & VF_USES_LIFELEFTcxx . . $ `Descent3/viseffect_external.h:64:9`!) { |
| 2034 | if (vis->lifeleftcxx . . $ vis_effect#lifeleft. < 0) |
| 2035 | VisEffectSetDeadFlagcxx . . $ VisEffectSetDeadFlag(6089e83781d51a35).(vis); |
| 2036 | } |
| 2037 | |
| 2038 | if (vis->idcxx . . $ vis_effect#id. == SNOWFLAKE_INDEXcxx . . $ `Descent3/fireball_external.h:61:9`!) { |
| 2039 | Weathercxx . . $ Weather..snowflakes_to_createcxx . . $ weather#snowflakes_to_create.++; |
| 2040 | |
| 2041 | vis->poscxx . . $ vis_effect#pos. +=cxx . . $ `operator+=`(801a8d6f7ab7bef9). vis->velocitycxx . . $ vis_effect#velocity. *cxx . . $ `operator*`(252247219a31502c). Frametimecxx . . $ Frametime.; |
| 2042 | |
| 2043 | if (vis->poscxx . . $ vis_effect#pos..ycxx . . $ vector#y. < 1) |
| 2044 | VisEffectSetDeadFlagcxx . . $ VisEffectSetDeadFlag(6089e83781d51a35).(vis); |
| 2045 | } |
| 2046 | |
| 2047 | // Do attached viseffect stuff here |
| 2048 | if (vis->flagscxx . . $ vis_effect#flags. & VF_ATTACHEDcxx . . $ `Descent3/viseffect_external.h:70:9`!) { |
| 2049 | int objnum = vis->attach_infocxx . . $ vis_effect#attach_info..obj_handlecxx . . $ vis_attach_info#obj_handle. & HANDLE_OBJNUM_MASKcxx . . $ `Descent3/object.h:642:9`!; |
| 2050 | uint32_tcxx . . $ uint32_t# sig = vis->attach_infocxx . . $ vis_effect#attach_info..obj_handlecxx . . $ vis_attach_info#obj_handle. & HANDLE_COUNT_MASKcxx . . $ `Descent3/object.h:643:9`!; |
| 2051 | objectcxx . . $ object# *obj = &Objectscxx . . $ Objects.[objnum]; |
| 2052 | |
| 2053 | if ((obj->flagscxx . . $ object#flags. & OF_DEADcxx . . $ `Descent3/object_external.h:270:9`!) || (obj->handlecxx . . $ object#handle. & HANDLE_COUNT_MASKcxx . . $ `Descent3/object.h:643:9`!) != sig) { |
| 2054 | // The object we're attached to doesn't exist anymore |
| 2055 | VisEffectSetDeadFlagcxx . . $ VisEffectSetDeadFlag(6089e83781d51a35).(vis); |
| 2056 | |
| 2057 | } else if (obj->typecxx . . $ object#type. == OBJ_PLAYERcxx . . $ `Descent3/object_external.h:164:9`! && (Playerscxx . . $ Players.[obj->idcxx . . $ object#id.].flagscxx . . $ player#flags. & (PLAYER_FLAGS_DYINGcxx . . $ `Descent3/player_external.h:80:9`! | PLAYER_FLAGS_DEADcxx . . $ `Descent3/player_external.h:81:9`!))) { |
| 2058 | // The object we're attached to doesn't exist anymore |
| 2059 | VisEffectSetDeadFlagcxx . . $ VisEffectSetDeadFlag(6089e83781d51a35).(vis); |
| 2060 | } else { |
| 2061 | if (vis->idcxx . . $ vis_effect#id. == THICK_LIGHTNING_INDEXcxx . . $ `Descent3/fireball_external.h:62:9`!) { |
| 2062 | if (vis->flagscxx . . $ vis_effect#flags. & VF_PLANARcxx . . $ `Descent3/viseffect_external.h:67:9`!) { |
| 2063 | // Do object to object attachment |
| 2064 | int dest_objnum = vis->attach_infocxx . . $ vis_effect#attach_info..dest_objhandlecxx . . $ vis_attach_info#dest_objhandle. & HANDLE_OBJNUM_MASKcxx . . $ `Descent3/object.h:642:9`!; |
| 2065 | uint32_tcxx . . $ uint32_t# dest_sig = vis->attach_infocxx . . $ vis_effect#attach_info..dest_objhandlecxx . . $ vis_attach_info#dest_objhandle. & HANDLE_COUNT_MASKcxx . . $ `Descent3/object.h:643:9`!; |
| 2066 | objectcxx . . $ object# *dest_obj = &Objectscxx . . $ Objects.[dest_objnum]; |
| 2067 | |
| 2068 | if ((dest_obj->flagscxx . . $ object#flags. & OF_DEADcxx . . $ `Descent3/object_external.h:270:9`!) || (dest_obj->handlecxx . . $ object#handle. & HANDLE_COUNT_MASKcxx . . $ `Descent3/object.h:643:9`!) != dest_sig) { |
| 2069 | // The object we're attached to doesn't exist anymore |
| 2070 | VisEffectSetDeadFlagcxx . . $ VisEffectSetDeadFlag(6089e83781d51a35).(vis); |
| 2071 | return; |
| 2072 | } |
| 2073 | |
| 2074 | if (dest_obj->typecxx . . $ object#type. == OBJ_PLAYERcxx . . $ `Descent3/object_external.h:164:9`! && |
| 2075 | (Playerscxx . . $ Players.[dest_obj->idcxx . . $ object#id.].flagscxx . . $ player#flags. & (PLAYER_FLAGS_DYINGcxx . . $ `Descent3/player_external.h:80:9`! | PLAYER_FLAGS_DEADcxx . . $ `Descent3/player_external.h:81:9`!))) { |
| 2076 | VisEffectSetDeadFlagcxx . . $ VisEffectSetDeadFlag(6089e83781d51a35).(vis); |
| 2077 | return; |
| 2078 | } |
| 2079 | |
| 2080 | vis->poscxx . . $ vis_effect#pos. =cxx . . $ vector#`operator=`(a48bc7e93a8dae5e). obj->poscxx . . $ object#pos.; |
| 2081 | vis->end_poscxx . . $ vis_effect#end_pos. =cxx . . $ vector#`operator=`(a48bc7e93a8dae5e). dest_obj->poscxx . . $ object#pos.; |
| 2082 | |
| 2083 | // If were are shooting to the exact center of the viewer object then move |
| 2084 | // the positions a little bit or it will look wrong: |
| 2085 | if (obj == Viewer_objectcxx . . $ Viewer_object.) { |
| 2086 | vis->poscxx . . $ vis_effect#pos. -=cxx . . $ `operator-=`(801a8d6f7ab7bef9). (obj->orientcxx . . $ object#orient..uveccxx . . $ matrix#uvec. *cxx . . $ `operator*`(252247219a31502c). .1f); |
| 2087 | } |
| 2088 | |
| 2089 | if (dest_obj == Viewer_objectcxx . . $ Viewer_object.) { |
| 2090 | vis->end_poscxx . . $ vis_effect#end_pos. -=cxx . . $ `operator-=`(801a8d6f7ab7bef9). (dest_obj->orientcxx . . $ object#orient..uveccxx . . $ matrix#uvec. *cxx . . $ `operator*`(252247219a31502c). .1f); |
| 2091 | } |
| 2092 | |
| 2093 | } else { |
| 2094 | if (obj->rtypecxx . . $ object#rtype..pobj_infocxx . . $ object#$anonymous_type_10#pobj_info..model_numcxx . . $ polyobj_info#model_num. != vis->attach_infocxx . . $ vis_effect#attach_info..modelnumcxx . . $ vis_attach_info#modelnum.) { |
| 2095 | VisEffectSetDeadFlagcxx . . $ VisEffectSetDeadFlag(6089e83781d51a35).(vis); |
| 2096 | } else { |
| 2097 | WeaponCalcGuncxx . . $ WeaponCalcGun(85e3752e9562a225).(&vis->poscxx . . $ vis_effect#pos., NULLcxx . . $ `<external>/15298297234472979974/stddef.h:416:9`!, obj, vis->attach_infocxx . . $ vis_effect#attach_info..vertnumcxx . . $ vis_attach_info#vertnum.); |
| 2098 | WeaponCalcGuncxx . . $ WeaponCalcGun(85e3752e9562a225).(&vis->end_poscxx . . $ vis_effect#end_pos., NULLcxx . . $ `<external>/15298297234472979974/stddef.h:416:9`!, obj, vis->attach_infocxx . . $ vis_effect#attach_info..end_vertnumcxx . . $ vis_attach_info#end_vertnum.); |
| 2099 | } |
| 2100 | } |
| 2101 | } else { |
| 2102 | float normalized_time[MAX_SUBOBJECTScxx . . $ `lib/polymodel_external.h:76:9`!]; |
| 2103 | |
| 2104 | if (obj->lowest_attached_viscxx . . $ object#lowest_attached_vis. == -1) { |
| 2105 | obj->lowest_attached_viscxx . . $ object#lowest_attached_vis. = vis - VisEffectscxx . . $ VisEffects.; |
| 2106 | poly_modelcxx . . $ poly_model# *pm = &Poly_modelscxx . . $ Poly_models.[obj->rtypecxx . . $ object#rtype..pobj_infocxx . . $ object#$anonymous_type_10#pobj_info..model_numcxx . . $ polyobj_info#model_num.]; |
| 2107 | |
| 2108 | int i; |
| 2109 | |
| 2110 | SetNormalizedTimeObjcxx . . $ SetNormalizedTimeObj(8af4de573afdac78).(obj, normalized_time); |
| 2111 | SetModelAnglescxx . . $ SetModelAngles(ed97be8d9db46e36).(pm, normalized_time); |
| 2112 | SetModelInterpPoscxx . . $ SetModelInterpPos(ed97be8d9db46e36).(pm, normalized_time); |
| 2113 | |
| 2114 | for (i = vis - VisEffectscxx . . $ VisEffects.; i <= Highest_vis_effect_indexcxx . . $ Highest_vis_effect_index.; i++) { |
| 2115 | vis_effectcxx . . $ vis_effect# *this_vis = &VisEffectscxx . . $ VisEffects.[i]; |
| 2116 | if (this_vis->typecxx . . $ vis_effect#type. != VIS_NONEcxx . . $ `Descent3/viseffect_external.h:60:9`! && (this_vis->flagscxx . . $ vis_effect#flags. & VF_ATTACHEDcxx . . $ `Descent3/viseffect_external.h:70:9`!) && |
| 2117 | ((this_vis->attach_infocxx . . $ vis_effect#attach_info..obj_handlecxx . . $ vis_attach_info#obj_handle. & HANDLE_OBJNUM_MASKcxx . . $ `Descent3/object.h:642:9`!) == objnum) && |
| 2118 | this_vis->idcxx . . $ vis_effect#id. != THICK_LIGHTNING_INDEXcxx . . $ `Descent3/fireball_external.h:62:9`!) { |
| 2119 | bsp_infocxx . . $ bsp_info# *sm = &pm->submodelcxx . . $ poly_model#submodel.[this_vis->attach_infocxx . . $ vis_effect#attach_info..subnumcxx . . $ vis_attach_info#subnum.]; |
| 2120 | GetPolyModelPointInWorldcxx . . $ GetPolyModelPointInWorld(fee16eb52aacf77f).(&this_vis->poscxx . . $ vis_effect#pos., pm, &obj->poscxx . . $ object#pos., &obj->orientcxx . . $ object#orient., this_vis->attach_infocxx . . $ vis_effect#attach_info..subnumcxx . . $ vis_attach_info#subnum., |
| 2121 | normalized_time, &sm->vertscxx . . $ bsp_info#verts.[this_vis->attach_infocxx . . $ vis_effect#attach_info..vertnumcxx . . $ vis_attach_info#vertnum.], NULLcxx . . $ `<external>/15298297234472979974/stddef.h:416:9`!); |
| 2122 | |
| 2123 | if (this_vis->attach_infocxx . . $ vis_effect#attach_info..end_vertnumcxx . . $ vis_attach_info#end_vertnum. != -1) |
| 2124 | GetPolyModelPointInWorldcxx . . $ GetPolyModelPointInWorld(fee16eb52aacf77f).(&this_vis->end_poscxx . . $ vis_effect#end_pos., pm, &obj->poscxx . . $ object#pos., &obj->orientcxx . . $ object#orient., this_vis->attach_infocxx . . $ vis_effect#attach_info..subnumcxx . . $ vis_attach_info#subnum., |
| 2125 | normalized_time, &sm->vertscxx . . $ bsp_info#verts.[this_vis->attach_infocxx . . $ vis_effect#attach_info..end_vertnumcxx . . $ vis_attach_info#end_vertnum.], NULLcxx . . $ `<external>/15298297234472979974/stddef.h:416:9`!); |
| 2126 | } |
| 2127 | } |
| 2128 | } |
| 2129 | } |
| 2130 | |
| 2131 | // Relink if need be |
| 2132 | if (obj->roomnumcxx . . $ object#roomnum. != vis->roomnumcxx . . $ vis_effect#roomnum.) |
| 2133 | VisEffectRelinkcxx . . $ VisEffectRelink(3e454b8ccf442868).(vis - VisEffectscxx . . $ VisEffects., obj->roomnumcxx . . $ object#roomnum.); |
| 2134 | } |
| 2135 | } |
| 2136 | |
| 2137 | // Do vis effect explosion lighting |
| 2138 | if (Detail_settingscxx . . $ Detail_settings..Dynamic_lightingcxx . . $ tDetailSettings#Dynamic_lighting. && vis->lighting_colorcxx . . $ vis_effect#lighting_color. != 0 && (vis->lighting_colorcxx . . $ vis_effect#lighting_color. & OPAQUE_FLAGcxx . . $ `lib/grdefs.h:72:9`!) && |
| 2139 | (vis->flagscxx . . $ vis_effect#flags. & VF_USES_LIFELEFTcxx . . $ `Descent3/viseffect_external.h:64:9`!) && !(vis->flagscxx . . $ vis_effect#flags. & VF_DEADcxx . . $ `Descent3/viseffect_external.h:66:9`!)) { |
| 2140 | float scalar; |
| 2141 | |
| 2142 | scalar = (vis->lifetimecxx . . $ vis_effect#lifetime. - vis->lifeleftcxx . . $ vis_effect#lifeleft.) / vis->lifetimecxx . . $ vis_effect#lifetime.; |
| 2143 | |
| 2144 | if (scalar > .5) { |
| 2145 | scalar -= .5; |
| 2146 | |
| 2147 | scalar = 1.0 - (scalar / .5); |
| 2148 | } else { |
| 2149 | scalar *= 2; |
| 2150 | } |
| 2151 | |
| 2152 | if (scalar > .05) { |
| 2153 | int color = GR_16_TO_COLORcxx . . $ GR_16_TO_COLOR(909d59720f161188).(vis->lighting_colorcxx . . $ vis_effect#lighting_color.); |
| 2154 | float r = (GR_COLOR_REDcxx . . $ GR_COLOR_RED(4c679297bf94b9eb).(color)) / 255.0; |
| 2155 | float g = (GR_COLOR_GREENcxx . . $ GR_COLOR_GREEN(4c679297bf94b9eb).(color)) / 255.0; |
| 2156 | float b = (GR_COLOR_BLUEcxx . . $ GR_COLOR_BLUE(4c679297bf94b9eb).(color)) / 255.0; |
| 2157 | |
| 2158 | if (ROOMNUM_OUTSIDEcxx . . $ `lib/object_external_struct.h:127:9`!(vis->roomnum)) { |
| 2159 | int cellnum = CELLNUMcxx . . $ `lib/object_external_struct.h:121:9`!(vis->roomnum); |
| 2160 | |
| 2161 | if (cellnum >= 0 && cellnum < TERRAIN_WIDTHcxx . . $ `Descent3/terrain.h:31:9`! * TERRAIN_DEPTHcxx . . $ `Descent3/terrain.h:32:9`!) |
| 2162 | ApplyLightingToTerraincxx . . $ ApplyLightingToTerrain(31a30e6d6b9dd744).(&vis->poscxx . . $ vis_effect#pos., cellnum, vis->sizecxx . . $ vis_effect#size. * scalar * 3, r, g, b); |
| 2163 | else |
| 2164 | mprintfcxx . . $ `ddebug/mono.h:82:9`!(0, "Vis effect not in world!\n"); |
| 2165 | } else { |
| 2166 | if (vis->roomnumcxx . . $ vis_effect#roomnum. >= 0 && vis->roomnumcxx . . $ vis_effect#roomnum. <= Highest_room_indexcxx . . $ Highest_room_index. && Roomscxx . . $ Rooms.[vis->roomnumcxx . . $ vis_effect#roomnum.].usedcxx . . $ room#used.) |
| 2167 | ApplyLightingToRoomscxx . . $ ApplyLightingToRooms(31a30e6d6b9dd744).(&vis->poscxx . . $ vis_effect#pos., vis->roomnumcxx . . $ vis_effect#roomnum., vis->sizecxx . . $ vis_effect#size. * scalar * 3, r, g, b); |
| 2168 | } |
| 2169 | } |
| 2170 | } |
| 2171 | |
| 2172 | // Link this effect to the viewer if needed |
| 2173 | if (vis->flagscxx . . $ vis_effect#flags. & VF_LINK_TO_VIEWERcxx . . $ `Descent3/viseffect_external.h:72:9`!) { |
| 2174 | if (vis->roomnumcxx . . $ vis_effect#roomnum. != Viewer_objectcxx . . $ Viewer_object.->roomnumcxx . . $ object#roomnum.) { |
| 2175 | VisEffectRelinkcxx . . $ VisEffectRelink(3e454b8ccf442868).(vis - VisEffectscxx . . $ VisEffects., Viewer_objectcxx . . $ Viewer_object.->roomnumcxx . . $ object#roomnum.); |
| 2176 | } |
| 2177 | } |
| 2178 | } |
| 2179 | |
| 2180 | // Moves our visuals |
| 2181 | void VisEffectMoveAllcxx . . $ VisEffectMoveAll(49f6e7a06ebc5aa8).() { |
| 2182 | int i; |
| 2183 | |
| 2184 | for (i = 0; i <= Highest_vis_effect_indexcxx . . $ Highest_vis_effect_index.; i++) { |
| 2185 | if (VisEffectscxx . . $ VisEffects.[i].typecxx . . $ vis_effect#type. != VIS_NONEcxx . . $ `Descent3/viseffect_external.h:60:9`!) |
| 2186 | VisEffectMoveOnecxx . . $ VisEffectMoveOne(6089e83781d51a35).(&VisEffectscxx . . $ VisEffects.[i]); |
| 2187 | } |
| 2188 | } |
| 2189 | |
| 2190 | /* |
| 2191 | // Attaches viseffects that move with an object |
| 2192 | void AttachRandomVisEffectsToObject (int num,int handle,object *obj) |
| 2193 | { |
| 2194 | int i; |
| 2195 | vector zero_pos={0,0,0}; |
| 2196 | poly_model *pm = &Poly_models[obj->rtype.pobj_info.model_num]; |
| 2197 | |
| 2198 | |
| 2199 | |
| 2200 | for (i=0;i<num;i++) |
| 2201 | { |
| 2202 | |
| 2203 | int visnum=VisEffectCreate(VIS_FIREBALL,NAPALM_BALL_INDEX,obj->roomnum,&zero_pos); |
| 2204 | if (visnum>=0) |
| 2205 | { |
| 2206 | vis_effect *vis=&VisEffects[visnum]; |
| 2207 | vis->size=1.0; |
| 2208 | vis->lifetime=15.0; |
| 2209 | vis->lifeleft=15.0; |
| 2210 | vis->flags |=VF_ATTACHED; |
| 2211 | vis->attach_info.obj_handle=obj->handle; |
| 2212 | |
| 2213 | int subnum=ps_rand()%pm->n_models; |
| 2214 | bsp_info *sm=&pm->submodel[subnum]; |
| 2215 | |
| 2216 | vis->attach_info.subnum=subnum; |
| 2217 | vis->attach_info.vertnum=ps_rand()%sm->nverts; |
| 2218 | |
| 2219 | } |
| 2220 | } |
| 2221 | }*/ |
| 2222 | |
| 2223 | // Attaches viseffects that move with an object |
| 2224 | void AttachRandomNapalmEffectsToObjectcxx . . $ AttachRandomNapalmEffectsToObject(419c470199a90a97).(objectcxx . . $ object# *obj) { |
| 2225 | if (obj->flagscxx . . $ object#flags. & OF_DEADcxx . . $ `Descent3/object_external.h:270:9`!) |
| 2226 | return; |
| 2227 | |
| 2228 | vectorcxx . . $ vector# velocity_norm = obj->mtypecxx . . $ object#mtype..phys_infocxx . . $ object#$anonymous_type_8#phys_info..velocitycxx . . $ physics_info#velocity.; |
| 2229 | vm_NormalizeVectorcxx . . $ vm_NormalizeVector(4939a7e530383cd4).(&velocity_norm); |
| 2230 | vectorcxx . . $ vector# pos = obj->poscxx . . $ object#pos. -cxx . . $ operator-(b77b703cd1e43e33). (velocity_norm *cxx . . $ `operator*`(252247219a31502c). (obj->sizecxx . . $ object#size. / 2)); |
| 2231 | |
| 2232 | if (obj->movement_typecxx . . $ object#movement_type. == MT_PHYSICScxx . . $ `Descent3/object_external.h:234:9`! && (OBJECT_OUTSIDEcxx . . $ `lib/object_external_struct.h:130:9`!(obj) && (ps_randcxx . . $ ps_rand(b126dc7c1de90089).() % 3) == 0) || (ps_randcxx . . $ ps_rand(b126dc7c1de90089).() % 3) == 0) |
| 2233 | CreateFireballcxx . . $ CreateFireball(2a769cac3223e33b).(&pos, BLACK_SMOKE_INDEXcxx . . $ `Descent3/fireball_external.h:30:9`!, obj->roomnumcxx . . $ object#roomnum., VISUAL_FIREBALLcxx . . $ `Descent3/fireball.h:165:9`!); |
| 2234 | |
| 2235 | float size_scalar = obj->sizecxx . . $ object#size. / 7.0; |
| 2236 | |
| 2237 | size_scalar = std::clampcxx . . $ std/clamp(3dbe0c69cb86ae06).(size_scalar, 1.0f, 4.0f); |
| 2238 | |
| 2239 | // Create an explosion that follows every now and then |
| 2240 | if ((ps_randcxx . . $ ps_rand(b126dc7c1de90089).() % 3) == 0) { |
| 2241 | if (!(obj->flagscxx . . $ object#flags. & OF_POLYGON_OBJECTcxx . . $ `Descent3/object_external.h:281:9`!)) |
| 2242 | return; |
| 2243 | |
| 2244 | int num = 1; |
| 2245 | |
| 2246 | num += (obj->sizecxx . . $ object#size. / 15); |
| 2247 | |
| 2248 | for (int i = 0; i < num; i++) { |
| 2249 | vectorcxx . . $ vector# dest; |
| 2250 | poly_modelcxx . . $ poly_model# *pm = &Poly_modelscxx . . $ Poly_models.[obj->rtypecxx . . $ object#rtype..pobj_infocxx . . $ object#$anonymous_type_10#pobj_info..model_numcxx . . $ polyobj_info#model_num.]; |
| 2251 | |
| 2252 | if (pm->n_modelscxx . . $ poly_model#n_models. == 0) |
| 2253 | return; |
| 2254 | |
| 2255 | int subnum = ps_randcxx . . $ ps_rand(b126dc7c1de90089).() % pm->n_modelscxx . . $ poly_model#n_models.; |
| 2256 | |
| 2257 | if (IsNonRenderableSubmodelcxx . . $ IsNonRenderableSubmodel(bb32db98789388a4).(pm, subnum)) |
| 2258 | continue; |
| 2259 | |
| 2260 | bsp_infocxx . . $ bsp_info# *sm = &pm->submodelcxx . . $ poly_model#submodel.[subnum]; |
| 2261 | |
| 2262 | if (sm->nvertscxx . . $ bsp_info#nverts. == 0) |
| 2263 | return; |
| 2264 | |
| 2265 | int vertnum = ps_randcxx . . $ ps_rand(b126dc7c1de90089).() % sm->nvertscxx . . $ bsp_info#nverts.; |
| 2266 | |
| 2267 | GetPolyModelPointInWorldcxx . . $ GetPolyModelPointInWorld(89309ad7c08ec4a9).(&dest, &Poly_modelscxx . . $ Poly_models.[obj->rtypecxx . . $ object#rtype..pobj_infocxx . . $ object#$anonymous_type_10#pobj_info..model_numcxx . . $ polyobj_info#model_num.], &obj->poscxx . . $ object#pos., &obj->orientcxx . . $ object#orient., subnum, |
| 2268 | &sm->vertscxx . . $ bsp_info#verts.[vertnum]); |
| 2269 | int visnum = VisEffectCreatecxx . . $ VisEffectCreate(20e4831b18f6895c).(VIS_FIREBALLcxx . . $ `Descent3/viseffect_external.h:61:9`!, GetRandomSmallExplosioncxx . . $ GetRandomSmallExplosion(b126dc7c1de90089).(), obj->roomnumcxx . . $ object#roomnum., &dest); |
| 2270 | if (visnum == -1) |
| 2271 | return; |
| 2272 | |
| 2273 | VisEffectscxx . . $ VisEffects.[visnum].sizecxx . . $ vis_effect#size. += ((ps_randcxx . . $ ps_rand(b126dc7c1de90089).() % 20) / 20.0) * 1.0; |
| 2274 | |
| 2275 | VisEffectscxx . . $ VisEffects.[visnum].sizecxx . . $ vis_effect#size. *= size_scalar; |
| 2276 | |
| 2277 | if ((ps_randcxx . . $ ps_rand(b126dc7c1de90089).() % 2)) { |
| 2278 | if (obj->movement_typecxx . . $ object#movement_type. == MT_PHYSICScxx . . $ `Descent3/object_external.h:234:9`!) { |
| 2279 | VisEffectscxx . . $ VisEffects.[visnum].movement_typecxx . . $ vis_effect#movement_type. = MT_PHYSICScxx . . $ `Descent3/object_external.h:234:9`!; |
| 2280 | VisEffectscxx . . $ VisEffects.[visnum].velocitycxx . . $ vis_effect#velocity. =cxx . . $ vector#`operator=`(a48bc7e93a8dae5e). obj->mtypecxx . . $ object#mtype..phys_infocxx . . $ object#$anonymous_type_8#phys_info..velocitycxx . . $ physics_info#velocity.; |
| 2281 | VisEffectscxx . . $ VisEffects.[visnum].masscxx . . $ vis_effect#mass. = obj->mtypecxx . . $ object#mtype..phys_infocxx . . $ object#$anonymous_type_8#phys_info..masscxx . . $ physics_info#mass.; |
| 2282 | VisEffectscxx . . $ VisEffects.[visnum].dragcxx . . $ vis_effect#drag. = obj->mtypecxx . . $ object#mtype..phys_infocxx . . $ object#$anonymous_type_8#phys_info..dragcxx . . $ physics_info#drag.; |
| 2283 | } |
| 2284 | } |
| 2285 | } |
| 2286 | } |
| 2287 | } |