diff -ur ScummVM-cvs20021007/scummvm/scumm/akos.cpp ScummVM-cvs20021007+hack/scummvm/scumm/akos.cpp
old
|
new
|
|
859 | 859 | |
860 | 860 | void AkosRenderer::codec5() |
861 | 861 | { |
862 | | VirtScreen *vs; |
863 | | |
864 | 862 | int left, right, top, bottom; |
865 | | int clip_left, clip_right, clip_top, clip_bottom; |
| 863 | int clip_top, clip_bottom; |
| 864 | int screen_width = (int) outwidth; |
| 865 | int screen_height = (int) outheight; |
866 | 866 | |
867 | 867 | byte *src, *dest; |
868 | 868 | int src_x, src_y; |
… |
… |
|
880 | 880 | // What I do know is that drawBomp() doesn't care about masking and |
881 | 881 | // shadows, and these are both needed for Full Throttle and The Dig. |
882 | 882 | |
883 | | vs = &_vm->virtscr[0]; |
884 | | |
885 | 883 | if (!mirror) { |
886 | 884 | left = (x - move_x_cur - width) + 1; |
887 | 885 | } else { |
… |
… |
|
892 | 890 | top = y + move_y_cur; |
893 | 891 | bottom = top + height; |
894 | 892 | |
895 | | if (left >= _vm->_realWidth || top >= _vm->_realHeight) |
| 893 | if (left >= screen_width || top >= screen_height) |
896 | 894 | return; |
897 | 895 | |
| 896 | _vm->updateDirtyRect(0, left, right, top, bottom, 1 << dirty_id); |
| 897 | |
898 | 898 | // The actual drawing code shouldn't survive even if the image is |
899 | | // partially outside the screen, but something before that seems to |
900 | | // be less tolerant... |
| 899 | // partially outside the screen, but I used to have trouble with |
| 900 | // crashes here so other functions may be less tolerant... |
901 | 901 | |
902 | | clip_left = (left >= 0) ? left : 0; |
903 | | clip_right = (right > _vm->_realWidth) ? _vm->_realWidth : right; |
904 | 902 | clip_top = (top >= 0) ? top : 0; |
905 | | clip_bottom = (bottom > _vm->_realHeight) ? _vm->_realHeight : bottom; |
906 | | |
| 903 | clip_bottom = (bottom > screen_height) ? screen_height : bottom; |
| 904 | |
907 | 905 | if (clip_top < draw_top) |
908 | 906 | draw_top = clip_top; |
909 | 907 | if (clip_bottom > draw_bottom) |
910 | 908 | draw_bottom = clip_bottom; |
911 | 909 | |
912 | | _vm->updateDirtyRect(0, clip_left, clip_right, clip_top, clip_bottom, 1 << dirty_id); |
913 | | |
914 | 910 | masking = false; |
915 | 911 | if (clipping) { |
916 | | masking = _vm->isMaskActiveAt(clip_left, clip_top, clip_right, clip_bottom, |
| 912 | masking = _vm->isMaskActiveAt(left, top, right, clip_bottom, |
917 | 913 | _vm->getResourceAddress(rtBuffer, 9) + |
918 | 914 | _vm->gdi._imgBufOffs[clipping] + |
919 | 915 | _vm->_screenStartStrip) != 0; |
… |
… |
|
936 | 932 | for (src_y = 0, dst_y = top; src_y < height; src_y++) { |
937 | 933 | byte code, color; |
938 | 934 | uint num, i; |
939 | | byte *d = dest + dst_y * _vm->_realWidth + left; |
| 935 | byte *d = dest + dst_y * screen_width + left; |
940 | 936 | byte *s; |
941 | 937 | uint data_length; |
942 | 938 | |
943 | 939 | data_length = READ_LE_UINT16(src) + 2; |
944 | 940 | |
945 | | if (dst_y < 0 || dst_y >= _vm->_realHeight) { |
| 941 | if (dst_y < 0 || dst_y >= screen_height) { |
946 | 942 | src += data_length; |
947 | 943 | dst_y++; |
948 | 944 | continue; |
… |
… |
|
958 | 954 | if (code & 1) { |
959 | 955 | color = *s++; |
960 | 956 | for (i = 0; i < num; i++) { |
961 | | if (dst_x >= 0 && dst_x < _vm->_realWidth) { |
| 957 | if (dst_x >= 0 && dst_x < screen_width) { |
962 | 958 | if (color != 255) { |
963 | 959 | if (v1.mask_ptr) |
964 | 960 | mask = v1.mask_ptr + 40 * dst_y + (dst_x >> 3); |
… |
… |
|
976 | 972 | } else { |
977 | 973 | for (i = 0; i < num; i++) { |
978 | 974 | color = s[i]; |
979 | | if (dst_x >= 0 && dst_x < _vm->_realWidth) { |
| 975 | if (dst_x >= 0 && dst_x < screen_width) { |
980 | 976 | if (color != 255) { |
981 | 977 | if (v1.mask_ptr) |
982 | 978 | mask = v1.mask_ptr + 40 * dst_y + (dst_x >> 3); |