summaryrefslogtreecommitdiffstatshomepage
path: root/src/mame/video/overdriv.c
blob: 31df37cab849262791db49ee01e47a967f484a0d (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
#include "emu.h"
#include "video/konicdev.h"
#include "includes/overdriv.h"

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

  Callbacks for the K053247

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

void overdriv_sprite_callback( running_machine &machine, int *code, int *color, int *priority_mask )
{
	overdriv_state *state = machine.driver_data<overdriv_state>();
	int pri = (*color & 0xffe0) >> 5;	/* ??????? */
	if (pri)
		*priority_mask = 0x02;
	else
		*priority_mask = 0x00;

	*color = state->m_sprite_colorbase + (*color & 0x001f);
}


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

  Callbacks for the K051316

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

void overdriv_zoom_callback_0( running_machine &machine, int *code, int *color, int *flags )
{
	overdriv_state *state = machine.driver_data<overdriv_state>();
	*flags = (*color & 0x40) ? TILE_FLIPX : 0;
	*code |= ((*color & 0x03) << 8);
	*color = state->m_zoom_colorbase[0] + ((*color & 0x3c) >> 2);
}

void overdriv_zoom_callback_1( running_machine &machine, int *code, int *color, int *flags )
{
	overdriv_state *state = machine.driver_data<overdriv_state>();
	*flags = (*color & 0x40) ? TILE_FLIPX : 0;
	*code |= ((*color & 0x03) << 8);
	*color = state->m_zoom_colorbase[1] + ((*color & 0x3c) >> 2);
}


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

  Display refresh

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

SCREEN_UPDATE( overdriv )
{
	overdriv_state *state = screen->machine().driver_data<overdriv_state>();

	state->m_sprite_colorbase  = k053251_get_palette_index(state->m_k053251, K053251_CI0);
	state->m_road_colorbase[1] = k053251_get_palette_index(state->m_k053251, K053251_CI1);
	state->m_road_colorbase[0] = k053251_get_palette_index(state->m_k053251, K053251_CI2);
	state->m_zoom_colorbase[1] = k053251_get_palette_index(state->m_k053251, K053251_CI3);
	state->m_zoom_colorbase[0] = k053251_get_palette_index(state->m_k053251, K053251_CI4);

	bitmap_fill(screen->machine().priority_bitmap, cliprect, 0);

	k051316_zoom_draw(state->m_k051316_1, bitmap, cliprect, 0, 0);
	k051316_zoom_draw(state->m_k051316_2, bitmap, cliprect, 0, 1);

	k053247_sprites_draw(state->m_k053246, bitmap,cliprect);
	return 0;
}