| 4485 | } |
| 4486 | |
| 4487 | S32 zEntPlayer_DamageNPCKnockBack(xBase* src, U32 damage, xVec3* npcPos) |
| 4488 | { |
| 4489 | S32 tmpRtn; |
| 4490 | F32 dx; |
| 4491 | F32 dz; |
| 4492 | F32 mag; |
| 4493 | F32 tmpVel; |
| 4494 | |
| 4495 | if (zEntPlayer_Damage(src, damage) == 0) |
| 4496 | { |
| 4497 | tmpRtn = 0; |
| 4498 | } |
| 4499 | else |
| 4500 | { |
| 4501 | dx = globals.player.ent.model->Mat->pos.x - npcPos->x; |
| 4502 | dz = globals.player.ent.model->Mat->pos.z - npcPos->z; |
| 4503 | mag = xsqrt(dx * dx + dz * dz); |
| 4504 | |
| 4505 | if (mag < 0.01f) |
| 4506 | { |
| 4507 | mag = 1.5f; |
| 4508 | dx = -globals.player.ent.model->Mat->at.x; |
| 4509 | dz = -globals.player.ent.model->Mat->at.z; |
| 4510 | } |
| 4511 | |
| 4512 | tmpVel = sPlayerNPC_KnockBackVel / mag; |
| 4513 | tmpRtn = 1; |
| 4514 | |
| 4515 | globals.player.ent.frame->vel.x = tmpVel * dx; |
| 4516 | globals.player.ent.frame->vel.y = 0.0f; |
| 4517 | globals.player.ent.frame->vel.z = tmpVel * dz; |
| 4518 | |
| 4519 | globals.player.KnockBackTimer = sPlayerNPC_KnockBackTime; |
| 4520 | globals.player.KnockIntoAirTimer = 0.0f; |
| 4521 | } |
| 4522 | |
| 4523 | return tmpRtn; |
| 4524 | } |
| 4525 | |
| 4526 | void zEntPlayer_DamageKnockIntoAir(F32 height) |
| 4527 | { |
no test coverage detected