diff options
Diffstat (limited to 'src')
-rw-r--r-- | src/data.c | 5 | ||||
-rw-r--r-- | src/data/graphics/trainers.h | 8 | ||||
-rw-r--r-- | src/data/trainer_graphics/back_pic_tables.h | 20 | ||||
-rw-r--r-- | src/data/trainer_graphics/front_pic_tables.h | 4 | ||||
-rw-r--r-- | src/daycare.c | 14 | ||||
-rw-r--r-- | src/menu.c | 43 |
6 files changed, 50 insertions, 44 deletions
diff --git a/src/data.c b/src/data.c index 29d1835ac..4861da18b 100644 --- a/src/data.c +++ b/src/data.c @@ -295,11 +295,6 @@ const union AnimCmd *const gUnknown_082FF70C[] = #define SPECIES_PAL(species, pal) [SPECIES_##species] = {pal, SPECIES_##species} #define SPECIES_SHINY_PAL(species, pal) [SPECIES_##species] = {pal, SPECIES_##species + SPECIES_SHINY_TAG} -#define TRAINER_SPRITE(trainerPic, sprite, size) [TRAINER_PIC_##trainerPic] = {sprite, size, TRAINER_PIC_##trainerPic} -#define TRAINER_PAL(trainerPic, pal) [TRAINER_PIC_##trainerPic] = {pal, TRAINER_PIC_##trainerPic} - -#define TRAINER_BACK_PAL(trainerPic, pal) [TRAINER_BACK_PIC_##trainerPic] = {pal, TRAINER_BACK_PIC_##trainerPic} - #include "data/pokemon_graphics/unknown_anims.h" #include "data/pokemon_graphics/front_pic_coordinates.h" #include "data/pokemon_graphics/still_front_pic_table.h" diff --git a/src/data/graphics/trainers.h b/src/data/graphics/trainers.h index 3de77d6ec..206d73a88 100644 --- a/src/data/graphics/trainers.h +++ b/src/data/graphics/trainers.h @@ -7,8 +7,8 @@ const u32 gTrainerPalette_AquaGruntM[] = INCBIN_U32("graphics/trainers/palettes/ const u32 gTrainerFrontPic_PokemonBreederF[] = INCBIN_U32("graphics/trainers/front_pics/pokemon_breeder_f_front_pic.4bpp.lz"); const u32 gTrainerPalette_PokemonBreederF[] = INCBIN_U32("graphics/trainers/palettes/pokemon_breeder_f.gbapal.lz"); -const u32 gTrainerFrontPic_CoolTrainerM[] = INCBIN_U32("graphics/trainers/front_pics/cool_trainer_m_front_pic.4bpp.lz"); -const u32 gTrainerPalette_CoolTrainerM[] = INCBIN_U32("graphics/trainers/palettes/cool_trainer_m.gbapal.lz"); +const u32 gTrainerFrontPic_CoolTrainerM[] = INCBIN_U32("graphics/trainers/front_pics/cooltrainer_m_front_pic.4bpp.lz"); +const u32 gTrainerPalette_CoolTrainerM[] = INCBIN_U32("graphics/trainers/palettes/cooltrainer_m.gbapal.lz"); const u32 gTrainerFrontPic_BirdKeeper[] = INCBIN_U32("graphics/trainers/front_pics/bird_keeper_front_pic.4bpp.lz"); const u32 gTrainerPalette_BirdKeeper[] = INCBIN_U32("graphics/trainers/palettes/bird_keeper.gbapal.lz"); @@ -58,8 +58,8 @@ const u32 gTrainerPalette_TuberF[] = INCBIN_U32("graphics/trainers/palettes/tube const u32 gTrainerFrontPic_TuberM[] = INCBIN_U32("graphics/trainers/front_pics/tuber_m_front_pic.4bpp.lz"); const u32 gTrainerPalette_TuberM[] = INCBIN_U32("graphics/trainers/palettes/tuber_m.gbapal.lz"); -const u32 gTrainerFrontPic_CoolTrainerF[] = INCBIN_U32("graphics/trainers/front_pics/cool_trainer_f_front_pic.4bpp.lz"); -const u32 gTrainerPalette_CoolTrainerF[] = INCBIN_U32("graphics/trainers/palettes/cool_trainer_f.gbapal.lz"); +const u32 gTrainerFrontPic_CoolTrainerF[] = INCBIN_U32("graphics/trainers/front_pics/cooltrainer_f_front_pic.4bpp.lz"); +const u32 gTrainerPalette_CoolTrainerF[] = INCBIN_U32("graphics/trainers/palettes/cooltrainer_f.gbapal.lz"); const u32 gTrainerFrontPic_Lady[] = INCBIN_U32("graphics/trainers/front_pics/lady_front_pic.4bpp.lz"); const u32 gTrainerPalette_Lady[] = INCBIN_U32("graphics/trainers/palettes/lady.gbapal.lz"); diff --git a/src/data/trainer_graphics/back_pic_tables.h b/src/data/trainer_graphics/back_pic_tables.h index 86efd7905..1dbffba42 100644 --- a/src/data/trainer_graphics/back_pic_tables.h +++ b/src/data/trainer_graphics/back_pic_tables.h @@ -13,18 +13,22 @@ const struct MonCoords gTrainerBackPicCoords[] = // this table goes functionally unused, since none of these pics are compressed // and the place they would get extracted to gets overwritten later anyway // the casts are so they'll play nice with the strict struct definition +#define TRAINER_BACK_SPRITE(trainerPic, sprite, size) [TRAINER_BACK_PIC_##trainerPic] = {(const u32 *)sprite, size, TRAINER_BACK_PIC_##trainerPic} + const struct CompressedSpriteSheet gTrainerBackPicTable[] = { - (const u32 *)gTrainerBackPic_Brendan, 0x2000, TRAINER_BACK_PIC_BRENDAN, - (const u32 *)gTrainerBackPic_May, 0x2000, TRAINER_BACK_PIC_MAY, - (const u32 *)gTrainerBackPic_Red, 0x2800, TRAINER_BACK_PIC_RED, - (const u32 *)gTrainerBackPic_Leaf, 0x2800, TRAINER_BACK_PIC_LEAF, - (const u32 *)gTrainerBackPic_RubySapphireBrendan, 0x2000, TRAINER_BACK_PIC_RUBY_SAPPHIRE_BRENDAN, - (const u32 *)gTrainerBackPic_RubySapphireMay, 0x2000, TRAINER_BACK_PIC_RUBY_SAPPHIRE_MAY, - (const u32 *)gTrainerBackPic_Wally, 0x2000, TRAINER_BACK_PIC_WALLY, - (const u32 *)gTrainerBackPic_Steven, 0x2000, TRAINER_BACK_PIC_STEVEN, + TRAINER_BACK_SPRITE(BRENDAN, gTrainerBackPic_Brendan, 0x2000), + TRAINER_BACK_SPRITE(MAY, gTrainerBackPic_May, 0x2000), + TRAINER_BACK_SPRITE(RED, gTrainerBackPic_Red, 0x2800), + TRAINER_BACK_SPRITE(LEAF, gTrainerBackPic_Leaf, 0x2800), + TRAINER_BACK_SPRITE(RUBY_SAPPHIRE_BRENDAN, gTrainerBackPic_RubySapphireBrendan, 0x2000), + TRAINER_BACK_SPRITE(RUBY_SAPPHIRE_MAY, gTrainerBackPic_RubySapphireMay, 0x2000), + TRAINER_BACK_SPRITE(WALLY, gTrainerBackPic_Wally, 0x2000), + TRAINER_BACK_SPRITE(STEVEN, gTrainerBackPic_Steven, 0x2000), }; +#define TRAINER_BACK_PAL(trainerPic, pal) [TRAINER_BACK_PIC_##trainerPic] = {pal, TRAINER_BACK_PIC_##trainerPic} + const struct CompressedSpritePalette gTrainerBackPicPaletteTable[] = { TRAINER_BACK_PAL(BRENDAN, gTrainerPalette_Brendan), diff --git a/src/data/trainer_graphics/front_pic_tables.h b/src/data/trainer_graphics/front_pic_tables.h index c3408b4c3..e751f3c1d 100644 --- a/src/data/trainer_graphics/front_pic_tables.h +++ b/src/data/trainer_graphics/front_pic_tables.h @@ -95,6 +95,8 @@ const struct MonCoords gTrainerFrontPicCoords[] = [TRAINER_PIC_RS_MAY] = {.size = 8, .y_offset = 1}, }; +#define TRAINER_SPRITE(trainerPic, sprite, size) [TRAINER_PIC_##trainerPic] = {sprite, size, TRAINER_PIC_##trainerPic} + const struct CompressedSpriteSheet gTrainerFrontPicTable[] = { TRAINER_SPRITE(HIKER, gTrainerFrontPic_Hiker, 0x800), @@ -192,6 +194,8 @@ const struct CompressedSpriteSheet gTrainerFrontPicTable[] = TRAINER_SPRITE(RS_MAY, gTrainerFrontPic_RubySapphireMay, 0x800), }; +#define TRAINER_PAL(trainerPic, pal) [TRAINER_PIC_##trainerPic] = {pal, TRAINER_PIC_##trainerPic} + const struct CompressedSpritePalette gTrainerFrontPicPaletteTable[] = { TRAINER_PAL(HIKER, gTrainerPalette_Hiker), diff --git a/src/daycare.c b/src/daycare.c index fd6ed3a50..d849b39f3 100644 --- a/src/daycare.c +++ b/src/daycare.c @@ -547,13 +547,17 @@ static void InheritIVs(struct Pokemon *egg, struct DayCare *daycare) for (i = 0; i < INHERITED_IV_COUNT; i++) { // Randomly pick an IV from the available list and stop from being chosen again. - selectedIvs[i] = availableIVs[Random() % (NUM_STATS - i)]; - // BUG: Instead of removing the IV that was just picked (like in RS and FRLG), this + // BUG: Instead of removing the IV that was just picked, this // removes position 0 (HP) then position 1 (DEF), then position 2. This is why HP and DEF // have a lower chance to be inherited in Emerald and why the IV picked for inheritance can - // be repeated. Uncomment the inline comment and remove the existing expression to get the - // intended behavior and to match the other Gen 3 games. - RemoveIVIndexFromList(availableIVs, i /*selectedIvs[i]*/); + // be repeated. Amusingly, FRLG and RS also got this wrong. They remove selectedIvs[i], which + // is not an index! This means that it can sometimes remove the wrong stat. To fix, delete + // the following two lines and uncomment the rest of the block. + selectedIvs[i] = availableIVs[Random() % (NUM_STATS - i)]; + RemoveIVIndexFromList(availableIVs, i); + // u8 index = Random() % (NUM_STATS - i); + // selectedIvs[i] = availableIVs[index]; + // RemoveIVIndexFromList(availableIVs, index); } // Determine which parent each of the selected IVs should inherit from. diff --git a/src/menu.c b/src/menu.c index dca8adc2d..4813f7b02 100644 --- a/src/menu.c +++ b/src/menu.c @@ -2016,7 +2016,7 @@ void sub_819A080(const struct Bitmap *src, struct Bitmap *dst, u16 srcX, u16 src { int loopSrcY, loopDstY, loopSrcX, loopDstX, xEnd, yEnd, multiplierSrcY, multiplierDstY; const u8 *pixelsSrc; - u16 *pixelsDst; + u8 *pixelsDst; u16 toOrr; if (dst->width - dstX < width) @@ -2037,53 +2037,52 @@ void sub_819A080(const struct Bitmap *src, struct Bitmap *dst, u16 srcX, u16 src for (loopSrcX = srcX, loopDstX = dstX; loopSrcX < xEnd; loopSrcX++, loopDstX++) { pixelsSrc = src->pixels + ((loopSrcX >> 1) & 3) + ((loopSrcX >> 3) << 5) + (((loopSrcY >> 3) * multiplierSrcY) << 5) + ((u32)(loopSrcY << 0x1d) >> 0x1B); - pixelsDst = (void*) dst->pixels + ((loopDstX >> 1) & 3) + ((loopDstX >> 3) << 5) + ((( loopDstY >> 3) * multiplierDstY) << 5) + ((u32)( loopDstY << 0x1d) >> 0x1B); + pixelsDst = (void*) dst->pixels + ((loopDstX >> 1) & 3) + ((loopDstX >> 3) << 5) + ((( loopDstY >> 3) * multiplierDstY) << 5) + ((u32)(loopDstY << 0x1d) >> 0x1B); - if ((uintptr_t )pixelsDst & 0x1) + if ((uintptr_t)pixelsDst & 0x1) { - pixelsDst = (void*)(pixelsDst) - 1; + pixelsDst--; if (loopDstX & 0x1) { - toOrr = *pixelsDst & 0x0fff; + toOrr = *(vu16*)pixelsDst; + toOrr &= 0x0fff; if (loopSrcX & 0x1) - *pixelsDst = toOrr | ((*pixelsSrc & 0xf0) << 8); + toOrr |= ((*pixelsSrc & 0xf0) << 8); else - *pixelsDst = toOrr | ((*pixelsSrc & 0x0f) << 12); + toOrr |= ((*pixelsSrc & 0x0f) << 12); } else { - toOrr = *pixelsDst & 0xf0ff; + toOrr = *(vu16*)pixelsDst; + toOrr &= 0xf0ff; if (loopSrcX & 0x1) - *pixelsDst = toOrr | ((*pixelsSrc & 0xf0) << 4); + toOrr |= ((*pixelsSrc & 0xf0) << 4); else - *pixelsDst = toOrr | ((*pixelsSrc & 0x0f) << 8); + toOrr |= ((*pixelsSrc & 0x0f) << 8); } } else { if (loopDstX & 1) { - toOrr = *pixelsDst & 0xff0f; + toOrr = *(vu16*)pixelsDst; + toOrr &= 0xff0f; if (loopSrcX & 1) - *pixelsDst = toOrr | ((*pixelsSrc & 0xf0) << 0); + toOrr |= ((*pixelsSrc & 0xf0) << 0); else - *pixelsDst = toOrr | ((*pixelsSrc & 0x0f) << 4); + toOrr |= ((*pixelsSrc & 0x0f) << 4); } else { - toOrr = *pixelsDst & 0xfff0; + toOrr = *(vu16*)pixelsDst; + toOrr &= 0xfff0; if (loopSrcX & 1) - *pixelsDst = toOrr | ((*pixelsSrc & 0xf0) >> 4); + toOrr |= ((*pixelsSrc & 0xf0) >> 4); else - *pixelsDst = toOrr | ((*pixelsSrc & 0x0f) >> 0); + toOrr |= ((*pixelsSrc & 0x0f) >> 0); } } - - // Needed to match, urgh. - #ifndef NONMATCHING - asm("":::"r4"); - pixelsDst++;pixelsDst--; - #endif // NONMATCHING + *(vu16*)pixelsDst = toOrr; } } } |