| 443 | } |
| 444 | |
| 445 | void LocalInterpComp_SetLocation(struct InterpComp* interp, struct LocationUpdate* update, struct Entity* e) { |
| 446 | struct EntityLocation* prev = &e->prev; |
| 447 | struct EntityLocation* next = &e->next; |
| 448 | cc_uint8 flags = update->flags; |
| 449 | cc_bool interpolate = flags & LU_ORI_INTERPOLATE; |
| 450 | |
| 451 | if (flags & LU_HAS_POS) { |
| 452 | LocalInterpComp_SetPosition(e, update, flags & LU_POS_MODEMASK); |
| 453 | } |
| 454 | if (flags & LU_HAS_PITCH) { |
| 455 | LocalInterpComp_Angle(&prev->pitch, &next->pitch, update->pitch, interpolate); |
| 456 | } |
| 457 | if (flags & LU_HAS_ROTX) { |
| 458 | LocalInterpComp_Angle(&prev->rotX, &next->rotX, update->rotX, interpolate); |
| 459 | } |
| 460 | if (flags & LU_HAS_ROTZ) { |
| 461 | LocalInterpComp_Angle(&prev->rotZ, &next->rotZ, update->rotZ, interpolate); |
| 462 | } |
| 463 | if (flags & LU_HAS_YAW) { |
| 464 | LocalInterpComp_Angle(&prev->yaw, &next->yaw, update->yaw, interpolate); |
| 465 | |
| 466 | if (!interpolate) { |
| 467 | next->rotY = next->yaw; |
| 468 | interp->RotYCount = 0; |
| 469 | } else { |
| 470 | /* Body Y rotation lags slightly behind */ |
| 471 | InterpComp_AddRotY(interp, Math_LerpAngle(prev->yaw, next->yaw, 0.33333333f)); |
| 472 | InterpComp_AddRotY(interp, Math_LerpAngle(prev->yaw, next->yaw, 0.66666667f)); |
| 473 | InterpComp_AddRotY(interp, Math_LerpAngle(prev->yaw, next->yaw, 1.00000000f)); |
| 474 | |
| 475 | e->next.rotY = interp->RotYStates[0]; |
| 476 | } |
| 477 | } |
| 478 | Entity_LerpAngles(e, 0.0f); |
| 479 | } |
| 480 | |
| 481 | void LocalInterpComp_AdvanceState(struct InterpComp* interp, struct Entity* e) { |
| 482 | e->prev = e->next; |
no test coverage detected