Crossfire Client, Branch  R11627
Functions | Variables
map.c File Reference

Handles map related code in terms of allocation, insertion of new objects, and actual rendering (although the sdl rendering is in the sdl file. More...

#include <config.h>
#include <stdlib.h>
#include <sys/stat.h>
#include <unistd.h>
#include <png.h>
#include <gtk/gtk.h>
#include <glade/glade.h>
#include <gdk/gdkx.h>
#include <gdk/gdkkeysyms.h>
#include "client-types.h"
#include "image.h"
#include "main.h"
#include "client.h"
#include "mapdata.h"
#include "gtk2proto.h"
#include "../../pixmaps/crossfiretitle.xpm"
Include dependency graph for map.c:

Go to the source code of this file.

Functions

void display_map_doneupdate (int redraw, int notice)
 This is called after the map has been all digested.
void display_map_newmap (void)
 The player has changed maps, so any info we have (for fog of war) is bogus, so clear out all that old info.
void display_map_startupdate (void)
 This isn't used - it is basically a prequel - we know we got a map command from the server, but have digested it all yet.
static void display_mapcell (int ax, int ay, int mx, int my)
int display_mapscroll (int dx, int dy)
void draw_map (int redraw)
static void draw_pixmap (int srcx, int srcy, int dstx, int dsty, int clipx, int clipy, void *mask, void *image, int sizex, int sizey)
void draw_splash (void)
 Simple routine to put the splash icon in the map window.
void drawsmooth (int mx, int my, int layer, int picx, int picy)
 Draw anything in adjacent squares that could smooth on given square.
void gtk_draw_map (int redraw)
void map_init (GtkWidget *window_root)
 This initializes the stuff we need for the map.
gboolean on_drawingarea_map_button_press_event (GtkWidget *widget, GdkEventButton *event, gpointer user_data)
gboolean on_drawingarea_map_configure_event (GtkWidget *widget, GdkEventConfigure *event, gpointer user_data)
gboolean on_drawingarea_map_expose_event (GtkWidget *widget, GdkEventExpose *event, gpointer user_data)
void reset_map (void)
 Request a map update from the server.
void resize_map_window (int x, int y)
 Resize_map_window is a NOOP for the time being - not sure if it will in fact need to do something, since there are scrollbars for the map window now.

Variables

static GdkPixmap * dark
static GdkBitmap * dark1
static GdkBitmap * dark2
static GdkBitmap * dark3
GtkWidget * map_drawing_area
int map_image_half_size = DEFAULT_IMAGE_SIZE/2
int map_image_size = DEFAULT_IMAGE_SIZE
GtkWidget * map_notebook
 main.c - drawing areas for the maps
static uint8 map_updated = 0
GdkGC * mapgc
PlayerPosition pl_pos
const char *const rcsid_gtk2_map_c = "$Id: map.c 11117 2009-01-05 07:11:04Z mwedel $"
int time_map_redraw = 0

Detailed Description

Handles map related code in terms of allocation, insertion of new objects, and actual rendering (although the sdl rendering is in the sdl file.

Definition in file map.c.


Function Documentation

void display_map_doneupdate ( int  redraw,
int  notice 
)

This is called after the map has been all digested.

Do the map drawing.

this should perhaps be removed, and left to being done from from the main event loop.

Parameters:
redrawIf set, force redraw of all tiles.
noticeIf set, another call will follow soon.

Definition at line 772 of file map.c.

References map_updated.

void display_map_newmap ( void  )

The player has changed maps, so any info we have (for fog of war) is bogus, so clear out all that old info.

Definition at line 564 of file map.c.

References reset_map().

Here is the call graph for this function:

void display_map_startupdate ( void  )

This isn't used - it is basically a prequel - we know we got a map command from the server, but have digested it all yet.

This can be useful if there is info we know we need to store away or the like before it is destroyed, but there isn't anything like that for the gtk client.

Definition at line 761 of file map.c.

static void display_mapcell ( int  ax,
int  ay,
int  mx,
int  my 
) [static]
Parameters:
ax
ay
mx
my

Definition at line 372 of file map.c.

References Map::cells, MapCell::cleared, CONFIG_FOGWAR, CONFIG_SMOOTH, dark, dark1, dark2, dark3, MapCell::darkness, draw_pixmap(), drawsmooth(), map_drawing_area, PixmapInfo::map_height, map_image_size, PixmapInfo::map_width, mapdata_bigface(), mapdata_face(), MAXLAYERS, pixmaps, the_map, TRUE, and use_config.

Referenced by gtk_draw_map().

Here is the call graph for this function:

Here is the caller graph for this function:

int display_mapscroll ( int  dx,
int  dy 
)
Parameters:
dx
dy

Definition at line 231 of file map.c.

References CFG_DM_SDL, CONFIG_DISPLAYMODE, sdl_mapscroll(), and use_config.

Here is the call graph for this function:

void draw_map ( int  redraw)
Parameters:
redraw

Definition at line 654 of file map.c.

References CFG_DM_OPENGL, CFG_DM_PIXMAP, CFG_DM_SDL, CONFIG_DISPLAYMODE, cpl, draw_splash(), gtk_draw_map(), Player_Struct::input_state, Metaserver_Select, opengl_gen_map(), sdl_gen_map(), and use_config.

Referenced by client_tick(), do_network(), get_metaserver(), on_drawingarea_map_expose_event(), and resize_map_window().

Here is the call graph for this function:

Here is the caller graph for this function:

static void draw_pixmap ( int  srcx,
int  srcy,
int  dstx,
int  dsty,
int  clipx,
int  clipy,
void *  mask,
void *  image,
int  sizex,
int  sizey 
) [static]
Parameters:
srcx
srcy
dstx
dsty
clipx
clipy
mask
image
sizex
sizey

Definition at line 218 of file map.c.

References map_drawing_area, and mapgc.

Referenced by display_mapcell(), and drawsmooth().

Here is the caller graph for this function:

void draw_splash ( void  )

Simple routine to put the splash icon in the map window.

Only supported with non-SDL right now.

Definition at line 620 of file map.c.

References CFG_DM_PIXMAP, CONFIG_DISPLAYMODE, map_drawing_area, mapgc, and use_config.

Referenced by draw_map(), and main().

Here is the caller graph for this function:

void drawsmooth ( int  mx,
int  my,
int  layer,
int  picx,
int  picy 
)

Draw anything in adjacent squares that could smooth on given square.

Parameters:
mx
mySquare to smooth on. You should not call this function to smooth on a 'completely black' square.
layerLayer to examine (we smooth only one layer at a time)
picx
picyPlace on the map_drawing_area->window to draw

Definition at line 251 of file map.c.

References CAN_SMOOTH, Map::cells, draw_pixmap(), MapCellLayer::face, MapCell::heads, map_image_size, pixmaps, MapCell::smooth, PixmapInfo::smooth_face, the_map, Map::x, and Map::y.

Referenced by display_mapcell().

Here is the call graph for this function:

Here is the caller graph for this function:

void gtk_draw_map ( int  redraw)
Parameters:
redraw

Definition at line 511 of file map.c.

References Map::cells, CONFIG_MAPHEIGHT, CONFIG_MAPWIDTH, display_mapcell(), drawingarea, LOG(), LOG_INFO, map_image_size, map_updated, mapwindow, MapCell::need_resmooth, MapCell::need_update, the_map, time_map_redraw, use_config, Map::x, PlayerPosition::x, Map::y, and PlayerPosition::y.

Referenced by client_tick(), display_map_doneupdate(), and draw_map().

Here is the call graph for this function:

Here is the caller graph for this function:

void map_init ( GtkWidget *  window_root)

This initializes the stuff we need for the map.

Parameters:
window_rootThe client's main playing window.

Definition at line 103 of file map.c.

References CFG_DM_OPENGL, CFG_DM_PIXMAP, CFG_DM_SDL, CONFIG_DISPLAYMODE, CONFIG_MAPHEIGHT, CONFIG_MAPWIDTH, dark, dark1, dark2, dark3, init_opengl(), init_SDL(), map_drawing_area, map_image_size, map_notebook, mapgc, NDI_BLACK, NDI_WHITE, on_drawingarea_map_button_press_event(), on_drawingarea_map_configure_event(), on_drawingarea_map_expose_event(), root_color, TRUE, and use_config.

Referenced by main().

Here is the call graph for this function:

Here is the caller graph for this function:

gboolean on_drawingarea_map_button_press_event ( GtkWidget *  widget,
GdkEventButton *  event,
gpointer  user_data 
)
Parameters:
widget
event
user_data
Returns:
FALSE

Definition at line 694 of file map.c.

References clear_fire(), CONFIG_MAPHEIGHT, CONFIG_MAPWIDTH, FALSE, fire_dir(), look_at(), map_image_size, move_player(), and use_config.

Referenced by map_init().

Here is the call graph for this function:

Here is the caller graph for this function:

gboolean on_drawingarea_map_configure_event ( GtkWidget *  widget,
GdkEventConfigure *  event,
gpointer  user_data 
)

Definition at line 586 of file map.c.

References CONFIG_MAPHEIGHT, CONFIG_MAPWIDTH, cs_print_string(), csocket, FALSE, ClientSocket::fd, map_image_size, MAP_MAX_SIZE, mapdata_set_size(), and use_config.

Referenced by map_init().

Here is the call graph for this function:

Here is the caller graph for this function:

gboolean on_drawingarea_map_expose_event ( GtkWidget *  widget,
GdkEventExpose *  event,
gpointer  user_data 
)
Parameters:
widget
event
user_data
Returns:
FALSE

Definition at line 678 of file map.c.

References draw_map(), FALSE, and TRUE.

Referenced by map_init().

Here is the call graph for this function:

Here is the caller graph for this function:

void reset_map ( void  )

Request a map update from the server.

This is to circumvent a bug in some server versions.

Todo:
remove

Definition at line 201 of file map.c.

void resize_map_window ( int  x,
int  y 
)

Resize_map_window is a NOOP for the time being - not sure if it will in fact need to do something, since there are scrollbars for the map window now.

Note - this is note a window resize request, but rather process the size (in spaces) of the map - is received from server.

Definition at line 575 of file map.c.

References draw_map(), map_drawing_area, and TRUE.

Here is the call graph for this function:


Variable Documentation

GdkPixmap* dark [static]

Definition at line 73 of file map.c.

GdkBitmap* dark1 [static]

Definition at line 72 of file map.c.

GdkBitmap * dark2 [static]

Definition at line 72 of file map.c.

GdkBitmap * dark3 [static]

Definition at line 72 of file map.c.

GtkWidget* map_drawing_area

Definition at line 68 of file map.c.

Referenced by display_mapcell(), draw_pixmap(), draw_splash(), map_init(), and resize_map_window().

Definition at line 71 of file map.c.

Definition at line 70 of file map.c.

GtkWidget * map_notebook

main.c - drawing areas for the maps

Definition at line 68 of file map.c.

Referenced by draw_magic_map(), magic_map_flash_pos(), and map_init().

uint8 map_updated = 0 [static]

Definition at line 57 of file map.c.

Referenced by display_map_doneupdate(), and gtk_draw_map().

GdkGC* mapgc

Definition at line 69 of file map.c.

Definition at line 66 of file map.c.

const char* const rcsid_gtk2_map_c = "$Id: map.c 11117 2009-01-05 07:11:04Z mwedel $"

Definition at line 1 of file map.c.

int time_map_redraw = 0

Definition at line 79 of file map.c.