Previous 199869 Revisions Next

r20976 Tuesday 12th February, 2013 at 10:43:35 UTC by Miodrag Milanović
Modernization of drivers part 17 (no whatsnew)
[src/mame/drivers]raiden.c raiden2.c rainbow.c
[src/mame/includes]raiden.h raiden2.h rainbow.h rallyx.h rampart.h realbrk.h redalert.h renegade.h retofinv.h rocnrope.h rohga.h route16.h rpunch.h
[src/mame/machine]rainbow.c
[src/mame/video]quizdna.c raiden.c rallyx.c rampart.c realbrk.c redalert.c renegade.c retofinv.c rocnrope.c rohga.c route16.c rpunch.c

trunk/src/mame/drivers/raiden.c
r20975r20976
573573/* This is based on code by Niclas Karlsson Mate, who figured out the
574574encryption method! The technique is a combination of a XOR table plus
575575bit-swapping */
576static void common_decrypt(running_machine &machine)
576void raiden_state::common_decrypt()
577577{
578   UINT16 *RAM = (UINT16 *)machine.root_device().memregion("maincpu")->base();
578   UINT16 *RAM = (UINT16 *)machine().root_device().memregion("maincpu")->base();
579579   int i;
580580
581581   for (i = 0; i < 0x20000; i++)
r20975r20976
587587      RAM[0xc0000/2 + i] = data;
588588   }
589589
590   RAM = (UINT16 *)machine.root_device().memregion("sub")->base();
590   RAM = (UINT16 *)machine().root_device().memregion("sub")->base();
591591
592592   for (i = 0; i < 0x20000; i++)
593593   {
r20975r20976
612612DRIVER_INIT_MEMBER(raiden_state,raiden)
613613{
614614   DRIVER_INIT_CALL(raidena);
615   common_decrypt(machine());
615   common_decrypt();
616616   seibu_sound_decrypt(machine(),"audiocpu",0x20000);
617617}
618618
619619DRIVER_INIT_MEMBER(raiden_state,raidenk)
620620{
621621   DRIVER_INIT_CALL(raidena);
622   common_decrypt(machine());
622   common_decrypt();
623623}
624624
625625DRIVER_INIT_MEMBER(raiden_state,raidenu)
trunk/src/mame/drivers/rainbow.c
r20975r20976
856856
857857   machine().root_device().membank("bank1")->configure_entries(0, 4, &ROM[0xc000], 0x4000);
858858
859   rbisland_cchip_init(machine(), 0);
859   rbisland_cchip_init(0);
860860}
861861
862862DRIVER_INIT_MEMBER(rbisland_state,rbislande)
r20975r20976
865865
866866   machine().root_device().membank("bank1")->configure_entries(0, 4, &ROM[0xc000], 0x4000);
867867
868   rbisland_cchip_init(machine(), 1);
868   rbisland_cchip_init(1);
869869}
870870
871871DRIVER_INIT_MEMBER(rbisland_state,jumping)
trunk/src/mame/drivers/raiden2.c
r20975r20976
141141#include "sound/okim6295.h"
142142#include "includes/raiden2.h"
143143
144static UINT16 rps(running_machine &machine)
144UINT16 raiden2_state::rps()
145145{
146   return machine.device("maincpu")->state().state_int(NEC_CS);
146   return machine().device("maincpu")->state().state_int(NEC_CS);
147147}
148148
149static UINT16 rpc(running_machine &machine)
149UINT16 raiden2_state::rpc()
150150{
151   return machine.device("maincpu")->state().state_int(NEC_IP);
151   return machine().device("maincpu")->state().state_int(NEC_IP);
152152}
153153
154154WRITE16_MEMBER(raiden2_state::cop_pgm_data_w)
r20975r20976
300300}
301301
302302/* RE from Seibu Cup Soccer bootleg */
303static const UINT8 fade_table(int v)
303const UINT8 raiden2_state::fade_table(int v)
304304{
305305   int low  = v & 0x001f;
306306   int high = v & 0x03e0;
r20975r20976
691691      break;
692692
693693   default:
694      logerror("pcall %04x (%04x:%04x) [%x %x %x %x]\n", data, rps(space.machine()), rpc(space.machine()), cop_regs[0], cop_regs[1], cop_regs[2], cop_regs[3]);
694      logerror("pcall %04x (%04x:%04x) [%x %x %x %x]\n", data, rps(), rpc(), cop_regs[0], cop_regs[1], cop_regs[2], cop_regs[3]);
695695   }
696696}
697697
r20975r20976
700700//      space.machine().root_device().membank("bank1")->set_entry((data >> 15) & 1);
701701
702702
703static void combine32(UINT32 *val, int offset, UINT16 data, UINT16 mem_mask)
703void raiden2_state::combine32(UINT32 *val, int offset, UINT16 data, UINT16 mem_mask)
704704{
705705   UINT16 *dest = (UINT16 *)val + BYTE_XOR_LE(offset);
706706   COMBINE_DATA(dest);
r20975r20976
10551055static UINT32 sprcpt_val[2], sprcpt_flags1;
10561056static UINT32 sprcpt_data_1[0x100], sprcpt_data_2[0x40], sprcpt_data_3[6], sprcpt_data_4[4];
10571057
1058static void sprcpt_init(void)
1058void raiden2_state::sprcpt_init(void)
10591059{
10601060   memset(sprcpt_data_1, 0, sizeof(sprcpt_data_1));
10611061   memset(sprcpt_data_2, 0, sizeof(sprcpt_data_2));
trunk/src/mame/machine/rainbow.c
r20975r20976
642642   0x042C60, 0x042D38
643643};
644644
645static void request_round_data( running_machine &machine )
645void rbisland_state::request_round_data(  )
646646{
647   rbisland_state *state = machine.driver_data<rbisland_state>();
648   int round = state->m_CRAM[1][0x141]; /* 0...49 */
647   int round = m_CRAM[1][0x141]; /* 0...49 */
649648
650   memcpy(state->m_CRAM[1], CROM_BANK1, sizeof CROM_BANK1);
651   memcpy(state->m_CRAM[2], CROM_BANK2, sizeof CROM_BANK2);
649   memcpy(m_CRAM[1], CROM_BANK1, sizeof CROM_BANK1);
650   memcpy(m_CRAM[2], CROM_BANK2, sizeof CROM_BANK2);
652651
653   state->m_CRAM[1][1] = cchip_round_height[round] >> 0;
654   state->m_CRAM[1][2] = cchip_round_height[round] >> 8;
652   m_CRAM[1][1] = cchip_round_height[round] >> 0;
653   m_CRAM[1][2] = cchip_round_height[round] >> 8;
655654
656   state->m_CRAM[1][0x142] = cchip_round_address[round] >> 24;
657   state->m_CRAM[1][0x143] = cchip_round_address[round] >> 16;
658   state->m_CRAM[1][0x144] = cchip_round_address[round] >> 8;
659   state->m_CRAM[1][0x145] = cchip_round_address[round] >> 0;
655   m_CRAM[1][0x142] = cchip_round_address[round] >> 24;
656   m_CRAM[1][0x143] = cchip_round_address[round] >> 16;
657   m_CRAM[1][0x144] = cchip_round_address[round] >> 8;
658   m_CRAM[1][0x145] = cchip_round_address[round] >> 0;
660659
661660   /* set the secret room or boss flag */
662661
663   state->m_CRAM[1][0x148] = (round >= 40 || round % 4 == 3);
662   m_CRAM[1][0x148] = (round >= 40 || round % 4 == 3);
664663}
665664
666static void request_world_data( running_machine &machine )
665void rbisland_state::request_world_data(  )
667666{
668   rbisland_state *state = machine.driver_data<rbisland_state>();
669   int world = state->m_CRAM[0][0x00d] / 4; /* 0...9 */
667   int world = m_CRAM[0][0x00d] / 4; /* 0...9 */
670668
671669   /* the extra version has the world data swapped around */
672670
673   if (state->m_extra_version)
671   if (m_extra_version)
674672   {
675673      static const UINT8 world_swap[] =
676674      {
r20975r20976
682680
683681   /* first two bytes in each bank are left unchanged  */
684682
685   memcpy(state->m_CRAM[4] + 2, CROM_BANK4[world].data, CROM_BANK4[world].size);
686   memcpy(state->m_CRAM[5] + 2, CROM_BANK5[world].data, CROM_BANK5[world].size);
687   memcpy(state->m_CRAM[7] + 2, CROM_BANK7[world].data, CROM_BANK7[world].size);
683   memcpy(m_CRAM[4] + 2, CROM_BANK4[world].data, CROM_BANK4[world].size);
684   memcpy(m_CRAM[5] + 2, CROM_BANK5[world].data, CROM_BANK5[world].size);
685   memcpy(m_CRAM[7] + 2, CROM_BANK7[world].data, CROM_BANK7[world].size);
688686
689687   /* banks 5 and 6 are different in the extra version */
690688
691   if (state->m_extra_version)
689   if (m_extra_version)
692690   {
693691      int i;
694692
r20975r20976
698696
699697         if (patch != 0)
700698         {
701            state->m_CRAM[5][state->m_CRAM[5][2] + 22 * i + 18] = patch >> 0;
702            state->m_CRAM[5][state->m_CRAM[5][2] + 22 * i + 19] = patch >> 8;
699            m_CRAM[5][m_CRAM[5][2] + 22 * i + 18] = patch >> 0;
700            m_CRAM[5][m_CRAM[5][2] + 22 * i + 19] = patch >> 8;
703701         }
704702      }
705703
706      memcpy(state->m_CRAM[6] + 2, CROM_BANK6_EXTRA, sizeof CROM_BANK6_EXTRA);
704      memcpy(m_CRAM[6] + 2, CROM_BANK6_EXTRA, sizeof CROM_BANK6_EXTRA);
707705   }
708706   else
709707   {
710      memcpy(state->m_CRAM[6] + 2, CROM_BANK6, sizeof CROM_BANK6);
708      memcpy(m_CRAM[6] + 2, CROM_BANK6, sizeof CROM_BANK6);
711709   }
712710}
713711
714static void request_goalin_data( running_machine &machine )
712void rbisland_state::request_goalin_data(  )
715713{
716   rbisland_state *state = machine.driver_data<rbisland_state>();
717   int n = machine.rand() % 15;
714   int n = machine().rand() % 15;
718715
719   state->m_CRAM[1][0x14B] = 0x00; /* x coordinates */
720   state->m_CRAM[1][0x14D] = 0x10;
721   state->m_CRAM[1][0x14F] = 0x20;
722   state->m_CRAM[1][0x151] = 0x38;
723   state->m_CRAM[1][0x153] = 0x50;
724   state->m_CRAM[1][0x155] = 0x60;
716   m_CRAM[1][0x14B] = 0x00; /* x coordinates */
717   m_CRAM[1][0x14D] = 0x10;
718   m_CRAM[1][0x14F] = 0x20;
719   m_CRAM[1][0x151] = 0x38;
720   m_CRAM[1][0x153] = 0x50;
721   m_CRAM[1][0x155] = 0x60;
725722
726   state->m_CRAM[1][0x14A] = cchip_goalin[n][0]; /* y coordinates */
727   state->m_CRAM[1][0x14C] = cchip_goalin[n][1];
728   state->m_CRAM[1][0x14E] = cchip_goalin[n][2];
729   state->m_CRAM[1][0x150] = cchip_goalin[n][3];
730   state->m_CRAM[1][0x152] = cchip_goalin[n][4];
731   state->m_CRAM[1][0x154] = cchip_goalin[n][5];
723   m_CRAM[1][0x14A] = cchip_goalin[n][0]; /* y coordinates */
724   m_CRAM[1][0x14C] = cchip_goalin[n][1];
725   m_CRAM[1][0x14E] = cchip_goalin[n][2];
726   m_CRAM[1][0x150] = cchip_goalin[n][3];
727   m_CRAM[1][0x152] = cchip_goalin[n][4];
728   m_CRAM[1][0x154] = cchip_goalin[n][5];
732729}
733730
734731TIMER_CALLBACK_MEMBER(rbisland_state::cchip_timer)
735732{
736733   if (m_CRAM[1][0x100] == 1)
737734   {
738      request_round_data(machine());
735      request_round_data();
739736
740737      m_CRAM[1][0x100] = 0xFF;
741738   }
742739
743740   if (m_CRAM[5][0x000] == 1)
744741   {
745      request_world_data(machine());
742      request_world_data();
746743
747744      m_CRAM[5][0x000] = 0xFF;
748745   }
749746
750747   if (m_CRAM[1][0x149] == 1)
751748   {
752      request_goalin_data(machine());
749      request_goalin_data();
753750
754751      m_CRAM[1][0x149] = 0xFF;
755752   }
r20975r20976
812809 *
813810 *************************************/
814811
815void rbisland_cchip_init( running_machine &machine, int version )
812void rbisland_state::rbisland_cchip_init( int version )
816813{
817   rbisland_state *state = machine.driver_data<rbisland_state>();
818814   int i;
819815
820   state->m_extra_version = version;
816   m_extra_version = version;
821817
822818   for (i = 0; i < 8; i++)
823819   {
824      state->m_CRAM[i] = auto_alloc_array(machine, UINT8, 0x400);
820      m_CRAM[i] = auto_alloc_array(machine(), UINT8, 0x400);
825821
826      state_save_register_item_pointer(machine, "cchip", NULL, i, state->m_CRAM[i], 0x400);
822      state_save_register_item_pointer(machine(), "cchip", NULL, i, m_CRAM[i], 0x400);
827823   }
828824
829   state_save_register_item(machine, "cchip", NULL, 0, state->m_current_bank);
825   state_save_register_item(machine(), "cchip", NULL, 0, m_current_bank);
830826
831   machine.scheduler().timer_pulse(attotime::from_hz(60), timer_expired_delegate(FUNC(rbisland_state::cchip_timer),state));
827   machine().scheduler().timer_pulse(attotime::from_hz(60), timer_expired_delegate(FUNC(rbisland_state::cchip_timer),this));
832828}
trunk/src/mame/video/route16.c
r20975r20976
4040 *
4141 *************************************/
4242
43static pen_t route16_make_pen(UINT8 color)
43pen_t route16_state::route16_make_pen(UINT8 color)
4444{
4545   return MAKE_RGB(pal1bit((color >> 0) & 0x01),
4646               pal1bit((color >> 1) & 0x01),
r20975r20976
4949}
5050
5151
52static pen_t ttmajng_make_pen(UINT8 color)
52pen_t route16_state::ttmajng_make_pen(UINT8 color)
5353{
5454   return MAKE_RGB(pal1bit((color >> 2) & 0x01),
5555               pal1bit((color >> 1) & 0x01),
r20975r20976
122122 *  The Stratovox video connections have been verified from the schematics
123123 */
124124
125static int video_update_stratvox_ttmahjng(running_machine &machine, bitmap_rgb32 &bitmap,
125int route16_state::video_update_stratvox_ttmahjng(bitmap_rgb32 &bitmap,
126126                                 const rectangle &cliprect,
127                                 pen_t (*make_pen)(UINT8))
127                                 pen_t (route16_state::*make_pen)(UINT8))
128128{
129   route16_state *state = machine.driver_data<route16_state>();
130129   offs_t offs;
131130
132   UINT8 *color_prom1 = &state->memregion("proms")->base()[0x000];
133   UINT8 *color_prom2 = &state->memregion("proms")->base()[0x100];
131   UINT8 *color_prom1 = &memregion("proms")->base()[0x000];
132   UINT8 *color_prom2 = &memregion("proms")->base()[0x100];
134133
135   for (offs = 0; offs < state->m_videoram1.bytes(); offs++)
134   for (offs = 0; offs < m_videoram1.bytes(); offs++)
136135   {
137136      int i;
138137
139138      UINT8 y = offs >> 6;
140139      UINT8 x = offs << 2;
141140
142      UINT8 data1 = state->m_videoram1[offs];
143      UINT8 data2 = state->m_videoram2[offs];
141      UINT8 data1 = m_videoram1[offs];
142      UINT8 data2 = m_videoram2[offs];
144143
145144      for (i = 0; i < 4; i++)
146145      {
147         UINT8 color1 = color_prom1[(state->m_palette_1 << 2) |
146         UINT8 color1 = color_prom1[(m_palette_1 << 2) |
148147                              ((data1 >> 3) & 0x02) |
149148                              ((data1 >> 0) & 0x01)];
150149
151150         /* bit 7 of the 2nd color is the OR of the 1st color bits 0 and 1 (verified) */
152151         UINT8 color2 = color_prom2[(((data1 << 3) & 0x80) | ((data1 << 7) & 0x80)) |
153                              (state->m_palette_2 << 2) |
152                              (m_palette_2 << 2) |
154153                              ((data2 >> 3) & 0x02) |
155154                              ((data2 >> 0) & 0x01)];
156155
157156         /* the final color is the OR of the two colors */
158157         UINT8 final_color = color1 | color2;
159158
160         pen_t pen = make_pen(final_color);
159         pen_t pen = (this->*make_pen)(final_color);
161160
162         if (state->m_flipscreen)
161         if (m_flipscreen)
163162            bitmap.pix32(255 - y, 255 - x) = pen;
164163         else
165164            bitmap.pix32(y, x) = pen;
r20975r20976
176175
177176UINT32 route16_state::screen_update_stratvox(screen_device &screen, bitmap_rgb32 &bitmap, const rectangle &cliprect)
178177{
179   return video_update_stratvox_ttmahjng(machine(), bitmap, cliprect, route16_make_pen);
178   return video_update_stratvox_ttmahjng(bitmap, cliprect, &route16_state::route16_make_pen);
180179}
181180
182181
183182UINT32 route16_state::screen_update_ttmahjng(screen_device &screen, bitmap_rgb32 &bitmap, const rectangle &cliprect)
184183{
185   return video_update_stratvox_ttmahjng(machine(), bitmap, cliprect, ttmajng_make_pen);
184   return video_update_stratvox_ttmahjng(bitmap, cliprect, &route16_state::ttmajng_make_pen);
186185}
trunk/src/mame/video/renegade.c
r20975r20976
7272   state_save_register_global(machine(), m_scrollx);
7373}
7474
75static void draw_sprites(running_machine &machine, bitmap_ind16 &bitmap, const rectangle &cliprect)
75void renegade_state::draw_sprites(bitmap_ind16 &bitmap, const rectangle &cliprect)
7676{
77   renegade_state *state = machine.driver_data<renegade_state>();
78   UINT8 *source = state->m_spriteram;
77   UINT8 *source = m_spriteram;
7978   UINT8 *finish = source + 96 * 4;
8079
8180   while (source < finish)
r20975r20976
9493         if (sx > 248)
9594            sx -= 256;
9695
97         if (state->flip_screen())
96         if (flip_screen())
9897         {
9998            sx = 240 - sx;
10099            sy = 240 - sy;
r20975r20976
104103         if (attributes & 0x80) /* big sprite */
105104         {
106105            sprite_number &= ~1;
107            drawgfx_transpen(bitmap, cliprect, machine.gfx[sprite_bank],
106            drawgfx_transpen(bitmap, cliprect, machine().gfx[sprite_bank],
108107               sprite_number + 1,
109108               color,
110               xflip, state->flip_screen(),
111               sx, sy + (state->flip_screen() ? -16 : 16), 0);
109               xflip, flip_screen(),
110               sx, sy + (flip_screen() ? -16 : 16), 0);
112111         }
113112         else
114113         {
115            sy += (state->flip_screen() ? -16 : 16);
114            sy += (flip_screen() ? -16 : 16);
116115         }
117         drawgfx_transpen(bitmap, cliprect, machine.gfx[sprite_bank],
116         drawgfx_transpen(bitmap, cliprect, machine().gfx[sprite_bank],
118117            sprite_number,
119118            color,
120            xflip, state->flip_screen(),
119            xflip, flip_screen(),
121120            sx, sy, 0);
122121      }
123122      source += 4;
r20975r20976
128127{
129128   m_bg_tilemap->set_scrollx(0, m_scrollx);
130129   m_bg_tilemap->draw(bitmap, cliprect, 0 , 0);
131   draw_sprites(machine(), bitmap, cliprect);
130   draw_sprites(bitmap, cliprect);
132131   m_fg_tilemap->draw(bitmap, cliprect, 0 , 0);
133132   return 0;
134133}
trunk/src/mame/video/retofinv.c
r20975r20976
164164
165165***************************************************************************/
166166
167static void draw_sprites(running_machine &machine, bitmap_ind16 &bitmap)
167void retofinv_state::draw_sprites(bitmap_ind16 &bitmap)
168168{
169   retofinv_state *state = machine.driver_data<retofinv_state>();
170   UINT8 *spriteram = state->m_sharedram + 0x0780;
171   UINT8 *spriteram_2 = state->m_sharedram + 0x0f80;
172   UINT8 *spriteram_3 = state->m_sharedram + 0x1780;
169   UINT8 *spriteram = m_sharedram + 0x0780;
170   UINT8 *spriteram_2 = m_sharedram + 0x0f80;
171   UINT8 *spriteram_3 = m_sharedram + 0x1780;
173172   int offs;
174173   const rectangle spritevisiblearea(2*8, 34*8-1, 0*8, 28*8-1);
175174
r20975r20976
194193      sprite &= ~sizex;
195194      sprite &= ~(sizey << 1);
196195
197      if (state->flip_screen())
196      if (flip_screen())
198197      {
199198         flipx ^= 1;
200199         flipy ^= 1;
r20975r20976
207206      {
208207         for (x = 0;x <= sizex;x++)
209208         {
210            drawgfx_transmask(bitmap,spritevisiblearea,machine.gfx[1],
209            drawgfx_transmask(bitmap,spritevisiblearea,machine().gfx[1],
211210               sprite + gfx_offs[y ^ (sizey * flipy)][x ^ (sizex * flipx)],
212211               color,
213212               flipx,flipy,
214213               sx + 16*x,sy + 16*y,
215               colortable_get_transpen_mask(machine.colortable, machine.gfx[1], color, 0xff));
214               colortable_get_transpen_mask(machine().colortable, machine().gfx[1], color, 0xff));
216215         }
217216      }
218217   }
r20975r20976
223222UINT32 retofinv_state::screen_update_retofinv(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect)
224223{
225224   m_bg_tilemap->draw(bitmap, cliprect, 0,0);
226   draw_sprites(machine(), bitmap);
225   draw_sprites(bitmap);
227226   m_fg_tilemap->draw(bitmap, cliprect, 0,0);
228227   return 0;
229228}
trunk/src/mame/video/quizdna.c
r20975r20976
132132
133133void quizdna_state::draw_sprites(bitmap_ind16 &bitmap, const rectangle &cliprect)
134134{
135//OBRISI.ME
136135   UINT8 *spriteram = m_spriteram;
137136   int offs;
138137
trunk/src/mame/video/rpunch.c
r20975r20976
191191 *
192192 *************************************/
193193
194static void draw_sprites(running_machine &machine, bitmap_ind16 &bitmap, const rectangle &cliprect, int start, int stop)
194void rpunch_state::draw_sprites(bitmap_ind16 &bitmap, const rectangle &cliprect, int start, int stop)
195195{
196   rpunch_state *state = machine.driver_data<rpunch_state>();
197   UINT16 *spriteram16 = state->m_spriteram;
196   UINT16 *spriteram16 = m_spriteram;
198197   int offs;
199198
200199   start *= 4;
r20975r20976
212211      int y = 513 - (data0 & 0x1ff);
213212      int xflip = data1 & 0x1000;
214213      int yflip = data1 & 0x0800;
215      int color = ((data1 >> 13) & 7) | ((state->m_videoflags & 0x0040) >> 3);
214      int color = ((data1 >> 13) & 7) | ((m_videoflags & 0x0040) >> 3);
216215
217216      if (x >= BITMAP_WIDTH) x -= 512;
218217      if (y >= BITMAP_HEIGHT) y -= 512;
219218
220      drawgfx_transpen(bitmap, cliprect, machine.gfx[2],
221            code, color + (state->m_sprite_palette / 16), xflip, yflip, x, y, 15);
219      drawgfx_transpen(bitmap, cliprect, machine().gfx[2],
220            code, color + (m_sprite_palette / 16), xflip, yflip, x, y, 15);
222221   }
223222}
224223
r20975r20976
229228 *
230229 *************************************/
231230
232static void draw_bitmap(running_machine &machine, bitmap_ind16 &bitmap, const rectangle &cliprect)
231void rpunch_state::draw_bitmap(bitmap_ind16 &bitmap, const rectangle &cliprect)
233232{
234   rpunch_state *state = machine.driver_data<rpunch_state>();
235233   int colourbase;
236234   int xxx=512/4;
237235   int yyy=256;
238236   int x,y,count;
239237
240   colourbase = 512 + ((state->m_videoflags & 15) * 16);
238   colourbase = 512 + ((m_videoflags & 15) * 16);
241239
242240   count = 0;
243241
r20975r20976
246244      for(x=0;x<xxx;x++)
247245      {
248246         int coldat;
249         coldat = (state->m_bitmapram[count]>>12)&0xf; if (coldat!=15) bitmap.pix16(y, ((x*4+0)-4)&0x1ff) = coldat+colourbase;
250         coldat = (state->m_bitmapram[count]>>8 )&0xf; if (coldat!=15) bitmap.pix16(y, ((x*4+1)-4)&0x1ff) = coldat+colourbase;
251         coldat = (state->m_bitmapram[count]>>4 )&0xf; if (coldat!=15) bitmap.pix16(y, ((x*4+2)-4)&0x1ff) = coldat+colourbase;
252         coldat = (state->m_bitmapram[count]>>0 )&0xf; if (coldat!=15) bitmap.pix16(y, ((x*4+3)-4)&0x1ff) = coldat+colourbase;
247         coldat = (m_bitmapram[count]>>12)&0xf; if (coldat!=15) bitmap.pix16(y, ((x*4+0)-4)&0x1ff) = coldat+colourbase;
248         coldat = (m_bitmapram[count]>>8 )&0xf; if (coldat!=15) bitmap.pix16(y, ((x*4+1)-4)&0x1ff) = coldat+colourbase;
249         coldat = (m_bitmapram[count]>>4 )&0xf; if (coldat!=15) bitmap.pix16(y, ((x*4+2)-4)&0x1ff) = coldat+colourbase;
250         coldat = (m_bitmapram[count]>>0 )&0xf; if (coldat!=15) bitmap.pix16(y, ((x*4+3)-4)&0x1ff) = coldat+colourbase;
253251         count++;
254252      }
255253   }
r20975r20976
270268   effbins = (m_bins > m_gins) ? m_gins : m_bins;
271269
272270   m_background[0]->draw(bitmap, cliprect, 0,0);
273   draw_sprites(machine(), bitmap, cliprect, 0, effbins);
271   draw_sprites(bitmap, cliprect, 0, effbins);
274272   m_background[1]->draw(bitmap, cliprect, 0,0);
275   draw_sprites(machine(), bitmap, cliprect, effbins, m_gins);
273   draw_sprites(bitmap, cliprect, effbins, m_gins);
276274   if (m_bitmapram)
277      draw_bitmap(machine(), bitmap, cliprect);
275      draw_bitmap(bitmap, cliprect);
278276   return 0;
279277}
trunk/src/mame/video/rampart.c
r20975r20976
99#include "video/atarimo.h"
1010#include "includes/rampart.h"
1111
12
13static void rampart_bitmap_render(running_machine &machine, bitmap_ind16 &bitmap, const rectangle &cliprect);
14
1512/*************************************
1613 *
1714 *  Video system start
r20975r20976
7976   int x, y, r;
8077
8178   /* draw the playfield */
82   rampart_bitmap_render(machine(), bitmap, cliprect);
79   rampart_bitmap_render(bitmap, cliprect);
8380
8481   /* draw and merge the MO */
8582   mobitmap = atarimo_render(0, cliprect, &rectlist);
r20975r20976
109106 *
110107 *************************************/
111108
112static void rampart_bitmap_render(running_machine &machine, bitmap_ind16 &bitmap, const rectangle &cliprect)
109void rampart_state::rampart_bitmap_render(bitmap_ind16 &bitmap, const rectangle &cliprect)
113110{
114   rampart_state *state = machine.driver_data<rampart_state>();
115111   int x, y;
116112
117113   /* update any dirty scanlines */
118114   for (y = cliprect.min_y; y <= cliprect.max_y; y++)
119115   {
120      const UINT16 *src = &state->m_bitmap[256 * y];
116      const UINT16 *src = &m_bitmap[256 * y];
121117      UINT16 *dst = &bitmap.pix16(y);
122118
123119      /* regenerate the line */
trunk/src/mame/video/rocnrope.c
r20975r20976
119119   m_bg_tilemap = &machine().tilemap().create(tilemap_get_info_delegate(FUNC(rocnrope_state::get_bg_tile_info),this), TILEMAP_SCAN_ROWS, 8, 8, 32, 32);
120120}
121121
122static void draw_sprites(running_machine &machine, bitmap_ind16 &bitmap, const rectangle &cliprect )
122void rocnrope_state::draw_sprites(bitmap_ind16 &bitmap, const rectangle &cliprect )
123123{
124   rocnrope_state *state = machine.driver_data<rocnrope_state>();
125   UINT8 *spriteram = state->m_spriteram;
126   UINT8 *spriteram_2 = state->m_spriteram2;
124   UINT8 *spriteram = m_spriteram;
125   UINT8 *spriteram_2 = m_spriteram2;
127126   int offs;
128127
129   for (offs = state->m_spriteram.bytes() - 2;offs >= 0;offs -= 2)
128   for (offs = m_spriteram.bytes() - 2;offs >= 0;offs -= 2)
130129   {
131130      int color = spriteram_2[offs] & 0x0f;
132131
133      drawgfx_transmask(bitmap, cliprect, machine.gfx[0],
132      drawgfx_transmask(bitmap, cliprect, machine().gfx[0],
134133            spriteram[offs + 1],
135134            color,
136135            spriteram_2[offs] & 0x40,~spriteram_2[offs] & 0x80,
137136            240 - spriteram[offs], spriteram_2[offs + 1],
138            colortable_get_transpen_mask(machine.colortable, machine.gfx[0], color, 0));
137            colortable_get_transpen_mask(machine().colortable, machine().gfx[0], color, 0));
139138   }
140139}
141140
142141UINT32 rocnrope_state::screen_update_rocnrope(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect)
143142{
144143   m_bg_tilemap->draw(bitmap, cliprect, 0, 0);
145   draw_sprites(machine(), bitmap, cliprect);
144   draw_sprites(bitmap, cliprect);
146145   return 0;
147146}
trunk/src/mame/video/redalert.c
r20975r20976
3636 *
3737 *************************************/
3838
39static void get_pens(running_machine &machine, pen_t *pens)
39void redalert_state::get_pens(pen_t *pens)
4040{
4141   static const int resistances_bitmap[]     = { 100 };
4242   static const int resistances_charmap_rg[] = { 390, 220, 180 };
r20975r20976
5151   double charmap_b_weights[2];
5252   double back_r_weight[1];
5353   double back_gb_weight[1];
54   const UINT8 *prom = machine.root_device().memregion("proms")->base();
54   const UINT8 *prom = machine().root_device().memregion("proms")->base();
5555
5656   scaler = compute_resistor_weights(0, 0xff, -1,
5757                              1, resistances_bitmap,     bitmap_weight,      470, 0,
r20975r20976
101101
102102/* this uses the same color hook-up between bitmap and chars. */
103103/* TODO: clean me up */
104static void get_panther_pens(running_machine &machine, pen_t *pens)
104void redalert_state::get_panther_pens(pen_t *pens)
105105{
106106   static const int resistances_bitmap[]     = { 100 };
107107   static const int resistances_charmap_rg[] = { 390, 220, 180 };
r20975r20976
116116   double charmap_b_weights[2];
117117   double back_r_weight[1];
118118   double back_gb_weight[1];
119   const UINT8 *prom = machine.root_device().memregion("proms")->base();
119   const UINT8 *prom = machine().root_device().memregion("proms")->base();
120120
121121   scaler = compute_resistor_weights(0, 0xff, -1,
122122                              1, resistances_bitmap,     bitmap_weight,      470, 0,
r20975r20976
188188   pen_t pens[NUM_CHARMAP_PENS + NUM_BITMAP_PENS + 1];
189189   offs_t offs;
190190
191   get_pens(machine(), pens);
191   get_pens(pens);
192192
193193   for (offs = 0; offs < 0x2000; offs++)
194194   {
r20975r20976
260260   pen_t pens[NUM_CHARMAP_PENS + NUM_BITMAP_PENS + 1];
261261   offs_t offs;
262262
263   get_pens(machine(), pens);
263   get_pens(pens);
264264
265265   for (offs = 0; offs < 0x2000; offs++)
266266   {
r20975r20976
334334   pen_t pens[NUM_CHARMAP_PENS + NUM_BITMAP_PENS + 1];
335335   offs_t offs;
336336
337   get_panther_pens(machine(), pens);
337   get_panther_pens(pens);
338338
339339   for (offs = 0; offs < 0x2000; offs++)
340340   {
trunk/src/mame/video/rohga.c
r20975r20976
119119}
120120
121121// not amazingly efficient, called multiple times to pull a layer out of the sprite bitmaps, but keeps correct sprite<->sprite priorities
122static void mixwizdfirelayer(running_machine &machine, bitmap_rgb32 &bitmap, const rectangle &cliprect, int gfxregion, UINT16 pri, UINT16 primask)
122void rohga_state::mixwizdfirelayer(bitmap_rgb32 &bitmap, const rectangle &cliprect, int gfxregion, UINT16 pri, UINT16 primask)
123123{
124124   int y, x;
125   const pen_t *paldata = machine.pens;
125   const pen_t *paldata = machine().pens;
126126   bitmap_ind16* sprite_bitmap;
127127   int penbase;
128128
129   sprite_bitmap = &machine.device<decospr_device>("spritegen2")->get_sprite_temp_bitmap();
129   sprite_bitmap = &machine().device<decospr_device>("spritegen2")->get_sprite_temp_bitmap();
130130   penbase = 0x600;
131131
132132   UINT16* srcline;
r20975r20976
194194
195195   m_sprgen1->inefficient_copy_sprite_bitmap(bitmap, cliprect, 0x0000, 0x0400, 0x400, 0x1ff); // 0x000 and 0x200 of 0x600
196196
197   mixwizdfirelayer(machine(), bitmap, cliprect, 4, 0x000, 0x000);
197   mixwizdfirelayer(bitmap, cliprect, 4, 0x000, 0x000);
198198
199199   deco16ic_tilemap_1_draw(m_deco_tilegen1, bitmap, cliprect, 0, 0);
200200   return 0;
trunk/src/mame/video/raiden.c
r20975r20976
109109   }
110110}
111111
112static void draw_sprites(running_machine &machine, bitmap_ind16 &bitmap,const rectangle &cliprect,int pri_mask)
112void raiden_state::draw_sprites(bitmap_ind16 &bitmap,const rectangle &cliprect,int pri_mask)
113113{
114   raiden_state *state = machine.driver_data<raiden_state>();
115   UINT16 *buffered_spriteram16 = state->m_spriteram->buffer();
114   UINT16 *buffered_spriteram16 = m_spriteram->buffer();
116115   int offs,fx,fy,x,y,color,sprite;
117116
118117   for (offs = 0x1000/2-4;offs >= 0;offs -= 4)
r20975r20976
130129      x = buffered_spriteram16[offs+2] & 0xff;
131130      if (buffered_spriteram16[offs+2] & 0x100) x=0-(0x100-x);
132131
133      if (state->m_flipscreen) {
132      if (m_flipscreen) {
134133         x=240-x;
135134         y=240-y;
136135         if (fx) fx=0; else fx=1;
137136         if (fy) fy=0; else fy=1;
138137      }
139138
140      drawgfx_transpen(bitmap,cliprect,machine.gfx[3],
139      drawgfx_transpen(bitmap,cliprect,machine().gfx[3],
141140            sprite,
142141            color,fx,fy,x,y,15);
143142   }
r20975r20976
162161   m_bg_layer->draw(bitmap, cliprect, 0,0);
163162
164163   /* Draw sprites underneath foreground */
165   draw_sprites(machine(),bitmap,cliprect,0x40);
164   draw_sprites(bitmap,cliprect,0x40);
166165   m_fg_layer->draw(bitmap, cliprect, 0,0);
167166
168167   /* Rest of sprites */
169   draw_sprites(machine(),bitmap,cliprect,0x80);
168   draw_sprites(bitmap,cliprect,0x80);
170169
171170   /* Text layer */
172171   m_tx_layer->draw(bitmap, cliprect, 0,0);
trunk/src/mame/video/rallyx.c
r20975r20976
222222}
223223
224224
225INLINE void rallyx_get_tile_info( running_machine &machine, tile_data &tileinfo, int tile_index, int ram_offs)
225inline void rallyx_state::rallyx_get_tile_info( tile_data &tileinfo, int tile_index, int ram_offs)
226226{
227   rallyx_state *state = machine.driver_data<rallyx_state>();
228   UINT8 attr = state->m_videoram[ram_offs + tile_index + 0x800];
227   UINT8 attr = m_videoram[ram_offs + tile_index + 0x800];
229228   tileinfo.category = (attr & 0x20) >> 5;
230   SET_TILE_INFO(
229   SET_TILE_INFO_MEMBER(
231230         0,
232         state->m_videoram[ram_offs + tile_index],
231         m_videoram[ram_offs + tile_index],
233232         attr & 0x3f,
234233         TILE_FLIPYX(attr >> 6) ^ TILE_FLIPX);
235234}
236235
237236TILE_GET_INFO_MEMBER(rallyx_state::rallyx_bg_get_tile_info)
238237{
239   rallyx_get_tile_info(machine(), tileinfo, tile_index, 0x400);
238   rallyx_get_tile_info(tileinfo, tile_index, 0x400);
240239}
241240
242241TILE_GET_INFO_MEMBER(rallyx_state::rallyx_fg_get_tile_info)
243242{
244   rallyx_get_tile_info(machine(), tileinfo, tile_index, 0x000);
243   rallyx_get_tile_info(tileinfo, tile_index, 0x000);
245244}
246245
247246
248INLINE void locomotn_get_tile_info(running_machine &machine,tile_data &tileinfo,int tile_index,int ram_offs)
247inline void rallyx_state::locomotn_get_tile_info(tile_data &tileinfo,int tile_index,int ram_offs)
249248{
250   rallyx_state *state = machine.driver_data<rallyx_state>();
251   UINT8 attr = state->m_videoram[ram_offs + tile_index + 0x800];
252   int code = state->m_videoram[ram_offs + tile_index];
249   UINT8 attr = m_videoram[ram_offs + tile_index + 0x800];
250   int code = m_videoram[ram_offs + tile_index];
253251   code = (code & 0x7f) + 2 * (attr & 0x40) + 2 * (code & 0x80);
254252   tileinfo.category = (attr & 0x20) >> 5;
255   SET_TILE_INFO(
253   SET_TILE_INFO_MEMBER(
256254         0,
257255         code,
258256         attr & 0x3f,
r20975r20976
261259
262260TILE_GET_INFO_MEMBER(rallyx_state::locomotn_bg_get_tile_info)
263261{
264   locomotn_get_tile_info(machine(), tileinfo, tile_index, 0x400);
262   locomotn_get_tile_info(tileinfo, tile_index, 0x400);
265263}
266264
267265TILE_GET_INFO_MEMBER(rallyx_state::locomotn_fg_get_tile_info)
268266{
269   locomotn_get_tile_info(machine(), tileinfo, tile_index, 0x000);
267   locomotn_get_tile_info(tileinfo, tile_index, 0x000);
270268}
271269
272270
r20975r20976
277275
278276***************************************************************************/
279277
280static void calculate_star_field( running_machine &machine )
278void rallyx_state::calculate_star_field(  )
281279{
282   rallyx_state *state = machine.driver_data<rallyx_state>();
283280   int generator;
284281   int x, y;
285282
286283   /* precalculate the star background */
287   state->m_total_stars = 0;
284   m_total_stars = 0;
288285   generator = 0;
289286
290287   for (y = 0; y < 256; y++)
r20975r20976
304301         {
305302            int color = (~(generator >> 8)) & 0x3f;
306303
307            if (color && state->m_total_stars < JUNGLER_MAX_STARS)
304            if (color && m_total_stars < JUNGLER_MAX_STARS)
308305            {
309               state->m_stars[state->m_total_stars].x = x;
310               state->m_stars[state->m_total_stars].y = y;
311               state->m_stars[state->m_total_stars].color = color;
306               m_stars[m_total_stars].x = x;
307               m_stars[m_total_stars].y = y;
308               m_stars[m_total_stars].color = color;
312309
313               state->m_total_stars++;
310               m_total_stars++;
314311            }
315312         }
316313      }
317314   }
318315}
319316
320static void rallyx_video_start_common( running_machine &machine )
317void rallyx_state::rallyx_video_start_common(  )
321318{
322   rallyx_state *state = machine.driver_data<rallyx_state>();
323319   int i;
324320
325   state->m_spriteram = state->m_videoram + 0x00;
326   state->m_spriteram2 = state->m_spriteram + 0x800;
327   state->m_radarx = state->m_videoram + 0x20;
328   state->m_radary = state->m_radarx + 0x800;
321   m_spriteram = m_videoram + 0x00;
322   m_spriteram2 = m_spriteram + 0x800;
323   m_radarx = m_videoram + 0x20;
324   m_radary = m_radarx + 0x800;
329325
330326   for (i = 0; i < 16; i++)
331      machine.shadow_table[i] = i + 16;
327      machine().shadow_table[i] = i + 16;
332328
333329   for (i = 16; i < 32; i++)
334      machine.shadow_table[i] = i;
330      machine().shadow_table[i] = i;
335331
336332   for (i = 0; i < 3; i++)
337      state->m_drawmode_table[i] = DRAWMODE_SHADOW;
333      m_drawmode_table[i] = DRAWMODE_SHADOW;
338334
339   state->m_drawmode_table[3] = DRAWMODE_NONE;
335   m_drawmode_table[3] = DRAWMODE_NONE;
340336}
341337
342338VIDEO_START_MEMBER(rallyx_state,rallyx)
r20975r20976
349345
350346   m_spriteram_base = 0x14;
351347
352   rallyx_video_start_common(machine());
348   rallyx_video_start_common();
353349}
354350
355351
r20975r20976
360356
361357   m_spriteram_base = 0x14;
362358
363   rallyx_video_start_common(machine());
364   calculate_star_field(machine());
359   rallyx_video_start_common();
360   calculate_star_field();
365361}
366362
367363
r20975r20976
379375
380376   m_spriteram_base = 0x14;
381377
382   rallyx_video_start_common(machine());
383   calculate_star_field(machine());
378   rallyx_video_start_common();
379   calculate_star_field();
384380}
385381
386382
r20975r20976
399395   /* commsega has more sprites and bullets than the other games */
400396   m_spriteram_base = 0x00;
401397
402   rallyx_video_start_common(machine());
403   calculate_star_field(machine());
398   rallyx_video_start_common();
399   calculate_star_field();
404400}
405401
406402
r20975r20976
435431}
436432
437433
438static void plot_star( running_machine &machine, bitmap_ind16 &bitmap, const rectangle &cliprect, int x, int y, int color )
434void rallyx_state::plot_star( bitmap_ind16 &bitmap, const rectangle &cliprect, int x, int y, int color )
439435{
440436   if (!cliprect.contains(x, y))
441437      return;
442438
443   rallyx_state *state = machine.driver_data<rallyx_state>();
444   if (state->flip_screen_x())
439   if (flip_screen_x())
445440      x = 255 - x;
446441
447   if (state->flip_screen_y())
442   if (flip_screen_y())
448443      y = 255 - y;
449444
450   if (colortable_entry_get_value(machine.colortable, bitmap.pix16(y, x) % 0x144) == 0)
445   if (colortable_entry_get_value(machine().colortable, bitmap.pix16(y, x) % 0x144) == 0)
451446      bitmap.pix16(y, x) = STARS_COLOR_BASE + color;
452447}
453448
454static void draw_stars( running_machine &machine, bitmap_ind16 &bitmap, const rectangle &cliprect )
449void rallyx_state::draw_stars( bitmap_ind16 &bitmap, const rectangle &cliprect )
455450{
456   rallyx_state *state = machine.driver_data<rallyx_state>();
457451   int offs;
458452
459   for (offs = 0; offs < state->m_total_stars; offs++)
453   for (offs = 0; offs < m_total_stars; offs++)
460454   {
461      int x = state->m_stars[offs].x;
462      int y = state->m_stars[offs].y;
455      int x = m_stars[offs].x;
456      int y = m_stars[offs].y;
463457
464458      if ((y & 0x01) ^ ((x >> 3) & 0x01))
465         plot_star(machine, bitmap, cliprect, x, y, state->m_stars[offs].color);
459         plot_star(bitmap, cliprect, x, y, m_stars[offs].color);
466460   }
467461}
468462
469463
470static void rallyx_draw_sprites( running_machine &machine, bitmap_ind16 &bitmap, const rectangle &cliprect, int displacement )
464void rallyx_state::rallyx_draw_sprites( bitmap_ind16 &bitmap, const rectangle &cliprect, int displacement )
471465{
472   rallyx_state *state = machine.driver_data<rallyx_state>();
473   UINT8 *spriteram = state->m_spriteram;
474   UINT8 *spriteram_2 = state->m_spriteram2;
466   UINT8 *spriteram = m_spriteram;
467   UINT8 *spriteram_2 = m_spriteram2;
475468   int offs;
476469
477   for (offs = 0x20 - 2; offs >= state->m_spriteram_base; offs -= 2)
470   for (offs = 0x20 - 2; offs >= m_spriteram_base; offs -= 2)
478471   {
479472      int sx = spriteram[offs + 1] + ((spriteram_2[offs + 1] & 0x80) << 1) - displacement;
480473      int sy = 241 - spriteram_2[offs] - displacement;
481474      int color = spriteram_2[offs + 1] & 0x3f;
482475      int flipx = spriteram[offs] & 1;
483476      int flipy = spriteram[offs] & 2;
484      if (state->flip_screen())
477      if (flip_screen())
485478         sx -= 2 * displacement;
486479
487      pdrawgfx_transmask(bitmap,cliprect,machine.gfx[1],
480      pdrawgfx_transmask(bitmap,cliprect,machine().gfx[1],
488481            (spriteram[offs] & 0xfc) >> 2,
489482            color,
490483            flipx,flipy,
491484            sx,sy,
492            machine.priority_bitmap,0x02,
493            colortable_get_transpen_mask(machine.colortable, machine.gfx[1], color, 0));
485            machine().priority_bitmap,0x02,
486            colortable_get_transpen_mask(machine().colortable, machine().gfx[1], color, 0));
494487   }
495488}
496489
497static void locomotn_draw_sprites( running_machine &machine, bitmap_ind16 &bitmap, const rectangle &cliprect, int displacement )
490void rallyx_state::locomotn_draw_sprites( bitmap_ind16 &bitmap, const rectangle &cliprect, int displacement )
498491{
499   rallyx_state *state = machine.driver_data<rallyx_state>();
500   UINT8 *spriteram = state->m_spriteram;
501   UINT8 *spriteram_2 = state->m_spriteram2;
492   UINT8 *spriteram = m_spriteram;
493   UINT8 *spriteram_2 = m_spriteram2;
502494   int offs;
503495
504   for (offs = 0x20 - 2; offs >= state->m_spriteram_base; offs -= 2)
496   for (offs = 0x20 - 2; offs >= m_spriteram_base; offs -= 2)
505497   {
506498      int sx = spriteram[offs + 1] + ((spriteram_2[offs + 1] & 0x80) << 1);
507499      int sy = 241 - spriteram_2[offs] - displacement;
508500      int color = spriteram_2[offs + 1] & 0x3f;
509501      int flip = spriteram[offs] & 2;
510502
511      pdrawgfx_transmask(bitmap,cliprect,machine.gfx[1],
503      pdrawgfx_transmask(bitmap,cliprect,machine().gfx[1],
512504            ((spriteram[offs] & 0x7c) >> 2) + 0x20*(spriteram[offs] & 0x01) + ((spriteram[offs] & 0x80) >> 1),
513505            color,
514506            flip,flip,
515507            sx,sy,
516            machine.priority_bitmap,0x02,
517            colortable_get_transpen_mask(machine.colortable, machine.gfx[1], color, 0));
508            machine().priority_bitmap,0x02,
509            colortable_get_transpen_mask(machine().colortable, machine().gfx[1], color, 0));
518510   }
519511}
520512
521static void rallyx_draw_bullets( running_machine &machine, bitmap_ind16 &bitmap, const rectangle &cliprect, int transpen )
513void rallyx_state::rallyx_draw_bullets( bitmap_ind16 &bitmap, const rectangle &cliprect, int transpen )
522514{
523   rallyx_state *state = machine.driver_data<rallyx_state>();
524515   int offs;
525516
526   for (offs = state->m_spriteram_base; offs < 0x20; offs++)
517   for (offs = m_spriteram_base; offs < 0x20; offs++)
527518   {
528519      int x, y;
529520
530      x = state->m_radarx[offs] + ((~state->m_radarattr[offs & 0x0f] & 0x01) << 8);
531      y = 253 - state->m_radary[offs];
532      if (state->flip_screen())
521      x = m_radarx[offs] + ((~m_radarattr[offs & 0x0f] & 0x01) << 8);
522      y = 253 - m_radary[offs];
523      if (flip_screen())
533524         x -= 3;
534525
535526      if (transpen)
536         drawgfx_transpen(bitmap,cliprect,machine.gfx[2],
537               ((state->m_radarattr[offs & 0x0f] & 0x0e) >> 1) ^ 0x07,
527         drawgfx_transpen(bitmap,cliprect,machine().gfx[2],
528               ((m_radarattr[offs & 0x0f] & 0x0e) >> 1) ^ 0x07,
538529               0,
539530               0,0,
540531               x,y,
541532               3);
542533      else
543         drawgfx_transtable(bitmap,cliprect,machine.gfx[2],
544               ((state->m_radarattr[offs & 0x0f] & 0x0e) >> 1) ^ 0x07,
534         drawgfx_transtable(bitmap,cliprect,machine().gfx[2],
535               ((m_radarattr[offs & 0x0f] & 0x0e) >> 1) ^ 0x07,
545536               0,
546537               0,0,
547538               x,y,
548               state->m_drawmode_table,machine.shadow_table);
539               m_drawmode_table,machine().shadow_table);
549540   }
550541}
551542
552static void jungler_draw_bullets( running_machine &machine, bitmap_ind16 &bitmap, const rectangle &cliprect, int transpen )
543void rallyx_state::jungler_draw_bullets( bitmap_ind16 &bitmap, const rectangle &cliprect, int transpen )
553544{
554   rallyx_state *state = machine.driver_data<rallyx_state>();
555545   int offs;
556546
557   for (offs = state->m_spriteram_base; offs < 0x20; offs++)
547   for (offs = m_spriteram_base; offs < 0x20; offs++)
558548   {
559549      int x, y;
560550
561      x = state->m_radarx[offs] + ((~state->m_radarattr[offs & 0x0f] & 0x08) << 5);
562      y = 253 - state->m_radary[offs];
551      x = m_radarx[offs] + ((~m_radarattr[offs & 0x0f] & 0x08) << 5);
552      y = 253 - m_radary[offs];
563553
564554      if (transpen)
565         drawgfx_transpen(bitmap,cliprect,machine.gfx[2],
566               (state->m_radarattr[offs & 0x0f] & 0x07) ^ 0x07,
555         drawgfx_transpen(bitmap,cliprect,machine().gfx[2],
556               (m_radarattr[offs & 0x0f] & 0x07) ^ 0x07,
567557               0,
568558               0,0,
569559               x,y,
570560               3);
571561      else
572         drawgfx_transtable(bitmap,cliprect,machine.gfx[2],
573               (state->m_radarattr[offs & 0x0f] & 0x07) ^ 0x07,
562         drawgfx_transtable(bitmap,cliprect,machine().gfx[2],
563               (m_radarattr[offs & 0x0f] & 0x07) ^ 0x07,
574564               0,
575565               0,0,
576566               x,y,
577               state->m_drawmode_table,machine.shadow_table);
567               m_drawmode_table,machine().shadow_table);
578568   }
579569}
580570
581static void locomotn_draw_bullets( running_machine &machine, bitmap_ind16 &bitmap, const rectangle &cliprect, int transpen )
571void rallyx_state::locomotn_draw_bullets( bitmap_ind16 &bitmap, const rectangle &cliprect, int transpen )
582572{
583   rallyx_state *state = machine.driver_data<rallyx_state>();
584573   int offs;
585574
586   for (offs = state->m_spriteram_base; offs < 0x20; offs++)
575   for (offs = m_spriteram_base; offs < 0x20; offs++)
587576   {
588577      int x, y;
589578
r20975r20976
595584         so 8024-8033 and 8824-8833 are not used
596585      */
597586
598      x = state->m_radarx[offs] + ((~state->m_radarattr[offs & 0x0f] & 0x08) << 5);
599      y = 252 - state->m_radary[offs];
587      x = m_radarx[offs] + ((~m_radarattr[offs & 0x0f] & 0x08) << 5);
588      y = 252 - m_radary[offs];
600589
601590      if (transpen)
602         drawgfx_transpen(bitmap,cliprect,machine.gfx[2],
603               (state->m_radarattr[offs & 0x0f] & 0x07) ^ 0x07,
591         drawgfx_transpen(bitmap,cliprect,machine().gfx[2],
592               (m_radarattr[offs & 0x0f] & 0x07) ^ 0x07,
604593               0,
605594               0,0,
606595               x,y,
607596               3);
608597      else
609         drawgfx_transtable(bitmap,cliprect,machine.gfx[2],
610               (state->m_radarattr[offs & 0x0f] & 0x07) ^ 0x07,
598         drawgfx_transtable(bitmap,cliprect,machine().gfx[2],
599               (m_radarattr[offs & 0x0f] & 0x07) ^ 0x07,
611600               0,
612601               0,0,
613602               x,y,
614               state->m_drawmode_table,machine.shadow_table);
603               m_drawmode_table,machine().shadow_table);
615604   }
616605}
617606
r20975r20976
641630   m_bg_tilemap->draw(bitmap, bg_clip, 1, 1);
642631   m_fg_tilemap->draw(bitmap, fg_clip, 1, 1);
643632
644   rallyx_draw_bullets(machine(), bitmap, cliprect, TRUE);
645   rallyx_draw_sprites(machine(), bitmap, cliprect, 1);
646   rallyx_draw_bullets(machine(), bitmap, cliprect, FALSE);
633   rallyx_draw_bullets(bitmap, cliprect, TRUE);
634   rallyx_draw_sprites(bitmap, cliprect, 1);
635   rallyx_draw_bullets(bitmap, cliprect, FALSE);
647636
648637   return 0;
649638}
r20975r20976
675664   m_bg_tilemap->draw(bitmap, bg_clip, 1, 0);
676665   m_fg_tilemap->draw(bitmap, fg_clip, 1, 0);
677666
678   jungler_draw_bullets(machine(), bitmap, cliprect, TRUE);
679   rallyx_draw_sprites(machine(), bitmap, cliprect, 0);
680   jungler_draw_bullets(machine(), bitmap, cliprect, FALSE);
667   jungler_draw_bullets(bitmap, cliprect, TRUE);
668   rallyx_draw_sprites(bitmap, cliprect, 0);
669   jungler_draw_bullets(bitmap, cliprect, FALSE);
681670
682671   if (m_stars_enable)
683      draw_stars(machine(), bitmap, cliprect);
672      draw_stars(bitmap, cliprect);
684673
685674   return 0;
686675}
r20975r20976
720709   m_bg_tilemap->draw(bitmap, bg_clip, 1, 1);
721710   m_fg_tilemap->draw(bitmap, fg_clip, 1, 1);
722711
723   locomotn_draw_bullets(machine(), bitmap, cliprect, TRUE);
724   locomotn_draw_sprites(machine(), bitmap, cliprect, 0);
725   locomotn_draw_bullets(machine(), bitmap, cliprect, FALSE);
712   locomotn_draw_bullets(bitmap, cliprect, TRUE);
713   locomotn_draw_sprites(bitmap, cliprect, 0);
714   locomotn_draw_bullets(bitmap, cliprect, FALSE);
726715
727716   if (m_stars_enable)
728      draw_stars(machine(), bitmap, cliprect);
717      draw_stars(bitmap, cliprect);
729718
730719   return 0;
731720}
trunk/src/mame/video/realbrk.c
r20975r20976
204204
205205***************************************************************************/
206206
207static void draw_sprites(running_machine &machine, bitmap_ind16 &bitmap,const rectangle &cliprect)
207void realbrk_state::draw_sprites(bitmap_ind16 &bitmap,const rectangle &cliprect)
208208{
209   realbrk_state *state = machine.driver_data<realbrk_state>();
210   UINT16 *spriteram16 = state->m_spriteram;
209   UINT16 *spriteram16 = m_spriteram;
211210   int offs;
212211
213   int max_x = machine.primary_screen->width();
214   int max_y = machine.primary_screen->height();
212   int max_x = machine().primary_screen->width();
213   int max_y = machine().primary_screen->height();
215214
216215   rectangle spritetile_clip(0, 31, 0, 31);
217216
r20975r20976
252251      xdim    =       ((zoom & 0x00ff) >> 0) << (16-6+4);
253252      ydim    =       ((zoom & 0xff00) >> 8) << (16-6+4);
254253
255      if (state->flip_screen_x()) {   flipx = !flipx;     sx = (max_x << 16) - sx - xnum * xdim;  }
256      if (state->flip_screen_y()) {   flipy = !flipy;     sy = (max_y << 16) - sy - ynum * ydim;  }
254      if (flip_screen_x()) {   flipx = !flipx;     sx = (max_x << 16) - sx - xnum * xdim;  }
255      if (flip_screen_y()) {   flipy = !flipy;     sy = (max_y << 16) - sy - ynum * ydim;  }
257256
258257      if (flipx)  { xstart = xnum-1;  xend = -1;    xinc = -1; }
259258      else        { xstart = 0;       xend = xnum;  xinc = +1; }
r20975r20976
287286            // buffer the tile and rotate it into bitmap
288287            if( rot )
289288            {
290               state->m_tmpbitmap0->fill(0, spritetile_clip );
291               state->m_tmpbitmap1->fill(0, spritetile_clip );
292               drawgfxzoom_transpen(   *state->m_tmpbitmap0,spritetile_clip,machine.gfx[gfx],
289               m_tmpbitmap0->fill(0, spritetile_clip );
290               m_tmpbitmap1->fill(0, spritetile_clip );
291               drawgfxzoom_transpen(   *m_tmpbitmap0,spritetile_clip,machine().gfx[gfx],
293292                           code++,
294293                           color,
295294                           flipx, flipy,
r20975r20976
297296                           (rot & 1 ? scaley : scalex) << 12, (rot & 1 ? scalex : scaley) << 12,0);
298297
299298               // peek at the unrotated sprite
300               // copybitmap_trans( bitmap,*state->m_tmpbitmap0, 0,0, 50+(x * xdim/0x10000),50+(y * ydim/0x10000), cliprect, 0 );
299               // copybitmap_trans( bitmap,*m_tmpbitmap0, 0,0, 50+(x * xdim/0x10000),50+(y * ydim/0x10000), cliprect, 0 );
301300            }
302301
303302            switch( rot )
304303            {
305304               case 0x10: // rot 90
306                  copyrozbitmap_trans( *state->m_tmpbitmap1, state->m_tmpbitmap1->cliprect(), *state->m_tmpbitmap0,
305                  copyrozbitmap_trans( *m_tmpbitmap1, m_tmpbitmap1->cliprect(), *m_tmpbitmap0,
307306                     (UINT32)0<<16,
308307                     (UINT32)16<<16,
309308                     0 << 16,
r20975r20976
315314                     currx = (sx - (y+1) * ydim) / 0x10000;
316315                     curry = (sy + x * xdim) / 0x10000;
317316
318                     copybitmap_trans( bitmap,*state->m_tmpbitmap1, 0,0, currx,curry, cliprect, 0 );
317                     copybitmap_trans( bitmap,*m_tmpbitmap1, 0,0, currx,curry, cliprect, 0 );
319318                  break;
320319
321320               case 0x20: // rot 180
322                  copyrozbitmap_trans( *state->m_tmpbitmap1, state->m_tmpbitmap1->cliprect(), *state->m_tmpbitmap0,
321                  copyrozbitmap_trans( *m_tmpbitmap1, m_tmpbitmap1->cliprect(), *m_tmpbitmap0,
323322                     (UINT32)16<<16,
324323                     (UINT32)16<<16,
325324                     -1 << 16,
r20975r20976
331330                     currx = (sx - (x+1) * xdim) / 0x10000;
332331                     curry = (sy - (y+1) * ydim) / 0x10000;
333332
334                     copybitmap_trans( bitmap,*state->m_tmpbitmap1, 0,0, currx,curry, cliprect, 0 );
333                     copybitmap_trans( bitmap,*m_tmpbitmap1, 0,0, currx,curry, cliprect, 0 );
335334                  break;
336335
337336               case 0x30: // rot 270
338                  copyrozbitmap_trans( *state->m_tmpbitmap1, state->m_tmpbitmap1->cliprect(), *state->m_tmpbitmap0,
337                  copyrozbitmap_trans( *m_tmpbitmap1, m_tmpbitmap1->cliprect(), *m_tmpbitmap0,
339338                     (UINT32)16<<16,
340339                     (UINT32)0<<16,
341340                     0 << 16,
r20975r20976
347346                     currx = (sx + y * ydim) / 0x10000;
348347                     curry = (sy - (x+1) * xdim) / 0x10000;
349348
350                     copybitmap_trans( bitmap,*state->m_tmpbitmap1, 0,0, currx,curry, cliprect, 0 );
349                     copybitmap_trans( bitmap,*m_tmpbitmap1, 0,0, currx,curry, cliprect, 0 );
351350                  break;
352351
353352               default:
354                  drawgfxzoom_transpen(   bitmap,cliprect,machine.gfx[gfx],
353                  drawgfxzoom_transpen(   bitmap,cliprect,machine().gfx[gfx],
355354                              code++,
356355                              color,
357356                              flipx, flipy,
r20975r20976
367366
368367/* DaiDaiKakumei */
369368/* layer : 0== bghigh<spr    1== bglow<spr<bghigh     2==spr<bglow    3==boarder */
370static void dai2kaku_draw_sprites(running_machine &machine, bitmap_ind16 &bitmap,const rectangle &cliprect, int layer)
369void realbrk_state::dai2kaku_draw_sprites(bitmap_ind16 &bitmap,const rectangle &cliprect, int layer)
371370{
372   realbrk_state *state = machine.driver_data<realbrk_state>();
373   UINT16 *spriteram16 = state->m_spriteram;
371   UINT16 *spriteram16 = m_spriteram;
374372   int offs;
375373
376   int max_x = machine.primary_screen->width();
377   int max_y = machine.primary_screen->height();
374   int max_x = machine().primary_screen->width();
375   int max_y = machine().primary_screen->height();
378376
379377   for ( offs = 0x3000/2; offs < 0x3600/2; offs += 2/2 )
380378   {
r20975r20976
414412      xdim    =       ((zoom & 0x00ff) >> 0) << (16-6+4);
415413      ydim    =       ((zoom & 0xff00) >> 8) << (16-6+4);
416414
417      if (state->flip_screen_x()) {   flipx = !flipx;     sx = (max_x << 16) - sx - xnum * xdim;  }
418      if (state->flip_screen_y()) {   flipy = !flipy;     sy = (max_y << 16) - sy - ynum * ydim;  }
415      if (flip_screen_x()) {   flipx = !flipx;     sx = (max_x << 16) - sx - xnum * xdim;  }
416      if (flip_screen_y()) {   flipy = !flipy;     sy = (max_y << 16) - sy - ynum * ydim;  }
419417
420418      if (flipx)  { xstart = xnum-1;  xend = -1;    xinc = -1; }
421419      else        { xstart = 0;       xend = xnum;  xinc = +1; }
r20975r20976
433431            int scalex = (sx + (x + 1) * xdim) / 0x10000 - currx;
434432            int scaley = (sy + (y + 1) * ydim) / 0x10000 - curry;
435433
436            drawgfxzoom_transpen(   bitmap,cliprect,machine.gfx[gfx],
434            drawgfxzoom_transpen(   bitmap,cliprect,machine().gfx[gfx],
437435                        code++,
438436                        color,
439437                        flipx, flipy,
r20975r20976
516514   if (layers_ctrl & 2)    m_tilemap_1->draw(bitmap, cliprect, 0,0);
517515   if (layers_ctrl & 1)    m_tilemap_0->draw(bitmap, cliprect, 0,0);
518516
519   if (layers_ctrl & 8)    draw_sprites(machine(),bitmap,cliprect);
517   if (layers_ctrl & 8)    draw_sprites(bitmap,cliprect);
520518
521519   if (layers_ctrl & 4)    m_tilemap_2->draw(bitmap, cliprect, 0,0);
522520
r20975r20976
586584
587585
588586   // spr 0
589   if (layers_ctrl & 8)    dai2kaku_draw_sprites(machine(),bitmap,cliprect,2);
587   if (layers_ctrl & 8)    dai2kaku_draw_sprites(bitmap,cliprect,2);
590588
591589   // bglow
592590   if( m_vregs[8/2] & (0x8000)){
r20975r20976
596594   }
597595
598596   // spr 1
599   if (layers_ctrl & 8)    dai2kaku_draw_sprites(machine(),bitmap,cliprect,1);
597   if (layers_ctrl & 8)    dai2kaku_draw_sprites(bitmap,cliprect,1);
600598
601599   // bghigh
602600   if( m_vregs[8/2] & (0x8000)){
r20975r20976
606604   }
607605
608606   // spr 2
609   if (layers_ctrl & 8)    dai2kaku_draw_sprites(machine(),bitmap,cliprect,0);
607   if (layers_ctrl & 8)    dai2kaku_draw_sprites(bitmap,cliprect,0);
610608
611609   // fix
612610   if (layers_ctrl & 4)    m_tilemap_2->draw(bitmap, cliprect, 0,0);
trunk/src/mame/includes/raiden2.h
r20975r20976
152152   DECLARE_MACHINE_RESET(raidendx);
153153   UINT32 screen_update_raiden2(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect);
154154   INTERRUPT_GEN_MEMBER(raiden2_interrupt);
155   UINT16 rps();
156   UINT16 rpc();
157   const UINT8 fade_table(int v);
158   void combine32(UINT32 *val, int offset, UINT16 data, UINT16 mem_mask);
159   void sprcpt_init(void);
155160};
156161
157162/*----------- defined in machine/r2crypt.c -----------*/
trunk/src/mame/includes/redalert.h
r20975r20976
4848   DECLARE_WRITE8_MEMBER(demoneye_ay8910_latch_1_w);
4949   DECLARE_READ8_MEMBER(demoneye_ay8910_latch_2_r);
5050   DECLARE_WRITE8_MEMBER(demoneye_ay8910_data_w);
51   void get_pens(pen_t *pens);
52   void get_panther_pens(pen_t *pens);
5153};
5254/*----------- defined in audio/redalert.c -----------*/
5355
trunk/src/mame/includes/realbrk.h
r20975r20976
4747   UINT32 screen_update_realbrk(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect);
4848   UINT32 screen_update_dai2kaku(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect);
4949   INTERRUPT_GEN_MEMBER(realbrk_interrupt);
50   void draw_sprites(bitmap_ind16 &bitmap,const rectangle &cliprect);
51   void dai2kaku_draw_sprites(bitmap_ind16 &bitmap,const rectangle &cliprect, int layer);
5052};
trunk/src/mame/includes/route16.h
r20975r20976
3131   UINT32 screen_update_route16(screen_device &screen, bitmap_rgb32 &bitmap, const rectangle &cliprect);
3232   UINT32 screen_update_stratvox(screen_device &screen, bitmap_rgb32 &bitmap, const rectangle &cliprect);
3333   UINT32 screen_update_ttmahjng(screen_device &screen, bitmap_rgb32 &bitmap, const rectangle &cliprect);
34   pen_t route16_make_pen(UINT8 color);
35   pen_t ttmajng_make_pen(UINT8 color);
36   int video_update_stratvox_ttmahjng(bitmap_rgb32 &bitmap,const rectangle &cliprect,pen_t (route16_state::*make_pen)(UINT8));
3437};
trunk/src/mame/includes/rpunch.h
r20975r20976
4343   UINT32 screen_update_rpunch(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect);
4444   TIMER_CALLBACK_MEMBER(sound_command_w_callback);
4545   TIMER_CALLBACK_MEMBER(crtc_interrupt_gen);
46   void draw_sprites(bitmap_ind16 &bitmap, const rectangle &cliprect, int start, int stop);
47   void draw_bitmap(bitmap_ind16 &bitmap, const rectangle &cliprect);
4648};
trunk/src/mame/includes/renegade.h
r20975r20976
7575   UINT32 screen_update_renegade(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect);
7676   TIMER_DEVICE_CALLBACK_MEMBER(renegade_interrupt);
7777   void setbank();
78   void draw_sprites(bitmap_ind16 &bitmap, const rectangle &cliprect);
7879};
trunk/src/mame/includes/retofinv.h
r20975r20976
6464   UINT32 screen_update_retofinv(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect);
6565   INTERRUPT_GEN_MEMBER(main_vblank_irq);
6666   INTERRUPT_GEN_MEMBER(sub_vblank_irq);
67   void draw_sprites(bitmap_ind16 &bitmap);
6768};
trunk/src/mame/includes/rohga.h
r20975r20976
6666   UINT32 screen_update_rohga(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect);
6767   UINT32 screen_update_wizdfire(screen_device &screen, bitmap_rgb32 &bitmap, const rectangle &cliprect);
6868   UINT32 screen_update_nitrobal(screen_device &screen, bitmap_rgb32 &bitmap, const rectangle &cliprect);
69   void mixwizdfirelayer(bitmap_rgb32 &bitmap, const rectangle &cliprect, int gfxregion, UINT16 pri, UINT16 primask);
6970};
7071/*----------- defined in video/rohga.c -----------*/
7172UINT16 rohga_pri_callback(UINT16 x);
trunk/src/mame/includes/rainbow.h
r20975r20976
5050   UINT32 screen_update_rainbow(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect);
5151   UINT32 screen_update_jumping(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect);
5252   TIMER_CALLBACK_MEMBER(cchip_timer);
53   void request_round_data(  );
54   void request_world_data(  );
55   void request_goalin_data(  );
56   void rbisland_cchip_init( int version );
5357};
5458
5559/*----------- defined in machine/rainbow.c -----------*/
trunk/src/mame/includes/rampart.h
r20975r20976
2323   DECLARE_MACHINE_RESET(rampart);
2424   DECLARE_VIDEO_START(rampart);
2525   UINT32 screen_update_rampart(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect);
26   void rampart_bitmap_render(bitmap_ind16 &bitmap, const rectangle &cliprect);
2627};
trunk/src/mame/includes/raiden.h
r20975r20976
4141   DECLARE_VIDEO_START(raidena);
4242   UINT32 screen_update_raiden(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect);
4343   INTERRUPT_GEN_MEMBER(raiden_interrupt);
44   void draw_sprites(bitmap_ind16 &bitmap,const rectangle &cliprect,int pri_mask);
45   void common_decrypt();
4446};
trunk/src/mame/includes/rallyx.h
r20975r20976
6666   UINT32 screen_update_locomotn(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect);
6767   INTERRUPT_GEN_MEMBER(rallyx_vblank_irq);
6868   INTERRUPT_GEN_MEMBER(jungler_vblank_irq);
69   inline void rallyx_get_tile_info( tile_data &tileinfo, int tile_index, int ram_offs);
70   inline void locomotn_get_tile_info(tile_data &tileinfo,int tile_index,int ram_offs);
71   void calculate_star_field(  );
72   void rallyx_video_start_common(  );
73   void plot_star( bitmap_ind16 &bitmap, const rectangle &cliprect, int x, int y, int color );
74   void draw_stars( bitmap_ind16 &bitmap, const rectangle &cliprect );
75   void rallyx_draw_sprites( bitmap_ind16 &bitmap, const rectangle &cliprect, int displacement );
76   void locomotn_draw_sprites( bitmap_ind16 &bitmap, const rectangle &cliprect, int displacement );
77   void rallyx_draw_bullets( bitmap_ind16 &bitmap, const rectangle &cliprect, int transpen );
78   void jungler_draw_bullets( bitmap_ind16 &bitmap, const rectangle &cliprect, int transpen );
79   void locomotn_draw_bullets( bitmap_ind16 &bitmap, const rectangle &cliprect, int transpen );
6980};
trunk/src/mame/includes/rocnrope.h
r20975r20976
3030   virtual void palette_init();
3131   UINT32 screen_update_rocnrope(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect);
3232   INTERRUPT_GEN_MEMBER(vblank_irq);
33   void draw_sprites(bitmap_ind16 &bitmap, const rectangle &cliprect );
3334};

Previous 199869 Revisions Next


© 1997-2024 The MAME Team