Merge pull request #6684 from DavidHaywood/110520

seta2.cpp - improve x enlarge cases (nw)
This commit is contained in:
ajrhacker 2020-05-11 15:43:39 -04:00 committed by GitHub
commit 857c33a5c0
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 82 additions and 41 deletions

View File

@ -51,7 +51,7 @@ TODO:
- Proper emulation of the TMP68301 CPU, in a core file.
- Proper emulation of the ColdFire CPU, in a core file.
- Flip screen / Zooming support.
- improvements to Flip screen / Zooming support. (Flip Screen is often done with 'negative zoom value')
- Fix some graphics imperfections (e.g. color depth selection, "tilemap" sprites) [all done? - NS]
- I added a kludge involving a -0x10 yoffset, this fixes the lifeline in myangel.
I didn't find a better way to do it without breaking pzlbowl's title screen.
@ -74,20 +74,6 @@ myangel2:
- before each level, the background image is shown with completely wrong colors. It
corrects itself when the level starts.
grdians:
- the map screen after the character selection needs zooming. There is a global
zoom register that should affect the background map and the level picture but
not the frontmost frame. This latter should use color 7ff (the last one) and
ignore the individual color codes in the tiles data. Note: the frontmost frame
has the shadow bit set, and has become invisible after implementing it.
penbros/ablast:
- Zooming is used briefly (between scenes, stage exit, stage introduction)
deerhunt,wschamp:
- offset tilemap sprite during demo. In deerhunt intro, the hunter should zoom
in to the deer. In wschamp intro the GPS unit should zoom to the high scores.
wschampb:
- dumps of the program ROMs matched the hand written checksum for each chip, but
the boot screen reports NG for both ROMs. - Is this correct and a bug from the
@ -98,9 +84,6 @@ funcube series:
- Hacked to run, as they use a ColdFire CPU.
- Pay-out key causes "unknown error" after coin count reaches 0.
reelquak:
- Needs an x offset for tilemap sprites.
***************************************************************************/
#include "emu.h"

View File

@ -290,7 +290,7 @@ WRITE16_MEMBER(seta2_state::spriteram_w)
***************************************************************************/
inline void seta2_state::drawgfx_line(bitmap_ind16 &bitmap, const rectangle &cliprect, int which_gfx, const uint8_t* const addr, const uint32_t realcolor, int flipx, int flipy, int base_sx, uint32_t xzoom, int use_shadow, int screenline, int line, int opaque)
inline void seta2_state::drawgfx_line(bitmap_ind16& bitmap, const rectangle& cliprect, int which_gfx, const uint8_t* const addr, const uint32_t realcolor, int flipx, int flipy, int base_sx, uint32_t xzoom, int use_shadow, int screenline, int line, int opaque)
{
struct drawmodes
{
@ -311,48 +311,106 @@ inline void seta2_state::drawgfx_line(bitmap_ind16 &bitmap, const rectangle &cli
{ 0xff, 0, 8 }, // 7: common 8bpp case
};
int shadow = BPP_MASK_TABLE[(which_gfx & 0x0700)>>8].shadow;
int gfx_mask = BPP_MASK_TABLE[(which_gfx & 0x0700)>>8].gfx_mask;
int gfx_shift = BPP_MASK_TABLE[(which_gfx & 0x0700)>>8].gfx_shift;
int shadow = BPP_MASK_TABLE[(which_gfx & 0x0700) >> 8].shadow;
int gfx_mask = BPP_MASK_TABLE[(which_gfx & 0x0700) >> 8].gfx_mask;
int gfx_shift = BPP_MASK_TABLE[(which_gfx & 0x0700) >> 8].gfx_shift;
if (!use_shadow)
shadow = 0;
const uint8_t* const source = flipy ? addr + (7 - line) * 8 : addr + line * 8;
uint16_t* dest = &bitmap.pix16(screenline);
int x0 = flipx ? (base_sx + (8*xzoom) - xzoom) : (base_sx);
int x1 = flipx ? (base_sx - xzoom) : (x0 + (8*xzoom));
const int dx = flipx ? (-xzoom) : (xzoom);
int column = 0;
int minx = cliprect.min_x << 16;
int maxx = cliprect.max_x << 16;
for (int sx = x0; sx != x1; sx += dx)
if (xzoom < 0x10000) // shrink
{
uint8_t pen = (source[column++] & gfx_mask) >> gfx_shift;
int x0 = flipx ? (base_sx + (8 * xzoom) - xzoom) : (base_sx);
int x1 = flipx ? (base_sx - xzoom) : (x0 + (8 * xzoom));
const int dx = flipx ? (-xzoom) : (xzoom);
const uint8_t* const source = flipy ? addr + (7 - line) * 8 : addr + line * 8;
int column = 0;
if (sx >= minx && sx <= maxx)
for (int sx = x0; sx != x1; sx += dx)
{
int realsx = sx >> 16;
uint8_t pen = (source[column++] & gfx_mask) >> gfx_shift;
if (pen || opaque)
if (sx >= minx && sx <= maxx)
{
if (!shadow)
int realsx = sx >> 16;
if (pen || opaque)
{
dest[realsx] = (realcolor + pen) & 0x7fff;
if (!shadow)
{
dest[realsx] = (realcolor + pen) & 0x7fff;
}
else
{
int pen_shift = 15 - shadow;
int pen_mask = (1 << pen_shift) - 1;
dest[realsx] = ((dest[realsx] & pen_mask) | (pen << pen_shift)) & 0x7fff;
}
}
}
}
}
else // enlarge or no zoom
{
const uint8_t* const source = flipy ? addr + (7 - line) * 8 : addr + line * 8;
int x0 = (base_sx);
int x1 = (x0 + (8 * xzoom));
int column;
if (!flipx)
{
column = 0;
}
else
{
column = 7;
}
uint32_t countx = 0;
for (int sx = x0; sx < x1; sx += 0x10000)
{
uint8_t pen = (source[column] & gfx_mask) >> gfx_shift;
if (sx >= minx && sx <= maxx)
{
int realsx = sx >> 16;
if (pen || opaque)
{
if (!shadow)
{
dest[realsx] = (realcolor + pen) & 0x7fff;
}
else
{
int pen_shift = 15 - shadow;
int pen_mask = (1 << pen_shift) - 1;
dest[realsx] = ((dest[realsx] & pen_mask) | (pen << pen_shift)) & 0x7fff;
}
}
}
countx += 0x10000;
if (countx >= xzoom)
{
if (!flipx)
{
column++;
}
else
{
int pen_shift = 15 - shadow;
int pen_mask = (1 << pen_shift) - 1;
dest[realsx] = ((dest[realsx] & pen_mask) | (pen << pen_shift)) & 0x7fff;
column--;
}
countx -= xzoom;
}
}
}