Skip to content

An OpenMW mod that lets you play the whole Elder Scrolls III: Morrowind as a top-down isometric game — with full online co-op or MMO modes.

C++

Top-down view: one name over another player, not two, when they are the one the cursor or stick is on

Alan Saunders5a09b327d91e
diff --git a/isowind/mod/scripts/isowind/healthbars.lua b/isowind/mod/scripts/isowind/healthbars.lua
index 8d27028..563cc49 100644
--- a/isowind/mod/scripts/isowind/healthbars.lua
+++ b/isowind/mod/scripts/isowind/healthbars.lua
@@ -100,12 +100,13 @@ local function showsName(actor)
and (actor.position - self.position):length() <= RANGE
end
--- project(worldPosition) returns a normalised screen position, or nil when it is off screen.
-function M.update(project)
+-- project(worldPosition) returns a normalised screen position, or nil when it is off screen. labelled is the object
+-- whose name the caller's own label shows already (the one under the cursor), if any: no second name for it.
+function M.update(project, labelled)
local seen = {}
local seenNames = {}
for _, actor in ipairs(nearby.actors) do
- if showsName(actor) then
+ if actor ~= labelled and showsName(actor) then
local box = actor:getBoundingBox()
local screen = project(v3(box.center.x, box.center.y, box.center.z + box.halfSize.z + 12))
if screen then
diff --git a/isowind/mod/scripts/isowind/topdown.lua b/isowind/mod/scripts/isowind/topdown.lua
index c69af94..2ce61cc 100644
--- a/isowind/mod/scripts/isowind/topdown.lua
+++ b/isowind/mod/scripts/isowind/topdown.lua
@@ -1059,7 +1059,7 @@ local function onFrame(dt)
setRingVisible(true)
updateRing()
updateParty()
- healthbars.update(worldToScreen)
+ healthbars.update(worldToScreen, hovered) -- (the one the cursor or the right stick is on already has the label)
local dx, dy = wantedDirection()
updateFacing(dt, dx, dy)
updateMovement(dx, dy)