Magic Numbers go bye-bye (Only Pouch Currently)

This commit is contained in:
elijah-thomas774
2025-03-31 19:14:14 -04:00
parent 95c710fab0
commit d85379e718
2 changed files with 87 additions and 18 deletions
@@ -0,0 +1,58 @@
#ifndef D_LYT_COMMON_ICON_MAPS_H
#define D_LYT_COMMON_ICON_MAPS_H
// Pouch Items
#define LYT_CMN_PotionHealyh (0) // uc_bottleKusuriA_00.tpl
#define LYT_CMN_Bottle (1) // uc_bottleEmpty_00.tpl
#define LYT_CMN_ShieldWoodA (2) // uc_shieldWoodA_00.tpl
#define LYT_CMN_ShieldIronA (3) // uc_shieldIronA_00.tpl
#define LYT_CMN_ShieldHolyA (4) // uc_shieldHolyA_00.tpl
#define LYT_CMN_ShieldHylian (5) // uc_shieldHylia_00.tpl
#define LYT_CMN_PotionAir (6) // uc_bottleAirA_00.tpl
#define LYT_CMN_PotionStamina (7) // uc_bottleGutsA_00.tpl
#define LYT_CMN_PotionHealthPlus (8) // uc_bottleKusuriB_00.tpl
#define LYT_CMN_PotionHealthPlusPlusFull (9) // uc_bottleKusuriC_00.tpl
#define LYT_CMN_PotionAirPlus (10) // uc_bottleAirB_00.tpl
#define LYT_CMN_PotionStaminaPlus (11) // uc_bottleGutsB_00.tpl
#define LYT_CMN_Blank4 (12) // tr_black4_00.tpl
#define LYT_CMN_PotionGaurdian (13) // uc_bottleMutekiA_00.tpl
#define LYT_CMN_PotionGaurdianPlus (14) // uc_bottleMutekiB_00.tpl
#define LYT_CMN_ShieldWoodB (15) // uc_shieldWoodB_00.tpl
#define LYT_CMN_ShieldWoodC (16) // uc_shieldWoodC_00.tpl
#define LYT_CMN_ShieldIronB (17) // uc_shieldIronB_00.tpl
#define LYT_CMN_ShieldIronC (18) // uc_shieldIronC_00.tpl
#define LYT_CMN_ShieldHolyB (19) // uc_shieldHolyB_00.tpl
#define LYT_CMN_ShieldHolyC (20) // uc_shieldHolyC_00.tpl
#define LYT_CMN_SeedSatchelSmall (21) // uc_spareSeedA_00.tpl
#define LYT_CMN_SeedSatchelMed (22) // uc_spareSeedB_00.tpl
#define LYT_CMN_SeedSatchelBig (23) // uc_spareSeedC_00.tpl
#define LYT_CMN_QuiverSmall (24) // uc_spareQuiverA_00.tpl
#define LYT_CMN_QuiverMed (25) // uc_spareQuiverB_00.tpl
#define LYT_CMN_QuiverBig (26) // uc_spareQuiverC_00.tpl
#define LYT_CMN_BombBagSmall (27) // uc_spareBombBagA_00.tpl
#define LYT_CMN_BombBagMed (28) // uc_spareBombBagB_00.tpl
#define LYT_CMN_BombBagBig (29) // uc_spareBombBagC_00.tpl
#define LYT_CMN_GlitteringSpores (30) // uc_bottleKinokoB_00.tpl
#define LYT_CMN_HolyWater (31) // uc_bottleHoly_00.tpl
#define LYT_CMN_32 (32) // tr_rupyCrystal_02.tpl // Assuming Unused
#define LYT_CMN_33 (33) // tr_rupyCrystal_02.tpl
#define LYT_CMN_34 (34) // tr_rupyCrystal_03.tpl
#define LYT_CMN_MedalDurable (35) // uc_medalDurable_00.tpl
#define LYT_CMN_MedalHeart (36) // uc_medalHeart_00.tpl
#define LYT_CMN_MedalLife (37) // uc_medalLife_00.tpl
#define LYT_CMN_MedalRupee (38) // uc_medalLucky_00.tpl
#define LYT_CMN_MedalTreasure (39) // uc_medalReturn_00.tpl
#define LYT_CMN_MedalCursed (40) // uc_medalDemon_00.tpl
#define LYT_CMN_PotionRepair (41) // uc_bottleRepairA_00.tpl
#define LYT_CMN_PotionRepairPlus (42) // uc_bottleRepairB_00.tpl
#define LYT_CMN_PotionRepairPlusPlusFull (43) // uc_bottleRepairC_01.tpl
#define LYT_CMN_FairyBottle (44) // uc_bottleFairy_00.tpl
#define LYT_CMN_Water (45) // uc_bottleWater_00.tpl
#define LYT_CMN_PumpkinSoup (46) // uc_bottlePumpkinA_00.tpl
#define LYT_CMN_PumpkinSoupCold (47) // uc_bottlePumpkinB_00.tpl
#define LYT_CMN_MushroomSpores (48) // uc_bottleKinokoA_00.tpl
#define LYT_CMN_MedalBug (49) // uc_medalHunter_00.tpl
#define LYT_CMN_PotionHealthPlusPlusHalf (50) // uc_bottleKusuriC_01.tpl
#define LYT_CMN_PotionRepairPlusPlusHalf (51) // uc_bottleRepairC_00.tpl
#endif
+29 -18
View File
@@ -2,6 +2,7 @@
#include "common.h"
#include "d/d_cs_base.h"
#include "d/lyt/d_lyt_common_icon_item_maps.h"
#include "d/lyt/d_structd.h"
#include <cstring>
@@ -368,25 +369,25 @@ void dLytCommonIconItemPart2_c::setShieldOnOff(bool onOff) {
}
void dLytCommonIconItemPart2_c::setItem(u8 item) {
if (item == 32) {
if (item == LYT_CMN_32) {
return;
}
u8 mappedItem = item;
realizeUnk();
if (item == 9) {
if (item == LYT_CMN_PotionHealthPlusPlusFull) {
if (mNumber == 1) {
mappedItem = 50;
mappedItem = LYT_CMN_PotionHealthPlusPlusHalf;
} else if (mNumber == 2) {
mappedItem = 9;
mappedItem = LYT_CMN_PotionHealthPlusPlusFull;
}
mHasNumber = false;
realizeNumberV();
} else if (item == 43) {
} else if (item == LYT_CMN_PotionRepairPlusPlusFull) {
if (mNumber == 1) {
mappedItem = 51;
mappedItem = LYT_CMN_PotionRepairPlusPlusHalf;
} else if (mNumber == 2) {
mappedItem = 43;
mappedItem = LYT_CMN_PotionRepairPlusPlusFull;
}
mHasNumber = false;
realizeNumberV();
@@ -476,17 +477,27 @@ void dLytCommonIconItemPart2_c::realizeShieldOnOff(bool onOff) {
u8 dLytCommonIconItemPart2_c::getShieldType() const {
switch (mItem) {
case 2:
case 15:
case 16: return 0; // Wooden Shield
case 3:
case 17:
case 18: return 1; // Iron Shield
case 4:
case 19:
case 20: return 2; // Goddess Shield
case 5: return 3; // Hylia's Shield
default: return 4;
case LYT_CMN_ShieldWoodA:
case LYT_CMN_ShieldWoodB:
case LYT_CMN_ShieldWoodC: {
return 0;
}
case LYT_CMN_ShieldIronA:
case LYT_CMN_ShieldIronB:
case LYT_CMN_ShieldIronC: {
return 1;
}
case LYT_CMN_ShieldHolyA:
case LYT_CMN_ShieldHolyB:
case LYT_CMN_ShieldHolyC: {
return 2;
}
case LYT_CMN_ShieldHylian: {
return 3;
}
default: {
return 4;
}
}
}