9 #include "tiledgnbuf.h"
17 #include "tiledef-dngn.h"
18 #include "tiledef-icons.h"
19 #include "tiledef-player.h"
21 #include "tilemcache.h"
23 #include "tilepick-p.h"
25 void packed_cell::clear()
36 swamp_tree_water
= false;
39 DungeonCellBuffer::DungeonCellBuffer(ImageManager
*im
) :
40 m_buf_floor(&im
->m_textures
[TEX_FLOOR
]),
41 m_buf_wall(&im
->m_textures
[TEX_WALL
]),
42 m_buf_feat(&im
->m_textures
[TEX_FEAT
]),
43 m_buf_feat_trans(&im
->m_textures
[TEX_FEAT
], 17),
44 m_buf_doll(&im
->m_textures
[TEX_PLAYER
], 17),
45 m_buf_main_trans(&im
->m_textures
[TEX_DEFAULT
], 17),
46 m_buf_main(&im
->m_textures
[TEX_DEFAULT
]),
47 m_buf_spells(&im
->m_textures
[TEX_GUI
]),
48 m_buf_skills(&im
->m_textures
[TEX_GUI
]),
49 m_buf_commands(&im
->m_textures
[TEX_GUI
]),
50 m_buf_icons(&im
->m_textures
[TEX_ICONS
])
54 static bool _in_water(const packed_cell
&cell
)
56 return ((cell
.bg
& TILE_FLAG_WATER
) && !(cell
.fg
& TILE_FLAG_FLYING
));
59 static void _lichform_add_weapon(SubmergedTileBuffer
&buf
, int x
, int y
,
62 const int item
= you
.equip
[EQ_WEAPON
];
66 const int wep
= tilep_equ_weapon(you
.inv
[item
]);
70 buf
.add(wep
, x
, y
, 0, in_water
, false, -1, 0);
73 void DungeonCellBuffer::add(const packed_cell
&cell
, int x
, int y
)
75 pack_background(x
, y
, cell
);
77 const tileidx_t fg_idx
= cell
.fg
& TILE_FLAG_MASK
;
78 const bool in_water
= _in_water(cell
);
80 if (fg_idx
>= TILEP_MCACHE_START
)
82 mcache_entry
*entry
= mcache
.get(fg_idx
);
84 pack_mcache(entry
, x
, y
, in_water
);
86 m_buf_doll
.add(TILEP_MONS_UNKNOWN
, x
, y
, 0, in_water
, false);
88 else if (fg_idx
== TILEP_PLAYER
)
90 pack_player(x
, y
, in_water
);
92 else if (fg_idx
>= TILE_MAIN_MAX
)
94 m_buf_doll
.add(fg_idx
, x
, y
, TILEP_PART_MAX
, in_water
, false);
95 if (fg_idx
>= TILEP_TRAN_LICH_EQUIP_FIRST
96 && fg_idx
<= TILEP_TRAN_LICH_EQUIP_LAST
)
98 _lichform_add_weapon(m_buf_doll
, x
, y
, in_water
);
102 pack_foreground(x
, y
, cell
);
106 void DungeonCellBuffer::add_dngn_tile(int tileidx
, int x
, int y
,
109 assert(tileidx
< TILE_FEAT_MAX
);
111 if (tileidx
< TILE_FLOOR_MAX
)
112 m_buf_floor
.add(tileidx
, x
, y
);
113 else if (tileidx
< TILE_WALL_MAX
)
114 m_buf_wall
.add(tileidx
, x
, y
);
116 m_buf_feat_trans
.add(tileidx
, x
, y
, 0, true, false);
118 m_buf_feat
.add(tileidx
, x
, y
);
121 void DungeonCellBuffer::add_main_tile(int tileidx
, int x
, int y
)
123 tileidx_t base
= tileidx_known_base_item(tileidx
);
125 m_buf_main
.add(base
, x
, y
);
127 m_buf_main
.add(tileidx
, x
, y
);
130 void DungeonCellBuffer::add_main_tile(int tileidx
, int x
, int y
, int ox
, int oy
)
132 tileidx_t base
= tileidx_known_base_item(tileidx
);
134 m_buf_main
.add(base
, x
, y
, ox
, oy
, false);
136 m_buf_main
.add(tileidx
, x
, y
, ox
, oy
, false);
139 void DungeonCellBuffer::add_spell_tile(int tileidx
, int x
, int y
)
141 m_buf_spells
.add(tileidx
, x
, y
);
144 void DungeonCellBuffer::add_skill_tile(int tileidx
, int x
, int y
)
146 m_buf_skills
.add(tileidx
, x
, y
);
149 void DungeonCellBuffer::add_command_tile(int tileidx
, int x
, int y
)
151 m_buf_commands
.add(tileidx
, x
, y
);
154 void DungeonCellBuffer::add_icons_tile(int tileidx
, int x
, int y
)
156 m_buf_icons
.add(tileidx
, x
, y
);
159 void DungeonCellBuffer::add_icons_tile(int tileidx
, int x
, int y
,
162 m_buf_icons
.add(tileidx
, x
, y
, ox
, oy
, false);
165 void DungeonCellBuffer::clear()
170 m_buf_feat_trans
.clear();
172 m_buf_main_trans
.clear();
174 m_buf_spells
.clear();
175 m_buf_skills
.clear();
176 m_buf_commands
.clear();
180 void DungeonCellBuffer::draw()
185 m_buf_feat_trans
.draw();
186 m_buf_main_trans
.draw();
191 m_buf_commands
.draw();
202 static wave_type
_get_wave_type(bool shallow
)
204 return (shallow
? WV_SHALLOW
: WV_DEEP
);
207 static void _add_overlay(int tileidx
, packed_cell
*cell
)
209 cell
->dngn_overlay
[cell
->num_dngn_overlay
++] = tileidx
;
212 static void _pack_shoal_waves(const coord_def
&gc
, packed_cell
*cell
)
214 // Add wave tiles on floor adjacent to shallow water.
215 const dungeon_feature_type feat
= env
.map_knowledge(gc
).feat();
216 const bool feat_has_ink
= (cloud_type_at(coord_def(gc
)) == CLOUD_INK
);
218 if (feat
== DNGN_DEEP_WATER
&& feat_has_ink
)
220 _add_overlay(TILE_WAVE_INK_FULL
, cell
);
224 if (feat
!= DNGN_FLOOR
&& feat
!= DNGN_UNDISCOVERED_TRAP
225 && feat
!= DNGN_SHALLOW_WATER
&& feat
!= DNGN_DEEP_WATER
)
230 const bool ink_only
= (feat
== DNGN_DEEP_WATER
);
232 wave_type north
= WV_NONE
, south
= WV_NONE
,
233 east
= WV_NONE
, west
= WV_NONE
,
234 ne
= WV_NONE
, nw
= WV_NONE
,
235 se
= WV_NONE
, sw
= WV_NONE
;
237 bool inkn
= false, inks
= false, inke
= false, inkw
= false,
238 inkne
= false, inknw
= false, inkse
= false, inksw
= false;
240 for (radius_iterator
ri(gc
, 1, true, false, true); ri
; ++ri
)
242 if (!env
.map_knowledge(*ri
).seen() && !env
.map_knowledge(*ri
).mapped())
245 const bool ink
= (cloud_type_at(coord_def(*ri
)) == CLOUD_INK
);
247 bool shallow
= false;
248 if (env
.map_knowledge(*ri
).feat() == DNGN_SHALLOW_WATER
)
250 // Adjacent shallow water is only interesting for
252 if (!ink
&& feat
== DNGN_SHALLOW_WATER
)
257 else if (env
.map_knowledge(*ri
).feat() != DNGN_DEEP_WATER
)
262 if (ri
->x
== gc
.x
) // orthogonals
265 north
= _get_wave_type(shallow
);
267 south
= _get_wave_type(shallow
);
269 else if (ri
->y
== gc
.y
)
272 west
= _get_wave_type(shallow
);
274 east
= _get_wave_type(shallow
);
281 nw
= _get_wave_type(shallow
);
283 sw
= _get_wave_type(shallow
);
288 ne
= _get_wave_type(shallow
);
290 se
= _get_wave_type(shallow
);
294 if (!feat_has_ink
&& ink
)
296 if (ri
->x
== gc
.x
) // orthogonals
303 else if (ri
->y
== gc
.y
)
332 // First check for shallow water.
333 if (north
== WV_SHALLOW
)
334 _add_overlay(TILE_WAVE_N
, cell
);
335 if (south
== WV_SHALLOW
)
336 _add_overlay(TILE_WAVE_S
, cell
);
337 if (east
== WV_SHALLOW
)
338 _add_overlay(TILE_WAVE_E
, cell
);
339 if (west
== WV_SHALLOW
)
340 _add_overlay(TILE_WAVE_W
, cell
);
342 // Then check for deep water, overwriting shallow
343 // corner waves, if necessary.
344 if (north
== WV_DEEP
)
345 _add_overlay(TILE_WAVE_DEEP_N
, cell
);
346 if (south
== WV_DEEP
)
347 _add_overlay(TILE_WAVE_DEEP_S
, cell
);
349 _add_overlay(TILE_WAVE_DEEP_E
, cell
);
351 _add_overlay(TILE_WAVE_DEEP_W
, cell
);
353 if (ne
== WV_SHALLOW
&& !north
&& !east
)
354 _add_overlay(TILE_WAVE_CORNER_NE
, cell
);
355 else if (ne
== WV_DEEP
&& north
!= WV_DEEP
&& east
!= WV_DEEP
)
356 _add_overlay(TILE_WAVE_DEEP_CORNER_NE
, cell
);
357 if (nw
== WV_SHALLOW
&& !north
&& !west
)
358 _add_overlay(TILE_WAVE_CORNER_NW
, cell
);
359 else if (nw
== WV_DEEP
&& north
!= WV_DEEP
&& west
!= WV_DEEP
)
360 _add_overlay(TILE_WAVE_DEEP_CORNER_NW
, cell
);
361 if (se
== WV_SHALLOW
&& !south
&& !east
)
362 _add_overlay(TILE_WAVE_CORNER_SE
, cell
);
363 else if (se
== WV_DEEP
&& south
!= WV_DEEP
&& east
!= WV_DEEP
)
364 _add_overlay(TILE_WAVE_DEEP_CORNER_SE
, cell
);
365 if (sw
== WV_SHALLOW
&& !south
&& !west
)
366 _add_overlay(TILE_WAVE_CORNER_SW
, cell
);
367 else if (sw
== WV_DEEP
&& south
!= WV_DEEP
&& west
!= WV_DEEP
)
368 _add_overlay(TILE_WAVE_DEEP_CORNER_SW
, cell
);
371 // Overlay with ink sheen, if necessary.
373 _add_overlay(TILE_WAVE_INK_FULL
, cell
);
377 _add_overlay(TILE_WAVE_INK_N
, cell
);
379 _add_overlay(TILE_WAVE_INK_S
, cell
);
381 _add_overlay(TILE_WAVE_INK_E
, cell
);
383 _add_overlay(TILE_WAVE_INK_W
, cell
);
384 if (inkne
|| inkn
|| inke
)
385 _add_overlay(TILE_WAVE_INK_CORNER_NE
, cell
);
386 if (inknw
|| inkn
|| inkw
)
387 _add_overlay(TILE_WAVE_INK_CORNER_NW
, cell
);
388 if (inkse
|| inks
|| inke
)
389 _add_overlay(TILE_WAVE_INK_CORNER_SE
, cell
);
390 if (inksw
|| inks
|| inkw
)
391 _add_overlay(TILE_WAVE_INK_CORNER_SW
, cell
);
395 static dungeon_feature_type
_safe_feat(coord_def gc
)
398 return (DNGN_UNSEEN
);
400 return (env
.map_knowledge(gc
).feat());
403 static bool _is_seen_land(coord_def gc
)
405 const dungeon_feature_type feat
= _safe_feat(gc
);
407 return (feat
!= DNGN_UNSEEN
&& !feat_is_water(feat
) && feat
!= DNGN_LAVA
);
410 static bool _is_seen_shallow(coord_def gc
)
412 const dungeon_feature_type feat
= _safe_feat(gc
);
414 return (feat
== DNGN_SHALLOW_WATER
|| feat
== DNGN_SWAMP_TREE
);
417 static void _pack_default_waves(const coord_def
&gc
, packed_cell
*cell
)
419 // Any tile on water with an adjacent solid tile will get an extra
421 dungeon_feature_type feat
= env
.map_knowledge(gc
).feat();
423 // Treat trees in Swamp as though they were shallow water.
424 if (cell
->swamp_tree_water
&& feat
== DNGN_TREE
)
425 feat
= DNGN_SHALLOW_WATER
;
427 if (!feat_is_water(feat
) && feat
!= DNGN_LAVA
|| env
.grid_colours(gc
))
430 if (feat
== DNGN_DEEP_WATER
)
432 if (_is_seen_shallow(coord_def(gc
.x
, gc
.y
- 1)))
433 _add_overlay(TILE_DNGN_WAVE_N
, cell
);
434 if (_is_seen_shallow(coord_def(gc
.x
+ 1, gc
.y
- 1)))
435 _add_overlay(TILE_DNGN_WAVE_NE
, cell
);
436 if (_is_seen_shallow(coord_def(gc
.x
+ 1, gc
.y
)))
437 _add_overlay(TILE_DNGN_WAVE_E
, cell
);
438 if (_is_seen_shallow(coord_def(gc
.x
+ 1, gc
.y
+ 1)))
439 _add_overlay(TILE_DNGN_WAVE_SE
, cell
);
440 if (_is_seen_shallow(coord_def(gc
.x
, gc
.y
+ 1)))
441 _add_overlay(TILE_DNGN_WAVE_S
, cell
);
442 if (_is_seen_shallow(coord_def(gc
.x
- 1, gc
.y
+ 1)))
443 _add_overlay(TILE_DNGN_WAVE_SW
, cell
);
444 if (_is_seen_shallow(coord_def(gc
.x
- 1, gc
.y
)))
445 _add_overlay(TILE_DNGN_WAVE_W
, cell
);
446 if (_is_seen_shallow(coord_def(gc
.x
- 1, gc
.y
- 1)))
447 _add_overlay(TILE_DNGN_WAVE_NW
, cell
);
451 bool north
= _is_seen_land(coord_def(gc
.x
, gc
.y
- 1));
452 bool west
= _is_seen_land(coord_def(gc
.x
- 1, gc
.y
));
453 bool east
= _is_seen_land(coord_def(gc
.x
+ 1, gc
.y
));
455 if (north
|| west
|| east
)
458 _add_overlay(TILE_SHORE_N
, cell
);
460 _add_overlay(TILE_SHORE_W
, cell
);
462 _add_overlay(TILE_SHORE_E
, cell
);
464 _add_overlay(TILE_SHORE_NW
, cell
);
466 _add_overlay(TILE_SHORE_NE
, cell
);
470 static bool _is_seen_wall(coord_def gc
)
472 dungeon_feature_type feat
= _safe_feat(gc
);
473 return (feat
!= DNGN_UNSEEN
&& feat
<= DNGN_MAXWALL
);
476 static void _pack_wall_shadows(const coord_def
&gc
, packed_cell
*cell
)
478 if (_is_seen_wall(gc
))
481 if (_is_seen_wall(coord_def(gc
.x
- 1, gc
.y
)))
482 _add_overlay(TILE_DNGN_WALL_SHADOW_W
, cell
);
483 if (_is_seen_wall(coord_def(gc
.x
- 1, gc
.y
- 1)))
484 _add_overlay(TILE_DNGN_WALL_SHADOW_NW
, cell
);
485 if (_is_seen_wall(coord_def(gc
.x
, gc
.y
- 1)))
486 _add_overlay(TILE_DNGN_WALL_SHADOW_N
, cell
);
487 if (_is_seen_wall(coord_def(gc
.x
+ 1, gc
.y
- 1)))
488 _add_overlay(TILE_DNGN_WALL_SHADOW_NE
, cell
);
489 if (_is_seen_wall(coord_def(gc
.x
+ 1, gc
.y
)))
490 _add_overlay(TILE_DNGN_WALL_SHADOW_E
, cell
);
493 void pack_cell_overlays(const coord_def
&gc
, packed_cell
*cell
)
495 if (player_in_branch(BRANCH_SHOALS
))
497 _pack_shoal_waves(gc
, cell
);
501 _pack_default_waves(gc
, cell
);
502 _pack_wall_shadows(gc
, cell
);
506 void DungeonCellBuffer::add_blood_overlay(int x
, int y
, const packed_cell
&cell
)
508 if (!cell
.is_bloody
&& !cell
.is_moldy
)
513 int offset
= cell
.flv
.special
% tile_dngn_count(TILE_BLOOD
);
514 m_buf_feat
.add(TILE_BLOOD
+ offset
, x
, y
);
516 else if (cell
.is_moldy
)
518 int offset
= cell
.flv
.special
% tile_dngn_count(TILE_MOLD
);
519 m_buf_feat
.add(TILE_MOLD
+ offset
, x
, y
);
523 void DungeonCellBuffer::pack_background(int x
, int y
, const packed_cell
&cell
)
525 const tileidx_t bg
= cell
.bg
;
526 const tileidx_t bg_idx
= cell
.bg
& TILE_FLAG_MASK
;
528 if (cell
.swamp_tree_water
&& bg_idx
> TILE_DNGN_UNSEEN
)
529 m_buf_feat
.add(TILE_DNGN_SHALLOW_WATER
, x
, y
);
531 if (bg_idx
>= TILE_DNGN_WAX_WALL
)
532 add_dngn_tile(cell
.flv
.floor
, x
, y
);
534 // Draw blood beneath feature tiles.
535 if (bg_idx
> TILE_WALL_MAX
)
536 add_blood_overlay(x
, y
, cell
);
538 add_dngn_tile(bg_idx
, x
, y
, cell
.swamp_tree_water
);
540 if (bg_idx
> TILE_DNGN_UNSEEN
)
542 if (bg
& TILE_FLAG_WAS_SECRET
)
543 m_buf_feat
.add(TILE_DNGN_DETECTED_SECRET_DOOR
, x
, y
);
545 // Draw blood on top of wall tiles.
546 if (bg_idx
<= TILE_WALL_MAX
)
547 add_blood_overlay(x
, y
, cell
);
549 for (int i
= 0; i
< cell
.num_dngn_overlay
; ++i
)
550 add_dngn_tile(cell
.dngn_overlay
[i
], x
, y
);
552 if (!(bg
& TILE_FLAG_UNSEEN
))
554 if (bg
& TILE_FLAG_KRAKEN_NW
)
555 m_buf_feat
.add(TILE_KRAKEN_OVERLAY_NW
, x
, y
);
556 if (bg
& TILE_FLAG_KRAKEN_NE
)
557 m_buf_feat
.add(TILE_KRAKEN_OVERLAY_NE
, x
, y
);
558 if (bg
& TILE_FLAG_KRAKEN_SE
)
559 m_buf_feat
.add(TILE_KRAKEN_OVERLAY_SE
, x
, y
);
560 if (bg
& TILE_FLAG_KRAKEN_SW
)
561 m_buf_feat
.add(TILE_KRAKEN_OVERLAY_SW
, x
, y
);
565 m_buf_feat
.add(TILE_HALO
, x
, y
);
567 if (!(bg
& TILE_FLAG_UNSEEN
))
569 if (cell
.is_sanctuary
)
570 m_buf_feat
.add(TILE_SANCTUARY
, x
, y
);
571 if (cell
.is_silenced
)
572 m_buf_feat
.add(TILE_SILENCED
, x
, y
);
574 // Apply the travel exclusion under the foreground if the cell is
575 // visible. It will be applied later if the cell is unseen.
576 if (bg
& TILE_FLAG_EXCL_CTR
)
577 m_buf_feat
.add(TILE_TRAVEL_EXCLUSION_CENTRE_BG
, x
, y
);
578 else if (bg
& TILE_FLAG_TRAV_EXCL
)
579 m_buf_feat
.add(TILE_TRAVEL_EXCLUSION_BG
, x
, y
);
582 if (bg
& TILE_FLAG_RAY
)
583 m_buf_feat
.add(TILE_RAY
, x
, y
);
584 else if (bg
& TILE_FLAG_RAY_OOR
)
585 m_buf_feat
.add(TILE_RAY_OUT_OF_RANGE
, x
, y
);
589 void DungeonCellBuffer::pack_foreground(int x
, int y
, const packed_cell
&cell
)
591 const tileidx_t fg
= cell
.fg
;
592 const tileidx_t bg
= cell
.bg
;
593 const tileidx_t fg_idx
= cell
.fg
& TILE_FLAG_MASK
;
594 const bool in_water
= _in_water(cell
);
596 if (fg_idx
&& fg_idx
<= TILE_MAIN_MAX
)
598 const tileidx_t base_idx
= tileidx_known_base_item(fg_idx
);
603 m_buf_main_trans
.add(base_idx
, x
, y
, 0, true, false);
604 m_buf_main_trans
.add(fg_idx
, x
, y
, 0, true, false);
609 m_buf_main
.add(base_idx
, x
, y
);
611 m_buf_main
.add(fg_idx
, x
, y
);
615 if (fg
& TILE_FLAG_NET
)
616 m_buf_icons
.add(TILEI_TRAP_NET
, x
, y
);
618 if (fg
& TILE_FLAG_S_UNDER
)
619 m_buf_icons
.add(TILEI_SOMETHING_UNDER
, x
, y
);
621 int status_shift
= 0;
622 if (fg
& TILE_FLAG_MIMIC
)
623 m_buf_icons
.add(TILEI_MIMIC
, x
, y
);
625 if (fg
& TILE_FLAG_BERSERK
)
627 m_buf_icons
.add(TILEI_BERSERK
, x
, y
);
632 if (fg
& TILE_FLAG_ATT_MASK
)
634 const tileidx_t att_flag
= fg
& TILE_FLAG_ATT_MASK
;
635 if (att_flag
== TILE_FLAG_PET
)
637 m_buf_icons
.add(TILEI_HEART
, x
, y
);
640 else if (att_flag
== TILE_FLAG_GD_NEUTRAL
)
642 m_buf_icons
.add(TILEI_GOOD_NEUTRAL
, x
, y
);
645 else if (att_flag
== TILE_FLAG_NEUTRAL
)
647 m_buf_icons
.add(TILEI_NEUTRAL
, x
, y
);
651 else if (fg
& TILE_FLAG_STAB
)
653 m_buf_icons
.add(TILEI_STAB_BRAND
, x
, y
);
656 else if (fg
& TILE_FLAG_MAY_STAB
)
658 m_buf_icons
.add(TILEI_MAY_STAB_BRAND
, x
, y
);
662 if (fg
& TILE_FLAG_POISON
)
664 m_buf_icons
.add(TILEI_POISON
, x
, y
, -status_shift
, 0);
667 if (fg
& TILE_FLAG_FLAME
)
669 m_buf_icons
.add(TILEI_FLAME
, x
, y
, -status_shift
, 0);
673 if (fg
& TILE_FLAG_ANIM_WEP
)
674 m_buf_icons
.add(TILEI_ANIMATED_WEAPON
, x
, y
);
676 if (bg
& TILE_FLAG_UNSEEN
&& (bg
!= TILE_FLAG_UNSEEN
|| fg
))
677 m_buf_icons
.add(TILEI_MESH
, x
, y
);
679 if (bg
& TILE_FLAG_OOR
&& (bg
!= TILE_FLAG_OOR
|| fg
))
680 m_buf_icons
.add(TILEI_OOR_MESH
, x
, y
);
682 if (bg
& TILE_FLAG_MM_UNSEEN
&& (bg
!= TILE_FLAG_MM_UNSEEN
|| fg
))
683 m_buf_icons
.add(TILEI_MAGIC_MAP_MESH
, x
, y
);
685 // Don't let the "new stair" icon cover up any existing icons, but
686 // draw it otherwise.
687 if (bg
& TILE_FLAG_NEW_STAIR
&& status_shift
== 0)
688 m_buf_icons
.add(TILEI_NEW_STAIR
, x
, y
);
690 if (bg
& TILE_FLAG_EXCL_CTR
&& (bg
& TILE_FLAG_UNSEEN
))
691 m_buf_icons
.add(TILEI_TRAVEL_EXCLUSION_CENTRE_FG
, x
, y
);
692 else if (bg
& TILE_FLAG_TRAV_EXCL
&& (bg
& TILE_FLAG_UNSEEN
))
693 m_buf_icons
.add(TILEI_TRAVEL_EXCLUSION_FG
, x
, y
);
695 // Tutorial cursor takes precedence over other cursors.
696 if (bg
& TILE_FLAG_TUT_CURSOR
)
698 m_buf_icons
.add(TILEI_TUTORIAL_CURSOR
, x
, y
);
700 else if (bg
& TILE_FLAG_CURSOR
)
702 int type
= ((bg
& TILE_FLAG_CURSOR
) == TILE_FLAG_CURSOR1
) ?
703 TILEI_CURSOR
: TILEI_CURSOR2
;
705 if ((bg
& TILE_FLAG_CURSOR
) == TILE_FLAG_CURSOR3
)
706 type
= TILEI_CURSOR3
;
708 m_buf_icons
.add(type
, x
, y
);
711 if (fg
& TILE_FLAG_MDAM_MASK
)
713 tileidx_t mdam_flag
= fg
& TILE_FLAG_MDAM_MASK
;
714 if (mdam_flag
== TILE_FLAG_MDAM_LIGHT
)
715 m_buf_icons
.add(TILEI_MDAM_LIGHTLY_DAMAGED
, x
, y
);
716 else if (mdam_flag
== TILE_FLAG_MDAM_MOD
)
717 m_buf_icons
.add(TILEI_MDAM_MODERATELY_DAMAGED
, x
, y
);
718 else if (mdam_flag
== TILE_FLAG_MDAM_HEAVY
)
719 m_buf_icons
.add(TILEI_MDAM_HEAVILY_DAMAGED
, x
, y
);
720 else if (mdam_flag
== TILE_FLAG_MDAM_SEV
)
721 m_buf_icons
.add(TILEI_MDAM_SEVERELY_DAMAGED
, x
, y
);
722 else if (mdam_flag
== TILE_FLAG_MDAM_ADEAD
)
723 m_buf_icons
.add(TILEI_MDAM_ALMOST_DEAD
, x
, y
);
726 if (fg
& TILE_FLAG_DEMON
)
728 tileidx_t demon_flag
= fg
& TILE_FLAG_DEMON
;
729 if (demon_flag
== TILE_FLAG_DEMON_1
)
730 m_buf_icons
.add(TILEI_DEMON_NUM1
, x
, y
);
731 else if (demon_flag
== TILE_FLAG_DEMON_2
)
732 m_buf_icons
.add(TILEI_DEMON_NUM2
, x
, y
);
733 else if (demon_flag
== TILE_FLAG_DEMON_3
)
734 m_buf_icons
.add(TILEI_DEMON_NUM3
, x
, y
);
735 else if (demon_flag
== TILE_FLAG_DEMON_4
)
736 m_buf_icons
.add(TILEI_DEMON_NUM4
, x
, y
);
737 else if (demon_flag
== TILE_FLAG_DEMON_5
)
738 m_buf_icons
.add(TILEI_DEMON_NUM5
, x
, y
);
742 void DungeonCellBuffer::pack_player(int x
, int y
, bool submerged
)
744 dolls_data result
= player_doll
;
745 fill_doll_equipment(result
);
746 pack_doll(result
, x
, y
, submerged
, false);
749 void DungeonCellBuffer::pack_doll(const dolls_data
&doll
, int x
, int y
,
750 bool submerged
, bool ghost
)
752 pack_doll_buf(m_buf_doll
, doll
, x
, y
, submerged
, ghost
);
756 void DungeonCellBuffer::pack_mcache(mcache_entry
*entry
, int x
, int y
,
761 bool trans
= entry
->transparent();
763 const dolls_data
*doll
= entry
->doll();
765 pack_doll(*doll
, x
, y
, submerged
, trans
);
767 tile_draw_info dinfo
[mcache_entry::MAX_INFO_COUNT
];
768 int draw_info_count
= entry
->info(&dinfo
[0]);
769 for (int i
= 0; i
< draw_info_count
; i
++)
771 m_buf_doll
.add(dinfo
[i
].idx
, x
, y
, TILEP_PART_MAX
, submerged
, trans
,
772 dinfo
[i
].ofs_x
, dinfo
[i
].ofs_y
);