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

Function DoDebrisFrame

Descent3/fireball.cpp:1224–1257  ·  view source on GitHub ↗

------------------------------------------------------------------------------------------------------- do whatever needs to be done for this piece of debris for this frame

Source from the content-addressed store, hash-verified

1222// -------------------------------------------------------------------------------------------------------
1223// do whatever needs to be done for this piece of debris for this frame
1224void DoDebrisFrame(object *obj) {
1225 ASSERT(obj->control_type == CT_DEBRIS);
1226 // Get death flags
1227 int death_flags = obj->ctype.debris_info.death_flags;
1228 // See if we're dead
1229 if ((obj->lifeleft <= 0.0) || (obj->mtype.phys_info.num_bounces < 1)) {
1230 // If explodes, create fireball & sound
1231 if (death_flags & DF_DEBRIS_FIREBALL) {
1232 Sound_system.Play3dSound(SOUND_DEBRIS_EXPLODE, SND_PRIORITY_NORMAL, obj);
1233 CreateObjectFireball(obj);
1234 }
1235 // If debris has a blast ring, create it
1236 if (death_flags & DF_DEBRIS_BLAST_RING)
1237 CreateObjectBlastRing(obj);
1238 // Make debris go away, or make it inactive
1239 if (!(death_flags & DF_DEBRIS_REMAINS))
1240 SetObjectDeadFlag(obj);
1241 else
1242 SetObjectControlType(obj, CT_NONE);
1243 // Done with this debris
1244 return;
1245 }
1246 // Create smoke, if this debris smokes
1247 if (death_flags & DF_DEBRIS_SMOKES) {
1248 if (Gametime - obj->ctype.debris_info.last_smoke_time > .015 && (rand() % 2)) {
1249 // Create a small flame puff every now and then
1250 int visnum = CreateFireball(&obj->pos, BLACK_SMOKE_INDEX, obj->roomnum, VISUAL_FIREBALL);
1251
1252 if (visnum >= 0)
1253 VisEffects[visnum].size = obj->size / 2; // Make small!
1254 obj->ctype.debris_info.last_smoke_time = Gametime;
1255 }
1256 }
1257}
1258// Create electrical bolts on an object
1259void CreateElectricalBolts(object *objp, int num_bolts) {
1260 for (int i = 0; i < num_bolts; i++) {

Callers 1

ObjDoFrameFunction · 0.85

Calls 6

CreateObjectFireballFunction · 0.85
CreateObjectBlastRingFunction · 0.85
SetObjectDeadFlagFunction · 0.85
SetObjectControlTypeFunction · 0.85
CreateFireballFunction · 0.85
Play3dSoundMethod · 0.80

Tested by

no test coverage detected