summaryrefslogblamecommitdiffstatshomepage
path: root/src/mame/video/battlnts.c
blob: 43d57f21b8da6495921b07af2b925c505f5eaf4b (plain) (tree)
1
2
3
4
5
6
7
8
9
10
                
                           
                              






                                                                            
                                                                                                             
 
                                                                      
 
                                                                 
                                                 







                                                                            
                                                                             
 
                                                                      
 
                                                              





                                                      
                                                                               
                                                







                                                                            
                         
 
                                                                                
 
                                                 
 


                                                                                                

                 
#include "emu.h"
#include "video/konicdev.h"
#include "includes/battlnts.h"

/***************************************************************************

  Callback for the K007342

***************************************************************************/

void battlnts_tile_callback(running_machine &machine, int layer, int bank, int *code, int *color, int *flags)
{
	battlnts_state *state = machine.driver_data<battlnts_state>();

	*code |= ((*color & 0x0f) << 9) | ((*color & 0x40) << 2);
	*color = state->m_layer_colorbase[layer];
}

/***************************************************************************

  Callback for the K007420

***************************************************************************/

void battlnts_sprite_callback(running_machine &machine, int *code,int *color)
{
	battlnts_state *state = machine.driver_data<battlnts_state>();

	*code |= ((*color & 0xc0) << 2) | state->m_spritebank;
	*code = (*code << 2) | ((*color & 0x30) >> 4);
	*color = 0;
}

WRITE8_HANDLER( battlnts_spritebank_w )
{
	battlnts_state *state = space->machine().driver_data<battlnts_state>();
	state->m_spritebank = 1024 * (data & 1);
}

/***************************************************************************

  Screen Refresh

***************************************************************************/

SCREEN_UPDATE( battlnts )
{
	battlnts_state *state = screen->machine().driver_data<battlnts_state>();

	k007342_tilemap_update(state->m_k007342);

	k007342_tilemap_draw(state->m_k007342, bitmap, cliprect, 0, TILEMAP_DRAW_OPAQUE ,0);
	k007420_sprites_draw(state->m_k007420, bitmap, cliprect, screen->machine().gfx[1]);
	k007342_tilemap_draw(state->m_k007342, bitmap, cliprect, 0, 1 | TILEMAP_DRAW_OPAQUE ,0);
	return 0;
}