Skip to content

Commit

Permalink
consistent naming for hud element IDs
Browse files Browse the repository at this point in the history
  • Loading branch information
z64a committed Oct 20, 2024
1 parent 67b84e1 commit a2f9e89
Show file tree
Hide file tree
Showing 63 changed files with 1,463 additions and 1,470 deletions.
8 changes: 4 additions & 4 deletions include/filemenu.h
Original file line number Diff line number Diff line change
Expand Up @@ -17,20 +17,20 @@ extern MenuPanel* filemenu_menus[];

extern s32 filemenu_iterFileIdx;
extern s32 filemenu_pressedButtons;
extern s32 filemenu_cursorHudElem;
extern s32 filemenu_cursorHID;
extern s32 filemenu_heldButtons;
extern s8 filemenu_filename_pos;
extern s32 filemenu_loadedFileIdx;
extern s8 filemenu_currentMenu;
extern s32 filemenu_8024C09C;
extern s32 filemenu_cursorHudElemID[1];
extern s32 filemenu_cursorHIDs[1];
extern s32 filemenu_8024C0A4[3];
extern s32 filemenu_hudElemIDs[20];
extern s32 filemenu_createfile_hudElems[4];
extern s32 filemenu_createfile_HIDs[4];
extern u8 filemenu_filename[8];

