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

Function zEntPlayer_SpawnWandBubbles

src/SB/Game/zEntPlayer.cpp:268–314  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

266static void zEntPlayer_PredictionUpdate(xEnt* ent, F32 dt);
267
268void zEntPlayer_SpawnWandBubbles(xVec3* center, U32 count)
269{
270 if (gFrameCount - last_frame > 5)
271 {
272 xVec3 wand;
273 xVec3ScaleC(&wand, (xVec3*)&globals.player.model_wand->Mat->at, 0.25f, 0.25f, 0.25f);
274 xVec3Sub(&last_center, center, &wand);
275 }
276
277 xVec3 dir;
278 xVec3Sub(&dir, center, &last_center);
279
280 U32 num = 3;
281 if (count != 0)
282 {
283 num = count;
284 }
285
286 xVec3* posbuf = (xVec3*)xMemPushTemp(num * 2 * sizeof(xVec3));
287 xVec3* velbuf = posbuf + num;
288 if (posbuf)
289 {
290 xVec3* pp = posbuf;
291 xVec3* vp = velbuf;
292 U32 j = 0;
293 for (; j < num; j++, pp++, vp++)
294 {
295 F32 f = (F32)j / (F32)num;
296 xVec3Lerp(pp, &last_center, center, f);
297 pp->x += 0.125f * (xurand() - 0.5f);
298 pp->y += 0.125f * (xurand() - 0.5f);
299 pp->z += 0.125f * (xurand() - 0.5f);
300
301 f = 5.0f * xurand();
302 xVec3ScaleC(vp, &dir, f, f, f);
303 vp->x += 0.25f * (xurand() - 0.5f);
304 vp->y += 0.25f * (xurand() - 0.5f);
305 vp->z += 0.25f * (xurand() - 0.5f);
306 }
307
308 zParPTankSpawnBubbles(posbuf, velbuf, num, 1.0f);
309 xMemPopTemp(posbuf);
310 }
311
312 last_center = *center;
313 last_frame = gFrameCount;
314}
315
316void zEntPlayerKillCarry()
317{

Callers

nothing calls this directly

Calls 6

xVec3SubFunction · 0.85
xVec3LerpFunction · 0.85
xurandFunction · 0.85
xMemPopTempFunction · 0.85
zParPTankSpawnBubblesFunction · 0.70
xMemPushTempFunction · 0.50

Tested by

no test coverage detected