📄 punchout.c
字号:
{
top_palette_bank = (data >> 1) & 0x01;
memset(dirtybuffer,1,videoram_size);
}
if (bottom_palette_bank != ((data >> 0) & 0x01))
{
bottom_palette_bank = (data >> 0) & 0x01;
memset(dirtybuffer2,1,punchout_videoram2_size);
memset(bs1dirtybuffer,1,punchout_bigsprite1ram_size);
memset(bs2dirtybuffer,1,punchout_bigsprite2ram_size);
}
}
/***************************************************************************
Draw the game screen in the given osd_bitmap.
Do NOT call osd_update_display() from this function, it will be called by
the main emulation engine.
***************************************************************************/
void punchout_vh_screenrefresh(struct osd_bitmap *bitmap,int full_refresh)
{
int offs;
/* for every character in the Video RAM, check if it has been modified */
/* since last time and update it accordingly. */
for (offs = videoram_size - 2;offs >= 0;offs -= 2)
{
if (dirtybuffer[offs] || dirtybuffer[offs + 1])
{
int sx,sy;
dirtybuffer[offs] = 0;
dirtybuffer[offs + 1] = 0;
sx = offs/2 % 32;
sy = offs/2 / 32;
drawgfx(tmpbitmap,Machine->gfx[0],
videoram[offs] + 256 * (videoram[offs + 1] & 0x03),
((videoram[offs + 1] & 0x7c) >> 2) + 64 * top_palette_bank,
videoram[offs + 1] & 0x80,0,
8*sx,8*sy - 8*(32-TOP_MONITOR_ROWS),
&topvisiblearea,TRANSPARENCY_NONE,0);
}
}
for (offs = punchout_videoram2_size - 2;offs >= 0;offs -= 2)
{
if (dirtybuffer2[offs] | dirtybuffer2[offs + 1])
{
int sx,sy;
dirtybuffer2[offs] = 0;
dirtybuffer2[offs + 1] = 0;
sx = offs/2 % 64;
sy = offs/2 / 64;
drawgfx(tmpbitmap,Machine->gfx[1],
punchout_videoram2[offs] + 256 * (punchout_videoram2[offs + 1] & 0x03),
32 + ((~punchout_videoram2[offs + 1] & 0x7c) >> 2) + 64 * bottom_palette_bank,
punchout_videoram2[offs + 1] & 0x80,0,
8*sx,8*sy + 8*TOP_MONITOR_ROWS,
&backgroundvisiblearea,TRANSPARENCY_NONE,0);
}
}
for (offs = punchout_bigsprite1ram_size - 4;offs >= 0;offs -= 4)
{
if (bs1dirtybuffer[offs] | bs1dirtybuffer[offs + 1] | bs1dirtybuffer[offs + 3])
{
int sx,sy;
bs1dirtybuffer[offs] = 0;
bs1dirtybuffer[offs + 1] = 0;
bs1dirtybuffer[offs + 3] = 0;
sx = offs/4 % 16;
sy = offs/4 / 16;
drawgfx(bs1tmpbitmap,Machine->gfx[2],
punchout_bigsprite1ram[offs] + 256 * (punchout_bigsprite1ram[offs + 1] & 0x1f),
(~punchout_bigsprite1ram[offs + 3] & 0x1f) + 32 * bottom_palette_bank,
punchout_bigsprite1ram[offs + 3] & 0x80,0,
8*sx,8*sy,
0,TRANSPARENCY_NONE,0);
}
}
for (offs = punchout_bigsprite2ram_size - 4;offs >= 0;offs -= 4)
{
if (bs2dirtybuffer[offs] | bs2dirtybuffer[offs + 1] | bs2dirtybuffer[offs + 3])
{
int sx,sy;
bs2dirtybuffer[offs] = 0;
bs2dirtybuffer[offs + 1] = 0;
bs2dirtybuffer[offs + 3] = 0;
sx = offs/4 % 16;
sy = offs/4 / 16;
drawgfx(bs2tmpbitmap,Machine->gfx[3],
punchout_bigsprite2ram[offs] + 256 * (punchout_bigsprite2ram[offs + 1] & 0x0f),
(~punchout_bigsprite2ram[offs + 3] & 0x3f) + 64 * bottom_palette_bank,
punchout_bigsprite2ram[offs + 3] & 0x80,0,
8*sx,8*sy,
0,TRANSPARENCY_NONE,0);
}
}
/* copy the character mapped graphics */
{
int scroll[64];
for (offs = 0;offs < TOP_MONITOR_ROWS;offs++)
scroll[offs] = 0;
for (offs = 0;offs < BOTTOM_MONITOR_ROWS;offs++)
scroll[TOP_MONITOR_ROWS + offs] = -(58 + punchout_scroll[2*offs] + 256 * (punchout_scroll[2*offs + 1] & 0x01));
copyscrollbitmap(bitmap,tmpbitmap,TOP_MONITOR_ROWS + BOTTOM_MONITOR_ROWS,scroll,0,0,&Machine->drv->visible_area,TRANSPARENCY_NONE,0);
}
/* copy the two big sprites */
{
int sx,sy,zoom,height;
zoom = punchout_bigsprite1[0] + 256 * (punchout_bigsprite1[1] & 0x0f);
if (zoom)
{
sx = 1024 - (punchout_bigsprite1[2] + 256 * (punchout_bigsprite1[3] & 0x0f)) / 4;
if (sx > 1024-127) sx -= 1024;
sx = sx * 0x1000 / zoom / 4; /* adjust x position basing on zoom */
sx -= 57; /* adjustment to match the screen shots */
sy = -punchout_bigsprite1[4] + 256 * (punchout_bigsprite1[5] & 1);
sy = sy * 0x1000 / zoom / 4; /* adjust y position basing on zoom */
/* when the sprite is reduced, it fits more than */
/* once in the screen, so if the first draw is */
/* offscreen the second can be visible */
height = 256 * 0x1000 / zoom / 4; /* height of the zoomed sprite */
if (sy <= -height+16) sy += 2*height; /* if offscreen, try moving it lower */
sy += 3; /* adjustment to match the screen shots */
/* have to be at least 3, using 2 creates a blank line at the bottom */
/* of the screen when you win the championship and jump around with */
/* the belt */
if (punchout_bigsprite1[7] & 1) /* display in top monitor */
{
copybitmapzoom(bitmap,bs1tmpbitmap,
punchout_bigsprite1[6] & 1,0,
sx,sy - 8*(32-TOP_MONITOR_ROWS),
&topvisiblearea,TRANSPARENCY_COLOR,1024,
0x10000 * 0x1000 / zoom / 4,0x10000 * 0x1000 / zoom / 4);
}
if (punchout_bigsprite1[7] & 2) /* display in bottom monitor */
{
copybitmapzoom(bitmap,bs1tmpbitmap,
punchout_bigsprite1[6] & 1,0,
sx,sy + 8*TOP_MONITOR_ROWS,
&bottomvisiblearea,TRANSPARENCY_COLOR,1024,
0x10000 * 0x1000 / zoom / 4,0x10000 * 0x1000 / zoom / 4);
}
}
}
{
int sx,sy;
sx = 512 - (punchout_bigsprite2[0] + 256 * (punchout_bigsprite2[1] & 1));
if (sx > 512-127) sx -= 512;
sx -= 55; /* adjustment to match the screen shots */
sy = -punchout_bigsprite2[2] + 256 * (punchout_bigsprite2[3] & 1);
sy += 3; /* adjustment to match the screen shots */
copybitmap(bitmap,bs2tmpbitmap,
punchout_bigsprite2[4] & 1,0,
sx,sy + 8*TOP_MONITOR_ROWS,
&bottomvisiblearea,TRANSPARENCY_COLOR,1024);
}
}
void armwrest_vh_screenrefresh(struct osd_bitmap *bitmap,int full_refresh)
{
int offs;
/* for every character in the Video RAM, check if it has been modified */
/* since last time and update it accordingly. */
for (offs = punchout_videoram2_size - 2;offs >= 0;offs -= 2)
{
if (dirtybuffer2[offs] | dirtybuffer2[offs + 1])
{
int sx,sy;
dirtybuffer2[offs] = 0;
dirtybuffer2[offs + 1] = 0;
sx = offs/2 % 32;
sy = offs/2 / 32;
if (sy >= 32)
{
/* top screen */
sy -= 32;
drawgfx(tmpbitmap,Machine->gfx[0],
punchout_videoram2[offs] + 256 * (punchout_videoram2[offs + 1] & 0x03) +
8 * (punchout_videoram2[offs + 1] & 0x80),
((punchout_videoram2[offs + 1] & 0x7c) >> 2) + 64 * top_palette_bank,
0,0,
8*sx,8*sy - 8*(32-TOP_MONITOR_ROWS),
&topvisiblearea,TRANSPARENCY_NONE,0);
}
else
/* bottom screen background */
drawgfx(tmpbitmap,Machine->gfx[0],
punchout_videoram2[offs] + 256 * (punchout_videoram2[offs + 1] & 0x03),
128 + ((punchout_videoram2[offs + 1] & 0x7c) >> 2) + 64 * bottom_palette_bank,
punchout_videoram2[offs + 1] & 0x80,0,
8*sx,8*sy + 8*TOP_MONITOR_ROWS,
&backgroundvisiblearea,TRANSPARENCY_NONE,0);
}
}
for (offs = punchout_bigsprite1ram_size - 4;offs >= 0;offs -= 4)
{
if (bs1dirtybuffer[offs] | bs1dirtybuffer[offs + 1] | bs1dirtybuffer[offs + 3])
{
int sx,sy;
bs1dirtybuffer[offs] = 0;
bs1dirtybuffer[offs + 1] = 0;
bs1dirtybuffer[offs + 3] = 0;
sx = offs/4 % 16;
sy = offs/4 / 16;
if (sy >= 16)
{
sy -= 16;
sx += 16;
}
drawgfx(bs1tmpbitmap,Machine->gfx[2],
punchout_bigsprite1ram[offs] + 256 * (punchout_bigsprite1ram[offs + 1] & 0x1f),
(punchout_bigsprite1ram[offs + 3] & 0x1f) + 32 * bottom_palette_bank,
punchout_bigsprite1ram[offs + 3] & 0x80,0,
8*sx,8*sy,
0,TRANSPARENCY_NONE,0);
}
}
for (offs = punchout_bigsprite2ram_size - 4;offs >= 0;offs -= 4)
{
if (bs2dirtybuffer[offs] | bs2dirtybuffer[offs + 1] | bs2dirtybuffer[offs + 3])
{
int sx,sy;
bs2dirtybuffer[offs] = 0;
bs2dirtybuffer[offs + 1] = 0;
bs2dirtybuffer[offs + 3] = 0;
sx = offs/4 % 16;
sy = offs/4 / 16;
drawgfx(bs2tmpbitmap,Machine->gfx[3],
punchout_bigsprite2ram[offs] + 256 * (punchout_bigsprite2ram[offs + 1] & 0x0f),
(punchout_bigsprite2ram[offs + 3] & 0x3f) + 64 * bottom_palette_bank,
punchout_bigsprite2ram[offs + 3] & 0x80,0,
8*sx,8*sy,
0,TRANSPARENCY_NONE,0);
}
}
/* copy the character mapped graphics */
copybitmap(bitmap,tmpbitmap,0,0,0,0,&Machine->drv->visible_area,TRANSPARENCY_NONE,0);
/* copy the two big sprites */
{
int sx,sy,zoom,height;
zoom = punchout_bigsprite1[0] + 256 * (punchout_bigsprite1[1] & 0x0f);
if (zoom)
{
sx = 1024 - (punchout_bigsprite1[2] + 256 * (punchout_bigsprite1[3] & 0x0f)) / 4;
if (sx > 1024-127) sx -= 1024;
sx = sx * 0x1000 / zoom / 4; /* adjust x position basing on zoom */
sx -= 57; /* adjustment to match the screen shots */
sy = -punchout_bigsprite1[4] + 256 * (punchout_bigsprite1[5] & 1);
sy = sy * 0x1000 / zoom / 4; /* adjust y position basing on zoom */
/* when the sprite is reduced, it fits more than */
/* once in the screen, so if the first draw is */
/* offscreen the second can be visible */
height = 256 * 0x1000 / zoom / 4; /* height of the zoomed sprite */
if (sy <= -height+16) sy += 2*height; /* if offscreen, try moving it lower */
sy += 3; /* adjustment to match the screen shots */
/* have to be at least 3, using 2 creates a blank line at the bottom */
/* of the screen when you win the championship and jump around with */
/* the belt */
if (punchout_bigsprite1[7] & 1) /* display in top monitor */
{
copybitmapzoom(bitmap,bs1tmpbitmap,
punchout_bigsprite1[6] & 1,0,
sx,sy - 8*(32-TOP_MONITOR_ROWS),
&topvisiblearea,TRANSPARENCY_COLOR,1024,
0x10000 * 0x1000 / zoom / 4,0x10000 * 0x1000 / zoom / 4);
}
if (punchout_bigsprite1[7] & 2) /* display in bottom monitor */
{
copybitmapzoom(bitmap,bs1tmpbitmap,
punchout_bigsprite1[6] & 1,0,
sx,sy + 8*TOP_MONITOR_ROWS,
&bottomvisiblearea,TRANSPARENCY_COLOR,1024,
0x10000 * 0x1000 / zoom / 4,0x10000 * 0x1000 / zoom / 4);
}
}
}
{
int sx,sy;
sx = 512 - (punchout_bigsprite2[0] + 256 * (punchout_bigsprite2[1] & 1));
if (sx > 512-127) sx -= 512;
sx -= 55; /* adjustment to match the screen shots */
sy = -punchout_bigsprite2[2] + 256 * (punchout_bigsprite2[3] & 1);
sy += 3; /* adjustment to match the screen shots */
copybitmap(bitmap,bs2tmpbitmap,
punchout_bigsprite2[4] & 1,0,
sx,sy + 8*TOP_MONITOR_ROWS,
&bottomvisiblearea,TRANSPARENCY_COLOR,1024);
}
/* draw the foregound chars */
for (offs = videoram_size - 2;offs >= 0;offs -= 2)
{
int sx,sy;
dirtybuffer[offs] = 0;
dirtybuffer[offs + 1] = 0;
sx = offs/2 % 32;
sy = offs/2 / 32;
drawgfx(bitmap,Machine->gfx[1],
videoram[offs] + 256 * (videoram[offs + 1] & 0x07),
((videoram[offs + 1] & 0xf8) >> 3) + 32 * bottom_palette_bank,
videoram[offs + 1] & 0x80,0,
8*sx,8*sy + 8*TOP_MONITOR_ROWS,
&backgroundvisiblearea,TRANSPARENCY_PEN,7);
}
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -