1
0
Fork 0
mirror of https://github.com/zeldaret/oot.git synced 2025-07-03 06:24:30 +00:00

Enable int-conversion warnings and fix all current instances (#1280)

* Enable int-conversion warnings for gcc/clang

* Fix all current int-conversion warnings

* Run format.sh

* Apply review suggestions
This commit is contained in:
Roman971 2022-06-16 02:15:44 +02:00 committed by GitHub
parent 5299208291
commit 08c8126ba5
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
46 changed files with 225 additions and 224 deletions

View file

@ -79,7 +79,7 @@ void BossGanon2_SetObjectSegment(BossGanon2* this, PlayState* play, s32 objectId
s32 pad;
s32 objectIdx = Object_GetIndex(&play->objectCtx, objectId);
gSegments[6] = PHYSICAL_TO_VIRTUAL(play->objectCtx.status[objectIdx].segment);
gSegments[6] = VIRTUAL_TO_PHYSICAL(play->objectCtx.status[objectIdx].segment);
if (setRSPSegment) {
OPEN_DISPS(play->state.gfxCtx, "../z_boss_ganon2.c", 790);
@ -1042,7 +1042,7 @@ void func_808FFDB0(BossGanon2* this, PlayState* play) {
s32 objectIdx = Object_GetIndex(&play->objectCtx, OBJECT_GANON2);
if (Object_IsLoaded(&play->objectCtx, objectIdx)) {
gSegments[6] = PHYSICAL_TO_VIRTUAL(play->objectCtx.status[objectIdx].segment);
gSegments[6] = VIRTUAL_TO_PHYSICAL(play->objectCtx.status[objectIdx].segment);
Animation_MorphToLoop(&this->skelAnime, &object_ganon2_Anim_00FFE4, -10.0f);
this->actionFunc = func_808FFEBC;

View file

@ -308,7 +308,9 @@ void BossGoma_ClearPixels32x32Rgba16(s16* rgba16image, u8* clearPixelTable, s16
if (clearPixelTable[i]) {
// address of the top left pixel in a 2x2 pixels block located at
// (i & 0xF, i >> 4) in a 16x16 grid of 2x2 pixels
targetPixel = (s32)rgba16image + (s16)((i & 0xF) * 2 + (i & 0xF0) * 4) * 2;
targetPixel = rgba16image;
targetPixel += (s16)((i & 0xF) * 2 + (i & 0xF0) * 4);
// set the 2x2 block of pixels to 0
targetPixel[0] = 0;
targetPixel[1] = 0;

View file

@ -329,7 +329,7 @@ void DemoEc_UseDrawObject(DemoEc* this, PlayState* play) {
void DemoEc_UseAnimationObject(DemoEc* this, PlayState* play) {
s32 animObjBankIndex = this->animObjBankIndex;
gSegments[6] = PHYSICAL_TO_VIRTUAL(play->objectCtx.status[animObjBankIndex].segment);
gSegments[6] = VIRTUAL_TO_PHYSICAL(play->objectCtx.status[animObjBankIndex].segment);
}
CsCmdActorAction* DemoEc_GetNpcAction(PlayState* play, s32 actionIndex) {

View file

@ -1864,7 +1864,7 @@ void DemoEffect_DrawLightEffect(Actor* thisx, PlayState* play) {
if (this->light.flicker == 0) {
this->light.flicker = 1;
} else {
disp = (u32)gEffFlash1DL; // necessary to match, should be able to remove after fake matches are fixed
disp = (Gfx*)(u32)gEffFlash1DL; // necessary to match, should be able to remove after fake matches are fixed
alpha = &this->light.alpha;
Gfx_SetupDL_25Xlu(play->state.gfxCtx);
gDPSetPrimColor(POLY_XLU_DISP++, 0, 128, this->primXluColor[0], this->primXluColor[1],

View file

@ -859,7 +859,7 @@ void DemoKankyo_DrawWarpSparkles(Actor* thisx, PlayState* play) {
translateZ = this->unk_150[i].unk_C.z + this->unk_150[i].unk_0.z;
if (this->unk_150[i].unk_22 < 2) {
disp = (u32)gEffFlash1DL;
disp = (Gfx*)(u32)gEffFlash1DL;
if (linkAge != LINK_AGE_ADULT) {
Matrix_Translate(translateX, translateY, translateZ, MTXMODE_NEW);
} else {

View file

@ -170,7 +170,7 @@ void EnDntNomal_Destroy(Actor* thisx, PlayState* play) {
void EnDntNomal_WaitForObject(EnDntNomal* this, PlayState* play) {
if (Object_IsLoaded(&play->objectCtx, this->objIndex)) {
gSegments[6] = PHYSICAL_TO_VIRTUAL(play->objectCtx.status[this->objIndex].segment);
gSegments[6] = VIRTUAL_TO_PHYSICAL(play->objectCtx.status[this->objIndex].segment);
this->actor.objBankIndex = this->objIndex;
ActorShape_Init(&this->actor.shape, 0.0f, ActorShadow_DrawCircle, 0.0f);
this->actor.gravity = -2.0f;

View file

@ -858,7 +858,9 @@ void EnHorse_Init(Actor* thisx, PlayState* play2) {
this->animationIdx = ENHORSE_ANIM_IDLE;
Animation_PlayOnce(&this->skin.skelAnime, sAnimationHeaders[this->type][this->animationIdx]);
this->numBoosts = 6;
this->blinkTimer = this->postDrawFunc = this->boostRegenTime = 0;
this->boostRegenTime = 0;
this->postDrawFunc = NULL;
this->blinkTimer = 0;
EnHorse_ResetCutscene(this, play);
EnHorse_ResetRace(this, play);
EnHorse_ResetHorsebackArchery(this, play);

View file

@ -864,7 +864,7 @@ void EnMb_ClubAttack(EnMb* this, PlayState* play) {
func_80033480(play, &effSpawnPos, 2.0f, 3, 0x12C, 0xB4, 1);
Camera_AddQuake(&play->mainCamera, 2, 0x19, 5);
func_800358DC(&this->actor, &effSpawnPos, &this->actor.world.rot, flamesParams, 20, flamesUnused, play, -1,
0);
NULL);
EnMb_SetupClubWaitAfterAttack(this);
}
} else {

View file

@ -1989,7 +1989,7 @@ void EnOssan_InitBazaarShopkeeper(EnOssan* this, PlayState* play) {
void EnOssan_InitKokiriShopkeeper(EnOssan* this, PlayState* play) {
SkelAnime_InitFlex(play, &this->skelAnime, &gKm1Skel, NULL, NULL, NULL, 0);
gSegments[6] = PHYSICAL_TO_VIRTUAL(play->objectCtx.status[this->objBankIndex3].segment);
gSegments[6] = VIRTUAL_TO_PHYSICAL(play->objectCtx.status[this->objBankIndex3].segment);
Animation_Change(&this->skelAnime, &object_masterkokiri_Anim_0004A8, 1.0f, 0.0f,
Animation_GetLastFrame(&object_masterkokiri_Anim_0004A8), 0, 0.0f);
this->actor.draw = EnOssan_DrawKokiriShopkeeper;
@ -2000,7 +2000,7 @@ void EnOssan_InitKokiriShopkeeper(EnOssan* this, PlayState* play) {
void EnOssan_InitGoronShopkeeper(EnOssan* this, PlayState* play) {
SkelAnime_InitFlex(play, &this->skelAnime, &gGoronSkel, NULL, NULL, NULL, 0);
gSegments[6] = PHYSICAL_TO_VIRTUAL(play->objectCtx.status[this->objBankIndex3].segment);
gSegments[6] = VIRTUAL_TO_PHYSICAL(play->objectCtx.status[this->objBankIndex3].segment);
Animation_Change(&this->skelAnime, &gGoronShopkeeperAnim, 1.0f, 0.0f, Animation_GetLastFrame(&gGoronShopkeeperAnim),
0, 0.0f);
this->actor.draw = EnOssan_DrawGoronShopkeeper;
@ -2009,7 +2009,7 @@ void EnOssan_InitGoronShopkeeper(EnOssan* this, PlayState* play) {
void EnOssan_InitZoraShopkeeper(EnOssan* this, PlayState* play) {
SkelAnime_InitFlex(play, &this->skelAnime, &gZoraSkel, NULL, NULL, NULL, 0);
gSegments[6] = PHYSICAL_TO_VIRTUAL(play->objectCtx.status[this->objBankIndex3].segment);
gSegments[6] = VIRTUAL_TO_PHYSICAL(play->objectCtx.status[this->objBankIndex3].segment);
Animation_Change(&this->skelAnime, &gZoraShopkeeperAnim, 1.0f, 0.0f, Animation_GetLastFrame(&gZoraShopkeeperAnim),
0, 0.0f);
this->actor.draw = EnOssan_DrawZoraShopkeeper;

View file

@ -150,7 +150,7 @@ void EnSth_SetupAfterObjectLoaded(EnSth* this, PlayState* play) {
s16* params;
EnSth_SetupShapeColliderUpdate2AndDraw(this, play);
gSegments[6] = PHYSICAL_TO_VIRTUAL(play->objectCtx.status[this->objectBankIdx].segment);
gSegments[6] = VIRTUAL_TO_PHYSICAL(play->objectCtx.status[this->objectBankIdx].segment);
SkelAnime_InitFlex(play, &this->skelAnime, sSkeletons[this->actor.params], NULL, this->jointTable, this->morphTable,
16);
Animation_PlayLoop(&this->skelAnime, sAnimations[this->actor.params]);
@ -389,7 +389,7 @@ void EnSth_Draw(Actor* thisx, PlayState* play) {
OPEN_DISPS(play->state.gfxCtx, "../z_en_sth.c", 2133);
gSegments[6] = PHYSICAL_TO_VIRTUAL(play->objectCtx.status[this->objectBankIdx].segment);
gSegments[6] = VIRTUAL_TO_PHYSICAL(play->objectCtx.status[this->objectBankIdx].segment);
Gfx_SetupDL_37Opa(play->state.gfxCtx);
gSPSegment(POLY_OPA_DISP++, 0x08,

View file

@ -742,7 +742,7 @@ void ObjectKankyo_Lightning(ObjectKankyo* this, PlayState* play) {
this->effects[0].state = 0;
}
break;
default:
break;
}

View file

@ -34,7 +34,7 @@ u32 EffectSsFhgFlash_Init(PlayState* play, u32 index, EffectSs* this, void* init
s32 objBankIdx;
Vec3f zeroVec = { 0.0f, 0.0f, 0.0f };
Vec3f sp34 = { 0.0f, -1000.0f, 0.0f };
void* oldSeg6;
u32 oldSeg6;
if (initParams->type == FHGFLASH_LIGHTBALL) {
objBankIdx = Object_GetIndex(&play->objectCtx, OBJECT_FHG);

View file

@ -24,7 +24,7 @@ u32 EffectSsIceSmoke_Init(PlayState* play, u32 index, EffectSs* this, void* init
EffectSsIceSmokeInitParams* initParams = (EffectSsIceSmokeInitParams*)initParamsx;
s32 pad;
s32 objBankIdx;
void* oldSeg6;
u32 oldSeg6;
objBankIdx = Object_GetIndex(&play->objectCtx, OBJECT_FZ);

View file

@ -761,7 +761,7 @@ void Select_Init(GameState* thisx) {
R_UPDATE_RATE = 1;
this->staticSegment = GameState_Alloc(&this->state, size, "../z_select.c", 1114);
DmaMgr_SendRequest1(this->staticSegment, _z_select_staticSegmentRomStart, size, "../z_select.c", 1115);
DmaMgr_SendRequest1(this->staticSegment, (u32)_z_select_staticSegmentRomStart, size, "../z_select.c", 1115);
gSaveContext.cutsceneIndex = 0x8000;
gSaveContext.linkAge = LINK_AGE_CHILD;
}

View file

@ -2595,7 +2595,7 @@ void KaleidoScope_Update(PlayState* play) {
if (gSaveContext.language == LANGUAGE_ENG) {
size = (u32)_icon_item_nes_staticSegmentRomEnd - (u32)_icon_item_nes_staticSegmentRomStart;
osSyncPrintf("icon_item_dungeon dungeon-size=%x\n", size);
DmaMgr_SendRequest1(pauseCtx->iconItemLangSegment, _icon_item_nes_staticSegmentRomStart, size,
DmaMgr_SendRequest1(pauseCtx->iconItemLangSegment, (u32)_icon_item_nes_staticSegmentRomStart, size,
"../z_kaleido_scope_PAL.c", 3739);
} else if (gSaveContext.language == LANGUAGE_GER) {
size = (u32)_icon_item_ger_staticSegmentRomEnd - (u32)_icon_item_ger_staticSegmentRomStart;