Merge branch 'dev' of https://github.com/coop-deluxe/sm64coopdx into proximity-chat

This commit is contained in:
Dominicentek 2026-06-22 01:10:00 +02:00
commit cbd04bd47f
194 changed files with 2520 additions and 3097 deletions

View file

@ -1,6 +1,7 @@
import os
import re
from vec_types import *
from exposed_lists import structs_excluded
usf_types = ['u8', 'u16', 'u32', 'u64', 's8', 's16', 's32', 's64', 'f32', 'f64']
vec_types = list(VEC_TYPES.keys())
@ -21,37 +22,6 @@ type_mappings = {
'size_t': 'u64', # this is assumed
}
exclude_structs = [
'AnimationTable',
'BullyCollisionData',
'CameraFOVStatus',
'CameraStoredInfo',
'CameraTrigger',
'Cutscene',
'CutsceneSplinePoint',
'CutsceneVariable',
'FloorGeometry',
'GraphNode_802A45E4',
'HandheldShakePoint',
'LinearTransitionPoint',
'MarioAnimDmaRelatedThing',
'ModAudioSampleCopies',
'ModFile',
'ModeTransitionInfo',
'OffsetSizePair',
'PaintingMeshVertex',
'ParallelTrackingPoint',
'PlayerGeometry',
'SPTask',
'SoundState',
'TransitionInfo',
'UnusedArea28',
'VblankHandler',
'Vtx_Interp',
'WarpTransition',
'WarpTransitionData',
]
override_types = { "Gfx", "Vtx" }
def extract_integer_datatype(c_type):
@ -212,7 +182,7 @@ def translate_type_to_lot(ptype, allowArrays=True):
struct_id = ptype.split(' ')[1]
if struct_id in exclude_structs:
if struct_id in structs_excluded:
return 'LOT_???'
return 'LOT_' + struct_id.upper()
@ -327,4 +297,32 @@ def translate_to_def(ptype):
return 'function'
if ptype.startswith('`Array` <'):
ptype = ptype.replace('`Array` <', '') + "[]"
return ptype.replace('enum ', '').replace('const ', '').replace(' ', '').replace('`', '').replace('<', '_').replace('>', '')
return ptype.replace('enum ', '').replace('const ', '').replace(' ', '').replace('`', '').replace('<', '_').replace('>', '')
allowed_identifier_cache = {}
def allowed_identifier(whitelists, blacklists, key, ident):
global allowed_identifier_cache
if whitelists is None: whitelists = {}
if blacklists is None: blacklists = {}
cache_key = "_".join([whitelists.get("__name__", ""), blacklists.get("__name__", ""), key])
if cache_key in allowed_identifier_cache:
whitelist_regex, blacklist_regex = allowed_identifier_cache[cache_key]
else:
blacklist = blacklists.get("*", []) + blacklists.get(key, [])
blacklist_regex = blacklist and re.compile("|".join(blacklist)) or None
whitelist = whitelists.get(key, [])
whitelist_regex = whitelist and re.compile("|".join(whitelist)) or None
allowed_identifier_cache[cache_key] = (whitelist_regex, blacklist_regex)
if blacklist_regex is not None:
if blacklist_regex.search(ident) is not None:
return False
if whitelist_regex is not None:
if whitelist_regex.search(ident) is not None:
return True
return False
return True

View file

@ -1,144 +1,25 @@
import sys
from common import *
from extract_constants import *
from vec_types import *
import sys
from exposed_lists import \
constants_files, \
constants_whitelist, \
constants_blacklist, \
constants_hidden
in_filename = 'autogen/lua_constants/built-in.lua'
verbose = len(sys.argv) > 1 and (sys.argv[1] == "-v" or sys.argv[1] == "--verbose")
in_filenames = ['autogen/lua_constants/built-in.lua', 'autogen/lua_constants/math.lua']
deprecated_filename = 'autogen/lua_constants/deprecated.lua'
out_filename = 'src/pc/lua/smlua_constants_autogen.c'
out_filename_docs = 'docs/lua/constants.md'
out_filename_defs = 'autogen/lua_definitions/constants.lua'
in_files = [
"include/types.h",
"include/sm64.h",
"src/pc/lua/smlua_hooks.h",
"src/game/area.h",
"src/game/camera.h",
"include/mario_animation_ids.h",
"include/sounds.h",
"src/game/characters.h",
"src/pc/network/network.h",
"src/pc/network/network_player.h",
"include/PR/os_cont.h",
"src/game/interaction.c",
"src/game/interaction.h",
"src/pc/djui/djui_hud_utils.h",
"src/pc/controller/controller_mouse.h",
"include/behavior_table.h",
"src/pc/lua/utils/smlua_model_utils.h",
"src/pc/lua/utils/smlua_misc_utils.h",
"include/object_constants.h",
"include/mario_geo_switch_case_ids.h",
"src/game/object_list_processor.h",
"src/engine/graph_node.h",
"levels/level_defines.h",
"src/game/obj_behaviors.c",
"src/game/save_file.h",
"src/game/obj_behaviors_2.h",
"include/dialog_ids.h",
"include/seq_ids.h",
"include/surface_terrains.h",
"src/game/level_update.h",
"src/pc/network/version.h",
"include/geo_commands.h",
"include/level_commands.h",
"src/audio/external.h",
"src/game/envfx_snow.h",
"src/pc/mods/mod_storage.h",
"src/pc/mods/mod_fs.h",
"src/game/first_person_cam.h",
"src/pc/djui/djui_console.h",
"src/game/player_palette.h",
"src/pc/network/lag_compensation.h",
"src/pc/djui/djui_panel_menu.h",
"src/engine/lighting_engine.h",
"include/PR/gbi.h",
"include/PR/gbi_extension.h",
"src/pc/gfx/gfx_pc.h",
"src/engine/surface_load.h",
"src/pc/lua/utils/smlua_audio_utils.h",
"src/pc/voice_chat.h",
]
exclude_constants = {
"*": [ "^MAXCONTROLLERS$", "^AREA_[^T].*", "^AREA_T[HTO]", "^CONT_ERR.*", "^READ_MASK$", "^SIGN_RANGE$", ],
"include/sm64.h": [ "END_DEMO" ],
"include/types.h": [ "GRAPH_NODE_GUARD" ],
"src/audio/external.h": [ "DS_DIFF" ],
"src/game/save_file.h": [ "EEPROM_SIZE" ],
"src/game/obj_behaviors.c": [ "^o$" ],
"src/pc/djui/djui_console.h": [ "CONSOLE_MAX_TMP_BUFFER" ],
"src/pc/lua/smlua_hooks.h": [ "^LUA_BEHAVIOR_.*", "MAX_HOOKED_.*", "^HOOK_RETURN_.*", "^ACTION_HOOK_.*", "^MOD_MENU_ELEMENT_.*" ],
"src/pc/djui/djui_panel_menu.h": [ "RAINBOW_TEXT_LEN" ],
"src/pc/mods/mod_fs.h": [ "INT_TYPE_MAX", "FLOAT_TYPE_MAX", "FILE_SEEK_MAX" ],
"src/engine/surface_load.h": [ "NUM_CELLS" ],
"src/pc/network/version.h": [ "VERSION_OFFSET" ],
}
include_constants = {
"include/geo_commands.h": [ "BACKGROUND" ],
"include/level_commands.h": [ "WARP_CHECKPOINT", "WARP_NO_CHECKPOINT" ],
"src/audio/external.h": [ "SEQ_PLAYER", "DS_" ],
"src/pc/lua/utils/smlua_audio_utils.h": ["MOD_AUDIO_CHANNEL"],
"src/pc/mods/mod_storage.h": [ "MAX_KEYS", "MAX_KEY_VALUE_LENGTH" ],
"include/PR/gbi.h": [
"^G_NOOP$",
"^G_SETOTHERMODE_H$",
"^G_SETOTHERMODE_L$",
"^G_ENDDL$",
"^G_DL$",
"^G_MOVEMEM$",
"^G_MOVEWORD$",
"^G_MTX$",
"^G_GEOMETRYMODE$",
"^G_POPMTX$",
"^G_TEXTURE$",
"^G_COPYMEM$",
"^G_VTX$",
"^G_TRI1$",
"^G_TRI2$",
"^G_SETCIMG$",
"^G_SETZIMG$",
"^G_SETTIMG$",
"^G_SETCOMBINE$",
"^G_SETENVCOLOR$",
"^G_SETPRIMCOLOR$",
"^G_SETBLENDCOLOR$",
"^G_SETFOGCOLOR$",
"^G_SETFILLCOLOR$",
"^G_FILLRECT$",
"^G_SETTILE$",
"^G_LOADTILE$",
"^G_LOADBLOCK$",
"^G_SETTILESIZE$",
"^G_LOADTLUT$",
"^G_SETSCISSOR$",
"^G_TEXRECTFLIP$",
"^G_TEXRECT$",
],
"include/PR/gbi_extension.h": [
"^G_VTX_EXT$",
"^G_PPARTTOCOLOR$",
"^G_SETENVRGB$",
"^G_STATE_EXT$",
],
}
# Constants that exist in the source code but should not appear
# in the documentation or VSCode autocomplete
hide_constants = {
"interaction.h": [ "INTERACT_UNKNOWN_08" ],
}
pretend_find = [
"SOUND_ARG_LOAD",
]
############################################################################
seen_constants = []
totalConstants = 0
verbose = len(sys.argv) > 1 and (sys.argv[1] == "-v" or sys.argv[1] == "--verbose")
overrideConstant = {
'VERSION_REGION': '"US"',
}
@ -150,6 +31,9 @@ defined_values = {
'F3DEX_GBI_2': True,
'DEVELOPMENT': False,
}
pretend_find = [
"SOUND_ARG_LOAD",
]
############################################################################
@ -179,26 +63,19 @@ def saw_constant(identifier, inIfBlock):
seen_constants.append(identifier)
return False
def allowed_identifier(filename, ident):
exclude_list = exclude_constants['*']
def get_constant(filename, line, inIfBlock, field, index, set_to, set_to_val):
if set_to is not None:
if allowed_identifier(constants_whitelist, constants_blacklist, filename, field):
if set_to_val is not None:
return [field, str(set_to_val + index)]
return [field, '((%s) + %d)' % (set_to, index)]
if filename in exclude_constants:
exclude_list.extend(exclude_constants[filename])
elif allowed_identifier(constants_whitelist, constants_blacklist, filename, field):
if saw_constant(field, inIfBlock):
print('>>> ' + line)
return [field, str(index)]
for exclude in exclude_list:
if re.search(exclude, ident) != None:
return False
if filename in include_constants:
for include in include_constants[filename]:
if re.search(include, ident) != None:
return True
return False
if ident in overrideConstant:
return False
return True
return None
def process_enum(filename, line, inIfBlock):
_, ident, val = line.split(' ', 2)
@ -233,24 +110,15 @@ def process_enum(filename, line, inIfBlock):
except Exception:
set_to_val = None
constants.append([ident, val])
if allowed_identifier(constants_whitelist, constants_blacklist, filename, field):
constants.append([ident, val])
set_to = ident
index = 1
continue
if set_to is not None:
if set_to_val is not None:
constants.append([field, str(set_to_val + index)])
else:
constants.append([field, '((%s) + %d)' % (set_to, index)])
index += 1
continue
if allowed_identifier(filename, field):
constants.append([field, str(index)])
if saw_constant(field, inIfBlock):
print('>>> ' + line)
constant = get_constant(filename, line, inIfBlock, field, index, set_to, set_to_val)
if constant is not None:
constants.append(constant)
index += 1
@ -277,7 +145,7 @@ def process_define(filename, line, inIfBlock):
print('UNRECOGNIZED DEFINE: ' + line)
return None
if not allowed_identifier(filename, ident):
if not allowed_identifier(constants_whitelist, constants_blacklist, filename, ident):
return None
if saw_constant(ident, inIfBlock):
@ -348,7 +216,7 @@ def process_file(filename):
def process_files():
seen_constants = []
processed_files = []
files = sorted(in_files, key=lambda d: d.split('/')[-1])
files = sorted(constants_files, key=lambda d: d.split('/')[-1])
for f in files:
processed_files.append(process_file(f))
for key, item in overrideConstant.items():
@ -411,7 +279,7 @@ def build_to_c(built_files):
txt = ''
# Built-in and deprecated
for filename in [in_filename, deprecated_filename]:
for filename in [*in_filenames, deprecated_filename]:
with open(get_path(filename), 'r') as f:
for line in f.readlines():
txt += line.strip() + '\n'
@ -439,13 +307,6 @@ def build_to_c(built_files):
############################################################################
def doc_should_document(fname, identifier):
if fname in hide_constants:
for pattern in hide_constants[fname]:
if re.search(pattern, identifier) != None:
return False
return True
def doc_constant_index(processed_files):
s = '# Supported Constants\n'
for processed_file in processed_files:
@ -478,7 +339,7 @@ def doc_constant(fname, processed_constant):
for c in [processed_constant]:
if c[0].startswith('#'):
continue
if not doc_should_document(fname, c[0]):
if not allowed_identifier(None, constants_hidden, fname, c[0]):
continue
s += '- %s\n' % (c[0])
@ -540,7 +401,7 @@ def def_constant(fname, processed_constant, skip_constant):
continue
if skip_constant:
continue
if not doc_should_document(fname, c[0]):
if not allowed_identifier(None, constants_hidden, fname, c[0]):
continue
if '"' in c[1]:
s += '\n--- @type string\n'
@ -555,9 +416,10 @@ def def_constant(fname, processed_constant, skip_constant):
def build_to_def(processed_files):
s = '-- AUTOGENERATED FOR CODE EDITORS --\n\n'
with open(get_path(in_filename), 'r') as f:
s += f.read()
s += '\n'
for filename in in_filenames:
with open(get_path(filename), 'r') as f:
s += f.read()
s += '\n'
s += '\n\n-------------------------\n'
s += '-- vec types constants --\n'

View file

