mirror of
https://github.com/zeldaret/oot.git
synced 2024-09-22 21:35:27 +00:00
f9d96d9f73
* Less warnings in boot & code segments * few more warnings gone * Ran formatter * z_view warning gone * -> 1 * f31 -> 31 * Remove function casts * Few more small improvements * Separate declaration and assignment in func_80091738 and Item_Give Co-authored-by: Thar0 <maximilianc64@gmail.com>
61 lines
1.7 KiB
C
61 lines
1.7 KiB
C
#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 {
|
|
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;
|
|
|
|
SkinMatrix_Vec3fMtxFMultXYZ(&globalCtx->mf_11D60, &source->originPos, &source->relativePos);
|
|
Audio_PlaySoundGeneral(sfxId, &source->relativePos, 4, &D_801333E0, &D_801333E0, &D_801333E8);
|
|
}
|