summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
author AJR <ajrhacker@users.noreply.github.com>2016-09-03 10:01:39 -0400
committer AJR <ajrhacker@users.noreply.github.com>2016-09-03 10:01:39 -0400
commita237f50680afcae5fc763fc80fa07b3dd08b24eb (patch)
treee86717afcc37ff2d796fc46d734d2f7084b3611c
parent0a8652e03f82e8bda55dcea445ce88b1c5038d1c (diff)
More consistent use of integer types in tilemap_t and other graphics-related classes (nw)
- Define indirect_pen_t, requiring a slight reordering of emu.h due to an unsurprising dependency
-rw-r--r--src/emu/digfx.cpp2
-rw-r--r--src/emu/digfx.h10
-rw-r--r--src/emu/drawgfx.cpp2
-rw-r--r--src/emu/drawgfx.h2
-rw-r--r--src/emu/emu.h2
-rw-r--r--src/emu/emupal.cpp4
-rw-r--r--src/emu/emupal.h12
-rw-r--r--src/emu/tilemap.cpp42
-rw-r--r--src/emu/tilemap.h36
-rw-r--r--src/frontend/mame/ui/viewgfx.cpp19
10 files changed, 68 insertions, 63 deletions
diff --git a/src/emu/digfx.cpp b/src/emu/digfx.cpp
index d3763c9d82e..3ab059ee5e0 100644
--- a/src/emu/digfx.cpp
+++ b/src/emu/digfx.cpp
@@ -128,7 +128,7 @@ void device_gfx_interface::decode_gfx(const gfx_decode_entry *gfxdecodeinfo)
std::vector<UINT32> extyoffs(0);
// loop over all elements
- for (int curgfx = 0; curgfx < MAX_GFX_ELEMENTS && gfxdecodeinfo[curgfx].gfxlayout != nullptr; curgfx++)
+ for (UINT8 curgfx = 0; curgfx < MAX_GFX_ELEMENTS && gfxdecodeinfo[curgfx].gfxlayout != nullptr; curgfx++)
{
const gfx_decode_entry &gfx = gfxdecodeinfo[curgfx];
diff --git a/src/emu/digfx.h b/src/emu/digfx.h
index 27ac702a986..a31625399e6 100644
--- a/src/emu/digfx.h
+++ b/src/emu/digfx.h
@@ -23,9 +23,9 @@
// CONSTANTS
//**************************************************************************
-const int MAX_GFX_ELEMENTS = 32;
-const int MAX_GFX_PLANES = 8;
-const int MAX_GFX_SIZE = 32;
+const UINT8 MAX_GFX_ELEMENTS = 32;
+const UINT16 MAX_GFX_PLANES = 8;
+const UINT16 MAX_GFX_SIZE = 32;
@@ -201,13 +201,13 @@ public:
// getters
palette_device &palette() const { assert(m_palette != nullptr); return *m_palette; }
- gfx_element *gfx(int index) const { assert(index < MAX_GFX_ELEMENTS); return m_gfx[index].get(); }
+ gfx_element *gfx(UINT8 index) const { assert(index < MAX_GFX_ELEMENTS); return m_gfx[index].get(); }
// decoding
void decode_gfx(const gfx_decode_entry *gfxdecodeinfo);
void decode_gfx() { decode_gfx(m_gfxdecodeinfo); }
- void set_gfx(int index, std::unique_ptr<gfx_element> &&element) { assert(index < MAX_GFX_ELEMENTS); m_gfx[index] = std::move(element); }
+ void set_gfx(UINT8 index, std::unique_ptr<gfx_element> &&element) { assert(index < MAX_GFX_ELEMENTS); m_gfx[index] = std::move(element); }
protected:
// interface-level overrides
diff --git a/src/emu/drawgfx.cpp b/src/emu/drawgfx.cpp
index e2bb6a688a8..fcb7b0b3fec 100644
--- a/src/emu/drawgfx.cpp
+++ b/src/emu/drawgfx.cpp
@@ -86,7 +86,7 @@ gfxdecode_device::gfxdecode_device(const machine_config &mconfig, const char *ta
// gfx_element - constructor
//-------------------------------------------------
-gfx_element::gfx_element(palette_device &palette, UINT8 *base, UINT32 width, UINT32 height, UINT32 rowbytes, UINT32 total_colors, UINT32 color_base, UINT32 color_granularity)
+gfx_element::gfx_element(palette_device &palette, UINT8 *base, UINT16 width, UINT16 height, UINT32 rowbytes, UINT32 total_colors, UINT32 color_base, UINT32 color_granularity)
: m_palette(&palette),
m_width(width),
m_height(height),
diff --git a/src/emu/drawgfx.h b/src/emu/drawgfx.h
index cebf2cb6e4c..a5864511c2f 100644
--- a/src/emu/drawgfx.h
+++ b/src/emu/drawgfx.h
@@ -152,7 +152,7 @@ public:
gfx_element();
#endif
gfx_element(palette_device &palette, const gfx_layout &gl, const UINT8 *srcdata, UINT32 xormask, UINT32 total_colors, UINT32 color_base);
- gfx_element(palette_device &palette, UINT8 *base, UINT32 width, UINT32 height, UINT32 rowbytes, UINT32 total_colors, UINT32 color_base, UINT32 color_granularity);
+ gfx_element(palette_device &palette, UINT8 *base, UINT16 width, UINT16 height, UINT32 rowbytes, UINT32 total_colors, UINT32 color_base, UINT32 color_granularity);
// getters
palette_device &palette() const { return *m_palette; }
diff --git a/src/emu/emu.h b/src/emu/emu.h
index 6424c4efec5..f170fc6295a 100644
--- a/src/emu/emu.h
+++ b/src/emu/emu.h
@@ -100,8 +100,8 @@ typedef device_t * (*machine_config_constructor)(machine_config &config, device_
// video-related
#include "drawgfx.h"
-#include "tilemap.h"
#include "emupal.h"
+#include "tilemap.h"
#include "screen.h"
#include "video.h"
diff --git a/src/emu/emupal.cpp b/src/emu/emupal.cpp
index dd32ba7816d..73f7360e8ff 100644
--- a/src/emu/emupal.cpp
+++ b/src/emu/emupal.cpp
@@ -133,7 +133,7 @@ void palette_device::set_indirect_color(int index, rgb_t rgb)
// set_pen_indirect - set an indirect pen index
//-------------------------------------------------
-void palette_device::set_pen_indirect(pen_t pen, UINT16 index)
+void palette_device::set_pen_indirect(pen_t pen, indirect_pen_t index)
{
// make sure we are in range
assert(pen < m_entries && index < m_indirect_entries);
@@ -150,7 +150,7 @@ void palette_device::set_pen_indirect(pen_t pen, UINT16 index)
// transcolor
//-------------------------------------------------
-UINT32 palette_device::transpen_mask(gfx_element &gfx, int color, int transcolor)
+UINT32 palette_device::transpen_mask(gfx_element &gfx, UINT32 color, indirect_pen_t transcolor)
{
UINT32 entry = gfx.colorbase() + (color % gfx.colors()) * gfx.granularity();
diff --git a/src/emu/emupal.h b/src/emu/emupal.h
index 283e40d5700..5ca21e354b6 100644
--- a/src/emu/emupal.h
+++ b/src/emu/emupal.h
@@ -290,6 +290,8 @@
typedef device_delegate<void (palette_device &)> palette_init_delegate;
+typedef UINT16 indirect_pen_t;
+
// ======================> raw_to_rgb_converter
@@ -412,11 +414,11 @@ public:
void set_pen_contrast(pen_t pen, double bright) { m_palette->entry_set_contrast(pen, bright); }
// indirection (aka colortables)
- UINT16 pen_indirect(int index) const { return m_indirect_pens[index]; }
+ indirect_pen_t pen_indirect(int index) const { return m_indirect_pens[index]; }
rgb_t indirect_color(int index) const { return m_indirect_colors[index]; }
void set_indirect_color(int index, rgb_t rgb);
- void set_pen_indirect(pen_t pen, UINT16 index);
- UINT32 transpen_mask(gfx_element &gfx, int color, int transcolor);
+ void set_pen_indirect(pen_t pen, indirect_pen_t index);
+ UINT32 transpen_mask(gfx_element &gfx, UINT32 color, indirect_pen_t transcolor);
// shadow config
void set_shadow_factor(double factor) { assert(m_shadow_group != 0); m_palette->group_set_contrast(m_shadow_group, factor); }
@@ -498,8 +500,8 @@ private:
pen_t m_black_pen; // precomputed black pen value
// indirection state
- std::vector<rgb_t> m_indirect_colors; // actual colors set for indirection
- std::vector<UINT16> m_indirect_pens; // indirection values
+ std::vector<rgb_t> m_indirect_colors; // actual colors set for indirection
+ std::vector<indirect_pen_t> m_indirect_pens; // indirection values
struct shadow_table_data
{
diff --git a/src/emu/tilemap.cpp b/src/emu/tilemap.cpp
index 5659169a19b..066475bd12e 100644
--- a/src/emu/tilemap.cpp
+++ b/src/emu/tilemap.cpp
@@ -343,7 +343,7 @@ tilemap_t::tilemap_t()
// init - initialize the tilemap
//-------------------------------------------------
-tilemap_t &tilemap_t::init(tilemap_manager &manager, device_gfx_interface &decoder, tilemap_get_info_delegate tile_get_info, tilemap_mapper_delegate mapper, int tilewidth, int tileheight, int cols, int rows)
+tilemap_t &tilemap_t::init(tilemap_manager &manager, device_gfx_interface &decoder, tilemap_get_info_delegate tile_get_info, tilemap_mapper_delegate mapper, UINT16 tilewidth, UINT16 tileheight, UINT32 cols, UINT32 rows)
{
// populate managers and devices
m_manager = &manager;
@@ -533,14 +533,12 @@ void tilemap_t::set_transmask(int group, UINT32 fgmask, UINT32 bgmask)
// matches the given transcolor are transparent
//-------------------------------------------------
-void tilemap_t::configure_groups(gfx_element &gfx, int transcolor)
+void tilemap_t::configure_groups(gfx_element &gfx, indirect_pen_t transcolor)
{
- int color;
-
assert(gfx.colors() <= TILEMAP_NUM_GROUPS);
// iterate over all colors in the tilemap
- for (color = 0; color < gfx.colors(); color++)
+ for (UINT32 color = 0; color < gfx.colors(); color++)
set_transmask(color, m_palette->transpen_mask(gfx, color, transcolor), 0);
}
@@ -632,7 +630,7 @@ void tilemap_t::postload()
void tilemap_t::mappings_create()
{
// compute the maximum logical index
- int max_logical_index = m_rows * m_cols;
+ const logical_index max_logical_index = m_rows * m_cols;
// compute the maximum memory index
tilemap_memory_index max_memory_index = 0;
@@ -726,8 +724,8 @@ g_profiler.start(PROFILER_TILEMAP_DRAW);
// iterate over rows and columns
logical_index logindex = 0;
- for (int row = 0; row < m_rows; row++)
- for (int col = 0; col < m_cols; col++, logindex++)
+ for (UINT32 row = 0; row < m_rows; row++)
+ for (UINT32 col = 0; col < m_cols; col++, logindex++)
if (m_tileflags[logindex] == TILE_FLAG_DIRTY)
tile_update(logindex, col, row);
@@ -805,7 +803,7 @@ UINT8 tilemap_t::tile_draw(const UINT8 *pendata, UINT32 x0, UINT32 y0, UINT32 pa
// iterate over rows
const UINT8 *penmap = m_pen_to_flags + group * MAX_PEN_TO_FLAGS;
UINT8 andmask = ~0, ormask = 0;
- for (int ty = 0; ty < m_tileheight; ty++)
+ for (UINT16 ty = 0; ty < m_tileheight; ty++)
{
UINT16 *pixptr = &m_pixmap.pix16(y0, x0);
UINT8 *flagsptr = &m_flagsmap.pix8(y0, x0);
@@ -814,7 +812,8 @@ UINT8 tilemap_t::tile_draw(const UINT8 *pendata, UINT32 x0, UINT32 y0, UINT32 pa
y0 += dy0;
// 8bpp data
- for (int tx = 0, xoffs = 0; tx < m_tilewidth; tx++, xoffs += dx0)
+ int xoffs = 0;
+ for (UINT16 tx = 0; tx < m_tilewidth; tx++)
{
UINT8 pen = (*pendata++) & pen_mask;
UINT8 map = penmap[pen];
@@ -822,6 +821,7 @@ UINT8 tilemap_t::tile_draw(const UINT8 *pendata, UINT32 x0, UINT32 y0, UINT32 pa
flagsptr[xoffs] = map | category;
andmask &= map;
ormask |= map;
+ xoffs += dx0;
}
}
return andmask ^ ormask;
@@ -855,14 +855,15 @@ UINT8 tilemap_t::tile_apply_bitmask(const UINT8 *maskdata, UINT32 x0, UINT32 y0,
// iterate over rows
UINT8 andmask = ~0, ormask = 0;
int bitoffs = 0;
- for (int ty = 0; ty < m_tileheight; ty++)
+ for (UINT16 ty = 0; ty < m_tileheight; ty++)
{
// pre-advance to the next row
UINT8 *flagsptr = &m_flagsmap.pix8(y0, x0);
y0 += dy0;
// anywhere the bitmask is 0 should be transparent
- for (int tx = 0, xoffs = 0; tx < m_tilewidth; tx++, xoffs += dx0)
+ int xoffs = 0;
+ for (UINT16 tx = 0; tx < m_tilewidth; tx++)
{
UINT8 map = flagsptr[xoffs];
@@ -871,6 +872,7 @@ UINT8 tilemap_t::tile_apply_bitmask(const UINT8 *maskdata, UINT32 x0, UINT32 y0,
andmask &= map;
ormask |= map;
bitoffs++;
+ xoffs += dx0;
}
}
return andmask ^ ormask;
@@ -1479,7 +1481,7 @@ void tilemap_t::draw_debug(screen_device &screen, bitmap_rgb32 &dest, UINT32 scr
// get_info_debug - extract info for one tile
//-------------------------------------------------
-void tilemap_t::get_info_debug(UINT32 col, UINT32 row, int &gfxnum, int &code, int &color)
+void tilemap_t::get_info_debug(UINT32 col, UINT32 row, UINT8 &gfxnum, UINT32 &code, UINT32 &color)
{
// first map to the memory index
tilemap_memory_index memindex = memory_index(col, row);
@@ -1492,8 +1494,8 @@ void tilemap_t::get_info_debug(UINT32 col, UINT32 row, int &gfxnum, int &code, i
code = m_tileinfo.code;
// work back from the palette base to get the color
- gfx_element *gfx = m_tileinfo.decoder->gfx(gfxnum);
- color = (m_tileinfo.palette_base - gfx->colorbase()) / gfx->granularity();
+ const gfx_element &gfx = *m_tileinfo.decoder->gfx(gfxnum);
+ color = (m_tileinfo.palette_base - gfx.colorbase()) / gfx.granularity();
}
@@ -1540,14 +1542,14 @@ tilemap_manager::~tilemap_manager()
// tilemaps
//-------------------------------------------------
-tilemap_t &tilemap_manager::create(device_gfx_interface &decoder, tilemap_get_info_delegate tile_get_info, tilemap_mapper_delegate mapper, int tilewidth, int tileheight, int cols, int rows, tilemap_t *allocated)
+tilemap_t &tilemap_manager::create(device_gfx_interface &decoder, tilemap_get_info_delegate tile_get_info, tilemap_mapper_delegate mapper, UINT16 tilewidth, UINT16 tileheight, UINT32 cols, UINT32 rows, tilemap_t *allocated)
{
if (allocated == nullptr)
allocated = global_alloc(tilemap_t);
return m_tilemap_list.append(allocated->init(*this, decoder, tile_get_info, mapper, tilewidth, tileheight, cols, rows));
}
-tilemap_t &tilemap_manager::create(device_gfx_interface &decoder, tilemap_get_info_delegate tile_get_info, tilemap_standard_mapper mapper, int tilewidth, int tileheight, int cols, int rows, tilemap_t *allocated)
+tilemap_t &tilemap_manager::create(device_gfx_interface &decoder, tilemap_get_info_delegate tile_get_info, tilemap_standard_mapper mapper, UINT16 tilewidth, UINT16 tileheight, UINT32 cols, UINT32 rows, tilemap_t *allocated)
{
if (allocated == nullptr)
allocated = global_alloc(tilemap_t);
@@ -1656,7 +1658,7 @@ void tilemap_device::static_set_info_callback(device_t &device, tilemap_get_info
// layout
//-------------------------------------------------
-void tilemap_device::static_set_layout(device_t &device, tilemap_standard_mapper mapper, int columns, int rows)
+void tilemap_device::static_set_layout(device_t &device, tilemap_standard_mapper mapper, UINT32 columns, UINT32 rows)
{
tilemap_device &target = downcast<tilemap_device &>(device);
target.m_standard_mapper = mapper;
@@ -1664,7 +1666,7 @@ void tilemap_device::static_set_layout(device_t &device, tilemap_standard_mapper
target.m_num_rows = rows;
}
-void tilemap_device::static_set_layout(device_t &device, tilemap_mapper_delegate mapper, int columns, int rows)
+void tilemap_device::static_set_layout(device_t &device, tilemap_mapper_delegate mapper, UINT32 columns, UINT32 rows)
{
tilemap_device &target = downcast<tilemap_device &>(device);
target.m_standard_mapper = TILEMAP_STANDARD_COUNT;
@@ -1678,7 +1680,7 @@ void tilemap_device::static_set_layout(device_t &device, tilemap_mapper_delegate
// static_set_tile_size: Set the tile size
//-------------------------------------------------
-void tilemap_device::static_set_tile_size(device_t &device, int width, int height)
+void tilemap_device::static_set_tile_size(device_t &device, UINT16 width, UINT16 height)
{
tilemap_device &target = downcast<tilemap_device &>(device);
target.m_tile_width = width;
diff --git a/src/emu/tilemap.h b/src/emu/tilemap.h
index 56f611a6308..b15c106b62f 100644
--- a/src/emu/tilemap.h
+++ b/src/emu/tilemap.h
@@ -450,7 +450,7 @@ struct tile_data
UINT8 gfxnum; // defaults to 0xff; specify index of gfx for auto-invalidation on dirty
UINT32 code;
- void set(int _gfxnum, int rawcode, int rawcolor, int _flags)
+ void set(UINT8 _gfxnum, UINT32 rawcode, UINT32 rawcolor, UINT8 _flags)
{
gfx_element *gfx = decoder->gfx(_gfxnum);
code = rawcode % gfx->elements();
@@ -496,7 +496,7 @@ protected:
tilemap_t();
virtual ~tilemap_t();
- tilemap_t &init(tilemap_manager &manager, device_gfx_interface &decoder, tilemap_get_info_delegate tile_get_info, tilemap_mapper_delegate mapper, int tilewidth, int tileheight, int cols, int rows);
+ tilemap_t &init(tilemap_manager &manager, device_gfx_interface &decoder, tilemap_get_info_delegate tile_get_info, tilemap_mapper_delegate mapper, UINT16 tilewidth, UINT16 tileheight, UINT32 cols, UINT32 rows);
public:
// getters
@@ -511,12 +511,12 @@ public:
memory_array &extmem() { return m_extmem; }
UINT32 rows() const { return m_rows; }
UINT32 cols() const { return m_cols; }
- UINT32 tilewidth() const { return m_tilewidth; }
- UINT32 tileheight() const { return m_tileheight; }
+ UINT16 tilewidth() const { return m_tilewidth; }
+ UINT16 tileheight() const { return m_tileheight; }
UINT32 width() const { return m_width; }
UINT32 height() const { return m_height; }
bool enabled() const { return m_enable; }
- int palette_offset() const { return m_palette_offset; }
+ UINT32 palette_offset() const { return m_palette_offset; }
int scrolldx() const { return (m_attributes & TILEMAP_FLIPX) ? m_dx_flipped : m_dx; }
int scrolldy() const { return (m_attributes & TILEMAP_FLIPY) ? m_dy_flipped : m_dy; }
int scrollx(int which = 0) const { return (which < m_scrollrows) ? m_rowscroll[which] : 0; }
@@ -525,7 +525,7 @@ public:
bitmap_ind8 &flagsmap() { pixmap_update(); return m_flagsmap; }
UINT8 *tile_flags() { pixmap_update(); return &m_tileflags[0]; }
tilemap_memory_index memory_index(UINT32 col, UINT32 row) { return m_mapper(col, row, m_cols, m_rows); }
- void get_info_debug(UINT32 col, UINT32 row, int &gfxnum, int &code, int &color);
+ void get_info_debug(UINT32 col, UINT32 row, UINT8 &gfxnum, UINT32 &code, UINT32 &color);
// setters
void enable(bool enable = true) { m_enable = enable; }
@@ -551,7 +551,7 @@ public:
void map_pen_to_layer(int group, pen_t pen, UINT8 layermask) { map_pens_to_layer(group, pen, ~0, layermask); }
void set_transparent_pen(pen_t pen);
void set_transmask(int group, UINT32 fgmask, UINT32 bgmask);
- void configure_groups(gfx_element &gfx, int transcolor);
+ void configure_groups(gfx_element &gfx, indirect_pen_t transcolor);
// drawing
void draw(screen_device &screen, bitmap_ind16 &dest, const rectangle &cliprect, UINT32 flags, UINT8 priority = 0, UINT8 priority_mask = 0xff);
@@ -645,8 +645,8 @@ private:
// basic tilemap metrics
UINT32 m_rows; // number of tile rows
UINT32 m_cols; // number of tile columns
- UINT32 m_tilewidth; // width of a single tile in pixels
- UINT32 m_tileheight; // height of a single tile in pixels
+ UINT16 m_tilewidth; // width of a single tile in pixels
+ UINT16 m_tileheight; // height of a single tile in pixels
UINT32 m_width; // width of the full tilemap in pixels
UINT32 m_height; // height of the full tilemap in pixels
@@ -704,8 +704,8 @@ public:
running_machine &machine() const { return m_machine; }
// tilemap creation
- tilemap_t &create(device_gfx_interface &decoder, tilemap_get_info_delegate tile_get_info, tilemap_mapper_delegate mapper, int tilewidth, int tileheight, int cols, int rows, tilemap_t *allocated = nullptr);
- tilemap_t &create(device_gfx_interface &decoder, tilemap_get_info_delegate tile_get_info, tilemap_standard_mapper mapper, int tilewidth, int tileheight, int cols, int rows, tilemap_t *allocated = nullptr);
+ tilemap_t &create(device_gfx_interface &decoder, tilemap_get_info_delegate tile_get_info, tilemap_mapper_delegate mapper, UINT16 tilewidth, UINT16 tileheight, UINT32 cols, UINT32 rows, tilemap_t *allocated = nullptr);
+ tilemap_t &create(device_gfx_interface &decoder, tilemap_get_info_delegate tile_get_info, tilemap_standard_mapper mapper, UINT16 tilewidth, UINT16 tileheight, UINT32 cols, UINT32 rows, tilemap_t *allocated = nullptr);
// tilemap list information
tilemap_t *find(int index) { return m_tilemap_list.find(index); }
@@ -742,9 +742,9 @@ public:
static void static_set_gfxdecode_tag(device_t &device, const char *tag);
static void static_set_bytes_per_entry(device_t &device, int bpe);
static void static_set_info_callback(device_t &device, tilemap_get_info_delegate tile_get_info);
- static void static_set_layout(device_t &device, tilemap_standard_mapper mapper, int columns, int rows);
- static void static_set_layout(device_t &device, tilemap_mapper_delegate mapper, int columns, int rows);
- static void static_set_tile_size(device_t &device, int width, int height);
+ static void static_set_layout(device_t &device, tilemap_standard_mapper mapper, UINT32 columns, UINT32 rows);
+ static void static_set_layout(device_t &device, tilemap_mapper_delegate mapper, UINT32 columns, UINT32 rows);
+ static void static_set_tile_size(device_t &device, UINT16 width, UINT16 height);
static void static_set_transparent_pen(device_t &device, pen_t pen);
// write handlers
@@ -771,10 +771,10 @@ private:
tilemap_standard_mapper m_standard_mapper;
tilemap_mapper_delegate m_mapper;
int m_bytes_per_entry;
- int m_tile_width;
- int m_tile_height;
- int m_num_columns;
- int m_num_rows;
+ UINT16 m_tile_width;
+ UINT16 m_tile_height;
+ UINT32 m_num_columns;
+ UINT32 m_num_rows;
bool m_transparent_pen_set;
pen_t m_transparent_pen;
};
diff --git a/src/frontend/mame/ui/viewgfx.cpp b/src/frontend/mame/ui/viewgfx.cpp
index 8dc9bd331a8..c7ffa27fbc6 100644
--- a/src/frontend/mame/ui/viewgfx.cpp
+++ b/src/frontend/mame/ui/viewgfx.cpp
@@ -29,7 +29,7 @@ enum ui_gfx_modes
UI_GFX_TILEMAP
};
-const int MAX_GFX_DECODERS = 8;
+const UINT8 MAX_GFX_DECODERS = 8;
@@ -137,7 +137,7 @@ static void tilemap_handler(mame_ui_manager &mui, render_container &container, u
void ui_gfx_init(running_machine &machine)
{
ui_gfx_state *state = &ui_gfx;
- int rotate = machine.system().flags & ORIENTATION_MASK;
+ UINT8 rotate = machine.system().flags & ORIENTATION_MASK;
// make sure we clean up after ourselves
machine.add_notifier(MACHINE_NOTIFY_EXIT, machine_notify_delegate(FUNC(ui_gfx_exit), &machine));
@@ -149,8 +149,8 @@ void ui_gfx_init(running_machine &machine)
state->palette.columns = 16;
// set up the graphics state
- for (int i = 0; i < MAX_GFX_DECODERS; i++)
- for (int j = 0; j < MAX_GFX_ELEMENTS; j++)
+ for (UINT8 i = 0; i < MAX_GFX_DECODERS; i++)
+ for (UINT8 j = 0; j < MAX_GFX_ELEMENTS; j++)
{
state->gfxdev[i].rotate[j] = rotate;
state->gfxdev[i].columns[j] = 16;
@@ -180,7 +180,7 @@ static void ui_gfx_count_devices(running_machine &machine, ui_gfx_state &state)
for (device_gfx_interface &interface : gfx_interface_iterator(machine.root_device()))
{
// count the gfx sets in each device, skipping devices with none
- int count = 0;
+ UINT8 count = 0;
while (count < MAX_GFX_ELEMENTS && interface.gfx(count) != nullptr)
count++;
@@ -1093,13 +1093,14 @@ static void tilemap_handler(mame_ui_manager &mui, render_container &container, u
ypixel = (mapboxheight - 1) - ypixel;
if (state.tilemap.rotate & ORIENTATION_SWAP_XY)
std::swap(xpixel, ypixel);
- int col = ((xpixel / pixelscale + state.tilemap.xoffs) / tilemap->tilewidth()) % tilemap->cols();
- int row = ((ypixel / pixelscale + state.tilemap.yoffs) / tilemap->tileheight()) % tilemap->rows();
- int gfxnum, code, color;
+ UINT32 col = ((xpixel / pixelscale + state.tilemap.xoffs) / tilemap->tilewidth()) % tilemap->cols();
+ UINT32 row = ((ypixel / pixelscale + state.tilemap.yoffs) / tilemap->tileheight()) % tilemap->rows();
+ UINT8 gfxnum;
+ UINT32 code, color;
tilemap->get_info_debug(col, row, gfxnum, code, color);
util::stream_format(title_buf, " @ %d,%d = GFX%d #%X:%X",
col * tilemap->tilewidth(), row * tilemap->tileheight(),
- gfxnum, code, color);
+ int(gfxnum), code, color);
}
else
util::stream_format(title_buf, " %dx%d OFFS %d,%d", tilemap->width(), tilemap->height(), state.tilemap.xoffs, state.tilemap.yoffs);