mirror of
https://github.com/HarbourMasters/Starship
synced 2026-09-03 11:01:36 -04:00
Use array count for more things (#230)
* array count more things * fix array count error * undo array count for later --------- Co-authored-by: Alejandro Javier Asenjo Nitti <alejandro.asenjo88@gmail.com>
This commit is contained in:
@@ -17,7 +17,7 @@ void func_80013400(SequenceChannel* channel, s32 updateVolume) {
|
||||
if (channel->changes.s.pan) {
|
||||
channel->pan = channel->newPan * channel->panChannelWeight;
|
||||
}
|
||||
for (i = 0; i < 4; i++) {
|
||||
for (i = 0; i < ARRAY_COUNT(channel->layers); i++) {
|
||||
SequenceLayer* layer = channel->layers[i];
|
||||
|
||||
if ((layer != NULL) && layer->enabled && (layer->note != NULL)) {
|
||||
|
||||
@@ -109,7 +109,7 @@ void AudioHeap_DiscardFont(s32 fontId) {
|
||||
void AudioHeap_DiscardSequence(s32 seqId) {
|
||||
s32 i;
|
||||
|
||||
for (i = 0; i < 4; i++) {
|
||||
for (i = 0; i < ARRAY_COUNT(gSeqPlayers); i++) {
|
||||
if (gSeqPlayers[i].enabled && gSeqPlayers[i].seqId == seqId) {
|
||||
func_800144E4(&gSeqPlayers[i]);
|
||||
}
|
||||
@@ -300,7 +300,7 @@ void* AudioHeap_AllocCached(s32 tableType, s32 size, s32 cache, s32 id) {
|
||||
// Check if there is a side which isn't in active use, if so, evict that one.
|
||||
if (tableType == 0) {
|
||||
if (loadStatusEntry0 == 2) {
|
||||
for (i = 0; i < 4; i++) {
|
||||
for (i = 0; i < ARRAY_COUNT(gSeqPlayers); i++) {
|
||||
if (gSeqPlayers[i].enabled && (gSeqPlayers[i].seqId == temporaryCache->entries[0].id)) {
|
||||
break;
|
||||
}
|
||||
@@ -311,7 +311,7 @@ void* AudioHeap_AllocCached(s32 tableType, s32 size, s32 cache, s32 id) {
|
||||
}
|
||||
}
|
||||
if (loadStatusEntry1 == 2) {
|
||||
for (i = 0; i < 4; i++) {
|
||||
for (i = 0; i < ARRAY_COUNT(gSeqPlayers); i++) {
|
||||
if (gSeqPlayers[i].enabled && (gSeqPlayers[i].seqId == temporaryCache->entries[1].id)) {
|
||||
break;
|
||||
}
|
||||
@@ -570,7 +570,7 @@ s32 AudioHeap_ResetStep(void) {
|
||||
}
|
||||
switch (gResetStatus) {
|
||||
case 5:
|
||||
for (i = 0; i < 4; i++) {
|
||||
for (i = 0; i < ARRAY_COUNT(gSeqPlayers); i++) {
|
||||
func_800144E4(&gSeqPlayers[i]);
|
||||
}
|
||||
gResetFadeoutFramesLeft = 4 / sp24;
|
||||
@@ -703,7 +703,7 @@ void AudioHeap_Init(void) {
|
||||
for (i = 0; i != 2; i++) {
|
||||
gAbiCmdBuffs[i] = AudioHeap_AllocZeroed(&gMiscPool, gMaxAudioCmds * 8);
|
||||
}
|
||||
for (i = 0; i < 4; i++) {
|
||||
for (i = 0; i < ARRAY_COUNT(gSynthReverbs); i++) {
|
||||
gSynthReverbs[i].useReverb = 0;
|
||||
}
|
||||
gNumSynthReverbs = spec->numReverbs;
|
||||
|
||||
+15
-15
@@ -142,7 +142,7 @@ void func_8001410C(SequenceChannel* channel, s32 arg1) {
|
||||
void func_8001415C(SequenceChannel* channel) {
|
||||
s32 var_s0;
|
||||
|
||||
for (var_s0 = 0; var_s0 < 4; var_s0++) {
|
||||
for (var_s0 = 0; var_s0 < ARRAY_COUNT(channel->layers); var_s0++) {
|
||||
func_8001410C(channel, var_s0);
|
||||
}
|
||||
func_80012964(&channel->notePool);
|
||||
@@ -212,18 +212,18 @@ void func_80014370(SequencePlayer* seqPlayer, u16 arg1) {
|
||||
}
|
||||
|
||||
void func_80014440(SequencePlayer* seqPlayer, u8 arg1, u8* arg2) {
|
||||
SequenceChannel* temp_s2 = seqPlayer->channels[arg1];
|
||||
SequenceChannel* channel = seqPlayer->channels[arg1];
|
||||
s32 i;
|
||||
|
||||
if (IS_SEQUENCE_CHANNEL_VALID(temp_s2) != 0) {
|
||||
temp_s2->scriptState.depth = 0;
|
||||
temp_s2->scriptState.pc = arg2;
|
||||
temp_s2->enabled = 1;
|
||||
temp_s2->finished = 0;
|
||||
temp_s2->delay = 0;
|
||||
for (i = 0; i < 4; i++) {
|
||||
if (temp_s2->layers[i] != NULL) {
|
||||
func_8001410C(temp_s2, i);
|
||||
if (IS_SEQUENCE_CHANNEL_VALID(channel) != 0) {
|
||||
channel->scriptState.depth = 0;
|
||||
channel->scriptState.pc = arg2;
|
||||
channel->enabled = 1;
|
||||
channel->finished = 0;
|
||||
channel->delay = 0;
|
||||
for (i = 0; i < ARRAY_COUNT(channel->layers); i++) {
|
||||
if (channel->layers[i] != NULL) {
|
||||
func_8001410C(channel, i);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -715,7 +715,7 @@ void func_800153E8(SequenceChannel* channel) {
|
||||
return;
|
||||
}
|
||||
if (channel->stopScript) {
|
||||
for (i = 0; i < 4; i++) {
|
||||
for (i = 0; i < ARRAY_COUNT(channel->layers); i++) {
|
||||
if (channel->layers[i] != NULL) {
|
||||
func_80014748(channel->layers[i]);
|
||||
}
|
||||
@@ -1093,7 +1093,7 @@ void func_800153E8(SequenceChannel* channel) {
|
||||
}
|
||||
}
|
||||
end_loop:;
|
||||
for (i = 0; i < 4; i++) {
|
||||
for (i = 0; i < ARRAY_COUNT(channel->layers); i++) {
|
||||
if (channel->layers[i] != NULL) {
|
||||
func_80014748(channel->layers[i]);
|
||||
}
|
||||
@@ -1352,7 +1352,7 @@ void func_80015FD4(SequencePlayer* seqPlayer) {
|
||||
void func_8001678C(s32 arg0) {
|
||||
s32 i;
|
||||
|
||||
for (i = 0; i < 4; i++) {
|
||||
for (i = 0; i < ARRAY_COUNT(gSeqPlayers); i++) {
|
||||
if (gSeqPlayers[i].enabled == 1) {
|
||||
func_80015FD4(&gSeqPlayers[i]);
|
||||
func_800135A8(&gSeqPlayers[i]);
|
||||
@@ -1404,7 +1404,7 @@ void func_800168BC(void) {
|
||||
gSeqLayers[i].channel = NULL;
|
||||
gSeqLayers[i].enabled = false;
|
||||
}
|
||||
for (i = 0; i < 4; i++) {
|
||||
for (i = 0; i < ARRAY_COUNT(gSeqPlayers); i++) {
|
||||
for (j = 0; j < 16; j++) {
|
||||
gSeqPlayers[i].channels[j] = &gSeqChannelNone;
|
||||
}
|
||||
|
||||
@@ -177,7 +177,7 @@ void AudioThread_ProcessGlobalCmd(AudioCmd* cmd) {
|
||||
gAudioSoundMode = cmd->asUInt;
|
||||
break;
|
||||
case AUDIOCMD_OP_GLOBAL_MUTE:
|
||||
for (i = 0; i < 4; i++) {
|
||||
for (i = 0; i < ARRAY_COUNT(gSeqPlayers); i++) {
|
||||
SequencePlayer* seqplayer = &gSeqPlayers[i];
|
||||
|
||||
seqplayer->muted = true;
|
||||
@@ -197,7 +197,7 @@ void AudioThread_ProcessGlobalCmd(AudioCmd* cmd) {
|
||||
}
|
||||
}
|
||||
}
|
||||
for (i = 0; i < 4; i++) {
|
||||
for (i = 0; i < ARRAY_COUNT(gSeqPlayers); i++) {
|
||||
SequencePlayer* seqplayer = &gSeqPlayers[i];
|
||||
|
||||
seqplayer->muted = false;
|
||||
@@ -315,7 +315,7 @@ void AudioThread_ProcessCmds(u32 msg) {
|
||||
}
|
||||
if ((cmd->op & 0xF0) == 0xF0) {
|
||||
AudioThread_ProcessGlobalCmd(cmd);
|
||||
} else if (cmd->arg0 < 4) {
|
||||
} else if (cmd->arg0 < ARRAY_COUNT(gSeqPlayers)) {
|
||||
player = &gSeqPlayers[cmd->arg0];
|
||||
if (cmd->op & 0x80) {
|
||||
AudioThread_ProcessGlobalCmd(cmd);
|
||||
|
||||
Reference in New Issue
Block a user