Previous 199869 Revisions Next

r21472 Wednesday 27th February, 2013 at 21:20:17 UTC by David Haywood
prepare for sorting
[src/mame/drivers]coolridr.c

trunk/src/mame/drivers/coolridr.c
r21471r21472
369369#define CLIPMINX_FULL (0)
370370#define CLIPMINY_FULL (0)
371371
372
372373class coolridr_state : public driver_device
373374{
374375public:
r21471r21472
404405      decode[0].current_object = 0;
405406      decode[1].current_object = 0;
406407      debug_randompal = 9;
407
408408   }
409409
410410   // Blitter state
r21471r21472
535535   static void *draw_object_threaded(void *param, int threadid);
536536   int m_usethreads;
537537
538
539
540   struct cool_render_object
541   {
542      UINT8* indirect_tiles;
543      UINT32* indirect_zoom;
544      UINT32 spriteblit[12];
545      bitmap_ind16* drawbitmap;
546      bitmap_ind16* zbitmap;
547      UINT16 zpri;
548      UINT8 blittype;
549      coolridr_state* state;
550      UINT32 clipvals[3];
551      int screen;
552   };
553
554   static int comp_sprite_z(const void *q1, const void *q2);
555
556   struct cool_render_object **m_cool_render_object_list1;
557   struct cool_render_object **m_cool_render_object_list2;
558
559   int m_listcount1;
560   int m_listcount2;
561
562
563
564
565
566   // the decode cache mechansim is an optimization
567   // we know all gfx are in ROM, and that calling the RLE decompression every time they're used is slow, so we cache the decoded tiles
568   // and objects after they're used, for future re-use, quite handy with a driving game.
569
538570#define DECODECACHE_NUMOBJECTCACHES (128)
539571
540572#define DECODECACHE_NUMSPRITETILES (16*16)
r21471r21472
10251057
10261058
10271059
1028struct cool_render_object
1029{
1030   UINT8* indirect_tiles;
1031   UINT32* indirect_zoom;
1032   UINT32 spriteblit[12];
1033   bitmap_ind16* drawbitmap;
1034   bitmap_ind16* zbitmap;
1035   UINT16 zpri;
1036   UINT8 blittype;
1037   coolridr_state* state;
1038   UINT32 clipvals[3];
1039   int screen;
1040};
10411060
10421061#define RLE_BLOCK(writeaddrxor) \
10431062   /* skip the decoding if it's the same tile as last time! */ \
r21471r21472
23882407
23892408   testobject->zpri = m_blitterAddr | m_blittype<<12;
23902409   testobject->blittype = m_blittype;
2410#if 0
23912411   osd_work_queue *queue;
2412#endif
23922413   // which queue, which bitmap
23932414   if (m_blitterMode == 0x30 || m_blitterMode == 0x40 || m_blitterMode == 0x4f || m_blitterMode == 0x50 || m_blitterMode == 0x60)
23942415   {
r21471r21472
23992420      testobject->clipvals[1] = m_clipvals[0][1];
24002421      testobject->clipvals[2] = m_clipvals[0][2];
24012422      testobject->screen = 0;
2423#if 0
24022424      queue = m_work_queue[0];
2425#endif
24032426   }
24042427   else // 0x90, 0xa0, 0xaf, 0xb0, 0xc0
24052428   {
r21471r21472
24102433      testobject->clipvals[1] = m_clipvals[1][1];
24112434      testobject->clipvals[2] = m_clipvals[1][2];
24122435      testobject->screen = 1;
2436#if 0
24132437      queue = m_work_queue[1];
2438#endif
24142439   }
24152440
2441#if 0
24162442   if (m_usethreads)
24172443   {
24182444      osd_work_item_queue(queue, draw_object_threaded, testobject, WORK_ITEM_FLAG_AUTO_RELEASE);
r21471r21472
24212447   {
24222448      draw_object_threaded((void*)testobject,0);
24232449   }
2450#else
2451
2452   if (m_blitterMode == 0x30 || m_blitterMode == 0x40 || m_blitterMode == 0x4f || m_blitterMode == 0x50 || m_blitterMode == 0x60)
2453   {
2454      if (m_listcount1<1000000)
2455      {
2456         m_cool_render_object_list1[m_listcount1] =  testobject;
2457         m_listcount1++;
2458      }
2459      else
2460      {
2461         popmessage("m_listcount1 overflow!\n");
2462      }
2463   }
2464   else
2465   {
2466      if (m_listcount2<1000000)
2467      {
2468         m_cool_render_object_list2[m_listcount2] =  testobject;
2469         m_listcount2++;
2470      }
2471      else
2472      {
2473         popmessage("m_listcount2 overflow!\n");
2474      }
2475   }
2476#endif
24242477}
24252478
24262479
r21471r21472
26022655   m_blitterClearCount = 0;
26032656}
26042657
2658
2659
2660
26052661WRITE32_MEMBER(coolridr_state::sysh1_fb_data_w)
26062662{
26072663   if(m_blitterClearCount == 0)
r21471r21472
26332689         {
26342690            // wait for our sprite rendering to finish
26352691            osd_work_queue_wait(m_work_queue[0], osd_ticks_per_second() * 100);
2636           
2692
26372693            // copy our old buffer to the actual screen
26382694            copybitmap(m_screen1_bitmap, m_temp_bitmap_sprites, 0, 0, 0, 0, visarea);
26392695           
2640            //m_temp_bitmap_sprites.fill(0xff000000, visarea);
2696
2697
2698
2699            //m_temp_bitmap_sprites2.fill(0xff000000, visarea);
26412700            // render the tilemap to the backbuffer, ready for having sprites drawn on it
26422701            draw_bg_coolridr(m_temp_bitmap_sprites, visarea, 0);
2643            // wipe the z-buffer ready for the sprites     
2702            // wipe the z-buffer ready for the sprites           
26442703            m_zbuffer_bitmap.fill(0xffff, visarea);
26452704            // almost certainly wrong
26462705            m_clipvals[0][0] = 0;
26472706            m_clipvals[0][1] = 0;
26482707            m_clipvals[0][2] = 0;
26492708            m_clipblitterMode[0] = 0xff;
2709         
2710            //qsort(m_cool_render_object_list1, m_listcount1, sizeof(struct cool_render_object *), comp_sprite_z);
2711
2712            for (int i=0;i<m_listcount1;i++)
2713            {
2714               if (m_usethreads)
2715               {
2716                  osd_work_item_queue(m_work_queue[0], draw_object_threaded, m_cool_render_object_list1[i], WORK_ITEM_FLAG_AUTO_RELEASE);
2717               }
2718               else
2719               {
2720                  draw_object_threaded((void*)m_cool_render_object_list1[i],0);
2721               }
2722            }   
2723   
2724            m_listcount1 = 0;
2725         
2726
26502727         }
26512728         else if(m_blitterClearMode == 0x8c800000)
26522729         {
r21471r21472
26552732
26562733            // copy our old buffer to the actual screen
26572734            copybitmap(m_screen2_bitmap, m_temp_bitmap_sprites2, 0, 0, 0, 0, visarea);
2735           
2736
2737
2738
26582739            //m_temp_bitmap_sprites2.fill(0xff000000, visarea);
26592740            // render the tilemap to the backbuffer, ready for having sprites drawn on it
26602741            draw_bg_coolridr(m_temp_bitmap_sprites2, visarea, 1);
r21471r21472
26652746            m_clipvals[1][1] = 0;
26662747            m_clipvals[1][2] = 0;
26672748            m_clipblitterMode[1] = 0xff;
2749   
2750            //qsort(m_cool_render_object_list2, m_listcount2, sizeof(struct cool_render_object *), comp_sprite_z);
2751
2752            for (int i=0;i<m_listcount2;i++)
2753            {
2754               if (m_usethreads)
2755               {
2756                  osd_work_item_queue(m_work_queue[1], draw_object_threaded, m_cool_render_object_list2[i], WORK_ITEM_FLAG_AUTO_RELEASE);
2757               }
2758               else
2759               {
2760                  draw_object_threaded((void*)m_cool_render_object_list2[i],0);
2761               }
2762            }   
2763   
2764            m_listcount2 = 0;
2765         
26682766         }
26692767
26702768         //printf("frame\n");
r21471r21472
35293627   m_h1_pcg = auto_alloc_array_clear(machine(), UINT8, VRAM_SIZE);
35303628   m_h1_pal = auto_alloc_array_clear(machine(), UINT16, VRAM_SIZE);
35313629
3630   m_cool_render_object_list1 = auto_alloc_array_clear(machine(), struct cool_render_object*, 1000000);
3631   m_listcount1 = 0;
3632
3633   m_cool_render_object_list2 = auto_alloc_array_clear(machine(), struct cool_render_object*, 1000000);
3634   m_listcount2 = 0;
3635
3636
35323637   save_pointer(NAME(m_h1_vram), VRAM_SIZE);
35333638   save_pointer(NAME(m_h1_pcg), VRAM_SIZE);
35343639   save_pointer(NAME(m_h1_pal), VRAM_SIZE);

Previous 199869 Revisions Next


© 1997-2024 The MAME Team