diff --git a/include/map.h b/include/map.h index 44d64610d5..aee0afb754 100644 --- a/include/map.h +++ b/include/map.h @@ -31,7 +31,7 @@ typedef struct MapConfig { } tattle; } MapConfig; // size = 0x40 -typedef s32(*MapInit)(void); +typedef s32 (*MapInit)(void); #define MAP_ID_MAX_LEN 7 ///< "xxx_yyy" excluding null terminator. typedef struct Map { diff --git a/include/variables.h b/include/variables.h index 99a6c4d0c7..e41dd6ba53 100644 --- a/include/variables.h +++ b/include/variables.h @@ -97,7 +97,7 @@ extern f64 D_802EB000; extern f64 D_802EB008; extern Entity* D_802EB3A0; -extern s32 D_8015C7D0; +extern s32 D_8015C7D0[3]; extern UNK_TYPE D_0A0031E0; extern UNK_TYPE D_0A001508; diff --git a/src/code_102610_len_2330.c b/src/code_102610_len_2330.c index 169452c7f4..1fc7b33c6f 100644 --- a/src/code_102610_len_2330.c +++ b/src/code_102610_len_2330.c @@ -8,11 +8,10 @@ void create_shadow_callback(Shadow* shadow) { //TODO: make sure this is the right struct for this. s32 func_802E0DB0(Shadow* shadow) { - if (((shadow->unk_06 & 4) != 0) && (gPlayerStatus.flags & 2) != 0) { - return 1; + return TRUE; } - return 0; + return FALSE; } INCLUDE_ASM(s32, "code_102610_len_2330", func_802E0DE0); @@ -31,14 +30,13 @@ void func_802E10F4(Entity* entity) { } void func_802E114C(void) { - - func_80027088(1); + func_80027088(TRUE); disable_player_input(); gPlayerStatusPtr->currentSpeed = 0.0f; } void func_802E117C(void) { - func_80027088(0); + func_80027088(FALSE); enable_player_input(); } @@ -53,7 +51,7 @@ void save_game_at_player_position(void) { void func_802E1204(Entity* entity) { - if (get_global_flag(0xF8405BDF) == 0) { + if (!get_global_flag(0xF8405BDF)) { s32* temp = &D_802EB390; *temp = 0; load_string(0x1D0000, temp); diff --git a/src/code_105f90.c b/src/code_105f90.c index 4b03e45142..4b13029630 100644 --- a/src/code_105f90.c +++ b/src/code_105f90.c @@ -9,11 +9,9 @@ void func_802E4AEC(s32 entityIndex) { } void func_802E4B10(Entity* entity) { - f32 temp_f0; - Entity* entityTemp; struct802E4B10* temp = entity->dataBuf; + Entity* entityTemp = get_entity_by_index(temp->unk_00); - entityTemp = get_entity_by_index(temp->unk_00); entity->position.x = entityTemp->position.x; entity->position.y = entityTemp->position.y + 14.0f; entity->position.z = entityTemp->position.z; @@ -66,7 +64,6 @@ void func_802E5308(Entity* entity) { func_802E3650(entity); } - INCLUDE_ASM(s32, "code_105f90", func_802E5324); void func_802E540C(Entity* entity) { diff --git a/src/code_1060_len_310.c b/src/code_1060_len_310.c index 755528a063..7e373371f2 100644 --- a/src/code_1060_len_310.c +++ b/src/code_1060_len_310.c @@ -39,7 +39,7 @@ u32 func_80025D74(void* arg0, const unsigned char* str, s32 count) { OSPiHandle** handle = &carthandle; osEPiReadIo(*handle, 0xB3FF0000, &data); - if (data != 0x49533634) { + if (data != ASCII_TO_U32('I', 'S', '6', '4')) { return 1; } osEPiReadIo(*handle, 0xB3FF0004, &data); diff --git a/src/code_109660_len_1270.c b/src/code_109660_len_1270.c index 4e65db7ef3..73d5be73f2 100644 --- a/src/code_109660_len_1270.c +++ b/src/code_109660_len_1270.c @@ -58,16 +58,16 @@ INCLUDE_ASM(s32, "code_109660_len_1270", func_802E854C); s32 func_802E8858(Entity* entity) { PlayerStatus* playerStatus = &gPlayerStatus; - s32 phi_a0 = 0; + s32 phi_a0 = FALSE; if (entity->unk_06 & 1) { if ((playerStatus->actionState == ActionState_GROUND_POUND) || (playerStatus->actionState == ActionState_ULTRA_POUND)) { set_action_state(ActionState_FALLING); - phi_a0 = 1; + phi_a0 = TRUE; } } - if (phi_a0 != 0) { + if (phi_a0) { func_802E7F6C(entity); func_80110BCC(entity, &D_802EAE7C); func_80110678(entity); @@ -82,16 +82,16 @@ void func_802E88EC(Entity* entity, f32 arg1) { struct802E7F40* temp = entity->dataBuf; if (temp->unk_00 != -1) { - s32 flag = 0; + s32 flag = FALSE; // can't do || here, or gcc realizes it can reuse the temp->unk_04 load - if ((temp->unk_04 == 0xFFFF)) { - flag = 1; - } else if ((get_global_flag(temp->unk_04) == 0)) { - flag = 1; + if (temp->unk_04 == 0xFFFF) { + flag = TRUE; + } else if (!get_global_flag(temp->unk_04)) { + flag = TRUE; } - if (flag != 0) { + if (flag) { make_item_entity(temp->unk_00, entity->position.x, entity->position.y + D_802EB370, entity->position.z, 0xA, 0, func_800E546C(), temp->unk_04); } @@ -103,15 +103,16 @@ typedef struct struct802E89B0 { /* 0x04 */ s32 unk_04; /* 0x08 */ s32 unk_08; /* 0x0C */ s32 unk_0C; - /* 0x10 */ char unk_10[4]; + /* 0x10 */ s32 unk_10; /* 0x14 */ s32 unk_14; + /* 0x18 */ f32 unk_18; } struct802E89B0; void func_802E89B0(Entity* entity) { struct802E89B0* temp_s0; temp_s0 = entity->dataBuf; - if (get_global_flag(temp_s0->unk_14) != 0) { + if (get_global_flag(temp_s0->unk_14)) { temp_s0->unk_04 = 0x10; func_8010FD68(entity); } diff --git a/src/code_341d0.c b/src/code_341d0.c index a0f32fe66f..29fc545fc5 100644 --- a/src/code_341d0.c +++ b/src/code_341d0.c @@ -166,7 +166,6 @@ extern TlbMappablePage D_80197000; extern EffectTableEntry D_8007F210[135]; s32 play_effect(s32 effectIndex) { - EffectTableEntry* effectTable = &D_8007F210[0]; EffectTableEntry* effectEntry; Effect* curEffect; diff --git a/src/si.c b/src/si.c index c420c58b6a..07712b475a 100644 --- a/src/si.c +++ b/src/si.c @@ -112,7 +112,7 @@ ApiStatus si_handle_sleep_seconds(ScriptInstance* script) { return ApiStatus_DONE2; } - script->functionTemp[0].s -= 1; + script->functionTemp[0].s--; return !script->functionTemp[0].s; } diff --git a/src/world/area_kmr/kmr_03/8C7F90.c b/src/world/area_kmr/kmr_03/8C7F90.c index f8eb70cc8e..b1246aeb20 100644 --- a/src/world/area_kmr/kmr_03/8C7F90.c +++ b/src/world/area_kmr/kmr_03/8C7F90.c @@ -50,14 +50,12 @@ ApiStatus func_80240000_8C7F90(ScriptInstance* script, s32 isInitialCall) { #include "world/common/CheckPartnerFlags1000.inc.c" -// 8C85E0 Vec4f N(entryList)[] = { { -340.0f, 0.0f, 348.0f, 48.0f }, { 480.0f, 0.0f, 0.0f, 270.0f }, { -310.0f, 20.0f, -80.0f, 135.0f }, }; - MapConfig N(config) = { .main = N(Main), .entryList = N(entryList),