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

Function DoExplosionFrame

Descent3/fireball.cpp:1707–1757  ·  view source on GitHub ↗

do whatever needs to be done for this explosion for this frame

Source from the content-addressed store, hash-verified

1705}
1706// do whatever needs to be done for this explosion for this frame
1707void DoExplosionFrame(object *obj) {
1708 ASSERT(obj->control_type == CT_EXPLOSION);
1709 ASSERT(obj->type != OBJ_PLAYER);
1710 if (obj->id == GRAVITY_FIELD_INDEX) {
1711 DoGravityFieldEffect(obj);
1712 }
1713
1714 // See if we should die of old age
1715 if (obj->lifeleft <= 0.0) {
1716 if (obj->id == GRAVITY_FIELD_INDEX) {
1717 // Create a big ass explosion
1718 if (OBJECT_OUTSIDE(obj))
1719 CreateBlastRing(&obj->pos, BLAST_RING_INDEX, DAMAGE_RING_TIME, obj->ctype.blast_info.max_size * 3, obj->roomnum,
1720 1);
1721 else
1722 CreateBlastRing(&obj->pos, BLAST_RING_INDEX, DAMAGE_RING_TIME, obj->ctype.blast_info.max_size, obj->roomnum, 1);
1723
1724 // Blow the damn thing up and register a kill.
1725
1726 float mag = vm_VectorDistanceQuick(&obj->pos, &Player_object->pos);
1727 if (mag > obj->ctype.blast_info.max_size)
1728 mag = 0;
1729 else
1730 mag = 1.0 - (mag / obj->ctype.blast_info.max_size);
1731
1732 if (OBJECT_OUTSIDE(Viewer_object))
1733 AddToShakeMagnitude(mag * obj->ctype.blast_info.max_size * 5);
1734 else
1735 AddToShakeMagnitude(mag * obj->ctype.blast_info.max_size * 2);
1736 obj->impact_time = 0;
1737 obj->impact_size = obj->ctype.blast_info.max_size;
1738 obj->impact_force = obj->impact_size * 2;
1739 obj->impact_player_damage = obj->impact_size * 3;
1740 obj->impact_generic_damage = obj->impact_size * 3;
1741
1742 if (Game_mode & GM_MULTI) // Do different damage to players if in multiplayer
1743 DoConcussiveForce(obj, obj->parent_handle, 1.0f / 5.0f);
1744 else
1745 DoConcussiveForce(obj, obj->parent_handle, 1.0);
1746 CreateRandomSparks(200, &obj->pos, obj->roomnum, -1, (ps_rand() % 2) + 2);
1747
1748 int explode_visnum = CreateFireball(&obj->pos, BLUE_EXPLOSION_INDEX, obj->roomnum, VISUAL_FIREBALL);
1749 if (explode_visnum >= 0)
1750 VisEffects[explode_visnum].size = obj->ctype.blast_info.max_size;
1751 }
1752
1753 // We died of old age
1754 SetObjectDeadFlag(obj);
1755 obj->lifeleft = 0.0;
1756 }
1757}
1758void MakeShockwave(object *explode_obj_ptr, int parent_handle) {
1759 if (explode_obj_ptr->impact_time > 0.0) {
1760 object *p = ObjGet(parent_handle);

Callers 1

ObjDoFrameFunction · 0.85

Calls 9

DoGravityFieldEffectFunction · 0.85
CreateBlastRingFunction · 0.85
AddToShakeMagnitudeFunction · 0.85
DoConcussiveForceFunction · 0.85
CreateRandomSparksFunction · 0.85
ps_randFunction · 0.85
CreateFireballFunction · 0.85
SetObjectDeadFlagFunction · 0.85
vm_VectorDistanceQuickFunction · 0.50

Tested by

no test coverage detected