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

Function WeaponDoFrame

Descent3/WeaponFire.cpp:1629–1729  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

1627}
1628
1629void WeaponDoFrame(object *obj) {
1630 bool draw_effects = 1;
1631
1632 if (!Detail_settings.Weapon_coronas_enabled)
1633 draw_effects = 0;
1634
1635 if (MAX_WEAPON_NOT_HIT_PARENT_TIME + obj->creation_time < Gametime)
1636 obj->mtype.phys_info.flags &= (~PF_NO_COLLIDE_PARENT);
1637
1638 if ((obj->mtype.phys_info.flags & PF_USES_THRUST) && (obj->ctype.laser_info.thrust_left >= 0.0)) {
1639 obj->ctype.laser_info.thrust_left -= Frametime;
1640
1641 if ((obj->creation_time + 0.1f < Gametime) && (obj->mtype.phys_info.flags & PF_HOMING) &&
1642 !(obj->mtype.phys_info.flags & PF_GUIDED)) {
1643 obj->ctype.laser_info.last_track_time = Gametime - HOMING_CHECK_VIS_INTERVAL;
1644 HomingDoFrame(obj);
1645 }
1646
1647 if (obj->ctype.laser_info.thrust_left <= 0.0) {
1648 obj->mtype.phys_info.flags &= (~PF_USES_THRUST);
1649 vm_MakeZero(&obj->mtype.phys_info.thrust);
1650 vm_MakeZero(&obj->mtype.phys_info.rotthrust);
1651
1652 obj->mtype.phys_info.drag = 0.005f;
1653 obj->mtype.phys_info.rotdrag = 0.005f;
1654
1655 obj->mtype.phys_info.flags |= PF_GRAVITY;
1656 }
1657 }
1658
1659 if ((Weapons[obj->id].flags & WF_SMOKE) && draw_effects) {
1660 if (Weapons[obj->id].flags & WF_PLANAR_SMOKE) {
1661 vector newpos = obj->pos - (obj->orient.fvec * (obj->size / 2));
1662 int visnum = VisEffectCreate(VIS_FIREBALL, BILLBOARD_SMOKETRAIL_INDEX, obj->roomnum, &newpos);
1663 if (visnum >= 0) {
1664 vis_effect *vis = &VisEffects[visnum];
1665 vis->custom_handle = Weapons[obj->id].smoke_handle;
1666 vis->lifeleft = 1.0;
1667 vis->lifetime = 1.0;
1668
1669 vis->end_pos = obj->ctype.laser_info.last_smoke_pos;
1670 vis->billboard_info.width = 4;
1671 vis->lighting_color = GR_RGB16(Weapons[obj->id].lighting_info.red_light1 * 255.0,
1672 Weapons[obj->id].lighting_info.green_light1 * 255.0,
1673 Weapons[obj->id].lighting_info.blue_light1 * 255.0);
1674 obj->ctype.laser_info.last_smoke_pos = vis->pos;
1675 }
1676 } else {
1677 // Create blobby smoke
1678 // Create extras
1679 vector blobpos = obj->pos - (obj->orient.fvec * obj->size);
1680
1681 float delta_time = Frametime;
1682 vector delta_vec = obj->mtype.phys_info.velocity * delta_time;
1683
1684 float mag = vm_GetMagnitudeFast(&delta_vec);
1685 float extras = (mag * 4) + .5;
1686 int int_extras = extras + 1;

Callers 1

ObjDoFrameFunction · 0.85

Calls 7

HomingDoFrameFunction · 0.85
vm_MakeZeroFunction · 0.85
VisEffectCreateFunction · 0.85
GR_RGB16Function · 0.85
CreateFireballFunction · 0.85
CreateRandomParticlesFunction · 0.85
vm_GetMagnitudeFastFunction · 0.50

Tested by

no test coverage detected