Follow up to #4579: wrong naming (#4591)

This commit is contained in:
Alex 2024-05-18 17:05:25 +02:00 committed by GitHub
parent 4b221b5802
commit 1d83ce430c
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
6 changed files with 735 additions and 735 deletions

View file

@ -23,7 +23,7 @@ struct Item
u8 type;
u8 battleUsage;
u8 flingPower;
const u32 *iconSprite;
const u32 *iconPic;
const u32 *iconPalette;
};

View file

@ -11,7 +11,7 @@ void FreeItemIconTemporaryBuffers(void);
void CopyItemIconPicTo4x4Buffer(const void *src, void *dest);
u8 AddItemIconSprite(u16 tilesTag, u16 paletteTag, u16 itemId);
u8 AddCustomItemIconSprite(const struct SpriteTemplate *customSpriteTemplate, u16 tilesTag, u16 paletteTag, u16 itemId);
const void *GetItemIconSprite(u16 itemId);
const void *GetItemIconPic(u16 itemId);
const void *GetItemIconPalette(u16 itemId);
#endif //GUARD_ITEM_ICON_H

View file

@ -16,8 +16,8 @@ icon_table_pattern = re.compile(r'\[(ITEM_[A-Z_0-9]+)\]\s*=\s*\{([^,]+),\s*([^}]
icon_table_data = {}
for match in icon_table_pattern.findall(icon_table_content):
if len(match) == 3:
item_name, icon_sprite, icon_palette = match
icon_table_data[item_name] = (icon_sprite, icon_palette)
item_name, icon_pic, icon_palette = match
icon_table_data[item_name] = (icon_pic, icon_palette)
# Read items.h content
for file in glob.glob('./src/data/items.h'):
@ -29,9 +29,9 @@ def add_icon_data(match):
item_name = match.group(1)
item_content = match.group(2)
if item_name in icon_table_data:
icon_sprite, icon_palette = icon_table_data[item_name]
print(f"Updating {item_name}: adding iconSprite = {icon_sprite}, iconPalette = {icon_palette}")
return f'[{item_name}] =\n {{{item_content} .iconSprite = {icon_sprite},\n .iconPalette = {icon_palette},\n }},'
icon_pic, icon_palette = icon_table_data[item_name]
print(f"Updating {item_name}: adding iconPic = {icon_pic}, iconPalette = {icon_palette}")
return f'[{item_name}] =\n {{{item_content} .iconPic = {icon_pic},\n .iconPalette = {icon_palette},\n }},'
else:
return match.group(0)
@ -42,4 +42,4 @@ modified_items_content = item_pattern.sub(add_icon_data, items_content)
for file in glob.glob('./src/data/items.h'):
with open(file, 'w') as f:
f.write(modified_items_content)
print("items.h has been updated")
print("items.h has been updated")

File diff suppressed because it is too large Load diff

View file

@ -98,7 +98,7 @@ u8 AddItemIconSprite(u16 tilesTag, u16 paletteTag, u16 itemId)
struct CompressedSpritePalette spritePalette;
struct SpriteTemplate *spriteTemplate;
LZDecompressWram(GetItemIconSprite(itemId), gItemIconDecompressionBuffer);
LZDecompressWram(GetItemIconPic(itemId), gItemIconDecompressionBuffer);
CopyItemIconPicTo4x4Buffer(gItemIconDecompressionBuffer, gItemIcon4x4Buffer);
spriteSheet.data = gItemIcon4x4Buffer;
spriteSheet.size = 0x200;
@ -135,7 +135,7 @@ u8 AddCustomItemIconSprite(const struct SpriteTemplate *customSpriteTemplate, u1
struct CompressedSpritePalette spritePalette;
struct SpriteTemplate *spriteTemplate;
LZDecompressWram(GetItemIconSprite(itemId), gItemIconDecompressionBuffer);
LZDecompressWram(GetItemIconPic(itemId), gItemIconDecompressionBuffer);
CopyItemIconPicTo4x4Buffer(gItemIconDecompressionBuffer, gItemIcon4x4Buffer);
spriteSheet.data = gItemIcon4x4Buffer;
spriteSheet.size = 0x200;
@ -159,12 +159,12 @@ u8 AddCustomItemIconSprite(const struct SpriteTemplate *customSpriteTemplate, u1
}
}
const void *GetItemIconSprite(u16 itemId)
const void *GetItemIconPic(u16 itemId)
{
if (itemId == ITEM_LIST_END)
return gItemIcon_ReturnToFieldArrow; // Use last icon, the "return to field" arrow
if (itemId >= ITEMS_COUNT)
return gItemsInfo[0].iconSprite;
return gItemsInfo[0].iconPic;
if (itemId >= ITEM_TM01 && itemId < ITEM_HM01 + NUM_HIDDEN_MACHINES)
{
if (itemId < ITEM_TM01 + NUM_TECHNICAL_MACHINES)
@ -172,7 +172,7 @@ const void *GetItemIconSprite(u16 itemId)
return gItemIcon_HM;
}
return gItemsInfo[itemId].iconSprite;
return gItemsInfo[itemId].iconPic;
}
const void *GetItemIconPalette(u16 itemId)

View file

@ -8878,7 +8878,7 @@ static void TryLoadItemIconAtPos(u8 cursorArea, u8 cursorPos)
if (heldItem != ITEM_NONE)
{
const u32 *tiles = GetItemIconSprite(heldItem);
const u32 *tiles = GetItemIconPic(heldItem);
const u32 *pal = GetItemIconPalette(heldItem);
u8 id = GetNewItemIconIdx();
@ -8933,7 +8933,7 @@ static void TakeItemFromMon(u8 cursorArea, u8 cursorPos)
static void InitItemIconInCursor(u16 itemId)
{
const u32 *tiles = GetItemIconSprite(itemId);
const u32 *tiles = GetItemIconPic(itemId);
const u32 *pal = GetItemIconPalette(itemId);
u8 id = GetNewItemIconIdx();
LoadItemIconGfx(id, tiles, pal);