summaryrefslogtreecommitdiffstats
path: root/docs/release/src/osd/winui/help.cpp
diff options
context:
space:
mode:
author arbee <rb6502@users.noreply.github.com>2017-02-28 08:14:19 -0500
committer arbee <rb6502@users.noreply.github.com>2017-02-28 08:14:19 -0500
commitd0018b1df40cb177f0c4f74c95d5bf720104b208 (patch)
treea7aa7151871eb22d6045fc4badfb4e118d2bcfca /docs/release/src/osd/winui/help.cpp
parentc9d8d33d44f08c01e6fdca0e6804603272a2d637 (diff)
apple2e: pass Zellyn/qkumba language card tests [R. Belmont]
Diffstat (limited to 'docs/release/src/osd/winui/help.cpp')
0 files changed, 0 insertions, 0 deletions
a id='n49' href='#n49'>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 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221
#include "emu.h"
#include "includes/lsasquad.h"

static void draw_layer( running_machine &machine, bitmap_t *bitmap, const rectangle *cliprect, UINT8 *scrollram )
{
	lsasquad_state *state = machine.driver_data<lsasquad_state>();
	int offs, scrollx, scrolly;

	scrollx = scrollram[3];
	scrolly = -scrollram[0];

	for (offs = 0; offs < 0x080; offs += 4)
	{
		int base, y, sx, sy, code, color;

		base = 64 * scrollram[offs + 1];
		sx = 8 * (offs / 4) + scrollx;
		if (flip_screen_get(machine))
			sx = 248 - sx;

		sx &= 0xff;

		for (y = 0; y < 32; y++)
		{
			int attr;

			sy = 8 * y + scrolly;
			if (flip_screen_get(machine))
				sy = 248 - sy;
			sy &= 0xff;

			attr = state->m_videoram[base + 2 * y + 1];
			code = state->m_videoram[base + 2 * y] + ((attr & 0x0f) << 8);
			color = attr >> 4;

			drawgfx_transpen(bitmap,cliprect,machine.gfx[0],
					code,
					color,
					flip_screen_get(machine),flip_screen_get(machine),
					sx,sy,15);
			if (sx > 248)	/* wraparound */
				drawgfx_transpen(bitmap,cliprect,machine.gfx[0],
						code,
						color,
						flip_screen_get(machine),flip_screen_get(machine),
						sx-256,sy,15);
		}
	}
}

static int draw_layer_daikaiju( running_machine &machine, bitmap_t *bitmap, const rectangle *cliprect, int offs, int  * previd, int type )
{
	lsasquad_state *state = machine.driver_data<lsasquad_state>();
	int id, scrollx, scrolly, initoffs, globalscrollx;
	int stepx = 0;

	initoffs = offs;
	globalscrollx = 0;

	id = state->m_scrollram[offs + 2];

	for( ; offs < 0x400; offs += 4)
	{
		int base, y, sx, sy, code, color;

		 //id change
		if (id != state->m_scrollram[offs + 2])
		{
			*previd = id;
			return offs;
		}
		else
		{
			id = state->m_scrollram[offs + 2];
		}

		//skip empty (??) column, potential probs with 1st column in scrollram (scroll 0, tile 0, id 0)
		if ((state->m_scrollram[offs + 0] | state->m_scrollram[offs + 1] | state->m_scrollram[offs + 2] | state->m_scrollram[offs + 3]) == 0)
			continue;

		//local scroll x/y
		scrolly = -state->m_scrollram[offs + 0];
		scrollx =  state->m_scrollram[offs + 3];

		//check for global x scroll used in bg layer in game (starts at offset 0 in scrollram
		// and game name/logo on title screen (starts in the middle of scrollram, but with different
		// (NOT unique )id than prev coulmn(s)

		if (*previd != 1)
		{
			if (offs != initoffs)
			{
				scrollx += globalscrollx;
			}
			else
			{
				//global scroll init
				globalscrollx = scrollx;
			}
		}

		base = 64 * state->m_scrollram[offs + 1];
		sx = scrollx + stepx;

		if (flip_screen_get(machine))
			sx = 248 - sx;
		sx &= 0xff;

		for (y = 0; y < 32; y++)
		{
			int attr;

			sy = 8 * y + scrolly;
			if (flip_screen_get(machine))
				sy = 248 - sy;
			sy &= 0xff;

			attr = state->m_videoram[base + 2 * y + 1];
			code = state->m_videoram[base + 2 * y] + ((attr & 0x0f) << 8);
			color = attr >> 4;

			if ((type == 0 && color != 0x0d) || (type != 0 && color == 0x0d))
			{
				drawgfx_transpen(bitmap,cliprect,machine.gfx[0],
					code,
					color,
					flip_screen_get(machine),flip_screen_get(machine),
					sx,sy,15);
				if (sx > 248)	/* wraparound */
					drawgfx_transpen(bitmap,cliprect,machine.gfx[0],
						code,
						color,
						flip_screen_get(machine),flip_screen_get(machine),
						sx-256,sy,15);
			}
		}
	}
	return offs;
}

