diff options
Diffstat (limited to 'apps/plugins/pacbox')
-rw-r--r-- | apps/plugins/pacbox/arcade.c | 68 |
1 files changed, 38 insertions, 30 deletions
diff --git a/apps/plugins/pacbox/arcade.c b/apps/plugins/pacbox/arcade.c index e7fc0244de..b4619d4c39 100644 --- a/apps/plugins/pacbox/arcade.c +++ b/apps/plugins/pacbox/arcade.c | |||
@@ -410,27 +410,39 @@ unsigned getDipSwitches(void) { | |||
410 | 410 | ||
411 | static inline void drawChar( unsigned char * buffer, int index, int ox, int oy, int color ) | 411 | static inline void drawChar( unsigned char * buffer, int index, int ox, int oy, int color ) |
412 | { | 412 | { |
413 | buffer += ox + oy*224; // Make the buffer point to the character position | ||
414 | index *= 64; // Make the index point to the character offset into the character table | ||
415 | color = (color & 0x3F)*4; | ||
416 | int x,y; | 413 | int x,y; |
417 | 414 | ||
415 | /* Make the index point to the character offset into the character table */ | ||
416 | unsigned char * chrmap = charmap_ + index*64; | ||
417 | buffer += ox + oy*224; /* Make the buffer point to the character position*/ | ||
418 | color = (color & 0x3F)*4; | ||
419 | |||
420 | if( color == 0 ) | ||
421 | { | ||
422 | for( y=7; y>=0; y-- ) | ||
423 | { | ||
424 | rb->memset( buffer, 0, 8 ); | ||
425 | buffer += ScreenWidth; | ||
426 | }; | ||
427 | return; | ||
428 | }; | ||
429 | |||
418 | if( output_devices_ & FlipScreen ) { | 430 | if( output_devices_ & FlipScreen ) { |
419 | // Flip character | 431 | // Flip character |
420 | buffer += 7*ScreenWidth; | 432 | buffer += 7*ScreenWidth; |
421 | for( y=0; y<8; y++ ) { | 433 | for( y=7; y>=0; y-- ) { |
422 | for( x=7; x>=0; x-- ) { | 434 | for( x=7; x>=0; x-- ) { |
423 | buffer[x] = charmap_[ index++ ] + color; | 435 | *buffer++ = (*chrmap++) + color; |
424 | } | 436 | } |
425 | buffer -= ScreenWidth; // Go to the next line | 437 | buffer -= ScreenWidth + 8; // Go to the next line |
426 | } | 438 | } |
427 | } | 439 | } |
428 | else { | 440 | else { |
429 | for( y=0; y<8; y++ ) { | 441 | for( y=7; y>=0; y-- ) { |
430 | for( x=0; x<=7; x++ ) { | 442 | for( x=7; x>=0; x-- ) { |
431 | buffer[x] = charmap_[ index++ ] + color; | 443 | *buffer++ = (*chrmap++) + color; |
432 | } | 444 | } |
433 | buffer += ScreenWidth; // Go to the next line | 445 | buffer += ScreenWidth - 8; // Go to the next line |
434 | } | 446 | } |
435 | } | 447 | } |
436 | } | 448 | } |
@@ -455,7 +467,6 @@ inline void drawSprite( unsigned char * buffer, int index ) | |||
455 | unsigned char * spritemap_base = spritemap_ + ((ps.n & 0x3F)*256); | 467 | unsigned char * spritemap_base = spritemap_ + ((ps.n & 0x3F)*256); |
456 | 468 | ||
457 | buffer += ScreenWidth*ps.y; | 469 | buffer += ScreenWidth*ps.y; |
458 | s2 = &spritemap_base[start_x-ps.x]; | ||
459 | 470 | ||
460 | dirty_[(start_x >> 3) + (ps.y >> 3)*28] = 1; | 471 | dirty_[(start_x >> 3) + (ps.y >> 3)*28] = 1; |
461 | dirty_[(start_x >> 3) + 1 + (ps.y >> 3)*28] = 1; | 472 | dirty_[(start_x >> 3) + 1 + (ps.y >> 3)*28] = 1; |
@@ -469,52 +480,49 @@ inline void drawSprite( unsigned char * buffer, int index ) | |||
469 | 480 | ||
470 | // Draw the 16x16 sprite | 481 | // Draw the 16x16 sprite |
471 | if( ps.mode == 0 ) { // Normal | 482 | if( ps.mode == 0 ) { // Normal |
483 | s2 = spritemap_base + start_x-ps.x; | ||
472 | // Draw the 16x16 sprite | 484 | // Draw the 16x16 sprite |
473 | for( y=15; y>=0; y-- ) { | 485 | for( y=15; y>=0; y-- ) { |
474 | s = s2; | 486 | s = s2; |
475 | for( x=start_x; x<=end_x; x++ ) { | 487 | for( x=start_x; x<=end_x; x++, s++ ) { |
476 | int c = *(s++); | 488 | if( *s ) { |
477 | if( c ) { | 489 | buffer[x] = color + *s; |
478 | buffer[x] = c + color; | ||
479 | } | 490 | } |
480 | } | 491 | } |
481 | buffer += ScreenWidth; | 492 | buffer += ScreenWidth; |
482 | s2 += 16; | 493 | s2 += 16; |
483 | } | 494 | } |
484 | } else if( ps.mode == 1 ) { // Flip Y | 495 | } else if( ps.mode == 1 ) { // Flip Y |
485 | s2 += 240; | 496 | s2 = spritemap_base + start_x-ps.x + 240; |
486 | for( y=15; y>=0; y-- ) { | 497 | for( y=15; y>=0; y-- ) { |
487 | s = s2; | 498 | s = s2; |
488 | for( x=start_x; x<=end_x; x++ ) { | 499 | for( x=start_x; x<=end_x; x++, s++ ) { |
489 | int c = *(s++); | 500 | if( *s ) { |
490 | if( c ) { | 501 | buffer[x] = color + *s; |
491 | buffer[x] = c + color; | ||
492 | } | 502 | } |
493 | } | 503 | } |
494 | buffer += ScreenWidth; | 504 | buffer += ScreenWidth; |
495 | s2 -= 16; | 505 | s2 -= 16; |
496 | } | 506 | } |
497 | } else if( ps.mode == 2 ) { // Flip X | 507 | } else if( ps.mode == 2 ) { // Flip X |
498 | s2 += 15; | 508 | s2 = spritemap_base + 15 + ps.x-start_x; |
499 | for( y=15; y>=-0; y-- ) { | 509 | for( y=15; y>=-0; y-- ) { |
500 | s = s2; | 510 | s = s2; |
501 | for( x=start_x; x<=end_x; x++ ) { | 511 | for( x=start_x; x<=end_x; x++, s-- ) { |
502 | int c = *(s--); | 512 | if( *s ) { |
503 | if( c ) { | 513 | buffer[x] = color + *s; |
504 | buffer[x] = c + color; | ||
505 | } | 514 | } |
506 | } | 515 | } |
507 | buffer += ScreenWidth; | 516 | buffer += ScreenWidth; |
508 | s2 += 16; | 517 | s2 += 16; |
509 | } | 518 | } |
510 | } else { // Flip X and Y | 519 | } else { // Flip X and Y |
511 | s2 += 255; | 520 | s2 = spritemap_base + 255 + ps.x-start_x; |
512 | for( y=15; y>=0; y-- ) { | 521 | for( y=15; y>=0; y-- ) { |
513 | s = s2; | 522 | s = s2; |
514 | for( x=start_x; x<=end_x; x++ ) { | 523 | for( x=start_x; x<=end_x; x++, s-- ) { |
515 | int c = *(s--); | 524 | if( *s ) { |
516 | if( c ) { | 525 | buffer[x] = color + *s; |
517 | buffer[x] = c + color; | ||
518 | } | 526 | } |
519 | } | 527 | } |
520 | buffer += ScreenWidth; | 528 | buffer += ScreenWidth; |