diff --git a/include/config.h b/include/config.h index 5188e0ef9..9c6dd908d 100644 --- a/include/config.h +++ b/include/config.h @@ -19,3 +19,7 @@ #include "config/config_movement.h" #include "config/config_objects.h" #include "config/config_rom.h" + + +/* WARNING: Compatibility safeguards - don't remove this file unless you know what you're doing */ +#include "config/config_safeguards.h" diff --git a/include/config/config_benchmark.h b/include/config/config_benchmark.h index be2468456..980e857f9 100644 --- a/include/config/config_benchmark.h +++ b/include/config/config_benchmark.h @@ -11,7 +11,7 @@ // #define ENABLE_CREDITS_BENCHMARK #ifdef ENABLE_CREDITS_BENCHMARK -#define DEBUG_ALL -#define ENABLE_VANILLA_LEVEL_SPECIFIC_CHECKS -#define TEST_LEVEL LEVEL_CASTLE_GROUNDS + #define DEBUG_ALL + #define ENABLE_VANILLA_LEVEL_SPECIFIC_CHECKS + #define TEST_LEVEL LEVEL_CASTLE_GROUNDS #endif diff --git a/include/config/config_camera.h b/include/config/config_camera.h index 5752ab85c..813dc1c0a 100644 --- a/include/config/config_camera.h +++ b/include/config/config_camera.h @@ -50,23 +50,5 @@ // This is automatically enabled when ENABLE_VANILLA_LEVEL_SPECIFIC_CHECKS is enabled, // but feel free to override it if you really want to for some reason #ifdef ENABLE_VANILLA_LEVEL_SPECIFIC_CHECKS -#define ENABLE_VANILLA_CAM_PROCESSING -#endif - - -/**************************************/ -/****** Compatibility safeguards ******/ -/**************************************/ -// Don't change these unless you know what you're doing -#ifdef FORCED_CAMERA_MODE -#define USE_COURSE_DEFAULT_MODE // Forced camera mode overwrites the default mode -#endif -#ifndef WATER_SURFACE_CAMERA_MODE -#define WATER_SURFACE_CAMERA_MODE CAMERA_MODE_WATER_SURFACE -#endif -#ifndef DEEP_WATER_CAMERA_MODE -#define DEEP_WATER_CAMERA_MODE CAMERA_MODE_BEHIND_MARIO -#endif -#ifndef FLYING_CAMERA_MODE -#define FLYING_CAMERA_MODE CAMERA_MODE_BEHIND_MARIO + #define ENABLE_VANILLA_CAM_PROCESSING #endif diff --git a/include/config/config_debug.h b/include/config/config_debug.h index 53cfc14ff..42aef6cdb 100644 --- a/include/config/config_debug.h +++ b/include/config/config_debug.h @@ -5,7 +5,7 @@ ******************/ // Enables most debug options -//#define DEBUG_ALL +// #define DEBUG_ALL // Disables all debug options (except PUPPYPRINT) #define DISABLE_ALL @@ -22,16 +22,8 @@ // Enable debug free move (DPad up to enter, A to exit). #define ENABLE_DEBUG_FREE_MOVE -// Include vanilla debug functionality. -//#define VANILLA_DEBUG - -// Custom debug mode. Press DPAD left to show the debug UI. Press DPAD right to enter the noclip mode. -//#define CUSTOM_DEBUG - -// Include Puppyprint, a display library for text and large images. -//#define PUPPYPRINT -// Include a custom, enhanced performance profiler (Requires PUPPYPRINT). -//#define PUPPYPRINT_DEBUG 1 +// Include a custom, enhanced performance profiler (Enables PUPPYPRINT by default in config_safeguards). +// #define PUPPYPRINT_DEBUG 1 // Use cycles instead of microseconds in Puppyprint debug output. //#define PUPPYPRINT_DEBUG_CYCLES @@ -45,41 +37,16 @@ // Same as above, but also reads all save file flags as complete. // This will not overwrite existing save file data unless you save over it. -//#define COMPLETE_SAVE_FILE +// #define COMPLETE_SAVE_FILE + +// Custom debug mode. Press DPAD left to show the debug UI. Press DPAD right to enter the noclip mode. +// #define CUSTOM_DEBUG // Removes the limit on FPS -//#define UNLOCK_FPS +// #define UNLOCK_FPS + +// Include vanilla debug functionality. +// #define VANILLA_DEBUG // Forces a crash when the game starts. Useful for debugging the crash screen. -//#define DEBUG_FORCE_CRASH_ON_BOOT - -// -- Compatibility safeguards. Don't mess with these unless you know what you're doing. -- - -#ifdef COMPLETE_SAVE_FILE -#define UNLOCK_ALL -#endif // COMPLETE_SAVE_FILE - -#ifdef DEBUG_ALL -#define DEBUG_LEVEL_SELECT -#define ENABLE_DEBUG_FREE_MOVE -#define PUPPYPRINT -#define PUPPYPRINT_DEBUG 1 -#define VISUAL_DEBUG -#define UNLOCK_ALL -#define COMPLETE_SAVE_FILE -#endif // DEBUG_ALL - -#ifdef DISABLE_ALL -#undef DEBUG_ALL -#undef TEST_LEVEL -#undef DEBUG_LEVEL_SELECT -#undef ENABLE_DEBUG_FREE_MOVE -#undef VANILLA_DEBUG -#undef CUSTOM_DEBUG -#undef PUPPYPRINT_DEBUG -#undef PUPPYPRINT_DEBUG_CYCLES -#undef VISUAL_DEBUG -#undef UNLOCK_ALL -#undef COMPLETE_SAVE_FILE -#undef DEBUG_FORCE_CRASH_ON_BOOT -#endif // DISABLE_ALL +// #define DEBUG_FORCE_CRASH_ON_BOOT diff --git a/include/config/config_game.h b/include/config/config_game.h index 55b914079..516e288b5 100644 --- a/include/config/config_game.h +++ b/include/config/config_game.h @@ -4,9 +4,11 @@ * 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. + * 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 +*/ // #define ENABLE_VANILLA_LEVEL_SPECIFIC_CHECKS // Disable lives and hide the lives counter @@ -26,6 +28,7 @@ // Air/Breath meter is separate from health meter when underwater // #define BREATH_METER + // Number of coins to spawn the "100 coin" star. If you remove the define altogether, then there won't be a 100 coin star at all. #define X_COIN_STAR 100 @@ -46,7 +49,9 @@ #define AREA_COUNT 8 // Makes signs and NPCs easier to talk to. -#define EASIER_DIALOG_TRIGGER +// NOTE: Currently has issues with talking to Bowser post-fight, +// https://github.com/Reonu/HackerSM64/issues/273 +// #define EASIER_DIALOG_TRIGGER // Show an "A" when Mario is able to talk [requires EASIER_DIALOG_TRIGGER] // #define DIALOG_INDICATOR @@ -68,13 +73,3 @@ // The level that the game starts in after file select. The levelscript needs to have a MARIO_POS command for this to work. #define START_LEVEL LEVEL_CASTLE_GROUNDS - - -// -- Compatibility safeguards. Don't mess with these unless you know what you're doing. -- - -#ifdef DISABLE_LIVES -#undef SAVE_NUM_LIVES -#endif // DISABLE_LIVES -#ifndef START_LEVEL -#define START_LEVEL LEVEL_CASTLE_GROUNDS -#endif diff --git a/include/config/config_goddard.h b/include/config/config_goddard.h index 5cee45b09..19f6d6fe3 100644 --- a/include/config/config_goddard.h +++ b/include/config/config_goddard.h @@ -12,10 +12,3 @@ // Disables the demo that plays when idle on the start screen (has no effect if KEEP_MARIO_HEAD is disabled) #define DISABLE_DEMO - -// -- Compatibility safeguards. Don't mess with these unless you know what you're doing.-- - -#ifndef KEEP_MARIO_HEAD -#undef GODDARD_EASTER_EGG -#define DISABLE_DEMO -#endif // !KEEP_MARIO_HEAD diff --git a/include/config/config_graphics.h b/include/config/config_graphics.h index 31698098f..4c4b52ff2 100644 --- a/include/config/config_graphics.h +++ b/include/config/config_graphics.h @@ -4,6 +4,9 @@ * GRAPHICS SETTINGS * *********************/ +// Size of how large the master display list (gDisplayListHead) can be. 6400 is vanilla +#define GFX_POOL_SIZE 10000 + // Show a watermark in the title screen that reads "Made with HackerSM64", instead of the copyright message #define INTRO_CREDIT @@ -15,7 +18,7 @@ // Skybox size modifier, changing this will add support for larger skybox images. NOTE: Vanilla skyboxes may break if you change this option. Be sure to rescale them accordingly. // Whenever you change this, make sure to run "make -C tools clean" to rebuild the skybox tool (alternatively go into skyconv.c and change the file in any way (like adding/deleting a space) to specifically rebuild that tool). -// When increasing this, you should probably also increase the GFX pool size. (the GFX_POOL_SIZE define in src/game/game_init.h) +// When increasing this, you should probably also increase the GFX pool size. (the GFX_POOL_SIZE define above) #define SKYBOX_SIZE 1 // When this option is enabled, LODs will ONLY work on console. @@ -23,6 +26,10 @@ // Regardless of whether this setting is enabled or not, you can use gIsConsole to wrap your own code in a console check. #define AUTO_LOD +// Include Puppyprint, a display library for text and large images. +// Automatically included when PUPPYPRINT_DEBUG is enabled +// #define PUPPYPRINT + // Disable AA (Improves console performance but causes visible seams between unconnected geometry). // #define DISABLE_AA @@ -77,20 +84,3 @@ // Use old shadow IDs for Fast64 compatibility. This is a temporary fix until Fast64 is updated to use the enum defines. // NOTE: When this is enabled, The 49th hardcoded rectangle shadow will act as a regular circular shadow, due to Mario's shadow ID being 99 in vanilla. #define LEGACY_SHADOW_IDS - -// -- Compatibility safeguards. Don't mess with these unless you know what you're doing. -- - -#ifndef F3DZEX_GBI_2 -#undef OBJECTS_REJ // OBJECTS_REJ requires f3dzex. -#endif // !F3DZEX_GBI_2 - -#ifndef F3DEX_GBI_SHARED -#undef OBJECTS_REJ // Non F3DEX-based ucodes do NOT support ucode switching. -#endif // !F3DEX_GBI_SHARED - -#ifdef OBJECTS_REJ -// Enable required ucodes. -#define F3DEX2_REJ_GBI -#define F3DLX2_REJ_GBI -#endif // OBJECTS_REJ - diff --git a/include/config/config_menu.h b/include/config/config_menu.h index d5bb33225..925c795df 100644 --- a/include/config/config_menu.h +++ b/include/config/config_menu.h @@ -17,12 +17,3 @@ #define EXIT_COURSE_LEVEL LEVEL_CASTLE #define EXIT_COURSE_AREA 0x01 #define EXIT_COURSE_NODE 0x1F - -// -- Compatibility safeguards. Don't mess with these unless you know what you're doing. -- - -#ifdef DISABLE_EXIT_COURSE -#undef EXIT_COURSE_WHILE_MOVING -#undef EXIT_COURSE_LEVEL -#undef EXIT_COURSE_AREA -#undef EXIT_COURSE_NODE -#endif // DISABLE_EXIT_COURSE diff --git a/include/config/config_movement.h b/include/config/config_movement.h index 9517e6afa..d1fbe65e2 100644 --- a/include/config/config_movement.h +++ b/include/config/config_movement.h @@ -5,7 +5,7 @@ *********************/ // Fixes Mario's turn ground radius by making it dependent on the analog stick magnitude. -//#define GROUND_TURN_FIX +// #define GROUND_TURN_FIX // Fixes Mario's turn ground radius by allowing Mario to turn around at any speed. // Basically a simpler version of GROUND_TURN_FIX but smoother & closer to vanilla. @@ -80,10 +80,3 @@ // Re-enable upwarping when entering water. Forces you to only enter water from the top // #define WATER_PLUNGE_UPWARP - - -// -- Compatibility safeguards. Don't mess with these unless you know what you're doing. -- - -// #ifdef GROUND_TURNING_AROUND_FIX -// #undef GROUND_TURN_FIX -// #endif // GROUND_TURNING_AROUND_FIX diff --git a/include/config/config_objects.h b/include/config/config_objects.h index b0064cf08..9158980ac 100644 --- a/include/config/config_objects.h +++ b/include/config/config_objects.h @@ -73,12 +73,3 @@ // The number of segments Wiggler has, not including the head. Vanilla is 4. #define WIGGLER_NUM_SEGMENTS 4 - -// -- Compatibility safeguards. Don't mess with these unless you know what you're doing. -- - -// Enable floombas if the intro floombas are enabled -#ifdef INTRO_FLOOMBAS - #ifndef FLOOMBAS - #define FLOOMBAS - #endif -#endif diff --git a/include/config/config_rom.h b/include/config/config_rom.h index 8a6d761fc..bdc340bd2 100644 --- a/include/config/config_rom.h +++ b/include/config/config_rom.h @@ -23,10 +23,3 @@ // There is generally no reason to have a value other than 0 for emulator. As for console, it provides a (small) performance boost. #define BORDER_HEIGHT_CONSOLE 0 #define BORDER_HEIGHT_EMULATOR 0 - -// -- Compatibility safeguards. Don't mess with these unless you know what you're doing.-- - -#ifndef TARGET_N64 -#define BORDER_HEIGHT_CONSOLE 0 -#define BORDER_HEIGHT_EMULATOR 0 -#endif // !TARGET_N64 diff --git a/include/config/config_safeguards.h b/include/config/config_safeguards.h new file mode 100644 index 000000000..f670bfa53 --- /dev/null +++ b/include/config/config_safeguards.h @@ -0,0 +1,164 @@ +#pragma once + +/***************************** + * COMPATIBILITY SAFE GUARDS * + *****************************/ + +/** + * NOTE: Only mess with these if you know what you're doing! + * These are put in place to insure that connected functionality works as intended. + */ + + +/***************** + * config_graphics + */ + +#ifndef F3DZEX_GBI_2 + #undef OBJECTS_REJ // OBJECTS_REJ requires f3dzex. +#endif // !F3DZEX_GBI_2 + +#ifndef F3DEX_GBI_SHARED + #undef OBJECTS_REJ // Non F3DEX-based ucodes do NOT support ucode switching. +#endif // !F3DEX_GBI_SHARED + +#ifdef OBJECTS_REJ +// Enable required ucodes. + #define F3DEX2_REJ_GBI + #define F3DLX2_REJ_GBI +#endif // OBJECTS_REJ + + +/***************** + * config_debug + */ + +#ifdef PUPPYPRINT_DEBUG + #undef PUPPYPRINT + #define PUPPYPRINT +#endif + +#ifdef COMPLETE_SAVE_FILE + #undef UNLOCK_ALL + #define UNLOCK_ALL +#endif // COMPLETE_SAVE_FILE + +#ifdef DEBUG_ALL + #undef DEBUG_LEVEL_SELECT + #define DEBUG_LEVEL_SELECT + + #undef ENABLE_DEBUG_FREE_MOVE + #define ENABLE_DEBUG_FREE_MOVE + + #undef PUPPYPRINT + #define PUPPYPRINT + + #undef PUPPYPRINT_DEBUG + #define PUPPYPRINT_DEBUG 1 + + #undef VISUAL_DEBUG + #define VISUAL_DEBUG + + #undef UNLOCK_ALL + #define UNLOCK_ALL + + #undef COMPLETE_SAVE_FILE + #define COMPLETE_SAVE_FILE +#endif // DEBUG_ALL + +#ifdef DISABLE_ALL + #undef DEBUG_ALL + #undef TEST_LEVEL + #undef DEBUG_LEVEL_SELECT + #undef ENABLE_DEBUG_FREE_MOVE + #undef VANILLA_DEBUG + #undef CUSTOM_DEBUG + #undef PUPPYPRINT_DEBUG + #undef PUPPYPRINT_DEBUG_CYCLES + #undef VISUAL_DEBUG + #undef UNLOCK_ALL + #undef COMPLETE_SAVE_FILE + #undef DEBUG_FORCE_CRASH_ON_BOOT +#endif // DISABLE_ALL + + +/***************** + * config_camera + */ + +#ifdef FORCED_CAMERA_MODE + #undef USE_COURSE_DEFAULT_MODE + #define USE_COURSE_DEFAULT_MODE // Forced camera mode overwrites the default mode +#endif + +#ifndef WATER_SURFACE_CAMERA_MODE + #define WATER_SURFACE_CAMERA_MODE CAMERA_MODE_WATER_SURFACE +#endif + +#ifndef DEEP_WATER_CAMERA_MODE + #define DEEP_WATER_CAMERA_MODE CAMERA_MODE_BEHIND_MARIO +#endif + +#ifndef FLYING_CAMERA_MODE + #define FLYING_CAMERA_MODE CAMERA_MODE_BEHIND_MARIO +#endif + + +/***************** + * config_game + */ + +#ifdef DISABLE_LIVES + #undef SAVE_NUM_LIVES +#endif // DISABLE_LIVES + +#ifndef START_LEVEL + #define START_LEVEL LEVEL_CASTLE_GROUNDS +#endif + + +/***************** + * config_goddard + */ + +#ifndef KEEP_MARIO_HEAD + #undef GODDARD_EASTER_EGG + + #undef DISABLE_DEMO + #define DISABLE_DEMO +#endif // !KEEP_MARIO_HEAD + +/***************** + * config_menu + */ + +#ifdef DISABLE_EXIT_COURSE + #undef EXIT_COURSE_WHILE_MOVING + #undef EXIT_COURSE_LEVEL + #undef EXIT_COURSE_AREA + #undef EXIT_COURSE_NODE +#endif // DISABLE_EXIT_COURSE + + +/***************** + * config_objects + */ + +// Enable floombas if the intro floombas are enabled +#ifdef INTRO_FLOOMBAS + #undef FLOOMBAS + #define FLOOMBAS +#endif + + +/***************** + * config_rom + */ + +#ifndef TARGET_N64 + #undef BORDER_HEIGHT_CONSOLE + #define BORDER_HEIGHT_CONSOLE 0 + + #undef BORDER_HEIGHT_EMULATOR + #define BORDER_HEIGHT_EMULATOR 0 +#endif // !TARGET_N64 diff --git a/src/game/game_init.h b/src/game/game_init.h index 2119b7919..c7a5c4729 100644 --- a/src/game/game_init.h +++ b/src/game/game_init.h @@ -8,8 +8,7 @@ #include "types.h" #include "memory.h" - -#define GFX_POOL_SIZE 10000 // Size of how large the master display list (gDisplayListHead) can be. 6400 is vanilla +#include "config.h" #define MARIO_ANIMS_POOL_SIZE 0x4000 #define DEMO_INPUTS_POOL_SIZE 0x800