sm64pc/src/game/behaviors/red_coin.inc.c

56 lines
1.6 KiB
C
Raw Normal View History

2019-08-25 04:46:40 +00:00
// red_coin.c.inc
static struct ObjectHitbox sRedCoinHitbox = {
/* interactType: */ INTERACT_COIN,
/* downOffset: */ 0,
/* damageOrCoinValue: */ 2,
/* health: */ 0,
/* numLootCoins: */ 0,
/* radius: */ 100,
/* height: */ 64,
/* hurtboxRadius: */ 0,
/* hurtboxHeight: */ 0,
};
void bhv_red_coin_init(void) {
struct Surface *sp24;
UNUSED f32 sp20 = find_floor(o->oPosX, o->oPosY, o->oPosZ, &sp24);
struct Object *sp1C;
sp1C = obj_nearest_object_with_behavior(bhvHiddenRedCoinStar);
if (sp1C != NULL)
o->parentObj = sp1C;
else {
sp1C = obj_nearest_object_with_behavior(bhvBowserCourseRedCoinStar);
if (sp1C != NULL)
o->parentObj = sp1C;
else
o->parentObj = NULL;
}
set_object_hitbox(o, &sRedCoinHitbox);
}
void bhv_red_coin_loop(void) {
if (o->oInteractStatus & INT_STATUS_INTERACTED) {
if (o->parentObj != NULL) {
2019-10-05 19:08:05 +00:00
o->parentObj->oHiddenStarTriggerCounter++;
2019-08-25 04:46:40 +00:00
#ifdef VERSION_JP
2019-10-05 19:08:05 +00:00
create_sound_spawner(SOUND_GENERAL_RED_COIN);
2019-08-25 04:46:40 +00:00
#endif
2019-10-05 19:08:05 +00:00
if (o->parentObj->oHiddenStarTriggerCounter != 8) {
SpawnOrangeNumber(o->parentObj->oHiddenStarTriggerCounter, 0, 0, 0);
2019-08-25 04:46:40 +00:00
}
#ifndef VERSION_JP
2019-10-05 19:08:05 +00:00
play_sound(SOUND_MENU_COLLECT_RED_COIN
+ (((u8) o->parentObj->oHiddenStarTriggerCounter - 1) << 16),
2019-08-25 04:46:40 +00:00
gDefaultSoundArgs);
#endif
}
CoinCollected();
o->oInteractStatus = 0;
}
}