summaryrefslogtreecommitdiffstatshomepage
path: root/src/mame/video/88games.c
blob: 04c9f93507e722daaa8358c92848c5980f45033b (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
71
72
73
74
75
76
77
78
79
80
81
82
83
#include "emu.h"
#include "video/konicdev.h"
#include "includes/88games.h"


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

  Callbacks for the K052109

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

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

	*code |= ((*color & 0x0f) << 8) | (bank << 12);
	*color = state->m_layer_colorbase[layer] + ((*color & 0xf0) >> 4);
}


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

  Callbacks for the K051960

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

void _88games_sprite_callback( running_machine &machine, int *code, int *color, int *priority, int *shadow )
{
	_88games_state *state = machine.driver_data<_88games_state>();

	*priority = (*color & 0x20) >> 5;	/* ??? */
	*color = state->m_sprite_colorbase + (*color & 0x0f);
}


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

  Callbacks for the K051316

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

void _88games_zoom_callback( running_machine &machine, int *code, int *color, int *flags )
{
	_88games_state *state = machine.driver_data<_88games_state>();

	*flags = (*color & 0x40) ? TILE_FLIPX : 0;
	*code |= ((*color & 0x07) << 8);
	*color = state->m_zoom_colorbase + ((*color & 0x38) >> 3) + ((*color & 0x80) >> 4);
}

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

  Display refresh

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

SCREEN_UPDATE( 88games )
{
	_88games_state *state = screen->machine().driver_data<_88games_state>();

	k052109_tilemap_update(state->m_k052109);

	if (state->m_k88games_priority)
	{
		k052109_tilemap_draw(state->m_k052109, bitmap, cliprect, 0, TILEMAP_DRAW_OPAQUE, 0);	// tile 0
		k051960_sprites_draw(state->m_k051960, bitmap,cliprect, 1, 1);
		k052109_tilemap_draw(state->m_k052109, bitmap, cliprect, 2, 0, 0);	// tile 2
		k052109_tilemap_draw(state->m_k052109, bitmap, cliprect, 1, 0, 0);	// tile 1
		k051960_sprites_draw(state->m_k051960, bitmap, cliprect, 0, 0);
		k051316_zoom_draw(state->m_k051316, bitmap, cliprect, 0, 0);
	}
	else
	{
		k052109_tilemap_draw(state->m_k052109, bitmap, cliprect, 2, TILEMAP_DRAW_OPAQUE, 0);	// tile 2
		k051316_zoom_draw(state->m_k051316, bitmap, cliprect, 0, 0);
		k051960_sprites_draw(state->m_k051960, bitmap, cliprect, 0, 0);
		k052109_tilemap_draw(state->m_k052109, bitmap, cliprect, 1, 0, 0);	// tile 1
		k051960_sprites_draw(state->m_k051960, bitmap, cliprect, 1, 1);
		k052109_tilemap_draw(state->m_k052109, bitmap, cliprect, 0, 0, 0);	// tile 0
	}

	return 0;
}