diff --git a/Makefile b/Makefile index f38b551b0c0b..71d2a48af9a3 100644 --- a/Makefile +++ b/Makefile @@ -438,6 +438,7 @@ libagbsyscall: @$(MAKE) -C libagbsyscall TOOLCHAIN=$(TOOLCHAIN) MODERN=1 # Elf from object files +LDFLAGS = -Map ../../$(MAP) $(ELF): $(LD_SCRIPT) $(LD_SCRIPT_DEPS) $(OBJS) libagbsyscall @cd $(OBJ_DIR) && $(LD) $(LDFLAGS) -T ../../$< --print-memory-usage -o ../../$@ $(OBJS_REL) $(LIB) | cat @echo "cd $(OBJ_DIR) && $(LD) $(LDFLAGS) -T ../../$< --print-memory-usage -o ../../$@ | cat" diff --git a/src/contest.c b/src/contest.c index 16e5fde9afcf..e03d5e8b3b84 100644 --- a/src/contest.c +++ b/src/contest.c @@ -949,23 +949,22 @@ static const struct CompressedSpriteSheet sSpriteSheets_ContestantsTurnBlinkEffe } }; -// Yup this is super dangerous but that's how it is here static const struct SpritePalette sSpritePalettes_ContestantsTurnBlinkEffect[CONTESTANT_COUNT] = { { - .data = (u16 *)(gHeap + 0x1A0A4), + .data = eContestTempSave.cachedWindowPalettes[5], .tag = TAG_BLINK_EFFECT_CONTESTANT0 }, { - .data = (u16 *)(gHeap + 0x1A0C4), + .data = eContestTempSave.cachedWindowPalettes[6], .tag = TAG_BLINK_EFFECT_CONTESTANT1 }, { - .data = (u16 *)(gHeap + 0x1A0E4), + .data = eContestTempSave.cachedWindowPalettes[7], .tag = TAG_BLINK_EFFECT_CONTESTANT2 }, { - .data = (u16 *)(gHeap + 0x1A104), + .data = eContestTempSave.cachedWindowPalettes[8], .tag = TAG_BLINK_EFFECT_CONTESTANT3 } }; diff --git a/src/mini_printf.c b/src/mini_printf.c index c5b1e09bdc56..9332a270a4ed 100644 --- a/src/mini_printf.c +++ b/src/mini_printf.c @@ -86,6 +86,8 @@ static inline char mini_pchar_decode(char encoded) ret = '('; // opening parentheses else if (encoded == CHAR_RIGHT_PAREN) ret = ')'; // closing parentheses + else if (encoded == CHAR_HYPHEN) + ret = '-'; // hyphen return ret; } @@ -133,7 +135,31 @@ static s32 _putsEncoded(char *s, s32 len, void *buf) { break; } - *(b->pbuffer ++) = mini_pchar_decode(s[i]); + if (s[i] == CHAR_NEWLINE) + { + *(b->pbuffer ++) = '\\'; + *(b->pbuffer ++) = 'n'; + } + else if (s[i] == CHAR_PROMPT_SCROLL) + { + *(b->pbuffer ++) = '\\'; + *(b->pbuffer ++) = 'l'; + } + else if (s[i] == CHAR_PROMPT_CLEAR) + { + *(b->pbuffer ++) = '\\'; + *(b->pbuffer ++) = 'p'; + } + else if (s[i] == CHAR_ELLIPSIS) + { + *(b->pbuffer ++) = '.'; + *(b->pbuffer ++) = '.'; + *(b->pbuffer ++) = '.'; + } + else + { + *(b->pbuffer ++) = mini_pchar_decode(s[i]); + } } *(b->pbuffer) = 0; return b->pbuffer - p0; diff --git a/src/pokemon.c b/src/pokemon.c index 9f716e3a7905..a605b43e5080 100644 --- a/src/pokemon.c +++ b/src/pokemon.c @@ -4977,16 +4977,25 @@ u16 HoennToNationalOrder(u16 hoennNum) The function then loops over the 16x16 spot image. For each bit in the spot's binary image, if the bit is set then it's part of the spot; try to draw it. A pixel is drawn on Spinda if the - pixel on Spinda satisfies the following formula: ((u8)(colorIndex - 1) <= 2). The -1 excludes - transparent pixels, as these are index 0. Therefore only colors 1, 2, or 3 on Spinda will - allow a spot to be drawn. These color indexes are Spinda's light brown body colors. To create + pixel is between FIRST_SPOT_COLOR and LAST_SPOT_COLOR (so only colors 1, 2, or 3 on Spinda will + allow a spot to be drawn). These color indexes are Spinda's light brown body colors. To create the spot it adds 4 to the color index, so Spinda's spots will be colors 5, 6, and 7. - The above is done two different ways in the function: one with << 4, and one without. This - is because Spinda's sprite is a 4 bits per pixel image, but the pointer to Spinda's pixels + The above is done in TRY_DRAW_SPOT_PIXEL two different ways: one with << 4, and one without. + This is because Spinda's sprite is a 4 bits per pixel image, but the pointer to Spinda's pixels (destPixels) is an 8 bit pointer, so it addresses two pixels. Shifting by 4 accesses the 2nd of these pixels, so this is done every other time. */ + +// Draw spot pixel if this is Spinda's body color +#define TRY_DRAW_SPOT_PIXEL(pixels, shift) \ + if (((*(pixels) & (0xF << (shift))) >= (FIRST_SPOT_COLOR << (shift))) \ + && ((*(pixels) & (0xF << (shift))) <= (LAST_SPOT_COLOR << (shift)))) \ + { \ + *(pixels) += (SPOT_COLOR_ADJUSTMENT << (shift)); \ + } + + void DrawSpindaSpots(u32 personality, u8 *dest, bool32 isSecondFrame) { s32 i; @@ -5028,16 +5037,12 @@ void DrawSpindaSpots(u32 personality, u8 *dest, bool32 isSecondFrame) if (column & 1) { /* Draw spot pixel if this is Spinda's body color */ - if ((u8)((*destPixels & 0xF0) - (FIRST_SPOT_COLOR << 4)) - <= ((LAST_SPOT_COLOR - FIRST_SPOT_COLOR) << 4)) - *destPixels += (SPOT_COLOR_ADJUSTMENT << 4); + TRY_DRAW_SPOT_PIXEL(destPixels, 4); } else { /* Draw spot pixel if this is Spinda's body color */ - if ((u8)((*destPixels & 0xF) - FIRST_SPOT_COLOR) - <= (LAST_SPOT_COLOR - FIRST_SPOT_COLOR)) - *destPixels += SPOT_COLOR_ADJUSTMENT; + TRY_DRAW_SPOT_PIXEL(destPixels, 0); } }