… | |
… | |
101 | ST_GET_PARTY_PASSWORD, |
101 | ST_GET_PARTY_PASSWORD, |
102 | }; |
102 | }; |
103 | |
103 | |
104 | // a handler for a specific type of packet |
104 | // a handler for a specific type of packet |
105 | enum { |
105 | enum { |
106 | PF_PLAYER = 0x01, // must have valid player / will by synchronised |
106 | PF_PLAYER = 0x01, // must have valid player / will by synchronised |
107 | PF_PLAYING = 0x02, // must be in playing state |
107 | PF_PLAYING = 0x02, // must be in playing state |
108 | PF_COMMAND0 = 0x04, // command starts at offset 0 |
108 | PF_COMMAND = 0x04, // is a suer command |
109 | PF_COMMAND6 = 0x08, // command starts at offset 6 |
|
|
110 | }; |
109 | }; |
111 | |
110 | |
112 | // face types. bit 0 means "has meta info prepended" |
111 | // face types. bit 0 means "has meta info prepended" |
113 | enum { |
112 | enum { |
114 | FT_FACE = 0 * 2 + 0, // faces (images) |
113 | FT_IMAGE = 0 * 2 + 0, // images |
115 | FT_MUSIC = 1 * 2 + 1, // background music |
114 | FT_MUSIC = 1 * 2 + 1, // background music |
116 | FT_SOUND = 2 * 2 + 1, // effects |
115 | FT_SOUND = 2 * 2 + 1, // effects |
117 | FT_RSRC = 3 * 2 + 0, // generic data files |
116 | FT_RSRC = 3 * 2 + 0, // generic data files |
118 | FT_NUM, |
117 | FT_NUM, |
119 | }; |
118 | }; |
… | |
… | |
167 | float ACC (RW, last_speed); /* Last speed as sent to client */ |
166 | float ACC (RW, last_speed); /* Last speed as sent to client */ |
168 | sint16 ACC (RW, last_resist[NROFATTACKS]);/* last resist values sent to client */ |
167 | sint16 ACC (RW, last_resist[NROFATTACKS]);/* last resist values sent to client */ |
169 | sint64 ACC (RW, last_skill_exp[CS_NUM_SKILLS]);/* shadow register. if != exp. obj update client */ |
168 | sint64 ACC (RW, last_skill_exp[CS_NUM_SKILLS]);/* shadow register. if != exp. obj update client */ |
170 | |
169 | |
171 | bool ACC (RW, afk); /* player is afk */ |
170 | bool ACC (RW, afk); /* player is afk */ |
172 | bool ACC (RW, sent_scroll); |
171 | bool ACC (RW, sent_scroll); |
173 | bool ACC (RW, sound); /* does the client want sound */ |
172 | bool ACC (RW, sound); /* does the client want sound */ |
174 | bool ACC (RW, bumpmsg); /* give message when bumping into walls */ |
173 | bool ACC (RW, bumpmsg); /* give message when bumping into walls */ |
175 | |
174 | |
176 | bool ACC (RW, plugincmd); // extend the protocol through a plug-in */ |
175 | bool ACC (RW, plugincmd); // extend the protocol through a plug-in */ |
177 | bool ACC (RW, mapinfocmd); // return map info and send map change info |
176 | bool ACC (RW, mapinfocmd); // return map info and send map change info |
178 | uint8_t ACC (RW, extcmd); // call into extensions/plugins |
177 | uint8 ACC (RW, extcmd); // call into extensions/plugins |
179 | bool ACC (RW, need_delinv0); /* If true, we need to delinv 0 before sending new floorbox */ |
178 | bool ACC (RW, need_delinv0); /* If true, we need to delinv 0 before sending new floorbox */ |
180 | |
179 | |
181 | bool ACC (RW, update_look); /* If true, we need to send the look window */ |
180 | bool ACC (RW, update_look); /* If true, we need to send the look window */ |
182 | bool ACC (RW, update_spells); // If true, we need to esrv_update_spells |
181 | bool ACC (RW, update_spells); // If true, we need to esrv_update_spells |
183 | bool ACC (RW, has_readable_type); /* If true client accept additional text information */ |
182 | bool ACC (RW, has_readable_type); /* If true client accept additional text information */ |
… | |
… | |
187 | bool ACC (RW, force_newmap); // force a newmap before next map update |
186 | bool ACC (RW, force_newmap); // force a newmap before next map update |
188 | uint16 ACC (RW, look_position); /* start of drawing of look window */ |
187 | uint16 ACC (RW, look_position); /* start of drawing of look window */ |
189 | uint16 ACC (RW, mss); // likely tcp maximum segment size |
188 | uint16 ACC (RW, mss); // likely tcp maximum segment size |
190 | uint8 ACC (RW, mapx), ACC (RW, mapy); /* How large a map the client wants */ |
189 | uint8 ACC (RW, mapx), ACC (RW, mapy); /* How large a map the client wants */ |
191 | uint8 ACC (RW, itemcmd); /* What version of the 'item' protocol command to use */ |
190 | uint8 ACC (RW, itemcmd); /* What version of the 'item' protocol command to use */ |
192 | uint8 ACC (RW, faceset); // CF+ selected faceset |
191 | uint8 ACC (RW, tileset); // selected tileset |
193 | uint8 ACC (RW, ws_version); // websocket protocol versio for framing |
192 | uint8 ACC (RW, ws_version); // websocket protocol versio for framing |
194 | |
193 | |
195 | maptile_ptr ACC (RW, current_map); // CF+ last/current player map |
194 | maptile_ptr ACC (RW, current_map); // last/current player map |
196 | region_ptr ACC (RW, current_region); // CF+ last/current player region |
195 | region_ptr ACC (RW, current_region); // last/current player region |
197 | int ACC (RW, current_x), ACC (RW, current_y); // CF+ last/current map position |
196 | int ACC (RW, current_x), ACC (RW, current_y); // CF+ last/current map position |
198 | |
197 | |
199 | tstamp ACC (RW, last_send); // last data send on socket. |
198 | tstamp ACC (RW, last_send); // last data send on socket. |
200 | |
199 | |
201 | float ACC (RW, socket_timeout); /* after how many seconds of no ack do we declare dead */ |
200 | float ACC (RW, socket_timeout); /* after how many seconds of no ack do we declare dead */ |
… | |
… | |
217 | void mapinfo_queue_clear (); |
216 | void mapinfo_queue_clear (); |
218 | void mapinfo_queue_run (); |
217 | void mapinfo_queue_run (); |
219 | bool mapinfo_try (char *buf); |
218 | bool mapinfo_try (char *buf); |
220 | |
219 | |
221 | struct ixsend { |
220 | struct ixsend { |
222 | int16_t pri; // higher means faces are sent earlier, default 0 |
221 | sint16 pri; // higher means faces are sent earlier, default 0 |
223 | faceidx idx; |
222 | faceidx idx; |
224 | uint32_t ofs; // if != 0, need to send remaining bytes of partial_face |
223 | uint32 ofs; // if != 0, need to send remaining bytes of partial_face |
225 | refcnt_buf data; |
224 | uint8 *data; |
|
|
225 | SV *data_sv; |
226 | }; |
226 | }; |
227 | std::vector<ixsend, slice_allocator<ixsend> > ixface; // which faces to send to the client using ix |
227 | std::vector<ixsend, slice_allocator<ixsend> > ixface; // which faces to send to the client using ix |
|
|
228 | MTH void ix_send (faceidx idx, sint16 pri, SV *data_sv); // keeps a copy of data_sv |
|
|
229 | void ix_pop (); // pops topmost ixsend |
228 | |
230 | |
229 | std::vector<faceidx, slice_allocator<faceidx> > fxface; // which faces to send using fx |
231 | std::vector<faceidx, slice_allocator<faceidx> > fxface; // which faces to send using fx |
230 | MTH void flush_fx (); // send fx if required |
232 | MTH void flush_fx (); // send fx if required |
231 | |
233 | |
232 | MTH void invalidate_face (faceidx idx); |
234 | MTH void invalidate_face (faceidx idx); |