MCPcopy Create free account
hub / github.com/bfbbdecomp/bfbb / xEntMotionReset

Function xEntMotionReset

src/SB/Core/x/xEntMotion.cpp:125–247  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

123}
124
125void 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;

Callers 6

xEntMechMoveFunction · 0.70
xEntMotionDebugIPadFunction · 0.70
zPendulum_ResetFunction · 0.50
zEntButton_ResetFunction · 0.50
zPlatform_ResetFunction · 0.50
zPlatformEventCBFunction · 0.50

Calls 15

xSceneResolvIDFunction · 0.85
xEntMPSetSpeedFunction · 0.85
xVec3CopyFunction · 0.85
xMovePointGetPosFunction · 0.85
xMat3x3RotFunction · 0.85
isinFunction · 0.85
xVec3SubFunction · 0.85
xVec3AddToFunction · 0.85
xVec3AddFunction · 0.85
xMat4x3CopyFunction · 0.85
xQuatCopyFunction · 0.85
xVec3SMulFunction · 0.85

Tested by

no test coverage detected