| 123 | } |
| 124 | |
| 125 | void xEntMotionReset(xEntMotion* motion, xScene* sc) |
| 126 | { |
| 127 | xEntMotionPenData* aspen; |
| 128 | xMat3x3 pshrot; |
| 129 | xEnt* ownr; |
| 130 | xVec3* modlpos; |
| 131 | xMat4x3* modlrot; |
| 132 | xEntMotionMechData* mkasst; |
| 133 | xEntMechData* mech; |
| 134 | F32 drot; |
| 135 | |
| 136 | motion->flags = motion->asset->flags; |
| 137 | motion->t = 0.0f; |
| 138 | |
| 139 | if (motion->type == XENTMOTION_TYPE_ER) |
| 140 | { |
| 141 | motion->er.state = 0; |
| 142 | } |
| 143 | else if (motion->type == XENTMOTION_TYPE_MP) |
| 144 | { |
| 145 | motion->mp.src = (xMovePoint*)xSceneResolvID(sc, motion->asset->mp.mp_id); |
| 146 | xEntMPSetSpeed(motion, motion->asset->mp.speed); |
| 147 | xEntMPGetNext(motion, NULL, sc); |
| 148 | xVec3Copy((xVec3*)&motion->owner->model->Mat->pos, xMovePointGetPos(motion->mp.src)); |
| 149 | } |
| 150 | else if (motion->type == XENTMOTION_TYPE_ORB) |
| 151 | { |
| 152 | xVec3Copy(&motion->orb.orig, (xVec3*)&motion->owner->model->Mat->pos); |
| 153 | } |
| 154 | else if (motion->type == XENTMOTION_TYPE_PEN) |
| 155 | { |
| 156 | xVec3 a, b, c; |
| 157 | |
| 158 | modlpos = (xVec3*)&motion->owner->model->Mat->pos; |
| 159 | modlrot = (xMat4x3*)motion->owner->model->Mat; |
| 160 | aspen = &motion->asset->pen; |
| 161 | |
| 162 | xMat3x3Rot(&pshrot, &modlrot->at, aspen->range * isin(aspen->phase)); |
| 163 | |
| 164 | a.x = 0.0f; |
| 165 | a.y = aspen->len; |
| 166 | a.z = 0.0f; |
| 167 | |
| 168 | xMat3x3RMulVec(&b, &pshrot, &a); |
| 169 | xVec3Sub(&c, &a, &b); |
| 170 | xMat3x3Mul(modlrot, modlrot, &pshrot); |
| 171 | xVec3AddTo(modlpos, &c); |
| 172 | xVec3Add(&motion->pen.top, modlpos, &b); |
| 173 | xMat4x3Copy(&motion->pen.omat, modlrot); |
| 174 | } |
| 175 | else if (motion->type == XENTMOTION_TYPE_MP) |
| 176 | { |
| 177 | if (motion->asset->flags & 1) |
| 178 | { |
| 179 | xQuatFromMat(&motion->mp.aquat, (xMat3x3*)motion->owner->model->Mat); |
| 180 | xQuatCopy(&motion->mp.bquat, &motion->mp.aquat); |
| 181 | } |
| 182 | motion->tmr = 0.0f; |
no test coverage detected