-static void blitplayer(struct PLAYER *ply) {
- unsigned int x, y, dx, dy;
- unsigned short obj, spr;
-
- xdebug("blitplayer");
-
- if(ply->alive) {
- x = (frame * ply->oldx + (8 - frame) * ply->x) * TILEX / 8; dx = x + TILEX - 1;
- y = (frame * ply->oldy + (8 - frame) * ply->y) * TILEY / 8; dy = y + TILEY - 1;
- if((unsigned int)(dx - screen_x) < (21 * TILEX - 1) && (unsigned int)(dy - screen_y) < (13 * TILEY - 1)) {
- spr = map_spr[ply->num][frame][ply->anim];
- x %= 22 * TILEX; dx %= 22 * TILEX;
- y %= 14 * TILEY; dy %= 14 * TILEY;
- if(objmaskBitmap) {
- obj = screen[y / TILEY][x / TILEX];
- XCopyArea(display, objmaskBitmap, spriteBitmap, spriteGC, (obj / 512) * TILEX, (obj % 512) * TILEY / 16, TILEX, TILEY, -(x % TILEX), -(y % TILEY));
- obj = screen[dy / TILEY][dx / TILEX];
- XCopyArea(display, objmaskBitmap, spriteBitmap, spriteGC, (obj / 512) * TILEX, (obj % 512) * TILEY / 16, TILEX, TILEY, (22 * TILEX - x) % TILEX, (14 * 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);
- }
- screen[y / TILEY][x / TILEX] = -1; /* mark screen as dirty */
- screen[dy / TILEY][dx / TILEX] = -1;
- XSetClipMask(display, screenGC, spriteBitmap);
- XSetClipOrigin(display, screenGC, x, y);
- XCopyArea(display, sprPixmap, screenPixmap, screenGC, (spr / 8) * TILEX, (spr % 8) * TILEY, TILEX, TILEY, x, y);
- XSetClipOrigin(display, screenGC, x - 22 * TILEX, y);
- XCopyArea(display, sprPixmap, screenPixmap, screenGC, (spr / 8) * TILEX, (spr % 8) * TILEY, TILEX, TILEY, x - 22 * TILEX, y);
- XSetClipOrigin(display, screenGC, x, y - 14 * TILEY);
- XCopyArea(display, sprPixmap, screenPixmap, screenGC, (spr / 8) * TILEX, (spr % 8) * TILEY, TILEX, TILEY, x, y - 14 * TILEY);
- XSetClipMask(display, screenGC, None);
- }
- }
+static void blitplayer(struct PLAYER *ply)
+{
+ unsigned int x, y, dx, dy;
+ unsigned short obj, spr;
+
+ xdebug("blitplayer");
+
+ if (ply->alive)
+ {
+ x = (frame * ply->oldx + (8 - frame) * ply->x) * TILEX / 8;
+ y = (frame * ply->oldy + (8 - frame) * ply->y) * TILEY / 8;
+ dx = x + TILEX - 1;
+ dy = y + TILEY - 1;
+
+ if ((unsigned int)(dx - screen_x) < (21 * TILEX - 1) &&
+ (unsigned int)(dy - screen_y) < (13 * TILEY - 1))
+ {
+ spr = map_spr[ply->num][frame][ply->anim];
+ x %= 22 * TILEX;
+ y %= 14 * TILEY;
+ dx %= 22 * TILEX;
+ dy %= 14 * TILEY;
+
+ 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,
+ (22 * TILEX - x) % TILEX, (14 * 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;
+
+ XSetClipMask(display, screenGC, spriteBitmap);
+ XSetClipOrigin(display, screenGC, x, y);
+ XCopyArea(display, sprPixmap, screenPixmap, screenGC,
+ (spr / 8) * TILEX, (spr % 8) * TILEY, TILEX, TILEY,
+ x, y);
+ XSetClipOrigin(display, screenGC, x - 22 * TILEX, y);
+ XCopyArea(display, sprPixmap, screenPixmap, screenGC,
+ (spr / 8) * TILEX, (spr % 8) * TILEY, TILEX, TILEY,
+ x - 22 * TILEX, y);
+ XSetClipOrigin(display, screenGC, x, y - 14 * TILEY);
+ XCopyArea(display, sprPixmap, screenPixmap, screenGC,
+ (spr / 8) * TILEX, (spr % 8) * TILEY, TILEX, TILEY,
+ x, y - 14 * TILEY);
+ XSetClipMask(display, screenGC, None);
+ }
+ }