@ -3,175 +3,24 @@ import sys
from extract_functions import *
from common import *
from vec_types import *
from exposed_lists import \
functions_files, \
functions_whitelist, \
functions_blacklist, \
functions_hidden, \
functions_version_excludes, \
functions_params_types
verbose = len(sys.argv) > 1 and (sys.argv[1] == "-v" or sys.argv[1] == "--verbose")
rejects = ""
integer_types = ["u8", "u16", "u32", "u64", "s8", "s16", "s32", "s64", "int", "lua_Integer"]
number_types = ["f32", "float", "f64", "double", "lua_Number"]
parameter_keywords = ["VEC_OUT", "RET", "INOUT", "OPTIONAL"]
out_filename = 'src/pc/lua/smlua_functions_autogen.c'
out_filename_docs = 'docs/lua/functions%s.md'
out_filename_defs = 'autogen/lua_definitions/functions.lua'
in_files = [
"src/audio/external.h",
"src/engine/math_util.h",
"src/engine/math_util.inl",
"src/engine/math_util_vec3f.inl",
"src/engine/math_util_vec3i.inl",
"src/engine/math_util_vec3s.inl",
"src/engine/math_util_mat4.inl",
"src/engine/surface_collision.h",
"src/engine/surface_load.h",
"src/game/camera.h",
"src/game/characters.h",
"src/game/mario_actions_airborne.c",
"src/game/mario_actions_automatic.c",
"src/game/mario_actions_cutscene.c",
"src/game/mario_actions_moving.c",
"src/game/mario_actions_object.c",
"src/game/mario_actions_stationary.c",
"src/game/mario_actions_submerged.c",
"src/game/mario_step.h",
"src/game/mario.h",
"src/game/rumble_init.h",
"src/pc/djui/djui_popup.h",
"src/pc/network/network_utils.h",
"src/pc/djui/djui_console.h",
"src/pc/djui/djui_chat_message.h",
"src/pc/djui/djui_language.h",
"src/game/interaction.h",
"src/game/level_info.h",
"src/game/save_file.h",
"src/game/sound_init.h",
"src/pc/djui/djui_hud_utils.h",
"src/pc/djui/djui_panel_menu.h",
"src/pc/network/network_player.h",
"src/pc/network/lag_compensation.h",
"include/behavior_table.h",
"src/pc/lua/utils/smlua_obj_utils.h",
"src/pc/lua/utils/smlua_misc_utils.h",
"src/pc/lua/utils/smlua_camera_utils.h",
"src/pc/lua/utils/smlua_gfx_utils.h",
"src/pc/lua/utils/smlua_collision_utils.h",
"src/pc/lua/utils/smlua_model_utils.h",
"src/pc/lua/utils/smlua_text_utils.h",
"src/pc/lua/utils/smlua_audio_utils.h",
"src/pc/lua/utils/smlua_level_utils.h",
"src/pc/lua/utils/smlua_anim_utils.h",
"src/pc/lua/utils/smlua_deprecated.h",
"src/game/object_helpers.c",
"src/game/obj_behaviors.c",
"src/game/obj_behaviors_2.c",
"src/game/platform_displacement.h",
"src/game/spawn_sound.h",
"src/game/object_list_processor.h",
"src/game/behavior_actions.h",
"src/game/mario_misc.h",
"src/pc/mods/mod_storage.h",
"src/pc/mods/mod_fs.h",
"src/pc/utils/misc.h",
"src/game/level_update.h",
"src/game/area.h",
"src/engine/level_script.h",
"src/game/ingame_menu.h",
"src/game/first_person_cam.h",
"src/engine/behavior_script.h",
"src/audio/seqplayer.h",
"src/engine/lighting_engine.h",
"src/pc/network/sync_object.h",
"src/audio/load.h",
"src/pc/djui/djui_gfx.h",
"src/pc/voice_chat.h"
]
override_allowed_functions = {
"src/audio/external.h": [ " play_", "fade", "current_background", "stop_", "sound_banks", "drop_queued_background_music", "set_sound_moving_speed", "background_music_default_volume", "get_sound_pan", "sound_get_level_intensity", "set_audio_muted" ],
"src/game/rumble_init.h": [ "queue_rumble_", "reset_rumble_timers" ],
"src/pc/djui/djui_popup.h": [ "create" ],
"src/pc/djui/djui_language.h": [ "djui_language_get" ],
"src/pc/djui/djui_panel_menu.h": [ "djui_menu_get_rainbow_string_color" ],
"src/game/save_file.h": [ "get_level_", "save_file_get_", "save_file_set_flags", "save_file_clear_flags", "save_file_reload", "save_file_erase_current_backup_save", "save_file_set_star_flags", "save_file_is_cannon_unlocked", "save_file_set_cannon_unlocked", "touch_coin_score_age", "save_file_set_course_coin_score", "save_file_do_save", "save_file_remove_star_flags", "save_file_erase" ],
"src/pc/lua/utils/smlua_model_utils.h": [ "smlua_model_util_get_id" ],
"src/game/object_list_processor.h": [ "set_object_respawn_info_bits" ],
"src/game/platform_displacement.h": [ "apply_platform_displacement" ],
"src/game/mario_misc.h": [ "bhv_toad.*", "bhv_unlock_door.*", "geo_get_.*" ],
"src/game/level_update.h": [ "level_trigger_warp", "get_painting_warp_node", "initiate_warp", "initiate_painting_warp", "warp_special", "lvl_set_current_level", "level_control_timer_running", "pressed_pause", "fade_into_special_warp", "get_instant_warp" ],
"src/game/area.h": [ "get_mario_spawn_type", "area_get_warp_node", "area_get_any_warp_node", "play_transition" ],
"src/engine/level_script.h": [ "area_create_warp_node" ],
"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" ],
"src/pc/djui/djui_gfx.h": [ "djui_gfx_get_scale" ],
}
override_disallowed_functions = {
"src/audio/external.h": [ " func_" ],
"src/engine/surface_load.h": [ "load_area_terrain", "alloc_surface_pools", "clear_dynamic_surfaces", "get_area_terrain_size", "alloc_surface", "add_surface", "remove_surface_from_partition", "delete_surface", "swap_and_pop_surface_pool", "add_surface_without_hook" ],
"src/engine/surface_collision.h": [ " debug_", "f32_find_wall_collision" ],
"src/game/mario_actions_airborne.c": [ "^[us]32 act_.*" ],
"src/game/mario_actions_automatic.c": [ "^[us]32 act_.*" ],
"src/game/mario_actions_cutscene.c": [ "^[us]32 act_.*", " geo_", "spawn_obj", "print_displaying_credits_entry" ],
"src/game/mario_actions_moving.c": [ "^[us]32 act_.*" ],
"src/game/mario_actions_object.c": [ "^[us]32 act_.*" ],
"src/game/mario_actions_stationary.c": [ "^[us]32 act_.*", "mario_exit_palette_editor" ],
"src/game/mario_actions_submerged.c": [ "^[us]32 act_.*" ],
"src/game/mario_step.h": [ " stub_mario_step", "transfer_bully_speed" ],
"src/game/mario.h": [ " init_mario" ],
"src/pc/djui/djui_console.h": [ " djui_console_create", "djui_console_message_create", "djui_console_message_dequeue" ],
"src/pc/djui/djui_chat_message.h": [ "create_from" ],
"src/pc/djui/djui_hud_utils.h": [ "djui_hud_clear_interp_data", "djui_hud_print_text", "djui_hud_print_text_interpolated" ],
"src/game/interaction.h": [ "process_interaction", "_handle_" ],
"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_", "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": [ "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"],
"src/pc/lua/utils/smlua_anim_utils.h": [ "smlua_anim_util_reset", "smlua_anim_util_register_animation" ],
"src/pc/lua/utils/smlua_gfx_utils.h": [ "gfx_allocate_internal", "vtx_allocate_internal", "gfx_get_length_no_sentinel" ],
"src/pc/network/lag_compensation.h": [ "lag_compensation_clear" ],
"src/game/first_person_cam.h": [ "first_person_update" ],
"src/pc/lua/utils/smlua_collision_utils.h": [ "collision_find_surface_on_ray" ],
"src/engine/behavior_script.h": [ "stub_behavior_script_2", "cur_obj_update" ],
"src/pc/mods/mod_storage.h": [ "mod_storage_shutdown" ],
"src/pc/mods/mod_fs.h": [ "mod_fs_read_file_from_uri", "mod_fs_shutdown" ],
"src/pc/utils/misc.h": [ "str_.*", "file_get_line", "delta_interpolate_(normal|rgba|mtx)", "detect_and_skip_mtx_interpolation", "precise_delay_f64", "can_update_game", "update_game", "open_url", "open_folder" ],
"src/engine/lighting_engine.h": [ "le_calculate_vertex_lighting", "le_clear", "le_shutdown" ],
"src/pc/voice_chat.h": [ "voicechat_init", "voicechat_shutdown", "voicechat_init_player", "voicechat_encode_audio", "voicechat_decode_audio", "voicechat_mix", "voicechat_push_pending_global_mute", "voicechat_resolve_pending_global_mutes" ],
}
override_hide_functions = {
"smlua_deprecated.h": [ ".*" ],
"network_player.h": [ "network_player_get_palette_color_channel", "network_player_get_override_palette_color_channel" ],
}
override_function_version_excludes = {
"bhv_play_music_track_when_touched_loop": "VERSION_JP",
"play_knockback_sound": "VERSION_JP",
"cur_obj_spawn_star_at_y_offset": "VERSION_JP",
}
lua_function_params = {
"src/pc/lua/utils/smlua_obj_utils.h::spawn_object_sync::objSetupFunction": [ "struct Object*" ],
}
parameter_keywords = [
"VEC_OUT",
"RET",
"INOUT",
"OPTIONAL"
]
###########################################################
template = """/* THIS FILE IS AUTOGENERATED */
@ -979,8 +828,8 @@ def build_function(function, do_extern):
s = ''
fid = function['identifier']
if fid in override_function_version_excludes:
s += '#ifndef ' + override_function_version_excludes[fid] + '\n'
if fid in functions_version_excludes:
s += '#ifndef ' + functions_version_excludes[fid] + '\n'
fparams, freturns = split_function_parameters_and_returns(function)
@ -1075,7 +924,7 @@ def build_function(function, do_extern):
num_returns = max(1, push_value + len(freturns))
s += ' return %d;\n}\n' % num_returns
if fid in override_function_version_excludes:
if fid in functions_version_excludes:
s += '#endif\n'
function['implemented'] = 'UNIMPLEMENTED' not in s
@ -1109,8 +958,8 @@ def build_bind(function):
s = ' ' + s
# There is no point in adding the ifndef statement if the function is commented out here anyways.
# So we only do it on implemented functions.
if fid in override_function_version_excludes:
s = '#ifndef ' + override_function_version_excludes[fid] + '\n' + s
if fid in functions_version_excludes:
s = '#ifndef ' + functions_version_excludes[fid] + '\n' + s
s += '\n#endif'
else:
s = ' //' + s + ' <--- UNIMPLEMENTED'
@ -1127,7 +976,7 @@ def build_binds(processed_files):
def build_includes():
s = ''
for f in in_files:
for f in functions_files:
if not f.endswith('.h'):
continue
s += '#include "%s"\n' % f
@ -1136,19 +985,8 @@ def build_includes():
############################################################################
def process_function(fname, line, description):
if fname in override_allowed_functions:
found_match = False
for pattern in override_allowed_functions[fname]:
if re.search(pattern, line) != None:
found_match = True
break
if not found_match:
return None
if fname in override_disallowed_functions:
for pattern in override_disallowed_functions[fname]:
if re.search(pattern, line) != None:
return None
if not allowed_identifier(functions_whitelist, functions_blacklist, fname, line):
return None
function = {}
@ -1204,8 +1042,8 @@ def process_function(fname, line, description):
# remember lua function params
lf_key = fname + '::' + function['identifier'] + '::' + param['identifier']
if param['type'] == 'LuaFunction' and lf_key in lua_function_params:
param['lua_function_params'] = lua_function_params[lf_key]
if param['type'] == 'LuaFunction' and lf_key in functions_params_types:
param['lua_function_params'] = functions_params_types[lf_key]
function['params'].append(param)
param_index += 1
@ -1239,7 +1077,7 @@ def process_file(fname):
def process_files():
processed_files = []
files = sorted(in_files, key=lambda d: d.split('/')[-1])
files = sorted(functions_files, key=lambda d: d.split('/')[-1])
for f in files:
processed_files.append(process_file(f))
return processed_files
@ -1293,16 +1131,6 @@ def output_fuzz_file():
############################################################################
def doc_should_document(fname, identifier):
if fname in override_hide_functions:
found_match = False
for pattern in override_hide_functions[fname]:
if re.search(pattern, identifier) != None:
found_match = True
break
return not found_match
return True
def doc_page_link(page_num):
if page_num == 1:
return 'functions.md'
@ -1319,7 +1147,7 @@ def doc_function_index(processed_files):
for function in processed_file['functions']:
if not function['implemented']:
continue
if not doc_should_document(processed_file['filename'], function['identifier']):
if not allowed_identifier(None, functions_hidden, processed_file['filename'], function['identifier']):
continue
s += ' - [%s](%s#%s)\n' % (function['identifier'], doc_page_link(page_num), function['identifier'])
@ -1356,7 +1184,7 @@ def doc_function(fname, function):
if len(sys.argv) >= 2 and sys.argv[1] == 'fuzz':
output_fuzz_function(fname, function)
if not doc_should_document(fname, function['identifier']):
if not allowed_identifier(None, functions_hidden, fname, function['identifier']):
return ''
fid = function['identifier']
@ -1503,7 +1331,7 @@ def def_function(fname, function):
return ''
fid = function['identifier']
if not doc_should_document(fname, fid):
if not allowed_identifier(None, functions_hidden, fname, fid):
return ''
rtype, _ = translate_type_to_lua(function['type'])

View file

@ -1,43 +1,21 @@
import os
import re
import sys
from extract_structs import *
from extract_object_fields import *
from common import *
from vec_types import *
in_files = [
"include/types.h",
"src/game/area.h",
"src/game/camera.h",
"src/game/characters.h",
"src/engine/surface_collision.h",
"src/pc/network/network_player.h",
"src/pc/djui/djui_hud_utils.h",
"src/pc/djui/djui_theme.h",
"src/game/object_helpers.h",
"src/game/mario_step.h",
"src/game/ingame_menu.h",
"src/pc/lua/utils/smlua_anim_utils.h",
"src/pc/lua/utils/smlua_misc_utils.h",
"src/pc/lua/utils/smlua_camera_utils.h",
"src/pc/lua/utils/smlua_collision_utils.h",
"src/pc/lua/utils/smlua_level_utils.h",
"src/game/spawn_sound.h",
"src/pc/network/network.h",
"src/game/hardcoded.h",
"src/pc/mods/mod.h",
"src/pc/mods/mod_fs.h",
"src/pc/lua/utils/smlua_audio_utils.h",
"src/game/paintings.h",
"src/pc/djui/djui_types.h",
"src/game/level_update.h",
"src/game/first_person_cam.h",
"src/game/player_palette.h",
"src/engine/graph_node.h",
"include/PR/gbi.h",
"src/pc/voice_chat.h",
]
from exposed_lists import \
structs_files, \
structs_whitelist, \
structs_blacklist, \
structs_excluded, \
structs_fields_whitelist, \
structs_fields_blacklist, \
structs_fields_hidden, \
structs_fields_version_excludes, \
structs_fields_types, \
structs_fields_mutable, \
structs_fields_immutable
out_filename_c = 'src/pc/lua/smlua_cobject_autogen.c'
out_filename_h = 'src/pc/lua/smlua_cobject_autogen.h'
@ -74,108 +52,7 @@ struct LuaObjectField* smlua_get_object_field_autogen(u16 lot, const char* key);
#endif
"""
override_field_types = {
"Surface": { "normal": "Vec3f" },
"Object": { "oAnimations": "ObjectAnimPointer*" },
}
override_field_mutable = {
"NetworkPlayer": [
"overrideModelIndex",
"overridePalette",
"overridePaletteIndex",
],
}
override_field_invisible = {
"Mod": [ "files", "showedScriptWarning", "customBehaviorIndex", "customObjectFields" ],
"Camera": [ "paletteEditorCapState", "filler31", "filler3C", "unusedVec1" ],
"LakituState": [ "filler30", "filler3E", "filler72", "unusedVec1", "unusedVec2" ],
"NetworkPlayer": [ "gag", "moderator", "discordId", "rxPacketHash", "rxSeqIds" ],
"GraphNode": [ "_guard1", "_guard2", "padding" ],
"GraphNodeRoot": ["unk15", "views"],
"GraphNodeMasterList": [ "listHeads", "listTails" ],
"GraphNodeCullingRadius": [ "pad1E" ],
"GraphNodeTranslation": [ "pad1E" ],
"GraphNodeBackground": [ "unused" ],
"GraphNodePerspective": [ "unused" ],
"GraphNodeSwitchCase": [ "unused" ],
"GraphNodeObject": [ "unk4C" ],
"FnGraphNode": [ "luaTokenIndex" ],
"Object": [ "firstSurface", "customFields", "bhvStack", "bhvStackIndex" ],
"SpawnInfo": [ "unk18" ],
"Animation": [ "unusedBoneCount" ],
"ModAudio": [ "alive", "sound", "decoder", "buffer", "bufferSize", "sampleCopiesTail", "volChannel" ],
"Painting": [ "normalDisplayList", "textureMaps", "rippleDisplayList", "ripples" ],
"DialogEntry": [ "str" ],
"ModFsFile": [ "data", "capacity" ],
"ModFs": [ "files" ],
"VoicePlayer": [ "internal" ],
}
override_field_deprecated = {
"NetworkPlayer": [ "paletteIndex", "overridePaletteIndex", "overridePaletteIndexLp" ],
"ModAudio": [ "file", "relativePath" ], # compatibility band-aid
}
override_field_immutable = {
"MarioState": [ "playerIndex", "controller", "marioObj", "marioBodyState", "statusForCamera", "area", "dialogId" ],
"MarioAnimation": [ "animDmaTable" ],
"ObjectNode": [ "next", "prev" ],
"Character": [ "*" ],
"NetworkPlayer": [ "*" ],
"TextureInfo": [ "*" ],
"Object": ["oSyncID", "coopFlags", "oChainChompSegments", "oWigglerSegments", "oHauntedChairUnk100", "oTTCTreadmillBigSurface", "oTTCTreadmillSmallSurface", "bhvStackIndex", "respawnInfoType", "numSurfaces", "bhvStack" ],
"Surface": [ "poolType", "socId" ],
"GlobalObjectAnimations": [ "*"],
"SpawnParticlesInfo": [ "model" ],
"WaterDropletParams": [ "model" ],
"MarioBodyState": [ "updateTorsoTime", "updateHeadPosTime", "animPartsPos", "animPartsRot", "currAnimPart" ],
"Area": [ "localAreaTimer", "nextSyncID", "objectSpawnInfos", "paintingWarpNodes", "warpNodes" ],
"Mod": [ "*" ],
"ModFile": [ "*" ],
"Painting": [ "id", "imageCount", "textureType", "textureWidth", "textureHeight" ],
"SpawnInfo": [ "syncID", "next", "unk18" ],
"CustomLevelInfo": [ "next" ],
"GraphNode": [ "children", "next", "parent", "prev", "type" ],
"GraphNodeBackground": [ "prevCameraTimestamp", "unused" ],
"GraphNodeCamera": [ "matrixPtrPrev", "prevTimestamp" ],
"GraphNodeHeldObject": [ "prevShadowPosTimestamp" ],
"GraphNodeObject": [ "angle", "animInfo", "cameraToObject", "node", "pos", "prevAngle", "prevPos", "prevScale", "prevScaleTimestamp", "prevShadowPos", "prevShadowPosTimestamp", "prevThrowMatrix", "prevThrowMatrixTimestamp", "prevTimestamp", "scale", "shadowPos", "sharedChild", "skipInterpolationTimestamp", "throwMatrixPrev", "unk4C", ],
"GraphNodeObjectParent": [ "sharedChild" ],
"GraphNodePerspective": [ "unused" ],
"GraphNodeSwitchCase": [ "fnNode", "unused" ],
"GraphNodeRoot": ["node", "areaIndex", "numViews"],
"ObjectWarpNode": [ "next" ],
"Animation": [ "*" ],
"AnimationTable": [ "*" ],
"Controller": [ "controllerData", "statusData" ],
"FirstPersonCamera": [ "enabled" ],
"ModAudio": [ "isStream", "loaded" ],
"Gfx": [ "w0", "w1" ], # to protect from invalid type conversions
"DialogEntry": [ "unused", "linesPerBox", "leftOffset", "width", "str", "text", "replaced"],
"ModFsFile": [ "*" ],
"ModFs": [ "*" ],
"StaticObjectCollision": [ "*" ],
"VoicePlayer": [ "talking", "error", "clientMutedState", "playerMutedState" ],
}
override_field_version_excludes = {
"oCameraLakituMusicPlayed": "VERSION_JP",
"oCoinUnk1B0": "VERSION_JP",
}
override_allowed_structs = {
"src/pc/network/network.h": [ "ServerSettings", "NametagsSettings" ],
"src/pc/djui/djui_types.h": [ "DjuiColor" ],
"src/game/level_update.h": [ "HudDisplay" ],
"src/game/player_palette.h": [ "PlayerPalette" ],
"src/game/ingame_menu.h" : [ "DialogEntry" ],
"include/PR/gbi.h": [ "Gfx", "Vtx" ],
"src/pc/voice_chat.h": [ "VoicePlayer" ],
}
sLuaManuallyDefinedStructs = [{
lua_manually_defined_structs = [{
'path': 'n/a',
'structs': [
*['struct %s { %s }' % (
@ -379,10 +256,8 @@ def parse_structs(extracted, sortFields = False):
for e in extracted:
for struct in e['structs']:
parsed = parse_struct(struct, sortFields)
if e['path'] in override_allowed_structs:
if parsed['identifier'] not in override_allowed_structs[e['path']]:
continue
structs.append(parsed)
if allowed_identifier(structs_whitelist, structs_blacklist, e['path'], parsed['identifier']):
structs.append(parsed)
return structs
############################################################################
@ -419,9 +294,9 @@ def output_fuzz_struct(struct):
fid, ftype, fimmutable, lvt, lot, size = get_struct_field_info(struct, field)
if fimmutable == 'true':
continue
if sid in override_field_invisible:
if fid in override_field_invisible[sid]:
continue
if not allowed_identifier(structs_fields_whitelist, structs_fields_blacklist, sid, fid):
continue
if '(' in fid or '[' in fid or ']' in fid:
continue
@ -510,8 +385,8 @@ def get_struct_field_info(struct, field):
ftype = field['type']
size = 1
if sid in override_field_types and fid in override_field_types[sid]:
ftype = override_field_types[sid][fid]
if sid in structs_fields_types and fid in structs_fields_types[sid]:
ftype = structs_fields_types[sid][fid]
lvt = translate_type_to_lvt(ftype, allowArrays=True)
lot = translate_type_to_lot(ftype, allowArrays=True)
@ -522,12 +397,12 @@ def get_struct_field_info(struct, field):
if field.get('get') and field['set'] == 'NULL':
fimmutable = 'true'
if sid in override_field_immutable:
if fid in override_field_immutable[sid] or '*' in override_field_immutable[sid]:
if sid in structs_fields_immutable:
if fid in structs_fields_immutable[sid] or '*' in structs_fields_immutable[sid]:
fimmutable = 'true'
if sid in override_field_mutable:
if fid in override_field_mutable[sid] or '*' in override_field_mutable[sid]:
if sid in structs_fields_mutable:
if fid in structs_fields_mutable[sid] or '*' in structs_fields_mutable[sid]:
fimmutable = 'false'
if not ('char' in ftype and '[' in ftype and 'unsigned' not in ftype):
@ -558,13 +433,12 @@ def build_struct(struct):
for field in struct['fields']:
fid, ftype, fimmutable, lvt, lot, size = get_struct_field_info(struct, field)
if not allowed_identifier(structs_fields_whitelist, structs_fields_blacklist, sid, fid):
continue
if re.search(r'\[([^\]]+)\]', ftype):
ftype = re.sub(r'\[[^\]]*\]', '', ftype).strip()
if sid in override_field_invisible:
if fid in override_field_invisible[sid]:
continue
name = sid
if sid in reversed_override_types:
name = reversed_override_types[sid]
@ -576,8 +450,8 @@ def build_struct(struct):
struct_str = "struct " if not struct['typedef'] else ""
startStr = ''
endStr = ' },'
if fid in override_field_version_excludes:
startStr += '#ifndef ' + override_field_version_excludes[fid] + '\n'
if fid in structs_fields_version_excludes:
startStr += '#ifndef ' + structs_fields_version_excludes[fid] + '\n'
endStr += '\n#endif'
startStr += ' { '
row.append(startStr)
@ -640,7 +514,7 @@ def build_structs(structs):
s = ''
for struct in structs:
if struct['identifier'] in exclude_structs:
if struct['identifier'] in structs_excluded:
continue
oldFields = struct['fields']
struct['fields'] = sorted(struct['fields'], key=lambda d: d['identifier'])
@ -669,7 +543,7 @@ def build_body(parsed):
for struct in parsed:
sid = struct['identifier']
if sid in exclude_structs:
if sid in structs_excluded:
continue
lot_names += f'\t[LOT_{sid.upper()}] = "{sid}",\n'
lot_names += '};\n'
@ -703,7 +577,7 @@ def build_lot_enum():
def build_includes():
s = '#include "smlua.h"\n'
for in_file in in_files:
for in_file in structs_files:
s += '#include "%s"\n' % in_file
return s
@ -729,7 +603,7 @@ def doc_struct_index(structs):
s = '# Supported Structs\n'
for struct in structs:
sid = struct['identifier']
if sid in exclude_structs:
if sid in structs_excluded:
continue
s += '- [%s](#%s)\n' % (sid, sid)
global total_structs
@ -739,15 +613,13 @@ def doc_struct_index(structs):
def doc_struct_field(struct, field):
fid, ftype, fimmutable, lvt, lot, size = get_struct_field_info(struct, field)
sid = struct['identifier']
if sid in override_field_invisible:
if fid in override_field_invisible[sid]:
return '', False
if sid in override_field_deprecated:
if fid in override_field_deprecated[sid]:
return '', False
if not allowed_identifier(structs_fields_whitelist, structs_fields_blacklist, sid, fid):
return '', False
if not allowed_identifier(None, structs_fields_hidden, sid, fid):
return '', False
if '???' in lvt or '???' in lot:
return '', False
@ -823,13 +695,13 @@ def doc_struct(struct):
return s
def doc_structs(structs):
structs.extend(parse_structs(sLuaManuallyDefinedStructs, False)) # Don't sort fields for vec types in the documentation
structs.extend(parse_structs(lua_manually_defined_structs, False)) # Don't sort fields for vec types in the documentation
structs = sorted(structs, key=lambda d: d['identifier'])
s = '## [:rewind: Lua Reference](lua.md)\n\n'
s += doc_struct_index(structs)
for struct in structs:
if struct['identifier'] in exclude_structs:
if struct['identifier'] in structs_excluded:
continue
s += doc_struct(struct) + '\n'
@ -878,13 +750,11 @@ def def_struct(struct):
for field in struct['fields']:
fid, ftype, fimmutable, lvt, lot, size = get_struct_field_info(struct, field)
if sid in override_field_invisible:
if fid in override_field_invisible[sid]:
continue
if not allowed_identifier(structs_fields_whitelist, structs_fields_blacklist, sid, fid):
continue
if sid in override_field_deprecated:
if fid in override_field_deprecated[sid]:
continue
if not allowed_identifier(None, structs_fields_hidden, sid, fid):
continue
if '???' in lvt or '???' in lot:
continue
@ -911,7 +781,7 @@ def def_structs(structs):
s = '-- AUTOGENERATED FOR CODE EDITORS --\n'
for struct in structs:
if struct['identifier'] in exclude_structs:
if struct['identifier'] in structs_excluded:
continue
s += def_struct(struct)
@ -926,7 +796,7 @@ def def_structs(structs):
def build_files():
extracted = []
for in_file in in_files:
for in_file in structs_files:
path = get_path(in_file)
extracted.append({
'path': in_file,

477
autogen/exposed_lists.py Normal file
View file

@ -0,0 +1,477 @@
#############
# CONSTANTS #
#############
# Autogen will look in these files for constants
constants_files = [
"include/types.h",
"include/sm64.h",
"src/pc/lua/smlua_hooks.h",
"src/game/area.h",
"src/game/camera.h",
"include/mario_animation_ids.h",
"include/sounds.h",
"src/game/characters.h",
"src/pc/network/network.h",
"src/pc/network/network_player.h",
"include/PR/os_cont.h",
"src/game/interaction.c",
"src/game/interaction.h",
"src/pc/djui/djui_hud_utils.h",
"src/pc/controller/controller_mouse.h",
"include/behavior_table.h",
"src/pc/lua/utils/smlua_model_utils.h",
"src/pc/lua/utils/smlua_misc_utils.h",
"include/object_constants.h",
"include/mario_geo_switch_case_ids.h",
"src/game/object_list_processor.h",
"src/engine/graph_node.h",
"levels/level_defines.h",
"levels/course_defines.h",
"src/game/obj_behaviors.c",
"src/game/save_file.h",
"src/game/obj_behaviors_2.h",
"include/dialog_ids.h",
"include/seq_ids.h",
"include/surface_terrains.h",
"src/game/level_update.h",
"src/pc/network/version.h",
"include/geo_commands.h",
"include/level_commands.h",
"src/audio/external.h",
"src/game/envfx_snow.h",
"src/pc/mods/mod_storage.h",
"src/pc/mods/mod_fs.h",
"src/game/first_person_cam.h",
"src/pc/djui/djui_console.h",
"src/game/player_palette.h",
"src/pc/network/lag_compensation.h",
"src/pc/djui/djui_panel_menu.h",
"src/engine/lighting_engine.h",
"include/PR/gbi.h",
"include/PR/gbi_extension.h",
"src/pc/gfx/gfx_pc.h",
"src/engine/surface_load.h",
"src/pc/lua/utils/smlua_audio_utils.h",
"src/pc/voice_chat.h",
]
# For each file, expose only these constants
constants_whitelist = { "__name__": "constants_whitelist",
"include/geo_commands.h": [ "BACKGROUND" ],
"include/level_commands.h": [ "WARP_CHECKPOINT", "WARP_NO_CHECKPOINT" ],
"src/audio/external.h": [ "SEQ_PLAYER", "DS_" ],
"src/pc/lua/utils/smlua_audio_utils.h": ["MOD_AUDIO_CHANNEL"],
"src/pc/mods/mod_storage.h": [ "MAX_KEYS", "MAX_KEY_VALUE_LENGTH" ],
"include/PR/gbi.h": [
"^G_NOOP$",
"^G_SETOTHERMODE_H$",
"^G_SETOTHERMODE_L$",
"^G_ENDDL$",
"^G_DL$",
"^G_MOVEMEM$",
"^G_MOVEWORD$",
"^G_MTX$",
"^G_GEOMETRYMODE$",
"^G_POPMTX$",
"^G_TEXTURE$",
"^G_COPYMEM$",
"^G_VTX$",
"^G_TRI1$",
"^G_TRI2$",
"^G_SETCIMG$",
"^G_SETZIMG$",
"^G_SETTIMG$",
"^G_SETCOMBINE$",
"^G_SETENVCOLOR$",
"^G_SETPRIMCOLOR$",
"^G_SETBLENDCOLOR$",
"^G_SETFOGCOLOR$",
"^G_SETFILLCOLOR$",
"^G_FILLRECT$",
"^G_SETTILE$",
"^G_LOADTILE$",
"^G_LOADBLOCK$",
"^G_SETTILESIZE$",
"^G_LOADTLUT$",
"^G_SETSCISSOR$",
"^G_TEXRECTFLIP$",
"^G_TEXRECT$",
],
"include/PR/gbi_extension.h": [
"^G_VTX_EXT$",
"^G_PPARTTOCOLOR$",
"^G_SETENVRGB$",
"^G_STATE_EXT$",
],
}
# For each file, do not expose these constants
constants_blacklist = { "__name__": "constants_blacklist",
"*": [ "^MAXCONTROLLERS$", "^AREA_[^T].*", "^AREA_T[HTO]", "^CONT_ERR.*", "^READ_MASK$", "^SIGN_RANGE$" ],
"include/sm64.h": [ "END_DEMO" ],
"include/types.h": [ "GRAPH_NODE_GUARD" ],
"src/audio/external.h": [ "DS_DIFF" ],
"src/game/save_file.h": [ "EEPROM_SIZE" ],
"src/game/obj_behaviors.c": [ "^o$" ],
"src/pc/djui/djui_console.h": [ "CONSOLE_MAX_TMP_BUFFER" ],
"src/pc/lua/smlua_hooks.h": [ "^LUA_BEHAVIOR_.*", "MAX_HOOKED_.*", "^HOOK_RETURN_.*", "^ACTION_HOOK_.*", "^MOD_MENU_ELEMENT_.*" ],
"src/pc/djui/djui_panel_menu.h": [ "RAINBOW_TEXT_LEN" ],
"src/pc/mods/mod_fs.h": [ "INT_TYPE_MAX", "FLOAT_TYPE_MAX", "FILE_SEEK_MAX" ],
"src/engine/surface_load.h": [ "NUM_CELLS" ],
"src/pc/network/version.h": [ "VERSION_OFFSET" ],
}
# For each file, expose these constants, but hide them from the documentation or VSCode autocomplete
constants_hidden = { "__name__": "constants_hidden",
"interaction.h": [ "INTERACT_UNKNOWN_08" ],
}
#############
# FUNCTIONS #
#############
# Autogen will look in these files for functions
functions_files = [
"src/audio/external.h",
"src/engine/math_util.h",
"src/engine/math_util.inl",
"src/engine/math_util_vec3f.inl",
"src/engine/math_util_vec3i.inl",
"src/engine/math_util_vec3s.inl",
"src/engine/math_util_mat4.inl",
"src/engine/surface_collision.h",
"src/engine/surface_load.h",
"src/game/camera.h",
"src/game/characters.h",
"src/game/mario_actions_airborne.c",
"src/game/mario_actions_automatic.c",
"src/game/mario_actions_cutscene.c",
"src/game/mario_actions_moving.c",
"src/game/mario_actions_object.c",
"src/game/mario_actions_stationary.c",
"src/game/mario_actions_submerged.c",
"src/game/mario_step.h",
"src/game/mario.h",
"src/game/rumble_init.h",
"src/pc/djui/djui_popup.h",
"src/pc/network/network_utils.h",
"src/pc/djui/djui_console.h",
"src/pc/djui/djui_chat_message.h",
"src/pc/djui/djui_language.h",
"src/game/interaction.h",
"src/game/level_info.h",
"src/game/save_file.h",
"src/game/sound_init.h",
"src/pc/djui/djui_hud_utils.h",
"src/pc/djui/djui_panel_menu.h",
"src/pc/network/network_player.h",
"src/pc/network/lag_compensation.h",
"include/behavior_table.h",
"src/pc/lua/utils/smlua_obj_utils.h",
"src/pc/lua/utils/smlua_misc_utils.h",
"src/pc/lua/utils/smlua_camera_utils.h",
"src/pc/lua/utils/smlua_gfx_utils.h",
"src/pc/lua/utils/smlua_collision_utils.h",
"src/pc/lua/utils/smlua_model_utils.h",
"src/pc/lua/utils/smlua_text_utils.h",
"src/pc/lua/utils/smlua_audio_utils.h",
"src/pc/lua/utils/smlua_level_utils.h",
"src/pc/lua/utils/smlua_anim_utils.h",
"src/pc/lua/utils/smlua_deprecated.h",
"src/game/object_helpers.c",
"src/game/obj_behaviors.c",
"src/game/obj_behaviors_2.c",
"src/game/platform_displacement.h",
"src/game/spawn_sound.h",
"src/game/object_list_processor.h",
"src/game/behavior_actions.h",
"src/game/mario_misc.h",
"src/pc/mods/mod_storage.h",
"src/pc/mods/mod_fs.h",
"src/pc/utils/misc.h",
"src/game/level_update.h",
"src/game/area.h",
"src/engine/level_script.h",
"src/game/ingame_menu.h",
"src/game/first_person_cam.h",
"src/engine/behavior_script.h",
"src/audio/seqplayer.h",
"src/engine/lighting_engine.h",
"src/pc/network/sync_object.h",
"src/audio/load.h",
"src/pc/djui/djui_gfx.h",
"src/pc/voice_chat.h"
]
# For each file, expose only these functions
functions_whitelist = { "__name__": "functions_whitelist",
"src/audio/external.h": [ " play_", "fade", "current_background", "stop_", "sound_banks", "drop_queued_background_music", "set_sound_moving_speed", "background_music_default_volume", "get_sound_pan", "sound_get_level_intensity", "set_audio_muted" ],
"src/game/rumble_init.h": [ "queue_rumble_", "reset_rumble_", "cancel_rumble", "is_rumble_finished_and_queue_empty" ],
"src/pc/djui/djui_popup.h": [ "create" ],
"src/pc/djui/djui_language.h": [ "djui_language_get" ],
"src/pc/djui/djui_panel_menu.h": [ "djui_menu_get_rainbow_string_color" ],
"src/game/save_file.h": [ "get_level_", "save_file_get_", "save_file_set_flags", "save_file_clear_flags", "save_file_reload", "save_file_erase_current_backup_save", "save_file_set_star_flags", "save_file_is_cannon_unlocked", "save_file_set_cannon_unlocked", "touch_coin_score_age", "save_file_set_course_coin_score", "save_file_do_save", "save_file_remove_star_flags", "save_file_erase" ],
"src/pc/lua/utils/smlua_model_utils.h": [ "smlua_model_util_get_id" ],
"src/game/object_list_processor.h": [ "set_object_respawn_info_bits" ],
"src/game/platform_displacement.h": [ "apply_platform_displacement" ],
"src/game/mario_misc.h": [ "bhv_toad.*", "bhv_unlock_door.*", "geo_get_.*" ],
"src/game/level_update.h": [ "level_trigger_warp", "get_painting_warp_node", "initiate_warp", "initiate_painting_warp", "warp_special", "lvl_set_current_level", "level_control_timer_running", "pressed_pause", "fade_into_special_warp", "get_instant_warp" ],
"src/game/area.h": [ "get_mario_spawn_type", "area_get_warp_node", "area_get_any_warp_node", "play_transition" ],
"src/engine/level_script.h": [ "area_create_warp_node" ],
"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" ],
"src/pc/djui/djui_gfx.h": [ "djui_gfx_get_scale" ],
}
# For each file, do not expose these functions
functions_blacklist = { "__name__": "functions_blacklist",
"src/audio/external.h": [ " func_" ],
"src/engine/surface_load.h": [ "load_area_terrain", "alloc_surface_pools", "clear_dynamic_surfaces", "get_area_terrain_size", "alloc_surface", "add_surface", "remove_surface_from_partition", "delete_surface", "swap_and_pop_surface_pool", "add_surface_without_hook" ],
"src/engine/surface_collision.h": [ " debug_", "f32_find_wall_collision" ],
"src/game/mario_actions_airborne.c": [ "^[us]32 act_.*" ],
"src/game/mario_actions_automatic.c": [ "^[us]32 act_.*" ],
"src/game/mario_actions_cutscene.c": [ "^[us]32 act_.*", " geo_", "spawn_obj", "print_displaying_credits_entry" ],
"src/game/mario_actions_moving.c": [ "^[us]32 act_.*" ],
"src/game/mario_actions_object.c": [ "^[us]32 act_.*" ],
"src/game/mario_actions_stationary.c": [ "^[us]32 act_.*", "mario_exit_palette_editor" ],
"src/game/mario_actions_submerged.c": [ "^[us]32 act_.*" ],
"src/game/mario_step.h": [ " stub_mario_step", "transfer_bully_speed" ],
"src/game/mario.h": [ " init_mario" ],
"src/pc/djui/djui_console.h": [ " djui_console_create", "djui_console_message_create", "djui_console_message_dequeue" ],
"src/pc/djui/djui_chat_message.h": [ "create_from" ],
"src/pc/djui/djui_hud_utils.h": [ "djui_hud_clear_interp_data", "djui_hud_print_text", "djui_hud_print_text_interpolated" ],
"src/game/interaction.h": [ "process_interaction", "_handle_" ],
"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_", "geo_", "abs[fi]", "^bit_shift", "_debug$", "stub_", "_set_model", "cur_obj_set_direction_table", "cur_obj_progress_direction_table", "bit_shift_left" ],
"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", "calc_dist_to_volume_range" ],
"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": [ "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"],
"src/pc/lua/utils/smlua_anim_utils.h": [ "smlua_anim_util_reset", "smlua_anim_util_register_animation" ],
"src/pc/lua/utils/smlua_gfx_utils.h": [ "gfx_allocate_internal", "vtx_allocate_internal", "gfx_get_length_no_sentinel" ],
"src/pc/network/lag_compensation.h": [ "lag_compensation_clear" ],
"src/game/first_person_cam.h": [ "first_person_update" ],
"src/pc/lua/utils/smlua_collision_utils.h": [ "collision_find_surface_on_ray" ],
"src/engine/behavior_script.h": [ "stub_behavior_script_2", "cur_obj_update" ],
"src/pc/mods/mod_storage.h": [ "mod_storage_shutdown" ],
"src/pc/mods/mod_fs.h": [ "mod_fs_read_file_from_uri", "mod_fs_shutdown" ],
"src/pc/utils/misc.h": [ "str_.*", "file_get_line", "delta_interpolate_(normal|rgba|mtx)", "detect_and_skip_mtx_interpolation", "precise_delay_f64", "can_update_game", "update_game", "open_url", "open_folder" ],
"src/engine/lighting_engine.h": [ "le_calculate_vertex_lighting", "le_clear", "le_shutdown" ],
"src/pc/voice_chat.h": [ "voicechat_init", "voicechat_shutdown", "voicechat_init_player", "voicechat_encode_audio", "voicechat_decode_audio", "voicechat_mix", "voicechat_push_pending_global_mute", "voicechat_resolve_pending_global_mutes" ],
}
# For each file, expose these functions, but hide them from the documentation or VSCode autocomplete
functions_hidden = { "__name__": "functions_hidden",
"smlua_deprecated.h": [ ".*" ],
"network_player.h": [ "network_player_get_palette_color_channel", "network_player_get_override_palette_color_channel" ],
}
# For each function, expose it except for the specified version
functions_version_excludes = {
"bhv_play_music_track_when_touched_loop": "VERSION_JP",
"play_knockback_sound": "VERSION_JP",
"cur_obj_spawn_star_at_y_offset": "VERSION_JP",
}
# For each function parameter, specify its type
functions_params_types = {
"src/pc/lua/utils/smlua_obj_utils.h::spawn_object_sync::objSetupFunction": [ "struct Object*" ],
}
###########
# STRUCTS #
###########
# Autogen will look in these files for structs
structs_files = [
"include/types.h",
"src/game/area.h",
"src/game/camera.h",
"src/game/characters.h",
"src/engine/surface_collision.h",
"src/pc/network/network_player.h",
"src/pc/djui/djui_hud_utils.h",
"src/pc/djui/djui_theme.h",
"src/game/object_helpers.h",
"src/game/mario_step.h",
"src/game/ingame_menu.h",
"src/pc/lua/utils/smlua_anim_utils.h",
"src/pc/lua/utils/smlua_misc_utils.h",
"src/pc/lua/utils/smlua_camera_utils.h",
"src/pc/lua/utils/smlua_collision_utils.h",
"src/pc/lua/utils/smlua_level_utils.h",
"src/game/spawn_sound.h",
"src/pc/network/network.h",
"src/game/hardcoded.h",
"src/pc/mods/mod.h",
"src/pc/mods/mod_fs.h",
"src/pc/lua/utils/smlua_audio_utils.h",
"src/game/paintings.h",
"src/pc/djui/djui_types.h",
"src/game/level_update.h",
"src/game/first_person_cam.h",
"src/game/player_palette.h",
"src/engine/graph_node.h",
"include/PR/gbi.h",
"src/pc/voice_chat.h",
]
# For each file, expose only these structs
structs_whitelist = { "__name__": "structs_whitelist",
"src/pc/network/network.h": [ "ServerSettings", "NametagsSettings" ],
"src/pc/djui/djui_types.h": [ "DjuiColor" ],
"src/game/level_update.h": [ "HudDisplay" ],
"src/game/player_palette.h": [ "PlayerPalette" ],
"src/game/ingame_menu.h" : [ "DialogEntry" ],
"include/PR/gbi.h": [ "Gfx", "^Vtx$" ],
"src/pc/voice_chat.h": [ "VoicePlayer" ],
}
# For each file, do not expose these structs
structs_blacklist = { "__name__": "structs_blacklist",
}
# Ignore these structs entirely across all files
structs_excluded = [
'AnimationTable',
'BullyCollisionData',
'CameraFOVStatus',
'CameraStoredInfo',
'CameraTrigger',
'Cutscene',
'CutsceneSplinePoint',
'CutsceneVariable',
'FloorGeometry',
'GraphNode_802A45E4',
'HandheldShakePoint',
'LinearTransitionPoint',
'MarioAnimDmaRelatedThing',
'ModAudioSampleCopies',
'ModFile',
'ModeTransitionInfo',
'OffsetSizePair',
'PaintingMeshVertex',
'ParallelTrackingPoint',
'PlayerGeometry',
'SPTask',
'SoundState',
'TransitionInfo',
'UnusedArea28',
'VblankHandler',
'Vtx_Interp',
'WarpTransition',
'WarpTransitionData',
]
# For each struct, expose only these fields
structs_fields_whitelist = { "__name__": "structs_fields_whitelist",
}
# For each struct, do not expose these fields
structs_fields_blacklist = { "__name__": "structs_fields_blacklist",
"Mod": [ "files", "showedScriptWarning", "customBehaviorIndex", "customObjectFields" ],
"Camera": [ "paletteEditorCapState" ],
"NetworkPlayer": [ "gag", "moderator", "discordId", "rxPacketHash", "rxSeqIds" ],
"GraphNode": [ "_guard1", "_guard2", "padding" ],
"GraphNodeRoot": ["unk15", "views"],
"GraphNodeMasterList": [ "listHeads", "listTails" ],
"GraphNodeCullingRadius": [ "pad1E" ],
"GraphNodeTranslation": [ "pad1E" ],
"GraphNodeBackground": [ "unused" ],
"GraphNodePerspective": [ "unused" ],
"GraphNodeSwitchCase": [ "unused" ],
"GraphNodeObject": [ "unk4C" ],
"FnGraphNode": [ "luaTokenIndex" ],
"Object": [ "firstSurface", "customFields", "bhvStack", "bhvStackIndex" ],
"Animation": [ "unusedBoneCount" ],
"ModAudio": [ "alive", "sound", "decoder", "buffer", "bufferSize", "sampleCopiesTail", "volChannel" ],
"Painting": [ "normalDisplayList", "textureMaps", "rippleDisplayList", "ripples" ],
"DialogEntry": [ "str" ],
"ModFsFile": [ "data", "capacity" ],
"ModFs": [ "files" ],
"VoicePlayer": [ "internal" ],
}
# For each struct, expose these fields, but hide them from the documentation or VSCode autocomplete
structs_fields_hidden = { "__name__": "structs_fields_hidden",
"NetworkPlayer": [ "paletteIndex", "overridePaletteIndex", "overridePaletteIndexLp" ],
"ModAudio": [ "^file$", "relativePath" ], # compatibility band-aid
"Camera": [ "filler31", "filler3C", "unusedVec1" ],
"LakituState": [ "filler30", "filler3E", "filler72", "unusedVec1", "unusedVec2" ],
"SpawnInfo": [ "unk18" ],
}
# For each struct field, expose it except for the specified version
structs_fields_version_excludes = {
"oCameraLakituMusicPlayed": "VERSION_JP",
"oCoinUnk1B0": "VERSION_JP",
}
# For each struct and field, specify its type
structs_fields_types = {
"Surface": {
"normal": "Vec3f"
},
"Object": {
"oAnimations": "ObjectAnimPointer*"
},
}
# For each struct, specify which fields are mutable (read and write)
structs_fields_mutable = {
"NetworkPlayer": [ "overrideModelIndex", "overridePalette", "overridePaletteIndex" ],
}
# For each struct, specify which fields are immutable (read-only)
structs_fields_immutable = {
"MarioState": [ "playerIndex", "controller", "marioObj", "marioBodyState", "statusForCamera", "area", "dialogId" ],
"MarioAnimation": [ "animDmaTable" ],
"ObjectNode": [ "next", "prev" ],
"Character": [ "*" ],
"NetworkPlayer": [ "*" ],
"TextureInfo": [ "*" ],
"Object": ["oSyncID", "coopFlags", "oChainChompSegments", "oWigglerSegments", "oHauntedChairUnk100", "oTTCTreadmillBigSurface", "oTTCTreadmillSmallSurface", "bhvStackIndex", "respawnInfoType", "numSurfaces", "bhvStack" ],
"Surface": [ "poolType", "socId" ],
"GlobalObjectAnimations": [ "*"],
"SpawnParticlesInfo": [ "model" ],
"WaterDropletParams": [ "model" ],
"MarioBodyState": [ "updateTorsoTime", "updateHeadPosTime", "animPartsPos", "animPartsRot", "currAnimPart" ],
"Area": [ "localAreaTimer", "nextSyncID", "objectSpawnInfos", "paintingWarpNodes", "warpNodes" ],
"Mod": [ "*" ],
"ModFile": [ "*" ],
"Painting": [ "id", "imageCount", "textureType", "textureWidth", "textureHeight" ],
"SpawnInfo": [ "syncID", "next", "unk18" ],
"CustomLevelInfo": [ "next" ],
"GraphNode": [ "children", "next", "parent", "prev", "type" ],
"GraphNodeBackground": [ "prevCameraTimestamp", "unused" ],
"GraphNodeCamera": [ "matrixPtrPrev", "prevTimestamp" ],
"GraphNodeHeldObject": [ "prevShadowPosTimestamp" ],
"GraphNodeObject": [ "angle", "animInfo", "cameraToObject", "node", "pos", "prevAngle", "prevPos", "prevScale", "prevScaleTimestamp", "prevShadowPos", "prevShadowPosTimestamp", "prevThrowMatrix", "prevThrowMatrixTimestamp", "prevTimestamp", "scale", "shadowPos", "sharedChild", "skipInterpolationTimestamp", "throwMatrixPrev", "unk4C", ],
"GraphNodeObjectParent": [ "sharedChild" ],
"GraphNodePerspective": [ "unused" ],
"GraphNodeSwitchCase": [ "fnNode", "unused" ],
"GraphNodeRoot": ["node", "areaIndex", "numViews"],
"ObjectWarpNode": [ "next" ],
"Animation": [ "*" ],
"AnimationTable": [ "*" ],
"Controller": [ "controllerData", "statusData" ],
"FirstPersonCamera": [ "enabled" ],
"ModAudio": [ "isStream", "loaded" ],
"Gfx": [ "w0", "w1" ], # to protect from invalid type conversions
"DialogEntry": [ "unused", "linesPerBox", "leftOffset", "width", "str", "text", "replaced"],
"ModFsFile": [ "*" ],
"ModFs": [ "*" ],
"StaticObjectCollision": [ "*" ],
"VoicePlayer": [ "talking", "error", "clientMutedState", "playerMutedState" ],
}

View file

@ -11,8 +11,21 @@ def extract_level_defines(txt):
txt += ' LEVEL_COUNT,\n };'
return txt
def extract_course_defines(txt):
tmp = txt
txt = 'enum CourseNum {\n'
for line in tmp.splitlines():
if line.startswith('DEFINE_COURSE(') or line.startswith('DEFINE_BONUS_COURSE('):
txt += ' ' + line.replace('(', ',').split(',')[1].strip() + ',\n'
txt += ' COURSE_END,\n'
txt += ' COURSE_COUNT = COURSE_END - 1,\n'
txt += ' COURSE_MAX = COURSE_COUNT,\n'
txt += ' COURSE_MIN = 1,\n };'
return txt
extra_steps = {
"levels/level_defines.h": extract_level_defines,
"levels/course_defines.h": extract_course_defines,
}
def extract_constants(filename):

View file

@ -79,72 +79,6 @@ function SOUND_ARG_LOAD(bank, soundID, priority, flags)
)
end
-------------
-- courses --
-------------
--- @type integer
COURSE_NONE = 0
--- @type integer
COURSE_BOB = 1
--- @type integer
COURSE_WF = 2
--- @type integer
COURSE_JRB = 3
--- @type integer
COURSE_CCM = 4
--- @type integer
COURSE_BBH = 5
--- @type integer
COURSE_HMC = 6
--- @type integer
COURSE_LLL = 7
--- @type integer
COURSE_SSL = 8
--- @type integer
COURSE_DDD = 9
--- @type integer
COURSE_SL = 10
--- @type integer
COURSE_WDW = 11
--- @type integer
COURSE_TTM = 12
--- @type integer
COURSE_THI = 13
--- @type integer
COURSE_TTC = 14
--- @type integer
COURSE_RR = 15
--- @type integer
COURSE_BITDW = 16
--- @type integer
COURSE_BITFS = 17
--- @type integer
COURSE_BITS = 18
--- @type integer
COURSE_PSS = 19
--- @type integer
COURSE_COTMC = 20
--- @type integer
COURSE_TOTWC = 21
--- @type integer
COURSE_VCUTM = 22
--- @type integer
COURSE_WMOTR = 23
--- @type integer
COURSE_SA = 24
--- @type integer
COURSE_CAKE_END = 25
--- @type integer
COURSE_END = 26
--- @type integer
COURSE_MAX = 25
--- @type integer
COURSE_COUNT = 25
--- @type integer
COURSE_MIN = 1
------------------------------
-- player palette functions --
------------------------------
@ -174,326 +108,3 @@ function network_player_get_override_palette_color(np, part)
}
return color
end
--------------------------
-- local math functions --
--------------------------
local __math_min, __math_max, __math_sqrt, __math_floor, __math_ceil, __math_cos, __math_sin, __math_pi = math.min, math.max, math.sqrt, math.floor, math.ceil, math.cos, math.sin, math.pi
------------
-- tweens --
------------
-- Unrelated to SM64, but these are for `math.tween`
---@param x number
---@return number
IN_SINE = function (x) return 1 - __math_cos((x * __math_pi) / 2) end
---@param x number
---@return number
OUT_SINE = function (x) return __math_sin((x * __math_pi) / 2) end
---@param x number
---@return number
IN_OUT_SINE = function (x) return -(__math_cos(__math_pi * x) - 1) / 2 end
---@param x number
---@return number
OUT_IN_SINE = function (x) return x < 0.5 and 0.5 * __math_sin(x * __math_pi) or 1 - 0.5 * __math_cos(((x * 2 - 1) * (__math_pi / 2))) end
---@param x number
---@return number
IN_QUAD = function (x) return x ^ 2 end
---@param x number
---@return number
OUT_QUAD = function (x) return 1 - ((1 - x) ^ 2) end
---@param x number
---@return number
IN_OUT_QUAD = function (x) return x < 0.5 and 2 * (x ^ 2) or 1 - ((-2 * x + 2) ^ 2) / 2 end
---@param x number
---@return number
OUT_IN_QUAD = function (x) return x < 0.5 and 0.5 * (-(2 * x) * ((2 * x) - 2)) or 0.5 + 0.5 * (2 * x - 1) ^ 2 end
---@param x number
---@return number
IN_CUBIC = function (x) return x ^ 3 end
---@param x number
---@return number
OUT_CUBIC = function (x) return 1 - ((1 - x) ^ 3) end
---@param x number
---@return number
IN_OUT_CUBIC = function (x) return x < 0.5 and 4 * (x ^ 3) or 1 - ((-2 * x + 2) ^ 3) / 2 end
---@param x number
---@return number
OUT_IN_CUBIC = function (x) return x < 0.5 and 0.5 * (((2 * x - 1) ^ 3) + 1) or 0.5 + 0.5 * (2 * x - 1) ^ 3 end
---@param x number
---@return number
IN_QUART = function (x) return x ^ 4 end
---@param x number
---@return number
OUT_QUART = function (x) return 1 - ((1 - x) ^ 4) end
---@param x number
---@return number
IN_OUT_QUART = function (x) return x < 0.5 and 8 * (x ^ 4) or 1 - ((-2 * x + 2) ^ 4) / 2 end
---@param x number
---@return number
OUT_IN_QUART = function (x) return x < 0.5 and 0.5 * (1 - ((2 * x - 1) ^ 4)) or 0.5 + 0.5 * (2 * x - 1) ^ 4 end
---@param x number
---@return number
IN_QUINT = function (x) return x ^ 5 end
---@param x number
---@return number
OUT_QUINT = function (x) return 1 - ((1 - x) ^ 5) end
---@param x number
---@return number
IN_OUT_QUINT = function (x) return x < 0.5 and 16 * (x ^ 5) or 1 - ((-2 * x + 2) ^ 5) / 2 end
---@param x number
---@return number
OUT_IN_QUINT = function (x) return x < 0.5 and 0.5 * (((2 * x - 1) ^ 5) + 1) or 0.5 + 0.5 * (2 * x - 1) ^ 5 end
---@param x number
---@return number
IN_EXPO = function (x) return x == 0 and x or 2 ^ (10 * x - 10) end
---@param x number
---@return number
OUT_EXPO = function (x) return x == 1 and x or 1 - (2 ^ (-10 * x)) end
---@param x number
---@return number
IN_OUT_EXPO = function (x) return (x == 0 or x == 1) and x or x < 0.5 and (2 ^ (20 * x - 10)) / 2 or (2 - (2 ^ (-20 * x + 10))) / 2 end
---@param x number
---@return number
OUT_IN_EXPO = function (x) return (x == 0 or x == 1) and x or x < 0.5 and 0.5 * (1 - 2 ^ (-20 * x)) or 0.5 + 0.5 * (2 ^ (20 * x - 20)) end
---@param x number
---@return number
IN_CIRC = function (x) return 1 - __math_sqrt(1 - (x ^ 2)) end
---@param x number
---@return number
OUT_CIRC = function (x) return __math_sqrt(1 - ((x - 1) ^ 2)) end
---@param x number
---@return number
IN_OUT_CIRC = function (x) return x < 0.5 and (1 - __math_sqrt(1 - ((2 * x) ^ 2))) / 2 or (__math_sqrt(1 - ((-2 * x + 2) ^ 2)) + 1) / 2 end
---@param x number
---@return number
OUT_IN_CIRC = function (x) return x < 0.5 and 0.5 * __math_sqrt(1 - (2 * x - 1) ^ 2) or 0.5 + 0.5 * (1 - __math_sqrt(1 - (2 * x - 1) ^ 2)) end
---@param x number
---@return number
IN_BACK = function (x) return (1.70158 + 1) * (x ^ 3) - 1.70158 * (x ^ 2) end
---@param x number
---@return number
OUT_BACK = function (x) return 1 + (1.70158 + 1) * ((x - 1) ^ 3) + 1.70158 * ((x - 1) ^ 2) end
---@param x number
---@return number
IN_OUT_BACK = function (x) return x < 0.5 and (((2 * x) ^ 2) * (((1.70158 * 1.525) + 1) * 2 * x - (1.70158 * 1.525))) / 2 or (((2 * x - 2) ^ 2) * (((1.70158 * 1.525) + 1) * (x * 2 - 2) + (1.70158 * 1.525)) + 2) / 2 end
---@param x number
---@return number
OUT_IN_BACK = function (x) return x < 0.5 and 0.5 * (1 + (1.70158 + 1) * ((2 * x) - 1) ^ 3 + 1.70158 * ((2 * x) - 1) ^ 2) or 0.5 + 0.5 * ((1.70158 + 1) * (2 * x - 1) ^ 3 - 1.70158 * (2 * x - 1) ^ 2) end
---@param x number
---@return number
IN_ELASTIC = function (x) return (x == 0 or x == 1) and x or -(2 ^ (10 * x - 10)) * __math_sin((x * 10 - 10.75) * ((2 * __math_pi) / 3)) end
---@param x number
---@return number
OUT_ELASTIC = function (x) return (x == 0 or x == 1) and x or (2 ^ (-10 * x)) * __math_sin((x * 10 - 0.75) * ((2 * __math_pi) / 3)) + 1 end
---@param x number
---@return number
IN_OUT_ELASTIC = function (x) return (x == 0 or x == 1) and x or (x < 0.5 and (-0.5 * (2 ^ (20 * x - 10)) * __math_sin((20 * x - 11.125) * ((2 * __math_pi) / 4.5)))) or (0.5 * (2 ^ (-20 * x + 10)) * __math_sin((20 * x - 11.125) * ((2 * __math_pi) / 4.5)) + 1) end
---@param x number
---@return number
OUT_IN_ELASTIC = function (x) return (x == 0 or x == 1) and x or (x < 0.5 and 0.5 * ((2 ^ (-10 * (x * 2))) * __math_sin(((x * 2) * 10 - 0.75) * ((2 * __math_pi) / 3)) + 1)) or 0.5 + 0.5 * (-(2 ^ (10 * ((x - 0.5) * 2) - 10)) * __math_sin((((x - 0.5) * 2) * 10 - 10.75) * ((2 * __math_pi) / 3))) end
---@param x number
---@return number
IN_BOUNCE = function (x) return 1 - OUT_BOUNCE(1 - x) end
---@param x number
---@return number
OUT_BOUNCE = function (x) if x < 1 / 2.75 then return 7.5625 * (x ^ 2) elseif x < 2 / 2.75 then x = x - 1.5 / 2.75 return 7.5625 * (x ^ 2) + 0.75 elseif x < 2.5 / 2.75 then x = x - 2.25 / 2.75 return 7.5625 * (x ^ 2) + 0.9375 else x = x - 2.625 / 2.75 return 7.5625 * (x ^ 2) + 0.984375 end end
---@param x number
---@return number
IN_OUT_BOUNCE = function (x) return x < 0.5 and (1 - OUT_BOUNCE(1 - 2 * x)) / 2 or (1 + OUT_BOUNCE(2 * x - 1)) / 2 end
---@param x number
---@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 --
--------------------
--- Note: These functions don't exist in the Lua math library,
--- and are useful enough to not have to redefine them in every mod
--- @param x number
--- @return number
--- Computes the square of the number `x`
function math.sqr(x)
return x * x
end
--- @param x number
--- @param a number
--- @param b number
--- @return number
--- Clamps the number `x` between bounds `a` (minimum) and `b` (maximum)
function math.clamp(x, a, b)
return __math_min(__math_max(x, a), b)
end
--- @param a number
--- @param b number
--- @return number
--- Computes the hypotenuse of a right-angled triangle given sides `a` and `b` using the Pythagorean theorem
function math.hypot(a, b)
return __math_sqrt(a * a + b * b)
end
--- @param x number
--- @return number
--- Returns 1 if `x` is positive or zero, -1 otherwise
function math.sign(x)
return x >= 0 and 1 or -1
end
--- @param x number
--- @return number
--- Returns 1 if `x` is positive, 0 if it is zero, -1 otherwise
function math.sign0(x)
return x ~= 0 and (x > 0 and 1 or -1) or 0
end
--- @param a number
--- @param b number
--- @param t number
--- @return number
--- Linearly interpolates between `a` and `b` using delta `t`
function math.lerp(a, b, t)
return a + (b - a) * t
end
--- @param a number
--- @param b number
--- @param x number
--- @return number
--- Determines where `x` linearly lies between `a` and `b`. It's the inverse of `math.lerp`
function math.invlerp(a, b, x)
return (x - a) / (b - a)
end
--- @param a number
--- @param b number
--- @param c number
--- @param d number
--- @param x number
--- @return number
--- Linearly remaps `x` from the source range `[a, b]` to the destination range `[c, d]`
function math.remap(a, b, c, d, x)
return c + (d - c) * ((x - a) / (b - a))
end
--- @param x number
--- Rounds `x` to the nearest integer value
function math.round(x)
return x > 0 and __math_floor(x + 0.5) or __math_ceil(x - 0.5)
end
--- @param t EasingFunction | number
--- @param a number
--- @param b number
--- @param x number
--- @return number
--- Interpolates between `a` and `b` using delta `x` and a tweening or easing math function `t`
function math.tween(t, a, b, x)
local y
if type(t) == 'function' then
y = a + t(x) * (b - a)
else
y = a + t * (b - a)
end
return y
end
local __common_signed_conversion = function (x, size)
x = __math_floor(x) & (1 << size) - 1
return x - ((x & (1 << (size - 1))) << 1)
end
local __common_unsigned_conversion = function (x, size)
return __math_floor(x) & (1 << size) - 1
end
--- @param x number
--- @return integer
--- Converts `x` into a valid `s8` range
--- - `[-128, 127]`
function math.s8(x)
return __common_signed_conversion(x, 8)
end
--- @param x number
--- @return integer
--- Converts `x` into a valid `s16` range
--- - `[-32768, 32767]`
function math.s16(x)
return __common_signed_conversion(x, 16)
end
--- @param x number
--- @return integer
--- Converts `x` into a valid `s32` range
--- - `[-2147483648, 2147483647]`
function math.s32(x)
return __common_signed_conversion(x, 32)
end
--- @param x number
--- @return integer
--- Converts `x` into a valid `u8` range
--- - `[0, 255]`
function math.u8(x)
return __common_unsigned_conversion(x, 8)
end
--- @param x number
--- @return integer
--- Converts `x` into a valid `u16` range
--- - `[0, 65535]`
function math.u16(x)
return __common_unsigned_conversion(x, 16)
end
--- @param x number
--- @return integer
--- Converts `x` into a valid `u32` range
--- - `[0, 4294967295]`
function math.u32(x)
return __common_unsigned_conversion(x, 32)
end

View file

@ -4,7 +4,6 @@ FONT_TINY = -1
--- @type integer
ANIM_FLAG_FORWARD = (1 << 1)
-----------------------
-- Renamed functions --
-----------------------
@ -12,6 +11,14 @@ ANIM_FLAG_FORWARD = (1 << 1)
rom_hack_cam_set_collisions = camera_romhack_set_collisions
camera_romhack_allow_centering = camera_romhack_allow_switchable
camera_romhack_get_allow_centering = camera_romhack_get_allow_switchable
bhv_star_door_loop_2 = bhv_star_door_loop_update_render_state
absf_2 = math.abs
cur_obj_enable_rendering_2 = cur_obj_enable_rendering
cur_obj_can_mario_activate_textbox_2 = cur_obj_can_mario_activate_textbox
reset_rumble_timers_2 = reset_rumble_timers_vibrate
cur_obj_play_sound_1 = cur_obj_play_sound_if_visible
cur_obj_play_sound_2 = cur_obj_play_sound_and_rumble_if_visible
bit_shift_left = function (shift) return math.u8(1 << shift) end
--------------------
-- Math functions --

View file

@ -0,0 +1,318 @@
local __math_min, __math_max, __math_sqrt, __math_floor, __math_ceil, __math_cos, __math_sin, __math_pi = math.min, math.max, math.sqrt, math.floor, math.ceil, math.cos, math.sin, math.pi
------------
-- tweens --
------------
---@param x number
---@return number
IN_SINE = function (x) return 1 - __math_cos((x * __math_pi) / 2) end
---@param x number
---@return number
OUT_SINE = function (x) return __math_sin((x * __math_pi) / 2) end
---@param x number
---@return number
IN_OUT_SINE = function (x) return -(__math_cos(__math_pi * x) - 1) / 2 end
---@param x number
---@return number
OUT_IN_SINE = function (x) return x < 0.5 and 0.5 * __math_sin(x * __math_pi) or 1 - 0.5 * __math_cos(((x * 2 - 1) * (__math_pi / 2))) end
---@param x number
---@return number
IN_QUAD = function (x) return x ^ 2 end
---@param x number
---@return number
OUT_QUAD = function (x) return 1 - ((1 - x) ^ 2) end
---@param x number
---@return number
IN_OUT_QUAD = function (x) return x < 0.5 and 2 * (x ^ 2) or 1 - ((-2 * x + 2) ^ 2) / 2 end
---@param x number
---@return number
OUT_IN_QUAD = function (x) return x < 0.5 and 0.5 * (-(2 * x) * ((2 * x) - 2)) or 0.5 + 0.5 * (2 * x - 1) ^ 2 end
---@param x number
---@return number
IN_CUBIC = function (x) return x ^ 3 end
---@param x number
---@return number
OUT_CUBIC = function (x) return 1 - ((1 - x) ^ 3) end
---@param x number
---@return number
IN_OUT_CUBIC = function (x) return x < 0.5 and 4 * (x ^ 3) or 1 - ((-2 * x + 2) ^ 3) / 2 end
---@param x number
---@return number
OUT_IN_CUBIC = function (x) return x < 0.5 and 0.5 * (((2 * x - 1) ^ 3) + 1) or 0.5 + 0.5 * (2 * x - 1) ^ 3 end
---@param x number
---@return number
IN_QUART = function (x) return x ^ 4 end
---@param x number
---@return number
OUT_QUART = function (x) return 1 - ((1 - x) ^ 4) end
---@param x number
---@return number
IN_OUT_QUART = function (x) return x < 0.5 and 8 * (x ^ 4) or 1 - ((-2 * x + 2) ^ 4) / 2 end
---@param x number
---@return number
OUT_IN_QUART = function (x) return x < 0.5 and 0.5 * (1 - ((2 * x - 1) ^ 4)) or 0.5 + 0.5 * (2 * x - 1) ^ 4 end
---@param x number
---@return number
IN_QUINT = function (x) return x ^ 5 end
---@param x number
---@return number
OUT_QUINT = function (x) return 1 - ((1 - x) ^ 5) end
---@param x number
---@return number
IN_OUT_QUINT = function (x) return x < 0.5 and 16 * (x ^ 5) or 1 - ((-2 * x + 2) ^ 5) / 2 end
---@param x number
---@return number
OUT_IN_QUINT = function (x) return x < 0.5 and 0.5 * (((2 * x - 1) ^ 5) + 1) or 0.5 + 0.5 * (2 * x - 1) ^ 5 end
---@param x number
---@return number
IN_EXPO = function (x) return x == 0 and x or 2 ^ (10 * x - 10) end
---@param x number
---@return number
OUT_EXPO = function (x) return x == 1 and x or 1 - (2 ^ (-10 * x)) end
---@param x number
---@return number
IN_OUT_EXPO = function (x) return (x == 0 or x == 1) and x or x < 0.5 and (2 ^ (20 * x - 10)) / 2 or (2 - (2 ^ (-20 * x + 10))) / 2 end
---@param x number
---@return number
OUT_IN_EXPO = function (x) return (x == 0 or x == 1) and x or x < 0.5 and 0.5 * (1 - 2 ^ (-20 * x)) or 0.5 + 0.5 * (2 ^ (20 * x - 20)) end
---@param x number
---@return number
IN_CIRC = function (x) return 1 - __math_sqrt(1 - (x ^ 2)) end
---@param x number
---@return number
OUT_CIRC = function (x) return __math_sqrt(1 - ((x - 1) ^ 2)) end
---@param x number
---@return number
IN_OUT_CIRC = function (x) return x < 0.5 and (1 - __math_sqrt(1 - ((2 * x) ^ 2))) / 2 or (__math_sqrt(1 - ((-2 * x + 2) ^ 2)) + 1) / 2 end
---@param x number
---@return number
OUT_IN_CIRC = function (x) return x < 0.5 and 0.5 * __math_sqrt(1 - (2 * x - 1) ^ 2) or 0.5 + 0.5 * (1 - __math_sqrt(1 - (2 * x - 1) ^ 2)) end
---@param x number
---@return number
IN_BACK = function (x) return (1.70158 + 1) * (x ^ 3) - 1.70158 * (x ^ 2) end
---@param x number
---@return number
OUT_BACK = function (x) return 1 + (1.70158 + 1) * ((x - 1) ^ 3) + 1.70158 * ((x - 1) ^ 2) end
---@param x number
---@return number
IN_OUT_BACK = function (x) return x < 0.5 and (((2 * x) ^ 2) * (((1.70158 * 1.525) + 1) * 2 * x - (1.70158 * 1.525))) / 2 or (((2 * x - 2) ^ 2) * (((1.70158 * 1.525) + 1) * (x * 2 - 2) + (1.70158 * 1.525)) + 2) / 2 end
---@param x number
---@return number
OUT_IN_BACK = function (x) return x < 0.5 and 0.5 * (1 + (1.70158 + 1) * ((2 * x) - 1) ^ 3 + 1.70158 * ((2 * x) - 1) ^ 2) or 0.5 + 0.5 * ((1.70158 + 1) * (2 * x - 1) ^ 3 - 1.70158 * (2 * x - 1) ^ 2) end
---@param x number
---@return number
IN_ELASTIC = function (x) return (x == 0 or x == 1) and x or -(2 ^ (10 * x - 10)) * __math_sin((x * 10 - 10.75) * ((2 * __math_pi) / 3)) end
---@param x number
---@return number
OUT_ELASTIC = function (x) return (x == 0 or x == 1) and x or (2 ^ (-10 * x)) * __math_sin((x * 10 - 0.75) * ((2 * __math_pi) / 3)) + 1 end
---@param x number
---@return number
IN_OUT_ELASTIC = function (x) return (x == 0 or x == 1) and x or (x < 0.5 and (-0.5 * (2 ^ (20 * x - 10)) * __math_sin((20 * x - 11.125) * ((2 * __math_pi) / 4.5)))) or (0.5 * (2 ^ (-20 * x + 10)) * __math_sin((20 * x - 11.125) * ((2 * __math_pi) / 4.5)) + 1) end
---@param x number
---@return number
OUT_IN_ELASTIC = function (x) return (x == 0 or x == 1) and x or (x < 0.5 and 0.5 * ((2 ^ (-10 * (x * 2))) * __math_sin(((x * 2) * 10 - 0.75) * ((2 * __math_pi) / 3)) + 1)) or 0.5 + 0.5 * (-(2 ^ (10 * ((x - 0.5) * 2) - 10)) * __math_sin((((x - 0.5) * 2) * 10 - 10.75) * ((2 * __math_pi) / 3))) end
---@param x number
---@return number
IN_BOUNCE = function (x) return 1 - OUT_BOUNCE(1 - x) end
---@param x number
---@return number
OUT_BOUNCE = function (x) if x < 1 / 2.75 then return 7.5625 * (x ^ 2) elseif x < 2 / 2.75 then x = x - 1.5 / 2.75 return 7.5625 * (x ^ 2) + 0.75 elseif x < 2.5 / 2.75 then x = x - 2.25 / 2.75 return 7.5625 * (x ^ 2) + 0.9375 else x = x - 2.625 / 2.75 return 7.5625 * (x ^ 2) + 0.984375 end end
---@param x number
---@return number
IN_OUT_BOUNCE = function (x) return x < 0.5 and (1 - OUT_BOUNCE(1 - 2 * x)) / 2 or (1 + OUT_BOUNCE(2 * x - 1)) / 2 end
---@param x number
---@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 --
--------------------
--- Note: These functions don't exist in the Lua math library,
--- and are useful enough to not have to redefine them in every mod
--- @param x number
--- @return number
--- Computes the square of the number `x`
function math.sqr(x)
return x * x
end
--- @param x number
--- @param a number
--- @param b number
--- @return number
--- Clamps the number `x` between bounds `a` (minimum) and `b` (maximum)
function math.clamp(x, a, b)
return __math_min(__math_max(x, a), b)
end
--- @param a number
--- @param b number
--- @return number
--- Computes the hypotenuse of a right-angled triangle given sides `a` and `b` using the Pythagorean theorem
function math.hypot(a, b)
return __math_sqrt(a * a + b * b)
end
--- @param x number
--- @return number
--- Returns 1 if `x` is positive or zero, -1 otherwise
function math.sign(x)
return x >= 0 and 1 or -1
end
--- @param x number
--- @return number
--- Returns 1 if `x` is positive, 0 if it is zero, -1 otherwise
function math.sign0(x)
return x ~= 0 and (x > 0 and 1 or -1) or 0
end
--- @param a number
--- @param b number
--- @param t number
--- @return number
--- Linearly interpolates between `a` and `b` using delta `t`
function math.lerp(a, b, t)
return a + (b - a) * t
end
--- @param a number
--- @param b number
--- @param x number
--- @return number
--- Determines where `x` linearly lies between `a` and `b`. It's the inverse of `math.lerp`
function math.invlerp(a, b, x)
return (x - a) / (b - a)
end
--- @param a number
--- @param b number
--- @param c number
--- @param d number
--- @param x number
--- @return number
--- Linearly remaps `x` from the source range `[a, b]` to the destination range `[c, d]`
function math.remap(a, b, c, d, x)
return c + (d - c) * ((x - a) / (b - a))
end
--- @param x number
--- Rounds `x` to the nearest integer value
function math.round(x)
return x > 0 and __math_floor(x + 0.5) or __math_ceil(x - 0.5)
end
--- @param t EasingFunction | number
--- @param a number
--- @param b number
--- @param x number
--- @return number
--- Interpolates between `a` and `b` using delta `x` and a tweening or easing math function `t`
function math.tween(t, a, b, x)
local y
if type(t) == 'function' then
y = a + t(x) * (b - a)
else
y = a + t * (b - a)
end
return y
end
local __common_signed_conversion = function (x, size)
x = __math_floor(x) & (1 << size) - 1
return x - ((x & (1 << (size - 1))) << 1)
end
local __common_unsigned_conversion = function (x, size)
return __math_floor(x) & (1 << size) - 1
end
--- @param x number
--- @return integer
--- Converts `x` into a valid `s8` range
--- - `[-128, 127]`
function math.s8(x)
return __common_signed_conversion(x, 8)
end
--- @param x number
--- @return integer
--- Converts `x` into a valid `s16` range
--- - `[-32768, 32767]`
function math.s16(x)
return __common_signed_conversion(x, 16)
end
--- @param x number
--- @return integer
--- Converts `x` into a valid `s32` range
--- - `[-2147483648, 2147483647]`
function math.s32(x)
return __common_signed_conversion(x, 32)
end
--- @param x number
--- @return integer
--- Converts `x` into a valid `u8` range
--- - `[0, 255]`
function math.u8(x)
return __common_unsigned_conversion(x, 8)
end
--- @param x number
--- @return integer
--- Converts `x` into a valid `u16` range
--- - `[0, 65535]`
function math.u16(x)
return __common_unsigned_conversion(x, 16)
end
--- @param x number
--- @return integer
--- Converts `x` into a valid `u32` range
--- - `[0, 4294967295]`
function math.u32(x)
return __common_unsigned_conversion(x, 32)
end

View file

@ -81,72 +81,6 @@ function SOUND_ARG_LOAD(bank, soundID, priority, flags)
)
end
-------------
-- courses --
-------------
--- @type integer
COURSE_NONE = 0
--- @type integer
COURSE_BOB = 1
--- @type integer
COURSE_WF = 2
--- @type integer
COURSE_JRB = 3
--- @type integer
COURSE_CCM = 4
--- @type integer
COURSE_BBH = 5
--- @type integer
COURSE_HMC = 6
--- @type integer
COURSE_LLL = 7
--- @type integer
COURSE_SSL = 8
--- @type integer
COURSE_DDD = 9
--- @type integer
COURSE_SL = 10
--- @type integer
COURSE_WDW = 11
--- @type integer
COURSE_TTM = 12
--- @type integer
COURSE_THI = 13
--- @type integer
COURSE_TTC = 14
--- @type integer
COURSE_RR = 15
--- @type integer
COURSE_BITDW = 16
--- @type integer
COURSE_BITFS = 17
--- @type integer
COURSE_BITS = 18
--- @type integer
COURSE_PSS = 19
--- @type integer
COURSE_COTMC = 20
--- @type integer
COURSE_TOTWC = 21
--- @type integer
COURSE_VCUTM = 22
--- @type integer
COURSE_WMOTR = 23
--- @type integer
COURSE_SA = 24
--- @type integer
COURSE_CAKE_END = 25
--- @type integer
COURSE_END = 26
--- @type integer
COURSE_MAX = 25
--- @type integer
COURSE_COUNT = 25
--- @type integer
COURSE_MIN = 1
------------------------------
-- player palette functions --
------------------------------
@ -177,15 +111,11 @@ function network_player_get_override_palette_color(np, part)
return color
end
--------------------------
-- local math functions --
--------------------------
local __math_min, __math_max, __math_sqrt, __math_floor, __math_ceil, __math_cos, __math_sin, __math_pi = math.min, math.max, math.sqrt, math.floor, math.ceil, math.cos, math.sin, math.pi
------------
-- tweens --
------------
-- Unrelated to SM64, but these are for `math.tween`
---@param x number
---@return number
@ -2404,6 +2334,69 @@ M_MOUSE_BUTTON = MOUSE_BUTTON_2
--- @type integer
R_MOUSE_BUTTON = MOUSE_BUTTON_3
COURSE_NONE = 0 --- @type CourseNum
COURSE_BOB = 1 --- @type CourseNum
COURSE_WF = 2 --- @type CourseNum
COURSE_JRB = 3 --- @type CourseNum
COURSE_CCM = 4 --- @type CourseNum
COURSE_BBH = 5 --- @type CourseNum
COURSE_HMC = 6 --- @type CourseNum
COURSE_LLL = 7 --- @type CourseNum
COURSE_SSL = 8 --- @type CourseNum
COURSE_DDD = 9 --- @type CourseNum
COURSE_SL = 10 --- @type CourseNum
COURSE_WDW = 11 --- @type CourseNum
COURSE_TTM = 12 --- @type CourseNum
COURSE_THI = 13 --- @type CourseNum
COURSE_TTC = 14 --- @type CourseNum
COURSE_RR = 15 --- @type CourseNum
COURSE_BITDW = 16 --- @type CourseNum
COURSE_BITFS = 17 --- @type CourseNum
COURSE_BITS = 18 --- @type CourseNum
COURSE_PSS = 19 --- @type CourseNum
COURSE_COTMC = 20 --- @type CourseNum
COURSE_TOTWC = 21 --- @type CourseNum
COURSE_VCUTM = 22 --- @type CourseNum
COURSE_WMOTR = 23 --- @type CourseNum
COURSE_SA = 24 --- @type CourseNum
COURSE_CAKE_END = 25 --- @type CourseNum
COURSE_END = 26 --- @type CourseNum
COURSE_COUNT = COURSE_END - 1 --- @type CourseNum
COURSE_MAX = COURSE_COUNT --- @type CourseNum
COURSE_MIN = 1 --- @type CourseNum
--- @alias CourseNum
--- | `COURSE_NONE`
--- | `COURSE_BOB`
--- | `COURSE_WF`
--- | `COURSE_JRB`
--- | `COURSE_CCM`
--- | `COURSE_BBH`
--- | `COURSE_HMC`
--- | `COURSE_LLL`
--- | `COURSE_SSL`
--- | `COURSE_DDD`
--- | `COURSE_SL`
--- | `COURSE_WDW`
--- | `COURSE_TTM`
--- | `COURSE_THI`
--- | `COURSE_TTC`
--- | `COURSE_RR`
--- | `COURSE_BITDW`
--- | `COURSE_BITFS`
--- | `COURSE_BITS`
--- | `COURSE_PSS`
--- | `COURSE_COTMC`
--- | `COURSE_TOTWC`
--- | `COURSE_VCUTM`
--- | `COURSE_WMOTR`
--- | `COURSE_SA`
--- | `COURSE_CAKE_END`
--- | `COURSE_END`
--- | `COURSE_COUNT`
--- | `COURSE_MAX`
--- | `COURSE_MIN`
DIALOG_NONE = -1 --- @type DialogId
DIALOG_000 = 0 --- @type DialogId
DIALOG_001 = 1 --- @type DialogId
@ -5181,6 +5174,15 @@ BOBOMB_ACT_LAVA_DEATH = 100
--- @type integer
BOBOMB_ACT_DEATH_PLANE_DEATH = 101
COIN_TYPE_NONE = 0 --- @type CoinType
COIN_TYPE_YELLOW = 1 --- @type CoinType
COIN_TYPE_BLUE = 2 --- @type CoinType
--- @alias CoinType
--- | `COIN_TYPE_NONE`
--- | `COIN_TYPE_YELLOW`
--- | `COIN_TYPE_BLUE`
--- @type integer
HIDDEN_BLUE_COIN_ACT_INACTIVE = 0

View file

@ -93,11 +93,11 @@ function spawn_wind_particles(pitch, yaw)
-- ...
end
--- @param a0 number
--- @param a1 number
--- @param maxDistToFloor number
--- @param distance number
--- @return integer
--- Checks if the current object is moving `a1` units over a floor and within a threshold of `a0`
function check_if_moving_over_floor(a0, a1)
--- Checks if the current object is moving `distance` units over a floor and within a max distance to floor of `maxDistToFloor`
function check_if_moving_over_floor(maxDistToFloor, distance)
-- ...
end
@ -144,8 +144,8 @@ function cur_obj_spawn_strong_wind_particles(windSpread, scale, relPosX, relPosY
-- ...
end
--- Behavior loop function for Star Door
function bhv_star_door_loop_2()
--- Behavior loop function for Star Door, which updates its render state
function bhv_star_door_loop_update_render_state()
-- ...
end
@ -319,11 +319,11 @@ function bhv_cannon_base_unused_loop()
-- ...
end
--- @param sp28 number
--- @param sp2C number
--- @param sp30 integer
--- Common behavior for when Mario's anchoring when grabbed
function common_anchor_mario_behavior(sp28, sp2C, sp30)
--- @param forwardVel number
--- @param upwardsVel number
--- @param interactStatusFlags integer
--- Common behavior for an object when grabbing Mario. Used by King Bob-omb and Chuckya anchor objects. When Mario is thrown, sets `forwardVel`, `upwardsVel` and `interactStatusFlags` to him
function common_anchor_mario_behavior(forwardVel, upwardsVel, interactStatusFlags)
-- ...
end
@ -8275,13 +8275,6 @@ function set_yoshi_as_not_dead()
-- ...
end
--- @param f number
--- @return number
--- Absolute value (always positive) function
function absf_2(f)
-- ...
end
--- @param objNewX number
--- @param objY number
--- @param objNewZ number
@ -8947,10 +8940,10 @@ function set_room_override(room)
-- ...
end
--- @param a0 Mat4
--- @param a1 Object
--- @param mtx Mat4
--- @param obj Object
--- Updates an object's position based on a parent transformation matrix
function obj_update_pos_from_parent_transformation(a0, a1)
function obj_update_pos_from_parent_transformation(mtx, obj)
-- ...
end
@ -8962,11 +8955,11 @@ function obj_apply_scale_to_matrix(obj, dst, src)
-- ...
end
--- @param a0 Mat4
--- @param a1 Mat4
--- @param a2 Mat4
--- @param dest Mat4
--- @param src1 Mat4
--- @param src2 Mat4
--- Combines two transformation matrices into a single result matrix
function create_transformation_from_matrices(a0, a1, a2)
function create_transformation_from_matrices(dest, src1, src2)
-- ...
end
@ -9350,11 +9343,6 @@ function cur_obj_set_pos_relative_to_parent(dleft, dy, dforward)
-- ...
end
--- Alternative function that enables rendering for the current object
function cur_obj_enable_rendering_2()
-- ...
end
--- Unused function that initializes the current object on the floor
function cur_obj_unused_init_on_floor()
-- ...
@ -9513,17 +9501,17 @@ function mario_is_dive_sliding(m)
-- ...
end
--- @param sp18 number
--- @param sp1C integer
--- @param velY number
--- @param animIndex integer
--- Sets the current object's vertical velocity and initializes an animation
function cur_obj_set_y_vel_and_animation(sp18, sp1C)
function cur_obj_set_y_vel_and_animation(velY, animIndex)
-- ...
end
--- @param sp18 integer
--- @param sp1C integer
--- Disables rendering, makes intangible, and resets action and animation
function cur_obj_unrender_and_reset_state(sp18, sp1C)
--- @param animIndex integer
--- @param action integer
--- Disables rendering, makes intangible, and resets animation and action
function cur_obj_unrender_and_reset_state(animIndex, action)
-- ...
end
@ -9783,11 +9771,11 @@ function cur_obj_start_cam_event(obj, cameraEvent)
-- ...
end
--- @param sp0 integer
--- @param sp4 integer
--- @param sp8 number
--- Sets Mario's interact status to hoot-grabbed if Mario is within range
function set_mario_interact_hoot_if_in_range(sp0, sp4, sp8)
--- @param unused1 integer
--- @param unused2 integer
--- @param maxDistanceToMario number
--- Sets Mario's interact status to hoot-grabbed if Mario is within range `maxDistanceToMario`
function set_mario_interact_hoot_if_in_range(unused1, unused2, maxDistanceToMario)
-- ...
end
@ -9840,29 +9828,29 @@ end
--- @param obj Object
--- @param numCoins integer
--- @param sp30 number
--- @param baseYVel number
--- @param coinBehavior Pointer_BehaviorScript
--- @param posJitter integer
--- @param model integer
--- Spawns loot coins from an object using the specified behavior, jitter, and model
function obj_spawn_loot_coins(obj, numCoins, sp30, coinBehavior, posJitter, model)
function obj_spawn_loot_coins(obj, numCoins, baseYVel, coinBehavior, posJitter, model)
-- ...
end
--- @param obj Object
--- @param numCoins integer
--- @param sp28 number
--- @param baseYVel number
--- @param posJitter integer
--- Spawns blue loot coins from an object
function obj_spawn_loot_blue_coins(obj, numCoins, sp28, posJitter)
function obj_spawn_loot_blue_coins(obj, numCoins, baseYVel, posJitter)
-- ...
end
--- @param obj Object
--- @param numCoins integer
--- @param sp28 number
--- @param baseYVel number
--- Spawns yellow loot coins from an object
function obj_spawn_loot_yellow_coins(obj, numCoins, sp28)
function obj_spawn_loot_yellow_coins(obj, numCoins, baseYVel)
-- ...
end
@ -10049,9 +10037,9 @@ function obj_translate_xz_random(obj, rangeLength)
-- ...
end
--- @param a0 Object
--- @param obj Object
--- Builds the object's world velocity from its transform basis vectors
function obj_build_vel_from_transform(a0)
function obj_build_vel_from_transform(obj)
-- ...
end
@ -10137,19 +10125,12 @@ function bhv_dust_smoke_loop()
-- ...
end
--- @param sp0 integer
--- @param sp4 integer
--- Placeholder function with no behavior
function stub_obj_helpers_3(sp0, sp4)
-- ...
end
--- @param a0 integer
--- @param a1 integer
--- @param sp10 number
--- @param sp14 number
--- Smoothly scales the current object over time using enabled axes
function cur_obj_scale_over_time(a0, a1, sp10, sp14)
--- @param axes integer
--- @param duration integer
--- @param minScale number
--- @param maxScale number
--- Smoothly scales between `minScale` and `maxScale` the current object over a `duration` using enabled `axes` (1 = x, 2 = y, 4 = z, can be combined)
function cur_obj_scale_over_time(axes, duration, minScale, maxScale)
-- ...
end
@ -10158,11 +10139,6 @@ function cur_obj_set_pos_to_home_with_debug()
-- ...
end
--- Placeholder function with no behavior
function stub_obj_helpers_4()
-- ...
end
--- @return integer
--- Returns `TRUE` if Mario is currently standing on the current platform object
function cur_obj_is_mario_on_platform()
@ -10183,18 +10159,18 @@ function cur_obj_shake_y_until(cycles, amount)
-- ...
end
--- @param a0 integer
--- @param index integer
--- @return integer
--- Moves the current object up and down along a preset displacement table
function cur_obj_move_up_and_down(a0)
function cur_obj_move_up_and_down(index)
-- ...
end
--- @param sp20 integer
--- @param sp24 integer
--- @param setHomeToMario integer
--- @param unused integer
--- @return Object
--- Spawns a star object without triggering level exit behavior
function spawn_star_with_no_lvl_exit(sp20, sp24)
function spawn_star_with_no_lvl_exit(setHomeToMario, unused)
-- ...
end
@ -10203,13 +10179,6 @@ function spawn_base_star_with_no_lvl_exit()
-- ...
end
--- @param a0 integer
--- @return integer
--- Returns the value at index a0 from a behavior-specific left-shift table
function bit_shift_left(a0)
-- ...
end
--- @return integer
--- Returns `TRUE` if the current object is farther than 2000 units from every active Mario
function cur_obj_mario_far_away()
@ -10250,10 +10219,10 @@ function cur_obj_set_hitbox_and_die_if_attacked(hitbox, deathSound, noLootCoins)
-- ...
end
--- @param sp18 number
--- @param sp1C integer
--- @param mistSize number
--- @param coinType CoinType
--- Explodes the current object, spawns particles, and optionally spawns coins
function obj_explode_and_spawn_coins(sp18, sp1C)
function obj_explode_and_spawn_coins(mistSize, coinType)
-- ...
end
@ -10312,22 +10281,13 @@ end
--- @param m MarioState
--- @param radius number
--- @param height number
--- @param unused integer
--- @param unused? integer
--- @return integer
--- Checks whether Mario can activate the current object's textbox within a vertical and horizontal range
function cur_obj_can_mario_activate_textbox(m, radius, height, unused)
-- ...
end
--- @param m MarioState
--- @param radius number
--- @param height number
--- @return integer
--- Wrapper that checks Mario textbox activation using a fixed unused parameter value
function cur_obj_can_mario_activate_textbox_2(m, radius, height)
-- ...
end
--- @param m MarioState
--- @param dialogFlags integer
--- @param dialogResult integer
@ -10480,39 +10440,61 @@ function apply_platform_displacement(o, platform)
-- ...
end
--- @param a0 integer
--- @param a1 integer
--- Queues rumble data
function queue_rumble_data(a0, a1)
--- @param time integer
--- @param level integer
--- Queues rumble data with `time` and `level`
function queue_rumble_data(time, level)
-- ...
end
--- @param object Object
--- @param a0 integer
--- @param a1 integer
--- Queues rumble data for object, factoring in its distance from Mario
function queue_rumble_data_object(object, a0, a1)
--- @param time integer
--- @param level integer
--- Queues rumble data for object with `time` and `level`, factoring in its distance from Mario
function queue_rumble_data_object(object, time, level)
-- ...
end
--- @param m MarioState
--- @param a0 integer
--- @param a1 integer
--- Queues rumble data for Mario
function queue_rumble_data_mario(m, a0, a1)
--- @param time integer
--- @param level integer
--- Queues rumble data with `time` and `level` only if `m` is the local Mario
function queue_rumble_data_mario(m, time, level)
-- ...
end
--- @param decay integer
--- Queues rumble `decay`
function queue_rumble_decay(decay)
-- ...
end
--- @return integer
--- Checks if rumble is finished and there is no rumble queued
function is_rumble_finished_and_queue_empty()
-- ...
end
--- @param m MarioState
--- Resets rumble timers
--- Resets rumble timers only if `m` is the local Mario
function reset_rumble_timers(m)
-- ...
end
--- @param m MarioState
--- @param a0 integer
--- Resets rumble timers and sets a field based on `a0`
function reset_rumble_timers_2(m, a0)
--- @param level integer
--- Resets rumble timers and sets vibrate based on `level`
function reset_rumble_timers_vibrate(m, level)
-- ...
end
--- Queues rumble data for submerged actions
function queue_rumble_submerged()
-- ...
end
--- Cancels all currently queued rumble data
function cancel_rumble()
-- ...
end
@ -12448,7 +12430,7 @@ end
--- @param x number
--- @param y number
--- @param z number
--- @param objSetupFunction function
--- @param objSetupFunction? function
--- @return Object
--- Spawns a synchronized object at `x`, `y`, and `z` as a child object of the local Mario with his rotation.<br>
--- You can change the fields of the object in `objSetupFunction`
@ -12461,7 +12443,7 @@ end
--- @param x number
--- @param y number
--- @param z number
--- @param objSetupFunction function
--- @param objSetupFunction? function
--- @return Object
--- Spawns a non-synchronized object at `x`, `y`, and `z` as a child object of the local Mario with his rotation.<br>
--- You can change the fields of the object in `objSetupFunction`
@ -13137,13 +13119,13 @@ end
--- @param soundMagic integer
--- Plays a sound if the current object is visible
function cur_obj_play_sound_1(soundMagic)
function cur_obj_play_sound_if_visible(soundMagic)
-- ...
end
--- @param soundMagic integer
--- Plays a sound if the current object is visible and queues rumble for specific sounds
function cur_obj_play_sound_2(soundMagic)
--- Plays a sound if the current object is visible and queues rumble for the following sounds: `SOUND_OBJ_BOWSER_WALK`, `SOUND_OBJ_POUNDING_LOUD`, `SOUND_OBJ_WHOMP_LOWPRIO`
function cur_obj_play_sound_and_rumble_if_visible(soundMagic)
-- ...
end
@ -13154,24 +13136,6 @@ function create_sound_spawner(soundMagic)
-- ...
end
--- @param distance number
--- @return integer
--- Unused vanilla function, calculates a volume based on `distance`.<br>
--- If `distance` is less than 500 then 127, if `distance` is greater than 1500 then 0, if `distance` is between 500 and 1500 then it ranges linearly from 60 to 124.<br>
--- What an even more strange and confusing function
function calc_dist_to_volume_range_1(distance)
-- ...
end
--- @param distance number
--- @return integer
--- Unused vanilla function, calculates a volume based on `distance`.<br>
--- If `distance` is less than 1300 then 127, if `distance` is greater than 2300 then 0, if `distance` is between 1300 and 2300 then it ranges linearly from 60 to 127.<br>
--- What a strange and confusing function
function calc_dist_to_volume_range_2(distance)
-- ...
end
--- @param colData WallCollisionData
--- @return integer
--- Detects wall collisions at a given position and adjusts the position based on the walls found.<br>

View file

@ -1563,6 +1563,7 @@
--- @field public oCoinUnkF4 integer
--- @field public oCoinUnkF8 integer
--- @field public oCoinUnk110 number
--- @field public oCoinBaseYVel number
--- @field public oCoinUnk1B0 integer
--- @field public oCollisionParticleUnkF4 number
--- @field public oControllablePlatformUnkF8 integer
@ -2266,6 +2267,9 @@
--- @field public clientMutedState VoiceChatMuteState
--- @field public playerMutedState VoiceChatMuteState
--- @class VoicePlayerInternal
--- @field public buffer VoiceBuffer
--- @class Vtx
--- @field public x number
--- @field public y number

View file

@ -76,7 +76,7 @@ const BehaviorScript bhvStarDoor[] = {
SET_INT(oIntangibleTimer, 0),
BEGIN_LOOP(),
CALL_NATIVE(bhv_star_door_loop),
CALL_NATIVE(bhv_star_door_loop_2),
CALL_NATIVE(bhv_star_door_loop_update_render_state),
CALL_NATIVE(load_object_collision_model),
END_LOOP(),
};

View file

@ -68,6 +68,7 @@ u64 dynos_level_cmd_get(void *cmd, u64 offset);
void dynos_level_cmd_next(void *cmd);
void dynos_level_parse_script(const void *script, s32 (*aPreprocessFunction)(u8, void *));
void* dynos_level_get_script(s32 level);
const void *dynos_level_get_vanilla_script(s32 level);
s32 dynos_level_get_mod_index(s32 level);
bool dynos_level_is_vanilla_level(s32 level);
Collision *dynos_level_get_collision(u32 level, u16 area);

View file

@ -798,6 +798,7 @@ void DynOS_UpdateGfx();
bool DynOS_IsTransitionActive();
void DynOS_Mod_Update();
void DynOS_Mod_Shutdown();
bool DynOS_Mod_IsShuttingDown();
//
// Gfx
@ -829,6 +830,7 @@ s8 DynOS_Level_GetCourse(s32 aLevel);
void DynOS_Level_Override(void* originalScript, void* newScript, s32 modIndex);
void DynOS_Level_Unoverride();
const void *DynOS_Level_GetScript(s32 aLevel);
const void *DynOS_Level_GetVanillaScript(s32 aLevel);
s32 DynOS_Level_GetModIndex(s32 aLevel);
bool DynOS_Level_IsVanillaLevel(s32 aLevel);
Collision *DynOS_Level_GetCollision(u32 aLevel, u16 aArea);

View file

@ -1133,6 +1133,7 @@ s64 DynOS_Bhv_ParseBehaviorScriptConstants(const String &_Arg, bool *found) {
bhv_constant(oCoinUnkF4);
bhv_constant(oCoinUnkF8);
bhv_constant(oCoinUnk110);
bhv_constant(oCoinBaseYVel);
#ifndef VERSION_JP
bhv_constant(oCoinUnk1B0);
#endif

View file

@ -228,6 +228,10 @@ void* dynos_level_get_script(s32 level) {
return (void *) DynOS_Level_GetScript(level);
}
const void *dynos_level_get_vanilla_script(s32 level) {
return DynOS_Level_GetVanillaScript(level);
}
s32 dynos_level_get_mod_index(s32 level) {
return DynOS_Level_GetModIndex(level);
}

View file

@ -21,7 +21,7 @@ extern const BehaviorScript *sWarpBhvSpawnTable[];
#define DYNOS_LEVEL_MARIO_POS_WARP_ID (-1)
extern void *gDynosLevelScriptsOriginal[LEVEL_COUNT];
extern const void *gDynosLevelScriptsOriginal[LEVEL_COUNT];
void DynOS_Level_ParseScript(const void *aScript, s32 (*aPreprocessFunction)(u8, void *));
@ -158,7 +158,7 @@ void DynOS_Level_Init() {
// Level warps
for (sDynosCurrentLevelNum = 0; sDynosCurrentLevelNum < LEVEL_COUNT; ++sDynosCurrentLevelNum) {
sDynosLevelScripts[sDynosCurrentLevelNum].mLevelScript = gDynosLevelScriptsOriginal[sDynosCurrentLevelNum];
sDynosLevelScripts[sDynosCurrentLevelNum].mLevelScript = (void *) gDynosLevelScriptsOriginal[sDynosCurrentLevelNum];
sDynosLevelScripts[sDynosCurrentLevelNum].mModIndex = DYNOS_LEVEL_MOD_INDEX_VANILLA;
if (sDynosLevelScripts[sDynosCurrentLevelNum].mLevelScript) {
DynOS_Level_ParseScript(sDynosLevelScripts[sDynosCurrentLevelNum].mLevelScript, DynOS_Level_PreprocessScript);
@ -199,7 +199,7 @@ void DynOS_Level_Unoverride() {
for (s32 i = 0; i < LEVEL_COUNT; i++) {
sDynosCurrentLevelNum = i;
sDynosLevelWarps[i].Clear();
sDynosLevelScripts[i].mLevelScript = gDynosLevelScriptsOriginal[i];
sDynosLevelScripts[i].mLevelScript = (void *) gDynosLevelScriptsOriginal[i];
sDynosLevelScripts[i].mModIndex = DYNOS_LEVEL_MOD_INDEX_VANILLA;
DynOS_Level_ParseScript(sDynosLevelScripts[i].mLevelScript, DynOS_Level_PreprocessScript);
}
@ -216,6 +216,13 @@ const void *DynOS_Level_GetScript(s32 aLevel) {
return sDynosLevelScripts[aLevel].mLevelScript;
}
const void *DynOS_Level_GetVanillaScript(s32 aLevel) {
if (aLevel < LEVEL_MIN || aLevel >= LEVEL_COUNT) {
return NULL;
}
return (const void *) gDynosLevelScriptsOriginal[aLevel];
}
s32 DynOS_Level_GetModIndex(s32 aLevel) {
if (aLevel >= CUSTOM_LEVEL_NUM_START) {
struct CustomLevelInfo* info = smlua_level_util_get_info(aLevel);
@ -231,7 +238,7 @@ bool DynOS_Level_IsVanillaLevel(s32 aLevel) {
DynOS_Level_Init();
if (aLevel >= LEVEL_MIN && aLevel < LEVEL_COUNT) {
return sDynosLevelScripts[aLevel].mLevelScript == gDynosLevelScriptsOriginal[aLevel];
return sDynosLevelScripts[aLevel].mLevelScript == (void *) gDynosLevelScriptsOriginal[aLevel];
}
return false;
}

View file

@ -52,3 +52,7 @@ void DynOS_Mod_Update() {
void DynOS_Mod_Shutdown() {
sDynosModShutdown = true;
}
bool DynOS_Mod_IsShuttingDown() {
return sDynosModShutdown;
}

View file

@ -36,7 +36,7 @@ void DynOS_Bhv_Activate(s32 modIndex, const SysPath &aFilename, const char *aBeh
void DynOS_Bhv_ModShutdown() {
auto &_CustomBehaviorScripts = DynOS_Bhv_GetArray();
for (auto &pair : _CustomBehaviorScripts) {
Delete(pair.second);
DynOS_Gfx_Free(pair.second);
}
_CustomBehaviorScripts.clear();
}

View file

@ -184,46 +184,14 @@ static const void* sDynosBuiltinScriptPtrs[] = {
define_builtin(level_main_menu_entry_1),
};
#define define_level_original(lvl, script) (void*) script
void* gDynosLevelScriptsOriginal[LEVEL_COUNT] = {
define_level_original(0, NULL),
define_level_original(LEVEL_UNKNOWN_1, NULL),
define_level_original(LEVEL_UNKNOWN_2, NULL),
define_level_original(LEVEL_UNKNOWN_3, NULL),
define_level_original(LEVEL_BBH, level_bbh_entry),
define_level_original(LEVEL_CCM, level_ccm_entry),
define_level_original(LEVEL_CASTLE, level_castle_inside_entry),
define_level_original(LEVEL_HMC, level_hmc_entry),
define_level_original(LEVEL_SSL, level_ssl_entry),
define_level_original(LEVEL_BOB, level_bob_entry),
define_level_original(LEVEL_SL, level_sl_entry),
define_level_original(LEVEL_WDW, level_wdw_entry),
define_level_original(LEVEL_JRB, level_jrb_entry),
define_level_original(LEVEL_THI, level_thi_entry),
define_level_original(LEVEL_TTC, level_ttc_entry),
define_level_original(LEVEL_RR, level_rr_entry),
define_level_original(LEVEL_CASTLE_GROUNDS, level_castle_grounds_entry),
define_level_original(LEVEL_BITDW, level_bitdw_entry),
define_level_original(LEVEL_VCUTM, level_vcutm_entry),
define_level_original(LEVEL_BITFS, level_bitfs_entry),
define_level_original(LEVEL_SA, level_sa_entry),
define_level_original(LEVEL_BITS, level_bits_entry),
define_level_original(LEVEL_LLL, level_lll_entry),
define_level_original(LEVEL_DDD, level_ddd_entry),
define_level_original(LEVEL_WF, level_wf_entry),
define_level_original(LEVEL_ENDING, level_ending_entry),
define_level_original(LEVEL_CASTLE_COURTYARD, level_castle_courtyard_entry),
define_level_original(LEVEL_PSS, level_pss_entry),
define_level_original(LEVEL_COTMC, level_cotmc_entry),
define_level_original(LEVEL_TOTWC, level_totwc_entry),
define_level_original(LEVEL_BOWSER_1, level_bowser_1_entry),
define_level_original(LEVEL_WMOTR, level_wmotr_entry),
define_level_original(LEVEL_UNKNOWN_32, NULL),
define_level_original(LEVEL_BOWSER_2, level_bowser_2_entry),
define_level_original(LEVEL_BOWSER_3, level_bowser_3_entry),
define_level_original(LEVEL_UNKNOWN_35, NULL),
define_level_original(LEVEL_TTM, level_ttm_entry),
const void *gDynosLevelScriptsOriginal[] = {
[LEVEL_NONE] = NULL,
#define STUB_LEVEL(_0, levelNum, _2, _3, _4, _5, _6, _7, _8) [levelNum] = NULL,
#define DEFINE_LEVEL(_0, levelNum, _2, folder, _4, _5, _6, _7, _8, _9, _10) \
[levelNum] = level_ ## folder ## _entry,
#include "levels/level_defines.h"
#undef STUB_LEVEL
#undef DEFINE_LEVEL
};
const void* DynOS_Builtin_ScriptPtr_GetFromName(const char* aDataName) {
@ -1398,12 +1366,13 @@ static void *geo_rotate_3d_coin(s32 callContext, void *node, UNUSED void *c) {
/////////////////////////////////////////////////////////////////////////////////////////////////////////
typedef struct {
const char *name;
const char *names[2];
const void *func;
u8 type;
} DynosBuiltinFunction;
#define define_builtin_function(_func, _type) { .name = #_func, .func = (const void *) _func, .type = _type }
#define define_builtin_function(_func, _type) { .names = {#_func, NULL}, .func = (const void *) _func, .type = _type }
#define define_builtin_function_renamed(_func, _oldName, _type) { .names = {#_func, #_oldName}, .func = (const void *) _func, .type = _type }
static const DynosBuiltinFunction sDynosBuiltinFuncs[] = {
define_builtin_function(geo_mirror_mario_set_alpha, FUNCTION_GEO),
@ -1452,7 +1421,7 @@ static const DynosBuiltinFunction sDynosBuiltinFuncs[] = {
define_builtin_function(geo_snufit_move_mask, FUNCTION_GEO),
define_builtin_function(geo_snufit_scale_body, FUNCTION_GEO),
define_builtin_function(geo_scale_bowser_key, FUNCTION_GEO),
{ .name = "geo_rotate_coin", .func = (const void *) geo_rotate_3d_coin, .type = FUNCTION_GEO },
define_builtin_function_renamed(geo_rotate_3d_coin, geo_rotate_coin, FUNCTION_GEO),
define_builtin_function(geo_offset_klepto_held_object, FUNCTION_GEO),
define_builtin_function(geo_switch_peach_eyes, FUNCTION_GEO),
@ -1470,7 +1439,7 @@ static const DynosBuiltinFunction sDynosBuiltinFuncs[] = {
define_builtin_function(bhv_door_init, FUNCTION_BHV),
define_builtin_function(bhv_door_loop, FUNCTION_BHV),
define_builtin_function(bhv_star_door_loop, FUNCTION_BHV),
define_builtin_function(bhv_star_door_loop_2, FUNCTION_BHV),
define_builtin_function_renamed(bhv_star_door_loop_update_render_state, bhv_star_door_loop_2, FUNCTION_BHV),
define_builtin_function(bhv_mr_i_loop, FUNCTION_BHV),
define_builtin_function(bhv_mr_i_body_loop, FUNCTION_BHV),
define_builtin_function(bhv_mr_i_particle_loop, FUNCTION_BHV),
@ -2047,9 +2016,16 @@ static const char *sDynosBuiltinFuncTypeNames[] = {
[FUNCTION_LVL] = "level script",
};
static inline bool DynOS_Builtin_Func_HasName(const DynosBuiltinFunction &aBuiltinFunc, const char *aDataName) {
return aDataName != NULL && (
(aBuiltinFunc.names[0] != NULL && strcmp(aBuiltinFunc.names[0], aDataName) == 0) ||
(aBuiltinFunc.names[1] != NULL && strcmp(aBuiltinFunc.names[1], aDataName) == 0)
);
}
const void* DynOS_Builtin_Func_GetFromName(const char* aDataName, u8 aFuncType) {
for (const auto &builtinFunc : sDynosBuiltinFuncs) {
if (builtinFunc.type == aFuncType && strcmp(builtinFunc.name, aDataName) == 0) {
if (builtinFunc.type == aFuncType && DynOS_Builtin_Func_HasName(builtinFunc, aDataName)) {
return builtinFunc.func;
}
}
@ -2067,7 +2043,7 @@ const char *DynOS_Builtin_Func_GetNameFromIndex(s32 aIndex, u8 aFuncType) {
s32 count = (s32) (sizeof(sDynosBuiltinFuncs) / sizeof(sDynosBuiltinFuncs[0]));
if (aIndex < 0 || aIndex >= count) { return NULL; }
if (sDynosBuiltinFuncs[aIndex].type != aFuncType) { return NULL; }
return sDynosBuiltinFuncs[aIndex].name;
return sDynosBuiltinFuncs[aIndex].names[0];
}
s32 DynOS_Builtin_Func_GetIndexFromData(const void* aData, u8 aFuncType) {
@ -2086,10 +2062,11 @@ static String DynOS_Builtin_Func_CheckMisuse_Internal(s32 aIndex, const char* aD
for (s32 i = 0; i < count; ++i) {
const auto &builtinFunc = sDynosBuiltinFuncs[i];
if (aFuncType != builtinFunc.type && (
aIndex == i || (aDataName && strcmp(aDataName, builtinFunc.name) == 0) || aData == builtinFunc.func)) {
aIndex == i || DynOS_Builtin_Func_HasName(builtinFunc, aDataName) || aData == builtinFunc.func)
) {
return String(
"Invalid use of %s function in %s: %s",
builtinFunc.name,
builtinFunc.names[0],
sDynosBuiltinFuncTypeNames[builtinFunc.type],
sDynosBuiltinFuncTypeNames[aFuncType]
);

View file

@ -350,7 +350,7 @@ void DynOS_Gfx_ModShutdown() {
sModsDisplayLists.Clear();
sModsVertexBuffers.Clear();
// Restore vanilla display lists
// Restore vanilla display lists and vertices
for (auto &it : sRomToRamGfxVtxMap) {
const void *original = it.second.gfxCopy ? it.second.gfxCopy : it.first;
void *duplicate = it.second.duplicate;

View file

@ -1,7 +1,9 @@
#include "dynos.cpp.h"
extern "C" {
#include "include/level_table.h"
#include "engine/level_script.h"
#include "game/level_update.h"
#include "game/skybox.h"
}
@ -41,7 +43,7 @@ void DynOS_Lvl_ModShutdown() {
if (!_CustomLevelScripts.empty()) {
for (auto& pair : _CustomLevelScripts) {
DynOS_Tex_Invalid(pair.second);
Delete(pair.second);
DynOS_Gfx_Free(pair.second);
}
_CustomLevelScripts.clear();
}
@ -173,12 +175,17 @@ double_break:
}
void *DynOS_Lvl_Override(void *aCmd) {
static bool sLevelIsVanilla = true;
auto& _OverrideLevelScripts = DynosOverrideLevelScripts();
for (auto& overrideStruct : _OverrideLevelScripts) {
if (aCmd == overrideStruct.originalScript || aCmd == overrideStruct.newScript) {
aCmd = (void*)overrideStruct.newScript;
if (!DynOS_Mod_IsShuttingDown()) {
aCmd = (void*)overrideStruct.newScript;
}
gLevelScriptModIndex = overrideStruct.gfxData->mModIndex;
gLevelScriptActive = (LevelScript*)aCmd;
sLevelIsVanilla = false;
}
}
@ -189,9 +196,29 @@ void *DynOS_Lvl_Override(void *aCmd) {
if (aCmd == s->mData) {
gLevelScriptModIndex = script.second->mModIndex;
gLevelScriptActive = (LevelScript*)aCmd;
sLevelIsVanilla = false;
}
}
}
for (u16 i = 0; i < LEVEL_COUNT; ++i) {
const void *vanillaScript = DynOS_Level_GetVanillaScript(i);
if (vanillaScript == aCmd) {
gLevelScriptModIndex = -1;
gLevelScriptActive = (LevelScript*)aCmd;
sLevelIsVanilla = true;
break;
}
}
// Evict the VM from any custom level scripts because we're about to delete them
if (DynOS_Mod_IsShuttingDown() && !sLevelIsVanilla) {
LevelScript *vanillaScript = (LevelScript *) DynOS_Level_GetVanillaScript(get_menu_level());
gLevelScriptModIndex = -1;
gLevelScriptActive = vanillaScript;
sLevelIsVanilla = true;
return vanillaScript;
}
return aCmd;
}

View file

@ -70,8 +70,5 @@ DataNode<MovtexQC>* DynOS_MovtexQC_GetFromIndex(s32 index) {
void DynOS_MovtexQC_ModShutdown() {
auto& _DynosRegisteredMovtexQCs = DynosRegisteredMovtexQCs();
for (auto &registered : _DynosRegisteredMovtexQCs) {
Delete(registered.dataNode);
}
_DynosRegisteredMovtexQCs.clear();
}

View file

@ -2,22 +2,20 @@
# SMLua
SMLua is what allows Lua to communicate with SM64. It's the backbone of the modding api, and it contains multiple features that makes development in C convenient.
SMLua is what allows Lua to communicate with SM64. It's the backbone of the modding API, and it contains multiple features that makes development in C convenient.
## Autogen
Autogen is the system in place to allow C functions to be generated into Lua functions automatically.
Autogen is the system in place to allow C constants, functions and structs to be exposed to the Lua API automatically.
Autogen can be ran by running `autogen/autogen.sh` in the root directory of your project.
Autogen needs to be ran for a variety of reasons:
- Anytime a function's name, parameter, or description is changed
- Anytime a struct's name, or variable is changed
- Anytime a enum's name, or contents is changed
- Anytime a new function or struct is added
- Anytime a hook event is added or modified
- And much more
Autogen may need a rerun when changes are made to:
- Functions
- Structs
- Enums
- Hooks
- etc.
## Adding functions, structs, and constants to autogen
@ -27,23 +25,37 @@ Constants, functions, and structs are each handled in their own files.
- `convert_functions.py`
- `convert_structs.py`
Each file is laid out differently to account for their own needs, the only thing that's the same in each is `in_files`, which tells autogen to look for functions, constants, or structs in a specific file
But thankfully, one does not need to know how it works but rather focus on a single file: `exposed_lists.py`.<br>
In this file, you will find numerous options sorted in three categories: `constants`, `functions` and `structs`.<br>
Note that all `whitelist`, `blacklist` and `hidden` dicts support regular expressions.
### Constants
Constants is the least used one, so it has the least to go over.
Let's start with the constants options:
- `exclude_constants` tells autogen to ignore specific constants. For instance, in `djui_console.h`, we don't want to include `CONSOLE_MAX_TMP_BUFFER`, Lua has no need for that constant, so we exclude it.
- `include_constants` tells autogen to add specific constants, and ignore every other constant in that file. For instance, in `mod_storage.h`, there's a bunch of constants we don't want exposed to Lua, so instead of excluding them, we include the few we actually need.
- `constants_files` defines in which files autogen should look into to expose constants.<br>
All filepaths are relative to the root of the repository.
- `constants_whitelist` defines for each file which constants should be exposed and ignore every other constant in that file.<br>
For example, in `mod_storage.h`, there's a bunch of constants we don't want exposed to Lua, so instead of excluding them, we include the few we actually need.
- `constants_blacklist` defines for each file which constants should not be exposed.<br>
For example, in `djui_console.h`, we don't want to include `CONSOLE_MAX_TMP_BUFFER`, Lua has no need for that constant, so we exclude it.
- `constants_hidden` defines for each file which constants should be exposed, but not appear in the documentation.<br>
It is usually done for deprecated constants or ones that have a temporary or placeholder name but some mods already use them, so they can't be removed completely.<br>
For example, in `interaction.h`, `INTERACT_UNKNOWN_08` is not a very explicit name, but since mods use it, it must exist in the API.
### Functions
Functions have quite a bit of options, so let's go over it:
- `override_allowed_functions` is similar to `include_constants`, it tells autogen to add specific functions and ignore all other functions in the file. It proves especially useful for functions since frequently files contains tons of functions that shouldn't be exposed to Lua.
- `override_disallowed_functions` is similar to `exclude_constants`, it tells autogen to ignore specific functions.
- `override_hide_functions` tells autogen to not document the function. It still exists in SMLua, and Lua can call it, but it can't see it. This is typically used for deprecated functions.
- `override_function_version_excludes` excludes functions from a specific version of the game. It doesn't have too much of a use anymore, so you can ignore it.
- `functions_files` defines in which files autogen should look into to expose functions.<br>
All filepaths are relative to the root of the repository.
- `functions_whitelist` defines for each file which functions should be exposed and ignore every other function in that file.<br>
It proves especially useful for functions since frequently files contains tons of functions that shouldn't be exposed to Lua.
- `functions_blacklist` defines for each file which functions should not be exposed.
- `functions_hidden` defines for each file which functions should be exposed, but not appear in the documentation.<br>
This is typically used for deprecated or renamed functions.
- `functions_version_excludes` excludes functions from a specific version of the game.<br>
It doesn't have too much of a use anymore, so you can ignore it.
Functions have a unique feature of being able to be documented. In a header file where autogen reads the function and generates documentation and generates an SMLua implementation, you can define a description for the function above it. An example of it and the syntax is as the following:
@ -66,13 +78,22 @@ s32 is_anim_at_end(struct MarioState *m);
Structs have the most options, so let's go through it:
- `override_field_types` changes the type of a field in a struct to something else. It pretty much lies to lua about what it actually is. This usually isn't useful, but in specific scenarios it can be.
- `override_field_mutable` tells autogen to make a specific field mutable and also make every other field immutable.
- `override_field_invisible` tells autogen to hide a field from Lua. Unlike `override_hide_functions`, it makes the value not accessible at all.
- `override_field_deprecated` tells autogen to mark certain fields as deprecated.
- `override_field_immutable` tells autogen to make certain fields immutable.
- `override_field_version_excludes` tells autogen to exclude specific fields depending on your version. Similarly to `override_function_version_excludes`, it doesn't have too much of a use anymore, so you can ignore it.
- `override_allowed_structs` tells autogen to make specific structs visible and tangible to Lua, but remove all other structs from Lua.
- `structs_files` defines in which files autogen should look into to expose structs.<br>
All filepaths are relative to the root of the repository.
- `structs_whitelist` defines for each file which structs should be exposed and ignore every other struct in that file.
- `structs_blacklist` defines for each file which structs should not be exposed at all.
- `structs_excluded` is a list of struct names that should never be exposed from any file, including as another struct fields.
- `structs_fields_whitelist` defines for each struct which fields should be exposed and ignore every other field in that struct.
- `structs_fields_blacklist` defines for each struct which fields should not be exposed to Lua.
- `structs_fields_hidden` defines for each struct which fields should be exposed, but not appear in the documentation.<br>
Like constants and functions, this is usually done for deprecated or renamed fields.
- `structs_fields_version_excludes` tells autogen to exclude specific fields depending on your version.<br>
Similarly to `functions_version_excludes`, it doesn't have too much of a use anymore, so you can ignore it.
- `structs_fields_types` changes the type of a field in a struct to something else.<br>
It pretty much lies to Lua about what it actually is. This usually isn't useful, but in specific scenarios it can be.
- `structs_fields_mutable` defines which fields should be mutable (read and write), but turn every other field of the struct immutable (read-only).
- `structs_fields_immutable` defines which fields should be immutable (read-only).<br>
By default, all fields are mutable, except pointers.
## Hook Events
@ -105,7 +126,7 @@ enum LuaHookedEventReturn {
- `HOOK_RETURN_ON_SUCCESSFUL_CALL` should be used if you don't want any other mods to use a hook call if the call succeeds for the first mod handling it. It's only used a few times, but it can come in handy.
- `HOOK_RETURN_ON_OUTPUT_SET` should be used if you don't want any mod to access a hook that had it's output set by Lua.
- If these 3 hook return types don't cover what you are looking for, you need to make a custom implementation, mark this parameter with an `_` if you want to do a custom implementation.
- Every argument after is the parameters and return values for Lua, and they are optional. Parameters come first, insert the parameters you want Lua to receive, for instance, `struct MarioState* m` to allow Lua to receive a mario state in the hook event call.
- Every argument after is the parameters and return values for Lua, and they are optional. Parameters come first, insert the parameters you want Lua to receive, for instance, `struct MarioState *m` to allow Lua to receive a mario state in the hook event call.
- After parameters comes output, or return values. This is optional. To define an output parameter, use the `OUTPUT` macro.
- Here is an example hook showcasing this:
@ -128,4 +149,4 @@ smlua_call_event_hooks(HOOK_ALLOW_HAZARD_SURFACE, m, HAZARD_TYPE_LAVA_WALL, &all
- The output should be a reference so the function can properly set the variable.
- If Lua doesn't return anything, the output passed into the function stays as what it was originally, so it serves as a default value. That's why `allowHazard` is set to true.
After all these changes, remember to rerun autogen. Once that's done, you should have your hook into the game, test it and make sure everything works!
After all these changes, remember to rerun autogen. Once that's done, you should have your hook into the game, test it and make sure everything works!

View file

@ -11,6 +11,8 @@
- [enum CharacterType](#enum-CharacterType)
- [enum CharacterSound](#enum-CharacterSound)
- [controller_mouse.h](#controller_mouseh)
- [course_defines.h](#course_definesh)
- [enum CourseNum](#enum-CourseNum)
- [dialog_ids.h](#dialog_idsh)
- [enum DialogId](#enum-DialogId)
- [djui_console.h](#djui_consoleh)
@ -70,6 +72,7 @@
- [obj_behaviors.c](#obj_behaviorsc)
- [obj_behaviors_2.h](#obj_behaviors_2h)
- [object_constants.h](#object_constantsh)
- [enum CoinType](#enum-CoinType)
- [object_list_processor.h](#object_list_processorh)
- [enum ObjectList](#enum-ObjectList)
- [os_cont.h](#os_conth)
@ -960,6 +963,46 @@
<br />
## [course_defines.h](#course_defines.h)
### [enum CourseNum](#CourseNum)
| Identifier | Value |
| :--------- | :---- |
| COURSE_NONE | 0 |
| COURSE_BOB | 1 |
| COURSE_WF | 2 |
| COURSE_JRB | 3 |
| COURSE_CCM | 4 |
| COURSE_BBH | 5 |
| COURSE_HMC | 6 |
| COURSE_LLL | 7 |
| COURSE_SSL | 8 |
| COURSE_DDD | 9 |
| COURSE_SL | 10 |
| COURSE_WDW | 11 |
| COURSE_TTM | 12 |
| COURSE_THI | 13 |
| COURSE_TTC | 14 |
| COURSE_RR | 15 |
| COURSE_BITDW | 16 |
| COURSE_BITFS | 17 |
| COURSE_BITS | 18 |
| COURSE_PSS | 19 |
| COURSE_COTMC | 20 |
| COURSE_TOTWC | 21 |
| COURSE_VCUTM | 22 |
| COURSE_WMOTR | 23 |
| COURSE_SA | 24 |
| COURSE_CAKE_END | 25 |
| COURSE_END | 26 |
| COURSE_COUNT | COURSE_END - 1 |
| COURSE_MAX | COURSE_COUNT |
| COURSE_MIN | 1 |
[:arrow_up_small:](#)
<br />
## [dialog_ids.h](#dialog_ids.h)
### [enum DialogId](#DialogId)
@ -2428,6 +2471,13 @@
- BOBOMB_ACT_EXPLODE
- BOBOMB_ACT_LAVA_DEATH
- BOBOMB_ACT_DEATH_PLANE_DEATH
### [enum CoinType](#CoinType)
| Identifier | Value |
| :--------- | :---- |
| COIN_TYPE_NONE | 0 |
| COIN_TYPE_YELLOW | 1 |
| COIN_TYPE_BLUE | 2 |
- HIDDEN_BLUE_COIN_ACT_INACTIVE
- HIDDEN_BLUE_COIN_ACT_WAITING
- HIDDEN_BLUE_COIN_ACT_ACTIVE

View file

@ -58,10 +58,10 @@ function bhv_ball_loop(obj)
-- play sounds
if stepRc == 1 then
cur_obj_play_sound_2(SOUND_GENERAL_BOX_LANDING_2)
cur_obj_play_sound_and_rumble_if_visible(SOUND_GENERAL_BOX_LANDING_2)
elseif (stepRc & 1) ~= 0 then
if obj.oForwardVel > 20.0 then
cur_obj_play_sound_2(SOUND_ENV_SLIDING)
cur_obj_play_sound_and_rumble_if_visible(SOUND_ENV_SLIDING)
end
end

View file

@ -158,22 +158,22 @@ Spawns wind particles around the current object
## [check_if_moving_over_floor](#check_if_moving_over_floor)
### Description
Checks if the current object is moving `a1` units over a floor and within a threshold of `a0`
Checks if the current object is moving `distance` units over a floor and within a max distance to floor of `maxDistToFloor`
### Lua Example
`local integerValue = check_if_moving_over_floor(a0, a1)`
`local integerValue = check_if_moving_over_floor(maxDistToFloor, distance)`
### Parameters
| Field | Type |
| ----- | ---- |
| a0 | `number` |
| a1 | `number` |
| maxDistToFloor | `number` |
| distance | `number` |
### Returns
- `integer`
### C Prototype
`s32 check_if_moving_over_floor(f32 a0, f32 a1);`
`s32 check_if_moving_over_floor(f32 maxDistToFloor, f32 distance);`
[:arrow_up_small:](#)
@ -305,13 +305,13 @@ Spawns strong wind particles relative to the current object
<br />
## [bhv_star_door_loop_2](#bhv_star_door_loop_2)
## [bhv_star_door_loop_update_render_state](#bhv_star_door_loop_update_render_state)
### Description
Behavior loop function for Star Door
Behavior loop function for Star Door, which updates its render state
### Lua Example
`bhv_star_door_loop_2()`
`bhv_star_door_loop_update_render_state()`
### Parameters
- None
@ -320,7 +320,7 @@ Behavior loop function for Star Door
- None
### C Prototype
`void bhv_star_door_loop_2(void);`
`void bhv_star_door_loop_update_render_state(void);`
[:arrow_up_small:](#)
@ -1043,23 +1043,23 @@ Behavior loop function for cannon base unused
## [common_anchor_mario_behavior](#common_anchor_mario_behavior)
### Description
Common behavior for when Mario's anchoring when grabbed
Common behavior for an object when grabbing Mario. Used by King Bob-omb and Chuckya anchor objects. When Mario is thrown, sets `forwardVel`, `upwardsVel` and `interactStatusFlags` to him
### Lua Example
`common_anchor_mario_behavior(sp28, sp2C, sp30)`
`common_anchor_mario_behavior(forwardVel, upwardsVel, interactStatusFlags)`
### Parameters
| Field | Type |
| ----- | ---- |
| sp28 | `number` |
| sp2C | `number` |
| sp30 | `integer` |
| forwardVel | `number` |
| upwardsVel | `number` |
| interactStatusFlags | `integer` |
### Returns
- None
### C Prototype
`void common_anchor_mario_behavior(f32 sp28, f32 sp2C, s32 sp30);`
`void common_anchor_mario_behavior(f32 forwardVel, f32 upwardsVel, s32 interactStatusFlags);`
[:arrow_up_small:](#)

View file

@ -2909,29 +2909,6 @@ Marks Yoshi as alive
<br />
## [absf_2](#absf_2)
### Description
Absolute value (always positive) function
### Lua Example
`local numberValue = absf_2(f)`
### Parameters
| Field | Type |
| ----- | ---- |
| f | `number` |
### Returns
- `number`
### C Prototype
`f32 absf_2(f32 f);`
[:arrow_up_small:](#)
<br />
## [obj_find_wall](#obj_find_wall)
### Description

View file

@ -65,19 +65,19 @@ Overrides the current room Mario is in. Set to -1 to reset override
Updates an object's position based on a parent transformation matrix
### Lua Example
`obj_update_pos_from_parent_transformation(a0, a1)`
`obj_update_pos_from_parent_transformation(mtx, obj)`
### Parameters
| Field | Type |
| ----- | ---- |
| a0 | [Mat4](structs.md#Mat4) |
| a1 | [Object](structs.md#Object) |
| mtx | [Mat4](structs.md#Mat4) |
| obj | [Object](structs.md#Object) |
### Returns
- None
### C Prototype
`void obj_update_pos_from_parent_transformation(Mat4 a0, struct Object *a1);`
`void obj_update_pos_from_parent_transformation(Mat4 mtx, struct Object *obj);`
[:arrow_up_small:](#)
@ -114,20 +114,20 @@ Applies an object's scale to a transformation matrix
Combines two transformation matrices into a single result matrix
### Lua Example
`create_transformation_from_matrices(a0, a1, a2)`
`create_transformation_from_matrices(dest, src1, src2)`
### Parameters
| Field | Type |
| ----- | ---- |
| a0 | [Mat4](structs.md#Mat4) |
| a1 | [Mat4](structs.md#Mat4) |
| a2 | [Mat4](structs.md#Mat4) |
| dest | [Mat4](structs.md#Mat4) |
| src1 | [Mat4](structs.md#Mat4) |
| src2 | [Mat4](structs.md#Mat4) |
### Returns
- None
### C Prototype
`void create_transformation_from_matrices(VEC_OUT Mat4 a0, Mat4 a1, Mat4 a2);`
`void create_transformation_from_matrices(VEC_OUT Mat4 dest, Mat4 src1, Mat4 src2);`
[:arrow_up_small:](#)
@ -1329,27 +1329,6 @@ Sets the current object's position relative to its parent's facing direction
<br />
## [cur_obj_enable_rendering_2](#cur_obj_enable_rendering_2)
### Description
Alternative function that enables rendering for the current object
### Lua Example
`cur_obj_enable_rendering_2()`
### Parameters
- None
### Returns
- None
### C Prototype
`void cur_obj_enable_rendering_2(void);`
[:arrow_up_small:](#)
<br />
## [cur_obj_unused_init_on_floor](#cur_obj_unused_init_on_floor)
### Description
@ -1896,19 +1875,19 @@ Checks if Mario is performing a dive slide action
Sets the current object's vertical velocity and initializes an animation
### Lua Example
`cur_obj_set_y_vel_and_animation(sp18, sp1C)`
`cur_obj_set_y_vel_and_animation(velY, animIndex)`
### Parameters
| Field | Type |
| ----- | ---- |
| sp18 | `number` |
| sp1C | `integer` |
| velY | `number` |
| animIndex | `integer` |
### Returns
- None
### C Prototype
`void cur_obj_set_y_vel_and_animation(f32 sp18, s32 sp1C);`
`void cur_obj_set_y_vel_and_animation(f32 velY, s32 animIndex);`
[:arrow_up_small:](#)
@ -1917,22 +1896,22 @@ Sets the current object's vertical velocity and initializes an animation
## [cur_obj_unrender_and_reset_state](#cur_obj_unrender_and_reset_state)
### Description
Disables rendering, makes intangible, and resets action and animation
Disables rendering, makes intangible, and resets animation and action
### Lua Example
`cur_obj_unrender_and_reset_state(sp18, sp1C)`
`cur_obj_unrender_and_reset_state(animIndex, action)`
### Parameters
| Field | Type |
| ----- | ---- |
| sp18 | `integer` |
| sp1C | `integer` |
| animIndex | `integer` |
| action | `integer` |
### Returns
- None
### C Prototype
`void cur_obj_unrender_and_reset_state(s32 sp18, s32 sp1C);`
`void cur_obj_unrender_and_reset_state(s32 animIndex, s32 action);`
[:arrow_up_small:](#)
@ -2831,23 +2810,23 @@ Starts a camera event and makes the current object the secondary camera focus
## [set_mario_interact_hoot_if_in_range](#set_mario_interact_hoot_if_in_range)
### Description
Sets Mario's interact status to hoot-grabbed if Mario is within range
Sets Mario's interact status to hoot-grabbed if Mario is within range `maxDistanceToMario`
### Lua Example
`set_mario_interact_hoot_if_in_range(sp0, sp4, sp8)`
`set_mario_interact_hoot_if_in_range(unused1, unused2, maxDistanceToMario)`
### Parameters
| Field | Type |
| ----- | ---- |
| sp0 | `integer` |
| sp4 | `integer` |
| sp8 | `number` |
| unused1 | `integer` |
| unused2 | `integer` |
| maxDistanceToMario | `number` |
### Returns
- None
### C Prototype
`void set_mario_interact_hoot_if_in_range(UNUSED s32 sp0, UNUSED s32 sp4, f32 sp8);`
`void set_mario_interact_hoot_if_in_range(UNUSED s32 unused1, UNUSED s32 unused2, f32 maxDistanceToMario);`
[:arrow_up_small:](#)
@ -3024,14 +3003,14 @@ Sets the current object's hurtbox radius and height
Spawns loot coins from an object using the specified behavior, jitter, and model
### Lua Example
`obj_spawn_loot_coins(obj, numCoins, sp30, coinBehavior, posJitter, model)`
`obj_spawn_loot_coins(obj, numCoins, baseYVel, coinBehavior, posJitter, model)`
### Parameters
| Field | Type |
| ----- | ---- |
| obj | [Object](structs.md#Object) |
| numCoins | `integer` |
| sp30 | `number` |
| baseYVel | `number` |
| coinBehavior | `Pointer` <`BehaviorScript`> |
| posJitter | `integer` |
| model | `integer` |
@ -3040,7 +3019,7 @@ Spawns loot coins from an object using the specified behavior, jitter, and model
- None
### C Prototype
`void obj_spawn_loot_coins(struct Object *obj, s32 numCoins, f32 sp30, const BehaviorScript *coinBehavior, s16 posJitter, s16 model);`
`void obj_spawn_loot_coins(struct Object *obj, s32 numCoins, f32 baseYVel, const BehaviorScript *coinBehavior, s16 posJitter, s16 model);`
[:arrow_up_small:](#)
@ -3052,21 +3031,21 @@ Spawns loot coins from an object using the specified behavior, jitter, and model
Spawns blue loot coins from an object
### Lua Example
`obj_spawn_loot_blue_coins(obj, numCoins, sp28, posJitter)`
`obj_spawn_loot_blue_coins(obj, numCoins, baseYVel, posJitter)`
### Parameters
| Field | Type |
| ----- | ---- |
| obj | [Object](structs.md#Object) |
| numCoins | `integer` |
| sp28 | `number` |
| baseYVel | `number` |
| posJitter | `integer` |
### Returns
- None
### C Prototype
`void obj_spawn_loot_blue_coins(struct Object *obj, s32 numCoins, f32 sp28, s16 posJitter);`
`void obj_spawn_loot_blue_coins(struct Object *obj, s32 numCoins, f32 baseYVel, s16 posJitter);`
[:arrow_up_small:](#)
@ -3078,20 +3057,20 @@ Spawns blue loot coins from an object
Spawns yellow loot coins from an object
### Lua Example
`obj_spawn_loot_yellow_coins(obj, numCoins, sp28)`
`obj_spawn_loot_yellow_coins(obj, numCoins, baseYVel)`
### Parameters
| Field | Type |
| ----- | ---- |
| obj | [Object](structs.md#Object) |
| numCoins | `integer` |
| sp28 | `number` |
| baseYVel | `number` |
### Returns
- None
### C Prototype
`void obj_spawn_loot_yellow_coins(struct Object *obj, s32 numCoins, f32 sp28);`
`void obj_spawn_loot_yellow_coins(struct Object *obj, s32 numCoins, f32 baseYVel);`
[:arrow_up_small:](#)
@ -3759,18 +3738,18 @@ Applies a random translation to an object on the X and Z axes
Builds the object's world velocity from its transform basis vectors
### Lua Example
`obj_build_vel_from_transform(a0)`
`obj_build_vel_from_transform(obj)`
### Parameters
| Field | Type |
| ----- | ---- |
| a0 | [Object](structs.md#Object) |
| obj | [Object](structs.md#Object) |
### Returns
- None
### C Prototype
`void obj_build_vel_from_transform(struct Object *a0);`
`void obj_build_vel_from_transform(struct Object *obj);`
[:arrow_up_small:](#)
@ -4069,51 +4048,27 @@ Behavior loop function for dust smoke
<br />
## [stub_obj_helpers_3](#stub_obj_helpers_3)
### Description
Placeholder function with no behavior
### Lua Example
`stub_obj_helpers_3(sp0, sp4)`
### Parameters
| Field | Type |
| ----- | ---- |
| sp0 | `integer` |
| sp4 | `integer` |
### Returns
- None
### C Prototype
`void stub_obj_helpers_3(UNUSED s32 sp0, UNUSED s32 sp4);`
[:arrow_up_small:](#)
<br />
## [cur_obj_scale_over_time](#cur_obj_scale_over_time)
### Description
Smoothly scales the current object over time using enabled axes
Smoothly scales between `minScale` and `maxScale` the current object over a `duration` using enabled `axes` (1 = x, 2 = y, 4 = z, can be combined)
### Lua Example
`cur_obj_scale_over_time(a0, a1, sp10, sp14)`
`cur_obj_scale_over_time(axes, duration, minScale, maxScale)`
### Parameters
| Field | Type |
| ----- | ---- |
| a0 | `integer` |
| a1 | `integer` |
| sp10 | `number` |
| sp14 | `number` |
| axes | `integer` |
| duration | `integer` |
| minScale | `number` |
| maxScale | `number` |
### Returns
- None
### C Prototype
`void cur_obj_scale_over_time(s32 a0, s32 a1, f32 sp10, f32 sp14);`
`void cur_obj_scale_over_time(s32 axes, s32 duration, f32 minScale, f32 maxScale);`
[:arrow_up_small:](#)
@ -4140,27 +4095,6 @@ Moves an object to its home position while applying debug position offsets
<br />
## [stub_obj_helpers_4](#stub_obj_helpers_4)
### Description
Placeholder function with no behavior
### Lua Example
`stub_obj_helpers_4()`
### Parameters
- None
### Returns
- None
### C Prototype
`void stub_obj_helpers_4(void);`
[:arrow_up_small:](#)
<br />
## [cur_obj_is_mario_on_platform](#cur_obj_is_mario_on_platform)
### Description
@ -4233,18 +4167,18 @@ Oscillates the current object vertically until a specified number of cycles pass
Moves the current object up and down along a preset displacement table
### Lua Example
`local integerValue = cur_obj_move_up_and_down(a0)`
`local integerValue = cur_obj_move_up_and_down(index)`
### Parameters
| Field | Type |
| ----- | ---- |
| a0 | `integer` |
| index | `integer` |
### Returns
- `integer`
### C Prototype
`s32 cur_obj_move_up_and_down(s32 a0);`
`s32 cur_obj_move_up_and_down(s32 index);`
[:arrow_up_small:](#)
@ -4256,19 +4190,19 @@ Moves the current object up and down along a preset displacement table
Spawns a star object without triggering level exit behavior
### Lua Example
`local objectValue = spawn_star_with_no_lvl_exit(sp20, sp24)`
`local objectValue = spawn_star_with_no_lvl_exit(setHomeToMario, unused)`
### Parameters
| Field | Type |
| ----- | ---- |
| sp20 | `integer` |
| sp24 | `integer` |
| setHomeToMario | `integer` |
| unused | `integer` |
### Returns
- [Object](structs.md#Object)
### C Prototype
`struct Object *spawn_star_with_no_lvl_exit(s32 sp20, s32 sp24);`
`struct Object *spawn_star_with_no_lvl_exit(s32 setHomeToMario, s32 unused);`
[:arrow_up_small:](#)
@ -4295,29 +4229,6 @@ Spawns a base star with default parameters and no level exit behavior
<br />
## [bit_shift_left](#bit_shift_left)
### Description
Returns the value at index a0 from a behavior-specific left-shift table
### Lua Example
`local integerValue = bit_shift_left(a0)`
### Parameters
| Field | Type |
| ----- | ---- |
| a0 | `integer` |
### Returns
- `integer`
### C Prototype
`s32 bit_shift_left(s32 a0);`
[:arrow_up_small:](#)
<br />
## [cur_obj_mario_far_away](#cur_obj_mario_far_away)
### Description
@ -4459,19 +4370,19 @@ Gives the current object a hitbox and kills it if attacked, with optional loot s
Explodes the current object, spawns particles, and optionally spawns coins
### Lua Example
`obj_explode_and_spawn_coins(sp18, sp1C)`
`obj_explode_and_spawn_coins(mistSize, coinType)`
### Parameters
| Field | Type |
| ----- | ---- |
| sp18 | `number` |
| sp1C | `integer` |
| mistSize | `number` |
| coinType | [enum CoinType](constants.md#enum-CoinType) |
### Returns
- None
### C Prototype
`void obj_explode_and_spawn_coins(f32 sp18, s32 sp1C);`
`void obj_explode_and_spawn_coins(f32 mistSize, enum CoinType coinType);`
[:arrow_up_small:](#)
@ -4696,32 +4607,7 @@ Checks whether Mario can activate the current object's textbox within a vertical
- `integer`
### C Prototype
`s32 cur_obj_can_mario_activate_textbox(struct MarioState* m, f32 radius, f32 height, UNUSED s32 unused);`
[:arrow_up_small:](#)
<br />
## [cur_obj_can_mario_activate_textbox_2](#cur_obj_can_mario_activate_textbox_2)
### Description
Wrapper that checks Mario textbox activation using a fixed unused parameter value
### Lua Example
`local integerValue = cur_obj_can_mario_activate_textbox_2(m, radius, height)`
### Parameters
| Field | Type |
| ----- | ---- |
| m | [MarioState](structs.md#MarioState) |
| radius | `number` |
| height | `number` |
### Returns
- `integer`
### C Prototype
`s32 cur_obj_can_mario_activate_textbox_2(struct MarioState* m, f32 radius, f32 height);`
`s32 cur_obj_can_mario_activate_textbox(struct MarioState* m, f32 radius, f32 height, OPTIONAL UNUSED s32 unused);`
[:arrow_up_small:](#)
@ -5273,22 +5159,22 @@ Apply one frame of platform rotation to the object using the given platform
## [queue_rumble_data](#queue_rumble_data)
### Description
Queues rumble data
Queues rumble data with `time` and `level`
### Lua Example
`queue_rumble_data(a0, a1)`
`queue_rumble_data(time, level)`
### Parameters
| Field | Type |
| ----- | ---- |
| a0 | `integer` |
| a1 | `integer` |
| time | `integer` |
| level | `integer` |
### Returns
- None
### C Prototype
`void queue_rumble_data(s16 a0, s16 a1);`
`void queue_rumble_data(s16 time, s16 level);`
[:arrow_up_small:](#)
@ -5297,23 +5183,23 @@ Queues rumble data
## [queue_rumble_data_object](#queue_rumble_data_object)
### Description
Queues rumble data for object, factoring in its distance from Mario
Queues rumble data for object with `time` and `level`, factoring in its distance from Mario
### Lua Example
`queue_rumble_data_object(object, a0, a1)`
`queue_rumble_data_object(object, time, level)`
### Parameters
| Field | Type |
| ----- | ---- |
| object | [Object](structs.md#Object) |
| a0 | `integer` |
| a1 | `integer` |
| time | `integer` |
| level | `integer` |
### Returns
- None
### C Prototype
`void queue_rumble_data_object(struct Object* object, s16 a0, s16 a1);`
`void queue_rumble_data_object(struct Object* object, s16 time, s16 level);`
[:arrow_up_small:](#)
@ -5322,23 +5208,67 @@ Queues rumble data for object, factoring in its distance from Mario
## [queue_rumble_data_mario](#queue_rumble_data_mario)
### Description
Queues rumble data for Mario
Queues rumble data with `time` and `level` only if `m` is the local Mario
### Lua Example
`queue_rumble_data_mario(m, a0, a1)`
`queue_rumble_data_mario(m, time, level)`
### Parameters
| Field | Type |
| ----- | ---- |
| m | [MarioState](structs.md#MarioState) |
| a0 | `integer` |
| a1 | `integer` |
| time | `integer` |
| level | `integer` |
### Returns
- None
### C Prototype
`void queue_rumble_data_mario(struct MarioState* m, s16 a0, s16 a1);`
`void queue_rumble_data_mario(struct MarioState* m, s16 time, s16 level);`
[:arrow_up_small:](#)
<br />
## [queue_rumble_decay](#queue_rumble_decay)
### Description
Queues rumble `decay`
### Lua Example
`queue_rumble_decay(decay)`
### Parameters
| Field | Type |
| ----- | ---- |
| decay | `integer` |
### Returns
- None
### C Prototype
`void queue_rumble_decay(s16 decay);`
[:arrow_up_small:](#)
<br />
## [is_rumble_finished_and_queue_empty](#is_rumble_finished_and_queue_empty)
### Description
Checks if rumble is finished and there is no rumble queued
### Lua Example
`local integerValue = is_rumble_finished_and_queue_empty()`
### Parameters
- None
### Returns
- `integer`
### C Prototype
`u8 is_rumble_finished_and_queue_empty(void);`
[:arrow_up_small:](#)
@ -5347,7 +5277,7 @@ Queues rumble data for Mario
## [reset_rumble_timers](#reset_rumble_timers)
### Description
Resets rumble timers
Resets rumble timers only if `m` is the local Mario
### Lua Example
`reset_rumble_timers(m)`
@ -5367,25 +5297,67 @@ Resets rumble timers
<br />
## [reset_rumble_timers_2](#reset_rumble_timers_2)
## [reset_rumble_timers_vibrate](#reset_rumble_timers_vibrate)
### Description
Resets rumble timers and sets a field based on `a0`
Resets rumble timers and sets vibrate based on `level`
### Lua Example
`reset_rumble_timers_2(m, a0)`
`reset_rumble_timers_vibrate(m, level)`
### Parameters
| Field | Type |
| ----- | ---- |
| m | [MarioState](structs.md#MarioState) |
| a0 | `integer` |
| level | `integer` |
### Returns
- None
### C Prototype
`void reset_rumble_timers_2(struct MarioState* m, s32 a0);`
`void reset_rumble_timers_vibrate(struct MarioState* m, s32 level);`
[:arrow_up_small:](#)
<br />
## [queue_rumble_submerged](#queue_rumble_submerged)
### Description
Queues rumble data for submerged actions
### Lua Example
`queue_rumble_submerged()`
### Parameters
- None
### Returns
- None
### C Prototype
`void queue_rumble_submerged(void);`
[:arrow_up_small:](#)
<br />
## [cancel_rumble](#cancel_rumble)
### Description
Cancels all currently queued rumble data
### Lua Example
`cancel_rumble()`
### Parameters
- None
### Returns
- None
### C Prototype
`void cancel_rumble(void);`
[:arrow_up_small:](#)

View file

@ -4104,7 +4104,7 @@ You can change the fields of the object in `objSetupFunction`
- [Object](structs.md#Object)
### C Prototype
`struct Object* spawn_sync_object(enum BehaviorId behaviorId, enum ModelExtendedId modelId, f32 x, f32 y, f32 z, LuaFunction objSetupFunction);`
`struct Object* spawn_sync_object(enum BehaviorId behaviorId, enum ModelExtendedId modelId, f32 x, f32 y, f32 z, OPTIONAL LuaFunction objSetupFunction);`
[:arrow_up_small:](#)
@ -4133,7 +4133,7 @@ You can change the fields of the object in `objSetupFunction`
- [Object](structs.md#Object)
### C Prototype
`struct Object* spawn_non_sync_object(enum BehaviorId behaviorId, enum ModelExtendedId modelId, f32 x, f32 y, f32 z, LuaFunction objSetupFunction);`
`struct Object* spawn_non_sync_object(enum BehaviorId behaviorId, enum ModelExtendedId modelId, f32 x, f32 y, f32 z, OPTIONAL LuaFunction objSetupFunction);`
[:arrow_up_small:](#)
@ -6332,13 +6332,13 @@ Stops cap music completely
<br />
## [cur_obj_play_sound_1](#cur_obj_play_sound_1)
## [cur_obj_play_sound_if_visible](#cur_obj_play_sound_if_visible)
### Description
Plays a sound if the current object is visible
### Lua Example
`cur_obj_play_sound_1(soundMagic)`
`cur_obj_play_sound_if_visible(soundMagic)`
### Parameters
| Field | Type |
@ -6349,19 +6349,19 @@ Plays a sound if the current object is visible
- None
### C Prototype
`void cur_obj_play_sound_1(s32 soundMagic);`
`void cur_obj_play_sound_if_visible(s32 soundMagic);`
[:arrow_up_small:](#)
<br />
## [cur_obj_play_sound_2](#cur_obj_play_sound_2)
## [cur_obj_play_sound_and_rumble_if_visible](#cur_obj_play_sound_and_rumble_if_visible)
### Description
Plays a sound if the current object is visible and queues rumble for specific sounds
Plays a sound if the current object is visible and queues rumble for the following sounds: `SOUND_OBJ_BOWSER_WALK`, `SOUND_OBJ_POUNDING_LOUD`, `SOUND_OBJ_WHOMP_LOWPRIO`
### Lua Example
`cur_obj_play_sound_2(soundMagic)`
`cur_obj_play_sound_and_rumble_if_visible(soundMagic)`
### Parameters
| Field | Type |
@ -6372,7 +6372,7 @@ Plays a sound if the current object is visible and queues rumble for specific so
- None
### C Prototype
`void cur_obj_play_sound_2(s32 soundMagic);`
`void cur_obj_play_sound_and_rumble_if_visible(s32 soundMagic);`
[:arrow_up_small:](#)
@ -6402,56 +6402,6 @@ Create a sound spawner for objects that need a sound play once.
<br />
## [calc_dist_to_volume_range_1](#calc_dist_to_volume_range_1)
### Description
Unused vanilla function, calculates a volume based on `distance`.
If `distance` is less than 500 then 127, if `distance` is greater than 1500 then 0, if `distance` is between 500 and 1500 then it ranges linearly from 60 to 124.
What an even more strange and confusing function
### Lua Example
`local integerValue = calc_dist_to_volume_range_1(distance)`
### Parameters
| Field | Type |
| ----- | ---- |
| distance | `number` |
### Returns
- `integer`
### C Prototype
`s32 calc_dist_to_volume_range_1(f32 distance);`
[:arrow_up_small:](#)
<br />
## [calc_dist_to_volume_range_2](#calc_dist_to_volume_range_2)
### Description
Unused vanilla function, calculates a volume based on `distance`.
If `distance` is less than 1300 then 127, if `distance` is greater than 2300 then 0, if `distance` is between 1300 and 2300 then it ranges linearly from 60 to 127.
What a strange and confusing function
### Lua Example
`local integerValue = calc_dist_to_volume_range_2(distance)`
### Parameters
| Field | Type |
| ----- | ---- |
| distance | `number` |
### Returns
- `integer`
### C Prototype
`s32 calc_dist_to_volume_range_2(f32 distance);`
[:arrow_up_small:](#)
<br />
---
# functions from surface_collision.h

View file

@ -53,7 +53,7 @@
- [play_penguin_walking_sound](functions-2.md#play_penguin_walking_sound)
- [update_angle_from_move_flags](functions-2.md#update_angle_from_move_flags)
- [cur_obj_spawn_strong_wind_particles](functions-2.md#cur_obj_spawn_strong_wind_particles)
- [bhv_star_door_loop_2](functions-2.md#bhv_star_door_loop_2)
- [bhv_star_door_loop_update_render_state](functions-2.md#bhv_star_door_loop_update_render_state)
- [bhv_cap_switch_loop](functions-2.md#bhv_cap_switch_loop)
- [bhv_tiny_star_particles_init](functions-2.md#bhv_tiny_star_particles_init)
- [bhv_grindel_thwomp_loop](functions-2.md#bhv_grindel_thwomp_loop)
@ -1457,7 +1457,6 @@
- obj_behaviors.c
- [set_yoshi_as_not_dead](functions-5.md#set_yoshi_as_not_dead)
- [absf_2](functions-5.md#absf_2)
- [obj_find_wall](functions-5.md#obj_find_wall)
- [turn_obj_away_from_steep_floor](functions-5.md#turn_obj_away_from_steep_floor)
- [obj_orient_graph](functions-5.md#obj_orient_graph)
@ -1601,7 +1600,6 @@
- [cur_obj_hide](functions-6.md#cur_obj_hide)
- [cur_obj_set_pos_relative](functions-6.md#cur_obj_set_pos_relative)
- [cur_obj_set_pos_relative_to_parent](functions-6.md#cur_obj_set_pos_relative_to_parent)
- [cur_obj_enable_rendering_2](functions-6.md#cur_obj_enable_rendering_2)
- [cur_obj_unused_init_on_floor](functions-6.md#cur_obj_unused_init_on_floor)
- [obj_set_face_angle_to_move_angle](functions-6.md#obj_set_face_angle_to_move_angle)
- [get_object_list_from_behavior](functions-6.md#get_object_list_from_behavior)
@ -1721,17 +1719,14 @@
- [cur_obj_push_mario_away](functions-6.md#cur_obj_push_mario_away)
- [cur_obj_push_mario_away_from_cylinder](functions-6.md#cur_obj_push_mario_away_from_cylinder)
- [bhv_dust_smoke_loop](functions-6.md#bhv_dust_smoke_loop)
- [stub_obj_helpers_3](functions-6.md#stub_obj_helpers_3)
- [cur_obj_scale_over_time](functions-6.md#cur_obj_scale_over_time)
- [cur_obj_set_pos_to_home_with_debug](functions-6.md#cur_obj_set_pos_to_home_with_debug)
- [stub_obj_helpers_4](functions-6.md#stub_obj_helpers_4)
- [cur_obj_is_mario_on_platform](functions-6.md#cur_obj_is_mario_on_platform)
- [cur_obj_is_any_player_on_platform](functions-6.md#cur_obj_is_any_player_on_platform)
- [cur_obj_shake_y_until](functions-6.md#cur_obj_shake_y_until)
- [cur_obj_move_up_and_down](functions-6.md#cur_obj_move_up_and_down)
- [spawn_star_with_no_lvl_exit](functions-6.md#spawn_star_with_no_lvl_exit)
- [spawn_base_star_with_no_lvl_exit](functions-6.md#spawn_base_star_with_no_lvl_exit)
- [bit_shift_left](functions-6.md#bit_shift_left)
- [cur_obj_mario_far_away](functions-6.md#cur_obj_mario_far_away)
- [is_mario_moving_fast_or_in_air](functions-6.md#is_mario_moving_fast_or_in_air)
- [is_item_in_array](functions-6.md#is_item_in_array)
@ -1749,7 +1744,6 @@
- [set_time_stop_flags_if_alone](functions-6.md#set_time_stop_flags_if_alone)
- [clear_time_stop_flags](functions-6.md#clear_time_stop_flags)
- [cur_obj_can_mario_activate_textbox](functions-6.md#cur_obj_can_mario_activate_textbox)
- [cur_obj_can_mario_activate_textbox_2](functions-6.md#cur_obj_can_mario_activate_textbox_2)
- [cur_obj_end_dialog](functions-6.md#cur_obj_end_dialog)
- [cur_obj_has_model](functions-6.md#cur_obj_has_model)
- [cur_obj_align_gfx_with_floor](functions-6.md#cur_obj_align_gfx_with_floor)
@ -1788,8 +1782,12 @@
- [queue_rumble_data](functions-6.md#queue_rumble_data)
- [queue_rumble_data_object](functions-6.md#queue_rumble_data_object)
- [queue_rumble_data_mario](functions-6.md#queue_rumble_data_mario)
- [queue_rumble_decay](functions-6.md#queue_rumble_decay)
- [is_rumble_finished_and_queue_empty](functions-6.md#is_rumble_finished_and_queue_empty)
- [reset_rumble_timers](functions-6.md#reset_rumble_timers)
- [reset_rumble_timers_2](functions-6.md#reset_rumble_timers_2)
- [reset_rumble_timers_vibrate](functions-6.md#reset_rumble_timers_vibrate)
- [queue_rumble_submerged](functions-6.md#queue_rumble_submerged)
- [cancel_rumble](functions-6.md#cancel_rumble)
<br />
@ -2231,11 +2229,9 @@
<br />
- spawn_sound.h
- [cur_obj_play_sound_1](functions-7.md#cur_obj_play_sound_1)
- [cur_obj_play_sound_2](functions-7.md#cur_obj_play_sound_2)
- [cur_obj_play_sound_if_visible](functions-7.md#cur_obj_play_sound_if_visible)
- [cur_obj_play_sound_and_rumble_if_visible](functions-7.md#cur_obj_play_sound_and_rumble_if_visible)
- [create_sound_spawner](functions-7.md#create_sound_spawner)
- [calc_dist_to_volume_range_1](functions-7.md#calc_dist_to_volume_range_1)
- [calc_dist_to_volume_range_2](functions-7.md#calc_dist_to_volume_range_2)
<br />

View file

@ -90,7 +90,6 @@
|`bhvUnused0DFC`|`OBJ_LIST_DEFAULT`|
|`bhvMistCircParticleSpawner`|`OBJ_LIST_DEFAULT`|
|`bhvDirtParticleSpawner`|`OBJ_LIST_DEFAULT`|
|``|`OBJ_LIST_DEFAULT`|
|`bhvSnowParticleSpawner`|`OBJ_LIST_DEFAULT`|
|`bhvWind`|`OBJ_LIST_UNIMPORTANT`|
|`bhvEndToad`|`OBJ_LIST_DEFAULT`|
@ -106,6 +105,7 @@
|`bhvBitfsTiltingInvertedPyramid`|`OBJ_LIST_SURFACE`|
|`bhvSquishablePlatform`|`OBJ_LIST_SURFACE`|
|`bhvCutOutObject`|`OBJ_LIST_GENACTOR`|
|`bhvBetaMovingFlamesSpawn`|`OBJ_LIST_DEFAULT`|
|`bhvBetaMovingFlames`|`OBJ_LIST_LEVEL`|
|`bhvRrRotatingBridgePlatform`|`OBJ_LIST_SURFACE`|
|`bhvFlamethrower`|`OBJ_LIST_DEFAULT`|
@ -186,6 +186,7 @@
|`bhvLllSinkingRockBlock`|`OBJ_LIST_SURFACE`|
|`bhvStub1D70`|`OBJ_LIST_DEFAULT`|
|`bhvLllMovingOctagonalMeshPlatform`|`OBJ_LIST_SURFACE`|
|`bhvSnowBall`|`OBJ_LIST_DEFAULT`|
|`bhvLllRotatingBlockWithFireBars`|`OBJ_LIST_SURFACE`|
|`bhvLllRotatingHexFlame`|`OBJ_LIST_LEVEL`|
|`bhvLllWoodPiece`|`OBJ_LIST_SURFACE`|
@ -214,6 +215,7 @@
|`bhvWdwExpressElevator`|`OBJ_LIST_SURFACE`|
|`bhvWdwExpressElevatorPlatform`|`OBJ_LIST_SURFACE`|
|`bhvChirpChirp`|`OBJ_LIST_DEFAULT`|
|`bhvChirpChirpUnused`|`OBJ_LIST_DEFAULT`|
|`bhvBub`|`OBJ_LIST_GENACTOR`|
|`bhvExclamationBox`|`OBJ_LIST_SURFACE`|
|`bhvRotatingExclamationMark`|`OBJ_LIST_DEFAULT`|
@ -235,6 +237,7 @@
|`bhvWhitePuff2`|`OBJ_LIST_UNIMPORTANT`|
|`bhvWhitePuffSmoke2`|`OBJ_LIST_UNIMPORTANT`|
|`bhvPurpleSwitchHiddenBoxes`|`OBJ_LIST_SURFACE`|
|`bhvBlueCoinNumber`|`OBJ_LIST_DEFAULT`|
|`bhvBlueCoinSwitch`|`OBJ_LIST_SURFACE`|
|`bhvHiddenBlueCoin`|`OBJ_LIST_LEVEL`|
|`bhvOpenableCageDoor`|`OBJ_LIST_SURFACE`|
@ -261,6 +264,7 @@
|`bhvMeshElevator`|`OBJ_LIST_SURFACE`|
|`bhvMerryGoRound`|`OBJ_LIST_SURFACE`|
|`bhvPlaysMusicTrackWhenTouched`|`OBJ_LIST_DEFAULT`|
|`bhvInsideCannon`|`OBJ_LIST_DEFAULT`|
|`bhvBetaBowserAnchor`|`OBJ_LIST_DESTRUCTIVE`|
|`bhvStaticCheckeredPlatform`|`OBJ_LIST_SURFACE`|
|`bhvUnused2A10`|`OBJ_LIST_DEFAULT`|
@ -273,7 +277,6 @@
|`bhvSparkle`|`OBJ_LIST_UNIMPORTANT`|
|`bhvSparkleSpawn`|`OBJ_LIST_UNIMPORTANT`|
|`bhvSparkleParticleSpawner`|`OBJ_LIST_DEFAULT`|
|``|`OBJ_LIST_UNIMPORTANT`|
|`bhvScuttlebug`|`OBJ_LIST_GENACTOR`|
|`bhvScuttlebugSpawn`|`OBJ_LIST_SPAWNER`|
|`bhvWhompKingBoss`|`OBJ_LIST_SURFACE`|
@ -296,6 +299,20 @@
|`bhvMario`|`OBJ_LIST_PLAYER`|
|`bhvToadMessage`|`OBJ_LIST_GENACTOR`|
|`bhvUnlockDoorStar`|`OBJ_LIST_LEVEL`|
|`bhvInstantActiveWarp`|`OBJ_LIST_DEFAULT`|
|`bhvAirborneWarp`|`OBJ_LIST_DEFAULT`|
|`bhvHardAirKnockBackWarp`|`OBJ_LIST_DEFAULT`|
|`bhvSpinAirborneCircleWarp`|`OBJ_LIST_DEFAULT`|
|`bhvDeathWarp`|`OBJ_LIST_DEFAULT`|
|`bhvSpinAirborneWarp`|`OBJ_LIST_DEFAULT`|
|`bhvFlyingWarp`|`OBJ_LIST_DEFAULT`|
|`bhvPaintingStarCollectWarp`|`OBJ_LIST_DEFAULT`|
|`bhvPaintingDeathWarp`|`OBJ_LIST_DEFAULT`|
|`bhvAirborneDeathWarp`|`OBJ_LIST_DEFAULT`|
|`bhvAirborneStarCollectWarp`|`OBJ_LIST_DEFAULT`|
|`bhvLaunchStarCollectWarp`|`OBJ_LIST_DEFAULT`|
|`bhvLaunchDeathWarp`|`OBJ_LIST_DEFAULT`|
|`bhvSwimmingWarp`|`OBJ_LIST_DEFAULT`|
|`bhvRandomAnimatedTexture`|`OBJ_LIST_LEVEL`|
|`bhvYellowBackgroundInMenu`|`OBJ_LIST_LEVEL`|
|`bhvMenuButton`|`OBJ_LIST_LEVEL`|
@ -388,6 +405,7 @@
|`bhvMetalCap`|`OBJ_LIST_LEVEL`|
|`bhvNormalCap`|`OBJ_LIST_LEVEL`|
|`bhvVanishCap`|`OBJ_LIST_LEVEL`|
|`bhvStarNumber`|`OBJ_LIST_DEFAULT`|
|`bhvStar`|`OBJ_LIST_LEVEL`|
|`bhvStarSpawnCoordinates`|`OBJ_LIST_LEVEL`|
|`bhvHiddenRedCoinStar`|`OBJ_LIST_LEVEL`|

View file

@ -95,6 +95,7 @@
- [Vec4i](#Vec4i)
- [Vec4s](#Vec4s)
- [VoicePlayer](#VoicePlayer)
- [VoicePlayerInternal](#VoicePlayerInternal)
- [Vtx](#Vtx)
- [WallCollisionData](#WallCollisionData)
- [WarpNode](#WarpNode)
@ -2173,6 +2174,7 @@
| oCoinUnkF4 | `integer` | |
| oCoinUnkF8 | `integer` | |
| oCoinUnk110 | `number` | |
| oCoinBaseYVel | `number` | |
| oCoinUnk1B0 | `integer` | |
| oCollisionParticleUnkF4 | `number` | |
| oControllablePlatformUnkF8 | `integer` | |
@ -3114,6 +3116,16 @@
<br />
## [VoicePlayerInternal](#VoicePlayerInternal)
| Field | Type | Access |
| ----- | ---- | ------ |
| buffer | [VoiceBuffer](structs.md#VoiceBuffer) | read-only |
[:arrow_up_small:](#)
<br />
## [Vtx](#Vtx)
| Field | Type | Access |

View file

@ -146,6 +146,13 @@
#define BOBOMB_ACT_LAVA_DEATH 100
#define BOBOMB_ACT_DEATH_PLANE_DEATH 101
/* Coin Type */
enum CoinType { // coinType
COIN_TYPE_NONE,
COIN_TYPE_YELLOW,
COIN_TYPE_BLUE
};
/* Hidden Blue Coin */
/* oAction */
#define HIDDEN_BLUE_COIN_ACT_INACTIVE 0

View file

@ -398,11 +398,12 @@
#define /*0x1AC*/ oCloudFwooshMovementRadius OBJECT_FIELD_S16(0x49, 0)
/* Coin */
#define /*0x0F4*/ oCoinUnkF4 OBJECT_FIELD_S32(0x1B)
#define /*0x0F8*/ oCoinUnkF8 OBJECT_FIELD_S32(0x1C)
#define /*0x110*/ oCoinUnk110 OBJECT_FIELD_F32(0x22)
#define /*0x0F4*/ oCoinUnkF4 OBJECT_FIELD_S32(0x1B)
#define /*0x0F8*/ oCoinUnkF8 OBJECT_FIELD_S32(0x1C)
#define /*0x110*/ oCoinUnk110 OBJECT_FIELD_F32(0x22)
#define /*0x110*/ oCoinBaseYVel OBJECT_FIELD_F32(0x22)
#ifndef VERSION_JP
#define /*0x1B0*/ oCoinUnk1B0 OBJECT_FIELD_S32(0x4A)
#define /*0x1B0*/ oCoinUnk1B0 OBJECT_FIELD_S32(0x4A)
#endif
/* Collision Particle */

View file

@ -198,6 +198,7 @@ FILE_SELECT_THEME = "Selezione file"
[DYNOS]
DYNOS = "DYNOS"
LOCAL_PLAYER_MODEL_ONLY = "Solo modello del giocatore locale"
OPEN_DYNOS_FOLDER = "Apri la cartella dei DynOS"
[HOST_MESSAGE]
INFO_TITLE = "INFO"
@ -212,6 +213,8 @@ MODS = "MOD"
CATEGORIES = "Categorie"
WARNING = "\\#ffffa0\\Attenzione:\\#dcdcdc\\ Sono state attivate 10 o più mod, disabilitane alcune per evitare instabilità o lag."
NO_MODS_FOUND = "Non è stata trovata alcuna mod."
BROWSE_MODS = "Cerca tra le Mod"
OPEN_MOD_FOLDER = "Apri la cartella delle Mod"
[HOST_MOD_CATEGORIES]
ALL = "Tutte"

View file

@ -1308,7 +1308,7 @@ static const Gfx inside_castle_seg7_painting_dl_070235B8[] = {
}
// 0x07023620 - 0x07023698
struct Painting bob_painting = {
DEFINE_PAINTING(bob_painting, {
/* id */ 0x0000,
/* Image Count */ 0x02,
/* Texture Type */ PAINTING_IMAGE,
@ -1333,10 +1333,10 @@ struct Painting bob_painting = {
/* Mario Below */ 0x00, 0x00, 0x00, /* Whether or not Mario is below the painting */
/* Size */ 614.0f,
/* Ripples */ { 0 },
};
});
// 0x07023698 - 0x07023710
struct Painting ccm_painting = {
DEFINE_PAINTING(ccm_painting, {
/* id */ 0x0001,
/* Image Count */ 0x02,
/* Texture Type */ PAINTING_IMAGE,
@ -1361,10 +1361,10 @@ struct Painting ccm_painting = {
/* Mario Below */ 0x00, 0x00, 0x00, /* Whether or not Mario is below the painting */
/* Size */ 614.0f,
/* Ripples */ { 0 },
};
});
// 0x07023710 - 0x07023788
struct Painting wf_painting = {
DEFINE_PAINTING(wf_painting, {
/* id */ 0x0002,
/* Image Count */ 0x02,
/* Texture Type */ PAINTING_IMAGE,
@ -1389,10 +1389,10 @@ struct Painting wf_painting = {
/* Mario Below */ 0x00, 0x00, 0x00, /* Whether or not Mario is below the painting */
/* Size */ 614.0f,
/* Ripples */ { 0 },
};
});
// 0x07023788 - 0x07023800
struct Painting jrb_painting = {
DEFINE_PAINTING(jrb_painting, {
/* id */ 0x0003,
/* Image Count */ 0x02,
/* Texture Type */ PAINTING_IMAGE,
@ -1417,10 +1417,10 @@ struct Painting jrb_painting = {
/* Mario Below */ 0x00, 0x00, 0x00, /* Whether or not Mario is below the painting */
/* Size */ 614.0f,
/* Ripples */ { 0 },
};
});
// 0x07023800 - 0x07023878
struct Painting lll_painting = {
DEFINE_PAINTING(lll_painting, {
/* id */ 0x0004,
/* Image Count */ 0x02,
/* Texture Type */ PAINTING_IMAGE,
@ -1445,10 +1445,10 @@ struct Painting lll_painting = {
/* Mario Below */ 0x00, 0x00, 0x00, /* Whether or not Mario is below the painting */
/* Size */ 614.0f,
/* Ripples */ { 0 },
};
});
// 0x07023878 - 0x070238F0
struct Painting ssl_painting = {
DEFINE_PAINTING(ssl_painting, {
/* id */ 0x0005,
/* Image Count */ 0x02,
/* Texture Type */ PAINTING_IMAGE,
@ -1473,10 +1473,10 @@ struct Painting ssl_painting = {
/* Mario Below */ 0x00, 0x00, 0x00, /* Whether or not Mario is below the painting */
/* Size */ 614.0f,
/* Ripples */ { 0 },
};
});
// 0x070238F0 - 0x07023968
struct Painting hmc_painting = {
DEFINE_PAINTING(hmc_painting, {
/* id */ 0x000E,
/* Image Count */ 0x01,
/* Texture Type */ PAINTING_ENV_MAP,
@ -1501,10 +1501,10 @@ struct Painting hmc_painting = {
/* Mario Below */ 0x00, 0x00, 0x00, /* Whether or not Mario is below the painting */
/* Size */ 768.0f,
/* Ripples */ { 0 },
};
});
// 0x07023968 - 0x070239E0
struct Painting ddd_painting = {
DEFINE_PAINTING(ddd_painting, {
/* id */ 0x0007,
/* Image Count */ 0x01,
/* Texture Type */ PAINTING_ENV_MAP,
@ -1529,10 +1529,10 @@ struct Painting ddd_painting = {
/* Mario Below */ 0x00, 0x00, 0x00, /* Whether or not Mario is below the painting */
/* Size */ 819.2f,
/* Ripples */ { 0 },
};
});
// 0x070239E0 - 0x07023A58
struct Painting wdw_painting = {
DEFINE_PAINTING(wdw_painting, {
/* id */ 0x0008,
/* Image Count */ 0x02,
/* Texture Type */ PAINTING_IMAGE,
@ -1557,10 +1557,10 @@ struct Painting wdw_painting = {
/* Mario Below */ 0x00, 0x00, 0x00, /* Whether or not Mario is below the painting */
/* Size */ 614.0f,
/* Ripples */ { 0 },
};
});
// 0x07023A58 - 0x07023AD0
struct Painting thi_tiny_painting = {
DEFINE_PAINTING(thi_tiny_painting, {
/* id */ 0x0009,
/* Image Count */ 0x02,
/* Texture Type */ PAINTING_IMAGE,
@ -1585,10 +1585,10 @@ struct Painting thi_tiny_painting = {
/* Mario Below */ 0x00, 0x00, 0x00, /* Whether or not Mario is below the painting */
/* Size */ 393.216f,
/* Ripples */ { 0 },
};
});
// 0x07023AD0 - 0x07023B48
struct Painting ttm_painting = {
DEFINE_PAINTING(ttm_painting, {
/* id */ 0x000A,
/* Image Count */ 0x02,
/* Texture Type */ PAINTING_IMAGE,
@ -1613,10 +1613,10 @@ struct Painting ttm_painting = {
/* Mario Below */ 0x00, 0x00, 0x00, /* Whether or not Mario is below the painting */
/* Size */ 256.0f,
/* Ripples */ { 0 },
};
});
// 0x07023B48 - 0x07023BC0
struct Painting ttc_painting = {
DEFINE_PAINTING(ttc_painting, {
/* id */ 0x000B,
/* Image Count */ 0x02,
/* Texture Type */ PAINTING_IMAGE,
@ -1641,10 +1641,10 @@ struct Painting ttc_painting = {
/* Mario Below */ 0x00, 0x00, 0x00, /* Whether or not Mario is below the painting */
/* Size */ 409.6f,
/* Ripples */ { 0 },
};
});
// 0x07023BC0 - 0x07023C38
struct Painting sl_painting = {
DEFINE_PAINTING(sl_painting, {
/* id */ 0x000C,
/* Image Count */ 0x02,
/* Texture Type */ PAINTING_IMAGE,
@ -1669,10 +1669,10 @@ struct Painting sl_painting = {
/* Mario Below */ 0x00, 0x00, 0x00, /* Whether or not Mario is below the painting */
/* Size */ 716.8f,
/* Ripples */ { 0 },
};
});
// 0x07023C38 - 0x07023CB0
struct Painting thi_huge_painting = {
DEFINE_PAINTING(thi_huge_painting, {
/* id */ 0x000D,
/* Image Count */ 0x02,
/* Texture Type */ PAINTING_IMAGE,
@ -1697,382 +1697,4 @@ struct Painting thi_huge_painting = {
/* Mario Below */ 0x00, 0x00, 0x00, /* Whether or not Mario is below the painting */
/* Size */ 1638.4f,
/* Ripples */ { 0 },
};
struct Painting default_bob_painting = {
/* id */ 0x0000,
/* Image Count */ 0x02,
/* Texture Type */ PAINTING_IMAGE,
/* Floor Status */ 0x00, 0x00, 0x00 /* which of the painting's nearby special floors Mario's on */,
/* Ripple Status */ 0x00,
/* Rotation */ 0.0f, 90.0f,
/* Position */ -5222.4f, 409.6f, -153.6f,
/* curr passive entry */
/* Ripple Magnitude */ 0.0f, 20.0f, 80.0f,
/* Ripple Decay */ 1.0f, 0.9608f, 0.9524f,
/* Ripple Rate */ 0.0f, 0.24f, 0.14f,
/* Ripple Dispersion */ 0.0f, 40.0f, 30.0f,
/* Curr Ripple Timer */ 0.0f,
/* Curr Ripple x, y */ 0.0f, 0.0f,
/* Normal DList */ inside_castle_seg7_painting_dl_07023050,
/* Texture Maps */ inside_castle_seg7_painting_texture_maps_07022518,
/* Textures */ inside_castle_seg7_painting_textures_070235C0,
/* Texture w, h */ 64, 32,
/* Ripple DList */ inside_castle_seg7_painting_dl_07021AC0,
/* Ripple Trigger */ RIPPLE_TRIGGER_PROXIMITY,
/* Alpha */ 0xFF,
/* Mario Below */ 0x00, 0x00, 0x00, /* Whether or not Mario is below the painting */
/* Size */ 614.0f,
/* Ripples */ { 0 },
};
struct Painting default_ccm_painting = {
/* id */ 0x0001,
/* Image Count */ 0x02,
/* Texture Type */ PAINTING_IMAGE,
/* Floor Status */ 0x00, 0x00, 0x00 /* which of the painting's nearby special floors Mario's on */,
/* Ripple Status */ 0x00,
/* Rotation */ 0.0f, 0.0f,
/* Position */ -2611.2f, -307.2f, -4352.0f,
/* curr passive entry */
/* Ripple Magnitude */ 0.0f, 20.0f, 80.0f,
/* Ripple Decay */ 1.0f, 0.9608f, 0.9524f,
/* Ripple Rate */ 0.0f, 0.24f, 0.14f,
/* Ripple Dispersion */ 0.0f, 40.0f, 30.0f,
/* Curr Ripple Timer */ 0.0f,
/* Curr Ripple x, y */ 0.0f, 0.0f,
/* Normal DList */ inside_castle_seg7_painting_dl_070230B0,
/* Texture Maps */ inside_castle_seg7_painting_texture_maps_07022518,
/* Textures */ inside_castle_seg7_painting_textures_070235C8,
/* Texture w, h */ 64, 32,
/* Ripple DList */ inside_castle_seg7_painting_dl_07021AC0,
/* Ripple Trigger */ RIPPLE_TRIGGER_PROXIMITY,
/* Alpha */ 0xFF,
/* Mario Below */ 0x00, 0x00, 0x00, /* Whether or not Mario is below the painting */
/* Size */ 614.0f,
/* Ripples */ { 0 },
};
struct Painting default_wf_painting = {
/* id */ 0x0002,
/* Image Count */ 0x02,
/* Texture Type */ PAINTING_IMAGE,
/* Floor Status */ 0x00, 0x00, 0x00 /* which of the painting's nearby special floors Mario's on */,
/* Ripple Status */ 0x00,
/* Rotation */ 0.0f, 0.0f,
/* Position */ -51.2f, -204.8f, -4505.6f,
/* curr passive entry */
/* Ripple Magnitude */ 0.0f, 20.0f, 80.0f,
/* Ripple Decay */ 1.0f, 0.9608f, 0.9524f,
/* Ripple Rate */ 0.0f, 0.24f, 0.14f,
/* Ripple Dispersion */ 0.0f, 40.0f, 30.0f,
/* Curr Ripple Timer */ 0.0f,
/* Curr Ripple x, y */ 0.0f, 0.0f,
/* Normal DList */ inside_castle_seg7_painting_dl_07023110,
/* Texture Maps */ inside_castle_seg7_painting_texture_maps_07022518,
/* Textures */ inside_castle_seg7_painting_textures_070235D0,
/* Texture w, h */ 64, 32,
/* Ripple DList */ inside_castle_seg7_painting_dl_07021AC0,
/* Ripple Trigger */ RIPPLE_TRIGGER_PROXIMITY,
/* Alpha */ 0xFF,
/* Mario Below */ 0x00, 0x00, 0x00, /* Whether or not Mario is below the painting */
/* Size */ 614.0f,
/* Ripples */ { 0 },
};
struct Painting default_jrb_painting = {
/* id */ 0x0003,
/* Image Count */ 0x02,
/* Texture Type */ PAINTING_IMAGE,
/* Floor Status */ 0x00, 0x00, 0x00 /* which of the painting's nearby special floors Mario's on */,
/* Ripple Status */ 0x00,
/* Rotation */ 0.0f, 270.0f,
/* Position */ 4300.8f, 409.6f, -537.6f,
/* curr passive entry */
/* Ripple Magnitude */ 0.0f, 20.0f, 80.0f,
/* Ripple Decay */ 1.0f, 0.9608f, 0.9524f,
/* Ripple Rate */ 0.0f, 0.24f, 0.14f,
/* Ripple Dispersion */ 0.0f, 40.0f, 30.0f,
/* Curr Ripple Timer */ 0.0f,
/* Curr Ripple x, y */ 0.0f, 0.0f,
/* Normal DList */ inside_castle_seg7_painting_dl_07023170,
/* Texture Maps */ inside_castle_seg7_painting_texture_maps_07022518,
/* Textures */ inside_castle_seg7_painting_textures_070235D8,
/* Texture w, h */ 64, 32,
/* Ripple DList */ inside_castle_seg7_painting_dl_07021AC0,
/* Ripple Trigger */ RIPPLE_TRIGGER_PROXIMITY,
/* Alpha */ 0xFF,
/* Mario Below */ 0x00, 0x00, 0x00, /* Whether or not Mario is below the painting */
/* Size */ 614.0f,
/* Ripples */ { 0 },
};
struct Painting default_lll_painting = {
/* id */ 0x0004,
/* Image Count */ 0x02,
/* Texture Type */ PAINTING_IMAGE,
/* Floor Status */ 0x00, 0x00, 0x00 /* which of the painting's nearby special floors Mario's on */,
/* Ripple Status */ 0x00,
/* Rotation */ 0.0f, 0.0f,
/* Position */ -1689.6f, -1126.4f, -3942.4f,
/* curr passive entry */
/* Ripple Magnitude */ 0.0f, 20.0f, 80.0f,
/* Ripple Decay */ 1.0f, 0.9608f, 0.9524f,
/* Ripple Rate */ 0.0f, 0.24f, 0.14f,
/* Ripple Dispersion */ 0.0f, 40.0f, 30.0f,
/* Curr Ripple Timer */ 0.0f,
/* Curr Ripple x, y */ 0.0f, 0.0f,
/* Normal DList */ inside_castle_seg7_painting_dl_070231D0,
/* Texture Maps */ inside_castle_seg7_painting_texture_maps_07022518,
/* Textures */ inside_castle_seg7_painting_textures_070235E0,
/* Texture w, h */ 64, 32,
/* Ripple DList */ inside_castle_seg7_painting_dl_07021AC0,
/* Ripple Trigger */ RIPPLE_TRIGGER_PROXIMITY,
/* Alpha */ 0xFF,
/* Mario Below */ 0x00, 0x00, 0x00, /* Whether or not Mario is below the painting */
/* Size */ 614.0f,
/* Ripples */ { 0 },
};
struct Painting default_ssl_painting = {
/* id */ 0x0005,
/* Image Count */ 0x02,
/* Texture Type */ PAINTING_IMAGE,
/* Floor Status */ 0x00, 0x00, 0x00 /* which of the painting's nearby special floors Mario's on */,
/* Ripple Status */ 0x00,
/* Rotation */ 0.0f, 180.0f,
/* Position */ -2611.2f, -1177.6f, -1075.2f,
/* curr passive entry */
/* Ripple Magnitude */ 0.0f, 20.0f, 80.0f,
/* Ripple Decay */ 1.0f, 0.9608f, 0.9524f,
/* Ripple Rate */ 0.0f, 0.24f, 0.14f,
/* Ripple Dispersion */ 0.0f, 40.0f, 30.0f,
/* Curr Ripple Timer */ 0.0f,
/* Curr Ripple x, y */ 0.0f, 0.0f,
/* Normal DList */ inside_castle_seg7_painting_dl_07023230,
/* Texture Maps */ inside_castle_seg7_painting_texture_maps_07022518,
/* Textures */ inside_castle_seg7_painting_textures_070235E8,
/* Texture w, h */ 64, 32,
/* Ripple DList */ inside_castle_seg7_painting_dl_07021AC0,
/* Ripple Trigger */ RIPPLE_TRIGGER_PROXIMITY,
/* Alpha */ 0xFF,
/* Mario Below */ 0x00, 0x00, 0x00, /* Whether or not Mario is below the painting */
/* Size */ 614.0f,
/* Ripples */ { 0 },
};
struct Painting default_hmc_painting = {
/* id */ 0x000E,
/* Image Count */ 0x01,
/* Texture Type */ PAINTING_ENV_MAP,
/* Floor Status */ 0x00, 0x00, 0x00 /* which of the painting's nearby special floors Mario's on */,
/* Ripple Status */ 0x00,
/* Rotation */ 270.0f, 0.0f,
/* Position */ 2099.2f, -1484.8f, -2278.4f,
/* curr passive entry */
/* Ripple Magnitude */ 0.0f, 10.0f, 30.0f,
/* Ripple Decay */ 1.0f, 1.0f, 0.98f,
/* Ripple Rate */ 0.0f, 0.05f, 0.05f,
/* Ripple Dispersion */ 0.0f, 15.0f, 15.0f,
/* Curr Ripple Timer */ 0.0f,
/* Curr Ripple x, y */ 0.0f, 0.0f,
/* Normal DList */ inside_castle_seg7_painting_dl_07023580,
/* Texture Maps */ inside_castle_seg7_painting_env_map_texture_maps_07023044,
/* Textures */ inside_castle_seg7_painting_textures_070235F0,
/* Texture w, h */ 32, 32,
/* Ripple DList */ inside_castle_seg7_painting_dl_07022640,
/* Ripple Trigger */ RIPPLE_TRIGGER_CONTINUOUS,
/* Alpha */ 0xFF,
/* Mario Below */ 0x00, 0x00, 0x00, /* Whether or not Mario is below the painting */
/* Size */ 768.0f,
/* Ripples */ { 0 },
};
struct Painting default_ddd_painting = {
/* id */ 0x0007,
/* Image Count */ 0x01,
/* Texture Type */ PAINTING_ENV_MAP,
/* Floor Status */ 0x00, 0x00, 0x00 /* which of the painting's nearby special floors Mario's on */,
/* Ripple Status */ 0x00,
/* Rotation */ 0.0f, 270.0f,
/* Position */ 3456.0f, -1075.2f, 1587.2f,
/* curr passive entry */
/* Ripple Magnitude */ 0.0f, 10.0f, 30.0f,
/* Ripple Decay */ 1.0f, 1.0f, 0.98f,
/* Ripple Rate */ 0.0f, 0.05f, 0.05f,
/* Ripple Dispersion */ 0.0f, 15.0f, 15.0f,
/* Curr Ripple Timer */ 0.0f,
/* Curr Ripple x, y */ 0.0f, 0.0f,
/* Normal DList */ inside_castle_seg7_painting_dl_070235B8,
/* Texture Maps */ inside_castle_seg7_painting_env_map_texture_maps_07023044,
/* Textures */ inside_castle_seg7_painting_textures_070235F4,
/* Texture w, h */ 32, 32,
/* Ripple DList */ inside_castle_seg7_painting_dl_07022640,
/* Ripple Trigger */ RIPPLE_TRIGGER_CONTINUOUS,
/* Alpha */ 0xB4,
/* Mario Below */ 0x00, 0x00, 0x00, /* Whether or not Mario is below the painting */
/* Size */ 819.2f,
/* Ripples */ { 0 },
};
struct Painting default_wdw_painting = {
/* id */ 0x0008,
/* Image Count */ 0x02,
/* Texture Type */ PAINTING_IMAGE,
/* Floor Status */ 0x00, 0x00, 0x00 /* which of the painting's nearby special floors Mario's on */,
/* Ripple Status */ 0x00,
/* Rotation */ 0.0f, 0.0f,
/* Position */ -966.656f, 1305.6f, -143.36f,
/* curr passive entry */
/* Ripple Magnitude */ 0.0f, 20.0f, 80.0f,
/* Ripple Decay */ 1.0f, 0.9608f, 0.9524f,
/* Ripple Rate */ 0.0f, 0.24f, 0.14f,
/* Ripple Dispersion */ 0.0f, 40.0f, 30.0f,
/* Curr Ripple Timer */ 0.0f,
/* Curr Ripple x, y */ 0.0f, 0.0f,
/* Normal DList */ inside_castle_seg7_painting_dl_07023290,
/* Texture Maps */ inside_castle_seg7_painting_texture_maps_07022518,
/* Textures */ inside_castle_seg7_painting_textures_070235F8,
/* Texture w, h */ 64, 32,
/* Ripple DList */ inside_castle_seg7_painting_dl_07021AC0,
/* Ripple Trigger */ RIPPLE_TRIGGER_PROXIMITY,
/* Alpha */ 0xFF,
/* Mario Below */ 0x00, 0x00, 0x00, /* Whether or not Mario is below the painting */
/* Size */ 614.0f,
/* Ripples */ { 0 },
};
struct Painting default_thi_tiny_painting = {
/* id */ 0x0009,
/* Image Count */ 0x02,
/* Texture Type */ PAINTING_IMAGE,
/* Floor Status */ 0x00, 0x00, 0x00 /* which of the painting's nearby special floors Mario's on */,
/* Ripple Status */ 0x00,
/* Rotation */ 0.0f, 180.0f,
/* Position */ -4598.7842f, 1354.752f, 3005.44f,
/* curr passive entry */
/* Ripple Magnitude */ 0.0f, 20.0f, 80.0f,
/* Ripple Decay */ 1.0f, 0.9608f, 0.9524f,
/* Ripple Rate */ 0.0f, 0.24f, 0.14f,
/* Ripple Dispersion */ 0.0f, 40.0f, 30.0f,
/* Curr Ripple Timer */ 0.0f,
/* Curr Ripple x, y */ 0.0f, 0.0f,
/* Normal DList */ inside_castle_seg7_painting_dl_070232F0,
/* Texture Maps */ inside_castle_seg7_painting_texture_maps_07022518,
/* Textures */ inside_castle_seg7_painting_textures_07023600,
/* Texture w, h */ 64, 32,
/* Ripple DList */ inside_castle_seg7_painting_dl_07021AC0,
/* Ripple Trigger */ RIPPLE_TRIGGER_PROXIMITY,
/* Alpha */ 0xFF,
/* Mario Below */ 0x00, 0x00, 0x00, /* Whether or not Mario is below the painting */
/* Size */ 393.216f,
/* Ripples */ { 0 },
};
struct Painting default_ttm_painting = {
/* id */ 0x000A,
/* Image Count */ 0x02,
/* Texture Type */ PAINTING_IMAGE,
/* Floor Status */ 0x00, 0x00, 0x00 /* which of the painting's nearby special floors Mario's on */,
/* Ripple Status */ 0x00,
/* Rotation */ 0.0f, 180.0f,
/* Position */ -546.816f, 1356.8f, 3813.376f,
/* curr passive entry */
/* Ripple Magnitude */ 0.0f, 20.0f, 80.0f,
/* Ripple Decay */ 1.0f, 0.9608f, 0.9524f,
/* Ripple Rate */ 0.0f, 0.24f, 0.14f,
/* Ripple Dispersion */ 0.0f, 40.0f, 30.0f,
/* Curr Ripple Timer */ 0.0f,
/* Curr Ripple x, y */ 0.0f, 0.0f,
/* Normal DList */ inside_castle_seg7_painting_dl_07023350,
/* Texture Maps */ inside_castle_seg7_painting_texture_maps_07022518,
/* Textures */ inside_castle_seg7_painting_textures_07023608,
/* Texture w, h */ 64, 32,
/* Ripple DList */ inside_castle_seg7_painting_dl_07021AC0,
/* Ripple Trigger */ RIPPLE_TRIGGER_PROXIMITY,
/* Alpha */ 0xFF,
/* Mario Below */ 0x00, 0x00, 0x00, /* Whether or not Mario is below the painting */
/* Size */ 256.0f,
/* Ripples */ { 0 },
};
struct Painting default_ttc_painting = {
/* id */ 0x000B,
/* Image Count */ 0x02,
/* Texture Type */ PAINTING_IMAGE,
/* Floor Status */ 0x00, 0x00, 0x00 /* which of the painting's nearby special floors Mario's on */,
/* Ripple Status */ 0x00,
/* Rotation */ 0.0f, 180.0f,
/* Position */ 0.0f, 2713.6f, 7232.5122f,
/* curr passive entry */
/* Ripple Magnitude */ 0.0f, 20.0f, 80.0f,
/* Ripple Decay */ 1.0f, 0.9608f, 0.9524f,
/* Ripple Rate */ 0.0f, 0.24f, 0.14f,
/* Ripple Dispersion */ 0.0f, 40.0f, 30.0f,
/* Curr Ripple Timer */ 0.0f,
/* Curr Ripple x, y */ 0.0f, 0.0f,
/* Normal DList */ inside_castle_seg7_painting_dl_070233B0,
/* Texture Maps */ inside_castle_seg7_painting_texture_maps_07022518,
/* Textures */ inside_castle_seg7_painting_textures_07023610,
/* Texture w, h */ 64, 32,
/* Ripple DList */ inside_castle_seg7_painting_dl_07021AC0,
/* Ripple Trigger */ RIPPLE_TRIGGER_PROXIMITY,
/* Alpha */ 0xFF,
/* Mario Below */ 0x00, 0x00, 0x00, /* Whether or not Mario is below the painting */
/* Size */ 409.6f,
/* Ripples */ { 0 },
};
struct Painting default_sl_painting = {
/* id */ 0x000C,
/* Image Count */ 0x02,
/* Texture Type */ PAINTING_IMAGE,
/* Floor Status */ 0x00, 0x00, 0x00 /* which of the painting's nearby special floors Mario's on */,
/* Ripple Status */ 0x00,
/* Rotation */ 0.0f, 0.0f,
/* Position */ 3179.52f, 1408.0f, -271.36f,
/* curr passive entry */
/* Ripple Magnitude */ 0.0f, 20.0f, 80.0f,
/* Ripple Decay */ 1.0f, 0.9608f, 0.9524f,
/* Ripple Rate */ 0.0f, 0.24f, 0.14f,
/* Ripple Dispersion */ 0.0f, 40.0f, 30.0f,
/* Curr Ripple Timer */ 0.0f,
/* Curr Ripple x, y */ 0.0f, 0.0f,
/* Normal DList */ inside_castle_seg7_painting_dl_07023410,
/* Texture Maps */ inside_castle_seg7_painting_texture_maps_07022518,
/* Textures */ inside_castle_seg7_painting_textures_07023618,
/* Texture w, h */ 64, 32,
/* Ripple DList */ inside_castle_seg7_painting_dl_07021AC0,
/* Ripple Trigger */ RIPPLE_TRIGGER_PROXIMITY,
/* Alpha */ 0xFF,
/* Mario Below */ 0x00, 0x00, 0x00, /* Whether or not Mario is below the painting */
/* Size */ 716.8f,
/* Ripples */ { 0 },
};
struct Painting default_thi_huge_painting = {
/* id */ 0x000D,
/* Image Count */ 0x02,
/* Texture Type */ PAINTING_IMAGE,
/* Floor Status */ 0x00, 0x00, 0x00 /* which of the painting's nearby special floors Mario's on */,
/* Ripple Status */ 0x00,
/* Rotation */ 0.0f, 0.0f,
/* Position */ -5614.5918f, 1510.4f, -3292.16f,
/* curr passive entry */
/* Ripple Magnitude */ 0.0f, 40.0f, 160.0f,
/* Ripple Decay */ 1.0f, 0.9608f, 0.9524f,
/* Ripple Rate */ 0.0f, 0.12f, 0.07f,
/* Ripple Dispersion */ 0.0f, 80.0f, 60.0f,
/* Curr Ripple Timer */ 0.0f,
/* Curr Ripple x, y */ 0.0f, 0.0f,
/* Normal DList */ inside_castle_seg7_painting_dl_070232F0,
/* Texture Maps */ inside_castle_seg7_painting_texture_maps_07022518,
/* Textures */ inside_castle_seg7_painting_textures_07023600,
/* Texture w, h */ 64, 32,
/* Ripple DList */ inside_castle_seg7_painting_dl_07021AC0,
/* Ripple Trigger */ RIPPLE_TRIGGER_PROXIMITY,
/* Alpha */ 0xFF,
/* Mario Below */ 0x00, 0x00, 0x00, /* Whether or not Mario is below the painting */
/* Size */ 1638.4f,
/* Ripples */ { 0 },
};
});

View file

@ -510,7 +510,7 @@ static const Gfx hmc_seg7_painting_dl_070254E0[] = {
}
// 0x0702551C (PaintingData)
struct Painting cotmc_painting = {
DEFINE_PAINTING(cotmc_painting, {
/* id */ 0x000E,
/* Image Count */ 0x01,
/* Texture Type */ PAINTING_ENV_MAP,
@ -535,31 +535,4 @@ struct Painting cotmc_painting = {
/* Mario Below */ 0x00, 0x00, 0x00, /* Whether or not Mario is below the painting */
/* Size */ 723.968018f,
/* Ripples */ { 0 },
};
struct Painting default_cotmc_painting = {
/* id */ 0x000E,
/* Image Count */ 0x01,
/* Texture Type */ PAINTING_ENV_MAP,
/* Floor Status */ 0x00, 0x00 , 0x00 /* which of the painting's nearby special floors Mario's on */,
/* Ripple Status */ 0x00,
/* Rotation */ 270.0f, 0.0f,
/* Position */ 2989.055908f, -4485.120117f, 5135.359863f,
/* curr passive entry */
/* Ripple Magnitude */ 0.0f, 10.0f, 30.0f,
/* Ripple Decay */ 1.0f, 1.0f, 0.98f,
/* Ripple Rate */ 0.0f, 0.05f, 0.05f,
/* Ripple Dispersion */ 0.0f, 15.0f, 15.0f,
/* Curr Ripple Timer */ 0.0f,
/* Curr Ripple x, y */ 0.0f, 0.0f,
/* Normal DList */ hmc_seg7_painting_dl_070254E0,
/* Texture Maps */ hmc_seg7_painting_texture_maps_07024CD4,
/* Textures */ hmc_seg7_painting_textures_07025518,
/* Texture w, h */ 32, 32,
/* Ripple DList */ hmc_seg7_painting_dl_070242D0,
/* Ripple Trigger */ RIPPLE_TRIGGER_CONTINUOUS,
/* Alpha */ 0xFF,
/* Mario Below */ 0x00, 0x00, 0x00, /* Whether or not Mario is below the painting */
/* Size */ 723.968018f,
/* Ripples */ { 0 },
};
});

View file

@ -542,7 +542,7 @@ static const Gfx ttm_seg7_painting_dl_07012E98[] = {
}
// 0x07012F00 (PaintingData)
struct Painting ttm_slide_painting = {
DEFINE_PAINTING(ttm_slide_painting, {
/* id */ 0x0000,
/* Image Count */ 0x02,
/* Texture Type */ PAINTING_IMAGE,
@ -567,31 +567,4 @@ struct Painting ttm_slide_painting = {
/* Mario Below */ 0x00, 0x00, 0x00, /* Whether or not Mario is below the painting */
/* Size */ 460.8f,
/* Ripples */ { 0 },
};
struct Painting default_ttm_slide_painting = {
/* id */ 0x0000,
/* Image Count */ 0x02,
/* Texture Type */ PAINTING_IMAGE,
/* Floor Status */ 0x00, 0x00, 0x00 /* which of the painting's nearby special floors Mario's on */,
/* Ripple Status */ 0x00,
/* Rotation */ 0.0f, 90.0f,
/* Position */ 3072.0f, 921.6f, -819.2f,
/* curr passive entry */
/* Ripple Magnitude */ 0.0f, 20.0f, 80.0f,
/* Ripple Decay */ 1.0f, 0.9608f, 0.9524f,
/* Ripple Rate */ 0.0f, 0.24f, 0.14f,
/* Ripple Dispersion */ 0.0f, 40.0f, 30.0f,
/* Curr Ripple Timer */ 0.0f,
/* Curr Ripple x, y */ 0.0f, 0.0f,
/* Normal DList */ ttm_seg7_painting_dl_07012E98,
/* Texture Maps */ ttm_seg7_painting_texture_maps_07012E88,
/* Textures */ ttm_seg7_painting_textures_07012EF8,
/* Texture w, h */ 64, 32,
/* Ripple DList */ ttm_seg7_painting_dl_07012430,
/* Ripple Trigger */ RIPPLE_TRIGGER_PROXIMITY,
/* Alpha */ 0xFF,
/* Mario Below */ 0x00, 0x00, 0x00, /* Whether or not Mario is below the painting */
/* Size */ 460.8f,
/* Ripples */ { 0 },
};
});

View file

@ -113,21 +113,21 @@ s16 D_8032F0CC[] = { 6047, 5664, 5292, 4934, 4587, 4254, 3933, 3624, 3329, 3046,
#include "behaviors/white_puff_explode.inc.c"
// not in behavior file
struct SpawnParticlesInfo D_8032F270 = { 2, 20, MODEL_MIST, 0, 40, 5, 30, 20, 252, 30, 330.0f, 10.0f };
struct SpawnParticlesInfo sMistParticles = { 2, 20, MODEL_MIST, 0, 40, 5, 30, 20, 252, 30, 330.0f, 10.0f };
// generate_wind_puffs/dust (something like that)
void spawn_mist_particles_variable(s32 count, s32 offsetY, f32 size) {
D_8032F270.sizeBase = size;
D_8032F270.sizeRange = size / 20.0;
D_8032F270.offsetY = offsetY;
sMistParticles.sizeBase = size;
sMistParticles.sizeRange = size / 20.0;
sMistParticles.offsetY = offsetY;
if (count == 0) {
D_8032F270.count = 20;
sMistParticles.count = 20;
} else if (count > 20) {
D_8032F270.count = count;
sMistParticles.count = count;
} else {
D_8032F270.count = 4;
sMistParticles.count = 4;
}
cur_obj_spawn_particles(&D_8032F270);
cur_obj_spawn_particles(&sMistParticles);
}
#include "behaviors/sparkle_spawn_star.inc.c"
@ -230,7 +230,7 @@ s32 set_obj_anim_with_accel_and_sound(s16 a0, s16 a1, s32 a2) {
if ((sp1C = o->header.gfx.animInfo.animAccel / (f32) 0x10000) == 0)
sp1C = 1.0f;
if (cur_obj_check_anim_frame_in_range(a0, sp1C) || cur_obj_check_anim_frame_in_range(a1, sp1C)) {
cur_obj_play_sound_2(a2);
cur_obj_play_sound_and_rumble_if_visible(a2);
return 1;
}
return 0;

View file

@ -17,8 +17,8 @@ void spawn_mist_from_global(void);
void clear_particle_flags(u32 flags);
/* |description|Spawns wind particles around the current object|descriptionEnd| */
void spawn_wind_particles(s16 pitch, s16 yaw);
/* |description|Checks if the current object is moving `a1` units over a floor and within a threshold of `a0`|descriptionEnd| */
s32 check_if_moving_over_floor(f32 a0, f32 a1);
/* |description|Checks if the current object is moving `distance` units over a floor and within a max distance to floor of `maxDistToFloor`|descriptionEnd| */
s32 check_if_moving_over_floor(f32 maxDistToFloor, f32 distance);
/* |description|Calculates the time it takes for the current object to follow an arc from `pos` to `goal`|descriptionEnd| */
s32 arc_to_goal_pos(Vec3f goal, Vec3f pos, f32 yVel, f32 gravity);
/* |description|Moves Tox Box|descriptionEnd| */
@ -30,8 +30,8 @@ s32 update_angle_from_move_flags(INOUT s32 *angle);
/* |description|Spawns strong wind particles relative to the current object|descriptionEnd| */
void cur_obj_spawn_strong_wind_particles(s32 windSpread, f32 scale, f32 relPosX, f32 relPosY, f32 relPosZ);
/* |description|Behavior loop function for Star Door|descriptionEnd| */
void bhv_star_door_loop_2(void);
/* |description|Behavior loop function for Star Door, which updates its render state|descriptionEnd| */
void bhv_star_door_loop_update_render_state(void);
/* |description|Behavior loop function for Cap Switch|descriptionEnd| */
void bhv_cap_switch_loop(void);
/* |description|Behavior init function for tiny Star particles|descriptionEnd| */
@ -100,8 +100,8 @@ void bhv_cannon_base_loop(void);
void bhv_cannon_barrel_loop(void);
/* |description|Behavior loop function for cannon base unused|descriptionEnd| */
void bhv_cannon_base_unused_loop(void);
/* |description|Common behavior for when Mario's anchoring when grabbed|descriptionEnd| */
void common_anchor_mario_behavior(f32 sp28, f32 sp2C, s32 sp30);
/* |description|Common behavior for an object when grabbing Mario. Used by King Bob-omb and Chuckya anchor objects. When Mario is thrown, sets `forwardVel`, `upwardsVel` and `interactStatusFlags` to him|descriptionEnd| */
void common_anchor_mario_behavior(f32 forwardVel, f32 upwardsVel, s32 interactStatusFlags);
/* |description|Behavior loop function for Chuckya|descriptionEnd| */
void bhv_chuckya_loop(void);
/* |description|Behavior loop function for Chuckya mario anchor|descriptionEnd| */

View file

@ -233,7 +233,7 @@ void bhv_homing_amp_loop(void) {
case HOMING_AMP_ACT_CHASE:
homing_amp_chase_loop();
cur_obj_play_sound_1(SOUND_AIR_AMP_BUZZ);
cur_obj_play_sound_if_visible(SOUND_AIR_AMP_BUZZ);
break;
case HOMING_AMP_ACT_GIVE_UP:
@ -316,7 +316,7 @@ static void fixed_circling_amp_idle_loop(void) {
// Oscillate
o->oAmpYPhase++;
// Where there is a cur_obj_play_sound_1 call in the main circling amp update function,
// Where there is a cur_obj_play_sound_if_visible call in the main circling amp update function,
// there is nothing here. Fixed amps are the only amps that never play
// the "amp buzzing" sound.
}
@ -342,7 +342,7 @@ static void circling_amp_idle_loop(void) {
// Oscillate
o->oAmpYPhase++;
cur_obj_play_sound_1(SOUND_AIR_AMP_BUZZ);
cur_obj_play_sound_if_visible(SOUND_AIR_AMP_BUZZ);
}
/**

View file

@ -55,9 +55,9 @@ void bhv_animates_on_floor_switch_press_loop(void) {
if (o->oFloorSwitchPressAnimationUnkF4 != 0) {
if (o->oFloorSwitchPressAnimationUnkF4 < 60) {
cur_obj_play_sound_1(SOUND_GENERAL2_SWITCH_TICK_SLOW);
cur_obj_play_sound_if_visible(SOUND_GENERAL2_SWITCH_TICK_SLOW);
} else {
cur_obj_play_sound_1(SOUND_GENERAL2_SWITCH_TICK_FAST);
cur_obj_play_sound_if_visible(SOUND_GENERAL2_SWITCH_TICK_FAST);
}
if (--o->oFloorSwitchPressAnimationUnkF4 == 0) {

View file

@ -40,7 +40,7 @@ void bhv_haunted_bookshelf_loop(void) {
case HAUNTED_BOOKSHELF_ACT_RECEDE:
// Move the bookshelf and play the sound
o->oPosX += 5.0f;
cur_obj_play_sound_1(SOUND_ENV_ELEVATOR4_2);
cur_obj_play_sound_if_visible(SOUND_ENV_ELEVATOR4_2);
// Delete the object after 102 frames
if (o->oTimer > 101) {

View file

@ -62,7 +62,7 @@ static void handle_merry_go_round_music(void) {
stop_secondary_music(300); // Switch to BBH music? FIXME: Audio needs labelling
o->oMerryGoRoundMusicShouldPlay = FALSE;
} else {
cur_obj_play_sound_1(SOUND_ENV_MERRY_GO_ROUND_CREAKING);
cur_obj_play_sound_if_visible(SOUND_ENV_MERRY_GO_ROUND_CREAKING);
}
}

View file

@ -35,9 +35,6 @@ static void beta_holdable_object_drop(void) {
* Throw the object.
*/
static void beta_holdable_object_throw(void) {
// cur_obj_enable_rendering_2 just calls cur_obj_enable_rendering and does
// nothing else; it's useless here. Maybe it originally did more?
cur_obj_enable_rendering_2();
cur_obj_enable_rendering();
o->oHeldState = HELD_FREE;

View file

@ -22,7 +22,7 @@ static void bird_act_inactive(void) {
if (o->oBehParams2ndByte != BIRD_BP_SPAWNED) {
s32 i;
cur_obj_play_sound_2(SOUND_GENERAL_BIRDS_FLY_AWAY);
cur_obj_play_sound_and_rumble_if_visible(SOUND_GENERAL_BIRDS_FLY_AWAY);
for (i = 0; i < 6; i++) {
spawn_object(o, MODEL_BIRDS, bhvBird);

View file

@ -144,7 +144,7 @@ void bhv_blue_coin_switch_loop(void) {
// Set gravity to 0 so it doesn't accelerate when receding.
o->oGravity = 0.0f;
cur_obj_play_sound_2(SOUND_GENERAL_SWITCH_DOOR_OPEN);
cur_obj_play_sound_and_rumble_if_visible(SOUND_GENERAL_SWITCH_DOOR_OPEN);
network_send_object(o);
}
@ -194,7 +194,7 @@ void bhv_blue_coin_switch_loop(void) {
o->oPosY = o->oHomeY - 120.0f;
o->oVelY = 20.0f;
o->oGravity = 0.0f;
cur_obj_play_sound_2(SOUND_GENERAL_SWITCH_DOOR_OPEN);
cur_obj_play_sound_and_rumble_if_visible(SOUND_GENERAL_SWITCH_DOOR_OPEN);
network_send_object(o);
} else {
obj_mark_for_deletion(o);

View file

@ -101,7 +101,7 @@ void bobomb_act_chase_mario(void) {
collisionFlags = object_step();
if (sp1a == 5 || sp1a == 16)
cur_obj_play_sound_2(SOUND_OBJ_BOBOMB_WALK);
cur_obj_play_sound_and_rumble_if_visible(SOUND_OBJ_BOBOMB_WALK);
struct Object* player = nearest_player_to_object(o);
if (player) {
@ -214,7 +214,7 @@ void bobomb_dropped_loop(void) {
}
void bobomb_thrown_loop(void) {
cur_obj_enable_rendering_2();
cur_obj_enable_rendering();
o->header.gfx.node.flags &= ~GRAPH_RENDER_INVISIBLE;
o->oHeldState = 0;
@ -278,7 +278,7 @@ void bhv_bobomb_loop(void) {
== 0) /* oBobombFuseTimer % 2 or oBobombFuseTimer % 8 */
spawn_object(o, MODEL_SMOKE, bhvBobombFuseSmoke);
cur_obj_play_sound_1(SOUND_AIR_BOBOMB_LIT_FUSE);
cur_obj_play_sound_if_visible(SOUND_AIR_BOBOMB_LIT_FUSE);
o->oBobombFuseTimer++;
}
@ -316,7 +316,7 @@ void bobomb_buddy_act_idle(void) {
object_step();
if ((animFrame == 5) || (animFrame == 16)) {
cur_obj_play_sound_2(SOUND_OBJ_BOBOMB_WALK);
cur_obj_play_sound_and_rumble_if_visible(SOUND_OBJ_BOBOMB_WALK);
}
struct Object* player = nearest_player_to_object(o);
@ -423,7 +423,7 @@ void bobomb_buddy_act_talk(void) {
void bobomb_buddy_act_turn_to_talk(void) {
s16 animFrame = o->header.gfx.animInfo.animFrame;
if ((animFrame == 5) || (animFrame == 16)) {
cur_obj_play_sound_2(SOUND_OBJ_BOBOMB_WALK);
cur_obj_play_sound_and_rumble_if_visible(SOUND_OBJ_BOBOMB_WALK);
}
struct Object *player = nearest_interacting_player_to_object(o);
@ -433,7 +433,7 @@ void bobomb_buddy_act_turn_to_talk(void) {
o->oAction = BOBOMB_BUDDY_ACT_TALK;
}
cur_obj_play_sound_2(SOUND_ACTION_READ_SIGN);
cur_obj_play_sound_and_rumble_if_visible(SOUND_ACTION_READ_SIGN);
}
void bobomb_buddy_actions(void) {

View file

@ -28,7 +28,7 @@ void bhv_small_bomp_loop(void) {
if (o->oTimer == 15.0) {
o->oAction = BOMP_ACT_EXTEND;
o->oForwardVel = 40.0f;
cur_obj_play_sound_2(SOUND_OBJ_UNKNOWN2);
cur_obj_play_sound_and_rumble_if_visible(SOUND_OBJ_UNKNOWN2);
}
break;
@ -42,7 +42,7 @@ void bhv_small_bomp_loop(void) {
o->oAction = BOMP_ACT_RETRACT;
o->oForwardVel = 10.0f;
o->oMoveAngleYaw -= 0x8000;
cur_obj_play_sound_2(SOUND_OBJ_UNKNOWN2);
cur_obj_play_sound_and_rumble_if_visible(SOUND_OBJ_UNKNOWN2);
}
break;
@ -88,7 +88,7 @@ void bhv_large_bomp_loop(void) {
if (o->oTimer == 15.0) {
o->oAction = BOMP_ACT_EXTEND;
o->oForwardVel = 10.0f;
cur_obj_play_sound_2(SOUND_OBJ_UNKNOWN2);
cur_obj_play_sound_and_rumble_if_visible(SOUND_OBJ_UNKNOWN2);
}
break;
@ -102,7 +102,7 @@ void bhv_large_bomp_loop(void) {
o->oAction = BOMP_ACT_RETRACT;
o->oForwardVel = 10.0f;
o->oMoveAngleYaw -= 0x8000;
cur_obj_play_sound_2(SOUND_OBJ_UNKNOWN2);
cur_obj_play_sound_and_rumble_if_visible(SOUND_OBJ_UNKNOWN2);
}
break;

View file

@ -184,7 +184,7 @@ static s32 boo_vanish_or_appear(void) {
if (relativeAngleToMario > relativeAngleToMarioThreshhold || relativeMarioFaceAngle < relativeMarioFaceAngleThreshhold) {
if (o->oOpacity == 40) {
o->oBooTargetOpacity = 255;
cur_obj_play_sound_2(SOUND_OBJ_BOO_LAUGH_LONG);
cur_obj_play_sound_and_rumble_if_visible(SOUND_OBJ_BOO_LAUGH_LONG);
}
if (o->oOpacity > 180) {
@ -351,11 +351,11 @@ static s32 boo_get_attack_status(void) {
o->oInteractStatus = 0;
cur_obj_play_sound_2(SOUND_OBJ_BOO_LAUGH_SHORT);
cur_obj_play_sound_and_rumble_if_visible(SOUND_OBJ_BOO_LAUGH_SHORT);
attackStatus = BOO_ATTACKED;
} else {
cur_obj_play_sound_2(SOUND_OBJ_BOO_BOUNCE_TOP);
cur_obj_play_sound_and_rumble_if_visible(SOUND_OBJ_BOO_BOUNCE_TOP);
o->oInteractStatus = 0;
@ -969,7 +969,7 @@ void bhv_boo_in_castle_loop(void) {
if (distanceToPlayer < 1000.0f) {
o->oAction++;
cur_obj_play_sound_2(SOUND_OBJ_BOO_LAUGH_LONG);
cur_obj_play_sound_and_rumble_if_visible(SOUND_OBJ_BOO_LAUGH_LONG);
}
o->oForwardVel = 0.0f;
@ -1026,7 +1026,7 @@ void bhv_boo_boss_spawned_bridge_loop(void) {
// fallthrough
case 1:
o->oPosY += 8.0f;
cur_obj_play_sound_1(SOUND_ENV_ELEVATOR2);
cur_obj_play_sound_if_visible(SOUND_ENV_ELEVATOR2);
if (o->oPosY > targetY) {
o->oPosY = targetY;
@ -1036,7 +1036,7 @@ void bhv_boo_boss_spawned_bridge_loop(void) {
break;
case 2:
if (o->oTimer == 0) {
cur_obj_play_sound_2(SOUND_GENERAL_UNKNOWN4_LOWPRIO);
cur_obj_play_sound_and_rumble_if_visible(SOUND_GENERAL_UNKNOWN4_LOWPRIO);
}
if (cur_obj_move_up_and_down(o->oTimer)) {

View file

@ -92,7 +92,7 @@ void bhv_boo_cage_loop(void) {
// When the cage lands/bounces, play a landing/bouncing sound.
if (o->oMoveFlags & OBJ_MOVE_LANDED) {
cur_obj_play_sound_2(SOUND_GENERAL_SOFT_LANDING);
cur_obj_play_sound_and_rumble_if_visible(SOUND_GENERAL_SOFT_LANDING);
}
// Once the cage stops bouncing and settles on the ground,

View file

@ -15,7 +15,7 @@ void boulder_act_1(void) {
sp1E = object_step_without_floor_orient();
if ((sp1E & 0x09) == 0x01 && o->oVelY > 10.0f) {
cur_obj_play_sound_2(SOUND_GENERAL_GRINDEL_ROLL);
cur_obj_play_sound_and_rumble_if_visible(SOUND_GENERAL_GRINDEL_ROLL);
spawn_mist_particles();
}
@ -43,7 +43,7 @@ void bhv_big_boulder_loop(void) {
case 1:
boulder_act_1();
adjust_rolling_face_pitch(1.5f);
cur_obj_play_sound_1(SOUND_ENV_UNKNOWN2);
cur_obj_play_sound_if_visible(SOUND_ENV_UNKNOWN2);
break;
}

View file

@ -103,7 +103,7 @@ void bhv_bowling_ball_roll_loop(void) {
}
if ((collisionFlags & OBJ_COL_FLAG_GROUNDED) && (o->oVelY > 5.0f))
cur_obj_play_sound_2(SOUND_GENERAL_QUIET_POUND1_LOWPRIO);
cur_obj_play_sound_and_rumble_if_visible(SOUND_GENERAL_QUIET_POUND1_LOWPRIO);
}
void bhv_bowling_ball_initializeLoop(void) {
@ -271,7 +271,7 @@ void bhv_bob_pit_bowling_ball_loop(void) {
bowling_ball_set_hitbox();
set_camera_shake_from_point(SHAKE_POS_BOWLING_BALL, o->oPosX, o->oPosY, o->oPosZ);
cur_obj_play_sound_1(SOUND_ENV_UNKNOWN2);
cur_obj_play_sound_if_visible(SOUND_ENV_UNKNOWN2);
set_object_visibility(o, 3000);
}
@ -291,12 +291,12 @@ void bhv_free_bowling_ball_roll_loop(void) {
if (o->oForwardVel > 10.0f) {
set_camera_shake_from_point(SHAKE_POS_BOWLING_BALL, o->oPosX, o->oPosY, o->oPosZ);
cur_obj_play_sound_1(SOUND_ENV_UNKNOWN2);
cur_obj_play_sound_if_visible(SOUND_ENV_UNKNOWN2);
}
// warning: 'and' of mutually exclusive equal-tests is always 0
/*if ((collisionFlags & OBJ_COL_FLAG_GROUNDED) && !(collisionFlags & OBJ_COL_FLAGS_LANDED))
cur_obj_play_sound_2(SOUND_GENERAL_QUIET_POUND1_LOWPRIO);*/
cur_obj_play_sound_and_rumble_if_visible(SOUND_GENERAL_QUIET_POUND1_LOWPRIO);*/
if (!is_point_within_radius_of_mario(o->oPosX, o->oPosY, o->oPosZ, 6000)) {
o->header.gfx.node.flags |= GRAPH_RENDER_INVISIBLE;

View file

@ -49,7 +49,7 @@ s16 D_8032F520[][3] = { { 1, 10, 40 }, { 0, 0, 74 }, { -1, -10, 114 }, { 1
{ -1, 80, 184 }, { 1, 160, 186 }, { -1, -160, 186 }, { 1, 0, 0 }, };
void bhv_bowser_tail_anchor_init(void) {
if (!o->parentObj) { mark_obj_for_deletion(o); return; }
if (!o->parentObj) { obj_mark_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);
@ -87,7 +87,7 @@ void bhv_bowser_flame_spawn_loop(void) {
sp30 = 0;
}
if (sp30 > 45 && sp30 < 85) {
cur_obj_play_sound_1(SOUND_AIR_BOWSER_SPIT_FIRE);
cur_obj_play_sound_if_visible(SOUND_AIR_BOWSER_SPIT_FIRE);
sp2C = sp1C[5 * sp30];
sp28 = sp1C[5 * sp30 + 2];
o->oPosX = bowser->oPosX + (sp28 * sp20 + sp2C * sp24);
@ -111,7 +111,7 @@ void bhv_bowser_flame_spawn_loop(void) {
}
void bhv_bowser_body_anchor_init(void) {
if (!o->parentObj) { mark_obj_for_deletion(o); return; }
if (!o->parentObj) { obj_mark_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);
@ -169,7 +169,7 @@ void bowser_bounce(s32 *a) {
if (a[0] < 4) {
cur_obj_start_cam_event(o, CAM_EVENT_BOWSER_THROW_BOUNCE);
spawn_mist_particles_variable(0, 0, 60.0f);
cur_obj_play_sound_2(SOUND_OBJ_BOWSER_WALK);
cur_obj_play_sound_and_rumble_if_visible(SOUND_OBJ_BOWSER_WALK);
}
}
}
@ -411,7 +411,7 @@ void bowser_act_default(void) // only lasts one frame
void bowser_act_breath_fire(void) {
o->oForwardVel = 0.0f;
if (o->oTimer == 0)
cur_obj_play_sound_2(SOUND_OBJ_BOWSER_INHALING);
cur_obj_play_sound_and_rumble_if_visible(SOUND_OBJ_BOWSER_INHALING);
if (cur_obj_init_animation_and_check_if_near_end(6))
o->oAction = 0;
}
@ -463,7 +463,7 @@ void bowser_act_teleport(void) {
o->oBowserUnk1AC = 0;
o->oBowserUnkF8 = 30;
if (o->oTimer == 0)
cur_obj_play_sound_2(SOUND_OBJ2_BOWSER_TELEPORT);
cur_obj_play_sound_and_rumble_if_visible(SOUND_OBJ2_BOWSER_TELEPORT);
if (o->oOpacity == 0) {
o->oSubAction++;
o->oMoveAngleYaw = angleToPlayer;
@ -480,7 +480,7 @@ void bowser_act_teleport(void) {
if (distanceToPlayer > 500.0f) {
o->oSubAction = 2;
o->oMoveAngleYaw = angleToPlayer; // large change in angle?
cur_obj_play_sound_2(SOUND_OBJ2_BOWSER_TELEPORT);
cur_obj_play_sound_and_rumble_if_visible(SOUND_OBJ2_BOWSER_TELEPORT);
}
break;
case 2:
@ -499,7 +499,7 @@ void bowser_act_spit_fire_into_sky(void) // only in sky
cur_obj_init_animation_with_sound(11);
frame = o->header.gfx.animInfo.animFrame;
if (frame > 24 && frame < 36) {
cur_obj_play_sound_1(SOUND_AIR_BOWSER_SPIT_FIRE);
cur_obj_play_sound_if_visible(SOUND_AIR_BOWSER_SPIT_FIRE);
struct MarioState* marioState = nearest_mario_state_to_object(o);
if (marioState && marioState->playerIndex == 0) {
struct Object* flame = NULL;
@ -870,7 +870,7 @@ void bowser_act_jump_onto_stage(void) {
void bowser_act_dance(void) {
if (is_item_in_array(o->oTimer, D_8032F514))
cur_obj_play_sound_2(SOUND_OBJ_BOWSER_WALK);
cur_obj_play_sound_and_rumble_if_visible(SOUND_OBJ_BOWSER_WALK);
if (cur_obj_init_animation_and_check_if_near_end(10))
o->oAction = 0;
}
@ -898,7 +898,7 @@ void bowser_spawn_grand_star_key(void) {
struct Object* prevReward = cur_obj_nearest_object_with_behavior(bhvBowserKey);
reward = (prevReward != NULL) ? prevReward : spawn_object(o, MODEL_BOWSER_KEY, bhvBowserKey);
gSecondCameraFocus = reward;
cur_obj_play_sound_2(SOUND_GENERAL2_BOWSER_KEY);
cur_obj_play_sound_and_rumble_if_visible(SOUND_GENERAL2_BOWSER_KEY);
if (prevReward == NULL && reward != NULL) {
// set the home position
@ -931,7 +931,7 @@ void bowser_dead_bounce(void) {
o->oBowserEyesShut = 1;
bowser_bounce(&o->oBowserUnkF8);
if (o->oMoveFlags & OBJ_MOVE_LANDED)
cur_obj_play_sound_2(SOUND_OBJ_BOWSER_WALK);
cur_obj_play_sound_and_rumble_if_visible(SOUND_OBJ_BOWSER_WALK);
if (o->oMoveFlags & OBJ_MOVE_ON_GROUND) {
o->oForwardVel = 0.0f;
o->oSubAction++;
@ -993,7 +993,7 @@ s32 bowser_dead_not_bits_end(void) {
}
if (marioState && should_start_or_continue_dialog(marioState, o) && cur_obj_update_dialog(marioState, 2, 18, *sBowserDefeatedDialogText[o->oBehParams2ndByte], 0, bowser_dead_not_bits_end_continue_dialog)) {
o->oBowserUnkF8++;
cur_obj_play_sound_2(SOUND_GENERAL2_BOWSER_EXPLODE);
cur_obj_play_sound_and_rumble_if_visible(SOUND_GENERAL2_BOWSER_EXPLODE);
seq_player_unlower_volume(SEQ_PLAYER_LEVEL, 60);
seq_player_fade_out(SEQ_PLAYER_LEVEL, 1);
network_send_object(o);
@ -1252,7 +1252,7 @@ void bowser_held_update(void) {
switch (o->oBowserUnk10E) {
case 0:
cur_obj_play_sound_2(SOUND_OBJ_BOWSER_TAIL_PICKUP);
cur_obj_play_sound_and_rumble_if_visible(SOUND_OBJ_BOWSER_TAIL_PICKUP);
cur_obj_unrender_and_reset_state(3, 1);
o->oBowserUnk10E++;
break;
@ -1628,7 +1628,7 @@ void falling_bowser_plat_act_2(void) {
f32 sp1C;
UNUSED struct Object *sp18 = o->oPlatformUnkF8;
if (o->oTimer == 0 || o->oTimer == 22)
cur_obj_play_sound_2(SOUND_GENERAL_BOWSER_PLATFORM_2);
cur_obj_play_sound_and_rumble_if_visible(SOUND_GENERAL_BOWSER_PLATFORM_2);
if (o->oTimer < 22) {
set_environmental_camera_shake(SHAKE_ENV_FALLING_BITS_PLAT);
o->oVelY = 8.0f;

View file

@ -38,14 +38,14 @@ void bhv_bowser_key_loop(void) {
o->oAction++;
else if (o->oMoveFlags & OBJ_MOVE_LANDED)
#ifndef VERSION_JP
cur_obj_play_sound_2(SOUND_GENERAL_UNKNOWN3_2);
cur_obj_play_sound_and_rumble_if_visible(SOUND_GENERAL_UNKNOWN3_2);
#else
cur_obj_play_sound_2(SOUND_GENERAL_UNKNOWN3_LOWPRIO);
cur_obj_play_sound_and_rumble_if_visible(SOUND_GENERAL_UNKNOWN3_LOWPRIO);
#endif
} else {
obj_set_hitbox(o, &sBowserKeyHitbox);
if (o->oInteractStatus & INT_STATUS_INTERACTED) {
mark_obj_for_deletion(o);
obj_mark_for_deletion(o);
o->oInteractStatus = 0;
}
}

View file

@ -223,7 +223,7 @@ void bhv_lll_bowser_puzzle_piece_move(f32 xOffset, f32 zOffset, s32 duration, UN
} else {
// On frame 20, play the shifting sound.
if (o->oTimer == 20)
cur_obj_play_sound_2(SOUND_OBJ2_BOWSER_PUZZLE_PIECE_MOVE);
cur_obj_play_sound_and_rumble_if_visible(SOUND_OBJ2_BOWSER_PUZZLE_PIECE_MOVE);
// For the number of frames specified by duration, move the piece.
if (o->oTimer < duration + 20) {

View file

@ -39,10 +39,10 @@ void small_breakable_box_act_move(void) {
obj_attack_collided_from_other_object(o);
if (sp1E == 1)
cur_obj_play_sound_2(SOUND_GENERAL_BOX_LANDING_2);
cur_obj_play_sound_and_rumble_if_visible(SOUND_GENERAL_BOX_LANDING_2);
if (sp1E & 1) {
if (o->oForwardVel > 20.0f) {
cur_obj_play_sound_2(SOUND_ENV_SLIDING);
cur_obj_play_sound_and_rumble_if_visible(SOUND_ENV_SLIDING);
small_breakable_box_spawn_dust();
}
}
@ -110,7 +110,6 @@ void breakable_box_small_get_dropped(void) {
void breakable_box_small_get_thrown(void) {
cur_obj_become_tangible();
cur_obj_enable_rendering_2();
cur_obj_enable_rendering();
o->header.gfx.node.flags &= ~GRAPH_RENDER_INVISIBLE;
o->oHeldState = 0;

View file

@ -92,7 +92,7 @@ void bub_act_2(void) {
} else
o->oInteractStatus = 0;
if (o->oTimer == 0)
cur_obj_play_sound_2(SOUND_GENERAL_MOVING_WATER);
cur_obj_play_sound_and_rumble_if_visible(SOUND_GENERAL_MOVING_WATER);
if (o->oForwardVel == 0.0f)
o->oForwardVel = 6.0f;
dy = o->oPosY - player->oPosY;

View file

@ -64,7 +64,7 @@ void bubba_act_1(void) {
o->oAction = 0;
} else if (o->oBubbaUnk100 != 0) {
if (--o->oBubbaUnk100 == 0) {
cur_obj_play_sound_2(SOUND_OBJ_BUBBA_CHOMP);
cur_obj_play_sound_and_rumble_if_visible(SOUND_OBJ_BUBBA_CHOMP);
o->oAction = 0;
} else if (o->oBubbaUnk100 < 15) {
o->oAnimState = 1;

View file

@ -56,7 +56,7 @@ void bullet_bill_act_2(void) {
if (distanceToPlayer > 300.0f)
cur_obj_rotate_yaw_toward(angleToPlayer, 0x100);
if (o->oTimer == 50) {
cur_obj_play_sound_2(SOUND_OBJ_POUNDING_CANNON);
cur_obj_play_sound_and_rumble_if_visible(SOUND_OBJ_POUNDING_CANNON);
cur_obj_shake_screen(SHAKE_POS_SMALL);
}
if (o->oTimer > 150 || o->oMoveFlags & OBJ_MOVE_HIT_WALL) {

View file

@ -109,9 +109,9 @@ void bully_check_mario_collision(void) {
#endif
o->oInteractStatus & INT_STATUS_INTERACTED) {
if (o->oBehParams2ndByte == BULLY_BP_SIZE_SMALL) {
cur_obj_play_sound_2(SOUND_OBJ2_BULLY_ATTACKED);
cur_obj_play_sound_and_rumble_if_visible(SOUND_OBJ2_BULLY_ATTACKED);
} else {
cur_obj_play_sound_2(SOUND_OBJ2_LARGE_BULLY_ATTACKED);
cur_obj_play_sound_and_rumble_if_visible(SOUND_OBJ2_LARGE_BULLY_ATTACKED);
}
o->oInteractStatus &= ~INT_STATUS_INTERACTED;
@ -216,9 +216,9 @@ void bully_play_stomping_sound(void) {
case BULLY_ACT_PATROL:
if (sp26 == 0 || sp26 == 12) {
if (o->oBehParams2ndByte == BULLY_BP_SIZE_SMALL)
cur_obj_play_sound_2(SOUND_OBJ_BULLY_WALK);
cur_obj_play_sound_and_rumble_if_visible(SOUND_OBJ_BULLY_WALK);
else
cur_obj_play_sound_2(SOUND_OBJ_BULLY_WALKING);
cur_obj_play_sound_and_rumble_if_visible(SOUND_OBJ_BULLY_WALKING);
}
break;
@ -226,9 +226,9 @@ void bully_play_stomping_sound(void) {
case BULLY_ACT_BACK_UP:
if (sp26 == 0 || sp26 == 5) {
if (o->oBehParams2ndByte == BULLY_BP_SIZE_SMALL)
cur_obj_play_sound_2(SOUND_OBJ_BULLY_WALK);
cur_obj_play_sound_and_rumble_if_visible(SOUND_OBJ_BULLY_WALK);
else
cur_obj_play_sound_2(SOUND_OBJ_BULLY_WALKING);
cur_obj_play_sound_and_rumble_if_visible(SOUND_OBJ_BULLY_WALKING);
}
break;
}
@ -251,11 +251,11 @@ void bully_step(void) {
void bully_spawn_coin(void) {
struct Object *coin = spawn_object(o, MODEL_YELLOW_COIN, bhvMovingYellowCoin);
#ifdef VERSION_JP // TODO: maybe move this ifdef logic to the header?
cur_obj_play_sound_2(SOUND_GENERAL_COIN_SPURT);
cur_obj_play_sound_and_rumble_if_visible(SOUND_GENERAL_COIN_SPURT);
#elif defined(VERSION_EU) || defined(VERSION_SH)
cur_obj_play_sound_2(SOUND_GENERAL_COIN_SPURT_EU);
cur_obj_play_sound_and_rumble_if_visible(SOUND_GENERAL_COIN_SPURT_EU);
#else
cur_obj_play_sound_2(SOUND_GENERAL_COIN_SPURT_2);
cur_obj_play_sound_and_rumble_if_visible(SOUND_GENERAL_COIN_SPURT_2);
#endif
if (coin == NULL) { return; }
coin->oForwardVel = 10.0f;
@ -429,7 +429,7 @@ void bhv_big_bully_with_minions_loop(void) {
o->oAction = BULLY_ACT_PATROL;
if (collisionFlags == 1) {
cur_obj_play_sound_2(SOUND_OBJ_THWOMP);
cur_obj_play_sound_and_rumble_if_visible(SOUND_OBJ_THWOMP);
set_camera_shake_from_point(SHAKE_POS_SMALL, o->oPosX, o->oPosY, o->oPosZ);
spawn_mist_particles();
}

View file

@ -116,7 +116,7 @@ static void camera_lakitu_intro_act_show_dialog(void) {
s16 targetMovePitch = 0;
s16 targetMoveYaw = 0;
cur_obj_play_sound_1(SOUND_AIR_LAKITU_FLY);
cur_obj_play_sound_if_visible(SOUND_AIR_LAKITU_FLY);
// Face toward mario
if (marioState) {

View file

@ -44,7 +44,7 @@ void opened_cannon_act_0(void) {
void opened_cannon_act_4(void) {
if (o->oTimer == 0)
cur_obj_play_sound_2(SOUND_OBJ_CANNON1);
cur_obj_play_sound_and_rumble_if_visible(SOUND_OBJ_CANNON1);
o->oPosY += 5.0f;
o->oPosX += (f32)((o->oTimer / 2 & 1) - 0.5) * 2;
o->oPosZ += (f32)((o->oTimer / 2 & 1) - 0.5) * 2;
@ -64,7 +64,7 @@ void opened_cannon_act_4(void) {
void opened_cannon_act_6(void) {
if (o->oTimer == 0)
cur_obj_play_sound_2(SOUND_OBJ_CANNON2);
cur_obj_play_sound_and_rumble_if_visible(SOUND_OBJ_CANNON2);
if (o->oTimer < 4) {
o->oPosX += (f32)((o->oTimer / 2 & 1) - 0.5) * 4.0f;
o->oPosZ += (f32)((o->oTimer / 2 & 1) - 0.5) * 4.0f;
@ -92,7 +92,7 @@ void opened_cannon_act_6(void) {
void opened_cannon_act_5(void) {
if (o->oTimer == 0)
cur_obj_play_sound_2(SOUND_OBJ_CANNON3);
cur_obj_play_sound_and_rumble_if_visible(SOUND_OBJ_CANNON3);
if (o->oTimer < 4) {
} else {
if (o->oTimer < 20) {

View file

@ -20,7 +20,7 @@ void bhv_cannon_closed_init(void) {
void cannon_door_act_opening(void) {
if (o->oTimer == 0)
cur_obj_play_sound_2(SOUND_GENERAL_CANNON_UP);
cur_obj_play_sound_and_rumble_if_visible(SOUND_GENERAL_CANNON_UP);
if (o->oTimer < 30) {
o->oVelY = -0.5f;

View file

@ -21,7 +21,7 @@ void cap_switch_act_1(void) {
if (capSwitchForcePress || cur_obj_is_mario_on_platform()) {
save_file_set_flags(BHV_ARR(D_8032F0C0, o->oBehParams2ndByte, s32));
o->oAction = 2;
cur_obj_play_sound_2(SOUND_GENERAL_ACTIVATE_CAP_SWITCH);
cur_obj_play_sound_and_rumble_if_visible(SOUND_GENERAL_ACTIVATE_CAP_SWITCH);
if (!capSwitchForcePress) {
capSwitchForcePress = TRUE;
network_send_object(o);

View file

@ -35,7 +35,7 @@ void bhv_castle_floor_trap_open_detect(void) {
void bhv_castle_floor_trap_open(void) {
if (o->oTimer == 0)
cur_obj_play_sound_2(SOUND_GENERAL_CASTLE_TRAP_OPEN);
cur_obj_play_sound_and_rumble_if_visible(SOUND_GENERAL_CASTLE_TRAP_OPEN);
o->oAngleVelRoll -= 0x100;
o->oFaceAngleRoll += o->oAngleVelRoll;
if (o->oFaceAngleRoll < -0x4000) {

View file

@ -183,7 +183,7 @@ static void chain_chomp_sub_act_turn(void) {
if (o->oTimer > 40) {
// Increase the maximum distance from the pivot and enter
// the lunging sub-action.
cur_obj_play_sound_2(SOUND_GENERAL_CHAIN_CHOMP2);
cur_obj_play_sound_and_rumble_if_visible(SOUND_GENERAL_CHAIN_CHOMP2);
o->oSubAction = CHAIN_CHOMP_SUB_ACT_LUNGE;
o->oChainChompMaxDistFromPivotPerChainPart = 900.0f / 5;
@ -200,7 +200,7 @@ static void chain_chomp_sub_act_turn(void) {
o->oForwardVel = 0.0f;
}
} else {
cur_obj_play_sound_2(SOUND_GENERAL_CHAIN_CHOMP1);
cur_obj_play_sound_and_rumble_if_visible(SOUND_GENERAL_CHAIN_CHOMP1);
o->oForwardVel = 10.0f;
o->oVelY = 20.0f;
}
@ -296,7 +296,7 @@ static void chain_chomp_released_lunge_around(void) {
o->oWallHitboxRadius = 200.0f;
} else {
if (++o->oChainChompNumLunges <= 5) {
cur_obj_play_sound_2(SOUND_GENERAL_CHAIN_CHOMP1);
cur_obj_play_sound_and_rumble_if_visible(SOUND_GENERAL_CHAIN_CHOMP1);
o->oMoveAngleYaw = cur_obj_angle_to_home() + random_sign() * 0x2000;
o->oForwardVel = 30.0f;
o->oVelY = 50.0f;
@ -517,7 +517,7 @@ void bhv_wooden_post_update(void) {
// When ground pounded by mario, drop by -45 + -20
if (!o->oWoodenPostMarioPounding) {
if ((o->oWoodenPostMarioPounding = cur_obj_is_mario_ground_pounding_platform())) {
cur_obj_play_sound_2(SOUND_GENERAL_POUND_WOOD_POST);
cur_obj_play_sound_and_rumble_if_visible(SOUND_GENERAL_POUND_WOOD_POST);
o->oWoodenPostSpeedY = -70.0f;
network_send_object(o);
}

View file

@ -51,7 +51,7 @@ void checkerboard_plat_act_rotate(s32 a0, s16 a1) {
static void bhv_checkerboard_platform_run_once(void) {
if (o->oDistanceToMario < 1000.0f) {
cur_obj_play_sound_1(SOUND_ENV_ELEVATOR4);
cur_obj_play_sound_if_visible(SOUND_ENV_ELEVATOR4);
}
load_object_collision_model();
}

View file

@ -1,6 +1,6 @@
// chuckya.c.inc
void common_anchor_mario_behavior(f32 sp28, f32 sp2C, s32 sp30) {
void common_anchor_mario_behavior(f32 forwardVel, f32 upwardsVel, s32 interactStatusFlags) {
if (!o) { return; }
for (s32 i = 0; i < MAX_PLAYERS; i++) {
if (!is_player_active(&gMarioStates[i])) { continue; }
@ -15,9 +15,9 @@ void common_anchor_mario_behavior(f32 sp28, f32 sp2C, s32 sp30) {
obj_set_gfx_pos_at_obj_pos(player, o);
break;
case 2:
player->oInteractStatus |= (sp30 + INT_STATUS_MARIO_UNK2);
marioState->forwardVel = sp28;
marioState->vel[1] = sp2C;
player->oInteractStatus |= (interactStatusFlags + INT_STATUS_MARIO_UNK2);
marioState->forwardVel = forwardVel;
marioState->vel[1] = upwardsVel;
o->parentObj->oChuckyaUnk88 = 0;
break;
case 3:
@ -35,7 +35,7 @@ void common_anchor_mario_behavior(f32 sp28, f32 sp2C, s32 sp30) {
}
void bhv_chuckya_anchor_mario_loop(void) {
common_anchor_mario_behavior(40.0f, 40.0f, 64);
common_anchor_mario_behavior(40.0f, 40.0f, INT_STATUS_MARIO_UNK6);
}
s32 unknown_chuckya_function(s32 sp20, f32 sp24, f32 sp28, s32 sp2C) {
@ -134,7 +134,7 @@ void chuckya_act_0(void) {
o->oChuckyaUnkFC++;
cur_obj_init_animation_with_sound(4);
if (o->oForwardVel > 1.0f)
cur_obj_play_sound_1(SOUND_AIR_CHUCKYA_MOVE);
cur_obj_play_sound_if_visible(SOUND_AIR_CHUCKYA_MOVE);
print_debug_bottom_up("fg %d", sp3C);
print_debug_bottom_up("sp %d", o->oForwardVel);
}
@ -167,7 +167,7 @@ void chuckya_act_1(void) {
} else {
cur_obj_init_animation_with_sound(3);
if (cur_obj_check_anim_frame(18)) {
cur_obj_play_sound_2(SOUND_OBJ_UNKNOWN4);
cur_obj_play_sound_and_rumble_if_visible(SOUND_OBJ_UNKNOWN4);
o->oChuckyaUnk88 = 2;
o->oAction = 3;
o->oInteractStatus &= ~(INT_STATUS_GRABBED_MARIO);
@ -205,7 +205,7 @@ void chuckya_move(void) {
if (o->oInteractStatus & INT_STATUS_GRABBED_MARIO) {
o->oAction = 1;
o->oChuckyaUnk88 = 1;
cur_obj_play_sound_2(SOUND_OBJ_UNKNOWN3);
cur_obj_play_sound_and_rumble_if_visible(SOUND_OBJ_UNKNOWN3);
o->usingObj = nearest_player_to_object(o);
}
}

View file

@ -17,7 +17,7 @@ void clam_act_0(void) {
s32 distanceToPlayer = dist_between_objects(o, player);
if (cur_obj_init_anim_check_frame(0, 25)) {
cur_obj_play_sound_2(SOUND_GENERAL_CLAM_SHELL3);
cur_obj_play_sound_and_rumble_if_visible(SOUND_GENERAL_CLAM_SHELL3);
spawn_mist_from_global();
cur_obj_become_tangible();
@ -25,7 +25,7 @@ void clam_act_0(void) {
o->oTimer = 0;
if (sync_object_is_owned_locally(o->oSyncID)) { network_send_object(o); }
} else if (o->oTimer > 150 && player == gMarioStates[0].marioObj && distanceToPlayer < 500.0f) {
cur_obj_play_sound_2(SOUND_GENERAL_CLAM_SHELL2);
cur_obj_play_sound_and_rumble_if_visible(SOUND_GENERAL_CLAM_SHELL2);
o->oAction = 1;
if (sync_object_is_owned_locally(o->oSyncID)) { network_send_object(o); }
} else if (o->oClamUnkF4 != 0) {

View file

@ -77,10 +77,10 @@ static void cloud_fwoosh_update(void) {
o->oCloudBlowing = o->oTimer = 0;
} else if (o->oCloudGrowSpeed < -0.1f) {
// Start blowing once we start shrinking faster than -0.1
cur_obj_play_sound_1(SOUND_AIR_BLOW_WIND);
cur_obj_play_sound_if_visible(SOUND_AIR_BLOW_WIND);
cur_obj_spawn_strong_wind_particles(12, 3.0f, 0.0f, -50.0f, 120.0f);
} else {
cur_obj_play_sound_1(SOUND_ENV_WIND1);
cur_obj_play_sound_if_visible(SOUND_ENV_WIND1);
}
} else {
// Return to normal size

View file

@ -76,7 +76,7 @@ void coffin_act_idle(void) {
// If the coffin landed...
if (obj_face_pitch_approach(0, -o->oAngleVelPitch)) {
cur_obj_play_sound_2(SOUND_GENERAL_ELEVATOR_MOVE_2);
cur_obj_play_sound_and_rumble_if_visible(SOUND_GENERAL_ELEVATOR_MOVE_2);
// This bit changes the coffin's position,
// spawns dust there, then resets the position.
@ -114,7 +114,7 @@ void coffin_act_idle(void) {
&& (distanceToPlayer > 100.0f || (marioState && marioState->action == ACT_SQUISHED))) {
if ((player && player->oPosY - o->oPosY < 200.0f) && absf(distForwards) < 140.0f) {
if (distSideways < 150.0f && distSideways > -450.0f) {
cur_obj_play_sound_2(SOUND_GENERAL_BUTTON_PRESS_2_LOWPRIO);
cur_obj_play_sound_and_rumble_if_visible(SOUND_GENERAL_BUTTON_PRESS_2_LOWPRIO);
o->oAction = COFFIN_ACT_STAND_UP;
}
}
@ -140,7 +140,7 @@ void coffin_act_stand_up(void) {
o->oFaceAngleRoll = 0;
} else if (o->oTimer > 30) {
if (gGlobalTimer % 4 == 0) {
cur_obj_play_sound_2(SOUND_GENERAL_ELEVATOR_MOVE_2);
cur_obj_play_sound_and_rumble_if_visible(SOUND_GENERAL_ELEVATOR_MOVE_2);
}
// Shake the coffin while its standing
o->oFaceAngleRoll = 400 * (gGlobalTimer % 2) - 200;

View file

@ -50,7 +50,7 @@ void bhv_temp_coin_loop(void) {
void bhv_coin_init(void) {
rng_position_init(o->oPosX, o->oPosY, o->oPosZ);
o->oVelY = random_float() * 10.0f + 30 + o->oCoinUnk110;
o->oVelY = random_float() * 10.0f + 30 + o->oCoinBaseYVel;
o->oForwardVel = random_float() * 10.0f;
o->oMoveAngleYaw = random_u16();
rng_position_finish();
@ -78,11 +78,11 @@ void bhv_coin_loop(void) {
}
if (o->oTimer == 0)
#if defined(VERSION_US)
cur_obj_play_sound_2(SOUND_GENERAL_COIN_SPURT_2);
cur_obj_play_sound_and_rumble_if_visible(SOUND_GENERAL_COIN_SPURT_2);
#elif defined(VERSION_EU) || defined(VERSION_SH)
cur_obj_play_sound_2(SOUND_GENERAL_COIN_SPURT_EU);
cur_obj_play_sound_and_rumble_if_visible(SOUND_GENERAL_COIN_SPURT_EU);
#else
cur_obj_play_sound_2(SOUND_GENERAL_COIN_SPURT);
cur_obj_play_sound_and_rumble_if_visible(SOUND_GENERAL_COIN_SPURT);
#endif
if (o->oVelY < 0)
cur_obj_become_tangible();
@ -97,12 +97,12 @@ void bhv_coin_loop(void) {
#ifndef VERSION_JP
if (o->oMoveFlags & OBJ_MOVE_BOUNCE) {
if (o->oCoinUnk1B0 < 5)
cur_obj_play_sound_2(SOUND_GENERAL_COIN_DROP);
cur_obj_play_sound_and_rumble_if_visible(SOUND_GENERAL_COIN_DROP);
o->oCoinUnk1B0++;
}
#else
if (o->oMoveFlags & OBJ_MOVE_BOUNCE)
cur_obj_play_sound_2(SOUND_GENERAL_COIN_DROP);
cur_obj_play_sound_and_rumble_if_visible(SOUND_GENERAL_COIN_DROP);
#endif
if (cur_obj_wait_then_blink(400, 20))
obj_mark_for_deletion(o);
@ -212,7 +212,7 @@ void coin_inside_boo_act_1(void) {
cur_obj_update_floor_and_walls();
cur_obj_if_hit_wall_bounce_away();
if (o->oMoveFlags & OBJ_MOVE_BOUNCE)
cur_obj_play_sound_2(SOUND_GENERAL_COIN_DROP);
cur_obj_play_sound_and_rumble_if_visible(SOUND_GENERAL_COIN_DROP);
if (o->oTimer > 90 || (o->oMoveFlags & OBJ_MOVE_LANDED)) {
obj_set_hitbox(o, &sYellowCoinHitbox);
cur_obj_become_tangible();

View file

@ -34,7 +34,7 @@ void bhv_controllable_platform_sub_loop(void) {
if (o->parentObj) { o->parentObj->header.gfx.node.flags &= ~GRAPH_RENDER_INVISIBLE; }
#endif
o->oAction = 1;
cur_obj_play_sound_2(SOUND_GENERAL_MOVING_PLATFORM_SWITCH);
cur_obj_play_sound_and_rumble_if_visible(SOUND_GENERAL_MOVING_PLATFORM_SWITCH);
if (o->parentObj) { network_send_object(o->parentObj); }
}
break;
@ -118,7 +118,7 @@ void controllable_platform_hit_wall(s8 sp1B) {
o->oTimer = 0;
D_80331694 = 5;
cur_obj_play_sound_2(SOUND_GENERAL_QUIET_POUND1);
cur_obj_play_sound_and_rumble_if_visible(SOUND_GENERAL_QUIET_POUND1);
#ifdef VERSION_SH
queue_rumble_data(50, 80);
#endif
@ -297,7 +297,7 @@ void bhv_controllable_platform_loop(void) {
o->oPosX += o->oVelX;
o->oPosZ += o->oVelZ;
if (D_80331694 != 0 && D_80331694 != 6)
cur_obj_play_sound_1(SOUND_ENV_ELEVATOR2);
cur_obj_play_sound_if_visible(SOUND_ENV_ELEVATOR2);
if (sync_object_is_owned_locally(o->oSyncID) && oldD_80331694 != D_80331694) {
network_send_object(o);

View file

@ -15,7 +15,7 @@ void bhv_rr_cruiser_wing_loop(void) {
}
#ifndef VERSION_JP
if (o->oTimer == 64) {
cur_obj_play_sound_2(SOUND_GENERAL_BOAT_ROCK);
cur_obj_play_sound_and_rumble_if_visible(SOUND_GENERAL_BOAT_ROCK);
o->oTimer = 0;
}
#endif

View file

@ -27,5 +27,5 @@ void bhv_decorative_pendulum_loop(void) {
* actually one sound played twice in rapid succession.
*/
if (o->oAngleVelRoll == 0x10 || o->oAngleVelRoll == -0x10)
cur_obj_play_sound_2(SOUND_GENERAL_BIG_CLOCK);
cur_obj_play_sound_and_rumble_if_visible(SOUND_GENERAL_BIG_CLOCK);
}

View file

@ -56,18 +56,18 @@ void set_door_camera_event(void) {
void play_door_open_noise(void) {
s32 sp1C = cur_obj_has_model(MODEL_HMC_METAL_DOOR);
if (o->oTimer == 0) {
cur_obj_play_sound_2(D_8032F328[sp1C]);
cur_obj_play_sound_and_rumble_if_visible(D_8032F328[sp1C]);
//gTimeStopState |= TIME_STOP_MARIO_OPENED_DOOR;
}
if (o->oTimer == 70) {
cur_obj_play_sound_2(D_8032F330[sp1C]);
cur_obj_play_sound_and_rumble_if_visible(D_8032F330[sp1C]);
}
}
void play_warp_door_open_noise(void) {
s32 sp1C = cur_obj_has_model(MODEL_HMC_METAL_DOOR);
if (o->oTimer == 30)
cur_obj_play_sound_2(D_8032F330[sp1C]);
cur_obj_play_sound_and_rumble_if_visible(D_8032F330[sp1C]);
}
void bhv_door_loop(void) {
@ -120,7 +120,7 @@ void bhv_door_loop(void) {
load_object_collision_model();
o->oIntangibleTimer = 0;
}
bhv_star_door_loop_2();
bhv_star_door_loop_update_render_state();
}
void bhv_door_init(void) {
@ -155,31 +155,31 @@ void bhv_door_init(void) {
sync_object_init(o, SYNC_DISTANCE_ONLY_EVENTS);
}
void bhv_star_door_loop_2(void) {
s32 sp4 = 0;
void bhv_star_door_loop_update_render_state(void) {
s32 inSameOrAdjacentRoomToMario = 0;
if (gMarioCurrentRoom != 0) {
if (o->oDoorUnkF8 == gMarioCurrentRoom)
sp4 = 1;
inSameOrAdjacentRoomToMario = 1;
else if (gMarioCurrentRoom == o->oDoorUnkFC)
sp4 = 1;
inSameOrAdjacentRoomToMario = 1;
else if (gMarioCurrentRoom == o->oDoorUnk100)
sp4 = 1;
inSameOrAdjacentRoomToMario = 1;
else if (gDoorAdjacentRooms[gMarioCurrentRoom][0] == o->oDoorUnkFC)
sp4 = 1;
inSameOrAdjacentRoomToMario = 1;
else if (gDoorAdjacentRooms[gMarioCurrentRoom][0] == o->oDoorUnk100)
sp4 = 1;
inSameOrAdjacentRoomToMario = 1;
else if (gDoorAdjacentRooms[gMarioCurrentRoom][1] == o->oDoorUnkFC)
sp4 = 1;
inSameOrAdjacentRoomToMario = 1;
else if (gDoorAdjacentRooms[gMarioCurrentRoom][1] == o->oDoorUnk100)
sp4 = 1;
inSameOrAdjacentRoomToMario = 1;
} else
sp4 = 1;
if (sp4 == 1) {
inSameOrAdjacentRoomToMario = 1;
if (inSameOrAdjacentRoomToMario == 1) {
o->header.gfx.node.flags |= GRAPH_RENDER_ACTIVE;
D_8035FEE4++;
}
if (sp4 == 0) {
if (inSameOrAdjacentRoomToMario == 0) {
o->header.gfx.node.flags &= ~GRAPH_RENDER_ACTIVE;
}
o->oDoorUnk88 = sp4;
o->oDoorUnk88 = inSameOrAdjacentRoomToMario;
}

View file

@ -38,7 +38,7 @@ void dorrie_act_move(void) {
cur_obj_init_animation_with_sound(1);
if (o->oDorrieForwardDistToMario < 320.0f && o->oDorrieGroundPounded) {
cur_obj_play_sound_2(SOUND_OBJ_DORRIE);
cur_obj_play_sound_and_rumble_if_visible(SOUND_OBJ_DORRIE);
o->collisionData = segmented_to_virtual(dorrie_seg6_collision_0600FBB8);
o->oAction = DORRIE_ACT_LOWER_HEAD;
o->oForwardVel = 0.0f;

View file

@ -54,7 +54,7 @@ void bhv_lll_drawbridge_loop(void) {
// the game at regular intervals can leave the drawbridge raised indefinitely.
if (o->oTimer >= 51 && (globalTimer % 8) == 0) {
o->oAction = LLL_DRAWBRIDGE_ACT_LOWER;
cur_obj_play_sound_2(SOUND_GENERAL_BOAT_TILT1);
cur_obj_play_sound_and_rumble_if_visible(SOUND_GENERAL_BOAT_TILT1);
}
}
@ -65,7 +65,7 @@ void bhv_lll_drawbridge_loop(void) {
// the game at regular intervals can leave the drawbridge lowered indefinitely.
if (o->oTimer >= 51 && (globalTimer % 8) == 0) {
o->oAction = LLL_DRAWBRIDGE_ACT_RAISE;
cur_obj_play_sound_2(SOUND_GENERAL_BOAT_TILT2);
cur_obj_play_sound_and_rumble_if_visible(SOUND_GENERAL_BOAT_TILT2);
}
}
}

View file

@ -1,7 +1,7 @@
// elevator.c.inc
void elevator_starting_shake(void) {
cur_obj_play_sound_2(SOUND_GENERAL_QUIET_POUND1);
cur_obj_play_sound_and_rumble_if_visible(SOUND_GENERAL_QUIET_POUND1);
cur_obj_shake_screen(SHAKE_POS_SMALL);
}
@ -43,7 +43,7 @@ void elevator_act_1(void) {
struct MarioState* marioState = nearest_mario_state_to_object(o);
struct Object* player = marioState ? marioState->marioObj : NULL;
cur_obj_play_sound_1(SOUND_ENV_ELEVATOR1);
cur_obj_play_sound_if_visible(SOUND_ENV_ELEVATOR1);
if (o->oTimer == 0 && cur_obj_is_any_player_on_platform()) {
elevator_starting_shake();
}
@ -67,7 +67,7 @@ void elevator_act_2(void) { // Pretty similar code to action 1
struct MarioState* marioState = nearest_mario_state_to_object(o);
struct Object* player = marioState ? marioState->marioObj : NULL;
cur_obj_play_sound_1(SOUND_ENV_ELEVATOR1);
cur_obj_play_sound_if_visible(SOUND_ENV_ELEVATOR1);
if (o->oTimer == 0 && cur_obj_is_any_player_on_platform()) {
elevator_starting_shake();
}
@ -96,7 +96,7 @@ void elevator_act_4(void) {
o->oVelY = 0;
if (o->oTimer == 0) {
cur_obj_shake_screen(SHAKE_POS_SMALL);
cur_obj_play_sound_2(SOUND_GENERAL_METAL_POUND);
cur_obj_play_sound_and_rumble_if_visible(SOUND_GENERAL_METAL_POUND);
}
if (marioState && !mario_is_in_air_action(marioState) && !cur_obj_is_any_player_on_platform()) {
o->oAction = 1;
@ -112,7 +112,7 @@ void elevator_act_3(void) // nearly identical to action 2
o->oVelY = 0;
if (o->oTimer == 0) {
cur_obj_shake_screen(SHAKE_POS_SMALL);
cur_obj_play_sound_2(SOUND_GENERAL_METAL_POUND);
cur_obj_play_sound_and_rumble_if_visible(SOUND_GENERAL_METAL_POUND);
}
if (marioState && !mario_is_in_air_action(marioState) && !cur_obj_is_any_player_on_platform()) {
o->oAction = 0;

View file

@ -19,7 +19,7 @@ void bhv_end_birds_1_loop(void) {
if (gCurrentObject->oTimer < 100)
obj_rotate_towards_point(gCurrentObject, sp34, 0, 0, 0x20, 0x20);
if ((gCurrentObject->oEndBirdUnk104 == 0.f) && (gCurrentObject->oTimer == 0))
cur_obj_play_sound_2(SOUND_GENERAL_BIRDS_FLY_AWAY);
cur_obj_play_sound_and_rumble_if_visible(SOUND_GENERAL_BIRDS_FLY_AWAY);
if (gCutsceneTimer == 0)
obj_mark_for_deletion(gCurrentObject);
break;

View file

@ -23,7 +23,7 @@ void bhv_end_birds_2_loop(void) {
obj_rotate_towards_point(gCurrentObject, sp3C, 0, 0, 8, 8);
if ((gCurrentObject->oEndBirdUnk104 == 0.f) && (gCurrentObject->oTimer == 0))
cur_obj_play_sound_2(SOUND_GENERAL_BIRDS_FLY_AWAY);
cur_obj_play_sound_and_rumble_if_visible(SOUND_GENERAL_BIRDS_FLY_AWAY);
break;
}

View file

@ -181,7 +181,7 @@ static void enemy_lakitu_sub_act_hold_spiny(void) {
*/
static void enemy_lakitu_sub_act_throw_spiny(void) {
if (cur_obj_init_anim_check_frame(2, 2)) {
cur_obj_play_sound_2(SOUND_OBJ_EVIL_LAKITU_THROW);
cur_obj_play_sound_and_rumble_if_visible(SOUND_OBJ_EVIL_LAKITU_THROW);
o->prevObj = NULL;
}
@ -196,7 +196,7 @@ static void enemy_lakitu_sub_act_throw_spiny(void) {
*/
static void enemy_lakitu_act_main(void) {
cur_obj_unhide();
cur_obj_play_sound_1(SOUND_AIR_LAKITU_FLY);
cur_obj_play_sound_if_visible(SOUND_AIR_LAKITU_FLY);
cur_obj_update_floor_and_walls();

View file

@ -19,7 +19,7 @@ void bhv_wdw_express_elevator_loop(void) {
} else if (o->oAction == 1) {
o->oVelY = -20.0f;
o->oPosY += o->oVelY;
cur_obj_play_sound_1(SOUND_ENV_ELEVATOR4);
cur_obj_play_sound_if_visible(SOUND_ENV_ELEVATOR4);
if (o->oTimer > 132)
o->oAction++;
} else if (o->oAction == 2) {
@ -28,7 +28,7 @@ void bhv_wdw_express_elevator_loop(void) {
} else if (o->oAction == 3) {
o->oVelY = 10.0f;
o->oPosY += o->oVelY;
cur_obj_play_sound_1(SOUND_ENV_ELEVATOR4);
cur_obj_play_sound_if_visible(SOUND_ENV_ELEVATOR4);
if (o->oPosY >= o->oHomeY) {
o->oPosY = o->oHomeY;
o->oAction++;

View file

@ -115,7 +115,7 @@ static void eyerok_boss_act_sleep(void) {
s32 distanceToPlayer = player ? dist_between_objects(o, player) : 10000;
if (o->oTimer == 0) {
} else if (distanceToPlayer < 500.0f) {
cur_obj_play_sound_2(SOUND_OBJ_EYEROK_EXPLODE);
cur_obj_play_sound_and_rumble_if_visible(SOUND_OBJ_EYEROK_EXPLODE);
o->oAction = EYEROK_BOSS_ACT_WAKE_UP;
}
}
@ -278,7 +278,7 @@ static s32 eyerok_hand_check_attacked(void) {
struct Object* player = nearest_player_to_object(o);
s32 angleToPlayer = player ? obj_angle_to_object(o, player) : 0;
if (o->oEyerokReceivedAttack != 0 && abs_angle_diff(angleToPlayer, o->oFaceAngleYaw) < 0x3000) {
cur_obj_play_sound_2(SOUND_OBJ2_EYEROK_SOUND_SHORT);
cur_obj_play_sound_and_rumble_if_visible(SOUND_OBJ2_EYEROK_SOUND_SHORT);
if (--o->oHealth >= 2 || !sync_object_is_owned_locally(o->parentObj->oSyncID)) {
o->oAction = EYEROK_HAND_ACT_ATTACKED;
@ -302,7 +302,7 @@ static s32 eyerok_hand_check_attacked(void) {
}
static void eyerok_hand_pound_ground(void) {
cur_obj_play_sound_2(SOUND_OBJ_POUNDING_LOUD);
cur_obj_play_sound_and_rumble_if_visible(SOUND_OBJ_POUNDING_LOUD);
set_camera_shake_from_point(SHAKE_POS_SMALL, o->oPosX, o->oPosY, o->oPosZ);
spawn_mist_from_global();
}
@ -497,7 +497,7 @@ static void eyerok_hand_act_die(void) {
}
if (o->oMoveFlags & OBJ_MOVE_MASK_ON_GROUND) {
cur_obj_play_sound_2(SOUND_OBJ_POUNDING_LOUD);
cur_obj_play_sound_and_rumble_if_visible(SOUND_OBJ_POUNDING_LOUD);
o->oForwardVel = 0.0f;
}
}

View file

@ -79,7 +79,7 @@ void bhv_falling_pillar_loop(void) {
o->oAction = FALLING_PILLAR_ACT_TURNING;
// Play the detaching sound.
cur_obj_play_sound_2(SOUND_GENERAL_POUND_ROCK);
cur_obj_play_sound_and_rumble_if_visible(SOUND_GENERAL_POUND_ROCK);
}
break;

View file

@ -61,7 +61,7 @@ static void fire_piranha_plant_act_hide(void) {
if (cur_obj_check_if_near_animation_end()) {
if (--o->oFirePiranhaPlantDeathSpinTimer == 0) {
cur_obj_play_sound_2(SOUND_OBJ_ENEMY_DEFEAT_SHRINK);
cur_obj_play_sound_and_rumble_if_visible(SOUND_OBJ_ENEMY_DEFEAT_SHRINK);
}
}
} else if (approach_f32_ptr(&o->oFirePiranhaPlantScale, 0.0f,
@ -83,7 +83,7 @@ static void fire_piranha_plant_act_hide(void) {
}
} else if (sNumActiveFirePiranhaPlants < 2 && o->oTimer > 100 && distanceToPlayer > 100.0f
&& distanceToPlayer < 800.0f) {
cur_obj_play_sound_2(SOUND_OBJ_PIRANHA_PLANT_APPEAR);
cur_obj_play_sound_and_rumble_if_visible(SOUND_OBJ_PIRANHA_PLANT_APPEAR);
o->oFirePiranhaPlantActive = TRUE;
sNumActiveFirePiranhaPlants += 1;
@ -108,7 +108,7 @@ static void fire_piranha_plant_act_grow(void) {
if (approach_f32_ptr(&o->oFirePiranhaPlantScale, o->oFirePiranhaPlantNeutralScale,
0.04f * o->oFirePiranhaPlantNeutralScale)) {
if (o->oTimer > 80) {
cur_obj_play_sound_2(SOUND_OBJ_PIRANHA_PLANT_SHRINK);
cur_obj_play_sound_and_rumble_if_visible(SOUND_OBJ_PIRANHA_PLANT_SHRINK);
o->oAction = FIRE_PIRANHA_PLANT_ACT_HIDE;
cur_obj_init_animation_with_sound(0);
} else if (o->oTimer < 50) {
@ -116,7 +116,7 @@ static void fire_piranha_plant_act_grow(void) {
} else { // TODO: Check if we can put these conditionals on same line
if (obj_is_rendering_enabled()) {
if (cur_obj_check_anim_frame(56)) {
cur_obj_play_sound_2(SOUND_OBJ_FLAME_BLOWN);
cur_obj_play_sound_and_rumble_if_visible(SOUND_OBJ_FLAME_BLOWN);
obj_spit_fire(0, (s32)(30.0f * o->oFirePiranhaPlantNeutralScale),
(s32)(140.0f * o->oFirePiranhaPlantNeutralScale),
2.5f * o->oFirePiranhaPlantNeutralScale, MODEL_RED_FLAME_SHADOW,

View file

@ -27,7 +27,7 @@ static void fire_spitter_act_spit_fire(void) {
o->oAction = FIRE_SPITTER_ACT_IDLE;
} else {
if (sync_object_is_owned_locally(o->oSyncID)) {
cur_obj_play_sound_2(SOUND_OBJ_FLAME_BLOWN);
cur_obj_play_sound_and_rumble_if_visible(SOUND_OBJ_FLAME_BLOWN);
struct Object* fire = obj_spit_fire(0, 0, 0, 5.0f, MODEL_RED_FLAME_SHADOW, 20.0f, 15.0f, 0x1000);
struct Object* spawn_objects[] = { fire };
@ -41,7 +41,7 @@ static void fire_spitter_act_spit_fire(void) {
}
static void bhv_fire_spitter_on_received_post(UNUSED u8 localIndex) {
cur_obj_play_sound_2(SOUND_OBJ_FLAME_BLOWN);
cur_obj_play_sound_and_rumble_if_visible(SOUND_OBJ_FLAME_BLOWN);
}
void bhv_fire_spitter_update(void) {

View file

@ -182,7 +182,7 @@ static void fish_act_flee(void) {
distance = (s32)(1.0 / (distanceToPlayer / 600.0));
}
distance *= 127;
cur_obj_play_sound_2(SOUND_GENERAL_MOVING_WATER);
cur_obj_play_sound_and_rumble_if_visible(SOUND_GENERAL_MOVING_WATER);
}
// Speed the animation up over time.

View file

@ -73,7 +73,7 @@ void bhv_flamethrower_loop(void) {
o->oFlameThowerUnk110 = sp34;
flame = spawn_object_relative(o->oBehParams2ndByte, 0, 0, 0, o, model, bhvFlamethrowerFlame);
if (flame != NULL) { flame->oForwardVel = flameVel; }
cur_obj_play_sound_1(SOUND_AIR_BLOW_FIRE);
cur_obj_play_sound_if_visible(SOUND_AIR_BLOW_FIRE);
} else if (o->oTimer > 60)
o->oAction = 0;
}

View file

@ -172,7 +172,7 @@ static void fly_guy_act_shoot_fire(void) {
} else {
// We have reached below scale 1.2 in the shrinking portion
s16 fireMovePitch = marioState ? obj_turn_pitch_toward_mario(marioState, 0.0f, 0) : 0;
cur_obj_play_sound_2(SOUND_OBJ_FLAME_BLOWN);
cur_obj_play_sound_and_rumble_if_visible(SOUND_OBJ_FLAME_BLOWN);
clamp_s16(&fireMovePitch, 0x800, 0x3000);
if (sync_object_is_owned_locally(o->oSyncID)) {

View file

@ -38,7 +38,7 @@ struct ObjectHitbox sBookSwitchHitbox = {
void flying_bookend_act_0(void) {
struct MarioState* marioState = nearest_mario_state_to_object(o);
if (marioState && obj_is_near_to_and_facing_mario(marioState, 400.0f, 0x3000)) {
cur_obj_play_sound_2(SOUND_OBJ_DEFAULT_DEATH);
cur_obj_play_sound_and_rumble_if_visible(SOUND_OBJ_DEFAULT_DEATH);
o->oAction = 1;
o->oBookendUnkF4 = o->oFaceAnglePitch + 0x7FFF;
o->oBookendUnkF8 = o->oFaceAngleRoll - 0x7FFF;
@ -152,7 +152,7 @@ void bhv_bookend_spawn_loop(void) {
u32 models[] = { MODEL_BOOKEND };
network_send_spawn_objects(spawn_objects, models, 1);
cur_obj_play_sound_2(SOUND_OBJ_DEFAULT_DEATH);
cur_obj_play_sound_and_rumble_if_visible(SOUND_OBJ_DEFAULT_DEATH);
}
o->oTimer = 0;
}
@ -355,7 +355,7 @@ void bhv_book_switch_loop(void) {
}
if (o->oBookSwitchUnkF4 == 0.0f) {
cur_obj_play_sound_2(SOUND_OBJ_DEFAULT_DEATH);
cur_obj_play_sound_and_rumble_if_visible(SOUND_OBJ_DEFAULT_DEATH);
}
if (approach_f32_ptr(&o->oBookSwitchUnkF4, 50.0f, 20.0f)) {

View file

@ -125,7 +125,7 @@ void bhv_goomba_init(void) {
* Enter the jump action and set initial y velocity.
*/
static void goomba_begin_jump(void) {
cur_obj_play_sound_2(SOUND_OBJ_GOOMBA_ALERT);
cur_obj_play_sound_and_rumble_if_visible(SOUND_OBJ_GOOMBA_ALERT);
o->oAction = GOOMBA_ACT_JUMP;
o->oForwardVel = 0.0f;
o->oVelY = 50.0f / 3.0f * o->oGoombaScale;

View file

@ -63,7 +63,7 @@ void bhv_grand_star_loop(void) {
if (o->oTimer == 0) {
obj_set_angle(o, 0, 0, 0);
o->oAngleVelYaw = 0x400;
cur_obj_play_sound_2(SOUND_GENERAL2_STAR_APPEARS);
cur_obj_play_sound_and_rumble_if_visible(SOUND_GENERAL2_STAR_APPEARS);
}
if (o->oTimer > 70) {
o->oAction++;
@ -74,7 +74,7 @@ void bhv_grand_star_loop(void) {
Vec3f empty;
empty[0] = empty[1] = empty[2] = 0.0f;
cur_obj_play_sound_2(SOUND_GENERAL_GRAND_STAR);
cur_obj_play_sound_and_rumble_if_visible(SOUND_GENERAL_GRAND_STAR);
cutscene_object(CUTSCENE_STAR_SPAWN, o);
o->oGrandStarUnk108 = arc_to_goal_pos(empty, &o->oPosX, 80.0f, -2.0f);
}
@ -85,7 +85,7 @@ void bhv_grand_star_loop(void) {
o->oVelY = 60.0f;
o->oForwardVel = 0.0f;
o->oSubAction++;
cur_obj_play_sound_2(SOUND_GENERAL_GRAND_STAR_JUMP);
cur_obj_play_sound_and_rumble_if_visible(SOUND_GENERAL_GRAND_STAR_JUMP);
}
} else if (o->oVelY < 0.0f && o->oPosY < o->oHomeY + 200.0f) {
o->oPosY = o->oHomeY + 200.0f;
@ -94,7 +94,7 @@ void bhv_grand_star_loop(void) {
set_mario_npc_dialog(&gMarioStates[0], 0, NULL);
o->oAction++;
o->oInteractStatus = 0;
cur_obj_play_sound_2(SOUND_GENERAL_GRAND_STAR_JUMP);
cur_obj_play_sound_and_rumble_if_visible(SOUND_GENERAL_GRAND_STAR_JUMP);
}
spawn_sparkle_particles(3, 200, 80, -60);
} else if (o->oAction == 2) {

View file

@ -45,7 +45,7 @@ void bhv_openable_grill_loop(void) {
grillObj = o->oOpenableGrillUnkF4;
if (grillObj && grillObj->oAction == 2) {
o->oOpenableGrillUnk88 = 2;
cur_obj_play_sound_2(SOUND_GENERAL_CAGE_OPEN);
cur_obj_play_sound_and_rumble_if_visible(SOUND_GENERAL_CAGE_OPEN);
o->oAction++;
if (o->oBehParams2ndByte != 0)
play_puzzle_jingle();

View file

@ -81,7 +81,7 @@ void haunted_chair_act_0(void) {
f32 val08;
if (o->oFaceAnglePitch < 0) {
cur_obj_play_sound_2(SOUND_GENERAL_HAUNTED_CHAIR_MOVE);
cur_obj_play_sound_and_rumble_if_visible(SOUND_GENERAL_HAUNTED_CHAIR_MOVE);
val08 = 4.0f;
} else {
val08 = -4.0f;
@ -126,7 +126,7 @@ void haunted_chair_act_1(void) {
} else {
if (o->oHauntedChairUnkF4 != 0) {
if (--o->oHauntedChairUnkF4 == 0) {
cur_obj_play_sound_2(SOUND_GENERAL_HAUNTED_CHAIR);
cur_obj_play_sound_and_rumble_if_visible(SOUND_GENERAL_HAUNTED_CHAIR);
if (marioState) {
o->oMoveAnglePitch = obj_turn_pitch_toward_mario(marioState, 120.0f, 0);
}
@ -134,7 +134,7 @@ void haunted_chair_act_1(void) {
obj_compute_vel_from_move_pitch(50.0f);
} else if (o->oHauntedChairUnkF4 > 20) {
if (gGlobalTimer % 4 == 0) {
cur_obj_play_sound_2(SOUND_GENERAL_SWISH_AIR_2);
cur_obj_play_sound_and_rumble_if_visible(SOUND_GENERAL_SWISH_AIR_2);
}
o->oFaceAngleYaw += 0x2710;
}

View file

@ -19,7 +19,7 @@ void bhv_heave_ho_throw_mario_loop(void) {
case 1:
break;
case 2:
cur_obj_play_sound_2(SOUND_OBJ_HEAVEHO_TOSSED);
cur_obj_play_sound_and_rumble_if_visible(SOUND_OBJ_HEAVEHO_TOSSED);
if (player) {
player->oInteractStatus |= INT_STATUS_MARIO_UNK2;
}
@ -108,7 +108,7 @@ void heave_ho_move(void) {
else
o->oGraphYOffset = 0.0f;
if (o->oForwardVel > 3.0f)
cur_obj_play_sound_1(SOUND_AIR_HEAVEHO_MOVE);
cur_obj_play_sound_if_visible(SOUND_AIR_HEAVEHO_MOVE);
if (o->oAction != 0 && o->oMoveFlags & OBJ_MOVE_MASK_IN_WATER)
o->oAction = 0;
if (o->oInteractStatus & INT_STATUS_GRABBED_MARIO) {

View file

@ -88,7 +88,7 @@ void hoot_free_step(s16 fastOscY, s32 speed) {
}
if (sp26 == 0)
cur_obj_play_sound_2(SOUND_GENERAL_SWISH_WATER);
cur_obj_play_sound_and_rumble_if_visible(SOUND_GENERAL_SWISH_WATER);
}
void hoot_player_set_yaw(void) {
@ -125,7 +125,7 @@ void hoot_carry_step(s32 speed, UNUSED f32 xPrev, UNUSED f32 zPrev) {
o->oPosZ += o->oVelZ;
if (sp22 == 0)
cur_obj_play_sound_2(SOUND_GENERAL_SWISH_WATER);
cur_obj_play_sound_and_rumble_if_visible(SOUND_GENERAL_SWISH_WATER);
}
// sp48 = xPrev
@ -160,9 +160,9 @@ void hoot_surface_collision(f32 xPrev, UNUSED f32 yPrev, f32 zPrev) {
return;
}
if (absf_2(o->oPosX) > 8000.0f)
if (absf(o->oPosX) > 8000.0f)
o->oPosX = xPrev;
if (absf_2(o->oPosZ) > 8000.0f)
if (absf(o->oPosZ) > 8000.0f)
o->oPosZ = zPrev;
if (floorY + 125.0f > o->oPosY)
o->oPosY = floorY + 125.0f;
@ -180,7 +180,7 @@ void hoot_act_ascent(f32 xPrev, f32 zPrev) {
o->oMoveAnglePitch = 0xCE38;
if (o->oTimer >= 29) {
cur_obj_play_sound_1(SOUND_ENV_WIND2);
cur_obj_play_sound_if_visible(SOUND_ENV_WIND2);
o->header.gfx.animInfo.animFrame = 1;
}

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