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

Use long over int for s32/u32 types (#1546)

* long s32

* Suggested changes
This commit is contained in:
Tharo 2023-10-17 20:16:31 +01:00 committed by GitHub
parent b3486b57ef
commit a20163c6ab
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
21 changed files with 66 additions and 62 deletions

View file

@ -376,14 +376,14 @@ void func_8002DBD0(Actor* actor, Vec3f* dest, Vec3f* pos);
f32 Actor_HeightDiff(Actor* actorA, Actor* actorB);
f32 Player_GetHeight(Player* player);
f32 func_8002DCE4(Player* player);
s32 func_8002DD6C(Player* player);
s32 func_8002DD78(Player* player);
int func_8002DD6C(Player* player);
int func_8002DD78(Player* player);
s32 func_8002DDE4(PlayState* play);
s32 func_8002DDF4(PlayState* play);
void func_8002DE04(PlayState* play, Actor* actorA, Actor* actorB);
void func_8002DE74(PlayState* play, Player* player);
void Actor_MountHorse(PlayState* play, Player* player, Actor* horse);
s32 func_8002DEEC(Player* player);
int func_8002DEEC(Player* player);
void func_8002DF18(PlayState* play, Player* player);
s32 func_8002DF38(PlayState* play, Actor* actor, u8 csAction);
s32 func_8002DF54(PlayState* play, Actor* actor, u8 csAction);
@ -991,10 +991,10 @@ void Path_CopyLastPoint(Path* path, Vec3f* dest);
void FrameAdvance_Init(FrameAdvanceContext* frameAdvCtx);
s32 FrameAdvance_Update(FrameAdvanceContext* frameAdvCtx, Input* input);
void Player_SetBootData(PlayState* play, Player* this);
s32 Player_InBlockingCsMode(PlayState* play, Player* this);
s32 Player_InCsMode(PlayState* play);
int Player_InBlockingCsMode(PlayState* play, Player* this);
int Player_InCsMode(PlayState* play);
s32 func_8008E9C4(Player* this);
s32 Player_IsChildWithHylianShield(Player* this);
int Player_IsChildWithHylianShield(Player* this);
s32 Player_ActionToModelGroup(Player* this, s32 itemAction);
void Player_SetModelsForHoldingShield(Player* this);
void Player_SetModels(Player* this, s32 modelGroup);
@ -1006,19 +1006,19 @@ void func_8008EDF0(Player* this);
void func_8008EE08(Player* this);
void func_8008EEAC(PlayState* play, Actor* actor);
s32 func_8008EF44(PlayState* play, s32 ammo);
s32 Player_IsBurningStickInRange(PlayState* play, Vec3f* pos, f32 xzRange, f32 yRange);
int Player_IsBurningStickInRange(PlayState* play, Vec3f* pos, f32 xzRange, f32 yRange);
s32 Player_GetStrength(void);
u8 Player_GetMask(PlayState* play);
Player* Player_UnsetMask(PlayState* play);
s32 Player_HasMirrorShieldEquipped(PlayState* play);
s32 Player_HasMirrorShieldSetToDraw(PlayState* play);
int Player_HasMirrorShieldSetToDraw(PlayState* play);
s32 Player_ActionToMagicSpell(Player* this, s32 itemAction);
s32 Player_HoldsHookshot(Player* this);
s32 func_8008F128(Player* this);
int Player_HoldsHookshot(Player* this);
int func_8008F128(Player* this);
s32 Player_ActionToMeleeWeapon(s32 itemAction);
s32 Player_GetMeleeWeaponHeld(Player* this);
s32 Player_HoldsTwoHandedWeapon(Player* this);
s32 Player_HoldsBrokenKnife(Player* this);
int Player_HoldsBrokenKnife(Player* this);
s32 Player_ActionToBottle(Player* this, s32 itemAction);
s32 Player_GetBottleHeld(Player* this);
s32 Player_ActionToExplosive(Player* this, s32 itemAction);
@ -1265,7 +1265,7 @@ Gfx* Play_SetFog(PlayState* this, Gfx* gfx);
void Play_Destroy(GameState* thisx);
void Play_Init(GameState* thisx);
void Play_Main(GameState* thisx);
s32 Play_InCsMode(PlayState* this);
int Play_InCsMode(PlayState* this);
f32 func_800BFCB8(PlayState* this, MtxF* mf, Vec3f* pos);
void* Play_LoadFile(PlayState* this, RomFile* file);
void Play_GetScreenPos(PlayState* this, Vec3f* src, Vec3f* dest);
@ -1287,8 +1287,8 @@ void Play_SaveSceneFlags(PlayState* this);
void Play_SetupRespawnPoint(PlayState* this, s32 respawnMode, s32 playerParams);
void Play_TriggerVoidOut(PlayState* this);
void Play_TriggerRespawn(PlayState* this);
s32 Play_CamIsNotFixed(PlayState* this);
s32 FrameAdvance_IsEnabled(PlayState* this);
int Play_CamIsNotFixed(PlayState* this);
int FrameAdvance_IsEnabled(PlayState* this);
s32 func_800C0D34(PlayState* this, Actor* actor, s16* yaw);
s32 func_800C0DB4(PlayState* this, Vec3f* pos);
void PreRender_SetValuesSave(PreRender* this, u32 width, u32 height, void* fbuf, void* zbuf, void* cvg);

View file

@ -3,7 +3,11 @@
#define NULL ((void*)0)
#if defined(_MIPS_SZLONG) && (_MIPS_SZLONG == 64)
typedef unsigned long size_t;
#else
typedef unsigned int size_t;
#endif
#ifdef __GNUC__
#define offsetof(structure, member) __builtin_offsetof (structure, member)

View file

@ -1,8 +1,8 @@
#ifndef STDINT_H
#define STDINT_H
typedef signed int intptr_t;
typedef unsigned int uintptr_t;
typedef signed long intptr_t;
typedef unsigned long uintptr_t;
#define INT8_MIN (-0x80)
#define INT16_MIN (-0x8000)

View file

@ -7,8 +7,8 @@ typedef signed char s8;
typedef unsigned char u8;
typedef signed short int s16;
typedef unsigned short int u16;
typedef signed int s32;
typedef unsigned int u32;
typedef signed long s32;
typedef unsigned long u32;
typedef signed long long int s64;
typedef unsigned long long int u64;

View file

@ -399,7 +399,7 @@ typedef struct PlayState {
/* 0x11D34 */ TransitionActorContext transiActorCtx;
/* 0x11D3C */ void (*playerInit)(Player* player, struct PlayState* play, FlexSkeletonHeader* skelHeader);
/* 0x11D40 */ void (*playerUpdate)(Player* player, struct PlayState* play, Input* input);
/* 0x11D44 */ s32 (*isPlayerDroppingFish)(struct PlayState* play);
/* 0x11D44 */ int (*isPlayerDroppingFish)(struct PlayState* play);
/* 0x11D48 */ s32 (*startPlayerFishing)(struct PlayState* play);
/* 0x11D4C */ s32 (*grabPlayer)(struct PlayState* play, Player* player);
/* 0x11D50 */ s32 (*startPlayerCutscene)(struct PlayState* play, Actor* actor, s32 csAction);

View file

@ -130,7 +130,7 @@ s32 DmaMgr_DmaRomToRam(uintptr_t rom, void* ram, size_t size) {
}
size -= buffSize;
rom = rom + buffSize;
rom += buffSize;
ram = (u8*)ram + buffSize;
}

View file

@ -2369,6 +2369,6 @@ void func_800BB060(void) {
sDebugCamAnim.unk_0A = 0;
}
s32 func_800BB06C(void) {
int func_800BB06C(void) {
return sDebugCamPtr->unk_00 == 2 && sDebugCamAnim.unk_0A != 0;
}

View file

@ -1000,15 +1000,15 @@ f32 func_8002DCE4(Player* player) {
}
}
s32 func_8002DD6C(Player* player) {
int func_8002DD6C(Player* player) {
return player->stateFlags1 & PLAYER_STATE1_3;
}
s32 func_8002DD78(Player* player) {
int func_8002DD78(Player* player) {
return func_8002DD6C(player) && player->unk_834;
}
s32 func_8002DDA8(PlayState* play) {
int func_8002DDA8(PlayState* play) {
Player* player = GET_PLAYER(play);
return (player->stateFlags1 & PLAYER_STATE1_11) || func_8002DD78(player);
@ -1049,7 +1049,7 @@ void Actor_MountHorse(PlayState* play, Player* player, Actor* horse) {
horse->child = &player->actor;
}
s32 func_8002DEEC(Player* player) {
int func_8002DEEC(Player* player) {
return (player->stateFlags1 & (PLAYER_STATE1_7 | PLAYER_STATE1_29)) || (player->csAction != PLAYER_CSACTION_NONE);
}
@ -2996,7 +2996,7 @@ Actor* Actor_Delete(ActorContext* actorCtx, Actor* actor, PlayState* play) {
return newHead;
}
s32 func_80032880(PlayState* play, Actor* actor) {
int func_80032880(PlayState* play, Actor* actor) {
s16 sp1E;
s16 sp1C;

View file

@ -37,7 +37,7 @@ void Font_LoadOrderedFont(Font* font) {
s32 jj;
s32 codePointIndex;
s32 fontBufIndex;
size_t offset;
u32 offset;
font->msgOffset = _message_0xFFFC_nes - (const char*)_nes_message_data_staticSegmentStart;
len = font->msgLength = _message_0xFFFD_nes - _message_0xFFFC_nes;

View file

@ -400,7 +400,7 @@ void Play_Init(GameState* thisx) {
zAllocAligned = (zAlloc + 8) & ~0xF;
ZeldaArena_Init((void*)zAllocAligned, zAllocSize - (zAllocAligned - zAlloc));
// "Zelda Heap"
osSyncPrintf("ゼルダヒープ %08x-%08x\n", zAllocAligned, zAllocAligned + zAllocSize - (s32)(zAllocAligned - zAlloc));
osSyncPrintf("ゼルダヒープ %08x-%08x\n", zAllocAligned, (u8*)zAllocAligned + zAllocSize - (s32)(zAllocAligned - zAlloc));
Fault_AddClient(&D_801614B8, ZeldaArena_Display, NULL, NULL);
Actor_InitContext(this, &this->actorCtx, this->playerEntry);
@ -1336,7 +1336,7 @@ void Play_Main(GameState* thisx) {
}
// original name: "Game_play_demo_mode_check"
s32 Play_InCsMode(PlayState* this) {
int Play_InCsMode(PlayState* this) {
return (this->csCtx.state != CS_STATE_IDLE) || Player_InCsMode(this);
}
@ -1773,7 +1773,7 @@ void Play_TriggerRespawn(PlayState* this) {
Play_LoadToLastEntrance(this);
}
s32 Play_CamIsNotFixed(PlayState* this) {
int Play_CamIsNotFixed(PlayState* this) {
// SCENE_CAM_TYPE_FIXED_SHOP_VIEWPOINT was probably intended to be in this condition,
// but the room shape type check handles all shop cases regardless
return (this->roomCtx.curRoom.roomShape->base.type != ROOM_SHAPE_TYPE_IMAGE) &&
@ -1781,7 +1781,7 @@ s32 Play_CamIsNotFixed(PlayState* this) {
(R_SCENE_CAM_TYPE != SCENE_CAM_TYPE_FIXED_MARKET) && (this->sceneId != SCENE_CASTLE_COURTYARD_GUARDS_DAY);
}
s32 FrameAdvance_IsEnabled(PlayState* this) {
int FrameAdvance_IsEnabled(PlayState* this) {
return !!this->frameAdvCtx.enabled;
}

View file

@ -487,14 +487,14 @@ void Player_SetBootData(PlayState* play, Player* this) {
}
}
s32 Player_InBlockingCsMode(PlayState* play, Player* this) {
int Player_InBlockingCsMode(PlayState* play, Player* this) {
return (this->stateFlags1 & (PLAYER_STATE1_7 | PLAYER_STATE1_29)) || (this->csAction != PLAYER_CSACTION_NONE) ||
(play->transitionTrigger == TRANS_TRIGGER_START) || (this->stateFlags1 & PLAYER_STATE1_0) ||
(this->stateFlags3 & PLAYER_STATE3_7) ||
((gSaveContext.magicState != MAGIC_STATE_IDLE) && (Player_ActionToMagicSpell(this, this->itemAction) >= 0));
}
s32 Player_InCsMode(PlayState* play) {
int Player_InCsMode(PlayState* play) {
Player* this = GET_PLAYER(play);
return Player_InBlockingCsMode(play, this) || (this->unk_6AD == 4);
@ -504,7 +504,7 @@ s32 func_8008E9C4(Player* this) {
return (this->stateFlags1 & PLAYER_STATE1_4);
}
s32 Player_IsChildWithHylianShield(Player* this) {
int Player_IsChildWithHylianShield(Player* this) {
return gSaveContext.save.linkAge != LINK_AGE_ADULT && (this->currentShield == PLAYER_SHIELD_HYLIAN);
}
@ -640,7 +640,7 @@ s32 func_8008EF44(PlayState* play, s32 ammo) {
return 1;
}
s32 Player_IsBurningStickInRange(PlayState* play, Vec3f* pos, f32 xzRange, f32 yRange) {
int Player_IsBurningStickInRange(PlayState* play, Vec3f* pos, f32 xzRange, f32 yRange) {
Player* this = GET_PLAYER(play);
Vec3f diff;
s32 pad;
@ -685,7 +685,7 @@ s32 Player_HasMirrorShieldEquipped(PlayState* play) {
return (this->currentShield == PLAYER_SHIELD_MIRROR);
}
s32 Player_HasMirrorShieldSetToDraw(PlayState* play) {
int Player_HasMirrorShieldSetToDraw(PlayState* play) {
Player* this = GET_PLAYER(play);
return (this->rightHandType == PLAYER_MODELTYPE_RH_SHIELD) && (this->currentShield == PLAYER_SHIELD_MIRROR);
@ -701,11 +701,11 @@ s32 Player_ActionToMagicSpell(Player* this, s32 itemAction) {
}
}
s32 Player_HoldsHookshot(Player* this) {
int Player_HoldsHookshot(Player* this) {
return (this->heldItemAction == PLAYER_IA_HOOKSHOT) || (this->heldItemAction == PLAYER_IA_LONGSHOT);
}
s32 func_8008F128(Player* this) {
int func_8008F128(Player* this) {
return Player_HoldsHookshot(this) && (this->heldActor == NULL);
}
@ -731,7 +731,7 @@ s32 Player_HoldsTwoHandedWeapon(Player* this) {
}
}
s32 Player_HoldsBrokenKnife(Player* this) {
int Player_HoldsBrokenKnife(Player* this) {
return (this->heldItemAction == PLAYER_IA_SWORD_BIGGORON) &&
(gSaveContext.save.info.playerData.swordHealth <= 0.0f);
}

View file

@ -123,7 +123,7 @@ void BgMoriElevator_Destroy(Actor* thisx, PlayState* play) {
}
}
s32 BgMoriElevator_IsPlayerRiding(BgMoriElevator* this, PlayState* play) {
int BgMoriElevator_IsPlayerRiding(BgMoriElevator* this, PlayState* play) {
return ((this->dyna.interactFlags & DYNA_INTERACT_PLAYER_ON_TOP) &&
!(this->unk_170 & DYNA_INTERACT_PLAYER_ON_TOP) &&
((GET_PLAYER(play)->actor.world.pos.y - this->dyna.actor.world.pos.y) < 80.0f));

View file

@ -85,13 +85,13 @@ void BgMoriRakkatenjo_Destroy(Actor* thisx, PlayState* play) {
DynaPoly_DeleteBgActor(play, &play->colCtx.dyna, this->dyna.bgId);
}
s32 BgMoriRakkatenjo_IsLinkUnder(BgMoriRakkatenjo* this, PlayState* play) {
int BgMoriRakkatenjo_IsLinkUnder(BgMoriRakkatenjo* this, PlayState* play) {
Vec3f* pos = &GET_PLAYER(play)->actor.world.pos;
return (-3300.0f < pos->z) && (pos->z < -1840.0f) && (1791.0f < pos->x) && (pos->x < 2191.0f);
}
s32 BgMoriRakkatenjo_IsLinkClose(BgMoriRakkatenjo* this, PlayState* play) {
int BgMoriRakkatenjo_IsLinkClose(BgMoriRakkatenjo* this, PlayState* play) {
Vec3f* pos = &GET_PLAYER(play)->actor.world.pos;
return (-3360.0f < pos->z) && (pos->z < -1840.0f) && (1791.0f < pos->x) && (pos->x < 2191.0f);

View file

@ -371,7 +371,7 @@ s32 EnFr_IsBelowLogSpot(EnFr* this, f32* yDistToLogSpot) {
}
}
s32 EnFr_IsAboveAndWithin30DistXZ(Player* player, EnFr* this) {
int EnFr_IsAboveAndWithin30DistXZ(Player* player, EnFr* this) {
f32 xDistToPlayer = player->actor.world.pos.x - this->actor.world.pos.x;
f32 zDistToPlayer = player->actor.world.pos.z - this->actor.world.pos.z;
f32 yDistToPlayer = player->actor.world.pos.y - this->actor.world.pos.y;

View file

@ -108,7 +108,7 @@ void EnHoll_SetupAction(EnHoll* this, EnHollActionFunc func) {
this->actionFunc = func;
}
s32 EnHoll_IsKokiriLayer8(void) {
int EnHoll_IsKokiriLayer8(void) {
return gSaveContext.save.entranceIndex == ENTR_KOKIRI_FOREST_0 && gSaveContext.sceneLayer == 8;
}

View file

@ -633,7 +633,7 @@ void func_80A5BB90(PlayState* play, Vec3f* vec, Vec3f* arg2, f32* arg3) {
SkinMatrix_Vec3fMtxFMultXYZW(&play->viewProjectionMtxF, vec, arg2, arg3);
}
s32 func_80A5BBBC(PlayState* play, EnHorse* this, Vec3f* pos) {
int func_80A5BBBC(PlayState* play, EnHorse* this, Vec3f* pos) {
Vec3f sp24;
f32 sp20;
f32 eyeDist;

View file

@ -333,7 +333,7 @@ Actor* func_80AEB124(PlayState* play) {
return NULL;
}
s32 func_80AEB174(PlayState* play) {
int func_80AEB174(PlayState* play) {
return (Message_GetState(&play->msgCtx) == TEXT_STATE_EVENT) && Message_ShouldAdvance(play);
}

View file

@ -464,7 +464,7 @@ void EnSkj_Destroy(Actor* thisx, PlayState* play) {
Collider_DestroyCylinder(play, &this->collider);
}
s32 EnSkj_RangeCheck(Player* player, EnSkj* this) {
int EnSkj_RangeCheck(Player* player, EnSkj* this) {
f32 xDiff = player->actor.world.pos.x - this->actor.world.pos.x;
f32 zDiff = player->actor.world.pos.z - this->actor.world.pos.z;
f32 yDiff = player->actor.world.pos.y - this->actor.world.pos.y;

View file

@ -369,7 +369,7 @@ void func_80B4F230(EnZl2* this, s16 arg1, s32 arg2) {
s32 temp_t3;
s32 phi_v0;
s32 index1AC;
s32 phi_t5;
int phi_t5;
if (this->unk_24C != 0) {
temp_v1 = this->unk_1DC[arg2] - arg1;

View file

@ -523,7 +523,7 @@ void func_80B54360(EnZl3* this, s16 arg1, s32 arg2) {
s32 temp_t3 = this->unk_25C[arg2];
s32 phi_v0 = temp_t3;
s32 index25C;
s32 phi_t5;
int phi_t5;
temp_t3 = arg1 - this->unk_2BC[arg2];

View file

@ -253,7 +253,7 @@ void func_808528C8(PlayState* play, Player* this, CsCmdActorCue* cue);
void func_80852944(PlayState* play, Player* this, CsCmdActorCue* cue);
void func_808529D0(PlayState* play, Player* this, CsCmdActorCue* cue);
void func_80852C50(PlayState* play, Player* this, CsCmdActorCue* cue);
s32 Player_IsDroppingFish(PlayState* play);
int Player_IsDroppingFish(PlayState* play);
s32 Player_StartFishing(PlayState* play);
s32 func_80852F38(PlayState* play, Player* this);
s32 func_80852FFC(PlayState* play, Actor* actor, s32 csAction);
@ -2041,7 +2041,7 @@ void func_8083328C(PlayState* play, Player* this, LinkAnimationHeader* linkAnim)
LinkAnimation_PlayOnceSetSpeed(play, &this->skelAnime, linkAnim, D_808535E8);
}
s32 func_808332B8(Player* this) {
int func_808332B8(Player* this) {
return (this->stateFlags1 & PLAYER_STATE1_27) && (this->currentBoots != PLAYER_BOOTS_IRON);
}
@ -2092,7 +2092,7 @@ LinkAnimationHeader* func_80833438(Player* this) {
}
}
s32 func_808334B4(Player* this) {
int func_808334B4(Player* this) {
return func_808332E4(this) && (this->unk_834 != 0);
}
@ -2318,11 +2318,11 @@ s32 func_80833B54(Player* this) {
return 0;
}
s32 func_80833BCC(Player* this) {
int func_80833BCC(Player* this) {
return func_8008E9C4(this) || func_80833B2C(this);
}
s32 func_80833C04(Player* this) {
int func_80833C04(Player* this) {
return func_80833B54(this) || func_80833B2C(this);
}
@ -2757,11 +2757,11 @@ s32 func_80834D2C(Player* this, PlayState* play) {
return 1;
}
s32 func_80834E44(PlayState* play) {
int func_80834E44(PlayState* play) {
return (play->shootingGalleryStatus > 0) && CHECK_BTN_ALL(sControlInput->press.button, BTN_B);
}
s32 func_80834E7C(PlayState* play) {
int func_80834E7C(PlayState* play) {
return (play->shootingGalleryStatus != 0) &&
((play->shootingGalleryStatus < 0) ||
CHECK_BTN_ANY(sControlInput->cur.button, BTN_A | BTN_B | BTN_CUP | BTN_CLEFT | BTN_CRIGHT | BTN_CDOWN));
@ -3341,7 +3341,7 @@ void func_80836448(PlayState* play, Player* this, LinkAnimationHeader* anim) {
}
}
s32 Player_CanUpdateItems(Player* this) {
int Player_CanUpdateItems(Player* this) {
return (!(Player_Action_808458D0 == this->actionFunc) ||
((this->stateFlags1 & PLAYER_STATE1_START_CHANGING_HELD_ITEM) &&
((this->heldItemId == ITEM_LAST_USED) || (this->heldItemId == ITEM_NONE)))) &&
@ -4253,7 +4253,7 @@ s32 func_80838144(s32 arg0) {
}
}
s32 func_8083816C(s32 arg0) {
int func_8083816C(s32 arg0) {
return (arg0 == FLOOR_TYPE_4) || (arg0 == FLOOR_TYPE_7) || (arg0 == FLOOR_TYPE_12);
}
@ -5080,7 +5080,7 @@ void func_8083A098(Player* this, LinkAnimationHeader* anim, PlayState* play) {
func_8083328C(play, this, anim);
}
s32 func_8083A0D4(Player* this) {
int func_8083A0D4(Player* this) {
return (this->interactRangeActor != NULL) && (this->heldActor == NULL);
}
@ -8273,7 +8273,7 @@ s32 func_808428D8(Player* this, PlayState* play) {
return 0;
}
s32 func_80842964(Player* this, PlayState* play) {
int func_80842964(Player* this, PlayState* play) {
return Player_ActionChange_13(this, play) || Player_ActionChange_4(this, play) || Player_ActionChange_2(this, play);
}
@ -12284,7 +12284,7 @@ static Vec3f D_8085492C[] = {
{ -60.0f, -20.0f, 0.0f },
};
s32 func_8084C89C(PlayState* play, Player* this, s32 arg2, f32* arg3) {
int func_8084C89C(PlayState* play, Player* this, s32 arg2, f32* arg3) {
EnHorse* rideActor = (EnHorse*)this->rideActor;
f32 sp50;
f32 sp4C;
@ -15159,7 +15159,7 @@ void Player_Action_80852E14(Player* this, PlayState* play) {
func_80852B4C(play, this, NULL, &D_80854E50[this->csAction]);
}
s32 Player_IsDroppingFish(PlayState* play) {
int Player_IsDroppingFish(PlayState* play) {
Player* this = GET_PLAYER(play);
return (Player_Action_8084EFC0 == this->actionFunc) && (this->itemAction == PLAYER_IA_BOTTLE_FISH);