Previous 199869 Revisions Next

r21025 Wednesday 13th February, 2013 at 11:19:27 UTC by Miodrag Milanović
Modernization of drivers part 21 (no whatsnew)
[src/mame/drivers]wecleman.c wgp.c williams.c xain.c xexex.c xyonix.c zaxxon.c
[src/mame/includes]warpwarp.h warriorb.h wc90.h wc90b.h wecleman.h welltris.h wgp.h williams.h wiz.h wolfpack.h wrally.h wwfsstar.h wwfwfest.h xain.h xexex.h xorworld.h xxmissio.h xyonix.h yiear.h yunsun16.h zac2650.h zaccaria.h zaxxon.h
[src/mame/machine]williams.c
[src/mame/video]warpwarp.c warriorb.c wc90.c wc90b.c welltris.c wgp.c williams.c wiz.c wolfpack.c wrally.c wwfsstar.c wwfwfest.c xain.c xorworld.c xxmissio.c yiear.c yunsun16.c zac2650.c zaccaria.c zaxxon.c

trunk/src/mame/drivers/wgp.c
r21024r21025
413413   COMBINE_DATA(&m_sharedram[offset]);
414414}
415415
416static void parse_control(running_machine &machine)
416void wgp_state::parse_control()
417417{
418418   /* bit 0 enables cpu B */
419419   /* however this fails when recovering from a save state
420420      if cpu B is disabled !! */
421   wgp_state *state = machine.driver_data<wgp_state>();
422   state->m_subcpu->set_input_line(INPUT_LINE_RESET, (state->m_cpua_ctrl & 0x1) ? CLEAR_LINE : ASSERT_LINE);
421   m_subcpu->set_input_line(INPUT_LINE_RESET, (m_cpua_ctrl & 0x1) ? CLEAR_LINE : ASSERT_LINE);
423422
424423   /* bit 1 is "vibration" acc. to test mode */
425424}
r21024r21025
430429      data = data >> 8;   /* for Wgp */
431430   m_cpua_ctrl = data;
432431
433   parse_control(machine());
432   parse_control();
434433
435434   logerror("CPU #0 PC %06x: write %04x to cpu control\n",space.device().safe_pc(),data);
436435}
r21024r21025
601600                          SOUND
602601**********************************************************/
603602
604static void reset_sound_region( running_machine &machine )  /* assumes Z80 sandwiched between the 68Ks */
603void wgp_state::reset_sound_region(  )  /* assumes Z80 sandwiched between the 68Ks */
605604{
606   wgp_state *state = machine.driver_data<wgp_state>();
607   state->membank("bank10")->set_entry(state->m_banknum);
605   membank("bank10")->set_entry(m_banknum);
608606}
609607
610608WRITE8_MEMBER(wgp_state::sound_bankswitch_w)
611609{
612610   m_banknum = data & 7;
613   reset_sound_region(machine());
611   reset_sound_region();
614612}
615613
616614WRITE16_MEMBER(wgp_state::wgp_sound_w)
r21024r21025
912910
913911void wgp_state::wgp_postload()
914912{
915   parse_control(machine());
916   reset_sound_region(machine());
913   parse_control();
914   reset_sound_region();
917915}
918916
919917void wgp_state::machine_reset()
trunk/src/mame/drivers/wecleman.c
r21024r21025
12871287   ROM_LOAD( "602a12.1a",  0x000000, 0x04000, CRC(77b9383d) SHA1(7cb970889677704d6324bb64aafc05326c4503ad) )
12881288ROM_END
12891289
1290static void wecleman_unpack_sprites(running_machine &machine)
1290void wecleman_state::wecleman_unpack_sprites()
12911291{
12921292   const char *region       = "gfx1";  // sprites
12931293
1294   const UINT32 len = machine.root_device().memregion(region)->bytes();
1295   UINT8 *src     = machine.root_device().memregion(region)->base() + len / 2 - 1;
1296   UINT8 *dst     = machine.root_device().memregion(region)->base() + len - 1;
1294   const UINT32 len = machine().root_device().memregion(region)->bytes();
1295   UINT8 *src     = machine().root_device().memregion(region)->base() + len / 2 - 1;
1296   UINT8 *dst     = machine().root_device().memregion(region)->base() + len - 1;
12971297
12981298   while(dst > src)
12991299   {
r21024r21025
13041304   }
13051305}
13061306
1307static void bitswap(running_machine &machine,UINT8 *src,size_t len,int _14,int _13,int _12,int _11,int _10,int _f,int _e,int _d,int _c,int _b,int _a,int _9,int _8,int _7,int _6,int _5,int _4,int _3,int _2,int _1,int _0)
1307void wecleman_state::bitswap(UINT8 *src,size_t len,int _14,int _13,int _12,int _11,int _10,int _f,int _e,int _d,int _c,int _b,int _a,int _9,int _8,int _7,int _6,int _5,int _4,int _3,int _2,int _1,int _0)
13081308{
1309   UINT8 *buffer = auto_alloc_array(machine, UINT8, len);
1309   UINT8 *buffer = auto_alloc_array(machine(), UINT8, len);
13101310   int i;
13111311
13121312   memcpy(buffer,src,len);
r21024r21025
13151315      src[i] =
13161316         buffer[BITSWAP24(i,23,22,21,_14,_13,_12,_11,_10,_f,_e,_d,_c,_b,_a,_9,_8,_7,_6,_5,_4,_3,_2,_1,_0)];
13171317   }
1318   auto_free(machine, buffer);
1318   auto_free(machine(), buffer);
13191319}
13201320
13211321/* Unpack sprites data and do some patching */
r21024r21025
13431343      RAM[i] = BITSWAP8(RAM[i],7,0,1,2,3,4,5,6);
13441344   }
13451345
1346   bitswap(machine(), machine().root_device().memregion("gfx1")->base(), machine().root_device().memregion("gfx1")->bytes(),
1346   bitswap(machine().root_device().memregion("gfx1")->base(), machine().root_device().memregion("gfx1")->bytes(),
13471347         0,1,20,19,18,17,14,9,16,6,4,7,8,15,10,11,13,5,12,3,2);
13481348
13491349   /* Now we can unpack each nibble of the sprites into a pixel (one byte) */
1350   wecleman_unpack_sprites(machine());
1350   wecleman_unpack_sprites();
13511351
13521352   /* Bg & Fg & Txt */
1353   bitswap(machine(), machine().root_device().memregion("gfx2")->base(), machine().root_device().memregion("gfx2")->bytes(),
1353   bitswap(machine().root_device().memregion("gfx2")->base(), machine().root_device().memregion("gfx2")->bytes(),
13541354         20,19,18,17,16,15,12,7,14,4,2,5,6,13,8,9,11,3,10,1,0);
13551355
13561356   /* Road */
1357   bitswap(machine(), machine().root_device().memregion("gfx3")->base(), machine().root_device().memregion("gfx3")->bytes(),
1357   bitswap(machine().root_device().memregion("gfx3")->base(), machine().root_device().memregion("gfx3")->bytes(),
13581358         20,19,18,17,16,15,14,7,12,4,2,5,6,13,8,9,11,3,10,1,0);
13591359
13601360   m_spr_color_offs = 0x40;
r21024r21025
14141414    in a ROM module definition.  This routine unpacks each sprite nibble
14151415    into a byte, doubling the memory consumption. */
14161416
1417static void hotchase_sprite_decode( running_machine &machine, int num16_banks, int bank_size )
1417void wecleman_state::hotchase_sprite_decode( int num16_banks, int bank_size )
14181418{
14191419   UINT8 *base, *temp;
14201420   int i;
14211421
1422   base = machine.root_device().memregion("gfx1")->base(); // sprites
1423   temp = auto_alloc_array(machine, UINT8,  bank_size );
1422   base = machine().root_device().memregion("gfx1")->base(); // sprites
1423   temp = auto_alloc_array(machine(), UINT8,  bank_size );
14241424
14251425   for( i = num16_banks; i >0; i-- ){
14261426      UINT8 *finish   = base + 2*bank_size*i;
r21024r21025
14581458         *dest++ = data & 0xF;
14591459      } while( dest<finish );
14601460   }
1461   auto_free( machine, temp );
1461   auto_free( machine(), temp );
14621462}
14631463
14641464/* Unpack sprites data and do some patching */
r21024r21025
14751475   RAM = memregion("gfx1")->base();
14761476
14771477   /* Now we can unpack each nibble of the sprites into a pixel (one byte) */
1478   hotchase_sprite_decode(machine(),3,0x80000*2);  // num banks, bank len
1478   hotchase_sprite_decode(3,0x80000*2);  // num banks, bank len
14791479
14801480   /* Let's copy the second half of the fg layer gfx (charset) over the first */
14811481   RAM = memregion("gfx3")->base();
trunk/src/mame/drivers/zaxxon.c
r21024r21025
14721472 *
14731473 *************************************/
14741474
1475static void zaxxonj_decode(running_machine &machine, const char *cputag)
1475void zaxxon_state::zaxxonj_decode(const char *cputag)
14761476{
14771477/*
14781478    the values vary, but the translation mask is always laid out like this:
r21024r21025
15171517   };
15181518
15191519   int A;
1520   address_space &space = machine.device(cputag)->memory().space(AS_PROGRAM);
1521   UINT8 *rom = machine.root_device().memregion(cputag)->base();
1522   int size = machine.root_device().memregion(cputag)->bytes();
1523   UINT8 *decrypt = auto_alloc_array(machine, UINT8, size);
1520   address_space &space = machine().device(cputag)->memory().space(AS_PROGRAM);
1521   UINT8 *rom = machine().root_device().memregion(cputag)->base();
1522   int size = machine().root_device().memregion(cputag)->bytes();
1523   UINT8 *decrypt = auto_alloc_array(machine(), UINT8, size);
15241524
15251525   space.set_decrypted_region(0x0000, size - 1, decrypt);
15261526
r21024r21025
15591559
15601560DRIVER_INIT_MEMBER(zaxxon_state,zaxxonj)
15611561{
1562   zaxxonj_decode(machine(), "maincpu");
1562   zaxxonj_decode("maincpu");
15631563}
15641564
15651565
trunk/src/mame/drivers/xexex.c
r21024r21025
114114#endif
115115
116116
117static void xexex_objdma( running_machine &machine, int limiter )
117void xexex_state::xexex_objdma( int limiter )
118118{
119   xexex_state *state = machine.driver_data<xexex_state>();
120119   int counter, num_inactive;
121120   UINT16 *src, *dst;
122121
123   counter = state->m_frame;
124   state->m_frame = machine.primary_screen->frame_number();
125   if (limiter && counter == state->m_frame)
122   counter = m_frame;
123   m_frame = machine().primary_screen->frame_number();
124   if (limiter && counter == m_frame)
126125      return; // make sure we only do DMA transfer once per frame
127126
128   k053247_get_ram(state->m_k053246, &dst);
129   counter = k053247_get_dy(state->m_k053246);
130   src = state->m_spriteram;
127   k053247_get_ram(m_k053246, &dst);
128   counter = k053247_get_dy(m_k053246);
129   src = m_spriteram;
131130   num_inactive = counter = 256;
132131
133132   do
r21024r21025
170169}
171170
172171
173static void parse_control2( running_machine &machine )
172void xexex_state::parse_control2(  )
174173{
175   xexex_state *state = machine.driver_data<xexex_state>();
176
177174   /* bit 0  is data */
178175   /* bit 1  is cs (active low) */
179176   /* bit 2  is clock (active high) */
180177   /* bit 5  is enable irq 6 */
181178   /* bit 6  is enable irq 5 */
182179   /* bit 11 is watchdog */
183   state->ioport("EEPROMOUT")->write(state->m_cur_control2, 0xff);
180   ioport("EEPROMOUT")->write(m_cur_control2, 0xff);
184181
185182   /* bit 8 = enable sprite ROM reading */
186   k053246_set_objcha_line(state->m_k053246, (state->m_cur_control2 & 0x0100) ? ASSERT_LINE : CLEAR_LINE);
183   k053246_set_objcha_line(m_k053246, (m_cur_control2 & 0x0100) ? ASSERT_LINE : CLEAR_LINE);
187184
188185   /* bit 9 = disable alpha channel on K054157 plane 0 (under investigation) */
189   state->m_cur_alpha = !(state->m_cur_control2 & 0x200);
186   m_cur_alpha = !(m_cur_control2 & 0x200);
190187}
191188
192189READ16_MEMBER(xexex_state::control2_r)
r21024r21025
197194WRITE16_MEMBER(xexex_state::control2_w)
198195{
199196   COMBINE_DATA(&m_cur_control2);
200   parse_control2(machine());
197   parse_control2();
201198}
202199
203200
r21024r21025
230227   return soundlatch3_byte_r(space, 0);
231228}
232229
233static void reset_sound_region(running_machine &machine)
230void xexex_state::reset_sound_region()
234231{
235   xexex_state *state = machine.driver_data<xexex_state>();
236   state->membank("bank2")->set_entry(state->m_cur_sound_region & 0x07);
232   membank("bank2")->set_entry(m_cur_sound_region & 0x07);
237233}
238234
239235WRITE8_MEMBER(xexex_state::sound_bankswitch_w)
240236{
241237   m_cur_sound_region = data & 7;
242   reset_sound_region(machine());
238   reset_sound_region();
243239}
244240
245241static void ym_set_mixing(device_t *device, double left, double right)
r21024r21025
291287      if (k053246_is_irq_enabled(m_k053246))
292288      {
293289         // OBJDMA starts at the beginning of V-blank
294         xexex_objdma(machine(), 0);
290         xexex_objdma(0);
295291
296292         // schedule DMA end interrupt
297293         m_dmadelay_timer->adjust(XE_DMADELAY);
r21024r21025
442438
443439void xexex_state::xexex_postload()
444440{
445   parse_control2(machine());
446   reset_sound_region(machine());
441   parse_control2();
442   reset_sound_region();
447443}
448444
449445void xexex_state::machine_start()
trunk/src/mame/drivers/xain.c
r21024r21025
164164    Since MAME's video timing is 0-based, we need to convert this.
165165*/
166166
167INLINE int scanline_to_vcount(int scanline)
167inline int xain_state::scanline_to_vcount(int scanline)
168168{
169169   int vcount = scanline + 8;
170170   if (vcount < 0x100)
trunk/src/mame/drivers/williams.c
r21024r21025
519519ADDRESS_MAP_END
520520
521521
522void defender_install_io_space(address_space &space)
522void williams_state::defender_install_io_space(address_space &space)
523523{
524524   williams_state *state = space.machine().driver_data<williams_state>();
525525   pia6821_device *pia_0 = space.machine().device<pia6821_device>("pia_0");
r21024r21025
534534   space.install_read_handler     (0xc800, 0xcbff, 0, 0x03e0, read8_delegate(FUNC(williams_state::williams_video_counter_r),state));
535535   space.install_readwrite_handler(0xcc00, 0xcc03, 0, 0x03e0, read8_delegate(FUNC(pia6821_device::read), pia_1), write8_delegate(FUNC(pia6821_device::write), pia_1));
536536   space.install_readwrite_handler(0xcc04, 0xcc07, 0, 0x03e0, read8_delegate(FUNC(pia6821_device::read), pia_0), write8_delegate(FUNC(pia6821_device::write), pia_0));
537   state->membank("bank3")->set_base(space.machine().driver_data<williams_state>()->m_nvram);
538   state->membank("bank4")->set_base(space.machine().driver_data<williams_state>()->m_generic_paletteram_8);
537   membank("bank3")->set_base(space.machine().driver_data<williams_state>()->m_nvram);
538   membank("bank4")->set_base(space.machine().driver_data<williams_state>()->m_generic_paletteram_8);
539539}
540540
541541
trunk/src/mame/drivers/xyonix.c
r21024r21025
3333
3434/* Inputs ********************************************************************/
3535
36static void handle_coins(running_machine &machine, int coin)
36void xyonix_state::handle_coins(int coin)
3737{
3838   static const int coinage_table[4][2] = {{2,3},{2,1},{1,2},{1,1}};
39   xyonix_state *state = machine.driver_data<xyonix_state>();
4039   int tmp = 0;
4140
42   //popmessage("Coin %d", state->m_coin);
41   //popmessage("Coin %d", m_coin);
4342
4443   if (coin & 1)   // Coin 2 !
4544   {
46      tmp = (state->ioport("DSW")->read() & 0xc0) >> 6;
47      state->m_coins++;
48      if (state->m_coins >= coinage_table[tmp][0])
45      tmp = (ioport("DSW")->read() & 0xc0) >> 6;
46      m_coins++;
47      if (m_coins >= coinage_table[tmp][0])
4948      {
50         state->m_credits += coinage_table[tmp][1];
51         state->m_coins -= coinage_table[tmp][0];
49         m_credits += coinage_table[tmp][1];
50         m_coins -= coinage_table[tmp][0];
5251      }
53      coin_lockout_global_w(machine, 0); /* Unlock all coin slots */
54      coin_counter_w(machine,1,1); coin_counter_w(machine,1,0); /* Count slot B */
52      coin_lockout_global_w(machine(), 0); /* Unlock all coin slots */
53      coin_counter_w(machine(),1,1); coin_counter_w(machine(),1,0); /* Count slot B */
5554   }
5655
5756   if (coin & 2)   // Coin 1 !
5857   {
59      tmp = (machine.root_device().ioport("DSW")->read() & 0x30) >> 4;
60      state->m_coins++;
61      if (state->m_coins >= coinage_table[tmp][0])
58      tmp = (machine().root_device().ioport("DSW")->read() & 0x30) >> 4;
59      m_coins++;
60      if (m_coins >= coinage_table[tmp][0])
6261      {
63         state->m_credits += coinage_table[tmp][1];
64         state->m_coins -= coinage_table[tmp][0];
62         m_credits += coinage_table[tmp][1];
63         m_coins -= coinage_table[tmp][0];
6564      }
66      coin_lockout_global_w(machine, 0); /* Unlock all coin slots */
67      coin_counter_w(machine,0,1); coin_counter_w(machine,0,0); /* Count slot A */
65      coin_lockout_global_w(machine(), 0); /* Unlock all coin slots */
66      coin_counter_w(machine(),0,1); coin_counter_w(machine(),0,0); /* Count slot A */
6867   }
6968
70   if (state->m_credits >= 9)
71      state->m_credits = 9;
69   if (m_credits >= 9)
70      m_credits = 9;
7271}
7372
7473
r21024r21025
9796            coin = ((ioport("P1")->read() & 0x80) >> 7) | ((ioport("P2")->read() & 0x80) >> 6);
9897            if (coin ^ m_prev_coin && coin != 3)
9998            {
100               if (m_credits < 9) handle_coins(machine(), coin);
99               if (m_credits < 9) handle_coins(coin);
101100            }
102101            m_prev_coin = coin;
103102            return m_credits;
trunk/src/mame/machine/williams.c
r21024r21025
865865}
866866
867867
868INLINE void update_blaster_banking(running_machine &machine)
868inline void williams_state::update_blaster_banking()
869869{
870   williams_state *state = machine.driver_data<williams_state>();
871   state->membank("bank1")->set_entry(state->m_vram_bank * (state->m_blaster_bank + 1));
872   state->membank("bank2")->set_entry(state->m_vram_bank * (state->m_blaster_bank + 1));
870   membank("bank1")->set_entry(m_vram_bank * (m_blaster_bank + 1));
871   membank("bank2")->set_entry(m_vram_bank * (m_blaster_bank + 1));
873872}
874873
875874
r21024r21025
877876{
878877   /* VRAM/ROM banking from bit 0 */
879878   m_vram_bank = data & 0x01;
880   update_blaster_banking(machine());
879   update_blaster_banking();
881880
882881   /* cocktail flip from bit 1 */
883882   m_cocktail = data & 0x02;
r21024r21025
890889WRITE8_MEMBER(williams_state::blaster_bank_select_w)
891890{
892891   m_blaster_bank = data & 15;
893   update_blaster_banking(machine());
892   update_blaster_banking();
894893}
895894
896895
trunk/src/mame/video/zac2650.c
r21024r21025
4848/* Check for Collision between 2 sprites */
4949/*****************************************/
5050
51static int SpriteCollision(running_machine &machine, int first,int second)
51int zac2650_state::SpriteCollision(int first,int second)
5252{
53   zac2650_state *state = machine.driver_data<zac2650_state>();
5453   int Checksum=0;
5554   int x,y;
56   const rectangle &visarea = machine.primary_screen->visible_area();
55   const rectangle &visarea = machine().primary_screen->visible_area();
5756
58   if((state->m_s2636_0_ram[first * 0x10 + 10] < 0xf0) && (state->m_s2636_0_ram[second * 0x10 + 10] < 0xf0))
57   if((m_s2636_0_ram[first * 0x10 + 10] < 0xf0) && (m_s2636_0_ram[second * 0x10 + 10] < 0xf0))
5958   {
60      int fx     = (state->m_s2636_0_ram[first * 0x10 + 10] * 4)-22;
61      int fy     = (state->m_s2636_0_ram[first * 0x10 + 12] * 3)+3;
59      int fx     = (m_s2636_0_ram[first * 0x10 + 10] * 4)-22;
60      int fy     = (m_s2636_0_ram[first * 0x10 + 12] * 3)+3;
6261      int expand = (first==1) ? 2 : 1;
6362
6463      /* Draw first sprite */
6564
66      drawgfx_opaque(state->m_spritebitmap,state->m_spritebitmap.cliprect(), machine.gfx[expand],
65      drawgfx_opaque(m_spritebitmap,m_spritebitmap.cliprect(), machine().gfx[expand],
6766            first * 2,
6867            0,
6968            0,0,
r21024r21025
7170
7271      /* Get fingerprint */
7372
74      for (x = fx; x < fx + machine.gfx[expand]->width(); x++)
73      for (x = fx; x < fx + machine().gfx[expand]->width(); x++)
7574      {
76         for (y = fy; y < fy + machine.gfx[expand]->height(); y++)
75         for (y = fy; y < fy + machine().gfx[expand]->height(); y++)
7776         {
7877            if (visarea.contains(x, y))
79               Checksum += state->m_spritebitmap.pix16(y, x);
78               Checksum += m_spritebitmap.pix16(y, x);
8079         }
8180      }
8281
8382      /* Blackout second sprite */
8483
85      drawgfx_transpen(state->m_spritebitmap,state->m_spritebitmap.cliprect(), machine.gfx[1],
84      drawgfx_transpen(m_spritebitmap,m_spritebitmap.cliprect(), machine().gfx[1],
8685            second * 2,
8786            1,
8887            0,0,
89            (state->m_s2636_0_ram[second * 0x10 + 10] * 4)-22,(state->m_s2636_0_ram[second * 0x10 + 12] * 3) + 3, 0);
88            (m_s2636_0_ram[second * 0x10 + 10] * 4)-22,(m_s2636_0_ram[second * 0x10 + 12] * 3) + 3, 0);
9089
9190      /* Remove fingerprint */
9291
93      for (x = fx; x < fx + machine.gfx[expand]->width(); x++)
92      for (x = fx; x < fx + machine().gfx[expand]->width(); x++)
9493      {
95         for (y = fy; y < fy + machine.gfx[expand]->height(); y++)
94         for (y = fy; y < fy + machine().gfx[expand]->height(); y++)
9695         {
9796            if (visarea.contains(x, y))
98               Checksum -= state->m_spritebitmap.pix16(y, x);
97               Checksum -= m_spritebitmap.pix16(y, x);
9998         }
10099      }
101100
102101      /* Zero bitmap */
103102
104      drawgfx_opaque(state->m_spritebitmap,state->m_spritebitmap.cliprect(), machine.gfx[expand],
103      drawgfx_opaque(m_spritebitmap,m_spritebitmap.cliprect(), machine().gfx[expand],
105104            first * 2,
106105            1,
107106            0,0,
r21024r21025
131130   machine().gfx[2]->set_source(m_s2636_0_ram);
132131}
133132
134static void draw_sprites(running_machine &machine, bitmap_ind16 &bitmap, const rectangle &cliprect)
133void zac2650_state::draw_sprites(bitmap_ind16 &bitmap, const rectangle &cliprect)
135134{
136   zac2650_state *state = machine.driver_data<zac2650_state>();
137135   int offs;
138   const rectangle &visarea = machine.primary_screen->visible_area();
136   const rectangle &visarea = machine().primary_screen->visible_area();
139137
140138   /* -------------------------------------------------------------- */
141139   /* There seems to be a strange setup with this board, in that it  */
r21024r21025
148146   /* does not seem to be a fault of the emulation!                  */
149147   /* -------------------------------------------------------------- */
150148
151   state->m_CollisionBackground = 0;   /* Read from 0x1e80 bit 7 */
149   m_CollisionBackground = 0;   /* Read from 0x1e80 bit 7 */
152150
153151   // for collision detection checking
154   copybitmap(state->m_bitmap,bitmap,0,0,0,0,visarea);
152   copybitmap(m_bitmap,bitmap,0,0,0,0,visarea);
155153
156154   for(offs=0;offs<0x50;offs+=0x10)
157155   {
158      if((state->m_s2636_0_ram[offs+10]<0xF0) && (offs!=0x30))
156      if((m_s2636_0_ram[offs+10]<0xF0) && (offs!=0x30))
159157      {
160158         int spriteno = (offs / 8);
161         int expand   = ((state->m_s2636_0_ram[0xc0] & (spriteno*2))!=0) ? 2 : 1;
162         int bx       = (state->m_s2636_0_ram[offs+10] * 4) - 22;
163         int by       = (state->m_s2636_0_ram[offs+12] * 3) + 3;
159         int expand   = ((m_s2636_0_ram[0xc0] & (spriteno*2))!=0) ? 2 : 1;
160         int bx       = (m_s2636_0_ram[offs+10] * 4) - 22;
161         int by       = (m_s2636_0_ram[offs+12] * 3) + 3;
164162         int x,y;
165163
166164         /* Sprite->Background collision detection */
167         drawgfx_transpen(bitmap,cliprect, machine.gfx[expand],
165         drawgfx_transpen(bitmap,cliprect, machine().gfx[expand],
168166               spriteno,
169167               1,
170168               0,0,
171169               bx,by, 0);
172170
173         for (x = bx; x < bx + machine.gfx[expand]->width(); x++)
171         for (x = bx; x < bx + machine().gfx[expand]->width(); x++)
174172         {
175            for (y = by; y < by + machine.gfx[expand]->height(); y++)
173            for (y = by; y < by + machine().gfx[expand]->height(); y++)
176174            {
177175               if (visarea.contains(x, y))
178                  if (bitmap.pix16(y, x) != state->m_bitmap.pix16(y, x))
176                  if (bitmap.pix16(y, x) != m_bitmap.pix16(y, x))
179177                  {
180                     state->m_CollisionBackground = 0x80;
178                     m_CollisionBackground = 0x80;
181179                     break;
182180                  }
183181            }
184182         }
185183
186         drawgfx_transpen(bitmap,cliprect, machine.gfx[expand],
184         drawgfx_transpen(bitmap,cliprect, machine().gfx[expand],
187185               spriteno,
188186               0,
189187               0,0,
r21024r21025
192190   }
193191
194192   /* Sprite->Sprite collision detection */
195   state->m_CollisionSprite = 0;
196//  if(SpriteCollision(machine, 0,1)) state->m_CollisionSprite |= 0x20;   /* Not Used */
197   if(SpriteCollision(machine, 0,2)) state->m_CollisionSprite |= 0x10;
198   if(SpriteCollision(machine, 0,4)) state->m_CollisionSprite |= 0x08;
199   if(SpriteCollision(machine, 1,2)) state->m_CollisionSprite |= 0x04;
200   if(SpriteCollision(machine, 1,4)) state->m_CollisionSprite |= 0x02;
201//  if(SpriteCollision(machine, 2,4)) state->m_CollisionSprite |= 0x01;   /* Not Used */
193   m_CollisionSprite = 0;
194//  if(SpriteCollision(0,1)) m_CollisionSprite |= 0x20;   /* Not Used */
195   if(SpriteCollision(0,2)) m_CollisionSprite |= 0x10;
196   if(SpriteCollision(0,4)) m_CollisionSprite |= 0x08;
197   if(SpriteCollision(1,2)) m_CollisionSprite |= 0x04;
198   if(SpriteCollision(1,4)) m_CollisionSprite |= 0x02;
199//  if(SpriteCollision(2,4)) m_CollisionSprite |= 0x01;   /* Not Used */
202200}
203201
204202UINT32 zac2650_state::screen_update_tinvader(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect)
205203{
206204   m_bg_tilemap->draw(bitmap, cliprect, 0, 0);
207   draw_sprites(machine(), bitmap, cliprect);
205   draw_sprites(bitmap, cliprect);
208206   return 0;
209207}
trunk/src/mame/video/zaxxon.c
r21024r21025
114114 *
115115 *************************************/
116116
117static void video_start_common(running_machine &machine, tilemap_get_info_delegate fg_tile_info)
117void zaxxon_state::video_start_common(tilemap_get_info_delegate fg_tile_info)
118118{
119   zaxxon_state *state = machine.driver_data<zaxxon_state>();
120
121119   /* reset globals */
122   state->m_bg_enable = 0;
123   state->m_bg_color = 0;
124   state->m_bg_position = 0;
125   state->m_fg_color = 0;
126   state->m_congo_fg_bank = 0;
127   state->m_congo_color_bank = 0;
128   memset(state->m_congo_custom, 0, sizeof(state->m_congo_custom));
120   m_bg_enable = 0;
121   m_bg_color = 0;
122   m_bg_position = 0;
123   m_fg_color = 0;
124   m_congo_fg_bank = 0;
125   m_congo_color_bank = 0;
126   memset(m_congo_custom, 0, sizeof(m_congo_custom));
129127
130128   /* create a background and foreground tilemap */
131   state->m_bg_tilemap = &machine.tilemap().create(tilemap_get_info_delegate(FUNC(zaxxon_state::get_bg_tile_info),state), TILEMAP_SCAN_ROWS,  8,8, 32,512);
132   state->m_fg_tilemap = &machine.tilemap().create(fg_tile_info, TILEMAP_SCAN_ROWS,  8,8, 32,32);
129   m_bg_tilemap = &machine().tilemap().create(tilemap_get_info_delegate(FUNC(zaxxon_state::get_bg_tile_info),this), TILEMAP_SCAN_ROWS,  8,8, 32,512);
130   m_fg_tilemap = &machine().tilemap().create(fg_tile_info, TILEMAP_SCAN_ROWS,  8,8, 32,32);
133131
134132   /* configure the foreground tilemap */
135   state->m_fg_tilemap->set_transparent_pen(0);
136   state->m_fg_tilemap->set_scrolldx(0, machine.primary_screen->width() - 256);
137   state->m_fg_tilemap->set_scrolldy(0, machine.primary_screen->height() - 256);
133   m_fg_tilemap->set_transparent_pen(0);
134   m_fg_tilemap->set_scrolldx(0, machine().primary_screen->width() - 256);
135   m_fg_tilemap->set_scrolldy(0, machine().primary_screen->height() - 256);
138136
139137   /* register for save states */
140   state->save_item(NAME(state->m_bg_enable));
141   state->save_item(NAME(state->m_bg_color));
142   state->save_item(NAME(state->m_bg_position));
143   state->save_item(NAME(state->m_fg_color));
138   save_item(NAME(m_bg_enable));
139   save_item(NAME(m_bg_color));
140   save_item(NAME(m_bg_position));
141   save_item(NAME(m_fg_color));
144142}
145143
146144
147145void zaxxon_state::video_start()
148146{
149   video_start_common(machine(), tilemap_get_info_delegate(FUNC(zaxxon_state::zaxxon_get_fg_tile_info),this));
147   video_start_common(tilemap_get_info_delegate(FUNC(zaxxon_state::zaxxon_get_fg_tile_info),this));
150148}
151149
152150
153151VIDEO_START_MEMBER(zaxxon_state,razmataz)
154152{
155   video_start_common(machine(), tilemap_get_info_delegate(FUNC(zaxxon_state::razmataz_get_fg_tile_info),this));
153   video_start_common(tilemap_get_info_delegate(FUNC(zaxxon_state::razmataz_get_fg_tile_info),this));
156154}
157155
158156
r21024r21025
166164   save_item(NAME(m_congo_color_bank));
167165   save_item(NAME(m_congo_custom));
168166
169   video_start_common(machine(), tilemap_get_info_delegate(FUNC(zaxxon_state::congo_get_fg_tile_info),this));
167   video_start_common(tilemap_get_info_delegate(FUNC(zaxxon_state::congo_get_fg_tile_info),this));
170168}
171169
172170
r21024r21025
297295 *
298296 *************************************/
299297
300static void draw_background(running_machine &machine, bitmap_ind16 &bitmap, const rectangle &cliprect, int skew)
298void zaxxon_state::draw_background(bitmap_ind16 &bitmap, const rectangle &cliprect, int skew)
301299{
302   zaxxon_state *state = machine.driver_data<zaxxon_state>();
303
304300   /* only draw if enabled */
305   if (state->m_bg_enable)
301   if (m_bg_enable)
306302   {
307      bitmap_ind16 &pixmap = state->m_bg_tilemap->pixmap();
308      int colorbase = state->m_bg_color + (state->m_congo_color_bank << 8);
303      bitmap_ind16 &pixmap = m_bg_tilemap->pixmap();
304      int colorbase = m_bg_color + (m_congo_color_bank << 8);
309305      int xmask = pixmap.width() - 1;
310306      int ymask = pixmap.height() - 1;
311      int flipmask = state->flip_screen() ? 0xff : 0x00;
312      int flipoffs = state->flip_screen() ? 0x38 : 0x40;
307      int flipmask = flip_screen() ? 0xff : 0x00;
308      int flipoffs = flip_screen() ? 0x38 : 0x40;
313309      int x, y;
314310
315311      /* the starting X value is offset by 1 pixel (normal) or 7 pixels */
316312      /* (flipped) due to a delay in the loading */
317      if (!state->flip_screen())
313      if (!flip_screen())
318314         flipoffs -= 1;
319315      else
320316         flipoffs += 7;
r21024r21025
331327
332328         /* base of the source row comes from VF plus the scroll value */
333329         /* this is done by the 3 4-bit adders at U56, U74, U75 */
334         srcy = vf + ((state->m_bg_position << 1) ^ 0xfff) + 1;
330         srcy = vf + ((m_bg_position << 1) ^ 0xfff) + 1;
335331         src = &pixmap.pix16(srcy & ymask);
336332
337333         /* loop over visible columns */
r21024r21025
359355
360356   /* if not enabled, fill the background with black */
361357   else
362      bitmap.fill(get_black_pen(machine), cliprect);
358      bitmap.fill(get_black_pen(machine()), cliprect);
363359}
364360
365361
r21024r21025
370366 *
371367 *************************************/
372368
373INLINE int find_minimum_y(UINT8 value, int flip)
369inline int zaxxon_state::find_minimum_y(UINT8 value, int flip)
374370{
375371   int flipmask = flip ? 0xff : 0x00;
376372   int flipconst = flip ? 0xef : 0xf1;
r21024r21025
401397}
402398
403399
404INLINE int find_minimum_x(UINT8 value, int flip)
400inline int zaxxon_state::find_minimum_x(UINT8 value, int flip)
405401{
406402   int flipmask = flip ? 0xff : 0x00;
407403   int x;
r21024r21025
415411}
416412
417413
418static void draw_sprites(running_machine &machine, bitmap_ind16 &bitmap, const rectangle &cliprect, UINT16 flipxmask, UINT16 flipymask)
414void zaxxon_state::draw_sprites(bitmap_ind16 &bitmap, const rectangle &cliprect, UINT16 flipxmask, UINT16 flipymask)
419415{
420   zaxxon_state *state = machine.driver_data<zaxxon_state>();
421   UINT8 *spriteram = state->m_spriteram;
422   gfx_element *gfx = machine.gfx[2];
423   int flip = state->flip_screen();
416   UINT8 *spriteram = m_spriteram;
417   gfx_element *gfx = machine().gfx[2];
418   int flip = flip_screen();
424419   int flipmask = flip ? 0xff : 0x00;
425420   int offs;
426421
r21024r21025
431426      int flipy = (spriteram[offs + (flipymask >> 8)] ^ flipmask) & flipymask;
432427      int flipx = (spriteram[offs + (flipxmask >> 8)] ^ flipmask) & flipxmask;
433428      int code = spriteram[offs + 1];
434      int color = (spriteram[offs + 2] & 0x1f) + (state->m_congo_color_bank << 5);
429      int color = (spriteram[offs + 2] & 0x1f) + (m_congo_color_bank << 5);
435430      int sx = find_minimum_x(spriteram[offs + 3], flip);
436431
437432      /* draw with 256 pixel offsets to ensure we wrap properly */
r21024r21025
452447
453448UINT32 zaxxon_state::screen_update_zaxxon(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect)
454449{
455   draw_background(machine(), bitmap, cliprect, TRUE);
456   draw_sprites(machine(), bitmap, cliprect, 0x140, 0x180);
450   draw_background(bitmap, cliprect, TRUE);
451   draw_sprites(bitmap, cliprect, 0x140, 0x180);
457452   m_fg_tilemap->draw(bitmap, cliprect, 0, 0);
458453   return 0;
459454}
r21024r21025
461456
462457UINT32 zaxxon_state::screen_update_futspy(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect)
463458{
464   draw_background(machine(), bitmap, cliprect, TRUE);
465   draw_sprites(machine(), bitmap, cliprect, 0x180, 0x180);
459   draw_background(bitmap, cliprect, TRUE);
460   draw_sprites(bitmap, cliprect, 0x180, 0x180);
466461   m_fg_tilemap->draw(bitmap, cliprect, 0, 0);
467462   return 0;
468463}
r21024r21025
470465
471466UINT32 zaxxon_state::screen_update_razmataz(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect)
472467{
473   draw_background(machine(), bitmap, cliprect, FALSE);
474   draw_sprites(machine(), bitmap, cliprect, 0x140, 0x180);
468   draw_background(bitmap, cliprect, FALSE);
469   draw_sprites(bitmap, cliprect, 0x140, 0x180);
475470   m_fg_tilemap->draw(bitmap, cliprect, 0, 0);
476471   return 0;
477472}
r21024r21025
479474
480475UINT32 zaxxon_state::screen_update_congo(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect)
481476{
482   draw_background(machine(), bitmap, cliprect, TRUE);
483   draw_sprites(machine(), bitmap, cliprect, 0x280, 0x180);
477   draw_background(bitmap, cliprect, TRUE);
478   draw_sprites(bitmap, cliprect, 0x280, 0x180);
484479   m_fg_tilemap->draw(bitmap, cliprect, 0, 0);
485480   return 0;
486481}
trunk/src/mame/video/xain.c
r21024r21025
157157
158158***************************************************************************/
159159
160static void draw_sprites(running_machine &machine, bitmap_ind16 &bitmap,const rectangle &cliprect)
160void xain_state::draw_sprites(bitmap_ind16 &bitmap,const rectangle &cliprect)
161161{
162   xain_state *state = machine.driver_data<xain_state>();
163   UINT8 *spriteram = state->m_spriteram;
162   UINT8 *spriteram = m_spriteram;
164163   int offs;
165164
166   for (offs = 0; offs < state->m_spriteram.bytes();offs += 4)
165   for (offs = 0; offs < m_spriteram.bytes();offs += 4)
167166   {
168167      int sx,sy,flipx,flipy;
169168      int attr = spriteram[offs+1];
r21024r21025
176175      if (sy <= -7) sy += 256;
177176      flipx = attr & 0x40;
178177      flipy = 0;
179      if (state->flip_screen())
178      if (flip_screen())
180179      {
181180         sx = 238 - sx;
182181         sy = 240 - sy;
r21024r21025
186185
187186      if (attr & 0x80)    /* double height */
188187      {
189         drawgfx_transpen(bitmap,cliprect,machine.gfx[3],
188         drawgfx_transpen(bitmap,cliprect,machine().gfx[3],
190189               numtile,
191190               color,
192191               flipx,flipy,
193192               sx,flipy ? sy+16:sy-16,0);
194         drawgfx_transpen(bitmap,cliprect,machine.gfx[3],
193         drawgfx_transpen(bitmap,cliprect,machine().gfx[3],
195194               numtile+1,
196195               color,
197196               flipx,flipy,
r21024r21025
199198      }
200199      else
201200      {
202         drawgfx_transpen(bitmap,cliprect,machine.gfx[3],
201         drawgfx_transpen(bitmap,cliprect,machine().gfx[3],
203202               numtile,
204203               color,
205204               flipx,flipy,
r21024r21025
215214   case 0:
216215      m_bgram0_tilemap->draw(bitmap, cliprect, TILEMAP_DRAW_OPAQUE,0);
217216      m_bgram1_tilemap->draw(bitmap, cliprect, 0,0);
218      draw_sprites(machine(), bitmap,cliprect);
217      draw_sprites(bitmap,cliprect);
219218      m_char_tilemap->draw(bitmap, cliprect, 0,0);
220219      break;
221220   case 1:
222221      m_bgram1_tilemap->draw(bitmap, cliprect, TILEMAP_DRAW_OPAQUE,0);
223222      m_bgram0_tilemap->draw(bitmap, cliprect, 0,0);
224      draw_sprites(machine(), bitmap,cliprect);
223      draw_sprites(bitmap,cliprect);
225224      m_char_tilemap->draw(bitmap, cliprect, 0,0);
226225      break;
227226   case 2:
228227      m_char_tilemap->draw(bitmap, cliprect, TILEMAP_DRAW_OPAQUE,0);
229228      m_bgram0_tilemap->draw(bitmap, cliprect, 0,0);
230      draw_sprites(machine(), bitmap,cliprect);
229      draw_sprites(bitmap,cliprect);
231230      m_bgram1_tilemap->draw(bitmap, cliprect, 0,0);
232231      break;
233232   case 3:
234233      m_char_tilemap->draw(bitmap, cliprect, TILEMAP_DRAW_OPAQUE,0);
235234      m_bgram1_tilemap->draw(bitmap, cliprect, 0,0);
236      draw_sprites(machine(), bitmap,cliprect);
235      draw_sprites(bitmap,cliprect);
237236      m_bgram0_tilemap->draw(bitmap, cliprect, 0,0);
238237      break;
239238   case 4:
240239      m_bgram0_tilemap->draw(bitmap, cliprect, TILEMAP_DRAW_OPAQUE,0);
241240      m_char_tilemap->draw(bitmap, cliprect, 0,0);
242      draw_sprites(machine(), bitmap,cliprect);
241      draw_sprites(bitmap,cliprect);
243242      m_bgram1_tilemap->draw(bitmap, cliprect, 0,0);
244243      break;
245244   case 5:
246245      m_bgram1_tilemap->draw(bitmap, cliprect, TILEMAP_DRAW_OPAQUE,0);
247246      m_char_tilemap->draw(bitmap, cliprect, 0,0);
248      draw_sprites(machine(), bitmap,cliprect);
247      draw_sprites(bitmap,cliprect);
249248      m_bgram0_tilemap->draw(bitmap, cliprect, 0,0);
250249      break;
251250   case 6:
252251      m_bgram0_tilemap->draw(bitmap, cliprect, TILEMAP_DRAW_OPAQUE,0);
253      draw_sprites(machine(), bitmap,cliprect);
252      draw_sprites(bitmap,cliprect);
254253      m_bgram1_tilemap->draw(bitmap, cliprect, 0,0);
255254      m_char_tilemap->draw(bitmap, cliprect, 0,0);
256255      break;
257256   case 7:
258257      m_bgram1_tilemap->draw(bitmap, cliprect, TILEMAP_DRAW_OPAQUE,0);
259      draw_sprites(machine(), bitmap,cliprect);
258      draw_sprites(bitmap,cliprect);
260259      m_bgram0_tilemap->draw(bitmap, cliprect, 0,0);
261260      m_char_tilemap->draw(bitmap, cliprect, 0,0);
262261      break;
trunk/src/mame/video/xxmissio.c
r21024r21025
7777}
7878
7979
80static void draw_sprites(bitmap_ind16 &bitmap, const rectangle &cliprect, gfx_element *gfx)
80void xxmissio_state::draw_sprites(bitmap_ind16 &bitmap, const rectangle &cliprect, gfx_element *gfx)
8181{
82   xxmissio_state *state = gfx->machine().driver_data<xxmissio_state>();
8382   int offs;
8483   int chr,col;
8584   int x,y,px,py,fx,fy;
8685
8786   for (offs=0; offs<0x800; offs +=0x20)
8887   {
89      chr = state->m_spriteram[offs];
90      col = state->m_spriteram[offs+3];
88      chr = m_spriteram[offs];
89      col = m_spriteram[offs+3];
9190
92      fx = ((col & 0x10) >> 4) ^ state->m_flipscreen;
93      fy = ((col & 0x20) >> 5) ^ state->m_flipscreen;
91      fx = ((col & 0x10) >> 4) ^ m_flipscreen;
92      fy = ((col & 0x20) >> 5) ^ m_flipscreen;
9493
95      x = state->m_spriteram[offs+1]*2;
96      y = state->m_spriteram[offs+2];
94      x = m_spriteram[offs+1]*2;
95      y = m_spriteram[offs+2];
9796
9897      chr = chr + ((col & 0x40) << 2);
9998      col = col & 0x07;
10099
101      if (state->m_flipscreen==0)
100      if (m_flipscreen==0)
102101      {
103102         px = x-8;
104103         py = y;
trunk/src/mame/video/wwfwfest.c
r21024r21025
138138 sprite drawing could probably be improved a bit
139139*******************************************************************************/
140140
141static void draw_sprites(running_machine &machine, bitmap_ind16 &bitmap, const rectangle &cliprect )
141void wwfwfest_state::draw_sprites(bitmap_ind16 &bitmap, const rectangle &cliprect )
142142{
143   wwfwfest_state *state = machine.driver_data<wwfwfest_state>();
144143   /*- SPR RAM Format -**
145144
146145     16 bytes per sprite
r21024r21025
161160
162161   **- End of Comments -*/
163162
164   UINT16 *buffered_spriteram16 = state->m_spriteram->buffer();
165   gfx_element *gfx = machine.gfx[1];
163   UINT16 *buffered_spriteram16 = m_spriteram->buffer();
164   gfx_element *gfx = machine().gfx[1];
166165   UINT16 *source = buffered_spriteram16;
167166   UINT16 *finish = source + 0x2000/2;
168167
r21024r21025
175174      if (enable) {
176175         xpos = +(source[5] & 0x00ff) | (source[1] & 0x0004) << 6;
177176         if (xpos>512-16) xpos -=512;
178         xpos += state->m_sprite_xoff;
177         xpos += m_sprite_xoff;
179178         ypos = (source[0] & 0x00ff) | (source[1] & 0x0002) << 7;
180179         ypos = (256 - ypos) & 0x1ff;
181180         ypos -= 16 ;
r21024r21025
186185         number = (source[2] & 0x00ff) | (source[3] & 0x00ff) << 8;
187186         colourbank = (source[4] & 0x000f);
188187
189         if (state->flip_screen()) {
188         if (flip_screen()) {
190189            if (flipy) flipy=0; else flipy=1;
191190            if (flipx) flipx=0; else flipx=1;
192            ypos=240-ypos-state->m_sprite_xoff;
191            ypos=240-ypos-m_sprite_xoff;
193192            xpos=304-xpos;
194193         }
195194
196195         for (count=0;count<chain;count++) {
197            if (state->flip_screen()) {
196            if (flip_screen()) {
198197               if (!flipy) {
199198                  drawgfx_transpen(bitmap,cliprect,gfx,number+count,colourbank,flipx,flipy,xpos,ypos+(16*(chain-1))-(16*count),0);
200199               } else {
r21024r21025
266265   if (m_pri == 0x007b) {
267266      m_bg0_tilemap->draw(bitmap, cliprect, TILEMAP_DRAW_OPAQUE,0);
268267      m_bg1_tilemap->draw(bitmap, cliprect, 0,0);
269      draw_sprites(machine(), bitmap,cliprect);
268      draw_sprites(bitmap,cliprect);
270269      m_fg0_tilemap->draw(bitmap, cliprect, 0,0);
271270   }
272271
273272   if (m_pri == 0x007c) {
274273      m_bg0_tilemap->draw(bitmap, cliprect, TILEMAP_DRAW_OPAQUE,0);
275      draw_sprites(machine(), bitmap,cliprect);
274      draw_sprites(bitmap,cliprect);
276275      m_bg1_tilemap->draw(bitmap, cliprect, 0,0);
277276      m_fg0_tilemap->draw(bitmap, cliprect, 0,0);
278277   }
r21024r21025
280279   if (m_pri == 0x0078) {
281280      m_bg1_tilemap->draw(bitmap, cliprect, TILEMAP_DRAW_OPAQUE,0);
282281      m_bg0_tilemap->draw(bitmap, cliprect, 0,0);
283      draw_sprites(machine(), bitmap,cliprect);
282      draw_sprites(bitmap,cliprect);
284283      m_fg0_tilemap->draw(bitmap, cliprect, 0,0);
285284   }
286285   return 0;
trunk/src/mame/video/williams.c
r21024r21025
9595#include "video/resnet.h"
9696#include "includes/williams.h"
9797
98
99
10098/*************************************
10199 *
102 *  Prototypes
103 *
104 *************************************/
105
106static void blitter_init(running_machine &machine, int blitter_config, const UINT8 *remap_prom);
107static void create_palette_lookup(running_machine &machine);
108
109static int blitter_core(address_space &space, int sstart, int dstart, int w, int h, int data);
110
111
112
113/*************************************
114 *
115100 *  Williams video startup
116101 *
117102 *************************************/
118103
119static void state_save_register(running_machine &machine)
104void williams_state::state_save_register()
120105{
121   williams_state *state = machine.driver_data<williams_state>();
122   state_save_register_global(machine, state->m_blitter_window_enable);
123   state_save_register_global(machine, state->m_cocktail);
124   state_save_register_global_array(machine, state->m_blitterram);
125   state_save_register_global(machine, state->m_blitter_remap_index);
126   state_save_register_global(machine, state->m_blaster_color0);
127   state_save_register_global(machine, state->m_blaster_video_control);
128   state_save_register_global(machine, state->m_tilemap_xscroll);
129   state_save_register_global(machine, state->m_williams2_fg_color);
106   state_save_register_global(machine(), m_blitter_window_enable);
107   state_save_register_global(machine(), m_cocktail);
108   state_save_register_global_array(machine(), m_blitterram);
109   state_save_register_global(machine(), m_blitter_remap_index);
110   state_save_register_global(machine(), m_blaster_color0);
111   state_save_register_global(machine(), m_blaster_video_control);
112   state_save_register_global(machine(), m_tilemap_xscroll);
113   state_save_register_global(machine(), m_williams2_fg_color);
130114}
131115
132116
133117VIDEO_START_MEMBER(williams_state,williams)
134118{
135   blitter_init(machine(), m_blitter_config, NULL);
136   create_palette_lookup(machine());
137   state_save_register(machine());
119   blitter_init(m_blitter_config, NULL);
120   create_palette_lookup();
121   state_save_register();
138122}
139123
140124
141125VIDEO_START_MEMBER(williams_state,blaster)
142126{
143   blitter_init(machine(), m_blitter_config, memregion("proms")->base());
144   create_palette_lookup(machine());
145   state_save_register(machine());
127   blitter_init(m_blitter_config, memregion("proms")->base());
128   create_palette_lookup();
129   state_save_register();
146130}
147131
148132
149133VIDEO_START_MEMBER(williams_state,williams2)
150134{
151   blitter_init(machine(), m_blitter_config, NULL);
135   blitter_init(m_blitter_config, NULL);
152136
153137   /* allocate paletteram */
154138   m_generic_paletteram_8.allocate(0x400 * 2);
r21024r21025
157141   m_bg_tilemap = &machine().tilemap().create(tilemap_get_info_delegate(FUNC(williams_state::get_tile_info),this), TILEMAP_SCAN_COLS,  24,16, 128,16);
158142   m_bg_tilemap->set_scrolldx(2, 0);
159143
160   state_save_register(machine());
144   state_save_register();
161145}
162146
163147
r21024r21025
277261 *
278262 *************************************/
279263
280static void create_palette_lookup(running_machine &machine)
264void williams_state::create_palette_lookup()
281265{
282   williams_state *state = machine.driver_data<williams_state>();
283266   static const int resistances_rg[3] = { 1200, 560, 330 };
284267   static const int resistances_b[2]  = { 560, 330 };
285268   double weights_r[3], weights_g[3], weights_b[2];
r21024r21025
294277         2, resistances_b,  weights_b, 0, 0);
295278
296279   /* build a palette lookup */
297   state->m_palette_lookup = auto_alloc_array(machine, rgb_t, 256);
280   m_palette_lookup = auto_alloc_array(machine(), rgb_t, 256);
298281   for (i = 0; i < 256; i++)
299282   {
300283      int r = combine_3_weights(weights_r, BIT(i,0), BIT(i,1), BIT(i,2));
301284      int g = combine_3_weights(weights_g, BIT(i,3), BIT(i,4), BIT(i,5));
302285      int b = combine_2_weights(weights_b, BIT(i,6), BIT(i,7));
303286
304      state->m_palette_lookup[i] = MAKE_RGB(r, g, b);
287      m_palette_lookup[i] = MAKE_RGB(r, g, b);
305288   }
306289}
307290
r21024r21025
476459 *
477460 *************************************/
478461
479static void blitter_init(running_machine &machine, int blitter_config, const UINT8 *remap_prom)
462void williams_state::blitter_init(int blitter_config, const UINT8 *remap_prom)
480463{
481   williams_state *state = machine.driver_data<williams_state>();
482464   static const UINT8 dummy_table[] = { 0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15 };
483465   int i,j;
484466
485467   /* by default, there is no clipping window - this will be touched only by games that have one */
486   state->m_blitter_window_enable = 0;
468   m_blitter_window_enable = 0;
487469
488470   /* switch off the video config */
489   state->m_blitter_xor = (blitter_config == WILLIAMS_BLITTER_SC01) ? 4 : 0;
471   m_blitter_xor = (blitter_config == WILLIAMS_BLITTER_SC01) ? 4 : 0;
490472
491473   /* create the remap table; if no PROM, make an identity remap table */
492   state->m_blitter_remap_lookup = auto_alloc_array(machine, UINT8, 256 * 256);
493   state->m_blitter_remap_index = 0;
494   state->m_blitter_remap = state->m_blitter_remap_lookup;
474   m_blitter_remap_lookup = auto_alloc_array(machine(), UINT8, 256 * 256);
475   m_blitter_remap_index = 0;
476   m_blitter_remap = m_blitter_remap_lookup;
495477   for (i = 0; i < 256; i++)
496478   {
497479      const UINT8 *table = remap_prom ? (remap_prom + (i & 0x7f) * 16) : dummy_table;
498480      for (j = 0; j < 256; j++)
499         state->m_blitter_remap_lookup[i * 256 + j] = (table[j >> 4] << 4) | table[j & 0x0f];
481         m_blitter_remap_lookup[i * 256 + j] = (table[j >> 4] << 4) | table[j & 0x0f];
500482   }
501483}
502484
r21024r21025
559541 *
560542 *************************************/
561543
562INLINE void blit_pixel(address_space &space, int offset, int srcdata, int data, int mask, int solid)
544inline void williams_state::blit_pixel(address_space &space, int offset, int srcdata, int data, int mask, int solid)
563545{
564   williams_state *state = space.machine().driver_data<williams_state>();
565546   /* always read from video RAM regardless of the bank setting */
566   int pix = (offset < 0xc000) ? state->m_videoram[offset] : space.read_byte(offset);
547   int pix = (offset < 0xc000) ? m_videoram[offset] : space.read_byte(offset);
567548
568549   /* handle transparency */
569550   if (data & 0x08)
r21024r21025
582563   /* if the window is enabled, only blit to videoram below the clipping address */
583564   /* note that we have to allow blits to non-video RAM (e.g. tileram) because those */
584565   /* are not blocked by the window enable */
585   if (!state->m_blitter_window_enable || offset < state->m_blitter_clip_address || offset >= 0xc000)
566   if (!m_blitter_window_enable || offset < m_blitter_clip_address || offset >= 0xc000)
586567      space.write_byte(offset, pix);
587568}
588569
589570
590static int blitter_core(address_space &space, int sstart, int dstart, int w, int h, int data)
571int williams_state::blitter_core(address_space &space, int sstart, int dstart, int w, int h, int data)
591572{
592   williams_state *state = space.machine().driver_data<williams_state>();
593573   int source, sxadv, syadv;
594574   int dest, dxadv, dyadv;
595575   int i, j, solid;
r21024r21025
610590      return accesses;
611591
612592   /* set the solid pixel value to the mask value */
613   solid = state->m_blitterram[1];
593   solid = m_blitterram[1];
614594
615595   /* first case: no shifting */
616596   if (!(data & 0x20))
r21024r21025
624604         /* loop over the width */
625605         for (j = w; j > 0; j--)
626606         {
627            blit_pixel(space, dest, state->m_blitter_remap[space.read_byte(source)], data, keepmask, solid);
607            blit_pixel(space, dest, m_blitter_remap[space.read_byte(source)], data, keepmask, solid);
628608            accesses += 2;
629609
630610            /* advance */
r21024r21025
658638         dest = dstart & 0xffff;
659639
660640         /* left edge case */
661         pixdata = state->m_blitter_remap[space.read_byte(source)];
641         pixdata = m_blitter_remap[space.read_byte(source)];
662642         blit_pixel(space, dest, (pixdata >> 4) & 0x0f, data, keepmask | 0xf0, solid);
663643         accesses += 2;
664644
r21024r21025
668648         /* loop over the width */
669649         for (j = w - 1; j > 0; j--)
670650         {
671            pixdata = (pixdata << 8) | state->m_blitter_remap[space.read_byte(source)];
651            pixdata = (pixdata << 8) | m_blitter_remap[space.read_byte(source)];
672652            blit_pixel(space, dest, (pixdata >> 4) & 0xff, data, keepmask, solid);
673653            accesses += 2;
674654
trunk/src/mame/video/wc90b.c
r21024r21025
9191
9292***************************************************************************/
9393
94static void draw_sprites(running_machine &machine, bitmap_ind16 &bitmap, const rectangle &cliprect, int priority )
94void wc90b_state::draw_sprites(bitmap_ind16 &bitmap, const rectangle &cliprect, int priority )
9595{
96   wc90b_state *state = machine.driver_data<wc90b_state>();
97   UINT8 *spriteram = state->m_spriteram;
96   UINT8 *spriteram = m_spriteram;
9897   int offs, sx, sy;
9998
10099   /* draw all visible sprites of specified priority */
101   for ( offs = state->m_spriteram.bytes() - 8 ; offs >= 0 ; offs -= 8 )
100   for ( offs = m_spriteram.bytes() - 8 ; offs >= 0 ; offs -= 8 )
102101   {
103102      if ( ( ~( spriteram[offs+3] >> 7 ) & 1 ) == priority )
104103      {
r21024r21025
115114
116115         sy = 240 - spriteram[offs + 1];
117116
118         drawgfx_transpen( bitmap, cliprect,machine.gfx[17], code,
117         drawgfx_transpen( bitmap, cliprect,machine().gfx[17], code,
119118               flags >> 4, /* color */
120119               bank & 1,   /* flipx */
121120               bank & 2,   /* flipy */
r21024r21025
134133
135134   m_bg_tilemap->draw(bitmap, cliprect, 0,0);
136135   m_fg_tilemap->draw(bitmap, cliprect, 0,0);
137   draw_sprites(machine(), bitmap,cliprect, 1 );
136   draw_sprites(bitmap,cliprect, 1 );
138137   m_tx_tilemap->draw(bitmap, cliprect, 0,0);
139   draw_sprites(machine(), bitmap,cliprect, 0 );
138   draw_sprites(bitmap,cliprect, 0 );
140139   return 0;
141140}
trunk/src/mame/video/wolfpack.c
r21024r21025
118118}
119119
120120
121static void draw_ship(running_machine &machine, bitmap_ind16 &bitmap, const rectangle &cliprect)
121void wolfpack_state::draw_ship(bitmap_ind16 &bitmap, const rectangle &cliprect)
122122{
123   wolfpack_state *state = machine.driver_data<wolfpack_state>();
124123   static const UINT32 scaler[] =
125124   {
126125      0x00000, 0x00500, 0x00a00, 0x01000,
r21024r21025
141140      0x2c000, 0x2fa00, 0x33500, 0x37000
142141   };
143142
144   int chop = (scaler[state->m_ship_size >> 2] * state->m_ship_h_precess) >> 16;
143   int chop = (scaler[m_ship_size >> 2] * m_ship_h_precess) >> 16;
145144
146145   drawgfxzoom_transpen(bitmap, cliprect,
147      machine.gfx[1],
148      state->m_ship_pic,
146      machine().gfx[1],
147      m_ship_pic,
149148      0,
150      state->m_ship_reflect, 0,
151      2 * (state->m_ship_h - chop),
149      m_ship_reflect, 0,
150      2 * (m_ship_h - chop),
152151      128,
153      2 * scaler[state->m_ship_size >> 2], scaler[state->m_ship_size >> 2], 0);
152      2 * scaler[m_ship_size >> 2], scaler[m_ship_size >> 2], 0);
154153}
155154
156155
157static void draw_torpedo(running_machine &machine, bitmap_ind16 &bitmap, const rectangle &cliprect)
156void wolfpack_state::draw_torpedo(bitmap_ind16 &bitmap, const rectangle &cliprect)
158157{
159   wolfpack_state *state = machine.driver_data<wolfpack_state>();
160158   int count = 0;
161159
162160   int x;
163161   int y;
164162
165163   drawgfx_transpen(bitmap, cliprect,
166      machine.gfx[3],
167      state->m_torpedo_pic,
164      machine().gfx[3],
165      m_torpedo_pic,
168166      0,
169167      0, 0,
170      2 * (244 - state->m_torpedo_h),
171      224 - state->m_torpedo_v, 0);
168      2 * (244 - m_torpedo_h),
169      224 - m_torpedo_v, 0);
172170
173   for (y = 16; y < 224 - state->m_torpedo_v; y++)
171   for (y = 16; y < 224 - m_torpedo_v; y++)
174172   {
175173      int x1;
176174      int x2;
r21024r21025
178176      if (y % 16 == 1)
179177         count = (count - 1) & 7;
180178
181      x1 = 248 - state->m_torpedo_h - count;
182      x2 = 248 - state->m_torpedo_h + count;
179      x1 = 248 - m_torpedo_h - count;
180      x2 = 248 - m_torpedo_h + count;
183181
184182      for (x = 2 * x1; x < 2 * x2; x++)
185         if (state->m_LFSR[(state->m_current_index + 0x300 * y + x) % 0x8000])
183         if (m_LFSR[(m_current_index + 0x300 * y + x) % 0x8000])
186184            bitmap.pix16(y, x) = 1;
187185   }
188186}
189187
190188
191static void draw_pt(running_machine &machine, bitmap_ind16 &bitmap, const rectangle &cliprect)
189void wolfpack_state::draw_pt(bitmap_ind16 &bitmap, const rectangle &cliprect)
192190{
193   wolfpack_state *state = machine.driver_data<wolfpack_state>();
194191   rectangle rect = cliprect;
195192
196   if (!(state->m_pt_pic & 0x20))
193   if (!(m_pt_pic & 0x20))
197194      rect.min_x = 256;
198195
199   if (!(state->m_pt_pic & 0x10))
196   if (!(m_pt_pic & 0x10))
200197      rect.max_x = 255;
201198
202199   drawgfx_transpen(bitmap, rect,
203      machine.gfx[2],
204      state->m_pt_pic,
200      machine().gfx[2],
201      m_pt_pic,
205202      0,
206203      0, 0,
207      2 * state->m_pt_horz,
208      state->m_pt_pos_select ? 0x70 : 0xA0, 0);
204      2 * m_pt_horz,
205      m_pt_pos_select ? 0x70 : 0xA0, 0);
209206
210207   drawgfx_transpen(bitmap, rect,
211      machine.gfx[2],
212      state->m_pt_pic,
208      machine().gfx[2],
209      m_pt_pic,
213210      0,
214211      0, 0,
215      2 * state->m_pt_horz - 512,
216      state->m_pt_pos_select ? 0x70 : 0xA0, 0);
212      2 * m_pt_horz - 512,
213      m_pt_pos_select ? 0x70 : 0xA0, 0);
217214}
218215
219216
220static void draw_water(colortable_t *colortable, bitmap_ind16 &bitmap, const rectangle &cliprect)
217void wolfpack_state::draw_water(colortable_t *colortable, bitmap_ind16 &bitmap, const rectangle &cliprect)
221218{
222219   rectangle rect = cliprect;
223220
r21024r21025
269266            192 + 8 * i);
270267      }
271268
272   draw_pt(machine(), bitmap, cliprect);
273   draw_ship(machine(), bitmap, cliprect);
274   draw_torpedo(machine(), bitmap, cliprect);
269   draw_pt(bitmap, cliprect);
270   draw_ship(bitmap, cliprect);
271   draw_torpedo(bitmap, cliprect);
275272   draw_water(machine().colortable, bitmap, cliprect);
276273   return 0;
277274}
r21024r21025
287284
288285      m_helper.fill(0);
289286
290      draw_ship(machine(), m_helper, m_helper.cliprect());
287      draw_ship(m_helper, m_helper.cliprect());
291288
292289      for (y = 128; y < 224 - m_torpedo_v; y++)
293290      {
trunk/src/mame/video/xorworld.c
r21024r21025
9494      1  | xxxx---- -------- | sprite color
9595*/
9696
97static void draw_sprites(running_machine &machine, bitmap_ind16 &bitmap, const rectangle &cliprect )
97void xorworld_state::draw_sprites(bitmap_ind16 &bitmap, const rectangle &cliprect )
9898{
99   xorworld_state *state = machine.driver_data<xorworld_state>();
100   UINT16 *spriteram16 = state->m_spriteram;
99   UINT16 *spriteram16 = m_spriteram;
101100   int i;
102101
103102   for (i = 0; i < 0x40; i += 2)
r21024r21025
107106      int code = (spriteram16[i+1] & 0x0ffc) >> 2;
108107      int color = (spriteram16[i+1] & 0xf000) >> 12;
109108
110      drawgfx_transpen(bitmap, cliprect, machine.gfx[1], code, color, 0, 0, sx, sy, 0);
109      drawgfx_transpen(bitmap, cliprect, machine().gfx[1], code, color, 0, 0, sx, sy, 0);
111110   }
112111}
113112
114113UINT32 xorworld_state::screen_update_xorworld(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect)
115114{
116115   m_bg_tilemap->draw(bitmap, cliprect, 0, 0);
117   draw_sprites(machine(), bitmap, cliprect);
116   draw_sprites(bitmap, cliprect);
118117   return 0;
119118}
trunk/src/mame/video/wwfsstar.c
r21024r21025
105105 sprite colour marking could probably be improved..
106106*******************************************************************************/
107107
108static void draw_sprites(running_machine &machine, bitmap_ind16 &bitmap, const rectangle &cliprect )
108void wwfsstar_state::draw_sprites(bitmap_ind16 &bitmap, const rectangle &cliprect )
109109{
110110   /*- SPR RAM Format -**
111111
r21024r21025
128128
129129   **- End of Comments -*/
130130
131   wwfsstar_state *state = machine.driver_data<wwfsstar_state>();
132   gfx_element *gfx = machine.gfx[1];
133   UINT16 *source = state->m_spriteram;
131   gfx_element *gfx = machine().gfx[1];
132   UINT16 *source = m_spriteram;
134133   UINT16 *finish = source + 0x3ff/2;
135134
136135   while (source < finish)
r21024r21025
154153
155154         number &= ~(chain - 1);
156155
157         if (state->flip_screen())
156         if (flip_screen())
158157         {
159158            flipy = !flipy;
160159            flipx = !flipx;
r21024r21025
164163
165164         for (count=0;count<chain;count++)
166165         {
167            if (state->flip_screen())
166            if (flip_screen())
168167            {
169168               if (!flipy)
170169               {
r21024r21025
218217   m_bg0_tilemap->set_scrollx(0, m_scrollx  );
219218
220219   m_bg0_tilemap->draw(bitmap, cliprect, 0,0);
221   draw_sprites(machine(), bitmap,cliprect );
220   draw_sprites(bitmap,cliprect );
222221   m_fg0_tilemap->draw(bitmap, cliprect, 0,0);
223222
224223   return 0;
trunk/src/mame/video/yunsun16.c
r21024r21025
128128
129129***************************************************************************/
130130
131static void draw_sprites( running_machine &machine, bitmap_ind16 &bitmap, const rectangle &cliprect )
131void yunsun16_state::draw_sprites( bitmap_ind16 &bitmap, const rectangle &cliprect )
132132{
133   yunsun16_state *state = machine.driver_data<yunsun16_state>();
134133   int offs;
135   const rectangle &visarea = machine.primary_screen->visible_area();
134   const rectangle &visarea = machine().primary_screen->visible_area();
136135
137136   int max_x = visarea.max_x + 1;
138137   int max_y = visarea.max_y + 1;
139138
140   int pri = *state->m_priorityram & 3;
139   int pri = *m_priorityram & 3;
141140   int pri_mask;
142141
143142   switch (pri)
r21024r21025
154153         break;
155154   }
156155
157   for (offs = (state->m_spriteram.bytes() - 8) / 2 ; offs >= 0; offs -= 8 / 2)
156   for (offs = (m_spriteram.bytes() - 8) / 2 ; offs >= 0; offs -= 8 / 2)
158157   {
159      int x = state->m_spriteram[offs + 0];
160      int y = state->m_spriteram[offs + 1];
161      int code = state->m_spriteram[offs + 2];
162      int attr = state->m_spriteram[offs + 3];
158      int x = m_spriteram[offs + 0];
159      int y = m_spriteram[offs + 1];
160      int code = m_spriteram[offs + 2];
161      int attr = m_spriteram[offs + 3];
163162      int flipx = attr & 0x20;
164163      int flipy = attr & 0x40;
165164
166      x += state->m_sprites_scrolldx;
167      y += state->m_sprites_scrolldy;
165      x += m_sprites_scrolldx;
166      y += m_sprites_scrolldy;
168167
169      if (state->flip_screen())   // not used?
168      if (flip_screen())   // not used?
170169      {
171170         flipx = !flipx;     x = max_x - x - 16;
172171         flipy = !flipy;     y = max_y - y - 16;
173172      }
174173
175      pdrawgfx_transpen(bitmap,cliprect,machine.gfx[1],
174      pdrawgfx_transpen(bitmap,cliprect,machine().gfx[1],
176175               code,
177176               attr & 0x1f,
178177               flipx, flipy,
179178               x,y,
180               machine.priority_bitmap,
179               machine().priority_bitmap,
181180               pri_mask,15);
182181   }
183182}
r21024r21025
219218      m_tilemap_0->draw(bitmap, cliprect, 0, 2);
220219   }
221220
222   draw_sprites(machine(), bitmap, cliprect);
221   draw_sprites(bitmap, cliprect);
223222   return 0;
224223}
trunk/src/mame/video/wiz.c
r21024r21025
9292   m_flipy = data;
9393}
9494
95static void draw_background(running_machine &machine, bitmap_ind16 &bitmap, const rectangle &cliprect, int bank, int colortype)
95void wiz_state::draw_background(bitmap_ind16 &bitmap, const rectangle &cliprect, int bank, int colortype)
9696{
97   wiz_state *state = machine.driver_data<wiz_state>();
98   UINT8 *videoram = state->m_videoram;
97   UINT8 *videoram = m_videoram;
9998   int offs;
10099
101100   /* for every character in the Video RAM, check if it has been modified */
r21024r21025
110109
111110      if (colortype)
112111      {
113         col = (state->m_attributesram[2 * sx + 1] & 0x07);
112         col = (m_attributesram[2 * sx + 1] & 0x07);
114113      }
115114      else
116115      {
117         col = (state->m_attributesram[2 * (offs % 32) + 1] & 0x04) + (videoram[offs] & 3);
116         col = (m_attributesram[2 * (offs % 32) + 1] & 0x04) + (videoram[offs] & 3);
118117      }
119118
120      scroll = (8*sy + 256 - state->m_attributesram[2 * sx]) % 256;
121      if (state->m_flipy)
119      scroll = (8*sy + 256 - m_attributesram[2 * sx]) % 256;
120      if (m_flipy)
122121      {
123122         scroll = (248 - scroll) % 256;
124123      }
125      if (state->m_flipx) sx = 31 - sx;
124      if (m_flipx) sx = 31 - sx;
126125
127126
128      drawgfx_transpen(bitmap,cliprect,machine.gfx[bank],
127      drawgfx_transpen(bitmap,cliprect,machine().gfx[bank],
129128         videoram[offs],
130         col + 8 * state->m_palette_bank,
131         state->m_flipx,state->m_flipy,
129         col + 8 * m_palette_bank,
130         m_flipx,m_flipy,
132131         8*sx,scroll,0);
133132   }
134133}
135134
136static void draw_foreground(running_machine &machine, bitmap_ind16 &bitmap, const rectangle &cliprect, int colortype)
135void wiz_state::draw_foreground(bitmap_ind16 &bitmap, const rectangle &cliprect, int colortype)
137136{
138   wiz_state *state = machine.driver_data<wiz_state>();
139137   int offs;
140138
141139   /* draw the frontmost playfield. They are characters, but draw them as sprites. */
r21024r21025
149147
150148      if (colortype)
151149      {
152         col = (state->m_attributesram2[2 * sx + 1] & 0x07);
150         col = (m_attributesram2[2 * sx + 1] & 0x07);
153151      }
154152      else
155153      {
156         col = (state->m_colorram2[offs] & 0x07);
154         col = (m_colorram2[offs] & 0x07);
157155      }
158156
159      scroll = (8*sy + 256 - state->m_attributesram2[2 * sx]) % 256;
160      if (state->m_flipy)
157      scroll = (8*sy + 256 - m_attributesram2[2 * sx]) % 256;
158      if (m_flipy)
161159      {
162160         scroll = (248 - scroll) % 256;
163161      }
164      if (state->m_flipx) sx = 31 - sx;
162      if (m_flipx) sx = 31 - sx;
165163
166164
167      drawgfx_transpen(bitmap,cliprect,machine.gfx[state->m_char_bank[1]],
168         state->m_videoram2[offs],
169         col + 8 * state->m_palette_bank,
170         state->m_flipx,state->m_flipy,
165      drawgfx_transpen(bitmap,cliprect,machine().gfx[m_char_bank[1]],
166         m_videoram2[offs],
167         col + 8 * m_palette_bank,
168         m_flipx,m_flipy,
171169         8*sx,scroll,0);
172170   }
173171}
174172
175static void draw_sprites(running_machine &machine, bitmap_ind16 &bitmap,
176                     const rectangle &cliprect, UINT8* sprite_ram,
177                     int bank)
173void wiz_state::draw_sprites(bitmap_ind16 &bitmap,const rectangle &cliprect, UINT8* sprite_ram,int bank)
178174{
179   wiz_state *state = machine.driver_data<wiz_state>();
180175   int offs;
181176
182   for (offs = state->m_spriteram.bytes() - 4;offs >= 0;offs -= 4)
177   for (offs = m_spriteram.bytes() - 4;offs >= 0;offs -= 4)
183178   {
184179      int sx,sy;
185180
r21024r21025
189184
190185      if (!sx || !sy) continue;
191186
192      if ( state->m_flipx) sx = 240 - sx;
193      if (!state->m_flipy) sy = 240 - sy;
187      if ( m_flipx) sx = 240 - sx;
188      if (!m_flipy) sy = 240 - sy;
194189
195      drawgfx_transpen(bitmap,cliprect,machine.gfx[bank],
190      drawgfx_transpen(bitmap,cliprect,machine().gfx[bank],
196191            sprite_ram[offs + 1],
197            (sprite_ram[offs + 2] & 0x07) + 8 * state->m_palette_bank,
198            state->m_flipx,state->m_flipy,
192            (sprite_ram[offs + 2] & 0x07) + 8 * m_palette_bank,
193            m_flipx,m_flipy,
199194            sx,sy,0);
200195   }
201196}
r21024r21025
204199UINT32 wiz_state::screen_update_kungfut(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect)
205200{
206201   bitmap.fill(m_bgpen, cliprect);
207   draw_background(machine(), bitmap, cliprect, 2 + m_char_bank[0] , 0);
208   draw_foreground(machine(), bitmap, cliprect, 0);
209   draw_sprites(machine(), bitmap, cliprect, m_spriteram2, 4);
210   draw_sprites(machine(), bitmap, cliprect, m_spriteram  , 5);
202   draw_background(bitmap, cliprect, 2 + m_char_bank[0] , 0);
203   draw_foreground(bitmap, cliprect, 0);
204   draw_sprites(bitmap, cliprect, m_spriteram2, 4);
205   draw_sprites(bitmap, cliprect, m_spriteram  , 5);
211206   return 0;
212207}
213208
r21024r21025
216211   int bank;
217212
218213   bitmap.fill(m_bgpen, cliprect);
219   draw_background(machine(), bitmap, cliprect, 2 + ((m_char_bank[0] << 1) | m_char_bank[1]), 0);
220   draw_foreground(machine(), bitmap, cliprect, 0);
214   draw_background(bitmap, cliprect, 2 + ((m_char_bank[0] << 1) | m_char_bank[1]), 0);
215   draw_foreground(bitmap, cliprect, 0);
221216
222217   const rectangle spritevisiblearea(2*8, 32*8-1, 2*8, 30*8-1);
223218   const rectangle spritevisibleareaflipx(0*8, 30*8-1, 2*8, 30*8-1);
r21024r21025
225220
226221   bank = 7 + *m_sprite_bank;
227222
228   draw_sprites(machine(), bitmap, visible_area, m_spriteram2, 6);
229   draw_sprites(machine(), bitmap, visible_area, m_spriteram  , bank);
223   draw_sprites(bitmap, visible_area, m_spriteram2, 6);
224   draw_sprites(bitmap, visible_area, m_spriteram  , bank);
230225   return 0;
231226}
232227
r21024r21025
234229UINT32 wiz_state::screen_update_stinger(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect)
235230{
236231   bitmap.fill(m_bgpen, cliprect);
237   draw_background(machine(), bitmap, cliprect, 2 + m_char_bank[0], 1);
238   draw_foreground(machine(), bitmap, cliprect, 1);
239   draw_sprites(machine(), bitmap, cliprect, m_spriteram2, 4);
240   draw_sprites(machine(), bitmap, cliprect, m_spriteram  , 5);
232   draw_background(bitmap, cliprect, 2 + m_char_bank[0], 1);
233   draw_foreground(bitmap, cliprect, 1);
234   draw_sprites(bitmap, cliprect, m_spriteram2, 4);
235   draw_sprites(bitmap, cliprect, m_spriteram  , 5);
241236   return 0;
242237}
trunk/src/mame/video/welltris.c
r21024r21025
7777   m_char_tilemap->set_transparent_pen(15);
7878}
7979
80static void draw_background(running_machine &machine, bitmap_ind16 &bitmap, const rectangle &cliprect)
80void welltris_state::draw_background(bitmap_ind16 &bitmap, const rectangle &cliprect)
8181{
82   welltris_state *state = machine.driver_data<welltris_state>();
8382   int x, y;
8483   int pixdata;
8584
8685   for (y = 0; y < 256; y++) {
8786      for (x = 0; x < 512 / 2; x++) {
88         pixdata = state->m_pixelram[(x & 0xff) + (y & 0xff) * 256];
87         pixdata = m_pixelram[(x & 0xff) + (y & 0xff) * 256];
8988
90         bitmap.pix16(y, (x * 2) + 0) = (pixdata >> 8) + (0x100 * state->m_pixelpalettebank) + 0x400;
91         bitmap.pix16(y, (x * 2) + 1) = (pixdata & 0xff) + (0x100 * state->m_pixelpalettebank) + 0x400;
89         bitmap.pix16(y, (x * 2) + 0) = (pixdata >> 8) + (0x100 * m_pixelpalettebank) + 0x400;
90         bitmap.pix16(y, (x * 2) + 1) = (pixdata & 0xff) + (0x100 * m_pixelpalettebank) + 0x400;
9291      }
9392   }
9493}
r21024r21025
9897   m_char_tilemap->set_scrollx(0, m_scrollx);
9998   m_char_tilemap->set_scrolly(0, m_scrolly);
10099
101   draw_background(machine(), bitmap, cliprect);
100   draw_background(bitmap, cliprect);
102101   m_char_tilemap->draw(bitmap, cliprect, 0, 0);
103102   m_spr_old->turbofrc_draw_sprites(m_spriteram, m_spriteram.bytes(), m_spritepalettebank, machine(), bitmap, cliprect, 0);
104103   return 0;
trunk/src/mame/video/wc90.c
r21024r21025
126126***************************************************************************/
127127
128128#define WC90_DRAW_SPRITE( code, sx, sy ) \
129               drawgfx_transpen( bitmap, cliprect, machine.gfx[3], code, flags >> 4, \
129               drawgfx_transpen( bitmap, cliprect, machine().gfx[3], code, flags >> 4, \
130130               bank&1, bank&2, sx, sy, 0 )
131131
132132static const char p32x32[4][4] = {
r21024r21025
157157   { 15, 14, 13, 12, 11, 10, 9, 8, 7, 6, 5, 4, 3, 2, 1, 0 }
158158};
159159
160static void draw_sprite_16x16(running_machine &machine, bitmap_ind16 &bitmap, const rectangle &cliprect, int code,
161                        int sx, int sy, int bank, int flags ) {
160void wc90_state::draw_sprite_16x16(bitmap_ind16 &bitmap, const rectangle &cliprect, int code,int sx, int sy, int bank, int flags )
161{
162162   WC90_DRAW_SPRITE( code, sx, sy );
163163}
164164
165static void draw_sprite_16x32(running_machine &machine, bitmap_ind16 &bitmap, const rectangle &cliprect, int code,
166                        int sx, int sy, int bank, int flags ) {
165void wc90_state::draw_sprite_16x32(bitmap_ind16 &bitmap, const rectangle &cliprect, int code,int sx, int sy, int bank, int flags )
166{
167167   if ( bank & 2 ) {
168168      WC90_DRAW_SPRITE( code+1, sx, sy+16 );
169169      WC90_DRAW_SPRITE( code, sx, sy );
r21024r21025
173173   }
174174}
175175
176static void draw_sprite_16x64(running_machine &machine, bitmap_ind16 &bitmap, const rectangle &cliprect, int code,
177                        int sx, int sy, int bank, int flags ) {
176void wc90_state::draw_sprite_16x64(bitmap_ind16 &bitmap, const rectangle &cliprect, int code,int sx, int sy, int bank, int flags )
177{
178178   if ( bank & 2 ) {
179179      WC90_DRAW_SPRITE( code+3, sx, sy+48 );
180180      WC90_DRAW_SPRITE( code+2, sx, sy+32 );
r21024r21025
188188   }
189189}
190190
191static void draw_sprite_32x16(running_machine &machine, bitmap_ind16 &bitmap, const rectangle &cliprect, int code,
192                        int sx, int sy, int bank, int flags ) {
191void wc90_state::draw_sprite_32x16(bitmap_ind16 &bitmap, const rectangle &cliprect, int code,int sx, int sy, int bank, int flags )
192{
193193   if ( bank & 1 ) {
194194      WC90_DRAW_SPRITE( code+1, sx+16, sy );
195195      WC90_DRAW_SPRITE( code, sx, sy );
r21024r21025
199199   }
200200}
201201
202static void draw_sprite_32x32(running_machine &machine, bitmap_ind16 &bitmap, const rectangle &cliprect, int code,
203                        int sx, int sy, int bank, int flags ) {
202void wc90_state::draw_sprite_32x32(bitmap_ind16 &bitmap, const rectangle &cliprect, int code,int sx, int sy, int bank, int flags )
203{
204204   const char *p = p32x32[ bank&3 ];
205205
206206   WC90_DRAW_SPRITE( code+p[0], sx, sy );
r21024r21025
209209   WC90_DRAW_SPRITE( code+p[3], sx+16, sy+16 );
210210}
211211
212static void draw_sprite_32x64(running_machine &machine, bitmap_ind16 &bitmap, const rectangle &cliprect, int code,
213                        int sx, int sy, int bank, int flags ) {
212void wc90_state::draw_sprite_32x64(bitmap_ind16 &bitmap, const rectangle &cliprect, int code, int sx, int sy, int bank, int flags )
213{
214214   const char *p = p32x64[ bank&3 ];
215215
216216   WC90_DRAW_SPRITE( code+p[0], sx, sy );
r21024r21025
223223   WC90_DRAW_SPRITE( code+p[7], sx+16, sy+48 );
224224}
225225
226static void draw_sprite_64x16(running_machine &machine, bitmap_ind16 &bitmap, const rectangle &cliprect, int code,
227                        int sx, int sy, int bank, int flags ) {
226void wc90_state::draw_sprite_64x16(bitmap_ind16 &bitmap, const rectangle &cliprect, int code,int sx, int sy, int bank, int flags )
227{
228228   if ( bank & 1 ) {
229229      WC90_DRAW_SPRITE( code+3, sx+48, sy );
230230      WC90_DRAW_SPRITE( code+2, sx+32, sy );
r21024r21025
238238   }
239239}
240240
241static void draw_sprite_64x32(running_machine &machine, bitmap_ind16 &bitmap, const rectangle &cliprect, int code,
242                        int sx, int sy, int bank, int flags ) {
241void wc90_state::draw_sprite_64x32(bitmap_ind16 &bitmap, const rectangle &cliprect, int code,int sx, int sy, int bank, int flags )
242{
243243   const char *p = p64x32[ bank&3 ];
244244
245245   WC90_DRAW_SPRITE( code+p[0], sx, sy );
r21024r21025
252252   WC90_DRAW_SPRITE( code+p[7], sx+48, sy+16 );
253253}
254254
255static void draw_sprite_64x64(running_machine &machine, bitmap_ind16 &bitmap, const rectangle &cliprect, int code,
256                        int sx, int sy, int bank, int flags ) {
255void wc90_state::draw_sprite_64x64(bitmap_ind16 &bitmap, const rectangle &cliprect, int code,int sx, int sy, int bank, int flags )
256{
257257   const char *p = p64x64[ bank&3 ];
258258
259259   WC90_DRAW_SPRITE( code+p[0], sx, sy );
r21024r21025
275275   WC90_DRAW_SPRITE( code+p[15], sx+48, sy+48 );
276276}
277277
278static void draw_sprite_invalid(running_machine &machine, bitmap_ind16 &bitmap, const rectangle &cliprect, int code,
279                                 int sx, int sy, int bank, int flags ) {
278void wc90_state::draw_sprite_invalid(bitmap_ind16 &bitmap, const rectangle &cliprect, int code, int sx, int sy, int bank, int flags )
279{
280280   logerror("8 pixel sprite size not supported\n" );
281281}
282282
283typedef void (*draw_sprites_func)(running_machine &, bitmap_ind16 &, const rectangle &, int, int, int, int, int );
284
285static const draw_sprites_func draw_sprites_proc[16] = {
286   draw_sprite_invalid,    /* 0000 = 08x08 */
287   draw_sprite_invalid,    /* 0001 = 16x08 */
288   draw_sprite_invalid,    /* 0010 = 32x08 */
289   draw_sprite_invalid,    /* 0011 = 64x08 */
290   draw_sprite_invalid,    /* 0100 = 08x16 */
291   draw_sprite_16x16,      /* 0101 = 16x16 */
292   draw_sprite_32x16,      /* 0110 = 32x16 */
293   draw_sprite_64x16,      /* 0111 = 64x16 */
294   draw_sprite_invalid,    /* 1000 = 08x32 */
295   draw_sprite_16x32,      /* 1001 = 16x32 */
296   draw_sprite_32x32,      /* 1010 = 32x32 */
297   draw_sprite_64x32,      /* 1011 = 64x32 */
298   draw_sprite_invalid,    /* 1100 = 08x64 */
299   draw_sprite_16x64,      /* 1101 = 16x64 */
300   draw_sprite_32x64,      /* 1110 = 32x64 */
301   draw_sprite_64x64       /* 1111 = 64x64 */
283static const wc90_state::draw_sprites_func draw_sprites_proc[16] = {
284   &wc90_state::draw_sprite_invalid,    /* 0000 = 08x08 */
285   &wc90_state::draw_sprite_invalid,    /* 0001 = 16x08 */
286   &wc90_state::draw_sprite_invalid,    /* 0010 = 32x08 */
287   &wc90_state::draw_sprite_invalid,    /* 0011 = 64x08 */
288   &wc90_state::draw_sprite_invalid,    /* 0100 = 08x16 */
289   &wc90_state::draw_sprite_16x16,      /* 0101 = 16x16 */
290   &wc90_state::draw_sprite_32x16,      /* 0110 = 32x16 */
291   &wc90_state::draw_sprite_64x16,      /* 0111 = 64x16 */
292   &wc90_state::draw_sprite_invalid,    /* 1000 = 08x32 */
293   &wc90_state::draw_sprite_16x32,      /* 1001 = 16x32 */
294   &wc90_state::draw_sprite_32x32,      /* 1010 = 32x32 */
295   &wc90_state::draw_sprite_64x32,      /* 1011 = 64x32 */
296   &wc90_state::draw_sprite_invalid,    /* 1100 = 08x64 */
297   &wc90_state::draw_sprite_16x64,      /* 1101 = 16x64 */
298   &wc90_state::draw_sprite_32x64,      /* 1110 = 32x64 */
299   &wc90_state::draw_sprite_64x64       /* 1111 = 64x64 */
302300};
303301
304static void draw_sprites(running_machine &machine, bitmap_ind16 &bitmap, const rectangle &cliprect, int priority )
302void wc90_state::draw_sprites(bitmap_ind16 &bitmap, const rectangle &cliprect, int priority )
305303{
306   wc90_state *state = machine.driver_data<wc90_state>();
307   UINT8 *spriteram = state->m_spriteram;
304   UINT8 *spriteram = m_spriteram;
308305   int offs, sx,sy, flags, which;
309306
310307   /* draw all visible sprites of specified priority */
311   for (offs = 0;offs < state->m_spriteram.bytes();offs += 16){
308   for (offs = 0;offs < m_spriteram.bytes();offs += 16){
312309      int bank = spriteram[offs+0];
313310
314311      if ( ( bank >> 4 ) == priority ) {
r21024r21025
321318            if (sx >= 0x0300) sx -= 0x0400;
322319
323320            flags = spriteram[offs+4];
324            ( *( draw_sprites_proc[ flags & 0x0f ] ) )(machine, bitmap,cliprect, which, sx, sy, bank, flags );
321            (this->*( draw_sprites_proc[ flags & 0x0f ] ) )(bitmap,cliprect, which, sx, sy, bank, flags );
325322         }
326323      }
327324   }
r21024r21025
339336   m_tx_tilemap->set_scrollx(0,m_scroll0xlo[0] + 256 * m_scroll0xhi[0]);
340337   m_tx_tilemap->set_scrolly(0,m_scroll0ylo[0] + 256 * m_scroll0yhi[0]);
341338
342//  draw_sprites(machine(), bitmap,cliprect, 3 );
339//  draw_sprites(bitmap,cliprect, 3 );
343340   m_bg_tilemap->draw(bitmap, cliprect, 0,0);
344   draw_sprites(machine(), bitmap,cliprect, 2 );
341   draw_sprites(bitmap,cliprect, 2 );
345342   m_fg_tilemap->draw(bitmap, cliprect, 0,0);
346   draw_sprites(machine(), bitmap,cliprect, 1 );
343   draw_sprites(bitmap,cliprect, 1 );
347344   m_tx_tilemap->draw(bitmap, cliprect, 0,0);
348   draw_sprites(machine(), bitmap,cliprect, 0 );
345   draw_sprites(bitmap,cliprect, 0 );
349346   return 0;
350347}
trunk/src/mame/video/yiear.c
r21024r21025
102102   m_bg_tilemap = &machine().tilemap().create(tilemap_get_info_delegate(FUNC(yiear_state::get_bg_tile_info),this), TILEMAP_SCAN_ROWS, 8, 8, 32, 32);
103103}
104104
105static void draw_sprites( running_machine &machine, bitmap_ind16 &bitmap, const rectangle &cliprect )
105void yiear_state::draw_sprites( bitmap_ind16 &bitmap, const rectangle &cliprect )
106106{
107   yiear_state *state = machine.driver_data<yiear_state>();
108   UINT8 *spriteram = state->m_spriteram;
109   UINT8 *spriteram_2 = state->m_spriteram2;
107   UINT8 *spriteram = m_spriteram;
108   UINT8 *spriteram_2 = m_spriteram2;
110109   int offs;
111110
112   for (offs = state->m_spriteram.bytes() - 2; offs >= 0; offs -= 2)
111   for (offs = m_spriteram.bytes() - 2; offs >= 0; offs -= 2)
113112   {
114113      int attr = spriteram[offs];
115114      int code = spriteram_2[offs + 1] + 256 * (attr & 0x01);
r21024r21025
119118      int sy = 240 - spriteram[offs + 1];
120119      int sx = spriteram_2[offs];
121120
122      if (state->flip_screen())
121      if (flip_screen())
123122      {
124123         sy = 240 - sy;
125124         flipy = !flipy;
r21024r21025
131130      }
132131
133132      drawgfx_transpen(bitmap, cliprect,
134         machine.gfx[1],
133         machine().gfx[1],
135134         code, color,
136135         flipx, flipy,
137136         sx, sy, 0);
r21024r21025
141140UINT32 yiear_state::screen_update_yiear(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect)
142141{
143142   m_bg_tilemap->draw(bitmap, cliprect, 0, 0);
144   draw_sprites(machine(), bitmap, cliprect);
143   draw_sprites(bitmap, cliprect);
145144   return 0;
146145}
trunk/src/mame/video/zaccaria.c
r21024r21025
203203offsets 1 and 2 are swapped if accessed from spriteram2
204204
205205*/
206static void draw_sprites(running_machine &machine, bitmap_ind16 &bitmap,const rectangle &cliprect,UINT8 *spriteram,int color,int section)
206void zaccaria_state::draw_sprites(bitmap_ind16 &bitmap,const rectangle &cliprect,UINT8 *spriteram,int color,int section)
207207{
208   zaccaria_state *state = machine.driver_data<zaccaria_state>();
209208   int offs,o1 = 1,o2 = 2;
210209
211210   if (section)
r21024r21025
223222
224223      if (sx == 1) continue;
225224
226      if (state->flip_screen_x())
225      if (flip_screen_x())
227226      {
228227         sx = 240 - sx;
229228         flipx = !flipx;
230229      }
231      if (state->flip_screen_y())
230      if (flip_screen_y())
232231      {
233232         sy = 240 - sy;
234233         flipy = !flipy;
235234      }
236235
237      drawgfx_transpen(bitmap,cliprect,machine.gfx[1],
236      drawgfx_transpen(bitmap,cliprect,machine().gfx[1],
238237            (spriteram[offs + o1] & 0x3f) + (spriteram[offs + o2] & 0xc0),
239238            ((spriteram[offs + o2] & 0x07) << 2) | color,
240239            flipx,flipy,sx,sy,0);
r21024r21025
247246
248247   // 3 layers of sprites, each with their own palette and priorities
249248   // Not perfect yet, does spriteram(1) layer have a priority bit somewhere?
250   draw_sprites(machine(),bitmap,cliprect,m_spriteram2,2,1);
251   draw_sprites(machine(),bitmap,cliprect,m_spriteram,1,0);
252   draw_sprites(machine(),bitmap,cliprect,m_spriteram2+0x20,0,1);
249   draw_sprites(bitmap,cliprect,m_spriteram2,2,1);
250   draw_sprites(bitmap,cliprect,m_spriteram,1,0);
251   draw_sprites(bitmap,cliprect,m_spriteram2+0x20,0,1);
253252
254253   return 0;
255254}
trunk/src/mame/video/wgp.c
r21024r21025
55
66/*******************************************************************/
77
8INLINE void common_get_piv_tile_info( running_machine &machine, tile_data &tileinfo, int tile_index, int num )
8inline void wgp_state::common_get_piv_tile_info( tile_data &tileinfo, int tile_index, int num )
99{
10   wgp_state *state = machine.driver_data<wgp_state>();
11   UINT16 tilenum = state->m_pivram[tile_index + num * 0x1000];    /* 3 blocks of $2000 */
12   UINT16 attr = state->m_pivram[tile_index + num * 0x1000 + 0x8000];  /* 3 blocks of $2000 */
10   UINT16 tilenum = m_pivram[tile_index + num * 0x1000];    /* 3 blocks of $2000 */
11   UINT16 attr = m_pivram[tile_index + num * 0x1000 + 0x8000];  /* 3 blocks of $2000 */
1312
14   SET_TILE_INFO(
13   SET_TILE_INFO_MEMBER(
1514         2,
1615         tilenum & 0x3fff,
1716         (attr & 0x3f),  /* attr & 0x1 ?? */
r21024r21025
2019
2120TILE_GET_INFO_MEMBER(wgp_state::get_piv0_tile_info)
2221{
23   common_get_piv_tile_info(machine(), tileinfo, tile_index, 0);
22   common_get_piv_tile_info(tileinfo, tile_index, 0);
2423}
2524
2625TILE_GET_INFO_MEMBER(wgp_state::get_piv1_tile_info)
2726{
28   common_get_piv_tile_info(machine(), tileinfo, tile_index, 1);
27   common_get_piv_tile_info(tileinfo, tile_index, 1);
2928}
3029
3130TILE_GET_INFO_MEMBER(wgp_state::get_piv2_tile_info)
3231{
33   common_get_piv_tile_info(machine(), tileinfo, tile_index, 2);
32   common_get_piv_tile_info(tileinfo, tile_index, 2);
3433}
3534
3635
37static void wgp_core_vh_start( running_machine &machine, int piv_xoffs, int piv_yoffs )
36void wgp_state::wgp_core_vh_start( int piv_xoffs, int piv_yoffs )
3837{
39   wgp_state *state = machine.driver_data<wgp_state>();
38   m_piv_tilemap[0] = &machine().tilemap().create(tilemap_get_info_delegate(FUNC(wgp_state::get_piv0_tile_info),this), TILEMAP_SCAN_ROWS, 16, 16, 64, 64);
39   m_piv_tilemap[1] = &machine().tilemap().create(tilemap_get_info_delegate(FUNC(wgp_state::get_piv1_tile_info),this), TILEMAP_SCAN_ROWS, 16, 16, 64, 64);
40   m_piv_tilemap[2] = &machine().tilemap().create(tilemap_get_info_delegate(FUNC(wgp_state::get_piv2_tile_info),this), TILEMAP_SCAN_ROWS, 16, 16, 64, 64);
4041
41   state->m_piv_tilemap[0] = &machine.tilemap().create(tilemap_get_info_delegate(FUNC(wgp_state::get_piv0_tile_info),state), TILEMAP_SCAN_ROWS, 16, 16, 64, 64);
42   state->m_piv_tilemap[1] = &machine.tilemap().create(tilemap_get_info_delegate(FUNC(wgp_state::get_piv1_tile_info),state), TILEMAP_SCAN_ROWS, 16, 16, 64, 64);
43   state->m_piv_tilemap[2] = &machine.tilemap().create(tilemap_get_info_delegate(FUNC(wgp_state::get_piv2_tile_info),state), TILEMAP_SCAN_ROWS, 16, 16, 64, 64);
42   m_piv_xoffs = piv_xoffs;
43   m_piv_yoffs = piv_yoffs;
4444
45   state->m_piv_xoffs = piv_xoffs;
46   state->m_piv_yoffs = piv_yoffs;
45   m_piv_tilemap[0]->set_transparent_pen(0);
46   m_piv_tilemap[1]->set_transparent_pen(0);
47   m_piv_tilemap[2]->set_transparent_pen(0);
4748
48   state->m_piv_tilemap[0]->set_transparent_pen(0);
49   state->m_piv_tilemap[1]->set_transparent_pen(0);
50   state->m_piv_tilemap[2]->set_transparent_pen(0);
51
5249   /* flipscreen n/a */
53   state->m_piv_tilemap[0]->set_scrolldx(-piv_xoffs, 0);
54   state->m_piv_tilemap[1]->set_scrolldx(-piv_xoffs, 0);
55   state->m_piv_tilemap[2]->set_scrolldx(-piv_xoffs, 0);
56   state->m_piv_tilemap[0]->set_scrolldy(-piv_yoffs, 0);
57   state->m_piv_tilemap[1]->set_scrolldy(-piv_yoffs, 0);
58   state->m_piv_tilemap[2]->set_scrolldy(-piv_yoffs, 0);
50   m_piv_tilemap[0]->set_scrolldx(-piv_xoffs, 0);
51   m_piv_tilemap[1]->set_scrolldx(-piv_xoffs, 0);
52   m_piv_tilemap[2]->set_scrolldx(-piv_xoffs, 0);
53   m_piv_tilemap[0]->set_scrolldy(-piv_yoffs, 0);
54   m_piv_tilemap[1]->set_scrolldy(-piv_yoffs, 0);
55   m_piv_tilemap[2]->set_scrolldy(-piv_yoffs, 0);
5956
6057   /* We don't need tilemap_set_scroll_rows, as the custom draw routine applies rowscroll manually */
61   tc0100scn_set_colbanks(state->m_tc0100scn, 0x80, 0xc0, 0x40);
58   tc0100scn_set_colbanks(m_tc0100scn, 0x80, 0xc0, 0x40);
6259
63   state->save_item(NAME(state->m_piv_ctrl_reg));
64   state->save_item(NAME(state->m_rotate_ctrl));
65   state->save_item(NAME(state->m_piv_zoom));
66   state->save_item(NAME(state->m_piv_scrollx));
67   state->save_item(NAME(state->m_piv_scrolly));
60   save_item(NAME(m_piv_ctrl_reg));
61   save_item(NAME(m_rotate_ctrl));
62   save_item(NAME(m_piv_zoom));
63   save_item(NAME(m_piv_scrollx));
64   save_item(NAME(m_piv_scrolly));
6865}
6966
7067void wgp_state::video_start()
7168{
72   wgp_core_vh_start(machine(), 32, 16);
69   wgp_core_vh_start(32, 16);
7370}
7471
7572VIDEO_START_MEMBER(wgp_state,wgp2)
7673{
77   wgp_core_vh_start(machine(), 32, 16);
74   wgp_core_vh_start(32, 16);
7875}
7976
8077
r21024r21025
341338      2, 2, 3, 3,
342339      2, 2, 3, 3 };
343340
344static void draw_sprites( running_machine &machine, bitmap_ind16 &bitmap, const rectangle &cliprect, int y_offs )
341void wgp_state::draw_sprites( bitmap_ind16 &bitmap, const rectangle &cliprect, int y_offs )
345342{
346   wgp_state *state = machine.driver_data<wgp_state>();
347   UINT16 *spriteram = state->m_spriteram;
343   UINT16 *spriteram = m_spriteram;
348344   int offs, i, j, k;
349345   int x, y, curx, cury;
350346   int zx, zy, zoomx, zoomy, priority = 0;
351347   UINT8 small_sprite, col, flipx, flipy;
352348   UINT16 code, bigsprite, map_index;
353349//  UINT16 rotate = 0;
354   UINT16 tile_mask = (machine.gfx[0]->elements()) - 1;
350   UINT16 tile_mask = (machine().gfx[0]->elements()) - 1;
355351   static const int primasks[2] = {0x0, 0xfffc};   /* fff0 => under rhs of road only */
356352
357353   for (offs = 0x1ff; offs >= 0; offs--)
r21024r21025
397393
398394         /* don't know what selects 2x2 sprites: we use a nasty kludge which seems to work */
399395
400         i = state->m_spritemap[map_index + 0xa];
401         j = state->m_spritemap[map_index + 0xc];
396         i = m_spritemap[map_index + 0xa];
397         j = m_spritemap[map_index + 0xc];
402398         small_sprite = ((i > 0) & (i <= 8) & (j > 0) & (j <= 8));
403399
404400         if (small_sprite)
405401         {
406402            for (i = 0; i < 4; i++)
407403            {
408               code = state->m_spritemap[(map_index + (i << 1))] & tile_mask;
409               col  = state->m_spritemap[(map_index + (i << 1) + 1)] & 0xf;
404               code = m_spritemap[(map_index + (i << 1))] & tile_mask;
405               col  = m_spritemap[(map_index + (i << 1) + 1)] & 0xf;
410406
411407               /* not known what controls priority */
412               priority = (state->m_spritemap[(map_index + (i << 1) + 1)] & 0x70) >> 4;
408               priority = (m_spritemap[(map_index + (i << 1) + 1)] & 0x70) >> 4;
413409
414410               flipx = 0;  // no flip xy?
415411               flipy = 0;
r21024r21025
423419               zx = x + (((k + 1) * zoomx) / 2) - curx;
424420               zy = y + (((j + 1) * zoomy) / 2) - cury;
425421
426               pdrawgfxzoom_transpen(bitmap, cliprect,machine.gfx[0],
422               pdrawgfxzoom_transpen(bitmap, cliprect,machine().gfx[0],
427423                     code,
428424                     col,
429425                     flipx, flipy,
430426                     curx,cury,
431427                     zx << 12, zy << 12,
432                     machine.priority_bitmap,primasks[((priority >> 1) &1)],0);  /* maybe >> 2 or 0...? */
428                     machine().priority_bitmap,primasks[((priority >> 1) &1)],0);  /* maybe >> 2 or 0...? */
433429            }
434430         }
435431         else
436432         {
437433            for (i = 0; i < 16; i++)
438434            {
439               code = state->m_spritemap[(map_index + (i << 1))] & tile_mask;
440               col  = state->m_spritemap[(map_index + (i << 1) + 1)] & 0xf;
435               code = m_spritemap[(map_index + (i << 1))] & tile_mask;
436               col  = m_spritemap[(map_index + (i << 1) + 1)] & 0xf;
441437
442438               /* not known what controls priority */
443               priority = (state->m_spritemap[(map_index + (i << 1) + 1)] & 0x70) >> 4;
439               priority = (m_spritemap[(map_index + (i << 1) + 1)] & 0x70) >> 4;
444440
445441               flipx = 0;  // no flip xy?
446442               flipy = 0;
r21024r21025
454450               zx = x + (((k + 1) * zoomx) / 4) - curx;
455451               zy = y + (((j + 1) * zoomy) / 4) - cury;
456452
457               pdrawgfxzoom_transpen(bitmap, cliprect,machine.gfx[0],
453               pdrawgfxzoom_transpen(bitmap, cliprect,machine().gfx[0],
458454                     code,
459455                     col,
460456                     flipx, flipy,
461457                     curx,cury,
462458                     zx << 12, zy << 12,
463                     machine.priority_bitmap,primasks[((priority >> 1) &1)],0);  /* maybe >> 2 or 0...? */
459                     machine().priority_bitmap,primasks[((priority >> 1) &1)],0);  /* maybe >> 2 or 0...? */
464460            }
465461         }
466462      }
r21024r21025
513509
514510
515511
516static void wgp_piv_layer_draw( running_machine &machine, bitmap_ind16 &bitmap, const rectangle &cliprect, int layer, int flags, UINT32 priority )
512void wgp_state::wgp_piv_layer_draw( bitmap_ind16 &bitmap, const rectangle &cliprect, int layer, int flags, UINT32 priority )
517513{
518   wgp_state *state = machine.driver_data<wgp_state>();
519   bitmap_ind16 &srcbitmap = state->m_piv_tilemap[layer]->pixmap();
520   bitmap_ind8 &flagsbitmap = state->m_piv_tilemap[layer]->flagsmap();
514   bitmap_ind16 &srcbitmap = m_piv_tilemap[layer]->pixmap();
515   bitmap_ind8 &flagsbitmap = m_piv_tilemap[layer]->flagsmap();
521516
522517   UINT16 *dst16,*src16;
523518   UINT8 *tsrc;
r21024r21025
549544      In WGP2 see: road at big hill (default course) */
550545
551546   /* This calculation may be wrong, the y_index one too */
552   zoomy = 0x10000 - (((state->m_piv_ctrlram[0x08 + layer] & 0xff) - 0x7f) * 512);
547   zoomy = 0x10000 - (((m_piv_ctrlram[0x08 + layer] & 0xff) - 0x7f) * 512);
553548
554549   if (!flipscreen)
555550   {
556      sx = ((state->m_piv_scrollx[layer]) << 16);
557      sx += (state->m_piv_xoffs) * zoomx;     /* may be imperfect */
551      sx = ((m_piv_scrollx[layer]) << 16);
552      sx += (m_piv_xoffs) * zoomx;     /* may be imperfect */
558553
559      y_index = (state->m_piv_scrolly[layer] << 16);
560      y_index += (state->m_piv_yoffs + min_y) * zoomy;        /* may be imperfect */
554      y_index = (m_piv_scrolly[layer] << 16);
555      y_index += (m_piv_yoffs + min_y) * zoomy;        /* may be imperfect */
561556   }
562557   else    /* piv tiles flipscreen n/a */
563558   {
r21024r21025
577572      src_y_index = (y_index >> 16) & 0x3ff;
578573      row_index = src_y_index;
579574
580      row_zoom = state->m_pivram[row_index + layer * 0x400 + 0x3400] & 0xff;
575      row_zoom = m_pivram[row_index + layer * 0x400 + 0x3400] & 0xff;
581576
582      row_colbank = state->m_pivram[row_index + layer * 0x400 + 0x3400] >> 8;
577      row_colbank = m_pivram[row_index + layer * 0x400 + 0x3400] >> 8;
583578      a = (row_colbank & 0xe0);   /* kill bit 4 */
584579      row_colbank = (((row_colbank & 0xf) << 1) | a) << 4;
585580
586      row_scroll = state->m_pivram[row_index + layer * 0x1000 + 0x4000];
581      row_scroll = m_pivram[row_index + layer * 0x1000 + 0x4000];
587582      a = (row_scroll & 0xffe0) >> 1; /* kill bit 4 */
588583      row_scroll = ((row_scroll & 0xf) | a) & width_mask;
589584
r21024r21025
623618         }
624619      }
625620
626      bryan2_drawscanline(bitmap, 0, y, screen_width, scanline, (flags & TILEMAP_DRAW_OPAQUE) ? 0 : 1, ROT0, machine.priority_bitmap, priority);
621      bryan2_drawscanline(bitmap, 0, y, screen_width, scanline, (flags & TILEMAP_DRAW_OPAQUE) ? 0 : 1, ROT0, machine().priority_bitmap, priority);
627622
628623      y_index += zoomy;
629624      if (!machine_flip) y++; else y--;
r21024r21025
694689#ifdef MAME_DEBUG
695690   if (m_dislayer[layer[0]] == 0)
696691#endif
697   wgp_piv_layer_draw(machine(), bitmap, cliprect, layer[0], TILEMAP_DRAW_OPAQUE, 1);
692   wgp_piv_layer_draw(bitmap, cliprect, layer[0], TILEMAP_DRAW_OPAQUE, 1);
698693
699694#ifdef MAME_DEBUG
700695   if (m_dislayer[layer[1]] == 0)
701696#endif
702   wgp_piv_layer_draw(machine(), bitmap, cliprect, layer[1], 0, 2);
697   wgp_piv_layer_draw(bitmap, cliprect, layer[1], 0, 2);
703698
704699#ifdef MAME_DEBUG
705700   if (m_dislayer[layer[2]] == 0)
706701#endif
707   wgp_piv_layer_draw(machine(), bitmap, cliprect, layer[2], 0, 4);
702   wgp_piv_layer_draw(bitmap, cliprect, layer[2], 0, 4);
708703
709   draw_sprites(machine(), bitmap, cliprect, 16);
704   draw_sprites(bitmap, cliprect, 16);
710705
711706/* ... then here we should apply rotation from wgp_sate_ctrl[] to the bitmap before we draw the TC0100SCN layers on it */
712707   layer[0] = tc0100scn_bottomlayer(m_tc0100scn);
trunk/src/mame/video/warpwarp.c
r21024r21025
207207
208208***************************************************************************/
209209
210INLINE void geebee_plot(bitmap_ind16 &bitmap, const rectangle &cliprect, int x, int y, pen_t pen)
210inline void warpwarp_state::geebee_plot(bitmap_ind16 &bitmap, const rectangle &cliprect, int x, int y, pen_t pen)
211211{
212212   if (cliprect.contains(x, y))
213213      bitmap.pix16(y, x) = pen;
214214}
215215
216static void draw_ball(running_machine &machine, bitmap_ind16 &bitmap, const rectangle &cliprect,pen_t pen)
216void warpwarp_state::draw_ball(bitmap_ind16 &bitmap, const rectangle &cliprect,pen_t pen)
217217{
218   warpwarp_state *state = machine.driver_data<warpwarp_state>();
219   if (state->m_ball_on)
218   if (m_ball_on)
220219   {
221220      int x,y,i,j;
222221
223      if (state->flip_screen() & 1) {
224         x = 376 - state->m_ball_h;
225         y = 280 - state->m_ball_v;
222      if (flip_screen() & 1) {
223         x = 376 - m_ball_h;
224         y = 280 - m_ball_v;
226225      }
227226      else {
228         x = 264 - state->m_ball_h;
229         y = 240 - state->m_ball_v;
227         x = 264 - m_ball_h;
228         y = 240 - m_ball_v;
230229      }
231230
232      for (i = state->m_ball_sizey;i > 0;i--)
233         for (j = state->m_ball_sizex;j > 0;j--)
231      for (i = m_ball_sizey;i > 0;i--)
232         for (j = m_ball_sizex;j > 0;j--)
234233            geebee_plot(bitmap, cliprect, x-j, y-i, pen);
235234   }
236235}
r21024r21025
239238{
240239   m_bg_tilemap->draw(bitmap, cliprect, 0,0);
241240
242   draw_ball(machine(), bitmap, cliprect, m_ball_pen);
241   draw_ball(bitmap, cliprect, m_ball_pen);
243242   return 0;
244243}
trunk/src/mame/video/warriorb.c
r21024r21025
1515            SPRITE DRAW ROUTINE
1616************************************************************/
1717
18static void draw_sprites( running_machine &machine, bitmap_ind16 &bitmap, const rectangle &cliprect, int x_offs, int y_offs )
18void warriorb_state::draw_sprites( bitmap_ind16 &bitmap, const rectangle &cliprect, int x_offs, int y_offs )
1919{
20   warriorb_state *state = machine.driver_data<warriorb_state>();
21   UINT16 *spriteram = state->m_spriteram;
20   UINT16 *spriteram = m_spriteram;
2221   int offs, data, data2, tilenum, color, flipx, flipy;
2322   int x, y, priority, pri_mask;
2423
r21024r21025
2726#endif
2827
2928   /* pdrawgfx() needs us to draw sprites front to back */
30   for (offs = 0; offs < state->m_spriteram.bytes() / 2; offs += 4)
29   for (offs = 0; offs < m_spriteram.bytes() / 2; offs += 4)
3130   {
3231      data = spriteram[offs + 1];
3332      tilenum = data & 0x7fff;
r21024r21025
6362      if (x > 0x3c0) x -= 0x400;
6463      if (y > 0x180) y -= 0x200;
6564
66      pdrawgfx_transpen(bitmap,cliprect,machine.gfx[0],
65      pdrawgfx_transpen(bitmap,cliprect,machine().gfx[0],
6766               tilenum,
6867               color,
6968               flipx,flipy,
7069               x,y,
71               machine.priority_bitmap,pri_mask,0);
70               machine().priority_bitmap,pri_mask,0);
7271   }
7372
7473#ifdef MAME_DEBUG
r21024r21025
8281                SCREEN REFRESH
8382**************************************************************/
8483
85static UINT32 update_screen(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect, int xoffs, device_t *tc0100scn)
84UINT32 warriorb_state::update_screen(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect, int xoffs, device_t *tc0100scn)
8685{
8786   UINT8 layer[3], nodraw;
8887
r21024r21025
101100
102101   /* Ensure screen blanked even when bottom layers not drawn due to disable bit */
103102   if (nodraw)
104      bitmap.fill(get_black_pen(screen.machine()), cliprect);
103      bitmap.fill(get_black_pen(machine()), cliprect);
105104
106105   // draw middle layer
107106   tc0100scn_tilemap_draw(tc0100scn, bitmap, cliprect, layer[1], 0, 1);
108107
109108   /* Sprites can be under/over the layer below text layer */
110   draw_sprites(screen.machine(), bitmap, cliprect, xoffs, 8); // draw sprites
109   draw_sprites(bitmap, cliprect, xoffs, 8); // draw sprites
111110
112111   // draw top(text) layer
113112   tc0100scn_tilemap_draw(tc0100scn, bitmap, cliprect, layer[2], 0, 0);
trunk/src/mame/video/wrally.c
r21024r21025
101101    in the range 0x8-0xf are used.
102102*/
103103
104static void draw_sprites(running_machine &machine, bitmap_ind16 &bitmap, const rectangle &cliprect, int priority)
104void wrally_state::draw_sprites(bitmap_ind16 &bitmap, const rectangle &cliprect, int priority)
105105{
106   wrally_state *state = machine.driver_data<wrally_state>();
107106   int i, px, py;
108   gfx_element *gfx = machine.gfx[0];
107   gfx_element *gfx = machine().gfx[0];
109108
110109   for (i = 6/2; i < (0x1000 - 6)/2; i += 4) {
111      int sx = state->m_spriteram[i+2] & 0x03ff;
112      int sy = (240 - (state->m_spriteram[i] & 0x00ff)) & 0x00ff;
113      int number = state->m_spriteram[i+3] & 0x3fff;
114      int color = (state->m_spriteram[i+2] & 0x7c00) >> 10;
115      int attr = (state->m_spriteram[i] & 0xfe00) >> 9;
110      int sx = m_spriteram[i+2] & 0x03ff;
111      int sy = (240 - (m_spriteram[i] & 0x00ff)) & 0x00ff;
112      int number = m_spriteram[i+3] & 0x3fff;
113      int color = (m_spriteram[i+2] & 0x7c00) >> 10;
114      int attr = (m_spriteram[i] & 0xfe00) >> 9;
116115
117116      int xflip = attr & 0x20;
118117      int yflip = attr & 0x40;
r21024r21025
122121
123122      if (high_priority != priority) continue;
124123
125      if (state->flip_screen()) {
124      if (flip_screen()) {
126125         sy = sy + 248;
127126      }
128127
r21024r21025
196195   m_pant[1]->draw(bitmap, cliprect, TILEMAP_DRAW_CATEGORY(1),0);
197196   m_pant[0]->draw(bitmap, cliprect, TILEMAP_DRAW_CATEGORY(1) | TILEMAP_DRAW_LAYER0,0);
198197
199   draw_sprites(machine(),bitmap,cliprect,0);
198   draw_sprites(bitmap,cliprect,0);
200199
201200   m_pant[0]->draw(bitmap, cliprect, TILEMAP_DRAW_CATEGORY(1) | TILEMAP_DRAW_LAYER1,0);
202201
203   draw_sprites(machine(),bitmap,cliprect,1);
202   draw_sprites(bitmap,cliprect,1);
204203
205204   return 0;
206205}
trunk/src/mame/includes/warriorb.h
r21024r21025
4343   UINT32 screen_update_warriorb_left(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect);
4444   UINT32 screen_update_warriorb_right(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect);
4545   void reset_sound_region();
46   void draw_sprites( bitmap_ind16 &bitmap, const rectangle &cliprect, int x_offs, int y_offs );
47   UINT32 update_screen(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect, int xoffs, device_t *tc0100scn);
4648};
trunk/src/mame/includes/yiear.h
r21024r21025
3838   UINT32 screen_update_yiear(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect);
3939   INTERRUPT_GEN_MEMBER(yiear_vblank_interrupt);
4040   INTERRUPT_GEN_MEMBER(yiear_nmi_interrupt);
41   void draw_sprites( bitmap_ind16 &bitmap, const rectangle &cliprect );
4142};
trunk/src/mame/includes/xyonix.h
r21024r21025
2020   virtual void video_start();
2121   virtual void palette_init();
2222   UINT32 screen_update_xyonix(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect);
23   void handle_coins(int coin);
2324};
trunk/src/mame/includes/xain.h
r21024r21025
7070   virtual void video_start();
7171   UINT32 screen_update_xain(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect);
7272   TIMER_DEVICE_CALLBACK_MEMBER(xain_scanline);
73   void draw_sprites(bitmap_ind16 &bitmap,const rectangle &cliprect);
74   inline int scanline_to_vcount(int scanline);
7375};
trunk/src/mame/includes/xxmissio.h
r21024r21025
3333   INTERRUPT_GEN_MEMBER(xxmissio_interrupt_s);
3434   DECLARE_WRITE8_MEMBER(xxmissio_scroll_x_w);
3535   DECLARE_WRITE8_MEMBER(xxmissio_scroll_y_w);
36   void draw_sprites(bitmap_ind16 &bitmap, const rectangle &cliprect, gfx_element *gfx);
3637};
trunk/src/mame/includes/wwfwfest.h
r21024r21025
4545   DECLARE_VIDEO_START(wwfwfstb);
4646   UINT32 screen_update_wwfwfest(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect);
4747   TIMER_DEVICE_CALLBACK_MEMBER(wwfwfest_scanline);
48   void draw_sprites(bitmap_ind16 &bitmap, const rectangle &cliprect );
4849};
trunk/src/mame/includes/williams.h
r21024r21025
129129   DECLARE_WRITE8_MEMBER(tshoot_lamp_w);
130130   void williams2_postload();
131131   void defender_postload();
132   void state_save_register();
133   void create_palette_lookup();
134   void blitter_init(int blitter_config, const UINT8 *remap_prom);
135   inline void blit_pixel(address_space &space, int offset, int srcdata, int data, int mask, int solid);
136   int blitter_core(address_space &space, int sstart, int dstart, int w, int h, int data);
137   inline void update_blaster_banking();
138   void defender_install_io_space(address_space &space);
132139};
133140
134141
r21024r21025
148155   DECLARE_WRITE8_MEMBER(joust2_snd_cmd_w);
149156};
150157
151/*----------- defined in drivers/williams.c -----------*/
152
153void defender_install_io_space(address_space &space);
154
155
156158/*----------- defined in machine/williams.c -----------*/
157159
158160/* Generic old-Williams PIA interfaces */
trunk/src/mame/includes/wolfpack.h
r21024r21025
5757   UINT32 screen_update_wolfpack(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect);
5858   void screen_eof_wolfpack(screen_device &screen, bool state);
5959   TIMER_CALLBACK_MEMBER(periodic_callback);
60   void draw_ship(bitmap_ind16 &bitmap, const rectangle &cliprect);
61   void draw_torpedo(bitmap_ind16 &bitmap, const rectangle &cliprect);
62   void draw_pt(bitmap_ind16 &bitmap, const rectangle &cliprect);
63   void draw_water(colortable_t *colortable, bitmap_ind16 &bitmap, const rectangle &cliprect);
6064};
trunk/src/mame/includes/xexex.h
r21024r21025
6969   TIMER_CALLBACK_MEMBER(dmaend_callback);
7070   TIMER_DEVICE_CALLBACK_MEMBER(xexex_interrupt);
7171   void xexex_postload();
72   void xexex_objdma( int limiter );
73   void parse_control2(  );
74   void reset_sound_region();
7275};
7376
7477/*----------- defined in video/xexex.c -----------*/
trunk/src/mame/includes/wiz.h
r21024r21025
5353   UINT32 screen_update_kungfut(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect);
5454   INTERRUPT_GEN_MEMBER(wiz_vblank_interrupt);
5555   INTERRUPT_GEN_MEMBER(wiz_sound_interrupt);
56   void draw_background(bitmap_ind16 &bitmap, const rectangle &cliprect, int bank, int colortype);
57   void draw_foreground(bitmap_ind16 &bitmap, const rectangle &cliprect, int colortype);
58   void draw_sprites(bitmap_ind16 &bitmap,const rectangle &cliprect, UINT8* sprite_ram,int bank);   
5659};
trunk/src/mame/includes/wrally.h
r21024r21025
2525   TILE_GET_INFO_MEMBER(get_tile_info_wrally_screen1);
2626   virtual void video_start();
2727   UINT32 screen_update_wrally(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect);
28   void draw_sprites(bitmap_ind16 &bitmap, const rectangle &cliprect, int priority);
2829};
trunk/src/mame/includes/xorworld.h
r21024r21025
2020   virtual void video_start();
2121   virtual void palette_init();
2222   UINT32 screen_update_xorworld(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect);
23   void draw_sprites(bitmap_ind16 &bitmap, const rectangle &cliprect );
2324};
trunk/src/mame/includes/wc90b.h
r21024r21025
4040   TILE_GET_INFO_MEMBER(get_tx_tile_info);
4141   virtual void video_start();
4242   UINT32 screen_update_wc90b(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect);
43   void draw_sprites(bitmap_ind16 &bitmap, const rectangle &cliprect, int priority );
4344};
trunk/src/mame/includes/wwfsstar.h
r21024r21025
2828   virtual void video_start();
2929   UINT32 screen_update_wwfsstar(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect);
3030   TIMER_DEVICE_CALLBACK_MEMBER(wwfsstar_scanline);
31   void draw_sprites(bitmap_ind16 &bitmap, const rectangle &cliprect );
3132};
trunk/src/mame/includes/wgp.h
r21024r21025
7474   TIMER_CALLBACK_MEMBER(wgp_interrupt6);
7575   TIMER_CALLBACK_MEMBER(wgp_cpub_interrupt6);
7676   void wgp_postload();
77   inline void common_get_piv_tile_info( tile_data &tileinfo, int tile_index, int num );
78   void wgp_core_vh_start( int piv_xoffs, int piv_yoffs );
79   void draw_sprites( bitmap_ind16 &bitmap, const rectangle &cliprect, int y_offs );
80   void wgp_piv_layer_draw( bitmap_ind16 &bitmap, const rectangle &cliprect, int layer, int flags, UINT32 priority );
81   void parse_control();
82   void reset_sound_region(  )  /* assumes Z80 sandwiched between the 68Ks */;
7783};
trunk/src/mame/includes/yunsun16.h
r21024r21025
4545   virtual void machine_reset();
4646   virtual void video_start();
4747   UINT32 screen_update_yunsun16(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect);
48   void draw_sprites( bitmap_ind16 &bitmap, const rectangle &cliprect );
4849};
trunk/src/mame/includes/zaxxon.h
r21024r21025
7878   DECLARE_WRITE8_MEMBER(zaxxon_sound_c_w);
7979   DECLARE_WRITE8_MEMBER(congo_sound_b_w);
8080   DECLARE_WRITE8_MEMBER(congo_sound_c_w);
81   void video_start_common(tilemap_get_info_delegate fg_tile_info);
82   void draw_background(bitmap_ind16 &bitmap, const rectangle &cliprect, int skew);
83   inline int find_minimum_y(UINT8 value, int flip);
84   inline int find_minimum_x(UINT8 value, int flip);
85   void draw_sprites(bitmap_ind16 &bitmap, const rectangle &cliprect, UINT16 flipxmask, UINT16 flipymask);
86   void zaxxonj_decode(const char *cputag);
8187};
8288
8389
trunk/src/mame/includes/wecleman.h
r21024r21025
8181   INTERRUPT_GEN_MEMBER(hotchase_sound_timer);
8282   TIMER_DEVICE_CALLBACK_MEMBER(wecleman_scanline);
8383   TIMER_DEVICE_CALLBACK_MEMBER(hotchase_scanline);
84   void wecleman_unpack_sprites();
85   void bitswap(UINT8 *src,size_t len,int _14,int _13,int _12,int _11,int _10,int _f,int _e,int _d,int _c,int _b,int _a,int _9,int _8,int _7,int _6,int _5,int _4,int _3,int _2,int _1,int _0);
86   void hotchase_sprite_decode( int num16_banks, int bank_size );
8487};
8588
8689/*----------- defined in video/wecleman.c -----------*/
trunk/src/mame/includes/welltris.h
r21024r21025
4141   TILE_GET_INFO_MEMBER(get_welltris_tile_info);
4242   virtual void video_start();
4343   UINT32 screen_update_welltris(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect);
44   void draw_background(bitmap_ind16 &bitmap, const rectangle &cliprect);
4445};
trunk/src/mame/includes/wc90.h
r21024r21025
2020      m_scroll2yhi(*this, "scroll2yhi"),
2121      m_spriteram(*this, "spriteram"){ }
2222
23   typedef void (wc90_state::*draw_sprites_func)(bitmap_ind16 &, const rectangle &, int, int, int, int, int );
24   
2325   required_shared_ptr<UINT8> m_fgvideoram;
2426   required_shared_ptr<UINT8> m_bgvideoram;
2527   required_shared_ptr<UINT8> m_txvideoram;
r21024r21025
5355   virtual void video_start();
5456   DECLARE_VIDEO_START(wc90t);
5557   UINT32 screen_update_wc90(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect);
58   void draw_sprites(bitmap_ind16 &bitmap, const rectangle &cliprect, int priority );
59   void draw_sprite_16x16(bitmap_ind16 &bitmap, const rectangle &cliprect, int code,int sx, int sy, int bank, int flags );
60   void draw_sprite_16x32(bitmap_ind16 &bitmap, const rectangle &cliprect, int code,int sx, int sy, int bank, int flags );
61   void draw_sprite_16x64(bitmap_ind16 &bitmap, const rectangle &cliprect, int code,int sx, int sy, int bank, int flags );
62   void draw_sprite_32x16(bitmap_ind16 &bitmap, const rectangle &cliprect, int code,int sx, int sy, int bank, int flags );
63   void draw_sprite_32x32(bitmap_ind16 &bitmap, const rectangle &cliprect, int code,int sx, int sy, int bank, int flags );
64   void draw_sprite_32x64(bitmap_ind16 &bitmap, const rectangle &cliprect, int code, int sx, int sy, int bank, int flags );
65   void draw_sprite_64x16(bitmap_ind16 &bitmap, const rectangle &cliprect, int code,int sx, int sy, int bank, int flags );
66   void draw_sprite_64x32(bitmap_ind16 &bitmap, const rectangle &cliprect, int code,int sx, int sy, int bank, int flags );
67   void draw_sprite_64x64(bitmap_ind16 &bitmap, const rectangle &cliprect, int code,int sx, int sy, int bank, int flags );
68   void draw_sprite_invalid(bitmap_ind16 &bitmap, const rectangle &cliprect, int code, int sx, int sy, int bank, int flags );
5669};
trunk/src/mame/includes/zac2650.h
r21024r21025
2222   virtual void video_start();
2323   virtual void palette_init();
2424   UINT32 screen_update_tinvader(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect);
25   int SpriteCollision(int first,int second);
26   void draw_sprites(bitmap_ind16 &bitmap, const rectangle &cliprect);
2527};
trunk/src/mame/includes/zaccaria.h
r21024r21025
4747   UINT32 screen_update_zaccaria(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect);
4848   INTERRUPT_GEN_MEMBER(zaccaria_cb1_toggle);
4949   INTERRUPT_GEN_MEMBER(vblank_irq);
50   void draw_sprites(bitmap_ind16 &bitmap,const rectangle &cliprect,UINT8 *spriteram,int color,int section);
5051};
trunk/src/mame/includes/warpwarp.h
r21024r21025
4848   DECLARE_PALETTE_INIT(navarone);
4949   UINT32 screen_update_geebee(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect);
5050   INTERRUPT_GEN_MEMBER(vblank_irq);
51   inline void geebee_plot(bitmap_ind16 &bitmap, const rectangle &cliprect, int x, int y, pen_t pen);
52   void draw_ball(bitmap_ind16 &bitmap, const rectangle &cliprect,pen_t pen);
5153};
5254
5355

Previous 199869 Revisions Next


© 1997-2024 The MAME Team