summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorGravatarGravatar angelosa <salese_corp_ltd@email.it>2018-02-02 13:33:10 +0100
committerGravatarGravatar angelosa <salese_corp_ltd@email.it>2018-02-02 13:33:10 +0100
commit266c662794249c25916cf769395d83a5697aa1ea (patch) (github)
tree35f0c93e644128af9d5b52ff522522fba65bbdad
parent5fea8ccc69d9e6be1145ecb824ccd3813d12f872 (diff)
downloadmame-266c662794249c25916cf769395d83a5697aa1ea.tar.bz2
mame-266c662794249c25916cf769395d83a5697aa1ea.zip
namcona1.cpp: Added dynamic screen visible area change effect, used mostly by Numan Athletics on transitions [Angelo Salese]
-rw-r--r--src/mame/drivers/namcona1.cpp11
-rw-r--r--src/mame/includes/namcona1.h3
-rw-r--r--src/mame/video/namcona1.cpp55
3 files changed, 51 insertions, 18 deletions
diff --git a/src/mame/drivers/namcona1.cpp b/src/mame/drivers/namcona1.cpp
index 8f9dc6f4695..53b8e5f1bd9 100644
--- a/src/mame/drivers/namcona1.cpp
+++ b/src/mame/drivers/namcona1.cpp
@@ -954,7 +954,8 @@ MACHINE_CONFIG_START(namcona1_state::namcona1)
MCFG_SCREEN_REFRESH_RATE(60)
MCFG_SCREEN_VBLANK_TIME(ATTOSECONDS_IN_USEC(2500) /* not accurate */)
MCFG_SCREEN_SIZE(40*8, 32*8)
- MCFG_SCREEN_VISIBLE_AREA(8, 38*8-1-8, 4*8, 32*8-1)
+// MCFG_SCREEN_VISIBLE_AREA(8, 38*8-1-8, 4*8, 32*8-1)
+ MCFG_SCREEN_VISIBLE_AREA(0, 38*8-1, 4*8, 32*8-1)
MCFG_SCREEN_UPDATE_DRIVER(namcona1_state, screen_update)
MCFG_SCREEN_PALETTE("palette")
@@ -977,8 +978,8 @@ MACHINE_CONFIG_END
MACHINE_CONFIG_DERIVED(namcona1_state::namcona1w, namcona1)
/* video hardware */
- MCFG_SCREEN_MODIFY("screen")
- MCFG_SCREEN_VISIBLE_AREA(0, 38*8-1-0, 4*8, 32*8-1)
+// MCFG_SCREEN_MODIFY("screen")
+// MCFG_SCREEN_VISIBLE_AREA(0, 38*8-1, 4*8, 32*8-1)
MACHINE_CONFIG_END
@@ -996,8 +997,8 @@ MACHINE_CONFIG_END
MACHINE_CONFIG_DERIVED(namcona1_state::namcona2w, namcona2)
/* video hardware */
- MCFG_SCREEN_MODIFY("screen")
- MCFG_SCREEN_VISIBLE_AREA(0, 38*8-1-0, 4*8, 32*8-1)
+// MCFG_SCREEN_MODIFY("screen")
+// MCFG_SCREEN_VISIBLE_AREA(0, 38*8-1, 4*8, 32*8-1)
MACHINE_CONFIG_END
/* NA-1 Hardware */
diff --git a/src/mame/includes/namcona1.h b/src/mame/includes/namcona1.h
index 1c81dc7f52f..b30d78dc900 100644
--- a/src/mame/includes/namcona1.h
+++ b/src/mame/includes/namcona1.h
@@ -152,7 +152,8 @@ private:
void draw_background(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect, int which, int primask );
void tilemap_get_info(tile_data &tileinfo, int tile_index, const uint16_t *tilemap_videoram, bool use_4bpp_gfx);
void blit_setup( int format, int *bytes_per_row, int *pitch, int mode );
- void draw_pixel_line( uint16_t *pDest, uint8_t *pPri, uint16_t *pSource, const pen_t *paldata );
+ void draw_pixel_line( const rectangle &cliprect, uint16_t *pDest, uint8_t *pPri, uint16_t *pSource, const pen_t *paldata );
+ bool screen_enabled( const rectangle &cliprect);
TILE_GET_INFO_MEMBER(tilemap_get_info0);
TILE_GET_INFO_MEMBER(tilemap_get_info1);
TILE_GET_INFO_MEMBER(tilemap_get_info2);
diff --git a/src/mame/video/namcona1.cpp b/src/mame/video/namcona1.cpp
index 52305418e19..b2d8caf4fce 100644
--- a/src/mame/video/namcona1.cpp
+++ b/src/mame/video/namcona1.cpp
@@ -3,8 +3,11 @@
/* Namco System NA1/2 Video Hardware */
/*
-TODO:
-- dynamic screen resolution (changes between emeralda test mode and normal game)
+Notes:
+- fa/fghtatck: Global screen window effect cut one line from top/bottom of screen, especially noticeable with credit display.
+ It's a btanb according to a PCB video I've seen -AS.
+
+TODO:
- non-shadow pixels for sprites flagged to enable shadows have bad colors
*/
@@ -428,16 +431,18 @@ void namcona1_state::draw_sprites(screen_device &screen, bitmap_ind16 &bitmap, c
}
} /* draw_sprites */
-void namcona1_state::draw_pixel_line( uint16_t *pDest, uint8_t *pPri, uint16_t *pSource, const pen_t *paldata )
+void namcona1_state::draw_pixel_line( const rectangle &cliprect, uint16_t *pDest, uint8_t *pPri, uint16_t *pSource, const pen_t *paldata )
{
int x;
for( x=0; x<38*8; x+=2 )
- {
+ {
uint16_t data = *pSource++;
pPri[x+0] = 0xff;
pPri[x+1] = 0xff;
- pDest[x+0] = paldata[data>>8];
- pDest[x+1] = paldata[data&0xff];
+ if(x >= cliprect.min_x && x <= cliprect.max_x)
+ pDest[x+0] = paldata[data>>8];
+ if(x+1 >= cliprect.min_x && x+1 <= cliprect.max_x)
+ pDest[x+1] = paldata[data&0xff];
} /* next x */
} /* draw_pixel_line */
@@ -497,7 +502,7 @@ void namcona1_state::draw_background(screen_device &screen, bitmap_ind16 &bitmap
{
// TODO: not convinced about this trigger
if( xdata == 0xc001 )
- {
+ {
/* This is a simplification, but produces the correct behavior for the only game that uses this
* feature, Numan Athletics.
*/
@@ -505,7 +510,7 @@ void namcona1_state::draw_background(screen_device &screen, bitmap_ind16 &bitmap
//const pen_t *paldata = &m_palette->pen(m_bg_tilemap[which]->palette_offset());
const pen_t *paldata = &m_palette->pen(0);
- draw_pixel_line(&bitmap.pix16(line),
+ draw_pixel_line(cliprect, &bitmap.pix16(line),
&screen.priority().pix8(line),
m_videoram + ydata + 25,
paldata );
@@ -521,10 +526,35 @@ void namcona1_state::draw_background(screen_device &screen, bitmap_ind16 &bitmap
}
} /* draw_background */
+// CRTC safety checks
+bool namcona1_state::screen_enabled(const rectangle &cliprect)
+{
+ if(cliprect.min_x < 0)
+ return false;
+
+ if(cliprect.max_x < 0)
+ return false;
+
+ if(cliprect.min_x > cliprect.max_x)
+ return false;
+
+ if(cliprect.min_y > cliprect.max_y)
+ return false;
+
+ return true;
+}
+
uint32_t namcona1_state::screen_update(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect)
{
int which;
int priority;
+ // CRTC visible area parameters
+ // (used mostly by Numan Athletics for global screen window effects, cfr. start of events/title screen to demo mode transitions)
+ rectangle display_rect;
+ display_rect.min_x = m_vreg[0x80/2]-0x48;
+ display_rect.max_x = m_vreg[0x82/2]-0x48-1;
+ display_rect.min_y = std::max((int)m_vreg[0x84/2], cliprect.min_y);
+ display_rect.max_y = std::min((int)m_vreg[0x86/2]-1, cliprect.max_y);
/* int flipscreen = m_vreg[0x98/2]; (TBA) */
@@ -532,8 +562,9 @@ uint32_t namcona1_state::screen_update(screen_device &screen, bitmap_ind16 &bitm
bitmap.fill(0xff, cliprect ); /* background color? */
- if( m_vreg[0x8e/2] )
- { /* gfx enabled */
+ if( m_vreg[0x8e/2] && screen_enabled(display_rect) == true)
+ {
+ /* gfx enabled */
if( m_palette_is_dirty )
{
/* palette updates are delayed when graphics are disabled */
@@ -564,12 +595,12 @@ uint32_t namcona1_state::screen_update(screen_device &screen, bitmap_ind16 &bitm
}
if( pri == priority )
{
- draw_background(screen,bitmap,cliprect,which,priority);
+ draw_background(screen,bitmap,display_rect,which,priority);
}
} /* next tilemap */
} /* next priority level */
- draw_sprites(screen,bitmap,cliprect);
+ draw_sprites(screen,bitmap,display_rect);
} /* gfx enabled */
return 0;
}