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

Function BoulderRollCB

src/SB/Game/zEntPlayer.cpp:2472–2543  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

2470static void zEntPlayer_BoulderVehicleRender(xEnt*);
2471
2472static U32 BoulderRollCB(xAnimTransition*, xAnimSingle*, void*)
2473{
2474 xEntHide(&globals.player.ent);
2475 xEntBoulder_Reset(boulderVehicle, globals.sceneCur);
2476 xVec3Copy((xVec3*)&boulderVehicle->model->Mat->pos,
2477 (xVec3*)&globals.player.ent.model->Mat->pos);
2478
2479 boulderVehicle->model->Mat->pos.y += boulderVehicle->bound.sph.r;
2480 xVec3SubFrom((xVec3*)&boulderVehicle->model->Mat->pos,
2481 (xVec3*)&boulderVehicle->model->Data->boundingSphere.center);
2482
2483 globals.player.ent.update = zEntPlayer_BoulderVehicleUpdate;
2484 globals.player.ent.move = zEntPlayer_BoulderVehicleMove;
2485 globals.player.ent.render = zEntPlayer_BoulderVehicleRender;
2486 boulderVehicle->vel.y = 0.0f;
2487 boulderVehicle->vel.x = globals.player.PredictCurrDir.x * globals.player.PredictCurrVel;
2488 boulderVehicle->vel.z = globals.player.PredictCurrDir.z * globals.player.PredictCurrVel;
2489 boulderVehicle->rotVec.x = boulderVehicle->vel.z;
2490 boulderVehicle->rotVec.y = 0.0f;
2491 boulderVehicle->rotVec.z = -boulderVehicle->vel.x;
2492
2493 xVec3Normalize(&boulderVehicle->rotVec, &boulderVehicle->rotVec);
2494 boulderVehicle->angVel = xVec3Length(&boulderVehicle->vel) / boulderVehicle->bound.sph.r;
2495
2496 xVec3Copy((xVec3*)&boulderVehicle->model->Mat->right,
2497 (xVec3*)&globals.player.ent.model->Mat->right);
2498 xVec3Copy((xVec3*)&boulderVehicle->model->Mat->at, (xVec3*)&globals.player.ent.model->Mat->at);
2499 xVec3Copy((xVec3*)&boulderVehicle->model->Mat->up, (xVec3*)&globals.player.ent.model->Mat->up);
2500
2501 xParEmitterCustomSettings info;
2502 if (gPTankDisable)
2503 {
2504 info.custom_flags = 0x35e;
2505 xVec3Copy(&info.pos, (xVec3*)&boulderVehicle->model->Mat->pos);
2506 xVec3Copy(&info.vel, (xVec3*)&boulderVehicle->vel);
2507
2508 if (xVec3Normalize(&info.vel, &info.vel) < 0.00001f)
2509 {
2510 info.vel.x = 0.0f;
2511 info.vel.y = 3.0f;
2512 info.vel.z = 0.0f;
2513 }
2514 else
2515 {
2516 xVec3SMulBy(&info.vel, 3.0f);
2517 }
2518
2519 info.vel_angle_variation = DEG2RAD(270);
2520 info.rate.set(3000.0f, 3000.0f, 1.0f, 0.0f);
2521 info.life.set(0.75f, 0.75f, 1.0f, 0.0f);
2522 info.size_birth.set(0.25f, 0.25f, 1.0f, 0.0f);
2523 info.size_death.set(0.5f, 0.5f, 1.0f, 0.0f);
2524
2525 xParEmitterEmitCustom(sEmitSpinBubbles, update_dt, &info);
2526 xVec3AddScaled(&info.pos, &boulderVehicle->vel, 10.0f * update_dt);
2527 xParEmitterEmitCustom(sEmitSpinBubbles, update_dt, &info);
2528 }
2529 else

Callers

nothing calls this directly

Calls 15

xEntHideFunction · 0.85
xEntBoulder_ResetFunction · 0.85
xVec3CopyFunction · 0.85
xVec3SubFromFunction · 0.85
xVec3LengthFunction · 0.85
xVec3SMulByFunction · 0.85
xVec3AddScaledFunction · 0.85
xEntBeginUpdateFunction · 0.85
zFX_SpawnBubbleHitFunction · 0.70
xVec3NormalizeFunction · 0.50
xParEmitterEmitCustomFunction · 0.50
zEntEventFunction · 0.50

Tested by

no test coverage detected