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

Function TimeoutWeapon

Descent3/WeaponFire.cpp:3356–3386  ·  view source on GitHub ↗

Does whatever to be done when a weapon times out

Source from the content-addressed store, hash-verified

3354
3355// Does whatever to be done when a weapon times out
3356void TimeoutWeapon(object *obj) {
3357 int n = obj->id;
3358
3359 if ((Weapons[n].flags & WF_SPAWNS_TIMEOUT) && Weapons[n].spawn_count > 0 && Weapons[n].spawn_handle >= 0) {
3360 DoWeaponExploded(obj, &obj->orient.fvec);
3361 CreateTimeoutSpawnFromWeapon(obj);
3362 }
3363
3364 if ((Weapons[n].flags & WF_MATTER_WEAPON) && !(Weapons[n].flags & WF_SPAWNS_TIMEOUT) &&
3365 (Weapons[n].spawn_count <= 0)) {
3366 vector temp = Zero_vector;
3367
3368 if (Weapons[obj->id].sounds[WSI_IMPACT_WALL] != SOUND_NONE_INDEX)
3369 Sound_system.Play3dSound(Weapons[obj->id].sounds[WSI_IMPACT_WALL], SND_PRIORITY_HIGH, obj);
3370
3371 temp.y = 1.0;
3372
3373 DoWeaponExploded(obj, &temp);
3374 }
3375
3376 if (Weapons[n].flags & WF_TIMEOUT_WALL) {
3377 if (Weapons[obj->id].sounds[WSI_IMPACT_WALL] != SOUND_NONE_INDEX)
3378 Sound_system.Play3dSound(Weapons[obj->id].sounds[WSI_IMPACT_WALL], SND_PRIORITY_HIGH, obj);
3379
3380 DoWeaponExploded(obj);
3381 }
3382
3383 if ((Weapons[obj->id].flags & WF_SPAWNS_ROBOT) && (Weapons[obj->id].flags & WF_COUNTERMEASURE) &&
3384 Weapons[obj->id].robot_spawn_handle >= 0)
3385 CreateRobotSpawnFromWeapon(obj);
3386}
3387
3388// Given a parent object and a weapon id, creates that countermeasure
3389void CreateCountermeasureFromObject(object *parent, int weapon_id) {

Callers 2

TimeoutObjectFunction · 0.85

Calls 4

DoWeaponExplodedFunction · 0.85
Play3dSoundMethod · 0.80

Tested by

no test coverage detected