Crossfire Client, Branches  R11627
proto.h
Go to the documentation of this file.
1 /* client.c */
3 int init_connection(char *host, int port);
4 void negotiate_connection(int sound);
5 /* commands.c */
6 void ReplyInfoCmd(uint8 *buf, int len);
7 void SetupCmd(char *buf, int len);
8 void ExtendedInfoSetCmd(char *data, int len);
9 void AddMeFail(char *data, int len);
10 void AddMeSuccess(char *data, int len);
11 void GoodbyeCmd(char *data, int len);
12 void AnimCmd(unsigned char *data, int len);
13 void SmoothCmd(unsigned char *data, int len);
14 void DrawInfoCmd(char *data, int len);
15 void setTextManager(int type, ExtTextManager callback);
16 void DrawExtInfoCmd(char *data, int len);
17 void use_skill(int skill_id);
18 void StatsCmd(unsigned char *data, int len);
19 void handle_query(char *data, int len);
20 void send_reply(const char *text);
21 void PlayerCmd(unsigned char *data, int len);
22 void item_actions(item *op);
23 void Item2Cmd(unsigned char *data, int len);
24 void UpdateItemCmd(unsigned char *data, int len);
25 void DeleteItem(unsigned char *data, int len);
26 void DeleteInventory(unsigned char *data, int len);
27 void AddspellCmd(unsigned char *data, int len);
28 void UpdspellCmd(unsigned char *data, int len);
29 void DeleteSpell(unsigned char *data, int len);
30 void NewmapCmd(unsigned char *data, int len);
31 void Map2Cmd(unsigned char *data, int len);
32 void map_scrollCmd(char *data, int len);
33 int ExtSmooth(unsigned char *data, int len, int x, int y, int layer);
34 void MapExtendedCmd(unsigned char *data, int len);
35 void MagicMapCmd(unsigned char *data, int len);
36 void SinkCmd(unsigned char *data, int len);
37 void TickCmd(uint8 *data, int len);
38 void PickupCmd(uint8 *data, int len);
39 /* image.c */
40 void init_common_cache_data(void);
41 void requestface(int pnum, char *facename);
42 void finish_face_cmd(int pnum, uint32 checksum, int has_sum, char *face, int faceset);
43 void reset_image_cache_data(void);
44 void Face2Cmd(uint8 *data, int len);
45 void Image2Cmd(uint8 *data, int len);
46 void display_newpng(int face, uint8 *buf, int buflen, int setnum);
47 void get_image_info(uint8 *data, int len);
48 void get_image_sums(char *data, int len);
49 /* init.c */
50 void VersionCmd(char *data, int len);
51 void SendVersion(ClientSocket csock);
52 void SendAddMe(ClientSocket csock);
53 void SendSetFaceMode(ClientSocket csock, int mode);
54 void init_client_vars(void);
55 void reset_player_data(void);
56 void reset_client_vars(void);
57 /* item.c */
58 uint8 get_type_from_name(const char *name);
59 void update_item_sort(item *it);
60 const char *get_number(uint32 i);
61 void free_all_items(item *op);
62 item *locate_item(sint32 tag);
63 void remove_item(item *op);
64 void remove_item_inventory(item *op);
65 item *create_new_item(item *env, sint32 tag);
66 int num_free_items(void);
67 void set_item_values(item *op, char *name, sint32 weight, uint16 face, uint16 flags, uint16 anim, uint16 animspeed, uint32 nrof, uint16 type);
68 void toggle_locked(item *op);
69 void send_mark_obj(item *op);
70 item *player_item(void);
71 item *map_item(void);
72 void update_item(int tag, int loc, char *name, int weight, int face, int flags, int anim, int animspeed, uint32 nrof, int type);
73 void print_inventory(item *op);
74 void animate_objects(void);
75 int can_write_spell_on(item *it);
76 void inscribe_magical_scroll(item *scroll, Spell *spell);
77 /* mapdata.c */
78 void mapdata_init(void);
79 void mapdata_reset(void);
80 void mapdata_set_size(int viewx, int viewy);
81 int mapdata_is_inside(int x, int y);
82 void mapdata_clear_space(int x, int y);
83 void mapdata_set_check_space(int x, int y);
84 void mapdata_set_darkness(int x, int y, int darkness);
85 void mapdata_set_smooth(int x, int y, int smooth, int layer);
86 void mapdata_clear_old(int x, int y);
87 void mapdata_set_face_layer(int x, int y, sint16 face, int layer);
88 void mapdata_set_anim_layer(int x, int y, uint16 anim, uint8 anim_speed, int layer);
89 void mapdata_scroll(int dx, int dy);
90 void mapdata_newmap(void);
91 sint16 mapdata_face(int x, int y, int layer);
92 sint16 mapdata_bigface(int x, int y, int layer, int *ww, int *hh);
93 sint16 mapdata_bigface_head(int x, int y, int layer, int *ww, int *hh);
94 void mapdata_animation(void);
95 /* metaserver.c */
96 int check_server_version(int entry);
97 size_t metaserver2_writer(void *ptr, size_t size, size_t nmemb, void *data);
98 void *metaserver2_thread(void *junk);
99 int metaserver2_get_info(void);
100 void init_metaserver(void);
101 void *metaserver1_thread(void *junk);
102 int metaserver1_get_info(void);
103 int metaserver_check_status(void);
104 int metaserver_get_info(char *metaserver, int meta_port);
105 void metaserver_show(int show_selection);
106 int metaserver_select(char *sel);
107 /* misc.c */
108 int make_path_to_dir(char *directory);
109 int make_path_to_file(char *filename);
110 char *strdup_local(const char *str);
112 void clearLogListener(void);
113 char *getLogTextRaw(LogLevel level, const char *origin, const char *message);
114 char *getLogText(const LogEntry *le);
115 void LOG(LogLevel level, const char *origin, const char *format, ...);
116 void purgePipe(ChildProcess *cp, int pipe);
117 void monitorChilds(void);
118 void logPipe(ChildProcess *child, LogLevel level, int pipe);
119 void logChildPipe(ChildProcess *child, LogLevel level, int flag);
120 ChildProcess *raiseChild(char *name, int flag);
121 /* newsocket.c */
122 void SockList_Init(SockList *sl, uint8 *buf);
123 void SockList_AddChar(SockList *sl, char c);
124 void SockList_AddShort(SockList *sl, uint16 data);
125 void SockList_AddInt(SockList *sl, uint32 data);
126 void SockList_AddString(SockList *sl, const char *str);
127 int SockList_Send(SockList *sl, int fd);
128 char GetChar_String(const unsigned char *data);
129 int GetInt_String(const unsigned char *data);
130 sint64 GetInt64_String(const unsigned char *data);
131 short GetShort_String(const unsigned char *data);
132 int SockList_ReadPacket(int fd, SockList *sl, int len);
133 int cs_print_string(int fd, const char *str, ...);
134 /* p_cmd.c */
135 /* player.c */
136 void new_player(long tag, char *name, long weight, long face);
137 void look_at(int x, int y);
138 void client_send_apply(int tag);
139 void client_send_examine(int tag);
140 void client_send_move(int loc, int tag, int nrof);
141 void move_player(int dir);
142 void stop_fire(void);
143 void clear_fire_run(void);
144 void clear_fire(void);
145 void clear_run(void);
146 void fire_dir(int dir);
147 void stop_run(void);
148 void run_dir(int dir);
149 int send_command(const char *command, int repeat, int must_send);
150 void CompleteCmd(unsigned char *data, int len);
151 void command_take(const char *command, const char *cpnext);
152 /* script.c */
153 /* script_lua.c */
154 void script_lua_load(const char *name);
155 void script_lua_list(const char *param);
156 void script_lua_kill(const char *param);
157 void script_lua_stats(void);
158 int script_lua_command(const char *command, const char *param);
short GetShort_String(const unsigned char *data)
Definition: newsocket.c:162
void metaserver_show(int show_selection)
Definition: metaserver.c:807
void CompleteCmd(unsigned char *data, int len)
Definition: player.c:246
void animate_objects(void)
Definition: item.c:687
void mapdata_set_size(int viewx, int viewy)
Definition: mapdata.c:577
void MapExtendedCmd(unsigned char *data, int len)
Definition: commands.c:1278
item * map_item(void)
Definition: item.c:611
void update_item(int tag, int loc, char *name, int weight, int face, int flags, int anim, int animspeed, uint32 nrof, int type)
Definition: item.c:618
signed short sint16
Definition: client-types.h:80
int setLogListener(LogListener li)
Definition: misc.c:137
void mapdata_animation(void)
Definition: mapdata.c:1264
void script_lua_list(const char *param)
int script_lua_command(const char *command, const char *param)
int SockList_ReadPacket(int fd, SockList *sl, int len)
Definition: newsocket.c:173
void mapdata_scroll(int dx, int dy)
Definition: mapdata.c:859
item * create_new_item(item *env, sint32 tag)
Definition: item.c:422
void set_item_values(item *op, char *name, sint32 weight, uint16 face, uint16 flags, uint16 anim, uint16 animspeed, uint32 nrof, uint16 type)
Definition: item.c:506
void AddspellCmd(unsigned char *data, int len)
Definition: commands.c:979
void mapdata_clear_old(int x, int y)
Definition: mapdata.c:744
void logChildPipe(ChildProcess *child, LogLevel level, int flag)
Definition: misc.c:290
int metaserver_select(char *sel)
Definition: metaserver.c:861
void DrawExtInfoCmd(char *data, int len)
Definition: commands.c:526
void clear_fire_run(void)
Definition: player.c:122
void logPipe(ChildProcess *child, LogLevel level, int pipe)
Definition: misc.c:271
void SockList_AddChar(SockList *sl, char c)
Definition: newsocket.c:97
void finish_face_cmd(int pnum, uint32 checksum, int has_sum, char *face, int faceset)
Definition: image.c:400
void script_lua_kill(const char *param)
void UpdateItemCmd(unsigned char *data, int len)
Definition: commands.c:862
int make_path_to_dir(char *directory)
Definition: misc.c:53
int ExtSmooth(unsigned char *data, int len, int x, int y, int layer)
Definition: commands.c:1244
void SendSetFaceMode(ClientSocket csock, int mode)
Definition: init.c:91
item * player_item(void)
Definition: item.c:606
void ExtendedInfoSetCmd(char *data, int len)
Definition: commands.c:370
void StatsCmd(unsigned char *data, int len)
Definition: commands.c:596
void SmoothCmd(unsigned char *data, int len)
Definition: commands.c:461
void client_send_apply(int tag)
Definition: player.c:80
void mapdata_newmap(void)
Definition: mapdata.c:935
void DrawInfoCmd(char *data, int len)
Definition: commands.c:475
char * getLogTextRaw(LogLevel level, const char *origin, const char *message)
Definition: misc.c:157
int mapdata_is_inside(int x, int y)
Definition: mapdata.c:587
void Item2Cmd(unsigned char *data, int len)
Definition: commands.c:857
void(* ExtTextManager)(int flag, int type, int subtype, char *message)
Definition: client-types.h:133
void SockList_AddString(SockList *sl, const char *str)
Definition: newsocket.c:117
void get_image_sums(char *data, int len)
Definition: image.c:737
sint64 GetInt64_String(const unsigned char *data)
Definition: newsocket.c:149
void fire_dir(int dir)
Definition: player.c:151
ClientSocket csocket
Definition: client.c:78
void UpdspellCmd(unsigned char *data, int len)
Definition: commands.c:1019
void TickCmd(uint8 *data, int len)
Definition: commands.c:1383
size_t metaserver2_writer(void *ptr, size_t size, size_t nmemb, void *data)
Definition: metaserver.c:214
void Face2Cmd(uint8 *data, int len)
Definition: image.c:491
void * metaserver2_thread(void *junk)
Definition: metaserver.c:397
int meta_port
Definition: client.c:67
LogLevel
Definition: client.h:367
void item_actions(item *op)
Definition: commands.c:801
int metaserver2_get_info(void)
Definition: metaserver.c:423
int make_path_to_file(char *filename)
Definition: misc.c:94
void NewmapCmd(unsigned char *data, int len)
Definition: commands.c:1093
uint8 get_type_from_name(const char *name)
Definition: item.c:49
int metaserver_check_status(void)
Definition: metaserver.c:774
void command_take(const char *command, const char *cpnext)
Definition: player.c:264
void Map2Cmd(unsigned char *data, int len)
Definition: commands.c:1116
void move_player(int dir)
Definition: player.c:99
void map_scrollCmd(char *data, int len)
Definition: commands.c:1221
void new_player(long tag, char *name, long weight, long face)
Definition: player.c:55
void print_inventory(item *op)
Definition: item.c:654
sint16 mapdata_face(int x, int y, int layer)
Definition: mapdata.c:955
void PlayerCmd(unsigned char *data, int len)
Definition: commands.c:782
void reset_client_vars(void)
Definition: init.c:249
void mapdata_set_smooth(int x, int y, int smooth, int layer)
Definition: mapdata.c:711
void get_image_info(uint8 *data, int len)
Definition: image.c:653
int GetInt_String(const unsigned char *data)
Definition: newsocket.c:143
gchar * text
Definition: about.h:2
void AddMeFail(char *data, int len)
Definition: commands.c:387
int cs_print_string(int fd, const char *str,...)
Definition: newsocket.c:259
void stop_fire(void)
Definition: player.c:116
void remove_item(item *op)
Definition: item.c:321
int init_connection(char *host, int port)
Definition: client.c:205
void DeleteItem(unsigned char *data, int len)
Definition: commands.c:941
void SendAddMe(ClientSocket csock)
Definition: init.c:85
void DeleteInventory(unsigned char *data, int len)
Definition: commands.c:960
void reset_image_cache_data(void)
Definition: image.c:474
void SetupCmd(char *buf, int len)
Definition: commands.c:173
void monitorChilds(void)
Definition: misc.c:239
void clear_fire(void)
Definition: player.c:134
void clearLogListener(void)
Definition: misc.c:143
void stop_run(void)
Definition: player.c:166
char * name
Definition: image.c:61
void update_item_sort(item *it)
Definition: item.c:96
void look_at(int x, int y)
Definition: player.c:75
void VersionCmd(char *data, int len)
Definition: init.c:54
int SockList_Send(SockList *sl, int fd)
Definition: newsocket.c:127
sint16 mapdata_bigface(int x, int y, int layer, int *ww, int *hh)
Definition: mapdata.c:966
void setTextManager(int type, ExtTextManager callback)
Definition: commands.c:497
void client_send_examine(int tag)
Definition: player.c:85
void SinkCmd(unsigned char *data, int len)
Definition: commands.c:1376
int num_free_items(void)
Definition: item.c:444
unsigned short uint16
Definition: client-types.h:79
void DoClient(ClientSocket *csocket)
Definition: client.c:149
void remove_item_inventory(item *op)
Definition: item.c:382
void send_reply(const char *text)
Definition: commands.c:769
item * locate_item(sint32 tag)
Definition: item.c:292
void negotiate_connection(int sound)
Definition: client.c:338
sint16 mapdata_bigface_head(int x, int y, int layer, int *ww, int *hh)
Definition: mapdata.c:1052
void inscribe_magical_scroll(item *scroll, Spell *spell)
Definition: item.c:756
void reset_player_data(void)
Definition: init.c:234
void SendVersion(ClientSocket csock)
Definition: init.c:78
void mapdata_set_check_space(int x, int y)
Definition: mapdata.c:638
void send_mark_obj(item *op)
Definition: item.c:590
void SockList_AddShort(SockList *sl, uint16 data)
Definition: newsocket.c:102
void init_metaserver(void)
Definition: metaserver.c:459
void mapdata_clear_space(int x, int y)
Definition: mapdata.c:596
void script_lua_stats(void)
const char * get_number(uint32 i)
Definition: item.c:182
unsigned int uint32
Definition: client-types.h:77
void MagicMapCmd(unsigned char *data, int len)
Definition: commands.c:1336
void use_skill(int skill_id)
Definition: commands.c:573
void display_newpng(int face, uint8 *buf, int buflen, int setnum)
Definition: image.c:535
void DeleteSpell(unsigned char *data, int len)
Definition: commands.c:1051
void PickupCmd(uint8 *data, int len)
Definition: commands.c:1399
void handle_query(char *data, int len)
Definition: commands.c:717
void(* LogListener)(LogEntry *)
Definition: client.h:380
signed int sint32
Definition: client-types.h:78
void SockList_Init(SockList *sl, uint8 *buf)
Definition: newsocket.c:91
void AddMeSuccess(char *data, int len)
Definition: commands.c:398
void ReplyInfoCmd(uint8 *buf, int len)
Definition: commands.c:131
char GetChar_String(const unsigned char *data)
Definition: newsocket.c:136
void toggle_locked(item *op)
Definition: item.c:573
int check_server_version(int entry)
Definition: metaserver.c:69
void mapdata_set_anim_layer(int x, int y, uint16 anim, uint8 anim_speed, int layer)
Definition: mapdata.c:802
void init_client_vars(void)
Definition: init.c:97
void script_lua_load(const char *name)
void clear_run(void)
Definition: player.c:142
void * metaserver1_thread(void *junk)
Definition: metaserver.c:548
void GoodbyeCmd(char *data, int len)
Definition: commands.c:406
int metaserver_get_info(char *metaserver, int meta_port)
Definition: metaserver.c:791
void client_send_move(int loc, int tag, int nrof)
Definition: player.c:92
unsigned char uint8
Definition: client-types.h:81
void purgePipe(ChildProcess *cp, int pipe)
Definition: misc.c:210
ChildProcess * raiseChild(char *name, int flag)
Definition: misc.c:297
int can_write_spell_on(item *it)
Definition: item.c:752
int metaserver1_get_info(void)
Definition: metaserver.c:729
char * getLogText(const LogEntry *le)
Definition: misc.c:164
void run_dir(int dir)
Definition: player.c:172
void SockList_AddInt(SockList *sl, uint32 data)
Definition: newsocket.c:109
void free_all_items(item *op)
Definition: item.c:258
void mapdata_set_face_layer(int x, int y, sint16 face, int layer)
Definition: mapdata.c:770
void requestface(int pnum, char *facename)
Definition: image.c:381
void AnimCmd(unsigned char *data, int len)
Definition: commands.c:421
void mapdata_init(void)
Definition: mapdata.c:514
void Image2Cmd(uint8 *data, int len)
Definition: image.c:514
int send_command(const char *command, int repeat, int must_send)
Definition: player.c:195
void LOG(LogLevel level, const char *origin, const char *format,...)
Definition: misc.c:178
uint32 checksum
Definition: image.c:62
void mapdata_set_darkness(int x, int y, int darkness)
Definition: mapdata.c:688
void mapdata_reset(void)
Definition: mapdata.c:572
char * strdup_local(const char *str)
Definition: misc.c:125
void init_common_cache_data(void)
Definition: image.c:332