ViewVC Help
View File | Revision Log | Show Annotations | Download File
/cvs/deliantra/Deliantra-Client/bin/pclient
(Generate patch)

Comparing deliantra/Deliantra-Client/bin/pclient (file contents):
Revision 1.160 by root, Sat Apr 22 23:11:34 2006 UTC vs.
Revision 1.172 by root, Mon Apr 24 03:43:52 2006 UTC

36our @SDL_MODES; 36our @SDL_MODES;
37our $WIDTH; 37our $WIDTH;
38our $HEIGHT; 38our $HEIGHT;
39our $FULLSCREEN; 39our $FULLSCREEN;
40our $FONTSIZE; 40our $FONTSIZE;
41
42our $FONT_PROP;
43our $FONT_FIXED;
41 44
42our $MAP; 45our $MAP;
43our $MAPWIDGET; 46our $MAPWIDGET;
44our $BUTTONBAR; 47our $BUTTONBAR;
45our $LOGVIEW; 48our $LOGVIEW;
120 $mode_slider->emit (changed => $mode_slider->{range}[0]); 123 $mode_slider->emit (changed => $mode_slider->{range}[0]);
121 124
122 my $row = 1; 125 my $row = 1;
123 126
124 $table->add (0, $row, new CFClient::UI::Label valign => 0, align => 1, text => "Fullscreen"); 127 $table->add (0, $row, new CFClient::UI::Label valign => 0, align => 1, text => "Fullscreen");
125 $table->add (1, $row++, new CFClient::UI::CheckBox state => $CFG->{fullscreen}, connect_changed => sub { 128 $table->add (1, $row++, new CFClient::UI::CheckBox
129 state => $CFG->{fullscreen},
130 tooltip => "Bring the client into fullscreen mode",
131 connect_changed => sub {
126 my ($self, $value) = @_; 132 my ($self, $value) = @_;
127 $CFG->{fullscreen} = $value; 133 $CFG->{fullscreen} = $value;
134 }
128 }); 135 );
129 136
130 $table->add (0, $row, new CFClient::UI::Label valign => 0, align => 1, text => "Fast & Ugly"); 137 $table->add (0, $row, new CFClient::UI::Label valign => 0, align => 1, text => "Fast & Ugly");
131 $table->add (1, $row++, new CFClient::UI::CheckBox state => $CFG->{fast}, connect_changed => sub { 138 $table->add (1, $row++, new CFClient::UI::CheckBox
139 state => $CFG->{fast},
140 tooltip => "Lower the visual quality considerably to speed up rendering.",
141 connect_changed => sub {
132 my ($self, $value) = @_; 142 my ($self, $value) = @_;
133 $CFG->{fast} = $value; 143 $CFG->{fast} = $value;
144 }
134 }); 145 );
146
147 $table->add (0, $row, new CFClient::UI::Label valign => 0, align => 1, text => "Map Scale");
148 $table->add (1, $row++, new CFClient::UI::Slider
149 range => [$CFG->{map_scale}, 0.25, 2, 0.05],
150 tooltip => "Enlarge or shrink the displayed map",
151 connect_changed => sub {
152 my ($self, $value) = @_;
153 $CFG->{map_scale} = 0.05 * int $value / 0.05;
154 }
155 );
135 156
136 $table->add (0, $row, new CFClient::UI::Label valign => 0, align => 1, text => "Fog of War"); 157 $table->add (0, $row, new CFClient::UI::Label valign => 0, align => 1, text => "Fog of War");
137 $table->add (1, $row++, new CFClient::UI::CheckBox state => $CFG->{fow_enable}, connect_changed => sub { 158 $table->add (1, $row++, new CFClient::UI::CheckBox
159 state => $CFG->{fow_enable},
160 tooltip => "Fog-of-War marks areas that cannot be seen by the player",
161 connect_changed => sub {
138 my ($self, $value) = @_; 162 my ($self, $value) = @_;
139 $CFG->{fow_enable} = $value; 163 $CFG->{fow_enable} = $value;
164 }
140 }); 165 );
141 166
142 $table->add (0, $row, new CFClient::UI::Label valign => 0, align => 1, text => "FoW Intensity"); 167 $table->add (0, $row, new CFClient::UI::Label valign => 0, align => 1, text => "FoW Intensity");
143 $table->add (1, $row++, new CFClient::UI::Slider range => [$CFG->{fow_intensity}, 0, 1 + 0.001, 0.001], connect_changed => sub { 168 $table->add (1, $row++, new CFClient::UI::Slider
169 range => [$CFG->{fow_intensity}, 0, 1 + 0.001, 0.001],
170 tooltip => "The higher the intensity, the lighter the Fog-of-War color",
171 connect_changed => sub {
144 my ($self, $value) = @_; 172 my ($self, $value) = @_;
145 $CFG->{fow_intensity} = $value; 173 $CFG->{fow_intensity} = $value;
174 }
146 }); 175 );
147 176
148 $table->add (0, $row, new CFClient::UI::Label valign => 0, align => 1, text => "FoW Smooth"); 177 $table->add (0, $row, new CFClient::UI::Label valign => 0, align => 1, text => "FoW Smooth");
149 $table->add (1, $row++, new CFClient::UI::CheckBox state => $CFG->{fow_smooth}, connect_changed => sub { 178 $table->add (1, $row++, new CFClient::UI::CheckBox
179 state => $CFG->{fow_smooth},
180 tooltip => "Smooth the Fog-of-War a bit to make it more realistic",
181 connect_changed => sub {
150 my ($self, $value) = @_; 182 my ($self, $value) = @_;
151 $CFG->{fow_smooth} = $value; 183 $CFG->{fow_smooth} = $value;
152 status "Fog of War smoothing requires OpenGL 1.2 or higher" if $CFClient::GL_VERSION < 1.2; 184 status "Fog of War smoothing requires OpenGL 1.2 or higher" if $CFClient::GL_VERSION < 1.2;
185 }
153 }); 186 );
154 187
155 $table->add (0, $row, new CFClient::UI::Label valign => 0, align => 1, text => "GUI Fontsize"); 188 $table->add (0, $row, new CFClient::UI::Label valign => 0, align => 1, text => "GUI Fontsize");
156 $table->add (1, $row++, new CFClient::UI::Slider range => [$CFG->{gui_fontsize}, 0.7, 1.7, 0.1], connect_changed => sub { 189 $table->add (1, $row++, new CFClient::UI::Slider
190 range => [$CFG->{gui_fontsize}, 0.5, 2, 0.1],
191 tooltip => "The font size used by most GUI elements",
192 connect_changed => sub {
157 $CFG->{gui_fontsize} = 0.1 * int $_[1] * 10; 193 $CFG->{gui_fontsize} = 0.1 * int $_[1] * 10;
158# $FONTSIZE = int $HEIGHT / 40 * $CFG->{gui_fontsize}; 194# $FONTSIZE = int $HEIGHT / 40 * $CFG->{gui_fontsize};
195 }
159 }); 196 );
160 197
161 $table->add (0, $row, new CFClient::UI::Label valign => 0, align => 1, text => "Server Log Fontsize"); 198 $table->add (0, $row, new CFClient::UI::Label valign => 0, align => 1, text => "Server Log Fontsize");
162 $table->add (1, $row++, new CFClient::UI::Slider range => [$CFG->{log_fontsize}, 0.7, 1.7, 0.1], connect_changed => sub { 199 $table->add (1, $row++, new CFClient::UI::Slider
200 range => [$CFG->{log_fontsize}, 0.5, 2, 0.1],
201 tooltip => "The font size used by the server log window only",
202 connect_changed => sub {
163 $LOGVIEW->set_fontsize ($CFG->{log_fontsize} = 0.1 * int $_[1] * 10); 203 $LOGVIEW->set_fontsize ($CFG->{log_fontsize} = 0.1 * int $_[1] * 10);
204 }
164 }); 205 );
165 206
166 $table->add (0, $row, new CFClient::UI::Label valign => 0, align => 1, text => "Stats Fontsize"); 207 $table->add (0, $row, new CFClient::UI::Label valign => 0, align => 1, text => "Stats Fontsize");
167 $table->add (1, $row++, new CFClient::UI::Slider range => [$CFG->{stat_fontsize}, 0.7, 1.7, 0.1], connect_changed => sub { 208
209 $table->add (1, $row++, new CFClient::UI::Slider
210 range => [$CFG->{stat_fontsize}, 0.5, 2, 0.1],
211 tooltip => "The font size used by the statistics window only",
212 connect_changed => sub {
168 $CFG->{stat_fontsize} = 0.1 * int $_[1] * 10; 213 $CFG->{stat_fontsize} = 0.1 * int $_[1] * 10;
169 &set_stats_window_fontsize; 214 &set_stats_window_fontsize;
215 }
170 }); 216 );
171 217
172 $table->add (0, $row, new CFClient::UI::Label valign => 0, align => 1, text => "Gauge width"); 218 $table->add (0, $row, new CFClient::UI::Label valign => 0, align => 1, text => "Gauge size");
173 $table->add (1, $row++, new CFClient::UI::Slider range => [$CFG->{gauge_w_size}, 0.1, 0.5, 0.02], connect_changed => sub { 219 $table->add (1, $row++, new CFClient::UI::Slider
174 $CFG->{gauge_w_size} = $_[1]; 220 range => [$CFG->{gauge_size}, 0.2, 0.8, 0.02],
175 my $h = int ($HEIGHT * $CFG->{gauge_size}); 221 tooltip => "Adjust the size of the stats gauges at the bottom right",
176 my $w = int ($WIDTH * $CFG->{gauge_w_size}); 222 connect_changed => sub {
177 $GAUGES->{win}->set_size ($w, $h);
178 $GAUGES->{win}->{y} = $HEIGHT - $h;
179 $GAUGES->{win}->{x} = $WIDTH - $w;
180 $GAUGES->{win}->update;
181 });
182
183 $table->add (0, $row, new CFClient::UI::Label valign => 0, align => 1, text => "Gauge height");
184 $table->add (1, $row++, new CFClient::UI::Slider range => [$CFG->{gauge_size}, 0.2, 0.8, 0.02], connect_changed => sub {
185 $CFG->{gauge_size} = $_[1]; 223 $CFG->{gauge_size} = $_[1];
186 my $h = int ($HEIGHT * $CFG->{gauge_size}); 224 my $h = int $HEIGHT * $CFG->{gauge_size};
187 my $w = int ($WIDTH * $CFG->{gauge_w_size});
188 $GAUGES->{win}->set_size ($w, $h); 225 $GAUGES->{win}->set_size ($WIDTH, $h);
189 $GAUGES->{win}->{y} = $HEIGHT - $h; 226 $GAUGES->{win}->move (0, $HEIGHT - $h);
190 $GAUGES->{win}->{x} = $WIDTH - $w; 227 }
191 $GAUGES->{win}->update;
192 }); 228 );
193
194 229
195 $table->add (0, $row, new CFClient::UI::Label valign => 0, align => 1, text => "Gauge fontsize"); 230 $table->add (0, $row, new CFClient::UI::Label valign => 0, align => 1, text => "Gauge fontsize");
196 $table->add (1, $row++, new CFClient::UI::Slider range => [$CFG->{gauge_fontsize}, 0.7, 1.7, 0.1], connect_changed => sub { 231 $table->add (1, $row++, new CFClient::UI::Slider
232 range => [$CFG->{gauge_fontsize}, 0.5, 2.0, 0.1],
233 tooltip => "Adjusts the fontsize of the gauges at the bottom right",
234 connect_changed => sub {
197 $CFG->{gauge_fontsize} = 0.1 * int $_[1] * 10; 235 $CFG->{gauge_fontsize} = 0.1 * int $_[1] * 10;
198 &set_gauge_window_fontsize; 236 &set_gauge_window_fontsize;
199 $GAUGES->{win}->check_size; 237 }
200 $GAUGES->{win}->update;
201 }); 238 );
202 239
203 240 $table->add (1, $row++, new CFClient::UI::Button
204 241 expand => 1, align => 0, text => "Apply",
205 $table->add (1, $row++, new CFClient::UI::Button expand => 1, align => 0, text => "Apply", connect_activate => sub { 242 tooltip => "Apply the video settings",
243 connect_activate => sub {
206 video_shutdown (); 244 video_shutdown ();
207 video_init (); 245 video_init ();
246 }
208 }); 247 );
209 248
210 $table->add (0, $row, new CFClient::UI::Label valign => 0, align => 1, text => "Audio Enable"); 249 $table->add (0, $row, new CFClient::UI::Label valign => 0, align => 1, text => "Audio Enable");
211 $table->add (1, $row++, new CFClient::UI::CheckBox state => $CFG->{audio_enable}, connect_changed => sub { 250 $table->add (1, $row++, new CFClient::UI::CheckBox
251 state => $CFG->{audio_enable},
252 tooltip => "If enabled, sound effects and music will be played. If disabled, no audio will be used and the soundcard will not be opened.",
253 connect_changed => sub {
212 $CFG->{audio_enable} = $_[1]; 254 $CFG->{audio_enable} = $_[1];
255 }
213 }); 256 );
214# $table->add (0, 9, new CFClient::UI::Label valign => 0, align => 1, text => "Effects Volume"); 257# $table->add (0, 9, new CFClient::UI::Label valign => 0, align => 1, text => "Effects Volume");
215# $table->add (1, 8, new CFClient::UI::Slider range => [$CFG->{effects_volume}, 0, 128, 1], connect_changed => sub { 258# $table->add (1, 8, new CFClient::UI::Slider range => [$CFG->{effects_volume}, 0, 128, 1], connect_changed => sub {
216# $CFG->{effects_volume} = $_[1]; 259# $CFG->{effects_volume} = $_[1];
217# }); 260# });
218 $table->add (0, $row, new CFClient::UI::Label valign => 0, align => 1, text => "Background Music"); 261 $table->add (0, $row, new CFClient::UI::Label valign => 0, align => 1, text => "Background Music");
219 $table->add (1, $row++, my $hbox = new CFClient::UI::HBox); 262 $table->add (1, $row++, my $hbox = new CFClient::UI::HBox);
220 $hbox->add (new CFClient::UI::CheckBox expand => 1, state => $CFG->{bgm_enable}, connect_changed => sub { 263 $hbox->add (new CFClient::UI::CheckBox
264 expand => 1, state => $CFG->{bgm_enable},
265 tooltip => "Enable background music playing",
266 connect_changed => sub {
221 $CFG->{bgm_enable} = $_[1]; 267 $CFG->{bgm_enable} = $_[1];
268 }
222 }); 269 );
223 $hbox->add (new CFClient::UI::Slider expand => 1, range => [$CFG->{bgm_volume}, 0, 1, 0.1], connect_changed => sub { 270 $hbox->add (new CFClient::UI::Slider
271 expand => 1, range => [$CFG->{bgm_volume}, 0, 1, 0.1],
272 tooltip => "The volume of the background music",
273 connect_changed => sub {
224 $CFG->{bgm_volume} = $_[1]; 274 $CFG->{bgm_volume} = $_[1];
225 CFClient::MixMusic::volume $_[1] * 128; 275 CFClient::MixMusic::volume $_[1] * 128;
276 }
226 }); 277 );
227 278
228 $table->add (1, $row++, new CFClient::UI::Button expand => 1, align => 0, text => "Apply", connect_activate => sub { 279 $table->add (1, $row++, new CFClient::UI::Button
280 expand => 1, align => 0, text => "Apply",
281 tooltip => "Apply the audio settings",
282 connect_activate => sub {
229 audio_shutdown (); 283 audio_shutdown ();
230 audio_init (); 284 audio_init ();
285 }
231 }); 286 );
232 287
233 $dialog 288 $dialog
234} 289}
235 290
236sub set_stats_window_fontsize { 291sub set_stats_window_fontsize {
241 296
242sub set_gauge_window_fontsize { 297sub set_gauge_window_fontsize {
243 for (map { $GAUGES->{$_} } grep { $_ ne 'win' } keys %{$GAUGES}) { 298 for (map { $GAUGES->{$_} } grep { $_ ne 'win' } keys %{$GAUGES}) {
244 $_->set_fontsize ($::CFG->{gauge_fontsize}); 299 $_->set_fontsize ($::CFG->{gauge_fontsize});
245 } 300 }
301
302# local $GAUGES->{win}{parent};#d#
303# use PApp::Util; open D, ">:utf8", "d"; print D PApp::Util::dumpval $GAUGES->{win}; close D;
246} 304}
247 305
248sub make_gauge_window { 306sub make_gauge_window {
249 my $gh = int ($HEIGHT * $CFG->{gauge_size}); 307 my $gh = int ($HEIGHT * $CFG->{gauge_size});
250 my $gw = int ($WIDTH * $CFG->{gauge_w_size}); 308# my $gw = int ($WIDTH * $CFG->{gauge_w_size});
251 309
252 my $win = new CFClient::UI::Frame ( 310 my $win = new CFClient::UI::Frame (
253 y => $HEIGHT - $gh, x => $WIDTH - $gw, req_w => $gw, req_h => $gh 311 y => $HEIGHT - $gh, x => 0, user_w => $WIDTH, user_h => $gh
254 ); 312 );
255 $win->add (my $vb = new CFClient::UI::VBox); 313 $win->add (my $vb = new CFClient::UI::VBox);
256 314
257 $vb->add (my $hb = new CFClient::UI::HBox expand => 1); 315 $vb->add (my $hb1 = new CFClient::UI::HBox expand => 1);
316
317 $hb1->add (new CFClient::UI::Empty expand => 1);
318 $hb1->add (my $hb = new CFClient::UI::HBox);
258 $hb->add (my $hg = new CFClient::UI::Gauge type => 'hp', expand => 1); 319 $hb->add (my $hg = new CFClient::UI::Gauge type => 'hp',
320 tooltip => "Health points - depletes when you get wounded, refills when you heal or idle");
259 $hb->add (my $mg = new CFClient::UI::Gauge type => 'mana', expand => 1); 321 $hb->add (my $mg = new CFClient::UI::Gauge type => 'mana',
322 tooltip => "Spell points - deplete when you cast wizard spells, refills when you idle");
260 $hb->add (my $gg = new CFClient::UI::Gauge type => 'grace', expand => 1); 323 $hb->add (my $gg = new CFClient::UI::Gauge type => 'grace',
324 tooltip => "Grace points - deplete when you cast priest spells, refills when you pray");
261 $hb->add (my $fg = new CFClient::UI::Gauge type => 'food', expand => 1); 325 $hb->add (my $fg = new CFClient::UI::Gauge type => 'food',
326 tooltip => "Food - depletes with time, faster when you heal or build mana, refills when you eat healthy food");
327
328 $vb->add (my $hb2 = new CFClient::UI::HBox);
329
330 $hb2->add (new CFClient::UI::Empty expand => 1);
331 $hb2->add (my $vb2 = new CFClient::UI::VBox);
262 $vb->add (my $exp = new CFClient::UI::Label valign => 0, align => -1, text => "XP:"); 332 $vb2->add (my $exp = new CFClient::UI::Label valign => 0, align => 1, can_hover => 1, can_events => 1,
263 $vb->add (my $lvl = new CFClient::UI::Label valign => 0, align => -1, text => "Lvl:"); 333 tooltip => "Experience points and level - increases when you kill monsters or successfully use skills");
264 $vb->add (my $rng = new CFClient::UI::Label valign => 0, align => -1, text => "Rng:"); 334 $vb2->add (my $rng = new CFClient::UI::Label valign => 0, align => 1, can_hover => 1, can_events => 1,
265 335 tooltip => "Ranged attack - how you attack when you press shift-cursor (spell, skill, weapon etc.)");
266 336
267 $GAUGES = { 337 $GAUGES = {
268 exp => $exp, lvl => $lvl, win => $win, range => $rng, 338 exp => $exp, win => $win, range => $rng,
269 food => $fg, mana => $mg, hp => $hg, grace => $gg 339 food => $fg, mana => $mg, hp => $hg, grace => $gg
270 }; 340 };
341
342 &set_gauge_window_fontsize;
343
271 $win 344 $win
272} 345}
273 346
274sub make_stats_window { 347sub make_stats_window {
275 my $tgw = new CFClient::UI::FancyFrame (x => $WIDTH * 2/5, y => 0, title => "Stats"); 348 my $tgw = new CFClient::UI::FancyFrame (x => $WIDTH * 2/5, y => 0, title => "Stats");
276 349
277 $tgw->add (my $vb = new CFClient::UI::VBox); 350 $tgw->add (my $vb = new CFClient::UI::VBox);
278 $vb->add (my $uhb = new CFClient::UI::HBox);
279 $uhb->add ($STATWIDS->{title} = new CFClient::UI::Label valign => 0, align => -1, text => "Title:", expand => 1); 351 $vb->add ($STATWIDS->{title} = new CFClient::UI::Label valign => 0, align => -1, text => "Title:", expand => 1);
280 $uhb->add ($STATWIDS->{map} = new CFClient::UI::Label valign => 0, align => -1, text => "Map:", expand => 1); 352 $vb->add ($STATWIDS->{map} = new CFClient::UI::Label valign => 0, align => -1, text => "Map:", expand => 1);
281 353
282 $vb->add (my $hb = new CFClient::UI::HBox expand => 1); 354 $vb->add (my $hb = new CFClient::UI::HBox expand => 1);
283 355
284 $hb->add (my $tbl = new CFClient::UI::Table expand => 1); 356 $hb->add (my $tbl = new CFClient::UI::Table expand => 1);
285 357
358 $tbl->add (0, 0, $STATWIDS->{st_str} = new CFClient::UI::Label valign => 0, align => +1, template => "30");
359 $tbl->add (0, 1, $STATWIDS->{st_dex} = new CFClient::UI::Label valign => 0, align => +1, template => "30");
360 $tbl->add (0, 2, $STATWIDS->{st_con} = new CFClient::UI::Label valign => 0, align => +1, template => "30");
361 $tbl->add (0, 3, $STATWIDS->{st_int} = new CFClient::UI::Label valign => 0, align => +1, template => "30");
362 $tbl->add (0, 4, $STATWIDS->{st_wis} = new CFClient::UI::Label valign => 0, align => +1, template => "30");
363 $tbl->add (0, 5, $STATWIDS->{st_pow} = new CFClient::UI::Label valign => 0, align => +1, template => "30");
364 $tbl->add (0, 6, $STATWIDS->{st_cha} = new CFClient::UI::Label valign => 0, align => +1, template => "30");
365
286 $tbl->add (0, 0, $STATWIDS->{st_str_lbl} = new CFClient::UI::Label valign => 0, align => +1, text => "Str"); 366 $tbl->add (1, 0, $STATWIDS->{st_str_lbl} = new CFClient::UI::Label valign => 0, align => -1, text => "Str");
287 $tbl->add (0, 1, $STATWIDS->{st_dex_lbl} = new CFClient::UI::Label valign => 0, align => +1, text => "Dex"); 367 $tbl->add (1, 1, $STATWIDS->{st_dex_lbl} = new CFClient::UI::Label valign => 0, align => -1, text => "Dex");
288 $tbl->add (0, 2, $STATWIDS->{st_con_lbl} = new CFClient::UI::Label valign => 0, align => +1, text => "Con"); 368 $tbl->add (1, 2, $STATWIDS->{st_con_lbl} = new CFClient::UI::Label valign => 0, align => -1, text => "Con");
289 $tbl->add (0, 3, $STATWIDS->{st_int_lbl} = new CFClient::UI::Label valign => 0, align => +1, text => "Int"); 369 $tbl->add (1, 3, $STATWIDS->{st_int_lbl} = new CFClient::UI::Label valign => 0, align => -1, text => "Int");
290 $tbl->add (0, 4, $STATWIDS->{st_wis_lbl} = new CFClient::UI::Label valign => 0, align => +1, text => "Wis"); 370 $tbl->add (1, 4, $STATWIDS->{st_wis_lbl} = new CFClient::UI::Label valign => 0, align => -1, text => "Wis");
291 $tbl->add (0, 5, $STATWIDS->{st_pow_lbl} = new CFClient::UI::Label valign => 0, align => +1, text => "Pow"); 371 $tbl->add (1, 5, $STATWIDS->{st_pow_lbl} = new CFClient::UI::Label valign => 0, align => -1, text => "Pow");
292 $tbl->add (0, 6, $STATWIDS->{st_cha_lbl} = new CFClient::UI::Label valign => 0, align => +1, text => "Cha"); 372 $tbl->add (1, 6, $STATWIDS->{st_cha_lbl} = new CFClient::UI::Label valign => 0, align => -1, text => "Cha");
293 373
294 $tbl->add (1, 0, $STATWIDS->{st_str} = new CFClient::UI::Label valign => 0, align => +1, text => ""); 374 $tbl->add (2, 0, $STATWIDS->{st_wc} = new CFClient::UI::Label valign => 0, align => +1, template => "-120");
375 $tbl->add (2, 1, $STATWIDS->{st_ac} = new CFClient::UI::Label valign => 0, align => +1, template => "-120");
295 $tbl->add (1, 1, $STATWIDS->{st_dex} = new CFClient::UI::Label valign => 0, align => +1, text => ""); 376 $tbl->add (2, 2, $STATWIDS->{st_dam} = new CFClient::UI::Label valign => 0, align => +1, template => "120");
296 $tbl->add (1, 2, $STATWIDS->{st_con} = new CFClient::UI::Label valign => 0, align => +1, text => "");
297 $tbl->add (1, 3, $STATWIDS->{st_int} = new CFClient::UI::Label valign => 0, align => +1, text => ""); 377 $tbl->add (2, 3, $STATWIDS->{st_arm} = new CFClient::UI::Label valign => 0, align => +1, template => "120");
378 $tbl->add (2, 4, $STATWIDS->{st_spd} = new CFClient::UI::Label valign => 0, align => +1, template => "10.54");
298 $tbl->add (1, 4, $STATWIDS->{st_wis} = new CFClient::UI::Label valign => 0, align => +1, text => ""); 379 $tbl->add (2, 5, $STATWIDS->{st_wspd} = new CFClient::UI::Label valign => 0, align => +1, template => "9");
299 $tbl->add (1, 5, $STATWIDS->{st_pow} = new CFClient::UI::Label valign => 0, align => +1, text => "");
300 $tbl->add (1, 6, $STATWIDS->{st_cha} = new CFClient::UI::Label valign => 0, align => +1, text => "");
301 380
302 $tbl->add (2, 0, $STATWIDS->{st_wc_lbl} = new CFClient::UI::Label valign => 0, align => +1, text => "Wc"); 381 $tbl->add (3, 0, $STATWIDS->{st_wc_lbl} = new CFClient::UI::Label valign => 0, align => -1, text => "Wc");
303 $tbl->add (2, 1, $STATWIDS->{st_ac_lbl} = new CFClient::UI::Label valign => 0, align => +1, text => "Ac"); 382 $tbl->add (3, 1, $STATWIDS->{st_ac_lbl} = new CFClient::UI::Label valign => 0, align => -1, text => "Ac");
304 $tbl->add (2, 2, $STATWIDS->{st_dam_lbl} = new CFClient::UI::Label valign => 0, align => +1, text => "Dam"); 383 $tbl->add (3, 2, $STATWIDS->{st_dam_lbl} = new CFClient::UI::Label valign => 0, align => -1, text => "Dam");
305 $tbl->add (2, 3, $STATWIDS->{st_arm_lbl} = new CFClient::UI::Label valign => 0, align => +1, text => "Arm"); 384 $tbl->add (3, 3, $STATWIDS->{st_arm_lbl} = new CFClient::UI::Label valign => 0, align => -1, text => "Arm");
306 $tbl->add (2, 4, $STATWIDS->{st_spd_lbl} = new CFClient::UI::Label valign => 0, align => +1, text => "Sp"); 385 $tbl->add (3, 4, $STATWIDS->{st_spd_lbl} = new CFClient::UI::Label valign => 0, align => -1, text => "Sp");
307 $tbl->add (2, 5, $STATWIDS->{st_wspd_lbl} = new CFClient::UI::Label valign => 0, align => +1, text => "WSp"); 386 $tbl->add (3, 5, $STATWIDS->{st_wspd_lbl} = new CFClient::UI::Label valign => 0, align => -1, text => "WSp");
308
309 $tbl->add (3, 0, $STATWIDS->{st_wc} = new CFClient::UI::Label valign => 0, align => +1, text => "");
310 $tbl->add (3, 1, $STATWIDS->{st_ac} = new CFClient::UI::Label valign => 0, align => +1, text => "");
311 $tbl->add (3, 2, $STATWIDS->{st_dam} = new CFClient::UI::Label valign => 0, align => +1, text => "");
312 $tbl->add (3, 3, $STATWIDS->{st_arm} = new CFClient::UI::Label valign => 0, align => +1, text => "");
313 $tbl->add (3, 4, $STATWIDS->{st_spd} = new CFClient::UI::Label valign => 0, align => +1, text => "");
314 $tbl->add (3, 5, $STATWIDS->{st_wspd} = new CFClient::UI::Label valign => 0, align => +1, text => "");
315 387
316 $hb->add (my $tbl2 = new CFClient::UI::Table expand => 1); 388 $hb->add (my $tbl2 = new CFClient::UI::Table expand => 1);
317 389
318 my $row = 0; 390 my $row = 0;
319 my $col = 0; 391 my $col = 0;
320 392
393 my %resist_names = (
394 slow => "Slow",
395 holyw => "Holy Word",
396 conf => "Confusion",
397 fire => "Fire",
398 depl => "Depletion",
399 magic => "Magic",
400 drain => "Draining",
401 acid => "Acid",
402 pois => "Poison",
403 para => "Paralysation",
404 deat => "Death",
405 phys => "Physical",
406 blind => "Blind",
407 fear => "Fear",
408 tund => "Turn undead",
409 elec => "Electricity",
410 cold => "Cold",
411 ghit => "Ghost hit",
412 );
321 for (qw/slow holyw conf fire depl magic 413 for (qw/slow holyw conf fire depl magic
322 drain acid pois para deat phys 414 drain acid pois para deat phys
323 blind fear tund elec cold ghit/) 415 blind fear tund elec cold ghit/)
324 { 416 {
325 $tbl2->add ($col , $row, 417 $tbl2->add ($col, $row,
326 $STATWIDS->{"res_$_"} = 418 $STATWIDS->{"res_$_"} =
327 new CFClient::UI::Label text => "0", align => +1, valign => 0 419 new CFClient::UI::Label
420 template => "-100%",
421 align => +1,
422 valign => 0,
423 tooltip => $resist_names{$_}
328 ); 424 );
329 $tbl2->add ($col + 1, $row, new CFClient::UI::Image image => "ui/resist/resist_$_.png"); 425 $tbl2->add ($col + 1, $row, new CFClient::UI::Image
426 can_hover => 1,
427 can_events => 1,
428 image => "ui/resist/resist_$_.png",
429 tooltip => $resist_names{$_}
430 );
330 431
331 $row++; 432 $row++;
332 if ($row % 6 == 0) { 433 if ($row % 6 == 0) {
333 $col += 2; 434 $col += 2;
334 $row = 0; 435 $row = 0;
339 update_stats_window ({}); 440 update_stats_window ({});
340 441
341 $tgw 442 $tgw
342} 443}
343 444
445sub formsep {
446 reverse join ",", grep length, split /(...)/, reverse $_[0] * 1
447}
448
344sub update_stats_window { 449sub update_stats_window {
345 my ($stats) = @_; 450 my ($stats) = @_;
346 451
347 # i love text protocols!!! 452 # i love text protocols!!!
348 my $hp = $stats->{1} * 1; 453 my $hp = $stats->{Crossfire::Protocol::CS_STAT_HP} * 1;
349 my $hp_m = $stats->{2} * 1; 454 my $hp_m = $stats->{Crossfire::Protocol::CS_STAT_MAXHP} * 1;
350 my $sp = $stats->{3} * 1; 455 my $sp = $stats->{Crossfire::Protocol::CS_STAT_SP} * 1;
351 my $sp_m = $stats->{4} * 1; 456 my $sp_m = $stats->{Crossfire::Protocol::CS_STAT_MAXSP} * 1;
352 my $fo = $stats->{18} * 1; 457 my $fo = $stats->{Crossfire::Protocol::CS_STAT_FOOD} * 1;
353 my $fo_m = 999; 458 my $fo_m = 999;
354 my $gr = $stats->{23} * 1; 459 my $gr = $stats->{Crossfire::Protocol::CS_STAT_GRACE} * 1;
355 my $gr_m = $stats->{24} * 1; 460 my $gr_m = $stats->{Crossfire::Protocol::CS_STAT_MAXGRACE} * 1;
356 461
357 $GAUGES->{hp} ->set_value ($hp, $hp_m); 462 $GAUGES->{hp} ->set_value ($hp, $hp_m);
358 $GAUGES->{mana} ->set_value ($sp, $sp_m); 463 $GAUGES->{mana} ->set_value ($sp, $sp_m);
359 $GAUGES->{food} ->set_value ($fo, $fo_m); 464 $GAUGES->{food} ->set_value ($fo, $fo_m);
360 $GAUGES->{grace} ->set_value ($gr, $gr_m); 465 $GAUGES->{grace} ->set_value ($gr, $gr_m);
361 $GAUGES->{exp} ->set_text ("XP: " . ($stats->{11} || $stats->{28})); 466 $GAUGES->{exp} ->set_text ("Exp: " . (formsep $stats->{Crossfire::Protocol::CS_STAT_EXP64})
362 my $rng = $stats->{20}; 467 . " (lvl " . ($stats->{Crossfire::Protocol::CS_STAT_LEVEL} * 1) . ")");
468 my $rng = $stats->{Crossfire::Protocol::CS_STAT_RANGE};
363 $rng =~ s/^Range: //; # thank you so much dear server 469 $rng =~ s/^Range: //; # thank you so much dear server
364 $GAUGES->{range} ->set_text ("Rng: " . $rng); 470 $GAUGES->{range} ->set_text ("Rng: " . $rng);
365 $GAUGES->{lvl} ->set_text ("LVL: " . $stats->{12}); 471 my $title = $stats->{Crossfire::Protocol::CS_STAT_TITLE};
472 $title =~ s/^Player: //;
366 $STATWIDS->{title} ->set_text ("Title: " . $stats->{21}); 473 $STATWIDS->{title} ->set_text ("Title: " . $title);
367 474
368 if (0) { # this code can vanish, just wanted to preserver it for a checkin
369 $STATWIDS->{st_str} ->set_text (sprintf "S%d", $stats->{5});
370 $STATWIDS->{st_dex} ->set_text (sprintf "D%d", $stats->{8});
371 $STATWIDS->{st_con} ->set_text (sprintf "Co%d", $stats->{9});
372 $STATWIDS->{st_int} ->set_text (sprintf "I%d", $stats->{6});
373 $STATWIDS->{st_wis} ->set_text (sprintf "W%d", $stats->{7});
374 $STATWIDS->{st_pow} ->set_text (sprintf "P%d", $stats->{22});
375 $STATWIDS->{st_cha} ->set_text (sprintf "Ch%d", $stats->{10});
376 $STATWIDS->{st_wc} ->set_text (sprintf "Wc%d", $stats->{13});
377 $STATWIDS->{st_ac} ->set_text (sprintf "Ac%d", $stats->{14});
378 $STATWIDS->{st_dam} ->set_text (sprintf "Dam%d", $stats->{15});
379 $STATWIDS->{st_arm} ->set_text (sprintf "Arm%d", $stats->{16});
380 $STATWIDS->{st_spd} ->set_text (sprintf "Sp%.1f", $stats->{17});
381 $STATWIDS->{st_wspd}->set_text (sprintf "WSp%.1f", $stats->{19});
382 } else {
383 $STATWIDS->{st_str} ->set_text (sprintf "%d", $stats->{5}); 475 $STATWIDS->{st_str} ->set_text (sprintf "%d", $stats->{5});
384 $STATWIDS->{st_dex} ->set_text (sprintf "%d", $stats->{8}); 476 $STATWIDS->{st_dex} ->set_text (sprintf "%d", $stats->{8});
385 $STATWIDS->{st_con} ->set_text (sprintf "%d", $stats->{9}); 477 $STATWIDS->{st_con} ->set_text (sprintf "%d", $stats->{9});
386 $STATWIDS->{st_int} ->set_text (sprintf "%d", $stats->{6}); 478 $STATWIDS->{st_int} ->set_text (sprintf "%d", $stats->{6});
387 $STATWIDS->{st_wis} ->set_text (sprintf "%d", $stats->{7}); 479 $STATWIDS->{st_wis} ->set_text (sprintf "%d", $stats->{7});
388 $STATWIDS->{st_pow} ->set_text (sprintf "%d", $stats->{22}); 480 $STATWIDS->{st_pow} ->set_text (sprintf "%d", $stats->{22});
389 $STATWIDS->{st_cha} ->set_text (sprintf "%d", $stats->{10}); 481 $STATWIDS->{st_cha} ->set_text (sprintf "%d", $stats->{10});
390 $STATWIDS->{st_wc} ->set_text (sprintf "%d", $stats->{13}); 482 $STATWIDS->{st_wc} ->set_text (sprintf "%d", $stats->{13});
391 $STATWIDS->{st_ac} ->set_text (sprintf "%d", $stats->{14}); 483 $STATWIDS->{st_ac} ->set_text (sprintf "%d", $stats->{14});
392 $STATWIDS->{st_dam} ->set_text (sprintf "%d", $stats->{15}); 484 $STATWIDS->{st_dam} ->set_text (sprintf "%d", $stats->{15});
393 $STATWIDS->{st_arm} ->set_text (sprintf "%d", $stats->{16}); 485 $STATWIDS->{st_arm} ->set_text (sprintf "%d", $stats->{16});
394 $STATWIDS->{st_spd} ->set_text (sprintf "%.1f", $stats->{17}); 486 $STATWIDS->{st_spd} ->set_text (sprintf "%.1f", $stats->{Crossfire::Protocol::CS_STAT_SPEED});
395 $STATWIDS->{st_wspd}->set_text (sprintf "%.1f", $stats->{19}); 487 $STATWIDS->{st_wspd}->set_text (sprintf "%.1f", $stats->{Crossfire::Protocol::CS_STAT_WEAP_SP});
396 }
397 488
398 my %tbl = ( 489 my %tbl = (
399 phys => 100, 490 phys => 100,
400 magic => 101, 491 magic => 101,
401 fire => 102, 492 fire => 102,
408 pois => 109, 499 pois => 109,
409 slow => 110, 500 slow => 110,
410 para => 111, 501 para => 111,
411 tund => 112, 502 tund => 112,
412 fear => 113, 503 fear => 113,
504 depl => 113,
413 deat => 115, 505 deat => 115,
414 holyw => 116, 506 holyw => 116,
415 blind => 117 507 blind => 117
416 ); 508 );
417 509
506 $table->add (0, 2, new CFClient::UI::Label valign => 0, align => 1, text => "Host:Port"); 598 $table->add (0, 2, new CFClient::UI::Label valign => 0, align => 1, text => "Host:Port");
507 599
508 { 600 {
509 $table->add (1, 2, my $vbox = new CFClient::UI::VBox); 601 $table->add (1, 2, my $vbox = new CFClient::UI::VBox);
510 602
511 $vbox->add (my $HOST = new CFClient::UI::Entry expand => 1, text => $CFG->{host}, connect_changed => sub { 603 $vbox->add (
604 my $HOST = new CFClient::UI::Entry
605 expand => 1,
606 text => $CFG->{host},
607 tooltip => "The hostname or ip address of the Crossfire(+) server to connect to",
608 connect_changed => sub {
609 my ($self, $value) = @_;
610 $CFG->{host} = $value;
611 }
612 );
613
614 $METASERVER = metaserver_dialog;
615
616 $vbox->add (new CFClient::UI::Flopper
617 expand => 1,
618 text => "Metaserver",
619 other => $METASERVER,
620 tooltip => "Show a list of avaible crossfire servers",
621 connect_open => sub {
622 update_metaserver $HOST;
623 }
624 );
625 }
626
627 $table->add (0, 4, new CFClient::UI::Label valign => 0, align => 1, text => "Username");
628 $table->add (1, 4, new CFClient::UI::Entry
629 text => $CFG->{user},
630 tooltip => "The name of your character on the server",
631 connect_changed => sub {
512 my ($self, $value) = @_; 632 my ($self, $value) = @_;
513 $CFG->{host} = $value;
514 });
515
516 $METASERVER = metaserver_dialog;
517
518 $vbox->add (new CFClient::UI::Flopper expand => 1, text => "Metaserver", other => $METASERVER, connect_open => sub {
519 update_metaserver $HOST;
520 });
521 }
522
523 $table->add (0, 4, new CFClient::UI::Label valign => 0, align => 1, text => "Username");
524 $table->add (1, 4, new CFClient::UI::Entry text => $CFG->{user}, connect_changed => sub {
525 my ($self, $value) = @_;
526 $CFG->{user} = $value; 633 $CFG->{user} = $value;
634 }
527 }); 635 );
528 636
529 $table->add (0, 5, new CFClient::UI::Label valign => 0, align => 1, text => "Password"); 637 $table->add (0, 5, new CFClient::UI::Label valign => 0, align => 1, text => "Password");
530 $table->add (1, 5, new CFClient::UI::Entry text => $CFG->{password}, hidden => 1, connect_changed => sub { 638 $table->add (1, 5, new CFClient::UI::Entry
639 text => $CFG->{password},
640 hidden => 1,
641 tooltip => "The password for your character",
642 connect_changed => sub {
531 my ($self, $value) = @_; 643 my ($self, $value) = @_;
532 $CFG->{password} = $value; 644 $CFG->{password} = $value;
645 }
533 }); 646 );
534 647
535 $table->add (0, 6, new CFClient::UI::Label valign => 0, align => 1, text => "Def. say cmd"); 648 $table->add (0, 6, new CFClient::UI::Label valign => 0, align => 1, text => "Def. say cmd");
536 $table->add (1, 6, my $saycmd = new CFClient::UI::Entry text => $CFG->{say_command}, connect_changed => sub { 649 $table->add (1, 6, my $saycmd = new CFClient::UI::Entry
650 text => $CFG->{say_command},
651 tooltip => "This is the command that will be used if you write a line in the message window entry. "
652 ."Usually you want to enter something like 'say' or 'shout' or 'gsay' here. "
653 ."But you could also set it to 'tell <playername>' to only chat with that user.",
654 connect_changed => sub {
537 my ($self, $value) = @_; 655 my ($self, $value) = @_;
538 $CFG->{say_command} = $value; 656 $CFG->{say_command} = $value;
657 }
539 }); 658 );
540 659
541 $table->add (0, 7, new CFClient::UI::Label valign => 0, align => 1, text => "Map Size"); 660 $table->add (0, 7, new CFClient::UI::Label valign => 0, align => 1, text => "Map Size");
542 $table->add (1, 7, new CFClient::UI::Slider 661 $table->add (1, 7, new CFClient::UI::Slider
543 req_w => 100, 662 req_w => 100,
544 range => [$CFG->{mapsize}, 10, 100 + 1, 1], 663 range => [$CFG->{mapsize}, 10, 100 + 1, 1],
664 tooltip => "This is the size of the portion of the map update the server sends you. "
665 ."If you set this to a high value you will be able to see further for example.",
545 connect_changed => sub { 666 connect_changed => sub {
546 my ($self, $value) = @_; 667 my ($self, $value) = @_;
547 668
548 $CFG->{mapsize} = $self->{range}[0] = $value = int $value; 669 $CFG->{mapsize} = $self->{range}[0] = $value = int $value;
549 }, 670 },
565 user_h => int $::HEIGHT / 5, 686 user_h => int $::HEIGHT / 5,
566 child => (my $vbox = new CFClient::UI::VBox); 687 child => (my $vbox = new CFClient::UI::VBox);
567 688
568 $vbox->add ($LOGVIEW = new CFClient::UI::TextView 689 $vbox->add ($LOGVIEW = new CFClient::UI::TextView
569 expand => 1, 690 expand => 1,
691 font => $FONT_FIXED,
570 fontsize => $::CFG->{log_fontsize}, 692 fontsize => $::CFG->{log_fontsize},
571 ); 693 );
572 694
573 $vbox->add (my $input = new CFClient::UI::Entry 695 $vbox->add (my $input = new CFClient::UI::Entry
574 connect_focus_in => sub { 696 connect_focus_in => sub {
668 790
669 $BUTTONBAR->add (new CFClient::UI::Flopper text => "Client Setup", other => client_setup); 791 $BUTTONBAR->add (new CFClient::UI::Flopper text => "Client Setup", other => client_setup);
670 $BUTTONBAR->add (new CFClient::UI::Flopper text => "Server Setup", other => server_setup); 792 $BUTTONBAR->add (new CFClient::UI::Flopper text => "Server Setup", other => server_setup);
671 $BUTTONBAR->add (new CFClient::UI::Flopper text => "Message Window", other => message_window); 793 $BUTTONBAR->add (new CFClient::UI::Flopper text => "Message Window", other => message_window);
672 794
795 $CFClient::UI::ROOT->add (make_gauge_window); # XXX: this has to be set before make_stats_window as make_stats_window calls update_stats_window which updated the gauges also X-D
796 $BUTTONBAR->add (new CFClient::UI::Flopper text => "Stats Window", other => make_stats_window);
797
673 $BUTTONBAR->add (new CFClient::UI::Button text => "Save Config", connect_activate => sub { 798 $BUTTONBAR->add (new CFClient::UI::Button text => "Save Config", connect_activate => sub {
674 CFClient::write_cfg "$Crossfire::VARDIR/pclientrc"; 799 CFClient::write_cfg "$Crossfire::VARDIR/pclientrc";
675 status "Configuration Saved"; 800 status "Configuration Saved";
676 }); 801 });
677 802
678 $CFClient::UI::ROOT->add (make_gauge_window); # XXX: this has to be set before make_stats_window as make_stats_window calls update_stats_window which updated the gauges also X-D
679 $BUTTONBAR->add (new CFClient::UI::Flopper text => "Stats Window", other => make_stats_window);
680
681 $BUTTONBAR->{children}[1]->emit ("activate"); # pop up server setup 803 $BUTTONBAR->{children}[1]->emit ("activate"); # pop up server setup
682
683
684} 804}
685 805
686sub video_shutdown { 806sub video_shutdown {
687 $CFClient::UI::ROOT->{children} = []; 807 $CFClient::UI::ROOT->{children} = [];
688 undef $SDL_ACTIVE; 808 undef $SDL_ACTIVE;
1012 1132
1013 $chunk->play; 1133 $chunk->play;
1014# warn "sound $x,$y,$soundnum,$type\n";#d# 1134# warn "sound $x,$y,$soundnum,$type\n";#d#
1015} 1135}
1016 1136
1137my $LAST_QUERY; # server is stupid, stupid, stupid
1138
1017sub conn::query { 1139sub conn::query {
1018 my ($self, $flags, $prompt) = @_; 1140 my ($self, $flags, $prompt) = @_;
1019 1141
1020 #TODO, display dialog with relevant information 1142 $prompt = $LAST_QUERY unless length $prompt;
1021 warn "<<<<QUERY:$flags:$prompt>>>\n";#d# 1143 $LAST_QUERY = $prompt;
1144
1145 my $dialog = new CFClient::UI::FancyFrame
1146 title => "Query",
1147 child => my $vbox = new CFClient::UI::VBox;
1148
1149 $vbox->add (new CFClient::UI::Label
1150 max_w => $::WIDTH * 0.4,
1151 text => $prompt);
1152
1153 if ($flags & Crossfire::Protocol::CS_QUERY_YESNO) {
1154 $vbox->add (my $hbox = new CFClient::HBox);
1155 $hbox->add (new CFClient::Button
1156 text => "No",
1157 connect_activate => sub {
1158 $self->send ("reply n");
1159 $dialog->destroy;
1160 $MAPWIDGET->focus_in;
1161 }
1162 );
1163 $hbox->add (new CFClient::Button
1164 text => "Yes",
1165 connect_activate => sub {
1166 $self->send ("reply y");
1167 $dialog->destroy;
1168 $MAPWIDGET->focus_in;
1169 },
1170 );
1171
1172 $dialog->focus_in;
1173
1174 } elsif ($flags & Crossfire::Protocol::CS_QUERY_SINGLECHAR) {
1175 $dialog->{tooltip} = "Press a key (click on the entry to make sure it has keyboard focus)";
1176 $vbox->add (my $entry = new CFClient::UI::Entry
1177 connect_changed => sub {
1178 $self->send ("reply $_[1]");
1179 $dialog->destroy;
1180 $MAPWIDGET->focus_in;
1181 },
1182 );
1183
1184 $entry->focus_in;
1185
1186 } else {
1187 $dialog->{tooltip} = "Enter the reply and press return (click on the entry to make sure it has keyboard focus)";
1188
1189 $vbox->add (my $entry = new CFClient::UI::Entry
1190 $flags & Crossfire::Protocol::CS_QUERY_HIDEINPUT ? (hiddenchar => "*") : (),
1191 connect_activate => sub {
1192 $self->send ("reply $_[1]");
1193 $dialog->destroy;
1194 $MAPWIDGET->focus_in;
1195 },
1196 );
1197
1198 $entry->focus_in;
1199 }
1200
1201 $dialog->show;
1022} 1202}
1023 1203
1024sub conn::drawinfo { 1204sub conn::drawinfo {
1025 my ($self, $color, $text) = @_; 1205 my ($self, $color, $text) = @_;
1026 1206
1044} 1224}
1045 1225
1046sub conn::spell_add { 1226sub conn::spell_add {
1047 my ($self, $spell) = @_; 1227 my ($self, $spell) = @_;
1048 1228
1229 # TODO
1230 # create a widget dynamically, using spell face (CF::Protocol downloads them)
1049 $MAPWIDGET->add_command ("invoke $spell->{name}", $spell->{message}, sub { 1231 $MAPWIDGET->add_command ("invoke $spell->{name}", $spell->{message});
1050 });
1051 $MAPWIDGET->add_command ("cast $spell->{name}", $spell->{message}, sub { 1232 $MAPWIDGET->add_command ("cast $spell->{name}", $spell->{message});
1052 });
1053} 1233}
1054 1234
1055sub conn::spell_delete { 1235sub conn::spell_delete {
1056 my ($self, $spell) = @_; 1236 my ($self, $spell) = @_;
1057} 1237}
1058 1238
1059sub conn::addme_success { 1239sub conn::addme_success {
1060 my ($self) = @_; 1240 my ($self) = @_;
1061 1241
1062 for my $skill (values %{$self->{skill_info}}) { 1242 for my $skill (values %{$self->{skill_info}}) {
1063 $MAPWIDGET->add_command ("ready_skill $skill", "", sub { 1243 $MAPWIDGET->add_command ("ready_skill $skill", "Ready the skill '$skill'");
1064 }); 1244 $MAPWIDGET->add_command ("use_skill $skill", "Immediately use the skill '$skill'");
1065 $MAPWIDGET->add_command ("use_skill $skill", "", sub {
1066 });
1067 } 1245 }
1246}
1247
1248sub conn::container_add {
1249 my ($self, $id, $items) = @_;
1250
1251 # 0 floor
1252 # $self-<{player}{tag} => player inv
1253 #use PApp::Util; warn PApp::Util::dumpval $self->{container}{$self->{player}{tag}};
1254}
1255
1256sub conn::container_clear {
1257 my ($self, $id) = @_;
1258# use PApp::Util; warn PApp::Util::dumpval $self->{container}{0};
1068} 1259}
1069 1260
1070%SDL_CB = ( 1261%SDL_CB = (
1071 CFClient::SDL_QUIT => sub { 1262 CFClient::SDL_QUIT => sub {
1072 Event::unloop -1; 1263 Event::unloop -1;
1107 sdl_mode => 0, 1298 sdl_mode => 0,
1108 width => 640, 1299 width => 640,
1109 height => 480, 1300 height => 480,
1110 fullscreen => 0, 1301 fullscreen => 0,
1111 fast => 0, 1302 fast => 0,
1303 map_scale => 0.5,
1112 fow_enable => 1, 1304 fow_enable => 1,
1113 fow_intensity => 0.45, 1305 fow_intensity => 0.45,
1114 fow_smooth => 0, 1306 fow_smooth => 0,
1115 gui_fontsize => 1, 1307 gui_fontsize => 1,
1116 log_fontsize => 1, 1308 log_fontsize => 1,
1117 gauge_fontsize => 1, 1309 gauge_fontsize => 1,
1118 gauge_size => 0.35, 1310 gauge_size => 0.35,
1119 gauge_w_size => 0.14,
1120 stat_fontsize => 1, 1311 stat_fontsize => 1,
1121 mapsize => 100, 1312 mapsize => 100,
1122 host => "crossfire.schmorp.de", 1313 host => "crossfire.schmorp.de",
1123 say_command => 'say', 1314 say_command => 'say',
1124 audio_enable => 1, 1315 audio_enable => 1,
1139@SDL_MODES or CFClient::fatal "Unable to find a usable video mode\n(hardware accelerated opengl fullscreen)"; 1330@SDL_MODES or CFClient::fatal "Unable to find a usable video mode\n(hardware accelerated opengl fullscreen)";
1140 1331
1141$CFG->{sdl_mode} = 0 if $CFG->{sdl_mode} > @SDL_MODES; 1332$CFG->{sdl_mode} = 0 if $CFG->{sdl_mode} > @SDL_MODES;
1142 1333
1143{ 1334{
1144 my @fonts = map CFClient::find_rcfile $_, qw(uifont.ttf uifontb.ttf uifonti.ttf uifontbi.ttf); 1335 my @fonts = map CFClient::find_rcfile "fonts/$_", qw(
1336 DejaVuSans.ttf
1337 DejaVuSansMono.ttf
1338 DejaVuSans-Bold.ttf
1339 DejaVuSansMono-Bold.ttf
1340 DejaVuSans-Oblique.ttf
1341 DejaVuSansMono-Oblique.ttf
1342 DejaVuSans-BoldOblique.ttf
1343 DejaVuSansMono-BoldOblique.ttf
1344 );
1145 1345
1146 CFClient::add_font $_ for @fonts; 1346 CFClient::add_font $_ for @fonts;
1147 CFClient::set_font $fonts[0]; 1347
1348 $FONT_PROP = new_from_file CFClient::Font $fonts[0];
1349 $FONT_FIXED = new_from_file CFClient::Font $fonts[1];
1350
1351 $FONT_PROP->make_default;
1148} 1352}
1149 1353
1150video_init; 1354video_init;
1151audio_init; 1355audio_init;
1152 1356

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines