| 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/object_lighting.cpp $ |
| 21 | * $Revision: 64 $ |
| 22 | * $Date: 3/20/00 12:58p $ |
| 23 | * $Author: Matt $ |
| 24 | * |
| 25 | * Code to deal with object lighting |
| 26 | * |
| 27 | * $Log: /DescentIII/main/object_lighting.cpp $ |
| 28 | * |
| 29 | * 64 3/20/00 12:58p Matt |
| 30 | * Merge of Duane's post-1.3 changes. |
| 31 | * Lots of lightmap stuff. Jason looked at this and said nothing jumps |
| 32 | * out at him as being wrong. |
| 33 | * |
| 34 | * 63 10/26/99 6:33p Chris |
| 35 | * Added the green flare |
| 36 | * |
| 37 | * 62 10/12/99 11:06a Jeff |
| 38 | * negative lighting effect |
| 39 | * |
| 40 | * 61 7/20/99 1:00p Jason |
| 41 | * added auto katmai support |
| 42 | * |
| 43 | * 60 4/28/99 11:28a Jason |
| 44 | * made real viseffects not cast light |
| 45 | * |
| 46 | * 59 4/26/99 4:28a Jeff |
| 47 | * reset cloak time to 0 on MakeObjectVisible() to prevent some weird |
| 48 | * anomalies (like the thief stealing cloak) |
| 49 | * |
| 50 | * 58 4/21/99 11:05a Kevin |
| 51 | * new ps_rand and ps_srand to replace rand & srand |
| 52 | * |
| 53 | * 57 4/12/99 6:15p Samir |
| 54 | * Sound priorities pass 1 |
| 55 | * |
| 56 | * 56 4/03/99 2:20p Jason |
| 57 | * added better heat damage effect |
| 58 | * |
| 59 | * 55 3/26/99 3:26p Jeff |
| 60 | * option to display hud message when cloaking |
| 61 | * |
| 62 | * 54 3/22/99 11:16a Jason |
| 63 | * Katmai enhancements |
| 64 | * |
| 65 | * 53 3/05/99 12:03p Jason |
| 66 | * fixed lighting with popup views |
| 67 | * |
| 68 | * 52 2/25/99 8:55p Jeff |
| 69 | * Inventory supports level change persistant items. Inventory supports |
| 70 | * time-out objects. Inventory Reset changed (takes a level of reset |
| 71 | * now). Quad lasers stay across level change (single player). Guidebot |
| 72 | * bug fixed (now back in ship on level start). Quads time out when |
| 73 | * spewed. Invulnerability and cloak powerups no longer use game |
| 74 | * event/callbacks, so they can be saved in game saves (moved to |
| 75 | * MakePlayerInvulnerable and MakeObjectInvisible) |
| 76 | * |
| 77 | * 51 2/15/99 4:10p Jason |
| 78 | * made non-vis objects kill all their attach sounds/objects |
| 79 | * |
| 80 | * 50 1/20/99 5:29p Jason |
| 81 | * took out thruster glow for players |
| 82 | * |
| 83 | * 49 1/19/99 4:22p Matt |
| 84 | * Added the ability for objects to have their own lighting info, |
| 85 | * different from the default lighting for that type of object. |
| 86 | * |
| 87 | */ |
| 88 | |
| 89 | #include "object_lighting.h"cxx . . $ `<file>/Descent3/object_lighting.h`/ |
| 90 | #include "object.h"cxx . . $ `<file>/Descent3/object.h`/ |
| 91 | #include "lighting.h"cxx . . $ `<file>/Descent3/lighting.h`/ |
| 92 | #include "objinfo.h"cxx . . $ `<file>/Descent3/objinfo.h`/ |
| 93 | #include "weapon.h"cxx . . $ `<file>/Descent3/weapon.h`/ |
| 94 | #include "descent.h"cxx . . $ `<file>/Descent3/descent.h`/ |
| 95 | #include "game.h"cxx . . $ `<file>/Descent3/game.h`/ |
| 96 | #include "polymodel.h"cxx . . $ `<file>/model/polymodel.h`/ |
| 97 | #include "renderobject.h"cxx . . $ `<file>/Descent3/renderobject.h`/ |
| 98 | #include <stdlib.h> |
| 99 | #include "lightmap_info.h"cxx . . $ `<file>/Descent3/lightmap_info.h`/ |
| 100 | #include "fireball.h"cxx . . $ `<file>/Descent3/fireball.h`/ |
| 101 | #include "player.h"cxx . . $ `<file>/Descent3/player.h`/ |
| 102 | #include "mem.h"cxx . . $ `<file>/mem/mem.h`/ |
| 103 | #include "config.h"cxx . . $ `<file>/Descent3/config.h`/ |
| 104 | #include "findintersection.h"cxx . . $ `<file>/physics/findintersection.h`/ |
| 105 | #include "psrand.h"cxx . . $ `<file>/misc/psrand.h`/ |
| 106 | |
| 107 | // How far the headlight casts light |
| 108 | #define HEADLIGHT_DISTANCEcxx . . $ `Descent3/object_lighting.cpp:108:9`! 150.0f |
| 109 | // Defines the headlight cone of light |
| 110 | #define HEADLIGHT_DOTcxx . . $ `Descent3/object_lighting.cpp:110:9`! .75f |
| 111 | |
| 112 | // How big the fast headlight is |
| 113 | #define FAST_HEADLIGHT_SIZEcxx . . $ `Descent3/object_lighting.cpp:113:9`! 20.0f |
| 114 | |
| 115 | // Defines the headlight cone of light |
| 116 | #define FAST_HEADLIGHT_DOTcxx . . $ `Descent3/object_lighting.cpp:116:9`! .80f |
| 117 | |
| 118 | // returns true if this light point is visible |
| 119 | bool IsLightPointVisiblecxx . . $ IsLightPointVisible(abd178c94e8d9d96).(vectorcxx . . $ vector# *pos, float size, objectcxx . . $ object# *obj) { |
| 120 | if (obj != NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:416:9`!) { |
| 121 | if ((obj->flagscxx . . $ object#flags. & OF_RENDEREDcxx . . $ `Descent3/object_external.h:285:9`!) || IsPointVisiblecxx . . $ IsPointVisible(a3c3a6b9788a7132).(pos, size, NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:416:9`!)) |
| 122 | return true; |
| 123 | } else { |
| 124 | if (IsPointVisiblecxx . . $ IsPointVisible(a3c3a6b9788a7132).(pos, size, NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:416:9`!)) |
| 125 | return true; |
| 126 | } |
| 127 | |
| 128 | return false; |
| 129 | } |
| 130 | |
| 131 | // Fills in the color of the passed in players thrusters. For lighting |
| 132 | void FindPlayerThrusterColorcxx . . $ FindPlayerThrusterColor(d464601be4169e0c).(int slot, float *r, float *g, float *b) { |
| 133 | ASSERTcxx . . $ `misc/pserror.h:246:9`!(slot >= 0 && slot < MAX_PLAYERScxx . . $ `Descent3/player_external_struct.h:86:9`!); |
| 134 | objectcxx . . $ object# *obj = &Objectscxx . . $ Objects.[Playerscxx . . $ Players.[slot].objnumcxx . . $ player#objnum.]; |
| 135 | int model_num = obj->rtypecxx . . $ object#rtype..pobj_infocxx . . $ object#$anonymous_type_10#pobj_info..model_numcxx . . $ polyobj_info#model_num.; |
| 136 | |
| 137 | *r = 0; |
| 138 | *g = 0; |
| 139 | *b = 0; |
| 140 | |
| 141 | if (obj->render_typecxx . . $ object#render_type. != RT_POLYOBJcxx . . $ `Descent3/object_external.h:258:9`!) |
| 142 | return; |
| 143 | |
| 144 | poly_modelcxx . . $ poly_model# *pm = &Poly_modelscxx . . $ Poly_models.[model_num]; |
| 145 | |
| 146 | for (int i = 0; i < pm->n_modelscxx . . $ poly_model#n_models.; i++) { |
| 147 | if (pm->submodelcxx . . $ poly_model#submodel.[i].flagscxx . . $ bsp_info#flags. & SOF_GLOWcxx . . $ `lib/polymodel_external.h:96:9`!) { |
| 148 | *r = pm->submodelcxx . . $ poly_model#submodel.[i].glow_infocxx . . $ bsp_info#glow_info.->glow_rcxx . . $ glowinfo#glow_r.; |
| 149 | *g = pm->submodelcxx . . $ poly_model#submodel.[i].glow_infocxx . . $ bsp_info#glow_info.->glow_gcxx . . $ glowinfo#glow_g.; |
| 150 | *b = pm->submodelcxx . . $ poly_model#submodel.[i].glow_infocxx . . $ bsp_info#glow_info.->glow_bcxx . . $ glowinfo#glow_b.; |
| 151 | |
| 152 | return; |
| 153 | } |
| 154 | } |
| 155 | |
| 156 | Int3cxx . . $ `misc/pserror.h:247:9`!(); // No thruster glow? |
| 157 | } |
| 158 | |
| 159 | uint8_tcxx . . $ uint8_t# EasterEggcxx . . $ EasterEgg. = 0; |
| 160 | #define EASTER_EGG_TIMERcxx . . $ `Descent3/object_lighting.cpp:160:9`! (3600 * 4) |
| 161 | |
| 162 | void ReflectRaycxx . . $ ReflectRay(af83aca25ba5b41c).(vectorcxx . . $ vector# *, vectorcxx . . $ vector# *, vectorcxx . . $ vector# *); |
| 163 | // Casts light from an object onto the rooms or terrain |
| 164 | void DoObjectLightcxx . . $ DoObjectLight(419c470199a90a97).(objectcxx . . $ object# *obj) { |
| 165 | light_infocxx . . $ light_info# *li; |
| 166 | static int first = 1, flare_id = -1, greenflare_id = -1; |
| 167 | |
| 168 | if (obj->flagscxx . . $ object#flags. & OF_DEADcxx . . $ `Descent3/object_external.h:270:9`!) |
| 169 | return; |
| 170 | |
| 171 | if (obj->render_typecxx . . $ object#render_type. == RT_NONEcxx . . $ `Descent3/object_external.h:257:9`!) |
| 172 | return; |
| 173 | |
| 174 | float negative_light = 1.0f; |
| 175 | if (obj->effect_infocxx . . $ object#effect_info. && obj->effect_infocxx . . $ object#effect_info.->type_flagscxx . . $ effect_info_s#type_flags. & EF_NEGATIVE_LIGHTcxx . . $ `Descent3/object_external.h:212:9`!) |
| 176 | negative_light = -1.0f; |
| 177 | |
| 178 | // Temporary hack to make explosions light up |
| 179 | if (obj->typecxx . . $ object#type. == OBJ_FIREBALLcxx . . $ `Descent3/object_external.h:161:9`!) { |
| 180 | if (!Detail_settingscxx . . $ Detail_settings..Dynamic_lightingcxx . . $ tDetailSettings#Dynamic_lighting.) |
| 181 | return; |
| 182 | |
| 183 | if (obj->flagscxx . . $ object#flags. & OF_USES_LIFELEFTcxx . . $ `Descent3/object_external.h:276:9`! && Fireballscxx . . $ Fireballs.[obj->idcxx . . $ object#id.].typecxx . . $ fireball#type. == FT_EXPLOSIONcxx . . $ `Descent3/fireball_external.h:77:9`!) { |
| 184 | float scalar; |
| 185 | |
| 186 | scalar = (obj->lifetimecxx . . $ object#lifetime. - obj->lifeleftcxx . . $ object#lifeleft.) / obj->lifetimecxx . . $ object#lifetime.; |
| 187 | |
| 188 | if (scalar > .5) { |
| 189 | scalar -= .5; |
| 190 | |
| 191 | scalar = 1.0 - (scalar / .5); |
| 192 | } else { |
| 193 | scalar *= 2; |
| 194 | } |
| 195 | |
| 196 | if (scalar > .05) { |
| 197 | if (OBJECT_OUTSIDEcxx . . $ `lib/object_external_struct.h:130:9`!(obj)) |
| 198 | ApplyLightingToTerraincxx . . $ ApplyLightingToTerrain(31a30e6d6b9dd744).(&obj->poscxx . . $ object#pos., CELLNUMcxx . . $ `lib/object_external_struct.h:121:9`!(obj->roomnum), 40 * scalar, negative_light * 1.0f, |
| 199 | negative_light * 0.5f, negative_light * 0.0f); |
| 200 | else |
| 201 | ApplyLightingToRoomscxx . . $ ApplyLightingToRooms(31a30e6d6b9dd744).(&obj->poscxx . . $ object#pos., obj->roomnumcxx . . $ object#roomnum., 40 * scalar, negative_light * 1.0f, negative_light * 0.5f, |
| 202 | negative_light * 0.0f); |
| 203 | } |
| 204 | } |
| 205 | return; |
| 206 | } |
| 207 | |
| 208 | switch (obj->typecxx . . $ object#type.) { |
| 209 | case OBJ_PLAYERcxx . . $ `Descent3/object_external.h:164:9`!: { |
| 210 | if ((Playerscxx . . $ Players.[obj->idcxx . . $ object#id.].flagscxx . . $ player#flags.) & PLAYER_FLAGS_HEADLIGHTcxx . . $ `Descent3/player_external.h:90:9`!) { |
| 211 | |
| 212 | if (Detail_settingscxx . . $ Detail_settings..Fast_headlight_oncxx . . $ tDetailSettings#Fast_headlight_on.) { |
| 213 | // Do fast headlight |
| 214 | fvi_infocxx . . $ fvi_info# hit_info; |
| 215 | fvi_querycxx . . $ fvi_query# fq; |
| 216 | |
| 217 | // shoot a ray from the light position to the current vertex |
| 218 | vectorcxx . . $ vector# end_pos = obj->poscxx . . $ object#pos. +cxx . . $ operator+(b77b703cd1e43e33). (obj->orientcxx . . $ object#orient..fveccxx . . $ matrix#fvec. *cxx . . $ `operator*`(252247219a31502c). HEADLIGHT_DISTANCEcxx . . $ `Descent3/object_lighting.cpp:108:9`! *cxx . . $ `operator*`(252247219a31502c). 2); |
| 219 | fq.p0cxx . . $ fvi_query#p0. = &obj->poscxx . . $ object#pos.; |
| 220 | fq.p1cxx . . $ fvi_query#p1. = &end_pos; |
| 221 | |
| 222 | fq.startroomcxx . . $ fvi_query#startroom. = obj->roomnumcxx . . $ object#roomnum.; |
| 223 | |
| 224 | fq.radcxx . . $ fvi_query#rad. = 0.0f; |
| 225 | fq.flagscxx . . $ fvi_query#flags. = FQ_CHECK_OBJScxx . . $ `lib/findintersection_external.h:59:9`!; |
| 226 | fq.thisobjnumcxx . . $ fvi_query#thisobjnum. = -1; |
| 227 | fq.ignore_obj_listcxx . . $ fvi_query#ignore_obj_list. = NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:416:9`!; |
| 228 | |
| 229 | fvi_FindIntersectioncxx . . $ fvi_FindIntersection(e1c4d7bd350effc8).(&fq, &hit_info); |
| 230 | |
| 231 | hit_info.hit_pntcxx . . $ fvi_info#hit_pnt. -=cxx . . $ `operator-=`(801a8d6f7ab7bef9). obj->orientcxx . . $ object#orient..fveccxx . . $ matrix#fvec. /cxx . . $ `operator/`(252247219a31502c). 4; |
| 232 | |
| 233 | float dist = vm_VectorDistanceQuickcxx . . $ vm_VectorDistanceQuick(a0b9c8659ecc16b8).(&hit_info.hit_pntcxx . . $ fvi_info#hit_pnt., &obj->poscxx . . $ object#pos.); |
| 234 | |
| 235 | // Now light up the hit area |
| 236 | if (ROOMNUM_OUTSIDEcxx . . $ `lib/object_external_struct.h:127:9`!(hit_info.hit_room)) |
| 237 | ApplyLightingToTerraincxx . . $ ApplyLightingToTerrain(31a30e6d6b9dd744).(&hit_info.hit_pntcxx . . $ fvi_info#hit_pnt., CELLNUMcxx . . $ `lib/object_external_struct.h:121:9`!(hit_info.hit_room), FAST_HEADLIGHT_SIZEcxx . . $ `Descent3/object_lighting.cpp:113:9`!, |
| 238 | negative_light * 1.0, negative_light * 1.0, negative_light * 1.0); |
| 239 | else { |
| 240 | ApplyLightingToRoomscxx . . $ ApplyLightingToRooms(31a30e6d6b9dd744).(&hit_info.hit_pntcxx . . $ fvi_info#hit_pnt., hit_info.hit_roomcxx . . $ fvi_info#hit_room., FAST_HEADLIGHT_SIZEcxx . . $ `Descent3/object_lighting.cpp:113:9`!, negative_light * 1.0, |
| 241 | negative_light * 1.0, negative_light * 1.0); |
| 242 | // Do stupid easter egg trick |
| 243 | facecxx . . $ face# *fp = &Roomscxx . . $ Rooms.[hit_info.hit_roomcxx . . $ fvi_info#hit_room.].facescxx . . $ room#faces.[hit_info.hit_facecxx . . $ fvi_info#hit_face.[0]]; |
| 244 | if (Gametimecxx . . $ Gametime. > EASTER_EGG_TIMERcxx . . $ `Descent3/object_lighting.cpp:160:9`! && GameTexturescxx . . $ GameTextures.[fp->tmapcxx . . $ face#tmap.].flagscxx . . $ texture#flags. & (TF_PROCEDURALcxx . . $ `Descent3/gametexture.h:225:9`! | TF_WATER_PROCEDURALcxx . . $ `Descent3/gametexture.h:226:9`!)) { |
| 245 | EasterEggcxx . . $ EasterEgg. = 1; |
| 246 | } |
| 247 | } |
| 248 | } else { |
| 249 | // Do slow headlight |
| 250 | |
| 251 | if (OBJECT_OUTSIDEcxx . . $ `lib/object_external_struct.h:130:9`!(obj)) |
| 252 | ApplyLightingToTerraincxx . . $ ApplyLightingToTerrain(31a30e6d6b9dd744).(&obj->poscxx . . $ object#pos., CELLNUMcxx . . $ `lib/object_external_struct.h:121:9`!(obj->roomnum), HEADLIGHT_DISTANCEcxx . . $ `Descent3/object_lighting.cpp:108:9`!, negative_light * 1.0, |
| 253 | negative_light * 1.0, negative_light * 1.0, &obj->orientcxx . . $ object#orient..fveccxx . . $ matrix#fvec., HEADLIGHT_DOTcxx . . $ `Descent3/object_lighting.cpp:110:9`!); |
| 254 | else |
| 255 | ApplyLightingToRoomscxx . . $ ApplyLightingToRooms(31a30e6d6b9dd744).(&obj->poscxx . . $ object#pos., obj->roomnumcxx . . $ object#roomnum., HEADLIGHT_DISTANCEcxx . . $ `Descent3/object_lighting.cpp:108:9`!, negative_light * 1.0, negative_light * 1.0, |
| 256 | negative_light * 1.0, &obj->orientcxx . . $ object#orient..fveccxx . . $ matrix#fvec., HEADLIGHT_DOTcxx . . $ `Descent3/object_lighting.cpp:110:9`!); |
| 257 | } |
| 258 | } |
| 259 | |
| 260 | int slot = obj->idcxx . . $ object#id.; |
| 261 | |
| 262 | /*// Do thruster glow |
| 263 | if (Players[slot].thrust_mag && Detail_settings.Dynamic_lighting) |
| 264 | { |
| 265 | float lightsize=Players[slot].thrust_mag*30.0; |
| 266 | lightsize+=Players[slot].afterburner_mag*40.0; |
| 267 | |
| 268 | float r,g,b; |
| 269 | vector negz=-obj->orient.fvec; |
| 270 | vector newpos=obj->pos-(obj->orient.fvec*(obj->size*.7)); |
| 271 | |
| 272 | if (IsLightPointVisible (&newpos,lightsize,NULL)) |
| 273 | { |
| 274 | FindPlayerThrusterColor (slot,&r,&g,&b); |
| 275 | |
| 276 | ASSERT (r>=0 && r<=1.0); |
| 277 | ASSERT (g>=0 && g<=1.0); |
| 278 | ASSERT (b>=0 && b<=1.0); |
| 279 | |
| 280 | if (r!=0 || g!=0 || b!=0) |
| 281 | { |
| 282 | if (OBJECT_OUTSIDE(obj)) |
| 283 | ApplyLightingToTerrain (&newpos,CELLNUM(obj->roomnum),lightsize,r,g,b,&negz,0); |
| 284 | else |
| 285 | ApplyLightingToRooms (&newpos,obj->roomnum,lightsize,r,g,b,&negz,0); |
| 286 | } |
| 287 | } |
| 288 | }*/ |
| 289 | |
| 290 | // If the player is glowing |
| 291 | if (Playerscxx . . $ Players.[slot].light_distcxx . . $ player#light_dist. > .5 && Detail_settingscxx . . $ Detail_settings..Dynamic_lightingcxx . . $ tDetailSettings#Dynamic_lighting.) { |
| 292 | if (IsLightPointVisiblecxx . . $ IsLightPointVisible(abd178c94e8d9d96).(&obj->poscxx . . $ object#pos., Playerscxx . . $ Players.[slot].light_distcxx . . $ player#light_dist., obj)) { |
| 293 | if (OBJECT_OUTSIDEcxx . . $ `lib/object_external_struct.h:130:9`!(obj)) |
| 294 | ApplyLightingToTerraincxx . . $ ApplyLightingToTerrain(31a30e6d6b9dd744).(&obj->poscxx . . $ object#pos., CELLNUMcxx . . $ `lib/object_external_struct.h:121:9`!(obj->roomnum), Playerscxx . . $ Players.[slot].light_distcxx . . $ player#light_dist., |
| 295 | Playerscxx . . $ Players.[slot].rcxx . . $ player#r. * negative_light, Playerscxx . . $ Players.[slot].gcxx . . $ player#g. * negative_light, |
| 296 | Playerscxx . . $ Players.[slot].bcxx . . $ player#b. * negative_light); |
| 297 | else |
| 298 | ApplyLightingToRoomscxx . . $ ApplyLightingToRooms(31a30e6d6b9dd744).(&obj->poscxx . . $ object#pos., obj->roomnumcxx . . $ object#roomnum., Playerscxx . . $ Players.[slot].light_distcxx . . $ player#light_dist., Playerscxx . . $ Players.[slot].rcxx . . $ player#r. * negative_light, |
| 299 | Playerscxx . . $ Players.[slot].gcxx . . $ player#g. * negative_light, Playerscxx . . $ Players.[slot].bcxx . . $ player#b. * negative_light); |
| 300 | } |
| 301 | } |
| 302 | |
| 303 | // Do stupid ball glow |
| 304 | if (Playerscxx . . $ Players.[slot].num_ballscxx . . $ player#num_balls. > 0 && Detail_settingscxx . . $ Detail_settings..Dynamic_lightingcxx . . $ tDetailSettings#Dynamic_lighting.) { |
| 305 | vectorcxx . . $ vector# ballpos; |
| 306 | for (int i = 0; i < Playerscxx . . $ Players.[slot].num_ballscxx . . $ player#num_balls.; i++) { |
| 307 | float light_size = 25; |
| 308 | PlayerGetBallPositioncxx . . $ PlayerGetBallPosition(826a07231ea9ab7c).(&ballpos, slot, i); |
| 309 | |
| 310 | if (!IsLightPointVisiblecxx . . $ IsLightPointVisible(abd178c94e8d9d96).(&ballpos, light_size, obj)) |
| 311 | return; |
| 312 | |
| 313 | if (OBJECT_OUTSIDEcxx . . $ `lib/object_external_struct.h:130:9`!(obj)) |
| 314 | ApplyLightingToTerraincxx . . $ ApplyLightingToTerrain(31a30e6d6b9dd744).(&ballpos, CELLNUMcxx . . $ `lib/object_external_struct.h:121:9`!(obj->roomnum), light_size, Playerscxx . . $ Players.[slot].ball_rcxx . . $ player#ball_r.[i] * negative_light, |
| 315 | Playerscxx . . $ Players.[slot].ball_gcxx . . $ player#ball_g.[i] * negative_light, Playerscxx . . $ Players.[slot].ball_bcxx . . $ player#ball_b.[i] * negative_light); |
| 316 | else |
| 317 | ApplyLightingToRoomscxx . . $ ApplyLightingToRooms(31a30e6d6b9dd744).(&ballpos, obj->roomnumcxx . . $ object#roomnum., light_size, Playerscxx . . $ Players.[slot].ball_rcxx . . $ player#ball_r.[i] * negative_light, |
| 318 | Playerscxx . . $ Players.[slot].ball_gcxx . . $ player#ball_g.[i] * negative_light, Playerscxx . . $ Players.[slot].ball_bcxx . . $ player#ball_b.[i] * negative_light); |
| 319 | } |
| 320 | } |
| 321 | |
| 322 | return; |
| 323 | } |
| 324 | |
| 325 | case OBJ_WEAPONcxx . . $ `Descent3/object_external.h:165:9`!: { |
| 326 | weaponcxx . . $ weapon# *w = &Weaponscxx . . $ Weapons.[obj->idcxx . . $ object#id.]; |
| 327 | li = &w->lighting_infocxx . . $ weapon#lighting_info.; |
| 328 | |
| 329 | // Check to see if we should have dynamic light |
| 330 | if (first) { |
| 331 | flare_id = FindWeaponNamecxx . . $ FindWeaponName(5c4306d8553b3696).("Yellow flare"); |
| 332 | greenflare_id = FindWeaponNamecxx . . $ FindWeaponName(5c4306d8553b3696).("GreenFlare"); |
| 333 | first = 0; |
| 334 | } |
| 335 | |
| 336 | if (!Detail_settingscxx . . $ Detail_settings..Dynamic_lightingcxx . . $ tDetailSettings#Dynamic_lighting.) { |
| 337 | if (obj->idcxx . . $ object#id. != flare_id && obj->idcxx . . $ object#id. != greenflare_id) |
| 338 | return; |
| 339 | } |
| 340 | if (obj->ctypecxx . . $ object#ctype..laser_infocxx . . $ object#$anonymous_type_9#laser_info..casts_lightcxx . . $ laser_info_s#casts_light. == false) |
| 341 | return; |
| 342 | |
| 343 | break; |
| 344 | } |
| 345 | case OBJ_POWERUPcxx . . $ `Descent3/object_external.h:167:9`!: |
| 346 | case OBJ_ROBOTcxx . . $ `Descent3/object_external.h:162:9`!: |
| 347 | case OBJ_CLUTTERcxx . . $ `Descent3/object_external.h:171:9`!: |
| 348 | case OBJ_BUILDINGcxx . . $ `Descent3/object_external.h:176:9`!: { |
| 349 | li = ObjGetLightInfocxx . . $ ObjGetLightInfo(fae61030adf16a8b).(obj); |
| 350 | if (!Detail_settingscxx . . $ Detail_settings..Dynamic_lightingcxx . . $ tDetailSettings#Dynamic_lighting. && (obj->typecxx . . $ object#type. == OBJ_ROBOTcxx . . $ `Descent3/object_external.h:162:9`! || obj->typecxx . . $ object#type. == OBJ_POWERUPcxx . . $ `Descent3/object_external.h:167:9`!)) |
| 351 | return; |
| 352 | break; |
| 353 | } |
| 354 | default: |
| 355 | return; |
| 356 | } |
| 357 | |
| 358 | float scalar = 1.0; |
| 359 | float red, green, blue; |
| 360 | float light_distance = li->light_distancecxx . . $ light_info#light_distance.; |
| 361 | vectorcxx . . $ vector# *direction = NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:416:9`!; |
| 362 | |
| 363 | // Make katmai lights bigger |
| 364 | if (Katmaicxx . . $ Katmai.) |
| 365 | light_distance *= 1.5; |
| 366 | |
| 367 | if (light_distance > 0) { |
| 368 | if (!IsLightPointVisiblecxx . . $ IsLightPointVisible(abd178c94e8d9d96).(&obj->poscxx . . $ object#pos., light_distance, obj)) |
| 369 | return; |
| 370 | |
| 371 | if (li->flagscxx . . $ light_info#flags. & OLF_DIRECTIONALcxx . . $ `Descent3/object.h:676:9`!) |
| 372 | direction = &obj->orientcxx . . $ object#orient..fveccxx . . $ matrix#fvec.; |
| 373 | |
| 374 | if (li->flagscxx . . $ light_info#flags. & OLF_FLICKER_SLIGHTLYcxx . . $ `Descent3/object.h:675:9`!) { |
| 375 | int factor = li->flicker_distancecxx . . $ light_info#flicker_distance.; |
| 376 | |
| 377 | if (factor == 0) { |
| 378 | mprintfcxx . . $ `ddebug/mono.h:82:9`!(0, "You have a flicker_slightly light that has a flicker factor of zero!\n"); |
| 379 | return; |
| 380 | } |
| 381 | |
| 382 | light_distance += ((ps_randcxx . . $ ps_rand(b126dc7c1de90089).() % factor) - (factor / 2)); |
| 383 | if (light_distance < 0) |
| 384 | return; |
| 385 | } |
| 386 | |
| 387 | red = li->red_light1cxx . . $ light_info#red_light1.; |
| 388 | green = li->green_light1cxx . . $ light_info#green_light1.; |
| 389 | blue = li->blue_light1cxx . . $ light_info#blue_light1.; |
| 390 | |
| 391 | if ((li->flagscxx . . $ light_info#flags. & OLF_PULSEcxx . . $ `Descent3/object.h:673:9`!) && li->time_intervalcxx . . $ light_info#time_interval. > 0) { |
| 392 | float ptime = li->time_intervalcxx . . $ light_info#time_interval.; |
| 393 | |
| 394 | int int_time = (int)(Gametimecxx . . $ Gametime. / (ptime * 2)); |
| 395 | float left_time = Gametimecxx . . $ Gametime. - (int_time * ptime * 2); |
| 396 | float norm_time = left_time / (ptime); |
| 397 | |
| 398 | if (norm_time > 1) |
| 399 | scalar = 1 - (norm_time - 1.0); |
| 400 | else |
| 401 | scalar = norm_time; |
| 402 | |
| 403 | scalar = li->flicker_distancecxx . . $ light_info#flicker_distance. + (scalar * (1.0 - li->flicker_distancecxx . . $ light_info#flicker_distance.)); |
| 404 | } |
| 405 | |
| 406 | if (li->flagscxx . . $ light_info#flags. & OLF_PULSE_TO_SECONDcxx . . $ `Descent3/object.h:674:9`! && li->time_intervalcxx . . $ light_info#time_interval. > 0) { |
| 407 | float ptime = li->time_intervalcxx . . $ light_info#time_interval.; |
| 408 | |
| 409 | int int_time = (int)(Gametimecxx . . $ Gametime. / (ptime * 2)); |
| 410 | float left_time = Gametimecxx . . $ Gametime. - (int_time * ptime * 2); |
| 411 | float norm_time = left_time / (ptime); |
| 412 | |
| 413 | if (norm_time > 1) { |
| 414 | norm_time -= 1.0; |
| 415 | |
| 416 | red = ((1.0 - norm_time) * li->red_light2cxx . . $ light_info#red_light2.) + (li->red_light1cxx . . $ light_info#red_light1. * norm_time); |
| 417 | green = ((1.0 - norm_time) * li->green_light2cxx . . $ light_info#green_light2.) + (li->green_light1cxx . . $ light_info#green_light1. * norm_time); |
| 418 | blue = ((1.0 - norm_time) * li->blue_light2cxx . . $ light_info#blue_light2.) + (li->blue_light1cxx . . $ light_info#blue_light1. * norm_time); |
| 419 | } else { |
| 420 | red = ((1.0 - norm_time) * li->red_light1cxx . . $ light_info#red_light1.) + (li->red_light2cxx . . $ light_info#red_light2. * norm_time); |
| 421 | green = ((1.0 - norm_time) * li->green_light1cxx . . $ light_info#green_light1.) + (li->green_light2cxx . . $ light_info#green_light2. * norm_time); |
| 422 | blue = ((1.0 - norm_time) * li->blue_light1cxx . . $ light_info#blue_light1.) + (li->blue_light2cxx . . $ light_info#blue_light2. * norm_time); |
| 423 | } |
| 424 | } |
| 425 | |
| 426 | if (scalar < 0.0f) |
| 427 | scalar = 0.0f; |
| 428 | |
| 429 | // If this is object is flickering, just compare it with a random value |
| 430 | if (li->flagscxx . . $ light_info#flags. & OLF_FLICKERINGcxx . . $ `Descent3/object.h:671:9`!) { |
| 431 | if (ps_randcxx . . $ ps_rand(b126dc7c1de90089).() % 2 == 1) |
| 432 | return; |
| 433 | } |
| 434 | |
| 435 | // If this object is based on timebits, then return if the corresponding bit |
| 436 | // is zero for this gametime |
| 437 | if (li->flagscxx . . $ light_info#flags. & OLF_TIMEBITScxx . . $ `Descent3/object.h:672:9`!) { |
| 438 | int int_time = (Gametimecxx . . $ Gametime. / li->time_intervalcxx . . $ light_info#time_interval.); |
| 439 | float left_time = (Gametimecxx . . $ Gametime. - (int_time * li->time_intervalcxx . . $ light_info#time_interval.)); |
| 440 | float slice_time = li->time_intervalcxx . . $ light_info#time_interval. / 8; |
| 441 | |
| 442 | int timebit_num = left_time / slice_time; |
| 443 | |
| 444 | if (!(li->timebitscxx . . $ light_info#timebits. & (1 << timebit_num))) |
| 445 | return; |
| 446 | } |
| 447 | |
| 448 | if (OBJECT_OUTSIDEcxx . . $ `lib/object_external_struct.h:130:9`!(obj)) |
| 449 | ApplyLightingToTerraincxx . . $ ApplyLightingToTerrain(31a30e6d6b9dd744).(&obj->poscxx . . $ object#pos., CELLNUMcxx . . $ `lib/object_external_struct.h:121:9`!(obj->roomnum), light_distance * scalar, red * negative_light, |
| 450 | green * negative_light, blue * negative_light, direction, li->directional_dotcxx . . $ light_info#directional_dot.); |
| 451 | else |
| 452 | ApplyLightingToRoomscxx . . $ ApplyLightingToRooms(31a30e6d6b9dd744).(&obj->poscxx . . $ object#pos., obj->roomnumcxx . . $ object#roomnum., light_distance * scalar, red * negative_light, |
| 453 | green * negative_light, blue * negative_light, direction, li->directional_dotcxx . . $ light_info#directional_dot.); |
| 454 | } |
| 455 | } |
| 456 | |
| 457 | // Frees all the memory associated with this objects lightmap |
| 458 | void ClearObjectLightmapscxx . . $ ClearObjectLightmaps(419c470199a90a97).(objectcxx . . $ object# *obj) { |
| 459 | int Mnum, Fnum; |
| 460 | |
| 461 | if (obj->lm_objectcxx . . $ object#lm_object..usedcxx . . $ lightmap_object#used. == 1) { |
| 462 | obj->lm_objectcxx . . $ object#lm_object..usedcxx . . $ lightmap_object#used. = 0; |
| 463 | 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.]; |
| 464 | ASSERTcxx . . $ `misc/pserror.h:246:9`!(pm->n_models < MAX_SUBOBJECTScxx . . $ `lib/polymodel_external.h:76:9`!); |
| 465 | |
| 466 | mprintfcxx . . $ `ddebug/mono.h:82:9`!(1, "CLEAR %d %s", obj->handle, obj->name); |
| 467 | |
| 468 | int faceCount = 0; |
| 469 | for (Mnum = 0; Mnum < pm->n_modelscxx . . $ poly_model#n_models.; Mnum++) { |
| 470 | if (!IsNonRenderableSubmodelcxx . . $ IsNonRenderableSubmodel(bb32db98789388a4).(pm, Mnum)) { |
| 471 | mprintfcxx . . $ `ddebug/mono.h:82:9`!(1, " %X\n", obj->lm_object.lightmap_faces[Mnum][0].u2); |
| 472 | mem_freecxx . . $ `mem/mem.h:80:9`!(obj->lm_object.lightmap_faces[Mnum][0].u2); |
| 473 | break; |
| 474 | } |
| 475 | } |
| 476 | for (Mnum = 0; Mnum < pm->n_modelscxx . . $ poly_model#n_models.; Mnum++) { |
| 477 | if (IsNonRenderableSubmodelcxx . . $ IsNonRenderableSubmodel(bb32db98789388a4).(pm, Mnum)) |
| 478 | continue; |
| 479 | |
| 480 | for (Fnum = 0; Fnum < pm->submodelcxx . . $ poly_model#submodel.[Mnum].num_facescxx . . $ bsp_info#num_faces.; Fnum++) { |
| 481 | lightmap_object_facecxx . . $ lightmap_object_face# *lof = &obj->lm_objectcxx . . $ object#lm_object..lightmap_facescxx . . $ lightmap_object#lightmap_faces.[Mnum][Fnum]; |
| 482 | |
| 483 | if (lof->lmi_handlecxx . . $ lightmap_object_face#lmi_handle. != BAD_LMI_INDEXcxx . . $ `Descent3/lightmap_info.h:46:9`!) { |
| 484 | FreeLightmapInfocxx . . $ FreeLightmapInfo(d4f767463ce0a6b3).(lof->lmi_handlecxx . . $ lightmap_object_face#lmi_handle.); |
| 485 | lof->lmi_handlecxx . . $ lightmap_object_face#lmi_handle. = BAD_LMI_INDEXcxx . . $ `Descent3/lightmap_info.h:46:9`!; |
| 486 | } |
| 487 | lof->num_vertscxx . . $ lightmap_object_face#num_verts. = 0; |
| 488 | } |
| 489 | |
| 490 | if (obj->lm_objectcxx . . $ object#lm_object..num_facescxx . . $ lightmap_object#num_faces.[Mnum]) { |
| 491 | mem_freecxx . . $ `mem/mem.h:80:9`!(obj->lm_object.lightmap_faces[Mnum]); |
| 492 | obj->lm_objectcxx . . $ object#lm_object..lightmap_facescxx . . $ lightmap_object#lightmap_faces.[Mnum] = NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:416:9`!; |
| 493 | } |
| 494 | obj->lm_objectcxx . . $ object#lm_object..num_facescxx . . $ lightmap_object#num_faces.[Mnum] = 0; |
| 495 | } |
| 496 | } |
| 497 | } |
| 498 | |
| 499 | // Frees all the memory associated with lightmap objects |
| 500 | void ClearAllObjectLightmapscxx . . $ ClearAllObjectLightmaps(d4f767463ce0a6b3).(int terrain) { |
| 501 | int i; |
| 502 | |
| 503 | for (i = 0; i <= Highest_object_indexcxx . . $ Highest_object_index.; i++) { |
| 504 | objectcxx . . $ object# *obj = &Objectscxx . . $ Objects.[i]; |
| 505 | |
| 506 | if ((OBJECT_OUTSIDEcxx . . $ `lib/object_external_struct.h:130:9`!(obj) != 0) != (terrain != 0)) |
| 507 | continue; |
| 508 | |
| 509 | if (obj->lm_objectcxx . . $ object#lm_object..usedcxx . . $ lightmap_object#used. == 1) { |
| 510 | ClearObjectLightmapscxx . . $ ClearObjectLightmaps(419c470199a90a97).(obj); |
| 511 | } |
| 512 | } |
| 513 | } |
| 514 | |
| 515 | // Sets up the memory to be used by an object for lightmaps |
| 516 | void SetupObjectLightmapMemorycxx . . $ SetupObjectLightmapMemory(419c470199a90a97).(objectcxx . . $ object# *obj) { |
| 517 | int Mnum, Fnum; |
| 518 | lightmap_object_facecxx . . $ lightmap_object_face# *lof; |
| 519 | |
| 520 | ASSERTcxx . . $ `misc/pserror.h:246:9`!(obj->lm_object.used == 0); |
| 521 | obj->lm_objectcxx . . $ object#lm_object..usedcxx . . $ lightmap_object#used. = 1; |
| 522 | |
| 523 | 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.]; |
| 524 | ASSERTcxx . . $ `misc/pserror.h:246:9`!(pm->new_style); |
| 525 | |
| 526 | obj->lm_objectcxx . . $ object#lm_object..num_modelscxx . . $ lightmap_object#num_models. = pm->n_modelscxx . . $ poly_model#n_models.; |
| 527 | |
| 528 | ASSERTcxx . . $ `misc/pserror.h:246:9`!(pm->n_models < MAX_SUBOBJECTScxx . . $ `lib/polymodel_external.h:76:9`!); |
| 529 | int uv2size = 0; |
| 530 | |
| 531 | mprintfcxx . . $ `ddebug/mono.h:82:9`!(1, "SETUP %d %s", obj->handle, obj->name); |
| 532 | for (Mnum = 0; Mnum < pm->n_modelscxx . . $ poly_model#n_models.; Mnum++) { |
| 533 | if (IsNonRenderableSubmodelcxx . . $ IsNonRenderableSubmodel(bb32db98789388a4).(pm, Mnum)) { |
| 534 | obj->lm_objectcxx . . $ object#lm_object..num_facescxx . . $ lightmap_object#num_faces.[Mnum] = 0; |
| 535 | obj->lm_objectcxx . . $ object#lm_object..lightmap_facescxx . . $ lightmap_object#lightmap_faces.[Mnum] = NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:416:9`!; |
| 536 | continue; |
| 537 | } |
| 538 | |
| 539 | obj->lm_objectcxx . . $ object#lm_object..num_facescxx . . $ lightmap_object#num_faces.[Mnum] = pm->submodelcxx . . $ poly_model#submodel.[Mnum].num_facescxx . . $ bsp_info#num_faces.; |
| 540 | obj->lm_objectcxx . . $ object#lm_object..lightmap_facescxx . . $ lightmap_object#lightmap_faces.[Mnum] = |
| 541 | (lightmap_object_facecxx . . $ lightmap_object_face# *)mem_malloccxx . . $ `mem/mem.h:79:9`!(obj->lm_object.num_faces[Mnum] * sizeof(lightmap_object_face)); |
| 542 | ASSERTcxx . . $ `misc/pserror.h:246:9`!(obj->lm_object.lightmap_faces[Mnum]); |
| 543 | |
| 544 | for (Fnum = 0; Fnum < pm->submodelcxx . . $ poly_model#submodel.[Mnum].num_facescxx . . $ bsp_info#num_faces.; Fnum++) { |
| 545 | lof = &obj->lm_objectcxx . . $ object#lm_object..lightmap_facescxx . . $ lightmap_object#lightmap_faces.[Mnum][Fnum]; |
| 546 | |
| 547 | lof->num_vertscxx . . $ lightmap_object_face#num_verts. = pm->submodelcxx . . $ poly_model#submodel.[Mnum].facescxx . . $ bsp_info#faces.[Fnum].nvertscxx . . $ polyface#nverts.; |
| 548 | lof->lmi_handlecxx . . $ lightmap_object_face#lmi_handle. = BAD_LMI_INDEXcxx . . $ `Descent3/lightmap_info.h:46:9`!; |
| 549 | |
| 550 | uv2size += lof->num_vertscxx . . $ lightmap_object_face#num_verts.; |
| 551 | } |
| 552 | } |
| 553 | if (uv2size) { |
| 554 | float *uvblock = (float *)mem_malloccxx . . $ `mem/mem.h:79:9`!(2 * uv2size * sizeof(float)); |
| 555 | mprintfcxx . . $ `ddebug/mono.h:82:9`!(1, " %X %d\n", uvblock, uv2size); |
| 556 | |
| 557 | for (Mnum = 0; Mnum < pm->n_modelscxx . . $ poly_model#n_models.; Mnum++) { |
| 558 | if (!IsNonRenderableSubmodelcxx . . $ IsNonRenderableSubmodel(bb32db98789388a4).(pm, Mnum)) { |
| 559 | for (Fnum = 0; Fnum < pm->submodelcxx . . $ poly_model#submodel.[Mnum].num_facescxx . . $ bsp_info#num_faces.; Fnum++) { |
| 560 | obj->lm_objectcxx . . $ object#lm_object..lightmap_facescxx . . $ lightmap_object#lightmap_faces.[Mnum][Fnum].u2cxx . . $ lightmap_object_face#u2. = uvblock; |
| 561 | uvblock += pm->submodelcxx . . $ poly_model#submodel.[Mnum].facescxx . . $ bsp_info#faces.[Fnum].nvertscxx . . $ polyface#nverts.; |
| 562 | obj->lm_objectcxx . . $ object#lm_object..lightmap_facescxx . . $ lightmap_object#lightmap_faces.[Mnum][Fnum].v2cxx . . $ lightmap_object_face#v2. = uvblock; |
| 563 | uvblock += pm->submodelcxx . . $ poly_model#submodel.[Mnum].facescxx . . $ bsp_info#faces.[Fnum].nvertscxx . . $ polyface#nverts.; |
| 564 | } |
| 565 | } |
| 566 | } |
| 567 | } |
| 568 | } |
| 569 | |
| 570 | // SHOULDN'T THE FOLLOWING TWO FUNCTIONS REALLY BE IN OBJECT.CPP? |
| 571 | #include "hlsoundlib.h"cxx . . $ `<file>/sndlib/hlsoundlib.h`/ |
| 572 | #include "soundload.h"cxx . . $ `<file>/sndlib/soundload.h`/ |
| 573 | #include "hud.h"cxx . . $ `<file>/Descent3/hud.h`/ |
| 574 | #include "stringtable.h"cxx . . $ `<file>/Descent3/stringtable.h`/ |
| 575 | // makes the an object cloaked |
| 576 | void MakeObjectInvisiblecxx . . $ MakeObjectInvisible(3cdd7424a643b971).(objectcxx . . $ object# *obj, float time, float fade_time, bool no_hud_message) { |
| 577 | if (obj->effect_infocxx . . $ object#effect_info.) { |
| 578 | obj->effect_infocxx . . $ object#effect_info.->cloak_timecxx . . $ effect_info_s#cloak_time. = time; |
| 579 | obj->effect_infocxx . . $ object#effect_info.->type_flagscxx . . $ effect_info_s#type_flags. |= EF_FADING_OUTcxx . . $ `Descent3/object_external.h:207:9`!; |
| 580 | obj->effect_infocxx . . $ object#effect_info.->fade_timecxx . . $ effect_info_s#fade_time. = fade_time; |
| 581 | obj->effect_infocxx . . $ object#effect_info.->fade_max_timecxx . . $ effect_info_s#fade_max_time. = fade_time; |
| 582 | } |
| 583 | |
| 584 | if (obj->typecxx . . $ object#type. == OBJ_PLAYERcxx . . $ `Descent3/object_external.h:164:9`! && !no_hud_message) { |
| 585 | static int cloak_sound_on_id = -2; |
| 586 | if (cloak_sound_on_id == -2) |
| 587 | cloak_sound_on_id = FindSoundNamecxx . . $ FindSoundName(5c4306d8553b3696).("Cloak on"); |
| 588 | |
| 589 | if (cloak_sound_on_id != -1) |
| 590 | Sound_systemcxx . . $ Sound_system..Play3dSoundcxx . . $ hlsSystem#Play3dSound(17f485224ada8dd7).(cloak_sound_on_id, SND_PRIORITY_HIGHESTcxx . . $ `sndlib/ssl_lib.h:282:9`!, obj, MAX_GAME_VOLUMEcxx . . $ `sndlib/ssl_lib.h:265:9`! / 2); |
| 591 | |
| 592 | if (obj->idcxx . . $ object#id. == Player_numcxx . . $ Player_num.) { |
| 593 | AddHUDMessagecxx . . $ AddHUDMessage(f90d95ab21fd6d97).(TXT_CLOAKONcxx . . $ `Descent3/stringtable.h:673:9`!); |
| 594 | } |
| 595 | |
| 596 | if (obj->effect_infocxx . . $ object#effect_info.) |
| 597 | obj->effect_infocxx . . $ object#effect_info.->type_flagscxx . . $ effect_info_s#type_flags. |= EF_CLOAK_WITH_MSGcxx . . $ `Descent3/object_external.h:209:9`!; |
| 598 | } |
| 599 | } |
| 600 | |
| 601 | // makes an object visbile |
| 602 | void MakeObjectVisiblecxx . . $ MakeObjectVisible(419c470199a90a97).(objectcxx . . $ object# *obj) { |
| 603 | if (obj->effect_infocxx . . $ object#effect_info.) { |
| 604 | // Play sound maybe. |
| 605 | obj->effect_infocxx . . $ object#effect_info.->type_flagscxx . . $ effect_info_s#type_flags. &= ~EF_CLOAKEDcxx . . $ `Descent3/object_external.h:197:9`!; |
| 606 | obj->effect_infocxx . . $ object#effect_info.->type_flagscxx . . $ effect_info_s#type_flags. |= EF_FADING_INcxx . . $ `Descent3/object_external.h:206:9`!; |
| 607 | obj->effect_infocxx . . $ object#effect_info.->fade_timecxx . . $ effect_info_s#fade_time. = obj->effect_infocxx . . $ object#effect_info.->fade_max_timecxx . . $ effect_info_s#fade_max_time.; |
| 608 | obj->effect_infocxx . . $ object#effect_info.->cloak_timecxx . . $ effect_info_s#cloak_time. = 0; |
| 609 | } |
| 610 | |
| 611 | if (obj->typecxx . . $ object#type. == OBJ_PLAYERcxx . . $ `Descent3/object_external.h:164:9`! && obj->effect_infocxx . . $ object#effect_info. && obj->effect_infocxx . . $ object#effect_info.->type_flagscxx . . $ effect_info_s#type_flags. & EF_CLOAK_WITH_MSGcxx . . $ `Descent3/object_external.h:209:9`!) { |
| 612 | static int cloak_sound_off_id = -2; |
| 613 | if (cloak_sound_off_id == -2) |
| 614 | cloak_sound_off_id = FindSoundNamecxx . . $ FindSoundName(5c4306d8553b3696).("Cloak off"); |
| 615 | |
| 616 | if (cloak_sound_off_id != -1) |
| 617 | Sound_systemcxx . . $ Sound_system..Play3dSoundcxx . . $ hlsSystem#Play3dSound(17f485224ada8dd7).(cloak_sound_off_id, SND_PRIORITY_HIGHESTcxx . . $ `sndlib/ssl_lib.h:282:9`!, obj, MAX_GAME_VOLUMEcxx . . $ `sndlib/ssl_lib.h:265:9`! / 2); |
| 618 | |
| 619 | if (obj->idcxx . . $ object#id. == Player_numcxx . . $ Player_num.) { |
| 620 | AddHUDMessagecxx . . $ AddHUDMessage(f90d95ab21fd6d97).(TXT_MSG_CLOAKOFFcxx . . $ `Descent3/stringtable.h:665:9`!); |
| 621 | } |
| 622 | } |
| 623 | } |
| 624 | |
| 625 | // Sets an object to have local lighting info |
| 626 | void ObjSetLocalLightingcxx . . $ ObjSetLocalLighting(419c470199a90a97).(objectcxx . . $ object# *objp) { |
| 627 | // If this object doesn't have its own lighting info, create it |
| 628 | if (objp->lighting_infocxx . . $ object#lighting_info. == NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:416:9`!) { |
| 629 | |
| 630 | // make sure this is a generic object |
| 631 | ASSERTcxx . . $ `misc/pserror.h:246:9`!((objp->type == OBJ_POWERUPcxx . . $ `Descent3/object_external.h:167:9`!) || (objp->type == OBJ_ROBOTcxx . . $ `Descent3/object_external.h:162:9`!) || (objp->type == OBJ_CLUTTERcxx . . $ `Descent3/object_external.h:171:9`!) || |
| 632 | (objp->type == OBJ_BUILDINGcxx . . $ `Descent3/object_external.h:176:9`!)); |
| 633 | |
| 634 | // allocate a light info for this object |
| 635 | objp->lighting_infocxx . . $ object#lighting_info. = (light_infocxx . . $ light_info# *)mem_malloccxx . . $ `mem/mem.h:79:9`!(sizeof(*objp->lighting_info)); |
| 636 | |
| 637 | // copy the lighting info from the type for this object |
| 638 | *objp->lighting_infocxx . . $ object#lighting_info. =cxx . . $ light_info#`operator=`(39c5b4f75ecb8956). Object_infocxx . . $ Object_info.[objp->idcxx . . $ object#id.].lighting_infocxx . . $ object_info#lighting_info.; |
| 639 | } |
| 640 | } |
| 641 | |
| 642 | // Returns a pointer to the lighting info for the specified object |
| 643 | light_infocxx . . $ light_info# *ObjGetLightInfocxx . . $ ObjGetLightInfo(fae61030adf16a8b).(objectcxx . . $ object# *objp) { |
| 644 | if (objp->lighting_infocxx . . $ object#lighting_info.) |
| 645 | return objp->lighting_infocxx . . $ object#lighting_info.; |
| 646 | |
| 647 | if ((objp->typecxx . . $ object#type. == OBJ_POWERUPcxx . . $ `Descent3/object_external.h:167:9`!) || (objp->typecxx . . $ object#type. == OBJ_ROBOTcxx . . $ `Descent3/object_external.h:162:9`!) || (objp->typecxx . . $ object#type. == OBJ_CLUTTERcxx . . $ `Descent3/object_external.h:171:9`!) || |
| 648 | (objp->typecxx . . $ object#type. == OBJ_BUILDINGcxx . . $ `Descent3/object_external.h:176:9`!)) |
| 649 | return &Object_infocxx . . $ Object_info.[objp->idcxx . . $ object#id.].lighting_infocxx . . $ object_info#lighting_info.; |
| 650 | |
| 651 | if (objp->typecxx . . $ object#type. == OBJ_WEAPONcxx . . $ `Descent3/object_external.h:165:9`!) |
| 652 | return &Weaponscxx . . $ Weapons.[objp->idcxx . . $ object#id.].lighting_infocxx . . $ weapon#lighting_info.; |
| 653 | |
| 654 | Int3cxx . . $ `misc/pserror.h:247:9`!(); |
| 655 | |
| 656 | return NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:416:9`!; |
| 657 | } |