298 | | _mask_ptr = NULL; |
299 | | if (masking || charsetmask) { |
300 | | _mask_ptr = _vm->getResourceAddress(rtBuffer, 9) + _ypos * _numStrips + _vm->_screenStartStrip; |
301 | | _imgbufoffs = _vm->gdi._imgBufOffs[_zbuf]; |
302 | | if (!charsetmask && _zbuf != 0) |
303 | | _mask_ptr += _imgbufoffs; |
304 | | _mask_ptr_dest = _mask_ptr + _xpos / 8; |
305 | | } |
| 281 | _mask_ptr = _vm->getResourceAddress(rtBuffer, 9) + _ypos * _numStrips + _vm->_screenStartStrip; |
| 282 | _imgbufoffs = _vm->gdi._imgBufOffs[_zbuf]; |
| 283 | _mask_ptr_dest = _mask_ptr + _xpos / 8; |
| 284 | |
| 285 | // FIXME: Masking used to be conditional. Will it cause regressions |
| 286 | // to always do it? I don't think so, since the behaviour used to be |
| 287 | // to mask if there was a mask to apply, unless _zbuf is 0. |
| 288 | // |
| 289 | // However, when _zbuf is 0 masking and charset masking are the same |
| 290 | // thing. I believe the only thing that is ever written to the |
| 291 | // frontmost mask buffer is the charset mask, except in Sam & Max |
| 292 | // where it's also used for the inventory box and conversation icons. |
| 293 | |
| 294 | _use_mask = true; |
| 295 | _use_charset_mask = true; |
313 | | switch ((newAmiCost << 3) | (scaling << 2) | (masking << 1) | (charsetmask ? 1 : 0)) { |
314 | | case 0: |
315 | | proc6(); // no scaling, no masking, no charsetmask |
316 | | break; |
317 | | case 1: |
318 | | case 2: |
319 | | proc5(); // no scaling, masking or charsetmask |
320 | | break; |
321 | | case 3: |
322 | | proc4(); // no scaling, masking and charsetmask |
323 | | break; |
324 | | case 4: |
325 | | proc1(); // scaling, no masking, no charsetmask |
326 | | break; |
327 | | case 5: |
328 | | case 6: |
329 | | proc2(); // scaling, masking or charsetmask |
330 | | break; |
331 | | case 7: |
332 | | proc3(); // scaling, masking and charsetmask |
333 | | break; |
334 | | case 8: |
335 | | proc6_ami(); // no scaling, no masking, no charsetmask (Amiga) |
336 | | break; |
337 | | case 9: |
338 | | case 10: |
339 | | proc5_ami(); // no scaling, masking or charsetmask (Amiga) |
340 | | break; |
341 | | case 11: |
342 | | proc4_ami(); // no scaling, masking and charsetmask (Amiga) |
343 | | break; |
344 | | case 12: |
345 | | proc1_ami(); // scaling, no masking, no charsetmask (Amiga) |
346 | | break; |
347 | | case 13: |
348 | | case 14: |
349 | | proc2_ami(); // scaling, masking or charsetmask (Amiga) |
350 | | break; |
351 | | case 15: |
352 | | proc3_ami(); // scaling, masking and charsetmask (Amiga) |
353 | | break; |
354 | | } |
| 299 | if (_vm->_features & GF_AMIGA) |
| 300 | proc3_ami(); |
| 301 | else |
| 302 | proc3(); |
360 | | void CostumeRenderer::proc6() { |
361 | | byte *src, *dst; |
362 | | byte len, height, pcolor, width; |
363 | | uint y; |
364 | | int color; |
365 | | uint scrheight; |
366 | | |
367 | | y = _ypos; |
368 | | src = _srcptr; |
369 | | dst = _backbuff_ptr; |
370 | | len = _replen; |
371 | | color = _repcolor; |
372 | | height = _height2; |
373 | | scrheight = _outheight; |
374 | | width = _width2; |
375 | | |
376 | | if (_docontinue) |
377 | | goto StartPos; |
378 | | |
379 | | do { |
380 | | len = *src++; |
381 | | color = len >> _shrval; |
382 | | len &= _maskval; |
383 | | if (!len) |
384 | | len = *src++; |
385 | | |
386 | | do { |
387 | | if (color && y < scrheight) { |
388 | | pcolor = _palette[color]; |
389 | | if (pcolor == 13 && _shadow_table) |
390 | | pcolor = _shadow_table[*dst]; |
391 | | *dst = pcolor; |
392 | | } |
393 | | |
394 | | dst += _vm->_screenWidth; |
395 | | y++; |
396 | | if (!--height) { |
397 | | if (!--width) |
398 | | return; |
399 | | height = _height; |
400 | | dst -= _ypitch; |
401 | | y = _ypostop; |
402 | | } |
403 | | StartPos:; |
404 | | } while (--len); |
405 | | } while (1); |
406 | | } |
407 | | |
408 | | void CostumeRenderer::proc5() { |
409 | | byte *mask, *src, *dst; |
410 | | byte maskbit, len, height, pcolor; |
411 | | uint y, scrheight; |
412 | | int color; |
413 | | |
414 | | mask = _mask_ptr = _mask_ptr_dest; |
415 | | maskbit = revBitMask[_xpos & 7]; |
416 | | y = _ypos; |
417 | | src = _srcptr; |
418 | | dst = _backbuff_ptr; |
419 | | len = _replen; |
420 | | color = _repcolor; |
421 | | height = _height2; |
422 | | scrheight = _outheight; |
423 | | |
424 | | if (_docontinue) |
425 | | goto StartPos; |
426 | | |
427 | | do { |
428 | | len = *src++; |
429 | | color = len >> _shrval; |
430 | | len &= _maskval; |
431 | | if (!len) |
432 | | len = *src++; |
433 | | |
434 | | do { |
435 | | if (color && y < scrheight && !(*mask & maskbit)) { |
436 | | pcolor = _palette[color]; |
437 | | if (pcolor == 13 && _shadow_table) |
438 | | pcolor = _shadow_table[*dst]; |
439 | | *dst = pcolor; |
440 | | } |
441 | | dst += _vm->_screenWidth; |
442 | | y++; |
443 | | mask += _numStrips; |
444 | | if (!--height) { |
445 | | if (!--_width2) |
446 | | return; |
447 | | height = _height; |
448 | | dst -= _ypitch; |
449 | | y = _ypostop; |
450 | | if (_scaleIndexXStep != 1) { |
451 | | maskbit <<= 1; |
452 | | if (!maskbit) { |
453 | | maskbit = 1; |
454 | | _mask_ptr--; |
455 | | } |
456 | | } else { |
457 | | maskbit >>= 1; |
458 | | if (!maskbit) { |
459 | | maskbit = 0x80; |
460 | | _mask_ptr++; |
461 | | } |
462 | | } |
463 | | mask = _mask_ptr; |
464 | | } |
465 | | StartPos:; |
466 | | } while (--len); |
467 | | } while (1); |
468 | | } |
469 | | |
470 | | void CostumeRenderer::proc4() { |
471 | | byte *mask, *src, *dst; |
472 | | byte maskbit, len, height, pcolor; |
473 | | uint y, scrheight; |
474 | | int color; |
475 | | |
476 | | mask = _mask_ptr = _mask_ptr_dest; |
477 | | maskbit = revBitMask[_xpos & 7]; |
478 | | y = _ypos; |
479 | | src = _srcptr; |
480 | | dst = _backbuff_ptr; |
481 | | len = _replen; |
482 | | color = _repcolor; |
483 | | height = _height2; |
484 | | scrheight = _outheight; |
485 | | |
486 | | if (_docontinue) |
487 | | goto StartPos; |
488 | | |
489 | | do { |
490 | | len = *src++; |
491 | | color = len >> _shrval; |
492 | | len &= _maskval; |
493 | | if (!len) |
494 | | len = *src++; |
495 | | |
496 | | do { |
497 | | if (color && y < scrheight && !((*mask | mask[_imgbufoffs]) & maskbit)) { |
498 | | pcolor = _palette[color]; |
499 | | if (pcolor == 13 && _shadow_table) |
500 | | pcolor = _shadow_table[*dst]; |
501 | | *dst = pcolor; |
502 | | } |
503 | | dst += _vm->_screenWidth; |
504 | | y++; |
505 | | mask += _numStrips; |
506 | | if (!--height) { |
507 | | if (!--_width2) |
508 | | return; |
509 | | height = _height; |
510 | | dst -= _ypitch; |
511 | | y = _ypostop; |
512 | | if (_scaleIndexXStep != 1) { |
513 | | maskbit <<= 1; |
514 | | if (!maskbit) { |
515 | | maskbit = 1; |
516 | | _mask_ptr--; |
517 | | } |
518 | | } else { |
519 | | maskbit >>= 1; |
520 | | if (!maskbit) { |
521 | | maskbit = 0x80; |
522 | | _mask_ptr++; |
523 | | } |
524 | | } |
525 | | mask = _mask_ptr; |
526 | | } |
527 | | StartPos:; |
528 | | } while (--len); |
529 | | } while (1); |
530 | | } |
531 | | |
559 | | if (cost_scaleTable[_scaleIndexY++] < _scaleY) { |
560 | | if (color && y < _outheight && !((*mask | mask[_imgbufoffs]) & maskbit)) { |
561 | | pcolor = _palette[color]; |
562 | | if (pcolor == 13 && _shadow_table) |
563 | | pcolor = _shadow_table[*dst]; |
564 | | *dst = pcolor; |
565 | | } |
566 | | dst += _vm->_screenWidth; |
567 | | mask += _numStrips; |
568 | | y++; |
569 | | } |
570 | | if (!--height) { |
571 | | if (!--width) |
572 | | return; |
573 | | height = _height; |
574 | | y = _ypostop; |
575 | | _scaleIndexY = _scaleIndexYTop; |
576 | | t = _scaleIndexX; |
577 | | _scaleIndexX = t + _scaleIndexXStep; |
578 | | if (cost_scaleTable[t] < _scaleX) { |
579 | | _xpos += _scaleIndexXStep; |
580 | | if (_xpos < 0 || _xpos >= _vm->_screenWidth) |
581 | | return; |
582 | | maskbit = revBitMask[_xpos & 7]; |
583 | | _backbuff_ptr += _scaleIndexXStep; |
584 | | } |
585 | | dst = _backbuff_ptr; |
586 | | mask = _mask_ptr + (_xpos >> 3); |
587 | | } |
588 | | StartPos:; |
589 | | } while (--len); |
590 | | } while (1); |
591 | | } |
592 | | |
593 | | void CostumeRenderer::proc2() { |
594 | | byte *mask, *src, *dst; |
595 | | byte maskbit, len, height, pcolor, width; |
596 | | int color, t; |
597 | | uint y; |
598 | | |
599 | | mask = _mask_ptr_dest; |
600 | | maskbit = revBitMask[_xpos & 7]; |
601 | | y = _ypos; |
602 | | src = _srcptr; |
603 | | dst = _backbuff_ptr; |
604 | | len = _replen; |
605 | | color = _repcolor; |
606 | | height = _height2; |
607 | | width = _width2; |
608 | | |
609 | | if (_docontinue) |
610 | | goto StartPos; |
611 | | |
612 | | do { |
613 | | len = *src++; |
614 | | color = len >> _shrval; |
615 | | len &= _maskval; |
616 | | if (!len) |
617 | | len = *src++; |
618 | | |
619 | | do { |
620 | | if (cost_scaleTable[_scaleIndexY++] < _scaleY) { |
621 | | if (color && y < _outheight && !(*mask & maskbit)) { |
622 | | pcolor = _palette[color]; |
623 | | if (pcolor == 13 && _shadow_table) |
624 | | pcolor = _shadow_table[*dst]; |
| 336 | if (_scaleY == 255 || cost_scaleTable[_scaleIndexY++] < _scaleY) { |
| 337 | masked = (_use_mask && (mask[_imgbufoffs] & maskbit)) || (_use_charset_mask && (mask[0] & maskbit)); |
| 338 | |
| 339 | if (color && y < _outheight && !masked) { |
| 340 | // FIXME: Fully implement _shadow_mode. |
| 341 | // For now, it's enough for Sam & Max |
| 342 | // transparency. |
| 343 | if (_shadow_mode & 0x20) { |
| 344 | pcolor = _vm->_proc_special_palette[*dst]; |
| 345 | } else { |
| 346 | pcolor = _palette[color]; |
| 347 | if (pcolor == 13 && _shadow_table) |
| 348 | pcolor = _shadow_table[*dst]; |
| 349 | } |
654 | | void CostumeRenderer::proc1() { |
655 | | byte *mask, *src, *dst, *dstorg; |
656 | | byte maskbit, len, height, pcolor, width; |
657 | | int color, t; |
658 | | uint y; |
659 | | |
660 | | mask = _mask_ptr = _mask_ptr_dest; |
661 | | maskbit = revBitMask[_xpos & 7]; |
662 | | y = _ypos; |
663 | | src = _srcptr; |
664 | | dstorg = dst = _backbuff_ptr; |
665 | | len = _replen; |
666 | | color = _repcolor; |
667 | | height = _height2; |
668 | | width = _width2; |
669 | | |
670 | | if (_docontinue) |
671 | | goto StartPos; |
672 | | |
673 | | do { |
674 | | len = *src++; |
675 | | color = len >> _shrval; |
676 | | len &= _maskval; |
677 | | if (!len) |
678 | | len = *src++; |
679 | | |
680 | | do { |
681 | | if (cost_scaleTable[_scaleIndexY++] < _scaleY) { |
682 | | if (color && y < _outheight) { |
683 | | pcolor = _palette[color]; |
684 | | if (pcolor == 13 && _shadow_table) |
685 | | pcolor = _shadow_table[*dst]; |
686 | | *dst = pcolor; |
687 | | } |
688 | | dst += _vm->_screenWidth; |
689 | | y++; |
690 | | } |
691 | | if (!--height) { |
692 | | if (!--width) |
693 | | return; |
694 | | height = _height; |
695 | | y = _ypostop; |
696 | | _scaleIndexY = _scaleIndexYTop; |
697 | | t = _scaleIndexX; |
698 | | _scaleIndexX = t + _scaleIndexXStep; |
699 | | if (cost_scaleTable[t] < _scaleX) { |
700 | | _xpos += _scaleIndexXStep; |
701 | | if (_xpos < 0 || _xpos >= _vm->_screenWidth) |
702 | | return; |
703 | | _backbuff_ptr += _scaleIndexXStep; |
704 | | } |
705 | | dst = _backbuff_ptr; |
706 | | } |
707 | | StartPos:; |
708 | | } while (--len); |
709 | | } while (1); |
710 | | } |
711 | | |
712 | | void CostumeRenderer::proc6_ami() { |
713 | | byte len; |
714 | | byte *src, *dst; |
715 | | byte width, height, pcolor; |
716 | | int color; |
717 | | int step = _scaleIndexXStep; |
718 | | int x; |
719 | | int y; |
720 | | int scrheight; |
721 | | |
722 | | x = _xpos; |
723 | | y = _ypos; |
724 | | src = _srcptr; |
725 | | dst = _backbuff_ptr; |
726 | | scrheight = _outheight; |
727 | | width = _width; |
728 | | height = _height2; |
729 | | |
730 | | do { |
731 | | len = *src++; |
732 | | color = len >> _shrval; |
733 | | len &= _maskval; |
734 | | if (!len) |
735 | | len = *src++; |
736 | | |
737 | | do { |
738 | | if (color && x >= 0 && x < _vm->_screenWidth) { |
739 | | pcolor = _palette[color]; |
740 | | /* if (pcolor == 13 && _shadow_table) |
741 | | pcolor = _shadow_table[*dst];*/ |
742 | | *dst = pcolor; |
743 | | } |
744 | | |
745 | | dst += step; |
746 | | x += step; |
747 | | if (!--width) { |
748 | | if (!--height) |
749 | | return; |
750 | | width = _width; |
751 | | dst += _vm->_screenWidth - step * _width; |
752 | | x = _xpos; |
753 | | y++; |
754 | | if (y >= scrheight) |
755 | | return; |
756 | | } |
757 | | } while (--len); |
758 | | } while (1); |
759 | | } |
760 | | |
761 | | void CostumeRenderer::proc5_ami() { |
762 | | byte *mask, *src, *dst; |
763 | | byte maskbit, len, width, height, pcolor; |
764 | | uint y, scrheight; |
765 | | int color, x; |
766 | | int step = _scaleIndexXStep; |
767 | | |
768 | | mask = _mask_ptr = _mask_ptr_dest; |
769 | | maskbit = revBitMask[_xpos & 7]; |
770 | | x = _xpos; |
771 | | y = _ypos; |
772 | | src = _srcptr; |
773 | | dst = _backbuff_ptr; |
774 | | scrheight = _outheight; |
775 | | width = _width; |
776 | | height = _height2; |
777 | | |
778 | | do { |
779 | | len = *src++; |
780 | | color = len >> _shrval; |
781 | | len &= _maskval; |
782 | | if (!len) |
783 | | len = *src++; |
784 | | |
785 | | do { |
786 | | if (color && x >=0 && x < _vm->_screenWidth && !(*mask & maskbit)) { |
787 | | pcolor = _palette[color]; |
788 | | /* if (pcolor == 13 && _shadow_table) |
789 | | pcolor = _shadow_table[*dst];*/ |
790 | | *dst = pcolor; |
791 | | } |
792 | | dst += step; |
793 | | x += step; |
794 | | if (step != 1) { |
795 | | maskbit <<= 1; |
796 | | if (!maskbit) |
797 | | { |
798 | | maskbit = 1; |
799 | | mask--; |
800 | | } |
801 | | } else { |
802 | | maskbit >>= 1; |
803 | | if (!maskbit) |
804 | | { |
805 | | maskbit = 0x80; |
806 | | mask++; |
807 | | } |
808 | | } |
809 | | if (!--width) { |
810 | | if (!--height) |
811 | | return; |
812 | | width = _width; |
813 | | x = _xpos; |
814 | | y++; |
815 | | dst += _vm->_screenWidth - step * _width; |
816 | | _mask_ptr += _numStrips; |
817 | | mask = _mask_ptr; |
818 | | maskbit = revBitMask[_xpos & 7]; |
819 | | if (y >= scrheight) |
820 | | return; |
821 | | } |
822 | | } while (--len); |
823 | | } while (1); |
824 | | } |
825 | | |
826 | | void CostumeRenderer::proc4_ami() { |
827 | | byte *mask, *src, *dst; |
828 | | byte maskbit, len, width, height, pcolor; |
829 | | uint y, scrheight; |
830 | | int color, x; |
831 | | int step = _scaleIndexXStep; |
832 | | |
833 | | mask = _mask_ptr = _mask_ptr_dest; |
834 | | maskbit = revBitMask[_xpos & 7]; |
835 | | x = _xpos; |
836 | | y = _ypos; |
837 | | src = _srcptr; |
838 | | dst = _backbuff_ptr; |
839 | | scrheight = _outheight; |
840 | | height = _height2; |
841 | | width = _width; |
842 | | |
843 | | do { |
844 | | len = *src++; |
845 | | color = len >> _shrval; |
846 | | len &= _maskval; |
847 | | if (!len) |
848 | | len = *src++; |
849 | | |
850 | | do { |
851 | | if (color && x >= 0 && x < _vm->_screenWidth && !((*mask | mask[_imgbufoffs]) & maskbit)) { |
852 | | pcolor = _palette[color]; |
853 | | /* if (pcolor == 13 && _shadow_table) |
854 | | pcolor = _shadow_table[*dst];*/ |
855 | | *dst = pcolor; |
856 | | } |
857 | | dst += step; |
858 | | x += step; |
859 | | if (step != 1) { |
860 | | maskbit <<= 1; |
861 | | if (!maskbit) { |
862 | | maskbit = 1; |
863 | | mask--; |
864 | | } |
865 | | } else { |
866 | | maskbit >>= 1; |
867 | | if (!maskbit) { |
868 | | maskbit = 0x80; |
869 | | mask++; |
870 | | } |
871 | | } |
872 | | if (!--width) { |
873 | | if (!--height) |
874 | | return; |
875 | | width = _width; |
876 | | y++; |
877 | | x = _xpos; |
878 | | dst += _vm->_screenWidth - step * _width; |
879 | | _mask_ptr += _numStrips; |
880 | | mask = _mask_ptr; |
881 | | maskbit = revBitMask[_xpos & 7]; |
882 | | if (y >= scrheight) |
883 | | return; |
884 | | } |
885 | | } while (--len); |
886 | | } while (1); |
887 | | } |
888 | | |
923 | | if (cost_scaleTable[t] < _scaleX) { |
924 | | _xpos += _scaleIndexXStep; |
925 | | dst += _scaleIndexXStep; |
926 | | maskbit = revBitMask[_xpos & 7]; |
927 | | } |
928 | | mask = _mask_ptr + (_xpos >> 3); |
929 | | } |
930 | | if (!--width) { |
931 | | if (!--height) |
932 | | return; |
933 | | |
934 | | if (y >= _outheight) |
935 | | return; |
936 | | |
937 | | if (_xpos != oldXpos) { |
938 | | dst += _vm->_screenWidth - (_xpos - oldXpos); |
939 | | _mask_ptr += _numStrips; |
940 | | mask = _mask_ptr; |
941 | | y++; |
942 | | } |
943 | | width = _width; |
944 | | _xpos = oldXpos; |
945 | | _scaleIndexX = oldScaleIndexX; |
946 | | _scaleIndexY++; |
947 | | } |
948 | | } while (--len); |
949 | | } while (1); |
950 | | } |
951 | | |
952 | | void CostumeRenderer::proc2_ami() { |
953 | | byte *mask, *src, *dst; |
954 | | byte maskbit, len, height, pcolor, width; |
955 | | int color, t; |
956 | | uint y; |
957 | | int oldXpos, oldScaleIndexX; |
958 | | |
959 | | mask = _mask_ptr_dest; |
960 | | dst = _backbuff_ptr; |
961 | | height = _height2; |
962 | | width = _width; |
963 | | src = _srcptr; |
964 | | maskbit = revBitMask[_xpos & 7]; |
965 | | y = _ypos; |
966 | | |
967 | | oldXpos = _xpos; |
968 | | oldScaleIndexX = _scaleIndexX; |
969 | | |
970 | | do { |
971 | | len = *src++; |
972 | | color = len >> _shrval; |
973 | | len &= _maskval; |
974 | | if (!len) |
975 | | len = *src++; |
976 | | do { |
977 | | if (cost_scaleTable[_scaleIndexY] < _scaleY) { |
978 | | if (color && _xpos >= 0 && _xpos < _vm->_screenWidth && !(*mask & maskbit)) { |
979 | | pcolor = _palette[color]; |
980 | | /* if (pcolor == 13 && _shadow_table) |
981 | | pcolor = _shadow_table[*dst];*/ |
982 | | *dst = pcolor; |
983 | | } |
984 | | t = _scaleIndexX; |
985 | | _scaleIndexX = t + _scaleIndexXStep; |
986 | | if (cost_scaleTable[t] < _scaleX) { |
| 413 | if (_scaleX == 255 || cost_scaleTable[t] < _scaleX) { |
1016 | | void CostumeRenderer::proc1_ami() { |
1017 | | byte *mask, *src, *dst; |
1018 | | byte maskbit, len, height, pcolor, width; |
1019 | | uint y; |
1020 | | int color; |
1021 | | int t, x; |
1022 | | int oldXpos, oldScaleIndexX; |
1023 | | |
1024 | | mask = _mask_ptr = _mask_ptr_dest; |
1025 | | maskbit = revBitMask[_xpos & 7]; |
1026 | | x = _xpos; |
1027 | | y = _ypos; |
1028 | | |
1029 | | dst = _backbuff_ptr; |
1030 | | height = _height2; |
1031 | | width = _width; |
1032 | | src = _srcptr; |
1033 | | |
1034 | | oldXpos = _xpos; |
1035 | | oldScaleIndexX = _scaleIndexX; |
1036 | | |
1037 | | do { |
1038 | | len = *src++; |
1039 | | color = len >> _shrval; |
1040 | | len &= _maskval; |
1041 | | if (!len) |
1042 | | len = *src++; |
1043 | | |
1044 | | do { |
1045 | | if (cost_scaleTable[_scaleIndexY] < _scaleY) { |
1046 | | if (color && _xpos >= 0 && _xpos < _vm->_screenWidth) { |
1047 | | pcolor = _palette[color]; |
1048 | | /* if (pcolor == 13 && _shadow_table) |
1049 | | pcolor = _shadow_table[*dst];*/ |
1050 | | *dst = pcolor; |
1051 | | } |
1052 | | |
1053 | | t = _scaleIndexX; |
1054 | | _scaleIndexX = t + _scaleIndexXStep; |
1055 | | if (cost_scaleTable[t] < _scaleX) { |
1056 | | _xpos += _scaleIndexXStep; |
1057 | | dst += _scaleIndexXStep; |
1058 | | } |
1059 | | } |
1060 | | if (!--width) { |
1061 | | if (!--height) |
1062 | | return; |
1063 | | |
1064 | | if (y >= _outheight) |
1065 | | return; |
1066 | | |
1067 | | if (_xpos != oldXpos) { |
1068 | | dst += _vm->_screenWidth - (_xpos - oldXpos); |
1069 | | y++; |
1070 | | } |
1071 | | width = _width; |
1072 | | _xpos = oldXpos; |
1073 | | _scaleIndexX = oldScaleIndexX; |
1074 | | _scaleIndexY++; |
1075 | | } |
1076 | | } while (--len); |
1077 | | } while (1); |
1078 | | } |
1079 | | |
1080 | | void CostumeRenderer::proc_special(byte mask2) { |
1081 | | byte *mask, *src, *dst, *dstorg; |
1082 | | byte maskbit, len, height, pcolor, width; |
1083 | | uint y; |
1084 | | int color; |
1085 | | int t; |
1086 | | |
1087 | | byte shadow1; |
1088 | | byte shadow2; |
1089 | | byte shadow3; |
1090 | | byte shadow4; |
1091 | | byte shadow5; |
1092 | | |
1093 | | shadow1 = _shadow_mode & 0x80; |
1094 | | shadow2 = _shadow_mode & 0x40; |
1095 | | shadow3 = _shadow_mode & 0x20; |
1096 | | shadow4 = _shadow_mode & 0x10; |
1097 | | shadow5 = _shadow_mode & 0x0F; |
1098 | | |
1099 | | mask = _mask_ptr = _mask_ptr_dest; |
1100 | | maskbit = revBitMask[_xpos & 7]; |
1101 | | y = _ypos; |
1102 | | |
1103 | | mask = _mask_ptr_dest; |
1104 | | dstorg = dst = _backbuff_ptr; |
1105 | | height = _height2; |
1106 | | width = _width2; |
1107 | | len = _replen; |
1108 | | color = _repcolor; |
1109 | | src = _srcptr; |
1110 | | |
1111 | | if (_mirror == 0) |
1112 | | shadow5 = -shadow5; |
1113 | | |
1114 | | maskbit = revBitMask[_xpos & 7]; |
1115 | | |
1116 | | dst = _backbuff_ptr; |
1117 | | |
1118 | | if (mask2 != 0 && mask2 < 3) |
1119 | | _imgbufoffs = 0; |
1120 | | |
1121 | | if (_docontinue) |
1122 | | goto StartPos; |
1123 | | |
1124 | | do { |
1125 | | len = *src++; |
1126 | | color = len >> _shrval; |
1127 | | len &= _maskval; |
1128 | | if (!len) |
1129 | | len = *src++; |
1130 | | |
1131 | | do { // ok |
1132 | | if (cost_scaleTable[_scaleIndexY++] < _scaleY) { |
1133 | | if (color && y < _outheight) { |
1134 | | if (!mask2 || (mask2 && !((*mask | mask[_imgbufoffs]) & maskbit))) { |
1135 | | if (shadow3 == 0) { |
1136 | | pcolor = _palette[color]; |
1137 | | if (pcolor != 13) |
1138 | | goto proc_special_end; |
1139 | | |
1140 | | } |
1141 | | if (shadow2 != 0) { |
1142 | | warning("proc_special: shadow2 unimplemented"); |
1143 | | pcolor = 0; |
1144 | | } else // we don't need all the random stuff, just the background copy |
1145 | | { |
1146 | | pcolor = _vm->_proc_special_palette[*dst]; |
1147 | | } |
1148 | | proc_special_end:; |
1149 | | *dst = pcolor; |
1150 | | } |
1151 | | } |
1152 | | dst += _vm->_screenWidth; |
1153 | | mask += _numStrips; |
1154 | | y++; |
1155 | | } |
1156 | | if (!--height) { |
1157 | | if (!--width) |
1158 | | return; |
1159 | | height = _height; |
1160 | | y = _ypostop; |
1161 | | _scaleIndexY = _scaleIndexYTop; |
1162 | | t = _scaleIndexX; |
1163 | | _scaleIndexX = t + _scaleIndexXStep; |
1164 | | if (cost_scaleTable[t] < _scaleX) { |
1165 | | _xpos += _scaleIndexXStep; |
1166 | | if (_xpos < 0 || _xpos >= _vm->_screenWidth) |
1167 | | return; |
1168 | | maskbit = revBitMask[_xpos & 7]; |
1169 | | _backbuff_ptr += _scaleIndexXStep; |
1170 | | } |
1171 | | dst = _backbuff_ptr; |
1172 | | mask = _mask_ptr + (_xpos >> 3); |
1173 | | } |
1174 | | StartPos:; |
1175 | | } while (--len); |
1176 | | } while (1); |
1177 | | } |
1178 | | |