From dad2f0c855444d65837889d74f5ef959fbc26944 Mon Sep 17 00:00:00 2001 From: hap Date: Sat, 2 Nov 2024 15:22:05 +0100 Subject: namcos22: no need for parentheses when bitshift has higher precendece, namcos23: copy over simpler gfxlayout from namcos22 --- src/mame/namco/namcos22.cpp | 20 +++++++------- src/mame/namco/namcos22_v.cpp | 64 +++++++++++++++++++++---------------------- src/mame/namco/namcos23.cpp | 58 ++++----------------------------------- 3 files changed, 48 insertions(+), 94 deletions(-) diff --git a/src/mame/namco/namcos22.cpp b/src/mame/namco/namcos22.cpp index 0d88e8e50b4..304d615485b 100644 --- a/src/mame/namco/namcos22.cpp +++ b/src/mame/namco/namcos22.cpp @@ -2012,7 +2012,7 @@ void namcos22_state::namcos22_dspram16_w(offs_t offset, u16 data, u16 mem_mask) break; } - m_polygonram[offset] = (hi << 16) | lo; + m_polygonram[offset] = hi << 16 | lo; } void namcos22_state::namcos22_dspram16_bank_w(offs_t offset, u16 data, u16 mem_mask) @@ -2080,7 +2080,7 @@ u16 namcos22_state::point_loword_r() u16 namcos22_state::point_hiword_ir() { // high bit is unknown busy signal (ridgerac, ridgera2, raverace, cybrcomm) - const u16 ret = 0x8000 | ((point_read(m_point_address) >> 16) & 0x00ff); + const u16 ret = 0x8000 | (point_read(m_point_address) >> 16 & 0x00ff); if (!machine().side_effects_disabled()) m_point_address++; @@ -2495,7 +2495,7 @@ u16 namcos22_state::dsp_slave_port5_r() #if 0 int numWords = SlaveBufSize(); int mode = 2; - return (numWords<<4) | mode; + return numWords << 4 | mode; #endif return 0; } @@ -2782,7 +2782,7 @@ void namcos22_state::handle_driving_io() { const u16 flags = m_inputs->read(); u16 steer = m_adc_ports[0]->read(); - u16 gas = m_adc_ports[1]->read(); + u16 gas = m_adc_ports[1]->read(); u16 brake = m_adc_ports[2]->read(); switch (m_gametype) @@ -3575,12 +3575,6 @@ INPUT_PORTS_END /*********************************************************************************************/ -/* System Super22 supports a sprite layer. - * Sprites are rendered as part of the polygon draw list, based on a per-sprite Z attribute. - * Each sprite has explicit placement/color/zoom controls. - */ -static GFXLAYOUT_RAW(sprite_layout, 32, 32, 32*8, 32*32*8) - /* text layer uses a set of 16x16x4bpp tiles defined in RAM */ #define XOR(a) WORD2_XOR_BE(a) static const gfx_layout namcos22_cg_layout = @@ -3597,6 +3591,12 @@ static const gfx_layout namcos22_cg_layout = #undef XOR +/* System Super22 supports a sprite layer. + * Sprites are rendered as part of the polygon draw list, based on a per-sprite Z attribute. + * Each sprite has explicit placement/color/zoom controls. + */ +static GFXLAYOUT_RAW(sprite_layout, 32, 32, 32*8, 32*32*8) + static GFXDECODE_START( gfx_namcos22 ) GFXDECODE_ENTRY( nullptr, 0, namcos22_cg_layout, 0, 0x800 ) GFXDECODE_ENTRY( "textile", 0, gfx_16x16x8_raw, 0, 0x80 ) diff --git a/src/mame/namco/namcos22_v.cpp b/src/mame/namco/namcos22_v.cpp index 2f98b767c97..d945346af4f 100644 --- a/src/mame/namco/namcos22_v.cpp +++ b/src/mame/namco/namcos22_v.cpp @@ -83,9 +83,9 @@ void namcos22_renderer::renderscanline_poly(int32_t scanline, const extent_t &ex { const int tx = int(u * ooz) & 0xfff; const int ty = (int(v * ooz) & 0xfff) | bn; - const int to = ((ty << 4) & 0xfff00) | (tx >> 4); - pen = ttdata[(ttmap[to] << 8) | tt_ayx_to_pixel[(ttattr[to] << 8) | ((ty << 4) & 0xf0) | (tx & 0xf)]]; - rgb.set(pens[(pen >> penshift) & penmask]); + const int to = (ty << 4 & 0xfff00) | (tx >> 4); + pen = ttdata[(ttmap[to] << 8) | tt_ayx_to_pixel[(ttattr[to] << 8) | (ty << 4 & 0xf0) | (tx & 0xf)]]; + rgb.set(pens[pen >> penshift & penmask]); } else rgb.set(0, 0xff, 0xff, 0xff); @@ -176,9 +176,9 @@ void namcos22_renderer::renderscanline_poly_ss22(int32_t scanline, const extent_ { const int tx = int(u * ooz) & 0xfff; const int ty = (int(v * ooz) & 0xfff) | bn; - const int to = ((ty << 4) & 0xfff00) | (tx >> 4); - pen = ttdata[(ttmap[to] << 8) | tt_ayx_to_pixel[(ttattr[to] << 8) | ((ty << 4) & 0xf0) | (tx & 0xf)]]; - rgb.set(pens[(pen >> penshift) & penmask]); + const int to = (ty << 4 & 0xfff00) | (tx >> 4); + pen = ttdata[(ttmap[to] << 8) | tt_ayx_to_pixel[(ttattr[to] << 8) | (ty << 4 & 0xf0) | (tx & 0xf)]]; + rgb.set(pens[pen >> penshift & penmask]); } else rgb.set(0, 0xff, 0xff, 0xff); @@ -697,7 +697,7 @@ float namcos22_state::dspfloat_to_nativefloat(u32 val) { const s16 mantissa = (s16)val; float result = (float)mantissa; - int exponent = (val >> 16) & 0x3f; + int exponent = val >> 16 & 0x3f; while (exponent < 0x2e) { result /= 2.0f; @@ -864,7 +864,7 @@ void namcos22_state::draw_direct_poly(const u16 *src) node->data.quad.texturebank = (src[1 + 4] & 0xf000) >> 12; } node->data.quad.color = (src[2] & 0xff00) >> 8; - node->data.quad.cz_value = (src[3] >> 2) & 0x1fff; + node->data.quad.cz_value = src[3] >> 2 & 0x1fff; node->data.quad.cz_type = src[3] & 3; node->data.quad.cz_adjust = 0; node->data.quad.objectflags = 0; @@ -1068,12 +1068,12 @@ void namcos22_state::blit_single_quad(u32 color, u32 addr, float m[4][4], int po else if (packetformat & 0x40) { // gourad shading - bri = (point_read(i + addr) >> 16) & 0xff; + bri = point_read(i + addr) >> 16 & 0xff; } else { // flat shading - bri = (color >> 16) & 0xff; + bri = color >> 16 & 0xff; } v[i].bri = bri; @@ -1081,11 +1081,11 @@ void namcos22_state::blit_single_quad(u32 color, u32 addr, float m[4][4], int po // allocate quad struct namcos22_scenenode *node = m_poly->new_scenenode(machine(), zsort, NAMCOS22_SCENENODE_QUAD); - node->data.quad.cmode = (v[0].u >> 12) & 0xf; - node->data.quad.texturebank = (v[0].v >> 12) & 0xf; - node->data.quad.color = (color >> 8) & 0xff; + node->data.quad.cmode = v[0].u >> 12 & 0xf; + node->data.quad.texturebank = v[0].v >> 12 & 0xf; + node->data.quad.color = color >> 8 & 0xff; node->data.quad.cz_value = cz_value >> 8; - node->data.quad.cz_type = (flags >> 10) & 3; + node->data.quad.cz_type = flags >> 10 & 3; node->data.quad.cz_adjust = m_cz_adjust; node->data.quad.objectflags = m_objectflags; @@ -1282,14 +1282,14 @@ void namcos22_state::slavesim_handle_bb0003(const s32 *src) 0000 7ffe 0000 0000 0000 7ffe */ - m_camera_ambient = (src[0x1] >> 16) & 0xffff; + m_camera_ambient = src[0x1] >> 16 & 0xffff; m_camera_power = src[0x1] & 0xffff; m_camera_lx = dspfixed_to_nativefloat(src[0x2]); m_camera_ly = dspfixed_to_nativefloat(src[0x3]); m_camera_lz = dspfixed_to_nativefloat(src[0x4]); - m_absolute_priority = (src[0x3] >> 16) & 0xffff; + m_absolute_priority = src[0x3] >> 16 & 0xffff; m_camera_vx = signed12(src[0x5] >> 16); m_camera_vy = signed12(src[0x5] & 0xffff); m_camera_zoom = dspfloat_to_nativefloat(src[0x6]); @@ -1298,7 +1298,7 @@ void namcos22_state::slavesim_handle_bb0003(const s32 *src) m_camera_vu = dspfloat_to_nativefloat(src[0x9]) * m_camera_zoom - 0.5f; m_camera_vd = dspfloat_to_nativefloat(src[0xa]) * m_camera_zoom - 0.5f; - m_reflection = (src[0x2] >> 16) & 0x30; // z too? + m_reflection = src[0x2] >> 16 & 0x30; // z too? m_cullflip = (m_reflection == 0x10 || m_reflection == 0x20); if (BIT(m_reflection, 4)) @@ -1607,17 +1607,17 @@ void namcos22_state::draw_sprite_group(const u32 *src, const u32 *attr, int num_ int ypos = (src[0] & 0xffff) - deltay; int sizex = src[1] >> 16; int sizey = src[1] & 0xffff; - const int flipy = (src[2] >> 3) & 0x1; + const int flipy = BIT(src[2], 3); int rows = src[2] & 0x7; - const int linktype = (src[2] & 0x00ff0000) >> 16; - const int flipx = (src[2] >> 7) & 0x1; - int cols = (src[2] >> 4) & 0x7; + const int linktype = src[2] >> 16 & 0xff; + const int flipx = BIT(src[2], 7); + int cols = src[2] >> 4 & 0x7; const u32 code = src[3]; const int tile = code >> 16; - const int alpha = (code & 0xff00) >> 8; + const int alpha = code >> 8 & 0xff; const u32 zcoord = attr[0] & 0x00ffffff; - const int color = (attr[1] >> 16) & 0xff; + const int color = attr[1] >> 16 & 0xff; const int cz = attr[1] & 0xff; // one of these is to override global fade setting? @@ -1628,7 +1628,7 @@ void namcos22_state::draw_sprite_group(const u32 *src, const u32 *attr, int num_ const int prioverchar = (cz == 0xfe) ? 1 : 0; // set window clipping - const int clip = (src[2] >> 23) & 0xe; + const int clip = src[2] >> 23 & 0xe; const int cx_min = -deltax + (s16)(m_spriteram[0x80|clip] >> 16); const int cx_max = -deltax + (s16)(m_spriteram[0x80|clip] & 0xffff); const int cy_min = -deltay + (s16)(m_spriteram[0x81|clip] >> 16); @@ -1788,7 +1788,7 @@ void namcos22_state::draw_sprites() // where do the games store the number of sprites to be processed by vics??? // the current default implementation (using spritelist size) is clearly wrong and causes problems in dirtdash and airco22b - num_sprites = (m_vics_control[0x40/4] >> 4) & 0x1ff; // no +1 + num_sprites = m_vics_control[0x40/4] >> 4 & 0x1ff; // no +1 // dirtdash sprite list starts at xxx4, number of sprites is stored in xxx0, it doesn't use set#2 if (m_gametype == NAMCOS22_DIRT_DASH) @@ -1801,7 +1801,7 @@ void namcos22_state::draw_sprites() draw_sprite_group(src, attr, num_sprites, deltax, deltay, y_lowres); } - num_sprites = (m_vics_control[0x60/4] >> 4) & 0x1ff; // no +1 + num_sprites = m_vics_control[0x60/4] >> 4 & 0x1ff; // no +1 // airco22b number of sprites for set#2 is stored in set#1 - it does not use set 1, or main set for sprites if (m_gametype == NAMCOS22_AIR_COMBAT22) @@ -1987,7 +1987,7 @@ u16 namcos22s_state::spotram_r(offs_t offset) if (offset == 2) { // read - const u16 ret = m_spotram[(m_spotram_address >> 1) & 0x7ff]; + const u16 ret = m_spotram[m_spotram_address >> 1 & 0x7ff]; if (!machine().side_effects_disabled()) m_spotram_address += 2; @@ -2009,7 +2009,7 @@ void namcos22s_state::spotram_w(offs_t offset, u16 data, u16 mem_mask) case 1: // write - COMBINE_DATA(&m_spotram[(m_spotram_address >> 1) & 0x7ff]); + COMBINE_DATA(&m_spotram[m_spotram_address >> 1 & 0x7ff]); m_spotram_address += 2; break; @@ -2039,7 +2039,7 @@ void namcos22s_state::namcos22s_mix_text_layer(screen_device &screen, bitmap_rgb // prepare spot const bool spot_enabled = BIT(m_spotram_enable, 0) && (m_chipselect & 0xc000); const int spot_factor = (m_spot_factor < 0x100) ? 0 : m_spot_factor & 0xff; - const int spot_palbase = (m_text_palbase >> 8) & 3; // (src[x] >> 8) & 3 + const int spot_palbase = m_text_palbase >> 8 & 3; // src[x] >> 8 & 3 // prepare fader const bool fade_enabled = BIT(m_mixer_flags, 1) && m_screen_fade_factor; @@ -2160,7 +2160,7 @@ void namcos22_state::namcos22_mix_text_layer(screen_device &screen, bitmap_rgb32 } // apply gamma - dest[x] = (rlut[(pixel >> 16) & 0xff] << 16) | (glut[(pixel >> 8) & 0xff] << 8) | blut[pixel & 0xff]; + dest[x] = (rlut[pixel >> 16 & 0xff] << 16) | (glut[pixel >> 8 & 0xff] << 8) | blut[pixel & 0xff]; } } } @@ -2540,8 +2540,8 @@ u32 namcos22s_state::screen_update_namcos22s(screen_device &screen, bitmap_rgb32 for (int x = cliprect.left(); x <= cliprect.right(); x++) { const u32 rgb = dest[x]; - const u8 r = rlut[NATIVE_ENDIAN_VALUE_LE_BE(3, 0) ^ ((rgb >> 16) & 0xff)]; - const u8 g = glut[NATIVE_ENDIAN_VALUE_LE_BE(3, 0) ^ ((rgb >> 8) & 0xff)]; + const u8 r = rlut[NATIVE_ENDIAN_VALUE_LE_BE(3, 0) ^ (rgb >> 16 & 0xff)]; + const u8 g = glut[NATIVE_ENDIAN_VALUE_LE_BE(3, 0) ^ (rgb >> 8 & 0xff)]; const u8 b = blut[NATIVE_ENDIAN_VALUE_LE_BE(3, 0) ^ (rgb & 0xff)]; dest[x] = (r << 16) | (g << 8) | b; } diff --git a/src/mame/namco/namcos23.cpp b/src/mame/namco/namcos23.cpp index afea5a47b74..8d5a41159d9 100644 --- a/src/mame/namco/namcos23.cpp +++ b/src/mame/namco/namcos23.cpp @@ -6050,28 +6050,6 @@ TIMER_CALLBACK_MEMBER(namcos23_gmen_state::sh2_irq_off) #define XOR(a) WORD2_XOR_BE(a) - -static const gfx_layout namcos23_sprite_layout = -{ - 32,32, - RGN_FRAC(1,1), - 8, - { 0,1,2,3,4,5,6,7 }, - { - 0*8,1*8,2*8,3*8,4*8,5*8,6*8,7*8, - 8*8,9*8,10*8,11*8,12*8,13*8,14*8,15*8, - 16*8,17*8,18*8,19*8,20*8,21*8,22*8,23*8, - 24*8,25*8,26*8,27*8,28*8,29*8,30*8,31*8 - }, - { - 0*32*8,1*32*8,2*32*8,3*32*8,4*32*8,5*32*8,6*32*8,7*32*8, - 8*32*8,9*32*8,10*32*8,11*32*8,12*32*8,13*32*8,14*32*8,15*32*8, - 16*32*8,17*32*8,18*32*8,19*32*8,20*32*8,21*32*8,22*32*8,23*32*8, - 24*32*8,25*32*8,26*32*8,27*32*8,28*32*8,29*32*8,30*32*8,31*32*8 - }, - 32*32*8 -}; - static const gfx_layout namcos23_cg_layout = { 16,16, @@ -6084,43 +6062,19 @@ static const gfx_layout namcos23_cg_layout = 64*16 }; /* cg_layout */ -static const gfx_layout namcos23_textile_layout = -{ - 16,16, - RGN_FRAC(1,1), - 8, - { 0,1,2,3,4,5,6,7 }, - { - 0*8,1*8,2*8,3*8,4*8,5*8,6*8,7*8,8*8,9*8,10*8,11*8,12*8,13*8,14*8,15*8 - }, - { - 0*16*8,1*16*8,2*16*8,3*16*8,4*16*8,5*16*8,6*16*8,7*16*8, - 8*16*8,9*16*8,10*16*8,11*16*8,12*16*8,13*16*8,14*16*8,15*16*8 - }, - 16*16*8 -}; /* textile_layout */ +#undef XOR -static const gfx_layout namcos23_texram_layout = -{ - 16,16, - 0x400, /* 0x3c0 */ - 4, - { 0,1,2,3 }, - { XOR(0)*4, XOR(1)*4, XOR(2)*4, XOR(3)*4, XOR(4)*4, XOR(5)*4, XOR(6)*4, XOR(7)*4, - XOR(8)*4, XOR(9)*4, XOR(10)*4, XOR(11)*4, XOR(12)*4, XOR(13)*4, XOR(14)*4, XOR(15)*4 }, - { 64*0,64*1,64*2,64*3,64*4,64*5,64*6,64*7,64*8,64*9,64*10,64*11,64*12,64*13,64*14,64*15 }, - 64*16 -}; /* cg_layout */ +static GFXLAYOUT_RAW(namcos23_sprite_layout, 32, 32, 32*8, 32*32*8) static GFXDECODE_START( gfx_namcos23 ) - GFXDECODE_ENTRY( nullptr, 0, namcos23_cg_layout, 0, 0x800 ) - GFXDECODE_ENTRY( "textile", 0, namcos23_textile_layout, 0, 0x80 ) + GFXDECODE_ENTRY( nullptr, 0, namcos23_cg_layout, 0, 0x800 ) + GFXDECODE_ENTRY( "textile", 0, gfx_16x16x8_raw, 0, 0x80 ) GFXDECODE_END static GFXDECODE_START( gfx_gorgon ) GFXDECODE_ENTRY( nullptr, 0, namcos23_cg_layout, 0, 0x800 ) - GFXDECODE_ENTRY( "textile", 0, namcos23_textile_layout, 0, 0x80 ) - GFXDECODE_ENTRY( "sprites", 0, namcos23_sprite_layout, 0, 0x80 ) + GFXDECODE_ENTRY( "textile", 0, gfx_16x16x8_raw, 0, 0x80 ) + GFXDECODE_ENTRY( "sprites", 0, namcos23_sprite_layout, 0, 0x80 ) GFXDECODE_END void gorgon_state::gorgon(machine_config &config) -- cgit v1.2.3