| 353 | } |
| 354 | |
| 355 | static void damage_entity(xEnt& ent, const xVec3& loc, const xVec3& dir, |
| 356 | const xVec3& hit_norm, F32 radius, bool explosive) |
| 357 | { |
| 358 | if (shared.hits_size >= 32) |
| 359 | { |
| 360 | return; |
| 361 | } |
| 362 | shared.hits[shared.hits_size] = &ent; |
| 363 | shared.hits_size++; |
| 364 | |
| 365 | switch (ent.baseType) |
| 366 | { |
| 367 | case eBaseTypeButton: |
| 368 | zEntButton_Press((_zEntButton*)&ent, 0x10); |
| 369 | return; |
| 370 | |
| 371 | case eBaseTypeDestructObj: |
| 372 | zEntDestructObj_Hit((zEntDestructObj*)&ent, 0x10000); |
| 373 | return; |
| 374 | |
| 375 | case eBaseTypePlatform: |
| 376 | switch (ent.subType) |
| 377 | { |
| 378 | case ZPLATFORM_SUBTYPE_PADDLE: |
| 379 | if (!(((zPlatform*)&ent)->passet->paddle.paddleFlags & 0x20)) |
| 380 | { |
| 381 | return; |
| 382 | } |
| 383 | |
| 384 | xCollis coll; |
| 385 | coll.optr = &ent; |
| 386 | coll.mptr = ent.collModel != NULL ? ent.collModel : ent.model; |
| 387 | |
| 388 | if (explosive) |
| 389 | { |
| 390 | coll.flags = 0x600; |
| 391 | |
| 392 | xSphere o; |
| 393 | o.center = loc; |
| 394 | o.r = radius; |
| 395 | xSphereHitsBound(&o, &ent.bound, &coll); |
| 396 | |
| 397 | if (!(coll.flags & 0x1)) |
| 398 | { |
| 399 | return; |
| 400 | } |
| 401 | |
| 402 | if (ent.collLev == 0x5) |
| 403 | { |
| 404 | xSphereHitsModel(&o, coll.mptr, &coll); |
| 405 | |
| 406 | if (!(coll.flags & 0x1)) |
| 407 | { |
| 408 | return; |
| 409 | } |
| 410 | } |
| 411 | |
| 412 | xVec3 hit_dir = coll.tohit.up_normal(); |
no test coverage detected