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

Method Timestep

src/SB/Game/zNPCGlyph.cpp:550–613  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

548}
549
550void NPCGlyph::Timestep(F32 dt)
551{
552 xVec3 vec = {};
553
554 switch (typ_glyph)
555 {
556 case NPC_GLYPH_SHINYONE:
557 case NPC_GLYPH_SHINYFIVE:
558 case NPC_GLYPH_SHINYTEN:
559 case NPC_GLYPH_SHINYFIFTY:
560 case NPC_GLYPH_SHINYHUNDRED:
561 {
562 VelSet_Shiny();
563 RotAddDelta(NULL);
564
565 // Do we use sph here?
566 F32 x_delta = globals.player.ent.bound.sph.center.x - pos_glyph.x;
567 F32 y_delta = globals.player.ent.bound.sph.center.y - pos_glyph.y;
568 F32 z_delta = globals.player.ent.bound.sph.center.z - pos_glyph.z;
569 if (SQR(x_delta) + SQR(y_delta) + SQR(z_delta) <= SQR(globals.player.ent.bound.sph.r))
570 {
571 tmr_glyph = -1.0f;
572 }
573
574 break;
575 }
576 case NPC_GLYPH_TALK:
577 case NPC_GLYPH_TALKOTHER:
578 if (mdl_glyph == NULL)
579 {
580 break;
581 }
582
583 xVec3 vec2;
584 if (NPCC_ds2_toCam(&pos_glyph, &vec2) < 0.1f)
585 {
586 break;
587 }
588
589 vec2.y = 0.0f;
590 if (SQ(vec2.x) + SQ(vec2.z) < 0.1f)
591 {
592 break;
593 }
594
595 vec2.normalize();
596 xMat4x3* frame = xModelGetFrame(mdl_glyph);
597 frame->pos = pos_glyph;
598 frame->up = g_Y3;
599 frame->right = vec2;
600 xVec3Cross(&frame->at, &frame->right, &g_Y3);
601 xModelSetFrame(mdl_glyph, frame);
602 break;
603 case NPC_GLYPH_FRIEND:
604 case NPC_GLYPH_DAZED:
605 if (flg_glyph & (1 << 2))
606 {
607 xVec3Copy(&vec, &pos_glyph);

Callers 10

ProcessMethod · 0.45
zNPCGlyph_TimestepFunction · 0.45
ProcessMethod · 0.45
ProcessMethod · 0.45
ProcessMethod · 0.45
ProcessMethod · 0.45
ProcessMethod · 0.45
ProcessMethod · 0.45
ProcessMethod · 0.45
ProcessMethod · 0.45

Calls 7

VelSet_ShinyFunction · 0.85
xModelGetFrameFunction · 0.85
xVec3CrossFunction · 0.85
xModelSetFrameFunction · 0.85
xVec3CopyFunction · 0.85
xVec3AddScaledFunction · 0.85
NPCC_ds2_toCamFunction · 0.70

Tested by

no test coverage detected