diff options
Diffstat (limited to 'src/pokemon.c')
-rw-r--r-- | src/pokemon.c | 34 |
1 files changed, 17 insertions, 17 deletions
diff --git a/src/pokemon.c b/src/pokemon.c index 8767207d7..3621284d6 100644 --- a/src/pokemon.c +++ b/src/pokemon.c @@ -69,7 +69,7 @@ EWRAM_DATA u8 gEnemyPartyCount = 0; EWRAM_DATA struct Pokemon gPlayerParty[PARTY_SIZE] = {0}; EWRAM_DATA struct Pokemon gEnemyParty[PARTY_SIZE] = {0}; EWRAM_DATA struct SpriteTemplate gMultiuseSpriteTemplate = {0}; -EWRAM_DATA struct Unknown_806F160_Struct *gUnknown_020249B4[2] = {NULL, NULL}; +EWRAM_DATA struct Unknown_806F160_Struct *gUnknown_020249B4[2] = {NULL}; // const rom data #include "data/battle_moves.h" @@ -5750,7 +5750,7 @@ u8 GetTrainerEncounterMusicId(u16 trainerOpponentId) u16 ModifyStatByNature(u8 nature, u16 n, u8 statIndex) { u16 retVal; - // Dont modify HP, Accuracy, or Evasion by nature + // Don't modify HP, Accuracy, or Evasion by nature if (statIndex <= STAT_HP || statIndex > NUM_NATURE_STATS) { return n; @@ -6811,8 +6811,6 @@ static bool8 ShouldSkipFriendshipChange(void) return FALSE; } -#define MAGIC_NUMBER 0xA3 - static void sub_806F160(struct Unknown_806F160_Struct* structPtr) { u16 i, j; @@ -6861,7 +6859,7 @@ struct Unknown_806F160_Struct *sub_806F2AC(u8 id, u8 arg1) structPtr->field_0_0 = 7; structPtr->field_0_1 = 7; structPtr->field_1 = 4; - structPtr->size = 1; + structPtr->field_3_0 = 1; structPtr->field_3_1 = 2; break; case 0: @@ -6869,12 +6867,12 @@ struct Unknown_806F160_Struct *sub_806F2AC(u8 id, u8 arg1) structPtr->field_0_0 = 4; structPtr->field_0_1 = 4; structPtr->field_1 = 4; - structPtr->size = 1; + structPtr->field_3_0 = 1; structPtr->field_3_1 = 0; break; } - structPtr->bytes = AllocZeroed(structPtr->size * 0x800 * 4 * structPtr->field_0_0); + structPtr->bytes = AllocZeroed(structPtr->field_3_0 * 0x800 * 4 * structPtr->field_0_0); structPtr->byteArrays = AllocZeroed(structPtr->field_0_0 * 32); if (structPtr->bytes == NULL || structPtr->byteArrays == NULL) { @@ -6883,7 +6881,7 @@ struct Unknown_806F160_Struct *sub_806F2AC(u8 id, u8 arg1) else { for (i = 0; i < structPtr->field_0_0; i++) - structPtr->byteArrays[i] = structPtr->bytes + (structPtr->size * (i << 0xD)); + structPtr->byteArrays[i] = structPtr->bytes + (structPtr->field_3_0 * (i << 0xD)); } structPtr->templates = AllocZeroed(sizeof(struct SpriteTemplate) * structPtr->field_0_0); @@ -6902,8 +6900,8 @@ struct Unknown_806F160_Struct *sub_806F2AC(u8 id, u8 arg1) case 2: sub_806F1FC(structPtr); break; - case 1: case 0: + case 1: default: sub_806F160(structPtr); break; @@ -6932,7 +6930,7 @@ struct Unknown_806F160_Struct *sub_806F2AC(u8 id, u8 arg1) } else { - structPtr->magic = MAGIC_NUMBER; + structPtr->magic = 0xA3; gUnknown_020249B4[id] = structPtr; } @@ -6943,12 +6941,12 @@ void sub_806F47C(u8 id) { struct Unknown_806F160_Struct *structPtr; - id &= 1; + id %= 2; structPtr = gUnknown_020249B4[id]; if (structPtr == NULL) return; - if (structPtr->magic != MAGIC_NUMBER) + if (structPtr->magic != 0xA3) { memset(structPtr, 0, sizeof(struct Unknown_806F160_Struct)); } @@ -6972,13 +6970,15 @@ void sub_806F47C(u8 id) u8 *sub_806F4F8(u8 id, u8 arg1) { struct Unknown_806F160_Struct *structPtr = gUnknown_020249B4[id % 2]; - if (structPtr->magic != MAGIC_NUMBER) + if (structPtr->magic != 0xA3) { return NULL; } - - if (arg1 >= structPtr->field_0_0) - arg1 = 0; + else + { + if (arg1 >= structPtr->field_0_0) + arg1 = 0; - return structPtr->byteArrays[arg1]; + return structPtr->byteArrays[arg1]; + } } |