summaryrefslogtreecommitdiffstatshomepage
path: root/src/mame/video/cps1.c
diff options
context:
space:
mode:
author Aaron Giles <aaron@aarongiles.com>2013-07-26 08:15:05 +0000
committer Aaron Giles <aaron@aarongiles.com>2013-07-26 08:15:05 +0000
commitec07fb10225293829c870f2ce1ffd05732f671ca (patch)
tree5fed58d5c5d4ecf690475e91f3546036a14abdd8 /src/mame/video/cps1.c
parentb5e744c477c41c28d1cefb88c622ae3a1cd4eb4e (diff)
Fix long-standing architectural wart: the priority bitmap is no longer owned
by the tilemap system, and no longer exists globally in the machine. Instead it is allocated per-screen for all systems. This has several side-effects: 1. Previously, the pdrawgfx* functions were already changed to take the priority bitmap as a parameter. Now all other hand-crafted functions that mess with the priority bitmap generally must do so as well, and have been updated. 2. Calls to the tilemap system now need to provide a screen_device. This is not just for the priority_bitmap, but also for screen flipping, which previously always assumed the "primary screen" when doing flipping calculations. 3. All devices that implemented tilemap-like functionality have been updated to follow the same pattern, since they largely tend to call through to the core tilemap system at some point.
Diffstat (limited to 'src/mame/video/cps1.c')
-rw-r--r--src/mame/video/cps1.c46
1 files changed, 23 insertions, 23 deletions
diff --git a/src/mame/video/cps1.c b/src/mame/video/cps1.c
index c8b23076719..a13c6774d98 100644
--- a/src/mame/video/cps1.c
+++ b/src/mame/video/cps1.c
@@ -2282,7 +2282,7 @@ void cps_state::cps1_find_last_sprite() /* Find the offset of last sprite */
}
-void cps_state::cps1_render_sprites( bitmap_ind16 &bitmap, const rectangle &cliprect )
+void cps_state::cps1_render_sprites( screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect )
{
#define DRAWSPRITE(CODE,COLOR,FLIPX,FLIPY,SX,SY) \
{ \
@@ -2292,14 +2292,14 @@ void cps_state::cps1_render_sprites( bitmap_ind16 &bitmap, const rectangle &clip
CODE, \
COLOR, \
!(FLIPX),!(FLIPY), \
- 511-16-(SX),255-16-(SY), machine().priority_bitmap,0x02,15); \
+ 511-16-(SX),255-16-(SY), screen.priority(),0x02,15); \
else \
pdrawgfx_transpen(bitmap,\
cliprect,machine().gfx[2], \
CODE, \
COLOR, \
FLIPX,FLIPY, \
- SX,SY, machine().priority_bitmap,0x02,15); \
+ SX,SY, screen.priority(),0x02,15); \
}
@@ -2515,7 +2515,7 @@ void cps_state::cps2_find_last_sprite() /* Find the offset of last sprite */
m_cps2_last_sprite_offset = m_cps2_obj_size / 2 - 4;
}
-void cps_state::cps2_render_sprites( bitmap_ind16 &bitmap, const rectangle &cliprect, int *primasks )
+void cps_state::cps2_render_sprites( screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect, int *primasks )
{
#define DRAWSPRITE(CODE,COLOR,FLIPX,FLIPY,SX,SY) \
{ \
@@ -2525,14 +2525,14 @@ void cps_state::cps2_render_sprites( bitmap_ind16 &bitmap, const rectangle &clip
CODE, \
COLOR, \
!(FLIPX),!(FLIPY), \
- 511-16-(SX),255-16-(SY), machine().priority_bitmap,primasks[priority],15); \
+ 511-16-(SX),255-16-(SY), screen.priority(),primasks[priority],15); \
else \
pdrawgfx_transpen(bitmap,\
cliprect,machine().gfx[2], \
CODE, \
COLOR, \
FLIPX,FLIPY, \
- SX,SY, machine().priority_bitmap,primasks[priority],15); \
+ SX,SY, screen.priority(),primasks[priority],15); \
}
int i;
@@ -2727,22 +2727,22 @@ void cps_state::cps1_render_stars( screen_device &screen, bitmap_ind16 &bitmap,
}
-void cps_state::cps1_render_layer( bitmap_ind16 &bitmap, const rectangle &cliprect, int layer, int primask )
+void cps_state::cps1_render_layer( screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect, int layer, int primask )
{
switch (layer)
{
case 0:
- cps1_render_sprites(bitmap, cliprect);
+ cps1_render_sprites(screen, bitmap, cliprect);
break;
case 1:
case 2:
case 3:
- m_bg_tilemap[layer - 1]->draw(bitmap, cliprect, TILEMAP_DRAW_LAYER1, primask);
+ m_bg_tilemap[layer - 1]->draw(screen, bitmap, cliprect, TILEMAP_DRAW_LAYER1, primask);
break;
}
}
-void cps_state::cps1_render_high_layer( bitmap_ind16 &bitmap, const rectangle &cliprect, int layer )
+void cps_state::cps1_render_high_layer( screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect, int layer )
{
bitmap_ind16 dummy_bitmap;
switch (layer)
@@ -2753,7 +2753,7 @@ void cps_state::cps1_render_high_layer( bitmap_ind16 &bitmap, const rectangle &c
case 1:
case 2:
case 3:
- m_bg_tilemap[layer - 1]->draw(dummy_bitmap, cliprect, TILEMAP_DRAW_LAYER0, 1);
+ m_bg_tilemap[layer - 1]->draw(screen, dummy_bitmap, cliprect, TILEMAP_DRAW_LAYER0, 1);
break;
}
}
@@ -2833,26 +2833,26 @@ UINT32 cps_state::screen_update_cps1(screen_device &screen, bitmap_ind16 &bitmap
l1 = (layercontrol >> 0x08) & 03;
l2 = (layercontrol >> 0x0a) & 03;
l3 = (layercontrol >> 0x0c) & 03;
- machine().priority_bitmap.fill(0, cliprect);
+ screen.priority().fill(0, cliprect);
if (m_cps_version == 1)
{
- cps1_render_layer(bitmap, cliprect, l0, 0);
+ cps1_render_layer(screen, bitmap, cliprect, l0, 0);
if (l1 == 0)
- cps1_render_high_layer(bitmap, cliprect, l0); /* prepare mask for sprites */
+ cps1_render_high_layer(screen, bitmap, cliprect, l0); /* prepare mask for sprites */
- cps1_render_layer(bitmap, cliprect, l1, 0);
+ cps1_render_layer(screen, bitmap, cliprect, l1, 0);
if (l2 == 0)
- cps1_render_high_layer(bitmap, cliprect, l1); /* prepare mask for sprites */
+ cps1_render_high_layer(screen, bitmap, cliprect, l1); /* prepare mask for sprites */
- cps1_render_layer(bitmap, cliprect, l2, 0);
+ cps1_render_layer(screen, bitmap, cliprect, l2, 0);
if (l3 == 0)
- cps1_render_high_layer(bitmap, cliprect, l2); /* prepare mask for sprites */
+ cps1_render_high_layer(screen, bitmap, cliprect, l2); /* prepare mask for sprites */
- cps1_render_layer(bitmap, cliprect, l3, 0);
+ cps1_render_layer(screen, bitmap, cliprect, l3, 0);
}
else
{
@@ -2903,10 +2903,10 @@ if (0 && machine().input().code_pressed(KEYCODE_Z))
}
}
- cps1_render_layer(bitmap, cliprect, l0, 1);
- cps1_render_layer(bitmap, cliprect, l1, 2);
- cps1_render_layer(bitmap, cliprect, l2, 4);
- cps2_render_sprites(bitmap, cliprect, primasks);
+ cps1_render_layer(screen, bitmap, cliprect, l0, 1);
+ cps1_render_layer(screen, bitmap, cliprect, l1, 2);
+ cps1_render_layer(screen, bitmap, cliprect, l2, 4);
+ cps2_render_sprites(screen, bitmap, cliprect, primasks);
}
return 0;