From 10af15d30a7b19f2ce51f9df41bae1603c73282f Mon Sep 17 00:00:00 2001 From: Tal Hayon Date: Sun, 17 Apr 2022 10:10:17 +0300 Subject: [PATCH] Replace int with s32 --- src/npc/phonograph.c | 4 ++-- src/object/button.c | 2 +- src/scroll.c | 52 ++++++++++++++++++++++---------------------- src/text.c | 32 +++++++++++++-------------- 4 files changed, 45 insertions(+), 45 deletions(-) diff --git a/src/npc/phonograph.c b/src/npc/phonograph.c index 560794d2..5932c644 100644 --- a/src/npc/phonograph.c +++ b/src/npc/phonograph.c @@ -85,7 +85,7 @@ void sub_0806E964(Entity* this, ScriptExecutionContext* context) { this->field_0x6a.HWORD = this->field_0x68.HWORD; field_0x68 = (s16)this->field_0x68.HWORD * 4; ptr2++; - this->field_0x6c.HWORD = *(s16*)((((int)ptr2 + field_0x68))); + this->field_0x6c.HWORD = *(s16*)((((s32)ptr2 + field_0x68))); } else { SoundReq(SONG_STOP_ALL); this->field_0x6a.HWORD = 0; @@ -167,7 +167,7 @@ void sub_0806E964(Entity* this, ScriptExecutionContext* context) { this->field_0x6a.HWORD = this->field_0x68.HWORD; field_0x68 = (s16)this->field_0x68.HWORD * 4; ptr2++; - this->field_0x6c.HWORD = *(s16*)((((int)ptr2 + field_0x68))); + this->field_0x6c.HWORD = *(s16*)((((s32)ptr2 + field_0x68))); } else { SoundReq(SONG_STOP_ALL); this->field_0x6a.HWORD = 0; diff --git a/src/object/button.c b/src/object/button.c index 88068074..1429cb05 100644 --- a/src/object/button.c +++ b/src/object/button.c @@ -185,7 +185,7 @@ u32 sub_08081E3C(Entity* this) { 0x77, 0x78, 0x79, 0x7a, 0, 0, }; const u16* tmp1; - int tmp2; + s32 tmp2; tmp2 = GetTileType(this->field_0x74.HWORD, this->collisionLayer); tmp1 = gUnk_0811EE50; do { diff --git a/src/scroll.c b/src/scroll.c index c7ce5348..1b8c213b 100644 --- a/src/scroll.c +++ b/src/scroll.c @@ -53,10 +53,10 @@ void sub_08080368(); void sub_08080B60(u8*); bool32 sub_08080794(const Transition* transition, u32 param_2, u32 param_3, u32 param_4); bool32 sub_08080808(const Transition* transition, u32 param_2, u32 param_3, u32 param_4); -void sub_080808D8(int); -void sub_080808E4(int); -void sub_08080904(int); -void sub_08080910(int); +void sub_080808D8(s32); +void sub_080808E4(s32); +void sub_08080904(s32); +void sub_08080910(s32); extern u8 gMapDataTopSpecial[]; @@ -104,7 +104,7 @@ void sub_0807FDE4(RoomControls* controls) { void sub_0807FDF8(RoomControls* controls) { u32 bVar1; Entity* pEVar2; - int iVar3; + s32 iVar3; gUpdateVisibleTiles = 2; controls->filler2[0]++; @@ -218,12 +218,12 @@ void sub_0807FFE4(RoomControls* controls) { } void sub_08080040(RoomControls* controls) { - int iVar2; - int iVar3; - int uVar5; - int uVar6; - int iVar7; - int temp; + s32 iVar2; + s32 iVar3; + s32 uVar5; + s32 uVar6; + s32 iVar7; + s32 temp; controls->filler2[0] -= 6; controls->filler2[1] = (controls->filler2[0] << 1) / 3; @@ -285,12 +285,12 @@ void sub_08080198(RoomControls* controls) { } void sub_080801BC(RoomControls* controls) { - int iVar2; - int iVar3; - int uVar5; - int uVar6; - int iVar7; - int temp; + s32 iVar2; + s32 iVar3; + s32 uVar5; + s32 uVar6; + s32 iVar7; + s32 temp; controls->filler2[0] += 6; controls->filler2[1] = (controls->filler2[0] << 1) / 3; @@ -369,7 +369,7 @@ bool32 sub_080806BC(u32 param_1, u32 param_2, u32 param_3, u32 param_4) { sub_08080808, }; u32 uVar1; - int iVar2; + s32 iVar2; const Transition* puVar3; puVar3 = (gArea.pCurrentRoomInfo->exits); @@ -386,7 +386,7 @@ bool32 sub_080806BC(u32 param_1, u32 param_2, u32 param_3, u32 param_4) { const Transition* sub_08080734(u32 param_1, u32 param_2) { u32 warpType; - int iVar2; + s32 iVar2; u32 uVar4; const Transition* puVar3; @@ -467,7 +467,7 @@ bool32 sub_08080808(const Transition* param_1, u32 param_2, u32 param_3, u32 par } void DoExitTransition(const ScreenTransitionData* data) { - static void (*const gUnk_0811E7C4[])(int) = { + static void (*const gUnk_0811E7C4[])(s32) = { sub_080808D8, sub_080808E4, sub_08080904, @@ -497,11 +497,11 @@ void DoExitTransition(const ScreenTransitionData* data) { gUnk_0811E7C4[data->type](data->field_0xa); } -void sub_080808D8(int param_1) { +void sub_080808D8(s32 param_1) { gRoomTransition.type = TRANSITION_DEFAULT; } -void sub_080808E4(int param_1) { +void sub_080808E4(s32 param_1) { if (CheckAreaOverworld(gRoomTransition.player_status.area_next)) { gRoomTransition.type = TRANSITION_DEFAULT; } else { @@ -509,11 +509,11 @@ void sub_080808E4(int param_1) { } } -void sub_08080904(int param_1) { +void sub_08080904(s32 param_1) { gRoomTransition.type = TRANSITION_CUT; } -void sub_08080910(int param_1) { +void sub_08080910(s32 param_1) { gRoomTransition.type = TRANSITION_CUT; } @@ -576,8 +576,8 @@ void sub_08080974(u32 arg0, u32 arg1) { } void sub_080809D4(void) { - int x, y; - int var1, var0; + s32 x, y; + s32 var1, var0; RoomControls* roomControls = &gRoomControls; roomControls->scroll_flags &= ~4; diff --git a/src/text.c b/src/text.c index a942ed63..277b0a65 100644 --- a/src/text.c +++ b/src/text.c @@ -33,7 +33,7 @@ void sub_0805F440(Token*, u8*); u32 sub_0805F6A4(Token*, WStruct*); u32 GetCharacter(Token* tok); u32 GetFontStrWith(Token*, u32); -int sub_0805F67C(short*, int, int); +s32 sub_0805F67C(short*, s32, s32); void sub_0805F918(u32, u32, void*); bool32 sub_0805F5CC(Font*, Token*, WStruct*); void sub_0805EEB4(Token*, u32); @@ -64,7 +64,7 @@ void sub_0805EEB4(Token* token, u32 textIndex) { u32 langIndex; u32* puVar2; u8* puVar5; - int iVar3; + s32 iVar3; u32 uVar4; u32 uVar6; u32 uVar7; @@ -76,7 +76,7 @@ void sub_0805EEB4(Token* token, u32 textIndex) { } puVar2 = gTranslations[langIndex]; iVar3 = puVar2[(u8)(textIndex >> 8)]; - puVar2 = (u32*)((int)puVar2 + iVar3); + puVar2 = (u32*)((s32)puVar2 + iVar3); iVar3 = puVar2[(u8)textIndex]; uVar6 = *(gTranslations[langIndex]) >> 2; uVar7 = *puVar2 >> 2; @@ -84,7 +84,7 @@ void sub_0805EEB4(Token* token, u32 textIndex) { if (((token->textIndex >> 8) >= uVar6) || ((u8)token->textIndex >= uVar7)) { uVar4 = 1; } else { - if (*(char*)((int)puVar2 + iVar3) == 0) { + if (*(char*)((s32)puVar2 + iVar3) == 0) { uVar4 = 2; } } @@ -95,7 +95,7 @@ void sub_0805EEB4(Token* token, u32 textIndex) { iVar3 = 0; break; } - puVar2 = (u32*)((int)puVar2 + iVar3); + puVar2 = (u32*)((s32)puVar2 + iVar3); sub_0805EF40(token, (u8*)puVar2); } @@ -134,7 +134,7 @@ u32 GetCharacter(Token* token) { u32 code; u32 uVar6; u8** ppuVar7; - int iVar8; + s32 iVar8; do { code = sub_0805EF8C(token); @@ -358,8 +358,8 @@ u32 GetFontStrWith(Token* param_1, u32 param_2) { u32 rv; u32 r9; Token token; - int local_28; - int local_24; + s32 local_28; + s32 local_24; MemCopy(param_1, &token, sizeof(Token)); local_24 = 0; @@ -457,9 +457,9 @@ u32 sub_0805F46C(u32 param_1, const Font* param_2) { pWVar4->bgColor = font.fill_type; if (font.draw_border) { sub_0805F918(font.border_type, font.fill_type, font.gfx_dest); - font.gfx_dest = (void*)((int)font.gfx_dest + 0xe0); + font.gfx_dest = (void*)((s32)font.gfx_dest + 0xe0); fontStr = GetFontStrWith(&token, 1); - iVar10 = (fontStr >> 0x18) * (u32)font._16 + ((u8)((int)fontStr >> 0x10) << 1); + iVar10 = (fontStr >> 0x18) * (u32)font._16 + ((u8)((s32)fontStr >> 0x10) << 1); uVar8 = (u16)fontStr; temp3 = uVar8; if (font.width < (s32)temp3) { @@ -487,7 +487,7 @@ u32 sub_0805F46C(u32 param_1, const Font* param_2) { while (iVar10-- > 0) { puVar9 += 0x20; puVar6 = puVar9; - for (uVar5 = uVar8; (int)uVar5-- > 0;) { + for (uVar5 = uVar8; (s32)uVar5-- > 0;) { *puVar6++ = param_1; } } @@ -502,7 +502,7 @@ u32 sub_0805F46C(u32 param_1, const Font* param_2) { bool32 sub_0805F5CC(Font* param_1, Token* param_2, WStruct* param_3) { u16 uVar2; u32 uVar3; - int iVar4; + s32 iVar4; u16* puVar5; u32 fontStr; @@ -513,7 +513,7 @@ bool32 sub_0805F5CC(Font* param_1, Token* param_2, WStruct* param_3) { puVar5 = (u16*)sub_0805F6A4(param_2, param_3); if (puVar5) { - iVar4 = (int)(param_3->unk6 + 7) / 8; + iVar4 = (s32)(param_3->unk6 + 7) / 8; puVar5 = param_1->dest; if (param_1->right_align) { puVar5 -= (iVar4 + 1U) >> 1; @@ -522,7 +522,7 @@ bool32 sub_0805F5CC(Font* param_1, Token* param_2, WStruct* param_3) { param_1->dest += 0x40; iVar4 *= 0x40; MemCopy(param_1->buffer_loc, param_1->gfx_dest, iVar4); - param_1->gfx_dest = (void*)((int)param_1->gfx_dest + iVar4); + param_1->gfx_dest = (void*)((s32)param_1->gfx_dest + iVar4); } else { if (param_2->code == 10) { param_1->dest += param_1->_16 * 0x20; @@ -531,7 +531,7 @@ bool32 sub_0805F5CC(Font* param_1, Token* param_2, WStruct* param_3) { return param_2->code > 0; } -int sub_0805F67C(short* param_1, int param_2, int param_3) { +s32 sub_0805F67C(short* param_1, s32 param_2, s32 param_3) { for (param_3--; param_3 != -1; param_3--) { param_1[0] = param_2++; param_1[0x20] = param_2++; @@ -543,7 +543,7 @@ int sub_0805F67C(short* param_1, int param_2, int param_3) { u32 sub_0805F6A4(Token* param_1, WStruct* param_2) { u32 uVar1; u32 uVar3; - int iVar4; + s32 iVar4; u32 r7; iVar4 = 0;