Ticket #9147: plant-draw.patch
File plant-draw.patch, 1.8 KB (added by , 14 years ago) |
---|
-
costume.cpp
1212 1212 if (!width || !height) 1213 1213 return 0; 1214 1214 1215 int xpos = 0; 1216 int ypos = _loaded._maxHeight - offsetY; 1215 int xpos = _actorX + (flipped ? -1 : +1) * (offsetX * 8 - a->_width / 2); 1216 // +1 as we appear to be 1 pixel away from the original interpreter 1217 int ypos = _actorY - offsetY + 1; 1217 1218 1218 if (flipped) {1219 if (offsetX)1220 xpos += (offsetX - 1) * 8;1221 } else {1222 xpos += offsetX * 8;1223 }1224 1225 xpos += _actorX - (a->_width / 2);1226 ypos += (_actorY - _loaded._maxHeight) + 1; // +1 as we appear to be 1 pixel away from the original interpreter1227 1228 1219 // This code is very similar to procC64() 1229 1220 for (int y = 0; y < height; ++y) { 1230 1221 for (int x = 0; x < width; ++x) { 1231 1222 byte color = data[y * width + x]; 1232 1223 byte pcolor; 1233 int realX = 0;1234 if (flipped) {1235 if (offsetX == 0||offsetX == 1) {1236 realX = width-(x + 1);1237 } else if (offsetX == 2) {1238 realX = width-(x + 2);1239 }1240 } else {1241 realX = x;1242 }1243 1224 1244 int destY = y + ypos; 1245 int destX = realX * 8 + xpos; 1225 int destX = xpos + (flipped ? -(x + 1) : x) * 8; 1226 int destY = ypos + y; 1227 1246 1228 if (destY >= 0 && destY < _out.h && destX >= 0 && destX < _out.w) { 1247 1229 byte *dst = (byte *)_out.pixels + destY * _out.pitch + destX; 1248 1230 byte *mask = _vm->getMaskBuffer(0, destY, _zbuf); … … 1257 1239 1258 1240 _draw_top = MIN(_draw_top, ypos); 1259 1241 _draw_bottom = MAX(_draw_bottom, ypos + height); 1260 _vm->markRectAsDirty(kMainVirtScreen, xpos, xpos + (width * 8), ypos, ypos + height, _actorID); 1261 1242 if (flipped) 1243 _vm->markRectAsDirty(kMainVirtScreen, xpos - (width * 8), xpos, ypos, ypos + height, _actorID); 1244 else 1245 _vm->markRectAsDirty(kMainVirtScreen, xpos, xpos + (width * 8), ypos, ypos + height, _actorID); 1262 1246 return 0; 1263 1247 } 1264 1248