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

Function DrawWeaponStreamer

Descent3/WeaponFire.cpp:2423–2463  ·  view source on GitHub ↗

Draws a streamer behind a weapon

Source from the content-addressed store, hash-verified

2421
2422// Draws a streamer behind a weapon
2423void DrawWeaponStreamer(object *obj) {
2424 float time_live = Gametime - obj->creation_time;
2425 float len;
2426 float norm_time = time_live / obj->lifetime;
2427
2428 if (norm_time >= 1)
2429 norm_time = .99999f; // don't go over!
2430
2431 // Get length
2432 object *parent_obj = ObjGet(obj->parent_handle);
2433
2434 if (!parent_obj)
2435 return;
2436
2437 len = vm_VectorDistance(&parent_obj->pos, &obj->pos);
2438
2439 rend_SetAlphaType(AT_VERTEX);
2440 rend_SetTextureType(TT_FLAT);
2441 rend_SetLighting(LS_GOURAUD);
2442 rend_SetColorModel(CM_RGB);
2443
2444 vector vecs[2];
2445 g3Point pnts[2];
2446 int i;
2447
2448 vecs[0] = obj->pos;
2449 vecs[1] = obj->pos - (obj->orient.fvec * len);
2450
2451 for (i = 0; i < 2; i++) {
2452 g3_RotatePoint(&pnts[i], &vecs[i]);
2453 pnts[i].p3_flags |= PF_RGBA;
2454 pnts[i].p3_r = Weapons[obj->id].lighting_info.red_light1;
2455 pnts[i].p3_g = Weapons[obj->id].lighting_info.green_light1;
2456 pnts[i].p3_b = Weapons[obj->id].lighting_info.blue_light1;
2457 }
2458
2459 pnts[0].p3_a = (1.0 - norm_time) * .3f;
2460 pnts[1].p3_a = 0;
2461
2462 g3_DrawSpecialLine(&pnts[0], &pnts[1]);
2463}
2464
2465void DrawBlobbyWeaponRing(object *obj) {
2466 vector vecs[30];

Callers 1

DrawWeaponObjectFunction · 0.85

Calls 8

ObjGetFunction · 0.85
g3_RotatePointFunction · 0.85
g3_DrawSpecialLineFunction · 0.85
vm_VectorDistanceFunction · 0.50
rend_SetAlphaTypeFunction · 0.50
rend_SetTextureTypeFunction · 0.50
rend_SetLightingFunction · 0.50
rend_SetColorModelFunction · 0.50

Tested by

no test coverage detected