77
77
cs_print_string(csocket.fd, "mapredraw");
80
static void draw_pixmap(int srcx, int srcy, int dstx, int dsty, int clipx, int clipy, void *mask, void *image)
80
static void draw_pixmap(int srcx, int srcy, int dstx, int dsty, int clipx, int clipy,
81
void *mask, void *image, int sizex, int sizey)
82
83
gdk_gc_set_clip_mask(mapgc, mask);
83
84
gdk_gc_set_clip_origin(mapgc, clipx, clipy);
84
gdk_draw_pixmap(mapwindow, mapgc, image, srcx, srcy, dstx, dsty, map_image_size, map_image_size);
85
gdk_draw_pixmap(mapwindow, mapgc, image, srcx, srcy, dstx, dsty, sizex, sizey);
87
88
int display_mapscroll(int dx, int dy)
200
201
weight*map_image_size, 0,
202
203
picx-weight*map_image_size, picy,
203
pixmaps[smoothface]->map_mask, pixmaps[smoothface]->map_image);
204
pixmaps[smoothface]->map_mask, pixmaps[smoothface]->map_image, map_image_size, map_image_size);
207
208
weightC*map_image_size, map_image_size,
209
210
picx-weightC*map_image_size, picy-map_image_size,
210
pixmaps[smoothface]->map_mask, pixmaps[smoothface]->map_image);
211
pixmaps[smoothface]->map_mask, pixmaps[smoothface]->map_image, map_image_size, map_image_size);
212
213
}/*while there's some smooth to do*/
244
245
w-map_image_size, h-map_image_size,
245
246
ax*map_image_size, ay*map_image_size,
246
247
ax*map_image_size+map_image_size-w, ay*map_image_size+map_image_size-h,
247
pixmaps[face]->map_mask, pixmaps[face]->map_image);
248
pixmaps[face]->map_mask, pixmaps[face]->map_image, map_image_size, map_image_size);
249
250
if ( use_config[CONFIG_SMOOTH])
250
251
drawsmooth(mx, my, layer, ax*map_image_size, ay*map_image_size);
260
261
/* draw big faces last (should overlap other objects) */
261
262
face = mapdata_bigface(ax, ay, layer, &sx, &sy);
262
263
if (face > 0 && pixmaps[face]->map_image != NULL) {
264
/* This is pretty messy, because images are not required to be
265
* an integral multiplier of the image size. There
266
* are really 4 main variables:
267
* source[xy]: From where within the pixmap to start grabbing pixels.
268
* off[xy]: Offset from space edge on the visible map to start drawing pixels.
269
* off[xy] also determines how many pixels to draw (map_image_size - off[xy])
270
* clip[xy]: Position of the clipmask. The position of the clipmask is always
271
* at the upper left of the image as we drawn it on the map, so for any
272
* given big image, it will have the same values for all the pieces. However
273
* we need to re-construct that location based on current location.
275
* For a 32x72 image, it would be drawn like follows:
281
int dx, dy, sourcex, sourcey, offx, offy, clipx, clipy;
283
dx = pixmaps[face]->map_width % map_image_size;
284
offx = dx?(map_image_size -dx):0;
285
clipx = (ax - sx)*map_image_size + offx;
288
sourcex = sx * map_image_size - offx ;
294
dy = pixmaps[face]->map_height % map_image_size;
295
offy = dy?(map_image_size -dy):0;
296
clipy = (ay - sy)*map_image_size + offy;
299
sourcey = sy * map_image_size - offy;
264
sx*map_image_size, sy*map_image_size,
265
ax*map_image_size, ay*map_image_size,
266
(ax-sx)*map_image_size, (ay-sy)*map_image_size,
267
pixmaps[face]->map_mask, pixmaps[face]->map_image);
307
ax*map_image_size+offx, ay*map_image_size + offy,
309
pixmaps[face]->map_mask, pixmaps[face]->map_image,
310
map_image_size - offx, map_image_size - offy);
269
312
} /* else for processing the layers */
276
319
if (use_config[CONFIG_FOGWAR] && the_map.cells[mx][my].cleared) {
277
draw_pixmap(0, 0, ax*map_image_size, ay*map_image_size, ax*map_image_size, ay*map_image_size, dark1, dark);
320
draw_pixmap(0, 0, ax*map_image_size, ay*map_image_size, ax*map_image_size, ay*map_image_size, dark1, dark, map_image_size, map_image_size);
279
322
else if (the_map.cells[mx][my].darkness > 192) { /* Full dark */
280
323
gdk_draw_rectangle (mapwindow, drawingarea->style->black_gc,
281
324
TRUE,map_image_size*ax, map_image_size*ay,
282
325
map_image_size, map_image_size);
283
326
} else if (the_map.cells[mx][my].darkness> 128) {
284
draw_pixmap(0, 0, ax*map_image_size, ay*map_image_size, ax*map_image_size, ay*map_image_size, dark1, dark);
327
draw_pixmap(0, 0, ax*map_image_size, ay*map_image_size, ax*map_image_size, ay*map_image_size, dark1, dark, map_image_size, map_image_size);
285
328
} else if (the_map.cells[mx][my].darkness> 64) {
286
draw_pixmap(0, 0, ax*map_image_size, ay*map_image_size, ax*map_image_size, ay*map_image_size, dark2, dark);
329
draw_pixmap(0, 0, ax*map_image_size, ay*map_image_size, ax*map_image_size, ay*map_image_size, dark2, dark, map_image_size, map_image_size);
287
330
} else if (the_map.cells[mx][my].darkness> 1) {
288
draw_pixmap(0, 0, ax*map_image_size, ay*map_image_size, ax*map_image_size, ay*map_image_size, dark3, dark);
331
draw_pixmap(0, 0, ax*map_image_size, ay*map_image_size, ax*map_image_size, ay*map_image_size, dark3, dark, map_image_size, map_image_size);