X-Git-Url: https://git.artsoft.org/?a=blobdiff_plain;ds=sidebyside;f=src%2Fgame_em%2Fgraphics.c;h=99d8e3b9cc1b2532554bb264d97c25a379bdeaec;hb=d4758d12db28cd36edca33c9c7ab05476a8f85e7;hp=1d7e113030abba7e75b5d508eb49017e869e8ebd;hpb=ef9242bb9320d705010959ba11fdf697dc1e5b70;p=rocksndiamonds.git diff --git a/src/game_em/graphics.c b/src/game_em/graphics.c index 1d7e1130..99d8e3b9 100644 --- a/src/game_em/graphics.c +++ b/src/game_em/graphics.c @@ -84,17 +84,36 @@ static void animscreen(void) for (y = top; y < top + MAX_BUF_YSIZE; y++) { dy = y % MAX_BUF_YSIZE; + for (x = left; x < left + MAX_BUF_XSIZE; x++) { + int tile = Draw[y][x]; + dx = x % MAX_BUF_XSIZE; - obj = map_obj[frame][Draw[y][x]]; + obj = map_obj[frame][tile]; if (screentiles[dy][dx] != obj) { - screentiles[dy][dx] = obj; +#if 1 + struct GraphicInfo_EM *g = &graphic_info_em[tile][frame]; + int dst_x = dx * TILEX; + int dst_y = dy * TILEY; + + if (g->width != TILEX || g->height != TILEY) + ClearRectangle(screenBitmap, dst_x, dst_y, TILEX, TILEY); + + if (g->width > 0 && g->height > 0) + BlitBitmap(g->bitmap, screenBitmap, + g->src_x + g->src_offset_x, g->src_y + g->src_offset_y, + g->width, g->height, + dst_x + g->dst_offset_x, dst_y + g->dst_offset_y); +#else BlitBitmap(objBitmap, screenBitmap, (obj / 512) * TILEX, (obj % 512) * TILEY / 16, TILEX, TILEY, dx * TILEX, dy * TILEY); +#endif + + screentiles[dy][dx] = obj; } } } @@ -110,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; @@ -124,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; @@ -147,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