summaryrefslogtreecommitdiffstats
path: root/src/mame/video/galpanic.cpp
blob: 94e23bfe38fc35b7ada7744b814b9783417f80df (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
// license:BSD-3-Clause
// copyright-holders:Nicola Salmoria
#include "emu.h"
#include "kan_pand.h"
#include "includes/galpanic.h"


void galpanic_state::video_start()
{
	m_screen->register_screen_bitmap(m_bitmap);

	save_item(NAME(m_bitmap));
}

PALETTE_INIT_MEMBER(galpanic_state,galpanic)
{
	/* first 1024 colors are dynamic */

	/* initialize 555 RGB lookup */
	for (int i = 0;i < 32768;i++)
		palette.set_pen_color(i+1024,pal5bit(i >> 5),pal5bit(i >> 10),pal5bit(i >> 0));
}

WRITE16_MEMBER(galpanic_state::bgvideoram_w)
{
	data = COMBINE_DATA(&m_bgvideoram[offset]);

	int sy = offset / 256;
	int sx = offset % 256;

	m_bitmap.pix16(sy, sx) = 1024 + (data >> 1);
}

void galpanic_state::draw_fgbitmap(bitmap_ind16 &bitmap, const rectangle &cliprect)
{
	for (int offs = 0;offs < m_fgvideoram.bytes()/2;offs++)
	{
		int sx = offs % 256;
		int sy = offs / 256;
		int color = m_fgvideoram[offs];
		if (color)
			bitmap.pix16(sy, sx) = color;
	}
}

UINT32 galpanic_state::screen_update(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect)
{
	/* copy the temporary bitmap to the screen */
	copybitmap(bitmap,m_bitmap,0,0,0,0,cliprect);

	draw_fgbitmap(bitmap, cliprect);

	m_pandora->update(bitmap, cliprect);

	return 0;
}