2 "$Id: map.c 9218 2008-06-03 13:45:46Z anmaster $";
44 #include <gdk/gdkwin32.h>
46 #include <gdk/gdkkeysyms.h>
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)
83 gdk_gc_set_clip_mask(
mapgc, mask);
84 gdk_gc_set_clip_origin(
mapgc, clipx, clipy);
85 gdk_draw_pixmap(
mapwindow,
mapgc, image, srcx, srcy, dstx, dsty, sizex, sizey);
105 static int dx[8]={0,1,1,1,0,-1,-1,-1};
106 static int dy[8]={-1,-1,0,1,1,1,0,-1};
107 static int bweights[8]={2,0,4,0,8,0,1,0};
108 static int cweights[8]={0,2,0,4,0,8,0,1};
109 static int bc_exclude[8]={
119 int partdone[8]={0,0,0,0,0,0,0,0};
122 int i,lowest,weight,weightC;
126 for (i=0;i<=layer;i++)
156 if ( (slevels[i]>0) && (!partdone[i]) &&
157 ((lowest<0) || (slevels[i]<slevels[lowest]))
176 if ( (slevels[i]==slevels[lowest]) &&
177 (sfaces[i]==sfaces[lowest])){
179 weight=weight+bweights[i];
180 weightC&=~bc_exclude[i];
183 weightC&=~cweights[i];
188 if (sfaces[lowest]<=0)
190 smoothface=sfaces[lowest];
199 if ( (!
pixmaps[smoothface]->map_image) ||
206 picx-weight*map_image_size, picy,
207 pixmaps[smoothface]->map_mask,
pixmaps[smoothface]->map_image, map_image_size, map_image_size);
213 picx-weightC*map_image_size, picy-map_image_size,
214 pixmaps[smoothface]->map_mask,
pixmaps[smoothface]->map_image, map_image_size, map_image_size);
225 for (layer=0; layer<
MAXLAYERS; layer++) {
227 if ((face > 0) && (!
pixmaps[face]->map_mask))
231 if (layer==MAXLAYERS)
239 for (layer=0; layer<
MAXLAYERS; layer++) {
244 if (face > 0 &&
pixmaps[face]->map_image != NULL) {
248 w-map_image_size, h-map_image_size,
249 ax*map_image_size, ay*map_image_size,
250 ax*map_image_size+map_image_size-w, ay*map_image_size+map_image_size-h,
251 pixmaps[face]->map_mask,
pixmaps[face]->map_image, map_image_size, map_image_size);
261 drawsmooth (mx, my, layer, ax*map_image_size, ay*map_image_size);
265 if (face > 0 &&
pixmaps[face]->map_image != NULL) {
283 int dx, dy, sourcex, sourcey, offx, offy, clipx, clipy;
286 offx = dx?(map_image_size -dx):0;
287 clipx = (ax - sx)*map_image_size + offx;
290 sourcex = sx * map_image_size - offx ;
297 offy = dy?(map_image_size -dy):0;
298 clipy = (ay - sy)*map_image_size + offy;
301 sourcey = sy * map_image_size - offy;
309 ax*map_image_size+offx, ay*map_image_size + offy,
312 map_image_size - offx, map_image_size - offy);
322 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);
326 TRUE,map_image_size*ax, map_image_size*ay,
327 map_image_size, map_image_size);
329 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);
331 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);
333 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);
340 struct timeval tv1, tv2,tv3;
341 long elapsed1, elapsed2;
344 gettimeofday(&tv1, NULL);
364 gettimeofday(&tv2, NULL);
369 gettimeofday(&tv3, NULL);
370 elapsed1 = (tv2.tv_sec - tv1.tv_sec)*1000000 + (tv2.tv_usec - tv1.tv_usec);
371 elapsed2 = (tv3.tv_sec - tv2.tv_sec)*1000000 + (tv3.tv_usec - tv2.tv_usec);
375 if ((elapsed1 + elapsed2)>10000)
376 LOG(
LOG_INFO,
"gtk::sdl_gen_map",
"gen took %7ld, flip took %7ld, total = %7ld",
377 elapsed1, elapsed2, elapsed1 + elapsed2);
#define CAN_SMOOTH(__SQUARE, __LEVEL)
const char *const rcsid_gtk_map_c
PixmapInfo * pixmaps[MAXPIXMAPNUM]
void LOG(LogLevel level, const char *origin, const char *format,...)
int sdl_mapscroll(int dx, int dy)
static void display_mapcell(int ax, int ay, int mx, int my)
sint16 use_config[CONFIG_NUMS]
sint16 mapdata_face(int x, int y, int layer)
void drawsmooth(int mx, int my, int layer, int picx, int picy)
static void draw_pixmap(int srcx, int srcy, int dstx, int dsty, int clipx, int clipy, void *mask, void *image, int sizex, int sizey)
sint16 mapdata_bigface(int x, int y, int layer, int *ww, int *hh)
int display_mapscroll(int dx, int dy)
#define CONFIG_DISPLAYMODE
void gtk_draw_map(int redraw)
struct MapCellLayer heads[MAXLAYERS]