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

Function collectPickup

src/SB/Game/zEntPickup.cpp:925–1006  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

923}
924
925static void collectPickup(zEntPickup* ent)
926{
927 xEntHide(ent);
928 zEntPickup_GivePickup(ent);
929
930 ent->state = (ent->state & ~0x3f) | 0x8;
931
932 if (isRewardPickup(ent))
933 {
934 ent->baseFlags &= 0x7f;
935 }
936
937 ent->timer = 0.5f;
938 ent->model->Mat->pos.x = ent->asset->pos.x;
939 ent->model->Mat->pos.y = ent->asset->pos.y;
940 ent->model->Mat->pos.z = ent->asset->pos.z;
941
942 if (!isRewardPickup(ent))
943 {
944 if (ent->p->pickupType == PICKUP_TYPE_SHINY)
945 {
946 switch (ent->p->pickupIndex)
947 {
948 case SHINY_PURPLE:
949 {
950 zEntPlayer_SNDPlayStream(ePlayerStreamSnd_ShinyComment5);
951 break;
952 }
953 case SHINY_BLUE:
954 case SHINY_GREEN:
955 case SHINY_YELLOW:
956 case SHINY_RED:
957 {
958 if ((xrand() & 0x3) == 3)
959 {
960 zEntPlayer_SNDPlayStreamRandom(0, 1, ePlayerStreamSnd_ShinyComment1,
961 ePlayerStreamSnd_ShinyComment2, 0.3f);
962 zEntPlayer_SNDPlayStreamRandom(2, 25, ePlayerStreamSnd_ShinyComment1,
963 ePlayerStreamSnd_ShinyComment3, 0.3f);
964 zEntPlayer_SNDPlayStreamRandom(26, 100, ePlayerStreamSnd_ShinyComment1,
965 ePlayerStreamSnd_ShinyComment4, 0.3f);
966 }
967
968 break;
969 }
970 }
971 }
972 else
973 {
974 switch (ent->p->pickupIndex)
975 {
976 case PICKUP_UNDERWEAR:
977 {
978 zEntPlayer_SNDPlay(ePlayerSnd_PickupUnderwear, 0.0f);
979 zEntPlayer_SNDPlayStreamRandom(ePlayerStreamSnd_UnderwearComment1,
980 ePlayerStreamSnd_UnderwearComment3, 1.3f);
981
982 break;

Callers

nothing calls this directly

Calls 7

xEntHideFunction · 0.85
zEntPickup_GivePickupFunction · 0.85
isRewardPickupFunction · 0.85
zEntPlayer_SNDPlayStreamFunction · 0.85
xrandFunction · 0.85
zEntPlayer_SNDPlayFunction · 0.85

Tested by

no test coverage detected