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:
inspectredc 2024-05-05 21:29:59 +01:00 committed by GitHub
parent 455aa0aa2c
commit d08678a5ac
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
28 changed files with 134 additions and 135 deletions

View File

@ -17,7 +17,7 @@ void func_80013400(SequenceChannel* channel, s32 updateVolume) {
if (channel->changes.s.pan) { if (channel->changes.s.pan) {
channel->pan = channel->newPan * channel->panChannelWeight; 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]; SequenceLayer* layer = channel->layers[i];
if ((layer != NULL) && layer->enabled && (layer->note != NULL)) { if ((layer != NULL) && layer->enabled && (layer->note != NULL)) {

View File

@ -109,7 +109,7 @@ void AudioHeap_DiscardFont(s32 fontId) {
void AudioHeap_DiscardSequence(s32 seqId) { void AudioHeap_DiscardSequence(s32 seqId) {
s32 i; s32 i;
for (i = 0; i < 4; i++) { for (i = 0; i < ARRAY_COUNT(gSeqPlayers); i++) {
if (gSeqPlayers[i].enabled && gSeqPlayers[i].seqId == seqId) { if (gSeqPlayers[i].enabled && gSeqPlayers[i].seqId == seqId) {
func_800144E4(&gSeqPlayers[i]); 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. // Check if there is a side which isn't in active use, if so, evict that one.
if (tableType == 0) { if (tableType == 0) {
if (loadStatusEntry0 == 2) { 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)) { if (gSeqPlayers[i].enabled && (gSeqPlayers[i].seqId == temporaryCache->entries[0].id)) {
break; break;
} }
@ -311,7 +311,7 @@ void* AudioHeap_AllocCached(s32 tableType, s32 size, s32 cache, s32 id) {
} }
} }
if (loadStatusEntry1 == 2) { 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)) { if (gSeqPlayers[i].enabled && (gSeqPlayers[i].seqId == temporaryCache->entries[1].id)) {
break; break;
} }
@ -570,7 +570,7 @@ s32 AudioHeap_ResetStep(void) {
} }
switch (gResetStatus) { switch (gResetStatus) {
case 5: case 5:
for (i = 0; i < 4; i++) { for (i = 0; i < ARRAY_COUNT(gSeqPlayers); i++) {
func_800144E4(&gSeqPlayers[i]); func_800144E4(&gSeqPlayers[i]);
} }
gResetFadeoutFramesLeft = 4 / sp24; gResetFadeoutFramesLeft = 4 / sp24;
@ -703,7 +703,7 @@ void AudioHeap_Init(void) {
for (i = 0; i != 2; i++) { for (i = 0; i != 2; i++) {
gAbiCmdBuffs[i] = AudioHeap_AllocZeroed(&gMiscPool, gMaxAudioCmds * 8); 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; gSynthReverbs[i].useReverb = 0;
} }
gNumSynthReverbs = spec->numReverbs; gNumSynthReverbs = spec->numReverbs;

View File

@ -142,7 +142,7 @@ void func_8001410C(SequenceChannel* channel, s32 arg1) {
void func_8001415C(SequenceChannel* channel) { void func_8001415C(SequenceChannel* channel) {
s32 var_s0; 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_8001410C(channel, var_s0);
} }
func_80012964(&channel->notePool); func_80012964(&channel->notePool);
@ -212,18 +212,18 @@ void func_80014370(SequencePlayer* seqPlayer, u16 arg1) {
} }
void func_80014440(SequencePlayer* seqPlayer, u8 arg1, u8* arg2) { void func_80014440(SequencePlayer* seqPlayer, u8 arg1, u8* arg2) {
SequenceChannel* temp_s2 = seqPlayer->channels[arg1]; SequenceChannel* channel = seqPlayer->channels[arg1];
s32 i; s32 i;
if (IS_SEQUENCE_CHANNEL_VALID(temp_s2) != 0) { if (IS_SEQUENCE_CHANNEL_VALID(channel) != 0) {
temp_s2->scriptState.depth = 0; channel->scriptState.depth = 0;
temp_s2->scriptState.pc = arg2; channel->scriptState.pc = arg2;
temp_s2->enabled = 1; channel->enabled = 1;
temp_s2->finished = 0; channel->finished = 0;
temp_s2->delay = 0; channel->delay = 0;
for (i = 0; i < 4; i++) { for (i = 0; i < ARRAY_COUNT(channel->layers); i++) {
if (temp_s2->layers[i] != NULL) { if (channel->layers[i] != NULL) {
func_8001410C(temp_s2, i); func_8001410C(channel, i);
} }
} }
} }
@ -715,7 +715,7 @@ void func_800153E8(SequenceChannel* channel) {
return; return;
} }
if (channel->stopScript) { if (channel->stopScript) {
for (i = 0; i < 4; i++) { for (i = 0; i < ARRAY_COUNT(channel->layers); i++) {
if (channel->layers[i] != NULL) { if (channel->layers[i] != NULL) {
func_80014748(channel->layers[i]); func_80014748(channel->layers[i]);
} }
@ -1093,7 +1093,7 @@ void func_800153E8(SequenceChannel* channel) {
} }
} }
end_loop:; end_loop:;
for (i = 0; i < 4; i++) { for (i = 0; i < ARRAY_COUNT(channel->layers); i++) {
if (channel->layers[i] != NULL) { if (channel->layers[i] != NULL) {
func_80014748(channel->layers[i]); func_80014748(channel->layers[i]);
} }
@ -1352,7 +1352,7 @@ void func_80015FD4(SequencePlayer* seqPlayer) {
void func_8001678C(s32 arg0) { void func_8001678C(s32 arg0) {
s32 i; s32 i;
for (i = 0; i < 4; i++) { for (i = 0; i < ARRAY_COUNT(gSeqPlayers); i++) {
if (gSeqPlayers[i].enabled == 1) { if (gSeqPlayers[i].enabled == 1) {
func_80015FD4(&gSeqPlayers[i]); func_80015FD4(&gSeqPlayers[i]);
func_800135A8(&gSeqPlayers[i]); func_800135A8(&gSeqPlayers[i]);
@ -1404,7 +1404,7 @@ void func_800168BC(void) {
gSeqLayers[i].channel = NULL; gSeqLayers[i].channel = NULL;
gSeqLayers[i].enabled = false; gSeqLayers[i].enabled = false;
} }
for (i = 0; i < 4; i++) { for (i = 0; i < ARRAY_COUNT(gSeqPlayers); i++) {
for (j = 0; j < 16; j++) { for (j = 0; j < 16; j++) {
gSeqPlayers[i].channels[j] = &gSeqChannelNone; gSeqPlayers[i].channels[j] = &gSeqChannelNone;
} }

View File

@ -177,7 +177,7 @@ void AudioThread_ProcessGlobalCmd(AudioCmd* cmd) {
gAudioSoundMode = cmd->asUInt; gAudioSoundMode = cmd->asUInt;
break; break;
case AUDIOCMD_OP_GLOBAL_MUTE: case AUDIOCMD_OP_GLOBAL_MUTE:
for (i = 0; i < 4; i++) { for (i = 0; i < ARRAY_COUNT(gSeqPlayers); i++) {
SequencePlayer* seqplayer = &gSeqPlayers[i]; SequencePlayer* seqplayer = &gSeqPlayers[i];
seqplayer->muted = true; 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]; SequencePlayer* seqplayer = &gSeqPlayers[i];
seqplayer->muted = false; seqplayer->muted = false;
@ -315,7 +315,7 @@ void AudioThread_ProcessCmds(u32 msg) {
} }
if ((cmd->op & 0xF0) == 0xF0) { if ((cmd->op & 0xF0) == 0xF0) {
AudioThread_ProcessGlobalCmd(cmd); AudioThread_ProcessGlobalCmd(cmd);
} else if (cmd->arg0 < 4) { } else if (cmd->arg0 < ARRAY_COUNT(gSeqPlayers)) {
player = &gSeqPlayers[cmd->arg0]; player = &gSeqPlayers[cmd->arg0];
if (cmd->op & 0x80) { if (cmd->op & 0x80) {
AudioThread_ProcessGlobalCmd(cmd); AudioThread_ProcessGlobalCmd(cmd);

View File

@ -422,7 +422,7 @@ void ActorAllRange_SpawnStarWolf(void) {
Actor* actor; Actor* actor;
s32 i; s32 i;
for (i = 0, actor = &gActors[4]; i < 4; i++, actor++) { for (i = 0, actor = &gActors[4]; i < ARRAY_COUNT(sStarWolfSpawnPos); i++, actor++) {
if (gStarWolfTeamAlive[i] != 0) { if (gStarWolfTeamAlive[i] != 0) {
Actor_Initialize(actor); Actor_Initialize(actor);
actor->obj.status = OBJ_ACTIVE; actor->obj.status = OBJ_ACTIVE;

View File

@ -743,7 +743,7 @@ void func_beam_80038140(PlayerShot* shot) {
sp60 = false; sp60 = false;
} }
if (sp60) { if (sp60) {
for (i = 0, effect = gEffects; i < 100; i++, effect++) { for (i = 0, effect = gEffects; i < ARRAY_COUNT(gEffects); i++, effect++) {
if ((effect->obj.status >= OBJ_ACTIVE) && (effect->info.unk_19 != 0) && if ((effect->obj.status >= OBJ_ACTIVE) && (effect->info.unk_19 != 0) &&
(fabsf(shot->obj.pos.z - effect->obj.pos.z) < 200.0f) && (fabsf(shot->obj.pos.z - effect->obj.pos.z) < 200.0f) &&
(fabsf(shot->obj.pos.x - effect->obj.pos.x) < 100.0f) && (fabsf(shot->obj.pos.x - effect->obj.pos.x) < 100.0f) &&
@ -914,7 +914,7 @@ void func_beam_80038140(PlayerShot* shot) {
} }
} }
} else { } else {
for (i = 0, scenery = gScenery; i < 50; i++, scenery++) { for (i = 0, scenery = gScenery; i < ARRAY_COUNT(gScenery); i++, scenery++) {
if (scenery->obj.status == OBJ_ACTIVE) { if (scenery->obj.status == OBJ_ACTIVE) {
if ((scenery->obj.id == OBJ_SCENERY_1) || (scenery->obj.id == OBJ_SCENERY_ME_TUNNEL) || if ((scenery->obj.id == OBJ_SCENERY_1) || (scenery->obj.id == OBJ_SCENERY_ME_TUNNEL) ||
(scenery->obj.id == OBJ_SCENERY_4) || (scenery->obj.id == OBJ_SCENERY_5) || (scenery->obj.id == OBJ_SCENERY_4) || (scenery->obj.id == OBJ_SCENERY_5) ||
@ -935,7 +935,7 @@ void func_beam_80038140(PlayerShot* shot) {
} }
} }
if (sp60) { if (sp60) {
for (i = 0, sprite = gSprites; i < 40; i++, sprite++) { for (i = 0, sprite = gSprites; i < ARRAY_COUNT(gSprites); i++, sprite++) {
if (sprite->obj.status == OBJ_ACTIVE) { if (sprite->obj.status == OBJ_ACTIVE) {
if (sprite->obj.id != OBJ_SPRITE_TI_CACTUS) { if (sprite->obj.id != OBJ_SPRITE_TI_CACTUS) {
if (func_beam_80037698(shot, sprite)) { if (func_beam_80037698(shot, sprite)) {
@ -949,7 +949,7 @@ void func_beam_80038140(PlayerShot* shot) {
} }
} }
} }
for (i = 0, boss = gBosses; i < 4; i++, boss++) { for (i = 0, boss = gBosses; i < ARRAY_COUNT(gBosses); i++, boss++) {
if ((boss->obj.status == OBJ_ACTIVE) && (boss->timer_05A == 0)) { if ((boss->obj.status == OBJ_ACTIVE) && (boss->timer_05A == 0)) {
if ((boss->obj.id == OBJ_BOSS_308) || (boss->obj.id == OBJ_BOSS_312) || (boss->obj.id == OBJ_BOSS_309) || if ((boss->obj.id == OBJ_BOSS_308) || (boss->obj.id == OBJ_BOSS_312) || (boss->obj.id == OBJ_BOSS_309) ||
(boss->obj.id == OBJ_BOSS_313)) { (boss->obj.id == OBJ_BOSS_313)) {
@ -1856,7 +1856,7 @@ void func_beam_8003C4D0(PlayerShot* shot, s32 damage) {
Player* player; Player* player;
f32 temp_fs2 = shot->scale * 60.0f; f32 temp_fs2 = shot->scale * 60.0f;
for (i = 0, scenery = gScenery; i < 50; i++, scenery++) { for (i = 0, scenery = gScenery; i < ARRAY_COUNT(gScenery); i++, scenery++) {
if ((scenery->obj.status == OBJ_ACTIVE) && (scenery->obj.id == OBJ_SCENERY_56)) { if ((scenery->obj.status == OBJ_ACTIVE) && (scenery->obj.id == OBJ_SCENERY_56)) {
sp68 = scenery->obj.pos.x - shot->obj.pos.x; sp68 = scenery->obj.pos.x - shot->obj.pos.x;
sp64 = scenery->obj.pos.y - shot->obj.pos.y; sp64 = scenery->obj.pos.y - shot->obj.pos.y;
@ -1867,7 +1867,7 @@ void func_beam_8003C4D0(PlayerShot* shot, s32 damage) {
scenery->dmgPart = 0; scenery->dmgPart = 0;
} }
} }
for (i = 0, sprite = gSprites; i < 40; i++, sprite++) { for (i = 0, sprite = gSprites; i < ARRAY_COUNT(gSprites); i++, sprite++) {
if ((sprite->obj.status == OBJ_ACTIVE) && if ((sprite->obj.status == OBJ_ACTIVE) &&
((sprite->obj.id == OBJ_SPRITE_FO_POLE) || (sprite->obj.id == OBJ_SPRITE_TI_CACTUS) || ((sprite->obj.id == OBJ_SPRITE_FO_POLE) || (sprite->obj.id == OBJ_SPRITE_TI_CACTUS) ||
(sprite->obj.id == OBJ_SPRITE_CO_POLE) || (sprite->obj.id == OBJ_SPRITE_CO_TREE))) { (sprite->obj.id == OBJ_SPRITE_CO_POLE) || (sprite->obj.id == OBJ_SPRITE_CO_TREE))) {
@ -1943,7 +1943,7 @@ void func_beam_8003C4D0(PlayerShot* shot, s32 damage) {
func_beam_8003C008(shot); func_beam_8003C008(shot);
} }
effect = gEffects; effect = gEffects;
for (i = 0; i < 100; i++, effect++) { for (i = 0; i < ARRAY_COUNT(gEffects); i++, effect++) {
if (effect->obj.status == OBJ_ACTIVE) { if (effect->obj.status == OBJ_ACTIVE) {
sp68 = effect->obj.pos.x - shot->obj.pos.x; sp68 = effect->obj.pos.x - shot->obj.pos.x;
sp64 = effect->obj.pos.y - shot->obj.pos.y; sp64 = effect->obj.pos.y - shot->obj.pos.y;

View File

@ -926,7 +926,7 @@ void Background_DrawGround(void) {
} else { } else {
gGroundSurface = SURFACE_GRASS; gGroundSurface = SURFACE_GRASS;
gBgColor = 0x845; // 8, 8, 32 gBgColor = 0x845; // 8, 8, 32
for (i = 0; i < 4; i++) { for (i = 0; i < ARRAY_COUNT(sGroundPositions360x); i++) {
Matrix_Push(&gGfxMatrix); Matrix_Push(&gGfxMatrix);
Matrix_Translate(gGfxMatrix, sGroundPositions360x[i], 0.0f, sGroundPositions360z[i], MTXF_APPLY); Matrix_Translate(gGfxMatrix, sGroundPositions360x[i], 0.0f, sGroundPositions360z[i], MTXF_APPLY);
Matrix_SetGfxMtx(&gMasterDisp); Matrix_SetGfxMtx(&gMasterDisp);
@ -992,7 +992,7 @@ void Background_DrawGround(void) {
gSPDisplayList(gMasterDisp++, D_TR_6005880); gSPDisplayList(gMasterDisp++, D_TR_6005880);
Matrix_Pop(&gGfxMatrix); Matrix_Pop(&gGfxMatrix);
} else { } else {
for (i = 0; i < 4; i++) { for (i = 0; i < ARRAY_COUNT(sGroundPositions360x); i++) {
Matrix_Push(&gGfxMatrix); Matrix_Push(&gGfxMatrix);
Matrix_Translate(gGfxMatrix, sGroundPositions360x[i], 0.0f, sGroundPositions360z[i], MTXF_APPLY); Matrix_Translate(gGfxMatrix, sGroundPositions360x[i], 0.0f, sGroundPositions360z[i], MTXF_APPLY);
Matrix_Scale(gGfxMatrix, 1.5f, 1.0f, 1.0f, MTXF_APPLY); Matrix_Scale(gGfxMatrix, 1.5f, 1.0f, 1.0f, MTXF_APPLY);
@ -1071,7 +1071,7 @@ void Background_DrawGround(void) {
} else { } else {
RCP_SetupDL_20(gFogRed, gFogGreen, gFogBlue, gFogAlpha, gFogNear, gFogFar); RCP_SetupDL_20(gFogRed, gFogGreen, gFogBlue, gFogAlpha, gFogNear, gFogFar);
} }
for (i = 0; i < 4; i++) { for (i = 0; i < ARRAY_COUNT(sGroundPositions360x); i++) {
Matrix_Push(&gGfxMatrix); Matrix_Push(&gGfxMatrix);
Matrix_Translate(gGfxMatrix, sGroundPositions360x[i], 0.0f, sGroundPositions360z[i], MTXF_APPLY); Matrix_Translate(gGfxMatrix, sGroundPositions360x[i], 0.0f, sGroundPositions360z[i], MTXF_APPLY);
Matrix_SetGfxMtx(&gMasterDisp); Matrix_SetGfxMtx(&gMasterDisp);
@ -1093,7 +1093,7 @@ void Background_DrawGround(void) {
} else { } else {
RCP_SetupDL_20(gFogRed, gFogGreen, gFogBlue, gFogAlpha, gFogNear, gFogFar); RCP_SetupDL_20(gFogRed, gFogGreen, gFogBlue, gFogAlpha, gFogNear, gFogFar);
} }
for (i = 0; i < 4; i++) { for (i = 0; i < ARRAY_COUNT(sGroundPositions360x); i++) {
Matrix_Push(&gGfxMatrix); Matrix_Push(&gGfxMatrix);
Matrix_Translate(gGfxMatrix, sGroundPositions360x[i], 0.0f, sGroundPositions360z[i], MTXF_APPLY); Matrix_Translate(gGfxMatrix, sGroundPositions360x[i], 0.0f, sGroundPositions360z[i], MTXF_APPLY);
Matrix_SetGfxMtx(&gMasterDisp); Matrix_SetGfxMtx(&gMasterDisp);

View File

@ -87,7 +87,7 @@ void Boss_SpawnActor189(f32 arg0, f32 arg1, f32 arg2, f32 arg3, f32 arg4, f32 ar
f32 arg9, s32 argA, s32 argB) { f32 arg9, s32 argA, s32 argB) {
s32 i; s32 i;
for (i = 59; i >= 0; i--) { for (i = (ARRAY_COUNT(gActors)) - 1; i >= 0; i--) {
if (gActors[i].obj.status == OBJ_FREE) { if (gActors[i].obj.status == OBJ_FREE) {
Boss_SetupActor189(&gActors[i], arg0, arg1, arg2, arg3, arg4, arg5, arg6, arg7, arg8, arg9, argA, argB); Boss_SetupActor189(&gActors[i], arg0, arg1, arg2, arg3, arg4, arg5, arg6, arg7, arg8, arg9, argA, argB);
return; return;

View File

@ -2933,7 +2933,7 @@ void Cutscene_DrawGreatFox(void) {
((gCurrentLevel != LEVEL_SECTOR_Z) || (gPlayer[0].state_1C8 == PLAYERSTATE_1C8_LEVEL_COMPLETE))) { ((gCurrentLevel != LEVEL_SECTOR_Z) || (gPlayer[0].state_1C8 == PLAYERSTATE_1C8_LEVEL_COMPLETE))) {
RCP_SetupDL_49(); RCP_SetupDL_49();
gDPSetPrimColor(gMasterDisp++, 0, 0, 255, 255, 255, 255); gDPSetPrimColor(gMasterDisp++, 0, 0, 255, 255, 255, 255);
for (i = 0, var_s6_2 = D_demo_800CA0BC; i < 4; i++, var_s6_2++) { for (i = 0, var_s6_2 = D_demo_800CA0BC; i < ARRAY_COUNT(sp9C); i++, var_s6_2++) {
if ((i != 1) || gGreatFoxIntact) { if ((i != 1) || gGreatFoxIntact) {
sp9C[i] = 0.0f; sp9C[i] = 0.0f;
if (i < 2) { if (i < 2) {

View File

@ -632,7 +632,7 @@ void func_effect_800794CC(f32 xPos, f32 yPos, f32 zPos, f32 scale2) {
void func_effect_8007953C(f32 xPos, f32 yPos, f32 zPos, f32 scale2) { void func_effect_8007953C(f32 xPos, f32 yPos, f32 zPos, f32 scale2) {
s32 i; s32 i;
for (i = 79; i >= 0; i--) { for (i = (ARRAY_COUNT(gEffects) - 20) - 1; i >= 0; i--) {
if (gEffects[i].obj.status == OBJ_FREE) { if (gEffects[i].obj.status == OBJ_FREE) {
func_effect_8007905C(&gEffects[i], xPos, yPos, zPos, scale2, 0); func_effect_8007905C(&gEffects[i], xPos, yPos, zPos, scale2, 0);
break; break;

View File

@ -1981,7 +1981,7 @@ void func_enmy_80067348(Actor* actor, f32 xPos, f32 yPos, f32 zPos, f32 xRot, f3
void func_enmy_800674B4(f32 xPos, f32 yPos, f32 zPos, f32 xRot, f32 yRot, f32 arg5, f32 arg6, f32 arg7) { void func_enmy_800674B4(f32 xPos, f32 yPos, f32 zPos, f32 xRot, f32 yRot, f32 arg5, f32 arg6, f32 arg7) {
s32 i; s32 i;
for (i = 59; i >= 50; i--) { for (i = ARRAY_COUNT(gActors) - 1; i >= 50; i--) {
if (gActors[i].obj.status == OBJ_FREE) { if (gActors[i].obj.status == OBJ_FREE) {
func_enmy_80067348(&gActors[i], xPos, yPos, zPos, xRot, yRot, arg5, arg6, arg7); func_enmy_80067348(&gActors[i], xPos, yPos, zPos, xRot, yRot, arg5, arg6, arg7);
break; break;

View File

@ -412,7 +412,7 @@ void Game_Update(void) {
gVersusStage = 0; gVersusStage = 0;
gVsPointsToWin = 3; gVsPointsToWin = 3;
gBlurAlpha = 255; gBlurAlpha = 255;
for (i = 0; i < 30; i++) { for (i = 0; i < ARRAY_COUNT(gLeveLClearStatus); i++) {
gLeveLClearStatus[i] = 0; gLeveLClearStatus[i] = 0;
} }
gExpertMode = false; gExpertMode = false;

View File

@ -1979,7 +1979,7 @@ void func_hud_8008A240(void) {
} }
if (gVersusMode == 1) { if (gVersusMode == 1) {
for (i = 0, item = gItems; i < 20; i++, item++) { for (i = 0, item = gItems; i < ARRAY_COUNT(gItems); i++, item++) {
if (item->obj.status >= OBJ_ACTIVE) { if (item->obj.status >= OBJ_ACTIVE) {
gRadarMarks[item->index + 50].status = 1; gRadarMarks[item->index + 50].status = 1;
gRadarMarks[item->index + 50].type = 103; gRadarMarks[item->index + 50].type = 103;
@ -2132,7 +2132,7 @@ s32 func_hud_8008A4DC(void) {
D_hud_80161710--; D_hud_80161710--;
} }
for (i = 64; i >= 0; i--) { for (i = ARRAY_COUNT(gRadarMarks) - 1; i >= 0; i--) {
if ((gRadarMarks[i].status == 0) || (fabsf(gRadarMarks[i].pos.x) >= (temp2 + 1000.0f)) || if ((gRadarMarks[i].status == 0) || (fabsf(gRadarMarks[i].pos.x) >= (temp2 + 1000.0f)) ||
(fabsf(gRadarMarks[i].pos.z) >= (temp2 + 1000.0f))) { (fabsf(gRadarMarks[i].pos.z) >= (temp2 + 1000.0f))) {
continue; continue;
@ -2458,7 +2458,7 @@ s32 func_hud_8008B774(void) {
if ((i >= 1) && (i <= 3) && if ((i >= 1) && (i <= 3) &&
((gLevelMode != LEVELMODE_ALL_RANGE) || (gCurrentLevel == LEVEL_CORNERIA) || ((gLevelMode != LEVELMODE_ALL_RANGE) || (gCurrentLevel == LEVEL_CORNERIA) ||
(gCurrentLevel == LEVEL_SECTOR_Y))) { (gCurrentLevel == LEVEL_SECTOR_Y))) {
for (i = 0; i < 60; i++) { for (i = 0; i < ARRAY_COUNT(gActors); i++) {
if ((gActors[i].obj.status == OBJ_ACTIVE) && (gActors[i].iwork[12] == temp)) { if ((gActors[i].obj.status == OBJ_ACTIVE) && (gActors[i].iwork[12] == temp)) {
if ((gActors[i].unk_0B4 == EVID_2) || (gActors[i].unk_0B4 == EVID_43) || if ((gActors[i].unk_0B4 == EVID_2) || (gActors[i].unk_0B4 == EVID_43) ||
((gActors[i].obj.id == OBJ_ACTOR_TEAM_BOSS) && ((gActors[i].obj.id == OBJ_ACTOR_TEAM_BOSS) &&
@ -3848,7 +3848,7 @@ bool func_hud_8009092C(Actor* actor) {
boss = &gBosses[1]; boss = &gBosses[1];
for (i = 1; i < 4; i++, boss++) { for (i = 1; i < ARRAY_COUNT(gBosses); i++, boss++) {
if (boss->obj.status == OBJ_ACTIVE) { if (boss->obj.status == OBJ_ACTIVE) {
var_s5 = true; var_s5 = true;
if (actor->aiIndex == 0) { if (actor->aiIndex == 0) {

View File

@ -2544,7 +2544,7 @@ void Play_Init(void) {
s32 i; s32 i;
gArwingSpeed = 40.0f; gArwingSpeed = 40.0f;
for (i = 0; i < 4; i++) { for (i = 0; i < ARRAY_COUNT(gControllerRumbleEnabled); i++) {
gControllerRumbleEnabled[i] = 0; gControllerRumbleEnabled[i] = 0;
} }

View File

@ -1592,7 +1592,7 @@ bool Ending_8018BCB0(void) {
Lights_SetOneLight(&gMasterDisp, gLight1x, gLight1y, gLight1z, gLight1R, gLight1G, gLight1B, gAmbientR, gAmbientG, Lights_SetOneLight(&gMasterDisp, gLight1x, gLight1y, gLight1z, gLight1R, gLight1G, gLight1B, gAmbientR, gAmbientG,
gAmbientB); gAmbientB);
for (i = 59; i >= 0; i--) { for (i = ARRAY_COUNT(gActors) - 1; i >= 0; i--) {
if (gActors[i].obj.status != OBJ_FREE) { if (gActors[i].obj.status != OBJ_FREE) {
switch (gActors[i].obj.id) { switch (gActors[i].obj.id) {
case 0: case 0:
@ -1752,7 +1752,7 @@ void Ending_8018C21C(void) {
Matrix_Push(&gGfxMatrix); Matrix_Push(&gGfxMatrix);
for (i = 59; i >= 0; i--) { for (i = ARRAY_COUNT(gActors) - 1; i >= 0; i--) {
if (gActors[i].obj.status != OBJ_FREE) { if (gActors[i].obj.status != OBJ_FREE) {
Matrix_Push(&gGfxMatrix); Matrix_Push(&gGfxMatrix);
switch (gActors[i].obj.id) { switch (gActors[i].obj.id) {

View File

@ -307,7 +307,7 @@ void Corneria_80187AC8(Boss* boss) {
if (!(D_edisplay_801615D0.y < 0.0f)) { if (!(D_edisplay_801615D0.y < 0.0f)) {
sprite = gSprites; sprite = gSprites;
for (var_s1 = 0; var_s1 < 40; var_s1++, sprite++) { for (var_s1 = 0; var_s1 < ARRAY_COUNT(gSprites); var_s1++, sprite++) {
if ((sprite->obj.status == OBJ_ACTIVE) && (sprite->obj.id == OBJ_SPRITE_CO_TREE)) { if ((sprite->obj.status == OBJ_ACTIVE) && (sprite->obj.id == OBJ_SPRITE_CO_TREE)) {
if ((fabsf(sprite->obj.pos.x - D_i1_8019B6D8[20]) < 90.0f) && if ((fabsf(sprite->obj.pos.x - D_i1_8019B6D8[20]) < 90.0f) &&
(fabsf(sprite->obj.pos.z - D_i1_8019B6D8[32]) < 90.0f)) { (fabsf(sprite->obj.pos.z - D_i1_8019B6D8[32]) < 90.0f)) {
@ -1203,7 +1203,7 @@ void Corneria_8018AED0(Actor* actor) {
void Corneria_8018B0B4(Actor* actor) { void Corneria_8018B0B4(Actor* actor) {
s32 i; s32 i;
for (i = 0; i < 50; i++) { for (i = 0; i < ARRAY_COUNT(gScenery); i++) {
if (gScenery[i].obj.status == OBJ_FREE) { if (gScenery[i].obj.status == OBJ_FREE) {
Scenery_Initialize(&gScenery[i]); Scenery_Initialize(&gScenery[i]);
gScenery[i].obj.status = OBJ_INIT; gScenery[i].obj.status = OBJ_INIT;
@ -1503,7 +1503,7 @@ void Corneria_Boss293_Init(Boss293* this) {
temp_s1 = this->timer_05A; temp_s1 = this->timer_05A;
// Bosses OBJ_BOSS_294 to OBJ_BOSS_296 // Bosses OBJ_BOSS_294 to OBJ_BOSS_296
for (i = 1; i < 4; i++) { for (i = 1; i < ARRAY_COUNT(gBosses); i++) {
Boss_Initialize(&gBosses[i]); Boss_Initialize(&gBosses[i]);
gBosses[i].obj.status = OBJ_INIT; gBosses[i].obj.status = OBJ_INIT;
gBosses[i].obj.id = i + 293; gBosses[i].obj.id = i + 293;
@ -1869,7 +1869,7 @@ void Corneria_8018C19C(Boss* boss) {
Matrix_MultVec3f(gCalcMatrix, &D_i1_801998F0[0], &sp84[3]); Matrix_MultVec3f(gCalcMatrix, &D_i1_801998F0[0], &sp84[3]);
effect = gEffects; effect = gEffects;
for (i = 0; i < 100; i++, effect++) { for (i = 0; i < ARRAY_COUNT(gEffects); i++, effect++) {
if (effect->obj.status == OBJ_FREE) { if (effect->obj.status == OBJ_FREE) {
Effect_Initialize(effect); Effect_Initialize(effect);
effect->obj.status = OBJ_INIT; effect->obj.status = OBJ_INIT;
@ -2474,7 +2474,7 @@ void Corneria_8018F4A4(void) {
s32 i; s32 i;
if (((gGameFrameCount % 16) == 0) && !(gPlayer[0].csState < 4)) { if (((gGameFrameCount % 16) == 0) && !(gPlayer[0].csState < 4)) {
for (i = 0; i < 50; i++) { for (i = 0; i < ARRAY_COUNT(gScenery); i++) {
if (gScenery[i].obj.status == OBJ_FREE) { if (gScenery[i].obj.status == OBJ_FREE) {
Corneria_8018F3BC(&gScenery[i], 4000.0f); Corneria_8018F3BC(&gScenery[i], 4000.0f);
break; break;

View File

@ -255,7 +255,7 @@ void Venom1_BossTrigger1_Update(Ve1BossTrigger1* this) {
Boss* boss = &gBosses[0]; Boss* boss = &gBosses[0];
s32 i; s32 i;
for (i = 0; i < 4; i++, boss++) { for (i = 0; i < ARRAY_COUNT(gBosses); i++, boss++) {
if ((boss->obj.status != OBJ_FREE) && (boss->obj.id == OBJ_BOSS_319)) { if ((boss->obj.status != OBJ_FREE) && (boss->obj.id == OBJ_BOSS_319)) {
if (boss->obj.pos.z <= this->obj.pos.z) { if (boss->obj.pos.z <= this->obj.pos.z) {
D_i1_8019C0B8 = (s32) this->obj.rot.x + 1; D_i1_8019C0B8 = (s32) this->obj.rot.x + 1;
@ -270,7 +270,7 @@ void Venom1_BossTrigger2_Update(Ve1BossTrigger2* this) {
Boss* boss = &gBosses[0]; Boss* boss = &gBosses[0];
s32 i; s32 i;
for (i = 0; i < 4; i++, boss++) { for (i = 0; i < ARRAY_COUNT(gBosses); i++, boss++) {
if ((boss->obj.status != OBJ_FREE) && (boss->obj.id == OBJ_BOSS_319)) { if ((boss->obj.status != OBJ_FREE) && (boss->obj.id == OBJ_BOSS_319)) {
if (boss->obj.pos.z <= this->obj.pos.z) { if (boss->obj.pos.z <= this->obj.pos.z) {
D_i1_8019C0B8 = 0; D_i1_8019C0B8 = 0;
@ -285,7 +285,7 @@ void Venom1_BossTrigger3_Update(Ve1BossTrigger3* this) {
Boss* boss = &gBosses[0]; Boss* boss = &gBosses[0];
s32 i; s32 i;
for (i = 0; i < 4; i++, boss++) { for (i = 0; i < ARRAY_COUNT(gBosses); i++, boss++) {
if ((boss->obj.status != OBJ_FREE) && (boss->obj.id == OBJ_BOSS_319)) { if ((boss->obj.status != OBJ_FREE) && (boss->obj.id == OBJ_BOSS_319)) {
if (boss->obj.pos.z <= this->obj.pos.z) { if (boss->obj.pos.z <= this->obj.pos.z) {
D_i1_8019C0BC = (s32) this->obj.rot.x + 1; D_i1_8019C0BC = (s32) this->obj.rot.x + 1;
@ -300,7 +300,7 @@ void Venom1_BossTrigger4_Update(Ve1BossTrigger4* this) {
Boss* boss = &gBosses[0]; Boss* boss = &gBosses[0];
s32 i; s32 i;
for (i = 0; i < 4; i++, boss++) { for (i = 0; i < ARRAY_COUNT(gBosses); i++, boss++) {
if ((boss->obj.status != OBJ_FREE) && (boss->obj.id == OBJ_BOSS_319)) { if ((boss->obj.status != OBJ_FREE) && (boss->obj.id == OBJ_BOSS_319)) {
if (boss->obj.pos.z <= this->obj.pos.z) { if (boss->obj.pos.z <= this->obj.pos.z) {
D_i1_8019C0C0 = 1; D_i1_8019C0C0 = 1;
@ -361,7 +361,7 @@ void Venom1_80192518(Actor* actor) {
scenery = &gScenery[0]; scenery = &gScenery[0];
for (i = 0; i < 50; i++, scenery++) { for (i = 0; i < ARRAY_COUNT(gScenery); i++, scenery++) {
if ((scenery->obj.id == OBJ_SCENERY_128) || (scenery->obj.id == OBJ_SCENERY_129) || if ((scenery->obj.id == OBJ_SCENERY_128) || (scenery->obj.id == OBJ_SCENERY_129) ||
(scenery->obj.id == OBJ_SCENERY_130)) { (scenery->obj.id == OBJ_SCENERY_130)) {
if (((actor->obj.pos.z + 1100.0f - scenery->obj.pos.z) < 2200.0f) && if (((actor->obj.pos.z + 1100.0f - scenery->obj.pos.z) < 2200.0f) &&
@ -692,7 +692,7 @@ void Venom1_80192EB0(Actor* actor) {
var_ft4 = 0.0f; var_ft4 = 0.0f;
scenery = gScenery; scenery = gScenery;
for (i = 0; i < 50; i++, scenery++) { for (i = 0; i < ARRAY_COUNT(gScenery); i++, scenery++) {
if (((scenery->obj.id == OBJ_SCENERY_128) || (scenery->obj.id == OBJ_SCENERY_129) || if (((scenery->obj.id == OBJ_SCENERY_128) || (scenery->obj.id == OBJ_SCENERY_129) ||
(scenery->obj.id == OBJ_SCENERY_130)) && (scenery->obj.id == OBJ_SCENERY_130)) &&
((actor->obj.pos.z + 1100.0f - scenery->obj.pos.z) < 2200.0f) && ((actor->obj.pos.z + 1100.0f - scenery->obj.pos.z) < 2200.0f) &&
@ -2217,7 +2217,7 @@ void Venom1_80194398(Boss* boss) {
is4 = boss->swork[23]; is4 = boss->swork[23];
temp_fs0 = boss->obj.pos.z; temp_fs0 = boss->obj.pos.z;
var_fv0 = -1500.0f; var_fv0 = -1500.0f;
for (spF4 = 0; spF4 < 60; spF4++, actor++) { for (spF4 = 0; spF4 < ARRAY_COUNT(gActors); spF4++, actor++) {
if (actor->obj.status == OBJ_FREE) { if (actor->obj.status == OBJ_FREE) {
while ((is3 <= boss->swork[22]) && while ((is3 <= boss->swork[22]) &&
@ -2249,7 +2249,7 @@ void Venom1_80194398(Boss* boss) {
is4 = boss->swork[23]; is4 = boss->swork[23];
temp_fs0 = boss->obj.pos.z; temp_fs0 = boss->obj.pos.z;
var_fv0 = -1500.0f; var_fv0 = -1500.0f;
for (spF4 = 0; spF4 < 60; spF4++, actor++) { for (spF4 = 0; spF4 < ARRAY_COUNT(gActors); spF4++, actor++) {
if (actor->obj.status == OBJ_FREE) { if (actor->obj.status == OBJ_FREE) {
while ((is3 > boss->swork[22]) && while ((is3 > boss->swork[22]) &&
@ -2282,7 +2282,7 @@ void Venom1_80194398(Boss* boss) {
is4 = boss->swork[23]; is4 = boss->swork[23];
temp_fs0 = boss->obj.pos.z; temp_fs0 = boss->obj.pos.z;
var_fv0 = (gPlayer[0].pos.z + -1500.0f); var_fv0 = (gPlayer[0].pos.z + -1500.0f);
for (spF4 = 0; spF4 < 60; spF4++, actor++) { for (spF4 = 0; spF4 < ARRAY_COUNT(gActors); spF4++, actor++) {
if (actor->obj.status == OBJ_FREE) { if (actor->obj.status == OBJ_FREE) {
while ((is3 > D_i1_80199E60[is4]) && (var_fv0) <= (temp_fs0 + D_i1_80199E6C[is4][is3].z)) { while ((is3 > D_i1_80199E60[is4]) && (var_fv0) <= (temp_fs0 + D_i1_80199E6C[is4][is3].z)) {
is3++; is3++;
@ -2305,7 +2305,7 @@ void Venom1_80194398(Boss* boss) {
} }
} }
actor = gActors; actor = gActors;
for (spF4 = 0; spF4 < 60; spF4++, actor++) { for (spF4 = 0; spF4 < ARRAY_COUNT(gActors); spF4++, actor++) {
if (((actor->obj.id == OBJ_ACTOR_281) || (actor->obj.id == OBJ_ACTOR_282)) && (actor->state == 0) && if (((actor->obj.id == OBJ_ACTOR_281) || (actor->obj.id == OBJ_ACTOR_282)) && (actor->state == 0) &&
(100.f <= (actor->obj.pos.z - boss->obj.pos.z)) && (100.f <= (actor->obj.pos.z - boss->obj.pos.z)) &&
((actor->obj.pos.z - boss->obj.pos.z) <= 2400.0f)) { ((actor->obj.pos.z - boss->obj.pos.z) <= 2400.0f)) {
@ -2380,7 +2380,7 @@ void Venom1_8019864C(PlayerShot* shot) {
Vec3f diff; Vec3f diff;
boss = gBosses; boss = gBosses;
for (i = 0; i < 4; i++, boss++) { for (i = 0; i < ARRAY_COUNT(gBosses); i++, boss++) {
if ((boss->obj.id == OBJ_BOSS_319) && (boss->obj.status == OBJ_ACTIVE) && (boss->timer_05A == 0)) { if ((boss->obj.id == OBJ_BOSS_319) && (boss->obj.status == OBJ_ACTIVE) && (boss->timer_05A == 0)) {
temp_fs1 = shot->scale * 30.0f; temp_fs1 = shot->scale * 30.0f;
hitboxData = boss->info.hitbox; hitboxData = boss->info.hitbox;

View File

@ -357,7 +357,7 @@ void Aquas_801A9448(Vec3f* pos, Vec3f* rot, f32 xVel, f32 yVel, f32 zVel, s32 un
s32 unk48) { s32 unk48) {
s32 i; s32 i;
for (i = 59; i >= 0; i--) { for (i = ARRAY_COUNT(gActors) - 1; i >= 0; i--) {
if (gActors[i].obj.status == OBJ_FREE) { if (gActors[i].obj.status == OBJ_FREE) {
Aquas_801A9374(&gActors[i], pos, rot, xVel, yVel, zVel, unkB8, scale, timerBC, unk48); Aquas_801A9374(&gActors[i], pos, rot, xVel, yVel, zVel, unkB8, scale, timerBC, unk48);
break; break;
@ -1174,7 +1174,7 @@ void Aquas_801AC09C(Player* player) {
s32 i; s32 i;
PlayerShot* shot; PlayerShot* shot;
for (i = 15, shot = &gPlayerShots[15]; i < 16; i++, shot++) { for (i = 15, shot = &gPlayerShots[15]; i < ARRAY_COUNT(gPlayerShots); i++, shot++) {
if (shot->obj.status == OBJ_FREE) { if (shot->obj.status == OBJ_FREE) {
func_play_800AC290(player, shot, 0.0f, 0.0f, PLAYERSHOT_8, 50.0f); func_play_800AC290(player, shot, 0.0f, 0.0f, PLAYERSHOT_8, 50.0f);
AUDIO_PLAY_SFX(0x01000025, shot->sfxSource, 0); AUDIO_PLAY_SFX(0x01000025, shot->sfxSource, 0);
@ -1245,7 +1245,7 @@ void Aquas_801AC274(Player* player) {
D_i3_801C41B8[11] = 10000.0f; D_i3_801C41B8[11] = 10000.0f;
temp = D_i3_801C4190[0]; temp = D_i3_801C4190[0];
for (i = 0, actor = gActors; i < 60; i++, actor++) { for (i = 0, actor = gActors; i < ARRAY_COUNT(gActors); i++, actor++) {
if ((actor->obj.status == OBJ_ACTIVE) && (actor->obj.id != OBJ_ACTOR_189)) { if ((actor->obj.status == OBJ_ACTIVE) && (actor->obj.id != OBJ_ACTOR_189)) {
var_v1 = 1; var_v1 = 1;
if (actor->info.hitbox[1] == HITBOX_ROTATED) { if (actor->info.hitbox[1] == HITBOX_ROTATED) {
@ -1867,7 +1867,7 @@ void Aquas_801AE3D8(Actor* actor) {
if (gBosses[0].timer_052 == 0) { if (gBosses[0].timer_052 == 0) {
gBosses[0].timer_052 = 72; gBosses[0].timer_052 = 72;
actor->health = 10; actor->health = 10;
for (i = 0; i < 60; i++) { for (i = 0; i < ARRAY_COUNT(gActors); i++) {
if ((gActors[i].obj.id == OBJ_ACTOR_256) && (actor->index != gActors[i].index)) { if ((gActors[i].obj.id == OBJ_ACTOR_256) && (actor->index != gActors[i].index)) {
gActors[i].health = 10; gActors[i].health = 10;
} }
@ -2193,7 +2193,7 @@ void Aquas_801AFA5C(Actor* actor) {
} }
if ((actor->iwork[1] == 13) && (i < 0)) { if ((actor->iwork[1] == 13) && (i < 0)) {
AUDIO_PLAY_SFX(0x29022048, actor->sfxSource, 4); AUDIO_PLAY_SFX(0x29022048, actor->sfxSource, 4);
for (i = 0, sp48 = gActors; i < 60; i++, sp48++) { for (i = 0, sp48 = gActors; i < ARRAY_COUNT(gActors); i++, sp48++) {
if (sp48->obj.status == OBJ_FREE) { if (sp48->obj.status == OBJ_FREE) {
Actor_Initialize(sp48); Actor_Initialize(sp48);
sp48->obj.status = OBJ_INIT; sp48->obj.status = OBJ_INIT;
@ -2224,7 +2224,7 @@ void Aquas_801AFA5C(Actor* actor) {
break; break;
} }
} }
if (i >= 60) { if (i >= ARRAY_COUNT(gActors)) {
actor->iwork[3] = 0; actor->iwork[3] = 0;
sp48->obj.status = OBJ_FREE; sp48->obj.status = OBJ_FREE;
} }
@ -2796,7 +2796,7 @@ void Aquas_801B134C(Boss* bossAQ) {
D_i3_801C4308[79] = 0.0f; D_i3_801C4308[79] = 0.0f;
AUDIO_PLAY_SFX(0x29408054, bossAQ->sfxSource, 4); AUDIO_PLAY_SFX(0x29408054, bossAQ->sfxSource, 4);
if (bossAQ->state < 14) { if (bossAQ->state < 14) {
for (i3 = 0, actor = gActors; i3 < 60; i3++, actor++) { for (i3 = 0, actor = gActors; i3 < ARRAY_COUNT(gActors); i3++, actor++) {
if ((actor->obj.id == OBJ_ACTOR_260) && (actor->obj.status == OBJ_ACTIVE)) { if ((actor->obj.id == OBJ_ACTOR_260) && (actor->obj.status == OBJ_ACTIVE)) {
actor->iwork[0] = 1; actor->iwork[0] = 1;
} }
@ -3126,8 +3126,8 @@ void Aquas_801B134C(Boss* bossAQ) {
spD4.z = D_i3_801C4308[75 + 3 * i7]; spD4.z = D_i3_801C4308[75 + 3 * i7];
func_effect_8007A6F0(&spD4, 0x2903404B); func_effect_8007A6F0(&spD4, 0x2903404B);
i2 = 0; i2 = 0;
for (i3 = 0; i2 <= i && i3 < 60; i3++) { for (i3 = 0; i2 <= i && i3 < ARRAY_COUNT(gActors); i3++) {
if ((gActors[i3].obj.status == OBJ_FREE) && (i3 < 60)) { if ((gActors[i3].obj.status == OBJ_FREE) && (i3 < ARRAY_COUNT(gActors))) {
Actor_Initialize(&gActors[i3]); Actor_Initialize(&gActors[i3]);
gActors[i3].obj.status = OBJ_INIT; gActors[i3].obj.status = OBJ_INIT;
@ -3163,7 +3163,7 @@ void Aquas_801B134C(Boss* bossAQ) {
gActors[i3].fwork[1] = D_i3_801C4308[i7 + 16]; gActors[i3].fwork[1] = D_i3_801C4308[i7 + 16];
gActors[i3].fwork[2] = D_i3_801C4308[i7 + 18]; gActors[i3].fwork[2] = D_i3_801C4308[i7 + 18];
Object_SetInfo(&gActors[i3].info, gActors[i3].obj.id); Object_SetInfo(&gActors[i3].info, gActors[i3].obj.id);
if (i3 >= 60) { if (i3 >= ARRAY_COUNT(gActors)) {
gActors[i3].obj.status = OBJ_FREE; gActors[i3].obj.status = OBJ_FREE;
} }
i2++; i2++;
@ -3800,7 +3800,7 @@ void Aquas_801B50E8(Actor* actor) {
actor->health = 0; actor->health = 0;
} }
} else if (actor->damage == 30) { } else if (actor->damage == 30) {
for (i = 0, var_v0 = gActors; i < 60; i++, var_v0++) { for (i = 0, var_v0 = gActors; i < ARRAY_COUNT(gActors); i++, var_v0++) {
if ((var_v0->obj.status == OBJ_ACTIVE) && (var_v0->obj.id == OBJ_ACTOR_261) && if ((var_v0->obj.status == OBJ_ACTIVE) && (var_v0->obj.id == OBJ_ACTOR_261) &&
(var_v0->state == 1) && (i != actor->index) && (var_v0->state == 1) && (i != actor->index) &&
(fabsf(var_v0->obj.pos.x - actor->obj.pos.x) <= 300.0f) && (fabsf(var_v0->obj.pos.x - actor->obj.pos.x) <= 300.0f) &&
@ -4054,7 +4054,7 @@ void Aquas_801B638C(Actor* actor) {
} }
} else { } else {
if (((gGameFrameCount % 2) == 0)) { if (((gGameFrameCount % 2) == 0)) {
for (i = 0, var_v0 = gActors; i < 60; i++, var_v0++) { for (i = 0, var_v0 = gActors; i < ARRAY_COUNT(gActors); i++, var_v0++) {
if ((var_v0->obj.status == OBJ_ACTIVE) && (var_v0->obj.id == OBJ_ACTOR_261) && if ((var_v0->obj.status == OBJ_ACTIVE) && (var_v0->obj.id == OBJ_ACTOR_261) &&
(var_v0->state == 1) && (var_v0->state == 1) &&
(fabsf(var_v0->obj.pos.x - actor->fwork[8]) <= (actor->fwork[5] * 48.0f)) && (fabsf(var_v0->obj.pos.x - actor->fwork[8]) <= (actor->fwork[5] * 48.0f)) &&
@ -5215,7 +5215,7 @@ void Aquas_801BA6A4(Actor* actor) {
actor->health = actor->itemDrop = 0; actor->health = actor->itemDrop = 0;
Actor_Despawn(actor); Actor_Despawn(actor);
if (actor->state == 0) { if (actor->state == 0) {
for (i = 0, var_s2 = 0, actor265 = gActors; i < 60 && var_s2 < 4; i++, actor265++) { for (i = 0, var_s2 = 0, actor265 = gActors; i < ARRAY_COUNT(gActors) && var_s2 < 4; i++, actor265++) {
if (actor265->obj.status == OBJ_FREE) { if (actor265->obj.status == OBJ_FREE) {
Actor_Initialize(actor265); Actor_Initialize(actor265);
actor265->obj.status = OBJ_INIT; actor265->obj.status = OBJ_INIT;
@ -5232,7 +5232,7 @@ void Aquas_801BA6A4(Actor* actor) {
var_s2++; var_s2++;
} }
} }
if (i >= 60) { if (i >= ARRAY_COUNT(gActors)) {
actor265->obj.status = OBJ_FREE; actor265->obj.status = OBJ_FREE;
} }
} else { } else {
@ -5401,7 +5401,7 @@ void Aquas_801BB26C(Actor* actor) {
sp54.z = 0.0f; sp54.z = 0.0f;
Matrix_MultVec3fNoTranslate(gCalcMatrix, &sp54, &sp48); Matrix_MultVec3fNoTranslate(gCalcMatrix, &sp54, &sp48);
for (sp64 = 0, actor267 = gActors; sp64 < 60; sp64++, actor267++) { for (sp64 = 0, actor267 = gActors; sp64 < ARRAY_COUNT(gActors); sp64++, actor267++) {
if (actor267->obj.status == OBJ_FREE) { if (actor267->obj.status == OBJ_FREE) {
Actor_Initialize(actor267); Actor_Initialize(actor267);
actor267->obj.status = OBJ_INIT; actor267->obj.status = OBJ_INIT;
@ -5427,7 +5427,7 @@ void Aquas_801BB26C(Actor* actor) {
sp54.z = 0.0f; sp54.z = 0.0f;
Matrix_MultVec3fNoTranslate(gCalcMatrix, &sp54, &sp48); Matrix_MultVec3fNoTranslate(gCalcMatrix, &sp54, &sp48);
for (sp60 = 0, actor267_2 = gActors; sp60 < 60; sp60++, actor267_2++) { for (sp60 = 0, actor267_2 = gActors; sp60 < ARRAY_COUNT(gActors); sp60++, actor267_2++) {
if (actor267_2->obj.status == OBJ_FREE) { if (actor267_2->obj.status == OBJ_FREE) {
Actor_Initialize(actor267_2); Actor_Initialize(actor267_2);
actor267_2->obj.status = OBJ_INIT; actor267_2->obj.status = OBJ_INIT;
@ -5484,7 +5484,7 @@ void Aquas_801BB79C(Actor* actor) {
actor->iwork[20] = 50; actor->iwork[20] = 50;
} }
} else { } else {
for (i = 0, actor122 = gScenery; i < 50; i++, actor122++) { for (i = 0, actor122 = gScenery; i < ARRAY_COUNT(gScenery); i++, actor122++) {
if ((actor122->obj.status == OBJ_ACTIVE) && (actor122->obj.id == OBJ_SCENERY_122) && if ((actor122->obj.status == OBJ_ACTIVE) && (actor122->obj.id == OBJ_SCENERY_122) &&
Object_CheckHitboxCollision(&actor->obj.pos, actor122->info.hitbox, &actor122->obj, Object_CheckHitboxCollision(&actor->obj.pos, actor122->info.hitbox, &actor122->obj,
0.0f, 0.0f, 0.0f) && 0.0f, 0.0f, 0.0f) &&
@ -5510,7 +5510,7 @@ void Aquas_801BB79C(Actor* actor) {
actor->iwork[20] = 50; actor->iwork[20] = 50;
} }
} else { } else {
for (i = 0, actor122 = gScenery; i < 50; i++, actor122++) { for (i = 0, actor122 = gScenery; i < ARRAY_COUNT(gScenery); i++, actor122++) {
if ((actor122->obj.status == OBJ_ACTIVE) && (actor122->obj.id == OBJ_SCENERY_122) && if ((actor122->obj.status == OBJ_ACTIVE) && (actor122->obj.id == OBJ_SCENERY_122) &&
(Object_CheckHitboxCollision(&actor->obj.pos, actor122->info.hitbox, &actor122->obj, (Object_CheckHitboxCollision(&actor->obj.pos, actor122->info.hitbox, &actor122->obj,
0.0f, 0.0f, 0.0f) || 0.0f, 0.0f, 0.0f) ||
@ -5897,7 +5897,7 @@ void Aquas_801BC9A0(Actor* actor) {
case 3: case 3:
for (i = 0; i < 2; i++) { for (i = 0; i < 2; i++) {
for (j = 0; j < 60; j++) { for (j = 0; j < ARRAY_COUNT(gActors); j++) {
if ((gActors[j].obj.status == OBJ_ACTIVE) && (gActors[j].obj.id == OBJ_ACTOR_189) && if ((gActors[j].obj.status == OBJ_ACTIVE) && (gActors[j].obj.id == OBJ_ACTOR_189) &&
(gActors[j].state == 58)) { (gActors[j].state == 58)) {
Object_Kill(&gActors[j].obj, gActors[j].sfxSource); Object_Kill(&gActors[j].obj, gActors[j].sfxSource);
@ -5907,7 +5907,7 @@ void Aquas_801BC9A0(Actor* actor) {
} }
for (i = 0; i < 2; i++) { for (i = 0; i < 2; i++) {
for (j = 0, actor269 = gActors; j < 60; j++, actor269++) { for (j = 0, actor269 = gActors; j < ARRAY_COUNT(gActors); j++, actor269++) {
if (actor269->obj.status == OBJ_FREE) { if (actor269->obj.status == OBJ_FREE) {
Actor_Initialize(actor269); Actor_Initialize(actor269);
actor269->obj.status = OBJ_INIT; actor269->obj.status = OBJ_INIT;
@ -6106,7 +6106,7 @@ void Aquas_801BD54C(Actor* actor) {
case 1: case 1:
sp64 = actor->index; sp64 = actor->index;
for (sp68 = 0; sp68 < 15; sp68++) { for (sp68 = 0; sp68 < 15; sp68++) {
for (sp6C = 0, actor268 = gActors; sp6C < 60; sp6C++, actor268++) { for (sp6C = 0, actor268 = gActors; sp6C < ARRAY_COUNT(gActors); sp6C++, actor268++) {
if (actor268->obj.status == OBJ_FREE) { if (actor268->obj.status == OBJ_FREE) {
Actor_Initialize(actor268); Actor_Initialize(actor268);
actor268->obj.status = OBJ_INIT; actor268->obj.status = OBJ_INIT;

View File

@ -227,7 +227,7 @@ void Solar_8019E920(Effect* effect, f32 xPos, f32 yPos, f32 zPos, f32 xVel, f32
void Solar_8019E9F4(f32 xPos, f32 yPos, f32 zPos, f32 xVel, f32 yVel, f32 zVel, f32 scale2, s32 unk4E) { void Solar_8019E9F4(f32 xPos, f32 yPos, f32 zPos, f32 xVel, f32 yVel, f32 zVel, f32 scale2, s32 unk4E) {
s32 i; s32 i;
for (i = 99; i >= 34; i--) { for (i = ARRAY_COUNT(gEffects) - 1; i >= 34; i--) {
if (gEffects[i].obj.status == OBJ_FREE) { if (gEffects[i].obj.status == OBJ_FREE) {
Solar_8019E920(&gEffects[i], xPos, yPos, zPos, xVel, yVel, zVel, scale2, unk4E); Solar_8019E920(&gEffects[i], xPos, yPos, zPos, xVel, yVel, zVel, scale2, unk4E);
break; break;
@ -1022,7 +1022,7 @@ void Solar_LevelStart(Player* player) {
RAND_FLOAT(2000.0f) - 6000.0f + gPathProgress, RAND_FLOAT(20.0f) + 20.0f); RAND_FLOAT(2000.0f) - 6000.0f + gPathProgress, RAND_FLOAT(20.0f) + 20.0f);
} }
if (gCsFrameCount == 380) { if (gCsFrameCount == 380) {
for (i = 0; i < 100; i++) { for (i = 0; i < ARRAY_COUNT(gEffects); i++) {
Object_Kill(&gEffects[i].obj, gEffects[i].sfxSource); Object_Kill(&gEffects[i].obj, gEffects[i].sfxSource);
} }
Solar_801A0DF8(400.0f, -2800.0f, 340.0f, 1, 1.0f); Solar_801A0DF8(400.0f, -2800.0f, 340.0f, 1, 1.0f);
@ -1193,7 +1193,7 @@ void Solar_801A1E14(f32 xPos, f32 yPos, f32 zPos, f32 xRot, f32 yRot, f32 zRot,
s32 unk46) { s32 unk46) {
s32 i; s32 i;
for (i = 59; i >= 0; i--) { for (i = ARRAY_COUNT(gActors) - 1; i >= 0; i--) {
if (gActors[i].obj.status == OBJ_FREE) { if (gActors[i].obj.status == OBJ_FREE) {
Solar_801A1CD8(&gActors[i], xPos, yPos, zPos, xRot, yRot, zRot, xVel, yVel, zVel, unk46); Solar_801A1CD8(&gActors[i], xPos, yPos, zPos, xRot, yRot, zRot, xVel, yVel, zVel, unk46);
break; break;
@ -1974,7 +1974,7 @@ void Solar_801A48B8(Boss* bossSO) {
bossSO->swork[SO_SWK_7] = bossSO->unk_04C; bossSO->swork[SO_SWK_7] = bossSO->unk_04C;
} }
if ((bossSO->swork[SO_SWK_0] == 4) && (bossSO->unk_04C >= 60) && (bossSO->unk_04C < 67)) { if ((bossSO->swork[SO_SWK_0] == 4) && (bossSO->unk_04C >= 60) && (bossSO->unk_04C < 67)) {
for (i = 4; i < 60; i++) { for (i = 4; i < ARRAY_COUNT(gActors); i++) {
if (gActors[i].obj.id == OBJ_ACTOR_278) { if (gActors[i].obj.id == OBJ_ACTOR_278) {
gActors[i].dmgType = DMG_EXPLOSION; gActors[i].dmgType = DMG_EXPLOSION;
break; break;
@ -2825,7 +2825,7 @@ void Solar_LevelComplete(Player* player) {
gCsCamAtX = player->cam.at.x; gCsCamAtX = player->cam.at.x;
gCsCamAtY = player->cam.at.y; gCsCamAtY = player->cam.at.y;
gCsCamAtZ = player->cam.at.z; gCsCamAtZ = player->cam.at.z;
for (i = 10; i < 60; i++) { for (i = 10; i < ARRAY_COUNT(gActors); i++) {
if (gActors[i].unk_0B6 == 0) { if (gActors[i].unk_0B6 == 0) {
Object_Kill(&gActors[i].obj, gActors[i].sfxSource); Object_Kill(&gActors[i].obj, gActors[i].sfxSource);
} }

View File

@ -542,7 +542,7 @@ void Zoness_80190028(Actor* actor, Vec3f* pos, Vec3f* rot, f32 xVel, f32 yVel, f
void Zoness_801900FC(Vec3f* pos, Vec3f* rot, f32 xVel, f32 yVel, f32 zVel, s32 arg6, f32 scale, s32 arg8, s32 arg9) { void Zoness_801900FC(Vec3f* pos, Vec3f* rot, f32 xVel, f32 yVel, f32 zVel, s32 arg6, f32 scale, s32 arg8, s32 arg9) {
s32 i; s32 i;
for (i = 59; i > 0; i--) { for (i = ARRAY_COUNT(gActors) - 1; i > 0; i--) {
if (gActors[i].obj.status == OBJ_FREE) { if (gActors[i].obj.status == OBJ_FREE) {
Zoness_80190028(&gActors[i], pos, rot, xVel, yVel, zVel, arg6, scale, arg8, arg9); Zoness_80190028(&gActors[i], pos, rot, xVel, yVel, zVel, arg6, scale, arg8, arg9);
break; break;
@ -687,7 +687,7 @@ void Zoness_80190790(Actor* actor) {
actor->unk_0F4.x = -actor->vel.y * 2.5f; actor->unk_0F4.x = -actor->vel.y * 2.5f;
actor->fwork[1] += 5.0f; actor->fwork[1] += 5.0f;
actor->unk_0F4.z = SIN_DEG(actor->fwork[1]) * 30.0f; actor->unk_0F4.z = SIN_DEG(actor->fwork[1]) * 30.0f;
for (i = 0, otherActor = gActors; i < 60; i++, otherActor++) { for (i = 0, otherActor = gActors; i < ARRAY_COUNT(gActors); i++, otherActor++) {
if ((otherActor->obj.status == OBJ_ACTIVE) && (otherActor->obj.id == OBJ_ACTOR_239) && if ((otherActor->obj.status == OBJ_ACTIVE) && (otherActor->obj.id == OBJ_ACTOR_239) &&
(otherActor->iwork[0] == actor->iwork[0])) { (otherActor->iwork[0] == actor->iwork[0])) {
temp1 = Math_RadToDeg( temp1 = Math_RadToDeg(
@ -921,7 +921,7 @@ void Zoness_801915A4(Actor* actor) {
actor->health = 50; actor->health = 50;
actor->fwork[0] = actor->obj.pos.z - 10000.0f; actor->fwork[0] = actor->obj.pos.z - 10000.0f;
for (i = 0, actor241 = gActors; i < 60; i++, actor241++) { for (i = 0, actor241 = gActors; i < ARRAY_COUNT(gActors); i++, actor241++) {
if (actor241->obj.status == OBJ_FREE) { if (actor241->obj.status == OBJ_FREE) {
Actor_Initialize(actor241); Actor_Initialize(actor241);
actor241->obj.status = OBJ_INIT; actor241->obj.status = OBJ_INIT;
@ -935,7 +935,7 @@ void Zoness_801915A4(Actor* actor) {
break; break;
} }
} }
if (i >= 60) { if (i >= ARRAY_COUNT(gActors)) {
actor241->obj.status = OBJ_FREE; actor241->obj.status = OBJ_FREE;
} }
} }
@ -3050,7 +3050,7 @@ void Zoness_801986FC(Boss* bossZO, s32 arg1, f32 xOff, f32 yOff, f32 zOff, f32 y
if (sZoSwork[ZO_BSS_12 + sp50] == 0) { if (sZoSwork[ZO_BSS_12 + sp50] == 0) {
sZoSwork[ZO_BSS_0 + arg1] = 40; sZoSwork[ZO_BSS_0 + arg1] = 40;
} }
for (sp50 = 0, newActor = gActors; sp50 < 60; sp50++, newActor++) { for (sp50 = 0, newActor = gActors; sp50 < ARRAY_COUNT(gActors); sp50++, newActor++) {
if (newActor->obj.status == OBJ_FREE) { if (newActor->obj.status == OBJ_FREE) {
D_ctx_801779A8[0] = 20.0f; D_ctx_801779A8[0] = 20.0f;
Actor_Initialize(newActor); Actor_Initialize(newActor);
@ -3080,7 +3080,7 @@ void Zoness_801986FC(Boss* bossZO, s32 arg1, f32 xOff, f32 yOff, f32 zOff, f32 y
} }
} }
} }
if (sp50 >= 60) { if (sp50 >= ARRAY_COUNT(gActors)) {
newActor->obj.status = OBJ_FREE; newActor->obj.status = OBJ_FREE;
} }
} }
@ -3094,7 +3094,7 @@ void Zoness_801989FC(Boss* bossZO) {
for (i = 0; i < 2; i++) { for (i = 0; i < 2; i++) {
if (sZoSwork[ZO_BSS_11 + i] != 0) { if (sZoSwork[ZO_BSS_11 + i] != 0) {
for (j = 0, newActor = gActors; j < 60; j++, newActor++) { for (j = 0, newActor = gActors; j < ARRAY_COUNT(gActors); j++, newActor++) {
if (newActor->obj.status == OBJ_FREE) { if (newActor->obj.status == OBJ_FREE) {
Actor_Initialize(newActor); Actor_Initialize(newActor);
newActor->obj.status = OBJ_INIT; newActor->obj.status = OBJ_INIT;
@ -3164,7 +3164,7 @@ void Zoness_80198BE8(Boss* bossZO, s32 arg1) {
break; break;
} }
} }
if (var_s1 >= 60) { if (var_s1 >= ARRAY_COUNT(gActors)) {
effect->obj.status = OBJ_FREE; effect->obj.status = OBJ_FREE;
} }
} }
@ -3812,7 +3812,7 @@ void Zoness_8019B1F0(Actor* actor) {
actor->obj.rot.x = (s32) fabsf(Math_ModF(actor->obj.rot.x, 100.0f)); actor->obj.rot.x = (s32) fabsf(Math_ModF(actor->obj.rot.x, 100.0f));
} }
for (i = 0, var_s6 = 0; var_s3 < 3 && i < 60; i++) { for (i = 0, var_s6 = 0; var_s3 < 3 && i < ARRAY_COUNT(gActors); i++) {
if (gActors[i].obj.status == OBJ_FREE) { if (gActors[i].obj.status == OBJ_FREE) {
if (actor->state == 0) { if (actor->state == 0) {
Matrix_MultVec3f(gCalcMatrix, &D_i3_801BF744[var_s3], &sp84); Matrix_MultVec3f(gCalcMatrix, &D_i3_801BF744[var_s3], &sp84);
@ -4028,7 +4028,7 @@ void Zoness_8019BE48(Actor* actor) {
switch (actor->state) { /* irregular */ switch (actor->state) { /* irregular */
case 0: case 0:
for (i = 0, newActor = gActors; i < 60; i++, newActor++) { for (i = 0, newActor = gActors; i < ARRAY_COUNT(gActors); i++, newActor++) {
if (newActor->obj.status == OBJ_FREE) { if (newActor->obj.status == OBJ_FREE) {
Actor_Initialize(newActor); Actor_Initialize(newActor);
newActor->obj.status = OBJ_INIT; newActor->obj.status = OBJ_INIT;
@ -4046,7 +4046,7 @@ void Zoness_8019BE48(Actor* actor) {
break; break;
} }
} }
if (i >= 60) { if (i >= ARRAY_COUNT(gActors)) {
newActor->obj.status = OBJ_FREE; newActor->obj.status = OBJ_FREE;
} }
actor->health = 10; actor->health = 10;
@ -4129,7 +4129,7 @@ void Zoness_8019C200(Actor* actor) {
actor->fwork[2] = actor->fwork[3] + sp2C.y; actor->fwork[2] = actor->fwork[3] + sp2C.y;
Matrix_RotateY(gCalcMatrix, actor->obj.rot.y * M_DTOR, MTXF_NEW); Matrix_RotateY(gCalcMatrix, actor->obj.rot.y * M_DTOR, MTXF_NEW);
Matrix_MultVec3f(gCalcMatrix, &D_i3_801BF8B8, &sp2C); Matrix_MultVec3f(gCalcMatrix, &D_i3_801BF8B8, &sp2C);
for (i = 0, newActor = gActors; i < 60; i++, newActor++) { for (i = 0, newActor = gActors; i < ARRAY_COUNT(gActors); i++, newActor++) {
if (newActor->obj.status == OBJ_FREE) { if (newActor->obj.status == OBJ_FREE) {
Actor_Initialize(newActor); Actor_Initialize(newActor);
newActor->obj.status = OBJ_INIT; newActor->obj.status = OBJ_INIT;
@ -4145,7 +4145,7 @@ void Zoness_8019C200(Actor* actor) {
break; break;
} }
} }
if (i >= 60) { if (i >= ARRAY_COUNT(gActors)) {
newActor->obj.status = OBJ_FREE; newActor->obj.status = OBJ_FREE;
} }
} }
@ -4359,7 +4359,7 @@ void Zoness_8019CE58(Actor* actor) {
void Zoness_Actor247_Init(Actor247* this) { void Zoness_Actor247_Init(Actor247* this) {
s32 i; s32 i;
for (i = 0; i < 60; i++) { for (i = 0; i < ARRAY_COUNT(gActors); i++) {
if (gActors[i].obj.status == OBJ_FREE) { if (gActors[i].obj.status == OBJ_FREE) {
Actor_Initialize(&gActors[i]); Actor_Initialize(&gActors[i]);
gActors[i].obj.status = OBJ_ACTIVE; gActors[i].obj.status = OBJ_ACTIVE;
@ -4517,7 +4517,7 @@ void Zoness_LevelComplete(Player* player) {
gCsCamAtX = player->cam.at.x; gCsCamAtX = player->cam.at.x;
gCsCamAtY = player->cam.at.y; gCsCamAtY = player->cam.at.y;
gCsCamAtZ = player->cam.at.z; gCsCamAtZ = player->cam.at.z;
for (i = 10; i < 60; i++) { for (i = 10; i < ARRAY_COUNT(gActors); i++) {
if (gActors[i].unk_0B6 == 0) { if (gActors[i].unk_0B6 == 0) {
Object_Kill(&gActors[i].obj, gActors[i].sfxSource); Object_Kill(&gActors[i].obj, gActors[i].sfxSource);
} }

View File

@ -1766,7 +1766,7 @@ void Bolse_80190D98(Effect* effect, f32 xPos, f32 yPos, f32 zPos, f32 xRot, f32
void Bolse_80190EE4(f32 x, f32 y, f32 z, f32 arg3, f32 arg4) { void Bolse_80190EE4(f32 x, f32 y, f32 z, f32 arg3, f32 arg4) {
s32 i; s32 i;
for (i = 99; i >= 0; i--) { for (i = ARRAY_COUNT(gEffects) - 1; i >= 0; i--) {
if (gEffects[i].obj.status == OBJ_FREE) { if (gEffects[i].obj.status == OBJ_FREE) {
Bolse_80190D98(&gEffects[i], x, y, z, arg3, arg4); Bolse_80190D98(&gEffects[i], x, y, z, arg3, arg4);
break; break;
@ -1791,7 +1791,7 @@ void Bolse_80190F58(Effect* effect, f32 x, f32 y, f32 z, f32 scale) {
void Bolse_80190FE8(f32 x, f32 y, f32 z, f32 scale) { void Bolse_80190FE8(f32 x, f32 y, f32 z, f32 scale) {
s32 i; s32 i;
for (i = 99; i >= 0; i--) { for (i = ARRAY_COUNT(gEffects) - 1; i >= 0; i--) {
if (gEffects[i].obj.status == OBJ_FREE) { if (gEffects[i].obj.status == OBJ_FREE) {
Bolse_80190F58(&gEffects[i], x, y, z, scale); Bolse_80190F58(&gEffects[i], x, y, z, scale);
break; break;

View File

@ -1833,8 +1833,7 @@ void Katina_LevelComplete(Player* player) {
gCsCamAtX = boss->obj.pos.x; gCsCamAtX = boss->obj.pos.x;
gCsCamAtY = 1000.0f; gCsCamAtY = 1000.0f;
gCsCamAtZ = boss->obj.pos.z; gCsCamAtZ = boss->obj.pos.z;
for (i = 10; i < ARRAY_COUNT(gActors); i++) {
for (i = 10; i < 60; i++) {
if (gActors[i].unk_0B6 == 0) { if (gActors[i].unk_0B6 == 0) {
Object_Kill(&gActors[i].obj, gActors[i].sfxSource); Object_Kill(&gActors[i].obj, gActors[i].sfxSource);
} }

View File

@ -1835,7 +1835,7 @@ void SectorZ_8019EA68(void) {
Object_SetInfo(&actor->info, actor->obj.id); Object_SetInfo(&actor->info, actor->obj.id);
actor->itemDrop = DROP_SILVER_RING; actor->itemDrop = DROP_SILVER_RING;
if (j++ >= 60) { if (j++ >= ARRAY_COUNT(gActors)) {
break; break;
} }
actor++; actor++;

View File

@ -1498,7 +1498,7 @@ void Macbeth_8019F164(Actor* actor) {
sp6C.y = gPlayer[0].pos.y - 25.0f - actor->obj.pos.y + actor->fwork[8] + 25.0f; sp6C.y = gPlayer[0].pos.y - 25.0f - actor->obj.pos.y + actor->fwork[8] + 25.0f;
sp6C.z = gPlayer[0].trueZpos - 500.0f - actor->obj.pos.z; sp6C.z = gPlayer[0].trueZpos - 500.0f - actor->obj.pos.z;
for (i = 0; i < 60; i++) { for (i = 0; i < ARRAY_COUNT(gActors); i++) {
if ((gActors[i].obj.id == OBJ_ACTOR_219) && (gActors[i].obj.status == OBJ_ACTIVE)) { if ((gActors[i].obj.id == OBJ_ACTOR_219) && (gActors[i].obj.status == OBJ_ACTIVE)) {
if ((actor->obj.pos.z < (gActors[i].obj.pos.z + 3000.0f)) && if ((actor->obj.pos.z < (gActors[i].obj.pos.z + 3000.0f)) &&
((gActors[i].obj.pos.z - actor->obj.pos.z) < 5000.0f)) { ((gActors[i].obj.pos.z - actor->obj.pos.z) < 5000.0f)) {
@ -5106,7 +5106,7 @@ void Macbeth_801AD144(PlayerShot* shot) {
temp_fs2 = shot->scale * 40.0f; temp_fs2 = shot->scale * 40.0f;
actor = &gActors[0]; actor = &gActors[0];
for (i = 0; i < 60; i++, actor++) { for (i = 0; i < ARRAY_COUNT(gActors); i++, actor++) {
if ((actor->obj.status == OBJ_ACTIVE) && (actor->timer_0C2 == 0) && (actor->obj.id >= OBJ_ACTOR_205) && if ((actor->obj.status == OBJ_ACTIVE) && (actor->timer_0C2 == 0) && (actor->obj.id >= OBJ_ACTOR_205) &&
(actor->obj.id <= OBJ_ACTOR_213)) { (actor->obj.id <= OBJ_ACTOR_213)) {
temp_s6 = gGameFrameCount % 8U; temp_s6 = gGameFrameCount % 8U;
@ -6708,47 +6708,47 @@ void Macbeth_801B38E0(void) {
s16 i; s16 i;
s16 j; s16 j;
for (i = 0; i < 65; i++) { for (i = 0; i < ARRAY_COUNT(gRadarMarks); i++) {
gRadarMarks[i].status = 0; gRadarMarks[i].status = 0;
} }
for (i = 0; i < 100; i++) { for (i = 0; i < ARRAY_COUNT(gTexturedLines); i++) {
gTexturedLines[i].mode = 0; gTexturedLines[i].mode = 0;
} }
for (i = 0; i < 50; i++) { for (i = 0; i < ARRAY_COUNT(gScenery); i++) {
if (gScenery[i].obj.id <= OBJ_SCENERY_91 || gScenery[i].obj.id >= OBJ_SCENERY_97) { if (gScenery[i].obj.id <= OBJ_SCENERY_91 || gScenery[i].obj.id >= OBJ_SCENERY_97) {
Object_Kill(&gScenery[i].obj, gScenery[i].sfxSource); Object_Kill(&gScenery[i].obj, gScenery[i].sfxSource);
Scenery_Initialize(&gScenery[i]); Scenery_Initialize(&gScenery[i]);
} }
} }
for (i = 0; i < 40; i++) { for (i = 0; i < ARRAY_COUNT(gSprites); i++) {
gSprites[i].obj.status = OBJ_FREE; gSprites[i].obj.status = OBJ_FREE;
Sprite_Initialize(&gSprites[i]); Sprite_Initialize(&gSprites[i]);
} }
for (i = 0; i < 60; i++) { for (i = 0; i < ARRAY_COUNT(gActors); i++) {
Object_Kill(&gActors[i].obj, gActors[i].sfxSource); Object_Kill(&gActors[i].obj, gActors[i].sfxSource);
Actor_Initialize(&gActors[i]); Actor_Initialize(&gActors[i]);
} }
for (i = 0; i < 4; i++) { for (i = 0; i < ARRAY_COUNT(gBosses); i++) {
Object_Kill(&gBosses[i].obj, gBosses[i].sfxSource); Object_Kill(&gBosses[i].obj, gBosses[i].sfxSource);
Boss_Initialize(&gBosses[i]); Boss_Initialize(&gBosses[i]);
} }
for (i = 0; i < 100; i++) { for (i = 0; i < ARRAY_COUNT(gEffects); i++) {
Object_Kill(&gEffects[i].obj, gEffects[i].sfxSource); Object_Kill(&gEffects[i].obj, gEffects[i].sfxSource);
Effect_Initialize(&gEffects[i]); Effect_Initialize(&gEffects[i]);
} }
for (i = 0; i < 20; i++) { for (i = 0; i < ARRAY_COUNT(gItems); i++) {
Object_Kill(&gItems[i].obj, gItems[i].sfxSource); Object_Kill(&gItems[i].obj, gItems[i].sfxSource);
Item_Initialize(&gItems[i]); Item_Initialize(&gItems[i]);
} }
for (i = 0; i < 16; i++) { for (i = 0; i < ARRAY_COUNT(gPlayerShots); i++) {
Object_Kill(&gPlayerShots[i].obj, gPlayerShots[i].sfxSource); Object_Kill(&gPlayerShots[i].obj, gPlayerShots[i].sfxSource);
PlayerShot_Initialize(&gPlayerShots[i]); PlayerShot_Initialize(&gPlayerShots[i]);
} }
@ -6758,7 +6758,7 @@ void Macbeth_801B38E0(void) {
gFormationInitPos.x = gFormationInitPos.y = gFormationInitPos.z = gFormationInitRot.x = gFormationInitRot.y = gFormationInitPos.x = gFormationInitPos.y = gFormationInitPos.z = gFormationInitRot.x = gFormationInitRot.y =
gFormationInitRot.z = 0.0f; gFormationInitRot.z = 0.0f;
for (i = 0; i < 10; i++) { for (i = 0; i < ARRAY_COUNT(gTeamArrowsViewPos); i++) {
gTeamArrowsViewPos[i].x = gTeamArrowsViewPos[i].y = gTeamArrowsViewPos[i].z = 100.0f; gTeamArrowsViewPos[i].x = gTeamArrowsViewPos[i].y = gTeamArrowsViewPos[i].z = 100.0f;
} }

View File

@ -684,7 +684,7 @@ void Titania_8018ADC4(Actor* actor) {
k = 0; k = 0;
actorPtr = gActors; actorPtr = gActors;
for (i = 0; i < 60; i++, actorPtr++) { for (i = 0; i < ARRAY_COUNT(gActors); i++, actorPtr++) {
if (actorPtr->obj.status == OBJ_FREE) { if (actorPtr->obj.status == OBJ_FREE) {
Actor_Initialize(actorPtr); Actor_Initialize(actorPtr);
actorPtr->obj.status = OBJ_INIT; actorPtr->obj.status = OBJ_INIT;
@ -1718,7 +1718,7 @@ void Titania_8018E3CC(Actor* actor) {
actor->obj.pos.y -= 20.0f; actor->obj.pos.y -= 20.0f;
actorPtr = gActors; actorPtr = gActors;
for (i = 0; i < 60; i++, actorPtr++) { for (i = 0; i < ARRAY_COUNT(gActors); i++, actorPtr++) {
if (actorPtr->obj.status == OBJ_FREE) { if (actorPtr->obj.status == OBJ_FREE) {
Actor_Initialize(actorPtr); Actor_Initialize(actorPtr);
actorPtr->obj.status = OBJ_INIT; actorPtr->obj.status = OBJ_INIT;
@ -1896,7 +1896,7 @@ void Titania_8018E5F8(Actor* actor) {
} }
if (actor->iwork[3] == 0) { if (actor->iwork[3] == 0) {
for (i = 0; i < 100; i++) { for (i = 0; i < ARRAY_COUNT(gTexturedLines); i++) {
if (gTexturedLines[i].mode == 0) { if (gTexturedLines[i].mode == 0) {
actor->iwork[3] = i + 1; actor->iwork[3] = i + 1;
break; break;
@ -4399,7 +4399,7 @@ void Titania_80193DF0(Boss* boss) {
D_i5_801BBEF4[33] = 1.0f; D_i5_801BBEF4[33] = 1.0f;
for (i = 0; i < 4; i++) { for (i = 0; i < 4; i++) {
if (D_i5_801BBEF0[9 + i] == 0) { if (D_i5_801BBEF0[9 + i] == 0) {
for (j = 0; j < 100; j++) { for (j = 0; j < ARRAY_COUNT(gTexturedLines); j++) {
if (gTexturedLines[j].mode == 0) { if (gTexturedLines[j].mode == 0) {
gTexturedLines[j].mode = 1; gTexturedLines[j].mode = 1;
D_i5_801BBEF0[9 + i] = j + 1; D_i5_801BBEF0[9 + i] = j + 1;

View File

@ -1492,7 +1492,7 @@ void Andross_8018CAD4(Effect* effect) {
Object_Kill(&effect->obj, effect->sfxSource); Object_Kill(&effect->obj, effect->sfxSource);
if (Rand_ZeroOne() < 0.1f) { if (Rand_ZeroOne() < 0.1f) {
item = gItems; item = gItems;
for (i = 0; i < 20; i++, item++) { for (i = 0; i < ARRAY_COUNT(gItems); i++, item++) {
if (item->obj.status == OBJ_FREE) { if (item->obj.status == OBJ_FREE) {
Item_Initialize(item); Item_Initialize(item);
item->obj.status = OBJ_INIT; item->obj.status = OBJ_INIT;
@ -2377,7 +2377,7 @@ void Andross_8018DBF0(Boss* boss) {
if (boss->timer_050 > 0) { if (boss->timer_050 > 0) {
playerShot = gPlayerShots; playerShot = gPlayerShots;
effect = gEffects; effect = gEffects;
for (i = 0; i < 16; i++, playerShot++) { for (i = 0; i < ARRAY_COUNT(gPlayerShots); i++, playerShot++) {
Math_SmoothStepToF(&playerShot->obj.pos.x, boss->obj.pos.x, 0.5f, boss->fwork[16], 0); Math_SmoothStepToF(&playerShot->obj.pos.x, boss->obj.pos.x, 0.5f, boss->fwork[16], 0);
Math_SmoothStepToF(&playerShot->obj.pos.y, boss->obj.pos.y - 100.0f, 0.5f, boss->fwork[16], 0); Math_SmoothStepToF(&playerShot->obj.pos.y, boss->obj.pos.y - 100.0f, 0.5f, boss->fwork[16], 0);
Math_SmoothStepToF(&playerShot->vel.x, 0.0f, 0.9f, 5.0f, 0); Math_SmoothStepToF(&playerShot->vel.x, 0.0f, 0.9f, 5.0f, 0);
@ -3215,7 +3215,7 @@ void Andross_80192E94(Actor* actor) {
break; break;
case 1: case 1:
otherActor = gActors; otherActor = gActors;
for (i = 0; i < 60; i++, otherActor++) { for (i = 0; i < ARRAY_COUNT(gActors); i++, otherActor++) {
if ((i != actor->index) && (otherActor->obj.status == OBJ_ACTIVE) && if ((i != actor->index) && (otherActor->obj.status == OBJ_ACTIVE) &&
(otherActor->obj.id == OBJ_ACTOR_285) && (otherActor->obj.id == OBJ_ACTOR_285) &&
(fabsf(otherActor->obj.pos.z - actor->obj.pos.z) < 200.0f)) { (fabsf(otherActor->obj.pos.z - actor->obj.pos.z) < 200.0f)) {

View File

@ -447,7 +447,7 @@ void SectorY_80198F5C(Boss* boss) {
SEQCMD_STOP_SEQUENCE(SEQ_PLAYER_FANFARE, 20); SEQCMD_STOP_SEQUENCE(SEQ_PLAYER_FANFARE, 20);
} }
for (i = 4; i < 60; i++) { for (i = 4; i < ARRAY_COUNT(gActors); i++) {
if (gActors[i].obj.status == OBJ_FREE) { if (gActors[i].obj.status == OBJ_FREE) {
SectorY_80197B30(&gActors[i], boss->index); SectorY_80197B30(&gActors[i], boss->index);
D_ctx_80177A10[9] = i; D_ctx_80177A10[9] = i;
@ -625,7 +625,7 @@ void SectorY_80199438(Boss* boss) {
if (boss->swork[25] == 0) { if (boss->swork[25] == 0) {
boss->swork[25] = 1; boss->swork[25] = 1;
for (j = 59; j >= 0; j--) { for (j = ARRAY_COUNT(gActors) - 1; j >= 0; j--) {
if (gActors[j].obj.status == OBJ_FREE) { if (gActors[j].obj.status == OBJ_FREE) {
SectorY_801A39FC(&gActors[j], boss->fwork[28], boss->fwork[29], boss->fwork[30], SectorY_801A39FC(&gActors[j], boss->fwork[28], boss->fwork[29], boss->fwork[30],
RAND_FLOAT_CENTERED(50.0f), RAND_FLOAT_CENTERED(50.0f), RAND_FLOAT_CENTERED(50.0f), RAND_FLOAT_CENTERED(50.0f),
@ -1644,7 +1644,7 @@ void SectorY_8019C888(Boss* boss) {
} }
if (gBossFrameCount == 250) { if (gBossFrameCount == 250) {
for (i = 59; i >= 0; i--) { for (i = ARRAY_COUNT(gActors) - 1; i >= 0; i--) {
if (gActors[i].obj.status == OBJ_ACTIVE) { if (gActors[i].obj.status == OBJ_ACTIVE) {
gTeamEventActorIndex[gActors[i].iwork[12]] = i; gTeamEventActorIndex[gActors[i].iwork[12]] = i;
} }
@ -3415,7 +3415,7 @@ void SectorY_801A39FC(Actor* actor, f32 xPos, f32 yPos, f32 zPos, f32 xVel, f32
void SectorY_801A3B50(f32 xPos, f32 yPos, f32 zPos, f32 xVel, f32 yVel, f32 zVel, s32 arg6) { void SectorY_801A3B50(f32 xPos, f32 yPos, f32 zPos, f32 xVel, f32 yVel, f32 zVel, s32 arg6) {
s32 i; s32 i;
for (i = 59; i >= 0; i--) { for (i = ARRAY_COUNT(gActors) - 1; i >= 0; i--) {
if (gActors[i].obj.status == OBJ_FREE) { if (gActors[i].obj.status == OBJ_FREE) {
SectorY_801A39FC(&gActors[i], xPos, yPos, zPos, xVel, yVel, zVel, arg6); SectorY_801A39FC(&gActors[i], xPos, yPos, zPos, xVel, yVel, zVel, arg6);
break; break;

View File

@ -117,8 +117,8 @@ void Turret_801A58A8(Player* player) {
} }
if (gControllerHold[player->num].button & R_TRIG) { if (gControllerHold[player->num].button & R_TRIG) {
player->unk_1C0++; player->unk_1C0++;
if (player->unk_1C0 > 60) { if (player->unk_1C0 > ARRAY_COUNT(gActors)) {
player->unk_1C0 = 60; player->unk_1C0 = ARRAY_COUNT(gActors);
} else { } else {
player->unk_1C0 = player->unk_1C0; player->unk_1C0 = player->unk_1C0;
} }