Crossfire Client, Branches  R11627
map.c
Go to the documentation of this file.
1 const char * const rcsid_gtk2_map_c =
2  "$Id: map.c 11117 2009-01-05 07:11:04Z mwedel $";
3 /*
4  Crossfire client, a client program for the crossfire program.
5 
6  Copyright (C) 2005 Mark Wedel & Crossfire Development Team
7 
8  This program is free software; you can redistribute it and/or modify
9  it under the terms of the GNU General Public License as published by
10  the Free Software Foundation; either version 2 of the License, or
11  (at your option) any later version.
12 
13  This program is distributed in the hope that it will be useful,
14  but WITHOUT ANY WARRANTY; without even the implied warranty of
15  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
16  GNU General Public License for more details.
17 
18  You should have received a copy of the GNU General Public License
19  along with this program; if not, write to the Free Software
20  Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
21 
22  The author can be reached via e-mail to crossfire@metalforge.org
23 */
24 
31 #include <config.h>
32 #include <stdlib.h>
33 #include <sys/stat.h>
34 #ifndef WIN32
35 #include <unistd.h>
36 #endif
37 #include <png.h>
38 
39 /* Pick up the gtk headers we need */
40 #include <gtk/gtk.h>
41 #include <glade/glade.h>
42 #ifndef WIN32
43 #include <gdk/gdkx.h>
44 #else
45 #include <time.h>
46 #include <gdk/gdkwin32.h>
47 #endif
48 #include <gdk/gdkkeysyms.h>
49 
50 #include "client-types.h"
51 #include "image.h"
52 #include "main.h"
53 #include "client.h"
54 #include "mapdata.h"
55 #include "gtk2proto.h"
56 
57 static uint8 map_updated = 0;
58 
59 /*
60  * Added for fog of war. Current size of the map structure in memory.
61  * We assume a rectangular map so this is the length of one side.
62  * command.c needs to know about this so not static
63  * FIX ME: Don't assume rectangle
64  */
65 
67 
69 GdkGC *mapgc;
72 static GdkBitmap *dark1, *dark2, *dark3;
73 static GdkPixmap *dark;
74 
75 /*
76  * This should really be one of the CONFIG values, or perhaps a checkbox
77  * someplace that displays frame rate.
78  */
80 
81 #if WIN32
82 
88 int gettimeofday(struct timeval* tp, void* tzp) {
89  DWORD t;
90  t = timeGetTime();
91  tp->tv_sec = t / 1000;
92  tp->tv_usec = t % 1000;
93  /* 0 indicates that the call succeeded. */
94  return 0;
95 }
96 #endif
97 
103 void map_init(GtkWidget *window_root)
104 {
105  GladeXML* xml_tree;
106 
107  xml_tree = glade_get_widget_tree(GTK_WIDGET(window_root));
108 
109  map_drawing_area = glade_xml_get_widget(xml_tree, "drawingarea_map");
110  map_notebook = glade_xml_get_widget(xml_tree, "map_notebook");
111 
112  g_signal_connect ((gpointer) map_drawing_area, "expose_event",
113  G_CALLBACK (on_drawingarea_map_expose_event), NULL);
114  g_signal_connect ((gpointer) map_drawing_area, "button_press_event",
115  G_CALLBACK (on_drawingarea_map_button_press_event), NULL);
116  g_signal_connect ((gpointer) map_drawing_area, "configure_event",
117  G_CALLBACK (on_drawingarea_map_configure_event), NULL);
118 
119 #if 0
120  gtk_widget_set_size_request (map_drawing_area,
122  use_config[CONFIG_MAPHEIGHT] * map_image_size);
123 #endif
124  mapgc = gdk_gc_new(map_drawing_area->window);
125  gtk_widget_show(map_drawing_area);
126  gtk_widget_add_events (map_drawing_area, GDK_BUTTON_PRESS_MASK);
127 
129  int x,y,count;
130  GdkGC *darkgc;
131  /*
132  * This is used when drawing with GdkPixmaps. Create another surface,
133  * as well as some light/dark images
134  */
135  dark = gdk_pixmap_new(map_drawing_area->window, map_image_size, map_image_size, -1);
136  gdk_draw_rectangle(dark, map_drawing_area->style->black_gc, TRUE, 0, 0, map_image_size, map_image_size);
137  dark1 = gdk_pixmap_new(map_drawing_area->window, map_image_size, map_image_size, 1);
138  dark2 = gdk_pixmap_new(map_drawing_area->window, map_image_size, map_image_size, 1);
139  dark3 = gdk_pixmap_new(map_drawing_area->window, map_image_size, map_image_size, 1);
140  /*
141  * We need our own GC here because we are working with single bit depth
142  * images
143  */
144  darkgc = gdk_gc_new(dark1);
145  gdk_gc_set_foreground(darkgc, &root_color[NDI_WHITE]);
146  /* Clear any garbage values we get when we create the bitmaps */
147  gdk_draw_rectangle(dark1, darkgc, TRUE, 0, 0, map_image_size, map_image_size);
148  gdk_draw_rectangle(dark2, darkgc, TRUE, 0, 0, map_image_size, map_image_size);
149  gdk_draw_rectangle(dark3, darkgc, TRUE, 0, 0, map_image_size, map_image_size);
150  gdk_gc_set_foreground(darkgc, &root_color[NDI_BLACK]);
151  count=0;
152  for (x=0; x<map_image_size; x++) {
153  for (y=0; y<map_image_size; y++) {
154  /*
155  * We just fill in points every X pixels - dark1 is the
156  * darkest, dark3 is the lightest. dark1 has 50% of the pixels
157  * filled in, dark2 has 33%, dark3 has 25% The formula's here
158  * are not perfect - dark2 will not match perfectly with an
159  * adjacent dark2 image. dark3 results in diagonal stripes.
160  * OTOH, these will change depending on the image size.
161  */
162  if ((x+y) % 2) {
163  gdk_draw_point(dark1, darkgc, x, y);
164  }
165  if ((x+y) %3) {
166  gdk_draw_point(dark2, darkgc, x, y);
167  }
168  if ((x+y) % 4) {
169  gdk_draw_point(dark3, darkgc, x, y);
170  }
171  /*
172  * dark1 gets filled on 0x01, 0x11, 0x10, only leaving 0x00
173  * empty
174  */
175  }
176  /*
177  * if the row size is even, we put an extra value in count - in
178  * this way, the pixels will be even on one line, odd on the next,
179  * etc instead of vertical lines - at least for dark1 and dark3
180  */
181  }
182  gdk_gc_unref(darkgc);
183  }
184 #ifdef HAVE_SDL
186  init_SDL(map_drawing_area,0);
187  }
188 #endif
189 #ifdef HAVE_OPENGL
191  init_opengl(map_drawing_area);
192  }
193 #endif
194 }
195 
201 void reset_map(void)
202 {
203 }
204 
218 static void draw_pixmap(int srcx, int srcy, int dstx, int dsty, int clipx, int clipy,
219  void *mask, void *image, int sizex, int sizey)
220 {
221  gdk_gc_set_clip_mask(mapgc, mask);
222  gdk_gc_set_clip_origin(mapgc, clipx, clipy);
223  gdk_draw_pixmap(map_drawing_area->window, mapgc, image, srcx, srcy, dstx, dsty, sizex, sizey);
224 }
225 
231 int display_mapscroll(int dx, int dy)
232 {
233 #ifdef HAVE_SDL
235  return sdl_mapscroll(dx,dy);
236  else
237 #endif
238  return 0;
239 }
240 
251 void drawsmooth (int mx,int my,int layer,int picx,int picy){
252  static int dx[8]={0,1,1,1,0,-1,-1,-1};
253  static int dy[8]={-1,-1,0,1,1,1,0,-1};
254  static int bweights[8]={2,0,4,0,8,0,1,0};
255  static int cweights[8]={0,2,0,4,0,8,0,1};
256  static int bc_exclude[8]={
257  1+2,/*north exclude northwest (bit0) and northeast(bit1)*/
258  0,
259  2+4,/*east exclude northeast and southeast*/
260  0,
261  4+8,/*and so on*/
262  0,
263  8+1,
264  0
265  };
266  int partdone[8]={0,0,0,0,0,0,0,0};
267  int slevels[8];
268  int sfaces[8];
269  int i,lowest,weight,weightC;
270  int emx,emy;
271  int smoothface;
272  int hasFace = 0;
273  for (i=0;i<=layer;i++)
274  hasFace |= the_map.cells[mx][my].heads[i].face;
275  if (!hasFace
276  || !CAN_SMOOTH(the_map.cells[mx][my], layer)) {
277  return;
278  }
279  for (i=0;i<8;i++){
280  emx=mx+dx[i];
281  emy=my+dy[i];
282  if ( (emx<0) || (emy<0) || (the_map.x<=emx) || (the_map.y<=emy)){
283  slevels[i]=0;
284  sfaces[i]=0; /*black picture*/
285  }
286  else if (the_map.cells[emx][emy].smooth[layer]<=the_map.cells[mx][my].smooth[layer]){
287  slevels[i]=0;
288  sfaces[i]=0; /*black picture*/
289  }else{
290  slevels[i]=the_map.cells[emx][emy].smooth[layer];
291  sfaces[i]=pixmaps[the_map.cells[emx][emy].heads[layer].face]->smooth_face;
292  }
293  }
294  /*
295  * Now we have a list of smoothlevel higher than current square. There are
296  * at most 8 different levels. so... check 8 times for the lowest one (we
297  * draw from bottom to top!).
298  */
299  lowest=-1;
300  while (1){
301  lowest = -1;
302  for (i=0;i<8;i++){
303  if ( (slevels[i]>0) && (!partdone[i]) &&
304  ((lowest<0) || (slevels[i]<slevels[lowest]))
305  )
306  lowest=i;
307  }
308  if (lowest<0)
309  break; /*no more smooth to do on this square*/
310  /*printf ("hey, must smooth something...%d\n",sfaces[lowest]);*/
311  /* Here we know 'what' to smooth
312  *
313  * Calculate the weight for border and weight for corners. Then
314  * 'markdone' the corresponding squares
315  *
316  * First, the border, which may exclude some corners
317  */
318  weight=0;
319  weightC=15; /*works in backward. remove where there is nothing*/
320  /*for (i=0;i<8;i++)
321  cornermask[i]=1;*/
322  for (i=0;i<8;i++){ /*check all nearby squares*/
323  if ( (slevels[i]==slevels[lowest]) &&
324  (sfaces[i]==sfaces[lowest])){
325  partdone[i]=1;
326  weight=weight+bweights[i];
327  weightC&=~bc_exclude[i];
328  }else{
329  /*must rmove the weight of a corner if not in smoothing*/
330  weightC&=~cweights[i];
331  }
332  }
333  /*We can't do this before since we need the partdone to be adjusted*/
334  if (sfaces[lowest]<=0)
335  continue; /*Can't smooth black*/
336  smoothface=sfaces[lowest];
337  if (smoothface<=0){
338  continue; /*picture for smoothing not yet available*/
339  }
340  /*
341  * now, it's quite easy. We must draw using a 32x32 part of the picture
342  * smoothface. This part is located using the 2 weights calculated:
343  * (32*weight,0) and (32*weightC,32)
344  */
345  if ( (!pixmaps[smoothface]->map_image) ||
346  (pixmaps[smoothface] == pixmaps[0]))
347  continue; /*don't have the picture associated*/
348  if (weight>0){
349  draw_pixmap(
350  weight*map_image_size, 0,
351  picx, picy,
352  picx-weight*map_image_size, picy,
353  pixmaps[smoothface]->map_mask, pixmaps[smoothface]->map_image, map_image_size, map_image_size);
354  }
355  if (weightC>0){
356  draw_pixmap(
357  weightC*map_image_size, map_image_size,
358  picx, picy,
359  picx-weightC*map_image_size, picy-map_image_size,
360  pixmaps[smoothface]->map_mask, pixmaps[smoothface]->map_image, map_image_size, map_image_size);
361  }
362  } /* while there's some smooth to do */
363 }
364 
372 static void display_mapcell(int ax, int ay, int mx, int my)
373 {
374  int layer;
375 
376  /* First, we need to black out this space. */
377  gdk_draw_rectangle(map_drawing_area->window, map_drawing_area->style->black_gc, TRUE, ax*map_image_size, ay*map_image_size, map_image_size, map_image_size);
378  /*
379  * Now draw the different layers. Only draw if using fog of war or the
380  * space isn't clear.
381  */
382  if (use_config[CONFIG_FOGWAR] || !the_map.cells[mx][my].cleared) {
383  for (layer=0; layer<MAXLAYERS; layer++) {
384  int sx, sy;
385 
386  /* draw single-tile faces first */
387  int face = mapdata_face(ax, ay, layer);
388  if (face > 0 && pixmaps[face]->map_image != NULL) {
389  int src_x = pixmaps[face]->map_width - map_image_size;;
390  int src_y = pixmaps[face]->map_height - map_image_size;
391  int off_x=0, off_y=0;
392 
393  /* Normalize the source coordinates - clearly it can't be
394  * be less than zero. If it is less than zero, this denotes
395  * a 'small' image. By definition, the bottom right is the
396  * origin of the image (an image 16 pixels high is drawn on the
397  * bottom half of the space, not top), which is why
398  * the offsets are negative of the base values.
399  */
400  if (src_x<0) {
401  off_x=-src_x;
402  src_x=0;
403  }
404  if (src_y<0) {
405  off_y = -src_y;
406  src_y=0;
407  }
408  draw_pixmap(
409  src_x, src_y,
410  ax*map_image_size + off_x, ay*map_image_size + off_y,
411  ax*map_image_size+map_image_size-pixmaps[face]->map_width,
412  ay*map_image_size+map_image_size-pixmaps[face]->map_height,
413  pixmaps[face]->map_mask, pixmaps[face]->map_image,
414  pixmaps[face]->map_width>map_image_size?map_image_size:pixmaps[face]->map_width,
415  pixmaps[face]->map_height>map_image_size?map_image_size:pixmaps[face]->map_height);
416 
417  }
418  /*
419  * Sometimes, it may happens we need to draw the smooth while there
420  * is nothing to draw at that layer (but there was something at
421  * lower layers). This is handled here. The else part is to take
422  * into account cases where the smooth as already been handled 2
423  * code lines before
424  */
426  drawsmooth (mx, my, layer, ax*map_image_size, ay*map_image_size);
427 
428  /* draw big faces last (should overlap other objects) */
429  face = mapdata_bigface(ax, ay, layer, &sx, &sy);
430 
431  if (face > 0 && pixmaps[face]->map_image != NULL) {
432  /*
433  * This is pretty messy, because images are not required to be
434  * an integral multiplier of the image size. There are really
435  * 4 main variables:
436  * source[xy]: Where within the pixmap to start grabbing pixels.
437  * off[xy]: Offset from space edge on the visible map to start
438  * drawing pixels.
439  * off[xy] also determines how many pixels to draw
440  * (map_image_size - off[xy])
441  * clip[xy]: Position of the clipmask. The position of the
442  * clipmask is always at the upper left of the image as we
443  * drawn it on the map, so for any given big image, it will
444  * have the same values for all the pieces. However we
445  * need to re-construct that location based on current
446  * location.
447  *
448  * For a 32x72 image, it would be drawn like follows:
449  * sourcey offy
450  * top space: 0 24
451  * middle space: 8 0
452  * bottom space: 40 0
453  */
454  int dx, dy, sourcex, sourcey, offx, offy, clipx, clipy;
455 
456  dx = pixmaps[face]->map_width % map_image_size;
457  offx = dx?(map_image_size -dx):0;
458  clipx = (ax - sx)*map_image_size + offx;
459 
460  if (sx) {
461  sourcex = sx * map_image_size - offx ;
462  offx=0;
463  } else {
464  sourcex=0;
465  }
466 
467  dy = pixmaps[face]->map_height % map_image_size;
468  offy = dy?(map_image_size -dy):0;
469  clipy = (ay - sy)*map_image_size + offy;
470 
471  if (sy) {
472  sourcey = sy * map_image_size - offy;
473  offy=0;
474  } else {
475  sourcey=0;
476  }
477 
478  draw_pixmap(
479  sourcex, sourcey,
480  ax*map_image_size+offx, ay*map_image_size + offy,
481  clipx, clipy,
482  pixmaps[face]->map_mask, pixmaps[face]->map_image,
483  map_image_size - offx, map_image_size - offy);
484  }
485  } /* else for processing the layers */
486  }
487  /*
488  * If this is a fog cell, do darkening of the space. otherwise, process
489  * light/darkness - only do those if not a fog cell.
490  */
491  if (use_config[CONFIG_FOGWAR] && the_map.cells[mx][my].cleared) {
492  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);
493  }
494  else if (the_map.cells[mx][my].darkness > 192) { /* Full dark */
495  gdk_draw_rectangle (map_drawing_area->window, map_drawing_area->style->black_gc,
496  TRUE,map_image_size*ax, map_image_size*ay,
497  map_image_size, map_image_size);
498  } else if (the_map.cells[mx][my].darkness> 128) {
499  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);
500  } else if (the_map.cells[mx][my].darkness> 64) {
501  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);
502  } else if (the_map.cells[mx][my].darkness> 1) {
503  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);
504  }
505 }
506 
511 void gtk_draw_map(int redraw) {
512  int mx, my;
513  int x, y;
514  struct timeval tv1, tv2,tv3;
515  long elapsed1, elapsed2;
516 
517  if(!redraw && !map_updated)
518  return;
519 
520  if (time_map_redraw)
521  gettimeofday(&tv1, NULL);
522 
523  for(x = 0; x < use_config[CONFIG_MAPWIDTH]; x++) {
524  for(y = 0; y < use_config[CONFIG_MAPHEIGHT]; y++) {
525  /*
526  * mx,my represent the spaces on the 'virtual' map (ie, the_map
527  * structure). x and y (from the for loop) represent the visible
528  * screen.
529  */
530  mx = pl_pos.x+x;
531  my = pl_pos.y+y;
532 
533  if (redraw
534  || the_map.cells[mx][my].need_update
535  || the_map.cells[mx][my].need_resmooth) {
536  display_mapcell(x, y, mx, my);
537  the_map.cells[mx][my].need_update = 0;
538  the_map.cells[mx][my].need_resmooth = 0;
539  }
540  } /* For y spaces */
541  } /* for x spaces */
542 
543  if (time_map_redraw)
544  gettimeofday(&tv2, NULL);
545 
546  if (time_map_redraw) {
547  gettimeofday(&tv3, NULL);
548  elapsed1 = (tv2.tv_sec - tv1.tv_sec)*1000000 + (tv2.tv_usec - tv1.tv_usec);
549  elapsed2 = (tv3.tv_sec - tv2.tv_sec)*1000000 + (tv3.tv_usec - tv2.tv_usec);
550  /*
551  * I care about performance for 'long' updates, so put the check in to
552  * make these a little more noticable
553  */
554  if ((elapsed1 + elapsed2)>10000)
555  LOG(LOG_INFO,"gtk::sdl_gen_map","gen took %7ld, flip took %7ld, total = %7ld",
556  elapsed1, elapsed2, elapsed1 + elapsed2);
557  }
558 }
559 
565 {
566  reset_map();
567 }
568 
575 void resize_map_window(int x, int y)
576 {
577  /* We do an implicit clear, since after a resize, there may be some
578  * left over pixels at the edge which will not get drawn on by map spaces.
579  */
580  gdk_window_clear(map_drawing_area->window);
581  draw_map(TRUE);
582 }
583 
584 
585 gboolean
587  GdkEventConfigure *event,
588  gpointer user_data)
589 {
590  sint16 w = event->width / map_image_size, h=event->height / map_image_size;
591 
592  if (w > MAP_MAX_SIZE) w = MAP_MAX_SIZE;
593  if (h > MAP_MAX_SIZE) h = MAP_MAX_SIZE;
594 
595  /* Only need to do something if the size actually changes in terms
596  * of displayable mapspaces.
597  */
599  /* We need to set the use_config values, even though we are not really using them,
600  * because the setup processing basically expects the values returned from the
601  * server to use these values.
602  * Likewise, we need to call mapdata_set_size because we may try
603  * to do map draws before we get the setup command from the server, and if it
604  * is using the old values, that doesn't work quite right.
605  */
610  "setup mapsize %dx%d", use_config[CONFIG_MAPWIDTH], use_config[CONFIG_MAPHEIGHT]);
611  }
612  return FALSE;
613 }
614 
615 
620 void draw_splash(void)
621 {
622  static GdkPixmap *splash;
623  static int have_init=0;
624  GdkBitmap *aboutgdkmask;
625  int x,y, w, h;
626 
627 #include "../../pixmaps/crossfiretitle.xpm"
628 
630  if (!have_init) {
631  splash = gdk_pixmap_create_from_xpm_d(map_drawing_area->window,
632  &aboutgdkmask, NULL,
633  (gchar **)crossfiretitle_xpm);
634  have_init=1;
635  }
636  gdk_window_clear(map_drawing_area->window);
637  gdk_drawable_get_size(splash, &w, &h);
638  x = (map_drawing_area->allocation.width- w)/2;
639  y = (map_drawing_area->allocation.height - h)/2;
640  /*
641  * Clear the clip mask - it can be left in an inconsistent state from
642  * last map redraw.
643  */
644  gdk_gc_set_clip_mask(mapgc, NULL);
645  gdk_draw_pixmap(map_drawing_area->window, mapgc, splash, 0, 0,
646  x, y, w, h);
647  }
648 }
649 
654 void draw_map(int redraw)
655 {
656 #ifdef HAVE_SDL
658  else
659 #endif
660 #ifdef HAVE_OPENGL
662  else
663 #endif
666  else gtk_draw_map(redraw);
667  }
668 }
669 
677 gboolean
679  GdkEventExpose *event,
680  gpointer user_data)
681 {
682  draw_map(TRUE);
683  return FALSE;
684 }
685 
693 gboolean
695  GdkEventButton *event,
696  gpointer user_data)
697 {
698  int dx, dy, i, x, y, xmidl, xmidh, ymidl, ymidh;
699 
700  x=(int)event->x;
701  y=(int)event->y;
705  xmidh=(use_config[CONFIG_MAPWIDTH]/2 + 1) * map_image_size;
707  ymidh=(use_config[CONFIG_MAPHEIGHT]/2 + 1) * map_image_size;
708 
709  switch (event->button) {
710  case 1:
711  look_at(dx,dy);
712  break;
713 
714  case 2:
715  case 3:
716  if (x<xmidl)
717  i = 0;
718  else if (x>xmidh)
719  i = 6;
720  else i =3;
721 
722  if (y>ymidh)
723  i += 2;
724  else if (y>ymidl)
725  i++;
726 
727  if (event->button==2) {
728  switch (i) {
729  case 0: fire_dir (8);break;
730  case 1: fire_dir (7);break;
731  case 2: fire_dir (6);break;
732  case 3: fire_dir (1);break;
733  case 5: fire_dir (5);break;
734  case 6: fire_dir (2);break;
735  case 7: fire_dir (3);break;
736  case 8: fire_dir (4);break;
737  }
738  /* Only want to fire once */
739  clear_fire();
740  }
741  else switch (i) {
742  case 0: move_player (8);break;
743  case 1: move_player (7);break;
744  case 2: move_player (6);break;
745  case 3: move_player (1);break;
746  case 5: move_player (5);break;
747  case 6: move_player (2);break;
748  case 7: move_player (3);break;
749  case 8: move_player (4);break;
750  }
751  }
752  return FALSE;
753 }
754 
762 {
763 }
764 
772 void display_map_doneupdate(int redraw, int notice)
773 {
774  map_updated |= redraw || !notice;
775 }
#define CAN_SMOOTH(__SQUARE, __LEVEL)
Definition: client.h:85
signed short sint16
Definition: client-types.h:80
GtkWidget * map_drawing_area
Definition: map.c:68
GdkGC * mapgc
Definition: map.c:69
void resize_map_window(int x, int y)
Definition: map.c:575
void display_map_doneupdate(int redraw, int notice)
Definition: map.c:772
int y
Definition: mapdata.h:93
void init_SDL(GtkWidget *sdl_window, int just_lightmap)
void move_player(int dir)
Definition: player.c:99
void map_init(GtkWidget *window_root)
Definition: map.c:103
#define DEFAULT_IMAGE_SIZE
Definition: gx11.c:114
void reset_map(void)
Definition: map.c:76
static XEvent event
Definition: x11.c:193
void clear_fire(void)
Definition: player.c:134
#define MAP_MAX_SIZE
Definition: client.h:447
ClientSocket csocket
Definition: client.c:78
#define CONFIG_FOGWAR
Definition: client.h:157
void display_map_startupdate(void)
Definition: map.c:761
uint16 map_height
Definition: gx11.h:64
PixmapInfo * pixmaps[MAXPIXMAPNUM]
Definition: gx11.c:118
uint8 need_update
Definition: mapdata.h:81
#define CFG_DM_SDL
Definition: client.h:195
sint16 face
Definition: mapdata.h:45
void LOG(LogLevel level, const char *origin, const char *format,...)
Definition: misc.c:178
gboolean on_drawingarea_map_button_press_event(GtkWidget *widget, GdkEventButton *event, gpointer user_data)
Definition: map.c:694
static GdkBitmap * dark1
Definition: map.c:72
#define TRUE
Definition: client-types.h:71
gboolean on_drawingarea_map_expose_event(GtkWidget *widget, GdkEventExpose *event, gpointer user_data)
Definition: map.c:678
void look_at(int x, int y)
Definition: player.c:75
Pixmap mask
Definition: xutil.c:67
GtkWidget * window_root
Definition: main.c:56
int sdl_mapscroll(int dx, int dy)
int cs_print_string(int fd, const char *str,...)
Definition: newsocket.c:259
static void draw_pixmap(int srcx, int srcy, int dstx, int dsty, int clipx, int clipy, void *mask, void *image, int sizex, int sizey)
Definition: map.c:218
sint16 use_config[CONFIG_NUMS]
Definition: init.c:50
sint16 mapdata_face(int x, int y, int layer)
Definition: mapdata.c:955
uint8 darkness
Definition: mapdata.h:80
int map_image_size
Definition: map.c:70
Client_Player cpl
Definition: client.c:77
struct Map the_map
Definition: mapdata.c:121
static GdkBitmap * dark2
Definition: map.c:72
uint8 cleared
Definition: mapdata.h:84
const char *const rcsid_gtk2_map_c
Definition: map.c:1
struct MapCell ** cells
Definition: mapdata.h:95
int fd
Definition: client.h:97
int x
Definition: mapdata.h:92
gboolean on_drawingarea_map_configure_event(GtkWidget *widget, GdkEventConfigure *event, gpointer user_data)
Definition: map.c:586
void draw_map(int redraw)
Definition: map.c:654
#define NDI_WHITE
Definition: newclient.h:202
void drawsmooth(int mx, int my, int layer, int picx, int picy)
Definition: map.c:104
#define CONFIG_SMOOTH
Definition: client.h:177
int map_image_half_size
Definition: map.c:71
GdkColor root_color[16]
Definition: gx11.c:244
uint8 need_resmooth
Definition: mapdata.h:83
#define CFG_DM_PIXMAP
Definition: client.h:194
void init_opengl(GtkWidget *drawingarea)
#define MAXLAYERS
Definition: mapdata.h:32
#define CONFIG_MAPWIDTH
Definition: client.h:170
void display_map_newmap(void)
Definition: map.c:564
uint16 smooth[MAXLAYERS]
Definition: mapdata.h:79
#define CONFIG_MAPHEIGHT
Definition: client.h:171
sint16 mapdata_bigface(int x, int y, int layer, int *ww, int *hh)
Definition: mapdata.c:966
static GdkPixmap * dark
Definition: map.c:73
void opengl_gen_map(int redraw)
int time_map_redraw
Definition: map.c:79
Input_State input_state
Definition: client.h:277
int display_mapscroll(int dx, int dy)
Definition: map.c:88
static uint8 map_updated
Definition: map.c:57
PlayerPosition pl_pos
Definition: map.c:69
uint16 smooth_face
Definition: gx11.h:66
#define CFG_DM_OPENGL
Definition: client.h:196
void draw_splash(void)
Definition: map.c:620
static GdkBitmap * dark3
Definition: map.c:72
#define CONFIG_DISPLAYMODE
Definition: client.h:161
GtkWidget * map_notebook
Definition: map.c:68
unsigned char uint8
Definition: client-types.h:81
void gtk_draw_map(int redraw)
Definition: map.c:337
struct MapCellLayer heads[MAXLAYERS]
Definition: mapdata.h:77
#define NDI_BLACK
Definition: newclient.h:201
#define FALSE
Definition: client-types.h:68
void mapdata_set_size(int viewx, int viewy)
Definition: mapdata.c:577
static void display_mapcell(int ax, int ay, int mx, int my)
Definition: map.c:372
void sdl_gen_map(int redraw)
void fire_dir(int dir)
Definition: player.c:151
uint16 map_width
Definition: gx11.h:64