From 2675960a823604881613dfa47aba4a13624d373a Mon Sep 17 00:00:00 2001 From: hap Date: Sat, 14 Sep 2024 12:08:00 +0200 Subject: [PATCH] namco*: no need for offs variable in tilemap mappers --- src/mame/namco/baraduke.cpp | 8 ++------ src/mame/namco/digdug.cpp | 8 ++------ src/mame/namco/galaga_v.cpp | 8 ++------ src/mame/namco/mappy_v.cpp | 18 +++++------------- src/mame/namco/skykid.cpp | 8 ++------ src/mame/namco/warpwarp_v.cpp | 8 ++------ src/mame/pacman/pacman_v.cpp | 27 +++++++++++---------------- src/mame/pacman/schick.cpp | 8 ++------ 8 files changed, 28 insertions(+), 65 deletions(-) diff --git a/src/mame/namco/baraduke.cpp b/src/mame/namco/baraduke.cpp index 815b33bdc27..5057e8a3232 100644 --- a/src/mame/namco/baraduke.cpp +++ b/src/mame/namco/baraduke.cpp @@ -254,16 +254,12 @@ void baraduke_state::palette(palette_device &palette) const // convert from 32x32 to 36x28 TILEMAP_MAPPER_MEMBER(baraduke_state::tx_tilemap_scan) { - int offs; - row += 2; col -= 2; if (col & 0x20) - offs = row + ((col & 0x1f) << 5); + return row + ((col & 0x1f) << 5); else - offs = col + (row << 5); - - return offs; + return col + (row << 5); } TILE_GET_INFO_MEMBER(baraduke_state::tx_get_tile_info) diff --git a/src/mame/namco/digdug.cpp b/src/mame/namco/digdug.cpp index 4542d1d10ff..2cab91a7942 100644 --- a/src/mame/namco/digdug.cpp +++ b/src/mame/namco/digdug.cpp @@ -75,16 +75,12 @@ void digdug_state::digdug_palette(palette_device &palette) const /* convert from 32x32 to 36x28 */ TILEMAP_MAPPER_MEMBER(digdug_state::tilemap_scan) { - int offs; - row += 2; col -= 2; if (col & 0x20) - offs = row + ((col & 0x1f) << 5); + return row + ((col & 0x1f) << 5); else - offs = col + (row << 5); - - return offs; + return col + (row << 5); } diff --git a/src/mame/namco/galaga_v.cpp b/src/mame/namco/galaga_v.cpp index 7e0999fb98f..907f6e20f2a 100644 --- a/src/mame/namco/galaga_v.cpp +++ b/src/mame/namco/galaga_v.cpp @@ -100,16 +100,12 @@ void galaga_state::galaga_palette(palette_device &palette) const /* convert from 32x32 to 36x28 */ TILEMAP_MAPPER_MEMBER(galaga_state::tilemap_scan) { - int offs; - row += 2; col -= 2; if (col & 0x20) - offs = row + ((col & 0x1f) << 5); + return row + ((col & 0x1f) << 5); else - offs = col + (row << 5); - - return offs; + return col + (row << 5); } diff --git a/src/mame/namco/mappy_v.cpp b/src/mame/namco/mappy_v.cpp index a2aeeb42e40..b66f5bcb737 100644 --- a/src/mame/namco/mappy_v.cpp +++ b/src/mame/namco/mappy_v.cpp @@ -224,23 +224,17 @@ void mappy_state::phozon_palette(palette_device &palette) const /* convert from 32x32 to 36x28 */ TILEMAP_MAPPER_MEMBER(mappy_state::superpac_tilemap_scan) { - int offs; - row += 2; col -= 2; if (col & 0x20) - offs = row + ((col & 0x1f) << 5); + return row + ((col & 0x1f) << 5); else - offs = col + (row << 5); - - return offs; + return col + (row << 5); } /* tilemap is a composition of a 32x60 scrolling portion and two 2x28 fixed portions on the sides */ TILEMAP_MAPPER_MEMBER(mappy_state::mappy_tilemap_scan) { - int offs; - col -= 2; if (col & 0x20) { @@ -248,14 +242,12 @@ TILEMAP_MAPPER_MEMBER(mappy_state::mappy_tilemap_scan) mapping from logical to hardware coordinates, which is true to the hardware. Not doing it that way would cause missing tiles in motos and todruaga */ if (row & 0x20) - offs = 0x7ff; // outside visible area + return 0x7ff; // outside visible area else - offs = ((row + 2) & 0x0f) + (row & 0x10) + ((col & 3) << 5) + 0x780; + return ((row + 2) & 0x0f) + (row & 0x10) + ((col & 3) << 5) + 0x780; } else - offs = col + (row << 5); - - return offs; + return col + (row << 5); } TILE_GET_INFO_MEMBER(mappy_state::superpac_get_tile_info) diff --git a/src/mame/namco/skykid.cpp b/src/mame/namco/skykid.cpp index 7481eb9797a..5916a86ccd8 100644 --- a/src/mame/namco/skykid.cpp +++ b/src/mame/namco/skykid.cpp @@ -165,16 +165,12 @@ void skykid_state::palette(palette_device &palette) const // convert from 32x32 to 36x28 TILEMAP_MAPPER_MEMBER(skykid_state::tx_tilemap_scan) { - int offs; - row += 2; col -= 2; if (col & 0x20) - offs = row + ((col & 0x1f) << 5); + return row + ((col & 0x1f) << 5); else - offs = col + (row << 5); - - return offs; + return col + (row << 5); } TILE_GET_INFO_MEMBER(skykid_state::tx_get_tile_info) diff --git a/src/mame/namco/warpwarp_v.cpp b/src/mame/namco/warpwarp_v.cpp index af943a6b2ef..d07db51ffcd 100644 --- a/src/mame/namco/warpwarp_v.cpp +++ b/src/mame/namco/warpwarp_v.cpp @@ -151,16 +151,12 @@ void warpwarp_state::warpwarp_palette(palette_device &palette) const /* convert from 32x32 to 34x28 */ TILEMAP_MAPPER_MEMBER(warpwarp_state::tilemap_scan) { - int offs; - row += 2; col--; if (col & 0x20) - offs = row + ((col & 1) << 5); + return row + ((col & 1) << 5); else - offs = col + (row << 5); - - return offs; + return col + (row << 5); } TILE_GET_INFO_MEMBER(warpwarp_state::geebee_get_tile_info) diff --git a/src/mame/pacman/pacman_v.cpp b/src/mame/pacman/pacman_v.cpp index 8d93e7681c6..8a030e788c0 100644 --- a/src/mame/pacman/pacman_v.cpp +++ b/src/mame/pacman/pacman_v.cpp @@ -169,16 +169,12 @@ void pacman_state::pacman_rbg_palette(palette_device &palette) const TILEMAP_MAPPER_MEMBER(pacman_state::pacman_scan_rows) { - int offs; - row += 2; col -= 2; if (col & 0x20) - offs = row + ((col & 0x1f) << 5); + return row + ((col & 0x1f) << 5); else - offs = col + (row << 5); - - return offs; + return col + (row << 5); } TILE_GET_INFO_MEMBER(pacman_state::pacman_get_tile_info) @@ -543,17 +539,17 @@ Jr. Pac-Man TILEMAP_MAPPER_MEMBER(pacman_state::jrpacman_scan_rows) { - int offs; - row += 2; col -= 2; - if ((col & 0x20) && (row & 0x20)) - offs = 0; - else if (col & 0x20) - offs = row + (((col&0x3) | 0x38)<< 5); + if (col & 0x20) + { + if (row & 0x20) + return 0x77f; // outside visible area + else + return row + (((col & 0x3) | 0x38) << 5); + } else - offs = col + (row << 5); - return offs; + return col + (row << 5); } TILE_GET_INFO_MEMBER(pacman_state::jrpacman_get_tile_info) @@ -579,8 +575,7 @@ void pacman_state::jrpacman_mark_tile_dirty(int offset) if (offset < 0x20) { /* line color - mark whole line as dirty */ - int i; - for (i = 2 * 0x20; i < 56 * 0x20; i += 0x20) + for (int i = 2 * 0x20; i < 56 * 0x20; i += 0x20) { m_bg_tilemap->mark_tile_dirty(offset + i); } diff --git a/src/mame/pacman/schick.cpp b/src/mame/pacman/schick.cpp index 3bba80f55a6..f8a9805702e 100644 --- a/src/mame/pacman/schick.cpp +++ b/src/mame/pacman/schick.cpp @@ -164,16 +164,12 @@ void schick_state::machine_start() TILEMAP_MAPPER_MEMBER(schick_state::schick_scan_rows) { - int offs; - row += 2; col -= 2; if (col & 0x20) - offs = row + ((col & 0x1f) << 5); + return row + ((col & 0x1f) << 5); else - offs = col + (row << 5); - - return offs; + return col + (row << 5); } TILE_GET_INFO_MEMBER(schick_state::schick_get_tile_info)