Crossfire Client, Branches
R11627
|
Go to the source code of this file.
Functions | |
void | addsmooth (uint16 face, uint16 smooth_face) |
int | associate_cache_entry (Cache_Entry *ce, int pixnum) |
void | bind_callback (GtkWidget *gtklist, GdkEventButton *event) |
void | bind_key (const char *params) |
void | cclist_button_event (GtkWidget *gtklist, gint row, gint column, GdkEventButton *event) |
void | chelpdialog (GtkWidget *widget) |
void | ckeyclear (void) |
void | ckeyentry_callback (GtkWidget *widget, GdkEventKey *event, GtkWidget *window) |
void | ckeyunbind (GtkWidget *gtklist, GdkEventButton *event) |
void | cleanup_connection (void) |
void | cleanup_textmanagers (void) |
void | client_exit (void) |
void | client_pickup (uint32 pickup) |
void | client_tick (uint32 tick) |
void | close_container (item *op) |
void | command_show (const char *params) |
void | configdialog (GtkWidget *widget) |
int | create_and_rescale_image_from_data (Cache_Entry *ce, int pixmap_num, uint8 *rgba_data, int width, int height) |
void | create_windows (void) |
void | disconnect (GtkWidget *widget) |
void | display_map_doneupdate (int redraw, int notice) |
void | display_map_newmap (void) |
void | display_map_startupdate (void) |
int | display_mapscroll (int dx, int dy) |
void | do_clearlock (void) |
int | do_timeout (void) |
void | draw_color_info (int colr, const char *buf) |
void | draw_info (const char *str, int color) |
void | draw_info_windows (void) |
void | draw_keybindings (GtkWidget *keylist) |
void | draw_magic_map (void) |
void | draw_message_window (int redraw) |
void | draw_prompt (const char *str) |
void | draw_stats (int redraw) |
void | drawsmooth (int mx, int my, int layer, int picx, int picy) |
int | get_info_width (void) |
void | get_inv_display (GtkWidget *frame) |
void | get_look_display (GtkWidget *frame) |
void | get_map_image_size (int face, uint8 *w, uint8 *h) |
char * | get_metaserver (void) |
news_entry * | get_news (void) |
const char * | get_rules (void) |
void | get_window_coord (GtkWidget *win, int *x, int *y, int *wx, int *wy, int *w, int *h) |
const char * | getMOTD (void) |
void | gLogHandler (const gchar *log_domain, GLogLevelFlags log_level, const gchar *message, gpointer user_data) |
int | gtk_checkchilds (void) |
void | gtk_command_history (int direction) |
void | gtk_complete_command (void) |
void | gtk_draw_map (int redraw) |
void | gtkLogListener (LogEntry *le) |
void | image_update_download_status (int start, int end, int total) |
void | init_keys (void) |
void | init_SDL (GtkWidget *sdl_window, int just_lightmap) |
int | init_sounds (void) |
void | init_text_callbacks (void) |
int | init_windows (int argc, char **argv) |
void | inventory_splitwin_toggling (void) |
void | inventory_tick (void) |
void | item_event_container_clearing (item *op) |
void | item_event_item_changed (item *op) |
void | item_event_item_deleting (item *op) |
void | itemlist_set_show_icon (itemlist *l, int new_setting) |
void | keyfunc (GtkWidget *widget, GdkEventKey *event, GtkWidget *window) |
void | keyrelfunc (GtkWidget *widget, GdkEventKey *event, GtkWidget *window) |
void | load_defaults (void) |
void | magic_map_flash_pos (void) |
int | main (int argc, char *argv[]) |
void | main_window_destroyed (void) |
void | menu_clear (void) |
void | MusicCmd (const char *data, int len) |
void | open_container (item *op) |
uint8 * | png_to_data (uint8 *data, int len, uint32 *width, uint32 *height) |
uint8 * | rescale_rgba_data (uint8 *data, int *width, int *height, int scale) |
void | reset_image_data (void) |
void | reset_map (void) |
void | reset_stat_bars (void) |
void | resize_map_window (int x, int y) |
void | resize_resistance_table (int resists_show) |
int | rgba_to_gdkpixmap (GdkWindow *window, uint8 *data, int width, int height, GdkPixmap **pix, GdkBitmap **mask, GdkColormap *colormap) |
void | save_defaults (void) |
void | save_winpos (void) |
void | sdl_gen_map (int redraw) |
int | sdl_mapscroll (int dx, int dy) |
void | set_autorepeat (const char *s) |
void | set_look_list_env (item *op) |
void | set_scroll (const char *s) |
void | set_show_icon (const char *s) |
void | set_show_weight (const char *s) |
void | set_weight_limit (uint32 wlim) |
void | set_window_pos (void) |
void | Sound2Cmd (unsigned char *data, int len) |
void | SoundCmd (unsigned char *data, int len) |
void | unbind_key (const char *params) |
void | update_list_labels (itemlist *l) |
media_state | write_media (GtkText *textarea, const char *message) |
media_state | write_media_with_state (GtkText *textarea, const char *message, media_state current_state) |
void | x_set_echo (void) |
Referenced from common/commands.c
face | |
smooth_face |
int associate_cache_entry | ( | Cache_Entry * | ce, |
int | pixnum | ||
) |
This functions associates image_data in the cache entry with the specific pixmap number. Currently, there is no failure condition, but there is the potential that in the future, we want to more closely look at the data and if it isn't valid, return the failure code.
void bind_callback | ( | GtkWidget * | gtklist, |
GdkEventButton * | event | ||
) |
Definition at line 1181 of file keys.c.
References bind_flags, cclist, ckentrytext, ckeyentrytext, cmodentrytext, draw_info(), draw_keybindings(), insert_key(), KEYF_FIRE, KEYF_MODIFIERS, KEYF_RUN, Keys::keysym, MAX_BUF, NDI_BLACK, and save_keys().
Referenced by configdialog().
void cclist_button_event | ( | GtkWidget * | gtklist, |
gint | row, | ||
gint | column, | ||
GdkEventButton * | event | ||
) |
Definition at line 2758 of file gx11.c.
References cclist, ckentrytext, ckeyentrytext, cmodentrytext, and cnumentrytext.
Referenced by configdialog().
void chelpdialog | ( | GtkWidget * | widget | ) |
Definition at line 182 of file help.c.
References chelp_entry_callback(), chelptext, FALSE, gtkwin_chelp, set_default_text(), and TRUE.
Referenced by get_menu_display().
void ckeyclear | ( | void | ) |
Definition at line 1251 of file keys.c.
References ckentrytext, ckeyentrytext, cmodentrytext, and cnumentrytext.
Referenced by configdialog().
void ckeyentry_callback | ( | GtkWidget * | widget, |
GdkEventKey * | event, | ||
GtkWidget * | window | ||
) |
Definition at line 1233 of file keys.c.
References ckeyentrytext, and cmodentrytext.
Referenced by configdialog().
void ckeyunbind | ( | GtkWidget * | gtklist, |
GdkEventButton * | event | ||
) |
Definition at line 1214 of file keys.c.
References cclist, draw_keybindings(), and unbind_key().
Referenced by configdialog().
void cleanup_connection | ( | void | ) |
void cleanup_textmanagers | ( | void | ) |
Definition at line 522 of file text.c.
References news_entry::content, first_news, last_motd, news_entry::next, rules, and news_entry::title.
Referenced by cleanup_connection(), disconnect(), and event_loop().
void client_exit | ( | void | ) |
Definition at line 3269 of file gx11.c.
References LOG(), and LOG_INFO.
Referenced by get_menu_display(), and main_window_destroyed().
void client_pickup | ( | uint32 | pickup | ) |
void client_tick | ( | uint32 | tick | ) |
void close_container | ( | item * | op | ) |
Open and close_container are now no-ops - since these are now drawn inline as treestores, we don't need to update what we are drawing were. and since the activation of a container will cause the list to be redrawn, don't need to worry about making an explicit call here.
op |
Definition at line 1342 of file inventory.c.
void command_show | ( | const char * | params | ) |
params |
Definition at line 1153 of file inventory.c.
void configdialog | ( | GtkWidget * | widget | ) |
Definition at line 379 of file config.c.
References applyconfig(), bind_callback(), CBUTTON, cclist, cclist_button_event(), ckentrytext, ckeyclear(), ckeyentry_callback(), ckeyentrytext, ckeyunbind(), cmodentrytext, cnumentrytext, CONFIG_LIGHTING, draw_keybindings(), face_info, faceset_combo, Face_Information_struct::facesets, FALSE, FLAG_MAPPANE, FaceSets_struct::fullname, get_window_coord(), gtkwin_config, gtkwin_root, Face_Information_struct::have_faceset_info, LOG(), LOG_WARNING, MAP_MAX_SIZE, MAX_BUTTONS, MAX_FACE_SETS, RBUTTON, saveconfig(), SEPERATOR, SPIN, SPIN_CWINDOW, SPIN_MAP, SPIN_SCALE, TRUE, want_config, Face_Information_struct::want_faceset, and CButtons::widget.
Referenced by get_menu_display().
int create_and_rescale_image_from_data | ( | Cache_Entry * | ce, |
int | pixmap_num, | ||
uint8 * | rgba_data, | ||
int | width, | ||
int | height | ||
) |
void create_windows | ( | void | ) |
Definition at line 4032 of file gx11.c.
References bigmap, CFG_DM_SDL, colorname, CONFIG_DISPLAYMODE, CONFIG_MAPHEIGHT, CONFIG_MAPWIDTH, CONFIG_SPLITWIN, CONFIG_TOOLTIPS, drawingarea, FALSE, game_bar_vpane, gameframe, get_game_display(), get_info_display(), get_inv_display(), get_look_display(), get_menu_display(), get_message_display(), get_stats_display(), gtkwin_info, gtkwin_inv, gtkwin_look, gtkwin_message, gtkwin_root, gtkwin_stats, init_SDL(), inv_hpane, inv_look_vpane, keyfunc(), keyrelfunc(), main_window_destroyed(), map_image_size, message_frame, root_color, set_window_pos(), stat_frame, stat_game_vpane, stat_info_hpane, tooltips, TRUE, use_config, and want_config.
Referenced by get_root_display(), and toggle_splitwin().
void display_map_doneupdate | ( | int | redraw, |
int | notice | ||
) |
Do the map drawing
If redraw is set, force redraw of all tiles.
If notice is set, another call will follow soon.
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. |
If redraw is set, force redraw of all tiles.
If notice is set, another call will follow soon.
void display_map_newmap | ( | void | ) |
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.
int do_timeout | ( | void | ) |
void draw_color_info | ( | int | colr, |
const char * | buf | ||
) |
Display information in color. This function simply calls draw_info() with the parameter order swapped, and it provides no unique features. Since it is called from common, it is likely a legacy function that should probably be considered deprecated. Important: This function calls draw_info(), so if a color other than black is specified, the text is routed to both the primary and secondary (critical) message panes.
colr | The color to use when displaying text. |
buf | The text to display. |
void draw_info | ( | const char * | str, |
int | color | ||
) |
Add text to the informational message windows. Colored text implies some level of importance, and results in the messge being auto-routed to the critical message panel. Note that with the textbufs, it seems you need to manually set it to the bottom of the screen - otherwise, the scrollbar just stays at the top. However, this does not seem ideal if you are trying to scroll back while new stuff comes in. Question: Is there a good reason for draw_info() and draw_color_info() to write directly to the message panel when add_to_textbuf() does this? Does it really make sense to use color to determine if a message is critical?.
str | Pointer to displayable text. |
color | Color of the text. |
void draw_info_windows | ( | void | ) |
Definition at line 4492 of file gx11.c.
References draw_info_freeze1, draw_info_freeze2, FALSE, gtkwin_info_text, gtkwin_info_text2, text_hadj, text_hadj2, text_vadj, and text_vadj2.
Referenced by do_timeout(), and main().
void draw_magic_map | ( | void | ) |
void draw_message_window | ( | int | redraw | ) |
void draw_stats | ( | int | redraw | ) |
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 |
int get_info_width | ( | void | ) |
This is used by the common help system to determine when to wrap. Should be able to get width of window, and divide by character width - however, still not perfect if we are using a variable width font. Actually, gtk can do word wrapping for us, so maybe the real fix is to have it to the word wrapping and just run a sufficiently large value. FIXME: should be better than hardcoded value.
void get_inv_display | ( | GtkWidget * | frame | ) |
Definition at line 1084 of file inventory.c.
References count_callback(), counttext, cpl, itemlist::env, FALSE, get_inv_widget(), itemlist::label, itemlist::last_maxweight, itemlist::last_title, itemlist::last_weight, itemlist::maxweightlabel, Player_Struct::ob, itemlist::show_weight, itemlist::title, tooltips, TRUE, itemlist::weight_limit, and itemlist::weightlabel.
Referenced by create_windows().
void get_look_display | ( | GtkWidget * | frame | ) |
Definition at line 1021 of file inventory.c.
References Player_Struct::below, close_container_callback(), closebutton, cpl, itemlist::env, FALSE, get_look_widget(), itemlist::label, itemlist::last_maxweight, itemlist::last_title, itemlist::last_weight, itemlist::maxweightlabel, itemlist::show_weight, itemlist::title, tooltips, TRUE, itemlist::weight_limit, and itemlist::weightlabel.
Referenced by create_windows().
char* get_metaserver | ( | void | ) |
news_entry* get_news | ( | void | ) |
Definition at line 462 of file text.c.
References first_news.
Referenced by buildLoginDialog().
const char* get_rules | ( | void | ) |
Definition at line 459 of file text.c.
References rules.
Referenced by buildLoginDialog().
void get_window_coord | ( | GtkWidget * | win, |
int * | x, | ||
int * | y, | ||
int * | wx, | ||
int * | wy, | ||
int * | w, | ||
int * | h | ||
) |
Gets the coordinates of a specified window.
win | Pass in a GtkWidget pointer to get its coordinates. |
x | Parent-relative window x coordinate |
y | Parent-relative window y coordinate |
wx | ? |
wy | ? |
w | Window width |
h | Window height |
Definition at line 4789 of file gx11.c.
Referenced by configdialog(), image_update_download_status(), and save_winpos().
const char* getMOTD | ( | void | ) |
Definition at line 454 of file text.c.
References last_motd.
Referenced by buildLoginDialog().
void gLogHandler | ( | const gchar * | log_domain, |
GLogLevelFlags | log_level, | ||
const gchar * | message, | ||
gpointer | user_data | ||
) |
Definition at line 5471 of file gx11.c.
References LOG(), LOG_CRITICAL, LOG_DEBUG, LOG_ERROR, LOG_INFO, LOG_WARNING, and MAX_RECURSE.
Referenced by main().
int gtk_checkchilds | ( | void | ) |
Definition at line 4553 of file gx11.c.
References FALSE, and monitorChilds().
Referenced by init_windows().
void gtk_draw_map | ( | int | redraw | ) |
redraw |
Definition at line 337 of file map.c.
Referenced by client_tick(), and display_map_doneupdate().
void gtkLogListener | ( | LogEntry * | le | ) |
Definition at line 5450 of file gx11.c.
References bugtrack, getLogText(), and MAX_LOG_CHARACTERS.
Referenced by main().
void image_update_download_status | ( | int | start, |
int | end, | ||
int | total | ||
) |
Draws a status bar showing where we our in terms of downloading all the image data. A few hacks: If start is 1, this is the first batch, so it means we need to create the appropriate status window. If start = end = total, it means were finished, so destroy the gui element.
start | The start value just sent to the server. |
end | |
total | The total number of images. |
void init_keys | ( | void | ) |
Definition at line 302 of file keys.c.
Referenced by init_windows(), and setUserPass().
void init_SDL | ( | GtkWidget * | sdl_window, |
int | just_lightmap | ||
) |
Referenced by applyconfig(), create_windows(), map_init(), read_config_window(), and resize_map_window().
int init_sounds | ( | void | ) |
Opens the audio device, and reads relevant configuration files.
Definition at line 60 of file sound.c.
Referenced by applyconfig(), main(), and read_config_window().
void init_text_callbacks | ( | void | ) |
Definition at line 515 of file text.c.
References admin_callback(), book_callback(), motd_callback(), MSG_TYPE_ADMIN, MSG_TYPE_BOOK, MSG_TYPE_MOTD, MSG_TYPE_SIGN, setTextManager(), and sign_callback().
Referenced by main().
void inventory_splitwin_toggling | ( | void | ) |
Definition at line 790 of file inventory.c.
References add_removal_victim(), highlit_inv_viewers, inv_notebook, inv_viewers, look_widget, and nuke_view().
Referenced by toggle_splitwin().
void inventory_tick | ( | void | ) |
This is called periodically from main.c - basically a timeout, used to animate the inventory.
Definition at line 1374 of file inventory.c.
Referenced by client_tick(), and do_timeout().
void item_event_container_clearing | ( | item * | op | ) |
Definition at line 525 of file inventory.c.
void item_event_item_changed | ( | item * | op | ) |
Definition at line 489 of file inventory.c.
void item_event_item_deleting | ( | item * | op | ) |
Definition at line 596 of file inventory.c.
void itemlist_set_show_icon | ( | itemlist * | l, |
int | new_setting | ||
) |
Definition at line 1288 of file inventory.c.
References set_inv_flags(), set_look_flags(), and itemlist::show_icon.
Referenced by applyconfig(), init_windows(), load_defaults(), and set_show_icon().
void load_defaults | ( | void | ) |
void magic_map_flash_pos | ( | void | ) |
Flash the player position on the magic map
Definition at line 4766 of file gx11.c.
Referenced by do_timeout().
int main | ( | int | argc, |
char * | argv[] | ||
) |
void main_window_destroyed | ( | void | ) |
Definition at line 219 of file config.c.
References client_exit(), and splitwin_toggling.
Referenced by create_windows().
void menu_clear | ( | void | ) |
void open_container | ( | item * | op | ) |
op |
Definition at line 1334 of file inventory.c.
Takes png data and scales it accordingly. This function is based on pnmscale, but has been modified to support alpha channel - instead of blending the alpha channel, it takes the most opaque value - blending it is not likely to give sane results IMO - for any image that has transparent information, if we blended the alpha, the result would be the edges of that region being partially transparent. This function has also been re-written to use more static data - in the case of the client, it will be called thousands of times, so it doesn't make sense to free the data and then re-allocate it.
For pixels that are fully transparent, the end result after scaling is they will be tranparent black. This is a needed effect for blending to work properly.
This function returns a new pointer to the scaled image data. This is malloc'd data, so should be freed at some point to prevent leaks. This function does not modify the data passed to it - the caller is responsible for freeing it if it is no longer needed.
function arguments:
*data | PNG data - this is any 4 byte per pixel data, in RGBA format. |
*width | Source width modified to contain the new image size. |
*height | Source height modified to contain the new image size. |
scale | Percentage size that new image should be. 100 is a same size image - values larger than 100 will result in zoom, values less than 100 will result in a shrinkage. |
Definition at line 244 of file png.c.
Referenced by create_and_rescale_image_from_data().
void reset_image_data | ( | void | ) |
Connecting to different servers, try to clear out any old images. Try to free the data to prevent memory leaks. This could be more clever, ie, if we're caching images and go to a new server and get a name, we should try to re-arrange our cache or the like.
Definition at line 387 of file image.c.
Referenced by main().
void reset_map | ( | void | ) |
Request a map update from the server. This is to circumvent a bug in some server versions.
Request a map update from the server. This is to circumvent a bug in some server versions.
Request a map update from the server. This is to circumvent a bug in some server versions.
Definition at line 76 of file map.c.
Referenced by display_map_newmap(), and keyfunc().
void reset_stat_bars | ( | void | ) |
Definition at line 2264 of file gx11.c.
References draw_message_window(), gdk_green, gdk_red, Vitals::state, and Vitals::style.
Referenced by applyconfig().
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.
void resize_resistance_table | ( | int | resists_show | ) |
Definition at line 2350 of file gx11.c.
References fire_label, NUM_RESISTS, res_scrolled_window, resists, restable, and run_label.
Referenced by applyconfig(), and get_message_display().
int rgba_to_gdkpixmap | ( | GdkWindow * | window, |
uint8 * | data, | ||
int | width, | ||
int | height, | ||
GdkPixmap ** | pix, | ||
GdkBitmap ** | mask, | ||
GdkColormap * | colormap | ||
) |
Takes data that has already been converted into RGBA format (via png_to_data above perhaps) and creates a GdkPixmap and GdkBitmap out of it.
*window | |
*data | |
width | |
height | |
**pix | |
**mask | |
*colormap |
Definition at line 407 of file png.c.
Referenced by create_icon_image(), and create_map_image().
void save_defaults | ( | void | ) |
void save_winpos | ( | void | ) |
Handles saving of the window positions when the Client | Save Window Position menu item is executed. All hpaned and vpaned widget settings have the information required, and the code automatically works for Glade XML layouts that follow the glade-2's default widget naming convention.
void sdl_gen_map | ( | int | redraw | ) |
Referenced by client_tick(), display_map_doneupdate(), do_network(), and draw_map().
int sdl_mapscroll | ( | int | dx, |
int | dy | ||
) |
void set_autorepeat | ( | const char * | s | ) |
A stub function that does nothing. These are callbacks used by the common code, but they are not implemented in GTK, either because it makes no sense (set_scroll for example), or because it may not be technically possible to do so if we limit ourselves to proper GTK2 code (Eg, don't mess with the internals of X or platform specific issues)
s |
void set_look_list_env | ( | item * | op | ) |
Definition at line 1323 of file inventory.c.
References itemlist::env, inv_viewers, inventory_viewer_set_container(), and set_look_list_env_one().
Referenced by close_container(), close_container_callback(), main(), and open_container().
void set_scroll | ( | const char * | s | ) |
A stub function that does nothing. These are callbacks used by the common code, but they are not implemented in GTK, either because it makes no sense (set_scroll for example), or because it may not be technically possible to do so if we limit ourselves to proper GTK2 code (Eg, don't mess with the internals of X or platform specific issues)
s |
void set_show_icon | ( | const char * | s | ) |
s |
Definition at line 1303 of file inventory.c.
void set_show_weight | ( | const char * | s | ) |
s |
Definition at line 1258 of file inventory.c.
void set_weight_limit | ( | uint32 | wlim | ) |
No reason to divide by 1000 everytime we do the display, so do it once and store it here.
wlim |
Definition at line 1245 of file inventory.c.
void SoundCmd | ( | unsigned char * | data, |
int | len | ||
) |
void update_list_labels | ( | itemlist * | l | ) |
Definition at line 1182 of file inventory.c.
References itemlist::env, FALSE, item_struct::inv_updated, itemlist::label, itemlist::last_maxweight, itemlist::last_title, itemlist::last_weight, MAX_BUF, itemlist::maxweightlabel, itemlist::show_weight, itemlist::title, item_struct::weight, itemlist::weight_limit, and itemlist::weightlabel.
Referenced by close_container(), close_container_callback(), open_container(), set_show_weight(), set_weight_limit(), toggle_splitwin(), and update_lists_labels().
media_state write_media | ( | GtkText * | textarea, |
const char * | message | ||
) |
Definition at line 282 of file text.c.
References media_state::flavor, media_state::has_color, media_state::style, style_print, and write_media_with_state().
Referenced by add_book(), admin_callback(), book_callback(), buildLoginDialog(), create_text_picture_window(), fill_news(), motd_callback(), show_media_message(), and sign_callback().
media_state write_media_with_state | ( | GtkText * | textarea, |
const char * | message, | ||
media_state | current_state | ||
) |
Definition at line 289 of file text.c.
References media_state::flavor, media_state::fore, media_state::has_color, init_fonts(), LOG(), LOG_ERROR, LOG_INFO, media_state::style, style_arcane, STYLE_BOLD, style_fixed, style_hand, STYLE_ITALIC, style_print, and style_strange.
Referenced by fill_news(), and write_media().