Added back the QoL demo data and made a few minor tweaks/fixes

This commit is contained in:
Colton Rushton 2021-02-17 18:06:30 -04:00
parent 85827a0abc
commit 3123010733
5 changed files with 70 additions and 3 deletions

View File

@ -912,8 +912,13 @@ $(BUILD_DIR)/include/level_headers.h: levels/level_headers.h.in
$(BUILD_DIR)/assets/mario_anim_data.c: $(wildcard assets/anims/*.inc.c)
$(PYTHON) tools/mario_anims_converter.py > $@
ifneq ($(QOL_FIXES),1)
$(BUILD_DIR)/assets/demo_data.c: assets/demo_data.json $(wildcard assets/demos/*.bin)
$(PYTHON) tools/demo_data_converter.py assets/demo_data.json $(VERSION_CFLAGS) > $@
else
$(BUILD_DIR)/assets/demo_data.c: assets/qol_demo_data.json $(wildcard assets/demos/*.bin)
$(PYTHON) tools/demo_data_converter.py assets/qol_demo_data.json $(VERSION_CFLAGS) > $@
endif
# Source code
$(BUILD_DIR)/levels/%/leveldata.o: OPT_FLAGS := -g

45
assets/qol_demo_data.json Normal file
View File

@ -0,0 +1,45 @@
/*
* This file defines the demo data. It's parsed by tools/demo_data_converter.py.
*
* The "table" array declares the order of the demos and will be generated
* as pairs of (offset, size).
* Each item has a "demofile" property, which must reference a demofile
* in the "demofiles" array.
* "ifdef" is an optional array property which can be used to specify
* requirement of SM64 version.
* "extraSize" is an optional property which will be added to the size of the
* demofile.
*
* The "demofiles" array declares the inclusion order of the demofiles.
* A file with the ".bin" extension with the "name" property as basename
* should exist in the assets/demos/ directory.
* "ifdef" is an optional array property which can be used to specify
* requirement of SM64 version.
*/
{
"table": [
{"demofile":"bitdw", "ifdef":["VERSION_US"]},
{"demofile":"wf"},
{"demofile":"ccm"},
{"demofile":"bbh"},
{"demofile":"jrb"},
{"demofile":"hmc"},
{"demofile":"pss"}
],
"demofiles": [
{"name":"bbh"},
{"name":"ccm"},
{"name":"hmc"},
{"name":"jrb"},
{"name":"wf"},
{"name":"pss"},
/* Might be an unused demo, but it doesn't define a header,
so it can't be normally called. Speculation: "blooper" take for CCM.
Mario runs into the sign and aligns himself as if it were a mistake. */
{"name":"unused"},
{"name":"bitdw", "ifdef":["VERSION_US"]}
]
}

View File

@ -159,9 +159,9 @@ void water_ring_spawner_act_inactive(void) {
//! Because the index counter overflows at 10000, it's possible to wait
// for about 4 hours and 38 minutes if you miss a ring, and the index will
// come around again.
#ifndef QOL_FIXES
if (o->oTimer == 300)
o->oTimer = 0;
#ifndef QOL_FIXES
if ((o->oTimer == 0) || (o->oTimer == 50) || (o->oTimer == 150) || (o->oTimer == 200)
|| (o->oTimer == 250)) {
#else

View File

@ -781,8 +781,9 @@ void handle_menu_scrolling(s8 scrollDirection, s8 *currentIndex, s8 minIndex, s8
currentIndex[0]++;
}
#else
// if >=, this could cause an OOB array access and crash. Use > instead here to fix this.
if (currentIndex[0] > maxIndex) {
// if <=, this could cause an OOB array access and crash. Use < instead here to fix this.
// >= is incorrect and will cause the menu to not function correctly
if (currentIndex[0] < maxIndex) {
play_sound(SOUND_MENU_CHANGE_SELECT, gDefaultSoundArgs);
currentIndex[0]++;
}
@ -790,12 +791,20 @@ void handle_menu_scrolling(s8 scrollDirection, s8 *currentIndex, s8 minIndex, s8
}
if (((index ^ gMenuHoldKeyIndex) & index) == 1) {
#ifndef QOL_FIXES
if (currentIndex[0] == minIndex) {
// Same applies to here as above
} else {
play_sound(SOUND_MENU_CHANGE_SELECT, gDefaultSoundArgs);
currentIndex[0]--;
}
#else
// if >=, this could cause an OOB array access and crash. Use > instead here to fix this.
if (currentIndex[0] > minIndex) {
play_sound(SOUND_MENU_CHANGE_SELECT, gDefaultSoundArgs);
currentIndex[0]--;
}
#endif
}
if (gMenuHoldKeyTimer == 10) {
@ -2813,6 +2822,7 @@ void print_hud_course_complete_coins(s16 x, s16 y) {
if ((gCourseDoneMenuTimer & 1) || gHudDisplay.coins > 70) {
gCourseCompleteCoins++;
play_sound(SOUND_MENU_YOSHI_GAIN_LIVES, gDefaultSoundArgs);
#ifndef QOL_FIXES
if (gCourseCompleteCoins == 50 || gCourseCompleteCoins == 100 || gCourseCompleteCoins == 150) {
#else

View File

@ -399,9 +399,16 @@ u32 check_ledge_grab(struct MarioState *m, struct Surface *wall, Vec3f intendedP
ledgePos[1] = find_floor(ledgePos[0], nextPos[1], ledgePos[2], &ledgeFloor);
#endif
#ifndef QOL_FIXES
if (ledgePos[1] - nextPos[1] <= 100.0f) {
return 0;
}
#else
// to compensate, increase this check to 260 instead of 100
if (ledgePos[1] - nextPos[1] <= 260.0f) {
return 0;
}
#endif
vec3f_copy(m->pos, ledgePos);
m->floor = ledgeFloor;