Previous 199869 Revisions Next

r21469 Wednesday 27th February, 2013 at 17:29:28 UTC by David Haywood
blending does not play nice with our z-buffer, road transitions and shadows on title screen have issues.  will need a rethink
[src/mame/drivers]coolridr.c

trunk/src/mame/drivers/coolridr.c
r21468r21469
403403      m_work_queue[1] = osd_work_queue_alloc(WORK_QUEUE_FLAG_HIGH_FREQ);
404404      decode[0].current_object = 0;
405405      decode[1].current_object = 0;
406      debug_randompal = 8;
406      debug_randompal = 9;
407407
408408   }
409409
r21468r21469
585585};
586586
587587#define PRINT_BLIT_STUFF \
588   printf("type blit %08x %08x(%d, %03x) %08x(%02x, %03x) %08x(%06x) %08x(%08x, %d, %d, %d) %08x(%d,%d) %04x %04x %04x %04x %08x %08x %d %d\n", blit0, blit1_unused,b1mode,b1colorNumber, blit2_unused,b2tpen,b2colorNumber, blit3_unused,b3romoffset, blit4_unused, blit4, blit_flipy,blit_rotate, blit_flipx, blit5_unused, indirect_tile_enable, indirect_zoom_enable, vCellCount, hCellCount, vZoom, hZoom, blit10, textlookup, vPosition, hPosition); \
588   printf("type blit %08x %08x(%d, %03x) %08x(%02x, %03x) %08x(%06x) %08x(%08x, %d, %d, %d) %08x(%d,%d) %04x %04x %04x %04x %08x %08x %d %d\n", blit0, blit1_unused,b1mode,b1colorNumber, blit2_unused,b2tpen,b2colorNumber, blit3_unused,b3romoffset, blit4_unused, blit4blendlevel, blit_flipy,blit_rotate, blit_flipx, blit5_unused, indirect_tile_enable, indirect_zoom_enable, vCellCount, hCellCount, vZoom, hZoom, blit10, textlookup, vPosition, hPosition); \
589589
590590
591591
r21468r21469
12641264
12651265
12661266#define DRAW_PIX \
1267   if (pix != 0x8000) \
1267   /* I think 0x8000 is ALWAYS transparent */ \
1268   /* values < 0x8000 have no alpha effect to them */ \
1269   if (pix < 0x8000) \
12681270   { \
12691271      if (object->zpri < zline[drawx]) \
12701272      { \
r21468r21469
12741276         } \
12751277      } \
12761278   } \
1277   else \
1279   /* values > 0x8000 have blending */ \
1280   else if (pix > 0x8000) \
12781281   { \
1279      /* some alpha sprites have 0x8000 set */ \
1280      /* but some regular ones text do too? */ \
1281      /* how do we tell the difference between them? */ \
1282      /* how would you have a black 0x0000 in an alpha sprite?? */ \
1282      /* a blend level of 0x8 (real register value 0x7 but we added one so we can shift instead of divide in code below) seems to be the same as solid, it is set on most parts of the road and during the 'lovemachine' animation in attract when the heart should be hidden */ \
1283      if (object->zpri < zline[drawx]) \
1284      { \
1285         if (blit4blendlevelinv==0x0) \
1286         { \
1287            line[drawx] = pix&0x7fff; \
1288            zline[drawx] = object->zpri; \
1289         } \
1290         else \
1291         { \
1292           UINT16 source = line[drawx]; \
1293           int src_r = ((source>>10)&0x1f) * blit4blendlevelinv; \
1294           int src_g = ((source>>5)&0x1f)  * blit4blendlevelinv; \
1295           int src_b = ((source>>0)&0x1f)  * blit4blendlevelinv; \
1296           int dest_r = ((pix>>10)&0x1f) * blit4blendlevel; \
1297           int dest_g = ((pix>>5)&0x1f)  * blit4blendlevel; \
1298           int dest_b = ((pix>>0)&0x1f)  * blit4blendlevel; \
1299           line[drawx] = (((src_r+dest_r)>>3)<<10) | (((src_g+dest_g)>>3)<<5) | (((src_b+dest_b)>>3)<<0); \
1300           zline[drawx] = object->zpri; \
1301         } \
1302      } \
12831303   } \
12841304   drawx++; \
12851305
r21468r21469
13841404   /************* object->spriteblit[4] *************/
13851405
13861406   UINT32 blit4_unused = object->spriteblit[4] & 0xf8fefeee;
1387   UINT32 blit4 = (object->spriteblit[4] & 0x07000000)>>24;
1407   UINT16 blit4blendlevel = (object->spriteblit[4] & 0x07000000)>>24;
1408   UINT16 blit4blendlevelinv = blit4blendlevel^0x7;
1409   blit4blendlevel+=1; // make our maths easier later (not sure about accuracy)
13881410   //object->zpri = 7-blit4;
13891411   // unknown bits in blit word 4 -  00000010 - australia (and various other times)
13901412
r21468r21469
14161438   // note the road always has 0x8000 bit set in the palette.  I *think* this is because they do a gradual blend of some kind between the road types
14171439   //  see the number of transitional road bits which have various values above set
14181440
1419   if (blit4==object->state->debug_randompal)
1441   if (blit4blendlevel==object->state->debug_randompal)
14201442   {
14211443      b1colorNumber = object->state->machine().rand()&0xfff;
14221444   }

Previous 199869 Revisions Next


© 1997-2024 The MAME Team