MCPcopy Create free account
hub / github.com/bfbbdecomp/bfbb / zEntDestructObj_DestroyFX

Function zEntDestructObj_DestroyFX

src/SB/Game/zEntDestructObj.cpp:364–409  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

362}
363
364void zEntDestructObj_DestroyFX(zEntDestructObj* ent)
365{
366 xVec3 entDistanceFromPlayer;
367 xSFXAsset* sfxAsset;
368 _tagSDRumbleType sdrRumbleType;
369 u8 fxType;
370
371 sfxAsset = ent->sfx_destroy;
372 if (sfxAsset != NULL)
373 {
374 xSndPlay3D(sfxAsset->soundAssetID, (F32)sfxAsset->volume, (F32)0.0f, (U32)0x80, (U32)0x0,
375 &sfxAsset->pos, (F32)0.0f, (sound_category)0, (F32)0.0f);
376 }
377
378 sdrRumbleType = SDR_Total;
379 ent->fx_timer = 0.33f;
380 fxType = ent->dasset->fxType;
381 switch (fxType)
382 {
383 case 0:
384 ent->fx_emitter = NULL;
385 break;
386 case 1:
387 sdrRumbleType = SDR_DustDestroyedObj;
388 ent->fx_emitter = sEmitDust;
389 break;
390 case 2:
391 sdrRumbleType = SDR_XploDestroyedObj;
392 ent->fx_emitter = sEmitXplo;
393 break;
394 case 3:
395 sdrRumbleType = SDR_WebDestroyed;
396 ent->fx_emitter = sEmitWeb;
397 break;
398 }
399
400 if (sdrRumbleType != SDR_Total)
401 {
402 xVec3Sub(&entDistanceFromPlayer, xEntGetPos((xEnt*)ent), xEntGetPos(&globals.player.ent));
403
404 if (xVec3Dot(&entDistanceFromPlayer, &entDistanceFromPlayer) <= 25.0f)
405 {
406 zRumbleStart((S32)globals.currentActivePad, sdrRumbleType);
407 }
408 }
409}
410
411S32 zEntDestructObjEventCB(xBase* from, xBase* to, U32 toEvent, const F32* toParam, xBase* toParamWidget)
412{

Callers 1

zEntDestructObjEventCBFunction · 0.70

Calls 4

xVec3SubFunction · 0.85
xEntGetPosFunction · 0.85
zRumbleStartFunction · 0.85
xSndPlay3DFunction · 0.70

Tested by

no test coverage detected