X-Git-Url: https://git.artsoft.org/?a=blobdiff_plain;f=src%2Fgame_em%2Fgraphics.c;h=99d8e3b9cc1b2532554bb264d97c25a379bdeaec;hb=d4758d12db28cd36edca33c9c7ab05476a8f85e7;hp=9a74308e62edabd699cbb2a12373a0ba06899d8c;hpb=f2b486caeabc0548dfa744c1569496c087b7420f;p=rocksndiamonds.git diff --git a/src/game_em/graphics.c b/src/game_em/graphics.c index 9a74308e..99d8e3b9 100644 --- a/src/game_em/graphics.c +++ b/src/game_em/graphics.c @@ -129,7 +129,7 @@ static void blitplayer(struct PLAYER *ply) { unsigned int x, y, dx, dy; unsigned short obj, spr; - int src_x, src_y, dest_x, dest_y; + int src_x, src_y, dst_x, dst_y; if (!ply->alive) return; @@ -143,8 +143,8 @@ static void blitplayer(struct PLAYER *ply) (unsigned int)(dy - screen_y) < ((MAX_BUF_YSIZE - 1) * TILEY - 1)) { spr = map_spr[ply->num][frame][ply->anim]; - x %= MAX_BUF_XSIZE * TILEX; - y %= MAX_BUF_YSIZE * TILEY; + x %= MAX_BUF_XSIZE * TILEX; + y %= MAX_BUF_YSIZE * TILEY; dx %= MAX_BUF_XSIZE * TILEX; dy %= MAX_BUF_YSIZE * TILEY; @@ -166,25 +166,96 @@ static void blitplayer(struct PLAYER *ply) obj = screentiles[y / TILEY][x / TILEX]; src_x = (obj / 512) * TILEX; src_y = (obj % 512) * TILEY / 16; - dest_x = (x / TILEX) * TILEX; - dest_y = (y / TILEY) * TILEY; + dst_x = (x / TILEX) * TILEX; + dst_y = (y / TILEY) * TILEY; +#if 1 +#if 0 + { + int tile = Draw[ply->oldy][ply->oldx]; + struct GraphicInfo_EM *g = &graphic_info_em[tile][frame]; + + if (g->width > 0 && g->height > 0) + { + src_x = g->src_x + g->src_offset_x; + src_y = g->src_y + g->src_offset_y; + dst_x = ply->oldx % MAX_BUF_XSIZE * TILEX + g->dst_offset_x; + dst_y = ply->oldy % MAX_BUF_YSIZE * TILEY + g->dst_offset_y; + + SetClipOrigin(g->bitmap, g->bitmap->stored_clip_gc, + dst_x - src_x, dst_y - src_y); + BlitBitmapMasked(g->bitmap, screenBitmap, + src_x, src_y, g->width, g->height, dst_x, dst_y); + } + } +#else SetClipOrigin(objBitmap, objBitmap->stored_clip_gc, - dest_x - src_x, dest_y - src_y); + dst_x - src_x, dst_y - src_y); BlitBitmapMasked(objBitmap, screenBitmap, - src_x, src_y, TILEX, TILEY, dest_x, dest_y); + src_x, src_y, TILEX, TILEY, dst_x, dst_y); +#endif +#endif /* draw the field the player is moving to (masked over the player) */ obj = screentiles[dy / TILEY][dx / TILEX]; src_x = (obj / 512) * TILEX; src_y = (obj % 512) * TILEY / 16; - dest_x = (dx / TILEX) * TILEX; - dest_y = (dy / TILEY) * TILEY; + dst_x = (dx / TILEX) * TILEX; + dst_y = (dy / TILEY) * TILEY; +#if 1 +#if 1 + { + /* + d? == 1: + 0-3: 0, 1 + 4-7: 0, 1 + + d? == 2: + 0-3: 0, 1 + 4-7: 1, 2 + */ + + int dx = (ply->x - ply->oldx); + int dy = (ply->y - ply->oldy); + int old_x = ply->oldx ; + int old_y = ply->oldy ; + int new_x = ply->oldx ; + int new_y = ply->oldy ; + int xxx = (frame * ply->oldx + (8 - frame) * ply->x) / 8; + int yyy = (frame * ply->oldy + (8 - frame) * ply->y) / 8; + int tileXXX = Draw[ply->y][ply->x]; + int tile = Draw[ply->y][ply->x]; + struct GraphicInfo_EM *g = &graphic_info_em[tile][frame]; + int xx = ply->x - 1, yy = ply->y; + + printf("::: %d: %d,%d -> %d,%d: %d, %d, %d, %d [%d,%d] <-> ", + frame, ply->oldx, ply->oldy, ply->x, ply->y, + src_x, src_y, dst_x, dst_y, xxx, yyy); + + if (g->width > 0 && g->height > 0) + { + src_x = g->src_x + g->src_offset_x; + src_y = g->src_y + g->src_offset_y; + dst_x = ply->x % MAX_BUF_XSIZE * TILEX + g->dst_offset_x; + dst_y = ply->y % MAX_BUF_YSIZE * TILEY + g->dst_offset_y; + + SetClipOrigin(g->bitmap, g->bitmap->stored_clip_gc, + dst_x - src_x, dst_y - src_y); + BlitBitmapMasked(g->bitmap, screenBitmap, + src_x, src_y, g->width, g->height, dst_x, dst_y); + + printf("::: %d, %d, %d, %d\n", + src_x, src_y, dst_x, dst_y); + } + } +#else SetClipOrigin(objBitmap, objBitmap->stored_clip_gc, - dest_x - src_x, dest_y - src_y); + dst_x - src_x, dst_y - src_y); BlitBitmapMasked(objBitmap, screenBitmap, - src_x, src_y, TILEX, TILEY, dest_x, dest_y); + src_x, src_y, TILEX, TILEY, dst_x, dst_y); +#endif +#endif #else