| 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.h $ |
| 21 | * $Revision: 33 $ |
| 22 | * $Date: 3/20/00 1:35p $ |
| 23 | * $Author: Matt $ |
| 24 | * |
| 25 | * Header for viseffect.cpp |
| 26 | * |
| 27 | * $Log: /DescentIII/Main/viseffect.h $ |
| 28 | * |
| 29 | * 33 3/20/00 1:35p Matt |
| 30 | * Merge of Duane's post-1.3 changes. |
| 31 | * Moved max_vis_effects (the variable, not the constant) from viseffect.h |
| 32 | * to viseffect_external.h. |
| 33 | * |
| 34 | * 31 10/21/99 9:27p Jeff |
| 35 | * B.A. Macintosh code merge |
| 36 | * |
| 37 | * 30 4/30/99 7:37p Jeff |
| 38 | * created viseffect_external.h |
| 39 | * |
| 40 | * 29 4/19/99 3:17p Jason |
| 41 | * made real vis effects work |
| 42 | * |
| 43 | * 28 3/31/99 11:40a Jason |
| 44 | * added support for attached thick lightning |
| 45 | * |
| 46 | * 27 3/23/99 4:10p Jason |
| 47 | * more tweaks for line sparks |
| 48 | * |
| 49 | * 26 3/23/99 12:50p Jason |
| 50 | * added line sparks |
| 51 | * |
| 52 | * 25 12/11/98 5:08p Jason |
| 53 | * changed mass driver effect |
| 54 | * |
| 55 | * 24 9/29/98 7:15p Jason |
| 56 | * added axis billboards |
| 57 | * |
| 58 | * 23 9/18/98 8:23p Jason |
| 59 | * fixed insidious vis effect errors |
| 60 | * |
| 61 | * 22 9/17/98 3:03p Jason |
| 62 | * added lightning and invul hit effects |
| 63 | * |
| 64 | * 21 6/23/98 3:34p Jason |
| 65 | * added cool lighting effect to gravity field |
| 66 | * |
| 67 | * 20 6/22/98 6:52p Jason |
| 68 | * changed gravity field effect somewhat |
| 69 | * |
| 70 | * 19 6/12/98 5:14p Jason |
| 71 | * made viseffects deal with zbuffer better |
| 72 | * |
| 73 | * 18 4/29/98 11:38a Jason |
| 74 | * added some weather effects (first pass) |
| 75 | * |
| 76 | * 17 4/19/98 5:00p Jason |
| 77 | * added cool napalm effect, plus made object effects dynamically |
| 78 | * allocated |
| 79 | * |
| 80 | * 16 4/15/98 2:33p Jason |
| 81 | * changed some smoke trail stuff |
| 82 | * |
| 83 | * 15 4/15/98 12:22p Jason |
| 84 | * lots of miscellaneous stuff pertaining to lighting and vis effects |
| 85 | * |
| 86 | * 14 4/10/98 12:39p Jason |
| 87 | * added expanding explosion bitmaps |
| 88 | * |
| 89 | * 13 4/07/98 3:31p Jason |
| 90 | * got particle effects working with weapons |
| 91 | * |
| 92 | * 12 4/07/98 12:54p Jason |
| 93 | * changes for viseffects and multiplayer dll |
| 94 | * |
| 95 | * 11 2/16/98 2:37p Jason |
| 96 | * added real viseffects |
| 97 | * |
| 98 | * 10 2/15/98 1:21a Jason |
| 99 | * doubled the amount of viseffects |
| 100 | * |
| 101 | * 9 2/04/98 9:28p Jason |
| 102 | * added some new weapons effects |
| 103 | * |
| 104 | * 8 2/04/98 6:58p Matt |
| 105 | * Fixed viseffect rendering on terrain. |
| 106 | * |
| 107 | * 7 2/04/98 6:09p Matt |
| 108 | * Changed object room number to indicate a terrain cell via a flag. Got |
| 109 | * rid of the object flag which used to indicate terrain. |
| 110 | * |
| 111 | */ |
| 112 | |
| 113 | #ifndef VIS_EFFECT_H |
| 114 | #define VIS_EFFECT_H |
| 115 | |
| 116 | #include "viseffect_external.h" |
| 117 | |
| 118 | extern vis_effect *VisEffects; |
| 119 | extern int Highest_vis_effect_index; |
| 120 | |
| 121 | // Returns the next free viseffect |
| 122 | int VisEffectAllocate(); |
| 123 | |
| 124 | // Frees up a viseffect for use |
| 125 | int VisEffectFree(int visnum); |
| 126 | |
| 127 | int VisEffectInitType(vis_effect *vis); |
| 128 | |
| 129 | // initialize a new viseffect. adds to the list for the given room |
| 130 | // returns the object number |
| 131 | int VisEffectCreate(uint8_t type, uint8_t id, int roomnum, vector *pos); |
| 132 | |
| 133 | // link the viseffect into the list for its room |
| 134 | // Does nothing for effects over terrain |
| 135 | void VisEffectLink(int visnum, int roomnum); |
| 136 | |
| 137 | // Unlinks a viseffect from a room |
| 138 | // Does nothing for terrain |
| 139 | void VisEffectUnlink(int visnum); |
| 140 | |
| 141 | // when an effect has moved into a new room, this function unlinks it |
| 142 | // from its old room and links it into the new room |
| 143 | void VisEffectRelink(int visnum, int newroomnum); |
| 144 | |
| 145 | // Frees all the vis effects that are currently in use |
| 146 | void FreeAllVisEffects(); |
| 147 | |
| 148 | // Goes through our array and clears the slots out |
| 149 | void InitVisEffects(); |
| 150 | |
| 151 | // remove viseffect from the world |
| 152 | void VisEffectDelete(int visnum); |
| 153 | |
| 154 | // Kills all the effects that are dead |
| 155 | void VisEffectDeleteDead(); |
| 156 | |
| 157 | // Moves our visuals |
| 158 | void VisEffectMoveAll(); |
| 159 | |
| 160 | // Renders a vis effect |
| 161 | void DrawVisEffect(vis_effect *vis); |
| 162 | |
| 163 | // Creates a some sparks that go in random directions |
| 164 | void CreateRandomSparks(int num_sparks, vector *pos, int roomnum, int which_index = -1, float force_scalar = 1); |
| 165 | |
| 166 | // Creates a some line sparks that go in random directions |
| 167 | void CreateRandomLineSparks(int num_sparks, vector *pos, int roomnum, uint16_t color = 0, float force_scalar = 1); |
| 168 | |
| 169 | // Creates vis effects but has the caller set their parameters |
| 170 | // initialize a new viseffect. adds to the list for the given room |
| 171 | // returns the vis number |
| 172 | int VisEffectCreateControlled(uint8_t type, object *parent, uint8_t id, int roomnum, vector *pos, float lifetime, |
| 173 | vector *velocity, int phys_flags = 0, float size = 0, float mass = 0.0f, |
| 174 | float drag = 0.0f, bool isreal = 0); |
| 175 | |
| 176 | // Creates a some particles that go in random directions |
| 177 | void CreateRandomParticles(int num_sparks, vector *pos, int roomnum, int bm_handle, float size, float life); |
| 178 | |
| 179 | // Attaches viseffects that move with an object |
| 180 | void AttachRandomNapalmEffectsToObject(object *obj); |
| 181 | |
| 182 | #endif |