diff --git a/README.md b/README.md index 3e8af652..8c3867c5 100644 --- a/README.md +++ b/README.md @@ -17,7 +17,7 @@ Fork of the ultrasm64 repo by CrashOveride which includes the following commonly - Widescreen (16:9) support toggleable by pressing `L` in the pause menu. - If you don't want this, you can disable it by removing `#define wide` in `ingame_menu.c` - Removed course-specific camera processing -- Increased maximum pole lenght (The game will read bparam1 and bparam2 together as a single value, so you can have a Snake Eater pole) +- Increased maximum pole length (The game will read bparam1 and bparam2 together as a single value, so you can have a Snake Eater pole) - bparam4 fix (the game no longer uses bparam4 to check if an object is mario and therefore you can safely use it) It also uncringes the way that apply_patch.sh works, and removes the black border. diff --git a/include/config.h b/include/config.h index cab8aaaf..23806692 100644 --- a/include/config.h +++ b/include/config.h @@ -55,6 +55,8 @@ #define CAMERA_FIX // Increase the maximum pone lenght (it will treat bparam1 and bparam2 as a single value) #define LONGER_POLES +// Uncomment this if you want global star IDs (useful for creating an open world hack ala MVC) +//#define GLOBAL_STAR_IDS // Uncomment this if you want to skip the title screen (Super Mario 64 logo) //#define SKIP_TITLE_SCREEN // Uncomment this if you want to keep the mario head and not skip it @@ -62,7 +64,7 @@ /* Coordinate overflow fix setting: * Scales the world down by this factor, increasing how far you can render on - * console in exchange for a slight loss in precision. + * console and LLE plugins in exchange for a slight loss in precision. * * For double extended boundary hacks, a value of 1.5f or 2.0f is good. * For quadruple extended bounds, use 3.f or 4.f diff --git a/src/game/behaviors/spawn_star.inc.c b/src/game/behaviors/spawn_star.inc.c index 9a194a5c..76846121 100644 --- a/src/game/behaviors/spawn_star.inc.c +++ b/src/game/behaviors/spawn_star.inc.c @@ -1,3 +1,5 @@ +#include "config.h" + // spawn_default_star.c.inc static struct ObjectHitbox sCollectStarHitbox = { @@ -17,8 +19,13 @@ void bhv_collect_star_init(void) { u8 currentLevelStarFlags; starId = (o->oBehParams >> 24) & 0xFF; +#ifdef GLOBAL_STAR_IDS + currentLevelStarFlags = save_file_get_star_flags(gCurrSaveFileNum - 1, (starId/7) - 1); + if (currentLevelStarFlags & (1 << (starId % 7))) { +#else currentLevelStarFlags = save_file_get_star_flags(gCurrSaveFileNum - 1, gCurrCourseNum - 1); if (currentLevelStarFlags & (1 << starId)) { +#endif o->header.gfx.sharedChild = gLoadedGraphNodes[MODEL_TRANSPARENT_STAR]; } else { o->header.gfx.sharedChild = gLoadedGraphNodes[MODEL_STAR]; diff --git a/src/game/interaction.c b/src/game/interaction.c index 63ef64af..6bc26c05 100644 --- a/src/game/interaction.c +++ b/src/game/interaction.c @@ -23,6 +23,7 @@ #include "sm64.h" #include "sound_init.h" #include "rumble_init.h" +#include "config.h" #define INT_GROUND_POUND_OR_TWIRL (1 << 0) // 0x01 #define INT_PUNCH (1 << 1) // 0x02 @@ -806,8 +807,11 @@ u32 interact_star_or_key(struct MarioState *m, UNUSED u32 interactType, struct O o->oInteractStatus = INT_STATUS_INTERACTED; m->interactObj = o; m->usedObj = o; - +#ifdef GLOBAL_STAR_IDS + starIndex = (o->oBehParams >> 24) & 0xFF; +#else starIndex = (o->oBehParams >> 24) & 0x1F; +#endif save_file_collect_star_or_key(m->numCoins, starIndex); m->numStars = diff --git a/src/game/save_file.c b/src/game/save_file.c index da3378eb..7112b706 100644 --- a/src/game/save_file.c +++ b/src/game/save_file.c @@ -413,8 +413,13 @@ void save_file_reload(void) { void save_file_collect_star_or_key(s16 coinScore, s16 starIndex) { s32 fileIndex = gCurrSaveFileNum - 1; s32 courseIndex = gCurrCourseNum - 1; - +#ifdef GLOBAL_STAR_IDS + s32 starByte = (starIndex / 7) - 1; + s32 starFlag = 1 << (starIndex % 7); +#else s32 starFlag = 1 << starIndex; +#endif + UNUSED s32 flags = save_file_get_flags(); gLastCompletedCourseNum = courseIndex + 1; @@ -456,9 +461,15 @@ void save_file_collect_star_or_key(s16 coinScore, s16 starIndex) { break; default: +#ifdef GLOBAL_STAR_IDS + if (!(save_file_get_star_flags(fileIndex, starByte) & starFlag)) { + save_file_set_star_flags(fileIndex, starByte, starFlag); + } +#else if (!(save_file_get_star_flags(fileIndex, courseIndex) & starFlag)) { save_file_set_star_flags(fileIndex, courseIndex, starFlag); } +#endif break; } }