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

Function DrawVisMassDriverEffect

Descent3/viseffect.cpp:1653–1801  ·  view source on GitHub ↗

Draws a long "stick" to represent the mass driver trail

Source from the content-addressed store, hash-verified

1651
1652// Draws a long "stick" to represent the mass driver trail
1653void DrawVisMassDriverEffect(vis_effect *vis, bool f_boss) {
1654 int i, t, k;
1655 static int masstrail = -1;
1656
1657 if (masstrail == -1)
1658 masstrail = FindTextureName("MassTrail");
1659 ASSERT(masstrail != -1); // DAJ -1FIX
1660
1661 vector center_vecs[2];
1662 g3Point arc_points[32], *pntlist[32];
1663
1664 center_vecs[0] = vis->pos;
1665 center_vecs[1] = vis->end_pos;
1666
1667 vector normvec = center_vecs[1] - center_vecs[0];
1668 matrix orient;
1669
1670 vm_NormalizeVector(&normvec);
1671 vm_VectorToMatrix(&orient, &normvec, NULL, NULL);
1672
1673 float size = ((float)vis->billboard_info.width) * .25;
1674 int circle_pieces = 16;
1675
1676 if (f_boss) {
1677 size *= 3.0f;
1678 }
1679
1680 float mag = vm_VectorDistanceQuick(&vis->pos, &vis->end_pos);
1681 vector dir_norm = (vis->end_pos - vis->pos) / mag;
1682 float alpha_norm = (vis->lifeleft / vis->lifetime) * .5;
1683 int bm_handle = GetTextureBitmap(vis->custom_handle, 0);
1684
1685 rend_SetAlphaType(AT_SATURATE_TEXTURE);
1686 rend_SetOverlayType(OT_NONE);
1687 rend_SetTextureType(TT_LINEAR);
1688 rend_SetLighting(LS_FLAT_GOURAUD);
1689 rend_SetZBufferWriteMask(0);
1690 if (f_boss)
1691 rend_SetFlatColor(GR_RGB(255, 170, 170));
1692 else
1693 rend_SetFlatColor(GR_RGB(200, 200, 255));
1694
1695 rend_SetAlphaValue(255 * alpha_norm);
1696
1697 for (i = 0; i < 2; i++) {
1698 for (t = 0; t < circle_pieces; t++) {
1699 float norm = (float)t / (float)circle_pieces;
1700 vector arc_vec = center_vecs[i];
1701
1702 arc_vec += (orient.uvec * (size / 4) * FixSin(norm * 65536));
1703 arc_vec -= (orient.rvec * (size / 4) * FixCos(norm * 65536));
1704
1705 g3_RotatePoint(&arc_points[i * circle_pieces + t], &arc_vec);
1706 arc_points[i * circle_pieces + t].p3_flags |= PF_UV | PF_RGBA;
1707 }
1708 }
1709
1710 for (k = 0; k < circle_pieces; k++) {

Callers 1

DrawVisEffectFunction · 0.85

Calls 15

FindTextureNameFunction · 0.85
vm_NormalizeVectorFunction · 0.85
GetTextureBitmapFunction · 0.85
g3_RotatePointFunction · 0.85
g3_DrawPolyFunction · 0.85
GR_16_TO_COLORFunction · 0.85
bm_hFunction · 0.85
bm_wFunction · 0.85
vm_VectorToMatrixFunction · 0.50
vm_VectorDistanceQuickFunction · 0.50
rend_SetAlphaTypeFunction · 0.50

Tested by

no test coverage detected