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

Function DoWallJumpCheck

src/SB/Game/zEntPlayer.cpp:2148–2207  ·  view source on GitHub ↗

Equivalent: static initializer scheduling (probably sda relocations?)

Source from the content-addressed store, hash-verified

2146
2147// Equivalent: static initializer scheduling (probably sda relocations?)
2148static void DoWallJumpCheck()
2149{
2150 sWallJumpResult = WallJumpResult_NoJump;
2151 xEnt* ent = &globals.player.ent;
2152
2153 static F32 sAtdist = 0.65f;
2154 static F32 sSweptrad = 0.4f;
2155 static F32 sVerticalCos = 0.2588f;
2156
2157 xVec3 start;
2158 start.x = ent->model->Mat->pos.x;
2159 start.y = ent->model->Mat->pos.y + ent->bound.cyl.r;
2160 start.z = ent->model->Mat->pos.z;
2161
2162 // hack: compiler isn't calling operator=
2163 xVec3 end;
2164 end.operator=(start);
2165 end.x += ent->model->Mat->at.x * sAtdist;
2166 end.z += ent->model->Mat->at.z * sAtdist;
2167
2168 xSweptSphere sws;
2169 xSweptSpherePrepare(&sws, &start, &end, sSweptrad);
2170
2171 if (xSweptSphereToScene(&sws, globals.sceneCur, ent, 0x16))
2172 {
2173 xSweptSphereGetResults(&sws);
2174
2175 xSurface* surf;
2176 if (sws.optr && sws.mptr)
2177 {
2178 surf = sws.mptr->Surf;
2179 }
2180 else
2181 {
2182 surf = zSurfaceGetSurface(sws.oid);
2183 }
2184
2185 if (!surf)
2186 {
2187 return;
2188 }
2189
2190 zSurfaceProps* surfaceProperties = (zSurfaceProps*)surf->moprops;
2191
2192 if (!(surfaceProperties->asset->phys_flags & 0x20))
2193 {
2194 return;
2195 }
2196
2197 if (xabs(sws.worldNormal.y) < sVerticalCos)
2198 {
2199 if (xVec3Dot(&sws.worldNormal, &sws.worldPolynorm) > 0.999f)
2200 {
2201 sWallNormal = sws.worldNormal;
2202 sWallJumpResult = WallJumpResult_Jump;
2203 sWallCollisionSurface = surfaceProperties;
2204 }
2205 }

Callers

nothing calls this directly

Calls 5

xSweptSphereGetResultsFunction · 0.85
zSurfaceGetSurfaceFunction · 0.70
xSweptSpherePrepareFunction · 0.50
xSweptSphereToSceneFunction · 0.50
operator=Method · 0.45

Tested by

no test coverage detected