Skip to content

Commit

Permalink
icons archive generation (#1091)
Browse files Browse the repository at this point in the history
* OK

* broken

* fixed

* misnomer

* fix names, add other versions

* fix stray object file and warnings

* .bin.o

* incorrect asset_deps

* cleanup

---------

Co-authored-by: HailSanta <Hail2Santa@gmail.com>
Co-authored-by: Ethan Roseman <ethteck@gmail.com>
  • Loading branch information
3 people authored Jul 22, 2023
1 parent 53fac51 commit 76386ce
Show file tree
Hide file tree
Showing 28 changed files with 848 additions and 2,400 deletions.
1,230 changes: 0 additions & 1,230 deletions include/icon_offsets.h

This file was deleted.

7 changes: 7 additions & 0 deletions include/item_entity.h
Original file line number Diff line number Diff line change
Expand Up @@ -19,4 +19,11 @@ enum {
#define is_Loop ITEM_SCRIPT_OP_Loop,
#define is_RandomRestart(max, cutoff) ITEM_SCRIPT_OP_RandomRestart, max, cutoff,

#define STANDARD_ITEM_SCRIPT(icon) \
{ \
is_SetIcon(60, icon) \
is_Restart \
is_End \
}

#endif
2 changes: 1 addition & 1 deletion include/variables.h
Original file line number Diff line number Diff line change
Expand Up @@ -99,7 +99,7 @@ extern s32 timeFreezeMode;
extern s32 D_8009A678;

extern u8 D_800779B0;
extern s32 D_8008EEC0[12]; // partner IDs
extern s32 PartnerIDFromMenuIndex[12]; // partner IDs

// Scripts
extern EvtScript EVS_NpcDefeat;
Expand Down
15 changes: 12 additions & 3 deletions src/190B20.c
Original file line number Diff line number Diff line change
Expand Up @@ -24,12 +24,21 @@ f32 D_802938A4 = 0.0f;
s16 D_802938A8 = 4;

EffectInstance* gDamageCountEffects[] = {
NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL,
NULL, NULL, NULL, NULL, NULL,
NULL, NULL, NULL, NULL,
NULL, NULL, NULL, NULL,
NULL, NULL, NULL, NULL,
NULL, NULL, NULL, NULL,
NULL, NULL, NULL, NULL,
NULL, NULL, NULL, NULL,
};

s32 gDamageCountTimers[] = {
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0
0, 0, 0, 0,
0, 0, 0, 0,
0, 0, 0, 0,
0, 0, 0, 0,
0, 0, 0, 0,
0, 0, 0, 0,
};

Gfx D_80293970[] = {
Expand Down
16 changes: 8 additions & 8 deletions src/415D90.c
Original file line number Diff line number Diff line change
Expand Up @@ -2166,7 +2166,7 @@ s32 can_btl_state_update_switch_to_player(void) {
}
}

extern s32 D_8008EEF0[]; // TODO MOVE
extern s32 MenuIndexFromPartnerID[]; // TODO MOVE

s32 func_802A58D0(void) {
BattleStatus* battleStatus = &gBattleStatus;
Expand Down Expand Up @@ -3460,7 +3460,7 @@ void btl_state_update_player_menu(void) {
case BTL_SUBSTATE_PLAYER_MENU_CHANGE_MEMBER_1:
entryIdx = 0;
for (i = 1; i < ARRAY_COUNT(playerData->partners); i++) {
s32 partnerId = D_8008EEC0[i];
s32 partnerId = PartnerIDFromMenuIndex[i];
if (playerData->partners[partnerId].enabled) {
prop = &gPartnerPopupProperties[partnerId];
popup->ptrIcon[entryIdx] = battle_menu_PartnerHudScripts[partnerId];
Expand All @@ -3481,7 +3481,7 @@ void btl_state_update_player_menu(void) {
}
popup->popupType = POPUP_MENU_SWITCH_PARTNER;
popup->numEntries = entryIdx;
popup->initialPos = D_8008EEF0[playerData->currentPartner] - 1;
popup->initialPos = MenuIndexFromPartnerID[playerData->currentPartner] - 1;
popup->dipMode = 0;
popup->titleNumber = 0;
create_battle_popup_menu(popup);
Expand Down Expand Up @@ -4050,8 +4050,8 @@ void btl_state_update_partner_menu(void) {
break;
case BTL_SUBSTATE_PARTNER_MENU_UNUSED_CHANGE_PARTNER_1:
popupIndex = 0;
for (i = 1; i < ARRAY_COUNT(D_8008EEC0); i++) {
s32 partnerId = D_8008EEC0[i];
for (i = 1; i < ARRAY_COUNT(PartnerIDFromMenuIndex); i++) {
s32 partnerId = PartnerIDFromMenuIndex[i];
if (playerData->partners[partnerId].enabled) {
popupProps = &gPartnerPopupProperties[partnerId];
popupMenu->ptrIcon[popupIndex] = battle_menu_PartnerHudScripts[partnerId];
Expand All @@ -4072,7 +4072,7 @@ void btl_state_update_partner_menu(void) {
}
popupMenu->popupType = POPUP_MENU_SWITCH_PARTNER;
popupMenu->numEntries = popupIndex;
popupMenu->initialPos = D_8008EEF0[playerData->currentPartner] - 1;
popupMenu->initialPos = MenuIndexFromPartnerID[playerData->currentPartner] - 1;
popupMenu->dipMode = 0;
popupMenu->titleNumber = 0;
create_battle_popup_menu(popupMenu);
Expand Down Expand Up @@ -4325,7 +4325,7 @@ void btl_state_update_partner_menu(void) {
case BTL_SUBSTATE_PARTNER_MENU_CHANGE_PARTNER_1:
popupIndex = 0;
for (i = 1; i < 12; i++) {
s32 partnerId = D_8008EEC0[i];
s32 partnerId = PartnerIDFromMenuIndex[i];
if (playerData->partners[partnerId].enabled) {
popupProps = &gPartnerPopupProperties[partnerId];
popupMenu->ptrIcon[popupIndex] = battle_menu_PartnerHudScripts[partnerId];
Expand All @@ -4346,7 +4346,7 @@ void btl_state_update_partner_menu(void) {
}
popupMenu->popupType = POPUP_MENU_SWITCH_PARTNER;
popupMenu->numEntries = popupIndex;
popupMenu->initialPos = D_8008EEF0[playerData->currentPartner] - 1;
popupMenu->initialPos = MenuIndexFromPartnerID[playerData->currentPartner] - 1;
popupMenu->dipMode = 0;
popupMenu->titleNumber = 0;
create_battle_popup_menu(popupMenu);
Expand Down
51 changes: 32 additions & 19 deletions src/5B320.c
Original file line number Diff line number Diff line change
Expand Up @@ -170,23 +170,6 @@
#define MSG_PartnerMoveName_SpinyFlip3 MSG_PartnerMoveName_SpinyFlip
#endif

#define STANDARD_ITEM_SCRIPT(icon) \
{ \
is_SetIcon(60, icon) \
is_Restart \
is_End \
}

#define STANDARD_ITEM_HUD_SCRIPT(icon) \
{ \
hs_SetVisible \
hs_SetTileSize(HUD_ELEMENT_SIZE_32x32) \
hs_Loop \
hs_SetIcon(60, icon) \
hs_Restart \
hs_End \
}

HudScript HES_HandPointDownLoop = {
hs_SetVisible
hs_SetTileSize(HUD_ELEMENT_SIZE_24x24)
Expand Down Expand Up @@ -322,9 +305,39 @@ s32 pad_after_item_hudscripts[] = {

#include "item_entity_scripts.inc.c"

s32 D_8008EEC0[] = { 0, 1, 2, 3, 4, 9, 6, 7, 8, 5, 10, 11 };
//TODO split for partner popup menu data?

s32 D_8008EEF0[] = { 0, 1, 2, 3, 4, 0, 6, 7, 8, 5, 0, 0 };
// "change partner" menu position -> partnerID
s32 PartnerIDFromMenuIndex[] = {
PARTNER_NONE,
PARTNER_GOOMBARIO,
PARTNER_KOOPER,
PARTNER_BOMBETTE,
PARTNER_PARAKARRY,
PARTNER_BOW,
PARTNER_WATT,
PARTNER_SUSHIE,
PARTNER_LAKILESTER,
PARTNER_GOOMPA,
PARTNER_GOOMBARIA,
PARTNER_TWINK
};

// partnerID -> "change partner" menu position
s32 MenuIndexFromPartnerID[] = {
[PARTNER_NONE] 0,
[PARTNER_GOOMBARIO] 1,
[PARTNER_KOOPER] 2,
[PARTNER_BOMBETTE] 3,
[PARTNER_PARAKARRY] 4,
[PARTNER_GOOMPA] 0,
[PARTNER_WATT] 6,
[PARTNER_SUSHIE] 7,
[PARTNER_LAKILESTER] 8,
[PARTNER_BOW] 5,
[PARTNER_GOOMBARIA] 0,
[PARTNER_TWINK] 0,
};

PartnerPopupProperties gPartnerPopupProperties[] = {
[PARTNER_NONE] {
Expand Down
8 changes: 4 additions & 4 deletions src/7fd10_len_b40.c
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ BSS char D_8010CD14[0xA];
BSS s32 D_8010CD20;
BSS char D_8010CD24[0xC];

extern s32 D_8008EEF0[];
extern s32 MenuIndexFromPartnerID[];

void func_800E6860(void) {
PlayerStatus* playerStatus = &gPlayerStatus;
Expand Down Expand Up @@ -128,8 +128,8 @@ s32 setup_partner_popup(PopupMenu* menu) {
s32 optionCount = 0;
s32 i;

for (i = 1; i < ARRAY_COUNT(D_8008EEC0); i++) {
s32 partnerID = D_8008EEC0[i];
for (i = 1; i < ARRAY_COUNT(PartnerIDFromMenuIndex); i++) {
s32 partnerID = PartnerIDFromMenuIndex[i];

if (playerData->partners[partnerID].enabled && partnerID != PARTNER_GOOMPA) {
PartnerPopupProperties* properties = &gPartnerPopupProperties[partnerID];
Expand Down Expand Up @@ -251,7 +251,7 @@ void check_input_open_menus(void) {
}
popup->numEntries = numEntries;
popup->popupType = POPUP_MENU_SWITCH_PARTNER;
popup->initialPos = D_8008EEF0[playerData->currentPartner] - 1;
popup->initialPos = MenuIndexFromPartnerID[playerData->currentPartner] - 1;
break;
}
return;
Expand Down
6 changes: 3 additions & 3 deletions src/C50A0.c
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@

#if VERSION_IQUE
// TODO: remove if section is split in iQue release
extern Addr icon_present_ROM_START;
extern Addr icon_ROM_START;
#endif

#define MAX_ITEM_ENTITIES 256
Expand Down Expand Up @@ -807,7 +807,7 @@ void item_entity_load(ItemEntity* item) {
entry->data = &gHudElementCacheBuffer[*gHudElementCacheSize];

ASSERT(*gHudElementCacheSize + size < 0x11000);
nuPiReadRom((s32)icon_present_ROM_START + raster, entry->data, size);
nuPiReadRom((s32)icon_ROM_START + raster, entry->data, size);
*gHudElementCacheSize += size;
if (!gGameStatusPtr->isBattle) {
*pos = i;
Expand Down Expand Up @@ -840,7 +840,7 @@ void item_entity_load(ItemEntity* item) {
entry->id = palette;
entry->data = &gHudElementCacheBuffer[*gHudElementCacheSize];
ASSERT(*gHudElementCacheSize + 0x20 < 0x11000);
nuPiReadRom((s32)icon_present_ROM_START + palette, entry->data, 0x20);
nuPiReadRom((s32)icon_ROM_START + palette, entry->data, 0x20);
*gHudElementCacheSize += 0x20;
if (!gGameStatusPtr->isBattle) {
*pos = i;
Expand Down
6 changes: 3 additions & 3 deletions src/hud_element.c
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@

#if VERSION_IQUE
// TODO: remove if section is split in iQue release
extern Addr icon_present_ROM_START;
extern Addr icon_ROM_START;
#endif

#define MAX_HUD_CACHE_ENTRIES 192
Expand Down Expand Up @@ -198,7 +198,7 @@ void hud_element_load_script(HudElement* hudElement, HudScript* anim) {
capacity = gHudElementCacheCapacity / 2;
}
ASSERT(capacity > *gHudElementCacheSize + gHudElementSizes[preset].size);
nuPiReadRom((s32)icon_present_ROM_START + raster, entry->data, gHudElementSizes[preset].size);
nuPiReadRom((s32)icon_ROM_START + raster, entry->data, gHudElementSizes[preset].size);
*gHudElementCacheSize += gHudElementSizes[preset].size;
if (!gGameStatusPtr->isBattle) {
*pos = i;
Expand Down Expand Up @@ -234,7 +234,7 @@ void hud_element_load_script(HudElement* hudElement, HudScript* anim) {
capacity = gHudElementCacheCapacity / 2;
}
ASSERT(capacity > *gHudElementCacheSize + 32);
nuPiReadRom((s32)icon_present_ROM_START + palette, entry->data, 32);
nuPiReadRom((s32)icon_ROM_START + palette, entry->data, 32);
*gHudElementCacheSize += 32;
if (!gGameStatusPtr->isBattle) {
*pos = i;
Expand Down
10 changes: 10 additions & 0 deletions src/hud_element.h
Original file line number Diff line number Diff line change
Expand Up @@ -284,6 +284,16 @@ extern HudScript* wPartnerHudScripts[];
hs_End \
}

#define STANDARD_ITEM_HUD_SCRIPT(icon) \
{ \
hs_SetVisible \
hs_SetTileSize(HUD_ELEMENT_SIZE_32x32) \
hs_Loop \
hs_SetIcon(60, icon) \
hs_Restart \
hs_End \
}

void hud_element_load_script(HudElement* hudElement, HudScript* anim);

/// @param clamp 0 = repeat; 1 = clamp
Expand Down
Loading

0 comments on commit 76386ce

Please sign in to comment.