Merge branch 'master' into puppycamera2

This commit is contained in:
Fazana
2021-08-19 18:53:39 +01:00
committed by GitHub
34 changed files with 660 additions and 5612 deletions

2
.gitignore vendored
View File

@@ -84,3 +84,5 @@ lib/libs2d_engine.a
!/lib/PR/hvqm/*.o
# .orig files
*.orig

View File

@@ -20,6 +20,8 @@ USE_DEBUG := 0
# Build for the N64 (turn this off for ports)
TARGET_N64 ?= 1
# Virtual Console hacks. Enabling this makes your hack (hopefully) compatible with the Wii Virtual Console.
# One of the thing this does is disable the instant input patch, so do NOT use this for your normal z64 release.
VC_HACKS ?= 0
# CONSOLE - selects the console to target
@@ -297,6 +299,10 @@ ifeq ($(filter clean distclean print-%,$(MAKECMDGOALS)),)
ifeq ($(DUMMY),FAIL)
$(error Failed to extract assets)
endif
DUMMY != $(PYTHON) extract_assets.py jp >&2 || echo FAIL
ifeq ($(DUMMY),FAIL)
$(error Failed to extract assets)
endif
endif
# Make tools if out of date
@@ -780,20 +786,20 @@ $(BUILD_DIR)/libz.a: $(LIBZ_O_FILES)
$(V)$(AR) rcs -o $@ $(LIBZ_O_FILES)
# SS2: Goddard rules to get size
$(BUILD_DIR)/goddard.ld: goddard.ld $(BUILD_DIR)/libgoddard.a
$(call print,Preprocessing linker script:,$<,$@)
$(V)$(CPP) $(CPPFLAGS) -DBUILD_DIR=$(BUILD_DIR) -MMD -MP -MT $@ -MF $@.d -o $@ $<
$(BUILD_DIR)/sm64_prelim.ld: sm64.ld $(O_FILES) $(YAY0_OBJ_FILES) $(SEG_FILES) $(BUILD_DIR)/libgoddard.a $(BUILD_DIR)/libz.a
$(call print,Preprocessing preliminary linker script:,$<,$@)
$(V)$(CPP) $(CPPFLAGS) -DPRELIMINARY=1 -DBUILD_DIR=$(BUILD_DIR) -MMD -MP -MT $@ -MF $@.d -o $@ $<
$(BUILD_DIR)/goddard.elf: $(BUILD_DIR)/goddard.ld
@$(PRINT) "$(GREEN)Linking ELF file: $(BLUE)$@ $(NO_COL)\n"
$(V)$(LD) --gc-sections -L $(BUILD_DIR) -T undefined_syms.txt -T $< -Map $(BUILD_DIR)/goddard.map --no-check-sections -o $@ -T tools/hardcoded_syms.txt $(wildcard $(BUILD_DIR)/src/menu/*.o) -L$(LIBS_DIR) -l$(ULTRALIB) -Llib -lgoddard -u sprintf -u osMapTLB -Llib/gcclib/$(LIBGCCDIR) -lgcc
$(BUILD_DIR)/sm64_prelim.elf: $(BUILD_DIR)/sm64_prelim.ld
@$(PRINT) "$(GREEN)Linking Preliminary ELF file: $(BLUE)$@ $(NO_COL)\n"
$(V)$(LD) --gc-sections -L $(BUILD_DIR) -T undefined_syms.txt -T $< -Map $(BUILD_DIR)/sm64_prelim.map --no-check-sections $(addprefix -R ,$(SEG_FILES)) -o $@ $(O_FILES) -L$(LIBS_DIR) -l$(ULTRALIB) -Llib $(LINK_LIBRARIES) -u sprintf -u osMapTLB -Llib/gcclib/$(LIBGCCDIR) -lgcc
$(BUILD_DIR)/goddard.txt: $(BUILD_DIR)/goddard.elf
$(BUILD_DIR)/goddard.txt: $(BUILD_DIR)/sm64_prelim.elf
$(call print,Getting Goddard size...)
$(V)python3 tools/getGoddardSize.py $(BUILD_DIR)/goddard.map
$(V)python3 tools/getGoddardSize.py $(BUILD_DIR)/sm64_prelim.map $(VERSION)
# Link SM64 ELF file
$(ELF): $(O_FILES) $(YAY0_OBJ_FILES) $(SEG_FILES) $(BUILD_DIR)/$(LD_SCRIPT) undefined_syms.txt $(BUILD_DIR)/libz.a $(BUILD_DIR)/libgoddard.a
$(ELF): $(BUILD_DIR)/sm64_prelim.elf $(O_FILES) $(YAY0_OBJ_FILES) $(SEG_FILES) $(BUILD_DIR)/$(LD_SCRIPT) undefined_syms.txt $(BUILD_DIR)/libz.a $(BUILD_DIR)/libgoddard.a
@$(PRINT) "$(GREEN)Linking ELF file: $(BLUE)$@ $(NO_COL)\n"
$(V)$(LD) --gc-sections -L $(BUILD_DIR) -T undefined_syms.txt -T $(BUILD_DIR)/$(LD_SCRIPT) -T goddard.txt -Map $(BUILD_DIR)/sm64.$(VERSION).map --no-check-sections $(addprefix -R ,$(SEG_FILES)) -o $@ $(O_FILES) -L$(LIBS_DIR) -l$(ULTRALIB) -Llib $(LINK_LIBRARIES) -u sprintf -u osMapTLB -Llib/gcclib/$(LIBGCCDIR) -lgcc
@@ -801,7 +807,7 @@ $(ELF): $(O_FILES) $(YAY0_OBJ_FILES) $(SEG_FILES) $(BUILD_DIR)/$(LD_SCRIPT) unde
$(ROM): $(ELF)
$(call print,Building ROM:,$<,$@)
ifeq ($(CONSOLE),n64)
$(V)$(OBJCOPY) --pad-to=0x800000 --gap-fill=0xFF $< $@ -O binary
$(V)$(OBJCOPY) --pad-to=0x101000 --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

View File

@@ -1,12 +1,14 @@
# HackerSM64
**AFTER CLONING THE REPO, CHECK OUT THE `include/config.h` FILE BEFORE ANYTHING ELSE! IT THERE'S A LOT OF STUFF IN THIS REPO THAT CAN BE TOGGLED THERE.**
This repo needs BOTH an US ROM and a JP ROM in order to build. Place baserom.us.z64 in the repo as usual and ALSO place baserom.jp.z64
This repo needs gcc in order to be able to build it. To install it, run `sudo apt install gcc-mips-linux-gnu`
This is a fork of the ultrasm64 repo by CrashOveride which includes the following commonly used patches (patches marked with `*` are toggleable in `config.h`):
**About Puppycam**
- Puppycam is available **on a dedicated branch**. If you want puppycam in your hack, clone the `puppycamera2` branch instead of `master`.
**Puppycam**
- Puppycam is available on the master branch now, you can toogle it in config.h. *
**Collision:**
- Slope fix and exposed ceilings fix

View File

@@ -14,14 +14,10 @@
.word 0x00000000 /* Checksum 2 */
.word 0x00000000 /* Unknown */
.word 0x00000000 /* Unknown */
.if VERSION_SH == 1
.ascii INTERNAL_ROM_NAME /* Internal ROM name */
.else
.ascii INTERNAL_ROM_NAME /* Internal ROM name */
.endif
.word 0x00000000 /* Unknown */
.word 0x0000004E /* Cartridge */
.ascii "SM" /* Cartridge ID */
.ascii "ED" /* Cartridge ID */
/* Region */
#if defined(VERSION_JP) || defined(VERSION_SH)
@@ -29,6 +25,4 @@
#else
.ascii "E" /* NTSC-U (North America) */
#endif
.byte 0x00 /* Version */

