#include "term/gameterm.h"
#include "term/term-color-types.h"
#include "term/z-virt.h"
+#include "view/colored-char.h"
/* Special flags in the attr data */
#define AF_BIGTILE2 0xf0
* Otherwise, queue a pair of attr/char for display at the current
* cursor location, and advance the cursor to the right by two.
*/
-errr term_add_bigch(TERM_COLOR a, char c)
+void term_add_bigch(const ColoredChar &cc)
{
if (!use_bigtile) {
- return term_addch(a, c);
+ (void)term_addch(cc.color, cc.character);
+ return;
}
/* Handle "unusable" cursor */
if (game_term->scr->cu) {
- return -1;
+ return;
}
/* Paranoia -- no illegal chars */
- if (!c) {
- return -2;
+ if (!cc.has_character()) {
+ return;
}
/* Queue the given character for display */
- term_queue_bigchar(game_term->scr->cx, game_term->scr->cy, a, c, 0, 0);
+ term_queue_bigchar(game_term->scr->cx, game_term->scr->cy, cc.color, cc.character, 0, 0);
/* Advance the cursor */
game_term->scr->cx += 2;
/* Success */
if (game_term->scr->cx < game_term->wid) {
- return 0;
+ return;
}
/* Note "Useless" cursor */
game_term->scr->cu = 1;
-
- /* Note "Useless" cursor */
- return 1;
}
/*
/**** Available Variables ****/
extern term_type *game_term;
+class ColoredChar;
errr term_user(int n);
errr term_xtra(int n, int v);
errr term_gotoxy(TERM_LEN x, TERM_LEN y);
errr term_draw(TERM_LEN x, TERM_LEN y, TERM_COLOR a, char c);
errr term_addch(TERM_COLOR a, char c);
-errr term_add_bigch(TERM_COLOR a, char c);
+void term_add_bigch(const ColoredChar &cc);
errr term_addstr(int n, TERM_COLOR a, std::string_view sv);
errr term_putch(TERM_LEN x, TERM_LEN y, TERM_COLOR a, char c);
errr term_putstr(TERM_LEN x, TERM_LEN y, int n, TERM_COLOR a, std::string_view sv);
#include "term/z-form.h"
#include "util/bit-flags-calculator.h"
#include "util/string-processor.h"
+#include "view/colored-char.h"
#include "view/display-messages.h"
#include "world/world.h"
void roff_top(MonsterRaceId r_idx)
{
auto *r_ptr = &monraces_info[r_idx];
- char c1 = r_ptr->d_char;
- char c2 = r_ptr->x_char;
-
TERM_COLOR a1 = r_ptr->d_attr;
+ char c1 = r_ptr->d_char;
TERM_COLOR a2 = r_ptr->x_attr;
+ char c2 = r_ptr->x_char;
term_erase(0, 0);
term_gotoxy(0, 0);
term_addstr(-1, TERM_WHITE, r_ptr->name);
term_addstr(-1, TERM_WHITE, " ('");
- term_add_bigch(a1, c1);
+ term_add_bigch({ a1, c1 });
term_addstr(-1, TERM_WHITE, "')");
term_addstr(-1, TERM_WHITE, "/('");
- term_add_bigch(a2, c2);
+ term_add_bigch({ a2, c2 });
term_addstr(-1, TERM_WHITE, "'):");
}
#include "mind/mind-sniper.h"
#include "mind/mind-types.h"
#include "monster-race/monster-race.h"
+#include "monster-race/race-indice-types.h"
#include "monster/monster-describer.h"
#include "monster/monster-description-types.h"
#include "object/item-tester-hooker.h"
*/
static void print_monster_line(TERM_LEN x, TERM_LEN y, MonsterEntity *m_ptr, int n_same, int n_awake)
{
- std::string buf;
- MonsterRaceId r_idx = m_ptr->ap_r_idx;
- auto *r_ptr = &monraces_info[r_idx];
-
term_erase(0, y);
term_gotoxy(x, y);
- if (!r_ptr) {
+ const auto monrace_id = m_ptr->ap_r_idx;
+ if (monrace_id == MonsterRaceId::PLAYER) {
return;
}
- if (r_ptr->kind_flags.has(MonsterKindType::UNIQUE)) {
- buf = format(_("%3s(覚%2d)", "%3s(%2d)"), MonsterRace(r_idx).is_bounty(true) ? " W" : " U", n_awake);
+
+ std::string buf;
+ const auto &monrace = monraces_info[monrace_id];
+ if (monrace.kind_flags.has(MonsterKindType::UNIQUE)) {
+ buf = format(_("%3s(覚%2d)", "%3s(%2d)"), MonsterRace(monrace_id).is_bounty(true) ? " W" : " U", n_awake);
} else {
buf = format(_("%3d(覚%2d)", "%3d(%2d)"), n_same, n_awake);
}
- term_addstr(-1, TERM_WHITE, buf);
+ term_addstr(-1, TERM_WHITE, buf);
term_addstr(-1, TERM_WHITE, " ");
- term_add_bigch(r_ptr->x_attr, r_ptr->x_char);
+ term_add_bigch({ monrace.x_attr, monrace.x_char });
- if (r_ptr->r_tkills && m_ptr->mflag2.has_not(MonsterConstantFlagType::KAGE)) {
- buf = format(" %2d", (int)r_ptr->level);
+ if (monrace.r_tkills && m_ptr->mflag2.has_not(MonsterConstantFlagType::KAGE)) {
+ buf = format(" %2d", monrace.level);
} else {
buf = " ??";
}
term_addstr(-1, TERM_WHITE, buf);
-
- term_addstr(-1, TERM_WHITE, format(" %s ", r_ptr->name.data()));
+ term_addstr(-1, TERM_WHITE, format(" %s ", monrace.name.data()));
}
/*!
}
term_gotoxy(x + 13, y);
- term_add_bigch(monrace.x_attr, monrace.x_char);
+ term_add_bigch({ monrace.x_attr, monrace.x_char });
term_addstr(-1, TERM_WHITE, " ");
term_addstr(-1, TERM_WHITE, name);
}
}
- term_add_bigch(ta, tc);
+ term_add_bigch({ ta, tc });
}
}