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

Function zEntButtonEventCB

src/SB/Game/zEntButton.cpp:395–493  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

393}
394
395static S32 zEntButtonEventCB(xBase* from, xBase* to, U32 toEvent, const F32* toParam, xBase* b3)
396{
397 _zEntButton* button = (_zEntButton*)to;
398
399 switch (toEvent)
400 {
401 case eEventVisible:
402 case eEventFastVisible:
403 case eEventCollision_Visible_On:
404 button->chkby |= XENT_COLLTYPE_PLYR;
405 xEntShow((xEnt*)button);
406 button->bupdate((xEnt*)button, (xVec3*)&button->model->Mat->pos);
407 if (toParam != NULL && (S32)(*toParam + 0.5f) == 77)
408 {
409 zFXPopOn((xEnt&)*button, toParam[1], toParam[2]);
410 }
411 break;
412 case eEventInvisible:
413 case eEventFastInvisible:
414 case eEventCollision_Visible_Off:
415 button->chkby &= (U8)~XENT_COLLTYPE_PLYR;
416 xEntHide((xEnt*)button);
417 if (toParam != NULL && (S32)(*toParam + 0.5f) == 77)
418 {
419 zFXPopOff((xEnt&)*button, toParam[1], toParam[2]);
420 }
421 break;
422 case eEventCameraCollideOn:
423 zCollGeom_CamEnable((xEnt*)button);
424 break;
425 case eEventCameraCollideOff:
426 zCollGeom_CamDisable((xEnt*)button);
427 break;
428 case eEventReset:
429 zEntButton_Reset(button, globals.sceneCur);
430 break;
431 case eEventPress:
432 zEntButton_Press(button);
433 break;
434 case eEventUnpress:
435 if (button->state == 0)
436 {
437 break;
438 }
439
440 xSndPlay3D(xStrHash("Button_up"), 0.77f, 0.0f, 128, 0, (xVec3*)&button->model->Mat->pos,
441 10.0f, 30.0f, SND_CAT_GAME, 0.0f);
442 zEntButton_SetReady(button);
443 break;
444 case eEventToggle:
445 if (button->state != 0)
446 {
447 zEntEvent((xBase*)button, (xBase*)button, eEventUnpress);
448 }
449 else
450 {
451 zEntEvent((xBase*)button, (xBase*)button, eEventPress);
452 }

Callers

nothing calls this directly

Calls 14

xEntShowFunction · 0.85
zFXPopOnFunction · 0.85
xEntHideFunction · 0.85
zFXPopOffFunction · 0.85
zCollGeom_CamEnableFunction · 0.85
zCollGeom_CamDisableFunction · 0.85
zEntButton_ResetFunction · 0.85
zEntButton_PressFunction · 0.85
zEntButton_SetReadyFunction · 0.85
xSndPlay3DFunction · 0.70
zEntAnimEventFunction · 0.70
xStrHashFunction · 0.50

Tested by

no test coverage detected