| 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/spew.h $ |
| 21 | * $Revision: 14 $ |
| 22 | * $Date: 5/02/99 2:52a $ |
| 23 | * $Author: Jeff $ |
| 24 | * |
| 25 | * header file for spew system |
| 26 | * |
| 27 | * $Log: /DescentIII/main/spew.h $ |
| 28 | * |
| 29 | * 14 5/02/99 2:52a Jeff |
| 30 | * fixed spewers for turrets/rotaters |
| 31 | * |
| 32 | * 13 4/29/99 7:50p Jason |
| 33 | * fixed spew errors |
| 34 | * |
| 35 | * 12 10/18/98 9:04p Jeff |
| 36 | * sped up spew by saving values? |
| 37 | * |
| 38 | * 11 8/19/98 5:36p Samir |
| 39 | * moved some stuff from source to header file. |
| 40 | * |
| 41 | * 10 8/19/98 1:44p Samir |
| 42 | * added array of spew extern |
| 43 | * |
| 44 | * 9 2/04/98 6:09p Matt |
| 45 | * Changed object room number to indicate a terrain cell via a flag. Got |
| 46 | * rid of the object flag which used to indicate terrain. |
| 47 | * |
| 48 | * 8 2/02/98 5:40p Luke |
| 49 | * |
| 50 | * 7 2/02/98 3:10p Jeff |
| 51 | * new handle system, makes more reliable |
| 52 | * |
| 53 | * 6 1/28/98 6:29p Jeff |
| 54 | * Added the "RISCy" layer between predef statements and the game |
| 55 | * |
| 56 | * 5 1/26/98 11:01a Jeff |
| 57 | * changed spew struct to use object handles |
| 58 | * |
| 59 | * 4 1/23/98 7:00p Jeff |
| 60 | * checked object before using it bug fixed |
| 61 | * |
| 62 | * 3 1/23/98 5:18p Jeff |
| 63 | * Added in new timer and 3/5 of the random flags |
| 64 | * |
| 65 | * 2 1/23/98 3:03p Jeff |
| 66 | * Added mass into spew structure |
| 67 | * |
| 68 | * 1 1/23/98 12:07p Jeff |
| 69 | * |
| 70 | * 2 1/23/98 11:50a Jeff |
| 71 | * Creation of Spew system |
| 72 | * |
| 73 | * $NoKeywords: $ |
| 74 | */ |
| 75 | |
| 76 | #ifndef __SPEW_H_ |
| 77 | #define __SPEW_H_ |
| 78 | |
| 79 | #include "vecmat.h" |
| 80 | |
| 81 | #define SF_FORCEUPDATE 0x01 // this spew needs to do an update no matter what next time it spews (gunpoint) |
| 82 | #define SF_UPDATEDFORFRAME 0x02 // thie spew has already updated it's position for this frame, no need to do it again |
| 83 | #define SF_UPDATEEVERYFRAME 0x04 |
| 84 | |
| 85 | struct guninfo { |
| 86 | int obj_handle; // handle to object (needed if it's gunpoint based) |
| 87 | int gunpoint; // gunpoint number (needed if it's gunpoint based) |
| 88 | }; |
| 89 | |
| 90 | struct pointinfo { |
| 91 | vector origin; // origin of the viseffect (needed if it's NOT gunpoint based) |
| 92 | vector normal; // normal of the point |
| 93 | int room_num; // room number of point of origin |
| 94 | }; |
| 95 | |
| 96 | struct spewinfo { |
| 97 | uint8_t flags; // flags |
| 98 | bool inuse; // if this slot is in use |
| 99 | bool use_gunpoint; // is this a gunpoint based object (yes=true) |
| 100 | bool real_obj; // if this object should be treated as a real object (can hurt you) (yes=true) |
| 101 | |
| 102 | union { |
| 103 | pointinfo pt; // point info structure (needed if it's point based) |
| 104 | guninfo gp; // gunpoint info structure (needed if it's gunpoint based) |
| 105 | }; |
| 106 | |
| 107 | int effect_type; // viseffect type (see fireball.h) |
| 108 | int phys_info; // physics info type (see physics.h) |
| 109 | int random; // should the viseffect have some randomness to it (must be 0 if real) |
| 110 | int handle; // stored handle for speweffect |
| 111 | |
| 112 | float drag; // drag of viseffect |
| 113 | float mass; // mass of viseffect |
| 114 | float time_int; // how often it should be 'updated' |
| 115 | float longevity; // lifespan of the viseffect (i.e. how long should the puff of smoke last) |
| 116 | float lifetime; // how long viseffect should run (0=infinity, until asked to stop) |
| 117 | float size; // size of viseffect blob |
| 118 | float speed; // speed of viseffect blob |
| 119 | float time_until_next_blob; // per spewer |
| 120 | float start_time; // time viseffect started |
| 121 | |
| 122 | vector gp_normal, gun_point; // vectors saved to keep from recalculating |
| 123 | }; |
| 124 | |
| 125 | #define SPEW_RAND_WIGGLE 1 |
| 126 | #define SPEW_RAND_SPEED 2 |
| 127 | #define SPEW_RAND_SIZE 4 |
| 128 | #define SPEW_RAND_SLIDE 8 |
| 129 | #define SPEW_RAND_LIFETIME 16 |
| 130 | |
| 131 | #define MAX_SPEW_EFFECTS 50 // maximum viseffects to be handled by at once |
| 132 | |
| 133 | // spew array |
| 134 | extern spewinfo SpewEffects[]; |
| 135 | |
| 136 | // spew count value. |
| 137 | extern int spew_count; |
| 138 | |
| 139 | // Initializes the Spew system |
| 140 | void SpewInit(); |
| 141 | |
| 142 | // Creates a Spew effect |
| 143 | // spew -> Pointer to spewinfo structure (that is filled out)...may be deleted after function call |
| 144 | // returns a handle to the spew effect |
| 145 | int SpewCreate(spewinfo *spew); |
| 146 | |
| 147 | // Does a step in a spew system |
| 148 | void SpewEmitAll(void); |
| 149 | |
| 150 | // Clears a Spew Event given a handle to it |
| 151 | void SpewClearEvent(int handle, bool force = true); |
| 152 | |
| 153 | #endif |