From 83846b913ac7dd23389588a23b3bb1aa2062a2ee Mon Sep 17 00:00:00 2001 From: Kurausukun Date: Mon, 26 Oct 2020 00:01:53 -0400 Subject: [PATCH] port sub_806F160 fakematch fix --- include/pokemon.h | 12 ++++++------ src/pokemon.c | 13 ++++--------- 2 files changed, 10 insertions(+), 15 deletions(-) diff --git a/include/pokemon.h b/include/pokemon.h index d75ec94f30..a956b9c406 100644 --- a/include/pokemon.h +++ b/include/pokemon.h @@ -123,12 +123,12 @@ struct Pokemon struct Unknown_806F160_Struct { - u8 field_0_0:4; - u8 field_0_1:4; - u8 field_1; - u8 magic; - u8 field_3_0:4; - u8 field_3_1:4; + u32 field_0_0:4; + u32 field_0_1:4; + u32 field_1:8; + u16 magic:8; + u32 field_3_0:4; + u32 field_3_1:4; void *bytes; u8 **byteArrays; struct SpriteTemplate *templates; diff --git a/src/pokemon.c b/src/pokemon.c index e04260e40c..a38ad12de0 100644 --- a/src/pokemon.c +++ b/src/pokemon.c @@ -6808,19 +6808,14 @@ static bool8 ShouldSkipFriendshipChange(void) return FALSE; } -#define FORCE_SIGNED(x)(-(x * (-1))) - static void sub_806F160(struct Unknown_806F160_Struct* structPtr) { u16 i, j; - for (i = 0; i < FORCE_SIGNED(structPtr->field_0_0); i++) + for (i = 0; i < structPtr->field_0_0; i++) { structPtr->templates[i] = gUnknown_08329D98[i]; for (j = 0; j < structPtr->field_1; j++) { - #ifndef NONMATCHING - asm(""); - #endif structPtr->frameImages[i * structPtr->field_1 + j].data = &structPtr->byteArrays[i][j * 0x800]; } structPtr->templates[i].images = &structPtr->frameImages[i * structPtr->field_1]; @@ -6830,7 +6825,7 @@ static void sub_806F160(struct Unknown_806F160_Struct* structPtr) static void sub_806F1FC(struct Unknown_806F160_Struct* structPtr) { u16 i, j; - for (i = 0; i < FORCE_SIGNED(structPtr->field_0_0); i++) + for (i = 0; i < structPtr->field_0_0; i++) { structPtr->templates[i] = gUnknown_08329F28; for (j = 0; j < structPtr->field_1; j++) @@ -6882,7 +6877,7 @@ struct Unknown_806F160_Struct *sub_806F2AC(u8 id, u8 arg1) } else { - for (i = 0; i < FORCE_SIGNED(structPtr->field_0_0); i++) + for (i = 0; i < structPtr->field_0_0; i++) structPtr->byteArrays[i] = structPtr->bytes + (structPtr->field_3_0 * (i << 0xD)); } @@ -6978,7 +6973,7 @@ u8 *sub_806F4F8(u8 id, u8 arg1) } else { - if (arg1 >= FORCE_SIGNED(structPtr->field_0_0)) + if (arg1 >= structPtr->field_0_0) arg1 = 0; return structPtr->byteArrays[arg1];