From 26207594f2b7e41e9522930fd171142a8810214e Mon Sep 17 00:00:00 2001 From: Derek Hensley Date: Mon, 3 Oct 2022 20:06:04 -0700 Subject: [PATCH 1/7] Format Script Update (#904) * Bring over format.sh and .clang-tidy and run it * Little fixes * Adjustments * Jenkins kick * Jenkins kick 2 * format * small fixes * Bring over new formatter by Roman Co-authored-by: Roman971 <32455037+Roman971@users.noreply.github.com> * Force use of clang-11 * check_format * Update error messages * Fix from Tharo for python3.6 Co-authored-by: Tharo <17233964+Thar0@users.noreply.github.com> * Just use nproc to determine num jobs for check format * Update error message * AnimatedMat_DrawStepOpa texture arg -> matAnim * Fix enTwig draw prototype * Tidying up * Bring over fixes in OoT #1387 Co-authored-by: Roman971 <32455037+Roman971@users.noreply.github.com> * Fix * Update doc tools * PR Co-authored-by: Roman971 <32455037+Roman971@users.noreply.github.com> Co-authored-by: Tharo <17233964+Thar0@users.noreply.github.com> --- .clang-tidy | 6 +- docs/tools.md | 28 +- format.py | 176 +++++++++++ format.sh | 46 --- include/functions.h | 297 +++++++++--------- include/gfxprint.h | 28 +- include/os_malloc.h | 2 +- include/sys_matrix.h | 2 +- include/z64quake.h | 2 +- include/z64save.h | 6 +- include/z64subs.h | 6 +- include/z_en_hy_code.h | 2 +- include/z_title_setup.h | 2 +- src/boot_O2_g3/irqmgr.c | 12 +- src/code/audio/audio_load.c | 2 +- src/code/audio/audio_synthesis.c | 6 +- src/code/audio/code_8019AF00.c | 2 +- src/code/z_en_item00.c | 4 +- src/code/z_scene_proc.c | 4 +- src/code/z_skelanime.c | 4 +- src/libultra/flash/osFlash.c | 6 +- .../ovl_Bg_Dblue_Movebg/z_bg_dblue_movebg.c | 2 +- .../ovl_Bg_Ikana_Dharma/z_bg_ikana_dharma.c | 2 +- .../ovl_Bg_Ikana_Mirror/z_bg_ikana_mirror.c | 2 +- .../actors/ovl_Bg_Ingate/z_bg_ingate.c | 2 +- .../ovl_Bg_Last_Bwall/z_bg_last_bwall.c | 2 +- .../actors/ovl_Bg_Numa_Hana/z_bg_numa_hana.c | 2 +- .../ovl_Bg_Open_Shutter/z_bg_open_shutter.c | 2 +- src/overlays/actors/ovl_Boss_02/z_boss_02.c | 2 +- src/overlays/actors/ovl_Boss_03/z_boss_03.c | 4 +- src/overlays/actors/ovl_Boss_04/z_boss_04.c | 4 +- src/overlays/actors/ovl_Boss_06/z_boss_06.c | 2 +- src/overlays/actors/ovl_Dm_An/z_dm_an.c | 2 +- .../actors/ovl_Dm_Char00/z_dm_char00.c | 2 +- .../actors/ovl_Dm_Char01/z_dm_char01.c | 2 +- .../actors/ovl_Door_Shutter/z_door_shutter.c | 2 +- src/overlays/actors/ovl_Eff_Dust/z_eff_dust.c | 4 +- src/overlays/actors/ovl_En_Am/z_en_am.c | 2 +- src/overlays/actors/ovl_En_Az/z_en_az.c | 10 +- .../actors/ovl_En_Bbfall/z_en_bbfall.c | 2 +- src/overlays/actors/ovl_En_Bigpo/z_en_bigpo.c | 4 +- .../actors/ovl_En_Bigslime/z_en_bigslime.c | 2 +- src/overlays/actors/ovl_En_Bombf/z_en_bombf.c | 2 +- .../actors/ovl_En_Bomjimb/z_en_bomjimb.c | 2 +- src/overlays/actors/ovl_En_Cha/z_en_cha.c | 2 +- src/overlays/actors/ovl_En_Cow/z_en_cow.c | 6 +- .../actors/ovl_En_Dinofos/z_en_dinofos.c | 2 +- src/overlays/actors/ovl_En_Dnb/z_en_dnb.c | 2 +- .../actors/ovl_En_Dodongo/z_en_dodongo.c | 2 +- src/overlays/actors/ovl_En_Door/z_en_door.c | 2 +- .../actors/ovl_En_Door_Etc/z_en_door_etc.c | 2 +- src/overlays/actors/ovl_En_Elf/z_en_elf.c | 6 +- .../actors/ovl_En_Elfbub/z_en_elfbub.c | 2 +- .../actors/ovl_En_Firefly/z_en_firefly.c | 2 +- src/overlays/actors/ovl_En_Fish/z_en_fish.c | 2 +- src/overlays/actors/ovl_En_Fish2/z_en_fish2.c | 2 +- .../actors/ovl_En_Fishing/z_en_fishing.c | 8 +- .../actors/ovl_En_Floormas/z_en_floormas.c | 2 +- src/overlays/actors/ovl_En_Ge1/z_en_ge1.c | 4 +- src/overlays/actors/ovl_En_Gg2/z_en_gg2.c | 2 +- .../actors/ovl_En_Hanabi/z_en_hanabi.c | 4 +- src/overlays/actors/ovl_En_Horse/z_en_horse.c | 4 +- src/overlays/actors/ovl_En_Ik/z_en_ik.c | 2 +- .../actors/ovl_En_Invadepoh/z_en_invadepoh.c | 2 +- src/overlays/actors/ovl_En_Ishi/z_en_ishi.c | 2 +- .../actors/ovl_En_Karebaba/z_en_karebaba.c | 2 +- src/overlays/actors/ovl_En_Kusa/z_en_kusa.c | 2 +- .../actors/ovl_En_M_Thunder/z_en_m_thunder.c | 2 +- src/overlays/actors/ovl_En_Muto/z_en_muto.c | 2 +- .../actors/ovl_En_Nutsball/z_en_nutsball.c | 2 +- .../actors/ovl_En_Peehat/z_en_peehat.c | 2 +- src/overlays/actors/ovl_En_Poh/z_en_poh.c | 2 +- src/overlays/actors/ovl_En_Pr/z_en_pr.c | 2 +- .../actors/ovl_En_Racedog/z_en_racedog.c | 2 +- .../actors/ovl_En_Railgibud/z_en_railgibud.c | 3 +- src/overlays/actors/ovl_En_Rr/z_en_rr.c | 2 +- .../actors/ovl_En_Ruppecrow/z_en_ruppecrow.c | 2 +- .../ovl_En_Syateki_Crow/z_en_syateki_crow.c | 2 +- .../z_en_syateki_dekunuts.c | 2 +- .../ovl_En_Syateki_Wf/z_en_syateki_wf.c | 2 +- .../actors/ovl_En_Tanron2/z_en_tanron2.c | 2 +- .../actors/ovl_En_Tanron4/z_en_tanron4.c | 2 +- .../actors/ovl_En_Tanron5/z_en_tanron5.c | 4 +- src/overlays/actors/ovl_En_Test/z_en_test.c | 2 +- src/overlays/actors/ovl_En_Test5/z_en_test5.c | 4 +- src/overlays/actors/ovl_En_Test6/z_en_test6.c | 4 +- src/overlays/actors/ovl_En_Test7/z_en_test7.c | 2 +- .../actors/ovl_En_Thiefbird/z_en_thiefbird.c | 2 +- .../actors/ovl_En_Torch2/z_en_torch2.c | 2 +- src/overlays/actors/ovl_En_Twig/z_en_twig.c | 10 +- .../ovl_En_Water_Effect/z_en_water_effect.c | 4 +- .../actors/ovl_En_Wiz_Fire/z_en_wiz_fire.c | 4 +- .../actors/ovl_En_Wood02/z_en_wood02.c | 2 +- src/overlays/actors/ovl_En_Zos/z_en_zos.c | 2 +- src/overlays/actors/ovl_En_Zot/z_en_zot.c | 2 +- .../actors/ovl_Obj_Armos/z_obj_armos.c | 2 +- src/overlays/actors/ovl_Obj_Boat/z_obj_boat.c | 2 +- src/overlays/actors/ovl_Obj_Chan/z_obj_chan.c | 2 +- .../actors/ovl_Obj_Dhouse/z_obj_dhouse.c | 2 +- .../ovl_Obj_Flowerpot/z_obj_flowerpot.c | 4 +- .../ovl_Obj_Hugebombiwa/z_obj_hugebombiwa.c | 2 +- .../actors/ovl_Obj_Jg_Gakki/z_obj_jg_gakki.c | 2 +- .../actors/ovl_Obj_Kibako/z_obj_kibako.c | 4 +- .../actors/ovl_Obj_Milk_Bin/z_obj_milk_bin.c | 2 +- .../actors/ovl_Obj_Raillift/z_obj_raillift.c | 6 +- .../ovl_Obj_Spinyroll/z_obj_spinyroll.c | 2 +- .../actors/ovl_Obj_Syokudai/z_obj_syokudai.c | 2 +- src/overlays/actors/ovl_Obj_Toge/z_obj_toge.c | 2 +- .../actors/ovl_Obj_Tsubo/z_obj_tsubo.c | 4 +- src/overlays/actors/ovl_Obj_Um/z_obj_um.c | 2 +- .../ovl_Obj_Vspinyroll/z_obj_vspinyroll.c | 2 +- .../ovl_Obj_Warpstone/z_obj_warpstone.c | 2 +- src/overlays/actors/ovl_Shot_Sun/z_shot_sun.c | 2 +- .../ovl_Effect_Ss_Bubble/z_eff_ss_bubble.c | 2 +- tools/check_format.sh | 4 +- 115 files changed, 526 insertions(+), 372 deletions(-) create mode 100755 format.py delete mode 100755 format.sh diff --git a/.clang-tidy b/.clang-tidy index 4022a3f68..caf62ab7f 100644 --- a/.clang-tidy +++ b/.clang-tidy @@ -1,5 +1,9 @@ -Checks: '-*,readability-braces-around-statements' +Checks: '-*,readability-braces-around-statements,readability-inconsistent-declaration-parameter-name' WarningsAsErrors: '' HeaderFilterRegex: '(src|include)\/.*\.h$' FormatStyle: 'file' CheckOptions: + # Require argument names to match exactly (instead of allowing a name to be a prefix/suffix of another) + # Note: 'true' is expected by clang-tidy 12+ but '1' is used for compatibility with older versions + - key: readability-inconsistent-declaration-parameter-name.Strict + value: 1 diff --git a/docs/tools.md b/docs/tools.md index 149fba9ae..0aba4fa47 100644 --- a/docs/tools.md +++ b/docs/tools.md @@ -23,7 +23,7 @@ - [`tools/warnings_count/check_new_warnings.sh`](#toolswarnings_countcheck_new_warningssh) - [`tools/warnings_count/update_current_warnings.sh`](#toolswarnings_countupdate_current_warningssh) - [`fixle.sh`](#fixlesh) - - [`format.sh`](#formatsh) + - [`format.py`](#formatpy) - [External tools](#external-tools) - [mips_to_c](#mips_to_c) - [Permuter](#permuter) @@ -196,9 +196,31 @@ If you have to add new warnings, **and have permission from the leads**, run thi Fixes line endings in the repo to Linux style (LF), which is required for the build process to work. (You may be better off creating a new clone directly in Linux/WSL, though) -### `format.sh` +### `format.py` -Formats all C files in the repo using `clang-format-11` (instructions on how to install this version are pinned in Discord if you can't get it from your package manager in the usual way). This will touch all files in the repo, so the next `make` will take longer. +Formats all C files in the repo using `clang-format-11`, `clang-tidy`, and `clang-apply-replacements` (when multiprocessing). This will touch all files in the repo, so the next `make` will take longer. + +You can specify how many threads you would like this to run with by adding the `-jN` flag. Where N is the number of threads. By default this will run using 1 thread (i.e. `-j1`). + +`clang-11` is available in many native package managers, but if not try: + +Linux: +Download llvm's setup script, run it, than install normally +```bash +wget https://apt.llvm.org/llvm.sh +chmod +x llvm.sh +sudo ./llvm.sh 11 +rm llvm.sh +sudo apt install clang-format-11 clang-tidy-11 clang-apply-replacements-11 +``` + +Mac: +Install with brew, than create symlinks for `clang-tidy` and `clang-apply-replacements` to use properly +```bash +brew install llvm clang-format-11 +ln -s "$(brew --prefix llvm)/bin/clang-tidy" "/usr/local/bin/clang-tidy" +ln -s "$(brew --prefix llvm)/bin/clang-apply-replacements" "/usr/local/bin/clang-apply-replacements" +``` ## External tools diff --git a/format.py b/format.py new file mode 100755 index 000000000..5b3cd3158 --- /dev/null +++ b/format.py @@ -0,0 +1,176 @@ +#!/usr/bin/env python3 + +import argparse +import glob +import multiprocessing +import os +import re +import shutil +import subprocess +import sys +import tempfile +from functools import partial +from typing import List + + +# clang-format, clang-tidy and clang-apply-replacements default version +# Version 11 is used when available for more consistency between contributors +CLANG_VER = 11 + +# Clang-Format options (see .clang-format for rules applied) +FORMAT_OPTS = "-i -style=file" + +# Clang-Tidy options (see .clang-tidy for checks enabled) +TIDY_OPTS = "-p ." +TIDY_FIX_OPTS = "--fix --fix-errors" + +# Clang-Apply-Replacements options (used for multiprocessing) +APPLY_OPTS = "" + +# Compiler options used with Clang-Tidy +# Normal warnings are disabled with -Wno-everything to focus only on tidying +INCLUDES = "-Iinclude -Isrc -Ibuild -I." +DEFINES = "-D_LANGUAGE_C -DNON_MATCHING" +COMPILER_OPTS = f"-fno-builtin -std=gnu90 -m32 -Wno-everything {INCLUDES} {DEFINES}" + + +def get_clang_executable(allowed_executables: List[str]): + for executable in allowed_executables: + try: + subprocess.check_call([executable, "--version"], stdout=subprocess.DEVNULL, stderr=subprocess.DEVNULL) + return executable + except FileNotFoundError or subprocess.CalledProcessError: + pass + return None + + +def get_tidy_version(tidy_executable: str): + tidy_version_run = subprocess.run([tidy_executable, "--version"], stdout=subprocess.PIPE, universal_newlines=True) + match = re.search(r"LLVM version ([0-9]+)", tidy_version_run.stdout) + return int(match.group(1)) + + +CLANG_FORMAT = get_clang_executable([f"clang-format-{CLANG_VER}"]) +if CLANG_FORMAT is None: + sys.exit(f"Error: clang-format-{CLANG_VER} found") + +CLANG_TIDY = get_clang_executable([f"clang-tidy-{CLANG_VER}", "clang-tidy"]) +if CLANG_TIDY is None: + sys.exit(f"Error: neither clang-tidy-{CLANG_VER} nor clang-tidy found") + +CLANG_APPLY_REPLACEMENTS = get_clang_executable([f"clang-apply-replacements-{CLANG_VER}", "clang-apply-replacements"]) + +# Try to detect the clang-tidy version and add --fix-notes for version 13+ +# This is used to ensure all fixes are applied properly in recent versions +if get_tidy_version(CLANG_TIDY) >= 13: + TIDY_FIX_OPTS += " --fix-notes" + + +def list_chunks(list: List, chunk_length: int): + for i in range(0, len(list), chunk_length): + yield list[i : i + chunk_length] + + +def run_clang_format(files: List[str]): + exec_str = f"{CLANG_FORMAT} {FORMAT_OPTS} {' '.join(files)}" + subprocess.run(exec_str, shell=True) + + +def run_clang_tidy(files: List[str]): + exec_str = f"{CLANG_TIDY} {TIDY_OPTS} {TIDY_FIX_OPTS} {' '.join(files)} -- {COMPILER_OPTS}" + subprocess.run(exec_str, shell=True, stdout=subprocess.DEVNULL, stderr=subprocess.DEVNULL) + + +def run_clang_tidy_with_export(tmp_dir: str, files: List[str]): + (handle, tmp_file) = tempfile.mkstemp(suffix=".yaml", dir=tmp_dir) + os.close(handle) + + exec_str = f"{CLANG_TIDY} {TIDY_OPTS} --export-fixes={tmp_file} {' '.join(files)} -- {COMPILER_OPTS}" + subprocess.run(exec_str, shell=True, stdout=subprocess.DEVNULL, stderr=subprocess.DEVNULL) + + +def run_clang_apply_replacements(tmp_dir: str): + exec_str = f"{CLANG_APPLY_REPLACEMENTS} {APPLY_OPTS} {tmp_dir}" + subprocess.run(exec_str, shell=True) + + +def add_final_new_line(file: str): + # https://backreference.org/2010/05/23/sanitizing-files-with-no-trailing-newline/index.html + # "gets the last character of the file pipes it into read, which will exit with a nonzero exit + # code if it encounters EOF before newline (so, if the last character of the file isn't a newline). + # If read exits nonzero, then append a newline onto the file using echo (if read exits 0, + # that satisfies the ||, so the echo command isn't run)." (https://stackoverflow.com/a/34865616) + exec_str = f"tail -c1 {file} | read -r _ || echo >> {file}" + subprocess.run(exec_str, shell=True) + + +def format_files(src_files: List[str], extra_files: List[str], nb_jobs: int): + if nb_jobs != 1: + print(f"Formatting files with {nb_jobs} jobs") + else: + print(f"Formatting files with a single job (consider using -j to make this faster)") + + # Format files in chunks to improve performance while still utilizing jobs + file_chunks = list(list_chunks(src_files, (len(src_files) // nb_jobs) + 1)) + + print("Running clang-format...") + # clang-format only applies changes in the given files, so it's safe to run in parallel + with multiprocessing.get_context("fork").Pool(nb_jobs) as pool: + pool.map(run_clang_format, file_chunks) + + print("Running clang-tidy...") + if nb_jobs > 1: + # clang-tidy may apply changes in #included files, so when running it in parallel we use --export-fixes + # then we call clang-apply-replacements to apply all suggested fixes at the end + tmp_dir = tempfile.mkdtemp() + + try: + with multiprocessing.get_context("fork").Pool(nb_jobs) as pool: + pool.map(partial(run_clang_tidy_with_export, tmp_dir), file_chunks) + + run_clang_apply_replacements(tmp_dir) + finally: + shutil.rmtree(tmp_dir) + else: + run_clang_tidy(src_files) + + print("Adding missing final new lines...") + # Adding final new lines is safe to do in parallel and can be applied to all types of files + with multiprocessing.get_context("fork").Pool(nb_jobs) as pool: + pool.map(add_final_new_line, src_files + extra_files) + + print("Done formatting files.") + + +def main(): + parser = argparse.ArgumentParser(description="Format files in the codebase to enforce most style rules") + parser.add_argument("files", metavar="file", nargs="*") + parser.add_argument( + "-j", + dest="jobs", + type=int, + nargs="?", + default=1, + help="number of jobs to run (default: 1 without -j, number of cpus with -j)", + ) + args = parser.parse_args() + + nb_jobs = args.jobs or multiprocessing.cpu_count() + if nb_jobs > 1: + if CLANG_APPLY_REPLACEMENTS is None: + sys.exit( + f"Error: neither clang-apply-replacements-{CLANG_VER} nor clang-apply-replacements found (required to use -j)" + ) + + if args.files: + files = args.files + extra_files = [] + else: + files = glob.glob("src/**/*.c", recursive=True) + extra_files = glob.glob("assets/**/*.xml", recursive=True) + + format_files(files, extra_files, nb_jobs) + + +if __name__ == "__main__": + main() diff --git a/format.sh b/format.sh deleted file mode 100755 index 1c9389a9a..000000000 --- a/format.sh +++ /dev/null @@ -1,46 +0,0 @@ -#!/usr/bin/env bash - -FORMAT_VER="11" -FORMAT_OPTS="-i -style=file" -TIDY_OPTS="-p . --fix --fix-errors" -COMPILER_OPTS="-fno-builtin -std=gnu90 -Iinclude -Isrc -D_LANGUAGE_C -DNON_MATCHING" - -# https://backreference.org/2010/05/23/sanitizing-files-with-no-trailing-newline/index.html -# "gets the last character of the file pipes it into read, which will exit with a nonzero exit code if it encounters EOF before newline (so, if the last character of the file isn't a newline). If read exits nonzero, then append a newline onto the file using echo (if read exits 0, that satisfies the ||, so the echo command isn't run)." (https://stackoverflow.com/a/34865616) -function add_final_newline () { - for file in "$@" - do - tail -c1 $file | read -r _ || echo >> $file - done -} -export -f add_final_newline - -shopt -s globstar - -if [ -z `command -v clang-format-${FORMAT_VER}` ] -then - echo "clang-format-${FORMAT_VER} not found. Exiting." - exit 1 -fi - -if (( $# > 0 )); then - echo "Formatting file(s) $*" - echo "Running clang-format..." - clang-format-${FORMAT_VER} ${FORMAT_OPTS} "$@" - echo "Running clang-tidy..." - clang-tidy ${TIDY_OPTS} "$@" -- ${COMPILER_OPTS} &> /dev/null - echo "Adding missing final new lines..." - add_final_newline "$@" - echo "Done formatting file(s) $*" - exit -fi - -echo "Formatting C files. This will take a bit" -echo "Running clang-format..." -clang-format-${FORMAT_VER} ${FORMAT_OPTS} src/**/*.c -echo "Running clang-tidy..." -clang-tidy ${TIDY_OPTS} src/**/*.c -- ${COMPILER_OPTS} &> /dev/null -echo "Adding missing final new lines..." -find src/ -type f -name "*.c" -exec bash -c 'add_final_newline "$@"' bash {} + -find assets/xml/ -type f -name "*.xml" -exec bash -c 'add_final_newline "$@"' bash {} + -echo "Done formatting all files." diff --git a/include/functions.h b/include/functions.h index d42733a14..34384ab3f 100644 --- a/include/functions.h +++ b/include/functions.h @@ -5,25 +5,25 @@ void bootproc(void); void Idle_ThreadEntry(void* arg); -void ViConfig_UpdateVi(u32 arg0); +void ViConfig_UpdateVi(u32 mode); void ViConfig_UpdateBlack(void); -s32 DmaMgr_DmaRomToRam(u32 src, void* dst, size_t size); -s32 DmaMgr_DmaHandler(OSPiHandle* piHandle, OSIoMesg* mb, s32 direction); -DmaEntry* DmaMgr_FindDmaEntry(u32 vromAddr); -u32 DmaMgr_TranslateVromToRom(u32 vromAddr); -s32 DmaMgr_FindDmaIndex(u32 vromAddr); +s32 DmaMgr_DmaRomToRam(u32 rom, void* ram, size_t size); +s32 DmaMgr_DmaHandler(OSPiHandle* pihandle, OSIoMesg* mb, s32 direction); +DmaEntry* DmaMgr_FindDmaEntry(u32 vrom); +u32 DmaMgr_TranslateVromToRom(u32 vrom); +s32 DmaMgr_FindDmaIndex(u32 vrom); const char* func_800809F4(u32 param_1); void DmaMgr_ProcessMsg(DmaRequest* req); void DmaMgr_ThreadEntry(void* arg); -s32 DmaMgr_SendRequestImpl(DmaRequest* request, void* vramStart, uintptr_t vromStart, size_t size, UNK_TYPE4 unused, OSMesgQueue* callback, void* callbackMesg); +s32 DmaMgr_SendRequestImpl(DmaRequest* request, void* vramStart, uintptr_t vromStart, size_t size, UNK_TYPE4 unused, OSMesgQueue* queue, void* msg); s32 DmaMgr_SendRequest0(void* vramStart, uintptr_t vromStart, size_t size); void DmaMgr_Start(void); void DmaMgr_Stop(void); void* Yaz0_FirstDMA(void); void* Yaz0_NextDMA(void* curSrcPos); -s32 Yaz0_DecompressImpl(u8* hdr, u8* dst); +s32 Yaz0_DecompressImpl(u8* src, u8* dst); void Yaz0_Decompress(u32 romStart, void* dst, size_t size); -void IrqMgr_AddClient(IrqMgr* irqmgr, IrqMgrClient* add, OSMesgQueue* msgQ); +void IrqMgr_AddClient(IrqMgr* irqmgr, IrqMgrClient* client, OSMesgQueue* msgQueue); void IrqMgr_RemoveClient(IrqMgr* irqmgr, IrqMgrClient* remove); void IrqMgr_SendMesgForClient(IrqMgr* irqmgr, OSMesg msg); void IrqMgr_JamMesgForClient(IrqMgr* irqmgr, OSMesg msg); @@ -85,7 +85,7 @@ void Fault_HangupFaultClient(const char* arg0, char* arg1); void Fault_AddHungupAndCrashImpl(const char* arg0, char* arg1); void Fault_AddHungupAndCrash(const char* filename, u32 line); void FaultDrawer_SetOsSyncPrintfEnabled(u32 enabled); -void FaultDrawer_DrawRecImpl(s32 xstart, s32 ystart, s32 xend, s32 yend, u16 color); +void FaultDrawer_DrawRecImpl(s32 xStart, s32 yStart, s32 xEnd, s32 yEnd, u16 color); void FaultDrawer_DrawChar(char c); s32 FaultDrawer_ColorToPrintColor(u16 color); void FaultDrawer_UpdatePrintColor(void); @@ -128,8 +128,8 @@ StackStatus StackCheck_GetState(StackEntry* entry); u32 StackCheck_CheckAll(void); u32 StackCheck_Check(StackEntry* entry); -void MtxConv_F2L(Mtx* m1, MtxF* m2); -void MtxConv_L2F(MtxF* m1, Mtx* m2); +void MtxConv_F2L(Mtx* mtx, MtxF* mf); +void MtxConv_L2F(MtxF* mtx, Mtx* mf); void __assert(const char* file, u32 lineNum); // void func_800862B4(void); @@ -150,7 +150,7 @@ f32 func_80086814(f32 x); // void func_80086AF0(void); f32 func_80086B30(f32 y, f32 x); // void func_80086C18(void); -f32 func_80086C48(f32 param_1); +f32 func_80086C48(f32 x); // void func_80086C70(void); f64 func_80086C7C(f64 param_1); s32 func_80086C88(f32 param_1); @@ -177,13 +177,13 @@ void Rand_Seed(u32 seed); f32 Rand_ZeroOne(void); f32 Rand_Centered(void); void Rand_Seed_Variable(u32* rndNum, u32 seed); -u32 Rand_Next_Variable(u32* param_1); -f32 Rand_ZeroOne_Variable(u32* param_1); -f32 Rand_Centered_Variable(u32* param_1); +u32 Rand_Next_Variable(u32* rndNum); +f32 Rand_ZeroOne_Variable(u32* rndNum); +f32 Rand_Centered_Variable(u32* rndNum); -void* proutSprintf(void* s, const char* buf, size_t n); +void* proutSprintf(void* dst, const char* fmt, size_t size); s32 vsprintf(char* dst, char* fmt, va_list args); -s32 sprintf(char* s, char* fmt, ...); +s32 sprintf(char* dst, char* fmt, ...); s32 PrintUtils_VPrintf(PrintCallback* pfn, const char* fmt, va_list args); s32 PrintUtils_Printf(PrintCallback* pfn, const char* fmt, ...); void Sleep_Cycles(OSTime time); @@ -194,7 +194,7 @@ void Sleep_Sec(u32 sec); // void __osSetCause(void); s32 osSendMesg(OSMesgQueue* mq, OSMesg msg, s32 flags); s32 osPfsFreeBlocks(OSPfs* pfs, s32* leftoverBytes); -void osViExtendVStart(u32 param_1); +void osViExtendVStart(u32 a0); void osStopThread(OSThread* t); s32 osRecvMesg(OSMesgQueue* mq, OSMesg* msg, s32 flags); OSIntMask osSetIntMask(OSIntMask im); @@ -226,8 +226,8 @@ OSThread* __osPopThread(OSThread** param_1); // void __osNop(void); void __osDispatchThread(void); void __osCleanupThread(void); -void __osDequeueThread(OSThread** param_1, OSThread* param_2); -void osDestroyThread(OSThread* puParm1); +void __osDequeueThread(OSThread** queue, OSThread* t); +void osDestroyThread(OSThread* t); // void __osVoiceCheckResult(void); void bzero(void* begin, s32 length); @@ -236,13 +236,13 @@ void __osSiGetAccess(void); void __osSiRelAccess(void); s32 osContInit(OSMesgQueue* mq, u8* bitpattern, OSContStatus* data); void __osContGetInitData(u8* pattern, OSContStatus* data); -void __osPackRequestData(u8 cmd); +void __osPackRequestData(u8 poll); void osCreateThread(OSThread* t, OSId id, void* entry, void* arg, void* sp, OSPri p); s32 osContStartReadData(OSMesgQueue* mq); void osContGetReadData(OSContPad* data); void __osPackReadData(void); // void osVoiceGetReadData(void); -uintptr_t osVirtualToPhysical(void* vaddr); +uintptr_t osVirtualToPhysical(void* virtualAddress); u32 __osGetSR(void); void __osSetSR(u32 value); void osWritebackDCache(void* vaddr, s32 nbytes); @@ -292,12 +292,12 @@ void guMtxL2F(MtxF* m1, Mtx* m2); u32 osGetMemSize(void); s32 osPfsFindFile(OSPfs* pfs, u16 companyCode, u32 gameCode, u8* gameName, u8* extName, s32* fileNo); void osSetEventMesg(OSEvent e, OSMesgQueue* mq, OSMesg m); -f32 sqrtf(f32 __x); +f32 sqrtf(f32 f); s32 osAfterPreNMI(void); s32 osContStartQuery(OSMesgQueue* mq); void osContGetQuery(OSContStatus* data); -void guLookAtHiliteF(float mf[4][4], LookAt* l, Hilite* h, f32 xEye, f32 yEye, f32 zEye, f32 xAt, f32 yAt, f32 zAt, f32 xUp, f32 yUp, f32 zUp, f32 xl1, f32 yl1, f32 zl1, f32 xl2, f32 yl2, f32 zl2, s32 twidth, s32 theight); -void guLookAtHilite(Mtx* m, LookAt* l, Hilite* h, f32 xEye, f32 yEye, f32 zEye, f32 xAt, f32 yAt, f32 zAt, f32 xUp, f32 yUp, f32 zUp, f32 xl1, f32 yl1, f32 zl1, f32 xl2, f32 yl2, f32 zl2, s32 twidth, s32 theight); +void guLookAtHiliteF(float mf[4][4], LookAt* l, Hilite* h, f32 xEye, f32 yEye, f32 zEye, f32 xAt, f32 yAt, f32 zAt, f32 xUp, f32 yUp, f32 zUp, f32 xl1, f32 yl1, f32 zl1, f32 xl2, f32 yl2, f32 zl2, s32 hiliteWidth, s32 hiliteHeight); +void guLookAtHilite(Mtx* m, LookAt* l, Hilite* h, f32 xEye, f32 yEye, f32 zEye, f32 xAt, f32 yAt, f32 zAt, f32 xUp, f32 yUp, f32 zUp, f32 xl1, f32 yl1, f32 zl1, f32 xl2, f32 yl2, f32 zl2, s32 hiliteWidth, s32 hiliteHeight); s32 _Printf(PrintCallback pfn, void* arg, const char* fmt, va_list ap); void _Putfld(_Pft* px, va_list* pap, u8 code, u8* ac); // void osVoiceClearDictionary(void); @@ -305,9 +305,9 @@ void osUnmapTLBAll(void); s32 osEPiStartDma(OSPiHandle* pihandle, OSIoMesg* mb, s32 direction); // void __osVoiceContRead2(void); u8 __osVoiceContDataCrc(u8* data, size_t numBytes); -const char* strchr(const char* __s, s32 __c); -size_t strlen(const char* __s); -void* memcpy(void* __dest, const void* __src, size_t __n); +const char* strchr(const char* s, s32 c); +size_t strlen(const char* s); +void* memcpy(void* s1, const void* s2, size_t n); void osCreateMesgQueue(OSMesgQueue* mq, OSMesg* msq, s32 count); void osInvalICache(void* vaddr, size_t nbytes); void osInvalDCache(void* vaddr, size_t nbytes); @@ -320,24 +320,24 @@ s32 __osSpDeviceBusy(void); s32 __osSiDeviceBusy(void); // void guMtxIdent(void); s32 osJamMesg(OSMesgQueue* mq, OSMesg msg, s32 flag); -void osSetThreadPri(OSThread* t, OSPri pri); +void osSetThreadPri(OSThread* t, OSPri p); OSPri osGetThreadPri(OSThread* t); s32 __osEPiRawReadIo(OSPiHandle* handle, u32 devAddr, u32* data); void osViSwapBuffer(void* frameBufPtr); -void guPositionF(float mf[4][4], f32 r, f32 p, f32 h, f32 s, f32 x, f32 y, f32 z); -void guPosition(Mtx* m, f32 r, f32 p, f32 h, f32 s, f32 x, f32 y, f32 z); +void guPositionF(float mf[4][4], f32 rot, f32 pitch, f32 yaw, f32 scale, f32 x, f32 y, f32 z); +void guPosition(Mtx* m, f32 rot, f32 pitch, f32 yaw, f32 scale, f32 x, f32 y, f32 z); s32 __osEPiRawStartDma(OSPiHandle* handle, s32 direction, u32 cartAddr, void* dramAddr, size_t size); OSYieldResult osSpTaskYielded(OSTask* task); s32 bcmp(void* __s1, void* __s2, size_t __n); OSTime osGetTime(void); -void guRotateF(float mf[4][4], f32 a, f32 x, f32 y, f32 z); +void guRotateF(float m[4][4], f32 a, f32 x, f32 y, f32 z); void guRotate(Mtx* m, f32 a, f32 x, f32 y, f32 z); void __osSetGlobalIntMask(u32 mask); // void osVoiceInit(void); s32 __osContChannelReset(OSMesgQueue* mq, s32 channel); // void __osVoiceSetADConverter(void); s32 osAiSetFrequency(u32 frequency); -s32 __osContRamRead(OSMesgQueue* mq, s32 channel, u16 address, u8* buffer); +s32 __osContRamRead(OSMesgQueue* ctrlrqueue, s32 channel, u16 addr, u8* buffer); // void __osVoiceContWrite20(void); u8 __osContAddressCrc(u16 addr); u8 __osContDataCrc(u8* data); @@ -351,7 +351,7 @@ void bcopy(void* __src, void* __dest, size_t __n); void __osResetGlobalIntMask(u32 mask); // void osPfsDeleteFile(UNK_TYPE1 param_1, UNK_TYPE1 param_2, UNK_TYPE1 param_3, UNK_TYPE1 param_4, UNK_TYPE4 param_5); // void __osPfsReleasePages(UNK_TYPE1 param_1, UNK_TYPE1 param_2, UNK_TYPE1 param_3, UNK_TYPE1 param_4, UNK_TYPE4 param_5); -void guOrthoF(float mf[4][4], f32 l, f32 r, f32 b, f32 t, f32 n, f32 f, f32 scale); +void guOrthoF(float m[4][4], f32 l, f32 r, f32 b, f32 t, f32 n, f32 f, f32 scale); void guOrtho(Mtx* m, f32 l, f32 r, f32 b, f32 t, f32 n, f32 f, f32 scale); OSIntMask __osDisableInt(void); void __osRestoreInt(OSIntMask im); @@ -359,13 +359,13 @@ void __osViInit(void); void __osViSwapContext(void); OSMesgQueue* osPiGetCmdQueue(void); f32 cosf(f32 __x); -s32 osEPiReadIo(OSPiHandle* pihandle, u32 devAddr, u32* data); +s32 osEPiReadIo(OSPiHandle* handle, u32 devAddr, u32* data); void osViSetSpecialFeatures(u32 func); s16 coss(u16 x); void osSetTime(OSTime ticks); // void osVoiceStopReadData(void); void osViSetEvent(OSMesgQueue* mq, OSMesg m, u32 retraceCount); -s32 osPfsIsPlug(OSMesgQueue* queue, u8* pattern); +s32 osPfsIsPlug(OSMesgQueue* mq, u8* pattern); // void __osPfsRequestData(void); // void __osPfsGetInitData(void); s32 __osVoiceGetStatus(OSMesgQueue* mq, s32 port, u8* status); @@ -380,7 +380,7 @@ u32 __osGetFpcCsr(void); // void __osPfsCheckRamArea(void); // void osPfsChecker(void); u32 osAiGetLength(void); -s32 osEPiWriteIo(OSPiHandle* pihandle, u32 devAddr, u32 data); +s32 osEPiWriteIo(OSPiHandle* handle, u32 devAddr, u32 data); void osMapTLBRdb(void); void osYieldThread(void); void guTranslate(Mtx* mtx, f32 x, f32 y, f32 z); @@ -388,15 +388,15 @@ u32 __osGetCause(void); s32 __osContRamWrite(OSMesgQueue* mq, s32 channel, u16 address, u8* buffer, s32 force); s32 __osEPiRawWriteIo(OSPiHandle* handle, u32 devAddr, u32 data); s32 osSetTimer(OSTimer* t, OSTime value, OSTime interval, OSMesgQueue* mq, OSMesg msg); -void _Ldtob(_Pft* px, u8 code); +void _Ldtob(_Pft* args, u8 type); // void _Ldunscale(void); void _Genld(_Pft* px, u8 code, u8* p, s16 nsig, s16 xexp); ldiv_t ldiv(long numer, long denom); lldiv_t lldiv(long long numer, long long denom); -void _Litob(_Pft* px, u8 code); +void _Litob(_Pft* args, u8 type); s32 __osSiRawWriteIo(u32 devAddr, u32 data); u32 __osSpGetStatus(void); -void __osSpSetStatus(u32 value); +void __osSpSetStatus(u32 data); void osCreateViManager(OSPri pri); // void viMgrMain(OSDevMgr* iParm1); __OSViContext* __osViGetCurrentContext(void); @@ -404,17 +404,17 @@ void osWritebackDCacheAll(void); OSThread* __osGetCurrFaultedThread(void); // void osVoiceMaskDictionary(void); void guMtxF2L(float mf[4][4], Mtx* m); -void osStartThread(OSThread* param_1); +void osStartThread(OSThread* t); void osViSetYScale(f32 value); void osViSetXScale(f32 value); long long __d_to_ll(double d); long long __f_to_ll(float f); unsigned long long __d_to_ull(double d); unsigned long long __f_to_ull(float f); -double __ll_to_d(long long l); -float __ll_to_f(long long l); -double __ull_to_d(unsigned long long l); -float __ull_to_f(unsigned long long l); +double __ll_to_d(long long s); +float __ll_to_f(long long s); +double __ull_to_d(unsigned long long u); +float __ull_to_f(unsigned long long u); // void osVoiceCheckWord(void); // void osVoiceControlGain(void); // void osVoiceStartReadData(void); @@ -473,7 +473,7 @@ void func_800AE5A0(PlayState* play); void func_800AE5E4(PlayState* play, Color_RGBA8* color, s16 arg2, s16 arg3); void func_800AE778(PlayState* play, Color_RGBA8* color, s16 arg2, s16 arg3); void func_800AE8EC(PlayState* play); -void func_800AE930(CollisionContext* colCtx, EffectTireMark* this, Vec3f* pos, f32 arg3, s16 angle, CollisionPoly* colPoly, s32 arg6); +void func_800AE930(CollisionContext* colCtx, EffectTireMark* this, Vec3f* pos, f32 arg3, s16 arg4, CollisionPoly* colPoly, s32 arg6); void func_800AEF44(EffectTireMark* this); void EffectTireMark_Init(void* thisx, void* initParamsx); void EffectTireMark_Destroy(void* thisx); @@ -490,18 +490,18 @@ void Effect_DestroyAll(PlayState* play); void EffectSS_Init(PlayState* play, s32 numEntries); void EffectSS_Clear(PlayState* play); EffectSs* EffectSS_GetTable(void); -void EffectSS_Delete(EffectSs* param_1); +void EffectSS_Delete(EffectSs* effectSs); void EffectSS_ResetEntry(EffectSs* particle); s32 EffectSS_FindFreeSpace(s32 priority, s32* tableEntry); -void EffectSS_Copy(PlayState* play, EffectSs* particle); -void EffectSs_Spawn(PlayState* play, s32 type, s32 priority, void* initParams); +void EffectSS_Copy(PlayState* play, EffectSs* effectsSs); +void EffectSs_Spawn(PlayState* play, s32 type, s32 priority, void* initData); void EffectSS_UpdateParticle(PlayState* play, s32 index); void EffectSS_UpdateAllParticles(PlayState* play); void EffectSS_DrawParticle(PlayState* play, s32 index); void EffectSS_DrawAllParticles(PlayState* play); -s16 func_800B096C(s16 param_1, s16 param_2, s32 param_3); -s16 func_800B09D0(s16 a0, s16 a1, f32 a2); -u8 func_800B0A24(u8 a0, u8 a1, f32 a2); +s16 func_800B096C(s16 arg0, s16 arg1, s32 arg2); +s16 func_800B09D0(s16 arg0, s16 arg1, f32 arg2); +u8 func_800B0A24(u8 arg0, u8 arg1, f32 arg2); void EffectSs_DrawGEffect(PlayState* play, EffectSs* this, void* texture); void EffectSsDust_Spawn(PlayState* play, u16 drawFlags, Vec3f* pos, Vec3f* velocity, Vec3f* accel, Color_RGBA8* primColor, Color_RGBA8* envColor, s16 scale, s16 scaleStep, s16 life, u8 updateMode); void func_800B0DE0(PlayState* play, Vec3f* pos, Vec3f* velocity, Vec3f* accel, Color_RGBA8* primColor, Color_RGBA8* envColor, s16 scale, s16 scaleStep); @@ -530,10 +530,9 @@ void EffectSsKirakira_SpawnDispersed(PlayState* play, Vec3f* pos, Vec3f* velocit // void EffectSsBomb2_SpawnFade(UNK_TYPE4 uParm1, Vec3f* pzParm2, Vec3f* pzParm3, Vec3f* pzParm4); void EffectSsBomb2_SpawnLayered(PlayState* play, Vec3f* pos, Vec3f* velocity, Vec3f* accel, s16 scale, s16 scaleStep); // void EffectSsBlast_Spawn(UNK_TYPE4 uParm1, Vec3f* pzParm2, Vec3f* pzParm3, Vec3f* pzParm4, Color_RGBA8* param_5, Color_RGBA8* param_6, UNK_TYPE2 param_7, UNK_TYPE2 param_8, UNK_TYPE2 param_9, UNK_TYPE2 param_10); -void EffectSsBlast_SpawnWhiteCustomScale(PlayState* play, Vec3f* pos, Vec3f* velocity, Vec3f* accel, s16 scale, - s16 scaleStep, s16 life); +void EffectSsBlast_SpawnWhiteCustomScale(PlayState* play, Vec3f* pos, Vec3f* velocity, Vec3f* accel, s16 scale, s16 scaleStep, s16 life); // void EffectSsBlast_SpawnShockwave(UNK_TYPE1 param_1, UNK_TYPE1 param_2, UNK_TYPE1 param_3, UNK_TYPE1 param_4, UNK_TYPE4 param_5, UNK_TYPE4 param_6, UNK_TYPE2 param_7); -void EffectSsBlast_SpawnWhiteShockwave(PlayState* play, Vec3f* arg1, Vec3f* arg2, Vec3f* arg3); +void EffectSsBlast_SpawnWhiteShockwave(PlayState* play, Vec3f* pos, Vec3f* velocity, Vec3f* accel); // void EffectSsGSpk_SpawnAccel(UNK_TYPE4 uParm1, UNK_TYPE4 uParm2, Vec3f* pzParm3, Vec3f* pzParm4, Vec3f* param_5, Color_RGBA8* param_6, Color_RGBA8* param_7, UNK_TYPE2 param_8, UNK_TYPE2 param_9); // void EffectSsGSpk_SpawnNoAccel(UNK_TYPE1 param_1, UNK_TYPE1 param_2, UNK_TYPE1 param_3, UNK_TYPE1 param_4, UNK_TYPE4 param_5, UNK_TYPE4 param_6, UNK_TYPE4 param_7, UNK_TYPE2 param_8, UNK_TYPE2 param_9); void EffectSsGSpk_SpawnFuse(PlayState* play, Actor* actor, Vec3f* pos, Vec3f* velocity, Vec3f* accel); @@ -558,11 +557,11 @@ void EffectSsHitmark_SpawnFixedScale(PlayState* play, s32 type, Vec3f* pos); void EffectSsHitmark_SpawnCustomScale(PlayState* play, s32 type, s16 scale, Vec3f* pos); void EffectSsFhgFlash_SpawnShock(PlayState* play, Actor* actor, Vec3f* pos, s16 scale, u8 params); // void EffectSsKFire_Spawn(UNK_TYPE4 uParm1, Vec3f* pzParm2, Vec3f* pzParm3, Vec3f* pzParm4, UNK_TYPE2 param_5, UNK_TYPE1 param_6); -void EffectSsSolderSrchBall_Spawn(PlayState* play, Vec3f* pos, Vec3f* velocity, Vec3f* accel, s16 scale, s16* playerDetected, s16 params); +void EffectSsSolderSrchBall_Spawn(PlayState* play, Vec3f* pos, Vec3f* velocity, Vec3f* accel, s16 scale, s16* playerDetected, s16 flags); void EffectSsKakera_Spawn(PlayState* play, Vec3f* pos, Vec3f* velocity, Vec3f* arg3, s16 gravity, s16 arg5, s16 arg6, s16 arg7, s16 arg8, s16 scale, s16 arg10, s16 arg11, s32 life, s16 colorIdx, s16 objId, Gfx* dList); // void EffectSsIcePiece_Spawn(UNK_TYPE4 uParm1, Vec3f* pzParm2, UNK_TYPE4 uParm3, Vec3f* pzParm4, Vec3f* param_5, UNK_TYPE4 param_6); // void EffectSsIcePiece_SpawnBurst(void); -void func_800B2B44(PlayState* play, Actor* actor, Vec3f* arg2, f32 arg3); +void func_800B2B44(PlayState* play, Actor* actor, Vec3f* pos, f32 scale); // void func_800B2B7C(void); void EffectSsEnIce_Spawn(PlayState* play, Vec3f* pos, f32 scale, Vec3f* velocity, Vec3f* accel, Color_RGBA8* primColor, Color_RGBA8* envColor, s32 life); // void EffectSsFireTail_Spawn(UNK_TYPE4 uParm1, UNK_TYPE4 uParm2, Vec3f* pzParm3, UNK_TYPE4 uParm4, Vec3f* param_5, UNK_TYPE2 param_6, Color_RGBA8* param_7, Color_RGBA8* param_8, UNK_TYPE2 param_9, UNK_TYPE2 param_10, UNK_TYPE4 param_11); @@ -571,7 +570,7 @@ void EffectSsEnIce_Spawn(PlayState* play, Vec3f* pos, f32 scale, Vec3f* velocity void EffectSsEnFire_SpawnVec3f(PlayState* play, Actor* actor, Vec3f* pos, s16 scale, s16 params, s16 flags, s16 bodyPart); // void EffectSsEnFire_SpawnVec3s(UNK_TYPE1 param_1, UNK_TYPE1 param_2, UNK_TYPE1 param_3, UNK_TYPE1 param_4, UNK_TYPE2 param_5, UNK_TYPE2 param_6, UNK_TYPE2 param_7); void EffectSsExtra_Spawn(PlayState* play, Vec3f* pos, Vec3f* velocity, Vec3f* accel, s16 scale, s16 scoreIdx); -void EffectSsDeadDb_Spawn(PlayState* play, Vec3f* pos, Vec3f* velocity, Vec3f* accel, Color_RGBA8* prim, Color_RGBA8* env, s16 scale, s16 scaleStep, s32 unk); +void EffectSsDeadDb_Spawn(PlayState* play, Vec3f* pos, Vec3f* velocity, Vec3f* accel, Color_RGBA8* prim, Color_RGBA8* env, s16 scale, s16 scaleStep, s32 life); void func_800B3030(PlayState* play, Vec3f* pos, Vec3f* velocity, Vec3f* accel, s16 scale, s16 scaleStep, s32 colorIndex); void EffectSsDeadDd_Spawn(PlayState* play, Vec3f* pos, Vec3f* velocity, Vec3f* accel, Color_RGBA8* prim, Color_RGBA8* env, s16 scale, s16 scaleStep, s16 alphaStep, s32 life); // void EffectSsDeadDs_Spawn(UNK_TYPE4 uParm1, Vec3f* pzParm2, Vec3f* pzParm3, Vec3f* pzParm4, UNK_TYPE2 param_5, UNK_TYPE2 param_6, UNK_TYPE2 param_7, UNK_TYPE4 param_8); @@ -580,8 +579,8 @@ void EffectSsIceSmoke_Spawn(PlayState* play, Vec3f* pos, Vec3f* velocity, Vec3f* void EffectSsIceBlock_Spawn(PlayState* play, Vec3f* pos, Vec3f* velocity, Vec3f* accel, s16 scale); void FlagSet_Update(GameState* gameState); void FlagSet_Draw(GameState* gameState); -void Overlay_LoadGameState(GameStateOverlay* gameState); -void Overlay_FreeGameState(GameStateOverlay* gameState); +void Overlay_LoadGameState(GameStateOverlay* overlayEntry); +void Overlay_FreeGameState(GameStateOverlay* overlayEntry); void ActorShape_Init(ActorShape* actorShape, f32 yOffset, ActorShadowFunc shadowDraw, f32 shadowScale); void ActorShadow_DrawCircle(Actor* actor, Lights* lights, PlayState* play); @@ -648,7 +647,7 @@ f32 Actor_XZDistanceBetweenActors(Actor* actor1, Actor* actor2); f32 Actor_XZDistanceToPoint(Actor* actor, Vec3f* point); void Actor_OffsetOfPointInActorCoords(Actor* actor, Vec3f* offset, Vec3f* point); f32 Actor_HeightDiff(Actor* actor1, Actor* actor2); -void func_800B6F20(PlayState* play, Input* input, f32 arg2, s16 arg3); +void func_800B6F20(PlayState* play, Input* input, f32 magnitude, s16 baseYaw); f32 Player_GetHeight(Player* player); f32 Player_GetRunSpeedLimit(Player* player); s32 func_800B7118(Player* player); @@ -717,7 +716,7 @@ void func_800B9010(Actor* actor, u16 sfxId); void func_800B9038(Actor* actor, s32 timer); void func_800B9084(Actor* actor); void func_800B9098(Actor* actor); -s32 func_800B90AC(PlayState* play, Actor* actor, CollisionPoly* polygon, s32 index, s32 arg4); +s32 func_800B90AC(PlayState* play, Actor* actor, CollisionPoly* polygon, s32 bgId, s32 arg4); void Actor_DeactivateLens(PlayState* play); void func_800B9120(ActorContext* actorCtx); void Actor_InitContext(PlayState* play, ActorContext* actorCtx, ActorEntry* actorEntry); @@ -783,15 +782,15 @@ void ActorOverlayTable_Init(void); void ActorOverlayTable_Cleanup(void); void SSNode_SetValue(SSNode* node, s16* polyIndex, u16 next); -void SSList_SetNull(SSList* head); +void SSList_SetNull(SSList* ssList); void SSNodeList_SetSSListHead(SSNodeList* list, SSList* ssList, s16* polyIndex); void DynaSSNodeList_SetSSListHead(DynaSSNodeList* list, SSList* ssList, s16* polyIndex); void DynaSSNodeList_Init(PlayState* play, DynaSSNodeList* list); void DynaSSNodeList_Alloc(PlayState* play, DynaSSNodeList* list, u32 numNodes); void DynaSSNodeList_ResetCount(DynaSSNodeList* list); u16 DynaSSNodeList_GetNextNodeIdx(DynaSSNodeList* list); -void BgCheck_Vec3sToVec3f(Vec3s* vertex, Vec3f* vector); -void BgCheck_Vec3fToVec3s(Vec3s* vertex, Vec3f* vector); +void BgCheck_Vec3sToVec3f(Vec3s* src, Vec3f* dest); +void BgCheck_Vec3fToVec3s(Vec3s* dest, Vec3f* src); f32 func_800BFD84(CollisionPoly *poly, f32 arg1, f32 arg2); s32 func_800BFDEC(CollisionPoly* polyA, CollisionPoly* polyB, u32* outVtxId0, u32* outVtxId1); s16 CollisionPoly_GetMinY(CollisionPoly* poly, Vec3s* vertices); @@ -815,7 +814,7 @@ void BgCheck_Allocate(CollisionContext* colCtx, PlayState* play, CollisionHeader void BgCheck_SetContextFlags(CollisionContext* colCtx, u32 flags); void BgCheck_UnsetContextFlags(CollisionContext* colCtx, u32 flags); CollisionHeader* BgCheck_GetCollisionHeader(CollisionContext* colCtx, s32 bgId); -f32 BgCheck_RaycastFloorImpl(PlayState* play, CollisionContext* colCtx, u16 xpFlags, CollisionPoly** outPoly, s32* outBgId, Vec3f* pos, Actor* actor, u32 arg7, f32 chkDist, s32 arg9); +f32 BgCheck_RaycastFloorImpl(PlayState* play, CollisionContext* colCtx, u16 xpFlags, CollisionPoly** outPoly, s32* outBgId, Vec3f* pos, Actor* actor, u32 arg7, f32 checkDist, s32 arg9); f32 BgCheck_CameraRaycastFloor1(CollisionContext* colCtx, CollisionPoly** outPoly, Vec3f* pos); f32 BgCheck_EntityRaycastFloor1(CollisionContext* colCtx, CollisionPoly** outPoly, Vec3f* pos); f32 BgCheck_EntityRaycastFloor2(PlayState* play, CollisionContext* colCtx, CollisionPoly** outPoly, Vec3f* pos); @@ -824,7 +823,7 @@ f32 BgCheck_EntityRaycastFloor3(CollisionContext* colCtx, CollisionPoly** outPol f32 BgCheck_EntityRaycastFloor5(CollisionContext* colCtx, CollisionPoly** outPoly, s32* outBgId, Actor* actor, Vec3f* pos); f32 BgCheck_EntityRaycastFloor5_2(PlayState* play, CollisionContext* colCtx, CollisionPoly** outPoly, s32* bgId, Actor* actor, Vec3f* pos); f32 BgCheck_EntityRaycastFloor5_3(PlayState* play, CollisionContext* colCtx, CollisionPoly** outPoly, s32* bgId, Actor* actor, Vec3f* pos); -f32 BgCheck_EntityRaycastFloor6(CollisionContext* colCtx, CollisionPoly** outPoly, s32* bgId, Actor* actor, Vec3f* pos, f32 chkDist); +f32 BgCheck_EntityRaycastFloor6(CollisionContext* colCtx, CollisionPoly** outPoly, s32* bgId, Actor* actor, Vec3f* pos, f32 checkDist); f32 BgCheck_EntityRaycastFloor7(CollisionContext* colCtx, CollisionPoly** outPoly, s32* bgId, Actor* actor, Vec3f* pos); f32 BgCheck_AnyRaycastFloor1(CollisionContext* colCtx, CollisionPoly* outPoly, Vec3f* pos); f32 BgCheck_AnyRaycastFloor2(CollisionContext* colCtx, CollisionPoly* outPoly, s32* bgId, Vec3f* pos); @@ -839,15 +838,15 @@ s32 BgCheck_EntitySphVsWall4(CollisionContext* colCtx, Vec3f* posResult, Vec3f* s32 BgCheck_CheckCeilingImpl(CollisionContext* colCtx, u16 xpFlags, f32* outY, Vec3f* pos, f32 checkHeight, CollisionPoly** outPoly, s32* outBgId, Actor* actor); s32 BgCheck_AnyCheckCeiling(CollisionContext* colCtx, f32* outY, Vec3f* pos, f32 checkHeight); s32 BgCheck_EntityCheckCeiling(CollisionContext* colCtx, f32* outY, Vec3f* pos, f32 checkHeight, CollisionPoly** outPoly, s32* outBgId, Actor* actor); -s32 BgCheck_CameraLineTest1(CollisionContext* colCtx, Vec3f* posA, Vec3f* posB, Vec3f* posResult, CollisionPoly** outPoly, s32 chkWall, s32 chkFloor, s32 chkCeil, s32 chkOneFace, s32* bgId); -s32 BgCheck_CameraLineTest2(CollisionContext* colCtx, Vec3f* posA, Vec3f* posB, Vec3f* posResult, CollisionPoly** outPoly, s32 chkWall, s32 chkFloor, s32 chkCeil, s32 chkOneFace, s32* bgId); -s32 BgCheck_EntityLineTest1(CollisionContext* colCtx, Vec3f* posA, Vec3f* posB, Vec3f* posResult, CollisionPoly** outPoly, s32 chkWall, s32 chkFloor, s32 chkCeil, s32 chkOneFace, s32* bgId); -s32 BgCheck_EntityLineTest2(CollisionContext* colCtx, Vec3f* posA, Vec3f* posB, Vec3f* posResult, CollisionPoly** outPoly, s32 chkWall, s32 chkFloor, s32 chkCeil, s32 chkOneFace, s32* bgId, Actor* actor); -s32 BgCheck_EntityLineTest3(CollisionContext* colCtx, Vec3f* posA, Vec3f* posB, Vec3f* posResult, CollisionPoly** outPoly, s32 chkWall, s32 chkFloor, s32 chkCeil, s32 chkOneFace, s32* bgId, Actor* actor, f32 chkDist); -s32 BgCheck_ProjectileLineTest(CollisionContext* colCtx, Vec3f* posA, Vec3f* posB, Vec3f* posResult, CollisionPoly** outPoly, s32 chkWall, s32 chkFloor, s32 chkCeil, s32 chkOneFace, s32* bgId); -s32 BgCheck_AnyLineTest1(CollisionContext* colCtx, Vec3f* posA, Vec3f* posB, Vec3f* posResult, CollisionPoly** outPoly, s32 chkOneFace); -s32 BgCheck_AnyLineTest2(CollisionContext* colCtx, Vec3f* posA, Vec3f* posB, Vec3f* posResult, CollisionPoly** outPoly, s32 chkWall, s32 chkFloor, s32 chkCeil, s32 chkOneFace); -s32 BgCheck_AnyLineTest3(CollisionContext* colCtx, Vec3f* posA, Vec3f* posB, Vec3f* posResult, CollisionPoly** outPoly, s32 chkWall, s32 chkFloor, s32 chkCeil, s32 chkOneFace, s32* bgId); +s32 BgCheck_CameraLineTest1(CollisionContext* colCtx, Vec3f* posA, Vec3f* posB, Vec3f* posResult, CollisionPoly** outPoly, s32 checkWall, s32 checkFloor, s32 checkCeil, s32 checkOneFace, s32* bgId); +s32 BgCheck_CameraLineTest2(CollisionContext* colCtx, Vec3f* posA, Vec3f* posB, Vec3f* posResult, CollisionPoly** outPoly, s32 checkWall, s32 checkFloor, s32 checkCeil, s32 checkOneFace, s32* bgId); +s32 BgCheck_EntityLineTest1(CollisionContext* colCtx, Vec3f* posA, Vec3f* posB, Vec3f* posResult, CollisionPoly** outPoly, s32 checkWall, s32 checkFloor, s32 checkCeil, s32 checkOneFace, s32* bgId); +s32 BgCheck_EntityLineTest2(CollisionContext* colCtx, Vec3f* posA, Vec3f* posB, Vec3f* posResult, CollisionPoly** outPoly, s32 checkWall, s32 checkFloor, s32 checkCeil, s32 checkOneFace, s32* bgId, Actor* actor); +s32 BgCheck_EntityLineTest3(CollisionContext* colCtx, Vec3f* posA, Vec3f* posB, Vec3f* posResult, CollisionPoly** outPoly, s32 checkWall, s32 checkFloor, s32 checkCeil, s32 checkOneFace, s32* bgId, Actor* actor, f32 checkDist); +s32 BgCheck_ProjectileLineTest(CollisionContext* colCtx, Vec3f* posA, Vec3f* posB, Vec3f* posResult, CollisionPoly** outPoly, s32 checkWall, s32 checkFloor, s32 checkCeil, s32 checkOneFace, s32* bgId); +s32 BgCheck_AnyLineTest1(CollisionContext* colCtx, Vec3f* posA, Vec3f* posB, Vec3f* posResult, CollisionPoly** outPoly, s32 checkOneFace); +s32 BgCheck_AnyLineTest2(CollisionContext* colCtx, Vec3f* posA, Vec3f* posB, Vec3f* posResult, CollisionPoly** outPoly, s32 checkWall, s32 checkFloor, s32 checkCeil, s32 checkOneFace); +s32 BgCheck_AnyLineTest3(CollisionContext* colCtx, Vec3f* posA, Vec3f* posB, Vec3f* posResult, CollisionPoly** outPoly, s32 checkWall, s32 checkFloor, s32 checkCeil, s32 checkOneFace, s32* bgId); s32 BgCheck_SphVsFirstPolyImpl(CollisionContext* colCtx, u16 xpFlags, CollisionPoly** outPoly, s32* outBgId, Vec3f* center, f32 radius, Actor* actor, u16 bciFlags); s32 BgCheck_SphVsFirstPoly(CollisionContext* colCtx, Vec3f* center, f32 radius); s32 BgCheck_SphVsFirstWall(CollisionContext* colCtx, Vec3f* center, f32 radius); @@ -890,8 +889,8 @@ void BgCheck_ResetFlagsIfLoadedActor(PlayState* play, DynaCollisionContext* dyna void DynaPoly_Setup(PlayState* play, DynaCollisionContext* dyna); void func_800C756C(DynaCollisionContext* dyna, s32* numPolygons, s32* numVertices, s32* numWaterBoxes); void DynaPoly_UpdateBgActorTransforms(PlayState* play, DynaCollisionContext* dyna); -void CollisionHeader_SegmentedToVirtual(CollisionHeader* header); -void CollisionHeader_GetVirtual(CollisionHeader* meshSegPtr, CollisionHeader** param_2); +void CollisionHeader_SegmentedToVirtual(CollisionHeader* colHeader); +void CollisionHeader_GetVirtual(CollisionHeader* colHeader, CollisionHeader** dest); void BgCheck_InitCollisionHeaders(CollisionContext* colCtx, PlayState* play); u32 SurfaceType_GetBgCamIndex(CollisionContext* colCtx, CollisionPoly* poly, s32 bgId); @@ -931,7 +930,7 @@ u32 SurfaceType_IsWallDamage(CollisionContext* colCtx, CollisionPoly* poly, s32 s32 WaterBox_GetSurfaceImpl(PlayState* play, CollisionContext* colCtx, f32 x, f32 z, f32* ySurface, WaterBox** outWaterBox, s32* bgId); s32 WaterBox_GetSurface1(PlayState* play, CollisionContext* colCtx, f32 x, f32 z, f32* ySurface, WaterBox** outWaterBox); s32 WaterBox_GetSurface1_2(PlayState* play, CollisionContext* colCtx, f32 x, f32 z, f32* ySurface, WaterBox** outWaterBox); -s32 WaterBox_GetSurface2(PlayState* play, CollisionContext* colCtx, Vec3f* pos, f32 surfaceChkDist, WaterBox** outWaterBox, s32* bgId); +s32 WaterBox_GetSurface2(PlayState* play, CollisionContext* colCtx, Vec3f* pos, f32 surfaceCheckDist, WaterBox** outWaterBox, s32* bgId); f32 func_800CA568(CollisionContext* colCtx, s32 waterBoxId, s32 bgId); u16 WaterBox_GetBgCamSetting(CollisionContext* colCtx, WaterBox* waterBox, s32 bgId); void WaterBox_GetSceneBgCamSetting(CollisionContext* colCtx, WaterBox* waterBox); @@ -939,18 +938,18 @@ u32 WaterBox_GetLightSettingIndex(CollisionContext* colCtx, WaterBox* waterBox); s32 func_800CA6F0(PlayState* play, CollisionContext* colCtx, f32 x, f32 z, f32* ySurface, WaterBox** outWaterBox, s32* bgId); s32 func_800CA9D0(PlayState* play, CollisionContext* colCtx, f32 x, f32 z, f32* ySurface, WaterBox** outWaterBox); s32 func_800CAA14(CollisionPoly* polyA, CollisionPoly* polyB, Vec3f* pointA, Vec3f* pointB, Vec3f* closestPoint); -void BgCheck2_UpdateActorPosition(CollisionContext* colCtx, s32 index, Actor* actor); -void BgCheck2_UpdateActorYRotation(CollisionContext* colCtx, s32 index, Actor* actor); -void BgCheck2_AttachToMesh(CollisionContext* colCtx, Actor* actor, s32 index); -u32 BgCheck2_UpdateActorAttachedToMesh(CollisionContext* colCtx, s32 index, Actor* actor); +void BgCheck2_UpdateActorPosition(CollisionContext* colCtx, s32 bgId, Actor* actor); +void BgCheck2_UpdateActorYRotation(CollisionContext* colCtx, s32 bgId, Actor* actor); +void BgCheck2_AttachToMesh(CollisionContext* colCtx, Actor* actor, s32 bgId); +u32 BgCheck2_UpdateActorAttachedToMesh(CollisionContext* colCtx, s32 bgId, Actor* actor); void DynaPolyActor_Init(DynaPolyActor* dynaActor, s32 flags); void DynaPolyActor_LoadMesh(PlayState* play, DynaPolyActor* dynaActor, CollisionHeader* meshHeader); void DynaPolyActor_ResetState(DynaPolyActor* dynaActor); void DynaPolyActor_SetRidingFallingState(DynaPolyActor* dynaActor); void DynaPolyActor_SetRidingMovingState(DynaPolyActor* dynaActor); -void DynaPolyActor_SetRidingMovingStateByIndex(CollisionContext* colCtx, s32 index); +void DynaPolyActor_SetRidingMovingStateByIndex(CollisionContext* colCtx, s32 bgId); void DynaPolyActor_SetRidingRotatingState(DynaPolyActor* dynaActor); -void DynaPolyActor_SetRidingRotatingStateByIndex(CollisionContext* colCtx, s32 index); +void DynaPolyActor_SetRidingRotatingStateByIndex(CollisionContext* colCtx, s32 bgId); void DynaPolyActor_SetSwitchPressedState(DynaPolyActor* dynaActor); void DynaPolyActor_SetHeavySwitchPressedState(DynaPolyActor* dynaActor); s32 DynaPolyActor_IsInRidingFallingState(DynaPolyActor* dynaActor); @@ -1331,7 +1330,7 @@ s32 Flags_GetInfTable(s32 flag); void Flags_SetInfTable(s32 flag); s32 Actor_TrackNone(Vec3s* headRot, Vec3s* torsoRot); s32 Actor_TrackPoint(Actor* actor, Vec3f* target, Vec3s* headRot, Vec3s* torsoRot); -s32 Actor_TrackPlayerSetFocusHeight(PlayState* play, Actor* actor, Vec3s* headRot, Vec3s* torsoRot, f32 focusPosYAdj); +s32 Actor_TrackPlayerSetFocusHeight(PlayState* play, Actor* actor, Vec3s* headRot, Vec3s* torsoRot, f32 focusHeight); s32 Actor_TrackPlayer(PlayState* play, Actor* actor, Vec3s* headRot, Vec3s* torsoRot, Vec3f focusPos); void SaveContext_Init(void); void GameInfo_Init(void); @@ -1616,10 +1615,10 @@ void Lights_GlowCheck(PlayState* play); void Lights_DrawGlow(PlayState* play); void* ZeldaArena_Malloc(size_t size); void* ZeldaArena_MallocR(size_t size); -void* ZeldaArena_Realloc(void* oldPtr, size_t newSize); -void ZeldaArena_Free(void* param_1); +void* ZeldaArena_Realloc(void* ptr, size_t newSize); +void ZeldaArena_Free(void* ptr); void* ZeldaArena_Calloc(u32 num, size_t size); -void ZeldaArena_GetSizes(size_t* maxFreeBlock, size_t* bytesFree, size_t* bytesAllocated); +void ZeldaArena_GetSizes(size_t* outMaxFree, size_t* outFree, size_t* outAlloc); s32 ZeldaArena_Check(); void ZeldaArena_Init(void* start, size_t size); void ZeldaArena_Cleanup(); @@ -1898,7 +1897,7 @@ void func_80122F28(Player* player); s32 func_80122F9C(PlayState* play); s32 func_80122FCC(PlayState* play); void func_8012300C(PlayState* play, s32 arg1); -void func_8012301C(Player* player, PlayState* play); +void func_8012301C(Player* player, PlayState* play2); void func_80123140(PlayState* play, Player* player); s32 Player_InBlockingCsMode(PlayState* play, Player* player); s32 Player_InCsMode(PlayState* play); @@ -1912,10 +1911,10 @@ s32 func_8012364C(PlayState* play, Player* player, s32 arg2); s32 func_80123810(PlayState* play); s32 Player_ActionToModelGroup(Player* player, s32 actionParam); void func_801239AC(Player* player); -void Player_SetModels(Player* player, s32 arg1); +void Player_SetModels(Player* player, s32 modelGroup); void Player_SetModelGroup(Player* player, s32 modelGroup); void func_80123C58(Player* player); -void Player_SetEquipmentData(PlayState* play, Player* this); +void Player_SetEquipmentData(PlayState* play, Player* player); void func_80123D50(PlayState* play, Player* player, s32 itemId, s32 actionParam); void func_80123DA4(Player* player); void func_80123DC0(Player* player); @@ -1938,7 +1937,7 @@ s32 Player_ActionToBottle(Player* player, s32 actionParam); s32 Player_GetBottleHeld(Player* Player); s32 Player_ActionToExplosive(Player* player, s32 actionParam); s32 Player_GetExplosiveHeld(Player* player); -s32 func_80124278(Actor* actor, s32 arg1); +s32 func_80124278(Actor* actor, s32 actionParam); s32 func_801242B4(Player* player); s32 Player_GetEnvTimerType(PlayState* play); void func_80124420(Player* player); @@ -1953,7 +1952,7 @@ s32 func_801263FC(PlayState* play, s32 limbIndex, Gfx** dList, Vec3f* pos, Vec3s s32 func_80126440(PlayState* play, ColliderQuad* collider, WeaponInfo* weaponInfo, Vec3f* arg3, Vec3f* arg4); void Player_DrawGetItem(PlayState* play, Player* player); void func_80126B8C(PlayState* play, Player* player); -s32 func_80127438(PlayState* play, Player* player, s32 maskId); +s32 func_80127438(PlayState* play, Player* player, s32 currentMask); s32 func_80128640(PlayState* play, Player* player, Gfx* dlist); void func_80128B74(PlayState* play, Player* player, s32 limbIndex); void func_80128BD0(PlayState* play, s32 limbIndex, Gfx** dList1, Gfx** dList2, Vec3s* rot, Actor* actor); @@ -2065,7 +2064,7 @@ void Inventory_SaveLotteryCodeGuess(PlayState* play); s32 Object_Spawn(ObjectContext* objectCtx, s16 id); void Object_InitBank(GameState* gameState, ObjectContext* objectCtx); void Object_UpdateBank(ObjectContext* objectCtx); -s32 Object_GetIndex(ObjectContext* objectCtx, s16 id); +s32 Object_GetIndex(ObjectContext* objectCtx, s16 objectId); s32 Object_IsLoaded(ObjectContext* objectCtx, s32 index); void Object_LoadAll(ObjectContext* objectCtx); void* func_8012F73C(ObjectContext* objectCtx, s32 iParm2, s16 id); @@ -2111,7 +2110,7 @@ Gfx* AnimatedMat_TexScroll(PlayState* play, AnimatedMatTexScrollParams* params); void AnimatedMat_DrawTexScroll(PlayState* play, s32 segment, void* params); Gfx* AnimatedMat_TwoLayerTexScroll(PlayState* play, AnimatedMatTexScrollParams* params); void AnimatedMat_DrawTwoTexScroll(PlayState* play, s32 segment, void* params); -void AnimatedMat_SetColor(PlayState* play, s32 segment, F3DPrimColor* primColor, F3DEnvColor* envColor); +void AnimatedMat_SetColor(PlayState* play, s32 segment, F3DPrimColor* primColorResult, F3DEnvColor* envColor); void AnimatedMat_DrawColor(PlayState* play, s32 segment, void* params); s32 AnimatedMat_Lerp(s32 min, s32 max, f32 norm); void AnimatedMat_DrawColorLerp(PlayState* play, s32 segment, void* params); @@ -2157,7 +2156,7 @@ void SkelAnime_DrawFlexLimbOpa(PlayState* play, s32 limbIndex, void** skeleton, void SkelAnime_DrawFlexOpa(PlayState* play, void** skeleton, Vec3s* jointTable, s32 dListCount, OverrideLimbDrawOpa overrideLimbDraw, PostLimbDrawOpa postLimbDraw, Actor* actor); void SkelAnime_DrawTransformFlexLimbOpa(PlayState* play, s32 limbIndex, void** skeleton, Vec3s* jointTable, OverrideLimbDrawOpa overrideLimbDraw, PostLimbDrawOpa postLimbDraw, TransformLimbDrawOpa transformLimbDraw, Actor* actor, Mtx** mtx); void SkelAnime_DrawTransformFlexOpa(PlayState* play, void** skeleton, Vec3s* jointTable, s32 dListCount, OverrideLimbDrawOpa overrideLimbDraw, PostLimbDrawOpa postLimbDraw, TransformLimbDrawOpa transformLimbDraw, Actor* actor); -void SkelAnime_GetFrameData(AnimationHeader* animation, s32 currentFrame, s32 limbCount, Vec3s* dst); +void SkelAnime_GetFrameData(AnimationHeader* animation, s32 frame, s32 limbCount, Vec3s* frameTable); s16 Animation_GetLength(void* animation); s16 Animation_GetLastFrame(void* animation); Gfx* SkelAnime_DrawLimb(PlayState* play, s32 limbIndex, void** skeleton, Vec3s* jointTable, OverrideLimbDraw overrideLimbDraw, PostLimbDraw postLimbDraw, Actor* actor, Gfx* gfx); @@ -2176,8 +2175,8 @@ AnimationEntry* AnimationContext_AddEntry(AnimationContext* animationCtx, Animat void AnimationContext_SetLoadFrame(PlayState* play, LinkAnimationHeader* animation, s32 frame, s32 limbCount, Vec3s* frameTable); void AnimationContext_SetCopyAll(PlayState* play, s32 vecCount, Vec3s* dst, Vec3s* src); void AnimationContext_SetInterp(PlayState* play, s32 vecCount, Vec3s* base, Vec3s* mod, f32 weight); -void AnimationContext_SetCopyTrue(PlayState* play, s32 vecCount, Vec3s* dst, Vec3s* src, u8* index); -void AnimationContext_SetCopyFalse(PlayState* play, s32 vecCount, Vec3s* dst, Vec3s* src, u8* index); +void AnimationContext_SetCopyTrue(PlayState* play, s32 vecCount, Vec3s* dst, Vec3s* src, u8* copyFlag); +void AnimationContext_SetCopyFalse(PlayState* play, s32 vecCount, Vec3s* dst, Vec3s* src, u8* copyFlag); void AnimationContext_SetMoveActor(PlayState* play, Actor* actor, SkelAnime* skelAnime, f32 arg3); void AnimationContext_LoadFrame(PlayState* play, AnimationEntryData* data); void AnimationContext_CopyAll(PlayState* play, AnimationEntryData* data); @@ -2203,7 +2202,7 @@ void LinkAnimation_CopyJointToMorph(PlayState* play, SkelAnime* skelAnime); void LinkAnimation_CopyMorphToJoint(PlayState* play, SkelAnime* skelAnime); void LinkAnimation_LoadToMorph(PlayState* play, SkelAnime* skelAnime, LinkAnimationHeader* animation, f32 frame); void LinkAnimation_LoadToJoint(PlayState* play, SkelAnime* skelAnime, LinkAnimationHeader* animation, f32 frame); -void LinkAnimation_InterpJointMorph(PlayState* play, SkelAnime* skelAnime, f32 frame); +void LinkAnimation_InterpJointMorph(PlayState* play, SkelAnime* skelAnime, f32 weight); void LinkAnimation_BlendToJoint(PlayState* play, SkelAnime* skelAnime, LinkAnimationHeader* animation1, f32 frame1, LinkAnimationHeader* animation2, f32 frame2, f32 blendWeight, Vec3s* blendTable); void LinkAnimation_BlendToMorph(PlayState* play, SkelAnime* skelAnime, LinkAnimationHeader* animation1, f32 frame1, LinkAnimationHeader* animation2, f32 frame2, f32 blendWeight, Vec3s* blendTable); void LinkAnimation_EndLoop(SkelAnime* skelAnime); @@ -2211,7 +2210,7 @@ s32 Animation_OnFrameImpl(SkelAnime* skelAnime, f32 frame, f32 updateRate); s32 LinkAnimation_OnFrame(SkelAnime* skelAnime, f32 frame); void SkelAnime_Init(PlayState* play, SkelAnime* skelAnime, SkeletonHeader* skeletonHeaderSeg, AnimationHeader* animation, Vec3s* jointTable, Vec3s* morphTable, s32 limbCount); void SkelAnime_InitFlex(PlayState* play, SkelAnime* skelAnime, FlexSkeletonHeader* skeletonHeaderSeg, AnimationHeader* animation, Vec3s* jointTable, Vec3s* morphTable, s32 limbCount); -void SkelAnime_InitSkin(GameState* gameState, SkelAnime* skelAnime, SkeletonHeader* skeletonHeaderSeg, AnimationHeader* animationSeg); +void SkelAnime_InitSkin(GameState* gameState, SkelAnime* skelAnime, SkeletonHeader* skeletonHeaderSeg, AnimationHeader* animation); void SkelAnime_SetUpdate(SkelAnime* skelAnime); s32 SkelAnime_Update(SkelAnime* skelAnime); s32 SkelAnime_Morph(SkelAnime* skelAnime); @@ -2232,15 +2231,15 @@ void Animation_EndLoop(SkelAnime* skelAnime); void Animation_Reverse(SkelAnime* skelAnime); void SkelAnime_CopyFrameTableTrue(SkelAnime* skelAnime, Vec3s* dst, Vec3s* src, u8* copyFlag); void SkelAnime_CopyFrameTableFalse(SkelAnime* skelAnime, Vec3s* dst, Vec3s* src, u8* copyFlag); -void SkelAnime_UpdateTranslation(SkelAnime* skelAnime, Vec3f* pos, s16 angle); +void SkelAnime_UpdateTranslation(SkelAnime* skelAnime, Vec3f* diff, s16 angle); s32 Animation_OnFrame(SkelAnime* skelAnime, f32 frame); void SkelAnime_Free(SkelAnime* skelAnime, PlayState* play); void SkelAnime_CopyFrameTable(SkelAnime* skelAnime, Vec3s* dst, Vec3s* src); void SkinMatrix_Vec3fMtxFMultXYZW(MtxF* mf, Vec3f* src, Vec3f* xyzDest, f32* wDest); void SkinMatrix_Vec3fMtxFMultXYZ(MtxF* mf, Vec3f* src, Vec3f* dest); void SkinMatrix_MtxFMtxFMult(MtxF* mfB, MtxF* mfA, MtxF* dest); -void SkinMatrix_GetClear(MtxF** puParm1); -void SkinMatrix_GetClear(MtxF** mf); +void SkinMatrix_GetClear(MtxF** mfp); +void SkinMatrix_GetClear(MtxF** mfp); void SkinMatrix_MtxFCopy(MtxF* src, MtxF* dest); s32 SkinMatrix_Invert(MtxF* src, MtxF* dest); void SkinMatrix_SetScale(MtxF* mf, f32 x, f32 y, f32 z); @@ -2309,7 +2308,7 @@ void func_801477B4(PlayState* play); void func_80147818(PlayState* play, UNK_PTR puParm2, UNK_TYPE4 uParm3, UNK_TYPE4 uParm4); // void func_80147F18(PlayState* play, UNK_PTR puParm2, UNK_TYPE4 uParm3, UNK_TYPE4 uParm4); // void func_80148558(PlayState* play, UNK_PTR puParm2, UNK_TYPE4 uParm3, UNK_TYPE4 uParm4); -void func_80148B98(PlayState* play, u8 bParm2); +void func_80148B98(PlayState* play, u8 arg1); // void func_80148CBC(void); // void func_80148D64(void); // void func_80149048(void); @@ -2323,7 +2322,7 @@ void func_80149F74(PlayState* play, u32** ppuParm2); // void func_8014AAD0(void); void func_8014ADBC(PlayState* play, UNK_PTR puParm2); // void func_8014C70C(void); -void Message_LoadChar(PlayState* play, u16 codePointIndex, s32* offset, f32* arg3, s16 arg4); +void Message_LoadChar(PlayState* play, u16 codePointIndex, s32* offset, f32* arg3, s16 decodedBufPos); // void func_8014CCB4(void); // void func_8014CDF0(void); // void func_8014CFDC(void); @@ -2336,7 +2335,7 @@ void func_801514B0(PlayState* play, u16 arg1, u8 arg2); void Message_StartTextbox(PlayState* play, u16 textId, Actor* Actor); void func_80151938(PlayState* play, u16 textId); void func_80151A68(PlayState* play, u16 textId); -void func_80151BB4(PlayState* play, u8 uParm2); +void func_80151BB4(PlayState* play, u8 arg1); // void func_80151C9C(void); void func_80151DA4(PlayState* play, u16 arg2); void func_80152434(PlayState* play, u16 arg2); @@ -2462,42 +2461,42 @@ void func_80167DE4(PlayState* play); void Play_Draw(PlayState* play); void func_80168DAC(PlayState* play); void Play_Main(PlayState* play); -s32 Play_InCsMode(PlayState* play); +s32 Play_InCsMode(PlayState* this); f32 func_80169100(PlayState* play, MtxF* mtx, CollisionPoly** arg2, s32* arg3, Vec3f* feetPosPtr); void func_801691F0(PlayState* play, MtxF* mtx, Vec3f* arg2); void* Play_LoadScene(PlayState* play, RomFile* entry); void func_8016927C(PlayState* play, s16 sParm2); // void func_801692C4(PlayState* play, UNK_TYPE1 uParm2); // void Play_SceneInit(PlayState* play, s32 sceneIndex, UNK_TYPE1 param_3); -void Play_GetScreenPos(PlayState* play, Vec3f* worldPos, Vec3f* screenPos); -s16 Play_CreateSubCamera(PlayState* play); -s16 Play_GetActiveCamId(PlayState* play); -s32 Play_ChangeCameraStatus(PlayState* play, s16 camId, s16 status); -void Play_ClearCamera(PlayState* play, s16 camId); -Camera* Play_GetCamera(PlayState* play, s16 camId); -s32 Play_SetCameraAtEye(PlayState* play, s16 camId, Vec3f* at, Vec3f* eye); -s32 Play_SetCameraAtEyeUp(PlayState* play, s16 camId, Vec3f* at, Vec3f* eye, Vec3f* up); -s32 Play_SetCameraFov(PlayState* play, s16 camId, f32 fov); -s32 Play_SetCameraRoll(PlayState* play, s16 camId, s16 roll); -void Play_CopyCamera(PlayState* play, s16 dstCamId, s16 srcCamId); -s32 func_80169A50(PlayState* play, s16 camId, Player* player, s16 setting); -s32 Play_ChangeCameraSetting(PlayState* play, s16 camId, s16 setting); -void func_80169AFC(PlayState* play, s16 camId, s16 arg2); -u16 Play_GetActorCsCamSetting(PlayState* play, s32 csCamDataIndex); -Vec3s* Play_GetActorCsCamFuncData(PlayState* play, s32 csCamDataIndex); +void Play_GetScreenPos(PlayState* this, Vec3f* worldPos, Vec3f* screenPos); +s16 Play_CreateSubCamera(PlayState* this); +s16 Play_GetActiveCamId(PlayState* this); +s32 Play_ChangeCameraStatus(PlayState* this, s16 camId, s16 status); +void Play_ClearCamera(PlayState* this, s16 camId); +Camera* Play_GetCamera(PlayState* this, s16 camId); +s32 Play_SetCameraAtEye(PlayState* this, s16 camId, Vec3f* at, Vec3f* eye); +s32 Play_SetCameraAtEyeUp(PlayState* this, s16 camId, Vec3f* at, Vec3f* eye, Vec3f* up); +s32 Play_SetCameraFov(PlayState* this, s16 camId, f32 fov); +s32 Play_SetCameraRoll(PlayState* this, s16 camId, s16 roll); +void Play_CopyCamera(PlayState* this, s16 destCamId, s16 srcCamId); +s32 func_80169A50(PlayState* this, s16 camId, Player* player, s16 setting); +s32 Play_ChangeCameraSetting(PlayState* this, s16 camId, s16 setting); +void func_80169AFC(PlayState* this, s16 camId, s16 timer); +u16 Play_GetActorCsCamSetting(PlayState* this, s32 csCamDataIndex); +Vec3s* Play_GetActorCsCamFuncData(PlayState* this, s32 csCamDataIndex); s16 Play_GetOriginalSceneId(s16 sceneId); -void Play_SaveCycleSceneFlags(GameState* gameState); -void Play_SetRespawnData(GameState* gameState, s32 respawnNumber, u16 sceneSetup, s32 roomIndex, s32 playerParams, Vec3f* pos, s16 yaw); -void Play_SetupRespawnPoint(GameState* gameState, s32 respawnNumber, s32 playerParams); -void func_80169EFC(GameState* gameState); -void func_80169F78(GameState* gameState); -void func_80169FDC(GameState* gameState); -s32 func_80169FFC(GameState* gameState); -s32 FrameAdvance_IsEnabled(GameState* gameState); -s32 func_8016A02C(GameState* gameState, Actor* actor, s16* yaw); -s32 Play_IsUnderwater(PlayState* play, Vec3f* pos); +void Play_SaveCycleSceneFlags(GameState* thisx); +void Play_SetRespawnData(GameState* thisx, s32 respawnMode, u16 entrance, s32 roomIndex, s32 playerParams, Vec3f* pos, s16 yaw); +void Play_SetupRespawnPoint(GameState* thisx, s32 respawnMode, s32 playerParams); +void func_80169EFC(GameState* thisx); +void func_80169F78(GameState* thisx); +void func_80169FDC(GameState* thisx); +s32 func_80169FFC(GameState* thisx); +s32 FrameAdvance_IsEnabled(GameState* thisx); +s32 func_8016A02C(GameState* thisx, Actor* actor, s16* yaw); +s32 Play_IsUnderwater(PlayState* this, Vec3f* pos); s32 Play_IsDebugCamEnabled(void); -void Play_AssignPlayerActorCsIdsFromScene(GameState* gameState, s32 cutscene); +void Play_AssignPlayerActorCsIdsFromScene(GameState* thisx, s32 startActorCsId); void func_8016A268(GameState* gameState, s16 arg1, u8 arg2, u8 arg3, u8 arg4, u8 arg5); void Play_Init(GameState* gameState); // void func_8016AC10(UNK_TYPE1 param_1, UNK_TYPE1 param_2, UNK_TYPE1 param_3, UNK_TYPE1 param_4, UNK_TYPE4 param_5, UNK_TYPE4 param_6, UNK_TYPE4 param_7, UNK_TYPE4 param_8, UNK_TYPE4 param_9, UNK_TYPE4 param_10); @@ -2589,7 +2588,7 @@ void Game_Update(GameState* gameState); void Game_IncrementFrameCount(GameState* gameState); void GameState_InitArena(GameState* gameState, size_t size); void GameState_Realloc(GameState* gameState, size_t size); -void GameState_Init(GameState* gameState, GameStateFunc gameStateInit, GraphicsContext* gfxCtx); +void GameState_Init(GameState* gameState, GameStateFunc init, GraphicsContext* gfxCtx); void GameState_Destroy(GameState* gameState); GameStateFunc GameState_GetInit(GameState* gameState); size_t GameState_GetSize(GameState* gameState); @@ -2806,9 +2805,9 @@ s32 Math3D_YZInSphere(Sphere16* sphere, f32 y, f32 z); // void func_8017FB1C(UNK_TYPE1 param_1, UNK_TYPE1 param_2, UNK_TYPE1 param_3, UNK_TYPE1 param_4, UNK_TYPE4 param_5, UNK_TYPE4 param_6, UNK_TYPE4 param_7, UNK_TYPE4 param_8, UNK_TYPE4 param_9, UNK_TYPE4 param_10, UNK_TYPE4 param_11); // void func_8017FD44(void); -u16 Math_GetAtan2Tbl(f32 opposite, f32 adjacent); -s16 Math_Atan2S(f32 opposite, f32 adjacent); -f32 Math_Atan2F(f32 opposite, f32 adjacent); +u16 Math_GetAtan2Tbl(f32 y, f32 x); +s16 Math_Atan2S(f32 y, f32 x); +f32 Math_Atan2F(f32 y, f32 x); s16 Math_FAtan2F(f32 adjacent, f32 opposite); f32 Math_Acot2F(f32 adjacent, f32 opposite); @@ -2843,9 +2842,7 @@ void func_801835EC(UNK_PTR arg0, UNK_PTR arg1); // void func_80183B68(void); s32 func_80183DE0(SkeletonInfo* skeletonInfo); // void func_8018410C(UNK_TYPE1 param_1, UNK_TYPE1 param_2, UNK_TYPE1 param_3, UNK_TYPE1 param_4, UNK_TYPE4 param_5, UNK_TYPE4 param_6, UNK_TYPE4 param_7); -void func_8018450C(PlayState* play, SkeletonInfo* skeleton, Mtx* mtx, - OverrideKeyframeDrawScaled overrideKeyframeDraw, PostKeyframeDrawScaled postKeyframeDraw, - Actor* actor); +void func_8018450C(PlayState* play, SkeletonInfo* skeleton, Mtx* mtx, OverrideKeyframeDrawScaled overrideKeyframeDraw, PostKeyframeDrawScaled postKeyframeDraw, Actor* actor); // void func_801845A4(void); // void func_801845C8(UNK_TYPE1 param_1, UNK_TYPE1 param_2, UNK_TYPE1 param_3, UNK_TYPE1 param_4, UNK_TYPE4 param_5); // void func_80184638(void); @@ -2897,7 +2894,7 @@ s32 osFlashWriteBuffer(OSIoMesg* mb, s32 priority, void* dramAddr, OSMesgQueue* s32 osFlashWriteArray(u32 pageNum); s32 osFlashReadArray(OSIoMesg* mb, s32 priority, u32 pageNum, void* dramAddr, u32 pageCount, OSMesgQueue* mq); -Acmd* AudioSynth_Update(Acmd* cmdStart, s32* numAbiCmds, s16* aiStart, s32 aiBufLen); +Acmd* AudioSynth_Update(Acmd* abiCmdStart, s32* numAbiCmds, s16* aiBufStart, s32 numSamplesPerFrame); void AudioHeap_DiscardFont(s32 fontId); void* AudioHeap_WritebackDCache(void* addr, size_t size); @@ -2917,15 +2914,15 @@ void* AudioHeap_SearchPermanentCache(s32 tableType, s32 id); void* AudioHeap_AllocPermanent(s32 tableType, s32 id, size_t size); void* AudioHeap_AllocSampleCache(size_t size, s32 sampleBankId, void* sampleAddr, s8 medium, s32 cache); void AudioHeap_ApplySampleBankCache(s32 sampleBankId); -void AudioHeap_SetReverbData(s32 reverbIndex, u32 dataType, s32 data, s32 flags); +void AudioHeap_SetReverbData(s32 reverbIndex, u32 dataType, s32 data, s32 isFirstInit); void AudioLoad_DecreaseSampleDmaTtls(void); void* AudioLoad_DmaSampleData(uintptr_t devAddr, size_t size, s32 arg2, u8* dmaIndexRef, s32 medium); void AudioLoad_InitSampleDmaBuffers(s32 numNotes); s32 AudioLoad_IsFontLoadComplete(s32 fontId); s32 AudioLoad_IsSeqLoadComplete(s32 seqId); -void AudioLoad_SetFontLoadStatus(s32 fontId, s32 status); -void AudioLoad_SetSeqLoadStatus(s32 seqId, s32 status); +void AudioLoad_SetFontLoadStatus(s32 fontId, s32 loadStatus); +void AudioLoad_SetSeqLoadStatus(s32 seqId, s32 loadStatus); void AudioLoad_SyncLoadSeqParts(s32 seqId, s32 arg1, s32 arg2, OSMesgQueue* arg3); s32 AudioLoad_SyncLoadInstrument(s32 fontId, s32 instId, s32 drumId); void AudioLoad_AsyncLoadSeq(s32 seqId, s32 arg1, s32 retData, OSMesgQueue* retQueue); @@ -2933,7 +2930,7 @@ void AudioLoad_AsyncLoadSampleBank(s32 sampleBankId, s32 arg1, s32 retData, OSMe void AudioLoad_AsyncLoadFont(s32 fontId, s32 arg1, s32 retData, OSMesgQueue* retQueue); u8* AudioLoad_GetFontsForSequence(s32 seqId, u32* outNumFonts); void AudioLoad_DiscardSeqFonts(s32 seqId); -void func_8018FA60(u32 tableType, u32 id, s32 arg2, s32 arg3); +void func_8018FA60(u32 tableType, u32 id, s32 type, s32 data); s32 AudioLoad_SyncInitSeqPlayer(s32 playerIndex, s32 seqId, s32 arg2); s32 AudioLoad_SyncInitSeqPlayerSkipTicks(s32 playerIndex, s32 seqId, s32 skipTicks); void AudioLoad_ProcessLoads(s32 resetStatus); @@ -3035,7 +3032,7 @@ void AudioOcarina_StartWithSongNoteLengths(u32 ocarinaFlags); void AudioOcarina_StartDefault(u32 ocarinaFlags); u8 func_8019B5AC(void); void AudioOcarina_ResetAndReadInput(void); -void AudioOcarina_SetOcarinaDisableTimer(u8 resetUnused, u8 resetDelay); +void AudioOcarina_SetOcarinaDisableTimer(u8 unused, u8 timer); u32 AudioOcarina_SetInstrument(u8 ocarinaInstrumentId); void AudioOcarina_SetPlaybackSong(s8 songIndexPlusOne, u8 playbackState); void AudioOcarina_SetRecordingState(u8 recordingState); @@ -3129,7 +3126,7 @@ void Audio_RestorePrevBgm(void); void Audio_PlayFanfare(u16 seqId); // void func_801A312C(void); void func_801A31EC(u16 seqId, s8 arg1, u8 arg2); -void Audio_PlaySequenceWithSeqPlayerIO(s8 playerIndex, u16 seqId, u8 fadeTimer, s8 ioPort, u8 ioData); +void Audio_PlaySequenceWithSeqPlayerIO(s8 playerIndex, u16 seqId, u8 fadeInDuration, s8 ioPort, u8 ioData); void Audio_SetSequenceMode(u8 seqMode); void Audio_UpdateEnemyBgmVolume(f32 dist); u8 func_801A3950(s32 playerIndex, s32 isChannelIOSet); diff --git a/include/gfxprint.h b/include/gfxprint.h index e643b0504..b652cc132 100644 --- a/include/gfxprint.h +++ b/include/gfxprint.h @@ -29,21 +29,21 @@ typedef struct GfxPrint { /* 0x14 */ UNK_TYPE1 unk_14[0x1C]; // unused } GfxPrint; // size = 0x30 -void GfxPrint_Setup(GfxPrint* printer); -void GfxPrint_SetColor(GfxPrint* printer, u32 r, u32 g, u32 b, u32 a); -void GfxPrint_SetPosPx(GfxPrint* printer, s32 x, s32 y); -void GfxPrint_SetPos(GfxPrint* printer, s32 x, s32 y); -void GfxPrint_SetBasePosPx(GfxPrint* printer, s32 x, s32 y); -void GfxPrint_PrintCharImpl(GfxPrint* printer, u8 c); -void GfxPrint_PrintChar(GfxPrint* printer, u8 c); -void GfxPrint_PrintStringWithSize(GfxPrint* printer, const void* buffer, size_t charSize, size_t charCount); -void GfxPrint_PrintString(GfxPrint* printer, const char* str); +void GfxPrint_Setup(GfxPrint* this); +void GfxPrint_SetColor(GfxPrint* this, u32 r, u32 g, u32 b, u32 a); +void GfxPrint_SetPosPx(GfxPrint* this, s32 x, s32 y); +void GfxPrint_SetPos(GfxPrint* this, s32 x, s32 y); +void GfxPrint_SetBasePosPx(GfxPrint* this, s32 x, s32 y); +void GfxPrint_PrintCharImpl(GfxPrint* this, u8 c); +void GfxPrint_PrintChar(GfxPrint* this, u8 c); +void GfxPrint_PrintStringWithSize(GfxPrint* this, const void* buffer, size_t charSize, size_t charCount); +void GfxPrint_PrintString(GfxPrint* this, const char* str); void* GfxPrint_Callback(void* arg, const char* str, size_t size); -void GfxPrint_Init(GfxPrint* printer); +void GfxPrint_Init(GfxPrint* this); void GfxPrint_Destroy(GfxPrint* printer); -void GfxPrint_Open(GfxPrint* printer, Gfx* dList); -Gfx* GfxPrint_Close(GfxPrint* printer); -s32 GfxPrint_VPrintf(GfxPrint* printer, const char* fmt, va_list args); -s32 GfxPrint_Printf(GfxPrint* printer, const char* fmt, ...); +void GfxPrint_Open(GfxPrint* this, Gfx* dList); +Gfx* GfxPrint_Close(GfxPrint* this); +s32 GfxPrint_VPrintf(GfxPrint* this, const char* fmt, va_list args); +s32 GfxPrint_Printf(GfxPrint* this, const char* fmt, ...); #endif diff --git a/include/os_malloc.h b/include/os_malloc.h index 6b1cceab5..6f6bbf900 100644 --- a/include/os_malloc.h +++ b/include/os_malloc.h @@ -29,7 +29,7 @@ void* __osMalloc(Arena* arena, size_t size); void* __osMallocR(Arena* arena, size_t size); void __osFree(Arena* arena, void* ptr); void* __osRealloc(Arena* arena, void* ptr, size_t newSize); -void __osGetSizes(Arena* arena, size_t* maxFreeBlock, size_t* bytesFree, size_t* bytesAllocated); +void __osGetSizes(Arena* arena, size_t* outMaxFree, size_t* outFree, size_t* outAlloc); s32 __osCheckArena(Arena* arena); #endif diff --git a/include/sys_matrix.h b/include/sys_matrix.h index 536322624..a471e4dde 100644 --- a/include/sys_matrix.h +++ b/include/sys_matrix.h @@ -29,7 +29,7 @@ MtxF* Matrix_GetCurrent(void); /* Basic operations */ -void Matrix_Mult(MtxF* matrix, MatrixMode mode); +void Matrix_Mult(MtxF* mf, MatrixMode mode); void Matrix_Translate(f32 x, f32 y, f32 z, MatrixMode mode); void Matrix_Scale(f32 x, f32 y, f32 z, MatrixMode mode); void Matrix_RotateXS(s16 x, MatrixMode mode); diff --git a/include/z64quake.h b/include/z64quake.h index 468f56793..a1272941d 100644 --- a/include/z64quake.h +++ b/include/z64quake.h @@ -42,7 +42,7 @@ u32 Quake_SetQuakeValues(s16 quakeIndex, s16 verticalMag, s16 horizontalMag, s16 u32 Quake_SetQuakeValues2(s16 quakeIndex, s16 isShakePerpendicular, Vec3s shakePlaneOffset); s16 Quake_Add(Camera* camera, u32 type); s16 Quake_Calc(Camera* camera, QuakeCamCalc* camData); -u32 Quake_Remove(s16 quakeIndex); +u32 Quake_Remove(s16 index); s32 Quake_NumActiveQuakes(void); void Quake_Init(void); diff --git a/include/z64save.h b/include/z64save.h index c35747972..436e410e6 100644 --- a/include/z64save.h +++ b/include/z64save.h @@ -480,9 +480,9 @@ void func_80144A94(SramContext* sramCtx); void Sram_OpenSave(struct FileSelectState* fileSelect, SramContext* sramCtx); void func_8014546C(SramContext* sramCtx); void func_801457CC(struct FileSelectState* fileSelect, SramContext* sramCtx); -void func_80146580(struct FileSelectState* fileSelect, SramContext* sramCtx, s32 fileNum); -void func_80146628(struct FileSelectState* fileSelect, SramContext* sramCtx); -void Sram_InitSave(struct FileSelectState* fileSelect, SramContext* sramCtx); +void func_80146580(struct FileSelectState* fileSelect2, SramContext* sramCtx, s32 fileNum); +void func_80146628(struct FileSelectState* fileSelect2, SramContext* sramCtx); +void Sram_InitSave(struct FileSelectState* fileSelect2, SramContext* sramCtx); void func_80146DF8(SramContext* sramCtx); void Sram_InitSram(struct GameState* gameState, SramContext* sramCtx); void Sram_Alloc(struct GameState* gameState, SramContext* sramCtx); diff --git a/include/z64subs.h b/include/z64subs.h index 9f0b5fea3..ca90cb232 100644 --- a/include/z64subs.h +++ b/include/z64subs.h @@ -100,7 +100,7 @@ void SubS_TimePathing_ComputeTargetPosXZ(f32* x, f32* z, f32 progress, s32 order s32 SubS_TimePathing_Update(Path* path, f32* progress, s32* elapsedTime, s32 waypointTime, s32 totalTime, s32* waypoint, f32 knots[], Vec3f* targetPos, s32 timeSpeed); void SubS_TimePathing_ComputeInitialY(struct PlayState* play, Path* path, s32 waypoint, Vec3f* targetPos); -Path* SubS_GetAdditionalPath(struct PlayState* play, u8 pathIndex, s32 max); +Path* SubS_GetAdditionalPath(struct PlayState* play, u8 pathIndex, s32 limit); Actor* SubS_FindNearestActor(Actor* actor, struct PlayState* play, u8 actorCategory, s16 actorId); @@ -122,7 +122,7 @@ void SubS_GenShadowTex(Vec3f bodyPartsPos[], Vec3f* worldPos, u8* tex, f32 tween void SubS_DrawShadowTex(Actor* actor, struct GameState* gameState, u8* tex); s16 SubS_ComputeTrackPointRot(s16* rot, s16 rotMax, s16 target, f32 slowness, f32 stepMin, f32 stepMax); -s32 SubS_TrackPoint(Vec3f* point, Vec3f* focusPos, Vec3s* shapeRot, Vec3s* trackTarget, Vec3s* headRot, Vec3s* torsoRot, TrackOptionsSet* options); +s32 SubS_TrackPoint(Vec3f* target, Vec3f* focusPos, Vec3s* shapeRot, Vec3s* trackTarget, Vec3s* headRot, Vec3s* torsoRot, TrackOptionsSet* options); s32 SubS_AngleDiffLessEqual(s16 angleA, s16 threshold, s16 angleB); @@ -130,7 +130,7 @@ Path* SubS_GetPathByIndex(struct PlayState* play, s16 pathIndex, s16 max); s32 SubS_CopyPointFromPath(Path* path, s32 pointIndex, Vec3f* dst); s16 SubS_GetDistSqAndOrientPoints(Vec3f* vecA, Vec3f* vecB, f32* distSq); s32 SubS_MoveActorToPoint(Actor* actor, Vec3f* point, s16 rotStep); -s16 SubS_GetDistSqAndOrientPath(Path* path, s32 pointIdx, Vec3f* pos, f32* distSq); +s16 SubS_GetDistSqAndOrientPath(Path* path, s32 pointIndex, Vec3f* pos, f32* distSq); s8 SubS_IsObjectLoaded(s8 index, struct PlayState* play); s8 SubS_GetObjectIndex(s16 id, struct PlayState* play); diff --git a/include/z_en_hy_code.h b/include/z_en_hy_code.h index d272522c9..0620d35a0 100644 --- a/include/z_en_hy_code.h +++ b/include/z_en_hy_code.h @@ -79,7 +79,7 @@ s32 EnHy_ChangeAnim(SkelAnime* skelAnime, s16 animIndex); EnDoor* EnHy_FindNearestDoor(Actor* actor, PlayState* play); void EnHy_ChangeObjectAndAnim(EnHy* enHy, PlayState* play, s16 animIndex); s32 EnHy_UpdateSkelAnime(EnHy* enHy, PlayState* play); -void EnHy_Blink(EnHy* enHy, s32 arg1); +void EnHy_Blink(EnHy* enHy, s32 eyeTexMaxIndex); s32 EnHy_Init(EnHy* enHy, PlayState* play, FlexSkeletonHeader* skeletonHeaderSeg, s16 animIndex); void func_800F0BB4(EnHy* enHy, PlayState* play, EnDoor* door, s16 arg3, s16 arg4); s32 func_800F0CE4(EnHy* enHy, PlayState* play, ActorFunc draw, s16 arg3, s16 arg4, f32 arg5); diff --git a/include/z_title_setup.h b/include/z_title_setup.h index 685b87c79..41e3f52f8 100644 --- a/include/z_title_setup.h +++ b/include/z_title_setup.h @@ -4,7 +4,7 @@ #include "global.h" void Setup_Destroy(GameState* gameState); -void Setup_Init(GameState* gameState); +void Setup_Init(GameState* thisx); typedef struct { /* 0x00 */ GameState state; diff --git a/src/boot_O2_g3/irqmgr.c b/src/boot_O2_g3/irqmgr.c index f605dc327..b100f209d 100644 --- a/src/boot_O2_g3/irqmgr.c +++ b/src/boot_O2_g3/irqmgr.c @@ -5,22 +5,22 @@ volatile OSTime sIrqMgrResetTime = 0; volatile OSTime sIrqMgrRetraceTime = 0; s32 sIrqMgrRetraceCount = 0; -void IrqMgr_AddClient(IrqMgr* irqmgr, IrqMgrClient* param_2, OSMesgQueue* param_3) { +void IrqMgr_AddClient(IrqMgr* irqmgr, IrqMgrClient* client, OSMesgQueue* msgQueue) { u32 saveMask; saveMask = osSetIntMask(1); - param_2->queue = param_3; - param_2->next = irqmgr->callbacks; - irqmgr->callbacks = param_2; + client->queue = msgQueue; + client->next = irqmgr->callbacks; + irqmgr->callbacks = client; osSetIntMask(saveMask); if (irqmgr->prenmiStage > 0) { - osSendMesg(param_2->queue, &irqmgr->prenmiMsg.type, OS_MESG_NOBLOCK); + osSendMesg(client->queue, &irqmgr->prenmiMsg.type, OS_MESG_NOBLOCK); } if (irqmgr->prenmiStage > 1) { - osSendMesg(param_2->queue, &irqmgr->nmiMsg.type, OS_MESG_NOBLOCK); + osSendMesg(client->queue, &irqmgr->nmiMsg.type, OS_MESG_NOBLOCK); } } diff --git a/src/code/audio/audio_load.c b/src/code/audio/audio_load.c index ccdc7488d..c9b5ad30b 100644 --- a/src/code/audio/audio_load.c +++ b/src/code/audio/audio_load.c @@ -37,7 +37,7 @@ void* AudioLoad_SyncLoad(s32 tableType, u32 id, s32* didAllocate); u32 AudioLoad_GetRealTableIndex(s32 tableType, u32 id); void* AudioLoad_SearchCaches(s32 tableType, s32 id); AudioTable* AudioLoad_GetLoadTable(s32 tableType); -void AudioLoad_SyncDma(uintptr_t devAddr, u8* addr, size_t size, s32 medium); +void AudioLoad_SyncDma(uintptr_t devAddr, u8* ramAddr, size_t size, s32 medium); void AudioLoad_SyncDmaUnkMedium(uintptr_t devAddr, u8* addr, size_t size, s32 unkMediumParam); s32 AudioLoad_Dma(OSIoMesg* mesg, u32 priority, s32 direction, uintptr_t devAddr, void* ramAddr, size_t size, OSMesgQueue* reqQueue, s32 medium, const char* dmaFuncType); diff --git a/src/code/audio/audio_synthesis.c b/src/code/audio/audio_synthesis.c index 17b3ff4be..d3b25f446 100644 --- a/src/code/audio/audio_synthesis.c +++ b/src/code/audio/audio_synthesis.c @@ -21,14 +21,14 @@ typedef enum { /* 2 */ HAAS_EFFECT_DELAY_RIGHT // Delay right channel so that left channel is heard first } HaasEffectDelaySide; -Acmd* AudioSynth_SaveResampledReverbSamplesImpl(Acmd* cmd, u16 dmem, u16 arg2, uintptr_t arg3); +Acmd* AudioSynth_SaveResampledReverbSamplesImpl(Acmd* cmd, u16 dmem, u16 size, uintptr_t startAddr); Acmd* AudioSynth_LoadReverbSamplesImpl(Acmd* cmd, u16 dmem, u16 startPos, s32 size, SynthesisReverb* reverb); Acmd* AudioSynth_SaveReverbSamplesImpl(Acmd* cmd, u16 dmem, u16 startPos, s32 size, SynthesisReverb* reverb); Acmd* AudioSynth_ProcessSamples(s16* aiBuf, s32 numSamplesPerUpdate, Acmd* cmd, s32 updateIndex); Acmd* AudioSynth_ProcessSample(s32 noteIndex, NoteSampleState* sampleState, NoteSynthesisState* synthState, s16* aiBuf, s32 numSamplesPerUpdate, Acmd* cmd, s32 updateIndex); -Acmd* AudioSynth_ApplySurroundEffect(Acmd* cmd, NoteSampleState* sampleState, NoteSynthesisState* synthState, s32 size, - s32 dmem, s32 flags); +Acmd* AudioSynth_ApplySurroundEffect(Acmd* cmd, NoteSampleState* sampleState, NoteSynthesisState* synthState, + s32 numSamplesPerUpdate, s32 haasDmem, s32 flags); Acmd* AudioSynth_FinalResample(Acmd* cmd, NoteSynthesisState* synthState, s32 size, u16 pitch, u16 inpDmem, s32 resampleFlags); Acmd* AudioSynth_ProcessEnvelope(Acmd* cmd, NoteSampleState* sampleState, NoteSynthesisState* synthState, diff --git a/src/code/audio/code_8019AF00.c b/src/code/audio/code_8019AF00.c index 98be41397..6d1468d82 100644 --- a/src/code/audio/code_8019AF00.c +++ b/src/code/audio/code_8019AF00.c @@ -70,7 +70,7 @@ s32 Audio_SetGanonsTowerBgmVolume(u8 targetVolume); void Audio_StartMorningSceneSequence(u16 seqId); void Audio_StartSceneSequence(u16 seqId); -void Audio_PlaySequenceWithSeqPlayerIO(s8 playerIndex, u16 seqId, u8 fadeTimer, s8 arg3, u8 arg4); +void Audio_PlaySequenceWithSeqPlayerIO(s8 playerIndex, u16 seqId, u8 fadeInDuration, s8 ioPort, u8 ioData); void func_801A4428(u8 reverbIndex); void func_801A3038(void); void Audio_PlayAmbience(u8 ambienceId); diff --git a/src/code/z_en_item00.c b/src/code/z_en_item00.c index 437728f0e..d6ab737c7 100644 --- a/src/code/z_en_item00.c +++ b/src/code/z_en_item00.c @@ -843,10 +843,10 @@ void EnItem00_DrawSprite(EnItem00* this, PlayState* play) { CLOSE_DISPS(play->state.gfxCtx); } -void EnItem00_DrawHeartContainer(EnItem00* actor, PlayState* play) { +void EnItem00_DrawHeartContainer(EnItem00* this, PlayState* play) { s32 pad[2]; - if (Object_GetIndex(&play->objectCtx, OBJECT_GI_HEARTS) == actor->actor.objBankIndex) { + if (Object_GetIndex(&play->objectCtx, OBJECT_GI_HEARTS) == this->actor.objBankIndex) { OPEN_DISPS(play->state.gfxCtx); func_8012C2DC(play->state.gfxCtx); diff --git a/src/code/z_scene_proc.c b/src/code/z_scene_proc.c index 8ddde8a82..4de83bcaa 100644 --- a/src/code/z_scene_proc.c +++ b/src/code/z_scene_proc.c @@ -459,8 +459,8 @@ void AnimatedMat_DrawStep(PlayState* play, AnimatedMaterial* matAnim, u32 step) /** * Draws an animated material with a step to only the OPA buffer. */ -void AnimatedMat_DrawStepOpa(PlayState* play, AnimatedMaterial* textures, u32 step) { - AnimatedMat_DrawMain(play, textures, 1, step, 1); +void AnimatedMat_DrawStepOpa(PlayState* play, AnimatedMaterial* matAnim, u32 step) { + AnimatedMat_DrawMain(play, matAnim, 1, step, 1); } /** diff --git a/src/code/z_skelanime.c b/src/code/z_skelanime.c index 8321a309e..088f1469f 100644 --- a/src/code/z_skelanime.c +++ b/src/code/z_skelanime.c @@ -8,9 +8,9 @@ s32 SkelAnime_LoopFull(SkelAnime* skelAnime); s32 SkelAnime_LoopPartial(SkelAnime* skelAnime); s32 SkelAnime_Once(SkelAnime* skelAnime); void Animation_PlayLoop(SkelAnime* skelAnime, AnimationHeader* animation); -void SkelAnime_UpdateTranslation(SkelAnime* skelAnime, Vec3f* pos, s16 angle); +void SkelAnime_UpdateTranslation(SkelAnime* skelAnime, Vec3f* diff, s16 angle); void LinkAnimation_Change(PlayState* play, SkelAnime* skelAnime, LinkAnimationHeader* animation, f32 playSpeed, - f32 frame, f32 frameCount, u8 animationMode, f32 morphFrames); + f32 startFrame, f32 endFrame, u8 mode, f32 morphFrames); void SkelAnime_CopyFrameTable(SkelAnime* skelAnime, Vec3s* dst, Vec3s* src); static AnimationEntryCallback sAnimationLoadDone[] = { diff --git a/src/libultra/flash/osFlash.c b/src/libultra/flash/osFlash.c index edba06fc2..cd4420c4a 100644 --- a/src/libultra/flash/osFlash.c +++ b/src/libultra/flash/osFlash.c @@ -32,9 +32,9 @@ OSPiHandle* osFlashReInit(u8 latency, u8 pulse, u8 pageSize, u8 relDuration, u32 return &__osFlashHandler; } -void osFlashChange(u32 flash_num) { - __osFlashHandler.baseAddress = RDRAM_UNCACHED | (FRAM_STATUS_REGISTER + (flash_num << 17)); - __osFlashHandler.type = 8 + flash_num; +void osFlashChange(u32 flashNum) { + __osFlashHandler.baseAddress = RDRAM_UNCACHED | (FRAM_STATUS_REGISTER + (flashNum << 17)); + __osFlashHandler.type = 8 + flashNum; return; } diff --git a/src/overlays/actors/ovl_Bg_Dblue_Movebg/z_bg_dblue_movebg.c b/src/overlays/actors/ovl_Bg_Dblue_Movebg/z_bg_dblue_movebg.c index 8e0c025e2..44e38f0da 100644 --- a/src/overlays/actors/ovl_Bg_Dblue_Movebg/z_bg_dblue_movebg.c +++ b/src/overlays/actors/ovl_Bg_Dblue_Movebg/z_bg_dblue_movebg.c @@ -16,7 +16,7 @@ void BgDblueMovebg_Init(Actor* thisx, PlayState* play); void BgDblueMovebg_Destroy(Actor* thisx, PlayState* play); void BgDblueMovebg_Update(Actor* thisx, PlayState* play); -void BgDblueMovebg_Draw(Actor* thisx, PlayState* play); +void BgDblueMovebg_Draw(Actor* thisx, PlayState* play2); void func_80A2A1E0(BgDblueMovebg* this, PlayState* play); void func_80A2A32C(BgDblueMovebg* this, PlayState* play); diff --git a/src/overlays/actors/ovl_Bg_Ikana_Dharma/z_bg_ikana_dharma.c b/src/overlays/actors/ovl_Bg_Ikana_Dharma/z_bg_ikana_dharma.c index 4f1434dc2..6c5e85e73 100644 --- a/src/overlays/actors/ovl_Bg_Ikana_Dharma/z_bg_ikana_dharma.c +++ b/src/overlays/actors/ovl_Bg_Ikana_Dharma/z_bg_ikana_dharma.c @@ -12,7 +12,7 @@ #define THIS ((BgIkanaDharma*)thisx) -void BgIkanaDharma_Init(Actor* thisx, PlayState* play); +void BgIkanaDharma_Init(Actor* thisx, PlayState* play2); void BgIkanaDharma_Destroy(Actor* thisx, PlayState* play); void BgIkanaDharma_Update(Actor* thisx, PlayState* play); void BgIkanaDharma_Draw(Actor* thisx, PlayState* play); diff --git a/src/overlays/actors/ovl_Bg_Ikana_Mirror/z_bg_ikana_mirror.c b/src/overlays/actors/ovl_Bg_Ikana_Mirror/z_bg_ikana_mirror.c index cfa67eb1d..11734b284 100644 --- a/src/overlays/actors/ovl_Bg_Ikana_Mirror/z_bg_ikana_mirror.c +++ b/src/overlays/actors/ovl_Bg_Ikana_Mirror/z_bg_ikana_mirror.c @@ -16,7 +16,7 @@ #define THIS ((BgIkanaMirror*)thisx) -void BgIkanaMirror_Init(Actor* thisx, PlayState* play); +void BgIkanaMirror_Init(Actor* thisx, PlayState* play2); void BgIkanaMirror_Destroy(Actor* thisx, PlayState* play); void BgIkanaMirror_Update(Actor* thisx, PlayState* play); void BgIkanaMirror_Draw(Actor* thisx, PlayState* play); diff --git a/src/overlays/actors/ovl_Bg_Ingate/z_bg_ingate.c b/src/overlays/actors/ovl_Bg_Ingate/z_bg_ingate.c index 9091948ae..95ca8936e 100644 --- a/src/overlays/actors/ovl_Bg_Ingate/z_bg_ingate.c +++ b/src/overlays/actors/ovl_Bg_Ingate/z_bg_ingate.c @@ -11,7 +11,7 @@ #define THIS ((BgIngate*)thisx) -void BgIngate_Init(Actor* thisx, PlayState* play); +void BgIngate_Init(Actor* thisx, PlayState* play2); void BgIngate_Destroy(Actor* thisx, PlayState* play); void BgIngate_Update(Actor* thisx, PlayState* play); void BgIngate_Draw(Actor* thisx, PlayState* play); diff --git a/src/overlays/actors/ovl_Bg_Last_Bwall/z_bg_last_bwall.c b/src/overlays/actors/ovl_Bg_Last_Bwall/z_bg_last_bwall.c index 2b4c24381..85272fa51 100644 --- a/src/overlays/actors/ovl_Bg_Last_Bwall/z_bg_last_bwall.c +++ b/src/overlays/actors/ovl_Bg_Last_Bwall/z_bg_last_bwall.c @@ -25,7 +25,7 @@ typedef struct { void BgLastBwall_Init(Actor* thisx, PlayState* play); void BgLastBwall_Destroy(Actor* thisx, PlayState* play); void BgLastBwall_Update(Actor* thisx, PlayState* play); -void BgLastBwall_Draw(Actor* thisx, PlayState* play); +void BgLastBwall_Draw(Actor* thisx, PlayState* play2); void BgLastBwall_InitCollider(ColliderTrisInit* init, Vec3f* pos, Vec3s* rot, ColliderTris* collider, BgLastBwallInitColliderStruct* arg4); diff --git a/src/overlays/actors/ovl_Bg_Numa_Hana/z_bg_numa_hana.c b/src/overlays/actors/ovl_Bg_Numa_Hana/z_bg_numa_hana.c index 4c0c109ea..8554e2b5a 100644 --- a/src/overlays/actors/ovl_Bg_Numa_Hana/z_bg_numa_hana.c +++ b/src/overlays/actors/ovl_Bg_Numa_Hana/z_bg_numa_hana.c @@ -15,7 +15,7 @@ void BgNumaHana_Init(Actor* thisx, PlayState* play); void BgNumaHana_Destroy(Actor* thisx, PlayState* play); void BgNumaHana_Update(Actor* thisx, PlayState* play); -void BgNumaHana_Draw(Actor* thisx, PlayState* play); +void BgNumaHana_Draw(Actor* thisx, PlayState* play2); void BgNumaHana_SetupDoNothing(BgNumaHana* this); void BgNumaHana_DoNothing(BgNumaHana* this, PlayState* play); diff --git a/src/overlays/actors/ovl_Bg_Open_Shutter/z_bg_open_shutter.c b/src/overlays/actors/ovl_Bg_Open_Shutter/z_bg_open_shutter.c index 22cf4968f..6504ec00e 100644 --- a/src/overlays/actors/ovl_Bg_Open_Shutter/z_bg_open_shutter.c +++ b/src/overlays/actors/ovl_Bg_Open_Shutter/z_bg_open_shutter.c @@ -15,7 +15,7 @@ void BgOpenShutter_Init(Actor* thisx, PlayState* play); void BgOpenShutter_Destroy(Actor* thisx, PlayState* play); -void BgOpenShutter_Update(Actor* thisx, PlayState* play); +void BgOpenShutter_Update(Actor* thisx, PlayState* play2); void BgOpenShutter_Draw(Actor* thisx, PlayState* play); void func_80ACAD88(BgOpenShutter* this, PlayState* play); diff --git a/src/overlays/actors/ovl_Boss_02/z_boss_02.c b/src/overlays/actors/ovl_Boss_02/z_boss_02.c index b3ab79b20..0d0e55e62 100644 --- a/src/overlays/actors/ovl_Boss_02/z_boss_02.c +++ b/src/overlays/actors/ovl_Boss_02/z_boss_02.c @@ -18,7 +18,7 @@ void Boss02_Init(Actor* thisx, PlayState* play); void Boss02_Destroy(Actor* thisx, PlayState* play); void Boss02_Twinmold_Update(Actor* thisx, PlayState* play); -void Boss02_Twinmold_Draw(Actor* thisx, PlayState* play); +void Boss02_Twinmold_Draw(Actor* thisx, PlayState* play2); void func_809DAA74(Boss02* this, PlayState* play); void func_809DAA98(Boss02* this, PlayState* play); diff --git a/src/overlays/actors/ovl_Boss_03/z_boss_03.c b/src/overlays/actors/ovl_Boss_03/z_boss_03.c index 1c14d63bb..870bc53a1 100644 --- a/src/overlays/actors/ovl_Boss_03/z_boss_03.c +++ b/src/overlays/actors/ovl_Boss_03/z_boss_03.c @@ -78,9 +78,9 @@ #define PLATFORM_HEIGHT 440.0f #define WATER_HEIGHT 430.0f -void Boss03_Init(Actor* thisx, PlayState* play); +void Boss03_Init(Actor* thisx, PlayState* play2); void Boss03_Destroy(Actor* thisx, PlayState* play); -void Boss03_Update(Actor* thisx, PlayState* play); +void Boss03_Update(Actor* thisx, PlayState* play2); void Boss03_Draw(Actor* thisx, PlayState* play); void func_809E344C(Boss03* this, PlayState* play); diff --git a/src/overlays/actors/ovl_Boss_04/z_boss_04.c b/src/overlays/actors/ovl_Boss_04/z_boss_04.c index 8eb73d84d..9a7371c97 100644 --- a/src/overlays/actors/ovl_Boss_04/z_boss_04.c +++ b/src/overlays/actors/ovl_Boss_04/z_boss_04.c @@ -11,9 +11,9 @@ #define THIS ((Boss04*)thisx) -void Boss04_Init(Actor* thisx, PlayState* play); +void Boss04_Init(Actor* thisx, PlayState* play2); void Boss04_Destroy(Actor* thisx, PlayState* play); -void Boss04_Update(Actor* thisx, PlayState* play); +void Boss04_Update(Actor* thisx, PlayState* play2); void Boss04_Draw(Actor* thisx, PlayState* play); void func_809EC544(Boss04* this); diff --git a/src/overlays/actors/ovl_Boss_06/z_boss_06.c b/src/overlays/actors/ovl_Boss_06/z_boss_06.c index 3aadce42c..1b8b6fef6 100644 --- a/src/overlays/actors/ovl_Boss_06/z_boss_06.c +++ b/src/overlays/actors/ovl_Boss_06/z_boss_06.c @@ -18,7 +18,7 @@ void Boss06_Init(Actor* thisx, PlayState* play); void Boss06_Destroy(Actor* thisx, PlayState* play); void Boss06_Update(Actor* thisx, PlayState* play); -void Boss06_Draw(Actor* thisx, PlayState* play); +void Boss06_Draw(Actor* thisx, PlayState* play2); void func_809F24A8(Boss06* this); void func_809F24C8(Boss06* this, PlayState* play); diff --git a/src/overlays/actors/ovl_Dm_An/z_dm_an.c b/src/overlays/actors/ovl_Dm_An/z_dm_an.c index 5e03eb74c..592800e9d 100644 --- a/src/overlays/actors/ovl_Dm_An/z_dm_an.c +++ b/src/overlays/actors/ovl_Dm_An/z_dm_an.c @@ -19,7 +19,7 @@ void DmAn_Update(Actor* thisx, PlayState* play); void func_80C1C958(DmAn* this, PlayState* play); void func_80C1CAB0(DmAn* this, PlayState* play); void func_80C1CC80(DmAn* this, PlayState* play); -void func_80C1D0B0(Actor* this, PlayState* play); +void func_80C1D0B0(Actor* thisx, PlayState* play); const ActorInit Dm_An_InitVars = { ACTOR_DM_AN, diff --git a/src/overlays/actors/ovl_Dm_Char00/z_dm_char00.c b/src/overlays/actors/ovl_Dm_Char00/z_dm_char00.c index 82e5157f6..a40bd1bc3 100644 --- a/src/overlays/actors/ovl_Dm_Char00/z_dm_char00.c +++ b/src/overlays/actors/ovl_Dm_Char00/z_dm_char00.c @@ -15,7 +15,7 @@ void DmChar00_Init(Actor* thisx, PlayState* play); void DmChar00_Destroy(Actor* thisx, PlayState* play); void DmChar00_Update(Actor* thisx, PlayState* play); -void DmChar00_Draw(Actor* thisx, PlayState* play); +void DmChar00_Draw(Actor* thisx, PlayState* play2); void func_80AA67F8(DmChar00* this, PlayState* play); void func_80AA695C(DmChar00* this, PlayState* play); diff --git a/src/overlays/actors/ovl_Dm_Char01/z_dm_char01.c b/src/overlays/actors/ovl_Dm_Char01/z_dm_char01.c index 2f715afed..6d3b18c2d 100644 --- a/src/overlays/actors/ovl_Dm_Char01/z_dm_char01.c +++ b/src/overlays/actors/ovl_Dm_Char01/z_dm_char01.c @@ -14,7 +14,7 @@ void DmChar01_Init(Actor* thisx, PlayState* play); void DmChar01_Destroy(Actor* thisx, PlayState* play); -void DmChar01_Update(Actor* thisx, PlayState* play); +void DmChar01_Update(Actor* thisx, PlayState* play2); void DmChar01_Draw(Actor* thisx, PlayState* play); void func_80AA8698(DmChar01* this, PlayState* play); diff --git a/src/overlays/actors/ovl_Door_Shutter/z_door_shutter.c b/src/overlays/actors/ovl_Door_Shutter/z_door_shutter.c index b2ffe1dcb..d7e9424e5 100644 --- a/src/overlays/actors/ovl_Door_Shutter/z_door_shutter.c +++ b/src/overlays/actors/ovl_Door_Shutter/z_door_shutter.c @@ -24,7 +24,7 @@ #define THIS ((DoorShutter*)thisx) -void DoorShutter_Init(Actor* thisx, PlayState* play); +void DoorShutter_Init(Actor* thisx, PlayState* play2); void DoorShutter_Destroy(Actor* thisx, PlayState* play); void DoorShutter_Update(Actor* thisx, PlayState* play); diff --git a/src/overlays/actors/ovl_Eff_Dust/z_eff_dust.c b/src/overlays/actors/ovl_Eff_Dust/z_eff_dust.c index c517ad007..e23ed1204 100644 --- a/src/overlays/actors/ovl_Eff_Dust/z_eff_dust.c +++ b/src/overlays/actors/ovl_Eff_Dust/z_eff_dust.c @@ -21,8 +21,8 @@ void func_80918D64(EffDust* this, PlayState* play); void func_80918FE4(EffDust* this, PlayState* play); void func_80919230(EffDust* this, PlayState* play); -void func_80919768(Actor* thisx, PlayState* play); -void func_809199FC(Actor* thisx, PlayState* play); +void func_80919768(Actor* thisx, PlayState* play2); +void func_809199FC(Actor* thisx, PlayState* play2); const ActorInit Eff_Dust_InitVars = { ACTOR_EFF_DUST, diff --git a/src/overlays/actors/ovl_En_Am/z_en_am.c b/src/overlays/actors/ovl_En_Am/z_en_am.c index eda01c254..858d125c0 100644 --- a/src/overlays/actors/ovl_En_Am/z_en_am.c +++ b/src/overlays/actors/ovl_En_Am/z_en_am.c @@ -35,7 +35,7 @@ void func_808B07A8(EnAm* this, PlayState* play); void func_808B0820(EnAm* this); void func_808B0894(EnAm* this, PlayState* play); void func_808B0B4C(EnAm* this, PlayState* play); -void EnAm_PostLimbDraw(PlayState* play, s32 limbIndex, Gfx** dList, Vec3s* rot, Actor* actor); +void EnAm_PostLimbDraw(PlayState* play, s32 limbIndex, Gfx** dList, Vec3s* rot, Actor* thisx); const ActorInit En_Am_InitVars = { ACTOR_EN_AM, diff --git a/src/overlays/actors/ovl_En_Az/z_en_az.c b/src/overlays/actors/ovl_En_Az/z_en_az.c index 3f35a5e35..08333482e 100644 --- a/src/overlays/actors/ovl_En_Az/z_en_az.c +++ b/src/overlays/actors/ovl_En_Az/z_en_az.c @@ -18,16 +18,16 @@ typedef struct { /* 0x4 */ f32 unk_4; } struct_80A98F94; // size = 0x8 -void EnAz_Init(Actor* thisx, PlayState* play); -void EnAz_Destroy(Actor* thisx, PlayState* play); -void EnAz_Update(Actor* thisx, PlayState* play); -void EnAz_Draw(Actor* thisx, PlayState* play); +void EnAz_Init(Actor* thisx, PlayState* play2); +void EnAz_Destroy(Actor* thisx, PlayState* play2); +void EnAz_Update(Actor* thisx, PlayState* play2); +void EnAz_Draw(Actor* thisx, PlayState* play2); void func_80A982E0(PlayState* play, ActorPathing* actorPathing); void func_80A98414(EnAz* this, PlayState* play); s32 func_80A98DA4(PlayState* play, s32 limbIndex, Gfx** dList, Vec3f* pos, Vec3s* rot, Actor* thisx); void func_80A98E48(PlayState* play, s32 limbIndex, Gfx** dList, Vec3s* rot, Actor* thisx); -void func_80A98EFC(EnAz* this, PlayState* play, u16 textId, s32 arg3, s32 arg4); +void func_80A98EFC(EnAz* this, PlayState* play, u16 textId, s32 animIndex, s32 brotherAnimIndex); void func_80A98F94(struct_80A98F94* yData, f32 frame, f32* yInterp); void func_80A95C5C(EnAz* this, PlayState* play); diff --git a/src/overlays/actors/ovl_En_Bbfall/z_en_bbfall.c b/src/overlays/actors/ovl_En_Bbfall/z_en_bbfall.c index b1e4db445..875a5a079 100644 --- a/src/overlays/actors/ovl_En_Bbfall/z_en_bbfall.c +++ b/src/overlays/actors/ovl_En_Bbfall/z_en_bbfall.c @@ -14,7 +14,7 @@ void EnBbfall_Init(Actor* thisx, PlayState* play); void EnBbfall_Destroy(Actor* thisx, PlayState* play); void EnBbfall_Update(Actor* thisx, PlayState* play); -void EnBbfall_Draw(Actor* thisx, PlayState* play); +void EnBbfall_Draw(Actor* thisx, PlayState* play2); void EnBbfall_SetupWaitForPlayer(EnBbfall* this); void EnBbfall_WaitForPlayer(EnBbfall* this, PlayState* play); diff --git a/src/overlays/actors/ovl_En_Bigpo/z_en_bigpo.c b/src/overlays/actors/ovl_En_Bigpo/z_en_bigpo.c index 62e1df422..57dae0368 100644 --- a/src/overlays/actors/ovl_En_Bigpo/z_en_bigpo.c +++ b/src/overlays/actors/ovl_En_Bigpo/z_en_bigpo.c @@ -12,8 +12,8 @@ #define THIS ((EnBigpo*)thisx) -void EnBigpo_Init(Actor* thisx, PlayState* play); -void EnBigpo_Destroy(Actor* thisx, PlayState* play); +void EnBigpo_Init(Actor* thisx, PlayState* play2); +void EnBigpo_Destroy(Actor* thisx, PlayState* play2); void EnBigpo_Update(Actor* thisx, PlayState* play); void EnBigpo_UpdateFire(Actor* thisx, PlayState* play); diff --git a/src/overlays/actors/ovl_En_Bigslime/z_en_bigslime.c b/src/overlays/actors/ovl_En_Bigslime/z_en_bigslime.c index e56997051..f65172093 100644 --- a/src/overlays/actors/ovl_En_Bigslime/z_en_bigslime.c +++ b/src/overlays/actors/ovl_En_Bigslime/z_en_bigslime.c @@ -15,7 +15,7 @@ #define THIS ((EnBigslime*)thisx) -void EnBigslime_Init(Actor* thisx, PlayState* play); +void EnBigslime_Init(Actor* thisx, PlayState* play2); void EnBigslime_Destroy(Actor* thisx, PlayState* play); void EnBigslime_UpdateGekko(Actor* thisx, PlayState* play); void EnBigslime_DrawGekko(Actor* thisx, PlayState* play); diff --git a/src/overlays/actors/ovl_En_Bombf/z_en_bombf.c b/src/overlays/actors/ovl_En_Bombf/z_en_bombf.c index 4a7ac1baf..4eb0ea456 100644 --- a/src/overlays/actors/ovl_En_Bombf/z_en_bombf.c +++ b/src/overlays/actors/ovl_En_Bombf/z_en_bombf.c @@ -12,7 +12,7 @@ #define THIS ((EnBombf*)thisx) -void EnBombf_Init(Actor* thisx, PlayState* play); +void EnBombf_Init(Actor* thisx, PlayState* play2); void EnBombf_Destroy(Actor* thisx, PlayState* play); void EnBombf_Update(Actor* thisx, PlayState* play); void EnBombf_Draw(Actor* thisx, PlayState* play); diff --git a/src/overlays/actors/ovl_En_Bomjimb/z_en_bomjimb.c b/src/overlays/actors/ovl_En_Bomjimb/z_en_bomjimb.c index 25f5de3e1..300d83958 100644 --- a/src/overlays/actors/ovl_En_Bomjimb/z_en_bomjimb.c +++ b/src/overlays/actors/ovl_En_Bomjimb/z_en_bomjimb.c @@ -14,7 +14,7 @@ void EnBomjimb_Init(Actor* thisx, PlayState* play); void EnBomjimb_Destroy(Actor* thisx, PlayState* play); -void EnBomjimb_Update(Actor* thisx, PlayState* play); +void EnBomjimb_Update(Actor* thisx, PlayState* play2); void EnBomjimb_Draw(Actor* thisx, PlayState* play); void func_80C01494(EnBomjimb* this); diff --git a/src/overlays/actors/ovl_En_Cha/z_en_cha.c b/src/overlays/actors/ovl_En_Cha/z_en_cha.c index b53f5f620..0fb85a756 100644 --- a/src/overlays/actors/ovl_En_Cha/z_en_cha.c +++ b/src/overlays/actors/ovl_En_Cha/z_en_cha.c @@ -13,7 +13,7 @@ void EnCha_Init(Actor* thisx, PlayState* play); void EnCha_Destroy(Actor* thisx, PlayState* play); -void EnCha_Update(Actor* thisx, PlayState* play); +void EnCha_Update(Actor* thisx, PlayState* play2); void EnCha_Draw(Actor* thisx, PlayState* play); void EnCha_Idle(EnCha* this, PlayState* play); diff --git a/src/overlays/actors/ovl_En_Cow/z_en_cow.c b/src/overlays/actors/ovl_En_Cow/z_en_cow.c index 902f01931..df6093690 100644 --- a/src/overlays/actors/ovl_En_Cow/z_en_cow.c +++ b/src/overlays/actors/ovl_En_Cow/z_en_cow.c @@ -12,7 +12,7 @@ void EnCow_Init(Actor* thisx, PlayState* play); void EnCow_Destroy(Actor* thisx, PlayState* play); -void EnCow_Update(Actor* thisx, PlayState* play); +void EnCow_Update(Actor* thisx, PlayState* play2); void EnCow_Draw(Actor* thisx, PlayState* play); void EnCow_TalkEnd(EnCow* this, PlayState* play); @@ -24,8 +24,8 @@ void EnCow_Talk(EnCow* this, PlayState* play); void EnCow_Idle(EnCow* this, PlayState* play); void EnCow_DoTail(EnCow* this, PlayState* play); -void EnCow_UpdateTail(Actor* this, PlayState* play); -void EnCow_DrawTail(Actor* this, PlayState* play); +void EnCow_UpdateTail(Actor* thisx, PlayState* play); +void EnCow_DrawTail(Actor* thisx, PlayState* play); const ActorInit En_Cow_InitVars = { ACTOR_EN_COW, diff --git a/src/overlays/actors/ovl_En_Dinofos/z_en_dinofos.c b/src/overlays/actors/ovl_En_Dinofos/z_en_dinofos.c index bf2f5e7ce..506e5eb47 100644 --- a/src/overlays/actors/ovl_En_Dinofos/z_en_dinofos.c +++ b/src/overlays/actors/ovl_En_Dinofos/z_en_dinofos.c @@ -13,7 +13,7 @@ void EnDinofos_Init(Actor* thisx, PlayState* play); void EnDinofos_Destroy(Actor* thisx, PlayState* play); -void EnDinofos_Update(Actor* thisx, PlayState* play); +void EnDinofos_Update(Actor* thisx, PlayState* play2); void EnDinofos_Draw(Actor* thisx, PlayState* play); void func_8089B834(EnDinofos* this, PlayState* play); diff --git a/src/overlays/actors/ovl_En_Dnb/z_en_dnb.c b/src/overlays/actors/ovl_En_Dnb/z_en_dnb.c index d663bcf74..b9bc34d99 100644 --- a/src/overlays/actors/ovl_En_Dnb/z_en_dnb.c +++ b/src/overlays/actors/ovl_En_Dnb/z_en_dnb.c @@ -19,7 +19,7 @@ void EnDnb_Draw(Actor* thisx, PlayState* play); s32 func_80A507C0(EnDnbUnkStruct* arg0, Vec3f arg1, Vec3f arg2, u8 arg3, f32 arg4, f32 arg5); s32 func_80A5086C(EnDnbUnkStruct* arg0); -s32 func_80A50950(EnDnbUnkStruct* arg0, PlayState* play); +s32 func_80A50950(EnDnbUnkStruct* arg0, PlayState* play2); const ActorInit En_Dnb_InitVars = { ACTOR_EN_DNB, diff --git a/src/overlays/actors/ovl_En_Dodongo/z_en_dodongo.c b/src/overlays/actors/ovl_En_Dodongo/z_en_dodongo.c index 65e5417f3..cd3710a3b 100644 --- a/src/overlays/actors/ovl_En_Dodongo/z_en_dodongo.c +++ b/src/overlays/actors/ovl_En_Dodongo/z_en_dodongo.c @@ -15,7 +15,7 @@ void EnDodongo_Init(Actor* thisx, PlayState* play); void EnDodongo_Destroy(Actor* thisx, PlayState* play); -void EnDodongo_Update(Actor* thisx, PlayState* play); +void EnDodongo_Update(Actor* thisx, PlayState* play2); void EnDodongo_Draw(Actor* thisx, PlayState* play); void func_808773C4(EnDodongo* this); diff --git a/src/overlays/actors/ovl_En_Door/z_en_door.c b/src/overlays/actors/ovl_En_Door/z_en_door.c index 892eab09c..5d2822d78 100644 --- a/src/overlays/actors/ovl_En_Door/z_en_door.c +++ b/src/overlays/actors/ovl_En_Door/z_en_door.c @@ -24,7 +24,7 @@ #define THIS ((EnDoor*)thisx) -void EnDoor_Init(Actor* thisx, PlayState* play); +void EnDoor_Init(Actor* thisx, PlayState* play2); void EnDoor_Destroy(Actor* thisx, PlayState* play); void EnDoor_Update(Actor* thisx, PlayState* play); void EnDoor_Draw(Actor* thisx, PlayState* play); diff --git a/src/overlays/actors/ovl_En_Door_Etc/z_en_door_etc.c b/src/overlays/actors/ovl_En_Door_Etc/z_en_door_etc.c index 98e9d2b8f..a17ce6193 100644 --- a/src/overlays/actors/ovl_En_Door_Etc/z_en_door_etc.c +++ b/src/overlays/actors/ovl_En_Door_Etc/z_en_door_etc.c @@ -11,7 +11,7 @@ #define THIS ((EnDoorEtc*)thisx) -void EnDoorEtc_Init(Actor* thisx, PlayState* play); +void EnDoorEtc_Init(Actor* thisx, PlayState* play2); void EnDoorEtc_Destroy(Actor* thisx, PlayState* play); void EnDoorEtc_Update(Actor* thisx, PlayState* play); diff --git a/src/overlays/actors/ovl_En_Elf/z_en_elf.c b/src/overlays/actors/ovl_En_Elf/z_en_elf.c index c9b393980..aa4768a76 100644 --- a/src/overlays/actors/ovl_En_Elf/z_en_elf.c +++ b/src/overlays/actors/ovl_En_Elf/z_en_elf.c @@ -11,7 +11,7 @@ #define THIS ((EnElf*)thisx) -void EnElf_Init(Actor* thisx, PlayState* play); +void EnElf_Init(Actor* thisx, PlayState* play2); void EnElf_Destroy(Actor* thisx, PlayState* play); void EnElf_Update(Actor* thisx, PlayState* play); void EnElf_Draw(Actor* thisx, PlayState* play); @@ -29,9 +29,9 @@ void func_8088E484(EnElf* this, PlayState* play); void func_8088E850(EnElf* this, PlayState* play); void func_8088EFA4(EnElf* this, PlayState* play); void func_8088F214(EnElf* this, PlayState* play); -void func_8088F5F4(EnElf* this, PlayState* play, s32 arg2); +void func_8088F5F4(EnElf* this, PlayState* play, s32 sparkleLife); void func_8089010C(Actor* thisx, PlayState* play); -void func_808908D0(Vec3f* arg0, PlayState* play, u32 arg2); +void func_808908D0(Vec3f* vec, PlayState* play, u32 action); const ActorInit En_Elf_InitVars = { ACTOR_EN_ELF, diff --git a/src/overlays/actors/ovl_En_Elfbub/z_en_elfbub.c b/src/overlays/actors/ovl_En_Elfbub/z_en_elfbub.c index e50fc13cd..42a4a06d8 100644 --- a/src/overlays/actors/ovl_En_Elfbub/z_en_elfbub.c +++ b/src/overlays/actors/ovl_En_Elfbub/z_en_elfbub.c @@ -15,7 +15,7 @@ void EnElfbub_Init(Actor* thisx, PlayState* play); void EnElfbub_Destroy(Actor* thisx, PlayState* play); void EnElfbub_Update(Actor* thisx, PlayState* play); -void EnElfbub_Draw(Actor* thisx, PlayState* play); +void EnElfbub_Draw(Actor* thisx, PlayState* play2); void EnElfbub_Pop(EnElfbub* this, PlayState* play); void EnElfbub_Idle(EnElfbub* this, PlayState* play); diff --git a/src/overlays/actors/ovl_En_Firefly/z_en_firefly.c b/src/overlays/actors/ovl_En_Firefly/z_en_firefly.c index 3ac02d9c9..ba43ec2a4 100644 --- a/src/overlays/actors/ovl_En_Firefly/z_en_firefly.c +++ b/src/overlays/actors/ovl_En_Firefly/z_en_firefly.c @@ -14,7 +14,7 @@ void EnFirefly_Init(Actor* thisx, PlayState* play); void EnFirefly_Destroy(Actor* thisx, PlayState* play); -void EnFirefly_Update(Actor* thisx, PlayState* play); +void EnFirefly_Update(Actor* thisx, PlayState* play2); void EnFirefly_Draw(Actor* thisx, PlayState* play); void EnFirefly_FlyIdle(EnFirefly* this, PlayState* play); diff --git a/src/overlays/actors/ovl_En_Fish/z_en_fish.c b/src/overlays/actors/ovl_En_Fish/z_en_fish.c index d5dc5469a..0479ba261 100644 --- a/src/overlays/actors/ovl_En_Fish/z_en_fish.c +++ b/src/overlays/actors/ovl_En_Fish/z_en_fish.c @@ -12,7 +12,7 @@ #define THIS ((EnFish*)thisx) void EnFish_Init(Actor* thisx, PlayState* play); -void EnFish_Destroy(Actor* thisx, PlayState* play); +void EnFish_Destroy(Actor* thisx, PlayState* play2); void EnFish_Update(Actor* thisx, PlayState* play); void EnFish_Draw(Actor* thisx, PlayState* play); diff --git a/src/overlays/actors/ovl_En_Fish2/z_en_fish2.c b/src/overlays/actors/ovl_En_Fish2/z_en_fish2.c index 6b8ae91aa..a0575eb9a 100644 --- a/src/overlays/actors/ovl_En_Fish2/z_en_fish2.c +++ b/src/overlays/actors/ovl_En_Fish2/z_en_fish2.c @@ -16,7 +16,7 @@ void EnFish2_Init(Actor* thisx, PlayState* play); void EnFish2_Destroy(Actor* thisx, PlayState* play); -void EnFish2_Update(Actor* thisx, PlayState* play); +void EnFish2_Update(Actor* thisx, PlayState* play2); void EnFish2_Draw(Actor* thisx, PlayState* play); void func_80B28B5C(EnFish2* this); diff --git a/src/overlays/actors/ovl_En_Fishing/z_en_fishing.c b/src/overlays/actors/ovl_En_Fishing/z_en_fishing.c index baa65bfa3..d940a0959 100644 --- a/src/overlays/actors/ovl_En_Fishing/z_en_fishing.c +++ b/src/overlays/actors/ovl_En_Fishing/z_en_fishing.c @@ -16,12 +16,12 @@ #define WATER_SURFACE_Y(play) play->colCtx.colHeader->waterBoxes->minPos.y -void EnFishing_Init(Actor* thisx, PlayState* play); -void EnFishing_Destroy(Actor* thisx, PlayState* play); -void EnFishing_UpdateFish(Actor* thisx, PlayState* play); +void EnFishing_Init(Actor* thisx, PlayState* play2); +void EnFishing_Destroy(Actor* thisx, PlayState* play2); +void EnFishing_UpdateFish(Actor* thisx, PlayState* play2); void EnFishing_DrawFish(Actor* thisx, PlayState* play); -void EnFishing_UpdateOwner(Actor* thisx, PlayState* play); +void EnFishing_UpdateOwner(Actor* thisx, PlayState* play2); void EnFishing_DrawOwner(Actor* thisx, PlayState* play); typedef struct { diff --git a/src/overlays/actors/ovl_En_Floormas/z_en_floormas.c b/src/overlays/actors/ovl_En_Floormas/z_en_floormas.c index 411d83712..92330d25a 100644 --- a/src/overlays/actors/ovl_En_Floormas/z_en_floormas.c +++ b/src/overlays/actors/ovl_En_Floormas/z_en_floormas.c @@ -10,7 +10,7 @@ #define THIS ((EnFloormas*)thisx) -void EnFloormas_Init(Actor* thisx, PlayState* play); +void EnFloormas_Init(Actor* thisx, PlayState* play2); void EnFloormas_Destroy(Actor* thisx, PlayState* play); void EnFloormas_Update(Actor* thisx, PlayState* play); void EnFloormas_Draw(Actor* thisx, PlayState* play); diff --git a/src/overlays/actors/ovl_En_Ge1/z_en_ge1.c b/src/overlays/actors/ovl_En_Ge1/z_en_ge1.c index ad0d3de24..c8e85a3ac 100644 --- a/src/overlays/actors/ovl_En_Ge1/z_en_ge1.c +++ b/src/overlays/actors/ovl_En_Ge1/z_en_ge1.c @@ -73,10 +73,10 @@ typedef enum { } GerudoWhiteAnimations; void EnGe1_ChangeAnim(EnGe1* this, s16 animIndex, u8 mode, f32 morphFrames); -void EnGe1_ShadowDraw(Actor* actor, Lights* lights, PlayState* play); +void EnGe1_ShadowDraw(Actor* thisx, Lights* lights, PlayState* play); void EnGe1_Wait(EnGe1* this, PlayState* play); void EnGe1_PerformCutsceneActions(EnGe1* this, PlayState* play); -s32 EnGe1_ValidatePictograph(PlayState* play, Actor* this); +s32 EnGe1_ValidatePictograph(PlayState* play, Actor* thisx); void EnGe1_Init(Actor* thisx, PlayState* play) { EnGe1* this = THIS; diff --git a/src/overlays/actors/ovl_En_Gg2/z_en_gg2.c b/src/overlays/actors/ovl_En_Gg2/z_en_gg2.c index a9aaedaa1..47eac3051 100644 --- a/src/overlays/actors/ovl_En_Gg2/z_en_gg2.c +++ b/src/overlays/actors/ovl_En_Gg2/z_en_gg2.c @@ -11,7 +11,7 @@ #define THIS ((EnGg2*)thisx) -void EnGg2_Init(Actor* thisx, PlayState* play); +void EnGg2_Init(Actor* thisx, PlayState* play2); void EnGg2_Destroy(Actor* thisx, PlayState* play); void EnGg2_Update(Actor* thisx, PlayState* play); void EnGg2_Draw(Actor* thisx, PlayState* play); diff --git a/src/overlays/actors/ovl_En_Hanabi/z_en_hanabi.c b/src/overlays/actors/ovl_En_Hanabi/z_en_hanabi.c index 0f016f300..6b354dd94 100644 --- a/src/overlays/actors/ovl_En_Hanabi/z_en_hanabi.c +++ b/src/overlays/actors/ovl_En_Hanabi/z_en_hanabi.c @@ -11,8 +11,8 @@ #define THIS ((EnHanabi*)thisx) -void EnHanabi_Init(Actor* thisx, PlayState* play); -void EnHanabi_Destroy(Actor* thisx, PlayState* play); +void EnHanabi_Init(Actor* thisx, PlayState* play2); +void EnHanabi_Destroy(Actor* thisx, PlayState* play2); void EnHanabi_Update(Actor* thisx, PlayState* play); void func_80B23894(EnHanabi* this, PlayState* play); diff --git a/src/overlays/actors/ovl_En_Horse/z_en_horse.c b/src/overlays/actors/ovl_En_Horse/z_en_horse.c index a9b233aa5..d822ba674 100644 --- a/src/overlays/actors/ovl_En_Horse/z_en_horse.c +++ b/src/overlays/actors/ovl_En_Horse/z_en_horse.c @@ -15,9 +15,9 @@ #define THIS ((EnHorse*)thisx) -void EnHorse_Init(Actor* thisx, PlayState* play); +void EnHorse_Init(Actor* thisx, PlayState* play2); void EnHorse_Destroy(Actor* thisx, PlayState* play); -void EnHorse_Update(Actor* thisx, PlayState* play); +void EnHorse_Update(Actor* thisx, PlayState* play2); void EnHorse_Draw(Actor* thisx, PlayState* play); void func_8087D540(Actor* thisx, PlayState* play); diff --git a/src/overlays/actors/ovl_En_Ik/z_en_ik.c b/src/overlays/actors/ovl_En_Ik/z_en_ik.c index ffd45eaf9..92f73dac5 100644 --- a/src/overlays/actors/ovl_En_Ik/z_en_ik.c +++ b/src/overlays/actors/ovl_En_Ik/z_en_ik.c @@ -13,7 +13,7 @@ void EnIk_Init(Actor* thisx, PlayState* play); void EnIk_Destroy(Actor* thisx, PlayState* play); -void EnIk_Update(Actor* thisx, PlayState* play); +void EnIk_Update(Actor* thisx, PlayState* play2); void EnIk_Draw(Actor* thisx, PlayState* play); void EnIk_Thaw(EnIk* this, PlayState* play); diff --git a/src/overlays/actors/ovl_En_Invadepoh/z_en_invadepoh.c b/src/overlays/actors/ovl_En_Invadepoh/z_en_invadepoh.c index 2050c7316..a0dbf7ca2 100644 --- a/src/overlays/actors/ovl_En_Invadepoh/z_en_invadepoh.c +++ b/src/overlays/actors/ovl_En_Invadepoh/z_en_invadepoh.c @@ -170,7 +170,7 @@ void func_80B4BA30(Actor* thisx, PlayState* play); void func_80B4C568(Actor* thisx, PlayState* play); void func_80B4CFFC(Actor* thisx, PlayState* play); void func_80B46184(unkStruct80B50350* unkStruct); -s32 func_80B450C0(f32* arg0, f32* arg1, f32 arg2, f32 arg3, f32 arg4); +s32 func_80B450C0(f32* x1, f32* z1, f32 x2, f32 z2, f32 speed); s32 func_80B4516C(EnInvadepoh* this); void func_80B45A4C(EnInvadePohStruct* s, unkstructInvadepoh4** u); void func_80B45A94(EnInvadePohStruct* s, unkstructInvadepoh4** u); diff --git a/src/overlays/actors/ovl_En_Ishi/z_en_ishi.c b/src/overlays/actors/ovl_En_Ishi/z_en_ishi.c index 57c18ad7b..5ebc15a02 100644 --- a/src/overlays/actors/ovl_En_Ishi/z_en_ishi.c +++ b/src/overlays/actors/ovl_En_Ishi/z_en_ishi.c @@ -16,7 +16,7 @@ #define THIS ((EnIshi*)thisx) void EnIshi_Init(Actor* thisx, PlayState* play); -void EnIshi_Destroy(Actor* thisx, PlayState* play); +void EnIshi_Destroy(Actor* thisx, PlayState* play2); void EnIshi_Update(Actor* thisx, PlayState* play); void func_8095D804(Actor* thisx, PlayState* play); diff --git a/src/overlays/actors/ovl_En_Karebaba/z_en_karebaba.c b/src/overlays/actors/ovl_En_Karebaba/z_en_karebaba.c index 46a1adfd5..61c1c5b3c 100644 --- a/src/overlays/actors/ovl_En_Karebaba/z_en_karebaba.c +++ b/src/overlays/actors/ovl_En_Karebaba/z_en_karebaba.c @@ -15,7 +15,7 @@ void EnKarebaba_Init(Actor* thisx, PlayState* play); void EnKarebaba_Destroy(Actor* thisx, PlayState* play); -void EnKarebaba_Update(Actor* thisx, PlayState* play); +void EnKarebaba_Update(Actor* thisx, PlayState* play2); void EnKarebaba_Draw(Actor* thisx, PlayState* play); void func_808F155C(EnKarebaba* this); diff --git a/src/overlays/actors/ovl_En_Kusa/z_en_kusa.c b/src/overlays/actors/ovl_En_Kusa/z_en_kusa.c index 9d0c41295..2ab13422a 100644 --- a/src/overlays/actors/ovl_En_Kusa/z_en_kusa.c +++ b/src/overlays/actors/ovl_En_Kusa/z_en_kusa.c @@ -15,7 +15,7 @@ void EnKusa_Init(Actor* thisx, PlayState* play); void EnKusa_Destroy(Actor* thisx, PlayState* play); -void EnKusa_Update(Actor* thisx, PlayState* play); +void EnKusa_Update(Actor* thisx, PlayState* play2); s32 EnKusa_SnapToFloor(EnKusa* this, PlayState* play, f32 yOffset); void EnKusa_DropCollectible(EnKusa* this, PlayState* play); diff --git a/src/overlays/actors/ovl_En_M_Thunder/z_en_m_thunder.c b/src/overlays/actors/ovl_En_M_Thunder/z_en_m_thunder.c index fbfb17040..1fa4589b5 100644 --- a/src/overlays/actors/ovl_En_M_Thunder/z_en_m_thunder.c +++ b/src/overlays/actors/ovl_En_M_Thunder/z_en_m_thunder.c @@ -16,7 +16,7 @@ void EnMThunder_Init(Actor* thisx, PlayState* play); void EnMThunder_Destroy(Actor* thisx, PlayState* play); void EnMThunder_Update(Actor* thisx, PlayState* play); -void EnMThunder_Draw(Actor* thisx, PlayState* play); +void EnMThunder_Draw(Actor* thisx, PlayState* play2); void EnMThunder_UnkType_Update(Actor* thisx, PlayState* play); diff --git a/src/overlays/actors/ovl_En_Muto/z_en_muto.c b/src/overlays/actors/ovl_En_Muto/z_en_muto.c index 69861434b..8a657ad2a 100644 --- a/src/overlays/actors/ovl_En_Muto/z_en_muto.c +++ b/src/overlays/actors/ovl_En_Muto/z_en_muto.c @@ -13,7 +13,7 @@ void EnMuto_Init(Actor* thisx, PlayState* play); void EnMuto_Destroy(Actor* thisx, PlayState* play); -void EnMuto_Update(Actor* thisx, PlayState* play); +void EnMuto_Update(Actor* thisx, PlayState* play2); void EnMuto_Draw(Actor* thisx, PlayState* play); void EnMuto_ChangeAnim(EnMuto* this, s32 animIndex); diff --git a/src/overlays/actors/ovl_En_Nutsball/z_en_nutsball.c b/src/overlays/actors/ovl_En_Nutsball/z_en_nutsball.c index 36fea369b..c93e531be 100644 --- a/src/overlays/actors/ovl_En_Nutsball/z_en_nutsball.c +++ b/src/overlays/actors/ovl_En_Nutsball/z_en_nutsball.c @@ -14,7 +14,7 @@ void EnNutsball_Init(Actor* thisx, PlayState* play); void EnNutsball_Destroy(Actor* thisx, PlayState* play); -void EnNutsball_Update(Actor* thisx, PlayState* play); +void EnNutsball_Update(Actor* thisx, PlayState* play2); void EnNutsball_Draw(Actor* thisx, PlayState* play); void EnNutsball_InitColliderParams(EnNutsball* this); diff --git a/src/overlays/actors/ovl_En_Peehat/z_en_peehat.c b/src/overlays/actors/ovl_En_Peehat/z_en_peehat.c index 02e660f14..cf3cd935f 100644 --- a/src/overlays/actors/ovl_En_Peehat/z_en_peehat.c +++ b/src/overlays/actors/ovl_En_Peehat/z_en_peehat.c @@ -15,7 +15,7 @@ void EnPeehat_Init(Actor* thisx, PlayState* play); void EnPeehat_Destroy(Actor* thisx, PlayState* play); -void EnPeehat_Update(Actor* thisx, PlayState* play); +void EnPeehat_Update(Actor* thisx, PlayState* play2); void EnPeehat_Draw(Actor* thisx, PlayState* play); void func_80897498(EnPeehat* this); diff --git a/src/overlays/actors/ovl_En_Poh/z_en_poh.c b/src/overlays/actors/ovl_En_Poh/z_en_poh.c index dde6236b5..a3718497c 100644 --- a/src/overlays/actors/ovl_En_Poh/z_en_poh.c +++ b/src/overlays/actors/ovl_En_Poh/z_en_poh.c @@ -13,7 +13,7 @@ void EnPoh_Init(Actor* thisx, PlayState* play); void EnPoh_Destroy(Actor* thisx, PlayState* play); -void EnPoh_Update(Actor* thisx, PlayState* play); +void EnPoh_Update(Actor* thisx, PlayState* play2); void EnPoh_Draw(Actor* thisx, PlayState* play); void func_80B2CAA4(EnPoh* this, PlayState* play); diff --git a/src/overlays/actors/ovl_En_Pr/z_en_pr.c b/src/overlays/actors/ovl_En_Pr/z_en_pr.c index 724b2c19f..ec8ab91de 100644 --- a/src/overlays/actors/ovl_En_Pr/z_en_pr.c +++ b/src/overlays/actors/ovl_En_Pr/z_en_pr.c @@ -12,7 +12,7 @@ #define THIS ((EnPr*)thisx) -void EnPr_Init(Actor* thisx, PlayState* play); +void EnPr_Init(Actor* thisx, PlayState* play2); void EnPr_Destroy(Actor* thisx, PlayState* play); void EnPr_Update(Actor* thisx, PlayState* play); void EnPr_Draw(Actor* thisx, PlayState* play); diff --git a/src/overlays/actors/ovl_En_Racedog/z_en_racedog.c b/src/overlays/actors/ovl_En_Racedog/z_en_racedog.c index 66b2a0a1e..3190e3e36 100644 --- a/src/overlays/actors/ovl_En_Racedog/z_en_racedog.c +++ b/src/overlays/actors/ovl_En_Racedog/z_en_racedog.c @@ -28,7 +28,7 @@ void EnRacedog_CalculateFinalStretchTargetSpeed(EnRacedog* this); void EnRacedog_UpdateRaceVariables(EnRacedog* this); void EnRacedog_CheckForFinish(EnRacedog* this); void EnRacedog_UpdateRunAnimationPlaySpeed(EnRacedog* this); -s32 EnRacedog_IsOverFinishLine(EnRacedog* this, Vec2f* arg1); +s32 EnRacedog_IsOverFinishLine(EnRacedog* this, Vec2f* finishLineCoordinates); void EnRacedog_SpawnFloorDustRing(EnRacedog* this, PlayState* play); void EnRacedog_PlaySfxWalk(EnRacedog* this); diff --git a/src/overlays/actors/ovl_En_Railgibud/z_en_railgibud.c b/src/overlays/actors/ovl_En_Railgibud/z_en_railgibud.c index 58ab51cf8..50df4d01c 100644 --- a/src/overlays/actors/ovl_En_Railgibud/z_en_railgibud.c +++ b/src/overlays/actors/ovl_En_Railgibud/z_en_railgibud.c @@ -35,7 +35,8 @@ void EnRailgibud_Damage(EnRailgibud* this, PlayState* play); void EnRailgibud_Stunned(EnRailgibud* this, PlayState* play); void EnRailgibud_SetupDead(EnRailgibud* this); void EnRailgibud_Dead(EnRailgibud* this, PlayState* play); -void EnRailgibud_SpawnDust(PlayState* play, Vec3f* vec, f32 arg2, s32 arg3, s16 arg4, s16 arg5); +void EnRailgibud_SpawnDust(PlayState* play, Vec3f* basePos, f32 randomnessScale, s32 dustCount, s16 dustScale, + s16 scaleStep); void EnRailgibud_TurnTowardsPlayer(EnRailgibud* this, PlayState* play); s32 EnRailgibud_PlayerInRangeWithCorrectState(EnRailgibud* this, PlayState* play); s32 EnRailgibud_PlayerOutOfRange(EnRailgibud* this, PlayState* play); diff --git a/src/overlays/actors/ovl_En_Rr/z_en_rr.c b/src/overlays/actors/ovl_En_Rr/z_en_rr.c index 4a61e62b9..daf11baa6 100644 --- a/src/overlays/actors/ovl_En_Rr/z_en_rr.c +++ b/src/overlays/actors/ovl_En_Rr/z_en_rr.c @@ -15,7 +15,7 @@ void EnRr_Init(Actor* thisx, PlayState* play); void EnRr_Destroy(Actor* thisx, PlayState* play); void EnRr_Update(Actor* thisx, PlayState* play); -void EnRr_Draw(Actor* thisx, PlayState* play); +void EnRr_Draw(Actor* thisx, PlayState* play2); void func_808FAF94(EnRr* this, PlayState* play); void func_808FB088(EnRr* this, PlayState* play); diff --git a/src/overlays/actors/ovl_En_Ruppecrow/z_en_ruppecrow.c b/src/overlays/actors/ovl_En_Ruppecrow/z_en_ruppecrow.c index 66db63c65..98f7b0a11 100644 --- a/src/overlays/actors/ovl_En_Ruppecrow/z_en_ruppecrow.c +++ b/src/overlays/actors/ovl_En_Ruppecrow/z_en_ruppecrow.c @@ -17,7 +17,7 @@ enum { ENRUPPECROW_EFFECT_LIGHT = 20, }; -void EnRuppecrow_Init(Actor* thisx, PlayState* play); +void EnRuppecrow_Init(Actor* thisx, PlayState* play2); void EnRuppecrow_Destroy(Actor* thisx, PlayState* play); void EnRuppecrow_Update(Actor* thisx, PlayState* play); void EnRuppecrow_Draw(Actor* thisx, PlayState* play); diff --git a/src/overlays/actors/ovl_En_Syateki_Crow/z_en_syateki_crow.c b/src/overlays/actors/ovl_En_Syateki_Crow/z_en_syateki_crow.c index f3bce9c4f..0b76c7715 100644 --- a/src/overlays/actors/ovl_En_Syateki_Crow/z_en_syateki_crow.c +++ b/src/overlays/actors/ovl_En_Syateki_Crow/z_en_syateki_crow.c @@ -11,7 +11,7 @@ #define THIS ((EnSyatekiCrow*)thisx) -void EnSyatekiCrow_Init(Actor* thisx, PlayState* play); +void EnSyatekiCrow_Init(Actor* thisx, PlayState* play2); void EnSyatekiCrow_Destroy(Actor* thisx, PlayState* play); void EnSyatekiCrow_Update(Actor* thisx, PlayState* play); void EnSyatekiCrow_Draw(Actor* thisx, PlayState* play); diff --git a/src/overlays/actors/ovl_En_Syateki_Dekunuts/z_en_syateki_dekunuts.c b/src/overlays/actors/ovl_En_Syateki_Dekunuts/z_en_syateki_dekunuts.c index 5e6f5925a..b7e79fdfd 100644 --- a/src/overlays/actors/ovl_En_Syateki_Dekunuts/z_en_syateki_dekunuts.c +++ b/src/overlays/actors/ovl_En_Syateki_Dekunuts/z_en_syateki_dekunuts.c @@ -12,7 +12,7 @@ #define THIS ((EnSyatekiDekunuts*)thisx) -void EnSyatekiDekunuts_Init(Actor* thisx, PlayState* play); +void EnSyatekiDekunuts_Init(Actor* thisx, PlayState* play2); void EnSyatekiDekunuts_Destroy(Actor* thisx, PlayState* play); void EnSyatekiDekunuts_Update(Actor* thisx, PlayState* play); void EnSyatekiDekunuts_Draw(Actor* thisx, PlayState* play); diff --git a/src/overlays/actors/ovl_En_Syateki_Wf/z_en_syateki_wf.c b/src/overlays/actors/ovl_En_Syateki_Wf/z_en_syateki_wf.c index c9caedf01..ad9aa824f 100644 --- a/src/overlays/actors/ovl_En_Syateki_Wf/z_en_syateki_wf.c +++ b/src/overlays/actors/ovl_En_Syateki_Wf/z_en_syateki_wf.c @@ -13,7 +13,7 @@ void EnSyatekiWf_Init(Actor* thisx, PlayState* play); void EnSyatekiWf_Destroy(Actor* thisx, PlayState* play); -void EnSyatekiWf_Update(Actor* thisx, PlayState* play); +void EnSyatekiWf_Update(Actor* thisx, PlayState* play2); void EnSyatekiWf_Draw(Actor* thisx, PlayState* play); void func_80A201CC(EnSyatekiWf* this); diff --git a/src/overlays/actors/ovl_En_Tanron2/z_en_tanron2.c b/src/overlays/actors/ovl_En_Tanron2/z_en_tanron2.c index 542a564f5..9737c9f81 100644 --- a/src/overlays/actors/ovl_En_Tanron2/z_en_tanron2.c +++ b/src/overlays/actors/ovl_En_Tanron2/z_en_tanron2.c @@ -16,7 +16,7 @@ void EnTanron2_Init(Actor* thisx, PlayState* play); void EnTanron2_Destroy(Actor* thisx, PlayState* play); void EnTanron2_Update(Actor* thisx, PlayState* play); -void EnTanron2_Draw(Actor* thisx, PlayState* play); +void EnTanron2_Draw(Actor* thisx, PlayState* play2); void func_80BB69C0(EnTanron2* this); void func_80BB69FC(EnTanron2* this, PlayState* play); diff --git a/src/overlays/actors/ovl_En_Tanron4/z_en_tanron4.c b/src/overlays/actors/ovl_En_Tanron4/z_en_tanron4.c index e68ca1b3a..c67b36940 100644 --- a/src/overlays/actors/ovl_En_Tanron4/z_en_tanron4.c +++ b/src/overlays/actors/ovl_En_Tanron4/z_en_tanron4.c @@ -10,7 +10,7 @@ #define THIS ((EnTanron4*)thisx) -void EnTanron4_Init(Actor* thisx, PlayState* play); +void EnTanron4_Init(Actor* thisx, PlayState* play2); void EnTanron4_Destroy(Actor* thisx, PlayState* play); void EnTanron4_Update(Actor* thisx, PlayState* play); void EnTanron4_Draw(Actor* thisx, PlayState* play); diff --git a/src/overlays/actors/ovl_En_Tanron5/z_en_tanron5.c b/src/overlays/actors/ovl_En_Tanron5/z_en_tanron5.c index 45f88ffb7..f45afbb01 100644 --- a/src/overlays/actors/ovl_En_Tanron5/z_en_tanron5.c +++ b/src/overlays/actors/ovl_En_Tanron5/z_en_tanron5.c @@ -15,10 +15,10 @@ void EnTanron5_Init(Actor* thisx, PlayState* play); void EnTanron5_Destroy(Actor* thisx, PlayState* play); -void EnTanron5_Update(Actor* thisx, PlayState* play); +void EnTanron5_Update(Actor* thisx, PlayState* play2); void EnTanron5_Draw(Actor* thisx, PlayState* play); -void func_80BE5818(Actor* thisx, PlayState* play); +void func_80BE5818(Actor* thisx, PlayState* play2); void func_80BE5C10(Actor* thisx, PlayState* play); s32 D_80BE5D80 = 0; diff --git a/src/overlays/actors/ovl_En_Test/z_en_test.c b/src/overlays/actors/ovl_En_Test/z_en_test.c index af2824c69..348290ccf 100644 --- a/src/overlays/actors/ovl_En_Test/z_en_test.c +++ b/src/overlays/actors/ovl_En_Test/z_en_test.c @@ -11,7 +11,7 @@ #define THIS ((EnTest*)thisx) -void EnTest_Init(Actor* thisx, PlayState* play); +void EnTest_Init(Actor* thisx, PlayState* play2); void EnTest_Destroy(Actor* thisx, PlayState* play); void EnTest_Update(Actor* thisx, PlayState* play); void EnTest_Draw(Actor* thisx, PlayState* play); diff --git a/src/overlays/actors/ovl_En_Test5/z_en_test5.c b/src/overlays/actors/ovl_En_Test5/z_en_test5.c index 57db36ea6..13cb04b02 100644 --- a/src/overlays/actors/ovl_En_Test5/z_en_test5.c +++ b/src/overlays/actors/ovl_En_Test5/z_en_test5.c @@ -10,9 +10,9 @@ #define THIS ((EnTest5*)thisx) -void EnTest5_Init(Actor* thisx, PlayState* play); +void EnTest5_Init(Actor* thisx, PlayState* play2); void EnTest5_Destroy(Actor* thisx, PlayState* play); -void EnTest5_Update(Actor* thisx, PlayState* play); +void EnTest5_Update(Actor* thisx, PlayState* play2); void EnTest5_HandleBottleAction(EnTest5* this, PlayState* play); void EnTest5_SetupAction(EnTest5* this, EnTest5ActionFunc actionFunc); diff --git a/src/overlays/actors/ovl_En_Test6/z_en_test6.c b/src/overlays/actors/ovl_En_Test6/z_en_test6.c index 23dccca0f..ea50336d9 100644 --- a/src/overlays/actors/ovl_En_Test6/z_en_test6.c +++ b/src/overlays/actors/ovl_En_Test6/z_en_test6.c @@ -12,8 +12,8 @@ #define THIS ((EnTest6*)thisx) -void EnTest6_Init(Actor* thisx, PlayState* play); -void EnTest6_Destroy(Actor* thisx, PlayState* play); +void EnTest6_Init(Actor* thisx, PlayState* play2); +void EnTest6_Destroy(Actor* thisx, PlayState* play2); void EnTest6_Update(Actor* thisx, PlayState* play); void EnTest6_Draw(Actor* thisx, PlayState* play); diff --git a/src/overlays/actors/ovl_En_Test7/z_en_test7.c b/src/overlays/actors/ovl_En_Test7/z_en_test7.c index e1223cddb..5f153e5a9 100644 --- a/src/overlays/actors/ovl_En_Test7/z_en_test7.c +++ b/src/overlays/actors/ovl_En_Test7/z_en_test7.c @@ -11,7 +11,7 @@ #define THIS ((EnTest7*)thisx) -void EnTest7_Init(Actor* thisx, PlayState* play); +void EnTest7_Init(Actor* thisx, PlayState* play2); void EnTest7_Destroy(Actor* thisx, PlayState* play); void EnTest7_Update(Actor* thisx, PlayState* play); void EnTest7_Draw(Actor* thisx, PlayState* play); diff --git a/src/overlays/actors/ovl_En_Thiefbird/z_en_thiefbird.c b/src/overlays/actors/ovl_En_Thiefbird/z_en_thiefbird.c index dd4890d53..fc82ed262 100644 --- a/src/overlays/actors/ovl_En_Thiefbird/z_en_thiefbird.c +++ b/src/overlays/actors/ovl_En_Thiefbird/z_en_thiefbird.c @@ -12,7 +12,7 @@ void EnThiefbird_Init(Actor* thisx, PlayState* play); void EnThiefbird_Destroy(Actor* thisx, PlayState* play); -void EnThiefbird_Update(Actor* thisx, PlayState* play); +void EnThiefbird_Update(Actor* thisx, PlayState* play2); void EnThiefbird_Draw(Actor* thisx, PlayState* play); void func_80C11538(EnThiefbird* this); diff --git a/src/overlays/actors/ovl_En_Torch2/z_en_torch2.c b/src/overlays/actors/ovl_En_Torch2/z_en_torch2.c index 2cb3cb193..0486f7c5c 100644 --- a/src/overlays/actors/ovl_En_Torch2/z_en_torch2.c +++ b/src/overlays/actors/ovl_En_Torch2/z_en_torch2.c @@ -14,7 +14,7 @@ void EnTorch2_Init(Actor* thisx, PlayState* play); void EnTorch2_Destroy(Actor* thisx, PlayState* play); void EnTorch2_Update(Actor* thisx, PlayState* play); -void EnTorch2_Draw(Actor* thisx, PlayState* play); +void EnTorch2_Draw(Actor* thisx, PlayState* play2); void EnTorch2_UpdateIdle(Actor* thisx, PlayState* play); void EnTorch2_UpdateDeath(Actor* thisx, PlayState* play); diff --git a/src/overlays/actors/ovl_En_Twig/z_en_twig.c b/src/overlays/actors/ovl_En_Twig/z_en_twig.c index 5df9cee3c..1f26288c4 100644 --- a/src/overlays/actors/ovl_En_Twig/z_en_twig.c +++ b/src/overlays/actors/ovl_En_Twig/z_en_twig.c @@ -11,10 +11,10 @@ #define THIS ((EnTwig*)thisx) -void EnTwig_Init(Actor* thisx, PlayState* play); -void EnTwig_Destroy(Actor* thisx, PlayState* play); -void EnTwig_Update(Actor* this, PlayState* play); -void EnTwig_Draw(EnTwig* this, PlayState* play); +void EnTwig_Init(Actor* thisx, PlayState* play2); +void EnTwig_Destroy(Actor* thisx, PlayState* play2); +void EnTwig_Update(Actor* thisx, PlayState* play2); +void EnTwig_Draw(Actor* thisx, PlayState* play); void func_80AC0A54(EnTwig* this, PlayState* play); void func_80AC0A6C(EnTwig* this, PlayState* play); @@ -227,7 +227,7 @@ void EnTwig_Update(Actor* thisx, PlayState* play2) { this->actionFunc(this, play); } -void EnTwig_Draw(EnTwig* thisx, PlayState* play) { +void EnTwig_Draw(Actor* thisx, PlayState* play) { EnTwig* this = THIS; switch (this->unk_160) { diff --git a/src/overlays/actors/ovl_En_Water_Effect/z_en_water_effect.c b/src/overlays/actors/ovl_En_Water_Effect/z_en_water_effect.c index fc1ad7279..aa36b6947 100644 --- a/src/overlays/actors/ovl_En_Water_Effect/z_en_water_effect.c +++ b/src/overlays/actors/ovl_En_Water_Effect/z_en_water_effect.c @@ -22,8 +22,8 @@ void EnWaterEffect_Init(Actor* thisx, PlayState* play); void EnWaterEffect_Destroy(Actor* thisx, PlayState* play); -void EnWaterEffect_Update(Actor* thisx, PlayState* play); -void EnWaterEffect_Draw(Actor* thisx, PlayState* play); +void EnWaterEffect_Update(Actor* thisx, PlayState* play2); +void EnWaterEffect_Draw(Actor* thisx, PlayState* play2); void func_80A59C04(Actor* thisx, PlayState* play2); void func_80A5A184(Actor* thisx, PlayState* play2); diff --git a/src/overlays/actors/ovl_En_Wiz_Fire/z_en_wiz_fire.c b/src/overlays/actors/ovl_En_Wiz_Fire/z_en_wiz_fire.c index eea112f89..ca3fde745 100644 --- a/src/overlays/actors/ovl_En_Wiz_Fire/z_en_wiz_fire.c +++ b/src/overlays/actors/ovl_En_Wiz_Fire/z_en_wiz_fire.c @@ -14,8 +14,8 @@ void EnWizFire_Init(Actor* thisx, PlayState* play); void EnWizFire_Destroy(Actor* thisx, PlayState* play); -void EnWizFire_Update(Actor* thisx, PlayState* play); -void EnWizFire_Draw(Actor* thisx, PlayState* play); +void EnWizFire_Update(Actor* thisx, PlayState* play2); +void EnWizFire_Draw(Actor* thisx, PlayState* play2); void EnWiz_SetupMoveMagicProjectile(EnWizFire* this, PlayState* play); void EnWiz_MoveMagicProjectile(EnWizFire* this, PlayState* play); diff --git a/src/overlays/actors/ovl_En_Wood02/z_en_wood02.c b/src/overlays/actors/ovl_En_Wood02/z_en_wood02.c index 67faa1f3c..08295ad1e 100644 --- a/src/overlays/actors/ovl_En_Wood02/z_en_wood02.c +++ b/src/overlays/actors/ovl_En_Wood02/z_en_wood02.c @@ -13,7 +13,7 @@ void EnWood02_Init(Actor* thisx, PlayState* play); void EnWood02_Destroy(Actor* thisx, PlayState* play); -void EnWood02_Update(Actor* thisx, PlayState* play); +void EnWood02_Update(Actor* thisx, PlayState* play2); void EnWood02_Draw(Actor* thisx, PlayState* play); /** diff --git a/src/overlays/actors/ovl_En_Zos/z_en_zos.c b/src/overlays/actors/ovl_En_Zos/z_en_zos.c index 1b7be4e0b..11fcc2595 100644 --- a/src/overlays/actors/ovl_En_Zos/z_en_zos.c +++ b/src/overlays/actors/ovl_En_Zos/z_en_zos.c @@ -15,7 +15,7 @@ void EnZos_Destroy(Actor* thisx, PlayState* play); void EnZos_Update(Actor* thisx, PlayState* play); void EnZos_Draw(Actor* thisx, PlayState* play); -void EnZos_ChangeAnim(EnZos* this, s16 arg1, u8 arg2); +void EnZos_ChangeAnim(EnZos* this, s16 animIndex, u8 animMode); void func_80BBB2C4(EnZos* this, PlayState* play); void func_80BBB354(EnZos* this, PlayState* play); void func_80BBB4CC(EnZos* this, PlayState* play); diff --git a/src/overlays/actors/ovl_En_Zot/z_en_zot.c b/src/overlays/actors/ovl_En_Zot/z_en_zot.c index bced0c6f3..1519a3774 100644 --- a/src/overlays/actors/ovl_En_Zot/z_en_zot.c +++ b/src/overlays/actors/ovl_En_Zot/z_en_zot.c @@ -12,7 +12,7 @@ #define THIS ((EnZot*)thisx) -void EnZot_Init(Actor* thisx, PlayState* play); +void EnZot_Init(Actor* thisx, PlayState* play2); void EnZot_Destroy(Actor* thisx, PlayState* play); void EnZot_Update(Actor* thisx, PlayState* play); void EnZot_Draw(Actor* thisx, PlayState* play); diff --git a/src/overlays/actors/ovl_Obj_Armos/z_obj_armos.c b/src/overlays/actors/ovl_Obj_Armos/z_obj_armos.c index 9b31c22ca..b9310b27e 100644 --- a/src/overlays/actors/ovl_Obj_Armos/z_obj_armos.c +++ b/src/overlays/actors/ovl_Obj_Armos/z_obj_armos.c @@ -13,7 +13,7 @@ void ObjArmos_Init(Actor* thisx, PlayState* play); void ObjArmos_Destroy(Actor* thisx, PlayState* play); -void ObjArmos_Update(Actor* thisx, PlayState* play); +void ObjArmos_Update(Actor* thisx, PlayState* play2); void ObjArmos_Draw(Actor* thisx, PlayState* play); void func_809A54B4(ObjArmos* this); diff --git a/src/overlays/actors/ovl_Obj_Boat/z_obj_boat.c b/src/overlays/actors/ovl_Obj_Boat/z_obj_boat.c index 0380b338d..1fca2a001 100644 --- a/src/overlays/actors/ovl_Obj_Boat/z_obj_boat.c +++ b/src/overlays/actors/ovl_Obj_Boat/z_obj_boat.c @@ -16,7 +16,7 @@ void ObjBoat_Destroy(Actor* thisx, PlayState* play); void ObjBoat_Update(Actor* thisx, PlayState* play); void ObjBoat_Draw(Actor* thisx, PlayState* play); -void func_80B9B428(Actor* thisx, PlayState* play); +void func_80B9B428(Actor* thisx, PlayState* play2); const ActorInit Obj_Boat_InitVars = { ACTOR_OBJ_BOAT, diff --git a/src/overlays/actors/ovl_Obj_Chan/z_obj_chan.c b/src/overlays/actors/ovl_Obj_Chan/z_obj_chan.c index 8e555a19f..d387436be 100644 --- a/src/overlays/actors/ovl_Obj_Chan/z_obj_chan.c +++ b/src/overlays/actors/ovl_Obj_Chan/z_obj_chan.c @@ -25,7 +25,7 @@ void ObjChan_Destroy(Actor* thisx, PlayState* play); void ObjChan_Update(Actor* thisx, PlayState* play); void ObjChan_Draw(Actor* thisx, PlayState* play); -void ObjChan_ChandelierAction(ObjChan* this, PlayState* play); +void ObjChan_ChandelierAction(ObjChan* this2, PlayState* play); void ObjChan_PotAction(ObjChan* this, PlayState* play); const ActorInit Obj_Chan_InitVars = { diff --git a/src/overlays/actors/ovl_Obj_Dhouse/z_obj_dhouse.c b/src/overlays/actors/ovl_Obj_Dhouse/z_obj_dhouse.c index 77b704a6c..fa92bd2e3 100644 --- a/src/overlays/actors/ovl_Obj_Dhouse/z_obj_dhouse.c +++ b/src/overlays/actors/ovl_Obj_Dhouse/z_obj_dhouse.c @@ -22,7 +22,7 @@ void func_80B13170(ObjDhouse* this, PlayState* play, ObjDhouseStruct1* ptr, ObjD void func_80B13908(ObjDhouse* this); void func_80B1391C(ObjDhouse* this, PlayState* play); void func_80B1392C(ObjDhouse* this); -void func_80B13940(ObjDhouse* this, PlayState* play); +void func_80B13940(ObjDhouse* this, PlayState* play2); void func_80B139D8(ObjDhouse* this); void func_80B139F4(ObjDhouse* this, PlayState* play); void func_80B13C08(Actor* thisx, PlayState* play); diff --git a/src/overlays/actors/ovl_Obj_Flowerpot/z_obj_flowerpot.c b/src/overlays/actors/ovl_Obj_Flowerpot/z_obj_flowerpot.c index 79961ad82..c4ebe8063 100644 --- a/src/overlays/actors/ovl_Obj_Flowerpot/z_obj_flowerpot.c +++ b/src/overlays/actors/ovl_Obj_Flowerpot/z_obj_flowerpot.c @@ -12,8 +12,8 @@ #define THIS ((ObjFlowerpot*)thisx) void ObjFlowerpot_Init(Actor* thisx, PlayState* play); -void ObjFlowerpot_Destroy(Actor* thisx, PlayState* play); -void ObjFlowerpot_Update(Actor* thisx, PlayState* play); +void ObjFlowerpot_Destroy(Actor* thisx, PlayState* play2); +void ObjFlowerpot_Update(Actor* thisx, PlayState* play2); void ObjFlowerpot_Draw(Actor* thisx, PlayState* play); void func_80A1C818(ObjFlowerpot* this); diff --git a/src/overlays/actors/ovl_Obj_Hugebombiwa/z_obj_hugebombiwa.c b/src/overlays/actors/ovl_Obj_Hugebombiwa/z_obj_hugebombiwa.c index 38f3164e3..3ad2cf5e8 100644 --- a/src/overlays/actors/ovl_Obj_Hugebombiwa/z_obj_hugebombiwa.c +++ b/src/overlays/actors/ovl_Obj_Hugebombiwa/z_obj_hugebombiwa.c @@ -14,7 +14,7 @@ #define THIS ((ObjHugebombiwa*)thisx) void ObjHugebombiwa_Init(Actor* thisx, PlayState* play); -void ObjHugebombiwa_Destroy(Actor* thisx, PlayState* play); +void ObjHugebombiwa_Destroy(Actor* thisx, PlayState* play2); void ObjHugebombiwa_Update(Actor* thisx, PlayState* play); void ObjHugebombiwa_Draw(Actor* thisx, PlayState* play); diff --git a/src/overlays/actors/ovl_Obj_Jg_Gakki/z_obj_jg_gakki.c b/src/overlays/actors/ovl_Obj_Jg_Gakki/z_obj_jg_gakki.c index 33de74100..57e0f4b2e 100644 --- a/src/overlays/actors/ovl_Obj_Jg_Gakki/z_obj_jg_gakki.c +++ b/src/overlays/actors/ovl_Obj_Jg_Gakki/z_obj_jg_gakki.c @@ -11,7 +11,7 @@ #define THIS ((ObjJgGakki*)thisx) -void ObjJgGakki_Init(Actor* thisx, PlayState* play); +void ObjJgGakki_Init(Actor* thisx, PlayState* play2); void ObjJgGakki_Destroy(Actor* thisx, PlayState* play); void ObjJgGakki_Update(Actor* thisx, PlayState* play); void ObjJgGakki_Draw(Actor* thisx, PlayState* play); diff --git a/src/overlays/actors/ovl_Obj_Kibako/z_obj_kibako.c b/src/overlays/actors/ovl_Obj_Kibako/z_obj_kibako.c index e2a71db92..9bd2e0442 100644 --- a/src/overlays/actors/ovl_Obj_Kibako/z_obj_kibako.c +++ b/src/overlays/actors/ovl_Obj_Kibako/z_obj_kibako.c @@ -12,8 +12,8 @@ #define THIS ((ObjKibako*)thisx) -void ObjKibako_Init(Actor* thisx, PlayState* play); -void ObjKibako_Destroy(Actor* thisx, PlayState* play); +void ObjKibako_Init(Actor* thisx, PlayState* play2); +void ObjKibako_Destroy(Actor* thisx, PlayState* play2); void ObjKibako_Update(Actor* thisx, PlayState* play); void ObjKibako_Draw(Actor* thisx, PlayState* play); diff --git a/src/overlays/actors/ovl_Obj_Milk_Bin/z_obj_milk_bin.c b/src/overlays/actors/ovl_Obj_Milk_Bin/z_obj_milk_bin.c index 99745be7c..e1b1bc1b9 100644 --- a/src/overlays/actors/ovl_Obj_Milk_Bin/z_obj_milk_bin.c +++ b/src/overlays/actors/ovl_Obj_Milk_Bin/z_obj_milk_bin.c @@ -13,7 +13,7 @@ void ObjMilkBin_Init(Actor* thisx, PlayState* play); void ObjMilkBin_Destroy(Actor* thisx, PlayState* play); -void ObjMilkBin_Update(Actor* thisx, PlayState* play); +void ObjMilkBin_Update(Actor* thisx, PlayState* play2); void ObjMilkBin_Draw(Actor* thisx, PlayState* play); const ActorInit Obj_Milk_Bin_InitVars = { diff --git a/src/overlays/actors/ovl_Obj_Raillift/z_obj_raillift.c b/src/overlays/actors/ovl_Obj_Raillift/z_obj_raillift.c index 23ca0872d..01cfdd832 100644 --- a/src/overlays/actors/ovl_Obj_Raillift/z_obj_raillift.c +++ b/src/overlays/actors/ovl_Obj_Raillift/z_obj_raillift.c @@ -22,7 +22,7 @@ void ObjRaillift_DrawDekuFlowerPlatform(Actor* thisx, PlayState* play); void ObjRaillift_DoNothing(ObjRaillift* this, PlayState* play); void ObjRaillift_Idle(ObjRaillift* this, PlayState* play); -void ObjRaillift_UpdatePosition(ObjRaillift* this, s32 arg1); +void ObjRaillift_UpdatePosition(ObjRaillift* this, s32 index); void ObjRaillift_StartCutscene(ObjRaillift* this, PlayState* play); void ObjRaillift_Teleport(ObjRaillift* this, PlayState* play); void ObjRaillift_Wait(ObjRaillift* this, PlayState* play); @@ -49,8 +49,8 @@ static InitChainEntry sInitChain[] = { static CollisionHeader* sColHeaders[] = { &object_raillift_Colheader_004FF8, &object_raillift_Colheader_0048D0 }; -void ObjRaillift_UpdatePosition(ObjRaillift* this, s32 idx) { - Math_Vec3s_ToVec3f(&this->dyna.actor.world.pos, &this->points[idx]); +void ObjRaillift_UpdatePosition(ObjRaillift* this, s32 index) { + Math_Vec3s_ToVec3f(&this->dyna.actor.world.pos, &this->points[index]); } void ObjRaillift_Init(Actor* thisx, PlayState* play) { diff --git a/src/overlays/actors/ovl_Obj_Spinyroll/z_obj_spinyroll.c b/src/overlays/actors/ovl_Obj_Spinyroll/z_obj_spinyroll.c index 0db945c96..c57db1111 100644 --- a/src/overlays/actors/ovl_Obj_Spinyroll/z_obj_spinyroll.c +++ b/src/overlays/actors/ovl_Obj_Spinyroll/z_obj_spinyroll.c @@ -13,7 +13,7 @@ void ObjSpinyroll_Init(Actor* thisx, PlayState* play); void ObjSpinyroll_Destroy(Actor* thisx, PlayState* play); -void ObjSpinyroll_Update(Actor* thisx, PlayState* play); +void ObjSpinyroll_Update(Actor* thisx, PlayState* play2); void ObjSpinyroll_Draw(Actor* thisx, PlayState* play); void func_80A1E9C4(ObjSpinyroll* this); diff --git a/src/overlays/actors/ovl_Obj_Syokudai/z_obj_syokudai.c b/src/overlays/actors/ovl_Obj_Syokudai/z_obj_syokudai.c index 7625b403f..02a7d59e1 100644 --- a/src/overlays/actors/ovl_Obj_Syokudai/z_obj_syokudai.c +++ b/src/overlays/actors/ovl_Obj_Syokudai/z_obj_syokudai.c @@ -15,7 +15,7 @@ void ObjSyokudai_Init(Actor* thisx, PlayState* play); void ObjSyokudai_Destroy(Actor* thisx, PlayState* play); -void ObjSyokudai_Update(Actor* thisx, PlayState* play); +void ObjSyokudai_Update(Actor* thisx, PlayState* play2); void ObjSyokudai_Draw(Actor* thisx, PlayState* play); const ActorInit Obj_Syokudai_InitVars = { diff --git a/src/overlays/actors/ovl_Obj_Toge/z_obj_toge.c b/src/overlays/actors/ovl_Obj_Toge/z_obj_toge.c index bd5c16413..a37f64b84 100644 --- a/src/overlays/actors/ovl_Obj_Toge/z_obj_toge.c +++ b/src/overlays/actors/ovl_Obj_Toge/z_obj_toge.c @@ -12,7 +12,7 @@ #define THIS ((ObjToge*)thisx) void ObjToge_Init(Actor* thisx, PlayState* play); -void ObjToge_Destroy(Actor* thisx, PlayState* play); +void ObjToge_Destroy(Actor* thisx, PlayState* play2); void ObjToge_Update(Actor* thisx, PlayState* play); void ObjToge_Draw(Actor* thisx, PlayState* play); diff --git a/src/overlays/actors/ovl_Obj_Tsubo/z_obj_tsubo.c b/src/overlays/actors/ovl_Obj_Tsubo/z_obj_tsubo.c index 9d635d7eb..eccc9c2c3 100644 --- a/src/overlays/actors/ovl_Obj_Tsubo/z_obj_tsubo.c +++ b/src/overlays/actors/ovl_Obj_Tsubo/z_obj_tsubo.c @@ -15,9 +15,9 @@ #define THIS ((ObjTsubo*)thisx) void ObjTsubo_Init(Actor* thisx, PlayState* play); -void ObjTsubo_Destroy(Actor* thisx, PlayState* play); +void ObjTsubo_Destroy(Actor* thisx, PlayState* play2); void ObjTsubo_Update(Actor* thisx, PlayState* play); -void ObjTsubo_Draw(Actor* thisx, PlayState* play); +void ObjTsubo_Draw(Actor* thisx, PlayState* play2); void ObjTsubo_PotBreak1(ObjTsubo* this, PlayState* play); void ObjTsubo_RacePotBreak1(ObjTsubo* this, PlayState* play); diff --git a/src/overlays/actors/ovl_Obj_Um/z_obj_um.c b/src/overlays/actors/ovl_Obj_Um/z_obj_um.c index 7cb4f310f..63fe32501 100644 --- a/src/overlays/actors/ovl_Obj_Um/z_obj_um.c +++ b/src/overlays/actors/ovl_Obj_Um/z_obj_um.c @@ -58,7 +58,7 @@ void ObjUm_Update(Actor* thisx, PlayState* play); void ObjUm_Draw(Actor* thisx, PlayState* play); void ObjUm_DefaultAnim(ObjUm* this, PlayState* play); -void ObjUm_ChangeAnim(ObjUm* this, PlayState* play, ObjUmAnimation index); +void ObjUm_ChangeAnim(ObjUm* this, PlayState* play, ObjUmAnimation animIndex); void ObjUm_SetupAction(ObjUm* this, ObjUmActionFunc actionFunc); const ActorInit Obj_Um_InitVars = { diff --git a/src/overlays/actors/ovl_Obj_Vspinyroll/z_obj_vspinyroll.c b/src/overlays/actors/ovl_Obj_Vspinyroll/z_obj_vspinyroll.c index 6740cc684..be692069f 100644 --- a/src/overlays/actors/ovl_Obj_Vspinyroll/z_obj_vspinyroll.c +++ b/src/overlays/actors/ovl_Obj_Vspinyroll/z_obj_vspinyroll.c @@ -13,7 +13,7 @@ void ObjVspinyroll_Init(Actor* thisx, PlayState* play); void ObjVspinyroll_Destroy(Actor* thisx, PlayState* play); -void ObjVspinyroll_Update(Actor* thisx, PlayState* play); +void ObjVspinyroll_Update(Actor* thisx, PlayState* play2); void ObjVspinyroll_Draw(Actor* thisx, PlayState* play); void func_80A3CEC4(ObjVspinyroll* this); diff --git a/src/overlays/actors/ovl_Obj_Warpstone/z_obj_warpstone.c b/src/overlays/actors/ovl_Obj_Warpstone/z_obj_warpstone.c index ea9b35f5c..4e0fb508d 100644 --- a/src/overlays/actors/ovl_Obj_Warpstone/z_obj_warpstone.c +++ b/src/overlays/actors/ovl_Obj_Warpstone/z_obj_warpstone.c @@ -15,7 +15,7 @@ void ObjWarpstone_Init(Actor* thisx, PlayState* play); void ObjWarpstone_Destroy(Actor* thisx, PlayState* play); void ObjWarpstone_Update(Actor* thisx, PlayState* play); -void ObjWarpstone_Draw(Actor* thisx, PlayState* play); +void ObjWarpstone_Draw(Actor* thisx, PlayState* play2); void ObjWarpstone_SetupAction(ObjWarpstone* this, ObjWarpstoneActionFunc actionFunc); s32 ObjWarpstone_ClosedIdle(ObjWarpstone* this, PlayState* play); s32 ObjWarpstone_BeginOpeningCutscene(ObjWarpstone* this, PlayState* play); diff --git a/src/overlays/actors/ovl_Shot_Sun/z_shot_sun.c b/src/overlays/actors/ovl_Shot_Sun/z_shot_sun.c index 093261344..1aa2e545e 100644 --- a/src/overlays/actors/ovl_Shot_Sun/z_shot_sun.c +++ b/src/overlays/actors/ovl_Shot_Sun/z_shot_sun.c @@ -17,7 +17,7 @@ void ShotSun_Destroy(Actor* thisx, PlayState* play); void ShotSun_Update(Actor* thisx, PlayState* play); void ShotSun_UpdateForOcarina(ShotSun* this, PlayState* play); -void ShotSun_UpdateHyliaSun(ShotSun* this, PlayState* play2); +void ShotSun_UpdateHyliaSun(ShotSun* this, PlayState* play); const ActorInit Shot_Sun_InitVars = { ACTOR_SHOT_SUN, diff --git a/src/overlays/effects/ovl_Effect_Ss_Bubble/z_eff_ss_bubble.c b/src/overlays/effects/ovl_Effect_Ss_Bubble/z_eff_ss_bubble.c index bd8a40ed8..3298b2ab3 100644 --- a/src/overlays/effects/ovl_Effect_Ss_Bubble/z_eff_ss_bubble.c +++ b/src/overlays/effects/ovl_Effect_Ss_Bubble/z_eff_ss_bubble.c @@ -14,7 +14,7 @@ #define PARAMS ((EffectSsBubbleInitParams*)initParamsx) u32 EffectSsBubble_Init(PlayState* play, u32 index, EffectSs* this, void* initParamsx); -void EffectSsBubble_Update(PlayState* play, u32 index, EffectSs* this); +void EffectSsBubble_Update(PlayState* play2, u32 index, EffectSs* this); void EffectSsBubble_Draw(PlayState* play, u32 index, EffectSs* this); const EffectSsInit Effect_Ss_Bubble_InitVars = { diff --git a/tools/check_format.sh b/tools/check_format.sh index d8119e743..1195a9c59 100755 --- a/tools/check_format.sh +++ b/tools/check_format.sh @@ -1,7 +1,7 @@ #!/bin/bash STATUSOLD=`git status --porcelain` -./format.sh +./format.py -j if [ $? -ne 0 ] then echo "Formatter failed. Exiting." @@ -12,7 +12,7 @@ STATUSNEW=`git status --porcelain` if [ "${STATUSOLD}" != "${STATUSNEW}" ]; then echo "" - echo "Misformatted files found. Run ./format.sh and verify codegen is not impacted." + echo "Misformatted files found. Run ./format.py and verify codegen is not impacted." echo "" diff --unified=0 --label "Old git status" <(echo "${STATUSOLD}") --label "New git status" <(echo "${STATUSNEW}") echo "" From 362a73a017fe353e09feb9a8592a05f07f7cdb91 Mon Sep 17 00:00:00 2001 From: SonicDcer <96613413+sonicdcer@users.noreply.github.com> Date: Tue, 4 Oct 2022 00:36:12 -0300 Subject: [PATCH 2/7] ovl_En_Bombal OK (#1051) * ovl_En_Bombal OK * alpha * decimal values for weekEventReg * pr review * cutscenes * merge fix * pr review --- assets/xml/objects/object_fusen.xml | 4 +- spec | 3 +- .../actors/ovl_En_Bombal/z_en_bombal.c | 246 ++++++++++++++++-- .../actors/ovl_En_Bombal/z_en_bombal.h | 28 +- .../actors/ovl_En_Bomjima/z_en_bomjima.c | 150 ++++++----- .../actors/ovl_En_Bomjima/z_en_bomjima.h | 16 +- .../actors/ovl_En_Encount2/z_en_encount2.c | 6 +- tools/disasm/functions.txt | 6 +- 8 files changed, 346 insertions(+), 113 deletions(-) diff --git a/assets/xml/objects/object_fusen.xml b/assets/xml/objects/object_fusen.xml index 0ff9e9f6c..2e115b2b7 100644 --- a/assets/xml/objects/object_fusen.xml +++ b/assets/xml/objects/object_fusen.xml @@ -1,7 +1,7 @@  - - + + diff --git a/spec b/spec index 100e615cf..42bbff182 100644 --- a/spec +++ b/spec @@ -4769,8 +4769,7 @@ beginseg name "ovl_En_Bombal" compress include "build/src/overlays/actors/ovl_En_Bombal/z_en_bombal.o" - include "build/data/ovl_En_Bombal/ovl_En_Bombal.data.o" - include "build/data/ovl_En_Bombal/ovl_En_Bombal.reloc.o" + include "build/src/overlays/actors/ovl_En_Bombal/ovl_En_Bombal_reloc.o" endseg beginseg diff --git a/src/overlays/actors/ovl_En_Bombal/z_en_bombal.c b/src/overlays/actors/ovl_En_Bombal/z_en_bombal.c index b4ebb73e6..a4fc5d484 100644 --- a/src/overlays/actors/ovl_En_Bombal/z_en_bombal.c +++ b/src/overlays/actors/ovl_En_Bombal/z_en_bombal.c @@ -5,6 +5,8 @@ */ #include "z_en_bombal.h" +#include "assets/objects/object_fusen/object_fusen.h" +#include "objects/gameplay_keep/gameplay_keep.h" #define FLAGS (ACTOR_FLAG_10) @@ -18,8 +20,11 @@ void EnBombal_Draw(Actor* thisx, PlayState* play); void func_80C05B3C(EnBombal* this, PlayState* play); void func_80C05C44(EnBombal* this, PlayState* play); void func_80C05DE8(EnBombal* this, PlayState* play); +void func_80C05B24(EnBombal* this); +void EnBombal_InitEffects(EnBombal* this, Vec3f* pos, s16 fadeDelay); +void EnBombal_UpdateEffects(EnBombal* this, PlayState* play); +void EnBombal_DrawEffects(EnBombal*, PlayState*); -#if 0 const ActorInit En_Bombal_InitVars = { ACTOR_EN_BOMBAL, ACTORCAT_PROP, @@ -32,37 +37,240 @@ const ActorInit En_Bombal_InitVars = { (ActorFunc)EnBombal_Draw, }; -// static ColliderCylinderInit sCylinderInit = { -static ColliderCylinderInit D_80C06460 = { - { COLTYPE_NONE, AT_NONE, AC_ON | AC_TYPE_PLAYER, OC1_NONE, OC2_TYPE_2, COLSHAPE_CYLINDER, }, - { ELEMTYPE_UNK0, { 0x00000000, 0x00, 0x00 }, { 0x004138B0, 0x00, 0x00 }, TOUCH_NONE | TOUCH_SFX_NORMAL, BUMP_ON, OCELEM_NONE, }, +static ColliderCylinderInit sCylinderInit = { + { + COLTYPE_NONE, + AT_NONE, + AC_ON | AC_TYPE_PLAYER, + OC1_NONE, + OC2_TYPE_2, + COLSHAPE_CYLINDER, + }, + { + ELEMTYPE_UNK0, + { 0x00000000, 0x00, 0x00 }, + { 0x004138B0, 0x00, 0x00 }, + TOUCH_NONE | TOUCH_SFX_NORMAL, + BUMP_ON, + OCELEM_NONE, + }, { 60, 90, -50, { 0, 0, 0 } }, }; -#endif +void EnBombal_Init(Actor* thisx, PlayState* play) { + EnBombal* this = THIS; -extern ColliderCylinderInit D_80C06460; + ActorShape_Init(&this->actor.shape, 0.0f, ActorShadow_DrawCircle, 25.0f); + this->actor.colChkInfo.mass = 0; + Collider_InitAndSetCylinder(play, &this->collider, &this->actor, &sCylinderInit); + this->actor.targetMode = 6; + this->actor.colChkInfo.health = 1; + this->scale = 0.1f; + this->cutscene = this->actor.cutscene; + func_80C05B24(this); +} -extern UNK_TYPE D_06000A00; +void EnBombal_Destroy(Actor* thisx, PlayState* play) { + EnBombal* this = THIS; -#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_En_Bombal/EnBombal_Init.s") + Collider_DestroyCylinder(play, &this->collider); +} -#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_En_Bombal/EnBombal_Destroy.s") +void func_80C05B24(EnBombal* this) { + this->isPopped = false; + this->actionFunc = func_80C05B3C; +} -#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_En_Bombal/func_80C05B24.s") +void func_80C05B3C(EnBombal* this, PlayState* play) { + Player* player; -#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_En_Bombal/func_80C05B3C.s") + this->oscillationAngle += 1500.0f; + this->actor.velocity.y = Math_SinS(this->oscillationAngle); + Math_ApproachF(&this->scale, 0.1f, 0.3f, 0.01f); -#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_En_Bombal/func_80C05C44.s") + if (play->msgCtx.msgLength == 0) { + if (this->collider.base.acFlags & AC_HIT) { + player = GET_PLAYER(play); + this->collider.base.acFlags &= ~AC_HIT; + if (!(gSaveContext.save.weekEventReg[75] & 0x40) && !(gSaveContext.save.weekEventReg[73] & 0x10) && + !(gSaveContext.save.weekEventReg[85] & 2)) { + player->stateFlags1 |= ACTOR_FLAG_20; + this->actor.flags |= ACTOR_FLAG_100000; + } + this->actionFunc = func_80C05C44; + } + } +} -#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_En_Bombal/func_80C05DE8.s") +void func_80C05C44(EnBombal* this, PlayState* play) { + s32 phi_s0 = false; + s32 i; + Vec3f pos; -#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_En_Bombal/EnBombal_Update.s") + if (!(gSaveContext.save.weekEventReg[75] & 0x40) && !(gSaveContext.save.weekEventReg[73] & 0x10) && + !(gSaveContext.save.weekEventReg[85] & 2)) { + if (ActorCutscene_GetCurrentIndex() == 0x7C) { + ActorCutscene_Stop(0x7C); + ActorCutscene_SetIntentToPlay(this->cutscene); + return; + } -#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_En_Bombal/EnBombal_Draw.s") + if (!ActorCutscene_GetCanPlayNext(this->cutscene)) { + ActorCutscene_SetIntentToPlay(this->cutscene); + } else { + ActorCutscene_StartAndSetUnkLinkFields(this->cutscene, &this->actor); + phi_s0 = true; + } + } else { + phi_s0 = true; + } -#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_En_Bombal/func_80C05F90.s") + if (phi_s0) { + Math_Vec3f_Copy(&pos, &this->actor.world.pos); + pos.y += 60.0f; + Actor_Spawn(&play->actorCtx, play, ACTOR_EN_CLEAR_TAG, pos.x, pos.y, pos.z, 255, 255, 200, + CLEAR_TAG_LARGE_EXPLOSION); -#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_En_Bombal/func_80C060B8.s") + for (i = 0; i < 100; i++) { + EnBombal_InitEffects(this, &pos, 10); + } -#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_En_Bombal/func_80C06208.s") + gSaveContext.save.weekEventReg[83] |= 4; + Actor_PlaySfxAtPos(&this->actor, NA_SE_EV_MUJURA_BALLOON_BROKEN); + this->timer = 30; + this->isPopped = true; + this->actionFunc = func_80C05DE8; + } +} + +void func_80C05DE8(EnBombal* this, PlayState* play) { + if (this->timer == 0) { + if (!(gSaveContext.save.weekEventReg[75] & 0x40) && !(gSaveContext.save.weekEventReg[73] & 0x10) && + !(gSaveContext.save.weekEventReg[85] & 2)) { + ActorCutscene_Stop(this->cutscene); + } + Actor_MarkForDeath(&this->actor); + } else if (this->timer < 10) { + this->actor.colChkInfo.health = 0; + } +} + +void EnBombal_Update(Actor* thisx, PlayState* play) { + s32 pad; + EnBombal* this = THIS; + + if (this->timer != 0) { + this->timer--; + } + + this->actor.shape.rot.y = this->actor.world.rot.y; + + Actor_SetFocus(&this->actor, 30.0f); + Actor_SetScale(&this->actor, this->scale); + + this->actionFunc(this, play); + + Actor_MoveWithGravity(&this->actor); + EnBombal_UpdateEffects(this, play); + + if (!this->isPopped) { + Collider_UpdateCylinder(&this->actor, &this->collider); + CollisionCheck_SetAC(play, &play->colChkCtx, &this->collider.base); + } +} + +void EnBombal_Draw(Actor* thisx, PlayState* play) { + EnBombal* this = THIS; + + if (this->isPopped != true) { + Gfx_DrawDListOpa(play, gMajoraBalloonDL); + Gfx_DrawDListOpa(play, gMajoraBalloonKnotDL); + } + EnBombal_DrawEffects(this, play); +} + +void EnBombal_InitEffects(EnBombal* this, Vec3f* pos, s16 fadeDelay) { + s16 i; + EnBombalEffect* sPtr = this->effects; + + for (i = 0; i < ARRAY_COUNT(this->effects); i++, sPtr++) { + if (!sPtr->isEnabled) { + sPtr->isEnabled = true; + sPtr->pos = *pos; + sPtr->alphaFadeDelay = fadeDelay; + sPtr->alpha = 255; + + sPtr->accel.x = (Rand_ZeroOne() - 0.5f) * 10.0f; + sPtr->accel.y = (Rand_ZeroOne() - 0.5f) * 10.0f; + sPtr->accel.z = (Rand_ZeroOne() - 0.5f) * 10.0f; + + sPtr->velocity.x = Rand_ZeroOne() - 0.5f; + sPtr->velocity.y = Rand_ZeroOne() - 0.5f; + sPtr->velocity.z = Rand_ZeroOne() - 0.5f; + + sPtr->scale = (Rand_ZeroFloat(1.0f) * 0.5f) + 2.0f; + return; + } + } +} + +void EnBombal_UpdateEffects(EnBombal* this, PlayState* play) { + s32 i; + EnBombalEffect* sPtr = this->effects; + + for (i = 0; i < ARRAY_COUNT(this->effects); i++, sPtr++) { + if (sPtr->isEnabled) { + sPtr->pos.x += sPtr->velocity.x; + sPtr->pos.y += sPtr->velocity.y; + sPtr->pos.z += sPtr->velocity.z; + sPtr->velocity.x += sPtr->accel.x; + sPtr->velocity.y += sPtr->accel.y; + sPtr->velocity.z += sPtr->accel.z; + + if (sPtr->alphaFadeDelay != 0) { + sPtr->alphaFadeDelay--; + } else { + sPtr->alpha -= 10; + if (sPtr->alpha < 10) { + sPtr->isEnabled = 0; + } + } + } + } +} + +void EnBombal_DrawEffects(EnBombal* this, PlayState* play) { + s16 i; + GraphicsContext* gfxCtx = play->state.gfxCtx; + EnBombalEffect* sPtr = this->effects; + + OPEN_DISPS(gfxCtx); + + func_8012C28C(gfxCtx); + func_8012C2DC(play->state.gfxCtx); + + for (i = 0; i < ARRAY_COUNT(this->effects); i++, sPtr++) { + if (sPtr->isEnabled != 0) { + Matrix_Translate(sPtr->pos.x, sPtr->pos.y, sPtr->pos.z, MTXMODE_NEW); + Matrix_Scale(sPtr->scale, sPtr->scale, sPtr->scale, MTXMODE_APPLY); + + POLY_XLU_DISP = Gfx_CallSetupDL(POLY_XLU_DISP, 0x14); + + gSPSegment(POLY_XLU_DISP++, 0x08, Lib_SegmentedToVirtual(&gSun1Tex)); + + gSPDisplayList(POLY_XLU_DISP++, &gSunSparkleMaterialDL); + + gDPPipeSync(POLY_XLU_DISP++); + + gDPSetPrimColor(POLY_XLU_DISP++, 0, 0, 255, 255, 255, 255); + gDPSetEnvColor(POLY_XLU_DISP++, 250, 180, 255, sPtr->alpha); + + Matrix_Mult(&play->billboardMtxF, MTXMODE_APPLY); + Matrix_RotateZF(DEGF_TO_RADF(play->state.frames * 20.0f), MTXMODE_APPLY); + + gSPMatrix(POLY_XLU_DISP++, Matrix_NewMtx(play->state.gfxCtx), G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_MODELVIEW); + gSPDisplayList(POLY_XLU_DISP++, &gSunSparkleModelDL); + } + } + CLOSE_DISPS(gfxCtx); +} diff --git a/src/overlays/actors/ovl_En_Bombal/z_en_bombal.h b/src/overlays/actors/ovl_En_Bombal/z_en_bombal.h index 5731208a4..a678fe1d8 100644 --- a/src/overlays/actors/ovl_En_Bombal/z_en_bombal.h +++ b/src/overlays/actors/ovl_En_Bombal/z_en_bombal.h @@ -7,15 +7,27 @@ struct EnBombal; typedef void (*EnBombalActionFunc)(struct EnBombal*, PlayState*); +typedef struct EnBombalEffect { + /* 0x00 */ u8 isEnabled; + /* 0x04 */ Vec3f pos; + /* 0x10 */ UNK_TYPE4 unk10; + /* 0x14 */ s16 alpha; + /* 0x16 */ s16 alphaFadeDelay; + /* 0x18 */ Vec3f velocity; + /* 0x24 */ Vec3f accel; + /* 0x30 */ f32 scale; +} EnBombalEffect; + typedef struct EnBombal { - /* 0x0000 */ Actor actor; - /* 0x0144 */ EnBombalActionFunc actionFunc; - /* 0x0148 */ char unk148[0x4]; - /* 0x014C */ s16 unk_14C; - /* 0x0150 */ f32 unk_150; - /* 0x0154 */ char unk154[0x150]; - /* 0x02A4 */ Vec3f unk_2A4; - /* 0x02B0 */ char unk2B0[0x2794]; + /* 0x000 */ Actor actor; + /* 0x144 */ EnBombalActionFunc actionFunc; + /* 0x148 */ s16 timer; + /* 0x14A */ s16 isPopped; + /* 0x14C */ s16 cutscene; + /* 0x150 */ f32 scale; + /* 0x154 */ f32 oscillationAngle; + /* 0x158 */ ColliderCylinder collider; + /* 0x1A4 */ EnBombalEffect effects[200]; } EnBombal; // size = 0x2A44 extern const ActorInit En_Bombal_InitVars; diff --git a/src/overlays/actors/ovl_En_Bomjima/z_en_bomjima.c b/src/overlays/actors/ovl_En_Bomjima/z_en_bomjima.c index 6c5a6f235..48b953ffe 100644 --- a/src/overlays/actors/ovl_En_Bomjima/z_en_bomjima.c +++ b/src/overlays/actors/ovl_En_Bomjima/z_en_bomjima.c @@ -39,6 +39,17 @@ void func_80C00168(EnBomjima* this, PlayState* play); void func_80C00234(EnBomjima* this); void func_80C00284(EnBomjima* this, PlayState* play); +typedef enum EN_BOMJIMA_ACTION { + /* 0 */ EN_BOMJIMA_ACTION_0, + /* 1 */ EN_BOMJIMA_ACTION_1, + /* 2 */ EN_BOMJIMA_ACTION_2, + /* 3 */ EN_BOMJIMA_ACTION_3, + /* 4 */ EN_BOMJIMA_ACTION_4, + /* 5 */ EN_BOMJIMA_ACTION_5, + /* 6 */ EN_BOMJIMA_ACTION_6, + /* 7 */ EN_BOMJIMA_ACTION_7, +} EN_BOMJIMA_ACTION; + static s32 D_80C009F0 = 0; static s32 D_80C009F4 = 0; @@ -129,7 +140,7 @@ void EnBomjima_Init(Actor* thisx, PlayState* play) { while (cs != -1) { // clang-format off - this->unk_2D4[i] = cs; cs = ActorCutscene_GetAdditionalCutscene(cs); + this->cutscenes[i] = cs; cs = ActorCutscene_GetAdditionalCutscene(cs); // clang-format on i++; } @@ -197,31 +208,31 @@ void func_80BFE32C(EnBomjima* this, PlayState* play, s32 arg2) { } } -void func_80BFE494(EnBomjima* this, s32 arg1, f32 arg2) { - this->unk_2EC = arg1; - this->unk_2CC = Animation_GetLastFrame(sAnimations[arg1]); - Animation_Change(&this->skelAnime, sAnimations[this->unk_2EC], arg2, 0.0f, this->unk_2CC, D_80C00AE4[this->unk_2EC], - -4.0f); +void func_80BFE494(EnBomjima* this, s32 animIndex, f32 playSpeed) { + this->animIndex = animIndex; + this->animLastFrame = Animation_GetLastFrame(sAnimations[animIndex]); + Animation_Change(&this->skelAnime, sAnimations[this->animIndex], playSpeed, 0.0f, this->animLastFrame, + D_80C00AE4[this->animIndex], -4.0f); } void func_80BFE524(EnBomjima* this) { - if ((this->unk_2EC == 5) && + if ((this->animIndex == 5) && (Animation_OnFrame(&this->skelAnime, 9.0f) || Animation_OnFrame(&this->skelAnime, 10.0f) || Animation_OnFrame(&this->skelAnime, 17.0f) || Animation_OnFrame(&this->skelAnime, 18.0f))) { Actor_PlaySfxAtPos(&this->actor, NA_SE_EV_BOMBERS_WALK); } - if ((this->unk_2EC == 18) && + if ((this->animIndex == 18) && (Animation_OnFrame(&this->skelAnime, 0.0f) || Animation_OnFrame(&this->skelAnime, 2.0f) || Animation_OnFrame(&this->skelAnime, 4.0f) || Animation_OnFrame(&this->skelAnime, 6.0f))) { Actor_PlaySfxAtPos(&this->actor, NA_SE_EV_BOMBERS_WALK); } - if ((this->unk_2EC == 15) && Animation_OnFrame(&this->skelAnime, 15.0f)) { + if ((this->animIndex == 15) && Animation_OnFrame(&this->skelAnime, 15.0f)) { Actor_PlaySfxAtPos(&this->actor, NA_SE_EV_BOMBERS_LAND); } - if ((this->unk_2EC == 6) && Animation_OnFrame(&this->skelAnime, 8.0f)) { + if ((this->animIndex == 6) && Animation_OnFrame(&this->skelAnime, 8.0f)) { Actor_PlaySfxAtPos(&this->actor, NA_SE_EV_BOMBERS_LAND); } } @@ -326,10 +337,11 @@ void func_80BFEA94(EnBomjima* this, PlayState* play) { continue; } - this->unk_2F0 = (EnBombal*)actor; + this->bombal = (EnBombal*)actor; Math_Vec3f_Copy(&this->unk_2B0, &actor->world.pos); - if (this->unk_2F4 == 0) { - this->unk_2F4 = this->unk_2F0->actor.cutscene; + + if (this->bombalCutscene == 0) { + this->bombalCutscene = this->bombal->actor.cutscene; } func_80BFEB1C(this); break; @@ -339,7 +351,7 @@ void func_80BFEA94(EnBomjima* this, PlayState* play) { void func_80BFEB1C(EnBomjima* this) { func_80BFE494(this, 1, 1.0f); func_80BFE65C(this); - this->unk_2A0 = 0; + this->action = EN_BOMJIMA_ACTION_0; this->actionFunc = func_80BFEB64; } @@ -381,7 +393,7 @@ void func_80BFEB64(EnBomjima* this, PlayState* play) { func_800B8614(&this->actor, play, 70.0f); } - if ((this->unk_2F0->actor.update == NULL) || (this->unk_2F0->actor.colChkInfo.health == 0)) { + if ((this->bombal->actor.update == NULL) || (this->bombal->actor.colChkInfo.health == 0)) { func_80BFEFF0(this); return; } @@ -394,14 +406,14 @@ void func_80BFEB64(EnBomjima* this, PlayState* play) { break; case 1: - this->unk_2DC = Math_Vec3f_Yaw(&this->actor.world.pos, &this->unk_2F0->actor.world.pos); + this->unk_2DC = Math_Vec3f_Yaw(&this->actor.world.pos, &this->bombal->actor.world.pos); if (Animation_OnFrame(&this->skelAnime, 19.0f)) { this->unk_2C0 = 5; Actor_PlaySfxAtPos(&this->actor, NA_SE_EV_BOMBERS_SHOT_BREATH); } if (this->unk_2C0 == 1) { - s16 sp3E = Math_Vec3f_Yaw(&this->actor.world.pos, &this->unk_2F0->actor.world.pos); + s16 sp3E = Math_Vec3f_Yaw(&this->actor.world.pos, &this->bombal->actor.world.pos); if (Rand_ZeroOne() < 0.5f) { sp3E += 0x4000; @@ -409,9 +421,9 @@ void func_80BFEB64(EnBomjima* this, PlayState* play) { sp3E += 0xC000; } - sp40.x = (Math_SinS(sp3E) * (Rand_ZeroFloat(20.0f) + 40.0f)) + this->unk_2F0->actor.world.pos.x; - sp40.y = this->unk_2F0->actor.world.pos.y - randPlusMinusPoint5Scaled(40.0f); - sp40.z = (Math_CosS(sp3E) * (Rand_ZeroFloat(20.0f) + 40.0f)) + this->unk_2F0->actor.world.pos.z; + sp40.x = (Math_SinS(sp3E) * (Rand_ZeroFloat(20.0f) + 40.0f)) + this->bombal->actor.world.pos.x; + sp40.y = this->bombal->actor.world.pos.y - randPlusMinusPoint5Scaled(40.0f); + sp40.z = (Math_CosS(sp3E) * (Rand_ZeroFloat(20.0f) + 40.0f)) + this->bombal->actor.world.pos.z; SoundSource_PlaySfxAtFixedWorldPos(play, &sp40, 50, NA_SE_EV_BOMBERS_SHOT_EXPLOSUIN); EffectSsHitmark_SpawnFixedScale(play, 0, &sp40); @@ -443,10 +455,10 @@ void func_80BFEB64(EnBomjima* this, PlayState* play) { } void func_80BFEFF0(EnBomjima* this) { - this->unk_2F0 = NULL; + this->bombal = NULL; func_80BFE494(this, 19, 1.0f); func_80BFE65C(this); - this->unk_2A0 = 1; + this->action = EN_BOMJIMA_ACTION_1; this->actionFunc = func_80BFF03C; } @@ -455,25 +467,25 @@ void func_80BFF03C(EnBomjima* this, PlayState* play) { if (ActorCutscene_GetCurrentIndex() == 0x7C) { ActorCutscene_Stop(0x7C); - ActorCutscene_SetIntentToPlay(this->unk_2D4[0]); - } else if (!ActorCutscene_GetCanPlayNext(this->unk_2D4[0])) { - ActorCutscene_SetIntentToPlay(this->unk_2D4[0]); + ActorCutscene_SetIntentToPlay(this->cutscenes[0]); + } else if (!ActorCutscene_GetCanPlayNext(this->cutscenes[0])) { + ActorCutscene_SetIntentToPlay(this->cutscenes[0]); } else { player->stateFlags1 &= ~0x20; gSaveContext.save.weekEventReg[83] &= (u8)~4; this->actor.world.rot.y = Camera_GetCamDirYaw(GET_ACTIVE_CAM(play)); this->unk_2DC = Camera_GetCamDirYaw(GET_ACTIVE_CAM(play)); - ActorCutscene_StartAndSetUnkLinkFields(this->unk_2D4[0], &this->actor); + ActorCutscene_StartAndSetUnkLinkFields(this->cutscenes[0], &this->actor); func_80BFF120(this); } } void func_80BFF120(EnBomjima* this) { func_80BFE65C(this); - this->unk_2C4 = 30; + this->cutsceneTimer = 30; func_80BFE494(this, 6, 1.0f); - this->unk_2DE = 0; - this->unk_2A0 = 2; + this->cutsceneEnded = false; + this->action = EN_BOMJIMA_ACTION_2; this->actionFunc = func_80BFF174; } @@ -481,9 +493,9 @@ void func_80BFF174(EnBomjima* this, PlayState* play) { f32 sp2C = this->skelAnime.curFrame; Player* player = GET_PLAYER(play); - if (this->unk_2C4 == 1) { - ActorCutscene_Stop(this->unk_2D4[0]); - this->unk_2DE = 1; + if (this->cutsceneTimer == 1) { + ActorCutscene_Stop(this->cutscenes[0]); + this->cutsceneEnded = true; } if (Text_GetFaceReaction(play, 0x11) != 0) { @@ -498,9 +510,9 @@ void func_80BFF174(EnBomjima* this, PlayState* play) { Math_SmoothStepToS(&this->actor.world.rot.y, this->unk_2DC, 1, 5000, 0); - if ((this->unk_2CC <= sp2C) && (this->unk_2BC < 5)) { + if ((this->animLastFrame <= sp2C) && (this->unk_2BC < 5)) { this->unk_2BC++; - if (this->unk_2EC != 19) { + if (this->animIndex != 19) { func_80BFE494(this, 19, 1.0f); } } @@ -541,7 +553,7 @@ void func_80BFF174(EnBomjima* this, PlayState* play) { func_80BFE32C(this, play, 1); } - if (this->unk_2DE != 0) { + if (this->cutsceneEnded != false) { if (this->unk_2BC >= 5) { func_80BFE67C(this, play); } @@ -551,20 +563,20 @@ void func_80BFF174(EnBomjima* this, PlayState* play) { void func_80BFF3F0(EnBomjima* this) { func_80BFE494(this, 15, 1.0f); - this->unk_2A0 = 3; + this->action = EN_BOMJIMA_ACTION_3; this->actionFunc = func_80BFF430; } void func_80BFF430(EnBomjima* this, PlayState* play) { f32 curFrame = this->skelAnime.curFrame; - if (this->unk_2CC <= curFrame) { + if (this->animLastFrame <= curFrame) { EnBombal* bombal = (EnBombal*)Actor_Spawn(&play->actorCtx, play, ACTOR_EN_BOMBAL, this->unk_2B0.x, this->unk_2B0.y, this->unk_2B0.z, 0, 0, 0, 0); if (bombal != NULL) { - bombal->unk_150 = 0.0f; - bombal->unk_14C = this->unk_2F4; + bombal->scale = 0.0f; + bombal->cutscene = this->bombalCutscene; Actor_ChangeFocus(&this->actor, play, &bombal->actor); gSaveContext.save.weekEventReg[83] &= (u8)~4; func_80BFE65C(this); @@ -576,7 +588,7 @@ void func_80BFF430(EnBomjima* this, PlayState* play) { void func_80BFF4F4(EnBomjima* this) { func_80BFE65C(this); - this->unk_2A0 = 4; + this->action = EN_BOMJIMA_ACTION_4; this->actionFunc = func_80BFF52C; } @@ -599,7 +611,7 @@ void func_80BFF52C(EnBomjima* this, PlayState* play) { func_80151938(play, this->actor.textId); play_sound(NA_SE_SY_FOUND); func_80BFE494(this, 15, 1.0f); - this->unk_2A0 = 5; + this->action = EN_BOMJIMA_ACTION_5; this->actionFunc = func_80BFF6CC; } else { Player* player = GET_PLAYER(play); @@ -623,7 +635,7 @@ void func_80BFF52C(EnBomjima* this, PlayState* play) { void func_80BFF6CC(EnBomjima* this, PlayState* play) { f32 curFrame = this->skelAnime.curFrame; - if (this->unk_2CC <= curFrame) { + if (this->animLastFrame <= curFrame) { if ((Message_GetState(&play->msgCtx) == TEXT_STATE_5) && Message_ShouldAdvance(play)) { func_801477B4(play); func_80BFE494(this, 1, 1.0f); @@ -635,7 +647,7 @@ void func_80BFF6CC(EnBomjima* this, PlayState* play) { void func_80BFF754(EnBomjima* this, PlayState* play) { Player* player = GET_PLAYER(play); Vec3f spA0; - EnBombal* temp_s3; + EnBomjima* bomjima; s32 i; f32 x; f32 y; @@ -643,12 +655,12 @@ void func_80BFF754(EnBomjima* this, PlayState* play) { if (ActorCutscene_GetCurrentIndex() == 0x7C) { ActorCutscene_Stop(0x7C); - ActorCutscene_SetIntentToPlay(this->unk_2D4[1]); + ActorCutscene_SetIntentToPlay(this->cutscenes[1]); return; } - if (!ActorCutscene_GetCanPlayNext(this->unk_2D4[1])) { - ActorCutscene_SetIntentToPlay(this->unk_2D4[1]); + if (!ActorCutscene_GetCanPlayNext(this->cutscenes[1])) { + ActorCutscene_SetIntentToPlay(this->cutscenes[1]); return; } @@ -663,9 +675,9 @@ void func_80BFF754(EnBomjima* this, PlayState* play) { spA0.y += y * (2.0f + (i * 0.2f)); spA0.z += z * (2.0f + (i * 0.2f)); - temp_s3 = (EnBombal*)Actor_SpawnAsChild(&play->actorCtx, &this->actor, play, ACTOR_EN_BOMJIMA, spA0.x, spA0.y, - spA0.z, 0, 0, 0, i + 32); - if (temp_s3 != NULL) { + bomjima = (EnBomjima*)Actor_SpawnAsChild(&play->actorCtx, &this->actor, play, ACTOR_EN_BOMJIMA, spA0.x, spA0.y, + spA0.z, 0, 0, 0, i + 32); + if (bomjima != NULL) { s32 index = (i * 2) - 2; Math_Vec3f_Copy(&spA0, &this->actor.world.pos); @@ -673,12 +685,12 @@ void func_80BFF754(EnBomjima* this, PlayState* play) { spA0.x += Math_SinS(D_80C00AF8[(i * 2) - 2] + this->actor.world.rot.y) * D_80C00AF8[index + 1]; spA0.z += Math_CosS(D_80C00AF8[index] + this->actor.world.rot.y) * D_80C00AF8[index + 1]; - Math_Vec3f_Copy(&temp_s3->unk_2A4, &spA0); + Math_Vec3f_Copy(&bomjima->unk_2A4, &spA0); } } D_80C009F0 = 0; - ActorCutscene_StartAndSetUnkLinkFields(this->unk_2D4[1], &this->actor); + ActorCutscene_StartAndSetUnkLinkFields(this->cutscenes[1], &this->actor); this->actionFunc = func_80BFF9B0; } @@ -741,7 +753,7 @@ void func_80BFFB40(EnBomjima* this, PlayState* play) { void func_80BFFBC4(EnBomjima* this, PlayState* play) { f32 curFrame = this->skelAnime.curFrame; - if ((this->unk_2EC != 1) && (this->unk_2CC <= curFrame)) { + if ((this->animIndex != 1) && (this->animLastFrame <= curFrame)) { func_80BFE494(this, 1, 1.0f); } @@ -762,14 +774,14 @@ void func_80BFFBC4(EnBomjima* this, PlayState* play) { play->transitionTrigger = TRANS_TRIGGER_START; play->transitionType = TRANS_TYPE_86; gSaveContext.nextTransitionType = TRANS_TYPE_03; - ActorCutscene_Stop(this->unk_2D4[1]); + ActorCutscene_Stop(this->cutscenes[1]); } } void func_80BFFCFC(EnBomjima* this) { func_80BFE65C(this); func_80BFE494(this, 18, 1.0f); - this->unk_2A0 = 6; + this->action = EN_BOMJIMA_ACTION_6; this->actionFunc = func_80BFFD48; } @@ -825,22 +837,22 @@ void func_80BFFF54(EnBomjima* this, PlayState* play) { } if (this->unk_2E4 != 4) { - if ((this->unk_2EC != 0) && (this->unk_2CC <= curFrame)) { + if ((this->animIndex != 0) && (this->animLastFrame <= curFrame)) { D_80C009F0++; func_80BFE494(this, 0, 1.0f); } - } else if ((this->unk_2EC != 8) && (this->unk_2CC <= curFrame)) { + } else if ((this->animIndex != 8) && (this->animLastFrame <= curFrame)) { func_80BFE494(this, 8, 1.0f); D_80C009F4 = 1; } - if (this->unk_2EC == 8) { + if (this->animIndex == 8) { if ((D_80C009F4 == 1) && Animation_OnFrame(&this->skelAnime, 7.0f)) { Actor_PlaySfxAtPos(&this->actor, NA_SE_EV_HUMAN_BOUND); D_80C009F4 = 2; } - if ((this->unk_2CC <= curFrame) && (this->unk_2C0 == 0)) { + if ((this->animLastFrame <= curFrame) && (this->unk_2C0 == 0)) { this->unk_2C0 = 10; } @@ -853,7 +865,7 @@ void func_80BFFF54(EnBomjima* this, PlayState* play) { void func_80C0011C(EnBomjima* this) { func_80BFE65C(this); func_80BFE494(this, 0, 1.0f); - this->unk_2A0 = 7; + this->action = EN_BOMJIMA_ACTION_7; this->actionFunc = func_80C00168; } @@ -894,8 +906,9 @@ void func_80C00284(EnBomjima* this, PlayState* play) { f32 sp28 = this->skelAnime.curFrame; Math_SmoothStepToS(&this->actor.world.rot.y, this->unk_2DC, 1, 5000, 0); - if (((this->unk_2A0 == 0) || (this->unk_2C8 == 10) || (this->unk_2C8 == 11) || (this->unk_2CA == 1)) && - (this->unk_2CC <= sp28)) { + if (((this->action == EN_BOMJIMA_ACTION_0) || (this->unk_2C8 == 10) || (this->unk_2C8 == 11) || + (this->unk_2CA == 1)) && + (this->animLastFrame <= sp28)) { if (!(this->unk_2BC & 1)) { func_80BFE494(this, 3, 1.0f); } else { @@ -919,14 +932,15 @@ void func_80C00284(EnBomjima* this, PlayState* play) { if ((Message_GetState(&play->msgCtx) == TEXT_STATE_5) && Message_ShouldAdvance(play)) { this->collider.dim.radius = 10; this->collider.dim.height = 30; - if ((this->unk_2A0 == 4) || (this->unk_2CA == 1) || ((this->unk_2CA == 3) && (this->unk_2C8 >= 2))) { + if ((this->action == EN_BOMJIMA_ACTION_4) || (this->unk_2CA == 1) || + ((this->unk_2CA == 3) && (this->unk_2C8 >= 2))) { this->unk_28E = 0; if (player->stateFlags1 & 0x20) { player->stateFlags1 &= ~0x20; } - if ((this->unk_2F0 == 0) || (this->unk_2F0->actor.update == NULL) || - (this->unk_2F0->actor.colChkInfo.health <= 0)) { + if ((this->bombal == 0) || (this->bombal->actor.update == NULL) || + (this->bombal->actor.colChkInfo.health <= 0)) { func_80BFF3F0(this); } else { func_80BFE65C(this); @@ -941,7 +955,7 @@ void func_80C00284(EnBomjima* this, PlayState* play) { switch (this->unk_2CA) { case 0: this->unk_28E = 0; - if (this->unk_2A0 == 7) { + if (this->action == EN_BOMJIMA_ACTION_7) { func_80C0011C(this); } else { func_80BFEB1C(this); @@ -953,7 +967,7 @@ void func_80C00284(EnBomjima* this, PlayState* play) { func_80BFE65C(this); this->unk_28E = 0; func_80BFE494(this, 1, 1.0f); - this->unk_2A0 = 2; + this->action = EN_BOMJIMA_ACTION_2; this->actionFunc = func_80BFF174; return; } @@ -1008,8 +1022,8 @@ void EnBomjima_Update(Actor* thisx, PlayState* play) { this->unk_2C6--; } - if (this->unk_2C4 != 0) { - this->unk_2C4--; + if (this->cutsceneTimer != 0) { + this->cutsceneTimer--; } SkelAnime_Update(&this->skelAnime); diff --git a/src/overlays/actors/ovl_En_Bomjima/z_en_bomjima.h b/src/overlays/actors/ovl_En_Bomjima/z_en_bomjima.h index b247e03ea..046e8813c 100644 --- a/src/overlays/actors/ovl_En_Bomjima/z_en_bomjima.h +++ b/src/overlays/actors/ovl_En_Bomjima/z_en_bomjima.h @@ -26,7 +26,7 @@ typedef struct EnBomjima { /* 0x296 */ UNK_TYPE1 unk296[4]; /* 0x29A */ s16 unk_29A; /* 0x29C */ UNK_TYPE1 unk29C[4]; - /* 0x2A0 */ s16 unk_2A0; + /* 0x2A0 */ s16 action; /* 0x2A2 */ s16 unk_2A2; /* 0x2A4 */ Vec3f unk_2A4; /* 0x2B0 */ Vec3f unk_2B0; @@ -34,25 +34,25 @@ typedef struct EnBomjima { /* 0x2BE */ s16 unk_2BE; /* 0x2C0 */ s16 unk_2C0; /* 0x2C2 */ s16 unk_2C2; - /* 0x2C4 */ s16 unk_2C4; + /* 0x2C4 */ s16 cutsceneTimer; /* 0x2C6 */ s16 unk_2C6; /* 0x2C8 */ s16 unk_2C8; /* 0x2CA */ s16 unk_2CA; - /* 0x2CC */ f32 unk_2CC; + /* 0x2CC */ f32 animLastFrame; /* 0x2D0 */ f32 unk_2D0; - /* 0x2D4 */ s16 unk_2D4[2]; + /* 0x2D4 */ s16 cutscenes[2]; /* 0x2D8 */ UNK_TYPE1 unk2D8[4]; // maybe a part of the above? /* 0x2DC */ s16 unk_2DC; - /* 0x2DE */ s16 unk_2DE; + /* 0x2DE */ s16 cutsceneEnded; /* 0x2E0 */ s16 unk_2E0; /* 0x2E2 */ s16 unk_2E2; /* 0x2E4 */ s16 unk_2E4; /* 0x2E6 */ s16 unk_2E6; /* 0x2E8 */ s16 unk_2E8; /* 0x2EA */ s16 unk_2EA; - /* 0x2EC */ s32 unk_2EC; - /* 0x2F0 */ EnBombal* unk_2F0; - /* 0x2F4 */ s16 unk_2F4; + /* 0x2EC */ s32 animIndex; + /* 0x2F0 */ EnBombal* bombal; + /* 0x2F4 */ s16 bombalCutscene; /* 0x2F8 */ ColliderCylinder collider; } EnBomjima; // size = 0x344 diff --git a/src/overlays/actors/ovl_En_Encount2/z_en_encount2.c b/src/overlays/actors/ovl_En_Encount2/z_en_encount2.c index b7c698376..506f14790 100644 --- a/src/overlays/actors/ovl_En_Encount2/z_en_encount2.c +++ b/src/overlays/actors/ovl_En_Encount2/z_en_encount2.c @@ -208,8 +208,8 @@ void EnEncount2_Update(Actor* thisx, PlayState* play) { void EnEncount2_Draw(Actor* thisx, PlayState* play) { EnEncount2* this = THIS; if (this->isPopped != true) { - Gfx_DrawDListOpa(play, object_fusen_DL_000A00); - Gfx_DrawDListOpa(play, object_fusen_DL_000D78); + Gfx_DrawDListOpa(play, gMajoraBalloonDL); + Gfx_DrawDListOpa(play, gMajoraBalloonKnotDL); } EnEncount2_DrawEffects(this, play); } @@ -223,7 +223,7 @@ void EnEncount2_InitEffects(EnEncount2* this, Vec3f* pos, s16 fadeDelay) { sPtr->isEnabled = true; sPtr->pos = *pos; sPtr->alphaFadeDelay = fadeDelay; - sPtr->alpha = 0xFF; + sPtr->alpha = 255; sPtr->accel.x = (Rand_ZeroOne() - 0.5f) * 10.0f; sPtr->accel.y = (Rand_ZeroOne() - 0.5f) * 10.0f; diff --git a/tools/disasm/functions.txt b/tools/disasm/functions.txt index 20fa0265c..3431e755a 100644 --- a/tools/disasm/functions.txt +++ b/tools/disasm/functions.txt @@ -16552,9 +16552,9 @@ 0x80C05DE8:("func_80C05DE8",), 0x80C05E7C:("EnBombal_Update",), 0x80C05F30:("EnBombal_Draw",), - 0x80C05F90:("func_80C05F90",), - 0x80C060B8:("func_80C060B8",), - 0x80C06208:("func_80C06208",), + 0x80C05F90:("EnBombal_InitEffects",), + 0x80C060B8:("EnBombal_UpdateEffects",), + 0x80C06208:("EnBombal_DrawEffects",), 0x80C06510:("ObjMoonStone_Init",), 0x80C0661C:("ObjMoonStone_Destroy",), 0x80C0662C:("func_80C0662C",), From 4833c08364014ac93727c907f0f149d5426fad30 Mon Sep 17 00:00:00 2001 From: SonicDcer <96613413+sonicdcer@users.noreply.github.com> Date: Tue, 4 Oct 2022 01:03:53 -0300 Subject: [PATCH 3/7] ovl_Oceff_Storm OK (#1010) * all functions matching * all functions matching * all functions matching (for real this time) * data extracted and imported * ovl_Oceff_Storm OK * reloc * pr review * texture name * renamings * renamings * Magic_Reset * pr review * gSPTextureRectangle * pr review --- assets/xml/overlays/ovl_Oceff_Storm.xml | 12 ++ spec | 3 +- .../actors/ovl_Oceff_Storm/z_oceff_storm.c | 198 ++++++++++++++++-- .../actors/ovl_Oceff_Storm/z_oceff_storm.h | 10 +- tools/disasm/functions.txt | 4 +- 5 files changed, 208 insertions(+), 19 deletions(-) create mode 100644 assets/xml/overlays/ovl_Oceff_Storm.xml diff --git a/assets/xml/overlays/ovl_Oceff_Storm.xml b/assets/xml/overlays/ovl_Oceff_Storm.xml new file mode 100644 index 000000000..6b8dc0228 --- /dev/null +++ b/assets/xml/overlays/ovl_Oceff_Storm.xml @@ -0,0 +1,12 @@ + + + + + + + + + + + + diff --git a/spec b/spec index 42bbff182..207b70da1 100644 --- a/spec +++ b/spec @@ -1938,8 +1938,7 @@ beginseg name "ovl_Oceff_Storm" compress include "build/src/overlays/actors/ovl_Oceff_Storm/z_oceff_storm.o" - include "build/data/ovl_Oceff_Storm/ovl_Oceff_Storm.data.o" - include "build/data/ovl_Oceff_Storm/ovl_Oceff_Storm.reloc.o" + include "build/src/overlays/actors/ovl_Oceff_Storm/ovl_Oceff_Storm_reloc.o" endseg beginseg diff --git a/src/overlays/actors/ovl_Oceff_Storm/z_oceff_storm.c b/src/overlays/actors/ovl_Oceff_Storm/z_oceff_storm.c index 68ee9d27f..3a4faceea 100644 --- a/src/overlays/actors/ovl_Oceff_Storm/z_oceff_storm.c +++ b/src/overlays/actors/ovl_Oceff_Storm/z_oceff_storm.c @@ -15,12 +15,10 @@ void OceffStorm_Destroy(Actor* thisx, PlayState* play); void OceffStorm_Update(Actor* thisx, PlayState* play); void OceffStorm_Draw(Actor* thisx, PlayState* play); -void func_80981928(OceffStorm* this, PlayState* play); +void OceffStorm_DefaultAction(OceffStorm* this, PlayState* play); void func_80981B48(OceffStorm* this, PlayState* play); +void OceffStorm_Draw2(Actor* thisx, PlayState* play); -void OceffStorm_SetupAction(OceffStorm* this, OceffStormActionFunc actionFunc); - -#if 0 const ActorInit Oceff_Storm_InitVars = { ACTOR_OCEFF_STORM, ACTORCAT_ITEMACTION, @@ -33,22 +31,194 @@ const ActorInit Oceff_Storm_InitVars = { (ActorFunc)OceffStorm_Draw, }; -#endif +void OceffStorm_SetupAction(OceffStorm* this, OceffStormActionFunc actionFunc) { + this->actionFunc = actionFunc; +} -#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_Oceff_Storm/OceffStorm_SetupAction.s") +s32 func_8098176C(PlayState* play) { + s32 ret = false; -#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_Oceff_Storm/func_8098176C.s") + switch (play->sceneId) { + case SCENE_13HUBUKINOMITI: + case SCENE_11GORONNOSATO: + case SCENE_10YUKIYAMANOMURA: + case SCENE_14YUKIDAMANOMITI: + case SCENE_12HAKUGINMAE: + case SCENE_17SETUGEN: + case SCENE_GORONRACE: + if (gSaveContext.sceneLayer == 0) { + ret = true; + } + break; -#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_Oceff_Storm/OceffStorm_Init.s") + case SCENE_10YUKIYAMANOMURA2: + if (gSaveContext.sceneLayer == 1) { + ret = true; + } + break; + } + return ret; +} -#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_Oceff_Storm/OceffStorm_Destroy.s") +void OceffStorm_Init(Actor* thisx, PlayState* play) { + s32 pad[2]; + Player* player = GET_PLAYER(play); + OceffStorm* this = THIS; -#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_Oceff_Storm/func_80981928.s") + OceffStorm_SetupAction(this, OceffStorm_DefaultAction); -#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_Oceff_Storm/func_80981B48.s") + this->posYOffAdd = 0; + this->counter = 0; + this->primColorAlpha = 0; + this->vtxAlpha = 0; + this->actor.scale.y = 0.0f; + this->actor.scale.z = 0.0f; + this->actor.scale.x = 0.0f; + this->posYOff = this->posYOffAdd; -#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_Oceff_Storm/OceffStorm_Update.s") + if (this->actor.params == OCEFF_STORM_ACTION_PARAM_1) { + OceffStorm_SetupAction(this, func_80981B48); + this->actor.draw = OceffStorm_Draw2; + } else { + this->actor.world.pos.y = player->actor.world.pos.y; + this->actor.world.pos.x = player->bodyPartsPos[0].x; + this->actor.world.pos.z = player->bodyPartsPos[0].z; + gSaveContext.jinxTimer = 0; + if ((play->interfaceCtx.restrictions.songOfStorms == 0) && !func_8098176C(play)) { + Actor_Spawn(&play->actorCtx, play, ACTOR_EN_OKARINA_EFFECT, this->actor.world.pos.x, + this->actor.world.pos.y - 30.0f, this->actor.world.pos.z, 0, 0, 0, 1); + } + } +} -#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_Oceff_Storm/func_80981BB8.s") +void OceffStorm_Destroy(Actor* thisx, PlayState* play) { + OceffStorm* this = THIS; -#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_Oceff_Storm/OceffStorm_Draw.s") + Magic_Reset(play); +} + +void OceffStorm_DefaultAction(OceffStorm* this, PlayState* play) { + f32 cylinderScale; + + switch (gSaveContext.save.playerForm) { + default: + cylinderScale = 1.0f; + break; + + case PLAYER_FORM_DEKU: + cylinderScale = 1.3f; + break; + + case PLAYER_FORM_ZORA: + cylinderScale = 1.2f; + break; + + case PLAYER_FORM_GORON: + cylinderScale = 2.0f; + break; + } + + if (this->counter < 10) { + this->primColorAlpha = (s8)(this->counter * 10.0f); + } else if (this->counter > 60) { + this->primColorAlpha = (s8)((70 - this->counter) * 10.0f); + } else { + this->primColorAlpha = 100; + } + + if ((this->counter < 10) || (this->counter >= 60)) { + this->vtxAlpha = 0; + } else if (this->counter <= 40) { + if (this->vtxAlpha <= 200) { + this->vtxAlpha += 10; + } + this->actor.scale.x = this->actor.scale.z = 0.4f * cylinderScale; + this->actor.scale.y = 0.3f; + } else if (this->counter > 40) { + this->vtxAlpha = (60 - this->counter) * 10; + } else { + this->actor.scale.x = this->actor.scale.z = 0.4f * cylinderScale; + this->vtxAlpha = -1; + } + + if (this->counter > 40) { + this->actor.world.pos.y += this->posYOff * 0.01f; + this->posYOff += this->posYOffAdd; + this->posYOffAdd += 10; + } + + if (this->counter < 70) { + this->counter++; + } else { + Actor_MarkForDeath(&this->actor); + } +} + +void func_80981B48(OceffStorm* this, PlayState* play) { + if (this->primColorAlpha < 100) { + this->primColorAlpha += 5; + } + //! @bug Actor_Kill is never called so the actor will stay alive forever +} + +void OceffStorm_Update(Actor* thisx, PlayState* play) { + OceffStorm* this = THIS; + + this->actor.shape.rot.y = Camera_GetCamDirYaw(GET_ACTIVE_CAM(play)); + this->actionFunc(this, play); +} + +#include "assets/overlays/ovl_Oceff_Storm/ovl_Oceff_Storm.c" + +void OceffStorm_Draw2(Actor* thisx, PlayState* play) { + s32 scroll = play->state.frames & 0xFFF; + OceffStorm* this = THIS; + + OPEN_DISPS(play->state.gfxCtx); + + gDPPipeSync(POLY_XLU_DISP++); + + POLY_XLU_DISP = func_8012C3A4(POLY_XLU_DISP); + + gDPSetAlphaDither(POLY_XLU_DISP++, G_AD_NOISE); + gDPSetColorDither(POLY_XLU_DISP++, G_CD_NOISE); + + gDPSetPrimColor(POLY_XLU_DISP++, 0x80, 0x80, 200, 200, 150, this->primColorAlpha); + + gSPDisplayList(POLY_XLU_DISP++, &sSongOfStormsMaterialDL); + gSPDisplayList(POLY_XLU_DISP++, Gfx_TwoTexScroll(play->state.gfxCtx, G_TX_RENDERTILE, scroll * 8, scroll * 4, 64, + 64, 1, scroll * 4, scroll * 4, 64, 64)); + gSPTextureRectangle(POLY_XLU_DISP++, 0, 0, SCREEN_WIDTH << 2, SCREEN_HEIGHT << 2, G_TX_RENDERTILE, 0, 0, + (s32)(0.13671875 * (1 << 10)), (s32)(-0.13671875 * (1 << 10))); + + CLOSE_DISPS(play->state.gfxCtx); +} + +void OceffStorm_Draw(Actor* thisx, PlayState* play) { + u32 scroll = play->state.frames & 0xFFF; + OceffStorm* this = (OceffStorm*)thisx; + Vtx* vtxPtr = sSongOfStormsCylinderVtx; + + OPEN_DISPS(play->state.gfxCtx); + + func_8012C2DC(play->state.gfxCtx); + + gDPSetPrimColor(POLY_XLU_DISP++, 0x80, 0x80, 255, 255, 200, 255); + gDPSetEnvColor(POLY_XLU_DISP++, 150, 150, 0, 128); + gDPSetAlphaDither(POLY_XLU_DISP++, G_AD_NOISE); + gDPSetColorDither(POLY_XLU_DISP++, G_CD_NOISE); + + vtxPtr[0].v.cn[3] = vtxPtr[6].v.cn[3] = vtxPtr[16].v.cn[3] = vtxPtr[25].v.cn[3] = this->vtxAlpha >> 1; + vtxPtr[10].v.cn[3] = vtxPtr[22].v.cn[3] = this->vtxAlpha; + + gSPMatrix(POLY_XLU_DISP++, Matrix_NewMtx(play->state.gfxCtx), G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_MODELVIEW); + + gSPDisplayList(POLY_XLU_DISP++, &sSongOfStormsCylinderMaterialDL); + gSPDisplayList(POLY_XLU_DISP++, Gfx_TwoTexScroll(play->state.gfxCtx, G_TX_RENDERTILE, scroll * 4, (0 - scroll) * 8, + 32, 32, 1, scroll * 8, (0 - scroll) * 12, 32, 32)); + gSPDisplayList(POLY_XLU_DISP++, &sSongOfStormsCylinderModelDL); + + CLOSE_DISPS(play->state.gfxCtx); + + OceffStorm_Draw2(&this->actor, play); +} diff --git a/src/overlays/actors/ovl_Oceff_Storm/z_oceff_storm.h b/src/overlays/actors/ovl_Oceff_Storm/z_oceff_storm.h index 460ede844..20dd1ffcb 100644 --- a/src/overlays/actors/ovl_Oceff_Storm/z_oceff_storm.h +++ b/src/overlays/actors/ovl_Oceff_Storm/z_oceff_storm.h @@ -9,10 +9,18 @@ typedef void (*OceffStormActionFunc)(struct OceffStorm*, PlayState*); typedef struct OceffStorm { /* 0x000 */ Actor actor; - /* 0x144 */ char unk_144[0x8]; + /* 0x144 */ u16 counter; + /* 0x146 */ u8 primColorAlpha; + /* 0x147 */ u8 vtxAlpha; + /* 0x148 */ s16 posYOff; + /* 0x14A */ s16 posYOffAdd; /* 0x14C */ OceffStormActionFunc actionFunc; } OceffStorm; // size = 0x150 extern const ActorInit Oceff_Storm_InitVars; +typedef enum { + /* 1 */ OCEFF_STORM_ACTION_PARAM_1 = 1 +} OceffStormActionParams; + #endif // Z_OCEFF_STORM_H diff --git a/tools/disasm/functions.txt b/tools/disasm/functions.txt index 3431e755a..62e5b7bdc 100644 --- a/tools/disasm/functions.txt +++ b/tools/disasm/functions.txt @@ -8245,10 +8245,10 @@ 0x8098176C:("func_8098176C",), 0x809817E4:("OceffStorm_Init",), 0x80981904:("OceffStorm_Destroy",), - 0x80981928:("func_80981928",), + 0x80981928:("OceffStorm_DefaultAction",), 0x80981B48:("func_80981B48",), 0x80981B68:("OceffStorm_Update",), - 0x80981BB8:("func_80981BB8",), + 0x80981BB8:("OceffStorm_Draw2",), 0x80981D68:("OceffStorm_Draw",), 0x80983520:("ObjDemo_Init",), 0x80983634:("func_80983634",), From 6c414889c9561837c5103c7d27c868f2b90cd142 Mon Sep 17 00:00:00 2001 From: Parker Burnett Date: Tue, 4 Oct 2022 05:55:20 -0700 Subject: [PATCH 4/7] Fbdemo_circle OK (#1024) * some progress, nasty draw func only thing to do * pushing for engineer * matching with no warnings * fixes * minor names * PR feedback * fixes for PR * docs * PR comments * fixing format and found bit shift --- include/functions.h | 19 ++--- include/variables.h | 4 +- include/z64transition.h | 25 ++++++- spec | 1 - src/code/z_actor.c | 3 +- src/code/z_fbdemo_circle.c | 143 ++++++++++++++++++++++++++++++++++--- 6 files changed, 172 insertions(+), 23 deletions(-) diff --git a/include/functions.h b/include/functions.h index 34384ab3f..93b15c2c5 100644 --- a/include/functions.h +++ b/include/functions.h @@ -2420,15 +2420,16 @@ void* TransitionFade_Init(void* param_1); // void TransitionFade_IsDone(void); // void TransitionFade_SetColor(void); // void TransitionFade_SetType(void); -// void TransitionCircle_Start(void); -// void TransitionCircle_Init(void); -// void TransitionCircle_Destroy(void); -// void TransitionCircle_Update(void); -// void TransitionCircle_SetColor(void); -// void TransitionCircle_SetType(void); -void func_80164C14(Gfx** arg0, TexturePtr* arg1, s32 arg2, s32 arg3, s32 arg4, s32 arg5, f32 arg6); -// void TransitionCircle_Draw(void); -// void TransitionCircle_IsDone(void); +void TransitionCircle_Start(void* thisx); +void* TransitionCircle_Init(void* thisx); +void TransitionCircle_Destroy(void* thisx); +void TransitionCircle_Update(void* thisx); +void TransitionCircle_SetColor(void* thisx, u32 color); +void TransitionCircle_SetType(void* thisx, s32 type); +void TransitionCircle_LoadAndSetTexture(Gfx** gfxp, TexturePtr texture, s32 fmt, s32 arg3, s32 masks, s32 maskt, + f32 arg6); +void TransitionCircle_Draw(void* thisx, Gfx** gfxp); +s32 TransitionCircle_IsDone(void* thisx); // void func_801651B0(void); // void func_80165224(void); // void func_80165288(void); diff --git a/include/variables.h b/include/variables.h index a4914a441..dfe8ae715 100644 --- a/include/variables.h +++ b/include/variables.h @@ -1472,7 +1472,7 @@ extern KaleidoMgrOverlay* gKaleidoMgrCurOvl; // extern UNK_TYPE1 D_801D0C80; // extern UNK_TYPE1 D_801D0CB0; extern const TransitionInit TransitionFade_InitVars; -// extern UNK_TYPE1 D_801D0D00; +extern Gfx D_801D0D00[]; extern const TransitionInit TransitionCircle_InitVars; extern s32 gDbgCamEnabled; // extern UNK_TYPE1 D_801D0D54; @@ -2703,7 +2703,7 @@ extern f32 D_801DE860; extern f32 D_801DE864; extern f32 D_801DE868; extern f32 D_801DE884; -extern TexturePtr gCircleTex; +extern TexturePtr gCircleTex[]; extern f32 D_801DF090; extern f32 D_801DF094; extern f32 D_801DF0A0; diff --git a/include/z64transition.h b/include/z64transition.h index 9630b4a3f..3742291a6 100644 --- a/include/z64transition.h +++ b/include/z64transition.h @@ -3,6 +3,8 @@ #include "ultra64.h" +#define TC_SET_PARAMS (1 << 7) + typedef struct { /* 0x00 */ void* (*init)(void* transition); /* 0x04 */ void (*destroy)(void* transition); @@ -21,8 +23,29 @@ typedef struct { extern const TransitionInit TransitionFade_InitVars; + +typedef enum { + /* 0 */ TRANSITION_CIRCLE_IN, + /* 1 */ TRANSITION_CIRCLE_OUT, +} TransitionCircleDirection; + +#define FBDEMO_CIRCLE_GET_MASK_TYPE(type) (type & 1) + typedef struct { - /* 0x00 */ char unk_0[0x20]; + /* 0x00 */ Color_RGBA8_u32 color; + /* 0x04 */ f32 referenceRadius; // Reference for where to transition to + /* 0x08 */ f32 stepValue; // How fast the Transition is + /* 0x0C */ f32 startingRadius; // Radius value where transition will begin + /* 0x10 */ f32 targetRadius; // Final radius of transition circle + /* 0x14 */ u8 direction; // Direction the circle is transitioning ( In / Out ) + /* 0x15 */ u8 maskType; // Positive / Negative mask type. Value of 0 will create a black circle + /* 0x16 */ u8 isDone; // Signals when Transition is done updating + /* 0x17 */ UNK_TYPE1 pad_17; // struct padding + /* 0x18 */ TexturePtr texture; + /* 0x1C */ u8 masks; + /* 0x1D */ u8 maskt; + /* 0x1E */ s8 unk_1E; // Set to 4 and never used + /* 0x1F */ s8 unk_1F; // Set to 0 and never used } TransitionCircle; // size = 0x20 extern const TransitionInit TransitionCircle_InitVars; diff --git a/spec b/spec index 207b70da1..bcbcf6697 100644 --- a/spec +++ b/spec @@ -554,7 +554,6 @@ beginseg include "build/data/code/z_fbdemo.data.o" include "build/src/code/z_fbdemo_fade.o" include "build/src/code/z_fbdemo_circle.o" - include "build/data/code/z_fbdemo_circle.data.o" include "build/src/code/z_overlay.o" include "build/src/code/z_play.o" include "build/data/code/z_play.data.o" diff --git a/src/code/z_actor.c b/src/code/z_actor.c index 389f7a051..88ec6c07b 100644 --- a/src/code/z_actor.c +++ b/src/code/z_actor.c @@ -2609,7 +2609,8 @@ s32 Actor_RecordUndrawnActor(PlayState* play, Actor* actor) { } void Actor_DrawLensOverlay(Gfx** gfxP, s32 lensMaskSize) { - func_80164C14(gfxP, &gCircleTex, 4, 0, 6, 6, ((LENS_MASK_ACTIVE_SIZE - lensMaskSize) * 0.003f) + 1.0f); + TransitionCircle_LoadAndSetTexture(gfxP, gCircleTex, 4, 0, 6, 6, + ((LENS_MASK_ACTIVE_SIZE - lensMaskSize) * 0.003f) + 1.0f); } #ifdef NON_EQUIVALENT diff --git a/src/code/z_fbdemo_circle.c b/src/code/z_fbdemo_circle.c index a822262ee..9cbc308be 100644 --- a/src/code/z_fbdemo_circle.c +++ b/src/code/z_fbdemo_circle.c @@ -1,19 +1,144 @@ #include "global.h" -#pragma GLOBAL_ASM("asm/non_matchings/code/z_fbdemo_circle/TransitionCircle_Start.s") +Gfx D_801D0D00[] = { + gsDPPipeSync(), + gsDPSetOtherMode(G_AD_DISABLE | G_CD_DISABLE | G_CK_NONE | G_TC_FILT | G_TF_BILERP | G_TT_NONE | G_TL_TILE | + G_TD_CLAMP | G_TP_NONE | G_CYC_1CYCLE | G_PM_NPRIMITIVE, + G_AC_THRESHOLD | G_ZS_PRIM | AA_EN | IM_RD | CVG_DST_FULL | ZMODE_OPA | CVG_X_ALPHA | FORCE_BL | + GBL_c1(G_BL_CLR_IN, G_BL_A_IN, G_BL_CLR_MEM, G_BL_1MA) | + GBL_c2(G_BL_CLR_IN, G_BL_0, G_BL_CLR_IN, G_BL_1)), + gsDPSetPrimColor(0, 255, 0, 0, 0, 1), + gsDPSetBlendColor(0, 0, 0, 1), + gsSPEndDisplayList(), +}; -#pragma GLOBAL_ASM("asm/non_matchings/code/z_fbdemo_circle/TransitionCircle_Init.s") +//! @bug: TransitionCircle_Update should take an additional argument `s32 updateRate` +const TransitionInit TransitionCircle_InitVars = { + TransitionCircle_Init, TransitionCircle_Destroy, (void*)TransitionCircle_Update, TransitionCircle_Draw, + TransitionCircle_Start, TransitionCircle_SetType, TransitionCircle_SetColor, NULL, + TransitionCircle_IsDone, +}; -#pragma GLOBAL_ASM("asm/non_matchings/code/z_fbdemo_circle/TransitionCircle_Destroy.s") +void TransitionCircle_Start(void* thisx) { + TransitionCircle* this = (TransitionCircle*)thisx; -#pragma GLOBAL_ASM("asm/non_matchings/code/z_fbdemo_circle/TransitionCircle_Update.s") + this->stepValue = 0.1f; + if (this->direction == TRANSITION_CIRCLE_IN) { + this->targetRadius = 0.0f; + this->startingRadius = 1.0f; + } else { + this->startingRadius = 0.0f; + this->targetRadius = 1.0f; + } + this->referenceRadius = this->startingRadius; +} -#pragma GLOBAL_ASM("asm/non_matchings/code/z_fbdemo_circle/TransitionCircle_SetColor.s") +void* TransitionCircle_Init(void* thisx) { + TransitionCircle* this = (TransitionCircle*)thisx; -#pragma GLOBAL_ASM("asm/non_matchings/code/z_fbdemo_circle/TransitionCircle_SetType.s") + bzero(this, sizeof(TransitionCircle)); + this->maskType = 1; + this->texture = gCircleTex; + this->masks = 6; + this->maskt = 6; + this->unk_1E = 4; + this->unk_1F = 0; -#pragma GLOBAL_ASM("asm/non_matchings/code/z_fbdemo_circle/func_80164C14.s") + return this; +} -#pragma GLOBAL_ASM("asm/non_matchings/code/z_fbdemo_circle/TransitionCircle_Draw.s") +void TransitionCircle_Destroy(void* thisx) { +} -#pragma GLOBAL_ASM("asm/non_matchings/code/z_fbdemo_circle/TransitionCircle_IsDone.s") +void TransitionCircle_Update(void* thisx) { + TransitionCircle* this = (TransitionCircle*)thisx; + + this->isDone = Math_StepToF(&this->referenceRadius, this->targetRadius, this->stepValue); +} + +void TransitionCircle_SetColor(void* thisx, u32 color) { + TransitionCircle* this = (TransitionCircle*)thisx; + + this->color.rgba = color; +} + +void TransitionCircle_SetType(void* thisx, s32 type) { + TransitionCircle* this = (TransitionCircle*)thisx; + + if (type & TC_SET_PARAMS) { + this->maskType = FBDEMO_CIRCLE_GET_MASK_TYPE(type); + } else if (type == 1) { + this->direction = TRANSITION_CIRCLE_OUT; + } else { + this->direction = TRANSITION_CIRCLE_IN; + } +} + +void TransitionCircle_LoadAndSetTexture(Gfx** gfxp, TexturePtr texture, s32 fmt, s32 arg3, s32 masks, s32 maskt, + f32 arg6) { + Gfx* gfx = *gfxp; + s32 xh = D_801FBBCC; + s32 yh = D_801FBBCE; + s32 width = 1 << masks; + s32 height = 1 << maskt; + f32 s; + f32 t; + s32 dtdy; + s32 dsdx; + + gDPLoadTextureBlock_4b(gfx++, texture, fmt, width, height, 0, G_TX_MIRROR | G_TX_CLAMP, G_TX_MIRROR | G_TX_CLAMP, + masks, maskt, G_TX_NOLOD, G_TX_NOLOD); + gDPSetTileSize(gfx++, G_TX_RENDERTILE, ((SCREEN_WIDTH / 2) - width) << 2, ((SCREEN_HEIGHT / 2) - height) << 2, + ((SCREEN_WIDTH / 2) + (width - 1)) << 2, ((SCREEN_HEIGHT / 2) + (height - 1)) << 2); + + s = ((1.0f - (1.0f / arg6)) * (SCREEN_WIDTH / 2)) + 70.0f; + t = ((1.0f - (1.0f / arg6)) * (SCREEN_HEIGHT / 2)) + 50.0f; + + if (s < -1023.0f) { + s = -1023.0f; + } + if (t < -1023.0f) { + t = -1023.0f; + } + + if ((s <= -1023.0f) || (t <= -1023.0f)) { + dsdx = 0; + dtdy = 0; + } else { + dsdx = ((SCREEN_WIDTH - (2.0f * s)) / gScreenWidth) * (1 << 10); + dtdy = ((SCREEN_HEIGHT - (2.0f * t)) / gScreenHeight) * (1 << 10); + } + + gSPTextureRectangle(gfx++, 0, 0, xh << 2, yh << 2, G_TX_RENDERTILE, (s32)(s * (1 << 5)), (s32)(t * (1 << 5)), dsdx, + dtdy); + gDPPipeSync(gfx++); + + *gfxp = gfx; +} + +void TransitionCircle_Draw(void* thisx, Gfx** gfxp) { + Gfx* gfx = *gfxp; + TransitionCircle* this = (TransitionCircle*)thisx; + + gDPPipeSync(gfx++); + gSPDisplayList(gfx++, &D_801D0D00); + gDPSetPrimColor(gfx++, 0, this->color.a, this->color.r, this->color.g, this->color.b, 1); + if (this->maskType == 0) { + gDPSetCombineLERP(gfx++, 0, 0, 0, PRIMITIVE, TEXEL0, 0, PRIM_LOD_FRAC, PRIMITIVE, 0, 0, 0, PRIMITIVE, TEXEL0, 0, + PRIM_LOD_FRAC, PRIMITIVE); + } else { + gDPSetCombineLERP(gfx++, 0, 0, 0, PRIMITIVE, 1, TEXEL0, PRIM_LOD_FRAC, PRIMITIVE, 0, 0, 0, PRIMITIVE, 1, TEXEL0, + PRIM_LOD_FRAC, PRIMITIVE); + } + TransitionCircle_LoadAndSetTexture(&gfx, this->texture, G_IM_FMT_I, 0, this->masks, this->maskt, + this->referenceRadius); + gDPPipeSync(gfx++); + + *gfxp = gfx; +} + +s32 TransitionCircle_IsDone(void* thisx) { + TransitionCircle* this = (TransitionCircle*)thisx; + + return this->isDone; +} From 8cd48db087ed7527d376195736eb9d4714bdf862 Mon Sep 17 00:00:00 2001 From: Tom Overton Date: Tue, 4 Oct 2022 12:23:13 -0700 Subject: [PATCH 5/7] Better match for BgKin2Fence_CheckHitMask (#1105) Co-authored-by: EllipticEllipsis Co-authored-by: EllipticEllipsis --- .../actors/ovl_Bg_Kin2_Fence/z_bg_kin2_fence.c | 17 +++++------------ 1 file changed, 5 insertions(+), 12 deletions(-) diff --git a/src/overlays/actors/ovl_Bg_Kin2_Fence/z_bg_kin2_fence.c b/src/overlays/actors/ovl_Bg_Kin2_Fence/z_bg_kin2_fence.c index 628ade7f1..09f71c4ff 100644 --- a/src/overlays/actors/ovl_Bg_Kin2_Fence/z_bg_kin2_fence.c +++ b/src/overlays/actors/ovl_Bg_Kin2_Fence/z_bg_kin2_fence.c @@ -120,19 +120,12 @@ static InitChainEntry sInitChain[] = { }; s32 BgKin2Fence_CheckHitMask(BgKin2Fence* this) { - ColliderJntSphElement* elements = this->collider.elements; + s32 i; - if (elements[0].info.bumperFlags & BUMP_HIT) { - return 0; - } - if (elements[1].info.bumperFlags & BUMP_HIT) { - return 1; - } - if (elements[2].info.bumperFlags & BUMP_HIT) { - return 2; - } - if (elements[3].info.bumperFlags & BUMP_HIT) { - return 3; + for (i = 0; i < ARRAY_COUNT(this->colliderElements); i++) { + if (this->collider.elements[i].info.bumperFlags & BUMP_HIT) { + return i; + } } return -1; } From 2006a65ba62e7e848823cd1de009c9e16d6421eb Mon Sep 17 00:00:00 2001 From: petrie911 <69443847+petrie911@users.noreply.github.com> Date: Tue, 4 Oct 2022 15:46:32 -0500 Subject: [PATCH 6/7] z_overlay and z_fbdemo_dlftbls (Transition overlay handling), clean up a lot of u32s used to store pointers (#1073) * overlay matches * prototypes * fbdemo too * virtual to physical * names, cleanup, etc * bss reordering * uintptr stuff * fixed now? * one fix * headers and such * fixes'n'stuff * XXX action * docs of a sort * useless error codes * n * format * header? I barely know her! Co-authored-by: petrie911 --- include/functions.h | 44 ++++---- include/initvars.h | 8 ++ include/os.h | 10 +- include/os_internal.h | 4 +- include/variables.h | 2 - include/z64actor.h | 4 +- include/z64dma.h | 22 ++-- include/z64effect.h | 4 +- include/z64transition.h | 38 +++++-- spec | 1 - src/boot_O2_g3/yaz0.c | 4 +- src/boot_O2_g3/z_std_dma.c | 6 +- src/code/z_actor.c | 2 +- src/code/z_effect_soft_sprite_old_init.c | 2 +- src/code/z_en_hy_code.c | 6 +- src/code/z_fbdemo_circle.c | 2 +- src/code/z_fbdemo_dlftbls.c | 53 ++++++++- src/code/z_lib.c | 30 ++++-- src/code/z_overlay.c | 101 ++++++++++++++++-- src/code/z_player_lib.c | 4 +- src/code/z_room.c | 4 +- src/code/z_scene.c | 10 +- src/libultra/io/epirawdma.c | 2 +- src/libultra/io/sirawread.c | 2 +- src/libultra/io/sirawwrite.c | 2 +- src/overlays/actors/ovl_Boss_03/z_boss_03.c | 3 +- src/overlays/actors/ovl_Dm_Stk/z_dm_stk.c | 8 +- .../actors/ovl_En_Bba_01/z_en_bba_01.c | 6 +- .../actors/ovl_En_Cne_01/z_en_cne_01.c | 6 +- src/overlays/actors/ovl_En_Dnk/z_en_dnk.c | 2 +- src/overlays/actors/ovl_En_Nwc/z_en_nwc.c | 4 +- .../actors/ovl_En_S_Goro/z_en_s_goro.c | 6 +- src/overlays/actors/ovl_En_Sob1/z_en_sob1.c | 6 +- .../ovl_Effect_Ss_Extra/z_eff_ss_extra.c | 4 +- .../ovl_fbdemo_triforce/z_fbdemo_triforce.c | 2 +- .../ovl_fbdemo_triforce/z_fbdemo_triforce.h | 2 - .../fbdemos/ovl_fbdemo_wipe1/z_fbdemo_wipe1.c | 2 +- .../fbdemos/ovl_fbdemo_wipe1/z_fbdemo_wipe1.h | 2 - .../fbdemos/ovl_fbdemo_wipe3/z_fbdemo_wipe3.c | 2 +- .../fbdemos/ovl_fbdemo_wipe3/z_fbdemo_wipe3.h | 2 - .../fbdemos/ovl_fbdemo_wipe4/z_fbdemo_wipe4.c | 2 +- .../fbdemos/ovl_fbdemo_wipe4/z_fbdemo_wipe4.h | 2 - .../fbdemos/ovl_fbdemo_wipe5/z_fbdemo_wipe5.c | 2 +- .../fbdemos/ovl_fbdemo_wipe5/z_fbdemo_wipe5.h | 2 - tools/disasm/functions.txt | 20 ++-- tools/sizes/code_functions.csv | 20 ++-- 46 files changed, 321 insertions(+), 151 deletions(-) diff --git a/include/functions.h b/include/functions.h index 93b15c2c5..dbbcc07df 100644 --- a/include/functions.h +++ b/include/functions.h @@ -7,12 +7,12 @@ void bootproc(void); void Idle_ThreadEntry(void* arg); void ViConfig_UpdateVi(u32 mode); void ViConfig_UpdateBlack(void); -s32 DmaMgr_DmaRomToRam(u32 rom, void* ram, size_t size); +s32 DmaMgr_DmaRomToRam(uintptr_t rom, void* ram, size_t size); s32 DmaMgr_DmaHandler(OSPiHandle* pihandle, OSIoMesg* mb, s32 direction); -DmaEntry* DmaMgr_FindDmaEntry(u32 vrom); -u32 DmaMgr_TranslateVromToRom(u32 vrom); -s32 DmaMgr_FindDmaIndex(u32 vrom); -const char* func_800809F4(u32 param_1); +DmaEntry* DmaMgr_FindDmaEntry(uintptr_t vrom); +u32 DmaMgr_TranslateVromToRom(uintptr_t vrom); +s32 DmaMgr_FindDmaIndex(uintptr_t vrom); +const char* func_800809F4(uintptr_t param_1); void DmaMgr_ProcessMsg(DmaRequest* req); void DmaMgr_ThreadEntry(void* arg); s32 DmaMgr_SendRequestImpl(DmaRequest* request, void* vramStart, uintptr_t vromStart, size_t size, UNK_TYPE4 unused, OSMesgQueue* queue, void* msg); @@ -22,7 +22,7 @@ void DmaMgr_Stop(void); void* Yaz0_FirstDMA(void); void* Yaz0_NextDMA(void* curSrcPos); s32 Yaz0_DecompressImpl(u8* src, u8* dst); -void Yaz0_Decompress(u32 romStart, void* dst, size_t size); +void Yaz0_Decompress(uintptr_t romStart, void* dst, size_t size); void IrqMgr_AddClient(IrqMgr* irqmgr, IrqMgrClient* client, OSMesgQueue* msgQueue); void IrqMgr_RemoveClient(IrqMgr* irqmgr, IrqMgrClient* remove); void IrqMgr_SendMesgForClient(IrqMgr* irqmgr, OSMesg msg); @@ -256,7 +256,7 @@ s32 __osSpRawStartDma(s32 direction, void* devAddr, void* dramAddr, size_t size) s32 __osSiRawStartDma(s32 direction, void* dramAddr); s32 osEPiLinkHandle(OSPiHandle* handle); void osViBlack(u8 active); -s32 __osSiRawReadIo(u32 devAddr, u32* data); +s32 __osSiRawReadIo(uintptr_t devAddr, u32* data); OSId osGetThreadId(OSThread* t); void osSpTaskYield(void); s32 __osPfsGetNextPage(OSPfs* pfs, u8* bank, __OSInode* inode, __OSInodeUnit* page); @@ -280,7 +280,7 @@ void __osPiGetAccess(void); void __osPiRelAccess(void); void __osDevMgrMain(void* arg); // void func_8008C640(UNK_TYPE1 param_1, UNK_TYPE1 param_2, UNK_TYPE1 param_3, UNK_TYPE1 param_4, UNK_TYPE1 param_5, UNK_TYPE1 param_6, UNK_TYPE1 param_7, UNK_TYPE1 param_8, UNK_TYPE4 param_9, UNK_TYPE4 param_10, UNK_TYPE4 param_11, UNK_TYPE4 param_12, UNK_TYPE4 param_13, UNK_TYPE4 param_14, UNK_TYPE4 param_15, UNK_TYPE4 param_16, UNK_TYPE4 param_17, UNK_TYPE4 param_18); -s32 __osPiRawStartDma(s32 direction, u32 devAddr, void* dramAddr, size_t size); +s32 __osPiRawStartDma(s32 direction, uintptr_t devAddr, void* dramAddr, size_t size); u16 __osSumcalc(u8* ptr, s32 length); s32 __osIdCheckSum(u16* ptr, u16* checkSum, u16* idSum); s32 __osRepairPackId(OSPfs* pfs, __OSPackId* badid, __OSPackId* newid); @@ -322,11 +322,11 @@ s32 __osSiDeviceBusy(void); s32 osJamMesg(OSMesgQueue* mq, OSMesg msg, s32 flag); void osSetThreadPri(OSThread* t, OSPri p); OSPri osGetThreadPri(OSThread* t); -s32 __osEPiRawReadIo(OSPiHandle* handle, u32 devAddr, u32* data); +s32 __osEPiRawReadIo(OSPiHandle* handle, uintptr_t devAddr, u32* data); void osViSwapBuffer(void* frameBufPtr); void guPositionF(float mf[4][4], f32 rot, f32 pitch, f32 yaw, f32 scale, f32 x, f32 y, f32 z); void guPosition(Mtx* m, f32 rot, f32 pitch, f32 yaw, f32 scale, f32 x, f32 y, f32 z); -s32 __osEPiRawStartDma(OSPiHandle* handle, s32 direction, u32 cartAddr, void* dramAddr, size_t size); +s32 __osEPiRawStartDma(OSPiHandle* handle, s32 direction, uintptr_t cartAddr, void* dramAddr, size_t size); OSYieldResult osSpTaskYielded(OSTask* task); s32 bcmp(void* __s1, void* __s2, size_t __n); OSTime osGetTime(void); @@ -359,7 +359,7 @@ void __osViInit(void); void __osViSwapContext(void); OSMesgQueue* osPiGetCmdQueue(void); f32 cosf(f32 __x); -s32 osEPiReadIo(OSPiHandle* handle, u32 devAddr, u32* data); +s32 osEPiReadIo(OSPiHandle* handle, uintptr_t devAddr, u32* data); void osViSetSpecialFeatures(u32 func); s16 coss(u16 x); void osSetTime(OSTime ticks); @@ -380,13 +380,13 @@ u32 __osGetFpcCsr(void); // void __osPfsCheckRamArea(void); // void osPfsChecker(void); u32 osAiGetLength(void); -s32 osEPiWriteIo(OSPiHandle* handle, u32 devAddr, u32 data); +s32 osEPiWriteIo(OSPiHandle* handle, uintptr_t devAddr, u32 data); void osMapTLBRdb(void); void osYieldThread(void); void guTranslate(Mtx* mtx, f32 x, f32 y, f32 z); u32 __osGetCause(void); s32 __osContRamWrite(OSMesgQueue* mq, s32 channel, u16 address, u8* buffer, s32 force); -s32 __osEPiRawWriteIo(OSPiHandle* handle, u32 devAddr, u32 data); +s32 __osEPiRawWriteIo(OSPiHandle* handle, uintptr_t devAddr, u32 data); s32 osSetTimer(OSTimer* t, OSTime value, OSTime interval, OSMesgQueue* mq, OSMesg msg); void _Ldtob(_Pft* args, u8 type); // void _Ldunscale(void); @@ -394,7 +394,7 @@ void _Genld(_Pft* px, u8 code, u8* p, s16 nsig, s16 xexp); ldiv_t ldiv(long numer, long denom); lldiv_t lldiv(long long numer, long long denom); void _Litob(_Pft* args, u8 type); -s32 __osSiRawWriteIo(u32 devAddr, u32 data); +s32 __osSiRawWriteIo(uintptr_t devAddr, u32 data); u32 __osSpGetStatus(void); void __osSpSetStatus(u32 data); void osCreateViManager(OSPri pri); @@ -1576,8 +1576,8 @@ f32 Math_Vec3f_StepTo(Vec3f* start, Vec3f* target, f32 speed); void Lib_Nop801004FC(void); void* Lib_SegmentedToVirtual(void* ptr); void* Lib_SegmentedToVirtualNull(void* ptr); +void* Lib_VirtualToPhysical(void* ptr); void* Lib_PhysicalToVirtual(void* ptr); -void* Lib_PhysicalToVirtualNull(void* ptr); void LifeMeter_Init(PlayState* play); void LifeMeter_UpdateColors(PlayState* play); s32 LifeMeter_SaveInterfaceHealth(PlayState* play); @@ -2401,8 +2401,8 @@ void KaleidoScopeCall_Init(PlayState* play); void KaleidoScopeCall_Destroy(PlayState* play); void KaleidoScopeCall_Update(PlayState* play); void KaleidoScopeCall_Draw(PlayState* play); -// void func_80163C90(void); -// void func_80163D80(void); +void Transition_Init(TransitionContext* transitionCtx); +void Transition_Destroy(TransitionContext* transitionCtx); // void func_80163DC0(void); // void func_8016418C(void); // void func_8016424C(void); @@ -2420,6 +2420,8 @@ void* TransitionFade_Init(void* param_1); // void TransitionFade_IsDone(void); // void TransitionFade_SetColor(void); // void TransitionFade_SetType(void); +void TransitionOverlay_ClearLoadInfo(TransitionOverlay *overlayEntry); +void TransitionOverlay_SetSegment(TransitionOverlay *overlayEntry, void* vramStart, void* vramEnd, uintptr_t vromStart, uintptr_t vromEnd); void TransitionCircle_Start(void* thisx); void* TransitionCircle_Init(void* thisx); void TransitionCircle_Destroy(void* thisx); @@ -2430,10 +2432,10 @@ void TransitionCircle_LoadAndSetTexture(Gfx** gfxp, TexturePtr texture, s32 fmt, f32 arg6); void TransitionCircle_Draw(void* thisx, Gfx** gfxp); s32 TransitionCircle_IsDone(void* thisx); -// void func_801651B0(void); -// void func_80165224(void); -// void func_80165288(void); -// void func_8016537C(void); +void* TransitionOverlay_VramToRam(TransitionOverlay *overlayEntry, void* vramAddr); +void TransitionOverlay_VramToRamArray(TransitionOverlay *overlayEntry, void** vramAddrs, s32 count); +s32 TransitionOverlay_Load(TransitionOverlay *overlayEntry); +s32 TransitionOverlay_Free(TransitionOverlay *overlayEntry); void func_80165438(UNK_PTR param_1); // void func_80165444(s32 param_1, UNK_TYPE4 param_2, UNK_TYPE4 param_3, UNK_TYPE4 param_4, UNK_TYPE4 param_5); // void func_80165460(void); diff --git a/include/initvars.h b/include/initvars.h index 11a6719e9..4de39757c 100644 --- a/include/initvars.h +++ b/include/initvars.h @@ -610,4 +610,12 @@ extern ActorInit Oceff_Wipe7_InitVars; extern ActorInit Shot_Sun_InitVars; extern ActorInit TG_Sw_InitVars; +extern TransitionInit TransitionFade_InitVars; +extern TransitionInit TransitionTriforce_InitVars; +extern TransitionInit TransitionWipe1_InitVars; +extern TransitionInit TransitionWipe3_InitVars; +extern TransitionInit TransitionWipe4_InitVars; +extern TransitionInit TransitionCircle_InitVars; +extern TransitionInit TransitionWipe5_InitVars; + #endif diff --git a/include/os.h b/include/os.h index 838d8234a..6e34bd428 100644 --- a/include/os.h +++ b/include/os.h @@ -47,7 +47,7 @@ typedef struct { /* 0x04 */ u16 transferMode; /* 0x06 */ u16 blockNum; /* 0x08 */ s32 sectorNum; - /* 0x0C */ u32 devAddr; + /* 0x0C */ uintptr_t devAddr; /* 0x10 */ u32 bmCtlShadow; /* 0x14 */ u32 seqCtlShadow; /* 0x18 */ __OSBlockInfo block[2]; @@ -62,7 +62,7 @@ typedef struct OSPiHandle { /* 0x07 */ u8 relDuration; /* 0x08 */ u8 pulse; /* 0x09 */ u8 domain; - /* 0x0C */ u32 baseAddress; + /* 0x0C */ uintptr_t baseAddress; /* 0x10 */ u32 speed; /* 0x14 */ __OSTranxInfo transferInfo; } OSPiHandle; // size = 0x74 @@ -70,7 +70,7 @@ typedef struct OSPiHandle { typedef struct { /* 0x0 */ u8 type; - /* 0x4 */ u32 address; + /* 0x4 */ uintptr_t address; } OSPiInfo; // size = 0x8 @@ -97,8 +97,8 @@ typedef struct { /* 0x08 */ OSMesgQueue* cmdQueue; /* 0x0C */ OSMesgQueue* evtQueue; /* 0x10 */ OSMesgQueue* acsQueue; - /* 0x14 */ s32 (*piDmaCallback)(s32, u32, void*, size_t); - /* 0x18 */ s32 (*epiDmaCallback)(OSPiHandle*, s32, u32, void*, size_t); + /* 0x14 */ s32 (*piDmaCallback)(s32, uintptr_t, void*, size_t); + /* 0x18 */ s32 (*epiDmaCallback)(OSPiHandle*, s32, uintptr_t, void*, size_t); } OSDevMgr; // size = 0x1C typedef u64 OSTime; diff --git a/include/os_internal.h b/include/os_internal.h index b4f98bffa..2d82b41a9 100644 --- a/include/os_internal.h +++ b/include/os_internal.h @@ -12,8 +12,8 @@ typedef struct { /* 0x08 */ OSMesgQueue* cmdQueue; /* 0x0C */ OSMesgQueue* eventQueue; /* 0x10 */ OSMesgQueue* accessQueue; - /* 0x14 */ s32 (*piDmaCallback)(s32, u32, void*, size_t); - /* 0x18 */ s32 (*epiDmaCallback)(OSPiHandle*, s32, u32, void*, size_t); + /* 0x14 */ s32 (*piDmaCallback)(s32, uintptr_t, void*, size_t); + /* 0x18 */ s32 (*epiDmaCallback)(OSPiHandle*, s32, uintptr_t, void*, size_t); } OSMgrArgs; // size = 0x1C #endif diff --git a/include/variables.h b/include/variables.h index dfe8ae715..e865f890e 100644 --- a/include/variables.h +++ b/include/variables.h @@ -1471,9 +1471,7 @@ extern KaleidoMgrOverlay* gKaleidoMgrCurOvl; // extern UNK_TYPE4 D_801D0BB0; // extern UNK_TYPE1 D_801D0C80; // extern UNK_TYPE1 D_801D0CB0; -extern const TransitionInit TransitionFade_InitVars; extern Gfx D_801D0D00[]; -extern const TransitionInit TransitionCircle_InitVars; extern s32 gDbgCamEnabled; // extern UNK_TYPE1 D_801D0D54; // extern UNK_TYPE2 D_801D0D58; diff --git a/include/z64actor.h b/include/z64actor.h index b11078316..f1c33783a 100644 --- a/include/z64actor.h +++ b/include/z64actor.h @@ -105,8 +105,8 @@ typedef enum { } AllocType; typedef struct { - /* 0x00 */ u32 vromStart; - /* 0x04 */ u32 vromEnd; + /* 0x00 */ uintptr_t vromStart; + /* 0x04 */ uintptr_t vromEnd; /* 0x08 */ void* vramStart; /* 0x0C */ void* vramEnd; /* 0x10 */ void* loadedRamAddr; // original name: "allocp" diff --git a/include/z64dma.h b/include/z64dma.h index 3b17d04d0..92c0227f3 100644 --- a/include/z64dma.h +++ b/include/z64dma.h @@ -4,21 +4,21 @@ #include "ultra64.h" typedef struct { - /* 0x00 */ u32 vromAddr; // VROM address (source) - /* 0x04 */ void* dramAddr; // DRAM address (destination) - /* 0x08 */ u32 size; // File Transfer size - /* 0x0C */ char* filename; // Filename for debugging - /* 0x10 */ s32 line; // Line for debugging - /* 0x14 */ s32 unk14; + /* 0x00 */ uintptr_t vromAddr; // VROM address (source) + /* 0x04 */ void* dramAddr; // DRAM address (destination) + /* 0x08 */ u32 size; // File Transfer size + /* 0x0C */ char* filename; // Filename for debugging + /* 0x10 */ s32 line; // Line for debugging + /* 0x14 */ s32 unk14; /* 0x18 */ OSMesgQueue* notifyQueue; // Message queue for the notification message - /* 0x1C */ OSMesg notifyMsg; // Completion notification message + /* 0x1C */ OSMesg notifyMsg; // Completion notification message } DmaRequest; // size = 0x20 typedef struct { - /* 0x0 */ u32 vromStart; - /* 0x4 */ u32 vromEnd; - /* 0x8 */ u32 romStart; - /* 0xC */ u32 romEnd; + /* 0x0 */ uintptr_t vromStart; + /* 0x4 */ uintptr_t vromEnd; + /* 0x8 */ uintptr_t romStart; + /* 0xC */ uintptr_t romEnd; } DmaEntry; // size = 0x10 #endif diff --git a/include/z64effect.h b/include/z64effect.h index b4574592a..727bf04d2 100644 --- a/include/z64effect.h +++ b/include/z64effect.h @@ -248,8 +248,8 @@ typedef struct { } EffectSsInit; // size = 0x8 typedef struct { - /* 0x00 */ u32 vromStart; - /* 0x04 */ u32 vromEnd; + /* 0x00 */ uintptr_t vromStart; + /* 0x04 */ uintptr_t vromEnd; /* 0x08 */ void* vramStart; /* 0x0C */ void* vramEnd; /* 0x10 */ void* loadedRamAddr; diff --git a/include/z64transition.h b/include/z64transition.h index 3742291a6..45178ba8e 100644 --- a/include/z64transition.h +++ b/include/z64transition.h @@ -17,13 +17,42 @@ typedef struct { /* 0x20 */ s32 (*isDone)(void* transition); } TransitionInit; // size = 0x24 +typedef struct { + union { + struct { + /* 0x00 */ u32 count : 8; + /* 0x00 */ uintptr_t addr : 24; + }; + /* 0x00 */ u32 word; + } loadInfo; + /* 0x04 */ void* vramStart; + /* 0x08 */ void* vramEnd; + /* 0x0C */ uintptr_t vromStart; + /* 0x10 */ uintptr_t vromEnd; + /* 0x14 */ TransitionInit* initInfo; + /* 0x18 */ size_t size; +} TransitionOverlay; + +typedef struct { + /* 0x000 */ s16 transitionType; + /* 0x002 */ s8 fbdemoType; + /* 0x003 */ char unk_003[0x22B]; + /* 0x230 */ void* (*init)(void* transition); + /* 0x234 */ void (*destroy)(void* transition); + /* 0x238 */ void (*update)(void* transition, s32 updateRate); + /* 0x23C */ void (*draw)(void* transition, Gfx** gfxP); + /* 0x240 */ void (*start)(void* transition); + /* 0x244 */ void (*setType)(void* transition, s32 type); + /* 0x248 */ void (*setColor)(void* transition, u32 color); + /* 0x24C */ void (*setEnvColor)(void* transition, u32 color); + /* 0x250 */ s32 (*isDone)(void* transition); + /* 0x254 */ char unk_254[0x4]; +} TransitionContext; // size = 0x258 + typedef struct { /* 0x0 */ char unk_0[0xC]; } TransitionFade; // size = 0xC -extern const TransitionInit TransitionFade_InitVars; - - typedef enum { /* 0 */ TRANSITION_CIRCLE_IN, /* 1 */ TRANSITION_CIRCLE_OUT, @@ -40,7 +69,6 @@ typedef struct { /* 0x14 */ u8 direction; // Direction the circle is transitioning ( In / Out ) /* 0x15 */ u8 maskType; // Positive / Negative mask type. Value of 0 will create a black circle /* 0x16 */ u8 isDone; // Signals when Transition is done updating - /* 0x17 */ UNK_TYPE1 pad_17; // struct padding /* 0x18 */ TexturePtr texture; /* 0x1C */ u8 masks; /* 0x1D */ u8 maskt; @@ -48,6 +76,4 @@ typedef struct { /* 0x1F */ s8 unk_1F; // Set to 0 and never used } TransitionCircle; // size = 0x20 -extern const TransitionInit TransitionCircle_InitVars; - #endif diff --git a/spec b/spec index bcbcf6697..33f635b8f 100644 --- a/spec +++ b/spec @@ -549,7 +549,6 @@ beginseg include "build/src/code/z_kaleido_manager.o" include "build/src/code/z_kaleido_scope_call.o" include "build/src/code/z_fbdemo_dlftbls.o" - include "build/data/code/code_801D0BB0.data.o" include "build/src/code/z_fbdemo.o" include "build/data/code/z_fbdemo.data.o" include "build/src/code/z_fbdemo_fade.o" diff --git a/src/boot_O2_g3/yaz0.c b/src/boot_O2_g3/yaz0.c index 5f8e5a0ed..63260e885 100644 --- a/src/boot_O2_g3/yaz0.c +++ b/src/boot_O2_g3/yaz0.c @@ -3,7 +3,7 @@ u8 sYaz0DataBuffer[0x400]; u8* sYaz0CurDataEnd; -u32 sYaz0CurRomStart; +uintptr_t sYaz0CurRomStart; u32 sYaz0CurSize; u8* sYaz0MaxPtr; u8* D_8009BE20; @@ -123,7 +123,7 @@ s32 Yaz0_DecompressImpl(u8* src, u8* dst) { return 0; } -void Yaz0_Decompress(u32 romStart, void* dst, size_t size) { +void Yaz0_Decompress(uintptr_t romStart, void* dst, size_t size) { s32 status; u32 pad; char sp80[0x50]; diff --git a/src/boot_O2_g3/z_std_dma.c b/src/boot_O2_g3/z_std_dma.c index 10d84dcb0..8e9d83872 100644 --- a/src/boot_O2_g3/z_std_dma.c +++ b/src/boot_O2_g3/z_std_dma.c @@ -60,7 +60,7 @@ s32 DmaMgr_DmaHandler(OSPiHandle* pihandle, OSIoMesg* mb, s32 direction) { return osEPiStartDma(pihandle, mb, direction); } -DmaEntry* DmaMgr_FindDmaEntry(u32 vrom) { +DmaEntry* DmaMgr_FindDmaEntry(uintptr_t vrom) { DmaEntry* curr; for (curr = dmadata; curr->vromEnd != 0; curr++) { @@ -77,7 +77,7 @@ DmaEntry* DmaMgr_FindDmaEntry(u32 vrom) { return NULL; } -u32 DmaMgr_TranslateVromToRom(u32 vrom) { +u32 DmaMgr_TranslateVromToRom(uintptr_t vrom) { DmaEntry* entry = DmaMgr_FindDmaEntry(vrom); if (entry != NULL) { @@ -95,7 +95,7 @@ u32 DmaMgr_TranslateVromToRom(u32 vrom) { return -1; } -s32 DmaMgr_FindDmaIndex(u32 vrom) { +s32 DmaMgr_FindDmaIndex(uintptr_t vrom) { DmaEntry* entry = DmaMgr_FindDmaEntry(vrom); if (entry != NULL) { diff --git a/src/code/z_actor.c b/src/code/z_actor.c index 88ec6c07b..84616f083 100644 --- a/src/code/z_actor.c +++ b/src/code/z_actor.c @@ -1060,7 +1060,7 @@ void Actor_SetScale(Actor* actor, f32 scale) { } void Actor_SetObjectDependency(PlayState* play, Actor* actor) { - gSegments[0x06] = PHYSICAL_TO_VIRTUAL(play->objectCtx.status[actor->objBankIndex].segment); + gSegments[0x06] = VIRTUAL_TO_PHYSICAL(play->objectCtx.status[actor->objBankIndex].segment); } void Actor_Init(Actor* actor, PlayState* play) { diff --git a/src/code/z_effect_soft_sprite_old_init.c b/src/code/z_effect_soft_sprite_old_init.c index bbdd528a4..4f24651d1 100644 --- a/src/code/z_effect_soft_sprite_old_init.c +++ b/src/code/z_effect_soft_sprite_old_init.c @@ -50,7 +50,7 @@ void EffectSs_DrawGEffect(PlayState* play, EffectSs* this, TexturePtr texture) { SkinMatrix_SetScale(&mfScale, scale, scale, scale); SkinMatrix_MtxFMtxFMult(&mfTrans, &play->billboardMtxF, &mfTrans11DA0); SkinMatrix_MtxFMtxFMult(&mfTrans11DA0, &mfScale, &mfResult); - gSegments[0x06] = PHYSICAL_TO_VIRTUAL(object); + gSegments[0x06] = VIRTUAL_TO_PHYSICAL(object); gSPSegment(POLY_XLU_DISP++, 0x06, object); mtx = SkinMatrix_MtxFToNewMtx(gfxCtx, &mfResult); diff --git a/src/code/z_en_hy_code.c b/src/code/z_en_hy_code.c index 5e32e5c95..19a52c1b4 100644 --- a/src/code/z_en_hy_code.c +++ b/src/code/z_en_hy_code.c @@ -84,7 +84,7 @@ EnDoor* EnHy_FindNearestDoor(Actor* actor, PlayState* play) { } void EnHy_ChangeObjectAndAnim(EnHy* enHy, PlayState* play, s16 animIndex) { - gSegments[6] = PHYSICAL_TO_VIRTUAL(play->objectCtx.status[enHy->animObjIndex].segment); + gSegments[6] = VIRTUAL_TO_PHYSICAL(play->objectCtx.status[enHy->animObjIndex].segment); EnHy_ChangeAnim(&enHy->skelAnime, animIndex); } @@ -92,7 +92,7 @@ s32 EnHy_UpdateSkelAnime(EnHy* enHy, PlayState* play) { s32 isUpdated = false; if (enHy->actor.draw != NULL) { - gSegments[6] = PHYSICAL_TO_VIRTUAL(play->objectCtx.status[enHy->animObjIndex].segment); + gSegments[6] = VIRTUAL_TO_PHYSICAL(play->objectCtx.status[enHy->animObjIndex].segment); SkelAnime_Update(&enHy->skelAnime); isUpdated = true; } @@ -119,7 +119,7 @@ s32 EnHy_Init(EnHy* enHy, PlayState* play, FlexSkeletonHeader* skeletonHeaderSeg enHy->actor.objBankIndex = enHy->skelLowerObjIndex; isInitialized = true; ActorShape_Init(&enHy->actor.shape, 0.0f, NULL, 0.0f); - gSegments[6] = PHYSICAL_TO_VIRTUAL(play->objectCtx.status[enHy->actor.objBankIndex].segment); + gSegments[6] = VIRTUAL_TO_PHYSICAL(play->objectCtx.status[enHy->actor.objBankIndex].segment); SkelAnime_InitFlex(play, &enHy->skelAnime, skeletonHeaderSeg, NULL, enHy->jointTable, enHy->morphTable, ENHY_LIMB_MAX); EnHy_ChangeObjectAndAnim(enHy, play, animIndex); diff --git a/src/code/z_fbdemo_circle.c b/src/code/z_fbdemo_circle.c index 9cbc308be..2a8144ea4 100644 --- a/src/code/z_fbdemo_circle.c +++ b/src/code/z_fbdemo_circle.c @@ -13,7 +13,7 @@ Gfx D_801D0D00[] = { }; //! @bug: TransitionCircle_Update should take an additional argument `s32 updateRate` -const TransitionInit TransitionCircle_InitVars = { +TransitionInit TransitionCircle_InitVars = { TransitionCircle_Init, TransitionCircle_Destroy, (void*)TransitionCircle_Update, TransitionCircle_Draw, TransitionCircle_Start, TransitionCircle_SetType, TransitionCircle_SetColor, NULL, TransitionCircle_IsDone, diff --git a/src/code/z_fbdemo_dlftbls.c b/src/code/z_fbdemo_dlftbls.c index 7ebce9e69..9d3685a45 100644 --- a/src/code/z_fbdemo_dlftbls.c +++ b/src/code/z_fbdemo_dlftbls.c @@ -1,5 +1,54 @@ #include "global.h" +#include "initvars.h" +#include "overlays/fbdemos/ovl_fbdemo_triforce/z_fbdemo_triforce.h" +#include "overlays/fbdemos/ovl_fbdemo_wipe1/z_fbdemo_wipe1.h" +#include "overlays/fbdemos/ovl_fbdemo_wipe3/z_fbdemo_wipe3.h" +#include "overlays/fbdemos/ovl_fbdemo_wipe4/z_fbdemo_wipe4.h" +#include "overlays/fbdemos/ovl_fbdemo_wipe5/z_fbdemo_wipe5.h" -#pragma GLOBAL_ASM("asm/non_matchings/code/z_fbdemo_dlftbls/func_80163C90.s") +#define TRANSITION_OVERLAY(name, filename) \ + { \ + { 0, 0 }, SEGMENT_START(ovl_##filename), SEGMENT_END(ovl_##filename), SEGMENT_ROM_START(ovl_##filename), \ + SEGMENT_ROM_END(ovl_##filename), &name##_InitVars, sizeof(name) \ + } -#pragma GLOBAL_ASM("asm/non_matchings/code/z_fbdemo_dlftbls/func_80163D80.s") +#define TRANSITION_OVERLAY_INTERNAL(name) \ + { { 0, 0 }, NULL, NULL, 0, 0, &name##_InitVars, sizeof(name) } + +#define TRANSITION_OVERLAY_UNSET \ + { 0 } + +TransitionOverlay gTransitionOverlayTable[] = { + TRANSITION_OVERLAY_INTERNAL(TransitionFade), TRANSITION_OVERLAY(TransitionTriforce, fbdemo_triforce), + TRANSITION_OVERLAY(TransitionWipe1, fbdemo_wipe1), TRANSITION_OVERLAY(TransitionWipe3, fbdemo_wipe3), + TRANSITION_OVERLAY(TransitionWipe4, fbdemo_wipe4), TRANSITION_OVERLAY_INTERNAL(TransitionCircle), + TRANSITION_OVERLAY(TransitionWipe5, fbdemo_wipe5), +}; + +void Transition_Init(TransitionContext* transitionCtx) { + TransitionOverlay* overlayEntry; + ptrdiff_t relocOffset; + TransitionInit* initInfo[1]; + + overlayEntry = &gTransitionOverlayTable[transitionCtx->fbdemoType]; + TransitionOverlay_Load(overlayEntry); + + relocOffset = (uintptr_t)Lib_PhysicalToVirtual(overlayEntry->loadInfo.addr) - (uintptr_t)overlayEntry->vramStart; + initInfo[0] = NULL; + initInfo[0] = (overlayEntry->initInfo != NULL) ? (TransitionInit*)((uintptr_t)overlayEntry->initInfo + relocOffset) + : initInfo[0]; + + transitionCtx->init = initInfo[0]->init; + transitionCtx->destroy = initInfo[0]->destroy; + transitionCtx->start = initInfo[0]->start; + transitionCtx->isDone = initInfo[0]->isDone; + transitionCtx->draw = initInfo[0]->draw; + transitionCtx->update = initInfo[0]->update; + transitionCtx->setType = initInfo[0]->setType; + transitionCtx->setColor = initInfo[0]->setColor; + transitionCtx->setEnvColor = initInfo[0]->setEnvColor; +} + +void Transition_Destroy(TransitionContext* transitionCtx) { + TransitionOverlay_Free(&gTransitionOverlayTable[transitionCtx->fbdemoType]); +} diff --git a/src/code/z_lib.c b/src/code/z_lib.c index 03e6c395c..6466b337c 100644 --- a/src/code/z_lib.c +++ b/src/code/z_lib.c @@ -704,11 +704,29 @@ void* Lib_SegmentedToVirtual(void* ptr) { void* Lib_SegmentedToVirtualNull(void* ptr) { if (((uintptr_t)ptr >> 28) == 0) { return ptr; + } else { + return SEGMENTED_TO_VIRTUAL(ptr); } - - return SEGMENTED_TO_VIRTUAL(ptr); } +/* + * Converts a 32-bit virtual address (0x80XXXXXX) to a 24-bit physical address (0xXXXXXX). The NULL case accounts for + * the NULL virtual address being 0x00000000 and not 0x80000000. Used by transition overlays, which store their + * addresses in 24-bit fields. + */ +void* Lib_VirtualToPhysical(void* ptr) { + if (ptr == NULL) { + return NULL; + } else { + return (void*)VIRTUAL_TO_PHYSICAL(ptr); + } +} + +/* + * Converts a 24-bit physical address (0xXXXXXX) to a 32-bit virtual address (0x80XXXXXX). The NULL case accounts for + * the NULL virtual address being 0x00000000 and not 0x80000000. Used by transition overlays, which store their + * addresses in 24-bit fields. + */ void* Lib_PhysicalToVirtual(void* ptr) { if (ptr == NULL) { return NULL; @@ -716,11 +734,3 @@ void* Lib_PhysicalToVirtual(void* ptr) { return (void*)PHYSICAL_TO_VIRTUAL(ptr); } } - -void* Lib_PhysicalToVirtualNull(void* ptr) { - if (ptr == NULL) { - return NULL; - } else { - return (void*)PHYSICAL_TO_VIRTUAL(ptr); - } -} diff --git a/src/code/z_overlay.c b/src/code/z_overlay.c index a358cefe6..2c8c8d6d7 100644 --- a/src/code/z_overlay.c +++ b/src/code/z_overlay.c @@ -1,14 +1,103 @@ +/** + * @file z_overlay.c + * + * Functions for handling transition overlays in memory + * + * Status codes returned from TransitionOverlay_Load and TransitionOverlay_Free: + * + * -1 : failed allocation or null reference + * 0 : successfully loaded/freed overlay + * 1 : successfully added/removed instance + * 2 : overlay is loaded but has no instances (?) TODO: Figure out why this exists + * 3 : internal overlay, so always loaded + */ + #include "global.h" #include "z64load.h" -#pragma GLOBAL_ASM("asm/non_matchings/code/z_overlay/func_801651B0.s") +void* TransitionOverlay_VramToRam(TransitionOverlay* overlayEntry, void* vramAddr) { + void* loadedRamAddr = Lib_PhysicalToVirtual(overlayEntry->loadInfo.addr); -#pragma GLOBAL_ASM("asm/non_matchings/code/z_overlay/func_80165224.s") + if ((loadedRamAddr != NULL) && (vramAddr >= overlayEntry->vramStart) && (vramAddr < overlayEntry->vramEnd)) { + return ((uintptr_t)loadedRamAddr - (uintptr_t)overlayEntry->vramStart) + (uintptr_t)vramAddr; + } + return vramAddr; +} -#pragma GLOBAL_ASM("asm/non_matchings/code/z_overlay/func_80165288.s") +void TransitionOverlay_VramToRamArray(TransitionOverlay* overlayEntry, void** vramAddrs, s32 count) { + s32 i; -#pragma GLOBAL_ASM("asm/non_matchings/code/z_overlay/func_8016537C.s") + for (i = 0; i < count; i++) { + vramAddrs[i] = TransitionOverlay_VramToRam(overlayEntry, vramAddrs[i]); + } +} -#pragma GLOBAL_ASM("asm/non_matchings/code/z_overlay/func_80165438.s") +s32 TransitionOverlay_Load(TransitionOverlay* overlayEntry) { + s32 count; + void* loadedRamAddr; -#pragma GLOBAL_ASM("asm/non_matchings/code/z_overlay/func_80165444.s") + if (overlayEntry->vromStart == 0) { + return 3; + } + if (Lib_PhysicalToVirtual(overlayEntry->loadInfo.addr) == NULL) { + loadedRamAddr = ZeldaArena_Malloc(VRAM_PTR_SIZE(overlayEntry)); + + if (loadedRamAddr == NULL) { + return -1; + } + Load2_LoadOverlay(overlayEntry->vromStart, overlayEntry->vromEnd, overlayEntry->vramStart, + overlayEntry->vramEnd, loadedRamAddr); + overlayEntry->loadInfo.addr = Lib_VirtualToPhysical(loadedRamAddr); + overlayEntry->loadInfo.count = 1; + return 0; + } else { + count = overlayEntry->loadInfo.count; + if (count != 0) { + count++; + overlayEntry->loadInfo.count = count; + if (count == 0) { + return 2; + } else { + return 1; + } + } + return 2; + } +} + +s32 TransitionOverlay_Free(TransitionOverlay* overlayEntry) { + s32 count; + void* loadedRamAddr; + + if (overlayEntry->vromStart == 0) { + return 3; + } + loadedRamAddr = Lib_PhysicalToVirtual(overlayEntry->loadInfo.addr); + if (loadedRamAddr != NULL) { + count = overlayEntry->loadInfo.count; + if (count != 0) { + count--; + overlayEntry->loadInfo.count = count; + if (count == 0) { + ZeldaArena_Free(loadedRamAddr); + overlayEntry->loadInfo.addr = Lib_VirtualToPhysical(NULL); + return 0; + } + return 1; + } + return 2; + } + return -1; +} + +void TransitionOverlay_ClearLoadInfo(TransitionOverlay* overlayEntry) { + overlayEntry->loadInfo.word = 0; // Equivalent to overlayEntry->loadInfo.count = 0, overlayEntry->loadInfo.addr = 0; +} + +void TransitionOverlay_SetSegment(TransitionOverlay* overlayEntry, void* vramStart, void* vramEnd, uintptr_t vromStart, + uintptr_t vromEnd) { + overlayEntry->vramStart = vramStart; + overlayEntry->vramEnd = vramEnd; + overlayEntry->vromStart = vromStart; + overlayEntry->vromEnd = vromEnd; +} diff --git a/src/code/z_player_lib.c b/src/code/z_player_lib.c index 0888be7c5..6f4198fc7 100644 --- a/src/code/z_player_lib.c +++ b/src/code/z_player_lib.c @@ -1107,7 +1107,7 @@ void Player_DrawGetItemImpl(PlayState* play, Player* player, Vec3f* refPos, s32 OPEN_DISPS(play->state.gfxCtx); - gSegments[6] = PHYSICAL_TO_VIRTUAL(player->giObjectSegment); + gSegments[6] = VIRTUAL_TO_PHYSICAL(player->giObjectSegment); gSPSegment(POLY_OPA_DISP++, 0x06, player->giObjectSegment); gSPSegment(POLY_XLU_DISP++, 0x06, player->giObjectSegment); @@ -1187,7 +1187,7 @@ void func_80127488(PlayState* play, Player* player, u8 alpha) { } void Player_DrawCouplesMask(PlayState* play, Player* player) { - gSegments[0xA] = PHYSICAL_TO_VIRTUAL(player->maskObjectSegment); + gSegments[0xA] = VIRTUAL_TO_PHYSICAL(player->maskObjectSegment); AnimatedMat_DrawOpa(play, Lib_SegmentedToVirtual(&object_mask_meoto_Matanimheader_001CD8)); } diff --git a/src/code/z_room.c b/src/code/z_room.c index e198e95ed..eb615c409 100644 --- a/src/code/z_room.c +++ b/src/code/z_room.c @@ -105,7 +105,7 @@ s32 Room_HandleLoadCallbacks(PlayState* play, RoomContext* roomCtx) { roomCtx->unk31 = 0; roomCtx->curRoom.segment = roomCtx->activeRoomVram; // TODO: Segment number enum - gSegments[0x03] = PHYSICAL_TO_VIRTUAL(roomCtx->activeRoomVram); + gSegments[0x03] = VIRTUAL_TO_PHYSICAL(roomCtx->activeRoomVram); Scene_ProcessHeader(play, (SceneCmd*)roomCtx->curRoom.segment); func_80123140(play, GET_PLAYER(play)); @@ -130,7 +130,7 @@ s32 Room_HandleLoadCallbacks(PlayState* play, RoomContext* roomCtx) { void Room_Draw(PlayState* play, Room* room, u32 flags) { if (room->segment != NULL) { // TODO: Segment number enum - gSegments[0x03] = PHYSICAL_TO_VIRTUAL(room->segment); + gSegments[0x03] = VIRTUAL_TO_PHYSICAL(room->segment); roomDrawFuncs[room->mesh->type0.type](play, room, flags); } return; diff --git a/src/code/z_scene.c b/src/code/z_scene.c index 7b88d4520..c32a2271d 100644 --- a/src/code/z_scene.c +++ b/src/code/z_scene.c @@ -52,7 +52,7 @@ void Object_InitBank(GameState* gameState, ObjectContext* objectCtx) { objectCtx->spaceEnd = (void*)((u32)objectCtx->spaceStart + spaceSize); objectCtx->mainKeepIndex = Object_Spawn(objectCtx, GAMEPLAY_KEEP); - gSegments[0x04] = PHYSICAL_TO_VIRTUAL(objectCtx->status[objectCtx->mainKeepIndex].segment); + gSegments[0x04] = VIRTUAL_TO_PHYSICAL(objectCtx->status[objectCtx->mainKeepIndex].segment); } void Object_UpdateBank(ObjectContext* objectCtx) { @@ -108,7 +108,7 @@ s32 Object_IsLoaded(ObjectContext* objectCtx, s32 index) { void Object_LoadAll(ObjectContext* objectCtx) { s32 i; s32 id; - u32 vromSize; + uintptr_t vromSize; for (i = 0; i < objectCtx->num; i++) { id = objectCtx->status[i].id; @@ -124,7 +124,7 @@ void Object_LoadAll(ObjectContext* objectCtx) { void* func_8012F73C(ObjectContext* objectCtx, s32 iParm2, s16 id) { u32 addr; - u32 vromSize; + uintptr_t vromSize; RomFile* fileTableEntry; objectCtx->status[iParm2].id = -id; @@ -224,7 +224,7 @@ void Scene_HeaderCmdSpecialFiles(PlayState* play, SceneCmd* cmd) { if (cmd->specialFiles.subKeepIndex != 0) { play->objectCtx.subKeepIndex = Object_Spawn(&play->objectCtx, cmd->specialFiles.subKeepIndex); // TODO: Segment number enum? - gSegments[0x05] = PHYSICAL_TO_VIRTUAL(play->objectCtx.status[play->objectCtx.subKeepIndex].segment); + gSegments[0x05] = VIRTUAL_TO_PHYSICAL(play->objectCtx.status[play->objectCtx.subKeepIndex].segment); } if (cmd->specialFiles.cUpElfMsgNum != 0) { @@ -350,7 +350,7 @@ void Scene_LoadAreaTextures(PlayState* play, s32 fileIndex) { { SEGMENT_ROM_START(scene_texture_07), SEGMENT_ROM_END(scene_texture_07) }, { SEGMENT_ROM_START(scene_texture_08), SEGMENT_ROM_END(scene_texture_08) }, }; - u32 vromStart = sceneTextureFiles[fileIndex].vromStart; + uintptr_t vromStart = sceneTextureFiles[fileIndex].vromStart; size_t size = sceneTextureFiles[fileIndex].vromEnd - vromStart; if (size != 0) { diff --git a/src/libultra/io/epirawdma.c b/src/libultra/io/epirawdma.c index fd7573151..aadd8ad5b 100644 --- a/src/libultra/io/epirawdma.c +++ b/src/libultra/io/epirawdma.c @@ -1,6 +1,6 @@ #include "global.h" -s32 __osEPiRawStartDma(OSPiHandle* handle, s32 direction, u32 cartAddr, void* dramAddr, size_t size) { +s32 __osEPiRawStartDma(OSPiHandle* handle, s32 direction, uintptr_t cartAddr, void* dramAddr, size_t size) { s32 status; OSPiHandle* curHandle; diff --git a/src/libultra/io/sirawread.c b/src/libultra/io/sirawread.c index 19327db49..7e3537603 100644 --- a/src/libultra/io/sirawread.c +++ b/src/libultra/io/sirawread.c @@ -1,6 +1,6 @@ #include "global.h" -s32 __osSiRawReadIo(u32 devAddr, u32* data) { +s32 __osSiRawReadIo(uintptr_t devAddr, u32* data) { if (__osSiDeviceBusy()) { return -1; } diff --git a/src/libultra/io/sirawwrite.c b/src/libultra/io/sirawwrite.c index 040fdee0d..0f98b08c5 100644 --- a/src/libultra/io/sirawwrite.c +++ b/src/libultra/io/sirawwrite.c @@ -1,6 +1,6 @@ #include "global.h" -s32 __osSiRawWriteIo(u32 devAddr, u32 data) { +s32 __osSiRawWriteIo(uintptr_t devAddr, u32 data) { if (__osSiDeviceBusy() != 0) { return -1; } diff --git a/src/overlays/actors/ovl_Boss_03/z_boss_03.c b/src/overlays/actors/ovl_Boss_03/z_boss_03.c index 870bc53a1..a0f3a208b 100644 --- a/src/overlays/actors/ovl_Boss_03/z_boss_03.c +++ b/src/overlays/actors/ovl_Boss_03/z_boss_03.c @@ -52,7 +52,6 @@ * - Effect Update/Draw * - Seaweed */ - #include "prevent_bss_reordering.h" #include "z_boss_03.h" #include "overlays/actors/ovl_Door_Warp1/z_door_warp1.h" @@ -2156,7 +2155,7 @@ void Boss03_SetObject(PlayState* play, s16 objectId) { OPEN_DISPS(play->state.gfxCtx); - gSegments[6] = PHYSICAL_TO_VIRTUAL(play->objectCtx.status[objectIndex].segment); + gSegments[6] = VIRTUAL_TO_PHYSICAL(play->objectCtx.status[objectIndex].segment); gSPSegment(POLY_OPA_DISP++, 0x06, play->objectCtx.status[objectIndex].segment); gSPSegment(POLY_XLU_DISP++, 0x06, play->objectCtx.status[objectIndex].segment); diff --git a/src/overlays/actors/ovl_Dm_Stk/z_dm_stk.c b/src/overlays/actors/ovl_Dm_Stk/z_dm_stk.c index 2be56dda3..90ccb1382 100644 --- a/src/overlays/actors/ovl_Dm_Stk/z_dm_stk.c +++ b/src/overlays/actors/ovl_Dm_Stk/z_dm_stk.c @@ -311,7 +311,7 @@ void DmStk_LoadObjectForAnimation(DmStk* this, PlayState* play) { } if (objectIndex >= 0) { - gSegments[6] = PHYSICAL_TO_VIRTUAL(play->objectCtx.status[objectIndex].segment); + gSegments[6] = VIRTUAL_TO_PHYSICAL(play->objectCtx.status[objectIndex].segment); } } @@ -1909,13 +1909,13 @@ void DmStk_PostLimbDraw2(PlayState* play, s32 limbIndex, Gfx** dList, Vec3s* rot (this->objectStk2ObjectIndex >= 0)) { Matrix_Push(); Matrix_Scale(2.0f, 2.0f, 2.0f, MTXMODE_APPLY); - gSegments[6] = PHYSICAL_TO_VIRTUAL(play->objectCtx.status[this->objectStk2ObjectIndex].segment); + gSegments[6] = VIRTUAL_TO_PHYSICAL(play->objectCtx.status[this->objectStk2ObjectIndex].segment); gSPSegment(POLY_OPA_DISP++, 0x06, play->objectCtx.status[this->objectStk2ObjectIndex].segment); AnimatedMat_Draw(play, Lib_SegmentedToVirtual(gSkullKidMajorasMaskCurseOverlayTexAnim)); Gfx_DrawDListOpa(play, gSkullKidMajorasMaskCurseOverlayDL); - gSegments[6] = PHYSICAL_TO_VIRTUAL(play->objectCtx.status[this->objectStkObjectIndex].segment); + gSegments[6] = VIRTUAL_TO_PHYSICAL(play->objectCtx.status[this->objectStkObjectIndex].segment); gSPSegment(POLY_OPA_DISP++, 0x06, play->objectCtx.status[this->objectStkObjectIndex].segment); @@ -2027,7 +2027,7 @@ void DmStk_Draw(Actor* thisx, PlayState* play) { return; } - gSegments[6] = PHYSICAL_TO_VIRTUAL(play->objectCtx.status[this->objectStkObjectIndex].segment); + gSegments[6] = VIRTUAL_TO_PHYSICAL(play->objectCtx.status[this->objectStkObjectIndex].segment); OPEN_DISPS(play->state.gfxCtx); diff --git a/src/overlays/actors/ovl_En_Bba_01/z_en_bba_01.c b/src/overlays/actors/ovl_En_Bba_01/z_en_bba_01.c index d141c6514..8398a69ed 100644 --- a/src/overlays/actors/ovl_En_Bba_01/z_en_bba_01.c +++ b/src/overlays/actors/ovl_En_Bba_01/z_en_bba_01.c @@ -262,8 +262,8 @@ s32 EnBba01_OverrideLimbDraw(PlayState* play, s32 limbIndex, Gfx** dList, Vec3f* if (limbIndex == BBA_LIMB_RIGHT_LOWER_ARM_ROOT) { OPEN_DISPS(play->state.gfxCtx); gSPSegment(POLY_OPA_DISP++, 0x06, play->objectCtx.status[this->enHy.headObjIndex].segment); - gSegments[6] = PHYSICAL_TO_VIRTUAL(play->objectCtx.status[this->enHy.headObjIndex].segment); - gSegments[6] = PHYSICAL_TO_VIRTUAL(play->objectCtx.status[this->enHy.skelLowerObjIndex].segment); + gSegments[6] = VIRTUAL_TO_PHYSICAL(play->objectCtx.status[this->enHy.headObjIndex].segment); + gSegments[6] = VIRTUAL_TO_PHYSICAL(play->objectCtx.status[this->enHy.skelLowerObjIndex].segment); CLOSE_DISPS(play->state.gfxCtx); } if (limbIndex == BBA_LIMB_RIGHT_LOWER_ARM_ROOT) { @@ -298,7 +298,7 @@ void EnBba01_PostLimbDraw(PlayState* play, s32 limbIndex, Gfx** dList, Vec3s* ro if (limbIndex == BBA_LIMB_HEAD) { OPEN_DISPS(play->state.gfxCtx); gSPSegment(POLY_OPA_DISP++, 0x06, play->objectCtx.status[this->enHy.skelUpperObjIndex].segment); - gSegments[0x06] = PHYSICAL_TO_VIRTUAL(play->objectCtx.status[this->enHy.skelUpperObjIndex].segment); + gSegments[0x06] = VIRTUAL_TO_PHYSICAL(play->objectCtx.status[this->enHy.skelUpperObjIndex].segment); CLOSE_DISPS(play->state.gfxCtx); } diff --git a/src/overlays/actors/ovl_En_Cne_01/z_en_cne_01.c b/src/overlays/actors/ovl_En_Cne_01/z_en_cne_01.c index 889055ee8..993076ba8 100644 --- a/src/overlays/actors/ovl_En_Cne_01/z_en_cne_01.c +++ b/src/overlays/actors/ovl_En_Cne_01/z_en_cne_01.c @@ -252,9 +252,9 @@ s32 EnCne01_OverrideLimbDraw(PlayState* play, s32 limbIndex, Gfx** dList, Vec3f* if (limbIndex == CNE_LIMB_HEAD) { OPEN_DISPS(play->state.gfxCtx); gSPSegment(POLY_OPA_DISP++, 0x06, play->objectCtx.status[this->enHy.headObjIndex].segment); - gSegments[6] = PHYSICAL_TO_VIRTUAL(play->objectCtx.status[this->enHy.headObjIndex].segment); + gSegments[6] = VIRTUAL_TO_PHYSICAL(play->objectCtx.status[this->enHy.headObjIndex].segment); *dList = gCneHeadBrownHairDL; - gSegments[6] = PHYSICAL_TO_VIRTUAL(play->objectCtx.status[this->enHy.skelLowerObjIndex].segment); + gSegments[6] = VIRTUAL_TO_PHYSICAL(play->objectCtx.status[this->enHy.skelLowerObjIndex].segment); CLOSE_DISPS(play->state.gfxCtx); } if (limbIndex == CNE_LIMB_HEAD) { @@ -290,7 +290,7 @@ void EnCne01_PostLimbDraw(PlayState* play, s32 limbIndex, Gfx** dList, Vec3s* ro if (limbIndex == CNE_LIMB_RIGHT_FOOT) { OPEN_DISPS(play->state.gfxCtx); gSPSegment(POLY_OPA_DISP++, 0x06, play->objectCtx.status[this->enHy.skelUpperObjIndex].segment); - gSegments[0x06] = PHYSICAL_TO_VIRTUAL(play->objectCtx.status[this->enHy.skelUpperObjIndex].segment); + gSegments[0x06] = VIRTUAL_TO_PHYSICAL(play->objectCtx.status[this->enHy.skelUpperObjIndex].segment); CLOSE_DISPS(play->state.gfxCtx); } diff --git a/src/overlays/actors/ovl_En_Dnk/z_en_dnk.c b/src/overlays/actors/ovl_En_Dnk/z_en_dnk.c index 50a027efa..346246f86 100644 --- a/src/overlays/actors/ovl_En_Dnk/z_en_dnk.c +++ b/src/overlays/actors/ovl_En_Dnk/z_en_dnk.c @@ -171,7 +171,7 @@ s32 func_80A515C4(EnDnk* this) { void func_80A51648(EnDnk* this, PlayState* play) { if (SubS_IsObjectLoaded(this->unk_28E, play) == true) { - gSegments[0x06] = PHYSICAL_TO_VIRTUAL(play->objectCtx.status[this->unk_28E].segment); + gSegments[0x06] = VIRTUAL_TO_PHYSICAL(play->objectCtx.status[this->unk_28E].segment); this->actor.draw = func_80A52018; this->actor.objBankIndex = this->unk_28E; ActorShape_Init(&this->actor.shape, 0.0f, NULL, 18.0f); diff --git a/src/overlays/actors/ovl_En_Nwc/z_en_nwc.c b/src/overlays/actors/ovl_En_Nwc/z_en_nwc.c index 2f842c8ae..3f66f7f70 100644 --- a/src/overlays/actors/ovl_En_Nwc/z_en_nwc.c +++ b/src/overlays/actors/ovl_En_Nwc/z_en_nwc.c @@ -242,14 +242,14 @@ void EnNwc_CheckFound(EnNwc* this, PlayState* play) { void EnNwc_LoadNiwSkeleton(EnNwc* this, PlayState* play) { if (Object_IsLoaded(&play->objectCtx, this->niwObjectIndex)) { - gSegments[6] = PHYSICAL_TO_VIRTUAL(play->objectCtx.status[this->niwObjectIndex].segment); + gSegments[6] = VIRTUAL_TO_PHYSICAL(play->objectCtx.status[this->niwObjectIndex].segment); SkelAnime_InitFlex(play, &this->niwSkeleton, &gNiwSkeleton, &gNiwIdleAnim, this->jointTable, this->morphTable, NIW_LIMB_MAX); Animation_Change(&this->niwSkeleton, &gNiwIdleAnim, 1.0f, 0.0f, Animation_GetLastFrame(&gNiwIdleAnim), ANIMMODE_LOOP, 0.0f); - gSegments[6] = PHYSICAL_TO_VIRTUAL(play->objectCtx.status[this->nwcObjectIndex].segment); + gSegments[6] = VIRTUAL_TO_PHYSICAL(play->objectCtx.status[this->nwcObjectIndex].segment); this->state = NWC_STATE_NIW_LOADED; EnNwc_ToggleState(this); } diff --git a/src/overlays/actors/ovl_En_S_Goro/z_en_s_goro.c b/src/overlays/actors/ovl_En_S_Goro/z_en_s_goro.c index ccc11a002..fbfe32252 100644 --- a/src/overlays/actors/ovl_En_S_Goro/z_en_s_goro.c +++ b/src/overlays/actors/ovl_En_S_Goro/z_en_s_goro.c @@ -788,7 +788,7 @@ s32 EnSGoro_UpdateCheerAnimation(EnSGoro* this, PlayState* play) { if (((EnJg*)this->otherGoron)->flags & 1) { this->loadedObjIndex = Object_GetIndex(&play->objectCtx, OBJECT_TAISOU); if (this->loadedObjIndex >= 0) { - gSegments[6] = PHYSICAL_TO_VIRTUAL(play->objectCtx.status[this->loadedObjIndex].segment); + gSegments[6] = VIRTUAL_TO_PHYSICAL(play->objectCtx.status[this->loadedObjIndex].segment); this->animInfoIndex = EN_S_GORO_ANIM_TAISOU_CHEER; SubS_ChangeAnimationByInfoS(&this->skelAnime, sAnimationInfo, this->animInfoIndex); return true; @@ -797,7 +797,7 @@ s32 EnSGoro_UpdateCheerAnimation(EnSGoro* this, PlayState* play) { } else if ((this->animInfoIndex == EN_S_GORO_ANIM_TAISOU_CHEER) && !(((EnJg*)this->otherGoron)->flags & 1)) { this->loadedObjIndex = Object_GetIndex(&play->objectCtx, OBJECT_OF1D_MAP); if (this->loadedObjIndex >= 0) { - gSegments[6] = PHYSICAL_TO_VIRTUAL(play->objectCtx.status[this->loadedObjIndex].segment); + gSegments[6] = VIRTUAL_TO_PHYSICAL(play->objectCtx.status[this->loadedObjIndex].segment); this->animInfoIndex = EN_S_GORO_ANIM_IDLE_STAND; SubS_ChangeAnimationByInfoS(&this->skelAnime, sAnimationInfo, this->animInfoIndex); this->skelAnime.curFrame = this->skelAnime.endFrame; @@ -1329,7 +1329,7 @@ void EnSGoro_Update(Actor* thisx, PlayState* play) { this->actionFunc(this, play); Actor_UpdateBgCheckInfo(play, &this->actor, 30.0f, 12.0f, 0.0f, 5); - gSegments[6] = PHYSICAL_TO_VIRTUAL(play->objectCtx.status[this->loadedObjIndex].segment); + gSegments[6] = VIRTUAL_TO_PHYSICAL(play->objectCtx.status[this->loadedObjIndex].segment); SkelAnime_Update(&this->skelAnime); if (this->animInfoIndex != EN_S_GORO_ANIM_SLEEPY) { EnSGoro_UpdateAttentionTarget(this, play); diff --git a/src/overlays/actors/ovl_En_Sob1/z_en_sob1.c b/src/overlays/actors/ovl_En_Sob1/z_en_sob1.c index b69877758..ebbdcf542 100644 --- a/src/overlays/actors/ovl_En_Sob1/z_en_sob1.c +++ b/src/overlays/actors/ovl_En_Sob1/z_en_sob1.c @@ -1305,7 +1305,7 @@ void EnSob1_Blink(EnSob1* this) { } void EnSob1_ChangeObject(EnSob1* this, PlayState* play) { - gSegments[0x06] = PHYSICAL_TO_VIRTUAL(play->objectCtx.status[this->shopkeeperAnimObjIndex].segment); + gSegments[0x06] = VIRTUAL_TO_PHYSICAL(play->objectCtx.status[this->shopkeeperAnimObjIndex].segment); } s32 EnSob1_AreObjectsLoaded(EnSob1* this, PlayState* play) { @@ -1323,7 +1323,7 @@ s32 EnSob1_AreObjectsLoaded(EnSob1* this, PlayState* play) { void EnSob1_ZoraShopkeeper_Init(EnSob1* this, PlayState* play) { SkelAnime_InitFlex(play, &this->skelAnime, &gZoraSkel, NULL, this->jointTable, this->morphTable, ZORA_LIMB_MAX); - gSegments[6] = PHYSICAL_TO_VIRTUAL(play->objectCtx.status[this->shopkeeperAnimObjIndex].segment); + gSegments[6] = VIRTUAL_TO_PHYSICAL(play->objectCtx.status[this->shopkeeperAnimObjIndex].segment); Animation_Change(&this->skelAnime, &gZoraShopkeeperAnim, 1.0f, 0.0f, Animation_GetLastFrame(&gZoraShopkeeperAnim), ANIMMODE_LOOP, 0.0f); this->actor.draw = EnSob1_ZoraShopkeeper_Draw; @@ -1332,7 +1332,7 @@ void EnSob1_ZoraShopkeeper_Init(EnSob1* this, PlayState* play) { void EnSob1_GoronShopkeeper_Init(EnSob1* this, PlayState* play) { SkelAnime_InitFlex(play, &this->skelAnime, &gGoronSkel, NULL, this->jointTable, this->morphTable, GORON_LIMB_MAX); - gSegments[6] = PHYSICAL_TO_VIRTUAL(play->objectCtx.status[this->shopkeeperAnimObjIndex].segment); + gSegments[6] = VIRTUAL_TO_PHYSICAL(play->objectCtx.status[this->shopkeeperAnimObjIndex].segment); Animation_Change(&this->skelAnime, &gGoronShopkeeperAnim, 1.0f, 0.0f, Animation_GetLastFrame(&gGoronShopkeeperAnim), ANIMMODE_LOOP, 0.0f); this->actor.draw = EnSob1_GoronShopkeeper_Draw; diff --git a/src/overlays/effects/ovl_Effect_Ss_Extra/z_eff_ss_extra.c b/src/overlays/effects/ovl_Effect_Ss_Extra/z_eff_ss_extra.c index e33b486f4..1ec1ab41d 100644 --- a/src/overlays/effects/ovl_Effect_Ss_Extra/z_eff_ss_extra.c +++ b/src/overlays/effects/ovl_Effect_Ss_Extra/z_eff_ss_extra.c @@ -37,7 +37,7 @@ u32 EffectSsExtra_Init(PlayState* play, u32 index, EffectSs* this, void* initPar if ((objIndex >= 0) && (Object_IsLoaded(&play->objectCtx, objIndex))) { void* segBackup = gSegments[6]; - gSegments[6] = PHYSICAL_TO_VIRTUAL(play->objectCtx.status[objIndex].segment); + gSegments[6] = VIRTUAL_TO_PHYSICAL(play->objectCtx.status[objIndex].segment); this->pos = params->pos; this->velocity = params->velocity; @@ -66,7 +66,7 @@ void EffectSsExtra_Draw(PlayState* play, u32 index, EffectSs* this) { OPEN_DISPS(play->state.gfxCtx); - gSegments[6] = PHYSICAL_TO_VIRTUAL(storedSegment); + gSegments[6] = VIRTUAL_TO_PHYSICAL(storedSegment); gSPSegment(POLY_XLU_DISP++, 0x06, storedSegment); diff --git a/src/overlays/fbdemos/ovl_fbdemo_triforce/z_fbdemo_triforce.c b/src/overlays/fbdemos/ovl_fbdemo_triforce/z_fbdemo_triforce.c index 4584cfab2..00e7cfabd 100644 --- a/src/overlays/fbdemos/ovl_fbdemo_triforce/z_fbdemo_triforce.c +++ b/src/overlays/fbdemos/ovl_fbdemo_triforce/z_fbdemo_triforce.c @@ -16,7 +16,7 @@ void TransitionTriforce_SetType(void* thisx, s32 type); void TransitionTriforce_SetColor(void* thisx, u32 color); s32 TransitionTriforce_IsDone(void* thisx); -const TransitionInit TransitionTriforce_InitVars = { +TransitionInit TransitionTriforce_InitVars = { TransitionTriforce_Init, TransitionTriforce_Destroy, TransitionTriforce_Update, TransitionTriforce_Draw, TransitionTriforce_Start, TransitionTriforce_SetType, TransitionTriforce_SetColor, NULL, TransitionTriforce_IsDone, diff --git a/src/overlays/fbdemos/ovl_fbdemo_triforce/z_fbdemo_triforce.h b/src/overlays/fbdemos/ovl_fbdemo_triforce/z_fbdemo_triforce.h index 2637b32cf..06d807a08 100644 --- a/src/overlays/fbdemos/ovl_fbdemo_triforce/z_fbdemo_triforce.h +++ b/src/overlays/fbdemos/ovl_fbdemo_triforce/z_fbdemo_triforce.h @@ -28,6 +28,4 @@ typedef struct { /* 0x060 */ Mtx modelView[2][3]; } TransitionTriforce; // size = 0x1E0 -extern const TransitionInit TransitionTriforce_InitVars; - #endif diff --git a/src/overlays/fbdemos/ovl_fbdemo_wipe1/z_fbdemo_wipe1.c b/src/overlays/fbdemos/ovl_fbdemo_wipe1/z_fbdemo_wipe1.c index 560d341f2..ed12d400e 100644 --- a/src/overlays/fbdemos/ovl_fbdemo_wipe1/z_fbdemo_wipe1.c +++ b/src/overlays/fbdemos/ovl_fbdemo_wipe1/z_fbdemo_wipe1.c @@ -17,7 +17,7 @@ void TransitionWipe1_SetEnvColor(void* thisx, u32 color); s32 TransitionWipe1_IsDone(void* thisx); #if 0 -const TransitionInit TransitionWipe1_InitVars = { +TransitionInit TransitionWipe1_InitVars = { TransitionWipe1_Init, TransitionWipe1_Destroy, TransitionWipe1_Update, diff --git a/src/overlays/fbdemos/ovl_fbdemo_wipe1/z_fbdemo_wipe1.h b/src/overlays/fbdemos/ovl_fbdemo_wipe1/z_fbdemo_wipe1.h index fe70e724b..971940bb2 100644 --- a/src/overlays/fbdemos/ovl_fbdemo_wipe1/z_fbdemo_wipe1.h +++ b/src/overlays/fbdemos/ovl_fbdemo_wipe1/z_fbdemo_wipe1.h @@ -7,6 +7,4 @@ typedef struct { /* 0x0000 */ char unk_0[0x218]; } TransitionWipe1; // size = 0x218 -extern const TransitionInit TransitionWipe1_InitVars; - #endif diff --git a/src/overlays/fbdemos/ovl_fbdemo_wipe3/z_fbdemo_wipe3.c b/src/overlays/fbdemos/ovl_fbdemo_wipe3/z_fbdemo_wipe3.c index bbd488642..c33f3c8c7 100644 --- a/src/overlays/fbdemos/ovl_fbdemo_wipe3/z_fbdemo_wipe3.c +++ b/src/overlays/fbdemos/ovl_fbdemo_wipe3/z_fbdemo_wipe3.c @@ -17,7 +17,7 @@ void TransitionWipe3_SetEnvColor(void* thisx, u32 color); s32 TransitionWipe3_IsDone(void* thisx); #if 0 -const TransitionInit TransitionWipe3_InitVars = { +TransitionInit TransitionWipe3_InitVars = { TransitionWipe3_Init, TransitionWipe3_Destroy, TransitionWipe3_Update, diff --git a/src/overlays/fbdemos/ovl_fbdemo_wipe3/z_fbdemo_wipe3.h b/src/overlays/fbdemos/ovl_fbdemo_wipe3/z_fbdemo_wipe3.h index f74f86a61..8fed0dcfe 100644 --- a/src/overlays/fbdemos/ovl_fbdemo_wipe3/z_fbdemo_wipe3.h +++ b/src/overlays/fbdemos/ovl_fbdemo_wipe3/z_fbdemo_wipe3.h @@ -7,6 +7,4 @@ typedef struct { /* 0x0000 */ char unk_0[0x120]; } TransitionWipe3; // size = 0x120 -extern const TransitionInit TransitionWipe3_InitVars; - #endif diff --git a/src/overlays/fbdemos/ovl_fbdemo_wipe4/z_fbdemo_wipe4.c b/src/overlays/fbdemos/ovl_fbdemo_wipe4/z_fbdemo_wipe4.c index 49dd027c8..e91d8ab5e 100644 --- a/src/overlays/fbdemos/ovl_fbdemo_wipe4/z_fbdemo_wipe4.c +++ b/src/overlays/fbdemos/ovl_fbdemo_wipe4/z_fbdemo_wipe4.c @@ -17,7 +17,7 @@ void TransitionWipe4_SetEnvColor(void* thisx, u32 color); s32 TransitionWipe4_IsDone(void* thisx); #if 0 -const TransitionInit TransitionWipe4_InitVars = { +TransitionInit TransitionWipe4_InitVars = { TransitionWipe4_Init, TransitionWipe4_Destroy, TransitionWipe4_Update, diff --git a/src/overlays/fbdemos/ovl_fbdemo_wipe4/z_fbdemo_wipe4.h b/src/overlays/fbdemos/ovl_fbdemo_wipe4/z_fbdemo_wipe4.h index 60296230e..8a677c2a4 100644 --- a/src/overlays/fbdemos/ovl_fbdemo_wipe4/z_fbdemo_wipe4.h +++ b/src/overlays/fbdemos/ovl_fbdemo_wipe4/z_fbdemo_wipe4.h @@ -7,6 +7,4 @@ typedef struct { /* 0x0000 */ char unk_0[0x28]; } TransitionWipe4; // size = 0x28 -extern const TransitionInit TransitionWipe4_InitVars; - #endif diff --git a/src/overlays/fbdemos/ovl_fbdemo_wipe5/z_fbdemo_wipe5.c b/src/overlays/fbdemos/ovl_fbdemo_wipe5/z_fbdemo_wipe5.c index 87f5638ac..0ed80c066 100644 --- a/src/overlays/fbdemos/ovl_fbdemo_wipe5/z_fbdemo_wipe5.c +++ b/src/overlays/fbdemos/ovl_fbdemo_wipe5/z_fbdemo_wipe5.c @@ -17,7 +17,7 @@ void TransitionWipe5_SetEnvColor(void* thisx, u32 color); s32 TransitionWipe5_IsDone(void* thisx); #if 0 -const TransitionInit TransitionWipe5_InitVars = { +TransitionInit TransitionWipe5_InitVars = { TransitionWipe5_Init, TransitionWipe5_Destroy, TransitionWipe5_Update, diff --git a/src/overlays/fbdemos/ovl_fbdemo_wipe5/z_fbdemo_wipe5.h b/src/overlays/fbdemos/ovl_fbdemo_wipe5/z_fbdemo_wipe5.h index d8ffe0616..d5f882dec 100644 --- a/src/overlays/fbdemos/ovl_fbdemo_wipe5/z_fbdemo_wipe5.h +++ b/src/overlays/fbdemos/ovl_fbdemo_wipe5/z_fbdemo_wipe5.h @@ -7,6 +7,4 @@ typedef struct { /* 0x0000 */ char unk_0[0x14]; } TransitionWipe5; // size = 0x14 -extern const TransitionInit TransitionWipe5_InitVars; - #endif diff --git a/tools/disasm/functions.txt b/tools/disasm/functions.txt index 62e5b7bdc..dbe3430c4 100644 --- a/tools/disasm/functions.txt +++ b/tools/disasm/functions.txt @@ -1854,8 +1854,8 @@ 0x801004FC:("Lib_Nop801004FC",), 0x80100504:("Lib_SegmentedToVirtual",), 0x8010053C:("Lib_SegmentedToVirtualNull",), - 0x80100584:("Lib_PhysicalToVirtual",), - 0x801005A0:("Lib_PhysicalToVirtualNull",), + 0x80100584:("Lib_VirtualToPhysical",), + 0x801005A0:("Lib_PhysicalToVirtual",), 0x801005C0:("LifeMeter_Init",), 0x8010069C:("LifeMeter_UpdateColors",), 0x80100A80:("func_80100A80",), @@ -2936,8 +2936,8 @@ 0x80163A38:("KaleidoScopeCall_Destroy",), 0x80163A58:("KaleidoScopeCall_Update",), 0x80163C0C:("KaleidoScopeCall_Draw",), - 0x80163C90:("func_80163C90",), - 0x80163D80:("func_80163D80",), + 0x80163C90:("Transition_Init",), + 0x80163D80:("Transition_Destroy",), 0x80163DC0:("func_80163DC0",), 0x8016418C:("func_8016418C",), 0x8016424C:("func_8016424C",), @@ -2964,12 +2964,12 @@ 0x80164C14:("func_80164C14",), 0x80165044:("TransitionCircle_Draw",), 0x80165198:("TransitionCircle_IsDone",), - 0x801651B0:("func_801651B0",), - 0x80165224:("func_80165224",), - 0x80165288:("func_80165288",), - 0x8016537C:("func_8016537C",), - 0x80165438:("func_80165438",), - 0x80165444:("func_80165444",), + 0x801651B0:("TransitionOverlay_VramToRam",), + 0x80165224:("TransitionOverlay_VramToRamArray",), + 0x80165288:("TransitionOverlay_Load",), + 0x8016537C:("TransitionOverlay_Free",), + 0x80165438:("TransitionOverlay_ClearLoadInfo",), + 0x80165444:("TransitionOverlay_SetSegment",), 0x80165460:("func_80165460",), 0x80165608:("func_80165608",), 0x80165630:("func_80165630",), diff --git a/tools/sizes/code_functions.csv b/tools/sizes/code_functions.csv index 9db0c0308..acec92239 100644 --- a/tools/sizes/code_functions.csv +++ b/tools/sizes/code_functions.csv @@ -1368,8 +1368,8 @@ asm/non_matchings/code/z_lib/Math_Vec3f_StepTo.s,Math_Vec3f_StepTo,0x80100448,0x asm/non_matchings/code/z_lib/Lib_Nop801004FC.s,Lib_Nop801004FC,0x801004FC,0x2 asm/non_matchings/code/z_lib/Lib_SegmentedToVirtual.s,Lib_SegmentedToVirtual,0x80100504,0xE asm/non_matchings/code/z_lib/Lib_SegmentedToVirtualNull.s,Lib_SegmentedToVirtualNull,0x8010053C,0x12 -asm/non_matchings/code/z_lib/Lib_PhysicalToVirtual.s,Lib_PhysicalToVirtual,0x80100584,0x7 -asm/non_matchings/code/z_lib/Lib_PhysicalToVirtualNull.s,Lib_PhysicalToVirtualNull,0x801005A0,0x8 +asm/non_matchings/code/z_lib/Lib_VirtualToPhysical.s,Lib_VirtualToPhysical,0x80100584,0x7 +asm/non_matchings/code/z_lib/Lib_PhysicalToVirtual.s,Lib_PhysicalToVirtual,0x801005A0,0x8 asm/non_matchings/code/z_lifemeter/LifeMeter_Init.s,LifeMeter_Init,0x801005C0,0x37 asm/non_matchings/code/z_lifemeter/LifeMeter_UpdateColors.s,LifeMeter_UpdateColors,0x8010069C,0xF9 asm/non_matchings/code/z_lifemeter/func_80100A80.s,func_80100A80,0x80100A80,0x8 @@ -2450,8 +2450,8 @@ asm/non_matchings/code/z_kaleido_scope_call/func_801639EC.s,func_801639EC,0x8016 asm/non_matchings/code/z_kaleido_scope_call/func_80163A38.s,func_80163A38,0x80163A38,0x8 asm/non_matchings/code/z_kaleido_scope_call/func_80163A58.s,func_80163A58,0x80163A58,0x6D asm/non_matchings/code/z_kaleido_scope_call/func_80163C0C.s,func_80163C0C,0x80163C0C,0x21 -asm/non_matchings/code/z_fbdemo_dlftbls/func_80163C90.s,func_80163C90,0x80163C90,0x3C -asm/non_matchings/code/z_fbdemo_dlftbls/func_80163D80.s,func_80163D80,0x80163D80,0x10 +asm/non_matchings/code/z_fbdemo_dlftbls/Transition_Init.s,Transition_Init,0x80163C90,0x3C +asm/non_matchings/code/z_fbdemo_dlftbls/Transition_Destroy.s,Transition_Destroy,0x80163D80,0x10 asm/non_matchings/code/z_fbdemo/func_80163DC0.s,func_80163DC0,0x80163DC0,0xF3 asm/non_matchings/code/z_fbdemo/func_8016418C.s,func_8016418C,0x8016418C,0x30 asm/non_matchings/code/z_fbdemo/func_8016424C.s,func_8016424C,0x8016424C,0x23 @@ -2478,12 +2478,12 @@ asm/non_matchings/code/z_fbdemo_circle/TransitionCircle_SetType.s,TransitionCirc asm/non_matchings/code/z_fbdemo_circle/func_80164C14.s,func_80164C14,0x80164C14,0x10C asm/non_matchings/code/z_fbdemo_circle/TransitionCircle_Draw.s,TransitionCircle_Draw,0x80165044,0x55 asm/non_matchings/code/z_fbdemo_circle/TransitionCircle_IsDone.s,TransitionCircle_IsDone,0x80165198,0x6 -asm/non_matchings/code/z_overlay/func_801651B0.s,func_801651B0,0x801651B0,0x1D -asm/non_matchings/code/z_overlay/func_80165224.s,func_80165224,0x80165224,0x19 -asm/non_matchings/code/z_overlay/func_80165288.s,func_80165288,0x80165288,0x3D -asm/non_matchings/code/z_overlay/func_8016537C.s,func_8016537C,0x8016537C,0x2F -asm/non_matchings/code/z_overlay/func_80165438.s,func_80165438,0x80165438,0x3 -asm/non_matchings/code/z_overlay/func_80165444.s,func_80165444,0x80165444,0x7 +asm/non_matchings/code/z_overlay/TransitionOverlay_VramToRam.s,TransitionOverlay_VramToRam,0x801651B0,0x1D +asm/non_matchings/code/z_overlay/TransitionOverlay_VramToRamArray.s,TransitionOverlay_VramToRamArray,0x80165224,0x19 +asm/non_matchings/code/z_overlay/TransitionOverlay_Load.s,TransitionOverlay_Load,0x80165288,0x3D +asm/non_matchings/code/z_overlay/TransitionOverlay_Free.s,TransitionOverlay_Free,0x8016537C,0x2F +asm/non_matchings/code/z_overlay/TransitionOverlay_ClearLoadInfo.s,TransitionOverlay_ClearLoadInfo,0x80165438,0x3 +asm/non_matchings/code/z_overlay/TransitionOverlay_SetSegment.s,TransitionOverlay_SetSegment,0x80165444,0x7 asm/non_matchings/code/z_play/func_80165460.s,func_80165460,0x80165460,0x6A asm/non_matchings/code/z_play/func_80165608.s,func_80165608,0x80165608,0xA asm/non_matchings/code/z_play/func_80165630.s,func_80165630,0x80165630,0xA From f379012742c07f2e069b24d77e4f30a614f63080 Mon Sep 17 00:00:00 2001 From: engineer124 <47598039+engineer124@users.noreply.github.com> Date: Wed, 5 Oct 2022 01:15:39 -0400 Subject: [PATCH 7/7] z_kaleido_map.c OK and Documented (Pause Menu Map Page) + related icon_item statics (dungeon/field/jpn) (#1094) * import pause menu map page * better owl-warp docs * fix func name * missed some owlwarps * fix merge from master * fix scene region code * PR Suggestions * add comment * add description of gWorldMapImageTex, thanks @EllipticEllipsis * clearup docs * missed a comma * bad formatter, drop comment * more cleanup --- .../interface/icon_item_dungeon_static.xml | 32 + .../xml/interface/icon_item_field_static.xml | 40 + assets/xml/interface/icon_item_jpn_static.xml | 31 + assets/xml/interface/parameter_static.xml | 1 + docs/tutorial/other_functions.md | 2 +- include/PR/gbi.h | 4 +- include/functions.h | 20 +- include/regs.h | 10 +- include/z64.h | 6 +- include/z64item.h | 15 +- include/z64save.h | 4 +- include/z64scene.h | 65 +- spec | 9 +- src/code/code_8012EC80.c | 109 +- src/code/title_setup.c | 6 +- src/code/z_actor.c | 7 +- src/code/z_kaleido_setup.c | 24 +- src/code/z_map_exp.c | 4 +- src/code/z_message.c | 25 +- src/code/z_message_nes.c | 64 +- src/code/z_scene.c | 17 +- .../actors/ovl_Door_Shutter/z_door_shutter.c | 2 +- .../actors/ovl_En_Tanron1/z_en_tanron1.c | 2 + .../ovl_kaleido_scope/z_kaleido_map.c | 1010 +++++++++++++++-- .../ovl_kaleido_scope/z_kaleido_scope.h | 9 +- .../ovl_kaleido_scope/z_kaleido_scope_NES.c | 2 +- tools/disasm/functions.txt | 18 +- tools/disasm/variables.txt | 42 +- tools/namefixer.py | 2 +- tools/sizes/code_functions.csv | 6 +- 30 files changed, 1321 insertions(+), 267 deletions(-) create mode 100644 assets/xml/interface/icon_item_dungeon_static.xml create mode 100644 assets/xml/interface/icon_item_field_static.xml create mode 100644 assets/xml/interface/icon_item_jpn_static.xml diff --git a/assets/xml/interface/icon_item_dungeon_static.xml b/assets/xml/interface/icon_item_dungeon_static.xml new file mode 100644 index 000000000..04ba39338 --- /dev/null +++ b/assets/xml/interface/icon_item_dungeon_static.xml @@ -0,0 +1,32 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/assets/xml/interface/icon_item_field_static.xml b/assets/xml/interface/icon_item_field_static.xml new file mode 100644 index 000000000..8fe3a9299 --- /dev/null +++ b/assets/xml/interface/icon_item_field_static.xml @@ -0,0 +1,40 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/assets/xml/interface/icon_item_jpn_static.xml b/assets/xml/interface/icon_item_jpn_static.xml new file mode 100644 index 000000000..aff93d07e --- /dev/null +++ b/assets/xml/interface/icon_item_jpn_static.xml @@ -0,0 +1,31 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/assets/xml/interface/parameter_static.xml b/assets/xml/interface/parameter_static.xml index 7532a95b8..e5e0808c0 100644 --- a/assets/xml/interface/parameter_static.xml +++ b/assets/xml/interface/parameter_static.xml @@ -127,6 +127,7 @@ + diff --git a/docs/tutorial/other_functions.md b/docs/tutorial/other_functions.md index 255ae9eb4..1c8ba6b5b 100644 --- a/docs/tutorial/other_functions.md +++ b/docs/tutorial/other_functions.md @@ -401,7 +401,7 @@ There remains one thing we need to fix before trying to compile it, namely `*(&g ```C /* 0x0EF8 */ u8 weekEventReg[100]; // "week_event_reg" - /* 0x0F5C */ u32 mapsVisited; // "area_arrival" + /* 0x0F5C */ u32 regionsVisited; // "area_arrival" ``` so it's somewhere in `weekEventReg`. `0xF37 - 0xEF8 = 0x3F = 63`, and it's a byte array, so the access is actually `gSaveContext.save.weekEventReg[63] & 0x80`. Now it will compile. We also don't use `!= 0` for flag comparisons: just `if (gSaveContext.save.weekEventReg[63] & 0x80)` will do. diff --git a/include/PR/gbi.h b/include/PR/gbi.h index 2c29420ea..632ca3caf 100644 --- a/include/PR/gbi.h +++ b/include/PR/gbi.h @@ -3572,7 +3572,7 @@ _DW({ \ #define gDPLoadTextureBlock(pkt, timg, fmt, siz, width, height, \ pal, cms, cmt, masks, maskt, shifts, shiftt) \ -{ \ +_DW({ \ gDPSetTextureImage(pkt, fmt, siz##_LOAD_BLOCK, 1, timg); \ gDPSetTile(pkt, fmt, siz##_LOAD_BLOCK, 0, 0, G_TX_LOADTILE, \ 0 , cmt, maskt, shiftt, cms, masks, shifts); \ @@ -3588,7 +3588,7 @@ _DW({ \ gDPSetTileSize(pkt, G_TX_RENDERTILE, 0, 0, \ ((width)-1) << G_TEXTURE_IMAGE_FRAC, \ ((height)-1) << G_TEXTURE_IMAGE_FRAC); \ -} +}) #define gDPLoadTextureBlockYuv(pkt, timg, fmt, siz, width, height, \ pal, cms, cmt, masks, maskt, shifts, shiftt) \ diff --git a/include/functions.h b/include/functions.h index dbbcc07df..88a149d1f 100644 --- a/include/functions.h +++ b/include/functions.h @@ -1672,8 +1672,8 @@ void func_80106644(PlayState* play, s16 arg1, s16 arg2, s16 arg3); // void func_80108558(UNK_TYPE1 param_1, UNK_TYPE1 param_2, UNK_TYPE1 param_3, UNK_TYPE1 param_4, UNK_TYPE4 param_5, UNK_TYPE4 param_6, UNK_TYPE4 param_7); // void func_80108A10(void); // void func_80108A64(void); -// void func_80108AF8(void); -// void func_801090B0(void); +void func_80108AF8(PlayState* play); +s32 func_801090B0(s32 arg0); s32 func_80109124(s16 arg0); // void func_801091F0(void); // void func_80109428(void); @@ -1805,15 +1805,15 @@ Vec3f* OLib_Vec3fDiffDegF(Vec3f* dest, Vec3f* a, Vec3f* b); Vec3s* OLib_Vec3fDiffBinAng(Vec3s* dest, Vec3f* a, Vec3f* b); void OLib_DbCameraVec3fDiff(PosRot* a, Vec3f* b, Vec3f* dest, s16 mode); void OLib_DbCameraVec3fSum(PosRot* a, Vec3f* b, Vec3f* dest, s16 mode); -// void func_8010CB80(UNK_TYPE1 param_1, UNK_TYPE1 param_2, UNK_TYPE1 param_3, UNK_TYPE1 param_4, UNK_TYPE2 param_5, UNK_TYPE2 param_6, UNK_TYPE2 param_7, UNK_TYPE2 param_8, UNK_TYPE2 param_9, UNK_TYPE2 param_10); -Gfx* func_8010CD98(Gfx* displayListHead, void* texture, s16 textureWidth, s16 textureHeight, s16 rectLeft, s16 rectTop, s16 rectWidth, s16 rectHeight, u16 dsdx, u16 dtdy); +Gfx* func_8010CB80(Gfx* gfx, TexturePtr texture, s16 textureWidth, s16 textureHeight, s16 rectLeft, s16 rectTop, s16 rectWidth, s16 rectHeight, u16 dsdx, u16 dtdy); +Gfx* func_8010CD98(Gfx* gfx, TexturePtr texture, s16 textureWidth, s16 textureHeight, s16 rectLeft, s16 rectTop, s16 rectWidth, s16 rectHeight, u16 dsdx, u16 dtdy); // void func_8010CFBC(UNK_TYPE1 param_1, UNK_TYPE1 param_2, UNK_TYPE1 param_3, UNK_TYPE1 param_4, UNK_TYPE2 param_5, UNK_TYPE2 param_6, UNK_TYPE2 param_7, UNK_TYPE2 param_8, UNK_TYPE2 param_9, UNK_TYPE2 param_10, UNK_TYPE2 param_11, UNK_TYPE2 param_12, UNK_TYPE2 param_13, UNK_TYPE2 param_14); // void func_8010D2D4(UNK_TYPE1 param_1, UNK_TYPE1 param_2, UNK_TYPE1 param_3, UNK_TYPE1 param_4, UNK_TYPE2 param_5, UNK_TYPE2 param_6, UNK_TYPE2 param_7, UNK_TYPE2 param_8, UNK_TYPE2 param_9, UNK_TYPE2 param_10, UNK_TYPE2 param_11); // void func_8010D480(UNK_TYPE1 param_1, UNK_TYPE1 param_2, UNK_TYPE1 param_3, UNK_TYPE1 param_4, UNK_TYPE2 param_5, UNK_TYPE2 param_6, UNK_TYPE2 param_7, UNK_TYPE2 param_8, UNK_TYPE2 param_9, UNK_TYPE2 param_10, UNK_TYPE2 param_11, UNK_TYPE2 param_12, UNK_TYPE2 param_13, UNK_TYPE2 param_14, UNK_TYPE4 param_15, UNK_TYPE4 param_16); -Gfx* func_8010D7D0(Gfx* displayListHead, void* texture, s16 textureWidth, s16 textureHeight, s16 rectLeft, s16 rectTop, s16 rectWidth, s16 rectHeight, u16 dsdx, u16 dtdy); +Gfx* func_8010D7D0(Gfx* gfx, TexturePtr texture, s16 textureWidth, s16 textureHeight, s16 rectLeft, s16 rectTop, s16 rectWidth, s16 rectHeight, u16 dsdx, u16 dtdy); // void func_8010D9F4(UNK_TYPE1 param_1, UNK_TYPE1 param_2, UNK_TYPE1 param_3, UNK_TYPE1 param_4, UNK_TYPE2 param_5, UNK_TYPE2 param_6, UNK_TYPE2 param_7, UNK_TYPE2 param_8, UNK_TYPE2 param_9, UNK_TYPE4 param_10, UNK_TYPE4 param_11, UNK_TYPE4 param_12, UNK_TYPE2 param_13, UNK_TYPE2 param_14); -Gfx* func_8010DC58(Gfx* displayListHead, void* texture, s16 textureWidth, s16 textureHeight, u16 i); -// void func_8010DE38(UNK_TYPE1 param_1, UNK_TYPE1 param_2, UNK_TYPE1 param_3, UNK_TYPE1 param_4, UNK_TYPE2 param_5, UNK_TYPE2 param_6); +Gfx* func_8010DC58(Gfx* gfx, TexturePtr texture, s16 textureWidth, s16 textureHeight, u16 i); +Gfx* func_8010DE38(Gfx* gfx, TexturePtr texture, s32 fmt, s16 textureWidth, s16 textureHeight, u16 point); // void func_8010E028(void); void Interface_StartTimer(s16 timerId, s16 seconds); void Interface_StartPostmanTimer(s16 seconds, s16 bunnyHoodState); @@ -2056,7 +2056,7 @@ void Inventory_ChangeEquipment(s16 value); u8 Inventory_DeleteEquipment(PlayState* play, s16 equipment); void Inventory_ChangeUpgrade(s16 upgrade, u32 value); s32 Inventory_IsMapVisible(s16 sceneId); -void Inventory_SetMapVisibility(s16 tingleIndex); +void Inventory_SetWorldMapCloudVisibility(s16 tingleIndex); void Inventory_SaveDekuPlaygroundHighScore(s16 timerId); void Inventory_IncrementSkullTokenCount(s16 sceneIndex); s16 Inventory_GetSkullTokenCount(s16 sceneIndex); @@ -2098,7 +2098,7 @@ void Scene_HeaderCmdActorCutsceneList(PlayState* play, SceneCmd* cmd); void Scene_HeaderCmdMiniMap(PlayState* play, SceneCmd* cmd); void Scene_HeaderCmd1D(PlayState* play, SceneCmd* cmd); void Scene_HeaderCmdMiniMapCompassInfo(PlayState* play, SceneCmd* cmd); -void Scene_HeaderCmdSetAreaVisitedFlag(PlayState* play, SceneCmd* cmd); +void Scene_HeaderCmdSetRegionVisitedFlag(PlayState* play, SceneCmd* cmd); void Scene_HeaderCmdAnimatedMaterials(PlayState* play, SceneCmd* cmd); void Scene_SetExitFade(PlayState* play); s32 Scene_ProcessHeader(PlayState* play, SceneCmd* header); @@ -2360,7 +2360,7 @@ void Message_FindMessageNES(PlayState* play, u16 textId); // void Message_LoadLocalizedRupeesNES(void); // void Message_LoadRupeesNES(UNK_TYPE1 param_1, UNK_TYPE1 param_2, UNK_TYPE1 param_3, UNK_TYPE1 param_4, UNK_TYPE2 param_5); // void Message_LoadTimeNES(UNK_TYPE1 param_1, UNK_TYPE1 param_2, UNK_TYPE1 param_3, UNK_TYPE1 param_4, UNK_TYPE4 param_5); -// void Message_LoadAreaTextNES(void); +// void Message_LoadOwlWarpTextNES(void); // void func_80159438(void); void func_8015966C(PlayState* play, UNK_PTR puParm2, UNK_TYPE arg3); // void func_8015A144(void); diff --git a/include/regs.h b/include/regs.h index cf15b236a..4ad6acbfb 100644 --- a/include/regs.h +++ b/include/regs.h @@ -47,8 +47,9 @@ #define R_RUN_SPEED_LIMIT REG(45) #define R_UPDATE_RATE SREG(30) #define R_PAUSE_MENU_MODE SREG(94) -#define R_C_UP_ICON_X YREG(88) -#define R_C_UP_ICON_Y YREG(89) +#define R_PAUSE_WORLD_MAP_YAW YREG(24) +#define R_PAUSE_WORLD_MAP_Y_OFFSET YREG(25) +#define R_PAUSE_WORLD_MAP_DEPTH YREG(26) #define R_MAGIC_FILL_COLOR(i) ZREG(0 + i) #define R_C_BTN_COLOR(i) ZREG(39 + i) #define R_B_BTN_COLOR(i) ZREG(43 + i) @@ -71,8 +72,13 @@ #define R_A_ICON_X XREG(20) #define R_A_BTN_COLOR(i) XREG(22 + i) #define R_MAGIC_CONSUME_TIMER_GIANTS_MASK XREG(41) +#define R_PAUSE_DBG_MAP_CLOUD_ON XREG(50) +#define R_PAUSE_DBG_MAP_CLOUD_X XREG(52) +#define R_PAUSE_DBG_MAP_CLOUD_Y XREG(53) #define R_MOON_CRASH_TIMER_Y XREG(80) #define R_MOON_CRASH_TIMER_X XREG(81) +#define R_PAUSE_OWLWARP_ALPHA XREG(87) +#define R_REVERSE_FLOOR_INDEX XREG(94) #define R_MINIMAP_DISABLED XREG(95) #define R_B_LABEL_DD WREG(0) #define R_OW_MINIMAP_X WREG(29) diff --git a/include/z64.h b/include/z64.h index d03879072..b18ab8d86 100644 --- a/include/z64.h +++ b/include/z64.h @@ -439,7 +439,7 @@ typedef struct { /* 0x238 */ s16 cursorPoint[5]; /* 0x242 */ s16 cursorXIndex[5]; /* 0x24C */ s16 cursorYIndex[5]; - /* 0x256 */ s16 unk_256; + /* 0x256 */ s16 unk_256; // Uses DungeonItem enum /* 0x258 */ s16 cursorSpecialPos; /* 0x25A */ s16 pageSwitchTimer; /* 0x25C */ u16 unk_25C; @@ -472,8 +472,8 @@ typedef struct { /* 0x2BA */ s16 equipAnimScale; // scale of item icon while moving being equipped to c-button /* 0x2BC */ s16 equipAnimShrinkRate; // rate the scale is shrinking for the item icon while moving being equipped to c-button /* 0x2BE */ s16 unk_2BE[5]; - /* 0x2C8 */ u16 unk_2C8; - /* 0x2CA */ s16 unk_2CA; + /* 0x2C8 */ u16 unk_2C8; // Uses PauseMenuPage enum for Owl Warp. Never set. + /* 0x2CA */ s16 unk_2CA; // Uses OwlStatueId enum for Owl Warp. Never set. } PauseContext; // size = 0x2D0 typedef struct { diff --git a/include/z64item.h b/include/z64item.h index d8a2185cc..7c6b719ca 100644 --- a/include/z64item.h +++ b/include/z64item.h @@ -65,6 +65,19 @@ typedef enum { /* 0x1C */ QUEST_HEART_PIECE_COUNT = 0x1C } QuestItem; +typedef enum { + /* -1 */ DUNGEON_NONE = -1, + /* 0 */ DUNGEON_BOSS_KEY, + /* 1 */ DUNGEON_COMPASS, + /* 2 */ DUNGEON_MAP, + /* 3 */ DUNGEON_STRAY_FAIRIES, + /* 4 */ DUNGEON_FLOOR_INDEX_4, // Top Floor + /* 5 */ DUNGEON_FLOOR_INDEX_3, + /* 6 */ DUNGEON_FLOOR_INDEX_2, + /* 7 */ DUNGEON_FLOOR_INDEX_1, + /* 8 */ DUNGEON_FLOOR_INDEX_0 // Bottom Floor +} DungeonItem; + typedef enum { /* 0x00 */ SLOT_OCARINA, /* 0x01 */ SLOT_BOW, @@ -550,6 +563,6 @@ typedef enum { /* 0x74 */ GID_PICTO_BOX, /* 0x75 */ GID_MASK_FIERCE_DEITY, /* 0x76 */ GID_MAX -} GetItemDrawID; +} GetItemDrawId; #endif diff --git a/include/z64save.h b/include/z64save.h index 436e410e6..fa65031eb 100644 --- a/include/z64save.h +++ b/include/z64save.h @@ -272,8 +272,8 @@ typedef struct Save { /* 0x0EF0 */ u32 lotteryCodeGuess; // Lottery code chosen by player (only uses lower three hex digits) /* 0x0EF4 */ u32 shootingGalleryHighScores; // High scores for both shooting galleries. Town uses lower 16 bits, Swamp uses higher 16 bits. /* 0x0EF8 */ u8 weekEventReg[100]; // "week_event_reg" - /* 0x0F5C */ u32 mapsVisited; // "area_arrival" - /* 0x0F60 */ u32 mapsVisible; // "cloud_clear" + /* 0x0F5C */ u32 regionsVisited; // "area_arrival" + /* 0x0F60 */ u32 worldMapCloudVisibility; // "cloud_clear" /* 0x0F64 */ u8 unk_F64; // "oca_rec_flag" has scarecrows song /* 0x0F65 */ u8 unk_F65; // "oca_rec_flag8" scarecrows song set? /* 0x0F66 */ u8 scarecrowSpawnSong[128]; diff --git a/include/z64scene.h b/include/z64scene.h index 9658c4f4d..bb82574f8 100644 --- a/include/z64scene.h +++ b/include/z64scene.h @@ -174,9 +174,9 @@ typedef struct { typedef struct { /* 0x0 */ u8 code; - /* 0x1 */ u8 cameraMovement; - /* 0x4 */ u32 area; -} SCmdMiscSettings; // size = 0x8 + /* 0x1 */ u8 sceneCsCount; + /* 0x4 */ void* segment; +} SCmdCutsceneList; // size = 0x8 typedef struct { /* 0x0 */ u8 code; @@ -186,9 +186,8 @@ typedef struct { typedef struct { /* 0x0 */ u8 code; - /* 0x1 */ u8 data1; - /* 0x4 */ u32 data2; -} SCmdWorldMapVisited; // size = 0x8 + /* 0x1 */ UNK_TYPE1 pad[7]; +} SCmdRegionVisited; // size = 0x8 typedef struct { /* 0x0 */ u8 code; @@ -523,9 +522,9 @@ typedef union { /* Command: 0x14 */ SCmdEndMarker endMarker; /* Command: 0x15 */ SCmdSoundSettings soundSettings; /* Command: 0x16 */ SCmdEchoSettings echoSettings; - /* Command: 0x17 */ SCmdMiscSettings miscSettings; + /* Command: 0x17 */ SCmdCutsceneList cutsceneList; /* Command: 0x18 */ SCmdAltHeaders altHeaders; - /* Command: 0x19 */ SCmdWorldMapVisited worldMapVisited; + /* Command: 0x19 */ SCmdRegionVisited regionVisited; /* Command: 0x1A */ SCmdTextureAnimations textureAnimations; /* Command: 0x1B */ SCmdCutsceneActorList cutsceneActorList; /* Command: 0x1C */ SCmdMinimapSettings minimapSettings; @@ -533,6 +532,49 @@ typedef union { /* Command: 0x1E */ SCmdMinimapChests minimapChests; } SceneCmd; // size = 0x8 +// Sets cursor point options on the world map +typedef enum { + /* 0x0 */ REGION_GREAT_BAY, + /* 0x1 */ REGION_ZORA_HALL, + /* 0x2 */ REGION_ROMANI_RANCH, + /* 0x3 */ REGION_DEKU_PALACE, + /* 0x4 */ REGION_WOODFALL, + /* 0x5 */ REGION_CLOCK_TOWN, + /* 0x6 */ REGION_SNOWHEAD, + /* 0x7 */ REGION_IKANA_GRAVEYARD, + /* 0x8 */ REGION_IKANA_CANYON, + /* 0x9 */ REGION_GORON_VILLAGE, + /* 0xA */ REGION_STONE_TOWER, + /* 0xB */ REGION_MAX +} RegionId; + +// Sets warp points for owl statues +typedef enum { + /* 0x0 */ OWL_WARP_GREAT_BAY_COAST, + /* 0x1 */ OWL_WARP_ZORA_CAPE, + /* 0x2 */ OWL_WARP_SNOWHEAD, + /* 0x3 */ OWL_WARP_MOUNTAIN_VILLAGE, + /* 0x4 */ OWL_WARP_CLOCK_TOWN, + /* 0x5 */ OWL_WARP_MILK_ROAD, + /* 0x6 */ OWL_WARP_WOODFALL, + /* 0x7 */ OWL_WARP_SOUTHERN_SWAMP, + /* 0x8 */ OWL_WARP_IKANA_CANYON, + /* 0x9 */ OWL_WARP_STONE_TOWER, + /* 0xA */ OWL_WARP_ENTRANCE, // Special index for warping to the entrance of a scene + /* 0xB */ OWL_WARP_MAX +} OwlWarpId; + +// Sets cloud visibility on the world map +typedef enum { + /* 0 */ TINGLE_MAP_CLOCK_TOWN, + /* 1 */ TINGLE_MAP_WOODFALL, + /* 2 */ TINGLE_MAP_SNOWHEAD, + /* 3 */ TINGLE_MAP_ROMANI_RANCH, + /* 4 */ TINGLE_MAP_GREAT_BAY, + /* 5 */ TINGLE_MAP_STONE_TOWER, + /* 6 */ TINGLE_MAP_MAX +} TingleMapId; + typedef enum { /* 0x00 */ SCENE_20SICHITAI2, // Southern Swamp (Clear) /* 0x01 */ SCENE_UNSET_1, @@ -810,7 +852,7 @@ typedef enum { /* 0x16 */ SCENE_CMD_ID_ECHO_SETTINGS, /* 0x17 */ SCENE_CMD_ID_CUTSCENE_LIST, /* 0x18 */ SCENE_CMD_ID_ALTERNATE_HEADER_LIST, - /* 0x19 */ SCENE_CMD_ID_MISC_SETTINGS, + /* 0x19 */ SCENE_CMD_ID_SET_REGION_VISITED, /* 0x1A */ SCENE_CMD_ID_ANIMATED_MATERIAL_LIST, /* 0x1B */ SCENE_CMD_ID_ACTOR_CUTSCENE_LIST, /* 0x1C */ SCENE_CMD_ID_MINIMAP_INFO, @@ -899,8 +941,9 @@ typedef enum { #define SCENE_CMD_ALTERNATE_HEADER_LIST(alternateHeaderList) \ { SCENE_CMD_ID_ALTERNATE_HEADER_LIST, 0, CMD_PTR(alternateHeaderList) } -#define SCENE_CMD_MISC_SETTINGS() \ - { SCENE_CMD_ID_MISC_SETTINGS, 0, CMD_W(0) } +#define SCENE_CMD_MISC_SETTINGS SCENE_CMD_SET_REGION_VISITED // TODO: ZAPD Capatability +#define SCENE_CMD_SET_REGION_VISITED() \ + { SCENE_CMD_ID_SET_REGION_VISITED, 0, CMD_W(0) } #define SCENE_CMD_ANIMATED_MATERIAL_LIST(matAnimList) \ { SCENE_CMD_ID_ANIMATED_MATERIAL_LIST, 0, CMD_PTR(matAnimList) } diff --git a/spec b/spec index 33f635b8f..c99e6ce3f 100644 --- a/spec +++ b/spec @@ -293,14 +293,16 @@ beginseg name "icon_item_field_static" compress romalign 0x1000 - include "build/baserom/icon_item_field_static.o" + include "build/assets/interface/icon_item_field_static/icon_item_field_static.o" + number 12 endseg beginseg name "icon_item_dungeon_static" compress romalign 0x1000 - include "build/baserom/icon_item_dungeon_static.o" + include "build/assets/interface/icon_item_dungeon_static/icon_item_dungeon_static.o" + number 12 endseg beginseg @@ -315,7 +317,8 @@ beginseg name "icon_item_jpn_static" compress romalign 0x1000 - include "build/baserom/icon_item_jpn_static.o" + include "build/assets/interface/icon_item_jpn_static/icon_item_jpn_static.o" + number 13 endseg beginseg diff --git a/src/code/code_8012EC80.c b/src/code/code_8012EC80.c index 278ef0830..eb70cfbc8 100644 --- a/src/code/code_8012EC80.c +++ b/src/code/code_8012EC80.c @@ -96,7 +96,7 @@ u32 gGsFlagsShift[] = { }; // TODO: use symbols for these icon textures once textures are properly in C -void* gItemIcons[] = { +TexturePtr gItemIcons[] = { 0x08000000, // ITEM_OCARINA 0x08001000, // ITEM_BOW 0x08002000, // ITEM_ARROW_FIRE @@ -249,7 +249,7 @@ u8 gItemSlots[] = { SLOT_LENS, // ITEM_LENS SLOT_HOOKSHOT, // ITEM_HOOKSHOT SLOT_SWORD_GREAT_FAIRY, // ITEM_SWORD_GREAT_FAIRY - SLOT_BOTTLE_1, // + SLOT_BOTTLE_1, // ITEM_LONGSHOT SLOT_BOTTLE_1, // ITEM_BOTTLE SLOT_BOTTLE_1, // ITEM_POTION_RED SLOT_BOTTLE_1, // ITEM_POTION_GREEN @@ -365,8 +365,8 @@ s16 gItemPrices[] = { }; // Used to map scene indexes to their region in Termina -u16 gSceneIdsPerRegion[11][27] = { - // Great Bay +u16 gSceneIdsPerRegion[REGION_MAX][27] = { + // REGION_GREAT_BAY { SCENE_30GYOSON, SCENE_LABO, @@ -378,15 +378,15 @@ u16 gSceneIdsPerRegion[11][27] = { SCENE_PIRATE, SCENE_35TAKI, SCENE_KINDAN2, - -1, + 0xFFFF, }, - // Zora Hall + // REGION_ZORA_HALL { SCENE_33ZORACITY, SCENE_BANDROOM, - -1, + 0xFFFF, }, - // Romani Ranch + // REGION_ROMANI_RANCH { SCENE_F01, SCENE_ROMANYMAE, @@ -394,17 +394,17 @@ u16 gSceneIdsPerRegion[11][27] = { SCENE_F01C, SCENE_F01_B, SCENE_KOEPONARACE, - -1, + 0xFFFF, }, - // Deku Palace + // REGION_DEKU_PALACE { SCENE_22DEKUCITY, SCENE_DEKU_KING, SCENE_26SARUNOMORI, SCENE_DANPEI, - -1, + 0xFFFF, }, - // Southern Swamp + // REGION_WOODFALL { SCENE_20SICHITAI, SCENE_20SICHITAI2, @@ -412,21 +412,18 @@ u16 gSceneIdsPerRegion[11][27] = { SCENE_WITCH_SHOP, SCENE_21MITURINMAE, SCENE_KINSTA1, - -1, + 0xFFFF, }, - // Clock Town + // REGION_CLOCK_TOWN { - SCENE_00KEIKOKU, SCENE_TENMON_DAI, SCENE_13HUBUKINOMITI, - SCENE_24KEMONOMITI, SCENE_SYATEKI_MORI, SCENE_IKANAMAE, - SCENE_TOWN, SCENE_SYATEKI_MIZU, SCENE_BOWLING, - SCENE_TAKARAYA, SCENE_YADOYA, SCENE_SONCHONOIE, - SCENE_MILK_BAR, SCENE_ICHIBA, SCENE_BOMYA, - SCENE_AYASHIISHOP, SCENE_8ITEMSHOP, SCENE_DOUJOU, - SCENE_POSTHOUSE, SCENE_TAKARAKUJI, SCENE_BACKTOWN, - SCENE_CLOCKTOWER, SCENE_INSIDETOWER, SCENE_OKUJOU, - SCENE_ALLEY, SCENE_DEKUTES, -1, + SCENE_00KEIKOKU, SCENE_TENMON_DAI, SCENE_13HUBUKINOMITI, SCENE_24KEMONOMITI, SCENE_SYATEKI_MORI, + SCENE_IKANAMAE, SCENE_TOWN, SCENE_SYATEKI_MIZU, SCENE_BOWLING, SCENE_TAKARAYA, + SCENE_YADOYA, SCENE_SONCHONOIE, SCENE_MILK_BAR, SCENE_ICHIBA, SCENE_BOMYA, + SCENE_AYASHIISHOP, SCENE_8ITEMSHOP, SCENE_DOUJOU, SCENE_POSTHOUSE, SCENE_TAKARAKUJI, + SCENE_BACKTOWN, SCENE_CLOCKTOWER, SCENE_INSIDETOWER, SCENE_OKUJOU, SCENE_ALLEY, + SCENE_DEKUTES, 0xFFFF, }, - // Snowhead + // REGION_SNOWHEAD { SCENE_10YUKIYAMANOMURA, SCENE_10YUKIYAMANOMURA2, @@ -437,15 +434,15 @@ u16 gSceneIdsPerRegion[11][27] = { SCENE_GORON_HAKA, SCENE_17SETUGEN, SCENE_17SETUGEN2, - -1, + 0xFFFF, }, - // Ikana Graveyard + // REGION_IKANA_GRAVEYARD { SCENE_BOTI, SCENE_DANPEI2TEST, - -1, + 0xFFFF, }, - // Ikana Canyon + // REGION_IKANA_CANYON { SCENE_CASTLE, SCENE_IKNINSIDE, @@ -456,21 +453,21 @@ u16 gSceneIdsPerRegion[11][27] = { SCENE_REDEAD, SCENE_TOUGITES, SCENE_HAKASHITA, - -1, + 0xFFFF, }, - // Goron Village + // REGION_GORON_VILLAGE { SCENE_11GORONNOSATO, SCENE_11GORONNOSATO2, SCENE_16GORON_HOUSE, SCENE_GORONSHOP, - -1, + 0xFFFF, }, - // Stone Tower + // REGION_STONE_TOWER { SCENE_F40, SCENE_F41, - -1, + 0xFFFF, }, }; @@ -553,9 +550,9 @@ s32 Inventory_IsMapVisible(s16 sceneId) { return false; } -static u16 sSceneIdsPerTingleMap[6][12] = { +static u16 sSceneIdsPerTingleMap[TINGLE_MAP_MAX][12] = { { - // Clock Town Tingle Map + // TINGLE_MAP_CLOCK_TOWN SCENE_00KEIKOKU, SCENE_BOTI, SCENE_13HUBUKINOMITI, @@ -566,20 +563,20 @@ static u16 sSceneIdsPerTingleMap[6][12] = { SCENE_BACKTOWN, SCENE_CLOCKTOWER, SCENE_ALLEY, - -1, + 0xFFFF, }, { - // Woodfall Tingle Map + // TINGLE_MAP_WOODFALL SCENE_20SICHITAI, SCENE_20SICHITAI2, SCENE_21MITURINMAE, SCENE_22DEKUCITY, SCENE_DEKU_KING, SCENE_KINSTA1, - -1, + 0xFFFF, }, { - // Snowhead Tingle Map + // TINGLE_MAP_SNOWHEAD SCENE_10YUKIYAMANOMURA, SCENE_10YUKIYAMANOMURA2, SCENE_11GORONNOSATO, @@ -590,20 +587,20 @@ static u16 sSceneIdsPerTingleMap[6][12] = { SCENE_GORONRACE, SCENE_17SETUGEN, SCENE_17SETUGEN2, - -1, + 0xFFFF, }, { - // Romani Ranch Tingle Map + // TINGLE_MAP_ROMANI_RANCH SCENE_F01, SCENE_ROMANYMAE, SCENE_OMOYA, SCENE_F01C, SCENE_F01_B, SCENE_KOEPONARACE, - -1, + 0xFFFF, }, { - // Great Bay Tingle Map + // TINGLE_MAP_GREAT_BAY SCENE_30GYOSON, SCENE_SINKAI, SCENE_31MISAKI, @@ -611,28 +608,28 @@ static u16 sSceneIdsPerTingleMap[6][12] = { SCENE_KAIZOKU, SCENE_33ZORACITY, SCENE_35TAKI, - -1, + 0xFFFF, }, { - // Stone Tower Tingle Map + // TINGLE_MAP_STONE_TOWER SCENE_F40, SCENE_F41, SCENE_CASTLE, SCENE_IKANA, SCENE_REDEAD, - -1, + 0xFFFF, }, }; /** - * Map visibility is achieved by purchasing a tingle map + * Removing clouds from the World Map is achieved by purchasing a tingle map */ -void Inventory_SetMapVisibility(s16 tingleIndex) { +void Inventory_SetWorldMapCloudVisibility(s16 tingleIndex) { s16 i = 0; s16 index = 0; u16(*tingleMapSceneIds)[] = &sSceneIdsPerTingleMap[tingleIndex]; - if ((tingleIndex >= 0) && (tingleIndex < 6)) { + if ((tingleIndex >= 0) && (tingleIndex < TINGLE_MAP_MAX)) { while (true) { if ((*tingleMapSceneIds)[i] == 0xFFFF) { break; @@ -665,21 +662,21 @@ void Inventory_SetMapVisibility(s16 tingleIndex) { } if ((*tingleMapSceneIds) == sSceneIdsPerTingleMap[0]) { - gSaveContext.save.mapsVisible |= 3; + gSaveContext.save.worldMapCloudVisibility |= 3; } else if ((*tingleMapSceneIds) == sSceneIdsPerTingleMap[1]) { - gSaveContext.save.mapsVisible |= 0x1C; + gSaveContext.save.worldMapCloudVisibility |= 0x1C; } else if ((*tingleMapSceneIds) == sSceneIdsPerTingleMap[2]) { - gSaveContext.save.mapsVisible |= 0xE0; + gSaveContext.save.worldMapCloudVisibility |= 0xE0; } else if ((*tingleMapSceneIds) == sSceneIdsPerTingleMap[3]) { - gSaveContext.save.mapsVisible |= 0x100; + gSaveContext.save.worldMapCloudVisibility |= 0x100; } else if ((*tingleMapSceneIds) == sSceneIdsPerTingleMap[4]) { - gSaveContext.save.mapsVisible |= 0x1E00; + gSaveContext.save.worldMapCloudVisibility |= 0x1E00; } else if ((*tingleMapSceneIds) == sSceneIdsPerTingleMap[5]) { - gSaveContext.save.mapsVisible |= 0x6000; + gSaveContext.save.worldMapCloudVisibility |= 0x6000; } } - XREG(95) = 0; + R_MINIMAP_DISABLED = false; } /** diff --git a/src/code/title_setup.c b/src/code/title_setup.c index dad3c6458..641160ea8 100644 --- a/src/code/title_setup.c +++ b/src/code/title_setup.c @@ -23,13 +23,13 @@ void Setup_SetRegs(void) { XREG(77) = 0x3C; XREG(78) = 0x2F; XREG(79) = 0x62; - XREG(87) = 0; + R_PAUSE_OWLWARP_ALPHA = 0; XREG(88) = 0x56; XREG(89) = 0x258; XREG(90) = 0x1C2; XREG(91) = 0; - XREG(94) = 0; - XREG(95) = 0; + R_REVERSE_FLOOR_INDEX = 0; + R_MINIMAP_DISABLED = false; YREG(32) = 0x50; YREG(33) = 0x3C; diff --git a/src/code/z_actor.c b/src/code/z_actor.c index 84616f083..c5783f4d7 100644 --- a/src/code/z_actor.c +++ b/src/code/z_actor.c @@ -861,10 +861,11 @@ void TitleCard_Draw(GameState* gameState, TitleCardContext* titleCtx) { OPEN_DISPS(gameState->gfxCtx); - height = (width * height > TMEM_SIZE) ? TMEM_SIZE / width : height; - spB4 = spB8 + (height * 4); + if (width * height > TMEM_SIZE) { + height = TMEM_SIZE / width; + } - if (1) {} + spB4 = spB8 + (height * 4); OVERLAY_DISP = func_8012C014(OVERLAY_DISP); diff --git a/src/code/z_kaleido_setup.c b/src/code/z_kaleido_setup.c index 0109dc4ab..2f2e3c388 100644 --- a/src/code/z_kaleido_setup.c +++ b/src/code/z_kaleido_setup.c @@ -22,19 +22,19 @@ void func_800F4A10(PlayState* play) { pauseCtx->unk_27E = -40; for (i = 0; i < ARRAY_COUNT(pauseCtx->worldMapPoints); i++) { - pauseCtx->worldMapPoints[i] = 0; + pauseCtx->worldMapPoints[i] = false; } if (pauseCtx->state == 1) { - for (i = 0; i < 11; i++) { - if ((gSaveContext.save.mapsVisited >> i) & 1) { - pauseCtx->worldMapPoints[i] = 1; + for (i = 0; i < REGION_MAX; i++) { + if ((gSaveContext.save.regionsVisited >> i) & 1) { + pauseCtx->worldMapPoints[i] = true; } } } else { - for (i = 9; i >= 0; i--) { + for (i = OWL_WARP_STONE_TOWER; i >= OWL_WARP_GREAT_BAY_COAST; i--) { if ((gSaveContext.save.playerData.owlActivationFlags >> i) & 1) { - pauseCtx->worldMapPoints[i] = 1; + pauseCtx->worldMapPoints[i] = true; pauseCtx->cursorPoint[PAUSE_WORLD_MAP] = i; } } @@ -57,9 +57,9 @@ void func_800F4A10(PlayState* play) { YREG(21) = -0x0622; YREG(22) = -0x0C44; YREG(23) = 0x0622; - YREG(24) = -0x0622; - YREG(25) = -0x005A; - YREG(26) = -0x3840; + R_PAUSE_WORLD_MAP_YAW = -0x622; + R_PAUSE_WORLD_MAP_Y_OFFSET = -90; + R_PAUSE_WORLD_MAP_DEPTH = -14400; } void KaleidoSetup_Update(PlayState* play) { @@ -124,18 +124,18 @@ void KaleidoSetup_Init(PlayState* play) { pauseCtx->unk_20C = 936.0f; pauseCtx->unk_220 = -314.0f; - pauseCtx->cursorPoint[PAUSE_MAP] = XREG(94) + 3; + pauseCtx->cursorPoint[PAUSE_MAP] = R_REVERSE_FLOOR_INDEX + (DUNGEON_FLOOR_INDEX_4 - 1); pauseCtx->cursorSpecialPos = PAUSE_CURSOR_PAGE_RIGHT; pauseCtx->pageSwitchTimer = 0; pauseCtx->cursorItem[PAUSE_ITEM] = PAUSE_ITEM_NONE; - pauseCtx->cursorItem[PAUSE_MAP] = XREG(94) + 3; + pauseCtx->cursorItem[PAUSE_MAP] = R_REVERSE_FLOOR_INDEX + (DUNGEON_FLOOR_INDEX_4 - 1); pauseCtx->cursorItem[PAUSE_QUEST] = PAUSE_ITEM_NONE; pauseCtx->cursorItem[PAUSE_MASK] = PAUSE_ITEM_NONE; pauseCtx->cursorSlot[PAUSE_ITEM] = 0; - pauseCtx->cursorSlot[PAUSE_MAP] = XREG(94) + 3; + pauseCtx->cursorSlot[PAUSE_MAP] = R_REVERSE_FLOOR_INDEX + (DUNGEON_FLOOR_INDEX_4 - 1); pauseCtx->cursorColorSet = 2; pauseCtx->unk_2A0 = -1; diff --git a/src/code/z_map_exp.c b/src/code/z_map_exp.c index 2b5eb1aac..57f51a20a 100644 --- a/src/code/z_map_exp.c +++ b/src/code/z_map_exp.c @@ -245,14 +245,14 @@ void Map_Update(PlayState* play) { if (floor != -1) { gSaveContext.save.permanentSceneFlags[Play_GetOriginalSceneId(play->sceneId)].unk_14 |= gBitFlags[FLOOR_INDEX_MAX - floor]; - XREG(94) = FLOOR_INDEX_MAX - floor; + R_REVERSE_FLOOR_INDEX = FLOOR_INDEX_MAX - floor; if (interfaceCtx->mapRoomNum != sLastRoomNum) { sLastRoomNum = interfaceCtx->mapRoomNum; } } } else if (Map_IsInBossArea(play)) { func_80105294(); - XREG(94) = FLOOR_INDEX_MAX - func_80105318(); + R_REVERSE_FLOOR_INDEX = FLOOR_INDEX_MAX - func_80105318(); } } } diff --git a/src/code/z_message.c b/src/code/z_message.c index 94f1e5992..de3a81c73 100644 --- a/src/code/z_message.c +++ b/src/code/z_message.c @@ -256,34 +256,33 @@ void func_8014CCB4(PlayState* play, s16* decodedBufPos, s32* offset, f32* arg3) #pragma GLOBAL_ASM("asm/non_matchings/code/z_message/func_8014D304.s") -extern u16 D_801D0188[][9]; -extern s16 D_801D0250[]; +extern u16 D_801D0188[OWL_WARP_MAX][9]; +extern s16 D_801D0250[OWL_WARP_MAX]; void func_8014D62C(PlayState* play, s32* arg1, f32* arg2, s16* arg3) { MessageContext* msgCtx = &play->msgCtx; PauseContext* pauseCtx = &play->pauseCtx; - s16 temp_s6; + s16 stringLimit; s16 temp_s1 = *arg3; s32 temp_s2 = *arg1; f32 sp3C = *arg2; - s16 phi_v0; + s16 owlWarpId; s16 phi_s0; - if ((func_8010A0A4(play) != 0) || (play->sceneId == SCENE_SECOM)) { - phi_v0 = 0xA; + if (func_8010A0A4(play) || (play->sceneId == SCENE_SECOM)) { + owlWarpId = OWL_WARP_ENTRANCE; } else { - phi_v0 = pauseCtx->cursorPoint[PAUSE_WORLD_MAP]; + owlWarpId = pauseCtx->cursorPoint[PAUSE_WORLD_MAP]; } + stringLimit = D_801D0250[owlWarpId]; - temp_s6 = D_801D0250[phi_v0]; - - for (phi_s0 = 0; phi_s0 < temp_s6; phi_s0++, temp_s1++, temp_s2 += 0x80) { - msgCtx->decodedBuffer.wchar[temp_s1] = D_801D0188[phi_v0][phi_s0]; - Font_LoadChar(play, D_801D0188[phi_v0][phi_s0], temp_s2); + for (phi_s0 = 0; phi_s0 < stringLimit; phi_s0++, temp_s1++, temp_s2 += 0x80) { + msgCtx->decodedBuffer.wchar[temp_s1] = D_801D0188[owlWarpId][phi_s0]; + Font_LoadChar(play, D_801D0188[owlWarpId][phi_s0], temp_s2); } temp_s1--; - sp3C += (temp_s6 - 1) * (16.0f * msgCtx->unk12098); + sp3C += (stringLimit - 1) * (16.0f * msgCtx->unk12098); *arg3 = temp_s1; *arg1 = temp_s2; diff --git a/src/code/z_message_nes.c b/src/code/z_message_nes.c index fef293b46..fb8dbfcbf 100644 --- a/src/code/z_message_nes.c +++ b/src/code/z_message_nes.c @@ -17,31 +17,43 @@ u8 D_801D06F0[4][8] = { { "rupee(s)" }, //EN // rupeesTextLength u8 D_801D0710[4] = {8,8,5,8}; -//TextArea -char D_801D0714[11][16] = { - "Great Bay Coast", - "Zora Cape", - "Snowhead", - "Mountain Village", - "Clock Town", - "Milk Road", - "Woodfall", - "Southern Swamp", - "Ikana Canyon", - "Stone Tower", - "Entrance" - }; +// sOwlWarpText +char D_801D0714[OWL_WARP_MAX][16] = { + "Great Bay Coast", // OWL_WARP_GREAT_BAY_COAST + "Zora Cape", // OWL_WARP_ZORA_CAPE + "Snowhead", // OWL_WARP_SNOWHEAD + "Mountain Village", // OWL_WARP_MOUNTAIN_VILLAGE + "Clock Town", // OWL_WARP_CLOCK_TOWN + "Milk Road", // OWL_WARP_MILK_ROAD + "Woodfall", // OWL_WARP_WOODFALL + "Southern Swamp", // OWL_WARP_SOUTHERN_SWAMP + "Ikana Canyon", // OWL_WARP_IKANA_CANYON + "Stone Tower", // OWL_WARP_STONE_TOWER + "Entrance", // OWL_WARP_ENTRANCE +}; -//TextAreaLength -s16 D_801D07C4[11] = {15,9,8,16,10,9,8,14,12,11,8}; +// sOwlWarpTextLength +s16 D_801D07C4[OWL_WARP_MAX] = { + 15, // OWL_WARP_GREAT_BAY_COAST + 9, // OWL_WARP_ZORA_CAPE + 8, // OWL_WARP_SNOWHEAD + 16, // OWL_WARP_MOUNTAIN_VILLAGE + 10, // OWL_WARP_CLOCK_TOWN + 9, // OWL_WARP_MILK_ROAD + 8, // OWL_WARP_WOODFALL + 14, // OWL_WARP_SOUTHERN_SWAMP + 12, // OWL_WARP_IKANA_CANYON + 11, // OWL_WARP_STONE_TOWER + 8, // OWL_WARP_ENTRANCE +}; #endif extern f32 D_801D0470[159]; extern u8 D_801D06F0[4][8]; extern u8 D_801D0710[4]; -extern u8 D_801D0714[11][16]; -extern s16 D_801D07C4[11]; +extern u8 D_801D0714[OWL_WARP_MAX][16]; +extern s16 D_801D07C4[OWL_WARP_MAX]; void Message_FindMessageNES(PlayState* play, u16 textId) { MessageContext* msgCtx = &play->msgCtx; @@ -244,28 +256,28 @@ void Message_LoadTimeNES(PlayState* play, u8 arg1, s32* offset, f32* arg3, s16* *arg3 = f; } -void Message_LoadAreaTextNES(PlayState* play, s32* offset, f32* arg2, s16* decodedBufPos) { +void Message_LoadOwlWarpTextNES(PlayState* play, s32* offset, f32* arg2, s16* decodedBufPos) { MessageContext* msgCtx = &play->msgCtx; s16 p = *decodedBufPos; s32 o = *offset; f32 f = *arg2; s16 i; u8 currentChar; - s16 currentArea; + s16 owlWarpId; s16 stringLimit; - if ((func_8010A0A4(play) != 0) || (play->sceneId == SCENE_SECOM)) { - currentArea = 10; + if (func_8010A0A4(play) || (play->sceneId == SCENE_SECOM)) { + owlWarpId = OWL_WARP_ENTRANCE; } else { - currentArea = play->pauseCtx.cursorPoint[PAUSE_WORLD_MAP]; + owlWarpId = play->pauseCtx.cursorPoint[PAUSE_WORLD_MAP]; } - stringLimit = D_801D07C4[currentArea]; + stringLimit = D_801D07C4[owlWarpId]; for (i = 0; i < stringLimit; i++) { - msgCtx->decodedBuffer.schar[p] = D_801D0714[currentArea][i]; + msgCtx->decodedBuffer.schar[p] = D_801D0714[owlWarpId][i]; currentChar = msgCtx->decodedBuffer.schar[p]; if (currentChar != ' ') { - Font_LoadCharNES(play, D_801D0714[currentArea][i], o); + Font_LoadCharNES(play, D_801D0714[owlWarpId][i], o); o += FONT_CHAR_TEX_SIZE; } currentChar = msgCtx->decodedBuffer.schar[p]; diff --git a/src/code/z_scene.c b/src/code/z_scene.c index c32a2271d..1167f14ab 100644 --- a/src/code/z_scene.c +++ b/src/code/z_scene.c @@ -468,8 +468,8 @@ void Scene_HeaderCmdAltHeaderList(PlayState* play, SceneCmd* cmd) { // SceneTableEntry Header Command 0x17: Cutscene List void Scene_HeaderCmdCutsceneList(PlayState* play, SceneCmd* cmd) { - play->csCtx.sceneCsCount = cmd->base.data1; - play->csCtx.sceneCsList = Lib_SegmentedToVirtual(cmd->base.data2); + play->csCtx.sceneCsCount = cmd->cutsceneList.sceneCsCount; + play->csCtx.sceneCsList = Lib_SegmentedToVirtual(cmd->cutsceneList.segment); } // SceneTableEntry Header Command 0x1B: Actor Cutscene List @@ -492,8 +492,8 @@ void Scene_HeaderCmdMiniMapCompassInfo(PlayState* play, SceneCmd* cmd) { func_8010565C(play, cmd->minimapChests.num, cmd->minimapChests.segment); } -// SceneTableEntry Header Command 0x1A: Sets Area Visited Flag -void Scene_HeaderCmdSetAreaVisitedFlag(PlayState* play, SceneCmd* cmd) { +// SceneTableEntry Header Command 0x19: Sets Region Visited Flag +void Scene_HeaderCmdSetRegionVisitedFlag(PlayState* play, SceneCmd* cmd) { s16 j = 0; s16 i = 0; @@ -502,7 +502,7 @@ void Scene_HeaderCmdSetAreaVisitedFlag(PlayState* play, SceneCmd* cmd) { i++; j = 0; - if (i == ARRAY_COUNT(gSceneIdsPerRegion)) { + if (i == REGION_MAX) { break; } } @@ -514,8 +514,9 @@ void Scene_HeaderCmdSetAreaVisitedFlag(PlayState* play, SceneCmd* cmd) { j++; } - if (i < ARRAY_COUNT(gSceneIdsPerRegion)) { - gSaveContext.save.mapsVisited = (gBitFlags[i] | gSaveContext.save.mapsVisited) | gSaveContext.save.mapsVisited; + if (i < REGION_MAX) { + gSaveContext.save.regionsVisited = + (gBitFlags[i] | gSaveContext.save.regionsVisited) | gSaveContext.save.regionsVisited; } } @@ -561,7 +562,7 @@ s32 Scene_ProcessHeader(PlayState* play, SceneCmd* header) { Scene_HeaderCmdEchoSetting, Scene_HeaderCmdCutsceneList, Scene_HeaderCmdAltHeaderList, - Scene_HeaderCmdSetAreaVisitedFlag, + Scene_HeaderCmdSetRegionVisitedFlag, Scene_HeaderCmdAnimatedMaterials, Scene_HeaderCmdActorCutsceneList, Scene_HeaderCmdMiniMap, diff --git a/src/overlays/actors/ovl_Door_Shutter/z_door_shutter.c b/src/overlays/actors/ovl_Door_Shutter/z_door_shutter.c index d7e9424e5..d7913b775 100644 --- a/src/overlays/actors/ovl_Door_Shutter/z_door_shutter.c +++ b/src/overlays/actors/ovl_Door_Shutter/z_door_shutter.c @@ -373,7 +373,7 @@ void func_808A1090(DoorShutter* this, PlayState* play) { } } else if (this->unk_166 != 0) { if (this->doorType == 5) { - if (!CHECK_DUNGEON_ITEM(0, gSaveContext.mapIndex)) { + if (!CHECK_DUNGEON_ITEM(DUNGEON_BOSS_KEY, gSaveContext.mapIndex)) { player->doorType = -1; this->actor.textId = 0x1803; } diff --git a/src/overlays/actors/ovl_En_Tanron1/z_en_tanron1.c b/src/overlays/actors/ovl_En_Tanron1/z_en_tanron1.c index d45cc854c..fbc74cb10 100644 --- a/src/overlays/actors/ovl_En_Tanron1/z_en_tanron1.c +++ b/src/overlays/actors/ovl_En_Tanron1/z_en_tanron1.c @@ -406,6 +406,8 @@ void func_80BB5AAC(EnTanron1* this, PlayState* play) { Matrix_RotateXS(ptr->unk_18 * -1, MTXMODE_APPLY); Matrix_Scale(1.0f, ptr->unk_2C, 1.0f, MTXMODE_APPLY); + if (1) {} + gSPMatrix(POLY_OPA_DISP++, Matrix_NewMtx(play->state.gfxCtx), G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_MODELVIEW); gSPDisplayList(POLY_OPA_DISP++, ovl_En_Tanron1_DL_001900); } diff --git a/src/overlays/kaleido_scope/ovl_kaleido_scope/z_kaleido_map.c b/src/overlays/kaleido_scope/ovl_kaleido_scope/z_kaleido_map.c index 6e23e8f6f..5f4c136e0 100644 --- a/src/overlays/kaleido_scope/ovl_kaleido_scope/z_kaleido_map.c +++ b/src/overlays/kaleido_scope/ovl_kaleido_scope/z_kaleido_map.c @@ -1,108 +1,974 @@ /* * File: z_kaleido_map.c * Overlay: ovl_kaleido_scope - * Description: + * Description: Pause Menu: Map Page */ #include "z_kaleido_scope.h" +#include "interface/parameter_static/parameter_static.h" +#include "interface/icon_item_field_static/icon_item_field_static.h" +#include "interface/icon_item_dungeon_static/icon_item_dungeon_static.h" +#include "interface/icon_item_jpn_static/icon_item_jpn_static.h" -extern UNK_TYPE D_02001360; -extern UNK_TYPE D_020044A0; -extern UNK_TYPE D_02004AA0; -extern UNK_TYPE D_0200B998; -extern UNK_TYPE D_08062000; -extern UNK_TYPE D_08064340; -extern UNK_TYPE D_0B000000; -extern UNK_TYPE D_0C000000; -extern UNK_TYPE D_0C006C00; +extern s16 D_8082B7F0[]; +extern s16 D_8082B838[]; -s32 D_8082B4A0[] = { 0x09003600, 0x09003F00, 0x09004800 }; +extern TexturePtr D_09007500; // gPlayerFace -s32 D_8082B4AC[] = { - 0x0D000000, - 0x0D000800, - 0x0D001000, - 0x0D001800, +#define WORLD_MAP_IMAGE_TEX_WIDTH 216 +#define WORLD_MAP_IMAGE_TEX_HEIGHT 128 + +void KaleidoScope_DrawDungeonStrayFairyCount(PlayState* play) { + s16 counterDigits[2]; + s16 rectLeft; + s16 digitIndex; + + OPEN_DISPS(play->state.gfxCtx); + + // Get digits for max number of stray fairies + counterDigits[1] = 15; + counterDigits[0] = counterDigits[1] / 10; + counterDigits[1] -= (s16)(counterDigits[0] * 10); + + // Draw max number of stray fairies + for (rectLeft = 116, digitIndex = 0; digitIndex < 2; digitIndex++, rectLeft += 8) { + gDPPipeSync(POLY_OPA_DISP++); + gDPSetPrimColor(POLY_OPA_DISP++, 0, 0, 0, 0, 0, 255); + + POLY_OPA_DISP = func_8010D7D0(POLY_OPA_DISP, (u8*)gCounterDigit0Tex + (8 * 16 * counterDigits[digitIndex]), 8, + 16, rectLeft + 1, 146, 8, 16, 1 << 10, 1 << 10); + + gDPPipeSync(POLY_OPA_DISP++); + gDPSetPrimColor(POLY_OPA_DISP++, 0, 0, 255, 255, 255, 255); + + gSPTextureRectangle(POLY_OPA_DISP++, rectLeft * 4, 145 << 2, (rectLeft + 8) * 4, 161 << 2, G_TX_RENDERTILE, 0, + 0, 1 << 10, 1 << 10); + } + + // Draw Counter slash + gDPPipeSync(POLY_OPA_DISP++); + gDPSetPrimColor(POLY_OPA_DISP++, 0, 0, 0, 0, 0, 255); + + POLY_OPA_DISP = + func_8010D7D0(POLY_OPA_DISP, gStrayFairyMapCounterSlashTex, 8, 16, 107, 146, 8, 16, 1 << 10, 1 << 10); + + gDPPipeSync(POLY_OPA_DISP++); + gDPSetPrimColor(POLY_OPA_DISP++, 0, 0, 255, 255, 255, 255); + + gSPTextureRectangle(POLY_OPA_DISP++, 106 << 2, 145 << 2, 114 << 2, 161 << 2, G_TX_RENDERTILE, 0, 0, 1 << 10, + 1 << 10); + + // Get digits for current number of stray fairies collected + counterDigits[1] = gSaveContext.save.inventory.strayFairies[(void)0, gSaveContext.dungeonIndex]; + counterDigits[0] = counterDigits[1] / 10; + counterDigits[1] -= (s16)(counterDigits[0] * 10); + + // Draw digits for current number of stray fairies collected + for (rectLeft = 88, digitIndex = 0; digitIndex < 2; digitIndex++, rectLeft += 8) { + gDPPipeSync(POLY_OPA_DISP++); + gDPSetPrimColor(POLY_OPA_DISP++, 0, 0, 0, 0, 0, 255); + + POLY_OPA_DISP = func_8010D7D0(POLY_OPA_DISP, (u8*)gCounterDigit0Tex + (8 * 16 * counterDigits[digitIndex]), 8, + 16, rectLeft + 1, 146, 8, 16, 1 << 10, 1 << 10); + + gDPPipeSync(POLY_OPA_DISP++); + gDPSetPrimColor(POLY_OPA_DISP++, 0, 0, 255, 255, 255, 255); + + gSPTextureRectangle(POLY_OPA_DISP++, rectLeft * 4, 145 << 2, (rectLeft + 8) * 4, 161 << 2, G_TX_RENDERTILE, 0, + 0, 1 << 10, 1 << 10); + } + + CLOSE_DISPS(play->state.gfxCtx); +} + +TexturePtr sDungeonItemTextures[] = { + 0x09003600, // `gBossKeyIconTex`: DUNGEON_BOSS_KEY + 0x09003F00, // `gCompassIconTex`: DUNGEON_COMPASS + 0x09004800, // `gDungeonMapIconTex`: DUNGEON_MAP }; -s16 D_8082B4BC[] = { - 0x0043, - 0x0051, - 0x005F, - 0x006D, +TexturePtr sDungeonTitleTextures[] = { + gPauseWoodfallTitleENGTex, // DUNGEON_INDEX_WOODFALL_TEMPLE + gPauseSnowheadTitleENGTex, // DUNGEON_INDEX_SNOWHEAD_TEMPLE + gPauseGreatBayTitleENGTex, // DUNGEON_INDEX_GREAT_BAY_TEMPLE + gPauseStoneTowerTitleENGTex, // DUNGEON_INDEX_STONE_TOWER_TEMPLE }; -s16 D_8082B4C4 = 0x7B; -s16 D_8082B4C8 = 30; -s16 D_8082B4CC = 0; -s16 D_8082B4D0 = 0xF; -s16 D_8082B4D4 = 0; -s16 D_8082B4D8 = 0xFF; -f32 D_8082B4DC = 100.0f; +s16 sDungeonMapFloorIconPosY[] = { 67, 81, 95, 109, 123 }; -s32 D_8082B4E0[] = { - 0x02008998, 0x0C001B80, 0x02008998, 0x0C001B80, 0x02009598, 0x0C002780, 0x02009598, 0x0C002780, - 0x0200A198, 0x0C003380, 0x0200A198, 0x0C003380, 0x0200AD98, 0x0C003F80, 0x0200AD98, 0x0C003F80, +void KaleidoScope_DrawDungeonMap(PlayState* play) { + static s16 sStrayFairyIconTimer = 30; + static s16 sStrayFairyIconIndex = 0; + static s16 sStrayFairyIconAlphaScaleTimer = 15; + static s16 sStrayFairyIconAlphaScaleState = 0; + static s16 sStrayFairyIconAlpha = 255; + static f32 sStrayFairyIconScale = 100.0f; + static TexturePtr sStrayFairyIconTextures[][4] = { + // DUNGEON_INDEX_WOODFALL_TEMPLE + { gStrayFairyWoodfallIconTex, gDungeonStrayFairyWoodfallIconTex, gStrayFairyWoodfallIconTex, + gDungeonStrayFairyWoodfallIconTex }, + // DUNGEON_INDEX_SNOWHEAD_TEMPLE + { gStrayFairySnowheadIconTex, gDungeonStrayFairySnowheadIconTex, gStrayFairySnowheadIconTex, + gDungeonStrayFairySnowheadIconTex }, + // DUNGEON_INDEX_GREAT_BAY_TEMPLE + { gStrayFairyGreatBayIconTex, gDungeonStrayFairyGreatBayIconTex, gStrayFairyGreatBayIconTex, + gDungeonStrayFairyGreatBayIconTex }, + // DUNGEON_INDEX_STONE_TOWER_TEMPLE + { gStrayFairyStoneTowerIconTex, gDungeonStrayFairyStoneTowerIconTex, gStrayFairyStoneTowerIconTex, + gDungeonStrayFairyStoneTowerIconTex }, + }; + static u8 sStrayFairyIconPrimColors[][3] = { + { 255, 110, 160 }, // DUNGEON_INDEX_WOODFALL_TEMPLE + { 90, 255, 100 }, // DUNGEON_INDEX_SNOWHEAD_TEMPLE + { 120, 255, 255 }, // DUNGEON_INDEX_GREAT_BAY_TEMPLE + { 245, 245, 90 }, // DUNGEON_INDEX_STONE_TOWER_TEMPLE + }; + static u8 sStrayFairyIconEnvColors[][3] = { + { 255, 255, 255 }, // DUNGEON_INDEX_WOODFALL_TEMPLE + { 255, 255, 255 }, // DUNGEON_INDEX_SNOWHEAD_TEMPLE + { 255, 255, 255 }, // DUNGEON_INDEX_GREAT_BAY_TEMPLE + { 225, 170, 0 }, // DUNGEON_INDEX_STONE_TOWER_TEMPLE + }; + static s32 sStrayFairyIconRectS[] = { + 1 << 10, // mirror texture horizontally + 0, // default + 0, // default + 0 // default + }; + PauseContext* pauseCtx = &play->pauseCtx; + s16 i; + s16 j; + f32 scale; + + OPEN_DISPS(play->state.gfxCtx); + + j = 72 + (pauseCtx->cursorSlot[PAUSE_MAP] * 4); + KaleidoScope_SetCursorVtx(pauseCtx, j, pauseCtx->mapPageVtx); + + pauseCtx->cursorItem[PAUSE_MAP] = PAUSE_ITEM_NONE; + if (pauseCtx->cursorSpecialPos == 0) { + if (pauseCtx->cursorPoint[PAUSE_MAP] <= DUNGEON_STRAY_FAIRIES) { + pauseCtx->cursorItem[PAUSE_MAP] = ITEM_KEY_BOSS + pauseCtx->cursorPoint[PAUSE_MAP]; + } + pauseCtx->cursorSlot[PAUSE_MAP] = pauseCtx->cursorPoint[PAUSE_MAP]; + } + + gSPVertex(POLY_OPA_DISP++, &pauseCtx->mapPageVtx[60], 16, 0); + gDPPipeSync(POLY_OPA_DISP++); + gDPSetPrimColor(POLY_OPA_DISP++, 0, 0, 255, 255, 255, pauseCtx->alpha); + gDPSetCombineMode(POLY_OPA_DISP++, G_CC_MODULATEIA, G_CC_MODULATEIA); + + POLY_OPA_DISP = + func_8010DC58(POLY_OPA_DISP, sDungeonTitleTextures[((void)0, gSaveContext.dungeonIndex)], 128, 16, 0); + + gDPPipeSync(POLY_OPA_DISP++); + + gDPSetCombineMode(POLY_OPA_DISP++, G_CC_MODULATEIA_PRIM, G_CC_MODULATEIA_PRIM); + + // Loop over dungeonItems (i) and vtxIndex (j) + for (i = DUNGEON_BOSS_KEY, j = 4; i <= DUNGEON_STRAY_FAIRIES; i++, j += 4) { + if (i == DUNGEON_STRAY_FAIRIES) { + if ((pauseCtx->pageIndex == PAUSE_MAP) && (pauseCtx->unk_200 == 0)) { + // If (pauseCtx->state == 6), then the other conditions are redundant and + // always return true + if ((pauseCtx->state == 6) && (pauseCtx->state != 7) && + !((pauseCtx->state >= 8) && (pauseCtx->state <= 0x12))) { + KaleidoScope_SetView(pauseCtx, 0.0f, 0.0f, 64.0f); + + if (!sStrayFairyIconAlphaScaleState) { + sStrayFairyIconAlpha -= 6; + sStrayFairyIconScale -= 1.0f; + } else { + sStrayFairyIconAlpha += 6; + sStrayFairyIconScale += 1.0f; + } + + sStrayFairyIconAlphaScaleTimer--; + if (sStrayFairyIconAlphaScaleTimer == 0) { + sStrayFairyIconAlphaScaleState ^= 1; + sStrayFairyIconAlphaScaleTimer = 15; + } + + func_8012C8AC(play->state.gfxCtx); + + gDPSetCombineLERP(POLY_OPA_DISP++, PRIMITIVE, ENVIRONMENT, TEXEL0, ENVIRONMENT, TEXEL0, 0, + PRIMITIVE, 0, PRIMITIVE, ENVIRONMENT, TEXEL0, ENVIRONMENT, TEXEL0, 0, PRIMITIVE, + 0); + + gDPSetPrimColor( + POLY_OPA_DISP++, 0, 0, sStrayFairyIconPrimColors[((void)0, gSaveContext.dungeonIndex)][0], + sStrayFairyIconPrimColors[((void)0, gSaveContext.dungeonIndex)][1], + sStrayFairyIconPrimColors[((void)0, gSaveContext.dungeonIndex)][2], sStrayFairyIconAlpha); + gDPSetEnvColor(POLY_OPA_DISP++, sStrayFairyIconEnvColors[((void)0, gSaveContext.dungeonIndex)][0], + sStrayFairyIconEnvColors[((void)0, gSaveContext.dungeonIndex)][1], + sStrayFairyIconEnvColors[((void)0, gSaveContext.dungeonIndex)][2], 0); + + scale = sStrayFairyIconScale / 100.0f; + + Matrix_Translate(-83.0f, -29.0f, -128.0f, MTXMODE_NEW); + Matrix_Scale(scale, scale, scale, MTXMODE_APPLY); + + gSPMatrix(POLY_OPA_DISP++, Matrix_NewMtx(play->state.gfxCtx), + G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_MODELVIEW); + + pauseCtx->mapPageVtx[76].v.ob[0] = pauseCtx->mapPageVtx[78].v.ob[0] = -16; + + pauseCtx->mapPageVtx[77].v.ob[0] = pauseCtx->mapPageVtx[79].v.ob[0] = + pauseCtx->mapPageVtx[76].v.ob[0] + 32; + + pauseCtx->mapPageVtx[76].v.ob[1] = pauseCtx->mapPageVtx[77].v.ob[1] = 12; + + pauseCtx->mapPageVtx[78].v.ob[1] = pauseCtx->mapPageVtx[79].v.ob[1] = + pauseCtx->mapPageVtx[76].v.ob[1] - 24; + + gSPVertex(POLY_OPA_DISP++, &pauseCtx->mapPageVtx[76], 4, 0); + + POLY_OPA_DISP = + func_8010DE38(POLY_OPA_DISP, gStrayFairyGlowingCircleIconTex, G_IM_FMT_I, 32, 24, 0); + KaleidoScope_SetView(pauseCtx, pauseCtx->eye.x, pauseCtx->eye.y, pauseCtx->eye.z); + func_8012C628(play->state.gfxCtx); + + gDPPipeSync(POLY_OPA_DISP++); + + gDPSetCombineMode(POLY_OPA_DISP++, G_CC_MODULATEIA_PRIM, G_CC_MODULATEIA_PRIM); + + gDPSetPrimColor(POLY_OPA_DISP++, 0, 0, 255, 255, 255, sStrayFairyIconAlpha); + + sStrayFairyIconTimer--; + + if (sStrayFairyIconTimer == 0) { + sStrayFairyIconIndex = (sStrayFairyIconIndex + 1) & 3; + sStrayFairyIconTimer = 34; + } + + gDPLoadTextureBlock( + POLY_OPA_DISP++, + sStrayFairyIconTextures[((void)0, gSaveContext.dungeonIndex)][sStrayFairyIconIndex], + G_IM_FMT_RGBA, G_IM_SIZ_32b, 32, 24, 0, G_TX_MIRROR | G_TX_WRAP, G_TX_NOMIRROR | G_TX_WRAP, 5, + G_TX_NOMASK, G_TX_NOLOD, G_TX_NOLOD); + gSPTextureRectangle(POLY_OPA_DISP++, 54 << 2, 140 << 2, 86 << 2, 164 << 2, G_TX_RENDERTILE, + sStrayFairyIconRectS[sStrayFairyIconIndex], 0, 1 << 10, 1 << 10); + + KaleidoScope_DrawDungeonStrayFairyCount(play); + func_8012C8AC(play->state.gfxCtx); + } + } + } else if (CHECK_DUNGEON_ITEM(i, gSaveContext.dungeonIndex)) { + gDPLoadTextureBlock(POLY_OPA_DISP++, sDungeonItemTextures[i], G_IM_FMT_RGBA, G_IM_SIZ_32b, 24, 24, 0, + G_TX_NOMIRROR | G_TX_WRAP, G_TX_NOMIRROR | G_TX_WRAP, G_TX_NOMASK, G_TX_NOMASK, + G_TX_NOLOD, G_TX_NOLOD); + + gSP1Quadrangle(POLY_OPA_DISP++, j, j + 2, j + 3, j + 1, 0); + } + } + + func_80108AF8(play); + + if ((pauseCtx->pageIndex == PAUSE_MAP) && (pauseCtx->unk_200 == 0)) { + // If (pauseCtx->state == 6), then the other conditions are redundant and always return + // true + if ((pauseCtx->state == 6) && (pauseCtx->state != 7) && + !((pauseCtx->state >= 8) && (pauseCtx->state <= 0x12))) { + + func_8012C628(play->state.gfxCtx); + + gDPSetPrimColor(POLY_OPA_DISP++, 0, 0, 255, 255, 255, pauseCtx->alpha); + + // Draw Player's face next to the dungeon floor icon currently in. + POLY_OPA_DISP = func_8010CB80(POLY_OPA_DISP, &D_09007500, 16, 16, 62, + sDungeonMapFloorIconPosY[R_REVERSE_FLOOR_INDEX], 16, 16, 1 << 10, 1 << 10); + + if (CHECK_DUNGEON_ITEM(DUNGEON_COMPASS, gSaveContext.dungeonIndex)) { + POLY_OPA_DISP = func_8010CB80(POLY_OPA_DISP, gDungeonMapSkullTex, 16, 16, 108, + sDungeonMapFloorIconPosY[FLOOR_INDEX_MAX - func_80105318()], 16, 16, + 1 << 10, 1 << 10); + } + + gDPSetPrimColor(POLY_OPA_DISP++, 0, 0, 255, 255, 255, pauseCtx->alpha); + + func_8012C8AC(play->state.gfxCtx); + } + } + + gDPPipeSync(POLY_OPA_DISP++); + + gDPSetTextureFilter(POLY_OPA_DISP++, G_TF_BILERP); + + CLOSE_DISPS(play->state.gfxCtx); +} + +void KaleidoScope_UpdateDungeonCursor(PlayState* play) { + s32 pad; + PauseContext* pauseCtx = &play->pauseCtx; + MessageContext* msgCtx = &play->msgCtx; + s16 i; + s16 oldCursorPoint; + + if (pauseCtx->state == 6) { + if ((pauseCtx->unk_200 == 0) && (pauseCtx->pageIndex == PAUSE_MAP)) { + pauseCtx->cursorColorSet = 0; + oldCursorPoint = pauseCtx->cursorPoint[PAUSE_MAP]; + if (pauseCtx->stickAdjX > 30) { + pauseCtx->unk_298 = 4.0f; + if (pauseCtx->cursorSpecialPos == PAUSE_CURSOR_PAGE_LEFT) { + func_80821A04(play); + pauseCtx->cursorXIndex[PAUSE_MAP] = 0; + pauseCtx->cursorSlot[PAUSE_MAP] = pauseCtx->unk_256; + pauseCtx->cursorPoint[PAUSE_MAP] = pauseCtx->unk_256; + } else if (pauseCtx->cursorSpecialPos == 0) { + if (pauseCtx->cursorXIndex[PAUSE_MAP] == 0) { + pauseCtx->cursorXIndex[PAUSE_MAP] = 1; + pauseCtx->cursorPoint[PAUSE_MAP] = DUNGEON_STRAY_FAIRIES; + } else { + if (pauseCtx->cursorPoint[PAUSE_MAP] == DUNGEON_STRAY_FAIRIES) { + pauseCtx->cursorPoint[PAUSE_MAP] = DUNGEON_NONE; + } + + while (true) { + pauseCtx->cursorPoint[PAUSE_MAP]++; + if (pauseCtx->cursorPoint[PAUSE_MAP] == DUNGEON_STRAY_FAIRIES) { + KaleidoScope_MoveCursorToSpecialPos(play, PAUSE_CURSOR_PAGE_RIGHT); + break; + } + if (CHECK_DUNGEON_ITEM(pauseCtx->cursorPoint[PAUSE_MAP], gSaveContext.dungeonIndex)) { + break; + } + } + } + } + } else if (pauseCtx->stickAdjX < -30) { + pauseCtx->unk_298 = 4.0f; + if (pauseCtx->cursorSpecialPos == PAUSE_CURSOR_PAGE_RIGHT) { + func_80821A04(play); + pauseCtx->cursorXIndex[PAUSE_MAP] = 1; + pauseCtx->cursorPoint[PAUSE_MAP] = DUNGEON_MAP; + if (!CHECK_DUNGEON_ITEM(DUNGEON_MAP, gSaveContext.dungeonIndex)) { + pauseCtx->cursorPoint[PAUSE_MAP]--; // DUNGEON_COMPASS + if (!CHECK_DUNGEON_ITEM(DUNGEON_COMPASS, gSaveContext.dungeonIndex)) { + pauseCtx->cursorPoint[PAUSE_MAP]--; // DUNGEON_BOSS_KEY + if (!CHECK_DUNGEON_ITEM(DUNGEON_BOSS_KEY, gSaveContext.dungeonIndex)) { + pauseCtx->cursorSlot[PAUSE_MAP] = DUNGEON_STRAY_FAIRIES; + pauseCtx->cursorPoint[PAUSE_MAP] = DUNGEON_STRAY_FAIRIES; + } + } + } else { + pauseCtx->cursorSlot[PAUSE_MAP] = pauseCtx->cursorPoint[PAUSE_MAP]; + } + } else if (pauseCtx->cursorSpecialPos == 0) { + if (pauseCtx->cursorXIndex[PAUSE_MAP] == 0) { + KaleidoScope_MoveCursorToSpecialPos(play, PAUSE_CURSOR_PAGE_LEFT); + } else if (pauseCtx->cursorPoint[PAUSE_MAP] == DUNGEON_STRAY_FAIRIES) { + pauseCtx->cursorXIndex[PAUSE_MAP] = 0; + pauseCtx->cursorSlot[PAUSE_MAP] = pauseCtx->unk_256; + pauseCtx->cursorPoint[PAUSE_MAP] = pauseCtx->unk_256; + } else { + while (true) { + pauseCtx->cursorPoint[PAUSE_MAP]--; + if (pauseCtx->cursorPoint[PAUSE_MAP] <= DUNGEON_NONE) { + pauseCtx->cursorSlot[PAUSE_MAP] = DUNGEON_STRAY_FAIRIES; + pauseCtx->cursorPoint[PAUSE_MAP] = DUNGEON_STRAY_FAIRIES; + break; + } + if (CHECK_DUNGEON_ITEM(pauseCtx->cursorPoint[PAUSE_MAP], gSaveContext.dungeonIndex)) { + break; + } + } + } + } + } else if ((pauseCtx->cursorSpecialPos == 0) && (pauseCtx->stickAdjY > 30)) { + if (pauseCtx->cursorPoint[PAUSE_MAP] >= DUNGEON_FLOOR_INDEX_4) { + for (i = pauseCtx->cursorPoint[PAUSE_MAP] - (DUNGEON_FLOOR_INDEX_4 + 1); i >= 0; i--) { + if ((gSaveContext.save.permanentSceneFlags[(void)0, gSaveContext.dungeonIndex].unk_14 & + gBitFlags[i]) || + func_801090B0(FLOOR_INDEX_MAX - i)) { + pauseCtx->cursorPoint[PAUSE_MAP] = i + DUNGEON_FLOOR_INDEX_4; + pauseCtx->unk_298 = 4.0f; + break; + } + } + } else if (pauseCtx->cursorPoint[PAUSE_MAP] == DUNGEON_STRAY_FAIRIES) { + pauseCtx->cursorXIndex[PAUSE_MAP] = 0; + pauseCtx->cursorSlot[PAUSE_MAP] = pauseCtx->unk_256; + pauseCtx->cursorPoint[PAUSE_MAP] = pauseCtx->unk_256; + } else { + pauseCtx->cursorSlot[PAUSE_MAP] = DUNGEON_STRAY_FAIRIES; + pauseCtx->cursorPoint[PAUSE_MAP] = DUNGEON_STRAY_FAIRIES; + } + } else if ((pauseCtx->cursorSpecialPos == 0) && (pauseCtx->stickAdjY < -30)) { + if ((pauseCtx->cursorPoint[PAUSE_MAP] >= DUNGEON_FLOOR_INDEX_4) && + (pauseCtx->cursorPoint[PAUSE_MAP] <= DUNGEON_FLOOR_INDEX_1)) { + for (i = pauseCtx->cursorPoint[PAUSE_MAP] - (DUNGEON_FLOOR_INDEX_4 - 1); i <= DUNGEON_FLOOR_INDEX_0; + i++) { + if ((gSaveContext.save.permanentSceneFlags[(void)0, gSaveContext.dungeonIndex].unk_14 & + gBitFlags[i]) || + func_801090B0(FLOOR_INDEX_MAX - i)) { + pauseCtx->cursorPoint[PAUSE_MAP] = i + DUNGEON_FLOOR_INDEX_4; + pauseCtx->unk_298 = 4.0f; + break; + } + } + + } else if (pauseCtx->cursorXIndex[PAUSE_MAP] == 0) { + pauseCtx->cursorXIndex[PAUSE_MAP] = 1; + pauseCtx->cursorPoint[PAUSE_MAP] = DUNGEON_STRAY_FAIRIES; + } else { + if (pauseCtx->cursorPoint[PAUSE_MAP] == DUNGEON_STRAY_FAIRIES) { + pauseCtx->cursorPoint[PAUSE_MAP] = DUNGEON_NONE; + } + + while (true) { + pauseCtx->cursorPoint[PAUSE_MAP]++; + if (pauseCtx->cursorPoint[PAUSE_MAP] == DUNGEON_FLOOR_INDEX_4) { + KaleidoScope_MoveCursorToSpecialPos(play, PAUSE_CURSOR_PAGE_RIGHT); + break; + } + if (CHECK_DUNGEON_ITEM(pauseCtx->cursorPoint[PAUSE_MAP], gSaveContext.dungeonIndex)) { + break; + } + } + } + } + if ((pauseCtx->cursorPoint[PAUSE_MAP] <= DUNGEON_STRAY_FAIRIES) && (pauseCtx->cursorSpecialPos == 0)) { + if (gSaveContext.buttonStatus[EQUIP_SLOT_A] == BTN_DISABLED) { + gSaveContext.buttonStatus[EQUIP_SLOT_A] = BTN_ENABLED; + gSaveContext.hudVisibility = HUD_VISIBILITY_IDLE; + Interface_SetHudVisibility(HUD_VISIBILITY_ALL); + } + } else if (gSaveContext.buttonStatus[EQUIP_SLOT_A] != BTN_DISABLED) { + gSaveContext.buttonStatus[EQUIP_SLOT_A] = BTN_DISABLED; + gSaveContext.hudVisibility = HUD_VISIBILITY_IDLE; + Interface_SetHudVisibility(HUD_VISIBILITY_ALL); + } + + if ((pauseCtx->cursorXIndex[PAUSE_MAP] == 0) && (pauseCtx->cursorSpecialPos == 0)) { + pauseCtx->unk_256 = pauseCtx->cursorPoint[PAUSE_MAP]; + } + + if (pauseCtx->cursorSpecialPos == 0) { + if (CHECK_BTN_ALL(CONTROLLER1(&play->state)->press.button, BTN_A) && (msgCtx->msgLength == 0) && + (pauseCtx->cursorPoint[PAUSE_MAP] == DUNGEON_STRAY_FAIRIES)) { + pauseCtx->itemDescriptionOn = true; + func_801514B0(play, 0x17AF, 1); + } else if (CHECK_BTN_ALL(CONTROLLER1(&play->state)->press.button, BTN_A) && (msgCtx->msgLength == 0) && + CHECK_DUNGEON_ITEM(pauseCtx->cursorPoint[PAUSE_MAP], gSaveContext.dungeonIndex)) { + pauseCtx->itemDescriptionOn = true; + func_801514B0(play, 0x17AC + pauseCtx->cursorPoint[PAUSE_MAP], 1); + } + } + + if (oldCursorPoint != pauseCtx->cursorPoint[PAUSE_MAP]) { + play_sound(NA_SE_SY_CURSOR); + } + } + } +} + +TexturePtr sCloudTextures[] = { + gWorldMapClockTownCloud1Tex, // TINGLE_MAP_CLOCK_TOWN + gWorldMapClockTownCloud2Tex, // TINGLE_MAP_CLOCK_TOWN + gWorldMapWoodfallCloud1Tex, // TINGLE_MAP_WOODFALL + gWorldMapWoodfallCloud2Tex, // TINGLE_MAP_WOODFALL + gWorldMapWoodfallCloud3Tex, // TINGLE_MAP_WOODFALL + gWorldMapSnowheadCloud1Tex, // TINGLE_MAP_SNOWHEAD + gWorldMapSnowheadCloud2Tex, // TINGLE_MAP_SNOWHEAD + gWorldMapSnowheadCloud3Tex, // TINGLE_MAP_SNOWHEAD + gWorldMapRomaniRanchCloudTex, // TINGLE_MAP_ROMANI_RANCH + gWorldMapGreatBayCloud1Tex, // TINGLE_MAP_GREAT_BAY + gWorldMapGreatBayCloud2Tex, // TINGLE_MAP_GREAT_BAY + gWorldMapGreatBayCloud3Tex, // TINGLE_MAP_GREAT_BAY + gWorldMapGreatBayCloud4Tex, // TINGLE_MAP_GREAT_BAY + gWorldMapStoneTowerCloud1Tex, // TINGLE_MAP_STONE_TOWER + gWorldMapStoneTowerCloud2Tex, // TINGLE_MAP_STONE_TOWER }; -s32 D_8082B520[] = { - 0xFF6EA05A, - 0xFF6478FF, - 0xFFF5F55A, +s16 sWorldMapDotPrimColors[][3] = { + { 0, 0, 255 }, + { 255, 255, 0 }, +}; +s16 sWorldMapDotEnvColors[][3] = { + { 255, 255, 0 }, + { 0, 0, 255 }, }; -s32 D_8082B52C[] = { - 0xFFFFFFFF, - 0xFFFFFFFF, - 0xFFE1AA00, +s16 sWorldMapCursorsRectLeft[REGION_MAX] = { + 86, // REGION_GREAT_BAY + 104, // REGION_ZORA_HALL + 145, // REGION_ROMANI_RANCH + 153, // REGION_DEKU_PALACE + 163, // REGION_WOODFALL + 159, // REGION_CLOCK_TOWN + 157, // REGION_SNOWHEAD + 199, // REGION_IKANA_GRAVEYARD + 208, // REGION_IKANA_CANYON + 210, // REGION_GORON_VILLAGE + 218, // REGION_STONE_TOWER }; -s32 D_8082B538[] = { - 0x00000400, - 0x00000000, - 0x00000000, - 0x00000000, +s16 sWorldMapCursorsRectTop[REGION_MAX] = { + 127, // REGION_GREAT_BAY + 153, // REGION_ZORA_HALL + 138, // REGION_ROMANI_RANCH + 171, // REGION_DEKU_PALACE + 146, // REGION_WOODFALL + 119, // REGION_CLOCK_TOWN + 77, // REGION_SNOWHEAD + 106, // REGION_IKANA_GRAVEYARD + 120, // REGION_IKANA_CANYON + 73, // REGION_GORON_VILLAGE + 99, // REGION_STONE_TOWER }; -s16 D_8082B548[] = { - 0x0C00, 0x8418, 0x0C00, 0x9098, 0x0C01, 0x2898, 0x0C01, 0x35D8, 0x0C01, 0x4318, - 0x0C00, 0xDE58, 0x0C00, 0xEB58, 0x0C00, 0xFAA8, 0x0C00, 0x9858, 0x0C00, 0x9E58, - 0x0C00, 0xAE58, 0x0C00, 0xBE58, 0x0C00, 0xCE58, 0x0C01, 0x09F8, 0x0C01, 0x1958, +s16 sGreatFairySpawnRegions[] = { + REGION_CLOCK_TOWN, REGION_WOODFALL, REGION_SNOWHEAD, REGION_GREAT_BAY, REGION_IKANA_CANYON, + REGION_CLOCK_TOWN, REGION_WOODFALL, REGION_SNOWHEAD, REGION_GREAT_BAY, REGION_IKANA_CANYON, }; -s16 D_8082B584[] = { - 0x0000, 0x0000, 0x00FF, 0x00FF, 0x00FF, 0x0000, +void KaleidoScope_DrawWorldMap(PlayState* play) { + s16 sceneId; + s16 t; + s16 n; + s16 j; + s16 k; + s16 i; + PauseContext* pauseCtx = &play->pauseCtx; + s16 rectLeft; + s16 rectRight; + + OPEN_DISPS(play->state.gfxCtx); + + KaleidoScope_SetCursorVtx(pauseCtx, pauseCtx->cursorSlot[PAUSE_MAP] * 4, pauseCtx->mapPageVtx); + + // Draw the world map image + if ((pauseCtx->pageIndex == PAUSE_MAP) && (pauseCtx->state == 6) && + ((pauseCtx->unk_200 == 0) || (pauseCtx->unk_200 == 3)) && YREG(6) && (pauseCtx->state != 7) && + !((pauseCtx->state >= 8) && (pauseCtx->state <= 0x12))) { + + // Draw the world map image flat + // Because it is flat, the texture is loaded by filling it in 8 rows at a time. + // 8 is chosen because it is smaller than `TMEM_SIZE / 2 / textureWidth` and divides the texture's height. + // Each loaded chunk must have `size <= TMEM_SIZE / 2` + // because the texture is color-indexed, so the TLUT uses the other half of TMEM. + + func_8012C628(play->state.gfxCtx); + + gDPSetTextureFilter(POLY_OPA_DISP++, G_TF_POINT); + gDPLoadTLUT_pal256(POLY_OPA_DISP++, gWorldMapImageTLUT); + gDPSetTextureLUT(POLY_OPA_DISP++, G_TT_RGBA16); + + gDPSetPrimColor(POLY_OPA_DISP++, 0, 0, 255, 255, 255, pauseCtx->alpha); + + // Process the 128 rows of pixels for gWorldMapImageTex, 8 rows at a time over 16 iterations + // Loop over yPos (t), textureIndex (j) + for (t = 62, j = 0; j < 16; j++, t += 8) { + gDPLoadTextureBlock(POLY_OPA_DISP++, (u8*)gWorldMapImageTex + j * (WORLD_MAP_IMAGE_TEX_WIDTH * 8), + G_IM_FMT_CI, G_IM_SIZ_8b, WORLD_MAP_IMAGE_TEX_WIDTH, 8, 0, G_TX_NOMIRROR | G_TX_WRAP, + G_TX_NOMIRROR | G_TX_WRAP, G_TX_NOMASK, G_TX_NOMASK, G_TX_NOLOD, G_TX_NOLOD); + + rectLeft = 51 << 2; + rectRight = rectLeft + (WORLD_MAP_IMAGE_TEX_WIDTH << 2); + gSPTextureRectangle(POLY_OPA_DISP++, rectLeft, t << 2, rectRight, (t << 2) + (8 << 2), G_TX_RENDERTILE, 0, + 0, 1 << 10, 1 << 10); + } + + func_8012C8AC(play->state.gfxCtx); + + } else { + // Draw the world map angled + // Because it is at an angle, vertices are used to place it. + // The structure of the loops here is to satisfy the constraints of both TMEM and the size of the vertex cache. + // - Each loop iteration loads 9 rows, because 9 is the largest number smaller than + // `TMEM_SIZE / 2 / textureWidth`. + // - Each loop is at most 8 iterations long because each row uses 4 vertices and the vertex cache has size + // `32 = 8 * 4`. + // . + // Hence there is one loop of length 8, one of length 6, and then the remaining `128 - (8 + 6) * 9 = 2` rows are + // drawn at the end. + + gDPPipeSync(POLY_OPA_DISP++); + gDPSetTextureFilter(POLY_OPA_DISP++, G_TF_POINT); + gDPLoadTLUT_pal256(POLY_OPA_DISP++, gWorldMapImageTLUT); + gDPSetTextureLUT(POLY_OPA_DISP++, G_TT_RGBA16); + + gDPSetPrimColor(POLY_OPA_DISP++, 0, 0, 255, 255, 255, pauseCtx->alpha); + + // Set the vertices for the first 8 quads attached to the world map texture. + gSPVertex(POLY_OPA_DISP++, &pauseCtx->mapPageVtx[204], 8 * 4, 0); + + // Process the first 72 rows of pixels for gWorldMapImageTex, 9 rows at a time over 8 iterations + // Loop over quadIndex of this loop (i), quadIndex of the entire texture (k), vtxIndex (j) + for (i = 0, k = 0, j = 0; i < 8; i++, k++, j += 4) { + gDPLoadTextureBlock(POLY_OPA_DISP++, (u8*)gWorldMapImageTex + k * (WORLD_MAP_IMAGE_TEX_WIDTH * 9), + G_IM_FMT_CI, G_IM_SIZ_8b, WORLD_MAP_IMAGE_TEX_WIDTH, 9, 0, G_TX_NOMIRROR | G_TX_WRAP, + G_TX_NOMIRROR | G_TX_WRAP, G_TX_NOMASK, G_TX_NOMASK, G_TX_NOLOD, G_TX_NOLOD); + + gSP1Quadrangle(POLY_OPA_DISP++, j, j + 2, j + 3, j + 1, 0); + } + + // Set the vertices for the last 7 quads attached to the world map texture: + // 6 quads with a height of 9, 1 quad with a height of 2 + gSPVertex(POLY_OPA_DISP++, &pauseCtx->mapPageVtx[236], (6 + 1) * 4, 0); + + // Process the next 54 rows of pixels for gWorldMapImageTex, 9 rows at a time over 6 iterations + // Loop over quadIndex of this loop (i), quadIndex of the entire texture (k), vtxIndex (j) + for (i = 0, j = 0; i < 6; i++, k++, j += 4) { + gDPLoadTextureBlock(POLY_OPA_DISP++, (u8*)gWorldMapImageTex + k * (WORLD_MAP_IMAGE_TEX_WIDTH * 9), + G_IM_FMT_CI, G_IM_SIZ_8b, WORLD_MAP_IMAGE_TEX_WIDTH, 9, 0, G_TX_NOMIRROR | G_TX_WRAP, + G_TX_NOMIRROR | G_TX_WRAP, G_TX_NOMASK, G_TX_NOMASK, G_TX_NOLOD, G_TX_NOLOD); + + gSP1Quadrangle(POLY_OPA_DISP++, j, j + 2, j + 3, j + 1, 0); + } + + // Process the last 2 rows of pixels for gWorldMapImageTex + gDPLoadTextureBlock(POLY_OPA_DISP++, (u8*)gWorldMapImageTex + k * (WORLD_MAP_IMAGE_TEX_WIDTH * 9), G_IM_FMT_CI, + G_IM_SIZ_8b, WORLD_MAP_IMAGE_TEX_WIDTH, 2, 0, G_TX_NOMIRROR | G_TX_WRAP, + G_TX_NOMIRROR | G_TX_WRAP, G_TX_NOMASK, G_TX_NOMASK, G_TX_NOLOD, G_TX_NOLOD); + + gSP1Quadrangle(POLY_OPA_DISP++, j, j + 2, j + 3, j + 1, 0); + } + + func_8012C8AC(play->state.gfxCtx); + + gDPPipeSync(POLY_OPA_DISP++); + + gDPSetTextureFilter(POLY_OPA_DISP++, G_TF_BILERP); + + gDPSetCombineLERP(POLY_OPA_DISP++, PRIMITIVE, ENVIRONMENT, TEXEL0, ENVIRONMENT, TEXEL0, 0, PRIMITIVE, 0, PRIMITIVE, + ENVIRONMENT, TEXEL0, ENVIRONMENT, TEXEL0, 0, PRIMITIVE, 0); + + gDPSetPrimColor(POLY_OPA_DISP++, 0, 0, 215, 235, 235, pauseCtx->alpha); + gDPSetEnvColor(POLY_OPA_DISP++, 40, 60, 100, 0); + + // Draw clouds over the world map + // Iterate over cloud bits (n) + for (n = 0; n < 15; n++) { + if (!(((void)0, gSaveContext.save.worldMapCloudVisibility) & gBitFlags[n])) { + + gSPVertex(POLY_OPA_DISP++, &pauseCtx->mapPageVtx[60 + n * 4], 4, 0); + + POLY_OPA_DISP = func_8010DC58(POLY_OPA_DISP, sCloudTextures[n], D_8082B7F0[n], D_8082B838[n], 0); + } + } + + if ((pauseCtx->state >= 0x15) && (pauseCtx->state <= 0x19)) { + gDPPipeSync(POLY_OPA_DISP++); + gDPSetRenderMode(POLY_OPA_DISP++, G_RM_XLU_SURF, G_RM_XLU_SURF2); + gDPSetCombineMode(POLY_OPA_DISP++, G_CC_PRIMITIVE, G_CC_PRIMITIVE); + gDPSetPrimColor(POLY_OPA_DISP++, 0, 0, 0, 0, 0, R_PAUSE_OWLWARP_ALPHA); + gDPFillRectangle(POLY_OPA_DISP++, 50, 62, 270, 190); + } + + func_8012C8AC(play->state.gfxCtx); + + if (!((pauseCtx->state >= 0x15) && (pauseCtx->state <= 0x19))) { + // Browsing the world map regions on the pause menu + gDPLoadTextureBlock(POLY_OPA_DISP++, gWorldMapDotTex, G_IM_FMT_IA, G_IM_SIZ_8b, 8, 8, 0, + G_TX_NOMIRROR | G_TX_WRAP, G_TX_NOMIRROR | G_TX_WRAP, G_TX_NOMASK, G_TX_NOMASK, G_TX_NOLOD, + G_TX_NOLOD); + gDPSetCombineLERP(POLY_OPA_DISP++, PRIMITIVE, ENVIRONMENT, TEXEL0, ENVIRONMENT, TEXEL0, 0, PRIMITIVE, 0, + PRIMITIVE, ENVIRONMENT, TEXEL0, ENVIRONMENT, TEXEL0, 0, PRIMITIVE, 0); + + gDPSetPrimColor(POLY_OPA_DISP++, 0, 0, sWorldMapDotPrimColors[0][0], sWorldMapDotPrimColors[0][1], + sWorldMapDotPrimColors[0][2], pauseCtx->alpha); + gDPSetEnvColor(POLY_OPA_DISP++, sWorldMapDotEnvColors[0][0], sWorldMapDotEnvColors[0][1], + sWorldMapDotEnvColors[0][2], 0); + + if (R_PAUSE_DBG_MAP_CLOUD_ON) { + gSaveContext.save.worldMapCloudVisibility |= (u16)~0x8000; + + pauseCtx->mapPageVtx[120].v.ob[0] = pauseCtx->mapPageVtx[122].v.ob[0] = R_PAUSE_DBG_MAP_CLOUD_X; + + pauseCtx->mapPageVtx[121].v.ob[0] = pauseCtx->mapPageVtx[123].v.ob[0] = + pauseCtx->mapPageVtx[120].v.ob[0] + 8; + + pauseCtx->mapPageVtx[120].v.ob[1] = pauseCtx->mapPageVtx[121].v.ob[1] = R_PAUSE_DBG_MAP_CLOUD_Y; + + pauseCtx->mapPageVtx[122].v.ob[1] = pauseCtx->mapPageVtx[123].v.ob[1] = + pauseCtx->mapPageVtx[120].v.ob[1] - 8; + } + + // Loop over RegionId (i), unused vtxIndex (j), unused (k) + for (i = 0, j = 0; i < REGION_MAX; i++, k++, j += 4) { + if (pauseCtx->worldMapPoints[i]) { + gSPVertex(POLY_OPA_DISP++, &pauseCtx->mapPageVtx[120 + i * 4], 4, 0); + gSP1Quadrangle(POLY_OPA_DISP++, 0, 2, 3, 1, 0); + } + } + + } else { + // Selecting an owl warp + gDPPipeSync(POLY_OPA_DISP++); + gDPSetCombineMode(POLY_OPA_DISP++, G_CC_MODULATEIA_PRIM, G_CC_MODULATEIA_PRIM); + gDPLoadTextureBlock(POLY_OPA_DISP++, gWorldMapOwlFaceTex, G_IM_FMT_RGBA, G_IM_SIZ_32b, 24, 12, 0, + G_TX_NOMIRROR | G_TX_WRAP, G_TX_NOMIRROR | G_TX_WRAP, G_TX_NOMASK, G_TX_NOMASK, G_TX_NOLOD, + G_TX_NOLOD); + + gDPSetPrimColor(POLY_OPA_DISP++, 0, 0, 255, 255, 255, pauseCtx->alpha); + + if (R_PAUSE_DBG_MAP_CLOUD_ON) { + gSaveContext.save.worldMapCloudVisibility |= (u16)~0x8000; + + pauseCtx->mapPageVtx[164].v.ob[0] = pauseCtx->mapPageVtx[166].v.ob[0] = R_PAUSE_DBG_MAP_CLOUD_X; + + pauseCtx->mapPageVtx[165].v.ob[0] = pauseCtx->mapPageVtx[167].v.ob[0] = + pauseCtx->mapPageVtx[164].v.ob[0] + 24; + + pauseCtx->mapPageVtx[164].v.ob[1] = pauseCtx->mapPageVtx[165].v.ob[1] = R_PAUSE_DBG_MAP_CLOUD_Y; + + pauseCtx->mapPageVtx[166].v.ob[1] = pauseCtx->mapPageVtx[167].v.ob[1] = + pauseCtx->mapPageVtx[164].v.ob[1] - 12; + } + + // Loop over OwlWarpId (i), unused vtxIndex (j), unused (k) + for (i = 0, j = 0; i < OWL_WARP_ENTRANCE; i++, k++, j += 4) { + if (pauseCtx->worldMapPoints[i]) { + gSPVertex(POLY_OPA_DISP++, &pauseCtx->mapPageVtx[164 + i * 4], 4, 0); + gSP1Quadrangle(POLY_OPA_DISP++, 0, 2, 3, 1, 0); + } + } + } + + // Find and draw Player's face at the current region based on the current scene + // If (pauseCtx->state == 6), then the other pauseCtx->state conditions are redundant + // and always return true + if ((pauseCtx->pageIndex == PAUSE_MAP) && (pauseCtx->unk_200 == 0) && (pauseCtx->state == 6) && + (pauseCtx->state != 7) && !((pauseCtx->state >= 8) && (pauseCtx->state <= 0x12))) { + j = 0; + n = 0; + + sceneId = play->sceneId; + + // Map grottos/shrines to sceneId's to be used in different regions + if (sceneId == SCENE_KAKUSIANA) { + if (play->roomCtx.curRoom.num == 5) { + sceneId = SCENE_11GORONNOSATO; + } else if ((play->roomCtx.curRoom.num == 6) || (play->roomCtx.curRoom.num == 8) || + (play->roomCtx.curRoom.num == 12)) { + sceneId = SCENE_22DEKUCITY; + } else { + sceneId = Entrance_GetSceneIdAbsolute(((void)0, gSaveContext.respawn[RESPAWN_MODE_UNK_3].entrance)); + } + } + + // Find the regionId that player is currently in + // Loop over regionId (n) and regionIdIndex (j) + while (true) { + if ((gSceneIdsPerRegion[n][j] == 0xFFFF)) { + n++; + j = 0; + if (n == REGION_MAX) { + n = 0; + + // Special case for fairy fountains + if (sceneId == SCENE_YOUSEI_IZUMI) { + j = play->curSpawn; + n = sGreatFairySpawnRegions[j]; + break; + } + + while (true) { + if (gSceneIdsPerRegion[n][j] == 0xFFFF) { + n++; + if (n == REGION_MAX) { + break; + } + j = 0; + if (Entrance_GetSceneIdAbsolute( + ((void)0, gSaveContext.respawn[RESPAWN_MODE_UNK_3].entrance)) == + gSceneIdsPerRegion[n][j]) { + break; + } + } + j++; + } + break; + } + } + + if (sceneId == gSceneIdsPerRegion[n][j]) { + break; + } + j++; + } + + // Draw Player's face at the current region + if (n != REGION_MAX) { + KaleidoScope_SetView(pauseCtx, pauseCtx->eye.x, pauseCtx->eye.y, pauseCtx->eye.z); + func_8012C628(play->state.gfxCtx); + + gDPSetPrimColor(POLY_OPA_DISP++, 0, 0, 255, 255, 255, pauseCtx->alpha); + + POLY_OPA_DISP = func_8010CB80(POLY_OPA_DISP, &D_09007500, 16, 16, sWorldMapCursorsRectLeft[n], + sWorldMapCursorsRectTop[n], 16, 16, 1 << 10, 1 << 10); + } + } + + gDPPipeSync(POLY_OPA_DISP++); + + CLOSE_DISPS(play->state.gfxCtx); +} + +u16 sOwlWarpPauseItems[] = { + 0xAF, // OWL_WARP_GREAT_BAY_COAST + 0xB3, // OWL_WARP_ZORA_CAPE + 0xAA, // OWL_WARP_SNOWHEAD + 0xB1, // OWL_WARP_MOUNTAIN_VILLAGE + 0xA9, // OWL_WARP_CLOCK_TOWN + 0xB2, // OWL_WARP_MILK_ROAD + 0xA8, // OWL_WARP_WOODFALL + 0xB0, // OWL_WARP_SOUTHERN_SWAMP + 0xAC, // OWL_WARP_IKANA_CANYON + 0xAE, // OWL_WARP_STONE_TOWER }; -s16 D_8082B590[] = { - 0x00FF, 0x00FF, 0x0000, 0x0000, 0x0000, 0x00FF, -}; +void KaleidoScope_UpdateWorldMapCursor(PlayState* play) { + static u16 sStickAdjTimer = 0; // unused timer that counts up every frame. Resets on reading a stickAdj. + PauseContext* pauseCtx = &play->pauseCtx; + s16 oldCursorPoint; -s16 D_8082B59C[] = { - 0x0056, 0x0068, 0x0091, 0x0099, 0x00A3, 0x009F, 0x009D, 0x00C7, 0x00D0, 0x00D2, 0x00DA, 0x0000, -}; + if ((pauseCtx->state == 6) && (pauseCtx->unk_200 == 0) && (pauseCtx->pageIndex == PAUSE_MAP)) { + pauseCtx->cursorColorSet = 0; + oldCursorPoint = pauseCtx->cursorPoint[PAUSE_WORLD_MAP]; -s16 D_8082B5B4[] = { - 0x007F, 0x0099, 0x008A, 0x00AB, 0x0092, 0x0077, 0x004D, 0x006A, 0x0078, 0x0049, 0x0063, 0x0000, -}; + if (gSaveContext.buttonStatus[EQUIP_SLOT_A] != BTN_DISABLED) { + gSaveContext.buttonStatus[EQUIP_SLOT_A] = BTN_DISABLED; + gSaveContext.hudVisibility = HUD_VISIBILITY_IDLE; + Interface_SetHudVisibility(HUD_VISIBILITY_ALL); + } -s16 D_8082B5CC[] = { - 0x0005, 0x0004, 0x0006, 0x0000, 0x0008, 0x0005, 0x0004, 0x0006, 0x0000, 0x0008, -}; + if (pauseCtx->cursorSpecialPos == 0) { + if (pauseCtx->stickAdjX > 30) { + pauseCtx->unk_298 = 4.0f; + sStickAdjTimer = 0; -u16 D_8082B5E0[] = { - 0xAF, 0xB3, 0xAA, 0xB1, 0xA9, 0xB2, 0xA8, 0xB0, 0xAC, 0xAE, -}; -u16 D_8082B5F4 = 0; + while (true) { + pauseCtx->cursorPoint[PAUSE_WORLD_MAP]++; + if (pauseCtx->cursorPoint[PAUSE_WORLD_MAP] >= REGION_MAX) { + KaleidoScope_MoveCursorToSpecialPos(play, PAUSE_CURSOR_PAGE_RIGHT); + pauseCtx->cursorItem[PAUSE_MAP] = PAUSE_ITEM_NONE; + break; + } + if (pauseCtx->worldMapPoints[pauseCtx->cursorPoint[PAUSE_WORLD_MAP]]) { + break; + } + } + } else if (pauseCtx->stickAdjX < -30) { + pauseCtx->unk_298 = 4.0f; + sStickAdjTimer = 0; -s32 D_8082B5F8[] = { 0, 0 }; + while (true) { + pauseCtx->cursorPoint[PAUSE_WORLD_MAP]--; + if (pauseCtx->cursorPoint[PAUSE_WORLD_MAP] < REGION_GREAT_BAY) { + KaleidoScope_MoveCursorToSpecialPos(play, PAUSE_CURSOR_PAGE_LEFT); + pauseCtx->cursorItem[PAUSE_MAP] = PAUSE_ITEM_NONE; + break; + } + if (pauseCtx->worldMapPoints[pauseCtx->cursorPoint[PAUSE_WORLD_MAP]]) { + break; + } + } + } else { + sStickAdjTimer++; + } -#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_kaleido_scope/func_8081D240.s") + if (pauseCtx->cursorSpecialPos == 0) { + pauseCtx->cursorItem[PAUSE_MAP] = pauseCtx->cursorPoint[PAUSE_WORLD_MAP]; + // Used as cursor vtxIndex + pauseCtx->cursorSlot[PAUSE_MAP] = 31 + pauseCtx->cursorPoint[PAUSE_WORLD_MAP]; + } + } else { + pauseCtx->cursorItem[PAUSE_MAP] = PAUSE_ITEM_NONE; + if (pauseCtx->cursorSpecialPos == PAUSE_CURSOR_PAGE_LEFT) { + if (pauseCtx->stickAdjX > 30) { + pauseCtx->cursorPoint[PAUSE_WORLD_MAP] = -1; + pauseCtx->cursorSpecialPos = 0; + pauseCtx->unk_298 = 4.0f; -#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_kaleido_scope/func_8081D6DC.s") + while (true) { + pauseCtx->cursorPoint[PAUSE_WORLD_MAP]++; + if (pauseCtx->cursorPoint[PAUSE_WORLD_MAP] > REGION_STONE_TOWER) { + KaleidoScope_MoveCursorToSpecialPos(play, PAUSE_CURSOR_PAGE_RIGHT); + pauseCtx->cursorItem[PAUSE_MAP] = PAUSE_ITEM_NONE; + break; + } + if (pauseCtx->worldMapPoints[pauseCtx->cursorPoint[PAUSE_WORLD_MAP]]) { + break; + } + } -#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_kaleido_scope/func_8081E118.s") + if (pauseCtx->cursorSpecialPos == 0) { + pauseCtx->cursorItem[PAUSE_MAP] = pauseCtx->cursorPoint[PAUSE_WORLD_MAP]; + // Used as cursor vtxIndex + pauseCtx->cursorSlot[PAUSE_MAP] = 31 + pauseCtx->cursorPoint[PAUSE_WORLD_MAP]; + } + play_sound(NA_SE_SY_CURSOR); + sStickAdjTimer = 0; + } + } else if (pauseCtx->stickAdjX < -30) { + pauseCtx->cursorPoint[PAUSE_WORLD_MAP] = 11; + pauseCtx->cursorSpecialPos = 0; + pauseCtx->unk_298 = 4.0f; -#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_kaleido_scope/func_8081E7D8.s") + while (true) { + pauseCtx->cursorPoint[PAUSE_WORLD_MAP]--; + if (pauseCtx->cursorPoint[PAUSE_WORLD_MAP] < 0) { + KaleidoScope_MoveCursorToSpecialPos(play, PAUSE_CURSOR_PAGE_LEFT); + pauseCtx->cursorItem[PAUSE_MAP] = PAUSE_ITEM_NONE; + break; + } + if (pauseCtx->worldMapPoints[pauseCtx->cursorPoint[PAUSE_WORLD_MAP]]) { + break; + } + } -#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_kaleido_scope/func_8081FB1C.s") + if (pauseCtx->cursorSpecialPos == 0) { + pauseCtx->cursorItem[PAUSE_MAP] = pauseCtx->cursorPoint[PAUSE_WORLD_MAP]; + // Used as cursor vtxIndex + pauseCtx->cursorSlot[PAUSE_MAP] = 31 + pauseCtx->cursorPoint[PAUSE_WORLD_MAP]; + } + play_sound(NA_SE_SY_CURSOR); + sStickAdjTimer = 0; + } + } + + if (!pauseCtx->worldMapPoints[pauseCtx->cursorPoint[PAUSE_WORLD_MAP]]) { + pauseCtx->cursorItem[PAUSE_MAP] = PAUSE_ITEM_NONE; + } + if (oldCursorPoint != pauseCtx->cursorPoint[PAUSE_WORLD_MAP]) { + play_sound(NA_SE_SY_CURSOR); + } + } else if (pauseCtx->state == 0x17) { + pauseCtx->cursorColorSet = 4; + oldCursorPoint = pauseCtx->cursorPoint[PAUSE_WORLD_MAP]; + + if (pauseCtx->stickAdjX > 30) { + pauseCtx->unk_298 = 4.0f; + sStickAdjTimer = 0; + do { + pauseCtx->cursorPoint[PAUSE_WORLD_MAP]++; + if (pauseCtx->cursorPoint[PAUSE_WORLD_MAP] > OWL_WARP_STONE_TOWER) { + pauseCtx->cursorPoint[PAUSE_WORLD_MAP] = OWL_WARP_GREAT_BAY_COAST; + } + } while (!pauseCtx->worldMapPoints[pauseCtx->cursorPoint[PAUSE_WORLD_MAP]]); + } else if (pauseCtx->stickAdjX < -30) { + pauseCtx->unk_298 = 4.0f; + sStickAdjTimer = 0; + do { + pauseCtx->cursorPoint[PAUSE_WORLD_MAP]--; + if (pauseCtx->cursorPoint[PAUSE_WORLD_MAP] < OWL_WARP_GREAT_BAY_COAST) { + pauseCtx->cursorPoint[PAUSE_WORLD_MAP] = OWL_WARP_STONE_TOWER; + } + } while (!pauseCtx->worldMapPoints[pauseCtx->cursorPoint[PAUSE_WORLD_MAP]]); + } else { + sStickAdjTimer++; + } + + //! TODO: Is the `0xA4` here related to `0xA3` being the last recored item in the `ItemId` enum? + pauseCtx->cursorItem[PAUSE_MAP] = sOwlWarpPauseItems[pauseCtx->cursorPoint[PAUSE_WORLD_MAP]] - 0xA4; + // Used as cursor vtxIndex + pauseCtx->cursorSlot[PAUSE_MAP] = 31 + pauseCtx->cursorPoint[PAUSE_WORLD_MAP]; + + if (oldCursorPoint != pauseCtx->cursorPoint[PAUSE_WORLD_MAP]) { + play_sound(NA_SE_SY_CURSOR); + } + } +} diff --git a/src/overlays/kaleido_scope/ovl_kaleido_scope/z_kaleido_scope.h b/src/overlays/kaleido_scope/ovl_kaleido_scope/z_kaleido_scope.h index 94724154f..72392390b 100644 --- a/src/overlays/kaleido_scope/ovl_kaleido_scope/z_kaleido_scope.h +++ b/src/overlays/kaleido_scope/ovl_kaleido_scope/z_kaleido_scope.h @@ -51,9 +51,16 @@ typedef enum { // NES void KaleidoScope_MoveCursorToSpecialPos(PlayState* play, s16 cursorSpecialPos); -void KaleidoScope_DrawQuadTextureRGBA32(GraphicsContext* gfxCtx, void* texture, u16 width, u16 height, u16 point); +void KaleidoScope_DrawQuadTextureRGBA32(GraphicsContext* gfxCtx, TexturePtr texture, u16 width, u16 height, u16 point); +void KaleidoScope_SetView(PauseContext* pauseCtx, f32 x, f32 y, f32 z); void func_80821A04(PlayState* play); +// Map +void KaleidoScope_DrawDungeonMap(PlayState* play); +void KaleidoScope_UpdateDungeonCursor(PlayState* play); +void KaleidoScope_DrawWorldMap(PlayState* play); +void KaleidoScope_UpdateWorldMapCursor(PlayState* play); + // Item void KaleidoScope_SetCursorVtx(PauseContext* pauseCtx, u16 index, Vtx* vtx); void KaleidoScope_DrawItemSelect(PlayState* play); diff --git a/src/overlays/kaleido_scope/ovl_kaleido_scope/z_kaleido_scope_NES.c b/src/overlays/kaleido_scope/ovl_kaleido_scope/z_kaleido_scope_NES.c index 3b3de5937..6c6754b3d 100644 --- a/src/overlays/kaleido_scope/ovl_kaleido_scope/z_kaleido_scope_NES.c +++ b/src/overlays/kaleido_scope/ovl_kaleido_scope/z_kaleido_scope_NES.c @@ -345,7 +345,7 @@ s32 D_8082BEB8[] = { 0, 0 }; #pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_kaleido_scope/func_8082585C.s") -#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_kaleido_scope/func_808259D4.s") +#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_kaleido_scope/KaleidoScope_SetView.s") #pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_kaleido_scope/func_80825A50.s") diff --git a/tools/disasm/functions.txt b/tools/disasm/functions.txt index dbe3430c4..5b05adefb 100644 --- a/tools/disasm/functions.txt +++ b/tools/disasm/functions.txt @@ -2410,7 +2410,7 @@ 0x8012ED78:("Inventory_DeleteEquipment",), 0x8012EDE8:("Inventory_ChangeUpgrade",), 0x8012EE34:("Inventory_IsMapVisible",), - 0x8012EF0C:("Inventory_SetMapVisibility",), + 0x8012EF0C:("Inventory_SetWorldMapCloudVisibility",), 0x8012F0EC:("Inventory_SaveDekuPlaygroundHighScore",), 0x8012F1BC:("Inventory_IncrementSkullTokenCount",), 0x8012F22C:("Inventory_GetSkullTokenCount",), @@ -2452,7 +2452,7 @@ 0x80130540:("Scene_HeaderCmdMiniMap",), 0x80130578:("Scene_HeaderCmd1D",), 0x80130588:("Scene_HeaderCmdMiniMapCompassInfo",), - 0x801305B0:("Scene_HeaderCmdSetAreaVisitedFlag",), + 0x801305B0:("Scene_HeaderCmdSetRegionVisitedFlag",), 0x80130674:("Scene_HeaderCmdAnimatedMaterials",), 0x801306A4:("Scene_SetExitFade",), 0x801306E8:("Scene_ProcessHeader",), @@ -2880,7 +2880,7 @@ 0x80158C04:("Message_LoadLocalizedRupeesNES",), 0x80158D98:("Message_LoadRupeesNES",), 0x80158FB0:("Message_LoadTimeNES",), - 0x8015926C:("Message_LoadAreaTextNES",), + 0x8015926C:("Message_LoadOwlWarpTextNES",), 0x80159438:("func_80159438",), 0x8015966C:("func_8015966C",), 0x8015B198:("func_8015B198",), @@ -4209,11 +4209,11 @@ 0x8081B6EC:("KaleidoScope_DrawItemSelect",), 0x8081BCA8:("KaleidoScope_UpdateItemCursor",), 0x8081C684:("KaleidoScope_UpdateItemEquip",), - 0x8081D240:("func_8081D240",), - 0x8081D6DC:("func_8081D6DC",), - 0x8081E118:("func_8081E118",), - 0x8081E7D8:("func_8081E7D8",), - 0x8081FB1C:("func_8081FB1C",), + 0x8081D240:("KaleidoScope_DrawDungeonStrayFairyCount",), + 0x8081D6DC:("KaleidoScope_DrawDungeonMap",), + 0x8081E118:("KaleidoScope_UpdateDungeonCursor",), + 0x8081E7D8:("KaleidoScope_DrawWorldMap",), + 0x8081FB1C:("KaleidoScope_UpdateWorldMapCursor",), 0x8081FF80:("KaleidoScope_DrawMaskSelect",), 0x808204AC:("KaleidoScope_UpdateMaskCursor",), 0x80820FA4:("KaleidoScope_UpdateMaskEquip",), @@ -4234,7 +4234,7 @@ 0x80824B90:("func_80824B90",), 0x808256E4:("func_808256E4",), 0x8082585C:("func_8082585C",), - 0x808259D4:("func_808259D4",), + 0x808259D4:("KaleidoScope_SetView",), 0x80825A50:("func_80825A50",), 0x80825E28:("func_80825E28",), 0x808274DC:("func_808274DC",), diff --git a/tools/disasm/variables.txt b/tools/disasm/variables.txt index 5c8147eef..8b487de8a 100644 --- a/tools/disasm/variables.txt +++ b/tools/disasm/variables.txt @@ -4703,28 +4703,28 @@ 0x8082B484:("sCButtonPosX","UNK_TYPE1","",0x1), 0x8082B48C:("sCButtonPosY","UNK_TYPE1","",0x1), 0x8082B494:("sEquipMagicArrowBowSlotHoldTimer","UNK_TYPE2","",0x2), - 0x8082B4A0:("D_8082B4A0","UNK_TYPE4","",0x4), - 0x8082B4AC:("D_8082B4AC","UNK_TYPE1","",0x1), - 0x8082B4BC:("D_8082B4BC","UNK_TYPE1","",0x1), + 0x8082B4A0:("sDungeonItemTextures","UNK_TYPE4","",0x4), + 0x8082B4AC:("sDungeonTitleTextures","UNK_TYPE1","",0x1), + 0x8082B4BC:("sDungeonMapFloorIconPosY","UNK_TYPE1","",0x1), 0x8082B4C4:("D_8082B4C4","UNK_TYPE1","",0x1), - 0x8082B4C8:("D_8082B4C8","UNK_TYPE2","",0x2), - 0x8082B4CC:("D_8082B4CC","UNK_TYPE2","",0x2), - 0x8082B4D0:("D_8082B4D0","UNK_TYPE2","",0x2), - 0x8082B4D4:("D_8082B4D4","UNK_TYPE2","",0x2), - 0x8082B4D8:("D_8082B4D8","UNK_TYPE2","",0x2), - 0x8082B4DC:("D_8082B4DC","f32","",0x4), - 0x8082B4E0:("D_8082B4E0","UNK_TYPE1","",0x1), - 0x8082B520:("D_8082B520","UNK_TYPE1","",0x1), - 0x8082B52C:("D_8082B52C","UNK_TYPE1","",0x1), - 0x8082B538:("D_8082B538","UNK_TYPE1","",0x1), - 0x8082B548:("D_8082B548","s16","[30]",0x3C), - 0x8082B584:("D_8082B584","UNK_TYPE2","",0x2), - 0x8082B590:("D_8082B590","UNK_TYPE2","",0x2), - 0x8082B59C:("D_8082B59C","UNK_TYPE1","",0x1), - 0x8082B5B4:("D_8082B5B4","UNK_TYPE1","",0x1), - 0x8082B5CC:("D_8082B5CC","UNK_TYPE1","",0x1), - 0x8082B5E0:("D_8082B5E0","UNK_TYPE1","",0x1), - 0x8082B5F4:("D_8082B5F4","UNK_TYPE2","",0x2), + 0x8082B4C8:("sStrayFairyIconTimer","UNK_TYPE2","",0x2), + 0x8082B4CC:("sStrayFairyIconIndex","UNK_TYPE2","",0x2), + 0x8082B4D0:("sStrayFairyIconAlphaScaleTimer","UNK_TYPE2","",0x2), + 0x8082B4D4:("sStrayFairyIconAlphaScaleState","UNK_TYPE2","",0x2), + 0x8082B4D8:("sStrayFairyIconAlpha","UNK_TYPE2","",0x2), + 0x8082B4DC:("sStrayFairyIconScale","f32","",0x4), + 0x8082B4E0:("sStrayFairyIconTextures","UNK_TYPE1","",0x1), + 0x8082B520:("sStrayFairyIconPrimColors","UNK_TYPE1","",0x1), + 0x8082B52C:("sStrayFairyIconEnvColors","UNK_TYPE1","",0x1), + 0x8082B538:("sStrayFairyIconRectS","UNK_TYPE1","",0x1), + 0x8082B548:("sCloudTextures","s16","[30]",0x3C), + 0x8082B584:("sWorldMapDotPrimColors","UNK_TYPE2","",0x2), + 0x8082B590:("sWorldMapDotEnvColors","UNK_TYPE2","",0x2), + 0x8082B59C:("sWorldMapCursorsRectLeft","UNK_TYPE1","",0x1), + 0x8082B5B4:("sWorldMapCursorsRectTop","UNK_TYPE1","",0x1), + 0x8082B5CC:("sGreatFairySpawnRegions","UNK_TYPE1","",0x1), + 0x8082B5E0:("sOwlWarpPauseItems","UNK_TYPE1","",0x1), + 0x8082B5F4:("sStickAdjTimer","UNK_TYPE2","",0x2), 0x8082B600:("sMaskEquipState","UNK_TYPE2","",0x2), 0x8082B604:("sMaskEquipMagicArrowSlotHoldTimer","UNK_TYPE2","",0x2), 0x8082B608:("sMaskEquipAnimTimer","UNK_TYPE2","",0x2), diff --git a/tools/namefixer.py b/tools/namefixer.py index a5d13493b..4f596ecef 100755 --- a/tools/namefixer.py +++ b/tools/namefixer.py @@ -597,7 +597,7 @@ wordReplace = { "func_80158C04": "Message_LoadLocalizedRupeesNES", "func_80158D98": "Message_LoadRupeesNES", "func_80158FB0": "Message_LoadTimeNES", - "func_8015926C": "Message_LoadAreaTextNES", + "func_8015926C": "Message_LoadOwlWarpTextNES", "func_8015E750": "Message_FindCreditsMessage", "func_80133038": "Schedule_RunScript", diff --git a/tools/sizes/code_functions.csv b/tools/sizes/code_functions.csv index acec92239..d18b02616 100644 --- a/tools/sizes/code_functions.csv +++ b/tools/sizes/code_functions.csv @@ -1924,7 +1924,7 @@ asm/non_matchings/code/code_8012EC80/Inventory_ChangeEquipment.s,Inventory_Chang asm/non_matchings/code/code_8012EC80/Inventory_DeleteEquipment.s,Inventory_DeleteEquipment,0x8012ED78,0x1C asm/non_matchings/code/code_8012EC80/Inventory_ChangeUpgrade.s,Inventory_ChangeUpgrade,0x8012EDE8,0x13 asm/non_matchings/code/code_8012EC80/Inventory_IsMapVisible.s,Inventory_IsMapVisible,0x8012EE34,0x36 -asm/non_matchings/code/code_8012EC80/Inventory_SetMapVisibility.s,Inventory_SetMapVisibility,0x8012EF0C,0x78 +asm/non_matchings/code/code_8012EC80/Inventory_SetWorldMapCloudVisibility.s,Inventory_SetWorldMapCloudVisibility,0x8012EF0C,0x78 asm/non_matchings/code/code_8012EC80/Inventory_SaveDekuPlaygroundHighScore.s,Inventory_SaveDekuPlaygroundHighScore,0x8012F0EC,0x34 asm/non_matchings/code/code_8012EC80/Inventory_IncrementSkullTokenCount.s,Inventory_IncrementSkullTokenCount,0x8012F1BC,0x1C asm/non_matchings/code/code_8012EC80/Inventory_GetSkullTokenCount.s,Inventory_GetSkullTokenCount,0x8012F22C,0x13 @@ -1966,7 +1966,7 @@ asm/non_matchings/code/z_scene/Scene_HeaderCmdActorCutsceneList.s,Scene_HeaderCm asm/non_matchings/code/z_scene/Scene_HeaderCmdMiniMap.s,Scene_HeaderCmdMiniMap,0x80130540,0xE asm/non_matchings/code/z_scene/Scene_HeaderCmd1D.s,Scene_HeaderCmd1D,0x80130578,0x4 asm/non_matchings/code/z_scene/Scene_HeaderCmdMiniMapCompassInfo.s,Scene_HeaderCmdMiniMapCompassInfo,0x80130588,0xA -asm/non_matchings/code/z_scene/Scene_HeaderCmdSetAreaVisitedFlag.s,Scene_HeaderCmdSetAreaVisitedFlag,0x801305B0,0x31 +asm/non_matchings/code/z_scene/Scene_HeaderCmdSetRegionVisitedFlag.s,Scene_HeaderCmdSetRegionVisitedFlag,0x801305B0,0x31 asm/non_matchings/code/z_scene/Scene_HeaderCmdAnimatedMaterials.s,Scene_HeaderCmdAnimatedMaterials,0x80130674,0xC asm/non_matchings/code/z_scene/Scene_SetExitFade.s,Scene_SetExitFade,0x801306A4,0x11 asm/non_matchings/code/z_scene/Scene_ProcessHeader.s,Scene_ProcessHeader,0x801306E8,0x20 @@ -2394,7 +2394,7 @@ asm/non_matchings/code/z_message_nes/Message_LoadPluralRupeesNES.s,Message_LoadP asm/non_matchings/code/z_message_nes/Message_LoadLocalizedRupeesNES.s,Message_LoadLocalizedRupeesNES,0x80158C04,0x65 asm/non_matchings/code/z_message_nes/Message_LoadRupeesNES.s,Message_LoadRupeesNES,0x80158D98,0x86 asm/non_matchings/code/z_message_nes/Message_LoadTimeNES.s,Message_LoadTimeNES,0x80158FB0,0xAF -asm/non_matchings/code/z_message_nes/Message_LoadAreaTextNES.s,Message_LoadAreaTextNES,0x8015926C,0x73 +asm/non_matchings/code/z_message_nes/Message_LoadOwlWarpTextNES.s,Message_LoadOwlWarpTextNES,0x8015926C,0x73 asm/non_matchings/code/z_message_nes/func_80159438.s,func_80159438,0x80159438,0x8D asm/non_matchings/code/z_message_nes/func_8015966C.s,func_8015966C,0x8015966C,0x6CB asm/non_matchings/code/z_message_nes/func_8015B198.s,func_8015B198,0x8015B198,0xD6E