Previous 15994 Revisions Next

r7063 Tuesday 19th January, 2010 at 10:19:17 UTC by Robbbert
[INTV] Apply sprite collision fix [H@P]
Fixed crash when attempting to display gfx1 in the viewer
Replaced some multiplies by shifts to gain speed
[src/mess/drivers]intv.c
[src/mess/video]intv.c

src/mess/video/intv.c
r7062r7063
6969    struct intv_sprite_type* s2 = &intv_sprite[spriteNum1];
7070
7171    x1 = s1->xpos-8; x2 = s2->xpos-8;
72    y1 = s1->ypos-8; y2 = s2->ypos-8;
73    w1 = 8 * (s1->doublex ? 2 : 1);
74    w2 = 8 * (s2->doublex ? 2 : 1);
75    h1 = 8 * (s1->quady ? 4 : 1) * (s1->doubley ? 2 : 1) *
76            (s1->doubleyres ? 2 : 1);
77    h2 = 8 * (s2->quady ? 4 : 1) * (s2->doubley ? 2 : 1) *
78            (s2->doubleyres ? 2 : 1);
72    y1 = (s1->ypos-8)<<1; y2 = (s2->ypos-8)<<1;
73    w1 = (s1->doublex ? 2 : 1)<<3;
74    w2 = (s2->doublex ? 2 : 1)<<3;
75    h1 = (s1->quady ? 4 : 1) * (s1->doubley ? 2 : 1) * (s1->doubleyres ? 2 : 1)<<3;
76    h2 = (s2->quady ? 4 : 1) * (s2->doubley ? 2 : 1) * (s2->doubleyres ? 2 : 1)<<3;
7977
8078    if ((x1 + w1 <= x2) || (y1 + h1 <= y2) ||
8179            (x1 >= x2 + w2) || (y1 >= y2 + h2))
r7062r7063
8482    //iterate over the intersecting bits to see if any touch
8583    x0 = MAX(x1, x2);
8684    y0 = MAX(y1, y2);
87    r0y = 2*(y0-y1);
88    r1y = 2*(y0-y2);
85    r0y = y0-y1;
86    r1y = y0-y2;
8987    width = MIN(x1+w1, x2+w2) - x0;
90    height = (MIN(y1+h1, y2+h2) - y0) * 2;
88    height = MIN(y1+h1, y2+h2) - y0;
9189    for (x = 0; x < width; x++) {
9290        for (y = 0; y < height; y++) {
9391            if (intv_sprite_buffers[spriteNum0][x0-x1+x][r0y+y] &&
r7062r7063
378376        borderCollision = FALSE;
379377        foregroundCollision = FALSE;
380378
381        spritePixelHeight = 8 * (s->quady ? 4 : 1) *
382                (s->doubley ? 2 : 1) * (s->doubleyres ? 2 : 1);
383        width = 8 * (s->doublex ? 2 : 1);
379        spritePixelHeight = (s->quady ? 4 : 1) *
380                (s->doubley ? 2 : 1) * (s->doubleyres ? 2 : 1)<<3;
381        width = (s->doublex ? 2 : 1)<<3;
384382
385        leftX = (s->xpos-8)*2;
386        nextY = (s->ypos-8)*2;
383        leftX = (s->xpos-8)<<1;
384        nextY = (s->ypos-8)<<1;
387385
388386        for (y = 0; y < spritePixelHeight; y++) {
389387            for (x = 0; x < width; x++) {
r7062r7063
797795         {
798796            offs = current_row*64+x;
799797            drawgfx_transpen(bitmap, NULL,
800               screen->machine->gfx[2],
798               screen->machine->gfx[1],
801799               screen->machine->generic.videoram.u8[offs],
802800               7, /* white */
803801               0,0,
804               x*8,y*8, 0);
802               x<<3,y<<3, 0);
805803         }
806804         if (current_row == tms9927_cursor_row)
807805         {
808806            /* draw the cursor as a solid white block */
809807            /* (should use a filled rect here!) */
810808            drawgfx_transpen(bitmap, NULL,
811               screen->machine->gfx[2],
809               screen->machine->gfx[1],
812810               191, /* a block */
813811               7,   /* white   */
814812               0,0,
815               (tms9927_cursor_col-1)*8,y*8, 0);
813               (tms9927_cursor_col-1)<<3,y<<3, 0);
816814         }
817815         current_row = (current_row + 1) % tms9927_num_rows;
818816      }
r7062r7063
821819#if 0
822820   // debugging
823821   c = tape_motor_mode_desc[tape_motor_mode][0];
824   drawgfx_transpen(bitmap,&machine->screen[0].visarea, machine->gfx[2],
822   drawgfx_transpen(bitmap,&machine->screen[0].visarea, machine->gfx[1],
825823      c,
826824      1,
827825      0,0,
828826      0*8,0*8, 0);
829827   for(y=0;y<5;y++)
830828   {
831      drawgfx_transpen(bitmap,&machine->screen[0].visarea, machine->gfx[2],
829      drawgfx_transpen(bitmap,&machine->screen[0].visarea, machine->gfx[1],
832830         tape_unknown_write[y]+'0',
833831         1,
834832         0,0,
835833         0*8,(y+2)*8, 0);
836834   }
837   drawgfx_transpen(bitmap,&machine->screen[0].visarea, machine->gfx[2],
835   drawgfx_transpen(bitmap,&machine->screen[0].visarea, machine->gfx[1],
838836         tape_unknown_write[5]+'0',
839837         1,
840838         0,0,
841839         0*8,8*8, 0);
842   drawgfx_transpen(bitmap,&machine->screen[0].visarea, machine->gfx[2],
840   drawgfx_transpen(bitmap,&machine->screen[0].visarea, machine->gfx[1],
843841         tape_interrupts_enabled+'0',
844842         1,
845843         0,0,
src/mess/drivers/intv.c
r7062r7063
125125   8 * 16
126126};
127127
128static const gfx_layout intv_gramlayout =
129{
130   16, 16,
131   64,
132   1,
133   { 0 },
134   { 0, 0, 1, 1, 2, 2, 3, 3, 4, 4, 5, 5, 6, 6, 7, 7},
135   { 0*8, 0*8, 1*8, 1*8, 2*8, 2*8, 3*8, 3*8,
136     4*8, 4*8, 5*8, 5*8, 6*8, 6*8, 7*8, 7*8 },
137   8 * 8
138};
139
140128static const gfx_layout intvkbd_charlayout =
141129{
142130   8, 8,
r7062r7063
150138
151139static GFXDECODE_START( intv )
152140   GFXDECODE_ENTRY( "maincpu", 0x3000<<1, intv_gromlayout, 0, 256 )
153   GFXDECODE_ENTRY( 0, 0, intv_gramlayout, 0, 256 )    /* Dynamically decoded from RAM */
154141GFXDECODE_END
155142
156143static GFXDECODE_START( intvkbd )
157144   GFXDECODE_ENTRY( "maincpu", 0x3000<<1, intv_gromlayout, 0, 256 )
158   GFXDECODE_ENTRY( 0, 0, intv_gramlayout, 0, 256 )    /* Dynamically decoded from RAM */
159145   GFXDECODE_ENTRY( "gfx1", 0x0000, intvkbd_charlayout, 0, 256 )
160146GFXDECODE_END
161147

Previous 15994 Revisions Next


© 1998-2018 The MESS Team