Up to sub 0x80ce580

This commit is contained in:
DizzyEggg
2018-12-15 23:58:47 +01:00
parent 59a69eb627
commit f1421d94c3
29 changed files with 2776 additions and 7355 deletions

View File

@@ -1613,7 +1613,7 @@ static void sub_81A8830(void)
static bool8 CanEncounterWildMon(u8 enemyMonLevel)
{
if (!GetMonData(&gPlayerParty[0], MON_DATA_SANITY_BIT3))
if (!GetMonData(&gPlayerParty[0], MON_DATA_SANITY_IS_EGG))
{
u8 monAbility = GetMonAbility(&gPlayerParty[0]);
if (monAbility == ABILITY_KEEN_EYE || monAbility == ABILITY_INTIMIDATE)

View File

@@ -901,7 +901,7 @@ static bool8 _DoEggActions_CheckHatch(struct DayCare *daycare)
for (i = 0; i < DAYCARE_MON_COUNT; i++)
{
if (GetBoxMonData(&daycare->mons[i].mon, MON_DATA_SANITY_BIT2))
if (GetBoxMonData(&daycare->mons[i].mon, MON_DATA_SANITY_HAS_SPECIES))
daycare->mons[i].steps++, validEggs++;
}
@@ -922,7 +922,7 @@ static bool8 _DoEggActions_CheckHatch(struct DayCare *daycare)
{
if (!GetMonData(&gPlayerParty[i], MON_DATA_IS_EGG))
continue;
if (GetMonData(&gPlayerParty[i], MON_DATA_SANITY_BIT1))
if (GetMonData(&gPlayerParty[i], MON_DATA_SANITY_IS_BAD_EGG))
continue;
steps = GetMonData(&gPlayerParty[i], MON_DATA_FRIENDSHIP);

View File

@@ -876,7 +876,7 @@ u8 GetEggStepsToSubtract(void)
u8 count, i;
for (count = CalculatePlayerPartyCount(), i = 0; i < count; i++)
{
if (!GetMonData(&gPlayerParty[i], MON_DATA_SANITY_BIT3))
if (!GetMonData(&gPlayerParty[i], MON_DATA_SANITY_IS_EGG))
{
u8 ability = GetMonAbility(&gPlayerParty[i]);
if (ability == ABILITY_MAGMA_ARMOR || ability == ABILITY_FLAME_BODY)

View File

@@ -1845,7 +1845,7 @@ static bool8 Fishing6(struct Task *task)
}
else
{
if (!GetMonData(&gPlayerParty[0], MON_DATA_SANITY_BIT3))
if (!GetMonData(&gPlayerParty[0], MON_DATA_SANITY_IS_EGG))
{
u8 ability = GetMonAbility(&gPlayerParty[0]);
if (ability == ABILITY_SUCTION_CUPS || ability == ABILITY_STICKY_HOLD)

View File

@@ -122,7 +122,7 @@ s32 DoPoisonFieldEffect(void)
u32 numFainted = 0;
for (i = 0; i < PARTY_SIZE; i++)
{
if (GetMonData(pokemon, MON_DATA_SANITY_BIT2) && pokemon_ailments_get_primary(GetMonData(pokemon, MON_DATA_STATUS)) == AILMENT_PSN)
if (GetMonData(pokemon, MON_DATA_SANITY_HAS_SPECIES) && pokemon_ailments_get_primary(GetMonData(pokemon, MON_DATA_STATUS)) == AILMENT_PSN)
{
hp = GetMonData(pokemon, MON_DATA_HP);
if (hp == 0 || --hp == 0)

View File

@@ -1266,7 +1266,7 @@ void IsGrassTypeInParty(void)
for (i = 0; i < PARTY_SIZE; i++)
{
pokemon = &gPlayerParty[i];
if (GetMonData(pokemon, MON_DATA_SANITY_BIT2) && !GetMonData(pokemon, MON_DATA_IS_EGG))
if (GetMonData(pokemon, MON_DATA_SANITY_HAS_SPECIES) && !GetMonData(pokemon, MON_DATA_IS_EGG))
{
species = GetMonData(pokemon, MON_DATA_SPECIES);
if (gBaseStats[species].type1 == TYPE_GRASS || gBaseStats[species].type2 == TYPE_GRASS)
@@ -1658,7 +1658,7 @@ bool8 sub_813990C(void)
for (i = 0; i < partyCount; i++)
{
if (GetMonData(&gPlayerParty[i], MON_DATA_SANITY_BIT1) == 1)
if (GetMonData(&gPlayerParty[i], MON_DATA_SANITY_IS_BAD_EGG) == 1)
return TRUE;
}

View File

@@ -1797,9 +1797,9 @@ bool8 free_temp_tile_data_buffers_if_possible(void)
}
}
void *decompress_and_copy_tile_data_to_vram(u8 bgId, const void *src, int size, u16 offset, u8 mode)
void *decompress_and_copy_tile_data_to_vram(u8 bgId, const void *src, u32 size, u16 offset, u8 mode)
{
int sizeOut;
u32 sizeOut;
if (gUnknown_0203CDA8 < ARRAY_COUNT(gUnknown_0203CDAC))
{
void *ptr = malloc_and_decompress(src, &sizeOut);
@@ -1815,9 +1815,9 @@ void *decompress_and_copy_tile_data_to_vram(u8 bgId, const void *src, int size,
return NULL;
}
void DecompressAndLoadBgGfxUsingHeap(u8 bgId, const void *src, int size, u16 offset, u8 mode)
void DecompressAndLoadBgGfxUsingHeap(u8 bgId, const void *src, u32 size, u16 offset, u8 mode)
{
int sizeOut;
u32 sizeOut;
void *ptr = malloc_and_decompress(src, &sizeOut);
if (!size)
size = sizeOut;
@@ -1838,7 +1838,7 @@ void task_free_buf_after_copying_tile_data_to_vram(u8 taskId)
}
}
void *malloc_and_decompress(const void *src, int *size)
void *malloc_and_decompress(const void *src, u32 *size)
{
void *ptr;
u8 *sizeAsBytes = (u8 *)size;

View File

@@ -1342,7 +1342,7 @@ void UpdateAmbientCry(s16 *state, u16 *delayCounter)
monsCount = CalculatePlayerPartyCount();
for (i = 0; i < monsCount; i++)
{
if (!GetMonData(&gPlayerParty[i], MON_DATA_SANITY_BIT3)
if (!GetMonData(&gPlayerParty[i], MON_DATA_SANITY_IS_EGG)
&& GetMonAbility(&gPlayerParty[0]) == ABILITY_SWARM)
{
divBy = 2;

View File

@@ -4097,13 +4097,13 @@ u32 GetBoxMonData(struct BoxPokemon *boxMon, s32 field, u8 *data)
case MON_DATA_LANGUAGE:
retVal = boxMon->language;
break;
case MON_DATA_SANITY_BIT1:
case MON_DATA_SANITY_IS_BAD_EGG:
retVal = boxMon->isBadEgg;
break;
case MON_DATA_SANITY_BIT2:
case MON_DATA_SANITY_HAS_SPECIES:
retVal = boxMon->hasSpecies;
break;
case MON_DATA_SANITY_BIT3:
case MON_DATA_SANITY_IS_EGG:
retVal = boxMon->isEgg;
break;
case MON_DATA_OT_NAME:
@@ -4304,7 +4304,7 @@ u32 GetBoxMonData(struct BoxPokemon *boxMon, s32 field, u8 *data)
u16 *moves = (u16 *)data;
s32 i = 0;
while (moves[i] != 355)
while (moves[i] != MOVES_COUNT)
{
u16 move = moves[i];
if (substruct1->moves[0] == move
@@ -4466,13 +4466,13 @@ void SetBoxMonData(struct BoxPokemon *boxMon, s32 field, const void *dataArg)
case MON_DATA_LANGUAGE:
SET8(boxMon->language);
break;
case MON_DATA_SANITY_BIT1:
case MON_DATA_SANITY_IS_BAD_EGG:
SET8(boxMon->isBadEgg);
break;
case MON_DATA_SANITY_BIT2:
case MON_DATA_SANITY_HAS_SPECIES:
SET8(boxMon->hasSpecies);
break;
case MON_DATA_SANITY_BIT3:
case MON_DATA_SANITY_IS_EGG:
SET8(boxMon->isEgg);
break;
case MON_DATA_OT_NAME:
@@ -4897,7 +4897,7 @@ bool8 IsPokemonStorageFull(void)
for (i = 0; i < 14; i++)
for (j = 0; j < 30; j++)
if (GetBoxMonDataFromAnyBox(i, j, MON_DATA_SPECIES) == SPECIES_NONE)
if (GetBoxMonDataAt(i, j, MON_DATA_SPECIES) == SPECIES_NONE)
return FALSE;
return TRUE;
@@ -6859,7 +6859,7 @@ void SetWildMonHeldItem(void)
u16 species = GetMonData(&gEnemyParty[0], MON_DATA_SPECIES, 0);
u16 var1 = 45;
u16 var2 = 95;
if (!GetMonData(&gPlayerParty[0], MON_DATA_SANITY_BIT3, 0)
if (!GetMonData(&gPlayerParty[0], MON_DATA_SANITY_IS_EGG, 0)
&& GetMonAbility(&gPlayerParty[0]) == ABILITY_COMPOUND_EYES)
{
var1 = 20;

View File

@@ -1076,7 +1076,7 @@ u8 sub_80D2D78(u16 species, void (*callback)(struct Sprite *), s16 x, s16 y, u8
return spriteId;
}
u16 mon_icon_convert_unown_species_id(u16 species, u32 personality)
u16 GetIconSpecies(u16 species, u32 personality)
{
u16 result;
@@ -1104,7 +1104,8 @@ u16 GetUnownLetterByPersonality(u32 personality)
{
if (!personality)
return 0;
return (((personality & 0x3000000) >> 18) | ((personality & 0x30000) >> 12) | ((personality & 0x300) >> 6) | (personality & 0x3)) % 0x1C;
else
return (((personality & 0x3000000) >> 18) | ((personality & 0x30000) >> 12) | ((personality & 0x300) >> 6) | (personality & 0x3)) % 0x1C;
}
u16 sub_80D2E84(u16 species)
@@ -1121,19 +1122,17 @@ u16 sub_80D2E84(u16 species)
}
else
{
if(species > (SPECIES_UNOWN_B - 1))
if (species > (SPECIES_UNOWN_B - 1))
species = 260;
return mon_icon_convert_unown_species_id(species, 0);
return GetIconSpecies(species, 0);
}
}
const u8 *GetMonIconPtr(u16 species, u32 personality, bool32 extra)
{
return GetMonIconTiles(mon_icon_convert_unown_species_id(species, personality), extra);
return GetMonIconTiles(GetIconSpecies(species, personality), extra);
}
void sub_80D2EF8(struct Sprite *sprite)
{
sub_80D328C(sprite);

View File

@@ -210,7 +210,7 @@ void GiveGiftRibbonToParty(u8 index, u8 ribbonId)
{
struct Pokemon *mon = &gPlayerParty[i];
if (GetMonData(mon, MON_DATA_SPECIES) != 0 && GetMonData(mon, MON_DATA_SANITY_BIT3) == 0)
if (GetMonData(mon, MON_DATA_SPECIES) != 0 && GetMonData(mon, MON_DATA_SANITY_IS_EGG) == 0)
{
SetMonData(mon, array[index], &data);
gotRibbon = TRUE;

File diff suppressed because it is too large Load Diff

View File

@@ -1310,7 +1310,7 @@ static bool8 ExtractMonDataToSummaryStruct(struct Pokemon *a)
sum->altAbility = GetMonData(a, MON_DATA_ALT_ABILITY);
sum->item = GetMonData(a, MON_DATA_HELD_ITEM);
sum->pid = GetMonData(a, MON_DATA_PERSONALITY);
sum->sanity = GetMonData(a, MON_DATA_SANITY_BIT1);
sum->sanity = GetMonData(a, MON_DATA_SANITY_IS_BAD_EGG);
if (sum->sanity)
sum->isEgg = TRUE;

View File

@@ -50,8 +50,8 @@ int GameClear(void)
ribbonCounts[i].partyIndex = i;
ribbonCounts[i].count = 0;
if (GetMonData(mon, MON_DATA_SANITY_BIT2)
&& !GetMonData(mon, MON_DATA_SANITY_BIT3)
if (GetMonData(mon, MON_DATA_SANITY_HAS_SPECIES)
&& !GetMonData(mon, MON_DATA_SANITY_IS_EGG)
&& !GetMonData(mon, MON_DATA_CHAMPION_RIBBON))
{
u8 val[1] = {TRUE};

View File

@@ -1858,7 +1858,7 @@ u32 (*GetFontWidthFunc(u8 glyphId))(u16, bool32)
return NULL;
}
u32 GetStringWidth(u8 fontId, const u8 *str, s16 letterSpacing)
s32 GetStringWidth(u8 fontId, const u8 *str, s16 letterSpacing)
{
bool8 isJapanese;
int minGlyphWidth;
@@ -1868,7 +1868,7 @@ u32 GetStringWidth(u8 fontId, const u8 *str, s16 letterSpacing)
u32 lineWidth;
const u8 *bufferPointer;
int glyphWidth;
u32 width;
s32 width;
isJapanese = 0;
minGlyphWidth = 0;
@@ -2028,7 +2028,8 @@ u32 GetStringWidth(u8 fontId, const u8 *str, s16 letterSpacing)
if (lineWidth > width)
return lineWidth;
return width;
else
return width;
}
u8 RenderTextFont9(u8 *pixels, u8 fontId, u8 *str)

View File

@@ -4802,7 +4802,7 @@ static u8 ChooseWildMonLevel(const struct WildPokemon *wildPokemon)
rand = Random() % range;
// check ability for max level mon
if (!GetMonData(&gPlayerParty[0], MON_DATA_SANITY_BIT3))
if (!GetMonData(&gPlayerParty[0], MON_DATA_SANITY_IS_EGG))
{
u8 ability = GetMonAbility(&gPlayerParty[0]);
if (ability == ABILITY_HUSTLE || ability == ABILITY_VITAL_SPIRIT || ability == ABILITY_PRESSURE)
@@ -4883,7 +4883,7 @@ static u8 PickWildMonNature(void)
}
}
// check synchronize for a pokemon with the same ability
if (!GetMonData(&gPlayerParty[0], MON_DATA_SANITY_BIT3)
if (!GetMonData(&gPlayerParty[0], MON_DATA_SANITY_IS_EGG)
&& GetMonAbility(&gPlayerParty[0]) == ABILITY_SYNCHRONIZE
&& Random() % 2 == 0)
{
@@ -4911,7 +4911,7 @@ static void CreateWildMon(u16 species, u8 level)
}
if (checkCuteCharm
&& !GetMonData(&gPlayerParty[0], MON_DATA_SANITY_BIT3)
&& !GetMonData(&gPlayerParty[0], MON_DATA_SANITY_IS_EGG)
&& GetMonAbility(&gPlayerParty[0]) == ABILITY_CUTE_CHARM
&& Random() % 3 != 0)
{
@@ -5029,7 +5029,7 @@ static bool8 DoWildEncounterRateTest(u32 encounterRate, bool8 ignoreAbility)
encounterRate = encounterRate * 80 / 100;
ApplyFluteEncounterRateMod(&encounterRate);
ApplyCleanseTagEncounterRateMod(&encounterRate);
if (!ignoreAbility && !GetMonData(&gPlayerParty[0], MON_DATA_SANITY_BIT3))
if (!ignoreAbility && !GetMonData(&gPlayerParty[0], MON_DATA_SANITY_IS_EGG))
{
u32 ability = GetMonAbility(&gPlayerParty[0]);
@@ -5419,7 +5419,7 @@ static bool8 IsAbilityAllowingEncounter(u8 level)
{
u8 ability;
if (GetMonData(&gPlayerParty[0], MON_DATA_SANITY_BIT3))
if (GetMonData(&gPlayerParty[0], MON_DATA_SANITY_IS_EGG))
return TRUE;
ability = GetMonAbility(&gPlayerParty[0]);
@@ -5456,7 +5456,7 @@ static bool8 TryGetRandomWildMonIndexByType(const struct WildPokemon *wildMon, u
static bool8 TryGetAbilityInfluencedWildMonIndex(const struct WildPokemon *wildMon, u8 type, u8 ability, u8 *monIndex)
{
if (GetMonData(&gPlayerParty[0], MON_DATA_SANITY_BIT3))
if (GetMonData(&gPlayerParty[0], MON_DATA_SANITY_IS_EGG))
return FALSE;
else if (GetMonAbility(&gPlayerParty[0]) != ability)
return FALSE;