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

Add VERTICAL_ROOMS define #430

Open
wants to merge 1 commit into
base: develop/2.4.0
Choose a base branch
from
Open
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
3 changes: 3 additions & 0 deletions include/config/config_collision.h
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,9 @@
// Number of walls that can push Mario at once. Vanilla is 4.
#define MAX_REFERENCED_WALLS 4

// Allow vertical rooms to be a thing by using the SURFACE_INTANGIBLE floor type to separate the rooms. Note that this will add an extra floor check every frame.
// #define VERTICAL_ROOMS

// Collision data is the type that the collision system uses. All data by default is stored as an s16, but you may change it to s32.
// Naturally, that would double the size of all collision data, but would allow you to use 32 bit values instead of 16.
// Rooms are s8 in vanilla, but if you somehow have more than 255 rooms, you may raise this number.
Expand Down
21 changes: 13 additions & 8 deletions src/game/object_helpers.c
Original file line number Diff line number Diff line change
Expand Up @@ -130,16 +130,21 @@ Gfx *geo_switch_area(s32 callContext, struct GraphNode *node, UNUSED void *conte
if (gMarioObject == NULL) {
switchCase->selectedCase = 0;
} else {
#ifdef ENABLE_VANILLA_LEVEL_SPECIFIC_CHECKS
if (gCurrLevelNum == LEVEL_BBH) {
// In BBH, check for a floor manually, since there is an intangible floor. In custom hacks this can be removed.
#ifdef VERTICAL_ROOMS
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

is there any issue with checking if gCurrentArea->surfaceRooms != NULL instead of using this define? i feel like there has to be a way if checking that an area has rooms before doing this check, that way we dont need to have a define for this and its automatic

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

good point, I'll see if that works and if so I'll remove the define

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

another consideration we're having: add a flag whether or not an area has surface intangible floors, then if flag then check

// Checks for a floor manually, including intangible ones. This allows one to have vertical rooms.
find_room_floor(gMarioObject->oPosX, gMarioObject->oPosY, gMarioObject->oPosZ, &floor);
} else {
// Since no intangible floors are nearby, use Mario's floor instead.
floor = gMarioState->floor;
}
#else
floor = gMarioState->floor;
#ifdef ENABLE_VANILLA_LEVEL_SPECIFIC_CHECKS
if (gCurrLevelNum == LEVEL_BBH) {
find_room_floor(gMarioObject->oPosX, gMarioObject->oPosY, gMarioObject->oPosZ, &floor);
} else {
floor = gMarioState->floor;
}
#else
// Use Mario's floor to determine the room.
// This saves processing time, but does not allow vertical rooms, since intangible floors will be skipped.
floor = gMarioState->floor;
#endif
#endif
if (floor) {
gMarioCurrentRoom = floor->room;
Expand Down