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

Function SpatulaGrabCB

src/SB/Game/zEntPlayer.cpp:1988–2060  ·  view source on GitHub ↗

Equivalent: scheduling

Source from the content-addressed store, hash-verified

1986
1987// Equivalent: scheduling
1988static U32 SpatulaGrabCB(xAnimTransition*, xAnimSingle*, void* data)
1989{
1990 sSpatulaGrabbed = 0;
1991 tslide_inair_tmr = 0.0f;
1992 tslide_dbl_tmr = 0.0f;
1993 globals.player.SlideTrackDecay = 0.0f;
1994 tslide_ground = 0;
1995
1996 xEnt* ent = (xEnt*)data;
1997 ent->frame->vel.x = 0.0f;
1998 if (ent->frame->vel.y > 0.0f)
1999 {
2000 ent->frame->vel.y = 0.0f;
2001 }
2002 ent->frame->vel.z = 0.0f;
2003
2004 globals.player.KnockBackTimer = 0.0f;
2005 globals.player.KnockIntoAirTimer = 0.0f;
2006
2007 if (globals.autoSaveFeature)
2008 {
2009 if (zEntPlayer_InBossBattle())
2010 {
2011 gWaitingToAutoSave = 1;
2012 }
2013 else
2014 {
2015 zSaveLoadPreAutoSave(true);
2016 }
2017 }
2018
2019 xCollis rcoll;
2020 xVec3 cam;
2021 xVec3 center;
2022 xRay3 r;
2023 rcoll.flags = 0;
2024
2025 xVec3Copy(&center, &globals.player.ent.bound.cyl.center);
2026
2027 xVec3Copy(&cam, &globals.camera.mat.pos);
2028
2029 xVec3Copy(&r.origin, &center);
2030 xVec3Sub(&r.dir, &cam, &center);
2031 r.max_t = xVec3Length(&r.dir);
2032 F32 one_len = 1.0f / MAX(r.max_t, 0.00001f);
2033 xVec3SMul(&r.dir, &r.dir, one_len);
2034 r.flags = 0x800;
2035
2036 xRayHitsScene(globals.sceneCur, &r, &rcoll);
2037 if ((rcoll.flags & 1) == 0)
2038 {
2039 zCameraSetReward(1);
2040 }
2041
2042 zCameraDisableInput();
2043 F32 delay = 0.0f;
2044 if (gCurrentPlayer == eCurrentPlayerSpongeBob)
2045 {

Callers 1

SpatulaMeleeStopCBFunction · 0.70

Calls 10

zEntPlayer_InBossBattleFunction · 0.85
zSaveLoadPreAutoSaveFunction · 0.85
xVec3CopyFunction · 0.85
xVec3SubFunction · 0.85
xVec3LengthFunction · 0.85
xVec3SMulFunction · 0.85
zCameraSetRewardFunction · 0.85
zCameraDisableInputFunction · 0.85
zEntPlayer_SNDPlayFunction · 0.85
xRayHitsSceneFunction · 0.50

Tested by

no test coverage detected