summaryrefslogtreecommitdiffstatshomepage
diff options
context:
space:
mode:
author Michaël Banaan Ananas <happppp@users.noreply.github.com>2011-03-24 02:22:39 +0000
committer Michaël Banaan Ananas <happppp@users.noreply.github.com>2011-03-24 02:22:39 +0000
commit5772d9502225fe4e705ddee1beb79ff9d289d34d (patch)
tree9422603d7f33595bb51c14c0ae7406e90b40f261
parent0b6aa86b59ad3c8288c68f9eec72db21228324a9 (diff)
fixed spritelayer-textlayer priorities: http://www.mametesters.org/view.php?id=2175
-rw-r--r--src/mame/video/skykid.c35
1 files changed, 25 insertions, 10 deletions
diff --git a/src/mame/video/skykid.c b/src/mame/video/skykid.c
index 2202a265edd..6695f601c8b 100644
--- a/src/mame/video/skykid.c
+++ b/src/mame/video/skykid.c
@@ -73,14 +73,18 @@ static TILEMAP_MAPPER( tx_tilemap_scan )
static TILE_GET_INFO( tx_get_tile_info )
{
skykid_state *state = machine->driver_data<skykid_state>();
+ int code = state->textram[tile_index];
+ int attr = state->textram[tile_index + 0x400];
+ tileinfo->category = code >> 4 & 0xf;
+
/* the hardware has two character sets, one normal and one flipped. When
screen is flipped, character flip is done by selecting the 2nd character set.
We reproduce this here, but since the tilemap system automatically flips
characters when screen is flipped, we have to flip them back. */
SET_TILE_INFO(
0,
- state->textram[tile_index] | (flip_screen_get(machine) ? 0x100 : 0),
- state->textram[tile_index + 0x400] & 0x3f,
+ code | (flip_screen_get(machine) ? 0x100 : 0),
+ attr & 0x3f,
flip_screen_get(machine) ? (TILE_FLIPY | TILE_FLIPX) : 0);
}
@@ -117,8 +121,6 @@ VIDEO_START( skykid )
state_save_register_global(machine, state->priority);
state_save_register_global(machine, state->scroll_x);
state_save_register_global(machine, state->scroll_y);
- //FIXME: flip_screen
- //state_save_register_global(machine, flip_screen_x_get(machine));
}
@@ -250,14 +252,27 @@ SCREEN_UPDATE( skykid )
tilemap_set_scrolly(state->bg_tilemap, 0, state->scroll_y + 25);
}
- tilemap_draw(bitmap,cliprect,state->bg_tilemap,0,0);
+ tilemap_draw(bitmap,cliprect,state->bg_tilemap,TILEMAP_DRAW_OPAQUE,0);
+
+ if (state->priority & 0x04)
+ {
+ // textlayer priority enabled?
+ int cat, pri = state->priority >> 4;
+
+ // draw low priority tiles
+ tilemap_draw(bitmap, cliprect, state->tx_tilemap, pri, 0);
- if ((state->priority & 0xf0) != 0x50)
- draw_sprites(screen->machine, bitmap,cliprect);
+ draw_sprites(screen->machine, bitmap, cliprect);
- tilemap_draw(bitmap,cliprect,state->tx_tilemap,0,0);
+ // draw the other tiles
+ for (cat = 0; cat < 0xf; cat++)
+ if (cat != pri) tilemap_draw(bitmap, cliprect, state->tx_tilemap, cat, 0);
+ }
+ else
+ {
+ draw_sprites(screen->machine, bitmap, cliprect);
+ tilemap_draw(bitmap, cliprect, state->tx_tilemap, TILEMAP_DRAW_ALL_CATEGORIES, 0);
+ }
- if ((state->priority & 0xf0) == 0x50)
- draw_sprites(screen->machine, bitmap,cliprect);
return 0;
}