port sub_806F160 fakematch fix

This commit is contained in:
Kurausukun 2020-10-26 00:01:53 -04:00
parent 4c10f3f465
commit 83846b913a
2 changed files with 10 additions and 15 deletions

View File

@ -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;

View File

@ -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];