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

Function zPlatformEventCB

src/SB/Game/zPlatform.cpp:1186–1510  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

1184}
1185
1186S32 zPlatformEventCB(xBase* from, xBase* to, U32 toEvent, const F32* toParam, xBase* toParamWidget)
1187{
1188 zPlatform* plat = (zPlatform*)to;
1189
1190 switch (toEvent) {
1191 case eEventOn:
1192 if (!(plat->plat_flags & 0x1)) {
1193 plat->plat_flags |= 0x1;
1194 }
1195 break;
1196 case eEventOff:
1197 if (plat->plat_flags & 0x1) {
1198 plat->plat_flags &= ~0x1;
1199 }
1200 break;
1201 case eEventToggle:
1202 if (plat->plat_flags & 0x1) {
1203 plat->plat_flags &= ~0x1;
1204 } else {
1205 plat->plat_flags |= 0x1;
1206 }
1207 break;
1208 case eEventRun:
1209 if (plat->subType == ePlatformTypeBreakaway) {
1210 if (plat->state == 0 || plat->state == 1) {
1211 plat->state = 2;
1212 if (plat->passet->ba.ba_delay) {
1213 zPlatform_Tremble(plat, 0.06f, 8*PI, 1.0f + plat->passet->ba.ba_delay);
1214 }
1215 }
1216 } else if (plat->subType == ePlatformTypeFM) {
1217 plat->plat_flags &= (U16)~0x4;
1218 } else if (plat->subType == ePlatformTypePaddle) {
1219 S32 iParam0 = (S32)toParam[0];
1220 if (iParam0) {
1221 if (plat->state == 0 &&
1222 ((plat->passet->paddle.paddleFlags & 0x4) ||
1223 !((iParam0 < 0) ? (plat->ctr == 0) : (plat->ctr + 1 == plat->passet->paddle.countOrient)))) {
1224 zPlatform_PaddleStartRotate(plat, iParam0, (S32)toParam[1]);
1225 }
1226 } else {
1227 S32 destctr = (S32)toParam[1];
1228 if (destctr >= 0 && destctr < plat->passet->paddle.countOrient) {
1229 plat->tmr = 1e-9f;
1230 plat->state = 2;
1231 plat->ctr = destctr;
1232 }
1233 }
1234 } else {
1235 if (plat->subType == ePlatformTypeMech &&
1236 globals.sceneCur->sceneID == 'PG12' &&
1237 (plat->asset->modelInfoID == xStrHash("skatepark_bumper") ||
1238 plat->asset->modelInfoID == xStrHash("skatepark_flipper"))) {
1239 if (plat->asset->modelInfoID != xStrHash("skatepark_flipper")) {
1240 xScrFXGlareAdd((xVec3*)&plat->model->Mat->pos,
1241 0.5f * xurand() + 0.5f,
1242 0.5f * xurand() + 0.5f,
1243 4.0f * xurand() + 3.0f,

Callers

nothing calls this directly

Calls 15

xurandFunction · 0.85
xEntMotionRunFunction · 0.85
xEntMotionStopFunction · 0.85
xEntShowFunction · 0.85
zFXPopOnFunction · 0.85
xEntHideFunction · 0.85
zFXPopOffFunction · 0.85
zCollGeom_CamEnableFunction · 0.85
zCollGeom_CamDisableFunction · 0.85
xEntMPSetSpeedFunction · 0.85
xEntMPAccelerateFunction · 0.85
zFXGooEventSetWarbFunction · 0.85

Tested by

no test coverage detected