| 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/damage.h $ |
| 21 | * $Revision: 20 $ |
| 22 | * $Date: 4/25/99 10:38p $ |
| 23 | * $Author: Matt $ |
| 24 | * |
| 25 | * Applies and handles damage to game entities. |
| 26 | * |
| 27 | * $Log: /DescentIII/Main/damage.h $ |
| 28 | * |
| 29 | * 20 4/25/99 10:38p Matt |
| 30 | * Made the Osiris kill object function work on players. |
| 31 | * |
| 32 | * 19 4/25/99 10:19p Matt |
| 33 | * Fixed multiplayer and demo problems will killing an object from script, |
| 34 | * and cleaned up the death code a bit in the process. |
| 35 | * |
| 36 | * 18 4/24/99 4:32p Jason |
| 37 | * made fusion damage sound not be irritating |
| 38 | * |
| 39 | * 17 4/02/99 11:23a Matt |
| 40 | * Made KillObject not take a death_info struct, but rather the death info |
| 41 | * as individual parameters. Moved death_info into objinfo.h, since it's |
| 42 | * only used for generic objects. Took out fade-away death hack, now that |
| 43 | * fade-away deaths can be explicitely set. |
| 44 | * |
| 45 | * 16 3/22/99 2:00p Matt |
| 46 | * Moved breaking glass code from collide.cpp to damage.cpp |
| 47 | * |
| 48 | * 15 2/25/99 11:01a Matt |
| 49 | * Added new explosion system. |
| 50 | * |
| 51 | * 14 1/20/99 2:13a Chris |
| 52 | * It is now possible for robots to have special immunities, resistances, |
| 53 | * and vunerabilities |
| 54 | * |
| 55 | * 13 11/28/98 3:11p Jason |
| 56 | * made damage glow much more apparent |
| 57 | * |
| 58 | * 12 11/19/98 5:40p Kevin |
| 59 | * Demo system |
| 60 | * |
| 61 | * 11 10/19/98 11:20p Matt |
| 62 | * Changed player damage types to start at 0 instead of -1 to avoid -1 -> |
| 63 | * 255 problem in multiplayer. |
| 64 | * |
| 65 | * 10 10/19/98 7:19p Matt |
| 66 | * Added system to support different types of damage to the player and |
| 67 | * have these different types make different sounds. |
| 68 | * |
| 69 | * 9 5/04/98 4:12p Chris |
| 70 | * |
| 71 | * 8 5/04/98 4:04p Chris |
| 72 | * Minestone checkin' -- energy effect and more AI functionality |
| 73 | * |
| 74 | * 7 4/17/98 1:59p Jason |
| 75 | * added cool object effects |
| 76 | * |
| 77 | * 6 2/18/98 3:43a Mark |
| 78 | * |
| 79 | * 5 1/20/98 6:01p Jason |
| 80 | * first pass at getting multiplayer deaths working |
| 81 | * |
| 82 | * 4 1/15/98 6:49p Jason |
| 83 | * incremental checkin for multiplayer |
| 84 | * |
| 85 | * 3 12/01/97 11:02a Jason |
| 86 | * made camera shake from explosions |
| 87 | * |
| 88 | * 2 12/01/97 9:54a Chris |
| 89 | * Added support for concussive forces, generalized robot collisions to |
| 90 | * generic collisions |
| 91 | * |
| 92 | * 1 10/01/97 4:50p Samir |
| 93 | * Damage for players and robots. |
| 94 | * |
| 95 | * $NoKeywords: $ |
| 96 | */ |
| 97 | |
| 98 | #ifndef DAMAGE_H |
| 99 | #define DAMAGE_H |
| 100 | |
| 101 | #include "damage_external.h" |
| 102 | #include "vecmat.h" |
| 103 | #include "DeathInfo.h" |
| 104 | |
| 105 | // Maximum damage magnitude |
| 106 | #define MAX_DAMAGE_MAG 20.0f |
| 107 | #define MAX_EDRAIN_MAG 18.0f |
| 108 | |
| 109 | struct object; |
| 110 | struct room; |
| 111 | |
| 112 | // Applies damage to a player object, returns true if damage is applied. |
| 113 | bool ApplyDamageToPlayer(object *playerobj, object *killer, int damage_type, float damage_amount, int server_says = 0, |
| 114 | int weapon_id = 255, bool playsound = 1); |
| 115 | |
| 116 | // Applies damage to a robot object, returns true if damage is applied. |
| 117 | bool ApplyDamageToGeneric(object *robotobj, object *killer, int damage_type, float damage, int server_says = 0, |
| 118 | int weapon_id = 255); |
| 119 | |
| 120 | // Starts on object on fire |
| 121 | void SetNapalmDamageEffect(object *obj, object *killer, int weapon_id); |
| 122 | |
| 123 | // Chrishack -- milestone |
| 124 | void DecreasePlayerEnergy(int slot, float energy); |
| 125 | |
| 126 | // Adds a bit of shake to the camera |
| 127 | void AddToShakeMagnitude(float delta); |
| 128 | |
| 129 | // This function sortof replaces ExplodeObject() |
| 130 | // Parameters: objp - the object to destroy |
| 131 | // killer - the object who is killing it, or NULL |
| 132 | // damage - how much damage was applied in the death blow? |
| 133 | // death_flags - how the object dies |
| 134 | // delay_time - how long to delay, if a timed delay |
| 135 | void KillObject(object *objp, object *killer, float damage, int death_flags, float delay_time); |
| 136 | |
| 137 | // Applies a default death to an object |
| 138 | // Figures out what sort of death to do, then calls the other KillObject() |
| 139 | // Parameters: objp - the object to destroy |
| 140 | // killer - the object who is killing it, or NULL |
| 141 | // damage - how much damage was applied in the death blow? |
| 142 | void KillObject(object *objp, object *killer, float damage); |
| 143 | |
| 144 | // Kills the player |
| 145 | // weapon_id can be -1 for no weapon |
| 146 | void KillPlayer(object *playerobj, object *killer, float damage_amount, int weapon_id); |
| 147 | |
| 148 | // Shakes player by some random amount |
| 149 | void ShakePlayer(); |
| 150 | |
| 151 | // Restores the player orientation matrix after shaking |
| 152 | void UnshakePlayer(); |
| 153 | |
| 154 | extern void SetShakeMagnitude(float delta); |
| 155 | |
| 156 | // Break the specified (glass) face into shards |
| 157 | // Parameters: rp, facenum - the face to break |
| 158 | // hitpnt - the point on the face where the face shatters. If NULL, uses center |
| 159 | // point of |
| 160 | // face hitvec - the direction in which the thing that's breaking the glass is |
| 161 | // moving. If NULL, uses the negative of the surface normal |
| 162 | void BreakGlassFace(room *rp, int facenum, vector *hitpnt = NULL, vector *hitvec = NULL); |
| 163 | |
| 164 | #endif |