Skip to content

Commit f3c3062

Browse files
committed
display position for items
1 parent 0891e0f commit f3c3062

3 files changed

Lines changed: 8 additions & 1 deletion

File tree

game/world/focus.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ Tempest::Vec3 Focus::displayPosition() const {
2323
if(npc)
2424
return npc->displayPosition();
2525
if(item)
26-
return item->position();
26+
return item->displayPosition();
2727
return {};
2828
}
2929

game/world/objects/item.cpp

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -210,6 +210,12 @@ std::string_view Item::description() const {
210210
return hitem->description;
211211
}
212212

213+
Vec3 Item::displayPosition() const {
214+
if(auto b = bBox())
215+
return pos + Vec3(0, b[1].y - b[0].y, 0);
216+
return pos;
217+
}
218+
213219
Tempest::Vec3 Item::position() const {
214220
return pos;
215221
}

game/world/objects/item.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -53,6 +53,7 @@ class Item : public Vob {
5353

5454
std::string_view displayName() const;
5555
std::string_view description() const;
56+
Tempest::Vec3 displayPosition() const;
5657
Tempest::Vec3 position() const;
5758
Tempest::Vec3 midPosition() const;
5859
const Tempest::Vec3*bBox() const;

0 commit comments

Comments
 (0)