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

Function DoExplosionEvent

Descent3/fireball.cpp:2357–2394  ·  view source on GitHub ↗

TODO: MTS: only used in this file. Creates an explosion

Source from the content-addressed store, hash-verified

2355// TODO: MTS: only used in this file.
2356// Creates an explosion
2357void DoExplosionEvent(int eventnum, void *data) {
2358 float *vals = (float *)data;
2359 vector pos;
2360 int fireball_num, roomnum;
2361 float size;
2362 float upwards_velocity;
2363 pos_state sound_pos;
2364 pos.x = vals[0];
2365 pos.y = vals[1];
2366 pos.z = vals[2];
2367 fireball_num = (int)vals[3];
2368 roomnum = (int)vals[4];
2369 size = vals[5];
2370 upwards_velocity = vals[6];
2371 int visnum = CreateFireball(&pos, fireball_num, roomnum, VISUAL_FIREBALL);
2372 if (visnum >= 0) {
2373 vector zero_vec = {0, 0, 0};
2374 matrix id_mat = Identity_matrix;
2375
2376 sound_pos.position = &pos;
2377 sound_pos.roomnum = roomnum;
2378 sound_pos.orient = &id_mat;
2379 sound_pos.velocity = &zero_vec;
2380
2381 if (ps_rand() > D3_RAND_MAX / 2)
2382 Sound_system.Play3dSound(SOUND_ROBOT_EXPLODE_1, SND_PRIORITY_HIGH, &sound_pos);
2383 else
2384 Sound_system.Play3dSound(SOUND_ROBOT_EXPLODE_2, SND_PRIORITY_HIGH, &sound_pos);
2385 VisEffects[visnum].size = size;
2386 if (upwards_velocity > .001) {
2387 VisEffects[visnum].movement_type = MT_PHYSICS;
2388 VisEffects[visnum].phys_flags = PF_FIXED_VELOCITY;
2389 VisEffects[visnum].velocity.x = 0;
2390 VisEffects[visnum].velocity.z = 0;
2391 VisEffects[visnum].velocity.y = upwards_velocity;
2392 }
2393 }
2394}
2395// An event handler that simply draws an alpha blended poly on top of the screen
2396// Takes a 4 element array of floats int r,g,b,a format
2397void DrawAlphaEvent(int eventnum, void *data) {

Callers

nothing calls this directly

Calls 3

CreateFireballFunction · 0.85
ps_randFunction · 0.85
Play3dSoundMethod · 0.80

Tested by

no test coverage detected