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

Method Damage

src/SB/Game/zNPCTypeBossPatrick.cpp:1335–1394  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

1333}
1334
1335void zNPCBPatrick::Damage(en_NPC_DAMAGE_TYPE dmg_type, xBase* who, const xVec3* vec_hit)
1336{
1337 xVec3 toHit;
1338
1339 if (dmg_type == DMGTYP_SIDE || dmg_type == DMGTYP_CRUISEBUBBLE || dmg_type == DMGTYP_BUBBOWL)
1340 {
1341 if (this->bossFlags & 4)
1342 {
1343 if (vec_hit)
1344 {
1345 xVec3Copy(&toHit, vec_hit);
1346 }
1347 else
1348 {
1349 xVec3Sub(&toHit, (xVec3*)&this->model->Mat->pos,
1350 (xVec3*)&globals.player.ent.model->Mat->pos);
1351 }
1352
1353 toHit.y = f832;
1354
1355 xVec3Normalize(&toHit, &toHit);
1356
1357 if (xVec3Dot(&toHit, (xVec3*)&this->model->Mat->at) > f832)
1358 {
1359 this->bossFlags |= 8;
1360 this->badHitTimer = f1054;
1361 }
1362 }
1363 else if (this->badHitTimer < f832)
1364 {
1365 if (this->nfFlags & 4)
1366 {
1367 if (xrand() & 0x80 && this->round != 2)
1368 {
1369 this->newsfish->SpeakStart(sNFComment[NF_SB_WONT_WIN_THAT_WAY].soundID, 0, -1);
1370 }
1371 else
1372 {
1373 this->newsfish->SpeakStart(sNFComment[NF_ROBOT_TOO_BIG_DIRECT_ATTACK].soundID,
1374 0, -1);
1375 }
1376 }
1377 else
1378 {
1379 if (this->round != 2)
1380 {
1381 this->newsfish->SpeakStart(sNFComment[NF_SB_WONT_WIN_THAT_WAY].soundID, 0, -1);
1382 }
1383 else
1384 {
1385 this->newsfish->SpeakStart(sNFComment[NF_ROBOT_TOO_BIG_DIRECT_ATTACK].soundID,
1386 0, -1);
1387 }
1388
1389 this->nfFlags |= 4;
1390 }
1391 this->badHitTimer = f1054;
1392 }

Callers

nothing calls this directly

Calls 5

xVec3CopyFunction · 0.85
xVec3SubFunction · 0.85
xrandFunction · 0.85
xVec3NormalizeFunction · 0.50
SpeakStartMethod · 0.45

Tested by

no test coverage detected