MCPcopy Create free account
hub / github.com/NetHack/NetHack / paintEvent

Method paintEvent

win/Qt/qt_inv.cpp:158–257  ·  view source on GitHub ↗

called to update the paper doll inventory subset

Source from the content-addressed store, hash-verified

156
157// called to update the paper doll inventory subset
158void NetHackQtInvUsageWindow::paintEvent(QPaintEvent*)
159{
160 // Paper doll is a 6 row by 3 column grid of worn and wielded
161 // equipment showing the map tiles that the inventory objects
162 // would be displayed as if they were on the floor.
163 //
164 // 0 1 2 two- dual
165 // [ old ] normal hander wielding legend
166 // 0 [x H b] q H b q H b q H b q quiver H helmet b eyewear
167 // 1 [S " w] w " S W " W w " X w weapon " amulet S shield
168 // 2 [G C G] x C G x C G . C G x alt-weap C cloak G gloves
169 // 3 [= A =] = A = = A = = A = = right rg A suit = left ring
170 // 4 [. U .] L U l L U l L U l L light U shirt l leash
171 // 5 [. F .] . F . . F . . F . . blank F boots . blank
172 // W wielded two-handed weapon
173 // X wielded secondary weapon
174 //
175 // 5.0: use a different layout (also different legend for it, above):
176 // invert so grid is facing player, with right hand on screen left;
177 // show gloves in only one slot;
178 // move alternate weapon to former right hand glove slot;
179 // move blindfold to former alternate weapon slot;
180 // add quiver to former blindfold slot;
181 // show secondary weapon in shield slot when two-weapon is active;
182 // show two-handed primary weapon in both shield and uwep slots;
183 // add lit lamp/lantern/candle/candelabrum on lower left side;
184 // add leash-in-use on lower right side
185 //
186 // Actually indexed by grid[column][row].
187
188#ifdef ENHANCED_PAPERDOLL
189 if (qt_settings->doll_is_shown && ::iflags.wc_ascii_map
190 && qt_settings->glyphs().no_tiles)
191 qt_settings->doll_is_shown = false;
192 if (!qt_settings->doll_is_shown)
193 return;
194 // set glyphs() for the paper doll; might be different size than map's
195 qt_settings->glyphs().setSize(qt_settings->dollWidth,
196 qt_settings->dollHeight);
197
198 /* for drawWorn()'s use of obj->invlet */
199 if (!::flags.invlet_constant)
200 reassign();
201#endif
202
203 QPainter painter;
204 painter.begin(this);
205
206 // String argument is for a tool tip when the object in question is Null.
207 //
208 // left grid column (depicts hero's right side)
209 drawWorn(painter, uquiver, 0, 0, "nothing readied for firing"); // quiver
210 drawWorn(painter, uwep, 0, 1, "no weapon");
211 /* uswapwep slot varies depending upon dual-wielding state;
212 shown in shield slot when actively wielded, so uswapwep slot is empty
213 then and an alternate tool tip is used to explain that emptiness */
214 if (!u.twoweap)
215 drawWorn(painter, uswapwep, 0, 2, "no alternate weapon");

Callers

nothing calls this directly

Calls 3

reassignFunction · 0.85
find_toolFunction · 0.85
setSizeMethod · 0.45

Tested by

no test coverage detected