… | |
… | |
7 | sub send_capabilities { |
7 | sub send_capabilities { |
8 | my ($ns) = @_; |
8 | my ($ns) = @_; |
9 | |
9 | |
10 | return unless $ns->extcmd; |
10 | return unless $ns->extcmd; |
11 | |
11 | |
12 | $ns->ext_event (capabilities => |
12 | $ns->ext_msg (capabilities => |
13 | # id, name, flags (1 == 2d), edge length |
13 | # id, name, flags (1 == 2d), edge length |
14 | tileset => [[1, "default 64x64 faceset", 1, 64], [0, "default 32x32 faceset", 1, 32]], |
14 | tileset => [[1, "default 64x64 faceset", 1, 64], [0, "default 32x32 faceset", 1, 32]], |
15 | ); |
15 | ); |
16 | } |
16 | } |
17 | |
17 | |
… | |
… | |
54 | |
54 | |
55 | } elsif ($k eq "mapinfocmd") { |
55 | } elsif ($k eq "mapinfocmd") { |
56 | $ns->mapinfocmd ($v); |
56 | $ns->mapinfocmd ($v); |
57 | |
57 | |
58 | } elsif ($k eq "extcmd") { |
58 | } elsif ($k eq "extcmd") { |
59 | $ns->extcmd ($v > 0); |
59 | $ns->extcmd (min 2, $v); |
60 | send_capabilities $ns; |
60 | send_capabilities $ns; |
61 | |
61 | |
62 | } elsif ($k eq "extmap") { |
62 | } elsif ($k eq "extmap") { |
63 | $ns->extmap ($v); |
63 | $ns->extmap ($v); |
64 | |
64 | |
… | |
… | |
88 | $setup{$k} = $ns->itemcmd; |
88 | $setup{$k} = $ns->itemcmd; |
89 | |
89 | |
90 | } elsif ($k eq "mapsize") { |
90 | } elsif ($k eq "mapsize") { |
91 | my ($x, $y) = split /x/, $v; |
91 | my ($x, $y) = split /x/, $v; |
92 | |
92 | |
|
|
93 | # we *need* to make sure we use an odd map size, as the remaining |
|
|
94 | # code relies on this. |
93 | $ns->mapx ($x = max 9, min cf::MAP_CLIENT_X, ($x - 1) | 1); |
95 | $ns->mapx ($x = max 9, min +(cf::MAP_CLIENT_X - 1) | 1, ($x - 1) | 1); |
94 | $ns->mapy ($y = max 9, min cf::MAP_CLIENT_Y, ($y - 1) | 1); |
96 | $ns->mapy ($y = max 9, min +(cf::MAP_CLIENT_Y - 1) | 1, ($y - 1) | 1); |
95 | |
97 | |
96 | $setup{$k} = "${x}x${y}"; |
98 | $setup{$k} = "${x}x${y}"; |
97 | |
|
|
98 | } elsif ($k eq "extendedMapInfos") { |
|
|
99 | $ns->ext_mapinfos ($v); |
|
|
100 | |
99 | |
101 | } elsif ($k eq "extendedTextInfos") { |
100 | } elsif ($k eq "extendedTextInfos") { |
102 | $ns->has_readable_type ($v); |
101 | $ns->has_readable_type ($v); |
103 | |
102 | |
104 | } elsif ($k eq "smoothing") { # cfplus-style smoothing |
103 | } elsif ($k eq "smoothing") { # cfplus-style smoothing |
105 | $ns->smoothing ($v); |
104 | $ns->smoothing ($v); |
106 | |
105 | |
107 | } elsif ($k eq "fxix") { |
106 | } elsif ($k eq "fxix") { |
108 | $ns->fxix ($setup{$k} = min 2, $v); |
107 | $ns->fxix ($setup{$k} = min 3, $v); |
109 | |
108 | |
110 | } elsif ($k eq "msg") { |
109 | } elsif ($k eq "msg") { |
111 | $ns->can_msg ($setup{$k} = min 2, $v); |
110 | $ns->can_msg ($setup{$k} = min 2, $v); |
112 | |
111 | |
113 | } elsif ($k eq "ywidget") { |
112 | } elsif ($k eq "widget") { |
114 | # eXperimental server-side widgets |
113 | # server-side widgets |
|
|
114 | $v = $v > 1; |
115 | $ns->{can_widget} = 1; |
115 | $ns->{can_widget} = $v; |
|
|
116 | $ns->fx_want (6 => 1); # need support for RSRC |
|
|
117 | $setup{$k} = $v ? 2 : 0; |
|
|
118 | |
|
|
119 | } elsif ($k eq "lzf") { |
|
|
120 | # the lzf packet simply contains an lzf-compressed packet as argument |
|
|
121 | $ns->{can_lzf} = $v == 1; |
|
|
122 | |
|
|
123 | } elsif ($k eq "frag") { |
|
|
124 | # the frag packet contains data which gets appended to the existing packet buffer. |
|
|
125 | # empty frag packet means end of packet. |
|
|
126 | $ns->{can_frag} = $v == 1; |
116 | |
127 | |
117 | } elsif ($k eq "excmd") { |
128 | } elsif ($k eq "excmd") { |
118 | # we support it |
129 | # we support it |
119 | |
130 | |
120 | } else { |
131 | } else { |