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

Function zPlatform_Update

src/SB/Game/zPlatform.cpp:793–1016  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

791}
792
793void zPlatform_Update(xEnt* entplat, xScene* sc, F32 dt)
794{
795 zPlatform* plat = (zPlatform*)entplat;
796
797 if (plat->subType != ePlatformTypeBreakaway) {
798 plat->pauseMult = CLAMP(plat->pauseMult + plat->pauseDelta, 0.000001f, 1.0f);
799 dt *= plat->pauseMult;
800 }
801
802 if (plat->subType == ePlatformTypeBreakaway) {
803 plat->model->Alpha += 4.0f * dt;
804 if (plat->model->Alpha > 1.0f) {
805 plat->model->Alpha = 1.0f;
806 }
807 }
808
809 xEntUpdate(plat, sc, dt);
810
811 if (plat->subType == ePlatformTypeER) {
812 U16 state = plat->motion.er.state;
813 if (plat->state == state ||
814 xEntERIsExtending(&plat->motion) ||
815 xEntERIsExtended(&plat->motion) ||
816 xEntERIsRetracting(&plat->motion) ||
817 xEntERIsRetracted(&plat->motion)) {
818 // do nothing
819 }
820 plat->state = state;
821 } else if (plat->subType == ePlatformTypeBreakaway) {
822 if (plat->state == 1 && !zEntPlayer_IsSneaking()) {
823 plat->state = 2;
824 if (plat->passet->ba.ba_delay) {
825 zPlatform_Tremble(plat, 0.06f, 8*PI, 1.0f + plat->passet->ba.ba_delay);
826 }
827 }
828 if (plat->state == 2) {
829 plat->tmr -= dt;
830 if (plat->tmr <= 0.0f) {
831 zPlatform_BreakawayFallFX(plat, dt);
832 plat->state = 3;
833 plat->pflags |= 0x6;
834 plat->tmr = plat->passet->ba.reset_delay;
835 if (plat->bm) {
836 plat->model = plat->bm;
837 plat->collModel = plat->model;
838 xMat4x3Copy((xMat4x3*)plat->bm->Mat, (xMat4x3*)plat->am->Mat);
839 plat->bound.mat = (xMat4x3*)plat->model->Mat;
840 }
841 zEntEvent(plat, eEventBreak);
842 }
843 } else if (plat->state == 3) {
844 plat->tmr -= dt;
845 if (plat->collis->colls[0].flags & k_HIT_IT) {
846 plat->state = 4;
847 plat->pflags &= (U8)~(XENT_PFLAGS_HAS_VELOCITY | XENT_PFLAGS_HAS_GRAVITY);
848 plat->collis->chk = 0;
849 xVec3Copy(&plat->frame->vel, &g_O3);
850 } else if (plat->tmr <= 0.0f) {

Callers

nothing calls this directly

Calls 15

xEntUpdateFunction · 0.85
xEntERIsExtendingFunction · 0.85
xEntERIsExtendedFunction · 0.85
xEntERIsRetractingFunction · 0.85
xEntERIsRetractedFunction · 0.85
zEntPlayer_IsSneakingFunction · 0.85
xMat4x3CopyFunction · 0.85
xVec3CopyFunction · 0.85
xBaseIsEnabledFunction · 0.85
zMechIsStartingForthFunction · 0.85
zMechIsStartingBackFunction · 0.85

Tested by

no test coverage detected