mirror of
https://github.com/HarbourMasters/Shipwright.git
synced 2025-07-15 17:42:58 -07:00
Use PlayState instead of GlobalContext (#1927)
* Use PlayState instead of GlobalContext - GlobalContext -> PlayState - globalCtx -> play - GlobalCtx -> PlayState - globalContext -> playState * Find and replace Gameplay_ with Play_ * Correct some misnamed argument cases
This commit is contained in:
parent
710a768d76
commit
99260acaf1
926 changed files with 41210 additions and 41210 deletions
|
@ -1,24 +1,24 @@
|
|||
#include "global.h"
|
||||
|
||||
void SoundSource_InitAll(GlobalContext* globalCtx) {
|
||||
SoundSource* sources = &globalCtx->soundSources[0];
|
||||
void SoundSource_InitAll(PlayState* play) {
|
||||
SoundSource* sources = &play->soundSources[0];
|
||||
s32 i;
|
||||
|
||||
// clang-format off
|
||||
for (i = 0; i < ARRAY_COUNT(globalCtx->soundSources); i++) { sources[i].countdown = 0; }
|
||||
for (i = 0; i < ARRAY_COUNT(play->soundSources); i++) { sources[i].countdown = 0; }
|
||||
// clang-format on
|
||||
}
|
||||
|
||||
void SoundSource_UpdateAll(GlobalContext* globalCtx) {
|
||||
SoundSource* source = &globalCtx->soundSources[0];
|
||||
void SoundSource_UpdateAll(PlayState* play) {
|
||||
SoundSource* source = &play->soundSources[0];
|
||||
s32 i;
|
||||
|
||||
for (i = 0; i < ARRAY_COUNT(globalCtx->soundSources); i++) {
|
||||
for (i = 0; i < ARRAY_COUNT(play->soundSources); i++) {
|
||||
if (source->countdown != 0) {
|
||||
if (DECR(source->countdown) == 0) {
|
||||
Audio_StopSfxByPos(&source->projectedPos);
|
||||
} else {
|
||||
SkinMatrix_Vec3fMtxFMultXYZ(&globalCtx->viewProjectionMtxF, &source->worldPos, &source->projectedPos);
|
||||
SkinMatrix_Vec3fMtxFMultXYZ(&play->viewProjectionMtxF, &source->worldPos, &source->projectedPos);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -26,15 +26,15 @@ void SoundSource_UpdateAll(GlobalContext* globalCtx) {
|
|||
}
|
||||
}
|
||||
|
||||
void SoundSource_PlaySfxAtFixedWorldPos(GlobalContext* globalCtx, Vec3f* worldPos, s32 duration, u16 sfxId) {
|
||||
void SoundSource_PlaySfxAtFixedWorldPos(PlayState* play, Vec3f* worldPos, 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++) {
|
||||
source = &play->soundSources[0];
|
||||
for (i = 0; i < ARRAY_COUNT(play->soundSources); i++) {
|
||||
if (source->countdown == 0) {
|
||||
break;
|
||||
}
|
||||
|
@ -49,7 +49,7 @@ void SoundSource_PlaySfxAtFixedWorldPos(GlobalContext* globalCtx, Vec3f* worldPo
|
|||
}
|
||||
|
||||
// If no sound source is available, replace the sound source with the smallest remaining countdown
|
||||
if (i >= ARRAY_COUNT(globalCtx->soundSources)) {
|
||||
if (i >= ARRAY_COUNT(play->soundSources)) {
|
||||
source = backupSource;
|
||||
Audio_StopSfxByPos(&source->projectedPos);
|
||||
}
|
||||
|
@ -57,6 +57,6 @@ void SoundSource_PlaySfxAtFixedWorldPos(GlobalContext* globalCtx, Vec3f* worldPo
|
|||
source->worldPos = *worldPos;
|
||||
source->countdown = duration;
|
||||
|
||||
SkinMatrix_Vec3fMtxFMultXYZ(&globalCtx->viewProjectionMtxF, &source->worldPos, &source->projectedPos);
|
||||
SkinMatrix_Vec3fMtxFMultXYZ(&play->viewProjectionMtxF, &source->worldPos, &source->projectedPos);
|
||||
Audio_PlaySoundGeneral(sfxId, &source->projectedPos, 4, &D_801333E0, &D_801333E0, &D_801333E8);
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue