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

Function xEntPenMove

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

Source from the content-addressed store, hash-verified

535}
536
537static void xEntPenMove(xEntMotion* motion, xScene* sc, F32 dt, xEntFrame* frame)
538{
539 xEntPenData* pen = &motion->pen;
540 xEntMotionPenData* aspen = &motion->asset->pen;
541 F32 th = (dt * 0.5f) * pen->w;
542 F32 rem = motion->t + (dt * 0.5f);
543 F32 dangle = (aspen->range * 2.0f) * isin(th) * icos((rem * pen->w) + aspen->phase);
544 F32 newt = motion->t - aspen->period;
545
546 if (newt > 0.0f)
547 {
548 motion->t = motion->t - aspen->period;
549 }
550
551 if ((-newt < dt) && (-newt > 0.0f))
552 {
553 xMat4x3Copy(&frame->mat, &motion->pen.omat);
554 frame->mode = 0x11;
555 }
556 else
557 {
558 xMat4x3 delta_mat;
559 xMat4x3Rot(&delta_mat, &frame->mat.at, dangle, &pen->top);
560 xMat4x3Mul(&frame->mat, &frame->mat, &delta_mat);
561 frame->mode = 0x41;
562 }
563}
564
565static void xEntMechMove(xEntMotion* motion, xScene* sc, F32 dt, xEntFrame* frame)
566{

Callers 1

xEntMotionMoveFunction · 0.70

Calls 5

isinFunction · 0.85
icosFunction · 0.85
xMat4x3CopyFunction · 0.85
xMat4x3MulFunction · 0.85
xMat4x3RotFunction · 0.70

Tested by

no test coverage detected