Fix red coins, secrets, goomba triplet macros, and count_objects_with_behavior

This commit is contained in:
Agent X 2024-06-13 18:03:20 -04:00
parent ab9e4bf6c7
commit a8f76be263
4 changed files with 5 additions and 4 deletions

View file

@ -132,9 +132,9 @@ static void area_check_red_coin_or_secret(void *arg, bool isMacroObject) {
} else {
bhv = (const BehaviorScript *) arg;
}
if (bhv == smlua_override_behavior(bhvRedCoin)) {
if (bhv == bhvRedCoin) {
gAreas[sCurrAreaIndex].numRedCoins++;
} else if (bhv == smlua_override_behavior(bhvHiddenStarTrigger)) {
} else if (bhv == bhvHiddenStarTrigger) {
gAreas[sCurrAreaIndex].numSecrets++;
}
}

View file

@ -58,7 +58,6 @@ void bhv_hidden_star_loop(void) {
}
}
/* TODO: this is likely not a checkpoint but a Secret */
void bhv_hidden_star_trigger_loop(void) {
if ((o->oInteractStatus & INT_STATUS_INTERACTED) || (gMarioStates[0].visibleToEnemies && obj_check_if_collided_with_object(o, gMarioObjects[0]) == 1)) {
struct Object *hiddenStar = cur_obj_nearest_object_with_behavior(bhvHiddenStar);

View file

@ -1151,6 +1151,8 @@ s32 count_unimportant_objects(void) {
}
s32 count_objects_with_behavior(const BehaviorScript *behavior) {
if (!behavior) { return 0; }
behavior = smlua_override_behavior(behavior);
uintptr_t *behaviorAddr = segmented_to_virtual(behavior);
u32 objList = get_object_list_from_behavior(behaviorAddr);

View file

@ -207,7 +207,7 @@ void network_receive_level_macro(struct Packet* p) {
}
}
LOG_INFO("rx macro special: coin formation");
} else if (behavior == smlua_override_behavior(bhvGoombaTripletSpawner)) {
} else if (behavior == bhvGoombaTripletSpawner) {
for (s32 i = 0; i < OBJECT_POOL_CAPACITY; i++) {
struct Object* o2 = &gObjectPool[i];
if (o2->parentObj != o) { continue; }