mirror of
https://github.com/n64decomp/sm64.git
synced 2024-12-22 07:38:54 -05:00
Refresh 12
This commit is contained in:
parent
9214dddabc
commit
8b872a71e8
20
CHANGES
20
CHANGES
@ -1,5 +1,23 @@
|
||||
Refresh 12
|
||||
|
||||
1.) Debug box improvements (#1066)
|
||||
2.) Improve 'geo_render_mirror_mario' (#1064)
|
||||
3.) Cleanup and small labeling (#1063)
|
||||
4.) Anim renames and other related renames (#1062)
|
||||
5.) remove do while 0 and make one line comments consistent (#1061)
|
||||
6.) fixed typo in segments.h (#1060)
|
||||
7.) Name unknown fields (from public repo) (#1058)
|
||||
8.) Change 'void *' to 'struct MainPoolState *' (#1057)
|
||||
9.) Fix type of freeList (#1056)
|
||||
10.) Newer version of diff script (#1055)
|
||||
11.) Add stubbed_printfs based on unused audio strings (#1054)
|
||||
12.) Fix comment in paintings.c (#1053)
|
||||
13.) Add defines for hardcoded cell/floor height values (#1051)
|
||||
14.) Update README.md: Remove GitHub specific Markdown syntax (#1052)
|
||||
15.) Properly label interation status that handle's Bowser's shockwave attack (#1050)
|
||||
|
||||
Refresh 11
|
||||
1.) (HEAD -> master, origin/master, origin/HEAD) Make geo_process_level_of_detail endian-independent (#1049)
|
||||
1.) Make geo_process_level_of_detail endian-independent (#1049)
|
||||
2.) Label oMoveFlags and slight cleanup. (#1046)
|
||||
3.) Avoid UB in synthesis_resample_and_mix_reverb (#1048)
|
||||
4.) Change some void * to correct type (#1047)
|
||||
|
17
Makefile
17
Makefile
@ -528,8 +528,6 @@ $(BUILD_DIR)/actors/%.o: OPT_FLAGS := -g
|
||||
$(BUILD_DIR)/bin/%.o: OPT_FLAGS := -g
|
||||
$(BUILD_DIR)/src/goddard/%.o: OPT_FLAGS := -g
|
||||
$(BUILD_DIR)/src/goddard/%.o: MIPSISET := -mips1
|
||||
$(BUILD_DIR)/src/audio/%.o: OPT_FLAGS := -O2 -Wo,-loopunroll,0
|
||||
$(BUILD_DIR)/src/audio/load.o: OPT_FLAGS := -O2 -framepointer -Wo,-loopunroll,0
|
||||
$(BUILD_DIR)/lib/src/%.o: OPT_FLAGS :=
|
||||
$(BUILD_DIR)/lib/src/math/ll%.o: MIPSISET := -mips3 -32
|
||||
$(BUILD_DIR)/lib/src/math/%.o: OPT_FLAGS := -O2
|
||||
@ -545,15 +543,22 @@ $(BUILD_DIR)/lib/src/_Ldtob.o: OPT_FLAGS := -O3
|
||||
$(BUILD_DIR)/lib/src/_Printf.o: OPT_FLAGS := -O3
|
||||
$(BUILD_DIR)/lib/src/sprintf.o: OPT_FLAGS := -O3
|
||||
|
||||
# enable loop unrolling except for external.c (external.c might also have used
|
||||
# unrolling, but it makes one loop harder to match)
|
||||
$(BUILD_DIR)/src/audio/%.o: OPT_FLAGS := -O2
|
||||
$(BUILD_DIR)/src/audio/load.o: OPT_FLAGS := -O2
|
||||
# Enable loop unrolling except for external.c (external.c might also have used
|
||||
# unrolling, but it makes one loop harder to match).
|
||||
# For all audio files other than external.c and port_eu.c, put string literals
|
||||
# in .data. (In Shindou, the port_eu.c string literals also moved to .data.)
|
||||
$(BUILD_DIR)/src/audio/%.o: OPT_FLAGS := -O2 -use_readwrite_const
|
||||
$(BUILD_DIR)/src/audio/port_eu.o: OPT_FLAGS := -O2
|
||||
$(BUILD_DIR)/src/audio/external.o: OPT_FLAGS := -O2 -Wo,-loopunroll,0
|
||||
else
|
||||
|
||||
$(BUILD_DIR)/src/audio/%.o: OPT_FLAGS := -O2 -Wo,-loopunroll,0
|
||||
$(BUILD_DIR)/src/audio/load.o: OPT_FLAGS := -O2 -framepointer -Wo,-loopunroll,0
|
||||
|
||||
# The source-to-source optimizer copt is enabled for audio. This makes it use
|
||||
# acpp, which needs -Wp,-+ to handle C++-style comments.
|
||||
# All other files than external.c should really use copt, but only a few have
|
||||
# been matched so far.
|
||||
$(BUILD_DIR)/src/audio/effects.o: OPT_FLAGS := -O2 -Wo,-loopunroll,0 -sopt,-inline=sequence_channel_process_sound,-scalaroptimize=1 -Wp,-+
|
||||
$(BUILD_DIR)/src/audio/synthesis.o: OPT_FLAGS := -O2 -sopt,-scalaroptimize=1 -Wp,-+
|
||||
#$(BUILD_DIR)/src/audio/seqplayer.o: OPT_FLAGS := -O2 -sopt,-inline_manual,-scalaroptimize=1 -Wp,-+ #-Wo,-v,-bb,-l,seqplayer_list.txt
|
||||
|
58
README.md
58
README.md
@ -139,35 +139,33 @@ Resulting artifacts can be found in the `build` directory.
|
||||
|
||||
## Project Structure
|
||||
|
||||
```
|
||||
sm64
|
||||
├── actors: object behaviors, geo layout, and display lists
|
||||
├── asm: handwritten assembly code, rom header
|
||||
│ └── non_matchings: asm for non-matching sections
|
||||
├── assets: animation and demo data
|
||||
│ ├── anims: animation data
|
||||
│ └── demos: demo data
|
||||
├── bin: C files for ordering display lists and textures
|
||||
├── build: output directory
|
||||
├── data: behavior scripts, misc. data
|
||||
├── doxygen: documentation infrastructure
|
||||
├── enhancements: example source modifications
|
||||
├── include: header files
|
||||
├── levels: level scripts, geo layout, and display lists
|
||||
├── lib: SDK library code
|
||||
├── rsp: audio and Fast3D RSP assembly code
|
||||
├── sound: sequences, sound samples, and sound banks
|
||||
├── src: C source code for game
|
||||
│ ├── audio: audio code
|
||||
│ ├── buffers: stacks, heaps, and task buffers
|
||||
│ ├── engine: script processing engines and utils
|
||||
│ ├── game: behaviors and rest of game source
|
||||
│ ├── goddard: Mario intro screen
|
||||
│ └── menu: title screen and file, act, and debug level selection menus
|
||||
├── text: dialog, level names, act names
|
||||
├── textures: skybox and generic texture data
|
||||
└── tools: build tools
|
||||
```
|
||||
sm64
|
||||
├── actors: object behaviors, geo layout, and display lists
|
||||
├── asm: handwritten assembly code, rom header
|
||||
│ └── non_matchings: asm for non-matching sections
|
||||
├── assets: animation and demo data
|
||||
│ ├── anims: animation data
|
||||
│ └── demos: demo data
|
||||
├── bin: C files for ordering display lists and textures
|
||||
├── build: output directory
|
||||
├── data: behavior scripts, misc. data
|
||||
├── doxygen: documentation infrastructure
|
||||
├── enhancements: example source modifications
|
||||
├── include: header files
|
||||
├── levels: level scripts, geo layout, and display lists
|
||||
├── lib: SDK library code
|
||||
├── rsp: audio and Fast3D RSP assembly code
|
||||
├── sound: sequences, sound samples, and sound banks
|
||||
├── src: C source code for game
|
||||
│ ├── audio: audio code
|
||||
│ ├── buffers: stacks, heaps, and task buffers
|
||||
│ ├── engine: script processing engines and utils
|
||||
│ ├── game: behaviors and rest of game source
|
||||
│ ├── goddard: Mario intro screen
|
||||
│ └── menu: title screen and file, act, and debug level selection menus
|
||||
├── text: dialog, level names, act names
|
||||
├── textures: skybox and generic texture data
|
||||
└── tools: build tools
|
||||
|
||||
## Contributing
|
||||
|
||||
@ -176,4 +174,4 @@ discuss what you would like to change.
|
||||
|
||||
Run `clang-format` on your code to ensure it meets the project's coding standards.
|
||||
|
||||
Official Discord: https://discord.gg/DuYH3Fh
|
||||
Official Discord: [discord.gg/DuYH3Fh](https://discord.gg/DuYH3Fh)
|
||||
|
@ -1,3 +1,17 @@
|
||||
.data
|
||||
.asciiz "Audio:Track :Call Macro Level Over Error!\n"
|
||||
.balign 4
|
||||
.asciiz "Audio:Track :Loops Macro Level Over Error!\n"
|
||||
.balign 4
|
||||
.asciiz "SUB:ERR:BANK %d NOT CACHED.\n"
|
||||
.balign 4
|
||||
.asciiz "SUB:ERR:BANK %d NOT CACHED.\n"
|
||||
.balign 4
|
||||
.asciiz "Audio:Track: CTBLCALL Macro Level Over Error!\n"
|
||||
.balign 4
|
||||
.asciiz "Err :Sub %x ,address %x:Undefined SubTrack Function %x"
|
||||
.balign 4
|
||||
|
||||
.late_rodata
|
||||
.late_rodata_alignment 4
|
||||
glabel jtbl_EU_80306714
|
||||
|
@ -43,4 +43,3 @@
|
||||
.else
|
||||
.byte 0x00 /* Version */
|
||||
.endif
|
||||
|
||||
|
410
diff.py
410
diff.py
@ -5,6 +5,7 @@ import os
|
||||
import ast
|
||||
import argparse
|
||||
import subprocess
|
||||
import collections
|
||||
import difflib
|
||||
import string
|
||||
import itertools
|
||||
@ -20,7 +21,7 @@ def fail(msg):
|
||||
|
||||
MISSING_PREREQUISITES = (
|
||||
"Missing prerequisite python module {}. "
|
||||
"Run `python3 -m pip install --user colorama ansiwrap attrs watchdog python-Levenshtein` to install prerequisites (python-Levenshtein only needed for --algorithm=levenshtein)."
|
||||
"Run `python3 -m pip install --user colorama ansiwrap attrs watchdog python-Levenshtein cxxfilt` to install prerequisites (cxxfilt only needed with --source)."
|
||||
)
|
||||
|
||||
try:
|
||||
@ -49,6 +50,21 @@ parser.add_argument(
|
||||
action="store_true",
|
||||
help="Diff .o files rather than a whole binary. This makes it possible to see symbol names. (Recommended)",
|
||||
)
|
||||
parser.add_argument(
|
||||
"--elf",
|
||||
dest="diff_elf_symbol",
|
||||
help="Diff a given function in two ELFs, one being stripped and the other one non-stripped. Requires objdump from binutils 2.33+.",
|
||||
)
|
||||
parser.add_argument(
|
||||
"--source",
|
||||
action="store_true",
|
||||
help="Show source code (if possible). Only works with -o and -e.",
|
||||
)
|
||||
parser.add_argument(
|
||||
"--inlines",
|
||||
action="store_true",
|
||||
help="Show inline function calls (if possible). Only works with -o and -e.",
|
||||
)
|
||||
parser.add_argument(
|
||||
"--base-asm",
|
||||
dest="base_asm",
|
||||
@ -126,7 +142,7 @@ parser.add_argument(
|
||||
parser.add_argument(
|
||||
"--algorithm",
|
||||
dest="algorithm",
|
||||
default="difflib",
|
||||
default="levenshtein",
|
||||
choices=["levenshtein", "difflib"],
|
||||
help="Diff algorithm to use.",
|
||||
)
|
||||
@ -137,7 +153,7 @@ parser.add_argument(
|
||||
dest="max_lines",
|
||||
type=int,
|
||||
default=1024,
|
||||
help="The maximum length of the diff, in lines. Not recommended when -f is used.",
|
||||
help="The maximum length of the diff, in lines.",
|
||||
)
|
||||
|
||||
# Project-specific flags, e.g. different versions/make arguments.
|
||||
@ -150,11 +166,13 @@ args = parser.parse_args()
|
||||
config = {}
|
||||
diff_settings.apply(config, args)
|
||||
|
||||
arch = config.get("arch", "mips")
|
||||
baseimg = config.get("baseimg", None)
|
||||
myimg = config.get("myimg", None)
|
||||
mapfile = config.get("mapfile", None)
|
||||
makeflags = config.get("makeflags", [])
|
||||
source_directories = config.get("source_directories", None)
|
||||
objdump_executable = config.get("objdump_executable", None)
|
||||
|
||||
MAX_FUNCTION_SIZE_LINES = args.max_lines
|
||||
MAX_FUNCTION_SIZE_BYTES = MAX_FUNCTION_SIZE_LINES * 4
|
||||
@ -172,7 +190,7 @@ COLOR_ROTATION = [
|
||||
]
|
||||
|
||||
BUFFER_CMD = ["tail", "-c", str(10 ** 9)]
|
||||
LESS_CMD = ["less", "-Ric"]
|
||||
LESS_CMD = ["less", "-SRic", "-#6"]
|
||||
|
||||
DEBOUNCE_DELAY = 0.1
|
||||
FS_WATCH_EXTENSIONS = [".c", ".h"]
|
||||
@ -185,25 +203,30 @@ if args.algorithm == "levenshtein":
|
||||
except ModuleNotFoundError as e:
|
||||
fail(MISSING_PREREQUISITES.format(e.name))
|
||||
|
||||
binutils_prefix = None
|
||||
if args.source:
|
||||
try:
|
||||
import cxxfilt
|
||||
except ModuleNotFoundError as e:
|
||||
fail(MISSING_PREREQUISITES.format(e.name))
|
||||
|
||||
for binutils_cand in ["mips-linux-gnu-", "mips64-elf-"]:
|
||||
if objdump_executable is None:
|
||||
for objdump_cand in ["mips-linux-gnu-objdump", "mips64-elf-objdump"]:
|
||||
try:
|
||||
subprocess.check_call(
|
||||
[binutils_cand + "objdump", "--version"],
|
||||
[objdump_cand, "--version"],
|
||||
stdout=subprocess.DEVNULL,
|
||||
stderr=subprocess.DEVNULL,
|
||||
)
|
||||
binutils_prefix = binutils_cand
|
||||
objdump_executable = objdump_cand
|
||||
break
|
||||
except subprocess.CalledProcessError:
|
||||
pass
|
||||
except FileNotFoundError:
|
||||
pass
|
||||
|
||||
if not binutils_prefix:
|
||||
if not objdump_executable:
|
||||
fail(
|
||||
"Missing binutils; please ensure mips-linux-gnu-objdump or mips64-elf-objdump exist."
|
||||
"Missing binutils; please ensure mips-linux-gnu-objdump or mips64-elf-objdump exist, or configure objdump_executable."
|
||||
)
|
||||
|
||||
|
||||
@ -219,6 +242,10 @@ def eval_int(expr, emsg=None):
|
||||
return None
|
||||
|
||||
|
||||
def eval_line_num(expr):
|
||||
return int(expr.strip().replace(":", ""), 16)
|
||||
|
||||
|
||||
def run_make(target, capture_output=False):
|
||||
if capture_output:
|
||||
return subprocess.run(
|
||||
@ -244,10 +271,26 @@ def restrict_to_function(dump, fn_name):
|
||||
return "\n".join(out)
|
||||
|
||||
|
||||
def maybe_get_objdump_source_flags():
|
||||
if not args.source:
|
||||
return []
|
||||
|
||||
flags = [
|
||||
"--source",
|
||||
"--source-comment=| ",
|
||||
"-l",
|
||||
]
|
||||
|
||||
if args.inlines:
|
||||
flags.append("--inlines")
|
||||
|
||||
return flags
|
||||
|
||||
|
||||
def run_objdump(cmd):
|
||||
flags, target, restrict = cmd
|
||||
out = subprocess.check_output(
|
||||
[binutils_prefix + "objdump"] + flags + [target], universal_newlines=True
|
||||
[objdump_executable] + flags + [target], universal_newlines=True
|
||||
)
|
||||
if restrict is not None:
|
||||
return restrict_to_function(out, restrict)
|
||||
@ -300,6 +343,36 @@ def search_map_file(fn_name):
|
||||
return None, None
|
||||
|
||||
|
||||
def dump_elf():
|
||||
if not baseimg or not myimg:
|
||||
fail("Missing myimg/baseimg in config.")
|
||||
if base_shift:
|
||||
fail("--base-shift not compatible with -e")
|
||||
|
||||
start_addr = eval_int(args.start, "Start address must be an integer expression.")
|
||||
|
||||
if args.end is not None:
|
||||
end_addr = eval_int(args.end, "End address must be an integer expression.")
|
||||
else:
|
||||
end_addr = start_addr + MAX_FUNCTION_SIZE_BYTES
|
||||
|
||||
flags1 = [
|
||||
f"--start-address={start_addr}",
|
||||
f"--stop-address={end_addr}",
|
||||
]
|
||||
|
||||
flags2 = [
|
||||
f"--disassemble={args.diff_elf_symbol}",
|
||||
]
|
||||
|
||||
objdump_flags = ["-drz", "-j", ".text"]
|
||||
return (
|
||||
myimg,
|
||||
(objdump_flags + flags1, baseimg, None),
|
||||
(objdump_flags + flags2 + maybe_get_objdump_source_flags(), myimg, None),
|
||||
)
|
||||
|
||||
|
||||
def dump_objfile():
|
||||
if base_shift:
|
||||
fail("--base-shift not compatible with -o")
|
||||
@ -326,7 +399,7 @@ def dump_objfile():
|
||||
return (
|
||||
objfile,
|
||||
(objdump_flags, refobjfile, args.start),
|
||||
(objdump_flags, objfile, args.start),
|
||||
(objdump_flags + maybe_get_objdump_source_flags(), objfile, args.start),
|
||||
)
|
||||
|
||||
|
||||
@ -366,14 +439,15 @@ def ansi_ljust(s, width):
|
||||
return s
|
||||
|
||||
|
||||
re_int = re.compile(r"[0-9]+")
|
||||
re_comments = re.compile(r"<.*?>")
|
||||
re_regs = re.compile(r"\$?\b(a[0-3]|t[0-9]|s[0-8]|at|v[01]|f[12]?[0-9]|f3[01]|fp)\b")
|
||||
re_sprel = re.compile(r",([0-9]+|0x[0-9a-f]+)\(sp\)")
|
||||
re_large_imm = re.compile(r"-?[1-9][0-9]{2,}|-?0x[0-9a-f]{3,}")
|
||||
re_imm = re.compile(r"(\b|-)([0-9]+|0x[0-9a-fA-F]+)\b(?!\(sp)|%(lo|hi)\([^)]*\)")
|
||||
forbidden = set(string.ascii_letters + "_")
|
||||
branch_likely_instructions = {
|
||||
if arch == "mips":
|
||||
re_int = re.compile(r"[0-9]+")
|
||||
re_comment = re.compile(r"<.*?>")
|
||||
re_reg = re.compile(r"\$?\b(a[0-3]|t[0-9]|s[0-8]|at|v[01]|f[12]?[0-9]|f3[01]|k[01]|fp|ra)\b")
|
||||
re_sprel = re.compile(r"(?<=,)([0-9]+|0x[0-9a-f]+)\(sp\)")
|
||||
re_large_imm = re.compile(r"-?[1-9][0-9]{2,}|-?0x[0-9a-f]{3,}")
|
||||
re_imm = re.compile(r"(\b|-)([0-9]+|0x[0-9a-fA-F]+)\b(?!\(sp)|%(lo|hi)\([^)]*\)")
|
||||
forbidden = set(string.ascii_letters + "_")
|
||||
branch_likely_instructions = {
|
||||
"beql",
|
||||
"bnel",
|
||||
"beqzl",
|
||||
@ -384,11 +458,26 @@ branch_likely_instructions = {
|
||||
"bltzl",
|
||||
"bc1tl",
|
||||
"bc1fl",
|
||||
}
|
||||
branch_instructions = branch_likely_instructions.union(
|
||||
}
|
||||
branch_instructions = branch_likely_instructions.union(
|
||||
{"b", "beq", "bne", "beqz", "bnez", "bgez", "bgtz", "blez", "bltz", "bc1t", "bc1f"}
|
||||
)
|
||||
jump_instructions = branch_instructions.union({"jal", "j"})
|
||||
)
|
||||
instructions_with_address_immediates = branch_instructions.union({"jal", "j"})
|
||||
elif arch == "aarch64":
|
||||
re_int = re.compile(r"[0-9]+")
|
||||
re_comment = re.compile(r"(<.*?>|//.*$)")
|
||||
# GPRs and FP registers: X0-X30, W0-W30, [DSHQ]0..31
|
||||
# The zero registers and SP should not be in this list.
|
||||
re_reg = re.compile(r"\$?\b([dshq][12]?[0-9]|[dshq]3[01]|[xw][12]?[0-9]|[xw]30)\b")
|
||||
re_sprel = re.compile(r"sp, #-?(0x[0-9a-fA-F]+|[0-9]+)\b")
|
||||
re_large_imm = re.compile(r"-?[1-9][0-9]{2,}|-?0x[0-9a-f]{3,}")
|
||||
re_imm = re.compile(r"(?<!sp, )#-?(0x[0-9a-fA-F]+|[0-9]+)\b")
|
||||
forbidden = set(string.ascii_letters + "_")
|
||||
branch_likely_instructions = set()
|
||||
branch_instructions = {"bl", "b", "b.eq", "b.ne", "b.cs", "b.hs", "b.cc", "b.lo", "b.mi", "b.pl", "b.vs", "b.vc", "b.hi", "b.ls", "b.ge", "b.lt", "b.gt", "b.le", "cbz", "cbnz", "tbz", "tbnz"}
|
||||
instructions_with_address_immediates = branch_instructions.union({"adrp"})
|
||||
else:
|
||||
fail("Unknown architecture.")
|
||||
|
||||
|
||||
def hexify_int(row, pat):
|
||||
@ -440,38 +529,63 @@ def process_reloc(row, prev):
|
||||
return before + repl + after
|
||||
|
||||
|
||||
def cleanup_whitespace(line):
|
||||
return "".join(f"{o:<8s}" for o in line.strip().split("\t"))
|
||||
|
||||
|
||||
Line = collections.namedtuple(
|
||||
"Line",
|
||||
[
|
||||
"mnemonic",
|
||||
"diff_row",
|
||||
"original",
|
||||
"line_num",
|
||||
"branch_target",
|
||||
"source_lines",
|
||||
"comment",
|
||||
],
|
||||
)
|
||||
|
||||
|
||||
def process(lines):
|
||||
mnemonics = []
|
||||
diff_rows = []
|
||||
rows_with_imms = []
|
||||
skip_next = False
|
||||
originals = []
|
||||
line_nums = []
|
||||
branch_targets = []
|
||||
source_lines = []
|
||||
if not args.diff_obj:
|
||||
lines = lines[7:]
|
||||
if lines and not lines[-1]:
|
||||
lines.pop()
|
||||
|
||||
output = []
|
||||
for row in lines:
|
||||
if args.diff_obj and (">:" in row or not row):
|
||||
continue
|
||||
|
||||
if "R_MIPS_" in row:
|
||||
# N.B. Don't transform the diff rows, they already ignore immediates
|
||||
# if diff_rows[-1] != '<delay-slot>':
|
||||
# diff_rows[-1] = process_reloc(row, rows_with_imms[-1])
|
||||
originals[-1] = process_reloc(row, originals[-1])
|
||||
if args.source and (row and row[0] != " "):
|
||||
source_lines.append(row)
|
||||
continue
|
||||
|
||||
row = re.sub(re_comments, "", row)
|
||||
if "R_AARCH64_" in row:
|
||||
# TODO: handle relocation
|
||||
continue
|
||||
|
||||
if "R_MIPS_" in row:
|
||||
# N.B. Don't transform the diff rows, they already ignore immediates
|
||||
# if output[-1].diff_row != "<delay-slot>":
|
||||
# output[-1] = output[-1].replace(diff_row=process_reloc(row, output[-1].row_with_imm))
|
||||
new_original = process_reloc(row, output[-1].original)
|
||||
output[-1] = output[-1]._replace(original=new_original)
|
||||
continue
|
||||
|
||||
m_comment = re.search(re_comment, row)
|
||||
comment = m_comment[0] if m_comment else None
|
||||
row = re.sub(re_comment, "", row)
|
||||
row = row.rstrip()
|
||||
tabs = row.split("\t")
|
||||
row = "\t".join(tabs[2:])
|
||||
line_num = tabs[0].strip()
|
||||
row_parts = row.split("\t", 1)
|
||||
mnemonic = row_parts[0].strip()
|
||||
if mnemonic not in jump_instructions:
|
||||
if mnemonic not in instructions_with_address_immediates:
|
||||
row = re.sub(re_int, lambda s: hexify_int(row, s), row)
|
||||
original = row
|
||||
if skip_next:
|
||||
@ -480,38 +594,45 @@ def process(lines):
|
||||
mnemonic = "<delay-slot>"
|
||||
if mnemonic in branch_likely_instructions:
|
||||
skip_next = True
|
||||
row = re.sub(re_regs, "<reg>", row)
|
||||
row = re.sub(re_sprel, ",addr(sp)", row)
|
||||
row = re.sub(re_reg, "<reg>", row)
|
||||
row = re.sub(re_sprel, "addr(sp)", row)
|
||||
row_with_imm = row
|
||||
if mnemonic in jump_instructions:
|
||||
if mnemonic in instructions_with_address_immediates:
|
||||
row = row.strip()
|
||||
row, _ = split_off_branch(row)
|
||||
row += "<imm>"
|
||||
else:
|
||||
row = re.sub(re_imm, "<imm>", row)
|
||||
row = normalize_imms(row)
|
||||
|
||||
mnemonics.append(mnemonic)
|
||||
rows_with_imms.append(row_with_imm)
|
||||
diff_rows.append(row)
|
||||
originals.append(original)
|
||||
line_nums.append(line_num)
|
||||
branch_target = None
|
||||
if mnemonic in branch_instructions:
|
||||
target = row_parts[1].strip().split(",")[-1]
|
||||
if mnemonic in branch_likely_instructions:
|
||||
target = hex(int(target, 16) - 4)[2:]
|
||||
branch_targets.append(target)
|
||||
else:
|
||||
branch_targets.append(None)
|
||||
branch_target = target.strip()
|
||||
|
||||
output.append(
|
||||
Line(
|
||||
mnemonic=mnemonic,
|
||||
diff_row=row,
|
||||
original=original,
|
||||
line_num=line_num,
|
||||
branch_target=branch_target,
|
||||
source_lines=source_lines,
|
||||
comment=comment,
|
||||
)
|
||||
)
|
||||
source_lines = []
|
||||
|
||||
if args.stop_jrra and mnemonic == "jr" and row_parts[1].strip() == "ra":
|
||||
break
|
||||
|
||||
# Cleanup whitespace
|
||||
originals = [original.strip() for original in originals]
|
||||
originals = [
|
||||
"".join(f"{o:<8s}" for o in original.split("\t")) for original in originals
|
||||
# Cleanup whitespace, after relocation fixups have happened
|
||||
output = [
|
||||
line._replace(original=cleanup_whitespace(line.original)) for line in output
|
||||
]
|
||||
# return diff_rows, diff_rows, line_nums
|
||||
return mnemonics, diff_rows, originals, line_nums, branch_targets
|
||||
|
||||
return output
|
||||
|
||||
|
||||
def format_single_line_diff(line1, line2, column_width):
|
||||
@ -545,7 +666,7 @@ def normalize_imms(row):
|
||||
|
||||
|
||||
def normalize_stack(row):
|
||||
return re.sub(re_sprel, ",addr(sp)", row)
|
||||
return re.sub(re_sprel, "addr(sp)", row)
|
||||
|
||||
|
||||
def split_off_branch(line):
|
||||
@ -614,20 +735,13 @@ def diff_sequences(seq1, seq2):
|
||||
|
||||
|
||||
def do_diff(basedump, mydump):
|
||||
asm_lines1 = basedump.split("\n")
|
||||
asm_lines2 = mydump.split("\n")
|
||||
|
||||
output = []
|
||||
|
||||
# TODO: status line?
|
||||
# output.append(sha1sum(mydump))
|
||||
|
||||
mnemonics1, asm_lines1, originals1, line_nums1, branch_targets1 = process(
|
||||
asm_lines1
|
||||
)
|
||||
mnemonics2, asm_lines2, originals2, line_nums2, branch_targets2 = process(
|
||||
asm_lines2
|
||||
)
|
||||
lines1 = process(basedump.split("\n"))
|
||||
lines2 = process(mydump.split("\n"))
|
||||
|
||||
sc1 = SymbolColorer(0)
|
||||
sc2 = SymbolColorer(0)
|
||||
@ -639,80 +753,74 @@ def do_diff(basedump, mydump):
|
||||
bts2 = set()
|
||||
|
||||
if args.show_branches:
|
||||
for (bts, btset, sc) in [
|
||||
(branch_targets1, bts1, sc5),
|
||||
(branch_targets2, bts2, sc6),
|
||||
for (lines, btset, sc) in [
|
||||
(lines1, bts1, sc5),
|
||||
(lines2, bts2, sc6),
|
||||
]:
|
||||
for bt in bts:
|
||||
for line in lines:
|
||||
bt = line.branch_target
|
||||
if bt is not None:
|
||||
btset.add(bt + ":")
|
||||
sc.color_symbol(bt + ":")
|
||||
|
||||
for (tag, i1, i2, j1, j2) in diff_sequences(mnemonics1, mnemonics2):
|
||||
lines1 = asm_lines1[i1:i2]
|
||||
lines2 = asm_lines2[j1:j2]
|
||||
|
||||
for k, (line1, line2) in enumerate(itertools.zip_longest(lines1, lines2)):
|
||||
for (tag, i1, i2, j1, j2) in diff_sequences(
|
||||
[line.mnemonic for line in lines1], [line.mnemonic for line in lines2]
|
||||
):
|
||||
for line1, line2 in itertools.zip_longest(lines1[i1:i2], lines2[j1:j2]):
|
||||
if tag == "replace":
|
||||
if line1 is None:
|
||||
tag = "insert"
|
||||
elif line2 is None:
|
||||
tag = "delete"
|
||||
elif tag == "insert":
|
||||
assert line1 is None
|
||||
elif tag == "delete":
|
||||
assert line2 is None
|
||||
|
||||
try:
|
||||
original1 = originals1[i1 + k]
|
||||
line_num1 = line_nums1[i1 + k]
|
||||
except:
|
||||
original1 = ""
|
||||
line_num1 = ""
|
||||
try:
|
||||
original2 = originals2[j1 + k]
|
||||
line_num2 = line_nums2[j1 + k]
|
||||
except:
|
||||
original2 = ""
|
||||
line_num2 = ""
|
||||
|
||||
has1 = has2 = True
|
||||
line_color1 = line_color2 = sym_color = Fore.RESET
|
||||
line_prefix = " "
|
||||
if line1 == line2:
|
||||
if not line1:
|
||||
has1 = has2 = False
|
||||
if maybe_normalize_large_imms(original1) == maybe_normalize_large_imms(
|
||||
original2
|
||||
):
|
||||
out1 = original1
|
||||
out2 = original2
|
||||
elif line1 == "<delay-slot>":
|
||||
out1 = f"{Style.DIM}{original1}"
|
||||
out2 = f"{Style.DIM}{original2}"
|
||||
if line1 and line2 and line1.diff_row == line2.diff_row:
|
||||
if maybe_normalize_large_imms(
|
||||
line1.original
|
||||
) == maybe_normalize_large_imms(line2.original):
|
||||
out1 = line1.original
|
||||
out2 = line2.original
|
||||
elif line1.diff_row == "<delay-slot>":
|
||||
out1 = f"{Style.BRIGHT}{Fore.LIGHTBLACK_EX}{line1.original}"
|
||||
out2 = f"{Style.BRIGHT}{Fore.LIGHTBLACK_EX}{line2.original}"
|
||||
else:
|
||||
mnemonic = original1.split()[0]
|
||||
out1, out2 = original1, original2
|
||||
mnemonic = line1.original.split()[0]
|
||||
out1, out2 = line1.original, line2.original
|
||||
branch1 = branch2 = ""
|
||||
if mnemonic in jump_instructions:
|
||||
out1, branch1 = split_off_branch(original1)
|
||||
out2, branch2 = split_off_branch(original2)
|
||||
if mnemonic in instructions_with_address_immediates:
|
||||
out1, branch1 = split_off_branch(line1.original)
|
||||
out2, branch2 = split_off_branch(line2.original)
|
||||
branchless1 = out1
|
||||
branchless2 = out2
|
||||
out1, out2 = color_imms(out1, out2)
|
||||
|
||||
same_relative_target = False
|
||||
if line1.branch_target is not None and line2.branch_target is not None:
|
||||
relative_target1 = eval_line_num(line1.branch_target) - eval_line_num(line1.line_num)
|
||||
relative_target2 = eval_line_num(line2.branch_target) - eval_line_num(line2.line_num)
|
||||
same_relative_target = relative_target1 == relative_target2
|
||||
|
||||
if not same_relative_target:
|
||||
branch1, branch2 = color_branch_imms(branch1, branch2)
|
||||
|
||||
out1 += branch1
|
||||
out2 += branch2
|
||||
if normalize_imms(branchless1) == normalize_imms(branchless2):
|
||||
if not same_relative_target:
|
||||
# only imms differences
|
||||
sym_color = Fore.LIGHTBLUE_EX
|
||||
line_prefix = "i"
|
||||
else:
|
||||
out1 = re.sub(
|
||||
re_sprel,
|
||||
lambda s: "," + sc3.color_symbol(s.group()[1:]),
|
||||
out1,
|
||||
re_sprel, lambda s: sc3.color_symbol(s.group()), out1,
|
||||
)
|
||||
out2 = re.sub(
|
||||
re_sprel,
|
||||
lambda s: "," + sc4.color_symbol(s.group()[1:]),
|
||||
out2,
|
||||
re_sprel, lambda s: sc4.color_symbol(s.group()), out2,
|
||||
)
|
||||
if normalize_stack(branchless1) == normalize_stack(branchless2):
|
||||
# only stack differences (luckily stack and imm
|
||||
@ -723,61 +831,81 @@ def do_diff(basedump, mydump):
|
||||
else:
|
||||
# regs differences and maybe imms as well
|
||||
out1 = re.sub(
|
||||
re_regs, lambda s: sc1.color_symbol(s.group()), out1
|
||||
re_reg, lambda s: sc1.color_symbol(s.group()), out1
|
||||
)
|
||||
out2 = re.sub(
|
||||
re_regs, lambda s: sc2.color_symbol(s.group()), out2
|
||||
re_reg, lambda s: sc2.color_symbol(s.group()), out2
|
||||
)
|
||||
line_color1 = line_color2 = sym_color = Fore.YELLOW
|
||||
line_prefix = "r"
|
||||
elif tag in ["replace", "equal"]:
|
||||
elif line1 and line2:
|
||||
line_prefix = "|"
|
||||
line_color1 = Fore.LIGHTBLUE_EX
|
||||
line_color2 = Fore.LIGHTBLUE_EX
|
||||
sym_color = Fore.LIGHTBLUE_EX
|
||||
out1 = original1
|
||||
out2 = original2
|
||||
elif tag == "delete":
|
||||
out1 = line1.original
|
||||
out2 = line2.original
|
||||
elif line1:
|
||||
line_prefix = "<"
|
||||
line_color1 = line_color2 = sym_color = Fore.RED
|
||||
has2 = False
|
||||
out1 = original1
|
||||
out1 = line1.original
|
||||
out2 = ""
|
||||
elif tag == "insert":
|
||||
elif line2:
|
||||
line_prefix = ">"
|
||||
line_color1 = line_color2 = sym_color = Fore.GREEN
|
||||
has1 = False
|
||||
out1 = ""
|
||||
out2 = original2
|
||||
out2 = line2.original
|
||||
|
||||
in_arrow1 = " "
|
||||
in_arrow2 = " "
|
||||
out_arrow1 = ""
|
||||
out_arrow2 = ""
|
||||
line_num1 = line_num1 if has1 else ""
|
||||
line_num2 = line_num2 if has2 else ""
|
||||
|
||||
if sym_color == line_color2:
|
||||
line_color2 = ""
|
||||
if args.show_branches and line1:
|
||||
if line1.line_num in bts1:
|
||||
in_arrow1 = sc5.color_symbol(line1.line_num, "~>") + line_color1
|
||||
if line1.branch_target is not None:
|
||||
out_arrow1 = " " + sc5.color_symbol(line1.branch_target + ":", "~>")
|
||||
if args.show_branches and line2:
|
||||
if line2.line_num in bts2:
|
||||
in_arrow2 = sc6.color_symbol(line2.line_num, "~>") + line_color2
|
||||
if line2.branch_target is not None:
|
||||
out_arrow2 = " " + sc6.color_symbol(line2.branch_target + ":", "~>")
|
||||
|
||||
if args.show_branches and has1:
|
||||
if line_num1 in bts1:
|
||||
in_arrow1 = sc5.color_symbol(line_num1, "~>") + line_color1
|
||||
if branch_targets1[i1 + k] is not None:
|
||||
out_arrow1 = " " + sc5.color_symbol(
|
||||
branch_targets1[i1 + k] + ":", "~>"
|
||||
)
|
||||
if args.show_branches and has2:
|
||||
if line_num2 in bts2:
|
||||
in_arrow2 = sc6.color_symbol(line_num2, "~>") + line_color2
|
||||
if branch_targets2[j1 + k] is not None:
|
||||
out_arrow2 = " " + sc6.color_symbol(
|
||||
branch_targets2[j1 + k] + ":", "~>"
|
||||
)
|
||||
if args.source and line2 and line2.comment:
|
||||
out2 += f" {line2.comment}"
|
||||
|
||||
line_num1 = line1.line_num if line1 else ""
|
||||
line_num2 = line2.line_num if line2 else ""
|
||||
|
||||
out1 = f"{line_color1}{line_num1} {in_arrow1} {out1}{Style.RESET_ALL}{out_arrow1}"
|
||||
out2 = f"{line_color2}{line_num2} {in_arrow2} {out2}{Style.RESET_ALL}{out_arrow2}"
|
||||
mid = f"{sym_color}{line_prefix} "
|
||||
|
||||
if line2:
|
||||
for source_line in line2.source_lines:
|
||||
color = Style.DIM
|
||||
# File names and function names
|
||||
if source_line and source_line[0] != "|":
|
||||
color += Style.BRIGHT
|
||||
# Function names
|
||||
if source_line.endswith("():"):
|
||||
# Underline. Colorama does not provide this feature, unfortunately.
|
||||
color += "\u001b[4m"
|
||||
try:
|
||||
source_line = cxxfilt.demangle(
|
||||
source_line[:-3], external_only=False
|
||||
)
|
||||
except:
|
||||
pass
|
||||
output.append(
|
||||
format_single_line_diff(
|
||||
"",
|
||||
f" {color}{source_line}{Style.RESET_ALL}",
|
||||
args.column_width,
|
||||
)
|
||||
)
|
||||
|
||||
output.append(format_single_line_diff(out1, mid + out2, args.column_width))
|
||||
|
||||
return output[args.skip_lines :]
|
||||
@ -941,7 +1069,9 @@ class Display:
|
||||
|
||||
|
||||
def main():
|
||||
if args.diff_obj:
|
||||
if args.diff_elf_symbol:
|
||||
make_target, basecmd, mycmd = dump_elf()
|
||||
elif args.diff_obj:
|
||||
make_target, basecmd, mycmd = dump_objfile()
|
||||
else:
|
||||
make_target, basecmd, mycmd = dump_binary()
|
||||
|
@ -25,7 +25,7 @@ new file mode 100644
|
||||
index 00000000..0ee87ec7
|
||||
--- /dev/null
|
||||
+++ b/src/game/debug_box.c
|
||||
@@ -0,0 +1,244 @@
|
||||
@@ -0,0 +1,281 @@
|
||||
+#include <ultra64.h>
|
||||
+
|
||||
+#include "sm64.h"
|
||||
@ -67,24 +67,39 @@ index 00000000..0ee87ec7
|
||||
+ * Internal struct containing box info
|
||||
+ */
|
||||
+struct DebugBox {
|
||||
+ u32 color;
|
||||
+ Vec3s center;
|
||||
+ Vec3s bounds;
|
||||
+ s16 yaw;
|
||||
+};
|
||||
+
|
||||
+struct DebugBox *sBoxes[MAX_DEBUG_BOXES];
|
||||
+struct DebugBox sBoxes[MAX_DEBUG_BOXES];
|
||||
+s16 sNumBoxes = 0;
|
||||
+
|
||||
+extern Mat4 gMatStack[32]; //XXX: Hack
|
||||
+
|
||||
+/**
|
||||
+ * The debug boxes' transparency
|
||||
+ * The debug boxes' default transparency
|
||||
+ */
|
||||
+#define DBG_BOX_ALPHA 0x7F
|
||||
+/**
|
||||
+ * The debug boxes' color
|
||||
+ * The debug boxes' default color. sCurBoxColor is reset to this every frame.
|
||||
+ */
|
||||
+#define DBG_BOX_COL 0xFF, 0x00, 0x00, DBG_BOX_ALPHA
|
||||
+#define DBG_BOX_DEF_COLOR 0xFF0000
|
||||
+
|
||||
+/**
|
||||
+ * The color that new boxes will be drawn with.
|
||||
+ */
|
||||
+u32 sCurBoxColor = DBG_BOX_ALPHA << 24 | DBG_BOX_DEF_COLOR;
|
||||
+
|
||||
+/**
|
||||
+ * The allocated size of a rotated box's dl
|
||||
+ */
|
||||
+#define DBG_BOX_ROT_DLSIZE ((s32)(6 * sizeof(Gfx) + 8 * sizeof(Vtx)))
|
||||
+/**
|
||||
+ * The allocated size of a normal box's dl
|
||||
+ */
|
||||
+#define DBG_BOX_DLSIZE ((s32)(2 * sizeof(Gfx) + 8 * sizeof(Vtx)))
|
||||
+
|
||||
+/**
|
||||
+ * Sets up the RCP for drawing the boxes
|
||||
@ -107,14 +122,14 @@ index 00000000..0ee87ec7
|
||||
+ * Actually draws the box
|
||||
+ */
|
||||
+static const Gfx dl_debug_draw_box[] = {
|
||||
+ gsSP2Triangles( 0, 1, 2, 0x0, 2, 1, 3, 0x0),
|
||||
+ gsSP2Triangles( 2, 3, 6, 0x0, 6, 3, 7, 0x0),
|
||||
+ gsSP2Triangles(5, 4, 6, 0x0, 5, 6, 7, 0x0), // front
|
||||
+ gsSP2Triangles(0, 1, 2, 0x0, 2, 1, 3, 0x0), // back
|
||||
+
|
||||
+ gsSP2Triangles( 4, 0, 2, 0x0, 2, 6, 4, 0x0),
|
||||
+ gsSP2Triangles( 1, 5, 3, 0x0, 3, 5, 7, 0x0),
|
||||
+ gsSP2Triangles(4, 0, 2, 0x0, 2, 6, 4, 0x0), // left
|
||||
+ gsSP2Triangles(1, 5, 3, 0x0, 3, 5, 7, 0x0), // right
|
||||
+
|
||||
+ gsSP2Triangles( 1, 0, 4, 0x0, 1, 4, 5, 0x0),
|
||||
+ gsSP2Triangles( 5, 4, 6, 0x0, 5, 6, 7, 0x0),
|
||||
+ gsSP2Triangles(1, 0, 4, 0x0, 1, 4, 5, 0x0), // top
|
||||
+ gsSP2Triangles(2, 3, 6, 0x0, 6, 3, 7, 0x0), // bottom
|
||||
+
|
||||
+ gsSPEndDisplayList(),
|
||||
+};
|
||||
@ -126,20 +141,32 @@ index 00000000..0ee87ec7
|
||||
+ */
|
||||
+static void append_debug_box(Vec3f center, Vec3f bounds, s16 yaw)
|
||||
+{
|
||||
+ if (sNumBoxes >= MAX_DEBUG_BOXES ||
|
||||
+ (sBoxes[sNumBoxes] = mem_pool_alloc(gEffectsMemoryPool, sizeof(struct DebugBox))) == NULL) {
|
||||
+ if (sNumBoxes >= MAX_DEBUG_BOXES) {
|
||||
+ return;
|
||||
+ }
|
||||
+
|
||||
+ vec3f_to_vec3s(sBoxes[sNumBoxes]->center, center);
|
||||
+ vec3f_to_vec3s(sBoxes[sNumBoxes]->bounds, bounds);
|
||||
+ vec3f_to_vec3s(sBoxes[sNumBoxes].center, center);
|
||||
+ vec3f_to_vec3s(sBoxes[sNumBoxes].bounds, bounds);
|
||||
+
|
||||
+ sBoxes[sNumBoxes]->yaw = yaw;
|
||||
+ sBoxes[sNumBoxes].yaw = yaw;
|
||||
+ sBoxes[sNumBoxes].color = sCurBoxColor;
|
||||
+
|
||||
+ ++sNumBoxes;
|
||||
+}
|
||||
+
|
||||
+/**
|
||||
+ * Draw new boxes with the given color.
|
||||
+ * Color format is 32-bit ARGB.
|
||||
+ * If the alpha component is zero, DBG_BOX_ALPHA (0x7f) will be used instead.
|
||||
+ * Ex: 0xFF0000 becomes 0x7FFF0000
|
||||
+ */
|
||||
+void debug_box_color(u32 color)
|
||||
+{
|
||||
+ if ((color >> 24) == 0) color |= (DBG_BOX_ALPHA << 24);
|
||||
+ sCurBoxColor = color;
|
||||
+}
|
||||
+
|
||||
+/**
|
||||
+ * Draws a debug box from (center - bounds) to (center + bounds)
|
||||
+ * To draw a rotated box, use debug_box_rot()
|
||||
+ *
|
||||
@ -176,9 +203,9 @@ index 00000000..0ee87ec7
|
||||
+{
|
||||
+ Vec3f center, bounds;
|
||||
+
|
||||
+ bounds[0] = pMax[0] - pMin[0] / 2.0f;
|
||||
+ bounds[1] = pMax[1] - pMin[1] / 2.0f;
|
||||
+ bounds[2] = pMax[2] - pMin[2] / 2.0f;
|
||||
+ bounds[0] = (pMax[0] - pMin[0]) / 2.0f;
|
||||
+ bounds[1] = (pMax[1] - pMin[1]) / 2.0f;
|
||||
+ bounds[2] = (pMax[2] - pMin[2]) / 2.0f;
|
||||
+
|
||||
+ center[0] = pMin[0] + bounds[0];
|
||||
+ center[1] = pMin[1] + bounds[1];
|
||||
@ -187,12 +214,15 @@ index 00000000..0ee87ec7
|
||||
+ append_debug_box(center, bounds, yaw);
|
||||
+}
|
||||
+
|
||||
+static void render_box(struct DebugBox *box)
|
||||
+static void render_box(int index)
|
||||
+{
|
||||
+ Vtx *verts = alloc_display_list(8 * sizeof(Vtx));
|
||||
+ Vtx *verts;
|
||||
+ Mtx *translate;
|
||||
+ Mtx *rotate;
|
||||
+ Mtx *translateback;
|
||||
+ struct DebugBox *box = &sBoxes[index];
|
||||
+ u32 color = box->color;
|
||||
+
|
||||
+ s32 x0 = box->center[0],
|
||||
+ y0 = box->center[1],
|
||||
+ z0 = box->center[2];
|
||||
@ -201,6 +231,13 @@ index 00000000..0ee87ec7
|
||||
+ yb = box->bounds[1],
|
||||
+ zb = box->bounds[2];
|
||||
+
|
||||
+ if (box->yaw != 0 && (Gfx*)gGfxPoolEnd - gDisplayListHead < DBG_BOX_ROT_DLSIZE)
|
||||
+ return;
|
||||
+ else if ((Gfx*)gGfxPoolEnd - gDisplayListHead < DBG_BOX_DLSIZE)
|
||||
+ return;
|
||||
+
|
||||
+ verts = alloc_display_list(8 * sizeof(Vtx));
|
||||
+
|
||||
+ if (verts != NULL) {
|
||||
+ if (box->yaw != 0) {
|
||||
+ // Translate to the origin, rotate, then translate back, effectively rotating the box about
|
||||
@ -218,6 +255,7 @@ index 00000000..0ee87ec7
|
||||
+ gSPMatrix(gDisplayListHead++, translateback, G_MTX_MODELVIEW | G_MTX_MUL | G_MTX_NOPUSH);
|
||||
+ }
|
||||
+
|
||||
+#define DBG_BOX_COL /**/ (color >> 16) & 0xff, (color >> 8) & 0xff, color & 0xff, (color >> 24) & 0xff
|
||||
+#define DBG_BOX_VTX(i, x, y, z) make_vertex(verts, i, x, y, z, 0, 0, DBG_BOX_COL)
|
||||
+ DBG_BOX_VTX(0, x0 - xb, y0 + yb, z0 - zb);
|
||||
+ DBG_BOX_VTX(1, x0 + xb, y0 + yb, z0 - zb);
|
||||
@ -244,15 +282,15 @@ index 00000000..0ee87ec7
|
||||
+ s32 i;
|
||||
+ Mtx *mtx;
|
||||
+
|
||||
+ debug_box_color(DBG_BOX_DEF_COLOR);
|
||||
+
|
||||
+ if (sNumBoxes == 0) {
|
||||
+ return;
|
||||
+ }
|
||||
+
|
||||
+ mtx = alloc_display_list(sizeof(Mtx));
|
||||
+ if (mtx == NULL) {
|
||||
+ for (i = 0; i < sNumBoxes; ++i) {
|
||||
+ mem_pool_free(gEffectsMemoryPool, sBoxes[i]);
|
||||
+ }
|
||||
+ // Don't draw if there isn't space for the configuration + at least one box
|
||||
+ if (mtx == NULL || ((Gfx*)gGfxPoolEnd - gDisplayListHead) <= (s32)(2 * sizeof(Gfx)) + DBG_BOX_DLSIZE) {
|
||||
+ sNumBoxes = 0;
|
||||
+ return;
|
||||
+ }
|
||||
@ -264,8 +302,7 @@ index 00000000..0ee87ec7
|
||||
+ gSPDisplayList(gDisplayListHead++, dl_debug_box_begin);
|
||||
+
|
||||
+ for (i = 0; i < sNumBoxes; ++i) {
|
||||
+ render_box(sBoxes[i]);
|
||||
+ mem_pool_free(gEffectsMemoryPool, sBoxes[i]);
|
||||
+ render_box(i);
|
||||
+ }
|
||||
+
|
||||
+ sNumBoxes = 0;
|
||||
@ -275,23 +312,24 @@ new file mode 100644
|
||||
index 00000000..cdb3dc9d
|
||||
--- /dev/null
|
||||
+++ b/src/game/debug_box.h
|
||||
@@ -0,0 +1,25 @@
|
||||
+#ifndef _DEBUG_DRAW_CUBE_H
|
||||
+#define _DEBUG_DRAW_CUBE_H
|
||||
@@ -0,0 +1,26 @@
|
||||
+#ifndef DEBUG_BOX_H
|
||||
+#define DEBUG_BOX_H
|
||||
+
|
||||
+/**
|
||||
+ * @file debug_box.h
|
||||
+ * Draws debug boxes, see debug_box.inc.c for details
|
||||
+ * Draws debug boxes, see debug_box.c for details
|
||||
+ */
|
||||
+
|
||||
+#include "types.h"
|
||||
+
|
||||
+/**
|
||||
+ * The max amount of debug boxes before debug_box() just returns.
|
||||
+ * You can set this to something higher like 1000, but things like text will stop rendering.
|
||||
+ * You can set this to something higher, but you might run out of space in the gfx pool.
|
||||
+ */
|
||||
+#define MAX_DEBUG_BOXES 100
|
||||
+#define MAX_DEBUG_BOXES 512
|
||||
+
|
||||
+void debug_box_color(u32 color);
|
||||
+void debug_box(Vec3f center, Vec3f bounds);
|
||||
+void debug_box_rot(Vec3f center, Vec3f bounds, s16 yaw);
|
||||
+
|
||||
@ -300,4 +338,4 @@ index 00000000..cdb3dc9d
|
||||
+
|
||||
+void render_debug_boxes(void);
|
||||
+
|
||||
+#endif /* _DEBUG_DRAW_CUBE_H */
|
||||
+#endif /* DEBUG_BOX_H */
|
||||
|
@ -170,7 +170,7 @@ index a3afffee..8b05fcf1 100644
|
||||
+ create_thread(&gGameLoopThread, 5, thread5_mem_error_message_loop, NULL, gThread5Stack + 0x2000, 10);
|
||||
osStartThread(&gGameLoopThread);
|
||||
|
||||
while (1) {
|
||||
while (TRUE) {
|
||||
diff --git a/src/game/mem_error_screen.c b/src/game/mem_error_screen.c
|
||||
new file mode 100644
|
||||
index 00000000..81efaf91
|
||||
|
@ -1,7 +1,7 @@
|
||||
#ifndef EU_TRANSLATION_H
|
||||
#define EU_TRANSLATION_H
|
||||
|
||||
// PAL changes most text to arrays for each language. This define allows these
|
||||
// EU changes most text to arrays for each language. This define allows these
|
||||
// differences to be combined.
|
||||
#ifdef VERSION_EU
|
||||
#define LANGUAGE_ARRAY(cmd) cmd[LANGUAGE_FUNCTION]
|
||||
|
@ -634,15 +634,15 @@
|
||||
#define UKIKI_TEXT_DEFAULT 0
|
||||
#define UKIKI_TEXT_CAGE_TEXTBOX 1
|
||||
#define UKIKI_TEXT_GO_TO_CAGE 2
|
||||
#define UKIKI_TEXT_STOLE_HAT 3
|
||||
#define UKIKI_TEXT_HAS_HAT 4
|
||||
#define UKIKI_TEXT_GAVE_HAT_BACK 5
|
||||
#define UKIKI_TEXT_STOLE_CAP 3
|
||||
#define UKIKI_TEXT_HAS_CAP 4
|
||||
#define UKIKI_TEXT_GAVE_CAP_BACK 5
|
||||
#define UKIKI_TEXT_DO_NOT_LET_GO 6
|
||||
#define UKIKI_TEXT_STEAL_HAT 7
|
||||
#define UKIKI_TEXT_STEAL_CAP 7
|
||||
|
||||
/* oBehParams2ndByte */
|
||||
#define UKIKI_CAGE 0
|
||||
#define UKIKI_HAT 1
|
||||
#define UKIKI_CAP 1
|
||||
|
||||
/* Animations */
|
||||
#define UKIKI_ANIM_RUN 0
|
||||
@ -662,10 +662,10 @@
|
||||
/* oAnimState */
|
||||
#define UKIKI_ANIM_STATE_DEFAULT 0
|
||||
#define UKIKI_ANIM_STATE_EYE_CLOSED 1
|
||||
#define UKIKI_ANIM_STATE_HAT_ON 2
|
||||
#define UKIKI_ANIM_STATE_CAP_ON 2
|
||||
|
||||
/* oUkikiHasHat */
|
||||
#define UKIKI_HAT_ON 1
|
||||
/* oUkikiHasCap */
|
||||
#define UKIKI_CAP_ON 1
|
||||
|
||||
/* Ukiki Cage Star */
|
||||
/* oAction */
|
||||
|
@ -504,9 +504,9 @@
|
||||
#define /*0x0F8*/ oBlueFlameUnkF8 OBJECT_FIELD_F32(0x1C)
|
||||
|
||||
/* Small Piranha Flame */
|
||||
#define /*0x0F4*/ oSmallPiranhaFlameUnkF4 OBJECT_FIELD_F32(0x1B)
|
||||
#define /*0x0F8*/ oSmallPiranhaFlameUnkF8 OBJECT_FIELD_F32(0x1C)
|
||||
#define /*0x0FC*/ oSmallPiranhaFlameUnkFC OBJECT_FIELD_S32(0x1D)
|
||||
#define /*0x0F4*/ oSmallPiranhaFlameStartSpeed OBJECT_FIELD_F32(0x1B)
|
||||
#define /*0x0F8*/ oSmallPiranhaFlameEndSpeed OBJECT_FIELD_F32(0x1C)
|
||||
#define /*0x0FC*/ oSmallPiranhaFlameModel OBJECT_FIELD_S32(0x1D)
|
||||
#define /*0x100*/ oSmallPiranhaFlameUnk100 OBJECT_FIELD_S32(0x1E)
|
||||
#define /*0x104*/ oSmallPiranhaFlameUnk104 OBJECT_FIELD_F32(0x1F)
|
||||
|
||||
@ -1050,7 +1050,7 @@
|
||||
#define /*0x1AC*/ oUkikiTextState OBJECT_FIELD_S16(0x49, 0)
|
||||
#define /*0x1AE*/ oUkikiTextboxTimer OBJECT_FIELD_S16(0x49, 1)
|
||||
#define /*0x1B0*/ oUkikiCageSpinTimer OBJECT_FIELD_S16(0x4A, 0)
|
||||
#define /*0x1B2*/ oUkikiHasHat OBJECT_FIELD_S16(0x4A, 1)
|
||||
#define /*0x1B2*/ oUkikiHasCap OBJECT_FIELD_S16(0x4A, 1)
|
||||
|
||||
/* Ukiki Cage*/
|
||||
#define /*0x088*/ oUkikiCageNextAction OBJECT_FIELD_S32(0x00)
|
||||
@ -1084,7 +1084,7 @@
|
||||
#define /*0x0F4*/ oCannonBarrelBubblesUnkF4 OBJECT_FIELD_F32(0x1B)
|
||||
|
||||
/* Water Level Pillar */
|
||||
#define /*0x0F8*/ oWaterLevelPillarUnkF8 OBJECT_FIELD_S32(0x1C)
|
||||
#define /*0x0F8*/ oWaterLevelPillarDrained OBJECT_FIELD_S32(0x1C)
|
||||
|
||||
/* Water Level Trigger */
|
||||
#define /*0x0F4*/ oWaterLevelTriggerUnkF4 OBJECT_FIELD_S32(0x1B)
|
||||
|
@ -44,7 +44,7 @@
|
||||
*/
|
||||
|
||||
#define SEG_BUFFERS 0x8005C000 // 0x0085000 in size
|
||||
#define SEG_MAIN 0x800E1000 // 0x1328000 in size
|
||||
#define SEG_MAIN 0x800E1000 // 0x0132800 in size
|
||||
#define SEG_ENGINE 0x80213800 // 0x0017000 in size
|
||||
#define SEG_FRAMEBUFFERS 0x8022A800 // 0x0070800 in size
|
||||
#define SEG_POOL_START 0x8029B000 // 0x0165000 in size
|
||||
|
@ -132,7 +132,8 @@
|
||||
#define MARIO_UNKNOWN_30 0x40000000
|
||||
#define MARIO_UNKNOWN_31 0x80000000
|
||||
|
||||
#define MARIO_CAP_FLAGS 0x0000001F
|
||||
#define MARIO_SPECIAL_CAPS (MARIO_VANISH_CAP | MARIO_METAL_CAP | MARIO_WING_CAP)
|
||||
#define MARIO_CAPS (MARIO_NORMAL_CAP | MARIO_SPECIAL_CAPS)
|
||||
|
||||
#define ACT_ID_MASK 0x000001FF
|
||||
|
||||
@ -183,6 +184,7 @@
|
||||
#define ACT_COUGHING 0x0C40020A // (0x00A | ACT_FLAG_STATIONARY | ACT_FLAG_IDLE | ACT_FLAG_ALLOW_FIRST_PERSON | ACT_FLAG_PAUSE_EXIT)
|
||||
#define ACT_SHIVERING 0x0C40020B // (0x00B | ACT_FLAG_STATIONARY | ACT_FLAG_IDLE | ACT_FLAG_ALLOW_FIRST_PERSON | ACT_FLAG_PAUSE_EXIT)
|
||||
#define ACT_IN_QUICKSAND 0x0002020D // (0x00D | ACT_FLAG_STATIONARY | ACT_FLAG_INVULNERABLE)
|
||||
#define ACT_UNKNOWN_0002020E 0x0002020E // (0x00E | ACT_FLAG_STATIONARY | ACT_FLAG_INVULNERABLE)
|
||||
#define ACT_CROUCHING 0x0C008220 // (0x020 | ACT_FLAG_STATIONARY | ACT_FLAG_SHORT_HITBOX | ACT_FLAG_ALLOW_FIRST_PERSON | ACT_FLAG_PAUSE_EXIT)
|
||||
#define ACT_START_CROUCHING 0x0C008221 // (0x021 | ACT_FLAG_STATIONARY | ACT_FLAG_SHORT_HITBOX | ACT_FLAG_ALLOW_FIRST_PERSON | ACT_FLAG_PAUSE_EXIT)
|
||||
#define ACT_STOP_CROUCHING 0x0C008222 // (0x022 | ACT_FLAG_STATIONARY | ACT_FLAG_SHORT_HITBOX | ACT_FLAG_ALLOW_FIRST_PERSON | ACT_FLAG_PAUSE_EXIT)
|
||||
|
@ -86,11 +86,11 @@ struct VblankHandler
|
||||
|
||||
struct Animation {
|
||||
/*0x00*/ s16 flags;
|
||||
/*0x02*/ s16 unk02;
|
||||
/*0x04*/ s16 unk04;
|
||||
/*0x06*/ s16 unk06;
|
||||
/*0x08*/ s16 unk08;
|
||||
/*0x0A*/ s16 unk0A;
|
||||
/*0x02*/ s16 animYTransDivisor;
|
||||
/*0x04*/ s16 startFrame;
|
||||
/*0x06*/ s16 loopStart;
|
||||
/*0x08*/ s16 loopEnd;
|
||||
/*0x0A*/ s16 unusedBoneCount;
|
||||
/*0x0C*/ const s16 *values;
|
||||
/*0x10*/ const u16 *index;
|
||||
/*0x14*/ u32 length; // only used with Mario animations to determine how much to load. 0 otherwise.
|
||||
@ -108,8 +108,7 @@ struct GraphNode
|
||||
/*0x10*/ struct GraphNode *children;
|
||||
};
|
||||
|
||||
// struct AnimInfo?
|
||||
struct GraphNodeObject_sub
|
||||
struct AnimInfo
|
||||
{
|
||||
/*0x00 0x38*/ s16 animID;
|
||||
/*0x02 0x3A*/ s16 animYTrans;
|
||||
@ -124,12 +123,12 @@ struct GraphNodeObject
|
||||
{
|
||||
/*0x00*/ struct GraphNode node;
|
||||
/*0x14*/ struct GraphNode *sharedChild;
|
||||
/*0x18*/ s8 unk18;
|
||||
/*0x19*/ s8 unk19;
|
||||
/*0x18*/ s8 areaIndex;
|
||||
/*0x19*/ s8 activeAreaIndex;
|
||||
/*0x1A*/ Vec3s angle;
|
||||
/*0x20*/ Vec3f pos;
|
||||
/*0x2C*/ Vec3f scale;
|
||||
/*0x38*/ struct GraphNodeObject_sub unk38;
|
||||
/*0x38*/ struct AnimInfo animInfo;
|
||||
/*0x4C*/ struct SpawnInfo *unk4C;
|
||||
/*0x50*/ Mat4 *throwMatrix; // matrix ptr
|
||||
/*0x54*/ Vec3f cameraToObject;
|
||||
|
@ -12,15 +12,12 @@ void osViSetSpecialFeatures(u32 func) {
|
||||
D_80334914->features |= OS_VI_GAMMA_DITHER;
|
||||
}
|
||||
if (func & OS_VI_GAMMA_DITHER_OFF) {
|
||||
|
||||
D_80334914->features &= ~OS_VI_GAMMA_DITHER;
|
||||
}
|
||||
if (func & OS_VI_DIVOT_ON) {
|
||||
|
||||
D_80334914->features |= OS_VI_DIVOT;
|
||||
}
|
||||
if (func & OS_VI_DIVOT_OFF) {
|
||||
|
||||
D_80334914->features &= ~OS_VI_DIVOT;
|
||||
}
|
||||
if (func & OS_VI_DITHER_FILTER_ON) {
|
||||
|
6
sm64.ld
6
sm64.ld
@ -420,6 +420,12 @@ SECTIONS
|
||||
/* wildcard doesn't match on EU due to files being moved to engine/ */
|
||||
BUILD_DIR/src/game*.o(.data*);
|
||||
#endif
|
||||
BUILD_DIR/src/audio/synthesis.o(.data*);
|
||||
BUILD_DIR/src/audio/heap.o(.data*);
|
||||
BUILD_DIR/src/audio/load.o(.data*);
|
||||
BUILD_DIR/src/audio/playback.o(.data*);
|
||||
BUILD_DIR/src/audio/effects.o(.data*);
|
||||
BUILD_DIR/src/audio/seqplayer.o(.data*);
|
||||
BUILD_DIR/src/audio/external.o(.data*);
|
||||
BUILD_DIR/src/audio/port_eu.o(.data*);
|
||||
BUILD_DIR/src/audio/data.o(.data*);
|
||||
|
@ -333,11 +333,11 @@ s16 gEuUnknownWave7[256] = {
|
||||
0x0000, 0x8d2e, 0x4e20, 0xe14e, 0x0000, 0x1eb2, 0xb1e0, 0x72d2, 0x0000, 0x8d2e, 0x4e20, 0xe14e,
|
||||
0x0000, 0x1eb2, 0xb1e0, 0x72d2,
|
||||
};
|
||||
// u8 buffer_remove2[764] = { 0 };
|
||||
s16 *gWaveSamples[6] = { sSawtoothWaves, sTriangleWaves, sSineWaves, sSquareWaves, sEuUnknownWave6, gEuUnknownWave7 };
|
||||
#endif
|
||||
|
||||
#ifndef VERSION_EU
|
||||
#else
|
||||
// !VERSION_EU
|
||||
|
||||
s16 sSineWave[0x40] = {
|
||||
0, 3211, 6392, 9511, 12539, 15446, 18204, 20787, 23169, 25329, 27244,
|
||||
28897, 30272, 31356, 32137, 32609, 0x7FFF, 32609, 32137, 31356, 30272, 28897,
|
||||
@ -584,7 +584,7 @@ f32 gVolRampingRhs128[128] = {
|
||||
s16 gTatumsPerBeat = TATUMS_PER_BEAT;
|
||||
s8 gUnusedCount80333EE8 = UNUSED_COUNT_80333EE8;
|
||||
s32 gAudioHeapSize = DOUBLE_SIZE_ON_64_BIT(AUDIO_HEAP_SIZE);
|
||||
s32 D_80333EF0 = DOUBLE_SIZE_ON_64_BIT(D_80333EF0_VAL);
|
||||
s32 gAudioInitPoolSize = DOUBLE_SIZE_ON_64_BIT(AUDIO_INIT_POOL_SIZE);
|
||||
volatile s32 gAudioLoadLock = AUDIO_LOCK_UNINITIALIZED;
|
||||
|
||||
#ifdef VERSION_EU
|
||||
|
@ -62,8 +62,8 @@ extern f32 gVolRampingRhs128[128];
|
||||
// non-constant .data
|
||||
extern s16 gTatumsPerBeat;
|
||||
extern s8 gUnusedCount80333EE8;
|
||||
extern s32 gAudioHeapSize;
|
||||
extern s32 D_80333EF0; // amount of heap designated to gAudioInitPool, 0x2500
|
||||
extern s32 gAudioHeapSize; // AUDIO_HEAP_SIZE
|
||||
extern s32 gAudioInitPoolSize; // AUDIO_INIT_POOL_SIZE
|
||||
extern volatile s32 gAudioLoadLock;
|
||||
|
||||
// .bss
|
||||
@ -103,15 +103,14 @@ extern u16 gUnused80226E98[0x10];
|
||||
|
||||
extern u32 gAudioRandom;
|
||||
|
||||
//make my life easier
|
||||
#ifdef VERSION_EU
|
||||
#define UNUSED_COUNT_80333EE8 24
|
||||
#define AUDIO_HEAP_SIZE 0x2c500
|
||||
#define D_80333EF0_VAL 0x2c00
|
||||
#define AUDIO_INIT_POOL_SIZE 0x2c00
|
||||
#else
|
||||
#define UNUSED_COUNT_80333EE8 16
|
||||
#define AUDIO_HEAP_SIZE 0x31150
|
||||
#define D_80333EF0_VAL 0x2500
|
||||
#define AUDIO_INIT_POOL_SIZE 0x2500
|
||||
#endif
|
||||
|
||||
|
||||
|
@ -502,6 +502,7 @@ s32 adsr_update(struct AdsrState *adsr) {
|
||||
return 0.0f;
|
||||
}
|
||||
if (adsr->current > 1.0f) {
|
||||
eu_stubbed_printf_1("Audio:Envp: overflow %f\n", adsr->current);
|
||||
return 1.0f;
|
||||
}
|
||||
return adsr->current;
|
||||
|
@ -19,136 +19,6 @@
|
||||
#define EU_FLOAT(x) x
|
||||
#endif
|
||||
|
||||
#ifdef VERSION_EU
|
||||
u8 audioString1[] = "pitch %x: delaybytes %d : olddelay %d\n";
|
||||
u8 audioString2[] = "cont %x: delaybytes %d : olddelay %d\n";
|
||||
u8 audioString3[] = "Warning:Kill Note %x \n";
|
||||
u8 audioString4[] = "Kill Voice %d (ID %d) %d\n";
|
||||
u8 audioString5[] = "Warning: Running Sequence's data disappear!\n";
|
||||
u8 audioString6[] = "Heap OverFlow : Not Allocate %d!\n";
|
||||
u8 audioString7[] = "DataHeap Not Allocate \n";
|
||||
u8 audioString8[] = "StayHeap Not Allocate %d\n";
|
||||
u8 audioString9[] = "AutoHeap Not Allocate %d\n";
|
||||
u8 audioString10[] = "WARNING: NO FREE AUTOSEQ AREA.\n";
|
||||
u8 audioString11[] = "WARNING: NO STOP AUTO AREA.\n";
|
||||
u8 audioString12[] = " AND TRY FORCE TO STOP SIDE \n";
|
||||
u8 audioString13[] = "TWO SIDES ARE LOADING... ALLOC CANCELED.\n";
|
||||
u8 audioString14[] = "WARNING: Before Area Overlaid After.";
|
||||
u8 audioString15[] = "WARNING: After Area Overlaid Before.";
|
||||
u8 audioString16[] = "MEMORY:SzHeapAlloc ERROR: sza->side %d\n";
|
||||
u8 audioString17[] = "MEMORY:StayHeap OVERFLOW.";
|
||||
u8 audioString18[] = "MEMORY:StayHeap OVERFLOW (REQ:%d)";
|
||||
u8 audioString19[] = "Auto Heap Unhit for ID %d\n";
|
||||
u8 audioString20[] = "Cache hit %d at stay %d\n";
|
||||
u8 audioString20_[] = "%d ";
|
||||
u8 audioString20__[] = "\n";
|
||||
u8 audioString20___[] = "%d ";
|
||||
u8 audioString20____[] = "\n";
|
||||
u8 audioString21[] = "Heap Reconstruct Start %x\n";
|
||||
u8 audioString22[] = "SFrame Sample %d %d %d\n";
|
||||
u8 audioString23[] = "AHPBASE %x\n";
|
||||
u8 audioString24[] = "AHPCUR %x\n";
|
||||
u8 audioString25[] = "HeapTop %x\n";
|
||||
u8 audioString26[] = "SynoutRate %d / %d \n";
|
||||
u8 audioString27[] = "FXSIZE %d\n";
|
||||
u8 audioString28[] = "FXCOMP %d\n";
|
||||
u8 audioString29[] = "FXDOWN %d\n";
|
||||
u8 audioString30[] = "WaveCacheLen: %d\n";
|
||||
u8 audioString31[] = "SpecChange Finished\n";
|
||||
u8 audioString31_[] = "";
|
||||
u8 audioString32[] = "Romcopy %x -> %x ,size %x\n";
|
||||
u8 audioString33[] = "Romcopyend\n";
|
||||
u8 audioString34[] = "CAUTION:WAVE CACHE FULL %d";
|
||||
u8 audioString35[] = "BASE %x %x\n";
|
||||
u8 audioString36[] = "LOAD %x %x %x\n";
|
||||
u8 audioString37[] = "INSTTOP %x\n";
|
||||
u8 audioString38[] = "INSTMAP[0] %x\n";
|
||||
u8 audioString39[] = "already flags %d\n";
|
||||
u8 audioString40[] = "already flags %d\n";
|
||||
u8 audioString41[] = "ERR:SLOW BANK DMA BUSY\n";
|
||||
u8 audioString42[] = "ERR:SLOW DMA BUSY\n";
|
||||
u8 audioString43[] = "Check %d bank %d\n";
|
||||
u8 audioString44[] = "Cache Check\n";
|
||||
u8 audioString45[] = "NO BANK ERROR\n";
|
||||
u8 audioString46[] = "BANK %d LOADING START\n";
|
||||
u8 audioString47[] = "BANK %d LOAD MISS (NO MEMORY)!\n";
|
||||
u8 audioString48[] = "BANK %d ALREADY CACHED\n";
|
||||
u8 audioString49[] = "BANK LOAD MISS! FOR %d\n";
|
||||
u8 audioString50[] = "Seq %d Loading Start\n";
|
||||
u8 audioString51[] = "Heap Overflow Error\n";
|
||||
u8 audioString52[] = "SEQ %d ALREADY CACHED\n";
|
||||
u8 audioString53[] = "Ok,one bank slow load Start \n";
|
||||
u8 audioString54[] = "Sorry,too many %d bank is none.fast load Start \n";
|
||||
u8 audioString55[] = "Seq %d:Default Load Id is %d\n";
|
||||
u8 audioString56[] = "Seq Loading Start\n";
|
||||
u8 audioString57[] = "Error:Before Sequence-SlowDma remain.\n";
|
||||
u8 audioString58[] = " Cancel Seq Start.\n";
|
||||
u8 audioString59[] = "SEQ %d ALREADY CACHED\n";
|
||||
u8 audioString60[] = "Clear Workarea %x -%x size %x \n";
|
||||
u8 audioString61[] = "AudioHeap is %x\n";
|
||||
u8 audioString62[] = "Heap reset.Synth Change %x \n";
|
||||
u8 audioString63[] = "Heap %x %x %x\n";
|
||||
u8 audioString64[] = "Main Heap Initialize.\n";
|
||||
u8 audioString65[] = "---------- Init Completed. ------------\n";
|
||||
u8 audioString66[] = " Syndrv :[%6d]\n";
|
||||
u8 audioString67[] = " Seqdrv :[%6d]\n";
|
||||
u8 audioString68[] = " audiodata :[%6d]\n";
|
||||
u8 audioString69[] = "---------------------------------------\n";
|
||||
u8 audioString69_[] = "";
|
||||
u8 audioString70[] = "Audio: setvol: volume minus %f\n";
|
||||
u8 audioString71[] = "Audio: setvol: volume overflow %f\n";
|
||||
u8 audioString72[] = "Audio: setpitch: pitch minus %f\n";
|
||||
u8 audioString73[] = "Audio: voiceman: No bank error %d\n";
|
||||
u8 audioString74[] = "Audio: voiceman: progNo. overflow %d,%d\n";
|
||||
u8 audioString75[] = "Audio: voiceman: progNo. undefined %d,%d\n";
|
||||
u8 audioString76[] = "Audio: voiceman: BAD Voicepointer %x,%d,%d\n";
|
||||
u8 audioString77[] = "Audio: voiceman: Percussion Overflow %d,%d\n";
|
||||
u8 audioString78[] = "Percussion Pointer Error\n";
|
||||
u8 audioString79[] = "Audio: voiceman: Percpointer NULL %d,%d\n";
|
||||
u8 audioString80[] = "CAUTION:SUB IS SEPARATED FROM GROUP";
|
||||
u8 audioString81[] = "Error:Wait Track disappear\n";
|
||||
u8 audioString82[] = "Slow Release Batting\n";
|
||||
u8 audioString83[] = "Audio:Wavemem: Bad voiceno (%d)\n";
|
||||
u8 audioString84[] = "Audio: C-Alloc : Dealloc voice is NULL\n";
|
||||
u8 audioString85[] = "Alloc Error:Dim voice-Alloc %d";
|
||||
u8 audioString86[] = "Error:Same List Add\n";
|
||||
u8 audioString87[] = "Already Cut\n";
|
||||
u8 audioString88[] = "Audio: C-Alloc : lowerPrio is NULL\n";
|
||||
u8 audioString89[] = "Sub Limited Warning: Drop Voice";
|
||||
u8 audioString90[] = "Warning: Drop Voice";
|
||||
u8 audioString91[] = "Warning: Drop Voice";
|
||||
u8 audioString92[] = "Warning: Drop Voice";
|
||||
u8 audioString93[] = "Audio:Envp: overflow %f\n";
|
||||
u8 audioString93_[] = "";
|
||||
u8 audioString94[] = "Audio:Track:Warning: No Free Notetrack\n";
|
||||
u8 audioString95[] = "SUBTRACK DIM\n";
|
||||
u8 audioString96[] = "Audio:Track: Warning SUBTRACK PARENT CHANGED\n";
|
||||
u8 audioString97[] = "GROUP 0:";
|
||||
u8 audioString98[] = "GROUP 1:";
|
||||
u8 audioString99[] = "SEQID %d,BANKID %d\n";
|
||||
u8 audioString100[] = "ERR:SUBTRACK %d NOT ALLOCATED\n";
|
||||
u8 audioString101[] = "Error:Same List Add\n";
|
||||
u8 audioString102[] = "Macro Level Over Error!\n";
|
||||
u8 audioString103[] = "Macro Level Over Error!\n";
|
||||
u8 audioString104[] = "WARNING: NPRG: cannot change %d\n";
|
||||
u8 audioString105[] = "Audio:Track:NOTE:UNDEFINED NOTE COM. %x\n";
|
||||
u8 audioString106[] = "Audio: Note:Velocity Error %d\n";
|
||||
u8 audioString107[] = "Error: Your assignchannel is stolen.\n";
|
||||
u8 audioString108[] = "Audio:Track :Call Macro Level Over Error!\n";
|
||||
u8 audioString109[] = "Audio:Track :Loops Macro Level Over Error!\n";
|
||||
u8 audioString110[] = "SUB:ERR:BANK %d NOT CACHED.\n";
|
||||
u8 audioString111[] = "SUB:ERR:BANK %d NOT CACHED.\n";
|
||||
u8 audioString112[] = "Audio:Track: CTBLCALL Macro Level Over Error!\n";
|
||||
u8 audioString113[] = "Err :Sub %x ,address %x:Undefined SubTrack Function %x";
|
||||
u8 audioString114[] = "Disappear Sequence or Bank %d\n";
|
||||
u8 audioString115[] = "Macro Level Over Error!\n";
|
||||
u8 audioString116[] = "Macro Level Over Error!\n";
|
||||
u8 audioString117[] = "Group:Undefine upper C0h command (%x)\n";
|
||||
u8 audioString118[] = "Group:Undefined Command\n";
|
||||
u8 audioString118_[] = "";
|
||||
u8 audioString118__[] = "";
|
||||
#endif
|
||||
|
||||
// N.B. sound banks are different from the audio banks referred to in other
|
||||
// files. We should really fix our naming to be less ambiguous...
|
||||
#define MAX_BG_MUSIC_QUEUE_SIZE 6
|
||||
@ -160,15 +30,6 @@ u8 audioString118__[] = "";
|
||||
#define SAMPLES_TO_OVERPRODUCE 0x10
|
||||
#define EXTRA_BUFFERED_AI_SAMPLES_TARGET 0x40
|
||||
|
||||
// No-op printf macro which leaves string literals in rodata in IDO. (IDO
|
||||
// doesn't support variadic macros, so instead they let the parameter list
|
||||
// expand to a no-op comma expression.) See also goddard/gd_main.h.
|
||||
#ifdef __sgi
|
||||
#define stubbed_printf
|
||||
#else
|
||||
#define stubbed_printf(...)
|
||||
#endif
|
||||
|
||||
struct Sound {
|
||||
s32 soundBits;
|
||||
f32 *position;
|
||||
|
@ -21,6 +21,9 @@
|
||||
extern s32 gAudioErrorFlags;
|
||||
extern f32 gDefaultSoundArgs[3];
|
||||
|
||||
// defined in data.c, used by the game
|
||||
extern u32 gAudioRandom;
|
||||
|
||||
extern u8 gAudioSPTaskYieldBuffer[]; // ucode yield data ptr; only used in JP
|
||||
|
||||
struct SPTask *create_next_audio_frame_task(void);
|
||||
|
@ -167,11 +167,17 @@ void discard_bank(s32 bankId) {
|
||||
struct Note *note = &gNotes[i];
|
||||
|
||||
#ifdef VERSION_EU
|
||||
if (note->noteSubEu.bankId == bankId) {
|
||||
if (note->noteSubEu.bankId == bankId)
|
||||
#else
|
||||
if (note->bankId == bankId) {
|
||||
if (note->bankId == bankId)
|
||||
#endif
|
||||
{
|
||||
// (These prints are unclear. Arguments are picked semi-randomly.)
|
||||
eu_stubbed_printf_1("Warning:Kill Note %x \n", i);
|
||||
if (note->priority >= NOTE_PRIORITY_MIN) {
|
||||
eu_stubbed_printf_3("Kill Voice %d (ID %d) %d\n", note->waveId,
|
||||
bankId, note->priority);
|
||||
eu_stubbed_printf_0("Warning: Running Sequence's data disappear!\n");
|
||||
note->parentLayer->enabled = FALSE;
|
||||
note->parentLayer->finished = TRUE;
|
||||
}
|
||||
@ -209,6 +215,7 @@ void *soundAlloc(struct SoundAllocPool *pool, u32 size) {
|
||||
*pos = 0;
|
||||
}
|
||||
} else {
|
||||
eu_stubbed_printf_1("Heap OverFlow : Not Allocate %d!\n", size);
|
||||
return NULL;
|
||||
}
|
||||
return start;
|
||||
@ -309,7 +316,7 @@ static void unused_803163D4(void) {
|
||||
void *alloc_bank_or_seq(struct SoundMultiPool *arg0, s32 arg1, s32 size, s32 arg3, s32 id) {
|
||||
// arg3 = 0, 1 or 2?
|
||||
|
||||
struct TemporaryPool *tp; // sp30
|
||||
struct TemporaryPool *tp;
|
||||
struct PersistentPool *persistent = &arg0->persistent;
|
||||
struct SoundAllocPool *pool;
|
||||
void *ret;
|
||||
@ -342,17 +349,17 @@ void *alloc_bank_or_seq(struct SoundMultiPool *arg0, s32 arg1, s32 size, s32 arg
|
||||
isSound = TRUE;
|
||||
}
|
||||
|
||||
firstVal = (tp->entries[0].id == (s8)nullID ? SOUND_LOAD_STATUS_NOT_LOADED : table[tp->entries[0].id]); // a3, a2
|
||||
secondVal = (tp->entries[1].id == (s8)nullID ? SOUND_LOAD_STATUS_NOT_LOADED : table[tp->entries[1].id]); // a1
|
||||
firstVal = (tp->entries[0].id == (s8)nullID ? SOUND_LOAD_STATUS_NOT_LOADED : table[tp->entries[0].id]);
|
||||
secondVal = (tp->entries[1].id == (s8)nullID ? SOUND_LOAD_STATUS_NOT_LOADED : table[tp->entries[1].id]);
|
||||
|
||||
#ifndef VERSION_EU
|
||||
leftNotLoaded = (firstVal == SOUND_LOAD_STATUS_NOT_LOADED);
|
||||
leftDiscardable = (firstVal == SOUND_LOAD_STATUS_DISCARDABLE); // t0
|
||||
leftDiscardable = (firstVal == SOUND_LOAD_STATUS_DISCARDABLE);
|
||||
leftAvail = (firstVal != SOUND_LOAD_STATUS_IN_PROGRESS);
|
||||
rightNotLoaded = (secondVal == SOUND_LOAD_STATUS_NOT_LOADED);
|
||||
rightDiscardable = (secondVal == SOUND_LOAD_STATUS_DISCARDABLE);
|
||||
rightAvail = (secondVal != SOUND_LOAD_STATUS_IN_PROGRESS);
|
||||
bothDiscardable = (leftDiscardable && rightDiscardable); // a0
|
||||
bothDiscardable = (leftDiscardable && rightDiscardable);
|
||||
|
||||
if (leftNotLoaded) {
|
||||
tp->nextSide = 0;
|
||||
@ -360,7 +367,7 @@ void *alloc_bank_or_seq(struct SoundMultiPool *arg0, s32 arg1, s32 size, s32 arg
|
||||
tp->nextSide = 1;
|
||||
} else if (bothDiscardable) {
|
||||
// Use the opposite side from last time.
|
||||
} else if (firstVal == SOUND_LOAD_STATUS_DISCARDABLE) { //??!
|
||||
} else if (firstVal == SOUND_LOAD_STATUS_DISCARDABLE) { // ??! (I blame copt)
|
||||
tp->nextSide = 0;
|
||||
} else if (rightDiscardable) {
|
||||
tp->nextSide = 1;
|
||||
@ -373,27 +380,42 @@ void *alloc_bank_or_seq(struct SoundMultiPool *arg0, s32 arg1, s32 size, s32 arg
|
||||
return NULL;
|
||||
}
|
||||
#else
|
||||
if (0) {
|
||||
// It's unclear where these string literals go.
|
||||
eu_stubbed_printf_0("DataHeap Not Allocate \n");
|
||||
eu_stubbed_printf_1("StayHeap Not Allocate %d\n", 0);
|
||||
eu_stubbed_printf_1("AutoHeap Not Allocate %d\n", 0);
|
||||
}
|
||||
|
||||
if (firstVal == SOUND_LOAD_STATUS_NOT_LOADED) {
|
||||
tp->nextSide = 0;
|
||||
} else if (secondVal == SOUND_LOAD_STATUS_NOT_LOADED) {
|
||||
tp->nextSide = 1;
|
||||
} else if ((firstVal == SOUND_LOAD_STATUS_DISCARDABLE) && (secondVal == SOUND_LOAD_STATUS_DISCARDABLE)) {
|
||||
} else {
|
||||
eu_stubbed_printf_0("WARNING: NO FREE AUTOSEQ AREA.\n");
|
||||
if ((firstVal == SOUND_LOAD_STATUS_DISCARDABLE) && (secondVal == SOUND_LOAD_STATUS_DISCARDABLE)) {
|
||||
// Use the opposite side from last time.
|
||||
} else if (firstVal == SOUND_LOAD_STATUS_DISCARDABLE) {
|
||||
tp->nextSide = 0;
|
||||
} else if (secondVal == SOUND_LOAD_STATUS_DISCARDABLE) {
|
||||
tp->nextSide = 1;
|
||||
} else if (firstVal != SOUND_LOAD_STATUS_IN_PROGRESS) {
|
||||
} else {
|
||||
eu_stubbed_printf_0("WARNING: NO STOP AUTO AREA.\n");
|
||||
eu_stubbed_printf_0(" AND TRY FORCE TO STOP SIDE \n");
|
||||
if (firstVal != SOUND_LOAD_STATUS_IN_PROGRESS) {
|
||||
tp->nextSide = 0;
|
||||
} else if (secondVal != SOUND_LOAD_STATUS_IN_PROGRESS) {
|
||||
tp->nextSide = 1;
|
||||
} else {
|
||||
// Both left and right sides are being loaded into.
|
||||
eu_stubbed_printf_0("TWO SIDES ARE LOADING... ALLOC CANCELED.\n");
|
||||
return NULL;
|
||||
}
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
||||
pool = &arg0->temporary.pool; // a1
|
||||
pool = &arg0->temporary.pool;
|
||||
if (tp->entries[tp->nextSide].id != (s8)nullID) {
|
||||
table[tp->entries[tp->nextSide].id] = SOUND_LOAD_STATUS_NOT_LOADED;
|
||||
if (isSound == TRUE) {
|
||||
@ -410,6 +432,8 @@ void *alloc_bank_or_seq(struct SoundMultiPool *arg0, s32 arg1, s32 size, s32 arg
|
||||
pool->cur = pool->start + size;
|
||||
|
||||
if (tp->entries[1].ptr < pool->cur) {
|
||||
eu_stubbed_printf_0("WARNING: Before Area Overlaid After.");
|
||||
|
||||
// Throw out the entry on the other side if it doesn't fit.
|
||||
// (possible @bug: what if it's currently being loaded?)
|
||||
table[tp->entries[1].id] = SOUND_LOAD_STATUS_NOT_LOADED;
|
||||
@ -444,6 +468,8 @@ void *alloc_bank_or_seq(struct SoundMultiPool *arg0, s32 arg1, s32 size, s32 arg
|
||||
tp->entries[1].size = size;
|
||||
|
||||
if (tp->entries[1].ptr < pool->cur) {
|
||||
eu_stubbed_printf_0("WARNING: After Area Overlaid Before.");
|
||||
|
||||
table[tp->entries[0].id] = SOUND_LOAD_STATUS_NOT_LOADED;
|
||||
|
||||
switch (isSound) {
|
||||
@ -463,6 +489,7 @@ void *alloc_bank_or_seq(struct SoundMultiPool *arg0, s32 arg1, s32 size, s32 arg
|
||||
break;
|
||||
|
||||
default:
|
||||
eu_stubbed_printf_1("MEMORY:SzHeapAlloc ERROR: sza->side %d\n", tp->nextSide);
|
||||
return NULL;
|
||||
}
|
||||
|
||||
@ -486,6 +513,7 @@ void *alloc_bank_or_seq(struct SoundMultiPool *arg0, s32 arg1, s32 size, s32 arg
|
||||
{
|
||||
switch (arg3) {
|
||||
case 2:
|
||||
eu_stubbed_printf_0("MEMORY:StayHeap OVERFLOW.");
|
||||
#ifdef VERSION_EU
|
||||
return alloc_bank_or_seq(arg0, arg1, size, 0, id);
|
||||
#else
|
||||
@ -494,6 +522,7 @@ void *alloc_bank_or_seq(struct SoundMultiPool *arg0, s32 arg1, s32 size, s32 arg
|
||||
return ret;
|
||||
#endif
|
||||
case 1:
|
||||
eu_stubbed_printf_1("MEMORY:StayHeap OVERFLOW (REQ:%d)", arg1 * size);
|
||||
return NULL;
|
||||
}
|
||||
}
|
||||
@ -523,11 +552,13 @@ void *get_bank_or_seq(struct SoundMultiPool *arg0, s32 arg1, s32 id) {
|
||||
temporary->nextSide = 0;
|
||||
return temporary->entries[1].ptr;
|
||||
}
|
||||
eu_stubbed_printf_1("Auto Heap Unhit for ID %d\n", id);
|
||||
return NULL;
|
||||
} else {
|
||||
struct PersistentPool *persistent = &arg0->persistent;
|
||||
for (i = 0; i < persistent->numEntries; i++) {
|
||||
if (id == persistent->entries[i].id) {
|
||||
eu_stubbed_printf_2("Cache hit %d at stay %d\n", id, i);
|
||||
return persistent->entries[i].ptr;
|
||||
}
|
||||
}
|
||||
@ -537,7 +568,7 @@ void *get_bank_or_seq(struct SoundMultiPool *arg0, s32 arg1, s32 id) {
|
||||
return get_bank_or_seq(arg0, 0, id);
|
||||
#else
|
||||
// Prevent tail call optimization by using a temporary.
|
||||
// (Did they compile with -Wo,-notail?)
|
||||
// Either copt or -Wo,-notail.
|
||||
ret = get_bank_or_seq(arg0, 0, id);
|
||||
return ret;
|
||||
#endif
|
||||
@ -567,25 +598,27 @@ void func_eu_802e27e4_unused(f32 arg0, f32 arg1, u16 *arg2) {
|
||||
}
|
||||
|
||||
for (i = 0; i < 8; i++) {
|
||||
eu_stubbed_printf_1("%d ", arg2[i]);
|
||||
}
|
||||
eu_stubbed_printf_0("\n");
|
||||
|
||||
for (i = 8; i < 16; i += 4) {
|
||||
for (i = 8; i < 16; i++) {
|
||||
eu_stubbed_printf_1("%d ", arg2[i]);
|
||||
}
|
||||
eu_stubbed_printf_0("\n");
|
||||
}
|
||||
#endif
|
||||
|
||||
#ifdef VERSION_EU
|
||||
void decrease_reverb_gain(void) {
|
||||
#ifdef VERSION_EU
|
||||
s32 i;
|
||||
for (i = 0; i < gNumSynthesisReverbs; i++) {
|
||||
gSynthesisReverbs[i].reverbGain -= gSynthesisReverbs[i].reverbGain / 8;
|
||||
}
|
||||
}
|
||||
#else
|
||||
void decrease_reverb_gain(void) {
|
||||
gSynthesisReverb.reverbGain -= gSynthesisReverb.reverbGain / 4;
|
||||
}
|
||||
#endif
|
||||
}
|
||||
|
||||
#ifdef VERSION_EU
|
||||
s32 audio_shut_down_and_reset_step(void) {
|
||||
@ -679,10 +712,10 @@ void audio_reset_session(void) {
|
||||
#ifndef VERSION_EU
|
||||
s32 frames;
|
||||
s32 remainingDmas;
|
||||
#endif
|
||||
#ifdef VERSION_EU
|
||||
#else
|
||||
struct SynthesisReverb *reverb;
|
||||
#endif
|
||||
eu_stubbed_printf_1("Heap Reconstruct Start %x\n", gAudioResetPresetIdToLoad);
|
||||
|
||||
#ifndef VERSION_EU
|
||||
if (gAudioLoadLock != AUDIO_LOCK_UNINITIALIZED) {
|
||||
@ -936,3 +969,16 @@ void audio_reset_session(void) {
|
||||
}
|
||||
#endif
|
||||
}
|
||||
|
||||
#ifdef VERSION_EU
|
||||
u8 audioString22[] = "SFrame Sample %d %d %d\n";
|
||||
u8 audioString23[] = "AHPBASE %x\n";
|
||||
u8 audioString24[] = "AHPCUR %x\n";
|
||||
u8 audioString25[] = "HeapTop %x\n";
|
||||
u8 audioString26[] = "SynoutRate %d / %d \n";
|
||||
u8 audioString27[] = "FXSIZE %d\n";
|
||||
u8 audioString28[] = "FXCOMP %d\n";
|
||||
u8 audioString29[] = "FXDOWN %d\n";
|
||||
u8 audioString30[] = "WaveCacheLen: %d\n";
|
||||
u8 audioString31[] = "SpecChange Finished\n";
|
||||
#endif
|
||||
|
@ -63,6 +63,29 @@
|
||||
#define FLOAT_CAST(x) (f32) (s32) (x)
|
||||
#endif
|
||||
|
||||
// No-op printf macro which leaves string literals in rodata in IDO. IDO
|
||||
// doesn't support variadic macros, so instead we let the parameter list
|
||||
// expand to a no-op comma expression. Another possibility is that it might
|
||||
// have expanded to something with "if (0)". See also goddard/gd_main.h.
|
||||
// On US/JP, -sopt optimizes away these except for external.c.
|
||||
#ifdef __sgi
|
||||
#define stubbed_printf
|
||||
#else
|
||||
#define stubbed_printf(...)
|
||||
#endif
|
||||
|
||||
#ifdef VERSION_EU
|
||||
#define eu_stubbed_printf_0(msg) stubbed_printf(msg)
|
||||
#define eu_stubbed_printf_1(msg, a) stubbed_printf(msg, a)
|
||||
#define eu_stubbed_printf_2(msg, a, b) stubbed_printf(msg, a, b)
|
||||
#define eu_stubbed_printf_3(msg, a, b, c) stubbed_printf(msg, a, b, c)
|
||||
#else
|
||||
#define eu_stubbed_printf_0(msg)
|
||||
#define eu_stubbed_printf_1(msg, a)
|
||||
#define eu_stubbed_printf_2(msg, a, b)
|
||||
#define eu_stubbed_printf_3(msg, a, b, c)
|
||||
#endif
|
||||
|
||||
struct NotePool;
|
||||
|
||||
struct AudioListItem
|
||||
@ -202,6 +225,7 @@ struct M64ScriptState {
|
||||
u8 depth;
|
||||
}; // size = 0x1C
|
||||
|
||||
// Also known as a Group, according to debug strings.
|
||||
struct SequencePlayer
|
||||
{
|
||||
/*US/JP, EU */
|
||||
@ -326,6 +350,8 @@ struct NoteAttributes
|
||||
#endif
|
||||
}; // size = 0x10
|
||||
|
||||
// Also known as a SubTrack, according to debug strings.
|
||||
// Confusingly, a SubTrack is a container of Tracks.
|
||||
struct SequenceChannel
|
||||
{
|
||||
/* U/J, EU */
|
||||
@ -394,7 +420,8 @@ struct SequenceChannel
|
||||
/*0x80, 0x84*/ struct NotePool notePool;
|
||||
}; // size = 0xC0, 0xC4 in EU
|
||||
|
||||
struct SequenceChannelLayer // Maybe SequenceTrack?
|
||||
// Also known as a Track, according to debug strings.
|
||||
struct SequenceChannelLayer
|
||||
{
|
||||
/* U/J, EU */
|
||||
/*0x00, 0x00*/ u8 enabled : 1;
|
||||
@ -507,6 +534,11 @@ struct Note
|
||||
/* U/J, EU */
|
||||
/*0xA4, 0x00*/ struct AudioListItem listItem;
|
||||
/* 0x10*/ struct NoteSynthesisState synthesisState;
|
||||
// The next members are actually part of a struct (NotePlaybackState), but
|
||||
// that results in messy US/EU ifdefs. Instead we cast to a struct pointer
|
||||
// when needed... This breaks alignment on non-N64 platforms, which we hack
|
||||
// around by skipping the padding in that case.
|
||||
// TODO: use macros or something instead.
|
||||
#ifdef TARGET_N64
|
||||
u8 pad0[12];
|
||||
#endif
|
||||
@ -527,6 +559,7 @@ struct Note
|
||||
/* , 0xB0*/ struct NoteSubEu noteSubEu;
|
||||
}; // size = 0xC0
|
||||
#else
|
||||
// volatile Note, needed in synthesis_process_notes
|
||||
struct vNote
|
||||
{
|
||||
/* U/J, EU */
|
||||
|
@ -107,12 +107,33 @@ extern u8 gBankSetsData[]; // bank_sets.s
|
||||
* Performs an immediate DMA copy
|
||||
*/
|
||||
void audio_dma_copy_immediate(uintptr_t devAddr, void *vAddr, size_t nbytes) {
|
||||
eu_stubbed_printf_3("Romcopy %x -> %x ,size %x\n", devAddr, vAddr, nbytes);
|
||||
osInvalDCache(vAddr, nbytes);
|
||||
osPiStartDma(&gAudioDmaIoMesg, OS_MESG_PRI_HIGH, OS_READ, devAddr, vAddr, nbytes,
|
||||
&gAudioDmaMesgQueue);
|
||||
osRecvMesg(&gAudioDmaMesgQueue, NULL, OS_MESG_BLOCK);
|
||||
eu_stubbed_printf_0("Romcopyend\n");
|
||||
}
|
||||
|
||||
#ifdef VERSION_EU
|
||||
u8 audioString34[] = "CAUTION:WAVE CACHE FULL %d";
|
||||
u8 audioString35[] = "BASE %x %x\n";
|
||||
u8 audioString36[] = "LOAD %x %x %x\n";
|
||||
u8 audioString37[] = "INSTTOP %x\n";
|
||||
u8 audioString38[] = "INSTMAP[0] %x\n";
|
||||
u8 audioString39[] = "already flags %d\n";
|
||||
u8 audioString40[] = "already flags %d\n";
|
||||
u8 audioString41[] = "ERR:SLOW BANK DMA BUSY\n";
|
||||
u8 audioString42[] = "ERR:SLOW DMA BUSY\n";
|
||||
u8 audioString43[] = "Check %d bank %d\n";
|
||||
u8 audioString44[] = "Cache Check\n";
|
||||
u8 audioString45[] = "NO BANK ERROR\n";
|
||||
u8 audioString46[] = "BANK %d LOADING START\n";
|
||||
u8 audioString47[] = "BANK %d LOAD MISS (NO MEMORY)!\n";
|
||||
u8 audioString48[] = "BANK %d ALREADY CACHED\n";
|
||||
u8 audioString49[] = "BANK LOAD MISS! FOR %d\n";
|
||||
#endif
|
||||
|
||||
/**
|
||||
* Performs an asynchronus (normal priority) DMA copy
|
||||
*/
|
||||
@ -666,11 +687,13 @@ void *sequence_dma_async(s32 seqId, s32 arg1, struct SequencePlayer *seqPlayer)
|
||||
u8 *seqData;
|
||||
OSMesgQueue *mesgQueue;
|
||||
|
||||
eu_stubbed_printf_1("Seq %d Loading Start\n", seqId);
|
||||
seqLength = gSeqFileHeader->seqArray[seqId].len + 0xf;
|
||||
seqLength = ALIGN16(seqLength);
|
||||
seqData = gSeqFileHeader->seqArray[seqId].offset;
|
||||
ptr = alloc_bank_or_seq(&gSeqLoadedPool, 1, seqLength, arg1, seqId);
|
||||
if (ptr == NULL) {
|
||||
eu_stubbed_printf_0("Heap Overflow Error\n");
|
||||
return NULL;
|
||||
}
|
||||
|
||||
@ -678,8 +701,8 @@ void *sequence_dma_async(s32 seqId, s32 arg1, struct SequencePlayer *seqPlayer)
|
||||
// Immediately load short sequenece
|
||||
audio_dma_copy_immediate((uintptr_t) seqData, ptr, seqLength);
|
||||
if (1) {
|
||||
gSeqLoadStatus[seqId] = SOUND_LOAD_STATUS_COMPLETE;
|
||||
}
|
||||
gSeqLoadStatus[seqId] = SOUND_LOAD_STATUS_COMPLETE;
|
||||
} else {
|
||||
audio_dma_copy_immediate((uintptr_t) seqData, ptr, 0x40);
|
||||
mesgQueue = &seqPlayer->seqDmaMesgQueue;
|
||||
@ -742,12 +765,12 @@ struct AudioBank *load_banks_immediate(s32 seqId, u8 *arg1) {
|
||||
u16 offset;
|
||||
u8 i;
|
||||
|
||||
#ifdef VERSION_EU
|
||||
offset = ((u16 *) gAlBankSets)[seqId];
|
||||
#ifdef VERSION_EU
|
||||
for (i = gAlBankSets[offset++]; i != 0; i--) {
|
||||
bankId = gAlBankSets[offset++];
|
||||
#else
|
||||
offset = ((u16 *) gAlBankSets)[seqId] + 1;
|
||||
offset++;
|
||||
for (i = gAlBankSets[offset - 1]; i != 0; i--) {
|
||||
offset++;
|
||||
bankId = gAlBankSets[offset - 1];
|
||||
@ -787,6 +810,7 @@ void preload_sequence(u32 seqId, u8 preloadMask) {
|
||||
if (preloadMask & PRELOAD_SEQUENCE) {
|
||||
// @bug should be IS_SEQ_LOAD_COMPLETE
|
||||
if (IS_BANK_LOAD_COMPLETE(seqId) == TRUE) {
|
||||
eu_stubbed_printf_1("SEQ %d ALREADY CACHED\n", seqId);
|
||||
sequenceData = get_bank_or_seq(&gSeqLoadedPool, 2, seqId);
|
||||
} else {
|
||||
sequenceData = NULL;
|
||||
@ -828,6 +852,7 @@ void load_sequence_internal(u32 player, u32 seqId, s32 loadAsync) {
|
||||
s32 dummy = 0;
|
||||
s32 bankId = get_missing_bank(seqId, &dummy, &numMissingBanks);
|
||||
if (numMissingBanks == 1) {
|
||||
eu_stubbed_printf_0("Ok,one bank slow load Start \n");
|
||||
if (bank_load_async(bankId, 2, seqPlayer) == NULL) {
|
||||
return;
|
||||
}
|
||||
@ -835,17 +860,25 @@ void load_sequence_internal(u32 player, u32 seqId, s32 loadAsync) {
|
||||
// as default, not the missing one. This code path never gets
|
||||
// taken, though -- all sequence loading is synchronous.
|
||||
seqPlayer->defaultBank[0] = bankId;
|
||||
} else if (load_banks_immediate(seqId, &seqPlayer->defaultBank[0]) == NULL) {
|
||||
} else {
|
||||
eu_stubbed_printf_1("Sorry,too many %d bank is none.fast load Start \n", numMissingBanks);
|
||||
if (load_banks_immediate(seqId, &seqPlayer->defaultBank[0]) == NULL) {
|
||||
return;
|
||||
}
|
||||
}
|
||||
} else if (load_banks_immediate(seqId, &seqPlayer->defaultBank[0]) == NULL) {
|
||||
return;
|
||||
}
|
||||
|
||||
eu_stubbed_printf_2("Seq %d:Default Load Id is %d\n", seqId, seqPlayer->defaultBank[0]);
|
||||
eu_stubbed_printf_0("Seq Loading Start\n");
|
||||
|
||||
seqPlayer->seqId = seqId;
|
||||
sequenceData = get_bank_or_seq(&gSeqLoadedPool, 2, seqId);
|
||||
if (sequenceData == NULL) {
|
||||
if (seqPlayer->seqDmaInProgress) {
|
||||
eu_stubbed_printf_0("Error:Before Sequence-SlowDma remain.\n");
|
||||
eu_stubbed_printf_0(" Cancel Seq Start.\n");
|
||||
return;
|
||||
}
|
||||
|
||||
@ -860,6 +893,7 @@ void load_sequence_internal(u32 player, u32 seqId, s32 loadAsync) {
|
||||
}
|
||||
}
|
||||
|
||||
eu_stubbed_printf_1("SEQ %d ALREADY CACHED\n", seqId);
|
||||
init_sequence_player(player);
|
||||
seqPlayer->scriptState.depth = 0;
|
||||
seqPlayer->delay = 0;
|
||||
@ -935,6 +969,16 @@ void audio_init() {
|
||||
}
|
||||
#endif
|
||||
|
||||
#ifdef TARGET_N64
|
||||
eu_stubbed_printf_3("Clear Workarea %x -%x size %x \n",
|
||||
(uintptr_t) &gAudioGlobalsStartMarker,
|
||||
(uintptr_t) &gAudioGlobalsEndMarker,
|
||||
(uintptr_t) &gAudioGlobalsEndMarker - (uintptr_t) &gAudioGlobalsStartMarker
|
||||
);
|
||||
#endif
|
||||
|
||||
eu_stubbed_printf_1("AudioHeap is %x\n", gAudioHeapSize);
|
||||
|
||||
for (i = 0; i < NUMAIBUFFERS; i++) {
|
||||
gAiBufferLengths[i] = 0xa0;
|
||||
}
|
||||
@ -952,7 +996,7 @@ void audio_init() {
|
||||
gCurrAudioFrameDmaCount = 0;
|
||||
gSampleDmaNumListItems = 0;
|
||||
|
||||
sound_init_main_pools(D_80333EF0);
|
||||
sound_init_main_pools(gAudioInitPoolSize);
|
||||
|
||||
for (i = 0; i < NUMAIBUFFERS; i++) {
|
||||
gAiBuffers[i] = soundAlloc(&gAudioInitPool, AIBUFFER_LEN);
|
||||
@ -970,6 +1014,11 @@ void audio_init() {
|
||||
audio_reset_session(&gAudioSessionPresets[0]);
|
||||
#endif
|
||||
|
||||
// Not sure about these prints
|
||||
eu_stubbed_printf_1("Heap reset.Synth Change %x \n", 0);
|
||||
eu_stubbed_printf_3("Heap %x %x %x\n", 0, 0, 0);
|
||||
eu_stubbed_printf_0("Main Heap Initialize.\n");
|
||||
|
||||
// Load header for sequence data (assets/music_data.sbk.s)
|
||||
gSeqFileHeader = (ALSeqFile *) buf;
|
||||
data = gMusicData;
|
||||
@ -1011,5 +1060,12 @@ void audio_init() {
|
||||
|
||||
init_sequence_players();
|
||||
gAudioLoadLock = AUDIO_LOCK_NOT_LOADING;
|
||||
}
|
||||
|
||||
// Should probably contain the sizes of the data banks, but those aren't
|
||||
// easily accessible from here.
|
||||
eu_stubbed_printf_0("---------- Init Completed. ------------\n");
|
||||
eu_stubbed_printf_1(" Syndrv :[%6d]\n", 0); // gSoundDataADSR
|
||||
eu_stubbed_printf_1(" Seqdrv :[%6d]\n", 0); // gMusicData
|
||||
eu_stubbed_printf_1(" audiodata :[%6d]\n", 0); // gSoundDataRaw
|
||||
eu_stubbed_printf_0("---------------------------------------\n");
|
||||
}
|
||||
|
@ -31,6 +31,7 @@ extern struct NotePool gNoteFreeLists;
|
||||
extern OSMesgQueue gCurrAudioFrameDmaQueue;
|
||||
extern u32 gSampleDmaNumListItems;
|
||||
extern ALSeqFile *gAlTbl;
|
||||
extern ALSeqFile *gSeqFileHeader;
|
||||
extern u8 *gAlBankSets;
|
||||
|
||||
extern struct CtlEntry *gCtlEntries;
|
||||
|
@ -55,8 +55,14 @@ void note_set_vel_pan_reverb(struct Note *note, f32 velocity, u8 pan, u8 reverb)
|
||||
volRight = gDefaultPanVolume[127 - pan];
|
||||
}
|
||||
|
||||
velocity = MAX(0.0f, velocity);
|
||||
velocity = MIN(32767.f, velocity);
|
||||
if (velocity < 0.0f) {
|
||||
stubbed_printf("Audio: setvol: volume minus %f\n", velocity);
|
||||
velocity = 0.0f;
|
||||
}
|
||||
if (velocity > 32767.f) {
|
||||
stubbed_printf("Audio: setvol: volume overflow %f\n", velocity);
|
||||
velocity = 32767.f;
|
||||
}
|
||||
|
||||
sub->targetVolLeft = ((s32) (velocity * volLeft) & 0xffff) >> 5;
|
||||
sub->targetVolRight = ((s32) (velocity * volRight) & 0xffff) >> 5;
|
||||
@ -79,6 +85,7 @@ void note_set_resampling_rate(struct Note *note, f32 resamplingRateInput) {
|
||||
struct NoteSubEu *tempSub = ¬e->noteSubEu;
|
||||
|
||||
if (resamplingRateInput < 0.0f) {
|
||||
stubbed_printf("Audio: setpitch: pitch minus %f\n", resamplingRateInput);
|
||||
resamplingRateInput = 0.0f;
|
||||
}
|
||||
if (resamplingRateInput < 2.0f) {
|
||||
@ -117,17 +124,21 @@ struct Instrument *get_instrument_inner(s32 bankId, s32 instId) {
|
||||
struct Instrument *inst;
|
||||
|
||||
if (IS_BANK_LOAD_COMPLETE(bankId) == FALSE) {
|
||||
stubbed_printf("Audio: voiceman: No bank error %d\n", bankId);
|
||||
gAudioErrorFlags = bankId + 0x10000000;
|
||||
return NULL;
|
||||
}
|
||||
|
||||
if (instId >= gCtlEntries[bankId].numInstruments) {
|
||||
stubbed_printf("Audio: voiceman: progNo. overflow %d,%d\n",
|
||||
instId, gCtlEntries[bankId].numInstruments);
|
||||
gAudioErrorFlags = ((bankId << 8) + instId) + 0x3000000;
|
||||
return NULL;
|
||||
}
|
||||
|
||||
inst = gCtlEntries[bankId].instruments[instId];
|
||||
if (inst == NULL) {
|
||||
stubbed_printf("Audio: voiceman: progNo. undefined %d,%d\n", bankId, instId);
|
||||
gAudioErrorFlags = ((bankId << 8) + instId) + 0x1000000;
|
||||
return inst;
|
||||
}
|
||||
@ -141,6 +152,7 @@ struct Instrument *get_instrument_inner(s32 bankId, s32 instId) {
|
||||
return inst;
|
||||
}
|
||||
|
||||
stubbed_printf("Audio: voiceman: BAD Voicepointer %x,%d,%d\n", inst, bankId, instId);
|
||||
gAudioErrorFlags = ((bankId << 8) + instId) + 0x2000000;
|
||||
return NULL;
|
||||
}
|
||||
@ -148,16 +160,20 @@ struct Instrument *get_instrument_inner(s32 bankId, s32 instId) {
|
||||
struct Drum *get_drum(s32 bankId, s32 drumId) {
|
||||
struct Drum *drum;
|
||||
if (drumId >= gCtlEntries[bankId].numDrums) {
|
||||
stubbed_printf("Audio: voiceman: Percussion Overflow %d,%d\n",
|
||||
drumId, gCtlEntries[bankId].numDrums);
|
||||
gAudioErrorFlags = ((bankId << 8) + drumId) + 0x4000000;
|
||||
return 0;
|
||||
return NULL;
|
||||
}
|
||||
#ifndef NO_SEGMENTED_MEMORY
|
||||
if ((uintptr_t) gCtlEntries[bankId].drums < 0x80000000U) {
|
||||
return 0;
|
||||
stubbed_printf("Percussion Pointer Error\n");
|
||||
return NULL;
|
||||
}
|
||||
#endif
|
||||
drum = gCtlEntries[bankId].drums[drumId];
|
||||
if (drum == NULL) {
|
||||
stubbed_printf("Audio: voiceman: Percpointer NULL %d,%d\n", bankId, drumId);
|
||||
gAudioErrorFlags = ((bankId << 8) + drumId) + 0x5000000;
|
||||
}
|
||||
return drum;
|
||||
@ -232,8 +248,8 @@ void process_notes(void) {
|
||||
#endif
|
||||
s32 i;
|
||||
|
||||
// Macro versions of audio_list_push_front and audio_list_remove
|
||||
// (PREPEND does not actually need to be a macro, but it seems likely.)
|
||||
// Macro versions of audio_list_push_front and audio_list_remove.
|
||||
// Should ideally be changed to use copt.
|
||||
#define PREPEND(item, head_arg) \
|
||||
((it = (item), it->prev != NULL) \
|
||||
? it \
|
||||
@ -257,6 +273,7 @@ void process_notes(void) {
|
||||
if (!playbackState->parentLayer->enabled && playbackState->priority >= NOTE_PRIORITY_MIN) {
|
||||
goto c;
|
||||
} else if (playbackState->parentLayer->seqChannel->seqPlayer == NULL) {
|
||||
eu_stubbed_printf_0("CAUTION:SUB IS SEPARATED FROM GROUP");
|
||||
sequence_channel_disable(playbackState->parentLayer->seqChannel);
|
||||
playbackState->priority = NOTE_PRIORITY_STOPPING;
|
||||
continue;
|
||||
@ -292,6 +309,7 @@ void process_notes(void) {
|
||||
playbackState->wantedParentLayer = NO_LAYER;
|
||||
// don't skip
|
||||
} else {
|
||||
eu_stubbed_printf_0("Error:Wait Track disappear\n");
|
||||
note_disable(note);
|
||||
audio_list_remove(¬e->listItem);
|
||||
audio_list_push_back(¬e->listItem.pool->disabled, ¬e->listItem);
|
||||
@ -435,7 +453,10 @@ void seq_channel_layer_decay_release_internal(struct SequenceChannelLayer *seqLa
|
||||
|
||||
if (note->parentLayer != seqLayer) {
|
||||
#ifdef VERSION_EU
|
||||
if (note->parentLayer == NO_LAYER && note->wantedParentLayer == NO_LAYER && note->prevParentLayer == seqLayer && target != ADSR_STATE_DECAY) {
|
||||
if (note->parentLayer == NO_LAYER && note->wantedParentLayer == NO_LAYER &&
|
||||
note->prevParentLayer == seqLayer && target != ADSR_STATE_DECAY) {
|
||||
// Just guessing that this printf goes here... it's hard to parse.
|
||||
eu_stubbed_printf_0("Slow Release Batting\n");
|
||||
note->adsr.fadeOutVel = gAudioBufferParameters.updatesPerFrameInv;
|
||||
note->adsr.action |= ADSR_ACTION_RELEASE;
|
||||
}
|
||||
@ -503,6 +524,7 @@ s32 build_synthetic_wave(struct Note *note, struct SequenceChannelLayer *seqLaye
|
||||
u8 sampleCountIndex;
|
||||
|
||||
if (waveId < 128) {
|
||||
stubbed_printf("Audio:Wavemem: Bad voiceno (%d)\n", waveId);
|
||||
waveId = 128;
|
||||
}
|
||||
|
||||
@ -531,6 +553,7 @@ s32 build_synthetic_wave(struct Note *note, struct SequenceChannelLayer *seqLaye
|
||||
|
||||
return sampleCountIndex;
|
||||
}
|
||||
|
||||
#else
|
||||
void build_synthetic_wave(struct Note *note, struct SequenceChannelLayer *seqLayer) {
|
||||
s32 i;
|
||||
@ -671,7 +694,11 @@ void note_pool_clear(struct NotePool *pool) {
|
||||
#ifdef VERSION_EU
|
||||
for (;;) {
|
||||
cur = source->next;
|
||||
if (cur == source || cur == NULL) {
|
||||
if (cur == source) {
|
||||
break;
|
||||
}
|
||||
if (cur == NULL) {
|
||||
eu_stubbed_printf_0("Audio: C-Alloc : Dealloc voice is NULL\n");
|
||||
break;
|
||||
}
|
||||
audio_list_remove(cur);
|
||||
@ -703,6 +730,7 @@ void note_pool_fill(struct NotePool *pool, s32 count) {
|
||||
|
||||
for (i = 0, j = 0; j < count; i++) {
|
||||
if (i == 4) {
|
||||
eu_stubbed_printf_1("Alloc Error:Dim voice-Alloc %d", count);
|
||||
return;
|
||||
}
|
||||
|
||||
@ -741,7 +769,9 @@ void note_pool_fill(struct NotePool *pool, s32 count) {
|
||||
|
||||
void audio_list_push_front(struct AudioListItem *list, struct AudioListItem *item) {
|
||||
// add 'item' to the front of the list given by 'list', if it's not in any list
|
||||
if (item->prev == NULL) {
|
||||
if (item->prev != NULL) {
|
||||
eu_stubbed_printf_0("Error:Same List Add\n");
|
||||
} else {
|
||||
item->prev = list;
|
||||
item->next = list->next;
|
||||
list->next->prev = item;
|
||||
@ -753,14 +783,16 @@ void audio_list_push_front(struct AudioListItem *list, struct AudioListItem *ite
|
||||
|
||||
void audio_list_remove(struct AudioListItem *item) {
|
||||
// remove 'item' from the list it's in, if any
|
||||
if (item->prev != NULL) {
|
||||
if (item->prev == NULL) {
|
||||
eu_stubbed_printf_0("Already Cut\n");
|
||||
} else {
|
||||
item->prev->next = item->next;
|
||||
item->next->prev = item->prev;
|
||||
item->prev = NULL;
|
||||
}
|
||||
}
|
||||
|
||||
struct Note *pop_node_with_value_less_equal(struct AudioListItem *list, s32 limit) {
|
||||
struct Note *pop_node_with_lower_prio(struct AudioListItem *list, s32 limit) {
|
||||
struct AudioListItem *cur = list->next;
|
||||
struct AudioListItem *best;
|
||||
|
||||
@ -894,8 +926,10 @@ struct Note *alloc_note_from_decaying(struct NotePool *pool, struct SequenceChan
|
||||
|
||||
struct Note *alloc_note_from_active(struct NotePool *pool, struct SequenceChannelLayer *seqLayer) {
|
||||
struct Note *note =
|
||||
pop_node_with_value_less_equal(&pool->active, seqLayer->seqChannel->notePriority);
|
||||
if (note != NULL) {
|
||||
pop_node_with_lower_prio(&pool->active, seqLayer->seqChannel->notePriority);
|
||||
if (note == NULL) {
|
||||
eu_stubbed_printf_0("Audio: C-Alloc : lowerPrio is NULL\n");
|
||||
} else {
|
||||
func_80319728(note, seqLayer);
|
||||
audio_list_push_back(&pool->releasing, ¬e->listItem);
|
||||
}
|
||||
@ -928,6 +962,7 @@ struct Note *alloc_note(struct SequenceChannelLayer *seqLayer) {
|
||||
if (!(ret = alloc_note_from_disabled(&seqLayer->seqChannel->notePool, seqLayer))
|
||||
&& !(ret = alloc_note_from_decaying(&seqLayer->seqChannel->notePool, seqLayer))
|
||||
&& !(ret = alloc_note_from_active(&seqLayer->seqChannel->notePool, seqLayer))) {
|
||||
eu_stubbed_printf_0("Sub Limited Warning: Drop Voice");
|
||||
seqLayer->status = SOUND_LOAD_STATUS_NOT_LOADED;
|
||||
return NULL;
|
||||
}
|
||||
@ -941,6 +976,7 @@ struct Note *alloc_note(struct SequenceChannelLayer *seqLayer) {
|
||||
&& !(ret = alloc_note_from_decaying(&seqLayer->seqChannel->seqPlayer->notePool, seqLayer))
|
||||
&& !(ret = alloc_note_from_active(&seqLayer->seqChannel->notePool, seqLayer))
|
||||
&& !(ret = alloc_note_from_active(&seqLayer->seqChannel->seqPlayer->notePool, seqLayer))) {
|
||||
eu_stubbed_printf_0("Warning: Drop Voice");
|
||||
seqLayer->status = SOUND_LOAD_STATUS_NOT_LOADED;
|
||||
return NULL;
|
||||
}
|
||||
@ -951,6 +987,7 @@ struct Note *alloc_note(struct SequenceChannelLayer *seqLayer) {
|
||||
if (!(ret = alloc_note_from_disabled(&gNoteFreeLists, seqLayer))
|
||||
&& !(ret = alloc_note_from_decaying(&gNoteFreeLists, seqLayer))
|
||||
&& !(ret = alloc_note_from_active(&gNoteFreeLists, seqLayer))) {
|
||||
eu_stubbed_printf_0("Warning: Drop Voice");
|
||||
seqLayer->status = SOUND_LOAD_STATUS_NOT_LOADED;
|
||||
return NULL;
|
||||
}
|
||||
@ -966,6 +1003,7 @@ struct Note *alloc_note(struct SequenceChannelLayer *seqLayer) {
|
||||
&& !(ret = alloc_note_from_active(&seqLayer->seqChannel->notePool, seqLayer))
|
||||
&& !(ret = alloc_note_from_active(&seqLayer->seqChannel->seqPlayer->notePool, seqLayer))
|
||||
&& !(ret = alloc_note_from_active(&gNoteFreeLists, seqLayer))) {
|
||||
eu_stubbed_printf_0("Warning: Drop Voice");
|
||||
seqLayer->status = SOUND_LOAD_STATUS_NOT_LOADED;
|
||||
return NULL;
|
||||
}
|
||||
@ -1011,7 +1049,6 @@ void reclaim_notes(void) {
|
||||
}
|
||||
#endif
|
||||
|
||||
|
||||
void note_init_all(void) {
|
||||
struct Note *note;
|
||||
s32 i;
|
||||
|
@ -141,7 +141,6 @@ void eu_process_audio_cmd(struct EuAudioCmd *cmd) {
|
||||
|
||||
case 0x82:
|
||||
case 0x88:
|
||||
// load_sequence(arg1, arg2, 0);
|
||||
load_sequence(cmd->u.s.arg1, cmd->u.s.arg2, cmd->u.s.arg3);
|
||||
func_8031D690(cmd->u.s.arg1, cmd->u2.as_s32);
|
||||
break;
|
||||
|
@ -198,6 +198,7 @@ void sequence_player_init_channels(struct SequencePlayer *seqPlayer, u16 channel
|
||||
}
|
||||
seqChannel = allocate_sequence_channel();
|
||||
if (IS_SEQUENCE_CHANNEL_VALID(seqChannel) == FALSE) {
|
||||
eu_stubbed_printf_0("Audio:Track:Warning: No Free Notetrack\n");
|
||||
gAudioErrorFlags = i + 0x10000;
|
||||
seqPlayer->channels[i] = seqChannel;
|
||||
} else {
|
||||
@ -221,6 +222,7 @@ void sequence_player_disable_channels(struct SequencePlayer *seqPlayer, u16 chan
|
||||
struct SequenceChannel *seqChannel;
|
||||
s32 i;
|
||||
|
||||
eu_stubbed_printf_0("SUBTRACK DIM\n");
|
||||
for (i = 0; i < CHANNELS_MAX; i++) {
|
||||
if (channelBits & 1) {
|
||||
seqChannel = seqPlayer->channels[i];
|
||||
@ -230,7 +232,9 @@ void sequence_player_disable_channels(struct SequencePlayer *seqPlayer, u16 chan
|
||||
seqChannel->seqPlayer = NULL;
|
||||
}
|
||||
#ifdef VERSION_EU
|
||||
if (0) {}
|
||||
else {
|
||||
stubbed_printf("Audio:Track: Warning SUBTRACK PARENT CHANGED\n");
|
||||
}
|
||||
#endif
|
||||
seqPlayer->channels[i] = &gSequenceChannelNone;
|
||||
}
|
||||
@ -243,27 +247,30 @@ void sequence_player_disable_channels(struct SequencePlayer *seqPlayer, u16 chan
|
||||
}
|
||||
}
|
||||
|
||||
void sequence_channel_enable(struct SequencePlayer *seqPlayer, u8 channelIndex, void *arg2) {
|
||||
void sequence_channel_enable(struct SequencePlayer *seqPlayer, u8 channelIndex, void *script) {
|
||||
struct SequenceChannel *seqChannel = seqPlayer->channels[channelIndex];
|
||||
s32 i;
|
||||
|
||||
#ifdef VERSION_EU
|
||||
if (IS_SEQUENCE_CHANNEL_VALID(seqChannel) == FALSE) {
|
||||
#ifdef VERSION_EU
|
||||
struct SequencePlayer *bgMusic = &gSequencePlayers[0];
|
||||
struct SequencePlayer *miscMusic = &gSequencePlayers[1];
|
||||
|
||||
if (seqPlayer == bgMusic) {
|
||||
stubbed_printf("GROUP 0:");
|
||||
} else if (seqPlayer == miscMusic) {
|
||||
stubbed_printf("GROUP 1:");
|
||||
} else {
|
||||
stubbed_printf("SEQID %d,BANKID %d\n",
|
||||
seqPlayer->seqId, seqPlayer->defaultBank[0]);
|
||||
}
|
||||
} else {
|
||||
#else
|
||||
if (IS_SEQUENCE_CHANNEL_VALID(seqChannel) != FALSE) {
|
||||
stubbed_printf("ERR:SUBTRACK %d NOT ALLOCATED\n", channelIndex);
|
||||
#endif
|
||||
} else {
|
||||
seqChannel->enabled = TRUE;
|
||||
seqChannel->finished = FALSE;
|
||||
seqChannel->scriptState.depth = 0;
|
||||
seqChannel->scriptState.pc = arg2;
|
||||
seqChannel->scriptState.pc = script;
|
||||
seqChannel->delay = 0;
|
||||
for (i = 0; i < LAYERS_MAX; i++) {
|
||||
if (seqChannel->layers[i] != NULL) {
|
||||
@ -309,7 +316,9 @@ void sequence_player_disable(struct SequencePlayer *seqPlayer) {
|
||||
* Add an item to the end of a list, if it's not already in any list.
|
||||
*/
|
||||
void audio_list_push_back(struct AudioListItem *list, struct AudioListItem *item) {
|
||||
if (item->prev == NULL) {
|
||||
if (item->prev != NULL) {
|
||||
eu_stubbed_printf_0("Error:Same List Add\n");
|
||||
} else {
|
||||
list->prev->next = item;
|
||||
item->prev = list->prev;
|
||||
item->next = list;
|
||||
@ -479,12 +488,18 @@ void seq_channel_layer_process_script(struct SequenceChannelLayer *layer) {
|
||||
break;
|
||||
|
||||
case 0xfc: // layer_call
|
||||
if (0 && state->depth >= 4) {
|
||||
eu_stubbed_printf_0("Macro Level Over Error!\n");
|
||||
}
|
||||
sp3A = m64_read_s16(state);
|
||||
state->stack[state->depth++] = state->pc;
|
||||
state->pc = seqPlayer->seqData + sp3A;
|
||||
break;
|
||||
|
||||
case 0xf8: // layer_loop; loop start, N iterations (or 256 if N = 0)
|
||||
if (0 && state->depth >= 4) {
|
||||
eu_stubbed_printf_0("Macro Level Over Error!\n");
|
||||
}
|
||||
state->remLoopIters[state->depth] = m64_read_u8(state);
|
||||
state->stack[state->depth++] = state->pc;
|
||||
break;
|
||||
@ -571,9 +586,8 @@ void seq_channel_layer_process_script(struct SequenceChannelLayer *layer) {
|
||||
break;
|
||||
}
|
||||
|
||||
cmd = get_instrument(seqChannel, cmd, &layer->instrument, &layer->adsr);
|
||||
layer->instOrWave = cmd;
|
||||
if (cmd == 0) {
|
||||
if ((layer->instOrWave = get_instrument(seqChannel, cmd, &layer->instrument, &layer->adsr)) == 0) {
|
||||
eu_stubbed_printf_1("WARNING: NPRG: cannot change %d\n", cmd);
|
||||
layer->instOrWave = 0xff;
|
||||
}
|
||||
#endif
|
||||
@ -627,6 +641,9 @@ void seq_channel_layer_process_script(struct SequenceChannelLayer *layer) {
|
||||
case 0xe0: // layer_setshortnotedurationfromtable
|
||||
layer->noteDuration = seqPlayer->shortNoteDurationTable[cmd & 0xf];
|
||||
break;
|
||||
default:
|
||||
eu_stubbed_printf_1("Audio:Track:NOTE:UNDEFINED NOTE COM. %x\n", cmd);
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -891,6 +908,10 @@ void seq_channel_layer_process_script(struct SequenceChannelLayer *layer) {
|
||||
}
|
||||
#endif
|
||||
}
|
||||
|
||||
u8 audioString106[] = "Audio: Note:Velocity Error %d\n";
|
||||
u8 audioString107[] = "Error: Your assignchannel is stolen.\n";
|
||||
|
||||
#elif defined(NON_MATCHING)
|
||||
// US/JP version with macros to simulate inlining by copt. Edit if you dare.
|
||||
#include "seq_channel_layer_process_script.h"
|
||||
@ -986,7 +1007,6 @@ void sequence_channel_set_volume(struct SequenceChannel *seqChannel, u8 volume)
|
||||
}
|
||||
|
||||
#ifdef NON_MATCHING
|
||||
//rodata: 0xf3e30
|
||||
void sequence_channel_process_script(struct SequenceChannel *seqChannel) {
|
||||
struct M64ScriptState *state;
|
||||
struct SequencePlayer *seqPlayer;
|
||||
@ -1086,6 +1106,9 @@ void sequence_channel_process_script(struct SequenceChannel *seqChannel) {
|
||||
goto out;
|
||||
#endif
|
||||
case 0xfc: // chan_call
|
||||
if (0 && state->depth >= 4) {
|
||||
eu_stubbed_printf_0("Audio:Track :Call Macro Level Over Error!\n");
|
||||
}
|
||||
sp5A = m64_read_s16(state);
|
||||
#ifdef VERSION_EU
|
||||
state->stack[state->depth++] = state->pc;
|
||||
@ -1096,6 +1119,9 @@ void sequence_channel_process_script(struct SequenceChannel *seqChannel) {
|
||||
break;
|
||||
|
||||
case 0xf8: // chan_loop; loop start, N iterations (or 256 if N = 0)
|
||||
if (0 && state->depth >= 4) {
|
||||
eu_stubbed_printf_0("Audio:Track :Loops Macro Level Over Error!\n");
|
||||
}
|
||||
state->remLoopIters[state->depth] = m64_read_u8(state);
|
||||
#ifdef VERSION_EU
|
||||
state->stack[state->depth++] = state->pc;
|
||||
@ -1132,9 +1158,9 @@ void sequence_channel_process_script(struct SequenceChannel *seqChannel) {
|
||||
break;
|
||||
|
||||
#ifdef VERSION_EU
|
||||
case 0xf4:
|
||||
case 0xf3:
|
||||
case 0xf2:
|
||||
case 0xf4: // chan_jump_rel
|
||||
case 0xf3: // chan_beqz_rel
|
||||
case 0xf2: // chan_bltz_rel
|
||||
tempSigned = m64_read_u8(state);
|
||||
if (cmd == 0xf3 && value != 0)
|
||||
break;
|
||||
@ -1177,7 +1203,7 @@ void sequence_channel_process_script(struct SequenceChannel *seqChannel) {
|
||||
break;
|
||||
|
||||
#ifdef VERSION_EU
|
||||
case 0xeb:
|
||||
case 0xeb: // chan_setbankandinstr
|
||||
temp = m64_read_u8(state);
|
||||
// Switch to the temp's (0-indexed) bank in this sequence's
|
||||
// bank set. Note that in the binary format (not in the JSON!)
|
||||
@ -1188,6 +1214,8 @@ void sequence_channel_process_script(struct SequenceChannel *seqChannel) {
|
||||
// temp should be in a saved register across this call
|
||||
if (get_bank_or_seq(&gBankLoadedPool, 2, temp) != NULL) {
|
||||
seqChannel->bankId = temp;
|
||||
} else {
|
||||
eu_stubbed_printf_1("SUB:ERR:BANK %d NOT CACHED.\n", temp);
|
||||
}
|
||||
// fallthrough
|
||||
#endif
|
||||
@ -1322,6 +1350,8 @@ void sequence_channel_process_script(struct SequenceChannel *seqChannel) {
|
||||
// temp should be in a saved register across this call
|
||||
if (get_bank_or_seq(&gBankLoadedPool, 2, temp) != NULL) {
|
||||
seqChannel->bankId = temp;
|
||||
} else {
|
||||
eu_stubbed_printf_1("SUB:ERR:BANK %d NOT CACHED.\n", temp);
|
||||
}
|
||||
}
|
||||
break;
|
||||
@ -1381,6 +1411,9 @@ void sequence_channel_process_script(struct SequenceChannel *seqChannel) {
|
||||
#endif
|
||||
case 0xe4: // chan_dyncall
|
||||
if (value != -1) {
|
||||
if (0 && state->depth >= 4) {
|
||||
eu_stubbed_printf_0("Audio:Track: CTBLCALL Macro Level Over Error!\n");
|
||||
}
|
||||
u8(*thingy)[2] = *seqChannel->dynTable;
|
||||
#ifdef VERSION_EU
|
||||
state->stack[state->depth++] = state->pc;
|
||||
@ -1389,6 +1422,9 @@ void sequence_channel_process_script(struct SequenceChannel *seqChannel) {
|
||||
#endif
|
||||
sp5A = thingy[value][1] + (thingy[value][0] << 8);
|
||||
state->pc = seqPlayer->seqData + sp5A;
|
||||
if (0 && sp5A >= gSeqFileHeader->seqArray[seqPlayer->seqId].len) {
|
||||
eu_stubbed_printf_3("Err :Sub %x ,address %x:Undefined SubTrack Function %x", seqChannel, state->pc, sp5A);
|
||||
}
|
||||
}
|
||||
break;
|
||||
|
||||
@ -1433,7 +1469,7 @@ void sequence_channel_process_script(struct SequenceChannel *seqChannel) {
|
||||
seqChannel->freqScale = 1.0f;
|
||||
break;
|
||||
|
||||
case 0xe9:
|
||||
case 0xe9: // chan_setnotepriority
|
||||
seqChannel->notePriority = m64_read_u8(state);
|
||||
break;
|
||||
#endif
|
||||
@ -1470,7 +1506,7 @@ void sequence_channel_process_script(struct SequenceChannel *seqChannel) {
|
||||
break;
|
||||
|
||||
#ifdef VERSION_EU
|
||||
case 0x60:
|
||||
case 0x60: // chan_delayshort
|
||||
seqChannel->delay = loBits;
|
||||
goto out;
|
||||
#endif
|
||||
@ -1621,6 +1657,7 @@ void sequence_player_process_sequence(struct SequencePlayer *seqPlayer) {
|
||||
// If discarded, bail out.
|
||||
if (IS_SEQ_LOAD_COMPLETE(seqPlayer->seqId) == FALSE
|
||||
|| IS_BANK_LOAD_COMPLETE(seqPlayer->defaultBank[0]) == FALSE) {
|
||||
eu_stubbed_printf_1("Disappear Sequence or Bank %d\n", seqPlayer->seqId);
|
||||
sequence_player_disable(seqPlayer);
|
||||
return;
|
||||
}
|
||||
@ -1685,6 +1722,9 @@ void sequence_player_process_sequence(struct SequencePlayer *seqPlayer) {
|
||||
|
||||
case 0xfc: // seq_call
|
||||
u16v = m64_read_s16(state);
|
||||
if (0 && state->depth >= 4) {
|
||||
eu_stubbed_printf_0("Macro Level Over Error!\n");
|
||||
}
|
||||
#ifdef VERSION_EU
|
||||
state->stack[state->depth++] = state->pc;
|
||||
#else
|
||||
@ -1694,6 +1734,9 @@ void sequence_player_process_sequence(struct SequencePlayer *seqPlayer) {
|
||||
break;
|
||||
|
||||
case 0xf8: // seq_loop; loop start, N iterations (or 256 if N = 0)
|
||||
if (0 && state->depth >= 4) {
|
||||
eu_stubbed_printf_0("Macro Level Over Error!\n");
|
||||
}
|
||||
state->remLoopIters[state->depth] = m64_read_u8(state);
|
||||
#ifdef VERSION_EU
|
||||
state->stack[state->depth++] = state->pc;
|
||||
@ -1913,6 +1956,10 @@ void sequence_player_process_sequence(struct SequencePlayer *seqPlayer) {
|
||||
case 0xc8: // seq_subtract
|
||||
value = value - m64_read_u8(state);
|
||||
break;
|
||||
|
||||
default:
|
||||
eu_stubbed_printf_1("Group:Undefine upper C0h command (%x)\n", cmd);
|
||||
break;
|
||||
}
|
||||
} else {
|
||||
loBits = cmd & 0xf;
|
||||
@ -1967,6 +2014,10 @@ void sequence_player_process_sequence(struct SequencePlayer *seqPlayer) {
|
||||
case 0xd9:
|
||||
break;
|
||||
#endif
|
||||
|
||||
default:
|
||||
eu_stubbed_printf_0("Group:Undefined Command\n");
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -71,11 +71,12 @@ f32 gLeftVolRampings[3][1024];
|
||||
f32 gRightVolRampings[3][1024];
|
||||
f32 *gCurrentLeftVolRamping; // Points to any of the three left buffers above
|
||||
f32 *gCurrentRightVolRamping; // Points to any of the three right buffers above
|
||||
|
||||
u8 audioString1[] = "pitch %x: delaybytes %d : olddelay %d\n";
|
||||
u8 audioString2[] = "cont %x: delaybytes %d : olddelay %d\n";
|
||||
|
||||
#else
|
||||
struct SynthesisReverb gSynthesisReverb;
|
||||
#endif
|
||||
|
||||
#ifndef VERSION_EU
|
||||
u8 sAudioSynthesisPad[0x20];
|
||||
#endif
|
||||
|
||||
@ -614,8 +615,6 @@ u64 *synthesis_process_notes(s16 *aiBuf, s32 bufLen, u64 *cmd) {
|
||||
u8 *sampleAddr; // sp120, spF4
|
||||
#endif
|
||||
|
||||
// sp6c is a temporary!
|
||||
|
||||
#ifdef VERSION_EU
|
||||
s32 samplesLenAdjusted; // 108, spEC
|
||||
// Might have been used to store (samplesLenFixedPoint >> 0x10), but doing so causes strange
|
||||
|
@ -314,12 +314,12 @@ struct GraphNodeObject *init_graph_node_object(struct AllocOnlyPool *pool,
|
||||
vec3s_copy(graphNode->angle, angle);
|
||||
graphNode->sharedChild = sharedChild;
|
||||
graphNode->throwMatrix = NULL;
|
||||
graphNode->unk38.animID = 0;
|
||||
graphNode->unk38.curAnim = NULL;
|
||||
graphNode->unk38.animFrame = 0;
|
||||
graphNode->unk38.animFrameAccelAssist = 0;
|
||||
graphNode->unk38.animAccel = 0x10000;
|
||||
graphNode->unk38.animTimer = 0;
|
||||
graphNode->animInfo.animID = 0;
|
||||
graphNode->animInfo.curAnim = NULL;
|
||||
graphNode->animInfo.animFrame = 0;
|
||||
graphNode->animInfo.animFrameAccelAssist = 0;
|
||||
graphNode->animInfo.animAccel = 0x10000;
|
||||
graphNode->animInfo.animTimer = 0;
|
||||
graphNode->node.flags |= GRAPH_RENDER_HAS_ANIMATION;
|
||||
}
|
||||
|
||||
@ -698,7 +698,7 @@ void geo_obj_init(struct GraphNodeObject *graphNode, void *sharedChild, Vec3f po
|
||||
graphNode->sharedChild = sharedChild;
|
||||
graphNode->unk4C = 0;
|
||||
graphNode->throwMatrix = NULL;
|
||||
graphNode->unk38.curAnim = NULL;
|
||||
graphNode->animInfo.curAnim = NULL;
|
||||
|
||||
graphNode->node.flags |= GRAPH_RENDER_ACTIVE;
|
||||
graphNode->node.flags &= ~GRAPH_RENDER_INVISIBLE;
|
||||
@ -717,12 +717,12 @@ void geo_obj_init_spawninfo(struct GraphNodeObject *graphNode, struct SpawnInfo
|
||||
graphNode->pos[1] = (f32) spawn->startPos[1];
|
||||
graphNode->pos[2] = (f32) spawn->startPos[2];
|
||||
|
||||
graphNode->unk18 = spawn->areaIndex;
|
||||
graphNode->unk19 = spawn->activeAreaIndex;
|
||||
graphNode->areaIndex = spawn->areaIndex;
|
||||
graphNode->activeAreaIndex = spawn->activeAreaIndex;
|
||||
graphNode->sharedChild = spawn->unk18;
|
||||
graphNode->unk4C = spawn;
|
||||
graphNode->throwMatrix = NULL;
|
||||
graphNode->unk38.curAnim = 0;
|
||||
graphNode->animInfo.curAnim = 0;
|
||||
|
||||
graphNode->node.flags |= GRAPH_RENDER_ACTIVE;
|
||||
graphNode->node.flags &= ~GRAPH_RENDER_INVISIBLE;
|
||||
@ -737,11 +737,11 @@ void geo_obj_init_animation(struct GraphNodeObject *graphNode, struct Animation
|
||||
struct Animation **animSegmented = segmented_to_virtual(animPtrAddr);
|
||||
struct Animation *anim = segmented_to_virtual(*animSegmented);
|
||||
|
||||
if (graphNode->unk38.curAnim != anim) {
|
||||
graphNode->unk38.curAnim = anim;
|
||||
graphNode->unk38.animFrame = anim->unk04 + ((anim->flags & ANIM_FLAG_FORWARD) ? 1 : -1);
|
||||
graphNode->unk38.animAccel = 0;
|
||||
graphNode->unk38.animYTrans = 0;
|
||||
if (graphNode->animInfo.curAnim != anim) {
|
||||
graphNode->animInfo.curAnim = anim;
|
||||
graphNode->animInfo.animFrame = anim->startFrame + ((anim->flags & ANIM_FLAG_FORWARD) ? 1 : -1);
|
||||
graphNode->animInfo.animAccel = 0;
|
||||
graphNode->animInfo.animYTrans = 0;
|
||||
}
|
||||
}
|
||||
|
||||
@ -752,15 +752,15 @@ void geo_obj_init_animation_accel(struct GraphNodeObject *graphNode, struct Anim
|
||||
struct Animation **animSegmented = segmented_to_virtual(animPtrAddr);
|
||||
struct Animation *anim = segmented_to_virtual(*animSegmented);
|
||||
|
||||
if (graphNode->unk38.curAnim != anim) {
|
||||
graphNode->unk38.curAnim = anim;
|
||||
graphNode->unk38.animYTrans = 0;
|
||||
graphNode->unk38.animFrameAccelAssist =
|
||||
(anim->unk04 << 16) + ((anim->flags & ANIM_FLAG_FORWARD) ? animAccel : -animAccel);
|
||||
graphNode->unk38.animFrame = graphNode->unk38.animFrameAccelAssist >> 16;
|
||||
if (graphNode->animInfo.curAnim != anim) {
|
||||
graphNode->animInfo.curAnim = anim;
|
||||
graphNode->animInfo.animYTrans = 0;
|
||||
graphNode->animInfo.animFrameAccelAssist =
|
||||
(anim->startFrame << 16) + ((anim->flags & ANIM_FLAG_FORWARD) ? animAccel : -animAccel);
|
||||
graphNode->animInfo.animFrame = graphNode->animInfo.animFrameAccelAssist >> 16;
|
||||
}
|
||||
|
||||
graphNode->unk38.animAccel = animAccel;
|
||||
graphNode->animInfo.animAccel = animAccel;
|
||||
}
|
||||
|
||||
/**
|
||||
@ -789,7 +789,7 @@ s32 retrieve_animation_index(s32 frame, u16 **attributes) {
|
||||
* whether it plays forwards or backwards, and whether it stops or loops at
|
||||
* the end etc.
|
||||
*/
|
||||
s16 geo_update_animation_frame(struct GraphNodeObject_sub *obj, s32 *accelAssist) {
|
||||
s16 geo_update_animation_frame(struct AnimInfo *obj, s32 *accelAssist) {
|
||||
s32 result;
|
||||
struct Animation *anim;
|
||||
|
||||
@ -810,11 +810,11 @@ s16 geo_update_animation_frame(struct GraphNodeObject_sub *obj, s32 *accelAssist
|
||||
result = (obj->animFrame - 1) << 16;
|
||||
}
|
||||
|
||||
if (GET_HIGH_S16_OF_32(result) < anim->unk06) {
|
||||
if (GET_HIGH_S16_OF_32(result) < anim->loopStart) {
|
||||
if (anim->flags & ANIM_FLAG_NOLOOP) {
|
||||
SET_HIGH_S16_OF_32(result, anim->unk06);
|
||||
SET_HIGH_S16_OF_32(result, anim->loopStart);
|
||||
} else {
|
||||
SET_HIGH_S16_OF_32(result, anim->unk08 - 1);
|
||||
SET_HIGH_S16_OF_32(result, anim->loopEnd - 1);
|
||||
}
|
||||
}
|
||||
} else {
|
||||
@ -824,11 +824,11 @@ s16 geo_update_animation_frame(struct GraphNodeObject_sub *obj, s32 *accelAssist
|
||||
result = (obj->animFrame + 1) << 16;
|
||||
}
|
||||
|
||||
if (GET_HIGH_S16_OF_32(result) >= anim->unk08) {
|
||||
if (GET_HIGH_S16_OF_32(result) >= anim->loopEnd) {
|
||||
if (anim->flags & ANIM_FLAG_NOLOOP) {
|
||||
SET_HIGH_S16_OF_32(result, anim->unk08 - 1);
|
||||
SET_HIGH_S16_OF_32(result, anim->loopEnd - 1);
|
||||
} else {
|
||||
SET_HIGH_S16_OF_32(result, anim->unk06);
|
||||
SET_HIGH_S16_OF_32(result, anim->loopStart);
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -849,7 +849,7 @@ s16 geo_update_animation_frame(struct GraphNodeObject_sub *obj, s32 *accelAssist
|
||||
* animations without lateral translation.
|
||||
*/
|
||||
void geo_retreive_animation_translation(struct GraphNodeObject *obj, Vec3f position) {
|
||||
struct Animation *animation = obj->unk38.curAnim;
|
||||
struct Animation *animation = obj->animInfo.curAnim;
|
||||
u16 *attribute;
|
||||
s16 *values;
|
||||
s16 frame;
|
||||
@ -858,7 +858,7 @@ void geo_retreive_animation_translation(struct GraphNodeObject *obj, Vec3f posit
|
||||
attribute = segmented_to_virtual((void *) animation->index);
|
||||
values = segmented_to_virtual((void *) animation->values);
|
||||
|
||||
frame = obj->unk38.animFrame;
|
||||
frame = obj->animInfo.animFrame;
|
||||
|
||||
if (frame < 0) {
|
||||
frame = 0;
|
||||
|
@ -420,7 +420,7 @@ void geo_obj_init_animation_accel(struct GraphNodeObject *graphNode, struct Anim
|
||||
|
||||
s32 retrieve_animation_index(s32 frame, u16 **attributes);
|
||||
|
||||
s16 geo_update_animation_frame(struct GraphNodeObject_sub *obj, s32 *accelAssist);
|
||||
s16 geo_update_animation_frame(struct AnimInfo *obj, s32 *accelAssist);
|
||||
void geo_retreive_animation_translation(struct GraphNodeObject *obj, Vec3f position);
|
||||
|
||||
struct GraphNodeRoot *geo_find_root(struct GraphNode *graphNode);
|
||||
|
@ -159,7 +159,8 @@ void mtxf_copy(Mat4 dest, Mat4 src) {
|
||||
void mtxf_identity(Mat4 mtx) {
|
||||
register s32 i;
|
||||
register f32 *dest;
|
||||
// Note: These loops need to be on one line to match on PAL
|
||||
// These loops must be one line to match on -O2
|
||||
|
||||
// initialize everything except the first and last cells to 0
|
||||
for (dest = (f32 *) mtx + 1, i = 0; i < 14; dest++, i++) *dest = 0;
|
||||
|
||||
|
@ -199,8 +199,8 @@ s32 find_wall_collisions(struct WallCollisionData *colData) {
|
||||
|
||||
// World (level) consists of a 16x16 grid. Find where the collision is on
|
||||
// the grid (round toward -inf)
|
||||
cellX = ((x + LEVEL_BOUNDARY_MAX) / CELL_SIZE) & 0x0F;
|
||||
cellZ = ((z + LEVEL_BOUNDARY_MAX) / CELL_SIZE) & 0x0F;
|
||||
cellX = ((x + LEVEL_BOUNDARY_MAX) / CELL_SIZE) & (NUM_CELLS - 1);
|
||||
cellZ = ((z + LEVEL_BOUNDARY_MAX) / CELL_SIZE) & (NUM_CELLS - 1);
|
||||
|
||||
// Check for surfaces belonging to objects.
|
||||
node = gDynamicSurfacePartition[cellZ][cellX][SPATIAL_PARTITION_WALLS].next;
|
||||
@ -307,8 +307,8 @@ f32 find_ceil(f32 posX, f32 posY, f32 posZ, struct Surface **pceil) {
|
||||
s16 cellZ, cellX;
|
||||
struct Surface *ceil, *dynamicCeil;
|
||||
struct SurfaceNode *surfaceList;
|
||||
f32 height = 20000.0f;
|
||||
f32 dynamicHeight = 20000.0f;
|
||||
f32 height = CELL_HEIGHT_LIMIT;
|
||||
f32 dynamicHeight = CELL_HEIGHT_LIMIT;
|
||||
s16 x, y, z;
|
||||
|
||||
//! (Parallel Universes) Because position is casted to an s16, reaching higher
|
||||
@ -327,8 +327,8 @@ f32 find_ceil(f32 posX, f32 posY, f32 posZ, struct Surface **pceil) {
|
||||
}
|
||||
|
||||
// Each level is split into cells to limit load, find the appropriate cell.
|
||||
cellX = ((x + LEVEL_BOUNDARY_MAX) / CELL_SIZE) & 0xF;
|
||||
cellZ = ((z + LEVEL_BOUNDARY_MAX) / CELL_SIZE) & 0xF;
|
||||
cellX = ((x + LEVEL_BOUNDARY_MAX) / CELL_SIZE) & (NUM_CELLS - 1);
|
||||
cellZ = ((z + LEVEL_BOUNDARY_MAX) / CELL_SIZE) & (NUM_CELLS - 1);
|
||||
|
||||
// Check for surfaces belonging to objects.
|
||||
surfaceList = gDynamicSurfacePartition[cellZ][cellX][SPATIAL_PARTITION_CEILS].next;
|
||||
@ -486,7 +486,7 @@ f32 find_floor_height(f32 x, f32 y, f32 z) {
|
||||
f32 unused_find_dynamic_floor(f32 xPos, f32 yPos, f32 zPos, struct Surface **pfloor) {
|
||||
struct SurfaceNode *surfaceList;
|
||||
struct Surface *floor;
|
||||
f32 floorHeight = -11000.0f;
|
||||
f32 floorHeight = FLOOR_LOWER_LIMIT;
|
||||
|
||||
// Would normally cause PUs, but dynamic floors unload at that range.
|
||||
s16 x = (s16) xPos;
|
||||
@ -494,8 +494,8 @@ f32 unused_find_dynamic_floor(f32 xPos, f32 yPos, f32 zPos, struct Surface **pfl
|
||||
s16 z = (s16) zPos;
|
||||
|
||||
// Each level is split into cells to limit load, find the appropriate cell.
|
||||
s16 cellX = ((x + LEVEL_BOUNDARY_MAX) / CELL_SIZE) & 0x0F;
|
||||
s16 cellZ = ((z + LEVEL_BOUNDARY_MAX) / CELL_SIZE) & 0x0F;
|
||||
s16 cellX = ((x + LEVEL_BOUNDARY_MAX) / CELL_SIZE) & (NUM_CELLS - 1);
|
||||
s16 cellZ = ((z + LEVEL_BOUNDARY_MAX) / CELL_SIZE) & (NUM_CELLS - 1);
|
||||
|
||||
surfaceList = gDynamicSurfacePartition[cellZ][cellX][SPATIAL_PARTITION_FLOORS].next;
|
||||
floor = find_floor_from_list(surfaceList, x, y, z, &floorHeight);
|
||||
@ -514,8 +514,8 @@ f32 find_floor(f32 xPos, f32 yPos, f32 zPos, struct Surface **pfloor) {
|
||||
struct Surface *floor, *dynamicFloor;
|
||||
struct SurfaceNode *surfaceList;
|
||||
|
||||
f32 height = -11000.0f;
|
||||
f32 dynamicHeight = -11000.0f;
|
||||
f32 height = FLOOR_LOWER_LIMIT;
|
||||
f32 dynamicHeight = FLOOR_LOWER_LIMIT;
|
||||
|
||||
//! (Parallel Universes) Because position is casted to an s16, reaching higher
|
||||
// float locations can return floors despite them not existing there.
|
||||
@ -534,8 +534,8 @@ f32 find_floor(f32 xPos, f32 yPos, f32 zPos, struct Surface **pfloor) {
|
||||
}
|
||||
|
||||
// Each level is split into cells to limit load, find the appropriate cell.
|
||||
cellX = ((x + LEVEL_BOUNDARY_MAX) / CELL_SIZE) & 0xF;
|
||||
cellZ = ((z + LEVEL_BOUNDARY_MAX) / CELL_SIZE) & 0xF;
|
||||
cellX = ((x + LEVEL_BOUNDARY_MAX) / CELL_SIZE) & (NUM_CELLS - 1);
|
||||
cellZ = ((z + LEVEL_BOUNDARY_MAX) / CELL_SIZE) & (NUM_CELLS - 1);
|
||||
|
||||
// Check for surfaces belonging to objects.
|
||||
surfaceList = gDynamicSurfacePartition[cellZ][cellX][SPATIAL_PARTITION_FLOORS].next;
|
||||
@ -591,7 +591,7 @@ f32 find_water_level(f32 x, f32 z) {
|
||||
s32 numRegions;
|
||||
s16 val;
|
||||
f32 loX, hiX, loZ, hiZ;
|
||||
f32 waterLevel = -11000.0f;
|
||||
f32 waterLevel = FLOOR_LOWER_LIMIT;
|
||||
s16 *p = gEnvironmentRegions;
|
||||
|
||||
if (p != NULL) {
|
||||
@ -627,7 +627,7 @@ f32 find_poison_gas_level(f32 x, f32 z) {
|
||||
UNUSED s32 unused;
|
||||
s16 val;
|
||||
f32 loX, hiX, loZ, hiZ;
|
||||
f32 gasLevel = -11000.0f;
|
||||
f32 gasLevel = FLOOR_LOWER_LIMIT;
|
||||
s16 *p = gEnvironmentRegions;
|
||||
|
||||
if (p != NULL) {
|
||||
@ -689,25 +689,25 @@ void debug_surface_list_info(f32 xPos, f32 zPos) {
|
||||
s32 cellX = (xPos + LEVEL_BOUNDARY_MAX) / CELL_SIZE;
|
||||
s32 cellZ = (zPos + LEVEL_BOUNDARY_MAX) / CELL_SIZE;
|
||||
|
||||
list = gStaticSurfacePartition[cellZ & 0x0F][cellX & 0x0F][SPATIAL_PARTITION_FLOORS].next;
|
||||
list = gStaticSurfacePartition[cellZ & (NUM_CELLS - 1)][cellX & (NUM_CELLS - 1)][SPATIAL_PARTITION_FLOORS].next;
|
||||
numFloors += surface_list_length(list);
|
||||
|
||||
list = gDynamicSurfacePartition[cellZ & 0x0F][cellX & 0x0F][SPATIAL_PARTITION_FLOORS].next;
|
||||
list = gDynamicSurfacePartition[cellZ & (NUM_CELLS - 1)][cellX & (NUM_CELLS - 1)][SPATIAL_PARTITION_FLOORS].next;
|
||||
numFloors += surface_list_length(list);
|
||||
|
||||
list = gStaticSurfacePartition[cellZ & 0x0F][cellX & 0x0F][SPATIAL_PARTITION_WALLS].next;
|
||||
list = gStaticSurfacePartition[cellZ & (NUM_CELLS - 1)][cellX & (NUM_CELLS - 1)][SPATIAL_PARTITION_WALLS].next;
|
||||
numWalls += surface_list_length(list);
|
||||
|
||||
list = gDynamicSurfacePartition[cellZ & 0x0F][cellX & 0x0F][SPATIAL_PARTITION_WALLS].next;
|
||||
list = gDynamicSurfacePartition[cellZ & (NUM_CELLS - 1)][cellX & (NUM_CELLS - 1)][SPATIAL_PARTITION_WALLS].next;
|
||||
numWalls += surface_list_length(list);
|
||||
|
||||
list = gStaticSurfacePartition[cellZ & 0x0F][cellX & 0x0F][SPATIAL_PARTITION_CEILS].next;
|
||||
list = gStaticSurfacePartition[cellZ & (NUM_CELLS - 1)][cellX & (NUM_CELLS - 1)][SPATIAL_PARTITION_CEILS].next;
|
||||
numCeils += surface_list_length(list);
|
||||
|
||||
list = gDynamicSurfacePartition[cellZ & 0x0F][cellX & 0x0F][SPATIAL_PARTITION_CEILS].next;
|
||||
list = gDynamicSurfacePartition[cellZ & (NUM_CELLS - 1)][cellX & (NUM_CELLS - 1)][SPATIAL_PARTITION_CEILS].next;
|
||||
numCeils += surface_list_length(list);
|
||||
|
||||
print_debug_top_down_mapinfo("area %x", cellZ * 16 + cellX);
|
||||
print_debug_top_down_mapinfo("area %x", cellZ * NUM_CELLS + cellX);
|
||||
|
||||
// Names represent ground, walls, and roofs as found in SMS.
|
||||
print_debug_top_down_mapinfo("dg %d", numFloors);
|
||||
|
@ -8,6 +8,9 @@
|
||||
#define LEVEL_BOUNDARY_MAX 0x2000
|
||||
#define CELL_SIZE 0x400
|
||||
|
||||
#define CELL_HEIGHT_LIMIT 20000.f
|
||||
#define FLOOR_LOWER_LIMIT -11000.f
|
||||
|
||||
struct WallCollisionData
|
||||
{
|
||||
/*0x00*/ f32 x, y, z;
|
||||
|
@ -21,8 +21,8 @@ s32 unused8038BE90;
|
||||
* Partitions for course and object surfaces. The arrays represent
|
||||
* the 16x16 cells that each level is split into.
|
||||
*/
|
||||
SpatialPartitionCell gStaticSurfacePartition[16][16];
|
||||
SpatialPartitionCell gDynamicSurfacePartition[16][16];
|
||||
SpatialPartitionCell gStaticSurfacePartition[NUM_CELLS][NUM_CELLS];
|
||||
SpatialPartitionCell gDynamicSurfacePartition[NUM_CELLS][NUM_CELLS];
|
||||
|
||||
/**
|
||||
* Pools of data to contain either surface nodes or surfaces.
|
||||
@ -83,7 +83,7 @@ static struct Surface *alloc_surface(void) {
|
||||
* Iterates through the entire partition, clearing the surfaces.
|
||||
*/
|
||||
static void clear_spatial_partition(SpatialPartitionCell *cells) {
|
||||
register s32 i = 16 * 16;
|
||||
register s32 i = NUM_CELLS * NUM_CELLS;
|
||||
|
||||
while (i--) {
|
||||
(*cells)[SPATIAL_PARTITION_FLOORS].next = NULL;
|
||||
@ -201,18 +201,18 @@ static s16 lower_cell_index(s16 coord) {
|
||||
s16 index;
|
||||
|
||||
// Move from range [-0x2000, 0x2000) to [0, 0x4000)
|
||||
coord += 0x2000;
|
||||
coord += LEVEL_BOUNDARY_MAX;
|
||||
if (coord < 0) {
|
||||
coord = 0;
|
||||
}
|
||||
|
||||
// [0, 16)
|
||||
index = coord / 0x400;
|
||||
index = coord / CELL_SIZE;
|
||||
|
||||
// Include extra cell if close to boundary
|
||||
//! Some wall checks are larger than the buffer, meaning wall checks can
|
||||
// miss walls that are near a cell border.
|
||||
if (coord % 0x400 < 50) {
|
||||
if (coord % CELL_SIZE < 50) {
|
||||
index -= 1;
|
||||
}
|
||||
|
||||
@ -233,23 +233,23 @@ static s16 upper_cell_index(s16 coord) {
|
||||
s16 index;
|
||||
|
||||
// Move from range [-0x2000, 0x2000) to [0, 0x4000)
|
||||
coord += 0x2000;
|
||||
coord += LEVEL_BOUNDARY_MAX;
|
||||
if (coord < 0) {
|
||||
coord = 0;
|
||||
}
|
||||
|
||||
// [0, 16)
|
||||
index = coord / 0x400;
|
||||
index = coord / CELL_SIZE;
|
||||
|
||||
// Include extra cell if close to boundary
|
||||
//! Some wall checks are larger than the buffer, meaning wall checks can
|
||||
// miss walls that are near a cell border.
|
||||
if (coord % 0x400 > 0x400 - 50) {
|
||||
if (coord % CELL_SIZE > CELL_SIZE - 50) {
|
||||
index += 1;
|
||||
}
|
||||
|
||||
if (index > 15) {
|
||||
index = 15;
|
||||
if (index > (NUM_CELLS - 1)) {
|
||||
index = (NUM_CELLS - 1);
|
||||
}
|
||||
|
||||
// Potentially < 0, but since lower index is >= 0, not exploitable
|
||||
|
@ -5,6 +5,10 @@
|
||||
|
||||
#include "types.h"
|
||||
|
||||
// NUM_CELLS needs to be a power of 2 so that the bitwise
|
||||
// in surface_collision.c functions can work properly
|
||||
#define NUM_CELLS 16
|
||||
|
||||
struct SurfaceNode
|
||||
{
|
||||
struct SurfaceNode *next;
|
||||
@ -23,8 +27,8 @@ typedef struct SurfaceNode SpatialPartitionCell[3];
|
||||
// Needed for bs bss reordering memes.
|
||||
extern s32 unused8038BE90;
|
||||
|
||||
extern SpatialPartitionCell gStaticSurfacePartition[16][16];
|
||||
extern SpatialPartitionCell gDynamicSurfacePartition[16][16];
|
||||
extern SpatialPartitionCell gStaticSurfacePartition[NUM_CELLS][NUM_CELLS];
|
||||
extern SpatialPartitionCell gDynamicSurfacePartition[NUM_CELLS][NUM_CELLS];
|
||||
extern struct SurfaceNode *sSurfaceNodePool;
|
||||
extern struct Surface *sSurfacePool;
|
||||
extern s16 sSurfacePoolSize;
|
||||
|
@ -58,7 +58,6 @@ s16 gCurrLevelNum = LEVEL_MIN;
|
||||
* the spawn behavior executed, the index of that behavior is used with sSpawnTypeFromWarpBhv
|
||||
*/
|
||||
|
||||
// D_8032CE9C
|
||||
const BehaviorScript *sWarpBhvSpawnTable[] = {
|
||||
bhvDoorWarp, bhvStar, bhvExitPodiumWarp, bhvWarp,
|
||||
bhvWarpPipe, bhvFadingWarp, bhvInstantActiveWarp, bhvAirborneWarp,
|
||||
@ -67,7 +66,6 @@ const BehaviorScript *sWarpBhvSpawnTable[] = {
|
||||
bhvAirborneStarCollectWarp, bhvAirborneDeathWarp, bhvLaunchStarCollectWarp, bhvLaunchDeathWarp,
|
||||
};
|
||||
|
||||
// D_8032CEEC
|
||||
u8 sSpawnTypeFromWarpBhv[] = {
|
||||
MARIO_SPAWN_DOOR_WARP, MARIO_SPAWN_UNKNOWN_02, MARIO_SPAWN_UNKNOWN_03, MARIO_SPAWN_UNKNOWN_03,
|
||||
MARIO_SPAWN_UNKNOWN_03, MARIO_SPAWN_TELEPORT, MARIO_SPAWN_INSTANT_ACTIVE, MARIO_SPAWN_AIRBORNE,
|
||||
@ -108,7 +106,7 @@ void set_warp_transition_rgb(u8 red, u8 green, u8 blue) {
|
||||
|
||||
void print_intro_text(void) {
|
||||
#ifdef VERSION_EU
|
||||
int language = eu_get_language();
|
||||
s32 language = eu_get_language();
|
||||
#endif
|
||||
if ((gGlobalTimer & 0x1F) < 20) {
|
||||
if (gControllerBits == 0) {
|
||||
@ -285,7 +283,7 @@ void change_area(s32 index) {
|
||||
}
|
||||
|
||||
if (areaFlags & 0x01) {
|
||||
gMarioObject->header.gfx.unk18 = index, gMarioSpawnInfo->areaIndex = index;
|
||||
gMarioObject->header.gfx.areaIndex = index, gMarioSpawnInfo->areaIndex = index;
|
||||
}
|
||||
}
|
||||
|
||||
@ -406,7 +404,7 @@ void render_game(void) {
|
||||
}
|
||||
} else {
|
||||
render_text_labels();
|
||||
if (D_8032CE78 != 0) {
|
||||
if (D_8032CE78 != NULL) {
|
||||
clear_viewport(D_8032CE78, gWarpTransFBSetColor);
|
||||
} else {
|
||||
clear_frame_buffer(gWarpTransFBSetColor);
|
||||
@ -414,5 +412,5 @@ void render_game(void) {
|
||||
}
|
||||
|
||||
D_8032CE74 = NULL;
|
||||
D_8032CE78 = 0;
|
||||
D_8032CE78 = NULL;
|
||||
}
|
||||
|
@ -244,7 +244,7 @@ void vec3f_copy_2(Vec3f dest, Vec3f src) {
|
||||
|
||||
s32 set_obj_anim_with_accel_and_sound(s16 a0, s16 a1, s32 a2) {
|
||||
f32 sp1C;
|
||||
if ((sp1C = o->header.gfx.unk38.animAccel / (f32) 0x10000) == 0)
|
||||
if ((sp1C = o->header.gfx.animInfo.animAccel / (f32) 0x10000) == 0)
|
||||
sp1C = 1.0f;
|
||||
if (cur_obj_check_anim_frame_in_range(a0, sp1C) || cur_obj_check_anim_frame_in_range(a1, sp1C)) {
|
||||
cur_obj_play_sound_2(a2);
|
||||
|
@ -146,7 +146,7 @@ static void homing_amp_chase_loop(void) {
|
||||
check_amp_attack();
|
||||
|
||||
// Give up if Mario goes further than 1500 units from the amp's original position
|
||||
if (is_point_within_radius_of_mario(o->oHomeX, o->oHomeY, o->oHomeZ, 1500) == FALSE) {
|
||||
if (!is_point_within_radius_of_mario(o->oHomeX, o->oHomeY, o->oHomeZ, 1500)) {
|
||||
o->oAction = HOMING_AMP_ACT_GIVE_UP;
|
||||
}
|
||||
}
|
||||
@ -178,7 +178,7 @@ static void homing_amp_give_up_loop(void) {
|
||||
*/
|
||||
static void amp_attack_cooldown_loop(void) {
|
||||
// Turn intangible and wait for 90 frames before chasing Mario again after hitting him.
|
||||
o->header.gfx.unk38.animFrame += 2;
|
||||
o->header.gfx.animInfo.animFrame += 2;
|
||||
o->oForwardVel = 0;
|
||||
|
||||
cur_obj_become_intangible();
|
||||
|
@ -88,7 +88,7 @@ void bhv_merry_go_round_loop(void) {
|
||||
}
|
||||
|
||||
// Rotate the merry-go-round and play appropriate music if it's not stopped.
|
||||
if (o->oMerryGoRoundStopped == FALSE) {
|
||||
if (!o->oMerryGoRoundStopped) {
|
||||
o->oAngleVelYaw = 0x80;
|
||||
o->oMoveAngleYaw += o->oAngleVelYaw;
|
||||
o->oFaceAngleYaw += o->oAngleVelYaw;
|
||||
|
@ -68,7 +68,7 @@ void bhv_blue_coin_switch_loop(void) {
|
||||
// If Mario is on the switch and has ground-pounded,
|
||||
// recede and get ready to start ticking.
|
||||
if (gMarioObject->platform == o) {
|
||||
if (gMarioStates->action == ACT_GROUND_POUND_LAND) {
|
||||
if (gMarioStates[0].action == ACT_GROUND_POUND_LAND) {
|
||||
// Set to BLUE_COIN_SWITCH_ACT_RECEDING
|
||||
o->oAction++;
|
||||
|
||||
|
@ -69,12 +69,12 @@ void bobomb_act_patrol(void) {
|
||||
UNUSED s16 sp22;
|
||||
s16 collisionFlags;
|
||||
|
||||
sp22 = o->header.gfx.unk38.animFrame;
|
||||
sp22 = o->header.gfx.animInfo.animFrame;
|
||||
o->oForwardVel = 5.0;
|
||||
|
||||
collisionFlags = object_step();
|
||||
if ((obj_return_home_if_safe(o, o->oHomeX, o->oHomeY, o->oHomeZ, 400) == 1)
|
||||
&& (obj_check_if_facing_toward_angle(o->oMoveAngleYaw, o->oAngleToMario, 0x2000) == 1)) {
|
||||
&& (obj_check_if_facing_toward_angle(o->oMoveAngleYaw, o->oAngleToMario, 0x2000) == TRUE)) {
|
||||
o->oBobombFuseLit = 1;
|
||||
o->oAction = BOBOMB_ACT_CHASE_MARIO;
|
||||
}
|
||||
@ -85,7 +85,7 @@ void bobomb_act_chase_mario(void) {
|
||||
UNUSED u8 filler[4];
|
||||
s16 sp1a, collisionFlags;
|
||||
|
||||
sp1a = ++o->header.gfx.unk38.animFrame;
|
||||
sp1a = ++o->header.gfx.animInfo.animFrame;
|
||||
o->oForwardVel = 20.0;
|
||||
|
||||
collisionFlags = object_step();
|
||||
@ -286,7 +286,7 @@ void bhv_bobomb_buddy_init(void) {
|
||||
|
||||
void bobomb_buddy_act_idle(void) {
|
||||
UNUSED u8 filler[4];
|
||||
s16 sp1a = o->header.gfx.unk38.animFrame;
|
||||
s16 sp1a = o->header.gfx.animInfo.animFrame;
|
||||
UNUSED s16 collisionFlags = 0;
|
||||
|
||||
o->oBobombBuddyPosXCopy = o->oPosX;
|
||||
@ -383,7 +383,7 @@ void bobomb_buddy_act_talk(void) {
|
||||
}
|
||||
|
||||
void bobomb_buddy_act_turn_to_talk(void) {
|
||||
s16 sp1e = o->header.gfx.unk38.animFrame;
|
||||
s16 sp1e = o->header.gfx.animInfo.animFrame;
|
||||
if ((sp1e == 5) || (sp1e == 16))
|
||||
cur_obj_play_sound_2(SOUND_OBJ_BOBOMB_WALK);
|
||||
|
||||
|
@ -31,7 +31,7 @@ void bhv_boo_init(void) {
|
||||
|
||||
static s32 boo_should_be_stopped(void) {
|
||||
if (cur_obj_has_behavior(bhvMerryGoRoundBigBoo) || cur_obj_has_behavior(bhvMerryGoRoundBoo)) {
|
||||
if (gMarioOnMerryGoRound == FALSE) {
|
||||
if (!gMarioOnMerryGoRound) {
|
||||
return TRUE;
|
||||
} else {
|
||||
return FALSE;
|
||||
@ -312,7 +312,7 @@ static s32 boo_get_attack_status(void) {
|
||||
s32 attackStatus = BOO_NOT_ATTACKED;
|
||||
|
||||
if (o->oInteractStatus & INT_STATUS_INTERACTED) {
|
||||
if ((o->oInteractStatus & INT_STATUS_WAS_ATTACKED) && obj_has_attack_type(ATTACK_FROM_ABOVE) == FALSE) {
|
||||
if ((o->oInteractStatus & INT_STATUS_WAS_ATTACKED) && !obj_has_attack_type(ATTACK_FROM_ABOVE)) {
|
||||
cur_obj_become_intangible();
|
||||
|
||||
o->oInteractStatus = 0;
|
||||
@ -554,7 +554,7 @@ static void big_boo_act_1(void) {
|
||||
|
||||
// redundant; this check is in boo_should_be_stopped
|
||||
if (cur_obj_has_behavior(bhvMerryGoRoundBigBoo)) {
|
||||
if (gMarioOnMerryGoRound == FALSE) {
|
||||
if (!gMarioOnMerryGoRound) {
|
||||
o->oAction = 0;
|
||||
}
|
||||
} else if (boo_should_be_stopped()) {
|
||||
|
@ -54,8 +54,8 @@ void bhv_bowser_flame_spawn_loop(void) {
|
||||
f32 sp20 = sins(bowser->oMoveAngleYaw);
|
||||
s16 *sp1C = segmented_to_virtual(bowser_seg6_unkmoveshorts_060576FC);
|
||||
if (bowser->oSoundStateID == 6) {
|
||||
sp30 = bowser->header.gfx.unk38.animFrame + 1.0f;
|
||||
if (bowser->header.gfx.unk38.curAnim->unk08 == sp30)
|
||||
sp30 = bowser->header.gfx.animInfo.animFrame + 1.0f;
|
||||
if (bowser->header.gfx.animInfo.curAnim->loopEnd == sp30)
|
||||
sp30 = 0;
|
||||
if (sp30 > 45 && sp30 < 85) {
|
||||
cur_obj_play_sound_1(SOUND_AIR_BOWSER_SPIT_FIRE);
|
||||
@ -398,7 +398,7 @@ void bowser_act_spit_fire_into_sky(void) // only in sky
|
||||
{
|
||||
s32 frame;
|
||||
cur_obj_init_animation_with_sound(11);
|
||||
frame = o->header.gfx.unk38.animFrame;
|
||||
frame = o->header.gfx.animInfo.animFrame;
|
||||
if (frame > 24 && frame < 36) {
|
||||
cur_obj_play_sound_1(SOUND_AIR_BOWSER_SPIT_FIRE);
|
||||
if (frame == 35)
|
||||
@ -458,7 +458,7 @@ s32 bowser_land(void) {
|
||||
o->oVelY = 0;
|
||||
spawn_mist_particles_variable(0, 0, 60.0f);
|
||||
cur_obj_init_animation_with_sound(8);
|
||||
o->header.gfx.unk38.animFrame = 0;
|
||||
o->header.gfx.animInfo.animFrame = 0;
|
||||
cur_obj_start_cam_event(o, CAM_EVENT_BOWSER_JUMP);
|
||||
if (BITDW) {
|
||||
if (o->oDistanceToMario < 850.0f)
|
||||
@ -1033,7 +1033,7 @@ void bowser_free_update(void) {
|
||||
struct Object *platform;
|
||||
UNUSED f32 floorHeight;
|
||||
if ((platform = o->platform) != NULL)
|
||||
apply_platform_displacement(0, platform);
|
||||
apply_platform_displacement(FALSE, platform);
|
||||
o->oBowserUnk10E = 0;
|
||||
cur_obj_update_floor_and_walls();
|
||||
cur_obj_call_action_function(sBowserActions);
|
||||
|
@ -11,7 +11,7 @@ Gfx *geo_scale_bowser_key(s32 run, struct GraphNode *node, UNUSED f32 mtx[4][4])
|
||||
|
||||
void bhv_bowser_key_unlock_door_loop(void) {
|
||||
s32 animTimer;
|
||||
animTimer = o->header.gfx.unk38.animFrame;
|
||||
animTimer = o->header.gfx.animInfo.animFrame;
|
||||
cur_obj_init_animation_with_sound(0);
|
||||
if (animTimer < 38)
|
||||
o->oBowserKeyScale = 0.0f;
|
||||
@ -30,7 +30,7 @@ void bhv_bowser_key_unlock_door_loop(void) {
|
||||
}
|
||||
|
||||
void bhv_bowser_key_course_exit_loop(void) {
|
||||
s32 animTimer = o->header.gfx.unk38.animFrame;
|
||||
s32 animTimer = o->header.gfx.animInfo.animFrame;
|
||||
cur_obj_init_animation_with_sound(1);
|
||||
if (animTimer < 38)
|
||||
o->oBowserKeyScale = 0.2f;
|
||||
|
@ -1,7 +1,7 @@
|
||||
// breakable_wall.c.inc
|
||||
|
||||
void bhv_wf_breakable_wall_loop(void) {
|
||||
if (gMarioStates->action == ACT_SHOT_FROM_CANNON) {
|
||||
if (gMarioStates[0].action == ACT_SHOT_FROM_CANNON) {
|
||||
cur_obj_become_tangible();
|
||||
if (obj_check_if_collided_with_object(o, gMarioObject)) {
|
||||
if (cur_obj_has_behavior(bhvWfBreakableWallRight))
|
||||
|
@ -98,7 +98,7 @@ void bully_act_knockback(void) {
|
||||
o->oMoveAngleYaw = o->oFaceAngleYaw;
|
||||
obj_turn_toward_object(o, gMarioObject, 16, 1280);
|
||||
} else
|
||||
o->header.gfx.unk38.animFrame = 0;
|
||||
o->header.gfx.animInfo.animFrame = 0;
|
||||
|
||||
if (o->oBullyKBTimerAndMinionKOCounter == 18) {
|
||||
o->oAction = BULLY_ACT_CHASE_MARIO;
|
||||
@ -139,7 +139,7 @@ void bully_backup_check(s16 collisionFlags) {
|
||||
}
|
||||
|
||||
void bully_play_stomping_sound(void) {
|
||||
s16 sp26 = o->header.gfx.unk38.animFrame;
|
||||
s16 sp26 = o->header.gfx.animInfo.animFrame;
|
||||
switch (o->oAction) {
|
||||
case BULLY_ACT_PATROL:
|
||||
if (sp26 == 0 || sp26 == 12) {
|
||||
|
@ -4,7 +4,7 @@ void bhv_butterfly_init(void) {
|
||||
cur_obj_init_animation(1);
|
||||
|
||||
o->oButterflyYPhase = random_float() * 100.0f;
|
||||
o->header.gfx.unk38.animFrame = random_float() * 7.0f;
|
||||
o->header.gfx.animInfo.animFrame = random_float() * 7.0f;
|
||||
o->oHomeX = o->oPosX;
|
||||
o->oHomeY = o->oPosY;
|
||||
o->oHomeZ = o->oPosZ;
|
||||
|
@ -13,7 +13,7 @@
|
||||
void bhv_camera_lakitu_init(void) {
|
||||
if (o->oBehParams2ndByte != CAMERA_LAKITU_BP_FOLLOW_CAMERA) {
|
||||
// Despawn unless this is the very beginning of the game
|
||||
if (gShouldNotPlayCastleMusic != TRUE) {
|
||||
if (gNeverEnteredCastle != TRUE) {
|
||||
obj_mark_for_deletion(o);
|
||||
}
|
||||
} else {
|
||||
|
@ -1,6 +1,7 @@
|
||||
// castle_cannon_grate.inc.c
|
||||
|
||||
void bhv_castle_cannon_grate_init(void) {
|
||||
if (save_file_get_total_star_count(gCurrSaveFileNum - 1, 0, 24) >= 120)
|
||||
if (save_file_get_total_star_count(gCurrSaveFileNum - 1, COURSE_MIN - 1, COURSE_MAX - 1) >= 120) {
|
||||
o->activeFlags = ACTIVE_FLAG_DEACTIVATED;
|
||||
}
|
||||
}
|
||||
|
@ -1,5 +1,5 @@
|
||||
// castle_flag.inc.c
|
||||
|
||||
void bhv_castle_flag_init(void) {
|
||||
o->header.gfx.unk38.animFrame = random_float() * 28.0f;
|
||||
o->header.gfx.animInfo.animFrame = random_float() * 28.0f;
|
||||
}
|
||||
|
@ -14,8 +14,8 @@ void bhv_castle_floor_trap_init(void) {
|
||||
}
|
||||
|
||||
void bhv_castle_floor_trap_open_detect(void) {
|
||||
if (gMarioStates->action == ACT_SPECIAL_EXIT_AIRBORNE
|
||||
|| gMarioStates->action == ACT_SPECIAL_DEATH_EXIT)
|
||||
if (gMarioStates[0].action == ACT_SPECIAL_EXIT_AIRBORNE
|
||||
|| gMarioStates[0].action == ACT_SPECIAL_DEATH_EXIT)
|
||||
o->oAction = 4; // rotates trapdoor so it looks always open
|
||||
else {
|
||||
o->oAngleVelRoll = 0x400;
|
||||
|
@ -9,15 +9,15 @@ void common_anchor_mario_behavior(f32 sp28, f32 sp2C, s32 sp30) {
|
||||
break;
|
||||
case 2:
|
||||
gMarioObject->oInteractStatus |= (sp30 + INT_STATUS_MARIO_UNK2);
|
||||
gMarioStates->forwardVel = sp28;
|
||||
gMarioStates->vel[1] = sp2C;
|
||||
gMarioStates[0].forwardVel = sp28;
|
||||
gMarioStates[0].vel[1] = sp2C;
|
||||
o->parentObj->oChuckyaUnk88 = 0;
|
||||
break;
|
||||
case 3:
|
||||
gMarioObject->oInteractStatus |=
|
||||
(INT_STATUS_MARIO_UNK2 + INT_STATUS_MARIO_UNK6); // loads 2 interactions at once?
|
||||
gMarioStates->forwardVel = 10.0f;
|
||||
gMarioStates->vel[1] = 10.0f;
|
||||
gMarioStates[0].forwardVel = 10.0f;
|
||||
gMarioStates[0].vel[1] = 10.0f;
|
||||
o->parentObj->oChuckyaUnk88 = 0;
|
||||
break;
|
||||
}
|
||||
|
@ -138,9 +138,7 @@ void spawn_coin_in_formation(s32 sp50, s32 sp54) {
|
||||
Vec3i sp40;
|
||||
s32 sp3C = 1;
|
||||
s32 sp38 = 1;
|
||||
UNUSED s32 unused;
|
||||
sp40[2] = 0;
|
||||
sp40[0] = (sp40[1] = sp40[2]);
|
||||
sp40[0] = sp40[1] = sp40[2] = 0;
|
||||
switch (sp54 & 7) {
|
||||
case 0:
|
||||
sp40[2] = 160 * (sp50 - 2);
|
||||
|
@ -96,7 +96,7 @@ void dorrie_act_raise_head(void) {
|
||||
o->collisionData = segmented_to_virtual(dorrie_seg6_collision_0600F644);
|
||||
if (cur_obj_check_if_near_animation_end()) {
|
||||
o->oAction = DORRIE_ACT_MOVE;
|
||||
} else if (o->oDorrieLiftingMario && o->header.gfx.unk38.animFrame < 74) {
|
||||
} else if (o->oDorrieLiftingMario && o->header.gfx.animInfo.animFrame < 74) {
|
||||
if (set_mario_npc_dialog(2) == 2) {
|
||||
o->oDorrieHeadRaiseSpeed += 0x1CC;
|
||||
if (cur_obj_check_anim_frame(73)) {
|
||||
|
@ -226,7 +226,7 @@ void fish_group_act_move(void) {
|
||||
*/
|
||||
void fish_group_act_animate(void) {
|
||||
cur_obj_init_animation_with_accel_and_sound(0, 1.0f);
|
||||
o->header.gfx.unk38.animFrame = (s16)(random_float() * 28.0f);
|
||||
o->header.gfx.animInfo.animFrame = (s16)(random_float() * 28.0f);
|
||||
o->oFishDepthDistance = random_float() * 300.0f;
|
||||
cur_obj_scale(random_float() * 0.4 + 0.8);
|
||||
o->oAction = FISH_ACT_ACTIVE;
|
||||
|
@ -15,24 +15,24 @@ void bhv_small_piranha_flame_loop(void) {
|
||||
}
|
||||
} else {
|
||||
cur_obj_update_floor_and_walls();
|
||||
if (approach_f32_ptr(&o->oSmallPiranhaFlameUnkF4, o->oSmallPiranhaFlameUnkF8, 0.6f)) {
|
||||
if (approach_f32_ptr(&o->oSmallPiranhaFlameStartSpeed, o->oSmallPiranhaFlameEndSpeed, 0.6f)) {
|
||||
cur_obj_rotate_yaw_toward(o->oAngleToMario, 0x200);
|
||||
}
|
||||
|
||||
obj_compute_vel_from_move_pitch(o->oSmallPiranhaFlameUnkF4);
|
||||
obj_compute_vel_from_move_pitch(o->oSmallPiranhaFlameStartSpeed);
|
||||
cur_obj_move_standard(-78);
|
||||
spawn_object_with_scale(o, o->oSmallPiranhaFlameUnkFC, bhvSmallPiranhaFlame,
|
||||
spawn_object_with_scale(o, o->oSmallPiranhaFlameModel, bhvSmallPiranhaFlame,
|
||||
0.4f * o->header.gfx.scale[0]);
|
||||
|
||||
if (o->oTimer > o->oSmallPiranhaFlameUnk100) {
|
||||
spawn_object_relative_with_scale(1, 0, o->oGraphYOffset, 0, o->header.gfx.scale[0], o,
|
||||
o->oSmallPiranhaFlameUnkFC, bhvFlyguyFlame);
|
||||
o->oSmallPiranhaFlameModel, bhvFlyguyFlame);
|
||||
o->oSmallPiranhaFlameUnk100 = random_linear_offset(8, 15);
|
||||
o->oTimer = 0;
|
||||
}
|
||||
|
||||
obj_check_attacks(&sPiranhaPlantFireHitbox, o->oAction);
|
||||
o->oSmallPiranhaFlameUnk104 += o->oSmallPiranhaFlameUnkF4;
|
||||
o->oSmallPiranhaFlameUnk104 += o->oSmallPiranhaFlameStartSpeed;
|
||||
|
||||
if (o->oSmallPiranhaFlameUnk104 > 1500.0f || (o->oMoveFlags & (OBJ_MOVE_HIT_WALL | OBJ_MOVE_MASK_IN_WATER))) {
|
||||
obj_die_if_health_non_positive();
|
||||
|
@ -40,7 +40,7 @@ void bhv_flamethrower_loop(void) {
|
||||
s32 model;
|
||||
UNUSED u8 pad[8];
|
||||
if (o->oAction == 0) {
|
||||
if (gCurrLevelNum != LEVEL_BBH || gMarioOnMerryGoRound == 1)
|
||||
if (gCurrLevelNum != LEVEL_BBH || gMarioOnMerryGoRound == TRUE)
|
||||
if (o->oDistanceToMario < 2000.0f)
|
||||
o->oAction++;
|
||||
} else if (o->oAction == 1) {
|
||||
|
@ -16,8 +16,8 @@ void bhv_heave_ho_throw_mario_loop(void) {
|
||||
case 2:
|
||||
cur_obj_play_sound_2(SOUND_OBJ_HEAVEHO_TOSSED);
|
||||
gMarioObject->oInteractStatus |= INT_STATUS_MARIO_UNK2;
|
||||
gMarioStates->forwardVel = -45.0f;
|
||||
gMarioStates->vel[1] = 95.0f;
|
||||
gMarioStates[0].forwardVel = -45.0f;
|
||||
gMarioStates[0].vel[1] = 95.0f;
|
||||
o->parentObj->oHeaveHoUnk88 = 0;
|
||||
break;
|
||||
}
|
||||
@ -27,7 +27,7 @@ void heave_ho_act_1(void) {
|
||||
s32 sp1C = 0;
|
||||
o->oForwardVel = 0.0f;
|
||||
cur_obj_reverse_animation();
|
||||
while (1) {
|
||||
while (TRUE) {
|
||||
if (D_8032F460[sp1C][0] == -1) {
|
||||
o->oAction = 2;
|
||||
break;
|
||||
|
@ -49,7 +49,7 @@ void hoot_free_step(s16 fastOscY, s32 speed) {
|
||||
struct FloorGeometry *sp2c;
|
||||
s16 yaw = o->oMoveAngleYaw;
|
||||
s16 pitch = o->oMoveAnglePitch;
|
||||
s16 sp26 = o->header.gfx.unk38.animFrame;
|
||||
s16 sp26 = o->header.gfx.animInfo.animFrame;
|
||||
f32 xPrev = o->oPosX;
|
||||
f32 zPrev = o->oPosZ;
|
||||
f32 hSpeed;
|
||||
@ -95,7 +95,7 @@ void hoot_player_set_yaw(void) {
|
||||
void hoot_carry_step(s32 speed, UNUSED f32 xPrev, UNUSED f32 zPrev) {
|
||||
s16 yaw = o->oMoveAngleYaw;
|
||||
s16 pitch = o->oMoveAnglePitch;
|
||||
s16 sp22 = o->header.gfx.unk38.animFrame;
|
||||
s16 sp22 = o->header.gfx.animInfo.animFrame;
|
||||
f32 hSpeed;
|
||||
|
||||
o->oVelY = sins(pitch) * speed;
|
||||
@ -161,7 +161,7 @@ void hoot_act_ascent(f32 xPrev, f32 zPrev) {
|
||||
|
||||
if (o->oTimer >= 29) {
|
||||
cur_obj_play_sound_1(SOUND_ENV_WIND2);
|
||||
o->header.gfx.unk38.animFrame = 1;
|
||||
o->header.gfx.animInfo.animFrame = 1;
|
||||
}
|
||||
|
||||
if (o->oPosY > 6500.0f)
|
||||
|
@ -29,7 +29,7 @@ void bhv_intro_peach_loop(void) {
|
||||
gCurrentObject->oIntroPeachPitchFromFocus = -9984.f;
|
||||
gCurrentObject->oIntroPeachYawFromFocus = -768.f;
|
||||
gCurrentObject->oOpacity = 255;
|
||||
gCurrentObject->header.gfx.unk38.animFrame = 100;
|
||||
gCurrentObject->header.gfx.animInfo.animFrame = 100;
|
||||
break;
|
||||
case 1:
|
||||
intro_peach_set_pos_and_opacity(gCurrentObject, 0.f, 0.f);
|
||||
|
@ -5,7 +5,7 @@ void spawn_child_obj_relative(struct Object *parent, s16 xOffset, s16 yOffset, s
|
||||
s32 model, const BehaviorScript *behavior) {
|
||||
struct Object *sp1C = spawn_object(parent, model, behavior);
|
||||
|
||||
sp1C->header.gfx.unk38.animFrame = random_float() * 6.f;
|
||||
sp1C->header.gfx.animInfo.animFrame = random_float() * 6.f;
|
||||
sp1C->oEndBirdUnk104 = sCutsceneVars[9].point[0];
|
||||
sCutsceneVars[9].point[0] += 1.f;
|
||||
sp1C->oPosX += xOffset;
|
||||
|
@ -3,17 +3,17 @@
|
||||
s32 check_mario_attacking(UNUSED s32 sp18) {
|
||||
if (obj_check_if_collided_with_object(o, gMarioObject)) {
|
||||
if (abs_angle_diff(o->oMoveAngleYaw, gMarioObject->oMoveAngleYaw) > 0x6000) {
|
||||
if (gMarioStates->action == ACT_SLIDE_KICK)
|
||||
if (gMarioStates[0].action == ACT_SLIDE_KICK)
|
||||
return 1;
|
||||
if (gMarioStates->action == ACT_PUNCHING)
|
||||
if (gMarioStates[0].action == ACT_PUNCHING)
|
||||
return 1;
|
||||
if (gMarioStates->action == ACT_MOVE_PUNCHING)
|
||||
if (gMarioStates[0].action == ACT_MOVE_PUNCHING)
|
||||
return 1;
|
||||
if (gMarioStates->action == ACT_SLIDE_KICK_SLIDE)
|
||||
if (gMarioStates[0].action == ACT_SLIDE_KICK_SLIDE)
|
||||
return 1;
|
||||
if (gMarioStates->action == ACT_JUMP_KICK)
|
||||
if (gMarioStates[0].action == ACT_JUMP_KICK)
|
||||
return 2;
|
||||
if (gMarioStates->action == ACT_WALL_KICK_AIR)
|
||||
if (gMarioStates[0].action == ACT_WALL_KICK_AIR)
|
||||
return 2;
|
||||
}
|
||||
}
|
||||
|
@ -22,8 +22,8 @@ void bhv_bobomb_anchor_mario_loop(void) {
|
||||
|
||||
void king_bobomb_act_0(void) {
|
||||
#ifndef VERSION_JP
|
||||
o->oForwardVel = 0;
|
||||
o->oVelY = 0;
|
||||
o->oForwardVel = 0.0f;
|
||||
o->oVelY = 0.0f;
|
||||
#endif
|
||||
if (o->oSubAction == 0) {
|
||||
cur_obj_become_intangible();
|
||||
@ -41,11 +41,12 @@ void king_bobomb_act_0(void) {
|
||||
}
|
||||
}
|
||||
|
||||
int mario_is_far_below_object(f32 arg0) {
|
||||
if (arg0 < o->oPosY - gMarioObject->oPosY)
|
||||
return 1;
|
||||
else
|
||||
return 0;
|
||||
s32 mario_is_far_below_object(f32 arg0) {
|
||||
if (arg0 < o->oPosY - gMarioObject->oPosY) {
|
||||
return TRUE;
|
||||
} else {
|
||||
return FALSE;
|
||||
}
|
||||
}
|
||||
|
||||
void king_bobomb_act_2(void) {
|
||||
|
@ -31,7 +31,7 @@ static s32 klepto_set_and_check_if_anim_at_end(void) {
|
||||
} else if (o->oSoundStateID == 5) {
|
||||
if (cur_obj_set_anim_if_at_end(0)) {
|
||||
cur_obj_play_sound_2(SOUND_GENERAL_SWISH_WATER);
|
||||
o->header.gfx.unk38.animFrame = 9;
|
||||
o->header.gfx.animInfo.animFrame = 9;
|
||||
}
|
||||
} else {
|
||||
if (cur_obj_check_anim_frame(9)) {
|
||||
|
@ -16,7 +16,7 @@ void koopa_shell_spawn_water_drop(void) {
|
||||
UNUSED s32 unused;
|
||||
struct Object *drop;
|
||||
spawn_object(o, MODEL_WAVE_TRAIL, bhvObjectWaveTrail);
|
||||
if (gMarioStates->forwardVel > 10.0f) {
|
||||
if (gMarioStates[0].forwardVel > 10.0f) {
|
||||
drop = spawn_object_with_scale(o, MODEL_WHITE_PARTICLE_SMALL, bhvWaterDroplet, 1.5f);
|
||||
drop->oVelY = random_float() * 30.0f;
|
||||
obj_translate_xz_random(drop, 110.0f);
|
||||
|
@ -36,7 +36,7 @@ void manta_ray_move(void) {
|
||||
s16 sp1E;
|
||||
s32 sp18;
|
||||
|
||||
sp1E = o->header.gfx.unk38.animFrame;
|
||||
sp1E = o->header.gfx.animInfo.animFrame;
|
||||
gCurrentObject->oPathedStartWaypoint = (struct Waypoint *) sMantaRayTraj;
|
||||
sp18 = cur_obj_follow_path(sp18);
|
||||
o->oMantaUnkF8 = o->oPathedTargetYaw;
|
||||
|
@ -29,7 +29,7 @@ void bhv_pushable_loop(void) {
|
||||
s16 sp1C;
|
||||
obj_set_hitbox(o, &sMetalBoxHitbox);
|
||||
o->oForwardVel = 0.0f;
|
||||
if (obj_check_if_collided_with_object(o, gMarioObject) && gMarioStates->flags & 0x80000000) {
|
||||
if (obj_check_if_collided_with_object(o, gMarioObject) && gMarioStates[0].flags & MARIO_UNKNOWN_31) {
|
||||
sp1C = obj_angle_to_object(o, gMarioObject);
|
||||
if (abs_angle_diff(sp1C, gMarioObject->oMoveAngleYaw) > 0x4000) {
|
||||
o->oMoveAngleYaw = (s16)((gMarioObject->oMoveAngleYaw + 0x2000) & 0xc000);
|
||||
|
@ -8,19 +8,19 @@
|
||||
*/
|
||||
void bhv_mips_init(void) {
|
||||
// Retrieve star flags for Castle Secret Stars on current save file.
|
||||
u8 starFlags;
|
||||
starFlags = save_file_get_star_flags(gCurrSaveFileNum - 1, -1);
|
||||
u8 starFlags = save_file_get_star_flags(gCurrSaveFileNum - 1, -1);
|
||||
|
||||
// If the player has >= 15 stars and hasn't collected first MIPS star...
|
||||
if (save_file_get_total_star_count(gCurrSaveFileNum - 1, 0, 24) >= 15 && (starFlags & 0x08) == 0) {
|
||||
if (save_file_get_total_star_count(gCurrSaveFileNum - 1, COURSE_MIN - 1, COURSE_MAX - 1) >= 15
|
||||
&& !(starFlags & SAVE_FLAG_TO_STAR_FLAG(SAVE_FLAG_COLLECTED_MIPS_STAR_1))) {
|
||||
o->oBehParams2ndByte = 0;
|
||||
#ifndef VERSION_JP
|
||||
o->oMipsForwardVelocity = 40.0f;
|
||||
#endif
|
||||
}
|
||||
// If the player has >= 50 stars and hasn't collected second MIPS star...
|
||||
else if (save_file_get_total_star_count(gCurrSaveFileNum - 1, 0, 24) >= 50
|
||||
&& (starFlags & 0x10) == 0) {
|
||||
else if (save_file_get_total_star_count(gCurrSaveFileNum - 1, COURSE_MIN - 1, COURSE_MAX - 1) >= 50
|
||||
&& !(starFlags & SAVE_FLAG_TO_STAR_FLAG(SAVE_FLAG_COLLECTED_MIPS_STAR_2))) {
|
||||
o->oBehParams2ndByte = 1;
|
||||
#ifndef VERSION_JP
|
||||
o->oMipsForwardVelocity = 45.0f;
|
||||
@ -164,7 +164,7 @@ void bhv_mips_act_fall_down(void) {
|
||||
s16 collisionFlags = 0;
|
||||
|
||||
collisionFlags = object_step();
|
||||
o->header.gfx.unk38.animFrame = 0;
|
||||
o->header.gfx.animInfo.animFrame = 0;
|
||||
|
||||
if ((collisionFlags & OBJ_COL_FLAG_GROUNDED) == 1) {
|
||||
o->oAction = MIPS_ACT_WAIT_FOR_ANIMATION_DONE;
|
||||
|
@ -55,7 +55,7 @@ void moneybag_check_mario_collision(void) {
|
||||
// sp20 = collisionFlags
|
||||
|
||||
void moneybag_jump(s8 collisionFlags) {
|
||||
s16 animFrame = o->header.gfx.unk38.animFrame;
|
||||
s16 animFrame = o->header.gfx.animInfo.animFrame;
|
||||
|
||||
switch (o->oMoneybagJumpState) {
|
||||
case MONEYBAG_JUMP_PREPARE:
|
||||
@ -96,7 +96,7 @@ void moneybag_jump(s8 collisionFlags) {
|
||||
if (o->oTimer >= 61) {
|
||||
o->oMoneybagJumpState = MONEYBAG_JUMP_LANDING;
|
||||
o->oForwardVel = 0;
|
||||
o->header.gfx.unk38.animFrame = 0;
|
||||
o->header.gfx.animInfo.animFrame = 0;
|
||||
}
|
||||
break;
|
||||
|
||||
|
@ -20,12 +20,14 @@ void bhv_1up_common_init(void) {
|
||||
void bhv_1up_init(void) {
|
||||
bhv_1up_common_init();
|
||||
if (o->oBehParams2ndByte == 1) {
|
||||
if ((save_file_get_flags() & 0x50) == 0)
|
||||
if (!(save_file_get_flags() & (SAVE_FLAG_HAVE_KEY_1 | SAVE_FLAG_UNLOCKED_BASEMENT_DOOR))) {
|
||||
o->activeFlags = ACTIVE_FLAG_DEACTIVATED;
|
||||
}
|
||||
} else if (o->oBehParams2ndByte == 2) {
|
||||
if ((save_file_get_flags() & 0xa0) == 0)
|
||||
if (!(save_file_get_flags() & (SAVE_FLAG_HAVE_KEY_2 | SAVE_FLAG_UNLOCKED_UPSTAIRS_DOOR))) {
|
||||
o->activeFlags = ACTIVE_FLAG_DEACTIVATED;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void one_up_loop_in_air(void) {
|
||||
|
@ -30,9 +30,9 @@ void bhv_piranha_plant_bubble_loop(void) {
|
||||
struct Object *parent = o->parentObj; // the Piranha Plant
|
||||
f32 scale = 0;
|
||||
s32 i;
|
||||
s32 frame = parent->header.gfx.unk38.animFrame;
|
||||
s32 frame = parent->header.gfx.animInfo.animFrame;
|
||||
// TODO: rename lastFrame if it is inaccurate
|
||||
s32 lastFrame = parent->header.gfx.unk38.curAnim->unk08 - 2;
|
||||
s32 lastFrame = parent->header.gfx.animInfo.curAnim->loopEnd - 2;
|
||||
s32 UNUSED unused;
|
||||
f32 doneShrinkingFrame; // the first frame after shrinking is done
|
||||
f32 beginGrowingFrame; // the frame just before growing begins
|
||||
|
@ -240,7 +240,7 @@ static s8 sPiranhaPlantBiteSoundFrames[] = { 12, 28, 50, 64, -1 };
|
||||
* Piranha Plant will move to the attacked state.
|
||||
*/
|
||||
void piranha_plant_act_biting(void) {
|
||||
s32 frame = o->header.gfx.unk38.animFrame;
|
||||
s32 frame = o->header.gfx.animInfo.animFrame;
|
||||
|
||||
cur_obj_become_tangible();
|
||||
|
||||
@ -277,9 +277,9 @@ void piranha_plant_act_biting(void) {
|
||||
* This is called from both the "stopped biting" state and the "sleeping" state.
|
||||
*/
|
||||
s32 mario_moving_fast_enough_to_make_piranha_plant_bite(void) {
|
||||
if (gMarioStates->vel[1] > 10.0f)
|
||||
if (gMarioStates[0].vel[1] > 10.0f)
|
||||
return 1;
|
||||
if (gMarioStates->forwardVel > 10.0f)
|
||||
if (gMarioStates[0].forwardVel > 10.0f)
|
||||
return 1;
|
||||
return 0;
|
||||
}
|
||||
|
@ -4,6 +4,6 @@ void bhv_pole_base_loop(void) {
|
||||
if (o->oPosY - 10.0f < gMarioObject->oPosY
|
||||
&& gMarioObject->oPosY < o->oPosY + o->hitboxHeight + 30.0f)
|
||||
if (o->oTimer > 10)
|
||||
if (!(gMarioStates->action & MARIO_PUNCHING))
|
||||
if (!(gMarioStates[0].action & MARIO_PUNCHING))
|
||||
cur_obj_push_mario_away(70.0f);
|
||||
}
|
||||
|
@ -16,7 +16,7 @@ void bhv_purple_switch_loop(void) {
|
||||
case PURPLE_SWITCH_IDLE:
|
||||
cur_obj_set_model(MODEL_PURPLE_SWITCH);
|
||||
cur_obj_scale(1.5f);
|
||||
if (gMarioObject->platform == o && !(gMarioStates->action & MARIO_UNKNOWN_13)) {
|
||||
if (gMarioObject->platform == o && !(gMarioStates[0].action & MARIO_UNKNOWN_13)) {
|
||||
if (lateral_dist_between_objects(o, gMarioObject) < 127.5) {
|
||||
o->oAction = PURPLE_SWITCH_PRESSED;
|
||||
}
|
||||
|
@ -1,7 +1,7 @@
|
||||
// seaweed.c.inc
|
||||
|
||||
void bhv_seaweed_init(void) {
|
||||
o->header.gfx.unk38.animFrame = random_float() * 80.0f;
|
||||
o->header.gfx.animInfo.animFrame = random_float() * 80.0f;
|
||||
}
|
||||
|
||||
void bhv_seaweed_bundle_init(void) {
|
||||
@ -23,7 +23,7 @@ void bhv_seaweed_bundle_init(void) {
|
||||
seaweed->header.gfx.scale[0] = 0.8;
|
||||
seaweed->header.gfx.scale[1] = 0.9;
|
||||
seaweed->header.gfx.scale[2] = 0.8;
|
||||
seaweed->header.gfx.unk38.animFrame = random_float() * 80.0f;
|
||||
seaweed->header.gfx.animInfo.animFrame = random_float() * 80.0f;
|
||||
|
||||
seaweed = spawn_object(o, MODEL_SEAWEED, bhvSeaweed);
|
||||
seaweed->oFaceAngleYaw = 40500;
|
||||
@ -32,7 +32,7 @@ void bhv_seaweed_bundle_init(void) {
|
||||
seaweed->header.gfx.scale[0] = 0.8;
|
||||
seaweed->header.gfx.scale[1] = 0.8;
|
||||
seaweed->header.gfx.scale[2] = 0.8;
|
||||
seaweed->header.gfx.unk38.animFrame = random_float() * 80.0f;
|
||||
seaweed->header.gfx.animInfo.animFrame = random_float() * 80.0f;
|
||||
|
||||
seaweed = spawn_object(o, MODEL_SEAWEED, bhvSeaweed);
|
||||
seaweed->oFaceAngleYaw = 57236;
|
||||
@ -41,5 +41,5 @@ void bhv_seaweed_bundle_init(void) {
|
||||
seaweed->header.gfx.scale[0] = 1.2;
|
||||
seaweed->header.gfx.scale[1] = 1.2;
|
||||
seaweed->header.gfx.scale[2] = 1.2;
|
||||
seaweed->header.gfx.unk38.animFrame = random_float() * 80.0f;
|
||||
seaweed->header.gfx.animInfo.animFrame = random_float() * 80.0f;
|
||||
}
|
||||
|
@ -20,7 +20,6 @@ void bhv_bowser_shock_wave_loop(void) {
|
||||
sp20 = o->oBowserShockWaveUnkF4 * D_8032F420[3];
|
||||
if ((sp2C < o->oDistanceToMario && o->oDistanceToMario < sp28)
|
||||
|| (sp24 < o->oDistanceToMario && o->oDistanceToMario < sp20))
|
||||
gMarioObject->oInteractStatus |=
|
||||
0x10; // This is interact_coin, but the name sounds wrong in this behiavor
|
||||
gMarioObject->oInteractStatus |= INT_STATUS_HIT_BY_SHOCKWAVE;
|
||||
}
|
||||
}
|
||||
|
@ -66,7 +66,8 @@ void snowmans_bottom_act_1(void) {
|
||||
|
||||
if (sp20 == -1) {
|
||||
sp1E = (u16) o->oAngleToMario - (u16) o->oMoveAngleYaw;
|
||||
if (obj_check_if_facing_toward_angle(o->oMoveAngleYaw, o->oAngleToMario, 0x2000) == 1 && o->oSnowmansBottomUnk1AC == 1) {
|
||||
if (obj_check_if_facing_toward_angle(o->oMoveAngleYaw, o->oAngleToMario, 0x2000) == TRUE
|
||||
&& o->oSnowmansBottomUnk1AC == 1) {
|
||||
o->oSnowmansBottomUnkF8 = o->oAngleToMario;
|
||||
} else {
|
||||
o->oSnowmansBottomUnkF8 = o->oMoveAngleYaw;
|
||||
|
@ -19,7 +19,7 @@ void bhv_thi_tiny_island_top_loop(void) {
|
||||
if (!(gTHIWaterDrained & 1)) {
|
||||
if (o->oAction == 0) {
|
||||
if (o->oDistanceToMario < 500.0f)
|
||||
if (gMarioStates->action == ACT_GROUND_POUND_LAND) {
|
||||
if (gMarioStates[0].action == ACT_GROUND_POUND_LAND) {
|
||||
o->oAction++;
|
||||
cur_obj_spawn_particles(&D_8032F134);
|
||||
spawn_triangle_break_particles(20, 138, 0.3f, 3);
|
||||
|
@ -81,7 +81,7 @@ void tweester_act_chase(void) {
|
||||
cur_obj_rotate_yaw_toward(o->oAngleToMario, 0x200);
|
||||
print_debug_top_down_objectinfo("off ", 0);
|
||||
|
||||
if (gMarioStates->action == ACT_TWIRLING)
|
||||
if (gMarioStates[0].action == ACT_TWIRLING)
|
||||
o->oSubAction++;
|
||||
} else {
|
||||
o->oForwardVel = 20.0f;
|
||||
|
@ -3,16 +3,16 @@
|
||||
/**
|
||||
* @file Contains behavior for the ukiki objects.
|
||||
*
|
||||
* Hat ukiki is the ukiki that steals Mario's hat.
|
||||
* Cap ukiki is the ukiki that steals Mario's cap.
|
||||
* Cage ukiki is the ukiki that triggers the cage star.
|
||||
*/
|
||||
|
||||
/**
|
||||
* Sets the hat ukiki to its home if Mario is far away
|
||||
* Sets the cap ukiki to its home if Mario is far away
|
||||
* or makes him wait to respawn if in water.
|
||||
*/
|
||||
void handle_hat_ukiki_reset(void) {
|
||||
if (o->oBehParams2ndByte == UKIKI_HAT) {
|
||||
void handle_cap_ukiki_reset(void) {
|
||||
if (o->oBehParams2ndByte == UKIKI_CAP) {
|
||||
if (cur_obj_mario_far_away()) {
|
||||
cur_obj_set_pos_to_home_and_stop();
|
||||
o->oAction = UKIKI_ACT_IDLE;
|
||||
@ -23,12 +23,12 @@ void handle_hat_ukiki_reset(void) {
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns TRUE if Mario has his hat and ukiki is
|
||||
* the hat ukiki.
|
||||
* Returns TRUE if Mario has his cap and ukiki is
|
||||
* the cap ukiki.
|
||||
*/
|
||||
s32 is_hat_ukiki_and_mario_has_hat(void) {
|
||||
if (o->oBehParams2ndByte == UKIKI_HAT) {
|
||||
if (does_mario_have_hat(gMarioState)) {
|
||||
s32 is_cap_ukiki_and_mario_has_normal_cap_on_head(void) {
|
||||
if (o->oBehParams2ndByte == UKIKI_CAP) {
|
||||
if (does_mario_have_normal_cap_on_head(gMarioState)) {
|
||||
return TRUE;
|
||||
}
|
||||
}
|
||||
@ -124,7 +124,7 @@ void idle_ukiki_taunt(void) {
|
||||
void ukiki_act_idle(void) {
|
||||
idle_ukiki_taunt();
|
||||
|
||||
if (is_hat_ukiki_and_mario_has_hat()) {
|
||||
if (is_cap_ukiki_and_mario_has_normal_cap_on_head()) {
|
||||
if (o->oDistanceToMario > 700.0f && o->oDistanceToMario < 1000.0f) {
|
||||
o->oAction = UKIKI_ACT_RUN;
|
||||
} else if (o->oDistanceToMario <= 700.0f && 200.0f < o->oDistanceToMario) {
|
||||
@ -140,8 +140,8 @@ void ukiki_act_idle(void) {
|
||||
o->oAction = UKIKI_ACT_GO_TO_CAGE;
|
||||
}
|
||||
|
||||
// Jump away from Mario after stealing his hat.
|
||||
if (o->oUkikiTextState == UKIKI_TEXT_STOLE_HAT) {
|
||||
// Jump away from Mario after stealing his cap.
|
||||
if (o->oUkikiTextState == UKIKI_TEXT_STOLE_CAP) {
|
||||
o->oMoveAngleYaw = gMarioObject->oMoveAngleYaw + 0x8000;
|
||||
|
||||
if (check_if_moving_over_floor(50.0f, 150.0f)) {
|
||||
@ -159,10 +159,10 @@ void ukiki_act_idle(void) {
|
||||
}
|
||||
}
|
||||
|
||||
o->oUkikiTextState = UKIKI_TEXT_HAS_HAT;
|
||||
o->oUkikiTextState = UKIKI_TEXT_HAS_CAP;
|
||||
}
|
||||
|
||||
if (o->oBehParams2ndByte == UKIKI_HAT) {
|
||||
if (o->oBehParams2ndByte == UKIKI_CAP) {
|
||||
if (o->oPosY < -1550.0f) {
|
||||
o->oAction = UKIKI_ACT_RETURN_HOME;
|
||||
}
|
||||
@ -171,7 +171,7 @@ void ukiki_act_idle(void) {
|
||||
|
||||
/**
|
||||
* Ukiki attempts to run home, which is often impossible depending on terrain.
|
||||
* Only used for the hat ukiki.
|
||||
* Only used for the cap ukiki.
|
||||
*/
|
||||
void ukiki_act_return_home(void) {
|
||||
UNUSED s32 unused;
|
||||
@ -232,7 +232,7 @@ void ukiki_act_turn_to_mario(void) {
|
||||
o->oAction = UKIKI_ACT_IDLE;
|
||||
}
|
||||
|
||||
if (is_hat_ukiki_and_mario_has_hat()){
|
||||
if (is_cap_ukiki_and_mario_has_normal_cap_on_head()){
|
||||
if (o->oDistanceToMario > 500.0f) {
|
||||
o->oAction = UKIKI_ACT_RUN;
|
||||
}
|
||||
@ -248,7 +248,7 @@ void ukiki_act_run(void) {
|
||||
s32 fleeMario = TRUE;
|
||||
s16 goalYaw = o->oAngleToMario + 0x8000;
|
||||
|
||||
if (is_hat_ukiki_and_mario_has_hat()) {
|
||||
if (is_cap_ukiki_and_mario_has_normal_cap_on_head()) {
|
||||
fleeMario = FALSE;
|
||||
goalYaw = o->oAngleToMario;
|
||||
}
|
||||
@ -488,7 +488,7 @@ void ukiki_free_loop(void) {
|
||||
}
|
||||
|
||||
cur_obj_move_standard(steepSlopeAngleDegrees);
|
||||
handle_hat_ukiki_reset();
|
||||
handle_cap_ukiki_reset();
|
||||
|
||||
if(!(o->oMoveFlags & OBJ_MOVE_MASK_IN_WATER)) {
|
||||
exec_anim_sound_state(sUkikiSoundStates);
|
||||
@ -499,7 +499,7 @@ void ukiki_free_loop(void) {
|
||||
* Unused function for timing ukiki's blinking.
|
||||
* Image still present in Ukiki's actor graphics.
|
||||
*
|
||||
* Possibly unused so AnimState could be used for wearing a hat?
|
||||
* Possibly unused so AnimState could be used for wearing a cap?
|
||||
*/
|
||||
static void ukiki_blink_timer(void) {
|
||||
if (gGlobalTimer % 50 < 7) {
|
||||
@ -555,37 +555,37 @@ void cage_ukiki_held_loop(void) {
|
||||
}
|
||||
|
||||
/**
|
||||
* Called by the main behavior function for the hat ukiki whenever it is held.
|
||||
* Called by the main behavior function for the cap ukiki whenever it is held.
|
||||
*/
|
||||
void hat_ukiki_held_loop(void) {
|
||||
void cap_ukiki_held_loop(void) {
|
||||
switch(o->oUkikiTextState) {
|
||||
case UKIKI_TEXT_DEFAULT:
|
||||
if (mario_lose_cap_to_enemy(2)) {
|
||||
o->oUkikiTextState = UKIKI_TEXT_STEAL_HAT;
|
||||
o->oUkikiHasHat |= UKIKI_HAT_ON;
|
||||
o->oUkikiTextState = UKIKI_TEXT_STEAL_CAP;
|
||||
o->oUkikiHasCap |= UKIKI_CAP_ON;
|
||||
} else {}
|
||||
break;
|
||||
|
||||
case UKIKI_TEXT_STEAL_HAT:
|
||||
case UKIKI_TEXT_STEAL_CAP:
|
||||
if (cur_obj_update_dialog(2, 2, DIALOG_100, 0)) {
|
||||
o->oInteractionSubtype |= INT_SUBTYPE_DROP_IMMEDIATELY;
|
||||
o->oUkikiTextState = UKIKI_TEXT_STOLE_HAT;
|
||||
o->oUkikiTextState = UKIKI_TEXT_STOLE_CAP;
|
||||
}
|
||||
break;
|
||||
|
||||
case UKIKI_TEXT_STOLE_HAT:
|
||||
case UKIKI_TEXT_STOLE_CAP:
|
||||
break;
|
||||
|
||||
case UKIKI_TEXT_HAS_HAT:
|
||||
case UKIKI_TEXT_HAS_CAP:
|
||||
if (cur_obj_update_dialog(2, 18, DIALOG_101, 0)) {
|
||||
mario_retrieve_cap();
|
||||
set_mario_npc_dialog(0);
|
||||
o->oUkikiHasHat &= ~UKIKI_HAT_ON;
|
||||
o->oUkikiTextState = UKIKI_TEXT_GAVE_HAT_BACK;
|
||||
o->oUkikiHasCap &= ~UKIKI_CAP_ON;
|
||||
o->oUkikiTextState = UKIKI_TEXT_GAVE_CAP_BACK;
|
||||
}
|
||||
break;
|
||||
|
||||
case UKIKI_TEXT_GAVE_HAT_BACK:
|
||||
case UKIKI_TEXT_GAVE_CAP_BACK:
|
||||
o->oUkikiTextState = UKIKI_TEXT_DEFAULT;
|
||||
o->oAction = UKIKI_ACT_IDLE;
|
||||
break;
|
||||
@ -593,20 +593,20 @@ void hat_ukiki_held_loop(void) {
|
||||
}
|
||||
|
||||
/**
|
||||
* Initializatation for ukiki, determines if it has Mario's hat.
|
||||
* Initializatation for ukiki, determines if it has Mario's cap.
|
||||
*/
|
||||
void bhv_ukiki_init(void) {
|
||||
if (o->oBehParams2ndByte == UKIKI_HAT) {
|
||||
if (o->oBehParams2ndByte == UKIKI_CAP) {
|
||||
if (save_file_get_flags() & SAVE_FLAG_CAP_ON_UKIKI) {
|
||||
o->oUkikiTextState = UKIKI_TEXT_HAS_HAT;
|
||||
o->oUkikiHasHat |= UKIKI_HAT_ON;
|
||||
o->oUkikiTextState = UKIKI_TEXT_HAS_CAP;
|
||||
o->oUkikiHasCap |= UKIKI_CAP_ON;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* The main behavior function for ukiki. Chooses which behavior to use
|
||||
* dependent on the held state and whick ukiki it is (cage or hat).
|
||||
* dependent on the held state and whick ukiki it is (cage or cap).
|
||||
*/
|
||||
void bhv_ukiki_loop(void) {
|
||||
switch(o->oHeldState) {
|
||||
@ -620,8 +620,8 @@ void bhv_ukiki_loop(void) {
|
||||
cur_obj_unrender_and_reset_state(UKIKI_ANIM_HELD, 0);
|
||||
obj_copy_pos(o, gMarioObject);
|
||||
|
||||
if (o->oBehParams2ndByte == UKIKI_HAT) {
|
||||
hat_ukiki_held_loop();
|
||||
if (o->oBehParams2ndByte == UKIKI_CAP) {
|
||||
cap_ukiki_held_loop();
|
||||
} else {
|
||||
cage_ukiki_held_loop();
|
||||
}
|
||||
@ -633,8 +633,8 @@ void bhv_ukiki_loop(void) {
|
||||
break;
|
||||
}
|
||||
|
||||
if (o->oUkikiHasHat & UKIKI_HAT_ON) {
|
||||
o->oAnimState = UKIKI_ANIM_STATE_HAT_ON;
|
||||
if (o->oUkikiHasCap & UKIKI_CAP_ON) {
|
||||
o->oAnimState = UKIKI_ANIM_STATE_CAP_ON;
|
||||
} else {
|
||||
o->oAnimState = UKIKI_ANIM_STATE_DEFAULT;
|
||||
}
|
||||
|
@ -61,11 +61,11 @@ void water_level_pillar_drained(void) {
|
||||
|
||||
void bhv_water_level_pillar_init(void) {
|
||||
if (save_file_get_flags() & SAVE_FLAG_MOAT_DRAINED)
|
||||
o->oWaterLevelPillarUnkF8 = 1;
|
||||
o->oWaterLevelPillarDrained = 1;
|
||||
}
|
||||
|
||||
void bhv_water_level_pillar_loop(void) {
|
||||
if (o->oWaterLevelPillarUnkF8)
|
||||
if (o->oWaterLevelPillarDrained)
|
||||
water_level_pillar_drained();
|
||||
else
|
||||
water_level_pillar_undrained();
|
||||
|
@ -85,7 +85,7 @@ void bhv_water_droplet_loop(void) {
|
||||
|
||||
void bhv_idle_water_wave_loop(void) {
|
||||
obj_copy_pos(o, gMarioObject);
|
||||
o->oPosY = gMarioStates->waterLevel + 5;
|
||||
o->oPosY = gMarioStates[0].waterLevel + 5;
|
||||
if (!(gMarioObject->oMarioParticleFlags & ACTIVE_PARTICLE_IDLE_WATER_WAVE)) {
|
||||
gMarioObject->oActiveParticleFlags &= (u16)~ACTIVE_PARTICLE_IDLE_WATER_WAVE;
|
||||
o->activeFlags = ACTIVE_FLAG_DEACTIVATED;
|
||||
|
@ -1,7 +1,7 @@
|
||||
// whomp.c.inc
|
||||
|
||||
void whomp_play_sfx_from_pound_animation(void) {
|
||||
UNUSED s32 sp2C = o->header.gfx.unk38.animFrame;
|
||||
UNUSED s32 sp2C = o->header.gfx.animInfo.animFrame;
|
||||
s32 sp28 = 0;
|
||||
if (o->oForwardVel < 5.0f) {
|
||||
sp28 = cur_obj_check_anim_frame(0);
|
||||
|
@ -137,7 +137,7 @@ void wiggler_init_segments(void) {
|
||||
(segments + i)->yaw = o->oFaceAngleYaw;
|
||||
}
|
||||
|
||||
o->header.gfx.unk38.animFrame = -1;
|
||||
o->header.gfx.animInfo.animFrame = -1;
|
||||
|
||||
// Spawn each body part
|
||||
for (i = 1; i <= 3; i++) {
|
||||
@ -145,7 +145,7 @@ void wiggler_init_segments(void) {
|
||||
spawn_object_relative(i, 0, 0, 0, o, MODEL_WIGGLER_BODY, bhvWigglerBody);
|
||||
if (bodyPart != NULL) {
|
||||
obj_init_animation_with_sound(bodyPart, wiggler_seg5_anims_0500C874, 0);
|
||||
bodyPart->header.gfx.unk38.animFrame = (23 * i) % 26 - 1;
|
||||
bodyPart->header.gfx.animInfo.animFrame = (23 * i) % 26 - 1;
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -11,14 +11,15 @@ void bhv_yoshi_init(void) {
|
||||
o->oBuoyancy = 1.3f;
|
||||
o->oInteractionSubtype = INT_SUBTYPE_NPC;
|
||||
|
||||
if (save_file_get_total_star_count(gCurrSaveFileNum - 1, 0, 24) < 120 || sYoshiDead == TRUE) {
|
||||
if (save_file_get_total_star_count(gCurrSaveFileNum - 1, COURSE_MIN - 1, COURSE_MAX - 1) < 120
|
||||
|| sYoshiDead == TRUE) {
|
||||
o->activeFlags = ACTIVE_FLAG_DEACTIVATED;
|
||||
}
|
||||
}
|
||||
|
||||
void yoshi_walk_loop(void) {
|
||||
UNUSED s16 sp26;
|
||||
s16 sp24 = o->header.gfx.unk38.animFrame;
|
||||
s16 sp24 = o->header.gfx.animInfo.animFrame;
|
||||
|
||||
o->oForwardVel = 10.0f;
|
||||
sp26 = object_step();
|
||||
@ -41,7 +42,7 @@ void yoshi_walk_loop(void) {
|
||||
|
||||
void yoshi_idle_loop(void) {
|
||||
s16 chosenHome;
|
||||
UNUSED s16 sp1C = o->header.gfx.unk38.animFrame;
|
||||
UNUSED s16 sp1C = o->header.gfx.animInfo.animFrame;
|
||||
|
||||
if (o->oTimer > 90) {
|
||||
chosenHome = random_float() * 3.99;
|
||||
@ -94,7 +95,7 @@ void yoshi_talk_loop(void) {
|
||||
}
|
||||
|
||||
void yoshi_walk_and_jump_off_roof_loop(void) {
|
||||
s16 sp26 = o->header.gfx.unk38.animFrame;
|
||||
s16 sp26 = o->header.gfx.animInfo.animFrame;
|
||||
|
||||
o->oForwardVel = 10.0f;
|
||||
object_step();
|
||||
@ -124,7 +125,7 @@ void yoshi_finish_jumping_and_despawn_loop(void) {
|
||||
if (o->oPosY < 2100.0f) {
|
||||
set_mario_npc_dialog(0);
|
||||
gObjCutsceneDone = TRUE;
|
||||
sYoshiDead = 1;
|
||||
sYoshiDead = TRUE;
|
||||
o->activeFlags = ACTIVE_FLAG_DEACTIVATED;
|
||||
}
|
||||
}
|
||||
@ -134,7 +135,7 @@ void yoshi_give_present_loop(void) {
|
||||
|
||||
if (gHudDisplay.lives == 100) {
|
||||
play_sound(SOUND_GENERAL_COLLECT_1UP, gDefaultSoundArgs);
|
||||
gSpecialTripleJump = 1;
|
||||
gSpecialTripleJump = TRUE;
|
||||
o->oAction = YOSHI_ACT_WALK_JUMP_OFF_ROOF;
|
||||
return;
|
||||
}
|
||||
|
@ -659,9 +659,9 @@ void unused_set_camera_pitch_shake_env(s16 shake) {
|
||||
* both ranges are always 200.f
|
||||
* Since focMul is 0.9, `focOff` is closer to the floor than `posOff`
|
||||
* posOff and focOff are sometimes the same address, which just ignores the pos calculation
|
||||
*! Doesn't return anything, but required to match EU
|
||||
*! Doesn't return anything, but required to match on -O2
|
||||
*/
|
||||
f32 calc_y_to_curr_floor(f32 *posOff, f32 posMul, f32 posBound, f32 *focOff, f32 focMul, f32 focBound) {
|
||||
BAD_RETURN(f32) calc_y_to_curr_floor(f32 *posOff, f32 posMul, f32 posBound, f32 *focOff, f32 focMul, f32 focBound) {
|
||||
f32 floorHeight = sMarioGeometry.currFloorHeight;
|
||||
f32 waterHeight;
|
||||
UNUSED s32 filler;
|
||||
@ -786,10 +786,10 @@ void set_camera_height(struct Camera *c, f32 goalHeight) {
|
||||
}
|
||||
}
|
||||
approach_camera_height(c, goalHeight, 20.f);
|
||||
if (camCeilHeight != 20000.f) {
|
||||
if (camCeilHeight != CELL_HEIGHT_LIMIT) {
|
||||
camCeilHeight -= baseOff;
|
||||
if ((c->pos[1] > camCeilHeight && sMarioGeometry.currFloorHeight + baseOff < camCeilHeight)
|
||||
|| (sMarioGeometry.currCeilHeight != 20000.f
|
||||
|| (sMarioGeometry.currCeilHeight != CELL_HEIGHT_LIMIT
|
||||
&& sMarioGeometry.currCeilHeight > camCeilHeight && c->pos[1] > camCeilHeight)) {
|
||||
c->pos[1] = camCeilHeight;
|
||||
}
|
||||
@ -1484,7 +1484,7 @@ s32 update_fixed_camera(struct Camera *c, Vec3f focus, UNUSED Vec3f pos) {
|
||||
vec3f_add(basePos, sCastleEntranceOffset);
|
||||
|
||||
if (sMarioGeometry.currFloorType != SURFACE_DEATH_PLANE
|
||||
&& sMarioGeometry.currFloorHeight != -11000.f) {
|
||||
&& sMarioGeometry.currFloorHeight != FLOOR_LOWER_LIMIT) {
|
||||
goalHeight = sMarioGeometry.currFloorHeight + basePos[1] + heightOffset;
|
||||
} else {
|
||||
goalHeight = gLakituState.goalPos[1];
|
||||
@ -1495,7 +1495,7 @@ s32 update_fixed_camera(struct Camera *c, Vec3f focus, UNUSED Vec3f pos) {
|
||||
}
|
||||
|
||||
ceilHeight = find_ceil(c->pos[0], goalHeight - 100.f, c->pos[2], &ceiling);
|
||||
if (ceilHeight != 20000.f) {
|
||||
if (ceilHeight != CELL_HEIGHT_LIMIT) {
|
||||
if (goalHeight > (ceilHeight -= 125.f)) {
|
||||
goalHeight = ceilHeight;
|
||||
}
|
||||
@ -1594,7 +1594,7 @@ s32 update_boss_fight_camera(struct Camera *c, Vec3f focus, Vec3f pos) {
|
||||
// When C-Down is not active, this
|
||||
vec3f_set_dist_and_angle(focus, pos, focusDistance, 0x1000, yaw);
|
||||
// Find the floor of the arena
|
||||
pos[1] = find_floor(c->areaCenX, 20000.f, c->areaCenZ, &floor);
|
||||
pos[1] = find_floor(c->areaCenX, CELL_HEIGHT_LIMIT, c->areaCenZ, &floor);
|
||||
if (floor != NULL) {
|
||||
nx = floor->normal.x;
|
||||
ny = floor->normal.y;
|
||||
@ -1610,7 +1610,7 @@ s32 update_boss_fight_camera(struct Camera *c, Vec3f focus, Vec3f pos) {
|
||||
}
|
||||
}
|
||||
|
||||
//! Must be same line to match EU
|
||||
//! Must be same line to match on -O2
|
||||
// Prevent the camera from going to the ground in the outside boss fight
|
||||
if (gCurrLevelNum == LEVEL_BBH) { pos[1] = 2047.f; }
|
||||
|
||||
@ -2268,7 +2268,7 @@ s16 update_default_camera(struct Camera *c) {
|
||||
|
||||
// If there's water below the camera, decide whether to keep the camera above the water surface
|
||||
waterHeight = find_water_level(cPos[0], cPos[2]);
|
||||
if (waterHeight != -11000.f) {
|
||||
if (waterHeight != FLOOR_LOWER_LIMIT) {
|
||||
waterHeight += 125.f;
|
||||
distFromWater = waterHeight - marioFloorHeight;
|
||||
if (!(gCameraMovementFlags & CAM_MOVE_METAL_BELOW_WATER)) {
|
||||
@ -2318,7 +2318,7 @@ s16 update_default_camera(struct Camera *c) {
|
||||
|
||||
// Make Lakitu fly above the gas
|
||||
gasHeight = find_poison_gas_level(cPos[0], cPos[2]);
|
||||
if (gasHeight != -11000.f) {
|
||||
if (gasHeight != FLOOR_LOWER_LIMIT) {
|
||||
if ((gasHeight += 130.f) > c->pos[1]) {
|
||||
c->pos[1] = gasHeight;
|
||||
}
|
||||
@ -2329,7 +2329,7 @@ s16 update_default_camera(struct Camera *c) {
|
||||
if (c->mode == CAMERA_MODE_FREE_ROAM) {
|
||||
camFloorHeight -= 100.f;
|
||||
}
|
||||
ceilHeight = 20000.f;
|
||||
ceilHeight = CELL_HEIGHT_LIMIT;
|
||||
vec3f_copy(c->focus, sMarioCamState->pos);
|
||||
}
|
||||
|
||||
@ -2338,10 +2338,10 @@ s16 update_default_camera(struct Camera *c) {
|
||||
if (sMarioCamState->pos[1] - 100.f > camFloorHeight) {
|
||||
camFloorHeight = sMarioCamState->pos[1] - 100.f;
|
||||
}
|
||||
ceilHeight = 20000.f;
|
||||
ceilHeight = CELL_HEIGHT_LIMIT;
|
||||
vec3f_copy(c->focus, sMarioCamState->pos);
|
||||
}
|
||||
if (camFloorHeight != -11000.f) {
|
||||
if (camFloorHeight != FLOOR_LOWER_LIMIT) {
|
||||
camFloorHeight += posHeight;
|
||||
approach_camera_height(c, camFloorHeight, 20.f);
|
||||
}
|
||||
@ -2363,7 +2363,7 @@ s16 update_default_camera(struct Camera *c) {
|
||||
vec3f_set_dist_and_angle(c->focus, c->pos, dist, tempPitch, tempYaw);
|
||||
}
|
||||
}
|
||||
if (ceilHeight != 20000.f) {
|
||||
if (ceilHeight != CELL_HEIGHT_LIMIT) {
|
||||
if (c->pos[1] > (ceilHeight -= 150.f)
|
||||
&& (avoidStatus = is_range_behind_surface(c->pos, sMarioCamState->pos, ceil, 0, -1)) == 1) {
|
||||
c->pos[1] = ceilHeight;
|
||||
@ -2461,7 +2461,7 @@ s32 update_spiral_stairs_camera(struct Camera *c, Vec3f focus, Vec3f pos) {
|
||||
checkPos[2] = focus[2] + (cPos[2] - focus[2]) * 0.7f;
|
||||
floorHeight = find_floor(checkPos[0], checkPos[1] + 50.f, checkPos[2], &floor);
|
||||
|
||||
if (floorHeight != -11000.f) {
|
||||
if (floorHeight != FLOOR_LOWER_LIMIT) {
|
||||
if (floorHeight < sMarioGeometry.currFloorHeight) {
|
||||
floorHeight = sMarioGeometry.currFloorHeight;
|
||||
}
|
||||
@ -2984,7 +2984,7 @@ void update_lakitu(struct Camera *c) {
|
||||
distToFloor = find_floor(gLakituState.pos[0],
|
||||
gLakituState.pos[1] + 20.0f,
|
||||
gLakituState.pos[2], &floor);
|
||||
if (distToFloor != -11000.f) {
|
||||
if (distToFloor != FLOOR_LOWER_LIMIT) {
|
||||
if (gLakituState.pos[1] < (distToFloor += 100.0f)) {
|
||||
gLakituState.pos[1] = distToFloor;
|
||||
} else {
|
||||
@ -4277,7 +4277,7 @@ s16 reduce_by_dist_from_camera(s16 value, f32 maxDist, f32 posX, f32 posY, f32 p
|
||||
vec3f_get_dist_and_angle(gLakituState.goalPos, pos, &dist, &pitch, &yaw);
|
||||
if (dist < maxDist) {
|
||||
calculate_angles(gLakituState.goalPos, gLakituState.goalFocus, &goalPitch, &goalYaw);
|
||||
//! Must be same line to match EU
|
||||
//! Must be same line to match on -O2
|
||||
pitch -= goalPitch; yaw -= goalYaw;
|
||||
dist -= 2000.f;
|
||||
if (dist < 0.f) {
|
||||
@ -5456,7 +5456,7 @@ s16 next_lakitu_state(Vec3f newPos, Vec3f newFoc, Vec3f curPos, Vec3f curFoc,
|
||||
|
||||
if (gCamera->cutscene != 0 || !(gCameraMovementFlags & CAM_MOVE_C_UP_MODE)) {
|
||||
floorHeight = find_floor(newPos[0], newPos[1], newPos[2], &floor);
|
||||
if (floorHeight != -11000.f) {
|
||||
if (floorHeight != FLOOR_LOWER_LIMIT) {
|
||||
if ((floorHeight += 125.f) > newPos[1]) {
|
||||
newPos[1] = floorHeight;
|
||||
}
|
||||
@ -6687,19 +6687,19 @@ void resolve_geometry_collisions(Vec3f pos, UNUSED Vec3f lastGood) {
|
||||
floorY = find_floor(pos[0], pos[1] + 50.f, pos[2], &surf);
|
||||
ceilY = find_ceil(pos[0], pos[1] - 50.f, pos[2], &surf);
|
||||
|
||||
if ((-11000.f != floorY) && (20000.f == ceilY)) {
|
||||
if ((FLOOR_LOWER_LIMIT != floorY) && (CELL_HEIGHT_LIMIT == ceilY)) {
|
||||
if (pos[1] < (floorY += 125.f)) {
|
||||
pos[1] = floorY;
|
||||
}
|
||||
}
|
||||
|
||||
if ((-11000.f == floorY) && (20000.f != ceilY)) {
|
||||
if ((FLOOR_LOWER_LIMIT == floorY) && (CELL_HEIGHT_LIMIT != ceilY)) {
|
||||
if (pos[1] > (ceilY -= 125.f)) {
|
||||
pos[1] = ceilY;
|
||||
}
|
||||
}
|
||||
|
||||
if ((-11000.f != floorY) && (20000.f != ceilY)) {
|
||||
if ((FLOOR_LOWER_LIMIT != floorY) && (CELL_HEIGHT_LIMIT != ceilY)) {
|
||||
floorY += 125.f;
|
||||
ceilY -= 125.f;
|
||||
|
||||
@ -6826,14 +6826,14 @@ void find_mario_floor_and_ceil(struct PlayerGeometry *pg) {
|
||||
gCheckingSurfaceCollisionsForCamera = TRUE;
|
||||
|
||||
if (find_floor(sMarioCamState->pos[0], sMarioCamState->pos[1] + 10.f,
|
||||
sMarioCamState->pos[2], &surf) != -11000.f) {
|
||||
sMarioCamState->pos[2], &surf) != FLOOR_LOWER_LIMIT) {
|
||||
pg->currFloorType = surf->type;
|
||||
} else {
|
||||
pg->currFloorType = 0;
|
||||
}
|
||||
|
||||
if (find_ceil(sMarioCamState->pos[0], sMarioCamState->pos[1] - 10.f,
|
||||
sMarioCamState->pos[2], &surf) != 20000.f) {
|
||||
sMarioCamState->pos[2], &surf) != CELL_HEIGHT_LIMIT) {
|
||||
pg->currCeilType = surf->type;
|
||||
} else {
|
||||
pg->currCeilType = 0;
|
||||
@ -7352,7 +7352,7 @@ BAD_RETURN(s32) cutscene_ending_peach_descends(struct Camera *c) {
|
||||
}
|
||||
|
||||
/**
|
||||
* Mario runs across the bridge to peach, and takes off his hat.
|
||||
* Mario runs across the bridge to peach, and takes off his cap.
|
||||
* Follow the sEndingMarioToPeach* splines while Mario runs across.
|
||||
*/
|
||||
BAD_RETURN(s32) cutscene_ending_mario_to_peach(struct Camera *c) {
|
||||
@ -8687,7 +8687,7 @@ BAD_RETURN(s32) cutscene_suffocation_stay_above_gas(struct Camera *c) {
|
||||
cutscene_goto_cvar_pos(c, 400.f, 0x2800, 0x200, 0);
|
||||
gasLevel = find_poison_gas_level(sMarioCamState->pos[0], sMarioCamState->pos[2]);
|
||||
|
||||
if (gasLevel != -11000.f) {
|
||||
if (gasLevel != FLOOR_LOWER_LIMIT) {
|
||||
if ((gasLevel += 130.f) > c->pos[1]) {
|
||||
c->pos[1] = gasLevel;
|
||||
}
|
||||
@ -10060,7 +10060,7 @@ BAD_RETURN(s32) cutscene_exit_painting_start(struct Camera *c) {
|
||||
offset_rotated(c->pos, sCutsceneVars[0].point, sCutsceneVars[2].point, sCutsceneVars[0].angle);
|
||||
floorHeight = find_floor(c->pos[0], c->pos[1] + 10.f, c->pos[2], &floor);
|
||||
|
||||
if (floorHeight != -11000.f) {
|
||||
if (floorHeight != FLOOR_LOWER_LIMIT) {
|
||||
if (c->pos[1] < (floorHeight += 60.f)) {
|
||||
c->pos[1] = floorHeight;
|
||||
}
|
||||
|
@ -256,7 +256,7 @@ void print_stageinfo(void) {
|
||||
void print_string_array_info(const char **strArr) {
|
||||
s32 i;
|
||||
|
||||
if (sDebugStringArrPrinted == FALSE) {
|
||||
if (!sDebugStringArrPrinted) {
|
||||
sDebugStringArrPrinted += 1; // again, why not = TRUE...
|
||||
for (i = 0; i < 8; i++) {
|
||||
// sDebugPage is assumed to be 4 or 5 here.
|
||||
@ -401,7 +401,7 @@ void try_modify_debug_controls(void) {
|
||||
if (gPlayer1Controller->buttonPressed & Z_TRIG) {
|
||||
sNoExtraDebug ^= 1;
|
||||
}
|
||||
if (!(gPlayer1Controller->buttonDown & (L_TRIG | R_TRIG)) && sNoExtraDebug == FALSE) {
|
||||
if (!(gPlayer1Controller->buttonDown & (L_TRIG | R_TRIG)) && !sNoExtraDebug) {
|
||||
sp4 = 1;
|
||||
if (gPlayer1Controller->buttonDown & B_BUTTON) {
|
||||
sp4 = 100;
|
||||
|
@ -45,7 +45,7 @@ struct MarioAnimation D_80339D10;
|
||||
struct MarioAnimation gDemo;
|
||||
UNUSED u8 filler80339D30[0x90];
|
||||
|
||||
int unused8032C690 = 0;
|
||||
s32 unused8032C690 = 0;
|
||||
u32 gGlobalTimer = 0;
|
||||
|
||||
static u16 sCurrFBNum = 0;
|
||||
@ -278,7 +278,7 @@ void draw_reset_bars(void) {
|
||||
sp18 += D_8032C648++ * (SCREEN_WIDTH / 4);
|
||||
|
||||
for (sp24 = 0; sp24 < ((SCREEN_HEIGHT / 16) + 1); sp24++) {
|
||||
// Must be on one line to match -O2
|
||||
// Loop must be one line to match on -O2
|
||||
for (sp20 = 0; sp20 < (SCREEN_WIDTH / 4); sp20++) *sp18++ = 0;
|
||||
sp18 += ((SCREEN_WIDTH / 4) * 14);
|
||||
}
|
||||
@ -603,7 +603,7 @@ void thread5_game_loop(UNUSED void *arg) {
|
||||
set_sound_mode(save_file_get_sound_mode());
|
||||
rendering_init();
|
||||
|
||||
while (1) {
|
||||
while (TRUE) {
|
||||
// if the reset timer is active, run the process to reset the game.
|
||||
if (gResetTimer) {
|
||||
draw_reset_bars();
|
||||
|
@ -86,7 +86,7 @@ Gfx *geo_exec_inside_castle_light(s32 callContext, struct GraphNode *node, UNUSE
|
||||
|
||||
if (callContext == GEO_CONTEXT_RENDER) {
|
||||
flags = save_file_get_flags();
|
||||
if (gHudDisplay.stars >= 10 && (flags & SAVE_FLAG_HAVE_WING_CAP) == 0) {
|
||||
if (gHudDisplay.stars >= 10 && !(flags & SAVE_FLAG_HAVE_WING_CAP)) {
|
||||
displayList = alloc_display_list(2 * sizeof(*displayList));
|
||||
|
||||
if (displayList == NULL) {
|
||||
|
@ -21,7 +21,6 @@ enum CameraHUDLut {
|
||||
GLYPH_CAM_ARROW_DOWN
|
||||
};
|
||||
|
||||
// Functions
|
||||
void set_hud_camera_status(s16 status);
|
||||
void render_hud(void);
|
||||
|
||||
|
@ -913,7 +913,7 @@ void create_dialog_box_with_response(s16 dialog) {
|
||||
}
|
||||
|
||||
void reset_dialog_render_state(void) {
|
||||
level_set_transition(0, 0);
|
||||
level_set_transition(0, NULL);
|
||||
|
||||
if (gDialogBoxType == DIALOG_TYPE_ZOOM) {
|
||||
trigger_cutscene_dialog(2);
|
||||
@ -1760,7 +1760,7 @@ void render_dialog_entries(void) {
|
||||
break;
|
||||
case DIALOG_STATE_CLOSING:
|
||||
if (gDialogBoxOpenTimer == 20.0f) {
|
||||
level_set_transition(0, 0);
|
||||
level_set_transition(0, NULL);
|
||||
play_sound(SOUND_MENU_MESSAGE_DISAPPEAR, gDefaultSoundArgs);
|
||||
|
||||
if (gDialogBoxType == DIALOG_TYPE_ZOOM) {
|
||||
@ -2608,7 +2608,7 @@ s16 render_pause_courses_and_castle(void) {
|
||||
case DIALOG_STATE_OPENING:
|
||||
gDialogLineNum = 1;
|
||||
gDialogTextAlpha = 0;
|
||||
level_set_transition(-1, 0);
|
||||
level_set_transition(-1, NULL);
|
||||
#if defined(VERSION_JP) || defined(VERSION_SH)
|
||||
play_sound(SOUND_MENU_PAUSE, gDefaultSoundArgs);
|
||||
#else
|
||||
@ -2639,7 +2639,7 @@ s16 render_pause_courses_and_castle(void) {
|
||||
|| gPlayer3Controller->buttonPressed & START_BUTTON)
|
||||
#endif
|
||||
{
|
||||
level_set_transition(0, 0);
|
||||
level_set_transition(0, NULL);
|
||||
play_sound(SOUND_MENU_PAUSE_2, gDefaultSoundArgs);
|
||||
gDialogBoxState = DIALOG_STATE_OPENING;
|
||||
gMenuMode = -1;
|
||||
@ -2666,7 +2666,7 @@ s16 render_pause_courses_and_castle(void) {
|
||||
|| gPlayer3Controller->buttonPressed & START_BUTTON)
|
||||
#endif
|
||||
{
|
||||
level_set_transition(0, 0);
|
||||
level_set_transition(0, NULL);
|
||||
play_sound(SOUND_MENU_PAUSE_2, gDefaultSoundArgs);
|
||||
gMenuMode = -1;
|
||||
gDialogBoxState = DIALOG_STATE_OPENING;
|
||||
@ -2757,7 +2757,7 @@ void print_hud_course_complete_coins(s16 x, s16 y) {
|
||||
gCourseCompleteCoinsEqual = 1;
|
||||
gCourseCompleteCoins = gHudDisplay.coins;
|
||||
|
||||
if (gGotFileCoinHiScore != 0) {
|
||||
if (gGotFileCoinHiScore) {
|
||||
print_hud_course_complete_string(HUD_PRINT_HISCORE);
|
||||
}
|
||||
} else {
|
||||
@ -2771,7 +2771,7 @@ void print_hud_course_complete_coins(s16 x, s16 y) {
|
||||
}
|
||||
}
|
||||
|
||||
if (gHudDisplay.coins == gCourseCompleteCoins && gGotFileCoinHiScore != 0) {
|
||||
if (gHudDisplay.coins == gCourseCompleteCoins && gGotFileCoinHiScore) {
|
||||
play_sound(SOUND_MENU_MARIO_CASTLE_WARP2, gDefaultSoundArgs);
|
||||
}
|
||||
}
|
||||
@ -2992,7 +2992,7 @@ s16 render_course_complete_screen(void) {
|
||||
render_course_complete_lvl_info_and_hud_str();
|
||||
if (gCourseDoneMenuTimer > 100 && gCourseCompleteCoinsEqual == 1) {
|
||||
gDialogBoxState = DIALOG_STATE_VERTICAL;
|
||||
level_set_transition(-1, 0);
|
||||
level_set_transition(-1, NULL);
|
||||
gDialogTextAlpha = 0;
|
||||
gDialogLineNum = 1;
|
||||
}
|
||||
@ -3013,7 +3013,7 @@ s16 render_course_complete_screen(void) {
|
||||
|| gPlayer3Controller->buttonPressed & Z_TRIG
|
||||
#endif
|
||||
)) {
|
||||
level_set_transition(0, 0);
|
||||
level_set_transition(0, NULL);
|
||||
play_sound(SOUND_MENU_STAR_SOUND, gDefaultSoundArgs);
|
||||
gDialogBoxState = DIALOG_STATE_OPENING;
|
||||
gMenuMode = -1;
|
||||
|
@ -132,10 +132,10 @@ static u8 sJustTeleported = FALSE;
|
||||
static u8 sPssSlideStarted = FALSE;
|
||||
|
||||
/**
|
||||
* Returns the type of hat Mario is wearing.
|
||||
* Returns the type of cap Mario is wearing.
|
||||
*/
|
||||
u32 get_mario_cap_flag(struct Object *capObject) {
|
||||
void *script = virtual_to_segmented(0x13, capObject->behavior);
|
||||
const BehaviorScript *script = virtual_to_segmented(0x13, capObject->behavior);
|
||||
|
||||
if (script == bhvNormalCap) {
|
||||
return MARIO_NORMAL_CAP;
|
||||
@ -149,6 +149,7 @@ u32 get_mario_cap_flag(struct Object *capObject) {
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns true if the passed in object has a moving angle yaw
|
||||
* in the angular range given towards Mario.
|
||||
@ -340,14 +341,14 @@ void mario_stop_riding_and_holding(struct MarioState *m) {
|
||||
}
|
||||
}
|
||||
|
||||
u32 does_mario_have_hat(struct MarioState *m) {
|
||||
return (m->flags & MARIO_CAP_FLAGS) == (MARIO_NORMAL_CAP | MARIO_CAP_ON_HEAD);
|
||||
u32 does_mario_have_normal_cap_on_head(struct MarioState *m) {
|
||||
return (m->flags & (MARIO_CAPS | MARIO_CAP_ON_HEAD)) == (MARIO_NORMAL_CAP | MARIO_CAP_ON_HEAD);
|
||||
}
|
||||
|
||||
void mario_blow_off_cap(struct MarioState *m, f32 capSpeed) {
|
||||
struct Object *capObject;
|
||||
|
||||
if (does_mario_have_hat(m)) {
|
||||
if (does_mario_have_normal_cap_on_head(m)) {
|
||||
save_file_set_cap_pos(m->pos[0], m->pos[1], m->pos[2]);
|
||||
|
||||
m->flags &= ~(MARIO_NORMAL_CAP | MARIO_CAP_ON_HEAD);
|
||||
@ -367,7 +368,7 @@ void mario_blow_off_cap(struct MarioState *m, f32 capSpeed) {
|
||||
u32 mario_lose_cap_to_enemy(u32 arg) {
|
||||
u32 wasWearingCap = FALSE;
|
||||
|
||||
if (does_mario_have_hat(gMarioState)) {
|
||||
if (does_mario_have_normal_cap_on_head(gMarioState)) {
|
||||
save_file_set_flags(arg == 1 ? SAVE_FLAG_CAP_ON_KLEPTO : SAVE_FLAG_CAP_ON_UKIKI);
|
||||
gMarioState->flags &= ~(MARIO_NORMAL_CAP | MARIO_CAP_ON_HEAD);
|
||||
wasWearingCap = TRUE;
|
||||
@ -416,7 +417,7 @@ struct Object *mario_get_collided_object(struct MarioState *m, u32 interactType)
|
||||
|
||||
u32 mario_check_object_grab(struct MarioState *m) {
|
||||
u32 result = FALSE;
|
||||
void *script;
|
||||
const BehaviorScript *script;
|
||||
|
||||
if (m->input & INPUT_INTERACT_OBJ_GRABBABLE) {
|
||||
script = virtual_to_segmented(0x13, m->interactObj->behavior);
|
||||
@ -702,6 +703,7 @@ u32 take_damage_from_interact_object(struct MarioState *m) {
|
||||
queue_rumble_data(5, 80);
|
||||
#endif
|
||||
set_camera_shake_from_hit(shake);
|
||||
|
||||
return damage;
|
||||
}
|
||||
|
||||
@ -819,7 +821,6 @@ u32 interact_star_or_key(struct MarioState *m, UNUSED u32 interactType, struct O
|
||||
play_sound(SOUND_MENU_STAR_SOUND, m->marioObj->header.gfx.cameraToObject);
|
||||
#ifndef VERSION_JP
|
||||
update_mario_sound_and_camera(m);
|
||||
// func_802521A0
|
||||
#endif
|
||||
|
||||
if (grandStar) {
|
||||
@ -1220,6 +1221,7 @@ u32 interact_clam_or_bubba(struct MarioState *m, UNUSED u32 interactType, struct
|
||||
if (!(o->oInteractionSubtype & INT_SUBTYPE_DELAY_INVINCIBILITY)) {
|
||||
sDelayInvincTimer = TRUE;
|
||||
}
|
||||
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
@ -1295,6 +1297,7 @@ u32 interact_shock(struct MarioState *m, UNUSED u32 interactType, struct Object
|
||||
if (!(o->oInteractionSubtype & INT_SUBTYPE_DELAY_INVINCIBILITY)) {
|
||||
sDelayInvincTimer = TRUE;
|
||||
}
|
||||
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
@ -1357,6 +1360,7 @@ u32 interact_hit_from_below(struct MarioState *m, UNUSED u32 interactType, struc
|
||||
if (!(o->oInteractionSubtype & INT_SUBTYPE_DELAY_INVINCIBILITY)) {
|
||||
sDelayInvincTimer = TRUE;
|
||||
}
|
||||
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
@ -1394,6 +1398,7 @@ u32 interact_bounce_top(struct MarioState *m, UNUSED u32 interactType, struct Ob
|
||||
if (!(o->oInteractionSubtype & INT_SUBTYPE_DELAY_INVINCIBILITY)) {
|
||||
sDelayInvincTimer = TRUE;
|
||||
}
|
||||
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
@ -1410,6 +1415,7 @@ u32 interact_unknown_08(struct MarioState *m, UNUSED u32 interactType, struct Ob
|
||||
if (!(o->oInteractionSubtype & INT_SUBTYPE_DELAY_INVINCIBILITY)) {
|
||||
sDelayInvincTimer = TRUE;
|
||||
}
|
||||
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
@ -1421,6 +1427,7 @@ u32 interact_damage(struct MarioState *m, UNUSED u32 interactType, struct Object
|
||||
if (!(o->oInteractionSubtype & INT_SUBTYPE_DELAY_INVINCIBILITY)) {
|
||||
sDelayInvincTimer = TRUE;
|
||||
}
|
||||
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
@ -1625,7 +1632,7 @@ u32 interact_cap(struct MarioState *m, UNUSED u32 interactType, struct Object *o
|
||||
}
|
||||
|
||||
u32 interact_grabbable(struct MarioState *m, u32 interactType, struct Object *o) {
|
||||
void *script = virtual_to_segmented(0x13, o->behavior);
|
||||
const BehaviorScript *script = virtual_to_segmented(0x13, o->behavior);
|
||||
|
||||
if (o->oInteractionSubtype & INT_SUBTYPE_KICKABLE) {
|
||||
u32 interaction = determine_interaction(m, o);
|
||||
@ -1653,6 +1660,7 @@ u32 interact_grabbable(struct MarioState *m, u32 interactType, struct Object *o)
|
||||
if (script != bhvBowser) {
|
||||
push_mario_out_of_object(m, o, -5.0f);
|
||||
}
|
||||
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
@ -1668,7 +1676,7 @@ u32 mario_can_talk(struct MarioState *m, u32 arg) {
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
val6 = m->marioObj->header.gfx.unk38.animID;
|
||||
val6 = m->marioObj->header.gfx.animInfo.animID;
|
||||
|
||||
if (val6 == 0x0080 || val6 == 0x007F || val6 == 0x006C) {
|
||||
return TRUE;
|
||||
|
@ -84,7 +84,7 @@
|
||||
#define INT_STATUS_MARIO_UNK1 (1 << 1) /* 0x00000002 */
|
||||
#define INT_STATUS_MARIO_UNK2 (1 << 2) /* 0x00000004 */
|
||||
#define INT_STATUS_MARIO_DROP_OBJECT (1 << 3) /* 0x00000008 */
|
||||
#define INT_STATUS_MARIO_UNK4 (1 << 4) /* 0x00000010 */
|
||||
#define INT_STATUS_HIT_BY_SHOCKWAVE (1 << 4) /* 0x00000010 */
|
||||
#define INT_STATUS_MARIO_UNK5 (1 << 5) /* 0x00000020 */
|
||||
#define INT_STATUS_MARIO_UNK6 (1 << 6) /* 0x00000040 */
|
||||
#define INT_STATUS_MARIO_UNK7 (1 << 7) /* 0x00000080 */
|
||||
@ -104,7 +104,7 @@ void mario_grab_used_object(struct MarioState *m);
|
||||
void mario_drop_held_object(struct MarioState *m);
|
||||
void mario_throw_held_object(struct MarioState *m);
|
||||
void mario_stop_riding_and_holding(struct MarioState *m);
|
||||
u32 does_mario_have_hat(struct MarioState *m);
|
||||
u32 does_mario_have_normal_cap_on_head(struct MarioState *m);
|
||||
void mario_blow_off_cap(struct MarioState *m, f32 capSpeed);
|
||||
u32 mario_lose_cap_to_enemy(u32 arg);
|
||||
void mario_retrieve_cap(void);
|
||||
|
@ -51,6 +51,7 @@ Gfx *geo_envfx_main(s32 callContext, struct GraphNode *node, Mat4 mtxf) {
|
||||
vec3s_copy(marioPos, gVec3sZero);
|
||||
envfx_update_particles(ENVFX_MODE_NONE, marioPos, camTo, camFrom);
|
||||
}
|
||||
|
||||
return gfx;
|
||||
}
|
||||
|
||||
@ -73,5 +74,6 @@ Gfx *geo_skybox_main(s32 callContext, struct GraphNode *node, UNUSED Mat4 *mtx)
|
||||
gLakituState.pos[1], gLakituState.pos[2], gLakituState.focus[0],
|
||||
gLakituState.focus[1], gLakituState.focus[2]);
|
||||
}
|
||||
|
||||
return gfx;
|
||||
}
|
||||
|
@ -165,11 +165,11 @@ s32 sDelayedWarpArg;
|
||||
s16 unusedEULevelUpdateBss1;
|
||||
#endif
|
||||
s8 sTimerRunning;
|
||||
s8 gShouldNotPlayCastleMusic;
|
||||
s8 gNeverEnteredCastle;
|
||||
|
||||
struct MarioState *gMarioState = &gMarioStates[0];
|
||||
u8 unused1[4] = { 0 };
|
||||
s8 D_8032C9E0 = 0;
|
||||
s8 sWarpCheckpointActive = FALSE;
|
||||
u8 unused3[4];
|
||||
u8 unused4[2];
|
||||
|
||||
@ -432,7 +432,7 @@ void init_mario_after_warp(void) {
|
||||
#ifndef VERSION_JP
|
||||
if (gCurrLevelNum == LEVEL_BOB
|
||||
&& get_current_background_music() != SEQUENCE_ARGS(4, SEQ_LEVEL_SLIDE)
|
||||
&& sTimerRunning != 0) {
|
||||
&& sTimerRunning) {
|
||||
play_music(SEQ_PLAYER_LEVEL, SEQUENCE_ARGS(4, SEQ_LEVEL_SLIDE), 0);
|
||||
}
|
||||
#endif
|
||||
@ -663,7 +663,7 @@ void initiate_painting_warp(void) {
|
||||
warpNode = *pWarpNode;
|
||||
|
||||
if (!(warpNode.destLevel & 0x80)) {
|
||||
D_8032C9E0 = check_warp_checkpoint(&warpNode);
|
||||
sWarpCheckpointActive = check_warp_checkpoint(&warpNode);
|
||||
}
|
||||
|
||||
initiate_warp(warpNode.destLevel & 0x7F, warpNode.destArea, warpNode.destNode, 0);
|
||||
@ -702,8 +702,7 @@ s16 level_trigger_warp(struct MarioState *m, s32 warpOp) {
|
||||
|
||||
switch (warpOp) {
|
||||
case WARP_OP_DEMO_NEXT:
|
||||
case WARP_OP_DEMO_END:
|
||||
do {sDelayedWarpTimer = 20;} while (0);
|
||||
case WARP_OP_DEMO_END: sDelayedWarpTimer = 20; // Must be one line to match on -O2
|
||||
sSourceWarpNodeId = WARP_NODE_F0;
|
||||
gSavedCourseNum = COURSE_NONE;
|
||||
val04 = FALSE;
|
||||
@ -885,7 +884,7 @@ void update_hud_values(void) {
|
||||
if (gCurrCreditsEntry == NULL) {
|
||||
s16 numHealthWedges = gMarioState->health > 0 ? gMarioState->health >> 8 : 0;
|
||||
|
||||
if (gCurrCourseNum > 0) {
|
||||
if (gCurrCourseNum >= COURSE_MIN) {
|
||||
gHudDisplay.flags |= HUD_DISPLAY_FLAG_COIN_COUNT;
|
||||
} else {
|
||||
gHudDisplay.flags &= ~HUD_DISPLAY_FLAG_COIN_COUNT;
|
||||
@ -1073,7 +1072,6 @@ s32 play_mode_change_area(void) {
|
||||
sTransitionTimer -= 1;
|
||||
}
|
||||
|
||||
//! If sTransitionTimer is -1, this will miss.
|
||||
if (sTransitionTimer == 0) {
|
||||
sTransitionUpdate = NULL;
|
||||
set_play_mode(PLAY_MODE_NORMAL);
|
||||
@ -1090,7 +1088,6 @@ s32 play_mode_change_level(void) {
|
||||
sTransitionUpdate(&sTransitionTimer);
|
||||
}
|
||||
|
||||
//! If sTransitionTimer is -1, this will miss.
|
||||
if (--sTransitionTimer == -1) {
|
||||
gHudDisplay.flags = HUD_DISPLAY_NONE;
|
||||
sTransitionTimer = 0;
|
||||
@ -1167,7 +1164,7 @@ s32 init_level(void) {
|
||||
gHudDisplay.flags = HUD_DISPLAY_NONE;
|
||||
}
|
||||
|
||||
sTimerRunning = 0;
|
||||
sTimerRunning = FALSE;
|
||||
|
||||
if (sWarpDest.type != WARP_TYPE_NOT_WARPING) {
|
||||
if (sWarpDest.nodeId >= WARP_NODE_CREDITS_MIN) {
|
||||
@ -1186,7 +1183,7 @@ s32 init_level(void) {
|
||||
|
||||
if (gCurrDemoInput != NULL) {
|
||||
set_mario_action(gMarioState, ACT_IDLE, 0);
|
||||
} else if (gDebugLevelSelect == 0) {
|
||||
} else if (!gDebugLevelSelect) {
|
||||
if (gMarioState->action != ACT_UNINITIALIZED) {
|
||||
if (save_file_exists(gCurrSaveFileNum - 1)) {
|
||||
set_mario_action(gMarioState, ACT_IDLE, 0);
|
||||
@ -1259,13 +1256,13 @@ s32 lvl_init_from_save_file(UNUSED s16 arg0, s32 levelNum) {
|
||||
#endif
|
||||
sWarpDest.type = WARP_TYPE_NOT_WARPING;
|
||||
sDelayedWarpOp = WARP_OP_NONE;
|
||||
gShouldNotPlayCastleMusic = !save_file_exists(gCurrSaveFileNum - 1);
|
||||
gNeverEnteredCastle = !save_file_exists(gCurrSaveFileNum - 1);
|
||||
|
||||
gCurrLevelNum = levelNum;
|
||||
gCurrCourseNum = COURSE_NONE;
|
||||
gSavedCourseNum = COURSE_NONE;
|
||||
gCurrCreditsEntry = NULL;
|
||||
gSpecialTripleJump = 0;
|
||||
gSpecialTripleJump = FALSE;
|
||||
|
||||
init_mario_from_save_file();
|
||||
disable_warp_checkpoint();
|
||||
@ -1277,9 +1274,9 @@ s32 lvl_init_from_save_file(UNUSED s16 arg0, s32 levelNum) {
|
||||
}
|
||||
|
||||
s32 lvl_set_current_level(UNUSED s16 arg0, s32 levelNum) {
|
||||
s32 val4 = D_8032C9E0;
|
||||
s32 warpCheckpointActive = sWarpCheckpointActive;
|
||||
|
||||
D_8032C9E0 = 0;
|
||||
sWarpCheckpointActive = FALSE;
|
||||
gCurrLevelNum = levelNum;
|
||||
gCurrCourseNum = gLevelToCourseNumTable[levelNum - 1];
|
||||
|
||||
@ -1300,11 +1297,11 @@ s32 lvl_set_current_level(UNUSED s16 arg0, s32 levelNum) {
|
||||
disable_warp_checkpoint();
|
||||
}
|
||||
|
||||
if (gCurrCourseNum > COURSE_STAGES_MAX || val4 != 0) {
|
||||
if (gCurrCourseNum > COURSE_STAGES_MAX || warpCheckpointActive) {
|
||||
return 0;
|
||||
}
|
||||
|
||||
if (gDebugLevelSelect != 0 && gShowProfiler == 0) {
|
||||
if (gDebugLevelSelect && !gShowProfiler) {
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
@ -100,7 +100,7 @@ struct HudDisplay {
|
||||
};
|
||||
|
||||
extern struct HudDisplay gHudDisplay;
|
||||
extern s8 gShouldNotPlayCastleMusic;
|
||||
extern s8 gNeverEnteredCastle;
|
||||
|
||||
enum HUDDisplayFlag {
|
||||
HUD_DISPLAY_FLAG_LIVES = 0x0001,
|
||||
|
@ -112,8 +112,8 @@ void spawn_macro_objects(s16 areaIndex, s16 *macroObjList) {
|
||||
struct Object *newObj;
|
||||
struct LoadedPreset preset;
|
||||
|
||||
gMacroObjectDefaultParent.header.gfx.unk18 = areaIndex;
|
||||
gMacroObjectDefaultParent.header.gfx.unk19 = areaIndex;
|
||||
gMacroObjectDefaultParent.header.gfx.areaIndex = areaIndex;
|
||||
gMacroObjectDefaultParent.header.gfx.activeAreaIndex = areaIndex;
|
||||
|
||||
while (TRUE) {
|
||||
if (*macroObjList == -1) { // An encountered value of -1 means the list has ended.
|
||||
@ -184,8 +184,8 @@ void spawn_macro_objects_hardcoded(s16 areaIndex, s16 *macroObjList) {
|
||||
|
||||
UNUSED u8 pad2[10];
|
||||
|
||||
gMacroObjectDefaultParent.header.gfx.unk18 = areaIndex;
|
||||
gMacroObjectDefaultParent.header.gfx.unk19 = areaIndex;
|
||||
gMacroObjectDefaultParent.header.gfx.areaIndex = areaIndex;
|
||||
gMacroObjectDefaultParent.header.gfx.activeAreaIndex = areaIndex;
|
||||
|
||||
while (TRUE) {
|
||||
macroObjPreset = *macroObjList++;
|
||||
@ -258,8 +258,8 @@ void spawn_special_objects(s16 areaIndex, s16 **specialObjList) {
|
||||
numOfSpecialObjects = **specialObjList;
|
||||
(*specialObjList)++;
|
||||
|
||||
gMacroObjectDefaultParent.header.gfx.unk18 = areaIndex;
|
||||
gMacroObjectDefaultParent.header.gfx.unk19 = areaIndex;
|
||||
gMacroObjectDefaultParent.header.gfx.areaIndex = areaIndex;
|
||||
gMacroObjectDefaultParent.header.gfx.activeAreaIndex = areaIndex;
|
||||
|
||||
for (i = 0; i < numOfSpecialObjects; i++) {
|
||||
presetID = (u8) * *specialObjList;
|
||||
|
@ -5,7 +5,6 @@
|
||||
|
||||
#include "types.h"
|
||||
|
||||
/* Functions */
|
||||
s16 convert_rotation(s16 inRotation);
|
||||
|
||||
void spawn_macro_abs_yrot_2params(u32 model, const BehaviorScript *behavior, s16 x, s16 y, s16 z, s16 ry, s16 params);
|
||||
|
@ -61,11 +61,11 @@ struct SPTask *sCurrentAudioSPTask = NULL;
|
||||
struct SPTask *sCurrentDisplaySPTask = NULL;
|
||||
struct SPTask *sNextAudioSPTask = NULL;
|
||||
struct SPTask *sNextDisplaySPTask = NULL;
|
||||
s8 sAudioEnabled = 1;
|
||||
s8 sAudioEnabled = TRUE;
|
||||
u32 sNumVblanks = 0;
|
||||
s8 gResetTimer = 0;
|
||||
s8 D_8032C648 = 0;
|
||||
s8 gDebugLevelSelect = 0;
|
||||
s8 gDebugLevelSelect = FALSE;
|
||||
s8 D_8032C650 = 0;
|
||||
|
||||
s8 gShowProfiler = FALSE;
|
||||
@ -254,7 +254,7 @@ void handle_vblank(void) {
|
||||
interrupt_gfx_sptask();
|
||||
} else {
|
||||
profiler_log_vblank_time();
|
||||
if (sAudioEnabled != 0) {
|
||||
if (sAudioEnabled) {
|
||||
start_sptask(M_AUDTASK);
|
||||
} else {
|
||||
pretend_audio_sptask_done();
|
||||
@ -298,7 +298,7 @@ void handle_sp_complete(void) {
|
||||
|
||||
// Start the audio task, as expected by handle_vblank.
|
||||
profiler_log_vblank_time();
|
||||
if (sAudioEnabled != 0) {
|
||||
if (sAudioEnabled) {
|
||||
start_sptask(M_AUDTASK);
|
||||
} else {
|
||||
pretend_audio_sptask_done();
|
||||
@ -349,7 +349,7 @@ void thread3_main(UNUSED void *arg) {
|
||||
create_thread(&gGameLoopThread, 5, thread5_game_loop, NULL, gThread5Stack + 0x2000, 10);
|
||||
osStartThread(&gGameLoopThread);
|
||||
|
||||
while (1) {
|
||||
while (TRUE) {
|
||||
OSMesg msg;
|
||||
|
||||
osRecvMesg(&gIntrMesgQueue, &msg, OS_MESG_BLOCK);
|
||||
@ -394,7 +394,7 @@ void send_sp_task_message(OSMesg *msg) {
|
||||
}
|
||||
|
||||
void dispatch_audio_sptask(struct SPTask *spTask) {
|
||||
if (sAudioEnabled != 0 && spTask != NULL) {
|
||||
if (sAudioEnabled && spTask != NULL) {
|
||||
osWritebackDCacheAll();
|
||||
osSendMesg(&gSPTaskMesgQueue, spTask, OS_MESG_NOBLOCK);
|
||||
}
|
||||
@ -415,11 +415,11 @@ void send_display_list(struct SPTask *spTask) {
|
||||
}
|
||||
|
||||
void turn_on_audio(void) {
|
||||
sAudioEnabled = 1;
|
||||
sAudioEnabled = TRUE;
|
||||
}
|
||||
|
||||
void turn_off_audio(void) {
|
||||
sAudioEnabled = 0;
|
||||
sAudioEnabled = FALSE;
|
||||
while (sCurrentAudioSPTask != NULL) {
|
||||
;
|
||||
}
|
||||
@ -456,7 +456,7 @@ void thread1_idle(UNUSED void *arg) {
|
||||
osSetThreadPri(NULL, 0);
|
||||
|
||||
// halt
|
||||
while (1) {
|
||||
while (TRUE) {
|
||||
;
|
||||
}
|
||||
}
|
||||
|
Some files were not shown because too many files have changed in this diff Show More
Loading…
Reference in New Issue
Block a user