| 323 | } |
| 324 | |
| 325 | static void NetInterpComp_SetPosition(struct NetInterpComp* interp, struct LocationUpdate* update, struct Entity* e, int mode) { |
| 326 | Vec3 lastPos = interp->CurPos; |
| 327 | Vec3* curPos = &interp->CurPos; |
| 328 | Vec3 midPos; |
| 329 | |
| 330 | if (mode == LU_POS_ABSOLUTE_INSTANT || mode == LU_POS_ABSOLUTE_SMOOTH) { |
| 331 | *curPos = update->pos; |
| 332 | } else { |
| 333 | Vec3_AddBy(curPos, &update->pos); |
| 334 | } |
| 335 | |
| 336 | if (mode == LU_POS_ABSOLUTE_INSTANT) { |
| 337 | e->prev.pos = *curPos; |
| 338 | e->next.pos = *curPos; |
| 339 | interp->PositionsCount = 0; |
| 340 | } else { |
| 341 | /* Smoother interpolation by also adding midpoint */ |
| 342 | Vec3_Lerp(&midPos, &lastPos, curPos, 0.5f); |
| 343 | NetInterpComp_AddPosition(interp, midPos); |
| 344 | NetInterpComp_AddPosition(interp, *curPos); |
| 345 | } |
| 346 | } |
| 347 | |
| 348 | static void NetInterpComp_RemoveOldestAngles(struct NetInterpComp* interp) { |
| 349 | int i; |
no test coverage detected