aboutsummaryrefslogtreecommitdiff
path: root/engines
diff options
context:
space:
mode:
authorEugene Sandulenko2007-09-04 11:20:42 +0000
committerEugene Sandulenko2007-09-04 11:20:42 +0000
commit0d279e8de07fc5137266fb8793dba05e14fccd0b (patch)
tree0754fb79cadfa97c339cf24cbf129b93dbba272a /engines
parent7389396a7f8ceb54c65370f80a23e04a59181d71 (diff)
downloadscummvm-rg350-0d279e8de07fc5137266fb8793dba05e14fccd0b.tar.gz
scummvm-rg350-0d279e8de07fc5137266fb8793dba05e14fccd0b.tar.bz2
scummvm-rg350-0d279e8de07fc5137266fb8793dba05e14fccd0b.zip
- Replace plotPattern() function with one based on specs.
- Add PreAGI differences to plotPattern function. - This effectively fixes Mickey title. svn-id: r28850
Diffstat (limited to 'engines')
-rw-r--r--engines/agi/picture.cpp169
1 files changed, 99 insertions, 70 deletions
diff --git a/engines/agi/picture.cpp b/engines/agi/picture.cpp
index 908b356b1a..715c7349a7 100644
--- a/engines/agi/picture.cpp
+++ b/engines/agi/picture.cpp
@@ -44,43 +44,6 @@ static uint8 scrOn;
static uint8 scrColour;
static uint8 priColour;
-static const uint8 circles[][15] = { /* agi circle bitmaps */
- {0x80},
- /* {0xfc}, */
- { 3 << 4 }, /* pattern data different from specs. fixes gold rush. does not seem to break any other v3 games */
- {0x5f, 0xf4},
- {0x66, 0xff, 0xf6, 0x60},
- {0x23, 0xbf, 0xff, 0xff, 0xee, 0x20},
- {0x31, 0xe7, 0x9e, 0xff, 0xff, 0xde, 0x79, 0xe3, 0x00},
- {0x38, 0xf9, 0xf3, 0xef, 0xff, 0xff, 0xff, 0xfe, 0xf9, 0xf3, 0xe3, 0x80},
- {0x18, 0x3c, 0x7e, 0x7e, 0x7e, 0xff, 0xff, 0xff, 0xff, 0xff, 0x7e, 0x7e, 0x7e, 0x3c, 0x18}
-};
-
-static const uint8 splatterMap[32] = { /* splatter brush bitmaps */
- 0x20, 0x94, 0x02, 0x24, 0x90, 0x82, 0xa4, 0xa2,
- 0x82, 0x09, 0x0a, 0x22, 0x12, 0x10, 0x42, 0x14,
- 0x91, 0x4a, 0x91, 0x11, 0x08, 0x12, 0x25, 0x10,
- 0x22, 0xa8, 0x14, 0x24, 0x00, 0x50, 0x24, 0x04
-};
-
-static const uint8 splatterStart[128] = { /* starting bit position */
- 0x00, 0x18, 0x30, 0xc4, 0xdc, 0x65, 0xeb, 0x48,
- 0x60, 0xbd, 0x89, 0x05, 0x0a, 0xf4, 0x7d, 0x7d,
- 0x85, 0xb0, 0x8e, 0x95, 0x1f, 0x22, 0x0d, 0xdf,
- 0x2a, 0x78, 0xd5, 0x73, 0x1c, 0xb4, 0x40, 0xa1,
- 0xb9, 0x3c, 0xca, 0x58, 0x92, 0x34, 0xcc, 0xce,
- 0xd7, 0x42, 0x90, 0x0f, 0x8b, 0x7f, 0x32, 0xed,
- 0x5c, 0x9d, 0xc8, 0x99, 0xad, 0x4e, 0x56, 0xa6,
- 0xf7, 0x68, 0xb7, 0x25, 0x82, 0x37, 0x3a, 0x51,
- 0x69, 0x26, 0x38, 0x52, 0x9e, 0x9a, 0x4f, 0xa7,
- 0x43, 0x10, 0x80, 0xee, 0x3d, 0x59, 0x35, 0xcf,
- 0x79, 0x74, 0xb5, 0xa2, 0xb1, 0x96, 0x23, 0xe0,
- 0xbe, 0x05, 0xf5, 0x6e, 0x19, 0xc5, 0x66, 0x49,
- 0xf0, 0xd1, 0x54, 0xa9, 0x70, 0x4b, 0xa4, 0xe2,
- 0xe6, 0xe5, 0xab, 0xe4, 0xd2, 0xaa, 0x4c, 0xe3,
- 0x06, 0x6f, 0xc6, 0x4a, 0xa4, 0x75, 0x97, 0xe1
-};
-
void PictureMgr::putVirtPixel(int x, int y) {
uint8 *p;
@@ -432,43 +395,109 @@ void PictureMgr::fill() {
** on the pattern code.
**************************************************************************/
-int PictureMgr::plotPatternPoint(int x, int y, int bitpos) {
- if (patCode & 0x20) {
- if ((splatterMap[bitpos >> 3] >> (7 - (bitpos & 7))) & 1) {
- putVirtPixel(x, y);
- }
- bitpos++;
- if (bitpos == 0xff)
- bitpos = 0;
- } else
- putVirtPixel(x, y);
-
- return bitpos;
-}
-
void PictureMgr::plotPattern(int x, int y) {
- int32 circlePos = 0;
- uint32 x1, y1, pensize, bitpos = splatterStart[patNum];
-
- pensize = (patCode & 7);
-
- if (x < (int)pensize)
- x = pensize - 1;
- if (y < (int)pensize)
- y = pensize;
-
- for (y1 = y - pensize; y1 <= y + pensize; y1++) {
- for (x1 = x - (pensize + 1) / 2; x1 <= x + pensize / 2; x1++) {
- if (patCode & 0x10) { /* Square */
- bitpos = plotPatternPoint (x1, y1, bitpos);
- } else { /* Circle */
- if ((circles[patCode & 7][circlePos >> 3] >> (7 - (circlePos & 7))) & 1) {
- bitpos = plotPatternPoint(x1, y1, bitpos);
- }
- circlePos++;
+ static uint16 binary_list[] = {0x8000, 0x4000, 0x2000, 0x1000, 0x800, 0x400, 0x200, 0x100,
+ 0x80, 0x40, 0x20, 0x10, 0x8, 0x4, 0x2, 0x1};
+
+ static uint8 circle_list[] = {0, 1, 4, 9, 16, 25, 37, 50};
+
+ static uint16 circle_data[] =
+ {0x8000,
+ 0xE000, 0xE000, 0xE000,
+ 0x7000, 0xF800, 0x0F800, 0x0F800, 0x7000,
+ 0x3800, 0x7C00, 0x0FE00, 0x0FE00, 0x0FE00, 0x7C00, 0x3800,
+ 0x1C00, 0x7F00, 0x0FF80, 0x0FF80, 0x0FF80, 0x0FF80, 0x0FF80, 0x7F00, 0x1C00,
+ 0x0E00, 0x3F80, 0x7FC0, 0x7FC0, 0x0FFE0, 0x0FFE0, 0x0FFE0, 0x7FC0, 0x7FC0, 0x3F80, 0x1F00, 0x0E00,
+ 0x0F80, 0x3FE0, 0x7FF0, 0x7FF0, 0x0FFF8, 0x0FFF8, 0x0FFF8, 0x0FFF8, 0x0FFF8, 0x7FF0, 0x7FF0, 0x3FE0, 0x0F80,
+ 0x07C0, 0x1FF0, 0x3FF8, 0x7FFC, 0x7FFC, 0x0FFFE, 0x0FFFE, 0x0FFFE, 0x0FFFE, 0x0FFFE, 0x7FFC, 0x7FFC, 0x3FF8, 0x1FF0, 0x07C0};
+
+ uint16 circle_word;
+ uint16 *circle_ptr;
+ uint16 counter;
+ uint16 pen_width = 0;
+ int pen_final_x = 0;
+ int pen_final_y = 0;
+
+ uint8 t = 0;
+ uint8 temp8;
+ uint16 temp16;
+
+ int pen_x = x;
+ int pen_y = y;
+ uint16 texture_num = 0;
+ uint16 pen_size = (patCode & 0x07);
+
+ circle_ptr = &circle_data[circle_list[pen_size]];
+
+ // setup the X position
+ // = pen_x - pen.size/2
+
+ pen_x = (pen_x * 2) - pen_size;
+ if (pen_x < 0) pen_x = 0;
+
+ temp16 = 320 - (2 * pen_size);
+ if (pen_x >= temp16)
+ pen_x = temp16;
+
+ pen_x /= 2;
+ pen_final_x = pen_x; // original starting point?? -> used in plotrelated
+
+ // Setup the Y Position
+ // = pen_y - pen.size
+ pen_y = pen_y - pen_size;
+ if (pen_y < 0) pen_y = 0;
+
+ temp16 = 167 - (2 * pen_size);
+ if (pen_y >= temp16)
+ pen_y = temp16;
+
+ pen_final_y = pen_y; // used in plotrelated
+
+ t = (uint8)(texture_num | 0x01); // even
+
+ // new purpose for temp16
+
+ temp16 =( pen_size<<1) +1; // pen size
+ pen_final_y += temp16; // the last row of this shape
+ temp16 = temp16 << 1;
+ pen_width = temp16; // width of shape?
+
+ bool circleCond;
+ int counterStep;
+ int ditherCond;
+
+ if (_vm->getGameType() == GType_PreAGI) {
+ circleCond = ((patCode & 0x10) == 0);
+ counterStep = 3;
+ ditherCond = 0x03;
+ } else {
+ circleCond = ((patCode & 0x10) != 0);
+ counterStep = 4;
+ ditherCond = 0x02;
+ }
+
+ for (; pen_y < pen_final_y; pen_y++) {
+ circle_word = *circle_ptr++;
+
+ for (counter = 0; counter <= pen_width; counter += counterStep) {
+ //if (pic.fCircle) pen_status |= 0x10;
+ if (circleCond || ((binary_list[counter>>1] & circle_word) != 0)) {
+ temp8 = t % 2;
+ t = t >> 1;
+ if (temp8 != 0)
+ t = t ^ 0xB8;
+
+ // == box plot, != circle plot
+ if ((patCode & 0x20) == 0 || (t & 0x03) == ditherCond)
+ putVirtPixel(pen_x, pen_y);
}
+ pen_x++;
}
+
+ pen_x = pen_final_x;
}
+
+ return;
}
/**************************************************************************