Merge branch 'master' into puppycamera2

This commit is contained in:
Fazana committed 2021-07-24 16:07:36 +01:00
commit 11af76e1a5
167 files changed
+18776 -2102

No files matched your search

+1
View File
@@ -74,6 +74,7 @@ build/*
# libultra
!/lib/*.a
lib/libs2d_engine.a
!/lib/gcclib/*.a
!/lib/gcclib/divbreak/*.a
!/lib/gcclib/nocheck/*.a
+27
View File
@@ -0,0 +1,27 @@
{
"configurations": [
{
"name": "Linux",
"includePath": [
"${workspaceFolder}/include/n64/**",
"${workspaceFolder}/include/**",
"${workspaceFolder}/textures/**",
"${workspaceFolder}/**"
],
"defines": [
"TARGET_N64=1",
"VERSION_US=1",
"F3DEX_GBI_2=1",
"F3DZEX_GBI_2=1",
"F3DEX_GBI_SHARED=1",
"NON_MATCHING=1",
"AVOID_UB=1"
],
"compilerPath": "/usr/bin/mips-linux-gnu-gcc",
"cStandard": "gnu17",
"cppStandard": "gnu++14",
"intelliSenseMode": "linux-gcc-x64"
}
],
"version": 4
}
+20 -4
View File
@@ -136,6 +136,20 @@ else ifeq ($(GRUCODE),super3d) # Super3D
DEFINES += SUPER3D_GBI=1 F3D_NEW=1
endif
LIBRARIES := nustd hvqm2 z goddard
# TEXT ENGINES
# s2dex_text_engine - Text Engine by someone2639
TEXT_ENGINE := none
ifeq ($(TEXT_ENGINE), s2dex_text_engine)
DEFINES += S2DEX_GBI_2=1 S2DEX_TEXT_ENGINE=1
LIBRARIES += s2d_engine
DUMMY != make -C src/s2d_engine COPY_DIR=$(shell pwd)/lib/
endif
# add more text engines here
LINK_LIBRARIES = $(foreach i,$(LIBRARIES),-l$(i))
ifeq ($(COMPILER),gcc)
NON_MATCHING := 1
MIPSISET := -mips3
@@ -403,7 +417,7 @@ DEF_INC_CFLAGS := $(foreach i,$(INCLUDE_DIRS),-I$(i)) $(C_DEFINES)
# C compiler options
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
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
else
CFLAGS += -non_shared -Wab,-r4300_mul -Xcpluscomm -Xfullwarn -signed -32
endif
@@ -444,8 +458,8 @@ else
RSPASM := $(TOOLS_DIR)/armips
endif
ENDIAN_BITWIDTH := $(BUILD_DIR)/endian-and-bitwidth
EMULATOR = mupen64plus
EMU_FLAGS = --noosd
EMULATOR = ~/Downloads/mupen64plus/mupen64plus-gui
EMU_FLAGS =
LOADER = loader64
LOADER_FLAGS = -vwf
SHA1SUM = sha1sum
@@ -482,6 +496,7 @@ endif
clean:
$(RM) -r $(BUILD_DIR_BASE)
make -C src/s2d_engine clean
distclean: clean
$(PYTHON) extract_assets.py --clean
@@ -511,6 +526,7 @@ $(CRASH_TEXTURE_C_FILES): TEXTURE_ENCODING := u32
ifeq ($(COMPILER),gcc)
$(BUILD_DIR)/src/libz/%.o: OPT_FLAGS := -Os
$(BUILD_DIR)/src/libz/%.o: CFLAGS += -Wno-implicit-fallthrough -Wno-unused-parameter -Wno-pointer-sign
endif
ifeq ($(VERSION),eu)
@@ -746,7 +762,7 @@ $(BUILD_DIR)/libz.a: $(LIBZ_O_FILES)
# 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
@$(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) -Map $(BUILD_DIR)/sm64.$(VERSION).map --no-check-sections $(addprefix -R ,$(SEG_FILES)) -o $@ $(O_FILES) -L$(LIBS_DIR) -l$(ULTRALIB) -Llib -Llib/gcclib/$(LIBGCCDIR) -lgcc -lnustd -lhvqm2 -lz -lgoddard -u sprintf -u osMapTLB
$(V)$(LD) --gc-sections -L $(BUILD_DIR) -T undefined_syms.txt -T $(BUILD_DIR)/$(LD_SCRIPT) -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
# Build ROM
$(ROM): $(ELF)
+71 -12
View File
@@ -1,3 +1,73 @@
# 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 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`):
**Collision:**
- Slope fix and exposed ceilings fix
- No false ledgegrabs fix *
- Jump kick fix *
- 46 degree wallkicks *
- Pole fix
- Possibility of disabling BLJs *
- Hanging fix (mario can grab hangable ceilings from any state, instead of only jump or double jump) *
- Increased maximum pole length (The game will read bparam1 and bparam2 together as a single value, so you can have a very long pole) *
- Platform Displacement 2 by Arthurtilly *
- Water Surface Type patch by thecozies
- Rounded corners by FramePerfection, merged by Cheezepin
- reonucam3: custom camera by me. This is included as a .patch file in the enhancements folder, you need to apply it if you want this camera.
This video shows a rundown of the features: https://youtu.be/TQNkznX9Z3k
**Common Hack Changes:**
- Better extended boundaries by anonymous_moose
- Mario head skip *
- Peach letter cutscene skip *
- Exit course while moving *
- Toggle to disable fall damage and the fall damage sound *
- Nonstop stars *
- Removed course-specific camera processing *
- You can increase the number of frames that you have to perform a firsty *
- Ability to set Mario's movement speed when hanging from a ceiling *
- Tighter hanging controls (mario will face the direction of the analog stick directly while hanging from a ceiling) *
**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)
- 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. *
- 16 bit model IDs by someone2639. This means you can have up to 65536 models (lol). You can set the maximum number of model IDs in `config.h`.
- Apply_patch.sh improved
- Removed the ifdef hell in `file_select.c` and `ingame_menu.c`
- Added Blake's custom function for object model stuff: `obj_set_model` and `obj_has_model`
- The "far" variable is now u16, allowing you to increase the farclip (the max distance at which geometry is rendered). However, when increasing the farclip, make sure to increase the nearclip by the same ratio, or rendering will break on console and LLE plugins.
- Many general use defines for object struct members, meant for use in custom object behaviors. Check `object_fields.h` for more info on this. (By MrComit)
- Included `actors/group0.c` in `behavior_data.c`
- The internal ROM name is now set with a define in `config.h` to make it simpler
- There is a `gIsConsole` variable that is 1 when running on console and 0 when running on emulator. This way you can wrap your code in a console check.
- Expanded audio heap allows for a larger concurrent note count and the importing of more m64 sequences and sound banks (By ArcticJaguar725) *
**Other Bugfixes:**
- Castle music fix (Fixes the castle music sometimes triggering after getting a dialog) *
- bparam4 fix (the game no longer uses bparam4 to check if an object is mario and therefore you can safely use it)
- Instant warp offset fix (makes the instant warp offset work even when warping to a different area) *
- haveyourcake, also known as cake screen fix. Made by Wiseguy and ported/PR'd by Cheezepin
- Tree particle fix (Whether a tree uses snow particles or not is decided via the model IDs instead of the course number) *
- Coordinate overflow fix by falcobuster. Your levels will render correctly on console and LLE emulators even when using 2x or 4x bounds, while not hurting anything on HLE plugins. *This is automatic now, you don't have to set WORLD_SCALE manually.*
- A couple vanilla texture fixes
- Smoke fix (the smoke texture uses the correct texture format)
**Neat Misc. Changes:**
- Instant Input patch by Wiseguy (Removes all input lag caused by plugins supporting framebuffer)
- This means that you'll have to do your framebuffer effects on buffer 0 for emulator, but NOT for console. You can use the `gIsConsole` variable to check for console when doing your framebuffer effects.
- Widescreen (16:9) support toggleable by pressing `L` in the pause menu. *
- S2DEX engine by someone2639! To use it, compile with `make TEXT_ENGINE=s2dex_text_engine` or just set `TEXT_ENGINE` to `s2dex_text_engine` in the makefile.
- ia8 coins (64x64), the vanilla coin texture is upgraded to accomodate. *
- Skybox size modifier. You can have 2x, 3x and 4x size skyboxes (you can select the skybox size in `config.h`.) Please note that this might affect console performance, especially 4x mode. 2x or 3x mode is recommended if aiming for console. By CowQuack *
- You can set the black border size to different values for console and emulator. It's set to 0 by default for both. *
# UltraSM64
- This repo contains a full decompilation of Super Mario 64 (J), (U), (E), and (SH).
@@ -20,23 +90,18 @@ Requirements are the same as regular SM64, however a GCC MIPS cross compiler is
## UNFLoader support
The repository supports UNFLoader for debugging.
To build with UNF, run make with ``UNF=1``.
Further instructions can be found at the [official repository](https://github.com/buu342/N64-UNFLoader)
## Multi-Save support
The repository supports SRAM in addition to EEPROM. The standard save data functions are #ifdef'd to accommedate this.
To build with SRAM support, run make with ``SAVETYPE=sram``.
I may attempt FlashRAM in the future.
## Multi-Console support
The repository supports targeting the iQue Player in addition to the N64. The iQue libultra is ***NOT*** compatible with N64 in many ways, so it is currently NOT possible to have one build for both consoles.
To target iQue, run make with the ``CONSOLE=bb`` argument.
## Compression
@@ -64,22 +129,16 @@ To use ``libdeflate-gzip``, first clone the [repo](https://github.com/ebiggers/l
Then run make for sm64 with ``GZIPVER=libdef`` in addition to ``COMPRESS=gzip``
The repo also supports building a ROM with no compression.
This is not recommended as it increases ROM size significantly, with little point other than load times decreased to almost nothing.
To switch to no compression, run make with the ``COMPRESS=uncomp`` argument.
## FAQ
Q: Why in the hell are you bundling your own build of ``ld``?
A: Newer binutils (Like the one bundled with Ubuntu, 2.34) break linking with libultra builds due to local asm symbols.
This puts me at a crossroads of either touching leaked code and requiring GCC, or just using an older linker that works just fine.
I went with the latter.
Thanks to "someone2639" for this hacky-ass idea
Q: Will this allow me to use FlashRAM/Transfer Pak/microcode swapping/Other Cool N64 Features?
@@ -88,4 +147,4 @@ A: Theoretically, all yes.
## Installation help
Go read the original repo README.md
Go read the original SM64 repo README.md
+1 -1
View File
@@ -180,7 +180,7 @@ static const Lights1 bobomb_seg8_lights_08022E00 = gdSPDefLights1(
);
// Unreferenced light group
static const Lights1 bobomb_lights_unused = gdSPDefLights1(
UNUSED static const Lights1 bobomb_lights_unused = gdSPDefLights1(
0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x28, 0x28, 0x28
);
+2 -2
View File
@@ -52,13 +52,13 @@ ALIGNED8 static const Texture bowser_seg6_texture_06025C38[] = {
// unreferenced, seen in pre-Spaceworld 1995 B-roll footage build
// 0x06026438
ALIGNED8 static const Texture bowser_seg6_texture_06026438[] = {
UNUSED ALIGNED8 static const Texture bowser_seg6_texture_06026438[] = {
#include "actors/bowser/bowser_blue_eye_unused.rgba16.inc.c"
};
// unreferenced (stubbed texture? possibly original texture for mouth)
// 0x06027438
ALIGNED8 static const Texture bowser_seg6_texture_06027438[] = {
UNUSED ALIGNED8 static const Texture bowser_seg6_texture_06027438[] = {
#include "actors/bowser/bowser_mouth_unused.rgba16.inc.c"
};
+1 -1
View File
@@ -14,7 +14,7 @@ ALIGNED8 static const Texture bubba_seg5_texture_05000008[] = {
// unused eye texture, assumed leftover from when actor file was copied from bub
// 0x05000408
ALIGNED8 static const Texture bubba_seg5_texture_05000408[] = {
UNUSED ALIGNED8 static const Texture bubba_seg5_texture_05000408[] = {
#include "actors/bubba/bubba_eyes_unused.rgba16.inc.c"
};
+2 -2
View File
@@ -19,7 +19,7 @@ ALIGNED8 static const Texture burn_smoke_seg4_texture_04021800[] = {
// 0x04022000 - 0x04022028
const Gfx burn_smoke_seg4_dl_04022000[] = {
gsDPPipeSync(),
gsDPSetCombineMode(G_CC_MODULATERGBA, G_CC_MODULATERGBA),
gsDPSetCombineMode(G_CC_MODULATEIA, G_CC_MODULATEIA),
gsSPClearGeometryMode(G_LIGHTING | G_CULL_BACK),
gsSPTexture(0xFFFF, 0xFFFF, 0, G_TX_RENDERTILE, G_ON),
gsSPEndDisplayList(),
@@ -44,7 +44,7 @@ const Gfx burn_smoke_seg4_dl_04022048[] = {
// 0x04022070 - 0x040220C8
const Gfx burn_smoke_seg4_dl_04022070[] = {
gsSPDisplayList(burn_smoke_seg4_dl_04022000),
gsDPLoadTextureBlock(burn_smoke_seg4_texture_04021800, G_IM_FMT_RGBA, G_IM_SIZ_16b, 32, 32, 0, G_TX_CLAMP, G_TX_CLAMP, 5, 5, G_TX_NOLOD, G_TX_NOLOD),
gsDPLoadTextureBlock(burn_smoke_seg4_texture_04021800, G_IM_FMT_IA, G_IM_SIZ_16b, 32, 32, 0, G_TX_CLAMP, G_TX_CLAMP, 5, 5, G_TX_NOLOD, G_TX_NOLOD),
gsSPDisplayList(burn_smoke_seg4_dl_04022028),
gsSPDisplayList(burn_smoke_seg4_dl_04022048),
gsSPEndDisplayList(),
+1 -1
View File
@@ -23,7 +23,7 @@ ALIGNED8 static const Texture chair_seg5_texture_05004060[] = {
// unreferenced
// 0x05004460
ALIGNED8 static const Texture chair_seg5_texture_05004460[] = {
UNUSED ALIGNED8 static const Texture chair_seg5_texture_05004460[] = {
#include "actors/chair/chair_surface_unused.rgba16.inc.c"
};
Binary file not shown.

After

Width:  |  Height:  |  Size: 14 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 8.4 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 14 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 13 KiB

+65 -13
View File
@@ -1,48 +1,92 @@
// Coin
#include "config.h"
// Coin
#ifdef IA8_COINS
// 0x030056C0
static const Vtx coin_seg3_vertex_030056C0[] = {
{{{ -32, 0, 0}, 0, { 0, 1984}, {0xff, 0xff, 0x00, 0xff}}},
{{{ 32, 0, 0}, 0, { 1984, 1984}, {0xff, 0xff, 0x00, 0xff}}},
{{{ 32, 64, 0}, 0, { 1984, 0}, {0xff, 0xff, 0x00, 0xff}}},
{{{ -32, 0, 0}, 0, { 0, 4032}, {0xff, 0xff, 0x00, 0xff}}},
{{{ 32, 0, 0}, 0, { 4032, 4032}, {0xff, 0xff, 0x00, 0xff}}},
{{{ 32, 64, 0}, 0, { 4032, 0}, {0xff, 0xff, 0x00, 0xff}}},
{{{ -32, 64, 0}, 0, { 0, 0}, {0xff, 0xff, 0x00, 0xff}}},
};
// 0x03005700
static const Vtx coin_seg3_vertex_03005700[] = {
{{{ -50, 0, 0}, 0, { 0, 1984}, {0x78, 0x78, 0xff, 0xff}}},
{{{ 50, 0, 0}, 0, { 1984, 1984}, {0x78, 0x78, 0xff, 0xff}}},
{{{ 50, 100, 0}, 0, { 1984, 0}, {0x78, 0x78, 0xff, 0xff}}},
{{{ -50, 0, 0}, 0, { 0, 4032}, {0x78, 0x78, 0xff, 0xff}}},
{{{ 50, 0, 0}, 0, { 4032, 4032}, {0x78, 0x78, 0xff, 0xff}}},
{{{ 50, 100, 0}, 0, { 4032, 0}, {0x78, 0x78, 0xff, 0xff}}},
{{{ -50, 100, 0}, 0, { 0, 0}, {0x78, 0x78, 0xff, 0xff}}},
};
// 0x03005740
static const Vtx coin_seg3_vertex_03005740[] = {
{{{ -35, 0, 0}, 0, { 0, 1984}, {0xff, 0x00, 0x00, 0xff}}},
{{{ 35, 0, 0}, 0, { 1984, 1984}, {0xff, 0x00, 0x00, 0xff}}},
{{{ 35, 70, 0}, 0, { 1984, 0}, {0xff, 0x00, 0x00, 0xff}}},
{{{ -35, 0, 0}, 0, { 0, 4032}, {0xff, 0x00, 0x00, 0xff}}},
{{{ 35, 0, 0}, 0, { 4032, 4032}, {0xff, 0x00, 0x00, 0xff}}},
{{{ 35, 70, 0}, 0, { 4032, 0}, {0xff, 0x00, 0x00, 0xff}}},
{{{ -35, 70, 0}, 0, { 0, 0}, {0xff, 0x00, 0x00, 0xff}}},
};
#else
static const Vtx coin_seg3_vertex_030056C0[] = {
{{{ -32, 0, 0}, 0, { 0, 1984 }, {0xff, 0xff, 0x00, 0xff}}},
{{{ 32, 0, 0}, 0, { 1984 , 1984 }, {0xff, 0xff, 0x00, 0xff}}},
{{{ 32, 64, 0}, 0, { 1984 , 0}, {0xff, 0xff, 0x00, 0xff}}},
{{{ -32, 64, 0}, 0, { 0, 0}, {0xff, 0xff, 0x00, 0xff}}},
};
// 0x03005700
static const Vtx coin_seg3_vertex_03005700[] = {
{{{ -50, 0, 0}, 0, { 0, 1984 }, {0x78, 0x78, 0xff, 0xff}}},
{{{ 50, 0, 0}, 0, { 1984 , 1984 }, {0x78, 0x78, 0xff, 0xff}}},
{{{ 50, 100, 0}, 0, { 1984 , 0}, {0x78, 0x78, 0xff, 0xff}}},
{{{ -50, 100, 0}, 0, { 0, 0}, {0x78, 0x78, 0xff, 0xff}}},
};
// 0x03005740
static const Vtx coin_seg3_vertex_03005740[] = {
{{{ -35, 0, 0}, 0, { 0, 1984 }, {0xff, 0x00, 0x00, 0xff}}},
{{{ 35, 0, 0}, 0, { 1984 , 1984 }, {0xff, 0x00, 0x00, 0xff}}},
{{{ 35, 70, 0}, 0, { 1984 , 0}, {0xff, 0x00, 0x00, 0xff}}},
{{{ -35, 70, 0}, 0, { 0, 0}, {0xff, 0x00, 0x00, 0xff}}},
};
#endif
// 0x03005780
#ifdef IA8_COINS
ALIGNED8 static const Texture coin_seg3_texture_03005780[] = {
#include "actors/coin/coin_front.ia16.inc.c"
#include "actors/coin/coin_front.ia8.inc.c"
};
// 0x03005F80
ALIGNED8 static const Texture coin_seg3_texture_03005F80[] = {
#include "actors/coin/coin_tilt_right.ia16.inc.c"
#include "actors/coin/coin_tilt_right.ia8.inc.c"
};
// 0x03006780
ALIGNED8 static const Texture coin_seg3_texture_03006780[] = {
#include "actors/coin/coin_side.ia16.inc.c"
#include "actors/coin/coin_side.ia8.inc.c"
};
// 0x03006F80
ALIGNED8 static const Texture coin_seg3_texture_03006F80[] = {
#include "actors/coin/coin_tilt_left.ia8.inc.c"
};
#else
ALIGNED8 static const Texture coin_seg3_texture_03005780[] = {
#include "actors/coin/coin_front.ia16.inc.c"
};
ALIGNED8 static const Texture coin_seg3_texture_03005F80[] = {
#include "actors/coin/coin_tilt_right.ia16.inc.c"
};
ALIGNED8 static const Texture coin_seg3_texture_03006780[] = {
#include "actors/coin/coin_side.ia16.inc.c"
};
ALIGNED8 static const Texture coin_seg3_texture_03006F80[] = {
#include "actors/coin/coin_tilt_left.ia16.inc.c"
};
#endif
// 0x03007780 - 0x030077D0
const Gfx coin_seg3_dl_03007780[] = {
@@ -50,11 +94,19 @@ const Gfx coin_seg3_dl_03007780[] = {
gsSPClearGeometryMode(G_LIGHTING),
gsDPSetCombineMode(G_CC_MODULATEIA, G_CC_MODULATEIA),
gsSPTexture(0x8000, 0x8000, 0, G_TX_RENDERTILE, G_ON),
#ifdef IA8_COINS
gsDPSetTile(G_IM_FMT_IA, G_IM_SIZ_16b, 0, 0, G_TX_LOADTILE, 0, G_TX_CLAMP, 6, G_TX_NOLOD, G_TX_CLAMP, 6, G_TX_NOLOD),
gsDPLoadSync(),
gsDPLoadBlock(G_TX_LOADTILE, 0, 0, 64/2 * 64 - 1, CALC_DXT(64/2, G_IM_SIZ_16b_BYTES)),
gsDPSetTile(G_IM_FMT_IA, G_IM_SIZ_8b, 8, 0, G_TX_RENDERTILE, 0, G_TX_CLAMP, 6, G_TX_NOLOD, G_TX_CLAMP, 6, G_TX_NOLOD),
gsDPSetTileSize(0, 0, 0, (64 - 1) << G_TEXTURE_IMAGE_FRAC, (64 - 1) << G_TEXTURE_IMAGE_FRAC),
#else
gsDPSetTile(G_IM_FMT_IA, G_IM_SIZ_16b, 0, 0, G_TX_LOADTILE, 0, G_TX_CLAMP, 5, G_TX_NOLOD, G_TX_CLAMP, 5, G_TX_NOLOD),
gsDPLoadSync(),
gsDPLoadBlock(G_TX_LOADTILE, 0, 0, 32 * 32 - 1, CALC_DXT(32, G_IM_SIZ_16b_BYTES)),
gsDPSetTile(G_IM_FMT_IA, G_IM_SIZ_16b, 8, 0, G_TX_RENDERTILE, 0, G_TX_CLAMP, 5, G_TX_NOLOD, G_TX_CLAMP, 5, G_TX_NOLOD),
gsDPSetTileSize(0, 0, 0, (32 - 1) << G_TEXTURE_IMAGE_FRAC, (32 - 1) << G_TEXTURE_IMAGE_FRAC),
#endif
gsSPEndDisplayList(),
};
Binary file not shown.

After

Width:  |  Height:  |  Size: 995 B

+5
View File
@@ -25,3 +25,8 @@
#include "white_particle_small/model.inc.c"
#include "sparkle_animation/model.inc.c"
#ifdef S2DEX_TEXT_ENGINE
#include "src/s2d_engine/config.h"
#include FONT_C_FILE
#endif
+1 -1
View File
@@ -41,7 +41,7 @@ ALIGNED8 static const Texture haunted_cage_seg5_texture_0500DA88[] = {
// also could be some sort of shader mask from much earlier in development, considering
// Big Boo's Haunt was a very very early level.
// 0x0500E288
ALIGNED8 static const Texture haunted_cage_seg5_texture_0500E288[] = {
UNUSED ALIGNED8 static const Texture haunted_cage_seg5_texture_0500E288[] = {
#include "actors/haunted_cage/bbh_cage_garbage.rgba16.inc.c"
};
+5 -5
View File
@@ -1,19 +1,19 @@
// Heave Ho
// Unreferenced light group
static const Lights1 heave_ho_lights_unused1 = gdSPDefLights1(
UNUSED static const Lights1 heave_ho_lights_unused1 = gdSPDefLights1(
0x2c, 0x2c, 0x2c,
0xb2, 0xb2, 0xb2, 0x28, 0x28, 0x28
);
// Unreferenced light group
static const Lights1 heave_ho_lights_unused2 = gdSPDefLights1(
UNUSED static const Lights1 heave_ho_lights_unused2 = gdSPDefLights1(
0x3f, 0x38, 0x00,
0xff, 0xe3, 0x00, 0x28, 0x28, 0x28
);
// Unreferenced light group
static const Lights1 heave_ho_lights_unused3 = gdSPDefLights1(
UNUSED static const Lights1 heave_ho_lights_unused3 = gdSPDefLights1(
0x3f, 0x00, 0x00,
0xff, 0x00, 0x00, 0x28, 0x28, 0x28
);
@@ -31,13 +31,13 @@ static const Lights1 heave_ho_seg5_lights_0500E980 = gdSPDefLights1(
);
// Unreferenced light group
static const Lights1 heave_ho_lights_unused4 = gdSPDefLights1(
UNUSED static const Lights1 heave_ho_lights_unused4 = gdSPDefLights1(
0x3b, 0x38, 0x21,
0xec, 0xe3, 0x84, 0x28, 0x28, 0x28
);
// Unreferenced light group
static const Lights1 heave_ho_lights_unused5 = gdSPDefLights1(
UNUSED static const Lights1 heave_ho_lights_unused5 = gdSPDefLights1(
0x32, 0x32, 0x32,
0xc8, 0xc8, 0xc8, 0x28, 0x28, 0x28
);
+5 -5
View File
@@ -31,12 +31,12 @@ UNUSED static const Lights1 king_bobomb_lights_unused5 = gdSPDefLights1(
);
// 0x05000078
ALIGNED8 static const Texture king_bobomb_seg5_texture_05000078[] = {
UNUSED ALIGNED8 static const Texture king_bobomb_seg5_texture_05000078[] = {
#include "actors/king_bobomb/bob-omb_buddy_left_side_unused.rgba16.inc.c"
};
// 0x05001078
ALIGNED8 static const Texture king_bobomb_seg5_texture_05001078[] = {
UNUSED ALIGNED8 static const Texture king_bobomb_seg5_texture_05001078[] = {
#include "actors/king_bobomb/bob-omb_buddy_right_side_unused.rgba16.inc.c"
};
@@ -46,7 +46,7 @@ ALIGNED8 static const Texture king_bobomb_seg5_texture_05002078[] = {
};
// 0x05002878
ALIGNED8 static const Texture king_bobomb_seg5_texture_05002878[] = {
UNUSED ALIGNED8 static const Texture king_bobomb_seg5_texture_05002878[] = {
#include "actors/king_bobomb/king_bob-omb_body_unused.rgba16.inc.c"
};
@@ -56,7 +56,7 @@ ALIGNED8 static const Texture king_bobomb_seg5_texture_05004878[] = {
};
// 0x05005078 - Unused
ALIGNED8 static const Texture king_bobomb_seg5_texture_05005078[] = {
UNUSED ALIGNED8 static const Texture king_bobomb_seg5_texture_05005078[] = {
#include "actors/king_bobomb/king_bob-omb_eyes_blink.rgba16.inc.c"
};
@@ -71,7 +71,7 @@ ALIGNED8 static const Texture king_bobomb_seg5_texture_05006078[] = {
};
// 0x05006478
ALIGNED8 static const Texture king_bobomb_seg5_texture_05006478[] = {
UNUSED ALIGNED8 static const Texture king_bobomb_seg5_texture_05006478[] = {
#include "actors/king_bobomb/bob-omb_buddy_body_unused.rgba16.inc.c"
};
+3 -3
View File
@@ -1,19 +1,19 @@
// Koopa Flag
// 0x06000000
static const Lights1 koopa_flag_seg6_lights_06000000 = gdSPDefLights1(
UNUSED static const Lights1 koopa_flag_seg6_lights_06000000 = gdSPDefLights1(
0x00, 0x1b, 0x00,
0x00, 0x6e, 0x00, 0x28, 0x28, 0x28
);
// 0x06000018
static const Lights1 koopa_flag_seg6_lights_06000018 = gdSPDefLights1(
UNUSED static const Lights1 koopa_flag_seg6_lights_06000018 = gdSPDefLights1(
0x3f, 0x39, 0x15,
0xff, 0xe6, 0x57, 0x28, 0x28, 0x28
);
// 0x06000030
static const Lights1 koopa_flag_seg6_lights_06000030 = gdSPDefLights1(
UNUSED static const Lights1 koopa_flag_seg6_lights_06000030 = gdSPDefLights1(
0x2b, 0x15, 0x01,
0xac, 0x54, 0x05, 0x28, 0x28, 0x28
);
+1 -1
View File
@@ -1,7 +1,7 @@
// Lakitu (Cameraman)
// 0x06000000
ALIGNED8 static const Texture lakitu_seg6_texture_06000000[] = {
UNUSED ALIGNED8 static const Texture lakitu_seg6_texture_06000000[] = {
#include "actors/lakitu_cameraman/lakitu_cameraman_cloud_face_unused.rgba16.inc.c"
};
+1 -1
View File
@@ -20,7 +20,7 @@ UNUSED static const Lights1 lakitu_enemy_lights_unused2 = gdSPDefLights1(
// Unreferenced texture
// 0x0500ECE0
ALIGNED8 static const Texture lakitu_enemy_seg5_texture_0500ECE0[] = {
UNUSED ALIGNED8 static const Texture lakitu_enemy_seg5_texture_0500ECE0[] = {
#include "actors/lakitu_enemy/lakitu_enemy_cloud_face_unused.rgba16.inc.c"
};
+1 -1
View File
@@ -13,7 +13,7 @@ static const Lights1 manta_seg5_lights_05001770 = gdSPDefLights1(
);
// Unreferenced light group
static const Lights1 manta_lights_unused = gdSPDefLights1(
UNUSED static const Lights1 manta_lights_unused = gdSPDefLights1(
0x3f, 0x3f, 0x35,
0xff, 0xff, 0xd7, 0x28, 0x28, 0x28
);
+2 -2
View File
@@ -78,13 +78,13 @@ ALIGNED8 static const Texture mario_texture_eyes_closed[] = {
// Unreferenced
// 0x04004890
ALIGNED8 static const Texture mario_texture_eyes_closed_unused1[] = {
UNUSED ALIGNED8 static const Texture mario_texture_eyes_closed_unused1[] = {
#include "actors/mario/mario_eyes_closed_unused_0.rgba16.inc.c"
};
// Unreferenced
// 0x04005090
ALIGNED8 static const Texture mario_texture_eyes_closed_unused2[] = {
UNUSED ALIGNED8 static const Texture mario_texture_eyes_closed_unused2[] = {
#include "actors/mario/mario_eyes_closed_unused_1.rgba16.inc.c"
};
Binary file not shown.

After

Width:  |  Height:  |  Size: 1012 B

+1 -1
View File
@@ -237,7 +237,7 @@ static const Vtx wiggler_seg5_vertex_0500D228[] = {
};
// Unused vertices? what are these? [D318]
static const Vtx wiggler_seg5_vertex_0500D318[] = {
UNUSED static const Vtx wiggler_seg5_vertex_0500D318[] = {
{{{ 92, 51, 0}, 0, { 0, 0}, {0x5d, 0x55, 0x00, 0x00}}},
{{{ 87, 46, -28}, 0, { 0, 0}, {0x5a, 0x53, 0xe1, 0x00}}},
{{{ 49, 88, -28}, 0, { 0, 0}, {0x5a, 0x53, 0xe1, 0x00}}},
+6 -6
View File
@@ -2,7 +2,7 @@
* Super Mario 64 ROM header
* Only the first 0x18 bytes matter to the console.
*/
#include "config.h"
.byte 0x80, 0x37, 0x12, 0x40 /* PI BSD Domain 1 register */
.word 0x0000000F /* Clockrate setting*/
.word entry_point /* Entrypoint */
@@ -14,11 +14,11 @@
.word 0x00000000 /* Checksum 2 */
.word 0x00000000 /* Unknown */
.word 0x00000000 /* Unknown */
#ifdef VERSION_SH
.ascii "SUPERMARIO64 " /* Internal ROM name */
#else
.ascii "SUPER MARIO 64 " /* Internal ROM name */
#endif
.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 */
+1
View File
@@ -15,6 +15,7 @@
#include "actors/common0.h"
#include "actors/common1.h"
#include "actors/group0.h"
#include "actors/group1.h"
#include "actors/group2.h"
#include "actors/group3.h"
+1 -1
View File
@@ -9,7 +9,7 @@ index af9d0156..c68a7f6e 100644
+#include "debug_box.h"
struct SpawnInfo gPlayerSpawnInfos[1];
struct GraphNode *D_8033A160[0x100];
struct GraphNode *gGraphNodePointers[0x100];
@@ -363,6 +364,8 @@ void render_game(void) {
if (gCurrentArea != NULL && !gWarpTransition.pauseRendering) {
geo_process_root(gCurrentArea->unk04, D_8032CE74, D_8032CE78, gFBSetColor);
+36
View File
@@ -0,0 +1,36 @@
diff --git a/src/game/game_init.c b/src/game/game_init.c
index b633468..da65e01 100644
--- a/src/game/game_init.c
+++ b/src/game/game_init.c
@@ -300,7 +300,10 @@ void rendering_init(void) {
end_master_display_list();
send_display_list(&gGfxPool->spTask);
- frameBufferIndex++;
+ // Skip incrementing the initial framebuffer index on emulators so that they display immediately as the Gfx task finishes
+ if ((*(volatile u32 *)0xA4100010) != 0) { // Read RDP Clock Register, has a value of zero on emulators
+ frameBufferIndex++;
+ }
gGlobalTimer++;
}
@@ -326,11 +329,14 @@ void display_and_vsync(void) {
osViSwapBuffer((void *) PHYSICAL_TO_VIRTUAL(gPhysicalFrameBuffers[sCurrFBNum]));
profiler_log_thread5_time(THREAD5_END);
osRecvMesg(&gGameVblankQueue, &D_80339BEC, OS_MESG_BLOCK);
- if (++sCurrFBNum == 3) {
- sCurrFBNum = 0;
- }
- if (++frameBufferIndex == 3) {
- frameBufferIndex = 0;
+ // Skip swapping buffers on emulator so that they display immediately as the Gfx task finishes
+ if ((*(volatile u32 *)0xA4100010) != 0) { // Read RDP Clock Register, has a value of zero on emulators
+ if (++sCurrFBNum == 3) {
+ sCurrFBNum = 0;
+ }
+ if (++frameBufferIndex == 3) {
+ frameBufferIndex = 0;
+ }
}
gGlobalTimer++;
}
+118
View File
@@ -0,0 +1,118 @@
diff --git a/src/engine/math_util.c b/src/engine/math_util.c
index e5d59d8b5..75cd43a09 100644
--- a/src/engine/math_util.c
+++ b/src/engine/math_util.c
@@ -564,23 +564,17 @@ void mtxf_mul_vec3s(Mat4 mtx, Vec3s b) {
* and no crashes occur.
*/
void mtxf_to_mtx(Mtx *dest, Mat4 src) {
-#ifdef AVOID_UB
- // Avoid type-casting which is technically UB by calling the equivalent
- // guMtxF2L function. This helps little-endian systems, as well.
- guMtxF2L(src, dest);
-#else
- s32 asFixedPoint;
- register s32 i;
- register s16 *a3 = (s16 *) dest; // all integer parts stored in first 16 bytes
- register s16 *t0 = (s16 *) dest + 16; // all fraction parts stored in last 16 bytes
- register f32 *t1 = (f32 *) src;
-
- for (i = 0; i < 16; i++) {
- asFixedPoint = *t1++ * (1 << 16); //! float-to-integer conversion responsible for PU crashes
- *a3++ = GET_HIGH_S16_OF_32(asFixedPoint); // integer part
- *t0++ = GET_LOW_S16_OF_32(asFixedPoint); // fraction part
- }
-#endif
+ 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;
+ }
+ temp[i][3] = src[i][3];
+ }
+
+ guMtxF2L( temp, dest );
}
/**
diff --git a/src/engine/math_util.h b/src/engine/math_util.h
index cb37d52d1..0826a8407 100644
--- a/src/engine/math_util.h
+++ b/src/engine/math_util.h
@@ -5,6 +5,14 @@
#include "types.h"
+/* Scales the world down by this factor, increasing how far you can render on
+ * console in exchange for a slight loss in precision.
+ *
+ * For double extended boundary hacks, a value of 1.5f or 2.0f is good.
+ * For quadruple extended bounds, use 3.f or 4.f
+ */
+#define WORLD_SCALE 2.f
+
/*
* The sine and cosine tables overlap, but "#define gCosineTable (gSineTable +
* 0x400)" doesn't give expected codegen; gSineTable and gCosineTable need to
diff --git a/src/game/rendering_graph_node.c b/src/game/rendering_graph_node.c
index 58238e83f..150cff68b 100644
--- a/src/game/rendering_graph_node.c
+++ b/src/game/rendering_graph_node.c
@@ -249,7 +249,7 @@ static void geo_process_perspective(struct GraphNodePerspective *node) {
f32 aspect = (f32) gCurGraphNodeRoot->width / (f32) gCurGraphNodeRoot->height;
#endif
- guPerspective(mtx, &perspNorm, node->fov, aspect, node->near, node->far, 1.0f);
+ guPerspective(mtx, &perspNorm, node->fov, aspect, node->near / WORLD_SCALE, node->far / WORLD_SCALE, 1.0f);
gSPPerspNormalize(gDisplayListHead++, perspNorm);
gSPMatrix(gDisplayListHead++, VIRTUAL_TO_PHYSICAL(mtx), G_MTX_PROJECTION | G_MTX_LOAD | G_MTX_NOPUSH);
@@ -267,17 +267,8 @@ static void geo_process_perspective(struct GraphNodePerspective *node) {
* range of this node.
*/
static void geo_process_level_of_detail(struct GraphNodeLevelOfDetail *node) {
-#ifdef GBI_FLOATS
- Mtx *mtx = gMatStackFixed[gMatStackIndex];
- s16 distanceFromCam = (s32) -mtx->m[3][2]; // z-component of the translation column
-#else
- // The fixed point Mtx type is defined as 16 longs, but it's actually 16
- // shorts for the integer parts followed by 16 shorts for the fraction parts
- Mtx *mtx = gMatStackFixed[gMatStackIndex];
- s16 distanceFromCam = -GET_HIGH_S16_OF_32(mtx->m[1][3]); // z-component of the translation column
-#endif
-
- if (node->minDistance <= distanceFromCam && distanceFromCam < node->maxDistance) {
+ f32 distanceFromCam = -gMatStack[gMatStackIndex][3][2];
+ if ((f32)node->minDistance <= distanceFromCam && distanceFromCam < (f32)node->maxDistance) {
if (node->node.children != 0) {
geo_process_node_and_siblings(node->node.children);
}
@@ -304,6 +295,17 @@ static void geo_process_switch(struct GraphNodeSwitchCase *node) {
}
}
+static void make_roll_matrix(Mtx *mtx, s16 angle) {
+ Mat4 temp;
+
+ mtxf_identity(temp);
+ temp[0][0] = coss(angle);
+ temp[0][1] = sins(angle);
+ temp[1][0] = -temp[0][1];
+ temp[1][1] = temp[0][0];
+ guMtxF2L(temp, mtx);
+}
+
/**
* Process a camera node.
*/
@@ -315,7 +317,7 @@ static void geo_process_camera(struct GraphNodeCamera *node) {
if (node->fnNode.func != NULL) {
node->fnNode.func(GEO_CONTEXT_RENDER, &node->fnNode.node, gMatStack[gMatStackIndex]);
}
- mtxf_rotate_xy(rollMtx, node->rollScreen);
+ make_roll_matrix(rollMtx, node->rollScreen);
gSPMatrix(gDisplayListHead++, VIRTUAL_TO_PHYSICAL(rollMtx), G_MTX_PROJECTION | G_MTX_MUL | G_MTX_NOPUSH);
File diff suppressed because it is too large. Load diff
+572
View File
@@ -0,0 +1,572 @@
diff --git a/include/text_strings.h.in b/include/text_strings.h.in
index d266058..4b12426 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")
#endif
+#define TEXT_CAM_INFO_SLOWEST _("CAM SPEED: SLOWEST")
+#define TEXT_CAM_INFO_SLOW _("CAM SPEED: SLOW")
+#define TEXT_CAM_INFO_MEDIUM _("CAM SPEED: MEDIUM")
+#define TEXT_CAM_INFO_FAST _("CAM SPEED: FAST")
+#define TEXT_CAM_INFO_FASTEST _("CAM SPEED: FASTEST")
+
#if defined(VERSION_JP) || defined(VERSION_SH)
/**
diff --git a/src/game/camera.c b/src/game/camera.c
index dfcf16a..e56f8c0 100644
--- a/src/game/camera.c
+++ b/src/game/camera.c
@@ -98,6 +98,7 @@ Vec3f sPlayer2FocusOffset;
* The pitch used for the credits easter egg.
*/
s16 sCreditsPlayer2Pitch;
+s16 rButtonCounter2;
/**
* The yaw used for the credits easter egg.
*/
@@ -107,6 +108,7 @@ s16 sCreditsPlayer2Yaw;
*/
u8 sFramesPaused;
+
extern struct CameraFOVStatus sFOVState;
extern struct TransitionInfo sModeTransition;
extern struct PlayerGeometry sMarioGeometry;
@@ -259,6 +261,7 @@ s16 sCameraSoundFlags;
* Stores what C-Buttons are pressed this frame.
*/
u16 sCButtonsPressed;
+u16 rButtonCounter;
/**
* A copy of gDialogID, the dialog displayed during the cutscene.
*/
@@ -437,6 +440,7 @@ u8 sFramesSinceCutsceneEnded = 0;
* 3 = Dialog doesn't have a response
*/
u8 sCutsceneDialogResponse = DIALOG_RESPONSE_NONE;
+u8 stickReset = 1;
struct PlayerCameraState *sMarioCamState = &gPlayerCameraState[0];
struct PlayerCameraState *sLuigiCamState = &gPlayerCameraState[1];
u32 unused8032D008 = 0;
@@ -755,6 +759,7 @@ void set_camera_height(struct Camera *c, f32 goalHeight) {
UNUSED s16 action = sMarioCamState->action;
f32 baseOff = 125.f;
f32 camCeilHeight = find_ceil(c->pos[0], gLakituState.goalPos[1] - 50.f, c->pos[2], &surface);
+ f32 approachRate = 20.0f;
if (sMarioCamState->action & ACT_FLAG_HANGING) {
marioCeilHeight = sMarioGeometry.currCeilHeight;
@@ -790,7 +795,8 @@ void set_camera_height(struct Camera *c, f32 goalHeight) {
c->pos[1] = goalHeight;
}
}
- approach_camera_height(c, goalHeight, 20.f);
+ approachRate += ABS(c->pos[1] - goalHeight) / 20;
+ approach_camera_height(c, goalHeight, approachRate);
if (camCeilHeight != CELL_HEIGHT_LIMIT) {
camCeilHeight -= baseOff;
if ((c->pos[1] > camCeilHeight && sMarioGeometry.currFloorHeight + baseOff < camCeilHeight)
@@ -934,9 +940,25 @@ s32 update_8_directions_camera(struct Camera *c, Vec3f focus, Vec3f pos) {
UNUSED f32 unused1;
UNUSED f32 unused2;
UNUSED f32 unused3;
- f32 yOff = 125.f;
+ f32 yOff;
f32 baseDist = 1000.f;
+ if (gMarioState->action & ACT_FLAG_SWIMMING) {
+ yOff = -125.f;
+ } else {
+ yOff = 125.f;
+ }
+
+ if ((gPlayer1Controller->buttonDown & R_TRIG) && (gPlayer1Controller->buttonDown & U_CBUTTONS)) {
+ gKeepCliffCam = 1;
+ pitch = DEGREES(60);
+ } else if (((gPlayer1Controller->buttonDown & U_CBUTTONS) || (gPlayer1Controller->buttonDown & R_TRIG)) && gKeepCliffCam) {
+ pitch = DEGREES(60);
+ } else {
+ gKeepCliffCam = 0;
+ }
+
+
sAreaYaw = camYaw;
calc_y_to_curr_floor(&posY, 1.f, 200.f, &focusY, 0.9f, 200.f);
focus_on_mario(focus, pos, posY + yOff, focusY + yOff, sLakituDist + baseDist, pitch, camYaw);
@@ -1170,6 +1192,28 @@ void mode_radial_camera(struct Camera *c) {
pan_ahead_of_player(c);
}
+// Returns the camera speed based on the user's camera speed setting
+f32 set_camera_speed(void) {
+ switch(gCameraSpeed) {
+ case 0:
+ return 0.5f;
+ break;
+ case 1:
+ return 1;
+ break;
+ case 2:
+ return 1.5;
+ break;
+ case 3:
+ return 2;
+ break;
+ case 4:
+ return 3.5;
+ break;
+ }
+ return 0;
+}
+
/**
* A mode that only has 8 camera angles, 45 degrees apart
*/
@@ -1177,42 +1221,59 @@ void mode_8_directions_camera(struct Camera *c) {
Vec3f pos;
UNUSED u8 unused[8];
s16 oldAreaYaw = sAreaYaw;
+ // Get the camera speed based on the user's setting
+ f32 cameraSpeed = set_camera_speed();
radial_camera_input(c, 0.f);
- if (gPlayer1Controller->buttonPressed & R_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)) {
+ s8DirModeBaseYaw += DEGREES(45);
+ } 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) {
- s8DirModeYawOffset = 0;
- s8DirModeYawOffset = gMarioState->faceAngle[1]-0x8000;
- }
- else if (gPlayer1Controller->buttonDown & L_JPAD) {
- s8DirModeYawOffset -= DEGREES(2);
+
+ if (gPlayer1Controller->buttonDown & R_TRIG) {
+ if (gPlayer1Controller->buttonDown & L_CBUTTONS) {
+ s8DirModeBaseYaw -= DEGREES(cameraSpeed);
+ } else if (gPlayer1Controller->buttonDown & R_CBUTTONS) {
+ s8DirModeBaseYaw += DEGREES(cameraSpeed);
+ }
+ rButtonCounter++; // This increses whenever R is held.
+ } else {
+ if (rButtonCounter > 0 && rButtonCounter <= 5 && !((gPlayer1Controller->buttonDown & L_CBUTTONS) || (gPlayer1Controller->buttonDown & R_CBUTTONS) || (gMarioState->action & ACT_FLAG_SWIMMING_OR_FLYING))) {
+ // This centers the camera behind mario. It triggers when you let go of R in less than 5 frames.
+ s8DirModeYawOffset = 0;
+ s8DirModeBaseYaw = gMarioState->faceAngle[1]-0x8000;
+ gMarioState->area->camera->yaw = s8DirModeBaseYaw;
+ play_sound_rbutton_changed();
+ }
+ rButtonCounter = 0;
+ }
+ if (gPlayer1Controller->buttonPressed & R_TRIG) {
+ if (rButtonCounter2 <= 5) {
+ set_cam_angle(CAM_ANGLE_MARIO); // Enter mario cam if R is pressed 2 times in less than 5 frames
+ rButtonCounter2 = 6;
+ } else {
+ rButtonCounter2 = 0;
+ }
+ } else {
+ rButtonCounter2++;
}
- else if (gPlayer1Controller->buttonDown & R_JPAD) {
- s8DirModeYawOffset += DEGREES(2);
+ 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);
c->nextYaw = update_8_directions_camera(c, c->focus, pos);
+ set_camera_height(c, pos[1]);
c->pos[0] = pos[0];
c->pos[2] = pos[2];
sAreaYawChange = sAreaYaw - oldAreaYaw;
- set_camera_height(c, pos[1]);
}
+
/**
* Updates the camera in outward radial mode.
* sModeOffsetYaw is calculated in radial_camera_move, which calls offset_yaw_outward_radial
@@ -2116,7 +2177,7 @@ s16 update_default_camera(struct Camera *c) {
gLakituState.goalPos[1],
gLakituState.goalPos[2], &ceil);
s16 yawDir;
-
+
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) {
void update_camera(struct Camera *c) {
UNUSED u8 unused[24];
+ extern s16 s8DirModeBaseYaw;
+
gCamera = c;
update_camera_hud_status(c);
if (c->cutscene == 0) {
// 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) {
- if (set_cam_angle(0) == CAM_ANGLE_LAKITU) {
- set_cam_angle(CAM_ANGLE_MARIO);
- } else {
+ if (set_cam_angle(0) == CAM_ANGLE_MARIO) {
+ s8DirModeBaseYaw = ((gMarioState->faceAngle[1]-0x8000) + 0x1000) & 0xE000;
set_cam_angle(CAM_ANGLE_LAKITU);
}
}
}
- play_sound_if_cam_switched_to_lakitu_or_mario();
+ //play_sound_if_cam_switched_to_lakitu_or_mario();
}
// Initialize the camera
@@ -4849,15 +4911,15 @@ void play_camera_buzz_if_c_sideways(void) {
}
void play_sound_cbutton_up(void) {
- play_sound(SOUND_MENU_CAMERA_ZOOM_IN, gGlobalSoundSource);
+ //play_sound(SOUND_MENU_CAMERA_ZOOM_OUT, gGlobalSoundSource);
}
void play_sound_cbutton_down(void) {
- play_sound(SOUND_MENU_CAMERA_ZOOM_OUT, gGlobalSoundSource);
+ //play_sound(SOUND_MENU_CAMERA_ZOOM_OUT, gGlobalSoundSource);
}
void play_sound_cbutton_side(void) {
- play_sound(SOUND_MENU_CAMERA_TURN, gGlobalSoundSource);
+ //play_sound(SOUND_MENU_CAMERA_TURN, gGlobalSoundSource);
}
void play_sound_button_change_blocked(void) {
@@ -4961,7 +5023,7 @@ s32 radial_camera_input(struct Camera *c, UNUSED f32 unused) {
}
// Zoom in / enter C-Up
- if (gPlayer1Controller->buttonPressed & U_CBUTTONS) {
+ if (((gPlayer1Controller->buttonPressed & U_CBUTTONS) || (gPlayer2Controller->rawStickY > 40)) && (stickReset) && !(gPlayer1Controller->buttonDown & R_TRIG)) {
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) {
}
// Zoom out
- if (gPlayer1Controller->buttonPressed & D_CBUTTONS) {
+ if ((gPlayer1Controller->buttonPressed & D_CBUTTONS) || (gPlayer2Controller->rawStickY < -40)) {
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) {
}
}
+ if ((gPlayer2Controller->rawStickY > 40) || (gPlayer2Controller->rawStickY < -40)) {
+ stickReset = 0;
+ } else {
+ stickReset = 1;
+ }
+
//! returning uninitialized variable
return dummy;
}
@@ -5548,7 +5616,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;
- s8DirModeBaseYaw = 0;
+ s8DirModeBaseYaw = ((gMarioState->faceAngle[1]-0x8000) + 0x1000) & 0xE000;
s8DirModeYawOffset = 0;
}
}
diff --git a/src/game/game_init.c b/src/game/game_init.c
index 6cfa8f5..63158e1 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;
+u8 gCameraSpeed = 2;
+u8 gWaterCamOverride;
+u8 gFlyingCamOverride;
+u8 gKeepCliffCam;
+s32 gCliffTimer;
#ifdef EEP
s8 gEepromProbe;
#endif
@@ -715,6 +720,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());
+ gCameraSpeed = (save_file_get_camera_speed());
#ifdef WIDE
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
--- a/src/game/game_init.h
+++ b/src/game/game_init.h
@@ -45,6 +45,10 @@ extern u8 gIsConsole;
#ifdef WIDE
extern u8 gWidescreen;
#endif
+extern u8 gCameraSpeed;
+extern u8 gWaterCamOverride;
+extern u8 gFlyingCamOverride;
+extern u8 gKeepCliffCam;
extern u8 gBorderHeight;
#ifdef EEP
extern s8 gEepromProbe;
diff --git a/src/game/ingame_menu.c b/src/game/ingame_menu.c
index 9cd458a..ac2d18c 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 };
#endif
+u8 textCamInfoSlowest[] = { TEXT_CAM_INFO_SLOWEST };
+u8 textCamInfoSlow[] = { TEXT_CAM_INFO_SLOW };
+u8 textCamInfoMedium[] = { TEXT_CAM_INFO_MEDIUM };
+u8 textCamInfoFast[] = { TEXT_CAM_INFO_FAST};
+u8 textCamInfoFastest[] = { TEXT_CAM_INFO_FASTEST };
+
extern u8 gLastCompletedCourseNum;
extern u8 gLastCompletedStarNum;
@@ -1350,6 +1356,45 @@ void reset_red_coins_collected(void) {
gRedCoinsCollected = 0;
}
+void render_camera_speed_setting(void) {
+ gSPDisplayList(gDisplayListHead++, dl_ia_text_begin);
+ gDPSetEnvColor(gDisplayListHead++, 255, 255, 255, gDialogTextAlpha);
+ switch (gCameraSpeed) {
+ case 0:
+ print_generic_string(190, 20, textCamInfoSlowest);
+ break;
+ case 1:
+ print_generic_string(190, 20, textCamInfoSlow);
+ break;
+ case 2:
+ print_generic_string(190, 20, textCamInfoMedium);
+ break;
+ case 3:
+ print_generic_string(190, 20, textCamInfoFast);
+ break;
+ case 4:
+ print_generic_string(190, 20, textCamInfoFastest);
+ break;
+ }
+ gSPDisplayList(gDisplayListHead++, dl_ia_text_end);
+
+ if (gPlayer1Controller->buttonPressed & R_JPAD) {
+ if (gCameraSpeed < 4) {
+ gCameraSpeed += 1;
+ } else {
+ gCameraSpeed = 0;
+ }
+ save_file_set_camera_speed(gCameraSpeed);
+ } else if (gPlayer1Controller->buttonPressed & L_JPAD) {
+ if (gCameraSpeed > 0) {
+ gCameraSpeed -= 1;
+ } else {
+ gCameraSpeed = 4;
+ }
+ save_file_set_camera_speed(gCameraSpeed);
+ }
+}
+
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) {
}
#ifdef WIDE
render_widescreen_setting();
+ render_camera_speed_setting();
if (gPlayer1Controller->buttonPressed & L_TRIG){
gWidescreen ^= 1;
save_file_set_widescreen_mode(gWidescreen);
diff --git a/src/game/mario.c b/src/game/mario.c
index b381afa..7cb9549 100644
--- a/src/game/mario.c
+++ b/src/game/mario.c
@@ -1443,32 +1443,39 @@ void update_mario_inputs(struct MarioState *m) {
void set_submerged_cam_preset_and_spawn_bubbles(struct MarioState *m) {
f32 heightBelowWater;
s16 camPreset;
+ extern s16 s8DirModeBaseYaw;
+ if (!gWaterCamOverride) {
+ if ((m->action & ACT_GROUP_MASK) == ACT_GROUP_SUBMERGED) {
+ heightBelowWater = (f32)(m->waterLevel - 80) - m->pos[1];
+ camPreset = m->area->camera->mode;
+ if (m->action & ACT_FLAG_METAL_WATER) {
+ if (camPreset != CAMERA_MODE_CLOSE) {
+ set_camera_mode(m->area->camera, CAMERA_MODE_CLOSE, 1);
+ }
+ } else {
+ if ((heightBelowWater > 800.0f) && (camPreset != CAMERA_MODE_BEHIND_MARIO)) {
+ set_camera_mode(m->area->camera, CAMERA_MODE_BEHIND_MARIO, 1);
+ }
- if ((m->action & ACT_GROUP_MASK) == ACT_GROUP_SUBMERGED) {
- heightBelowWater = (f32)(m->waterLevel - 80) - m->pos[1];
- camPreset = m->area->camera->mode;
-
- if (m->action & ACT_FLAG_METAL_WATER) {
- if (camPreset != CAMERA_MODE_CLOSE) {
- set_camera_mode(m->area->camera, CAMERA_MODE_CLOSE, 1);
- }
- } else {
- if ((heightBelowWater > 800.0f) && (camPreset != CAMERA_MODE_BEHIND_MARIO)) {
- set_camera_mode(m->area->camera, CAMERA_MODE_BEHIND_MARIO, 1);
- }
-
- if ((heightBelowWater < 400.0f) && (camPreset != CAMERA_MODE_WATER_SURFACE)) {
- set_camera_mode(m->area->camera, CAMERA_MODE_WATER_SURFACE, 1);
- }
+ if ((heightBelowWater < 400.0f) && (camPreset != CAMERA_MODE_WATER_SURFACE)) {
+ set_camera_mode(m->area->camera, CAMERA_MODE_WATER_SURFACE, 1);
+ }
- // As long as Mario isn't drowning or at the top
- // of the water with his head out, spawn bubbles.
- if (!(m->action & ACT_FLAG_INTANGIBLE)) {
- if ((m->pos[1] < (f32)(m->waterLevel - 160)) || (m->faceAngle[0] < -0x800)) {
- m->particleFlags |= PARTICLE_BUBBLE;
+ // As long as Mario isn't drowning or at the top
+ // of the water with his head out, spawn bubbles.
+ if (!(m->action & ACT_FLAG_INTANGIBLE)) {
+ if ((m->pos[1] < (f32)(m->waterLevel - 160)) || (m->faceAngle[0] < -0x800)) {
+ m->particleFlags |= PARTICLE_BUBBLE;
+ }
}
}
}
+ } else {
+ set_camera_mode(m->area->camera, CAMERA_MODE_8_DIRECTIONS, 1);
+ }
+ if ((gPlayer1Controller->buttonPressed & R_TRIG) && (m->action & ACT_FLAG_SWIMMING)) {
+ s8DirModeBaseYaw = ((gMarioState->faceAngle[1]-0x8000) + 0x1000) & 0xE000;
+ gWaterCamOverride ^= 1;
}
}
diff --git a/src/game/mario_actions_airborne.c b/src/game/mario_actions_airborne.c
index ce6467e..c7e998c 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) {
s32 act_flying(struct MarioState *m) {
s16 startPitch = m->faceAngle[0];
+ if (gPlayer1Controller->buttonPressed & R_TRIG) {
+ gFlyingCamOverride ^= 1;
+ }
+
if (m->input & INPUT_Z_PRESSED) {
if (m->area->camera->mode == CAMERA_MODE_BEHIND_MARIO) {
set_camera_mode(m->area->camera, m->area->camera->defMode, 1);
@@ -1750,8 +1754,10 @@ s32 act_flying(struct MarioState *m) {
return set_mario_action(m, ACT_FREEFALL, 0);
}
- if (m->area->camera->mode != CAMERA_MODE_BEHIND_MARIO) {
+ if (!gFlyingCamOverride) {
set_camera_mode(m->area->camera, CAMERA_MODE_BEHIND_MARIO, 1);
+ } else {
+ set_camera_mode(m->area->camera, CAMERA_MODE_8_DIRECTIONS, 1);
}
if (m->actionState == 0) {
@@ -1933,7 +1939,7 @@ s32 act_flying_triple_jump(struct MarioState *m) {
}
if (m->vel[1] < 4.0f) {
- if (m->area->camera->mode != CAMERA_MODE_BEHIND_MARIO) {
+ if ((m->area->camera->mode != CAMERA_MODE_BEHIND_MARIO) && (!gFlyingCamOverride)) {
set_camera_mode(m->area->camera, CAMERA_MODE_BEHIND_MARIO, 1);
}
@@ -1944,7 +1950,7 @@ s32 act_flying_triple_jump(struct MarioState *m) {
set_mario_action(m, ACT_FLYING, 1);
}
- if (m->actionTimer++ == 10 && m->area->camera->mode != CAMERA_MODE_BEHIND_MARIO) {
+ if (m->actionTimer++ == 10 && m->area->camera->mode != CAMERA_MODE_BEHIND_MARIO && (!gFlyingCamOverride)) {
set_camera_mode(m->area->camera, CAMERA_MODE_BEHIND_MARIO, 1);
}
diff --git a/src/game/save_file.c b/src/game/save_file.c
index b27d869..7fbf045 100644
--- a/src/game/save_file.c
+++ b/src/game/save_file.c
@@ -634,6 +634,12 @@ u8 save_file_get_widescreen_mode(void) {
return gSaveBuffer.menuData[0].wideMode;
}
+void save_file_set_camera_speed(u8 speed) {
+ gSaveBuffer.menuData[0].cameraSpeedSetting = speed;
+ gMainMenuDataModified = TRUE;
+ save_main_menu_data();
+}
+
void save_file_set_widescreen_mode(u8 mode) {
gSaveBuffer.menuData[0].wideMode = mode;
@@ -646,6 +652,10 @@ u16 save_file_get_sound_mode(void) {
return gSaveBuffer.menuData[0].soundMode;
}
+u8 save_file_get_camera_speed(void) {
+ return gSaveBuffer.menuData[0].cameraSpeedSetting;
+}
+
void save_file_move_cap_to_default_location(void) {
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
--- a/src/game/save_file.h
+++ b/src/game/save_file.h
@@ -62,6 +62,7 @@ struct MainMenuSaveData
#ifdef WIDE
u8 wideMode: 1;
#endif
+ u8 cameraSpeedSetting: 3;
#ifdef VERSION_EU
u16 language;
@@ -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);
#endif
+u8 save_file_get_camera_speed(void);
+void save_file_set_camera_speed(u8 speed);
void save_file_move_cap_to_default_location(void);
void disable_warp_checkpoint(void);
+716
View File
@@ -0,0 +1,716 @@
diff --git a/enhancements/widescreenv2_sm64.patch b/enhancements/widescreenv2_sm64.patch
new file mode 100644
index 0000000..d7f27ad
--- /dev/null
+++ b/enhancements/widescreenv2_sm64.patch
@@ -0,0 +1,198 @@
+diff --git a/include/text_strings.h.in b/include/text_strings.h.in
+index 749179b..3b23b41 100644
+--- a/include/text_strings.h.in
++++ b/include/text_strings.h.in
+@@ -24,6 +24,10 @@
+ // Ingame Menu
+ #define TEXT_PAUSE _("PAUSE") // Pause text, Castle Courses
+ #define TEXT_HUD_CONGRATULATIONS _("CONGRATULATIONS") // Course Complete Text, Bowser Courses
++#define TEXT_HUD_CURRENT_RATIO_43 _("CURRENT ASPECT RATIO: 4:3. PRESS L TO SWITCH TO 16:9")
++#define TEXT_HUD_CURRENT_RATIO_169 _("CURRENT ASPECT RATIO: 16:9. PRESS L TO SWITCH TO 4:3")
++#define TEXT_HUD_WIDE_INFO _("PLEASE CONFIGURE YOUR DISPLAY OR YOUR EMULATOR TO")
++#define TEXT_HUD_WIDE_INFO2 _("STRETCH THE IMAGE TO 16:9")
+
+ #if defined(VERSION_JP) || defined(VERSION_SH)
+
+diff --git a/src/game/ingame_menu.c b/src/game/ingame_menu.c
+index 8190f88..deb69f5 100644
+--- a/src/game/ingame_menu.c
++++ b/src/game/ingame_menu.c
+@@ -34,6 +34,11 @@ s16 gDialogY; // D_8032F69C
+ s16 gCutsceneMsgXOffset;
+ s16 gCutsceneMsgYOffset;
+ s8 gRedCoinsCollected;
++u8 textCurrRatio43[] = { TEXT_HUD_CURRENT_RATIO_43 };
++u8 textCurrRatio169[] = { TEXT_HUD_CURRENT_RATIO_169 };
++u8 textWideInfo[] = { TEXT_HUD_WIDE_INFO };
++u8 textWideInfo2[] = { TEXT_HUD_WIDE_INFO2 };
++extern u8 widescreen = 0;
+
+ extern u8 gLastCompletedCourseNum;
+ extern u8 gLastCompletedStarNum;
+@@ -2266,6 +2271,14 @@ void render_pause_my_score_coins(void) {
+ print_generic_string(get_string_width(gTextCourseArr[gInGameLanguage]) + 51, 157, strCourseNum);
+ #else
+ print_generic_string(CRS_NUM_X1, 157, strCourseNum);
++ if (widescreen == 0) {
++ print_generic_string(10, 20, textCurrRatio43);
++ }
++ else {
++ print_generic_string(10, 20, textCurrRatio169);
++ print_generic_string(10, 200, textWideInfo);
++ print_generic_string(10, 180, textWideInfo2);
++ }
+ #endif
+
+ actName = segmented_to_virtual(actNameTbl[(gCurrCourseNum - 1) * 6 + gDialogCourseActNum - 1]);
+@@ -2557,10 +2570,25 @@ void render_pause_castle_main_strings(s16 x, s16 y) {
+ }
+ }
+ }
++ if (gPlayer1Controller->buttonPressed & L_TRIG){
++ if (widescreen == 0){
++ widescreen = 1;
++ }
++ else{
++ widescreen = 0;
++ }
++ }
+
+ gSPDisplayList(gDisplayListHead++, dl_ia_text_begin);
+ gDPSetEnvColor(gDisplayListHead++, 255, 255, 255, gDialogTextAlpha);
+-
++ if (widescreen == 0) {
++ print_generic_string(10, 20, textCurrRatio43);
++ }
++ else {
++ print_generic_string(10, 20, textCurrRatio169);
++ print_generic_string(10, 200, textWideInfo);
++ print_generic_string(10, 180, textWideInfo2);
++ }
+ if (gDialogLineNum < COURSE_STAGES_COUNT) {
+ courseName = segmented_to_virtual(courseNameTbl[gDialogLineNum]);
+ render_pause_castle_course_stars(x, y, gCurrSaveFileNum - 1, gDialogLineNum);
+@@ -2626,6 +2654,14 @@ s16 render_pause_courses_and_castle(void) {
+ shade_screen();
+ render_pause_my_score_coins();
+ render_pause_red_coins();
++ if (gPlayer1Controller->buttonPressed & L_TRIG){
++ if (widescreen == 0){
++ widescreen = 1;
++ }
++ else{
++ widescreen = 0;
++ }
++ }
+
+ if (gMarioStates[0].action & ACT_FLAG_PAUSE_EXIT) {
+ render_pause_course_options(99, 93, &gDialogLineNum, 15);
+diff --git a/src/game/rendering_graph_node.c b/src/game/rendering_graph_node.c
+index 58238e8..aabdb85 100644
+--- a/src/game/rendering_graph_node.c
++++ b/src/game/rendering_graph_node.c
+@@ -10,6 +10,7 @@
+ #include "rendering_graph_node.h"
+ #include "shadow.h"
+ #include "sm64.h"
++#define WIDESCREEN
+
+ /**
+ * This file contains the code that processes the scene graph for rendering.
+@@ -235,6 +236,7 @@ static void geo_process_ortho_projection(struct GraphNodeOrthoProjection *node)
+ /**
+ * Process a perspective projection node.
+ */
++extern u8 widescreen;
+ static void geo_process_perspective(struct GraphNodePerspective *node) {
+ if (node->fnNode.func != NULL) {
+ node->fnNode.func(GEO_CONTEXT_RENDER, &node->fnNode.node, gMatStack[gMatStackIndex]);
+@@ -246,7 +248,13 @@ static void geo_process_perspective(struct GraphNodePerspective *node) {
+ #ifdef VERSION_EU
+ f32 aspect = ((f32) gCurGraphNodeRoot->width / (f32) gCurGraphNodeRoot->height) * 1.1f;
+ #else
+- f32 aspect = (f32) gCurGraphNodeRoot->width / (f32) gCurGraphNodeRoot->height;
++ f32 aspect;
++ if (widescreen == 1){
++ aspect = 1.775f;
++ }
++ else{
++ aspect = 1.33333f;
++ }
+ #endif
+
+ guPerspective(mtx, &perspNorm, node->fov, aspect, node->near, node->far, 1.0f);
+diff --git a/src/menu/file_select.c b/src/menu/file_select.c
+index c894797..dc759f7 100644
+--- a/src/menu/file_select.c
++++ b/src/menu/file_select.c
+@@ -2854,10 +2854,12 @@ Gfx *geo_file_select_strings_and_menu_cursor(s32 callContext, UNUSED struct Grap
+ * Relocates cursor position of the last save if the game goes back to the Mario Screen
+ * either completing a course choosing "SAVE & QUIT" or having a game over.
+ */
++extern u8 widescreen;
+ s32 lvl_init_menu_values_and_cursor_pos(UNUSED s32 arg, UNUSED s32 unused) {
+ #ifdef VERSION_EU
+ s8 fileNum;
+ #endif
++ widescreen = 0;
+ sSelectedButtonID = MENU_BUTTON_NONE;
+ sCurrentMenuLevel = MENU_LAYER_MAIN;
+ sTextBaseAlpha = 0;
+diff --git a/src/menu/star_select.c b/src/menu/star_select.c
+index 025dbf2..d6aaa7e 100644
+--- a/src/menu/star_select.c
++++ b/src/menu/star_select.c
+@@ -52,7 +52,7 @@ static s8 sSelectableStarIndex = 0;
+
+ // Act Selector menu timer that keeps counting until you choose an act.
+ static s32 sActSelectorMenuTimer = 0;
+-
++extern u8 widescreen;
+ /**
+ * Act Selector Star Type Loop Action
+ * Defines a select type for a star in the act selector.
+@@ -92,8 +92,15 @@ void bhv_act_selector_star_type_loop(void) {
+ void render_100_coin_star(u8 stars) {
+ if (stars & (1 << 6)) {
+ // If the 100 coin star has been collected, create a new star selector next to the coin score.
+- sStarSelectorModels[6] = spawn_object_abs_with_rot(gCurrentObject, 0, MODEL_STAR,
+- bhvActSelectorStarType, 370, 24, -300, 0, 0, 0);
++ if (widescreen == 1){
++ sStarSelectorModels[6] = spawn_object_abs_with_rot(gCurrentObject, 0, MODEL_STAR,
++ bhvActSelectorStarType, ((370*4.0f)/3), 24, -300, 0, 0, 0);
++ }
++ else{
++ sStarSelectorModels[6] = spawn_object_abs_with_rot(gCurrentObject, 0, MODEL_STAR,
++ bhvActSelectorStarType, 370, 24, -300, 0, 0, 0);
++ }
++
+ sStarSelectorModels[6]->oStarSelectorSize = 0.8;
+ sStarSelectorModels[6]->oStarSelectorType = STAR_SELECTOR_100_COINS;
+ }
+@@ -147,11 +154,21 @@ void bhv_act_selector_init(void) {
+ }
+
+ // Render star selector objects
+- for (i = 0; i < sVisibleStars; i++) {
+- sStarSelectorModels[i] =
+- spawn_object_abs_with_rot(gCurrentObject, 0, selectorModelIDs[i], bhvActSelectorStarType,
+- 75 + sVisibleStars * -75 + i * 152, 248, -300, 0, 0, 0);
+- sStarSelectorModels[i]->oStarSelectorSize = 1.0f;
++ if (widescreen == 1) {
++ for (i = 0; i < sVisibleStars; i++) {
++ sStarSelectorModels[i] =
++ spawn_object_abs_with_rot(gCurrentObject, 0, selectorModelIDs[i], bhvActSelectorStarType,
++ (((75 + sVisibleStars * -75 + i * 152)*4.0f)/3), 248, -300, 0, 0, 0);
++ sStarSelectorModels[i]->oStarSelectorSize = 1.0f;
++ }
++ }
++ else {
++ for (i = 0; i < sVisibleStars; i++) {
++ sStarSelectorModels[i] =
++ spawn_object_abs_with_rot(gCurrentObject, 0, selectorModelIDs[i], bhvActSelectorStarType,
++ 75 + sVisibleStars * -75 + i * 152, 248, -300, 0, 0, 0);
++ sStarSelectorModels[i]->oStarSelectorSize = 1.0f;
++ }
+ }
+
+ render_100_coin_star(stars);
diff --git a/enhancements/widescreenv2_ultrasm64.patch b/enhancements/widescreenv2_ultrasm64.patch
new file mode 100644
index 0000000..667e6e2
--- /dev/null
+++ b/enhancements/widescreenv2_ultrasm64.patch
@@ -0,0 +1,227 @@
+diff --git a/include/text_strings.h.in b/include/text_strings.h.in
+index 749179b..3b23b41 100644
+--- a/include/text_strings.h.in
++++ b/include/text_strings.h.in
+@@ -24,6 +24,10 @@
+ // Ingame Menu
+ #define TEXT_PAUSE _("PAUSE") // Pause text, Castle Courses
+ #define TEXT_HUD_CONGRATULATIONS _("CONGRATULATIONS") // Course Complete Text, Bowser Courses
++#define TEXT_HUD_CURRENT_RATIO_43 _("CURRENT ASPECT RATIO: 4:3. PRESS L TO SWITCH TO 16:9")
++#define TEXT_HUD_CURRENT_RATIO_169 _("CURRENT ASPECT RATIO: 16:9. PRESS L TO SWITCH TO 4:3")
++#define TEXT_HUD_WIDE_INFO _("PLEASE CONFIGURE YOUR DISPLAY OR YOUR EMULATOR TO")
++#define TEXT_HUD_WIDE_INFO2 _("STRETCH THE IMAGE TO 16:9")
+
+ #if defined(VERSION_JP) || defined(VERSION_SH)
+
+diff --git a/src/game/ingame_menu.c b/src/game/ingame_menu.c
+index 9344738..37bc1d1 100644
+--- a/src/game/ingame_menu.c
++++ b/src/game/ingame_menu.c
+@@ -34,6 +34,11 @@ s16 gDialogY; // D_8032F69C
+ s16 gCutsceneMsgXOffset;
+ s16 gCutsceneMsgYOffset;
+ s8 gRedCoinsCollected;
++u8 textCurrRatio43[] = { TEXT_HUD_CURRENT_RATIO_43 };
++u8 textCurrRatio169[] = { TEXT_HUD_CURRENT_RATIO_169 };
++u8 textWideInfo[] = { TEXT_HUD_WIDE_INFO };
++u8 textWideInfo2[] = { TEXT_HUD_WIDE_INFO2 };
++extern s32 widescreen = 0;
+
+ extern u8 gLastCompletedCourseNum;
+ extern u8 gLastCompletedStarNum;
+@@ -1672,6 +1677,7 @@ s8 gDialogCourseActNum = 1;
+ #define DIAG_VAL2 240 // JP & US
+ #endif
+
++
+ void render_dialog_entries(void) {
+ #ifdef VERSION_EU
+ s8 lowerBound;
+@@ -1713,7 +1719,7 @@ void render_dialog_entries(void) {
+ switch (gDialogBoxState) {
+ case DIALOG_STATE_OPENING:
+ if (gDialogBoxOpenTimer == DEFAULT_DIALOG_BOX_ANGLE) {
+- play_dialog_sound(gDialogID);
++ //play_dialog_sound(gDialogID);
+ play_sound(SOUND_MENU_MESSAGE_APPEAR, gGlobalSoundSource);
+ }
+
+@@ -2199,6 +2205,7 @@ void render_pause_my_score_coins(void) {
+ #else
+ u8 textCourse[] = { TEXT_COURSE };
+ u8 textMyScore[] = { TEXT_MY_SCORE };
++
+ #endif
+ u8 textStar[] = { TEXT_STAR };
+ u8 textUnfilledStar[] = { TEXT_UNFILLED_STAR };
+@@ -2266,8 +2273,18 @@ void render_pause_my_score_coins(void) {
+ print_generic_string(get_string_width(gTextCourseArr[gInGameLanguage]) + 51, 157, strCourseNum);
+ #else
+ print_generic_string(CRS_NUM_X1, 157, strCourseNum);
++ if (widescreen == 0) {
++ print_generic_string(10, 20, textCurrRatio43);
++ }
++ else {
++ print_generic_string(10, 20, textCurrRatio169);
++ print_generic_string(10, 200, textWideInfo);
++ print_generic_string(10, 180, textWideInfo2);
++ }
++
+ #endif
+
++
+ actName = segmented_to_virtual(actNameTbl[(gCurrCourseNum - 1) * 6 + gDialogCourseActNum - 1]);
+
+ if (starFlags & (1 << (gDialogCourseActNum - 1))) {
+@@ -2557,10 +2574,25 @@ void render_pause_castle_main_strings(s16 x, s16 y) {
+ }
+ }
+ }
+-
++ if (gPlayer1Controller->buttonPressed & L_TRIG){
++ if (widescreen == 0){
++ widescreen = 1;
++ }
++ else{
++ widescreen = 0;
++ }
++ }
+ gSPDisplayList(gDisplayListHead++, dl_ia_text_begin);
+ gDPSetEnvColor(gDisplayListHead++, 255, 255, 255, gDialogTextAlpha);
+
++ if (widescreen == 0) {
++ print_generic_string(10, 20, textCurrRatio43);
++ }
++ else {
++ print_generic_string(10, 20, textCurrRatio169);
++ print_generic_string(10, 200, textWideInfo);
++ print_generic_string(10, 180, textWideInfo2);
++ }
+ if (gDialogLineNum < COURSE_STAGES_COUNT) {
+ courseName = segmented_to_virtual(courseNameTbl[gDialogLineNum]);
+ render_pause_castle_course_stars(x, y, gCurrSaveFileNum - 1, gDialogLineNum);
+@@ -2626,7 +2658,14 @@ s16 render_pause_courses_and_castle(void) {
+ shade_screen();
+ render_pause_my_score_coins();
+ render_pause_red_coins();
+-
++ if (gPlayer1Controller->buttonPressed & L_TRIG){
++ if (widescreen == 0){
++ widescreen = 1;
++ }
++ else{
++ widescreen = 0;
++ }
++ }
+ if (gMarioStates[0].action & ACT_FLAG_PAUSE_EXIT) {
+ render_pause_course_options(99, 93, &gDialogLineNum, 15);
+ }
+diff --git a/src/game/rendering_graph_node.c b/src/game/rendering_graph_node.c
+index 58238e8..5262fd3 100644
+--- a/src/game/rendering_graph_node.c
++++ b/src/game/rendering_graph_node.c
+@@ -10,6 +10,7 @@
+ #include "rendering_graph_node.h"
+ #include "shadow.h"
+ #include "sm64.h"
++#define WIDESCREEN
+
+ /**
+ * This file contains the code that processes the scene graph for rendering.
+@@ -235,6 +236,8 @@ static void geo_process_ortho_projection(struct GraphNodeOrthoProjection *node)
+ /**
+ * Process a perspective projection node.
+ */
++
++extern s32 widescreen;
+ static void geo_process_perspective(struct GraphNodePerspective *node) {
+ if (node->fnNode.func != NULL) {
+ node->fnNode.func(GEO_CONTEXT_RENDER, &node->fnNode.node, gMatStack[gMatStackIndex]);
+@@ -246,7 +249,13 @@ static void geo_process_perspective(struct GraphNodePerspective *node) {
+ #ifdef VERSION_EU
+ f32 aspect = ((f32) gCurGraphNodeRoot->width / (f32) gCurGraphNodeRoot->height) * 1.1f;
+ #else
+- f32 aspect = (f32) gCurGraphNodeRoot->width / (f32) gCurGraphNodeRoot->height;
++ f32 aspect;
++ if (widescreen == 1){
++ aspect = 1.775f;
++ }
++ else{
++ aspect = 1.33333f;
++ }
+ #endif
+
+ guPerspective(mtx, &perspNorm, node->fov, aspect, node->near, node->far, 1.0f);
+diff --git a/src/menu/file_select.c b/src/menu/file_select.c
+index 9437dcc..6ba1845 100644
+--- a/src/menu/file_select.c
++++ b/src/menu/file_select.c
+@@ -2854,10 +2854,12 @@ Gfx *geo_file_select_strings_and_menu_cursor(s32 callContext, UNUSED struct Grap
+ * Relocates cursor position of the last save if the game goes back to the Mario Screen
+ * either completing a course choosing "SAVE & QUIT" or having a game over.
+ */
++extern s32 widescreen;
+ s32 lvl_init_menu_values_and_cursor_pos(UNUSED s32 arg, UNUSED s32 unused) {
+ #ifdef VERSION_EU
+ s8 fileNum;
+ #endif
++ widescreen = 0;
+ sSelectedButtonID = MENU_BUTTON_NONE;
+ sCurrentMenuLevel = MENU_LAYER_MAIN;
+ sTextBaseAlpha = 0;
+diff --git a/src/menu/star_select.c b/src/menu/star_select.c
+index 07610fa..9664cc1 100644
+--- a/src/menu/star_select.c
++++ b/src/menu/star_select.c
+@@ -52,6 +52,7 @@ static s8 sSelectableStarIndex = 0;
+
+ // Act Selector menu timer that keeps counting until you choose an act.
+ static s32 sActSelectorMenuTimer = 0;
++extern s32 widescreen;
+
+ /**
+ * Act Selector Star Type Loop Action
+@@ -92,8 +93,14 @@ void bhv_act_selector_star_type_loop(void) {
+ void render_100_coin_star(u8 stars) {
+ if (stars & (1 << 6)) {
+ // If the 100 coin star has been collected, create a new star selector next to the coin score.
+- sStarSelectorModels[6] = spawn_object_abs_with_rot(gCurrentObject, 0, MODEL_STAR,
+- bhvActSelectorStarType, 370, 24, -300, 0, 0, 0);
++ if (widescreen == 1){
++ sStarSelectorModels[6] = spawn_object_abs_with_rot(gCurrentObject, 0, MODEL_STAR,
++ bhvActSelectorStarType, ((370*4.0f)/3), 24, -300, 0, 0, 0);
++ }
++ else{
++ sStarSelectorModels[6] = spawn_object_abs_with_rot(gCurrentObject, 0, MODEL_STAR,
++ bhvActSelectorStarType, 370, 24, -300, 0, 0, 0);
++ }
+ sStarSelectorModels[6]->oStarSelectorSize = 0.8;
+ sStarSelectorModels[6]->oStarSelectorType = STAR_SELECTOR_100_COINS;
+ }
+@@ -147,11 +154,21 @@ void bhv_act_selector_init(void) {
+ }
+
+ // Render star selector objects
+- for (i = 0; i < sVisibleStars; i++) {
+- sStarSelectorModels[i] =
+- spawn_object_abs_with_rot(gCurrentObject, 0, selectorModelIDs[i], bhvActSelectorStarType,
+- 75 + sVisibleStars * -75 + i * 152, 248, -300, 0, 0, 0);
+- sStarSelectorModels[i]->oStarSelectorSize = 1.0f;
++ if (widescreen == 1) {
++ for (i = 0; i < sVisibleStars; i++) {
++ sStarSelectorModels[i] =
++ spawn_object_abs_with_rot(gCurrentObject, 0, selectorModelIDs[i], bhvActSelectorStarType,
++ (((75 + sVisibleStars * -75 + i * 152)*4.0f)/3), 248, -300, 0, 0, 0);
++ sStarSelectorModels[i]->oStarSelectorSize = 1.0f;
++ }
++ }
++ else {
++ for (i = 0; i < sVisibleStars; i++) {
++ sStarSelectorModels[i] =
++ spawn_object_abs_with_rot(gCurrentObject, 0, selectorModelIDs[i], bhvActSelectorStarType,
++ 75 + sVisibleStars * -75 + i * 152, 248, -300, 0, 0, 0);
++ sStarSelectorModels[i]->oStarSelectorSize = 1.0f;
++ }
+ }
+
+ render_100_coin_star(stars);
diff --git a/include/config.h b/include/config.h
index 211a086..d1eb721 100644
--- a/include/config.h
+++ b/include/config.h
@@ -30,9 +30,9 @@
// Border Height Define for NTSC Versions
#ifdef TARGET_N64
#ifndef VERSION_EU
-#define BORDER_HEIGHT 8
+#define BORDER_HEIGHT 0
#else
-#define BORDER_HEIGHT 1
+#define BORDER_HEIGHT 0
#endif
#else
// What's the point of having a border?
diff --git a/include/text_strings.h.in b/include/text_strings.h.in
index 749179b..3b23b41 100644
--- a/include/text_strings.h.in
+++ b/include/text_strings.h.in
@@ -24,6 +24,10 @@
// Ingame Menu
#define TEXT_PAUSE _("PAUSE") // Pause text, Castle Courses
#define TEXT_HUD_CONGRATULATIONS _("CONGRATULATIONS") // Course Complete Text, Bowser Courses
+#define TEXT_HUD_CURRENT_RATIO_43 _("CURRENT ASPECT RATIO: 4:3. PRESS L TO SWITCH TO 16:9")
+#define TEXT_HUD_CURRENT_RATIO_169 _("CURRENT ASPECT RATIO: 16:9. PRESS L TO SWITCH TO 4:3")
+#define TEXT_HUD_WIDE_INFO _("PLEASE CONFIGURE YOUR DISPLAY OR YOUR EMULATOR TO")
+#define TEXT_HUD_WIDE_INFO2 _("STRETCH THE IMAGE TO 16:9")
#if defined(VERSION_JP) || defined(VERSION_SH)
diff --git a/levels/castle_grounds/script.c b/levels/castle_grounds/script.c
index 626bece..b8191ea 100644
--- a/levels/castle_grounds/script.c
+++ b/levels/castle_grounds/script.c
@@ -132,6 +132,7 @@ const LevelScript level_castle_grounds_entry[] = {
FREE_LEVEL_POOL(),
MARIO_POS(/*area*/ 1, /*yaw*/ 180, /*pos*/ -1328, 260, 4664),
CALL(/*arg*/ 0, /*func*/ lvl_init_or_update),
+ CALL(0, lvl_set_widescreen),
CALL_LOOP(/*arg*/ 1, /*func*/ lvl_init_or_update),
CLEAR_LEVEL(),
SLEEP_BEFORE_EXIT(/*frames*/ 1),
diff --git a/src/game/ingame_menu.c b/src/game/ingame_menu.c
index 8190f88..e4d0f32 100644
--- a/src/game/ingame_menu.c
+++ b/src/game/ingame_menu.c
@@ -34,6 +34,11 @@ s16 gDialogY; // D_8032F69C
s16 gCutsceneMsgXOffset;
s16 gCutsceneMsgYOffset;
s8 gRedCoinsCollected;
+u8 textCurrRatio43[] = { TEXT_HUD_CURRENT_RATIO_43 };
+u8 textCurrRatio169[] = { TEXT_HUD_CURRENT_RATIO_169 };
+u8 textWideInfo[] = { TEXT_HUD_WIDE_INFO };
+u8 textWideInfo2[] = { TEXT_HUD_WIDE_INFO2 };
+u8 widescreen = 1;
extern u8 gLastCompletedCourseNum;
extern u8 gLastCompletedStarNum;
@@ -2266,6 +2271,24 @@ void render_pause_my_score_coins(void) {
print_generic_string(get_string_width(gTextCourseArr[gInGameLanguage]) + 51, 157, strCourseNum);
#else
print_generic_string(CRS_NUM_X1, 157, strCourseNum);
+ if (widescreen == 0) {
+ if (COURSE_IS_MAIN_COURSE(gCurrCourseNum)) {
+ print_generic_string(10, 40, textCurrRatio43);
+ } else {
+ print_generic_string(10, 20, textCurrRatio43);
+ }
+
+ }
+ else {
+ if (COURSE_IS_MAIN_COURSE(gCurrCourseNum)) {
+ print_generic_string(10, 40, textCurrRatio169);
+ } else {
+ print_generic_string(10, 20, textCurrRatio169);
+ }
+
+ print_generic_string(10, 200, textWideInfo);
+ print_generic_string(10, 180, textWideInfo2);
+ }
#endif
actName = segmented_to_virtual(actNameTbl[(gCurrCourseNum - 1) * 6 + gDialogCourseActNum - 1]);
@@ -2557,10 +2580,25 @@ void render_pause_castle_main_strings(s16 x, s16 y) {
}
}
}
+ if (gPlayer1Controller->buttonPressed & L_TRIG){
+ if (widescreen == 0){
+ widescreen = 1;
+ }
+ else{
+ widescreen = 0;
+ }
+ }
gSPDisplayList(gDisplayListHead++, dl_ia_text_begin);
gDPSetEnvColor(gDisplayListHead++, 255, 255, 255, gDialogTextAlpha);
-
+ if (widescreen == 0) {
+ print_generic_string(10, 20, textCurrRatio43);
+ }
+ else {
+ print_generic_string(10, 20, textCurrRatio169);
+ print_generic_string(10, 200, textWideInfo);
+ print_generic_string(10, 180, textWideInfo2);
+ }
if (gDialogLineNum < COURSE_STAGES_COUNT) {
courseName = segmented_to_virtual(courseNameTbl[gDialogLineNum]);
render_pause_castle_course_stars(x, y, gCurrSaveFileNum - 1, gDialogLineNum);
@@ -2626,6 +2664,14 @@ s16 render_pause_courses_and_castle(void) {
shade_screen();
render_pause_my_score_coins();
render_pause_red_coins();
+ if (gPlayer1Controller->buttonPressed & L_TRIG){
+ if (widescreen == 0){
+ widescreen = 1;
+ }
+ else{
+ widescreen = 0;
+ }
+ }
if (gMarioStates[0].action & ACT_FLAG_PAUSE_EXIT) {
render_pause_course_options(99, 93, &gDialogLineNum, 15);
diff --git a/src/game/level_update.c b/src/game/level_update.c
index 4ecb902..b2d6e53 100644
--- a/src/game/level_update.c
+++ b/src/game/level_update.c
@@ -1247,6 +1247,10 @@ s32 lvl_init_or_update(s16 initOrUpdate, UNUSED s32 unused) {
return result;
}
+extern u8 widescreen;
+void lvl_set_widescreen(void) {
+ widescreen = 1;
+}
s32 lvl_init_from_save_file(UNUSED s16 arg0, s32 levelNum) {
#ifdef VERSION_EU
diff --git a/src/game/level_update.h b/src/game/level_update.h
index 521b4ef..58d4e75 100644
--- a/src/game/level_update.h
+++ b/src/game/level_update.h
@@ -128,5 +128,6 @@ s32 lvl_init_from_save_file(UNUSED s16 arg0, s32 levelNum);
s32 lvl_set_current_level(UNUSED s16 arg0, s32 levelNum);
s32 lvl_play_the_end_screen_sound(UNUSED s16 arg0, UNUSED s32 arg1);
void basic_update(UNUSED s16 *arg);
+void lvl_set_widescreen(void);
#endif // LEVEL_UPDATE_H
diff --git a/src/game/rendering_graph_node.c b/src/game/rendering_graph_node.c
index 58238e8..09a6c87 100644
--- a/src/game/rendering_graph_node.c
+++ b/src/game/rendering_graph_node.c
@@ -10,6 +10,7 @@
#include "rendering_graph_node.h"
#include "shadow.h"
#include "sm64.h"
+#define WIDESCREEN
/**
* This file contains the code that processes the scene graph for rendering.
@@ -39,6 +40,7 @@
s16 gMatStackIndex;
Mat4 gMatStack[32];
Mtx *gMatStackFixed[32];
+f32 aspect;
/**
* Animation nodes have state in global variables, so this struct captures
@@ -235,6 +237,7 @@ static void geo_process_ortho_projection(struct GraphNodeOrthoProjection *node)
/**
* Process a perspective projection node.
*/
+extern u8 widescreen;
static void geo_process_perspective(struct GraphNodePerspective *node) {
if (node->fnNode.func != NULL) {
node->fnNode.func(GEO_CONTEXT_RENDER, &node->fnNode.node, gMatStack[gMatStackIndex]);
@@ -246,7 +249,12 @@ static void geo_process_perspective(struct GraphNodePerspective *node) {
#ifdef VERSION_EU
f32 aspect = ((f32) gCurGraphNodeRoot->width / (f32) gCurGraphNodeRoot->height) * 1.1f;
#else
- f32 aspect = (f32) gCurGraphNodeRoot->width / (f32) gCurGraphNodeRoot->height;
+ if (widescreen == 1){
+ aspect = 1.775f;
+ }
+ else{
+ aspect = 1.33333f;
+ }
#endif
guPerspective(mtx, &perspNorm, node->fov, aspect, node->near, node->far, 1.0f);
@@ -755,7 +763,7 @@ static s32 obj_is_in_view(struct GraphNodeObject *node, Mat4 matrix) {
// ! @bug The aspect ratio is not accounted for. When the fov value is 45,
// the horizontal effective fov is actually 60 degrees, so you can see objects
// visibly pop in or out at the edge of the screen.
- halfFov = (gCurGraphNodeCamFrustum->fov / 2.0f + 1.0f) * 32768.0f / 180.0f + 0.5f;
+ halfFov = ((gCurGraphNodeCamFrustum->fov*aspect) / 2.0f + 1.0f) * 32768.0f / 180.0f + 0.5f;
hScreenEdge = -matrix[3][2] * sins(halfFov) / coss(halfFov);
// -matrix[3][2] is the depth, which gets multiplied by tan(halfFov) to get
diff --git a/src/menu/file_select.c b/src/menu/file_select.c
index c894797..94a3566 100644
--- a/src/menu/file_select.c
+++ b/src/menu/file_select.c
@@ -2854,10 +2854,12 @@ Gfx *geo_file_select_strings_and_menu_cursor(s32 callContext, UNUSED struct Grap
* Relocates cursor position of the last save if the game goes back to the Mario Screen
* either completing a course choosing "SAVE & QUIT" or having a game over.
*/
+extern u8 widescreen;
s32 lvl_init_menu_values_and_cursor_pos(UNUSED s32 arg, UNUSED s32 unused) {
#ifdef VERSION_EU
s8 fileNum;
#endif
+ widescreen = 0;
sSelectedButtonID = MENU_BUTTON_NONE;
sCurrentMenuLevel = MENU_LAYER_MAIN;
sTextBaseAlpha = 0;
diff --git a/src/menu/star_select.c b/src/menu/star_select.c
index 025dbf2..4840898 100644
--- a/src/menu/star_select.c
+++ b/src/menu/star_select.c
@@ -52,7 +52,7 @@ static s8 sSelectableStarIndex = 0;
// Act Selector menu timer that keeps counting until you choose an act.
static s32 sActSelectorMenuTimer = 0;
-
+extern u8 widescreen;
/**
* Act Selector Star Type Loop Action
* Defines a select type for a star in the act selector.
@@ -92,8 +92,15 @@ void bhv_act_selector_star_type_loop(void) {
void render_100_coin_star(u8 stars) {
if (stars & (1 << 6)) {
// If the 100 coin star has been collected, create a new star selector next to the coin score.
- sStarSelectorModels[6] = spawn_object_abs_with_rot(gCurrentObject, 0, MODEL_STAR,
- bhvActSelectorStarType, 370, 24, -300, 0, 0, 0);
+ if (widescreen == 1){
+ sStarSelectorModels[6] = spawn_object_abs_with_rot(gCurrentObject, 0, MODEL_STAR,
+ bhvActSelectorStarType, ((370*4.0f)/3), 24, -300, 0, 0, 0);
+ }
+ else{
+ sStarSelectorModels[6] = spawn_object_abs_with_rot(gCurrentObject, 0, MODEL_STAR,
+ bhvActSelectorStarType, 370, 24, -300, 0, 0, 0);
+ }
+
sStarSelectorModels[6]->oStarSelectorSize = 0.8;
sStarSelectorModels[6]->oStarSelectorType = STAR_SELECTOR_100_COINS;
}
@@ -147,11 +154,21 @@ void bhv_act_selector_init(void) {
}
// Render star selector objects
- for (i = 0; i < sVisibleStars; i++) {
- sStarSelectorModels[i] =
- spawn_object_abs_with_rot(gCurrentObject, 0, selectorModelIDs[i], bhvActSelectorStarType,
- 75 + sVisibleStars * -75 + i * 152, 248, -300, 0, 0, 0);
- sStarSelectorModels[i]->oStarSelectorSize = 1.0f;
+ if (widescreen == 1) {
+ for (i = 0; i < sVisibleStars; i++) {
+ sStarSelectorModels[i] =
+ spawn_object_abs_with_rot(gCurrentObject, 0, selectorModelIDs[i], bhvActSelectorStarType,
+ (((75 + sVisibleStars * -75 + i * 152)*4.0f)/3), 248, -300, 0, 0, 0);
+ sStarSelectorModels[i]->oStarSelectorSize = 1.0f;
+ }
+ }
+ else {
+ for (i = 0; i < sVisibleStars; i++) {
+ sStarSelectorModels[i] =
+ spawn_object_abs_with_rot(gCurrentObject, 0, selectorModelIDs[i], bhvActSelectorStarType,
+ 75 + sVisibleStars * -75 + i * 152, 248, -300, 0, 0, 0);
+ sStarSelectorModels[i]->oStarSelectorSize = 1.0f;
+ }
}
render_100_coin_star(stars);
+103 -12
View File
@@ -1,10 +1,9 @@
#ifndef CONFIG_H
#define CONFIG_H
// ULTRASM64-EXTBOUNDS CONFIG FLAGS NEAR BOTTOM
/**
* @file config.h
* A catch-all file for configuring various bugfixes and other settings
* (maybe eventually) in SM64
* A catch-all file for configuring various bugfixes and other settings (maybe eventually) in SM64
*/
// Bug Fixes
@@ -34,7 +33,8 @@
#define EU_CUSTOM_CAKE_FIX 1
// Support Rumble Pak
#define ENABLE_RUMBLE (1 || VERSION_SH)
// Currently not recommended, as it may cause random crashes.
//#define ENABLE_RUMBLE (1 || VERSION_SH)
// Clear RAM on boot
#define CLEARRAM 1
@@ -45,16 +45,107 @@
// Border Height Define for NTSC Versions
#ifdef TARGET_N64
#ifndef VERSION_EU
#define BORDER_HEIGHT_CONSOLE 8
#define BORDER_HEIGHT_EMULATOR 0
#else
#define BORDER_HEIGHT_CONSOLE 1
#define BORDER_HEIGHT_EMULATOR 0
#endif
#else
// Size of the black border at the top and bottom of the screen. You can set it to different values for console and emulator.
// There is generally no reason to have a value other than 0 for emulator. As for console, it provides a (small) performance boost.
#define BORDER_HEIGHT_CONSOLE 0
#define BORDER_HEIGHT_EMULATOR 0
#endif
// -- ultrasm64-extbounds specific settings --
// COMMON HACK CHANGES
// Internal ROM name. NEEDS TO BE **EXACTLY** 20 CHARACTERS. Can't be 19 characters, can't be 21 characters. You can fill it with spaces.
// The end quote should be here: "
#define INTERNAL_ROM_NAME "SUPERMARIO64 "
// Disable lives and hide the lives counter
#define DISABLE_LIVES
// Skip peach letter cutscene
#define PEACH_SKIP
// Fixes the castle music sometimes triggering after getting a dialog
#define CASTLE_MUSIC_FIX
// Remove course specific camera processing
#define CAMERA_FIX
// Change the movement speed when hanging from a ceiling (the vanilla value is 4.f)
#define HANGING_SPEED 12.f
// Makes Mario face the direction of the analog stick directly while hanging from a ceiling, without doing "semicircles"
#define TIGHTER_HANGING_CONTROLS
// Makes Mario turn around instantly when moving on the ground
//#define SUPER_RESPONSIVE_CONTROLS
// Disables fall damage
#define NO_FALL_DAMAGE
// Disables the scream that mario makes when falling off a great height (this is separate from actual fall damage)
//#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
// 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)
//#define GLOBAL_STAR_IDS
// Uncomment this if you want to skip the title screen (Super Mario 64 logo)
//#define SKIP_TITLE_SCREEN
// Uncomment this if you want to keep the mario head and not skip it
//#define KEEP_MARIO_HEAD
// Makes the coins ia8 64x64 instead of ia16 32x32. Uses new ia8 textures so that vanilla coins look better.
#define IA8_COINS
// Enables "parallel lakitu camera" or "aglab cam" which lets you move the camera smoothly with the dpad
#define PARALLEL_LAKITU_CAM
// HACKER QOL
// Enable widescreen (16:9) support
#define WIDE
// When this option is enabled, LODs will ONLY work on console.
// When this option is disabled, LODs will work regardless of whether console or emulator is used.
// Regardless of whether this setting is enabled or not, you can use gIsConsole to wrap your own code in a console check.
#define AUTO_LOD
// Increase the maximum pole length (it will treat bparam1 and bparam2 as a single value)
#define LONGER_POLES
// Disable AA (Recommended: it changes nothing on emulator, and it makes console run better)
#define DISABLE_AA
// Allows Mario to ledgegrab sloped floors
#define NO_FALSE_LEDGEGRABS
// Number of possible unique model ID's (keep it higher than 256)
#define MODEL_ID_COUNT 256
// Increase audio heap size to allow for more concurrent notes to be played and for more custom sequences/banks to be imported (does nothing with EU and SH versions)
#define EXPAND_AUDIO_HEAP
// BUG/GAME QOL FIXES
// Fix instant warp offset not working when warping across different areas
#define INSTANT_WARP_OFFSET_FIX
// Whether a tree uses snow particles or not is decided via the model IDs instead of the course number
#define TREE_PARTICLE_FIX
// Allows Mario to jump kick on steep surfaces that are set to be non slippery, instead of being forced to dive
#define JUMP_KICK_FIX
// Allow Mario to grab hangable ceilings from any state
#define HANGING_FIX
// The last frame that will be considered a firsty when wallkicking
#define FIRSTY_LAST_FRAME 1
// 46 degree walkicks
//#define WALLKICKS_46_DEGREES
// Disable BLJs and crush SimpleFlips's dreams
//#define DISABLE_BLJ
// RELATING TO EXIT COURSE
// Disable exit course
//#define DISABLE_EXIT_COURSE
// Decides whether you can exit course while moving (has no effect if you disable exit course)
//#define EXIT_COURSE_WHILE_MOVING
// Decides which level "exit course" takes you to (has no effect if you disable exit course)
#define EXIT_COURSE_LEVEL LEVEL_CASTLE
// Decides the area node "exit course" takes you to (has no effect if you disable exit course)
#define EXIT_COURSE_AREA 0x01
// Decides the warp node "exit course" takes you to (has no effect if you disable exit course)
#define EXIT_COURSE_NODE 0x1F
// OTHER ENHANCEMENTS
// Skybox size modifier, changing this will add support for larger skybox images. NOTE: Vanilla skyboxes may break if you change this option. Be sure to rescale them accordingly.
// Whenever you change this, make sure to run "make -C tools clean" to rebuild the skybox tool (alternatively go into skyconv.c and change the file in any way (like adding/deleting a space) to specifically rebuild that tool).
// When increasing this, you should probably also increase the GFX pool size. (the GFX_POOL_SIZE define in src/game/game_init.h)
#define SKYBOX_SIZE 1
// If you want to change the extended boundaries mode, go to engine/extended_bounds.h and change EXTENDED_BOUNDS_MODE
#endif // CONFIG_H
+11 -8
View File
@@ -4,6 +4,7 @@
#include "command_macros_base.h"
#include "level_table.h"
#include "config.h"
#define OP_AND 0
#define OP_NAND 1
@@ -169,7 +170,7 @@
CMD_PTR(romEnd)
#endif
#ifdef GODDARD
#ifdef KEEP_MARIO_HEAD
#define LOAD_MARIO_HEAD(sethead) \
CMD_BBH(0x19, 0x04, sethead)
#else
@@ -209,8 +210,9 @@
CMD_BBH(0x20, 0x04, 0x0000)
#define LOAD_MODEL_FROM_DL(model, dl, layer) \
CMD_BBH(0x21, 0x08, ((layer << 12) | model)), \
CMD_PTR(dl)
CMD_BBH(0x21, 0x0C, 0), \
CMD_PTR(dl), \
CMD_HH(layer, model)
#define LOAD_MODEL_FROM_GEO(model, geo) \
CMD_BBH(0x22, 0x08, model), \
@@ -218,21 +220,22 @@
// unk8 is float, but doesn't really matter since CMD23 is unused
#define CMD23(model, unk4, unk8) \
CMD_BBH(0x22, 0x08, model), \
CMD_BBH(0x22, 0x08, 0), \
CMD_PTR(unk4), \
CMD_W(unk8)
#define OBJECT_WITH_ACTS(model, posX, posY, posZ, angleX, angleY, angleZ, behParam, beh, acts) \
CMD_BBBB(0x24, 0x18, acts, model), \
CMD_BBBB(0x24, 0x1C, acts, 0x00), \
CMD_HHHHHH(posX, posY, posZ, angleX, angleY, angleZ), \
CMD_W(behParam), \
CMD_PTR(beh)
CMD_PTR(beh), \
CMD_W(model)
#define OBJECT(model, posX, posY, posZ, angleX, angleY, angleZ, behParam, beh) \
OBJECT_WITH_ACTS(model, posX, posY, posZ, angleX, angleY, angleZ, behParam, beh, 0x1F)
#define MARIO(unk3, behArg, beh) \
CMD_BBBB(0x25, 0x0C, 0x00, unk3), \
#define MARIO(model, behArg, beh) \
CMD_BBH(0x25, 0x0C, model), \
CMD_W(behArg), \
CMD_PTR(beh)
+65
View File
@@ -21,6 +21,7 @@
#define _GBI_H_
#include <PR/ultratypes.h>
#include <config.h>
/*
* To use the F3DEX ucodes, define F3DEX_GBI before include this file.
@@ -942,6 +943,68 @@
#define RM_CUSTOM_AA_ZB_XLU_SURF(clk) \
RM_AA_ZB_XLU_SURF(clk) | Z_UPD
#ifdef DISABLE_AA
#define G_RM_AA_ZB_OPA_SURF RM_ZB_OPA_SURF(1)
#define G_RM_AA_ZB_OPA_SURF2 RM_ZB_OPA_SURF(2)
#define G_RM_AA_ZB_XLU_SURF RM_ZB_XLU_SURF(1)
#define G_RM_AA_ZB_XLU_SURF2 RM_ZB_XLU_SURF(2)
#define G_RM_AA_ZB_OPA_DECAL RM_ZB_OPA_DECAL(1)
#define G_RM_AA_ZB_OPA_DECAL2 RM_ZB_OPA_DECAL(2)
#define G_RM_AA_ZB_XLU_DECAL RM_ZB_XLU_DECAL(1)
#define G_RM_AA_ZB_XLU_DECAL2 RM_ZB_XLU_DECAL(2)
#define G_RM_AA_ZB_OPA_INTER RM_AA_ZB_OPA_INTER(1)
#define G_RM_AA_ZB_OPA_INTER2 RM_AA_ZB_OPA_INTER(2)
#define G_RM_AA_ZB_XLU_INTER RM_AA_ZB_XLU_INTER(1)
#define G_RM_AA_ZB_XLU_INTER2 RM_AA_ZB_XLU_INTER(2)
#define G_RM_AA_ZB_XLU_LINE RM_AA_ZB_XLU_LINE(1)
#define G_RM_AA_ZB_XLU_LINE2 RM_AA_ZB_XLU_LINE(2)
#define G_RM_AA_ZB_DEC_LINE RM_AA_ZB_DEC_LINE(1)
#define G_RM_AA_ZB_DEC_LINE2 RM_AA_ZB_DEC_LINE(2)
#define G_RM_AA_ZB_TEX_EDGE RM_AA_ZB_TEX_EDGE(1)
#define G_RM_AA_ZB_TEX_EDGE2 RM_AA_ZB_TEX_EDGE(2)
#define G_RM_AA_ZB_TEX_INTER RM_AA_ZB_TEX_INTER(1)
#define G_RM_AA_ZB_TEX_INTER2 RM_AA_ZB_TEX_INTER(2)
#define G_RM_AA_ZB_SUB_SURF RM_AA_ZB_SUB_SURF(1)
#define G_RM_AA_ZB_SUB_SURF2 RM_AA_ZB_SUB_SURF(2)
#define G_RM_AA_ZB_PCL_SURF RM_ZB_PCL_SURF(1)
#define G_RM_AA_ZB_PCL_SURF2 RM_ZB_PCL_SURF(2)
#define G_RM_AA_ZB_OPA_TERR RM_AA_ZB_OPA_TERR(1)
#define G_RM_AA_ZB_OPA_TERR2 RM_AA_ZB_OPA_TERR(2)
#define G_RM_AA_ZB_TEX_TERR RM_AA_ZB_TEX_TERR(1)
#define G_RM_AA_ZB_TEX_TERR2 RM_AA_ZB_TEX_TERR(2)
#define G_RM_AA_ZB_SUB_TERR RM_AA_ZB_SUB_TERR(1)
#define G_RM_AA_ZB_SUB_TERR2 RM_AA_ZB_SUB_TERR(2)
#define G_RM_RA_ZB_OPA_SURF RM_RA_ZB_OPA_SURF(1)
#define G_RM_RA_ZB_OPA_SURF2 RM_RA_ZB_OPA_SURF(2)
#define G_RM_RA_ZB_OPA_DECAL RM_RA_ZB_OPA_DECAL(1)
#define G_RM_RA_ZB_OPA_DECAL2 RM_RA_ZB_OPA_DECAL(2)
#define G_RM_RA_ZB_OPA_INTER RM_RA_ZB_OPA_INTER(1)
#define G_RM_RA_ZB_OPA_INTER2 RM_RA_ZB_OPA_INTER(2)
#define G_RM_AA_OPA_SURF RM_OPA_SURF(1)
#define G_RM_AA_OPA_SURF2 RM_OPA_SURF(2)
#define G_RM_AA_XLU_SURF RM_XLU_SURF(1)
#define G_RM_AA_XLU_SURF2 RM_XLU_SURF(2)
#define G_RM_AA_XLU_LINE RM_AA_XLU_LINE(1)
#define G_RM_AA_XLU_LINE2 RM_AA_XLU_LINE(2)
#define G_RM_AA_DEC_LINE RM_AA_DEC_LINE(1)
#define G_RM_AA_DEC_LINE2 RM_AA_DEC_LINE(2)
#define G_RM_AA_TEX_EDGE RM_TEX_EDGE(1)
#define G_RM_AA_TEX_EDGE2 RM_TEX_EDGE(2)
#define G_RM_AA_SUB_SURF RM_AA_SUB_SURF(1)
#define G_RM_AA_SUB_SURF2 RM_AA_SUB_SURF(2)
#define G_RM_AA_PCL_SURF RM_PCL_SURF(1)
#define G_RM_AA_PCL_SURF2 RM_PCL_SURF(2)
#define G_RM_AA_OPA_TERR RM_AA_OPA_TERR(1)
#define G_RM_AA_OPA_TERR2 RM_AA_OPA_TERR(2)
#define G_RM_AA_TEX_TERR RM_AA_TEX_TERR(1)
#define G_RM_AA_TEX_TERR2 RM_AA_TEX_TERR(2)
#define G_RM_AA_SUB_TERR RM_AA_SUB_TERR(1)
#define G_RM_AA_SUB_TERR2 RM_AA_SUB_TERR(2)
#else
#define G_RM_AA_ZB_OPA_SURF RM_AA_ZB_OPA_SURF(1)
#define G_RM_AA_ZB_OPA_SURF2 RM_AA_ZB_OPA_SURF(2)
@@ -1002,6 +1065,8 @@
#define G_RM_AA_SUB_TERR RM_AA_SUB_TERR(1)
#define G_RM_AA_SUB_TERR2 RM_AA_SUB_TERR(2)
#endif
#define G_RM_RA_OPA_SURF RM_RA_OPA_SURF(1)
#define G_RM_RA_OPA_SURF2 RM_RA_OPA_SURF(2)
+83
View File
@@ -1161,4 +1161,87 @@
#define /*0x0FC*/ oYoshiChosenHome OBJECT_FIELD_S32(0x1D)
#define /*0x100*/ oYoshiTargetYaw OBJECT_FIELD_S32(0x1E)
/*Custom general defines:
For general s32 ints, use o->oF4, oF8, oFC, o100, o104, o108, o10C, and o110
For floats, apply the prefix "oFloat" before the index. For object pointers, apply "oObj", and for surface pointers, apply "oSurf"
Examples: o->oFloatF4, o->oSurf10C
s16 variables are also supported, and using them effectly can double the number of available members. The full list of s16 defines is:
os16F4
os16F6
os16F8
os16FA
os16FC
os16FE
os16100
os16102
os16104
os16106
os16108
os1610A
os1610C
os1610E
os16110
os16112*/
#define /*0x0F4*/ oF4 OBJECT_FIELD_S32(0x1B)
#define /*0x0F8*/ oF8 OBJECT_FIELD_S32(0x1C)
#define /*0x0FC*/ oFC OBJECT_FIELD_S32(0x1D)
#define /*0x100*/ o100 OBJECT_FIELD_S32(0x1E)
#define /*0x104*/ o104 OBJECT_FIELD_S32(0x1F)
#define /*0x108*/ o108 OBJECT_FIELD_S32(0x20)
#define /*0x10C*/ o10C OBJECT_FIELD_S32(0x21)
#define /*0x110*/ o110 OBJECT_FIELD_S32(0x22)
#define /*0x0F4*/ oFloatF4 OBJECT_FIELD_F32(0x1B)
#define /*0x0F8*/ oFloatF8 OBJECT_FIELD_F32(0x1C)
#define /*0x0FC*/ oFloatFC OBJECT_FIELD_F32(0x1D)
#define /*0x100*/ oFloat100 OBJECT_FIELD_F32(0x1E)
#define /*0x104*/ oFloat104 OBJECT_FIELD_F32(0x1F)
#define /*0x108*/ oFloat108 OBJECT_FIELD_F32(0x20)
#define /*0x10C*/ oFloat10C OBJECT_FIELD_F32(0x21)
#define /*0x110*/ oFloat110 OBJECT_FIELD_F32(0x22)
#define /*0x0F4*/ oObjF4 OBJECT_FIELD_OBJ(0x1B)
#define /*0x0F8*/ oObjF8 OBJECT_FIELD_OBJ(0x1C)
#define /*0x0FC*/ oObjFC OBJECT_FIELD_OBJ(0x1D)
#define /*0x100*/ oObj100 OBJECT_FIELD_OBJ(0x1E)
#define /*0x104*/ oObj104 OBJECT_FIELD_OBJ(0x1F)
#define /*0x108*/ oObj108 OBJECT_FIELD_OBJ(0x20)
#define /*0x10C*/ oObj10C OBJECT_FIELD_OBJ(0x21)
#define /*0x110*/ oObj110 OBJECT_FIELD_OBJ(0x22)
#define /*0x0F4*/ oSurfF4 OBJECT_FIELD_SURFACE(0x1B)
#define /*0x0F8*/ oSurfF8 OBJECT_FIELD_SURFACE(0x1C)
#define /*0x0FC*/ oSurfFC OBJECT_FIELD_SURFACE(0x1D)
#define /*0x100*/ oSurf100 OBJECT_FIELD_SURFACE(0x1E)
#define /*0x104*/ oSurf104 OBJECT_FIELD_SURFACE(0x1F)
#define /*0x108*/ oSurf108 OBJECT_FIELD_SURFACE(0x20)
#define /*0x10C*/ oSurf10C OBJECT_FIELD_SURFACE(0x21)
#define /*0x110*/ oSurf110 OBJECT_FIELD_SURFACE(0x22)
#define /*0x0F4*/ os16F4 OBJECT_FIELD_S16(0x1B, 0)
#define /*0x0F6*/ os16F6 OBJECT_FIELD_S16(0x1B, 1)
#define /*0x0F8*/ os16F8 OBJECT_FIELD_S16(0x1C, 0)
#define /*0x0FA*/ os16FA OBJECT_FIELD_S16(0x1C, 1)
#define /*0x0FC*/ os16FC OBJECT_FIELD_S16(0x1D, 0)
#define /*0x0FE*/ os16FE OBJECT_FIELD_S16(0x1D, 1)
#define /*0x100*/ os16100 OBJECT_FIELD_S16(0x1E, 0)
#define /*0x102*/ os16102 OBJECT_FIELD_S16(0x1E, 1)
#define /*0x104*/ os16104 OBJECT_FIELD_S16(0x1F, 0)
#define /*0x106*/ os16106 OBJECT_FIELD_S16(0x1F, 1)
#define /*0x108*/ os16108 OBJECT_FIELD_S16(0x20, 0)
#define /*0x10A*/ os1610A OBJECT_FIELD_S16(0x20, 1)
#define /*0x10C*/ os1610C OBJECT_FIELD_S16(0x21, 0)
#define /*0x10E*/ os1610E OBJECT_FIELD_S16(0x21, 1)
#define /*0x110*/ os16110 OBJECT_FIELD_S16(0x22, 0)
#define /*0x112*/ os16112 OBJECT_FIELD_S16(0x22, 1)
#endif // OBJECT_FIELDS_H
+1
View File
@@ -14,6 +14,7 @@
* linker script syntax.
*/
#define USE_EXT_RAM
#ifndef USE_EXT_RAM
#define RAM_END 0x80400000
#else
+1 -1
View File
@@ -17,7 +17,7 @@ struct SpecialPreset
/*00*/ u8 preset_id;
/*01*/ u8 type; // Determines whether object is 8, 10, 12 or 14 bytes long.
/*02*/ u8 defParam; // Default parameter, only used when type is SPTYPE_DEF_PARAM_AND_YROT
/*03*/ u8 model;
/*03*/ ModelID model;
/*04*/ const BehaviorScript *behavior;
};
+2
View File
@@ -4,6 +4,8 @@
// Surface Types
#define SURFACE_DEFAULT 0x0000 // Environment default
#define SURFACE_BURNING 0x0001 // Lava / Frostbite (in SL), but is used mostly for Lava
#define SURFACE_NEW_WATER 0x0002 // Custom water surface
#define SURFACE_NEW_WATER_BOTTOM 0x0003 // Custom water surface bottom marker
#define SURFACE_0004 0x0004 // Unused, has no function and has parameters
#define SURFACE_HANGABLE 0x0005 // Ceiling that Mario can climb on
#define SURFACE_SLOW 0x0009 // Slow down Mario, unused
+9
View File
@@ -25,6 +25,15 @@
#define TEXT_PAUSE _("PAUSE") // Pause text, Castle Courses
#define TEXT_HUD_CONGRATULATIONS _("CONGRATULATIONS") // Course Complete Text, Bowser Courses
//Widescreen stuff
#ifdef WIDE
#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")
#define TEXT_HUD_WIDE_INFO2 _("STRETCH THE IMAGE TO 16:9")
#endif
#if defined(VERSION_JP) || defined(VERSION_SH)
/**
+1
View File
@@ -54,6 +54,7 @@ typedef s16 Trajectory;
typedef s16 PaintingData;
typedef uintptr_t BehaviorScript;
typedef u8 Texture;
typedef u16 ModelID;
enum SpTaskState {
SPTASK_STATE_NOT_STARTED,
+1 -1
View File
@@ -177,7 +177,7 @@ static const Vtx bitfs_seg7_vertex_07003340[] = {
// TODO: what is this?
// Possibly vertices for a perfect triangle, but flag seems to be used here.
// 0x070033B0 - 0x070033E0
static const s16 bitfs_seg7_todo_070033B0[] = {
UNUSED static const s16 bitfs_seg7_todo_070033B0[] = {
0x0080, 0x0100, 0x0000, 0x0000, 0x03de, 0x0000, 0xFFFF, 0xFFFF,
0xFF81, 0x0100, 0x0000, 0x0000, 0xFBE4, 0x0000, 0xFFFF, 0xFFFF,
0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x07DA, 0xFFFF, 0xFFFF,
+4 -2
View File
@@ -15,6 +15,8 @@
#include "levels/intro/header.h"
#include "config.h"
// 0x0E0002D0
const GeoLayout intro_geo_0002D0[] = {
GEO_NODE_SCREEN_AREA(0, SCREEN_WIDTH/2, SCREEN_HEIGHT/2, SCREEN_WIDTH/2, SCREEN_HEIGHT/2),
@@ -61,7 +63,7 @@ const GeoLayout intro_geo_mario_head_regular[] = {
GEO_ZBUFFER(1),
GEO_OPEN_NODE(),
GEO_CAMERA_FRUSTUM(45, 128, 16384),
#ifdef GODDARD
#ifdef KEEP_MARIO_HEAD
GEO_OPEN_NODE(),
GEO_ASM(2, geo_draw_mario_head_goddard),
GEO_CLOSE_NODE(),
@@ -94,7 +96,7 @@ const GeoLayout intro_geo_mario_head_dizzy[] = {
GEO_ZBUFFER(1),
GEO_OPEN_NODE(),
GEO_CAMERA_FRUSTUM(45, 128, 16384),
#ifdef GODDARD
#ifdef KEEP_MARIO_HEAD
GEO_OPEN_NODE(),
GEO_ASM(3, geo_draw_mario_head_goddard),
GEO_CLOSE_NODE(),
+8 -3
View File
@@ -18,8 +18,13 @@
#include "make_const_nonconst.h"
#include "levels/intro/header.h"
#include "config.h"
const LevelScript level_intro_splash_screen[] = {
INIT_LEVEL(),
#ifdef SKIP_TITLE_SCREEN
EXIT_AND_EXECUTE(/*seg*/ 0x14, _introSegmentRomStart, _introSegmentRomEnd, level_intro_mario_head_regular),
#endif
FIXED_LOAD(/*loadAddr*/ _goddardSegmentStart, /*romStart*/ _goddardSegmentRomStart, /*romEnd*/ _goddardSegmentRomEnd),
LOAD_RAW(/*seg*/ 0x13, _behaviorSegmentRomStart, _behaviorSegmentRomEnd),
LOAD_YAY0(/*seg*/ 0x07, _intro_segment_7SegmentRomStart, _intro_segment_7SegmentRomEnd),
@@ -45,12 +50,12 @@ const LevelScript level_intro_splash_screen[] = {
const LevelScript level_intro_mario_head_regular[] = {
INIT_LEVEL(),
#ifndef GODDARD
#ifndef KEEP_MARIO_HEAD
EXIT_AND_EXECUTE(/*seg*/ 0x14, _menuSegmentRomStart, _menuSegmentRomEnd, level_main_menu_entry_1),
#endif
BLACKOUT(/*active*/ TRUE),
FIXED_LOAD(/*loadAddr*/ _goddardSegmentStart, /*romStart*/ _goddardSegmentRomStart, /*romEnd*/ _goddardSegmentRomEnd),
#ifdef GODDARD
#ifdef KEEP_MARIO_HEAD
LOAD_MARIO_HEAD(/*loadHeadID*/ REGULAR_FACE),
#endif
LOAD_RAW(/*seg*/ 0x13, _behaviorSegmentRomStart, _behaviorSegmentRomEnd),
@@ -77,7 +82,7 @@ const LevelScript level_intro_mario_head_dizzy[] = {
INIT_LEVEL(),
BLACKOUT(/*active*/ TRUE),
FIXED_LOAD(/*loadAddr*/ _goddardSegmentStart, /*romStart*/ _goddardSegmentRomStart, /*romEnd*/ _goddardSegmentRomEnd),
#ifdef GODDARD
#ifdef KEEP_MARIO_HEAD
LOAD_MARIO_HEAD(/*loadHeadID*/ DIZZY_FACE),
#endif
LOAD_RAW(/*seg*/ 0x13, _behaviorSegmentRomStart, _behaviorSegmentRomEnd),
+34 -32
View File
@@ -11,47 +11,49 @@
// Argument 4: Shorthand name of the level which should be the name of the levels/ folder of the level.
// Argument 5: The shared texture bin used.
// Argument 6: Acoustic reaches for each levels.
// Argument 7, 8, 9: Echo levels for individual areas.
// Argument 7, 8, 9: Echo levels for individual areas. < Clueless hackers should change these for their levels btw
// Argument 10: Specify dynamic music tables for levels, if specified. _ for none.
// Argument 11: Specify level camera table, if specified. _ for none.
// NOTE: Be sure to edit sZoomOutAreaMasks in camera.c, as there isnt a good way to macro those right now.
// TODO: Figure something out for sZoomOutAreaMasks?
// Reworked internal names, non-level name abbreviations used from quad64 bc that was prob the best idea. - send all complaints to pyro jay
STUB_LEVEL( "", LEVEL_UNKNOWN_1, COURSE_NONE, 20000, 0x00, 0x00, 0x00, _, _)
STUB_LEVEL( "", LEVEL_UNKNOWN_2, COURSE_NONE, 20000, 0x00, 0x00, 0x00, _, _)
STUB_LEVEL( "", LEVEL_UNKNOWN_3, COURSE_NONE, 20000, 0x00, 0x00, 0x00, _, _)
DEFINE_LEVEL("TERESA OBAKE", LEVEL_BBH, COURSE_BBH, bbh, spooky, 28000, 0x28, 0x28, 0x28, sDynBbh, sCamBBH)
DEFINE_LEVEL("YYAMA1 % YSLD1", LEVEL_CCM, COURSE_CCM, ccm, snow, 17000, 0x10, 0x38, 0x38, _, sCamCCM)
DEFINE_LEVEL("SELECT ROOM", LEVEL_CASTLE, COURSE_NONE, castle_inside, inside, 20000, 0x20, 0x20, 0x30, _, sCamCastle)
DEFINE_LEVEL("HORROR DUNGEON", LEVEL_HMC, COURSE_HMC, hmc, cave, 16000, 0x28, 0x28, 0x28, sDynHmc, sCamHMC)
DEFINE_LEVEL("SABAKU % PYRMD", LEVEL_SSL, COURSE_SSL, ssl, generic, 15000, 0x08, 0x30, 0x30, _, sCamSSL)
DEFINE_LEVEL("BATTLE FIELD", LEVEL_BOB, COURSE_BOB, bob, generic, 15000, 0x08, 0x08, 0x08, _, _)
DEFINE_LEVEL("YUKIYAMA2", LEVEL_SL, COURSE_SL, sl, snow, 14000, 0x10, 0x28, 0x28, _, sCamSL)
DEFINE_LEVEL("POOL KAI", LEVEL_WDW, COURSE_WDW, wdw, grass, 17000, 0x10, 0x18, 0x18, sDynWdw, _)
DEFINE_LEVEL("WTDG % TINBOTU", LEVEL_JRB, COURSE_JRB, jrb, water, 20000, 0x10, 0x18, 0x18, sDynJrb, _)
DEFINE_LEVEL("BIG WORLD", LEVEL_THI, COURSE_THI, thi, grass, 20000, 0x0c, 0x0c, 0x20, _, sCamTHI)
DEFINE_LEVEL("CLOCK TOWER", LEVEL_TTC, COURSE_TTC, ttc, machine, 18000, 0x18, 0x18, 0x18, _, _)
DEFINE_LEVEL("RAINBOW CRUISE", LEVEL_RR, COURSE_RR, rr, sky, 20000, 0x20, 0x20, 0x20, _, sCamRR)
DEFINE_LEVEL("MAIN MAP", LEVEL_CASTLE_GROUNDS, COURSE_NONE, castle_grounds, outside, 25000, 0x08, 0x08, 0x08, _, _)
DEFINE_LEVEL("EXT1 YOKO SCRL", LEVEL_BITDW, COURSE_BITDW, bitdw, sky, 16000, 0x28, 0x28, 0x28, _, _)
DEFINE_LEVEL("EXT7 HORI MINI", LEVEL_VCUTM, COURSE_VCUTM, vcutm, outside, 30000, 0x28, 0x28, 0x28, _, _)
DEFINE_LEVEL("EXT2 TIKA LAVA", LEVEL_BITFS, COURSE_BITFS, bitfs, sky, 16000, 0x28, 0x28, 0x28, _, _)
DEFINE_LEVEL("EXT9 SUISOU", LEVEL_SA, COURSE_SA, sa, inside, 20000, 0x10, 0x10, 0x10, _, _)
DEFINE_LEVEL("EXT3 HEAVEN", LEVEL_BITS, COURSE_BITS, bits, sky, 16000, 0x28, 0x28, 0x28, _, _)
DEFINE_LEVEL("FIREB1 % INVLC", LEVEL_LLL, COURSE_LLL, lll, fire, 22000, 0x08, 0x30, 0x30, _, _)
DEFINE_LEVEL("WATER LAND", LEVEL_DDD, COURSE_DDD, ddd, water, 17000, 0x10, 0x20, 0x20, sDynDdd, _)
DEFINE_LEVEL("MOUNTAIN", LEVEL_WF, COURSE_WF, wf, grass, 13000, 0x08, 0x08, 0x08, _, _)
DEFINE_LEVEL("ENDING", LEVEL_ENDING, COURSE_CAKE_END, ending, generic, 20000, 0x00, 0x00, 0x00, _, _)
DEFINE_LEVEL("URANIWA", LEVEL_CASTLE_COURTYARD, COURSE_NONE, castle_courtyard, outside, 20000, 0x08, 0x08, 0x08, _, _)
DEFINE_LEVEL("EXT4 MINI SLID", LEVEL_PSS, COURSE_PSS, pss, mountain, 20000, 0x28, 0x28, 0x28, _, _)
DEFINE_LEVEL("IN THE FALL", LEVEL_COTMC, COURSE_COTMC, cotmc, cave, 18000, 0x28, 0x28, 0x28, _, sCamCotMC)
DEFINE_LEVEL("EXT6 MARIO FLY", LEVEL_TOTWC, COURSE_TOTWC, totwc, sky, 20000, 0x20, 0x20, 0x20, _, _)
DEFINE_LEVEL("KUPPA1", LEVEL_BOWSER_1, COURSE_BITDW, bowser_1, generic, VAL_DIFF, 0x40, 0x40, 0x40, _, _)
DEFINE_LEVEL("EXT8 BLUE SKY", LEVEL_WMOTR, COURSE_WMOTR, wmotr, generic, 20000, 0x28, 0x28, 0x28, _, _)
DEFINE_LEVEL("COURSE 5 BBH", LEVEL_BBH, COURSE_BBH, bbh, spooky, 28000, 0x28, 0x28, 0x28, sDynBbh, sCamBBH)
DEFINE_LEVEL("COURSE 4 CCM", LEVEL_CCM, COURSE_CCM, ccm, snow, 17000, 0x10, 0x38, 0x38, _, sCamCCM)
DEFINE_LEVEL("OW2 IN CASTLE", LEVEL_CASTLE, COURSE_NONE, castle_inside, inside, 20000, 0x20, 0x20, 0x30, _, sCamCastle)
DEFINE_LEVEL("COURSE 6 HMC", LEVEL_HMC, COURSE_HMC, hmc, cave, 16000, 0x28, 0x28, 0x28, sDynHmc, sCamHMC)
DEFINE_LEVEL("COURSE 8 SSL", LEVEL_SSL, COURSE_SSL, ssl, generic, 15000, 0x08, 0x30, 0x30, _, sCamSSL)
DEFINE_LEVEL("COURSE 1 BOB", LEVEL_BOB, COURSE_BOB, bob, generic, 15000, 0x08, 0x08, 0x08, _, _)
DEFINE_LEVEL("COURSE 10 SL", LEVEL_SL, COURSE_SL, sl, snow, 14000, 0x10, 0x28, 0x28, _, sCamSL)
DEFINE_LEVEL("COURSE 11 WDW", LEVEL_WDW, COURSE_WDW, wdw, grass, 17000, 0x10, 0x18, 0x18, sDynWdw, _)
DEFINE_LEVEL("COURSE 3 JRB", LEVEL_JRB, COURSE_JRB, jrb, water, 20000, 0x10, 0x18, 0x18, sDynJrb, _)
DEFINE_LEVEL("COURSE 13 THI", LEVEL_THI, COURSE_THI, thi, grass, 20000, 0x0c, 0x0c, 0x20, _, sCamTHI)
DEFINE_LEVEL("COURSE 14 TTC", LEVEL_TTC, COURSE_TTC, ttc, machine, 18000, 0x18, 0x18, 0x18, _, _)
DEFINE_LEVEL("COURSE 15 RR", LEVEL_RR, COURSE_RR, rr, sky, 20000, 0x20, 0x20, 0x20, _, sCamRR)
DEFINE_LEVEL("OW1 C GROUNDS", LEVEL_CASTLE_GROUNDS, COURSE_NONE, castle_grounds, outside, 25000, 0x08, 0x08, 0x08, _, _)
DEFINE_LEVEL("BC1 BITDW", LEVEL_BITDW, COURSE_BITDW, bitdw, sky, 16000, 0x28, 0x28, 0x28, _, _)
DEFINE_LEVEL("VCL VCUTM", LEVEL_VCUTM, COURSE_VCUTM, vcutm, outside, 30000, 0x28, 0x28, 0x28, _, _)
DEFINE_LEVEL("BC2 BITFS", LEVEL_BITFS, COURSE_BITFS, bitfs, sky, 16000, 0x28, 0x28, 0x28, _, _)
DEFINE_LEVEL("SC1 SEC AQUA", LEVEL_SA, COURSE_SA, sa, inside, 20000, 0x10, 0x10, 0x10, _, _)
DEFINE_LEVEL("BC3 BITS", LEVEL_BITS, COURSE_BITS, bits, sky, 16000, 0x28, 0x28, 0x28, _, _)
DEFINE_LEVEL("COURSE 7 LLL", LEVEL_LLL, COURSE_LLL, lll, fire, 22000, 0x08, 0x30, 0x30, _, _)
DEFINE_LEVEL("COURSE 9 DDD", LEVEL_DDD, COURSE_DDD, ddd, water, 17000, 0x10, 0x20, 0x20, sDynDdd, _)
DEFINE_LEVEL("COURSE 2 WF", LEVEL_WF, COURSE_WF, wf, grass, 13000, 0x08, 0x08, 0x08, _, _)
DEFINE_LEVEL("END CAKE", LEVEL_ENDING, COURSE_CAKE_END, ending, generic, 20000, 0x00, 0x00, 0x00, _, _)
DEFINE_LEVEL("OW3 C COURTYD", LEVEL_CASTLE_COURTYARD, COURSE_NONE, castle_courtyard, outside, 20000, 0x08, 0x08, 0x08, _, _)
DEFINE_LEVEL("SIC P SEC SLID", LEVEL_PSS, COURSE_PSS, pss, mountain, 20000, 0x28, 0x28, 0x28, _, _)
DEFINE_LEVEL("MCL COTMC", LEVEL_COTMC, COURSE_COTMC, cotmc, cave, 18000, 0x28, 0x28, 0x28, _, sCamCotMC)
DEFINE_LEVEL("WCL TOTWC", LEVEL_TOTWC, COURSE_TOTWC, totwc, sky, 20000, 0x20, 0x20, 0x20, _, _)
DEFINE_LEVEL("B BATTLE1", LEVEL_BOWSER_1, COURSE_BITDW, bowser_1, generic, VAL_DIFF, 0x40, 0x40, 0x40, _, _)
DEFINE_LEVEL("SC2 WMOTR", LEVEL_WMOTR, COURSE_WMOTR, wmotr, generic, 20000, 0x28, 0x28, 0x28, _, _)
STUB_LEVEL( "", LEVEL_UNKNOWN_32, COURSE_NONE, 20000, 0x70, 0x00, 0x00, _, _)
DEFINE_LEVEL("KUPPA2", LEVEL_BOWSER_2, COURSE_BITFS, bowser_2, fire, VAL_DIFF, 0x40, 0x40, 0x40, _, _)
DEFINE_LEVEL("KUPPA3", LEVEL_BOWSER_3, COURSE_BITS, bowser_3, generic, VAL_DIFF, 0x40, 0x40, 0x40, _, _)
DEFINE_LEVEL("B BATTLE2", LEVEL_BOWSER_2, COURSE_BITFS, bowser_2, fire, VAL_DIFF, 0x40, 0x40, 0x40, _, _)
DEFINE_LEVEL("B BATTLE3", LEVEL_BOWSER_3, COURSE_BITS, bowser_3, generic, VAL_DIFF, 0x40, 0x40, 0x40, _, _)
STUB_LEVEL( "", LEVEL_UNKNOWN_35, COURSE_NONE, 20000, 0x00, 0x00, 0x00, _, _)
DEFINE_LEVEL("DONKEY % SLID2", LEVEL_TTM, COURSE_TTM, ttm, mountain, 15000, 0x08, 0x08, 0x08, _, _)
DEFINE_LEVEL("COURSE 12 TTM", LEVEL_TTM, COURSE_TTM, ttm, mountain, 15000, 0x08, 0x08, 0x08, _, _)
STUB_LEVEL( "", LEVEL_UNKNOWN_37, COURSE_NONE, 20000, 0x00, 0x00, 0x00, _, _)
STUB_LEVEL( "", LEVEL_UNKNOWN_38, COURSE_NONE, 20000, 0x00, 0x00, 0x00, sDynUnk38, _)
+2 -2
View File
@@ -14,7 +14,7 @@ ALIGNED8 static const Texture lll_seg7_texture_07001000[] = {
};
// 0x07001800 - 0x07002000
ALIGNED8 static const Texture lll_seg7_texture_07001800[] = {
UNUSED ALIGNED8 static const Texture lll_seg7_texture_07001800[] = {
#include "levels/lll/3.rgba16.inc.c"
};
@@ -34,7 +34,7 @@ ALIGNED8 static const Texture lll_seg7_texture_07003000[] = {
};
// 0x07003800 - 0x07004000
ALIGNED8 static const Texture lll_seg7_texture_07003800[] = {
UNUSED ALIGNED8 static const Texture lll_seg7_texture_07003800[] = {
#include "levels/lll/7.rgba16.inc.c"
};
+1 -1
View File
@@ -101,7 +101,7 @@ const LevelScript level_main_scripts_entry[] = {
LOAD_MODEL_FROM_GEO(MODEL_MARIOS_METAL_CAP, marios_metal_cap_geo),
LOAD_MODEL_FROM_GEO(MODEL_MARIOS_WING_CAP, marios_wing_cap_geo),
LOAD_MODEL_FROM_GEO(MODEL_MARIOS_CAP, marios_cap_geo),
LOAD_MODEL_FROM_GEO(MODEL_MARIOS_CAP, marios_cap_geo), // repeated
//LOAD_MODEL_FROM_GEO(MODEL_MARIOS_CAP, marios_cap_geo), // repeated
LOAD_MODEL_FROM_GEO(MODEL_BOWSER_KEY_CUTSCENE, bowser_key_cutscene_geo),
LOAD_MODEL_FROM_GEO(MODEL_BOWSER_KEY, bowser_key_geo),
LOAD_MODEL_FROM_GEO(MODEL_RED_FLAME_SHADOW, red_flame_shadow_geo),
+1 -1
View File
@@ -19,7 +19,7 @@ ALIGNED8 static const Texture ssl_seg7_texture_07001800[] = {
};
// 0x07002000 - 0x07002800
ALIGNED8 static const Texture ssl_seg7_texture_07002000[] = {
UNUSED ALIGNED8 static const Texture ssl_seg7_texture_07002000[] = {
#include "levels/ssl/4.rgba16.inc.c"
};
+19 -4
View File
@@ -2,6 +2,7 @@ OUTPUT_ARCH (mips)
#define LINKER /* Removes externs from preprocessed script */
#include "segments.h"
#include "config.h"
#undef LINKER
#define BEGIN_SEG(name, addr) \
@@ -135,6 +136,9 @@ SECTIONS
BUILD_DIR/src/gdb*.o(.text);
BUILD_DIR/src/usb*.o(.text);
BUILD_DIR/src/audio*.o(.text);
#ifdef S2DEX_TEXT_ENGINE
lib/libs2d_engine.a:*(.text);
#endif
#if defined(ISVPRINT) || defined(UNF)
*/libultra_d.a:*.o(.text);
#else
@@ -152,6 +156,9 @@ SECTIONS
BUILD_DIR/src/gdb*.o(.*data*);
BUILD_DIR/src/usb*.o(.*data*);
BUILD_DIR/src/audio*.o(.*data*);
#ifdef S2DEX_TEXT_ENGINE
lib/libs2d_engine.a:*(.*data*);
#endif
#if defined(ISVPRINT) || defined(UNF)
*/libultra_d.a:*.o(.*data*);
#else
@@ -168,6 +175,9 @@ SECTIONS
BUILD_DIR/src/gdb*.o(.*rodata*);
BUILD_DIR/src/usb*.o(.rodata*);
BUILD_DIR/src/audio*.o(.rodata*);
#ifdef S2DEX_TEXT_ENGINE
lib/libs2d_engine.a:*(.rodata*);
#endif
#if defined(ISVPRINT) || defined(UNF)
*/libultra_d.a:*.o(.*rodata*);
#else
@@ -187,6 +197,9 @@ SECTIONS
BUILD_DIR/src/gdb*.o(.*bss*);
BUILD_DIR/src/usb*.o(.*bss*);
BUILD_DIR/src/audio*.o(.*bss*);
#ifdef S2DEX_TEXT_ENGINE
lib/libs2d_engine.a:*(.*bss*);
#endif
#if defined(ISVPRINT) || defined(UNF)
*/libultra_d.a:*.o(COMMON);
*/libultra_d.a:*.o(.scommon);
@@ -236,7 +249,9 @@ SECTIONS
__mainPoolSize = RAM_END - .;
__expansionRamStart = 0x80400000;
ASSERT((. <= __expansionRamStart), "Error: RDRAM expanded into Expansion RAM, despite Expansion RAM not being defined.")
#ifndef USE_EXT_RAM
ASSERT((. <= __expansionRamStart), "Error: RDRAM expanded into Expansion RAM, despite Expansion RAM not being defined.")
#endif
BEGIN_SEG(entry, 0x10000000)
{
@@ -291,7 +306,7 @@ SECTIONS
BUILD_DIR/src/menu*.o(.text);
BUILD_DIR/src/menu*.o(.data*);
BUILD_DIR/src/menu*.o(.rodata*);
#ifdef GODDARD
#ifdef KEEP_MARIO_HEAD
BUILD_DIR/libgoddard.a:*.o(.text);
/* goddard subsystem data */
BUILD_DIR/libgoddard.a:gd_main.o(.data*);
@@ -324,7 +339,7 @@ SECTIONS
BEGIN_NOLOAD(goddard)
{
BUILD_DIR/src/menu*.o(.bss*);
#ifdef GODDARD
#ifdef KEEP_MARIO_HEAD
BUILD_DIR/libgoddard.a:*.o(.bss*);
#endif
}
@@ -349,7 +364,7 @@ SECTIONS
YAY0_SEG(debug_level_select, 0x07000000)
YAY0_SEG(title_screen_bg, 0x0A000000)
#ifdef GODDARD
#ifdef KEEP_MARIO_HEAD
BEGIN_SEG(gd_dynlists, 0x04000000)
{
BUILD_DIR/libgoddard.a:dynlist_test_cube.o(.data);
@@ -126,12 +126,12 @@ void seq_channel_layer_process_script(struct SequenceChannelLayer *layer) {
u8 sameSound;
u8 cmd; // a0 sp3E, EU s2
u8 cmdSemitone; // sp3D, t0
u16 sp3A; // t2, a0, a1
u16 sp3A = 0; // t2, a0, a1
f32 tuning; // f0
s32 vel; // sp30, t3
s32 vel = 0; // sp30, t3
s32 usedSemitone; // a1
f32 freqScale; // sp28, f0
f32 sp24;
f32 freqScale = 0.0f; // sp28, f0
f32 sp24 = 0.0f;
f32 temp_f12;
f32 temp_f2;
+34
View File
@@ -49,6 +49,39 @@ struct AudioSessionSettingsEU gAudioSessionPresets[] = {
// - memory used for temporary sequences
// - memory used for temporary banks
#if defined(VERSION_JP) || defined(VERSION_US)
#ifdef EXPAND_AUDIO_HEAP
struct AudioSessionSettings gAudioSessionPresets[18] = {
#ifdef VERSION_JP
{ 32000, 32, 1, 0x0800, 0x2FFF, 0x7FFF, 0x7200, 0xC000, 0x8800, 0x5400 },
{ 32000, 32, 1, 0x0A00, 0x47FF, 0x7FFF, 0x7200, 0xC000, 0x8800, 0x5400 },
{ 32000, 32, 1, 0x1000, 0x2FFF, 0x7FFF, 0x7200, 0xC000, 0x8800, 0x5400 },
{ 32000, 32, 1, 0x0E00, 0x3FFF, 0x7FFF, 0x7200, 0xC000, 0x8800, 0x5400 },
{ 32000, 32, 1, 0x0C00, 0x4FFF, 0x7FFF, 0x7200, 0xC000, 0x8800, 0x5400 },
{ 32000, 32, 1, 0x0800, 0x2FFF, 0x7FFF, 0x7C00, 0xC400, 0x7E00, 0x5400 },
{ 32000, 32, 1, 0x0A00, 0x47FF, 0x7FFF, 0x7E00, 0xC400, 0x8800, 0x5500 },
{ 32000, 40, 1, 0x0800, 0x37FF, 0x7FFF, 0x6600, 0xAA00, 0x8000, 0x3600 },
#else
{ 32000, 32, 1, 0x0C00, 0x2FFF, 0x7FFF, 0x7400, 0xDA00, 0x8800, 0x5400 },
{ 32000, 32, 1, 0x0A00, 0x47FF, 0x7FFF, 0x7400, 0xDA00, 0x8800, 0x5400 },
{ 32000, 32, 1, 0x1000, 0x2FFF, 0x7FFF, 0x7400, 0xDA00, 0x8800, 0x5400 },
{ 32000, 32, 1, 0x0E00, 0x3FFF, 0x7FFF, 0x7400, 0xDA00, 0x8800, 0x5400 },
{ 32000, 32, 1, 0x0C00, 0x4FFF, 0x7FFF, 0x7400, 0xDA00, 0x8800, 0x5400 },
{ 32000, 32, 1, 0x0C00, 0x2FFF, 0x7FFF, 0x8000, 0xDC00, 0x7E00, 0x5400 },
{ 32000, 32, 1, 0x0A00, 0x47FF, 0x7FFF, 0x8200, 0xDC00, 0x8800, 0x5500 },
{ 32000, 40, 1, 0x0800, 0x37FF, 0x7FFF, 0x6980, 0xC500, 0x8000, 0x3600 },
#endif
{ 27000, 32, 1, 0x0800, 0x2FFF, 0x7FFF, 0x4A00, 0xAA00, 0xE800, 0x4800 },
{ 27000, 32, 1, 0x0800, 0x3FFF, 0x7FFF, 0x4A00, 0xAA00, 0xE800, 0x4800 },
{ 27000, 32, 1, 0x1000, 0x2FFF, 0x7FFF, 0x4A00, 0xAA00, 0xE800, 0x4800 },
{ 27000, 32, 1, 0x1000, 0x3FFF, 0x7FFF, 0x4A00, 0xAA00, 0xE800, 0x4800 },
{ 27000, 32, 1, 0x0C00, 0x4FFF, 0x7FFF, 0x4A00, 0xAA00, 0xE800, 0x4800 },
{ 32000, 28, 1, 0x0800, 0x2FFF, 0x7FFF, 0x4A00, 0xAA00, 0xE800, 0x4800 },
{ 32000, 24, 1, 0x0800, 0x2FFF, 0x7FFF, 0x4A00, 0xAA00, 0xE800, 0x4800 },
{ 32000, 20, 1, 0x0800, 0x2FFF, 0x7FFF, 0x4A00, 0xAA00, 0xE800, 0x4800 },
{ 32000, 16, 1, 0x0800, 0x2FFF, 0x7FFF, 0x4A00, 0xAA00, 0xE800, 0x4800 },
{ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }
};
#else
struct AudioSessionSettings gAudioSessionPresets[18] = {
#ifdef VERSION_JP
{ 32000, 16, 1, 0x0800, 0x2FFF, 0x7FFF, 0x3900, 0x6000, 0x4400, 0x2A00 },
@@ -81,6 +114,7 @@ struct AudioSessionSettings gAudioSessionPresets[18] = {
{ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }
};
#endif
#endif
// gAudioCosineTable[k] = round((2**15 - 1) * cos(pi/2 * k / 127)). Unused.
#if defined(VERSION_JP) || defined(VERSION_US)
u16 gAudioCosineTable[128] = {
+18 -4
View File
@@ -109,6 +109,20 @@ extern u16 gUnused80226E98[0x10];
extern u32 gAudioRandom;
#ifdef EXPAND_AUDIO_HEAP
#if defined(VERSION_US) || defined(VERSION_JP)
#define EXT_AUDIO_HEAP_SIZE 0x24400
#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
#endif
#else
#define EXT_AUDIO_HEAP_SIZE 0x0
#define EXT_AUDIO_INIT_POOL_SIZE 0x0
#endif
#ifdef VERSION_SH
extern f32 unk_sh_data_1[];
@@ -136,12 +150,12 @@ extern OSMesgQueue *D_SH_80350FA8;
#if defined(VERSION_EU) || defined(VERSION_SH)
#define UNUSED_COUNT_80333EE8 24
#define AUDIO_HEAP_SIZE 0x2c500
#define AUDIO_INIT_POOL_SIZE 0x2c00
#define AUDIO_HEAP_SIZE (0x2c500 + EXT_AUDIO_HEAP_SIZE + EXT_AUDIO_INIT_POOL_SIZE)
#define AUDIO_INIT_POOL_SIZE (0x2c00 + EXT_AUDIO_INIT_POOL_SIZE)
#else
#define UNUSED_COUNT_80333EE8 16
#define AUDIO_HEAP_SIZE 0x31150
#define AUDIO_INIT_POOL_SIZE 0x2500
#define AUDIO_HEAP_SIZE (0x31150 + EXT_AUDIO_HEAP_SIZE + EXT_AUDIO_INIT_POOL_SIZE)
#define AUDIO_INIT_POOL_SIZE (0x2500 + EXT_AUDIO_INIT_POOL_SIZE)
#endif
#ifdef VERSION_SH
+4 -2
View File
@@ -190,6 +190,7 @@ s8 get_vibrato_pitch_change(struct VibratoState *vib) {
switch (index & 0x30) {
case 0x10:
index = 31 - index;
// fall through
case 0x00:
return vib->curve[index];
@@ -385,8 +386,8 @@ s32 adsr_update(struct AdsrState *adsr) {
adsr->state = ADSR_STATE_HANG;
break;
}
// fallthrough
}
// fall through
case ADSR_STATE_START_LOOP:
adsr->envIndex = 0;
@@ -394,11 +395,12 @@ s32 adsr_update(struct AdsrState *adsr) {
adsr->currentHiRes = adsr->current << 0x10;
#endif
adsr->state = ADSR_STATE_LOOP;
// fallthrough
#ifdef VERSION_SH
restart:
#endif
// fall through
case ADSR_STATE_LOOP:
adsr->delay = BSWAP16(adsr->envelope[adsr->envIndex].delay);
switch (adsr->delay) {
+2 -2
View File
@@ -409,9 +409,9 @@ void *alloc_bank_or_seq(struct SoundMultiPool *arg0, s32 arg1, s32 size, s32 arg
#endif
u32 nullID = -1;
UNUSED s32 i;
u8 *table;
u8 *table = NULL;
#ifndef VERSION_SH
u8 isSound;
u8 isSound = FALSE;
#endif
#if defined(VERSION_JP) || defined(VERSION_US)
u16 firstVal;
+4 -4
View File
@@ -764,8 +764,8 @@ u8 get_missing_bank(u32 seqId, s32 *nonNullCount, s32 *nullCount) {
}
struct AudioBank *load_banks_immediate(s32 seqId, u8 *outDefaultBank) {
void *ret;
u32 bankId;
void *ret = NULL;
u32 bankId = 0;
u16 offset;
u8 i;
@@ -945,10 +945,10 @@ void audio_init() {
// It seems boot.s doesn't clear the .bss area for audio, so do it here.
i = 0;
lim3 = ((uintptr_t) &gAudioGlobalsEndMarker - (uintptr_t) &gAudioGlobalsStartMarker) / 8;
ptr64 = &gAudioGlobalsStartMarker - 1;
ptr64 = &gAudioGlobalsStartMarker;
for (k = lim3; k >= 0; k--) {
i++;
ptr64[i] = 0;
i++;
}
#endif
+2 -2
View File
@@ -1493,7 +1493,7 @@ void sequence_channel_process_script(struct SequenceChannel *seqChannel) {
u8 loBits;
u16 sp5A;
s32 sp38;
s8 value;
s8 value = 0;
s32 i;
u8 *seqData;
@@ -2235,7 +2235,7 @@ void sequence_player_process_sequence(struct SequencePlayer *seqPlayer) {
#endif
u8 loBits;
u8 temp;
s32 value;
s32 value = 0;
s32 i;
u16 u16v;
u8 *seqData;
+8 -8
View File
@@ -35,7 +35,7 @@
aSetBuffer(pkt, 0, 0, c + DMEM_ADDR_WET_RIGHT_CH, d); \
aSaveBuffer(pkt, VIRTUAL_TO_PHYSICAL2(gSynthesisReverb.ringBuffer.right + (off)));
#define ALIGN(val, amnt) (((val) + (1 << amnt) - 1) & ~((1 << amnt) - 1))
#define AUDIO_ALIGN(val, amnt) (((val) + (1 << amnt) - 1) & ~((1 << amnt) - 1))
struct VolumeChange {
u16 sourceLeft;
@@ -379,7 +379,7 @@ u64 *synthesis_resample_and_mix_reverb(u64 *cmd, s32 bufLen, s16 reverbIndex, s1
aMix(cmd++, 0, 0x8000 + gSynthesisReverbs[reverbIndex].reverbGain, DMEM_ADDR_WET_LEFT_CH, DMEM_ADDR_WET_LEFT_CH);
} else {
startPad = (item->startPos % 8u) * 2;
paddedLengthA = ALIGN(startPad + item->lengthA, 4);
paddedLengthA = AUDIO_ALIGN(startPad + item->lengthA, 4);
cmd = synthesis_load_reverb_ring_buffer(cmd, DMEM_ADDR_RESAMPLED, (item->startPos - startPad / 2), DEFAULT_LEN_1CH, reverbIndex);
if (item->lengthB != 0) {
@@ -539,7 +539,7 @@ u64 *synthesis_do_one_audio_update(s16 *aiBuf, s32 bufLen, u64 *cmd, s32 updateI
// Same as above but upsample the previously downsampled samples used for reverb first
temp = 0; //! jesus christ
t4 = (v1->startPos & 7) * 2;
ra = ALIGN(v1->lengthA + t4, 4);
ra = AUDIO_ALIGN(v1->lengthA + t4, 4);
aSetLoadBufferPair(cmd++, 0, v1->startPos - t4 / 2);
if (v1->lengthB != 0) {
// Ring buffer wrapped
@@ -606,11 +606,11 @@ u64 *synthesis_process_notes(s16 *aiBuf, s32 bufLen, u64 *cmd) {
UNUSED u8 pad7[0x0c]; // sp100
UNUSED s32 tempBufLen;
#ifdef VERSION_EU
s32 sp130; //sp128, sp104
s32 sp130 = 0; //sp128, sp104
UNUSED u32 pad9;
#else
UNUSED u32 pad9;
s32 sp130; //sp128, sp104
s32 sp130 = 0; //sp128, sp104
#endif
s32 nAdpcmSamplesProcessed; // signed required for US
s32 t0;
@@ -891,7 +891,7 @@ u64 *synthesis_process_notes(s16 *aiBuf, s32 bufLen, u64 *cmd) {
VIRTUAL_TO_PHYSICAL2(synthesisState->synthesisBuffers->adpcmdecState));
sp130 = s2 * 2;
} else {
s5Aligned = ALIGN(s5, 5);
s5Aligned = AUDIO_ALIGN(s5, 5);
aSetBuffer(cmd++, 0, DMEM_ADDR_COMPRESSED_ADPCM_DATA + a3,
DMEM_ADDR_UNCOMPRESSED_NOTE + s5Aligned, s0 * 2);
aADPCMdec(cmd++, flags,
@@ -905,9 +905,9 @@ u64 *synthesis_process_notes(s16 *aiBuf, s32 bufLen, u64 *cmd) {
aADPCMdec(cmd++, flags, VIRTUAL_TO_PHYSICAL2(note->synthesisBuffers->adpcmdecState));
sp130 = s2 * 2;
} else {
aSetBuffer(cmd++, 0, DMEM_ADDR_COMPRESSED_ADPCM_DATA + a3, DMEM_ADDR_UNCOMPRESSED_NOTE + ALIGN(s5, 5), s0 * 2);
aSetBuffer(cmd++, 0, DMEM_ADDR_COMPRESSED_ADPCM_DATA + a3, DMEM_ADDR_UNCOMPRESSED_NOTE + AUDIO_ALIGN(s5, 5), s0 * 2);
aADPCMdec(cmd++, flags, VIRTUAL_TO_PHYSICAL2(note->synthesisBuffers->adpcmdecState));
aDMEMMove(cmd++, DMEM_ADDR_UNCOMPRESSED_NOTE + ALIGN(s5, 5) + (s2 * 2), DMEM_ADDR_UNCOMPRESSED_NOTE + s5, (nSamplesInThisIteration) * 2);
aDMEMMove(cmd++, DMEM_ADDR_UNCOMPRESSED_NOTE + AUDIO_ALIGN(s5, 5) + (s2 * 2), DMEM_ADDR_UNCOMPRESSED_NOTE + s5, (nSamplesInThisIteration) * 2);
}
#endif
+4 -3
View File
@@ -2,6 +2,7 @@
#include <hvqm2dec.h>
#include "buffers.h"
#include "audio/data.h"
#ifdef HVQM
#include <hvqm/hvqm.h>
#endif
@@ -9,11 +10,11 @@
ALIGNED8 u8 gDecompressionHeap[0xD000];
#if defined(VERSION_EU)
ALIGNED16 u8 gAudioHeap[DOUBLE_SIZE_ON_64_BIT(0x31200) - 0x3800];
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) - 0x4800];
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)];
ALIGNED16 u8 gAudioHeap[DOUBLE_SIZE_ON_64_BIT(0x31200 + EXT_AUDIO_HEAP_SIZE + EXT_AUDIO_INIT_POOL_SIZE)];
#endif
ALIGNED8 u8 gIdleThreadStack[0x800];
+84
View File
@@ -0,0 +1,84 @@
#ifndef __EXTENDED_BOUNDS_H__
#define __EXTENDED_BOUNDS_H__
/*
Better Extended Bounds by anonymous_moose
Thanks to someone2639 for the shiftable segments patch
Thanks to Wiseguy for the Surface Pool Full error code and 4x bounds fix
0: Regular bounds
Same as vanilla sm64, boundaries are (-8192 to 8191)
16x16 collision cells.
1: 2x extended bounds
level boundaries are twice as big (-16384 to 16383)
Collision calculations remain as fast as vanilla, at the cost of using more RAM.
32x32 collision cells.
2: Regular bounds (performance)
Same boundaries as vanilla (-8192 to 8191), but with twice the amount of collision cells
Trades more RAM usage for faster collision calculations.
32x32 collision cells.
3: 4x extended bounds
level boundaries are 4 times as big (-32768 to 32767)
Collision calculations remain as fast as vanilla, at the cost of using far more RAM (16 times vanilla).
64x64 collision cells.
If you see "SURFACE POOL FULL" or "SURFACE NODE POOL FULL" in game, you should increase
SURFACE_POOL_SIZE or SURFACE_NODE_POOL_SIZE, respectively, or reduce the amount of
collision surfaces in your level.
*/
//for the static assert macro
#include "macros.h"
//set this to the extended bounds mode you want, then do "make clean".
#define EXTENDED_BOUNDS_MODE 1
//the maximum amount of collision surfaces (static and dynamic combined)
//8200 should work fine for a 2x extended stage, the vanilla value is 2300
#define SURFACE_POOL_SIZE 4000
//make this approximately (amount of collision cells) + (SURFACE_POOL_SIZE * 3)
//22000 should work fine for a 2x extended stage, the vanilla value is 7000
#define SURFACE_NODE_POOL_SIZE 12000
//don't touch the stuff past this point unless you know what you're doing!
//default value to check if the user set a proper extended bounds mode
#define LEVEL_BOUNDARY_MAX 0x0000
#if EXTENDED_BOUNDS_MODE == 0
#undef LEVEL_BOUNDARY_MAX // Undefine the old value to avoid compiler warnings
#define LEVEL_BOUNDARY_MAX 0x2000L
#define CELL_SIZE 0x400
#define WORLD_SCALE 1.f
#elif EXTENDED_BOUNDS_MODE == 1
#undef LEVEL_BOUNDARY_MAX
#define LEVEL_BOUNDARY_MAX 0x4000L
#define CELL_SIZE 0x400
#define WORLD_SCALE 2.f
#elif EXTENDED_BOUNDS_MODE == 2
#undef LEVEL_BOUNDARY_MAX
#define LEVEL_BOUNDARY_MAX 0x2000L
#define CELL_SIZE 0x200
#define WORLD_SCALE 1.f
#elif EXTENDED_BOUNDS_MODE == 3
#undef LEVEL_BOUNDARY_MAX
#define LEVEL_BOUNDARY_MAX 0x8000L
#define CELL_SIZE 0x400
#define WORLD_SCALE 4.f
#endif
STATIC_ASSERT(LEVEL_BOUNDARY_MAX != 0, "You must set a valid extended bounds mode!");
#define NUM_CELLS (2 * LEVEL_BOUNDARY_MAX / CELL_SIZE)
#define NOT_ENOUGH_ROOM_FOR_SURFACES (1 << 0)
#define NOT_ENOUGH_ROOM_FOR_NODES (1 << 1)
#endif // __EXTENDED_BOUNDS_H__
+1 -1
View File
@@ -258,7 +258,7 @@ void geo_layout_cmd_node_perspective(void) {
GraphNodeFunc frustumFunc = NULL;
s16 fov = cur_geo_cmd_s16(0x02);
s16 near = cur_geo_cmd_s16(0x04);
s16 far = cur_geo_cmd_s16(0x06);
u16 far = cur_geo_cmd_s16(0x06);
if (cur_geo_cmd_u8(0x01) != 0) {
// optional asm function
+1 -1
View File
@@ -79,7 +79,7 @@ init_graph_node_ortho_projection(struct AllocOnlyPool *pool, struct GraphNodeOrt
*/
struct GraphNodePerspective *init_graph_node_perspective(struct AllocOnlyPool *pool,
struct GraphNodePerspective *graphNode,
f32 fov, s16 near, s16 far,
f32 fov, s16 near, u16 far,
GraphNodeFunc nodeFunc, s32 unused) {
if (pool != NULL) {
graphNode = alloc_only_pool_alloc(pool, sizeof(struct GraphNodePerspective));
+2 -2
View File
@@ -108,7 +108,7 @@ struct GraphNodePerspective
/*0x18*/ s32 unused;
/*0x1C*/ f32 fov; // horizontal field of view in degrees
/*0x20*/ s16 near; // near clipping plane
/*0x22*/ s16 far; // far clipping plane
/*0x22*/ u16 far; // far clipping plane
};
/** An entry in the master list. It is a linked list of display lists
@@ -368,7 +368,7 @@ struct GraphNodeRoot *init_graph_node_root(struct AllocOnlyPool *pool, struct Gr
s16 areaIndex, s16 x, s16 y, s16 width, s16 height);
struct GraphNodeOrthoProjection *init_graph_node_ortho_projection(struct AllocOnlyPool *pool, struct GraphNodeOrthoProjection *graphNode, f32 scale);
struct GraphNodePerspective *init_graph_node_perspective(struct AllocOnlyPool *pool, struct GraphNodePerspective *graphNode,
f32 fov, s16 near, s16 far, GraphNodeFunc nodeFunc, s32 unused);
f32 fov, s16 near, u16 far, GraphNodeFunc nodeFunc, s32 unused);
struct GraphNodeStart *init_graph_node_start(struct AllocOnlyPool *pool, struct GraphNodeStart *graphNode);
struct GraphNodeMasterList *init_graph_node_master_list(struct AllocOnlyPool *pool, struct GraphNodeMasterList *graphNode, s16 on);
struct GraphNodeLevelOfDetail *init_graph_node_render_range(struct AllocOnlyPool *pool, struct GraphNodeLevelOfDetail *graphNode,
+17 -15
View File
@@ -25,6 +25,8 @@
#include "surface_collision.h"
#include "surface_load.h"
#include "config.h"
#define CMD_GET(type, offset) (*(type *) (CMD_PROCESS_OFFSET(offset) + (u8 *) sCurrentCmd))
// These are equal
@@ -281,7 +283,7 @@ static void level_cmd_load_yay0(void) {
}
static void level_cmd_load_mario_head(void) {
#ifdef GODDARD
#ifdef KEEP_MARIO_HEAD
// TODO: Fix these hardcoded sizes
void *addr = main_pool_alloc(DOUBLE_SIZE_ON_64_BIT(0xE1000), MEMORY_POOL_LEFT);
if (addr != NULL) {
@@ -373,24 +375,24 @@ static void level_cmd_end_area(void) {
}
static void level_cmd_load_model_from_dl(void) {
s16 val1 = CMD_GET(s16, 2) & 0x0FFF;
s16 val2 = ((u16)CMD_GET(s16, 2)) >> 12;
void *val3 = CMD_GET(void *, 4);
ModelID model = CMD_GET(ModelID, 0xA);
s16 layer = CMD_GET(u16, 0x8);
void *dl_ptr = CMD_GET(void *, 4);
if (val1 < 256) {
gLoadedGraphNodes[val1] =
(struct GraphNode *) init_graph_node_display_list(sLevelPool, 0, val2, val3);
if (model < MODEL_ID_COUNT) {
gLoadedGraphNodes[model] =
(struct GraphNode *) init_graph_node_display_list(sLevelPool, 0, layer, dl_ptr);
}
sCurrentCmd = CMD_NEXT;
}
static void level_cmd_load_model_from_geo(void) {
s16 arg0 = CMD_GET(s16, 2);
void *arg1 = CMD_GET(void *, 4);
ModelID model = CMD_GET(ModelID, 2);
void *geo = CMD_GET(void *, 4);
if (arg0 < 256) {
gLoadedGraphNodes[arg0] = process_geo_layout(sLevelPool, arg1);
if (model < MODEL_ID_COUNT) {
gLoadedGraphNodes[model] = process_geo_layout(sLevelPool, geo);
}
sCurrentCmd = CMD_NEXT;
@@ -402,13 +404,13 @@ static void level_cmd_23(void) {
f32 f;
} arg2;
s16 model = CMD_GET(s16, 2) & 0x0FFF;
ModelID model = CMD_GET(s16, 2) & 0x0FFF;
s16 arg0H = ((u16)CMD_GET(s16, 2)) >> 12;
void *arg1 = CMD_GET(void *, 4);
// load an f32, but using an integer load instruction for some reason (hence the union)
arg2.i = CMD_GET(s32, 8);
if (model < 256) {
if (model < MODEL_ID_COUNT) {
// GraphNodeScale has a GraphNode at the top. This
// is being stored to the array, so cast the pointer.
gLoadedGraphNodes[model] =
@@ -426,7 +428,7 @@ static void level_cmd_init_mario(void) {
gMarioSpawnInfo->areaIndex = 0;
gMarioSpawnInfo->behaviorArg = CMD_GET(u32, 4);
gMarioSpawnInfo->behaviorScript = CMD_GET(void *, 8);
gMarioSpawnInfo->unk18 = gLoadedGraphNodes[CMD_GET(u8, 3)];
gMarioSpawnInfo->unk18 = gLoadedGraphNodes[CMD_GET(ModelID, 0x2)];
gMarioSpawnInfo->next = NULL;
sCurrentCmd = CMD_NEXT;
@@ -438,7 +440,7 @@ static void level_cmd_place_object(void) {
struct SpawnInfo *spawnInfo;
if (sCurrAreaIndex != -1 && ((CMD_GET(u8, 2) & val7) || CMD_GET(u8, 2) == 0x1F)) {
model = CMD_GET(u8, 3);
model = CMD_GET(u32, 0x18);
spawnInfo = alloc_only_pool_alloc(sLevelPool, sizeof(struct SpawnInfo));
spawnInfo->startPos[0] = CMD_GET(s16, 4);
+13 -17
View File
@@ -4,9 +4,11 @@
#include "engine/graph_node.h"
#include "math_util.h"
#include "surface_collision.h"
#include "extended_bounds.h"
#include "trig_tables.inc.c"
#include "config.h"
// Variables for a spline curve animation (used for the flight path in the grand star cutscene)
Vec4s *gSplineKeyframe;
float gSplineKeyframeFraction;
@@ -571,23 +573,17 @@ void mtxf_mul_vec3s(Mat4 mtx, Vec3s b) {
* and no crashes occur.
*/
void mtxf_to_mtx(Mtx *dest, Mat4 src) {
#ifdef AVOID_UB
// Avoid type-casting which is technically UB by calling the equivalent
// guMtxF2L function. This helps little-endian systems, as well.
guMtxF2L(src, dest);
#else
s32 asFixedPoint;
register s32 i;
register s16 *a3 = (s16 *) dest; // all integer parts stored in first 16 bytes
register s16 *t0 = (s16 *) dest + 16; // all fraction parts stored in last 16 bytes
register f32 *t1 = (f32 *) 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;
}
temp[i][3] = src[i][3];
}
for (i = 0; i < 16; i++) {
asFixedPoint = *t1++ * (1 << 16); //! float-to-integer conversion responsible for PU crashes
*a3++ = GET_HIGH_S16_OF_32(asFixedPoint); // integer part
*t0++ = GET_LOW_S16_OF_32(asFixedPoint); // fraction part
}
#endif
guMtxF2L( temp, dest );
}
/**
+2
View File
@@ -5,6 +5,8 @@
#include "types.h"
/*
* The sine and cosine tables overlap, but "#define gCosineTable (gSineTable +
* 0x400)" doesn't give expected codegen; gSineTable and gCosineTable need to
+207 -65
View File
@@ -110,12 +110,12 @@ static s32 find_wall_collisions_from_list(struct SurfaceNode *surfaceNode,
// Determine if checking for the camera or not.
if (gCheckingSurfaceCollisionsForCamera) {
if (surf->flags & SURFACE_FLAG_NO_CAM_COLLISION) {
if (surf->flags & SURFACE_FLAG_NO_CAM_COLLISION || surf->type == SURFACE_NEW_WATER || surf->type == SURFACE_NEW_WATER_BOTTOM) {
continue;
}
} else {
// Ignore camera only surfaces.
if (surf->type == SURFACE_CAMERA_BOUNDARY) {
if (surf->type == SURFACE_CAMERA_BOUNDARY || surf->type == SURFACE_NEW_WATER || surf->type == SURFACE_NEW_WATER_BOTTOM) {
continue;
}
@@ -226,25 +226,21 @@ s32 find_wall_collisions(struct WallCollisionData *colData) {
static struct Surface *find_ceil_from_list(struct SurfaceNode *surfaceNode, s32 x, s32 y, s32 z, f32 *pheight) {
register struct Surface *surf;
register s32 x1, z1, x2, z2, x3, z3;
f32 nx, ny, nz, oo, height;
struct Surface *ceil = NULL;
ceil = NULL;
*pheight = CELL_HEIGHT_LIMIT;
// Stay in this loop until out of ceilings.
while (surfaceNode != NULL) {
surf = surfaceNode->surface;
surfaceNode = surfaceNode->next;
x1 = surf->vertex1[0];
z1 = surf->vertex1[2];
z2 = surf->vertex2[2];
x2 = surf->vertex2[0];
// Checking if point is in bounds of the triangle laterally.
if ((z1 - z) * (x2 - x1) - (x1 - x) * (z2 - z1) > 0) {
continue;
}
// Slight optimization by checking these later.
x3 = surf->vertex3[0];
z3 = surf->vertex3[2];
@@ -254,49 +250,42 @@ static struct Surface *find_ceil_from_list(struct SurfaceNode *surfaceNode, s32
if ((z3 - z) * (x1 - x3) - (x3 - x) * (z1 - z3) > 0) {
continue;
}
// Determine if checking for the camera or not.
if (gCheckingSurfaceCollisionsForCamera != 0) {
if (surf->flags & SURFACE_FLAG_NO_CAM_COLLISION) {
if (surf->flags & SURFACE_FLAG_NO_CAM_COLLISION || surf->type == SURFACE_NEW_WATER || surf->type == SURFACE_NEW_WATER_BOTTOM) {
continue;
}
}
// Ignore camera only surfaces.
else if (surf->type == SURFACE_CAMERA_BOUNDARY) {
else if (surf->type == SURFACE_CAMERA_BOUNDARY || surf->type == SURFACE_NEW_WATER || surf->type == SURFACE_NEW_WATER_BOTTOM) {
continue;
}
{
f32 nx = surf->normal.x;
f32 ny = surf->normal.y;
f32 nz = surf->normal.z;
f32 oo = surf->originOffset;
f32 height;
// If a wall, ignore it. Likely a remnant, should never occur.
if (ny == 0.0f) {
continue;
}
// Find the ceil height at the specific point.
height = -(x * nx + nz * z + oo) / ny;
// Checks for ceiling interaction with a 78 unit buffer.
//! (Exposed Ceilings) Because any point above a ceiling counts
// as interacting with a ceiling, ceilings far below can cause
// "invisible walls" that are really just exposed ceilings.
if (y - (height - -78.0f) > 0.0f) {
continue;
}
*pheight = height;
ceil = surf;
break;
}
nx = surf->normal.x;
ny = surf->normal.y;
nz = surf->normal.z;
oo = surf->originOffset;
// If a wall, ignore it. Likely a remnant, should never occur.
if (ny == 0.0f) {
continue;
}
// Find the ceil height at the specific point.
height = -(x * nx + nz * z + oo) / ny;
if (height > *pheight) {
continue;
}
// Checks for ceiling interaction
if (y > height) {
continue;
}
if (y >= surf->upperY) {
continue;
}
*pheight = height;
ceil = surf;
if (height == y) {
break;
}
}
//! (Surface Cucking) Since only the first ceil is returned and not the lowest,
// lower ceilings can be "cucked" by higher ceilings.
return ceil;
}
@@ -399,40 +388,33 @@ f32 find_floor_height_and_data(f32 xPos, f32 yPos, f32 zPos, struct FloorGeometr
static struct Surface *find_floor_from_list(struct SurfaceNode *surfaceNode, s32 x, s32 y, s32 z, f32 *pheight) {
register struct Surface *surf;
register s32 x1, z1, x2, z2, x3, z3;
f32 nx, ny, nz;
f32 oo;
f32 height;
f32 nx, ny, nz, oo, height;
struct Surface *floor = NULL;
*pheight = FLOOR_LOWER_LIMIT;
// Iterate through the list of floors until there are no more floors.
while (surfaceNode != NULL) {
surf = surfaceNode->surface;
surfaceNode = surfaceNode->next;
x1 = surf->vertex1[0];
z1 = surf->vertex1[2];
x2 = surf->vertex2[0];
z2 = surf->vertex2[2];
// Check that the point is within the triangle bounds.
if ((z1 - z) * (x2 - x1) - (x1 - x) * (z2 - z1) < 0) {
continue;
}
// To slightly save on computation time, set this later.
x3 = surf->vertex3[0];
z3 = surf->vertex3[2];
if ((z2 - z) * (x3 - x2) - (x2 - x) * (z3 - z2) < 0) {
continue;
}
if ((z3 - z) * (x1 - x3) - (x3 - x) * (z1 - z3) < 0) {
continue;
}
// Determine if we are checking for the camera or not.
if (gCheckingSurfaceCollisionsForCamera != 0) {
if (surf->flags & SURFACE_FLAG_NO_CAM_COLLISION) {
if (surf->flags & SURFACE_FLAG_NO_CAM_COLLISION || surf->type == SURFACE_NEW_WATER || surf->type == SURFACE_NEW_WATER_BOTTOM) {
continue;
}
}
@@ -440,31 +422,101 @@ static struct Surface *find_floor_from_list(struct SurfaceNode *surfaceNode, s32
else if (surf->type == SURFACE_CAMERA_BOUNDARY) {
continue;
}
nx = surf->normal.x;
ny = surf->normal.y;
nz = surf->normal.z;
oo = surf->originOffset;
// If a wall, ignore it. Likely a remnant, should never occur.
if (ny == 0.0f) {
continue;
}
// If a wall, ignore it. Likely a remnant, should never occur.
if (ny == 0.0f) {
continue;
}
// Find the height of the floor at a given location.
height = -(x * nx + nz * z + oo) / ny;
if (height < *pheight) {
continue;
}
// Checks for floor interaction with a 78 unit buffer.
if (y - (height + -78.0f) < 0.0f) {
if (y < (height - 78.0f)) {
continue;
}
*pheight = height;
floor = surf;
break;
if (height - 78.0f == y) {
break;
}
}
return floor;
}
static s16 check_within_triangle_bounds(s32 x, s32 z, struct Surface *surf) {
register s32 x1, z1, x2, z2, x3, z3;
x1 = surf->vertex1[0];
z1 = surf->vertex1[2];
x2 = surf->vertex2[0];
z2 = surf->vertex2[2];
if ((z1 - z) * (x2 - x1) - (x1 - x) * (z2 - z1) < 0) return FALSE;
x3 = surf->vertex3[0];
z3 = surf->vertex3[2];
if ((z2 - z) * (x3 - x2) - (x2 - x) * (z3 - z2) < 0) return FALSE;
if ((z3 - z) * (x1 - x3) - (x3 - x) * (z1 - z3) < 0) return FALSE;
return TRUE;
}
// Find the height of the floor at a given location
static f32 get_floor_height_at_location(s32 x, s32 z, struct Surface *surf) {
return -(x * surf->normal.x + surf->normal.z * z + surf->originOffset) / surf->normal.y;
}
/**
* 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) {
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;
// Iterate through the list of water floors until there are no more water floors.
while (bottomSurfaceNode != NULL) {
f32 curBottomHeight = FLOOR_LOWER_LIMIT;
surf = bottomSurfaceNode->surface;
bottomSurfaceNode = bottomSurfaceNode->next;
if (surf->type != SURFACE_NEW_WATER_BOTTOM || !check_within_triangle_bounds(x, z, surf)) continue;
curBottomHeight = get_floor_height_at_location(x, z, surf);
if (curBottomHeight < y - 78.0f) continue;
if (curBottomHeight >= y - 78.0f) bottomHeight = curBottomHeight;
}
// Iterate through the list of water tops until there are no more water tops.
while (topSurfaceNode != NULL) {
f32 curHeight = FLOOR_LOWER_LIMIT;
surf = topSurfaceNode->surface;
topSurfaceNode = topSurfaceNode->next;
if (surf->type == SURFACE_NEW_WATER_BOTTOM || !check_within_triangle_bounds(x, z, surf)) continue;
curHeight = get_floor_height_at_location(x, z, surf);
if (bottomHeight != FLOOR_LOWER_LIMIT && curHeight > bottomHeight) continue;
if (curHeight > height) {
height = curHeight;
*pheight = curHeight;
floor = surf;
}
}
//! (Surface Cucking) Since only the first floor is returned and not the highest,
// higher floors can be "cucked" by lower floors.
return floor;
}
@@ -579,10 +631,93 @@ f32 find_floor(f32 xPos, f32 yPos, f32 zPos, struct Surface **pfloor) {
return height;
}
/**
* 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;
struct Surface *floor = NULL;
struct SurfaceNode *surfaceList;
f32 height = FLOOR_LOWER_LIMIT;
s16 x = (s16) xPos;
s16 y = (s16) yPos;
s16 z = (s16) zPos;
if (x <= -LEVEL_BOUNDARY_MAX || x >= LEVEL_BOUNDARY_MAX) {
return height;
}
if (z <= -LEVEL_BOUNDARY_MAX || z >= LEVEL_BOUNDARY_MAX) {
return height;
}
// Each level is split into cells to limit load, find the appropriate cell.
cellX = ((x + LEVEL_BOUNDARY_MAX) / CELL_SIZE) & NUM_CELLS_INDEX;
cellZ = ((z + LEVEL_BOUNDARY_MAX) / CELL_SIZE) & NUM_CELLS_INDEX;
// Check for surfaces that are a part of level geometry.
surfaceList = gStaticSurfacePartition[cellZ][cellX][SPATIAL_PARTITION_WATER].next;
floor = find_water_floor_from_list(surfaceList, x, y, z, &height);
if (floor == NULL) {
height = FLOOR_LOWER_LIMIT;
} else {
*pfloor = floor;
}
return height;
}
/**************************************************
* ENVIRONMENTAL BOXES *
**************************************************/
/**
* Finds the height of water at a given location.
*/
f32 find_water_level_and_floor(f32 x, f32 z, struct Surface **pfloor) {
s32 i;
s32 numRegions;
s16 val;
f32 loX, hiX, loZ, hiZ;
f32 waterLevel = FLOOR_LOWER_LIMIT;
s16 *p = gEnvironmentRegions;
struct Surface *floor = NULL;
if (gCheckingSurfaceCollisionsForCamera) {
waterLevel = find_water_floor(x, gLakituState.pos[1], z, &floor);
} else {
waterLevel = find_water_floor(x, gMarioState->pos[1], z, &floor);
}
if (p != NULL && waterLevel == FLOOR_LOWER_LIMIT) {
numRegions = *p++;
for (i = 0; i < numRegions; i++) {
val = *p++;
loX = *p++;
loZ = *p++;
hiX = *p++;
hiZ = *p++;
// If the location is within a water box and it is a water box.
// Water is less than 50 val only, while above is gas and such.
if (loX < x && x < hiX && loZ < z && z < hiZ && val < 50) {
// Set the water height. Since this breaks, only return the first height.
waterLevel = *p;
break;
}
p++;
}
} else {
*pfloor = floor;
}
return waterLevel;
}
/**
* Finds the height of water at a given location.
*/
@@ -593,8 +728,15 @@ f32 find_water_level(f32 x, f32 z) {
f32 loX, hiX, loZ, hiZ;
f32 waterLevel = FLOOR_LOWER_LIMIT;
s16 *p = gEnvironmentRegions;
struct Surface *floor;
if (p != NULL) {
if (gCheckingSurfaceCollisionsForCamera) {
waterLevel = find_water_floor(x, gLakituState.pos[1], z, &floor);
} else {
waterLevel = find_water_floor(x, gMarioState->pos[1], z, &floor);
}
if (p != NULL && waterLevel == FLOOR_LOWER_LIMIT) {
numRegions = *p++;
for (i = 0; i < numRegions; i++) {
+2 -3
View File
@@ -5,10 +5,8 @@
#include "types.h"
// Range level area is 16384x16384 (-8192 to +8192 in x and z)
#define LEVEL_BOUNDARY_MAX 0x2000 // 8192
#include "engine/extended_bounds.h"
#define CELL_SIZE (1 << 10) // 0x400
#define CELL_HEIGHT_LIMIT 20000
#define FLOOR_LOWER_LIMIT -11000
@@ -42,6 +40,7 @@ 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);
void debug_surface_list_info(f32 xPos, f32 zPos);
+13 -7
View File
@@ -37,6 +37,8 @@ s16 sSurfacePoolSize;
u8 unused8038EEA8[0x30];
u8 gSurfacePoolError = 0;
/**
* Allocate the part of the surface node pool to contain a surface node.
*/
@@ -49,7 +51,8 @@ static struct SurfaceNode *alloc_surface_node(void) {
//! A bounds check! If there's more surface nodes than 7000 allowed,
// we, um...
// Perhaps originally just debug feedback?
if (gSurfaceNodesAllocated >= 7000) {
if (gSurfaceNodesAllocated >= SURFACE_NODE_POOL_SIZE) {
gSurfacePoolError |= NOT_ENOUGH_ROOM_FOR_NODES;
}
return node;
@@ -68,6 +71,7 @@ static struct Surface *alloc_surface(void) {
// we, um...
// Perhaps originally just debug feedback?
if (gSurfacesAllocated >= sSurfacePoolSize) {
gSurfacePoolError |= NOT_ENOUGH_ROOM_FOR_SURFACES;
}
surface->type = 0;
@@ -89,6 +93,7 @@ static void clear_spatial_partition(SpatialPartitionCell *cells) {
(*cells)[SPATIAL_PARTITION_FLOORS].next = NULL;
(*cells)[SPATIAL_PARTITION_CEILS].next = NULL;
(*cells)[SPATIAL_PARTITION_WALLS].next = NULL;
(*cells)[SPATIAL_PARTITION_WATER].next = NULL;
cells++;
}
@@ -115,9 +120,10 @@ static void add_surface_to_cell(s16 dynamic, s16 cellX, s16 cellZ, struct Surfac
s16 priority;
s16 sortDir;
s16 listIndex;
s16 isWater = surface->type == SURFACE_NEW_WATER || surface->type == SURFACE_NEW_WATER_BOTTOM;
if (surface->normal.y > 0.01) {
listIndex = SPATIAL_PARTITION_FLOORS;
listIndex = isWater ? SPATIAL_PARTITION_WATER : SPATIAL_PARTITION_FLOORS;
sortDir = 1; // highest to lowest, then insertion order
} else if (surface->normal.y < -0.01) {
listIndex = SPATIAL_PARTITION_CEILS;
@@ -197,7 +203,7 @@ static s16 max_3(s16 a0, s16 a1, s16 a2) {
* time). This function determines the lower cell for a given x/z position.
* @param coord The coordinate to test
*/
static s16 lower_cell_index(s16 coord) {
static s16 lower_cell_index(s32 coord) {
s16 index;
// Move from range [-0x2000, 0x2000) to [0, 0x4000)
@@ -229,7 +235,7 @@ static s16 lower_cell_index(s16 coord) {
* time). This function determines the upper cell for a given x/z position.
* @param coord The coordinate to test
*/
static s16 upper_cell_index(s16 coord) {
static s16 upper_cell_index(s32 coord) {
s16 index;
// Move from range [-0x2000, 0x2000) to [0, 0x4000)
@@ -524,8 +530,8 @@ static void load_environmental_regions(s16 **data) {
* Allocate some of the main pool for surfaces (2300 surf) and for surface nodes (7000 nodes).
*/
void alloc_surface_pools(void) {
sSurfacePoolSize = 2300;
sSurfaceNodePool = main_pool_alloc(7000 * sizeof(struct SurfaceNode), MEMORY_POOL_LEFT);
sSurfacePoolSize = SURFACE_POOL_SIZE;
sSurfaceNodePool = main_pool_alloc(SURFACE_NODE_POOL_SIZE * sizeof(struct SurfaceNode), MEMORY_POOL_LEFT);
sSurfacePool = main_pool_alloc(sSurfacePoolSize * sizeof(struct Surface), MEMORY_POOL_LEFT);
gCCMEnteredSlide = 0;
@@ -589,7 +595,7 @@ u32 get_area_terrain_size(s16 *data) {
*/
void load_area_terrain(s16 index, s16 *data, s8 *surfaceRooms, s16 *macroObjects) {
s16 terrainLoadType;
s16 *vertexData;
s16 *vertexData = NULL;
UNUSED s32 unused;
// Initialize the data for this.
+5 -2
View File
@@ -6,6 +6,8 @@
#include "surface_collision.h"
#include "types.h"
extern u8 gSurfacePoolError;
#define NUM_CELLS (2 * LEVEL_BOUNDARY_MAX / CELL_SIZE)
#define NUM_CELLS_INDEX (NUM_CELLS - 1)
@@ -19,10 +21,11 @@ enum
{
SPATIAL_PARTITION_FLOORS,
SPATIAL_PARTITION_CEILS,
SPATIAL_PARTITION_WALLS
SPATIAL_PARTITION_WALLS,
SPATIAL_PARTITION_WATER
};
typedef struct SurfaceNode SpatialPartitionCell[3];
typedef struct SurfaceNode SpatialPartitionCell[4];
// Needed for bs bss reordering memes.
extern s32 unused8038BE90;
+3 -2
View File
@@ -1,5 +1,6 @@
#include <PR/ultratypes.h>
#include "config.h"
#include "prevent_bss_reordering.h"
#include "area.h"
#include "sm64.h"
@@ -24,7 +25,7 @@
#include "dialog_ids.h"
struct SpawnInfo gPlayerSpawnInfos[1];
struct GraphNode *D_8033A160[0x100];
struct GraphNode *gGraphNodePointers[MODEL_ID_COUNT];
struct Area gAreaData[8];
struct WarpTransition gWarpTransition;
@@ -37,7 +38,7 @@ s16 gMenuOptSelectIndex;
s16 gSaveOptSelectIndex;
struct SpawnInfo *gMarioSpawnInfo = &gPlayerSpawnInfos[0];
struct GraphNode **gLoadedGraphNodes = D_8033A160;
struct GraphNode **gLoadedGraphNodes = gGraphNodePointers;
struct Area *gAreas = gAreaData;
struct Area *gCurrentArea = NULL;
struct CreditsEntry *gCurrCreditsEntry = NULL;
+1 -1
View File
@@ -138,7 +138,7 @@ enum MenuOption {
extern struct GraphNode **gLoadedGraphNodes;
extern struct SpawnInfo gPlayerSpawnInfos[];
extern struct GraphNode *D_8033A160[];
extern struct GraphNode *gGraphNodePointers[MODEL_ID_COUNT];
extern struct Area gAreaData[];
extern struct WarpTransition gWarpTransition;
extern s16 gCurrCourseNum;
+3 -3
View File
@@ -58,7 +58,7 @@ struct Struct8032F34C {
s16 numBridgeSections;
s16 bridgeRelativeStartingXorZ;
s16 platformWidth;
s16 model;
ModelID model;
const void *segAddr;
};
@@ -66,7 +66,7 @@ struct Struct802C0DF0 {
u8 unk0;
u8 unk1;
u8 unk2;
u8 model;
ModelID model;
const BehaviorScript *behavior;
};
@@ -78,7 +78,7 @@ struct Struct8032F754 {
struct OpenableGrill {
s16 halfWidth;
s16 modelID;
ModelID modelID;
const Collision *collision;
};
+1 -1
View File
@@ -864,7 +864,7 @@ void bhv_boo_in_castle_loop(void) {
}
void bhv_boo_staircase(void) {
f32 targetY;
f32 targetY = 0.0f;
switch (o->oBehParams2ndByte) {
case 1:
+4 -3
View File
@@ -258,7 +258,7 @@ void bhv_free_bowling_ball_init(void) {
}
void bhv_free_bowling_ball_roll_loop(void) {
s16 collisionFlags = object_step();
/*s16 collisionFlags = */object_step();
bowling_ball_set_hitbox();
if (o->oForwardVel > 10.0f) {
@@ -266,8 +266,9 @@ void bhv_free_bowling_ball_roll_loop(void) {
cur_obj_play_sound_1(SOUND_ENV_UNKNOWN2);
}
if ((collisionFlags & OBJ_COL_FLAG_GROUNDED) && !(collisionFlags & OBJ_COL_FLAGS_LANDED))
cur_obj_play_sound_2(SOUND_GENERAL_QUIET_POUND1_LOWPRIO);
/* Always false, commented out to suppress compiler warnings */
// if ((collisionFlags & OBJ_COL_FLAG_GROUNDED) && !(collisionFlags & OBJ_COL_FLAGS_LANDED))
// cur_obj_play_sound_2(SOUND_GENERAL_QUIET_POUND1_LOWPRIO);
if (!is_point_within_radius_of_mario(o->oPosX, o->oPosY, o->oPosZ, 6000)) {
o->header.gfx.node.flags |= GRAPH_RENDER_INVISIBLE;
+16 -2
View File
@@ -1,3 +1,6 @@
#include "config.h"
// bowser.c.inc
/**
* Behavior for Bowser and it's actions (Tail, Flame, Body)
*/
@@ -1480,6 +1483,10 @@ s32 bowser_check_fallen_off_stage(void) {
return FALSE;
}
#ifdef PLATFORM_DISPLACEMENT_2
struct PlatformDisplacementInfo sBowserDisplacementInfo;
#endif
/**
* Set Bowser's actions
*/
@@ -1556,11 +1563,18 @@ void bowser_free_update(void) {
struct Surface *floor;
struct Object *platform;
UNUSED f32 floorHeight;
// Platform displacement check (for BITFS)
#ifdef PLATFORM_DISPLACEMENT_2
s16 tmpOFaceAngleYaw = (s16) o->oFaceAngleYaw;
if ((platform = o->platform) != NULL) {
// NOTE: This function was at one point using '&o->oFaceAngleYaw', which is a s32 address. Should tmpOFaceAngleYaw be using the first 16 bits instead, or was that a bug?
apply_platform_displacement(&sBowserDisplacementInfo, &o->oPosX, &tmpOFaceAngleYaw, platform);
o->oFaceAngleYaw = tmpOFaceAngleYaw;
}
#else
if ((platform = o->platform) != NULL) {
apply_platform_displacement(FALSE, platform);
}
#endif
// Reset grabbed status
o->oBowserGrabbedStatus = BOWSER_GRAB_STATUS_NONE;
// Update positions and actions (default action)
+3
View File
@@ -33,6 +33,9 @@ static void fish_spawner_act_spawn(void) {
case FISH_SPAWNER_BP_FEW_CYAN:
model = MODEL_CYAN_FISH; schoolQuantity = 5; minDistToMario = 1500.0f; fishAnimation = cyan_fish_seg6_anims_0600E264;
break;
default:
return;
}
+1 -1
View File
@@ -42,7 +42,7 @@ void bhv_jrb_sliding_box_loop(void) {
struct Surface *sp38;
UNUSED Vec3f sp2C;
Vec3f sp20;
s16 sp1E;
s16 sp1E = 0;
if (o->oJrbSlidingBoxUnkF4 == NULL) {
sp3C = cur_obj_nearest_object_with_behavior(bhvInSunkenShip3);
if (sp3C != NULL) // NULL check only for assignment, not for dereference?
+6
View File
@@ -1,3 +1,4 @@
#include "config.h"
/**
* Behaviors for bhvPoleGrabbing and bhvGiantPole.
*
@@ -16,8 +17,13 @@ void bhv_pole_init(void) {
* This is equivalent to using `o->oBehParams2ndByte` according to
* `spawn_objects_from_info`.
*/
#ifdef LONGER_POLES
o->hitboxHeight = ((o->oBehParams & 0xFFFF0000) >> 16) * 10;
#else
s32 tenthHitboxHeight = o->oBehParams >> 0x10 & 0xFF;
o->hitboxHeight = tenthHitboxHeight * 10;
#endif
}
/**
+7
View File
@@ -1,3 +1,5 @@
#include "config.h"
// spawn_default_star.c.inc
static struct ObjectHitbox sCollectStarHitbox = {
@@ -17,8 +19,13 @@ void bhv_collect_star_init(void) {
u8 currentLevelStarFlags;
starId = (o->oBehParams >> 24) & 0xFF;
#ifdef GLOBAL_STAR_IDS
currentLevelStarFlags = save_file_get_star_flags(gCurrSaveFileNum - 1, (starId/7) - 1);
if (currentLevelStarFlags & (1 << (starId % 7))) {
#else
currentLevelStarFlags = save_file_get_star_flags(gCurrSaveFileNum - 1, gCurrCourseNum - 1);
if (currentLevelStarFlags & (1 << starId)) {
#endif
o->header.gfx.sharedChild = gLoadedGraphNodes[MODEL_TRANSPARENT_STAR];
} else {
o->header.gfx.sharedChild = gLoadedGraphNodes[MODEL_STAR];
@@ -1,3 +1,5 @@
#include "config.h"
/**
* This is the behavior file for the tilting inverted pyramids in BitFS/LLL.
* The object essentially just tilts and moves Mario with it.
@@ -131,7 +133,10 @@ void bhv_tilting_inverted_pyramid_loop(void) {
mx += posAfterRotation[0] - posBeforeRotation[0];
my += posAfterRotation[1] - posBeforeRotation[1];
mz += posAfterRotation[2] - posBeforeRotation[2];
#ifndef PLATFORM_DISPLACEMENT_2
set_mario_pos(mx, my, mz);
#endif
}
o->header.gfx.throwMatrix = transform;
+9
View File
@@ -1,3 +1,4 @@
#include "config.h"
// tree_particles.c.inc
void bhv_tree_snow_or_leaf_loop(void) {
@@ -33,15 +34,23 @@ void bhv_tree_snow_or_leaf_loop(void) {
void bhv_snow_leaf_particle_spawn_init(void) {
struct Object *obj; // Either snow or leaf
#ifdef TREE_PARTICLE_FIX
struct Object *nearestTree = NULL;
#endif
UNUSED s32 unused;
s32 isSnow;
f32 scale;
UNUSED s32 unused2;
gMarioObject->oActiveParticleFlags &= ~0x2000;
#ifdef TREE_PARTICLE_FIX
nearestTree = cur_obj_nearest_object_with_behavior(bhvTree);
isSnow = (nearestTree->header.gfx.sharedChild == gLoadedGraphNodes[MODEL_CCM_SNOW_TREE] || nearestTree->header.gfx.sharedChild == gLoadedGraphNodes[MODEL_SL_SNOW_TREE]);
#else
if (gCurrLevelNum == LEVEL_CCM || gCurrLevelNum == LEVEL_SL)
isSnow = 1;
else
isSnow = 0;
#endif
if (isSnow) {
if (random_float() < 0.5) {
obj = spawn_object(o, MODEL_WHITE_PARTICLE_DL, bhvTreeSnow);
+1
View File
@@ -163,6 +163,7 @@ void bhv_unagi_loop(void) {
break;
case 2:
unagi_act_2();
// fall through
case 3:
unagi_act_3();
break;
+37 -18
View File
@@ -28,6 +28,7 @@
#include "paintings.h"
#include "engine/graph_node.h"
#include "level_table.h"
#include "config.h"
#define CBUTTON_MASK (U_CBUTTONS | D_CBUTTONS | L_CBUTTONS | R_CBUTTONS)
@@ -878,21 +879,21 @@ void pan_ahead_of_player(struct Camera *c) {
vec3f_add(c->focus, pan);
}
s16 find_in_bounds_yaw_wdw_bob_thi(Vec3f pos, Vec3f origin, s16 yaw) {
switch (gCurrLevelArea) {
case AREA_WDW_MAIN:
yaw = clamp_positions_and_find_yaw(pos, origin, 4508.f, -3739.f, 4508.f, -3739.f);
break;
case AREA_BOB:
yaw = clamp_positions_and_find_yaw(pos, origin, 8000.f, -8000.f, 7050.f, -8000.f);
break;
case AREA_THI_HUGE:
yaw = clamp_positions_and_find_yaw(pos, origin, 8192.f, -8192.f, 8192.f, -8192.f);
break;
case AREA_THI_TINY:
yaw = clamp_positions_and_find_yaw(pos, origin, 2458.f, -2458.f, 2458.f, -2458.f);
break;
}
s16 find_in_bounds_yaw_wdw_bob_thi(UNUSED Vec3f pos, UNUSED Vec3f origin, s16 yaw) {
// switch (gCurrLevelArea) {
// case AREA_WDW_MAIN:
// yaw = clamp_positions_and_find_yaw(pos, origin, 4508.f, -3739.f, 4508.f, -3739.f);
// break;
// case AREA_BOB:
// yaw = clamp_positions_and_find_yaw(pos, origin, 8000.f, -8000.f, 7050.f, -8000.f);
// break;
// case AREA_THI_HUGE:
// yaw = clamp_positions_and_find_yaw(pos, origin, 8192.f, -8192.f, 8192.f, -8192.f);
// break;
// case AREA_THI_TINY:
// yaw = clamp_positions_and_find_yaw(pos, origin, 2458.f, -2458.f, 2458.f, -2458.f);
// break;
// }
return yaw;
}
@@ -1187,6 +1188,22 @@ void mode_8_directions_camera(struct Camera *c) {
s8DirModeYawOffset -= DEGREES(45);
play_sound_cbutton_side();
}
#ifdef PARALLEL_LAKITU_CAM
// extra functionality
else if (gPlayer1Controller->buttonPressed & U_JPAD) {
s8DirModeYawOffset = 0;
s8DirModeYawOffset = gMarioState->faceAngle[1]-0x8000;
}
else if (gPlayer1Controller->buttonDown & L_JPAD) {
s8DirModeYawOffset -= DEGREES(2);
}
else if (gPlayer1Controller->buttonDown & R_JPAD) {
s8DirModeYawOffset += DEGREES(2);
}
else if (gPlayer1Controller->buttonPressed & D_JPAD) {
s8DirModeYawOffset = s8DirModeYawOffset&0xE000;
}
#endif
lakitu_zoom(400.f, 0x900);
c->nextYaw = update_8_directions_camera(c, c->focus, pos);
@@ -1608,7 +1625,8 @@ s32 update_boss_fight_camera(struct Camera *c, Vec3f focus, Vec3f pos) {
switch (gCurrLevelArea) {
case AREA_BOB:
pos[1] += 125.f;
//! fall through, makes the BoB boss fight camera move up twice as high as it should
// fall through
//! makes the BoB boss fight camera move up twice as high as it should
case AREA_WF:
pos[1] += 125.f;
}
@@ -3059,8 +3077,9 @@ void update_camera(struct Camera *c) {
c->nextYaw = gLakituState.nextYaw;
c->mode = gLakituState.mode;
c->defMode = gLakituState.defMode;
#ifndef CAMERA_FIX
camera_course_processing(c);
#endif
stub_camera_3(c);
sCButtonsPressed = find_c_buttons_pressed(sCButtonsPressed, gPlayer1Controller->buttonPressed,
gPlayer1Controller->buttonDown);
@@ -5109,7 +5128,7 @@ s32 determine_dance_cutscene(UNUSED struct Camera *c) {
* @return `pullResult` or `pushResult` depending on Mario's door action
*/
u8 open_door_cutscene(u8 pullResult, u8 pushResult) {
s16 result;
s16 result = 0;
if (sMarioCamState->action == ACT_PULLING_DOOR) {
result = pullResult;
+2
View File
@@ -455,6 +455,8 @@ void envfx_set_bubble_texture(s32 mode, s16 index) {
imageArr = segmented_to_virtual(&bubble_ptr_0B006848);
frame = 0;
break;
default:
return;
}
gDPSetTextureImage(sGfxCursor++, G_IM_FMT_RGBA, G_IM_SIZ_16b, 1, *(imageArr + frame));
+10 -2
View File
@@ -72,10 +72,15 @@ struct DmaHandlerList gDemoInputsBuf;
// fillers
UNUSED static u8 sfillerGameInit[0x90];
static s32 sUnusedGameInitValue = 0;
UNUSED static s32 sUnusedGameInitValue = 0;
// General timer that runs as the game starts
u32 gGlobalTimer = 0;
u8 gIsConsole;
#ifdef WIDE
u8 gWidescreen;
#endif
u8 gBorderHeight;
// Framebuffer rendering values (max 3)
u16 sRenderedFramebuffer = 0;
@@ -367,7 +372,7 @@ void render_init(void) {
} else {
gIsConsole = 1;
gBorderHeight = BORDER_HEIGHT_CONSOLE;
}
}
gGfxPool = &gGfxPools[0];
set_segment_base_addr(1, gGfxPool->buffer);
gGfxSPTask = &gGfxPool->spTask;
@@ -710,6 +715,9 @@ 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());
#ifdef WIDE
gWidescreen = save_file_get_widescreen_mode();
#endif
render_init();
while (TRUE) {
+3
View File
@@ -42,6 +42,9 @@ extern u8 *gGfxPoolEnd;
extern struct GfxPool *gGfxPool;
extern u8 gControllerBits;
extern u8 gIsConsole;
#ifdef WIDE
extern u8 gWidescreen;
#endif
extern u8 gBorderHeight;
#ifdef EEP
extern s8 gEepromProbe;
+48 -2
View File
@@ -13,6 +13,7 @@
#include "area.h"
#include "save_file.h"
#include "print.h"
#include "engine/surface_load.h"
/* @file hud.c
* This file implements HUD rendering and power meter animations.
@@ -20,6 +21,42 @@
* cannon reticle, and the unused keys.
**/
// ------------- FPS COUNTER ---------------
// To use it, call print_fps(x,y); every frame.
#define FRAMETIME_COUNT 30
OSTime frameTimes[FRAMETIME_COUNT];
u8 curFrameTimeIndex = 0;
#include "PR/os_convert.h"
// Call once per frame
f32 calculate_and_update_fps()
{
OSTime newTime = osGetTime();
OSTime oldTime = frameTimes[curFrameTimeIndex];
frameTimes[curFrameTimeIndex] = newTime;
curFrameTimeIndex++;
if (curFrameTimeIndex >= FRAMETIME_COUNT)
curFrameTimeIndex = 0;
return ((f32)FRAMETIME_COUNT * 1000000.0f) / (s32)OS_CYCLES_TO_USEC(newTime - oldTime);
}
void print_fps(s32 x, s32 y)
{
f32 fps = calculate_and_update_fps();
char text[10];
sprintf(text, "%2.2f", fps);
print_text(x, y, text);
}
// ------------ END OF FPS COUNER -----------------
struct PowerMeterHUD {
s8 animation;
s16 x;
@@ -450,11 +487,11 @@ void render_hud(void) {
if (gCurrentArea != NULL && gCurrentArea->camera->mode == CAMERA_MODE_INSIDE_CANNON) {
render_hud_cannon_reticle();
}
#ifndef DISABLE_LIVES
if (hudDisplayFlags & HUD_DISPLAY_FLAG_LIVES) {
render_hud_mario_lives();
}
#endif
if (hudDisplayFlags & HUD_DISPLAY_FLAG_COIN_COUNT) {
render_hud_coins();
}
@@ -475,5 +512,14 @@ void render_hud(void) {
if (hudDisplayFlags & HUD_DISPLAY_FLAG_TIMER) {
render_hud_timer();
}
if (gSurfacePoolError & NOT_ENOUGH_ROOM_FOR_SURFACES)
{
print_text(10, 40, "SURFACE POOL FULL");
}
if (gSurfacePoolError & NOT_ENOUGH_ROOM_FOR_NODES)
{
print_text(10, 60, "SURFACE NODE POOL FULL");
}
}
}
+40 -1059
View File
File diff suppressed because it is too large. Load diff
+1
View File
@@ -129,6 +129,7 @@ extern s8 gRedCoinsCollected;
void create_dl_identity_matrix(void);
void create_dl_translation_matrix(s8 pushOp, f32 x, f32 y, f32 z);
void create_dl_ortho_matrix(void);
void create_dl_scale_matrix(s8 pushOp, f32 x, f32 y, f32 z);
void print_generic_string(s16 x, s16 y, const u8 *str);
void print_hud_lut_string(s8 hudLUT, s16 x, s16 y, const u8 *str);
void print_menu_generic_string(s16 x, s16 y, const u8 *str);
+16 -5
View File
@@ -23,6 +23,7 @@
#include "sm64.h"
#include "sound_init.h"
#include "rumble_init.h"
#include "config.h"
#define INT_GROUND_POUND_OR_TWIRL (1 << 0) // 0x01
#define INT_PUNCH (1 << 1) // 0x02
@@ -745,11 +746,12 @@ u32 interact_coin(struct MarioState *m, UNUSED u32 interactType, struct Object *
m->healCounter += 4 * o->oDamageOrCoinValue;
o->oInteractStatus = INT_STATUS_INTERACTED;
if (COURSE_IS_MAIN_COURSE(gCurrCourseNum) && m->numCoins - o->oDamageOrCoinValue < 100
&& m->numCoins >= 100) {
#ifdef X_COIN_STAR
if (COURSE_IS_MAIN_COURSE(gCurrCourseNum) && m->numCoins - o->oDamageOrCoinValue < X_COIN_STAR
&& m->numCoins >= X_COIN_STAR) {
bhv_spawn_star_no_level_exit(6);
}
#endif
#if ENABLE_RUMBLE
if (o->oDamageOrCoinValue >= 2) {
queue_rumble_data(5, 80);
@@ -768,7 +770,11 @@ u32 interact_water_ring(struct MarioState *m, UNUSED u32 interactType, struct Ob
u32 interact_star_or_key(struct MarioState *m, UNUSED u32 interactType, struct Object *o) {
u32 starIndex;
u32 starGrabAction = ACT_STAR_DANCE_EXIT;
#ifdef NON_STOP_STARS
u32 noExit = 1;
#else
u32 noExit = (o->oInteractionSubtype & INT_SUBTYPE_NO_EXIT) != 0;
#endif
u32 grandStar = (o->oInteractionSubtype & INT_SUBTYPE_GRAND_STAR) != 0;
if (m->health >= 0x100) {
@@ -806,8 +812,11 @@ u32 interact_star_or_key(struct MarioState *m, UNUSED u32 interactType, struct O
o->oInteractStatus = INT_STATUS_INTERACTED;
m->interactObj = o;
m->usedObj = o;
#ifdef GLOBAL_STAR_IDS
starIndex = (o->oBehParams >> 24) & 0xFF;
#else
starIndex = (o->oBehParams >> 24) & 0x1F;
#endif
save_file_collect_star_or_key(m->numCoins, starIndex);
m->numStars =
@@ -1532,7 +1541,9 @@ u32 interact_pole(struct MarioState *m, UNUSED u32 interactType, struct Object *
marioObj->oMarioPoleUnk108 = 0;
marioObj->oMarioPoleYawVel = 0;
marioObj->oMarioPolePos = m->pos[1] - o->oPosY;
marioObj->oMarioPolePos = (m->pos[1] - o->oPosY) < 0
? -o->hitboxDownOffset
: (m->pos[1] - o->oPosY);
if (lowSpeed) {
return set_mario_action(m, ACT_GRAB_POLE_SLOW, 0);
+42 -17
View File
@@ -29,6 +29,8 @@
#include "course_table.h"
#include "rumble_init.h"
#include "config.h"
#define PLAY_MODE_NORMAL 0
#define PLAY_MODE_PAUSED 2
#define PLAY_MODE_CHANGE_AREA 3
@@ -490,7 +492,7 @@ void warp_level(void) {
}
void warp_credits(void) {
s32 marioAction;
s32 marioAction = 0;
switch (sWarpDest.nodeId) {
case WARP_NODE_CREDITS_START:
@@ -557,7 +559,11 @@ void check_instant_warp(void) {
gMarioState->marioObj->oPosX = gMarioState->pos[0];
gMarioState->marioObj->oPosY = gMarioState->pos[1];
gMarioState->marioObj->oPosZ = gMarioState->pos[2];
#ifdef INSTANT_WARP_OFFSET_FIX
gMarioObject->header.gfx.pos[0] = gMarioState->pos[0];
gMarioObject->header.gfx.pos[1] = gMarioState->pos[1];
gMarioObject->header.gfx.pos[2] = gMarioState->pos[2];
#endif
cameraAngle = gMarioState->area->camera->yaw;
change_area(warp->area);
@@ -736,9 +742,11 @@ s16 level_trigger_warp(struct MarioState *m, s32 warpOp) {
break;
case WARP_OP_DEATH:
#ifndef DISABLE_LIVES
if (m->numLives == 0) {
sDelayedWarpOp = WARP_OP_GAME_OVER;
}
#endif
sDelayedWarpTimer = 48;
sSourceWarpNodeId = WARP_NODE_DEATH;
play_transition(WARP_TRANSITION_FADE_INTO_BOWSER, 0x30, 0x00, 0x00, 0x00);
@@ -748,12 +756,17 @@ s16 level_trigger_warp(struct MarioState *m, s32 warpOp) {
case WARP_OP_WARP_FLOOR:
sSourceWarpNodeId = WARP_NODE_WARP_FLOOR;
if (area_get_warp_node(sSourceWarpNodeId) == NULL) {
#ifndef DISABLE_LIVES
if (m->numLives == 0) {
sDelayedWarpOp = WARP_OP_GAME_OVER;
} else {
sSourceWarpNodeId = WARP_NODE_DEATH;
}
#else
sSourceWarpNodeId = WARP_NODE_DEATH;
#endif
}
sDelayedWarpTimer = 20;
play_transition(WARP_TRANSITION_FADE_INTO_CIRCLE, 0x14, 0x00, 0x00, 0x00);
break;
@@ -1026,7 +1039,7 @@ s32 play_mode_paused(void) {
if (gDebugLevelSelect) {
fade_into_special_warp(-9, 1);
} else {
initiate_warp(LEVEL_CASTLE, 1, 0x1F, 0);
initiate_warp(EXIT_COURSE_LEVEL, EXIT_COURSE_AREA, EXIT_COURSE_NODE, 0);
fade_into_special_warp(0, 0);
gSavedCourseNum = COURSE_NONE;
}
@@ -1131,7 +1144,7 @@ UNUSED static s32 play_mode_unused(void) {
}
s32 update_level(void) {
s32 changeLevel;
s32 changeLevel = FALSE;
switch (sCurrPlayMode) {
case PLAY_MODE_NORMAL:
@@ -1190,21 +1203,30 @@ s32 init_level(void) {
if (gCurrentArea != NULL) {
reset_camera(gCurrentArea->camera);
if (gCurrDemoInput != NULL) {
set_mario_action(gMarioState, ACT_IDLE, 0);
} else if (!gDebugLevelSelect) {
if (gMarioState->action != ACT_UNINITIALIZED) {
if (save_file_exists(gCurrSaveFileNum - 1)) {
set_mario_action(gMarioState, ACT_IDLE, 0);
} else {
set_mario_action(gMarioState, ACT_INTRO_CUTSCENE, 0);
val4 = 1;
}
#ifdef PEACH_SKIP
if (gCurrDemoInput != NULL) {
set_mario_action(gMarioState, ACT_IDLE, 0);
} else if (gDebugLevelSelect == 0) {
if (gMarioState->action != ACT_UNINITIALIZED) {
set_mario_action(gMarioState, ACT_IDLE, 0);
}
}
}
#else
if (gCurrDemoInput != NULL) {
set_mario_action(gMarioState, ACT_IDLE, 0);
} else if (gDebugLevelSelect == 0) {
if (gMarioState->action != ACT_UNINITIALIZED) {
if (save_file_exists(gCurrSaveFileNum - 1)) {
set_mario_action(gMarioState, ACT_IDLE, 0);
} else {
set_mario_action(gMarioState, ACT_INTRO_CUTSCENE, 0);
val4 = 1;
}
}
}
}
#endif
if (val4 != 0) {
play_transition(WARP_TRANSITION_FADE_FROM_COLOR, 0x5A, 0xFF, 0xFF, 0xFF);
} else {
@@ -1266,8 +1288,11 @@ s32 lvl_init_from_save_file(UNUSED s16 arg0, s32 levelNum) {
#endif
sWarpDest.type = WARP_TYPE_NOT_WARPING;
sDelayedWarpOp = WARP_OP_NONE;
#ifdef CASTLE_MUSIC_FIX
gNeverEnteredCastle = 0;
#else
gNeverEnteredCastle = !save_file_exists(gCurrSaveFileNum - 1);
#endif
gCurrLevelNum = levelNum;
gCurrCourseNum = COURSE_NONE;
gSavedCourseNum = COURSE_NONE;
+2 -2
View File
@@ -95,7 +95,7 @@ UNUSED static void spawn_macro_coin_unknown(const BehaviorScript *behavior, s16
struct LoadedPreset {
/*0x00*/ const BehaviorScript *behavior;
/*0x04*/ s16 param; // huh? why does the below function swap these.. just use the struct..
/*0x06*/ s16 model;
/*0x06*/ ModelID model;
};
#define MACRO_OBJ_Y_ROT 0
@@ -245,7 +245,7 @@ void spawn_special_objects(s16 areaIndex, s16 **specialObjList) {
s16 y;
s16 z;
s16 extraParams[4];
u8 model;
ModelID model;
u8 type;
u8 presetID;
u8 defaultParam;
+27 -3
View File
@@ -547,7 +547,7 @@ struct Surface *resolve_and_return_wall_collisions(Vec3f pos, f32 offset, f32 ra
f32 vec3f_find_ceil(Vec3f pos, f32 height, struct Surface **ceil) {
UNUSED f32 unused;
return find_ceil(pos[0], height + 80.0f, pos[2], ceil);
return find_ceil(pos[0], height + 3.0f, pos[2], ceil);
}
/**
@@ -639,6 +639,11 @@ s32 mario_floor_is_steep(struct MarioState *m) {
f32 normY;
s32 result = FALSE;
#ifdef JUMP_KICK_FIX
if (m->floor->type == SURFACE_NOT_SLIPPERY)
return FALSE;
#endif
// Interestingly, this function does not check for the
// slide terrain type. This means that steep behavior persists for
// non-slippery and slippery surfaces.
@@ -1167,6 +1172,24 @@ s32 transition_submerged_to_walking(struct MarioState *m) {
}
}
/**
* Transitions Mario from a submerged action to an airborne action.
* You may want to change these actions to fit your hack
*/
s32 transition_submerged_to_airborne(struct MarioState *m) {
set_camera_mode(m->area->camera, m->area->camera->defMode, 1);
vec3s_set(m->angleVel, 0, 0, 0);
if (m->heldObj == NULL) {
if (m->input & INPUT_A_DOWN) return set_mario_action(m, ACT_DIVE, 0);
else return set_mario_action(m, ACT_FREEFALL, 0);
} else {
if (m->input & INPUT_A_DOWN) return set_mario_action(m, ACT_HOLD_JUMP, 0);
else return set_mario_action(m, ACT_HOLD_FREEFALL, 0);
}
}
/**
* This is the transition function typically for entering a submerged action for a
* non-submerged action. This also applies the water surface camera preset.
@@ -1175,7 +1198,8 @@ s32 set_water_plunge_action(struct MarioState *m) {
m->forwardVel = m->forwardVel / 4.0f;
m->vel[1] = m->vel[1] / 2.0f;
m->pos[1] = m->waterLevel - 100;
// !BUG: Causes waterbox upwarp
// m->pos[1] = m->waterLevel - 100;
m->faceAngle[2] = 0;
@@ -1329,7 +1353,7 @@ void update_mario_geometry_inputs(struct MarioState *m) {
m->floorHeight = find_floor(m->pos[0], m->pos[1], m->pos[2], &m->floor);
}
m->ceilHeight = vec3f_find_ceil(&m->pos[0], m->floorHeight, &m->ceil);
m->ceilHeight = vec3f_find_ceil(m->pos, m->pos[1], &m->ceil);
gasLevel = find_poison_gas_level(m->pos[0], m->pos[2]);
m->waterLevel = find_water_level(m->pos[0], m->pos[2]);
+1
View File
@@ -46,6 +46,7 @@ s32 hurt_and_set_mario_action(struct MarioState *m, u32 action, u32 actionArg, s
s32 check_common_action_exits(struct MarioState *m);
s32 check_common_hold_action_exits(struct MarioState *m);
s32 transition_submerged_to_walking(struct MarioState *m);
s32 transition_submerged_to_airborne(struct MarioState *m);
s32 set_water_plunge_action(struct MarioState *m);
s32 execute_mario_action(UNUSED struct Object *o);
void init_mario(void);
+18 -7
View File
@@ -14,6 +14,8 @@
#include "save_file.h"
#include "rumble_init.h"
#include "config.h"
void play_flip_sounds(struct MarioState *m, s16 frame1, s16 frame2, s16 frame3) {
s32 animFrame = m->marioObj->header.gfx.animInfo.animFrame;
if (animFrame == frame1 || animFrame == frame2 || animFrame == frame3) {
@@ -61,6 +63,9 @@ s32 lava_boost_on_wall(struct MarioState *m) {
s32 check_fall_damage(struct MarioState *m, u32 hardFallAction) {
f32 fallHeight;
f32 damageHeight;
#ifdef NO_FALL_DAMAGE
return FALSE;
#endif
fallHeight = m->peakHeight - m->pos[1];
@@ -523,7 +528,7 @@ s32 act_backflip(struct MarioState *m) {
}
s32 act_freefall(struct MarioState *m) {
s32 animation;
s32 animation = 0;
if (m->input & INPUT_B_PRESSED) {
return set_mario_action(m, ACT_DIVE, 0);
@@ -1031,7 +1036,7 @@ s32 act_burning_fall(struct MarioState *m) {
}
s32 act_crazy_box_bounce(struct MarioState *m) {
f32 minSpeed;
f32 minSpeed = 0.0f;
if (m->actionTimer == 0) {
switch (m->actionArg) {
@@ -1311,7 +1316,7 @@ s32 act_air_hit_wall(struct MarioState *m) {
mario_drop_held_object(m);
}
if (++(m->actionTimer) <= 2) {
if (++(m->actionTimer) <= FIRSTY_LAST_FRAME) {
if (m->input & INPUT_A_PRESSED) {
m->vel[1] = 52.0f;
m->faceAngle[1] += 0x8000;
@@ -1337,10 +1342,15 @@ s32 act_air_hit_wall(struct MarioState *m) {
return set_mario_action(m, ACT_SOFT_BONK, 0);
}
#ifdef AVOID_UB
/*#ifdef AVOID_UB
return
#endif
#endif*/
#if FIRSTY_LAST_FRAME > 1
set_mario_animation(m, MARIO_ANIM_START_WALLKICK);
m->marioObj->header.gfx.angle[1] = atan2s(m->wall->normal.z, m->wall->normal.x);
#endif
return FALSE;
//! Missing return statement. The returned value is the result of the call
// to set_mario_animation. In practice, this value is nonzero.
@@ -2061,13 +2071,14 @@ s32 check_common_airborne_cancels(struct MarioState *m) {
}
s32 mario_execute_airborne_action(struct MarioState *m) {
u32 cancel;
u32 cancel = FALSE;
if (check_common_airborne_cancels(m)) {
return TRUE;
}
#ifndef NO_FALL_DAMAGE_SOUND
play_far_fall_sound(m);
#endif
/* clang-format off */
switch (m->action) {
+11 -5
View File
@@ -17,6 +17,8 @@
#include "level_table.h"
#include "rumble_init.h"
#include "config.h"
#define POLE_NONE 0
#define POLE_TOUCHED_FLOOR 1
#define POLE_FELL_OFF 2
@@ -308,7 +310,7 @@ s32 perform_hanging_step(struct MarioState *m, Vec3f nextPos) {
m->wall = resolve_and_return_wall_collisions(nextPos, 50.0f, 50.0f);
floorHeight = find_floor(nextPos[0], nextPos[1], nextPos[2], &floor);
ceilHeight = vec3f_find_ceil(nextPos, floorHeight, &ceil);
ceilHeight = vec3f_find_ceil(nextPos, nextPos[1], &ceil);
if (floor == NULL) {
return HANG_HIT_CEIL_OR_OOB;
@@ -345,7 +347,7 @@ s32 perform_hanging_step(struct MarioState *m, Vec3f nextPos) {
s32 update_hang_moving(struct MarioState *m) {
s32 stepResult;
Vec3f nextPos;
f32 maxSpeed = 4.0f;
f32 maxSpeed = HANGING_SPEED;
m->forwardVel += 1.0f;
if (m->forwardVel > maxSpeed) {
@@ -353,7 +355,11 @@ s32 update_hang_moving(struct MarioState *m) {
}
m->faceAngle[1] =
#ifdef TIGHTER_HANGING_CONTROLS
m->intendedYaw;
#else
m->intendedYaw - approach_s32((s16)(m->intendedYaw - m->faceAngle[1]), 0, 0x800, 0x800);
#endif
m->slideYaw = m->faceAngle[1];
m->slideVelX = m->forwardVel * sins(m->faceAngle[1]);
@@ -550,11 +556,11 @@ s32 act_ledge_grab(struct MarioState *m) {
if (m->actionTimer < 10) {
m->actionTimer++;
}
#ifndef NO_FALSE_LEDGEGRABS
if (m->floor->normal.y < 0.9063078f) {
return let_go_of_ledge(m);
}
#endif
if (m->input & (INPUT_Z_PRESSED | INPUT_OFF_FLOOR)) {
return let_go_of_ledge(m);
}
@@ -854,7 +860,7 @@ s32 check_common_automatic_cancels(struct MarioState *m) {
}
s32 mario_execute_automatic_action(struct MarioState *m) {
s32 cancel;
s32 cancel = FALSE;
if (check_common_automatic_cancels(m)) {
return TRUE;
+9 -1
View File
@@ -13,6 +13,8 @@
#include "behavior_data.h"
#include "rumble_init.h"
#include "config.h"
struct LandingAction {
s16 numFrames;
s16 unk02;
@@ -384,8 +386,13 @@ void update_shell_speed(struct MarioState *m) {
m->forwardVel = 64.0f;
}
#ifdef SUPER_RESPONSIVE_CONTROLS
m->faceAngle[1] = m->intendedYaw;
#else
m->faceAngle[1] =
m->intendedYaw - approach_s32((s16)(m->intendedYaw - m->faceAngle[1]), 0, 0x800, 0x800);
#endif
apply_slope_accel(m);
}
@@ -1285,6 +1292,7 @@ s32 act_crawling(struct MarioState *m) {
mario_set_forward_vel(m, 10.0f);
}
//! Possibly unintended missing break
// fall through
case GROUND_STEP_NONE:
align_with_floor(m);
@@ -1845,7 +1853,7 @@ s32 act_hold_freefall_land(struct MarioState *m) {
}
s32 act_long_jump_land(struct MarioState *m) {
#ifdef VERSION_SH
#if defined (VERSION_SH) || defined(DISABLE_BLJ)
// BLJ (Backwards Long Jump) speed build up fix, crushing SimpleFlips's dreams since July 1997
if (m->forwardVel < 0.0f) {
m->forwardVel = 0.0f;
+3 -3
View File
@@ -37,7 +37,7 @@ s32 mario_update_punch_sequence(struct MarioState *m) {
switch (m->actionArg) {
case 0:
play_sound(SOUND_MARIO_PUNCH_YAH, m->marioObj->header.gfx.cameraToObject);
// Fall-through:
// fall through
case 1:
set_mario_animation(m, MARIO_ANIM_FIRST_PUNCH);
if (is_anim_past_end(m)) {
@@ -77,7 +77,7 @@ s32 mario_update_punch_sequence(struct MarioState *m) {
case 3:
play_sound(SOUND_MARIO_PUNCH_WAH, m->marioObj->header.gfx.cameraToObject);
// Fall-through:
// fall through
case 4:
set_mario_animation(m, MARIO_ANIM_SECOND_PUNCH);
if (is_anim_past_end(m)) {
@@ -456,7 +456,7 @@ s32 check_common_object_cancels(struct MarioState *m) {
}
s32 mario_execute_object_action(struct MarioState *m) {
s32 cancel;
s32 cancel = FALSE;
if (check_common_object_cancels(m)) {
return TRUE;
Loaded 100 of 167 files, more files were not shown because too many files have changed in this diff. Show more