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

Function DrawBlobbyWeaponRing

Descent3/WeaponFire.cpp:2465–2507  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

2463}
2464
2465void DrawBlobbyWeaponRing(object *obj) {
2466 vector vecs[30];
2467 float lifenorm = (obj->lifetime - obj->lifeleft) / obj->lifetime;
2468 int i;
2469
2470 int bm_handle;
2471 int num_segments = 20;
2472
2473 int ring_increment = 65536 / num_segments;
2474 int ring_angle = 0;
2475
2476 if (lifenorm >= 1.0)
2477 lifenorm = .999f;
2478
2479 if (Weapons[obj->id].flags & WF_IMAGE_BITMAP)
2480 bm_handle = GetWeaponFireImage(obj->id, 0);
2481 else {
2482 vclip *vc = &GameVClips[Weapons[obj->id].fire_image_handle];
2483 int int_frame = vc->num_frames * lifenorm;
2484 bm_handle = vc->frames[int_frame];
2485 }
2486
2487 rend_SetLighting(LS_NONE);
2488 rend_SetTextureType(TT_LINEAR);
2489 rend_SetAlphaType(AT_CONSTANT_TEXTURE);
2490 rend_SetAlphaValue((1.0 - lifenorm) * 255.0);
2491
2492 // Now draw a ring of blobs
2493 ring_angle = 0;
2494 float blob_size = (obj->size / 4);
2495
2496 for (i = 0; i < num_segments; i++, ring_angle += ring_increment) {
2497 float ring_sin = FixSin(ring_angle);
2498 float ring_cos = FixCos(ring_angle);
2499
2500 vecs[i] = obj->orient.rvec * (ring_cos * obj->size);
2501 vecs[i] += obj->orient.uvec * (ring_sin * obj->size);
2502 vecs[i] += obj->pos;
2503
2504 g3_DrawRotatedBitmap(&vecs[i], ring_angle, blob_size, (blob_size * bm_h(bm_handle, 0)) / bm_w(bm_handle, 0),
2505 bm_handle);
2506 }
2507}
2508
2509void DrawPolygonalWeaponRing(object *obj) {
2510 vector inner_vecs[30], outer_vecs[30];

Callers 1

DrawWeaponRingFunction · 0.85

Calls 10

GetWeaponFireImageFunction · 0.85
g3_DrawRotatedBitmapFunction · 0.85
bm_hFunction · 0.85
bm_wFunction · 0.85
rend_SetLightingFunction · 0.50
rend_SetTextureTypeFunction · 0.50
rend_SetAlphaTypeFunction · 0.50
rend_SetAlphaValueFunction · 0.50
FixSinFunction · 0.50
FixCosFunction · 0.50

Tested by

no test coverage detected