static void drawbg( running_machine &machine, bitmap_t *bitmap, const rectangle *cliprect, int type )
{
	lsasquad_state *state = machine.driver_data<lsasquad_state>();
	int i = 0;
	int id = -1;

	while (i < 0x400)
	{
		if (!(state->m_scrollram[i + 2] & 1))
		{
			i = draw_layer_daikaiju(machine, bitmap, cliprect, i, &id, type);
		}
		else
		{
			id = state->m_scrollram[i + 2];
			i += 4;
		}
	}
}

static void draw_sprites( running_machine &machine, bitmap_t *bitmap, const rectangle *cliprect )
{
	lsasquad_state *state = machine.driver_data<lsasquad_state>();
	UINT8 *spriteram = state->m_spriteram;
	int offs;

	for (offs = state->m_spriteram_size - 4; offs >= 0; offs -= 4)
	{
		int sx, sy, attr, code, color, flipx, flipy;

		sx = spriteram[offs + 3];
		sy = 240 - spriteram[offs];
		attr = spriteram[offs + 1];
		code = spriteram[offs + 2] + ((attr & 0x30) << 4);
		color = attr & 0x0f;
		flipx = attr & 0x40;
		flipy = attr & 0x80;

		if (flip_screen_get(machine))
		{
			sx = 240 - sx;
			sy = 240 - sy;
			flipx = !flipx;
			flipy = !flipy;
		}

		drawgfx_transpen(bitmap,cliprect,machine.gfx[1],
				code,
				color,
				flipx,flipy,
				sx,sy,15);
		/* wraparound */
		drawgfx_transpen(bitmap,cliprect,machine.gfx[1],
				code,
				color,
				flipx,flipy,
				sx-256,sy,15);
	}
}

SCREEN_UPDATE( lsasquad )
{
	lsasquad_state *state = screen->machine().driver_data<lsasquad_state>();
	bitmap_fill(bitmap, cliprect, 511);

	draw_layer(screen->machine(), bitmap, cliprect, state->m_scrollram + 0x000);
	draw_layer(screen->machine(), bitmap, cliprect, state->m_scrollram + 0x080);
	draw_sprites(screen->machine(), bitmap, cliprect);
	draw_layer(screen->machine(), bitmap, cliprect, state->m_scrollram + 0x100);
	return 0;
}


SCREEN_UPDATE( daikaiju )
{
	bitmap_fill(bitmap, cliprect, 511);
	drawbg(screen->machine(), bitmap, cliprect, 0); // bottom
	draw_sprites(screen->machine(), bitmap, cliprect);
	drawbg(screen->machine(), bitmap, cliprect, 1);	// top = pallete $d ?
	return 0;
}