// license:BSD-3-Clause // copyright-holders:David Haywood /* Tecmo Mixer */ #ifndef MAME_VIDEO_TECMO_MIX_H #define MAME_VIDEO_TECMO_MIX_H #pragma once #include "emupal.h" class tecmo_mix_device : public device_t, public device_video_interface { public: tecmo_mix_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock); void 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); void set_mixer_shifts(int sprpri_shift, int sprbln_shift, int sprcol_shift) { m_sprpri_shift = sprpri_shift; m_sprbln_shift = sprbln_shift; m_sprcol_shift = sprcol_shift; } void set_blendcols(int bgblend_comp, int fgblend_comp, int txblend_comp, int spblend_comp) { m_bgblend_comp = bgblend_comp; m_fgblend_comp = fgblend_comp; m_txblend_comp = txblend_comp; m_spblend_comp = spblend_comp; } void set_regularcols(int bgregular_comp, int fgregular_comp, int txregular_comp, int spregular_comp) { m_bgregular_comp = bgregular_comp; m_fgregular_comp = fgregular_comp; m_txregular_comp = txregular_comp; m_spregular_comp = spregular_comp; } void set_blendsource(int spblend_source, int fgblend_source) { m_spblend_source = spblend_source; m_fgblend_source = fgblend_source; } void set_revspritetile() { m_revspritetile = 3; } void set_bgpen(int bgpen) { m_bgpen = bgpen; } protected: virtual void device_start() override; virtual void device_reset() override; // mixer shifts int m_sprpri_shift; int m_sprbln_shift; int m_sprcol_shift; // when the blend bit is specified in the attribute the source blend palette for that sprite / fg pixel comes from these offsets instead int m_spblend_source; int m_fgblend_source; // the second blend component depends on the pixel we are blending with, the following palettes get used instead of the regular ones int m_bgblend_comp; int m_fgblend_comp; int m_txblend_comp; int m_spblend_comp; // otherwise the regular palettes are int m_bgregular_comp; int m_fgregular_comp; int m_txregular_comp; int m_spregular_comp; int m_revspritetile; int m_bgpen; private: uint32_t sum_colors(const pen_t *pal, int c1_idx, int c2_idx); }; DECLARE_DEVICE_TYPE(TECMO_MIXER, tecmo_mix_device) #define MCFG_TECMO_MIXER_SHIFTS(_sprpri_shift, _sprbln_shift, _sprcol_shift) \ downcast(*device).set_mixer_shifts(_sprpri_shift, _sprbln_shift, _sprcol_shift); #define MCFG_TECMO_MIXER_BLENDCOLS(_bgblend_comp, _fgblend_comp, _txblend_comp, _spblend_comp) \ downcast(*device).set_blendcols(_bgblend_comp, _fgblend_comp, _txblend_comp, _spblend_comp); #define MCFG_TECMO_MIXER_REGULARCOLS(_bgregular_comp, _fgregular_comp, _txregular_comp, _spregular_comp) \ downcast(*device).set_regularcols(_bgregular_comp, _fgregular_comp, _txregular_comp, _spregular_comp); #define MCFG_TECMO_MIXER_BLENDSOURCE(_spblend_source, _fgblend_source) \ downcast(*device).set_blendsource(_spblend_source, _fgblend_source); #define MCFG_TECMO_MIXER_REVSPRITETILE \ downcast(*device).set_revspritetile(); #define MCFG_TECMO_MIXER_BGPEN(_bgpen) \ downcast(*device).set_bgpen(_bgpen); #endif // MAME_VIDEO_TECMO_MIX_H