summaryrefslogtreecommitdiffstatshomepage
path: root/src/mame/video/sshangha.c
blob: b111c30e1939673f05d10a1dfa56f40ee3c9327b (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
/***************************************************************************

    Uses Data East custom chip 55 for backgrounds, with a special 8bpp mode
    2 times custom chips 52/71 for sprites.

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

#include "emu.h"
#include "includes/sshangha.h"
#include "video/decospr.h"

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

WRITE16_HANDLER (sshangha_video_w)
{
	sshangha_state *state = space->machine().driver_data<sshangha_state>();
	/* 0x4: Special video mode, other bits unknown */
	state->m_video_control=data;
//  popmessage("%04x",data);
}

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

VIDEO_START( sshangha )
{
	machine.device<decospr_device>("spritegen1")->alloc_sprite_bitmap(machine);
	machine.device<decospr_device>("spritegen2")->alloc_sprite_bitmap(machine);
}

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

SCREEN_UPDATE( sshangha )
{
	sshangha_state *state = screen->machine().driver_data<sshangha_state>();

	screen->machine().device<decospr_device>("spritegen1")->draw_sprites(screen->machine(), bitmap, cliprect, screen->machine().generic.spriteram.u16, 0x800, true);

	// I'm pretty sure only the original has the 2nd spriteram, used for the Japanese text on the 2nd scene (non-scrolling text) in the intro of the quest (3rd in JPN) mode
	if (screen->machine().generic.spriteram2.u16)
		screen->machine().device<decospr_device>("spritegen2")->draw_sprites(screen->machine(), bitmap, cliprect, screen->machine().generic.spriteram2.u16, 0x800, true);

	tilemap_set_flip_all(screen->machine(),flip_screen_x_get(screen->machine()) ? (TILEMAP_FLIPY | TILEMAP_FLIPX) : 0);

	bitmap_fill(bitmap,cliprect,get_black_pen(screen->machine()));

	deco16ic_pf_update(state->m_deco_tilegen1, state->m_pf1_rowscroll, state->m_pf2_rowscroll);
	
	/* the tilemap 4bpp + 4bpp = 8bpp mixing actually seems external to the tilemap, note video_control is not part of the tilemap chip */
	if ((state->m_video_control&4)==0) {
		deco16ic_tilemap_12_combine_draw(state->m_deco_tilegen1, bitmap, cliprect, 0, 0, 1);
		screen->machine().device<decospr_device>("spritegen1")->inefficient_copy_sprite_bitmap(screen->machine(), bitmap, cliprect, 0x0200, 0x0200, 0x100, 0x1ff);
	}
	else {

		deco16ic_tilemap_2_draw(state->m_deco_tilegen1, bitmap, cliprect, 0, 0);
		screen->machine().device<decospr_device>("spritegen1")->inefficient_copy_sprite_bitmap(screen->machine(), bitmap, cliprect, 0x0200, 0x0200, 0x100, 0x1ff);
		deco16ic_tilemap_1_draw(state->m_deco_tilegen1, bitmap, cliprect, 0, 0);
	}

	if (screen->machine().generic.spriteram2.u16)
		screen->machine().device<decospr_device>("spritegen2")->inefficient_copy_sprite_bitmap(screen->machine(), bitmap, cliprect, 0x0000, 0x0000, 0, 0x1ff);

	screen->machine().device<decospr_device>("spritegen1")->inefficient_copy_sprite_bitmap(screen->machine(), bitmap, cliprect, 0x0000, 0x0200, 0, 0x1ff);
	return 0;
}