When items in the paper doll inventory subset (primary worn and wielded items) have known BUC state, indicate what that is. It now draws a one pixel wide white border around each doll tile, and if BUC is known, that border gets its color changed (red for known cursed, yellow for known uncursed, cyan for known blessed). That isn't very visual so the first pixel inside the tile is overwritten with the same color, and alternating pixels are also overwritten for the second rectangle within. The 2..3 pixel wide border is visible without cluttering the tile for 'normal' sized paper doll. The tiles are allowed to be scrunched down to as small as 6x6 so there won't be much left after 1 or 2 around the edge are replaced. Initially I was going to try to highlight welded items but the more general BUC highlighting is simpler and usually more useful to the player. The qt_map.* bits are just reformatting. I was looking at pet and pile annotations as a way to do BUC annotations but decided not to attempt that.
84 lines
2.0 KiB
C++
84 lines
2.0 KiB
C++
// Copyright (c) Warwick Allison, 1999.
|
|
// Qt4 conversion copyright (c) Ray Chason, 2012-2014.
|
|
// NetHack may be freely redistributed. See license for details.
|
|
|
|
// qt_map.h -- the map window
|
|
|
|
#ifndef QT4MAP_H
|
|
#define QT4MAP_H
|
|
|
|
#include "qt_win.h"
|
|
#include "qt_clust.h"
|
|
|
|
namespace nethack_qt_ {
|
|
|
|
class NetHackQtClickBuffer;
|
|
|
|
class NetHackQtMapViewport : public QWidget {
|
|
Q_OBJECT
|
|
public:
|
|
NetHackQtMapViewport(NetHackQtClickBuffer& click_sink);
|
|
~NetHackQtMapViewport(void);
|
|
|
|
protected:
|
|
virtual void paintEvent(QPaintEvent* event);
|
|
bool DrawWalls(QPainter& painter, int x, int y,
|
|
int w, int h, unsigned ch);
|
|
virtual QSize sizeHint() const;
|
|
virtual QSize minimumSizeHint() const;
|
|
virtual void mousePressEvent(QMouseEvent* event);
|
|
|
|
private:
|
|
QFont *rogue_font;
|
|
unsigned short glyph[ROWNO][COLNO];
|
|
unsigned short& Glyph(int x, int y) { return glyph[y][x]; }
|
|
QPoint cursor;
|
|
QPixmap pet_annotation;
|
|
QPixmap pile_annotation;
|
|
NetHackQtClickBuffer& clicksink;
|
|
Clusterizer change;
|
|
|
|
void clickCursor();
|
|
void Clear();
|
|
void Display(bool block);
|
|
void CursorTo(int x,int y);
|
|
void PrintGlyph(int x,int y,int glyph);
|
|
void Changed(int x, int y);
|
|
void updateTiles();
|
|
|
|
// NetHackQtMapWindow2 passes through many calls to the viewport
|
|
friend class NetHackQtMapWindow2;
|
|
};
|
|
|
|
class NetHackQtMapWindow2 : public QScrollArea, public NetHackQtWindow {
|
|
Q_OBJECT
|
|
public:
|
|
NetHackQtMapWindow2(NetHackQtClickBuffer& click_sink);
|
|
void clearMessages();
|
|
void putMessage(int attr, const QString& text);
|
|
void clickCursor();
|
|
virtual QWidget *Widget();
|
|
|
|
virtual void Clear();
|
|
virtual void Display(bool block);
|
|
virtual void CursorTo(int x,int y);
|
|
virtual void PutStr(int attr, const QString& text);
|
|
virtual void ClipAround(int x,int y);
|
|
virtual void PrintGlyph(int x,int y,int glyph);
|
|
|
|
signals:
|
|
void resized();
|
|
|
|
private slots:
|
|
void updateTiles();
|
|
|
|
private:
|
|
NetHackQtMapViewport *m_viewport;
|
|
QRect messages_rect;
|
|
QString messages;
|
|
};
|
|
|
|
} // namespace nethack_qt_
|
|
|
|
#endif
|