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

Function DrawBlastRingObject

Descent3/fireball.cpp:2236–2348  ·  view source on GitHub ↗

TODO: MTS: only used in this file. Draws a blast ring

Source from the content-addressed store, hash-verified

2234// TODO: MTS: only used in this file.
2235// Draws a blast ring
2236void DrawBlastRingObject(object *obj) {
2237 vector inner_vecs[30], outer_vecs[30];
2238 g3Point inner_points[30], outer_points[30];
2239 float lifenorm = (obj->lifetime - obj->lifeleft) / obj->lifetime;
2240 float cur_size = lifenorm * obj->ctype.blast_info.max_size;
2241 int i;
2242 g3Point *pntlist[4];
2243 static int grav_first = 1;
2244 static int grav_texture;
2245
2246 if (obj->id == GRAVITY_FIELD_INDEX)
2247 cur_size = (1 - lifenorm) * obj->ctype.blast_info.max_size;
2248
2249 int bm_handle = obj->ctype.blast_info.bm_handle;
2250 int num_segments = 20;
2251 int ring_increment = 65536 / num_segments;
2252 int ring_angle = 0;
2253
2254 if (lifenorm > 1.0)
2255 lifenorm = 1.0;
2256 // First draw a blast sphere
2257 float sphere_norm;
2258 int rot_angle;
2259 // Scale lifetime to make it look like a lensflare
2260 if (lifenorm < .1) {
2261 sphere_norm = lifenorm * 10;
2262 rot_angle = (FrameCount * 20) % 65536;
2263 } else {
2264 sphere_norm = 1.0 - ((lifenorm - .1) * 1.5);
2265 rot_angle = (FrameCount * 550) % 65536;
2266 if (sphere_norm < 0)
2267 sphere_norm = 0;
2268 }
2269 float sphere_alpha = sphere_norm;
2270 int disk_handle;
2271 float disk_size = sphere_norm * obj->ctype.blast_info.max_size;
2272 if (obj->id == GRAVITY_FIELD_INDEX) {
2273 rend_SetZBias(-(cur_size / 2));
2274 DrawColoredDisk(&obj->pos, .3f, .5f, 1, .9f, 0, disk_size, 1, 0);
2275 // Set states for the ring
2276 rend_SetOverlayType(OT_NONE);
2277 rend_SetLighting(LS_NONE);
2278 rend_SetTextureType(TT_LINEAR);
2279 rend_SetAlphaType(AT_SATURATE_TEXTURE);
2280 rend_SetAlphaValue(sphere_alpha * 255.0);
2281 rend_SetZBufferWriteMask(0);
2282
2283 } else {
2284 disk_handle = Fireballs[SHRINKING_BLAST_INDEX].bm_handle;
2285
2286 rend_SetOverlayType(OT_NONE);
2287 rend_SetLighting(LS_NONE);
2288 rend_SetTextureType(TT_LINEAR);
2289 rend_SetAlphaType(AT_SATURATE_TEXTURE);
2290 rend_SetAlphaValue(sphere_alpha * 255.0);
2291 rend_SetZBufferWriteMask(0);
2292 rend_SetZBias(-(cur_size / 2));
2293 if (sphere_norm >= 0.0)

Callers 1

DrawFireballObjectFunction · 0.85

Calls 15

DrawColoredDiskFunction · 0.85
g3_DrawRotatedBitmapFunction · 0.85
bm_hFunction · 0.85
bm_wFunction · 0.85
g3_RotatePointFunction · 0.85
g3_DrawPolyFunction · 0.85
rend_SetZBiasFunction · 0.50
rend_SetOverlayTypeFunction · 0.50
rend_SetLightingFunction · 0.50
rend_SetTextureTypeFunction · 0.50
rend_SetAlphaTypeFunction · 0.50
rend_SetAlphaValueFunction · 0.50

Tested by

no test coverage detected