summaryrefslogtreecommitdiffstatshomepage
path: root/src/mame
diff options
context:
space:
mode:
author Angelo Salese <angelosa@users.noreply.github.com>2009-11-26 01:59:15 +0000
committer Angelo Salese <angelosa@users.noreply.github.com>2009-11-26 01:59:15 +0000
commit6693a2612eed59b7766f1a0b47dfac71ac158fc0 (patch)
tree19b6f8936c28bdb40e93505b4ebdbd62d9a6bec9 /src/mame
parent58e1ff522ae30fa0aa73045ad70e0f601d669ad0 (diff)
hng64: re-implemented zooming in Fatal Fury WA, and added alternative zooming mode used by the other games, they have some precision bugs though [Angelo Salese]
Diffstat (limited to 'src/mame')
-rw-r--r--src/mame/video/hng64.c46
1 files changed, 20 insertions, 26 deletions
diff --git a/src/mame/video/hng64.c b/src/mame/video/hng64.c
index 5e005dfca0f..4284dfa91e9 100644
--- a/src/mame/video/hng64.c
+++ b/src/mame/video/hng64.c
@@ -138,7 +138,7 @@ static struct polygon *polys ;
* UINT32 | Bits | Use
* | 3322 2222 2222 1111 1111 11 |
* -------+-1098-7654-3210-9876-5432-1098-7654-3210-+----------------
- * 0 | ---- ---- x--- ---- ---- ---- ---- ---- | bpp select
+ * 0 | ---- z--- b--- ---- ---- ---- ---- ---- | zooming mode, bpp select
* 1 | yyyy yyyy yyyy yyyy xxxx xxxx xxxx xxxx | global sprite offset (ss64 rankings in attract)
* 2 | ---- ---- ---- ---- ---- ---- ---- ---- |
* 3 | ---- ---- ---- ---- ---- ---- ---- ---- |
@@ -147,7 +147,6 @@ static struct polygon *polys ;
* Notes:
* [0]
* 0xf0000000 setted in both Samurai Shodown
- * 0x08000000 setted by Fatal Fury WA only, zooming mode?
* 0x00060000 always setted in all the games
* 0x00010000 setted in POST, sprite disable?
* [4]
@@ -178,7 +177,7 @@ static void draw_sprites(running_machine *machine, bitmap_t *bitmap, const recta
int chaini;
int zbuf;
UINT32 zoomx,zoomy;
- //float foomX, foomY;
+ float foomX, foomY;
zbuf = (source[2]&0x07ff0000)>>16;
#if 1
@@ -211,24 +210,24 @@ static void draw_sprites(running_machine *machine, bitmap_t *bitmap, const recta
// source[4], source[5], source[6], source[7]) ;
/* Calculate the zoom */
- /* First, prevent any possible divide by zero errors */
-
-#if 0
- if(!zoomx) zoomx=0x1000;
- if(!zoomy) zoomy=0x1000;
+ {
+ int zoom_factor;
- foomX = (float)(0x1000) / (float)zoomx ;
- foomY = (float)(0x1000) / (float)zoomy ;
+ /* FIXME: regular zoom mode has precision bugs, can be easily seen in Samurai Shodown 64 intro */
+ zoom_factor = (hng64_spriteregs[0] & 0x08000000) ? 0x1000 : 0x100;
+ if(!zoomx) zoomx=zoom_factor;
+ if(!zoomy) zoomy=zoom_factor;
- zoomx = ((int)foomX) << 16 ;
- zoomy = ((int)foomY) << 16 ;
+ /* First, prevent any possible divide by zero errors */
+ foomX = (float)(zoom_factor) / (float)zoomx ;
+ foomY = (float)(zoom_factor) / (float)zoomy ;
- zoomx += (int)((foomX - floor(foomX)) * (float)0x10000) ;
- zoomy += (int)((foomY - floor(foomY)) * (float)0x10000) ;
-#endif
+ zoomx = ((int)foomX) << 16 ;
+ zoomy = ((int)foomY) << 16 ;
- zoomx = 0x10000;
- zoomy = 0x10000;
+ zoomx += (int)((foomX - floor(foomX)) * (float)0x10000) ;
+ zoomy += (int)((foomY - floor(foomY)) * (float)0x10000) ;
+ }
if (hng64_spriteregs[0] & 0x00800000) //bpp switch
{
@@ -244,27 +243,22 @@ static void draw_sprites(running_machine *machine, bitmap_t *bitmap, const recta
// Accomodate for chaining and flipping
if(xflip)
{
- //xinc=-(int)(16.0f*foomX);
-
- xinc=-16;
+ xinc=-(int)(16.0f*foomX);
xpos-=xinc*chainx;
}
else
{
- //xinc=(int)(16.0f*foomX);
- xinc = 16;
+ xinc=(int)(16.0f*foomX);
}
if(yflip)
{
- //yinc=-(int)(16.0f*foomY);
- yinc = -16;
+ yinc=-(int)(16.0f*foomY);
ypos-=yinc*chainy;
}
else
{
- yinc = 16;
- //yinc=(int)(16.0f*foomY);
+ yinc=(int)(16.0f*foomY);
}