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

Method Damage

src/SB/Game/zNPCTypeCommon.cpp:497–610  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

495}
496
497void zNPCCommon::Damage(en_NPC_DAMAGE_TYPE damtype, xBase* who, const xVec3* vec_hit)
498{
499 static NPCMsg msg;
500 NPCDamageInfo* dmg = &msg.dmgdata;
501
502 if (!(this->flg_vuln & 0x1))
503 return;
504 if (who && who->baseType == eBaseTypePlayer && !(this->flg_vuln & 0xFFFF0000))
505 return;
506
507 switch (damtype)
508 {
509 case DMGTYP_ABOVE:
510 if (!(this->flg_vuln & 0x40000))
511 return;
512 break;
513 case DMGTYP_BELOW:
514 if (!(this->flg_vuln & 0x20000))
515 return;
516 break;
517 case DMGTYP_SIDE:
518 if (gCurrentPlayer == eCurrentPlayerSpongeBob)
519 {
520 if (!(this->flg_vuln & 0x10000))
521 return;
522 }
523 else if (gCurrentPlayer == eCurrentPlayerPatrick)
524 {
525 if (!(this->flg_vuln & 0x80000000))
526 return;
527 }
528 else if (gCurrentPlayer == eCurrentPlayerSandy)
529 {
530 if (!(this->flg_vuln & 0x2000000))
531 return;
532 }
533 else
534 {
535 if (!(this->flg_vuln & 0x10000))
536 return;
537 }
538 break;
539 case DMGTYP_INSTAKILL:
540 this->tmr_invuln = -1.0f;
541 break;
542 case DMGTYP_HITBYTOSS:
543 if (!(this->flg_vuln & 0x4))
544 return;
545 break;
546 case DMGTYP_NPCATTACK:
547 if (!(this->flg_vuln & 0x8))
548 return;
549 break;
550 case DMGTYP_ROPE:
551 if (!(this->flg_vuln & 0x1000000))
552 return;
553 break;
554 case DMGTYP_CRUISEBUBBLE:

Callers 2

SysEventMethod · 0.95
ConvertHitEventMethod · 0.95

Calls 3

memsetFunction · 0.85
xVec3CopyFunction · 0.85
zNPCMsg_SendMsgFunction · 0.70

Tested by

no test coverage detected