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

Function Pat_FaceTarget

src/SB/Game/zNPCTypeBossPatrick.cpp:2208–2259  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

2206 colls->dist = t[j];
2207 colls->optr = this->conveyorBelt[i];
2208 }
2209 }
2210 }
2211 }
2212}
2213
2214// not in PS2 dwarf
2215void zNPCBPatrick::bossPatBoxCheckCollide(bossPatBox* box)
2216{
2217 if (box->flags & 1 && box->pos < 8.5f)
2218 {
2219 F32 z = this->model->Mat->pos.z - box->box->model->Mat->pos.z;
2220 F32 x = this->model->Mat->pos.x - box->box->model->Mat->pos.x;
2221
2222 if (x * x + z * z < 4.0f)
2223 {
2224 zShrapnelAsset* shrap = this->boxBreak;
2225
2226 if (shrap && shrap->initCB)
2227 {
2228 shrap->initCB(shrap, box->box->model, NULL, NULL);
2229 }
2230
2231 box->velocity = 0.0f;
2232 box->flags = 0;
2233 box->pos = 20.0f + box->minY;
2234 }
2235 }
2236}
2237
2238// very close, but there are some if statements not quite right
2239void zNPCBPatrick::bossPatBoxUpdate(bossPatBox* bx, F32 dt)
2240{
2241 if (bx->flags & 1)
2242 {
2243 bx->velocity = -(10.0f * dt - bx->velocity);
2244 bx->pos = bx->velocity * dt + bx->pos;
2245
2246 if (bx->pos < this->gooHeight)
2247 {
2248 bx->pos = this->gooHeight;
2249 bx->velocity = 0.0f;
2250
2251 if (!(bx->flags & 2))
2252 {
2253 bx->flags |= 2;
2254
2255 if (this->boxSplash && this->boxSplash->initCB)
2256 {
2257 this->boxSplash->initCB(this->boxSplash, bx->box->model, NULL, NULL);
2258 }
2259
2260 if (this->boxSplashSndTimer > 0.5f)
2261 {
2262 xSndPlay3D(xStrHash("b201_box_splash"), 0.50049996f, 0.0f, 0, 0,

Callers 1

ProcessMethod · 0.70

Calls 6

xVec3SubFunction · 0.85
xatan2Function · 0.85
isinFunction · 0.85
icosFunction · 0.85
xVec3CrossFunction · 0.85
xVec3NormalizeFunction · 0.50

Tested by

no test coverage detected