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

Function xEntERMove

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

Source from the content-addressed store, hash-verified

282}
283
284static void xEntERMove(xEntMotion* motion, xScene* sc, F32 dt, xEntFrame* frame)
285{
286 F32 newt = motion->t - motion->er.p;
287
288 if (newt > 0.0f)
289 {
290 motion->t = newt;
291 }
292
293 if (xEntERIsExtending(motion))
294 {
295 F32 rem = motion->er.et - motion->t;
296 F32 scale = MIN(rem, dt) / motion->er.et;
297
298 if (rem < dt)
299 {
300 xVec3Sub(&frame->dpos, &motion->er.b, &frame->mat.pos);
301 }
302 else
303 {
304 xVec3Sub(&frame->dpos, &motion->er.b, &motion->er.a);
305 xVec3SMulBy(&frame->dpos, scale);
306 }
307
308 frame->mode = 2;
309 motion->er.state = 0;
310 }
311 else if (xEntERIsExtended(motion))
312 {
313 motion->er.state = 1;
314 }
315 else if (xEntERIsRetracting(motion))
316 {
317 F32 rem = motion->er.ert - motion->t;
318 F32 scale = MIN(rem, dt) / motion->er.rt;
319
320 if (rem < dt)
321 {
322 xVec3Sub(&frame->dpos, &motion->er.a, &frame->mat.pos);
323 }
324 else
325 {
326 xVec3Sub(&frame->dpos, &motion->er.a, &motion->er.b);
327 xVec3SMulBy(&frame->dpos, scale);
328 }
329
330 frame->mode = 2;
331 motion->er.state = 2;
332 }
333 else if (xEntERIsRetracted(motion))
334 {
335 motion->er.state = 3;
336 }
337}
338
339static void xEntOrbitMove(xEntMotion* motion, xScene* sc, F32 dt, xEntFrame* frame)
340{

Callers 1

xEntMotionMoveFunction · 0.70

Calls 6

xEntERIsExtendingFunction · 0.85
xVec3SubFunction · 0.85
xVec3SMulByFunction · 0.85
xEntERIsExtendedFunction · 0.85
xEntERIsRetractingFunction · 0.85
xEntERIsRetractedFunction · 0.85

Tested by

no test coverage detected