mirror of
https://github.com/HarbourMasters/Shipwright.git
synced 2024-11-22 17:32:19 -05:00
Test Tracker Rework Breakout (#3180)
* Fix indentation for `actualItemtrackerItemMap`. Abstract equipment, quest item, and song checking for the item tracker. * Simplify `HasSong` Co-authored-by: briaguya <70942617+briaguya-ai@users.noreply.github.com> * Rename `HasEqItem` to `HasEquipment`. --------- Co-authored-by: briaguya <70942617+briaguya-ai@users.noreply.github.com>
This commit is contained in:
parent
79b5301165
commit
0a1e70ebaa
@ -283,6 +283,18 @@ bool IsValidSaveFile() {
|
|||||||
return validSave;
|
return validSave;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
bool HasSong(ItemTrackerItem item) {
|
||||||
|
return (1 << item.id) & gSaveContext.inventory.questItems;
|
||||||
|
}
|
||||||
|
|
||||||
|
bool HasQuestItem(ItemTrackerItem item) {
|
||||||
|
return (item.data & gSaveContext.inventory.questItems) != 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
bool HasEquipment(ItemTrackerItem item) {
|
||||||
|
return (item.data & gSaveContext.inventory.equipment) != 0;
|
||||||
|
}
|
||||||
|
|
||||||
ItemTrackerNumbers GetItemCurrentAndMax(ItemTrackerItem item) {
|
ItemTrackerNumbers GetItemCurrentAndMax(ItemTrackerItem item) {
|
||||||
ItemTrackerNumbers result;
|
ItemTrackerNumbers result;
|
||||||
result.currentCapacity = 0;
|
result.currentCapacity = 0;
|
||||||
@ -483,7 +495,7 @@ void DrawItemCount(ItemTrackerItem item) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
void DrawEquip(ItemTrackerItem item) {
|
void DrawEquip(ItemTrackerItem item) {
|
||||||
bool hasEquip = (item.data & gSaveContext.inventory.equipment) != 0;
|
bool hasEquip = HasEquipment(item);
|
||||||
int iconSize = CVarGetInteger("gItemTrackerIconSize", 36);
|
int iconSize = CVarGetInteger("gItemTrackerIconSize", 36);
|
||||||
ImGui::Image(LUS::Context::GetInstance()->GetWindow()->GetGui()->GetTextureByName(hasEquip && IsValidSaveFile() ? item.name : item.nameFaded),
|
ImGui::Image(LUS::Context::GetInstance()->GetWindow()->GetGui()->GetTextureByName(hasEquip && IsValidSaveFile() ? item.name : item.nameFaded),
|
||||||
ImVec2(iconSize, iconSize), ImVec2(0, 0), ImVec2(1, 1));
|
ImVec2(iconSize, iconSize), ImVec2(0, 0), ImVec2(1, 1));
|
||||||
@ -492,7 +504,7 @@ void DrawEquip(ItemTrackerItem item) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
void DrawQuest(ItemTrackerItem item) {
|
void DrawQuest(ItemTrackerItem item) {
|
||||||
bool hasQuestItem = (item.data & gSaveContext.inventory.questItems) != 0;
|
bool hasQuestItem = HasQuestItem(item);
|
||||||
int iconSize = CVarGetInteger("gItemTrackerIconSize", 36);
|
int iconSize = CVarGetInteger("gItemTrackerIconSize", 36);
|
||||||
ImGui::BeginGroup();
|
ImGui::BeginGroup();
|
||||||
ImGui::Image(LUS::Context::GetInstance()->GetWindow()->GetGui()->GetTextureByName(hasQuestItem && IsValidSaveFile() ? item.name : item.nameFaded),
|
ImGui::Image(LUS::Context::GetInstance()->GetWindow()->GetGui()->GetTextureByName(hasQuestItem && IsValidSaveFile() ? item.name : item.nameFaded),
|
||||||
@ -630,9 +642,8 @@ void DrawDungeonItem(ItemTrackerItem item) {
|
|||||||
|
|
||||||
void DrawSong(ItemTrackerItem item) {
|
void DrawSong(ItemTrackerItem item) {
|
||||||
int iconSize = CVarGetInteger("gItemTrackerIconSize", 36);
|
int iconSize = CVarGetInteger("gItemTrackerIconSize", 36);
|
||||||
uint32_t bitMask = 1 << item.id;
|
|
||||||
bool hasSong = (bitMask & gSaveContext.inventory.questItems) != 0;
|
|
||||||
ImVec2 p = ImGui::GetCursorScreenPos();
|
ImVec2 p = ImGui::GetCursorScreenPos();
|
||||||
|
bool hasSong = HasSong(item);
|
||||||
ImGui::SetCursorScreenPos(ImVec2(p.x + 6, p.y));
|
ImGui::SetCursorScreenPos(ImVec2(p.x + 6, p.y));
|
||||||
ImGui::Image(LUS::Context::GetInstance()->GetWindow()->GetGui()->GetTextureByName(hasSong && IsValidSaveFile() ? item.name : item.nameFaded),
|
ImGui::Image(LUS::Context::GetInstance()->GetWindow()->GetGui()->GetTextureByName(hasSong && IsValidSaveFile() ? item.name : item.nameFaded),
|
||||||
ImVec2(iconSize / 1.5, iconSize), ImVec2(0, 0), ImVec2(1, 1));
|
ImVec2(iconSize / 1.5, iconSize), ImVec2(0, 0), ImVec2(1, 1));
|
||||||
|
@ -15,6 +15,10 @@ typedef struct ItemTrackerItem {
|
|||||||
void (*drawFunc)(ItemTrackerItem);
|
void (*drawFunc)(ItemTrackerItem);
|
||||||
} ItemTrackerItem;
|
} ItemTrackerItem;
|
||||||
|
|
||||||
|
bool HasSong(ItemTrackerItem);
|
||||||
|
bool HasQuestItem(ItemTrackerItem);
|
||||||
|
bool HasEquipment(ItemTrackerItem);
|
||||||
|
|
||||||
#define ITEM_TRACKER_ITEM(id, data, drawFunc) \
|
#define ITEM_TRACKER_ITEM(id, data, drawFunc) \
|
||||||
{ \
|
{ \
|
||||||
id, #id, #id "_Faded", data, drawFunc \
|
id, #id, #id "_Faded", data, drawFunc \
|
||||||
|
Loading…
Reference in New Issue
Block a user