Crossfire Client, Branch
R11627
|
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"
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 |
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.
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.
redraw | If set, force redraw of all tiles. |
notice | If 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().
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.
static void display_mapcell | ( | int | ax, |
int | ay, | ||
int | mx, | ||
int | my | ||
) | [static] |
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().
int display_mapscroll | ( | int | dx, |
int | dy | ||
) |
dx | |
dy |
Definition at line 231 of file map.c.
References CFG_DM_SDL, CONFIG_DISPLAYMODE, sdl_mapscroll(), and use_config.
void draw_map | ( | int | redraw | ) |
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().
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] |
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().
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().
void drawsmooth | ( | int | mx, |
int | my, | ||
int | layer, | ||
int | picx, | ||
int | picy | ||
) |
Draw anything in adjacent squares that could smooth on given square.
mx | |
my | Square to smooth on. You should not call this function to smooth on a 'completely black' square. |
layer | Layer to examine (we smooth only one layer at a time) |
picx | |
picy | Place 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().
void gtk_draw_map | ( | int | redraw | ) |
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().
void map_init | ( | GtkWidget * | window_root | ) |
This initializes the stuff we need for the map.
window_root | The 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().
gboolean on_drawingarea_map_button_press_event | ( | GtkWidget * | widget, |
GdkEventButton * | event, | ||
gpointer | user_data | ||
) |
widget | |
event | |
user_data |
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().
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().
gboolean on_drawingarea_map_expose_event | ( | GtkWidget * | widget, |
GdkEventExpose * | event, | ||
gpointer | user_data | ||
) |
widget | |
event | |
user_data |
Definition at line 678 of file map.c.
References draw_map(), FALSE, and TRUE.
Referenced by map_init().
void reset_map | ( | void | ) |
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.
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().
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().
const char* const rcsid_gtk2_map_c = "$Id: map.c 11117 2009-01-05 07:11:04Z mwedel $" |
int time_map_redraw = 0 |