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

Function CreateSubobjectDebris

Descent3/fireball.cpp:963–973  ·  view source on GitHub ↗

Creates a subobject debris piece that goes off in a random direction

Source from the content-addressed store, hash-verified

961}
962// Creates a subobject debris piece that goes off in a random direction
963object *CreateSubobjectDebris(object *parent, int subobj_num, float explosion_mag, int death_flags) {
964 vector rand_vec;
965 // Set physics data for this object
966 rand_vec.x = (float)(D3_RAND_MAX / 2 - ps_rand());
967 rand_vec.y = (float)(D3_RAND_MAX / 2 - ps_rand()) + .2f * D3_RAND_MAX; // a habit of moving upwards
968 rand_vec.z = (float)(D3_RAND_MAX / 2 - ps_rand());
969
970 vm_NormalizeVectorFast(&rand_vec);
971 explosion_mag *= 1.0f + ((float)(D3_RAND_MAX / 2 - ps_rand()) / (float)(D3_RAND_MAX / 2) * 0.05); // +5/-5 percent
972 return CreateSubobjectDebrisDirected(parent, subobj_num, &rand_vec, explosion_mag, death_flags);
973}
974// Create extra fireballs for an exploding object
975void CreateExtraFireballs(object *obj, float size_scale) {
976 // Create some extra explosions to start later

Callers 1

BreakApartModelFunction · 0.85

Calls 3

ps_randFunction · 0.85
vm_NormalizeVectorFastFunction · 0.85

Tested by

no test coverage detected