Merge branch 'dev' into deadzone

This commit is contained in:
abcpea 2026-03-15 12:43:15 +11:00
commit 9847380130
204 changed files with 3231 additions and 2408 deletions

View file

@ -26,7 +26,7 @@ jobs:
cd tools
g++ -std=c++17 -o hash_file hash_file.cpp
echo "::notice ::$(./hash_file ../build/us_pc/sm64coopdx)"
- name: Zip the game
run: |
cd ./build/us_pc
@ -37,7 +37,7 @@ jobs:
with:
name: sm64coopdx-linux
path: ./build/us_pc/sm64coopdx_Linux.zip
build-steamos:
if: ${{ github.event_name == 'workflow_dispatch' || contains(github.event.head_commit.message, '[build]') }}
runs-on: ubuntu-22.04
@ -58,7 +58,7 @@ jobs:
cd tools
g++ -std=c++17 -o hash_file hash_file.cpp
echo "::notice ::$(./hash_file ../build/us_pc/sm64coopdx)"
- name: Zip the game
run: |
cd ./build/us_pc
@ -108,7 +108,7 @@ jobs:
cd tools
g++ -std=c++17 -o hash_file.exe hash_file.cpp
echo "::notice ::$(./hash_file.exe ../build/us_pc/sm64coopdx.exe)"
- name: Zip the game
run: |
cd ./build/us_pc
@ -158,7 +158,7 @@ jobs:
cd tools
g++ -std=c++17 -o hash_file.exe hash_file.cpp
echo "::notice ::$(./hash_file.exe ../build/us_pc/sm64coopdx.exe)"
- name: Zip the game
run: |
cd ./build/us_pc
@ -172,17 +172,36 @@ jobs:
build-macos-arm:
if: ${{ github.event_name == 'workflow_dispatch' || contains(github.event.head_commit.message, '[build]') }}
runs-on: macos-latest
runs-on: macos-26
steps:
- name: Checkout repository
uses: actions/checkout@v4
- name: Install dependencies
run: |
brew install make mingw-w64 sdl2 pkg-config glew glfw3 coreutils
brew install make mingw-w64 pkg-config glfw3 coreutils
- name: Compile glew
run: |
export MACOSX_DEPLOYMENT_TARGET=11
curl -L -o glew.tar.gz https://github.com/nigels-com/glew/releases/download/glew-2.2.0/glew-2.2.0.tgz
tar -xzf glew.tar.gz
cd glew-2.2.0
make SYSTEM=darwin CC="clang -arch arm64 -mmacosx-version-min=11" GLEW_PREFIX=/opt/homebrew GLEW_DEST=/opt/homebrew
make install GLEW_PREFIX=/opt/homebrew GLEW_DEST=/opt/homebrew
- name: Compile SDL2
run: |
curl -L -o SDL2.tar.gz https://github.com/libsdl-org/SDL/releases/download/release-2.30.9/SDL2-2.30.9.tar.gz
tar -xzf SDL2.tar.gz
cd SDL2-2.30.9
./configure --prefix=/opt/homebrew CC="clang -arch arm64 -mmacosx-version-min=11"
make -j$(sysctl -n hw.ncpu)
make install
- name: Build the game
run: |
export PKG_CONFIG_PATH=/opt/homebrew/lib/pkgconfig:$PKG_CONFIG_PATH
gmake OSX_BUILD=1 -j$(sysctl -n hw.ncpu)
- name: Code sign the app (Ad-Hoc)
@ -199,7 +218,7 @@ jobs:
run: |
cd ./build/us_pc
zip -r sm64coopdx_macOS_ARM.zip sm64coopdx.app
- name: Upload artifact
uses: actions/upload-artifact@v4
with:
@ -215,7 +234,25 @@ jobs:
- name: Install dependencies
run: |
brew install make mingw-w64 gcc@9 sdl2 pkg-config glew glfw3 coreutils
brew install make mingw-w64 gcc@9 pkg-config glfw3 coreutils
- name: Compile glew
run: |
export MACOSX_DEPLOYMENT_TARGET=10.15
curl -L -o glew.tar.gz https://github.com/nigels-com/glew/releases/download/glew-2.2.0/glew-2.2.0.tgz
tar -xzf glew.tar.gz
cd glew-2.2.0
make SYSTEM=darwin CC="clang -arch x86_64 -mmacosx-version-min=10.15"
make install
- name: Compile SDL2
run: |
curl -L -o SDL2.tar.gz https://github.com/libsdl-org/SDL/releases/download/release-2.30.9/SDL2-2.30.9.tar.gz
tar -xzf SDL2.tar.gz
cd SDL2-2.30.9
./configure --prefix=/usr/local CC="clang -arch x86_64 -mmacosx-version-min=10.15"
make -j$(sysctl -n hw.ncpu)
make install
- name: Build the game
run: |
@ -235,7 +272,7 @@ jobs:
run: |
cd ./build/us_pc
zip -r sm64coopdx_macOS_Intel.zip sm64coopdx.app
- name: Upload artifact
uses: actions/upload-artifact@v4
with:

View file

@ -64,12 +64,7 @@ ICON ?= 1
# Use .app (for macOS)
USE_APP ?= 1
# Minimum macOS Version
# If our arch is arm, set to macOS 14
ifeq ($(shell arch),arm64)
MIN_MACOS_VERSION ?= 14
else
MIN_MACOS_VERSION ?= 10.15
endif
MIN_MACOS_VERSION ?= 11
# Make some small adjustments for handheld devices
HANDHELD ?= 0
@ -1575,15 +1570,15 @@ endif
# with no prerequisites, .SECONDARY causes no intermediate target to be removed
.SECONDARY:
# Handle end of macOS compilation
APP_DIR = ./sm64coopdx.app
APP_CONTENTS_DIR = $(APP_DIR)/Contents
APP_MACOS_DIR = $(APP_CONTENTS_DIR)/MacOS
APP_RESOURCES_DIR = $(APP_CONTENTS_DIR)/Resources
ifeq ($(OSX_BUILD),1)
GLEW_LIB := $(shell find $(BREW_PREFIX)/Cellar/glew | grep libGLEW.2.2.0 | sort -n | uniq)
SDL2_LIB := $(shell find $(BREW_PREFIX)/Cellar/sdl2 | grep libSDL2- | sort -n | uniq)
GLEW_LIB := $(shell find $(BREW_PREFIX)/lib/ | grep libGLEW.2.2.0 | sort -n | uniq)
SDL2_LIB := $(shell find $(BREW_PREFIX)/lib/ | grep libSDL2- | sort -n | uniq)
endif
all:
@ -1605,14 +1600,20 @@ all:
cp build/us_pc/libcoopnet.dylib $(APP_MACOS_DIR); \
cp build/us_pc/libjuice.1.6.2.dylib $(APP_MACOS_DIR); \
cp $(SDL2_LIB) $(APP_MACOS_DIR)/libSDL2.dylib; \
install_name_tool -change $(BREW_PREFIX)/opt/sdl2/lib/libSDL2-2.0.0.dylib @executable_path/libSDL2.dylib $(APP_MACOS_DIR)/sm64coopdx; > /dev/null 2>&1 \
install_name_tool -id @executable_path/libSDL2.dylib $(APP_MACOS_DIR)/libSDL2.dylib; > /dev/null 2>&1 \
install_name_tool -change $(BREW_PREFIX)/lib/libSDL2-2.0.0.dylib @executable_path/libSDL2.dylib $(APP_MACOS_DIR)/sm64coopdx > /dev/null 2>&1; \
install_name_tool -change $(BREW_PREFIX)/opt/sdl2/lib/libSDL2-2.0.0.dylib @executable_path/libSDL2.dylib $(APP_MACOS_DIR)/sm64coopdx > /dev/null 2>&1; \
install_name_tool -id @executable_path/libSDL2.dylib $(APP_MACOS_DIR)/libSDL2.dylib > /dev/null 2>&1; \
codesign --force --deep --sign - $(APP_MACOS_DIR)/libSDL2.dylib; \
cp $(GLEW_LIB) $(APP_MACOS_DIR)/libGLEW.dylib; \
install_name_tool -change $(BREW_PREFIX)/opt/glew/lib/libGLEW.2.2.dylib @executable_path/libGLEW.dylib $(APP_MACOS_DIR)/sm64coopdx; > /dev/null 2>&1 \
install_name_tool -id @executable_path/libGLEW.dylib $(APP_MACOS_DIR)/libGLEW.dylib; > /dev/null 2>&1 \
install_name_tool -change $(BREW_PREFIX)/lib/libGLEW.2.2.0.dylib @executable_path/libGLEW.dylib $(APP_MACOS_DIR)/sm64coopdx > /dev/null 2>&1; \
install_name_tool -change $(BREW_PREFIX)/opt/glew/lib/libGLEW.2.2.0.dylib @executable_path/libGLEW.dylib $(APP_MACOS_DIR)/sm64coopdx > /dev/null 2>&1; \
install_name_tool -id @executable_path/libGLEW.dylib $(APP_MACOS_DIR)/libGLEW.dylib > /dev/null 2>&1; \
codesign --force --deep --sign - $(APP_MACOS_DIR)/libGLEW.dylib; \
cp res/icon.icns $(APP_RESOURCES_DIR)/icon.icns; \
mkdir res/build; \
xcrun actool res/icon.icon --compile res/build --app-icon icon --output-partial-info-plist res/build/Info.plist --minimum-deployment-target $(MIN_MACOS_VERSION) --platform macosx > /dev/null 2>&1; \
mv res/build/Assets.car $(APP_RESOURCES_DIR)/; \
cp res/icon.icns $(APP_RESOURCES_DIR)/; \
rm -rf res/build; \
echo "APPL????" > $(APP_CONTENTS_DIR)/PkgInfo; \
echo '<?xml version="1.0" encoding="UTF-8"?>' > $(APP_CONTENTS_DIR)/Info.plist; \
echo '<!DOCTYPE plist PUBLIC "-//Apple Computer//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">' >> $(APP_CONTENTS_DIR)/Info.plist; \
@ -1623,7 +1624,7 @@ all:
echo ' <key>CFBundleIconFile</key>' >> $(APP_CONTENTS_DIR)/Info.plist; \
echo ' <string>icon</string>' >> $(APP_CONTENTS_DIR)/Info.plist; \
echo ' <key>CFBundleIconName</key>' >> $(APP_CONTENTS_DIR)/Info.plist; \
echo ' <string>AppIcon</string>' >> $(APP_CONTENTS_DIR)/Info.plist; \
echo ' <string>icon</string>' >> $(APP_CONTENTS_DIR)/Info.plist; \
echo ' <key>CFBundleDisplayName</key>' >> $(APP_CONTENTS_DIR)/Info.plist; \
echo ' <string>sm64coopdx</string>' >> $(APP_CONTENTS_DIR)/Info.plist; \
echo ' <!-- Add other keys and values here -->' >> $(APP_CONTENTS_DIR)/Info.plist; \

View file

@ -535,6 +535,8 @@ def def_constant(fname, processed_constant, skip_constant):
continue
if '"' in c[1]:
s += '\n--- @type string\n'
elif "." in c[1]:
s += '\n--- @type number\n'
else:
s += '\n--- @type integer\n'
s += '%s = %s\n' % (c[0], c[1])

View file

