Pret Merge, 2024-11-29 (#5736)

This commit is contained in:
Bassoonian 2024-11-29 16:21:58 +01:00 committed by GitHub
commit cc05187ab1
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
4 changed files with 48 additions and 17 deletions

View file

@ -478,6 +478,7 @@ libagbsyscall:
@$(MAKE) -C libagbsyscall TOOLCHAIN=$(TOOLCHAIN) MODERN=$(MODERN)
# 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 ../../$@ <objs> <libs> | cat"

View file

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

View file

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

View file

@ -4970,16 +4970,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;
@ -5021,16 +5030,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);
}
}