From 7875de00e4e3eca916013d0e23b1659a097256f4 Mon Sep 17 00:00:00 2001 From: Zeno Rogue Date: Sat, 3 May 2025 17:40:11 +0200 Subject: [PATCH] ru:: display room name, player HP and enemy HP in the status line --- rogueviz/ru/entity.cpp | 1 + rogueviz/ru/globals.cpp | 2 ++ rogueviz/ru/ru.cpp | 7 +++++++ 3 files changed, 10 insertions(+) diff --git a/rogueviz/ru/entity.cpp b/rogueviz/ru/entity.cpp index 307241b7..3960b115 100644 --- a/rogueviz/ru/entity.cpp +++ b/rogueviz/ru/entity.cpp @@ -276,6 +276,7 @@ void boar::act() { } void boar::attacked(int dmg) { + current_target = this; reduce_hp(dmg); if(destroyed) addMessage("You kill the wild boar."); else addMessage("You hit the wild boar."); auto dat = get_dat(); diff --git a/rogueviz/ru/globals.cpp b/rogueviz/ru/globals.cpp index 22641fca..ff3d9b17 100644 --- a/rogueviz/ru/globals.cpp +++ b/rogueviz/ru/globals.cpp @@ -45,6 +45,8 @@ double mscale = 100; bool non_hyperbolic; bool one_room; +struct entity *current_target; + struct ruwall { string name; string glyph; diff --git a/rogueviz/ru/ru.cpp b/rogueviz/ru/ru.cpp index da05ccd8..6f1813cc 100644 --- a/rogueviz/ru/ru.cpp +++ b/rogueviz/ru/ru.cpp @@ -257,6 +257,13 @@ void run() { else switch_mapmode_to(mapmode::poincare); }); if(cmode == mode::editmap) mouseovers = format("coordinates: %d %d (%.2lf)", mousepx, mousepy, double(get_scale_at(mousepy))); + if(cmode == mode::playing) { + titlecolor = 0xFFFFFF; + mouseovers = current_room->roomname; + displayfr(vid.fsize, vid.fsize, 2, vid.fsize, "HP " + its(m.hp) + "/" + its(m.max_hp()), titlecolor, 0); + if(current_target && current_target->existing) + displayfr(vid.xres - vid.fsize, vid.fsize, 2, vid.fsize, "HP " + its(current_target->hp) + "/" + its(current_target->max_hp()) + " " + current_target->get_name(), titlecolor, 16); + } draw_pentagon(); break;