9 Commits

Author SHA1 Message Date
NepuShiro 40bee0f224 :(
Build libsm64 / Build libsm64 for linux (push) Successful in 34s
Build libsm64 / Build libsm64 for web (push) Successful in 32s
Build libsm64 / Build libsm64 for windows (push) Successful in 24s
2026-05-31 21:57:50 -05:00
NepuShiro ede2099ff5 Implement FakeObjects (Just poles for now)
Build libsm64 / Build libsm64 for linux (push) Successful in 33s
Build libsm64 / Build libsm64 for web (push) Successful in 30s
Build libsm64 / Build libsm64 for windows (push) Successful in 23s
2026-05-31 16:55:19 -05:00
NepuShiro b096207a10 Implement play/stop cap and shell music
Build libsm64 / Build libsm64 for linux (push) Successful in 32s
Build libsm64 / Build libsm64 for web (push) Successful in 31s
Build libsm64 / Build libsm64 for windows (push) Successful in 25s
2026-05-27 19:04:13 -05:00
NepuShiro d6bafb4403 Implement play/stop cap and shell music
Build libsm64 / Build libsm64 for linux (push) Failing after 29s
Build libsm64 / Build libsm64 for web (push) Successful in 33s
Build libsm64 / Build libsm64 for windows (push) Successful in 24s
2026-05-27 19:00:04 -05:00
NepuShiro a499b4f032 Implement Rumble
Build libsm64 / Build libsm64 for linux (push) Successful in 31s
Build libsm64 / Build libsm64 for web (push) Successful in 32s
Build libsm64 / Build libsm64 for windows (push) Successful in 24s
2026-05-25 12:34:52 -05:00
NepuShiro bd3dd8f523 Add SurfaceFlags, and more formatting :)
Build libsm64 / Build libsm64 for linux (push) Successful in 32s
Build libsm64 / Build libsm64 for web (push) Successful in 39s
Build libsm64 / Build libsm64 for windows (push) Successful in 25s
2026-05-24 18:03:08 -05:00
NepuShiro d3ea4e5e99 Reformat to something more readable for me :3
Build libsm64 / Build libsm64 for linux (push) Successful in 30s
Build libsm64 / Build libsm64 for web (push) Successful in 30s
Build libsm64 / Build libsm64 for windows (push) Successful in 23s
2026-05-24 12:13:35 -05:00
NepuShiro 4328104536 Make Surfaces Float
Build libsm64 / Build libsm64 for linux (push) Successful in 29s
Build libsm64 / Build libsm64 for web (push) Successful in 31s
Build libsm64 / Build libsm64 for windows (push) Successful in 24s
2026-05-23 15:08:00 -05:00
NepuShiro aa092bebfe fixes somethigns
Build libsm64 / Build libsm64 for linux (push) Successful in 38s
Build libsm64 / Build libsm64 for web (push) Successful in 32s
Build libsm64 / Build libsm64 for windows (push) Successful in 24s
2026-05-23 11:20:57 -05:00
420 changed files with 158289 additions and 21826 deletions
+13 -6
View File
@@ -13,8 +13,6 @@ jobs:
os: ubuntu-latest
- identifier: windows
os: ubuntu-latest
- identifier: macos
os: macos-latest
- identifier: web
os: ubuntu-latest
runs-on: ${{ matrix.os }}
@@ -27,9 +25,13 @@ jobs:
with:
python-version: '3.10'
- name: (Windows) Set up MinGW
- name: (Windows) Install MinGW
if: ${{ startsWith(matrix.identifier, 'windows') }}
uses: egor-tensin/setup-mingw@v2
run: |
sudo apt-get update -y -qq
sudo apt-get install -y mingw-w64
sudo update-alternatives --set x86_64-w64-mingw32-gcc /usr/bin/x86_64-w64-mingw32-gcc-posix
sudo update-alternatives --set x86_64-w64-mingw32-g++ /usr/bin/x86_64-w64-mingw32-g++-posix
- name: (Windows) Prepare cross compilation
if: ${{ startsWith(matrix.identifier, 'windows') }}
@@ -42,16 +44,21 @@ jobs:
run: |
sudo add-apt-repository -y "deb http://archive.ubuntu.com/ubuntu `lsb_release -sc` main universe restricted multiverse"
sudo apt-get update -y -qq
sudo apt-get install libsdl2-dev libglew-dev
sudo apt-get install -y libsdl2-dev libglew-dev
- name: (Web) Set up Emscripten
if: ${{ startsWith(matrix.identifier, 'web') }}
uses: mymindstorm/setup-emsdk@v14
- name: Build shared library
shell: bash
run: |
if [[ "${{ matrix.identifier }}" == "web" ]]; then
emmake make lib -j $(nproc) CC=emcc
elif [[ "${{ matrix.identifier }}" == "windows" ]]; then
make lib -j $(nproc 2>/dev/null || sysctl -n hw.ncpu) \
CC=x86_64-w64-mingw32-gcc \
CXX=x86_64-w64-mingw32-g++
else
make lib -j $(nproc 2>/dev/null || sysctl -n hw.ncpu)
fi
@@ -62,7 +69,7 @@ jobs:
make test -j`nproc`
- name: Upload build
uses: actions/upload-artifact@v4
uses: actions/upload-artifact@v3
with:
name: libsm64_${{ matrix.identifier }}
path: |
+10
View File
@@ -0,0 +1,10 @@
# Default ignored files
/shelf/
/workspace.xml
# Editor-based HTTP Client requests
/httpRequests/
# Ignored default folder with query files
/queries/
# Datasource local storage ignored files
/dataSources/
/dataSources.local.xml
+5
View File
@@ -0,0 +1,5 @@
<component name="ProjectCodeStyleConfiguration">
<state>
<option name="PREFERRED_PROJECT_CODE_STYLE" value="Default" />
</state>
</component>
+393
View File
@@ -0,0 +1,393 @@
<?xml version="1.0" encoding="UTF-8"?>
<project version="4">
<component name="BackendCodeEditorSettings">
<option name="/Default/CodeInspection/Highlighting/InspectionSeverities/=CDeclarationWithImplicitIntType/@EntryIndexedValue" value="WARNING" type="string" />
<option name="/Default/CodeInspection/Highlighting/InspectionSeverities/=CommentTypo/@EntryIndexedValue" value="DO_NOT_SHOW" type="string" />
<option name="/Default/CodeInspection/Highlighting/InspectionSeverities/=ConstevalIfIsAlwaysConstant/@EntryIndexedValue" value="WARNING" type="string" />
<option name="/Default/CodeInspection/Highlighting/InspectionSeverities/=CppAbstractClassWithoutSpecifier/@EntryIndexedValue" value="WARNING" type="string" />
<option name="/Default/CodeInspection/Highlighting/InspectionSeverities/=CppAbstractFinalClass/@EntryIndexedValue" value="WARNING" type="string" />
<option name="/Default/CodeInspection/Highlighting/InspectionSeverities/=CppAbstractVirtualFunctionCallInCtor/@EntryIndexedValue" value="ERROR" type="string" />
<option name="/Default/CodeInspection/Highlighting/InspectionSeverities/=CppAccessSpecifierWithNoDeclarations/@EntryIndexedValue" value="SUGGESTION" type="string" />
<option name="/Default/CodeInspection/Highlighting/InspectionSeverities/=CppAwaiterTypeIsNotClass/@EntryIndexedValue" value="WARNING" type="string" />
<option name="/Default/CodeInspection/Highlighting/InspectionSeverities/=CppBooleanIncrementExpression/@EntryIndexedValue" value="WARNING" type="string" />
<option name="/Default/CodeInspection/Highlighting/InspectionSeverities/=CppBoostFormatBadCode/@EntryIndexedValue" value="WARNING" type="string" />
<option name="/Default/CodeInspection/Highlighting/InspectionSeverities/=CppBoostFormatLegacyCode/@EntryIndexedValue" value="SUGGESTION" type="string" />
<option name="/Default/CodeInspection/Highlighting/InspectionSeverities/=CppBoostFormatMixedArgs/@EntryIndexedValue" value="ERROR" type="string" />
<option name="/Default/CodeInspection/Highlighting/InspectionSeverities/=CppBoostFormatTooFewArgs/@EntryIndexedValue" value="ERROR" type="string" />
<option name="/Default/CodeInspection/Highlighting/InspectionSeverities/=CppBoostFormatTooManyArgs/@EntryIndexedValue" value="WARNING" type="string" />
<option name="/Default/CodeInspection/Highlighting/InspectionSeverities/=CppCStyleCast/@EntryIndexedValue" value="DO_NOT_SHOW" type="string" />
<option name="/Default/CodeInspection/Highlighting/InspectionSeverities/=CppCVQualifierCanNotBeAppliedToReference/@EntryIndexedValue" value="WARNING" type="string" />
<option name="/Default/CodeInspection/Highlighting/InspectionSeverities/=CppClassCanBeFinal/@EntryIndexedValue" value="DO_NOT_SHOW" type="string" />
<option name="/Default/CodeInspection/Highlighting/InspectionSeverities/=CppClassIsIncomplete/@EntryIndexedValue" value="WARNING" type="string" />
<option name="/Default/CodeInspection/Highlighting/InspectionSeverities/=CppClassNeedsConstructorBecauseOfUninitializedMember/@EntryIndexedValue" value="WARNING" type="string" />
<option name="/Default/CodeInspection/Highlighting/InspectionSeverities/=CppClassNeverUsed/@EntryIndexedValue" value="WARNING" type="string" />
<option name="/Default/CodeInspection/Highlighting/InspectionSeverities/=CppCompileTimeConstantCanBeReplacedWithBooleanConstant/@EntryIndexedValue" value="SUGGESTION" type="string" />
<option name="/Default/CodeInspection/Highlighting/InspectionSeverities/=CppConceptNeverUsed/@EntryIndexedValue" value="WARNING" type="string" />
<option name="/Default/CodeInspection/Highlighting/InspectionSeverities/=CppConditionalExpressionCanBeSimplified/@EntryIndexedValue" value="SUGGESTION" type="string" />
<option name="/Default/CodeInspection/Highlighting/InspectionSeverities/=CppConstParameterInDeclaration/@EntryIndexedValue" value="SUGGESTION" type="string" />
<option name="/Default/CodeInspection/Highlighting/InspectionSeverities/=CppConstValueFunctionReturnType/@EntryIndexedValue" value="SUGGESTION" type="string" />
<option name="/Default/CodeInspection/Highlighting/InspectionSeverities/=CppCoroutineCallResolveError/@EntryIndexedValue" value="WARNING" type="string" />
<option name="/Default/CodeInspection/Highlighting/InspectionSeverities/=CppDFAArrayIndexOutOfBounds/@EntryIndexedValue" value="WARNING" type="string" />
<option name="/Default/CodeInspection/Highlighting/InspectionSeverities/=CppDFAConstantConditions/@EntryIndexedValue" value="WARNING" type="string" />
<option name="/Default/CodeInspection/Highlighting/InspectionSeverities/=CppDFAConstantFunctionResult/@EntryIndexedValue" value="WARNING" type="string" />
<option name="/Default/CodeInspection/Highlighting/InspectionSeverities/=CppDFAConstantParameter/@EntryIndexedValue" value="WARNING" type="string" />
<option name="/Default/CodeInspection/Highlighting/InspectionSeverities/=CppDFADeletedPointer/@EntryIndexedValue" value="WARNING" type="string" />
<option name="/Default/CodeInspection/Highlighting/InspectionSeverities/=CppDFAEndlessLoop/@EntryIndexedValue" value="WARNING" type="string" />
<option name="/Default/CodeInspection/Highlighting/InspectionSeverities/=CppDFAInfiniteRecursion/@EntryIndexedValue" value="WARNING" type="string" />
<option name="/Default/CodeInspection/Highlighting/InspectionSeverities/=CppDFAInvalidatedMemory/@EntryIndexedValue" value="WARNING" type="string" />
<option name="/Default/CodeInspection/Highlighting/InspectionSeverities/=CppDFALocalValueEscapesFunction/@EntryIndexedValue" value="WARNING" type="string" />
<option name="/Default/CodeInspection/Highlighting/InspectionSeverities/=CppDFALocalValueEscapesScope/@EntryIndexedValue" value="WARNING" type="string" />
<option name="/Default/CodeInspection/Highlighting/InspectionSeverities/=CppDFALoopConditionNotUpdated/@EntryIndexedValue" value="WARNING" type="string" />
<option name="/Default/CodeInspection/Highlighting/InspectionSeverities/=CppDFAMemoryLeak/@EntryIndexedValue" value="WARNING" type="string" />
<option name="/Default/CodeInspection/Highlighting/InspectionSeverities/=CppDFANotInitializedField/@EntryIndexedValue" value="WARNING" type="string" />
<option name="/Default/CodeInspection/Highlighting/InspectionSeverities/=CppDFANullDereference/@EntryIndexedValue" value="WARNING" type="string" />
<option name="/Default/CodeInspection/Highlighting/InspectionSeverities/=CppDFATimeOver/@EntryIndexedValue" value="HINT" type="string" />
<option name="/Default/CodeInspection/Highlighting/InspectionSeverities/=CppDFAUnreachableCode/@EntryIndexedValue" value="WARNING" type="string" />
<option name="/Default/CodeInspection/Highlighting/InspectionSeverities/=CppDFAUnreachableFunctionCall/@EntryIndexedValue" value="WARNING" type="string" />
<option name="/Default/CodeInspection/Highlighting/InspectionSeverities/=CppDFAUnreadVariable/@EntryIndexedValue" value="WARNING" type="string" />
<option name="/Default/CodeInspection/Highlighting/InspectionSeverities/=CppDFAUnusedValue/@EntryIndexedValue" value="WARNING" type="string" />
<option name="/Default/CodeInspection/Highlighting/InspectionSeverities/=CppDeclarationHidesLocal/@EntryIndexedValue" value="WARNING" type="string" />
<option name="/Default/CodeInspection/Highlighting/InspectionSeverities/=CppDeclarationHidesUncapturedLocal/@EntryIndexedValue" value="HINT" type="string" />
<option name="/Default/CodeInspection/Highlighting/InspectionSeverities/=CppDeclarationSpecifierWithoutDeclarators/@EntryIndexedValue" value="WARNING" type="string" />
<option name="/Default/CodeInspection/Highlighting/InspectionSeverities/=CppDeclaratorDisambiguatedAsFunction/@EntryIndexedValue" value="WARNING" type="string" />
<option name="/Default/CodeInspection/Highlighting/InspectionSeverities/=CppDeclaratorNeverUsed/@EntryIndexedValue" value="WARNING" type="string" />
<option name="/Default/CodeInspection/Highlighting/InspectionSeverities/=CppDeclaratorUsedBeforeInitialization/@EntryIndexedValue" value="ERROR" type="string" />
<option name="/Default/CodeInspection/Highlighting/InspectionSeverities/=CppDefaultCaseNotHandledInSwitchStatement/@EntryIndexedValue" value="WARNING" type="string" />
<option name="/Default/CodeInspection/Highlighting/InspectionSeverities/=CppDefaultInitializationWithNoUserConstructor/@EntryIndexedValue" value="WARNING" type="string" />
<option name="/Default/CodeInspection/Highlighting/InspectionSeverities/=CppDefaultIsUsedAsIdentifier/@EntryIndexedValue" value="WARNING" type="string" />
<option name="/Default/CodeInspection/Highlighting/InspectionSeverities/=CppDefaultedSpecialMemberFunctionIsImplicitlyDeleted/@EntryIndexedValue" value="WARNING" type="string" />
<option name="/Default/CodeInspection/Highlighting/InspectionSeverities/=CppDefinitionsOrder/@EntryIndexedValue" value="HINT" type="string" />
<option name="/Default/CodeInspection/Highlighting/InspectionSeverities/=CppDeletingVoidPointer/@EntryIndexedValue" value="WARNING" type="string" />
<option name="/Default/CodeInspection/Highlighting/InspectionSeverities/=CppDependentTemplateWithoutTemplateKeyword/@EntryIndexedValue" value="WARNING" type="string" />
<option name="/Default/CodeInspection/Highlighting/InspectionSeverities/=CppDependentTypeWithoutTypenameKeyword/@EntryIndexedValue" value="WARNING" type="string" />
<option name="/Default/CodeInspection/Highlighting/InspectionSeverities/=CppDeprecatedEntity/@EntryIndexedValue" value="WARNING" type="string" />
<option name="/Default/CodeInspection/Highlighting/InspectionSeverities/=CppDeprecatedOverridenMethod/@EntryIndexedValue" value="WARNING" type="string" />
<option name="/Default/CodeInspection/Highlighting/InspectionSeverities/=CppDeprecatedRegisterStorageClassSpecifier/@EntryIndexedValue" value="WARNING" type="string" />
<option name="/Default/CodeInspection/Highlighting/InspectionSeverities/=CppDereferenceOperatorLimitExceeded/@EntryIndexedValue" value="WARNING" type="string" />
<option name="/Default/CodeInspection/Highlighting/InspectionSeverities/=CppDiscardedPostfixOperatorResult/@EntryIndexedValue" value="SUGGESTION" type="string" />
<option name="/Default/CodeInspection/Highlighting/InspectionSeverities/=CppDoxygenSyntaxError/@EntryIndexedValue" value="WARNING" type="string" />
<option name="/Default/CodeInspection/Highlighting/InspectionSeverities/=CppDoxygenUndocumentedParameter/@EntryIndexedValue" value="SUGGESTION" type="string" />
<option name="/Default/CodeInspection/Highlighting/InspectionSeverities/=CppDoxygenUnresolvedReference/@EntryIndexedValue" value="WARNING" type="string" />
<option name="/Default/CodeInspection/Highlighting/InspectionSeverities/=CppEmptyDeclaration/@EntryIndexedValue" value="WARNING" type="string" />
<option name="/Default/CodeInspection/Highlighting/InspectionSeverities/=CppEnforceCVQualifiersOrder/@EntryIndexedValue" value="DO_NOT_SHOW" type="string" />
<option name="/Default/CodeInspection/Highlighting/InspectionSeverities/=CppEnforceCVQualifiersPlacement/@EntryIndexedValue" value="DO_NOT_SHOW" type="string" />
<option name="/Default/CodeInspection/Highlighting/InspectionSeverities/=CppEnforceDoStatementBraces/@EntryIndexedValue" value="DO_NOT_SHOW" type="string" />
<option name="/Default/CodeInspection/Highlighting/InspectionSeverities/=CppEnforceForStatementBraces/@EntryIndexedValue" value="DO_NOT_SHOW" type="string" />
<option name="/Default/CodeInspection/Highlighting/InspectionSeverities/=CppEnforceFunctionDeclarationStyle/@EntryIndexedValue" value="DO_NOT_SHOW" type="string" />
<option name="/Default/CodeInspection/Highlighting/InspectionSeverities/=CppEnforceIfStatementBraces/@EntryIndexedValue" value="DO_NOT_SHOW" type="string" />
<option name="/Default/CodeInspection/Highlighting/InspectionSeverities/=CppEnforceNestedNamespacesStyle/@EntryIndexedValue" value="HINT" type="string" />
<option name="/Default/CodeInspection/Highlighting/InspectionSeverities/=CppEnforceOverridingDestructorStyle/@EntryIndexedValue" value="SUGGESTION" type="string" />
<option name="/Default/CodeInspection/Highlighting/InspectionSeverities/=CppEnforceOverridingFunctionStyle/@EntryIndexedValue" value="SUGGESTION" type="string" />
<option name="/Default/CodeInspection/Highlighting/InspectionSeverities/=CppEnforceTypeAliasCodeStyle/@EntryIndexedValue" value="DO_NOT_SHOW" type="string" />
<option name="/Default/CodeInspection/Highlighting/InspectionSeverities/=CppEnforceWhileStatementBraces/@EntryIndexedValue" value="DO_NOT_SHOW" type="string" />
<option name="/Default/CodeInspection/Highlighting/InspectionSeverities/=CppEntityAssignedButNoRead/@EntryIndexedValue" value="WARNING" type="string" />
<option name="/Default/CodeInspection/Highlighting/InspectionSeverities/=CppEntityUsedOnlyInUnevaluatedContext/@EntryIndexedValue" value="WARNING" type="string" />
<option name="/Default/CodeInspection/Highlighting/InspectionSeverities/=CppEnumeratorNeverUsed/@EntryIndexedValue" value="WARNING" type="string" />
<option name="/Default/CodeInspection/Highlighting/InspectionSeverities/=CppEqualOperandsInBinaryExpression/@EntryIndexedValue" value="WARNING" type="string" />
<option name="/Default/CodeInspection/Highlighting/InspectionSeverities/=CppEvaluationFailure/@EntryIndexedValue" value="ERROR" type="string" />
<option name="/Default/CodeInspection/Highlighting/InspectionSeverities/=CppExplicitSpecializationInNonNamespaceScope/@EntryIndexedValue" value="WARNING" type="string" />
<option name="/Default/CodeInspection/Highlighting/InspectionSeverities/=CppExpressionWithoutSideEffects/@EntryIndexedValue" value="WARNING" type="string" />
<option name="/Default/CodeInspection/Highlighting/InspectionSeverities/=CppFinalFunctionInFinalClass/@EntryIndexedValue" value="SUGGESTION" type="string" />
<option name="/Default/CodeInspection/Highlighting/InspectionSeverities/=CppFinalNonOverridingVirtualFunction/@EntryIndexedValue" value="SUGGESTION" type="string" />
<option name="/Default/CodeInspection/Highlighting/InspectionSeverities/=CppForLoopCanBeReplacedWithWhile/@EntryIndexedValue" value="SUGGESTION" type="string" />
<option name="/Default/CodeInspection/Highlighting/InspectionSeverities/=CppForwardEnumDeclarationWithoutUnderlyingType/@EntryIndexedValue" value="WARNING" type="string" />
<option name="/Default/CodeInspection/Highlighting/InspectionSeverities/=CppFunctionDoesntReturnValue/@EntryIndexedValue" value="WARNING" type="string" />
<option name="/Default/CodeInspection/Highlighting/InspectionSeverities/=CppFunctionIsNotImplemented/@EntryIndexedValue" value="WARNING" type="string" />
<option name="/Default/CodeInspection/Highlighting/InspectionSeverities/=CppFunctionResultShouldBeUsed/@EntryIndexedValue" value="HINT" type="string" />
<option name="/Default/CodeInspection/Highlighting/InspectionSeverities/=CppFunctionalStyleCast/@EntryIndexedValue" value="SUGGESTION" type="string" />
<option name="/Default/CodeInspection/Highlighting/InspectionSeverities/=CppHeaderHasBeenAlreadyIncluded/@EntryIndexedValue" value="HINT" type="string" />
<option name="/Default/CodeInspection/Highlighting/InspectionSeverities/=CppHiddenFunction/@EntryIndexedValue" value="WARNING" type="string" />
<option name="/Default/CodeInspection/Highlighting/InspectionSeverities/=CppHidingFunction/@EntryIndexedValue" value="WARNING" type="string" />
<option name="/Default/CodeInspection/Highlighting/InspectionSeverities/=CppIdenticalOperandsInBinaryExpression/@EntryIndexedValue" value="WARNING" type="string" />
<option name="/Default/CodeInspection/Highlighting/InspectionSeverities/=CppIfCanBeReplacedByConstexprIf/@EntryIndexedValue" value="SUGGESTION" type="string" />
<option name="/Default/CodeInspection/Highlighting/InspectionSeverities/=CppImplicitDefaultConstructorNotAvailable/@EntryIndexedValue" value="WARNING" type="string" />
<option name="/Default/CodeInspection/Highlighting/InspectionSeverities/=CppIncompatiblePointerConversion/@EntryIndexedValue" value="WARNING" type="string" />
<option name="/Default/CodeInspection/Highlighting/InspectionSeverities/=CppIncompleteSwitchStatement/@EntryIndexedValue" value="WARNING" type="string" />
<option name="/Default/CodeInspection/Highlighting/InspectionSeverities/=CppInconsistentNaming/@EntryIndexedValue" value="DO_NOT_SHOW" type="string" />
<option name="/Default/CodeInspection/Highlighting/InspectionSeverities/=CppIntegralToPointerConversion/@EntryIndexedValue" value="WARNING" type="string" />
<option name="/Default/CodeInspection/Highlighting/InspectionSeverities/=CppInvalidLineContinuation/@EntryIndexedValue" value="WARNING" type="string" />
<option name="/Default/CodeInspection/Highlighting/InspectionSeverities/=CppJoinDeclarationAndAssignment/@EntryIndexedValue" value="SUGGESTION" type="string" />
<option name="/Default/CodeInspection/Highlighting/InspectionSeverities/=CppLambdaCaptureNeverUsed/@EntryIndexedValue" value="WARNING" type="string" />
<option name="/Default/CodeInspection/Highlighting/InspectionSeverities/=CppLocalVariableMayBeConst/@EntryIndexedValue" value="HINT" type="string" />
<option name="/Default/CodeInspection/Highlighting/InspectionSeverities/=CppLocalVariableMightNotBeInitialized/@EntryIndexedValue" value="WARNING" type="string" />
<option name="/Default/CodeInspection/Highlighting/InspectionSeverities/=CppLocalVariableWithNonTrivialDtorIsNeverUsed/@EntryIndexedValue" value="DO_NOT_SHOW" type="string" />
<option name="/Default/CodeInspection/Highlighting/InspectionSeverities/=CppLongFloat/@EntryIndexedValue" value="WARNING" type="string" />
<option name="/Default/CodeInspection/Highlighting/InspectionSeverities/=CppMemberFunctionMayBeConst/@EntryIndexedValue" value="SUGGESTION" type="string" />
<option name="/Default/CodeInspection/Highlighting/InspectionSeverities/=CppMemberFunctionMayBeStatic/@EntryIndexedValue" value="SUGGESTION" type="string" />
<option name="/Default/CodeInspection/Highlighting/InspectionSeverities/=CppMemberInitializersOrder/@EntryIndexedValue" value="SUGGESTION" type="string" />
<option name="/Default/CodeInspection/Highlighting/InspectionSeverities/=CppMismatchedClassTags/@EntryIndexedValue" value="WARNING" type="string" />
<option name="/Default/CodeInspection/Highlighting/InspectionSeverities/=CppMissingIncludeGuard/@EntryIndexedValue" value="WARNING" type="string" />
<option name="/Default/CodeInspection/Highlighting/InspectionSeverities/=CppMissingKeywordThrow/@EntryIndexedValue" value="WARNING" type="string" />
<option name="/Default/CodeInspection/Highlighting/InspectionSeverities/=CppModulePartitionWithSeveralPartitionUnits/@EntryIndexedValue" value="WARNING" type="string" />
<option name="/Default/CodeInspection/Highlighting/InspectionSeverities/=CppMsExtAddressOfClassRValue/@EntryIndexedValue" value="WARNING" type="string" />
<option name="/Default/CodeInspection/Highlighting/InspectionSeverities/=CppMsExtBindingRValueToLvalueReference/@EntryIndexedValue" value="WARNING" type="string" />
<option name="/Default/CodeInspection/Highlighting/InspectionSeverities/=CppMsExtCopyElisionInCopyInitDeclarator/@EntryIndexedValue" value="WARNING" type="string" />
<option name="/Default/CodeInspection/Highlighting/InspectionSeverities/=CppMsExtDoubleUserConversionInCopyInit/@EntryIndexedValue" value="WARNING" type="string" />
<option name="/Default/CodeInspection/Highlighting/InspectionSeverities/=CppMsExtNotInitializedStaticConstLocalVar/@EntryIndexedValue" value="WARNING" type="string" />
<option name="/Default/CodeInspection/Highlighting/InspectionSeverities/=CppMsExtReinterpretCastFromNullptr/@EntryIndexedValue" value="WARNING" type="string" />
<option name="/Default/CodeInspection/Highlighting/InspectionSeverities/=CppMultiCharacterLiteral/@EntryIndexedValue" value="WARNING" type="string" />
<option name="/Default/CodeInspection/Highlighting/InspectionSeverities/=CppMultiCharacterWideLiteral/@EntryIndexedValue" value="WARNING" type="string" />
<option name="/Default/CodeInspection/Highlighting/InspectionSeverities/=CppMustBePublicVirtualToImplementInterface/@EntryIndexedValue" value="WARNING" type="string" />
<option name="/Default/CodeInspection/Highlighting/InspectionSeverities/=CppMutableSpecifierOnReferenceMember/@EntryIndexedValue" value="WARNING" type="string" />
<option name="/Default/CodeInspection/Highlighting/InspectionSeverities/=CppNoDiscardExpression/@EntryIndexedValue" value="WARNING" type="string" />
<option name="/Default/CodeInspection/Highlighting/InspectionSeverities/=CppNodiscardFunctionWithoutReturnValue/@EntryIndexedValue" value="WARNING" type="string" />
<option name="/Default/CodeInspection/Highlighting/InspectionSeverities/=CppNonExceptionSafeResourceAcquisition/@EntryIndexedValue" value="HINT" type="string" />
<option name="/Default/CodeInspection/Highlighting/InspectionSeverities/=CppNonExplicitConversionOperator/@EntryIndexedValue" value="HINT" type="string" />
<option name="/Default/CodeInspection/Highlighting/InspectionSeverities/=CppNonExplicitConvertingConstructor/@EntryIndexedValue" value="HINT" type="string" />
<option name="/Default/CodeInspection/Highlighting/InspectionSeverities/=CppNonInlineFunctionDefinitionInHeaderFile/@EntryIndexedValue" value="WARNING" type="string" />
<option name="/Default/CodeInspection/Highlighting/InspectionSeverities/=CppNonInlineVariableDefinitionInHeaderFile/@EntryIndexedValue" value="WARNING" type="string" />
<option name="/Default/CodeInspection/Highlighting/InspectionSeverities/=CppNotAllPathsReturnValue/@EntryIndexedValue" value="WARNING" type="string" />
<option name="/Default/CodeInspection/Highlighting/InspectionSeverities/=CppObjectMemberMightNotBeInitialized/@EntryIndexedValue" value="WARNING" type="string" />
<option name="/Default/CodeInspection/Highlighting/InspectionSeverities/=CppOutParameterMustBeWritten/@EntryIndexedValue" value="WARNING" type="string" />
<option name="/Default/CodeInspection/Highlighting/InspectionSeverities/=CppOverrideWithDifferentVisibility/@EntryIndexedValue" value="WARNING" type="string" />
<option name="/Default/CodeInspection/Highlighting/InspectionSeverities/=CppParameterMayBeConst/@EntryIndexedValue" value="HINT" type="string" />
<option name="/Default/CodeInspection/Highlighting/InspectionSeverities/=CppParameterMayBeConstPtrOrRef/@EntryIndexedValue" value="SUGGESTION" type="string" />
<option name="/Default/CodeInspection/Highlighting/InspectionSeverities/=CppParameterNamesMismatch/@EntryIndexedValue" value="HINT" type="string" />
<option name="/Default/CodeInspection/Highlighting/InspectionSeverities/=CppParameterNeverUsed/@EntryIndexedValue" value="HINT" type="string" />
<option name="/Default/CodeInspection/Highlighting/InspectionSeverities/=CppPassValueParameterByConstReference/@EntryIndexedValue" value="SUGGESTION" type="string" />
<option name="/Default/CodeInspection/Highlighting/InspectionSeverities/=CppPointerConversionDropsQualifiers/@EntryIndexedValue" value="WARNING" type="string" />
<option name="/Default/CodeInspection/Highlighting/InspectionSeverities/=CppPointerToIntegralConversion/@EntryIndexedValue" value="WARNING" type="string" />
<option name="/Default/CodeInspection/Highlighting/InspectionSeverities/=CppPolymorphicClassWithNonVirtualPublicDestructor/@EntryIndexedValue" value="WARNING" type="string" />
<option name="/Default/CodeInspection/Highlighting/InspectionSeverities/=CppPossiblyErroneousEmptyStatements/@EntryIndexedValue" value="WARNING" type="string" />
<option name="/Default/CodeInspection/Highlighting/InspectionSeverities/=CppPossiblyUninitializedMember/@EntryIndexedValue" value="WARNING" type="string" />
<option name="/Default/CodeInspection/Highlighting/InspectionSeverities/=CppPossiblyUnintendedObjectSlicing/@EntryIndexedValue" value="WARNING" type="string" />
<option name="/Default/CodeInspection/Highlighting/InspectionSeverities/=CppPrecompiledHeaderIsNotIncluded/@EntryIndexedValue" value="ERROR" type="string" />
<option name="/Default/CodeInspection/Highlighting/InspectionSeverities/=CppPrecompiledHeaderNotFound/@EntryIndexedValue" value="ERROR" type="string" />
<option name="/Default/CodeInspection/Highlighting/InspectionSeverities/=CppPrintfBadFormat/@EntryIndexedValue" value="WARNING" type="string" />
<option name="/Default/CodeInspection/Highlighting/InspectionSeverities/=CppPrintfExtraArg/@EntryIndexedValue" value="WARNING" type="string" />
<option name="/Default/CodeInspection/Highlighting/InspectionSeverities/=CppPrintfMissedArg/@EntryIndexedValue" value="ERROR" type="string" />
<option name="/Default/CodeInspection/Highlighting/InspectionSeverities/=CppPrintfRiskyFormat/@EntryIndexedValue" value="WARNING" type="string" />
<option name="/Default/CodeInspection/Highlighting/InspectionSeverities/=CppPrivateSpecialMemberFunctionIsNotImplemented/@EntryIndexedValue" value="WARNING" type="string" />
<option name="/Default/CodeInspection/Highlighting/InspectionSeverities/=CppRangeBasedForIncompatibleReference/@EntryIndexedValue" value="WARNING" type="string" />
<option name="/Default/CodeInspection/Highlighting/InspectionSeverities/=CppRedefinitionOfDefaultArgumentInOverrideFunction/@EntryIndexedValue" value="WARNING" type="string" />
<option name="/Default/CodeInspection/Highlighting/InspectionSeverities/=CppRedundantAccessSpecifier/@EntryIndexedValue" value="HINT" type="string" />
<option name="/Default/CodeInspection/Highlighting/InspectionSeverities/=CppRedundantBaseClassAccessSpecifier/@EntryIndexedValue" value="HINT" type="string" />
<option name="/Default/CodeInspection/Highlighting/InspectionSeverities/=CppRedundantBaseClassInitializer/@EntryIndexedValue" value="SUGGESTION" type="string" />
<option name="/Default/CodeInspection/Highlighting/InspectionSeverities/=CppRedundantBooleanExpressionArgument/@EntryIndexedValue" value="WARNING" type="string" />
<option name="/Default/CodeInspection/Highlighting/InspectionSeverities/=CppRedundantCastExpression/@EntryIndexedValue" value="HINT" type="string" />
<option name="/Default/CodeInspection/Highlighting/InspectionSeverities/=CppRedundantComplexityInComparison/@EntryIndexedValue" value="SUGGESTION" type="string" />
<option name="/Default/CodeInspection/Highlighting/InspectionSeverities/=CppRedundantConditionalExpression/@EntryIndexedValue" value="SUGGESTION" type="string" />
<option name="/Default/CodeInspection/Highlighting/InspectionSeverities/=CppRedundantConstSpecifier/@EntryIndexedValue" value="HINT" type="string" />
<option name="/Default/CodeInspection/Highlighting/InspectionSeverities/=CppRedundantControlFlowJump/@EntryIndexedValue" value="HINT" type="string" />
<option name="/Default/CodeInspection/Highlighting/InspectionSeverities/=CppRedundantDereferencingAndTakingAddress/@EntryIndexedValue" value="SUGGESTION" type="string" />
<option name="/Default/CodeInspection/Highlighting/InspectionSeverities/=CppRedundantElaboratedTypeSpecifier/@EntryIndexedValue" value="HINT" type="string" />
<option name="/Default/CodeInspection/Highlighting/InspectionSeverities/=CppRedundantElseKeyword/@EntryIndexedValue" value="HINT" type="string" />
<option name="/Default/CodeInspection/Highlighting/InspectionSeverities/=CppRedundantElseKeywordInsideCompoundStatement/@EntryIndexedValue" value="HINT" type="string" />
<option name="/Default/CodeInspection/Highlighting/InspectionSeverities/=CppRedundantEmptyDeclaration/@EntryIndexedValue" value="HINT" type="string" />
<option name="/Default/CodeInspection/Highlighting/InspectionSeverities/=CppRedundantEmptyStatement/@EntryIndexedValue" value="HINT" type="string" />
<option name="/Default/CodeInspection/Highlighting/InspectionSeverities/=CppRedundantExportKeyword/@EntryIndexedValue" value="WARNING" type="string" />
<option name="/Default/CodeInspection/Highlighting/InspectionSeverities/=CppRedundantFwdClassOrEnumSpecifier/@EntryIndexedValue" value="SUGGESTION" type="string" />
<option name="/Default/CodeInspection/Highlighting/InspectionSeverities/=CppRedundantInlineSpecifier/@EntryIndexedValue" value="HINT" type="string" />
<option name="/Default/CodeInspection/Highlighting/InspectionSeverities/=CppRedundantLambdaParameterList/@EntryIndexedValue" value="HINT" type="string" />
<option name="/Default/CodeInspection/Highlighting/InspectionSeverities/=CppRedundantMemberInitializer/@EntryIndexedValue" value="SUGGESTION" type="string" />
<option name="/Default/CodeInspection/Highlighting/InspectionSeverities/=CppRedundantNamespaceDefinition/@EntryIndexedValue" value="SUGGESTION" type="string" />
<option name="/Default/CodeInspection/Highlighting/InspectionSeverities/=CppRedundantParentheses/@EntryIndexedValue" value="HINT" type="string" />
<option name="/Default/CodeInspection/Highlighting/InspectionSeverities/=CppRedundantQualifier/@EntryIndexedValue" value="HINT" type="string" />
<option name="/Default/CodeInspection/Highlighting/InspectionSeverities/=CppRedundantQualifierADL/@EntryIndexedValue" value="DO_NOT_SHOW" type="string" />
<option name="/Default/CodeInspection/Highlighting/InspectionSeverities/=CppRedundantStaticSpecifierOnMemberAllocationFunction/@EntryIndexedValue" value="HINT" type="string" />
<option name="/Default/CodeInspection/Highlighting/InspectionSeverities/=CppRedundantStaticSpecifierOnThreadLocalLocalVariable/@EntryIndexedValue" value="HINT" type="string" />
<option name="/Default/CodeInspection/Highlighting/InspectionSeverities/=CppRedundantTemplateArguments/@EntryIndexedValue" value="HINT" type="string" />
<option name="/Default/CodeInspection/Highlighting/InspectionSeverities/=CppRedundantTemplateKeyword/@EntryIndexedValue" value="WARNING" type="string" />
<option name="/Default/CodeInspection/Highlighting/InspectionSeverities/=CppRedundantTypenameKeyword/@EntryIndexedValue" value="WARNING" type="string" />
<option name="/Default/CodeInspection/Highlighting/InspectionSeverities/=CppRedundantVoidArgumentList/@EntryIndexedValue" value="SUGGESTION" type="string" />
<option name="/Default/CodeInspection/Highlighting/InspectionSeverities/=CppRedundantZeroInitializerInAggregateInitialization/@EntryIndexedValue" value="SUGGESTION" type="string" />
<option name="/Default/CodeInspection/Highlighting/InspectionSeverities/=CppReinterpretCastFromVoidPtr/@EntryIndexedValue" value="SUGGESTION" type="string" />
<option name="/Default/CodeInspection/Highlighting/InspectionSeverities/=CppRemoveRedundantBraces/@EntryIndexedValue" value="DO_NOT_SHOW" type="string" />
<option name="/Default/CodeInspection/Highlighting/InspectionSeverities/=CppReplaceMemsetWithZeroInitialization/@EntryIndexedValue" value="SUGGESTION" type="string" />
<option name="/Default/CodeInspection/Highlighting/InspectionSeverities/=CppReplaceTieWithStructuredBinding/@EntryIndexedValue" value="SUGGESTION" type="string" />
<option name="/Default/CodeInspection/Highlighting/InspectionSeverities/=CppReturnNoValueInNonVoidFunction/@EntryIndexedValue" value="WARNING" type="string" />
<option name="/Default/CodeInspection/Highlighting/InspectionSeverities/=CppSmartPointerVsMakeFunction/@EntryIndexedValue" value="SUGGESTION" type="string" />
<option name="/Default/CodeInspection/Highlighting/InspectionSeverities/=CppSomeObjectMembersMightNotBeInitialized/@EntryIndexedValue" value="WARNING" type="string" />
<option name="/Default/CodeInspection/Highlighting/InspectionSeverities/=CppSpecialFunctionWithoutNoexceptSpecification/@EntryIndexedValue" value="WARNING" type="string" />
<option name="/Default/CodeInspection/Highlighting/InspectionSeverities/=CppStaticAssertFailure/@EntryIndexedValue" value="ERROR" type="string" />
<option name="/Default/CodeInspection/Highlighting/InspectionSeverities/=CppStaticDataMemberInUnnamedStruct/@EntryIndexedValue" value="WARNING" type="string" />
<option name="/Default/CodeInspection/Highlighting/InspectionSeverities/=CppStaticSpecifierOnAnonymousNamespaceMember/@EntryIndexedValue" value="SUGGESTION" type="string" />
<option name="/Default/CodeInspection/Highlighting/InspectionSeverities/=CppStringLiteralToCharPointerConversion/@EntryIndexedValue" value="WARNING" type="string" />
<option name="/Default/CodeInspection/Highlighting/InspectionSeverities/=CppTabsAreDisallowed/@EntryIndexedValue" value="DO_NOT_SHOW" type="string" />
<option name="/Default/CodeInspection/Highlighting/InspectionSeverities/=CppTemplateArgumentsCanBeDeduced/@EntryIndexedValue" value="HINT" type="string" />
<option name="/Default/CodeInspection/Highlighting/InspectionSeverities/=CppTemplateParameterNeverUsed/@EntryIndexedValue" value="HINT" type="string" />
<option name="/Default/CodeInspection/Highlighting/InspectionSeverities/=CppTemplateParameterShadowing/@EntryIndexedValue" value="WARNING" type="string" />
<option name="/Default/CodeInspection/Highlighting/InspectionSeverities/=CppThrowExpressionCanBeReplacedWithRethrow/@EntryIndexedValue" value="WARNING" type="string" />
<option name="/Default/CodeInspection/Highlighting/InspectionSeverities/=CppTooWideScope/@EntryIndexedValue" value="SUGGESTION" type="string" />
<option name="/Default/CodeInspection/Highlighting/InspectionSeverities/=CppTooWideScopeInitStatement/@EntryIndexedValue" value="HINT" type="string" />
<option name="/Default/CodeInspection/Highlighting/InspectionSeverities/=CppTypeAliasNeverUsed/@EntryIndexedValue" value="WARNING" type="string" />
<option name="/Default/CodeInspection/Highlighting/InspectionSeverities/=CppUninitializedDependentBaseClass/@EntryIndexedValue" value="WARNING" type="string" />
<option name="/Default/CodeInspection/Highlighting/InspectionSeverities/=CppUninitializedNonStaticDataMember/@EntryIndexedValue" value="WARNING" type="string" />
<option name="/Default/CodeInspection/Highlighting/InspectionSeverities/=CppUnionMemberOfReferenceType/@EntryIndexedValue" value="WARNING" type="string" />
<option name="/Default/CodeInspection/Highlighting/InspectionSeverities/=CppUnmatchedPragmaEndRegionDirective/@EntryIndexedValue" value="WARNING" type="string" />
<option name="/Default/CodeInspection/Highlighting/InspectionSeverities/=CppUnmatchedPragmaRegionDirective/@EntryIndexedValue" value="WARNING" type="string" />
<option name="/Default/CodeInspection/Highlighting/InspectionSeverities/=CppUnnamedNamespaceInHeaderFile/@EntryIndexedValue" value="WARNING" type="string" />
<option name="/Default/CodeInspection/Highlighting/InspectionSeverities/=CppUnnecessaryWhitespace/@EntryIndexedValue" value="DO_NOT_SHOW" type="string" />
<option name="/Default/CodeInspection/Highlighting/InspectionSeverities/=CppUnsignedZeroComparison/@EntryIndexedValue" value="WARNING" type="string" />
<option name="/Default/CodeInspection/Highlighting/InspectionSeverities/=CppUnusedIncludeDirective/@EntryIndexedValue" value="WARNING" type="string" />
<option name="/Default/CodeInspection/Highlighting/InspectionSeverities/=CppUseAlgorithmWithCount/@EntryIndexedValue" value="SUGGESTION" type="string" />
<option name="/Default/CodeInspection/Highlighting/InspectionSeverities/=CppUseAssociativeContains/@EntryIndexedValue" value="SUGGESTION" type="string" />
<option name="/Default/CodeInspection/Highlighting/InspectionSeverities/=CppUseAuto/@EntryIndexedValue" value="HINT" type="string" />
<option name="/Default/CodeInspection/Highlighting/InspectionSeverities/=CppUseAutoForNumeric/@EntryIndexedValue" value="HINT" type="string" />
<option name="/Default/CodeInspection/Highlighting/InspectionSeverities/=CppUseElementsView/@EntryIndexedValue" value="SUGGESTION" type="string" />
<option name="/Default/CodeInspection/Highlighting/InspectionSeverities/=CppUseEraseAlgorithm/@EntryIndexedValue" value="SUGGESTION" type="string" />
<option name="/Default/CodeInspection/Highlighting/InspectionSeverities/=CppUseFamiliarTemplateSyntaxForGenericLambdas/@EntryIndexedValue" value="SUGGESTION" type="string" />
<option name="/Default/CodeInspection/Highlighting/InspectionSeverities/=CppUseRangeAlgorithm/@EntryIndexedValue" value="SUGGESTION" type="string" />
<option name="/Default/CodeInspection/Highlighting/InspectionSeverities/=CppUseStdSize/@EntryIndexedValue" value="SUGGESTION" type="string" />
<option name="/Default/CodeInspection/Highlighting/InspectionSeverities/=CppUseStructuredBinding/@EntryIndexedValue" value="HINT" type="string" />
<option name="/Default/CodeInspection/Highlighting/InspectionSeverities/=CppUseTypeTraitAlias/@EntryIndexedValue" value="SUGGESTION" type="string" />
<option name="/Default/CodeInspection/Highlighting/InspectionSeverities/=CppUserDefinedLiteralSuffixDoesNotStartWithUnderscore/@EntryIndexedValue" value="WARNING" type="string" />
<option name="/Default/CodeInspection/Highlighting/InspectionSeverities/=CppUsingResultOfAssignmentAsCondition/@EntryIndexedValue" value="WARNING" type="string" />
<option name="/Default/CodeInspection/Highlighting/InspectionSeverities/=CppVariableCanBeMadeConstexpr/@EntryIndexedValue" value="SUGGESTION" type="string" />
<option name="/Default/CodeInspection/Highlighting/InspectionSeverities/=CppVirtualFunctionCallInsideCtor/@EntryIndexedValue" value="WARNING" type="string" />
<option name="/Default/CodeInspection/Highlighting/InspectionSeverities/=CppVirtualFunctionInFinalClass/@EntryIndexedValue" value="WARNING" type="string" />
<option name="/Default/CodeInspection/Highlighting/InspectionSeverities/=CppVolatileParameterInDeclaration/@EntryIndexedValue" value="SUGGESTION" type="string" />
<option name="/Default/CodeInspection/Highlighting/InspectionSeverities/=CppWarningDirective/@EntryIndexedValue" value="WARNING" type="string" />
<option name="/Default/CodeInspection/Highlighting/InspectionSeverities/=CppWrongIncludesOrder/@EntryIndexedValue" value="HINT" type="string" />
<option name="/Default/CodeInspection/Highlighting/InspectionSeverities/=CppWrongSlashesInIncludeDirective/@EntryIndexedValue" value="HINT" type="string" />
<option name="/Default/CodeInspection/Highlighting/InspectionSeverities/=CppZeroConstantCanBeReplacedWithNullptr/@EntryIndexedValue" value="SUGGESTION" type="string" />
<option name="/Default/CodeInspection/Highlighting/InspectionSeverities/=CppZeroValuedExpressionUsedAsNullPointer/@EntryIndexedValue" value="WARNING" type="string" />
<option name="/Default/CodeInspection/Highlighting/InspectionSeverities/=IdentifierTypo/@EntryIndexedValue" value="DO_NOT_SHOW" type="string" />
<option name="/Default/CodeInspection/Highlighting/InspectionSeverities/=IfStdIsConstantEvaluatedCanBeReplaced/@EntryIndexedValue" value="SUGGESTION" type="string" />
<option name="/Default/CodeInspection/Highlighting/InspectionSeverities/=StdIsConstantEvaluatedWillAlwaysEvaluateToConstant/@EntryIndexedValue" value="WARNING" type="string" />
<option name="/Default/CodeInspection/Highlighting/InspectionSeverities/=StringLiteralTypo/@EntryIndexedValue" value="DO_NOT_SHOW" type="string" />
<option name="/Default/CodeStyle/CodeFormatting/CppClangFormat/EnableClangFormatSupport/@EntryValue" value="false" type="bool" />
<option name="/Default/CodeStyle/CodeFormatting/CppCodeStyle/BracesInForStatement/@EntryValue" value="Required" type="string" />
<option name="/Default/CodeStyle/CodeFormatting/CppCodeStyle/BracesInIfStatement/@EntryValue" value="Required" type="string" />
<option name="/Default/CodeStyle/CodeFormatting/CppCodeStyle/BracesInWhileStatement/@EntryValue" value="Required" type="string" />
<option name="/Default/CodeStyle/CodeFormatting/CppCodeStyle/UseAutoCommonCase/@EntryValue" value="Never" type="string" />
<option name="/Default/CodeStyle/CodeFormatting/CppFormatting/ALIGN_MULTILINE_ARGUMENT/@EntryValue" value="true" type="bool" />
<option name="/Default/CodeStyle/CodeFormatting/CppFormatting/ALIGN_MULTILINE_BINARY_EXPRESSIONS_CHAIN/@EntryValue" value="true" type="bool" />
<option name="/Default/CodeStyle/CodeFormatting/CppFormatting/ALIGN_MULTILINE_EXPRESSION/@EntryValue" value="false" type="bool" />
<option name="/Default/CodeStyle/CodeFormatting/CppFormatting/ALIGN_MULTILINE_EXTENDS_LIST/@EntryValue" value="true" type="bool" />
<option name="/Default/CodeStyle/CodeFormatting/CppFormatting/ALIGN_MULTILINE_FOR_STMT/@EntryValue" value="true" type="bool" />
<option name="/Default/CodeStyle/CodeFormatting/CppFormatting/ALIGN_MULTILINE_PARAMETER/@EntryValue" value="true" type="bool" />
<option name="/Default/CodeStyle/CodeFormatting/CppFormatting/ALIGN_MULTILINE_TYPE_ARGUMENT/@EntryValue" value="false" type="bool" />
<option name="/Default/CodeStyle/CodeFormatting/CppFormatting/ALIGN_MULTILINE_TYPE_PARAMETER/@EntryValue" value="false" type="bool" />
<option name="/Default/CodeStyle/CodeFormatting/CppFormatting/ALIGN_TERNARY/@EntryValue" value="ALIGN_ALL" type="string" />
<option name="/Default/CodeStyle/CodeFormatting/CppFormatting/ALLOW_COMMENT_AFTER_LBRACE/@EntryValue" value="true" type="bool" />
<option name="/Default/CodeStyle/CodeFormatting/CppFormatting/BLANK_LINES_AROUND_CLASS_DEFINITION/@EntryValue" value="1" type="int" />
<option name="/Default/CodeStyle/CodeFormatting/CppFormatting/BLANK_LINES_AROUND_DECLARATIONS/@EntryValue" value="0" type="int" />
<option name="/Default/CodeStyle/CodeFormatting/CppFormatting/BLANK_LINES_AROUND_FUNCTION_DECLARATION/@EntryValue" value="1" type="int" />
<option name="/Default/CodeStyle/CodeFormatting/CppFormatting/BLANK_LINES_AROUND_FUNCTION_DEFINITION/@EntryValue" value="1" type="int" />
<option name="/Default/CodeStyle/CodeFormatting/CppFormatting/CASE_BLOCK_BRACES/@EntryValue" value="NEXT_LINE" type="string" />
<option name="/Default/CodeStyle/CodeFormatting/CppFormatting/CONTINUOUS_LINE_INDENT/@EntryValue" value="Double" type="string" />
<option name="/Default/CodeStyle/CodeFormatting/CppFormatting/FUNCTION_DECLARATION_RETURN_TYPE_STYLE/@EntryValue" value="ON_SINGLE_LINE" type="string" />
<option name="/Default/CodeStyle/CodeFormatting/CppFormatting/FUNCTION_DEFINITION_RETURN_TYPE_STYLE/@EntryValue" value="ON_SINGLE_LINE" type="string" />
<option name="/Default/CodeStyle/CodeFormatting/CppFormatting/INDENT_ACCESS_SPECIFIERS_FROM_CLASS/@EntryValue" value="true" type="bool" />
<option name="/Default/CodeStyle/CodeFormatting/CppFormatting/INDENT_CASE_FROM_SWITCH/@EntryValue" value="true" type="bool" />
<option name="/Default/CodeStyle/CodeFormatting/CppFormatting/INDENT_CLASS_MEMBERS_FROM_ACCESS_SPECIFIERS/@EntryValue" value="true" type="bool" />
<option name="/Default/CodeStyle/CodeFormatting/CppFormatting/INDENT_COMMENT/@EntryValue" value="true" type="bool" />
<option name="/Default/CodeStyle/CodeFormatting/CppFormatting/INDENT_PREPROCESSOR_DIRECTIVES/@EntryValue" value="Normal" type="string" />
<option name="/Default/CodeStyle/CodeFormatting/CppFormatting/INDENT_SIZE/@EntryValue" value="4" type="int" />
<option name="/Default/CodeStyle/CodeFormatting/CppFormatting/INDENT_STYLE/@EntryValue" value="Space" type="string" />
<option name="/Default/CodeStyle/CodeFormatting/CppFormatting/INITIALIZER_BRACES/@EntryValue" value="END_OF_LINE_NO_SPACE" type="string" />
<option name="/Default/CodeStyle/CodeFormatting/CppFormatting/INT_ALIGN_EQ/@EntryValue" value="false" type="bool" />
<option name="/Default/CodeStyle/CodeFormatting/CppFormatting/KEEP_EXISTING_ENUM_ARRANGEMENT/@EntryValue" value="false" type="bool" />
<option name="/Default/CodeStyle/CodeFormatting/CppFormatting/KEEP_USER_LINEBREAKS/@EntryValue" value="false" type="bool" />
<option name="/Default/CodeStyle/CodeFormatting/CppFormatting/LABELED_STATEMENT_STYLE/@EntryValue" value="ON_SINGLE_LINE" type="string" />
<option name="/Default/CodeStyle/CodeFormatting/CppFormatting/LINE_BREAK_AFTER_COLON_IN_MEMBER_INITIALIZER_LISTS/@EntryValue" value="ON_SINGLE_LINE" type="string" />
<option name="/Default/CodeStyle/CodeFormatting/CppFormatting/LINE_BREAK_AFTER_DEREF_IN_TRAILING_RETURN_TYPES/@EntryValue" value="ON_SINGLE_LINE" type="string" />
<option name="/Default/CodeStyle/CodeFormatting/CppFormatting/LINE_BREAK_AFTER_INIT_STATEMENT/@EntryValue" value="ON_SINGLE_LINE" type="string" />
<option name="/Default/CodeStyle/CodeFormatting/CppFormatting/LINE_BREAK_BEFORE_DEREF_IN_TRAILING_RETURN_TYPES/@EntryValue" value="ON_SINGLE_LINE" type="string" />
<option name="/Default/CodeStyle/CodeFormatting/CppFormatting/LINE_BREAK_BEFORE_FUNCTION_TRY_BLOCK/@EntryValue" value="LINE_BREAK" type="string" />
<option name="/Default/CodeStyle/CodeFormatting/CppFormatting/LINE_BREAK_BEFORE_REQUIRES_CLAUSE/@EntryValue" value="LINE_BREAK" type="string" />
<option name="/Default/CodeStyle/CodeFormatting/CppFormatting/LINKAGE_SPECIFICATION_BRACES/@EntryValue" value="NEXT_LINE" type="string" />
<option name="/Default/CodeStyle/CodeFormatting/CppFormatting/LINKAGE_SPECIFICATION_INDENTATION/@EntryValue" value="All" type="string" />
<option name="/Default/CodeStyle/CodeFormatting/CppFormatting/MEMBER_INITIALIZER_LIST_STYLE/@EntryValue" value="ON_SINGLE_LINE" type="string" />
<option name="/Default/CodeStyle/CodeFormatting/CppFormatting/NAMESPACE_INDENTATION/@EntryValue" value="All" type="string" />
<option name="/Default/CodeStyle/CodeFormatting/CppFormatting/SIMPLE_BLOCK_STYLE/@EntryValue" value="DO_NOT_CHANGE" type="string" />
<option name="/Default/CodeStyle/CodeFormatting/CppFormatting/SIMPLE_CASE_STATEMENT_STYLE/@EntryValue" value="LINE_BREAK" type="string" />
<option name="/Default/CodeStyle/CodeFormatting/CppFormatting/SPACE_AFTER_COLON_IN_BITFIELD_DECLARATOR/@EntryValue" value="true" type="bool" />
<option name="/Default/CodeStyle/CodeFormatting/CppFormatting/SPACE_AFTER_FOR_COLON/@EntryValue" value="true" type="bool" />
<option name="/Default/CodeStyle/CodeFormatting/CppFormatting/SPACE_AFTER_FOR_SEMICOLON/@EntryValue" value="true" type="bool" />
<option name="/Default/CodeStyle/CodeFormatting/CppFormatting/SPACE_AFTER_PTR_IN_DATA_MEMBER/@EntryValue" value="false" type="bool" />
<option name="/Default/CodeStyle/CodeFormatting/CppFormatting/SPACE_AFTER_PTR_IN_METHOD/@EntryValue" value="false" type="bool" />
<option name="/Default/CodeStyle/CodeFormatting/CppFormatting/SPACE_AFTER_PTR_IN_NESTED_DECLARATOR/@EntryValue" value="false" type="bool" />
<option name="/Default/CodeStyle/CodeFormatting/CppFormatting/SPACE_AFTER_REF_IN_DATA_MEMBER/@EntryValue" value="false" type="bool" />
<option name="/Default/CodeStyle/CodeFormatting/CppFormatting/SPACE_AFTER_REF_IN_DATA_MEMBERS/@EntryValue" value="false" type="bool" />
<option name="/Default/CodeStyle/CodeFormatting/CppFormatting/SPACE_AFTER_REF_IN_METHOD/@EntryValue" value="false" type="bool" />
<option name="/Default/CodeStyle/CodeFormatting/CppFormatting/SPACE_AFTER_UNARY_OPERATOR/@EntryValue" value="false" type="bool" />
<option name="/Default/CodeStyle/CodeFormatting/CppFormatting/SPACE_BEFORE_COLON_IN_BITFIELD_DECLARATOR/@EntryValue" value="false" type="bool" />
<option name="/Default/CodeStyle/CodeFormatting/CppFormatting/SPACE_BEFORE_FOR_COLON/@EntryValue" value="false" type="bool" />
<option name="/Default/CodeStyle/CodeFormatting/CppFormatting/SPACE_BEFORE_FOR_SEMICOLON/@EntryValue" value="false" type="bool" />
<option name="/Default/CodeStyle/CodeFormatting/CppFormatting/SPACE_BEFORE_PTR_IN_ABSTRACT_DECL/@EntryValue" value="true" type="bool" />
<option name="/Default/CodeStyle/CodeFormatting/CppFormatting/SPACE_BEFORE_PTR_IN_DATA_MEMBER/@EntryValue" value="true" type="bool" />
<option name="/Default/CodeStyle/CodeFormatting/CppFormatting/SPACE_BEFORE_PTR_IN_METHOD/@EntryValue" value="true" type="bool" />
<option name="/Default/CodeStyle/CodeFormatting/CppFormatting/SPACE_BEFORE_REF_IN_ABSTRACT_DECL/@EntryValue" value="true" type="bool" />
<option name="/Default/CodeStyle/CodeFormatting/CppFormatting/SPACE_BEFORE_REF_IN_DATA_MEMBER/@EntryValue" value="true" type="bool" />
<option name="/Default/CodeStyle/CodeFormatting/CppFormatting/SPACE_BEFORE_REF_IN_DATA_MEMBERS/@EntryValue" value="true" type="bool" />
<option name="/Default/CodeStyle/CodeFormatting/CppFormatting/SPACE_BEFORE_REF_IN_METHOD/@EntryValue" value="true" type="bool" />
<option name="/Default/CodeStyle/CodeFormatting/CppFormatting/SPACE_BEFORE_TEMPLATE_PARAMS/@EntryValue" value="false" type="bool" />
<option name="/Default/CodeStyle/CodeFormatting/CppFormatting/SPACE_WITHIN_ARRAY_ACCESS_BRACKETS/@EntryValue" value="false" type="bool" />
<option name="/Default/CodeStyle/CodeFormatting/CppFormatting/SPACE_WITHIN_EMPTY_BLOCKS/@EntryValue" value="false" type="bool" />
<option name="/Default/CodeStyle/CodeFormatting/CppFormatting/SPACE_WITHIN_EMPTY_INITIALIZER_BRACES/@EntryValue" value="false" type="bool" />
<option name="/Default/CodeStyle/CodeFormatting/CppFormatting/SPACE_WITHIN_EMPTY_METHOD_PARENTHESES/@EntryValue" value="false" type="bool" />
<option name="/Default/CodeStyle/CodeFormatting/CppFormatting/SPACE_WITHIN_EMPTY_TEMPLATE_PARAMS/@EntryValue" value="false" type="bool" />
<option name="/Default/CodeStyle/CodeFormatting/CppFormatting/SPACE_WITHIN_INITIALIZER_BRACES/@EntryValue" value="false" type="bool" />
<option name="/Default/CodeStyle/CodeFormatting/CppFormatting/SPACE_WITHIN_TEMPLATE_PARAMS/@EntryValue" value="false" type="bool" />
<option name="/Default/CodeStyle/CodeFormatting/CppFormatting/SPECIAL_ELSE_IF_TREATMENT/@EntryValue" value="true" type="bool" />
<option name="/Default/CodeStyle/CodeFormatting/CppFormatting/TAB_WIDTH/@EntryValue" value="4" type="int" />
<option name="/Default/CodeStyle/CodeFormatting/CppFormatting/TOPLEVEL_FUNCTION_DECLARATION_RETURN_TYPE_STYLE/@EntryValue" value="ON_SINGLE_LINE" type="string" />
<option name="/Default/CodeStyle/CodeFormatting/CppFormatting/TOPLEVEL_FUNCTION_DEFINITION_RETURN_TYPE_STYLE/@EntryValue" value="ON_SINGLE_LINE" type="string" />
<option name="/Default/CodeStyle/CodeFormatting/CppFormatting/WRAP_AFTER_BINARY_OPSIGN/@EntryValue" value="true" type="bool" />
<option name="/Default/CodeStyle/CodeFormatting/CppFormatting/WRAP_AFTER_DECLARATION_LPAR/@EntryValue" value="true" type="bool" />
<option name="/Default/CodeStyle/CodeFormatting/CppFormatting/WRAP_ARGUMENTS_STYLE/@EntryValue" value="WRAP_IF_LONG" type="string" />
<option name="/Default/CodeStyle/CodeFormatting/CppFormatting/WRAP_BEFORE_TERNARY_OPSIGNS/@EntryValue" value="true" type="bool" />
<option name="/Default/CodeStyle/CodeFormatting/CppFormatting/WRAP_ENUMERATION_STYLE/@EntryValue" value="CHOP_ALWAYS" type="string" />
<option name="/Default/CodeStyle/CodeFormatting/CppFormatting/WRAP_LINES/@EntryValue" value="false" type="bool" />
<option name="/Default/CodeStyle/EditorConfig/EnableClangFormatSupport/@EntryValue" value="false" type="bool" />
<option name="/Default/CodeStyle/Naming/CppNamingOptions/Rules/=05D45346A5B5B54F93A9F94C46B14079/@EntryIndexRemoved" value="true" type="bool" />
<option name="/Default/CodeStyle/Naming/CppNamingOptions/Rules/=05D45346A5B5B54F93A9F94C46B14079/@EntryIndexedValue" value="" type="string" />
<option name="/Default/CodeStyle/Naming/CppNamingOptions/Rules/=0AFB7787612DF743B09AD9412E48D4CC/@EntryIndexRemoved" value="true" type="bool" />
<option name="/Default/CodeStyle/Naming/CppNamingOptions/Rules/=0AFB7787612DF743B09AD9412E48D4CC/@EntryIndexedValue" value="" type="string" />
<option name="/Default/CodeStyle/Naming/CppNamingOptions/Rules/=0B82708A1BA7774EB13D27F245698A56/@EntryIndexRemoved" value="true" type="bool" />
<option name="/Default/CodeStyle/Naming/CppNamingOptions/Rules/=0B82708A1BA7774EB13D27F245698A56/@EntryIndexedValue" value="" type="string" />
<option name="/Default/CodeStyle/Naming/CppNamingOptions/Rules/=0CBD9263BD435842828596291C4FE4B4/@EntryIndexedValue" value="&lt;NamingElement Priority=&quot;2&quot; Title=&quot;Fields&quot;&gt;&lt;Descriptor Static=&quot;Indeterminate&quot; Constexpr=&quot;Indeterminate&quot; Const=&quot;Indeterminate&quot; Volatile=&quot;Indeterminate&quot; Accessibility=&quot;NOT_APPLICABLE&quot;&gt;&lt;type Name=&quot;class field&quot; /&gt;&lt;type Name=&quot;struct field&quot; /&gt;&lt;type Name=&quot;union member&quot; /&gt;&lt;/Descriptor&gt;&lt;Policy Inspect=&quot;True&quot; WarnAboutPrefixesAndSuffixes=&quot;False&quot; Prefix=&quot;&quot; Suffix=&quot;&quot; Style=&quot;aaBb&quot; /&gt;&lt;/NamingElement&gt;" type="string" />
<option name="/Default/CodeStyle/Naming/CppNamingOptions/Rules/=1350D079A82E0740947E85445B5AF47C/@EntryIndexRemoved" value="true" type="bool" />
<option name="/Default/CodeStyle/Naming/CppNamingOptions/Rules/=1350D079A82E0740947E85445B5AF47C/@EntryIndexedValue" value="" type="string" />
<option name="/Default/CodeStyle/Naming/CppNamingOptions/Rules/=18392FF80FA40749AA8CC53981A32AE0/@EntryIndexRemoved" value="true" type="bool" />
<option name="/Default/CodeStyle/Naming/CppNamingOptions/Rules/=18392FF80FA40749AA8CC53981A32AE0/@EntryIndexedValue" value="" type="string" />
<option name="/Default/CodeStyle/Naming/CppNamingOptions/Rules/=1CBDD658AEE8EA4382EE1F914B5B3314/@EntryIndexRemoved" value="true" type="bool" />
<option name="/Default/CodeStyle/Naming/CppNamingOptions/Rules/=1CBDD658AEE8EA4382EE1F914B5B3314/@EntryIndexedValue" value="" type="string" />
<option name="/Default/CodeStyle/Naming/CppNamingOptions/Rules/=2229A2BE1AA9214483A51F028530E042/@EntryIndexRemoved" value="true" type="bool" />
<option name="/Default/CodeStyle/Naming/CppNamingOptions/Rules/=2229A2BE1AA9214483A51F028530E042/@EntryIndexedValue" value="" type="string" />
<option name="/Default/CodeStyle/Naming/CppNamingOptions/Rules/=2AD8EC23F81C6F4AB06852FBF796A3D1/@EntryIndexRemoved" value="true" type="bool" />
<option name="/Default/CodeStyle/Naming/CppNamingOptions/Rules/=2AD8EC23F81C6F4AB06852FBF796A3D1/@EntryIndexedValue" value="" type="string" />
<option name="/Default/CodeStyle/Naming/CppNamingOptions/Rules/=2B232F1067F0324F8FF4B9D63ACECDB2/@EntryIndexRemoved" value="true" type="bool" />
<option name="/Default/CodeStyle/Naming/CppNamingOptions/Rules/=2B232F1067F0324F8FF4B9D63ACECDB2/@EntryIndexedValue" value="" type="string" />
<option name="/Default/CodeStyle/Naming/CppNamingOptions/Rules/=4203BE6F332C5149B409B4D5F7197E54/@EntryIndexRemoved" value="true" type="bool" />
<option name="/Default/CodeStyle/Naming/CppNamingOptions/Rules/=4203BE6F332C5149B409B4D5F7197E54/@EntryIndexedValue" value="" type="string" />
<option name="/Default/CodeStyle/Naming/CppNamingOptions/Rules/=4F91A7364D7B63479FCEA1D063EAEA19/@EntryIndexedValue" value="&lt;NamingElement Priority=&quot;13&quot; Title=&quot;Non-Type Template Parameters&quot;&gt;&lt;Descriptor Static=&quot;Indeterminate&quot; Constexpr=&quot;Indeterminate&quot; Const=&quot;Indeterminate&quot; Volatile=&quot;Indeterminate&quot; Accessibility=&quot;NOT_APPLICABLE&quot;&gt;&lt;type Name=&quot;non-type template parameter&quot; /&gt;&lt;/Descriptor&gt;&lt;Policy Inspect=&quot;True&quot; WarnAboutPrefixesAndSuffixes=&quot;False&quot; Prefix=&quot;&quot; Suffix=&quot;&quot; Style=&quot;AaBb&quot; /&gt;&lt;/NamingElement&gt;" type="string" />
<option name="/Default/CodeStyle/Naming/CppNamingOptions/Rules/=5653BA7B6222F349B94149A2A53C35B8/@EntryIndexRemoved" value="true" type="bool" />
<option name="/Default/CodeStyle/Naming/CppNamingOptions/Rules/=5653BA7B6222F349B94149A2A53C35B8/@EntryIndexedValue" value="" type="string" />
<option name="/Default/CodeStyle/Naming/CppNamingOptions/Rules/=6513EEED32DF014BB4F3706393117465/@EntryIndexedValue" value="&lt;NamingElement Priority=&quot;8&quot; Title=&quot;Enumerators&quot;&gt;&lt;Descriptor Static=&quot;Indeterminate&quot; Constexpr=&quot;Indeterminate&quot; Const=&quot;Indeterminate&quot; Volatile=&quot;Indeterminate&quot; Accessibility=&quot;NOT_APPLICABLE&quot;&gt;&lt;type Name=&quot;scoped enumerator&quot; /&gt;&lt;type Name=&quot;unscoped enumerator&quot; /&gt;&lt;/Descriptor&gt;&lt;Policy Inspect=&quot;True&quot; WarnAboutPrefixesAndSuffixes=&quot;False&quot; Prefix=&quot;&quot; Suffix=&quot;&quot; Style=&quot;AaBb&quot; /&gt;&lt;/NamingElement&gt;" type="string" />
<option name="/Default/CodeStyle/Naming/CppNamingOptions/Rules/=72514D5DF422D442B71A277F97B72887/@EntryIndexRemoved" value="true" type="bool" />
<option name="/Default/CodeStyle/Naming/CppNamingOptions/Rules/=72514D5DF422D442B71A277F97B72887/@EntryIndexedValue" value="" type="string" />
<option name="/Default/CodeStyle/Naming/CppNamingOptions/Rules/=821F3C5CF47D5640AD3511BCBADE17C4/@EntryIndexRemoved" value="true" type="bool" />
<option name="/Default/CodeStyle/Naming/CppNamingOptions/Rules/=821F3C5CF47D5640AD3511BCBADE17C4/@EntryIndexedValue" value="" type="string" />
<option name="/Default/CodeStyle/Naming/CppNamingOptions/Rules/=8B1F7EC98488B349961668DA5758DC54/@EntryIndexedValue" value="&lt;NamingElement Priority=&quot;5&quot; Title=&quot;Functions&quot;&gt;&lt;Descriptor Static=&quot;Indeterminate&quot; Constexpr=&quot;Indeterminate&quot; Const=&quot;Indeterminate&quot; Volatile=&quot;Indeterminate&quot; Accessibility=&quot;NOT_APPLICABLE&quot;&gt;&lt;type Name=&quot;global function&quot; /&gt;&lt;type Name=&quot;member function&quot; /&gt;&lt;/Descriptor&gt;&lt;Policy Inspect=&quot;True&quot; WarnAboutPrefixesAndSuffixes=&quot;False&quot; Prefix=&quot;&quot; Suffix=&quot;&quot; Style=&quot;aaBb&quot; /&gt;&lt;/NamingElement&gt;" type="string" />
<option name="/Default/CodeStyle/Naming/CppNamingOptions/Rules/=8F69F48E2532F54CBAA0039D4557825E/@EntryIndexRemoved" value="true" type="bool" />
<option name="/Default/CodeStyle/Naming/CppNamingOptions/Rules/=8F69F48E2532F54CBAA0039D4557825E/@EntryIndexedValue" value="" type="string" />
<option name="/Default/CodeStyle/Naming/CppNamingOptions/Rules/=97F66D4C2F93FF418F4AE9D29638A2F8/@EntryIndexedValue" value="&lt;NamingElement Priority=&quot;9&quot; Title=&quot;Namespaces&quot;&gt;&lt;Descriptor Static=&quot;Indeterminate&quot; Constexpr=&quot;Indeterminate&quot; Const=&quot;Indeterminate&quot; Volatile=&quot;Indeterminate&quot; Accessibility=&quot;NOT_APPLICABLE&quot;&gt;&lt;type Name=&quot;namespace&quot; /&gt;&lt;type Name=&quot;namespace alias&quot; /&gt;&lt;/Descriptor&gt;&lt;Policy Inspect=&quot;True&quot; WarnAboutPrefixesAndSuffixes=&quot;False&quot; Prefix=&quot;&quot; Suffix=&quot;&quot; Style=&quot;AaBb&quot; /&gt;&lt;/NamingElement&gt;" type="string" />
<option name="/Default/CodeStyle/Naming/CppNamingOptions/Rules/=9E4D28CA929F6B4AB5F6F3FEB9E69A47/@EntryIndexRemoved" value="true" type="bool" />
<option name="/Default/CodeStyle/Naming/CppNamingOptions/Rules/=9E4D28CA929F6B4AB5F6F3FEB9E69A47/@EntryIndexedValue" value="" type="string" />
<option name="/Default/CodeStyle/Naming/CppNamingOptions/Rules/=A229B5AAD2B3D44A9E9AFBB9F61DEEB3/@EntryIndexedValue" value="&lt;NamingElement Priority=&quot;11&quot; Title=&quot;Properties&quot;&gt;&lt;Descriptor Static=&quot;Indeterminate&quot; Constexpr=&quot;Indeterminate&quot; Const=&quot;Indeterminate&quot; Volatile=&quot;Indeterminate&quot; Accessibility=&quot;NOT_APPLICABLE&quot;&gt;&lt;type Name=&quot;property&quot; /&gt;&lt;/Descriptor&gt;&lt;Policy Inspect=&quot;True&quot; WarnAboutPrefixesAndSuffixes=&quot;False&quot; Prefix=&quot;&quot; Suffix=&quot;&quot; Style=&quot;AaBb&quot; /&gt;&lt;/NamingElement&gt;" type="string" />
<option name="/Default/CodeStyle/Naming/CppNamingOptions/Rules/=A42D627FA43B054F91D1E1C4281D8896/@EntryIndexRemoved" value="true" type="bool" />
<option name="/Default/CodeStyle/Naming/CppNamingOptions/Rules/=A42D627FA43B054F91D1E1C4281D8896/@EntryIndexedValue" value="" type="string" />
<option name="/Default/CodeStyle/Naming/CppNamingOptions/Rules/=A4FAA2257682A94F8C2C93E123FAFC7A/@EntryIndexRemoved" value="true" type="bool" />
<option name="/Default/CodeStyle/Naming/CppNamingOptions/Rules/=A4FAA2257682A94F8C2C93E123FAFC7A/@EntryIndexedValue" value="" type="string" />
<option name="/Default/CodeStyle/Naming/CppNamingOptions/Rules/=A7EBF16DA3BDCB42A0B710704BC8A053/@EntryIndexRemoved" value="true" type="bool" />
<option name="/Default/CodeStyle/Naming/CppNamingOptions/Rules/=A7EBF16DA3BDCB42A0B710704BC8A053/@EntryIndexedValue" value="" type="string" />
<option name="/Default/CodeStyle/Naming/CppNamingOptions/Rules/=A87CB78D825AFA439AD708500DC7732B/@EntryIndexedValue" value="&lt;NamingElement Priority=&quot;4&quot; Title=&quot;Parameters&quot;&gt;&lt;Descriptor Static=&quot;Indeterminate&quot; Constexpr=&quot;Indeterminate&quot; Const=&quot;Indeterminate&quot; Volatile=&quot;Indeterminate&quot; Accessibility=&quot;NOT_APPLICABLE&quot;&gt;&lt;type Name=&quot;function parameter&quot; /&gt;&lt;type Name=&quot;lambda parameter&quot; /&gt;&lt;/Descriptor&gt;&lt;Policy Inspect=&quot;True&quot; WarnAboutPrefixesAndSuffixes=&quot;False&quot; Prefix=&quot;&quot; Suffix=&quot;&quot; Style=&quot;aaBb&quot; /&gt;&lt;/NamingElement&gt;" type="string" />
<option name="/Default/CodeStyle/Naming/CppNamingOptions/Rules/=B28E74445B5ADE46BB06B8B2E7AF0B10/@EntryIndexedValue" value="&lt;NamingElement Priority=&quot;3&quot; Title=&quot;Variables&quot;&gt;&lt;Descriptor Static=&quot;Indeterminate&quot; Constexpr=&quot;Indeterminate&quot; Const=&quot;Indeterminate&quot; Volatile=&quot;Indeterminate&quot; Accessibility=&quot;NOT_APPLICABLE&quot;&gt;&lt;type Name=&quot;global variable&quot; /&gt;&lt;type Name=&quot;lambda&quot; /&gt;&lt;type Name=&quot;local variable&quot; /&gt;&lt;/Descriptor&gt;&lt;Policy Inspect=&quot;True&quot; WarnAboutPrefixesAndSuffixes=&quot;False&quot; Prefix=&quot;&quot; Suffix=&quot;&quot; Style=&quot;aaBb&quot; /&gt;&lt;/NamingElement&gt;" type="string" />
<option name="/Default/CodeStyle/Naming/CppNamingOptions/Rules/=B6E900853D6D05429D8C57765B2E546A/@EntryIndexRemoved" value="true" type="bool" />
<option name="/Default/CodeStyle/Naming/CppNamingOptions/Rules/=B6E900853D6D05429D8C57765B2E546A/@EntryIndexedValue" value="" type="string" />
<option name="/Default/CodeStyle/Naming/CppNamingOptions/Rules/=B82A063F0DDD98498A70D8D7EBB97F8D/@EntryIndexRemoved" value="true" type="bool" />
<option name="/Default/CodeStyle/Naming/CppNamingOptions/Rules/=B82A063F0DDD98498A70D8D7EBB97F8D/@EntryIndexedValue" value="" type="string" />
<option name="/Default/CodeStyle/Naming/CppNamingOptions/Rules/=BBE8AA08E662BF409B2CB08EC597C493/@EntryIndexRemoved" value="true" type="bool" />
<option name="/Default/CodeStyle/Naming/CppNamingOptions/Rules/=BBE8AA08E662BF409B2CB08EC597C493/@EntryIndexedValue" value="" type="string" />
<option name="/Default/CodeStyle/Naming/CppNamingOptions/Rules/=BF0D1AE66D64FE4FAF613448A12051A0/@EntryIndexRemoved" value="true" type="bool" />
<option name="/Default/CodeStyle/Naming/CppNamingOptions/Rules/=BF0D1AE66D64FE4FAF613448A12051A0/@EntryIndexedValue" value="" type="string" />
<option name="/Default/CodeStyle/Naming/CppNamingOptions/Rules/=C0DE3DAEDDF0744889F41BE5BEA903AC/@EntryIndexedValue" value="&lt;NamingElement Priority=&quot;1&quot; Title=&quot;Types&quot;&gt;&lt;Descriptor Static=&quot;Indeterminate&quot; Constexpr=&quot;Indeterminate&quot; Const=&quot;Indeterminate&quot; Volatile=&quot;Indeterminate&quot; Accessibility=&quot;NOT_APPLICABLE&quot;&gt;&lt;type Name=&quot;__interface&quot; /&gt;&lt;type Name=&quot;class&quot; /&gt;&lt;type Name=&quot;concept&quot; /&gt;&lt;type Name=&quot;enum&quot; /&gt;&lt;type Name=&quot;struct&quot; /&gt;&lt;type Name=&quot;type alias&quot; /&gt;&lt;type Name=&quot;type template parameter&quot; /&gt;&lt;type Name=&quot;typedef&quot; /&gt;&lt;type Name=&quot;union&quot; /&gt;&lt;/Descriptor&gt;&lt;Policy Inspect=&quot;True&quot; WarnAboutPrefixesAndSuffixes=&quot;False&quot; Prefix=&quot;&quot; Suffix=&quot;&quot; Style=&quot;AaBb&quot; /&gt;&lt;/NamingElement&gt;" type="string" />
<option name="/Default/CodeStyle/Naming/CppNamingOptions/Rules/=C2FB8C7FF23D70478D17C7DAF4AC9E4D/@EntryIndexedValue" value="&lt;NamingElement Priority=&quot;12&quot; Title=&quot;Events&quot;&gt;&lt;Descriptor Static=&quot;Indeterminate&quot; Constexpr=&quot;Indeterminate&quot; Const=&quot;Indeterminate&quot; Volatile=&quot;Indeterminate&quot; Accessibility=&quot;NOT_APPLICABLE&quot;&gt;&lt;type Name=&quot;event&quot; /&gt;&lt;/Descriptor&gt;&lt;Policy Inspect=&quot;True&quot; WarnAboutPrefixesAndSuffixes=&quot;False&quot; Prefix=&quot;&quot; Suffix=&quot;&quot; Style=&quot;AaBb&quot; /&gt;&lt;/NamingElement&gt;" type="string" />
<option name="/Default/CodeStyle/Naming/CppNamingOptions/Rules/=DA7983C3DEA2E84CA44F3B120F90B3CC/@EntryIndexedValue" value="&lt;NamingElement Priority=&quot;10&quot; Title=&quot;Macros&quot;&gt;&lt;Descriptor Static=&quot;Indeterminate&quot; Constexpr=&quot;Indeterminate&quot; Const=&quot;Indeterminate&quot; Volatile=&quot;Indeterminate&quot; Accessibility=&quot;NOT_APPLICABLE&quot;&gt;&lt;type Name=&quot;macro&quot; /&gt;&lt;/Descriptor&gt;&lt;Policy Inspect=&quot;True&quot; WarnAboutPrefixesAndSuffixes=&quot;False&quot; Prefix=&quot;&quot; Suffix=&quot;&quot; Style=&quot;AA_BB&quot; /&gt;&lt;/NamingElement&gt;" type="string" />
<option name="/Default/CodeStyle/Naming/CppNamingOptions/Rules/=FAAD8F52D9EFD84E8894C7AAE4F72FCA/@EntryIndexedValue" value="&lt;NamingElement Priority=&quot;7&quot; Title=&quot;Global constants&quot;&gt;&lt;Descriptor Static=&quot;Indeterminate&quot; Constexpr=&quot;Indeterminate&quot; Const=&quot;True&quot; Volatile=&quot;Indeterminate&quot; Accessibility=&quot;NOT_APPLICABLE&quot;&gt;&lt;type Name=&quot;global variable&quot; /&gt;&lt;/Descriptor&gt;&lt;Policy Inspect=&quot;True&quot; WarnAboutPrefixesAndSuffixes=&quot;False&quot; Prefix=&quot;&quot; Suffix=&quot;&quot; Style=&quot;AA_BB&quot; /&gt;&lt;/NamingElement&gt;" type="string" />
<option name="/Default/CodeStyle/Naming/CppNamingOptions/Rules/=FBDB26623C05204BA0FA28B9017D7101/@EntryIndexedValue" value="&lt;NamingElement Priority=&quot;6&quot; Title=&quot;Other constants&quot;&gt;&lt;Descriptor Static=&quot;True&quot; Constexpr=&quot;Indeterminate&quot; Const=&quot;True&quot; Volatile=&quot;Indeterminate&quot; Accessibility=&quot;NOT_APPLICABLE&quot;&gt;&lt;type Name=&quot;class field&quot; /&gt;&lt;type Name=&quot;local variable&quot; /&gt;&lt;type Name=&quot;struct field&quot; /&gt;&lt;/Descriptor&gt;&lt;Policy Inspect=&quot;True&quot; WarnAboutPrefixesAndSuffixes=&quot;False&quot; Prefix=&quot;&quot; Suffix=&quot;&quot; Style=&quot;AA_BB&quot; /&gt;&lt;/NamingElement&gt;" type="string" />
</component>
</project>
+4
View File
@@ -0,0 +1,4 @@
<?xml version="1.0" encoding="UTF-8"?>
<project version="4">
<component name="Encoding" addBOMForNewFiles="with BOM under Windows, with no BOM otherwise" />
</project>
+9
View File
@@ -0,0 +1,9 @@
<component name="InspectionProjectProfileManager">
<profile version="1.0">
<option name="myName" value="Project Default" />
<inspection_tool class="ClangTidy" enabled="true" level="WARNING" enabled_by_default="true">
<option name="clangTidyChecks" value="-*,bugprone-argument-comment,bugprone-assert-side-effect,bugprone-bad-signal-to-kill-thread,bugprone-branch-clone,bugprone-copy-constructor-init,bugprone-dangling-handle,bugprone-dynamic-static-initializers,bugprone-fold-init-type,bugprone-forward-declaration-namespace,bugprone-forwarding-reference-overload,bugprone-inaccurate-erase,bugprone-incorrect-roundings,bugprone-integer-division,bugprone-lambda-function-name,bugprone-macro-parentheses,bugprone-macro-repeated-side-effects,bugprone-misplaced-operator-in-strlen-in-alloc,bugprone-misplaced-pointer-arithmetic-in-alloc,bugprone-misplaced-widening-cast,bugprone-move-forwarding-reference,bugprone-multiple-statement-macro,bugprone-no-escape,bugprone-parent-virtual-call,bugprone-posix-return,bugprone-reserved-identifier,bugprone-sizeof-container,bugprone-sizeof-expression,bugprone-spuriously-wake-up-functions,bugprone-string-constructor,bugprone-string-integer-assignment,bugprone-string-literal-with-embedded-nul,bugprone-suspicious-enum-usage,bugprone-suspicious-include,bugprone-suspicious-memset-usage,bugprone-suspicious-missing-comma,bugprone-suspicious-semicolon,bugprone-suspicious-string-compare,bugprone-suspicious-memory-comparison,bugprone-suspicious-realloc-usage,bugprone-swapped-arguments,bugprone-terminating-continue,bugprone-throw-keyword-missing,bugprone-too-small-loop-variable,bugprone-undefined-memory-manipulation,bugprone-undelegated-constructor,bugprone-unhandled-self-assignment,bugprone-unused-raii,bugprone-unused-return-value,bugprone-use-after-move,bugprone-virtual-near-miss,cert-dcl21-cpp,cert-dcl58-cpp,cert-err34-c,cert-err52-cpp,cert-err60-cpp,cert-flp30-c,cert-msc50-cpp,cert-msc51-cpp,cert-str34-c,cppcoreguidelines-interfaces-global-init,cppcoreguidelines-narrowing-conversions,cppcoreguidelines-pro-type-member-init,cppcoreguidelines-pro-type-static-cast-downcast,cppcoreguidelines-slicing,google-default-arguments,google-runtime-operator,hicpp-exception-baseclass,hicpp-multiway-paths-covered,misc-misplaced-const,misc-new-delete-overloads,misc-non-copyable-objects,misc-throw-by-value-catch-by-reference,misc-unconventional-assign-operator,misc-uniqueptr-reset-release,modernize-avoid-bind,modernize-concat-nested-namespaces,modernize-deprecated-headers,modernize-deprecated-ios-base-aliases,modernize-loop-convert,modernize-make-shared,modernize-make-unique,modernize-pass-by-value,modernize-raw-string-literal,modernize-redundant-void-arg,modernize-replace-auto-ptr,modernize-replace-disallow-copy-and-assign-macro,modernize-replace-random-shuffle,modernize-return-braced-init-list,modernize-shrink-to-fit,modernize-unary-static-assert,modernize-use-auto,modernize-use-bool-literals,modernize-use-emplace,modernize-use-equals-default,modernize-use-equals-delete,modernize-use-nodiscard,modernize-use-noexcept,modernize-use-override,modernize-use-transparent-functors,modernize-use-uncaught-exceptions,mpi-buffer-deref,mpi-type-mismatch,openmp-use-default-none,performance-faster-string-find,performance-for-range-copy,performance-implicit-conversion-in-loop,performance-inefficient-algorithm,performance-inefficient-string-concatenation,performance-inefficient-vector-operation,performance-move-const-arg,performance-move-constructor-init,performance-no-automatic-move,performance-noexcept-move-constructor,performance-trivially-destructible,performance-type-promotion-in-math-fn,performance-unnecessary-copy-initialization,performance-unnecessary-value-param,portability-simd-intrinsics,readability-avoid-const-params-in-decls,readability-const-return-type,readability-container-size-empty,readability-convert-member-functions-to-static,readability-delete-null-pointer,readability-deleted-default,readability-inconsistent-declaration-parameter-name,readability-make-member-function-const,readability-misleading-indentation,readability-misplaced-array-index,readability-non-const-parameter,readability-redundant-control-flow,readability-redundant-declaration,readability-redundant-function-ptr-dereference,readability-redundant-smartptr-get,readability-redundant-string-cstr,readability-redundant-string-init,readability-simplify-subscript-expr,readability-static-accessed-through-instance,readability-static-definition-in-anonymous-namespace,readability-string-compare,readability-uniqueptr-delete-release,readability-use-anyofallof" />
</inspection_tool>
<inspection_tool class="CppCStyleCast" enabled="false" level="WEAK WARNING" enabled_by_default="false" />
</profile>
</component>
+19
View File
@@ -0,0 +1,19 @@
<?xml version="1.0" encoding="UTF-8"?>
<project version="4">
<component name="ExternalStorageConfigurationManager" enabled="true" />
<component name="MakefileSettings">
<option name="linkedExternalProjectsSettings">
<MakefileProjectSettings>
<option name="buildTarget" value="run" />
<option name="externalProjectPath" value="$PROJECT_DIR$" />
<option name="modules">
<set>
<option value="$PROJECT_DIR$" />
</set>
</option>
<option name="version" value="2" />
</MakefileProjectSettings>
</option>
</component>
<component name="MakefileWorkspace" PROJECT_DIR="$PROJECT_DIR$" />
</project>
Generated
+6
View File
@@ -0,0 +1,6 @@
<?xml version="1.0" encoding="UTF-8"?>
<project version="4">
<component name="VcsDirectoryMappings">
<mapping directory="" vcs="Git" />
</component>
</project>
+21 -13
View File
@@ -15,14 +15,14 @@ else
CXX := c++
LDFLAGS := -lm -shared
endif
CFLAGS := -fno-strict-aliasing -g -Wall -Wno-unused-function -fPIC -fvisibility=hidden -DSM64_LIB_EXPORT -DGBI_FLOATS -DVERSION_US -DNO_SEGMENTED_MEMORY
CFLAGS := -fno-strict-aliasing -g -Wall -Wno-unused-function -fPIC -fvisibility=hidden -DSM64_LIB_EXPORT -DGBI_FLOATS -DVERSION_US -DENABLE_RUMBLE -DNO_SEGMENTED_MEMORY
SRC_DIRS := src src/decomp src/decomp/engine src/decomp/include/PR src/decomp/game src/decomp/pc src/decomp/pc/audio src/decomp/mario src/decomp/tools src/decomp/audio
BUILD_DIR := build
DIST_DIR := dist
ALL_DIRS := $(addprefix $(BUILD_DIR)/,$(SRC_DIRS))
LIB_FILE := $(DIST_DIR)/libsm64.so
LIB_FILE := $(DIST_DIR)/sm64.so
LIB_H_FILE := $(DIST_DIR)/include/libsm64.h
TEST_FILE := run-test
@@ -40,18 +40,25 @@ else
DEP_FILES := $(O_FILES:.o=.d)
endif
TEST_SRCS_C := test/context.c test/level.c test/gl33core/gl33core_renderer.c test/gl20/gl20_renderer.c
TEST_SRCS_CPP := test/main.cpp test/audio.cpp
TEST_SRCS_C := test/level.c test/gl33core/gl33core_renderer.c test/gl20/gl20_renderer.c
TEST_SRCS_CPP := test/main.cpp test/audio.cpp test/context.cpp \
test/imgui/imgui.cpp \
test/imgui/imgui_demo.cpp \
test/imgui/imgui_draw.cpp \
test/imgui/imgui_tables.cpp \
test/imgui/imgui_widgets.cpp \
test/imgui/backends/imgui_impl_sdl2.cpp \
test/imgui/backends/imgui_impl_opengl3.cpp
TEST_OBJS := $(foreach file,$(TEST_SRCS_C),$(BUILD_DIR)/$(file:.c=.o)) $(foreach file,$(TEST_SRCS_CPP),$(BUILD_DIR)/$(file:.cpp=.o))
ifdef WINDOWS_BUILD
LIB_FILE := $(DIST_DIR)/sm64.dll
TEST_FILE := $(DIST_DIR)/run-test.exe
else ifdef MACOS_BUILD
LIB_FILE := $(DIST_DIR)/libsm64.dylib
LIB_FILE := $(DIST_DIR)/sm64.dylib
endif
DUMMY := $(shell mkdir -p $(ALL_DIRS) build/test build/test/gl33core build/test/gl20 src/decomp/mario $(DIST_DIR)/include)
DUMMY := $(shell mkdir -p $(ALL_DIRS) build/test build/test/gl33core build/test/gl20 build/test/imgui build/test/imgui/backends src/decomp/mario $(DIST_DIR)/include)
$(filter-out src/decomp/mario/geo.inc.c,$(IMPORTED)): src/decomp/mario/geo.inc.c
src/decomp/mario/geo.inc.c: ./import-mario-geo.py
@@ -88,21 +95,22 @@ test/level.c: ./import-test-collision.py
test/main.cpp test/gl20/gl20_renderer.c test/gl33core/gl33core_renderer.c: test/level.c
SDL2_RAW_CFLAGS := $(shell sdl2-config --cflags)
SDL2_CFLAGS := $(filter-out -Dmain=SDL_main,$(SDL2_RAW_CFLAGS))
$(BUILD_DIR)/test/%.o: test/%.c
@$(CC) $(CFLAGS) -MM -MP -MT $@ -MF $(BUILD_DIR)/test/$*.d $<
$(CC) -c $(CFLAGS) -o $@ $<
$(CC) -c $(CFLAGS) $(SDL2_CFLAGS) -I src/decomp/include -o $@ $<
$(BUILD_DIR)/test/%.o: test/%.cpp
@$(CXX) $(CFLAGS) -MM -MP -MT $@ -MF $(BUILD_DIR)/test/$*.d $<
$(CXX) -c $(CFLAGS) -o $@ $<
$(CXX) -c $(CFLAGS) $(SDL2_CFLAGS) -I src/decomp/include -std=c++17 -o $@ $<
$(TEST_FILE): $(LIB_FILE) $(TEST_OBJS)
ifdef WINDOWS_BUILD
$(CC) -o $@ $(TEST_OBJS) $(LIB_FILE) -lglew32 -lopengl32 -lSDL2 -lSDL2main -lm
$(CXX) -o $@ $(TEST_OBJS) $(LIB_FILE) -lglew32 -lopengl32 -lSDL2 -lm
else ifdef MACOS_BUILD
$(CC) -o $@ $(TEST_OBJS) $(LIB_FILE) -framework OpenGL -lGLEW -lSDL2 -lSDL2main -lm -lpthread
$(CXX) -o $@ $(TEST_OBJS) $(LIB_FILE) -framework OpenGL -lGLEW -lSDL2 -lSDL2main -lm -lpthread
else
$(CC) -o $@ $(TEST_OBJS) $(LIB_FILE) -lGLEW -lGL -lSDL2 -lSDL2main -lm -lpthread
$(CXX) -o $@ $(TEST_OBJS) $(LIB_FILE) -lGLEW -lGL $(shell sdl2-config --libs) -lm -lpthread
endif
lib: $(LIB_FILE) $(LIB_H_FILE)
+1
View File
@@ -31,6 +31,7 @@ project under the `test` directory as well, demonstrating usage of the library.
- To run the test program you'll need a SM64 US ROM in the root of the repository with the name `baserom.us.z64`.
## Building on Windows
- [Follow steps 1-4 for setting up MSYS2 MinGW 64 here](https://github.com/sm64-port/sm64-port#windows), but replace the repository URL with `https://github.com/libsm64/libsm64.git`
- Ensure the SDL2 and GLEW libraries are installed if you're building the test program.
- 64 bits: `pacman -S mingw-w64-x86_64-SDL2 mingw-w64-x86_64-glew`.
+2 -1
View File
@@ -54,6 +54,7 @@ model_inc_h = """
#include "../include/PR/gbi.h"
"""
def main():
global model_inc_h
@@ -82,7 +83,6 @@ def main():
lines.insert(0, "#include \"../../load_tex_data.h\"")
model_inc_c = "\n".join(lines)
with open("src/decomp/mario/geo.inc.c", "w") as file:
file.write(geo_inc_c_header + geo_inc_c + geo_inc_c_footer)
@@ -95,5 +95,6 @@ def main():
with open("src/decomp/mario/geo.inc.h", "w") as file:
file.write(geo_inc_h)
if __name__ == "__main__":
main()
+85 -27
View File
@@ -1,9 +1,10 @@
#!/usr/bin/env python3
import os
import shutil
import urllib.request
import re
COLLISION_URL = "https://raw.githubusercontent.com/n64decomp/sm64/06ec56df7f951f88da05f468cdcacecba496145a/levels/bob/areas/1/collision.inc.c"
SCRIPT_URL = "https://raw.githubusercontent.com/n64decomp/sm64/06ec56df7f951f88da05f468cdcacecba496145a/levels/bob/script.c"
BOB_COLLISION_URL = "https://raw.githubusercontent.com/n64decomp/sm64/06ec56df7f951f88da05f468cdcacecba496145a/levels/bob/areas/1/collision.inc.c"
LEVEL_H = """#pragma once
@@ -13,46 +14,103 @@ extern const struct SM64Surface surfaces[];
extern const size_t surfaces_count;
"""
def main():
print("Downloading " + BOB_COLLISION_URL)
in_lines = urllib.request.urlopen(BOB_COLLISION_URL).read().decode('utf8').splitlines()
def extract_surface(token):
token = token.strip()
if "SURFACE_" in token:
token = token[token.find("SURFACE_"):]
if "," in token:
token = token.split(",")[0].strip()
return token
def parse_collision(raw):
verts = []
tris = []
mode = ""
current_surface = "SURFACE_DEFAULT"
for line in in_lines:
if not line.strip().startswith("COL_"):
continue;
for line in raw:
line = line.strip()
tokens = line.strip().replace("(", ",").replace(")", "").split(",")
if "COL_VERTEX(" in line:
inside = line[line.find("(") + 1:line.rfind(")")]
t = [x.strip() for x in inside.split(",")]
verts.append((int(t[0]), int(t[1]), int(t[2])))
if tokens[0] == "COL_VERTEX":
verts.append([ int(tokens[1]), int(tokens[2]), int(tokens[3]) ])
elif tokens[0] == "COL_TRI_INIT":
mode = tokens[1]
elif tokens[0] == "COL_TRI":
tris.append([ int(tokens[1]), int(tokens[2]), int(tokens[3]), mode ])
elif "COL_TRI_INIT(" in line:
inside = line[line.find("(") + 1:line.rfind(")")]
t = [x.strip() for x in inside.split(",")]
current_surface = extract_surface(t[0])
elif "COL_TRI(" in line:
inside = line[line.find("(") + 1:line.rfind(")")]
t = [x.strip() for x in inside.split(",")]
tris.append((int(t[0]), int(t[1]), int(t[2]), current_surface))
return verts, tris
def parse_script(raw):
current_area = None
area_terrain = {}
for line in raw:
line = line.strip()
m_area = re.search(r"AREA\s*\(\s*(\d+)", line)
if m_area:
current_area = int(m_area.group(1))
m_terrain = re.search(r"TERRAIN_TYPE\s*\(\s*([A-Z_0-9]+)\s*\)", line)
if m_terrain and current_area is not None:
area_terrain[current_area] = m_terrain.group(1)
return area_terrain
def main():
print("Downloading collision...")
collision_raw = urllib.request.urlopen(COLLISION_URL).read().decode("utf8").splitlines()
print("Downloading script...")
script_raw = urllib.request.urlopen(SCRIPT_URL).read().decode("utf8").splitlines()
verts, tris = parse_collision(collision_raw)
area_terrain = parse_script(script_raw)
current_terrain = area_terrain.get(1, "TERRAIN_GRASS")
out_lines = []
for tri in tris:
out_lines.append("{%s,0,TERRAIN_SNOW,{{%s,%s,%s},{%s,%s,%s},{%s,%s,%s}}}"%(tri[3], \
verts[tri[0]][0], verts[tri[0]][1], verts[tri[0]][2], \
verts[tri[1]][0], verts[tri[1]][1], verts[tri[1]][2], \
verts[tri[2]][0], verts[tri[2]][1], verts[tri[2]][2]))
v1 = verts[tri[0]]
v2 = verts[tri[1]]
v3 = verts[tri[2]]
surf = tri[3]
out_lines.append(
"{%s,0,%s,0,{{%d,%d,%d},{%d,%d,%d},{%d,%d,%d}}}" % (
surf,
current_terrain,
v1[0], v1[1], v1[2],
v2[0], v2[1], v2[2],
v3[0], v3[1], v3[2],
)
)
out_str = ",\n".join(out_lines)
out_str = "const struct SM64Surface surfaces[] = {\n" + out_str + "};\n\n"
out_str += "const size_t surfaces_count = sizeof( surfaces ) / sizeof( surfaces[0] );"
out_str = "const struct SM64Surface surfaces[] = {\n" + out_str + "\n};\n\n"
out_str += "const size_t surfaces_count = sizeof(surfaces) / sizeof(surfaces[0]);\n"
out_str = '#include "../src/decomp/include/surface_terrains.h"\n' + out_str
out_str = '#include "level.h"\n' + out_str
with open("test/level.c", "w") as file:
file.write(out_str)
with open("test/level.c", "w") as f:
f.write(out_str)
with open("test/level.h", "w") as f:
f.write(LEVEL_H)
with open("test/level.h", "w") as file:
file.write(LEVEL_H)
if __name__ == "__main__":
main()
+170
View File
@@ -0,0 +1,170 @@
//
// Created by nepushiro on 5/29/26.
//
#include "FakeObject.h"
#include <string.h>
#include "decomp/global_state.h"
#include "decomp/engine/math_util.h"
#include "decomp/game/interaction.h"
#include "decomp/game/object_stuff.h"
#include "decomp/include/object_fields.h"
#include "libsm64.h"
#include <stdint.h>
#include <stdbool.h>
void fake_object_init(struct FakeObject *fake, float x, float y, float z)
{
memset(fake, 0, sizeof(*fake));
struct Object *obj = &fake->object;
obj->activeFlags = ACTIVE_FLAG_ACTIVE | ACTIVE_FLAG_UNK8;
obj->parentObj = NULL;
obj->prevObj = NULL;
obj->collidedObjInteractTypes = 0;
obj->numCollidedObjs = 0;
for (s32 i = 0; i < 0x50; i++)
{
#ifdef _WIN32
obj->rawData.asS32[i] = 0;
#endif
#ifdef _WIN64
obj->ptrData.asVoidPtr[i] = NULL;
#endif
}
obj->unused1 = 0;
obj->bhvStackIndex = 0;
obj->bhvDelayTimer = 0;
obj->hitboxRadius = 50.0f;
obj->hitboxHeight = 100.0f;
obj->hurtboxRadius = 0.0f;
obj->hurtboxHeight = 0.0f;
obj->hitboxDownOffset = 0.0f;
obj->unused2 = 0;
obj->platform = NULL;
obj->collisionData = NULL;
obj->oIntangibleTimer = -1;
obj->oDamageOrCoinValue = 0;
obj->oHealth = 2048;
obj->oCollisionDistance = 1000.0f;
obj->oDrawingDistance = 4000.0f;
mtxf_identity(obj->transform);
obj->respawnInfoType = RESPAWN_INFO_TYPE_NULL;
obj->respawnInfo = NULL;
obj->oDistanceToMario = 19000.0f;
obj->oRoom = -1;
obj->oInteractType = 0;
obj->oInteractionSubtype = 0;
obj->oHeldState = 0;
obj->oAction = 0;
obj->header.gfx.node.flags |= GRAPH_RENDER_ACTIVE;
obj->header.gfx.node.flags |= GRAPH_RENDER_INVISIBLE;
obj->header.gfx.node.flags &= ~GRAPH_RENDER_BILLBOARD;
obj->header.gfx.pos[0] = x;
obj->header.gfx.pos[1] = y;
obj->header.gfx.pos[2] = z;
obj->header.gfx.angle[0] = 0;
obj->header.gfx.angle[1] = 0;
obj->header.gfx.angle[2] = 0;
obj->header.gfx.throwMatrix = NULL;
obj->header.gfx.sharedChild = NULL;
obj->header.gfx.animInfo.curAnim = NULL;
obj->header.gfx.animInfo.animID = 0;
obj->header.gfx.animInfo.animFrame = 0;
obj->header.gfx.animInfo.animTimer = 0;
obj->oPosX = x;
obj->oPosY = y;
obj->oPosZ = z;
obj->oMoveAnglePitch = 0;
obj->oMoveAngleYaw = 0;
obj->oMoveAngleRoll = 0;
obj->oFaceAnglePitch = 0;
obj->oFaceAngleYaw = 0;
obj->oFaceAngleRoll = 0;
}
void fake_object_sync_position(struct FakeObject *fake)
{
struct Object *obj = &fake->object;
obj->header.gfx.pos[0] = obj->oPosX;
obj->header.gfx.pos[1] = obj->oPosY;
obj->header.gfx.pos[2] = obj->oPosZ;
}
bool fake_object_overlaps_mario(struct FakeObject *fake, struct MarioState *m)
{
struct Object *obj = &fake->object;
float dx = obj->oPosX - m->pos[0];
float dz = obj->oPosZ - m->pos[2];
float radius = obj->hitboxRadius;
float top = obj->oPosY + obj->hitboxHeight;
float bottom = obj->oPosY - obj->hitboxDownOffset;
if ((dx * dx) + (dz * dz) > radius * radius)
{
return false;
}
if (m->pos[1] < bottom || m->pos[1] > top)
{
return false;
}
return true;
}
void fake_object_add_collision(struct FakeObject *fake, struct MarioState *m)
{
struct Object *obj = &fake->object;
if (obj->oHeldState != 0)
{
return;
}
m->marioObj->collidedObjInteractTypes |= obj->oInteractType;
if (m->marioObj->numCollidedObjs < 4)
{
m->marioObj->collidedObjs[m->marioObj->numCollidedObjs++] = obj;
}
}
void fake_object_apply_pole(struct FakeObject *fake)
{
(void)fake;
}
void fake_object_set_preset(struct FakeObject *fake, uint32_t preset)
{
struct Object *obj = &fake->object;
switch (preset)
{
case 1:
obj->oInteractType = INTERACT_POLE;
obj->oInteractionSubtype = 0;
obj->hitboxRadius = 60.0f;
obj->hitboxHeight = 1000.0f;
obj->hitboxDownOffset = 0.0f;
break;
case 0: default:
obj->oInteractType = 0;
obj->oInteractionSubtype = 0;
obj->hitboxRadius = 50.0f;
obj->hitboxHeight = 100.0f;
obj->hitboxDownOffset = 0.0f;
break;
}
}
+25
View File
@@ -0,0 +1,25 @@
//
// Created by nepushiro on 5/29/26.
//
#ifndef LIBSM64_FAKEOBJECT_H
#define LIBSM64_FAKEOBJECT_H
#endif //LIBSM64_FAKEOBJECT_H
#include <stdint.h>
#include <types.h>
#include <stdbool.h>
struct FakeObject
{
struct Object object;
};
void fake_object_init(struct FakeObject *fake, float x, float y, float z);
void fake_object_sync_position(struct FakeObject *fake);
bool fake_object_overlaps_mario(struct FakeObject *fake, struct MarioState *m);
void fake_object_add_collision(struct FakeObject *fake, struct MarioState *m);
void fake_object_apply_pole(struct FakeObject *fake);
void fake_object_set_preset(struct FakeObject *fake, uint32_t preset);
@@ -114,7 +114,8 @@ struct Instrument **instOut = _instOut;\
}
#endif
void seq_channel_layer_process_script(struct SequenceChannelLayer *layer) {
void seq_channel_layer_process_script(struct SequenceChannelLayer *layer)
{
struct SequencePlayer *seqPlayer; // sp5C, t4
struct SequenceChannel *seqChannel; // sp58, t5
struct M64ScriptState *state;
@@ -144,31 +145,37 @@ void seq_channel_layer_process_script(struct SequenceChannelLayer *layer) {
#endif
sameSound = TRUE;
if ((*layer).enabled == FALSE) {
if ((*layer).enabled == FALSE)
{
return;
}
if ((*layer).delay > 1) {
if ((*layer).delay > 1)
{
(*layer).delay--;
if (!layer->stopSomething && layer->delay <= layer->duration) {
if (!layer->stopSomething && layer->delay <= layer->duration)
{
seq_channel_layer_note_decay(layer);
layer->stopSomething = TRUE;
}
return;
}
if (!layer->continuousNotes) {
if (!layer->continuousNotes)
{
seq_channel_layer_note_decay(layer);
}
if (PORTAMENTO_MODE(layer->portamento) == PORTAMENTO_MODE_1 ||
PORTAMENTO_MODE(layer->portamento) == PORTAMENTO_MODE_2) {
PORTAMENTO_MODE(layer->portamento) == PORTAMENTO_MODE_2)
{
layer->portamento.mode = 0;
}
seqChannel = (*layer).seqChannel;
seqPlayer = (*seqChannel).seqPlayer;
for (;;) {
for (;;)
{
state = &layer->scriptState;
//M64_READ_U8(state, cmd);
{
@@ -177,13 +184,16 @@ void seq_channel_layer_process_script(struct SequenceChannelLayer *layer) {
cmd = *_ptr_pc;
}
if (cmd <= 0xc0) {
if (cmd <= 0xc0)
{
break;
}
switch (cmd) {
switch (cmd)
{
case 0xff: // layer_end; function return or end of script
if (state->depth == 0) {
if (state->depth == 0)
{
// N.B. this function call is *not* inlined even though it's
// within the same file, unlike in the rest of this function.
seq_channel_layer_disable(layer);
@@ -204,9 +214,12 @@ void seq_channel_layer_process_script(struct SequenceChannelLayer *layer) {
break;
case 0xf7: // layer_loopend
if (--state->remLoopIters[state->depth - 1] != 0) {
if (--state->remLoopIters[state->depth - 1] != 0)
{
state->pc = state->stack[state->depth - 1];
} else {
}
else
{
state->depth--;
}
break;
@@ -219,9 +232,12 @@ void seq_channel_layer_process_script(struct SequenceChannelLayer *layer) {
case 0xc1: // layer_setshortnotevelocity
case 0xca: // layer_setpan
temp_a0_5 = *(state->pc++);
if (cmd == 0xc1) {
if (cmd == 0xc1)
{
layer->velocitySquare = (f32)(temp_a0_5 * temp_a0_5);
} else {
}
else
{
layer->pan = (f32)temp_a0_5 / US_FLOAT(128.0);
}
break;
@@ -229,9 +245,12 @@ void seq_channel_layer_process_script(struct SequenceChannelLayer *layer) {
case 0xc2: // layer_transpose; set transposition in semitones
case 0xc9: // layer_setshortnoteduration
temp_a0_5 = *(state->pc++);
if (cmd == 0xc9) {
if (cmd == 0xc9)
{
layer->noteDuration = temp_a0_5;
} else {
}
else
{
layer->transposition = temp_a0_5;
}
break;
@@ -242,9 +261,12 @@ void seq_channel_layer_process_script(struct SequenceChannelLayer *layer) {
//layer->continuousNotes = (cmd == 0xc4) ? TRUE : FALSE;
{
u8 setting;
if (cmd == 0xc4) {
if (cmd == 0xc4)
{
setting = TRUE;
} else {
}
else
{
setting = FALSE;
}
layer->continuousNotes = setting;
@@ -260,7 +282,8 @@ void seq_channel_layer_process_script(struct SequenceChannelLayer *layer) {
case 0xc6: // layer_setinstr
M64_READ_U8(state, cmdSemitone);
if (cmdSemitone < 127) {
if (cmdSemitone < 127)
{
GET_INSTRUMENT(seqChannel, cmdSemitone, &(*layer).instrument, &(*layer).adsr, cmdSemitone, 1);
}
break;
@@ -273,13 +296,15 @@ void seq_channel_layer_process_script(struct SequenceChannelLayer *layer) {
cmdSemitone += (*layer).transposition;
cmdSemitone += (*seqPlayer).transposition;
if (cmdSemitone >= 0x80) {
if (cmdSemitone >= 0x80)
{
cmdSemitone = 0;
}
layer->portamentoTargetNote = cmdSemitone;
// If special, the next param is u8 instead of var
if (PORTAMENTO_IS_SPECIAL((*layer).portamento)) {
if (PORTAMENTO_IS_SPECIAL((*layer).portamento))
{
layer->portamentoTime = *((state)->pc++);
break;
}
@@ -293,7 +318,8 @@ void seq_channel_layer_process_script(struct SequenceChannelLayer *layer) {
break;
default:
switch (cmd & 0xf0) {
switch (cmd & 0xf0)
{
case 0xd0: // layer_setshortnotevelocityfromtable
sp3A = seqPlayer->shortNoteVelocityTable[cmd & 0xf];
(*layer).velocitySquare = (f32)(sp3A * sp3A);
@@ -305,14 +331,19 @@ void seq_channel_layer_process_script(struct SequenceChannelLayer *layer) {
}
}
if (cmd == 0xc0) { // layer_delay
if (cmd == 0xc0)
{ // layer_delay
M64_READ_COMPRESSED_U16(state, layer->delay);
layer->stopSomething = TRUE;
} else {
}
else
{
layer->stopSomething = FALSE;
if (seqChannel->largeNotes == TRUE) {
switch (cmd & 0xc0) {
if (seqChannel->largeNotes == TRUE)
{
switch (cmd & 0xc0)
{
case 0x00: // layer_note0 (play percentage, velocity, duration)
M64_READ_COMPRESSED_U16(state, sp3A);
vel = *((*state).pc++);
@@ -333,11 +364,13 @@ void seq_channel_layer_process_script(struct SequenceChannelLayer *layer) {
layer->noteDuration = *((*state).pc++);
goto l1090;
}
l1090:
cmdSemitone = cmd - (cmd & 0xc0);
l1090: cmdSemitone = cmd - (cmd & 0xc0);
layer->velocitySquare = vel * vel;
} else {
switch (cmd & 0xc0) {
}
else
{
switch (cmd & 0xc0)
{
case 0x00: // play note, type 0 (play percentage)
M64_READ_COMPRESSED_U16(state, sp3A);
layer->playPercentage = sp3A;
@@ -351,9 +384,7 @@ l1090:
sp3A = layer->playPercentage;
goto l1138;
}
l1138:
cmdSemitone = cmd - (cmd & 0xc0);
l1138: cmdSemitone = cmd - (cmd & 0xc0);
}
layer->delay = sp3A;
@@ -361,14 +392,20 @@ l1138:
if ((seqPlayer->muted && (seqChannel->muteBehavior & MUTE_BEHAVIOR_STOP_NOTES) != 0)
|| seqChannel->stopSomething2
|| !seqChannel->hasInstrument
) {
)
{
layer->stopSomething = TRUE;
} else {
if (seqChannel->instOrWave == 0) { // drum
}
else
{
if (seqChannel->instOrWave == 0)
{ // drum
cmdSemitone += (*seqChannel).transposition + (*layer).transposition;
if (cmdSemitone >= gCtlEntries[seqChannel->bankId].numDrums) {
if (cmdSemitone >= gCtlEntries[seqChannel->bankId].numDrums)
{
cmdSemitone = gCtlEntries[seqChannel->bankId].numDrums;
if (cmdSemitone == 0) {
if (cmdSemitone == 0)
{
// this goto looks a bit like a function return...
layer->stopSomething = TRUE;
goto skip;
@@ -378,9 +415,12 @@ l1138:
}
drum = gCtlEntries[seqChannel->bankId].drums[cmdSemitone];
if (drum == NULL) {
if (drum == NULL)
{
layer->stopSomething = TRUE;
} else {
}
else
{
layer->adsr.envelope = drum->envelope;
layer->adsr.releaseRate = drum->releaseRate;
layer->pan = FLOAT_CAST(drum->pan) / US_FLOAT(128.0);
@@ -389,34 +429,49 @@ l1138:
}
skip:;
} else { // instrument
}
else
{ // instrument
cmdSemitone += (*seqPlayer).transposition + (*seqChannel).transposition + (*layer).transposition;
if (cmdSemitone >= 0x80) {
if (cmdSemitone >= 0x80)
{
layer->stopSomething = TRUE;
} else {
}
else
{
instrument = layer->instrument;
if (instrument == NULL) {
if (instrument == NULL)
{
instrument = seqChannel->instrument;
}
if (layer->portamento.mode != 0) {
if (layer->portamento.mode != 0)
{
//! copt needs a ternary:
//usedSemitone = (layer->portamentoTargetNote < cmdSemitone) ? cmdSemitone : layer->portamentoTargetNote;
if (layer->portamentoTargetNote < cmdSemitone) {
if (layer->portamentoTargetNote < cmdSemitone)
{
usedSemitone = cmdSemitone;
} else {
}
else
{
usedSemitone = layer->portamentoTargetNote;
}
if (instrument != NULL) {
sound = (u8) usedSemitone < instrument->normalRangeLo ? &instrument->lowNotesSound
: (u8) usedSemitone <= instrument->normalRangeHi ?
&instrument->normalNotesSound : &instrument->highNotesSound;
if (instrument != NULL)
{
sound = (u8)usedSemitone < instrument->normalRangeLo
? &instrument->lowNotesSound
: (u8)usedSemitone <= instrument->normalRangeHi
? &instrument->normalNotesSound
: &instrument->highNotesSound;
sameSound = (sound == (*layer).sound);
layer->sound = sound;
tuning = (*sound).tuning;
} else {
}
else
{
layer->sound = NULL;
tuning = 1.0f;
}
@@ -425,7 +480,8 @@ l1138:
temp_f12 = gNoteFrequencies[layer->portamentoTargetNote] * tuning;
portamento = &layer->portamento;
switch (PORTAMENTO_MODE(layer->portamento)) {
switch (PORTAMENTO_MODE(layer->portamento))
{
case PORTAMENTO_MODE_1:
case PORTAMENTO_MODE_3:
case PORTAMENTO_MODE_5:
@@ -439,29 +495,34 @@ l1138:
sp24 = temp_f12;
goto l13cc;
}
l13cc:
portamento->extent = sp24 / freqScale - US_FLOAT(1.0);
if (PORTAMENTO_IS_SPECIAL((*layer).portamento)) {
l13cc: portamento->extent = sp24 / freqScale - US_FLOAT(1.0);
if (PORTAMENTO_IS_SPECIAL((*layer).portamento))
{
portamento->speed = US_FLOAT(32512.0) * FLOAT_CAST((*seqPlayer).tempo)
/ ((f32)(*layer).delay * (f32)gTempoInternalToExternal
* FLOAT_CAST((*layer).portamentoTime));
} else {
}
else
{
portamento->speed = US_FLOAT(127.0) / FLOAT_CAST((*layer).portamentoTime);
}
portamento->cur = 0.0f;
layer->freqScale = freqScale;
if (PORTAMENTO_MODE((*layer).portamento) == PORTAMENTO_MODE_5) {
if (PORTAMENTO_MODE((*layer).portamento) == PORTAMENTO_MODE_5)
{
layer->portamentoTargetNote = cmdSemitone;
}
} else if (instrument != NULL) {
sound = cmdSemitone < instrument->normalRangeLo ?
&instrument->lowNotesSound : cmdSemitone <= instrument->normalRangeHi ?
&instrument->normalNotesSound : &instrument->highNotesSound;
}
else if (instrument != NULL)
{
sound = cmdSemitone < instrument->normalRangeLo ? &instrument->lowNotesSound : cmdSemitone <= instrument->normalRangeHi ? &instrument->normalNotesSound : &instrument->highNotesSound;
sameSound = (sound == (*layer).sound);
layer->sound = sound;
layer->freqScale = gNoteFrequencies[cmdSemitone] * (*sound).tuning;
} else {
}
else
{
layer->sound = NULL;
layer->freqScale = gNoteFrequencies[cmdSemitone];
}
@@ -471,30 +532,41 @@ l13cc:
}
}
if (layer->stopSomething == TRUE) {
if (layer->note != NULL || layer->continuousNotes) {
if (layer->stopSomething == TRUE)
{
if (layer->note != NULL || layer->continuousNotes)
{
seq_channel_layer_note_decay(layer);
}
return;
}
cmdSemitone = FALSE;
if (!layer->continuousNotes) {
if (!layer->continuousNotes)
{
cmdSemitone = TRUE;
} else if (layer->note == NULL || layer->status == SOUND_LOAD_STATUS_NOT_LOADED) {
}
else if (layer->note == NULL || layer->status == SOUND_LOAD_STATUS_NOT_LOADED)
{
cmdSemitone = TRUE;
} else if (sameSound == FALSE) {
}
else if (sameSound == FALSE)
{
seq_channel_layer_note_decay(layer);
cmdSemitone = TRUE;
} else if (layer->sound == NULL) {
}
else if (layer->sound == NULL)
{
init_synthetic_wave(layer->note, layer);
}
if (cmdSemitone != FALSE) {
if (cmdSemitone != FALSE)
{
(*layer).note = alloc_note(layer);
}
if (layer->note != NULL && layer->note->parentLayer == layer) {
if (layer->note != NULL && layer->note->parentLayer == layer)
{
note_vibrato_init(layer->note);
}
}
+32 -16
View File
@@ -18,22 +18,38 @@ struct ReverbSettingsEU sReverbSettings[] = {
{0x04, 0x0a, 0x37ff}
};
struct AudioSessionSettingsEU gAudioSessionPresets[] = {
{ 0x00007d00, 0x01, 0x10, 0x01, 0x00, &sReverbSettings[0], 0x7fff, 0x0000, 0x00003a40, 0x00006d00,
0x00004400, 0x00002a00 },
{ 0x00007d00, 0x01, 0x10, 0x01, 0x00, &sReverbSettings[1], 0x7fff, 0x0000, 0x00003a40, 0x00006d00,
0x00004400, 0x00002a00 },
{ 0x00007d00, 0x01, 0x10, 0x01, 0x00, &sReverbSettings[2], 0x7fff, 0x0000, 0x00003a40, 0x00006d00,
0x00004400, 0x00002a00 },
{ 0x00007d00, 0x01, 0x10, 0x01, 0x00, &sReverbSettings[3], 0x7fff, 0x0000, 0x00003a40, 0x00006d00,
0x00004400, 0x00002a00 },
{ 0x00007d00, 0x01, 0x10, 0x01, 0x00, &sReverbSettings[4], 0x7fff, 0x0000, 0x00003a40, 0x00006d00,
0x00004400, 0x00002a00 },
{ 0x00007d00, 0x01, 0x10, 0x01, 0x00, &sReverbSettings[0], 0x7fff, 0x0000, 0x00004000, 0x00006e00,
0x00003f00, 0x00002a00 },
{ 0x00007d00, 0x01, 0x10, 0x01, 0x00, &sReverbSettings[1], 0x7fff, 0x0000, 0x00004100, 0x00006e00,
0x00004400, 0x00002a80 },
{ 0x00007d00, 0x01, 0x14, 0x01, 0x00, &sReverbSettings[5], 0x7fff, 0x0000, 0x00003500, 0x00006280,
0x00004000, 0x00001b00 }
{
0x00007d00, 0x01, 0x10, 0x01, 0x00, &sReverbSettings[0], 0x7fff, 0x0000, 0x00003a40, 0x00006d00,
0x00004400, 0x00002a00
},
{
0x00007d00, 0x01, 0x10, 0x01, 0x00, &sReverbSettings[1], 0x7fff, 0x0000, 0x00003a40, 0x00006d00,
0x00004400, 0x00002a00
},
{
0x00007d00, 0x01, 0x10, 0x01, 0x00, &sReverbSettings[2], 0x7fff, 0x0000, 0x00003a40, 0x00006d00,
0x00004400, 0x00002a00
},
{
0x00007d00, 0x01, 0x10, 0x01, 0x00, &sReverbSettings[3], 0x7fff, 0x0000, 0x00003a40, 0x00006d00,
0x00004400, 0x00002a00
},
{
0x00007d00, 0x01, 0x10, 0x01, 0x00, &sReverbSettings[4], 0x7fff, 0x0000, 0x00003a40, 0x00006d00,
0x00004400, 0x00002a00
},
{
0x00007d00, 0x01, 0x10, 0x01, 0x00, &sReverbSettings[0], 0x7fff, 0x0000, 0x00004000, 0x00006e00,
0x00003f00, 0x00002a00
},
{
0x00007d00, 0x01, 0x10, 0x01, 0x00, &sReverbSettings[1], 0x7fff, 0x0000, 0x00004100, 0x00006e00,
0x00004400, 0x00002a80
},
{
0x00007d00, 0x01, 0x14, 0x01, 0x00, &sReverbSettings[5], 0x7fff, 0x0000, 0x00003500, 0x00006280,
0x00004000, 0x00001b00
}
};
#endif
+163 -90
View File
@@ -14,13 +14,16 @@
f32 gTrackVolume = 1.0f;
#if defined(VERSION_EU) || defined(VERSION_SH)
void sequence_channel_process_sound(struct SequenceChannel *seqChannel, s32 recalculateVolume) {
void sequence_channel_process_sound(struct SequenceChannel *seqChannel, s32 recalculateVolume)
{
f32 channelVolume;
s32 i;
if (seqChannel->changes.as_bitfields.volume || recalculateVolume) {
if (seqChannel->changes.as_bitfields.volume || recalculateVolume)
{
channelVolume = seqChannel->volume * seqChannel->volumeScale * seqChannel->seqPlayer->appliedFadeVolume;
if (seqChannel->seqPlayer->muted && (seqChannel->muteBehavior & MUTE_BEHAVIOR_SOFTEN) != 0) {
if (seqChannel->seqPlayer->muted && (seqChannel->muteBehavior & MUTE_BEHAVIOR_SOFTEN) != 0)
{
channelVolume = seqChannel->seqPlayer->muteVolumeScale * channelVolume;
}
#ifdef VERSION_SH
@@ -58,55 +61,59 @@ void sequence_channel_process_sound(struct SequenceChannel *seqChannel, s32 reca
seqChannel->changes.as_u8=0;
}
#else
static void sequence_channel_process_sound(struct SequenceChannel *seqChannel) {
f32 channelVolume;
f32 panLayerWeight;
f32 panFromChannel;
s32 i;
channelVolume = seqChannel->volume * seqChannel->volumeScale * seqChannel->seqPlayer->fadeVolume;
if (seqChannel->seqPlayer->muted && (seqChannel->muteBehavior & MUTE_BEHAVIOR_SOFTEN) != 0) {
static void sequence_channel_process_sound(struct SequenceChannel *seqChannel)
{
f32 channelVolume = seqChannel->volume * seqChannel->volumeScale * seqChannel->seqPlayer->fadeVolume;
if (seqChannel->seqPlayer->muted && (seqChannel->muteBehavior & MUTE_BEHAVIOR_SOFTEN) != 0)
{
channelVolume *= seqChannel->seqPlayer->muteVolumeScale;
}
panFromChannel = seqChannel->pan * seqChannel->panChannelWeight;
panLayerWeight = US_FLOAT(1.0) - seqChannel->panChannelWeight;
f32 panFromChannel = seqChannel->pan * seqChannel->panChannelWeight;
f32 panLayerWeight = US_FLOAT(1.0) - seqChannel->panChannelWeight;
for (i = 0; i < 4; i++) {
for (s32 i = 0; i < 4; i++)
{
struct SequenceChannelLayer *layer = seqChannel->layers[i];
if (layer != NULL && layer->enabled && layer->note != NULL) {
if (layer != NULL && layer->enabled && layer->note != NULL)
{
layer->noteFreqScale = layer->freqScale * seqChannel->freqScale;
layer->noteVelocity = layer->velocitySquare * (channelVolume * gTrackVolume);
layer->notePan = (layer->pan * panLayerWeight) + panFromChannel;
layer->notePan = layer->pan * panLayerWeight + panFromChannel;
}
}
}
#endif
void sequence_player_process_sound(struct SequencePlayer *seqPlayer) {
s32 i;
if (seqPlayer->fadeRemainingFrames != 0) {
void sequence_player_process_sound(struct SequencePlayer *seqPlayer)
{
if (seqPlayer->fadeRemainingFrames != 0)
{
seqPlayer->fadeVolume += seqPlayer->fadeVelocity;
#if defined(VERSION_EU) || defined(VERSION_SH)
seqPlayer->recalculateVolume = TRUE;
#endif
if (seqPlayer->fadeVolume > US_FLOAT2(1)) {
if (seqPlayer->fadeVolume > US_FLOAT2(1))
{
seqPlayer->fadeVolume = US_FLOAT2(1);
}
if (seqPlayer->fadeVolume < 0) {
if (seqPlayer->fadeVolume < 0)
{
seqPlayer->fadeVolume = 0;
}
if (--seqPlayer->fadeRemainingFrames == 0) {
if (--seqPlayer->fadeRemainingFrames == 0)
{
#if defined(VERSION_EU) || defined(VERSION_SH)
if (seqPlayer->state == 2) {
if (seqPlayer->state == 2)
{
sequence_player_disable(seqPlayer);
return;
}
#else
switch (seqPlayer->state) {
switch (seqPlayer->state)
{
case SEQUENCE_PLAYER_STATE_FADE_OUT:
sequence_player_disable(seqPlayer);
return;
@@ -124,15 +131,18 @@ void sequence_player_process_sound(struct SequencePlayer *seqPlayer) {
}
#if defined(VERSION_EU) || defined(VERSION_SH)
if (seqPlayer->recalculateVolume) {
if (seqPlayer->recalculateVolume)
{
seqPlayer->appliedFadeVolume = seqPlayer->fadeVolume * seqPlayer->fadeVolumeScale;
}
#endif
// Process channels
for (i = 0; i < CHANNELS_MAX; i++) {
for (s32 i = 0; i < CHANNELS_MAX; i++)
{
if (IS_SEQUENCE_CHANNEL_VALID(seqPlayer->channels[i]) == TRUE
&& seqPlayer->channels[i]->enabled == TRUE) {
&& seqPlayer->channels[i]->enabled == TRUE)
{
#if defined(VERSION_EU) || defined(VERSION_SH)
sequence_channel_process_sound(seqPlayer->channels[i], seqPlayer->recalculateVolume);
#else
@@ -146,11 +156,13 @@ void sequence_player_process_sound(struct SequencePlayer *seqPlayer) {
#endif
}
f32 get_portamento_freq_scale(struct Portamento *p) {
f32 get_portamento_freq_scale(struct Portamento *p)
{
u32 v0;
f32 result;
#if defined(VERSION_JP) || defined(VERSION_US)
if (p->mode == 0) {
if (p->mode == 0)
{
return 1.0f;
}
#endif
@@ -176,20 +188,22 @@ f32 get_portamento_freq_scale(struct Portamento *p) {
}
#if defined(VERSION_EU) || defined(VERSION_SH)
s16 get_vibrato_pitch_change(struct VibratoState *vib) {
s16 get_vibrato_pitch_change(struct VibratoState *vib)
{
s32 index;
vib->time += (s32)vib->rate;
index = (vib->time >> 10) & 0x3F;
return vib->curve[index] >> 8;
}
#else
s8 get_vibrato_pitch_change(struct VibratoState *vib) {
s32 index;
s8 get_vibrato_pitch_change(struct VibratoState *vib)
{
vib->time += vib->rate;
index = (vib->time >> 10) & 0x3F;
s32 index = vib->time >> 10 & 0x3F;
switch (index & 0x30) {
switch (index & 0x30)
{
case 0x10:
index = 31 - index;
@@ -209,51 +223,66 @@ s8 get_vibrato_pitch_change(struct VibratoState *vib) {
}
#endif
f32 get_vibrato_freq_scale(struct VibratoState *vib) {
s32 pitchChange;
f32 extent;
f32 get_vibrato_freq_scale(struct VibratoState *vib)
{
f32 result;
if (vib->delay != 0) {
if (vib->delay != 0)
{
vib->delay--;
return 1;
}
if (vib->extentChangeTimer) {
if (vib->extentChangeTimer == 1) {
if (vib->extentChangeTimer)
{
if (vib->extentChangeTimer == 1)
{
vib->extent = (s32)vib->seqChannel->vibratoExtentTarget;
} else {
}
else
{
vib->extent +=
((s32)vib->seqChannel->vibratoExtentTarget - vib->extent) / (s32)vib->extentChangeTimer;
}
vib->extentChangeTimer--;
} else if (vib->seqChannel->vibratoExtentTarget != (s32) vib->extent) {
if ((vib->extentChangeTimer = vib->seqChannel->vibratoExtentChangeDelay) == 0) {
}
else if (vib->seqChannel->vibratoExtentTarget != (s32)vib->extent)
{
if ((vib->extentChangeTimer = vib->seqChannel->vibratoExtentChangeDelay) == 0)
{
vib->extent = (s32)vib->seqChannel->vibratoExtentTarget;
}
}
if (vib->rateChangeTimer) {
if (vib->rateChangeTimer == 1) {
if (vib->rateChangeTimer)
{
if (vib->rateChangeTimer == 1)
{
vib->rate = (s32)vib->seqChannel->vibratoRateTarget;
} else {
}
else
{
vib->rate += ((s32)vib->seqChannel->vibratoRateTarget - vib->rate) / (s32)vib->rateChangeTimer;
}
vib->rateChangeTimer--;
} else if (vib->seqChannel->vibratoRateTarget != (s32) vib->rate) {
if ((vib->rateChangeTimer = vib->seqChannel->vibratoRateChangeDelay) == 0) {
}
else if (vib->seqChannel->vibratoRateTarget != (s32)vib->rate)
{
if ((vib->rateChangeTimer = vib->seqChannel->vibratoRateChangeDelay) == 0)
{
vib->rate = (s32)vib->seqChannel->vibratoRateTarget;
}
}
if (vib->extent == 0) {
if (vib->extent == 0)
{
return 1.0f;
}
pitchChange = get_vibrato_pitch_change(vib);
extent = (f32) vib->extent / US_FLOAT(4096.0);
s32 pitchChange = get_vibrato_pitch_change(vib);
f32 extent = (f32)vib->extent / US_FLOAT(4096.0);
#if defined(VERSION_EU) || defined(VERSION_SH)
result = US_FLOAT(1.0) + extent * (gPitchBendFrequencyScale[pitchChange + 128] - US_FLOAT(1.0));
@@ -263,27 +292,34 @@ f32 get_vibrato_freq_scale(struct VibratoState *vib) {
return result;
}
void note_vibrato_update(struct Note *note) {
void note_vibrato_update(struct Note *note)
{
#if defined(VERSION_EU) || defined(VERSION_SH)
if (note->portamento.mode != 0) {
if (note->portamento.mode != 0)
{
note->portamentoFreqScale = get_portamento_freq_scale(&note->portamento);
}
if (note->vibratoState.active && note->parentLayer != NO_LAYER) {
if (note->vibratoState.active && note->parentLayer != NO_LAYER)
{
note->vibratoFreqScale = get_vibrato_freq_scale(&note->vibratoState);
}
#else
if (note->vibratoState.active) {
if (note->vibratoState.active)
{
note->portamentoFreqScale = get_portamento_freq_scale(&note->portamento);
if (note->parentLayer != NO_LAYER) {
if (note->parentLayer != NO_LAYER)
{
note->vibratoFreqScale = get_vibrato_freq_scale(&note->vibratoState);
}
}
#endif
}
void note_vibrato_init(struct Note *note) {
void note_vibrato_init(struct Note *note)
{
struct VibratoState *vib;
UNUSED struct SequenceChannel *seqChannel;
UNUSED
struct SequenceChannel *seqChannel;
#if defined(VERSION_EU) || defined(VERSION_SH)
struct NotePlaybackState *seqPlayerState = (struct NotePlaybackState *)&note->priority;
#endif
@@ -296,7 +332,8 @@ void note_vibrato_init(struct Note *note) {
#if defined(VERSION_JP) || defined(VERSION_US)
if (note->parentLayer->seqChannel->vibratoExtentStart == 0
&& note->parentLayer->seqChannel->vibratoExtentTarget == 0
&& note->parentLayer->portamento.mode == 0) {
&& note->parentLayer->portamento.mode == 0)
{
vib->active = FALSE;
return;
}
@@ -308,15 +345,21 @@ void note_vibrato_init(struct Note *note) {
#if defined(VERSION_EU) || defined(VERSION_SH)
vib->curve = gWaveSamples[2];
vib->seqChannel = note->parentLayer->seqChannel;
if ((vib->extentChangeTimer = vib->seqChannel->vibratoExtentChangeDelay) == 0) {
if ((vib->extentChangeTimer = vib->seqChannel->vibratoExtentChangeDelay) == 0)
{
vib->extent = FLOAT_CAST(vib->seqChannel->vibratoExtentTarget);
} else {
}
else
{
vib->extent = FLOAT_CAST(vib->seqChannel->vibratoExtentStart);
}
if ((vib->rateChangeTimer = vib->seqChannel->vibratoRateChangeDelay) == 0) {
if ((vib->rateChangeTimer = vib->seqChannel->vibratoRateChangeDelay) == 0)
{
vib->rate = FLOAT_CAST(vib->seqChannel->vibratoRateTarget);
} else {
}
else
{
vib->rate = FLOAT_CAST(vib->seqChannel->vibratoRateStart);
}
vib->delay = vib->seqChannel->vibratoDelay;
@@ -327,15 +370,21 @@ void note_vibrato_init(struct Note *note) {
vib->seqChannel = note->parentLayer->seqChannel;
seqChannel = vib->seqChannel;
if ((vib->extentChangeTimer = seqChannel->vibratoExtentChangeDelay) == 0) {
if ((vib->extentChangeTimer = seqChannel->vibratoExtentChangeDelay) == 0)
{
vib->extent = seqChannel->vibratoExtentTarget;
} else {
}
else
{
vib->extent = seqChannel->vibratoExtentStart;
}
if ((vib->rateChangeTimer = seqChannel->vibratoRateChangeDelay) == 0) {
if ((vib->rateChangeTimer = seqChannel->vibratoRateChangeDelay) == 0)
{
vib->rate = seqChannel->vibratoRateTarget;
} else {
}
else
{
vib->rate = seqChannel->vibratoRateStart;
}
vib->delay = seqChannel->vibratoDelay;
@@ -344,7 +393,8 @@ void note_vibrato_init(struct Note *note) {
#endif
}
void adsr_init(struct AdsrState *adsr, struct AdsrEnvelope *envelope, UNUSED s16 *volOut) {
void adsr_init(struct AdsrState *adsr, struct AdsrEnvelope *envelope, UNUSED s16 *volOut)
{
adsr->action = 0;
adsr->state = ADSR_STATE_DISABLED;
#if defined(VERSION_EU) || defined(VERSION_SH)
@@ -364,26 +414,33 @@ void adsr_init(struct AdsrState *adsr, struct AdsrEnvelope *envelope, UNUSED s16
}
#if defined(VERSION_EU) || defined(VERSION_SH)
f32 adsr_update(struct AdsrState *adsr) {
f32 adsr_update(struct AdsrState *adsr)
{
#else
s32 adsr_update(struct AdsrState *adsr) {
s32 adsr_update(struct AdsrState *adsr)
{
#endif
u8 action = adsr->action;
#if defined(VERSION_EU) || defined(VERSION_SH)
u8 state = adsr->state;
switch (state) {
#else
switch (adsr->state) {
switch (adsr->state)
{
#endif
case ADSR_STATE_DISABLED:
return 0;
case ADSR_STATE_INITIAL: {
case ADSR_STATE_INITIAL:
{
#if defined(VERSION_JP) || defined(VERSION_US)
adsr->current = adsr->initial;
adsr->target = adsr->initial;
#endif
if (action & ADSR_ACTION_HANG) {
if (action & ADSR_ACTION_HANG)
{
adsr->state = ADSR_STATE_HANG;
break;
}
@@ -403,7 +460,8 @@ s32 adsr_update(struct AdsrState *adsr) {
#endif
case ADSR_STATE_LOOP:
adsr->delay = BSWAP16(adsr->envelope[adsr->envIndex].delay);
switch (adsr->delay) {
switch (adsr->delay)
{
case ADSR_DISABLE:
adsr->state = ADSR_STATE_DISABLED;
break;
@@ -423,7 +481,8 @@ s32 adsr_update(struct AdsrState *adsr) {
default:
#if defined(VERSION_EU) || defined(VERSION_SH)
if (adsr->delay >= 4) {
if (adsr->delay >= 4)
{
adsr->delay = adsr->delay * gAudioBufferParameters.updatesPerFrame
#ifdef VERSION_SH
/ gAudioBufferParameters.presetUnk4
@@ -431,7 +490,8 @@ s32 adsr_update(struct AdsrState *adsr) {
/ 4;
}
#if defined(VERSION_SH)
if (adsr->delay == 0) {
if (adsr->delay == 0)
{
adsr->delay = 1;
}
adsr->target = (f32)BSWAP16(adsr->envelope[adsr->envIndex].arg) / 32767.0f;
@@ -448,7 +508,8 @@ s32 adsr_update(struct AdsrState *adsr) {
adsr->envIndex++;
break;
}
if (adsr->state != ADSR_STATE_FADE) {
if (adsr->state != ADSR_STATE_FADE)
{
break;
}
// fallthrough
@@ -460,7 +521,8 @@ s32 adsr_update(struct AdsrState *adsr) {
adsr->currentHiRes += adsr->velocity;
adsr->current = adsr->currentHiRes >> 0x10;
#endif
if (--adsr->delay <= 0) {
if (--adsr->delay <= 0)
{
adsr->state = ADSR_STATE_LOOP;
}
// fallthrough
@@ -469,14 +531,17 @@ s32 adsr_update(struct AdsrState *adsr) {
break;
case ADSR_STATE_DECAY:
case ADSR_STATE_RELEASE: {
case ADSR_STATE_RELEASE:
{
adsr->current -= adsr->fadeOutVel;
#if defined(VERSION_EU) || defined(VERSION_SH)
if (adsr->sustain != 0.0f && state == ADSR_STATE_DECAY) {
#else
if (adsr->sustain != 0 && adsr->state == ADSR_STATE_DECAY) {
if (adsr->sustain != 0 && adsr->state == ADSR_STATE_DECAY)
{
#endif
if (adsr->current < adsr->sustain) {
if (adsr->current < adsr->sustain)
{
adsr->current = adsr->sustain;
#if defined(VERSION_EU) || defined(VERSION_SH)
adsr->delay = 128;
@@ -489,17 +554,20 @@ s32 adsr_update(struct AdsrState *adsr) {
}
#if defined(VERSION_SH)
if (adsr->current < 0.00001f) {
if (adsr->current < 0.00001f)
{
adsr->current = 0.0f;
adsr->state = ADSR_STATE_DISABLED;
}
#elif defined(VERSION_EU)
if (adsr->current < 0) {
if (adsr->current < 0)
{
adsr->current = 0.0f;
adsr->state = ADSR_STATE_DISABLED;
}
#else
if (adsr->current < 100) {
if (adsr->current < 100)
{
adsr->current = 0;
adsr->state = ADSR_STATE_DISABLED;
}
@@ -509,18 +577,21 @@ s32 adsr_update(struct AdsrState *adsr) {
case ADSR_STATE_SUSTAIN:
adsr->delay -= 1;
if (adsr->delay == 0) {
if (adsr->delay == 0)
{
adsr->state = ADSR_STATE_RELEASE;
}
break;
}
if ((action & ADSR_ACTION_DECAY)) {
if (action & ADSR_ACTION_DECAY)
{
adsr->state = ADSR_STATE_DECAY;
adsr->action = action & ~ADSR_ACTION_DECAY;
}
if ((action & ADSR_ACTION_RELEASE)) {
if (action & ADSR_ACTION_RELEASE)
{
adsr->state = ADSR_STATE_RELEASE;
#if defined(VERSION_EU) || defined(VERSION_SH)
adsr->action = action & ~ADSR_ACTION_RELEASE;
@@ -530,10 +601,12 @@ s32 adsr_update(struct AdsrState *adsr) {
}
#if defined(VERSION_EU) || defined(VERSION_SH)
if (adsr->current < 0.0f) {
if (adsr->current < 0.0f)
{
return 0.0f;
}
if (adsr->current > 1.0f) {
if (adsr->current > 1.0f)
{
eu_stubbed_printf_1("Audio:Envp: overflow %f\n", adsr->current);
return 1.0f;
}
+3
View File
@@ -36,8 +36,11 @@
extern f32 gTrackVolume;
void sequence_player_process_sound(struct SequencePlayer *seqPlayer);
void note_vibrato_update(struct Note *note);
void note_vibrato_init(struct Note *note);
void adsr_init(struct AdsrState *adsr, struct AdsrEnvelope *envelope, s16 *volOut);
#if defined(VERSION_EU) || defined(VERSION_SH)
f32 adsr_update(struct AdsrState *adsr);
File diff suppressed because it is too large Load Diff
+36 -1
View File
@@ -24,7 +24,8 @@ extern u32 gAudioRandom;
extern f32 gAudioVolume;
extern u8 gAudioReverb;
struct Sound {
struct Sound
{
s32 soundBits;
f32 *position;
}; // size = 0x8
@@ -35,39 +36,73 @@ extern u8 sSoundRequestCount;
extern u8 gAudioSPTaskYieldBuffer[]; // ucode yield data ptr; only used in JP
struct SPTask *create_next_audio_frame_task(void);
void create_next_audio_buffer(s16 *samples, u32 num_samples);
void audio_signal_game_loop_tick(void);
void update_game_sound(void);
void seq_player_fade_out(u8 player, u16 fadeDuration);
void fade_volume_scale(u8 player, u8 targetScale, u16 fadeDuration);
void seq_player_lower_volume(u8 player, u16 fadeDuration, u8 percentage);
void seq_player_unlower_volume(u8 player, u16 fadeDuration);
void set_audio_muted(u8 muted);
void sound_init(void);
void get_currently_playing_sound(u8 bank, u8 *numPlayingSounds, u8 *numSoundsInBank, u8 *soundId);
void stop_sound(u32 soundBits, f32 *pos);
void stop_sounds_from_source(f32 * pos);
void stop_sounds_in_continuous_banks(void);
void sound_banks_disable(u8 player, u16 bankMask);
void sound_banks_enable(u8 player, u16 bankMask);
void set_sound_moving_speed(u8 bank, u8 speed);
void play_dialog_sound(u8 dialogID);
void play_music(u8 player, u16 seqArgs, u16 fadeTimer);
void stop_background_music(u16 seqId);
void fadeout_background_music(u16 arg0, u16 fadeOut);
void drop_queued_background_music(void);
u16 get_current_background_music(void);
void play_secondary_music(u8 seqId, u8 bgMusicVolume, u8 volume, u16 fadeTimer);
void func_80321080(u16 fadeTimer);
void func_803210D4(u16 fadeOutTime);
void play_course_clear(void);
void play_peachs_jingle(void);
void play_puzzle_jingle(void);
void play_star_fanfare(void);
void play_power_star_jingle(u8 arg0);
void play_race_fanfare(void);
void play_toads_jingle(void);
void sound_reset(u8 presetId);
void audio_set_sound_mode(u8 arg0);
void audio_init(void); // in load.c
+581 -294
View File
File diff suppressed because it is too large Load Diff
+32 -14
View File
@@ -23,7 +23,8 @@ struct SoundAllocPool
s32 numAllocatedEntries;
}; // size = 0x10
struct SeqOrBankEntry {
struct SeqOrBankEntry
{
u8 *ptr;
u32 size;
#ifdef VERSION_SH
@@ -36,21 +37,27 @@ struct SeqOrBankEntry {
struct PersistentPool
{
/*0x00*/ u32 numEntries;
/*0x04*/ struct SoundAllocPool pool;
/*0x14*/ struct SeqOrBankEntry entries[32];
/*0x00*/
u32 numEntries;
/*0x04*/
struct SoundAllocPool pool;
/*0x14*/
struct SeqOrBankEntry entries[32];
}; // size = 0x194
struct TemporaryPool
{
/*EU, SH*/
/*0x00, 0x00*/ u32 nextSide;
/*0x04, */ struct SoundAllocPool pool;
/*0x00, 0x00*/
u32 nextSide;
/*0x04, */
struct SoundAllocPool pool;
/*0x04, pool.start */
/*0x08, pool.cur */
/*0x0C, 0x0C pool.size */
/*0x10, 0x10 pool.numAllocatedEntries */
/*0x14, */ struct SeqOrBankEntry entries[2];
/*0x14, */
struct SeqOrBankEntry entries[2];
/*0x14, 0x14 entries[0].ptr */
/*0x18, entries[0].size*/
/*0x1C, 0x1E entries[0].id */
@@ -61,9 +68,12 @@ struct TemporaryPool
struct SoundMultiPool
{
/*0x000*/ struct PersistentPool persistent;
/*0x194*/ struct TemporaryPool temporary;
/* */ u32 pad2[4];
/*0x000*/
struct PersistentPool persistent;
/*0x194*/
struct TemporaryPool temporary;
/* */
u32 pad2[4];
}; // size = 0x1D0
struct Unk1Pool
@@ -85,10 +95,14 @@ struct UnkEntry
struct UnkPool
{
/*0x00*/ struct SoundAllocPool pool;
/*0x10*/ struct UnkEntry entries[64];
/*0x510*/ s32 numEntries;
/*0x514*/ u32 unk514;
/*0x00*/
struct SoundAllocPool pool;
/*0x10*/
struct UnkEntry entries[64];
/*0x510*/
s32 numEntries;
/*0x514*/
u32 unk514;
};
extern u8 gAudioHeap[];
@@ -115,14 +129,18 @@ extern volatile u8 gAudioResetStatus;
#endif
void *soundAlloc(struct SoundAllocPool *pool, u32 size);
void *sound_alloc_uninitialized(struct SoundAllocPool *pool, u32 size);
void sound_init_main_pools(s32 sizeForAudioInitPool);
void sound_alloc_pool_init(struct SoundAllocPool *pool, void *memAddr, u32 size);
#ifdef VERSION_SH
void *alloc_bank_or_seq(s32 poolIdx, s32 size, s32 arg3, s32 id);
void *get_bank_or_seq(s32 poolIdx, s32 arg1, s32 id);
#else
void *alloc_bank_or_seq(struct SoundMultiPool *arg0, s32 arg1, s32 size, s32 arg3, s32 id);
void *get_bank_or_seq(struct SoundMultiPool *arg0, s32 arg1, s32 id);
#endif
#if defined(VERSION_EU) || defined(VERSION_SH)
File diff suppressed because it is too large Load Diff
+266 -164
View File
@@ -11,14 +11,22 @@
#define ALIGN16(val) (((val) + 0xF) & ~0xF)
struct SharedDma {
/*0x0*/ u8 *buffer; // target, points to pre-allocated buffer
/*0x4*/ uintptr_t source; // device address
/*0x8*/ u16 sizeUnused; // set to bufSize, never read
/*0xA*/ u16 bufSize; // size of buffer
/*0xC*/ u8 unused2; // set to 0, never read
/*0xD*/ u8 reuseIndex; // position in sSampleDmaReuseQueue1/2, if ttl == 0
/*0xE*/ u8 ttl; // duration after which the DMA can be discarded
struct SharedDma
{
/*0x0*/
u8 *buffer; // target, points to pre-allocated buffer
/*0x4*/
uintptr_t source; // device address
/*0x8*/
u16 sizeUnused; // set to bufSize, never read
/*0xA*/
u16 bufSize; // size of buffer
/*0xC*/
u8 unused2; // set to 0, never read
/*0xD*/
u8 reuseIndex; // position in sSampleDmaReuseQueue1/2, if ttl == 0
/*0xE*/
u8 ttl; // duration after which the DMA can be discarded
}; // size = 0x10
// EU only
@@ -110,7 +118,8 @@ ALSeqFile *get_audio_file_header(s32 arg0);
/**
* Performs an immediate DMA copy
*/
void audio_dma_copy_immediate(uintptr_t devAddr, void *vAddr, size_t nbytes) {
void audio_dma_copy_immediate(uintptr_t devAddr, void *vAddr, size_t nbytes)
{
DEBUG_PRINT("audio_dma_copy_immediate()");
DEBUG_PRINT("- dev addr: %x", devAddr);
DEBUG_PRINT("- vAddr: %x", vAddr);
@@ -148,7 +157,8 @@ u8 audioString49[] = "BANK LOAD MISS! FOR %d\n";
/**
* Performs an asynchronus (normal priority) DMA copy
*/
void audio_dma_copy_async(uintptr_t devAddr, void *vAddr, size_t nbytes, OSMesgQueue *queue, OSIoMesg *mesg) {
void audio_dma_copy_async(uintptr_t devAddr, void *vAddr, size_t nbytes, OSMesgQueue *queue, OSIoMesg *mesg)
{
osInvalDCache(vAddr, nbytes);
osPiStartDma(mesg, OS_MESG_PRI_NORMAL, OS_READ, devAddr, vAddr, nbytes, queue);
}
@@ -157,11 +167,12 @@ void audio_dma_copy_async(uintptr_t devAddr, void *vAddr, size_t nbytes, OSMesgQ
* Performs a partial asynchronous (normal priority) DMA copy. This is limited
* to 0x1000 bytes transfer at once.
*/
void audio_dma_partial_copy_async(uintptr_t *devAddr, u8 **vAddr, ssize_t *remaining, OSMesgQueue *queue, OSIoMesg *mesg) {
void audio_dma_partial_copy_async(uintptr_t *devAddr, u8 **vAddr, ssize_t *remaining, OSMesgQueue *queue, OSIoMesg *mesg)
{
#if defined(VERSION_EU)
ssize_t transfer = (*remaining >= 0x1000 ? 0x1000 : *remaining);
#else
ssize_t transfer = (*remaining < 0x1000 ? *remaining : 0x1000);
ssize_t transfer = *remaining < 0x1000 ? *remaining : 0x1000;
#endif
*remaining -= transfer;
osInvalDCache(*vAddr, transfer);
@@ -170,33 +181,40 @@ void audio_dma_partial_copy_async(uintptr_t *devAddr, u8 **vAddr, ssize_t *remai
*vAddr += transfer;
}
void decrease_sample_dma_ttls() {
void decrease_sample_dma_ttls()
{
u32 i;
for (i = 0; i < sSampleDmaListSize1; i++) {
for (i = 0; i < sSampleDmaListSize1; i++)
{
#if defined(VERSION_EU)
struct SharedDma *temp = &sSampleDmas[i];
#else
struct SharedDma *temp = sSampleDmas + i;
#endif
if (temp->ttl != 0) {
if (temp->ttl != 0)
{
temp->ttl--;
if (temp->ttl == 0) {
if (temp->ttl == 0)
{
temp->reuseIndex = sSampleDmaReuseQueueHead1;
sSampleDmaReuseQueue1[sSampleDmaReuseQueueHead1++] = (u8)i;
}
}
}
for (i = sSampleDmaListSize1; i < gSampleDmaNumListItems; i++) {
for (i = sSampleDmaListSize1; i < gSampleDmaNumListItems; i++)
{
#if defined(VERSION_EU)
struct SharedDma *temp = &sSampleDmas[i];
#else
struct SharedDma *temp = sSampleDmas + i;
#endif
if (temp->ttl != 0) {
if (temp->ttl != 0)
{
temp->ttl--;
if (temp->ttl == 0) {
if (temp->ttl == 0)
{
temp->reuseIndex = sSampleDmaReuseQueueHead2;
sSampleDmaReuseQueue2[sSampleDmaReuseQueueHead2++] = (u8)i;
}
@@ -206,30 +224,33 @@ void decrease_sample_dma_ttls() {
sUnused80226B40 = 0;
}
void *dma_sample_data(uintptr_t devAddr, u32 size, s32 arg2, u8 *dmaIndexRef) {
void *dma_sample_data(uintptr_t devAddr, u32 size, s32 arg2, u8 *dmaIndexRef)
{
s32 hasDma = FALSE;
struct SharedDma *dma;
uintptr_t dmaDevAddr;
u32 transfer;
u32 i;
u32 dmaIndex;
ssize_t bufferPos;
UNUSED u32 pad;
if (arg2 != 0 || *dmaIndexRef >= sSampleDmaListSize1) {
for (i = sSampleDmaListSize1; i < gSampleDmaNumListItems; i++) {
if (arg2 != 0 || *dmaIndexRef >= sSampleDmaListSize1)
{
for (u32 i = sSampleDmaListSize1; i < gSampleDmaNumListItems; i++)
{
#if defined(VERSION_EU)
dma = &sSampleDmas[i];
#else
dma = sSampleDmas + i;
#endif
bufferPos = devAddr - dma->source;
if (0 <= bufferPos && (size_t) bufferPos <= dma->bufSize - size) {
if (0 <= bufferPos && (size_t)bufferPos <= dma->bufSize - size)
{
// We already have a DMA request for this memory range.
if (dma->ttl == 0 && sSampleDmaReuseQueueTail2 != sSampleDmaReuseQueueHead2) {
if (dma->ttl == 0 && sSampleDmaReuseQueueTail2 != sSampleDmaReuseQueueHead2)
{
// Move the DMA out of the reuse queue, by swapping it with the
// tail, and then incrementing the tail.
if (dma->reuseIndex != sSampleDmaReuseQueueTail2) {
if (dma->reuseIndex != sSampleDmaReuseQueueTail2)
{
sSampleDmaReuseQueue2[dma->reuseIndex] =
sSampleDmaReuseQueue2[sSampleDmaReuseQueueTail2];
sSampleDmas[sSampleDmaReuseQueue2[sSampleDmaReuseQueueTail2]].reuseIndex =
@@ -242,12 +263,13 @@ void *dma_sample_data(uintptr_t devAddr, u32 size, s32 arg2, u8 *dmaIndexRef) {
#if defined(VERSION_EU)
return &dma->buffer[(devAddr - dma->source)];
#else
return (devAddr - dma->source) + dma->buffer;
return devAddr - dma->source + dma->buffer;
#endif
}
}
if (sSampleDmaReuseQueueTail2 != sSampleDmaReuseQueueHead2 && arg2 != 0) {
if (sSampleDmaReuseQueueTail2 != sSampleDmaReuseQueueHead2 && arg2 != 0)
{
// Allocate a DMA from reuse queue 2. This queue can be empty, since
// TTL 60 is pretty large.
dmaIndex = sSampleDmaReuseQueue2[sSampleDmaReuseQueueTail2];
@@ -255,7 +277,9 @@ void *dma_sample_data(uintptr_t devAddr, u32 size, s32 arg2, u8 *dmaIndexRef) {
dma = sSampleDmas + dmaIndex;
hasDma = TRUE;
}
} else {
}
else
{
#if defined(VERSION_EU)
dma = sSampleDmas;
dma += *dmaIndexRef;
@@ -263,14 +287,18 @@ void *dma_sample_data(uintptr_t devAddr, u32 size, s32 arg2, u8 *dmaIndexRef) {
dma = sSampleDmas + *dmaIndexRef;
#endif
bufferPos = devAddr - dma->source;
if (0 <= bufferPos && (size_t) bufferPos <= dma->bufSize - size) {
if (0 <= bufferPos && (size_t)bufferPos <= dma->bufSize - size)
{
// We already have DMA for this memory range.
if (dma->ttl == 0) {
if (dma->ttl == 0)
{
// Move the DMA out of the reuse queue, by swapping it with the
// tail, and then incrementing the tail.
if (dma->reuseIndex != sSampleDmaReuseQueueTail1) {
if (dma->reuseIndex != sSampleDmaReuseQueueTail1)
{
#if defined(VERSION_EU)
if (1) {
if (1)
{
}
#endif
sSampleDmaReuseQueue1[dma->reuseIndex] =
@@ -284,12 +312,13 @@ void *dma_sample_data(uintptr_t devAddr, u32 size, s32 arg2, u8 *dmaIndexRef) {
#if defined(VERSION_EU)
return dma->buffer + (devAddr - dma->source);
#else
return (devAddr - dma->source) + dma->buffer;
return devAddr - dma->source + dma->buffer;
#endif
}
}
if (!hasDma) {
if (!hasDma)
{
// Allocate a DMA from reuse queue 1. This queue will hopefully never
// be empty, since TTL 2 is so small.
dmaIndex = sSampleDmaReuseQueue1[sSampleDmaReuseQueueTail1++];
@@ -297,8 +326,8 @@ void *dma_sample_data(uintptr_t devAddr, u32 size, s32 arg2, u8 *dmaIndexRef) {
hasDma = TRUE;
}
transfer = dma->bufSize;
dmaDevAddr = devAddr & ~0xF;
u32 transfer = dma->bufSize;
uintptr_t dmaDevAddr = devAddr & ~0xF;
dma->ttl = 2;
dma->source = dmaDevAddr;
dma->sizeUnused = transfer;
@@ -320,7 +349,8 @@ void *dma_sample_data(uintptr_t devAddr, u32 size, s32 arg2, u8 *dmaIndexRef) {
}
void init_sample_dma_buffers(UNUSED s32 arg0) {
void init_sample_dma_buffers(UNUSED s32 arg0)
{
s32 i;
#if defined(VERSION_EU)
#define j i
@@ -341,7 +371,8 @@ void init_sample_dma_buffers(UNUSED s32 arg0) {
#endif
{
sSampleDmas[gSampleDmaNumListItems].buffer = soundAlloc(&gNotesAndBuffersPool, sDmaBufSize);
if (sSampleDmas[gSampleDmaNumListItems].buffer == NULL) {
if (sSampleDmas[gSampleDmaNumListItems].buffer == NULL)
{
#if defined(VERSION_EU)
break;
#else
@@ -359,12 +390,14 @@ void init_sample_dma_buffers(UNUSED s32 arg0) {
out1:
#endif
for (i = 0; (u32) i < gSampleDmaNumListItems; i++) {
for (i = 0; (u32)i < gSampleDmaNumListItems; i++)
{
sSampleDmaReuseQueue1[i] = (u8)i;
sSampleDmas[i].reuseIndex = (u8)i;
}
for (j = gSampleDmaNumListItems; j < 0x100; j++) {
for (j = gSampleDmaNumListItems; j < 0x100; j++)
{
sSampleDmaReuseQueue1[j] = 0;
}
@@ -377,9 +410,11 @@ out1:
#else
sDmaBufSize = 160 * 9;
#endif
for (i = 0; i < gMaxSimultaneousNotes; i++) {
for (i = 0; i < gMaxSimultaneousNotes; i++)
{
sSampleDmas[gSampleDmaNumListItems].buffer = soundAlloc(&gNotesAndBuffersPool, sDmaBufSize);
if (sSampleDmas[gSampleDmaNumListItems].buffer == NULL) {
if (sSampleDmas[gSampleDmaNumListItems].buffer == NULL)
{
#if defined(VERSION_EU)
break;
#else
@@ -397,14 +432,16 @@ out1:
out2:
#endif
for (i = sSampleDmaListSize1; (u32) i < gSampleDmaNumListItems; i++) {
for (i = sSampleDmaListSize1; (u32)i < gSampleDmaNumListItems; i++)
{
sSampleDmaReuseQueue2[i - sSampleDmaListSize1] = (u8)i;
sSampleDmas[i].reuseIndex = (u8)(i - sSampleDmaListSize1);
}
// This probably meant to touch the range size1..size2 as well... but it
// doesn't matter, since these values are never read anyway.
for (j = gSampleDmaNumListItems; j < 0x100; j++) {
for (j = gSampleDmaNumListItems; j < 0x100; j++)
{
sSampleDmaReuseQueue2[j] = sSampleDmaListSize1;
}
@@ -419,29 +456,35 @@ out2:
// This function gets optimized out on US due to being static and never called
UNUSED static
#endif
void patch_sound(UNUSED struct AudioBankSound *sound, UNUSED u8 *memBase, UNUSED u8 *offsetBase) {
struct AudioBankSample *sample;
void patch_sound(UNUSED struct AudioBankSound *sound, UNUSED u8 *memBase, UNUSED u8 *offsetBase)
{
void *patched;
UNUSED u8 *mem; // unused on US
#define PATCH(x, base) (patched = (void *)((uintptr_t) (x) + (uintptr_t) base))
if (sound->sample != NULL) {
sample = sound->sample = PATCH(sound->sample, memBase);
if (sample->loaded == 0) {
if (sound->sample != NULL)
{
struct AudioBankSample *sample = sound->sample = PATCH(sound->sample, memBase);
if (sample->loaded == 0)
{
sample->sampleAddr = PATCH(sample->sampleAddr, offsetBase);
sample->loop = PATCH(sample->loop, memBase);
sample->book = PATCH(sample->book, memBase);
sample->loaded = 1;
}
#if defined(VERSION_EU)
else if (sample->loaded == 0x80) {
else if (sample->loaded == 0x80)
{
PATCH(sample->sampleAddr, offsetBase);
mem = soundAlloc(&gNotesAndBuffersPool, sample->sampleSize);
if (mem == NULL) {
if (mem == NULL)
{
sample->sampleAddr = patched;
sample->loaded = 1;
} else {
}
else
{
audio_dma_copy_immediate((uintptr_t)patched, mem, sample->sampleSize);
sample->loaded = 0x81;
sample->sampleAddr = mem;
@@ -484,12 +527,12 @@ void patch_sound(UNUSED struct AudioBankSound *sound, UNUSED u8 *memBase, UNUSED
#endif
// on US/JP this inlines patch_sound, using some -sopt compiler flag
void patch_audio_bank(struct AudioBank *mem, u8 *offset, u32 numInstruments, u32 numDrums) {
void patch_audio_bank(struct AudioBank *mem, u8 *offset, u32 numInstruments, u32 numDrums)
{
struct Instrument *instrument;
struct Instrument **itInstrs;
struct Instrument **end;
struct AudioBank *temp;
u32 i;
void *patched;
struct Drum *drum;
struct Drum **drums;
@@ -509,21 +552,29 @@ void patch_audio_bank(struct AudioBank *mem, u8 *offset, u32 numInstruments, u32
drums = mem->drums;
#if defined(VERSION_JP) || defined(VERSION_US)
if (drums != NULL && numDrums > 0) {
if (drums != NULL && numDrums > 0)
{
mem->drums = (void *)((uintptr_t)drums + (uintptr_t)mem);
if (numDrums > 0) //! unneeded when -sopt is enabled
for (i = 0; i < numDrums; i++) {
for (u32 i = 0; i < numDrums; i++)
{
#else
numDrums2 = numDrums;
if (drums != NULL && numDrums2 > 0) {
if (drums != NULL && numDrums2 > 0)
{
mem->drums = PATCH(drums, mem);
for (i = 0; i < numDrums2; i++) {
for (i = 0; i < numDrums2; i++)
{
#endif
patched = mem->drums[i];
if (patched != NULL) {
if (patched != NULL)
{
drum = PATCH(patched, mem);
mem->drums[i] = drum;
if (drum->loaded == 0) {
if (drum->loaded == 0)
{
#if defined(VERSION_JP) || defined(VERSION_US)
//! copt replaces drum with 'patched' for these two lines
PATCH_SOUND(&(*(struct Drum *)patched).sound, mem, offset);
@@ -535,7 +586,6 @@ void patch_audio_bank(struct AudioBank *mem, u8 *offset, u32 numInstruments, u32
drum->envelope = BASE_OFFSET(mem, patched);
drum->loaded = 1;
}
}
}
}
@@ -545,23 +595,28 @@ void patch_audio_bank(struct AudioBank *mem, u8 *offset, u32 numInstruments, u32
#if defined(VERSION_JP) || defined(VERSION_US)
if (numInstruments >= 1)
#endif
if (numInstruments > 0) {
if (numInstruments > 0)
{
//! Doesn't affect EU, but required for US/JP
struct Instrument **tempInst;
itInstrs = temp->instruments;
tempInst = temp->instruments;
struct Instrument **tempInst = temp->instruments;
end = numInstruments + tempInst;
#if defined(VERSION_JP) || defined(VERSION_US)
l2:
#else
do {
do
{
#endif
if (*itInstrs != NULL) {
if (*itInstrs != NULL)
{
*itInstrs = BASE_OFFSET(*itInstrs, mem);
instrument = *itInstrs;
if (instrument->loaded == 0) {
if (instrument->loaded == 0)
{
PATCH_SOUND(&instrument->lowNotesSound, (u8 *) mem, offset);
PATCH_SOUND(&instrument->normalNotesSound, (u8 *) mem, offset);
PATCH_SOUND(&instrument->highNotesSound, (u8 *) mem, offset);
@@ -573,11 +628,13 @@ l2:
itInstrs++;
#if defined(VERSION_JP) || defined(VERSION_US)
//! goto generated by copt, required to match US/JP
if (end != itInstrs) {
if (end != itInstrs)
{
goto l2;
}
#else
} while (end != itInstrs);
}
while (end != itInstrs);
#endif
}
#undef PATCH_MEM
@@ -587,28 +644,26 @@ l2:
#undef PATCH_SOUND
}
struct AudioBank *bank_load_immediate(s32 bankId, s32 arg1) {
struct AudioBank *bank_load_immediate(s32 bankId, s32 arg1)
{
DEBUG_PRINT("bank_load_immediate()");
UNUSED u32 pad1[4];
u32 buf[4];
u32 numInstruments, numDrums;
struct AudioBank *ret;
u8 *ctlData;
s32 alloc;
// (This is broken if the length is 1 (mod 16), but that never happens --
// it's always divisible by 4.)
DEBUG_PRINT("- getting alloc");
alloc = gAlCtlHeader->seqArray[bankId].len + 0xf;
s32 alloc = gAlCtlHeader->seqArray[bankId].len + 0xf;
DEBUG_PRINT("- aligning");
alloc = ALIGN16(alloc);
alloc -= 0x10;
DEBUG_PRINT("- getting ctl data for bank %d", bankId);
ctlData = gAlCtlHeader->seqArray[bankId].offset;
u8 *ctlData = gAlCtlHeader->seqArray[bankId].offset;
DEBUG_PRINT("- alloc bank or seq");
ret = alloc_bank_or_seq(&gBankLoadedPool, 1, alloc, arg1, bankId);
if (ret == NULL) {
struct AudioBank *ret = alloc_bank_or_seq(&gBankLoadedPool, 1, alloc, arg1, bankId);
if (ret == NULL)
{
return NULL;
}
@@ -616,8 +671,8 @@ struct AudioBank *bank_load_immediate(s32 bankId, s32 arg1) {
DEBUG_PRINT("- ctlData: %x", ctlData);
audio_dma_copy_immediate((uintptr_t)ctlData, buf, 0x10);
DEBUG_PRINT("- getting nums");
numInstruments = buf[0];
numDrums = buf[1];
u32 numInstruments = buf[0];
u32 numDrums = buf[1];
DEBUG_PRINT("- copying dma immediate 2");
audio_dma_copy_immediate((uintptr_t)(ctlData + 0x10), ret, alloc);
DEBUG_PRINT("- patching bank");
@@ -632,7 +687,8 @@ struct AudioBank *bank_load_immediate(s32 bankId, s32 arg1) {
return ret;
}
struct AudioBank *bank_load_async(s32 bankId, s32 arg1, struct SequencePlayer *seqPlayer) {
struct AudioBank *bank_load_async(s32 bankId, s32 arg1, struct SequencePlayer *seqPlayer)
{
u32 numInstruments, numDrums;
UNUSED u32 pad1[2];
u32 buf[4];
@@ -649,7 +705,8 @@ struct AudioBank *bank_load_async(s32 bankId, s32 arg1, struct SequencePlayer *s
alloc -= 0x10;
ctlData = gAlCtlHeader->seqArray[bankId].offset;
ret = alloc_bank_or_seq(&gBankLoadedPool, 1, alloc, arg1, bankId);
if (ret == NULL) {
if (ret == NULL)
{
return NULL;
}
@@ -665,7 +722,8 @@ struct AudioBank *bank_load_async(s32 bankId, s32 arg1, struct SequencePlayer *s
seqPlayer->bankDmaCurrMemAddr = (u8 *)ret;
seqPlayer->bankDmaCurrDevAddr = (uintptr_t)(ctlData + 0x10);
seqPlayer->bankDmaRemaining = alloc;
if (1) {
if (1)
{
}
#else
seqPlayer->loadingBankNumInstruments = numInstruments;
@@ -687,16 +745,14 @@ struct AudioBank *bank_load_async(s32 bankId, s32 arg1, struct SequencePlayer *s
return ret;
}
void *sequence_dma_immediate(s32 seqId, s32 arg1) {
s32 seqLength;
void *ptr;
u8 *seqData;
seqLength = gSeqFileHeader->seqArray[seqId].len + 0xf;
void *sequence_dma_immediate(s32 seqId, s32 arg1)
{
s32 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) {
u8 *seqData = gSeqFileHeader->seqArray[seqId].offset;
void *ptr = alloc_bank_or_seq(&gSeqLoadedPool, 1, seqLength, arg1, seqId);
if (ptr == NULL)
{
return NULL;
}
@@ -705,31 +761,32 @@ void *sequence_dma_immediate(s32 seqId, s32 arg1) {
return ptr;
}
void *sequence_dma_async(s32 seqId, s32 arg1, struct SequencePlayer *seqPlayer) {
s32 seqLength;
void *ptr;
u8 *seqData;
OSMesgQueue *mesgQueue;
void *sequence_dma_async(s32 seqId, s32 arg1, struct SequencePlayer *seqPlayer)
{
eu_stubbed_printf_1("Seq %d Loading Start\n", seqId);
seqLength = gSeqFileHeader->seqArray[seqId].len + 0xf;
s32 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) {
u8 *seqData = gSeqFileHeader->seqArray[seqId].offset;
void *ptr = alloc_bank_or_seq(&gSeqLoadedPool, 1, seqLength, arg1, seqId);
if (ptr == NULL)
{
eu_stubbed_printf_0("Heap Overflow Error\n");
return NULL;
}
if (seqLength <= 0x40) {
if (seqLength <= 0x40)
{
// Immediately load short sequenece
audio_dma_copy_immediate((uintptr_t)seqData, ptr, seqLength);
if (1) {
if (1)
{
}
gSeqLoadStatus[seqId] = SOUND_LOAD_STATUS_COMPLETE;
} else {
}
else
{
audio_dma_copy_immediate((uintptr_t)seqData, ptr, 0x40);
mesgQueue = &seqPlayer->seqDmaMesgQueue;
OSMesgQueue *mesgQueue = &seqPlayer->seqDmaMesgQueue;
osCreateMesgQueue(mesgQueue, &seqPlayer->seqDmaMesg, 1);
#if defined(VERSION_JP) || defined(VERSION_US)
seqPlayer->seqDmaMesg = NULL;
@@ -742,7 +799,8 @@ void *sequence_dma_async(s32 seqId, s32 arg1, struct SequencePlayer *seqPlayer)
return ptr;
}
u8 get_missing_bank(u32 seqId, s32 *nonNullCount, s32 *nullCount) {
u8 get_missing_bank(u32 seqId, s32 *nonNullCount, s32 *nullCount)
{
void *temp;
u32 bankId;
u16 offset;
@@ -753,29 +811,37 @@ u8 get_missing_bank(u32 seqId, s32 *nonNullCount, s32 *nullCount) {
*nonNullCount = 0;
#if defined(VERSION_EU)
offset = ((u16 *)gAlBankSets)[seqId];
for (i = gAlBankSets[offset++], ret = 0; i != 0; i--) {
for (i = gAlBankSets[offset++], ret = 0; i != 0; i--)
{
bankId = gAlBankSets[offset++];
#else
offset = ((u16 *)gAlBankSets)[seqId] + 1;
for (i = gAlBankSets[offset - 1], ret = 0; i != 0; i--) {
for (i = gAlBankSets[offset - 1], ret = 0; i != 0; i--)
{
offset++;
bankId = gAlBankSets[offset - 1];
#endif
if (IS_BANK_LOAD_COMPLETE(bankId) == TRUE) {
if (IS_BANK_LOAD_COMPLETE(bankId) == TRUE)
{
#if defined(VERSION_EU)
temp = get_bank_or_seq(&gBankLoadedPool, 2, bankId);
#else
temp = get_bank_or_seq(&gBankLoadedPool, 2, gAlBankSets[offset - 1]);
#endif
} else {
}
else
{
temp = NULL;
}
if (temp == NULL) {
if (temp == NULL)
{
(*nullCount)++;
ret = bankId;
} else {
}
else
{
(*nonNullCount)++;
}
}
@@ -783,40 +849,46 @@ u8 get_missing_bank(u32 seqId, s32 *nonNullCount, s32 *nullCount) {
return ret;
}
struct AudioBank *load_banks_immediate(s32 seqId, u8 *outDefaultBank) {
struct AudioBank *load_banks_immediate(s32 seqId, u8 *outDefaultBank)
{
DEBUG_PRINT("load_banks_immediate()");
void *ret;
u32 bankId;
u16 offset;
u8 i;
DEBUG_PRINT("- getting offset");
offset = ((u16 *) gAlBankSets)[seqId];
u16 offset = ((u16 *)gAlBankSets)[seqId];
#ifdef VERSION_EU
for (i = gAlBankSets[offset++]; i != 0; i--) {
for (i = gAlBankSets[offset++]; i != 0; i--)
{
bankId = gAlBankSets[offset++];
#else
offset++;
DEBUG_PRINT("- looping through bank sets");
for (i = gAlBankSets[offset - 1]; i != 0; i--) {
for (i = gAlBankSets[offset - 1]; i != 0; i--)
{
offset++;
DEBUG_PRINT("- getting bank id");
bankId = gAlBankSets[offset - 1];
#endif
DEBUG_PRINT("- checking if bank load is complete");
if (IS_BANK_LOAD_COMPLETE(bankId) == TRUE) {
if (IS_BANK_LOAD_COMPLETE(bankId) == TRUE)
{
#ifdef VERSION_EU
ret = get_bank_or_seq(&gBankLoadedPool, 2, bankId);
#else
DEBUG_PRINT("- getting bank or seq");
ret = get_bank_or_seq(&gBankLoadedPool, 2, gAlBankSets[offset - 1]);
#endif
} else {
}
else
{
ret = NULL;
}
if (ret == NULL) {
if (ret == NULL)
{
DEBUG_PRINT("- bank load immediate");
ret = bank_load_immediate(bankId, 2);
}
@@ -825,33 +897,41 @@ struct AudioBank *load_banks_immediate(s32 seqId, u8 *outDefaultBank) {
return ret;
}
void preload_sequence(u32 seqId, u8 preloadMask) {
void preload_sequence(u32 seqId, u8 preloadMask)
{
DEBUG_PRINT("preload_sequence()");
void *sequenceData;
u8 temp;
if (seqId >= gSequenceCount) {
if (seqId >= gSequenceCount)
{
return;
}
gAudioLoadLock = AUDIO_LOCK_LOADING;
if (preloadMask & PRELOAD_BANKS) {
if (preloadMask & PRELOAD_BANKS)
{
DEBUG_PRINT("- load banks immediate");
load_banks_immediate(seqId, &temp);
}
if (preloadMask & PRELOAD_SEQUENCE) {
if (preloadMask & PRELOAD_SEQUENCE)
{
// @bug should be IS_SEQ_LOAD_COMPLETE
DEBUG_PRINT("- checking if bank load immediate");
if (IS_BANK_LOAD_COMPLETE(seqId) == TRUE) {
if (IS_BANK_LOAD_COMPLETE(seqId) == TRUE)
{
eu_stubbed_printf_1("SEQ %d ALREADY CACHED\n", seqId);
DEBUG_PRINT("- getting bank or seq");
sequenceData = get_bank_or_seq(&gSeqLoadedPool, 2, seqId);
} else {
}
else
{
sequenceData = NULL;
}
DEBUG_PRINT("- checking dma immediate");
if (sequenceData == NULL && sequence_dma_immediate(seqId, 2) == NULL) {
if (sequenceData == NULL && sequence_dma_immediate(seqId, 2) == NULL)
{
gAudioLoadLock = AUDIO_LOCK_NOT_LOADING;
return;
}
@@ -862,46 +942,58 @@ void preload_sequence(u32 seqId, u8 preloadMask) {
void load_sequence_internal(u32 player, u32 seqId, s32 loadAsync);
void load_sequence(u32 player, u32 seqId, s32 loadAsync) {
if (!loadAsync) {
void load_sequence(u32 player, u32 seqId, s32 loadAsync)
{
if (!loadAsync)
{
gAudioLoadLock = AUDIO_LOCK_LOADING;
}
load_sequence_internal(player, seqId, loadAsync);
if (!loadAsync) {
if (!loadAsync)
{
gAudioLoadLock = AUDIO_LOCK_NOT_LOADING;
}
}
void load_sequence_internal(u32 player, u32 seqId, s32 loadAsync) {
void *sequenceData;
void load_sequence_internal(u32 player, u32 seqId, s32 loadAsync)
{
struct SequencePlayer *seqPlayer = &gSequencePlayers[player];
UNUSED u32 padding[2];
if (seqId >= gSequenceCount) {
if (seqId >= gSequenceCount)
{
return;
}
sequence_player_disable(seqPlayer);
if (loadAsync) {
if (loadAsync)
{
s32 numMissingBanks = 0;
s32 dummy = 0;
s32 bankId = get_missing_bank(seqId, &dummy, &numMissingBanks);
if (numMissingBanks == 1) {
if (numMissingBanks == 1)
{
eu_stubbed_printf_0("Ok,one bank slow load Start \n");
if (bank_load_async(bankId, 2, seqPlayer) == NULL) {
if (bank_load_async(bankId, 2, seqPlayer) == NULL)
{
return;
}
// @bug This should set the last bank (i.e. the first in the JSON)
// as default, not the missing one. This code path never gets
// taken, though -- all sequence loading is synchronous.
seqPlayer->defaultBank[0] = bankId;
} else {
}
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) {
if (load_banks_immediate(seqId, &seqPlayer->defaultBank[0]) == NULL)
{
return;
}
}
} else if (load_banks_immediate(seqId, &seqPlayer->defaultBank[0]) == NULL) {
}
else if (load_banks_immediate(seqId, &seqPlayer->defaultBank[0]) == NULL)
{
return;
}
@@ -909,20 +1001,26 @@ void load_sequence_internal(u32 player, u32 seqId, s32 loadAsync) {
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) {
void *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;
}
if (loadAsync) {
if (loadAsync)
{
sequenceData = sequence_dma_async(seqId, 2, seqPlayer);
} else {
}
else
{
sequenceData = sequence_dma_immediate(seqId, 2);
}
if (sequenceData == NULL) {
if (sequenceData == NULL)
{
return;
}
}
@@ -937,37 +1035,39 @@ void load_sequence_internal(u32 player, u32 seqId, s32 loadAsync) {
}
// (void) must be omitted from parameters to fix stack with -framepointer
void audio_init() {
void audio_init()
{
DEBUG_PRINT("audio_init()");
UNUSED s8 pad[32];
u8 buf[0x10];
s32 i, j, UNUSED k;
UNUSED s32 lim1; // lim1 unused in EU
s32 lim2, UNUSED lim3;
UNUSED u32 size;
s32 i, UNUSED k;
// lim1 unused in EU
s32 UNUSED lim3;
UNUSED u64 *ptr64;
void *data;
UNUSED s32 pad2;
gAudioLoadLock = AUDIO_LOCK_UNINITIALIZED;
DEBUG_PRINT("- setting values in unused");
lim1 = gUnusedCount80333EE8;
for (i = 0; i < lim1; i++) {
s32 lim1 = gUnusedCount80333EE8;
for (i = 0; i < lim1; i++)
{
gUnused80226E58[i] = 0;
gUnused80226E98[i] = 0;
}
DEBUG_PRINT("- clearing audio heap");
lim2 = gAudioHeapSize;
for (i = 0; i <= lim2 / 8 - 1; i++) {
s32 lim2 = gAudioHeapSize;
for (i = 0; i <= lim2 / 8 - 1; i++)
{
((u64 *)gAudioHeap)[i] = 0;
}
eu_stubbed_printf_1("AudioHeap is %x\n", gAudioHeapSize);
for (i = 0; i < NUMAIBUFFERS; i++) {
for (i = 0; i < NUMAIBUFFERS; i++)
{
gAiBufferLengths[i] = 0xa0;
}
@@ -986,10 +1086,12 @@ void audio_init() {
sound_init_main_pools(gAudioInitPoolSize);
for (i = 0; i < NUMAIBUFFERS; i++) {
for (i = 0; i < NUMAIBUFFERS; i++)
{
gAiBuffers[i] = soundAlloc(&gAudioInitPool, AIBUFFER_LEN);
for (j = 0; j < (s32) (AIBUFFER_LEN / sizeof(s16)); j++) {
for (s32 j = 0; j < (s32)(AIBUFFER_LEN / sizeof(s16)); j++)
{
gAiBuffers[i][j] = 0;
}
}
@@ -1003,10 +1105,10 @@ void audio_init() {
// Load headers for sounds and sequences
gSeqFileHeader = (ALSeqFile *)buf;
data = gMusicData;
void *data = gMusicData;
audio_dma_copy_immediate((uintptr_t)data, gSeqFileHeader, 0x10);
gSequenceCount = gSeqFileHeader->seqCount;
size = ALIGN16(gSequenceCount * sizeof(ALSeqData) + 4);
u32 size = ALIGN16(gSequenceCount * sizeof(ALSeqData) + 4);
gSeqFileHeader = soundAlloc(&gAudioInitPool, size);
audio_dma_copy_immediate((uintptr_t)data, gSeqFileHeader, size);
alSeqFileNew(gSeqFileHeader, data);
+5 -2
View File
@@ -56,7 +56,8 @@ extern s8 gSoundMode;
#ifdef VERSION_SH
extern OSMesgQueue gUnkQueue1;
struct UnkStructSH8034EC88 {
struct UnkStructSH8034EC88
{
u8 *endAndMediumIdentification;
struct AudioBankSample *sample;
u8 *ramAddr;
@@ -64,7 +65,8 @@ struct UnkStructSH8034EC88 {
s32 isFree;
};
struct PatchStruct {
struct PatchStruct
{
s32 bankId1;
s32 bankId2;
void *baseAddr1;
@@ -79,6 +81,7 @@ extern struct UnkStructSH8034EC88 D_SH_8034EC88[0x80];
struct AudioBank *bank_load_immediate(s32 bankId, s32 arg1);
void audio_dma_partial_copy_async(uintptr_t * devAddr, u8 * *vAddr, ssize_t * remaining, OSMesgQueue * queue, OSIoMesg * mesg);
void decrease_sample_dma_ttls(void);
#ifdef VERSION_SH
void *dma_sample_data(uintptr_t devAddr, u32 size, s32 arg2, u8 *dmaIndexRef, s32 medium);
+527 -260
View File
File diff suppressed because it is too large Load Diff
File diff suppressed because it is too large Load Diff
+12
View File
@@ -17,17 +17,29 @@
#define NOTE_ALLOC_GLOBAL_FREELIST 8
void process_notes(void);
void seq_channel_layer_note_decay(struct SequenceChannelLayer *seqLayer);
void seq_channel_layer_note_release(struct SequenceChannelLayer *seqLayer);
void init_synthetic_wave(struct Note *note, struct SequenceChannelLayer *seqLayer);
void init_note_lists(struct NotePool *pool);
void init_note_free_list(void);
void note_pool_clear(struct NotePool *pool);
void note_pool_fill(struct NotePool *pool, s32 count);
void audio_list_push_front(struct AudioListItem *list, struct AudioListItem *item);
void audio_list_remove(struct AudioListItem *item);
struct Note *alloc_note(struct SequenceChannelLayer *seqLayer);
void reclaim_notes(void);
void note_init_all(void);
#if defined(VERSION_SH)
+90 -46
View File
@@ -34,7 +34,8 @@ s32 audio_shut_down_and_reset_step(void);
void func_802ad7ec(u32);
#ifdef TARGET_N64
struct SPTask *create_next_audio_frame_task(void) {
struct SPTask *create_next_audio_frame_task(void)
{
u32 samplesRemainingInAI;
s32 writtenCmds;
s32 index;
@@ -46,7 +47,8 @@ struct SPTask *create_next_audio_frame_task(void) {
OSMesg sp2C;
gAudioFrameCount++;
if (gAudioFrameCount % gAudioBufferParameters.presetUnk4 != 0) {
if (gAudioFrameCount % gAudioBufferParameters.presetUnk4 != 0)
{
stubbed_printf("DAC:Lost 1 Frame.\n");
return NULL;
}
@@ -59,25 +61,32 @@ struct SPTask *create_next_audio_frame_task(void) {
index = (gCurrAiBufferIndex - 2 + NUMAIBUFFERS) % NUMAIBUFFERS;
samplesRemainingInAI = osAiGetLength() / 4;
if (gAiBufferLengths[index] != 0) {
if (gAiBufferLengths[index] != 0)
{
osAiSetNextBuffer(gAiBuffers[index], gAiBufferLengths[index] * 4);
}
oldDmaCount = gCurrAudioFrameDmaCount;
if (oldDmaCount > AUDIO_FRAME_DMA_QUEUE_SIZE) {
if (oldDmaCount > AUDIO_FRAME_DMA_QUEUE_SIZE)
{
stubbed_printf("DMA: Request queue over.( %d )\n", oldDmaCount);
}
gCurrAudioFrameDmaCount = 0;
decrease_sample_dma_ttls();
if (osRecvMesg(OSMesgQueues[2], &sp30, 0) != -1) {
gAudioResetPresetIdToLoad = (u8) (s32) sp30;
if (osRecvMesg(OSMesgQueues[2], &sp30, 0) != -1)
{
gAudioResetPresetIdToLoad = (u8)(s32)
sp30;
gAudioResetStatus = 5;
}
if (gAudioResetStatus != 0) {
if (audio_shut_down_and_reset_step() == 0) {
if (gAudioResetStatus == 0) {
if (gAudioResetStatus != 0)
{
if (audio_shut_down_and_reset_step() == 0)
{
if (gAudioResetStatus == 0)
{
osSendMesg(OSMesgQueues[3], (OSMesg)(s32) gAudioResetPresetIdToLoad, OS_MESG_NOBLOCK);
}
return NULL;
@@ -91,14 +100,17 @@ struct SPTask *create_next_audio_frame_task(void) {
gAiBufferLengths[index] = ((gAudioBufferParameters.samplesPerFrameTarget - samplesRemainingInAI +
EXTRA_BUFFERED_AI_SAMPLES_TARGET) & ~0xf) + SAMPLES_TO_OVERPRODUCE;
if (gAiBufferLengths[index] < gAudioBufferParameters.minAiBufferLength) {
if (gAiBufferLengths[index] < gAudioBufferParameters.minAiBufferLength)
{
gAiBufferLengths[index] = gAudioBufferParameters.minAiBufferLength;
}
if (gAiBufferLengths[index] > gAudioBufferParameters.maxAiBufferLength) {
if (gAiBufferLengths[index] > gAudioBufferParameters.maxAiBufferLength)
{
gAiBufferLengths[index] = gAudioBufferParameters.maxAiBufferLength;
}
if (osRecvMesg(OSMesgQueues[1], &sp2C, OS_MESG_NOBLOCK) != -1) {
if (osRecvMesg(OSMesgQueues[1], &sp2C, OS_MESG_NOBLOCK) != -1)
{
func_802ad7ec((u32)sp2C);
}
@@ -131,24 +143,30 @@ struct SPTask *create_next_audio_frame_task(void) {
return gAudioTask;
}
#else
struct SPTask *create_next_audio_frame_task(void) {
struct SPTask *create_next_audio_frame_task(void)
{
return NULL;
}
void create_next_audio_buffer(s16 *samples, u32 num_samples) {
void create_next_audio_buffer(s16 *samples, u32 num_samples)
{
s32 writtenCmds;
OSMesg msg;
gAudioFrameCount++;
decrease_sample_dma_ttls();
if (osRecvMesg(OSMesgQueues[2], &msg, 0) != -1) {
gAudioResetPresetIdToLoad = (u8) (intptr_t) msg;
if (osRecvMesg(OSMesgQueues[2], &msg, 0) != -1)
{
gAudioResetPresetIdToLoad = (u8)(intptr_t)
msg;
gAudioResetStatus = 5;
}
if (gAudioResetStatus != 0) {
if (gAudioResetStatus != 0)
{
audio_reset_session();
gAudioResetStatus = 0;
}
if (osRecvMesg(OSMesgQueues[1], &msg, OS_MESG_NOBLOCK) != -1) {
if (osRecvMesg(OSMesgQueues[1], &msg, OS_MESG_NOBLOCK) != -1)
{
func_802ad7ec((u32)msg);
}
synthesis_execute(gAudioCmdBuffers[0], &writtenCmds, samples, num_samples);
@@ -157,10 +175,12 @@ void create_next_audio_buffer(s16 *samples, u32 num_samples) {
}
#endif
void eu_process_audio_cmd(struct EuAudioCmd *cmd) {
void eu_process_audio_cmd(struct EuAudioCmd *cmd)
{
s32 i;
switch (cmd->u.s.op) {
switch (cmd->u.s.op)
{
case 0x81:
preload_sequence(cmd->u.s.arg2, 3);
break;
@@ -172,11 +192,14 @@ void eu_process_audio_cmd(struct EuAudioCmd *cmd) {
break;
case 0x83:
if (gSequencePlayers[cmd->u.s.arg1].enabled != FALSE) {
if (cmd->u2.as_s32 == 0) {
if (gSequencePlayers[cmd->u.s.arg1].enabled != FALSE)
{
if (cmd->u2.as_s32 == 0)
{
sequence_player_disable(&gSequencePlayers[cmd->u.s.arg1]);
}
else {
else
{
seq_player_fade_to_zero_volume(cmd->u.s.arg1, cmd->u2.as_s32);
}
}
@@ -187,14 +210,16 @@ void eu_process_audio_cmd(struct EuAudioCmd *cmd) {
break;
case 0xf1:
for (i = 0; i < 4; i++) {
for (i = 0; i < 4; i++)
{
gSequencePlayers[i].muted = TRUE;
gSequencePlayers[i].recalculateVolume = TRUE;
}
break;
case 0xf2:
for (i = 0; i < 4; i++) {
for (i = 0; i < 4; i++)
{
gSequencePlayers[i].muted = FALSE;
gSequencePlayers[i].recalculateVolume = TRUE;
}
@@ -212,18 +237,21 @@ extern OSMesg OSMesg1;
extern OSMesg OSMesg2;
extern OSMesg OSMesg3;
void seq_player_fade_to_zero_volume(s32 player, FadeT fadeOutTime) {
if (fadeOutTime == 0) {
void seq_player_fade_to_zero_volume(s32 player, FadeT fadeOutTime)
{
if (fadeOutTime == 0)
{
fadeOutTime = 1;
}
gSequencePlayers[player].fadeVelocity = -(gSequencePlayers[player].fadeVolume / fadeOutTime);
gSequencePlayers[player].state = 2;
gSequencePlayers[player].fadeRemainingFrames = fadeOutTime;
}
void func_8031D690(s32 player, FadeT fadeInTime) {
if (fadeInTime != 0) {
void func_8031D690(s32 player, FadeT fadeInTime)
{
if (fadeInTime != 0)
{
gSequencePlayers[player].state = 1;
gSequencePlayers[player].fadeTimerUnkEu = fadeInTime;
gSequencePlayers[player].fadeRemainingFrames = fadeInTime;
@@ -232,7 +260,8 @@ void func_8031D690(s32 player, FadeT fadeInTime) {
}
}
void port_eu_init_queues(void) {
void port_eu_init_queues(void)
{
D_EU_80302010 = 0;
D_EU_80302014 = 0;
osCreateMesgQueue(OSMesgQueues[0], &OSMesg0, 1);
@@ -241,51 +270,62 @@ void port_eu_init_queues(void) {
osCreateMesgQueue(OSMesgQueues[3], &OSMesg3, 1);
}
void func_802ad6f0(s32 arg0, s32 *arg1) {
void func_802ad6f0(s32 arg0, s32 *arg1)
{
struct EuAudioCmd *cmd = &sAudioCmd[D_EU_80302010 & 0xff];
cmd->u.first = arg0;
cmd->u2.as_u32 = *arg1;
D_EU_80302010++;
}
void func_802ad728(u32 arg0, f32 arg1) {
void func_802ad728(u32 arg0, f32 arg1)
{
func_802ad6f0(arg0, (s32 *)&arg1);
}
void func_802ad74c(u32 arg0, u32 arg1) {
void func_802ad74c(u32 arg0, u32 arg1)
{
func_802ad6f0(arg0, (s32 *)&arg1);
}
void func_802ad770(u32 arg0, s8 arg1) {
void func_802ad770(u32 arg0, s8 arg1)
{
s32 sp1C = arg1 << 24;
func_802ad6f0(arg0, &sp1C);
}
void func_802ad7a0(void) {
void func_802ad7a0(void)
{
osSendMesg(OSMesgQueues[1],
(OSMesg)(u32)((D_EU_80302014 & 0xff) << 8 | (D_EU_80302010 & 0xff)),
OS_MESG_NOBLOCK);
D_EU_80302014 = D_EU_80302010;
}
void func_802ad7ec(u32 arg0) {
void func_802ad7ec(u32 arg0)
{
struct EuAudioCmd *cmd;
struct SequencePlayer *seqPlayer;
struct SequenceChannel *chan;
u8 end = arg0 & 0xff;
u8 i = (arg0 >> 8) & 0xff;
for (;;) {
for (;;)
{
if (i == end) break;
cmd = &sAudioCmd[i++ & 0xff];
if (cmd->u.s.arg1 < SEQUENCE_PLAYERS) {
if (cmd->u.s.arg1 < SEQUENCE_PLAYERS)
{
seqPlayer = &gSequencePlayers[cmd->u.s.arg1];
if ((cmd->u.s.op & 0x80) != 0) {
if ((cmd->u.s.op & 0x80) != 0)
{
eu_process_audio_cmd(cmd);
}
else if ((cmd->u.s.op & 0x40) != 0) {
switch (cmd->u.s.op) {
else if ((cmd->u.s.op & 0x40) != 0)
{
switch (cmd->u.s.op)
{
case 0x41:
seqPlayer->fadeVolumeScale = cmd->u2.as_f32;
seqPlayer->recalculateVolume = TRUE;
@@ -304,11 +344,13 @@ void func_802ad7ec(u32 arg0) {
break;
}
}
else if (seqPlayer->enabled != FALSE && cmd->u.s.arg2 < 0x10) {
else if (seqPlayer->enabled != FALSE && cmd->u.s.arg2 < 0x10)
{
chan = seqPlayer->channels[cmd->u.s.arg2];
if (IS_SEQUENCE_CHANNEL_VALID(chan))
{
switch (cmd->u.s.op) {
switch (cmd->u.s.op)
{
case 1:
chan->volumeScale = cmd->u2.as_f32;
chan->changes.as_bitfields.volume = TRUE;
@@ -329,7 +371,8 @@ void func_802ad7ec(u32 arg0) {
chan->reverbVol = cmd->u2.as_s8;
break;
case 6:
if (cmd->u.s.arg3 < 8) {
if (cmd->u.s.arg3 < 8)
{
chan->soundScriptIO[cmd->u.s.arg3] = cmd->u2.as_s8;
}
break;
@@ -344,7 +387,8 @@ void func_802ad7ec(u32 arg0) {
}
}
void port_eu_init(void) {
void port_eu_init(void)
{
port_eu_init_queues();
}
+176 -87
View File
@@ -24,7 +24,8 @@ void seq_player_fade_to_zero_volume(s32 arg0, s32 numFrames);
void func_802ad7ec(u32 arg0);
#ifdef TARGET_N64
struct SPTask *create_next_audio_frame_task(void) {
struct SPTask *create_next_audio_frame_task(void)
{
u32 samplesRemainingInAI;
s32 writtenCmds;
s32 index;
@@ -37,8 +38,10 @@ struct SPTask *create_next_audio_frame_task(void) {
s32 writtenCmdsCopy;
gAudioFrameCount++;
if (gAudioFrameCount % gAudioBufferParameters.presetUnk4 != 0) {
if ((gAudioFrameCount % gAudioBufferParameters.presetUnk4) + 1 == gAudioBufferParameters.presetUnk4) {
if (gAudioFrameCount % gAudioBufferParameters.presetUnk4 != 0)
{
if ((gAudioFrameCount % gAudioBufferParameters.presetUnk4) + 1 == gAudioBufferParameters.presetUnk4)
{
return D_SH_80314FCC;
}
return NULL;
@@ -51,39 +54,49 @@ struct SPTask *create_next_audio_frame_task(void) {
index = (gCurrAiBufferIndex - 2 + NUMAIBUFFERS) % NUMAIBUFFERS;
samplesRemainingInAI = osAiGetLength() / 4;
if (gAudioLoadLockSH < 0x10U) {
if (gAiBufferLengths[index] != 0) {
if (gAudioLoadLockSH < 0x10U)
{
if (gAiBufferLengths[index] != 0)
{
osAiSetNextBuffer(gAiBuffers[index], gAiBufferLengths[index] * 4);
}
}
oldDmaCount = gCurrAudioFrameDmaCount;
if (oldDmaCount > AUDIO_FRAME_DMA_QUEUE_SIZE) {
if (oldDmaCount > AUDIO_FRAME_DMA_QUEUE_SIZE)
{
}
gCurrAudioFrameDmaCount = 0;
decrease_sample_dma_ttls();
func_sh_802f41e4(gAudioResetStatus);
if (osRecvMesg(D_SH_80350F88, (OSMesg *) &sp38, OS_MESG_NOBLOCK) != -1) {
if (gAudioResetStatus == 0) {
if (osRecvMesg(D_SH_80350F88, (OSMesg *)&sp38, OS_MESG_NOBLOCK) != -1)
{
if (gAudioResetStatus == 0)
{
gAudioResetStatus = 5;
}
gAudioResetPresetIdToLoad = (u8)sp38;
}
if (gAudioResetStatus != 0) {
if (audio_shut_down_and_reset_step() == 0) {
if (gAudioResetStatus == 0) {
if (gAudioResetStatus != 0)
{
if (audio_shut_down_and_reset_step() == 0)
{
if (gAudioResetStatus == 0)
{
osSendMesg(D_SH_80350FA8, (OSMesg)(s32) gAudioResetPresetIdToLoad, OS_MESG_NOBLOCK);
}
D_SH_80314FCC = 0;
return NULL;
}
}
if (gAudioLoadLockSH >= 0x11U) {
if (gAudioLoadLockSH >= 0x11U)
{
return NULL;
}
if (gAudioLoadLockSH != 0) {
if (gAudioLoadLockSH != 0)
{
gAudioLoadLockSH++;
}
@@ -94,17 +107,22 @@ struct SPTask *create_next_audio_frame_task(void) {
gAiBufferLengths[index] = (s16)((((gAudioBufferParameters.samplesPerFrameTarget - samplesRemainingInAI) +
EXTRA_BUFFERED_AI_SAMPLES_TARGET) & ~0xf) + SAMPLES_TO_OVERPRODUCE);
if (gAiBufferLengths[index] < gAudioBufferParameters.minAiBufferLength) {
if (gAiBufferLengths[index] < gAudioBufferParameters.minAiBufferLength)
{
gAiBufferLengths[index] = gAudioBufferParameters.minAiBufferLength;
}
if (gAiBufferLengths[index] > gAudioBufferParameters.maxAiBufferLength) {
if (gAiBufferLengths[index] > gAudioBufferParameters.maxAiBufferLength)
{
gAiBufferLengths[index] = gAudioBufferParameters.maxAiBufferLength;
}
if (osRecvMesg(D_SH_80350F68, (OSMesg *) &sp34, 0) != -1) {
do {
if (osRecvMesg(D_SH_80350F68, (OSMesg *)&sp34, 0) != -1)
{
do
{
func_802ad7ec(sp34);
} while (osRecvMesg(D_SH_80350F68, (OSMesg *) &sp34, 0) != -1);
}
while (osRecvMesg(D_SH_80350F68, (OSMesg *)&sp34, 0) != -1);
}
flags = 0;
@@ -135,38 +153,49 @@ struct SPTask *create_next_audio_frame_task(void) {
task->yield_data_size = 0;
writtenCmdsCopy = writtenCmds;
if (D_SH_80314FC8 < writtenCmdsCopy) {
if (D_SH_80314FC8 < writtenCmdsCopy)
{
D_SH_80314FC8 = writtenCmdsCopy;
}
if (gAudioBufferParameters.presetUnk4 == 1) {
if (gAudioBufferParameters.presetUnk4 == 1)
{
return gAudioTask;
} else {
}
else
{
D_SH_80314FCC = gAudioTask;
return NULL;
}
}
#else
struct SPTask *create_next_audio_frame_task(void) {
struct SPTask *create_next_audio_frame_task(void)
{
return NULL;
}
void create_next_audio_buffer(s16 *samples, u32 num_samples) {
void create_next_audio_buffer(s16 *samples, u32 num_samples)
{
s32 writtenCmds;
OSMesg msg;
gAudioFrameCount++;
decrease_sample_dma_ttls();
if (osRecvMesg(D_SH_80350F88, &msg, 0) != -1) {
gAudioResetPresetIdToLoad = (u8) (intptr_t) msg;
if (gAudioResetStatus == 0) {
if (osRecvMesg(D_SH_80350F88, &msg, 0) != -1)
{
gAudioResetPresetIdToLoad = (u8)(intptr_t)
msg;
if (gAudioResetStatus == 0)
{
gAudioResetStatus = 5;
}
}
if (gAudioResetStatus != 0) {
if (gAudioResetStatus != 0)
{
audio_reset_session();
gAudioResetStatus = 0;
}
while (osRecvMesg(D_SH_80350F68, &msg, OS_MESG_NOBLOCK) != -1) {
while (osRecvMesg(D_SH_80350F68, &msg, OS_MESG_NOBLOCK) != -1)
{
func_802ad7ec((u32)msg);
}
synthesis_execute(gAudioCmdBuffers[0], &writtenCmds, samples, num_samples);
@@ -176,12 +205,14 @@ void create_next_audio_buffer(s16 *samples, u32 num_samples) {
}
#endif
void eu_process_audio_cmd(struct EuAudioCmd *cmd) {
void eu_process_audio_cmd(struct EuAudioCmd *cmd)
{
s32 i;
struct Note *note;
struct NoteSubEu *sub;
switch (cmd->u.s.op) {
switch (cmd->u.s.op)
{
case 0x81:
preload_sequence(cmd->u.s.arg2, 3);
break;
@@ -193,11 +224,14 @@ void eu_process_audio_cmd(struct EuAudioCmd *cmd) {
break;
case 0x83:
if (gSequencePlayers[cmd->u.s.arg1].enabled != FALSE) {
if (cmd->u2.as_s32 == 0) {
if (gSequencePlayers[cmd->u.s.arg1].enabled != FALSE)
{
if (cmd->u2.as_s32 == 0)
{
sequence_player_disable(&gSequencePlayers[cmd->u.s.arg1]);
}
else {
else
{
seq_player_fade_to_zero_volume(cmd->u.s.arg1, cmd->u2.as_s32);
}
}
@@ -211,25 +245,31 @@ void eu_process_audio_cmd(struct EuAudioCmd *cmd) {
break;
case 0xf1:
for (i = 0; i < 4; i++) {
for (i = 0; i < 4; i++)
{
gSequencePlayers[i].muted = TRUE;
gSequencePlayers[i].recalculateVolume = TRUE;
}
break;
case 0xf2:
if (cmd->u2.as_s32 == 1) {
for (i = 0; i < gMaxSimultaneousNotes; i++) {
if (cmd->u2.as_s32 == 1)
{
for (i = 0; i < gMaxSimultaneousNotes; i++)
{
note = &gNotes[i];
sub = &note->noteSubEu;
if (note->noteSubEu.enabled && note->unkSH34 == 0) {
if ((note->parentLayer->seqChannel->muteBehavior & 8) != 0) {
if (note->noteSubEu.enabled && note->unkSH34 == 0)
{
if ((note->parentLayer->seqChannel->muteBehavior & 8) != 0)
{
sub->finished = TRUE;
}
}
}
}
for (i = 0; i < 4; i++) {
for (i = 0; i < 4; i++)
{
gSequencePlayers[i].muted = FALSE;
gSequencePlayers[i].recalculateVolume = TRUE;
}
@@ -253,10 +293,12 @@ void eu_process_audio_cmd(struct EuAudioCmd *cmd) {
}
}
void seq_player_fade_to_zero_volume(s32 arg0, s32 fadeOutTime) {
void seq_player_fade_to_zero_volume(s32 arg0, s32 fadeOutTime)
{
struct SequencePlayer *player;
if (fadeOutTime == 0) {
if (fadeOutTime == 0)
{
fadeOutTime = 1;
}
player = &gSequencePlayers[arg0];
@@ -265,10 +307,12 @@ void seq_player_fade_to_zero_volume(s32 arg0, s32 fadeOutTime) {
player->fadeVelocity = -(player->fadeVolume / (f32)fadeOutTime);
}
void func_8031D690(s32 playerIndex, s32 fadeInTime) {
void func_8031D690(s32 playerIndex, s32 fadeInTime)
{
struct SequencePlayer *player;
if (fadeInTime != 0) {
if (fadeInTime != 0)
{
player = &gSequencePlayers[playerIndex];
player->state = 1;
player->fadeTimerUnkEu = fadeInTime;
@@ -278,7 +322,8 @@ void func_8031D690(s32 playerIndex, s32 fadeInTime) {
}
}
void port_eu_init_queues(void) {
void port_eu_init_queues(void)
{
D_SH_80350F18 = 0;
D_SH_80350F19 = 0;
D_SH_80350F38 = &D_SH_80350F20;
@@ -292,36 +337,43 @@ void port_eu_init_queues(void) {
}
extern struct EuAudioCmd sAudioCmd[0x100];
void func_802ad6f0(s32 arg0, s32 *arg1) {
void func_802ad6f0(s32 arg0, s32 *arg1)
{
struct EuAudioCmd *cmd = &sAudioCmd[D_SH_80350F18 & 0xff];
cmd->u.first = arg0;
cmd->u2.as_u32 = *arg1;
D_SH_80350F18++;
if (D_SH_80350F18 == D_SH_80350F19) {
if (D_SH_80350F18 == D_SH_80350F19)
{
D_SH_80350F18--;
}
}
void func_802ad728(u32 arg0, f32 arg1) {
void func_802ad728(u32 arg0, f32 arg1)
{
func_802ad6f0(arg0, (s32 *)&arg1);
}
void func_802ad74c(u32 arg0, u32 arg1) {
void func_802ad74c(u32 arg0, u32 arg1)
{
func_802ad6f0(arg0, (s32 *)&arg1);
}
void func_802ad770(u32 arg0, s8 arg1) {
void func_802ad770(u32 arg0, s8 arg1)
{
s32 sp1C = arg1 << 24;
func_802ad6f0(arg0, &sp1C);
}
char shindouDebugPrint133[] = "AudioSend: %d -> %d (%d)\n";
void func_sh_802F64C8(void) {
void func_sh_802F64C8(void)
{
static s32 D_SH_8031503C = 0;
s32 mesg;
if (((D_SH_80350F18 - D_SH_80350F19 + 0x100) & 0xff) > D_SH_8031503C) {
if (((D_SH_80350F18 - D_SH_80350F19 + 0x100) & 0xff) > D_SH_8031503C)
{
D_SH_8031503C = (D_SH_80350F18 - D_SH_80350F19 + 0x100) & 0xff;
}
mesg = ((D_SH_80350F19 & 0xff) << 8) | (D_SH_80350F18 & 0xff);
@@ -329,11 +381,13 @@ void func_sh_802F64C8(void) {
D_SH_80350F19 = D_SH_80350F18;
}
void func_sh_802f6540(void) {
void func_sh_802f6540(void)
{
D_SH_80350F19 = D_SH_80350F18;
}
void func_802ad7ec(u32 arg0) {
void func_802ad7ec(u32 arg0)
{
struct EuAudioCmd *cmd;
struct SequencePlayer *seqPlayer;
struct SequenceChannel *chan;
@@ -347,35 +401,45 @@ void func_802ad7ec(u32 arg0) {
static u8 D_SH_80315098 = 0;
static u8 D_SH_8031509C = 0;
if (D_SH_8031509C == 0) {
if (D_SH_8031509C == 0)
{
D_SH_80315098 = (arg0 >> 8) & 0xff;
}
end = arg0 & 0xff;
for (;;) {
if (D_SH_80315098 == end) {
for (;;)
{
if (D_SH_80315098 == end)
{
D_SH_8031509C = 0;
break;
}
cmd = &sAudioCmd[D_SH_80315098 & 0xff];
D_SH_80315098++;
if (cmd->u.s.op == 0xf8) {
if (cmd->u.s.op == 0xf8)
{
D_SH_8031509C = 1;
break;
}
else if ((cmd->u.s.op & 0xf0) == 0xf0) {
else if ((cmd->u.s.op & 0xf0) == 0xf0)
{
eu_process_audio_cmd(cmd);
}
else if (cmd->u.s.arg1 < SEQUENCE_PLAYERS) {
else if (cmd->u.s.arg1 < SEQUENCE_PLAYERS)
{
seqPlayer = &gSequencePlayers[cmd->u.s.arg1];
if ((cmd->u.s.op & 0x80) != 0) {
if ((cmd->u.s.op & 0x80) != 0)
{
eu_process_audio_cmd(cmd);
}
else if ((cmd->u.s.op & 0x40) != 0) {
switch (cmd->u.s.op) {
else if ((cmd->u.s.op & 0x40) != 0)
{
switch (cmd->u.s.op)
{
case 0x41:
if (seqPlayer->fadeVolumeScale != cmd->u2.as_f32) {
if (seqPlayer->fadeVolumeScale != cmd->u2.as_f32)
{
seqPlayer->fadeVolumeScale = cmd->u2.as_f32;
seqPlayer->recalculateVolume = TRUE;
}
@@ -398,43 +462,51 @@ void func_802ad7ec(u32 arg0) {
break;
}
}
else if (seqPlayer->enabled != FALSE && cmd->u.s.arg2 < 0x10) {
else if (seqPlayer->enabled != FALSE && cmd->u.s.arg2 < 0x10)
{
chan = seqPlayer->channels[cmd->u.s.arg2];
if (IS_SEQUENCE_CHANNEL_VALID(chan))
{
switch (cmd->u.s.op) {
switch (cmd->u.s.op)
{
case 1:
if (chan->volumeScale != cmd->u2.as_f32) {
if (chan->volumeScale != cmd->u2.as_f32)
{
chan->volumeScale = cmd->u2.as_f32;
chan->changes.as_bitfields.volume = TRUE;
}
break;
case 2:
if (chan->volume != cmd->u2.as_f32) {
if (chan->volume != cmd->u2.as_f32)
{
chan->volume = cmd->u2.as_f32;
chan->changes.as_bitfields.volume = TRUE;
}
break;
case 3:
if (chan->newPan != cmd->u2.as_s8) {
if (chan->newPan != cmd->u2.as_s8)
{
chan->newPan = cmd->u2.as_s8;
chan->changes.as_bitfields.pan = TRUE;
}
break;
case 4:
if (chan->freqScale != cmd->u2.as_f32) {
if (chan->freqScale != cmd->u2.as_f32)
{
chan->freqScale = cmd->u2.as_f32;
chan->changes.as_bitfields.freqScale = TRUE;
}
break;
case 5:
//! @bug u8 s8 comparison (but harmless)
if (chan->reverbVol != cmd->u2.as_s8) {
if (chan->reverbVol != cmd->u2.as_s8)
{
chan->reverbVol = cmd->u2.as_s8;
}
break;
case 6:
if (cmd->u.s.arg3 < 8) {
if (cmd->u.s.arg3 < 8)
{
chan->soundScriptIO[cmd->u.s.arg3] = cmd->u2.as_s8;
}
break;
@@ -452,10 +524,12 @@ void func_802ad7ec(u32 arg0) {
}
}
u32 func_sh_802f6878(s32 *arg0) {
u32 func_sh_802f6878(s32 *arg0)
{
u32 sp1C;
if (osRecvMesg(&gUnkQueue1, (OSMesg *) &sp1C, 0) == -1) {
if (osRecvMesg(&gUnkQueue1, (OSMesg *)&sp1C, 0) == -1)
{
*arg0 = 0;
return 0U;
}
@@ -463,63 +537,78 @@ u32 func_sh_802f6878(s32 *arg0) {
return sp1C >> 0x18;
}
u8 *func_sh_802f68e0(u32 index, u32 *a1) {
u8 *func_sh_802f68e0(u32 index, u32 *a1)
{
return func_sh_802f3220(index, a1);
}
s32 func_sh_802f6900(void) {
s32 func_sh_802f6900(void)
{
s32 ret;
s32 sp18;
ret = osRecvMesg(D_SH_80350FA8, (OSMesg *)&sp18, 0);
if (ret == -1) {
if (ret == -1)
{
return 0;
}
if (sp18 != gAudioResetPresetIdToLoad) {
if (sp18 != gAudioResetPresetIdToLoad)
{
return 0;
} else {
}
else
{
return 1;
}
}
// TODO: (Scrub C)
void func_sh_802f6958(OSMesg mesg) {
void func_sh_802f6958(OSMesg mesg)
{
s32 a;
OSMesg recvMesg;
do {
do
{
a = -1;
} while (osRecvMesg(D_SH_80350FA8, &recvMesg, OS_MESG_NOBLOCK) != a);
}
while (osRecvMesg(D_SH_80350FA8, &recvMesg, OS_MESG_NOBLOCK) != a);
func_sh_802f6540();
osSendMesg(D_SH_80350F88, mesg, OS_MESG_NOBLOCK);
}
void func_sh_802f69cc(void) {
void func_sh_802f69cc(void)
{
gAudioLoadLockSH = 1;
func_sh_802f6958(0);
gAudioResetStatus = 0;
}
s32 func_sh_802f6a08(s32 playerIndex, s32 channelIndex, s32 soundScriptIOIndex) {
s32 func_sh_802f6a08(s32 playerIndex, s32 channelIndex, s32 soundScriptIOIndex)
{
struct SequenceChannel *seqChannel;
struct SequencePlayer *player;
player = &gSequencePlayers[playerIndex];
if (player->enabled) {
if (player->enabled)
{
seqChannel = player->channels[channelIndex];
if (IS_SEQUENCE_CHANNEL_VALID(seqChannel)) {
if (IS_SEQUENCE_CHANNEL_VALID(seqChannel))
{
return seqChannel->soundScriptIO[soundScriptIOIndex];
}
}
return -1;
}
s8 func_sh_802f6a6c(s32 playerIndex, s32 index) {
s8 func_sh_802f6a6c(s32 playerIndex, s32 index)
{
return gSequencePlayers[playerIndex].seqVariationEu[index];
}
void port_eu_init(void) {
void port_eu_init(void)
{
port_eu_init_queues();
}
File diff suppressed because it is too large Load Diff
+7
View File
@@ -7,12 +7,19 @@
#include "playback.h"
void seq_channel_layer_disable(struct SequenceChannelLayer *seqPlayer);
void sequence_channel_disable(struct SequenceChannel *seqPlayer);
void sequence_player_disable(struct SequencePlayer *seqPlayer);
void audio_list_push_back(struct AudioListItem *list, struct AudioListItem *item);
void *audio_list_pop_back(struct AudioListItem *list);
void process_sequences(s32 iterationsRemaining);
void init_sequence_player(u32 player);
void init_sequence_players(void);
#endif // AUDIO_SEQPLAYER_H
File diff suppressed because it is too large Load Diff
+30 -14
View File
@@ -30,10 +30,14 @@ struct ReverbRingBufferItem
struct SynthesisReverb
{
/*0x00, 0x00, 0x00*/ u8 resampleFlags;
/*0x01, 0x01, 0x01*/ u8 useReverb;
/*0x02, 0x02, 0x02*/ u8 framesLeftToIgnore;
/*0x03, 0x03, 0x03*/ u8 curFrame;
/*0x00, 0x00, 0x00*/
u8 resampleFlags;
/*0x01, 0x01, 0x01*/
u8 useReverb;
/*0x02, 0x02, 0x02*/
u8 framesLeftToIgnore;
/*0x03, 0x03, 0x03*/
u8 curFrame;
#if defined(VERSION_EU) || defined(VERSION_SH)
/* 0x04, 0x04*/ u8 downsampleRate;
#ifdef VERSION_SH
@@ -44,25 +48,37 @@ struct SynthesisReverb
#ifdef VERSION_SH
/* 0x08*/ u16 unk08;
#endif
/*0x04, 0x08, 0x0A*/ u16 reverbGain;
/*0x06, 0x0A, 0x0C*/ u16 resampleRate;
/*0x04, 0x08, 0x0A*/
u16 reverbGain;
/*0x06, 0x0A, 0x0C*/
u16 resampleRate;
#ifdef VERSION_SH
/* 0x0E*/ u16 panRight;
/* 0x10*/ u16 panLeft;
#endif
/*0x08, 0x0C, 0x14*/ s32 nextRingBufferPos;
/*0x0C, 0x10, 0x18*/ s32 unkC; // never read
/*0x10, 0x14, 0x1C*/ s32 bufSizePerChannel;
/*0x08, 0x0C, 0x14*/
s32 nextRingBufferPos;
/*0x0C, 0x10, 0x18*/
s32 unkC; // never read
/*0x10, 0x14, 0x1C*/
s32 bufSizePerChannel;
struct
{
s16 *left;
s16 *right;
} ringBuffer;
/*0x1C, 0x20, 0x28*/ s16 *resampleStateLeft;
/*0x20, 0x24, 0x2C*/ s16 *resampleStateRight;
/*0x24, 0x28, 0x30*/ s16 *unk24; // never read
/*0x28, 0x2C, 0x34*/ s16 *unk28; // never read
/*0x2C, 0x30, 0x38*/ struct ReverbRingBufferItem items[2][MAX_UPDATES_PER_FRAME];
/*0x1C, 0x20, 0x28*/
s16 *resampleStateLeft;
/*0x20, 0x24, 0x2C*/
s16 *resampleStateRight;
/*0x24, 0x28, 0x30*/
s16 *unk24; // never read
/*0x28, 0x2C, 0x34*/
s16 *unk28; // never read
/*0x2C, 0x30, 0x38*/
struct ReverbRingBufferItem items[2][MAX_UPDATES_PER_FRAME];
#if defined(VERSION_EU) || defined(VERSION_SH)
// Only used in sh:
/* 0x100*/ s16 *unk100;
+315 -144
View File
@@ -39,7 +39,8 @@
#define ALIGN(val, amnt) (((val) + (1 << amnt) - 1) & ~((1 << amnt) - 1))
struct VolumeChange {
struct VolumeChange
{
u16 sourceLeft;
u16 sourceRight;
u16 targetLeft;
@@ -65,7 +66,8 @@ struct NoteSubEu *gNoteSubsEu;
// Equivalent functionality as the US/JP version,
// just that the reverb structure is chosen from an array with index
// Identical in EU.
void prepare_reverb_ring_buffer(s32 chunkLen, u32 updateIndex, s32 reverbIndex) {
void prepare_reverb_ring_buffer(s32 chunkLen, u32 updateIndex, s32 reverbIndex)
{
struct ReverbRingBufferItem *item;
struct SynthesisReverb *reverb = &gSynthesisReverbs[reverbIndex];
s32 srcPos;
@@ -73,8 +75,10 @@ void prepare_reverb_ring_buffer(s32 chunkLen, u32 updateIndex, s32 reverbIndex)
s32 nSamples;
s32 excessiveSamples;
s32 UNUSED pad[3];
if (reverb->downsampleRate != 1) {
if (reverb->framesLeftToIgnore == 0) {
if (reverb->downsampleRate != 1)
{
if (reverb->framesLeftToIgnore == 0)
{
// Now that the RSP has finished, downsample the samples produced two frames ago by skipping
// samples.
item = &reverb->items[reverb->curFrame][updateIndex];
@@ -83,13 +87,15 @@ void prepare_reverb_ring_buffer(s32 chunkLen, u32 updateIndex, s32 reverbIndex)
osInvalDCache(item->toDownsampleLeft, DEFAULT_LEN_2CH);
for (srcPos = 0, dstPos = 0; dstPos < item->lengthA / 2;
srcPos += reverb->downsampleRate, dstPos++) {
srcPos += reverb->downsampleRate, dstPos++)
{
reverb->ringBuffer.left[item->startPos + dstPos] =
item->toDownsampleLeft[srcPos];
reverb->ringBuffer.right[item->startPos + dstPos] =
item->toDownsampleRight[srcPos];
}
for (dstPos = 0; dstPos < item->lengthB / 2; srcPos += reverb->downsampleRate, dstPos++) {
for (dstPos = 0; dstPos < item->lengthB / 2; srcPos += reverb->downsampleRate, dstPos++)
{
reverb->ringBuffer.left[dstPos] = item->toDownsampleLeft[srcPos];
reverb->ringBuffer.right[dstPos] = item->toDownsampleRight[srcPos];
}
@@ -99,13 +105,16 @@ void prepare_reverb_ring_buffer(s32 chunkLen, u32 updateIndex, s32 reverbIndex)
item = &reverb->items[reverb->curFrame][updateIndex];
nSamples = chunkLen / reverb->downsampleRate;
excessiveSamples = (nSamples + reverb->nextRingBufferPos) - reverb->bufSizePerChannel;
if (excessiveSamples < 0) {
if (excessiveSamples < 0)
{
// There is space in the ring buffer before it wraps around
item->lengthA = nSamples * 2;
item->lengthB = 0;
item->startPos = (s32)reverb->nextRingBufferPos;
reverb->nextRingBufferPos += nSamples;
} else {
}
else
{
// Ring buffer wrapped around
item->lengthA = (nSamples - excessiveSamples) * 2;
item->lengthB = excessiveSamples * 2;
@@ -117,7 +126,8 @@ void prepare_reverb_ring_buffer(s32 chunkLen, u32 updateIndex, s32 reverbIndex)
item->chunkLen = chunkLen;
}
u64 *synthesis_load_reverb_ring_buffer(u64 *cmd, u16 addr, u16 srcOffset, s32 len, s32 reverbIndex) {
u64 *synthesis_load_reverb_ring_buffer(u64 *cmd, u16 addr, u16 srcOffset, s32 len, s32 reverbIndex)
{
aLoadBuffer(cmd++, VIRTUAL_TO_PHYSICAL2(&gSynthesisReverbs[reverbIndex].ringBuffer.left[srcOffset]),
addr, len);
aLoadBuffer(cmd++, VIRTUAL_TO_PHYSICAL2(&gSynthesisReverbs[reverbIndex].ringBuffer.right[srcOffset]),
@@ -125,7 +135,8 @@ u64 *synthesis_load_reverb_ring_buffer(u64 *cmd, u16 addr, u16 srcOffset, s32 le
return cmd;
}
u64 *synthesis_save_reverb_ring_buffer(u64 *cmd, u16 addr, u16 destOffset, s32 len, s32 reverbIndex) {
u64 *synthesis_save_reverb_ring_buffer(u64 *cmd, u16 addr, u16 destOffset, s32 len, s32 reverbIndex)
{
aSaveBuffer(cmd++, addr,
VIRTUAL_TO_PHYSICAL2(&gSynthesisReverbs[reverbIndex].ringBuffer.left[destOffset]), len);
aSaveBuffer(cmd++, addr + DEFAULT_LEN_1CH,
@@ -133,61 +144,84 @@ u64 *synthesis_save_reverb_ring_buffer(u64 *cmd, u16 addr, u16 destOffset, s32 l
return cmd;
}
void func_sh_802ed644(s32 updateIndexStart, s32 noteIndex) {
void func_sh_802ed644(s32 updateIndexStart, s32 noteIndex)
{
s32 i;
for (i = updateIndexStart + 1; i < gAudioBufferParameters.updatesPerFrame; i++) {
if (!gNoteSubsEu[gMaxSimultaneousNotes * i + noteIndex].needsInit) {
for (i = updateIndexStart + 1; i < gAudioBufferParameters.updatesPerFrame; i++)
{
if (!gNoteSubsEu[gMaxSimultaneousNotes * i + noteIndex].needsInit)
{
gNoteSubsEu[gMaxSimultaneousNotes * i + noteIndex].enabled = FALSE;
} else {
}
else
{
break;
}
}
}
void synthesis_load_note_subs_eu(s32 updateIndex) {
void synthesis_load_note_subs_eu(s32 updateIndex)
{
struct NoteSubEu *src;
struct NoteSubEu *dest;
s32 i;
for (i = 0; i < gMaxSimultaneousNotes; i++) {
for (i = 0; i < gMaxSimultaneousNotes; i++)
{
src = &gNotes[i].noteSubEu;
dest = &gNoteSubsEu[gMaxSimultaneousNotes * updateIndex + i];
if (src->enabled) {
if (src->enabled)
{
*dest = *src;
src->needsInit = FALSE;
} else {
}
else
{
dest->enabled = FALSE;
}
}
}
// TODO: (Scrub C) pointless mask and whitespace
u64 *synthesis_execute(u64 *cmdBuf, s32 *writtenCmds, s16 *aiBuf, s32 bufLen) {
u64 *synthesis_execute(u64 *cmdBuf, s32 *writtenCmds, s16 *aiBuf, s32 bufLen)
{
s32 i, j;
u32 *aiBufPtr;
u64 *cmd = cmdBuf;
s32 chunkLen;
for (i = gAudioBufferParameters.updatesPerFrame; i > 0; i--) {
for (i = gAudioBufferParameters.updatesPerFrame; i > 0; i--)
{
process_sequences(i - 1);
synthesis_load_note_subs_eu(gAudioBufferParameters.updatesPerFrame - i);
}
aiBufPtr = (u32 *)aiBuf;
for (i = gAudioBufferParameters.updatesPerFrame; i > 0; i--) {
if (i == 1) {
for (i = gAudioBufferParameters.updatesPerFrame; i > 0; i--)
{
if (i == 1)
{
chunkLen = bufLen;
} else {
if (bufLen / i >= gAudioBufferParameters.samplesPerUpdateMax) {
}
else
{
if (bufLen / i >= gAudioBufferParameters.samplesPerUpdateMax)
{
chunkLen = gAudioBufferParameters.samplesPerUpdateMax;
} else if (bufLen / i <= gAudioBufferParameters.samplesPerUpdateMin) {
}
else if (bufLen / i <= gAudioBufferParameters.samplesPerUpdateMin)
{
chunkLen = gAudioBufferParameters.samplesPerUpdateMin;
} else {
}
else
{
chunkLen = gAudioBufferParameters.samplesPerUpdate;
}
}
for (j = 0; j < gNumSynthesisReverbs; j++) {
if (gSynthesisReverbs[j].useReverb != 0) {
for (j = 0; j < gNumSynthesisReverbs; j++)
{
if (gSynthesisReverbs[j].useReverb != 0)
{
prepare_reverb_ring_buffer(chunkLen, gAudioBufferParameters.updatesPerFrame - i, j);
}
}
@@ -196,8 +230,10 @@ u64 *synthesis_execute(u64 *cmdBuf, s32 *writtenCmds, s16 *aiBuf, s32 bufLen) {
aiBufPtr += chunkLen;
}
for (j = 0; j < gNumSynthesisReverbs; j++) {
if (gSynthesisReverbs[j].framesLeftToIgnore != 0) {
for (j = 0; j < gNumSynthesisReverbs; j++)
{
if (gSynthesisReverbs[j].framesLeftToIgnore != 0)
{
gSynthesisReverbs[j].framesLeftToIgnore--;
}
gSynthesisReverbs[j].curFrame ^= 1;
@@ -206,26 +242,32 @@ u64 *synthesis_execute(u64 *cmdBuf, s32 *writtenCmds, s16 *aiBuf, s32 bufLen) {
return cmd;
}
u64 *synthesis_resample_and_mix_reverb(u64 *cmd, s32 bufLen, s16 reverbIndex, s16 updateIndex) {
u64 *synthesis_resample_and_mix_reverb(u64 *cmd, s32 bufLen, s16 reverbIndex, s16 updateIndex)
{
struct ReverbRingBufferItem *item;
s16 startPad;
s16 paddedLengthA;
item = &gSynthesisReverbs[reverbIndex].items[gSynthesisReverbs[reverbIndex].curFrame][updateIndex];
if (gSynthesisReverbs[reverbIndex].downsampleRate == 1) {
if (gSynthesisReverbs[reverbIndex].downsampleRate == 1)
{
cmd = synthesis_load_reverb_ring_buffer(cmd, DMEM_ADDR_WET_LEFT_CH, item->startPos, item->lengthA, reverbIndex);
if (item->lengthB != 0) {
if (item->lengthB != 0)
{
cmd = synthesis_load_reverb_ring_buffer(cmd, DMEM_ADDR_WET_LEFT_CH + item->lengthA, 0, item->lengthB, reverbIndex);
}
aAddMixer(cmd++, DMEM_ADDR_WET_LEFT_CH, DMEM_ADDR_LEFT_CH, DEFAULT_LEN_2CH);
aMix(cmd++, 0x8000 + gSynthesisReverbs[reverbIndex].reverbGain, DMEM_ADDR_WET_LEFT_CH, DMEM_ADDR_WET_LEFT_CH, DEFAULT_LEN_2CH);
} else {
}
else
{
startPad = (item->startPos % 8u) * 2;
paddedLengthA = ALIGN(startPad + item->lengthA, 4);
cmd = synthesis_load_reverb_ring_buffer(cmd, DMEM_ADDR_RESAMPLED, (item->startPos - startPad / 2), DEFAULT_LEN_1CH, reverbIndex);
if (item->lengthB != 0) {
if (item->lengthB != 0)
{
cmd = synthesis_load_reverb_ring_buffer(cmd, DMEM_ADDR_RESAMPLED + paddedLengthA, 0, DEFAULT_LEN_1CH - paddedLengthA, reverbIndex);
}
@@ -238,7 +280,8 @@ u64 *synthesis_resample_and_mix_reverb(u64 *cmd, s32 bufLen, s16 reverbIndex, s1
aAddMixer(cmd++, DMEM_ADDR_WET_LEFT_CH, DMEM_ADDR_LEFT_CH, DEFAULT_LEN_2CH);
aMix(cmd++, 0x8000 + gSynthesisReverbs[reverbIndex].reverbGain, DMEM_ADDR_WET_LEFT_CH, DMEM_ADDR_WET_LEFT_CH, DEFAULT_LEN_2CH);
}
if (gSynthesisReverbs[reverbIndex].panRight != 0 || gSynthesisReverbs[reverbIndex].panLeft != 0) {
if (gSynthesisReverbs[reverbIndex].panRight != 0 || gSynthesisReverbs[reverbIndex].panLeft != 0)
{
// Leak some audio from the left reverb channel into the right reverb channel and vice versa (pan)
aDMEMMove(cmd++, DMEM_ADDR_WET_LEFT_CH, DMEM_ADDR_RESAMPLED, DEFAULT_LEN_1CH);
aMix(cmd++, gSynthesisReverbs[reverbIndex].panRight, DMEM_ADDR_WET_RIGHT_CH, DMEM_ADDR_WET_LEFT_CH, DEFAULT_LEN_1CH);
@@ -247,7 +290,8 @@ u64 *synthesis_resample_and_mix_reverb(u64 *cmd, s32 bufLen, s16 reverbIndex, s1
return cmd;
}
u64 *synthesis_load_reverb_samples(u64 *cmd, s16 reverbIndex, s16 updateIndex) {
u64 *synthesis_load_reverb_samples(u64 *cmd, s16 reverbIndex, s16 updateIndex)
{
struct ReverbRingBufferItem *item;
struct SynthesisReverb *reverb;
@@ -255,22 +299,26 @@ u64 *synthesis_load_reverb_samples(u64 *cmd, s16 reverbIndex, s16 updateIndex) {
item = &reverb->items[reverb->curFrame][updateIndex];
// Get the oldest samples in the ring buffer into the wet channels
cmd = synthesis_load_reverb_ring_buffer(cmd, DMEM_ADDR_RESAMPLED, item->startPos, item->lengthA, reverbIndex);
if (item->lengthB != 0) {
if (item->lengthB != 0)
{
// Ring buffer wrapped
cmd = synthesis_load_reverb_ring_buffer(cmd, DMEM_ADDR_RESAMPLED + item->lengthA, 0, item->lengthB, reverbIndex);
}
return cmd;
}
u64 *synthesis_save_reverb_samples(u64 *cmd, s16 reverbIndex, s16 updateIndex) {
u64 *synthesis_save_reverb_samples(u64 *cmd, s16 reverbIndex, s16 updateIndex)
{
struct ReverbRingBufferItem *item;
item = &gSynthesisReverbs[reverbIndex].items[gSynthesisReverbs[reverbIndex].curFrame][updateIndex];
switch (gSynthesisReverbs[reverbIndex].downsampleRate) {
switch (gSynthesisReverbs[reverbIndex].downsampleRate)
{
case 1:
// Put the oldest samples in the ring buffer into the wet channels
cmd = synthesis_save_reverb_ring_buffer(cmd, DMEM_ADDR_WET_LEFT_CH, item->startPos, item->lengthA, reverbIndex);
if (item->lengthB != 0) {
if (item->lengthB != 0)
{
// Ring buffer wrapped
cmd = synthesis_save_reverb_ring_buffer(cmd, DMEM_ADDR_WET_LEFT_CH + item->lengthA, 0, item->lengthB, reverbIndex);
}
@@ -287,7 +335,8 @@ u64 *synthesis_save_reverb_samples(u64 *cmd, s16 reverbIndex, s16 updateIndex) {
return cmd;
}
u64 *func_sh_802EDF24(u64 *cmd, s16 reverbIndex, s16 updateIndex) {
u64 *func_sh_802EDF24(u64 *cmd, s16 reverbIndex, s16 updateIndex)
{
struct ReverbRingBufferItem *item;
struct SynthesisReverb *reverb;
@@ -295,14 +344,16 @@ u64 *func_sh_802EDF24(u64 *cmd, s16 reverbIndex, s16 updateIndex) {
item = &reverb->items[reverb->curFrame][updateIndex];
// Put the oldest samples in the ring buffer into the wet channels
cmd = synthesis_save_reverb_ring_buffer(cmd, DMEM_ADDR_RESAMPLED, item->startPos, item->lengthA, reverbIndex);
if (item->lengthB != 0) {
if (item->lengthB != 0)
{
// Ring buffer wrapped
cmd = synthesis_save_reverb_ring_buffer(cmd, DMEM_ADDR_RESAMPLED + item->lengthA, 0, item->lengthB, reverbIndex);
}
return cmd;
}
u64 *synthesis_do_one_audio_update(s16 *aiBuf, s32 bufLen, u64 *cmd, s32 updateIndex) {
u64 *synthesis_do_one_audio_update(s16 *aiBuf, s32 bufLen, u64 *cmd, s32 updateIndex)
{
struct NoteSubEu *noteSubEu;
u8 noteIndices[56];
s32 temp;
@@ -310,60 +361,81 @@ u64 *synthesis_do_one_audio_update(s16 *aiBuf, s32 bufLen, u64 *cmd, s32 updateI
s16 j;
s16 notePos = 0;
if (gNumSynthesisReverbs == 0) {
for (i = 0; i < gMaxSimultaneousNotes; i++) {
if (gNoteSubsEu[gMaxSimultaneousNotes * updateIndex + i].enabled) {
if (gNumSynthesisReverbs == 0)
{
for (i = 0; i < gMaxSimultaneousNotes; i++)
{
if (gNoteSubsEu[gMaxSimultaneousNotes * updateIndex + i].enabled)
{
noteIndices[notePos++] = i;
}
}
} else {
for (j = 0; j < gNumSynthesisReverbs; j++) {
for (i = 0; i < gMaxSimultaneousNotes; i++) {
}
else
{
for (j = 0; j < gNumSynthesisReverbs; j++)
{
for (i = 0; i < gMaxSimultaneousNotes; i++)
{
noteSubEu = &gNoteSubsEu[gMaxSimultaneousNotes * updateIndex + i];
if (noteSubEu->enabled && j == noteSubEu->reverbIndex) {
if (noteSubEu->enabled && j == noteSubEu->reverbIndex)
{
noteIndices[notePos++] = i;
}
}
}
for (i = 0; i < gMaxSimultaneousNotes; i++) {
for (i = 0; i < gMaxSimultaneousNotes; i++)
{
noteSubEu = &gNoteSubsEu[gMaxSimultaneousNotes * updateIndex + i];
if (noteSubEu->enabled && noteSubEu->reverbIndex >= gNumSynthesisReverbs) {
if (noteSubEu->enabled && noteSubEu->reverbIndex >= gNumSynthesisReverbs)
{
noteIndices[notePos++] = i;
}
}
}
aClearBuffer(cmd++, DMEM_ADDR_LEFT_CH, DEFAULT_LEN_2CH);
i = 0;
for (j = 0; j < gNumSynthesisReverbs; j++) {
for (j = 0; j < gNumSynthesisReverbs; j++)
{
gUseReverb = gSynthesisReverbs[j].useReverb;
if (gUseReverb != 0) {
if (gUseReverb != 0)
{
cmd = synthesis_resample_and_mix_reverb(cmd, bufLen, j, updateIndex);
}
for (; i < notePos; i++) {
for (; i < notePos; i++)
{
temp = updateIndex * gMaxSimultaneousNotes;
if (j == gNoteSubsEu[temp + noteIndices[i]].reverbIndex) {
if (j == gNoteSubsEu[temp + noteIndices[i]].reverbIndex)
{
cmd = synthesis_process_note(noteIndices[i],
&gNoteSubsEu[temp + noteIndices[i]],
&gNotes[noteIndices[i]].synthesisState,
aiBuf, bufLen, cmd, updateIndex);
continue;
} else {
}
else
{
break;
}
}
if (gSynthesisReverbs[j].useReverb != 0) {
if (gSynthesisReverbs[j].unk100 != NULL) {
if (gSynthesisReverbs[j].useReverb != 0)
{
if (gSynthesisReverbs[j].unk100 != NULL)
{
aFilter(cmd++, 0x02, bufLen * 2, gSynthesisReverbs[j].unk100);
aFilter(cmd++, gSynthesisReverbs[j].resampleFlags, DMEM_ADDR_WET_LEFT_CH, gSynthesisReverbs[j].unk108);
}
if (gSynthesisReverbs[j].unk104 != NULL) {
if (gSynthesisReverbs[j].unk104 != NULL)
{
aFilter(cmd++, 0x02, bufLen * 2, gSynthesisReverbs[j].unk104);
aFilter(cmd++, gSynthesisReverbs[j].resampleFlags, DMEM_ADDR_WET_RIGHT_CH, gSynthesisReverbs[j].unk10C);
}
cmd = synthesis_save_reverb_samples(cmd, j, updateIndex);
if (gSynthesisReverbs[j].unk5 != -1) {
if (gSynthesisReverbs[gSynthesisReverbs[j].unk5].downsampleRate == 1) {
if (gSynthesisReverbs[j].unk5 != -1)
{
if (gSynthesisReverbs[gSynthesisReverbs[j].unk5].downsampleRate == 1)
{
cmd = synthesis_load_reverb_samples(cmd, gSynthesisReverbs[j].unk5, updateIndex);
aMix(cmd++, gSynthesisReverbs[j].unk08, DMEM_ADDR_WET_LEFT_CH, DMEM_ADDR_RESAMPLED, DEFAULT_LEN_2CH);
cmd = func_sh_802EDF24(cmd++, gSynthesisReverbs[j].unk5, updateIndex);
@@ -371,7 +443,8 @@ u64 *synthesis_do_one_audio_update(s16 *aiBuf, s32 bufLen, u64 *cmd, s32 updateI
}
}
}
for (; i < notePos; i++) {
for (; i < notePos; i++)
{
struct NoteSubEu *noteSubEu2 = &gNoteSubsEu[updateIndex * gMaxSimultaneousNotes + noteIndices[i]];
cmd = synthesis_process_note(noteIndices[i],
noteSubEu2,
@@ -385,7 +458,8 @@ u64 *synthesis_do_one_audio_update(s16 *aiBuf, s32 bufLen, u64 *cmd, s32 updateI
return cmd;
}
u64 *synthesis_process_note(s32 noteIndex, struct NoteSubEu *noteSubEu, struct NoteSynthesisState *synthesisState, UNUSED s16 *aiBuf, s32 bufLen, u64 *cmd, s32 updateIndex) {
u64 *synthesis_process_note(s32 noteIndex, struct NoteSubEu *noteSubEu, struct NoteSynthesisState *synthesisState, UNUSED s16 *aiBuf, s32 bufLen, u64 *cmd, s32 updateIndex)
{
UNUSED s32 pad0[3];
struct AudioBankSample *audioBookSample; // sp164, sp138
struct AdpcmLoop *loopInfo; // sp160, sp134
@@ -441,7 +515,8 @@ u64 *synthesis_process_note(s32 noteIndex, struct NoteSubEu *noteSubEu, struct N
curLoadedBook = NULL;
note = &gNotes[noteIndex];
flags = 0;
if (noteSubEu->needsInit == TRUE) {
if (noteSubEu->needsInit == TRUE)
{
flags = A_INIT;
synthesisState->restart = 0;
synthesisState->samplePosInt = 0;
@@ -461,46 +536,63 @@ u64 *synthesis_process_note(s32 noteIndex, struct NoteSubEu *noteSubEu, struct N
nSamplesToLoad = (samplesLenFixedPoint >> 0x10);
synthesisState->samplePosFrac = samplesLenFixedPoint & 0xFFFF;
if ((synthesisState->unk5 == 1) && (nParts == 2)) {
if ((synthesisState->unk5 == 1) && (nParts == 2))
{
nSamplesToLoad += 2;
sp56 = 2;
} else if ((synthesisState->unk5 == 2) && (nParts == 1)) {
}
else if ((synthesisState->unk5 == 2) && (nParts == 1))
{
nSamplesToLoad -= 4;
sp56 = 4;
} else {
}
else
{
sp56 = 0;
}
synthesisState->unk5 = nParts;
if (noteSubEu->isSyntheticWave) {
if (noteSubEu->isSyntheticWave)
{
cmd = load_wave_samples(cmd, noteSubEu, synthesisState, nSamplesToLoad);
noteSamplesDmemAddrBeforeResampling = (synthesisState->samplePosInt * 2) + DMEM_ADDR_UNCOMPRESSED_NOTE;
synthesisState->samplePosInt += nSamplesToLoad;
} else {
}
else
{
// ADPCM note
audioBookSample = noteSubEu->sound.audioBankSound->sample;
loopInfo = audioBookSample->loop;
endPos = loopInfo->end;
sampleAddr = audioBookSample->sampleAddr;
resampledTempLen = 0;
for (curPart = 0; curPart < nParts; curPart++) {
for (curPart = 0; curPart < nParts; curPart++)
{
nAdpcmSamplesProcessed = 0; // s8
s5 = 0; // s4
if (nParts == 1) {
if (nParts == 1)
{
samplesLenAdjusted = nSamplesToLoad;
} else if (nSamplesToLoad & 1) {
}
else if (nSamplesToLoad & 1)
{
samplesLenAdjusted = (nSamplesToLoad & ~1) + (curPart * 2);
} else {
}
else
{
samplesLenAdjusted = nSamplesToLoad;
}
if (audioBookSample->codec == CODEC_ADPCM) {
if (curLoadedBook != (*audioBookSample->book).book) {
if (audioBookSample->codec == CODEC_ADPCM)
{
if (curLoadedBook != (*audioBookSample->book).book)
{
u32 nEntries;
switch (noteSubEu->bookOffset) {
switch (noteSubEu->bookOffset)
{
case 1:
curLoadedBook = euUnknownData_80301950 + 1;
break;
@@ -517,7 +609,8 @@ u64 *synthesis_process_note(s32 noteIndex, struct NoteSubEu *noteSubEu, struct N
}
}
while (nAdpcmSamplesProcessed != samplesLenAdjusted) {
while (nAdpcmSamplesProcessed != samplesLenAdjusted)
{
s32 samplesRemaining; // v1
s32 s0;
@@ -527,30 +620,39 @@ u64 *synthesis_process_note(s32 noteIndex, struct NoteSubEu *noteSubEu, struct N
samplesRemaining = endPos - synthesisState->samplePosInt;
nSamplesToProcess = samplesLenAdjusted - nAdpcmSamplesProcessed;
if (s2 == 0 && synthesisState->restart == FALSE) {
if (s2 == 0 && synthesisState->restart == FALSE)
{
s2 = 16;
}
s6 = 16 - s2; // a1
if (nSamplesToProcess < samplesRemaining) {
if (nSamplesToProcess < samplesRemaining)
{
t0 = (nSamplesToProcess - s6 + 0xf) / 16;
s0 = t0 * 16;
s3 = s6 + s0 - nSamplesToProcess;
} else {
}
else
{
s0 = samplesRemaining - s6;
s3 = 0;
if (s0 <= 0) {
if (s0 <= 0)
{
s0 = 0;
s6 = samplesRemaining;
}
t0 = (s0 + 0xf) / 16;
if (loopInfo->count != 0) {
if (loopInfo->count != 0)
{
// Loop around and restart
restart = 1;
} else {
}
else
{
noteFinished = 1;
}
}
switch (audioBookSample->codec) {
switch (audioBookSample->codec)
{
case CODEC_ADPCM:
unk_s6 = 9;
sp88 = 0x10;
@@ -561,13 +663,18 @@ u64 *synthesis_process_note(s32 noteIndex, struct NoteSubEu *noteSubEu, struct N
sp88 = 0x10;
sp84 = 0;
break;
case CODEC_SKIP: goto skip;
case CODEC_SKIP:
goto skip;
}
if (t0 != 0) {
if (t0 != 0)
{
temp = (synthesisState->samplePosInt + sp88 - s2) / 16;
if (audioBookSample->medium == 0) {
if (audioBookSample->medium == 0)
{
v0_2 = sp84 + (temp * unk_s6) + sampleAddr;
} else {
}
else
{
v0_2 = dma_sample_data((uintptr_t)(sp84 + (temp * unk_s6) + sampleAddr),
ALIGN(t0 * unk_s6 + 16, 4), flags, &synthesisState->sampleDmaIndex, audioBookSample->medium);
}
@@ -576,18 +683,23 @@ u64 *synthesis_process_note(s32 noteIndex, struct NoteSubEu *noteSubEu, struct N
aligned = ALIGN(t0 * unk_s6 + 16, 4);
addr = (DMEM_ADDR_COMPRESSED_ADPCM_DATA - aligned) & 0xffff;
aLoadBuffer(cmd++, VIRTUAL_TO_PHYSICAL2(v0_2 - a3), addr, ALIGN(t0 * unk_s6 + 16, 4));
} else {
}
else
{
s0 = 0;
a3 = 0;
}
if (synthesisState->restart != FALSE) {
if (synthesisState->restart != FALSE)
{
aSetLoop(cmd++, VIRTUAL_TO_PHYSICAL2(audioBookSample->loop->state));
flags = A_LOOP; // = 2
synthesisState->restart = FALSE;
}
nSamplesInThisIteration = s0 + s6 - s3;
if (nAdpcmSamplesProcessed == 0) {
switch (audioBookSample->codec) {
if (nAdpcmSamplesProcessed == 0)
{
switch (audioBookSample->codec)
{
case CODEC_ADPCM:
aligned = ALIGN(t0 * unk_s6 + 16, 4);
addr = (DMEM_ADDR_COMPRESSED_ADPCM_DATA - aligned) & 0xffff;
@@ -602,9 +714,12 @@ u64 *synthesis_process_note(s32 noteIndex, struct NoteSubEu *noteSubEu, struct N
break;
}
sp130 = s2 * 2;
} else {
}
else
{
s5Aligned = ALIGN(s5 + 16, 4);
switch (audioBookSample->codec) {
switch (audioBookSample->codec)
{
case CODEC_ADPCM:
aligned = ALIGN(t0 * unk_s6 + 16, 4);
addr = (DMEM_ADDR_COMPRESSED_ADPCM_DATA - aligned) & 0xffff;
@@ -621,7 +736,8 @@ u64 *synthesis_process_note(s32 noteIndex, struct NoteSubEu *noteSubEu, struct N
aDMEMMove(cmd++, DMEM_ADDR_UNCOMPRESSED_NOTE + s5Aligned + (s2 * 2), DMEM_ADDR_UNCOMPRESSED_NOTE + s5, (nSamplesInThisIteration) * 2);
}
nAdpcmSamplesProcessed += nSamplesInThisIteration;
switch (flags) {
switch (flags)
{
case A_INIT: // = 1
sp130 = 0x20;
s5 = (s0 + 0x10) * 2;
@@ -630,16 +746,19 @@ u64 *synthesis_process_note(s32 noteIndex, struct NoteSubEu *noteSubEu, struct N
s5 = (nSamplesInThisIteration) * 2 + s5;
break;
default:
if (s5 != 0) {
if (s5 != 0)
{
s5 = (nSamplesInThisIteration) * 2 + s5;
} else {
}
else
{
s5 = (s2 + (nSamplesInThisIteration)) * 2;
}
break;
}
flags = 0;
skip:
if (noteFinished) {
skip: if (noteFinished)
{
aClearBuffer(cmd++, DMEM_ADDR_UNCOMPRESSED_NOTE + s5,
(samplesLenAdjusted - nAdpcmSamplesProcessed) * 2);
noteSubEu->finished = 1;
@@ -647,25 +766,31 @@ skip:
func_sh_802ed644(updateIndex, noteIndex);
break;
}
if (restart != 0) {
if (restart != 0)
{
synthesisState->restart = TRUE;
synthesisState->samplePosInt = loopInfo->start;
} else {
}
else
{
synthesisState->samplePosInt += nSamplesToProcess;
}
}
switch (nParts) {
switch (nParts)
{
case 1:
noteSamplesDmemAddrBeforeResampling = DMEM_ADDR_UNCOMPRESSED_NOTE + sp130;
break;
case 2:
switch (curPart) {
switch (curPart)
{
case 0:
aDownsampleHalf(cmd++, ALIGN(samplesLenAdjusted / 2, 3), DMEM_ADDR_UNCOMPRESSED_NOTE + sp130, DMEM_ADDR_RESAMPLED);
resampledTempLen = samplesLenAdjusted;
noteSamplesDmemAddrBeforeResampling = DMEM_ADDR_RESAMPLED;
if (noteSubEu->finished != FALSE) {
if (noteSubEu->finished != FALSE)
{
aClearBuffer(cmd++, noteSamplesDmemAddrBeforeResampling + resampledTempLen, samplesLenAdjusted + 0x10);
}
break;
@@ -674,52 +799,65 @@ skip:
break;
}
}
if (noteSubEu->finished != FALSE) {
if (noteSubEu->finished != FALSE)
{
break;
}
}
}
flags = 0;
if (noteSubEu->needsInit == TRUE) {
if (noteSubEu->needsInit == TRUE)
{
flags = A_INIT;
noteSubEu->needsInit = FALSE;
}
flags = flags | sp56;
cmd = final_resample(cmd, synthesisState, bufLen * 2, resamplingRateFixedPoint,
noteSamplesDmemAddrBeforeResampling, flags);
if ((flags & 1) != 0) {
if ((flags & 1) != 0)
{
flags = 1;
}
if (noteSubEu->filter) {
if (noteSubEu->filter)
{
aFilter(cmd++, 0x02, bufLen * 2, noteSubEu->filter);
aFilter(cmd++, flags, DMEM_ADDR_TEMP, synthesisState->synthesisBuffers->filterBuffer);
}
if (noteSubEu->bookOffset == 3) {
if (noteSubEu->bookOffset == 3)
{
aUnknown25(cmd++, 0, bufLen * 2, DMEM_ADDR_TEMP, DMEM_ADDR_TEMP);
}
synthesisVolume = noteSubEu->synthesisVolume;
if (synthesisVolume != 0) {
if (synthesisVolume < 0x10) {
if (synthesisVolume != 0)
{
if (synthesisVolume < 0x10)
{
synthesisVolume = 0x10;
}
aHiLoGain(cmd++, synthesisVolume, (bufLen + 0x10) * 2, DMEM_ADDR_TEMP);
}
if (noteSubEu->headsetPanRight != 0 || synthesisState->prevHeadsetPanRight != 0) {
if (noteSubEu->headsetPanRight != 0 || synthesisState->prevHeadsetPanRight != 0)
{
leftRight = 1;
} else if (noteSubEu->headsetPanLeft != 0 || synthesisState->prevHeadsetPanLeft != 0) {
}
else if (noteSubEu->headsetPanLeft != 0 || synthesisState->prevHeadsetPanLeft != 0)
{
leftRight = 2;
} else {
}
else
{
leftRight = 0;
}
cmd = process_envelope(cmd, noteSubEu, synthesisState, bufLen, DMEM_ADDR_TEMP, leftRight, flags);
if (noteSubEu->usesHeadsetPanEffects) {
if ((flags & 1) == 0) {
if (noteSubEu->usesHeadsetPanEffects)
{
if ((flags & 1) == 0)
{
flags = 0;
}
cmd = note_apply_headset_pan_effects(cmd, noteSubEu, synthesisState, bufLen * 2, flags, leftRight);
@@ -728,7 +866,8 @@ skip:
return cmd;
}
u64 *load_wave_samples(u64 *cmd, struct NoteSubEu *noteSubEu, struct NoteSynthesisState *synthesisState, s32 nSamplesToLoad) {
u64 *load_wave_samples(u64 *cmd, struct NoteSubEu *noteSubEu, struct NoteSynthesisState *synthesisState, s32 nSamplesToLoad)
{
s32 a3;
s32 repeats;
aLoadBuffer(cmd++, VIRTUAL_TO_PHYSICAL2(noteSubEu->sound.samples),
@@ -736,9 +875,11 @@ u64 *load_wave_samples(u64 *cmd, struct NoteSubEu *noteSubEu, struct NoteSynthes
synthesisState->samplePosInt &= 0x3f;
a3 = 64 - synthesisState->samplePosInt;
if (a3 < nSamplesToLoad) {
if (a3 < nSamplesToLoad)
{
repeats = (nSamplesToLoad - a3 + 63) / 64;
if (repeats != 0) {
if (repeats != 0)
{
aDuplicate(cmd++,
/*dmemin*/ DMEM_ADDR_UNCOMPRESSED_NOTE,
/*dmemout*/ DMEM_ADDR_UNCOMPRESSED_NOTE + 128,
@@ -748,17 +889,22 @@ u64 *load_wave_samples(u64 *cmd, struct NoteSubEu *noteSubEu, struct NoteSynthes
return cmd;
}
u64 *final_resample(u64 *cmd, struct NoteSynthesisState *synthesisState, s32 count, u16 pitch, u16 dmemIn, u32 flags) {
if (pitch == 0) {
u64 *final_resample(u64 *cmd, struct NoteSynthesisState *synthesisState, s32 count, u16 pitch, u16 dmemIn, u32 flags)
{
if (pitch == 0)
{
aClearBuffer(cmd++, DMEM_ADDR_TEMP, count);
} else {
}
else
{
aSetBuffer(cmd++, /*flags*/ 0, dmemIn, /*dmemout*/ DMEM_ADDR_TEMP, count);
aResample(cmd++, flags, pitch, VIRTUAL_TO_PHYSICAL2(synthesisState->synthesisBuffers->finalResampleState));
}
return cmd;
}
u64 *process_envelope(u64 *cmd, struct NoteSubEu *note, struct NoteSynthesisState *synthesisState, s32 nSamples, u16 inBuf, s32 headsetPanSettings, UNUSED u32 flags) {
u64 *process_envelope(u64 *cmd, struct NoteSubEu *note, struct NoteSynthesisState *synthesisState, s32 nSamples, u16 inBuf, s32 headsetPanSettings, UNUSED u32 flags)
{
u16 sourceRight;
u16 sourceLeft;
u16 targetLeft;
@@ -776,34 +922,45 @@ u64 *process_envelope(u64 *cmd, struct NoteSubEu *note, struct NoteSynthesisStat
targetLeft <<= 4;
targetRight <<= 4;
if (targetLeft != sourceLeft) {
if (targetLeft != sourceLeft)
{
rampLeft = (targetLeft - sourceLeft) / (nSamples >> 3);
} else {
}
else
{
rampLeft = 0;
}
if (targetRight != sourceRight) {
if (targetRight != sourceRight)
{
rampRight = (targetRight - sourceRight) / (nSamples >> 3);
} else {
}
else
{
rampRight = 0;
}
sourceReverbVol = synthesisState->reverbVol;
if (note->reverbVol != sourceReverbVol) {
if (note->reverbVol != sourceReverbVol)
{
reverbVolDiff = ((note->reverbVol & 0x7f) - (sourceReverbVol & 0x7f)) << 9;
rampReverb = reverbVolDiff / (nSamples >> 3);
synthesisState->reverbVol = note->reverbVol;
} else {
}
else
{
rampReverb = 0;
}
synthesisState->curVolLeft = sourceLeft + rampLeft * (nSamples >> 3);
synthesisState->curVolRight = sourceRight + rampRight * (nSamples >> 3);
if (note->usesHeadsetPanEffects) {
if (note->usesHeadsetPanEffects)
{
aClearBuffer(cmd++, DMEM_ADDR_NOTE_PAN_TEMP, DEFAULT_LEN_1CH);
aEnvSetup1(cmd++, (sourceReverbVol & 0x7f) * 2, rampReverb, rampLeft, rampRight);
aEnvSetup2(cmd++, sourceLeft, sourceRight);
switch (headsetPanSettings) {
switch (headsetPanSettings)
{
case 1:
aEnvMixer(cmd++,
inBuf, nSamples,
@@ -835,7 +992,9 @@ u64 *process_envelope(u64 *cmd, struct NoteSubEu *note, struct NoteSynthesisStat
DMEM_ADDR_WET_RIGHT_CH);
break;
}
} else {
}
else
{
aEnvSetup1(cmd++, (sourceReverbVol & 0x7f) * 2, rampReverb, rampLeft, rampRight);
aEnvSetup2(cmd++, sourceLeft, sourceRight);
aEnvMixer(cmd++,
@@ -850,14 +1009,16 @@ u64 *process_envelope(u64 *cmd, struct NoteSubEu *note, struct NoteSynthesisStat
return cmd;
}
u64 *note_apply_headset_pan_effects(u64 *cmd, struct NoteSubEu *noteSubEu, struct NoteSynthesisState *note, s32 bufLen, s32 flags, s32 leftRight) {
u64 *note_apply_headset_pan_effects(u64 *cmd, struct NoteSubEu *noteSubEu, struct NoteSynthesisState *note, s32 bufLen, s32 flags, s32 leftRight)
{
u16 dest;
u16 pitch;
u8 prevPanShift;
u8 panShift;
UNUSED u8 unkDebug;
switch (leftRight) {
switch (leftRight)
{
case 1:
dest = DMEM_ADDR_LEFT_CH;
panShift = noteSubEu->headsetPanRight;
@@ -877,31 +1038,41 @@ u64 *note_apply_headset_pan_effects(u64 *cmd, struct NoteSubEu *noteSubEu, struc
return cmd;
}
if (flags != 1) { // A_INIT?
if (flags != 1)
{ // A_INIT?
// Slightly adjust the sample rate in order to fit a change in pan shift
if (panShift != prevPanShift) {
if (panShift != prevPanShift)
{
pitch = (((bufLen << 0xf) / 2) - 1) / ((bufLen + panShift - prevPanShift - 2) / 2);
aSetBuffer(cmd++, 0, DMEM_ADDR_NOTE_PAN_TEMP, DMEM_ADDR_TEMP, (bufLen + panShift) - prevPanShift);
aResampleZoh(cmd++, pitch, 0);
} else {
}
else
{
aDMEMMove(cmd++, DMEM_ADDR_NOTE_PAN_TEMP, DMEM_ADDR_TEMP, bufLen);
}
if (prevPanShift != 0) {
if (prevPanShift != 0)
{
aLoadBuffer(cmd++, VIRTUAL_TO_PHYSICAL2(note->synthesisBuffers->panSamplesBuffer),
DMEM_ADDR_NOTE_PAN_TEMP, ALIGN(prevPanShift, 4));
aDMEMMove(cmd++, DMEM_ADDR_TEMP, DMEM_ADDR_NOTE_PAN_TEMP + prevPanShift, bufLen + panShift - prevPanShift);
} else {
}
else
{
aDMEMMove(cmd++, DMEM_ADDR_TEMP, DMEM_ADDR_NOTE_PAN_TEMP, bufLen + panShift);
}
} else {
}
else
{
// Just shift right
aDMEMMove(cmd++, DMEM_ADDR_NOTE_PAN_TEMP, DMEM_ADDR_TEMP, bufLen);
aClearBuffer(cmd++, DMEM_ADDR_NOTE_PAN_TEMP, panShift);
aDMEMMove(cmd++, DMEM_ADDR_TEMP, DMEM_ADDR_NOTE_PAN_TEMP + panShift, bufLen);
}
if (panShift) {
if (panShift)
{
// Save excessive samples for next iteration
aSaveBuffer(cmd++, DMEM_ADDR_NOTE_PAN_TEMP + bufLen,
VIRTUAL_TO_PHYSICAL2(note->synthesisBuffers->panSamplesBuffer), ALIGN(panShift, 4));
+126 -113
View File
@@ -108,7 +108,8 @@ u32 unused_8038B894[3] = { 0 };
0x00: Branch and store return address
cmd+0x04: void *branchTarget
*/
void geo_layout_cmd_branch_and_link(void) {
void geo_layout_cmd_branch_and_link(void)
{
gGeoLayoutStack[gGeoLayoutStackIndex++] = (uintptr_t)(gGeoLayoutCommand + CMD_PROCESS_OFFSET(8));
gGeoLayoutStack[gGeoLayoutStackIndex++] = (gCurGraphNodeIndex << 16) + gGeoLayoutReturnIndex;
gGeoLayoutReturnIndex = gGeoLayoutStackIndex;
@@ -116,7 +117,8 @@ void geo_layout_cmd_branch_and_link(void) {
}
// 0x01: Terminate geo layout
void geo_layout_cmd_end(void) {
void geo_layout_cmd_end(void)
{
gGeoLayoutStackIndex = gGeoLayoutReturnIndex;
gGeoLayoutReturnIndex = gGeoLayoutStack[--gGeoLayoutStackIndex] & 0xFFFF;
gCurGraphNodeIndex = gGeoLayoutStack[gGeoLayoutStackIndex] >> 16;
@@ -127,8 +129,10 @@ void geo_layout_cmd_end(void) {
0x02: Branch
cmd+0x04: void *branchTarget
*/
void geo_layout_cmd_branch(void) {
if (cur_geo_cmd_u8(0x01) == 1) {
void geo_layout_cmd_branch(void)
{
if (cur_geo_cmd_u8(0x01) == 1)
{
gGeoLayoutStack[gGeoLayoutStackIndex++] = (uintptr_t)(gGeoLayoutCommand + CMD_PROCESS_OFFSET(8));
}
@@ -136,19 +140,22 @@ void geo_layout_cmd_branch(void) {
}
// 0x03: Return from branch
void geo_layout_cmd_return(void) {
void geo_layout_cmd_return(void)
{
gGeoLayoutCommand = (u8 *)gGeoLayoutStack[--gGeoLayoutStackIndex];
}
// 0x04: Open node
void geo_layout_cmd_open_node(void) {
void geo_layout_cmd_open_node(void)
{
gCurGraphNodeList[gCurGraphNodeIndex + 1] = gCurGraphNodeList[gCurGraphNodeIndex];
gCurGraphNodeIndex++;
gGeoLayoutCommand += 0x04 << CMD_SIZE_SHIFT;
}
// 0x05: Close node
void geo_layout_cmd_close_node(void) {
void geo_layout_cmd_close_node(void)
{
gCurGraphNodeIndex--;
gGeoLayoutCommand += 0x04 << CMD_SIZE_SHIFT;
}
@@ -159,10 +166,12 @@ void geo_layout_cmd_close_node(void) {
Register the current node in the gGeoViews array at the given index
*/
void geo_layout_cmd_assign_as_view(void) {
void geo_layout_cmd_assign_as_view(void)
{
u16 index = cur_geo_cmd_s16(0x02);
if (index < gGeoNumViews) {
if (index < gGeoNumViews)
{
gGeoViews[index] = gCurGraphNodeList[gCurGraphNodeIndex];
}
@@ -174,11 +183,13 @@ void geo_layout_cmd_assign_as_view(void) {
cmd+0x01: u8 operation (0 = reset, 1 = set, 2 = clear)
cmd+0x02: s16 bits
*/
void geo_layout_cmd_update_node_flags(void) {
void geo_layout_cmd_update_node_flags(void)
{
u16 operation = cur_geo_cmd_u8(0x01);
u16 flagBits = cur_geo_cmd_s16(0x02);
switch (operation) {
switch (operation)
{
case GEO_CMD_FLAGS_RESET:
gCurGraphNodeList[gCurGraphNodeIndex]->flags = flagBits;
break;
@@ -201,10 +212,8 @@ void geo_layout_cmd_update_node_flags(void) {
cmd+0x08: s16 width
cmd+0x0A: s16 height
*/
void geo_layout_cmd_node_root(void) {
s32 i;
struct GraphNodeRoot *graphNode;
void geo_layout_cmd_node_root(void)
{
s16 x = cur_geo_cmd_s16(0x04);
s16 y = cur_geo_cmd_s16(0x06);
s16 width = cur_geo_cmd_s16(0x08);
@@ -215,7 +224,7 @@ void geo_layout_cmd_node_root(void) {
// cmd+0x02 = 0x00: Mario face, 0x0A: all other levels
gGeoNumViews = cur_geo_cmd_s16(0x02) + 2;
graphNode = init_graph_node_root(gGraphNodePool, NULL, 0, x, y, width, height);
struct GraphNodeRoot *graphNode = init_graph_node_root(gGraphNodePool, NULL, 0, x, y, width, height);
// gGeoViews is unused in libsm64
gGeoViews = NULL; // alloc_only_pool_alloc(gGraphNodePool, gGeoNumViews * sizeof(struct GraphNode *));
@@ -223,7 +232,8 @@ void geo_layout_cmd_node_root(void) {
graphNode->views = gGeoViews;
graphNode->numViews = gGeoNumViews;
for (i = 0; i < gGeoNumViews; i++) {
for (s32 i = 0; i < gGeoNumViews; i++)
{
gGeoViews[i] = NULL;
}
@@ -236,11 +246,11 @@ void geo_layout_cmd_node_root(void) {
0x09: Create orthographic projection scene graph node
cmd+0x02: s16 scale as a percentage (usually it's 100)
*/
void geo_layout_cmd_node_ortho_projection(void) {
struct GraphNodeOrthoProjection *graphNode;
void geo_layout_cmd_node_ortho_projection(void)
{
f32 scale = (f32)cur_geo_cmd_s16(0x02) / 100.0f;
graphNode = init_graph_node_ortho_projection(gGraphNodePool, NULL, scale);
struct GraphNodeOrthoProjection *graphNode = init_graph_node_ortho_projection(gGraphNodePool, NULL, scale);
register_scene_graph_node(&graphNode->node);
@@ -255,20 +265,21 @@ void geo_layout_cmd_node_ortho_projection(void) {
cmd+0x06: s16 far
[cmd+0x08: GraphNodeFunc frustumFunc]
*/
void geo_layout_cmd_node_perspective(void) {
struct GraphNodePerspective *graphNode;
void geo_layout_cmd_node_perspective(void)
{
GraphNodeFunc frustumFunc = NULL;
s16 fov = cur_geo_cmd_s16(0x02);
s16 near = cur_geo_cmd_s16(0x04);
s16 far = cur_geo_cmd_s16(0x06);
if (cur_geo_cmd_u8(0x01) != 0) {
if (cur_geo_cmd_u8(0x01) != 0)
{
// optional asm function
frustumFunc = (GraphNodeFunc)cur_geo_cmd_ptr(0x08);
gGeoLayoutCommand += 4 << CMD_SIZE_SHIFT;
}
graphNode = init_graph_node_perspective(gGraphNodePool, NULL, (f32) fov, near, far, frustumFunc, 0);
struct GraphNodePerspective *graphNode = init_graph_node_perspective(gGraphNodePool, NULL, fov, near, far, frustumFunc, 0);
register_scene_graph_node(&graphNode->fnNode.node);
@@ -279,10 +290,9 @@ void geo_layout_cmd_node_perspective(void) {
0x0B: Create a scene graph node that groups other nodes without any
additional functionality
*/
void geo_layout_cmd_node_start(void) {
struct GraphNodeStart *graphNode;
graphNode = init_graph_node_start(gGraphNodePool, NULL);
void geo_layout_cmd_node_start(void)
{
struct GraphNodeStart *graphNode = init_graph_node_start(gGraphNodePool, NULL);
register_scene_graph_node(&graphNode->node);
@@ -290,7 +300,8 @@ void geo_layout_cmd_node_start(void) {
}
// 0x1F: No operation
void geo_layout_cmd_nop3(void) {
void geo_layout_cmd_nop3(void)
{
gGeoLayoutCommand += 0x10 << CMD_SIZE_SHIFT;
}
@@ -298,10 +309,9 @@ void geo_layout_cmd_nop3(void) {
0x0C: Create zbuffer-toggling scene graph node
cmd+0x01: u8 enableZBuffer (1 = on, 0 = off)
*/
void geo_layout_cmd_node_master_list(void) {
struct GraphNodeMasterList *graphNode;
graphNode = init_graph_node_master_list(gGraphNodePool, NULL, cur_geo_cmd_u8(0x01));
void geo_layout_cmd_node_master_list(void)
{
struct GraphNodeMasterList *graphNode = init_graph_node_master_list(gGraphNodePool, NULL, cur_geo_cmd_u8(0x01));
register_scene_graph_node(&graphNode->node);
@@ -314,12 +324,12 @@ void geo_layout_cmd_node_master_list(void) {
cmd+0x04: s16 minDistance
cmd+0x06: s16 maxDistance
*/
void geo_layout_cmd_node_level_of_detail(void) {
struct GraphNodeLevelOfDetail *graphNode;
void geo_layout_cmd_node_level_of_detail(void)
{
s16 minDistance = cur_geo_cmd_s16(0x04);
s16 maxDistance = cur_geo_cmd_s16(0x06);
graphNode = init_graph_node_render_range(gGraphNodePool, NULL, minDistance, maxDistance);
struct GraphNodeLevelOfDetail *graphNode = init_graph_node_render_range(gGraphNodePool, NULL, minDistance, maxDistance);
register_scene_graph_node(&graphNode->node);
@@ -334,14 +344,12 @@ void geo_layout_cmd_node_level_of_detail(void) {
caseSelectorFunc returns an index which is used to select the child node to render.
Used for animating coins, blinking, color selection, etc.
*/
void geo_layout_cmd_node_switch_case(void) {
struct GraphNodeSwitchCase *graphNode;
graphNode =
init_graph_node_switch_case(gGraphNodePool, NULL,
void geo_layout_cmd_node_switch_case(void)
{
struct GraphNodeSwitchCase *graphNode = init_graph_node_switch_case(gGraphNodePool, NULL,
cur_geo_cmd_s16(0x02), // case which is initially selected
0,
(GraphNodeFunc) cur_geo_cmd_ptr(0x04), // case update function
cur_geo_cmd_ptr(0x04), // case update function
0);
register_scene_graph_node(&graphNode->fnNode.node);
@@ -360,8 +368,8 @@ void geo_layout_cmd_node_switch_case(void) {
cmd+0x0E: s16 focusZ
cmd+0x10: GraphNodeFunc func
*/
void geo_layout_cmd_node_camera(void) {
struct GraphNodeCamera *graphNode;
void geo_layout_cmd_node_camera(void)
{
s16 *cmdPos = (s16 *)&gGeoLayoutCommand[4];
Vec3f pos, focus;
@@ -369,8 +377,8 @@ void geo_layout_cmd_node_camera(void) {
cmdPos = read_vec3s_to_vec3f(pos, cmdPos);
cmdPos = read_vec3s_to_vec3f(focus, cmdPos);
graphNode = init_graph_node_camera(gGraphNodePool, NULL, pos, focus,
(GraphNodeFunc) cur_geo_cmd_ptr(0x10), cur_geo_cmd_s16(0x02));
struct GraphNodeCamera *graphNode = init_graph_node_camera(gGraphNodePool, NULL, pos, focus,
cur_geo_cmd_ptr(0x10), cur_geo_cmd_s16(0x02));
register_scene_graph_node(&graphNode->fnNode.node);
@@ -413,9 +421,8 @@ void geo_layout_cmd_node_camera(void) {
[cmd+var: void *displayList]
*/
void geo_layout_cmd_node_translation_rotation(void) {
struct GraphNodeTranslationRotation *graphNode;
void geo_layout_cmd_node_translation_rotation(void)
{
Vec3s translation, rotation;
void *displayList = NULL;
@@ -424,7 +431,8 @@ void geo_layout_cmd_node_translation_rotation(void) {
s16 params = cur_geo_cmd_u8(0x01);
s16 *cmdPos = (s16 *)gGeoLayoutCommand;
switch ((params & 0x70) >> 4) {
switch ((params & 0x70) >> 4)
{
case 0:
cmdPos = read_vec3s(translation, &cmdPos[2]);
cmdPos = read_vec3s_angle(rotation, cmdPos);
@@ -444,13 +452,14 @@ void geo_layout_cmd_node_translation_rotation(void) {
break;
}
if (params & 0x80) {
if (params & 0x80)
{
displayList = *(void **)&cmdPos[0];
drawingLayer = params & 0x0F;
cmdPos += 2 << CMD_SIZE_SHIFT;
}
graphNode = init_graph_node_translation_rotation(gGraphNodePool, NULL, drawingLayer, displayList,
struct GraphNodeTranslationRotation *graphNode = init_graph_node_translation_rotation(gGraphNodePool, NULL, drawingLayer, displayList,
translation, rotation);
register_scene_graph_node(&graphNode->node);
@@ -467,9 +476,8 @@ void geo_layout_cmd_node_translation_rotation(void) {
cmd+0x06: s16 zTranslation
[cmd+0x08: void *displayList]
*/
void geo_layout_cmd_node_translation(void) {
struct GraphNodeTranslation *graphNode;
void geo_layout_cmd_node_translation(void)
{
Vec3s translation;
s16 drawingLayer = 0;
@@ -479,14 +487,14 @@ void geo_layout_cmd_node_translation(void) {
cmdPos = read_vec3s(translation, &cmdPos[1]);
if (params & 0x80) {
if (params & 0x80)
{
displayList = *(void **)&cmdPos[0];
drawingLayer = params & 0x0F;
cmdPos += 2 << CMD_SIZE_SHIFT;
}
graphNode =
init_graph_node_translation(gGraphNodePool, NULL, drawingLayer, displayList, translation);
struct GraphNodeTranslation *graphNode = init_graph_node_translation(gGraphNodePool, NULL, drawingLayer, displayList, translation);
register_scene_graph_node(&graphNode->node);
@@ -503,9 +511,8 @@ void geo_layout_cmd_node_translation(void) {
cmd+0x06: s16 unkZ
[cmd+0x08: void *displayList]
*/
void geo_layout_cmd_node_rotation(void) {
struct GraphNodeRotation *graphNode;
void geo_layout_cmd_node_rotation(void)
{
Vec3s sp2c;
s16 drawingLayer = 0;
@@ -515,13 +522,14 @@ void geo_layout_cmd_node_rotation(void) {
cmdPos = read_vec3s_angle(sp2c, &cmdPos[1]);
if (params & 0x80) {
if (params & 0x80)
{
displayList = *(void **)&cmdPos[0];
drawingLayer = params & 0x0F;
cmdPos += 2 << CMD_SIZE_SHIFT;
}
graphNode = init_graph_node_rotation(gGraphNodePool, NULL, drawingLayer, displayList, sp2c);
struct GraphNodeRotation *graphNode = init_graph_node_rotation(gGraphNodePool, NULL, drawingLayer, displayList, sp2c);
register_scene_graph_node(&graphNode->node);
@@ -536,21 +544,21 @@ void geo_layout_cmd_node_rotation(void) {
cmd+0x04: u32 scale (0x10000 = 1.0)
[cmd+0x08: void *displayList]
*/
void geo_layout_cmd_node_scale(void) {
struct GraphNodeScale *graphNode;
void geo_layout_cmd_node_scale(void)
{
s16 drawingLayer = 0;
s16 params = cur_geo_cmd_u8(0x01);
f32 scale = cur_geo_cmd_u32(0x04) / 65536.0f;
void *displayList = NULL;
if (params & 0x80) {
if (params & 0x80)
{
displayList = cur_geo_cmd_ptr(0x08);
drawingLayer = params & 0x0F;
gGeoLayoutCommand += 4 << CMD_SIZE_SHIFT;
}
graphNode = init_graph_node_scale(gGraphNodePool, NULL, drawingLayer, displayList, scale);
struct GraphNodeScale *graphNode = init_graph_node_scale(gGraphNodePool, NULL, drawingLayer, displayList, scale);
register_scene_graph_node(&graphNode->node);
@@ -558,7 +566,8 @@ void geo_layout_cmd_node_scale(void) {
}
// 0x1E: No operation
void geo_layout_cmd_nop2(void) {
void geo_layout_cmd_nop2(void)
{
gGeoLayoutCommand += 0x08 << CMD_SIZE_SHIFT;
}
@@ -570,8 +579,8 @@ void geo_layout_cmd_nop2(void) {
cmd+0x06: s16 zTranslation
cmd+0x08: void *displayList
*/
void geo_layout_cmd_node_animated_part(void) {
struct GraphNodeAnimatedPart *graphNode;
void geo_layout_cmd_node_animated_part(void)
{
Vec3s translation;
s32 drawingLayer = cur_geo_cmd_u8(0x01);
void *displayList = cur_geo_cmd_ptr(0x08);
@@ -579,8 +588,7 @@ void geo_layout_cmd_node_animated_part(void) {
read_vec3s(translation, &cmdPos[1]);
graphNode =
init_graph_node_animated_part(gGraphNodePool, NULL, drawingLayer, displayList, translation);
struct GraphNodeAnimatedPart *graphNode = init_graph_node_animated_part(gGraphNodePool, NULL, drawingLayer, displayList, translation);
register_scene_graph_node(&graphNode->node);
@@ -597,8 +605,8 @@ void geo_layout_cmd_node_animated_part(void) {
cmd+0x06: s16 zTranslation
[cmd+0x08: void *displayList]
*/
void geo_layout_cmd_node_billboard(void) {
struct GraphNodeBillboard *graphNode;
void geo_layout_cmd_node_billboard(void)
{
Vec3s translation;
s16 drawingLayer = 0;
s16 params = cur_geo_cmd_u8(0x01);
@@ -607,13 +615,14 @@ void geo_layout_cmd_node_billboard(void) {
cmdPos = read_vec3s(translation, &cmdPos[1]);
if (params & 0x80) {
if (params & 0x80)
{
displayList = *(void **)&cmdPos[0];
drawingLayer = params & 0x0F;
cmdPos += 2 << CMD_SIZE_SHIFT;
}
graphNode = init_graph_node_billboard(gGraphNodePool, NULL, drawingLayer, displayList, translation);
struct GraphNodeBillboard *graphNode = init_graph_node_billboard(gGraphNodePool, NULL, drawingLayer, displayList, translation);
register_scene_graph_node(&graphNode->node);
@@ -625,12 +634,12 @@ void geo_layout_cmd_node_billboard(void) {
cmd+0x01: u8 drawingLayer
cmd+0x04: void *displayList
*/
void geo_layout_cmd_node_display_list(void) {
struct GraphNodeDisplayList *graphNode;
void geo_layout_cmd_node_display_list(void)
{
s32 drawingLayer = cur_geo_cmd_u8(0x01);
void *displayList = cur_geo_cmd_ptr(0x04);
graphNode = init_graph_node_display_list(gGraphNodePool, NULL, drawingLayer, displayList);
struct GraphNodeDisplayList *graphNode = init_graph_node_display_list(gGraphNodePool, NULL, drawingLayer, displayList);
register_scene_graph_node(&graphNode->node);
@@ -643,13 +652,13 @@ void geo_layout_cmd_node_display_list(void) {
cmd+0x04: s16 shadowSolidity
cmd+0x06: s16 shadowScale
*/
void geo_layout_cmd_node_shadow(void) {
struct GraphNodeShadow *graphNode;
void geo_layout_cmd_node_shadow(void)
{
u8 shadowType = cur_geo_cmd_s16(0x02);
u8 shadowSolidity = cur_geo_cmd_s16(0x04);
s16 shadowScale = cur_geo_cmd_s16(0x06);
graphNode = init_graph_node_shadow(gGraphNodePool, NULL, shadowScale, shadowSolidity, shadowType);
struct GraphNodeShadow *graphNode = init_graph_node_shadow(gGraphNodePool, NULL, shadowScale, shadowSolidity, shadowType);
register_scene_graph_node(&graphNode->node);
@@ -657,10 +666,9 @@ void geo_layout_cmd_node_shadow(void) {
}
// 0x17: Create scene graph node that manages the group of all object nodes
void geo_layout_cmd_node_object_parent(void) {
struct GraphNodeObjectParent *graphNode;
graphNode = init_graph_node_object_parent(gGraphNodePool, NULL, &gObjParentGraphNode);
void geo_layout_cmd_node_object_parent(void)
{
struct GraphNodeObjectParent *graphNode = init_graph_node_object_parent(gGraphNodePool, NULL, &gObjParentGraphNode);
register_scene_graph_node(&graphNode->node);
@@ -672,11 +680,10 @@ void geo_layout_cmd_node_object_parent(void) {
cmd+0x02: s16 parameter
cmd+0x04: GraphNodeFunc func
*/
void geo_layout_cmd_node_generated(void) {
struct GraphNodeGenerated *graphNode;
graphNode = init_graph_node_generated(gGraphNodePool, NULL,
(GraphNodeFunc) cur_geo_cmd_ptr(0x04), // asm function
void geo_layout_cmd_node_generated(void)
{
struct GraphNodeGenerated *graphNode = init_graph_node_generated(gGraphNodePool, NULL,
cur_geo_cmd_ptr(0x04), // asm function
cur_geo_cmd_s16(0x02)); // parameter
register_scene_graph_node(&graphNode->fnNode.node);
@@ -689,13 +696,12 @@ void geo_layout_cmd_node_generated(void) {
cmd+0x02: s16 background // background ID, or RGBA5551 color if backgroundFunc is null
cmd+0x04: GraphNodeFunc backgroundFunc
*/
void geo_layout_cmd_node_background(void) {
struct GraphNodeBackground *graphNode;
graphNode = init_graph_node_background(
void geo_layout_cmd_node_background(void)
{
struct GraphNodeBackground *graphNode = init_graph_node_background(
gGraphNodePool, NULL,
cur_geo_cmd_s16(0x02), // background ID, or RGBA5551 color if asm function is null
(GraphNodeFunc) cur_geo_cmd_ptr(0x04), // asm function
cur_geo_cmd_ptr(0x04), // asm function
0);
register_scene_graph_node(&graphNode->fnNode.node);
@@ -704,7 +710,8 @@ void geo_layout_cmd_node_background(void) {
}
// 0x1A: No operation
void geo_layout_cmd_nop(void) {
void geo_layout_cmd_nop(void)
{
gGeoLayoutCommand += 0x08 << CMD_SIZE_SHIFT;
}
@@ -713,22 +720,26 @@ void geo_layout_cmd_nop(void) {
to a newly created object parent node.
cmd+0x02: s16 index (of gGeoViews)
*/
void geo_layout_cmd_copy_view(void) {
struct GraphNodeObjectParent *graphNode;
void geo_layout_cmd_copy_view(void)
{
struct GraphNode *node = NULL;
s16 index = cur_geo_cmd_s16(0x02);
if (index >= 0) {
if (index >= 0)
{
node = gGeoViews[index];
if (node->type == GRAPH_NODE_TYPE_OBJECT_PARENT) {
if (node->type == GRAPH_NODE_TYPE_OBJECT_PARENT)
{
node = ((struct GraphNodeObjectParent *)node)->sharedChild;
} else {
}
else
{
node = NULL;
}
}
graphNode = init_graph_node_object_parent(gGraphNodePool, NULL, node);
struct GraphNodeObjectParent *graphNode = init_graph_node_object_parent(gGraphNodePool, NULL, node);
register_scene_graph_node(&graphNode->node);
@@ -743,14 +754,14 @@ void geo_layout_cmd_copy_view(void) {
cmd+0x06: s16 offsetZ
cmd+0x08: GraphNodeFunc nodeFunc
*/
void geo_layout_cmd_node_held_obj(void) {
struct GraphNodeHeldObject *graphNode;
void geo_layout_cmd_node_held_obj(void)
{
Vec3s offset;
read_vec3s(offset, (s16 *)&gGeoLayoutCommand[0x02]);
graphNode = init_graph_node_held_object(
gGraphNodePool, NULL, NULL, offset, (GraphNodeFunc) cur_geo_cmd_ptr(0x08), cur_geo_cmd_u8(0x01));
struct GraphNodeHeldObject *graphNode = init_graph_node_held_object(
gGraphNodePool, NULL, NULL, offset, cur_geo_cmd_ptr(0x08), cur_geo_cmd_u8(0x01));
register_scene_graph_node(&graphNode->fnNode.node);
@@ -762,14 +773,15 @@ void geo_layout_cmd_node_held_obj(void) {
is used for frustum culling.
cmd+0x02: s16 cullingRadius
*/
void geo_layout_cmd_node_culling_radius(void) {
struct GraphNodeCullingRadius *graphNode;
graphNode = init_graph_node_culling_radius(gGraphNodePool, NULL, cur_geo_cmd_s16(0x02));
void geo_layout_cmd_node_culling_radius(void)
{
struct GraphNodeCullingRadius *graphNode = init_graph_node_culling_radius(gGraphNodePool, NULL, cur_geo_cmd_s16(0x02));
register_scene_graph_node(&graphNode->node);
gGeoLayoutCommand += 0x04 << CMD_SIZE_SHIFT;
}
struct GraphNode *process_geo_layout(struct AllocOnlyPool *pool, void *segptr) {
struct GraphNode *process_geo_layout(struct AllocOnlyPool *pool, void *segptr)
{
// set by register_scene_graph_node when gCurGraphNodeIndex is 0
// and gCurRootGraphNode is NULL
gCurRootGraphNode = NULL;
@@ -789,7 +801,8 @@ struct GraphNode *process_geo_layout(struct AllocOnlyPool *pool, void *segptr) {
gGeoLayoutStack[0] = 0;
gGeoLayoutStack[1] = 0;
while (gGeoLayoutCommand != NULL) {
while (gGeoLayoutCommand != NULL)
{
GeoLayoutJumpTable[gGeoLayoutCommand[0x00]]();
}
+32
View File
@@ -49,37 +49,69 @@ extern s16 D_8038BD78;
extern struct GraphNode *D_8038BCF8[];
void geo_layout_cmd_branch_and_link(void);
void geo_layout_cmd_end(void);
void geo_layout_cmd_branch(void);
void geo_layout_cmd_return(void);
void geo_layout_cmd_open_node(void);
void geo_layout_cmd_close_node(void);
void geo_layout_cmd_assign_as_view(void);
void geo_layout_cmd_update_node_flags(void);
void geo_layout_cmd_node_root(void);
void geo_layout_cmd_node_ortho_projection(void);
void geo_layout_cmd_node_perspective(void);
void geo_layout_cmd_node_start(void);
void geo_layout_cmd_nop3(void);
void geo_layout_cmd_node_master_list(void);
void geo_layout_cmd_node_level_of_detail(void);
void geo_layout_cmd_node_switch_case(void);
void geo_layout_cmd_node_camera(void);
void geo_layout_cmd_node_translation_rotation(void);
void geo_layout_cmd_node_translation(void);
void geo_layout_cmd_node_rotation(void);
void geo_layout_cmd_node_scale(void);
void geo_layout_cmd_nop2(void);
void geo_layout_cmd_node_animated_part(void);
void geo_layout_cmd_node_billboard(void);
void geo_layout_cmd_node_display_list(void);
void geo_layout_cmd_node_shadow(void);
void geo_layout_cmd_node_object_parent(void);
void geo_layout_cmd_node_generated(void);
void geo_layout_cmd_node_background(void);
void geo_layout_cmd_nop(void);
void geo_layout_cmd_copy_view(void);
void geo_layout_cmd_node_held_obj(void);
void geo_layout_cmd_node_culling_radius(void);
struct GraphNode *process_geo_layout(struct AllocOnlyPool *a0, void *segptr);
+339 -195
View File
@@ -18,7 +18,8 @@ static Vec3f gVec3fOne = { 1.0f, 1.0f, 1.0f };
* Initialize a geo node with a given type. Sets all links such that there
* are no siblings, parent or children for this node.
*/
void init_scene_graph_node_links(struct GraphNode *graphNode, s32 type) {
void init_scene_graph_node_links(struct GraphNode *graphNode, s32 type)
{
graphNode->type = type;
graphNode->flags = GRAPH_RENDER_ACTIVE;
graphNode->prev = graphNode;
@@ -30,13 +31,17 @@ void init_scene_graph_node_links(struct GraphNode *graphNode, s32 type) {
/**
* Allocated and returns a newly created root node
*/
struct GraphNodeRoot *init_graph_node_root(struct AllocOnlyPool *pool, struct GraphNodeRoot *graphNode,
s16 areaIndex, s16 x, s16 y, s16 width, s16 height) {
if (pool != NULL) {
struct GraphNodeRoot *init_graph_node_root(
struct AllocOnlyPool *pool, struct GraphNodeRoot *graphNode,
s16 areaIndex, s16 x, s16 y, s16 width, s16 height)
{
if (pool != NULL)
{
graphNode = alloc_only_pool_alloc(pool, sizeof(struct GraphNodeRoot));
}
if (graphNode != NULL) {
if (graphNode != NULL)
{
init_scene_graph_node_links(&graphNode->node, GRAPH_NODE_TYPE_ROOT);
graphNode->areaIndex = areaIndex;
@@ -55,14 +60,17 @@ struct GraphNodeRoot *init_graph_node_root(struct AllocOnlyPool *pool, struct Gr
/**
* Allocates and returns a newly created otrhographic projection node
*/
struct GraphNodeOrthoProjection *
init_graph_node_ortho_projection(struct AllocOnlyPool *pool, struct GraphNodeOrthoProjection *graphNode,
f32 scale) {
if (pool != NULL) {
struct GraphNodeOrthoProjection *init_graph_node_ortho_projection(
struct AllocOnlyPool *pool, struct GraphNodeOrthoProjection *graphNode,
f32 scale)
{
if (pool != NULL)
{
graphNode = alloc_only_pool_alloc(pool, sizeof(struct GraphNodeOrthoProjection));
}
if (graphNode != NULL) {
if (graphNode != NULL)
{
init_scene_graph_node_links(&graphNode->node, GRAPH_NODE_TYPE_ORTHO_PROJECTION);
graphNode->scale = scale;
}
@@ -73,15 +81,19 @@ init_graph_node_ortho_projection(struct AllocOnlyPool *pool, struct GraphNodeOrt
/**
* Allocates and returns a newly created perspective node
*/
struct GraphNodePerspective *init_graph_node_perspective(struct AllocOnlyPool *pool,
struct GraphNodePerspective *init_graph_node_perspective(
struct AllocOnlyPool *pool,
struct GraphNodePerspective *graphNode,
f32 fov, s16 near, s16 far,
GraphNodeFunc nodeFunc, s32 unused) {
if (pool != NULL) {
GraphNodeFunc nodeFunc, s32 unused)
{
if (pool != NULL)
{
graphNode = alloc_only_pool_alloc(pool, sizeof(struct GraphNodePerspective));
}
if (graphNode != NULL) {
if (graphNode != NULL)
{
init_scene_graph_node_links(&graphNode->fnNode.node, GRAPH_NODE_TYPE_PERSPECTIVE);
graphNode->fov = fov;
@@ -90,7 +102,8 @@ struct GraphNodePerspective *init_graph_node_perspective(struct AllocOnlyPool *p
graphNode->fnNode.func = nodeFunc;
graphNode->unused = unused;
if (nodeFunc != NULL) {
if (nodeFunc != NULL)
{
nodeFunc(GEO_CONTEXT_CREATE, &graphNode->fnNode.node, pool);
}
}
@@ -101,13 +114,17 @@ struct GraphNodePerspective *init_graph_node_perspective(struct AllocOnlyPool *p
/**
* Allocates and returns a newly created start node
*/
struct GraphNodeStart *init_graph_node_start(struct AllocOnlyPool *pool,
struct GraphNodeStart *graphNode) {
if (pool != NULL) {
struct GraphNodeStart *init_graph_node_start(
struct AllocOnlyPool *pool,
struct GraphNodeStart *graphNode)
{
if (pool != NULL)
{
graphNode = alloc_only_pool_alloc(pool, sizeof(struct GraphNodeStart));
}
if (graphNode != NULL) {
if (graphNode != NULL)
{
init_scene_graph_node_links(&graphNode->node, GRAPH_NODE_TYPE_START);
}
@@ -117,16 +134,21 @@ struct GraphNodeStart *init_graph_node_start(struct AllocOnlyPool *pool,
/**
* Allocates and returns a newly created master list node
*/
struct GraphNodeMasterList *init_graph_node_master_list(struct AllocOnlyPool *pool,
struct GraphNodeMasterList *graphNode, s16 on) {
if (pool != NULL) {
struct GraphNodeMasterList *init_graph_node_master_list(
struct AllocOnlyPool *pool,
struct GraphNodeMasterList *graphNode, s16 on)
{
if (pool != NULL)
{
graphNode = alloc_only_pool_alloc(pool, sizeof(struct GraphNodeMasterList));
}
if (graphNode != NULL) {
if (graphNode != NULL)
{
init_scene_graph_node_links(&graphNode->node, GRAPH_NODE_TYPE_MASTER_LIST);
if (on) {
if (on)
{
graphNode->node.flags |= GRAPH_RENDER_Z_BUFFER;
}
}
@@ -137,14 +159,18 @@ struct GraphNodeMasterList *init_graph_node_master_list(struct AllocOnlyPool *po
/**
* Allocates and returns a newly created render range node
*/
struct GraphNodeLevelOfDetail *init_graph_node_render_range(struct AllocOnlyPool *pool,
struct GraphNodeLevelOfDetail *init_graph_node_render_range(
struct AllocOnlyPool *pool,
struct GraphNodeLevelOfDetail *graphNode,
s16 minDistance, s16 maxDistance) {
if (pool != NULL) {
s16 minDistance, s16 maxDistance)
{
if (pool != NULL)
{
graphNode = alloc_only_pool_alloc(pool, sizeof(struct GraphNodeLevelOfDetail));
}
if (graphNode != NULL) {
if (graphNode != NULL)
{
init_scene_graph_node_links(&graphNode->node, GRAPH_NODE_TYPE_LEVEL_OF_DETAIL);
graphNode->minDistance = minDistance;
graphNode->maxDistance = maxDistance;
@@ -156,22 +182,27 @@ struct GraphNodeLevelOfDetail *init_graph_node_render_range(struct AllocOnlyPool
/**
* Allocates and returns a newly created switch case node
*/
struct GraphNodeSwitchCase *init_graph_node_switch_case(struct AllocOnlyPool *pool,
struct GraphNodeSwitchCase *init_graph_node_switch_case(
struct AllocOnlyPool *pool,
struct GraphNodeSwitchCase *graphNode,
s16 numCases, s16 selectedCase,
GraphNodeFunc nodeFunc, s32 unused) {
if (pool != NULL) {
GraphNodeFunc nodeFunc, s32 unused)
{
if (pool != NULL)
{
graphNode = alloc_only_pool_alloc(pool, sizeof(struct GraphNodeSwitchCase));
}
if (graphNode != NULL) {
if (graphNode != NULL)
{
init_scene_graph_node_links(&graphNode->fnNode.node, GRAPH_NODE_TYPE_SWITCH_CASE);
graphNode->numCases = numCases;
graphNode->selectedCase = selectedCase;
graphNode->fnNode.func = nodeFunc;
graphNode->unused = unused;
if (nodeFunc != NULL) {
if (nodeFunc != NULL)
{
nodeFunc(GEO_CONTEXT_CREATE, &graphNode->fnNode.node, pool);
}
}
@@ -182,14 +213,18 @@ struct GraphNodeSwitchCase *init_graph_node_switch_case(struct AllocOnlyPool *po
/**
* Allocates and returns a newly created camera node
*/
struct GraphNodeCamera *init_graph_node_camera(struct AllocOnlyPool *pool,
struct GraphNodeCamera *init_graph_node_camera(
struct AllocOnlyPool *pool,
struct GraphNodeCamera *graphNode, f32 *pos,
f32 *focus, GraphNodeFunc func, s32 mode) {
if (pool != NULL) {
f32 *focus, GraphNodeFunc func, s32 mode)
{
if (pool != NULL)
{
graphNode = alloc_only_pool_alloc(pool, sizeof(struct GraphNodeCamera));
}
if (graphNode != NULL) {
if (graphNode != NULL)
{
init_scene_graph_node_links(&graphNode->fnNode.node, GRAPH_NODE_TYPE_CAMERA);
vec3f_copy(graphNode->pos, pos);
vec3f_copy(graphNode->focus, focus);
@@ -198,7 +233,8 @@ struct GraphNodeCamera *init_graph_node_camera(struct AllocOnlyPool *pool,
graphNode->roll = 0;
graphNode->rollScreen = 0;
if (func != NULL) {
if (func != NULL)
{
func(GEO_CONTEXT_CREATE, &graphNode->fnNode.node, pool);
}
}
@@ -209,20 +245,23 @@ struct GraphNodeCamera *init_graph_node_camera(struct AllocOnlyPool *pool,
/**
* Allocates and returns a newly created translation rotation node
*/
struct GraphNodeTranslationRotation *
init_graph_node_translation_rotation(struct AllocOnlyPool *pool,
struct GraphNodeTranslationRotation *init_graph_node_translation_rotation(
struct AllocOnlyPool *pool,
struct GraphNodeTranslationRotation *graphNode, s32 drawingLayer,
void *displayList, Vec3s translation, Vec3s rotation) {
if (pool != NULL) {
void *displayList, Vec3s translation, Vec3s rotation)
{
if (pool != NULL)
{
graphNode = alloc_only_pool_alloc(pool, sizeof(struct GraphNodeTranslationRotation));
}
if (graphNode != NULL) {
if (graphNode != NULL)
{
init_scene_graph_node_links(&graphNode->node, GRAPH_NODE_TYPE_TRANSLATION_ROTATION);
vec3s_copy(graphNode->translation, translation);
vec3s_copy(graphNode->rotation, rotation);
graphNode->node.flags = (drawingLayer << 8) | (graphNode->node.flags & 0xFF);
graphNode->node.flags = drawingLayer << 8 | graphNode->node.flags & 0xFF;
graphNode->displayList = displayList;
}
@@ -232,19 +271,23 @@ init_graph_node_translation_rotation(struct AllocOnlyPool *pool,
/**
* Allocates and returns a newly created translation node
*/
struct GraphNodeTranslation *init_graph_node_translation(struct AllocOnlyPool *pool,
struct GraphNodeTranslation *init_graph_node_translation(
struct AllocOnlyPool *pool,
struct GraphNodeTranslation *graphNode,
s32 drawingLayer, void *displayList,
Vec3s translation) {
if (pool != NULL) {
Vec3s translation)
{
if (pool != NULL)
{
graphNode = alloc_only_pool_alloc(pool, sizeof(struct GraphNodeTranslation));
}
if (graphNode != NULL) {
if (graphNode != NULL)
{
init_scene_graph_node_links(&graphNode->node, GRAPH_NODE_TYPE_TRANSLATION);
vec3s_copy(graphNode->translation, translation);
graphNode->node.flags = (drawingLayer << 8) | (graphNode->node.flags & 0xFF);
graphNode->node.flags = drawingLayer << 8 | graphNode->node.flags & 0xFF;
graphNode->displayList = displayList;
}
@@ -254,18 +297,22 @@ struct GraphNodeTranslation *init_graph_node_translation(struct AllocOnlyPool *p
/**
* Allocates and returns a newly created rotation node
*/
struct GraphNodeRotation *init_graph_node_rotation(struct AllocOnlyPool *pool,
struct GraphNodeRotation *init_graph_node_rotation(
struct AllocOnlyPool *pool,
struct GraphNodeRotation *graphNode,
s32 drawingLayer, void *displayList,
Vec3s rotation) {
if (pool != NULL) {
Vec3s rotation)
{
if (pool != NULL)
{
graphNode = alloc_only_pool_alloc(pool, sizeof(struct GraphNodeRotation));
}
if (graphNode != NULL) {
if (graphNode != NULL)
{
init_scene_graph_node_links(&graphNode->node, GRAPH_NODE_TYPE_ROTATION);
vec3s_copy(graphNode->rotation, rotation);
graphNode->node.flags = (drawingLayer << 8) | (graphNode->node.flags & 0xFF);
graphNode->node.flags = drawingLayer << 8 | graphNode->node.flags & 0xFF;
graphNode->displayList = displayList;
}
@@ -275,16 +322,20 @@ struct GraphNodeRotation *init_graph_node_rotation(struct AllocOnlyPool *pool,
/**
* Allocates and returns a newly created scaling node
*/
struct GraphNodeScale *init_graph_node_scale(struct AllocOnlyPool *pool,
struct GraphNodeScale *init_graph_node_scale(
struct AllocOnlyPool *pool,
struct GraphNodeScale *graphNode, s32 drawingLayer,
void *displayList, f32 scale) {
if (pool != NULL) {
void *displayList, f32 scale)
{
if (pool != NULL)
{
graphNode = alloc_only_pool_alloc(pool, sizeof(struct GraphNodeScale));
}
if (graphNode != NULL) {
if (graphNode != NULL)
{
init_scene_graph_node_links(&graphNode->node, GRAPH_NODE_TYPE_SCALE);
graphNode->node.flags = (drawingLayer << 8) | (graphNode->node.flags & 0xFF);
graphNode->node.flags = drawingLayer << 8 | graphNode->node.flags & 0xFF;
graphNode->scale = scale;
graphNode->displayList = displayList;
}
@@ -295,15 +346,19 @@ struct GraphNodeScale *init_graph_node_scale(struct AllocOnlyPool *pool,
/**
* Allocates and returns a newly created object node
*/
struct GraphNodeObject *init_graph_node_object(struct AllocOnlyPool *pool,
struct GraphNodeObject *init_graph_node_object(
struct AllocOnlyPool *pool,
struct GraphNodeObject *graphNode,
struct GraphNode *sharedChild, Vec3f pos, Vec3s angle,
Vec3f scale) {
if (pool != NULL) {
Vec3f scale)
{
if (pool != NULL)
{
graphNode = alloc_only_pool_alloc(pool, sizeof(struct GraphNodeObject));
}
if (graphNode != NULL) {
if (graphNode != NULL)
{
init_scene_graph_node_links(&graphNode->node, GRAPH_NODE_TYPE_OBJECT);
vec3f_copy(graphNode->pos, pos);
vec3f_copy(graphNode->scale, scale);
@@ -329,14 +384,18 @@ struct GraphNodeObject *init_graph_node_object(struct AllocOnlyPool *pool,
/**
* Allocates and returns a newly created frustum culling radius node
*/
struct GraphNodeCullingRadius *init_graph_node_culling_radius(struct AllocOnlyPool *pool,
struct GraphNodeCullingRadius *init_graph_node_culling_radius(
struct AllocOnlyPool *pool,
struct GraphNodeCullingRadius *graphNode,
s16 radius) {
if (pool != NULL) {
s16 radius)
{
if (pool != NULL)
{
graphNode = alloc_only_pool_alloc(pool, sizeof(struct GraphNodeCullingRadius));
}
if (graphNode != NULL) {
if (graphNode != NULL)
{
init_scene_graph_node_links(&graphNode->node, GRAPH_NODE_TYPE_CULLING_RADIUS);
graphNode->cullingRadius = radius;
}
@@ -347,18 +406,22 @@ struct GraphNodeCullingRadius *init_graph_node_culling_radius(struct AllocOnlyPo
/**
* Allocates and returns a newly created animated part node
*/
struct GraphNodeAnimatedPart *init_graph_node_animated_part(struct AllocOnlyPool *pool,
struct GraphNodeAnimatedPart *init_graph_node_animated_part(
struct AllocOnlyPool *pool,
struct GraphNodeAnimatedPart *graphNode,
s32 drawingLayer, void *displayList,
Vec3s translation) {
if (pool != NULL) {
Vec3s translation)
{
if (pool != NULL)
{
graphNode = alloc_only_pool_alloc(pool, sizeof(struct GraphNodeAnimatedPart));
}
if (graphNode != NULL) {
if (graphNode != NULL)
{
init_scene_graph_node_links(&graphNode->node, GRAPH_NODE_TYPE_ANIMATED_PART);
vec3s_copy(graphNode->translation, translation);
graphNode->node.flags = (drawingLayer << 8) | (graphNode->node.flags & 0xFF);
graphNode->node.flags = drawingLayer << 8 | graphNode->node.flags & 0xFF;
graphNode->displayList = displayList;
}
@@ -368,18 +431,22 @@ struct GraphNodeAnimatedPart *init_graph_node_animated_part(struct AllocOnlyPool
/**
* Allocates and returns a newly created billboard node
*/
struct GraphNodeBillboard *init_graph_node_billboard(struct AllocOnlyPool *pool,
struct GraphNodeBillboard *init_graph_node_billboard(
struct AllocOnlyPool *pool,
struct GraphNodeBillboard *graphNode,
s32 drawingLayer, void *displayList,
Vec3s translation) {
if (pool != NULL) {
Vec3s translation)
{
if (pool != NULL)
{
graphNode = alloc_only_pool_alloc(pool, sizeof(struct GraphNodeBillboard));
}
if (graphNode != NULL) {
if (graphNode != NULL)
{
init_scene_graph_node_links(&graphNode->node, GRAPH_NODE_TYPE_BILLBOARD);
vec3s_copy(graphNode->translation, translation);
graphNode->node.flags = (drawingLayer << 8) | (graphNode->node.flags & 0xFF);
graphNode->node.flags = drawingLayer << 8 | graphNode->node.flags & 0xFF;
graphNode->displayList = displayList;
}
@@ -389,16 +456,20 @@ struct GraphNodeBillboard *init_graph_node_billboard(struct AllocOnlyPool *pool,
/**
* Allocates and returns a newly created displaylist node
*/
struct GraphNodeDisplayList *init_graph_node_display_list(struct AllocOnlyPool *pool,
struct GraphNodeDisplayList *init_graph_node_display_list(
struct AllocOnlyPool *pool,
struct GraphNodeDisplayList *graphNode,
s32 drawingLayer, void *displayList) {
if (pool != NULL) {
s32 drawingLayer, void *displayList)
{
if (pool != NULL)
{
graphNode = alloc_only_pool_alloc(pool, sizeof(struct GraphNodeDisplayList));
}
if (graphNode != NULL) {
if (graphNode != NULL)
{
init_scene_graph_node_links(&graphNode->node, GRAPH_NODE_TYPE_DISPLAY_LIST);
graphNode->node.flags = (drawingLayer << 8) | (graphNode->node.flags & 0xFF);
graphNode->node.flags = drawingLayer << 8 | graphNode->node.flags & 0xFF;
graphNode->displayList = displayList;
}
@@ -408,14 +479,18 @@ struct GraphNodeDisplayList *init_graph_node_display_list(struct AllocOnlyPool *
/**
* Allocates and returns a newly created shadow node
*/
struct GraphNodeShadow *init_graph_node_shadow(struct AllocOnlyPool *pool,
struct GraphNodeShadow *init_graph_node_shadow(
struct AllocOnlyPool *pool,
struct GraphNodeShadow *graphNode, s16 shadowScale,
u8 shadowSolidity, u8 shadowType) {
if (pool != NULL) {
u8 shadowSolidity, u8 shadowType)
{
if (pool != NULL)
{
graphNode = alloc_only_pool_alloc(pool, sizeof(struct GraphNodeShadow));
}
if (graphNode != NULL) {
if (graphNode != NULL)
{
init_scene_graph_node_links(&graphNode->node, GRAPH_NODE_TYPE_SHADOW);
graphNode->shadowScale = shadowScale;
graphNode->shadowSolidity = shadowSolidity;
@@ -428,14 +503,18 @@ struct GraphNodeShadow *init_graph_node_shadow(struct AllocOnlyPool *pool,
/**
* Allocates and returns a newly created object parent node
*/
struct GraphNodeObjectParent *init_graph_node_object_parent(struct AllocOnlyPool *pool,
struct GraphNodeObjectParent *init_graph_node_object_parent(
struct AllocOnlyPool *pool,
struct GraphNodeObjectParent *graphNode,
struct GraphNode *sharedChild) {
if (pool != NULL) {
struct GraphNode *sharedChild)
{
if (pool != NULL)
{
graphNode = alloc_only_pool_alloc(pool, sizeof(struct GraphNodeObjectParent));
}
if (graphNode != NULL) {
if (graphNode != NULL)
{
init_scene_graph_node_links(&graphNode->node, GRAPH_NODE_TYPE_OBJECT_PARENT);
graphNode->sharedChild = sharedChild;
}
@@ -446,19 +525,24 @@ struct GraphNodeObjectParent *init_graph_node_object_parent(struct AllocOnlyPool
/**
* Allocates and returns a newly created generated node
*/
struct GraphNodeGenerated *init_graph_node_generated(struct AllocOnlyPool *pool,
struct GraphNodeGenerated *init_graph_node_generated(
struct AllocOnlyPool *pool,
struct GraphNodeGenerated *graphNode,
GraphNodeFunc gfxFunc, s32 parameter) {
if (pool != NULL) {
GraphNodeFunc gfxFunc, s32 parameter)
{
if (pool != NULL)
{
graphNode = alloc_only_pool_alloc(pool, sizeof(struct GraphNodeGenerated));
}
if (graphNode != NULL) {
if (graphNode != NULL)
{
init_scene_graph_node_links(&graphNode->fnNode.node, GRAPH_NODE_TYPE_GENERATED_LIST);
graphNode->fnNode.func = gfxFunc;
graphNode->parameter = parameter;
if (gfxFunc != NULL) {
if (gfxFunc != NULL)
{
gfxFunc(GEO_CONTEXT_CREATE, &graphNode->fnNode.node, pool);
}
}
@@ -469,22 +553,27 @@ struct GraphNodeGenerated *init_graph_node_generated(struct AllocOnlyPool *pool,
/**
* Allocates and returns a newly created background node
*/
struct GraphNodeBackground *init_graph_node_background(struct AllocOnlyPool *pool,
struct GraphNodeBackground *init_graph_node_background(
struct AllocOnlyPool *pool,
struct GraphNodeBackground *graphNode,
u16 background, GraphNodeFunc backgroundFunc,
s32 zero) {
if (pool != NULL) {
s32 zero)
{
if (pool != NULL)
{
graphNode = alloc_only_pool_alloc(pool, sizeof(struct GraphNodeBackground));
}
if (graphNode != NULL) {
if (graphNode != NULL)
{
init_scene_graph_node_links(&graphNode->fnNode.node, GRAPH_NODE_TYPE_BACKGROUND);
graphNode->background = (background << 16) | background;
graphNode->background = background << 16 | background;
graphNode->fnNode.func = backgroundFunc;
graphNode->unused = zero; // always 0, unused
if (backgroundFunc != NULL) {
if (backgroundFunc != NULL)
{
backgroundFunc(GEO_CONTEXT_CREATE, &graphNode->fnNode.node, pool);
}
}
@@ -495,23 +584,28 @@ struct GraphNodeBackground *init_graph_node_background(struct AllocOnlyPool *poo
/**
* Allocates and returns a newly created held object node
*/
struct GraphNodeHeldObject *init_graph_node_held_object(struct AllocOnlyPool *pool,
struct GraphNodeHeldObject *init_graph_node_held_object(
struct AllocOnlyPool *pool,
struct GraphNodeHeldObject *graphNode,
struct Object *objNode,
Vec3s translation,
GraphNodeFunc nodeFunc, s32 playerIndex) {
if (pool != NULL) {
GraphNodeFunc nodeFunc, s32 playerIndex)
{
if (pool != NULL)
{
graphNode = alloc_only_pool_alloc(pool, sizeof(struct GraphNodeHeldObject));
}
if (graphNode != NULL) {
if (graphNode != NULL)
{
init_scene_graph_node_links(&graphNode->fnNode.node, GRAPH_NODE_TYPE_HELD_OBJ);
vec3s_copy(graphNode->translation, translation);
graphNode->objNode = objNode;
graphNode->fnNode.func = nodeFunc;
graphNode->playerIndex = playerIndex;
if (nodeFunc != NULL) {
if (nodeFunc != NULL)
{
nodeFunc(GEO_CONTEXT_CREATE, &graphNode->fnNode.node, pool);
}
}
@@ -522,20 +616,22 @@ struct GraphNodeHeldObject *init_graph_node_held_object(struct AllocOnlyPool *po
/**
* Adds 'childNode' to the end of the list children from 'parent'
*/
struct GraphNode *geo_add_child(struct GraphNode *parent, struct GraphNode *childNode) {
struct GraphNode *parentFirstChild;
struct GraphNode *parentLastChild;
if (childNode != NULL) {
struct GraphNode *geo_add_child(struct GraphNode *parent, struct GraphNode *childNode)
{
if (childNode != NULL)
{
childNode->parent = parent;
parentFirstChild = parent->children;
struct GraphNode *parentFirstChild = parent->children;
if (parentFirstChild == NULL) {
if (parentFirstChild == NULL)
{
parent->children = childNode;
childNode->prev = childNode;
childNode->next = childNode;
} else {
parentLastChild = parentFirstChild->prev;
}
else
{
struct GraphNode *parentLastChild = parentFirstChild->prev;
childNode->prev = parentLastChild;
childNode->next = parentFirstChild;
parentFirstChild->prev = childNode;
@@ -552,23 +648,25 @@ struct GraphNode *geo_add_child(struct GraphNode *parent, struct GraphNode *chil
* since geo nodes are allocated in a pointer-bumping pool that
* gets thrown out when changing areas.
*/
struct GraphNode *geo_remove_child(struct GraphNode *graphNode) {
struct GraphNode *parent;
struct GraphNode **firstChild;
parent = graphNode->parent;
firstChild = &parent->children;
struct GraphNode *geo_remove_child(struct GraphNode *graphNode)
{
struct GraphNode *parent = graphNode->parent;
struct GraphNode **firstChild = &parent->children;
// Remove link with siblings
graphNode->prev->next = graphNode->next;
graphNode->next->prev = graphNode->prev;
// If this node was the first child, a new first child must be chosen
if (*firstChild == graphNode) {
if (*firstChild == graphNode)
{
// The list is circular, so this checks whether it was the only child
if (graphNode->next == graphNode) {
if (graphNode->next == graphNode)
{
*firstChild = NULL; // Parent has no children anymore
} else {
}
else
{
*firstChild = graphNode->next; // Choose a new first child
}
}
@@ -582,19 +680,18 @@ struct GraphNode *geo_remove_child(struct GraphNode *graphNode) {
* object is always drawn before any other objects. (Note that the geo order
* is independent from processing group order, where Mario is not first.)
*/
struct GraphNode *geo_make_first_child(struct GraphNode *newFirstChild) {
struct GraphNode *lastSibling;
struct GraphNode *parent;
struct GraphNode **firstChild;
struct GraphNode *geo_make_first_child(struct GraphNode *newFirstChild)
{
struct GraphNode *parent = newFirstChild->parent;
struct GraphNode **firstChild = &parent->children;
parent = newFirstChild->parent;
firstChild = &parent->children;
if (*firstChild != newFirstChild) {
if ((*firstChild)->prev != newFirstChild) {
if (*firstChild != newFirstChild)
{
if ((*firstChild)->prev != newFirstChild)
{
newFirstChild->prev->next = newFirstChild->next;
newFirstChild->next->prev = newFirstChild->prev;
lastSibling = (*firstChild)->prev;
struct GraphNode *lastSibling = (*firstChild)->prev;
newFirstChild->prev = lastSibling;
newFirstChild->next = *firstChild;
(*firstChild)->prev = newFirstChild;
@@ -610,24 +707,28 @@ struct GraphNode *geo_make_first_child(struct GraphNode *newFirstChild) {
* Helper function for geo_call_global_function_nodes that recursively
* traverses the scene graph and calls the functions of global nodes.
*/
void geo_call_global_function_nodes_helper(struct GraphNode *graphNode, s32 callContext) {
void geo_call_global_function_nodes_helper(struct GraphNode *graphNode, s32 callContext)
{
struct GraphNode **globalPtr;
struct GraphNode *curNode;
struct FnGraphNode *asFnNode;
curNode = graphNode;
struct GraphNode *curNode = graphNode;
do {
asFnNode = (struct FnGraphNode *) curNode;
do
{
struct FnGraphNode *asFnNode = (struct FnGraphNode *)curNode;
if (curNode->type & GRAPH_NODE_TYPE_FUNCTIONAL) {
if (asFnNode->func != NULL) {
if (curNode->type & GRAPH_NODE_TYPE_FUNCTIONAL)
{
if (asFnNode->func != NULL)
{
asFnNode->func(callContext, curNode, NULL);
}
}
if (curNode->children != NULL) {
switch (curNode->type) {
if (curNode->children != NULL)
{
switch (curNode->type)
{
case GRAPH_NODE_TYPE_MASTER_LIST:
globalPtr = (struct GraphNode **)&gCurGraphNodeMasterList;
break;
@@ -645,17 +746,20 @@ void geo_call_global_function_nodes_helper(struct GraphNode *graphNode, s32 call
break;
}
if (globalPtr != NULL) {
if (globalPtr != NULL)
{
*globalPtr = curNode;
}
geo_call_global_function_nodes_helper(curNode->children, callContext);
if (globalPtr != NULL) {
if (globalPtr != NULL)
{
*globalPtr = NULL;
}
}
} while ((curNode = curNode->next) != graphNode);
}
while ((curNode = curNode->next) != graphNode);
}
/**
@@ -665,11 +769,14 @@ void geo_call_global_function_nodes_helper(struct GraphNode *graphNode, s32 call
* callContext is one of the GEO_CONTEXT_ defines.
* The graphNode argument should be of type GraphNodeRoot.
*/
void geo_call_global_function_nodes(struct GraphNode *graphNode, s32 callContext) {
if (graphNode->flags & GRAPH_RENDER_ACTIVE) {
void geo_call_global_function_nodes(struct GraphNode *graphNode, s32 callContext)
{
if (graphNode->flags & GRAPH_RENDER_ACTIVE)
{
gCurGraphNodeRoot = (struct GraphNodeRoot *)graphNode;
if (graphNode->children != NULL) {
if (graphNode->children != NULL)
{
geo_call_global_function_nodes_helper(graphNode->children, callContext);
}
@@ -680,7 +787,8 @@ void geo_call_global_function_nodes(struct GraphNode *graphNode, s32 callContext
/**
* When objects are cleared, this is called on all object nodes (loaded or unloaded).
*/
void geo_reset_object_node(struct GraphNodeObject *graphNode) {
void geo_reset_object_node(struct GraphNodeObject *graphNode)
{
init_graph_node_object(NULL, graphNode, 0, gVec3fZero, gVec3sZero, gVec3fOne);
geo_add_child(&gObjParentGraphNode, &graphNode->node);
@@ -690,7 +798,8 @@ void geo_reset_object_node(struct GraphNodeObject *graphNode) {
/**
* Initialize an object node using the given parameters
*/
void geo_obj_init(struct GraphNodeObject *graphNode, void *sharedChild, Vec3f pos, Vec3s angle) {
void geo_obj_init(struct GraphNodeObject *graphNode, void *sharedChild, Vec3f pos, Vec3s angle)
{
vec3f_set(graphNode->scale, 1.0f, 1.0f, 1.0f);
vec3f_copy(graphNode->pos, pos);
vec3s_copy(graphNode->angle, angle);
@@ -709,13 +818,14 @@ void geo_obj_init(struct GraphNodeObject *graphNode, void *sharedChild, Vec3f po
/**
* Initialize and object node using the given SpawnInfo struct
*/
void geo_obj_init_spawninfo(struct GraphNodeObject *graphNode, struct SpawnInfo *spawn) {
void geo_obj_init_spawninfo(struct GraphNodeObject *graphNode, struct SpawnInfo *spawn)
{
vec3f_set(graphNode->scale, 1.0f, 1.0f, 1.0f);
vec3s_copy(graphNode->angle, spawn->startAngle);
graphNode->pos[0] = (f32) spawn->startPos[0];
graphNode->pos[1] = (f32) spawn->startPos[1];
graphNode->pos[2] = (f32) spawn->startPos[2];
graphNode->pos[0] = spawn->startPos[0];
graphNode->pos[1] = spawn->startPos[1];
graphNode->pos[2] = spawn->startPos[2];
graphNode->areaIndex = spawn->areaIndex;
graphNode->activeAreaIndex = spawn->activeAreaIndex;
@@ -733,13 +843,15 @@ void geo_obj_init_spawninfo(struct GraphNodeObject *graphNode, struct SpawnInfo
/**
* Initialize the animation of an object node
*/
void geo_obj_init_animation(struct GraphNodeObject *graphNode, struct Animation **animPtrAddr) {
void geo_obj_init_animation(struct GraphNodeObject *graphNode, struct Animation **animPtrAddr)
{
struct Animation **animSegmented = segmented_to_virtual(animPtrAddr);
struct Animation *anim = segmented_to_virtual(*animSegmented);
if (graphNode->animInfo.curAnim != anim) {
if (graphNode->animInfo.curAnim != anim)
{
graphNode->animInfo.curAnim = anim;
graphNode->animInfo.animFrame = anim->startFrame + ((anim->flags & ANIM_FLAG_FORWARD) ? 1 : -1);
graphNode->animInfo.animFrame = anim->startFrame + (anim->flags & ANIM_FLAG_FORWARD ? 1 : -1);
graphNode->animInfo.animAccel = 0;
graphNode->animInfo.animYTrans = 0;
}
@@ -748,15 +860,17 @@ void geo_obj_init_animation(struct GraphNodeObject *graphNode, struct Animation
/**
* Initialize the animation of an object node
*/
void geo_obj_init_animation_accel(struct GraphNodeObject *graphNode, struct Animation **animPtrAddr, u32 animAccel) {
void geo_obj_init_animation_accel(struct GraphNodeObject *graphNode, struct Animation **animPtrAddr, u32 animAccel)
{
struct Animation **animSegmented = segmented_to_virtual(animPtrAddr);
struct Animation *anim = segmented_to_virtual(*animSegmented);
if (graphNode->animInfo.curAnim != anim) {
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);
(anim->startFrame << 16) + (anim->flags & ANIM_FLAG_FORWARD ? animAccel : -animAccel);
graphNode->animInfo.animFrame = graphNode->animInfo.animFrameAccelAssist >> 16;
}
@@ -770,12 +884,16 @@ void geo_obj_init_animation_accel(struct GraphNodeObject *graphNode, struct Anim
* and the second s16 the actual index. This index can be used to index in the array
* with actual animation values.
*/
s32 retrieve_animation_index(s32 frame, u16 **attributes) {
s32 retrieve_animation_index(s32 frame, u16 **attributes)
{
s32 result;
if (frame < (*attributes)[0]) {
if (frame < (*attributes)[0])
{
result = (*attributes)[1] + frame;
} else {
}
else
{
result = (*attributes)[1] + (*attributes)[0] - 1;
}
@@ -789,51 +907,71 @@ 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 AnimInfo *obj, s32 *accelAssist) {
s16 geo_update_animation_frame(struct AnimInfo *obj, s32 *accelAssist)
{
s32 result;
struct Animation *anim;
anim = obj->curAnim;
struct Animation *anim = obj->curAnim;
if (obj->animTimer == gAreaUpdateCounter || anim->flags & ANIM_FLAG_2) {
if (accelAssist != NULL) {
if (obj->animTimer == gAreaUpdateCounter || anim->flags & ANIM_FLAG_2)
{
if (accelAssist != NULL)
{
accelAssist[0] = obj->animFrameAccelAssist;
}
return obj->animFrame;
}
if (anim->flags & ANIM_FLAG_FORWARD) {
if (obj->animAccel) {
if (anim->flags & ANIM_FLAG_FORWARD)
{
if (obj->animAccel)
{
result = obj->animFrameAccelAssist - obj->animAccel;
} else {
}
else
{
result = (obj->animFrame - 1) << 16;
}
if (GET_HIGH_S16_OF_32(result) < anim->loopStart) {
if (anim->flags & ANIM_FLAG_NOLOOP) {
if (GET_HIGH_S16_OF_32(result) < anim->loopStart)
{
if (anim->flags & ANIM_FLAG_NOLOOP)
{
SET_HIGH_S16_OF_32(result, anim->loopStart);
} else {
}
else
{
SET_HIGH_S16_OF_32(result, anim->loopEnd - 1);
}
}
} else {
if (obj->animAccel != 0) {
}
else
{
if (obj->animAccel != 0)
{
result = obj->animFrameAccelAssist + obj->animAccel;
} else {
}
else
{
result = (obj->animFrame + 1) << 16;
}
if (GET_HIGH_S16_OF_32(result) >= anim->loopEnd) {
if (anim->flags & ANIM_FLAG_NOLOOP) {
if (GET_HIGH_S16_OF_32(result) >= anim->loopEnd)
{
if (anim->flags & ANIM_FLAG_NOLOOP)
{
SET_HIGH_S16_OF_32(result, anim->loopEnd - 1);
} else {
}
else
{
SET_HIGH_S16_OF_32(result, anim->loopStart);
}
}
}
if (accelAssist != 0) {
if (accelAssist != 0)
{
accelAssist[0] = result;
}
@@ -848,19 +986,20 @@ s16 geo_update_animation_frame(struct AnimInfo *obj, s32 *accelAssist) {
* currently happens in-line in geo_process_shadow where it also accounts for
* animations without lateral translation.
*/
void geo_retreive_animation_translation(struct GraphNodeObject *obj, Vec3f position) {
void geo_retreive_animation_translation(struct GraphNodeObject *obj, Vec3f position)
{
struct Animation *animation = obj->animInfo.curAnim;
u16 *attribute;
s16 *values;
s16 frame;
if (animation != NULL) {
attribute = segmented_to_virtual((void *) animation->index);
values = segmented_to_virtual((void *) animation->values);
if (animation != NULL)
{
attribute = segmented_to_virtual(animation->index);
s16 *values = segmented_to_virtual(animation->values);
frame = obj->animInfo.animFrame;
s16 frame = obj->animInfo.animFrame;
if (frame < 0) {
if (frame < 0)
{
frame = 0;
}
@@ -870,7 +1009,9 @@ void geo_retreive_animation_translation(struct GraphNodeObject *obj, Vec3f posit
position[1] = (f32)values[retrieve_animation_index(frame, &attribute)];
position[2] = (f32)values[retrieve_animation_index(frame, &attribute)];
}
} else {
}
else
{
vec3f_set(position, 0, 0, 0);
}
}
@@ -879,14 +1020,17 @@ void geo_retreive_animation_translation(struct GraphNodeObject *obj, Vec3f posit
* Unused function to find the root of the geo node tree, which should be a
* GraphNodeRoot. If it is not for some reason, null is returned.
*/
struct GraphNodeRoot *geo_find_root(struct GraphNode *graphNode) {
struct GraphNodeRoot *geo_find_root(struct GraphNode *graphNode)
{
struct GraphNodeRoot *resGraphNode = NULL;
while (graphNode->parent != NULL) {
while (graphNode->parent != NULL)
{
graphNode = graphNode->parent;
}
if (graphNode->type == GRAPH_NODE_TYPE_ROOT) {
if (graphNode->type == GRAPH_NODE_TYPE_ROOT)
{
resGraphNode = (struct GraphNodeRoot *)graphNode;
}
+220 -92
View File
@@ -70,23 +70,34 @@ typedef Gfx *(*GraphNodeFunc)(s32 callContext, struct GraphNode *node, void *con
*/
struct FnGraphNode
{
/*0x00*/ struct GraphNode node;
/*0x14*/ GraphNodeFunc func;
/*0x00*/
struct GraphNode node;
/*0x14*/
GraphNodeFunc func;
};
/** The very root of the geo tree. Specifies the viewport.
*/
struct GraphNodeRoot
{
/*0x00*/ struct GraphNode node;
/*0x14*/ u8 areaIndex;
/*0x15*/ s8 unk15; // ?
/*0x16*/ s16 x;
/*0x18*/ s16 y;
/*0x1A*/ s16 width; // half width, 160
/*0x1C*/ s16 height; // half height
/*0x1E*/ s16 numViews; // number of entries in mystery array
/*0x20*/ struct GraphNode **views;
/*0x00*/
struct GraphNode node;
/*0x14*/
u8 areaIndex;
/*0x15*/
s8 unk15; // ?
/*0x16*/
s16 x;
/*0x18*/
s16 y;
/*0x1A*/
s16 width; // half width, 160
/*0x1C*/
s16 height; // half height
/*0x1E*/
s16 numViews; // number of entries in mystery array
/*0x20*/
struct GraphNode **views;
};
/** A node that sets up an orthographic projection based on the global
@@ -94,8 +105,10 @@ struct GraphNodeRoot
*/
struct GraphNodeOrthoProjection
{
/*0x00*/ struct GraphNode node;
/*0x14*/ f32 scale;
/*0x00*/
struct GraphNode node;
/*0x14*/
f32 scale;
};
/** A node that sets up a perspective projection. Used for drawing the
@@ -104,11 +117,16 @@ struct GraphNodeOrthoProjection
*/
struct GraphNodePerspective
{
/*0x00*/ struct FnGraphNode fnNode;
/*0x18*/ s32 unused;
/*0x1C*/ f32 fov; // horizontal field of view in degrees
/*0x20*/ s16 near; // near clipping plane
/*0x22*/ s16 far; // far clipping plane
/*0x00*/
struct FnGraphNode fnNode;
/*0x18*/
s32 unused;
/*0x1C*/
f32 fov; // horizontal field of view in degrees
/*0x20*/
s16 near; // near clipping plane
/*0x22*/
s16 far; // far clipping plane
};
/** An entry in the master list. It is a linked list of display lists
@@ -128,9 +146,12 @@ struct DisplayListNode
*/
struct GraphNodeMasterList
{
/*0x00*/ struct GraphNode node;
/*0x14*/ struct DisplayListNode *listHeads[GFX_NUM_MASTER_LISTS];
/*0x34*/ struct DisplayListNode *listTails[GFX_NUM_MASTER_LISTS];
/*0x00*/
struct GraphNode node;
/*0x14*/
struct DisplayListNode *listHeads[GFX_NUM_MASTER_LISTS];
/*0x34*/
struct DisplayListNode *listTails[GFX_NUM_MASTER_LISTS];
};
/** Simply used as a parent to group multiple children.
@@ -138,7 +159,8 @@ struct GraphNodeMasterList
*/
struct GraphNodeStart
{
/*0x00*/ struct GraphNode node;
/*0x00*/
struct GraphNode node;
};
/** GraphNode that only renders its children if the current transformation matrix
@@ -149,9 +171,12 @@ struct GraphNodeStart
*/
struct GraphNodeLevelOfDetail
{
/*0x00*/ struct GraphNode node;
/*0x14*/ s16 minDistance;
/*0x16*/ s16 maxDistance;
/*0x00*/
struct GraphNode node;
/*0x14*/
s16 minDistance;
/*0x16*/
s16 maxDistance;
};
/** GraphNode that renders exactly one of its children.
@@ -161,10 +186,14 @@ struct GraphNodeLevelOfDetail
*/
struct GraphNodeSwitchCase
{
/*0x00*/ struct FnGraphNode fnNode;
/*0x18*/ s32 unused;
/*0x1C*/ s16 numCases;
/*0x1E*/ s16 selectedCase;
/*0x00*/
struct FnGraphNode fnNode;
/*0x18*/
s32 unused;
/*0x1C*/
s16 numCases;
/*0x1E*/
s16 selectedCase;
};
/**
@@ -173,8 +202,12 @@ struct GraphNodeSwitchCase
*/
struct GraphNodeCamera
{
/*0x00*/ struct FnGraphNode fnNode;
/*0x18*/ union {
/*0x00*/
struct FnGraphNode fnNode;
/*0x18*/
union
{
// When the node is created, a mode is assigned to the node.
// Later in geo_camera_main a Camera is allocated,
// the mode is passed to the struct, and the field is overridden
@@ -182,11 +215,17 @@ struct GraphNodeCamera
s32 mode;
struct Camera *camera;
} config;
/*0x1C*/ Vec3f pos;
/*0x28*/ Vec3f focus;
/*0x34*/ Mat4 *matrixPtr; // pointer to look-at matrix of this camera as a Mat4
/*0x38*/ s16 roll; // roll in look at matrix. Doesn't account for light direction unlike rollScreen.
/*0x3A*/ s16 rollScreen; // rolls screen while keeping the light direction consistent
/*0x1C*/
Vec3f pos;
/*0x28*/
Vec3f focus;
/*0x34*/
Mat4 *matrixPtr; // pointer to look-at matrix of this camera as a Mat4
/*0x38*/
s16 roll; // roll in look at matrix. Doesn't account for light direction unlike rollScreen.
/*0x3A*/
s16 rollScreen; // rolls screen while keeping the light direction consistent
};
/** GraphNode that translates and rotates its children.
@@ -197,10 +236,14 @@ struct GraphNodeCamera
*/
struct GraphNodeTranslationRotation
{
/*0x00*/ struct GraphNode node;
/*0x14*/ void *displayList;
/*0x18*/ Vec3s translation;
/*0x1E*/ Vec3s rotation;
/*0x00*/
struct GraphNode node;
/*0x14*/
void *displayList;
/*0x18*/
Vec3s translation;
/*0x1E*/
Vec3s rotation;
};
/** GraphNode that translates itself and its children.
@@ -209,9 +252,12 @@ struct GraphNodeTranslationRotation
*/
struct GraphNodeTranslation
{
/*0x00*/ struct GraphNode node;
/*0x14*/ void *displayList;
/*0x18*/ Vec3s translation;
/*0x00*/
struct GraphNode node;
/*0x14*/
void *displayList;
/*0x18*/
Vec3s translation;
u8 pad1E[2];
};
@@ -222,9 +268,12 @@ struct GraphNodeTranslation
*/
struct GraphNodeRotation
{
/*0x00*/ struct GraphNode node;
/*0x14*/ void *displayList;
/*0x18*/ Vec3s rotation;
/*0x00*/
struct GraphNode node;
/*0x14*/
void *displayList;
/*0x18*/
Vec3s rotation;
u8 pad1E[2];
};
@@ -237,9 +286,12 @@ struct GraphNodeRotation
*/
struct GraphNodeAnimatedPart
{
/*0x00*/ struct GraphNode node;
/*0x14*/ void *displayList;
/*0x18*/ Vec3s translation;
/*0x00*/
struct GraphNode node;
/*0x14*/
void *displayList;
/*0x18*/
Vec3s translation;
};
/** A GraphNode that draws a display list rotated in a way to always face the
@@ -249,9 +301,12 @@ struct GraphNodeAnimatedPart
*/
struct GraphNodeBillboard
{
/*0x00*/ struct GraphNode node;
/*0x14*/ void *displayList;
/*0x18*/ Vec3s translation;
/*0x00*/
struct GraphNode node;
/*0x14*/
void *displayList;
/*0x18*/
Vec3s translation;
};
/** A GraphNode that simply draws a display list without doing any
@@ -259,8 +314,10 @@ struct GraphNodeBillboard
*/
struct GraphNodeDisplayList
{
/*0x00*/ struct GraphNode node;
/*0x14*/ void *displayList;
/*0x00*/
struct GraphNode node;
/*0x14*/
void *displayList;
};
/** GraphNode part that scales itself and its children.
@@ -273,9 +330,12 @@ struct GraphNodeDisplayList
*/
struct GraphNodeScale
{
/*0x00*/ struct GraphNode node;
/*0x14*/ void *displayList;
/*0x18*/ f32 scale;
/*0x00*/
struct GraphNode node;
/*0x14*/
void *displayList;
/*0x18*/
f32 scale;
};
/** GraphNode that draws a shadow under an object.
@@ -285,10 +345,14 @@ struct GraphNodeScale
*/
struct GraphNodeShadow
{
/*0x00*/ struct GraphNode node;
/*0x14*/ s16 shadowScale; // diameter (when a circle) or side (when a square) of shadow
/*0x16*/ u8 shadowSolidity; // opacity of shadow, 255 = opaque
/*0x17*/ u8 shadowType; // see ShadowType enum in shadow.h
/*0x00*/
struct GraphNode node;
/*0x14*/
s16 shadowScale; // diameter (when a circle) or side (when a square) of shadow
/*0x16*/
u8 shadowSolidity; // opacity of shadow, 255 = opaque
/*0x17*/
u8 shadowType; // see ShadowType enum in shadow.h
};
/** GraphNode that contains as its sharedChild a group node containing all
@@ -296,8 +360,10 @@ struct GraphNodeShadow
*/
struct GraphNodeObjectParent
{
/*0x00*/ struct GraphNode node;
/*0x14*/ struct GraphNode *sharedChild;
/*0x00*/
struct GraphNode node;
/*0x14*/
struct GraphNode *sharedChild;
};
/** GraphNode that draws display lists not directly in memory but generated by
@@ -310,8 +376,10 @@ struct GraphNodeObjectParent
*/
struct GraphNodeGenerated
{
/*0x00*/ struct FnGraphNode fnNode;
/*0x18*/ u32 parameter; // extra context for the function
/*0x00*/
struct FnGraphNode fnNode;
/*0x18*/
u32 parameter; // extra context for the function
};
/** GraphNode that draws a background image or a rectangle of a color.
@@ -319,19 +387,26 @@ struct GraphNodeGenerated
*/
struct GraphNodeBackground
{
/*0x00*/ struct FnGraphNode fnNode;
/*0x18*/ s32 unused;
/*0x1C*/ s32 background; // background ID, or rgba5551 color if fnNode.func is null
/*0x00*/
struct FnGraphNode fnNode;
/*0x18*/
s32 unused;
/*0x1C*/
s32 background; // background ID, or rgba5551 color if fnNode.func is null
};
/** Renders the object that Mario is holding.
*/
struct GraphNodeHeldObject
{
/*0x00*/ struct FnGraphNode fnNode;
/*0x18*/ s32 playerIndex;
/*0x1C*/ struct Object *objNode;
/*0x20*/ Vec3s translation;
/*0x00*/
struct FnGraphNode fnNode;
/*0x18*/
s32 playerIndex;
/*0x1C*/
struct Object *objNode;
/*0x20*/
Vec3s translation;
};
/** A node that allows an object to specify a different culling radius than the
@@ -341,8 +416,10 @@ struct GraphNodeHeldObject
*/
struct GraphNodeCullingRadius
{
/*0x00*/ struct GraphNode node;
/*0x14*/ s16 cullingRadius; // specifies the 'sphere radius' for purposes of frustum culling
/*0x00*/
struct GraphNode node;
/*0x14*/
s16 cullingRadius; // specifies the 'sphere radius' for purposes of frustum culling
u8 pad1E[2];
};
@@ -363,71 +440,122 @@ extern s16 gCurGraphNodeIndex;
void init_scene_graph_node_links(struct GraphNode *graphNode, s32 type);
struct GraphNodeRoot *init_graph_node_root(struct AllocOnlyPool *pool, struct GraphNodeRoot *graphNode,
struct GraphNodeRoot *init_graph_node_root(
struct AllocOnlyPool *pool, struct GraphNodeRoot *graphNode,
s16 areaIndex, s16 x, s16 y, s16 width, s16 height);
struct GraphNodeOrthoProjection *init_graph_node_ortho_projection(struct AllocOnlyPool *pool, struct GraphNodeOrthoProjection *graphNode, f32 scale);
struct GraphNodePerspective *init_graph_node_perspective(struct AllocOnlyPool *pool, struct GraphNodePerspective *graphNode,
struct GraphNodePerspective *init_graph_node_perspective(
struct AllocOnlyPool *pool, struct GraphNodePerspective *graphNode,
f32 fov, s16 near, s16 far, GraphNodeFunc nodeFunc, s32 unused);
struct GraphNodeStart *init_graph_node_start(struct AllocOnlyPool *pool, struct GraphNodeStart *graphNode);
struct GraphNodeMasterList *init_graph_node_master_list(struct AllocOnlyPool *pool, struct GraphNodeMasterList *graphNode, s16 on);
struct GraphNodeLevelOfDetail *init_graph_node_render_range(struct AllocOnlyPool *pool, struct GraphNodeLevelOfDetail *graphNode,
struct GraphNodeLevelOfDetail *init_graph_node_render_range(
struct AllocOnlyPool *pool, struct GraphNodeLevelOfDetail *graphNode,
s16 minDistance, s16 maxDistance);
struct GraphNodeSwitchCase *init_graph_node_switch_case(struct AllocOnlyPool *pool, struct GraphNodeSwitchCase *graphNode,
struct GraphNodeSwitchCase *init_graph_node_switch_case(
struct AllocOnlyPool *pool, struct GraphNodeSwitchCase *graphNode,
s16 numCases, s16 selectedCase, GraphNodeFunc nodeFunc, s32 unused);
struct GraphNodeCamera *init_graph_node_camera(struct AllocOnlyPool *pool, struct GraphNodeCamera *graphNode,
struct GraphNodeCamera *init_graph_node_camera(
struct AllocOnlyPool *pool, struct GraphNodeCamera *graphNode,
f32 *pos, f32 *focus, GraphNodeFunc func, s32 mode);
struct GraphNodeTranslationRotation *init_graph_node_translation_rotation(struct AllocOnlyPool *pool, struct GraphNodeTranslationRotation *graphNode,
struct GraphNodeTranslationRotation *init_graph_node_translation_rotation(
struct AllocOnlyPool *pool, struct GraphNodeTranslationRotation *graphNode,
s32 drawingLayer, void *displayList, Vec3s translation, Vec3s rotation);
struct GraphNodeTranslation *init_graph_node_translation(struct AllocOnlyPool *pool, struct GraphNodeTranslation *graphNode,
struct GraphNodeTranslation *init_graph_node_translation(
struct AllocOnlyPool *pool, struct GraphNodeTranslation *graphNode,
s32 drawingLayer, void *displayList, Vec3s translation);
struct GraphNodeRotation *init_graph_node_rotation(struct AllocOnlyPool *pool, struct GraphNodeRotation *graphNode,
struct GraphNodeRotation *init_graph_node_rotation(
struct AllocOnlyPool *pool, struct GraphNodeRotation *graphNode,
s32 drawingLayer, void *displayList, Vec3s rotation);
struct GraphNodeScale *init_graph_node_scale(struct AllocOnlyPool *pool, struct GraphNodeScale *graphNode,
struct GraphNodeScale *init_graph_node_scale(
struct AllocOnlyPool *pool, struct GraphNodeScale *graphNode,
s32 drawingLayer, void *displayList, f32 scale);
struct GraphNodeObject *init_graph_node_object(struct AllocOnlyPool *pool, struct GraphNodeObject *graphNode,
struct GraphNodeObject *init_graph_node_object(
struct AllocOnlyPool *pool, struct GraphNodeObject *graphNode,
struct GraphNode *sharedChild, Vec3f pos, Vec3s angle, Vec3f scale);
struct GraphNodeCullingRadius *init_graph_node_culling_radius(struct AllocOnlyPool *pool, struct GraphNodeCullingRadius *graphNode, s16 radius);
struct GraphNodeAnimatedPart *init_graph_node_animated_part(struct AllocOnlyPool *pool, struct GraphNodeAnimatedPart *graphNode,
struct GraphNodeAnimatedPart *init_graph_node_animated_part(
struct AllocOnlyPool *pool, struct GraphNodeAnimatedPart *graphNode,
s32 drawingLayer, void *displayList, Vec3s translation);
struct GraphNodeBillboard *init_graph_node_billboard(struct AllocOnlyPool *pool, struct GraphNodeBillboard *graphNode,
struct GraphNodeBillboard *init_graph_node_billboard(
struct AllocOnlyPool *pool, struct GraphNodeBillboard *graphNode,
s32 drawingLayer, void *displayList, Vec3s translation);
struct GraphNodeDisplayList *init_graph_node_display_list(struct AllocOnlyPool *pool, struct GraphNodeDisplayList *graphNode,
struct GraphNodeDisplayList *init_graph_node_display_list(
struct AllocOnlyPool *pool, struct GraphNodeDisplayList *graphNode,
s32 drawingLayer, void *displayList);
struct GraphNodeShadow *init_graph_node_shadow(struct AllocOnlyPool *pool, struct GraphNodeShadow *graphNode,
struct GraphNodeShadow *init_graph_node_shadow(
struct AllocOnlyPool *pool, struct GraphNodeShadow *graphNode,
s16 shadowScale, u8 shadowSolidity, u8 shadowType);
struct GraphNodeObjectParent *init_graph_node_object_parent(struct AllocOnlyPool *pool, struct GraphNodeObjectParent *sp1c,
struct GraphNodeObjectParent *init_graph_node_object_parent(
struct AllocOnlyPool *pool, struct GraphNodeObjectParent *sp1c,
struct GraphNode *sharedChild);
struct GraphNodeGenerated *init_graph_node_generated(struct AllocOnlyPool *pool, struct GraphNodeGenerated *sp1c,
struct GraphNodeGenerated *init_graph_node_generated(
struct AllocOnlyPool *pool, struct GraphNodeGenerated *sp1c,
GraphNodeFunc gfxFunc, s32 parameter);
struct GraphNodeBackground *init_graph_node_background(struct AllocOnlyPool *pool, struct GraphNodeBackground *sp1c,
struct GraphNodeBackground *init_graph_node_background(
struct AllocOnlyPool *pool, struct GraphNodeBackground *sp1c,
u16 background, GraphNodeFunc backgroundFunc, s32 zero);
struct GraphNodeHeldObject *init_graph_node_held_object(struct AllocOnlyPool *pool, struct GraphNodeHeldObject *sp1c,
struct GraphNodeHeldObject *init_graph_node_held_object(
struct AllocOnlyPool *pool, struct GraphNodeHeldObject *sp1c,
struct Object *objNode, Vec3s translation,
GraphNodeFunc nodeFunc, s32 playerIndex);
struct GraphNode *geo_add_child(struct GraphNode *parent, struct GraphNode *childNode);
struct GraphNode *geo_remove_child(struct GraphNode *graphNode);
struct GraphNode *geo_make_first_child(struct GraphNode *newFirstChild);
void geo_call_global_function_nodes_helper(struct GraphNode *graphNode, s32 callContext);
void geo_call_global_function_nodes(struct GraphNode *graphNode, s32 callContext);
void geo_reset_object_node(struct GraphNodeObject *graphNode);
void geo_obj_init(struct GraphNodeObject *graphNode, void *sharedChild, Vec3f pos, Vec3s angle);
void geo_obj_init_spawninfo(struct GraphNodeObject *graphNode, struct SpawnInfo *spawn);
void geo_obj_init_animation(struct GraphNodeObject *graphNode, struct Animation **animPtrAddr);
void geo_obj_init_animation_accel(struct GraphNodeObject *graphNode, struct Animation **animPtrAddr, u32 animAccel);
s32 retrieve_animation_index(s32 frame, u16 **attributes);
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);
// graph_node_manager
s16 *read_vec3s_to_vec3f(Vec3f, s16 * src);
s16 *read_vec3s(Vec3s dst, s16 *src);
s16 *read_vec3s_angle(Vec3s dst, s16 *src);
void register_scene_graph_node(struct GraphNode *graphNode);
#endif // GRAPH_NODE_H
+29 -15
View File
@@ -6,13 +6,15 @@
#include "graph_node.h"
#if IS_64_BIT
static s16 next_s16_in_geo_script(s16 **src) {
s16 ret;
if (((uintptr_t)(*src) & 7) == 4) {
static s16 next_s16_in_geo_script(s16 **src)
{
if (((uintptr_t) * src & 7) == 4)
{
*src += 2; // skip 32 bits
}
ret = *(*src)++;
if (((uintptr_t)(*src) & 7) == 4) {
s16 ret = *(*src)++;
if (((uintptr_t) * src & 7) == 4)
{
*src += 2; // skip 32 bits
}
return ret;
@@ -25,7 +27,8 @@ static s16 next_s16_in_geo_script(s16 **src) {
* Takes a pointer to three shorts (supplied by a geo layout script) and
* copies it to the destination float vector.
*/
s16 *read_vec3s_to_vec3f(Vec3f dst, s16 *src) {
s16 *read_vec3s_to_vec3f(Vec3f dst, s16 *src)
{
dst[0] = next_s16_in_geo_script(&src);
dst[1] = next_s16_in_geo_script(&src);
dst[2] = next_s16_in_geo_script(&src);
@@ -37,7 +40,8 @@ s16 *read_vec3s_to_vec3f(Vec3f dst, s16 *src) {
* copies it to the destination vector. It's essentially a memcpy but consistent
* with the other two 'geo-script vector to internal vector' functions.
*/
s16 *read_vec3s(Vec3s dst, s16 *src) {
s16 *read_vec3s(Vec3s dst, s16 *src)
{
dst[0] = next_s16_in_geo_script(&src);
dst[1] = next_s16_in_geo_script(&src);
dst[2] = next_s16_in_geo_script(&src);
@@ -49,7 +53,8 @@ s16 *read_vec3s(Vec3s dst, s16 *src) {
* and converts it to a vector of three in-game angle units in [-32768, 32767]
* range.
*/
s16 *read_vec3s_angle(Vec3s dst, s16 *src) {
s16 *read_vec3s_angle(Vec3s dst, s16 *src)
{
dst[0] = (next_s16_in_geo_script(&src) << 15) / 180;
dst[1] = (next_s16_in_geo_script(&src) << 15) / 180;
dst[2] = (next_s16_in_geo_script(&src) << 15) / 180;
@@ -61,19 +66,28 @@ s16 *read_vec3s_angle(Vec3s dst, s16 *src) {
* 'gCurGraphNodeList'. This is called from geo_layout commands to add nodes
* to the scene graph.
*/
void register_scene_graph_node(struct GraphNode *graphNode) {
if (graphNode != NULL) {
void register_scene_graph_node(struct GraphNode *graphNode)
{
if (graphNode != NULL)
{
gCurGraphNodeList[gCurGraphNodeIndex] = graphNode;
if (gCurGraphNodeIndex == 0) {
if (gCurRootGraphNode == NULL) {
if (gCurGraphNodeIndex == 0)
{
if (gCurRootGraphNode == NULL)
{
gCurRootGraphNode = graphNode;
}
} else {
if (gCurGraphNodeList[gCurGraphNodeIndex - 1]->type == GRAPH_NODE_TYPE_OBJECT_PARENT) {
}
else
{
if (gCurGraphNodeList[gCurGraphNodeIndex - 1]->type == GRAPH_NODE_TYPE_OBJECT_PARENT)
{
((struct GraphNodeObjectParent *)gCurGraphNodeList[gCurGraphNodeIndex - 1])
->sharedChild = graphNode;
} else {
}
else
{
geo_add_child(gCurGraphNodeList[gCurGraphNodeIndex - 1], graphNode);
}
}
+31 -15
View File
@@ -5,14 +5,17 @@
#endif
#ifndef GBI_FLOATS
void guMtxF2L(float mf[4][4], Mtx *m) {
void guMtxF2L(float mf[4][4], Mtx *m)
{
int r, c;
s32 tmp1;
s32 tmp2;
s32 *m1 = &m->m[0][0];
s32 *m2 = &m->m[2][0];
for (r = 0; r < 4; r++) {
for (c = 0; c < 2; c++) {
for (r = 0; r < 4; r++)
{
for (c = 0; c < 2; c++)
{
tmp1 = mf[r][2 * c] * 65536.0f;
tmp2 = mf[r][2 * c + 1] * 65536.0f;
*m1++ = (tmp1 & 0xffff0000) | ((tmp2 >> 0x10) & 0xffff);
@@ -20,7 +23,9 @@ void guMtxF2L(float mf[4][4], Mtx *m) {
}
}
}
void guMtxL2F(float mf[4][4], Mtx *m) {
void guMtxL2F(float mf[4][4], Mtx *m)
{
int r, c;
u32 tmp1;
u32 tmp2;
@@ -29,8 +34,10 @@ void guMtxL2F(float mf[4][4], Mtx *m) {
s32 stmp1, stmp2;
m1 = (u32 *)&m->m[0][0];
m2 = (u32 *)&m->m[2][0];
for (r = 0; r < 4; r++) {
for (c = 0; c < 2; c++) {
for (r = 0; r < 4; r++)
{
for (c = 0; c < 2; c++)
{
tmp1 = (*m1 & 0xffff0000) | ((*m2 >> 0x10) & 0xffff);
tmp2 = ((*m1++ << 0x10) & 0xffff0000) | (*m2++ & 0xffff);
stmp1 = *(s32 *)&tmp1;
@@ -41,27 +48,36 @@ void guMtxL2F(float mf[4][4], Mtx *m) {
}
}
#else
void guMtxF2L(float mf[4][4], Mtx *m) {
void guMtxF2L(float mf[4][4], Mtx *m)
{
memcpy(m, mf, sizeof(Mtx));
}
void guMtxL2F(float mf[4][4], Mtx *m) {
void guMtxL2F(float mf[4][4], Mtx *m)
{
memcpy(mf, m, sizeof(Mtx));
}
#endif
void guMtxIdentF(float mf[4][4]) {
int r, c;
for (r = 0; r < 4; r++) {
for (c = 0; c < 4; c++) {
if (r == c) {
void guMtxIdentF(float mf[4][4])
{
for (int r = 0; r < 4; r++)
{
for (int c = 0; c < 4; c++)
{
if (r == c)
{
mf[r][c] = 1.0f;
} else {
}
else
{
mf[r][c] = 0.0f;
}
}
}
}
void guMtxIdent(Mtx *m) {
void guMtxIdent(Mtx *m)
{
#ifndef GBI_FLOATS
float mf[4][4];
guMtxIdentF(mf);
+1
View File
@@ -4,6 +4,7 @@
#include "../include/PR/gbi.h"
extern void guMtxF2L(float mf[4][4], Mtx *m);
extern void guMtxL2F(float mf[4][4], Mtx *m);
#endif//GUMTXF2L_H
+193 -128
View File
@@ -1450,7 +1450,8 @@ int gSplineState;
#pragma GCC diagnostic ignored "-Wreturn-local-addr"
/// Copy vector 'src' to 'dest'
void *vec3f_copy(Vec3f dest, Vec3f src) {
void *vec3f_copy(Vec3f dest, Vec3f src)
{
dest[0] = src[0];
dest[1] = src[1];
dest[2] = src[2];
@@ -1458,7 +1459,8 @@ void *vec3f_copy(Vec3f dest, Vec3f src) {
}
/// Set vector 'dest' to (x, y, z)
void *vec3f_set(Vec3f dest, f32 x, f32 y, f32 z) {
void *vec3f_set(Vec3f dest, f32 x, f32 y, f32 z)
{
dest[0] = x;
dest[1] = y;
dest[2] = z;
@@ -1466,7 +1468,8 @@ void *vec3f_set(Vec3f dest, f32 x, f32 y, f32 z) {
}
/// Add vector 'a' to 'dest'
void *vec3f_add(Vec3f dest, Vec3f a) {
void *vec3f_add(Vec3f dest, Vec3f a)
{
dest[0] += a[0];
dest[1] += a[1];
dest[2] += a[2];
@@ -1474,7 +1477,8 @@ void *vec3f_add(Vec3f dest, Vec3f a) {
}
/// Make 'dest' the sum of vectors a and b.
void *vec3f_sum(Vec3f dest, Vec3f a, Vec3f b) {
void *vec3f_sum(Vec3f dest, Vec3f a, Vec3f b)
{
dest[0] = a[0] + b[0];
dest[1] = a[1] + b[1];
dest[2] = a[2] + b[2];
@@ -1482,7 +1486,8 @@ void *vec3f_sum(Vec3f dest, Vec3f a, Vec3f b) {
}
/// Copy vector src to dest
void *vec3s_copy(Vec3s dest, Vec3s src) {
void *vec3s_copy(Vec3s dest, Vec3s src)
{
dest[0] = src[0];
dest[1] = src[1];
dest[2] = src[2];
@@ -1490,7 +1495,8 @@ void *vec3s_copy(Vec3s dest, Vec3s src) {
}
/// Set vector 'dest' to (x, y, z)
void *vec3s_set(Vec3s dest, s16 x, s16 y, s16 z) {
void *vec3s_set(Vec3s dest, s16 x, s16 y, s16 z)
{
dest[0] = x;
dest[1] = y;
dest[2] = z;
@@ -1498,7 +1504,8 @@ void *vec3s_set(Vec3s dest, s16 x, s16 y, s16 z) {
}
/// Add vector a to 'dest'
void *vec3s_add(Vec3s dest, Vec3s a) {
void *vec3s_add(Vec3s dest, Vec3s a)
{
dest[0] += a[0];
dest[1] += a[1];
dest[2] += a[2];
@@ -1506,7 +1513,8 @@ void *vec3s_add(Vec3s dest, Vec3s a) {
}
/// Make 'dest' the sum of vectors a and b.
void *vec3s_sum(Vec3s dest, Vec3s a, Vec3s b) {
void *vec3s_sum(Vec3s dest, Vec3s a, Vec3s b)
{
dest[0] = a[0] + b[0];
dest[1] = a[1] + b[1];
dest[2] = a[2] + b[2];
@@ -1514,7 +1522,8 @@ void *vec3s_sum(Vec3s dest, Vec3s a, Vec3s b) {
}
/// Subtract vector a from 'dest'
void *vec3s_sub(Vec3s dest, Vec3s a) {
void *vec3s_sub(Vec3s dest, Vec3s a)
{
dest[0] -= a[0];
dest[1] -= a[1];
dest[2] -= a[2];
@@ -1522,7 +1531,8 @@ void *vec3s_sub(Vec3s dest, Vec3s a) {
}
/// Convert short vector a to float vector 'dest'
void *vec3s_to_vec3f(Vec3f dest, Vec3s a) {
void *vec3s_to_vec3f(Vec3f dest, Vec3s a)
{
dest[0] = a[0];
dest[1] = a[1];
dest[2] = a[2];
@@ -1533,11 +1543,12 @@ void *vec3s_to_vec3f(Vec3f dest, Vec3s a) {
* Convert float vector a to a short vector 'dest' by rounding the components
* to the nearest integer.
*/
void *vec3f_to_vec3s(Vec3s dest, Vec3f a) {
void *vec3f_to_vec3s(Vec3s dest, Vec3f a)
{
// add/subtract 0.5 in order to round to the nearest s32 instead of truncating
dest[0] = a[0] + ((a[0] > 0) ? 0.5f : -0.5f);
dest[1] = a[1] + ((a[1] > 0) ? 0.5f : -0.5f);
dest[2] = a[2] + ((a[2] > 0) ? 0.5f : -0.5f);
dest[0] = a[0] + (a[0] > 0 ? 0.5f : -0.5f);
dest[1] = a[1] + (a[1] > 0 ? 0.5f : -0.5f);
dest[2] = a[2] + (a[2] > 0 ? 0.5f : -0.5f);
return &dest; //! warning: function returns address of local variable
}
@@ -1546,7 +1557,8 @@ void *vec3f_to_vec3s(Vec3s dest, Vec3f a) {
* It is similar to vec3f_cross, but it calculates the vectors (c-b) and (b-a)
* at the same time.
*/
void *find_vector_perpendicular_to_plane(Vec3f dest, Vec3f a, Vec3f b, Vec3f c) {
void *find_vector_perpendicular_to_plane(Vec3f dest, Vec3f a, Vec3f b, Vec3f c)
{
dest[0] = (b[1] - a[1]) * (c[2] - b[2]) - (c[1] - b[1]) * (b[2] - a[2]);
dest[1] = (b[2] - a[2]) * (c[0] - b[0]) - (c[2] - b[2]) * (b[0] - a[0]);
dest[2] = (b[0] - a[0]) * (c[1] - b[1]) - (c[0] - b[0]) * (b[1] - a[1]);
@@ -1554,7 +1566,8 @@ void *find_vector_perpendicular_to_plane(Vec3f dest, Vec3f a, Vec3f b, Vec3f c)
}
/// Make vector 'dest' the cross product of vectors a and b.
void *vec3f_cross(Vec3f dest, Vec3f a, Vec3f b) {
void *vec3f_cross(Vec3f dest, Vec3f a, Vec3f b)
{
dest[0] = a[1] * b[2] - b[1] * a[2];
dest[1] = a[2] * b[0] - b[2] * a[0];
dest[2] = a[0] * b[1] - b[0] * a[1];
@@ -1562,7 +1575,8 @@ void *vec3f_cross(Vec3f dest, Vec3f a, Vec3f b) {
}
/// Scale vector 'dest' so it has length 1
void *vec3f_normalize(Vec3f dest) {
void *vec3f_normalize(Vec3f dest)
{
//! Possible division by zero
f32 invsqrt = 1.0f / sqrtf(dest[0] * dest[0] + dest[1] * dest[1] + dest[2] * dest[2]);
@@ -1575,12 +1589,13 @@ void *vec3f_normalize(Vec3f dest) {
#pragma GCC diagnostic pop
/// Copy matrix 'src' to 'dest'
void mtxf_copy(Mat4 dest, Mat4 src) {
register s32 i;
void mtxf_copy(Mat4 dest, Mat4 src)
{
register u32 *d = (u32 *)dest;
register u32 *s = (u32 *)src;
for (i = 0; i < 16; i++) {
for (register s32 i = 0; i < 16; i++)
{
*d++ = *s++;
}
}
@@ -1588,7 +1603,8 @@ void mtxf_copy(Mat4 dest, Mat4 src) {
/**
* Set mtx to the identity matrix
*/
void mtxf_identity(Mat4 mtx) {
void mtxf_identity(Mat4 mtx)
{
register s32 i;
register f32 *dest;
// These loops must be one line to match on -O2
@@ -1603,7 +1619,8 @@ void mtxf_identity(Mat4 mtx) {
/**
* Set dest to a translation matrix of vector b
*/
void mtxf_translate(Mat4 dest, Vec3f b) {
void mtxf_translate(Mat4 dest, Vec3f b)
{
mtxf_identity(dest);
dest[3][0] = b[0];
dest[3][1] = b[1];
@@ -1616,43 +1633,31 @@ void mtxf_translate(Mat4 dest, Vec3f b) {
* at the position 'to'. The up-vector is assumed to be (0, 1, 0), but the 'roll'
* angle allows a bank rotation of the camera.
*/
void mtxf_lookat(Mat4 mtx, Vec3f from, Vec3f to, s16 roll) {
register f32 invLength;
f32 dx;
f32 dz;
f32 xColY;
f32 yColY;
f32 zColY;
f32 xColZ;
f32 yColZ;
f32 zColZ;
f32 xColX;
f32 yColX;
f32 zColX;
void mtxf_lookat(Mat4 mtx, Vec3f from, Vec3f to, s16 roll)
{
f32 dx = to[0] - from[0];
f32 dz = to[2] - from[2];
dx = to[0] - from[0];
dz = to[2] - from[2];
invLength = -1.0 / sqrtf(dx * dx + dz * dz);
register f32 invLength = -1.0 / sqrtf(dx * dx + dz * dz);
dx *= invLength;
dz *= invLength;
yColY = coss(roll);
xColY = sins(roll) * dz;
zColY = -sins(roll) * dx;
f32 yColY = coss(roll);
f32 xColY = sins(roll) * dz;
f32 zColY = -sins(roll) * dx;
xColZ = to[0] - from[0];
yColZ = to[1] - from[1];
zColZ = to[2] - from[2];
f32 xColZ = to[0] - from[0];
f32 yColZ = to[1] - from[1];
f32 zColZ = to[2] - from[2];
invLength = -1.0 / sqrtf(xColZ * xColZ + yColZ * yColZ + zColZ * zColZ);
xColZ *= invLength;
yColZ *= invLength;
zColZ *= invLength;
xColX = yColY * zColZ - zColY * yColZ;
yColX = zColY * xColZ - xColY * zColZ;
zColX = xColY * yColZ - yColY * xColZ;
f32 xColX = yColY * zColZ - zColY * yColZ;
f32 yColX = zColY * xColZ - xColY * zColZ;
f32 zColX = xColY * yColZ - yColY * xColZ;
invLength = 1.0 / sqrtf(xColX * xColX + yColX * yColX + zColX * zColX);
@@ -1694,7 +1699,8 @@ void mtxf_lookat(Mat4 mtx, Vec3f from, Vec3f to, s16 roll) {
* Build a matrix that rotates around the z axis, then the x axis, then the y
* axis, and then translates.
*/
void mtxf_rotate_zxy_and_translate(Mat4 dest, Vec3f translate, Vec3s rotate) {
void mtxf_rotate_zxy_and_translate(Mat4 dest, Vec3f translate, Vec3s rotate)
{
register f32 sx = sins(rotate[0]);
register f32 cx = coss(rotate[0]);
@@ -1727,7 +1733,8 @@ void mtxf_rotate_zxy_and_translate(Mat4 dest, Vec3f translate, Vec3s rotate) {
* Build a matrix that rotates around the x axis, then the y axis, then the z
* axis, and then translates.
*/
void mtxf_rotate_xyz_and_translate(Mat4 dest, Vec3f b, Vec3s c) {
void mtxf_rotate_xyz_and_translate(Mat4 dest, Vec3f b, Vec3s c)
{
register f32 sx = sins(c[0]);
register f32 cx = coss(c[0]);
@@ -1764,7 +1771,8 @@ void mtxf_rotate_xyz_and_translate(Mat4 dest, Vec3f b, Vec3s c) {
* 'position' is the position of the object in the world
* 'angle' rotates the object while still facing the camera.
*/
void mtxf_billboard(Mat4 dest, Mat4 mtx, Vec3f position, s16 angle) {
void mtxf_billboard(Mat4 dest, Mat4 mtx, Vec3f position, s16 angle)
{
dest[0][0] = coss(angle);
dest[0][1] = sins(angle);
dest[0][2] = 0;
@@ -1796,7 +1804,8 @@ void mtxf_billboard(Mat4 dest, Mat4 mtx, Vec3f position, s16 angle) {
* 'yaw' is the angle which it should face
* 'pos' is the object's position in the world
*/
void mtxf_align_terrain_normal(Mat4 dest, Vec3f upDir, Vec3f pos, s16 yaw) {
void mtxf_align_terrain_normal(Mat4 dest, Vec3f upDir, Vec3f pos, s16 yaw)
{
Vec3f lateralDir;
Vec3f leftDir;
Vec3f forwardDir;
@@ -1839,7 +1848,8 @@ void mtxf_align_terrain_normal(Mat4 dest, Vec3f upDir, Vec3f pos, s16 yaw) {
* 'pos' is the object's position in the world
* 'radius' is the distance from each triangle vertex to the center
*/
void mtxf_align_terrain_triangle(Mat4 mtx, Vec3f pos, s16 yaw, f32 radius) {
void mtxf_align_terrain_triangle(Mat4 mtx, Vec3f pos, s16 yaw, f32 radius)
{
struct SM64SurfaceCollisionData *sp74;
Vec3f point0;
Vec3f point1;
@@ -1848,7 +1858,6 @@ void mtxf_align_terrain_triangle(Mat4 mtx, Vec3f pos, s16 yaw, f32 radius) {
Vec3f xColumn;
Vec3f yColumn;
Vec3f zColumn;
f32 avgY;
f32 minY = -radius * 3;
point0[0] = pos[0] + radius * sins(yaw + 0x2AAA);
@@ -1862,19 +1871,22 @@ void mtxf_align_terrain_triangle(Mat4 mtx, Vec3f pos, s16 yaw, f32 radius) {
point1[1] = find_floor(point1[0], pos[1] + 150, point1[2], &sp74);
point2[1] = find_floor(point2[0], pos[1] + 150, point2[2], &sp74);
if (point0[1] - pos[1] < minY) {
if (point0[1] - pos[1] < minY)
{
point0[1] = pos[1];
}
if (point1[1] - pos[1] < minY) {
if (point1[1] - pos[1] < minY)
{
point1[1] = pos[1];
}
if (point2[1] - pos[1] < minY) {
if (point2[1] - pos[1] < minY)
{
point2[1] = pos[1];
}
avgY = (point0[1] + point1[1] + point2[1]) / 3;
f32 avgY = (point0[1] + point1[1] + point2[1]) / 3;
vec3f_set(forward, sins(yaw), 0, coss(yaw));
find_vector_perpendicular_to_plane(yColumn, point0, point1, point2);
@@ -1892,7 +1904,7 @@ void mtxf_align_terrain_triangle(Mat4 mtx, Vec3f pos, s16 yaw, f32 radius) {
mtx[1][0] = yColumn[0];
mtx[1][1] = yColumn[1];
mtx[1][2] = yColumn[2];
mtx[3][1] = (avgY < pos[1]) ? pos[1] : avgY;
mtx[3][1] = avgY < pos[1] ? pos[1] : avgY;
mtx[2][0] = zColumn[0];
mtx[2][1] = zColumn[1];
@@ -1913,16 +1925,14 @@ void mtxf_align_terrain_triangle(Mat4 mtx, Vec3f pos, s16 yaw, f32 radius) {
* The resulting matrix represents first applying transformation b and
* then a.
*/
void mtxf_mul(Mat4 dest, Mat4 a, Mat4 b) {
void mtxf_mul(Mat4 dest, Mat4 a, Mat4 b)
{
Mat4 temp;
register f32 entry0;
register f32 entry1;
register f32 entry2;
// column 0
entry0 = a[0][0];
entry1 = a[0][1];
entry2 = a[0][2];
register f32 entry0 = a[0][0];
register f32 entry1 = a[0][1];
register f32 entry2 = a[0][2];
temp[0][0] = entry0 * b[0][0] + entry1 * b[1][0] + entry2 * b[2][0];
temp[0][1] = entry0 * b[0][1] + entry1 * b[1][1] + entry2 * b[2][1];
temp[0][2] = entry0 * b[0][2] + entry1 * b[1][2] + entry2 * b[2][2];
@@ -1960,10 +1970,10 @@ void mtxf_mul(Mat4 dest, Mat4 a, Mat4 b) {
/**
* Set matrix 'dest' to 'mtx' scaled by vector s
*/
void mtxf_scale_vec3f(Mat4 dest, Mat4 mtx, Vec3f s) {
register s32 i;
for (i = 0; i < 4; i++) {
void mtxf_scale_vec3f(Mat4 dest, Mat4 mtx, Vec3f s)
{
for (register s32 i = 0; i < 4; i++)
{
dest[0][i] = mtx[0][i] * s[0];
dest[1][i] = mtx[1][i] * s[1];
dest[2][i] = mtx[2][i] * s[2];
@@ -1976,7 +1986,8 @@ void mtxf_scale_vec3f(Mat4 dest, Mat4 mtx, Vec3f s) {
* to the point. Note that the bottom row is assumed to be [0, 0, 0, 1], which is
* true for transformation matrices if the translation has a w component of 1.
*/
void mtxf_mul_vec3s(Mat4 mtx, Vec3s b) {
void mtxf_mul_vec3s(Mat4 mtx, Vec3s b)
{
register f32 x = b[0];
register f32 y = b[1];
register f32 z = b[2];
@@ -1986,7 +1997,8 @@ void mtxf_mul_vec3s(Mat4 mtx, Vec3s b) {
b[2] = x * mtx[0][2] + y * mtx[1][2] + z * mtx[2][2] + mtx[3][2];
}
void mtxf_mul_vec3f(Mat4 mtx, Vec3f b) {
void mtxf_mul_vec3f(Mat4 mtx, Vec3f b)
{
register f32 x = b[0];
register f32 y = b[1];
register f32 z = b[2];
@@ -1995,6 +2007,7 @@ void mtxf_mul_vec3f(Mat4 mtx, Vec3f b) {
b[1] = x * mtx[0][1] + y * mtx[1][1] + z * mtx[2][1] + mtx[3][1];
b[2] = x * mtx[0][2] + y * mtx[1][2] + z * mtx[2][2] + mtx[3][2];
}
/**
* Convert float matrix 'src' to fixed point matrix 'dest'.
* The float matrix may not contain entries larger than 65536 or the console
@@ -2004,7 +2017,8 @@ void mtxf_mul_vec3f(Mat4 mtx, Vec3f b) {
* exception. On Wii and Wii U Virtual Console the value will simply be clamped
* and no crashes occur.
*/
void mtxf_to_mtx(Mtx *dest, Mat4 src) {
void mtxf_to_mtx(Mtx *dest, Mat4 src)
{
#ifdef AVOID_UB
// Avoid type-casting which is technically UB by calling the equivalent
// guMtxF2L function. This helps little-endian systems, as well.
@@ -2016,7 +2030,8 @@ void mtxf_to_mtx(Mtx *dest, Mat4 src) {
register s16 *t0 = (s16 *)dest + 16; // all fraction parts stored in last 16 bytes
register f32 *t1 = (f32 *)src;
for (i = 0; i < 16; i++) {
for (i = 0; i < 16; i++)
{
asFixedPoint = *t1++ * (1 << 16); //! float-to-integer conversion responsible for PU crashes
*a3++ = GET_HIGH_S16_OF_32(asFixedPoint); // integer part
*t0++ = GET_LOW_S16_OF_32(asFixedPoint); // fraction part
@@ -2027,7 +2042,8 @@ void mtxf_to_mtx(Mtx *dest, Mat4 src) {
/**
* Set 'mtx' to a transformation matrix that rotates around the z axis.
*/
void mtxf_rotate_xy(Mtx *mtx, s16 angle) {
void mtxf_rotate_xy(Mtx *mtx, s16 angle)
{
Mat4 temp;
mtxf_identity(temp);
@@ -2046,7 +2062,8 @@ void mtxf_rotate_xy(Mtx *mtx, s16 angle) {
* objMtx back from screen orientation to world orientation, and then subtracting
* the camera position.
*/
void get_pos_from_transform_mtx(Vec3f dest, Mat4 objMtx, Mat4 camMtx) {
void get_pos_from_transform_mtx(Vec3f dest, Mat4 objMtx, Mat4 camMtx)
{
f32 camX = camMtx[3][0] * camMtx[0][0] + camMtx[3][1] * camMtx[0][1] + camMtx[3][2] * camMtx[0][2];
f32 camY = camMtx[3][0] * camMtx[1][0] + camMtx[3][1] * camMtx[1][1] + camMtx[3][2] * camMtx[1][2];
f32 camZ = camMtx[3][0] * camMtx[2][0] + camMtx[3][1] * camMtx[2][1] + camMtx[3][2] * camMtx[2][2];
@@ -2064,7 +2081,8 @@ void get_pos_from_transform_mtx(Vec3f dest, Mat4 objMtx, Mat4 camMtx) {
* of that vector, as well as the yaw and pitch angles.
* Basically it converts the direction to spherical coordinates.
*/
void vec3f_get_dist_and_angle(Vec3f from, Vec3f to, f32 *dist, s16 *pitch, s16 *yaw) {
void vec3f_get_dist_and_angle(Vec3f from, Vec3f to, f32 *dist, s16 *pitch, s16 *yaw)
{
register f32 x = to[0] - from[0];
register f32 y = to[1] - from[1];
register f32 z = to[2] - from[2];
@@ -2078,7 +2096,8 @@ void vec3f_get_dist_and_angle(Vec3f from, Vec3f to, f32 *dist, s16 *pitch, s16 *
* Construct the 'to' point which is distance 'dist' away from the 'from' position,
* and has the angles pitch and yaw.
*/
void vec3f_set_dist_and_angle(Vec3f from, Vec3f to, f32 dist, s16 pitch, s16 yaw) {
void vec3f_set_dist_and_angle(Vec3f from, Vec3f to, f32 dist, s16 pitch, s16 yaw)
{
to[0] = from[0] + dist * coss(pitch) * sins(yaw);
to[1] = from[1] + dist * sins(pitch);
to[2] = from[2] + dist * coss(pitch) * coss(yaw);
@@ -2088,18 +2107,24 @@ void vec3f_set_dist_and_angle(Vec3f from, Vec3f to, f32 dist, s16 pitch, s16 yaw
* Return the value 'current' after it tries to approach target, going up at
* most 'inc' and going down at most 'dec'.
*/
s32 approach_s32(s32 current, s32 target, s32 inc, s32 dec) {
s32 approach_s32(s32 current, s32 target, s32 inc, s32 dec)
{
//! If target is close to the max or min s32, then it's possible to overflow
// past it without stopping.
if (current < target) {
if (current < target)
{
current += inc;
if (current > target) {
if (current > target)
{
current = target;
}
} else {
}
else
{
current -= dec;
if (current < target) {
if (current < target)
{
current = target;
}
}
@@ -2110,15 +2135,21 @@ s32 approach_s32(s32 current, s32 target, s32 inc, s32 dec) {
* Return the value 'current' after it tries to approach target, going up at
* most 'inc' and going down at most 'dec'.
*/
f32 approach_f32(f32 current, f32 target, f32 inc, f32 dec) {
if (current < target) {
f32 approach_f32(f32 current, f32 target, f32 inc, f32 dec)
{
if (current < target)
{
current += inc;
if (current > target) {
if (current > target)
{
current = target;
}
} else {
}
else
{
current -= dec;
if (current < target) {
if (current < target)
{
current = target;
}
}
@@ -2129,12 +2160,16 @@ f32 approach_f32(f32 current, f32 target, f32 inc, f32 dec) {
* Helper function for atan2s. Does a look up of the arctangent of y/x assuming
* the resulting angle is in range [0, 0x2000] (1/8 of a circle).
*/
static u16 atan2_lookup(f32 y, f32 x) {
static u16 atan2_lookup(f32 y, f32 x)
{
u16 ret;
if (x == 0) {
if (x == 0)
{
ret = gArctanTable[0];
} else {
}
else
{
ret = gArctanTable[(s32)(y / x * 1024 + 0.5f)];
}
return ret;
@@ -2144,37 +2179,59 @@ static u16 atan2_lookup(f32 y, f32 x) {
* Compute the angle from (0, 0) to (x, y) as a s16. Given that terrain is in
* the xz-plane, this is commonly called with (z, x) to get a yaw angle.
*/
s16 atan2s(f32 y, f32 x) {
s16 atan2s(f32 y, f32 x)
{
u16 ret;
if (x >= 0) {
if (y >= 0) {
if (y >= x) {
if (x >= 0)
{
if (y >= 0)
{
if (y >= x)
{
ret = atan2_lookup(x, y);
} else {
}
else
{
ret = 0x4000 - atan2_lookup(y, x);
}
} else {
}
else
{
y = -y;
if (y < x) {
if (y < x)
{
ret = 0x4000 + atan2_lookup(y, x);
} else {
}
else
{
ret = 0x8000 - atan2_lookup(x, y);
}
}
} else {
}
else
{
x = -x;
if (y < 0) {
if (y < 0)
{
y = -y;
if (y >= x) {
if (y >= x)
{
ret = 0x8000 + atan2_lookup(x, y);
} else {
}
else
{
ret = 0xC000 - atan2_lookup(y, x);
}
} else {
if (y < x) {
}
else
{
if (y < x)
{
ret = 0xC000 + atan2_lookup(y, x);
} else {
}
else
{
ret = -atan2_lookup(x, y);
}
}
@@ -2220,14 +2277,16 @@ s16 atan2s(f32 y, f32 x) {
* [0, 0, 0, 0, 1, 2, ... n-1, n, n, n, n]
* TODO: verify the classification of the spline / figure out how polynomials were computed
*/
void spline_get_weights(Vec4f result, f32 t, UNUSED s32 c) {
void spline_get_weights(Vec4f result, f32 t, UNUSED s32 c)
{
f32 tinv = 1 - t;
f32 tinv2 = tinv * tinv;
f32 tinv3 = tinv2 * tinv;
f32 t2 = t * t;
f32 t3 = t2 * t;
switch (gSplineState) {
switch (gSplineState)
{
case CURVE_BEGIN_1:
result[0] = tinv3;
result[1] = t3 * 1.75f - t2 * 4.5f + t * 3.0f;
@@ -2236,20 +2295,20 @@ void spline_get_weights(Vec4f result, f32 t, UNUSED s32 c) {
break;
case CURVE_BEGIN_2:
result[0] = tinv3 * 0.25f;
result[1] = t3 * (7 / 12.0f) - t2 * 1.25f + t * 0.25f + (7 / 12.0f);
result[2] = -t3 * 0.5f + t2 * 0.5f + t * 0.5f + (1 / 6.0f);
result[1] = t3 * (7 / 12.0f) - t2 * 1.25f + t * 0.25f + 7 / 12.0f;
result[2] = -t3 * 0.5f + t2 * 0.5f + t * 0.5f + 1 / 6.0f;
result[3] = t3 * (1 / 6.0f);
break;
case CURVE_MIDDLE:
result[0] = tinv3 * (1 / 6.0f);
result[1] = t3 * 0.5f - t2 + (4 / 6.0f);
result[2] = -t3 * 0.5f + t2 * 0.5f + t * 0.5f + (1 / 6.0f);
result[1] = t3 * 0.5f - t2 + 4 / 6.0f;
result[2] = -t3 * 0.5f + t2 * 0.5f + t * 0.5f + 1 / 6.0f;
result[3] = t3 * (1 / 6.0f);
break;
case CURVE_END_1:
result[0] = tinv3 * (1 / 6.0f);
result[1] = -tinv3 * 0.5f + tinv2 * 0.5f + tinv * 0.5f + (1 / 6.0f);
result[2] = tinv3 * (7 / 12.0f) - tinv2 * 1.25f + tinv * 0.25f + (7 / 12.0f);
result[1] = -tinv3 * 0.5f + tinv2 * 0.5f + tinv * 0.5f + 1 / 6.0f;
result[2] = tinv3 * (7 / 12.0f) - tinv2 * 1.25f + tinv * 0.25f + 7 / 12.0f;
result[3] = t3 * 0.25f;
break;
case CURVE_END_2:
@@ -2269,7 +2328,8 @@ void spline_get_weights(Vec4f result, f32 t, UNUSED s32 c) {
* The array should end with three entries with s=0 (infinite keyframe duration).
* That's because the spline has a 3rd degree polynomial, so it looks 3 points ahead.
*/
void anim_spline_init(Vec4s *keyFrames) {
void anim_spline_init(Vec4s *keyFrames)
{
gSplineKeyframe = keyFrames;
gSplineKeyframeFraction = 0;
gSplineState = 1;
@@ -2280,28 +2340,32 @@ void anim_spline_init(Vec4s *keyFrames) {
* anim_spline_init should be called before polling for vectors.
* Returns TRUE when the last point is reached, FALSE otherwise.
*/
s32 anim_spline_poll(Vec3f result) {
s32 anim_spline_poll(Vec3f result)
{
Vec4f weights;
s32 i;
s32 hasEnded = FALSE;
vec3f_copy(result, gVec3fZero);
spline_get_weights(weights, gSplineKeyframeFraction, gSplineState);
for (i = 0; i < 4; i++) {
for (s32 i = 0; i < 4; i++)
{
result[0] += weights[i] * gSplineKeyframe[i][1];
result[1] += weights[i] * gSplineKeyframe[i][2];
result[2] += weights[i] * gSplineKeyframe[i][3];
}
if ((gSplineKeyframeFraction += gSplineKeyframe[0][0] / 1000.0f) >= 1) {
if ((gSplineKeyframeFraction += gSplineKeyframe[0][0] / 1000.0f) >= 1)
{
gSplineKeyframe++;
gSplineKeyframeFraction--;
switch (gSplineState) {
switch (gSplineState)
{
case CURVE_END_2:
hasEnded = TRUE;
break;
case CURVE_MIDDLE:
if (gSplineKeyframe[2][0] == 0) {
if (gSplineKeyframe[2][0] == 0)
{
gSplineState = CURVE_END_1;
}
break;
@@ -2315,7 +2379,6 @@ s32 anim_spline_poll(Vec3f result) {
}
// From object_helpers.c
/**
@@ -2326,9 +2389,10 @@ s32 anim_spline_poll(Vec3f result) {
* | 0 0 0 1 |
* i.e. a matrix representing a linear transformation over 3 space.
*/
void linear_mtxf_mul_vec3f(Mat4 m, Vec3f dst, Vec3f v) {
s32 i;
for (i = 0; i < 3; i++) {
void linear_mtxf_mul_vec3f(Mat4 m, Vec3f dst, Vec3f v)
{
for (s32 i = 0; i < 3; i++)
{
dst[i] = m[0][i] * v[0] + m[1][i] * v[1] + m[2][i] * v[2];
}
}
@@ -2341,9 +2405,10 @@ void linear_mtxf_mul_vec3f(Mat4 m, Vec3f dst, Vec3f v) {
* | 0 0 0 1 |
* i.e. a matrix representing a linear transformation over 3 space.
*/
void linear_mtxf_transpose_mul_vec3f(Mat4 m, Vec3f dst, Vec3f v) {
s32 i;
for (i = 0; i < 3; i++) {
void linear_mtxf_transpose_mul_vec3f(Mat4 m, Vec3f dst, Vec3f v)
{
for (s32 i = 0; i < 3; i++)
{
dst[i] = m[i][0] * v[0] + m[i][1] * v[1] + m[i][2] * v[2];
}
}
+38
View File
@@ -34,49 +34,87 @@ extern f32 gCosineTable[];
#define sqr(x) ((x) * (x))
void *vec3f_copy(Vec3f dest, Vec3f src);
void *vec3f_set(Vec3f dest, f32 x, f32 y, f32 z);
void *vec3f_add(Vec3f dest, Vec3f a);
void *vec3f_sum(Vec3f dest, Vec3f a, Vec3f b);
void *vec3s_copy(Vec3s dest, Vec3s src);
void *vec3s_set(Vec3s dest, s16 x, s16 y, s16 z);
void *vec3s_add(Vec3s dest, Vec3s a);
void *vec3s_sum(Vec3s dest, Vec3s a, Vec3s b);
void *vec3s_sub(Vec3s dest, Vec3s a);
void *vec3s_to_vec3f(Vec3f dest, Vec3s a);
void *vec3f_to_vec3s(Vec3s dest, Vec3f a);
void *find_vector_perpendicular_to_plane(Vec3f dest, Vec3f a, Vec3f b, Vec3f c);
void *vec3f_cross(Vec3f dest, Vec3f a, Vec3f b);
void *vec3f_normalize(Vec3f dest);
void mtxf_copy(Mat4 dest, Mat4 src);
void mtxf_identity(Mat4 mtx);
void mtxf_translate(Mat4 dest, Vec3f b);
void mtxf_lookat(Mat4 mtx, Vec3f from, Vec3f to, s16 roll);
void mtxf_rotate_zxy_and_translate(Mat4 dest, Vec3f translate, Vec3s rotate);
void mtxf_rotate_xyz_and_translate(Mat4 dest, Vec3f b, Vec3s c);
void mtxf_billboard(Mat4 dest, Mat4 mtx, Vec3f position, s16 angle);
void mtxf_align_terrain_normal(Mat4 dest, Vec3f upDir, Vec3f pos, s16 yaw);
void mtxf_align_terrain_triangle(Mat4 mtx, Vec3f pos, s16 yaw, f32 radius);
void mtxf_mul(Mat4 dest, Mat4 a, Mat4 b);
void mtxf_scale_vec3f(Mat4 dest, Mat4 mtx, Vec3f s);
void mtxf_mul_vec3s(Mat4 mtx, Vec3s b);
void mtxf_mul_vec3f(Mat4 mtx, Vec3f b);
void mtxf_to_mtx(Mtx *dest, Mat4 src);
void mtxf_rotate_xy(Mtx *mtx, s16 angle);
void get_pos_from_transform_mtx(Vec3f dest, Mat4 objMtx, Mat4 camMtx);
void vec3f_get_dist_and_angle(Vec3f from, Vec3f to, f32 *dist, s16 *pitch, s16 *yaw);
void vec3f_set_dist_and_angle(Vec3f from, Vec3f to, f32 dist, s16 pitch, s16 yaw);
s32 approach_s32(s32 current, s32 target, s32 inc, s32 dec);
f32 approach_f32(f32 current, f32 target, f32 inc, f32 dec);
s16 atan2s(f32 y, f32 x);
// libsm64: `atan2f()` is not used anywhere and collides with `math.h`'s definition of the function, better to remove it entirely.
// f32 atan2f(f32 a, f32 b);
void spline_get_weights(Vec4f result, f32 t, UNUSED s32 c);
void anim_spline_init(Vec4s * keyFrames);
s32 anim_spline_poll(Vec3f result);
// From object_helpers.c
void linear_mtxf_mul_vec3f(Mat4 m, Vec3f dst, Vec3f v);
void linear_mtxf_transpose_mul_vec3f(Mat4 m, Vec3f dst, Vec3f v);
+145 -95
View File
@@ -8,18 +8,19 @@
/**
* Iterate through the list of ceilings and find the first ceiling over a given point.
*/
static struct SM64SurfaceCollisionData *find_ceil_from_list( s32 x, s32 y, s32 z, f32 *pheight) {
register struct SM64SurfaceCollisionData *surf;
register s32 x1, z1, x2, z2, x3, z3;
static struct SM64SurfaceCollisionData *find_ceil_from_list(f32 x, f32 y, f32 z, f32 *pheight)
{
struct SM64SurfaceCollisionData *ceil = NULL;
ceil = NULL;
uint32_t groupCount = loaded_surface_iter_group_count();
for( int i = 0; i < groupCount; ++i ) {
for (int i = 0; i < groupCount; ++i)
{
uint32_t surfCount = loaded_surface_iter_group_size(i);
for( int j = 0; j < surfCount; ++j ) {
surf = loaded_surface_iter_get_at_index( i, j );
for (int j = 0; j < surfCount; ++j)
{
register struct SM64SurfaceCollisionData *surf = loaded_surface_iter_get_at_index(i, j);
// libsm64: Weed out surfaces whose triangles are actually line segs. TODO do this at surface load time
if (!surf->isValid) continue;
@@ -27,23 +28,26 @@ static struct SM64SurfaceCollisionData *find_ceil_from_list( s32 x, s32 y, s32 z
// Do the check normally done in add_surface_to_cell
if (surf->normal.y >= -0.01f) continue;
x1 = surf->vertex1[0];
z1 = surf->vertex1[2];
z2 = surf->vertex2[2];
x2 = surf->vertex2[0];
register f32 x1 = surf->vertex1[0];
register f32 z1 = surf->vertex1[2];
register f32 z2 = surf->vertex2[2];
register f32 x2 = surf->vertex2[0];
// Checking if point is in bounds of the triangle laterally.
if ((z1 - z) * (x2 - x1) - (x1 - x) * (z2 - z1) > 0) {
if ((z1 - z) * (x2 - x1) - (x1 - x) * (z2 - z1) > 0)
{
continue;
}
// Slight optimization by checking these later.
x3 = surf->vertex3[0];
z3 = surf->vertex3[2];
if ((z2 - z) * (x3 - x2) - (x2 - x) * (z3 - z2) > 0) {
register f32 x3 = surf->vertex3[0];
register f32 z3 = surf->vertex3[2];
if ((z2 - z) * (x3 - x2) - (x2 - x) * (z3 - z2) > 0)
{
continue;
}
if ((z3 - z) * (x1 - x3) - (x3 - x) * (z1 - z3) > 0) {
if ((z3 - z) * (x1 - x3) - (x3 - x) * (z1 - z3) > 0)
{
continue;
}
@@ -52,21 +56,22 @@ static struct SM64SurfaceCollisionData *find_ceil_from_list( s32 x, s32 y, s32 z
f32 ny = surf->normal.y;
f32 nz = surf->normal.z;
f32 oo = surf->originOffset;
f32 height;
// If a wall, ignore it. Likely a remnant, should never occur.
if (ny == 0.0f) {
if (ny == 0.0f)
{
continue;
}
// Find the ceil height at the specific point.
height = -(x * nx + nz * z + oo) / ny;
f32 height = -(x * nx + nz * z + oo) / ny;
// Checks for ceiling interaction with a 78 unit buffer.
//! (Exposed Ceilings) Because any point above a ceiling counts
// as interacting with a ceiling, ceilings far below can cause
// "invisible walls" that are really just exposed ceilings.
if (y - (height - -78.0f) > 0.0f) {
if (y - (height - -78.0f) > 0.0f)
{
continue;
}
@@ -76,26 +81,25 @@ static struct SM64SurfaceCollisionData *find_ceil_from_list( s32 x, s32 y, s32 z
ceil = surf;
}
}
}}
}
}
return ceil;
}
/**
* Iterate through the list of floors and find the first floor under a given point.
*/
static struct SM64SurfaceCollisionData *find_floor_from_list( s32 x, s32 y, s32 z, f32 *pheight) {
register struct SM64SurfaceCollisionData *surf;
register s32 x1, z1, x2, z2, x3, z3;
f32 nx, ny, nz;
f32 oo;
f32 height;
static struct SM64SurfaceCollisionData *find_floor_from_list(f32 x, f32 y, f32 z, f32 *pheight)
{
struct SM64SurfaceCollisionData *floor = NULL;
uint32_t groupCount = loaded_surface_iter_group_count();
for( int i = 0; i < groupCount; ++i ) {
for (int i = 0; i < groupCount; ++i)
{
uint32_t surfCount = loaded_surface_iter_group_size(i);
for( int j = 0; j < surfCount; ++j ) {
surf = loaded_surface_iter_get_at_index( i, j );
for (int j = 0; j < surfCount; ++j)
{
register struct SM64SurfaceCollisionData *surf = loaded_surface_iter_get_at_index(i, j);
// libsm64: Weed out surfaces whose triangles are actually line segs. TODO do this at surface load time
if (!surf->isValid) continue;
@@ -103,41 +107,46 @@ static struct SM64SurfaceCollisionData *find_floor_from_list( s32 x, s32 y, s32
// Do the check normally done in add_surface_to_cell
if (surf->normal.y <= 0.01f) continue;
x1 = surf->vertex1[0];
z1 = surf->vertex1[2];
x2 = surf->vertex2[0];
z2 = surf->vertex2[2];
register f32 x1 = surf->vertex1[0];
register f32 z1 = surf->vertex1[2];
register f32 x2 = surf->vertex2[0];
register f32 z2 = surf->vertex2[2];
// Check that the point is within the triangle bounds.
if ((z1 - z) * (x2 - x1) - (x1 - x) * (z2 - z1) < 0) {
if ((z1 - z) * (x2 - x1) - (x1 - x) * (z2 - z1) < 0)
{
continue;
}
// To slightly save on computation time, set this later.
x3 = surf->vertex3[0];
z3 = surf->vertex3[2];
register f32 x3 = surf->vertex3[0];
register f32 z3 = surf->vertex3[2];
if ((z2 - z) * (x3 - x2) - (x2 - x) * (z3 - z2) < 0) {
if ((z2 - z) * (x3 - x2) - (x2 - x) * (z3 - z2) < 0)
{
continue;
}
if ((z3 - z) * (x1 - x3) - (x3 - x) * (z1 - z3) < 0) {
if ((z3 - z) * (x1 - x3) - (x3 - x) * (z1 - z3) < 0)
{
continue;
}
nx = surf->normal.x;
ny = surf->normal.y;
nz = surf->normal.z;
oo = surf->originOffset;
f32 nx = surf->normal.x;
f32 ny = surf->normal.y;
f32 nz = surf->normal.z;
f32 oo = surf->originOffset;
// If a wall, ignore it. Likely a remnant, should never occur.
if (ny == 0.0f) {
if (ny == 0.0f)
{
continue;
}
// Find the height of the floor at a given location.
height = -(x * nx + nz * z + oo) / ny;
f32 height = -(x * nx + nz * z + oo) / ny;
// Checks for floor interaction with a 78 unit buffer.
if (y - (height + -78.0f) < 0.0f) {
if (y - (height + -78.0f) < 0.0f)
{
continue;
}
@@ -146,32 +155,34 @@ static struct SM64SurfaceCollisionData *find_floor_from_list( s32 x, s32 y, s32
*pheight = height;
floor = surf;
}
}}
}
}
return floor;
}
static s32 find_wall_collisions_from_list( struct SM64WallCollisionData *data) {
register struct SM64SurfaceCollisionData *surf;
register f32 offset;
static s32 find_wall_collisions_from_list(struct SM64WallCollisionData *data)
{
register f32 radius = data->radius;
register f32 x = data->x;
register f32 y = data->y + data->offsetY;
register f32 z = data->z;
register f32 px, pz;
register f32 w1, w2, w3;
register f32 y1, y2, y3;
s32 numCols = 0;
// Max collision radius = 200
if (radius > 200.0f) {
if (radius > 200.0f)
{
radius = 200.0f;
}
uint32_t groupCount = loaded_surface_iter_group_count();
for( int i = 0; i < groupCount; ++i ) {
for (int i = 0; i < groupCount; ++i)
{
uint32_t surfCount = loaded_surface_iter_group_size(i);
for( int j = 0; j < surfCount; ++j ) {
surf = loaded_surface_iter_get_at_index( i, j );
for (int j = 0; j < surfCount; ++j)
{
register struct SM64SurfaceCollisionData *surf = loaded_surface_iter_get_at_index(i, j);
// libsm64: Weed out surfaces whose triangles are actually line segs. TODO do this at surface load time
if (!surf->isValid) continue;
@@ -179,95 +190,131 @@ static s32 find_wall_collisions_from_list( struct SM64WallCollisionData *data) {
// Do the check normally done in add_surface_to_cell
if (surf->normal.y < -0.01f || surf->normal.y > 0.01f) continue;
if( surf->normal.x < -0.707f || surf->normal.x > 0.707f ) {
if (surf->normal.x < -0.707f || surf->normal.x > 0.707f)
{
surf->flags |= SURFACE_FLAG_X_PROJECTION;
}
// Exclude a large number of walls immediately to optimize.
if (y < surf->lowerY || y > surf->upperY) {
if (y < surf->lowerY || y > surf->upperY)
{
continue;
}
offset = surf->normal.x * x + surf->normal.y * y + surf->normal.z * z + surf->originOffset;
register f32 offset = surf->normal.x * x + surf->normal.y * y + surf->normal.z * z + surf->originOffset;
if (offset < -radius || offset > radius) {
if (offset < -radius || offset > radius)
{
continue;
}
px = x;
pz = z;
register f32 px = x;
register f32 pz = z;
//! (Quantum Tunneling) Due to issues with the vertices walls choose and
// the fact they are floating point, certain floating point positions
// along the seam of two walls may collide with neither wall or both walls.
if (surf->flags & SURFACE_FLAG_X_PROJECTION) {
w1 = -surf->vertex1[2]; w2 = -surf->vertex2[2]; w3 = -surf->vertex3[2];
y1 = surf->vertex1[1]; y2 = surf->vertex2[1]; y3 = surf->vertex3[1];
if (surf->flags & SURFACE_FLAG_X_PROJECTION)
{
w1 = -surf->vertex1[2];
w2 = -surf->vertex2[2];
w3 = -surf->vertex3[2];
y1 = surf->vertex1[1];
y2 = surf->vertex2[1];
y3 = surf->vertex3[1];
if (surf->normal.x > 0.0f) {
if ((y1 - y) * (w2 - w1) - (w1 - -pz) * (y2 - y1) > 0.0f) {
if (surf->normal.x > 0.0f)
{
if ((y1 - y) * (w2 - w1) - (w1 - -pz) * (y2 - y1) > 0.0f)
{
continue;
}
if ((y2 - y) * (w3 - w2) - (w2 - -pz) * (y3 - y2) > 0.0f) {
if ((y2 - y) * (w3 - w2) - (w2 - -pz) * (y3 - y2) > 0.0f)
{
continue;
}
if ((y3 - y) * (w1 - w3) - (w3 - -pz) * (y1 - y3) > 0.0f) {
continue;
}
} else {
if ((y1 - y) * (w2 - w1) - (w1 - -pz) * (y2 - y1) < 0.0f) {
continue;
}
if ((y2 - y) * (w3 - w2) - (w2 - -pz) * (y3 - y2) < 0.0f) {
continue;
}
if ((y3 - y) * (w1 - w3) - (w3 - -pz) * (y1 - y3) < 0.0f) {
if ((y3 - y) * (w1 - w3) - (w3 - -pz) * (y1 - y3) > 0.0f)
{
continue;
}
}
} else {
w1 = surf->vertex1[0]; w2 = surf->vertex2[0]; w3 = surf->vertex3[0];
y1 = surf->vertex1[1]; y2 = surf->vertex2[1]; y3 = surf->vertex3[1];
else
{
if ((y1 - y) * (w2 - w1) - (w1 - -pz) * (y2 - y1) < 0.0f)
{
continue;
}
if ((y2 - y) * (w3 - w2) - (w2 - -pz) * (y3 - y2) < 0.0f)
{
continue;
}
if ((y3 - y) * (w1 - w3) - (w3 - -pz) * (y1 - y3) < 0.0f)
{
continue;
}
}
}
else
{
w1 = surf->vertex1[0];
w2 = surf->vertex2[0];
w3 = surf->vertex3[0];
y1 = surf->vertex1[1];
y2 = surf->vertex2[1];
y3 = surf->vertex3[1];
if (surf->normal.z > 0.0f) {
if ((y1 - y) * (w2 - w1) - (w1 - px) * (y2 - y1) > 0.0f) {
if (surf->normal.z > 0.0f)
{
if ((y1 - y) * (w2 - w1) - (w1 - px) * (y2 - y1) > 0.0f)
{
continue;
}
if ((y2 - y) * (w3 - w2) - (w2 - px) * (y3 - y2) > 0.0f) {
if ((y2 - y) * (w3 - w2) - (w2 - px) * (y3 - y2) > 0.0f)
{
continue;
}
if ((y3 - y) * (w1 - w3) - (w3 - px) * (y1 - y3) > 0.0f) {
if ((y3 - y) * (w1 - w3) - (w3 - px) * (y1 - y3) > 0.0f)
{
continue;
}
} else {
if ((y1 - y) * (w2 - w1) - (w1 - px) * (y2 - y1) < 0.0f) {
}
else
{
if ((y1 - y) * (w2 - w1) - (w1 - px) * (y2 - y1) < 0.0f)
{
continue;
}
if ((y2 - y) * (w3 - w2) - (w2 - px) * (y3 - y2) < 0.0f) {
if ((y2 - y) * (w3 - w2) - (w2 - px) * (y3 - y2) < 0.0f)
{
continue;
}
if ((y3 - y) * (w1 - w3) - (w3 - px) * (y1 - y3) < 0.0f) {
if ((y3 - y) * (w1 - w3) - (w3 - px) * (y1 - y3) < 0.0f)
{
continue;
}
}
}
// Ignore camera only surfaces.
if (surf->type == SURFACE_CAMERA_BOUNDARY) {
if (surf->type == SURFACE_CAMERA_BOUNDARY)
{
continue;
}
// If an object can pass through a vanish cap wall, pass through.
if (surf->type == SURFACE_VANISH_CAP_WALLS) {
if (surf->type == SURFACE_VANISH_CAP_WALLS)
{
// If an object can pass through a vanish cap wall, pass through.
if (gCurrentObject != NULL
&& (gCurrentObject->activeFlags & ACTIVE_FLAG_MOVE_THROUGH_GRATE)) {
&& gCurrentObject->activeFlags & ACTIVE_FLAG_MOVE_THROUGH_GRATE)
{
continue;
}
// If Mario has a vanish cap, pass through the vanish cap wall.
if (gCurrentObject != NULL && gCurrentObject == gMarioObject
&& (gMarioState->flags & MARIO_VANISH_CAP)) {
&& gMarioState->flags & MARIO_VANISH_CAP)
{
continue;
}
}
@@ -280,12 +327,14 @@ static s32 find_wall_collisions_from_list( struct SM64WallCollisionData *data) {
//! (Unreferenced Walls) Since this only returns the first four walls,
// this can lead to wall interaction being missed. Typically unreferenced walls
// come from only using one wall, however.
if (data->numWalls < 4) {
if (data->numWalls < 4)
{
data->walls[data->numWalls++] = surf;
}
numCols++;
}}
}
}
return numCols;
}
@@ -348,7 +397,8 @@ f32 find_floor_height_and_data(f32 xPos, f32 yPos, f32 zPos, struct SM64FloorCol
*floorGeo = NULL;
if (floor != NULL) {
if (floor != NULL)
{
sFloorGeo.normalX = floor->normal.x;
sFloorGeo.normalY = floor->normal.y;
sFloorGeo.normalZ = floor->normal.z;
+7
View File
@@ -13,12 +13,19 @@
#define FLOOR_LOWER_LIMIT -110000.f
s32 f32_find_wall_collision(f32 *xPtr, f32 *yPtr, f32 *zPtr, f32 offsetY, f32 radius);
s32 find_wall_collisions(struct SM64WallCollisionData *colData);
f32 find_ceil(f32 posX, f32 posY, f32 posZ, struct SM64SurfaceCollisionData **pceil);
f32 find_floor_height_and_data(f32 xPos, f32 yPos, f32 zPos, struct SM64FloorCollisionData **floorGeo);
f32 find_floor_height(f32 x, f32 y, f32 z);
f32 find_floor(f32 xPos, f32 yPos, f32 zPos, struct SM64SurfaceCollisionData **pfloor);
f32 find_water_level(f32 x, f32 z);
f32 find_poison_gas_level(f32 x, f32 z);
#endif // SURFACE_COLLISION_H
+112 -56
View File
@@ -9,17 +9,24 @@
struct WarpNode
{
/*00*/ u8 id;
/*01*/ u8 destLevel;
/*02*/ u8 destArea;
/*03*/ u8 destNode;
/*00*/
u8 id;
/*01*/
u8 destLevel;
/*02*/
u8 destArea;
/*03*/
u8 destNode;
};
struct ObjectWarpNode
{
/*0x00*/ struct WarpNode node;
/*0x04*/ struct Object *object;
/*0x08*/ struct ObjectWarpNode *next;
/*0x00*/
struct WarpNode node;
/*0x04*/
struct Object *object;
/*0x08*/
struct ObjectWarpNode *next;
};
// From Surface 0x1B to 0x1E
@@ -28,74 +35,118 @@ struct ObjectWarpNode
struct InstantWarp
{
/*0x00*/ u8 id; // 0 = 0x1B / 1 = 0x1C / 2 = 0x1D / 3 = 0x1E
/*0x01*/ u8 area;
/*0x02*/ Vec3s displacement;
/*0x00*/
u8 id; // 0 = 0x1B / 1 = 0x1C / 2 = 0x1D / 3 = 0x1E
/*0x01*/
u8 area;
/*0x02*/
Vec3s displacement;
};
struct SpawnInfo
{
/*0x00*/ Vec3f startPos;
/*0x06*/ Vec3s startAngle;
/*0x0C*/ s8 areaIndex;
/*0x0D*/ s8 activeAreaIndex;
/*0x10*/ u32 behaviorArg;
/*0x14*/ void *behaviorScript;
/*0x18*/ struct GraphNode *unk18;
/*0x1C*/ struct SpawnInfo *next;
/*0x00*/
Vec3f startPos;
/*0x06*/
Vec3s startAngle;
/*0x0C*/
s8 areaIndex;
/*0x0D*/
s8 activeAreaIndex;
/*0x10*/
u32 behaviorArg;
/*0x14*/
void *behaviorScript;
/*0x18*/
struct GraphNode *unk18;
/*0x1C*/
struct SpawnInfo *next;
};
struct UnusedArea28
{
/*0x00*/ s16 unk00;
/*0x02*/ s16 unk02;
/*0x04*/ s16 unk04;
/*0x06*/ s16 unk06;
/*0x08*/ s16 unk08;
/*0x00*/
s16 unk00;
/*0x02*/
s16 unk02;
/*0x04*/
s16 unk04;
/*0x06*/
s16 unk06;
/*0x08*/
s16 unk08;
};
struct Whirlpool
{
/*0x00*/ Vec3s pos;
/*0x03*/ s16 strength;
/*0x00*/
Vec3s pos;
/*0x03*/
s16 strength;
};
struct Area
{
/*0x00*/ s8 index;
/*0x01*/ s8 flags; // Only has 1 flag: 0x01 = Is this the active area?
/*0x00*/
s8 index;
/*0x01*/
s8 flags; // Only has 1 flag: 0x01 = Is this the active area?
// /*0x02*/ u16 terrainType; // default terrain of the level (set from level script cmd 0x31) ; in libsm64 terrain is defined in the Surface struct
/*0x04*/ struct GraphNodeRoot *unk04; // geometry layout data
/*0x08*/ s16 *terrainData; // collision data (set from level script cmd 0x2E)
/*0x0C*/ s8 *surfaceRooms; // (set from level script cmd 0x2F)
/*0x10*/ s16 *macroObjects; // Macro Objects Ptr (set from level script cmd 0x39)
/*0x14*/ struct ObjectWarpNode *warpNodes;
/*0x18*/ struct WarpNode *paintingWarpNodes;
/*0x1C*/ struct InstantWarp *instantWarps;
/*0x20*/ struct SpawnInfo *objectSpawnInfos;
/*0x24*/ struct Camera *camera;
/*0x28*/ struct UnusedArea28 *unused28; // Filled by level script 0x3A, but is unused.
/*0x2C*/ struct Whirlpool *whirlpools[2];
/*0x34*/ u8 dialog[2]; // Level start dialog number (set by level script cmd 0x30)
/*0x36*/ u16 musicParam;
/*0x38*/ u16 musicParam2;
/*0x04*/
struct GraphNodeRoot *unk04; // geometry layout data
/*0x08*/
s16 *terrainData; // collision data (set from level script cmd 0x2E)
/*0x0C*/
s8 *surfaceRooms; // (set from level script cmd 0x2F)
/*0x10*/
s16 *macroObjects; // Macro Objects Ptr (set from level script cmd 0x39)
/*0x14*/
struct ObjectWarpNode *warpNodes;
/*0x18*/
struct WarpNode *paintingWarpNodes;
/*0x1C*/
struct InstantWarp *instantWarps;
/*0x20*/
struct SpawnInfo *objectSpawnInfos;
/*0x24*/
struct Camera *camera;
/*0x28*/
struct UnusedArea28 *unused28; // Filled by level script 0x3A, but is unused.
/*0x2C*/
struct Whirlpool *whirlpools[2];
/*0x34*/
u8 dialog[2]; // Level start dialog number (set by level script cmd 0x30)
/*0x36*/
u16 musicParam;
/*0x38*/
u16 musicParam2;
};
// All the transition data to be used in screen_transition.c
struct WarpTransitionData
{
/*0x00*/ u8 red;
/*0x01*/ u8 green;
/*0x02*/ u8 blue;
/*0x00*/
u8 red;
/*0x01*/
u8 green;
/*0x02*/
u8 blue;
/*0x04*/ s16 startTexRadius;
/*0x06*/ s16 endTexRadius;
/*0x08*/ s16 startTexX;
/*0x0A*/ s16 startTexY;
/*0x0C*/ s16 endTexX;
/*0x0E*/ s16 endTexY;
/*0x04*/
s16 startTexRadius;
/*0x06*/
s16 endTexRadius;
/*0x08*/
s16 startTexX;
/*0x0A*/
s16 startTexY;
/*0x0C*/
s16 endTexX;
/*0x0E*/
s16 endTexY;
/*0x10*/ s16 texTimer; // always 0, does seems to affect transition when disabled
/*0x10*/
s16 texTimer; // always 0, does seems to affect transition when disabled
};
#define WARP_TRANSITION_FADE_FROM_COLOR 0x00
@@ -111,11 +162,16 @@ struct WarpTransitionData
struct WarpTransition
{
/*0x00*/ u8 isActive; // Is the transition active. (either TRUE or FALSE)
/*0x01*/ u8 type; // Determines the type of transition to use (circle, star, etc.)
/*0x02*/ u8 time; // Amount of time to complete the transition (in frames)
/*0x03*/ u8 pauseRendering; // Should the game stop rendering. (either TRUE or FALSE)
/*0x04*/ struct WarpTransitionData data;
/*0x00*/
u8 isActive; // Is the transition active. (either TRUE or FALSE)
/*0x01*/
u8 type; // Determines the type of transition to use (circle, star, etc.)
/*0x02*/
u8 time; // Amount of time to complete the transition (in frames)
/*0x03*/
u8 pauseRendering; // Should the game stop rendering. (either TRUE or FALSE)
/*0x04*/
struct WarpTransitionData data;
};
// extern struct GraphNode **gLoadedGraphNodes;
+7 -5
View File
@@ -4,13 +4,15 @@
#include "../shim.h"
// not sure what this is doing here. not in a behavior file.
Gfx *geo_move_mario_part_from_parent(s32 run, UNUSED struct GraphNode *node, Mat4 mtx) {
Gfx *geo_move_mario_part_from_parent(s32 run, UNUSED struct GraphNode *node, Mat4 mtx)
{
Mat4 sp20;
struct Object *sp1C;
if (run == TRUE) {
sp1C = (struct Object *) gCurGraphNodeObject;
if (sp1C == gMarioObject && sp1C->prevObj != NULL) {
if (run == TRUE)
{
struct Object *sp1C = (struct Object *)gCurGraphNodeObject;
if (sp1C == gMarioObject && sp1C->prevObj != NULL)
{
create_transformation_from_matrices(sp20, mtx, *gCurGraphNodeCamera->matrixPtr);
obj_update_pos_from_parent_transformation(sp20, sp1C->prevObj);
obj_set_gfx_pos_from_pos(sp1C->prevObj);
+191 -95
View File
@@ -300,17 +300,24 @@ struct PlayerCameraState
/**
* Mario's action on this frame.
*/
/*0x00*/ u32 action;
/*0x04*/ Vec3f pos;
/*0x10*/ Vec3s faceAngle;
/*0x16*/ Vec3s headRotation;
/*0x1C*/ s16 unused;
/*0x00*/
u32 action;
/*0x04*/
Vec3f pos;
/*0x10*/
Vec3s faceAngle;
/*0x16*/
Vec3s headRotation;
/*0x1C*/
s16 unused;
/**
* Set to nonzero when an event, such as entering a door, starting the credits, or throwing bowser,
* has happened on this frame.
*/
/*0x1E*/ s16 cameraEvent;
/*0x20*/ struct Object *usedObj;
/*0x1E*/
s16 cameraEvent;
/*0x20*/
struct Object *usedObj;
};
/**
@@ -319,15 +326,24 @@ struct PlayerCameraState
*/
struct TransitionInfo
{
/*0x00*/ s16 posPitch;
/*0x02*/ s16 posYaw;
/*0x04*/ f32 posDist;
/*0x08*/ s16 focPitch;
/*0x0A*/ s16 focYaw;
/*0x0C*/ f32 focDist;
/*0x10*/ s32 framesLeft;
/*0x14*/ Vec3f marioPos;
/*0x20*/ u8 pad; // for the structs to align, there has to be an extra unused variable here. type is unknown.
/*0x00*/
s16 posPitch;
/*0x02*/
s16 posYaw;
/*0x04*/
f32 posDist;
/*0x08*/
s16 focPitch;
/*0x0A*/
s16 focYaw;
/*0x0C*/
f32 focDist;
/*0x10*/
s32 framesLeft;
/*0x14*/
Vec3f marioPos;
/*0x20*/
u8 pad; // for the structs to align, there has to be an extra unused variable here. type is unknown.
};
/**
@@ -336,9 +352,12 @@ struct TransitionInfo
*/
struct HandheldShakePoint
{
/*0x00*/ s8 index; // only set to -1
/*0x04 (aligned)*/ u32 pad;
/*0x08*/ Vec3s point;
/*0x00*/
s8 index; // only set to -1
/*0x04 (aligned)*/
u32 pad;
/*0x08*/
Vec3s point;
}; // size = 0x10
struct Camera;
@@ -348,6 +367,7 @@ struct Camera;
* These are concurrent: multiple CameraEvents can occur on the same frame.
*/
typedef BAD_RETURN (s32)(*CameraEvent)(struct Camera *c);
/**
* The same type as a CameraEvent, but because these are generally longer, and happen in sequential
* order, they're are called "shots," a term taken from cinematography.
@@ -403,24 +423,32 @@ struct Cutscene
struct CameraFOVStatus
{
/// The current function being used to set the camera's field of view (before any fov shake is applied).
/*0x00*/ u8 fovFunc;
/*0x00*/
u8 fovFunc;
/// The current field of view in degrees
/*0x04*/ f32 fov;
/*0x04*/
f32 fov;
// Fields used by shake_camera_fov()
/// The amount to change the current fov by in the fov shake effect.
/*0x08*/ f32 fovOffset;
/*0x08*/
f32 fovOffset;
/// A bool set in fov_default() but unused otherwise
/*0x0C*/ u32 unusedIsSleeping;
/*0x0C*/
u32 unusedIsSleeping;
/// The range in degrees to shake fov
/*0x10*/ f32 shakeAmplitude;
/*0x10*/
f32 shakeAmplitude;
/// Used to calculate fovOffset, the phase through the shake's period.
/*0x14*/ s16 shakePhase;
/*0x14*/
s16 shakePhase;
/// How much to progress through the shake period
/*0x16*/ s16 shakeSpeed;
/*0x16*/
s16 shakeSpeed;
/// How much to decrease shakeAmplitude each frame.
/*0x18*/ s16 decay;
/*0x18*/
s16 decay;
};
/**
@@ -443,20 +471,33 @@ struct CutsceneSplinePoint
*/
struct PlayerGeometry
{
/*0x00*/ struct SM64SurfaceCollisionData *currFloor;
/*0x04*/ f32 currFloorHeight;
/*0x08*/ s16 currFloorType;
/*0x0C*/ struct SM64SurfaceCollisionData *currCeil;
/*0x10*/ s16 currCeilType;
/*0x14*/ f32 currCeilHeight;
/*0x18*/ struct SM64SurfaceCollisionData *prevFloor;
/*0x1C*/ f32 prevFloorHeight;
/*0x20*/ s16 prevFloorType;
/*0x24*/ struct SM64SurfaceCollisionData *prevCeil;
/*0x28*/ f32 prevCeilHeight;
/*0x2C*/ s16 prevCeilType;
/*0x00*/
struct SM64SurfaceCollisionData *currFloor;
/*0x04*/
f32 currFloorHeight;
/*0x08*/
s16 currFloorType;
/*0x0C*/
struct SM64SurfaceCollisionData *currCeil;
/*0x10*/
s16 currCeilType;
/*0x14*/
f32 currCeilHeight;
/*0x18*/
struct SM64SurfaceCollisionData *prevFloor;
/*0x1C*/
f32 prevFloorHeight;
/*0x20*/
s16 prevFloorType;
/*0x24*/
struct SM64SurfaceCollisionData *prevCeil;
/*0x28*/
f32 prevCeilHeight;
/*0x2C*/
s16 prevCeilType;
/// Unused, but recalculated every frame
/*0x30*/ f32 waterHeight;
/*0x30*/
f32 waterHeight;
};
/**
@@ -504,10 +545,14 @@ struct ParallelTrackingPoint
*/
struct CameraStoredInfo
{
/*0x00*/ Vec3f pos;
/*0x0C*/ Vec3f focus;
/*0x18*/ f32 panDist;
/*0x1C*/ f32 cannonYOffset;
/*0x00*/
Vec3f pos;
/*0x0C*/
Vec3f focus;
/*0x18*/
f32 panDist;
/*0x1C*/
f32 cannonYOffset;
};
/**
@@ -533,8 +578,10 @@ struct CutsceneVariable
*/
struct Camera
{
/*0x00*/ u8 mode; // What type of mode the camera uses (see defines above)
/*0x01*/ u8 defMode;
/*0x00*/
u8 mode; // What type of mode the camera uses (see defines above)
/*0x01*/
u8 defMode;
/**
* Determines what direction Mario moves in when the analog stick is moved.
*
@@ -543,24 +590,36 @@ struct Camera
* be. It's effectively the opposite of the camera's actual yaw. Use
* vec3f_get_dist_and_angle() if you need the camera's yaw.
*/
/*0x02*/ s16 yaw;
/*0x04*/ Vec3f focus;
/*0x10*/ Vec3f pos;
/*0x1C*/ Vec3f unusedVec1;
/*0x02*/
s16 yaw;
/*0x04*/
Vec3f focus;
/*0x10*/
Vec3f pos;
/*0x1C*/
Vec3f unusedVec1;
/// The x coordinate of the "center" of the area. The camera will rotate around this point.
/// For example, this is what makes the camera rotate around the hill in BoB
/*0x28*/ f32 areaCenX;
/*0x28*/
f32 areaCenX;
/// The z coordinate of the "center" of the area. The camera will rotate around this point.
/// For example, this is what makes the camera rotate around the hill in BoB
/*0x2C*/ f32 areaCenZ;
/*0x30*/ u8 cutscene;
/*0x31*/ u8 filler31[0x8];
/*0x3A*/ s16 nextYaw;
/*0x3C*/ u8 filler3C[0x28];
/*0x64*/ u8 doorStatus;
/*0x2C*/
f32 areaCenZ;
/*0x30*/
u8 cutscene;
/*0x31*/
u8 filler31[0x8];
/*0x3A*/
s16 nextYaw;
/*0x3C*/
u8 filler3C[0x28];
/*0x64*/
u8 doorStatus;
/// The y coordinate of the "center" of the area. Unlike areaCenX and areaCenZ, this is only used
/// when paused. See zoom_out_if_paused_and_outside
/*0x68*/ f32 areaCenY;
/*0x68*/
f32 areaCenY;
};
/**
@@ -576,85 +635,122 @@ struct LakituState
/**
* Lakitu's position, which (when CAM_FLAG_SMOOTH_MOVEMENT is set), approaches his goalPos every frame.
*/
/*0x00*/ Vec3f curFocus;
/*0x00*/
Vec3f curFocus;
/**
* Lakitu's focus, which (when CAM_FLAG_SMOOTH_MOVEMENT is set), approaches his goalFocus every frame.
*/
/*0x0C*/ Vec3f curPos;
/*0x0C*/
Vec3f curPos;
/**
* The focus point that lakitu turns towards every frame.
* If CAM_FLAG_SMOOTH_MOVEMENT is unset, this is the same as curFocus.
*/
/*0x18*/ Vec3f goalFocus;
/*0x18*/
Vec3f goalFocus;
/**
* The point that lakitu flies towards every frame.
* If CAM_FLAG_SMOOTH_MOVEMENT is unset, this is the same as curPos.
*/
/*0x24*/ Vec3f goalPos;
/*0x24*/
Vec3f goalPos;
/*0x30*/ u8 filler30[12]; // extra unused Vec3f?
/*0x30*/
u8 filler30[12]; // extra unused Vec3f?
/// Copy of the active camera mode
/*0x3C*/ u8 mode;
/*0x3C*/
u8 mode;
/// Copy of the default camera mode
/*0x3D*/ u8 defMode;
/*0x3D*/
u8 defMode;
/*0x3E*/ u8 filler3E[10];
/*0x3E*/
u8 filler3E[10];
/*0x48*/ f32 focusDistance; // unused
/*0x4C*/ s16 oldPitch; // unused
/*0x4E*/ s16 oldYaw; // unused
/*0x50*/ s16 oldRoll; // unused
/*0x48*/
f32 focusDistance; // unused
/*0x4C*/
s16 oldPitch; // unused
/*0x4E*/
s16 oldYaw; // unused
/*0x50*/
s16 oldRoll; // unused
/// The angular offsets added to lakitu's pitch, yaw, and roll
/*0x52*/ Vec3s shakeMagnitude;
/*0x52*/
Vec3s shakeMagnitude;
// shake pitch, yaw, and roll phase: The progression through the camera shake (a cosine wave).
// shake pitch, yaw, and roll vel: The speed of the camera shake.
// shake pitch, yaw, and roll decay: The shake's deceleration.
/*0x58*/ s16 shakePitchPhase;
/*0x5A*/ s16 shakePitchVel;
/*0x5C*/ s16 shakePitchDecay;
/*0x58*/
s16 shakePitchPhase;
/*0x5A*/
s16 shakePitchVel;
/*0x5C*/
s16 shakePitchDecay;
/*0x60*/ Vec3f unusedVec1;
/*0x6C*/ Vec3s unusedVec2;
/*0x72*/ u8 filler72[8];
/*0x60*/
Vec3f unusedVec1;
/*0x6C*/
Vec3s unusedVec2;
/*0x72*/
u8 filler72[8];
/// Used to rotate the screen when rendering.
/*0x7A*/ s16 roll;
/*0x7A*/
s16 roll;
/// Copy of the camera's yaw.
/*0x7C*/ s16 yaw;
/*0x7C*/
s16 yaw;
/// Copy of the camera's next yaw.
/*0x7E*/ s16 nextYaw;
/*0x7E*/
s16 nextYaw;
/// The actual focus point the game uses to render.
/*0x80*/ Vec3f focus;
/*0x80*/
Vec3f focus;
/// The actual position the game is rendered from.
/*0x8C*/ Vec3f pos;
/*0x8C*/
Vec3f pos;
// Shake variables: See above description
/*0x98*/ s16 shakeRollPhase;
/*0x9A*/ s16 shakeRollVel;
/*0x9C*/ s16 shakeRollDecay;
/*0x9E*/ s16 shakeYawPhase;
/*0xA0*/ s16 shakeYawVel;
/*0xA2*/ s16 shakeYawDecay;
/*0x98*/
s16 shakeRollPhase;
/*0x9A*/
s16 shakeRollVel;
/*0x9C*/
s16 shakeRollDecay;
/*0x9E*/
s16 shakeYawPhase;
/*0xA0*/
s16 shakeYawVel;
/*0xA2*/
s16 shakeYawDecay;
// focH,Vspeed: how fast lakitu turns towards his goalFocus.
/// By default HSpeed is 0.8, so lakitu turns 80% of the horz distance to his goal each frame.
/*0xA4*/ f32 focHSpeed;
/*0xA4*/
f32 focHSpeed;
/// By default VSpeed is 0.3, so lakitu turns 30% of the vert distance to his goal each frame.
/*0xA8*/ f32 focVSpeed;
/*0xA8*/
f32 focVSpeed;
// posH,Vspeed: How fast lakitu flies towards his goalPos.
/// By default they are 0.3, so lakitu will fly 30% of the way towards his goal each frame.
/*0xAC*/ f32 posHSpeed;
/*0xB0*/ f32 posVSpeed;
/*0xAC*/
f32 posHSpeed;
/*0xB0*/
f32 posVSpeed;
/// The roll offset applied during part of the key dance cutscene
/*0xB4*/ s16 keyDanceRoll;
/*0xB4*/
s16 keyDanceRoll;
/// Mario's action from the previous frame. Only used to determine if Mario just finished a dive.
/*0xB8*/ u32 lastFrameAction;
/*0xBC*/ s16 unused;
/*0xB8*/
u32 lastFrameAction;
/*0xBC*/
s16 unused;
};
File diff suppressed because it is too large Load Diff
+14
View File
@@ -99,19 +99,33 @@
s16 mario_obj_angle_to_object(struct MarioState *m, struct Object *o);
void mario_stop_riding_object(struct MarioState *m);
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_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);
struct Object *mario_get_collided_object(struct MarioState *m, u32 interactType);
u32 mario_check_object_grab(struct MarioState *m);
u32 get_door_save_file_flag(struct Object *door);
void mario_process_interactions(struct MarioState *m);
void mario_handle_special_floors(struct MarioState *m);
#endif // INTERACTION_H
+19 -10
View File
@@ -89,20 +89,29 @@
// extern u8 unused4[2];
// extern s8 sTimerRunning;
struct HudDisplay {
/*0x00*/ s16 lives;
/*0x02*/ s16 coins;
/*0x04*/ s16 stars;
/*0x06*/ s16 wedges;
/*0x08*/ s16 keys;
/*0x0A*/ s16 flags;
/*0x0C*/ u16 timer;
struct HudDisplay
{
/*0x00*/
s16 lives;
/*0x02*/
s16 coins;
/*0x04*/
s16 stars;
/*0x06*/
s16 wedges;
/*0x08*/
s16 keys;
/*0x0A*/
s16 flags;
/*0x0C*/
u16 timer;
};
// extern struct HudDisplay gHudDisplay;
// extern s8 gNeverEnteredCastle;
enum HUDDisplayFlag {
enum HUDDisplayFlag
{
HUD_DISPLAY_FLAG_LIVES = 0x0001,
HUD_DISPLAY_FLAG_COIN_COUNT = 0x0002,
HUD_DISPLAY_FLAG_STAR_COUNT = 0x0004,
@@ -111,10 +120,10 @@ enum HUDDisplayFlag {
HUD_DISPLAY_FLAG_UNKNOWN_0020 = 0x0020,
HUD_DISPLAY_FLAG_TIMER = 0x0040,
HUD_DISPLAY_FLAG_EMPHASIZE_POWER = 0x8000,
HUD_DISPLAY_NONE = 0x0000,
HUD_DISPLAY_DEFAULT = HUD_DISPLAY_FLAG_LIVES | HUD_DISPLAY_FLAG_COIN_COUNT | HUD_DISPLAY_FLAG_STAR_COUNT | HUD_DISPLAY_FLAG_CAMERA_AND_POWER | HUD_DISPLAY_FLAG_KEYS | HUD_DISPLAY_FLAG_UNKNOWN_0020
};
//
//
// u16 level_control_timer(s32 timerOp);
+665 -361
View File
File diff suppressed because it is too large Load Diff
+44 -1
View File
@@ -7,48 +7,91 @@
#include "../include/types.h"
s32 is_anim_at_end(struct MarioState *m);
s32 is_anim_past_end(struct MarioState *m);
s16 set_mario_animation(struct MarioState *m, s32 targetAnimID);
s16 set_mario_anim_with_accel(struct MarioState *m, s32 targetAnimID, s32 accel);
void set_anim_to_frame(struct MarioState *m, s16 animFrame);
s32 is_anim_past_frame(struct MarioState *m, s16 animFrame);
s16 find_mario_anim_flags_and_translation(struct Object *o, s32 yaw, Vec3s translation);
void update_mario_pos_for_anim(struct MarioState *m);
s16 return_mario_anim_y_translation(struct MarioState *m);
void play_sound_if_no_flag(struct MarioState *m, u32 soundBits, u32 flags);
void play_mario_jump_sound(struct MarioState *m);
void adjust_sound_for_speed(struct MarioState *m);
void play_sound_and_spawn_particles(struct MarioState *m, u32 soundBits, u32 waveParticleType);
void play_mario_action_sound(struct MarioState *m, u32 soundBits, u32 waveParticleType);
void play_mario_landing_sound(struct MarioState *m, u32 soundBits);
void play_mario_landing_sound_once(struct MarioState *m, u32 soundBits);
void play_mario_heavy_landing_sound(struct MarioState *m, u32 soundBits);
void play_mario_heavy_landing_sound_once(struct MarioState *m, u32 soundBits);
void play_mario_sound(struct MarioState *m, s32 primarySoundBits, s32 scondarySoundBits);
void mario_set_forward_vel(struct MarioState *m, f32 speed);
s32 mario_get_floor_class(struct MarioState *m);
u32 mario_get_terrain_sound_addend(struct MarioState *m);
struct SM64SurfaceCollisionData *resolve_and_return_wall_collisions(Vec3f pos, f32 offset, f32 radius);
f32 vec3f_find_ceil(Vec3f pos, f32 height, struct SM64SurfaceCollisionData **ceil);
s32 mario_facing_downhill(struct MarioState *m, s32 turnYaw);
u32 mario_floor_is_slippery(struct MarioState *m);
s32 mario_floor_is_slope(struct MarioState *m);
s32 mario_floor_is_steep(struct MarioState *m);
f32 find_floor_height_relative_polar(struct MarioState *m, s16 angleFromMario, f32 distFromMario);
s16 find_floor_slope(struct MarioState *m, s16 yawOffset);
void update_mario_sound_and_camera(struct MarioState *m);
void set_steep_jump_action(struct MarioState *m);
u32 set_mario_action(struct MarioState *, u32 action, u32 actionArg);
s32 set_jump_from_landing(struct MarioState *m);
s32 set_jumping_action(struct MarioState *m, u32 action, u32 actionArg);
s32 drop_and_set_mario_action(struct MarioState *m, u32 action, u32 actionArg);
s32 hurt_and_set_mario_action(struct MarioState *m, u32 action, u32 actionArg, s16 hurtCounter);
s32 check_common_action_exits(struct MarioState *m);
s32 check_common_hold_action_exits(struct MarioState *m);
s32 transition_submerged_to_walking(struct MarioState *m);
s32 set_water_plunge_action(struct MarioState *m);
s32 execute_mario_action(UNUSED struct Object *o);
int init_mario(void);
int init_mario(uint8_t isLocal);
void init_mario_from_save_file(void);
#endif // MARIO_H
File diff suppressed because it is too large Load Diff
File diff suppressed because it is too large Load Diff
File diff suppressed because it is too large Load Diff
+6
View File
@@ -7,11 +7,17 @@
#include "../include/types.h"
void print_displaying_credits_entry(void);
void bhv_end_peach_loop(void);
void bhv_end_toad_loop(void);
s32 geo_switch_peach_eyes(s32 run, struct GraphNode *node, UNUSED s32 a2);
s32 mario_ready_to_speak(void);
s32 set_mario_npc_dialog(s32 actionArg);
s32 mario_execute_cutscene_action(struct MarioState *m);
#endif // MARIO_ACTIONS_CUTSCENE_H
File diff suppressed because it is too large Load Diff
+1
View File
@@ -6,6 +6,7 @@
#include "../include/types.h"
void play_step_sound(struct MarioState *m, s16 frame1, s16 frame2);
s32 mario_execute_moving_action(struct MarioState *m);
#endif // MARIO_ACTIONS_MOVING
+220 -113
View File
@@ -16,6 +16,7 @@
#include "../include/mario_animation_ids.h"
#include "../include/object_fields.h"
#include "../include/mario_geo_switch_case_ids.h"
#include "../../rumble.h"
/**
* Used by act_punching() to determine Mario's forward velocity during each
@@ -23,61 +24,77 @@
*/
s8 sPunchingForwardVelocities[8] = {0, 1, 1, 2, 3, 5, 7, 10};
void animated_stationary_ground_step(struct MarioState *m, s32 animation, u32 endAction) {
void animated_stationary_ground_step(struct MarioState *m, s32 animation, u32 endAction)
{
stationary_ground_step(m);
set_mario_animation(m, animation);
if (is_anim_at_end(m)) {
if (is_anim_at_end(m))
{
set_mario_action(m, endAction, 0);
}
}
s32 mario_update_punch_sequence(struct MarioState *m) {
s32 mario_update_punch_sequence(struct MarioState *m)
{
u32 endAction, crouchEndAction;
s32 animFrame;
if (m->action & ACT_FLAG_MOVING) {
if (m->action & ACT_FLAG_MOVING)
{
endAction = ACT_WALKING, crouchEndAction = ACT_CROUCH_SLIDE;
} else {
}
else
{
endAction = ACT_IDLE, crouchEndAction = ACT_CROUCHING;
}
switch (m->actionArg) {
switch (m->actionArg)
{
case 0:
play_sound(SOUND_MARIO_PUNCH_YAH, m->marioObj->header.gfx.cameraToObject);
// Fall-through:
case 1:
set_mario_animation(m, MARIO_ANIM_FIRST_PUNCH);
if (is_anim_past_end(m)) {
if (is_anim_past_end(m))
{
m->actionArg = 2;
} else {
}
else
{
m->actionArg = 1;
}
if (m->marioObj->header.gfx.animInfo.animFrame >= 2) {
if (mario_check_object_grab(m)) {
if (m->marioObj->header.gfx.animInfo.animFrame >= 2)
{
if (mario_check_object_grab(m))
{
return TRUE;
}
m->flags |= MARIO_PUNCHING;
}
if (m->actionArg == 2) {
m->marioBodyState->punchState = (0 << 6) | 4;
if (m->actionArg == 2)
{
m->marioBodyState->punchState = 0 << 6 | 4;
}
break;
case 2:
set_mario_animation(m, MARIO_ANIM_FIRST_PUNCH_FAST);
if (m->marioObj->header.gfx.animInfo.animFrame <= 0) {
if (m->marioObj->header.gfx.animInfo.animFrame <= 0)
{
m->flags |= MARIO_PUNCHING;
}
if (m->input & INPUT_B_PRESSED) {
if (m->input & INPUT_B_PRESSED)
{
m->actionArg = 3;
}
if (is_anim_at_end(m)) {
if (is_anim_at_end(m))
{
set_mario_action(m, endAction, 0);
}
break;
@@ -87,32 +104,40 @@ s32 mario_update_punch_sequence(struct MarioState *m) {
// Fall-through:
case 4:
set_mario_animation(m, MARIO_ANIM_SECOND_PUNCH);
if (is_anim_past_end(m)) {
if (is_anim_past_end(m))
{
m->actionArg = 5;
} else {
}
else
{
m->actionArg = 4;
}
if (m->marioObj->header.gfx.animInfo.animFrame > 0) {
if (m->marioObj->header.gfx.animInfo.animFrame > 0)
{
m->flags |= MARIO_PUNCHING;
}
if (m->actionArg == 5) {
m->marioBodyState->punchState = (1 << 6) | 4;
if (m->actionArg == 5)
{
m->marioBodyState->punchState = 1 << 6 | 4;
}
break;
case 5:
set_mario_animation(m, MARIO_ANIM_SECOND_PUNCH_FAST);
if (m->marioObj->header.gfx.animInfo.animFrame <= 0) {
if (m->marioObj->header.gfx.animInfo.animFrame <= 0)
{
m->flags |= MARIO_PUNCHING;
}
if (m->input & INPUT_B_PRESSED) {
if (m->input & INPUT_B_PRESSED)
{
m->actionArg = 6;
}
if (is_anim_at_end(m)) {
if (is_anim_at_end(m))
{
set_mario_action(m, endAction, 0);
}
break;
@@ -120,15 +145,18 @@ s32 mario_update_punch_sequence(struct MarioState *m) {
case 6:
play_mario_action_sound(m, SOUND_MARIO_PUNCH_HOO, 1);
animFrame = set_mario_animation(m, MARIO_ANIM_GROUND_KICK);
if (animFrame == 0) {
m->marioBodyState->punchState = (2 << 6) | 6;
if (animFrame == 0)
{
m->marioBodyState->punchState = 2 << 6 | 6;
}
if (animFrame >= 0 && animFrame < 8) {
if (animFrame >= 0 && animFrame < 8)
{
m->flags |= MARIO_KICKING;
}
if (is_anim_at_end(m)) {
if (is_anim_at_end(m))
{
set_mario_action(m, endAction, 0);
}
break;
@@ -138,11 +166,13 @@ s32 mario_update_punch_sequence(struct MarioState *m) {
set_mario_animation(m, MARIO_ANIM_BREAKDANCE);
animFrame = m->marioObj->header.gfx.animInfo.animFrame;
if (animFrame >= 2 && animFrame < 8) {
if (animFrame >= 2 && animFrame < 8)
{
m->flags |= MARIO_TRIPPING;
}
if (is_anim_at_end(m)) {
if (is_anim_at_end(m))
{
set_mario_action(m, crouchEndAction, 0);
}
break;
@@ -151,26 +181,32 @@ s32 mario_update_punch_sequence(struct MarioState *m) {
return FALSE;
}
s32 act_punching(struct MarioState *m) {
if (m->input & INPUT_UNKNOWN_10) {
s32 act_punching(struct MarioState *m)
{
if (m->input & INPUT_UNKNOWN_10)
{
return drop_and_set_mario_action(m, ACT_SHOCKWAVE_BOUNCE, 0);
}
if (m->input & (INPUT_NONZERO_ANALOG | INPUT_A_PRESSED | INPUT_OFF_FLOOR | INPUT_ABOVE_SLIDE)) {
if (m->input & (INPUT_NONZERO_ANALOG | INPUT_A_PRESSED | INPUT_OFF_FLOOR | INPUT_ABOVE_SLIDE))
{
return check_common_action_exits(m);
}
if (m->actionState == 0 && (m->input & INPUT_A_DOWN)) {
if (m->actionState == 0 && m->input & INPUT_A_DOWN)
{
return set_mario_action(m, ACT_JUMP_KICK, 0);
}
m->actionState = 1;
if (m->actionArg == 0) {
if (m->actionArg == 0)
{
m->actionTimer = 7;
}
mario_set_forward_vel(m, sPunchingForwardVelocities[m->actionTimer]);
if (m->actionTimer > 0) {
if (m->actionTimer > 0)
{
m->actionTimer--;
}
@@ -179,16 +215,20 @@ s32 act_punching(struct MarioState *m) {
return FALSE;
}
s32 act_picking_up(struct MarioState *m) {
if (m->input & INPUT_UNKNOWN_10) {
s32 act_picking_up(struct MarioState *m)
{
if (m->input & INPUT_UNKNOWN_10)
{
return drop_and_set_mario_action(m, ACT_SHOCKWAVE_BOUNCE, 0);
}
if (m->input & INPUT_OFF_FLOOR) {
if (m->input & INPUT_OFF_FLOOR)
{
return drop_and_set_mario_action(m, ACT_FREEFALL, 0);
}
if (m->actionState == 0 && is_anim_at_end(m)) {
if (m->actionState == 0 && is_anim_at_end(m))
{
//! While the animation is playing, it is possible for the used object
// to unload. This allows you to pick up a vacant or newly loaded object
// slot (cloning via fake object).
@@ -197,17 +237,23 @@ s32 act_picking_up(struct MarioState *m) {
m->actionState = 1;
}
if (m->actionState == 1) {
if (m->heldObj->oInteractionSubtype & INT_SUBTYPE_GRABS_MARIO) {
if (m->actionState == 1)
{
if (m->heldObj->oInteractionSubtype & INT_SUBTYPE_GRABS_MARIO)
{
m->marioBodyState->grabPos = GRAB_POS_HEAVY_OBJ;
set_mario_animation(m, MARIO_ANIM_GRAB_HEAVY_OBJECT);
if (is_anim_at_end(m)) {
if (is_anim_at_end(m))
{
set_mario_action(m, ACT_HOLD_HEAVY_IDLE, 0);
}
} else {
}
else
{
m->marioBodyState->grabPos = GRAB_POS_LIGHT_OBJ;
set_mario_animation(m, MARIO_ANIM_PICK_UP_LIGHT_OBJ);
if (is_anim_at_end(m)) {
if (is_anim_at_end(m))
{
set_mario_action(m, ACT_HOLD_IDLE, 0);
}
}
@@ -217,19 +263,23 @@ s32 act_picking_up(struct MarioState *m) {
return FALSE;
}
s32 act_dive_picking_up(struct MarioState *m) {
if (m->input & INPUT_UNKNOWN_10) {
s32 act_dive_picking_up(struct MarioState *m)
{
if (m->input & INPUT_UNKNOWN_10)
{
return drop_and_set_mario_action(m, ACT_SHOCKWAVE_BOUNCE, 0);
}
//! Hands-free holding. Landing on a slope or being pushed off a ledge while
// landing from a dive grab sets Mario's action to a non-holding action
// without dropping the object, causing the hands-free holding glitch.
if (m->input & INPUT_OFF_FLOOR) {
if (m->input & INPUT_OFF_FLOOR)
{
return set_mario_action(m, ACT_FREEFALL, 0);
}
if (m->input & INPUT_ABOVE_SLIDE) {
if (m->input & INPUT_ABOVE_SLIDE)
{
return set_mario_action(m, ACT_BEGIN_SLIDING, 0);
}
@@ -237,16 +287,20 @@ s32 act_dive_picking_up(struct MarioState *m) {
return FALSE;
}
s32 act_placing_down(struct MarioState *m) {
if (m->input & INPUT_UNKNOWN_10) {
s32 act_placing_down(struct MarioState *m)
{
if (m->input & INPUT_UNKNOWN_10)
{
return drop_and_set_mario_action(m, ACT_SHOCKWAVE_BOUNCE, 0);
}
if (m->input & INPUT_OFF_FLOOR) {
if (m->input & INPUT_OFF_FLOOR)
{
return drop_and_set_mario_action(m, ACT_FREEFALL, 0);
}
if (++m->actionTimer == 8) {
if (++m->actionTimer == 8)
{
mario_drop_held_object(m);
}
@@ -254,64 +308,77 @@ s32 act_placing_down(struct MarioState *m) {
return FALSE;
}
s32 act_throwing(struct MarioState *m) {
if (m->heldObj && (m->heldObj->oInteractionSubtype & INT_SUBTYPE_HOLDABLE_NPC)) {
s32 act_throwing(struct MarioState *m)
{
if (m->heldObj && m->heldObj->oInteractionSubtype & INT_SUBTYPE_HOLDABLE_NPC)
{
return set_mario_action(m, ACT_PLACING_DOWN, 0);
}
if (m->input & INPUT_UNKNOWN_10) {
if (m->input & INPUT_UNKNOWN_10)
{
return drop_and_set_mario_action(m, ACT_SHOCKWAVE_BOUNCE, 0);
}
if (m->input & INPUT_OFF_FLOOR) {
if (m->input & INPUT_OFF_FLOOR)
{
return drop_and_set_mario_action(m, ACT_FREEFALL, 0);
}
if (++m->actionTimer == 7) {
if (++m->actionTimer == 7)
{
mario_throw_held_object(m);
play_sound_if_no_flag(m, SOUND_MARIO_WAH2, MARIO_MARIO_SOUND_PLAYED);
play_sound_if_no_flag(m, SOUND_ACTION_THROW, MARIO_ACTION_SOUND_PLAYED);
#ifdef VERSION_SH
// #ifdef VERSION_SH
queue_rumble_data(3, 50);
#endif
// #endif
}
animated_stationary_ground_step(m, MARIO_ANIM_GROUND_THROW, ACT_IDLE);
return FALSE;
}
s32 act_heavy_throw(struct MarioState *m) {
if (m->input & INPUT_UNKNOWN_10) {
s32 act_heavy_throw(struct MarioState *m)
{
if (m->input & INPUT_UNKNOWN_10)
{
return drop_and_set_mario_action(m, ACT_SHOCKWAVE_BOUNCE, 0);
}
if (m->input & INPUT_OFF_FLOOR) {
if (m->input & INPUT_OFF_FLOOR)
{
return drop_and_set_mario_action(m, ACT_FREEFALL, 0);
}
if (++m->actionTimer == 13) {
if (++m->actionTimer == 13)
{
mario_drop_held_object(m);
play_sound_if_no_flag(m, SOUND_MARIO_WAH2, MARIO_MARIO_SOUND_PLAYED);
play_sound_if_no_flag(m, SOUND_ACTION_THROW, MARIO_ACTION_SOUND_PLAYED);
#ifdef VERSION_SH
// #ifdef VERSION_SH
queue_rumble_data(3, 50);
#endif
// #endif
}
animated_stationary_ground_step(m, MARIO_ANIM_HEAVY_THROW, ACT_IDLE);
return FALSE;
}
s32 act_stomach_slide_stop(struct MarioState *m) {
if (m->input & INPUT_UNKNOWN_10) {
s32 act_stomach_slide_stop(struct MarioState *m)
{
if (m->input & INPUT_UNKNOWN_10)
{
return set_mario_action(m, ACT_SHOCKWAVE_BOUNCE, 0);
}
if (m->input & INPUT_OFF_FLOOR) {
if (m->input & INPUT_OFF_FLOOR)
{
return set_mario_action(m, ACT_FREEFALL, 0);
}
if (m->input & INPUT_ABOVE_SLIDE) {
if (m->input & INPUT_ABOVE_SLIDE)
{
return set_mario_action(m, ACT_BEGIN_SLIDING, 0);
}
@@ -319,20 +386,23 @@ s32 act_stomach_slide_stop(struct MarioState *m) {
return FALSE;
}
s32 act_picking_up_bowser(struct MarioState *m) {
if (m->actionState == 0) {
s32 act_picking_up_bowser(struct MarioState *m)
{
if (m->actionState == 0)
{
m->actionState = 1;
m->angleVel[1] = 0;
m->marioBodyState->grabPos = GRAB_POS_BOWSER;
mario_grab_used_object(m);
#ifdef VERSION_SH
// #ifdef VERSION_SH
queue_rumble_data(5, 80);
#endif
// #endif
play_sound(SOUND_MARIO_HRMM, m->marioObj->header.gfx.cameraToObject);
}
set_mario_animation(m, MARIO_ANIM_GRAB_BOWSER);
if (is_anim_at_end(m)) {
if (is_anim_at_end(m))
{
set_mario_action(m, ACT_HOLDING_BOWSER, 0);
}
@@ -340,14 +410,19 @@ s32 act_picking_up_bowser(struct MarioState *m) {
return FALSE;
}
s32 act_holding_bowser(struct MarioState *m) {
s32 act_holding_bowser(struct MarioState *m)
{
s16 spin;
if (m->input & INPUT_B_PRESSED) {
if (m->input & INPUT_B_PRESSED)
{
#ifndef VERSION_JP
if (m->angleVel[1] <= -0xE00 || m->angleVel[1] >= 0xE00) {
if (m->angleVel[1] <= -0xE00 || m->angleVel[1] >= 0xE00)
{
play_sound(SOUND_MARIO_SO_LONGA_BOWSER, m->marioObj->header.gfx.cameraToObject);
} else {
}
else
{
play_sound(SOUND_MARIO_HERE_WE_GO, m->marioObj->header.gfx.cameraToObject);
}
#else
@@ -356,43 +431,57 @@ s32 act_holding_bowser(struct MarioState *m) {
return set_mario_action(m, ACT_RELEASING_BOWSER, 0);
}
if (m->angleVel[1] == 0) {
if (m->actionTimer++ > 120) {
if (m->angleVel[1] == 0)
{
if (m->actionTimer++ > 120)
{
return set_mario_action(m, ACT_RELEASING_BOWSER, 1);
}
set_mario_animation(m, MARIO_ANIM_HOLDING_BOWSER);
} else {
}
else
{
m->actionTimer = 0;
set_mario_animation(m, MARIO_ANIM_SWINGING_BOWSER);
}
if (m->intendedMag > 20.0f) {
if (m->actionArg == 0) {
if (m->intendedMag > 20.0f)
{
if (m->actionArg == 0)
{
m->actionArg = 1;
m->twirlYaw = m->intendedYaw;
} else {
}
else
{
// spin = acceleration
spin = (s16)(m->intendedYaw - m->twirlYaw) / 0x80;
if (spin < -0x80) {
if (spin < -0x80)
{
spin = -0x80;
}
if (spin > 0x80) {
if (spin > 0x80)
{
spin = 0x80;
}
m->twirlYaw = m->intendedYaw;
m->angleVel[1] += spin;
if (m->angleVel[1] > 0x1000) {
if (m->angleVel[1] > 0x1000)
{
m->angleVel[1] = 0x1000;
}
if (m->angleVel[1] < -0x1000) {
if (m->angleVel[1] < -0x1000)
{
m->angleVel[1] = -0x1000;
}
}
} else {
}
else
{
m->actionArg = 0;
m->angleVel[1] = approach_s32(m->angleVel[1], 0, 64, 64);
}
@@ -402,40 +491,50 @@ s32 act_holding_bowser(struct MarioState *m) {
m->faceAngle[1] += m->angleVel[1];
// play sound on overflow
if (m->angleVel[1] <= -0x100 && spin < m->faceAngle[1]) {
#ifdef VERSION_SH
if (m->angleVel[1] <= -0x100 && spin < m->faceAngle[1])
{
// #ifdef VERSION_SH
queue_rumble_data(4, 20);
#endif
// #endif
play_sound(SOUND_OBJ_BOWSER_SPINNING, m->marioObj->header.gfx.cameraToObject);
}
if (m->angleVel[1] >= 0x100 && spin > m->faceAngle[1]) {
#ifdef VERSION_SH
if (m->angleVel[1] >= 0x100 && spin > m->faceAngle[1])
{
// #ifdef VERSION_SH
queue_rumble_data(4, 20);
#endif
// #endif
play_sound(SOUND_OBJ_BOWSER_SPINNING, m->marioObj->header.gfx.cameraToObject);
}
stationary_ground_step(m);
if (m->angleVel[1] >= 0) {
if (m->angleVel[1] >= 0)
{
m->marioObj->header.gfx.angle[0] = -m->angleVel[1];
} else {
}
else
{
m->marioObj->header.gfx.angle[0] = m->angleVel[1];
}
return FALSE;
}
s32 act_releasing_bowser(struct MarioState *m) {
if (++m->actionTimer == 1) {
if (m->actionArg == 0) {
#ifdef VERSION_SH
s32 act_releasing_bowser(struct MarioState *m)
{
if (++m->actionTimer == 1)
{
if (m->actionArg == 0)
{
// #ifdef VERSION_SH
queue_rumble_data(4, 50);
#endif
// #endif
mario_throw_held_object(m);
} else {
#ifdef VERSION_SH
}
else
{
// #ifdef VERSION_SH
queue_rumble_data(4, 50);
#endif
// #endif
mario_drop_held_object(m);
}
}
@@ -445,31 +544,38 @@ s32 act_releasing_bowser(struct MarioState *m) {
return FALSE;
}
s32 check_common_object_cancels(struct MarioState *m) {
s32 check_common_object_cancels(struct MarioState *m)
{
f32 waterSurface = m->waterLevel - 100;
if (m->pos[1] < waterSurface) {
if (m->pos[1] < waterSurface)
{
return set_water_plunge_action(m);
}
if (m->input & INPUT_SQUISHED) {
if (m->input & INPUT_SQUISHED)
{
return drop_and_set_mario_action(m, ACT_SQUISHED, 0);
}
if (m->health < 0x100) {
if (m->health < 0x100)
{
return drop_and_set_mario_action(m, ACT_STANDING_DEATH, 0);
}
return FALSE;
}
s32 mario_execute_object_action(struct MarioState *m) {
s32 mario_execute_object_action(struct MarioState *m)
{
s32 cancel;
if (check_common_object_cancels(m)) {
if (check_common_object_cancels(m))
{
return TRUE;
}
if (mario_update_quicksand(m, 0.5f)) {
if (mario_update_quicksand(m, 0.5f))
{
return TRUE;
}
@@ -488,7 +594,8 @@ s32 mario_execute_object_action(struct MarioState *m) {
}
/* clang-format on */
if (!cancel && (m->input & INPUT_IN_WATER)) {
if (!cancel && m->input & INPUT_IN_WATER)
{
m->particleFlags |= PARTICLE_IDLE_WATER_WAVE;
}
+1
View File
@@ -6,6 +6,7 @@
#include "../include/types.h"
s32 mario_update_punch_sequence(struct MarioState *m);
s32 mario_execute_object_action(struct MarioState *m);
#endif // MARIO_ACTIONS_OBJECT_H
File diff suppressed because it is too large Load Diff
@@ -6,45 +6,85 @@
#include "../include/types.h"
s32 check_common_idle_cancels(struct MarioState *m);
s32 check_common_hold_idle_cancels(struct MarioState *m);
s32 act_idle(struct MarioState *m);
void play_anim_sound(struct MarioState *m, u32 actionState, s32 animFrame, u32 sound);
s32 act_start_sleeping(struct MarioState *m);
s32 act_sleeping(struct MarioState *m);
s32 act_waking_up(struct MarioState *m);
s32 act_shivering(struct MarioState *m);
s32 act_coughing(struct MarioState *m);
s32 act_standing_against_wall(struct MarioState *m);
s32 act_in_quicksand(struct MarioState *m);
s32 act_crouching(struct MarioState *m);
s32 act_panting(struct MarioState *m);
void stopping_step(struct MarioState *m, s32 animID, u32 action);
s32 act_braking_stop(struct MarioState *m);
s32 act_butt_slide_stop(struct MarioState *m);
s32 act_hold_butt_slide_stop(struct MarioState *m);
s32 act_slide_kick_slide_stop(struct MarioState *m);
s32 act_start_crouching(struct MarioState *m);
s32 act_stop_crouching(struct MarioState *m);
s32 act_start_crawling(struct MarioState *m);
s32 act_stop_crawling(struct MarioState *m);
s32 act_shockwave_bounce(struct MarioState *m);
s32 landing_step(struct MarioState *m, s32 arg1, u32 action);
s32 check_common_landing_cancels(struct MarioState *m, u32 action);
s32 act_jump_land_stop(struct MarioState *m);
s32 act_double_jump_land_stop(struct MarioState *m);
s32 act_side_flip_land_stop(struct MarioState *m);
s32 act_freefall_land_stop(struct MarioState *m);
s32 act_triple_jump_land_stop(struct MarioState *m);
s32 act_backflip_land_stop(struct MarioState *m);
s32 act_lava_boost_land(struct MarioState *m);
s32 act_long_jump_land_stop(struct MarioState *m);
s32 act_hold_jump_land_stop(struct MarioState *m);
s32 act_hold_freefall_land_stop(struct MarioState *m);
s32 act_air_throw_land(struct MarioState *m);
s32 act_twirl_land(struct MarioState *m);
s32 act_ground_pound_land(struct MarioState *m);
s32 act_first_person(struct MarioState *m);
s32 check_common_stationary_cancels(struct MarioState *m);
s32 mario_execute_stationary_action(struct MarioState *m);
#endif // MARIO_ACTIONS_STATIONARY
File diff suppressed because it is too large Load Diff
+158 -76
View File
@@ -42,7 +42,8 @@ static Vec3s gVec3sZero = {0,0,0};
#define TOAD_STAR_2_DIALOG_AFTER 91 // DIALOG_155
#define TOAD_STAR_3_DIALOG_AFTER 92 // DIALOG_156
enum ToadMessageStates {
enum ToadMessageStates
{
TOAD_MESSAGE_FADED,
TOAD_MESSAGE_OPAQUE,
TOAD_MESSAGE_OPACIFYING,
@@ -50,7 +51,8 @@ enum ToadMessageStates {
TOAD_MESSAGE_TALKING
};
enum UnlockDoorStarStates {
enum UnlockDoorStarStates
{
UNLOCK_DOOR_STAR_RISING,
UNLOCK_DOOR_STAR_WAITING,
UNLOCK_DOOR_STAR_SPAWNING_PARTICLES,
@@ -106,7 +108,8 @@ static s8 gMarioAttackScaleAnimation[3 * 6] = {
// return gfx;
// }
static void toad_message_faded(void) {
static void toad_message_faded(void)
{
// if (gCurrentObject->oDistanceToMario > 700.0f) {
// gCurrentObject->oToadMessageRecentlyTalked = FALSE;
// }
@@ -115,7 +118,8 @@ static void toad_message_faded(void) {
// }
}
static void toad_message_opaque(void) {
static void toad_message_opaque(void)
{
// if (gCurrentObject->oDistanceToMario > 700.0f) {
// gCurrentObject->oToadMessageState = TOAD_MESSAGE_FADING;
// } else if (!gCurrentObject->oToadMessageRecentlyTalked) {
@@ -128,7 +132,8 @@ static void toad_message_opaque(void) {
// }
}
static void toad_message_talking(void) {
static void toad_message_talking(void)
{
// if (cur_obj_update_dialog_with_cutscene(3, 1, CUTSCENE_DIALOG, gCurrentObject->oToadMessageDialogId)
// != 0) {
// gCurrentObject->oToadMessageRecentlyTalked = TRUE;
@@ -150,22 +155,29 @@ static void toad_message_talking(void) {
// }
}
static void toad_message_opacifying(void) {
if ((gCurrentObject->oOpacity += 6) == 255) {
static void toad_message_opacifying(void)
{
if ((gCurrentObject->oOpacity += 6) == 255)
{
gCurrentObject->oToadMessageState = TOAD_MESSAGE_OPAQUE;
}
}
static void toad_message_fading(void) {
if ((gCurrentObject->oOpacity -= 6) == 81) {
static void toad_message_fading(void)
{
if ((gCurrentObject->oOpacity -= 6) == 81)
{
gCurrentObject->oToadMessageState = TOAD_MESSAGE_FADED;
}
}
void bhv_toad_message_loop(void) {
if (gCurrentObject->header.gfx.node.flags & GRAPH_RENDER_ACTIVE) {
void bhv_toad_message_loop(void)
{
if (gCurrentObject->header.gfx.node.flags & GRAPH_RENDER_ACTIVE)
{
gCurrentObject->oInteractionSubtype = 0;
switch (gCurrentObject->oToadMessageState) {
switch (gCurrentObject->oToadMessageState)
{
case TOAD_MESSAGE_FADED:
toad_message_faded();
break;
@@ -185,7 +197,8 @@ void bhv_toad_message_loop(void) {
}
}
void bhv_toad_message_init(void) {
void bhv_toad_message_init(void)
{
// s32 saveFlags = save_file_get_flags();
// s32 starCount = save_file_get_total_star_count(gCurrSaveFileNum - 1, COURSE_MIN - 1, COURSE_MAX - 1);
// s32 dialogId = (gCurrentObject->oBehParams >> 24) & 0xFF;
@@ -232,7 +245,8 @@ void bhv_toad_message_init(void) {
// sparkleParticle->oPosY -= gCurrentObject->oUnlockDoorStarTimer * 10.0f;
//}
void bhv_unlock_door_star_init(void) {
void bhv_unlock_door_star_init(void)
{
// gCurrentObject->oUnlockDoorStarState = UNLOCK_DOOR_STAR_RISING;
// gCurrentObject->oUnlockDoorStarTimer = 0;
// gCurrentObject->oUnlockDoorStarYawVel = 0x1000;
@@ -243,7 +257,8 @@ void bhv_unlock_door_star_init(void) {
// obj_scale(gCurrentObject, 0.5f);
}
void bhv_unlock_door_star_loop(void) {
void bhv_unlock_door_star_loop(void)
{
// UNUSED u8 unused1[4];
// s16 prevYaw = gCurrentObject->oMoveAngleYaw;
// UNUSED u8 unused2[4];
@@ -304,16 +319,20 @@ void bhv_unlock_door_star_loop(void) {
/**
* Generate a display list that sets the correct blend mode and color for mirror Mario.
*/
static Gfx *make_gfx_mario_alpha(struct GraphNodeGenerated *node, s16 alpha) {
static Gfx *make_gfx_mario_alpha(struct GraphNodeGenerated *node, s16 alpha)
{
Gfx *gfx;
Gfx *gfxHead = NULL;
if (alpha == 255) {
node->fnNode.node.flags = (node->fnNode.node.flags & 0xFF) | (LAYER_OPAQUE << 8);
if (alpha == 255)
{
node->fnNode.node.flags = node->fnNode.node.flags & 0xFF | LAYER_OPAQUE << 8;
gfxHead = alloc_display_list(2 * sizeof(*gfxHead));
gfx = gfxHead;
} else {
node->fnNode.node.flags = (node->fnNode.node.flags & 0xFF) | (LAYER_TRANSPARENT << 8);
}
else
{
node->fnNode.node.flags = node->fnNode.node.flags & 0xFF | LAYER_TRANSPARENT << 8;
gfxHead = alloc_display_list(3 * sizeof(*gfxHead));
gfx = gfxHead;
gDPSetAlphaCompare(gfx++, G_AC_DITHER);
@@ -326,16 +345,17 @@ static Gfx *make_gfx_mario_alpha(struct GraphNodeGenerated *node, s16 alpha) {
/**
* Sets the correct blend mode and color for mirror Mario.
*/
Gfx *geo_mirror_mario_set_alpha(s32 callContext, struct GraphNode *node, UNUSED Mat4 *c) {
Gfx *geo_mirror_mario_set_alpha(s32 callContext, struct GraphNode *node, UNUSED Mat4 *c)
{
UNUSED u8 unused1[4];
Gfx *gfx = NULL;
struct GraphNodeGenerated *asGenerated = (struct GraphNodeGenerated *)node;
struct MarioBodyState *bodyState = &gBodyStates[asGenerated->parameter];
s16 alpha;
UNUSED u8 unused2[4];
if (callContext == GEO_CONTEXT_RENDER) {
alpha = (bodyState->modelState & 0x100) ? (bodyState->modelState & 0xFF) : 255;
if (callContext == GEO_CONTEXT_RENDER)
{
s16 alpha = bodyState->modelState & 0x100 ? bodyState->modelState & 0xFF : 255;
gfx = make_gfx_mario_alpha(asGenerated, alpha);
}
return gfx;
@@ -346,13 +366,15 @@ Gfx *geo_mirror_mario_set_alpha(s32 callContext, struct GraphNode *node, UNUSED
* If Mario is standing still, he is always high poly. If he is running,
* his level of detail depends on the distance to the camera.
*/
Gfx *geo_switch_mario_stand_run(s32 callContext, struct GraphNode *node, UNUSED Mat4 *mtx) {
Gfx *geo_switch_mario_stand_run(s32 callContext, struct GraphNode *node, UNUSED Mat4 *mtx)
{
struct GraphNodeSwitchCase *switchCase = (struct GraphNodeSwitchCase *)node;
struct MarioBodyState *bodyState = &gBodyStates[switchCase->numCases];
if (callContext == GEO_CONTEXT_RENDER) {
if (callContext == GEO_CONTEXT_RENDER)
{
// assign result. 0 if moving, 1 if stationary.
switchCase->selectedCase = ((bodyState->action & ACT_FLAG_STATIONARY) == 0);
switchCase->selectedCase = (bodyState->action & ACT_FLAG_STATIONARY) == 0;
}
return NULL;
}
@@ -360,20 +382,27 @@ Gfx *geo_switch_mario_stand_run(s32 callContext, struct GraphNode *node, UNUSED
/**
* Geo node script that makes Mario blink
*/
Gfx *geo_switch_mario_eyes(s32 callContext, struct GraphNode *node, UNUSED Mat4 *c) {
Gfx *geo_switch_mario_eyes(s32 callContext, struct GraphNode *node, UNUSED Mat4 *c)
{
struct GraphNodeSwitchCase *switchCase = (struct GraphNodeSwitchCase *)node;
struct MarioBodyState *bodyState = &gBodyStates[switchCase->numCases];
s16 blinkFrame;
if (callContext == GEO_CONTEXT_RENDER) {
if (bodyState->eyeState == 0) {
blinkFrame = ((switchCase->numCases * 32 + gAreaUpdateCounter) >> 1) & 0x1F;
if (blinkFrame < 7) {
if (callContext == GEO_CONTEXT_RENDER)
{
if (bodyState->eyeState == 0)
{
s16 blinkFrame = (switchCase->numCases * 32 + gAreaUpdateCounter) >> 1 & 0x1F;
if (blinkFrame < 7)
{
switchCase->selectedCase = gMarioBlinkAnimation[blinkFrame];
} else {
}
else
{
switchCase->selectedCase = 0;
}
} else {
}
else
{
switchCase->selectedCase = bodyState->eyeState - 1;
}
}
@@ -383,16 +412,19 @@ Gfx *geo_switch_mario_eyes(s32 callContext, struct GraphNode *node, UNUSED Mat4
/**
* Makes Mario's upper body tilt depending on the rotation stored in his bodyState
*/
Gfx *geo_mario_tilt_torso(s32 callContext, struct GraphNode *node, UNUSED Mat4 *c) {
Gfx *geo_mario_tilt_torso(s32 callContext, struct GraphNode *node, UNUSED Mat4 *c)
{
struct GraphNodeGenerated *asGenerated = (struct GraphNodeGenerated *)node;
struct MarioBodyState *bodyState = &gBodyStates[asGenerated->parameter];
s32 action = bodyState->action;
if (callContext == GEO_CONTEXT_RENDER) {
if (callContext == GEO_CONTEXT_RENDER)
{
struct GraphNodeRotation *rotNode = (struct GraphNodeRotation *)node->next;
if (action != ACT_BUTT_SLIDE && action != ACT_HOLD_BUTT_SLIDE && action != ACT_WALKING
&& action != ACT_RIDING_SHELL_GROUND) {
&& action != ACT_RIDING_SHELL_GROUND)
{
vec3s_copy(bodyState->torsoAngle, gVec3sZero);
}
rotNode->rotation[0] = bodyState->torsoAngle[1];
@@ -405,12 +437,14 @@ Gfx *geo_mario_tilt_torso(s32 callContext, struct GraphNode *node, UNUSED Mat4 *
/**
* Makes Mario's head rotate with the camera angle when in C-up mode
*/
Gfx *geo_mario_head_rotation(s32 callContext, struct GraphNode *node, UNUSED Mat4 *c) {
Gfx *geo_mario_head_rotation(s32 callContext, struct GraphNode *node, UNUSED Mat4 *c)
{
struct GraphNodeGenerated *asGenerated = (struct GraphNodeGenerated *)node;
struct MarioBodyState *bodyState = &gBodyStates[asGenerated->parameter];
// s32 action = bodyState->action;
if (callContext == GEO_CONTEXT_RENDER) {
if (callContext == GEO_CONTEXT_RENDER)
{
struct GraphNodeRotation *rotNode = (struct GraphNodeRotation *)node->next;
// struct Camera *camera = gCurGraphNodeCamera->config.camera;
@@ -433,21 +467,29 @@ Gfx *geo_mario_head_rotation(s32 callContext, struct GraphNode *node, UNUSED Mat
* Switch between hand models.
* Possible options are described in the MarioHandGSCId enum.
*/
Gfx *geo_switch_mario_hand(s32 callContext, struct GraphNode *node, UNUSED Mat4 *c) {
Gfx *geo_switch_mario_hand(s32 callContext, struct GraphNode *node, UNUSED Mat4 *c)
{
struct GraphNodeSwitchCase *switchCase = (struct GraphNodeSwitchCase *)node;
struct MarioBodyState *bodyState = &gBodyStates[0];
if (callContext == GEO_CONTEXT_RENDER) {
if (bodyState->handState == MARIO_HAND_FISTS) {
if (callContext == GEO_CONTEXT_RENDER)
{
if (bodyState->handState == MARIO_HAND_FISTS)
{
// switch between fists (0) and open (1)
switchCase->selectedCase = ((bodyState->action & ACT_FLAG_SWIMMING_OR_FLYING) != 0);
} else {
if (switchCase->numCases == 0) {
switchCase->selectedCase = (bodyState->action & ACT_FLAG_SWIMMING_OR_FLYING) != 0;
}
else
{
if (switchCase->numCases == 0)
{
switchCase->selectedCase =
(bodyState->handState < 5) ? bodyState->handState : MARIO_HAND_OPEN;
} else {
bodyState->handState < 5 ? bodyState->handState : MARIO_HAND_OPEN;
}
else
{
switchCase->selectedCase =
(bodyState->handState < 2) ? bodyState->handState : MARIO_HAND_FISTS;
bodyState->handState < 2 ? bodyState->handState : MARIO_HAND_FISTS;
}
}
}
@@ -462,15 +504,19 @@ Gfx *geo_switch_mario_hand(s32 callContext, struct GraphNode *node, UNUSED Mat4
* ! Since the animation gets updated in GEO_CONTEXT_RENDER, drawing Mario multiple times
* (such as in the mirror room) results in a faster and desynced punch / kick animation.
*/
Gfx *geo_mario_hand_foot_scaler(s32 callContext, struct GraphNode *node, UNUSED Mat4 *c) {
Gfx *geo_mario_hand_foot_scaler(s32 callContext, struct GraphNode *node, UNUSED Mat4 *c)
{
struct GraphNodeGenerated *asGenerated = (struct GraphNodeGenerated *)node;
struct GraphNodeScale *scaleNode = (struct GraphNodeScale *)node->next;
struct MarioBodyState *bodyState = &gBodyStates[0];
if (callContext == GEO_CONTEXT_RENDER) {
if (callContext == GEO_CONTEXT_RENDER)
{
scaleNode->scale = 1.0f;
if (asGenerated->parameter == bodyState->punchState >> 6) {
if (g_state->msMarioAttackAnimCounter != gAreaUpdateCounter && (bodyState->punchState & 0x3F) > 0) {
if (asGenerated->parameter == bodyState->punchState >> 6)
{
if (g_state->msMarioAttackAnimCounter != gAreaUpdateCounter && (bodyState->punchState & 0x3F) > 0)
{
bodyState->punchState -= 1;
g_state->msMarioAttackAnimCounter = gAreaUpdateCounter;
}
@@ -485,13 +531,23 @@ Gfx *geo_mario_hand_foot_scaler(s32 callContext, struct GraphNode *node, UNUSED
/**
* Switch between normal cap, wing cap, vanish cap and metal cap.
*/
Gfx *geo_switch_mario_cap_effect(s32 callContext, struct GraphNode *node, UNUSED Mat4 *c) {
Gfx *geo_switch_mario_cap_effect(s32 callContext, struct GraphNode *node, UNUSED Mat4 *c)
{
struct GraphNodeSwitchCase *switchCase = (struct GraphNodeSwitchCase *)node;
struct MarioBodyState *bodyState = &gBodyStates[switchCase->numCases];
if (callContext == GEO_CONTEXT_RENDER) {
if (callContext == GEO_CONTEXT_RENDER)
{
// switchCase->selectedCase = bodyState->modelState >> 8;
if (bodyState->modelState >> 8 >= 2)
{ // temporarily disables metal cap
switchCase->selectedCase = 0;
}
else
{
switchCase->selectedCase = bodyState->modelState >> 8;
}
}
return NULL;
}
@@ -499,18 +555,25 @@ Gfx *geo_switch_mario_cap_effect(s32 callContext, struct GraphNode *node, UNUSED
* Determine whether Mario's head is drawn with or without a cap on.
* Also sets the visibility of the wing cap wings on or off.
*/
Gfx *geo_switch_mario_cap_on_off(s32 callContext, struct GraphNode *node, UNUSED Mat4 *c) {
Gfx *geo_switch_mario_cap_on_off(s32 callContext, struct GraphNode *node, UNUSED Mat4 *c)
{
struct GraphNode *next = node->next;
struct GraphNodeSwitchCase *switchCase = (struct GraphNodeSwitchCase *)node;
struct MarioBodyState *bodyState = &gBodyStates[switchCase->numCases];
if (callContext == GEO_CONTEXT_RENDER) {
if (callContext == GEO_CONTEXT_RENDER)
{
switchCase->selectedCase = bodyState->capState & 1;
while (next != node) {
if (next->type == GRAPH_NODE_TYPE_TRANSLATION_ROTATION) {
if (bodyState->capState & 2) {
while (next != node)
{
if (next->type == GRAPH_NODE_TYPE_TRANSLATION_ROTATION)
{
if (bodyState->capState & 2)
{
next->flags |= GRAPH_RENDER_ACTIVE;
} else {
}
else
{
next->flags &= ~GRAPH_RENDER_ACTIVE;
}
}
@@ -524,21 +587,29 @@ Gfx *geo_switch_mario_cap_on_off(s32 callContext, struct GraphNode *node, UNUSED
* Geo node script that makes the wings on Mario's wing cap flap.
* Should be placed before a rotation node.
*/
Gfx *geo_mario_rotate_wing_cap_wings(s32 callContext, struct GraphNode *node, UNUSED Mat4 *c) {
Gfx *geo_mario_rotate_wing_cap_wings(s32 callContext, struct GraphNode *node, UNUSED Mat4 *c)
{
s16 rotX;
struct GraphNodeGenerated *asGenerated = (struct GraphNodeGenerated *)node;
if (callContext == GEO_CONTEXT_RENDER) {
if (callContext == GEO_CONTEXT_RENDER)
{
struct GraphNodeRotation *rotNode = (struct GraphNodeRotation *)node->next;
if (!gBodyStates[asGenerated->parameter >> 1].wingFlutter) {
if (!gBodyStates[asGenerated->parameter >> 1].wingFlutter)
{
rotX = (coss((gAreaUpdateCounter & 0xF) << 12) + 1.0f) * 4096.0f;
} else {
}
else
{
rotX = (coss((gAreaUpdateCounter & 7) << 13) + 1.0f) * 6144.0f;
}
if (!(asGenerated->parameter & 1)) {
if (!(asGenerated->parameter & 1))
{
rotNode->rotation[0] = -rotX;
} else {
}
else
{
rotNode->rotation[0] = rotX;
}
}
@@ -548,20 +619,27 @@ Gfx *geo_mario_rotate_wing_cap_wings(s32 callContext, struct GraphNode *node, UN
/**
* Geo node that updates the held object node and the HOLP.
*/
Gfx *geo_switch_mario_hand_grab_pos(s32 callContext, struct GraphNode *b, Mat4 *mtx) {
Gfx *geo_switch_mario_hand_grab_pos(s32 callContext, struct GraphNode *b, Mat4 *mtx)
{
struct GraphNodeHeldObject *asHeldObj = (struct GraphNodeHeldObject *)b;
Mat4 *curTransform = mtx;
struct MarioState *marioState = gMarioState; // &gMarioStates[asHeldObj->playerIndex]; // PATCH
if (callContext == GEO_CONTEXT_RENDER) {
if (callContext == GEO_CONTEXT_RENDER)
{
asHeldObj->objNode = NULL;
if (marioState->heldObj != NULL) {
if (marioState->heldObj != NULL)
{
asHeldObj->objNode = marioState->heldObj;
switch (marioState->marioBodyState->grabPos) {
switch (marioState->marioBodyState->grabPos)
{
case GRAB_POS_LIGHT_OBJ:
if (marioState->action & ACT_FLAG_THROWING) {
if (marioState->action & ACT_FLAG_THROWING)
{
vec3s_set(asHeldObj->translation, 50, 0, 0);
} else {
}
else
{
vec3s_set(asHeldObj->translation, 50, 0, 110);
}
break;
@@ -573,7 +651,9 @@ Gfx *geo_switch_mario_hand_grab_pos(s32 callContext, struct GraphNode *b, Mat4 *
break;
}
}
} else if (callContext == GEO_CONTEXT_HELD_OBJ) {
}
else if (callContext == GEO_CONTEXT_HELD_OBJ)
{
// ! The HOLP is set here, which is why it only updates when the held object is drawn.
// This is why it won't update during a pause buffered hitstun or when the camera is very far
// away.
@@ -590,7 +670,8 @@ Gfx *geo_switch_mario_hand_grab_pos(s32 callContext, struct GraphNode *b, Mat4 *
* Geo node that creates a clone of Mario's geo node and updates it to becomes
* a mirror image of the player.
*/
Gfx *geo_render_mirror_mario(s32 callContext, struct GraphNode *node, UNUSED Mat4 *c) {
Gfx *geo_render_mirror_mario(s32 callContext, struct GraphNode *node, UNUSED Mat4 *c)
{
// f32 mirroredX;
// struct Object *mario = gMarioState->marioObj; // PATCH gMarioStates[0].marioObj;
@@ -631,7 +712,8 @@ Gfx *geo_render_mirror_mario(s32 callContext, struct GraphNode *node, UNUSED Mat
* Since Mirror Mario has an x scale of -1, the mesh becomes inside out.
* This node corrects that by changing the culling mode accordingly.
*/
Gfx *geo_mirror_mario_backface_culling(s32 callContext, struct GraphNode *node, UNUSED Mat4 *c) {
Gfx *geo_mirror_mario_backface_culling(s32 callContext, struct GraphNode *node, UNUSED Mat4 *c)
{
// struct GraphNodeGenerated *asGenerated = (struct GraphNodeGenerated *) node;
// Gfx *gfx = NULL;
+16
View File
@@ -8,21 +8,37 @@
// Gfx *geo_draw_mario_head_goddard(s32 callContext, struct GraphNode *node, Mat4 *c);
void bhv_toad_message_loop(void);
void bhv_toad_message_init(void);
void bhv_unlock_door_star_init(void);
void bhv_unlock_door_star_loop(void);
Gfx *geo_mirror_mario_set_alpha(s32 callContext, struct GraphNode *node, UNUSED Mat4 *c);
Gfx *geo_switch_mario_stand_run(s32 callContext, struct GraphNode *node, UNUSED Mat4 *mtx);
Gfx *geo_switch_mario_eyes(s32 callContext, struct GraphNode *node, UNUSED Mat4 *c);
Gfx *geo_mario_tilt_torso(s32 callContext, struct GraphNode *node, UNUSED Mat4 *c);
Gfx *geo_mario_head_rotation(s32 callContext, struct GraphNode *node, UNUSED Mat4 *c);
Gfx *geo_switch_mario_hand(s32 callContext, struct GraphNode *node, UNUSED Mat4 *c);
Gfx *geo_mario_hand_foot_scaler(s32 callContext, struct GraphNode *node, UNUSED Mat4 *c);
Gfx *geo_switch_mario_cap_effect(s32 callContext, struct GraphNode *node, UNUSED Mat4 *c);
Gfx *geo_switch_mario_cap_on_off(s32 callContext, struct GraphNode *node, UNUSED Mat4 *c);
Gfx *geo_mario_rotate_wing_cap_wings(s32 callContext, struct GraphNode *node, UNUSED Mat4 *c);
Gfx *geo_switch_mario_hand_grab_pos(s32 callContext, struct GraphNode *b, Mat4 *mtx);
Gfx *geo_render_mirror_mario(s32 callContext, struct GraphNode *node, UNUSED Mat4 *c);
Gfx *geo_mirror_mario_backface_culling(s32 callContext, struct GraphNode *node, UNUSED Mat4 *c);
#endif // MARIO_MISC_H
+250 -147
View File
@@ -25,7 +25,8 @@ struct SM64SurfaceCollisionData gWaterSurfacePseudoFloor = {
* known through stub_mario_step_2 and whether Mario was on it,
* and if so return a higher value than 0.
*/
f32 get_additive_y_vel_for_jumps(void) {
f32 get_additive_y_vel_for_jumps(void)
{
return 0.0f;
}
@@ -38,7 +39,8 @@ f32 get_additive_y_vel_for_jumps(void) {
* this could be used for checking if Mario was on the trampoline.
* It could, for example, make him bounce.
*/
void stub_mario_step_1(UNUSED struct MarioState *x) {
void stub_mario_step_1(UNUSED struct MarioState * x)
{
}
/**
@@ -48,10 +50,12 @@ void stub_mario_step_1(UNUSED struct MarioState *x) {
* by the trampoline to make itself known to get_additive_y_vel_for_jumps,
* or to set a variable with its intended additive Y vel.
*/
void stub_mario_step_2(void) {
void stub_mario_step_2(void)
{
}
void transfer_bully_speed(struct BullyCollisionData *obj1, struct BullyCollisionData *obj2) {
void transfer_bully_speed(struct BullyCollisionData *obj1, struct BullyCollisionData *obj2)
{
f32 rx = obj2->posX - obj1->posX;
f32 rz = obj2->posZ - obj1->posZ;
@@ -70,9 +74,12 @@ void transfer_bully_speed(struct BullyCollisionData *obj1, struct BullyCollision
//! Bully battery
}
BAD_RETURN(s32) init_bully_collision_data(struct BullyCollisionData *data, f32 posX, f32 posZ,
f32 forwardVel, s16 yaw, f32 conversionRatio, f32 radius) {
if (forwardVel < 0.0f) {
BAD_RETURN (s32) init_bully_collision_data(
struct BullyCollisionData *data, f32 posX, f32 posZ,
f32 forwardVel, s16 yaw, f32 conversionRatio, f32 radius)
{
if (forwardVel < 0.0f)
{
forwardVel *= -1.0f;
yaw += 0x8000;
}
@@ -85,55 +92,72 @@ BAD_RETURN(s32) init_bully_collision_data(struct BullyCollisionData *data, f32 p
data->velZ = forwardVel * coss(yaw);
}
void mario_bonk_reflection(struct MarioState *m, u32 negateSpeed) {
if (m->wall != NULL) {
void mario_bonk_reflection(struct MarioState *m, u32 negateSpeed)
{
if (m->wall != NULL)
{
s16 wallAngle = atan2s(m->wall->normal.z, m->wall->normal.x);
m->faceAngle[1] = wallAngle - (s16)(m->faceAngle[1] - wallAngle);
play_sound((m->flags & MARIO_METAL_CAP) ? SOUND_ACTION_METAL_BONK : SOUND_ACTION_BONK,
play_sound(m->flags & MARIO_METAL_CAP ? SOUND_ACTION_METAL_BONK : SOUND_ACTION_BONK,
m->marioObj->header.gfx.cameraToObject);
} else {
}
else
{
play_sound(SOUND_ACTION_HIT, m->marioObj->header.gfx.cameraToObject);
}
if (negateSpeed) {
if (negateSpeed)
{
mario_set_forward_vel(m, -m->forwardVel);
} else {
}
else
{
m->faceAngle[1] += 0x8000;
}
}
u32 mario_update_quicksand(struct MarioState *m, f32 sinkingSpeed) {
if (m->action & ACT_FLAG_RIDING_SHELL) {
u32 mario_update_quicksand(struct MarioState *m, f32 sinkingSpeed)
{
if (m->action & ACT_FLAG_RIDING_SHELL)
{
m->quicksandDepth = 0.0f;
} else {
if (m->quicksandDepth < 1.1f) {
}
else
{
if (m->quicksandDepth < 1.1f)
{
m->quicksandDepth = 1.1f;
}
switch (m->floor->type) {
switch (m->floor->type)
{
case SURFACE_SHALLOW_QUICKSAND:
if ((m->quicksandDepth += sinkingSpeed) >= 10.0f) {
if ((m->quicksandDepth += sinkingSpeed) >= 10.0f)
{
m->quicksandDepth = 10.0f;
}
break;
case SURFACE_SHALLOW_MOVING_QUICKSAND:
if ((m->quicksandDepth += sinkingSpeed) >= 25.0f) {
if ((m->quicksandDepth += sinkingSpeed) >= 25.0f)
{
m->quicksandDepth = 25.0f;
}
break;
case SURFACE_QUICKSAND:
case SURFACE_MOVING_QUICKSAND:
if ((m->quicksandDepth += sinkingSpeed) >= 60.0f) {
if ((m->quicksandDepth += sinkingSpeed) >= 60.0f)
{
m->quicksandDepth = 60.0f;
}
break;
case SURFACE_DEEP_QUICKSAND:
case SURFACE_DEEP_MOVING_QUICKSAND:
if ((m->quicksandDepth += sinkingSpeed) >= 160.0f) {
if ((m->quicksandDepth += sinkingSpeed) >= 160.0f)
{
update_mario_sound_and_camera(m);
return drop_and_set_mario_action(m, ACT_QUICKSAND_DEATH, 0);
}
@@ -154,13 +178,17 @@ u32 mario_update_quicksand(struct MarioState *m, f32 sinkingSpeed) {
return FALSE;
}
u32 mario_push_off_steep_floor(struct MarioState *m, u32 action, u32 actionArg) {
u32 mario_push_off_steep_floor(struct MarioState *m, u32 action, u32 actionArg)
{
s16 floorDYaw = m->floorAngle - m->faceAngle[1];
if (floorDYaw > -0x4000 && floorDYaw < 0x4000) {
if (floorDYaw > -0x4000 && floorDYaw < 0x4000)
{
m->forwardVel = 16.0f;
m->faceAngle[1] = m->floorAngle;
} else {
}
else
{
m->forwardVel = -16.0f;
m->faceAngle[1] = m->floorAngle + 0x8000;
}
@@ -168,12 +196,14 @@ u32 mario_push_off_steep_floor(struct MarioState *m, u32 action, u32 actionArg)
return set_mario_action(m, action, actionArg);
}
u32 mario_update_moving_sand(struct MarioState *m) {
u32 mario_update_moving_sand(struct MarioState *m)
{
struct SM64SurfaceCollisionData *floor = m->floor;
s32 floorType = floor->type;
if (floorType == SURFACE_DEEP_MOVING_QUICKSAND || floorType == SURFACE_SHALLOW_MOVING_QUICKSAND
|| floorType == SURFACE_MOVING_QUICKSAND || floorType == SURFACE_INSTANT_MOVING_QUICKSAND) {
|| floorType == SURFACE_MOVING_QUICKSAND || floorType == SURFACE_INSTANT_MOVING_QUICKSAND)
{
s16 pushAngle = floor->force << 8;
f32 pushSpeed = sMovingSandSpeeds[floor->force >> 8];
@@ -186,25 +216,31 @@ u32 mario_update_moving_sand(struct MarioState *m) {
return FALSE;
}
u32 mario_update_windy_ground(struct MarioState *m) {
u32 mario_update_windy_ground(struct MarioState *m)
{
struct SM64SurfaceCollisionData *floor = m->floor;
if (floor->type == SURFACE_HORIZONTAL_WIND) {
if (floor->type == SURFACE_HORIZONTAL_WIND)
{
f32 pushSpeed;
s16 pushAngle = floor->force << 8;
if (m->action & ACT_FLAG_MOVING) {
if (m->action & ACT_FLAG_MOVING)
{
s16 pushDYaw = m->faceAngle[1] - pushAngle;
pushSpeed = m->forwardVel > 0.0f ? -m->forwardVel * 0.5f : -8.0f;
if (pushDYaw > -0x4000 && pushDYaw < 0x4000) {
if (pushDYaw > -0x4000 && pushDYaw < 0x4000)
{
pushSpeed *= -1.0f;
}
pushSpeed *= coss(pushDYaw);
} else {
pushSpeed = 3.2f + (gGlobalTimer % 4);
}
else
{
pushSpeed = 3.2f + gGlobalTimer % 4;
}
m->vel[0] += pushSpeed * sins(pushAngle);
@@ -219,7 +255,8 @@ u32 mario_update_windy_ground(struct MarioState *m) {
return FALSE;
}
void stop_and_set_height_to_floor(struct MarioState *m) {
void stop_and_set_height_to_floor(struct MarioState *m)
{
struct Object *marioObj = m->marioObj;
mario_set_forward_vel(m, 0.0f);
@@ -232,18 +269,21 @@ void stop_and_set_height_to_floor(struct MarioState *m) {
vec3s_set(marioObj->header.gfx.angle, 0, m->faceAngle[1], 0);
}
s32 stationary_ground_step(struct MarioState *m) {
u32 takeStep;
s32 stationary_ground_step(struct MarioState *m)
{
struct Object *marioObj = m->marioObj;
u32 stepResult = GROUND_STEP_NONE;
mario_set_forward_vel(m, 0.0f);
takeStep = mario_update_moving_sand(m);
u32 takeStep = mario_update_moving_sand(m);
takeStep |= mario_update_windy_ground(m);
if (takeStep) {
if (takeStep)
{
stepResult = perform_ground_step(m);
} else {
}
else
{
//! This is responsible for several stationary downwarps.
m->pos[1] = m->floorHeight;
@@ -254,38 +294,38 @@ s32 stationary_ground_step(struct MarioState *m) {
return stepResult;
}
static s32 perform_ground_quarter_step(struct MarioState *m, Vec3f nextPos) {
UNUSED struct SM64SurfaceCollisionData *lowerWall;
struct SM64SurfaceCollisionData *upperWall;
static s32 perform_ground_quarter_step(struct MarioState *m, Vec3f nextPos)
{
struct SM64SurfaceCollisionData *ceil;
struct SM64SurfaceCollisionData *floor;
f32 ceilHeight;
f32 floorHeight;
f32 waterLevel;
lowerWall = resolve_and_return_wall_collisions(nextPos, 30.0f, 24.0f);
upperWall = resolve_and_return_wall_collisions(nextPos, 60.0f, 50.0f);
struct SM64SurfaceCollisionData *lowerWall = resolve_and_return_wall_collisions(nextPos, 30.0f, 24.0f);
struct SM64SurfaceCollisionData *upperWall = resolve_and_return_wall_collisions(nextPos, 60.0f, 50.0f);
floorHeight = find_floor(nextPos[0], nextPos[1], nextPos[2], &floor);
ceilHeight = vec3f_find_ceil(nextPos, floorHeight, &ceil);
f32 floorHeight = find_floor(nextPos[0], nextPos[1], nextPos[2], &floor);
f32 ceilHeight = vec3f_find_ceil(nextPos, floorHeight, &ceil);
//waterLevel = find_water_level(nextPos[0], nextPos[2]);
waterLevel = m->waterLevel;
f32 waterLevel = m->waterLevel;
m->wall = upperWall;
if (floor == NULL) {
if (floor == NULL)
{
return GROUND_STEP_HIT_WALL_STOP_QSTEPS;
}
if ((m->action & ACT_FLAG_RIDING_SHELL) && floorHeight < waterLevel) {
if (m->action & ACT_FLAG_RIDING_SHELL && floorHeight < waterLevel)
{
floorHeight = waterLevel;
floor = &gWaterSurfacePseudoFloor;
floor->originOffset = floorHeight; //! Wrong origin offset (no effect)
}
if (nextPos[1] > floorHeight + 100.0f) {
if (nextPos[1] + 160.0f >= ceilHeight) {
if (nextPos[1] > floorHeight + 100.0f)
{
if (nextPos[1] + 160.0f >= ceilHeight)
{
return GROUND_STEP_HIT_WALL_STOP_QSTEPS;
}
@@ -295,7 +335,8 @@ static s32 perform_ground_quarter_step(struct MarioState *m, Vec3f nextPos) {
return GROUND_STEP_LEFT_GROUND;
}
if (floorHeight + 160.0f >= ceilHeight) {
if (floorHeight + 160.0f >= ceilHeight)
{
return GROUND_STEP_HIT_WALL_STOP_QSTEPS;
}
@@ -303,13 +344,16 @@ static s32 perform_ground_quarter_step(struct MarioState *m, Vec3f nextPos) {
m->floor = floor;
m->floorHeight = floorHeight;
if (upperWall != NULL) {
if (upperWall != NULL)
{
s16 wallDYaw = atan2s(upperWall->normal.z, upperWall->normal.x) - m->faceAngle[1];
if (wallDYaw >= 0x2AAA && wallDYaw <= 0x5555) {
if (wallDYaw >= 0x2AAA && wallDYaw <= 0x5555)
{
return GROUND_STEP_NONE;
}
if (wallDYaw <= -0x2AAA && wallDYaw >= -0x5555) {
if (wallDYaw <= -0x2AAA && wallDYaw >= -0x5555)
{
return GROUND_STEP_NONE;
}
@@ -319,18 +363,20 @@ static s32 perform_ground_quarter_step(struct MarioState *m, Vec3f nextPos) {
return GROUND_STEP_NONE;
}
s32 perform_ground_step(struct MarioState *m) {
s32 i;
s32 perform_ground_step(struct MarioState *m)
{
u32 stepResult;
Vec3f intendedPos;
for (i = 0; i < 4; i++) {
for (s32 i = 0; i < 4; i++)
{
intendedPos[0] = m->pos[0] + m->floor->normal.y * (m->vel[0] / 4.0f);
intendedPos[2] = m->pos[2] + m->floor->normal.y * (m->vel[2] / 4.0f);
intendedPos[1] = m->pos[1];
stepResult = perform_ground_quarter_step(m, intendedPos);
if (stepResult == GROUND_STEP_LEFT_GROUND || stepResult == GROUND_STEP_HIT_WALL_STOP_QSTEPS) {
if (stepResult == GROUND_STEP_LEFT_GROUND || stepResult == GROUND_STEP_HIT_WALL_STOP_QSTEPS)
{
break;
}
}
@@ -339,28 +385,30 @@ s32 perform_ground_step(struct MarioState *m) {
vec3f_copy(m->marioObj->header.gfx.pos, m->pos);
vec3s_set(m->marioObj->header.gfx.angle, 0, m->faceAngle[1], 0);
if (stepResult == GROUND_STEP_HIT_WALL_CONTINUE_QSTEPS) {
if (stepResult == GROUND_STEP_HIT_WALL_CONTINUE_QSTEPS)
{
stepResult = GROUND_STEP_HIT_WALL;
}
return stepResult;
}
u32 check_ledge_grab(struct MarioState *m, struct SM64SurfaceCollisionData *wall, Vec3f intendedPos, Vec3f nextPos) {
u32 check_ledge_grab(struct MarioState *m, struct SM64SurfaceCollisionData *wall, Vec3f intendedPos, Vec3f nextPos)
{
struct SM64SurfaceCollisionData *ledgeFloor;
Vec3f ledgePos;
f32 displacementX;
f32 displacementZ;
if (m->vel[1] > 0) {
if (m->vel[1] > 0)
{
return FALSE;
}
displacementX = nextPos[0] - intendedPos[0];
displacementZ = nextPos[2] - intendedPos[2];
f32 displacementX = nextPos[0] - intendedPos[0];
f32 displacementZ = nextPos[2] - intendedPos[2];
// Only ledge grab if the wall displaced Mario in the opposite direction of
// his velocity.
if (displacementX * m->vel[0] + displacementZ * m->vel[2] > 0.0f) {
if (displacementX * m->vel[0] + displacementZ * m->vel[2] > 0.0f)
{
return FALSE;
}
@@ -370,7 +418,8 @@ u32 check_ledge_grab(struct MarioState *m, struct SM64SurfaceCollisionData *wall
ledgePos[2] = nextPos[2] - wall->normal.z * 60.0f;
ledgePos[1] = find_floor(ledgePos[0], nextPos[1] + 160.0f, ledgePos[2], &ledgeFloor);
if (ledgePos[1] - nextPos[1] <= 100.0f) {
if (ledgePos[1] - nextPos[1] <= 100.0f)
{
return FALSE;
}
@@ -385,35 +434,32 @@ u32 check_ledge_grab(struct MarioState *m, struct SM64SurfaceCollisionData *wall
return TRUE;
}
s32 perform_air_quarter_step(struct MarioState *m, Vec3f intendedPos, u32 stepArg) {
s16 wallDYaw;
s32 perform_air_quarter_step(struct MarioState *m, Vec3f intendedPos, u32 stepArg)
{
Vec3f nextPos;
struct SM64SurfaceCollisionData *upperWall;
struct SM64SurfaceCollisionData *lowerWall;
struct SM64SurfaceCollisionData *ceil;
struct SM64SurfaceCollisionData *floor;
f32 ceilHeight;
f32 floorHeight;
f32 waterLevel;
vec3f_copy(nextPos, intendedPos);
upperWall = resolve_and_return_wall_collisions(nextPos, 150.0f, 50.0f);
lowerWall = resolve_and_return_wall_collisions(nextPos, 30.0f, 50.0f);
struct SM64SurfaceCollisionData *upperWall = resolve_and_return_wall_collisions(nextPos, 150.0f, 50.0f);
struct SM64SurfaceCollisionData *lowerWall = resolve_and_return_wall_collisions(nextPos, 30.0f, 50.0f);
floorHeight = find_floor(nextPos[0], nextPos[1], nextPos[2], &floor);
ceilHeight = vec3f_find_ceil(nextPos, floorHeight, &ceil);
f32 floorHeight = find_floor(nextPos[0], nextPos[1], nextPos[2], &floor);
f32 ceilHeight = vec3f_find_ceil(nextPos, floorHeight, &ceil);
//waterLevel = find_water_level(nextPos[0], nextPos[2]);
waterLevel = m->waterLevel;
f32 waterLevel = m->waterLevel;
m->wall = NULL;
//! The water pseudo floor is not referenced when your intended qstep is
// out of bounds, so it won't detect you as landing.
if (floor == NULL) {
if (nextPos[1] <= m->floorHeight) {
if (floor == NULL)
{
if (nextPos[1] <= m->floorHeight)
{
m->pos[1] = m->floorHeight;
return AIR_STEP_LANDED;
}
@@ -422,15 +468,18 @@ s32 perform_air_quarter_step(struct MarioState *m, Vec3f intendedPos, u32 stepAr
return AIR_STEP_HIT_WALL;
}
if ((m->action & ACT_FLAG_RIDING_SHELL) && floorHeight < waterLevel) {
if (m->action & ACT_FLAG_RIDING_SHELL && floorHeight < waterLevel)
{
floorHeight = waterLevel;
floor = &gWaterSurfacePseudoFloor;
floor->originOffset = floorHeight; //! Incorrect origin offset (no effect)
}
//! This check uses f32, but findFloor uses short (overflow jumps)
if (nextPos[1] <= floorHeight) {
if (ceilHeight - floorHeight > 160.0f) {
if (nextPos[1] <= floorHeight)
{
if (ceilHeight - floorHeight > 160.0f)
{
m->pos[0] = nextPos[0];
m->pos[2] = nextPos[2];
m->floor = floor;
@@ -444,13 +493,16 @@ s32 perform_air_quarter_step(struct MarioState *m, Vec3f intendedPos, u32 stepAr
return AIR_STEP_LANDED;
}
if (nextPos[1] + 160.0f > ceilHeight) {
if (m->vel[1] >= 0.0f) {
if (nextPos[1] + 160.0f > ceilHeight)
{
if (m->vel[1] >= 0.0f)
{
m->vel[1] = 0.0f;
//! Uses referenced ceiling instead of ceil (ceiling hang upwarp)
if ((stepArg & AIR_STEP_CHECK_HANG) && m->ceil != NULL
&& m->ceil->type == SURFACE_HANGABLE) {
if (stepArg & AIR_STEP_CHECK_HANG && m->ceil != NULL
&& m->ceil->type == SURFACE_HANGABLE)
{
return AIR_STEP_GRABBED_CEILING;
}
@@ -458,7 +510,8 @@ s32 perform_air_quarter_step(struct MarioState *m, Vec3f intendedPos, u32 stepAr
}
//! Potential subframe downwarp->upwarp?
if (nextPos[1] <= m->floorHeight) {
if (nextPos[1] <= m->floorHeight)
{
m->pos[1] = m->floorHeight;
return AIR_STEP_LANDED;
}
@@ -469,8 +522,10 @@ s32 perform_air_quarter_step(struct MarioState *m, Vec3f intendedPos, u32 stepAr
//! When the wall is not completely vertical or there is a slight wall
// misalignment, you can activate these conditions in unexpected situations
if ((stepArg & AIR_STEP_CHECK_LEDGE_GRAB) && upperWall == NULL && lowerWall != NULL) {
if (check_ledge_grab(m, lowerWall, intendedPos, nextPos)) {
if (stepArg & AIR_STEP_CHECK_LEDGE_GRAB && upperWall == NULL && lowerWall != NULL)
{
if (check_ledge_grab(m, lowerWall, intendedPos, nextPos))
{
return AIR_STEP_GRABBED_LEDGE;
}
@@ -484,15 +539,18 @@ s32 perform_air_quarter_step(struct MarioState *m, Vec3f intendedPos, u32 stepAr
m->floor = floor;
m->floorHeight = floorHeight;
if (upperWall != NULL || lowerWall != NULL) {
if (upperWall != NULL || lowerWall != NULL)
{
m->wall = upperWall != NULL ? upperWall : lowerWall;
wallDYaw = atan2s(m->wall->normal.z, m->wall->normal.x) - m->faceAngle[1];
s16 wallDYaw = atan2s(m->wall->normal.z, m->wall->normal.x) - m->faceAngle[1];
if (m->wall->type == SURFACE_BURNING) {
if (m->wall->type == SURFACE_BURNING)
{
return AIR_STEP_HIT_LAVA_WALL;
}
if (wallDYaw < -0x6000 || wallDYaw > 0x6000) {
if (wallDYaw < -0x6000 || wallDYaw > 0x6000)
{
m->flags |= MARIO_UNKNOWN_30;
return AIR_STEP_HIT_WALL;
}
@@ -501,102 +559,141 @@ s32 perform_air_quarter_step(struct MarioState *m, Vec3f intendedPos, u32 stepAr
return AIR_STEP_NONE;
}
void apply_twirl_gravity(struct MarioState *m) {
f32 terminalVelocity;
void apply_twirl_gravity(struct MarioState *m)
{
f32 heaviness = 1.0f;
if (m->angleVel[1] > 1024) {
if (m->angleVel[1] > 1024)
{
heaviness = 1024.0f / m->angleVel[1];
}
terminalVelocity = -75.0f * heaviness;
f32 terminalVelocity = -75.0f * heaviness;
m->vel[1] -= 4.0f * heaviness;
if (m->vel[1] < terminalVelocity) {
if (m->vel[1] < terminalVelocity)
{
m->vel[1] = terminalVelocity;
}
}
u32 should_strengthen_gravity_for_jump_ascent(struct MarioState *m) {
if (!(m->flags & MARIO_UNKNOWN_08)) {
u32 should_strengthen_gravity_for_jump_ascent(struct MarioState *m)
{
if (!(m->flags & MARIO_UNKNOWN_08))
{
return FALSE;
}
if (m->action & (ACT_FLAG_INTANGIBLE | ACT_FLAG_INVULNERABLE)) {
if (m->action & (ACT_FLAG_INTANGIBLE | ACT_FLAG_INVULNERABLE))
{
return FALSE;
}
if (!(m->input & INPUT_A_DOWN) && m->vel[1] > 20.0f) {
if (!(m->input & INPUT_A_DOWN) && m->vel[1] > 20.0f)
{
return (m->action & ACT_FLAG_CONTROL_JUMP_HEIGHT) != 0;
}
return FALSE;
}
void apply_gravity(struct MarioState *m) {
if (m->action == ACT_TWIRLING && m->vel[1] < 0.0f) {
void apply_gravity(struct MarioState *m)
{
if (m->action == ACT_TWIRLING && m->vel[1] < 0.0f)
{
apply_twirl_gravity(m);
} else if (m->action == ACT_SHOT_FROM_CANNON) {
}
else if (m->action == ACT_SHOT_FROM_CANNON)
{
m->vel[1] -= 1.0f;
if (m->vel[1] < -75.0f) {
if (m->vel[1] < -75.0f)
{
m->vel[1] = -75.0f;
}
} else if (m->action == ACT_LONG_JUMP || m->action == ACT_SLIDE_KICK
|| m->action == ACT_BBH_ENTER_SPIN) {
}
else if (m->action == ACT_LONG_JUMP || m->action == ACT_SLIDE_KICK
|| m->action == ACT_BBH_ENTER_SPIN)
{
m->vel[1] -= 2.0f;
if (m->vel[1] < -75.0f) {
if (m->vel[1] < -75.0f)
{
m->vel[1] = -75.0f;
}
} else if (m->action == ACT_LAVA_BOOST || m->action == ACT_FALL_AFTER_STAR_GRAB) {
}
else if (m->action == ACT_LAVA_BOOST || m->action == ACT_FALL_AFTER_STAR_GRAB)
{
m->vel[1] -= 3.2f;
if (m->vel[1] < -65.0f) {
if (m->vel[1] < -65.0f)
{
m->vel[1] = -65.0f;
}
} else if (m->action == ACT_GETTING_BLOWN) {
}
else if (m->action == ACT_GETTING_BLOWN)
{
m->vel[1] -= m->unkC4;
if (m->vel[1] < -75.0f) {
if (m->vel[1] < -75.0f)
{
m->vel[1] = -75.0f;
}
} else if (should_strengthen_gravity_for_jump_ascent(m)) {
}
else if (should_strengthen_gravity_for_jump_ascent(m))
{
m->vel[1] /= 4.0f;
} else if (m->action & ACT_FLAG_METAL_WATER) {
}
else if (m->action & ACT_FLAG_METAL_WATER)
{
m->vel[1] -= 1.6f;
if (m->vel[1] < -16.0f) {
if (m->vel[1] < -16.0f)
{
m->vel[1] = -16.0f;
}
} else if ((m->flags & MARIO_WING_CAP) && m->vel[1] < 0.0f && (m->input & INPUT_A_DOWN)) {
}
else if (m->flags & MARIO_WING_CAP && m->vel[1] < 0.0f && m->input & INPUT_A_DOWN)
{
m->marioBodyState->wingFlutter = TRUE;
m->vel[1] -= 2.0f;
if (m->vel[1] < -37.5f) {
if ((m->vel[1] += 4.0f) > -37.5f) {
if (m->vel[1] < -37.5f)
{
if ((m->vel[1] += 4.0f) > -37.5f)
{
m->vel[1] = -37.5f;
}
}
} else {
}
else
{
m->vel[1] -= 4.0f;
if (m->vel[1] < -75.0f) {
if (m->vel[1] < -75.0f)
{
m->vel[1] = -75.0f;
}
}
}
void apply_vertical_wind(struct MarioState *m) {
void apply_vertical_wind(struct MarioState *m)
{
f32 maxVelY;
f32 offsetY;
if (m->action != ACT_GROUND_POUND) {
offsetY = m->pos[1] - -1500.0f;
if (m->action != ACT_GROUND_POUND)
{
f32 offsetY = m->pos[1] - -1500.0f;
if (m->floor->type == SURFACE_VERTICAL_WIND && -3000.0f < offsetY && offsetY < 2000.0f) {
if (offsetY >= 0.0f) {
if (m->floor->type == SURFACE_VERTICAL_WIND && -3000.0f < offsetY && offsetY < 2000.0f)
{
if (offsetY >= 0.0f)
{
maxVelY = 10000.0f / (offsetY + 200.0f);
} else {
}
else
{
maxVelY = 50.0f;
}
if (m->vel[1] < maxVelY) {
if ((m->vel[1] += maxVelY / 8.0f) > maxVelY) {
if (m->vel[1] < maxVelY)
{
if ((m->vel[1] += maxVelY / 8.0f) > maxVelY)
{
m->vel[1] = maxVelY;
}
}
@@ -608,43 +705,47 @@ void apply_vertical_wind(struct MarioState *m) {
}
}
s32 perform_air_step(struct MarioState *m, u32 stepArg) {
s32 perform_air_step(struct MarioState *m, u32 stepArg)
{
Vec3f intendedPos;
s32 i;
s32 quarterStepResult;
s32 stepResult = AIR_STEP_NONE;
m->wall = NULL;
for (i = 0; i < 4; i++) {
for (s32 i = 0; i < 4; i++)
{
intendedPos[0] = m->pos[0] + m->vel[0] / 4.0f;
intendedPos[1] = m->pos[1] + m->vel[1] / 4.0f;
intendedPos[2] = m->pos[2] + m->vel[2] / 4.0f;
quarterStepResult = perform_air_quarter_step(m, intendedPos, stepArg);
s32 quarterStepResult = perform_air_quarter_step(m, intendedPos, stepArg);
//! On one qf, hit OOB/ceil/wall to store the 2 return value, and continue
// getting 0s until your last qf. Graze a wall on your last qf, and it will
// return the stored 2 with a sharply angled reference wall. (some gwks)
if (quarterStepResult != AIR_STEP_NONE) {
if (quarterStepResult != AIR_STEP_NONE)
{
stepResult = quarterStepResult;
}
if (quarterStepResult == AIR_STEP_LANDED || quarterStepResult == AIR_STEP_GRABBED_LEDGE
|| quarterStepResult == AIR_STEP_GRABBED_CEILING
|| quarterStepResult == AIR_STEP_HIT_LAVA_WALL) {
|| quarterStepResult == AIR_STEP_HIT_LAVA_WALL)
{
break;
}
}
if (m->vel[1] >= 0.0f) {
if (m->vel[1] >= 0.0f)
{
m->peakHeight = m->pos[1];
}
m->terrainSoundAddend = mario_get_terrain_sound_addend(m);
if (m->action != ACT_FLYING) {
if (m->action != ACT_FLYING)
{
apply_gravity(m);
}
apply_vertical_wind(m);
@@ -657,13 +758,15 @@ s32 perform_air_step(struct MarioState *m, u32 stepArg) {
// They had these functions the whole time and never used them? Lol
void set_vel_from_pitch_and_yaw(struct MarioState *m) {
void set_vel_from_pitch_and_yaw(struct MarioState *m)
{
m->vel[0] = m->forwardVel * coss(m->faceAngle[0]) * sins(m->faceAngle[1]);
m->vel[1] = m->forwardVel * sins(m->faceAngle[0]);
m->vel[2] = m->forwardVel * coss(m->faceAngle[0]) * coss(m->faceAngle[1]);
}
void set_vel_from_yaw(struct MarioState *m) {
void set_vel_from_yaw(struct MarioState *m)
{
m->vel[0] = m->slideVelX = m->forwardVel * sins(m->faceAngle[1]);
m->vel[1] = 0.0f;
m->vel[2] = m->slideVelZ = m->forwardVel * coss(m->faceAngle[1]);
+28 -8
View File
@@ -5,32 +5,52 @@
#include "../include/types.h"
struct BullyCollisionData {
/*0x00*/ f32 conversionRatio;
/*0x04*/ f32 radius;
/*0x08*/ f32 posX;
/*0x0C*/ f32 posZ;
/*0x10*/ f32 velX;
/*0x14*/ f32 velZ;
struct BullyCollisionData
{
/*0x00*/
f32 conversionRatio;
/*0x04*/
f32 radius;
/*0x08*/
f32 posX;
/*0x0C*/
f32 posZ;
/*0x10*/
f32 velX;
/*0x14*/
f32 velZ;
};
extern struct SM64SurfaceCollisionData gWaterSurfacePseudoFloor;
f32 get_additive_y_vel_for_jumps(void);
void stub_mario_step_1(struct MarioState *);
void stub_mario_step_2(void);
void mario_bonk_reflection(struct MarioState *, u32);
void transfer_bully_speed(struct BullyCollisionData *obj1, struct BullyCollisionData *obj2);
BAD_RETURN(s32) init_bully_collision_data(struct BullyCollisionData *data, f32 posX, f32 posZ,
BAD_RETURN (s32) init_bully_collision_data(
struct BullyCollisionData *data, f32 posX, f32 posZ,
f32 forwardVel, s16 yaw, f32 conversionRatio, f32 radius);
u32 mario_update_quicksand(struct MarioState *, f32);
u32 mario_push_off_steep_floor(struct MarioState *, u32, u32);
u32 mario_update_moving_sand(struct MarioState *);
u32 mario_update_windy_ground(struct MarioState *);
void stop_and_set_height_to_floor(struct MarioState *);
s32 stationary_ground_step(struct MarioState *);
s32 perform_ground_step(struct MarioState *);
s32 perform_air_step(struct MarioState *, u32);
#endif // MARIO_STEP_H
+38 -28
View File
@@ -11,16 +11,16 @@
static Vec3f gVec3fZero = {0.0f, 0.0f, 0.0f};
static Vec3s gVec3sZero = {0, 0, 0};
static struct Object *try_allocate_object(void) {
struct ObjectNode *nextObj;
nextObj = (struct ObjectNode *) malloc(sizeof(struct Object));
static struct Object *try_allocate_object(void)
{
struct ObjectNode *nextObj = (struct ObjectNode *)malloc(sizeof(struct Object));
nextObj->prev = NULL;
nextObj->next = NULL;
return (struct Object *)nextObj;
}
static struct Object *allocate_object(void) {
s32 i;
static struct Object *allocate_object(void)
{
struct Object *obj = try_allocate_object();
// Initialize object fields
@@ -31,7 +31,8 @@ static struct Object *allocate_object(void) {
obj->collidedObjInteractTypes = 0;
obj->numCollidedObjs = 0;
for (i = 0; i < 0x50; i++) {
for (s32 i = 0; i < 0x50; i++)
{
#ifdef _WIN32
obj->rawData.asS32[i] = 0;
#endif
@@ -58,9 +59,12 @@ static struct Object *allocate_object(void) {
obj->oHealth = 2048;
obj->oCollisionDistance = 1000.0f;
if (gCurrLevelNum == LEVEL_TTC) {
if (gCurrLevelNum == LEVEL_TTC)
{
obj->oDrawingDistance = 2000.0f;
} else {
}
else
{
obj->oDrawingDistance = 4000.0f;
}
@@ -81,15 +85,16 @@ static struct Object *allocate_object(void) {
return obj;
}
static struct Object *create_object(void) {
struct Object *obj;
obj = allocate_object();
static struct Object *create_object(void)
{
struct Object *obj = allocate_object();
obj->curBhvCommand = NULL;
obj->behavior = NULL;
return obj;
}
static void geo_obj_init(struct GraphNodeObject *graphNode, void *sharedChild, Vec3f pos, Vec3s angle) {
static void geo_obj_init(struct GraphNodeObject *graphNode, void *sharedChild, Vec3f pos, Vec3s angle)
{
vec3f_set(graphNode->scale, 1.0f, 1.0f, 1.0f);
vec3f_copy(graphNode->pos, pos);
vec3s_copy(graphNode->angle, angle);
@@ -105,14 +110,13 @@ static void geo_obj_init(struct GraphNodeObject *graphNode, void *sharedChild, V
graphNode->node.flags &= ~GRAPH_RENDER_BILLBOARD;
}
static struct Object *spawn_object_at_origin(void) {
struct Object *obj;
obj = create_object();
static struct Object *spawn_object_at_origin(void)
{
struct Object *obj = create_object();
obj->parentObj = NULL;
obj->header.gfx.areaIndex = 0;
obj->header.gfx.activeAreaIndex = 0;
geo_obj_init((struct GraphNodeObject *) &obj->header.gfx, NULL, gVec3fZero, gVec3sZero);
geo_obj_init(&obj->header.gfx, NULL, gVec3fZero, gVec3sZero);
return obj;
}
@@ -121,10 +125,12 @@ static struct Object *spawn_object_at_origin(void) {
* Copy position, velocity, and angle variables from MarioState to the Mario
* object.
*/
static void copy_mario_state_to_object(void) {
static void copy_mario_state_to_object(void)
{
s32 i = 0;
// L is real
if (gCurrentObject != gMarioObject) {
if (gCurrentObject != gMarioObject)
{
i += 1;
}
@@ -157,7 +163,8 @@ struct Object *hack_allocate_mario(void)
/**
* Mario's primary behavior update function.
*/
void bhv_mario_update(void) {
void bhv_mario_update(void)
{
u32 particleFlags = 0;
// s32 i;
@@ -180,12 +187,11 @@ void bhv_mario_update(void) {
// }
}
void create_transformation_from_matrices(Mat4 a0, Mat4 a1, Mat4 a2) {
f32 spC, sp8, sp4;
spC = a2[3][0] * a2[0][0] + a2[3][1] * a2[0][1] + a2[3][2] * a2[0][2];
sp8 = a2[3][0] * a2[1][0] + a2[3][1] * a2[1][1] + a2[3][2] * a2[1][2];
sp4 = a2[3][0] * a2[2][0] + a2[3][1] * a2[2][1] + a2[3][2] * a2[2][2];
void create_transformation_from_matrices(Mat4 a0, Mat4 a1, Mat4 a2)
{
f32 spC = a2[3][0] * a2[0][0] + a2[3][1] * a2[0][1] + a2[3][2] * a2[0][2];
f32 sp8 = a2[3][0] * a2[1][0] + a2[3][1] * a2[1][1] + a2[3][2] * a2[1][2];
f32 sp4 = a2[3][0] * a2[2][0] + a2[3][1] * a2[2][1] + a2[3][2] * a2[2][2];
a0[0][0] = a1[0][0] * a2[0][0] + a1[0][1] * a2[0][1] + a1[0][2] * a2[0][2];
a0[0][1] = a1[0][0] * a2[1][0] + a1[0][1] * a2[1][1] + a1[0][2] * a2[1][2];
@@ -208,7 +214,9 @@ void create_transformation_from_matrices(Mat4 a0, Mat4 a1, Mat4 a2) {
a0[2][3] = 0;
a0[3][3] = 1.0f;
}
void obj_update_pos_from_parent_transformation(Mat4 a0, struct Object *a1) {
void obj_update_pos_from_parent_transformation(Mat4 a0, struct Object *a1)
{
f32 spC = a1->oParentRelativePosX;
f32 sp8 = a1->oParentRelativePosY;
f32 sp4 = a1->oParentRelativePosZ;
@@ -217,7 +225,9 @@ void obj_update_pos_from_parent_transformation(Mat4 a0, struct Object *a1) {
a1->oPosY = spC * a0[0][1] + sp8 * a0[1][1] + sp4 * a0[2][1] + a0[3][1];
a1->oPosZ = spC * a0[0][2] + sp8 * a0[1][2] + sp4 * a0[2][2] + a0[3][2];
}
void obj_set_gfx_pos_from_pos(struct Object *obj) {
void obj_set_gfx_pos_from_pos(struct Object *obj)
{
obj->header.gfx.pos[0] = obj->oPosX;
obj->header.gfx.pos[1] = obj->oPosY;
obj->header.gfx.pos[2] = obj->oPosZ;
+4
View File
@@ -53,7 +53,11 @@
#define GRAPH_RENDER_HAS_ANIMATION (1 << 5)
struct Object *hack_allocate_mario(void);
void bhv_mario_update(void);
void create_transformation_from_matrices(Mat4 a0, Mat4 a1, Mat4 a2);
void obj_update_pos_from_parent_transformation(Mat4 a0, struct Object *a1);
void obj_set_gfx_pos_from_pos(struct Object *obj);
+42 -36
View File
@@ -16,16 +16,13 @@
* Determine if Mario is standing on a platform object, meaning that he is
* within 4 units of the floor. Set his referenced platform object accordingly.
*/
void update_mario_platform(void) {
void update_mario_platform(void)
{
struct SM64SurfaceCollisionData *floor;
UNUSED u32 unused;
f32 marioX;
f32 marioY;
f32 marioZ;
f32 floorHeight;
u32 awayFromFloor;
if (gMarioObject == NULL) {
if (gMarioObject == NULL)
{
return;
}
@@ -34,26 +31,34 @@ void update_mario_platform(void) {
// of displacement since he is considered to be far from the platform's
// axis of rotation.
marioX = gMarioObject->oPosX;
marioY = gMarioObject->oPosY;
marioZ = gMarioObject->oPosZ;
floorHeight = find_floor(marioX, marioY, marioZ, &floor);
f32 marioX = gMarioObject->oPosX;
f32 marioY = gMarioObject->oPosY;
f32 marioZ = gMarioObject->oPosZ;
f32 floorHeight = find_floor(marioX, marioY, marioZ, &floor);
if (absfx(marioY - floorHeight) < 4.0f) {
u32 awayFromFloor;
if (absfx(marioY - floorHeight) < 4.0f)
{
awayFromFloor = 0;
} else {
}
else
{
awayFromFloor = 1;
}
switch (awayFromFloor) {
switch (awayFromFloor)
{
case 1:
gMarioObject->platform = NULL;
break;
case 0:
if (floor != NULL && floor->transform != NULL) {
if (floor != NULL && floor->transform != NULL)
{
gMarioObject->platform = floor->transform;
} else {
}
else
{
gMarioObject->platform = NULL;
}
break;
@@ -63,7 +68,8 @@ void update_mario_platform(void) {
/**
* Get Mario's position and store it in x, y, and z.
*/
static void get_mario_pos(f32 *x, f32 *y, f32 *z) {
static void get_mario_pos(f32 *x, f32 *y, f32 *z)
{
*x = gMarioState->pos[0];
*y = gMarioState->pos[1];
*z = gMarioState->pos[2];
@@ -72,7 +78,8 @@ static void get_mario_pos(f32 *x, f32 *y, f32 *z) {
/**
* Set Mario's position.
*/
static void set_mario_pos(f32 x, f32 y, f32 z) {
static void set_mario_pos(f32 x, f32 y, f32 z)
{
gMarioState->pos[0] = x;
gMarioState->pos[1] = y;
gMarioState->pos[2] = z;
@@ -82,20 +89,15 @@ static void set_mario_pos(f32 x, f32 y, f32 z) {
* Apply one frame of platform rotation to Mario or an object using the given
* platform. If isMario is false, use gCurrentObject.
*/
void apply_platform_displacement(u32 isMario, struct SM64SurfaceObjectTransform *platform) {
void apply_platform_displacement(u32 isMario, struct SM64SurfaceObjectTransform *platform)
{
f32 x;
f32 y;
f32 z;
f32 platformPosX;
f32 platformPosY;
f32 platformPosZ;
Vec3f currentObjectOffset;
Vec3f relativeOffset;
Vec3f newObjectOffset;
Vec3s rotation;
UNUSED s16 unused1;
UNUSED s16 unused2;
UNUSED s16 unused3;
f32 displaceMatrix[4][4];
rotation[0] = platform->aAngleVelPitch;
@@ -114,18 +116,20 @@ void apply_platform_displacement(u32 isMario, struct SM64SurfaceObjectTransform
x += platform->aVelX;
z += platform->aVelZ;
if (rotation[0] != 0 || rotation[1] != 0 || rotation[2] != 0) {
unused1 = rotation[0];
unused2 = rotation[2];
unused3 = platform->aFaceAngleYaw;
if (rotation[0] != 0 || rotation[1] != 0 || rotation[2] != 0)
{
s16 unused1 = rotation[0];
s16 unused2 = rotation[2];
s16 unused3 = platform->aFaceAngleYaw;
if (isMario) {
if (isMario)
{
gMarioState->faceAngle[1] += rotation[1];
}
platformPosX = platform->aPosX;
platformPosY = platform->aPosY;
platformPosZ = platform->aPosZ;
f32 platformPosX = platform->aPosX;
f32 platformPosY = platform->aPosY;
f32 platformPosZ = platform->aPosZ;
currentObjectOffset[0] = x - platformPosX;
currentObjectOffset[1] = y - platformPosY;
@@ -162,8 +166,10 @@ void apply_platform_displacement(u32 isMario, struct SM64SurfaceObjectTransform
/**
* If Mario's platform is not null, apply platform displacement.
*/
void apply_mario_platform_displacement(void) {
if (gMarioObject != NULL && gMarioObject->platform != NULL) {
void apply_mario_platform_displacement(void)
{
if (gMarioObject != NULL && gMarioObject->platform != NULL)
{
apply_platform_displacement(TRUE, gMarioObject->platform);
}
}
+1
View File
@@ -5,6 +5,7 @@
#include "../include/types.h"
void update_mario_platform(void);
void apply_mario_platform_displacement(void);
#endif // PLATFORM_DISPLACEMENT_H
+299 -156
View File
@@ -17,7 +17,6 @@
#include "../../gfx_adapter.h"
#include "../mario/model.inc.h"
@@ -28,7 +27,6 @@ static Gfx *gDisplayListHead;
#define USE_SYSTEM_MALLOC
/**
* This file contains the code that processes the scene graph for rendering.
* The scene graph is responsible for drawing everything except the HUD / text boxes.
@@ -63,13 +61,20 @@ Mtx *gMatStackFixed[32];
* the animation state so a 'context switch' can be made when rendering the
* held object.
*/
struct GeoAnimState {
/*0x00*/ u8 type;
/*0x01*/ u8 enabled;
/*0x02*/ s16 frame;
/*0x04*/ f32 translationMultiplier;
/*0x08*/ u16 *attribute;
/*0x0C*/ s16 *data;
struct GeoAnimState
{
/*0x00*/
u8 type;
/*0x01*/
u8 enabled;
/*0x02*/
s16 frame;
/*0x04*/
f32 translationMultiplier;
/*0x08*/
u16 *attribute;
/*0x0C*/
s16 *data;
};
// For some reason, this is a GeoAnimState struct, but the current state consists
@@ -85,12 +90,15 @@ s16 *gCurAnimData;
struct AllocOnlyPool *gDisplayListHeap;
struct RenderModeContainer {
struct RenderModeContainer
{
u32 modes[8];
};
/* Rendermode settings for cycle 1 for all 8 layers. */
struct RenderModeContainer renderModeTable_1Cycle[2] = { { {
struct RenderModeContainer renderModeTable_1Cycle[2] = {
{
{
G_RM_OPA_SURF,
G_RM_AA_OPA_SURF,
G_RM_AA_OPA_SURF,
@@ -99,8 +107,10 @@ struct RenderModeContainer renderModeTable_1Cycle[2] = { { {
G_RM_AA_XLU_SURF,
G_RM_AA_XLU_SURF,
G_RM_AA_XLU_SURF,
} },
{ {
}
},
{
{
/* z-buffered */
G_RM_ZB_OPA_SURF,
G_RM_AA_ZB_OPA_SURF,
@@ -110,10 +120,14 @@ struct RenderModeContainer renderModeTable_1Cycle[2] = { { {
G_RM_AA_ZB_XLU_SURF,
G_RM_AA_ZB_XLU_DECAL,
G_RM_AA_ZB_XLU_INTER,
} } };
}
}
};
/* Rendermode settings for cycle 2 for all 8 layers. */
struct RenderModeContainer renderModeTable_2Cycle[2] = { { {
struct RenderModeContainer renderModeTable_2Cycle[2] = {
{
{
G_RM_OPA_SURF2,
G_RM_AA_OPA_SURF2,
G_RM_AA_OPA_SURF2,
@@ -122,8 +136,10 @@ struct RenderModeContainer renderModeTable_2Cycle[2] = { { {
G_RM_AA_XLU_SURF2,
G_RM_AA_XLU_SURF2,
G_RM_AA_XLU_SURF2,
} },
{ {
}
},
{
{
/* z-buffered */
G_RM_ZB_OPA_SURF2,
G_RM_AA_ZB_OPA_SURF2,
@@ -133,7 +149,9 @@ struct RenderModeContainer renderModeTable_2Cycle[2] = { { {
G_RM_AA_ZB_XLU_SURF2,
G_RM_AA_ZB_XLU_DECAL2,
G_RM_AA_ZB_XLU_INTER2,
} } };
}
}
};
struct GraphNodeRoot *gCurGraphNodeRoot = NULL;
struct GraphNodeMasterList *gCurGraphNodeMasterList = NULL;
@@ -149,9 +167,9 @@ LookAt lookAt;
/**
* Process a master list node.
*/
static void geo_process_master_list_sub(struct GraphNodeMasterList *node) {
static void geo_process_master_list_sub(struct GraphNodeMasterList *node)
{
struct DisplayListNode *currList;
s32 i;
s32 enableZBuffer = (node->node.flags & GRAPH_RENDER_Z_BUFFER) != 0;
// struct RenderModeContainer *modeList = &renderModeTable_1Cycle[enableZBuffer];
// struct RenderModeContainer *mode2List = &renderModeTable_2Cycle[enableZBuffer];
@@ -164,7 +182,8 @@ static void geo_process_master_list_sub(struct GraphNodeMasterList *node) {
guLookAtReflect(&lMtx, &lookAt, 0, 0, 0, /* eye */ 0, 0, 1, /* at */ 1, 0, 0 /* up */);
#endif
if (enableZBuffer != 0) {
if (enableZBuffer != 0)
{
gDPPipeSync(gDisplayListHead++);
gSPSetGeometryMode(gDisplayListHead++, G_ZBUFFER);
}
@@ -173,11 +192,15 @@ static void geo_process_master_list_sub(struct GraphNodeMasterList *node) {
// Mario ends up in the second master list for some reason.
// The first item in the list is the projection matrix that is uninitialized, so just skip it.
int xx = FALSE;
for (i = 1; i < GFX_NUM_MASTER_LISTS; i++) {
if ((currList = node->listHeads[i]) != NULL) {
for (s32 i = 1; i < GFX_NUM_MASTER_LISTS; i++)
{
if ((currList = node->listHeads[i]) != NULL)
{
// gDPSetRenderMode(gDisplayListHead++, modeList->modes[i], mode2List->modes[i]);
while (currList != NULL) {
if( !xx ) {
while (currList != NULL)
{
if (!xx)
{
xx = TRUE;
currList = currList->next;
continue;
@@ -190,7 +213,8 @@ static void geo_process_master_list_sub(struct GraphNodeMasterList *node) {
}
}
}
if (enableZBuffer != 0) {
if (enableZBuffer != 0)
{
gDPPipeSync(gDisplayListHead++);
gSPClearGeometryMode(gDisplayListHead++, G_ZBUFFER);
}
@@ -201,21 +225,25 @@ static void geo_process_master_list_sub(struct GraphNodeMasterList *node) {
* parameter. Look at the RenderModeContainer struct to see the corresponding
* render modes of layers.
*/
static void geo_append_display_list(void *displayList, s16 layer) {
static void geo_append_display_list(void *displayList, s16 layer)
{
#ifdef F3DEX_GBI_2
gSPLookAt(gDisplayListHead++, &lookAt);
#endif
if (gCurGraphNodeMasterList != 0) {
if (gCurGraphNodeMasterList != 0)
{
struct DisplayListNode *listNode =
alloc_only_pool_alloc(gDisplayListHeap, sizeof(struct DisplayListNode));
listNode->transform = gMatStackFixed[gMatStackIndex];
listNode->displayList = displayList;
listNode->next = 0;
if (gCurGraphNodeMasterList->listHeads[layer] == 0) {
if (gCurGraphNodeMasterList->listHeads[layer] == 0)
{
gCurGraphNodeMasterList->listHeads[layer] = listNode;
} else {
}
else
{
gCurGraphNodeMasterList->listTails[layer]->next = listNode;
}
gCurGraphNodeMasterList->listTails[layer] = listNode;
@@ -225,13 +253,15 @@ static void geo_append_display_list(void *displayList, s16 layer) {
/**
* Process the master list node.
*/
static void geo_process_master_list(struct GraphNodeMasterList *node) {
s32 i;
static void geo_process_master_list(struct GraphNodeMasterList *node)
{
UNUSED s32 sp1C;
if (gCurGraphNodeMasterList == NULL && node->node.children != NULL) {
if (gCurGraphNodeMasterList == NULL && node->node.children != NULL)
{
gCurGraphNodeMasterList = node;
for (i = 0; i < GFX_NUM_MASTER_LISTS; i++) {
for (s32 i = 0; i < GFX_NUM_MASTER_LISTS; i++)
{
node->listHeads[i] = NULL;
}
geo_process_node_and_siblings(node->node.children);
@@ -243,8 +273,10 @@ static void geo_process_master_list(struct GraphNodeMasterList *node) {
/**
* Process an orthographic projection node.
*/
static void geo_process_ortho_projection(struct GraphNodeOrthoProjection *node) {
if (node->node.children != NULL) {
static void geo_process_ortho_projection(struct GraphNodeOrthoProjection *node)
{
if (node->node.children != NULL)
{
Mtx *mtx = alloc_display_list(sizeof(*mtx));
// f32 left = (gCurGraphNodeRoot->x - gCurGraphNodeRoot->width) / 2.0f * node->scale;
// f32 right = (gCurGraphNodeRoot->x + gCurGraphNodeRoot->width) / 2.0f * node->scale;
@@ -262,11 +294,14 @@ static void geo_process_ortho_projection(struct GraphNodeOrthoProjection *node)
/**
* Process a perspective projection node.
*/
static void geo_process_perspective(struct GraphNodePerspective *node) {
if (node->fnNode.func != NULL) {
static void geo_process_perspective(struct GraphNodePerspective *node)
{
if (node->fnNode.func != NULL)
{
node->fnNode.func(GEO_CONTEXT_RENDER, &node->fnNode.node, gMatStack[gMatStackIndex]);
}
if (node->fnNode.node.children != NULL) {
if (node->fnNode.node.children != NULL)
{
// u16 perspNorm;
Mtx *mtx = alloc_display_list(sizeof(*mtx));
@@ -293,7 +328,8 @@ static void geo_process_perspective(struct GraphNodePerspective *node) {
* of this node are only processed if that distance is within the render
* range of this node.
*/
static void geo_process_level_of_detail(struct GraphNodeLevelOfDetail *node) {
static void geo_process_level_of_detail(struct GraphNodeLevelOfDetail *node)
{
#ifdef GBI_FLOATS
Mtx *mtx = gMatStackFixed[gMatStackIndex];
s16 distanceFromCam = (s32) - mtx->m[3][2]; // z-component of the translation column
@@ -309,8 +345,10 @@ static void geo_process_level_of_detail(struct GraphNodeLevelOfDetail *node) {
distanceFromCam = 0;
#endif
if (node->minDistance <= distanceFromCam && distanceFromCam < node->maxDistance) {
if (node->node.children != 0) {
if (node->minDistance <= distanceFromCam && distanceFromCam < node->maxDistance)
{
if (node->node.children != 0)
{
geo_process_node_and_siblings(node->node.children);
}
}
@@ -321,17 +359,20 @@ static void geo_process_level_of_detail(struct GraphNodeLevelOfDetail *node) {
* if it is 0, and among the node's children, only the selected child is
* processed next.
*/
static void geo_process_switch(struct GraphNodeSwitchCase *node) {
static void geo_process_switch(struct GraphNodeSwitchCase *node)
{
struct GraphNode *selectedChild = node->fnNode.node.children;
s32 i;
if (node->fnNode.func != NULL) {
if (node->fnNode.func != NULL)
{
node->fnNode.func(GEO_CONTEXT_RENDER, &node->fnNode.node, gMatStack[gMatStackIndex]);
}
for (i = 0; selectedChild != NULL && node->selectedCase > i; i++) {
for (s32 i = 0; selectedChild != NULL && node->selectedCase > i; i++)
{
selectedChild = selectedChild->next;
}
if (selectedChild != NULL) {
if (selectedChild != NULL)
{
geo_process_node_and_siblings(selectedChild);
}
}
@@ -339,12 +380,14 @@ static void geo_process_switch(struct GraphNodeSwitchCase *node) {
/**
* Process a camera node.
*/
static void geo_process_camera(struct GraphNodeCamera *node) {
static void geo_process_camera(struct GraphNodeCamera *node)
{
Mat4 cameraTransform;
Mtx *rollMtx = alloc_display_list(sizeof(*rollMtx));
Mtx *mtx = alloc_display_list(sizeof(*mtx));
if (node->fnNode.func != NULL) {
if (node->fnNode.func != NULL)
{
node->fnNode.func(GEO_CONTEXT_RENDER, &node->fnNode.node, gMatStack[gMatStackIndex]);
}
mtxf_rotate_xy(rollMtx, node->rollScreen);
@@ -356,7 +399,8 @@ static void geo_process_camera(struct GraphNodeCamera *node) {
gMatStackIndex++;
mtxf_to_mtx(mtx, gMatStack[gMatStackIndex]);
gMatStackFixed[gMatStackIndex] = mtx;
if (node->fnNode.node.children != 0) {
if (node->fnNode.node.children != 0)
{
gCurGraphNodeCamera = node;
node->matrixPtr = &gMatStack[gMatStackIndex];
geo_process_node_and_siblings(node->fnNode.node.children);
@@ -371,7 +415,8 @@ static void geo_process_camera(struct GraphNodeCamera *node) {
* the float and fixed point matrix stacks.
* For the rest it acts as a normal display list node.
*/
static void geo_process_translation_rotation(struct GraphNodeTranslationRotation *node) {
static void geo_process_translation_rotation(struct GraphNodeTranslationRotation *node)
{
Mat4 mtxf;
Vec3f translation;
Mtx *mtx = alloc_display_list(sizeof(*mtx));
@@ -382,10 +427,12 @@ static void geo_process_translation_rotation(struct GraphNodeTranslationRotation
gMatStackIndex++;
mtxf_to_mtx(mtx, gMatStack[gMatStackIndex]);
gMatStackFixed[gMatStackIndex] = mtx;
if (node->displayList != NULL) {
if (node->displayList != NULL)
{
geo_append_display_list(node->displayList, node->node.flags >> 8);
}
if (node->node.children != NULL) {
if (node->node.children != NULL)
{
geo_process_node_and_siblings(node->node.children);
}
gMatStackIndex--;
@@ -396,7 +443,8 @@ static void geo_process_translation_rotation(struct GraphNodeTranslationRotation
* translation is created and pushed on both the float and fixed point matrix stacks.
* For the rest it acts as a normal display list node.
*/
static void geo_process_translation(struct GraphNodeTranslation *node) {
static void geo_process_translation(struct GraphNodeTranslation *node)
{
Mat4 mtxf;
Vec3f translation;
Mtx *mtx = alloc_display_list(sizeof(*mtx));
@@ -407,10 +455,12 @@ static void geo_process_translation(struct GraphNodeTranslation *node) {
gMatStackIndex++;
mtxf_to_mtx(mtx, gMatStack[gMatStackIndex]);
gMatStackFixed[gMatStackIndex] = mtx;
if (node->displayList != NULL) {
if (node->displayList != NULL)
{
geo_append_display_list(node->displayList, node->node.flags >> 8);
}
if (node->node.children != NULL) {
if (node->node.children != NULL)
{
geo_process_node_and_siblings(node->node.children);
}
gMatStackIndex--;
@@ -421,7 +471,8 @@ static void geo_process_translation(struct GraphNodeTranslation *node) {
* rotation is created and pushed on both the float and fixed point matrix stacks.
* For the rest it acts as a normal display list node.
*/
static void geo_process_rotation(struct GraphNodeRotation *node) {
static void geo_process_rotation(struct GraphNodeRotation *node)
{
Mat4 mtxf;
Mtx *mtx = alloc_display_list(sizeof(*mtx));
@@ -430,10 +481,12 @@ static void geo_process_rotation(struct GraphNodeRotation *node) {
gMatStackIndex++;
mtxf_to_mtx(mtx, gMatStack[gMatStackIndex]);
gMatStackFixed[gMatStackIndex] = mtx;
if (node->displayList != NULL) {
if (node->displayList != NULL)
{
geo_append_display_list(node->displayList, node->node.flags >> 8);
}
if (node->node.children != NULL) {
if (node->node.children != NULL)
{
geo_process_node_and_siblings(node->node.children);
}
gMatStackIndex--;
@@ -444,7 +497,8 @@ static void geo_process_rotation(struct GraphNodeRotation *node) {
* scale is created and pushed on both the float and fixed point matrix stacks.
* For the rest it acts as a normal display list node.
*/
static void geo_process_scale(struct GraphNodeScale *node) {
static void geo_process_scale(struct GraphNodeScale *node)
{
UNUSED Mat4 transform;
Vec3f scaleVec;
Mtx *mtx = alloc_display_list(sizeof(*mtx));
@@ -454,10 +508,12 @@ static void geo_process_scale(struct GraphNodeScale *node) {
gMatStackIndex++;
mtxf_to_mtx(mtx, gMatStack[gMatStackIndex]);
gMatStackFixed[gMatStackIndex] = mtx;
if (node->displayList != NULL) {
if (node->displayList != NULL)
{
geo_append_display_list(node->displayList, node->node.flags >> 8);
}
if (node->node.children != NULL) {
if (node->node.children != NULL)
{
geo_process_node_and_siblings(node->node.children);
}
gMatStackIndex--;
@@ -469,7 +525,8 @@ static void geo_process_scale(struct GraphNodeScale *node) {
* point matrix stacks.
* For the rest it acts as a normal display list node.
*/
static void geo_process_billboard(struct GraphNodeBillboard *node) {
static void geo_process_billboard(struct GraphNodeBillboard *node)
{
Vec3f translation;
Mtx *mtx = alloc_display_list(sizeof(*mtx));
@@ -477,20 +534,25 @@ static void geo_process_billboard(struct GraphNodeBillboard *node) {
vec3s_to_vec3f(translation, node->translation);
mtxf_billboard(gMatStack[gMatStackIndex], gMatStack[gMatStackIndex - 1], translation,
gCurGraphNodeCamera->roll);
if (gCurGraphNodeHeldObject != NULL) {
if (gCurGraphNodeHeldObject != NULL)
{
mtxf_scale_vec3f(gMatStack[gMatStackIndex], gMatStack[gMatStackIndex],
gCurGraphNodeHeldObject->objNode->header.gfx.scale);
} else if (gCurGraphNodeObject != NULL) {
}
else if (gCurGraphNodeObject != NULL)
{
mtxf_scale_vec3f(gMatStack[gMatStackIndex], gMatStack[gMatStackIndex],
gCurGraphNodeObject->scale);
}
mtxf_to_mtx(mtx, gMatStack[gMatStackIndex]);
gMatStackFixed[gMatStackIndex] = mtx;
if (node->displayList != NULL) {
if (node->displayList != NULL)
{
geo_append_display_list(node->displayList, node->node.flags >> 8);
}
if (node->node.children != NULL) {
if (node->node.children != NULL)
{
geo_process_node_and_siblings(node->node.children);
}
gMatStackIndex--;
@@ -501,11 +563,14 @@ static void geo_process_billboard(struct GraphNodeBillboard *node) {
* a transformation on the stack, so all transformations are inherited from the
* parent node. It processes its children if it has them.
*/
static void geo_process_display_list(struct GraphNodeDisplayList *node) {
if (node->displayList != NULL) {
static void geo_process_display_list(struct GraphNodeDisplayList *node)
{
if (node->displayList != NULL)
{
geo_append_display_list(node->displayList, node->node.flags >> 8);
}
if (node->node.children != NULL) {
if (node->node.children != NULL)
{
geo_process_node_and_siblings(node->node.children);
}
}
@@ -514,16 +579,20 @@ static void geo_process_display_list(struct GraphNodeDisplayList *node) {
* Process a generated list. Instead of storing a pointer to a display list,
* the list is generated on the fly by a function.
*/
static void geo_process_generated_list(struct GraphNodeGenerated *node) {
if (node->fnNode.func != NULL) {
static void geo_process_generated_list(struct GraphNodeGenerated *node)
{
if (node->fnNode.func != NULL)
{
Gfx *list = node->fnNode.func(GEO_CONTEXT_RENDER, &node->fnNode.node,
(struct AllocOnlyPool *)gMatStack[gMatStackIndex]);
if (list != NULL) {
geo_append_display_list((void *) VIRTUAL_TO_PHYSICAL(list), node->fnNode.node.flags >> 8);
if (list != NULL)
{
geo_append_display_list(VIRTUAL_TO_PHYSICAL(list), node->fnNode.node.flags >> 8);
}
}
if (node->fnNode.node.children != NULL) {
if (node->fnNode.node.children != NULL)
{
geo_process_node_and_siblings(node->fnNode.node.children);
}
}
@@ -533,16 +602,21 @@ static void geo_process_generated_list(struct GraphNodeGenerated *node) {
* the function of the node. If that function is null or returns null, a black
* rectangle is drawn instead.
*/
static void geo_process_background(struct GraphNodeBackground *node) {
static void geo_process_background(struct GraphNodeBackground *node)
{
Gfx *list = NULL;
if (node->fnNode.func != NULL) {
if (node->fnNode.func != NULL)
{
list = node->fnNode.func(GEO_CONTEXT_RENDER, &node->fnNode.node,
(struct AllocOnlyPool *)gMatStack[gMatStackIndex]);
}
if (list != NULL) {
geo_append_display_list((void *) VIRTUAL_TO_PHYSICAL(list), node->fnNode.node.flags >> 8);
} else if (gCurGraphNodeMasterList != NULL) {
if (list != NULL)
{
geo_append_display_list(VIRTUAL_TO_PHYSICAL(list), node->fnNode.node.flags >> 8);
}
else if (gCurGraphNodeMasterList != NULL)
{
#ifndef F3DEX_GBI_2E
Gfx *gfxStart = alloc_display_list(sizeof(Gfx) * 7);
#else
@@ -559,9 +633,10 @@ static void geo_process_background(struct GraphNodeBackground *node) {
gDPSetCycleType(gfx++, G_CYC_1CYCLE);
gSPEndDisplayList(gfx++);
geo_append_display_list((void *) VIRTUAL_TO_PHYSICAL(gfxStart), 0);
geo_append_display_list(VIRTUAL_TO_PHYSICAL(gfxStart), 0);
}
if (node->fnNode.node.children != NULL) {
if (node->fnNode.node.children != NULL)
{
geo_process_node_and_siblings(node->fnNode.node.children);
}
}
@@ -570,7 +645,8 @@ static void geo_process_background(struct GraphNodeBackground *node) {
* Render an animated part. The current animation state is not part of the node
* but set in global variables. If an animated part is skipped, everything afterwards desyncs.
*/
static void geo_process_animated_part(struct GraphNodeAnimatedPart *node) {
static void geo_process_animated_part(struct GraphNodeAnimatedPart *node)
{
Mat4 matrix;
Vec3s rotation;
Vec3f translation;
@@ -578,7 +654,8 @@ static void geo_process_animated_part(struct GraphNodeAnimatedPart *node) {
vec3s_copy(rotation, gVec3sZero);
vec3f_set(translation, node->translation[0], node->translation[1], node->translation[2]);
if (gCurAnimType == ANIM_TYPE_TRANSLATION) {
if (gCurAnimType == ANIM_TYPE_TRANSLATION)
{
translation[0] += gCurAnimData[retrieve_animation_index(gCurrAnimFrame, &gCurrAnimAttribute)]
* gCurAnimTranslationMultiplier;
translation[1] += gCurAnimData[retrieve_animation_index(gCurrAnimFrame, &gCurrAnimAttribute)]
@@ -586,8 +663,11 @@ static void geo_process_animated_part(struct GraphNodeAnimatedPart *node) {
translation[2] += gCurAnimData[retrieve_animation_index(gCurrAnimFrame, &gCurrAnimAttribute)]
* gCurAnimTranslationMultiplier;
gCurAnimType = ANIM_TYPE_ROTATION;
} else {
if (gCurAnimType == ANIM_TYPE_LATERAL_TRANSLATION) {
}
else
{
if (gCurAnimType == ANIM_TYPE_LATERAL_TRANSLATION)
{
translation[0] +=
gCurAnimData[retrieve_animation_index(gCurrAnimFrame, &gCurrAnimAttribute)]
* gCurAnimTranslationMultiplier;
@@ -596,22 +676,28 @@ static void geo_process_animated_part(struct GraphNodeAnimatedPart *node) {
gCurAnimData[retrieve_animation_index(gCurrAnimFrame, &gCurrAnimAttribute)]
* gCurAnimTranslationMultiplier;
gCurAnimType = ANIM_TYPE_ROTATION;
} else {
if (gCurAnimType == ANIM_TYPE_VERTICAL_TRANSLATION) {
}
else
{
if (gCurAnimType == ANIM_TYPE_VERTICAL_TRANSLATION)
{
gCurrAnimAttribute += 2;
translation[1] +=
gCurAnimData[retrieve_animation_index(gCurrAnimFrame, &gCurrAnimAttribute)]
* gCurAnimTranslationMultiplier;
gCurrAnimAttribute += 2;
gCurAnimType = ANIM_TYPE_ROTATION;
} else if (gCurAnimType == ANIM_TYPE_NO_TRANSLATION) {
}
else if (gCurAnimType == ANIM_TYPE_NO_TRANSLATION)
{
gCurrAnimAttribute += 6;
gCurAnimType = ANIM_TYPE_ROTATION;
}
}
}
if (gCurAnimType == ANIM_TYPE_ROTATION) {
if (gCurAnimType == ANIM_TYPE_ROTATION)
{
rotation[0] = gCurAnimData[retrieve_animation_index(gCurrAnimFrame, &gCurrAnimAttribute)];
rotation[1] = gCurAnimData[retrieve_animation_index(gCurrAnimFrame, &gCurrAnimAttribute)];
rotation[2] = gCurAnimData[retrieve_animation_index(gCurrAnimFrame, &gCurrAnimAttribute)];
@@ -621,10 +707,12 @@ static void geo_process_animated_part(struct GraphNodeAnimatedPart *node) {
gMatStackIndex++;
mtxf_to_mtx(matrixPtr, gMatStack[gMatStackIndex]);
gMatStackFixed[gMatStackIndex] = matrixPtr;
if (node->displayList != NULL) {
if (node->displayList != NULL)
{
geo_append_display_list(node->displayList, node->node.flags >> 8);
}
if (node->node.children != NULL) {
if (node->node.children != NULL)
{
geo_process_node_and_siblings(node->node.children);
}
gMatStackIndex--;
@@ -634,31 +722,43 @@ static void geo_process_animated_part(struct GraphNodeAnimatedPart *node) {
* Initialize the animation-related global variables for the currently drawn
* object's animation.
*/
void geo_set_animation_globals(struct AnimInfo *node, s32 hasAnimation) {
void geo_set_animation_globals(struct AnimInfo *node, s32 hasAnimation)
{
struct Animation *anim = node->curAnim;
if (hasAnimation) {
if (hasAnimation)
{
node->animFrame = geo_update_animation_frame(node, &node->animFrameAccelAssist);
}
node->animTimer = gAreaUpdateCounter;
if (anim->flags & ANIM_FLAG_HOR_TRANS) {
if (anim->flags & ANIM_FLAG_HOR_TRANS)
{
gCurAnimType = ANIM_TYPE_VERTICAL_TRANSLATION;
} else if (anim->flags & ANIM_FLAG_VERT_TRANS) {
}
else if (anim->flags & ANIM_FLAG_VERT_TRANS)
{
gCurAnimType = ANIM_TYPE_LATERAL_TRANSLATION;
} else if (anim->flags & ANIM_FLAG_6) {
}
else if (anim->flags & ANIM_FLAG_6)
{
gCurAnimType = ANIM_TYPE_NO_TRANSLATION;
} else {
}
else
{
gCurAnimType = ANIM_TYPE_TRANSLATION;
}
gCurrAnimFrame = node->animFrame;
gCurAnimEnabled = (anim->flags & ANIM_FLAG_5) == 0;
gCurrAnimAttribute = segmented_to_virtual((void *) anim->index);
gCurAnimData = segmented_to_virtual((void *) anim->values);
gCurrAnimAttribute = segmented_to_virtual(anim->index);
gCurAnimData = segmented_to_virtual(anim->values);
if (anim->animYTransDivisor == 0) {
if (anim->animYTransDivisor == 0)
{
gCurAnimTranslationMultiplier = 1.0f;
} else {
}
else
{
gCurAnimTranslationMultiplier = (f32)node->animYTrans / (f32)anim->animYTransDivisor;
}
}
@@ -668,7 +768,8 @@ void geo_set_animation_globals(struct AnimInfo *node, s32 hasAnimation) {
* translation of the first animated component and rotated according to
* the floor below it.
*/
static void geo_process_shadow(struct GraphNodeShadow *node) {
static void geo_process_shadow(struct GraphNodeShadow *node)
{
// Gfx *shadowList;
// Mat4 mtxf;
// Vec3f shadowPos;
@@ -772,24 +873,24 @@ static void geo_process_shadow(struct GraphNodeShadow *node) {
*
* Since (0,0,0) is unaffected by rotation, columns 0, 1 and 2 are ignored.
*/
static s32 obj_is_in_view(struct GraphNodeObject *node, Mat4 matrix) {
static s32 obj_is_in_view(struct GraphNodeObject *node, Mat4 matrix)
{
s16 cullingRadius;
s16 halfFov; // half of the fov in in-game angle units instead of degrees
struct GraphNode *geo;
f32 hScreenEdge;
// half of the fov in in-game angle units instead of degrees
if (node->node.flags & GRAPH_RENDER_INVISIBLE) {
if (node->node.flags & GRAPH_RENDER_INVISIBLE)
{
return FALSE;
}
geo = node->sharedChild;
struct GraphNode *geo = node->sharedChild;
// ! @bug The aspect ratio is not accounted for. When the fov value is 45,
// the horizontal effective fov is actually 60 degrees, so you can see objects
// visibly pop in or out at the edge of the screen.
halfFov = (gCurGraphNodeCamFrustum->fov / 2.0f + 1.0f) * 32768.0f / 180.0f + 0.5f;
s16 halfFov = (gCurGraphNodeCamFrustum->fov / 2.0f + 1.0f) * 32768.0f / 180.0f + 0.5f;
hScreenEdge = -matrix[3][2] * sins(halfFov) / coss(halfFov);
f32 hScreenEdge = -matrix[3][2] * sins(halfFov) / coss(halfFov);
// -matrix[3][2] is the depth, which gets multiplied by tan(halfFov) to get
// the amount of units between the center of the screen and the horizontal edge
// given the distance from the object to the camera.
@@ -800,15 +901,19 @@ static s32 obj_is_in_view(struct GraphNodeObject *node, Mat4 matrix) {
hScreenEdge *= GFX_DIMENSIONS_ASPECT_RATIO;
#endif
if (geo != NULL && geo->type == GRAPH_NODE_TYPE_CULLING_RADIUS) {
if (geo != NULL && geo->type == GRAPH_NODE_TYPE_CULLING_RADIUS)
{
cullingRadius =
(f32)((struct GraphNodeCullingRadius *)geo)->cullingRadius; //! Why is there a f32 cast?
} else {
}
else
{
cullingRadius = 300;
}
// Don't render if the object is close to or behind the camera
if (matrix[3][2] > -100.0f + cullingRadius) {
if (matrix[3][2] > -100.0f + cullingRadius)
{
return FALSE;
}
@@ -816,15 +921,18 @@ static s32 obj_is_in_view(struct GraphNodeObject *node, Mat4 matrix) {
// makes PU travel safe when the camera is locked on the main map.
// If Mario were rendered with a depth over 65536 it would cause overflow
// when converting the transformation matrix to a fixed point matrix.
if (matrix[3][2] < -20000.0f - cullingRadius) {
if (matrix[3][2] < -20000.0f - cullingRadius)
{
return FALSE;
}
// Check whether the object is horizontally in view
if (matrix[3][0] > hScreenEdge + cullingRadius) {
if (matrix[3][0] > hScreenEdge + cullingRadius)
{
return FALSE;
}
if (matrix[3][0] < -hScreenEdge - cullingRadius) {
if (matrix[3][0] < -hScreenEdge - cullingRadius)
{
return FALSE;
}
return TRUE;
@@ -833,18 +941,25 @@ static s32 obj_is_in_view(struct GraphNodeObject *node, Mat4 matrix) {
/**
* Process an object node.
*/
static void geo_process_object(struct Object *node) {
static void geo_process_object(struct Object *node)
{
Mat4 mtxf;
s32 hasAnimation = (node->header.gfx.node.flags & GRAPH_RENDER_HAS_ANIMATION) != 0;
if (node->header.gfx.areaIndex == gCurGraphNodeRoot->areaIndex) {
if (node->header.gfx.throwMatrix != NULL) {
if (node->header.gfx.areaIndex == gCurGraphNodeRoot->areaIndex)
{
if (node->header.gfx.throwMatrix != NULL)
{
mtxf_mul(gMatStack[gMatStackIndex + 1], *node->header.gfx.throwMatrix,
gMatStack[gMatStackIndex]);
} else if (node->header.gfx.node.flags & GRAPH_RENDER_BILLBOARD) {
}
else if (node->header.gfx.node.flags & GRAPH_RENDER_BILLBOARD)
{
mtxf_billboard(gMatStack[gMatStackIndex + 1], gMatStack[gMatStackIndex],
node->header.gfx.pos, gCurGraphNodeCamera->roll);
} else {
}
else
{
mtxf_rotate_zxy_and_translate(mtxf, node->header.gfx.pos, node->header.gfx.angle);
mtxf_mul(gMatStack[gMatStackIndex + 1], mtxf, gMatStack[gMatStackIndex]);
}
@@ -857,22 +972,26 @@ static void geo_process_object(struct Object *node) {
node->header.gfx.cameraToObject[2] = gMatStack[gMatStackIndex][3][2];
// FIXME: correct types
if (node->header.gfx.animInfo.curAnim != NULL) {
if (node->header.gfx.animInfo.curAnim != NULL)
{
geo_set_animation_globals(&node->header.gfx.animInfo, hasAnimation);
}
if (obj_is_in_view(&node->header.gfx, gMatStack[gMatStackIndex])) {
if (obj_is_in_view(&node->header.gfx, gMatStack[gMatStackIndex]))
{
Mtx *mtx = alloc_display_list(sizeof(*mtx));
mtxf_to_mtx(mtx, gMatStack[gMatStackIndex]);
gMatStackFixed[gMatStackIndex] = mtx;
if (node->header.gfx.sharedChild != NULL) {
if (node->header.gfx.sharedChild != NULL)
{
gCurGraphNodeObject = (struct GraphNodeObject *)node;
node->header.gfx.sharedChild->parent = &node->header.gfx.node;
geo_process_node_and_siblings(node->header.gfx.sharedChild);
node->header.gfx.sharedChild->parent = NULL;
gCurGraphNodeObject = NULL;
}
if (node->header.gfx.node.children != NULL) {
if (node->header.gfx.node.children != NULL)
{
geo_process_node_and_siblings(node->header.gfx.node.children);
}
}
@@ -888,13 +1007,16 @@ static void geo_process_object(struct Object *node) {
* the subtree rooted at 'sharedChild' and processes the subtree, after which the
* actual children are be processed. (in practice they are null though)
*/
static void geo_process_object_parent(struct GraphNodeObjectParent *node) {
if (node->sharedChild != NULL) {
static void geo_process_object_parent(struct GraphNodeObjectParent *node)
{
if (node->sharedChild != NULL)
{
node->sharedChild->parent = (struct GraphNode *)node;
geo_process_node_and_siblings(node->sharedChild);
node->sharedChild->parent = NULL;
}
if (node->node.children != NULL) {
if (node->node.children != NULL)
{
geo_process_node_and_siblings(node->node.children);
}
}
@@ -902,7 +1024,8 @@ static void geo_process_object_parent(struct GraphNodeObjectParent *node) {
/**
* Process a held object node.
*/
void geo_process_held_object(struct GraphNodeHeldObject *node) {
void geo_process_held_object(struct GraphNodeHeldObject *node)
{
Mat4 mat;
Vec3f translation;
Mtx *mtx = alloc_display_list(sizeof(*mtx));
@@ -911,10 +1034,12 @@ void geo_process_held_object(struct GraphNodeHeldObject *node) {
gSPLookAt(gDisplayListHead++, &lookAt);
#endif
if (node->fnNode.func != NULL) {
if (node->fnNode.func != NULL)
{
node->fnNode.func(GEO_CONTEXT_RENDER, &node->fnNode.node, gMatStack[gMatStackIndex]);
}
if (node->objNode != NULL && node->objNode->header.gfx.sharedChild != NULL) {
if (node->objNode != NULL && node->objNode->header.gfx.sharedChild != NULL)
{
s32 hasAnimation = (node->objNode->header.gfx.node.flags & GRAPH_RENDER_HAS_ANIMATION) != 0;
translation[0] = node->translation[0] / 4.0f;
@@ -929,7 +1054,8 @@ void geo_process_held_object(struct GraphNodeHeldObject *node) {
mtxf_mul(gMatStack[gMatStackIndex + 1], mat, gMatStack[gMatStackIndex + 1]);
mtxf_scale_vec3f(gMatStack[gMatStackIndex + 1], gMatStack[gMatStackIndex + 1],
node->objNode->header.gfx.scale);
if (node->fnNode.func != NULL) {
if (node->fnNode.func != NULL)
{
node->fnNode.func(GEO_CONTEXT_HELD_OBJ, &node->fnNode.node,
(struct AllocOnlyPool *)gMatStack[gMatStackIndex + 1]);
}
@@ -944,7 +1070,8 @@ void geo_process_held_object(struct GraphNodeHeldObject *node) {
gGeoTempState.data = gCurAnimData;
gCurAnimType = 0;
gCurGraphNodeHeldObject = (void *)node;
if (node->objNode->header.gfx.animInfo.curAnim != NULL) {
if (node->objNode->header.gfx.animInfo.curAnim != NULL)
{
geo_set_animation_globals(&node->objNode->header.gfx.animInfo, hasAnimation);
}
@@ -959,7 +1086,8 @@ void geo_process_held_object(struct GraphNodeHeldObject *node) {
gMatStackIndex--;
}
if (node->fnNode.node.children != NULL) {
if (node->fnNode.node.children != NULL)
{
geo_process_node_and_siblings(node->fnNode.node.children);
}
}
@@ -967,8 +1095,10 @@ void geo_process_held_object(struct GraphNodeHeldObject *node) {
/**
* Processes the children of the given GraphNode if it has any
*/
void geo_try_process_children(struct GraphNode *node) {
if (node->children != NULL) {
void geo_try_process_children(struct GraphNode *node)
{
if (node->children != NULL)
{
geo_process_node_and_siblings(node->children);
}
}
@@ -978,23 +1108,31 @@ void geo_try_process_children(struct GraphNode *node) {
* The first argument is the start node, and all its siblings will
* be iterated over.
*/
void geo_process_node_and_siblings(struct GraphNode *firstNode) {
void geo_process_node_and_siblings(struct GraphNode *firstNode)
{
s16 iterateChildren = TRUE;
struct GraphNode *curGraphNode = firstNode;
struct GraphNode *parent = curGraphNode->parent;
// In the case of a switch node, exactly one of the children of the node is
// processed instead of all children like usual
if (parent != NULL) {
iterateChildren = (parent->type != GRAPH_NODE_TYPE_SWITCH_CASE);
if (parent != NULL)
{
iterateChildren = parent->type != GRAPH_NODE_TYPE_SWITCH_CASE;
}
do {
if (curGraphNode->flags & GRAPH_RENDER_ACTIVE) {
if (curGraphNode->flags & GRAPH_RENDER_CHILDREN_FIRST) {
do
{
if (curGraphNode->flags & GRAPH_RENDER_ACTIVE)
{
if (curGraphNode->flags & GRAPH_RENDER_CHILDREN_FIRST)
{
geo_try_process_children(curGraphNode);
} else {
switch (curGraphNode->type) {
}
else
{
switch (curGraphNode->type)
{
case GRAPH_NODE_TYPE_ORTHO_PROJECTION:
geo_process_ortho_projection((struct GraphNodeOrthoProjection *)curGraphNode);
break;
@@ -1054,16 +1192,20 @@ void geo_process_node_and_siblings(struct GraphNode *firstNode) {
geo_process_held_object((struct GraphNodeHeldObject *)curGraphNode);
break;
default:
geo_try_process_children((struct GraphNode *) curGraphNode);
geo_try_process_children(curGraphNode);
break;
}
}
} else {
if (curGraphNode->type == GRAPH_NODE_TYPE_OBJECT) {
}
else
{
if (curGraphNode->type == GRAPH_NODE_TYPE_OBJECT)
{
((struct GraphNodeObject *)curGraphNode)->throwMatrix = NULL;
}
}
} while (iterateChildren && (curGraphNode = curGraphNode->next) != firstNode);
}
while (iterateChildren && (curGraphNode = curGraphNode->next) != firstNode);
}
/**
@@ -1127,10 +1269,8 @@ void geo_process_root_hack_single_node(struct GraphNode *node)
display_list_pool_reset();
Mtx *initialMatrix;
gDisplayListHeap = alloc_only_pool_init();
initialMatrix = alloc_display_list(sizeof(*initialMatrix));
Mtx *initialMatrix = alloc_display_list(sizeof(*initialMatrix));
gMatStackIndex = 0;
gCurAnimType = 0;
@@ -1142,12 +1282,14 @@ void geo_process_root_hack_single_node(struct GraphNode *node)
// Hacked in from geo_proces_object since we only have Mario
//geo_process_object( node );
if (gMarioObject->header.gfx.throwMatrix != NULL) {
if (gMarioObject->header.gfx.throwMatrix != NULL)
{
mtxf_mul(gMatStack[gMatStackIndex + 1], *gMarioObject->header.gfx.throwMatrix, gMatStack[gMatStackIndex]);
mtxf_scale_vec3f(gMatStack[gMatStackIndex + 1], gMatStack[gMatStackIndex + 1], gMarioObject->header.gfx.scale);
gMarioObject->header.gfx.throwMatrix = &gMatStack[++gMatStackIndex];
}
else {
else
{
Mat4 identity, scale, rotTran;
mtxf_identity(identity);
mtxf_scale_vec3f(scale, identity, gMarioObject->header.gfx.scale);
@@ -1157,7 +1299,8 @@ void geo_process_root_hack_single_node(struct GraphNode *node)
geo_set_animation_globals(&gMarioObject->header.gfx.animInfo, 1);
gCurGraphNodeRoot = (struct GraphNodeRoot *)node;
if (node->children != NULL) {
if (node->children != NULL)
{
geo_process_node_and_siblings(node->children);
}
gCurGraphNodeRoot = NULL;
+1
View File
@@ -27,6 +27,7 @@ extern struct GraphNodeHeldObject *gCurGraphNodeHeldObject;
#define ANIM_TYPE_ROTATION 5
void geo_process_node_and_siblings(struct GraphNode *firstNode);
//void geo_process_root(struct GraphNodeRoot *node, Vp *b, Vp *c, s32 clearColor);
void geo_process_root_hack_single_node(struct GraphNode *node);
+37 -11
View File
@@ -42,7 +42,8 @@ struct SaveFile
struct SaveBlockSignature signature;
};
enum SaveFileIndex {
enum SaveFileIndex
{
SAVE_FILE_A,
SAVE_FILE_B,
SAVE_FILE_C,
@@ -120,12 +121,18 @@ extern s8 gLevelToCourseNumTable[];
// Variable for setting a warp checkpoint.
// possibly a WarpDest struct where arg is a union. TODO: Check?
struct WarpCheckpoint {
/*0x00*/ u8 actNum;
/*0x01*/ u8 courseNum;
/*0x02*/ u8 levelID;
/*0x03*/ u8 areaNum;
/*0x04*/ u8 warpNode;
struct WarpCheckpoint
{
/*0x00*/
u8 actNum;
/*0x01*/
u8 courseNum;
/*0x02*/
u8 levelID;
/*0x03*/
u8 areaNum;
/*0x04*/
u8 warpNode;
};
extern struct WarpCheckpoint gWarpCheckpoint;
@@ -134,38 +141,57 @@ extern s8 gMainMenuDataModified;
extern s8 gSaveFileModified;
void save_file_do_save(s32 fileIndex);
void save_file_erase(s32 fileIndex);
BAD_RETURN (s32) save_file_copy(s32 srcFileIndex, s32 destFileIndex);
void save_file_load_all(void);
void save_file_reload(void);
void save_file_collect_star_or_key(s16 coinScore, s16 starIndex);
s32 save_file_exists(s32 fileIndex);
u32 save_file_get_max_coin_score(s32 courseIndex);
s32 save_file_get_course_star_count(s32 fileIndex, s32 courseIndex);
//s32 save_file_get_total_star_count(s32 fileIndex, s32 minCourse, s32 maxCourse);
//void save_file_set_flags(u32 flags);
//void save_file_clear_flags(u32 flags);
//u32 save_file_get_flags(void);
u32 save_file_get_star_flags(s32 fileIndex, s32 courseIndex);
void save_file_set_star_flags(s32 fileIndex, s32 courseIndex, u32 starFlags);
s32 save_file_get_course_coin_score(s32 fileIndex, s32 courseIndex);
s32 save_file_is_cannon_unlocked(void);
void save_file_set_cannon_unlocked(void);
void save_file_set_cap_pos(s16 x, s16 y, s16 z);
s32 save_file_get_cap_pos(Vec3s capPos);
void save_file_set_sound_mode(u16 mode);
u16 save_file_get_sound_mode(void);
void save_file_move_cap_to_default_location(void);
void disable_warp_checkpoint(void);
void check_if_should_set_warp_checkpoint(struct WarpNode *warpNode);
s32 check_warp_checkpoint(struct WarpNode *warpNode);
#ifdef VERSION_EU
enum EuLanguages {
LANGUAGE_ENGLISH,
LANGUAGE_FRENCH,
LANGUAGE_GERMAN
enum EuLanguages
{
LANGUAGE_ENGLISH, LANGUAGE_FRENCH, LANGUAGE_GERMAN
};
void eu_set_language(u16 language);
+80 -37
View File
@@ -16,6 +16,7 @@
#include "sound_init.h"
#include "../../play_sound.h"
//#include "rumble_init.h"
#include "../../rumble.h"
#define MUSIC_NONE 0xFFFF
@@ -82,15 +83,18 @@ void play_menu_sounds_extra(s32 a, void *b);
/**
* Called from threads: thread5_game_loop
*/
void reset_volume(void) {
void reset_volume(void)
{
sMusicVolume = 0;
}
/**
* Called from threads: thread5_game_loop
*/
void lower_background_noise(s32 a) {
switch (a) {
void lower_background_noise(s32 a)
{
switch (a)
{
case 1:
set_audio_muted(TRUE);
break;
@@ -104,8 +108,10 @@ void lower_background_noise(s32 a) {
/**
* Called from threads: thread5_game_loop
*/
void raise_background_noise(s32 a) {
switch (a) {
void raise_background_noise(s32 a)
{
switch (a)
{
case 1:
set_audio_muted(FALSE);
break;
@@ -119,8 +125,10 @@ void raise_background_noise(s32 a) {
/**
* Called from threads: thread5_game_loop
*/
void disable_background_sound(void) {
if (sBgMusicDisabled == FALSE) {
void disable_background_sound(void)
{
if (sBgMusicDisabled == FALSE)
{
sBgMusicDisabled = TRUE;
sound_banks_disable(SEQ_PLAYER_SFX, SOUND_BANKS_BACKGROUND);
}
@@ -129,8 +137,10 @@ void disable_background_sound(void) {
/**
* Called from threads: thread5_game_loop
*/
void enable_background_sound(void) {
if (sBgMusicDisabled == TRUE) {
void enable_background_sound(void)
{
if (sBgMusicDisabled == TRUE)
{
sBgMusicDisabled = FALSE;
sound_banks_enable(SEQ_PLAYER_SFX, SOUND_BANKS_BACKGROUND);
}
@@ -141,8 +151,10 @@ void enable_background_sound(void) {
*
* Called from threads: thread5_game_loop
*/
void set_sound_mode(u16 soundMode) {
if (soundMode < 3) {
void set_sound_mode(u16 soundMode)
{
if (soundMode < 3)
{
audio_set_sound_mode(sSoundMenuModeToSoundMode[soundMode]);
}
}
@@ -152,33 +164,51 @@ void set_sound_mode(u16 soundMode) {
*
* Called from threads: thread5_game_loop
*/
void play_menu_sounds(s16 soundMenuFlags) {
if (soundMenuFlags & SOUND_MENU_FLAG_HANDAPPEAR) {
void play_menu_sounds(s16 soundMenuFlags)
{
if (soundMenuFlags & SOUND_MENU_FLAG_HANDAPPEAR)
{
play_sound(SOUND_MENU_HAND_APPEAR, gGlobalSoundSource);
} else if (soundMenuFlags & SOUND_MENU_FLAG_HANDISAPPEAR) {
}
else if (soundMenuFlags & SOUND_MENU_FLAG_HANDISAPPEAR)
{
play_sound(SOUND_MENU_HAND_DISAPPEAR, gGlobalSoundSource);
} else if (soundMenuFlags & SOUND_MENU_FLAG_UNKNOWN1) {
}
else if (soundMenuFlags & SOUND_MENU_FLAG_UNKNOWN1)
{
play_sound(SOUND_MENU_UNK0C, gGlobalSoundSource);
} else if (soundMenuFlags & SOUND_MENU_FLAG_PINCHMARIOFACE) {
}
else if (soundMenuFlags & SOUND_MENU_FLAG_PINCHMARIOFACE)
{
play_sound(SOUND_MENU_PINCH_MARIO_FACE, gGlobalSoundSource);
} else if (soundMenuFlags & SOUND_MENU_FLAG_PINCHMARIOFACE2) {
}
else if (soundMenuFlags & SOUND_MENU_FLAG_PINCHMARIOFACE2)
{
play_sound(SOUND_MENU_PINCH_MARIO_FACE, gGlobalSoundSource);
} else if (soundMenuFlags & SOUND_MENU_FLAG_LETGOMARIOFACE) {
}
else if (soundMenuFlags & SOUND_MENU_FLAG_LETGOMARIOFACE)
{
play_sound(SOUND_MENU_LET_GO_MARIO_FACE, gGlobalSoundSource);
} else if (soundMenuFlags & SOUND_MENU_FLAG_CAMERAZOOMIN) {
}
else if (soundMenuFlags & SOUND_MENU_FLAG_CAMERAZOOMIN)
{
play_sound(SOUND_MENU_CAMERA_ZOOM_IN, gGlobalSoundSource);
} else if (soundMenuFlags & SOUND_MENU_FLAG_CAMERAZOOMOUT) {
}
else if (soundMenuFlags & SOUND_MENU_FLAG_CAMERAZOOMOUT)
{
play_sound(SOUND_MENU_CAMERA_ZOOM_OUT, gGlobalSoundSource);
}
if (soundMenuFlags & 0x100) {
if (soundMenuFlags & 0x100)
{
play_menu_sounds_extra(20, NULL);
}
#if ENABLE_RUMBLE
if (soundMenuFlags & SOUND_MENU_FLAG_LETGOMARIOFACE) {
// #if ENABLE_RUMBLE
if (soundMenuFlags & SOUND_MENU_FLAG_LETGOMARIOFACE)
{
queue_rumble_data(10, 60);
}
#endif
// #endif
}
/**
@@ -245,7 +275,8 @@ void play_menu_sounds(s16 soundMenuFlags) {
/**
* Called from threads: thread3_main, thread5_game_loop
*/
void fadeout_music(s16 fadeOutTime) {
void fadeout_music(s16 fadeOutTime)
{
func_803210D4(fadeOutTime);
sCurrentMusic = MUSIC_NONE;
sCurrentShellMusic = MUSIC_NONE;
@@ -255,7 +286,8 @@ void fadeout_music(s16 fadeOutTime) {
/**
* Called from threads: thread5_game_loop
*/
void fadeout_level_music(s16 fadeTimer) {
void fadeout_level_music(s16 fadeTimer)
{
seq_player_fade_out(SEQ_PLAYER_LEVEL, fadeTimer);
sCurrentMusic = MUSIC_NONE;
sCurrentShellMusic = MUSIC_NONE;
@@ -265,7 +297,8 @@ void fadeout_level_music(s16 fadeTimer) {
/**
* Called from threads: thread5_game_loop
*/
void play_cutscene_music(u16 seqArgs) {
void play_cutscene_music(u16 seqArgs)
{
play_music(SEQ_PLAYER_LEVEL, seqArgs, 0);
sCurrentMusic = seqArgs;
}
@@ -273,7 +306,8 @@ void play_cutscene_music(u16 seqArgs) {
/**
* Called from threads: thread5_game_loop
*/
void play_shell_music(void) {
void play_shell_music(void)
{
play_music(SEQ_PLAYER_LEVEL, SEQUENCE_ARGS(4, SEQ_EVENT_POWERUP | SEQ_VARIATION), 0);
sCurrentShellMusic = SEQUENCE_ARGS(4, SEQ_EVENT_POWERUP | SEQ_VARIATION);
}
@@ -281,8 +315,10 @@ void play_shell_music(void) {
/**
* Called from threads: thread5_game_loop
*/
void stop_shell_music(void) {
if (sCurrentShellMusic != MUSIC_NONE) {
void stop_shell_music(void)
{
if (sCurrentShellMusic != MUSIC_NONE)
{
stop_background_music(sCurrentShellMusic);
sCurrentShellMusic = MUSIC_NONE;
}
@@ -291,9 +327,11 @@ void stop_shell_music(void) {
/**
* Called from threads: thread5_game_loop
*/
void play_cap_music(u16 seqArgs) {
void play_cap_music(u16 seqArgs)
{
play_music(SEQ_PLAYER_LEVEL, seqArgs, 0);
if (sCurrentCapMusic != MUSIC_NONE && sCurrentCapMusic != seqArgs) {
if (sCurrentCapMusic != MUSIC_NONE && sCurrentCapMusic != seqArgs)
{
stop_background_music(sCurrentCapMusic);
}
sCurrentCapMusic = seqArgs;
@@ -302,8 +340,10 @@ void play_cap_music(u16 seqArgs) {
/**
* Called from threads: thread5_game_loop
*/
void fadeout_cap_music(void) {
if (sCurrentCapMusic != MUSIC_NONE) {
void fadeout_cap_music(void)
{
if (sCurrentCapMusic != MUSIC_NONE)
{
fadeout_background_music(sCurrentCapMusic, 600);
}
}
@@ -311,8 +351,10 @@ void fadeout_cap_music(void) {
/**
* Called from threads: thread5_game_loop
*/
void stop_cap_music(void) {
if (sCurrentCapMusic != MUSIC_NONE) {
void stop_cap_music(void)
{
if (sCurrentCapMusic != MUSIC_NONE)
{
stop_background_music(sCurrentCapMusic);
sCurrentCapMusic = MUSIC_NONE;
}
@@ -321,7 +363,8 @@ void stop_cap_music(void) {
/**
* Called from threads: thread5_game_loop
*/
void play_menu_sounds_extra(s32 a, void *b) {
void play_menu_sounds_extra(s32 a, void *b)
{
play_sound(sMenuSoundsExtra[a], b);
}
+15
View File
@@ -19,23 +19,38 @@
#define SOUND_MENU_MODE_HEADSET 2
void reset_volume(void);
void raise_background_noise(s32 a);
void lower_background_noise(s32 a);
void disable_background_sound(void);
void enable_background_sound(void);
void set_sound_mode(u16 soundMode);
void play_menu_sounds(s16 soundMenuFlags);
//void play_painting_eject_sound(void);
//void play_infinite_stairs_music(void);
//void set_background_music(u16 a, u16 seqArgs, s16 fadeTimer);
void fadeout_music(s16 fadeOutTime);
void fadeout_level_music(s16 fadeTimer);
void play_cutscene_music(u16 seqArgs);
void play_shell_music(void);
void stop_shell_music(void);
void play_cap_music(u16 seqArgs);
void fadeout_cap_music(void);
void stop_cap_music(void);
//void audio_game_loop_tick(void);
//void thread4_sound(UNUSED void *arg);
+4
View File
@@ -3,6 +3,8 @@
#include <stdlib.h>
#include <string.h>
#include "../obj_pool.h"
struct GlobalState *g_state = 0;
struct GlobalState *global_state_create(void)
@@ -10,6 +12,7 @@ struct GlobalState *global_state_create(void)
struct GlobalState *state = malloc(sizeof(struct GlobalState));
memset(state, 0, sizeof(struct GlobalState));
state->msSwimStrength = MIN_SWIM_STRENGTH;
state->mgMarioId = -1;
return state;
}
@@ -20,5 +23,6 @@ void global_state_bind(struct GlobalState *state)
void global_state_delete(struct GlobalState *state)
{
obj_pool_free_all(&state->mgFakeObjects);
free(state);
}
+5
View File
@@ -2,6 +2,7 @@
#include "include/types.h"
#include "game/area.h"
#include "../obj_pool.h"
struct GlobalState
{
@@ -35,11 +36,13 @@ struct GlobalState
s8 mgShowDebugText;
s8 mgDebugLevelSelect;
s16 mgCurrSaveFileNum;
s32 mgMarioId;
struct Controller mgController;
struct SpawnInfo mgMarioSpawnInfoVal;
struct Area *mgCurrentArea;
struct Object *mgCurrentObject;
struct Object *mgMarioObject;
struct ObjPool mgFakeObjects;
struct MarioAnimation mD_80339D10;
struct MarioState mgMarioStateVal;
};
@@ -50,5 +53,7 @@ struct GlobalState
extern struct GlobalState *g_state;
extern struct GlobalState *global_state_create(void);
extern void global_state_bind(struct GlobalState *state);
extern void global_state_delete(struct GlobalState *state);
+40 -20
View File
@@ -98,28 +98,32 @@
* Data Structures.
*/
typedef struct {
typedef struct
{
unsigned int cmd: 8;
unsigned int flags: 8;
unsigned int gain: 16;
unsigned int addr;
} Aadpcm;
typedef struct {
typedef struct
{
unsigned int cmd: 8;
unsigned int flags: 8;
unsigned int gain: 16;
unsigned int addr;
} Apolef;
typedef struct {
typedef struct
{
unsigned int cmd: 8;
unsigned int flags: 8;
unsigned int pad1: 16;
unsigned int addr;
} Aenvelope;
typedef struct {
typedef struct
{
unsigned int cmd: 8;
unsigned int pad1: 8;
unsigned int dmem: 16;
@@ -127,7 +131,8 @@ typedef struct {
unsigned int count: 16;
} Aclearbuff;
typedef struct {
typedef struct
{
unsigned int cmd: 8;
unsigned int pad1: 8;
unsigned int pad2: 16;
@@ -135,20 +140,23 @@ typedef struct {
unsigned int inR: 16;
} Ainterleave;
typedef struct {
typedef struct
{
unsigned int cmd: 8;
unsigned int pad1: 24;
unsigned int addr;
} Aloadbuff;
typedef struct {
typedef struct
{
unsigned int cmd: 8;
unsigned int flags: 8;
unsigned int pad1: 16;
unsigned int addr;
} Aenvmixer;
typedef struct {
typedef struct
{
unsigned int cmd: 8;
unsigned int flags: 8;
unsigned int gain: 16;
@@ -156,34 +164,39 @@ typedef struct {
unsigned int dmemo: 16;
} Amixer;
typedef struct {
typedef struct
{
unsigned int cmd: 8;
unsigned int flags: 8;
unsigned int dmem2: 16;
unsigned int addr;
} Apan;
typedef struct {
typedef struct
{
unsigned int cmd: 8;
unsigned int flags: 8;
unsigned int pitch: 16;
unsigned int addr;
} Aresample;
typedef struct {
typedef struct
{
unsigned int cmd: 8;
unsigned int flags: 8;
unsigned int pad1: 16;
unsigned int addr;
} Areverb;
typedef struct {
typedef struct
{
unsigned int cmd: 8;
unsigned int pad1: 24;
unsigned int addr;
} Asavebuff;
typedef struct {
typedef struct
{
unsigned int cmd: 8;
unsigned int pad1: 24;
unsigned int pad2: 2;
@@ -191,7 +204,8 @@ typedef struct {
unsigned int base: 24;
} Asegment;
typedef struct {
typedef struct
{
unsigned int cmd: 8;
unsigned int flags: 8;
unsigned int dmemin: 16;
@@ -199,7 +213,8 @@ typedef struct {
unsigned int count: 16;
} Asetbuff;
typedef struct {
typedef struct
{
unsigned int cmd: 8;
unsigned int flags: 8;
unsigned int vol: 16;
@@ -207,7 +222,8 @@ typedef struct {
unsigned int volrate: 16;
} Asetvol;
typedef struct {
typedef struct
{
unsigned int cmd: 8;
unsigned int pad1: 8;
unsigned int dmemin: 16;
@@ -215,14 +231,16 @@ typedef struct {
unsigned int count: 16;
} Admemmove;
typedef struct {
typedef struct
{
unsigned int cmd: 8;
unsigned int pad1: 8;
unsigned int count: 16;
unsigned int addr;
} Aloadadpcm;
typedef struct {
typedef struct
{
unsigned int cmd: 8;
unsigned int pad1: 8;
unsigned int pad2: 16;
@@ -233,12 +251,14 @@ typedef struct {
* Generic Acmd Packet
*/
typedef struct {
typedef struct
{
uintptr_t w0;
uintptr_t w1;
} Awords;
typedef union {
typedef union
{
Awords words;
#if IS_BIG_ENDIAN && !IS_64_BIT
Aadpcm adpcm;
+90 -50
View File
@@ -24,7 +24,6 @@
#include "ultratypes.h"
// FROM mbi.h
/*
* the SHIFT macros are used to build display list commands, inserting
@@ -51,9 +50,6 @@
#define G_OFF (0)
/*
* To use the F3DEX ucodes, define F3DEX_GBI before include this file.
*
@@ -1141,7 +1137,8 @@
/*
* Vertex (set up for use with colors)
*/
typedef struct {
typedef struct
{
#ifndef GBI_FLOATS
short ob[3]; /* x, y, z */
#else
@@ -1155,7 +1152,8 @@ typedef struct {
/*
* Vertex (set up for use with normals)
*/
typedef struct {
typedef struct
{
#ifndef GBI_FLOATS
short ob[3]; /* x, y, z */
#else
@@ -1167,7 +1165,8 @@ typedef struct {
unsigned char a; /* alpha */
} Vtx_tn;
typedef union {
typedef union
{
Vtx_t v; /* Use this one for colors */
Vtx_tn n; /* Use this one for normals */
long long int force_structure_alignment;
@@ -1177,7 +1176,8 @@ typedef union {
* Sprite structure
*/
typedef struct {
typedef struct
{
void *SourceImagePointer;
void *TlutPointer;
short Stride;
@@ -1191,10 +1191,10 @@ typedef struct {
/* padding to bring structure size to 64 bit allignment */
char dummy[4];
} uSprite_t;
typedef union {
typedef union
{
uSprite_t s;
/* Need to make sure this is 64 bit aligned */
@@ -1204,7 +1204,8 @@ typedef union {
/*
* Triangle face
*/
typedef struct {
typedef struct
{
unsigned char flag;
unsigned char v[3];
} Tri;
@@ -1217,12 +1218,14 @@ typedef struct {
*/
typedef s32 Mtx_t[4][4];
typedef union {
typedef union
{
Mtx_t m;
long long int force_structure_alignment;
} Mtx;
#else
typedef struct {
typedef struct
{
float m[4][4];
} Mtx;
#endif
@@ -1261,13 +1264,15 @@ typedef struct {
* (SCREEN_WD/2)*4, (SCREEN_HT/2)*4, G_MAXZ, 0,
* (SCREEN_WD/2)*4, (SCREEN_HT/2)*4, 0, 0,
*/
typedef struct {
typedef struct
{
short vscale[4]; /* scale, 2 bits fraction */
short vtrans[4]; /* translate, 2 bits fraction */
/* both the above arrays are padded to 64-bit boundary */
} Vp_t;
typedef union {
typedef union
{
Vp_t vp;
long long int force_structure_alignment;
} Vp;
@@ -1427,7 +1432,8 @@ typedef union {
*
*/
typedef struct {
typedef struct
{
unsigned char col[3]; /* diffuse light value (rgba) */
char pad1;
unsigned char colc[3]; /* copy of diffuse light value (rgba) */
@@ -1436,77 +1442,92 @@ typedef struct {
char pad3;
} Light_t;
typedef struct {
typedef struct
{
unsigned char col[3]; /* ambient light value (rgba) */
char pad1;
unsigned char colc[3]; /* copy of ambient light value (rgba) */
char pad2;
} Ambient_t;
typedef struct {
typedef struct
{
int x1, y1, x2, y2; /* texture offsets for highlight 1/2 */
} Hilite_t;
typedef union {
typedef union
{
Light_t l;
long long int force_structure_alignment[2];
} Light;
typedef union {
typedef union
{
Ambient_t l;
long long int force_structure_alignment[1];
} Ambient;
typedef struct {
typedef struct
{
Ambient a;
Light l[7];
} Lightsn;
typedef struct {
typedef struct
{
Ambient a;
Light l[1];
} Lights0;
typedef struct {
typedef struct
{
Ambient a;
Light l[1];
} Lights1;
typedef struct {
typedef struct
{
Ambient a;
Light l[2];
} Lights2;
typedef struct {
typedef struct
{
Ambient a;
Light l[3];
} Lights3;
typedef struct {
typedef struct
{
Ambient a;
Light l[4];
} Lights4;
typedef struct {
typedef struct
{
Ambient a;
Light l[5];
} Lights5;
typedef struct {
typedef struct
{
Ambient a;
Light l[6];
} Lights6;
typedef struct {
typedef struct
{
Ambient a;
Light l[7];
} Lights7;
typedef struct {
typedef struct
{
Light l[2];
} LookAt;
typedef union {
typedef union
{
Hilite_t h;
long int force_structure_alignment[4];
} Hilite;
@@ -1571,7 +1592,8 @@ typedef union {
/*
* Graphics DMA Packet
*/
typedef struct {
typedef struct
{
int cmd: 8;
unsigned int par: 8;
unsigned int len: 16;
@@ -1581,13 +1603,15 @@ typedef struct {
/*
* Graphics Immediate Mode Packet types
*/
typedef struct {
typedef struct
{
int cmd: 8;
int pad: 24;
Tri tri;
} Gtri;
typedef struct {
typedef struct
{
int cmd: 8;
int pad1: 24;
int pad2: 24;
@@ -1603,7 +1627,8 @@ typedef struct {
* int base:24;
* } Gsegment;
*/
typedef struct {
typedef struct
{
int cmd: 8;
int pad0: 8;
int mw_index: 8;
@@ -1612,7 +1637,8 @@ typedef struct {
int base: 24;
} Gsegment;
typedef struct {
typedef struct
{
int cmd: 8;
int pad0: 8;
int sft: 8;
@@ -1620,7 +1646,8 @@ typedef struct {
unsigned int data: 32;
} GsetothermodeL;
typedef struct {
typedef struct
{
int cmd: 8;
int pad0: 8;
int sft: 8;
@@ -1628,7 +1655,8 @@ typedef struct {
unsigned int data: 32;
} GsetothermodeH;
typedef struct {
typedef struct
{
unsigned char cmd;
unsigned char lodscale;
unsigned char tile;
@@ -1637,13 +1665,15 @@ typedef struct {
unsigned short t;
} Gtexture;
typedef struct {
typedef struct
{
int cmd: 8;
int pad: 24;
Tri line;
} Gline3D;
typedef struct {
typedef struct
{
int cmd: 8;
int pad1: 24;
short int pad2;
@@ -1654,7 +1684,8 @@ typedef struct {
/*
* RDP Packet types
*/
typedef struct {
typedef struct
{
int cmd: 8;
unsigned int fmt: 3;
unsigned int siz: 2;
@@ -1663,13 +1694,15 @@ typedef struct {
uintptr_t dram; /* to account for 1024 */
} Gsetimg;
typedef struct {
typedef struct
{
int cmd: 8;
unsigned int muxs0: 24;
unsigned int muxs1: 32;
} Gsetcombine;
typedef struct {
typedef struct
{
int cmd: 8;
unsigned char pad;
unsigned char prim_min_level;
@@ -1677,7 +1710,8 @@ typedef struct {
unsigned long color;
} Gsetcolor;
typedef struct {
typedef struct
{
int cmd: 8;
int x0: 10;
int x0frac: 2;
@@ -1690,7 +1724,8 @@ typedef struct {
int y1frac: 2;
} Gfillrect;
typedef struct {
typedef struct
{
int cmd: 8;
unsigned int fmt: 3;
unsigned int siz: 2;
@@ -1710,7 +1745,8 @@ typedef struct {
unsigned int shifts: 4;
} Gsettile;
typedef struct {
typedef struct
{
int cmd: 8;
unsigned int sl: 12;
unsigned int tl: 12;
@@ -1726,7 +1762,8 @@ typedef Gloadtile Gsettilesize;
typedef Gloadtile Gloadtlut;
typedef struct {
typedef struct
{
unsigned int cmd: 8; /* command */
unsigned int xl: 12; /* X coordinate of upper left */
unsigned int yl: 12; /* Y coordinate of upper left */
@@ -1743,7 +1780,8 @@ typedef struct {
/*
* Textured rectangles are 128 bits not 64 bits
*/
typedef struct {
typedef struct
{
unsigned long w0;
unsigned long w1;
unsigned long w2;
@@ -1757,7 +1795,8 @@ typedef struct {
/*
* Generic Gfx Packet
*/
typedef struct {
typedef struct
{
uintptr_t w0;
uintptr_t w1;
} Gwords;
@@ -1770,7 +1809,8 @@ typedef struct {
* 64-bit systems, only the 'words' member may be accessed; the rest of the
* structs don't have matching layouts for now.)
*/
typedef union {
typedef union
{
Gwords words;
#if !defined(F3D_OLD) && IS_BIG_ENDIAN && !IS_64_BIT
Gdma dma;
+14 -3
View File
@@ -6,8 +6,15 @@
typedef struct
{
u8 *offset __attribute__((aligned (8)));
s32 len __attribute__((aligned (8)));
u8 *offset __attribute__((aligned (8)
)
);
s32 len __attribute__((aligned (8)
)
);
} ALSeqData;
typedef struct
@@ -16,7 +23,11 @@ typedef struct
unsigned short seqCount;
unsigned int pad;
ALSeqData seqArray[1];
} __attribute__((aligned (16))) ALSeqFile;
} __attribute__((aligned (16)
)
)
ALSeqFile;
void alSeqFileNew(ALSeqFile * f, u8 * base);
+19 -10
View File
@@ -32,7 +32,10 @@
#define _OS_H_
#ifdef _LANGUAGE_C_PLUS_PLUS
extern "C" {
extern "C"
{
#endif
#include "ultratypes.h"
@@ -49,7 +52,8 @@ extern "C" {
/*
* Structure for device manager block
*/
typedef struct {
typedef struct
{
s32 active; /* Status flag */
OSThread *thread; /* Calling thread */
OSMesgQueue *cmdQueue; /* Command queue */
@@ -57,6 +61,7 @@ typedef struct {
OSMesgQueue *acsQueue; /* Access queue */
/* Raw DMA routine */
s32 (*dma)(s32, u32, void *, u32);
s32 (*edma)(OSPiHandle *, s32, u32, void *, u32);
} OSDevMgr;
@@ -65,8 +70,8 @@ typedef struct {
*/
typedef struct {
typedef struct
{
int status;
OSMesgQueue *queue;
int channel;
@@ -83,7 +88,8 @@ typedef struct {
} OSPfs;
typedef struct {
typedef struct
{
u32 file_size; /* bytes */
u32 game_code;
u16 company_code;
@@ -94,7 +100,8 @@ typedef struct {
/*
* Structure for Profiler
*/
typedef struct {
typedef struct
{
u16 *histo_base; /* histogram base */
u32 histo_size; /* histogram size */
u32 *text_start; /* start of text segment */
@@ -575,7 +582,6 @@ extern OSPiHandle *__osPiTable; /* The head of OSPiHandle link list */
extern OSPiHandle *__osDiskHandle; /* For exceptasm to get disk info*/
/**************************************************************************
*
* Function prototypes
@@ -584,7 +590,8 @@ extern OSPiHandle *__osDiskHandle; /* For exceptasm to get disk info*/
/* Thread operations */
extern void osCreateThread(OSThread *, OSId, void (*)(void *),
extern void osCreateThread(
OSThread *, OSId, void (*)(void *),
void *, void *, OSPri);
extern void osDestroyThread(OSThread *);
extern void osYieldThread(void);
@@ -665,7 +672,8 @@ extern s32 osPiRawReadIo(u32, u32 *);
extern s32 osPiRawStartDma(s32, u32, void *, u32);
extern s32 osPiWriteIo(u32, u32);
extern s32 osPiReadIo(u32, u32 *);
extern s32 osPiStartDma(OSIoMesg *, s32, s32, u32, void *, u32,
extern s32 osPiStartDma(
OSIoMesg *, s32, s32, u32, void *, u32,
OSMesgQueue *);
extern void osCreatePiManager(OSPri, OSMesgQueue *, OSMesg *, s32);
@@ -691,7 +699,8 @@ extern void osCreateViManager(OSPri);
extern OSTime osGetTime(void);
extern void osSetTime(OSTime);
extern u32 osSetTimer(OSTimer *, OSTime, OSTime,
extern u32 osSetTimer(
OSTimer *, OSTime, OSTime,
OSMesgQueue *, OSMesg);
extern int osStopTimer(OSTimer *);
+4 -1
View File
@@ -31,7 +31,10 @@
#define _OS_AI_H_
#ifdef _LANGUAGE_C_PLUS_PLUS
extern "C" {
extern "C"
{
#endif
#include "ultratypes.h"
+4 -1
View File
@@ -31,7 +31,10 @@
#define _OS_CACHE_H_
#ifdef _LANGUAGE_C_PLUS_PLUS
extern "C" {
extern "C"
{
#endif
#include "ultratypes.h"
+10 -4
View File
@@ -31,7 +31,10 @@
#define _OS_CONT_H_
#ifdef _LANGUAGE_C_PLUS_PLUS
extern "C" {
extern "C"
{
#endif
#include "ultratypes.h"
@@ -50,20 +53,23 @@ extern "C" {
* Structure for controllers
*/
typedef struct {
typedef struct
{
u16 type; /* Controller Type */
u8 status; /* Controller status */
u8 errnum;
} OSContStatus;
typedef struct {
typedef struct
{
u16 button;
s8 stick_x; /* -80 <= stick_x <= 80 */
s8 stick_y; /* -80 <= stick_y <= 80 */
u8 errnum;
} OSContPad;
typedef struct {
typedef struct
{
void *address; /* Ram pad Address: 11 bits */
u8 databuffer[32]; /* address of the data buffer */
u8 addressCrc; /* CRC code for address */
+4 -1
View File
@@ -31,7 +31,10 @@
#define _OS_EEPROM_H_
#ifdef _LANGUAGE_C_PLUS_PLUS
extern "C" {
extern "C"
{
#endif
#include "ultratypes.h"
+4 -1
View File
@@ -31,7 +31,10 @@
#define _OS_EXCEPTION_H_
#ifdef _LANGUAGE_C_PLUS_PLUS
extern "C" {
extern "C"
{
#endif
#include "ultratypes.h"
+1
View File
@@ -8,6 +8,7 @@
// Old deprecated functions from strings.h, replaced by memcpy/memset.
extern void bcopy(const void *, void *, size_t);
extern void bzero(void *, size_t);
#endif
+6 -2
View File
@@ -31,7 +31,10 @@
#define _OS_MESSAGE_H_
#ifdef _LANGUAGE_C_PLUS_PLUS
extern "C" {
extern "C"
{
#endif
#include "ultratypes.h"
@@ -55,7 +58,8 @@ typedef void * OSMesg;
/*
* Structure for message queue
*/
typedef struct OSMesgQueue_s {
typedef struct OSMesgQueue_s
{
OSThread *mtqueue; /* Queue to store threads blocked
on empty mailboxes (receive) */
OSThread *fullqueue; /* Queue to store threads blocked
+1
View File
@@ -4,6 +4,7 @@
/* Miscellaneous OS functions */
void osInitialize(void);
u32 osGetCount(void);
uintptr_t osVirtualToPhysical(void *);
+27 -11
View File
@@ -6,7 +6,8 @@
/* Types */
typedef struct {
typedef struct
{
#if !defined(VERSION_EU)
u32 errStatus;
#endif
@@ -17,7 +18,8 @@ typedef struct {
u32 C1ErrSector[4];
} __OSBlockInfo;
typedef struct {
typedef struct
{
u32 cmdType; // 0
u16 transferMode; // 4
u16 blockNum; // 6
@@ -31,7 +33,8 @@ typedef struct {
__OSBlockInfo block[2]; // 18
} __OSTranxInfo;
typedef struct OSPiHandle_s {
typedef struct OSPiHandle_s
{
struct OSPiHandle_s *next;
u8 type;
u8 latency;
@@ -44,23 +47,30 @@ typedef struct OSPiHandle_s {
__OSTranxInfo transferInfo;
} OSPiHandle;
typedef struct {
typedef struct
{
u8 type;
uintptr_t address;
} OSPiInfo;
typedef struct {
typedef struct
{
u16 type;
u8 pri;
u8 status;
OSMesgQueue *retQueue;
} OSIoMesgHdr;
typedef struct {
/*0x00*/ OSIoMesgHdr hdr;
/*0x08*/ void *dramAddr;
/*0x0C*/ uintptr_t devAddr;
/*0x10*/ size_t size;
typedef struct
{
/*0x00*/
OSIoMesgHdr hdr;
/*0x08*/
void *dramAddr;
/*0x0C*/
uintptr_t devAddr;
/*0x10*/
size_t size;
#if defined(VERSION_EU) || defined(VERSION_SH)
OSPiHandle *piHandle; // from the official definition
#endif
@@ -76,13 +86,19 @@ typedef struct {
/* Functions */
s32 osPiStartDma(OSIoMesg *mb, s32 priority, s32 direction, uintptr_t devAddr, void *vAddr,
s32 osPiStartDma(
OSIoMesg *mb, s32 priority, s32 direction, uintptr_t devAddr, void *vAddr,
size_t nbytes, OSMesgQueue *mq);
void osCreatePiManager(OSPri pri, OSMesgQueue *cmdQ, OSMesg *cmdBuf, s32 cmdMsgCnt);
OSMesgQueue *osPiGetCmdQueue(void);
s32 osPiWriteIo(uintptr_t devAddr, u32 data);
s32 osPiReadIo(uintptr_t devAddr, u32 *data);
s32 osPiRawStartDma(s32 dir, u32 cart_addr, void *dram_addr, size_t size);
s32 osEPiRawStartDma(OSPiHandle *piHandle, s32 dir, u32 cart_addr, void *dram_addr, size_t size);
#endif
+4 -1
View File
@@ -31,7 +31,10 @@
#define _OS_RDP_H_
#ifdef _LANGUAGE_C_PLUS_PLUS
extern "C" {
extern "C"
{
#endif
#include "ultratypes.h"
+46 -19
View File
@@ -23,19 +23,30 @@ typedef s32 OSId;
typedef union
{
struct {f32 f_odd; f32 f_even;} f;
struct
{
f32 f_odd;
f32 f_even;
} f;
} __OSfp;
typedef struct
{
/* registers */
/*0x20*/ u64 at, v0, v1, a0, a1, a2, a3;
/*0x58*/ u64 t0, t1, t2, t3, t4, t5, t6, t7;
/*0x98*/ u64 s0, s1, s2, s3, s4, s5, s6, s7;
/*0xD8*/ u64 t8, t9, gp, sp, s8, ra;
/*0x108*/ u64 lo, hi;
/*0x118*/ u32 sr, pc, cause, badvaddr, rcp;
/*0x12C*/ u32 fpcsr;
/*0x20*/
u64 at, v0, v1, a0, a1, a2, a3;
/*0x58*/
u64 t0, t1, t2, t3, t4, t5, t6, t7;
/*0x98*/
u64 s0, s1, s2, s3, s4, s5, s6, s7;
/*0xD8*/
u64 t8, t9, gp, sp, s8, ra;
/*0x108*/
u64 lo, hi;
/*0x118*/
u32 sr, pc, cause, badvaddr, rcp;
/*0x12C*/
u32 fpcsr;
__OSfp fp0, fp2, fp4, fp6, fp8, fp10, fp12, fp14;
__OSfp fp16, fp18, fp20, fp22, fp24, fp26, fp28, fp30;
} __OSThreadContext;
@@ -49,27 +60,43 @@ typedef struct
typedef struct OSThread_s
{
/*0x00*/ struct OSThread_s *next;
/*0x04*/ OSPri priority;
/*0x08*/ struct OSThread_s **queue;
/*0x0C*/ struct OSThread_s *tlnext;
/*0x10*/ u16 state;
/*0x12*/ u16 flags;
/*0x14*/ OSId id;
/*0x18*/ int fp;
/*0x1C*/ __OSThreadprofile_s *thprof;
/*0x20*/ __OSThreadContext context;
/*0x00*/
struct OSThread_s *next;
/*0x04*/
OSPri priority;
/*0x08*/
struct OSThread_s **queue;
/*0x0C*/
struct OSThread_s *tlnext;
/*0x10*/
u16 state;
/*0x12*/
u16 flags;
/*0x14*/
OSId id;
/*0x18*/
int fp;
/*0x1C*/
__OSThreadprofile_s *thprof;
/*0x20*/
__OSThreadContext context;
} OSThread;
/* Functions */
void osCreateThread(OSThread *thread, OSId id, void (*entry)(void *),
void osCreateThread(
OSThread *thread, OSId id, void (*entry)(void *),
void *arg, void *sp, OSPri pri);
OSId osGetThreadId(OSThread *thread);
OSPri osGetThreadPri(OSThread *thread);
void osSetThreadPri(OSThread *thread, OSPri pri);
void osStartThread(OSThread *thread);
void osStopThread(OSThread *thread);
#endif
+2
View File
@@ -21,7 +21,9 @@ typedef u64 OSTime;
/* Functions */
OSTime osGetTime(void);
void osSetTime(OSTime time);
u32 osSetTimer(OSTimer *, OSTime, OSTime, OSMesgQueue *, OSMesg);
#endif
+4 -1
View File
@@ -31,7 +31,10 @@
#define _OS_TLB_H_
#ifdef _LANGUAGE_C_PLUS_PLUS
extern "C" {
extern "C"
{
#endif
#include "ultratypes.h"
+31 -13
View File
@@ -58,26 +58,44 @@ typedef struct
typedef struct
{
/* 0x00 */ u16 unk00; //some kind of flags. swap buffer sets to 0x10
/* 0x02 */ u16 retraceCount;
/* 0x04 */ void* buffer;
/* 0x08 */ OSViMode *modep;
/* 0x0c */ u32 features;
/* 0x10 */ OSMesgQueue *mq;
/* 0x14 */ OSMesg *msg;
/* 0x18 */ u32 unk18;
/* 0x1c */ u32 unk1c;
/* 0x20 */ u32 unk20;
/* 0x24 */ f32 unk24;
/* 0x28 */ u16 unk28;
/* 0x2c */ u32 unk2c;
/* 0x00 */
u16 unk00; //some kind of flags. swap buffer sets to 0x10
/* 0x02 */
u16 retraceCount;
/* 0x04 */
void *buffer;
/* 0x08 */
OSViMode *modep;
/* 0x0c */
u32 features;
/* 0x10 */
OSMesgQueue *mq;
/* 0x14 */
OSMesg *msg;
/* 0x18 */
u32 unk18;
/* 0x1c */
u32 unk1c;
/* 0x20 */
u32 unk20;
/* 0x24 */
f32 unk24;
/* 0x28 */
u16 unk28;
/* 0x2c */
u32 unk2c;
} OSViContext;
void osCreateViManager(OSPri pri);
void osViSetMode(OSViMode *mode);
void osViSetEvent(OSMesgQueue *mq, OSMesg msg, u32 retraceCount);
void osViBlack(u8 active);
void osViSetSpecialFeatures(u32 func);
void osViSwapBuffer(void *vaddr);
+37 -17
View File
@@ -70,32 +70,49 @@
typedef struct
{
/*0x00*/ u32 type;
/*0x04*/ u32 flags;
/*0x00*/
u32 type;
/*0x04*/
u32 flags;
/*0x08*/ u64 *ucode_boot;
/*0x0C*/ u32 ucode_boot_size;
/*0x08*/
u64 *ucode_boot;
/*0x0C*/
u32 ucode_boot_size;
/*0x10*/ u64 *ucode;
/*0x14*/ u32 ucode_size;
/*0x10*/
u64 *ucode;
/*0x14*/
u32 ucode_size;
/*0x18*/ u64 *ucode_data;
/*0x1C*/ u32 ucode_data_size;
/*0x18*/
u64 *ucode_data;
/*0x1C*/
u32 ucode_data_size;
/*0x20*/ u64 *dram_stack;
/*0x24*/ u32 dram_stack_size;
/*0x20*/
u64 *dram_stack;
/*0x24*/
u32 dram_stack_size;
/*0x28*/ u64 *output_buff;
/*0x2C*/ u64 *output_buff_size;
/*0x28*/
u64 *output_buff;
/*0x2C*/
u64 *output_buff_size;
/*0x30*/ u64 *data_ptr;
/*0x34*/ u32 data_size;
/*0x30*/
u64 *data_ptr;
/*0x34*/
u32 data_size;
/*0x38*/ u64 *yield_data_ptr;
/*0x3C*/ u32 yield_data_size;
/*0x38*/
u64 *yield_data_ptr;
/*0x3C*/
u32 yield_data_size;
} OSTask_t; // size = 0x40
typedef union {
typedef union
{
OSTask_t t;
long long int force_structure_alignment;
} OSTask;
@@ -109,8 +126,11 @@ typedef u32 OSYieldResult;
osSpTaskStartGo(p);
void osSpTaskLoad(OSTask *task);
void osSpTaskStartGo(OSTask *task);
void osSpTaskYield(void);
OSYieldResult osSpTaskYielded(OSTask *task);
#endif
+426 -213
View File
@@ -117,47 +117,72 @@
#define SOUND_ACTION_HANGING_STEP SOUND_ARG_LOAD(0, 4, 0x2D, 0xA0, 8)
#define SOUND_ACTION_QUICKSAND_STEP SOUND_ARG_LOAD(0, 4, 0x2E, 0x00, 8)
#define SOUND_ACTION_METAL_STEP_TIPTOE SOUND_ARG_LOAD(0, 4, 0x2F, 0x90, 8)
/* not verified */ #define SOUND_ACTION_UNKNOWN430 SOUND_ARG_LOAD(0, 4, 0x30, 0xC0, 8)
/* not verified */ #define SOUND_ACTION_UNKNOWN431 SOUND_ARG_LOAD(0, 4, 0x31, 0x60, 8)
/* not verified */ #define SOUND_ACTION_UNKNOWN432 SOUND_ARG_LOAD(0, 4, 0x32, 0x80, 8)
/* not verified */
#define SOUND_ACTION_UNKNOWN430 SOUND_ARG_LOAD(0, 4, 0x30, 0xC0, 8)
/* not verified */
#define SOUND_ACTION_UNKNOWN431 SOUND_ARG_LOAD(0, 4, 0x31, 0x60, 8)
/* not verified */
#define SOUND_ACTION_UNKNOWN432 SOUND_ARG_LOAD(0, 4, 0x32, 0x80, 8)
#define SOUND_ACTION_SWIM SOUND_ARG_LOAD(0, 4, 0x33, 0x80, 8)
/* not verified */ #define SOUND_ACTION_UNKNOWN434 SOUND_ARG_LOAD(0, 4, 0x34, 0x80, 8)
/* not verified */
#define SOUND_ACTION_UNKNOWN434 SOUND_ARG_LOAD(0, 4, 0x34, 0x80, 8)
#define SOUND_ACTION_THROW SOUND_ARG_LOAD(0, 4, 0x35, 0x80, 8)
#define SOUND_ACTION_KEY_SWISH SOUND_ARG_LOAD(0, 4, 0x36, 0x80, 8)
#define SOUND_ACTION_SPIN SOUND_ARG_LOAD(0, 4, 0x37, 0x80, 8)
#define SOUND_ACTION_TWIRL SOUND_ARG_LOAD(0, 4, 0x38, 0x80, 8) // same sound as spin
/* not verified */ #define SOUND_ACTION_CLIMB_UP_TREE SOUND_ARG_LOAD(0, 4, 0x3A, 0x80, 8)
/* not verified */ #define SOUND_ACTION_CLIMB_DOWN_TREE 0x003B
/* not verified */ #define SOUND_ACTION_UNK3C 0x003C
/* not verified */ #define SOUND_ACTION_UNKNOWN43D SOUND_ARG_LOAD(0, 4, 0x3D, 0x80, 8)
/* not verified */ #define SOUND_ACTION_UNKNOWN43E SOUND_ARG_LOAD(0, 4, 0x3E, 0x80, 8)
/* not verified */ #define SOUND_ACTION_PAT_BACK SOUND_ARG_LOAD(0, 4, 0x3F, 0x80, 8)
/* not verified */
#define SOUND_ACTION_CLIMB_UP_TREE SOUND_ARG_LOAD(0, 4, 0x3A, 0x80, 8)
/* not verified */
#define SOUND_ACTION_CLIMB_DOWN_TREE 0x003B
/* not verified */
#define SOUND_ACTION_UNK3C 0x003C
/* not verified */
#define SOUND_ACTION_UNKNOWN43D SOUND_ARG_LOAD(0, 4, 0x3D, 0x80, 8)
/* not verified */
#define SOUND_ACTION_UNKNOWN43E SOUND_ARG_LOAD(0, 4, 0x3E, 0x80, 8)
/* not verified */
#define SOUND_ACTION_PAT_BACK SOUND_ARG_LOAD(0, 4, 0x3F, 0x80, 8)
#define SOUND_ACTION_BRUSH_HAIR SOUND_ARG_LOAD(0, 4, 0x40, 0x80, 8)
/* not verified */ #define SOUND_ACTION_CLIMB_UP_POLE SOUND_ARG_LOAD(0, 4, 0x41, 0x80, 8)
/* not verified */
#define SOUND_ACTION_CLIMB_UP_POLE SOUND_ARG_LOAD(0, 4, 0x41, 0x80, 8)
#define SOUND_ACTION_METAL_BONK SOUND_ARG_LOAD(0, 4, 0x42, 0x80, 8)
#define SOUND_ACTION_UNSTUCK_FROM_GROUND SOUND_ARG_LOAD(0, 4, 0x43, 0x80, 8)
/* not verified */ #define SOUND_ACTION_HIT SOUND_ARG_LOAD(0, 4, 0x44, 0xC0, 8)
/* not verified */ #define SOUND_ACTION_HIT_2 SOUND_ARG_LOAD(0, 4, 0x44, 0xB0, 8)
/* not verified */ #define SOUND_ACTION_HIT_3 SOUND_ARG_LOAD(0, 4, 0x44, 0xA0, 8)
/* not verified */
#define SOUND_ACTION_HIT SOUND_ARG_LOAD(0, 4, 0x44, 0xC0, 8)
/* not verified */
#define SOUND_ACTION_HIT_2 SOUND_ARG_LOAD(0, 4, 0x44, 0xB0, 8)
/* not verified */
#define SOUND_ACTION_HIT_3 SOUND_ARG_LOAD(0, 4, 0x44, 0xA0, 8)
#define SOUND_ACTION_BONK SOUND_ARG_LOAD(0, 4, 0x45, 0xA0, 8)
#define SOUND_ACTION_SHRINK_INTO_BBH SOUND_ARG_LOAD(0, 4, 0x46, 0xA0, 8)
#define SOUND_ACTION_SWIM_FAST SOUND_ARG_LOAD(0, 4, 0x47, 0xA0, 8)
#define SOUND_ACTION_METAL_JUMP_WATER SOUND_ARG_LOAD(0, 4, 0x50, 0x90, 8)
#define SOUND_ACTION_METAL_LAND_WATER SOUND_ARG_LOAD(0, 4, 0x51, 0x90, 8)
#define SOUND_ACTION_METAL_STEP_WATER SOUND_ARG_LOAD(0, 4, 0x52, 0x90, 8)
/* not verified */ #define SOUND_ACTION_UNK53 0x0053
/* not verified */ #define SOUND_ACTION_UNK54 0x0054
/* not verified */ #define SOUND_ACTION_UNK55 0x0055
/* not verified */ #define SOUND_ACTION_FLYING_FAST SOUND_ARG_LOAD(0, 4, 0x56, 0x80, 8) // "swoop"?
/* not verified */
#define SOUND_ACTION_UNK53 0x0053
/* not verified */
#define SOUND_ACTION_UNK54 0x0054
/* not verified */
#define SOUND_ACTION_UNK55 0x0055
/* not verified */
#define SOUND_ACTION_FLYING_FAST SOUND_ARG_LOAD(0, 4, 0x56, 0x80, 8) // "swoop"?
#define SOUND_ACTION_TELEPORT SOUND_ARG_LOAD(0, 4, 0x57, 0xC0, 8)
/* not verified */ #define SOUND_ACTION_UNKNOWN458 SOUND_ARG_LOAD(0, 4, 0x58, 0xA0, 8)
/* not verified */ #define SOUND_ACTION_BOUNCE_OFF_OBJECT SOUND_ARG_LOAD(0, 4, 0x59, 0xB0, 8)
/* not verified */ #define SOUND_ACTION_SIDE_FLIP_UNK SOUND_ARG_LOAD(0, 4, 0x5A, 0x80, 8)
/* not verified */
#define SOUND_ACTION_UNKNOWN458 SOUND_ARG_LOAD(0, 4, 0x58, 0xA0, 8)
/* not verified */
#define SOUND_ACTION_BOUNCE_OFF_OBJECT SOUND_ARG_LOAD(0, 4, 0x59, 0xB0, 8)
/* not verified */
#define SOUND_ACTION_SIDE_FLIP_UNK SOUND_ARG_LOAD(0, 4, 0x5A, 0x80, 8)
#define SOUND_ACTION_READ_SIGN SOUND_ARG_LOAD(0, 4, 0x5B, 0xFF, 8)
/* not verified */ #define SOUND_ACTION_UNKNOWN45C SOUND_ARG_LOAD(0, 4, 0x5C, 0x80, 8)
/* not verified */ #define SOUND_ACTION_UNK5D 0x005D
/* not verified */ #define SOUND_ACTION_INTRO_UNK45E SOUND_ARG_LOAD(0, 4, 0x5E, 0x80, 8)
/* not verified */ #define SOUND_ACTION_INTRO_UNK45F SOUND_ARG_LOAD(0, 4, 0x5F, 0x80, 8)
/* not verified */
#define SOUND_ACTION_UNKNOWN45C SOUND_ARG_LOAD(0, 4, 0x5C, 0x80, 8)
/* not verified */
#define SOUND_ACTION_UNK5D 0x005D
/* not verified */
#define SOUND_ACTION_INTRO_UNK45E SOUND_ARG_LOAD(0, 4, 0x5E, 0x80, 8)
/* not verified */
#define SOUND_ACTION_INTRO_UNK45F SOUND_ARG_LOAD(0, 4, 0x5F, 0x80, 8)
/* Moving Sound Effects */
@@ -180,27 +205,45 @@
/* Mario Sound Effects */
// A random number 0-2 is added to the sound ID before playing, producing Yah/Wah/Hoo
#define SOUND_MARIO_YAH_WAH_HOO SOUND_ARG_LOAD(2, 4, 0x00, 0x80, 8)
/* not verified */ #define SOUND_MARIO_HOOHOO SOUND_ARG_LOAD(2, 4, 0x03, 0x80, 8)
/* not verified */ #define SOUND_MARIO_YAHOO SOUND_ARG_LOAD(2, 4, 0x04, 0x80, 8)
/* not verified */ #define SOUND_MARIO_UH SOUND_ARG_LOAD(2, 4, 0x05, 0x80, 8)
/* not verified */ #define SOUND_MARIO_HRMM SOUND_ARG_LOAD(2, 4, 0x06, 0x80, 8)
/* not verified */ #define SOUND_MARIO_WAH2 SOUND_ARG_LOAD(2, 4, 0x07, 0x80, 8)
/* not verified */ #define SOUND_MARIO_WHOA SOUND_ARG_LOAD(2, 4, 0x08, 0xC0, 8)
/* not verified */ #define SOUND_MARIO_EEUH SOUND_ARG_LOAD(2, 4, 0x09, 0x80, 8)
/* not verified */ #define SOUND_MARIO_ATTACKED SOUND_ARG_LOAD(2, 4, 0x0A, 0xFF, 8)
/* not verified */ #define SOUND_MARIO_OOOF SOUND_ARG_LOAD(2, 4, 0x0B, 0x80, 8)
/* not verified */ #define SOUND_MARIO_OOOF2 SOUND_ARG_LOAD(2, 4, 0x0B, 0xD0, 8)
/* not verified */
#define SOUND_MARIO_HOOHOO SOUND_ARG_LOAD(2, 4, 0x03, 0x80, 8)
/* not verified */
#define SOUND_MARIO_YAHOO SOUND_ARG_LOAD(2, 4, 0x04, 0x80, 8)
/* not verified */
#define SOUND_MARIO_UH SOUND_ARG_LOAD(2, 4, 0x05, 0x80, 8)
/* not verified */
#define SOUND_MARIO_HRMM SOUND_ARG_LOAD(2, 4, 0x06, 0x80, 8)
/* not verified */
#define SOUND_MARIO_WAH2 SOUND_ARG_LOAD(2, 4, 0x07, 0x80, 8)
/* not verified */
#define SOUND_MARIO_WHOA SOUND_ARG_LOAD(2, 4, 0x08, 0xC0, 8)
/* not verified */
#define SOUND_MARIO_EEUH SOUND_ARG_LOAD(2, 4, 0x09, 0x80, 8)
/* not verified */
#define SOUND_MARIO_ATTACKED SOUND_ARG_LOAD(2, 4, 0x0A, 0xFF, 8)
/* not verified */
#define SOUND_MARIO_OOOF SOUND_ARG_LOAD(2, 4, 0x0B, 0x80, 8)
/* not verified */
#define SOUND_MARIO_OOOF2 SOUND_ARG_LOAD(2, 4, 0x0B, 0xD0, 8)
#define SOUND_MARIO_HERE_WE_GO SOUND_ARG_LOAD(2, 4, 0x0C, 0x80, 8)
/* not verified */ #define SOUND_MARIO_YAWNING SOUND_ARG_LOAD(2, 4, 0x0D, 0x80, 8)
/* not verified */
#define SOUND_MARIO_YAWNING SOUND_ARG_LOAD(2, 4, 0x0D, 0x80, 8)
#define SOUND_MARIO_SNORING1 SOUND_ARG_LOAD(2, 4, 0x0E, 0x80, 8)
#define SOUND_MARIO_SNORING2 SOUND_ARG_LOAD(2, 4, 0x0F, 0x80, 8)
/* not verified */ #define SOUND_MARIO_WAAAOOOW SOUND_ARG_LOAD(2, 4, 0x10, 0xC0, 8)
/* not verified */ #define SOUND_MARIO_HAHA SOUND_ARG_LOAD(2, 4, 0x11, 0x80, 8)
/* not verified */ #define SOUND_MARIO_HAHA_2 SOUND_ARG_LOAD(2, 4, 0x11, 0xF0, 8)
/* not verified */ #define SOUND_MARIO_UH2 SOUND_ARG_LOAD(2, 4, 0x13, 0xD0, 8)
/* not verified */ #define SOUND_MARIO_UH2_2 SOUND_ARG_LOAD(2, 4, 0x13, 0x80, 8)
/* not verified */ #define SOUND_MARIO_ON_FIRE SOUND_ARG_LOAD(2, 4, 0x14, 0xA0, 8)
/* not verified */ #define SOUND_MARIO_DYING SOUND_ARG_LOAD(2, 4, 0x15, 0xFF, 8)
/* not verified */
#define SOUND_MARIO_WAAAOOOW SOUND_ARG_LOAD(2, 4, 0x10, 0xC0, 8)
/* not verified */
#define SOUND_MARIO_HAHA SOUND_ARG_LOAD(2, 4, 0x11, 0x80, 8)
/* not verified */
#define SOUND_MARIO_HAHA_2 SOUND_ARG_LOAD(2, 4, 0x11, 0xF0, 8)
/* not verified */
#define SOUND_MARIO_UH2 SOUND_ARG_LOAD(2, 4, 0x13, 0xD0, 8)
/* not verified */
#define SOUND_MARIO_UH2_2 SOUND_ARG_LOAD(2, 4, 0x13, 0x80, 8)
/* not verified */
#define SOUND_MARIO_ON_FIRE SOUND_ARG_LOAD(2, 4, 0x14, 0xA0, 8)
/* not verified */
#define SOUND_MARIO_DYING SOUND_ARG_LOAD(2, 4, 0x15, 0xFF, 8)
#define SOUND_MARIO_PANTING_COLD SOUND_ARG_LOAD(2, 4, 0x16, 0x80, 8)
// A random number 0-2 is added to the sound ID before playing
@@ -245,147 +288,268 @@
/* General Sound Effects */
#define SOUND_GENERAL_ACTIVATE_CAP_SWITCH SOUND_ARG_LOAD(3, 0, 0x00, 0x80, 8)
/* not verified */ #define SOUND_GENERAL_FLAME_OUT SOUND_ARG_LOAD(3, 0, 0x03, 0x80, 8)
/* not verified */ #define SOUND_GENERAL_OPEN_WOOD_DOOR SOUND_ARG_LOAD(3, 0, 0x04, 0xC0, 8)
/* not verified */ #define SOUND_GENERAL_CLOSE_WOOD_DOOR SOUND_ARG_LOAD(3, 0, 0x05, 0xC0, 8)
/* not verified */ #define SOUND_GENERAL_OPEN_IRON_DOOR SOUND_ARG_LOAD(3, 0, 0x06, 0xC0, 8)
/* not verified */ #define SOUND_GENERAL_CLOSE_IRON_DOOR SOUND_ARG_LOAD(3, 0, 0x07, 0xC0, 8)
/* not verified */ #define SOUND_GENERAL_BUBBLES 0x3008
/* not verified */ #define SOUND_GENERAL_MOVING_WATER SOUND_ARG_LOAD(3, 0, 0x09, 0x00, 8)
/* not verified */ #define SOUND_GENERAL_SWISH_WATER SOUND_ARG_LOAD(3, 0, 0x0A, 0x00, 8)
/* not verified */ #define SOUND_GENERAL_QUIET_BUBBLE SOUND_ARG_LOAD(3, 0, 0x0B, 0x00, 8)
/* not verified */
#define SOUND_GENERAL_FLAME_OUT SOUND_ARG_LOAD(3, 0, 0x03, 0x80, 8)
/* not verified */
#define SOUND_GENERAL_OPEN_WOOD_DOOR SOUND_ARG_LOAD(3, 0, 0x04, 0xC0, 8)
/* not verified */
#define SOUND_GENERAL_CLOSE_WOOD_DOOR SOUND_ARG_LOAD(3, 0, 0x05, 0xC0, 8)
/* not verified */
#define SOUND_GENERAL_OPEN_IRON_DOOR SOUND_ARG_LOAD(3, 0, 0x06, 0xC0, 8)
/* not verified */
#define SOUND_GENERAL_CLOSE_IRON_DOOR SOUND_ARG_LOAD(3, 0, 0x07, 0xC0, 8)
/* not verified */
#define SOUND_GENERAL_BUBBLES 0x3008
/* not verified */
#define SOUND_GENERAL_MOVING_WATER SOUND_ARG_LOAD(3, 0, 0x09, 0x00, 8)
/* not verified */
#define SOUND_GENERAL_SWISH_WATER SOUND_ARG_LOAD(3, 0, 0x0A, 0x00, 8)
/* not verified */
#define SOUND_GENERAL_QUIET_BUBBLE SOUND_ARG_LOAD(3, 0, 0x0B, 0x00, 8)
#define SOUND_GENERAL_VOLCANO_EXPLOSION SOUND_ARG_LOAD(3, 0, 0x0C, 0x80, 8)
/* not verified */ #define SOUND_GENERAL_QUIET_BUBBLE2 SOUND_ARG_LOAD(3, 0, 0x0D, 0x00, 8)
/* not verified */
#define SOUND_GENERAL_QUIET_BUBBLE2 SOUND_ARG_LOAD(3, 0, 0x0D, 0x00, 8)
#define SOUND_GENERAL_CASTLE_TRAP_OPEN SOUND_ARG_LOAD(3, 0, 0x0E, 0x80, 8)
#define SOUND_GENERAL_WALL_EXPLOSION SOUND_ARG_LOAD(3, 0, 0x0F, 0x00, 8)
/* not verified */ #define SOUND_GENERAL_COIN SOUND_ARG_LOAD(3, 8, 0x11, 0x80, 8)
/* not verified */ #define SOUND_GENERAL_COIN_WATER SOUND_ARG_LOAD(3, 8, 0x12, 0x80, 8)
/* not verified */ #define SOUND_GENERAL_SHORT_STAR SOUND_ARG_LOAD(3, 0, 0x16, 0x00, 9)
/* not verified */ #define SOUND_GENERAL_BIG_CLOCK SOUND_ARG_LOAD(3, 0, 0x17, 0x00, 8)
/* not verified */ #define SOUND_GENERAL_LOUD_POUND 0x3018 // _TERRAIN?
/* not verified */ #define SOUND_GENERAL_LOUD_POUND2 0x3019
/* not verified */ #define SOUND_GENERAL_SHORT_POUND1 0x301A
/* not verified */ #define SOUND_GENERAL_SHORT_POUND2 0x301B
/* not verified */ #define SOUND_GENERAL_SHORT_POUND3 0x301C
/* not verified */ #define SOUND_GENERAL_SHORT_POUND4 0x301D
/* not verified */ #define SOUND_GENERAL_SHORT_POUND5 0x301E
/* not verified */ #define SOUND_GENERAL_SHORT_POUND6 0x301F
/* not verified */
#define SOUND_GENERAL_COIN SOUND_ARG_LOAD(3, 8, 0x11, 0x80, 8)
/* not verified */
#define SOUND_GENERAL_COIN_WATER SOUND_ARG_LOAD(3, 8, 0x12, 0x80, 8)
/* not verified */
#define SOUND_GENERAL_SHORT_STAR SOUND_ARG_LOAD(3, 0, 0x16, 0x00, 9)
/* not verified */
#define SOUND_GENERAL_BIG_CLOCK SOUND_ARG_LOAD(3, 0, 0x17, 0x00, 8)
/* not verified */
#define SOUND_GENERAL_LOUD_POUND 0x3018 // _TERRAIN?
/* not verified */
#define SOUND_GENERAL_LOUD_POUND2 0x3019
/* not verified */
#define SOUND_GENERAL_SHORT_POUND1 0x301A
/* not verified */
#define SOUND_GENERAL_SHORT_POUND2 0x301B
/* not verified */
#define SOUND_GENERAL_SHORT_POUND3 0x301C
/* not verified */
#define SOUND_GENERAL_SHORT_POUND4 0x301D
/* not verified */
#define SOUND_GENERAL_SHORT_POUND5 0x301E
/* not verified */
#define SOUND_GENERAL_SHORT_POUND6 0x301F
#define SOUND_GENERAL_OPEN_CHEST SOUND_ARG_LOAD(3, 1, 0x20, 0x80, 8)
/* not verified */ #define SOUND_GENERAL_CLAM_SHELL1 SOUND_ARG_LOAD(3, 1, 0x22, 0x80, 8)
/* not verified */ #define SOUND_GENERAL_BOX_LANDING SOUND_ARG_LOAD(3, 0, 0x24, 0x00, 8)
/* not verified */ #define SOUND_GENERAL_BOX_LANDING_2 SOUND_ARG_LOAD(3, 2, 0x24, 0x00, 8)
/* not verified */ #define SOUND_GENERAL_UNKNOWN1 SOUND_ARG_LOAD(3, 0, 0x25, 0x00, 8)
/* not verified */ #define SOUND_GENERAL_UNKNOWN1_2 SOUND_ARG_LOAD(3, 2, 0x25, 0x00, 8)
/* not verified */ #define SOUND_GENERAL_CLAM_SHELL2 SOUND_ARG_LOAD(3, 0, 0x26, 0x40, 8)
/* not verified */ #define SOUND_GENERAL_CLAM_SHELL3 SOUND_ARG_LOAD(3, 0, 0x27, 0x40, 8)
/* not verified */
#define SOUND_GENERAL_CLAM_SHELL1 SOUND_ARG_LOAD(3, 1, 0x22, 0x80, 8)
/* not verified */
#define SOUND_GENERAL_BOX_LANDING SOUND_ARG_LOAD(3, 0, 0x24, 0x00, 8)
/* not verified */
#define SOUND_GENERAL_BOX_LANDING_2 SOUND_ARG_LOAD(3, 2, 0x24, 0x00, 8)
/* not verified */
#define SOUND_GENERAL_UNKNOWN1 SOUND_ARG_LOAD(3, 0, 0x25, 0x00, 8)
/* not verified */
#define SOUND_GENERAL_UNKNOWN1_2 SOUND_ARG_LOAD(3, 2, 0x25, 0x00, 8)
/* not verified */
#define SOUND_GENERAL_CLAM_SHELL2 SOUND_ARG_LOAD(3, 0, 0x26, 0x40, 8)
/* not verified */
#define SOUND_GENERAL_CLAM_SHELL3 SOUND_ARG_LOAD(3, 0, 0x27, 0x40, 8)
#ifdef VERSION_JP
#define SOUND_GENERAL_PAINTING_EJECT SOUND_ARG_LOAD(3, 8, 0x28, 0x00, 8)
#else
#define SOUND_GENERAL_PAINTING_EJECT SOUND_ARG_LOAD(3, 9, 0x28, 0x00, 8)
#endif
#define SOUND_GENERAL_LEVEL_SELECT_CHANGE SOUND_ARG_LOAD(3, 0, 0x2B, 0x00, 8)
/* not verified */ #define SOUND_GENERAL_PLATFORM SOUND_ARG_LOAD(3, 0, 0x2D, 0x80, 8)
/* not verified */
#define SOUND_GENERAL_PLATFORM SOUND_ARG_LOAD(3, 0, 0x2D, 0x80, 8)
#define SOUND_GENERAL_DONUT_PLATFORM_EXPLOSION SOUND_ARG_LOAD(3, 0, 0x2E, 0x20, 8)
#define SOUND_GENERAL_BOWSER_BOMB_EXPLOSION SOUND_ARG_LOAD(3, 1, 0x2F, 0x00, 8)
/* not verified */ #define SOUND_GENERAL_COIN_SPURT SOUND_ARG_LOAD(3, 0, 0x30, 0x00, 8)
/* not verified */ #define SOUND_GENERAL_COIN_SPURT_2 SOUND_ARG_LOAD(3, 8, 0x30, 0x00, 8)
/* not verified */ #define SOUND_GENERAL_COIN_SPURT_EU SOUND_ARG_LOAD(3, 8, 0x30, 0x20, 8)
/* not verified */
#define SOUND_GENERAL_COIN_SPURT SOUND_ARG_LOAD(3, 0, 0x30, 0x00, 8)
/* not verified */
#define SOUND_GENERAL_COIN_SPURT_2 SOUND_ARG_LOAD(3, 8, 0x30, 0x00, 8)
/* not verified */
#define SOUND_GENERAL_COIN_SPURT_EU SOUND_ARG_LOAD(3, 8, 0x30, 0x20, 8)
/* not verified */ #define SOUND_GENERAL_EXPLOSION6 0x3031
/* not verified */ #define SOUND_GENERAL_UNK32 0x3032
/* not verified */ #define SOUND_GENERAL_BOAT_TILT1 SOUND_ARG_LOAD(3, 0, 0x34, 0x40, 8)
/* not verified */ #define SOUND_GENERAL_BOAT_TILT2 SOUND_ARG_LOAD(3, 0, 0x35, 0x40, 8)
/* not verified */ #define SOUND_GENERAL_COIN_DROP SOUND_ARG_LOAD(3, 0, 0x36, 0x40, 8)
/* not verified */ #define SOUND_GENERAL_UNKNOWN3_LOWPRIO SOUND_ARG_LOAD(3, 0, 0x37, 0x00, 8)
/* not verified */ #define SOUND_GENERAL_UNKNOWN3 SOUND_ARG_LOAD(3, 0, 0x37, 0x80, 8)
/* not verified */ #define SOUND_GENERAL_UNKNOWN3_2 SOUND_ARG_LOAD(3, 8, 0x37, 0x80, 8)
/* not verified */
#define SOUND_GENERAL_EXPLOSION6 0x3031
/* not verified */
#define SOUND_GENERAL_UNK32 0x3032
/* not verified */
#define SOUND_GENERAL_BOAT_TILT1 SOUND_ARG_LOAD(3, 0, 0x34, 0x40, 8)
/* not verified */
#define SOUND_GENERAL_BOAT_TILT2 SOUND_ARG_LOAD(3, 0, 0x35, 0x40, 8)
/* not verified */
#define SOUND_GENERAL_COIN_DROP SOUND_ARG_LOAD(3, 0, 0x36, 0x40, 8)
/* not verified */
#define SOUND_GENERAL_UNKNOWN3_LOWPRIO SOUND_ARG_LOAD(3, 0, 0x37, 0x00, 8)
/* not verified */
#define SOUND_GENERAL_UNKNOWN3 SOUND_ARG_LOAD(3, 0, 0x37, 0x80, 8)
/* not verified */
#define SOUND_GENERAL_UNKNOWN3_2 SOUND_ARG_LOAD(3, 8, 0x37, 0x80, 8)
#define SOUND_GENERAL_PENDULUM_SWING SOUND_ARG_LOAD(3, 0, 0x38, 0x00, 8)
/* not verified */ #define SOUND_GENERAL_CHAIN_CHOMP1 SOUND_ARG_LOAD(3, 0, 0x39, 0x00, 8)
/* not verified */ #define SOUND_GENERAL_CHAIN_CHOMP2 SOUND_ARG_LOAD(3, 0, 0x3A, 0x00, 8)
/* not verified */
#define SOUND_GENERAL_CHAIN_CHOMP1 SOUND_ARG_LOAD(3, 0, 0x39, 0x00, 8)
/* not verified */
#define SOUND_GENERAL_CHAIN_CHOMP2 SOUND_ARG_LOAD(3, 0, 0x3A, 0x00, 8)
#define SOUND_GENERAL_DOOR_TURN_KEY SOUND_ARG_LOAD(3, 0, 0x3B, 0x00, 8)
/* not verified */ #define SOUND_GENERAL_MOVING_IN_SAND SOUND_ARG_LOAD(3, 0, 0x3C, 0x00, 8)
/* not verified */ #define SOUND_GENERAL_UNKNOWN4_LOWPRIO SOUND_ARG_LOAD(3, 0, 0x3D, 0x00, 8)
/* not verified */ #define SOUND_GENERAL_UNKNOWN4 SOUND_ARG_LOAD(3, 0, 0x3D, 0x80, 8)
/* not verified */
#define SOUND_GENERAL_MOVING_IN_SAND SOUND_ARG_LOAD(3, 0, 0x3C, 0x00, 8)
/* not verified */
#define SOUND_GENERAL_UNKNOWN4_LOWPRIO SOUND_ARG_LOAD(3, 0, 0x3D, 0x00, 8)
/* not verified */
#define SOUND_GENERAL_UNKNOWN4 SOUND_ARG_LOAD(3, 0, 0x3D, 0x80, 8)
#define SOUND_GENERAL_MOVING_PLATFORM_SWITCH SOUND_ARG_LOAD(3, 0, 0x3E, 0x00, 8)
/* not verified */ #define SOUND_GENERAL_CAGE_OPEN SOUND_ARG_LOAD(3, 0, 0x3F, 0xA0, 8)
/* not verified */ #define SOUND_GENERAL_QUIET_POUND1_LOWPRIO SOUND_ARG_LOAD(3, 0, 0x40, 0x00, 8)
/* not verified */ #define SOUND_GENERAL_QUIET_POUND1 SOUND_ARG_LOAD(3, 0, 0x40, 0x40, 8)
/* not verified */ #define SOUND_GENERAL_BREAK_BOX SOUND_ARG_LOAD(3, 0, 0x41, 0xC0, 8)
/* not verified */
#define SOUND_GENERAL_CAGE_OPEN SOUND_ARG_LOAD(3, 0, 0x3F, 0xA0, 8)
/* not verified */
#define SOUND_GENERAL_QUIET_POUND1_LOWPRIO SOUND_ARG_LOAD(3, 0, 0x40, 0x00, 8)
/* not verified */
#define SOUND_GENERAL_QUIET_POUND1 SOUND_ARG_LOAD(3, 0, 0x40, 0x40, 8)
/* not verified */
#define SOUND_GENERAL_BREAK_BOX SOUND_ARG_LOAD(3, 0, 0x41, 0xC0, 8)
#define SOUND_GENERAL_DOOR_INSERT_KEY SOUND_ARG_LOAD(3, 0, 0x42, 0x00, 8)
/* not verified */ #define SOUND_GENERAL_QUIET_POUND2 SOUND_ARG_LOAD(3, 0, 0x43, 0x00, 8)
/* not verified */ #define SOUND_GENERAL_BIG_POUND SOUND_ARG_LOAD(3, 0, 0x44, 0x00, 8)
/* not verified */ #define SOUND_GENERAL_UNK45 SOUND_ARG_LOAD(3, 0, 0x45, 0x00, 8)
/* not verified */ #define SOUND_GENERAL_UNK46_LOWPRIO SOUND_ARG_LOAD(3, 0, 0x46, 0x00, 8)
/* not verified */ #define SOUND_GENERAL_UNK46 SOUND_ARG_LOAD(3, 0, 0x46, 0x80, 8)
/* not verified */ #define SOUND_GENERAL_CANNON_UP SOUND_ARG_LOAD(3, 0, 0x47, 0x80, 8)
/* not verified */ #define SOUND_GENERAL_GRINDEL_ROLL SOUND_ARG_LOAD(3, 0, 0x48, 0x00, 8)
/* not verified */ #define SOUND_GENERAL_EXPLOSION7 0x3049
/* not verified */ #define SOUND_GENERAL_SHAKE_COFFIN 0x304A
/* not verified */ #define SOUND_GENERAL_RACE_GUN_SHOT SOUND_ARG_LOAD(3, 1, 0x4D, 0x40, 8)
/* not verified */ #define SOUND_GENERAL_STAR_DOOR_OPEN SOUND_ARG_LOAD(3, 0, 0x4E, 0xC0, 8)
/* not verified */ #define SOUND_GENERAL_STAR_DOOR_CLOSE SOUND_ARG_LOAD(3, 0, 0x4F, 0xC0, 8)
/* not verified */ #define SOUND_GENERAL_POUND_ROCK SOUND_ARG_LOAD(3, 0, 0x56, 0x00, 8)
/* not verified */ #define SOUND_GENERAL_STAR_APPEARS SOUND_ARG_LOAD(3, 0, 0x57, 0xFF, 9)
/* not verified */
#define SOUND_GENERAL_QUIET_POUND2 SOUND_ARG_LOAD(3, 0, 0x43, 0x00, 8)
/* not verified */
#define SOUND_GENERAL_BIG_POUND SOUND_ARG_LOAD(3, 0, 0x44, 0x00, 8)
/* not verified */
#define SOUND_GENERAL_UNK45 SOUND_ARG_LOAD(3, 0, 0x45, 0x00, 8)
/* not verified */
#define SOUND_GENERAL_UNK46_LOWPRIO SOUND_ARG_LOAD(3, 0, 0x46, 0x00, 8)
/* not verified */
#define SOUND_GENERAL_UNK46 SOUND_ARG_LOAD(3, 0, 0x46, 0x80, 8)
/* not verified */
#define SOUND_GENERAL_CANNON_UP SOUND_ARG_LOAD(3, 0, 0x47, 0x80, 8)
/* not verified */
#define SOUND_GENERAL_GRINDEL_ROLL SOUND_ARG_LOAD(3, 0, 0x48, 0x00, 8)
/* not verified */
#define SOUND_GENERAL_EXPLOSION7 0x3049
/* not verified */
#define SOUND_GENERAL_SHAKE_COFFIN 0x304A
/* not verified */
#define SOUND_GENERAL_RACE_GUN_SHOT SOUND_ARG_LOAD(3, 1, 0x4D, 0x40, 8)
/* not verified */
#define SOUND_GENERAL_STAR_DOOR_OPEN SOUND_ARG_LOAD(3, 0, 0x4E, 0xC0, 8)
/* not verified */
#define SOUND_GENERAL_STAR_DOOR_CLOSE SOUND_ARG_LOAD(3, 0, 0x4F, 0xC0, 8)
/* not verified */
#define SOUND_GENERAL_POUND_ROCK SOUND_ARG_LOAD(3, 0, 0x56, 0x00, 8)
/* not verified */
#define SOUND_GENERAL_STAR_APPEARS SOUND_ARG_LOAD(3, 0, 0x57, 0xFF, 9)
#define SOUND_GENERAL_COLLECT_1UP SOUND_ARG_LOAD(3, 0, 0x58, 0xFF, 8)
/* not verified */ #define SOUND_GENERAL_BUTTON_PRESS_LOWPRIO SOUND_ARG_LOAD(3, 0, 0x5A, 0x00, 8)
/* not verified */ #define SOUND_GENERAL_BUTTON_PRESS SOUND_ARG_LOAD(3, 0, 0x5A, 0x40, 8)
/* not verified */ #define SOUND_GENERAL_BUTTON_PRESS_2_LOWPRIO SOUND_ARG_LOAD(3, 1, 0x5A, 0x00, 8)
/* not verified */ #define SOUND_GENERAL_BUTTON_PRESS_2 SOUND_ARG_LOAD(3, 1, 0x5A, 0x40, 8)
/* not verified */ #define SOUND_GENERAL_ELEVATOR_MOVE SOUND_ARG_LOAD(3, 0, 0x5B, 0x00, 8)
/* not verified */ #define SOUND_GENERAL_ELEVATOR_MOVE_2 SOUND_ARG_LOAD(3, 1, 0x5B, 0x00, 8)
/* not verified */ #define SOUND_GENERAL_SWISH_AIR SOUND_ARG_LOAD(3, 0, 0x5C, 0x00, 8)
/* not verified */ #define SOUND_GENERAL_SWISH_AIR_2 SOUND_ARG_LOAD(3, 1, 0x5C, 0x00, 8)
/* not verified */ #define SOUND_GENERAL_HAUNTED_CHAIR SOUND_ARG_LOAD(3, 0, 0x5D, 0x00, 8)
/* not verified */ #define SOUND_GENERAL_SOFT_LANDING SOUND_ARG_LOAD(3, 0, 0x5E, 0x00, 8)
/* not verified */ #define SOUND_GENERAL_HAUNTED_CHAIR_MOVE SOUND_ARG_LOAD(3, 0, 0x5F, 0x00, 8)
/* not verified */ #define SOUND_GENERAL_BOWSER_PLATFORM SOUND_ARG_LOAD(3, 0, 0x62, 0x80, 8)
/* not verified */ #define SOUND_GENERAL_BOWSER_PLATFORM_2 SOUND_ARG_LOAD(3, 1, 0x62, 0x80, 8)
/* not verified */ #define SOUND_GENERAL_HEART_SPIN SOUND_ARG_LOAD(3, 0, 0x64, 0xC0, 8)
/* not verified */ #define SOUND_GENERAL_POUND_WOOD_POST SOUND_ARG_LOAD(3, 0, 0x65, 0xC0, 8)
/* not verified */ #define SOUND_GENERAL_WATER_LEVEL_TRIG SOUND_ARG_LOAD(3, 0, 0x66, 0x80, 8)
/* not verified */ #define SOUND_GENERAL_SWITCH_DOOR_OPEN SOUND_ARG_LOAD(3, 0, 0x67, 0xA0, 8)
/* not verified */ #define SOUND_GENERAL_RED_COIN SOUND_ARG_LOAD(3, 0, 0x68, 0x90, 8)
/* not verified */ #define SOUND_GENERAL_BIRDS_FLY_AWAY SOUND_ARG_LOAD(3, 0, 0x69, 0x00, 8)
/* not verified */ #define SOUND_GENERAL_METAL_POUND SOUND_ARG_LOAD(3, 0, 0x6B, 0x80, 8)
/* not verified */ #define SOUND_GENERAL_BOING1 SOUND_ARG_LOAD(3, 0, 0x6C, 0x40, 8)
/* not verified */ #define SOUND_GENERAL_BOING2_LOWPRIO SOUND_ARG_LOAD(3, 0, 0x6D, 0x20, 8)
/* not verified */ #define SOUND_GENERAL_BOING2 SOUND_ARG_LOAD(3, 0, 0x6D, 0x40, 8)
/* not verified */ #define SOUND_GENERAL_YOSHI_WALK SOUND_ARG_LOAD(3, 0, 0x6E, 0x20, 8)
/* not verified */ #define SOUND_GENERAL_ENEMY_ALERT1 SOUND_ARG_LOAD(3, 0, 0x6F, 0x30, 8)
/* not verified */ #define SOUND_GENERAL_YOSHI_TALK SOUND_ARG_LOAD(3, 0, 0x70, 0x30, 8)
/* not verified */ #define SOUND_GENERAL_SPLATTERING SOUND_ARG_LOAD(3, 0, 0x71, 0x30, 8)
/* not verified */ #define SOUND_GENERAL_BOING3 0x3072
/* not verified */ #define SOUND_GENERAL_GRAND_STAR SOUND_ARG_LOAD(3, 0, 0x73, 0x00, 8)
/* not verified */ #define SOUND_GENERAL_GRAND_STAR_JUMP SOUND_ARG_LOAD(3, 0, 0x74, 0x00, 8)
/* not verified */ #define SOUND_GENERAL_BOAT_ROCK SOUND_ARG_LOAD(3, 0, 0x75, 0x00, 8)
/* not verified */ #define SOUND_GENERAL_VANISH_SFX SOUND_ARG_LOAD(3, 0, 0x76, 0x20, 8)
/* not verified */
#define SOUND_GENERAL_BUTTON_PRESS_LOWPRIO SOUND_ARG_LOAD(3, 0, 0x5A, 0x00, 8)
/* not verified */
#define SOUND_GENERAL_BUTTON_PRESS SOUND_ARG_LOAD(3, 0, 0x5A, 0x40, 8)
/* not verified */
#define SOUND_GENERAL_BUTTON_PRESS_2_LOWPRIO SOUND_ARG_LOAD(3, 1, 0x5A, 0x00, 8)
/* not verified */
#define SOUND_GENERAL_BUTTON_PRESS_2 SOUND_ARG_LOAD(3, 1, 0x5A, 0x40, 8)
/* not verified */
#define SOUND_GENERAL_ELEVATOR_MOVE SOUND_ARG_LOAD(3, 0, 0x5B, 0x00, 8)
/* not verified */
#define SOUND_GENERAL_ELEVATOR_MOVE_2 SOUND_ARG_LOAD(3, 1, 0x5B, 0x00, 8)
/* not verified */
#define SOUND_GENERAL_SWISH_AIR SOUND_ARG_LOAD(3, 0, 0x5C, 0x00, 8)
/* not verified */
#define SOUND_GENERAL_SWISH_AIR_2 SOUND_ARG_LOAD(3, 1, 0x5C, 0x00, 8)
/* not verified */
#define SOUND_GENERAL_HAUNTED_CHAIR SOUND_ARG_LOAD(3, 0, 0x5D, 0x00, 8)
/* not verified */
#define SOUND_GENERAL_SOFT_LANDING SOUND_ARG_LOAD(3, 0, 0x5E, 0x00, 8)
/* not verified */
#define SOUND_GENERAL_HAUNTED_CHAIR_MOVE SOUND_ARG_LOAD(3, 0, 0x5F, 0x00, 8)
/* not verified */
#define SOUND_GENERAL_BOWSER_PLATFORM SOUND_ARG_LOAD(3, 0, 0x62, 0x80, 8)
/* not verified */
#define SOUND_GENERAL_BOWSER_PLATFORM_2 SOUND_ARG_LOAD(3, 1, 0x62, 0x80, 8)
/* not verified */
#define SOUND_GENERAL_HEART_SPIN SOUND_ARG_LOAD(3, 0, 0x64, 0xC0, 8)
/* not verified */
#define SOUND_GENERAL_POUND_WOOD_POST SOUND_ARG_LOAD(3, 0, 0x65, 0xC0, 8)
/* not verified */
#define SOUND_GENERAL_WATER_LEVEL_TRIG SOUND_ARG_LOAD(3, 0, 0x66, 0x80, 8)
/* not verified */
#define SOUND_GENERAL_SWITCH_DOOR_OPEN SOUND_ARG_LOAD(3, 0, 0x67, 0xA0, 8)
/* not verified */
#define SOUND_GENERAL_RED_COIN SOUND_ARG_LOAD(3, 0, 0x68, 0x90, 8)
/* not verified */
#define SOUND_GENERAL_BIRDS_FLY_AWAY SOUND_ARG_LOAD(3, 0, 0x69, 0x00, 8)
/* not verified */
#define SOUND_GENERAL_METAL_POUND SOUND_ARG_LOAD(3, 0, 0x6B, 0x80, 8)
/* not verified */
#define SOUND_GENERAL_BOING1 SOUND_ARG_LOAD(3, 0, 0x6C, 0x40, 8)
/* not verified */
#define SOUND_GENERAL_BOING2_LOWPRIO SOUND_ARG_LOAD(3, 0, 0x6D, 0x20, 8)
/* not verified */
#define SOUND_GENERAL_BOING2 SOUND_ARG_LOAD(3, 0, 0x6D, 0x40, 8)
/* not verified */
#define SOUND_GENERAL_YOSHI_WALK SOUND_ARG_LOAD(3, 0, 0x6E, 0x20, 8)
/* not verified */
#define SOUND_GENERAL_ENEMY_ALERT1 SOUND_ARG_LOAD(3, 0, 0x6F, 0x30, 8)
/* not verified */
#define SOUND_GENERAL_YOSHI_TALK SOUND_ARG_LOAD(3, 0, 0x70, 0x30, 8)
/* not verified */
#define SOUND_GENERAL_SPLATTERING SOUND_ARG_LOAD(3, 0, 0x71, 0x30, 8)
/* not verified */
#define SOUND_GENERAL_BOING3 0x3072
/* not verified */
#define SOUND_GENERAL_GRAND_STAR SOUND_ARG_LOAD(3, 0, 0x73, 0x00, 8)
/* not verified */
#define SOUND_GENERAL_GRAND_STAR_JUMP SOUND_ARG_LOAD(3, 0, 0x74, 0x00, 8)
/* not verified */
#define SOUND_GENERAL_BOAT_ROCK SOUND_ARG_LOAD(3, 0, 0x75, 0x00, 8)
/* not verified */
#define SOUND_GENERAL_VANISH_SFX SOUND_ARG_LOAD(3, 0, 0x76, 0x20, 8)
/* Environment Sound Effects */
/* not verified */ #define SOUND_ENV_WATERFALL1 SOUND_ARG_LOAD(4, 0, 0x00, 0x00, 0)
/* not verified */ #define SOUND_ENV_WATERFALL2 SOUND_ARG_LOAD(4, 0, 0x01, 0x00, 0)
/* not verified */ #define SOUND_ENV_ELEVATOR1 SOUND_ARG_LOAD(4, 0, 0x02, 0x00, 0)
/* not verified */ #define SOUND_ENV_DRONING1 SOUND_ARG_LOAD(4, 1, 0x03, 0x00, 0)
/* not verified */ #define SOUND_ENV_DRONING2 SOUND_ARG_LOAD(4, 0, 0x04, 0x00, 0)
/* not verified */ #define SOUND_ENV_WIND1 SOUND_ARG_LOAD(4, 0, 0x05, 0x00, 0)
/* not verified */ #define SOUND_ENV_MOVING_SAND_SNOW 0x4006
/* not verified */ #define SOUND_ENV_UNK07 0x4007
/* not verified */ #define SOUND_ENV_ELEVATOR2 SOUND_ARG_LOAD(4, 0, 0x08, 0x00, 0)
/* not verified */ #define SOUND_ENV_WATER SOUND_ARG_LOAD(4, 0, 0x09, 0x00, 0)
/* not verified */ #define SOUND_ENV_UNKNOWN2 SOUND_ARG_LOAD(4, 0, 0x0A, 0x00, 0)
/* not verified */ #define SOUND_ENV_BOAT_ROCKING1 SOUND_ARG_LOAD(4, 0, 0x0B, 0x00, 0)
/* not verified */ #define SOUND_ENV_ELEVATOR3 SOUND_ARG_LOAD(4, 0, 0x0C, 0x00, 0)
/* not verified */ #define SOUND_ENV_ELEVATOR4 SOUND_ARG_LOAD(4, 0, 0x0D, 0x00, 0)
/* not verified */ #define SOUND_ENV_ELEVATOR4_2 SOUND_ARG_LOAD(4, 1, 0x0D, 0x00, 0)
/* not verified */ #define SOUND_ENV_MOVINGSAND SOUND_ARG_LOAD(4, 0, 0x0E, 0x00, 0)
/* not verified */ #define SOUND_ENV_MERRY_GO_ROUND_CREAKING SOUND_ARG_LOAD(4, 0, 0x0F, 0x40, 0)
/* not verified */ #define SOUND_ENV_WIND2 SOUND_ARG_LOAD(4, 0, 0x10, 0x80, 0)
/* not verified */ #define SOUND_ENV_UNK12 0x4012
/* not verified */ #define SOUND_ENV_SLIDING SOUND_ARG_LOAD(4, 0, 0x13, 0x00, 0)
/* not verified */ #define SOUND_ENV_STAR SOUND_ARG_LOAD(4, 0, 0x14, 0x00, 1)
/* not verified */ #define SOUND_ENV_UNKNOWN4 SOUND_ARG_LOAD(4, 1, 0x15, 0x00, 0)
/* not verified */ #define SOUND_ENV_WATER_DRAIN SOUND_ARG_LOAD(4, 1, 0x16, 0x00, 0)
/* not verified */ #define SOUND_ENV_METAL_BOX_PUSH SOUND_ARG_LOAD(4, 0, 0x17, 0x80, 0)
/* not verified */ #define SOUND_ENV_SINK_QUICKSAND SOUND_ARG_LOAD(4, 0, 0x18, 0x80, 0)
/* not verified */
#define SOUND_ENV_WATERFALL1 SOUND_ARG_LOAD(4, 0, 0x00, 0x00, 0)
/* not verified */
#define SOUND_ENV_WATERFALL2 SOUND_ARG_LOAD(4, 0, 0x01, 0x00, 0)
/* not verified */
#define SOUND_ENV_ELEVATOR1 SOUND_ARG_LOAD(4, 0, 0x02, 0x00, 0)
/* not verified */
#define SOUND_ENV_DRONING1 SOUND_ARG_LOAD(4, 1, 0x03, 0x00, 0)
/* not verified */
#define SOUND_ENV_DRONING2 SOUND_ARG_LOAD(4, 0, 0x04, 0x00, 0)
/* not verified */
#define SOUND_ENV_WIND1 SOUND_ARG_LOAD(4, 0, 0x05, 0x00, 0)
/* not verified */
#define SOUND_ENV_MOVING_SAND_SNOW 0x4006
/* not verified */
#define SOUND_ENV_UNK07 0x4007
/* not verified */
#define SOUND_ENV_ELEVATOR2 SOUND_ARG_LOAD(4, 0, 0x08, 0x00, 0)
/* not verified */
#define SOUND_ENV_WATER SOUND_ARG_LOAD(4, 0, 0x09, 0x00, 0)
/* not verified */
#define SOUND_ENV_UNKNOWN2 SOUND_ARG_LOAD(4, 0, 0x0A, 0x00, 0)
/* not verified */
#define SOUND_ENV_BOAT_ROCKING1 SOUND_ARG_LOAD(4, 0, 0x0B, 0x00, 0)
/* not verified */
#define SOUND_ENV_ELEVATOR3 SOUND_ARG_LOAD(4, 0, 0x0C, 0x00, 0)
/* not verified */
#define SOUND_ENV_ELEVATOR4 SOUND_ARG_LOAD(4, 0, 0x0D, 0x00, 0)
/* not verified */
#define SOUND_ENV_ELEVATOR4_2 SOUND_ARG_LOAD(4, 1, 0x0D, 0x00, 0)
/* not verified */
#define SOUND_ENV_MOVINGSAND SOUND_ARG_LOAD(4, 0, 0x0E, 0x00, 0)
/* not verified */
#define SOUND_ENV_MERRY_GO_ROUND_CREAKING SOUND_ARG_LOAD(4, 0, 0x0F, 0x40, 0)
/* not verified */
#define SOUND_ENV_WIND2 SOUND_ARG_LOAD(4, 0, 0x10, 0x80, 0)
/* not verified */
#define SOUND_ENV_UNK12 0x4012
/* not verified */
#define SOUND_ENV_SLIDING SOUND_ARG_LOAD(4, 0, 0x13, 0x00, 0)
/* not verified */
#define SOUND_ENV_STAR SOUND_ARG_LOAD(4, 0, 0x14, 0x00, 1)
/* not verified */
#define SOUND_ENV_UNKNOWN4 SOUND_ARG_LOAD(4, 1, 0x15, 0x00, 0)
/* not verified */
#define SOUND_ENV_WATER_DRAIN SOUND_ARG_LOAD(4, 1, 0x16, 0x00, 0)
/* not verified */
#define SOUND_ENV_METAL_BOX_PUSH SOUND_ARG_LOAD(4, 0, 0x17, 0x80, 0)
/* not verified */
#define SOUND_ENV_SINK_QUICKSAND SOUND_ARG_LOAD(4, 0, 0x18, 0x80, 0)
/* Object Sound Effects */
#define SOUND_OBJ_SUSHI_SHARK_WATER_SOUND SOUND_ARG_LOAD(5, 0, 0x00, 0x80, 8)
@@ -400,45 +564,69 @@
#define SOUND_OBJ_BOO_BOUNCE_TOP SOUND_ARG_LOAD(5, 0, 0x0A, 0x00, 8)
#define SOUND_OBJ_BOO_LAUGH_SHORT SOUND_ARG_LOAD(5, 0, 0x0B, 0x00, 8)
#define SOUND_OBJ_THWOMP SOUND_ARG_LOAD(5, 0, 0x0C, 0xA0, 8)
/* not verified */ #define SOUND_OBJ_CANNON1 SOUND_ARG_LOAD(5, 0, 0x0D, 0xF0, 8)
/* not verified */ #define SOUND_OBJ_CANNON2 SOUND_ARG_LOAD(5, 0, 0x0E, 0xF0, 8)
/* not verified */ #define SOUND_OBJ_CANNON3 SOUND_ARG_LOAD(5, 0, 0x0F, 0xF0, 8)
/* not verified */ #define SOUND_OBJ_JUMP_WALK_WATER 0x5012
/* not verified */ #define SOUND_OBJ_UNKNOWN2 SOUND_ARG_LOAD(5, 0, 0x13, 0x00, 8)
/* not verified */
#define SOUND_OBJ_CANNON1 SOUND_ARG_LOAD(5, 0, 0x0D, 0xF0, 8)
/* not verified */
#define SOUND_OBJ_CANNON2 SOUND_ARG_LOAD(5, 0, 0x0E, 0xF0, 8)
/* not verified */
#define SOUND_OBJ_CANNON3 SOUND_ARG_LOAD(5, 0, 0x0F, 0xF0, 8)
/* not verified */
#define SOUND_OBJ_JUMP_WALK_WATER 0x5012
/* not verified */
#define SOUND_OBJ_UNKNOWN2 SOUND_ARG_LOAD(5, 0, 0x13, 0x00, 8)
#define SOUND_OBJ_MRI_DEATH SOUND_ARG_LOAD(5, 0, 0x14, 0x00, 8)
/* not verified */ #define SOUND_OBJ_POUNDING1 SOUND_ARG_LOAD(5, 0, 0x15, 0x50, 8)
/* not verified */ #define SOUND_OBJ_POUNDING1_HIGHPRIO SOUND_ARG_LOAD(5, 0, 0x15, 0x80, 8)
/* not verified */
#define SOUND_OBJ_POUNDING1 SOUND_ARG_LOAD(5, 0, 0x15, 0x50, 8)
/* not verified */
#define SOUND_OBJ_POUNDING1_HIGHPRIO SOUND_ARG_LOAD(5, 0, 0x15, 0x80, 8)
#define SOUND_OBJ_WHOMP_LOWPRIO SOUND_ARG_LOAD(5, 0, 0x16, 0x60, 8)
#define SOUND_OBJ_KING_BOBOMB SOUND_ARG_LOAD(5, 0, 0x16, 0x80, 8)
/* not verified */ #define SOUND_OBJ_BULLY_METAL SOUND_ARG_LOAD(5, 0, 0x17, 0x80, 8)
/* not verified */ #define SOUND_OBJ_BULLY_EXPLODE SOUND_ARG_LOAD(5, 0, 0x18, 0xA0, 8)
/* not verified */ #define SOUND_OBJ_BULLY_EXPLODE_2 SOUND_ARG_LOAD(5, 1, 0x18, 0xA0, 8)
/* not verified */ #define SOUND_OBJ_POUNDING_CANNON SOUND_ARG_LOAD(5, 0, 0x1A, 0x50, 8)
/* not verified */ #define SOUND_OBJ_BULLY_WALK SOUND_ARG_LOAD(5, 0, 0x1B, 0x30, 8)
/* not verified */ #define SOUND_OBJ_UNKNOWN3 SOUND_ARG_LOAD(5, 0, 0x1D, 0x80, 8)
/* not verified */ #define SOUND_OBJ_UNKNOWN4 SOUND_ARG_LOAD(5, 0, 0x1E, 0xA0, 8)
/* not verified */
#define SOUND_OBJ_BULLY_METAL SOUND_ARG_LOAD(5, 0, 0x17, 0x80, 8)
/* not verified */
#define SOUND_OBJ_BULLY_EXPLODE SOUND_ARG_LOAD(5, 0, 0x18, 0xA0, 8)
/* not verified */
#define SOUND_OBJ_BULLY_EXPLODE_2 SOUND_ARG_LOAD(5, 1, 0x18, 0xA0, 8)
/* not verified */
#define SOUND_OBJ_POUNDING_CANNON SOUND_ARG_LOAD(5, 0, 0x1A, 0x50, 8)
/* not verified */
#define SOUND_OBJ_BULLY_WALK SOUND_ARG_LOAD(5, 0, 0x1B, 0x30, 8)
/* not verified */
#define SOUND_OBJ_UNKNOWN3 SOUND_ARG_LOAD(5, 0, 0x1D, 0x80, 8)
/* not verified */
#define SOUND_OBJ_UNKNOWN4 SOUND_ARG_LOAD(5, 0, 0x1E, 0xA0, 8)
#define SOUND_OBJ_BABY_PENGUIN_DIVE SOUND_ARG_LOAD(5, 0, 0x1F, 0x40, 8)
#define SOUND_OBJ_GOOMBA_WALK SOUND_ARG_LOAD(5, 0, 0x20, 0x00, 8)
#define SOUND_OBJ_UKIKI_CHATTER_LONG SOUND_ARG_LOAD(5, 0, 0x21, 0x00, 8)
#define SOUND_OBJ_MONTY_MOLE_ATTACK SOUND_ARG_LOAD(5, 0, 0x22, 0x00, 8)
#define SOUND_OBJ_EVIL_LAKITU_THROW SOUND_ARG_LOAD(5, 0, 0x22, 0x20, 8)
/* not verified */ #define SOUND_OBJ_UNK23 0x5023
/* not verified */
#define SOUND_OBJ_UNK23 0x5023
#define SOUND_OBJ_DYING_ENEMY1 SOUND_ARG_LOAD(5, 0, 0x24, 0x40, 8)
/* not verified */ #define SOUND_OBJ_CANNON4 SOUND_ARG_LOAD(5, 0, 0x25, 0x40, 8)
/* not verified */ #define SOUND_OBJ_DYING_ENEMY2 0x5026
/* not verified */
#define SOUND_OBJ_CANNON4 SOUND_ARG_LOAD(5, 0, 0x25, 0x40, 8)
/* not verified */
#define SOUND_OBJ_DYING_ENEMY2 0x5026
#define SOUND_OBJ_BOBOMB_WALK SOUND_ARG_LOAD(5, 0, 0x27, 0x00, 8)
/* not verified */ #define SOUND_OBJ_SOMETHING_LANDING SOUND_ARG_LOAD(5, 0, 0x28, 0x80, 8)
/* not verified */ #define SOUND_OBJ_DIVING_IN_WATER SOUND_ARG_LOAD(5, 0, 0x29, 0xA0, 8)
/* not verified */ #define SOUND_OBJ_SNOW_SAND1 SOUND_ARG_LOAD(5, 0, 0x2A, 0x00, 8)
/* not verified */ #define SOUND_OBJ_SNOW_SAND2 SOUND_ARG_LOAD(5, 0, 0x2B, 0x00, 8)
/* not verified */
#define SOUND_OBJ_SOMETHING_LANDING SOUND_ARG_LOAD(5, 0, 0x28, 0x80, 8)
/* not verified */
#define SOUND_OBJ_DIVING_IN_WATER SOUND_ARG_LOAD(5, 0, 0x29, 0xA0, 8)
/* not verified */
#define SOUND_OBJ_SNOW_SAND1 SOUND_ARG_LOAD(5, 0, 0x2A, 0x00, 8)
/* not verified */
#define SOUND_OBJ_SNOW_SAND2 SOUND_ARG_LOAD(5, 0, 0x2B, 0x00, 8)
#define SOUND_OBJ_DEFAULT_DEATH SOUND_ARG_LOAD(5, 0, 0x2C, 0x80, 8)
#define SOUND_OBJ_BIG_PENGUIN_YELL SOUND_ARG_LOAD(5, 0, 0x2D, 0x00, 8)
#define SOUND_OBJ_WATER_BOMB_BOUNCING SOUND_ARG_LOAD(5, 0, 0x2E, 0x80, 8)
#define SOUND_OBJ_GOOMBA_ALERT SOUND_ARG_LOAD(5, 0, 0x2F, 0x00, 8)
#define SOUND_OBJ_WIGGLER_JUMP SOUND_ARG_LOAD(5, 0, 0x2F, 0x60, 8)
/* not verified */ #define SOUND_OBJ_STOMPED SOUND_ARG_LOAD(5, 0, 0x30, 0x80, 8)
/* not verified */ #define SOUND_OBJ_UNKNOWN6 SOUND_ARG_LOAD(5, 0, 0x31, 0x00, 8)
/* not verified */ #define SOUND_OBJ_DIVING_INTO_WATER SOUND_ARG_LOAD(5, 0, 0x32, 0x40, 8)
/* not verified */
#define SOUND_OBJ_STOMPED SOUND_ARG_LOAD(5, 0, 0x30, 0x80, 8)
/* not verified */
#define SOUND_OBJ_UNKNOWN6 SOUND_ARG_LOAD(5, 0, 0x31, 0x00, 8)
/* not verified */
#define SOUND_OBJ_DIVING_INTO_WATER SOUND_ARG_LOAD(5, 0, 0x32, 0x40, 8)
#define SOUND_OBJ_PIRANHA_PLANT_SHRINK SOUND_ARG_LOAD(5, 0, 0x33, 0x40, 8)
#define SOUND_OBJ_KOOPA_THE_QUICK_WALK SOUND_ARG_LOAD(5, 0, 0x34, 0x20, 8)
#define SOUND_OBJ_KOOPA_WALK SOUND_ARG_LOAD(5, 0, 0x35, 0x00, 8)
@@ -451,39 +639,52 @@
#define SOUND_OBJ_UKIKI_STEP_LEAVES SOUND_ARG_LOAD(5, 0, 0x3C, 0x00, 8)
#define SOUND_OBJ_KOOPA_TALK SOUND_ARG_LOAD(5, 0, 0x3D, 0xA0, 8)
#define SOUND_OBJ_KOOPA_DAMAGE SOUND_ARG_LOAD(5, 0, 0x3E, 0xA0, 8)
/* not verified */ #define SOUND_OBJ_KLEPTO1 SOUND_ARG_LOAD(5, 0, 0x3F, 0x40, 8)
/* not verified */ #define SOUND_OBJ_KLEPTO2 SOUND_ARG_LOAD(5, 0, 0x40, 0x60, 8)
/* not verified */
#define SOUND_OBJ_KLEPTO1 SOUND_ARG_LOAD(5, 0, 0x3F, 0x40, 8)
/* not verified */
#define SOUND_OBJ_KLEPTO2 SOUND_ARG_LOAD(5, 0, 0x40, 0x60, 8)
#define SOUND_OBJ_KING_BOBOMB_TALK SOUND_ARG_LOAD(5, 0, 0x41, 0x00, 8)
#define SOUND_OBJ_KING_BOBOMB_JUMP SOUND_ARG_LOAD(5, 0, 0x46, 0x80, 8)
#define SOUND_OBJ_KING_WHOMP_DEATH SOUND_ARG_LOAD(5, 1, 0x47, 0xC0, 8)
#define SOUND_OBJ_BOO_LAUGH_LONG SOUND_ARG_LOAD(5, 0, 0x48, 0x00, 8)
/* not verified */ #define SOUND_OBJ_EEL SOUND_ARG_LOAD(5, 0, 0x4A, 0x00, 8)
/* not verified */ #define SOUND_OBJ_EEL_2 SOUND_ARG_LOAD(5, 2, 0x4A, 0x00, 8)
/* not verified */
#define SOUND_OBJ_EEL SOUND_ARG_LOAD(5, 0, 0x4A, 0x00, 8)
/* not verified */
#define SOUND_OBJ_EEL_2 SOUND_ARG_LOAD(5, 2, 0x4A, 0x00, 8)
#define SOUND_OBJ_EYEROK_SHOW_EYE SOUND_ARG_LOAD(5, 2, 0x4B, 0x00, 8)
#define SOUND_OBJ_MR_BLIZZARD_ALERT SOUND_ARG_LOAD(5, 0, 0x4C, 0x00, 8)
#define SOUND_OBJ_SNUFIT_SHOOT SOUND_ARG_LOAD(5, 0, 0x4D, 0x00, 8)
#define SOUND_OBJ_SKEETER_WALK SOUND_ARG_LOAD(5, 0, 0x4E, 0x00, 8)
/* not verified */ #define SOUND_OBJ_WALKING_WATER SOUND_ARG_LOAD(5, 0, 0x4F, 0x00, 8)
/* not verified */
#define SOUND_OBJ_WALKING_WATER SOUND_ARG_LOAD(5, 0, 0x4F, 0x00, 8)
#define SOUND_OBJ_BIRD_CHIRP3 SOUND_ARG_LOAD(5, 0, 0x51, 0x40, 0)
#define SOUND_OBJ_PIRANHA_PLANT_APPEAR SOUND_ARG_LOAD(5, 0, 0x54, 0x20, 8)
#define SOUND_OBJ_FLAME_BLOWN SOUND_ARG_LOAD(5, 0, 0x55, 0x80, 8)
#define SOUND_OBJ_MAD_PIANO_CHOMPING SOUND_ARG_LOAD(5, 2, 0x56, 0x40, 8)
#define SOUND_OBJ_BOBOMB_BUDDY_TALK SOUND_ARG_LOAD(5, 0, 0x58, 0x40, 8)
/* not verified */ #define SOUND_OBJ_SPINY_UNK59 SOUND_ARG_LOAD(5, 0, 0x59, 0x10, 8)
/* not verified */
#define SOUND_OBJ_SPINY_UNK59 SOUND_ARG_LOAD(5, 0, 0x59, 0x10, 8)
#define SOUND_OBJ_WIGGLER_HIGH_PITCH SOUND_ARG_LOAD(5, 0, 0x5C, 0x40, 8)
#define SOUND_OBJ_HEAVEHO_TOSSED SOUND_ARG_LOAD(5, 0, 0x5D, 0x40, 8)
/* not verified */ #define SOUND_OBJ_WIGGLER_DEATH 0x505E
/* not verified */
#define SOUND_OBJ_WIGGLER_DEATH 0x505E
#define SOUND_OBJ_BOWSER_INTRO_LAUGH SOUND_ARG_LOAD(5, 0, 0x5F, 0x80, 9)
/* not verified */ #define SOUND_OBJ_ENEMY_DEATH_HIGH SOUND_ARG_LOAD(5, 0, 0x60, 0xB0, 8)
/* not verified */ #define SOUND_OBJ_ENEMY_DEATH_LOW SOUND_ARG_LOAD(5, 0, 0x61, 0xB0, 8)
/* not verified */
#define SOUND_OBJ_ENEMY_DEATH_HIGH SOUND_ARG_LOAD(5, 0, 0x60, 0xB0, 8)
/* not verified */
#define SOUND_OBJ_ENEMY_DEATH_LOW SOUND_ARG_LOAD(5, 0, 0x61, 0xB0, 8)
#define SOUND_OBJ_SWOOP_DEATH SOUND_ARG_LOAD(5, 0, 0x62, 0xB0, 8)
#define SOUND_OBJ_KOOPA_FLYGUY_DEATH SOUND_ARG_LOAD(5, 0, 0x63, 0xB0, 8)
#define SOUND_OBJ_POKEY_DEATH SOUND_ARG_LOAD(5, 0, 0x63, 0xC0, 8)
/* not verified */ #define SOUND_OBJ_SNOWMAN_BOUNCE SOUND_ARG_LOAD(5, 0, 0x64, 0xC0, 8)
/* not verified */
#define SOUND_OBJ_SNOWMAN_BOUNCE SOUND_ARG_LOAD(5, 0, 0x64, 0xC0, 8)
#define SOUND_OBJ_SNOWMAN_EXPLODE SOUND_ARG_LOAD(5, 0, 0x65, 0xD0, 8)
/* not verified */ #define SOUND_OBJ_POUNDING_LOUD SOUND_ARG_LOAD(5, 0, 0x68, 0x40, 8)
/* not verified */ #define SOUND_OBJ_MIPS_RABBIT SOUND_ARG_LOAD(5, 0, 0x6A, 0x00, 8)
/* not verified */ #define SOUND_OBJ_MIPS_RABBIT_WATER SOUND_ARG_LOAD(5, 0, 0x6C, 0x00, 8)
/* not verified */
#define SOUND_OBJ_POUNDING_LOUD SOUND_ARG_LOAD(5, 0, 0x68, 0x40, 8)
/* not verified */
#define SOUND_OBJ_MIPS_RABBIT SOUND_ARG_LOAD(5, 0, 0x6A, 0x00, 8)
/* not verified */
#define SOUND_OBJ_MIPS_RABBIT_WATER SOUND_ARG_LOAD(5, 0, 0x6C, 0x00, 8)
#define SOUND_OBJ_EYEROK_EXPLODE SOUND_ARG_LOAD(5, 0, 0x6D, 0x00, 8)
#define SOUND_OBJ_CHUCKYA_DEATH SOUND_ARG_LOAD(5, 1, 0x6E, 0x00, 8)
#define SOUND_OBJ_WIGGLER_TALK SOUND_ARG_LOAD(5, 0, 0x6F, 0x00, 8)
@@ -511,7 +712,8 @@
/* Menu Sound Effects */
#define SOUND_MENU_CHANGE_SELECT SOUND_ARG_LOAD(7, 0, 0x00, 0xF8, 8)
/* not verified */ #define SOUND_MENU_REVERSE_PAUSE 0x7001
/* not verified */
#define SOUND_MENU_REVERSE_PAUSE 0x7001
#define SOUND_MENU_PAUSE SOUND_ARG_LOAD(7, 0, 0x02, 0xF0, 8)
#define SOUND_MENU_PAUSE_HIGHPRIO SOUND_ARG_LOAD(7, 0, 0x02, 0xFF, 8)
#define SOUND_MENU_PAUSE_2 SOUND_ARG_LOAD(7, 0, 0x03, 0xFF, 8)
@@ -523,28 +725,39 @@
#define SOUND_MENU_LET_GO_MARIO_FACE SOUND_ARG_LOAD(7, 0, 0x09, 0x00, 8)
#define SOUND_MENU_HAND_APPEAR SOUND_ARG_LOAD(7, 0, 0x0A, 0x00, 8)
#define SOUND_MENU_HAND_DISAPPEAR SOUND_ARG_LOAD(7, 0, 0x0B, 0x00, 8)
/* not verified */ #define SOUND_MENU_UNK0C SOUND_ARG_LOAD(7, 0, 0x0C, 0x00, 8)
/* not verified */ #define SOUND_MENU_POWER_METER SOUND_ARG_LOAD(7, 0, 0x0D, 0x00, 8)
/* not verified */
#define SOUND_MENU_UNK0C SOUND_ARG_LOAD(7, 0, 0x0C, 0x00, 8)
/* not verified */
#define SOUND_MENU_POWER_METER SOUND_ARG_LOAD(7, 0, 0x0D, 0x00, 8)
#define SOUND_MENU_CAMERA_BUZZ SOUND_ARG_LOAD(7, 0, 0x0E, 0x00, 8)
#define SOUND_MENU_CAMERA_TURN SOUND_ARG_LOAD(7, 0, 0x0F, 0x00, 8)
/* not verified */ #define SOUND_MENU_UNK10 0x7010
/* not verified */
#define SOUND_MENU_UNK10 0x7010
#define SOUND_MENU_CLICK_FILE_SELECT SOUND_ARG_LOAD(7, 0, 0x11, 0x00, 8)
/* not verified */ #define SOUND_MENU_MESSAGE_NEXT_PAGE SOUND_ARG_LOAD(7, 0, 0x13, 0x00, 8)
/* not verified */
#define SOUND_MENU_MESSAGE_NEXT_PAGE SOUND_ARG_LOAD(7, 0, 0x13, 0x00, 8)
#define SOUND_MENU_COIN_ITS_A_ME_MARIO SOUND_ARG_LOAD(7, 0, 0x14, 0x00, 8)
#define SOUND_MENU_YOSHI_GAIN_LIVES SOUND_ARG_LOAD(7, 0, 0x15, 0x00, 8)
#define SOUND_MENU_ENTER_PIPE SOUND_ARG_LOAD(7, 0, 0x16, 0xA0, 8)
#define SOUND_MENU_EXIT_PIPE SOUND_ARG_LOAD(7, 0, 0x17, 0xA0, 8)
#define SOUND_MENU_BOWSER_LAUGH SOUND_ARG_LOAD(7, 0, 0x18, 0x80, 8)
#define SOUND_MENU_ENTER_HOLE SOUND_ARG_LOAD(7, 1, 0x19, 0x80, 8)
/* not verified */ #define SOUND_MENU_CLICK_CHANGE_VIEW SOUND_ARG_LOAD(7, 0, 0x1A, 0x80, 8)
/* not verified */ #define SOUND_MENU_CAMERA_UNUSED1 0x701B
/* not verified */ #define SOUND_MENU_CAMERA_UNUSED2 0x701C
/* not verified */ #define SOUND_MENU_MARIO_CASTLE_WARP SOUND_ARG_LOAD(7, 0, 0x1D, 0xB0, 8)
/* not verified */
#define SOUND_MENU_CLICK_CHANGE_VIEW SOUND_ARG_LOAD(7, 0, 0x1A, 0x80, 8)
/* not verified */
#define SOUND_MENU_CAMERA_UNUSED1 0x701B
/* not verified */
#define SOUND_MENU_CAMERA_UNUSED2 0x701C
/* not verified */
#define SOUND_MENU_MARIO_CASTLE_WARP SOUND_ARG_LOAD(7, 0, 0x1D, 0xB0, 8)
#define SOUND_MENU_STAR_SOUND SOUND_ARG_LOAD(7, 0, 0x1E, 0xFF, 8)
#define SOUND_MENU_THANK_YOU_PLAYING_MY_GAME SOUND_ARG_LOAD(7, 0, 0x1F, 0xFF, 8)
/* not verified */ #define SOUND_MENU_READ_A_SIGN 0x7020
/* not verified */ #define SOUND_MENU_EXIT_A_SIGN 0x7021
/* not verified */ #define SOUND_MENU_MARIO_CASTLE_WARP2 SOUND_ARG_LOAD(7, 0, 0x22, 0x20, 8)
/* not verified */
#define SOUND_MENU_READ_A_SIGN 0x7020
/* not verified */
#define SOUND_MENU_EXIT_A_SIGN 0x7021
/* not verified */
#define SOUND_MENU_MARIO_CASTLE_WARP2 SOUND_ARG_LOAD(7, 0, 0x22, 0x20, 8)
#define SOUND_MENU_STAR_SOUND_OKEY_DOKEY SOUND_ARG_LOAD(7, 0, 0x23, 0xFF, 8)
#define SOUND_MENU_STAR_SOUND_LETS_A_GO SOUND_ARG_LOAD(7, 0, 0x24, 0xFF, 8)

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