1
0
mirror of https://github.com/zeldaret/oot.git synced 2024-09-22 21:35:27 +00:00
oot/src/code/code_8006BA00.c

61 lines
1.7 KiB
C
Raw Normal View History

#include "global.h"
void func_8006BA00(GlobalContext* globalCtx) {
SoundSource* sources = &globalCtx->soundSources[0];
s32 i;
// clang-format off
for (i = 0; i < ARRAY_COUNT(globalCtx->soundSources); i++) { sources[i].countdown = 0; }
// clang-format on
}
void func_8006BA30(GlobalContext* globalCtx) {
SoundSource* source = &globalCtx->soundSources[0];
s32 i;
for (i = 0; i < ARRAY_COUNT(globalCtx->soundSources); i++) {
if (source->countdown != 0) {
if (DECR(source->countdown) == 0) {
func_800F89E8(&source->relativePos);
} else {
z_skin_matrix.c decompiled (1 non matching, 1 non equivalent) (#243) * func_800A7BE4 and func_800A7C20 done - func_800A7BE4 copy of "Math_Vec3f_ToVec3s" in z_lib.c - func_800A7C20 copy of "Math_Vec3s_ToVec3f" in z_lib.c * done func_800A7A24 * func_800A76A4 done * func_800A6E10 done * func_800A6EF4 done * func_800A6FA0 done * func_800A72FC done * Deleted z_skin_matrix.data.s and updated spec * func_800A730C done * func_800A735C done * func_800A7E70 done, func_800A7C60 matching but I'm not happy with it (weird types in function params) * Corrections. func_800A7C60 in skin_matrix done, Matrix_MtxFToMtx in sys_matrix done. * func_800A7EC0 nonmatching * func_800A8030 nonmatching but VERY close (two registers swapped) * func_800A8030 done * updating comments * func_800A7704 done * func_800A7894 done * halfway through deciphering mips_to_c for func_800A73E0 * func_800A73E0 functional but non-matching (saved register differences and probably regalloc) * Renaming some arguments and rewriting comments * Renamed files across whole project and deleted asm nonmatchings * ran format.sh * fixed function name * fixing multiplcation order in SkinMatrix_MtxFMtxFMult * Corrections in SkinMatrix_MtxFMtxFMult * Formatting changes after review * Changes as per code review * fixing rename error * fixing rename error * rename fixes * fixing function rename error * ran ./format.sh * last couple of changes as per code review * renamed SetScaling -> SetScale * Skin_Matrix_Invert -> SkinMatrix_Invert * Renaming and fixing debug message print * Renamed argument "mf" to more specific "clear" in SkinMatrix_GetClear * renamed again to "mfp" * snake case to camel case changes
2020-08-08 15:23:16 +00:00
SkinMatrix_Vec3fMtxFMultXYZ(&globalCtx->mf_11D60, &source->originPos, &source->relativePos);
}
}
source++;
}
}
void Audio_PlaySoundAtPosition(GlobalContext* globalCtx, Vec3f* pos, s32 duration, u16 sfxId) {
s32 countdown;
SoundSource* source;
s32 smallestCountdown = 0xFFFF;
SoundSource* backupSource;
s32 i;
source = &globalCtx->soundSources[0];
for (i = 0; i < ARRAY_COUNT(globalCtx->soundSources); i++) {
if (source->countdown == 0) {
break;
}
countdown = source->countdown;
if (countdown < smallestCountdown) {
smallestCountdown = countdown;
backupSource = source;
}
source++;
}
if (i >= ARRAY_COUNT(globalCtx->soundSources)) {
source = backupSource;
func_800F89E8(&source->relativePos);
}
source->originPos = *pos;
source->countdown = duration;
z_skin_matrix.c decompiled (1 non matching, 1 non equivalent) (#243) * func_800A7BE4 and func_800A7C20 done - func_800A7BE4 copy of "Math_Vec3f_ToVec3s" in z_lib.c - func_800A7C20 copy of "Math_Vec3s_ToVec3f" in z_lib.c * done func_800A7A24 * func_800A76A4 done * func_800A6E10 done * func_800A6EF4 done * func_800A6FA0 done * func_800A72FC done * Deleted z_skin_matrix.data.s and updated spec * func_800A730C done * func_800A735C done * func_800A7E70 done, func_800A7C60 matching but I'm not happy with it (weird types in function params) * Corrections. func_800A7C60 in skin_matrix done, Matrix_MtxFToMtx in sys_matrix done. * func_800A7EC0 nonmatching * func_800A8030 nonmatching but VERY close (two registers swapped) * func_800A8030 done * updating comments * func_800A7704 done * func_800A7894 done * halfway through deciphering mips_to_c for func_800A73E0 * func_800A73E0 functional but non-matching (saved register differences and probably regalloc) * Renaming some arguments and rewriting comments * Renamed files across whole project and deleted asm nonmatchings * ran format.sh * fixed function name * fixing multiplcation order in SkinMatrix_MtxFMtxFMult * Corrections in SkinMatrix_MtxFMtxFMult * Formatting changes after review * Changes as per code review * fixing rename error * fixing rename error * rename fixes * fixing function rename error * ran ./format.sh * last couple of changes as per code review * renamed SetScaling -> SetScale * Skin_Matrix_Invert -> SkinMatrix_Invert * Renaming and fixing debug message print * Renamed argument "mf" to more specific "clear" in SkinMatrix_GetClear * renamed again to "mfp" * snake case to camel case changes
2020-08-08 15:23:16 +00:00
SkinMatrix_Vec3fMtxFMultXYZ(&globalCtx->mf_11D60, &source->originPos, &source->relativePos);
Audio_PlaySoundGeneral(sfxId, &source->relativePos, 4, &D_801333E0, &D_801333E0, &D_801333E8);
}