View File

@@ -2166,7 +2166,6 @@ const Gfx dl_draw_text_bg_box[] = {
gsSPEndDisplayList(),
};
#ifndef VERSION_EU
// 0x0200EE28 - 0x0200EE68
static const Vtx vertex_ia8_char[] = {
#if defined(VERSION_JP) || defined(VERSION_SH)
@@ -2181,21 +2180,8 @@ static const Vtx vertex_ia8_char[] = {
{{{ 0, 16, 0}, 0, { 480, 256}, {0xff, 0xff, 0xff, 0xff}}},
#endif
};
// !EU
#endif
#ifdef VERSION_EU
// 0x020073B0
const Gfx dl_ia_text_begin[] = {
gsDPPipeSync(),
gsDPSetTexturePersp(G_TP_NONE),
gsDPSetCombineMode(G_CC_FADEA, G_CC_FADEA),
gsDPSetEnvColor(255, 255, 255, 255),
gsDPSetRenderMode(G_RM_XLU_SURF, G_RM_XLU_SURF2),
gsDPSetTextureFilter(G_TF_POINT),
gsSPEndDisplayList(),
};
// 0x020073E8 - 0x02007418
const Gfx dl_ia_text_tex_settings[] = {
gsDPSetTile(G_IM_FMT_IA, G_IM_SIZ_16b, 0, 0, G_TX_LOADTILE, 0, G_TX_WRAP | G_TX_MIRROR, 3, G_TX_NOLOD, G_TX_WRAP | G_TX_MIRROR, 4, G_TX_NOLOD),
@@ -2203,21 +2189,14 @@ const Gfx dl_ia_text_tex_settings[] = {
gsDPLoadBlock(G_TX_LOADTILE, 0, 0, ((16 * 8 + G_IM_SIZ_4b_INCR) >> G_IM_SIZ_4b_SHIFT) - 1, CALC_DXT(16, G_IM_SIZ_4b_BYTES)),
gsDPSetTile(G_IM_FMT_IA, G_IM_SIZ_4b, 1, 0, G_TX_RENDERTILE, 0, G_TX_WRAP | G_TX_MIRROR, 3, G_TX_NOLOD, G_TX_WRAP | G_TX_MIRROR, 4, G_TX_NOLOD),
gsDPSetTileSize(0, 0, 0, (16 - 1) << G_TEXTURE_IMAGE_FRAC, (8 - 1) << G_TEXTURE_IMAGE_FRAC),
gsSPVertex(vertex_ia8_char, 4, 0),
gsSP2Triangles( 0, 1, 2, 0x0, 0, 2, 3, 0x0),
gsSPEndDisplayList(),
gsSPEndDisplayList(),
};
#endif
// 0x02007418 - 0x02007450
const Gfx dl_ia_text_end[] = {
gsDPPipeSync(),
gsDPSetTexturePersp(G_TP_PERSP),
gsDPSetRenderMode(G_RM_AA_ZB_OPA_SURF, G_RM_AA_ZB_OPA_SURF2),
gsDPSetCombineMode(G_CC_SHADE, G_CC_SHADE),
gsDPSetEnvColor(255, 255, 255, 255),
gsDPSetTextureFilter(G_TF_BILERP),
gsSPEndDisplayList(),
};
#elif defined(VERSION_US)
#if defined(VERSION_US) || defined(VERSION_EU)
const Gfx dl_ia_text_begin[] = {
gsDPPipeSync(),
gsSPClearGeometryMode(G_LIGHTING),
@@ -2228,7 +2207,9 @@ const Gfx dl_ia_text_begin[] = {
gsSPTexture(0xFFFF, 0xFFFF, 0, G_TX_RENDERTILE, G_ON),
gsSPEndDisplayList(),
};
#endif
#ifdef VERSION_US
const Gfx dl_ia_text_tex_settings[] = {
gsDPSetTile(G_IM_FMT_IA, G_IM_SIZ_16b, 0, 0, G_TX_LOADTILE, 0, G_TX_WRAP | G_TX_NOMIRROR, 3, G_TX_NOLOD, G_TX_WRAP | G_TX_NOMIRROR, 4, G_TX_NOLOD),
gsDPLoadSync(),
@@ -2239,8 +2220,9 @@ const Gfx dl_ia_text_tex_settings[] = {
gsSP2Triangles( 0, 1, 2, 0x0, 0, 2, 3, 0x0),
gsSPEndDisplayList(),
};
#endif
#else
#if defined(VERSION_JP) || defined(VERSION_SH)
// 0x0200EE68 - 0x0200EEA8
const Gfx dl_ia_text_begin[] = {
gsDPPipeSync(),
@@ -2266,7 +2248,6 @@ const Gfx dl_ia_text_tex_settings[] = {
};
#endif
#ifndef VERSION_EU
// 0x0200EEF0 - 0x0200EF30
const Gfx dl_ia_text_end[] = {
gsDPPipeSync(),
@@ -2278,7 +2259,6 @@ const Gfx dl_ia_text_end[] = {
gsDPSetTextureFilter(G_TF_BILERP),
gsSPEndDisplayList(),
};
#endif
// 0x0200EF30 - 0x0200EF60
static const Vtx vertex_triangle[] = {

View File

@@ -1,8 +1,8 @@
diff --git a/include/text_strings.h.in b/include/text_strings.h.in
index 8ccc6b1..d2bb516 100644
index 711d4562..f1c83171 100644
--- a/include/text_strings.h.in
+++ b/include/text_strings.h.in
@@ -33,6 +33,12 @@
@@ -93,6 +93,12 @@
#define TEXT_HUD_WIDE_INFO _("PLEASE CONFIGURE YOUR DISPLAY OR YOUR EMULATOR TO\nSTRETCH THE IMAGE TO 16:9")
#endif
@@ -16,7 +16,7 @@ index 8ccc6b1..d2bb516 100644
/**
diff --git a/src/game/camera.c b/src/game/camera.c
index dfcf16a..e56f8c0 100644
index 25b27983..2ff11930 100644
--- a/src/game/camera.c
+++ b/src/game/camera.c
@@ -98,6 +98,7 @@ Vec3f sPlayer2FocusOffset;
@@ -137,6 +137,10 @@ index dfcf16a..e56f8c0 100644
- if (gPlayer1Controller->buttonPressed & R_CBUTTONS) {
- s8DirModeYawOffset += DEGREES(45);
- play_sound_cbutton_side();
- }
- if (gPlayer1Controller->buttonPressed & L_CBUTTONS) {
- s8DirModeYawOffset -= DEGREES(45);
- play_sound_cbutton_side();
+ if ((gPlayer1Controller->buttonPressed & L_CBUTTONS) && !(gPlayer1Controller->buttonDown & R_TRIG)) {
+ s8DirModeBaseYaw -= DEGREES(45);
+ } else if ((gPlayer1Controller->buttonPressed & R_CBUTTONS) && !(gPlayer1Controller->buttonDown & R_TRIG)) {
@@ -144,10 +148,6 @@ index dfcf16a..e56f8c0 100644
+ } else if (gPlayer2Controller->rawStickX) {
+ s8DirModeBaseYaw += DEGREES(gPlayer2Controller->rawStickX * 4 / 64); // Analog camera support (Use the "Dual Analog" input mode in Parallel Launcher)
}
- if (gPlayer1Controller->buttonPressed & L_CBUTTONS) {
- s8DirModeYawOffset -= DEGREES(45);
- play_sound_cbutton_side();
- }
-#ifdef PARALLEL_LAKITU_CAM
- // extra functionality
- else if (gPlayer1Controller->buttonPressed & U_JPAD) {
@@ -156,6 +156,9 @@ index dfcf16a..e56f8c0 100644
- }
- else if (gPlayer1Controller->buttonDown & L_JPAD) {
- s8DirModeYawOffset -= DEGREES(2);
- }
- else if (gPlayer1Controller->buttonDown & R_JPAD) {
- s8DirModeYawOffset += DEGREES(2);
+
+ if (gPlayer1Controller->buttonDown & R_TRIG) {
+ if (gPlayer1Controller->buttonDown & L_CBUTTONS) {
@@ -184,14 +187,11 @@ index dfcf16a..e56f8c0 100644
+ } else {
+ rButtonCounter2++;
}
- else if (gPlayer1Controller->buttonDown & R_JPAD) {
- s8DirModeYawOffset += DEGREES(2);
- else if (gPlayer1Controller->buttonPressed & D_JPAD) {
- s8DirModeYawOffset = s8DirModeYawOffset&0xE000;
+ if (gPlayer1Controller->buttonPressed & D_JPAD) {
+ s8DirModeBaseYaw = (s8DirModeBaseYaw + 0x1000) & 0xE000; // Lock the camera to the nearest 45deg axis
}
- else if (gPlayer1Controller->buttonPressed & D_JPAD) {
- s8DirModeYawOffset = s8DirModeYawOffset&0xE000;
- }
-#endif
lakitu_zoom(400.f, 0x900);
@@ -216,7 +216,7 @@ index dfcf16a..e56f8c0 100644
handle_c_button_movement(c);
vec3f_get_dist_and_angle(sMarioCamState->pos, c->pos, &dist, &pitch, &yaw);
@@ -3036,20 +3097,21 @@ void update_lakitu(struct Camera *c) {
@@ -3036,6 +3097,8 @@ void update_lakitu(struct Camera *c) {
void update_camera(struct Camera *c) {
UNUSED u8 unused[24];
@@ -224,7 +224,8 @@ index dfcf16a..e56f8c0 100644
+
gCamera = c;
update_camera_hud_status(c);
if (c->cutscene == 0) {
if (c->cutscene == 0 &&
@@ -3046,14 +3109,13 @@ void update_camera(struct Camera *c) {
// Only process R_TRIG if 'fixed' is not selected in the menu
if (cam_select_alt_mode(0) == CAM_SELECTION_MARIO) {
if (gPlayer1Controller->buttonPressed & R_TRIG) {
@@ -242,7 +243,15 @@ index dfcf16a..e56f8c0 100644
}
// Initialize the camera
@@ -4849,15 +4911,15 @@ void play_camera_buzz_if_c_sideways(void) {
@@ -3356,7 +3418,6 @@ void init_camera(struct Camera *c) {
struct Surface *floor = 0;
Vec3f marioOffset;
s32 i;
-
sCreditsPlayer2Pitch = 0;
sCreditsPlayer2Yaw = 0;
gPrevLevel = gCurrLevelArea / 16;
@@ -4901,15 +4962,15 @@ void play_camera_buzz_if_c_sideways(void) {
}
void play_sound_cbutton_up(void) {
@@ -261,7 +270,7 @@ index dfcf16a..e56f8c0 100644
}
void play_sound_button_change_blocked(void) {
@@ -4961,7 +5023,7 @@ s32 radial_camera_input(struct Camera *c, UNUSED f32 unused) {
@@ -5013,7 +5074,7 @@ s32 radial_camera_input(struct Camera *c, UNUSED f32 unused) {
}
// Zoom in / enter C-Up
@@ -270,7 +279,7 @@ index dfcf16a..e56f8c0 100644
if (gCameraMovementFlags & CAM_MOVE_ZOOMED_OUT) {
gCameraMovementFlags &= ~CAM_MOVE_ZOOMED_OUT;
play_sound_cbutton_up();
@@ -4971,7 +5033,7 @@ s32 radial_camera_input(struct Camera *c, UNUSED f32 unused) {
@@ -5023,7 +5084,7 @@ s32 radial_camera_input(struct Camera *c, UNUSED f32 unused) {
}
// Zoom out
@@ -279,7 +288,7 @@ index dfcf16a..e56f8c0 100644
if (gCameraMovementFlags & CAM_MOVE_ZOOMED_OUT) {
gCameraMovementFlags |= CAM_MOVE_ALREADY_ZOOMED_OUT;
#ifndef VERSION_JP
@@ -4983,6 +5045,12 @@ s32 radial_camera_input(struct Camera *c, UNUSED f32 unused) {
@@ -5035,6 +5096,12 @@ s32 radial_camera_input(struct Camera *c, UNUSED f32 unused) {
}
}
@@ -292,7 +301,7 @@ index dfcf16a..e56f8c0 100644
//! returning uninitialized variable
return dummy;
}
@@ -5548,7 +5616,7 @@ void set_camera_mode_8_directions(struct Camera *c) {
@@ -5600,7 +5667,7 @@ void set_camera_mode_8_directions(struct Camera *c) {
if (c->mode != CAMERA_MODE_8_DIRECTIONS) {
c->mode = CAMERA_MODE_8_DIRECTIONS;
sStatusFlags &= ~CAM_FLAG_SMOOTH_MOVEMENT;
@@ -302,10 +311,10 @@ index dfcf16a..e56f8c0 100644
}
}
diff --git a/src/game/game_init.c b/src/game/game_init.c
index 8693507..fb8729d 100644
index 317e33bf..6687016d 100644
--- a/src/game/game_init.c
+++ b/src/game/game_init.c
@@ -49,6 +49,11 @@ u8 gBorderHeight;
@@ -51,6 +51,11 @@ u8 gBorderHeight;
#ifdef CUSTOM_DEBUG
u8 gCustomDebugMode;
#endif
@@ -317,7 +326,7 @@ index 8693507..fb8729d 100644
#ifdef EEP
s8 gEepromProbe;
#endif
@@ -725,6 +730,7 @@ void thread5_game_loop(UNUSED void *arg) {
@@ -739,6 +744,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,12 +335,12 @@ index 8693507..fb8729d 100644
gWidescreen = save_file_get_widescreen_mode();
#endif
diff --git a/src/game/game_init.h b/src/game/game_init.h
index f3f650c..fdf20b6 100644
index 84a31755..817c58df 100644
--- a/src/game/game_init.h
+++ b/src/game/game_init.h
@@ -45,6 +45,10 @@ extern u8 gIsConsole;
#ifdef WIDE
extern u8 gWidescreen;
extern s16 gWidescreen;
#endif
+extern u8 gCameraSpeed;
+extern u8 gWaterCamOverride;
@@ -341,12 +350,12 @@ index f3f650c..fdf20b6 100644
#ifdef CUSTOM_DEBUG
extern u8 gCustomDebugMode;
diff --git a/src/game/ingame_menu.c b/src/game/ingame_menu.c
index 158154c..9ffefec 100644
index 6cbfd8e1..01dd4de8 100644
--- a/src/game/ingame_menu.c
+++ b/src/game/ingame_menu.c
@@ -38,6 +38,12 @@ u8 textPressL[] = { TEXT_HUD_PRESS_L };
u8 textWideInfo[] = { TEXT_HUD_WIDE_INFO };
#endif
@@ -59,6 +59,12 @@ void *languageTable[][3] =
#endif
};
+u8 textCamInfoSlowest[] = { TEXT_CAM_INFO_SLOWEST };
+u8 textCamInfoSlow[] = { TEXT_CAM_INFO_SLOW };
@@ -357,7 +366,7 @@ index 158154c..9ffefec 100644
extern u8 gLastCompletedCourseNum;
extern u8 gLastCompletedStarNum;
@@ -1434,6 +1440,45 @@ void reset_red_coins_collected(void) {
@@ -1504,6 +1510,45 @@ void reset_red_coins_collected(void) {
gRedCoinsCollected = 0;
}
@@ -403,9 +412,9 @@ index 158154c..9ffefec 100644
void change_dialog_camera_angle(void) {
if (cam_select_alt_mode(0) == CAM_SELECTION_MARIO) {
gDialogCameraAngleIndex = CAM_SELECTION_MARIO;
@@ -1866,6 +1911,11 @@ s16 render_pause_courses_and_castle(void) {
@@ -1942,6 +1987,11 @@ s16 render_pause_courses_and_castle(void) {
}
#ifdef WIDE
#if defined(WIDE) && !defined(PUPPYCAM)
render_widescreen_setting();
+ render_camera_speed_setting();
+ if (gPlayer1Controller->buttonPressed & L_TRIG){
@@ -416,10 +425,10 @@ index 158154c..9ffefec 100644
if (gDialogTextAlpha < 250) {
gDialogTextAlpha += 25;
diff --git a/src/game/mario.c b/src/game/mario.c
index c0b5f76..b6da9d4 100644
index 31e97bce..29b5e9c4 100644
--- a/src/game/mario.c
+++ b/src/game/mario.c
@@ -1460,32 +1460,39 @@ void update_mario_inputs(struct MarioState *m) {
@@ -1468,32 +1468,39 @@ void update_mario_inputs(struct MarioState *m) {
void set_submerged_cam_preset_and_spawn_bubbles(struct MarioState *m) {
f32 heightBelowWater;
s16 camPreset;
@@ -481,7 +490,7 @@ index c0b5f76..b6da9d4 100644
}
diff --git a/src/game/mario_actions_airborne.c b/src/game/mario_actions_airborne.c
index ce6467e..c7e998c 100644
index ce6467ef..c7e998c1 100644
--- a/src/game/mario_actions_airborne.c
+++ b/src/game/mario_actions_airborne.c
@@ -1736,6 +1736,10 @@ s32 act_shot_from_cannon(struct MarioState *m) {
@@ -526,10 +535,10 @@ index ce6467e..c7e998c 100644
}
diff --git a/src/game/save_file.c b/src/game/save_file.c
index b27d869..7fbf045 100644
index bcdcdbaf..3f0b8ca1 100644
--- a/src/game/save_file.c
+++ b/src/game/save_file.c
@@ -634,6 +634,12 @@ u8 save_file_get_widescreen_mode(void) {
@@ -673,6 +673,12 @@ u8 save_file_get_widescreen_mode(void) {
return gSaveBuffer.menuData[0].wideMode;
}
@@ -542,7 +551,7 @@ index b27d869..7fbf045 100644
void save_file_set_widescreen_mode(u8 mode) {
gSaveBuffer.menuData[0].wideMode = mode;
@@ -646,6 +652,10 @@ u16 save_file_get_sound_mode(void) {
@@ -685,6 +691,10 @@ u16 save_file_get_sound_mode(void) {
return gSaveBuffer.menuData[0].soundMode;
}
@@ -554,10 +563,10 @@ 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 3ac0c4d..d46a7e1 100644
index 64cf0c63..085ec1d9 100644
--- a/src/game/save_file.h
+++ b/src/game/save_file.h
@@ -62,6 +62,7 @@ struct MainMenuSaveData
@@ -63,6 +63,7 @@ struct MainMenuSaveData
#ifdef WIDE
u8 wideMode: 1;
#endif
@@ -565,7 +574,7 @@ index 3ac0c4d..d46a7e1 100644
#ifdef VERSION_EU
u8 language: 2;
@@ -167,6 +168,8 @@ u16 save_file_get_sound_mode(void);
@@ -178,6 +179,8 @@ u16 save_file_get_sound_mode(void);
u8 save_file_get_widescreen_mode(void);
void save_file_set_widescreen_mode(u8 mode);
#endif

View File

@@ -1,46 +0,0 @@
OUTPUT_ARCH (mips)
#define BEGIN_SEG(name, addr) \
_##name##SegmentStart = ADDR(.name); \
_##name##SegmentRomStart = __romPos; \
.name addr : AT(__romPos)
#define END_SEG(name) \
_##name##SegmentEnd = ADDR(.name) + SIZEOF(.name); \
_##name##SegmentRomEnd = __romPos + SIZEOF(.name); \
__romPos += SIZEOF(.name);
#define BEGIN_NOLOAD(name) \
_##name##SegmentBssStart = ADDR(.name.noload); \
.name.noload (NOLOAD) :
#define END_NOLOAD(name) \
_##name##SegmentBssEnd = ADDR(.name.noload) + SIZEOF(.name.noload); \
_##name##SegmentBssSize = SIZEOF(.name.noload);
SECTIONS {
__romPos = 0;
SEG_GODDARD = 0x80345670;
BEGIN_SEG(goddard, SEG_GODDARD)
{
#define LOAD
#include "goddard.ld.inc"
#undef LOAD
. = ALIGN(16);
}
END_SEG(goddard)
BEGIN_NOLOAD(goddard) {
#define NOLOAD
#include "goddard.ld.inc"
#undef NOLOAD
. = ALIGN(16);
}
END_NOLOAD(goddard)
GODDARD_SIZE = SIZEOF(.goddard) + SIZEOF(.goddard.noload);
/DISCARD/ :
{
*(*);
}
}

View File

@@ -1,41 +0,0 @@
#ifdef LOAD
KEEP(BUILD_DIR/src/menu*.o(.text));
KEEP(BUILD_DIR/src/menu*.o(.data*));
KEEP(BUILD_DIR/src/menu*.o(.rodata*));
#ifdef KEEP_MARIO_HEAD
KEEP(BUILD_DIR/libgoddard.a:*.o(.text));
KEEP(BUILD_DIR/libgoddard.a:gd_main.o(.data*));
KEEP(BUILD_DIR/libgoddard.a:draw_objects.o(.data*));
KEEP(BUILD_DIR/libgoddard.a:objects.o(.data*));
KEEP(BUILD_DIR/libgoddard.a:particles.o(.data*));
KEEP(BUILD_DIR/libgoddard.a:dynlist_proc.o(.data*));
KEEP(BUILD_DIR/libgoddard.a:debug_utils.o(.data*));
KEEP(BUILD_DIR/libgoddard.a:joints.o(.data*));
KEEP(BUILD_DIR/libgoddard.a:shape_helper.o(.data*));
KEEP(BUILD_DIR/libgoddard.a:renderer.o(.data*));
KEEP(BUILD_DIR/libgoddard.a:gd_main.o(.rodata*));
KEEP(BUILD_DIR/libgoddard.a:gd_memory.o(.rodata*));
KEEP(BUILD_DIR/libgoddard.a:draw_objects.o(.rodata*));
KEEP(BUILD_DIR/libgoddard.a:objects.o(.rodata*));
KEEP(BUILD_DIR/libgoddard.a:skin_movement.o(.rodata*));
KEEP(BUILD_DIR/libgoddard.a:particles.o(.rodata*));
KEEP(BUILD_DIR/libgoddard.a:dynlist_proc.o(.rodata*));
KEEP(BUILD_DIR/libgoddard.a:old_menu.o(.rodata*));
KEEP(BUILD_DIR/libgoddard.a:debug_utils.o(.rodata*));
KEEP(BUILD_DIR/libgoddard.a:joints.o(.rodata*));
KEEP(BUILD_DIR/libgoddard.a:skin.o(.rodata*));
KEEP(BUILD_DIR/libgoddard.a:gd_math.o(.rodata*));
KEEP(BUILD_DIR/libgoddard.a:shape_helper.o(.rodata*));
KEEP(BUILD_DIR/libgoddard.a:renderer.o(.rodata*));
#endif
#endif
#ifdef NOLOAD
KEEP(BUILD_DIR/src/menu*.o(.bss*));
#ifdef KEEP_MARIO_HEAD
KEEP(BUILD_DIR/libgoddard.a:*.o(.bss*));
#endif
#endif

View File

@@ -1,6 +1,6 @@
#ifndef CONFIG_H
#define CONFIG_H
// ULTRASM64-EXTBOUNDS CONFIG FLAGS NEAR BOTTOM
// HACKERSM64 CONFIG DEFINES NEAR BOTTOM
/**
* @file config.h
* A catch-all file for configuring various bugfixes and other settings (maybe eventually) in SM64
@@ -52,7 +52,7 @@
#endif
// -- ultrasm64-extbounds specific settings --
// -- HackerSM64 specific settings --
// TEST LEVEL
// Uncomment this define and set a test level in order to boot straight into said level.
@@ -98,11 +98,13 @@
#define PARALLEL_LAKITU_CAM
// Allows Mario to ledgegrab sloped floors
#define NO_FALSE_LEDGEGRABS
//Adds multiple languages to the game. Just a placeholder for the most part, because it only works with EU, and must be enabled with EU.
#define MULTILANG (0 || VERSION_EU)
//Enables Puppy Camera 2, a rewritten camera that can be freely configured and modified.
//#define PUPPYCAM
// HACKER QOL
// HACKER QOL
// Increase the maximum pole length (it will treat bparam1 and bparam2 as a single value)
#define LONGER_POLES
// Number of possible unique model ID's (keep it higher than 256)
@@ -115,7 +117,7 @@
//#define CUSTOM_DEBUG
// Include Puppyprint, a display library for text and large images. Also includes a custom, enhanced performance profiler.
//#define PUPPYPRINT
#define PUPPYPRINT_DEBUG 0
//#define PUPPYPRINT_DEBUG 0
// BUG/GAME QOL FIXES
// Fix instant warp offset not working when warping across different areas

View File

@@ -4,7 +4,8 @@
// EU changes most text to arrays for each language. This define allows these
// differences to be combined.
#ifdef VERSION_EU
#define LANGUAGE_ARRAY(cmd) cmd[LANGUAGE_FUNCTION]
//#define LANGUAGE_ARRAY(cmd) cmd[LANGUAGE_FUNCTION]
#define LANGUAGE_ARRAY(cmd) cmd
#else
#define LANGUAGE_ARRAY(cmd) cmd
#endif

View File

@@ -3,12 +3,10 @@
#include "text_menu_strings.h"
#ifdef PUPPYCAM
#if defined(PUPPYCAM)
#define NC_CAMX_EN _("Camera X Sensitivity")
#define NC_CAMY_EN _("Camera Y Sensitivity")
#define NC_INVERTX_EN _("Invert X Axis")
#define NC_INVERTX_FR _("Invertir Axe X")
#define NC_INVERTX_DE _("Invert X Axis")
#define NC_INVERTY_EN _("Invert Y Axis")
#define NC_CAMC_EN _("Camera Centre Speed")
#define NC_ANALOGUE_EN _("Analogue Camera")
@@ -18,59 +16,50 @@
#define OPTION_SCHEME1_EN _("Double Tap")
#define OPTION_SCHEME2_EN _("Single Press")
#define OPTION_SCHEME3_EN _("Classic")
#define OPTION_LANGUAGE_EN _("Language")
#define NC_WIDE_EN _("Widescreen")
#define NC_HIGHLIGHT_L _(">")
#define NC_HIGHLIGHT_R _("<")
#define NC_BUTTON_EN _("[R]: Options")
#define NC_BUTTON2_EN _("[R]: Return")
#define NC_OPTION_EN _("PUPPYCAM OPTIONS")
#define NC_OPTION_EN _("OPTIONS")
#if defined(VERSION_EU)
#if MULTILANG
#define NC_CAMX_FR _("Sensibilite sur l'axe X")
#define NC_CAMX_DE _("Camera X Sensitivity")
#define NC_CAMY_FR _("Sensibilite sur l'axe Y")
#define NC_CAMY_DE _("Camera Y Sensitivity")
#define NC_INVERTX_FR _("Invertir Axe X")
#define NC_INVERTY_FR _("Invertir Axe Y")
#define NC_INVERTY_DE _("Invert Y Axis")
#define NC_CAMC_FR _("Vitesse de Centrage")
#define NC_CAMC_DE _("Camera Centre Speed")
#define NC_ANALOGUE_FR _("Camera Analogue")
#define NC_ANALOGUE_DE _("Analogue Camera")
#define NC_SCHEME_FR _("Control Scheme")
#define NC_SCHEME_DE _("Control Scheme")
#define OPTION_ENABLED_FR _("Active")
#define OPTION_DISABLED_FR _("Desactive")
#define OPTION_SCHEME1_FR _("Double Tap")
#define OPTION_SCHEME2_FR _("Single Press")
#define OPTION_SCHEME3_FR _("Classic")
#define OPTION_LANGUAGE_FR _("Language")
#define NC_WIDE_FR _("Widescreen")
#define NC_BUTTON_FR _("[R]: Options")
#define NC_BUTTON2_FR _("[R]: Retournez")
#define NC_OPTION_FR _("OPTIONS")
#define NC_CAMX_DE _("Camera X Sensitivity")
#define NC_CAMY_DE _("Camera Y Sensitivity")
#define NC_INVERTY_DE _("Invert Y Axis")
#define NC_INVERTX_DE _("Invert X Axis")
#define NC_CAMC_DE _("Camera Centre Speed")
#define NC_ANALOGUE_DE _("Analogue Camera")
#define NC_SCHEME_DE _("Control Scheme")
#define OPTION_ENABLED_DE _("Enabled")
#define OPTION_DISABLED_DE _("Disabled")
#define OPTION_SCHEME1_DE _("Double Tap")
#define OPTION_SCHEME2_DE _("Single Press")
#define OPTION_SCHEME3_DE _("Classic")
#define OPTION_LANGUAGE_DE _("Language")
#define NC_WIDE_DE _("Widescreen")
#define OPTION_ENABLED_FR _("Active")
#define OPTION_ENABLED_DE _("Enabled")
#define OPTION_DISABLED_FR _("Desactive")
#define OPTION_DISABLED_DE _("Disabled")
#define OPTION_SCHEME1_FR _("Double Tap")
#define OPTION_SCHEME1_DE _("Double Tap")
#define OPTION_SCHEME2_FR _("Single Press")
#define OPTION_SCHEME2_DE _("Single Press")
#define OPTION_SCHEME3_FR _("Classic")
#define OPTION_SCHEME3_DE _("Classic")
#define NC_BUTTON_FR _("[R]: Options")
#define NC_BUTTON_DE _("[R]: Options")
#define NC_BUTTON2_FR _("[R]: Retournez")
#define NC_BUTTON2_DE _("[R]: Return")
#define NC_OPTION_FR _("OPTIONS PUPPYCAM")
#define NC_OPTION_DE _("PUPPYCAM OPTIONS")
#define NC_BUTTON_DE _("[R]: Options")
#define NC_BUTTON2_DE _("[R]: Return")
#define NC_OPTION_DE _("OPTIONS")
#endif
#endif
@@ -97,11 +86,10 @@
#define TEXT_HUD_CONGRATULATIONS _("CONGRATULATIONS") // Course Complete Text, Bowser Courses
//Widescreen stuff
#ifdef WIDE
#if defined(WIDE) && !defined(PUPPYCAM)
#define TEXT_HUD_CURRENT_RATIO_43 _("ASPECT RATIO: 4:3")
#define TEXT_HUD_CURRENT_RATIO_169 _("ASPECT RATIO: 16:9")
#define TEXT_HUD_PRESS_L _("PRESS L TO SWITCH")
#define TEXT_HUD_WIDE_INFO _("PLEASE CONFIGURE YOUR DISPLAY OR YOUR EMULATOR TO\nSTRETCH THE IMAGE TO 16:9")
#endif
#if defined(VERSION_JP) || defined(VERSION_SH)
@@ -303,7 +291,12 @@
#endif
#ifdef VERSION_EU
#define TEXT_ENGLISH _("ENGLISH")
#define TEXT_FRENCH _("FRANÇAIS")
#define TEXT_GERMAN _("DEUTSCH")
#if MULTILANG
/**
* File Select Text
@@ -387,10 +380,6 @@
#define TEXT_MONO_DE _("MONO")
#define TEXT_HEADSET_DE _("PHONES")
#define TEXT_ENGLISH _("ENGLISH")
#define TEXT_FRENCH _("FRANÇAIS")
#define TEXT_GERMAN _("DEUTSCH")
#define TEXT_HI_SCORE_FR _("MEILLEUR SCORE")
#define TEXT_HI_SCORE_DE _("BESTLEISTUNG")

View File

@@ -2,6 +2,7 @@
#define SCRIPTS_H
#include "types.h"
#include "game/puppycam2.h"
// scripts
extern const LevelScript level_main_scripts_entry[];

54
sm64.ld
View File

@@ -190,7 +190,9 @@ SECTIONS
lib/PR/hvqm/hvqm2sp1.o(.rodata*);
}
END_SEG(main)
ASSERT((_mainSegmentRomEnd <= 0x101000), "Error: Please shrink your main segment to under 1MB.")
#ifndef PRELIMINARY
ASSERT((_mainSegmentRomEnd <= 0x101000), "Error: Please shrink your main segment to under 1MB.")
#endif
BEGIN_NOLOAD(main)
{
BUILD_DIR/src/game*.o(.*bss*);
@@ -247,7 +249,9 @@ SECTIONS
__expansionRamStart = 0x80400000;
#ifndef USE_EXT_RAM
ASSERT((. <= __expansionRamStart), "Error: RDRAM expanded into Expansion RAM, despite Expansion RAM not being defined.")
#ifndef PRELIMINARY
ASSERT((. <= __expansionRamStart), "Error: RDRAM expanded into Expansion RAM, despite Expansion RAM not being defined.")
#endif
#endif
BEGIN_SEG(entry, 0x10000000)
@@ -300,22 +304,54 @@ SECTIONS
/* 0x8016F000 21D7D0-255EC0 [386F0] */
BEGIN_SEG(goddard, RAM_END - GODDARD_SIZE)
{
#define LOAD
#include "goddard.ld.inc"
#undef LOAD
KEEP(BUILD_DIR/src/menu*.o(.text));
KEEP(BUILD_DIR/src/menu*.o(.data*));
KEEP(BUILD_DIR/src/menu*.o(.rodata*));
#ifdef KEEP_MARIO_HEAD
KEEP(BUILD_DIR/libgoddard.a:*.o(.text));
KEEP(BUILD_DIR/libgoddard.a:gd_main.o(.data*));
KEEP(BUILD_DIR/libgoddard.a:draw_objects.o(.data*));
KEEP(BUILD_DIR/libgoddard.a:objects.o(.data*));
KEEP(BUILD_DIR/libgoddard.a:particles.o(.data*));
KEEP(BUILD_DIR/libgoddard.a:dynlist_proc.o(.data*));
KEEP(BUILD_DIR/libgoddard.a:debug_utils.o(.data*));
KEEP(BUILD_DIR/libgoddard.a:joints.o(.data*));
KEEP(BUILD_DIR/libgoddard.a:shape_helper.o(.data*));
KEEP(BUILD_DIR/libgoddard.a:renderer.o(.data*));
KEEP(BUILD_DIR/libgoddard.a:gd_main.o(.rodata*));
KEEP(BUILD_DIR/libgoddard.a:gd_memory.o(.rodata*));
KEEP(BUILD_DIR/libgoddard.a:draw_objects.o(.rodata*));
KEEP(BUILD_DIR/libgoddard.a:objects.o(.rodata*));
KEEP(BUILD_DIR/libgoddard.a:skin_movement.o(.rodata*));
KEEP(BUILD_DIR/libgoddard.a:particles.o(.rodata*));
KEEP(BUILD_DIR/libgoddard.a:dynlist_proc.o(.rodata*));
KEEP(BUILD_DIR/libgoddard.a:old_menu.o(.rodata*));
KEEP(BUILD_DIR/libgoddard.a:debug_utils.o(.rodata*));
KEEP(BUILD_DIR/libgoddard.a:joints.o(.rodata*));
KEEP(BUILD_DIR/libgoddard.a:skin.o(.rodata*));
KEEP(BUILD_DIR/libgoddard.a:gd_math.o(.rodata*));
KEEP(BUILD_DIR/libgoddard.a:shape_helper.o(.rodata*));
KEEP(BUILD_DIR/libgoddard.a:renderer.o(.rodata*));
#endif
. = ALIGN(16);
}
END_SEG(goddard)
BEGIN_NOLOAD(goddard)
{
#define NOLOAD
#include "goddard.ld.inc"
#undef NOLOAD
KEEP(BUILD_DIR/src/menu*.o(.bss*));
#ifdef KEEP_MARIO_HEAD
KEEP(BUILD_DIR/libgoddard.a:*.o(.bss*));
#endif
. = ALIGN(16);
}
END_NOLOAD(goddard)
ASSERT((. <= (SEG_POOL_START + POOL_SIZE)), "Error: extended past pool end.")
#ifndef PRELIMINARY
ASSERT((. <= (SEG_POOL_START + POOL_SIZE)), "Error: extended past pool end.")
#endif
#ifdef PRELIMINARY
GODDARD_SIZE = SIZEOF(.goddard) + SIZEOF(.goddard.noload);
#endif
/* 0x268020 0x268020-0 [0] */
BEGIN_SEG(intro, 0x14000000)

View File

@@ -116,8 +116,8 @@ extern u32 gAudioRandom;
#define EXT_AUDIO_INIT_POOL_SIZE 0x8000
#else
// EU and SH versions not yet supported for extended audio heap
#define EXT_AUDIO_HEAP_SIZE 0x0
#define EXT_AUDIO_INIT_POOL_SIZE 0x0
#define EXT_AUDIO_HEAP_SIZE 0x24400
#define EXT_AUDIO_INIT_POOL_SIZE 0x8000
#endif
#else
#define EXT_AUDIO_HEAP_SIZE 0x0

View File

@@ -1000,8 +1000,9 @@ void audio_init() {
}
#endif
D_EU_802298D0 = 20.03042f;
gRefreshRate = 50;
//D_EU_802298D0 = 20.03042f;
D_EU_802298D0 = 16.713f;
gRefreshRate = 60;
port_eu_init();
if (k) {
}

View File

@@ -10,13 +10,7 @@
#include "audio/synthesis.h"
ALIGNED8 u8 gDecompressionHeap[0xD000];
#if defined(VERSION_EU)
ALIGNED16 u8 gAudioHeap[DOUBLE_SIZE_ON_64_BIT(0x31200 + EXT_AUDIO_HEAP_SIZE + EXT_AUDIO_INIT_POOL_SIZE) - 0x3800];
#elif defined(VERSION_SH)
ALIGNED16 u8 gAudioHeap[DOUBLE_SIZE_ON_64_BIT(0x31200 + EXT_AUDIO_HEAP_SIZE + EXT_AUDIO_INIT_POOL_SIZE) - 0x4800];
#else
ALIGNED16 u8 gAudioHeap[DOUBLE_SIZE_ON_64_BIT(0x31200 + EXT_AUDIO_HEAP_SIZE + EXT_AUDIO_INIT_POOL_SIZE + BETTER_REVERB_SIZE)];
#endif
ALIGNED8 u8 gIdleThreadStack[0x800];
ALIGNED8 u8 gThread3Stack[0x2000];
@@ -26,9 +20,14 @@ ALIGNED8 u8 gThread5Stack[0x2000];
ALIGNED8 u8 gThread6Stack[0x2000];
#endif
// 0x400 bytes
ALIGNED8 u8 gGfxSPTaskStack[SP_DRAM_STACK_SIZE8];
#if UNF
ALIGNED16 u8 gGfxSPTaskStack[SP_DRAM_STACK_SIZE8];
ALIGNED16 u8 gGfxSPTaskYieldBuffer[OS_YIELD_DATA_SIZE];
#else
// 0xc00 bytes for f3dex, 0x900 otherwise
ALIGNED8 u8 gGfxSPTaskStack[SP_DRAM_STACK_SIZE8];
ALIGNED8 u8 gGfxSPTaskYieldBuffer[OS_YIELD_DATA_SIZE];
#endif // UNF
// 0x200 bytes
struct SaveBuffer __attribute__ ((aligned (8))) gSaveBuffer;
// 0x190a0 bytes

View File

@@ -210,7 +210,7 @@ void mtxf_lookat(Mat4 mtx, Vec3f from, Vec3f to, s16 roll) {
dx = to[0] - from[0];
dz = to[2] - from[2];
invLength = -1.0 / sqrtf(dx * dx + dz * dz);
invLength = -1.0f / MAX(sqrtf(dx * dx + dz * dz), 0.00001f);
dx *= invLength;
dz *= invLength;
@@ -222,7 +222,7 @@ void mtxf_lookat(Mat4 mtx, Vec3f from, Vec3f to, s16 roll) {
yColZ = to[1] - from[1];
zColZ = to[2] - from[2];
invLength = -1.0 / sqrtf(xColZ * xColZ + yColZ * yColZ + zColZ * zColZ);
invLength = -1.0f / MAX(sqrtf(xColZ * xColZ + yColZ * yColZ + zColZ * zColZ), 0.00001f);
xColZ *= invLength;
yColZ *= invLength;
zColZ *= invLength;
@@ -231,7 +231,7 @@ void mtxf_lookat(Mat4 mtx, Vec3f from, Vec3f to, s16 roll) {
yColX = zColY * xColZ - xColY * zColZ;
zColX = xColY * yColZ - yColY * xColZ;
invLength = 1.0 / sqrtf(xColX * xColX + yColX * yColX + zColX * zColX);
invLength = 1.0f / MAX(sqrtf(xColX * xColX + yColX * yColX + zColX * zColX), 0.00001f);
xColX *= invLength;
yColX *= invLength;
@@ -241,7 +241,7 @@ void mtxf_lookat(Mat4 mtx, Vec3f from, Vec3f to, s16 roll) {
yColY = zColZ * xColX - xColZ * zColX;
zColY = xColZ * yColX - yColZ * xColX;
invLength = 1.0 / sqrtf(xColY * xColY + yColY * yColY + zColY * zColY);
invLength = 1.0f / MAX(sqrtf(xColY * xColY + yColY * yColY + zColY * zColY), 0.00001f);
xColY *= invLength;
yColY *= invLength;
zColY *= invLength;
@@ -575,7 +575,7 @@ void mtxf_mul_vec3s(Mat4 mtx, Vec3s b) {
void mtxf_to_mtx(Mtx *dest, Mat4 src) {
Mat4 temp;
register s32 i, j;
for( i = 0; i < 4; i++ ) {
for( j = 0; j < 3; j++ ) {
temp[i][j] = src[i][j] / WORLD_SCALE;

View File

@@ -184,10 +184,10 @@ s32 f32_find_wall_collision(f32 *xPtr, f32 *yPtr, f32 *zPtr, f32 offsetY, f32 ra
*/
s32 find_wall_collisions(struct WallCollisionData *colData) {
struct SurfaceNode *node;
s16 cellX, cellZ;
s32 cellX, cellZ;
s32 numCollisions = 0;
s16 x = colData->x;
s16 z = colData->z;
s32 x = colData->x;
s32 z = colData->z;
#ifdef PUPPYPRINT
OSTime first = osGetTime();
#endif
@@ -271,7 +271,7 @@ static struct Surface *find_ceil_from_list(struct SurfaceNode *surfaceNode, s32
nx = surf->normal.x;
ny = surf->normal.y;
nz = surf->normal.z;
oo = surf->originOffset;
oo = surf->originOffset;
// If a wall, ignore it. Likely a remnant, should never occur.
if (ny == 0.0f) {
continue;
@@ -301,22 +301,19 @@ static struct Surface *find_ceil_from_list(struct SurfaceNode *surfaceNode, s32
* Find the lowest ceiling above a given position and return the height.
*/
f32 find_ceil(f32 posX, f32 posY, f32 posZ, struct Surface **pceil) {
s16 cellZ, cellX;
s32 cellZ, cellX;
struct Surface *ceil, *dynamicCeil;
struct SurfaceNode *surfaceList;
f32 height = CELL_HEIGHT_LIMIT;
f32 dynamicHeight = CELL_HEIGHT_LIMIT;
s16 x, y, z;
s32 x, y, z;
#ifdef PUPPYPRINT
OSTime first = osGetTime();
#endif
//! (Parallel Universes) Because position is casted to an s16, reaching higher
// float locations can return ceilings despite them not existing there.
//(Dynamic ceilings will unload due to the range.)
x = (s16) posX;
y = (s16) posY;
z = (s16) posZ;
x = posX;
y = posY;
z = posZ;
*pceil = NULL;
if (x <= -LEVEL_BOUNDARY_MAX || x >= LEVEL_BOUNDARY_MAX) {
@@ -491,17 +488,17 @@ static f32 get_floor_height_at_location(s32 x, s32 z, struct Surface *surf) {
* Iterate through the list of water floors and find the first water floor under a given point.
*/
struct Surface *find_water_floor_from_list(struct SurfaceNode *surfaceNode, s32 x, s32 y, s32 z,
f32 *pheight) {
s32 *pheight) {
register struct Surface *surf;
struct Surface *floor = NULL;
struct SurfaceNode *topSurfaceNode = surfaceNode;
struct SurfaceNode *bottomSurfaceNode = surfaceNode;
f32 height = FLOOR_LOWER_LIMIT;
f32 bottomHeight = FLOOR_LOWER_LIMIT;
s32 height = FLOOR_LOWER_LIMIT;
s32 bottomHeight = FLOOR_LOWER_LIMIT;
// Iterate through the list of water floors until there are no more water floors.
while (bottomSurfaceNode != NULL) {
f32 curBottomHeight = FLOOR_LOWER_LIMIT;
s32 curBottomHeight = FLOOR_LOWER_LIMIT;
surf = bottomSurfaceNode->surface;
bottomSurfaceNode = bottomSurfaceNode->next;
@@ -515,7 +512,7 @@ struct Surface *find_water_floor_from_list(struct SurfaceNode *surfaceNode, s32
// Iterate through the list of water tops until there are no more water tops.
while (topSurfaceNode != NULL) {
f32 curHeight = FLOOR_LOWER_LIMIT;
s32 curHeight = FLOOR_LOWER_LIMIT;
surf = topSurfaceNode->surface;
topSurfaceNode = topSurfaceNode->next;
@@ -556,13 +553,13 @@ f32 unused_find_dynamic_floor(f32 xPos, f32 yPos, f32 zPos, struct Surface **pfl
f32 floorHeight = FLOOR_LOWER_LIMIT;
// Would normally cause PUs, but dynamic floors unload at that range.
s16 x = (s16) xPos;
s16 y = (s16) yPos;
s16 z = (s16) zPos;
s32 x = xPos;
s32 y = yPos;
s32 z = zPos;
// Each level is split into cells to limit load, find the appropriate cell.
s16 cellX = ((x + LEVEL_BOUNDARY_MAX) / CELL_SIZE) & NUM_CELLS_INDEX;
s16 cellZ = ((z + LEVEL_BOUNDARY_MAX) / CELL_SIZE) & NUM_CELLS_INDEX;
s32 cellX = ((x + LEVEL_BOUNDARY_MAX) / CELL_SIZE) & NUM_CELLS_INDEX;
s32 cellZ = ((z + LEVEL_BOUNDARY_MAX) / CELL_SIZE) & NUM_CELLS_INDEX;
surfaceList = gDynamicSurfacePartition[cellZ][cellX][SPATIAL_PARTITION_FLOORS].next;
floor = find_floor_from_list(surfaceList, x, y, z, &floorHeight);
@@ -576,7 +573,7 @@ f32 unused_find_dynamic_floor(f32 xPos, f32 yPos, f32 zPos, struct Surface **pfl
* Find the highest floor under a given position and return the height.
*/
f32 find_floor(f32 xPos, f32 yPos, f32 zPos, struct Surface **pfloor) {
s16 cellZ, cellX;
s32 cellZ, cellX;
#ifdef PUPPYPRINT
OSTime first = osGetTime();
#endif
@@ -590,9 +587,9 @@ f32 find_floor(f32 xPos, f32 yPos, f32 zPos, struct Surface **pfloor) {
//! (Parallel Universes) Because position is casted to an s16, reaching higher
// float locations can return floors despite them not existing there.
//(Dynamic floors will unload due to the range.)
s16 x = (s16) xPos;
s16 y = (s16) yPos;
s16 z = (s16) zPos;
s32 x = xPos;
s32 y = yPos;
s32 z = zPos;
*pfloor = NULL;
@@ -662,17 +659,17 @@ f32 find_floor(f32 xPos, f32 yPos, f32 zPos, struct Surface **pfloor) {
/**
* Find the highest water floor under a given position and return the height.
*/
f32 find_water_floor(f32 xPos, f32 yPos, f32 zPos, struct Surface **pfloor) {
s16 cellZ, cellX;
s32 find_water_floor(s32 xPos, s32 yPos, s32 zPos, struct Surface **pfloor) {
s32 cellZ, cellX;
struct Surface *floor = NULL;
struct SurfaceNode *surfaceList;
f32 height = FLOOR_LOWER_LIMIT;
s32 height = FLOOR_LOWER_LIMIT;
s16 x = (s16) xPos;
s16 y = (s16) yPos;
s16 z = (s16) zPos;
s32 x = xPos;
s32 y = yPos;
s32 z = zPos;
if (x <= -LEVEL_BOUNDARY_MAX || x >= LEVEL_BOUNDARY_MAX) {
return height;
@@ -705,7 +702,7 @@ f32 find_water_floor(f32 xPos, f32 yPos, f32 zPos, struct Surface **pfloor) {
/**
* Finds the height of water at a given location.
*/
f32 find_water_level_and_floor(f32 x, f32 z, struct Surface **pfloor) {
s32 find_water_level_and_floor(s32 x, s32 z, struct Surface **pfloor) {
s32 i;
s32 numRegions;
s32 val;
@@ -756,7 +753,7 @@ f32 find_water_level_and_floor(f32 x, f32 z, struct Surface **pfloor) {
/**
* Finds the height of water at a given location.
*/
f32 find_water_level(f32 x, f32 z) {
s32 find_water_level(s32 x, s32 z) {
s32 i;
s32 numRegions;
s32 val;
@@ -805,7 +802,7 @@ f32 find_water_level(f32 x, f32 z) {
/**
* Finds the height of the poison gas (used only in HMC) at a given location.
*/
f32 find_poison_gas_level(f32 x, f32 z) {
s32 find_poison_gas_level(s32 x, s32 z) {
s32 i;
s32 numRegions;
s32 val;

View File

@@ -11,7 +11,7 @@
#define CELL_HEIGHT_LIMIT 20000
#define FLOOR_LOWER_LIMIT -11000
#define FLOOR_LOWER_LIMIT_MISC (FLOOR_LOWER_LIMIT + 1000)
// same as FLOOR_LOWER_LIMIT_MISC, explicitly for shadow.c
// same as FLOOR_LOWER_LIMIT_MISC, explicitly for shadow.c
// It doesn't match if ".0" is removed or ".f" is added
#define FLOOR_LOWER_LIMIT_SHADOW (FLOOR_LOWER_LIMIT + 1000.0)
@@ -40,9 +40,9 @@ f32 find_ceil(f32 posX, f32 posY, f32 posZ, struct Surface **pceil);
f32 find_floor_height_and_data(f32 xPos, f32 yPos, f32 zPos, struct FloorGeometry **floorGeo);
f32 find_floor_height(f32 x, f32 y, f32 z);
f32 find_floor(f32 xPos, f32 yPos, f32 zPos, struct Surface **pfloor);
f32 find_water_level_and_floor(f32 x, f32 z, struct Surface **pfloor);
f32 find_water_level(f32 x, f32 z);
f32 find_poison_gas_level(f32 x, f32 z);
s32 find_water_level_and_floor(s32 x, s32 z, struct Surface **pfloor);
s32 find_water_level(s32 x, s32 z);
s32 find_poison_gas_level(s32 x, s32 z);
void debug_surface_list_info(f32 xPos, f32 zPos);
#endif // SURFACE_COLLISION_H

View File

@@ -3509,6 +3509,9 @@ void init_camera(struct Camera *c) {
gLakituState.nextYaw = gLakituState.yaw;
c->yaw = gLakituState.yaw;
c->nextYaw = gLakituState.yaw;
#ifdef CAMERA_FIX
set_camera_mode(c, CAMERA_MODE_8_DIRECTIONS, 0);
#endif
#ifdef PUPPYCAM
puppycam_init();
#endif

Some files were not shown because too many files have changed in this diff Show More