@ -80,6 +80,7 @@ in_files = [
"src/audio/seqplayer.h",
"src/engine/lighting_engine.h",
"src/pc/network/sync_object.h",
"src/audio/load.h",
]
override_allowed_functions = {
@ -99,6 +100,7 @@ override_allowed_functions = {
"src/game/ingame_menu.h": [ "set_min_dialog_width", "set_dialog_override_pos", "reset_dialog_override_pos", "set_dialog_override_color", "reset_dialog_override_color", "set_menu_mode", "create_dialog_box", "create_dialog_box_with_var", "create_dialog_inverted_box", "create_dialog_box_with_response", "reset_dialog_render_state", "set_dialog_box_state", "handle_special_dialog_text" ],
"src/audio/seqplayer.h": [ "sequence_player_set_tempo", "sequence_player_set_tempo_acc", "sequence_player_set_transposition", "sequence_player_get_tempo", "sequence_player_get_tempo_acc", "sequence_player_get_transposition", "sequence_player_get_volume", "sequence_player_get_fade_volume", "sequence_player_get_mute_volume_scale" ],
"src/pc/network/sync_object.h": [ "sync_object_is_initialized", "sync_object_is_owned_locally", "sync_object_get_object" ],
"src/audio/load.h": [ "set_sound_bank_override" ],
}
override_disallowed_functions = {
@ -120,14 +122,14 @@ override_disallowed_functions = {
"src/game/sound_init.h": [ "_loop_", "thread4_", "set_sound_mode" ],
"src/pc/network/network_utils.h": [ "network_get_player_text_color[^_]" ],
"src/pc/network/network_player.h": [ "_init", "_connected[^_]", "_shutdown", "_disconnected", "_update", "construct_player_popup", "network_player_name_valid" ],
"src/game/object_helpers.c": [ "spawn_obj", "^bhv_", "abs[fi]", "^bit_shift", "_debug$", "^stub_", "_set_model", "cur_obj_set_direction_table", "cur_obj_progress_direction_table" ],
"src/game/obj_behaviors.c": [ "debug_", "turn_obj_away_from_surface" ],
"src/game/object_helpers.c": [ "spawn_obj", "^bhv_", "geo_", "abs[fi]", "^bit_shift", "_debug$", "^stub_", "_set_model", "cur_obj_set_direction_table", "cur_obj_progress_direction_table" ],
"src/game/obj_behaviors.c": [ "debug_", "geo_", "turn_obj_away_from_surface"],
"src/game/obj_behaviors_2.c": [ "wiggler_jumped_on_attack_handler", "huge_goomba_weakly_attacked" ],
"src/game/spawn_sound.h": [ "exec_anim_sound_state" ],
"src/game/level_info.h": [ "_name_table", "convert_string_" ],
"src/pc/lua/utils/smlua_obj_utils.h": [ "spawn_object_remember_field" ],
"src/game/camera.h": [ "update_camera", "init_camera", "stub_camera", "^reset_camera", "move_point_along_spline", "romhack_camera_init_settings", "romhack_camera_reset_settings" ],
"src/game/behavior_actions.h": [ "bhv_dust_smoke_loop", "bhv_init_room" ],
"src/game/camera.h": [ "geo_", "update_camera", "init_camera", "stub_camera", "^reset_camera", "move_point_along_spline", "romhack_camera_init_settings", "romhack_camera_reset_settings" ],
"src/game/behavior_actions.h": [ "bhv_dust_smoke_loop", "bhv_init_room", "geo_" ],
"src/pc/lua/utils/smlua_audio_utils.h": [ "smlua_audio_utils_override", "audio_custom_shutdown", "smlua_audio_custom_deinit", "audio_sample_destroy_pending_copies", "audio_custom_update_volume" ],
"src/pc/lua/utils/smlua_level_utils.h": [ "smlua_level_util_reset" ],
"src/pc/lua/utils/smlua_text_utils.h": [ "smlua_text_utils_init", "smlua_text_utils_shutdown", "smlua_text_utils_dialog_get_unmodified"],
@ -825,7 +827,7 @@ def build_param(fid, param, i):
lot = translate_type_to_lot(ptype)
s = ' %s %s = (%s)smlua_to_cobject(L, %d, %s);' % (ptype, pid, ptype, i, lot)
if '???' in lot or "GRAPHNODE" in lot:
if '???' in lot:
s = '//' + s + ' <--- UNIMPLEMENTED'
else:
s = ' ' + s
@ -949,7 +951,7 @@ def build_function(function, do_extern):
sparam = build_param(fid, param, i)
param_var, param_value = sparam.split('=')
param_type = param_var.replace(pid, '').strip()
s += ' %s = (%s) NULL;\n' % (param_var.strip(), param_type)
s += ' %s = (%s) %s;\n' % (param_var.strip(), param_type, "NULL" if '*' in param_type else "0")
s += ' if (top >= %d) {\n' % (i)
s += ' %s = %s\n' % (pid, param_value.strip())
s += ' if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter %%u for function \'%%s\'", %d, "%s"); return 0; }\n' % (i, fid)
@ -1340,7 +1342,7 @@ def doc_function(fname, function):
s += '- None\n'
s += '\n### Returns\n'
if rtype != None:
if len(rvalues) > 0:
for _, ptype, plink in rvalues:
if plink:
s += '- [%s](%s)\n' % (ptype, plink)

View file

@ -30,7 +30,7 @@ SMLUA_CALL_EVENT_HOOKS_SET_HOOK_RESULT = """
SMLUA_CALL_EVENT_HOOKS_CALLBACK = """
// call the callback
if (0 != smlua_call_hook(L, {n_inputs}, {n_outputs}, 0, hook->mod[i], hook->modFile[i])) {{
LOG_LUA("Failed to call the callback for hook %s", sLuaHookedEventTypeName[{hook_type}]);
LOG_LUA("Failed to call the callback for hook %s - '%s/%s'", sLuaHookedEventTypeName[{hook_type}], hook->mod[i]->relativePath, hook->modFile[i]->relativePath);
continue;
}}{set_hook_result}
"""

View file

@ -306,6 +306,49 @@ IN_OUT_BOUNCE = function (x) return x < 0.5 and (1 - OUT_BOUNCE(1 - 2 * x)) / 2
---@return number
OUT_IN_BOUNCE = function (x) return x < 0.5 and 0.5 * OUT_BOUNCE(x * 2) or 0.5 + 0.5 * IN_BOUNCE(2 * x - 1) end
--- @alias EasingFunction
--- | `IN_SINE`
--- | `OUT_SINE`
--- | `IN_OUT_SINE`
--- | `OUT_IN_SINE`
--- | `IN_QUAD`
--- | `OUT_QUAD`
--- | `IN_OUT_QUAD`
--- | `OUT_IN_QUAD`
--- | `IN_CUBIC`
--- | `OUT_CUBIC`
--- | `IN_OUT_CUBIC`
--- | `OUT_IN_CUBIC`
--- | `IN_QUART`
--- | `OUT_QUART`
--- | `IN_OUT_QUART`
--- | `OUT_IN_QUART`
--- | `IN_QUINT`
--- | `OUT_QUINT`
--- | `IN_OUT_QUINT`
--- | `OUT_IN_QUINT`
--- | `IN_EXPO`
--- | `OUT_EXPO`
--- | `IN_OUT_EXPO`
--- | `OUT_IN_EXPO`
--- | `IN_CIRC`
--- | `OUT_CIRC`
--- | `IN_OUT_CIRC`
--- | `OUT_IN_CIRC`
--- | `IN_BACK`
--- | `OUT_BACK`
--- | `IN_OUT_BACK`
--- | `OUT_IN_BACK`
--- | `IN_ELASTIC`
--- | `OUT_ELASTIC`
--- | `IN_OUT_ELASTIC`
--- | `OUT_IN_ELASTIC`
--- | `IN_BOUNCE`
--- | `OUT_BOUNCE`
--- | `IN_OUT_BOUNCE`
--- | `OUT_IN_BOUNCE`
--- | fun(x: number): number
--------------------
-- math functions --
--------------------
@ -385,7 +428,7 @@ function math.round(x)
return x > 0 and __math_floor(x + 0.5) or __math_ceil(x - 0.5)
end
--- @param t function | number
--- @param t EasingFunction | number
--- @param a number
--- @param b number
--- @param x number

View file

@ -308,6 +308,49 @@ IN_OUT_BOUNCE = function (x) return x < 0.5 and (1 - OUT_BOUNCE(1 - 2 * x)) / 2
---@return number
OUT_IN_BOUNCE = function (x) return x < 0.5 and 0.5 * OUT_BOUNCE(x * 2) or 0.5 + 0.5 * IN_BOUNCE(2 * x - 1) end
--- @alias EasingFunction
--- | `IN_SINE`
--- | `OUT_SINE`
--- | `IN_OUT_SINE`
--- | `OUT_IN_SINE`
--- | `IN_QUAD`
--- | `OUT_QUAD`
--- | `IN_OUT_QUAD`
--- | `OUT_IN_QUAD`
--- | `IN_CUBIC`
--- | `OUT_CUBIC`
--- | `IN_OUT_CUBIC`
--- | `OUT_IN_CUBIC`
--- | `IN_QUART`
--- | `OUT_QUART`
--- | `IN_OUT_QUART`
--- | `OUT_IN_QUART`
--- | `IN_QUINT`
--- | `OUT_QUINT`
--- | `IN_OUT_QUINT`
--- | `OUT_IN_QUINT`
--- | `IN_EXPO`
--- | `OUT_EXPO`
--- | `IN_OUT_EXPO`
--- | `OUT_IN_EXPO`
--- | `IN_CIRC`
--- | `OUT_CIRC`
--- | `IN_OUT_CIRC`
--- | `OUT_IN_CIRC`
--- | `IN_BACK`
--- | `OUT_BACK`
--- | `IN_OUT_BACK`
--- | `OUT_IN_BACK`
--- | `IN_ELASTIC`
--- | `OUT_ELASTIC`
--- | `IN_OUT_ELASTIC`
--- | `OUT_IN_ELASTIC`
--- | `IN_BOUNCE`
--- | `OUT_BOUNCE`
--- | `IN_OUT_BOUNCE`
--- | `OUT_IN_BOUNCE`
--- | fun(x: number): number
--------------------
-- math functions --
--------------------
@ -387,7 +430,7 @@ function math.round(x)
return x > 0 and __math_floor(x + 0.5) or __math_ceil(x - 0.5)
end
--- @param t function | number
--- @param t EasingFunction | number
--- @param a number
--- @param b number
--- @param x number
@ -2717,6 +2760,42 @@ CONSOLE_MESSAGE_ERROR = 2 --- @type ConsoleMessageLevel
--- | `CONSOLE_MESSAGE_WARNING`
--- | `CONSOLE_MESSAGE_ERROR`
--- @type number
ROTATION_PIVOT_X_LEFT = 0.0
--- @type number
ROTATION_PIVOT_X_CENTER = 0.5
--- @type number
ROTATION_PIVOT_X_RIGHT = 1.0
--- @type number
ROTATION_PIVOT_Y_TOP = 0.0
--- @type number
ROTATION_PIVOT_Y_CENTER = 0.5
--- @type number
ROTATION_PIVOT_Y_BOTTOM = 1.0
--- @type number
TEXT_HALIGN_LEFT = 0.0
--- @type number
TEXT_HALIGN_CENTER = 0.5
--- @type number
TEXT_HALIGN_RIGHT = 1.0
--- @type number
TEXT_VALIGN_TOP = 0.0
--- @type number
TEXT_VALIGN_CENTER = 0.5
--- @type number
TEXT_VALIGN_BOTTOM = 1.0
RESOLUTION_DJUI = 0 --- @type HudUtilsResolution
RESOLUTION_N64 = 1 --- @type HudUtilsResolution
RESOLUTION_COUNT = 2 --- @type HudUtilsResolution
@ -2735,16 +2814,18 @@ FILTER_COUNT = 2 --- @type HudUtilsFilter
--- | `FILTER_LINEAR`
--- | `FILTER_COUNT`
FONT_NORMAL = 0 --- @type DjuiFontType
FONT_MENU = 1 --- @type DjuiFontType
FONT_HUD = 2 --- @type DjuiFontType
FONT_ALIASED = 3 --- @type DjuiFontType
FONT_CUSTOM_HUD = 4 --- @type DjuiFontType
FONT_RECOLOR_HUD = 5 --- @type DjuiFontType
FONT_SPECIAL = 6 --- @type DjuiFontType
FONT_COUNT = 7 --- @type DjuiFontType
FONT_LEGACY = -1 --- @type DjuiFontType
FONT_NORMAL = 0 --- @type DjuiFontType
FONT_MENU = 1 --- @type DjuiFontType
FONT_HUD = 2 --- @type DjuiFontType
FONT_ALIASED = 3 --- @type DjuiFontType
FONT_CUSTOM_HUD = 4 --- @type DjuiFontType
FONT_RECOLOR_HUD = 5 --- @type DjuiFontType
FONT_SPECIAL = 6 --- @type DjuiFontType
FONT_COUNT = 7 --- @type DjuiFontType
--- @alias DjuiFontType
--- | `FONT_LEGACY`
--- | `FONT_NORMAL`
--- | `FONT_MENU`
--- | `FONT_HUD`
@ -3635,7 +3716,7 @@ HUD_DISPLAY_DEFAULT = HUD_DISPLAY_FLAG_LIVES | HUD_DISPLAY_FLAG_CO
--- | `HUD_DISPLAY_DEFAULT`
--- @type integer
LE_MAX_LIGHTS = 512
LE_MAX_LIGHTS = 1024
LE_MODE_AFFECT_ALL_SHADED_AND_COLORED = 0 --- @type LEMode
LE_MODE_AFFECT_ALL_SHADED = 1 --- @type LEMode
@ -8191,6 +8272,9 @@ HOOK_MAX = 60 --- @type LuaHookedEventType
--- | `HOOK_ON_PACKET_BYTESTRING_RECEIVE`
--- | `HOOK_MAX`
--- @type integer
MAX_HOOKED_BEHAVIORS = 1024
HUD_DISPLAY_LIVES = 0 --- @type HudDisplayValue
HUD_DISPLAY_COINS = 1 --- @type HudDisplayValue
HUD_DISPLAY_STARS = 2 --- @type HudDisplayValue

View file

@ -3030,7 +3030,7 @@ end
--- @param name string
--- @return BehaviorId
--- gets a behavior ID from a behavior name
--- Gets a behavior ID from a behavior name
function get_id_from_behavior_name(name)
-- ...
end
@ -3856,7 +3856,9 @@ function djui_hud_reset_color()
-- ...
end
--- @return HudUtilsRotation
--- @return integer rotation
--- @return number pivotX
--- @return number pivotY
--- Gets the current DJUI HUD rotation
function djui_hud_get_rotation()
-- ...
@ -3881,6 +3883,29 @@ function djui_hud_set_rotation_interpolated(prevRotation, prevPivotX, prevPivotY
-- ...
end
--- @return number textHAlign
--- @return number textVAlign
--- Gets the current DJUI HUD text alignment
function djui_hud_get_text_alignment()
-- ...
end
--- @param textHAlign number
--- @param textVAlign number
--- Sets the current DJUI HUD text alignment
function djui_hud_set_text_alignment(textHAlign, textVAlign)
-- ...
end
--- @param prevTextHAlign number
--- @param prevTextVAlign number
--- @param textHAlign number
--- @param textVAlign number
--- Sets the current DJUI HUD text alignment interpolated
function djui_hud_set_text_alignment_interpolated(prevTextHAlign, prevTextVAlign, textHAlign, textVAlign)
-- ...
end
--- @return integer
--- Gets the screen width in the current DJUI HUD resolution
function djui_hud_get_screen_width()
@ -5103,6 +5128,12 @@ function le_set_ambient_color(r, g, b)
-- ...
end
--- @param count integer
--- Sets the max amount of lights that can affect a vertex
function le_set_max_lights_per_vertex(count)
-- ...
end
--- @param pos Vec3f
--- @param out Color
--- @param lightIntensityScalar number
@ -5234,6 +5265,12 @@ function le_set_light_use_surface_normals(id, useSurfaceNormals)
-- ...
end
--- @param bank integer
--- Overrides the soundbank, set to -1 to reset
function set_sound_bank_override(bank)
-- ...
end
--- @param m MarioState
--- @return integer
--- Checks if Mario's current animation has reached its final frame (i.e., the last valid frame in the animation). Useful for deciding when to transition out of an animation-driven action
@ -11516,6 +11553,12 @@ function get_dialog_response()
-- ...
end
--- @return integer
--- Gets the active time stop flags, used to freeze specific objects during cutscenes
function get_time_stop_flags()
-- ...
end
--- @return string
--- Gets the local discord ID if it isn't disabled, otherwise "0" is returned
function get_local_discord_id()
@ -11622,35 +11665,42 @@ function get_os_name()
end
--- @return GraphNodeRoot
--- Gets the current GraphNodeRoot
--- Gets the current root node being processed
function geo_get_current_root()
-- ...
end
--- @return GraphNodeMasterList
--- Gets the current GraphNodeMasterList
--- Gets the current master list node being processed
function geo_get_current_master_list()
-- ...
end
--- @return GraphNodePerspective
--- Gets the current GraphNodePerspective
--- Gets the current perspective node being processed
function geo_get_current_perspective()
-- ...
end
--- @return GraphNodeCamera
--- Gets the current GraphNodeCamera
--- Gets the current camera node being processed
function geo_get_current_camera()
-- ...
end
--- @return GraphNodeHeldObject
--- Gets the current GraphNodeHeldObject
--- Gets the current held object node being processed
function geo_get_current_held_object()
-- ...
end
--- @param node GraphNode
--- @param obj GraphNodeObject
--- Skips graph node interpolation for a frame
function geo_skip_interpolation(node, obj)
-- ...
end
--- @param tex Pointer_Texture
--- @return table
--- Converts a texture's pixels to a Lua table. Returns nil if failed. Otherwise, returns a 1-indexed table of RGBA pixels
@ -12062,6 +12112,18 @@ function set_whirlpools(x, y, z, strength, area, index)
-- ...
end
--- @param o Object
--- Skips object interpolation for a frame
function obj_skip_interpolation(o)
-- ...
end
--- @param o Object
--- Skips animation interpolation for a frame
function obj_anim_skip_interpolation(o)
-- ...
end
--- Resets every modified dialog back to vanilla
function smlua_text_utils_reset_all()
-- ...

View file

@ -955,14 +955,6 @@
--- @field public translation Vec3s
--- @field public rotation Vec3s
--- @class HudUtilsRotation
--- @field public rotation number
--- @field public rotationDiff number
--- @field public prevPivotX number
--- @field public prevPivotY number
--- @field public pivotX number
--- @field public pivotY number
--- @class InstantWarp
--- @field public id integer
--- @field public area integer

View file

@ -1149,6 +1149,18 @@
<br />
## [djui_hud_utils.h](#djui_hud_utils.h)
- ROTATION_PIVOT_X_LEFT
- ROTATION_PIVOT_X_CENTER
- ROTATION_PIVOT_X_RIGHT
- ROTATION_PIVOT_Y_TOP
- ROTATION_PIVOT_Y_CENTER
- ROTATION_PIVOT_Y_BOTTOM
- TEXT_HALIGN_LEFT
- TEXT_HALIGN_CENTER
- TEXT_HALIGN_RIGHT
- TEXT_VALIGN_TOP
- TEXT_VALIGN_CENTER
- TEXT_VALIGN_BOTTOM
### [enum HudUtilsResolution](#HudUtilsResolution)
| Identifier | Value |
@ -1167,6 +1179,7 @@
### [enum DjuiFontType](#DjuiFontType)
| Identifier | Value |
| :--------- | :---- |
| FONT_LEGACY | -1 |
| FONT_NORMAL | 0 |
| FONT_MENU | 1 |
| FONT_HUD | 2 |
@ -3525,6 +3538,7 @@
| HOOK_ON_CLEAR_AREAS | 58 |
| HOOK_ON_PACKET_BYTESTRING_RECEIVE | 59 |
| HOOK_MAX | 60 |
- MAX_HOOKED_BEHAVIORS
[:arrow_up_small:](#)

View file

@ -261,7 +261,7 @@ Gets a behavior name from a behavior ID (bhvMyGreatMODCustom004)
## [get_id_from_behavior_name](#get_id_from_behavior_name)
### Description
gets a behavior ID from a behavior name
Gets a behavior ID from a behavior name
### Lua Example
`local enumValue = get_id_from_behavior_name(name)`
@ -1312,7 +1312,8 @@ Calculates and returns the pitch and yaw angles from one 3D position (`from`) to
| to | [Vec3f](structs.md#Vec3f) |
### Returns
- None
- `integer`
- `integer`
### C Prototype
`void calculate_angles(Vec3f from, Vec3f to, RET s16 *pitch, RET s16 *yaw);`
@ -1585,7 +1586,7 @@ Applies a roll-based shake effect to the camera. Simulates rotational disturbanc
| roll | `integer` |
### Returns
- None
- `integer`
### C Prototype
`void shake_camera_roll(INOUT s16 *roll);`
@ -2825,7 +2826,7 @@ Gets the current DJUI HUD font
- `integer`
### C Prototype
`u8 djui_hud_get_font(void);`
`s8 djui_hud_get_font(void);`
[:arrow_up_small:](#)
@ -2928,16 +2929,18 @@ Resets the current DJUI HUD color
Gets the current DJUI HUD rotation
### Lua Example
`local hudUtilsRotationValue = djui_hud_get_rotation()`
`local rotation, pivotX, pivotY = djui_hud_get_rotation()`
### Parameters
- None
### Returns
- [HudUtilsRotation](structs.md#HudUtilsRotation)
- `integer`
- `number`
- `number`
### C Prototype
`struct HudUtilsRotation* djui_hud_get_rotation(void);`
`void djui_hud_get_rotation(RET s16 *rotation, RET f32 *pivotX, RET f32 *pivotY);`
[:arrow_up_small:](#)
@ -2990,7 +2993,79 @@ Sets the current DJUI HUD rotation interpolated
- None
### C Prototype
`void djui_hud_set_rotation_interpolated(s32 prevRotation, f32 prevPivotX, f32 prevPivotY, s32 rotation, f32 pivotX, f32 pivotY);`
`void djui_hud_set_rotation_interpolated(s16 prevRotation, f32 prevPivotX, f32 prevPivotY, s16 rotation, f32 pivotX, f32 pivotY);`
[:arrow_up_small:](#)
<br />
## [djui_hud_get_text_alignment](#djui_hud_get_text_alignment)
### Description
Gets the current DJUI HUD text alignment
### Lua Example
`local textHAlign, textVAlign = djui_hud_get_text_alignment()`
### Parameters
- None
### Returns
- `number`
- `number`
### C Prototype
`void djui_hud_get_text_alignment(RET f32 *textHAlign, RET f32 *textVAlign);`
[:arrow_up_small:](#)
<br />
## [djui_hud_set_text_alignment](#djui_hud_set_text_alignment)
### Description
Sets the current DJUI HUD text alignment
### Lua Example
`djui_hud_set_text_alignment(textHAlign, textVAlign)`
### Parameters
| Field | Type |
| ----- | ---- |
| textHAlign | `number` |
| textVAlign | `number` |
### Returns
- None
### C Prototype
`void djui_hud_set_text_alignment(f32 textHAlign, f32 textVAlign);`
[:arrow_up_small:](#)
<br />
## [djui_hud_set_text_alignment_interpolated](#djui_hud_set_text_alignment_interpolated)
### Description
Sets the current DJUI HUD text alignment interpolated
### Lua Example
`djui_hud_set_text_alignment_interpolated(prevTextHAlign, prevTextVAlign, textHAlign, textVAlign)`
### Parameters
| Field | Type |
| ----- | ---- |
| prevTextHAlign | `number` |
| prevTextVAlign | `number` |
| textHAlign | `number` |
| textVAlign | `number` |
### Returns
- None
### C Prototype
`void djui_hud_set_text_alignment_interpolated(f32 prevTextHAlign, f32 prevTextVAlign, f32 textHAlign, f32 textVAlign);`
[:arrow_up_small:](#)

View file

@ -147,6 +147,29 @@ Sets the lighting engine ambient color
<br />
## [le_set_max_lights_per_vertex](#le_set_max_lights_per_vertex)
### Description
Sets the max amount of lights that can affect a vertex
### Lua Example
`le_set_max_lights_per_vertex(count)`
### Parameters
| Field | Type |
| ----- | ---- |
| count | `integer` |
### Returns
- None
### C Prototype
`void le_set_max_lights_per_vertex(u8 count);`
[:arrow_up_small:](#)
<br />
## [le_calculate_lighting_color](#le_calculate_lighting_color)
### Description
@ -560,6 +583,35 @@ Sets whether a lighting engine point light will use a surface's normals to deter
<br />
---
# functions from load.h
<br />
## [set_sound_bank_override](#set_sound_bank_override)
### Description
Overrides the soundbank, set to -1 to reset
### Lua Example
`set_sound_bank_override(bank)`
### Parameters
| Field | Type |
| ----- | ---- |
| bank | `integer` |
### Returns
- None
### C Prototype
`void set_sound_bank_override(s32 bank);`
[:arrow_up_small:](#)
<br />
---
# functions from mario.h
@ -5082,7 +5134,9 @@ Calculates the distance between two points in 3D space (`from` and `to`), as wel
| to | [Vec3f](structs.md#Vec3f) |
### Returns
- None
- `number`
- `integer`
- `integer`
### C Prototype
`void vec3f_get_dist_and_angle(Vec3f from, Vec3f to, RET f32 *dist, RET s16 *pitch, RET s16 *yaw);`

View file

@ -2945,7 +2945,7 @@ Determines an object's forward speed multiplier.
| floor_nY | `number` |
### Returns
- None
- `number`
### C Prototype
`void calc_obj_friction(RET f32 *objFriction, f32 floor_nY);`
@ -4419,7 +4419,7 @@ Begin by increasing the current object's scale by `scaleVel`, and slowly decreas
| blinkLength | `integer` |
### Returns
- None
- `integer`
### C Prototype
`void obj_update_blinking(INOUT s32 *blinkTimer, s16 baseCycleLength, s16 cycleLengthRange, s16 blinkLength);`
@ -4743,7 +4743,8 @@ Treats far home as Mario. Returns the distance and angle to the nearest player
| threshold | `number` |
### Returns
- None
- `integer`
- `integer`
### C Prototype
`void treat_far_home_as_mario(f32 threshold, RET s32* distanceToPlayer, RET s32* angleToPlayer);`

View file

@ -1963,7 +1963,7 @@ Marks an object to be unloaded at the end of the frame
| dragStrength | `number` |
### Returns
- None
- `number`
### C Prototype
`void apply_drag_to_value(INOUT f32 *value, f32 dragStrength);`

View file

@ -1775,6 +1775,27 @@ Gets the choice selected inside of a dialog box (0-1)
<br />
## [get_time_stop_flags](#get_time_stop_flags)
### Description
Gets the active time stop flags, used to freeze specific objects during cutscenes
### Lua Example
`local integerValue = get_time_stop_flags()`
### Parameters
- None
### Returns
- `integer`
### C Prototype
`u32 get_time_stop_flags(void);`
[:arrow_up_small:](#)
<br />
## [get_local_discord_id](#get_local_discord_id)
### Description
@ -2154,7 +2175,7 @@ Gets the name of the operating system the game is running on
## [geo_get_current_root](#geo_get_current_root)
### Description
Gets the current GraphNodeRoot
Gets the current root node being processed
### Lua Example
`local graphNodeRootValue = geo_get_current_root()`
@ -2175,7 +2196,7 @@ Gets the current GraphNodeRoot
## [geo_get_current_master_list](#geo_get_current_master_list)
### Description
Gets the current GraphNodeMasterList
Gets the current master list node being processed
### Lua Example
`local graphNodeMasterListValue = geo_get_current_master_list()`
@ -2196,7 +2217,7 @@ Gets the current GraphNodeMasterList
## [geo_get_current_perspective](#geo_get_current_perspective)
### Description
Gets the current GraphNodePerspective
Gets the current perspective node being processed
### Lua Example
`local graphNodePerspectiveValue = geo_get_current_perspective()`
@ -2217,7 +2238,7 @@ Gets the current GraphNodePerspective
## [geo_get_current_camera](#geo_get_current_camera)
### Description
Gets the current GraphNodeCamera
Gets the current camera node being processed
### Lua Example
`local graphNodeCameraValue = geo_get_current_camera()`
@ -2238,7 +2259,7 @@ Gets the current GraphNodeCamera
## [geo_get_current_held_object](#geo_get_current_held_object)
### Description
Gets the current GraphNodeHeldObject
Gets the current held object node being processed
### Lua Example
`local graphNodeHeldObjectValue = geo_get_current_held_object()`
@ -2256,6 +2277,30 @@ Gets the current GraphNodeHeldObject
<br />
## [geo_skip_interpolation](#geo_skip_interpolation)
### Description
Skips graph node interpolation for a frame
### Lua Example
`geo_skip_interpolation(node, obj)`
### Parameters
| Field | Type |
| ----- | ---- |
| node | [GraphNode](structs.md#GraphNode) |
| obj | [GraphNodeObject](structs.md#GraphNodeObject) |
### Returns
- None
### C Prototype
`void geo_skip_interpolation(struct GraphNode *node, struct GraphNodeObject *obj);`
[:arrow_up_small:](#)
<br />
## [texture_to_lua_table](#texture_to_lua_table)
### Description
@ -3531,6 +3576,52 @@ Sets the parameters of one of the two whirlpools (0-indexed) in an area
<br />
## [obj_skip_interpolation](#obj_skip_interpolation)
### Description
Skips object interpolation for a frame
### Lua Example
`obj_skip_interpolation(o)`
### Parameters
| Field | Type |
| ----- | ---- |
| o | [Object](structs.md#Object) |
### Returns
- None
### C Prototype
`void obj_skip_interpolation(struct Object *o);`
[:arrow_up_small:](#)
<br />
## [obj_anim_skip_interpolation](#obj_anim_skip_interpolation)
### Description
Skips animation interpolation for a frame
### Lua Example
`obj_anim_skip_interpolation(o)`
### Parameters
| Field | Type |
| ----- | ---- |
| o | [Object](structs.md#Object) |
### Returns
- None
### C Prototype
`void obj_anim_skip_interpolation(struct Object *o);`
[:arrow_up_small:](#)
<br />
---
# functions from smlua_text_utils.h

View file

@ -763,6 +763,9 @@
- [djui_hud_get_rotation](functions-3.md#djui_hud_get_rotation)
- [djui_hud_set_rotation](functions-3.md#djui_hud_set_rotation)
- [djui_hud_set_rotation_interpolated](functions-3.md#djui_hud_set_rotation_interpolated)
- [djui_hud_get_text_alignment](functions-3.md#djui_hud_get_text_alignment)
- [djui_hud_set_text_alignment](functions-3.md#djui_hud_set_text_alignment)
- [djui_hud_set_text_alignment_interpolated](functions-3.md#djui_hud_set_text_alignment_interpolated)
- [djui_hud_get_screen_width](functions-3.md#djui_hud_get_screen_width)
- [djui_hud_get_screen_height](functions-3.md#djui_hud_get_screen_height)
- [djui_hud_get_mouse_x](functions-3.md#djui_hud_get_mouse_x)
@ -976,6 +979,7 @@
- [le_set_tone_mapping](functions-4.md#le_set_tone_mapping)
- [le_get_ambient_color](functions-4.md#le_get_ambient_color)
- [le_set_ambient_color](functions-4.md#le_set_ambient_color)
- [le_set_max_lights_per_vertex](functions-4.md#le_set_max_lights_per_vertex)
- [le_calculate_lighting_color](functions-4.md#le_calculate_lighting_color)
- [le_calculate_lighting_color_with_normal](functions-4.md#le_calculate_lighting_color_with_normal)
- [le_calculate_lighting_dir](functions-4.md#le_calculate_lighting_dir)
@ -996,6 +1000,11 @@
<br />
- load.h
- [set_sound_bank_override](functions-4.md#set_sound_bank_override)
<br />
- mario.h
- [is_anim_at_end](functions-4.md#is_anim_at_end)
- [is_anim_past_end](functions-4.md#is_anim_past_end)
@ -2047,6 +2056,7 @@
- [set_override_envfx](functions-7.md#set_override_envfx)
- [get_global_timer](functions-7.md#get_global_timer)
- [get_dialog_response](functions-7.md#get_dialog_response)
- [get_time_stop_flags](functions-7.md#get_time_stop_flags)
- [get_local_discord_id](functions-7.md#get_local_discord_id)
- [get_coopnet_id](functions-7.md#get_coopnet_id)
- [get_volume_master](functions-7.md#get_volume_master)
@ -2069,6 +2079,7 @@
- [geo_get_current_perspective](functions-7.md#geo_get_current_perspective)
- [geo_get_current_camera](functions-7.md#geo_get_current_camera)
- [geo_get_current_held_object](functions-7.md#geo_get_current_held_object)
- [geo_skip_interpolation](functions-7.md#geo_skip_interpolation)
- [texture_to_lua_table](functions-7.md#texture_to_lua_table)
- [get_texture_name](functions-7.md#get_texture_name)
@ -2130,6 +2141,8 @@
- [obj_set_vel](functions-7.md#obj_set_vel)
- [obj_move_xyz](functions-7.md#obj_move_xyz)
- [set_whirlpools](functions-7.md#set_whirlpools)
- [obj_skip_interpolation](functions-7.md#obj_skip_interpolation)
- [obj_anim_skip_interpolation](functions-7.md#obj_anim_skip_interpolation)
<br />

View file

@ -53,7 +53,6 @@
- [GraphNodeSwitchCase](#GraphNodeSwitchCase)
- [GraphNodeTranslation](#GraphNodeTranslation)
- [GraphNodeTranslationRotation](#GraphNodeTranslationRotation)
- [HudUtilsRotation](#HudUtilsRotation)
- [InstantWarp](#InstantWarp)
- [LakituState](#LakituState)
- [LevelValues](#LevelValues)
@ -1427,21 +1426,6 @@
<br />
## [HudUtilsRotation](#HudUtilsRotation)
| Field | Type | Access |
| ----- | ---- | ------ |
| rotation | `number` | |
| rotationDiff | `number` | |
| prevPivotX | `number` | |
| prevPivotY | `number` | |
| pivotX | `number` | |
| pivotY | `number` | |
[:arrow_up_small:](#)
<br />
## [InstantWarp](#InstantWarp)
| Field | Type | Access |

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

After

Width:  |  Height:  |  Size: 58 KiB

35
res/icon.icon/icon.json Normal file
View file

@ -0,0 +1,35 @@
{
"fill" : "automatic",
"groups" : [
{
"layers" : [
{
"image-name" : "icon.png",
"name" : "icon",
"position" : {
"scale" : 3.5,
"translation-in-points" : [
0,
0
]
}
}
],
"shadow" : {
"kind" : "neutral",
"opacity" : 0.5
},
"specular" : false,
"translucency" : {
"enabled" : false,
"value" : 0.5
}
}
],
"supported-platforms" : {
"circles" : [
"watchOS"
],
"squares" : "shared"
}
}

View file

@ -1694,6 +1694,9 @@ static void update_game_sound(void) {
break;
case SOUND_BANK_ACTION:
case SOUND_BANK_MARIO_VOICE:
case SOUND_BANK_LUIGI_VOICE:
case SOUND_BANK_WARIO_VOICE:
case SOUND_BANK_TOAD_VOICE:
#if defined(VERSION_EU) || defined(VERSION_SH)
queue_audio_cmd_s8(AUDIO_CMD_ARGS(AUDIO_CMD_REVERB, SEQ_PLAYER_SFX, channelIndex, 0),
get_sound_reverb(bank, soundIndex, channelIndex));

View file

@ -1481,6 +1481,13 @@ u8 get_missing_bank(u32 seqId, s32 *nonNullCount, s32 *nullCount) {
#endif
#ifndef VERSION_SH
s32 gOverrideBank = -1;
void set_sound_bank_override(s32 bank) {
gOverrideBank = bank;
}
struct AudioBank *load_banks_immediate(s32 seqId, u8 *arg1) {
void *ret = NULL;
u32 bankId = 0;
@ -1498,6 +1505,10 @@ struct AudioBank *load_banks_immediate(s32 seqId, u8 *arg1) {
bankId = gAlBankSets[offset - 1];
#endif
if (gOverrideBank > 0) {
bankId = gOverrideBank;
}
if (IS_BANK_LOAD_COMPLETE(bankId) == TRUE) {
#ifdef VERSION_EU
ret = get_bank_or_seq(&gBankLoadedPool, 2, bankId);

View file

@ -53,6 +53,7 @@ extern s32 gMinAiBufferLength;
extern s16 gTempoInternalToExternal;
extern s8 gAudioUpdatesPerFrame; // = 4
extern s8 gSoundMode;
extern s32 gOverrideBank;
#ifdef VERSION_SH
extern OSMesgQueue gUnkQueue1;
@ -95,6 +96,9 @@ void preload_sequence(u32 seqId, u8 preloadMask);
#endif
void load_sequence(u32 player, u32 seqId, s32 loadAsync);
/* |description|Overrides the soundbank, set to -1 to reset|descriptionEnd| */
void set_sound_bank_override(s32 bank);
#ifdef VERSION_SH
void func_sh_802f3158(s32 index, s32 arg1, s32 arg2, OSMesgQueue *retQueue);
u8 *func_sh_802f3220(u32 index, u32 *a1);

View file

@ -797,7 +797,22 @@ static s32 bhv_cmd_load_collision_data(void) {
// Command 0x2D: Sets the home position of the object to its current position.
// Usage: SET_HOME()
static s32 bhv_cmd_set_home(void) {
if (!(gCurrentObject->coopFlags & (COOP_OBJ_FLAG_LUA | COOP_OBJ_FLAG_NETWORK))) {
// COOP: only set home via behavior for the following cases
if (
// if the object wasn't created via Lua
!(gCurrentObject->coopFlags & COOP_OBJ_FLAG_LUA)
// if the object wasn't created via network
// OR
// the object has never had its home set via behavior AND its home is default (e.g. (0, 0, 0))
// (this case handles an object that needs its home set via behavior after being spawned by another player)
&& (
!(gCurrentObject->coopFlags & COOP_OBJ_FLAG_NETWORK)
|| (
!gCurrentObject->setHome
&& gCurrentObject->oHomeX == 0.0f && gCurrentObject->oHomeY == 0.0f && gCurrentObject->oHomeZ == 0.0f
)
)
) {
gCurrentObject->oHomeX = gCurrentObject->oPosX;
gCurrentObject->oHomeY = gCurrentObject->oPosY;
gCurrentObject->oHomeZ = gCurrentObject->oPosZ;

View file

@ -1,382 +0,0 @@
#include "lighting_engine.h"
#include "math_util.h"
struct LELight
{
f32 posX;
f32 posY;
f32 posZ;
u8 colorR;
u8 colorG;
u8 colorB;
f32 radius;
f32 intensity;
bool added;
bool useSurfaceNormals;
};
Color gLEAmbientColor = { 127, 127, 127 };
static struct LELight sLights[LE_MAX_LIGHTS] = { 0 };
static enum LEMode sMode = LE_MODE_AFFECT_ALL_SHADED_AND_COLORED;
static enum LEToneMapping sToneMapping = LE_TONE_MAPPING_WEIGHTED;
static bool sEnabled = false;
static inline void color_set(Color color, u8 r, u8 g, u8 b) {
color[0] = r;
color[1] = g;
color[2] = b;
}
static inline void color_copy(Color dest, Color src) {
dest[0] = src[0];
dest[1] = src[1];
dest[2] = src[2];
}
bool le_is_enabled(void) {
// this is needed because we don't want to make vanilla darker,
// and we don't want to set the ambient color to { 255, 255, 255 }
// because then no one could see the effect of their lights
return sEnabled;
}
void le_set_mode(enum LEMode mode) {
sMode = mode;
}
enum LEMode le_get_mode(void) {
return sMode;
}
void le_set_tone_mapping(enum LEToneMapping toneMapping) {
sToneMapping = toneMapping;
}
void le_get_ambient_color(VEC_OUT Color out) {
color_copy(out, gLEAmbientColor);
}
void le_set_ambient_color(u8 r, u8 g, u8 b) {
color_set(gLEAmbientColor, r, g, b);
sEnabled = true;
}
static inline void le_tone_map_total_weighted(Color out, Color inAmbient, Vec3f inColor, float weight) {
out[0] = clamp((inAmbient[0] + inColor[0]) / weight, 0, 255);
out[1] = clamp((inAmbient[1] + inColor[1]) / weight, 0, 255);
out[2] = clamp((inAmbient[2] + inColor[2]) / weight, 0, 255);
}
static inline void le_tone_map_weighted(Color out, Color inAmbient, Vec3f inColor, float weight) {
out[0] = clamp(inAmbient[0] + (inColor[0] / weight), 0, 255);
out[1] = clamp(inAmbient[1] + (inColor[1] / weight), 0, 255);
out[2] = clamp(inAmbient[2] + (inColor[2] / weight), 0, 255);
}
static inline void le_tone_map_clamp(Color out, Color inAmbient, Vec3f inColor) {
out[0] = clamp(inAmbient[0] + inColor[0], 0, 255);
out[1] = clamp(inAmbient[1] + inColor[1], 0, 255);
out[2] = clamp(inAmbient[2] + inColor[2], 0, 255);
}
static inline void le_tone_map_reinhard(Color out, Color inAmbient, Vec3f inColor) {
inColor[0] += inAmbient[0];
inColor[1] += inAmbient[1];
inColor[2] += inAmbient[2];
out[0] = clamp((inColor[0] / (inColor[0] + 255.0f)) * 255.0f, 0, 255);
out[1] = clamp((inColor[1] / (inColor[1] + 255.0f)) * 255.0f, 0, 255);
out[2] = clamp((inColor[2] / (inColor[2] + 255.0f)) * 255.0f, 0, 255);
}
static inline void le_tone_map(Color out, Color inAmbient, Vec3f inColor, float weight) {
switch (sToneMapping) {
case LE_TONE_MAPPING_TOTAL_WEIGHTED: le_tone_map_total_weighted(out, inAmbient, inColor, weight); break;
case LE_TONE_MAPPING_WEIGHTED: le_tone_map_weighted(out, inAmbient, inColor, weight); break;
case LE_TONE_MAPPING_CLAMP: le_tone_map_clamp(out, inAmbient, inColor); break;
case LE_TONE_MAPPING_REINHARD: le_tone_map_reinhard(out, inAmbient, inColor); break;
}
}
static inline void le_calculate_light_contribution(struct LELight* light, Vec3f pos, Vec3f normal, f32 lightIntensityScalar, Vec3f out_color, f32* weight) {
// skip 'inactive' lights
if (light->intensity <= 0 || light->radius <= 0) { return; }
// vector to light
f32 diffX = light->posX - pos[0];
f32 diffY = light->posY - pos[1];
f32 diffZ = light->posZ - pos[2];
// squared distance check
f32 dist2 = (diffX * diffX) + (diffY * diffY) + (diffZ * diffZ);
f32 radius2 = light->radius * light->radius;
if (dist2 > radius2 || dist2 <= 0) { return; }
// attenuation & intensity
f32 att = 1.0f - (dist2 / radius2);
f32 brightness = att * light->intensity * lightIntensityScalar;
// normalize diff
f32 invLen = 1.0f / sqrtf(dist2);
diffX *= invLen;
diffY *= invLen;
diffZ *= invLen;
if (light->useSurfaceNormals && normal) {
// lambert term
f32 nl = (normal[0] * diffX) + (normal[1] * diffY) + (normal[2] * diffZ);
if (nl <= 0.0f) { return; }
// modulate by normal
brightness *= nl;
}
// accumulate
out_color[0] += light->colorR * brightness;
out_color[1] += light->colorG * brightness;
out_color[2] += light->colorB * brightness;
*weight += brightness;
}
void le_calculate_vertex_lighting(Vtx_t* v, Vec3f pos, Color out) {
// clear color
Vec3f color = { 0 };
// accumulate lighting
f32 weight = 1.0f;
for (s16 i = 0; i < LE_MAX_LIGHTS; i++) {
struct LELight* light = &sLights[i];
if (!light->added) { continue; }
le_calculate_light_contribution(light, pos, NULL, 1.0f, color, &weight);
}
// tone map and output
Color vtxAmbient = {
v->cn[0] * (gLEAmbientColor[0] / 255.0f),
v->cn[1] * (gLEAmbientColor[1] / 255.0f),
v->cn[2] * (gLEAmbientColor[2] / 255.0f),
};
le_tone_map(out, vtxAmbient, color, weight);
}
void le_calculate_lighting_color(Vec3f pos, Color out, f32 lightIntensityScalar) {
// clear color
Vec3f color = { 0 };
// accumulate lighting
f32 weight = 1.0f;
for (s16 i = 0; i < LE_MAX_LIGHTS; i++) {
struct LELight* light = &sLights[i];
if (!light->added) { continue; }
le_calculate_light_contribution(light, pos, NULL, lightIntensityScalar, color, &weight);
}
// tone map and output
le_tone_map(out, gLEAmbientColor, color, weight);
}
void le_calculate_lighting_color_with_normal(Vec3f pos, Vec3f normal, Color out, f32 lightIntensityScalar) {
// normalize normal
if (normal) { vec3f_normalize(normal); }
// clear color
Vec3f color = { 0 };
// accumulate lighting
f32 weight = 1.0f;
for (s16 i = 0; i < LE_MAX_LIGHTS; i++) {
struct LELight* light = &sLights[i];
if (!light->added) { continue; }
le_calculate_light_contribution(light, pos, normal, lightIntensityScalar, color, &weight);
}
// tone map and output
le_tone_map(out, gLEAmbientColor, color, weight);
}
void le_calculate_lighting_dir(Vec3f pos, Vec3f out) {
Vec3f lightingDir = { 0, 0, 0 };
s16 count = 1;
for (s16 i = 0; i < LE_MAX_LIGHTS; i++) {
struct LELight* light = &sLights[i];
if (!light->added) { continue; }
f32 diffX = light->posX - pos[0];
f32 diffY = light->posY - pos[1];
f32 diffZ = light->posZ - pos[2];
f32 dist = (diffX * diffX) + (diffY * diffY) + (diffZ * diffZ);
f32 radius = light->radius * light->radius;
if (dist > radius) { continue; }
Vec3f dir = {
pos[0] - light->posX,
pos[1] - light->posY,
pos[2] - light->posZ,
};
vec3f_normalize(dir);
f32 intensity = (1 - (dist / radius)) * light->intensity;
lightingDir[0] += dir[0] * intensity;
lightingDir[1] += dir[1] * intensity;
lightingDir[2] += dir[2] * intensity;
count++;
}
out[0] = lightingDir[0] / (f32)(count);
out[1] = lightingDir[1] / (f32)(count);
out[2] = lightingDir[2] / (f32)(count);
vec3f_normalize(out);
}
s16 le_add_light(f32 x, f32 y, f32 z, u8 r, u8 g, u8 b, f32 radius, f32 intensity) {
struct LELight* newLight = NULL;
s16 lightID = -1;
for (s16 i = 0; i < LE_MAX_LIGHTS; i++) {
struct LELight* light = &sLights[i];
if (!light->added) {
newLight = light;
lightID = i;
break;
}
}
if (newLight == NULL) { return -1; }
newLight->posX = x;
newLight->posY = y;
newLight->posZ = z;
newLight->colorR = r;
newLight->colorG = g;
newLight->colorB = b;
newLight->radius = radius;
newLight->intensity = intensity;
newLight->added = true;
newLight->useSurfaceNormals = true;
sEnabled = true;
return lightID;
}
void le_remove_light(s16 id) {
if (id < 0 || id >= LE_MAX_LIGHTS) { return; }
memset(&sLights[id], 0, sizeof(struct LELight));
}
s16 le_get_light_count(void) {
s16 count = 0;
for (s16 i = 0; i < LE_MAX_LIGHTS; i++) {
if (sLights[i].added) { count++; }
}
return count;
}
bool le_light_exists(s16 id) {
if (id < 0 || id >= LE_MAX_LIGHTS) { return false; }
return sLights[id].added;
}
void le_get_light_pos(s16 id, VEC_OUT Vec3f out) {
if (id < 0 || id >= LE_MAX_LIGHTS) { return; }
struct LELight* light = &sLights[id];
if (!light->added) { return; }
vec3f_set(out, light->posX, light->posY, light->posZ);
}
void le_set_light_pos(s16 id, f32 x, f32 y, f32 z) {
if (id < 0 || id >= LE_MAX_LIGHTS) { return; }
struct LELight* light = &sLights[id];
if (!light->added) { return; }
light->posX = x;
light->posY = y;
light->posZ = z;
}
void le_get_light_color(s16 id, VEC_OUT Color out) {
if (id < 0 || id >= LE_MAX_LIGHTS) { return; }
struct LELight* light = &sLights[id];
if (!light->added) { return; }
color_set(out, light->colorR, light->colorG, light->colorB);
}
void le_set_light_color(s16 id, u8 r, u8 g, u8 b) {
if (id < 0 || id >= LE_MAX_LIGHTS) { return; }
struct LELight* light = &sLights[id];
if (!light->added) { return; }
light->colorR = r;
light->colorG = g;
light->colorB = b;
}
f32 le_get_light_radius(s16 id) {
if (id < 0 || id >= LE_MAX_LIGHTS) { return 0.0f; }
struct LELight* light = &sLights[id];
if (!light->added) { return 0.0f; }
return light->radius;
}
void le_set_light_radius(s16 id, f32 radius) {
if (id < 0 || id >= LE_MAX_LIGHTS) { return; }
struct LELight* light = &sLights[id];
if (!light->added) { return; }
light->radius = radius;
}
f32 le_get_light_intensity(s16 id) {
if (id < 0 || id >= LE_MAX_LIGHTS) { return 0.0f; }
struct LELight* light = &sLights[id];
if (!light->added) { return 0.0f; }
return light->intensity;
}
void le_set_light_intensity(s16 id, f32 intensity) {
if (id < 0 || id >= LE_MAX_LIGHTS) { return; }
struct LELight* light = &sLights[id];
if (!light->added) { return; }
light->intensity = intensity;
}
bool le_get_light_use_surface_normals(s16 id) {
if (id < 0 || id >= LE_MAX_LIGHTS) { return false; }
struct LELight* light = &sLights[id];
if (!light->added) { return false; }
return light->useSurfaceNormals;
}
void le_set_light_use_surface_normals(s16 id, bool useSurfaceNormals) {
if (id < 0 || id >= LE_MAX_LIGHTS) { return; }
struct LELight* light = &sLights[id];
if (!light->added) { return; }
light->useSurfaceNormals = useSurfaceNormals;
}
void le_clear(void) {
memset(&sLights, 0, sizeof(struct LELight) * LE_MAX_LIGHTS);
gLEAmbientColor[0] = 127;
gLEAmbientColor[1] = 127;
gLEAmbientColor[2] = 127;
}
void le_shutdown(void) {
sEnabled = false;
sMode = LE_MODE_AFFECT_ALL_SHADED_AND_COLORED;
sToneMapping = LE_TONE_MAPPING_WEIGHTED;
le_clear();
}

View file

@ -0,0 +1,444 @@
#include "lighting_engine.h"
extern "C" {
#include "math_util.h"
#include "pc/lua/smlua.h"
}
#undef clamp
#undef min
#undef max
#include <vector>
#include <algorithm>
#ifdef __SSE__
#include <xmmintrin.h>
#endif
#define C_FIELD extern "C"
struct LELight
{
s16 id;
Vec3f pos;
Color color;
f32 radius;
f32 intensity;
bool useSurfaceNormals;
};
Color gLEAmbientColor = { 127, 127, 127 };
static std::vector<LELight> sLightPool;
static std::vector<LELight*> sActiveLights;
static s16 sLightID = -1;
static enum LEMode sMode = LE_MODE_AFFECT_ALL_SHADED_AND_COLORED;
static enum LEToneMapping sToneMapping = LE_TONE_MAPPING_WEIGHTED;
static bool sEnabled = false;
static u8 sMaxLightsPerVertex = 4;
static inline f32 rsqrt(f32 value) {
#ifdef __SSE__
return _mm_cvtss_f32(_mm_rsqrt_ss(_mm_set_ss(value)));
#else
return 1.0f / sqrtf(value);
#endif
}
static inline void color_set(Color color, u8 r, u8 g, u8 b) {
color[0] = r;
color[1] = g;
color[2] = b;
}
static inline void color_copy(Color dest, Color src) {
dest[0] = src[0];
dest[1] = src[1];
dest[2] = src[2];
}
static inline u8 clamp_u8(f32 value) {
s32 v = (s32)value;
v = v < 0 ? 0 : v;
v = v > 255 ? 255 : v;
return (u8)v;
}
C_FIELD bool le_is_enabled(void) {
// this is needed because we don't want to make vanilla darker,
// and we don't want to set the ambient color to { 255, 255, 255 }
// because then no one could see the effect of their lights
return sEnabled;
}
C_FIELD void le_set_mode(enum LEMode mode) {
sMode = mode;
}
C_FIELD enum LEMode le_get_mode(void) {
return sMode;
}
C_FIELD void le_set_tone_mapping(enum LEToneMapping toneMapping) {
sToneMapping = toneMapping;
}
C_FIELD void le_get_ambient_color(VEC_OUT Color out) {
color_copy(out, gLEAmbientColor);
}
C_FIELD void le_set_ambient_color(u8 r, u8 g, u8 b) {
color_set(gLEAmbientColor, r, g, b);
sEnabled = true;
}
C_FIELD void le_set_max_lights_per_vertex(u8 count) {
sMaxLightsPerVertex = count;
}
static inline void le_tone_map_total_weighted(Color out, Color inAmbient, Vec3f inColor, f32 weight) {
out[0] = clamp_u8((inAmbient[0] + inColor[0]) / weight);
out[1] = clamp_u8((inAmbient[1] + inColor[1]) / weight);
out[2] = clamp_u8((inAmbient[2] + inColor[2]) / weight);
}
static inline void le_tone_map_weighted(Color out, Color inAmbient, Vec3f inColor, f32 weight) {
out[0] = clamp_u8(inAmbient[0] + (inColor[0] / weight));
out[1] = clamp_u8(inAmbient[1] + (inColor[1] / weight));
out[2] = clamp_u8(inAmbient[2] + (inColor[2] / weight));
}
static inline void le_tone_map_clamp(Color out, Color inAmbient, Vec3f inColor) {
out[0] = clamp_u8(inAmbient[0] + inColor[0]);
out[1] = clamp_u8(inAmbient[1] + inColor[1]);
out[2] = clamp_u8(inAmbient[2] + inColor[2]);
}
static inline void le_tone_map_reinhard(Color out, Color inAmbient, Vec3f inColor) {
inColor[0] += inAmbient[0];
inColor[1] += inAmbient[1];
inColor[2] += inAmbient[2];
out[0] = clamp_u8((inColor[0] / (inColor[0] + 255.0f)) * 255.0f);
out[1] = clamp_u8((inColor[1] / (inColor[1] + 255.0f)) * 255.0f);
out[2] = clamp_u8((inColor[2] / (inColor[2] + 255.0f)) * 255.0f);
}
static void le_tone_map(Color out, Color inAmbient, Vec3f inColor, f32 weight) {
switch (sToneMapping) {
case LE_TONE_MAPPING_TOTAL_WEIGHTED: le_tone_map_total_weighted(out, inAmbient, inColor, weight); break;
case LE_TONE_MAPPING_WEIGHTED: le_tone_map_weighted(out, inAmbient, inColor, weight); break;
case LE_TONE_MAPPING_CLAMP: le_tone_map_clamp(out, inAmbient, inColor); break;
case LE_TONE_MAPPING_REINHARD: le_tone_map_reinhard(out, inAmbient, inColor); break;
}
}
static void le_update_active_lights() {
sActiveLights.clear();
for (auto& light : sLightPool) {
if (light.intensity > 0.0f && light.radius > 0.0f) {
sActiveLights.push_back(&light);
}
}
}
static inline OPTIMIZE_O3 void le_calculate_light_contribution(const LELight& light, Vec3f pos, Vec3f normal, f32 lightIntensityScalar, Vec3f outColor, f32& weight, u8& contribution) {
// vector to light
f32 diffX = light.pos[0] - pos[0];
f32 diffY = light.pos[1] - pos[1];
f32 diffZ = light.pos[2] - pos[2];
// squared distance check
f32 dist2 = (diffX * diffX) + (diffY * diffY) + (diffZ * diffZ);
f32 radius2 = light.radius * light.radius;
if (dist2 > radius2 || dist2 <= 0) { return; }
// attenuation & intensity
f32 att = 1.0f - (dist2 / radius2);
f32 brightness = att * light.intensity * lightIntensityScalar;
if (light.useSurfaceNormals && normal) {
// normalize diff
f32 invLen = rsqrt(dist2);
diffX *= invLen;
diffY *= invLen;
diffZ *= invLen;
// lambert term
f32 nl = (normal[0] * diffX) + (normal[1] * diffY) + (normal[2] * diffZ);
if (nl <= 0.0f) { return; }
// modulate by normal
brightness *= nl;
}
// accumulate
outColor[0] += light.color[0] * brightness;
outColor[1] += light.color[1] * brightness;
outColor[2] += light.color[2] * brightness;
weight += brightness;
contribution++;
}
C_FIELD OPTIMIZE_O3 void le_calculate_vertex_lighting(const Vtx_t* v, Vec3f pos, VEC_OUT Color out) {
// clear color
Vec3f color = { 0 };
// accumulate lighting
f32 weight = 1.0f;
u8 contribution = 0;
for (LELight* light : sActiveLights) {
le_calculate_light_contribution(*light, pos, NULL, 1.0f, color, weight, contribution);
if (contribution == sMaxLightsPerVertex) { break; }
}
// tone map and output
Color vtxAmbient = {
(u8)(v->cn[0] * (gLEAmbientColor[0] / 255.0f)),
(u8)(v->cn[1] * (gLEAmbientColor[1] / 255.0f)),
(u8)(v->cn[2] * (gLEAmbientColor[2] / 255.0f)),
};
le_tone_map(out, vtxAmbient, color, weight);
}
C_FIELD OPTIMIZE_O3 void le_calculate_lighting_color(Vec3f pos, VEC_OUT Color out, f32 lightIntensityScalar) {
// clear color
Vec3f color = { 0 };
// accumulate lighting
f32 weight = 1.0f;
u8 contribution = 0;
for (LELight* light : sActiveLights) {
le_calculate_light_contribution(*light, pos, NULL, lightIntensityScalar, color, weight, contribution);
if (contribution == sMaxLightsPerVertex) { break; }
}
// tone map and output
le_tone_map(out, gLEAmbientColor, color, weight);
}
C_FIELD OPTIMIZE_O3 void le_calculate_lighting_color_with_normal(Vec3f pos, Vec3f normal, VEC_OUT Color out, f32 lightIntensityScalar) {
// normalize normal
if (normal) { vec3f_normalize(normal); }
// clear color
Vec3f color = { 0 };
// accumulate lighting
f32 weight = 1.0f;
u8 contribution = 0;
for (LELight* light : sActiveLights) {
le_calculate_light_contribution(*light, pos, normal, lightIntensityScalar, color, weight, contribution);
if (contribution == sMaxLightsPerVertex) { break; }
}
// tone map and output
le_tone_map(out, gLEAmbientColor, color, weight);
}
C_FIELD void le_calculate_lighting_dir(Vec3f pos, VEC_OUT Vec3f out) {
Vec3f lightingDir = { 0, 0, 0 };
s16 count = 1;
for (LELight* light : sActiveLights) {
f32 diffX = light->pos[0] - pos[0];
f32 diffY = light->pos[1] - pos[1];
f32 diffZ = light->pos[2] - pos[2];
f32 dist = (diffX * diffX) + (diffY * diffY) + (diffZ * diffZ);
f32 radius = light->radius * light->radius;
if (dist > radius) { continue; }
Vec3f dir = {
pos[0] - light->pos[0],
pos[1] - light->pos[1],
pos[2] - light->pos[2],
};
vec3f_normalize(dir);
f32 intensity = (1 - (dist / radius)) * light->intensity;
lightingDir[0] += dir[0] * intensity;
lightingDir[1] += dir[1] * intensity;
lightingDir[2] += dir[2] * intensity;
count++;
}
out[0] = lightingDir[0] / (f32)(count);
out[1] = lightingDir[1] / (f32)(count);
out[2] = lightingDir[2] / (f32)(count);
vec3f_normalize(out);
}
C_FIELD s16 le_add_light(f32 x, f32 y, f32 z, u8 r, u8 g, u8 b, f32 radius, f32 intensity) {
if (sLightPool.size() >= LE_MAX_LIGHTS) {
LOG_LUA_LINE("LE light count cannot exceed %d lights!", LE_MAX_LIGHTS);
return -1;
}
LELight newLight;
newLight.id = ++sLightID;
newLight.pos[0] = x;
newLight.pos[1] = y;
newLight.pos[2] = z;
newLight.color[0] = r;
newLight.color[1] = g;
newLight.color[2] = b;
newLight.radius = radius;
newLight.intensity = intensity;
newLight.useSurfaceNormals = true;
sLightPool.push_back(newLight);
le_update_active_lights();
sEnabled = true;
return sLightID;
}
C_FIELD void le_remove_light(s16 id) {
if (id < 0) { return; }
auto it = std::find_if(sLightPool.begin(), sLightPool.end(),
[id](const LELight& light) {
return light.id == id;
}
);
if (it != sLightPool.end()) {
sLightPool.erase(it);
}
le_update_active_lights();
}
C_FIELD s16 le_get_light_count(void) {
return sLightPool.size();
}
C_FIELD bool le_light_exists(s16 id) {
if (id < 0) { return false; }
return std::any_of(sLightPool.begin(), sLightPool.end(),
[id](const LELight& light) {
return light.id == id;
}
);
}
static LELight* le_find_light(s16 id) {
if (id < 0) { return nullptr; }
auto it = std::find_if(sLightPool.begin(), sLightPool.end(),
[id](const LELight& light) {
return light.id == id;
}
);
// kinda cursed syntax but it works
return (it != sLightPool.end()) ? &(*it) : nullptr;
}
C_FIELD void le_get_light_pos(s16 id, VEC_OUT Vec3f out) {
if (id < 0) { return; }
if (auto* light = le_find_light(id)) {
vec3f_set(out, light->pos[0], light->pos[1], light->pos[2]);
}
}
C_FIELD void le_set_light_pos(s16 id, f32 x, f32 y, f32 z) {
if (id < 0) { return; }
if (auto* light = le_find_light(id)) {
light->pos[0] = x;
light->pos[1] = y;
light->pos[2] = z;
}
}
C_FIELD void le_get_light_color(s16 id, VEC_OUT Color out) {
if (id < 0) { return; }
if (auto* light = le_find_light(id)) {
color_set(out, light->color[0], light->color[1], light->color[2]);
}
}
C_FIELD void le_set_light_color(s16 id, u8 r, u8 g, u8 b) {
if (id < 0) { return; }
if (auto* light = le_find_light(id)) {
light->color[0] = r;
light->color[1] = g;
light->color[2] = b;
}
}
C_FIELD f32 le_get_light_radius(s16 id) {
if (id < 0) { return 0.0f; }
if (auto* light = le_find_light(id)) {
return light->radius;
}
return 0.0f;
}
C_FIELD void le_set_light_radius(s16 id, f32 radius) {
if (id < 0) { return; }
if (auto* light = le_find_light(id)) {
light->radius = radius;
}
le_update_active_lights();
}
C_FIELD f32 le_get_light_intensity(s16 id) {
if (id < 0) { return 0.0f; }
if (auto* light = le_find_light(id)) {
return light->intensity;
}
return 0.0f;
}
C_FIELD void le_set_light_intensity(s16 id, f32 intensity) {
if (id < 0) { return; }
if (auto* light = le_find_light(id)) {
light->intensity = intensity;
}
le_update_active_lights();
}
C_FIELD bool le_get_light_use_surface_normals(s16 id) {
if (id < 0) { return false; }
if (auto* light = le_find_light(id)) {
return light->useSurfaceNormals;
}
return false;
}
C_FIELD void le_set_light_use_surface_normals(s16 id, bool useSurfaceNormals) {
if (id < 0) { return; }
if (auto* light = le_find_light(id)) {
light->useSurfaceNormals = useSurfaceNormals;
}
}
void le_clear(void) {
sLightPool.clear();
sLightID = -1;
color_set(gLEAmbientColor, 127, 127, 127);
}
void le_shutdown(void) {
sEnabled = false;
sMode = LE_MODE_AFFECT_ALL_SHADED_AND_COLORED;
sToneMapping = LE_TONE_MAPPING_WEIGHTED;
sMaxLightsPerVertex = 4;
le_clear();
}

View file

@ -1,9 +1,12 @@
#ifndef LIGHTING_ENGINE_H
#define LIGHTING_ENGINE_H
#ifdef __cplusplus
extern "C" {
#endif
#include "types.h"
#define LE_MAX_LIGHTS 512
#define LE_MAX_LIGHTS 1024
enum LEMode {
LE_MODE_AFFECT_ALL_SHADED_AND_COLORED,
@ -32,8 +35,10 @@ void le_set_tone_mapping(enum LEToneMapping toneMapping);
void le_get_ambient_color(VEC_OUT Color out);
/* |description|Sets the lighting engine ambient color|descriptionEnd| */
void le_set_ambient_color(u8 r, u8 g, u8 b);
/* |description|Sets the max amount of lights that can affect a vertex|descriptionEnd| */
void le_set_max_lights_per_vertex(u8 count);
void le_calculate_vertex_lighting(Vtx_t* v, Vec3f pos, VEC_OUT Color out);
void le_calculate_vertex_lighting(const Vtx_t* v, Vec3f pos, VEC_OUT Color out);
/* |description|Calculates the lighting with `lightIntensityScalar` at a position and outputs the color in `out`|descriptionEnd|*/
void le_calculate_lighting_color(Vec3f pos, VEC_OUT Color out, f32 lightIntensityScalar);
/* |description|Calculates the lighting with `lightIntensityScalar` at a position and with a normal and outputs the color in `out`|descriptionEnd|*/
@ -71,4 +76,8 @@ void le_set_light_use_surface_normals(s16 id, bool useSurfaceNormals);
void le_clear(void);
void le_shutdown(void);
#ifdef __cplusplus
}
#endif
#endif // LIGHTING_ENGINE_H

View file

@ -271,6 +271,8 @@ static void add_surface(struct Surface *surface, s32 dynamic) {
s16 cellZ, cellX;
smlua_call_event_hooks(HOOK_ON_ADD_SURFACE, surface, dynamic);
minX = min_3(surface->vertex1[0], surface->vertex2[0], surface->vertex3[0]);
minZ = min_3(surface->vertex1[2], surface->vertex2[2], surface->vertex3[2]);
maxX = max_3(surface->vertex1[0], surface->vertex2[0], surface->vertex3[0]);
@ -287,7 +289,6 @@ static void add_surface(struct Surface *surface, s32 dynamic) {
}
}
smlua_call_event_hooks(HOOK_ON_ADD_SURFACE, surface, dynamic);
}
/**
@ -805,7 +806,10 @@ static void load_object_collision_model_internal(bool isSOC) {
for (s32 i = 0; i < MAX_PLAYERS; i++) {
f32 dist = dist_between_objects(gCurrentObject, gMarioStates[i].marioObj);
if (dist < tangibleDist) { anyPlayerInTangibleRange = TRUE; }
if (dist < tangibleDist) {
anyPlayerInTangibleRange = TRUE;
break;
}
}
// If the object collision is supposed to be loaded more than the

View file

@ -57,19 +57,19 @@ void bhv_activated_back_and_forth_platform_init(void) {
o->oActivatedBackAndForthPlatformStartYaw = o->oFaceAngleYaw;
sync_object_init(o, SYNC_DISTANCE_ONLY_EVENTS);
sync_object_init_field(o, &o->oPosX);
sync_object_init_field(o, &o->oPosY);
sync_object_init_field(o, &o->oPosZ);
sync_object_init_field(o, &o->oVelX);
sync_object_init_field(o, &o->oVelY);
sync_object_init_field(o, &o->oVelZ);
sync_object_init_field(o, &o->oActivatedBackAndForthPlatformMaxOffset);
sync_object_init_field(o, &o->oActivatedBackAndForthPlatformOffset);
sync_object_init_field(o, &o->oActivatedBackAndForthPlatformVel);
sync_object_init_field(o, &o->oActivatedBackAndForthPlatformCountdown);
sync_object_init_field(o, &o->oActivatedBackAndForthPlatformStartYaw);
sync_object_init_field(o, &o->oActivatedBackAndForthPlatformVertical);
sync_object_init_field(o, &o->oActivatedBackAndForthPlatformFlipRotation);
sync_object_init_field(o, o->oPosX);
sync_object_init_field(o, o->oPosY);
sync_object_init_field(o, o->oPosZ);
sync_object_init_field(o, o->oVelX);
sync_object_init_field(o, o->oVelY);
sync_object_init_field(o, o->oVelZ);
sync_object_init_field(o, o->oActivatedBackAndForthPlatformMaxOffset);
sync_object_init_field(o, o->oActivatedBackAndForthPlatformOffset);
sync_object_init_field(o, o->oActivatedBackAndForthPlatformVel);
sync_object_init_field(o, o->oActivatedBackAndForthPlatformCountdown);
sync_object_init_field(o, o->oActivatedBackAndForthPlatformStartYaw);
sync_object_init_field(o, o->oActivatedBackAndForthPlatformVertical);
sync_object_init_field(o, o->oActivatedBackAndForthPlatformFlipRotation);
}
/**

View file

@ -207,14 +207,14 @@ void bhv_homing_amp_loop(void) {
if (!sync_object_is_initialized(o->oSyncID)) {
struct SyncObject *so = sync_object_init(o, 4000.0f);
if (so) {
sync_object_init_field(o, &o->oAmpYPhase);
sync_object_init_field(o, &o->oAnimState);
sync_object_init_field(o, &o->oFaceAnglePitch);
sync_object_init_field(o, &o->oFaceAngleYaw);
sync_object_init_field(o, &o->oForwardVel);
sync_object_init_field(o, &o->oFriction);
sync_object_init_field(o, &o->oHomingAmpAvgY);
sync_object_init_field(o, &o->oHomingAmpLockedOn);
sync_object_init_field(o, o->oAmpYPhase);
sync_object_init_field(o, o->oAnimState);
sync_object_init_field(o, o->oFaceAnglePitch);
sync_object_init_field(o, o->oFaceAngleYaw);
sync_object_init_field(o, o->oForwardVel);
sync_object_init_field(o, o->oFriction);
sync_object_init_field(o, o->oHomingAmpAvgY);
sync_object_init_field(o, o->oHomingAmpLockedOn);
}
}
@ -354,12 +354,12 @@ void bhv_circling_amp_loop(void) {
if (!sync_object_is_initialized(o->oSyncID)) {
struct SyncObject *so = sync_object_init(o, 4000.0f);
if (so) {
sync_object_init_field(o, &o->oAmpYPhase);
sync_object_init_field(o, &o->oAnimState);
sync_object_init_field(o, &o->oFaceAnglePitch);
sync_object_init_field(o, &o->oFaceAngleYaw);
sync_object_init_field(o, &o->oForwardVel);
sync_object_init_field(o, &o->oFriction);
sync_object_init_field(o, o->oAmpYPhase);
sync_object_init_field(o, o->oAnimState);
sync_object_init_field(o, o->oFaceAnglePitch);
sync_object_init_field(o, o->oFaceAngleYaw);
sync_object_init_field(o, o->oForwardVel);
sync_object_init_field(o, o->oFriction);
}
}

View file

@ -62,9 +62,9 @@ void bhv_arrow_lift_loop(void) {
if (!sync_object_is_initialized(o->oSyncID)) {
struct SyncObject *so = sync_object_init(o, SYNC_DISTANCE_ONLY_EVENTS);
if (so) {
sync_object_init_field(o, &o->oTimer);
sync_object_init_field(o, &o->oPrevAction);
sync_object_init_field(o, &o->oAction);
sync_object_init_field(o, o->oTimer);
sync_object_init_field(o, o->oPrevAction);
sync_object_init_field(o, o->oAction);
}
}

View file

@ -10,10 +10,10 @@
void bhv_haunted_bookshelf_loop(void) {
if (!sync_object_is_initialized(o->oSyncID)) {
sync_object_init(o, SYNC_DISTANCE_ONLY_EVENTS);
sync_object_init_field(o, &o->oAction);
sync_object_init_field(o, &o->oTimer);
sync_object_init_field(o, &o->oPosX);
sync_object_init_field(o, &o->oHauntedBookshelfShouldOpen);
sync_object_init_field(o, o->oAction);
sync_object_init_field(o, o->oTimer);
sync_object_init_field(o, o->oPosX);
sync_object_init_field(o, o->oHauntedBookshelfShouldOpen);
}
// oDistanceToMario is unused by this object.

View file

@ -10,6 +10,9 @@
* in the enclosure nor in the room around it.
*/
static void handle_merry_go_round_music(void) {
// COOP: raise scope of this variable since floor check is no longer strictly tied to music
u16 marioFloorType = 0;
// If the music should play, play it and check whether it still should.
// Otherwise, don't play it and check whether it should.
if (o->oMerryGoRoundMusicShouldPlay == FALSE) {
@ -23,7 +26,7 @@ static void handle_merry_go_round_music(void) {
// Get Mario's floor and floor surface type
struct Surface *marioFloor = NULL;
struct Object *marioObject = gMarioObjects[0];
u16 marioFloorType = 0;
// COOP: `marioFloorType` originally here
if (marioObject) {
find_floor(marioObject->oPosX, marioObject->oPosY, marioObject->oPosZ, &marioFloor);
@ -37,7 +40,9 @@ static void handle_merry_go_round_music(void) {
// The cur_obj_is_mario_on_platform check is redundant since the merry-go-round
// has surface type 0x1A, so Mario cannot be on the merry-go-round
// without being on a floor with surface type 0x1A (SURFACE_MGR_MUSIC).
gMarioOnMerryGoRound = cur_obj_is_any_player_on_platform();
// COOP: `gMarioOnMerryGoRound` is used to determine if the merry-go-round Boos should be active
// for co-op, this means that this check needs to be separated from the music check, since music is client-side.
if (cur_obj_is_mario_on_platform() || marioFloorType == SURFACE_MGR_MUSIC) {
// If Mario is in the merry-go-round's enclosure, play only the merry-go-round music.
play_secondary_music(SEQ_EVENT_MERRY_GO_ROUND, 0, 78, 50);
@ -60,6 +65,28 @@ static void handle_merry_go_round_music(void) {
cur_obj_play_sound_1(SOUND_ENV_MERRY_GO_ROUND_CREAKING);
}
}
// COOP: floor check happens here
// `marioFloorType` refers to the local player's character
gMarioOnMerryGoRound = marioFloorType == SURFACE_MGR_MUSIC || cur_obj_is_any_player_on_platform();
if (!gMarioOnMerryGoRound) {
// check the other Marios' floors
// starting at 1 since local player was already checked
for (s32 i = 1; i < MAX_PLAYERS; i++) {
if (!is_player_active(&gMarioStates[i])) { continue; }
struct Object *marioObject = gMarioStates[i].marioObj;
if (marioObject == NULL) { continue; }
struct Surface *marioFloor = NULL;
find_floor(marioObject->oPosX, marioObject->oPosY, marioObject->oPosZ, &marioFloor);
if (marioFloor != NULL && marioFloor->type == SURFACE_MGR_MUSIC) {
gMarioOnMerryGoRound = TRUE;
break;
}
}
}
}
/**

View file

@ -12,8 +12,8 @@ void bhv_bbh_tilting_trap_platform_loop(void) {
if (!sync_object_is_initialized(o->oSyncID)) {
sync_object_init(o, 1000.0f);
sync_object_init_field(o, &o->oAngleVelPitch);
sync_object_init_field(o, &o->oFaceAnglePitch);
sync_object_init_field(o, o->oAngleVelPitch);
sync_object_init_field(o, o->oFaceAnglePitch);
}
f32 x = 0;

View file

@ -120,12 +120,12 @@ void bhv_blue_coin_switch_init(void) {
void bhv_blue_coin_switch_loop(void) {
if (!sync_object_is_initialized(o->oSyncID)) {
sync_object_init(o, SYNC_DISTANCE_ONLY_EVENTS);
sync_object_init_field(o, &o->oAction);
sync_object_init_field(o, &o->oVelY);
sync_object_init_field(o, &o->oGravity);
sync_object_init_field(o, &o->oTimer);
sync_object_init_field(o, &o->oPosY);
sync_object_init_field(o, &o->oHomeY);
sync_object_init_field(o, o->oAction);
sync_object_init_field(o, o->oVelY);
sync_object_init_field(o, o->oGravity);
sync_object_init_field(o, o->oTimer);
sync_object_init_field(o, o->oPosY);
sync_object_init_field(o, o->oHomeY);
}
// The switch's model is 1/3 size.

View file

@ -300,9 +300,9 @@ void bhv_bobomb_buddy_init(void) {
if (o->oBobombBuddyRole == BOBOMB_BUDDY_ROLE_CANNON) {
sync_object_init(o, SYNC_DISTANCE_ONLY_EVENTS);
sync_object_init_field(o, &o->oBobombBuddyHasTalkedToMario);
sync_object_init_field(o, &o->oBobombBuddyCannonStatus);
sync_object_init_field(o, &forceCannonOpen);
sync_object_init_field(o, o->oBobombBuddyHasTalkedToMario);
sync_object_init_field(o, o->oBobombBuddyCannonStatus);
sync_object_init_field(o, forceCannonOpen);
}
}

View file

@ -27,20 +27,20 @@ struct SyncObject* boo_sync_object_init(void) {
struct SyncObject *so = sync_object_init(o, 4000.0f);
if (so == NULL) { return NULL; }
so->ignore_if_true = boo_ignore_update;
sync_object_init_field(o, &o->oBooBaseScale);
sync_object_init_field(o, &o->oBooNegatedAggressiveness);
sync_object_init_field(o, &o->oBooOscillationTimer);
sync_object_init_field(o, &o->oBooTargetOpacity);
sync_object_init_field(o, &o->oBooTurningSpeed);
sync_object_init_field(o, &o->oFaceAngleRoll);
sync_object_init_field(o, &o->oFaceAngleYaw);
sync_object_init_field(o, &o->oFlags);
sync_object_init_field(o, &o->oForwardVel);
sync_object_init_field(o, &o->oHealth);
sync_object_init_field(o, &o->oInteractStatus);
sync_object_init_field(o, &o->oInteractType);
sync_object_init_field(o, &o->oOpacity);
sync_object_init_field(o, &o->oRoom);
sync_object_init_field(o, o->oBooBaseScale);
sync_object_init_field(o, o->oBooNegatedAggressiveness);
sync_object_init_field(o, o->oBooOscillationTimer);
sync_object_init_field(o, o->oBooTargetOpacity);
sync_object_init_field(o, o->oBooTurningSpeed);
sync_object_init_field(o, o->oFaceAngleRoll);
sync_object_init_field(o, o->oFaceAngleYaw);
sync_object_init_field(o, o->oFlags);
sync_object_init_field(o, o->oForwardVel);
sync_object_init_field(o, o->oHealth);
sync_object_init_field(o, o->oInteractStatus);
sync_object_init_field(o, o->oInteractType);
sync_object_init_field(o, o->oOpacity);
sync_object_init_field(o, o->oRoom);
return so;
}
@ -56,16 +56,11 @@ void bhv_boo_init(void) {
static s32 boo_should_be_stopped(void) {
if (cur_obj_has_behavior(bhvMerryGoRoundBigBoo) || cur_obj_has_behavior(bhvMerryGoRoundBoo)) {
for (s32 i = 0; i < MAX_PLAYERS; i++) {
if (!is_player_active(&gMarioStates[i])) { continue; }
if (gMarioStates[i].currentRoom != BBH_DYNAMIC_SURFACE_ROOM && gMarioStates[i].currentRoom != BBH_NEAR_MERRY_GO_ROUND_ROOM) { return TRUE; }
}
return FALSE;
/*if (!gMarioOnMerryGoRound) {
if (!gMarioOnMerryGoRound) {
return TRUE;
} else {
return FALSE;
}*/
}
} else {
if (o->activeFlags & ACTIVE_FLAG_IN_DIFFERENT_ROOM) {
return TRUE;
@ -384,9 +379,7 @@ static void boo_chase_mario(f32 a0, s16 a1, f32 a2) {
if (boo_vanish_or_appear()) {
o->oInteractType = 0x8000;
u8 isMerryGoRoundBoo = (cur_obj_has_behavior(bhvMerryGoRoundBigBoo) || cur_obj_has_behavior(bhvMerryGoRoundBoo));
if (!isMerryGoRoundBoo && cur_obj_lateral_dist_from_obj_to_home(player) > 1500.0f) {
if (cur_obj_lateral_dist_from_obj_to_home(player) > 1500.0f) {
sp1A = cur_obj_angle_to_home();
} else {
sp1A = angleToPlayer;
@ -535,7 +528,8 @@ static void (*sBooActions[])(void) = {
};
void bhv_boo_loop(void) {
if (o->oAction < 3) {
// COOP: only sync when Boo isn't in a death state
if (o->oAction < 3 || o->oAction == 5) {
if (!sync_object_is_initialized(o->oSyncID)) {
struct SyncObject* so = boo_sync_object_init();
if (so) { so->syncDeathEvent = FALSE; }
@ -862,8 +856,8 @@ void bhv_boo_with_cage_loop(void) {
void bhv_merry_go_round_boo_manager_loop(void) {
if (!sync_object_is_initialized(o->oSyncID)) {
sync_object_init(o, SYNC_DISTANCE_ONLY_EVENTS);
sync_object_init_field(o, &o->oAction);
sync_object_init_field(o, &o->oMerryGoRoundBooManagerNumBoosSpawned);
sync_object_init_field(o, o->oAction);
sync_object_init_field(o, o->oMerryGoRoundBooManagerNumBoosSpawned);
}
struct Object* player = nearest_player_to_object(o);

View file

@ -32,13 +32,13 @@ void bhv_boo_cage_init(void) {
struct SyncObject* so = sync_object_init(o, SYNC_DISTANCE_ONLY_EVENTS);
if (so == NULL) { return; }
so->on_received_post = bhv_boo_cage_on_received_post;
sync_object_init_field(o, &o->oAction);
sync_object_init_field(o, &o->oPosX);
sync_object_init_field(o, &o->oPosY);
sync_object_init_field(o, &o->oPosZ);
sync_object_init_field(o, &o->oVelX);
sync_object_init_field(o, &o->oVelY);
sync_object_init_field(o, &o->oVelZ);
sync_object_init_field(o, o->oAction);
sync_object_init_field(o, o->oPosX);
sync_object_init_field(o, o->oPosY);
sync_object_init_field(o, o->oPosZ);
sync_object_init_field(o, o->oVelX);
sync_object_init_field(o, o->oVelY);
sync_object_init_field(o, o->oVelZ);
}
/**

View file

@ -53,7 +53,7 @@ void bhv_big_boulder_loop(void) {
void bhv_big_boulder_generator_loop(void) {
if (!sync_object_is_initialized(o->oSyncID)) {
sync_object_init(o, SYNC_DISTANCE_ONLY_EVENTS);
sync_object_init_field(o, &o->oTimer);
sync_object_init_field(o, o->oTimer);
}
struct Object *sp1C;

View file

@ -50,14 +50,14 @@ s16 D_8032F520[][3] = { { 1, 10, 40 }, { 0, 0, 74 }, { -1, -10, 114 }, { 1
void bhv_bowser_tail_anchor_init(void) {
if (!o->parentObj) { mark_obj_for_deletion(o); return; }
sync_object_init_field(o->parentObj, &o->oAction);
sync_object_init_field(o->parentObj, &o->oPrevAction);
sync_object_init_field(o->parentObj, &o->oTimer);
sync_object_init_field(o->parentObj, &o->oIntangibleTimer);
sync_object_init_field(o->parentObj, &o->oInteractStatus);
sync_object_init_field(o->parentObj, &o->header.gfx.scale[0]);
sync_object_init_field(o->parentObj, &o->header.gfx.scale[1]);
sync_object_init_field(o->parentObj, &o->header.gfx.scale[2]);
sync_object_init_field(o->parentObj, o->oAction);
sync_object_init_field(o->parentObj, o->oPrevAction);
sync_object_init_field(o->parentObj, o->oTimer);
sync_object_init_field(o->parentObj, o->oIntangibleTimer);
sync_object_init_field(o->parentObj, o->oInteractStatus);
sync_object_init_field(o->parentObj, o->header.gfx.scale[0]);
sync_object_init_field(o->parentObj, o->header.gfx.scale[1]);
sync_object_init_field(o->parentObj, o->header.gfx.scale[2]);
}
void bhv_bowser_tail_anchor_loop(void) {
@ -112,10 +112,10 @@ void bhv_bowser_flame_spawn_loop(void) {
void bhv_bowser_body_anchor_init(void) {
if (!o->parentObj) { mark_obj_for_deletion(o); return; }
sync_object_init_field(o->parentObj, &o->oInteractType);
sync_object_init_field(o->parentObj, &o->oInteractStatus);
sync_object_init_field(o->parentObj, &o->oIntangibleTimer);
sync_object_init_field(o->parentObj, &o->oDamageOrCoinValue);
sync_object_init_field(o->parentObj, o->oInteractType);
sync_object_init_field(o->parentObj, o->oInteractStatus);
sync_object_init_field(o->parentObj, o->oIntangibleTimer);
sync_object_init_field(o->parentObj, o->oDamageOrCoinValue);
}
void bhv_bowser_body_anchor_loop(void) {
@ -1077,12 +1077,12 @@ void bowser_act_dead(void) {
void bhv_tilting_bowser_lava_platform_init(void) {
sync_object_init(o, SYNC_DISTANCE_ONLY_EVENTS);
sync_object_init_field(o, &o->oAngleVelPitch);
sync_object_init_field(o, &o->oAngleVelRoll);
sync_object_init_field(o, &o->oFaceAnglePitch);
sync_object_init_field(o, &o->oFaceAngleRoll);
sync_object_init_field(o, &o->oMoveAnglePitch);
sync_object_init_field(o, &o->oMoveAngleRoll);
sync_object_init_field(o, o->oAngleVelPitch);
sync_object_init_field(o, o->oAngleVelRoll);
sync_object_init_field(o, o->oFaceAnglePitch);
sync_object_init_field(o, o->oFaceAngleRoll);
sync_object_init_field(o, o->oMoveAnglePitch);
sync_object_init_field(o, o->oMoveAngleRoll);
}
void bowser_tilt_platform(struct Object* platform, s16 a1) {
@ -1445,13 +1445,13 @@ void bhv_bowser_init(void) {
so->ignore_if_true = bhv_bowser_ignore_if_true;
so->on_received_post = bhv_bowser_on_received_post;
so->fullObjectSync = TRUE;
sync_object_init_field_with_size(o, &o->header.gfx.node.flags, 16);
sync_object_init_field_with_size(o, &o->header.gfx.animInfo.animFrame, 16);
sync_object_init_field_with_size(o, &bowserCutsceneGlobalIndex, 8);
sync_object_init_field(o, &networkBowserAnimationIndex);
sync_object_init_field(o, &o->header.gfx.scale[0]);
sync_object_init_field(o, &o->header.gfx.scale[1]);
sync_object_init_field(o, &o->header.gfx.scale[2]);
sync_object_init_field(o, o->header.gfx.node.flags);
sync_object_init_field(o, o->header.gfx.animInfo.animFrame);
sync_object_init_field(o, bowserCutsceneGlobalIndex);
sync_object_init_field(o, networkBowserAnimationIndex);
sync_object_init_field(o, o->header.gfx.scale[0]);
sync_object_init_field(o, o->header.gfx.scale[1]);
sync_object_init_field(o, o->header.gfx.scale[2]);
}
}
}
@ -1692,9 +1692,9 @@ void bhv_falling_bowser_platform_loop(void) {
struct SyncObject* so = sync_object_init(o, SYNC_DISTANCE_ONLY_EVENTS);
if (so) {
so->ignore_if_true = bhv_falling_bowser_platform_ignore_if_true;
sync_object_init_field(o, &o->oAction);
sync_object_init_field(o, &o->oPrevAction);
sync_object_init_field(o, &o->oTimer);
sync_object_init_field(o, o->oAction);
sync_object_init_field(o, o->oPrevAction);
sync_object_init_field(o, o->oTimer);
}
}

View file

@ -33,7 +33,7 @@ void bhv_bowser_bomb_loop(void) {
struct SyncObject* so = sync_object_init(o, SYNC_DISTANCE_ONLY_EVENTS);
if (so) {
so->syncDeathEvent = FALSE;
sync_object_init_field(o, &networkBowserBombHit);
sync_object_init_field(o, networkBowserBombHit);
}
}

View file

@ -132,9 +132,9 @@ void bhv_lll_bowser_puzzle_loop(void) {
if (!sync_object_is_initialized(o->oSyncID)) {
struct SyncObject *so = sync_object_init(o, SYNC_DISTANCE_ONLY_EVENTS);
if (so) {
sync_object_init_field(o, &o->oAction);
sync_object_init_field(o, &o->oPrevAction);
sync_object_init_field(o, &o->oBowserPuzzleCompletionFlags);
sync_object_init_field(o, o->oAction);
sync_object_init_field(o, o->oPrevAction);
sync_object_init_field(o, o->oBowserPuzzleCompletionFlags);
}
}

View file

@ -21,10 +21,10 @@ void bhv_breakable_box_small_init(void) {
o->oAnimState = 1;
o->activeFlags |= ACTIVE_FLAG_UNK9;
sync_object_init(o, 1000.0f);
sync_object_init_field(o, &o->oBreakableBoxSmallReleased);
sync_object_init_field(o, &o->oBreakableBoxSmallFramesSinceReleased);
sync_object_init_field(o, &o->oAnimState);
sync_object_init_field(o, &o->oFlags);
sync_object_init_field(o, o->oBreakableBoxSmallReleased);
sync_object_init_field(o, o->oBreakableBoxSmallFramesSinceReleased);
sync_object_init_field(o, o->oAnimState);
sync_object_init_field(o, o->oFlags);
}
void small_breakable_box_spawn_dust(void) {

View file

@ -3,7 +3,7 @@
void bhv_wf_breakable_wall_loop(void) {
if (!sync_object_is_initialized(o->oSyncID)) {
sync_object_init(o, SYNC_DISTANCE_ONLY_EVENTS);
sync_object_init_field(o, &o->oBreakableWallForce);
sync_object_init_field(o, o->oBreakableWallForce);
}
if (o->oBreakableWallForce || gMarioStates[0].action == ACT_SHOT_FROM_CANNON) {

View file

@ -121,11 +121,11 @@ void bhv_bub_loop(void) {
if (!sync_object_is_initialized(o->oSyncID)) {
struct SyncObject *so = sync_object_init(o, 4000.0f);
if (so) {
sync_object_init_field(o, &o->oCheepCheepUnkF4);
sync_object_init_field(o, &o->oCheepCheepUnkF8);
sync_object_init_field(o, &o->oCheepCheepUnkFC);
sync_object_init_field(o, &o->oCheepCheepUnk104);
sync_object_init_field(o, &o->oCheepCheepUnk108);
sync_object_init_field(o, o->oCheepCheepUnkF4);
sync_object_init_field(o, o->oCheepCheepUnkF8);
sync_object_init_field(o, o->oCheepCheepUnkFC);
sync_object_init_field(o, o->oCheepCheepUnk104);
sync_object_init_field(o, o->oCheepCheepUnk108);
}
}

View file

@ -111,17 +111,17 @@ void bubba_act_1(void) {
void bhv_bubba_loop(void) {
if (!sync_object_is_initialized(o->oSyncID)) {
sync_object_init(o, 4000.0f);
sync_object_init_field(o, &o->oBubbaUnkF4);
sync_object_init_field(o, &o->oBubbaUnkF8);
sync_object_init_field(o, &o->oBubbaUnkFC);
sync_object_init_field(o, &o->oBubbaUnk100);
sync_object_init_field(o, &o->oBubbaUnk104);
sync_object_init_field(o, &o->oBubbaUnk108);
sync_object_init_field(o, &o->oBubbaUnk10C);
sync_object_init_field(o, &o->oBubbaUnk1AC);
sync_object_init_field(o, &o->oBubbaUnk1B0);
sync_object_init_field(o, &o->oAnimState);
sync_object_init_field(o, &o->oMoveAnglePitch);
sync_object_init_field(o, o->oBubbaUnkF4);
sync_object_init_field(o, o->oBubbaUnkF8);
sync_object_init_field(o, o->oBubbaUnkFC);
sync_object_init_field(o, o->oBubbaUnk100);
sync_object_init_field(o, o->oBubbaUnk104);
sync_object_init_field(o, o->oBubbaUnk108);
sync_object_init_field(o, o->oBubbaUnk10C);
sync_object_init_field(o, o->oBubbaUnk1AC);
sync_object_init_field(o, o->oBubbaUnk1B0);
sync_object_init_field(o, o->oAnimState);
sync_object_init_field(o, o->oMoveAnglePitch);
}
struct MarioState* marioState = nearest_mario_state_to_object(o);

View file

@ -9,9 +9,9 @@ void bhv_bullet_bill_init(void) {
o->oBulletBillInitialMoveYaw = o->oMoveAngleYaw;
if (!sync_object_is_initialized(o->oSyncID)) {
sync_object_init(o, 4000.0f);
sync_object_init_field(o, &o->oFaceAnglePitch);
sync_object_init_field(o, &o->oFaceAngleRoll);
sync_object_init_field(o, &o->oForwardVel);
sync_object_init_field(o, o->oFaceAnglePitch);
sync_object_init_field(o, o->oFaceAngleRoll);
sync_object_init_field(o, o->oForwardVel);
}
}

View file

@ -40,14 +40,14 @@ static void bhv_bully_override_ownership(u8* shouldOverride, u8* shouldOwn) {
static void bhv_bully_network_init(void) {
struct SyncObject* so = sync_object_init(o, 4000.0f);
if (so) {
sync_object_init_field(o, &o->oFlags);
sync_object_init_field(o, &o->oBullyKBTimerAndMinionKOCounter);
sync_object_init_field(o, &o->oForwardVel);
sync_object_init_field(o, &o->oBullyPrevX);
sync_object_init_field(o, &o->oBullyPrevY);
sync_object_init_field(o, &o->oBullyPrevZ);
sync_object_init_field(o, &o->oBullyMarioCollisionAngle);
sync_object_init_field(o, &o->oBullyLastNetworkPlayerIndex);
sync_object_init_field(o, o->oFlags);
sync_object_init_field(o, o->oBullyKBTimerAndMinionKOCounter);
sync_object_init_field(o, o->oForwardVel);
sync_object_init_field(o, o->oBullyPrevX);
sync_object_init_field(o, o->oBullyPrevY);
sync_object_init_field(o, o->oBullyPrevZ);
sync_object_init_field(o, o->oBullyMarioCollisionAngle);
sync_object_init_field(o, o->oBullyLastNetworkPlayerIndex);
so->syncDeathEvent = FALSE;
so->ignore_if_true = bhv_bully_ignore_if_true;
so->override_ownership = bhv_bully_override_ownership;

View file

@ -45,15 +45,15 @@ void bhv_camera_lakitu_init(void) {
so->ignore_if_true = bhv_camera_lakitu_ignore_if_true;
so->override_ownership = bhv_camera_lakitu_override_ownership;
so->on_received_post = bhv_camera_lakitu_on_received_post;
sync_object_init_field(o, &o->oAngleVelPitch);
sync_object_init_field(o, &o->oFaceAnglePitch);
sync_object_init_field(o, &o->oCameraLakituBlinkTimer);
sync_object_init_field(o, &o->oCameraLakituSpeed);
sync_object_init_field(o, &o->oCameraLakituCircleRadius);
sync_object_init_field(o, &o->oCameraLakituFinishedDialog);
sync_object_init_field(o, &o->oCameraLakituPitchVel);
sync_object_init_field(o, o->oAngleVelPitch);
sync_object_init_field(o, o->oFaceAnglePitch);
sync_object_init_field(o, o->oCameraLakituBlinkTimer);
sync_object_init_field(o, o->oCameraLakituSpeed);
sync_object_init_field(o, o->oCameraLakituCircleRadius);
sync_object_init_field(o, o->oCameraLakituFinishedDialog);
sync_object_init_field(o, o->oCameraLakituPitchVel);
#ifndef VERSION_JP
sync_object_init_field(o, &o->oCameraLakituUnk104);
sync_object_init_field(o, o->oCameraLakituUnk104);
#endif
}
}

View file

@ -218,16 +218,16 @@ void bhv_cannon_base_loop(void) {
if (so) {
so->on_received_post = cannon_on_received_post;
so->override_ownership = bhv_cannon_override_ownership;
sync_object_init_field(o, &o->oAction);
sync_object_init_field(o, &o->oPrevAction);
sync_object_init_field(o, &o->oTimer);
sync_object_init_field(o, &o->oPosX);
sync_object_init_field(o, &o->oPosY);
sync_object_init_field(o, &o->oPosZ);
sync_object_init_field(o, &o->oCannonUnk10C);
sync_object_init_field(o, &o->oCannonUnk10C);
sync_object_init_field(o, &o->oCannonUnkF8);
sync_object_init_field(o, &o->oCannonUnkF4);
sync_object_init_field(o, o->oAction);
sync_object_init_field(o, o->oPrevAction);
sync_object_init_field(o, o->oTimer);
sync_object_init_field(o, o->oPosX);
sync_object_init_field(o, o->oPosY);
sync_object_init_field(o, o->oPosZ);
sync_object_init_field(o, o->oCannonUnk10C);
sync_object_init_field(o, o->oCannonUnk10C);
sync_object_init_field(o, o->oCannonUnkF8);
sync_object_init_field(o, o->oCannonUnkF4);
}
}

View file

@ -62,7 +62,7 @@ void (*sCapSwitchActions[])(void) = { cap_switch_act_0, cap_switch_act_1,
void bhv_cap_switch_loop(void) {
if (!sync_object_is_initialized(o->oSyncID)) {
sync_object_init(o, SYNC_DISTANCE_ONLY_EVENTS);
sync_object_init_field(o, &capSwitchForcePress);
sync_object_init_field(o, capSwitchForcePress);
}
CUR_OBJ_CALL_ACTION_FUNCTION(sCapSwitchActions);

View file

@ -482,8 +482,8 @@ void bhv_chain_chomp_update(void) {
struct SyncObject* so = sync_object_init(o, 1000.0f);
if (so) {
so->syncDeathEvent = FALSE;
sync_object_init_field(o, &o->oChainChompUnk104);
sync_object_init_field_with_size(o, &o->header.gfx.animInfo.animFrame, 16);
sync_object_init_field(o, o->oChainChompUnk104);
sync_object_init_field(o, o->header.gfx.animInfo.animFrame);
}
}
@ -506,12 +506,12 @@ void bhv_chain_chomp_update(void) {
void bhv_wooden_post_update(void) {
if (!sync_object_is_initialized(o->oSyncID)) {
sync_object_init(o, SYNC_DISTANCE_ONLY_EVENTS);
sync_object_init_field(o, &o->oBehParams);
sync_object_init_field(o, &o->oWoodenPostMarioPounding);
sync_object_init_field(o, &o->oWoodenPostOffsetY);
sync_object_init_field(o, &o->oWoodenPostSpeedY);
sync_object_init_field(o, &o->oWoodenPostTotalMarioAngle);
sync_object_init_field(o, &o->oTimer);
sync_object_init_field(o, o->oBehParams);
sync_object_init_field(o, o->oWoodenPostMarioPounding);
sync_object_init_field(o, o->oWoodenPostOffsetY);
sync_object_init_field(o, o->oWoodenPostSpeedY);
sync_object_init_field(o, o->oWoodenPostTotalMarioAngle);
sync_object_init_field(o, o->oTimer);
}
// When ground pounded by mario, drop by -45 + -20

View file

@ -227,11 +227,11 @@ void bhv_chuckya_loop(void) {
if (so != NULL) {
so->override_ownership = bhv_chuckya_override_ownership;
so->ignore_if_true = bhv_chuckya_ignore_if_true;
sync_object_init_field(o, &o->oChuckyaUnk88);
sync_object_init_field(o, &o->oChuckyaUnkF8);
sync_object_init_field(o, &o->oChuckyaUnkFC);
sync_object_init_field(o, &o->oChuckyaUnk100);
sync_object_init_field(o, &o->oFaceAnglePitch);
sync_object_init_field(o, o->oChuckyaUnk88);
sync_object_init_field(o, o->oChuckyaUnkF8);
sync_object_init_field(o, o->oChuckyaUnkFC);
sync_object_init_field(o, o->oChuckyaUnk100);
sync_object_init_field(o, o->oFaceAnglePitch);
}
}

View file

@ -58,9 +58,9 @@ void clam_act_1(void) {
void bhv_clam_loop(void) {
if (!sync_object_is_initialized(o->oSyncID)) {
sync_object_init(o, SYNC_DISTANCE_ONLY_EVENTS);
sync_object_init_field(o, &o->oAction);
sync_object_init_field(o, &o->oTimer);
sync_object_init_field(o, &o->oClamUnkF4);
sync_object_init_field(o, o->oAction);
sync_object_init_field(o, o->oTimer);
sync_object_init_field(o, o->oClamUnkF4);
}
o->header.gfx.scale[1] = 1.5f;

View file

@ -58,12 +58,12 @@ static void cloud_act_fwoosh_hidden(void) {
static void cloud_fwoosh_update(void) {
if (!sync_object_is_initialized(o->oSyncID)) {
sync_object_init(o, 4000.0f);
sync_object_init_field(o, &o->header.gfx.scale[0]);
sync_object_init_field(o, &o->oCloudCenterX);
sync_object_init_field(o, &o->oCloudCenterY);
sync_object_init_field(o, &o->oCloudBlowing);
sync_object_init_field(o, &o->oCloudGrowSpeed);
sync_object_init_field(o, &o->oCloudFwooshMovementRadius);
sync_object_init_field(o, o->header.gfx.scale[0]);
sync_object_init_field(o, o->oCloudCenterX);
sync_object_init_field(o, o->oCloudCenterY);
sync_object_init_field(o, o->oCloudBlowing);
sync_object_init_field(o, o->oCloudGrowSpeed);
sync_object_init_field(o, o->oCloudFwooshMovementRadius);
}
struct Object* player = nearest_player_to_object(o);

View file

@ -85,30 +85,30 @@ void bhv_controllable_platform_init(void) {
struct SyncObject* so = sync_object_init(o, SYNC_DISTANCE_ONLY_EVENTS);
if (so != NULL) {
so->on_received_post = bhv_controllable_platform_on_received_post;
sync_object_init_field(o, &o->oPosX);
sync_object_init_field(o, &o->oPosY);
sync_object_init_field(o, &o->oPosZ);
sync_object_init_field(o, &o->oVelX);
sync_object_init_field(o, &o->oVelY);
sync_object_init_field(o, &o->oVelZ);
sync_object_init_field(o, &o->oAction);
sync_object_init_field(o, &o->oPrevAction);
sync_object_init_field(o, &o->oTimer);
sync_object_init_field_with_size(o, &o->activeFlags, 16);
sync_object_init_field_with_size(o, &D_80331694, 8);
sync_object_init_field_with_size(o, &o->header.gfx.node.flags, 16);
sync_object_init_field(o, o->oPosX);
sync_object_init_field(o, o->oPosY);
sync_object_init_field(o, o->oPosZ);
sync_object_init_field(o, o->oVelX);
sync_object_init_field(o, o->oVelY);
sync_object_init_field(o, o->oVelZ);
sync_object_init_field(o, o->oAction);
sync_object_init_field(o, o->oPrevAction);
sync_object_init_field(o, o->oTimer);
sync_object_init_field(o, o->activeFlags);
sync_object_init_field(o, D_80331694);
sync_object_init_field(o, o->header.gfx.node.flags);
sync_object_init_field(o, &o->oControllablePlatformUnkF8);
sync_object_init_field(o, &o->oControllablePlatformUnkFC);
sync_object_init_field(o, &o->oControllablePlatformUnk100);
sync_object_init_field(o, &o->oFaceAnglePitch);
sync_object_init_field(o, &o->oFaceAngleRoll);
sync_object_init_field(o, o->oControllablePlatformUnkF8);
sync_object_init_field(o, o->oControllablePlatformUnkFC);
sync_object_init_field(o, o->oControllablePlatformUnk100);
sync_object_init_field(o, o->oFaceAnglePitch);
sync_object_init_field(o, o->oFaceAngleRoll);
for (s32 i = 0; i < 4; i++) {
if (controllablePlatformSubs[i] == NULL) { continue; }
sync_object_init_field(o, &controllablePlatformSubs[i]->oAction);
sync_object_init_field(o, &controllablePlatformSubs[i]->oPrevAction);
sync_object_init_field(o, &controllablePlatformSubs[i]->oTimer);
sync_object_init_field(o, &controllablePlatformSubs[i]->oParentRelativePosY);
sync_object_init_field(o, controllablePlatformSubs[i]->oAction);
sync_object_init_field(o, controllablePlatformSubs[i]->oPrevAction);
sync_object_init_field(o, controllablePlatformSubs[i]->oTimer);
sync_object_init_field(o, controllablePlatformSubs[i]->oParentRelativePosY);
}
}
}

View file

@ -31,8 +31,8 @@ void bhv_donut_platform_spawner_update(void) {
void bhv_donut_platform_update(void) {
if (!sync_object_is_initialized(o->oSyncID)) {
sync_object_init(o, 4000.0f);
sync_object_init_field(o, &o->oGravity);
sync_object_init_field(o, &o->oIntangibleTimer);
sync_object_init_field(o, o->oGravity);
sync_object_init_field(o, o->oIntangibleTimer);
}
struct Object* player = nearest_player_to_object(o);

View file

@ -167,12 +167,12 @@ void bhv_dorrie_update(void) {
struct SyncObject* so = sync_object_init(o, 4000.0f);
if (so) {
so->ignore_if_true = bhv_dorrie_ignore_if_true;
sync_object_init_field(o, &o->oDorrieOffsetY);
sync_object_init_field(o, &o->oDorrieVelY);
sync_object_init_field(o, &o->oDorrieYawVel);
sync_object_init_field(o, &o->oDorrieLiftingMario);
sync_object_init_field(o, &o->oDorrieNeckAngle);
sync_object_init_field(o, &o->oAngleVelYaw);
sync_object_init_field(o, o->oDorrieOffsetY);
sync_object_init_field(o, o->oDorrieVelY);
sync_object_init_field(o, o->oDorrieYawVel);
sync_object_init_field(o, o->oDorrieLiftingMario);
sync_object_init_field(o, o->oDorrieNeckAngle);
sync_object_init_field(o, o->oAngleVelYaw);
}
}

View file

@ -21,10 +21,10 @@ void bhv_lll_drawbridge_spawner_init(void) {
sync_object_init(o, 3000.0f);
for (s32 i = 0; i < 2; i++) {
if (drawbridge[i] == NULL) { continue; }
sync_object_init_field(o, &drawbridge[i]->oFaceAngleRoll);
sync_object_init_field(o, &drawbridge[i]->oAction);
sync_object_init_field(o, &drawbridge[i]->oPrevAction);
sync_object_init_field(o, &drawbridge[i]->oTimer);
sync_object_init_field(o, drawbridge[i]->oFaceAngleRoll);
sync_object_init_field(o, drawbridge[i]->oAction);
sync_object_init_field(o, drawbridge[i]->oPrevAction);
sync_object_init_field(o, drawbridge[i]->oTimer);
}
}

View file

@ -136,9 +136,9 @@ void bhv_elevator_init(void) {
}
sync_object_init(o, SYNC_DISTANCE_ONLY_EVENTS);
sync_object_init_field(o, &o->oAction);
sync_object_init_field(o, &o->oPosY);
sync_object_init_field(o, &o->oVelY);
sync_object_init_field(o, o->oAction);
sync_object_init_field(o, o->oPosY);
sync_object_init_field(o, o->oVelY);
}
void (*sElevatorActions[])(void) = { elevator_act_0, elevator_act_1, elevator_act_2, elevator_act_3,

View file

@ -245,9 +245,9 @@ void bhv_enemy_lakitu_update(void) {
// PARTIAL_UPDATE
if (!sync_object_is_initialized(o->oSyncID)) {
sync_object_init(o, 4000.0f);
sync_object_init_field(o, &o->oEnemyLakituBlinkTimer);
sync_object_init_field(o, &o->oEnemyLakituSpinyCooldown);
sync_object_init_field(o, &o->oEnemyLakituFaceForwardCountdown);
sync_object_init_field(o, o->oEnemyLakituBlinkTimer);
sync_object_init_field(o, o->oEnemyLakituSpinyCooldown);
sync_object_init_field(o, o->oEnemyLakituFaceForwardCountdown);
}
treat_far_home_as_mario(2000.0f, NULL, NULL);

View file

@ -187,8 +187,8 @@ void bhv_exclamation_box_init(void) {
struct SyncObject* so = sync_object_init(o, SYNC_DISTANCE_ONLY_EVENTS);
if (so) {
so->syncDeathEvent = FALSE;
sync_object_init_field(o, &o->oExclamationBoxForce);
sync_object_init_field(o, &o->areaTimer);
sync_object_init_field(o, o->oExclamationBoxForce);
sync_object_init_field(o, o->areaTimer);
}
o->areaTimerType = AREA_TIMER_TYPE_MAXIMUM;

View file

@ -3,11 +3,11 @@
void bhv_wdw_express_elevator_loop(void) {
if (!sync_object_is_initialized(o->oSyncID)) {
sync_object_init(o, SYNC_DISTANCE_ONLY_EVENTS);
sync_object_init_field(o, &o->oAction);
sync_object_init_field(o, &o->oPrevAction);
sync_object_init_field(o, &o->oTimer);
sync_object_init_field(o, &o->oVelY);
sync_object_init_field(o, &o->oPosY);
sync_object_init_field(o, o->oAction);
sync_object_init_field(o, o->oPrevAction);
sync_object_init_field(o, o->oTimer);
sync_object_init_field(o, o->oVelY);
sync_object_init_field(o, o->oPosY);
}
o->oVelY = 0.0f;

View file

@ -79,34 +79,34 @@ void bhv_eyerok_boss_init(void) {
so->minUpdateRate = 1.0f;
so->maxUpdateRate = 1.0f;
so->syncDeathEvent = FALSE;
sync_object_init_field(o, &o->oEyerokBossNumHands);
sync_object_init_field(o, &o->oEyerokBossUnkFC);
sync_object_init_field(o, &o->oEyerokBossActiveHand);
sync_object_init_field(o, &o->oEyerokBossUnk104);
sync_object_init_field(o, &o->oEyerokBossUnk108);
sync_object_init_field(o, &o->oEyerokBossUnk10C);
sync_object_init_field(o, &o->oEyerokBossUnk110);
sync_object_init_field(o, &o->oEyerokBossUnk1AC);
sync_object_init_field(o, o->oEyerokBossNumHands);
sync_object_init_field(o, o->oEyerokBossUnkFC);
sync_object_init_field(o, o->oEyerokBossActiveHand);
sync_object_init_field(o, o->oEyerokBossUnk104);
sync_object_init_field(o, o->oEyerokBossUnk108);
sync_object_init_field(o, o->oEyerokBossUnk10C);
sync_object_init_field(o, o->oEyerokBossUnk110);
sync_object_init_field(o, o->oEyerokBossUnk1AC);
for (s32 i = 0; i < 2; i++) {
sync_object_init_field(o, &hands[i]->oPosX);
sync_object_init_field(o, &hands[i]->oPosY);
sync_object_init_field(o, &hands[i]->oPosZ);
sync_object_init_field(o, &hands[i]->oVelX);
sync_object_init_field(o, &hands[i]->oVelY);
sync_object_init_field(o, &hands[i]->oVelZ);
sync_object_init_field(o, &hands[i]->oForwardVel);
sync_object_init_field(o, &hands[i]->oAction);
sync_object_init_field(o, &hands[i]->oPrevAction);
sync_object_init_field(o, &hands[i]->oTimer);
sync_object_init_field(o, &hands[i]->oHealth);
sync_object_init_field(o, &hands[i]->oEyerokHandWakeUpTimer);
sync_object_init_field(o, &hands[i]->oEyerokReceivedAttack);
sync_object_init_field(o, &hands[i]->oEyerokHandUnkFC);
sync_object_init_field(o, &hands[i]->oEyerokHandUnk100);
sync_object_init_field(o, &hands[i]->oFaceAngleYaw);
sync_object_init_field(o, &hands[i]->oMoveAngleYaw);
sync_object_init_field(o, &hands[i]->oGravity);
sync_object_init_field(o, &hands[i]->oAnimState);
sync_object_init_field(o, hands[i]->oPosX);
sync_object_init_field(o, hands[i]->oPosY);
sync_object_init_field(o, hands[i]->oPosZ);
sync_object_init_field(o, hands[i]->oVelX);
sync_object_init_field(o, hands[i]->oVelY);
sync_object_init_field(o, hands[i]->oVelZ);
sync_object_init_field(o, hands[i]->oForwardVel);
sync_object_init_field(o, hands[i]->oAction);
sync_object_init_field(o, hands[i]->oPrevAction);
sync_object_init_field(o, hands[i]->oTimer);
sync_object_init_field(o, hands[i]->oHealth);
sync_object_init_field(o, hands[i]->oEyerokHandWakeUpTimer);
sync_object_init_field(o, hands[i]->oEyerokReceivedAttack);
sync_object_init_field(o, hands[i]->oEyerokHandUnkFC);
sync_object_init_field(o, hands[i]->oEyerokHandUnk100);
sync_object_init_field(o, hands[i]->oFaceAngleYaw);
sync_object_init_field(o, hands[i]->oMoveAngleYaw);
sync_object_init_field(o, hands[i]->oGravity);
sync_object_init_field(o, hands[i]->oAnimState);
}
}

View file

@ -5,8 +5,8 @@ void bhv_squishable_platform_loop(void) {
struct SyncObject* so = sync_object_init(o, 4000.0f);
if (so) {
so->minUpdateRate = 5.0f;
sync_object_init_field(o, &o->oPlatformTimer);
sync_object_init_field(o, &o->header.gfx.scale[1]);
sync_object_init_field(o, o->oPlatformTimer);
sync_object_init_field(o, o->header.gfx.scale[1]);
}
}
@ -23,7 +23,7 @@ void bhv_bitfs_sinking_platform_loop(void) {
struct SyncObject* so = sync_object_init(o, 4000.0f);
if (so) {
so->minUpdateRate = 5.0f;
sync_object_init_field(o, &o->oPlatformTimer);
sync_object_init_field(o, o->oPlatformTimer);
}
}
@ -43,7 +43,7 @@ void bhv_bitfs_sinking_cage_platform_loop(void) {
struct SyncObject* so = sync_object_init(o, 4000.0f);
if (so) {
so->minUpdateRate = 5.0f;
sync_object_init_field(o, &o->oPlatformTimer);
sync_object_init_field(o, o->oPlatformTimer);
}
}

View file

@ -52,7 +52,7 @@ void bhv_ferris_wheel_axle_init(void) {
if (so) {
so->hasStandardFields = FALSE;
so->maxUpdateRate = 5.0f;
sync_object_init_field(o, &o->oFaceAngleRoll);
sync_object_init_field(o, o->oFaceAngleRoll);
}
}
@ -61,9 +61,9 @@ void bhv_ferris_wheel_platform_init(void) {
if (so) {
so->hasStandardFields = FALSE;
so->maxUpdateRate = 5.0f;
sync_object_init_field(o, &o->oPosX);
sync_object_init_field(o, &o->oPosY);
sync_object_init_field(o, &o->oPosZ);
sync_object_init_field(o, o->oPosX);
sync_object_init_field(o, o->oPosY);
sync_object_init_field(o, o->oPosZ);
}
}

View file

@ -46,8 +46,8 @@ void bhv_fire_piranha_plant_init(void) {
sNumActiveFirePiranhaPlants = sNumKilledFirePiranhaPlants = 0;
sync_object_init(o, SYNC_DISTANCE_ONLY_EVENTS);
sync_object_init_field(o, &sNumActiveFirePiranhaPlants);
sync_object_init_field(o, &sNumKilledFirePiranhaPlants);
sync_object_init_field(o, sNumActiveFirePiranhaPlants);
sync_object_init_field(o, sNumKilledFirePiranhaPlants);
}
static void fire_piranha_plant_act_hide(void) {

View file

@ -49,13 +49,13 @@ void bhv_fire_spitter_update(void) {
struct SyncObject* so = sync_object_init(o, SYNC_DISTANCE_ONLY_EVENTS);
if (so) {
so->on_received_post = bhv_fire_spitter_on_received_post;
sync_object_init_field(o, &o->oAction);
sync_object_init_field(o, &o->oPrevAction);
sync_object_init_field(o, &o->oTimer);
sync_object_init_field(o, &o->oFireSpitterScaleVel);
sync_object_init_field(o, &o->header.gfx.scale[0]);
sync_object_init_field(o, &o->header.gfx.scale[1]);
sync_object_init_field(o, &o->header.gfx.scale[2]);
sync_object_init_field(o, o->oAction);
sync_object_init_field(o, o->oPrevAction);
sync_object_init_field(o, o->oTimer);
sync_object_init_field(o, o->oFireSpitterScaleVel);
sync_object_init_field(o, o->header.gfx.scale[0]);
sync_object_init_field(o, o->header.gfx.scale[1]);
sync_object_init_field(o, o->header.gfx.scale[2]);
}
}

View file

@ -36,9 +36,9 @@ void bhv_flamethrower_flame_loop(void) {
void bhv_flamethrower_loop(void) {
if (!sync_object_is_initialized(o->oSyncID)) {
sync_object_init(o, SYNC_DISTANCE_ONLY_EVENTS);
sync_object_init_field(o, &o->oAction);
sync_object_init_field(o, &o->oTimer);
sync_object_init_field(o, &o->oFlameThowerUnk110);
sync_object_init_field(o, o->oAction);
sync_object_init_field(o, o->oTimer);
sync_object_init_field(o, o->oFlameThowerUnk110);
}
struct MarioState* marioState = nearest_mario_state_to_object(o);
struct Object* player = marioState ? marioState->marioObj : NULL;

View file

@ -207,11 +207,11 @@ void bhv_fly_guy_update(void) {
if (!sync_object_is_initialized(o->oSyncID)) {
sync_object_init(o, 4000.0f);
sync_object_init_field(o, &o->oFlyGuyOscTimer);
sync_object_init_field(o, &o->oFlyGuyLungeYDecel);
sync_object_init_field(o, &o->oFlyGuyLungeTargetPitch);
sync_object_init_field(o, &o->oFlyGuyTargetRoll);
sync_object_init_field(o, &o->oFlyGuyLungeTargetPitch);
sync_object_init_field(o, o->oFlyGuyOscTimer);
sync_object_init_field(o, o->oFlyGuyLungeYDecel);
sync_object_init_field(o, o->oFlyGuyLungeTargetPitch);
sync_object_init_field(o, o->oFlyGuyTargetRoll);
sync_object_init_field(o, o->oFlyGuyLungeTargetPitch);
}
if (!(o->activeFlags & ACTIVE_FLAG_IN_DIFFERENT_ROOM)) {

View file

@ -279,13 +279,13 @@ void bhv_haunted_bookshelf_manager_loop(void) {
so->syncDeathEvent = FALSE;
so->override_ownership = bhv_haunted_bookshelf_manager_override_ownership;
so->ignore_if_true = bhv_haunted_bookshelf_manager_ignore_if_true;
sync_object_init_field_with_size(o, &o->activeFlags, 16);
sync_object_init_field(o, &o->oAction);
sync_object_init_field(o, &o->oBookSwitchManagerUnkF8);
sync_object_init_field(o, &o->oBookSwitchManagerUnkF4);
sync_object_init_field(o, &o->oTimer);
sync_object_init_field(o, &o->oPosX);
sync_object_init_field(o, &o->oForwardVel);
sync_object_init_field(o, o->activeFlags);
sync_object_init_field(o, o->oAction);
sync_object_init_field(o, o->oBookSwitchManagerUnkF8);
sync_object_init_field(o, o->oBookSwitchManagerUnkF4);
sync_object_init_field(o, o->oTimer);
sync_object_init_field(o, o->oPosX);
sync_object_init_field(o, o->oForwardVel);
}
}
@ -315,12 +315,12 @@ void bhv_book_switch_loop(void) {
so->override_ownership = bhv_haunted_bookshelf_manager_override_ownership;
so->ignore_if_true = bhv_haunted_bookshelf_manager_ignore_if_true;
sync_object_init_field(o, &o->oAction);
sync_object_init_field(o, &o->oBookSwitchUnkF4);
sync_object_init_field(o, &o->oIntangibleTimer);
sync_object_init_field(o, &o->oPosX);
sync_object_init_field(o, &o->oPosZ);
sync_object_init_field(o, &o->oTimer);
sync_object_init_field(o, o->oAction);
sync_object_init_field(o, o->oBookSwitchUnkF4);
sync_object_init_field(o, o->oIntangibleTimer);
sync_object_init_field(o, o->oPosX);
sync_object_init_field(o, o->oPosZ);
sync_object_init_field(o, o->oTimer);
}
}

View file

@ -117,8 +117,8 @@ void bhv_goomba_init(void) {
o->oGravity = -8.0f / 3.0f * o->oGoombaScale;
sync_object_init(o, 4000.0f);
sync_object_init_field(o, &o->oGoombaTargetYaw);
sync_object_init_field(o, &o->oGoombaWalkTimer);
sync_object_init_field(o, o->oGoombaTargetYaw);
sync_object_init_field(o, o->oGoombaWalkTimer);
}
/**

View file

@ -26,27 +26,27 @@ void bhv_grand_star_init(void) {
if (!sync_object_is_initialized(o->oSyncID)) {
struct SyncObject *so = sync_object_init(o, 4000.0f);
if (so) {
sync_object_init_field(o, &o->header.gfx.scale[0]);
sync_object_init_field(o, &o->header.gfx.scale[1]);
sync_object_init_field(o, &o->header.gfx.scale[2]);
sync_object_init_field(o, &o->oPrevAction);
sync_object_init_field(o, &o->oAction);
sync_object_init_field(o, &o->oSubAction);
sync_object_init_field(o, &o->oInteractStatus);
sync_object_init_field(o, &o->oTimer);
sync_object_init_field(o, &o->oHomeX);
sync_object_init_field(o, &o->oHomeY);
sync_object_init_field(o, &o->oHomeZ);
sync_object_init_field(o, &o->oPosX);
sync_object_init_field(o, &o->oPosY);
sync_object_init_field(o, &o->oPosZ);
sync_object_init_field(o, &o->oGravity);
sync_object_init_field(o, &o->oVelY);
sync_object_init_field(o, &o->oForwardVel);
sync_object_init_field(o, &o->oAngleVelYaw);
sync_object_init_field(o, &o->oMoveAngleYaw);
sync_object_init_field(o, &o->oFaceAngleYaw);
sync_object_init_field(o, &o->oGraphYOffset);
sync_object_init_field(o, o->header.gfx.scale[0]);
sync_object_init_field(o, o->header.gfx.scale[1]);
sync_object_init_field(o, o->header.gfx.scale[2]);
sync_object_init_field(o, o->oPrevAction);
sync_object_init_field(o, o->oAction);
sync_object_init_field(o, o->oSubAction);
sync_object_init_field(o, o->oInteractStatus);
sync_object_init_field(o, o->oTimer);
sync_object_init_field(o, o->oHomeX);
sync_object_init_field(o, o->oHomeY);
sync_object_init_field(o, o->oHomeZ);
sync_object_init_field(o, o->oPosX);
sync_object_init_field(o, o->oPosY);
sync_object_init_field(o, o->oPosZ);
sync_object_init_field(o, o->oGravity);
sync_object_init_field(o, o->oVelY);
sync_object_init_field(o, o->oForwardVel);
sync_object_init_field(o, o->oAngleVelYaw);
sync_object_init_field(o, o->oMoveAngleYaw);
sync_object_init_field(o, o->oFaceAngleYaw);
sync_object_init_field(o, o->oGraphYOffset);
}
}
return;

View file

@ -24,15 +24,15 @@ void bhv_haunted_chair_init(void) {
}
sync_object_init(o, 4000.0f);
sync_object_init_field(o, &o->oFaceAnglePitch);
sync_object_init_field(o, &o->oFaceAngleRoll);
sync_object_init_field(o, &o->oFaceAngleYaw);
sync_object_init_field(o, &o->oHauntedChairUnk104);
sync_object_init_field(o, &o->oHauntedChairUnkF4);
sync_object_init_field(o, &o->oHauntedChairUnkF8);
sync_object_init_field(o, &o->oHauntedChairUnkFC);
sync_object_init_field(o, &o->oMoveAnglePitch);
sync_object_init_field(o, &o->oMoveAngleYaw);
sync_object_init_field(o, o->oFaceAnglePitch);
sync_object_init_field(o, o->oFaceAngleRoll);
sync_object_init_field(o, o->oFaceAngleYaw);
sync_object_init_field(o, o->oHauntedChairUnk104);
sync_object_init_field(o, o->oHauntedChairUnkF4);
sync_object_init_field(o, o->oHauntedChairUnkF8);
sync_object_init_field(o, o->oHauntedChairUnkFC);
sync_object_init_field(o, o->oMoveAnglePitch);
sync_object_init_field(o, o->oMoveAngleYaw);
}
void haunted_chair_act_0(void) {

View file

@ -136,11 +136,11 @@ void bhv_heave_ho_loop(void) {
if (so != NULL) {
so->override_ownership = bhv_heave_ho_override_ownership;
so->ignore_if_true = bhv_heave_ho_ignore_if_true;
sync_object_init_field(o, &o->oHeaveHoUnk88);
sync_object_init_field(o, &o->oHeaveHoUnkF4);
sync_object_init_field(o, &o->oInteractStatus);
sync_object_init_field(o, &o->oGraphYOffset);
sync_object_init_field(o, &o->oFaceAngleYaw);
sync_object_init_field(o, o->oHeaveHoUnk88);
sync_object_init_field(o, o->oHeaveHoUnkF4);
sync_object_init_field(o, o->oInteractStatus);
sync_object_init_field(o, o->oGraphYOffset);
sync_object_init_field(o, o->oFaceAngleYaw);
}
}

View file

@ -23,12 +23,12 @@ void bhv_hidden_star_init(void) {
if (!sync_object_is_initialized(o->oSyncID)) {
struct SyncObject *so = sync_object_init(o, SYNC_DISTANCE_ONLY_EVENTS);
if (so) {
sync_object_init_field(o, &o->oAction);
sync_object_init_field(o, &o->oHiddenStarTriggerCounter);
sync_object_init_field(o, &o->oPosX);
sync_object_init_field(o, &o->oPosY);
sync_object_init_field(o, &o->oPosZ);
sync_object_init_field(o, &o->oTimer);
sync_object_init_field(o, o->oAction);
sync_object_init_field(o, o->oHiddenStarTriggerCounter);
sync_object_init_field(o, o->oPosX);
sync_object_init_field(o, o->oPosY);
sync_object_init_field(o, o->oPosZ);
sync_object_init_field(o, o->oTimer);
}
}
}

View file

@ -20,9 +20,9 @@ void bhv_hoot_init(void) {
struct SyncObject* so = sync_object_init(o, 4000.0f);
if (so) {
so->ignore_if_true = bhv_hoot_ignore_if_true;
sync_object_init_field(o, &o->oHootAvailability);
sync_object_init_field(o, &o->oMoveAnglePitch);
sync_object_init_field_with_size(o, &o->header.gfx.animInfo.animFrame, 16);
sync_object_init_field(o, o->oHootAvailability);
sync_object_init_field(o, o->oMoveAnglePitch);
sync_object_init_field(o, o->header.gfx.animInfo.animFrame);
}
}

View file

@ -3,12 +3,12 @@ void bhv_horizontal_grindel_init(void) {
o->oHorizontalGrindelTargetYaw = o->oMoveAngleYaw;
sync_object_init(o, 4000.0f);
sync_object_init_field(o, &o->oHorizontalGrindelOnGround);
sync_object_init_field(o, &o->oHorizontalGrindelTargetYaw);
sync_object_init_field(o, &o->oHorizontalGrindelDistToHome);
sync_object_init_field(o, &o->oMoveFlags);
sync_object_init_field(o, &o->oForwardVel);
sync_object_init_field(o, &o->oGravity);
sync_object_init_field(o, o->oHorizontalGrindelOnGround);
sync_object_init_field(o, o->oHorizontalGrindelTargetYaw);
sync_object_init_field(o, o->oHorizontalGrindelDistToHome);
sync_object_init_field(o, o->oMoveFlags);
sync_object_init_field(o, o->oForwardVel);
sync_object_init_field(o, o->oGravity);
}
void bhv_horizontal_grindel_update(void) {

View file

@ -25,9 +25,9 @@ void bhv_ship_part_3_loop(void) {
struct SyncObject* so = sync_object_init(o, 4000.0f);
if (so) {
so->maxUpdateRate = 5.0f;
sync_object_init_field(o, &o->oFaceAnglePitch);
sync_object_init_field(o, &o->oFaceAngleRoll);
sync_object_init_field(o, &o->oShipPart3UnkF4);
sync_object_init_field(o, o->oFaceAnglePitch);
sync_object_init_field(o, o->oFaceAngleRoll);
sync_object_init_field(o, o->oShipPart3UnkF4);
}
}
@ -49,13 +49,13 @@ void bhv_jrb_sliding_box_loop(void) {
struct SyncObject* so = sync_object_init(o, 4000.0f);
if (so) {
so->maxUpdateRate = 5.0f;
sync_object_init_field(o, &o->oFaceAnglePitch);
sync_object_init_field(o, &o->oFaceAngleRoll);
sync_object_init_field(o, &o->oJrbSlidingBoxUnkF8);
sync_object_init_field(o, &o->oJrbSlidingBoxUnkFC);
sync_object_init_field(o, &o->oParentRelativePosX);
sync_object_init_field(o, &o->oParentRelativePosY);
sync_object_init_field(o, &o->oParentRelativePosZ);
sync_object_init_field(o, o->oFaceAnglePitch);
sync_object_init_field(o, o->oFaceAngleRoll);
sync_object_init_field(o, o->oJrbSlidingBoxUnkF8);
sync_object_init_field(o, o->oJrbSlidingBoxUnkFC);
sync_object_init_field(o, o->oParentRelativePosX);
sync_object_init_field(o, o->oParentRelativePosY);
sync_object_init_field(o, o->oParentRelativePosZ);
}
}

View file

@ -47,7 +47,7 @@ void jumping_box_free_update(void) {
void bhv_jumping_box_loop(void) {
if (!sync_object_is_initialized(o->oSyncID)) {
sync_object_init(o, 500.0f);
sync_object_init_field(o, &o->oJumpingBoxUnkF4);
sync_object_init_field(o, o->oJumpingBoxUnkF4);
}
switch (o->oHeldState) {

View file

@ -29,14 +29,14 @@ void bhv_kickable_board_loop(void) {
struct MarioState* marioState = nearest_mario_state_to_object(o);
if (!sync_object_is_initialized(o->oSyncID)) {
sync_object_init(o, SYNC_DISTANCE_ONLY_EVENTS);
sync_object_init_field(o, &o->oAction);
sync_object_init_field(o, &o->oAngleVelPitch);
sync_object_init_field(o, &o->oFaceAnglePitch);
sync_object_init_field(o, &o->oKickableBoardF4);
sync_object_init_field(o, &o->oKickableBoardF8);
sync_object_init_field(o, &o->oMoveAngleYaw);
sync_object_init_field(o, &o->oPosY);
sync_object_init_field(o, &o->oTimer);
sync_object_init_field(o, o->oAction);
sync_object_init_field(o, o->oAngleVelPitch);
sync_object_init_field(o, o->oFaceAnglePitch);
sync_object_init_field(o, o->oKickableBoardF4);
sync_object_init_field(o, o->oKickableBoardF8);
sync_object_init_field(o, o->oMoveAngleYaw);
sync_object_init_field(o, o->oPosY);
sync_object_init_field(o, o->oTimer);
}
s32 sp24;
switch (o->oAction) {

View file

@ -391,10 +391,10 @@ void bhv_king_bobomb_loop(void) {
if (so) {
so->override_ownership = bhv_king_bobomb_override_ownership;
so->ignore_if_true = bhv_king_bobomb_ignore_if_true;
sync_object_init_field(o, &o->oKingBobombUnk88);
sync_object_init_field(o, &o->oFlags);
sync_object_init_field(o, &o->oHealth);
sync_object_init_field(o, &o->oInteractStatus);
sync_object_init_field(o, o->oKingBobombUnk88);
sync_object_init_field(o, o->oFlags);
sync_object_init_field(o, o->oHealth);
sync_object_init_field(o, o->oInteractStatus);
}
}

View file

@ -108,22 +108,22 @@ void bhv_klepto_init(void) {
if (so) {
so->on_received_pre = bhv_klepto_on_received_pre;
so->on_received_post = bhv_klepto_on_received_post;
sync_object_init_field(o, &o->oAnimState);
sync_object_init_field(o, &o->oFlags);
sync_object_init_field(o, &o->oKleptoDistanceToTarget);
sync_object_init_field(o, &o->oKleptoUnkF8);
sync_object_init_field(o, &o->oKleptoUnkFC);
sync_object_init_field(o, &o->oKleptoSpeed);
sync_object_init_field(o, &o->oKleptoTimeUntilTargetChange);
sync_object_init_field(o, &o->oKleptoTargetNumber);
sync_object_init_field(o, &o->oKleptoUnk1B0);
sync_object_init_field(o, &o->oSoundStateID);
sync_object_init_field(o, &o->oHomeX);
sync_object_init_field(o, &o->oHomeY);
sync_object_init_field(o, &o->oHomeZ);
sync_object_init_field(o, &o->oMoveAnglePitch);
sync_object_init_field(o, &o->oGravity);
sync_object_init_field_with_size(o, &o->globalPlayerIndex, 8);
sync_object_init_field(o, o->oAnimState);
sync_object_init_field(o, o->oFlags);
sync_object_init_field(o, o->oKleptoDistanceToTarget);
sync_object_init_field(o, o->oKleptoUnkF8);
sync_object_init_field(o, o->oKleptoUnkFC);
sync_object_init_field(o, o->oKleptoSpeed);
sync_object_init_field(o, o->oKleptoTimeUntilTargetChange);
sync_object_init_field(o, o->oKleptoTargetNumber);
sync_object_init_field(o, o->oKleptoUnk1B0);
sync_object_init_field(o, o->oSoundStateID);
sync_object_init_field(o, o->oHomeX);
sync_object_init_field(o, o->oHomeY);
sync_object_init_field(o, o->oHomeZ);
sync_object_init_field(o, o->oMoveAnglePitch);
sync_object_init_field(o, o->oGravity);
sync_object_init_field(o, o->globalPlayerIndex);
}
}

View file

@ -126,28 +126,28 @@ void bhv_koopa_init(void) {
so->on_received_post = bhv_koopa_the_quick_on_received_post;
so->on_sent_pre = bhv_koopa_the_quick_on_sent_pre;
so->override_ownership = bhv_koopa_the_quick_override_ownership;
sync_object_init_field(o, &koopaPathedStartWaypoint);
sync_object_init_field(o, &koopaPathedPrevWaypoint);
sync_object_init_field(o, &koopaShotFromCannon);
sync_object_init_field(o, &o->oPathedPrevWaypointFlags);
sync_object_init_field(o, &o->oPathedTargetPitch);
sync_object_init_field(o, &o->oPathedTargetYaw);
sync_object_init_field(o, &o->oPosX);
sync_object_init_field(o, &o->oPosY);
sync_object_init_field(o, &o->oPosZ);
sync_object_init_field(o, &o->oVelX);
sync_object_init_field(o, &o->oVelY);
sync_object_init_field(o, &o->oVelZ);
sync_object_init_field(o, &o->oAction);
sync_object_init_field(o, &o->oPrevAction);
sync_object_init_field(o, &o->oSubAction);
sync_object_init_field(o, &o->oTimer);
sync_object_init_field(o, &o->oKoopaAgility);
sync_object_init_field(o, &o->parentObj->oKoopaRaceEndpointRaceBegun);
sync_object_init_field(o, &o->parentObj->oKoopaRaceEndpointRaceStatus);
sync_object_init_field(o, &o->oForwardVel);
sync_object_init_field(o, &o->oMoveAngleYaw);
sync_object_init_field(o, &o->areaTimer);
sync_object_init_field(o, koopaPathedStartWaypoint);
sync_object_init_field(o, koopaPathedPrevWaypoint);
sync_object_init_field(o, koopaShotFromCannon);
sync_object_init_field(o, o->oPathedPrevWaypointFlags);
sync_object_init_field(o, o->oPathedTargetPitch);
sync_object_init_field(o, o->oPathedTargetYaw);
sync_object_init_field(o, o->oPosX);
sync_object_init_field(o, o->oPosY);
sync_object_init_field(o, o->oPosZ);
sync_object_init_field(o, o->oVelX);
sync_object_init_field(o, o->oVelY);
sync_object_init_field(o, o->oVelZ);
sync_object_init_field(o, o->oAction);
sync_object_init_field(o, o->oPrevAction);
sync_object_init_field(o, o->oSubAction);
sync_object_init_field(o, o->oTimer);
sync_object_init_field(o, o->oKoopaAgility);
sync_object_init_field(o, o->parentObj->oKoopaRaceEndpointRaceBegun);
sync_object_init_field(o, o->parentObj->oKoopaRaceEndpointRaceStatus);
sync_object_init_field(o, o->oForwardVel);
sync_object_init_field(o, o->oMoveAngleYaw);
sync_object_init_field(o, o->areaTimer);
}
o->areaTimerType = AREA_TIMER_TYPE_MAXIMUM;
o->areaTimer = 0;
@ -156,10 +156,10 @@ void bhv_koopa_init(void) {
} else {
// normal koopa
sync_object_init(o, 4000.0f);
sync_object_init_field(o, &o->oKoopaTargetYaw);
sync_object_init_field(o, &o->oKoopaCountdown);
sync_object_init_field(o, &o->oKoopaMovementType);
sync_object_init_field(o, &o->oKoopaUnshelledTimeUntilTurn);
sync_object_init_field(o, o->oKoopaTargetYaw);
sync_object_init_field(o, o->oKoopaCountdown);
sync_object_init_field(o, o->oKoopaMovementType);
sync_object_init_field(o, o->oKoopaUnshelledTimeUntilTurn);
}
}

View file

@ -3,7 +3,7 @@
void bhv_lll_wood_piece_loop(void) {
if (!sync_object_is_initialized(o->oSyncID)) {
sync_object_init(o, 1000.0f);
sync_object_init_field(o, &o->oLllWoodPieceOscillationTimer);
sync_object_init_field(o, o->oLllWoodPieceOscillationTimer);
}
if (o->oTimer == 0)

View file

@ -19,7 +19,7 @@ void hexagonal_ring_spawn_flames(void) {
void bhv_lll_rotating_hexagonal_ring_loop(void) {
if (!sync_object_is_initialized(o->oSyncID)) {
sync_object_init(o, 4000.0f);
sync_object_init_field(o, &o->oAngleVelYaw);
sync_object_init_field(o, o->oAngleVelYaw);
}
UNUSED s32 unused;
o->oCollisionDistance = 4000.0f;

View file

@ -63,10 +63,10 @@ s32 lll_octagonal_mesh_find_y_offset(s32 *a0, f32 *a1, s32 a2, s32 a3) {
void bhv_lll_moving_octagonal_mesh_platform_loop(void) {
if (!sync_object_is_initialized(o->oSyncID)) {
sync_object_init(o, 4000.0f);
sync_object_init_field(o, &o->oHorizontalMovementUnkF8);
sync_object_init_field(o, &o->oHorizontalMovementUnkF4);
sync_object_init_field(o, &o->oHorizontalMovementUnk100);
sync_object_init_field(o, &o->oForwardVel);
sync_object_init_field(o, o->oHorizontalMovementUnkF8);
sync_object_init_field(o, o->oHorizontalMovementUnkF4);
sync_object_init_field(o, o->oHorizontalMovementUnk100);
sync_object_init_field(o, o->oForwardVel);
}
if (o->oAction == 0) {
o->oHorizontalMovementUnkF8 = 0;

View file

@ -63,7 +63,7 @@ void (*sRotatingCwFireBarsActions[])(void) = { fire_bar_act_0, fire_bar_act_1,
void bhv_lll_rotating_block_fire_bars_loop(void) {
if (!sync_object_is_initialized(o->oSyncID)) {
sync_object_init(o, 4000.0f);
sync_object_init_field(o, &o->oAngleVelYaw);
sync_object_init_field(o, o->oAngleVelYaw);
}
CUR_OBJ_CALL_ACTION_FUNCTION(sRotatingCwFireBarsActions);
if (o->oBehParams2ndByte == 0)

View file

@ -17,8 +17,8 @@ void sinking_rectangular_plat_actions(f32 a0, s32 a1) {
void bhv_lll_sinking_rectangular_platform_loop(void) {
if (!sync_object_is_initialized(o->oSyncID)) {
sync_object_init(o, 1000.0f);
sync_object_init_field(o, &o->oLllWoodPieceOscillationTimer);
sync_object_init_field(o, &o->oFaceAnglePitch);
sync_object_init_field(o, o->oLllWoodPieceOscillationTimer);
sync_object_init_field(o, o->oFaceAnglePitch);
}
f32 sp1C = 0.4f;
s32 sp18 = 0x100;
@ -33,7 +33,7 @@ void bhv_lll_sinking_rectangular_platform_loop(void) {
void bhv_lll_sinking_square_platforms_loop(void) {
if (!sync_object_is_initialized(o->oSyncID)) {
sync_object_init(o, 1000.0f);
sync_object_init_field(o, &o->oLllWoodPieceOscillationTimer);
sync_object_init_field(o, o->oLllWoodPieceOscillationTimer);
}
f32 sp1C = 0.5f;
s32 sp18 = 0x100;

View file

@ -3,8 +3,8 @@
void bhv_lll_sinking_rock_block_loop(void) {
if (!sync_object_is_initialized(o->oSyncID)) {
sync_object_init(o, 1000.0f);
sync_object_init_field(o, &o->oSinkWhenSteppedOnUnk104);
sync_object_init_field(o, &o->oGraphYOffset);
sync_object_init_field(o, o->oSinkWhenSteppedOnUnk104);
sync_object_init_field(o, o->oGraphYOffset);
}
lll_octagonal_mesh_find_y_offset(&o->oSinkWhenSteppedOnUnk104, &o->oSinkWhenSteppedOnUnk108, 124, -110);
o->oGraphYOffset = 0.0f;

View file

@ -42,13 +42,13 @@ void bhv_manta_ray_init(void) {
cur_obj_scale(2.5f);
sync_object_init(o, 4000.0f);
sync_object_init_field(o, &o->oMantaTargetPitch);
sync_object_init_field(o, &o->oMantaTargetYaw);
sync_object_init_field(o, &o->oWaterRingSpawnerRingsCollected);
sync_object_init_field(o, &o->oMoveAnglePitch);
sync_object_init_field(o, &o->oMoveAngleRoll);
sync_object_init_field(o, o->oMantaTargetPitch);
sync_object_init_field(o, o->oMantaTargetYaw);
sync_object_init_field(o, o->oWaterRingSpawnerRingsCollected);
sync_object_init_field(o, o->oMoveAnglePitch);
sync_object_init_field(o, o->oMoveAngleRoll);
if (ringManager != NULL) {
sync_object_init_field(o, &ringManager->oWaterRingMgrNextRingIndex);
sync_object_init_field(o, ringManager->oWaterRingMgrNextRingIndex);
}
}

View file

@ -28,7 +28,7 @@ s32 check_if_moving_over_floor(f32 a0, f32 a1) {
void bhv_pushable_loop(void) {
if (!sync_object_is_initialized(o->oSyncID)) {
sync_object_init(o, 1000.0f);
sync_object_init_field(o, &o->oMoveAngleYaw);
sync_object_init_field(o, o->oMoveAngleYaw);
}
struct MarioState* marioState = nearest_mario_state_to_object(o);

View file

@ -69,12 +69,12 @@ void bhv_mips_init(void) {
struct SyncObject* so = sync_object_init(o, 4000.0f);
if (so) {
sync_object_init_field(o, &o->oMipsStartWaypointIndex);
sync_object_init_field(o, &o->oForwardVel);
sync_object_init_field(o, &o->oMipsStarStatus);
sync_object_init_field(o, &o->oBehParams2ndByte);
sync_object_init_field(o, &o->oHeldState);
sync_object_init_field(o, &o->oFlags);
sync_object_init_field(o, o->oMipsStartWaypointIndex);
sync_object_init_field(o, o->oForwardVel);
sync_object_init_field(o, o->oMipsStarStatus);
sync_object_init_field(o, o->oBehParams2ndByte);
sync_object_init_field(o, o->oHeldState);
sync_object_init_field(o, o->oFlags);
so->on_received_pre = bhv_mips_on_received_pre;
so->on_received_post = bhv_mips_on_received_post;
}

View file

@ -32,11 +32,11 @@ void bhv_moneybag_init(void) {
o->oOpacity = 0;
sync_object_init(o, 4000.0f);
sync_object_init_field(o, &o->oHomeX);
sync_object_init_field(o, &o->oHomeY);
sync_object_init_field(o, &o->oHomeZ);
sync_object_init_field(o, &o->oMoneybagJumpState);
sync_object_init_field(o, &o->oOpacity);
sync_object_init_field(o, o->oHomeX);
sync_object_init_field(o, o->oHomeY);
sync_object_init_field(o, o->oHomeZ);
sync_object_init_field(o, o->oMoneybagJumpState);
sync_object_init_field(o, o->oOpacity);
}
void moneybag_check_mario_collision(void) {
@ -228,9 +228,9 @@ void bhv_moneybag_hidden_loop(void) {
if (!sync_object_is_initialized(o->oSyncID)) {
sync_object_init(o, SYNC_DISTANCE_ONLY_EVENTS);
sync_object_init_field(o, &o->oAction);
sync_object_init_field(o, &o->oPrevAction);
sync_object_init_field(o, &o->oTimer);
sync_object_init_field(o, o->oAction);
sync_object_init_field(o, o->oPrevAction);
sync_object_init_field(o, o->oTimer);
}
switch (o->oAction) {

View file

@ -175,15 +175,15 @@ void bhv_monty_mole_init(void) {
struct SyncObject* so = sync_object_init(o, 4000.0f);
if (so) {
so->on_received_post = bhv_monty_mole_on_received_post;
sync_object_init_field(o, &o->oMontyMoleHeightRelativeToFloor);
sync_object_init_field(o, &o->oMontyMoleHoleX);
sync_object_init_field(o, &o->oMontyMoleHoleY);
sync_object_init_field(o, &o->oMontyMoleHoleZ);
sync_object_init_field(o, &o->oFaceAnglePitch);
sync_object_init_field(o, &o->oGravity);
sync_object_init_field(o, &o->oIntangibleTimer);
sync_object_init_field(o, &o->oFaceAnglePitch);
sync_object_init_field_with_size(o, &o->header.gfx.node.flags, 16);
sync_object_init_field(o, o->oMontyMoleHeightRelativeToFloor);
sync_object_init_field(o, o->oMontyMoleHoleX);
sync_object_init_field(o, o->oMontyMoleHoleY);
sync_object_init_field(o, o->oMontyMoleHoleZ);
sync_object_init_field(o, o->oFaceAnglePitch);
sync_object_init_field(o, o->oGravity);
sync_object_init_field(o, o->oIntangibleTimer);
sync_object_init_field(o, o->oFaceAnglePitch);
sync_object_init_field(o, o->header.gfx.node.flags);
}
}

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