#if VERSION_PAL
extern s32 D_802517D0[1];
extern s32 PauseLanguageHIDs[1];
extern s32 D_802517D4[1];
extern u16 D_802517E0[2][0x400];
extern u8 D_filemenu_8025095C[4];
Expand Down
32 changes: 16 additions & 16 deletions src/8a860_len_3f30.c
Original file line number Diff line number Diff line change
Expand Up @@ -352,7 +352,7 @@ s32 popup_menu_update(void) {
s32 posY;
s32 width;
s32 height;
s32 hid;
HudElemID hid;
s32 cond;
s32 buttons;
s32 msgID;
Expand Down Expand Up @@ -2160,14 +2160,14 @@ void func_800F4C1C(s32* userData, s32 x, s32 y) {
}

void popup_draw_cost_icon(s32* userData, s32 x, s32 y) {
s32 hudElement;
HudElemID hid;
s32 xPos;
s32 yPos;

switch (gPopupMenu->popupType) {
case POPUP_TYPE_TRADE_FOR_BADGE:
xPos = x + 16;
hudElement = PopupMenu_TitleIconHID;
hid = PopupMenu_TitleIconHID;
yPos = y + 16;
break;
#if VERSION_JP
Expand All @@ -2177,16 +2177,16 @@ void popup_draw_cost_icon(s32* userData, s32 x, s32 y) {
#endif
case POPUP_TYPE_SELL_ITEM:
xPos = x + 17;
hudElement = PopupMenu_TitleIconHID;
hid = PopupMenu_TitleIconHID;
yPos = y + 17;
break;
default:
return;
}

hud_element_set_render_pos(hudElement, xPos, yPos);
hud_element_set_alpha(hudElement, PopupMenu_Alpha);
hud_element_draw_clipped(hudElement);
hud_element_set_render_pos(hid, xPos, yPos);
hud_element_set_alpha(hid, PopupMenu_Alpha);
hud_element_draw_clipped(hid);
}

void popup_draw_already_have_partner(s32* userData, s32 x, s32 y) {
Expand All @@ -2198,26 +2198,26 @@ void popup_draw_already_have_partner(s32* userData, s32 x, s32 y) {
}

void func_800F4D28(s32* userData, s32 x, s32 y) {
s32 hudElement = PopupMenu_TitleIconHID;
HudElemID hid = PopupMenu_TitleIconHID;
PlayerData* playerData = &gPlayerData;
s32 xPos = x + 14;
s32 yPos = y + 9;
s32 type;

hud_element_set_alpha(hudElement, PopupMenu_Alpha);
hud_element_set_alpha(hid, PopupMenu_Alpha);

if (gPopupMenu->popupType == POPUP_TYPE_TRADE_FOR_BADGE) {
hud_element_set_render_pos(hudElement, xPos, yPos);
hud_element_set_render_pos(hid, xPos, yPos);
} else {
hud_element_set_render_pos(hudElement, xPos, y + 10);
hud_element_set_render_pos(hid, xPos, y + 10);
}

hud_element_draw_clipped(hudElement);
hud_element_draw_clipped(hid);

hudElement = PopupMenu_TimesHID;
hud_element_set_render_pos(hudElement, x + 26, y + 11);
hud_element_set_alpha(hudElement, PopupMenu_Alpha);
hud_element_draw_clipped(hudElement);
hid = PopupMenu_TimesHID;
hud_element_set_render_pos(hid, x + 26, y + 11);
hud_element_set_alpha(hid, PopupMenu_Alpha);
hud_element_draw_clipped(hid);

type = gPopupMenu->popupType;
if (type == POPUP_TYPE_TRADE_FOR_BADGE) {
Expand Down
58 changes: 29 additions & 29 deletions src/battle/16C8E0.c
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ BSS Camera SavedWorldCameras[ARRAY_COUNT(gCameras)];
BSS f32 SavedWorldPlayerPosX;
BSS f32 SavedWorldPlayerPosY;
BSS f32 SavedWorldPlayerPosZ;
BSS s32 D_8029EFBC;
BSS s32 HPBarHID;
BSS s32 BtlStarPointTensHIDs[10];
BSS s32 BtlStarPointShinesHIDs[10];
BSS s32 BtlStarPointOnesHIDs[10];
Expand Down Expand Up @@ -163,7 +163,7 @@ void initialize_battle(void) {
PlayerData* playerData = &gPlayerData;
BattleStatus* battleStatus = &gBattleStatus;
Camera* tattleCam = &gCameras[CAM_TATTLE];
s32 hudElemID;
HudElemID hid;
s32 i;

gBattleStatus.flags1 = 0;
Expand Down Expand Up @@ -210,25 +210,25 @@ void initialize_battle(void) {
btl_popup_messages_init();
create_action_command_ui_worker();
set_windows_visible(WINDOW_GROUP_1);
D_8029EFBC = hud_element_create(&HES_HPBar);
hud_element_set_flags(D_8029EFBC, HUD_ELEMENT_FLAG_80);
HPBarHID = hud_element_create(&HES_HPBar);
hud_element_set_flags(HPBarHID, HUD_ELEMENT_FLAG_80);

for (i = 0; i < ARRAY_COUNT(BtlStarPointTensHIDs); i++) {
hudElemID = BtlStarPointTensHIDs[i] = hud_element_create(&HES_Item_StarPoint);
hud_element_set_flags(hudElemID, HUD_ELEMENT_FLAG_80 | HUD_ELEMENT_FLAG_DISABLED);
hud_element_set_render_depth(hudElemID, 20);
hid = BtlStarPointTensHIDs[i] = hud_element_create(&HES_Item_StarPoint);
hud_element_set_flags(hid, HUD_ELEMENT_FLAG_80 | HUD_ELEMENT_FLAG_DISABLED);
hud_element_set_render_depth(hid, 20);
}

for (i = 0; i < ARRAY_COUNT(BtlStarPointShinesHIDs); i++) {
hudElemID = BtlStarPointShinesHIDs[i] = hud_element_create(&HES_StatusSPShine);
hud_element_set_flags(hudElemID, HUD_ELEMENT_FLAG_80 | HUD_ELEMENT_FLAG_DISABLED);
hud_element_set_render_depth(hudElemID, 20);
hid = BtlStarPointShinesHIDs[i] = hud_element_create(&HES_StatusSPShine);
hud_element_set_flags(hid, HUD_ELEMENT_FLAG_80 | HUD_ELEMENT_FLAG_DISABLED);
hud_element_set_render_depth(hid, 20);
}

for (i = 0; i < ARRAY_COUNT(BtlStarPointOnesHIDs); i++) {
hudElemID = BtlStarPointOnesHIDs[i] = hud_element_create(&HES_SmallStarPoint);
hud_element_set_flags(hudElemID, HUD_ELEMENT_FLAG_80 | HUD_ELEMENT_FLAG_DISABLED);
hud_element_set_render_depth(hudElemID, 20);
hid = BtlStarPointOnesHIDs[i] = hud_element_create(&HES_SmallStarPoint);
hud_element_set_flags(hid, HUD_ELEMENT_FLAG_80 | HUD_ELEMENT_FLAG_DISABLED);
hud_element_set_render_depth(hid, 20);
}

tattleCam->fpDoPreRender = tattle_cam_pre_render;
Expand Down Expand Up @@ -907,36 +907,36 @@ void btl_draw_enemy_health_bars(void) {

if (enemy->healthBarPos.y >= -500) {
s32 screenX, screenY, screenZ;
s32 id;
HudElemID hid;

get_screen_coords(CAM_BATTLE, x, y, z, &screenX, &screenY, &screenZ);
screenY += 16;
id = D_8029EFBC;
hud_element_set_render_depth(id, 10);
hud_element_set_script(id, &HES_HPBar);
hud_element_set_render_pos(id, screenX, screenY);
hud_element_draw_clipped(id);
hid = HPBarHID;
hud_element_set_render_depth(hid, 10);
hud_element_set_script(hid, &HES_HPBar);
hud_element_set_render_pos(hid, screenX, screenY);
hud_element_draw_clipped(hid);

temp = currentHP / 10;
ones = currentHP % 10;

// tens digit
if (temp > 0) {
id = D_8029EFBC;
hud_element_set_render_depth(id, 10);
hud_element_set_script(id, bHPDigitHudScripts[temp]);
hid = HPBarHID;
hud_element_set_render_depth(hid, 10);
hud_element_set_script(hid, bHPDigitHudScripts[temp]);
btl_draw_prim_quad(0, 0, 0, 0, screenX, screenY + 2, 8, 8);
hud_element_set_render_pos(id, screenX + 4, screenY + 6);
hud_element_draw_next(id);
hud_element_set_render_pos(hid, screenX + 4, screenY + 6);
hud_element_draw_next(hid);
}

// ones digit
id = D_8029EFBC;
hud_element_set_render_depth(id, 10);
hud_element_set_script(id, bHPDigitHudScripts[ones]);
hid = HPBarHID;
hud_element_set_render_depth(hid, 10);
hud_element_set_script(hid, bHPDigitHudScripts[ones]);
btl_draw_prim_quad(0, 0, 0, 0, screenX + 6, screenY + 2, 8, 8);
hud_element_set_render_pos(id, screenX + 10, screenY + 6);
hud_element_draw_next(id);
hud_element_set_render_pos(hid, screenX + 10, screenY + 6);
hud_element_draw_next(hid);

temp = enemy->healthFraction;
temp = 25 - temp;
Expand Down
2 changes: 1 addition & 1 deletion src/battle/action_cmd.h
Original file line number Diff line number Diff line change
Expand Up @@ -80,7 +80,7 @@ enum ActionCommandModes {

typedef struct ActionCommandStatus {
/* 0x00 */ s32 workerID;
/* 0x04 */ s32 hudElements[16];
/* 0x04 */ HudElemID hudElemIDs[16];
/* 0x44 */ s16 meterFillLevel; // 0 to MAX_MASH_UNITS
/* 0x46 */ s16 escapeThreshold;
/* 0x48 */ s16 meterFillWidth; // X100
Expand Down
36 changes: 18 additions & 18 deletions src/battle/action_cmd/air_lift.c
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ API_CALLABLE(N(init)) {
s32 *args = script->ptrReadPos;
BattleStatus* battleStatus = &gBattleStatus;
ActionCommandStatus* acs = &gActionCommandStatus;
s32 hid;
HudElemID hid;

battleStatus->actionCmdDifficultyTable = actionCmdTableAirLift;
battleStatus->maxActionQuality = 0;
Expand Down Expand Up @@ -56,19 +56,19 @@ API_CALLABLE(N(init)) {
acs->hudPosY = 80;

hid = hud_element_create(&HES_AButton);
acs->hudElements[HIDX_BUTTON] = hid;
acs->hudElemIDs[HIDX_BUTTON] = hid;
hud_element_set_render_pos(hid, acs->hudPosX, acs->hudPosY);
hud_element_set_render_depth(hid, 0);
hud_element_set_flags(hid, HUD_ELEMENT_FLAG_80 | HUD_ELEMENT_FLAG_DISABLED);

hid = hud_element_create(&HES_BlueMeter);
acs->hudElements[HIDX_METER] = hid;
acs->hudElemIDs[HIDX_METER] = hid;
hud_element_set_render_pos(hid, acs->hudPosX, acs->hudPosY + 28);
hud_element_set_render_depth(hid, 0);
hud_element_set_flags(hid, HUD_ELEMENT_FLAG_80 | HUD_ELEMENT_FLAG_DISABLED);

hid = hud_element_create(&HES_100pct);
acs->hudElements[HIDX_100_PCT] = hid;
acs->hudElemIDs[HIDX_100_PCT] = hid;
hud_element_set_render_pos(hid, acs->hudPosX, acs->hudPosY + 28);
hud_element_set_render_depth(hid, 0);
hud_element_set_flags(hid, HUD_ELEMENT_FLAG_80 | HUD_ELEMENT_FLAG_DISABLED);
Expand Down Expand Up @@ -107,19 +107,19 @@ API_CALLABLE(N(start)) {
void N(update)(void) {
ActionCommandStatus* acs = &gActionCommandStatus;
BattleStatus* battleStatus = &gBattleStatus;
s32 hid;
HudElemID hid;

switch (acs->state) {
case AC_STATE_INIT:
btl_set_popup_duration(POPUP_MSG_ON);

hid = acs->hudElements[HIDX_BUTTON];
hid = acs->hudElemIDs[HIDX_BUTTON];
hud_element_set_alpha(hid, 255);
if (acs->showHud) {
hud_element_clear_flags(hid, HUD_ELEMENT_FLAG_DISABLED);
}

hid = acs->hudElements[HIDX_METER];
hid = acs->hudElemIDs[HIDX_METER];
hud_element_set_alpha(hid, 255);
if (acs->showHud) {
hud_element_clear_flags(hid, HUD_ELEMENT_FLAG_DISABLED);
Expand All @@ -140,8 +140,8 @@ void N(update)(void) {
acs->hudPosX = 50;
}

hud_element_set_render_pos(acs->hudElements[HIDX_BUTTON], acs->hudPosX, acs->hudPosY);
hud_element_set_render_pos(acs->hudElements[HIDX_METER], acs->hudPosX, acs->hudPosY + 28);
hud_element_set_render_pos(acs->hudElemIDs[HIDX_BUTTON], acs->hudPosX, acs->hudPosY);
hud_element_set_render_pos(acs->hudElemIDs[HIDX_METER], acs->hudPosX, acs->hudPosY + 28);
break;
case AC_STATE_START:
btl_set_popup_duration(POPUP_MSG_ON);
Expand All @@ -151,7 +151,7 @@ void N(update)(void) {
return;
}

hud_element_set_script(acs->hudElements[HIDX_BUTTON], &HES_MashAButton);
hud_element_set_script(acs->hudElemIDs[HIDX_BUTTON], &HES_MashAButton);
N(HasStarted) = TRUE;
acs->stateTimer = acs->duration;
sfx_play_sound_with_params(SOUND_LOOP_CHARGE_METER, 0, 0, 0);
Expand Down Expand Up @@ -197,7 +197,7 @@ void N(update)(void) {
if (acs->meterFillLevel > MAX_MASH_UNITS) {
acs->meterFillLevel = MAX_MASH_UNITS;
acs->isMeterFilled = TRUE;
hid = acs->hudElements[HIDX_100_PCT];
hid = acs->hudElemIDs[HIDX_100_PCT];
hud_element_set_render_pos(hid, acs->hudPosX + 50, acs->hudPosY + 28);
hud_element_clear_flags(hid, HUD_ELEMENT_FLAG_DISABLED);
}
Expand Down Expand Up @@ -255,13 +255,13 @@ void N(update)(void) {
void N(draw)(void) {
ActionCommandStatus* acs = &gActionCommandStatus;
s32 hudX, hudY;
s32 hid;
HudElemID hid;

if (gBattleStatus.actionCommandMode != AC_MODE_NOT_LEARNED) {
hud_element_draw_clipped(acs->hudElements[HIDX_BUTTON]);
hud_element_draw_clipped(acs->hudElemIDs[HIDX_BUTTON]);
}

hid = acs->hudElements[HIDX_METER];
hid = acs->hudElemIDs[HIDX_METER];
hud_element_draw_clipped(hid);
hud_element_get_render_pos(hid, &hudX, &hudY);

Expand All @@ -273,11 +273,11 @@ void N(draw)(void) {
draw_mash_meter_blink_with_divisor(hudX, hudY, acs->meterFillLevel / ONE_PCT_MASH, 4);
}

hud_element_draw_clipped(acs->hudElements[HIDX_100_PCT]);
hud_element_draw_clipped(acs->hudElemIDs[HIDX_100_PCT]);
}

void N(free)(void) {
hud_element_free(gActionCommandStatus.hudElements[HIDX_BUTTON]);
hud_element_free(gActionCommandStatus.hudElements[HIDX_METER]);
hud_element_free(gActionCommandStatus.hudElements[HIDX_100_PCT]);
hud_element_free(gActionCommandStatus.hudElemIDs[HIDX_BUTTON]);
hud_element_free(gActionCommandStatus.hudElemIDs[HIDX_METER]);
hud_element_free(gActionCommandStatus.hudElemIDs[HIDX_100_PCT]);
}
Loading

0 comments on commit a2f9e89

Please sign in to comment.