Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Make bhv_init_room automatically detect if the current area has room data instead of checking a hardcoded array of level numbers. #392

Closed
wants to merge 1 commit into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 3 additions & 6 deletions include/config/config_game.h
Original file line number Diff line number Diff line change
Expand Up @@ -4,11 +4,8 @@
* GAME SETTINGS *
*****************/

/**
* Enables some mechanics that change behavior depending on hardcoded level numbers.
* You may also need to change sLevelsWithRooms in object_helpers.c
* TODO: separate this into separate defines, behavior params, or make these mechanics otherwise dynamic
*/
// Enables some mechanics that change behavior depending on hardcoded level numbers.
// TODO: separate this into separate defines, behavior params, or make these mechanics otherwise dynamic.
// #define ENABLE_VANILLA_LEVEL_SPECIFIC_CHECKS

// Disable lives and hide the lives counter
Expand Down Expand Up @@ -62,7 +59,7 @@
// If this is disabled, backup assets will be used.
// #define COMPLETE_EN_US_SEGMENT2

/// Removes multi-language cake screen
// Removes multi-language cake screen
#define EU_CUSTOM_CAKE_FIX

// Adds multiple languages to the game. Just a placeholder for the most part, because it only works with EU, and must be enabled with EU.
Expand Down
4 changes: 1 addition & 3 deletions src/game/object_helpers.c
Original file line number Diff line number Diff line change
Expand Up @@ -28,8 +28,6 @@
#include "spawn_sound.h"
#include "puppylights.h"

static s8 sLevelsWithRooms[] = { LEVEL_BBH, LEVEL_CASTLE, LEVEL_HMC, -1 };

static s32 clear_move_flag(u32 *bitSet, s32 flag);

Gfx *geo_update_projectile_pos_from_parent(s32 callContext, UNUSED struct GraphNode *node, Mat4 mtx) {
Expand Down Expand Up @@ -1882,7 +1880,7 @@ s32 is_item_in_array(s8 item, s8 *array) {

void bhv_init_room(void) {
struct Surface *floor = NULL;
if (is_item_in_array(gCurrLevelNum, sLevelsWithRooms)) {
if (gCurrentArea->surfaceRooms != NULL) {
find_room_floor(o->oPosX, o->oPosY, o->oPosZ, &floor);

if (floor != NULL) {
Expand Down