Fixed bug where selling items freed sprite palettes too early.

This commit is contained in:
Ariel Antonitis 2021-06-15 18:05:38 -04:00
parent 3568c2a882
commit 9a6f6212b2
3 changed files with 16 additions and 6 deletions

View file

@ -280,6 +280,11 @@ ifeq ($(DINFO),1)
override CFLAGS += -g
endif
ifeq ($(DDEBUG),1)
override ASFLAGS += --defsym DEBUG=1
override CPPFLAGS += -D DEBUG=1
endif
$(C_BUILDDIR)/%.o : $(C_SUBDIR)/%.c $$(c_dep)
@$(CPP) $(CPPFLAGS) $< -o $(C_BUILDDIR)/$*.i
@$(PREPROC) $(C_BUILDDIR)/$*.i charmap.txt | $(CC1) $(CFLAGS) -o $(C_BUILDDIR)/$*.s

View file

@ -1673,11 +1673,16 @@ u16 GetSpritePaletteTagByPaletteNum(u8 paletteNum)
void FreeSpritePaletteByTag(u16 tag)
{
u8 index = IndexOfSpritePaletteTag(tag);
u16 emptyPalette[16] = {0};
if (index != 0xFF) {
sSpritePaletteTags[index] = 0xFFFF;
LoadPalette(emptyPalette, index * 16 + 0x100, 32); // TODO: For debugging only
}
#if DEBUG
u16 emptyPalette[16] = {0};
if (index != 0xFF) {
sSpritePaletteTags[index] = 0xFFFF;
LoadPalette(emptyPalette, index * 16 + 0x100, 32);
}
#else
if (index != 0xFF)
sSpritePaletteTags[index] = 0xFFFF;
#endif
}
void SetSubspriteTables(struct Sprite *sprite, const struct SubspriteTable *subspriteTables)

View file

@ -11,5 +11,5 @@ set -x
git push build --force
# `nproc` must be escaped so that it executes on the remote machine
ssh $remote_host "cd $remote_path && git reset --hard && git checkout $git_branch && \
echo \"Using \`nproc\` job(s)\" && make -j\`nproc\`"
echo \"Using \`nproc\` job(s)\" && make DDEBUG=1 -j\`nproc\`"
scp "$remote_host:$remote_path/pokeemerald.gba" romhack.gba