This function suffers from a couple floating point memes Additionally it has a jumptable that needs to be generated in the correct place.
| 385 | // This function suffers from a couple floating point memes |
| 386 | // Additionally it has a jumptable that needs to be generated in the correct place. |
| 387 | void zEntAnimEvent(zEnt* ent, U32 animEvent, const F32* animParam) |
| 388 | { |
| 389 | xAnimPlay* play = ent->model->Anim; |
| 390 | if (play == NULL) |
| 391 | { |
| 392 | return; |
| 393 | } |
| 394 | |
| 395 | xAnimSingle* single = play->Single; |
| 396 | if (single == NULL) |
| 397 | { |
| 398 | return; |
| 399 | } |
| 400 | |
| 401 | if (ent->miscflags & 1) |
| 402 | { |
| 403 | zEntAnimEvent_AutoAnim(ent, animEvent, animParam); |
| 404 | } |
| 405 | else |
| 406 | { |
| 407 | switch (animEvent) |
| 408 | { |
| 409 | case 0xc3: |
| 410 | case 0xc4: |
| 411 | if (animParam == NULL) |
| 412 | { |
| 413 | break; |
| 414 | } |
| 415 | |
| 416 | S32 anum = (int)*animParam - 1; |
| 417 | if (anum < 0 || anum >= 10 || ent->atbl == NULL) |
| 418 | { |
| 419 | break; |
| 420 | } |
| 421 | |
| 422 | char name[12]; |
| 423 | if (animEvent == 0xc4) |
| 424 | { |
| 425 | sprintf(name, "loop%d", anum); |
| 426 | } |
| 427 | else |
| 428 | { |
| 429 | sprintf(name, "stop%d", anum); |
| 430 | } |
| 431 | |
| 432 | xAnimState* ast = xAnimTableGetState(ent->atbl, name); |
| 433 | if (ast == NULL) |
| 434 | { |
| 435 | break; |
| 436 | } |
| 437 | |
| 438 | xAnimPlaySetState(single, ast, 0.0f); |
| 439 | single->CurrentSpeed = 1.0f; |
| 440 | xAnimPlayUpdate(play, 0.0f); |
| 441 | xAnimPlayEval(play); |
| 442 | |
| 443 | if (ent->asset->modelInfoID != 0x8D398D0C /*is this an address???*/ || |
| 444 | animEvent != 0xc3) |
no test coverage detected