![]() |
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) |
Given x, y coordinates on the map drawing area, determine the tile that the coordinates are on with respect to the player. More... | |
void | display_map_doneupdate (int redraw, int notice) |
This is called after the map has been all digested. More... | |
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 () |
Draw the map window using the appropriate backend. More... | |
static void | draw_move_to (cairo_t *cr, int mx_start, int my_start) |
static void | draw_pixmap (cairo_t *cr, PixmapInfo *pixmap, int ax, int ay) |
Draw a pixmap to the given map tile on screen. More... | |
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) |
Draw anything in adjacent squares that could smooth on given square. More... | |
static void | gtk_map_redraw () |
Redraw the entire map using GTK. More... | |
static gboolean | map_button_event (GtkWidget *widget, GdkEventButton *event, gpointer user_data) |
Handle a mouse event in the drawing area. More... | |
void | map_check_resize () |
Calculate and set desired map size based on map window size. More... | |
static void | map_draw_labels (cairo_t *cr, int mx_start, int nx, int my_start, int ny) |
static void | map_draw_layer (cairo_t *cr, int layer, int mx_start, int nx, int my_start, int ny) |
Draw a single map layer to the given cairo context. More... | |
static gboolean | map_expose_event (GtkWidget *widget, GdkEventExpose *event, gpointer user_data) |
void | map_init (GtkWidget *window_root) |
This initializes the stuff we need for the map. More... | |
static double | mapcell_darkness (int mx, int my) |
int | relative_direction (int dx, int dy) |
Given a relative tile coordinate, determine its compass direction. More... | |
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. More... | |
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 |
Speed of local map prediction scrolling, 0-100 (0 to disable). More... | |
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 589 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 671 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 155 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 364 of file map.c.
References CFG_LT_PIXEL, CFG_LT_PIXEL_BEST, CFG_LT_TILE, CONFIG_LIGHTING, 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 525 of file map.c.
References CONFIG_MAPSCALE, gtk_map_redraw(), LOG(), LOG_DEBUG, map_check_resize(), MIN, time_map_redraw, update_global_offset(), and use_config.
Referenced by map_expose_event(), and redraw().
|
static |
Definition at line 411 of file map.c.
References is_at_moveto(), map_image_size, move_to_attack, move_to_x, and move_to_y.
Referenced by gtk_map_redraw().
|
static |
Draw a pixmap to the given map tile on screen.
Definition at line 137 of file map.c.
References PixmapInfo::map_image, and map_image_size.
Referenced by map_draw_layer().
|
static |
Definition at line 144 of file map.c.
References 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 169 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 437 of file map.c.
References CONFIG_LIGHTING, CONFIG_MAPHEIGHT, CONFIG_MAPSCALE, CONFIG_MAPWIDTH, draw_darkness(), draw_move_to(), global_offset_x, global_offset_y, map_draw_labels(), map_draw_layer(), map_drawing_area, map_image_size, map_updated, MAXLAYERS, MIN, pl_pos, render_debug_layers, use_config, PlayerPosition::x, and PlayerPosition::y.
Referenced by draw_map().
|
static |
Handle a mouse event in the drawing area.
Definition at line 634 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 |
Definition at line 308 of file map.c.
References MapCell::label, MapLabel::label, MAP2_LABEL_DM, MAP2_LABEL_PLAYER_PARTY, map_image_size, mapdata_cell(), MapLabel::next, and MapLabel::subtype.
Referenced by gtk_map_redraw().
|
static |
Draw a single map layer to the given cairo context.
Definition at line 282 of file map.c.
References CONFIG_FOGWAR, CONFIG_SMOOTH, draw_pixmap(), drawsmooth(), FOG, mapdata_cell(), mapdata_face_info(), pixmaps, and use_config.
Referenced by gtk_map_redraw().
|
static |
Definition at line 548 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::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 356 of file map.c.
References CONFIG_FOGWAR, MapCell::darkness, FOG, 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 560 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 511 of file map.c.
Referenced by SetupCmd().
|
static |
Definition at line 514 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_move_to(), draw_pixmap(), draw_smooth_pixmap(), get_map_image_size(), gtk_map_redraw(), init_image_cache_data(), map_check_resize(), map_draw_labels(), 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 56 of file config.c.
Referenced by config_load(), save_defaults(), and update_global_offset().
bool time_map_redraw |
Definition at line 53 of file config.c.
Referenced by draw_map().