diff --git a/Makefile b/Makefile index b5daa8c8..19cdce91 100644 --- a/Makefile +++ b/Makefile @@ -43,8 +43,9 @@ endif # COMPILER - selects the C compiler to use # gcc - uses the GNU C Compiler +# clang - uses clang C/C++ frontend for LLVM COMPILER ?= gcc -$(eval $(call validate-option,COMPILER,gcc)) +$(eval $(call validate-option,COMPILER,gcc clang)) # LIBGCCDIR - selects the libgcc configuration for checking for dividing by zero @@ -158,7 +159,12 @@ LINK_LIBRARIES = $(foreach i,$(LIBRARIES),-l$(i)) ifeq ($(COMPILER),gcc) NON_MATCHING := 1 MIPSISET := -mips3 - OPT_FLAGS := -O2 -g + OPT_FLAGS := -O2 +else ifeq ($(COMPILER),clang) + NON_MATCHING := 1 + # clang doesn't support ABI 'o32' for 'mips3' + MIPSISET := -mips2 + OPT_FLAGS := -O2 endif @@ -390,6 +396,8 @@ export LD_LIBRARY_PATH=./tools AS := $(CROSS)as ifeq ($(COMPILER),gcc) CC := $(CROSS)gcc +else ifeq ($(COMPILER),clang) + CC := clang endif # Prefer gcc's cpp if installed on the system ifneq (,$(call find-command,cpp-10)) @@ -423,9 +431,12 @@ DEF_INC_CFLAGS := $(foreach i,$(INCLUDE_DIRS),-I$(i)) $(C_DEFINES) CFLAGS = -G 0 $(OPT_FLAGS) $(TARGET_CFLAGS) $(MIPSISET) $(DEF_INC_CFLAGS) ifeq ($(COMPILER),gcc) CFLAGS += -mno-shared -march=vr4300 -mfix4300 -mabi=32 -mhard-float -mdivide-breaks -fno-stack-protector -fno-common -fno-zero-initialized-in-bss -fno-PIC -mno-abicalls -fno-strict-aliasing -fno-inline-functions -ffreestanding -fwrapv -Wall -Wextra -Wno-missing-braces -fno-jump-tables +else ifeq ($(COMPILER),clang) + CFLAGS += -target mips -mabi=32 -G 0 -mhard-float -fomit-frame-pointer -fno-stack-protector -fno-common -I include -I src/ -I $(BUILD_DIR)/include -fno-PIC -mno-abicalls -fno-strict-aliasing -fno-inline-functions -ffreestanding -fwrapv -Wall -Wextra -Wno-missing-braces -fno-jump-tables else CFLAGS += -non_shared -Wab,-r4300_mul -Xcpluscomm -Xfullwarn -signed -32 endif +ASMFLAGS = -G 0 $(OPT_FLAGS) $(TARGET_CFLAGS) -mips3 $(DEF_INC_CFLAGS) -mno-shared -march=vr4300 -mfix4300 -mabi=32 -mhard-float -mdivide-breaks -fno-stack-protector -fno-common -fno-zero-initialized-in-bss -fno-PIC -mno-abicalls -fno-strict-aliasing -fno-inline-functions -ffreestanding -fwrapv -Wall -Wextra ASFLAGS := -march=vr4300 -mabi=32 $(foreach i,$(INCLUDE_DIRS),-I$(i)) $(foreach d,$(DEFINES),--defsym $(d)) RSPASMFLAGS := $(foreach d,$(DEFINES),-definelabel $(subst =, ,$(d))) @@ -479,8 +490,8 @@ YELLOW := \033[0;33m BLINK := \033[33;5m endif -# Use Objcopy instead of extract_data_for_mio -ifeq ($(COMPILER),gcc) +# For non-IDO, use objcopy instead of extract_data_for_mio +ifneq ($(COMPILER),ido) EXTRACT_DATA_FOR_MIO := $(OBJCOPY) -O binary --only-section=.data endif @@ -745,7 +756,7 @@ $(BUILD_DIR)/%.o: $(BUILD_DIR)/%.c # Assemble assembly code $(BUILD_DIR)/%.o: %.s $(call print,Assembling:,$<,$@) - $(V)$(CC) -c $(CFLAGS) $(foreach i,$(INCLUDE_DIRS),-Wa,-I$(i)) -x assembler-with-cpp -MMD -MF $(BUILD_DIR)/$*.d -o $@ $< + $(V)$(CROSS)gcc -c $(ASMFLAGS) $(foreach i,$(INCLUDE_DIRS),-Wa,-I$(i)) -x assembler-with-cpp -MMD -MF $(BUILD_DIR)/$*.d -o $@ $< # Assemble RSP assembly code $(BUILD_DIR)/rsp/%.bin $(BUILD_DIR)/rsp/%_data.bin: rsp/%.s @@ -788,7 +799,13 @@ $(ELF): $(O_FILES) $(YAY0_OBJ_FILES) $(SEG_FILES) $(BUILD_DIR)/$(LD_SCRIPT) unde # Build ROM $(ROM): $(ELF) $(call print,Building ROM:,$<,$@) +ifeq ($(CONSOLE),n64) $(V)$(OBJCOPY) --pad-to=0x800000 --gap-fill=0xFF $< $@ -O binary +else ifeq ($(CONSOLE),bb) + $(V)$(OBJCOPY) --gap-fill=0x00 $< $@ -O binary + $(V)dd if=$@ of=tmp bs=16K conv=sync + $(V)mv tmp $@ +endif $(V)$(N64CKSUM) $@ $(BUILD_DIR)/$(TARGET).objdump: $(ELF) diff --git a/README.md b/README.md index 3c835b5c..cb7856c4 100644 --- a/README.md +++ b/README.md @@ -37,7 +37,7 @@ This is a fork of the ultrasm64 repo by CrashOveride which includes the followin **Hacker QOL:** - Global, non-level based, star IDs (off by default) * -- FPS counter (use the function `print_fps(x,y)` anywhere that runs code every frame) +- Debug mode: prints mario's coordinates, angle and speed, and a FPS counter. - Automatic console/emulator detection. If emulator is detected, LODs are disabled. * - Ability to configure whether there's a 100 coin star at all and how many coins are required to spawn it * - Ability to easily change the warp that EXIT COURSE takes you to via config.h, or disable it entirely. * @@ -53,6 +53,7 @@ This is a fork of the ultrasm64 repo by CrashOveride which includes the followin - Expanded audio heap allows for a larger concurrent note count and the importing of more m64 sequences and sound banks (By ArcticJaguar725) * - You can set a test level in config.h in order to boot straight into it, so you can quickly test the level you're working on. * - Allows all surfaces in the game to have a `force` parameter. Activating this doesn't REQUIRE you to set `force` for every surface: If you don't set, it will default to 0x0000 rather than crashing. Increases RAM usage of collision. * +- The clown font includes the entire English alphabet. - Colored ia4 text support. Format: `"@XXXXXXXX[YOUR TEXT]@--------"` (By ArcticJaguar725) - Example Text: `"@FF0000FFRED @00FF00FFGREEN @0000FFFFBLUE @FFFFFF00INVISIBLE @--------NORMAL"` - NOTE: It is not mandatory to reset the text color with `"@--------"`, but text will need to be recolored each time it scrolls in a dialog box, or the custom color will reset. diff --git a/actors/chillychief/geo.inc.c b/actors/chillychief/geo.inc.c index 96ec2e1c..78a0bfa2 100644 --- a/actors/chillychief/geo.inc.c +++ b/actors/chillychief/geo.inc.c @@ -5,39 +5,39 @@ const GeoLayout chilly_chief_geo[] = { GEO_OPEN_NODE(), GEO_SCALE(0, 0x7333), GEO_OPEN_NODE(), - GEO_ANIMATED_PART(1, 0, 0, 0, NULL), + GEO_ANIMATED_PART(LAYER_OPAQUE, 0, 0, 0, NULL), GEO_OPEN_NODE(), - GEO_ANIMATED_PART(1, 0, 0, 0, NULL), + GEO_ANIMATED_PART(LAYER_OPAQUE, 0, 0, 0, NULL), GEO_OPEN_NODE(), - GEO_ANIMATED_PART(1, 0, 0, 75, NULL), + GEO_ANIMATED_PART(LAYER_OPAQUE, 0, 0, 75, NULL), GEO_OPEN_NODE(), - GEO_ANIMATED_PART(1, 0, 0, 0, NULL), + GEO_ANIMATED_PART(LAYER_OPAQUE, 0, 0, 0, NULL), GEO_OPEN_NODE(), - GEO_ANIMATED_PART(1, 146, 0, 0, NULL), + GEO_ANIMATED_PART(LAYER_OPAQUE, 146, 0, 0, NULL), GEO_OPEN_NODE(), - GEO_ANIMATED_PART(1, 0, 0, 0, chilly_chief_seg6_dl_06002B30), + GEO_ANIMATED_PART(LAYER_OPAQUE, 0, 0, 0, chilly_chief_seg6_dl_06002B30), GEO_CLOSE_NODE(), GEO_CLOSE_NODE(), GEO_CLOSE_NODE(), - GEO_ANIMATED_PART(1, 0, 0, -75, NULL), + GEO_ANIMATED_PART(LAYER_OPAQUE, 0, 0, -75, NULL), GEO_OPEN_NODE(), - GEO_ANIMATED_PART(1, 0, 0, 0, NULL), + GEO_ANIMATED_PART(LAYER_OPAQUE, 0, 0, 0, NULL), GEO_OPEN_NODE(), - GEO_ANIMATED_PART(1, 146, 0, 0, NULL), + GEO_ANIMATED_PART(LAYER_OPAQUE, 146, 0, 0, NULL), GEO_OPEN_NODE(), - GEO_ANIMATED_PART(1, 0, 0, 0, chilly_chief_seg6_dl_06002BC8), + GEO_ANIMATED_PART(LAYER_OPAQUE, 0, 0, 0, chilly_chief_seg6_dl_06002BC8), GEO_CLOSE_NODE(), GEO_CLOSE_NODE(), GEO_CLOSE_NODE(), - GEO_ANIMATED_PART(1, 0, 0, 0, NULL), + GEO_ANIMATED_PART(LAYER_OPAQUE, 0, 0, 0, NULL), GEO_OPEN_NODE(), GEO_BILLBOARD(), GEO_OPEN_NODE(), GEO_DISPLAY_LIST(LAYER_ALPHA, chilly_chief_seg6_dl_06002D88), GEO_CLOSE_NODE(), GEO_CLOSE_NODE(), - GEO_ANIMATED_PART(1, 0, 0, 0, chilly_chief_seg6_dl_06002C60), - GEO_ANIMATED_PART(4, 0, 0, 0, chilly_chief_seg6_dl_06003010), + GEO_ANIMATED_PART(LAYER_OPAQUE, 0, 0, 0, chilly_chief_seg6_dl_06002C60), + GEO_ANIMATED_PART(LAYER_ALPHA, 0, 0, 0, chilly_chief_seg6_dl_06003010), GEO_CLOSE_NODE(), GEO_CLOSE_NODE(), GEO_CLOSE_NODE(), @@ -51,39 +51,39 @@ const GeoLayout chilly_chief_big_geo[] = { GEO_OPEN_NODE(), GEO_SCALE(0, 0xE666), GEO_OPEN_NODE(), - GEO_ANIMATED_PART(1, 0, 0, 0, NULL), + GEO_ANIMATED_PART(LAYER_OPAQUE, 0, 0, 0, NULL), GEO_OPEN_NODE(), - GEO_ANIMATED_PART(1, 0, 0, 0, NULL), + GEO_ANIMATED_PART(LAYER_OPAQUE, 0, 0, 0, NULL), GEO_OPEN_NODE(), - GEO_ANIMATED_PART(1, 0, 0, 75, NULL), + GEO_ANIMATED_PART(LAYER_OPAQUE, 0, 0, 75, NULL), GEO_OPEN_NODE(), - GEO_ANIMATED_PART(1, 0, 0, 0, NULL), + GEO_ANIMATED_PART(LAYER_OPAQUE, 0, 0, 0, NULL), GEO_OPEN_NODE(), - GEO_ANIMATED_PART(1, 146, 0, 0, NULL), + GEO_ANIMATED_PART(LAYER_OPAQUE, 146, 0, 0, NULL), GEO_OPEN_NODE(), - GEO_ANIMATED_PART(1, 0, 0, 0, chilly_chief_seg6_dl_06002B30), + GEO_ANIMATED_PART(LAYER_OPAQUE, 0, 0, 0, chilly_chief_seg6_dl_06002B30), GEO_CLOSE_NODE(), GEO_CLOSE_NODE(), GEO_CLOSE_NODE(), - GEO_ANIMATED_PART(1, 0, 0, -75, NULL), + GEO_ANIMATED_PART(LAYER_OPAQUE, 0, 0, -75, NULL), GEO_OPEN_NODE(), - GEO_ANIMATED_PART(1, 0, 0, 0, NULL), + GEO_ANIMATED_PART(LAYER_OPAQUE, 0, 0, 0, NULL), GEO_OPEN_NODE(), - GEO_ANIMATED_PART(1, 146, 0, 0, NULL), + GEO_ANIMATED_PART(LAYER_OPAQUE, 146, 0, 0, NULL), GEO_OPEN_NODE(), - GEO_ANIMATED_PART(1, 0, 0, 0, chilly_chief_seg6_dl_06002BC8), + GEO_ANIMATED_PART(LAYER_OPAQUE, 0, 0, 0, chilly_chief_seg6_dl_06002BC8), GEO_CLOSE_NODE(), GEO_CLOSE_NODE(), GEO_CLOSE_NODE(), - GEO_ANIMATED_PART(1, 0, 0, 0, NULL), + GEO_ANIMATED_PART(LAYER_OPAQUE, 0, 0, 0, NULL), GEO_OPEN_NODE(), GEO_BILLBOARD(), GEO_OPEN_NODE(), GEO_DISPLAY_LIST(LAYER_ALPHA, chilly_chief_seg6_dl_06002EF0), GEO_CLOSE_NODE(), GEO_CLOSE_NODE(), - GEO_ANIMATED_PART(1, 0, 0, 0, chilly_chief_seg6_dl_06002C60), - GEO_ANIMATED_PART(4, 0, 0, 0, chilly_chief_seg6_dl_06003010), + GEO_ANIMATED_PART(LAYER_OPAQUE, 0, 0, 0, chilly_chief_seg6_dl_06002C60), + GEO_ANIMATED_PART(LAYER_ALPHA, 0, 0, 0, chilly_chief_seg6_dl_06003010), GEO_CLOSE_NODE(), GEO_CLOSE_NODE(), GEO_CLOSE_NODE(), diff --git a/actors/group11.c b/actors/group11.c index 2dddacb5..669a72c8 100644 --- a/actors/group11.c +++ b/actors/group11.c @@ -13,7 +13,6 @@ UNUSED static const u64 binid_0 = 0; #include "wiggler_body/model.inc.c" #include "wiggler_body/anims/data.inc.c" -#include "wiggler_body/geo.inc.c" #include "wiggler_body/anims/table.inc.c" #include "wiggler_head/model.inc.c" diff --git a/actors/group11_geo.c b/actors/group11_geo.c index 5a3f296c..ae26eddc 100644 --- a/actors/group11_geo.c +++ b/actors/group11_geo.c @@ -8,6 +8,7 @@ #include "group11.h" #include "bubba/geo.inc.c" +#include "wiggler_body/geo.inc.c" #include "wiggler_head/geo.inc.c" #include "lakitu_enemy/geo.inc.c" #include "spiny_egg/geo.inc.c" diff --git a/actors/group16.c b/actors/group16.c index 5435ac0f..50338e05 100644 --- a/actors/group16.c +++ b/actors/group16.c @@ -10,7 +10,6 @@ #include "chillychief/model.inc.c" #include "chillychief/anims/data.inc.c" -#include "chillychief/geo.inc.c" #include "chillychief/anims/table.inc.c" UNUSED static const u64 binid_0 = 0; diff --git a/actors/group16_geo.c b/actors/group16_geo.c index ab80df19..114eb979 100644 --- a/actors/group16_geo.c +++ b/actors/group16_geo.c @@ -7,4 +7,5 @@ #include "common1.h" #include "group16.h" +#include "chillychief/geo.inc.c" #include "moneybag/geo.inc.c" diff --git a/actors/group4.c b/actors/group4.c index 080a026d..d9a0e4ee 100644 --- a/actors/group4.c +++ b/actors/group4.c @@ -14,7 +14,6 @@ UNUSED static const u64 binid_0 = 0; #include "manta/model.inc.c" #include "manta/anims/data.inc.c" -#include "manta/geo.inc.c" #include "manta/anims/table.inc.c" UNUSED static const u64 binid_1 = 1; diff --git a/actors/group4_geo.c b/actors/group4_geo.c index 6e93672f..c922414b 100644 --- a/actors/group4_geo.c +++ b/actors/group4_geo.c @@ -8,5 +8,6 @@ #include "group4.h" #include "clam_shell/geo.inc.c" +#include "manta/geo.inc.c" #include "sushi/geo.inc.c" #include "unagi/geo.inc.c" diff --git a/actors/manta/geo.inc.c b/actors/manta/geo.inc.c index d60ce675..4c669e7d 100644 --- a/actors/manta/geo.inc.c +++ b/actors/manta/geo.inc.c @@ -2,56 +2,56 @@ const GeoLayout manta_seg5_geo_05008D14[] = { GEO_SCALE(0, 16384), GEO_OPEN_NODE(), - GEO_ANIMATED_PART(1, 0, 0, 0, NULL), + GEO_ANIMATED_PART(LAYER_OPAQUE, 0, 0, 0, NULL), GEO_OPEN_NODE(), - GEO_ANIMATED_PART(1, 0, 0, 0, manta_seg5_dl_05006750), + GEO_ANIMATED_PART(LAYER_OPAQUE, 0, 0, 0, manta_seg5_dl_05006750), GEO_OPEN_NODE(), - GEO_ANIMATED_PART(1, 440, 220, 6, NULL), + GEO_ANIMATED_PART(LAYER_OPAQUE, 440, 220, 6, NULL), GEO_OPEN_NODE(), - GEO_ANIMATED_PART(1, 0, 0, 0, manta_seg5_dl_05005358), + GEO_ANIMATED_PART(LAYER_OPAQUE, 0, 0, 0, manta_seg5_dl_05005358), GEO_OPEN_NODE(), - GEO_ANIMATED_PART(1, 220, 0, 0, manta_seg5_dl_050055A8), + GEO_ANIMATED_PART(LAYER_OPAQUE, 220, 0, 0, manta_seg5_dl_050055A8), GEO_OPEN_NODE(), - GEO_ANIMATED_PART(1, 180, 0, 0, manta_seg5_dl_05005768), + GEO_ANIMATED_PART(LAYER_OPAQUE, 180, 0, 0, manta_seg5_dl_05005768), GEO_CLOSE_NODE(), GEO_CLOSE_NODE(), GEO_CLOSE_NODE(), - GEO_ANIMATED_PART(1, 440, -220, 6, NULL), + GEO_ANIMATED_PART(LAYER_OPAQUE, 440, -220, 6, NULL), GEO_OPEN_NODE(), - GEO_ANIMATED_PART(1, 0, 0, 0, manta_seg5_dl_05005C38), + GEO_ANIMATED_PART(LAYER_OPAQUE, 0, 0, 0, manta_seg5_dl_05005C38), GEO_OPEN_NODE(), - GEO_ANIMATED_PART(1, 220, 0, 0, manta_seg5_dl_05005E88), + GEO_ANIMATED_PART(LAYER_OPAQUE, 220, 0, 0, manta_seg5_dl_05005E88), GEO_OPEN_NODE(), - GEO_ANIMATED_PART(1, 180, 0, 0, manta_seg5_dl_05006048), + GEO_ANIMATED_PART(LAYER_OPAQUE, 180, 0, 0, manta_seg5_dl_05006048), GEO_CLOSE_NODE(), GEO_CLOSE_NODE(), GEO_CLOSE_NODE(), - GEO_ANIMATED_PART(1, 0, 0, 0, NULL), + GEO_ANIMATED_PART(LAYER_OPAQUE, 0, 0, 0, NULL), GEO_OPEN_NODE(), - GEO_ANIMATED_PART(1, 0, 0, 0, manta_seg5_dl_05006C08), + GEO_ANIMATED_PART(LAYER_OPAQUE, 0, 0, 0, manta_seg5_dl_05006C08), GEO_OPEN_NODE(), - GEO_ANIMATED_PART(1, 168, 0, 0, manta_seg5_dl_05006B70), + GEO_ANIMATED_PART(LAYER_OPAQUE, 168, 0, 0, manta_seg5_dl_05006B70), GEO_OPEN_NODE(), - GEO_ANIMATED_PART(1, 236, 0, 0, manta_seg5_dl_05006B08), - GEO_ANIMATED_PART(1, 236, 0, 0, manta_seg5_dl_05004E90), + GEO_ANIMATED_PART(LAYER_OPAQUE, 236, 0, 0, manta_seg5_dl_05006B08), + GEO_ANIMATED_PART(LAYER_OPAQUE, 236, 0, 0, manta_seg5_dl_05004E90), GEO_CLOSE_NODE(), GEO_CLOSE_NODE(), GEO_CLOSE_NODE(), - GEO_ANIMATED_PART(1, 688, 120, -6, NULL), + GEO_ANIMATED_PART(LAYER_OPAQUE, 688, 120, -6, NULL), GEO_OPEN_NODE(), - GEO_ANIMATED_PART(1, 0, 0, 0, manta_seg5_dl_05005038), + GEO_ANIMATED_PART(LAYER_OPAQUE, 0, 0, 0, manta_seg5_dl_05005038), GEO_CLOSE_NODE(), - GEO_ANIMATED_PART(1, 668, 170, 6, NULL), + GEO_ANIMATED_PART(LAYER_OPAQUE, 668, 170, 6, NULL), GEO_OPEN_NODE(), - GEO_ANIMATED_PART(1, 0, 0, 0, manta_seg5_dl_05004DB8), + GEO_ANIMATED_PART(LAYER_OPAQUE, 0, 0, 0, manta_seg5_dl_05004DB8), GEO_CLOSE_NODE(), - GEO_ANIMATED_PART(1, 688, -120, -6, NULL), + GEO_ANIMATED_PART(LAYER_OPAQUE, 688, -120, -6, NULL), GEO_OPEN_NODE(), - GEO_ANIMATED_PART(1, 0, 0, 0, manta_seg5_dl_05005918), + GEO_ANIMATED_PART(LAYER_OPAQUE, 0, 0, 0, manta_seg5_dl_05005918), GEO_CLOSE_NODE(), - GEO_ANIMATED_PART(1, 668, -170, 6, NULL), + GEO_ANIMATED_PART(LAYER_OPAQUE, 668, -170, 6, NULL), GEO_OPEN_NODE(), - GEO_ANIMATED_PART(1, 0, 0, 0, manta_seg5_dl_05004A70), + GEO_ANIMATED_PART(LAYER_OPAQUE, 0, 0, 0, manta_seg5_dl_05004A70), GEO_CLOSE_NODE(), GEO_CLOSE_NODE(), GEO_CLOSE_NODE(), diff --git a/actors/wiggler_body/geo.inc.c b/actors/wiggler_body/geo.inc.c index a55a1f93..38568c74 100644 --- a/actors/wiggler_body/geo.inc.c +++ b/actors/wiggler_body/geo.inc.c @@ -4,9 +4,9 @@ const GeoLayout wiggler_body_geo[] = { GEO_OPEN_NODE(), GEO_SCALE(0, 16384), GEO_OPEN_NODE(), - GEO_ANIMATED_PART(1, 0, 0, 0, NULL), + GEO_ANIMATED_PART(LAYER_OPAQUE, 0, 0, 0, NULL), GEO_OPEN_NODE(), - GEO_ANIMATED_PART(1, 0, 0, 0, NULL), + GEO_ANIMATED_PART(LAYER_OPAQUE, 0, 0, 0, NULL), GEO_OPEN_NODE(), GEO_BILLBOARD(), GEO_OPEN_NODE(), @@ -14,23 +14,23 @@ const GeoLayout wiggler_body_geo[] = { GEO_CLOSE_NODE(), GEO_CLOSE_NODE(), GEO_OPEN_NODE(), - GEO_ANIMATED_PART(1, -31, 0, 51, NULL), + GEO_ANIMATED_PART(LAYER_OPAQUE, -31, 0, 51, NULL), GEO_OPEN_NODE(), - GEO_ANIMATED_PART(1, 0, 0, 0, wiggler_seg5_dl_0500BE98), + GEO_ANIMATED_PART(LAYER_OPAQUE, 0, 0, 0, wiggler_seg5_dl_0500BE98), GEO_OPEN_NODE(), - GEO_ANIMATED_PART(1, 39, 0, 0, wiggler_seg5_dl_0500BE10), + GEO_ANIMATED_PART(LAYER_OPAQUE, 39, 0, 0, wiggler_seg5_dl_0500BE10), GEO_OPEN_NODE(), - GEO_ANIMATED_PART(1, 41, 0, 0, wiggler_seg5_dl_0500BCB8), + GEO_ANIMATED_PART(LAYER_OPAQUE, 41, 0, 0, wiggler_seg5_dl_0500BCB8), GEO_CLOSE_NODE(), GEO_CLOSE_NODE(), GEO_CLOSE_NODE(), - GEO_ANIMATED_PART(1, -31, 0, -49, NULL), + GEO_ANIMATED_PART(LAYER_OPAQUE, -31, 0, -49, NULL), GEO_OPEN_NODE(), - GEO_ANIMATED_PART(1, 0, 0, 0, wiggler_seg5_dl_0500C100), + GEO_ANIMATED_PART(LAYER_OPAQUE, 0, 0, 0, wiggler_seg5_dl_0500C100), GEO_OPEN_NODE(), - GEO_ANIMATED_PART(1, 39, 0, 0, wiggler_seg5_dl_0500C078), + GEO_ANIMATED_PART(LAYER_OPAQUE, 39, 0, 0, wiggler_seg5_dl_0500C078), GEO_OPEN_NODE(), - GEO_ANIMATED_PART(1, 41, 0, 0, wiggler_seg5_dl_0500BF20), + GEO_ANIMATED_PART(LAYER_OPAQUE, 41, 0, 0, wiggler_seg5_dl_0500BF20), GEO_CLOSE_NODE(), GEO_CLOSE_NODE(), GEO_CLOSE_NODE(), diff --git a/bin/segment2.c b/bin/segment2.c index 20ffa240..0e0fdbd9 100644 --- a/bin/segment2.c +++ b/bin/segment2.c @@ -86,11 +86,9 @@ ALIGNED8 static const Texture texture_hud_char_I[] = { #include "textures/segment2/segment2.02400.rgba16.inc.c" }; -#if defined(VERSION_JP) || defined(VERSION_SH) ALIGNED8 static const Texture texture_hud_char_J[] = { #include "textures/segment2/segment2.02600.rgba16.inc.c" }; -#endif ALIGNED8 static const Texture texture_hud_char_K[] = { #include "textures/segment2/segment2.02800.rgba16.inc.c" @@ -116,11 +114,9 @@ ALIGNED8 static const Texture texture_hud_char_P[] = { #include "textures/segment2/segment2.03200.rgba16.inc.c" }; -#if defined(VERSION_JP) || defined(VERSION_SH) ALIGNED8 static const Texture texture_hud_char_Q[] = { #include "textures/segment2/segment2.03400.rgba16.inc.c" }; -#endif ALIGNED8 static const Texture texture_hud_char_R[] = { #include "textures/segment2/segment2.03600.rgba16.inc.c" @@ -138,31 +134,25 @@ ALIGNED8 static const Texture texture_hud_char_U[] = { #include "textures/segment2/segment2.03C00.rgba16.inc.c" }; -#if defined(VERSION_JP) || defined(VERSION_EU) || defined(VERSION_SH) ALIGNED8 static const Texture texture_hud_char_V[] = { #include "textures/segment2/segment2.03E00.rgba16.inc.c" }; -#endif ALIGNED8 static const Texture texture_hud_char_W[] = { #include "textures/segment2/segment2.04000.rgba16.inc.c" }; -#if defined(VERSION_JP) || defined(VERSION_SH) ALIGNED8 static const Texture texture_hud_char_X[] = { #include "textures/segment2/segment2.04200.rgba16.inc.c" }; -#endif ALIGNED8 static const Texture texture_hud_char_Y[] = { #include "textures/segment2/segment2.04400.rgba16.inc.c" }; -#if defined(VERSION_JP) || defined(VERSION_EU) || defined(VERSION_SH) ALIGNED8 static const Texture texture_hud_char_Z[] = { #include "textures/segment2/segment2.04600.rgba16.inc.c" }; -#endif ALIGNED8 static const Texture texture_hud_char_apostrophe[] = { #include "textures/segment2/segment2.04800.rgba16.inc.c" @@ -178,7 +168,6 @@ ALIGNED8 static const Texture texture_hud_char_umlaut[] = { }; #endif -#if defined(VERSION_JP) || defined(VERSION_SH) ALIGNED8 static const Texture texture_hud_char_exclamation[] = { #include "textures/segment2/segment2.04C00.rgba16.inc.c"// JP ! }; @@ -198,7 +187,6 @@ ALIGNED8 static const Texture texture_hud_char_ampersand[] = { ALIGNED8 static const Texture texture_hud_char_percent[] = { #include "textures/segment2/segment2.05400.rgba16.inc.c"// JP % }; -#endif ALIGNED8 static const Texture texture_hud_char_multiply[] = { #include "textures/segment2/segment2.05600.rgba16.inc.c" @@ -216,11 +204,9 @@ ALIGNED8 static const Texture texture_hud_char_star[] = { #include "textures/segment2/segment2.05C00.rgba16.inc.c" }; -#if defined(VERSION_JP) || defined(VERSION_SH) ALIGNED8 static const Texture texture_hud_char_decimal_point[] = { #include "textures/segment2/segment2.05E00.rgba16.inc.c" }; -#endif #if defined(VERSION_JP) || defined(VERSION_SH) ALIGNED8 static const Texture texture_hud_char_beta_key[] = { @@ -1827,16 +1813,16 @@ const Texture *const main_hud_lut[] = { texture_hud_char_4, texture_hud_char_5, texture_hud_char_6, texture_hud_char_7, texture_hud_char_8, texture_hud_char_9, texture_hud_char_A, texture_hud_char_B, texture_hud_char_C, texture_hud_char_D, texture_hud_char_E, texture_hud_char_F, - texture_hud_char_G, texture_hud_char_H, texture_hud_char_I, 0x0, + texture_hud_char_G, texture_hud_char_H, texture_hud_char_I, texture_hud_char_J, texture_hud_char_K, texture_hud_char_L, texture_hud_char_M, texture_hud_char_N, - texture_hud_char_O, texture_hud_char_P, 0x0, texture_hud_char_R, - texture_hud_char_S, texture_hud_char_T, texture_hud_char_U, 0x0, - texture_hud_char_W, 0x0, texture_hud_char_Y, 0x0, - 0x0, 0x0, 0x0, 0x0, - 0x0, 0x0, 0x0, 0x0, + texture_hud_char_O, texture_hud_char_P, texture_hud_char_Q, texture_hud_char_R, + texture_hud_char_S, texture_hud_char_T, texture_hud_char_U, texture_hud_char_V, + texture_hud_char_W, texture_hud_char_X, texture_hud_char_Y, texture_hud_char_Z, + texture_hud_char_exclamation, texture_hud_char_double_exclamation, texture_hud_char_question, texture_hud_char_ampersand, + texture_hud_char_percent, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, texture_hud_char_multiply, texture_hud_char_coin, - texture_hud_char_mario_head, texture_hud_char_star, 0x0, 0x0, + texture_hud_char_mario_head, texture_hud_char_star, texture_hud_char_decimal_point, 0x0, texture_hud_char_apostrophe, texture_hud_char_double_quote, #else texture_hud_char_0, texture_hud_char_1, texture_hud_char_2, texture_hud_char_3, diff --git a/data/behavior_data.c b/data/behavior_data.c index 72ca4b8f..584b4402 100644 --- a/data/behavior_data.c +++ b/data/behavior_data.c @@ -3507,7 +3507,7 @@ UNUSED static const u64 behavior_data_unused_0 = 0; const BehaviorScript bhvMario[] = { BEGIN(OBJ_LIST_PLAYER), SET_INT(oIntangibleTimer, 0), - OR_INT(oFlags, OBJ_FLAG_0100), + OR_INT(oFlags, OBJ_FLAG_PLAYER), OR_INT(oUnk94, 0x0001), SET_HITBOX(/*Radius*/ 37, /*Height*/ 160), BEGIN_LOOP(), @@ -3631,7 +3631,7 @@ const BehaviorScript bhvMenuButton[] = { const BehaviorScript bhvMenuButtonManager[] = { BEGIN(OBJ_LIST_LEVEL), - OR_INT(oFlags, (OBJ_FLAG_SET_THROW_MATRIX_FROM_TRANSFORM | OBJ_FLAG_0020 | OBJ_FLAG_UPDATE_GFX_POS_AND_ANGLE)), + OR_INT(oFlags, (OBJ_FLAG_SET_THROW_MATRIX_FROM_TRANSFORM | OBJ_FLAG_UPDATE_TRANSFORM_FOR_THROW_MATRIX | OBJ_FLAG_UPDATE_GFX_POS_AND_ANGLE)), CALL_NATIVE(bhv_menu_button_manager_init), BEGIN_LOOP(), SET_INT(oIntangibleTimer, 0), @@ -4828,7 +4828,7 @@ const BehaviorScript bhvHidden1upInPoleSpawner[] = { const BehaviorScript bhvControllablePlatform[] = { BEGIN(OBJ_LIST_SURFACE), - OR_INT(oFlags, (OBJ_FLAG_SET_THROW_MATRIX_FROM_TRANSFORM | OBJ_FLAG_0020 | OBJ_FLAG_UPDATE_GFX_POS_AND_ANGLE)), + OR_INT(oFlags, (OBJ_FLAG_SET_THROW_MATRIX_FROM_TRANSFORM | OBJ_FLAG_UPDATE_TRANSFORM_FOR_THROW_MATRIX | OBJ_FLAG_UPDATE_GFX_POS_AND_ANGLE)), LOAD_COLLISION_DATA(hmc_seg7_collision_controllable_platform), SET_HOME(), CALL_NATIVE(bhv_controllable_platform_init), diff --git a/enhancements/reonucam3.patch b/enhancements/reonucam3.patch index d99eb14f..35b36221 100644 --- a/enhancements/reonucam3.patch +++ b/enhancements/reonucam3.patch @@ -1,9 +1,9 @@ diff --git a/include/text_strings.h.in b/include/text_strings.h.in -index d266058..4b12426 100644 +index 8ccc6b1..d2bb516 100644 --- a/include/text_strings.h.in +++ b/include/text_strings.h.in -@@ -34,6 +34,12 @@ - #define TEXT_HUD_WIDE_INFO2 _("STRETCH THE IMAGE TO 16:9") +@@ -33,6 +33,12 @@ + #define TEXT_HUD_WIDE_INFO _("PLEASE CONFIGURE YOUR DISPLAY OR YOUR EMULATOR TO\nSTRETCH THE IMAGE TO 16:9") #endif +#define TEXT_CAM_INFO_SLOWEST _("CAM SPEED: SLOWEST") @@ -302,13 +302,13 @@ index dfcf16a..e56f8c0 100644 } } diff --git a/src/game/game_init.c b/src/game/game_init.c -index 6cfa8f5..63158e1 100644 +index 8693507..fb8729d 100644 --- a/src/game/game_init.c +++ b/src/game/game_init.c -@@ -46,6 +46,11 @@ OSContPad gControllerPads[4]; - u8 gControllerBits; - u8 gIsConsole; - u8 gBorderHeight; +@@ -49,6 +49,11 @@ u8 gBorderHeight; + #ifdef CUSTOM_DEBUG + u8 gCustomDebugMode; + #endif +u8 gCameraSpeed = 2; +u8 gWaterCamOverride; +u8 gFlyingCamOverride; @@ -317,7 +317,7 @@ index 6cfa8f5..63158e1 100644 #ifdef EEP s8 gEepromProbe; #endif -@@ -715,6 +720,7 @@ void thread5_game_loop(UNUSED void *arg) { +@@ -725,6 +730,7 @@ void thread5_game_loop(UNUSED void *arg) { play_music(SEQ_PLAYER_SFX, SEQUENCE_ARGS(0, SEQ_SOUND_PLAYER), 0); set_sound_mode(save_file_get_sound_mode()); @@ -326,7 +326,7 @@ index 6cfa8f5..63158e1 100644 gWidescreen = save_file_get_widescreen_mode(); #endif diff --git a/src/game/game_init.h b/src/game/game_init.h -index 87386ce..47e9724 100644 +index f3f650c..fdf20b6 100644 --- a/src/game/game_init.h +++ b/src/game/game_init.h @@ -45,6 +45,10 @@ extern u8 gIsConsole; @@ -338,14 +338,14 @@ index 87386ce..47e9724 100644 +extern u8 gFlyingCamOverride; +extern u8 gKeepCliffCam; extern u8 gBorderHeight; - #ifdef EEP - extern s8 gEepromProbe; + #ifdef CUSTOM_DEBUG + extern u8 gCustomDebugMode; diff --git a/src/game/ingame_menu.c b/src/game/ingame_menu.c -index 9cd458a..ac2d18c 100644 +index 158154c..9ffefec 100644 --- a/src/game/ingame_menu.c +++ b/src/game/ingame_menu.c -@@ -39,6 +39,12 @@ u8 textWideInfo[] = { TEXT_HUD_WIDE_INFO }; - u8 textWideInfo2[] = { TEXT_HUD_WIDE_INFO2 }; +@@ -38,6 +38,12 @@ u8 textPressL[] = { TEXT_HUD_PRESS_L }; + u8 textWideInfo[] = { TEXT_HUD_WIDE_INFO }; #endif +u8 textCamInfoSlowest[] = { TEXT_CAM_INFO_SLOWEST }; @@ -357,7 +357,7 @@ index 9cd458a..ac2d18c 100644 extern u8 gLastCompletedCourseNum; extern u8 gLastCompletedStarNum; -@@ -1350,6 +1356,45 @@ void reset_red_coins_collected(void) { +@@ -1434,6 +1440,45 @@ void reset_red_coins_collected(void) { gRedCoinsCollected = 0; } @@ -403,19 +403,23 @@ index 9cd458a..ac2d18c 100644 void change_dialog_camera_angle(void) { if (cam_select_alt_mode(0) == CAM_SELECTION_MARIO) { gDialogCameraAngleIndex = CAM_SELECTION_MARIO; -@@ -1779,6 +1824,7 @@ s16 render_pause_courses_and_castle(void) { +@@ -1866,6 +1911,11 @@ s16 render_pause_courses_and_castle(void) { } #ifdef WIDE render_widescreen_setting(); + render_camera_speed_setting(); - if (gPlayer1Controller->buttonPressed & L_TRIG){ - gWidescreen ^= 1; - save_file_set_widescreen_mode(gWidescreen); ++ if (gPlayer1Controller->buttonPressed & L_TRIG){ ++ gWidescreen ^= 1; ++ save_file_set_widescreen_mode(gWidescreen); ++ } + #endif + if (gDialogTextAlpha < 250) { + gDialogTextAlpha += 25; diff --git a/src/game/mario.c b/src/game/mario.c -index b381afa..7cb9549 100644 +index c0b5f76..b6da9d4 100644 --- a/src/game/mario.c +++ b/src/game/mario.c -@@ -1443,32 +1443,39 @@ void update_mario_inputs(struct MarioState *m) { +@@ -1460,32 +1460,39 @@ void update_mario_inputs(struct MarioState *m) { void set_submerged_cam_preset_and_spawn_bubbles(struct MarioState *m) { f32 heightBelowWater; s16 camPreset; @@ -550,7 +554,7 @@ index b27d869..7fbf045 100644 if (save_file_get_flags() & SAVE_FLAG_CAP_ON_GROUND) { switch (gSaveBuffer.files[gCurrSaveFileNum - 1][0].capLevel) { diff --git a/src/game/save_file.h b/src/game/save_file.h -index 00fc042..7062ead 100644 +index 3ac0c4d..d46a7e1 100644 --- a/src/game/save_file.h +++ b/src/game/save_file.h @@ -62,6 +62,7 @@ struct MainMenuSaveData @@ -560,7 +564,7 @@ index 00fc042..7062ead 100644 + u8 cameraSpeedSetting: 3; #ifdef VERSION_EU - u16 language; + u8 language: 2; @@ -167,6 +168,8 @@ u16 save_file_get_sound_mode(void); u8 save_file_get_widescreen_mode(void); void save_file_set_widescreen_mode(u8 mode); diff --git a/gziprules.mk b/gziprules.mk index d7c2fb7d..8f0be75c 100644 --- a/gziprules.mk +++ b/gziprules.mk @@ -10,7 +10,7 @@ endif # Strip gzip header $(BUILD_DIR)/%.szp: $(BUILD_DIR)/%.gz $(call print,Converting:,$<,$@) - $(V)dd bs=10 skip=1 if=$< of=$(<:.gz=.gz.strip) + $(V)dd bs=10 skip=1 if=$< of=$(<:.gz=.gz.strip) status=none $(V)$(FILESIZER) $(<:.gz=.gz.strip) $@ `stat --format="%s" $(<:.gz=.bin)` # convert binary szp to object file diff --git a/include/config.h b/include/config.h index c9002a94..2ca41605 100644 --- a/include/config.h +++ b/include/config.h @@ -84,8 +84,8 @@ //#define NO_FALL_DAMAGE_SOUND // 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 -// Platform displacement 2 also known as momentum patch. Makes Mario keep the momemtum from moving platforms. Breaks treadmills. -//#define PLATFORM_DISPLACEMENT_2 +// Platform displacement 2 also known as momentum patch. Makes Mario keep the momemtum from moving platforms. Doesn't break treadmills anymore! +#define PLATFORM_DISPLACEMENT_2 // Stars don't kick you out of the level // #define NON_STOP_STARS // Uncomment this if you want global star IDs (useful for creating an open world hack ala MVC) @@ -109,6 +109,8 @@ #define EXPAND_AUDIO_HEAP // Allow all surfaces types to have force, (doesn't require setting force, just allows it to be optional). #define ALL_SURFACES_HAVE_FORCE +// Custom debug mode. Press DPAD left to show the debug UI. Press DPAD right to enter the noclip mode. +//#define CUSTOM_DEBUG // BUG/GAME QOL FIXES // Fix instant warp offset not working when warping across different areas diff --git a/include/object_constants.h b/include/object_constants.h index 76664b23..807ef5e9 100644 --- a/include/object_constants.h +++ b/include/object_constants.h @@ -28,23 +28,23 @@ #define RESPAWN_INFO_DONT_RESPAWN 0xFF /* oFlags */ -#define OBJ_FLAG_UPDATE_GFX_POS_AND_ANGLE (1 << 0) // 0x00000001 -#define OBJ_FLAG_MOVE_XZ_USING_FVEL (1 << 1) // 0x00000002 -#define OBJ_FLAG_MOVE_Y_WITH_TERMINAL_VEL (1 << 2) // 0x00000004 -#define OBJ_FLAG_SET_FACE_YAW_TO_MOVE_YAW (1 << 3) // 0x00000008 -#define OBJ_FLAG_SET_FACE_ANGLE_TO_MOVE_ANGLE (1 << 4) // 0x00000010 -#define OBJ_FLAG_0020 (1 << 5) // 0x00000020 -#define OBJ_FLAG_COMPUTE_DIST_TO_MARIO (1 << 6) // 0x00000040 -#define OBJ_FLAG_ACTIVE_FROM_AFAR (1 << 7) // 0x00000080 -#define OBJ_FLAG_0100 (1 << 8) // 0x00000100 -#define OBJ_FLAG_TRANSFORM_RELATIVE_TO_PARENT (1 << 9) // 0x00000200 -#define OBJ_FLAG_HOLDABLE (1 << 10) // 0x00000400 -#define OBJ_FLAG_SET_THROW_MATRIX_FROM_TRANSFORM (1 << 11) // 0x00000800 -#define OBJ_FLAG_1000 (1 << 12) // 0x00001000 -#define OBJ_FLAG_COMPUTE_ANGLE_TO_MARIO (1 << 13) // 0x00002000 -#define OBJ_FLAG_PERSISTENT_RESPAWN (1 << 14) // 0x00004000 -#define OBJ_FLAG_8000 (1 << 15) // 0x00008000 -#define OBJ_FLAG_30 (1 << 30) // 0x40000000 +#define OBJ_FLAG_UPDATE_GFX_POS_AND_ANGLE (1 << 0) // 0x00000001 +#define OBJ_FLAG_MOVE_XZ_USING_FVEL (1 << 1) // 0x00000002 +#define OBJ_FLAG_MOVE_Y_WITH_TERMINAL_VEL (1 << 2) // 0x00000004 +#define OBJ_FLAG_SET_FACE_YAW_TO_MOVE_YAW (1 << 3) // 0x00000008 +#define OBJ_FLAG_SET_FACE_ANGLE_TO_MOVE_ANGLE (1 << 4) // 0x00000010 +#define OBJ_FLAG_UPDATE_TRANSFORM_FOR_THROW_MATRIX (1 << 5) // 0x00000020 +#define OBJ_FLAG_COMPUTE_DIST_TO_MARIO (1 << 6) // 0x00000040 +#define OBJ_FLAG_ACTIVE_FROM_AFAR (1 << 7) // 0x00000080 +#define OBJ_FLAG_PLAYER (1 << 8) // 0x00000100 +#define OBJ_FLAG_TRANSFORM_RELATIVE_TO_PARENT (1 << 9) // 0x00000200 +#define OBJ_FLAG_HOLDABLE (1 << 10) // 0x00000400 +#define OBJ_FLAG_SET_THROW_MATRIX_FROM_TRANSFORM (1 << 11) // 0x00000800 +#define OBJ_FLAG_1000 (1 << 12) // 0x00001000 +#define OBJ_FLAG_COMPUTE_ANGLE_TO_MARIO (1 << 13) // 0x00002000 +#define OBJ_FLAG_PERSISTENT_RESPAWN (1 << 14) // 0x00004000 +#define OBJ_FLAG_8000 (1 << 15) // 0x00008000 +#define OBJ_FLAG_HITBOX_WAS_SET (1 << 30) // 0x40000000 /* oHeldState */ #define HELD_FREE 0 diff --git a/src/engine/graph_node.h b/src/engine/graph_node.h index c8d48f89..89276f59 100644 --- a/src/engine/graph_node.h +++ b/src/engine/graph_node.h @@ -17,9 +17,6 @@ // Whether the node type has a function pointer of type GraphNodeFunc #define GRAPH_NODE_TYPE_FUNCTIONAL 0x100 -// Type used for Bowser and an unused geo function in obj_behaviors.c -#define GRAPH_NODE_TYPE_400 0x400 - // The discriminant for different types of geo nodes #define GRAPH_NODE_TYPE_ROOT 0x001 #define GRAPH_NODE_TYPE_ORTHO_PROJECTION 0x002 diff --git a/src/game/behaviors/bobomb.inc.c b/src/game/behaviors/bobomb.inc.c index 1f6124e4..34eef764 100644 --- a/src/game/behaviors/bobomb.inc.c +++ b/src/game/behaviors/bobomb.inc.c @@ -98,8 +98,7 @@ void bobomb_act_chase_mario(void) { } void bobomb_act_launched(void) { - s16 collisionFlags = 0; - collisionFlags = object_step(); + s16 collisionFlags = object_step(); if ((collisionFlags & OBJ_COL_FLAG_GROUNDED) == OBJ_COL_FLAG_GROUNDED) o->oAction = BOBOMB_ACT_EXPLODE; /* bit 0 */ } @@ -203,7 +202,7 @@ void bobomb_thrown_loop(void) { o->header.gfx.node.flags &= ~GRAPH_RENDER_INVISIBLE; o->oHeldState = 0; - o->oFlags &= ~0x8; /* bit 3 */ + o->oFlags &= ~OBJ_FLAG_SET_FACE_YAW_TO_MOVE_YAW; /* bit 3 */ o->oForwardVel = 25.0; o->oVelY = 20.0; o->oAction = BOBOMB_ACT_LAUNCHED; diff --git a/src/game/behaviors/boulder.inc.c b/src/game/behaviors/boulder.inc.c index 18bd53fb..42e03cfb 100644 --- a/src/game/behaviors/boulder.inc.c +++ b/src/game/behaviors/boulder.inc.c @@ -11,10 +11,8 @@ void bhv_big_boulder_init(void) { } void boulder_act_1(void) { - s16 sp1E; - - sp1E = object_step_without_floor_orient(); - if ((sp1E & 0x09) == 0x01 && o->oVelY > 10.0f) { + s16 collisionFlags = object_step_without_floor_orient(); + if ((collisionFlags & OBJ_COL_FLAGS_LANDED) == OBJ_COL_FLAG_GROUNDED && o->oVelY > 10.0f) { cur_obj_play_sound_2(SOUND_GENERAL_GRINDEL_ROLL); spawn_mist_particles(); } diff --git a/src/game/behaviors/breakable_box_small.inc.c b/src/game/behaviors/breakable_box_small.inc.c index fe962bf0..e2ecc8c6 100644 --- a/src/game/behaviors/breakable_box_small.inc.c +++ b/src/game/behaviors/breakable_box_small.inc.c @@ -29,19 +29,19 @@ void small_breakable_box_spawn_dust(void) { } void small_breakable_box_act_move(void) { - s16 sp1E = object_step(); + s16 collisionFlags = object_step(); obj_attack_collided_from_other_object(o); - if (sp1E == 1) + if (collisionFlags == OBJ_COL_FLAG_GROUNDED) cur_obj_play_sound_2(SOUND_GENERAL_BOX_LANDING_2); - if (sp1E & 1) { + if (collisionFlags & OBJ_COL_FLAG_GROUNDED) { if (o->oForwardVel > 20.0f) { cur_obj_play_sound_2(SOUND_ENV_SLIDING); small_breakable_box_spawn_dust(); } } - if (sp1E & 2) { + if (collisionFlags & OBJ_COL_FLAG_HIT_WALL) { spawn_mist_particles(); spawn_triangle_break_particles(20, MODEL_DIRT_ANIMATION, 0.7f, 3); obj_spawn_yellow_coins(o, 3); @@ -49,7 +49,7 @@ void small_breakable_box_act_move(void) { o->activeFlags = ACTIVE_FLAG_DEACTIVATED; } - obj_check_floor_death(sp1E, sObjFloor); + obj_check_floor_death(collisionFlags, sObjFloor); } void breakable_box_small_released_loop(void) { @@ -106,7 +106,7 @@ void breakable_box_small_get_thrown(void) { cur_obj_enable_rendering(); o->header.gfx.node.flags &= ~GRAPH_RENDER_INVISIBLE; o->oHeldState = 0; - o->oFlags &= ~0x08; + o->oFlags &= ~OBJ_FLAG_SET_FACE_YAW_TO_MOVE_YAW; o->oForwardVel = 40.0f; o->oVelY = 20.0f; o->oBreakableBoxSmallReleased = 1; diff --git a/src/game/behaviors/bully.inc.c b/src/game/behaviors/bully.inc.c index 21c561a7..3695a847 100644 --- a/src/game/behaviors/bully.inc.c +++ b/src/game/behaviors/bully.inc.c @@ -64,7 +64,7 @@ void bully_check_mario_collision(void) { o->oInteractStatus &= ~INT_STATUS_INTERACTED; o->oAction = BULLY_ACT_KNOCKBACK; - o->oFlags &= ~0x8; /* bit 3 */ + o->oFlags &= ~OBJ_FLAG_SET_FACE_YAW_TO_MOVE_YAW; /* bit 3 */ cur_obj_init_animation(3); o->oBullyMarioCollisionAngle = o->oMoveAngleYaw; } @@ -98,7 +98,7 @@ void bully_act_knockback(void) { if (o->oForwardVel < 10.0 && (s32) o->oVelY == 0) { o->oForwardVel = 1.0; o->oBullyKBTimerAndMinionKOCounter++; - o->oFlags |= 0x8; /* bit 3 */ + o->oFlags |= OBJ_FLAG_SET_FACE_YAW_TO_MOVE_YAW; /* bit 3 */ o->oMoveAngleYaw = o->oFaceAngleYaw; obj_turn_toward_object(o, gMarioObject, 16, 1280); } else @@ -113,7 +113,7 @@ void bully_act_knockback(void) { void bully_act_back_up(void) { if (o->oTimer == 0) { - o->oFlags &= ~0x8; /* bit 3 */ + o->oFlags &= ~OBJ_FLAG_SET_FACE_YAW_TO_MOVE_YAW; /* bit 3 */ o->oMoveAngleYaw += 0x8000; } @@ -128,13 +128,13 @@ void bully_act_back_up(void) { if (o->oTimer == 15) { o->oMoveAngleYaw = o->oFaceAngleYaw; - o->oFlags |= 0x8; /* bit 3 */ + o->oFlags |= OBJ_FLAG_SET_FACE_YAW_TO_MOVE_YAW; /* bit 3 */ o->oAction = BULLY_ACT_PATROL; } } void bully_backup_check(s16 collisionFlags) { - if (!(collisionFlags & 0x8) && o->oAction != BULLY_ACT_KNOCKBACK) /* bit 3 */ + if (!(collisionFlags & OBJ_COL_FLAG_NO_Y_VEL) && o->oAction != BULLY_ACT_KNOCKBACK) /* bit 3 */ { o->oPosX = o->oBullyPrevX; o->oPosZ = o->oBullyPrevZ; @@ -346,10 +346,10 @@ void bhv_big_bully_with_minions_loop(void) { case BULLY_ACT_ACTIVATE_AND_FALL: collisionFlags = object_step(); - if ((collisionFlags & 0x9) == 0x9) /* bits 0 and 3 */ + if ((collisionFlags & OBJ_COL_FLAGS_LANDED) == OBJ_COL_FLAGS_LANDED) /* bits 0 and 3 */ o->oAction = BULLY_ACT_PATROL; - if (collisionFlags == 1) { + if (collisionFlags == OBJ_COL_FLAG_GROUNDED) { cur_obj_play_sound_2(SOUND_OBJ_THWOMP); set_camera_shake_from_point(SHAKE_POS_SMALL, o->oPosX, o->oPosY, o->oPosZ); spawn_mist_particles(); diff --git a/src/game/behaviors/cap.inc.c b/src/game/behaviors/cap.inc.c index 066ff1fb..09e13d1a 100644 --- a/src/game/behaviors/cap.inc.c +++ b/src/game/behaviors/cap.inc.c @@ -118,11 +118,11 @@ void cap_scale_vertically(void) { } void wing_vanish_cap_act_0(void) { - s16 sp1E; + s16 collisionFlags; o->oFaceAngleYaw += o->oForwardVel * 128.0f; - sp1E = object_step(); - if (sp1E & 0x01) { + collisionFlags = object_step(); + if (collisionFlags & OBJ_COL_FLAG_GROUNDED) { cap_check_quicksand(); if (o->oVelY != 0.0f) { o->oCapUnkF4 = 1; @@ -161,11 +161,11 @@ void bhv_metal_cap_init(void) { } void metal_cap_act_0(void) { - s16 sp1E; + s16 collisionFlags; o->oFaceAngleYaw += o->oForwardVel * 128.0f; - sp1E = object_step(); - if (sp1E & 0x01) + collisionFlags = object_step(); + if (collisionFlags & OBJ_COL_FLAG_GROUNDED) cap_check_quicksand(); } @@ -220,12 +220,12 @@ void normal_cap_set_save_flags(void) { } void normal_cap_act_0(void) { - s16 sp1E; + s16 collisionFlags; o->oFaceAngleYaw += o->oForwardVel * 128.0f; o->oFaceAnglePitch += o->oForwardVel * 80.0f; - sp1E = object_step(); - if (sp1E & 0x01) { + collisionFlags = object_step(); + if (collisionFlags & OBJ_COL_FLAG_GROUNDED) { cap_check_quicksand(); if (o->oVelY != 0.0f) { diff --git a/src/game/behaviors/door.inc.c b/src/game/behaviors/door.inc.c index 695e5996..a02ee597 100644 --- a/src/game/behaviors/door.inc.c +++ b/src/game/behaviors/door.inc.c @@ -6,7 +6,7 @@ struct DoorAction s32 action; }; -static struct DoorAction sDoorActions[] = { { 0x40000, 3 }, { 0x80000, 4 }, { 0x10000, 1 }, { 0x20000, 2 }, { -1, 0 }, }; +static struct DoorAction sDoorActions[] = { { INT_STATUS_WARP_DOOR_PULLED, 3 }, { INT_STATUS_WARP_DOOR_PUSHED, 4 }, { INT_STATUS_DOOR_PULLED, 1 }, { INT_STATUS_DOOR_PUSHED, 2 }, { -1, 0 }, }; static s32 sDoorOpenSounds[] = { SOUND_GENERAL_OPEN_WOOD_DOOR, SOUND_GENERAL_OPEN_IRON_DOOR }; diff --git a/src/game/behaviors/exclamation_box.inc.c b/src/game/behaviors/exclamation_box.inc.c index eed6df0e..3d70e032 100644 --- a/src/game/behaviors/exclamation_box.inc.c +++ b/src/game/behaviors/exclamation_box.inc.c @@ -113,8 +113,8 @@ void exclamation_box_spawn_contents(struct Struct802C0DF0 *a0, u8 a1) { sp1C->oForwardVel = 3.0f; sp1C->oMoveAngleYaw = gMarioObject->oMoveAngleYaw; o->oBehParams |= a0->unk2 << 24; - if (a0->model == 122) - o->oFlags |= 0x4000; + if (a0->model == MODEL_STAR) + o->oFlags |= OBJ_FLAG_PERSISTENT_RESPAWN; break; } a0++; diff --git a/src/game/behaviors/fire_piranha_plant.inc.c b/src/game/behaviors/fire_piranha_plant.inc.c index a6d867b2..c4b1bc56 100644 --- a/src/game/behaviors/fire_piranha_plant.inc.c +++ b/src/game/behaviors/fire_piranha_plant.inc.c @@ -35,7 +35,7 @@ void bhv_fire_piranha_plant_init(void) { obj_set_hitbox(o, &sFirePiranhaPlantHitbox); if ((u16)(o->oBehParams >> 16) != 0) { - o->oFlags |= 0x00004000; + o->oFlags |= OBJ_FLAG_PERSISTENT_RESPAWN; o->oHealth = 1; if (o->oBehParams & 0x0000FF00) { diff --git a/src/game/behaviors/klepto.inc.c b/src/game/behaviors/klepto.inc.c index 46d7ffcc..1a5768a5 100644 --- a/src/game/behaviors/klepto.inc.c +++ b/src/game/behaviors/klepto.inc.c @@ -180,7 +180,7 @@ static void klepto_act_wait_for_mario(void) { klepto_target_mario(); if (o->oKleptoDistanceToTarget < 1000.0f) { o->oAction = KLEPTO_ACT_TURN_TOWARD_MARIO; - o->oFlags &= ~0x00000008; + o->oFlags &= ~OBJ_FLAG_SET_FACE_YAW_TO_MOVE_YAW; } } @@ -195,7 +195,7 @@ static void klepto_act_turn_toward_mario(void) { cur_obj_play_sound_2(SOUND_OBJ_KLEPTO1); o->oAction = KLEPTO_ACT_DIVE_AT_MARIO; o->oMoveAngleYaw = o->oFaceAngleYaw; - o->oFlags |= 0x00000008; + o->oFlags |= OBJ_FLAG_SET_FACE_YAW_TO_MOVE_YAW; cur_obj_init_animation_with_sound(3); } @@ -287,7 +287,7 @@ static void klepto_act_retreat(void) { o->oAction = KLEPTO_ACT_RESET_POSITION; o->oHomeY = 1500.0f; o->oKleptoUnk1AE = -100; - o->oFlags |= 0x00000008; + o->oFlags |= OBJ_FLAG_SET_FACE_YAW_TO_MOVE_YAW; cur_obj_become_tangible(); } } @@ -371,7 +371,7 @@ void bhv_klepto_update(void) { o->oGravity = -2.0f; o->oMoveAngleYaw = o->oAngleToMario + 0x8000; - o->oFlags &= ~0x00000008; + o->oFlags &= ~OBJ_FLAG_SET_FACE_YAW_TO_MOVE_YAW; cur_obj_become_intangible(); } else if (gMarioStates[0].action == ACT_SLEEPING || (gMarioStates[0].action diff --git a/src/game/behaviors/mips.inc.c b/src/game/behaviors/mips.inc.c index 461e9f2a..adba6333 100644 --- a/src/game/behaviors/mips.inc.c +++ b/src/game/behaviors/mips.inc.c @@ -163,13 +163,10 @@ void bhv_mips_act_wait_for_animation_done(void) { * Handles MIPS falling down after being thrown. */ void bhv_mips_act_fall_down(void) { - - s16 collisionFlags = 0; - - collisionFlags = object_step(); + s16 collisionFlags = object_step(); o->header.gfx.animInfo.animFrame = 0; - if ((collisionFlags & OBJ_COL_FLAG_GROUNDED) == 1) { + if (collisionFlags & OBJ_COL_FLAG_GROUNDED) { o->oAction = MIPS_ACT_WAIT_FOR_ANIMATION_DONE; o->oFlags |= OBJ_FLAG_SET_FACE_YAW_TO_MOVE_YAW; diff --git a/src/game/behaviors/moneybag.inc.c b/src/game/behaviors/moneybag.inc.c index 7c366632..b8567bd5 100644 --- a/src/game/behaviors/moneybag.inc.c +++ b/src/game/behaviors/moneybag.inc.c @@ -74,7 +74,7 @@ void moneybag_jump(s8 collisionFlags) { case MONEYBAG_JUMP_JUMP: cur_obj_init_animation(2); - if ((collisionFlags & 1) == 1) /* bit 0 */ + if ((collisionFlags & OBJ_COL_FLAG_GROUNDED) == OBJ_COL_FLAG_GROUNDED) /* bit 0 */ { o->oForwardVel = 0; o->oVelY = 0; diff --git a/src/game/behaviors/moving_coin.inc.c b/src/game/behaviors/moving_coin.inc.c index d992b13e..b01e32b8 100644 --- a/src/game/behaviors/moving_coin.inc.c +++ b/src/game/behaviors/moving_coin.inc.c @@ -31,7 +31,7 @@ s32 coin_step(s16 *collisionFlagsPtr) { obj_check_floor_death(*collisionFlagsPtr, sObjFloor); - if ((*collisionFlagsPtr & 0x1) != 0 && (*collisionFlagsPtr & 0x8) == 0) /* bit 0, bit 3 */ + if ((*collisionFlagsPtr & OBJ_COL_FLAG_GROUNDED) && !(*collisionFlagsPtr & OBJ_COL_FLAG_NO_Y_VEL)) /* bit 0, bit 3 */ { cur_obj_play_sound_2(SOUND_GENERAL_COIN_DROP); return 1; @@ -152,7 +152,7 @@ void blue_coin_sliding_away_from_mario(void) { if (coin_step(&collisionFlags) != 0) o->oVelY += 18.0f; - if ((collisionFlags & 0x2) != 0) + if (collisionFlags & OBJ_COL_FLAG_HIT_WALL) o->oAction = 3; /* bit 1 */ if (is_point_within_radius_of_mario(o->oPosX, o->oPosY, o->oPosZ, 1000) == 0) diff --git a/src/game/behaviors/mushroom_1up.inc.c b/src/game/behaviors/mushroom_1up.inc.c index aac7c98d..5921827c 100644 --- a/src/game/behaviors/mushroom_1up.inc.c +++ b/src/game/behaviors/mushroom_1up.inc.c @@ -57,11 +57,11 @@ void pole_1up_move_towards_mario(void) { bhv_1up_interact(); } -void one_up_move_away_from_mario(s16 sp1A) { +void one_up_move_away_from_mario(s16 collisionFlags) { o->oForwardVel = 8.0f; o->oMoveAngleYaw = o->oAngleToMario + 0x8000; bhv_1up_interact(); - if (sp1A & 0x02) + if (collisionFlags & OBJ_COL_FLAG_HIT_WALL) o->oAction = 2; if (!is_point_within_radius_of_mario(o->oPosX, o->oPosY, o->oPosZ, 3000)) @@ -105,9 +105,7 @@ void bhv_1up_walking_loop(void) { } void bhv_1up_running_away_loop(void) { - s16 sp26; - - sp26 = object_step(); + s16 collisionFlags = object_step(); switch (o->oAction) { case 0: if (o->oTimer >= 18) @@ -127,7 +125,7 @@ void bhv_1up_running_away_loop(void) { case 1: spawn_object(o, MODEL_NONE, bhvSparkleSpawn); - one_up_move_away_from_mario(sp26); + one_up_move_away_from_mario(collisionFlags); break; case 2: @@ -140,10 +138,8 @@ void bhv_1up_running_away_loop(void) { } void sliding_1up_move(void) { - s16 sp1E; - - sp1E = object_step(); - if (sp1E & 0x01) { + s16 collisionFlags = object_step(); + if (collisionFlags & OBJ_COL_FLAG_GROUNDED) { o->oForwardVel += 25.0f; o->oVelY = 0; } else { @@ -185,7 +181,7 @@ void bhv_1up_loop(void) { } void bhv_1up_jump_on_approach_loop(void) { - s16 sp26; + s16 collisionFlags; switch (o->oAction) { case 0: @@ -196,13 +192,13 @@ void bhv_1up_jump_on_approach_loop(void) { break; case 1: - sp26 = object_step(); - one_up_move_away_from_mario(sp26); + collisionFlags = object_step(); + one_up_move_away_from_mario(collisionFlags); spawn_object(o, MODEL_NONE, bhvSparkleSpawn); break; case 2: - sp26 = object_step(); + collisionFlags = object_step(); bhv_1up_interact(); obj_flicker_and_disappear(o, 30); break; @@ -212,7 +208,7 @@ void bhv_1up_jump_on_approach_loop(void) { } void bhv_1up_hidden_loop(void) { - s16 sp26; + s16 collisionFlags; switch (o->oAction) { case 0: o->header.gfx.node.flags |= GRAPH_RENDER_INVISIBLE; @@ -225,19 +221,19 @@ void bhv_1up_hidden_loop(void) { break; case 1: - sp26 = object_step(); - one_up_move_away_from_mario(sp26); + collisionFlags = object_step(); + one_up_move_away_from_mario(collisionFlags); spawn_object(o, MODEL_NONE, bhvSparkleSpawn); break; case 2: - sp26 = object_step(); + collisionFlags = object_step(); bhv_1up_interact(); obj_flicker_and_disappear(o, 30); break; case 3: - sp26 = object_step(); + collisionFlags = object_step(); if (o->oTimer >= 18) spawn_object(o, MODEL_NONE, bhvSparkleSpawn); @@ -264,7 +260,6 @@ void bhv_1up_hidden_trigger_loop(void) { } void bhv_1up_hidden_in_pole_loop(void) { - UNUSED s16 sp26; switch (o->oAction) { case 0: o->header.gfx.node.flags |= GRAPH_RENDER_INVISIBLE; @@ -278,11 +273,11 @@ void bhv_1up_hidden_in_pole_loop(void) { case 1: pole_1up_move_towards_mario(); - sp26 = object_step(); + object_step(); break; case 3: - sp26 = object_step(); + object_step(); if (o->oTimer >= 18) spawn_object(o, MODEL_NONE, bhvSparkleSpawn); diff --git a/src/game/behaviors/scuttlebug.inc.c b/src/game/behaviors/scuttlebug.inc.c index 16840e1c..febf64f2 100644 --- a/src/game/behaviors/scuttlebug.inc.c +++ b/src/game/behaviors/scuttlebug.inc.c @@ -77,7 +77,7 @@ void bhv_scuttlebug_loop(void) { cur_obj_rotate_yaw_toward(o->oAngleToMario, 0x400); break; case 3: - o->oFlags &= ~8; + o->oFlags &= ~OBJ_FLAG_SET_FACE_YAW_TO_MOVE_YAW; o->oForwardVel = -10.0f; o->oVelY = 30.0f; cur_obj_play_sound_2(SOUND_OBJ2_SCUTTLEBUG_ALERT); @@ -89,7 +89,7 @@ void bhv_scuttlebug_loop(void) { o->oSubAction++; o->oVelY = 0.0f; o->oScuttlebugUnkFC = 0; - o->oFlags |= 8; + o->oFlags |= OBJ_FLAG_SET_FACE_YAW_TO_MOVE_YAW; o->oInteractStatus = 0; } break; diff --git a/src/game/behaviors/skeeter.inc.c b/src/game/behaviors/skeeter.inc.c index a726760f..6451d4ea 100644 --- a/src/game/behaviors/skeeter.inc.c +++ b/src/game/behaviors/skeeter.inc.c @@ -70,7 +70,7 @@ static void skeeter_act_lunge(void) { if (o->oMoveFlags & OBJ_MOVE_HIT_WALL) { o->oMoveAngleYaw = cur_obj_reflect_move_angle_off_wall(); o->oForwardVel *= 0.3f; - o->oFlags &= ~0x00000008; + o->oFlags &= ~OBJ_FLAG_SET_FACE_YAW_TO_MOVE_YAW; } if (obj_forward_vel_approach(0.0f, 0.8f) && cur_obj_check_if_at_animation_end()) { @@ -84,7 +84,7 @@ static void skeeter_act_lunge(void) { o->oAction = SKEETER_ACT_IDLE; o->oSkeeterWaitTime = random_linear_offset(0, 30); - o->oFlags |= 0x00000008; + o->oFlags |= OBJ_FLAG_SET_FACE_YAW_TO_MOVE_YAW; } } } diff --git a/src/game/behaviors/snowman.inc.c b/src/game/behaviors/snowman.inc.c index 2d532efe..35ed8dd9 100644 --- a/src/game/behaviors/snowman.inc.c +++ b/src/game/behaviors/snowman.inc.c @@ -51,7 +51,6 @@ void adjust_rolling_face_pitch(f32 f12) { } void snowmans_bottom_act_1(void) { - UNUSED s16 sp26; s32 sp20; UNUSED s16 sp1E; #ifdef AVOID_UB @@ -59,7 +58,7 @@ void snowmans_bottom_act_1(void) { #endif o->oPathedStartWaypoint = segmented_to_virtual(&ccm_seg7_trajectory_snowman); - sp26 = object_step_without_floor_orient(); + object_step_without_floor_orient(); sp20 = cur_obj_follow_path(sp20); o->oSnowmansBottomUnkF8 = o->oPathedTargetYaw; o->oMoveAngleYaw = approach_s16_symmetric(o->oMoveAngleYaw, o->oSnowmansBottomUnkF8, 0x400); @@ -80,9 +79,7 @@ void snowmans_bottom_act_1(void) { } void snowmans_bottom_act_2(void) { - UNUSED s16 sp26; - - sp26 = object_step_without_floor_orient(); + object_step_without_floor_orient(); if (o->oForwardVel > 70.0) o->oForwardVel = 70.0f; @@ -106,15 +103,13 @@ void snowmans_bottom_act_2(void) { } void snowmans_bottom_act_3(void) { - UNUSED s16 sp1E; - - sp1E = object_step_without_floor_orient(); - if ((sp1E & 0x09) == 0x09) { + s16 collisionFlags = object_step_without_floor_orient(); + if ((collisionFlags & OBJ_COL_FLAGS_LANDED) == OBJ_COL_FLAGS_LANDED) { o->oAction = 4; cur_obj_become_intangible(); } - if ((sp1E & 0x01) != 0) { + if ((collisionFlags & 0x01) != 0) { spawn_mist_particles_variable(0, 0, 70.0f); o->oPosX = -4230.0f; o->oPosZ = 1813.0f; @@ -190,7 +185,7 @@ void bhv_snowmans_head_init(void) { void bhv_snowmans_head_loop(void) { UNUSED s16 sp1E; - s16 sp1C; + s16 collisionFlags; switch (o->oAction) { case 0: @@ -202,8 +197,8 @@ void bhv_snowmans_head_loop(void) { break; case 2: - sp1C = object_step_without_floor_orient(); - if (sp1C & 0x08) + collisionFlags = object_step_without_floor_orient(); + if (collisionFlags & OBJ_COL_FLAG_NO_Y_VEL) o->oAction = 3; break; diff --git a/src/game/behaviors/spindrift.inc.c b/src/game/behaviors/spindrift.inc.c index bc04018e..4e904486 100644 --- a/src/game/behaviors/spindrift.inc.c +++ b/src/game/behaviors/spindrift.inc.c @@ -27,12 +27,12 @@ void bhv_spindrift_loop(void) { cur_obj_rotate_yaw_toward(o->oAngleToMario, 0x400); break; case 1: - o->oFlags &= ~8; + o->oFlags &= ~OBJ_FLAG_SET_FACE_YAW_TO_MOVE_YAW; o->oForwardVel = -10.0f; if (o->oTimer > 20) { o->oAction = 0; o->oInteractStatus = 0; - o->oFlags |= 8; + o->oFlags |= OBJ_FLAG_SET_FACE_YAW_TO_MOVE_YAW; } break; } diff --git a/src/game/behaviors/yoshi.inc.c b/src/game/behaviors/yoshi.inc.c index 3a56cf8b..f2ba6de6 100644 --- a/src/game/behaviors/yoshi.inc.c +++ b/src/game/behaviors/yoshi.inc.c @@ -18,11 +18,11 @@ void bhv_yoshi_init(void) { } void yoshi_walk_loop(void) { - UNUSED s16 sp26; + UNUSED s16 collisionFlags; s16 sp24 = o->header.gfx.animInfo.animFrame; o->oForwardVel = 10.0f; - sp26 = object_step(); + collisionFlags = object_step(); o->oMoveAngleYaw = approach_s16_symmetric(o->oMoveAngleYaw, o->oYoshiTargetYaw, 0x500); if (is_point_close_to_object(o, o->oHomeX, 3174.0f, o->oHomeZ, 200)) o->oAction = YOSHI_ACT_IDLE; diff --git a/src/game/game_init.c b/src/game/game_init.c index 83a90626..86935075 100644 --- a/src/game/game_init.c +++ b/src/game/game_init.c @@ -46,6 +46,9 @@ OSContPad gControllerPads[4]; u8 gControllerBits; u8 gIsConsole = TRUE; // Needs to be initialized before audio_reset_session is called u8 gBorderHeight; +#ifdef CUSTOM_DEBUG +u8 gCustomDebugMode; +#endif #ifdef EEP s8 gEepromProbe; #endif diff --git a/src/game/game_init.h b/src/game/game_init.h index 87386cea..f3f650c3 100644 --- a/src/game/game_init.h +++ b/src/game/game_init.h @@ -46,6 +46,9 @@ extern u8 gIsConsole; extern u8 gWidescreen; #endif extern u8 gBorderHeight; +#ifdef CUSTOM_DEBUG +extern u8 gCustomDebugMode; +#endif #ifdef EEP extern s8 gEepromProbe; #endif diff --git a/src/game/geo_misc.c b/src/game/geo_misc.c index 61d7a8c0..383f5fff 100644 --- a/src/game/geo_misc.c +++ b/src/game/geo_misc.c @@ -96,7 +96,7 @@ Gfx *geo_exec_inside_castle_light(s32 callContext, struct GraphNode *node, UNUSE } generatedNode = (struct GraphNodeGenerated *) node; - generatedNode->fnNode.node.flags = (generatedNode->fnNode.node.flags & 0xFF) | 0x500; + generatedNode->fnNode.node.flags = (generatedNode->fnNode.node.flags & 0xFF) | (LAYER_TRANSPARENT << 8); gSPDisplayList(displayListHead++, dl_castle_lobby_wing_cap_light); gSPEndDisplayList(displayListHead); @@ -149,7 +149,7 @@ Gfx *geo_exec_flying_carpet_create(s32 callContext, struct GraphNode *node, UNUS return NULL; } - generatedNode->fnNode.node.flags = (generatedNode->fnNode.node.flags & 0xFF) | 0x100; + generatedNode->fnNode.node.flags = (generatedNode->fnNode.node.flags & 0xFF) | (LAYER_OPAQUE << 8); for (n = 0; n <= 20; n++) { row = n / 3; @@ -202,7 +202,7 @@ Gfx *geo_exec_cake_end_screen(s32 callContext, struct GraphNode *node, UNUSED f3 displayList = alloc_display_list(3 * sizeof(*displayList)); displayListHead = displayList; - generatedNode->fnNode.node.flags = (generatedNode->fnNode.node.flags & 0xFF) | 0x100; + generatedNode->fnNode.node.flags = (generatedNode->fnNode.node.flags & 0xFF) | (LAYER_OPAQUE << 8); #ifdef VERSION_EU gSPDisplayList(displayListHead++, dl_cake_end_screen); #else diff --git a/src/game/hud.c b/src/game/hud.c index 42fd1554..cfbd0f0f 100644 --- a/src/game/hud.c +++ b/src/game/hud.c @@ -15,6 +15,8 @@ #include "print.h" #include "engine/surface_load.h" +#include "config.h" + /* @file hud.c * This file implements HUD rendering and power meter animations. * That includes stars, lives, coins, camera status, power meter, timer @@ -48,9 +50,9 @@ f32 calculate_and_update_fps() void print_fps(s32 x, s32 y) { f32 fps = calculate_and_update_fps(); - char text[10]; + char text[14]; - sprintf(text, "%2.2f", fps); + sprintf(text, "FPS %2.2f", fps); print_text(x, y, text); } @@ -308,6 +310,18 @@ void render_hud_mario_lives(void) { print_text_fmt_int(GFX_DIMENSIONS_RECT_FROM_LEFT_EDGE(54), HUD_TOP_Y, "%d", gHudDisplay.lives); } +#ifdef CUSTOM_DEBUG +void render_debug_mode(void) { + print_text(180, 40, "DEBUG MODE"); + print_text_fmt_int(5, 20, "Z %d", gMarioState->pos[2]); + print_text_fmt_int(5, 40, "Y %d", gMarioState->pos[1]); + print_text_fmt_int(5, 60, "X %d", gMarioState->pos[0]); + print_text_fmt_int(10, 100, "SPD %d", (s32) gMarioState->forwardVel); + print_text_fmt_int(10, 120, "ANG 0*%04x", (u16) gMarioState->faceAngle[1]); + print_fps(10,80); +} +#endif + /** * Renders the amount of coins collected. */ @@ -521,5 +535,10 @@ void render_hud(void) { { print_text(10, 60, "SURFACE NODE POOL FULL"); } + #ifdef CUSTOM_DEBUG + if (gCustomDebugMode) { + render_debug_mode(); + } + #endif } } diff --git a/src/game/interaction.h b/src/game/interaction.h index 3f9e5b9b..1b2457be 100644 --- a/src/game/interaction.h +++ b/src/game/interaction.h @@ -95,6 +95,10 @@ #define INT_STATUS_ATTACKED_MARIO (1 << 13) /* 0x00002000 */ #define INT_STATUS_WAS_ATTACKED (1 << 14) /* 0x00004000 */ #define INT_STATUS_INTERACTED (1 << 15) /* 0x00008000 */ +#define INT_STATUS_DOOR_PULLED (1 << 16) /* 0x00010000 */ +#define INT_STATUS_DOOR_PUSHED (1 << 17) /* 0x00020000 */ +#define INT_STATUS_WARP_DOOR_PULLED (1 << 18) /* 0x00040000 */ +#define INT_STATUS_WARP_DOOR_PUSHED (1 << 19) /* 0x00080000 */ #define INT_STATUS_TRAP_TURN (1 << 20) /* 0x00100000 */ #define INT_STATUS_HIT_MINE (1 << 21) /* 0x00200000 */ #define INT_STATUS_STOP_RIDING (1 << 22) /* 0x00400000 */ diff --git a/src/game/level_geo.c b/src/game/level_geo.c index 1fc4b88e..f7e40543 100644 --- a/src/game/level_geo.c +++ b/src/game/level_geo.c @@ -40,7 +40,7 @@ Gfx *geo_envfx_main(s32 callContext, struct GraphNode *node, Mat4 mtxf) { mtxf_to_mtx(mtx, mtxf); gSPMatrix(&gfx[0], VIRTUAL_TO_PHYSICAL(mtx), G_MTX_MODELVIEW | G_MTX_LOAD | G_MTX_NOPUSH); gSPBranchList(&gfx[1], VIRTUAL_TO_PHYSICAL(particleList)); - execNode->fnNode.node.flags = (execNode->fnNode.node.flags & 0xFF) | 0x400; + execNode->fnNode.node.flags = (execNode->fnNode.node.flags & 0xFF) | (LAYER_ALPHA << 8); } SET_HIGH_U16_OF_32(*params, gAreaUpdateCounter); } diff --git a/src/game/mario.c b/src/game/mario.c index b381afa8..c0b5f763 100644 --- a/src/game/mario.c +++ b/src/game/mario.c @@ -1283,6 +1283,23 @@ void update_mario_button_inputs(struct MarioState *m) { m->input |= INPUT_A_DOWN; } +#ifdef CUSTOM_DEBUG + if (m->controller->buttonPressed & L_JPAD) { + gCustomDebugMode ^= 1; + } + if (gCustomDebugMode) { + if (m->controller->buttonPressed & R_JPAD) { + if (gMarioState->action == ACT_DEBUG_FREE_MOVE) { + set_mario_action(gMarioState, ACT_IDLE, 0); + } else { + set_mario_action(gMarioState, ACT_DEBUG_FREE_MOVE, 0); + } + } + } else if (gMarioState->action == ACT_DEBUG_FREE_MOVE) { + set_mario_action(gMarioState, ACT_IDLE, 0); + } +#endif + // Don't update for these buttons if squished. if (m->squishTimer == 0) { if (m->controller->buttonPressed & B_BUTTON) { diff --git a/src/game/mario_actions_cutscene.c b/src/game/mario_actions_cutscene.c index ad95b9a8..07458cff 100644 --- a/src/game/mario_actions_cutscene.c +++ b/src/game/mario_actions_cutscene.c @@ -861,7 +861,7 @@ s32 act_entering_star_door(struct MarioState *m) { s16 targetAngle; if (m->actionTimer++ == 0) { - m->interactObj->oInteractStatus = 0x00010000; + m->interactObj->oInteractStatus = INT_STATUS_DOOR_PULLED; // ~30 degrees / 1/12 rot targetAngle = m->usedObj->oMoveAngleYaw + 0x1555; @@ -919,10 +919,10 @@ s32 act_entering_star_door(struct MarioState *m) { s32 act_going_through_door(struct MarioState *m) { if (m->actionTimer == 0) { if (m->actionArg & 1) { - m->interactObj->oInteractStatus = 0x00010000; + m->interactObj->oInteractStatus = INT_STATUS_DOOR_PULLED; set_mario_animation(m, MARIO_ANIM_PULL_DOOR_WALK_IN); } else { - m->interactObj->oInteractStatus = 0x00020000; + m->interactObj->oInteractStatus = INT_STATUS_DOOR_PUSHED; set_mario_animation(m, MARIO_ANIM_PUSH_DOOR_WALK_IN); } } @@ -952,9 +952,9 @@ s32 act_warp_door_spawn(struct MarioState *m) { if (m->actionState == 0) { m->actionState = 1; if (m->actionArg & 1) { - m->usedObj->oInteractStatus = 0x00040000; + m->usedObj->oInteractStatus = INT_STATUS_WARP_DOOR_PULLED; } else { - m->usedObj->oInteractStatus = 0x00080000; + m->usedObj->oInteractStatus = INT_STATUS_WARP_DOOR_PUSHED; } } else if (m->usedObj->oAction == 0) { if (gNeverEnteredCastle == TRUE && gCurrLevelNum == LEVEL_CASTLE) { diff --git a/src/game/obj_behaviors.c b/src/game/obj_behaviors.c index fdfc70fa..4432645a 100644 --- a/src/game/obj_behaviors.c +++ b/src/game/obj_behaviors.c @@ -108,7 +108,7 @@ Gfx UNUSED *geo_obj_transparency_something(s32 callContext, struct GraphNode *no gfxHead = alloc_display_list(3 * sizeof(Gfx)); gfx = gfxHead; obj->header.gfx.node.flags = - (obj->header.gfx.node.flags & 0xFF) | (GRAPH_NODE_TYPE_FUNCTIONAL | GRAPH_NODE_TYPE_400); + (obj->header.gfx.node.flags & 0xFF) | (LAYER_TRANSPARENT << 8); gDPSetEnvColor(gfx++, 255, 255, 255, heldObject->oOpacity); diff --git a/src/game/object_helpers.c b/src/game/object_helpers.c index 3a37f3d5..eae57a85 100644 --- a/src/game/object_helpers.c +++ b/src/game/object_helpers.c @@ -76,20 +76,20 @@ Gfx *geo_update_layer_transparency(s32 callContext, struct GraphNode *node, UNUS if (objectOpacity == 0xFF) { if (currentGraphNode->parameter == 20) { currentGraphNode->fnNode.node.flags = - 0x600 | (currentGraphNode->fnNode.node.flags & 0xFF); + (LAYER_TRANSPARENT_DECAL << 8) | (currentGraphNode->fnNode.node.flags & 0xFF); } else { currentGraphNode->fnNode.node.flags = - 0x100 | (currentGraphNode->fnNode.node.flags & 0xFF); + (LAYER_OPAQUE << 8) | (currentGraphNode->fnNode.node.flags & 0xFF); } objectGraphNode->oAnimState = 0; } else { if (currentGraphNode->parameter == 20) { currentGraphNode->fnNode.node.flags = - 0x600 | (currentGraphNode->fnNode.node.flags & 0xFF); + (LAYER_TRANSPARENT_DECAL << 8) | (currentGraphNode->fnNode.node.flags & 0xFF); } else { currentGraphNode->fnNode.node.flags = - 0x500 | (currentGraphNode->fnNode.node.flags & 0xFF); + (LAYER_TRANSPARENT << 8) | (currentGraphNode->fnNode.node.flags & 0xFF); } objectGraphNode->oAnimState = 1; @@ -479,7 +479,7 @@ struct Object *spawn_object_rel_with_rot(struct Object *parent, u32 model, const struct Object *spawn_obj_with_transform_flags(struct Object *sp20, s32 model, const BehaviorScript *sp28) { struct Object *sp1C = spawn_object(sp20, model, sp28); - sp1C->oFlags |= OBJ_FLAG_0020 | OBJ_FLAG_SET_THROW_MATRIX_FROM_TRANSFORM; + sp1C->oFlags |= OBJ_FLAG_UPDATE_TRANSFORM_FOR_THROW_MATRIX | OBJ_FLAG_SET_THROW_MATRIX_FROM_TRANSFORM; return sp1C; } @@ -1921,7 +1921,7 @@ void obj_build_transform_from_pos_and_angle(struct Object *obj, s16 posIndex, s1 } void obj_set_throw_matrix_from_transform(struct Object *obj) { - if (obj->oFlags & OBJ_FLAG_0020) { + if (obj->oFlags & OBJ_FLAG_UPDATE_TRANSFORM_FOR_THROW_MATRIX) { obj_build_transform_from_pos_and_angle(obj, O_POS_INDEX, O_FACE_ANGLE_INDEX); obj_apply_scale_to_transform(obj); } @@ -2118,8 +2118,8 @@ void cur_obj_spawn_particles(struct SpawnParticlesInfo *info) { } void obj_set_hitbox(struct Object *obj, struct ObjectHitbox *hitbox) { - if (!(obj->oFlags & OBJ_FLAG_30)) { - obj->oFlags |= OBJ_FLAG_30; + if (!(obj->oFlags & OBJ_FLAG_HITBOX_WAS_SET)) { + obj->oFlags |= OBJ_FLAG_HITBOX_WAS_SET; obj->oInteractType = hitbox->interactType; obj->oDamageOrCoinValue = hitbox->damageOrCoinValue; diff --git a/src/game/platform_displacement.c b/src/game/platform_displacement.c index e42f4829..61859bf6 100644 --- a/src/game/platform_displacement.c +++ b/src/game/platform_displacement.c @@ -9,6 +9,7 @@ #include "platform_displacement.h" #include "types.h" #include "sm64.h" +#include "behavior_data.h" #include "config.h" @@ -144,6 +145,13 @@ void apply_platform_displacement(struct PlatformDisplacementInfo *displaceInfo, vec3f_sub(pos, platformPos); } + // Apply displacement specifically for TTC Treadmills + if (platform->behavior == segmented_to_virtual(bhvTTCTreadmill)) { + pos[0] += platform->oVelX; + pos[1] += platform->oVelY; + pos[2] += platform->oVelZ; + } + // Transform from world positions to relative positions for use next frame linear_mtxf_transpose_mul_vec3f(*platform->header.gfx.throwMatrix, scaledPos, pos); scale_vec3f(displaceInfo->prevTransformedPos, scaledPos, platform->header.gfx.scale, TRUE); diff --git a/src/game/rendering_graph_node.c b/src/game/rendering_graph_node.c index 1a42958f..b1e00dbf 100644 --- a/src/game/rendering_graph_node.c +++ b/src/game/rendering_graph_node.c @@ -594,7 +594,7 @@ static void geo_process_background(struct GraphNodeBackground *node) { gDPSetCycleType(gfx++, G_CYC_1CYCLE); gSPEndDisplayList(gfx++); - geo_append_display_list((void *) VIRTUAL_TO_PHYSICAL(gfxStart), 0); + geo_append_display_list((void *) VIRTUAL_TO_PHYSICAL(gfxStart), LAYER_FORCE); } if (node->fnNode.node.children != NULL) { geo_process_node_and_siblings(node->fnNode.node.children); @@ -762,11 +762,11 @@ static void geo_process_shadow(struct GraphNodeShadow *node) { mtxf_to_mtx(mtx, gMatStack[gMatStackIndex]); gMatStackFixed[gMatStackIndex] = mtx; if (gShadowAboveWaterOrLava == TRUE) { - geo_append_display_list((void *) VIRTUAL_TO_PHYSICAL(shadowList), 4); + geo_append_display_list((void *) VIRTUAL_TO_PHYSICAL(shadowList), LAYER_ALPHA); } else if (gMarioOnIceOrCarpet == 1 || gShadowAboveCustomWater == 1) { - geo_append_display_list((void *) VIRTUAL_TO_PHYSICAL(shadowList), 5); + geo_append_display_list((void *) VIRTUAL_TO_PHYSICAL(shadowList), LAYER_TRANSPARENT); } else { - geo_append_display_list((void *) VIRTUAL_TO_PHYSICAL(shadowList), 6); + geo_append_display_list((void *) VIRTUAL_TO_PHYSICAL(shadowList), LAYER_TRANSPARENT_DECAL); } gMatStackIndex--; } diff --git a/src/game/screen_transition.c b/src/game/screen_transition.c index 52452b82..9347e223 100644 --- a/src/game/screen_transition.c +++ b/src/game/screen_transition.c @@ -297,7 +297,7 @@ Gfx *geo_cannon_circle_base(s32 callContext, struct GraphNode *node, UNUSED Mat4 if (callContext == GEO_CONTEXT_RENDER && gCurrentArea != NULL && gCurrentArea->camera->mode == CAMERA_MODE_INSIDE_CANNON) { - graphNode->fnNode.node.flags = (graphNode->fnNode.node.flags & 0xFF) | 0x500; + graphNode->fnNode.node.flags = (graphNode->fnNode.node.flags & 0xFF) | (LAYER_TRANSPARENT << 8); dlist = render_cannon_circle_base(); } return dlist; diff --git a/tools/rncpack.c b/tools/rncpack.c index 2eaaff4f..31cd6c64 100644 --- a/tools/rncpack.c +++ b/tools/rncpack.c @@ -1641,10 +1641,10 @@ int parse_args(int argc, char **argv, vars_t *vars) int main(int argc, char *argv[]) { - printf("-= RNC ProPackED v1.5 [by Lab 313] (12/02/2020) =-\n"); - printf("-----------------------------\n"); if (argc <= 2) { + printf("-= RNC ProPackED v1.5 [by Lab 313] (12/02/2020) =-\n"); + printf("-----------------------------\n"); printf("Compression type: Huffman + LZ77\n"); printf("De/Compressor: Dr.MefistO\n"); printf("Coding: Dr. MefistO\n"); @@ -1725,8 +1725,8 @@ int main(int argc, char *argv[]) fwrite(v->output, v->output_offset, 1, out); fclose(out); - printf("File successfully %s!\n", ((v->puse_mode == 'p') ? "packed" : "unpacked")); - printf("Original/new size: %d/%zd bytes\n", (v->puse_mode == 'u') ? (v->packed_size + RNC_HEADER_SIZE) : v->file_size, v->output_offset); +// printf("File successfully %s!\n", ((v->puse_mode == 'p') ? "packed" : "unpacked")); +// printf("Original/new size: %d/%zd bytes\n", (v->puse_mode == 'u') ? (v->packed_size + RNC_HEADER_SIZE) : v->file_size, v->output_offset); } else { switch (error_code) { diff --git a/tools/slienc.c b/tools/slienc.c index 30e3911f..ec44e519 100644 --- a/tools/slienc.c +++ b/tools/slienc.c @@ -199,7 +199,7 @@ void encode() } if ( v1 != 0x80000000 ) ++cp; - fprintf(stderr, "IN=%d OUT=%d\n", insize, dp + 2 * pp + 4 * cp + 16); + //fprintf(stderr, "IN=%d OUT=%d\n", insize, dp + 2 * pp + 4 * cp + 16); } void search(unsigned int a1, int a2, int *a3, unsigned int *a4)