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

Method Upd_CattleProd

src/SB/Game/zNPCHazard.cpp:438–528  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

436}
437
438void NPCHazard::Upd_CattleProd(F32 dt)
439{
440 HAZCatProd* catprod = &this->custdata.catprod;
441 catprod->rad_cur = LERP(isin(PI * this->pam_interp), catprod->rad_min, catprod->rad_max);
442
443 if (this->flg_hazard & 0x2000 && !(globals.player.DamageTimer > 0.0f) &&
444 this->tym_lifespan - this->tmr_remain > 0.25f)
445 {
446 if (ColPlyrSphere(catprod->rad_cur))
447 {
448 HurtThePlayer();
449 }
450 }
451
452 if (this->flg_hazard & 0x8)
453 {
454 _tagLightningAdd info;
455 NPCC_MakeLightningInfo(NPC_LYT_CATTLEPROD, &info);
456
457 xVec3 pos_lytend = { 0.0f, 0.0f, 0.0f };
458 pos_lytend.x = catprod->rad_cur;
459 pos_lytend.y = catprod->rad_cur;
460 pos_lytend.z = catprod->rad_cur;
461
462 info.time = this->tmr_remain;
463 info.start = &this->pos_hazard;
464
465 pos_lytend.x *= xurand();
466 pos_lytend.y *= xurand();
467 pos_lytend.z *= xurand();
468
469 pos_lytend.x += 0.05f;
470 pos_lytend.y += 0.05f;
471 pos_lytend.z += 0.05f;
472
473 xVec3AddTo(&pos_lytend, &this->pos_hazard);
474 info.end = &pos_lytend;
475 catprod->zap_lyta = zLightningAdd(&info);
476
477 xVec3SubFrom(&pos_lytend, &this->pos_hazard);
478 pos_lytend.y *= -1.0f;
479 xVec3AddTo(&pos_lytend, &this->pos_hazard);
480 info.end = &pos_lytend;
481 catprod->zap_lytb = zLightningAdd(&info);
482 }
483 else
484 {
485 xVec3 pos_lytend = { 0.0f, 0.0f, 0.0f };
486 pos_lytend.x = catprod->rad_cur;
487 pos_lytend.y = catprod->rad_cur;
488 pos_lytend.z = catprod->rad_cur;
489
490 if (this->npc_owner != NULL)
491 {
492 F32 tym = this->npc_owner->AnimTimeCurrent();
493 if (tym > 0.8f && tym < 1.0f)
494 {
495 xVec3SMul(&pos_lytend, NPCC_faceDir(this->npc_owner), catprod->rad_cur);

Callers

nothing calls this directly

Calls 13

LERPFunction · 0.85
isinFunction · 0.85
xurandFunction · 0.85
xVec3AddToFunction · 0.85
xVec3SubFromFunction · 0.85
xVec3SMulFunction · 0.85
NPCC_faceDirFunction · 0.85
xVec3AddScaledFunction · 0.85
NPCC_rightDirFunction · 0.85
xrandFunction · 0.85
AnimTimeCurrentMethod · 0.80

Tested by

no test coverage detected