Equivalent: scheduling.
| 318 | |
| 319 | // Equivalent: scheduling. |
| 320 | void zEntHangable_SetMatrix(zEntHangable* ent, F32 dt) |
| 321 | { |
| 322 | xMat4x3 spinMat; |
| 323 | xMat3x3 tmpMat; |
| 324 | S32 moving; |
| 325 | xVec3* opos; |
| 326 | xVec3* pos; |
| 327 | xVec3* orot; |
| 328 | xVec3 rot; |
| 329 | |
| 330 | xVec3Sub(&spinMat.up, &ent->pivot, &ent->endpos); |
| 331 | xVec3Normalize(&spinMat.up, &spinMat.up); |
| 332 | |
| 333 | opos = &spinMat.at; |
| 334 | opos->x = 0.0f; |
| 335 | opos->y = 0.0f; |
| 336 | opos->z = 1.0f; |
| 337 | |
| 338 | xVec3Cross(&spinMat.right, &spinMat.up, opos); |
| 339 | xVec3Normalize(&spinMat.right, &spinMat.right); |
| 340 | xMat3x3RotC(&tmpMat, spinMat.up.x, spinMat.up.y, spinMat.up.z, ent->spin); |
| 341 | xMat3x3RMulVec(&spinMat.right, &tmpMat, &spinMat.right); |
| 342 | xVec3Cross(opos, &spinMat.right, &spinMat.up); |
| 343 | |
| 344 | spinMat.pos.x = 0.0f; |
| 345 | spinMat.pos.y = -ent->hangInfo->pivotOffset; |
| 346 | spinMat.pos.z = 0.0f; |
| 347 | |
| 348 | xMat3x3RMulVec(&spinMat.pos, &spinMat, &spinMat.pos); |
| 349 | |
| 350 | spinMat.pos.x += ent->pivot.x; |
| 351 | spinMat.pos.y += ent->pivot.y; |
| 352 | spinMat.pos.z += ent->pivot.z; |
| 353 | spinMat.flags = 0; |
| 354 | |
| 355 | *(xMat4x3*)(ent->model->Mat) = *(xMat4x3*)(&spinMat); |
| 356 | |
| 357 | opos = &ent->frame->oldmat.pos; |
| 358 | orot = &ent->frame->oldrot.axis; |
| 359 | pos = (xVec3 *)&ent->model->Mat->pos; |
| 360 | xMat3x3GetEuler((xMat3x3*)ent->model->Mat, &rot); |
| 361 | |
| 362 | if |
| 363 | ( |
| 364 | (opos->x != pos->x) || (opos->y != pos->y) || (opos->z != pos->z) || |
| 365 | (orot->x != rot.x) || (orot->y != rot.y) || (orot->z != rot.z) |
| 366 | ) |
| 367 | { |
| 368 | moving = 1; |
| 369 | if (ent->moving != 1) |
| 370 | { |
| 371 | zEntEvent((xBase *)ent, eEventStartMoving); |
| 372 | } |
| 373 | } |
| 374 | else |
| 375 | { |
| 376 | moving = 0; |
| 377 | if (ent->moving != 0) |
no test coverage detected