+2010-06-24
+ * started adding alternative (smaller) tile size option for playing game
+
2010-06-23
* added graphics performance optimization to native Supaplex game engine
* fixed bug with accidentally removing preceding buffer in SP engine
{ "game.use_native_emc_graphics_engine", "false" },
{ "game.use_native_sp_graphics_engine", "true" },
{ "game.use_masked_pushing", "false" },
+ { "game.tile_size", "32" },
{ "[player].boring_delay_fixed", "1000" },
{ "[player].boring_delay_random", "1000" },
"game.use_masked_pushing",
&game.use_masked_pushing
},
+ {
+ "game.tile_size",
+ &game.tile_size
+ },
{
"[player].boring_delay_fixed",
&game.player_boring_delay_fixed
-#define COMPILE_DATE_STRING "2010-06-23 13:30"
+#define COMPILE_DATE_STRING "2010-06-24 01:23"
#define RANDOM_USE_QUANTITY 1
/* maximal size of level editor drawing area */
+#if NEW_TILESIZE
+#define MAX_ED_FIELDX (SCR_FIELDX)
+#define MAX_ED_FIELDY (SCR_FIELDY - 1)
+#else
#define MAX_ED_FIELDX (2 * SCR_FIELDX)
#define MAX_ED_FIELDY (2 * SCR_FIELDY - 1)
+#endif
/*
int by2 = TILEY - by;
int i;
- getGraphicSource(border_graphic, 0, &src_bitmap, &src_x, &src_y);
+ getFixedGraphicSource(border_graphic, 0, &src_bitmap, &src_x, &src_y);
BlitBitmap(src_bitmap, drawto, src_x, src_y,
bx, by, dest_x - bx, dest_y - by);
ANIM_MODE(graphic) == ANIM_CE_SCORE ?
custom_element.collect_score_initial : FrameCounter);
- DrawGraphicAnimationExt(drawto, x, y, graphic, frame, NO_MASKING);
+ DrawFixedGraphicAnimationExt(drawto, x, y, graphic, frame, NO_MASKING);
}
static void DrawEditorElementName(int x, int y, int element)
gi->y + sy * MINI_TILEY,
el2edimg(new_element));
else
- DrawGraphicExt(drawto,
- gi->x + sx * TILEX,
- gi->y + sy * TILEY,
- el2img(new_element), 0);
+ DrawFixedGraphicExt(drawto,
+ gi->x + sx * TILEX,
+ gi->y + sy * TILEY,
+ el2img(new_element), 0);
if (id == GADGET_ID_CUSTOM_GRAPHIC)
new_element = GFX_ELEMENT(new_element);
break;
case KSYM_f:
- ScrollStepSize = TILEX/8;
+ ScrollStepSize = TILEX / 8;
printf("ScrollStepSize == %d (1/8)\n", ScrollStepSize);
break;
case KSYM_g:
- ScrollStepSize = TILEX/4;
+ ScrollStepSize = TILEX / 4;
printf("ScrollStepSize == %d (1/4)\n", ScrollStepSize);
break;
case KSYM_h:
- ScrollStepSize = TILEX/2;
+ ScrollStepSize = TILEX / 2;
printf("ScrollStepSize == %d (1/2)\n", ScrollStepSize);
break;
filename1 = getPath2(global.create_images_dir, basename1);
filename2 = getPath2(global.create_images_dir, basename2);
- getGraphicSource(graphic, 0, &src_bitmap, &src_x, &src_y);
- BlitBitmap(src_bitmap, bitmap1, src_x, src_y, TILEX, TILEY, 0, 0);
+ getFixedGraphicSource(graphic, 0, &src_bitmap, &src_x, &src_y);
+ BlitBitmap(src_bitmap, bitmap1, src_x, src_y, TILEX, TILEY,
+ 0, 0);
if (SDL_SaveBMP(bitmap1->surface, filename1) != 0)
Error(ERR_EXIT, "cannot save level sketch image file '%s'", filename1);
TILEY * (NUM_CUSTOM_ELEMENTS + NUM_GROUP_ELEMENTS) / 16,
DEFAULT_DEPTH);
- getGraphicSource(dummy_graphic, 0, &src_bitmap, &src_x, &src_y);
+ getFixedGraphicSource(dummy_graphic, 0, &src_bitmap, &src_x, &src_y);
for (i = 0; i < NUM_CUSTOM_ELEMENTS; i++)
{
BlitBitmap(src_bitmap, bitmap, 0, 0, TILEX, TILEY,
TILEX * x, TILEY * y + yoffset_ce);
- BlitBitmap(src_bitmap, bitmap, 0, TILEY, TILEX, TILEY,
- TILEX * x + TILEX * 16, TILEY * y + yoffset_ce);
+ BlitBitmap(src_bitmap, bitmap, 0, TILEY,
+ TILEX, TILEY,
+ TILEX * x + TILEX * 16,
+ TILEY * y + yoffset_ce);
for (j = 2; j >= 0; j--)
{
int c = ii % 10;
- BlitBitmap(src_bitmap, bitmap, TILEX + c * 7, 0, 6, 10,
+ BlitBitmap(src_bitmap, bitmap,
+ TILEX + c * 7, 0, 6, 10,
TILEX * x + 6 + j * 7,
TILEY * y + 11 + yoffset_ce);
- BlitBitmap(src_bitmap, bitmap, TILEX + c * 8, TILEY, 6, 10,
+ BlitBitmap(src_bitmap, bitmap,
+ TILEX + c * 8, TILEY, 6, 10,
TILEX * 16 + TILEX * x + 6 + j * 8,
TILEY * y + 10 + yoffset_ce);
BlitBitmap(src_bitmap, bitmap, 0, 0, TILEX, TILEY,
TILEX * x, TILEY * y + yoffset_ge);
- BlitBitmap(src_bitmap, bitmap, 0, TILEY, TILEX, TILEY,
- TILEX * x + TILEX * 16, TILEY * y + yoffset_ge);
+ BlitBitmap(src_bitmap, bitmap, 0, TILEY,
+ TILEX, TILEY,
+ TILEX * x + TILEX * 16,
+ TILEY * y + yoffset_ge);
for (j = 1; j >= 0; j--)
{
TILEX * x + 6 + j * 10,
TILEY * y + 11 + yoffset_ge);
- BlitBitmap(src_bitmap, bitmap, TILEX + c * 8, TILEY + 12, 6, 10,
+ BlitBitmap(src_bitmap, bitmap,
+ TILEX + c * 8, TILEY + 12, 6, 10,
TILEX * 16 + TILEX * x + 10 + j * 8,
TILEY * y + 10 + yoffset_ge);
else if (Feld[x][y + 1] == EL_MAGIC_WALL_ACTIVE)
{
if (!MovDelay[x][y])
- MovDelay[x][y] = TILEY/4 + 1;
+ MovDelay[x][y] = TILEY / 4 + 1;
if (MovDelay[x][y])
{
else if (Feld[x][y + 1] == EL_BD_MAGIC_WALL_ACTIVE)
{
if (!MovDelay[x][y])
- MovDelay[x][y] = TILEY/4 + 1;
+ MovDelay[x][y] = TILEY / 4 + 1;
if (MovDelay[x][y])
{
else if (Feld[x][y + 1] == EL_DC_MAGIC_WALL_ACTIVE)
{
if (!MovDelay[x][y])
- MovDelay[x][y] = TILEY/4 + 1;
+ MovDelay[x][y] = TILEY / 4 + 1;
if (MovDelay[x][y])
{
#else
+#if NEW_TILESIZE
+#if NEW_SCROLL
+ int softscroll_offset = (setup.soft_scrolling ? 2 * TILEX_VAR : 0);
+#else
+ int softscroll_offset = (setup.soft_scrolling ? TILEX_VAR : 0);
+#endif
+#else
#if NEW_SCROLL
int softscroll_offset = (setup.soft_scrolling ? 2 * TILEX : 0);
#else
int softscroll_offset = (setup.soft_scrolling ? TILEX : 0);
#endif
+#endif
+#if NEW_TILESIZE
+ BlitBitmap(drawto_field, drawto_field,
+ FX + TILEX_VAR * (dx == -1) - softscroll_offset,
+ FY + TILEY_VAR * (dy == -1) - softscroll_offset,
+ SXSIZE - TILEX_VAR * (dx != 0) + 2 * softscroll_offset,
+ SYSIZE - TILEY_VAR * (dy != 0) + 2 * softscroll_offset,
+ FX + TILEX_VAR * (dx == 1) - softscroll_offset,
+ FY + TILEY_VAR * (dy == 1) - softscroll_offset);
+#else
BlitBitmap(drawto_field, drawto_field,
FX + TILEX * (dx == -1) - softscroll_offset,
FY + TILEY * (dy == -1) - softscroll_offset,
FX + TILEX * (dx == 1) - softscroll_offset,
FY + TILEY * (dy == 1) - softscroll_offset);
#endif
+
+#endif
#endif
if (dx != 0)
boolean use_masked_pushing;
int forced_scroll_delay_value;
int scroll_delay_value;
+ int tile_size;
/* values for engine initialization */
int default_push_delay_fixed;
int height = graphic_info[graphic].height;
int frame = getGraphicAnimationFrame(graphic, sync_frame);
- getGraphicSource(graphic, frame, &src_bitmap, &src_x, &src_y);
+ getFixedGraphicSource(graphic, frame, &src_bitmap, &src_x, &src_y);
BlitBitmap(src_bitmap, window, src_x, src_y, width, height, x, y);
#else
/* !!! this can only draw TILEX/TILEY size animations !!! */
if (swap_movement_tiles_always || swap_movement_tiles_autodetected)
{
/* get current (wrong) backside tile coordinates */
- getGraphicSourceExt(graphic, 0, &dummy, &src_x_back, &src_y_back,
- TRUE);
+ getFixedGraphicSourceExt(graphic, 0, &dummy,
+ &src_x_back, &src_y_back, TRUE);
/* set frontside tile coordinates to backside tile coordinates */
g->src_x = src_x_back;
/* check if first animation frame is inside specified bitmap */
first_frame = 0;
- getGraphicSource(i, first_frame, &src_bitmap, &src_x, &src_y);
+ getFixedGraphicSource(i, first_frame, &src_bitmap, &src_x, &src_y);
#if 1
/* this avoids calculating wrong start position for out-of-bounds frame */
/* check if last animation frame is inside specified bitmap */
last_frame = graphic_info[i].anim_frames - 1;
- getGraphicSource(i, last_frame, &src_bitmap, &src_x, &src_y);
+ getFixedGraphicSource(i, last_frame, &src_bitmap, &src_x, &src_y);
if (src_x < 0 || src_y < 0 ||
src_x + width > src_bitmap_width ||
Error(ERR_INFO,
"error: last animation frame (%d) out of bounds (%d, %d) [%d, %d]",
last_frame, src_x, src_y, src_bitmap_width, src_bitmap_height);
+ Error(ERR_INFO, "::: %d, %d", width, height);
Error(ERR_INFO, "custom graphic rejected for this element/action");
if (i == fallback_graphic)
#if defined(TARGET_X11_NATIVE_PERFORMANCE_WORKAROUND)
/* currently we only need a tile clip mask from the first frame */
- getGraphicSource(i, first_frame, &src_bitmap, &src_x, &src_y);
+ getFixedGraphicSource(i, first_frame, &src_bitmap, &src_x, &src_y);
if (copy_clipmask_gc == None)
{
int VX = 566, VY = 400;
int EX = 566, EY = 356;
int dDX, dDY;
+int SXSIZE = 17 * TILEX; /* SCR_FIELDX * TILEX */
+int SYSIZE = 17 * TILEY; /* SCR_FIELDY * TILEY */
+int FULL_SXSIZE = 2 + 17 * TILEX + 2; /* 2 + SXSIZE + 2 */
+int FULL_SYSIZE = 2 + 17 * TILEY + 2; /* 2 + SYSIZE + 2 */
+int TILESIZE_VAR = TILESIZE / 2;
#if 1
int FX, FY;
#include "conf_mus.h" /* include auto-generated data structure definitions */
+#define NEW_TILESIZE 1
#define NEW_SCROLL 0
#define IMG_UNDEFINED (-1)
#define TILESIZE 32
#define TILEX TILESIZE
#define TILEY TILESIZE
+#define TILEX_VAR TILESIZE_VAR
+#define TILEY_VAR TILESIZE_VAR
#define MINI_TILESIZE (TILESIZE / 2)
#define MINI_TILEX MINI_TILESIZE
#define MINI_TILEY MINI_TILESIZE
#define MICRO_TILEY MICRO_TILESIZE
#define MIDPOSX (SCR_FIELDX / 2)
#define MIDPOSY (SCR_FIELDY / 2)
+#if NEW_TILESIZE
+#if NEW_SCROLL
+#if 0
+#define SXSIZE (SCR_FIELDX * TILEX_VAR)
+#define SYSIZE (SCR_FIELDY * TILEY_VAR)
+#endif
+#define FXSIZE ((2 + SCR_FIELDX + 2) * TILEX_VAR)
+#define FYSIZE ((2 + SCR_FIELDY + 2) * TILEY_VAR)
+#else
+#if 0
+#define SXSIZE (SCR_FIELDX * TILEX_VAR)
+#define SYSIZE (SCR_FIELDY * TILEY_VAR)
+#endif
+#define FXSIZE ((SCR_FIELDX + 2) * TILEX_VAR)
+#define FYSIZE ((SCR_FIELDY + 2) * TILEY_VAR)
+#endif
+#else
+#if NEW_SCROLL
+#if 0
#define SXSIZE (SCR_FIELDX * TILEX)
#define SYSIZE (SCR_FIELDY * TILEY)
+#endif
+#define FXSIZE ((2 + SCR_FIELDX + 2) * TILEX)
+#define FYSIZE ((2 + SCR_FIELDY + 2) * TILEY)
+#else
+#if 0
+#define SXSIZE (SCR_FIELDX * TILEX)
+#define SYSIZE (SCR_FIELDY * TILEY)
+#endif
#define FXSIZE ((SCR_FIELDX + 2) * TILEX)
#define FYSIZE ((SCR_FIELDY + 2) * TILEY)
+#endif
+#endif
#define DXSIZE 100
#define DYSIZE 280
#define VXSIZE DXSIZE
#define VYSIZE 100
#define EXSIZE DXSIZE
#define EYSIZE (VYSIZE + 44)
+#if 0
#define FULL_SXSIZE (2 + SXSIZE + 2)
#define FULL_SYSIZE (2 + SYSIZE + 2)
+#endif
#define MICROLEVEL_XSIZE ((STD_LEV_FIELDX + 2) * MICRO_TILEX)
#define MICROLEVEL_YSIZE ((STD_LEV_FIELDY + 2) * MICRO_TILEY)
#define MICROLEVEL_XPOS (SX + (SXSIZE - MICROLEVEL_XSIZE) / 2)
extern int VX, VY;
extern int EX, EY;
extern int dDX, dDY;
+extern int SXSIZE, SYSIZE;
+extern int FULL_SXSIZE, FULL_SYSIZE;
+extern int TILESIZE_VAR;
extern int FX, FY;
extern int ScrollStepSize;
int y = mSY + pos->y;
DrawBackgroundForGraphic(x, y, pos->width, pos->height, button_graphic);
- DrawGraphicThruMaskExt(drawto, x, y, button_graphic, 0);
+ DrawFixedGraphicThruMaskExt(drawto, x, y, button_graphic, 0);
}
if (visibleTextPos(pos_text) && text != NULL)
graphic = BUTTON_ACTIVE(graphic);
DrawBackgroundForGraphic(x, y, TILEX, TILEY, graphic);
- DrawGraphicThruMaskExt(drawto, x, y, graphic, 0);
+ DrawFixedGraphicThruMaskExt(drawto, x, y, graphic, 0);
}
static void initCursor(int ypos, int graphic)
ClearRectangleOnBackground(drawto, xstart, ystart2 + (i - start) * ystep,
TILEX, TILEY);
- DrawGraphicAnimationExt(drawto, xstart, ystart2 + (i - start) * ystep,
- graphic, sync_frame, USE_MASKING);
+ DrawFixedGraphicAnimationExt(drawto, xstart, ystart2 + (i - start) * ystep,
+ graphic, sync_frame, USE_MASKING);
if (init)
DrawInfoScreen_HelpText(element, action, direction, i - start);
ClearRectangleOnBackground(drawto, mSX + 8 * TILEX, mSY + 2 * TILEY,
TILEX, TILEY);
- DrawGraphicThruMaskExt(drawto, mSX + 8 * TILEX, mSY + 2 * TILEY,
- PLAYER_NR_GFX(IMG_PLAYER_1, player_nr), 0);
+ DrawFixedGraphicThruMaskExt(drawto, mSX + 8 * TILEX, mSY + 2 * TILEY,
+ PLAYER_NR_GFX(IMG_PLAYER_1, player_nr), 0);
if (setup.input[player_nr].use_joystick)
{
{
for (x = 0; x < 3; x++)
{
- DrawGraphic(xpos + x - 1, ypos + y - 1, IMG_MENU_CALIBRATE_BLUE, 0);
+ DrawFixedGraphic(xpos + x - 1, ypos + y - 1, IMG_MENU_CALIBRATE_BLUE, 0);
check[x][y] = FALSE;
}
}
new_joystick_xmiddle = joy_x;
new_joystick_ymiddle = joy_y;
- DrawGraphic(xpos + last_x, ypos + last_y, IMG_MENU_CALIBRATE_RED, 0);
+ DrawFixedGraphic(xpos + last_x, ypos + last_y, IMG_MENU_CALIBRATE_RED, 0);
FadeIn(REDRAW_FIELD);
if (x != last_x || y != last_y)
{
- DrawGraphic(xpos + last_x, ypos + last_y, IMG_MENU_CALIBRATE_YELLOW, 0);
- DrawGraphic(xpos + x, ypos + y, IMG_MENU_CALIBRATE_RED, 0);
+ DrawFixedGraphic(xpos + last_x, ypos + last_y,
+ IMG_MENU_CALIBRATE_YELLOW, 0);
+ DrawFixedGraphic(xpos + x, ypos + y,
+ IMG_MENU_CALIBRATE_RED, 0);
last_x = x;
last_y = y;
{
if (mode == DRAW_BUFFERED && setup.soft_scrolling)
{
+#if NEW_TILESIZE
+#if NEW_SCROLL
+ FX = 2 * TILEX_VAR;
+ FY = 2 * TILEY_VAR;
+ BX1 = -2;
+ BY1 = -2;
+ BX2 = SCR_FIELDX + 1;
+ BY2 = SCR_FIELDY + 1;
+ redraw_x1 = 2;
+ redraw_y1 = 2;
+#else
+ FX = TILEX_VAR;
+ FY = TILEY_VAR;
+ BX1 = -1;
+ BY1 = -1;
+ BX2 = SCR_FIELDX;
+ BY2 = SCR_FIELDY;
+ redraw_x1 = 1;
+ redraw_y1 = 1;
+#endif
+#else
#if NEW_SCROLL
FX = 2 * TILEX;
FY = 2 * TILEY;
BY2 = SCR_FIELDY;
redraw_x1 = 1;
redraw_y1 = 1;
+#endif
#endif
drawto_field = fieldbuffer;
if (setup.soft_scrolling)
{
+#if NEW_TILESIZE
+ int dx = (ScreenMovDir & (MV_LEFT | MV_RIGHT) ? ScreenGfxPos : 0);
+ int dy = (ScreenMovDir & (MV_UP | MV_DOWN) ? ScreenGfxPos : 0);
+
+ fx += dx * TILESIZE_VAR / TILESIZE;
+ fy += dy * TILESIZE_VAR / TILESIZE;
+#else
fx += (ScreenMovDir & (MV_LEFT | MV_RIGHT) ? ScreenGfxPos : 0);
fy += (ScreenMovDir & (MV_UP | MV_DOWN) ? ScreenGfxPos : 0);
+#endif
+
+#if 0
+ printf("::: %d, %d [%d, %d] [%d, %d]\n",
+ fx, fy, FX, FY, ScreenMovDir, ScreenGfxPos);
+#endif
+
+#if 0
+#if NEW_TILESIZE
+ fx = fx * TILESIZE_VAR / TILESIZE;
+ fy = fy * TILESIZE_VAR / TILESIZE;
+#endif
+#endif
}
if (setup.soft_scrolling ||
printf("::: REDRAW_TILES\n");
#endif
+#if NEW_TILESIZE
+ for (x = 0; x < SCR_FIELDX; x++)
+ for (y = 0 ; y < SCR_FIELDY; y++)
+ if (redraw[redraw_x1 + x][redraw_y1 + y])
+ BlitBitmap(buffer, window,
+ FX + x * TILEX_VAR, FY + y * TILEY_VAR,
+ TILEX_VAR, TILEY_VAR,
+ SX + x * TILEX_VAR, SY + y * TILEY_VAR);
+#else
for (x = 0; x < SCR_FIELDX; x++)
for (y = 0 ; y < SCR_FIELDY; y++)
if (redraw[redraw_x1 + x][redraw_y1 + y])
BlitBitmap(buffer, window,
FX + x * TILEX, FY + y * TILEY, TILEX, TILEY,
SX + x * TILEX, SY + y * TILEY);
+#endif
}
if (redraw_mask & REDRAW_FPS) /* display frames per second */
sync_frame);
}
-void getSizedGraphicSource(int graphic, int frame, int tilesize_raw,
- Bitmap **bitmap, int *x, int *y)
+void getSizedGraphicSourceExt(int graphic, int frame, int tilesize_raw,
+ Bitmap **bitmap, int *x, int *y,
+ boolean get_backside)
{
struct
{
int height_div = offset_calc[offset_calc_pos].height_div;
int startx = src_bitmap->width * width_mult / width_div;
int starty = src_bitmap->height * height_mult / height_div;
+#if NEW_TILESIZE
+ int src_x = (g->src_x + (get_backside ? g->offset2_x : 0)) *
+ tilesize / TILESIZE;
+ int src_y = (g->src_y + (get_backside ? g->offset2_y : 0)) *
+ tilesize / TILESIZE;
+#else
int src_x = g->src_x * tilesize / TILESIZE;
int src_y = g->src_y * tilesize / TILESIZE;
+#endif
int width = g->width * tilesize / TILESIZE;
int height = g->height * tilesize / TILESIZE;
int offset_x = g->offset_x * tilesize / TILESIZE;
*y = starty + src_y;
}
+void getFixedGraphicSourceExt(int graphic, int frame, Bitmap **bitmap,
+ int *x, int *y, boolean get_backside)
+{
+ getSizedGraphicSourceExt(graphic, frame, TILESIZE, bitmap, x, y,
+ get_backside);
+}
+
+void getSizedGraphicSource(int graphic, int frame, int tilesize_raw,
+ Bitmap **bitmap, int *x, int *y)
+{
+ getSizedGraphicSourceExt(graphic, frame, tilesize_raw, bitmap, x, y, FALSE);
+}
+
+void getFixedGraphicSource(int graphic, int frame,
+ Bitmap **bitmap, int *x, int *y)
+{
+ getSizedGraphicSourceExt(graphic, frame, TILESIZE, bitmap, x, y, FALSE);
+}
+
void getMiniGraphicSource(int graphic, Bitmap **bitmap, int *x, int *y)
{
#if 1
int src_x = g->src_x + (get_backside ? g->offset2_x : 0);
int src_y = g->src_y + (get_backside ? g->offset2_y : 0);
+#if NEW_TILESIZE
+ if (TILESIZE_VAR != TILESIZE)
+ return getSizedGraphicSourceExt(graphic, frame, TILESIZE_VAR, bitmap, x, y,
+ get_backside);
+#endif
+
*bitmap = g->bitmap;
if (g->offset_y == 0) /* frames are ordered horizontally */
}
#endif
+#if NEW_TILESIZE
+ DrawGraphicExt(drawto_field, FX + x * TILEX_VAR, FY + y * TILEY_VAR, graphic,
+ frame);
+#else
DrawGraphicExt(drawto_field, FX + x * TILEX, FY + y * TILEY, graphic, frame);
+#endif
+ MarkTileDirty(x, y);
+}
+
+void DrawFixedGraphic(int x, int y, int graphic, int frame)
+{
+#if DEBUG
+ if (!IN_SCR_FIELD(x, y))
+ {
+ printf("DrawGraphic(): x = %d, y = %d, graphic = %d\n", x, y, graphic);
+ printf("DrawGraphic(): This should never happen!\n");
+ return;
+ }
+#endif
+
+ DrawFixedGraphicExt(drawto_field, FX + x * TILEX, FY + y * TILEY, graphic,
+ frame);
MarkTileDirty(x, y);
}
int src_x, src_y;
getGraphicSource(graphic, frame, &src_bitmap, &src_x, &src_y);
+#if NEW_TILESIZE
+ BlitBitmap(src_bitmap, dst_bitmap, src_x, src_y, TILEX_VAR, TILEY_VAR, x, y);
+#else
+ BlitBitmap(src_bitmap, dst_bitmap, src_x, src_y, TILEX, TILEY, x, y);
+#endif
+}
+
+void DrawFixedGraphicExt(DrawBuffer *dst_bitmap, int x, int y, int graphic,
+ int frame)
+{
+ Bitmap *src_bitmap;
+ int src_x, src_y;
+
+ getFixedGraphicSource(graphic, frame, &src_bitmap, &src_x, &src_y);
BlitBitmap(src_bitmap, dst_bitmap, src_x, src_y, TILEX, TILEY, x, y);
}
}
#endif
- DrawGraphicThruMaskExt(drawto_field, FX + x * TILEX, FY + y *TILEY, graphic,
+#if NEW_TILESIZE
+ DrawGraphicThruMaskExt(drawto_field, FX + x * TILEX_VAR, FY + y * TILEY_VAR,
+ graphic, frame);
+#else
+ DrawGraphicThruMaskExt(drawto_field, FX + x * TILEX, FY + y * TILEY, graphic,
frame);
+#endif
+ MarkTileDirty(x, y);
+}
+
+void DrawFixedGraphicThruMask(int x, int y, int graphic, int frame)
+{
+#if DEBUG
+ if (!IN_SCR_FIELD(x, y))
+ {
+ printf("DrawGraphicThruMask(): x = %d,y = %d, graphic = %d\n",x,y,graphic);
+ printf("DrawGraphicThruMask(): This should never happen!\n");
+ return;
+ }
+#endif
+
+ DrawFixedGraphicThruMaskExt(drawto_field, FX + x * TILEX, FY + y * TILEY,
+ graphic, frame);
MarkTileDirty(x, y);
}
getGraphicSource(graphic, frame, &src_bitmap, &src_x, &src_y);
+ SetClipOrigin(src_bitmap, src_bitmap->stored_clip_gc,
+ dst_x - src_x, dst_y - src_y);
+#if NEW_TILESIZE
+ BlitBitmapMasked(src_bitmap, d, src_x, src_y, TILEX_VAR, TILEY_VAR,
+ dst_x, dst_y);
+#else
+ BlitBitmapMasked(src_bitmap, d, src_x, src_y, TILEX, TILEY, dst_x, dst_y);
+#endif
+}
+
+void DrawFixedGraphicThruMaskExt(DrawBuffer *d, int dst_x, int dst_y,
+ int graphic, int frame)
+{
+ Bitmap *src_bitmap;
+ int src_x, src_y;
+
+ getFixedGraphicSource(graphic, frame, &src_bitmap, &src_x, &src_y);
+
SetClipOrigin(src_bitmap, src_bitmap->stored_clip_gc,
dst_x - src_x, dst_y - src_y);
BlitBitmapMasked(src_bitmap, d, src_x, src_y, TILEX, TILEY, dst_x, dst_y);
}
#endif
+#if NEW_TILESIZE
+ width = width * TILESIZE_VAR / TILESIZE;
+ height = height * TILESIZE_VAR / TILESIZE;
+ cx = cx * TILESIZE_VAR / TILESIZE;
+ cy = cy * TILESIZE_VAR / TILESIZE;
+ dx = dx * TILESIZE_VAR / TILESIZE;
+ dy = dy * TILESIZE_VAR / TILESIZE;
+#endif
+
if (width > 0 && height > 0)
{
getGraphicSource(graphic, frame, &src_bitmap, &src_x, &src_y);
src_x += cx;
src_y += cy;
+#if NEW_TILESIZE
+ dst_x = FX + x * TILEX_VAR + dx;
+ dst_y = FY + y * TILEY_VAR + dy;
+#else
dst_x = FX + x * TILEX + dx;
dst_y = FY + y * TILEY + dy;
+#endif
if (mask_mode == USE_MASKING)
{
Bitmap *src_bitmap;
int src_x, src_y;
int dst_x, dst_y;
+#if NEW_TILESIZE
+ int width = TILEX_VAR, height = TILEY_VAR;
+#else
int width = TILEX, height = TILEY;
+#endif
int x1 = x;
int y1 = y;
int x2 = x + SIGN(dx);
{
getGraphicSourceExt(graphic, frame, &src_bitmap, &src_x, &src_y, TRUE);
+#if NEW_TILESIZE
+ dst_x = FX + x1 * TILEX_VAR;
+ dst_y = FY + y1 * TILEY_VAR;
+#else
dst_x = FX + x1 * TILEX;
dst_y = FY + y1 * TILEY;
+#endif
if (mask_mode == USE_MASKING)
{
{
getGraphicSourceExt(graphic, frame, &src_bitmap, &src_x, &src_y, FALSE);
+#if NEW_TILESIZE
+ dst_x = FX + x2 * TILEX_VAR;
+ dst_y = FY + y2 * TILEY_VAR;
+#else
dst_x = FX + x2 * TILEX;
dst_y = FY + y2 * TILEY;
+#endif
if (mask_mode == USE_MASKING)
{
getGraphicSource(graphic, 1, &src_bitmap, &src_x, &src_y);
+#if NEW_TILESIZE
+ width = crumbled_border_size * TILESIZE_VAR / TILESIZE;
+ height = crumbled_border_size * TILESIZE_VAR / TILESIZE;
+ cx = (dx > 0 ? TILEX - crumbled_border_size : 0) * TILESIZE_VAR / TILESIZE;
+ cy = (dy > 0 ? TILEY - crumbled_border_size : 0) * TILESIZE_VAR / TILESIZE;
+
+ BlitBitmap(src_bitmap, drawto_field, src_x + cx, src_y + cy,
+ width, height, FX + sx * TILEX_VAR + cx, FY + sy * TILEY_VAR + cy);
+#else
width = crumbled_border_size;
height = crumbled_border_size;
cx = (dx > 0 ? TILEX - crumbled_border_size : 0);
BlitBitmap(src_bitmap, drawto_field, src_x + cx, src_y + cy,
width, height, FX + sx * TILEX + cx, FY + sy * TILEY + cy);
+#endif
}
static void DrawLevelFieldCrumbledBorders(int x, int y, int graphic, int frame,
}
#endif
+#if NEW_TILESIZE
+ BlitBitmap(src_bitmap, drawto_field,
+ src_x + cx * TILESIZE_VAR / TILESIZE,
+ src_y + cy * TILESIZE_VAR / TILESIZE,
+ width * TILESIZE_VAR / TILESIZE,
+ height * TILESIZE_VAR / TILESIZE,
+ FX + sx * TILEX_VAR + cx * TILESIZE_VAR / TILESIZE,
+ FY + sy * TILEY_VAR + cy * TILESIZE_VAR / TILESIZE);
+#else
BlitBitmap(src_bitmap, drawto_field, src_x + cx, src_y + cy,
width, height, FX + sx * TILEX + cx, FY + sy * TILEY + cy);
+#endif
/* (remaining middle border part must be at least as big as corner part) */
if (!(graphic_info[graphic].style & STYLE_ACCURATE_BORDERS) ||
by = cy;
}
+#if NEW_TILESIZE
+ BlitBitmap(src_bitmap, drawto_field,
+ src_x + bx * TILESIZE_VAR / TILESIZE,
+ src_y + by * TILESIZE_VAR / TILESIZE,
+ width * TILESIZE_VAR / TILESIZE,
+ height * TILESIZE_VAR / TILESIZE,
+ FX + sx * TILEX_VAR + cx * TILESIZE_VAR / TILESIZE,
+ FY + sy * TILEY_VAR + cy * TILESIZE_VAR / TILESIZE);
+#else
BlitBitmap(src_bitmap, drawto_field, src_x + bx, src_y + by,
width, height, FX + sx * TILEX + cx, FY + sy * TILEY + cy);
+#endif
}
}
#else
int inner_sy = (height >= 3 * font_height ? font_height : 0);
boolean draw_masked = graphic_info[graphic].draw_masked;
- getGraphicSource(graphic, 0, &src_bitmap, &src_x, &src_y);
+ getFixedGraphicSource(graphic, 0, &src_bitmap, &src_x, &src_y);
if (src_bitmap == NULL || width < font_width || height < font_height)
{
DrawGraphicExt(dst_bitmap, x, y, graphic, frame);
}
+inline void DrawFixedGraphicAnimationExt(DrawBuffer *dst_bitmap, int x, int y,
+ int graphic, int sync_frame,
+ int mask_mode)
+{
+ int frame = getGraphicAnimationFrame(graphic, sync_frame);
+
+ if (mask_mode == USE_MASKING)
+ DrawFixedGraphicThruMaskExt(dst_bitmap, x, y, graphic, frame);
+ else
+ DrawFixedGraphicExt(dst_bitmap, x, y, graphic, frame);
+}
+
inline void DrawGraphicAnimation(int x, int y, int graphic)
{
int lx = LEVELX(x), ly = LEVELY(y);
if (!IN_SCR_FIELD(x, y))
return;
+#if NEW_TILESIZE
+ DrawGraphicAnimationExt(drawto_field, FX + x * TILEX_VAR, FY + y * TILEY_VAR,
+ graphic, GfxFrame[lx][ly], NO_MASKING);
+#else
+ DrawGraphicAnimationExt(drawto_field, FX + x * TILEX, FY + y * TILEY,
+ graphic, GfxFrame[lx][ly], NO_MASKING);
+#endif
+ MarkTileDirty(x, y);
+}
+
+inline void DrawFixedGraphicAnimation(int x, int y, int graphic)
+{
+ int lx = LEVELX(x), ly = LEVELY(y);
+
+ if (!IN_SCR_FIELD(x, y))
+ return;
+
DrawGraphicAnimationExt(drawto_field, FX + x * TILEX, FY + y * TILEY,
graphic, GfxFrame[lx][ly], NO_MASKING);
MarkTileDirty(x, y);
int border_size = vp_playfield->border_size;
int new_sx = vp_playfield->x + border_size;
int new_sy = vp_playfield->y + border_size;
+ int tilesize = (gfx_game_mode == GAME_MODE_PLAYING ? TILESIZE_VAR :
+ gfx_game_mode == GAME_MODE_EDITOR ? MINI_TILESIZE : TILESIZE);
+ int new_sxsize = vp_playfield->width - 2 * border_size;
+ int new_sysize = vp_playfield->height - 2 * border_size;
+#if NEW_TILESIZE
+ int new_scr_fieldx = new_sxsize / tilesize;
+ int new_scr_fieldy = new_sysize / tilesize;
+#else
int new_scr_fieldx = (vp_playfield->width - 2 * border_size) / TILESIZE;
int new_scr_fieldy = (vp_playfield->height - 2 * border_size) / TILESIZE;
+#endif
#if 0
/* !!! TEST ONLY !!! */
REAL_SX = vp_playfield->x;
REAL_SY = vp_playfield->y;
+ SXSIZE = new_sxsize;
+ SYSIZE = new_sysize;
+ FULL_SXSIZE = vp_playfield->width;
+ FULL_SYSIZE = vp_playfield->width;
+
*door_1_x = vp_door_1->x;
*door_1_y = vp_door_1->y;
*door_2_x = vp_door_2->x;
void SetRandomAnimationValue(int, int);
int getGraphicAnimationFrame(int, int);
-void DrawGraphicAnimationExt(DrawBuffer *, int, int, int, int, int);
+
void DrawGraphicAnimation(int, int, int);
+void DrawGraphicAnimationExt(DrawBuffer *, int, int, int, int, int);
+
+void DrawFixedGraphicAnimation(int, int, int);
+void DrawFixedGraphicAnimationExt(DrawBuffer *, int, int, int, int, int);
+
void DrawLevelGraphicAnimation(int, int, int);
void DrawLevelElementAnimation(int, int, int);
void DrawLevelGraphicAnimationIfNeeded(int, int, int);
void DrawPlayerField(int, int);
void DrawPlayer(struct PlayerInfo *);
+void getSizedGraphicSourceExt(int, int, int, Bitmap **, int *, int *, boolean);
+void getFixedGraphicSourceExt(int, int, Bitmap **, int *, int *, boolean);
void getSizedGraphicSource(int, int, int, Bitmap **, int *, int *);
+void getFixedGraphicSource(int, int, Bitmap **, int *, int *);
void getMiniGraphicSource(int, Bitmap **, int *, int *);
void getGraphicSourceExt(int, int, Bitmap **, int *, int *, boolean);
void getGraphicSource(int, int, Bitmap **, int *, int *);
+
void DrawGraphic(int, int, int, int);
void DrawGraphicExt(DrawBuffer *, int, int, int, int);
void DrawGraphicThruMask(int, int, int, int);
void DrawGraphicThruMaskExt(DrawBuffer *, int, int, int, int);
+void DrawFixedGraphic(int, int, int, int);
+void DrawFixedGraphicExt(DrawBuffer *, int, int, int, int);
+void DrawFixedGraphicThruMask(int, int, int, int);
+void DrawFixedGraphicThruMaskExt(DrawBuffer *, int, int, int, int);
+
void DrawSizedGraphic(int, int, int, int, int);
void DrawSizedGraphicExt(DrawBuffer *, int, int, int, int, int);
+
void DrawMiniGraphic(int, int, int);
void DrawMiniGraphicExt(DrawBuffer *, int, int, int);