void DrawMiniGraphic(int x, int y, int graphic)
{
- DrawMiniGraphicExt(drawto, SX + x*MINI_TILEX, SY + y*MINI_TILEY, graphic);
- MarkTileDirty(x/2, y/2);
+ DrawMiniGraphicExt(drawto,
+ SX + x * MINI_TILEX, SY + y * MINI_TILEY, graphic);
+ MarkTileDirty(x / 2, y / 2);
+}
+
+void DrawNewMiniGraphic(int x, int y, int graphic)
+{
+ DrawNewMiniGraphicExt(drawto,
+ SX + x * MINI_TILEX, SY + y * MINI_TILEY, graphic);
+ MarkTileDirty(x / 2, y / 2);
}
void getMiniGraphicSource(int graphic, Bitmap **bitmap, int *x, int *y)
}
}
+void getNewMiniGraphicSource(int graphic, Bitmap **bitmap, int *x, int *y)
+{
+ Bitmap *src_bitmap = new_graphic_info[graphic].bitmap;
+ int mini_startx = 0;
+ int mini_starty = src_bitmap->height * 2 / 3;
+ int src_x = mini_startx + new_graphic_info[graphic].src_x / 2;
+ int src_y = mini_starty + new_graphic_info[graphic].src_y / 2;
+
+ *bitmap = src_bitmap;
+ *x = src_x;
+ *y = src_y;
+}
+
void DrawMiniGraphicExt(DrawBuffer *d, int x, int y, int graphic)
{
Bitmap *bitmap;
BlitBitmap(bitmap, d, src_x, src_y, MINI_TILEX, MINI_TILEY, x, y);
}
+void DrawNewMiniGraphicExt(DrawBuffer *d, int x, int y, int graphic)
+{
+#if 1
+ Bitmap *src_bitmap;
+ int src_x, src_y;
+
+ getNewMiniGraphicSource(graphic, &src_bitmap, &src_x, &src_y);
+#else
+ Bitmap *src_bitmap = new_graphic_info[graphic].bitmap;
+ int mini_startx = src_bitmap->width * 2 / 3;
+ int mini_starty = src_bitmap->height * 2 / 3;
+ int src_x = mini_startx + new_graphic_info[graphic].src_x / 2;
+ int src_y = mini_starty + new_graphic_info[graphic].src_y / 2;
+#endif
+
+ BlitBitmap(src_bitmap, d, src_x, src_y, MINI_TILEX, MINI_TILEY, x, y);
+}
+
void DrawGraphicShifted(int x,int y, int dx,int dy, int graphic,
int cut_mode, int mask_mode)
{
DrawMiniGraphic(x, y, graphic);
}
+void DrawNewMiniElement(int x, int y, int element)
+{
+ int graphic;
+
+#if 0
+ if (!element)
+ {
+ DrawNewMiniGraphic(x, y, -1);
+ return;
+ }
+#endif
+
+ graphic = el2img(element);
+ DrawNewMiniGraphic(x, y, graphic);
+}
+
void DrawMiniElementOrWall(int sx, int sy, int scroll_x, int scroll_y)
{
int x = sx + scroll_x, y = sy + scroll_y;
}
}
+void DrawNewMiniElementOrWall(int sx, int sy, int scroll_x, int scroll_y)
+{
+ int x = sx + scroll_x, y = sy + scroll_y;
+
+ if (x < -1 || x > lev_fieldx || y < -1 || y > lev_fieldy)
+ DrawNewMiniElement(sx, sy, EL_EMPTY);
+ else if (x > -1 && x < lev_fieldx && y > -1 && y < lev_fieldy)
+ DrawNewMiniElement(sx, sy, Feld[x][y]);
+ else
+ {
+ int steel_type, steel_position;
+ int border[6][2] =
+ {
+ { IMG_STEELWALL_TOPLEFT, IMG_INVISIBLE_STEELWALL_TOPLEFT },
+ { IMG_STEELWALL_TOPRIGHT, IMG_INVISIBLE_STEELWALL_TOPRIGHT },
+ { IMG_STEELWALL_BOTTOMLEFT, IMG_INVISIBLE_STEELWALL_BOTTOMLEFT },
+ { IMG_STEELWALL_BOTTOMRIGHT, IMG_INVISIBLE_STEELWALL_BOTTOMRIGHT },
+ { IMG_STEELWALL_VERTICAL, IMG_INVISIBLE_STEELWALL_VERTICAL },
+ { IMG_STEELWALL_HORIZONTAL, IMG_INVISIBLE_STEELWALL_HORIZONTAL }
+ };
+
+ steel_type = (BorderElement == EL_STEELWALL ? 0 : 1);
+ steel_position = (x == -1 && y == -1 ? 0 :
+ x == lev_fieldx && y == -1 ? 1 :
+ x == -1 && y == lev_fieldy ? 2 :
+ x == lev_fieldx && y == lev_fieldy ? 3 :
+ x == -1 || x == lev_fieldx ? 4 :
+ y == -1 || y == lev_fieldy ? 5 : -1);
+
+ if (steel_position != -1)
+ DrawNewMiniGraphic(sx, sy, border[steel_position][steel_type]);
+ }
+}
+
void DrawMicroElement(int xpos, int ypos, int element)
{
int graphic;
MICRO_TILEX, MICRO_TILEY, xpos, ypos);
}
+void getNewMicroGraphicSource(int graphic, Bitmap **bitmap, int *x, int *y)
+{
+ Bitmap *src_bitmap = new_graphic_info[graphic].bitmap;
+ int mini_startx = src_bitmap->width * 3 / 4;
+ int mini_starty = src_bitmap->height * 2 / 3;
+ int src_x = mini_startx + new_graphic_info[graphic].src_x / 8;
+ int src_y = mini_starty + new_graphic_info[graphic].src_y / 8;
+
+ *bitmap = src_bitmap;
+ *x = src_x;
+ *y = src_y;
+}
+
+void DrawNewMicroElement(int xpos, int ypos, int element)
+{
+ Bitmap *src_bitmap;
+ int src_x, src_y;
+ int graphic;
+
+ if (element == EL_EMPTY)
+ return;
+
+ graphic = el2img(element);
+
+ getNewMicroGraphicSource(graphic, &src_bitmap, &src_x, &src_y);
+ BlitBitmap(src_bitmap, drawto, src_x, src_y, MICRO_TILEX, MICRO_TILEY,
+ xpos, ypos);
+}
+
void DrawLevel()
{
int x,y;
redraw_mask |= REDRAW_FIELD;
}
+void DrawNewMiniLevel(int size_x, int size_y, int scroll_x, int scroll_y)
+{
+ int x,y;
+
+ for(x=0; x<size_x; x++)
+ for(y=0; y<size_y; y++)
+ DrawNewMiniElementOrWall(x, y, scroll_x, scroll_y);
+
+ redraw_mask |= REDRAW_FIELD;
+}
+
static void DrawMicroLevelExt(int xpos, int ypos, int from_x, int from_y)
{
int x, y;
redraw_mask |= REDRAW_MICROLEVEL;
}
+static void DrawNewMicroLevelExt(int xpos, int ypos, int from_x, int from_y)
+{
+ int x, y;
+
+ ClearRectangle(drawto, xpos, ypos, MICROLEV_XSIZE, MICROLEV_YSIZE);
+
+ if (lev_fieldx < STD_LEV_FIELDX)
+ xpos += (STD_LEV_FIELDX - lev_fieldx) / 2 * MICRO_TILEX;
+ if (lev_fieldy < STD_LEV_FIELDY)
+ ypos += (STD_LEV_FIELDY - lev_fieldy) / 2 * MICRO_TILEY;
+
+ xpos += MICRO_TILEX;
+ ypos += MICRO_TILEY;
+
+ for(x=-1; x<=STD_LEV_FIELDX; x++)
+ {
+ for(y=-1; y<=STD_LEV_FIELDY; y++)
+ {
+ int lx = from_x + x, ly = from_y + y;
+
+ if (lx >= 0 && lx < lev_fieldx && ly >= 0 && ly < lev_fieldy)
+ DrawNewMicroElement(xpos + x * MICRO_TILEX, ypos + y * MICRO_TILEY,
+ Ur[lx][ly]);
+ else if (lx >= -1 && lx < lev_fieldx+1 && ly >= -1 && ly < lev_fieldy+1)
+ DrawNewMicroElement(xpos + x * MICRO_TILEX, ypos + y * MICRO_TILEY,
+ BorderElement);
+ }
+ }
+
+ redraw_mask |= REDRAW_MICROLEVEL;
+}
+
#define MICROLABEL_EMPTY 0
#define MICROLABEL_LEVEL_NAME 1
#define MICROLABEL_CREATED_BY 2
label_state = 1;
label_counter = 0;
- DrawMicroLevelExt(xpos, ypos, from_x, from_y);
+ DrawNewMicroLevelExt(xpos, ypos, from_x, from_y);
DrawMicroLevelLabelExt(label_state);
/* initialize delay counters */
#if 1
int graphic_NEW = element_info[element].graphic[GFX_ACTION_DEFAULT];
+#if DEBUG
+ if (graphic_NEW < 0)
+ Error(ERR_WARN, "element %d -> graphic %d -- probably crashing now...",
+ element, graphic_NEW);
+#endif
+
return graphic_NEW;
#else