diff --git a/include/PR/gbi.h b/include/PR/gbi.h index 595bc2b7b0..9c76ae06b5 100755 --- a/include/PR/gbi.h +++ b/include/PR/gbi.h @@ -1361,7 +1361,7 @@ typedef struct { typedef union { Light_t l; - //long long int force_structure_alignment[2]; + long long int force_structure_alignment[2]; } Light; typedef union { diff --git a/include/common_structs.h b/include/common_structs.h index e849cabc70..bb84f9a516 100644 --- a/include/common_structs.h +++ b/include/common_structs.h @@ -209,14 +209,9 @@ typedef union { s32 flags; } TriggerFlags; -typedef union { - s16 s; - s32 w; -} TriggerParams; - typedef struct Trigger { /* 0x00 */ TriggerFlags flags; - /* 0x04 */ TriggerParams params1; + /* 0x04 */ s32 params1; /* 0x08 */ s32 params2; /* 0x0C */ UNK_FUN_PTR(functionHandler); /* 0x10 */ Bytecode* scriptStart; @@ -1708,7 +1703,8 @@ typedef struct struct802E4B10 { // END ENTITY-SPECIFIC STRUCTS typedef struct { - /* 0x00000 */ LookAt lookAt[2]; + /* 0x00000 */ Light l1[2]; + /* 0x00018 */ Light l2[2]; /* 0x00030 */ Matrix4s camPerspMatrix[8]; // could only be length 4, unsure /* 0x00230 */ s32 mainGfx[0x4100]; /* 0x10630 */ s32 smallGfx[0x400]; // used by func 800269EC diff --git a/src/code_102610_len_2330.c b/src/code_102610_len_2330.c index 1fc7b33c6f..b1b5eb9b50 100644 --- a/src/code_102610_len_2330.c +++ b/src/code_102610_len_2330.c @@ -8,7 +8,7 @@ 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) { + if ((shadow->unk_06 & 4) && (gPlayerStatus.flags & 2)) { return TRUE; } return FALSE; @@ -51,11 +51,11 @@ void save_game_at_player_position(void) { void func_802E1204(Entity* entity) { - if (!get_global_flag(0xF8405BDF)) { + if (!get_global_flag(SI_SAVE_FLAG(95))) { s32* temp = &D_802EB390; *temp = 0; load_string(0x1D0000, temp); - set_global_flag(0xF8405BDF); + set_global_flag(SI_SAVE_FLAG(95)); return; } diff --git a/src/code_102c80.c b/src/code_102c80.c index 07dcb2e92d..6c6be1c033 100644 --- a/src/code_102c80.c +++ b/src/code_102c80.c @@ -104,10 +104,8 @@ void func_802E1660(Entity* entity) { return; } - if (temp2[3] == 4) { - if (temp2[0] != 0) { - return; - } + if ((temp2[3] == 4) && (temp2[0] != 0)) { + return; } if (!(entity->unk_06 & 1)) { diff --git a/src/code_104940_len_dc0.c b/src/code_104940_len_dc0.c index 0c70d1f48b..09e60056ff 100644 --- a/src/code_104940_len_dc0.c +++ b/src/code_104940_len_dc0.c @@ -199,6 +199,7 @@ void func_802E3B08(Entity* entity) { extern s32 D_802E9E80; #ifdef NON_MATCHING +// tail merge + rodata s32 func_802E3BA4(Entity* entity) { u8 bVar1; s32 bVar2; @@ -211,33 +212,33 @@ s32 func_802E3BA4(Entity* entity) { } bVar1 = entity->unk_06; - if ((bVar1 & 4) != 0) { + if (bVar1 & 4) { s32 type = get_entity_type(entity->listIndex); - if ((type == 0xC)) { + if (type == 0xC) { return 0; } - if ((type >= 0xC)) { - if ((type < 0x1b)) { - if ((type > 0x14)) { + if (type >= 0xC) { + if (type < 0x1b) { + if (type > 0x14) { return 0; } } } - if ((playerStatus->flags & 2) == 0) { + if (!(playerStatus->flags & 2)) { return 1; } func_8010FD68(entity); return 1; } - if ((bVar1 & 0x80) != 0) { + if (bVar1 & 0x80) { func_8010FD68(entity); return 1; } bVar2 = FALSE; - if ((bVar1 & 1)) { + if (bVar1 & 1) { if ((playerStatus->actionState == 0xd) || (playerStatus->actionState == 0x0f)) { return 0; } @@ -248,7 +249,7 @@ s32 func_802E3BA4(Entity* entity) { return 1; } } else { - if ((bVar1 & 0x40) == 0) { + if (!(bVar1 & 0x40)) { return 1; } if ((playerStatus->flags & 0x1000000) == 0) { diff --git a/src/code_105700_len_2130.c b/src/code_105700_len_2130.c index 30cb130293..c066c17d78 100644 --- a/src/code_105700_len_2130.c +++ b/src/code_105700_len_2130.c @@ -16,15 +16,15 @@ void func_802E3E9C(Entity* entity) { s32 alpha; alpha = entity->alpha; - if ((gPlayerStatus.animFlags & 1)) { - alpha += 0x20; - if (alpha > 0xC0) { - alpha = 0xC0; + if (gPlayerStatus.animFlags & 1) { + alpha += 32; + if (alpha > 192) { + alpha = 192; } entity->alpha = alpha; return; } else { - alpha -= 0x20; + alpha -= 32; if (alpha <= 0) { alpha = 0; } @@ -74,7 +74,7 @@ void func_802E4154(Entity* entity) { UNK_PTR phi_a0; struct802E3F0C* temp = entity->dataBuf; - if ((temp->unk_A != 0xFFFF) && (get_global_flag(temp->unk_A) != 0)) { + if ((temp->unk_A != 0xFFFF) && get_global_flag(temp->unk_A)) { if (get_entity_type(entity->listIndex) != 0x14) { phi_a0 = &D_802EA07C; } else { @@ -82,9 +82,9 @@ void func_802E4154(Entity* entity) { } create_entity(phi_a0, entity->position.x, entity->position.y, entity->position.z, entity->rotation.y, 0x80000000); func_8010FBC0(entity, &D_802EA310); - return; + } else { + func_8010FD68(entity); } - func_8010FD68(entity); } void func_802E421C(Entity* entity) { @@ -164,9 +164,9 @@ void func_802E4484(Entity* entity) { s32 func_802E44CC(Entity* entity) { if (entity->boundScript != NULL) { entity->flags |= 0x1000000; - return 1; + return TRUE; } - return 0; + return FALSE; } // TODO: new file here? diff --git a/src/code_109660_len_1270.c b/src/code_109660_len_1270.c index 7aa3f99778..acec7c62f1 100644 --- a/src/code_109660_len_1270.c +++ b/src/code_109660_len_1270.c @@ -155,7 +155,6 @@ void func_802E8A58(Entity* entity) { } } else { func_8010FD68(entity); - return; } } @@ -216,7 +215,7 @@ void func_802E8BC0(Entity* entity) { void func_802E8C94(Entity* entity) { Trigger* trigger = (Trigger*)entity->dataBuf; // TODO: is Trigger correct? - if (--trigger->params1.w == -1) { + if (--trigger->params1 == -1) { func_8010FD68(entity); } } @@ -226,7 +225,7 @@ void player_enter_blue_pipe(Entity* bluePipe) { Trigger* pipeTrigger = (Trigger*)bluePipe->dataBuf; // TODO: is Trigger correct? playerStatus->targetYaw = CURRENT_CAM->currentYaw + 180.0f; - pipeTrigger->params1.w = 0x19; + pipeTrigger->params1 = 0x19; playerStatus->renderMode = 0xD; func_802DDFF8(0x10002, 5, 2, 1, 1, 0, 0); @@ -239,9 +238,9 @@ void func_802E8D74(Entity* entity) { Trigger* entityTrigger = (Trigger*)entity->dataBuf; // TODO: is Trigger correct? playerStatus->position.y--; - entityTrigger->params1.w--; + entityTrigger->params1--; - if (entityTrigger->params1.w == -1) { + if (entityTrigger->params1 == -1) { playerStatus->renderMode = 0xD; playerStatus->position.y -= 50.0f; func_802DDFF8(0x10002, 0, 0, 0, 0, 0, 0); @@ -278,5 +277,5 @@ f32 func_802E8F94(Entity* entity) { temp_s0->unk_14 = temp4; temp_s0->unk_18 = entity->position.y; temp_s0->unk_08 = get_global_flag(temp_s0->unk_14); - *temp5 = entity->position.y - ((temp_s0->unk_08 != 0) ? 15.0 : 52.0); + *temp5 = entity->position.y - (temp_s0->unk_08 ? 15.0 : 52.0); } diff --git a/src/code_341d0.c b/src/code_341d0.c index 29fc545fc5..6bb7bb45d3 100644 --- a/src/code_341d0.c +++ b/src/code_341d0.c @@ -42,12 +42,12 @@ s32 render_effects(void) { curEffectInst = &D_800B4398[0]; for (i = 0; i < ARRAY_COUNT(D_800B4398); i++) { - if ((curEffectInst[i] != NULL) && ((curEffectInst[i]->flags & 1) != 0) && ((curEffectInst[i]->flags & 8) != 0)) { + if ((curEffectInst[i] != NULL) && (curEffectInst[i]->flags & 1) && (curEffectInst[i]->flags & 8)) { if (GAME_STATUS->isBattle) { - if ((curEffectInst[i]->flags & 4) != 0) { + if (curEffectInst[i]->flags & 4) { curEffectInst[i]->effect->renderWorld(curEffectInst[i]); } - } else if ((curEffectInst[i]->flags & 4) == 0) { + } else if (!(curEffectInst[i]->flags & 4)) { curEffectInst[i]->effect->renderWorld(curEffectInst[i]); } }