Misc Cleanup 5 (#1294)

* quick cleanup

* a few more

* more

* misc cleanup

* PR Suggestion
This commit is contained in:
engineer124
2023-06-17 15:22:41 +10:00
committed by GitHub
parent bc632ac931
commit 491870c355
31 changed files with 314 additions and 256 deletions
+1 -1
View File
@@ -10,7 +10,7 @@ void AudioEffects_SequenceChannelProcessSound(SequenceChannel* channel, s32 reca
if (channel->seqPlayer->muted && (channel->muteFlags & MUTE_FLAGS_SOFTEN)) {
channelVolume = channel->seqPlayer->muteVolumeScale * channelVolume;
}
channel->appliedVolume = channelVolume * channelVolume;
channel->appliedVolume = SQ(channelVolume);
}
if (channel->changes.s.pan) {
+41 -28
View File
@@ -884,7 +884,6 @@ void AudioLoad_RelocateFont(s32 fontId, SoundFontData* fontDataStartAddr, Sample
// The first u32 in fontData is an offset to a list of offsets to the drums
soundListOffset = fontData[0];
if (1) {}
// If the soundFont has drums
if ((soundListOffset != 0) && (numDrums != 0)) {
@@ -897,20 +896,23 @@ void AudioLoad_RelocateFont(s32 fontId, SoundFontData* fontDataStartAddr, Sample
soundOffset = ((Drum**)fontData[0])[i];
// Some drum data entries are empty, represented by an offset of 0 in the list of drum offsets
if (soundOffset != 0) {
soundOffset = RELOC_TO_RAM(soundOffset);
((Drum**)fontData[0])[i] = drum = soundOffset;
// The drum may be in the list multiple times and already relocated
if (!drum->isRelocated) {
AudioLoad_RelocateSample(&drum->tunedSample, fontDataStartAddr, sampleBankReloc);
soundOffset = drum->envelope;
drum->envelope = RELOC_TO_RAM(soundOffset);
drum->isRelocated = true;
}
if (soundOffset == 0) {
continue;
}
soundOffset = RELOC_TO_RAM(soundOffset);
((Drum**)fontData[0])[i] = drum = soundOffset;
// The drum may be in the list multiple times and already relocated
if (drum->isRelocated) {
continue;
}
AudioLoad_RelocateSample(&drum->tunedSample, fontDataStartAddr, sampleBankReloc);
soundOffset = drum->envelope;
drum->envelope = RELOC_TO_RAM(soundOffset);
drum->isRelocated = true;
}
}
@@ -918,7 +920,6 @@ void AudioLoad_RelocateFont(s32 fontId, SoundFontData* fontDataStartAddr, Sample
// The second u32 in fontData is an offset to the first sound effect entry
soundListOffset = fontData[1];
if (1) {}
// If the soundFont has sound effects
if ((soundListOffset != 0) && (numSfx != 0)) {
@@ -932,9 +933,11 @@ void AudioLoad_RelocateFont(s32 fontId, SoundFontData* fontDataStartAddr, Sample
soundEffect = (SoundEffect*)soundOffset;
// Check for NULL (note: the pointer is guaranteed to be in fontData and can never be NULL)
if ((soundEffect != NULL) && (soundEffect->tunedSample.sample != NULL)) {
AudioLoad_RelocateSample(&soundEffect->tunedSample, fontDataStartAddr, sampleBankReloc);
if ((soundEffect == NULL) || (soundEffect->tunedSample.sample == NULL)) {
continue;
}
AudioLoad_RelocateSample(&soundEffect->tunedSample, fontDataStartAddr, sampleBankReloc);
}
}
@@ -1643,9 +1646,11 @@ void AudioLoad_FinishAsyncLoad(AudioAsyncLoad* asyncLoad) {
case SEQUENCE_TABLE:
AudioLoad_SetSeqLoadStatus(ASYNC_ID(retMsg), ASYNC_STATUS(retMsg));
break;
case SAMPLE_TABLE:
AudioLoad_SetSampleFontLoadStatusAndApplyCaches(ASYNC_ID(retMsg), ASYNC_STATUS(retMsg));
break;
case FONT_TABLE:
fontId = ASYNC_ID(retMsg);
sampleBankId1 = gAudioCtx.soundFontList[fontId].sampleBankId1;
@@ -1659,6 +1664,9 @@ void AudioLoad_FinishAsyncLoad(AudioAsyncLoad* asyncLoad) {
AudioLoad_SetFontLoadStatus(fontId, ASYNC_STATUS(retMsg));
AudioLoad_RelocateFontAndPreloadSamples(fontId, asyncLoad->ramAddr, &sampleBankReloc, true);
break;
default:
break;
}
doneMsg = asyncLoad->retMsg;
@@ -2002,24 +2010,29 @@ s32 AudioLoad_GetSamplesForFont(s32 fontId, Sample** sampleSet) {
for (i = 0; i < numDrums; i++) {
Drum* drum = AudioPlayback_GetDrum(fontId, i);
if (1) {}
if (drum != NULL) {
numSamples = AudioLoad_AddToSampleSet(drum->tunedSample.sample, numSamples, sampleSet);
if (drum == NULL) {
continue;
}
numSamples = AudioLoad_AddToSampleSet(drum->tunedSample.sample, numSamples, sampleSet);
}
for (i = 0; i < numInstruments; i++) {
Instrument* instrument = AudioPlayback_GetInstrumentInner(fontId, i);
if (instrument != NULL) {
if (instrument->normalRangeLo != 0) {
numSamples = AudioLoad_AddToSampleSet(instrument->lowPitchTunedSample.sample, numSamples, sampleSet);
}
if (instrument->normalRangeHi != 0x7F) {
numSamples = AudioLoad_AddToSampleSet(instrument->highPitchTunedSample.sample, numSamples, sampleSet);
}
numSamples = AudioLoad_AddToSampleSet(instrument->normalPitchTunedSample.sample, numSamples, sampleSet);
if (instrument == NULL) {
continue;
}
if (instrument->normalRangeLo != 0) {
numSamples = AudioLoad_AddToSampleSet(instrument->lowPitchTunedSample.sample, numSamples, sampleSet);
}
if (instrument->normalRangeHi != 0x7F) {
numSamples = AudioLoad_AddToSampleSet(instrument->highPitchTunedSample.sample, numSamples, sampleSet);
}
numSamples = AudioLoad_AddToSampleSet(instrument->normalPitchTunedSample.sample, numSamples, sampleSet);
}
// Should really also process sfx, but this method is never called
+3
View File
@@ -83,6 +83,9 @@ void AudioPlayback_InitSampleState(Note* note, NoteSampleState* sampleState, Not
sampleState->bitField0.strongRight = stereoData.strongRight ^ strongRight;
sampleState->bitField0.strongLeft = stereoData.strongLeft ^ strongLeft;
break;
default:
break;
}
} else if (gAudioCtx.soundMode == SOUNDMODE_MONO) {
+2 -1
View File
@@ -80,7 +80,8 @@ void func_800AE930(CollisionContext* colCtx, EffectTireMark* this, Vec3f* pos, f
spAC->flags |= 1;
}
if (spA8) {} // Necessary to match
//! FAKE:
if (spA8) {}
spA8 = &this->elements[this->numElements];
spA8->flags = 0;
+3 -3
View File
@@ -6606,7 +6606,7 @@ void Interface_Update(PlayState* play) {
case HUD_VISIBILITY_NONE:
case HUD_VISIBILITY_NONE_ALT:
case HUD_VISIBILITY_B:
dimmingAlpha = 255 - (gSaveContext.hudVisibilityTimer << 5);
dimmingAlpha = 255 - (gSaveContext.hudVisibilityTimer * 32);
if (dimmingAlpha < 0) {
dimmingAlpha = 0;
}
@@ -6637,7 +6637,7 @@ void Interface_Update(PlayState* play) {
case HUD_VISIBILITY_B_MAGIC:
case HUD_VISIBILITY_A_B:
case HUD_VISIBILITY_A_B_HEARTS_MAGIC_MINIMAP:
dimmingAlpha = 255 - (gSaveContext.hudVisibilityTimer << 5);
dimmingAlpha = 255 - (gSaveContext.hudVisibilityTimer * 32);
if (dimmingAlpha < 0) {
dimmingAlpha = 0;
}
@@ -6650,7 +6650,7 @@ void Interface_Update(PlayState* play) {
break;
case HUD_VISIBILITY_ALL:
dimmingAlpha = 255 - (gSaveContext.hudVisibilityTimer << 5);
dimmingAlpha = 255 - (gSaveContext.hudVisibilityTimer * 32);
if (dimmingAlpha < 0) {
dimmingAlpha = 0;
}
@@ -320,6 +320,7 @@ void func_80B84610(BgDblueWaterfall* this, PlayState* play) {
player->actor.world.pos.x += sp34.x;
player->actor.world.pos.z += sp34.z;
//! FAKE:
if (this && this && this) {}
player->pushedSpeed = 8.0f;
player->pushedYaw = this->actor.yawTowardsPlayer;
@@ -829,7 +829,7 @@ void func_80A9CE1C(BgHakuginPost* this, PlayState* play) {
for (i = 0; i < D_80A9E028.count; i++) {
collider = D_80A9E028.unk_0000[i].collider;
if ((collider != NULL) && (collider->base.acFlags & AT_HIT) && (D_80A9E028.unk_0000[i].unk_34 == 1)) {
if ((collider != NULL) && (collider->base.acFlags & AC_HIT) && (D_80A9E028.unk_0000[i].unk_34 == 1)) {
temp_f2 = this->unk_16C;
yDiff = ABS_ALT(BINANG_SUB(this->dyna.actor.yawTowardsPlayer, player->actor.shape.rot.y));
temp_f0 = temp_f2 + D_80A9E028.unk_0000[i].unk_14.y;
@@ -853,7 +853,7 @@ void func_80A9CE1C(BgHakuginPost* this, PlayState* play) {
for (i = 0; i < D_80A9E028.count; i++) {
collider = D_80A9E028.unk_0000[i].collider;
if (collider != NULL) {
collider->base.acFlags &= ~AT_HIT;
collider->base.acFlags &= ~AC_HIT;
}
}
@@ -225,8 +225,8 @@ void func_80C187E4(BgLastBwall* this) {
}
void func_80C187F8(BgLastBwall* this, PlayState* play) {
if (this->colliderTris.base.acFlags & 2) {
this->colliderTris.base.acFlags &= ~2;
if (this->colliderTris.base.acFlags & AC_HIT) {
this->colliderTris.base.acFlags &= ~AC_HIT;
Flags_SetSwitch(play, BGLASTBWALL_GET_SWITCHFLAGS(&this->dyna.actor));
func_80C1886C(this, play);
} else {
+1 -1
View File
@@ -521,7 +521,7 @@ void EnAm_Update(Actor* thisx, PlayState* play) {
CollisionCheck_SetAC(play, &play->colChkCtx, &this->enemyCollider.base);
}
CollisionCheck_SetAC(play, &play->colChkCtx, &this->interactCollider.base);
if (this->enemyCollider.base.atFlags & AC_ON) {
if (this->enemyCollider.base.atFlags & AT_ON) {
this->actor.flags |= ACTOR_FLAG_1000000;
CollisionCheck_SetAT(play, &play->colChkCtx, &this->enemyCollider.base);
}
@@ -688,21 +688,20 @@ void EnBigpo_BurnAwayDeath(EnBigpo* this, PlayState* play) {
if (this->idleTimer < 8) {
camYaw = Camera_GetCamDirYaw(GET_ACTIVE_CAM(play)) + 0x4800;
if (this->idleTimer < 5) {
unkTemp = (this->idleTimer << 0xC) - 0x4000;
// 1.4.0...1 is NOT 1.4, the rodata demands it
tempVec.y = (((Math_SinS(unkTemp) * 23.0f) + 40.0f) * 1.4000001f) + this->actor.world.pos.y;
unkTemp = (this->idleTimer * 0x1000) - 0x4000;
tempVec.y = (((Math_SinS(unkTemp) * 23.0f) + 40.0f) * (1400.0f * 0.001f)) + this->actor.world.pos.y;
unkTemp2 = Math_CosS(unkTemp) * 32.2f;
tempVec.x = (Math_SinS(camYaw) * unkTemp2) + this->actor.world.pos.x;
tempVec.z = (Math_CosS(camYaw) * unkTemp2) + this->actor.world.pos.z;
} else {
tempVec.y = this->actor.world.pos.y + ((40.0f + (15.0f * (this->idleTimer - 5))) * 1.4000001f);
tempVec.y = this->actor.world.pos.y + ((40.0f + (15.0f * (this->idleTimer - 5))) * (1400.0f * 0.001f));
tempVec.x = (Math_SinS(camYaw) * 32.2f) + this->actor.world.pos.x;
tempVec.z = (Math_CosS(camYaw) * 32.2f) + this->actor.world.pos.z;
}
// not sure what we're turning this into, but its based on the timer
modifiedTimer = ((f32)((this->idleTimer * 10) + 80) * 1.4000001f);
modifiedTimer = ((this->idleTimer * 10) + 80) * (1400.0f * 0.001f);
func_800B3030(play, &tempVec, &D_80B6506C, &gZeroVec3f, modifiedTimer, 0, 2);
tempVec.x = (2.0f * this->actor.world.pos.x) - tempVec.x;
tempVec.z = (2.0f * this->actor.world.pos.z) - tempVec.z;
+2 -2
View File
@@ -465,8 +465,8 @@ void EnCrow_Respawn(EnCrow* this, PlayState* play) {
}
void EnCrow_UpdateDamage(EnCrow* this, PlayState* play) {
if (this->collider.base.acFlags & AT_HIT) {
this->collider.base.acFlags &= ~AT_HIT;
if (this->collider.base.acFlags & AC_HIT) {
this->collider.base.acFlags &= ~AC_HIT;
Actor_SetDropFlag(&this->actor, &this->collider.elements->info);
if (this->actor.colChkInfo.damageEffect == GUAY_DMGEFF_STUN) {
@@ -216,7 +216,7 @@ void EnElforg_MoveToTargetFairyFountain(EnElforg* this, Vec3f* homePos) {
s16 angleAdjustment;
s16 targetAngle;
this->actor.shape.yOffset += 100.0f * Math_SinS(this->timer << 9);
this->actor.shape.yOffset += 100.0f * Math_SinS(this->timer * 0x200);
EnElforg_ApproachTargetYPosition(this, homePos);
xDifference = this->actor.world.pos.x - homePos->x;
zDifference = this->actor.world.pos.z - homePos->z;
@@ -245,7 +245,7 @@ void EnElforg_MoveToTargetFairyFountain(EnElforg* this, Vec3f* homePos) {
void EnElforg_MoveToTarget(EnElforg* this, Vec3f* targetPos) {
s16 targetAngle;
this->actor.shape.yOffset += 100.0f * Math_SinS(this->timer << 9);
this->actor.shape.yOffset += 100.0f * Math_SinS(this->timer * 0x200);
EnElforg_ApproachTargetYPosition(this, targetPos);
targetAngle = Math_Atan2S_XY(-(this->actor.world.pos.z - targetPos->z), -(this->actor.world.pos.x - targetPos->x));
@@ -273,7 +273,7 @@ void EnElforg_TrappedByBubble(EnElforg* this, PlayState* play) {
EnElforg_InitializeParams(this);
this->actionFunc = EnElforg_FreeFloating;
} else {
this->actor.shape.yOffset += 10.0f * Math_SinS(this->timer << 9);
this->actor.shape.yOffset += 10.0f * Math_SinS(this->timer * 0x200);
this->actor.world.pos = this->actor.parent->world.pos;
this->actor.world.pos.y += 12.0f;
}
@@ -391,8 +391,8 @@ void EnElforg_CirclePlayer(EnElforg* this, PlayState* play) {
distanceFromPlayer = 20.0f;
}
this->actor.world.pos.x = (Math_SinS(this->timer << 12) * distanceFromPlayer) + playerActor->world.pos.x;
this->actor.world.pos.z = (Math_CosS(this->timer << 12) * distanceFromPlayer) + playerActor->world.pos.z;
this->actor.world.pos.x = (Math_SinS(this->timer * 0x1000) * distanceFromPlayer) + playerActor->world.pos.x;
this->actor.world.pos.z = (Math_CosS(this->timer * 0x1000) * distanceFromPlayer) + playerActor->world.pos.z;
this->actor.world.pos.y = player->bodyPartsPos[PLAYER_BODYPART_WAIST].y;
EnElforg_SpawnSparkles(this, play, 16);
}
@@ -788,7 +788,7 @@ void EnFamos_Update(Actor* thisx, PlayState* play) {
CollisionCheck_SetAC(play, &play->colChkCtx, &this->emblemCollider.base);
}
if (this->collider2.base.atFlags & AC_ON) {
if (this->collider2.base.atFlags & AT_ON) {
Collider_UpdateCylinder(&this->actor, &this->collider2);
this->collider2.dim.pos.y = this->actor.floorHeight;
CollisionCheck_SetAT(play, &play->colChkCtx, &this->collider2.base);
+1 -1
View File
@@ -401,7 +401,7 @@ void func_80932C98(EnFz* this, PlayState* play) {
}
if (this->unk_BCE != 0) {
if (ENFZ_GET_8000(&this->actor) && (this->collider1.base.atFlags & AC_HIT)) {
if (ENFZ_GET_8000(&this->actor) && (this->collider1.base.atFlags & AT_HIT)) {
this->unk_BCD = 0;
this->unk_BBC = 0.0f;
this->collider1.base.acFlags &= ~AC_HIT;
+3 -2
View File
@@ -534,8 +534,6 @@ void func_80B51510(EnGk* this, PlayState* play) {
s32 pad;
s32 cueChannel;
if (this) {}
if (Cutscene_IsCueInChannel(play, CS_CMD_ACTOR_CUE_479)) {
cueChannel = Cutscene_GetCueChannel(play, CS_CMD_ACTOR_CUE_479);
@@ -577,6 +575,9 @@ void func_80B51510(EnGk* this, PlayState* play) {
case 7:
Flags_SetSwitch(play, ENGK_GET_3F00(&this->actor));
break;
default:
break;
}
Actor_ChangeAnimationByInfo(&this->skelAnime, sAnimationInfo, this->unk_31A);
}
+32 -31
View File
@@ -149,40 +149,41 @@ void func_80B22FA8(EnHanabiStruct* arg0, PlayState* play2) {
gSPDisplayList(POLY_XLU_DISP++, gSunSparkleMaterialDL);
sp53 = 0xFF;
if (sp53) {}
for (i = 0; i < 400; i++, arg0++) {
if (arg0->unk_00 == 1) {
Matrix_Translate(arg0->unk_08.x, arg0->unk_08.y, arg0->unk_08.z, MTXMODE_NEW);
Matrix_ReplaceRotation(&play->billboardMtxF);
if (arg0->unk_01 < 40) {
Matrix_Scale(arg0->unk_04 * 0.025f * arg0->unk_01, arg0->unk_04 * 0.025f * arg0->unk_01, 1.0f,
MTXMODE_APPLY);
} else {
Matrix_Scale(arg0->unk_04, arg0->unk_04, 1.0f, MTXMODE_APPLY);
}
Matrix_RotateZS(play->gameplayFrames * 4864, MTXMODE_APPLY);
gSPMatrix(POLY_XLU_DISP++, Matrix_NewMtx(play->state.gfxCtx), G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_MODELVIEW);
if (sp53 != arg0->unk_02) {
gDPPipeSync(POLY_XLU_DISP++);
gDPSetEnvColor(POLY_XLU_DISP++, D_80B23C40[arg0->unk_02], D_80B23C40[arg0->unk_02 + 1],
D_80B23C40[arg0->unk_02 + 2], 255);
sp53 = arg0->unk_02;
}
if (arg0->unk_01 < 6) {
gDPSetPrimColor(POLY_XLU_DISP++, 0, 0, D_80B23C2C[arg0->unk_02], D_80B23C2C[arg0->unk_02 + 1],
D_80B23C2C[arg0->unk_02 + 2], arg0->unk_01 * 50);
} else {
gDPSetPrimColor(POLY_XLU_DISP++, 0, 0, D_80B23C2C[arg0->unk_02], D_80B23C2C[arg0->unk_02 + 1],
D_80B23C2C[arg0->unk_02 + 2], 255);
}
gSPDisplayList(POLY_XLU_DISP++, gSunSparkleModelDL);
if (arg0->unk_00 != 1) {
continue;
}
Matrix_Translate(arg0->unk_08.x, arg0->unk_08.y, arg0->unk_08.z, MTXMODE_NEW);
Matrix_ReplaceRotation(&play->billboardMtxF);
if (arg0->unk_01 < 40) {
Matrix_Scale(arg0->unk_04 * 0.025f * arg0->unk_01, arg0->unk_04 * 0.025f * arg0->unk_01, 1.0f,
MTXMODE_APPLY);
} else {
Matrix_Scale(arg0->unk_04, arg0->unk_04, 1.0f, MTXMODE_APPLY);
}
Matrix_RotateZS(play->gameplayFrames * 4864, MTXMODE_APPLY);
gSPMatrix(POLY_XLU_DISP++, Matrix_NewMtx(play->state.gfxCtx), G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_MODELVIEW);
if (sp53 != arg0->unk_02) {
gDPPipeSync(POLY_XLU_DISP++);
gDPSetEnvColor(POLY_XLU_DISP++, D_80B23C40[arg0->unk_02], D_80B23C40[arg0->unk_02 + 1],
D_80B23C40[arg0->unk_02 + 2], 255);
sp53 = arg0->unk_02;
}
if (arg0->unk_01 < 6) {
gDPSetPrimColor(POLY_XLU_DISP++, 0, 0, D_80B23C2C[arg0->unk_02], D_80B23C2C[arg0->unk_02 + 1],
D_80B23C2C[arg0->unk_02 + 2], arg0->unk_01 * 50);
} else {
gDPSetPrimColor(POLY_XLU_DISP++, 0, 0, D_80B23C2C[arg0->unk_02], D_80B23C2C[arg0->unk_02 + 1],
D_80B23C2C[arg0->unk_02 + 2], 255);
}
gSPDisplayList(POLY_XLU_DISP++, gSunSparkleModelDL);
}
CLOSE_DISPS(gfxCtx);
@@ -315,7 +315,7 @@ void func_808DF088(EnHorseLinkChild* this, PlayState* play) {
} else {
phi_v0 = -1;
}
sp32 += (phi_v0 << 0xE);
sp32 += (phi_v0 * 0x4000);
} else {
sp32 = Math_Vec3f_Yaw(&this->actor.world.pos, &this->actor.home.pos) - this->actor.world.rot.y;
}
@@ -621,7 +621,6 @@ void EnKakasi_TeachingSong(EnKakasi* this, PlayState* play) {
this->unkCounter1A4 = 0;
CutsceneManager_Stop(this->csIdList[0]);
Actor_PlaySfx(&this->picto.actor, NA_SE_EN_YASE_DEAD);
if (this) {}
this->unkState196 = 2;
this->subCamId = SUB_CAM_ID_DONE;
this->picto.actor.textId = 0x1647;
@@ -610,7 +610,7 @@ void EnKanban_Update(Actor* thisx, PlayState* play) {
}
}
Math_ApproachS(&this->actor.shape.rot.x, this->direction << 0xE, 1, 0x2000);
Math_ApproachS(&this->actor.shape.rot.x, this->direction * 0x4000, 1, 0x2000);
} else {
this->actor.shape.rot.y += this->spinVel.y;
this->actor.shape.rot.x += this->direction * 0x7D0;
@@ -111,7 +111,7 @@ void func_80A5B160(EnKusa2* this, PlayState* play) {
}
for (i = 1; i < ARRAY_COUNT(this->unk_194); i++) {
temp_s1 = (i << 0xD) - 0x2000;
temp_s1 = (i * 0x2000) - 0x2000;
if (this->unk_194[i] == NULL) {
ptr = &this->unk_194[i];
actor = (EnKusa2*)Actor_SpawnAsChildAndCutscene(

Some files were not shown because too many files have changed in this diff Show More