Crossfire Client, Trunk
|
#include "client.h"
#include <math.h>
#include <gtk/gtk.h>
#include "image.h"
#include "main.h"
#include "mapdata.h"
#include "gtk2proto.h"
Go to the source code of this file.
Functions | |
static void | coord_to_tile (int x, int y, int *dx, int *dy) |
void | display_map_doneupdate (int redraw, int notice) |
int | display_mapscroll (int dx, int dy) |
static void | draw_darkness (cairo_t *cr, int nx, int ny, int mx_start, int my_start) |
void | draw_map () |
static void | draw_pixmap (cairo_t *cr, PixmapInfo *pixmap, int ax, int ay, int off_x, int off_y) |
static void | draw_smooth_pixmap (cairo_t *cr, PixmapInfo *pixmap, const int sx, const int sy, const int dx, const int dy) |
static void | drawsmooth (cairo_t *cr, int mx, int my, int layer, int picx, int picy) |
static void | gtk_map_redraw () |
static gboolean | map_button_event (GtkWidget *widget, GdkEventButton *event, gpointer user_data) |
void | map_check_resize () |
static void | map_draw_layer (cairo_t *cr, int layer, int pass, int mx_start, int nx, int my_start, int ny, int off_x, int off_y) |
static gboolean | map_expose_event (GtkWidget *widget, GdkEventExpose *event, gpointer user_data) |
void | map_init (GtkWidget *window_root) |
static double | mapcell_darkness (int mx, int my) |
int | relative_direction (int dx, int dy) |
void | resize_map_window (int x, int y) |
static void | update_global_offset () |
Variables | |
static GtkWidget * | map_drawing_area |
int | map_image_size = DEFAULT_IMAGE_SIZE |
GtkWidget * | map_notebook |
static gboolean | map_updated = FALSE |
int | predict_alpha |
bool | time_map_redraw |
Initializes and renders the map drawing area. Handles map drawing area events, notably the "click to look at" mouse event.
Definition in file map.c.
|
static |
Given x, y coordinates on the map drawing area, determine the tile that the coordinates are on with respect to the player. Clicking on the tile with the player returns (0, 0).
Definition at line 540 of file map.c.
References CONFIG_MAPHEIGHT, CONFIG_MAPSCALE, CONFIG_MAPWIDTH, map_drawing_area, map_image_size, and use_config.
Referenced by map_button_event().
void display_map_doneupdate | ( | int | redraw, |
int | notice | ||
) |
This is called after the map has been all digested. 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 622 of file map.c.
References map_updated, and redraw().
Referenced by Map2Cmd(), map_scrollCmd(), and MapExtendedCmd().
int display_mapscroll | ( | int | dx, |
int | dy | ||
) |
Definition at line 156 of file map.c.
Referenced by mapdata_scroll().
|
static |
Create light map nx wide, ny tall. Add a border 1px around to get rid of edge effects.
Definition at line 317 of file map.c.
References CFG_LT_PIXEL, CFG_LT_PIXEL_BEST, CFG_LT_TILE, CONFIG_LIGHTING, global_offset_x, global_offset_y, map_image_size, mapcell_darkness(), MIN, and use_config.
Referenced by gtk_map_redraw().
void draw_map | ( | ) |
Draw the map window using the appropriate backend.
Definition at line 477 of file map.c.
References CONFIG_MAPSCALE, gtk_map_redraw(), LOG(), LOG_DEBUG, map_check_resize(), time_map_redraw, update_global_offset(), and use_config.
Referenced by map_expose_event(), and redraw().
|
static |
Draw a pixmap to the given map tile on screen.
Definition at line 138 of file map.c.
References global_offset_x, global_offset_y, PixmapInfo::map_image, and map_image_size.
Referenced by map_draw_layer().
|
static |
Definition at line 145 of file map.c.
References global_offset_x, global_offset_y, PixmapInfo::map_image, and map_image_size.
Referenced by drawsmooth().
|
static |
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 170 of file map.c.
References draw_smooth_pixmap(), MapCellLayer::face, MapCell::heads, mapdata_can_smooth(), mapdata_cell(), mapdata_contains(), pixmaps, MapCell::smooth, and PixmapInfo::smooth_face.
Referenced by map_draw_layer().
|
static |
Redraw the entire map using GTK.
Definition at line 367 of file map.c.
References CONFIG_LIGHTING, CONFIG_MAPHEIGHT, CONFIG_MAPSCALE, CONFIG_MAPWIDTH, draw_darkness(), global_offset_x, global_offset_y, is_at_moveto(), map_draw_layer(), map_drawing_area, map_image_size, map_updated, mapdata_cell(), MAXLAYERS, move_to_attack, move_to_x, move_to_y, MapCell::need_resmooth, MapCell::need_update, pl_pos, use_config, PlayerPosition::x, and PlayerPosition::y.
Referenced by draw_map().
|
static |
Handle a mouse event in the drawing area.
Definition at line 585 of file map.c.
References clear_fire(), coord_to_tile(), fire_dir(), look_at(), relative_direction(), run_move_to(), and set_move_to().
Referenced by map_init().
|
static |
Draw a single map layer to the given cairo context.
Definition at line 283 of file map.c.
References CONFIG_FOGWAR, CONFIG_SMOOTH, draw_pixmap(), drawsmooth(), mapdata_cell(), mapdata_face_info(), pixmaps, and use_config.
Referenced by gtk_map_redraw().
|
static |
Definition at line 499 of file map.c.
References draw_map().
Referenced by map_init().
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 86 of file map.c.
References CONFIG_MAPSCALE, DEFAULT_IMAGE_SIZE, do_new_image(), face_info, Face_Information_struct::faceset, Face_Information_struct::facesets, PixmapInfo::full_icon_height, PixmapInfo::full_icon_width, PixmapInfo::icon_height, PixmapInfo::icon_width, image_size, LOG(), LOG_ERROR, map_button_event(), map_check_resize(), map_drawing_area, map_expose_event(), map_image_size, map_notebook, pixmaps, rescale_rgba_data(), FaceSets_struct::size, use_config, and window_xml.
Referenced by show_main_client().
|
static |
Definition at line 309 of file map.c.
References CONFIG_FOGWAR, MapCell::darkness, mapdata_cell(), and use_config.
Referenced by draw_darkness().
int relative_direction | ( | int | dx, |
int | dy | ||
) |
Given a relative tile coordinate, determine its compass direction.
dx | Relative 'x' coordinate |
dy | Relative 'y' coordinate |
Definition at line 511 of file map.c.
Referenced by map_button_event(), and run_move_to().
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 463 of file map.c.
Referenced by SetupCmd().
|
static |
Definition at line 466 of file map.c.
References global_offset_x, global_offset_y, map_image_size, predict_alpha, want_offset_x, and want_offset_y.
Referenced by draw_map().
|
static |
Definition at line 38 of file map.c.
Referenced by coord_to_tile(), gtk_map_redraw(), map_check_resize(), and map_init().
int map_image_size = DEFAULT_IMAGE_SIZE |
Definition at line 34 of file map.c.
Referenced by coord_to_tile(), draw_darkness(), draw_pixmap(), draw_smooth_pixmap(), get_map_image_size(), gtk_map_redraw(), init_image_cache_data(), map_check_resize(), map_init(), and update_global_offset().
GtkWidget* map_notebook |
Definition at line 37 of file map.c.
Referenced by client_tick(), draw_magic_map(), and map_init().
|
static |
Definition at line 35 of file map.c.
Referenced by display_map_doneupdate(), and gtk_map_redraw().
int predict_alpha |
Speed of local map prediction scrolling, 0-100 (0 to disable).
Definition at line 54 of file config.c.
Referenced by config_load(), save_defaults(), and update_global_offset().
bool time_map_redraw |
Definition at line 51 of file config.c.
Referenced by draw_map().