Previous 199869 Revisions Next

r18503 Saturday 13th October, 2012 at 13:29:27 UTC by Tafoid
Video System improvements.  Further unification of the functions, improved rendering of players in 3on3dunk and promoted it to working, also further improves the sprites in twrldc94.  From Haze (nw)

New games added or promoted from NOT_WORKING status
---------------------------------------------------
3 On 3 Dunk Madness (US, prototype? 1997/02/04)  [David Haywood, ShouTime, Smitdogg, The Dumping Union]
[src/mame/drivers]3x3puzzl.c aerofgt.c gstriker.c inufuku.c
[src/mame/video]vsystem_spr.c vsystem_spr.h

trunk/src/mame/drivers/gstriker.c
r18502r18503
216216   UINT8 *RAM = memregion("audiocpu")->base();
217217   int bankaddress;
218218
219   bankaddress = 0x10000 + (data & 0x03) * 0x8000;
219   bankaddress = (data & 0x07) * 0x8000;
220220   membank("bank1")->set_base(&RAM[bankaddress]);
221221}
222222
r18502r18503
625625
626626   ROM_REGION( 0x40000, "audiocpu", 0 )
627627   ROM_LOAD( "human-3_27c1001.u87",  0x00000, 0x20000, CRC(2f28c01e) SHA1(63829ad7969d197b2f2c87cb88bdb9e9880ed2d6) )
628   ROM_RELOAD(               0x10000, 0x20000 )
629628
630629   ROM_REGION( 0x20000, "gfx1", 0 ) // score tilemap
631630   ROM_LOAD( "human-2_27c1024.u79",  0x00000, 0x20000, CRC(a981993b) SHA1(ed92c7581d2b84a8628744dd5f8a2266c45dcd5b) )
r18502r18503
661660
662661   ROM_REGION( 0x40000, "audiocpu", 0 )
663662   ROM_LOAD( "human-3_27c1001.u87",  0x00000, 0x20000, CRC(2f28c01e) SHA1(63829ad7969d197b2f2c87cb88bdb9e9880ed2d6) )
664   ROM_RELOAD(               0x10000, 0x20000 )
665663
666664   ROM_REGION( 0x20000, "gfx1", 0 ) // score tilemap
667665   ROM_LOAD( "human-2_27c1024.u79",  0x00000, 0x20000, CRC(a981993b) SHA1(ed92c7581d2b84a8628744dd5f8a2266c45dcd5b) )
trunk/src/mame/drivers/aerofgt.c
r18502r18503
288288   AM_RANGE(0x1b0ff0, 0x1b0fff) AM_RAM   /* stack area during boot */
289289   AM_RANGE(0x1b2000, 0x1b3fff) AM_RAM_WRITE(aerofgt_bg1videoram_w) AM_SHARE("bg1videoram")
290290   AM_RANGE(0x1b4000, 0x1b5fff) AM_RAM_WRITE(aerofgt_bg2videoram_w) AM_SHARE("bg2videoram")
291   AM_RANGE(0x1c0000, 0x1c3fff) AM_RAM AM_SHARE("spriteram1")
292   AM_RANGE(0x1c4000, 0x1c7fff) AM_RAM AM_SHARE("spriteram2")
291   AM_RANGE(0x1c0000, 0x1c7fff) AM_RAM AM_SHARE("spriteram1")
293292   AM_RANGE(0x1d0000, 0x1d1fff) AM_RAM AM_SHARE("spriteram3")
294293   AM_RANGE(0xfef000, 0xffefff) AM_RAM   /* work RAM */
295294   AM_RANGE(0xffff80, 0xffff87) AM_WRITE(aerofgt_gfxbank_w)
r18502r18503
12541253static GFXDECODE_START( aerofgt )
12551254   GFXDECODE_ENTRY( "gfx1", 0, aerofgt_charlayout,     0, 16 )
12561255   GFXDECODE_ENTRY( "gfx1", 0, aerofgt_charlayout,   256, 16 )
1257   GFXDECODE_ENTRY( "gfx2", 0, aerofgt_spritelayout, 512, 16 )
1258   GFXDECODE_ENTRY( "gfx3", 0, aerofgt_spritelayout, 768, 16 )
1256   GFXDECODE_ENTRY( "gfx2", 0, aerofgt_spritelayout, 512, 32 )
12591257GFXDECODE_END
12601258
12611259static GFXDECODE_START( aerfboot )
r18502r18503
23212319   ROM_LOAD( "538a54.124",   0x000000, 0x80000, CRC(4d2c4df2) SHA1(f51c2b3135f0a921ac1a79e63d6878c03cb6254b) )
23222320   ROM_LOAD( "1538a54.124",  0x080000, 0x80000, CRC(286d109e) SHA1(3a5f3d2d89cf58f6ef15e4bd3f570b84e8e695b2) )
23232321
2324   ROM_REGION( 0x100000, "gfx2", 0 )
2322   ROM_REGION( 0x400000, "gfx2", 0 )
23252323   ROM_LOAD( "538a53.u9",    0x000000, 0x100000, CRC(630d8e0b) SHA1(5a0c252ccd53c5199a695909d25ecb4e53dc15b9) )
2324   ROM_LOAD( "534g8f.u18",   0x200000, 0x080000, CRC(76ce0926) SHA1(5ef4cec215d4dd600d8fcd1bd9a4c09081d59e33) )
23262325
2327   ROM_REGION( 0x080000, "gfx3", 0 )
2328   ROM_LOAD( "534g8f.u18",   0x000000, 0x80000, CRC(76ce0926) SHA1(5ef4cec215d4dd600d8fcd1bd9a4c09081d59e33) )
2329
23302326   ROM_REGION( 0x40000, "ymsnd.deltat", 0 ) /* sound samples */
23312327   ROM_LOAD( "it-19-01",     0x00000, 0x40000, CRC(6d42723d) SHA1(57c59234e9925430a4c687733682efed06d7eed1) )
23322328
trunk/src/mame/drivers/inufuku.c
r18502r18503
488488******************************************************************************/
489489
490490GAME( 1998, inufuku, 0, inufuku, inufuku, driver_device, 0, ROT0, "Video System Co.", "Quiz & Variety Sukusuku Inufuku (Japan)", GAME_NO_COCKTAIL | GAME_SUPPORTS_SAVE )
491GAME( 1996, 3on3dunk, 0, _3on3dunk, inufuku, driver_device, 0, ROT0, "Video System Co.", "3 On 3 Dunk Madness (US, prototype?)", GAME_NOT_WORKING )
491GAME( 1996, 3on3dunk, 0, _3on3dunk, inufuku, driver_device, 0, ROT0, "Video System Co.", "3 On 3 Dunk Madness (US, prototype? 1997/02/04)", GAME_NO_COCKTAIL | GAME_SUPPORTS_SAVE )
trunk/src/mame/drivers/3x3puzzl.c
r18502r18503
164164void _3x3puzzle_state::video_start()
165165{
166166   m_tilemap1 = &machine().tilemap().create(tilemap_get_info_delegate(FUNC(_3x3puzzle_state::get_tile1_info),this), TILEMAP_SCAN_ROWS, 16, 16, 32, 32);
167   m_tilemap2 = &machine().tilemap().create(tilemap_get_info_delegate(FUNC(_3x3puzzle_state::get_tile2_info),this), TILEMAP_SCAN_ROWS, 8, 8, 64, 64);
168   m_tilemap3 = &machine().tilemap().create(tilemap_get_info_delegate(FUNC(_3x3puzzle_state::get_tile3_info),this), TILEMAP_SCAN_ROWS, 8, 8, 64, 64);
167   m_tilemap2 = &machine().tilemap().create(tilemap_get_info_delegate(FUNC(_3x3puzzle_state::get_tile2_info),this), TILEMAP_SCAN_ROWS, 8, 8, 64, 32);
168   m_tilemap3 = &machine().tilemap().create(tilemap_get_info_delegate(FUNC(_3x3puzzle_state::get_tile3_info),this), TILEMAP_SCAN_ROWS, 8, 8, 64, 32);
169169   m_tilemap2->set_transparent_pen(0);
170170   m_tilemap3->set_transparent_pen(0);
171171}
trunk/src/mame/video/vsystem_spr.c
r18502r18503
1515// Tecmo World Cup '94
1616// Tao Taido
1717
18/* old notes */
19
20/*** Fujitsu CG10103 **********************************************/
21
22/*
23    Fujitsu CG10103 sprite generator
24    --------------------------------
25
26- Tile based
27- 16x16 4bpp tiles
28- Up to 7x7 in each block
29- 5 bit of palette selection for the mixer
30- Scaling (x/y)
31- Flipping
32- Indipendent sorting list
33- 1 bit of pri for the mixer
34
35Note that this chip can be connected to a VS9210 which adds a level of indirection for
36tile numbers. Basically, the VS9210 indirects the tilet number through a table in its attached
37memory, before accessing the ROMs.
38
39
40    Sorting list format (VideoRAM offset 0)
41    ---------------------------------------
42
43de-- ---f ssss ssss
44
45e=end of list
46f=sprite present in this position
47s=sprite index
48d=disable sprite?
49
50
51TODO:
52Priorities should be right, but they probably need to be orthogonal with the mixer priorities.
53Zoom factor is not correct, the scale is probably non-linear
54Horizontal wrapping is just a hack. The chip probably calculates if it needs to draw the sprite at the
55  normal position, or wrapped along X/Y.
56Abstracts the VS9210
57
58*/
59
60
61
1862#include "emu.h"
1963#include "vsystem_spr.h"
2064
65/* game specific tile indirection callbacks for different HW hookups */
66UINT32 inufuku_tile_callback( UINT32 code, UINT16* lookupram1, UINT16* lookupram2 )
67{
68   return ((lookupram1[code*2] & 0x0007) << 16) + lookupram1[(code*2)+ 1];
69}
2170
71UINT32 suprslam_tile_callback( UINT32 code, UINT16* lookupram1, UINT16* lookupram2 )
72{
73   return lookupram1[code];
74}
75
76UINT32 crshrace_tile_callback( UINT32 code, UINT16* lookupram1, UINT16* lookupram2 )
77{
78   return lookupram1[code&0x7fff];
79}
80
81UINT32 f1gp2_tile_callback( UINT32 code, UINT16* lookupram1, UINT16* lookupram2 )
82{
83   return lookupram1[code&0x3fff];
84}
85
86UINT32 gstriker_tile_callback( UINT32 code, UINT16* lookupram1, UINT16* lookupram2 )
87{
88   // straight through
89   return code;
90}
91
92UINT32 taotaido_tile_callback( UINT32 code, UINT16* lookupram1, UINT16* lookupram2 )
93{
94   code = lookupram1[code&0x7fff];
95
96   if (code > 0x3fff)
97   {
98      int block = (code & 0x3800)>>11;
99      code &= 0x07ff;
100      code |= lookupram2[block] * 0x800;
101   }
102
103   return code;
104}
105
106
22107const device_type VSYSTEM_SPR = &device_creator<vsystem_spr_device>;
23108
24109vsystem_spr_device::vsystem_spr_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock)
25110   : device_t(mconfig, VSYSTEM_SPR, "vsystem_spr_device", tag, owner, clock)
26111{
112   m_CG10103.transpen = 15;
113   m_CG10103.pal_base = 0;
114
27115}
28116
29117
r18502r18503
40128
41129void vsystem_spr_device::get_sprite_attributes(UINT16* ram)
42130{
43      /*
44            attr_start + 0x0000
45            ---- ---x xxxx xxxx oy
46            ---- xxx- ---- ---- ysize
47            xxxx ---- ---- ---- zoomy
131   /*
132        attr_start + 0x0000
133        ---- ---x xxxx xxxx oy
134        ---- xxx- ---- ---- ysize
135        xxxx ---- ---- ---- zoomy
48136
49            attr_start + 0x0001
50            ---- ---x xxxx xxxx ox
51            ---- xxx- ---- ---- xsize
52            xxxx ---- ---- ---- zoomx
137        attr_start + 0x0001
138        ---- ---x xxxx xxxx ox
139        ---- xxx- ---- ---- xsize
140        xxxx ---- ---- ---- zoomx
53141
54            attr_start + 0x0002
55            -x-- ---- ---- ---- flipx
56            x--- ---- ---- ---- flipy
57            --xx xxxx ---- ---- color
58            --xx ---- ---- ---- priority? (upper color bits)
59            ---- ---- ---- ---x map start (msb)
142        attr_start + 0x0002
143        -x-- ---- ---- ---- flipx
144        x--- ---- ---- ---- flipy
145        --xx xxxx ---- ---- color
146        --xx ---- ---- ---- priority? (upper color bits)
147        ---- ---- ---- ---x map start (msb)
60148
61            attr_start + 0x0003
62            xxxx xxxx xxxx xxxx map start (lsb)
63        */
149        attr_start + 0x0003
150        xxxx xxxx xxxx xxxx map start (lsb)
151    */
64152
65      curr_sprite.oy =    (ram[0] & 0x01ff);
66      curr_sprite.ysize = (ram[0] & 0x0e00) >> 9;
67      curr_sprite.zoomy = (ram[0] & 0xf000) >> 12;
153   curr_sprite.oy =    (ram[0] & 0x01ff);
154   curr_sprite.ysize = (ram[0] & 0x0e00) >> 9;
155   curr_sprite.zoomy = (ram[0] & 0xf000) >> 12;
68156
69      curr_sprite.ox =    (ram[1] & 0x01ff);
70      curr_sprite.xsize = (ram[1] & 0x0e00) >> 9;
71      curr_sprite.zoomx = (ram[1] & 0xf000) >> 12;
157   curr_sprite.ox =    (ram[1] & 0x01ff);
158   curr_sprite.xsize = (ram[1] & 0x0e00) >> 9;
159   curr_sprite.zoomx = (ram[1] & 0xf000) >> 12;
72160
73      curr_sprite.flipx = (ram[2] & 0x4000);
74      curr_sprite.flipy = (ram[2] & 0x8000);
75      curr_sprite.color = (ram[2] & 0x3f00) >> 8;
76      curr_sprite.pri   = (ram[2] & 0x3000) >> 12;
77      curr_sprite.map   = (ram[2] & 0x0001) << 16;
161   curr_sprite.flipx = (ram[2] & 0x4000);
162   curr_sprite.flipy = (ram[2] & 0x8000);
163   curr_sprite.color = (ram[2] & 0x3f00) >> 8;
164   curr_sprite.pri   = (ram[2] & 0x3000) >> 12;
165   curr_sprite.map   = (ram[2] & 0x0001) << 16;
78166
79      curr_sprite.map  |= (ram[3] & 0xffff);
167   curr_sprite.map  |= (ram[3] & 0xffff);
168}
80169
170
171void vsystem_spr_device::common_sprite_drawgfx(int gfxrgn, UINT16* spriteram2, UINT16* spriteram3, vsystem_spr_tile_indirection_callback tilecb, running_machine &machine, bitmap_ind16 &bitmap, const rectangle &cliprect)
172{
173   gfx_element *gfx = machine.gfx[gfxrgn];
174
175   curr_sprite.zoomx = 32 - curr_sprite.zoomx;
176   curr_sprite.zoomy = 32 - curr_sprite.zoomy;
177
178   int ystart, yend, yinc;
179   
180   if (!curr_sprite.flipy)   { ystart = 0; yend = curr_sprite.ysize+1; yinc = 1; }
181   else                    { ystart = curr_sprite.ysize; yend = -1; yinc = -1; }
182
183   int ycnt = ystart;
184   while (ycnt != yend)
185   {
186      int xstart, xend, xinc;
187
188      if (!curr_sprite.flipx)   { xstart = 0; xend = curr_sprite.xsize+1; xinc = 1; }
189      else                    { xstart = curr_sprite.xsize; xend = -1; xinc = -1; }
190
191      int xcnt = xstart;
192      while (xcnt != xend)
193      {
194         int startno = tilecb(curr_sprite.map++, spriteram2, spriteram3);
195         drawgfxzoom_transpen(bitmap, cliprect, gfx, startno, curr_sprite.color + m_CG10103.pal_base, curr_sprite.flipx, curr_sprite.flipy, curr_sprite.ox + xcnt * curr_sprite.zoomx/2,        curr_sprite.oy + ycnt * curr_sprite.zoomy/2,        curr_sprite.zoomx << 11, curr_sprite.zoomy << 11, m_CG10103.transpen);
196         drawgfxzoom_transpen(bitmap, cliprect, gfx, startno, curr_sprite.color + m_CG10103.pal_base, curr_sprite.flipx, curr_sprite.flipy, -0x200+curr_sprite.ox + xcnt * curr_sprite.zoomx/2, curr_sprite.oy + ycnt * curr_sprite.zoomy/2,        curr_sprite.zoomx << 11, curr_sprite.zoomy << 11, m_CG10103.transpen);     
197         drawgfxzoom_transpen(bitmap, cliprect, gfx, startno, curr_sprite.color + m_CG10103.pal_base, curr_sprite.flipx, curr_sprite.flipy, curr_sprite.ox + xcnt * curr_sprite.zoomx/2,        -0x200+curr_sprite.oy + ycnt * curr_sprite.zoomy/2, curr_sprite.zoomx << 11, curr_sprite.zoomy << 11, m_CG10103.transpen);
198         drawgfxzoom_transpen(bitmap, cliprect, gfx, startno, curr_sprite.color + m_CG10103.pal_base, curr_sprite.flipx, curr_sprite.flipy, -0x200+curr_sprite.ox + xcnt * curr_sprite.zoomx/2, -0x200+curr_sprite.oy + ycnt * curr_sprite.zoomy/2, curr_sprite.zoomx << 11, curr_sprite.zoomy << 11, m_CG10103.transpen);     
199         xcnt+=xinc;
200      }
201      ycnt+=yinc;
202   }
203   
81204}
82205
83// zooming is wrong for 3on3dunk ... suprslam implementation is probably better
206// same as above but for pdrawgfx implementations
207void vsystem_spr_device::common_sprite_pdrawgfx(int gfxrgn, UINT16* spriteram2, UINT16* spriteram3, vsystem_spr_tile_indirection_callback tilecb, running_machine &machine, bitmap_ind16 &bitmap, const rectangle &cliprect)
208{
209   gfx_element *gfx = machine.gfx[gfxrgn];
210   int priority_mask;
211
212   switch (curr_sprite.pri)
213   {
214      default:
215      case 0:   priority_mask = 0x00; break;
216      case 3:   priority_mask = 0xfe; break;
217      case 2:   priority_mask = 0xfc; break;
218      case 1:   priority_mask = 0xf0; break;
219   }
220
221
222   curr_sprite.zoomx = 32 - curr_sprite.zoomx;
223   curr_sprite.zoomy = 32 - curr_sprite.zoomy;
224
225   int ystart, yend, yinc;
226   
227   if (!curr_sprite.flipy)   { ystart = 0; yend = curr_sprite.ysize+1; yinc = 1; }
228   else                    { ystart = curr_sprite.ysize; yend = -1; yinc = -1; }
229
230   int ycnt = ystart;
231   while (ycnt != yend)
232   {
233      int xstart, xend, xinc;
234
235      if (!curr_sprite.flipx)   { xstart = 0; xend = curr_sprite.xsize+1; xinc = 1; }
236      else                    { xstart = curr_sprite.xsize; xend = -1; xinc = -1; }
237
238      int xcnt = xstart;
239      while (xcnt != xend)
240      {
241         int startno = tilecb(curr_sprite.map++, spriteram2, spriteram3);   
242         pdrawgfxzoom_transpen(bitmap, cliprect, gfx, startno, curr_sprite.color + m_CG10103.pal_base, curr_sprite.flipx, curr_sprite.flipy, curr_sprite.ox + xcnt * curr_sprite.zoomx/2,        curr_sprite.oy + ycnt * curr_sprite.zoomy/2,        curr_sprite.zoomx << 11, curr_sprite.zoomy << 11, machine.priority_bitmap,priority_mask, m_CG10103.transpen);
243         pdrawgfxzoom_transpen(bitmap, cliprect, gfx, startno, curr_sprite.color + m_CG10103.pal_base, curr_sprite.flipx, curr_sprite.flipy, -0x200+curr_sprite.ox + xcnt * curr_sprite.zoomx/2, curr_sprite.oy + ycnt * curr_sprite.zoomy/2,        curr_sprite.zoomx << 11, curr_sprite.zoomy << 11, machine.priority_bitmap,priority_mask, m_CG10103.transpen);     
244         pdrawgfxzoom_transpen(bitmap, cliprect, gfx, startno, curr_sprite.color + m_CG10103.pal_base, curr_sprite.flipx, curr_sprite.flipy, curr_sprite.ox + xcnt * curr_sprite.zoomx/2,        -0x200+curr_sprite.oy + ycnt * curr_sprite.zoomy/2, curr_sprite.zoomx << 11, curr_sprite.zoomy << 11, machine.priority_bitmap,priority_mask, m_CG10103.transpen);
245         pdrawgfxzoom_transpen(bitmap, cliprect, gfx, startno, curr_sprite.color + m_CG10103.pal_base, curr_sprite.flipx, curr_sprite.flipy, -0x200+curr_sprite.ox + xcnt * curr_sprite.zoomx/2, -0x200+curr_sprite.oy + ycnt * curr_sprite.zoomy/2, curr_sprite.zoomx << 11, curr_sprite.zoomy << 11, machine.priority_bitmap,priority_mask, m_CG10103.transpen);     
246         xcnt+=xinc;
247      }
248      ycnt+=yinc;
249   }
250}
251
252
84253void vsystem_spr_device::draw_sprites_inufuku( UINT16* spriteram, int spriteram_bytes, UINT16* spriteram2, running_machine &machine, bitmap_ind16 &bitmap, const rectangle &cliprect )
85254{
86255   int offs;
r18502r18503
97266      if ((spriteram[offs] & 0x8000) == 0x0000)
98267      {
99268         int attr_start;
100         int x, y;
101         int priority_mask;
102269
103270         attr_start = 4 * (spriteram[offs] & 0x03ff);
104271
105272         get_sprite_attributes(&spriteram[attr_start]);
106273
107         curr_sprite.oy += 1;
274//         curr_sprite.oy += 1;
108275         curr_sprite.map &= 0x7fff;
109276
110         switch (curr_sprite.pri)
111         {
112            default:
113            case 0:   priority_mask = 0x00; break;
114            case 3:   priority_mask = 0xfe; break;
115            case 2:   priority_mask = 0xfc; break;
116            case 1:   priority_mask = 0xf0; break;
117         }
118
119         curr_sprite.ox += (curr_sprite.xsize * curr_sprite.zoomx + 2) / 4;
120         curr_sprite.oy += (curr_sprite.ysize * curr_sprite.zoomy + 2) / 4;
121
122         curr_sprite.zoomx = 32 - curr_sprite.zoomx;
123         curr_sprite.zoomy = 32 - curr_sprite.zoomy;
124
125         for (y = 0; y <= curr_sprite.ysize; y++)
126         {
127            int sx, sy;
128
129            if (curr_sprite.flipy)
130               sy = (curr_sprite.oy + curr_sprite.zoomy * (curr_sprite.ysize - y) / 2 + 16) & 0x1ff;
131            else
132               sy = (curr_sprite.oy + curr_sprite.zoomy * y / 2 + 16) & 0x1ff;
133
134            for (x = 0; x <= curr_sprite.xsize; x++)
135            {
136               int code;
137
138               if (curr_sprite.flipx)
139                  sx = (curr_sprite.ox + curr_sprite.zoomx * (curr_sprite.xsize - x) / 2 + 16) & 0x1ff;
140               else
141                  sx = (curr_sprite.ox + curr_sprite.zoomx * x / 2 + 16) & 0x1ff;
142
143               code  = ((spriteram2[curr_sprite.map*2] & 0x0007) << 16) + spriteram2[(curr_sprite.map*2)+ 1];
144
145               pdrawgfxzoom_transpen(bitmap, cliprect, machine.gfx[2],
146                     code,
147                     curr_sprite.color,
148                     curr_sprite.flipx, curr_sprite.flipy,
149                     sx - 16, sy - 16,
150                     curr_sprite.zoomx << 11, curr_sprite.zoomy << 11,
151                     machine.priority_bitmap,priority_mask, 15);
152
153               curr_sprite.map ++;
154            }
155         }
277         common_sprite_pdrawgfx(2, spriteram2, NULL, inufuku_tile_callback, machine, bitmap, cliprect);
156278      }
157279   }
158280}
159281
160282
161
162/* todo, fix zooming correctly, it's _not_ like aerofgt */
163283void vsystem_spr_device::draw_sprites_suprslam( UINT16* spriteram, int spriteram_bytes, UINT16* spriteram2, running_machine &machine, bitmap_ind16 &bitmap, const rectangle &cliprect )
164284{
165   gfx_element *gfx = machine.gfx[1];
166285   UINT16 *source = spriteram;
167286   UINT16 *source2 = spriteram;
168287   UINT16 *finish = source + 0x2000/2;
r18502r18503
171290   {
172291      UINT32 sprnum = source[0] & 0x03ff;
173292      if (source[0] == 0x4000) break;
174
175293      sprnum *= 4;
176
177294      source++;
178      /* DRAW START */
179      {
180         get_sprite_attributes(&source2[sprnum]);
181295
182         curr_sprite.map &= 0x7fff;
183                           
184         int xcnt, ycnt;
185296
186         int loopno = 0;
297      get_sprite_attributes(&source2[sprnum]);
187298
188         curr_sprite.zoomx = 32 - curr_sprite.zoomx;
189         curr_sprite.zoomy = 32 - curr_sprite.zoomy;
299      curr_sprite.map &= 0x7fff;               
190300
191         if (curr_sprite.oy > 0xff) curr_sprite.oy -=0x200;
192
193         for (ycnt = 0; ycnt < curr_sprite.ysize+1; ycnt ++)
194         {
195            if (!curr_sprite.flipx)
196            {
197               for (xcnt = 0; xcnt < curr_sprite.xsize+1; xcnt ++)
198               {
199                  int startno = spriteram2[curr_sprite.map + loopno];
200                  drawgfxzoom_transpen(bitmap, cliprect, gfx, startno, curr_sprite.color, 0, 0,curr_sprite.ox + xcnt * curr_sprite.zoomx/2, curr_sprite.oy + ycnt * curr_sprite.zoomy/2,curr_sprite.zoomx << 11, curr_sprite.zoomy << 11, 15);
201                  drawgfxzoom_transpen(bitmap, cliprect, gfx, startno, curr_sprite.color, 0, 0,-0x200+curr_sprite.ox + xcnt * curr_sprite.zoomx/2, curr_sprite.oy + ycnt * curr_sprite.zoomy/2,curr_sprite.zoomx << 11, curr_sprite.zoomy << 11, 15);
202                  loopno ++;
203               }
204            }
205            else
206            {
207               for (xcnt = curr_sprite.xsize; xcnt >= 0; xcnt --)
208               {
209                  int startno = spriteram2[curr_sprite.map + loopno];
210                  drawgfxzoom_transpen(bitmap, cliprect, gfx, startno, curr_sprite.color, 1, 0,curr_sprite.ox + xcnt * curr_sprite.zoomx/2, curr_sprite.oy + ycnt * curr_sprite.zoomy/2,curr_sprite.zoomx << 11, curr_sprite.zoomy << 11, 15);
211                  drawgfxzoom_transpen(bitmap, cliprect, gfx, startno, curr_sprite.color, 1, 0,-0x200+curr_sprite.ox + xcnt * curr_sprite.zoomx/2, curr_sprite.oy + ycnt * curr_sprite.zoomy/2,curr_sprite.zoomx << 11, curr_sprite.zoomy << 11, 15);
212                  loopno ++;
213               }
214            }
215         }
216      }
301      common_sprite_drawgfx(1, spriteram2, NULL, suprslam_tile_callback, machine, bitmap, cliprect);
217302   }
218303}
219304
r18502r18503
221306
222307void vsystem_spr_device::draw_sprite_taotaido( UINT16* spriteram, int spriteram_bytes, UINT16* spriteram2, UINT16* spriteram3, running_machine &machine, UINT16 spriteno, bitmap_ind16 &bitmap, const rectangle &cliprect )
223308{
224   /*- SPR RAM Format -**
225
226      4 words per sprite
227
228      zzzz sssp  pppp pppp (y zoom, y size, y position)
229      zzzz sssp  pppp pppp (x zoom, x size, x position)
230      yxpc cccc  ---- ---- (flipy, >flipx, priority?, color)
231      -nnn nnnn  nnnn nnnn (map_start lookup)
232
233    */
234
235   int x,y;
236
237309   UINT16 *source = &spriteram[spriteno*4];
238   gfx_element *gfx = machine.gfx[0];
239310
240311   get_sprite_attributes(&source[0]);
241312
242313   curr_sprite.map &= 0xffff;
243314   curr_sprite.color &= 0x1f;
244315
245   curr_sprite.ox += (curr_sprite.xsize*curr_sprite.zoomx+2)/4;
246   curr_sprite.oy += (curr_sprite.ysize*curr_sprite.zoomy+2)/4;
247
248   curr_sprite.zoomx = 32 - curr_sprite.zoomx;
249   curr_sprite.zoomy = 32 - curr_sprite.zoomy;
250
251
252   for (y = 0;y <= curr_sprite.ysize;y++)
253   {
254      int sx,sy;
255
256      if (curr_sprite.flipy) sy = ((curr_sprite.oy + curr_sprite.zoomy * (curr_sprite.ysize - y)/2 + 16) & 0x1ff) - 16;
257         else sy = ((curr_sprite.oy + curr_sprite.zoomy * y / 2 + 16) & 0x1ff) - 16;
258
259      for (x = 0;x <= curr_sprite.xsize;x++)
260      {
261
262         /* this indirection is a bit different to the other video system games */
263         int realstart;
264
265         realstart = spriteram2[curr_sprite.map&0x7fff];
266
267         if (realstart > 0x3fff)
268         {
269            int block;
270
271            block = (realstart & 0x3800)>>11;
272
273            realstart &= 0x07ff;
274            realstart |= spriteram3[block] * 0x800;
275         }
276
277         if (curr_sprite.flipx) sx = ((curr_sprite.ox + curr_sprite.zoomx * (curr_sprite.xsize - x) / 2 + 16) & 0x1ff) - 16;
278            else sx = ((curr_sprite.ox + curr_sprite.zoomx * x / 2 + 16) & 0x1ff) - 16;
279
280
281         drawgfxzoom_transpen(bitmap,cliprect,gfx,
282                  realstart,
283                  curr_sprite.color,
284                  curr_sprite.flipx,curr_sprite.flipy,
285                  sx,sy,
286                  curr_sprite.zoomx << 11, curr_sprite.zoomy << 11,15);
287
288         curr_sprite.map++;
289
290      }
291   }
316   common_sprite_drawgfx(0, spriteram2, spriteram3, taotaido_tile_callback, machine, bitmap, cliprect);
292317}
293318
294319void vsystem_spr_device::draw_sprites_taotaido( UINT16* spriteram, int spriteram_bytes, UINT16* spriteram2, UINT16* spriteram3, running_machine &machine, bitmap_ind16 &bitmap, const rectangle &cliprect )
r18502r18503
316341   while (offs < 0x0400 && (spriteram[offs] & 0x4000) == 0)
317342   {
318343      int attr_start;
319      int x, y;
320      /* table hand made by looking at the ship explosion in aerofgt attract mode */
321      /* it's almost a logarithmic scale but not exactly */
322      static const int zoomtable[16] = { 0,7,14,20,25,30,34,38,42,46,49,52,54,57,59,61 };
323344
324345      attr_start = 4 * (spriteram[offs++] & 0x03ff);
325346
r18502r18503
328349      curr_sprite.color &= 0x1f;
329350      curr_sprite.map &= 0x7fff;
330351
331      curr_sprite.zoomx = 16 - zoomtable[curr_sprite.zoomx] / 8;
332      curr_sprite.zoomy = 16 - zoomtable[curr_sprite.zoomy] / 8;
333
334      if (spriteram[attr_start + 2] & 0x20ff) curr_sprite.color = machine.rand();
335
336      for (y = 0; y <= curr_sprite.ysize; y++)
337      {
338         int sx,sy;
339
340         if (curr_sprite.flipy) sy = ((curr_sprite.oy + curr_sprite.zoomy * (curr_sprite.ysize - y) + 16) & 0x1ff) - 16;
341         else sy = ((curr_sprite.oy + curr_sprite.zoomy * y + 16) & 0x1ff) - 16;
342
343         for (x = 0; x <= curr_sprite.xsize; x++)
344         {
345            int code;
346
347            if (curr_sprite.flipx) sx = ((curr_sprite.ox + curr_sprite.zoomx * (curr_sprite.xsize - x) + 16) & 0x1ff) - 16;
348            else sx = ((curr_sprite.ox + curr_sprite.zoomx * x + 16) & 0x1ff) - 16;
349
350            code = spriteram2[curr_sprite.map & 0x7fff];
351            curr_sprite.map++;
352
353            if (flipscreen)
354               drawgfxzoom_transpen(bitmap,cliprect,machine.gfx[2],
355                     code,
356                     curr_sprite.color,
357                     !curr_sprite.flipx,!curr_sprite.flipy,
358                     304-sx,208-sy,
359                     0x1000 * curr_sprite.zoomx,0x1000 * curr_sprite.zoomy,15);
360            else
361               drawgfxzoom_transpen(bitmap,cliprect,machine.gfx[2],
362                     code,
363                     curr_sprite.color,
364                     curr_sprite.flipx,curr_sprite.flipy,
365                     sx,sy,
366                     0x1000 * curr_sprite.zoomx,0x1000 * curr_sprite.zoomy,15);
367         }
368      }
352      common_sprite_drawgfx(2, spriteram2, NULL, crshrace_tile_callback, machine, bitmap, cliprect);
369353   }
370354}
371355
r18502r18503
384368      /* is the way I handle pri correct? Or should I just check bit 13? */
385369      if ((spriteram3[attr_start + 2] & 0x3000) == pri)
386370      {
387         int x, y;
388
389371         get_sprite_attributes(&spriteram3[attr_start]);
390372
391         curr_sprite.color &=0xf;
373         curr_sprite.color &=0x1f;
392374         curr_sprite.map &= 0x3fff;
393         curr_sprite.ox += (curr_sprite.xsize * curr_sprite.zoomx + 2) / 4;
394         curr_sprite.oy += (curr_sprite.ysize * curr_sprite.zoomy + 2) / 4;
375   
376         common_sprite_drawgfx(2, spriteram1, NULL, crshrace_tile_callback, machine, bitmap, cliprect);
395377
396         curr_sprite.zoomx = 32 - curr_sprite.zoomx;
397         curr_sprite.zoomy = 32 - curr_sprite.zoomy;
398
399         for (y = 0; y <= curr_sprite.ysize; y++)
400         {
401            int sx, sy;
402
403            if (curr_sprite.flipy)
404               sy = ((curr_sprite.oy + curr_sprite.zoomy * (curr_sprite.ysize - y)/2 + 16) & 0x1ff) - 16;
405            else
406               sy = ((curr_sprite.oy + curr_sprite.zoomy * y / 2 + 16) & 0x1ff) - 16;
407
408            for (x = 0; x <= curr_sprite.xsize; x++)
409            {
410               int code;
411
412               if (curr_sprite.flipx)
413                  sx = ((curr_sprite.ox + curr_sprite.zoomx * (curr_sprite.xsize - x) / 2 + 16) & 0x1ff) - 16;
414               else
415                  sx = ((curr_sprite.ox + curr_sprite.zoomx * x / 2 + 16) & 0x1ff) - 16;
416
417               if (curr_sprite.map < 0x2000)
418                  code = spriteram1[curr_sprite.map & 0x1fff] & 0x1fff;
419               else
420                  code = spriteram2[curr_sprite.map & 0x1fff] & 0x1fff;
421
422               drawgfxzoom_transpen(bitmap,cliprect,machine.gfx[2 + (curr_sprite.map >= 0x2000 ? 1 : 0)],
423                     code,
424                     curr_sprite.color,
425                     curr_sprite.flipx,curr_sprite.flipy,
426                     sx,sy,
427                     curr_sprite.zoomx << 11, curr_sprite.zoomy << 11,15);
428               curr_sprite.map++;
429            }
430         }
431378      }
432379      offs++;
433380   }
r18502r18503
442389   while (offs < 0x0400 && (spritelist[offs] & 0x4000) == 0)
443390   {
444391      int attr_start;
445      int x, y;
446392
447393      attr_start = 4 * (spritelist[offs++] & 0x01ff);
448394
r18502r18503
451397      curr_sprite.color &= 0x1f;
452398      curr_sprite.map &= 0x7fff;
453399
454// aerofgt has the following adjustment, but doing it here would break the title screen
455//      curr_sprite.ox += (curr_sprite.xsize*curr_sprite.zoomx+2)/4;
456//      curr_sprite.oy += (curr_sprite.ysize*curr_sprite.zoomy+2)/4;
457
458      curr_sprite.zoomx = 32 - curr_sprite.zoomx;
459      curr_sprite.zoomy = 32 - curr_sprite.zoomy;
460
461      if (spritelist[attr_start + 2] & 0x20ff)
462         curr_sprite.color = machine.rand();
463
464      for (y = 0; y <= curr_sprite.ysize; y++)
465      {
466         int sx,sy;
467
468         if (curr_sprite.flipy) sy = ((curr_sprite.oy + curr_sprite.zoomy * (curr_sprite.ysize - y)/2 + 16) & 0x1ff) - 16;
469         else sy = ((curr_sprite.oy + curr_sprite.zoomy * y / 2 + 16) & 0x1ff) - 16;
470
471         for (x = 0; x <= curr_sprite.xsize; x++)
472         {
473            int code;
474
475            if (curr_sprite.flipx) sx = ((curr_sprite.ox + curr_sprite.zoomx * (curr_sprite.xsize - x) / 2 + 16) & 0x1ff) - 16;
476            else sx = ((curr_sprite.ox + curr_sprite.zoomx * x / 2 + 16) & 0x1ff) - 16;
477
478            code = sprcgram[curr_sprite.map & 0x3fff];
479            curr_sprite.map++;
480
481            if (flipscreen)
482               drawgfxzoom_transpen(bitmap,cliprect,machine.gfx[1],
483                     code,
484                     curr_sprite.color,
485                     !curr_sprite.flipx,!curr_sprite.flipy,
486                     304-sx,208-sy,
487                     curr_sprite.zoomx << 11,curr_sprite.zoomy << 11,15);
488            else
489               drawgfxzoom_transpen(bitmap,cliprect,machine.gfx[1],
490                     code,
491                     curr_sprite.color,
492                     curr_sprite.flipx,curr_sprite.flipy,
493                     sx,sy,
494                     curr_sprite.zoomx << 11,curr_sprite.zoomy << 11,15);
495         }
496      }
400      common_sprite_drawgfx(1, sprcgram, NULL, f1gp2_tile_callback, machine, bitmap, cliprect);
497401   }
498402}
499403
500404
501/*** Fujitsu CG10103 **********************************************/
502
503/*
504    Fujitsu CG10103 sprite generator
505    --------------------------------
506
507- Tile based
508- 16x16 4bpp tiles
509- Up to 7x7 in each block
510- 5 bit of palette selection for the mixer
511- Scaling (x/y)
512- Flipping
513- Indipendent sorting list
514- 1 bit of pri for the mixer
515
516Note that this chip can be connected to a VS9210 which adds a level of indirection for
517tile numbers. Basically, the VS9210 indirects the tilet number through a table in its attached
518memory, before accessing the ROMs.
519
520
521    Sorting list format (VideoRAM offset 0)
522    ---------------------------------------
523
524de-- ---f ssss ssss
525
526e=end of list
527f=sprite present in this position
528s=sprite index
529d=disable sprite?
530
531
532TODO:
533Priorities should be right, but they probably need to be orthogonal with the mixer priorities.
534Zoom factor is not correct, the scale is probably non-linear
535Horizontal wrapping is just a hack. The chip probably calculates if it needs to draw the sprite at the
536  normal position, or wrapped along X/Y.
537Abstracts the VS9210
538
539*/
540
541
542void vsystem_spr_device::CG10103_draw_sprite(running_machine &machine, bitmap_ind16& screen, const rectangle &cliprect, UINT16* spr, int drawpri)
405void vsystem_spr_device::CG10103_draw_sprite(running_machine &machine, bitmap_ind16& bitmap, const rectangle &cliprect, UINT16* spr, int drawpri)
543406{
544407   get_sprite_attributes(&spr[0]);
545408   curr_sprite.color &=0x1f;
546409   curr_sprite.pri >>= 1;
547410
548   int x, y;
549   int xstep, ystep;
550   int xfact, yfact;
551
552
553411   // Check if we want to draw this sprite now
554412   if (curr_sprite.pri != drawpri)
555413      return;
556414
557   // Convert in fixed point to handle the scaling
558   curr_sprite.ox <<= 16;
559   curr_sprite.oy <<= 16;
560
561   curr_sprite.xsize++;
562   curr_sprite.ysize++;
563   xstep = ystep = 16;
564
565   // Linear scale, surely wrong
566   xfact = 0x10000 - ((0x8000 * curr_sprite.zoomx) / 15);
567   yfact = 0x10000 - ((0x8000 * curr_sprite.zoomy) / 15);
568
569   xstep *= xfact;
570   ystep *= yfact;
571
572   // Handle flipping
573   if (curr_sprite.flipy)
574   {
575      curr_sprite.oy += (curr_sprite.ysize-1) * ystep;
576      ystep = -ystep;
577   }
578
579   if (curr_sprite.flipx)
580   {
581      curr_sprite.ox += (curr_sprite.xsize-1) * xstep;
582      xstep = -xstep;
583   }
584
585   // Draw the block
586   for (y=0;y<curr_sprite.ysize;y++)
587   {
588      int xp = curr_sprite.ox;
589
590      for (x=0;x<curr_sprite.xsize;x++)
591      {
592         // Hack to handle horizontal wrapping
593         drawgfxzoom_transpen(screen, cliprect, machine.gfx[m_CG10103_cur_chip->gfx_region], curr_sprite.map, curr_sprite.color+m_CG10103_cur_chip->pal_base, curr_sprite.flipx, curr_sprite.flipy, xp>>16, curr_sprite.oy>>16, xfact, yfact, m_CG10103_cur_chip->transpen);
594         drawgfxzoom_transpen(screen, cliprect, machine.gfx[m_CG10103_cur_chip->gfx_region], curr_sprite.map, curr_sprite.color+m_CG10103_cur_chip->pal_base, curr_sprite.flipx, curr_sprite.flipy, (xp>>16) - 0x200, curr_sprite.oy>>16, xfact, yfact, m_CG10103_cur_chip->transpen);
595
596         drawgfxzoom_transpen(screen, cliprect, machine.gfx[m_CG10103_cur_chip->gfx_region], curr_sprite.map, curr_sprite.color+m_CG10103_cur_chip->pal_base, curr_sprite.flipx, curr_sprite.flipy, xp>>16, (curr_sprite.oy>>16)-0x200, xfact, yfact, m_CG10103_cur_chip->transpen);
597         drawgfxzoom_transpen(screen, cliprect, machine.gfx[m_CG10103_cur_chip->gfx_region], curr_sprite.map, curr_sprite.color+m_CG10103_cur_chip->pal_base, curr_sprite.flipx, curr_sprite.flipy, (xp>>16) - 0x200, (curr_sprite.oy>>16)-0x200, xfact, yfact, m_CG10103_cur_chip->transpen);
598
599         xp += xstep;
600         curr_sprite.map++;
601      }
602
603      curr_sprite.oy += ystep;
604   }
415   common_sprite_drawgfx(m_CG10103.gfx_region, NULL, NULL, gstriker_tile_callback, machine, bitmap, cliprect);
605416}
606417
607418
r18502r18503
610421   UINT16* splist;
611422   int i;
612423
613   m_CG10103_cur_chip = &m_CG10103;
424   splist = m_CG10103.vram;
614425
615   splist = m_CG10103_cur_chip->vram;
616
617426   // Parse the sorting list
618427   for (i=0;i<0x400;i++)
619428   {
r18502r18503
629438         int num = cmd & 0x3FF;
630439
631440         // Draw the sprite
632         CG10103_draw_sprite(machine, screen, cliprect, m_CG10103_cur_chip->vram + num*4, pri);
441         CG10103_draw_sprite(machine, screen, cliprect, m_CG10103.vram + num*4, pri);
633442      }
634443   }
635444}
trunk/src/mame/video/vsystem_spr.h
r18502r18503
1313
1414};
1515
16typedef UINT32 (*vsystem_spr_tile_indirection_callback)(UINT32 code, UINT16* lookupram1, UINT16* lookupram2);
17
1618class vsystem_spr_device : public device_t
1719{
1820public:
1921   vsystem_spr_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock);
2022
2123   tCG10103 m_CG10103;
22   tCG10103* m_CG10103_cur_chip;
2324
2425   struct vsystem_sprite_attributes
2526   {
r18502r18503
3738   } curr_sprite;
3839
3940   void get_sprite_attributes(UINT16* ram);
41   void common_sprite_drawgfx(int gfxrgn, UINT16* spriteram2, UINT16* spriteram3, vsystem_spr_tile_indirection_callback tilecb, running_machine &machine, bitmap_ind16 &bitmap, const rectangle &cliprect);
42   void common_sprite_pdrawgfx(int gfxrgn, UINT16* spriteram2, UINT16* spriteram3, vsystem_spr_tile_indirection_callback tilecb, running_machine &machine, bitmap_ind16 &bitmap, const rectangle &cliprect);
4043
4144   void draw_sprites_inufuku(  UINT16* spriteram, int spriteram_bytes, UINT16* spriteram2, running_machine &machine, bitmap_ind16 &bitmap, const rectangle &cliprect );
4245   void draw_sprites_suprslam( UINT16* spriteram, int spriteram_bytes, UINT16* spriteram2, running_machine &machine, bitmap_ind16 &bitmap, const rectangle &cliprect );

Previous 199869 Revisions Next


© 1997-2024 The MAME Team