mirror of
https://github.com/holub/mame
synced 2025-04-23 08:49:55 +03:00
tecmo_mix: Fixed the saturated colors in Final Star Force (Level 2) (#1823)
* tecmo_mix: Fixed macro typo; renamed MCFG_TECMO_MIXER_BLENDSOUCE to MCFG_TECMO_MIXER_BLENDSOURCE (nw) * tecmo_mix: Fixed the 'direct sum' of two ARGB colors. This corrected the wrong 'saturated colors' in Final Star Force (level2: tank underwater, final boss) * tecmo16: Added a video reference for the title screen issue * sum_colors: Corrected some mistakes * sum_colors: Added extra parenthesis to std::min, removed 'extra spaces' (nw)
This commit is contained in:
parent
7a15fc8978
commit
6dcc7276b7
@ -774,7 +774,7 @@ static MACHINE_CONFIG_START( shadoww, gaiden_state )
|
||||
MCFG_TECMO_MIXER_SHIFTS(10,9,4)
|
||||
MCFG_TECMO_MIXER_BLENDCOLS( 0x0400 + 0x300, 0x0400 + 0x200, 0x0400 + 0x100, 0x0400 + 0x000 )
|
||||
MCFG_TECMO_MIXER_REGULARCOLS( 0x0000 + 0x300, 0x0000 + 0x200, 0x0000 + 0x100, 0x0000 + 0x000 )
|
||||
MCFG_TECMO_MIXER_BLENDSOUCE( 0x0800 + 0x000, 0x0800 + 0x200)
|
||||
MCFG_TECMO_MIXER_BLENDSOURCE( 0x0800 + 0x000, 0x0800 + 0x200)
|
||||
MCFG_TECMO_MIXER_REVSPRITETILE
|
||||
MCFG_TECMO_MIXER_BGPEN(0x000 + 0x200)
|
||||
|
||||
|
@ -432,7 +432,7 @@ static MACHINE_CONFIG_START( spbactn, spbactn_state )
|
||||
MCFG_TECMO_MIXER_SHIFTS(8,10,4)
|
||||
MCFG_TECMO_MIXER_BLENDCOLS( 0x0000 + 0x300, 0x0000 + 0x200, 0x0000 + 0x100, 0x0000 + 0x000 )
|
||||
MCFG_TECMO_MIXER_REGULARCOLS( 0x0800 + 0x300, 0x0800 + 0x200, 0x0800 + 0x100, 0x0800 + 0x000 )
|
||||
MCFG_TECMO_MIXER_BLENDSOUCE( 0x1000 + 0x000, 0x1000 + 0x100)
|
||||
MCFG_TECMO_MIXER_BLENDSOURCE( 0x1000 + 0x000, 0x1000 + 0x100)
|
||||
MCFG_TECMO_MIXER_BGPEN(0x800 + 0x300)
|
||||
|
||||
/* sound hardware */
|
||||
@ -485,7 +485,7 @@ static MACHINE_CONFIG_START( spbactnp, spbactn_state )
|
||||
MCFG_TECMO_MIXER_SHIFTS(12,14,8)
|
||||
MCFG_TECMO_MIXER_BLENDCOLS( 0x0000 + 0x300, 0x0000 + 0x200, 0x0000 + 0x100, 0x0000 + 0x000 )
|
||||
MCFG_TECMO_MIXER_REGULARCOLS( 0x0800 + 0x300, 0x0800 + 0x200, 0x0800 + 0x100, 0x0800 + 0x000 )
|
||||
MCFG_TECMO_MIXER_BLENDSOUCE( 0x1000 + 0x000, 0x1000 + 0x100)
|
||||
MCFG_TECMO_MIXER_BLENDSOURCE( 0x1000 + 0x000, 0x1000 + 0x100)
|
||||
MCFG_TECMO_MIXER_BGPEN(0x800 + 0x300)
|
||||
|
||||
/* sound hardware - different? */
|
||||
|
@ -13,7 +13,7 @@ driver by Hau, Nicola Salmoria
|
||||
special thanks to Nekomata, NTD & code-name'Siberia'
|
||||
|
||||
TODO:
|
||||
- wrong background in fstarfrc title
|
||||
- wrong background in fstarfrc title (Video ref. -> https://www.youtube.com/watch?v=EXBTNk-0ejk)
|
||||
- there could be some priorities problems in riot
|
||||
(more noticeable in level 2)
|
||||
|
||||
@ -397,7 +397,7 @@ static MACHINE_CONFIG_START( fstarfrc, tecmo16_state )
|
||||
MCFG_TECMO_MIXER_SHIFTS(10,9,4)
|
||||
MCFG_TECMO_MIXER_BLENDCOLS( 0x0400 + 0x300, 0x0400 + 0x200, 0x0400 + 0x100, 0x0400 + 0x000 )
|
||||
MCFG_TECMO_MIXER_REGULARCOLS( 0x0000 + 0x300, 0x0000 + 0x200, 0x0000 + 0x100, 0x0000 + 0x000 )
|
||||
MCFG_TECMO_MIXER_BLENDSOUCE( 0x0800 + 0x000, 0x0800 + 0x100) // riot seems to set palettes in 0x800 + 0x200, could be more to this..
|
||||
MCFG_TECMO_MIXER_BLENDSOURCE( 0x0800 + 0x000, 0x0800 + 0x100) // riot seems to set palettes in 0x800 + 0x200, could be more to this..
|
||||
MCFG_TECMO_MIXER_REVSPRITETILE
|
||||
MCFG_TECMO_MIXER_BGPEN(0x000 + 0x300)
|
||||
|
||||
|
@ -89,6 +89,28 @@ void tecmo_mix_device::set_bgpen(device_t &device, int bgpen)
|
||||
dev.m_bgpen = bgpen;
|
||||
}
|
||||
|
||||
uint32_t tecmo_mix_device::sum_colors (const pen_t *pal, int c1_idx, int c2_idx)
|
||||
{
|
||||
const pen_t c1 = pal[c1_idx];
|
||||
const pen_t c2 = pal[c2_idx];
|
||||
|
||||
const int c1_a = (c1 >> 24) & 0xFF;
|
||||
const int c1_r = (c1 >> 16) & 0xFF;
|
||||
const int c1_g = (c1 >> 8) & 0xFF;
|
||||
const int c1_b = c1 & 0xFF;
|
||||
|
||||
const int c2_a = (c2 >> 24) & 0xFF;
|
||||
const int c2_r = (c2 >> 16) & 0xFF;
|
||||
const int c2_g = (c2 >> 8) & 0xFF;
|
||||
const int c2_b = c2 & 0xFF;
|
||||
|
||||
const uint8_t a = (std::min)(0xFF, c1_a + c2_a);
|
||||
const uint8_t r = (std::min)(0xFF, c1_r + c2_r);
|
||||
const uint8_t g = (std::min)(0xFF, c1_g + c2_g);
|
||||
const uint8_t b = (std::min)(0xFF, c1_b + c2_b);
|
||||
|
||||
return ((a << 24) | (r << 16) | (g << 8) | b);
|
||||
}
|
||||
|
||||
void tecmo_mix_device::mix_bitmaps(screen_device &screen, bitmap_rgb32 &bitmap, const rectangle &cliprect, palette_device &palette, bitmap_ind16* bitmap_bg, bitmap_ind16* bitmap_fg, bitmap_ind16* bitmap_tx, bitmap_ind16* bitmap_sp)
|
||||
{
|
||||
@ -113,7 +135,6 @@ void tecmo_mix_device::mix_bitmaps(screen_device &screen, bitmap_rgb32 &bitmap,
|
||||
uint16_t m_sprbln = (sprpixel >> m_sprbln_shift) & 0x1;
|
||||
uint16_t m_sprcol = (sprpixel >> m_sprcol_shift) & 0xf;
|
||||
|
||||
|
||||
sprpixel = (sprpixel & 0xf) | (m_sprcol << 4);
|
||||
|
||||
//sprpixel &= 0xff;
|
||||
@ -157,7 +178,6 @@ void tecmo_mix_device::mix_bitmaps(screen_device &screen, bitmap_rgb32 &bitmap,
|
||||
// solid sprite
|
||||
dd[x] = paldata[sprpixel + m_spregular_comp];
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
else if (m_sprpri == (1 ^ m_revspritetile)) // above bg, behind tx, fg
|
||||
@ -171,12 +191,12 @@ void tecmo_mix_device::mix_bitmaps(screen_device &screen, bitmap_rgb32 &bitmap,
|
||||
// needs if bgpixel & 0xf check?
|
||||
|
||||
// fg is used and blended with sprite, sprite is used and blended with bg? -- used on 'trail' of ball when ball is under the transparent area
|
||||
dd[x] = paldata[bgpixel + m_bgblend_comp] + paldata[sprpixel + m_spblend_source]; // WRONG??
|
||||
dd[x] = sum_colors (paldata, bgpixel + m_bgblend_comp, sprpixel + m_spblend_source); // WRONG??
|
||||
}
|
||||
else
|
||||
{
|
||||
// fg is used and blended with opaque sprite
|
||||
dd[x] = paldata[fgpixel + m_fgblend_source] + paldata[sprpixel + m_spblend_comp];
|
||||
dd[x] = sum_colors (paldata, fgpixel + m_fgblend_source, sprpixel + m_spblend_comp);
|
||||
}
|
||||
}
|
||||
else
|
||||
@ -184,7 +204,6 @@ void tecmo_mix_device::mix_bitmaps(screen_device &screen, bitmap_rgb32 &bitmap,
|
||||
// fg is used and opaque
|
||||
dd[x] = paldata[fgpixel + m_fgregular_comp];
|
||||
}
|
||||
|
||||
}
|
||||
else
|
||||
{
|
||||
@ -193,7 +212,7 @@ void tecmo_mix_device::mix_bitmaps(screen_device &screen, bitmap_rgb32 &bitmap,
|
||||
// needs if bgpixel & 0xf check?
|
||||
|
||||
//fg isn't used, sprite is used and blended with bg? -- used on trail of ball / flippers (looks odd) -- some ninja gaiden enemy deaths (when behind fg) (looks ok?) (maybe we need to check for colour saturation?)
|
||||
dd[x] = paldata[bgpixel + m_bgblend_comp] + paldata[sprpixel + m_spblend_source];
|
||||
dd[x] = sum_colors (paldata, bgpixel + m_bgblend_comp, sprpixel + m_spblend_source);
|
||||
}
|
||||
else
|
||||
{
|
||||
@ -201,8 +220,6 @@ void tecmo_mix_device::mix_bitmaps(screen_device &screen, bitmap_rgb32 &bitmap,
|
||||
dd[x] = paldata[sprpixel + m_spregular_comp];
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
else if (m_sprpri == (2 ^ m_revspritetile)) // above bg,fg, behind tx
|
||||
{
|
||||
@ -218,18 +235,15 @@ void tecmo_mix_device::mix_bitmaps(screen_device &screen, bitmap_rgb32 &bitmap,
|
||||
else
|
||||
{
|
||||
// blended sprite over solid fgpixel?
|
||||
dd[x] = paldata[fgpixel + m_fgblend_comp] + paldata[sprpixel + m_spblend_source];
|
||||
dd[x] = sum_colors (paldata, fgpixel + m_fgblend_comp, sprpixel + m_spblend_source);
|
||||
}
|
||||
}
|
||||
else // needs if bgpixel & 0xf check?
|
||||
{
|
||||
// blended sprite over solid bg pixel
|
||||
dd[x] = paldata[bgpixel + m_bgblend_comp] + paldata[sprpixel + m_spblend_source];
|
||||
// dd[x] = rand();
|
||||
dd[x] = sum_colors (paldata, bgpixel + m_bgblend_comp, sprpixel + m_spblend_source);
|
||||
// dd[x] = rand();
|
||||
}
|
||||
|
||||
|
||||
|
||||
}
|
||||
else
|
||||
{
|
||||
@ -261,14 +275,13 @@ void tecmo_mix_device::mix_bitmaps(screen_device &screen, bitmap_rgb32 &bitmap,
|
||||
if (fgbln)
|
||||
{
|
||||
// needs if bgpixel & 0xf check?
|
||||
dd[x] = paldata[fgpixel + m_fgblend_source] + paldata[bgpixel + m_bgblend_comp];
|
||||
dd[x] = sum_colors (paldata, fgpixel + m_fgblend_source, bgpixel + m_bgblend_comp);
|
||||
|
||||
}
|
||||
else
|
||||
{
|
||||
dd[x] = paldata[fgpixel + m_fgregular_comp];
|
||||
}
|
||||
|
||||
}
|
||||
else if (bgpixel & 0x0f)
|
||||
{
|
||||
|
@ -46,9 +46,7 @@ protected:
|
||||
int m_bgpen;
|
||||
|
||||
private:
|
||||
|
||||
|
||||
|
||||
uint32_t sum_colors (const pen_t *pal, int c1_idx, int c2_idx);
|
||||
};
|
||||
|
||||
extern const device_type TECMO_MIXER;
|
||||
@ -64,7 +62,7 @@ extern const device_type TECMO_MIXER;
|
||||
#define MCFG_TECMO_MIXER_REGULARCOLS(_bgregular_comp, _fgregular_comp, _txregular_comp, _spregular_comp) \
|
||||
tecmo_mix_device::set_regularcols(*device, _bgregular_comp, _fgregular_comp, _txregular_comp, _spregular_comp);
|
||||
|
||||
#define MCFG_TECMO_MIXER_BLENDSOUCE(_spblend_source, _fgblend_source) \
|
||||
#define MCFG_TECMO_MIXER_BLENDSOURCE(_spblend_source, _fgblend_source) \
|
||||
tecmo_mix_device::set_blendsource(*device, _spblend_source, _fgblend_source);
|
||||
|
||||
#define MCFG_TECMO_MIXER_REVSPRITETILE \
|
||||
|
Loading…
Reference in New Issue
Block a user