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

Function DblJumpCB

src/SB/Game/zEntPlayer.cpp:2362–2416  ·  view source on GitHub ↗

Equivalent: regswaps and a sda relocation scheduling meme, may be cause some/all the swaps

Source from the content-addressed store, hash-verified

2360
2361// Equivalent: regswaps and a sda relocation scheduling meme, may be cause some/all the swaps
2362static U32 DblJumpCB(xAnimTransition*, xAnimSingle*, void*)
2363{
2364 if (globals.player.cheat_mode)
2365 {
2366 return 0;
2367 }
2368
2369 zEntPlayerJumpStart(&globals.player.ent, &globals.player.s->Double);
2370 globals.player.Jump_CanDouble = 0;
2371 startDouble = globals.player.ent.frame->mat.pos.y;
2372 globals.player.IsDJumping = 1;
2373 globals.player.Bounced = 0;
2374 sLasso->flags = NULL;
2375
2376 if (tslide_inair_tmr)
2377 {
2378 // load order swap
2379 F32 dirx = update_motion.x;
2380 F32 dirz = update_motion.z;
2381 F32 dbldirx = SQR(dirx);
2382 F32 dbldirz = SQR(dirz);
2383
2384 F32 speed;
2385 F32 dblspeed;
2386 F32 len2 = dbldirx + dbldirz;
2387 if (xabs(len2 - 1.0f) <= 0.00001f)
2388 {
2389 dirx = update_motion.x;
2390 speed = 1.0f;
2391 }
2392 else if (xabs(len2) <= 0.00001f)
2393 {
2394 dirx = 0.0f;
2395 dirz = 0.0f;
2396 speed = 0.0f;
2397 }
2398 else
2399 {
2400 speed = xsqrt(dbldirx + dbldirz);
2401 dirx = update_motion.x * (1.0f / speed);
2402 dirz = update_motion.z * (1.0f / speed);
2403 }
2404
2405 F32 len_inv = speed / update_dt;
2406 if (globals.player.g.SlideVelDblBoost *
2407 (dirx * globals.player.SlideTrackDir.x + dirz * globals.player.SlideTrackDir.z) >
2408 len_inv)
2409 {
2410 globals.player.ent.frame->vel.x += dirx * len_inv;
2411 globals.player.ent.frame->vel.z += dirz * len_inv;
2412 tslide_dbl_tmr = update_dt;
2413 }
2414 }
2415 return 0;
2416}
2417
2418// equivalent: sda relocation optimization
2419static U32 TongueDblJumpCB(xAnimTransition* tran, xAnimSingle* anim, void* data)

Callers 1

TongueDblJumpCBFunction · 0.70

Calls 2

zEntPlayerJumpStartFunction · 0.85
xsqrtFunction · 0.85

Tested by

no test coverage detected