MCPcopy Create free account
hub / github.com/DescentDevelopers/Descent3 / ObjDoEffects

Function ObjDoEffects

Descent3/object.cpp:2465–2598  ·  view source on GitHub ↗

Do any special effects processing for this object

Source from the content-addressed store, hash-verified

2463
2464// Do any special effects processing for this object
2465void ObjDoEffects(object *obj) {
2466 if (!obj->effect_info)
2467 return;
2468
2469 static int napalm_id = -1;
2470
2471 if (napalm_id == -1)
2472 napalm_id = FindWeaponName("Napalm");
2473
2474 if (obj->effect_info->type_flags & EF_VOLUME_CHANGING) {
2475 obj->effect_info->volume_change_time -= Frametime;
2476 if (obj->effect_info->volume_change_time <= 0.0f) {
2477 obj->effect_info->type_flags &= ~EF_VOLUME_CHANGING;
2478 }
2479 }
2480
2481 if (obj->effect_info->type_flags & EF_FADING_IN) {
2482 obj->effect_info->fade_time -= Frametime;
2483 if (obj->effect_info->fade_time <= 0.0f) {
2484 obj->effect_info->type_flags &= ~EF_FADING_IN;
2485 }
2486 }
2487
2488 if (obj->effect_info->type_flags & EF_CLOAKED) {
2489 obj->effect_info->cloak_time -= Frametime;
2490 if (obj->effect_info->cloak_time <= 0.0f) {
2491 // reappear the object
2492 MakeObjectVisible(obj);
2493 }
2494 }
2495
2496 if (obj->effect_info->type_flags & EF_FADING_OUT) {
2497 obj->effect_info->fade_time -= Frametime;
2498 if (obj->effect_info->fade_time <= 0.0f) {
2499 obj->effect_info->type_flags &= ~EF_FADING_OUT;
2500 obj->effect_info->type_flags |= EF_CLOAKED;
2501 }
2502 }
2503
2504 if (obj->effect_info->type_flags & EF_LIQUID) {
2505 obj->effect_info->liquid_time_left -= Frametime;
2506 if (obj->effect_info->liquid_time_left <= 0.0f) {
2507 // Stop doing liquid effect
2508 obj->effect_info->type_flags &= ~EF_LIQUID;
2509 if (obj == Viewer_object)
2510 Render_FOV = D3_DEFAULT_FOV;
2511 } else {
2512 if (obj == Viewer_object) {
2513 int inttime = Gametime;
2514 float normtime = Gametime - inttime;
2515
2516 float scalar = FixSin(normtime * 65535 * 4);
2517
2518 scalar *= ((float)obj->effect_info->liquid_mag);
2519 if (obj->effect_info->liquid_time_left < 1)
2520 scalar *= (obj->effect_info->liquid_time_left);
2521
2522 Render_FOV = D3_DEFAULT_FOV + scalar;

Callers 1

ObjDoFrameFunction · 0.85

Calls 8

FindWeaponNameFunction · 0.85
MakeObjectVisibleFunction · 0.85
ApplyDamageToPlayerFunction · 0.85
ApplyDamageToGenericFunction · 0.85
CreateElectricalBoltsFunction · 0.85
StopSoundLoopingMethod · 0.80
FixSinFunction · 0.50

Tested by

no test coverage detected