- if (objmaskBitmap)
- {
- obj = screentiles[y / TILEY][x / TILEX];
- XCopyArea(display, objmaskBitmap, spriteBitmap, spriteGC,
- (obj / 512) * TILEX, (obj % 512) * TILEY / 16, TILEX, TILEY,
- -(x % TILEX), -(y % TILEY));
-
- obj = screentiles[dy / TILEY][dx / TILEX];
- XCopyArea(display, objmaskBitmap, spriteBitmap, spriteGC,
- (obj / 512) * TILEX, (obj % 512) * TILEY / 16, TILEX, TILEY,
- (MAX_BUF_XSIZE * TILEX - x) % TILEX,
- (MAX_BUF_YSIZE * TILEY - y) % TILEY);
- }
- else if (sprmaskBitmap)
- {
- XCopyArea(display, sprmaskBitmap, spriteBitmap, spriteGC,
- (spr / 8) * TILEX, (spr % 8) * TILEY, TILEX, TILEY, 0, 0);
- }
- else
- {
- XFillRectangle(display, spriteBitmap, spriteGC, 0, 0, TILEX, TILEY);
- }
-
- screentiles[y / TILEY][x / TILEX] = -1; /* mark screen as dirty */
- screentiles[dy / TILEY][dx / TILEX] = -1;
-
-#if 1
-
-
-#if 1
-
- SetClipMask(sprBitmap, sprBitmap->stored_clip_gc, spriteBitmap);
-
- SetClipOrigin(sprBitmap, sprBitmap->stored_clip_gc, x, y);
- BlitBitmapMasked(sprBitmap, screenBitmap,
- (spr / 8) * TILEX, (spr % 8) * TILEY, TILEX, TILEY,
- x, y);
-
- SetClipOrigin(sprBitmap, sprBitmap->stored_clip_gc,
- x - MAX_BUF_XSIZE * TILEX, y);
- BlitBitmapMasked(sprBitmap, screenBitmap,
- (spr / 8) * TILEX, (spr % 8) * TILEY, TILEX, TILEY,
- x - MAX_BUF_XSIZE * TILEX, y);
-
- SetClipOrigin(sprBitmap, sprBitmap->stored_clip_gc,
- x, y - MAX_BUF_YSIZE * TILEY);
- BlitBitmapMasked(sprBitmap, screenBitmap,
- (spr / 8) * TILEX, (spr % 8) * TILEY, TILEX, TILEY,
- x, y - MAX_BUF_YSIZE * TILEY);
-
- SetClipMask(sprBitmap, sprBitmap->stored_clip_gc, None);
-
-#else
+ if ((unsigned int)(x2 - screen_x) < ((MAX_BUF_XSIZE - 1) * TILEX - 1) &&
+ (unsigned int)(y2 - screen_y) < ((MAX_BUF_YSIZE - 1) * TILEY - 1))
+ {
+ /* some casts to "int" are needed because of negative calculation values */
+ int dx = (int)ply->x - (int)ply->oldx;
+ int dy = (int)ply->y - (int)ply->oldy;
+ int old_x = (int)ply->oldx + (7 - (int)frame) * dx / 8;
+ int old_y = (int)ply->oldy + (7 - (int)frame) * dy / 8;
+ int new_x = old_x + SIGN(dx);
+ int new_y = old_y + SIGN(dy);
+ int old_sx = old_x % MAX_BUF_XSIZE;
+ int old_sy = old_y % MAX_BUF_XSIZE;
+ int new_sx = new_x % MAX_BUF_XSIZE;
+ int new_sy = new_y % MAX_BUF_XSIZE;
+#if 0
+ int old_crm = crumbled_state[old_sy][old_sx];
+#endif
+ int new_crm = crumbled_state[new_sy][new_sx];