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

Function zEntTeleportBoxEventCB

src/SB/Game/zEntTeleportBox.cpp:431–484  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

429 ent->prevPlayerIn = ent->currPlayerIn;
430
431 if (ent->currPlrState == PLAYER_STATE_TELEPORTED)
432 {
433 globals.camera.pgoal = sTeleportCamPitch;
434 globals.camera.pcur = sTeleportCamPitch;
435 }
436
437 if (ent->prevPlrState != ent->currPlrState)
438 {
439 switch (ent->currPlrState)
440 {
441 case PLAYER_STATE_INSIDE:
442 {
443 ent->chkby &= (U8)~XENT_COLLTYPE_PLYR;
444
445 zEntPlayerControlOff(CONTROL_OWNER_TELEPORT_BOX);
446
447 globals.player.ent.frame->vel.x = 0.0f;
448 globals.player.ent.frame->vel.z = 0.0f;
449 globals.player.KnockBackTimer = 0.0f;
450
451 xSndPlay3D(xStrHash("Box_shuffle_alt"), 0.77f, 0.0f, 128, 0,
452 (xVec3*)&ent->model->Mat->pos, 0.0f, SND_CAT_GAME, 0.1f);
453 zRumbleStart(SDR_TeleportStart);
454
455 break;
456 }
457 case PLAYER_STATE_TELEPORTING:
458 {
459 zEntPickup_GiveAllRewardsNow();
460
461 ent->chkby |= XENT_COLLTYPE_PLYR;
462
463 if (target)
464 {
465 xVec3Copy((xVec3*)&globals.player.ent.model->Mat->pos,
466 (xVec3*)&target->model->Mat->pos);
467 xVec3Copy(&globals.player.ent.frame->mat.pos, (xVec3*)&target->model->Mat->pos);
468
469 xMat4x3& mat = (xMat4x3&)*globals.player.ent.model->Mat;
470 xVec3 ypr;
471
472 xMat3x3GetEuler(&mat, &ypr);
473
474 ypr.x = PI * target->tasset->launchAngle / 180.0f;
475
476 xMat3x3Euler(&mat, &ypr);
477
478 target->currPlrState = PLAYER_STATE_TELEPORTED;
479
480 if (zEntTeleportBox_isClosed(target))
481 {
482 zEntEvent(target, eEventOpenTBox);
483 }
484
485 iCameraMotionBlurActivate(1);
486 }
487

Callers

nothing calls this directly

Calls 4

xEntShowFunction · 0.85
xEntHideFunction · 0.85
zEntTeleportBox_OpenFunction · 0.85
zEntTeleportBox_CloseFunction · 0.85

Tested by

no test coverage detected