Previous 199869 Revisions Next

r20973 Tuesday 12th February, 2013 at 09:13:40 UTC by Miodrag Milanović
Modernization of drivers part 14 (no whatsnew)
[src/mame/drivers]opwolf.c orbit.c othunder.c
[src/mame/includes]ohmygod.h ojankohs.h oneshot.h opwolf.h orbit.h othldrby.h othunder.h
[src/mame/machine]opwolf.c
[src/mame/video]ohmygod.c ojankohs.c oneshot.c orbit.c othldrby.c othunder.c

trunk/src/mame/drivers/opwolf.c
r20972r20973
962962
963963   m_opwolf_region = rom[0x03fffe / 2] & 0xff;
964964
965   opwolf_cchip_init(machine());
965   opwolf_cchip_init();
966966
967967   // World & US version have different gun offsets, presumably slightly different gun hardware
968968   m_opwolf_gun_xoffs = 0xec - (rom[0x03ffb0 / 2] & 0xff);
trunk/src/mame/drivers/orbit.c
r20972r20973
5959 *
6060 *************************************/
6161
62static void update_misc_flags(address_space &space, UINT8 val)
62void orbit_state::update_misc_flags(address_space &space, UINT8 val)
6363{
64   orbit_state *state = space.machine().driver_data<orbit_state>();
64   m_misc_flags = val;
6565
66   state->m_misc_flags = val;
67
6866   /* BIT0 => UNUSED       */
6967   /* BIT1 => LOCKOUT      */
7068   /* BIT2 => NMI ENABLE   */
r20972r20973
7472   /* BIT6 => HYPER LED    */
7573   /* BIT7 => WARNING SND  */
7674
77   discrete_sound_w(state->m_discrete, space, ORBIT_WARNING_EN, BIT(state->m_misc_flags, 7));
75   discrete_sound_w(m_discrete, space, ORBIT_WARNING_EN, BIT(m_misc_flags, 7));
7876
79   set_led_status(space.machine(), 0, BIT(state->m_misc_flags, 3));
80   set_led_status(space.machine(), 1, BIT(state->m_misc_flags, 6));
77   set_led_status(machine(), 0, BIT(m_misc_flags, 3));
78   set_led_status(machine(), 1, BIT(m_misc_flags, 6));
8179
82   coin_lockout_w(space.machine(), 0, !BIT(state->m_misc_flags, 1));
83   coin_lockout_w(space.machine(), 1, !BIT(state->m_misc_flags, 1));
80   coin_lockout_w(machine(), 0, !BIT(m_misc_flags, 1));
81   coin_lockout_w(machine(), 1, !BIT(m_misc_flags, 1));
8482}
8583
8684
trunk/src/mame/drivers/othunder.c
r20972r20973
249249                INTERRUPTS
250250***********************************************************/
251251
252static void update_irq( running_machine &machine )
252void othunder_state::update_irq(  )
253253{
254   othunder_state *state = machine.driver_data<othunder_state>();
255   state->m_maincpu->set_input_line(6, state->m_ad_irq ? ASSERT_LINE : CLEAR_LINE);
256   state->m_maincpu->set_input_line(5, state->m_vblank_irq ? ASSERT_LINE : CLEAR_LINE);
254   m_maincpu->set_input_line(6, m_ad_irq ? ASSERT_LINE : CLEAR_LINE);
255   m_maincpu->set_input_line(5, m_vblank_irq ? ASSERT_LINE : CLEAR_LINE);
257256}
258257
259258WRITE16_MEMBER(othunder_state::irq_ack_w)
r20972r20973
269268         break;
270269   }
271270
272   update_irq(machine());
271   update_irq();
273272}
274273
275274INTERRUPT_GEN_MEMBER(othunder_state::vblank_interrupt)
276275{
277276   m_vblank_irq = 1;
278   update_irq(machine());
277   update_irq();
279278}
280279
281280TIMER_CALLBACK_MEMBER(othunder_state::ad_interrupt)
282281{
283282   m_ad_irq = 1;
284   update_irq(machine());
283   update_irq();
285284}
286285
287286
trunk/src/mame/machine/opwolf.c
r20972r20973
312312   m_current_cmd = 0;
313313}
314314
315static void updateDifficulty( running_machine &machine, int mode )
315void opwolf_state::updateDifficulty( int mode )
316316{
317   opwolf_state *state = machine.driver_data<opwolf_state>();
318317
319318   // The game is made up of 6 rounds, when you complete the
320319   // sixth you return to the start but with harder difficulty.
321320   if (mode == 0)
322321   {
323      switch (state->m_cchip_ram[0x15]&3) // Dipswitch B
322      switch (m_cchip_ram[0x15]&3) // Dipswitch B
324323      {
325324      case 3:
326         state->m_cchip_ram[0x2c] = 0x31;
327         state->m_cchip_ram[0x77] = 0x05;
328         state->m_cchip_ram[0x25] = 0x0f;
329         state->m_cchip_ram[0x26] = 0x0b;
325         m_cchip_ram[0x2c] = 0x31;
326         m_cchip_ram[0x77] = 0x05;
327         m_cchip_ram[0x25] = 0x0f;
328         m_cchip_ram[0x26] = 0x0b;
330329         break;
331330      case 0:
332         state->m_cchip_ram[0x2c] = 0x20;
333         state->m_cchip_ram[0x77] = 0x06;
334         state->m_cchip_ram[0x25] = 0x07;
335         state->m_cchip_ram[0x26] = 0x03;
331         m_cchip_ram[0x2c] = 0x20;
332         m_cchip_ram[0x77] = 0x06;
333         m_cchip_ram[0x25] = 0x07;
334         m_cchip_ram[0x26] = 0x03;
336335         break;
337336      case 1:
338         state->m_cchip_ram[0x2c] = 0x31;
339         state->m_cchip_ram[0x77] = 0x05;
340         state->m_cchip_ram[0x25] = 0x0f;
341         state->m_cchip_ram[0x26] = 0x0b;
337         m_cchip_ram[0x2c] = 0x31;
338         m_cchip_ram[0x77] = 0x05;
339         m_cchip_ram[0x25] = 0x0f;
340         m_cchip_ram[0x26] = 0x0b;
342341         break;
343342      case 2:
344         state->m_cchip_ram[0x2c] = 0x3c;
345         state->m_cchip_ram[0x77] = 0x04;
346         state->m_cchip_ram[0x25] = 0x13;
347         state->m_cchip_ram[0x26] = 0x0f;
343         m_cchip_ram[0x2c] = 0x3c;
344         m_cchip_ram[0x77] = 0x04;
345         m_cchip_ram[0x25] = 0x13;
346         m_cchip_ram[0x26] = 0x0f;
348347         break;
349348      }
350349   }
351350   else
352351   {
353      switch (state->m_cchip_ram[0x15]&3) // Dipswitch B
352      switch (m_cchip_ram[0x15]&3) // Dipswitch B
354353      {
355354      case 3:
356         state->m_cchip_ram[0x2c] = 0x46;
357         state->m_cchip_ram[0x77] = 0x05;
358         state->m_cchip_ram[0x25] = 0x11;
359         state->m_cchip_ram[0x26] = 0x0e;
355         m_cchip_ram[0x2c] = 0x46;
356         m_cchip_ram[0x77] = 0x05;
357         m_cchip_ram[0x25] = 0x11;
358         m_cchip_ram[0x26] = 0x0e;
360359         break;
361360      case 0:
362         state->m_cchip_ram[0x2c] = 0x30;
363         state->m_cchip_ram[0x77] = 0x06;
364         state->m_cchip_ram[0x25] = 0x0b;
365         state->m_cchip_ram[0x26] = 0x03;
361         m_cchip_ram[0x2c] = 0x30;
362         m_cchip_ram[0x77] = 0x06;
363         m_cchip_ram[0x25] = 0x0b;
364         m_cchip_ram[0x26] = 0x03;
366365         break;
367366      case 1:
368         state->m_cchip_ram[0x2c] = 0x3a;
369         state->m_cchip_ram[0x77] = 0x05;
370         state->m_cchip_ram[0x25] = 0x0f;
371         state->m_cchip_ram[0x26] = 0x09;
367         m_cchip_ram[0x2c] = 0x3a;
368         m_cchip_ram[0x77] = 0x05;
369         m_cchip_ram[0x25] = 0x0f;
370         m_cchip_ram[0x26] = 0x09;
372371         break;
373372      case 2:
374         state->m_cchip_ram[0x2c] = 0x4c;
375         state->m_cchip_ram[0x77] = 0x04;
376         state->m_cchip_ram[0x25] = 0x19;
377         state->m_cchip_ram[0x26] = 0x11;
373         m_cchip_ram[0x2c] = 0x4c;
374         m_cchip_ram[0x77] = 0x04;
375         m_cchip_ram[0x25] = 0x19;
376         m_cchip_ram[0x26] = 0x11;
378377         break;
379378      };
380379   }
r20972r20973
395394
396395   m_cchip_ram[0x3d] = 1;
397396   m_cchip_ram[0x7a] = 1;
398   updateDifficulty(machine(), 0);
397   updateDifficulty(0);
399398}
400399
401400WRITE16_MEMBER(opwolf_state::opwolf_cchip_bank_w)
r20972r20973
485484      // Dip switch B
486485      if (offset == 0x15)
487486      {
488         updateDifficulty(machine(), 0);
487         updateDifficulty(0);
489488      }
490489   }
491490}
r20972r20973
632631      if (m_cchip_ram[0x76] == 0)
633632      {
634633         m_cchip_ram[0x76] = 1;
635         updateDifficulty(machine(), 1);
634         updateDifficulty(1);
636635      }
637636   }
638637
639638   // These variables are cleared every frame during attract mode and the intro.
640639   if (m_cchip_ram[0x34] < 2)
641640   {
642      updateDifficulty(machine(), 0);
641      updateDifficulty(0);
643642      m_cchip_ram[0x76] = 0;
644643      m_cchip_ram[0x75] = 0;
645644      m_cchip_ram[0x74] = 0;
r20972r20973
708707 *
709708 *************************************/
710709
711void opwolf_cchip_init( running_machine &machine )
710void opwolf_state::opwolf_cchip_init(  )
712711{
713   opwolf_state *state = machine.driver_data<opwolf_state>();
714712
715   state->m_cchip_ram.allocate(0x400 * 8);
713   m_cchip_ram.allocate(0x400 * 8);
716714
717   state->save_item(NAME(state->m_current_bank));
718   state->save_item(NAME(state->m_current_cmd));
719   state->save_item(NAME(state->m_cchip_last_7a));
720   state->save_item(NAME(state->m_cchip_last_04));
721   state->save_item(NAME(state->m_cchip_last_05));
722   state->save_item(NAME(state->m_c588));
723   state->save_item(NAME(state->m_c589));
724   state->save_item(NAME(state->m_c58a));
725   state->save_item(NAME(state->m_cchip_coins));
726   state->save_item(NAME(state->m_cchip_coins_for_credit));
727   state->save_item(NAME(state->m_cchip_credits_for_coin));
715   save_item(NAME(m_current_bank));
716   save_item(NAME(m_current_cmd));
717   save_item(NAME(m_cchip_last_7a));
718   save_item(NAME(m_cchip_last_04));
719   save_item(NAME(m_cchip_last_05));
720   save_item(NAME(m_c588));
721   save_item(NAME(m_c589));
722   save_item(NAME(m_c58a));
723   save_item(NAME(m_cchip_coins));
724   save_item(NAME(m_cchip_coins_for_credit));
725   save_item(NAME(m_cchip_credits_for_coin));
728726
729   state->m_current_bank = 0;
730   state->m_current_cmd = 0;
731   state->m_cchip_last_7a = 0;
732   state->m_cchip_last_04 = 0xfc;
733   state->m_cchip_last_05 = 0xff;
734   state->m_c588 = 0;
735   state->m_c589 = 0;
736   state->m_c58a = 0;
737   state->m_cchip_coins[0] = 0;
738   state->m_cchip_coins[1] = 0;
739   state->m_cchip_coins_for_credit[0] = 1;
740   state->m_cchip_credits_for_coin[0] = 1;
741   state->m_cchip_coins_for_credit[1] = 1;
742   state->m_cchip_credits_for_coin[1] = 1;
727   m_current_bank = 0;
728   m_current_cmd = 0;
729   m_cchip_last_7a = 0;
730   m_cchip_last_04 = 0xfc;
731   m_cchip_last_05 = 0xff;
732   m_c588 = 0;
733   m_c589 = 0;
734   m_c58a = 0;
735   m_cchip_coins[0] = 0;
736   m_cchip_coins[1] = 0;
737   m_cchip_coins_for_credit[0] = 1;
738   m_cchip_credits_for_coin[0] = 1;
739   m_cchip_coins_for_credit[1] = 1;
740   m_cchip_credits_for_coin[1] = 1;
743741
744   machine.scheduler().timer_pulse(attotime::from_hz(60), timer_expired_delegate(FUNC(opwolf_state::cchip_timer),state));
742   machine().scheduler().timer_pulse(attotime::from_hz(60), timer_expired_delegate(FUNC(opwolf_state::cchip_timer),this));
745743}
trunk/src/mame/includes/orbit.h
r20972r20973
5353   DECLARE_WRITE8_MEMBER(orbit_note_amp_w);
5454   DECLARE_WRITE8_MEMBER(orbit_noise_amp_w);
5555   DECLARE_WRITE8_MEMBER(orbit_noise_rst_w);
56   void draw_sprites( bitmap_ind16 &bitmap, const rectangle &cliprect );
57   void update_misc_flags(address_space &space, UINT8 val);
5658};
5759/*----------- defined in audio/orbit.c -----------*/
5860
trunk/src/mame/includes/othldrby.h
r20972r20973
4343   virtual void video_start();
4444   UINT32 screen_update_othldrby(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect);
4545   void screen_eof_othldrby(screen_device &screen, bool state);
46   inline void get_tile_info( tile_data &tileinfo, int tile_index, int plane );
47   void draw_sprites( bitmap_ind16 &bitmap, const rectangle &cliprect, int priority );
4648};
trunk/src/mame/includes/ojankohs.h
r20972r20973
7272   DECLARE_MACHINE_START(common);
7373   UINT32 screen_update_ojankohs(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect);
7474   UINT32 screen_update_ojankoc(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect);
75   void ojankoc_flipscreen( address_space &space, int data );
7576};
7677
7778/*----------- defined in video/ojankohs.c -----------*/
trunk/src/mame/includes/opwolf.h
r20972r20973
7575   UINT32 screen_update_opwolf(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect);
7676   TIMER_CALLBACK_MEMBER(opwolf_timer_callback);
7777   TIMER_CALLBACK_MEMBER(cchip_timer);
78   void updateDifficulty( int mode );
79   void opwolf_cchip_init(  );
7880};
7981
8082/*----------- defined in machine/opwolf.c -----------*/
trunk/src/mame/includes/othunder.h
r20972r20973
6767   INTERRUPT_GEN_MEMBER(vblank_interrupt);
6868   TIMER_CALLBACK_MEMBER(ad_interrupt);
6969   void reset_sound_region();
70   void draw_sprites( bitmap_ind16 &bitmap, const rectangle &cliprect, const int *primasks, int y_offs );
71   void update_irq(  );
7072};
trunk/src/mame/includes/ohmygod.h
r20972r20973
3838   virtual void machine_reset();
3939   virtual void video_start();
4040   UINT32 screen_update_ohmygod(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect);
41   void draw_sprites( bitmap_ind16 &bitmap, const rectangle &cliprect );
4142};
trunk/src/mame/includes/oneshot.h
r20972r20973
5151   virtual void video_start();
5252   UINT32 screen_update_oneshot(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect);
5353   UINT32 screen_update_maddonna(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect);
54   void draw_crosshairs( bitmap_ind16 &bitmap, const rectangle &cliprect );
55   void draw_sprites( bitmap_ind16 &bitmap, const rectangle &cliprect );
5456};
trunk/src/mame/video/ojankohs.c
r20972r20973
181181
182182******************************************************************************/
183183
184void ojankoc_flipscreen( address_space &space, int data )
184void ojankohs_state::ojankoc_flipscreen( address_space &space, int data )
185185{
186   ojankohs_state *state = space.machine().driver_data<ojankohs_state>();
187186   int x, y;
188187   UINT8 color1, color2;
189188
190   state->m_flipscreen = BIT(data, 7);
189   m_flipscreen = BIT(data, 7);
191190
192   if (state->m_flipscreen == state->m_flipscreen_old)
191   if (m_flipscreen == m_flipscreen_old)
193192      return;
194193
195194   for (y = 0; y < 0x40; y++)
196195   {
197196      for (x = 0; x < 0x100; x++)
198197      {
199         color1 = state->m_videoram[0x0000 + ((y * 256) + x)];
200         color2 = state->m_videoram[0x3fff - ((y * 256) + x)];
201         state->ojankoc_videoram_w(space, 0x0000 + ((y * 256) + x), color2);
202         state->ojankoc_videoram_w(space, 0x3fff - ((y * 256) + x), color1);
198         color1 = m_videoram[0x0000 + ((y * 256) + x)];
199         color2 = m_videoram[0x3fff - ((y * 256) + x)];
200         ojankoc_videoram_w(space, 0x0000 + ((y * 256) + x), color2);
201         ojankoc_videoram_w(space, 0x3fff - ((y * 256) + x), color1);
203202
204         color1 = state->m_videoram[0x4000 + ((y * 256) + x)];
205         color2 = state->m_videoram[0x7fff - ((y * 256) + x)];
206         state->ojankoc_videoram_w(space, 0x4000 + ((y * 256) + x), color2);
207         state->ojankoc_videoram_w(space, 0x7fff - ((y * 256) + x), color1);
203         color1 = m_videoram[0x4000 + ((y * 256) + x)];
204         color2 = m_videoram[0x7fff - ((y * 256) + x)];
205         ojankoc_videoram_w(space, 0x4000 + ((y * 256) + x), color2);
206         ojankoc_videoram_w(space, 0x7fff - ((y * 256) + x), color1);
208207      }
209208   }
210209
211   state->m_flipscreen_old = state->m_flipscreen;
210   m_flipscreen_old = m_flipscreen;
212211}
213212
214213WRITE8_MEMBER(ojankohs_state::ojankoc_videoram_w)
trunk/src/mame/video/othunder.c
r20972r20973
6262********************************************************/
6363
6464
65static void draw_sprites( running_machine &machine, bitmap_ind16 &bitmap, const rectangle &cliprect, const int *primasks, int y_offs )
65void othunder_state::draw_sprites( bitmap_ind16 &bitmap, const rectangle &cliprect, const int *primasks, int y_offs )
6666{
67   othunder_state *state = machine.driver_data<othunder_state>();
68   UINT16 *spritemap = (UINT16 *)state->memregion("user1")->base();
69   UINT16 tile_mask = (machine.gfx[0]->elements()) - 1;
70   UINT16 *spriteram16 = state->m_spriteram;
67   UINT16 *spritemap = (UINT16 *)memregion("user1")->base();
68   UINT16 tile_mask = (machine().gfx[0]->elements()) - 1;
69   UINT16 *spriteram16 = m_spriteram;
7170   int offs, data, tilenum, color, flipx, flipy;
7271   int x, y, priority, curx, cury;
7372   int sprites_flipscreen = 0;
r20972r20973
7776
7877   /* pdrawgfx() needs us to draw sprites front to back, so we have to build a list
7978      while processing sprite ram and then draw them all at the end */
80   struct othunder_tempsprite *sprite_ptr = state->m_spritelist;
79   struct othunder_tempsprite *sprite_ptr = m_spritelist;
8180
82   for (offs = (state->m_spriteram.bytes() / 2) - 4; offs >= 0; offs -= 4)
81   for (offs = (m_spriteram.bytes() / 2) - 4; offs >= 0; offs -= 4)
8382   {
8483      data = spriteram16[offs + 0];
8584      zoomy = (data & 0xfe00) >> 9;
r20972r20973
166165         }
167166         else
168167         {
169            drawgfxzoom_transpen(bitmap,cliprect,machine.gfx[0],
168            drawgfxzoom_transpen(bitmap,cliprect,machine().gfx[0],
170169                  sprite_ptr->code,
171170                  sprite_ptr->color,
172171                  sprite_ptr->flipx,sprite_ptr->flipy,
r20972r20973
180179   }
181180
182181   /* this happens only if primsks != NULL */
183   while (sprite_ptr != state->m_spritelist)
182   while (sprite_ptr != m_spritelist)
184183   {
185184      sprite_ptr--;
186185
187      pdrawgfxzoom_transpen(bitmap,cliprect,machine.gfx[0],
186      pdrawgfxzoom_transpen(bitmap,cliprect,machine().gfx[0],
188187            sprite_ptr->code,
189188            sprite_ptr->color,
190189            sprite_ptr->flipx,sprite_ptr->flipy,
191190            sprite_ptr->x,sprite_ptr->y,
192191            sprite_ptr->zoomx,sprite_ptr->zoomy,
193            machine.priority_bitmap,sprite_ptr->primask,0);
192            machine().priority_bitmap,sprite_ptr->primask,0);
194193   }
195194}
196195
r20972r20973
221220   /* Sprites can be under/over the layer below text layer */
222221   {
223222      static const int primasks[2] = {0xf0, 0xfc};
224      draw_sprites(machine(), bitmap, cliprect, primasks, 3);
223      draw_sprites(bitmap, cliprect, primasks, 3);
225224   }
226225
227226   return 0;
trunk/src/mame/video/orbit.c
r20972r20973
3434}
3535
3636
37static void draw_sprites( running_machine &machine, bitmap_ind16 &bitmap, const rectangle &cliprect )
37void orbit_state::draw_sprites( bitmap_ind16 &bitmap, const rectangle &cliprect )
3838{
39   orbit_state *state = machine.driver_data<orbit_state>();
40   const UINT8* p = state->m_sprite_ram;
39   const UINT8* p = m_sprite_ram;
4140
4241   int i;
4342
r20972r20973
7069      hpos <<= 1;
7170      vpos <<= 1;
7271
73      drawgfxzoom_transpen(bitmap, cliprect, machine.gfx[layout], code, 0, flip_x, flip_y,
72      drawgfxzoom_transpen(bitmap, cliprect, machine().gfx[layout], code, 0, flip_x, flip_y,
7473         hpos, vpos, zoom_x, zoom_y, 0);
7574   }
7675}
r20972r20973
8281
8382   m_bg_tilemap->draw(bitmap, cliprect, 0, 0);
8483
85   draw_sprites(machine(), bitmap, cliprect);
84   draw_sprites(bitmap, cliprect);
8685   return 0;
8786}
trunk/src/mame/video/ohmygod.c
r20972r20973
7070
7171***************************************************************************/
7272
73static void draw_sprites( running_machine &machine, bitmap_ind16 &bitmap, const rectangle &cliprect )
73void ohmygod_state::draw_sprites( bitmap_ind16 &bitmap, const rectangle &cliprect )
7474{
75   ohmygod_state *state = machine.driver_data<ohmygod_state>();
76   UINT16 *spriteram = state->m_spriteram;
75   UINT16 *spriteram = m_spriteram;
7776   int offs;
7877
79   for (offs = 0; offs < state->m_spriteram.bytes() / 4; offs += 4)
78   for (offs = 0; offs < m_spriteram.bytes() / 4; offs += 4)
8079   {
8180      int sx, sy, code, color, flipx;
8281      UINT16 *sr;
8382
84      sr = state->m_spritebank ? (spriteram + state->m_spriteram.bytes() / 4) : spriteram;
83      sr = m_spritebank ? (spriteram + m_spriteram.bytes() / 4) : spriteram;
8584
8685      code = sr[offs + 3] & 0x0fff;
8786      color = sr[offs + 2] & 0x000f;
r20972r20973
9190         sy -= 65536;
9291      flipx = sr[offs + 3] & 0x8000;
9392
94      drawgfx_transpen(bitmap,cliprect,machine.gfx[1],
93      drawgfx_transpen(bitmap,cliprect,machine().gfx[1],
9594            code,
9695            color,
9796            flipx,0,
r20972r20973
102101UINT32 ohmygod_state::screen_update_ohmygod(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect)
103102{
104103   m_bg_tilemap->draw(bitmap, cliprect, 0, 0);
105   draw_sprites(machine(), bitmap, cliprect);
104   draw_sprites(bitmap, cliprect);
106105   return 0;
107106}
trunk/src/mame/video/oneshot.c
r20972r20973
5858   m_fg_tilemap->set_transparent_pen(0);
5959}
6060
61static void draw_crosshairs( running_machine &machine, bitmap_ind16 &bitmap, const rectangle &cliprect )
61void oneshot_state::draw_crosshairs( bitmap_ind16 &bitmap, const rectangle &cliprect )
6262{
63   oneshot_state *state = machine.driver_data<oneshot_state>();
6463   //int xpos,ypos;
6564
6665   /* get gun raw coordinates (player 1) */
67   state->m_gun_x_p1 = (state->ioport("LIGHT0_X")->read() & 0xff) * 320 / 256;
68   state->m_gun_y_p1 = (state->ioport("LIGHT0_Y")->read() & 0xff) * 240 / 256;
66   m_gun_x_p1 = (ioport("LIGHT0_X")->read() & 0xff) * 320 / 256;
67   m_gun_y_p1 = (ioport("LIGHT0_Y")->read() & 0xff) * 240 / 256;
6968
7069   /* compute the coordinates for drawing (from routine at 0x009ab0) */
71   //xpos = state->m_gun_x_p1;
72   //ypos = state->m_gun_y_p1;
70   //xpos = m_gun_x_p1;
71   //ypos = m_gun_y_p1;
7372
74   state->m_gun_x_p1 += state->m_gun_x_shift;
73   m_gun_x_p1 += m_gun_x_shift;
7574
76   state->m_gun_y_p1 -= 0x0a;
77   if (state->m_gun_y_p1 < 0)
78      state->m_gun_y_p1 = 0;
75   m_gun_y_p1 -= 0x0a;
76   if (m_gun_y_p1 < 0)
77      m_gun_y_p1 = 0;
7978
8079
8180   /* get gun raw coordinates (player 2) */
82   state->m_gun_x_p2 = (state->ioport("LIGHT1_X")->read() & 0xff) * 320 / 256;
83   state->m_gun_y_p2 = (state->ioport("LIGHT1_Y")->read() & 0xff) * 240 / 256;
81   m_gun_x_p2 = (ioport("LIGHT1_X")->read() & 0xff) * 320 / 256;
82   m_gun_y_p2 = (ioport("LIGHT1_Y")->read() & 0xff) * 240 / 256;
8483
8584   /* compute the coordinates for drawing (from routine at 0x009b6e) */
86   //xpos = state->m_gun_x_p2;
87   //ypos = state->m_gun_y_p2;
85   //xpos = m_gun_x_p2;
86   //ypos = m_gun_y_p2;
8887
89   state->m_gun_x_p2 += state->m_gun_x_shift - 0x0a;
90   if (state->m_gun_x_p2 < 0)
91      state->m_gun_x_p2 = 0;
88   m_gun_x_p2 += m_gun_x_shift - 0x0a;
89   if (m_gun_x_p2 < 0)
90      m_gun_x_p2 = 0;
9291}
9392
94static void draw_sprites( running_machine &machine, bitmap_ind16 &bitmap, const rectangle &cliprect )
93void oneshot_state::draw_sprites( bitmap_ind16 &bitmap, const rectangle &cliprect )
9594{
96   oneshot_state *state = machine.driver_data<oneshot_state>();
97   const UINT16 *source = state->m_sprites;
95   const UINT16 *source = m_sprites;
9896   const UINT16 *finish = source + (0x1000 / 2);
99   gfx_element *gfx = machine.gfx[1];
97   gfx_element *gfx = machine().gfx[1];
10098
10199   int xpos, ypos;
102100
r20972r20973
157155
158156   m_bg_tilemap->draw(bitmap, cliprect, 0, 0);
159157   m_mid_tilemap->draw(bitmap, cliprect, 0, 0);
160   draw_sprites(machine(), bitmap, cliprect);
158   draw_sprites(bitmap, cliprect);
161159   m_fg_tilemap->draw(bitmap, cliprect, 0, 0);
162   draw_crosshairs(machine(), bitmap, cliprect);
160   draw_crosshairs(bitmap, cliprect);
163161   return 0;
164162}
165163
r20972r20973
172170   m_mid_tilemap->draw(bitmap, cliprect, 0, 0);
173171   m_fg_tilemap->draw(bitmap, cliprect, 0, 0);
174172   m_bg_tilemap->draw(bitmap, cliprect, 0, 0);
175   draw_sprites(machine(), bitmap, cliprect);
173   draw_sprites(bitmap, cliprect);
176174
177175//  popmessage ("%04x %04x %04x %04x %04x %04x %04x %04x", m_scroll[0], m_scroll[1], m_scroll[2], m_scroll[3], m_scroll[4], m_scroll[5], m_scroll[6], m_scroll[7]);
178176   return 0;
trunk/src/mame/video/othldrby.c
r20972r20973
1313
1414***************************************************************************/
1515
16INLINE void get_tile_info( running_machine &machine, tile_data &tileinfo, int tile_index, int plane )
16inline void othldrby_state::get_tile_info( tile_data &tileinfo, int tile_index, int plane )
1717{
18   othldrby_state *state = machine.driver_data<othldrby_state>();
1918   UINT16 attr;
2019
2120   tile_index = 2 * tile_index + 0x800 * plane;
22   attr = state->m_vram[tile_index];
23   SET_TILE_INFO(
21   attr = m_vram[tile_index];
22   SET_TILE_INFO_MEMBER(
2423         1,
25         state->m_vram[tile_index + 1],
24         m_vram[tile_index + 1],
2625         attr & 0x7f,
2726         0);
2827   tileinfo.category = (attr & 0x0600) >> 9;
r20972r20973
3029
3130TILE_GET_INFO_MEMBER(othldrby_state::get_tile_info0)
3231{
33   get_tile_info(machine(), tileinfo, tile_index, 0);
32   get_tile_info(tileinfo, tile_index, 0);
3433}
3534
3635TILE_GET_INFO_MEMBER(othldrby_state::get_tile_info1)
3736{
38   get_tile_info(machine(), tileinfo, tile_index, 1);
37   get_tile_info(tileinfo, tile_index, 1);
3938}
4039
4140TILE_GET_INFO_MEMBER(othldrby_state::get_tile_info2)
4241{
43   get_tile_info(machine(), tileinfo, tile_index, 2);
42   get_tile_info(tileinfo, tile_index, 2);
4443}
4544
4645
r20972r20973
126125
127126***************************************************************************/
128127
129static void draw_sprites( running_machine &machine, bitmap_ind16 &bitmap, const rectangle &cliprect, int priority )
128void othldrby_state::draw_sprites( bitmap_ind16 &bitmap, const rectangle &cliprect, int priority )
130129{
131   othldrby_state *state = machine.driver_data<othldrby_state>();
132130   int offs;
133131
134132   for (offs = 0; offs < SPRITERAM_SIZE; offs += 4)
135133   {
136134      int x, y, color, code, sx, sy, flipx, flipy, sizex, sizey, pri;
137135
138      pri = (state->m_buf_spriteram[offs] & 0x0600) >> 9;
136      pri = (m_buf_spriteram[offs] & 0x0600) >> 9;
139137      if (pri != priority)
140138         continue;
141139
142      flipx = state->m_buf_spriteram[offs] & 0x1000;
140      flipx = m_buf_spriteram[offs] & 0x1000;
143141      flipy = 0;
144      color = (state->m_buf_spriteram[offs] & 0x01fc) >> 2;
145      code = state->m_buf_spriteram[offs + 1] | ((state->m_buf_spriteram[offs] & 0x0003) << 16);
146      sx = (state->m_buf_spriteram[offs + 2] >> 7);
147      sy = (state->m_buf_spriteram[offs + 3] >> 7);
148      sizex = (state->m_buf_spriteram[offs + 2] & 0x000f) + 1;
149      sizey = (state->m_buf_spriteram[offs + 3] & 0x000f) + 1;
142      color = (m_buf_spriteram[offs] & 0x01fc) >> 2;
143      code = m_buf_spriteram[offs + 1] | ((m_buf_spriteram[offs] & 0x0003) << 16);
144      sx = (m_buf_spriteram[offs + 2] >> 7);
145      sy = (m_buf_spriteram[offs + 3] >> 7);
146      sizex = (m_buf_spriteram[offs + 2] & 0x000f) + 1;
147      sizey = (m_buf_spriteram[offs + 3] & 0x000f) + 1;
150148
151      if (state->flip_screen())
149      if (flip_screen())
152150      {
153151         flipx = !flipx;
154152         flipy = !flipy;
r20972r20973
160158      {
161159         for (x = 0; x < sizex; x++)
162160         {
163            drawgfx_transpen(bitmap,cliprect,machine.gfx[0],
161            drawgfx_transpen(bitmap,cliprect,machine().gfx[0],
164162                  code + x + sizex * y,
165163                  color,
166164                  flipx,flipy,
167                  (sx + (flipx ? (-8*(x+1)+1) : 8*x) - state->m_vreg[6]+44) & 0x1ff,(sy + (flipy ? (-8*(y+1)+1) : 8*y) - state->m_vreg[7]-9) & 0x1ff,0);
165                  (sx + (flipx ? (-8*(x+1)+1) : 8*x) - m_vreg[6]+44) & 0x1ff,(sy + (flipy ? (-8*(y+1)+1) : 8*y) - m_vreg[7]-9) & 0x1ff,0);
168166         }
169167      }
170168   }
r20972r20973
196194
197195   for (layer = 0; layer < 3; layer++)
198196      m_bg_tilemap[layer]->draw(bitmap, cliprect, 0, 0);
199   draw_sprites(machine(), bitmap, cliprect, 0);
197   draw_sprites(bitmap, cliprect, 0);
200198
201199   for (layer = 0; layer < 3; layer++)
202200      m_bg_tilemap[layer]->draw(bitmap, cliprect, 1, 0);
203   draw_sprites(machine(), bitmap, cliprect, 1);
201   draw_sprites(bitmap, cliprect, 1);
204202
205203   for (layer = 0; layer < 3; layer++)
206204      m_bg_tilemap[layer]->draw(bitmap, cliprect, 2, 0);
207   draw_sprites(machine(), bitmap, cliprect, 2);
205   draw_sprites(bitmap, cliprect, 2);
208206
209207   for (layer = 0; layer < 3; layer++)
210208      m_bg_tilemap[layer]->draw(bitmap, cliprect, 3, 0);
211   draw_sprites(machine(), bitmap, cliprect, 3);
209   draw_sprites(bitmap, cliprect, 3);
212210
213211   return 0;
214212}

Previous 199869 Revisions Next


© 1997-2024 The MAME Team