Skip to content

Commit 13de973

Browse files
committed
Inventory Menu - Display the current and max counts
1 parent bb6abf6 commit 13de973

File tree

2 files changed

+33
-2
lines changed

2 files changed

+33
-2
lines changed

ttyd-tools/rel/source/draw.cpp

Lines changed: 32 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -535,6 +535,37 @@ void drawInventoryIconAndTextColumns()
535535
MultiplyAmount = 1;
536536
}
537537

538+
// Draw the text for how many items/badges the player currently has out of the max
539+
int16_t *CurrentAddress = reinterpret_cast<int16_t *>(tempAddress);
540+
uint32_t CurrentItemCount = 0;
541+
542+
for (uint32_t i = 0; i < tempSize; i++)
543+
{
544+
if (*CurrentAddress)
545+
{
546+
CurrentItemCount++;
547+
}
548+
else
549+
{
550+
break;
551+
}
552+
553+
CurrentAddress++;
554+
}
555+
556+
// Draw the counts as int32_ts, to prevent long text if they somehow become negative
557+
char *tempDisplayBuffer = DisplayBuffer;
558+
559+
sprintf(tempDisplayBuffer,
560+
"%" PRId32 "/%" PRId32,
561+
static_cast<int32_t>(CurrentItemCount),
562+
static_cast<int32_t>(tempSize));
563+
564+
int32_t ItemCountPosX = 23;
565+
int32_t ItemCountPosY = 180;
566+
uint32_t Color = 0xFFFFFFFF;
567+
drawText(tempDisplayBuffer, ItemCountPosX, ItemCountPosY, Alpha, Color, TextScale);
568+
538569
// Draw the icons
539570
for (uint32_t i = 0; i < 2; i++)
540571
{
@@ -551,7 +582,7 @@ void drawInventoryIconAndTextColumns()
551582
PosX = SetPosXText;
552583
PosY = SetPosYText;
553584

554-
// Draw the text
585+
// Draw the text for each item/badge
555586
for (uint32_t i = 0; i < 2; i++)
556587
{
557588
// Draw the left and right columns

ttyd-tools/rel/source/global.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33

44
namespace mod {
55

6-
const char *VersionNumber = "v3.0.44";
6+
const char *VersionNumber = "v3.0.45";
77

88
const char *RootLines[] =
99
{

0 commit comments

Comments
 (0)