1
0
Fork 0
mirror of https://github.com/zeldaret/oot.git synced 2024-12-27 23:36:22 +00:00

Fix compiler warnings in z_camera/db_camera (#947)

* Fix compiler warnings in z_camera/db_camera

* review

Co-authored-by: zelda2774 <zelda2774@invalid>
This commit is contained in:
zelda2774 2021-09-07 18:13:52 +02:00 committed by GitHub
parent 3d57eaf019
commit c577ed1e84
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
3 changed files with 32 additions and 23 deletions

View file

@ -1463,7 +1463,7 @@ void ShrinkWindow_Update(s32 updateRate);
// ? DbCamera_PrintS16Bytes(?);
// ? DbCamera_PrintCutBytes(?);
void DbCamera_Init(DbCamera* dbCamera, Camera* cameraPtr);
// ? DbgCamera_Enable(?);
void DbgCamera_Enable(DbCamera* dbCamera, Camera* cam);
void DbCamera_Update(DbCamera* dbCamera, Camera* cam);
// ? DbCamera_GetFirstAvailableLetter(?);
// ? DbCamera_InitCut(?);

View file

@ -153,16 +153,16 @@ Vec3f* DbCamera_CalcUpFromPitchYawRoll(Vec3f* dest, s16 pitch, s16 yaw, s16 roll
temp_f14 = 1.0f - cosNegRoll;
cosPitchSinYaw = cosPitch * sinYaw;
sp54 = SQ(cosPitchSinYaw);
sp4C = (cosPitchSinYaw * sinPitch) * (0, temp_f14);
sp4C = (cosPitchSinYaw * sinPitch) * ((void)0, temp_f14);
cosPitchcosYaw = cosPitch * cosYaw;
temp_f4_2 = ((1.0f - sp54) * cosNegRoll) + sp54;
cosPitchCosYawSinRoll = cosPitchcosYaw * sinNegRoll;
temp_f6 = (cosPitchcosYaw * cosPitchSinYaw) * (0, temp_f14);
temp_f6 = (cosPitchcosYaw * cosPitchSinYaw) * ((void)0, temp_f14);
temp_f10_2 = sinPitch * sinNegRoll;
spA4.x = ((negSinPitchSinYaw * temp_f4_2) + (cosPitch * (sp4C - cosPitchCosYawSinRoll))) +
(negSinPitchCosYaw * (temp_f6 + temp_f10_2));
sp54 = SQ(sinPitch);
temp_f4_2 = (sinPitch * cosPitchcosYaw) * (0, temp_f14);
temp_f4_2 = (sinPitch * cosPitchcosYaw) * ((void)0, temp_f14);
temp_f8_3 = cosPitchSinYaw * sinNegRoll;
temp_f8 = sp4C + cosPitchCosYawSinRoll;
spA4.y = ((negSinPitchSinYaw * temp_f8) + (cosPitch * (((1.0f - sp54) * cosNegRoll) + sp54))) +
@ -544,21 +544,21 @@ void DbCamera_Init(DbCamera* dbCamera, Camera* cameraPtr) {
dbCamera->unk_6C.z = 0;
}
s32 DbgCamera_Enable(DbCamera* this, Camera* cam) {
this->at = cam->at;
this->eye = cam->eye;
this->unk_1C = cam->up;
this->fov = cam->fov;
this->roll = 0;
this->sub.nPoints = 1;
this->sub.unkIdx = 0;
this->sub.unk_08 = 0;
this->sub.unk_0A = 1;
this->sub.unk_0C = 1;
this->unk_78 = 0;
this->unk_7A = 0;
this->rollDegrees = 0.0f;
return func_800B4088(this, cam);
void DbgCamera_Enable(DbCamera* dbCamera, Camera* cam) {
dbCamera->at = cam->at;
dbCamera->eye = cam->eye;
dbCamera->unk_1C = cam->up;
dbCamera->fov = cam->fov;
dbCamera->roll = 0;
dbCamera->sub.nPoints = 1;
dbCamera->sub.unkIdx = 0;
dbCamera->sub.unk_08 = 0;
dbCamera->sub.unk_0A = 1;
dbCamera->sub.unk_0C = 1;
dbCamera->unk_78 = 0;
dbCamera->unk_7A = 0;
dbCamera->rollDegrees = 0.0f;
func_800B4088(dbCamera, cam);
}
#ifdef NON_EQUIVALENT
@ -1655,7 +1655,7 @@ s32 DbCamera_SaveCallback(char* c) {
ret = Mempak_GetFileSize(2, *c);
freeSize = Mempak_GetFreeBytes(2);
if (sAllocSize < (freeSize + ret)) {
if ((u32)sAllocSize < (freeSize + ret)) {
if (!Mempak_Alloc(2, c, sAllocSize)) {
return false;
}

View file

@ -7020,10 +7020,19 @@ void Camera_PrintSettings(Camera* camera) {
if (camera->camDataIdx < 0) {
sp50[i++] = '-';
}
if (camera->camDataIdx / 0xA != 0) {
sp50[i++] = i / 0xA + '0';
//! @bug: this code was clearly meaning to print `abs(camera->camDataIdx)` as a
//! one-or-two-digit number, instead of `i`.
// "sp50[i++] = ..." matches here, but is undefined behavior due to conflicting
// reads/writes between sequence points, triggering warnings. Work around by
// putting i++ afterwards while on the same line.
// clang-format off
if (camera->camDataIdx / 10 != 0) {
sp50[i] = i / 10 + '0'; i++;
}
sp50[i++] = i % 10 + '0';
sp50[i] = i % 10 + '0'; i++;
// clang-format on
sp50[i++] = ' ';
sp50[i++] = ' ';
sp50[i++] = ' ';