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.153 by root, Thu Apr 20 09:13:32 2006 UTC vs.
Revision 1.163 by root, Sun Apr 23 00:57:40 2006 UTC

45our $LOGVIEW; 45our $LOGVIEW;
46our $CONSOLE; 46our $CONSOLE;
47our $METASERVER; 47our $METASERVER;
48 48
49our $GAUGES; 49our $GAUGES;
50our $STATWIDS;
50 51
51our $SDL_ACTIVE; 52our $SDL_ACTIVE;
52our %SDL_CB; 53our %SDL_CB;
53 54
54our $SDL_MIXER; 55our $SDL_MIXER;
116 $CFG->{sdl_mode} = $self->{range}[0] = $value = int $value; 117 $CFG->{sdl_mode} = $self->{range}[0] = $value = int $value;
117 $mode_label->set_text (sprintf "%dx%d", @{$SDL_MODES[$value]}); 118 $mode_label->set_text (sprintf "%dx%d", @{$SDL_MODES[$value]});
118 }); 119 });
119 $mode_slider->emit (changed => $mode_slider->{range}[0]); 120 $mode_slider->emit (changed => $mode_slider->{range}[0]);
120 121
122 my $row = 1;
123
121 $table->add (0, 1, new CFClient::UI::Label valign => 0, align => 1, text => "Fullscreen"); 124 $table->add (0, $row, new CFClient::UI::Label valign => 0, align => 1, text => "Fullscreen");
122 $table->add (1, 1, new CFClient::UI::CheckBox state => $CFG->{fullscreen}, connect_changed => sub { 125 $table->add (1, $row++, new CFClient::UI::CheckBox state => $CFG->{fullscreen}, connect_changed => sub {
123 my ($self, $value) = @_; 126 my ($self, $value) = @_;
124 $CFG->{fullscreen} = $value; 127 $CFG->{fullscreen} = $value;
125 }); 128 });
126 129
127 $table->add (0, 2, new CFClient::UI::Label valign => 0, align => 1, text => "Fast & Ugly"); 130 $table->add (0, $row, new CFClient::UI::Label valign => 0, align => 1, text => "Fast & Ugly");
128 $table->add (1, 2, new CFClient::UI::CheckBox state => $CFG->{fast}, connect_changed => sub { 131 $table->add (1, $row++, new CFClient::UI::CheckBox
132 state => $CFG->{fast},
133 tooltip => "Lower the visual quality considerably to speed up rendering.",
134 connect_changed => sub {
129 my ($self, $value) = @_; 135 my ($self, $value) = @_;
130 $CFG->{fast} = $value; 136 $CFG->{fast} = $value;
137 }
138 );
139
140 $table->add (0, $row, new CFClient::UI::Label valign => 0, align => 1, text => "Fog of War");
141 $table->add (1, $row++, new CFClient::UI::CheckBox
142 state => $CFG->{fow_enable},
143 tooltip => "Fog-of-War marks areas that cannot be seen by the player",
144 connect_changed => sub {
145 my ($self, $value) = @_;
146 $CFG->{fow_enable} = $value;
147 }
148 );
149
150 $table->add (0, $row, new CFClient::UI::Label valign => 0, align => 1, text => "FoW Intensity");
151 $table->add (1, $row++, new CFClient::UI::Slider
152 range => [$CFG->{fow_intensity}, 0, 1 + 0.001, 0.001],
153 tooltip => "The higher the intensity, the lighter the Fog-of-War color",
154 connect_changed => sub {
155 my ($self, $value) = @_;
156 $CFG->{fow_intensity} = $value;
157 }
158 );
159
160 $table->add (0, $row, new CFClient::UI::Label valign => 0, align => 1, text => "FoW Smooth");
161 $table->add (1, $row++, new CFClient::UI::CheckBox
162 state => $CFG->{fow_smooth},
163 tooltip => "Smooth the Fog-of-War a bit to make it more realistic",
164 connect_changed => sub {
165 my ($self, $value) = @_;
166 $CFG->{fow_smooth} = $value;
167 status "Fog of War smoothing requires OpenGL 1.2 or higher" if $CFClient::GL_VERSION < 1.2;
168 }
169 );
170
171 $table->add (0, $row, new CFClient::UI::Label valign => 0, align => 1, text => "GUI Fontsize");
172 $table->add (1, $row++, new CFClient::UI::Slider
173 range => [$CFG->{gui_fontsize}, 0.5, 2, 0.1],
174 tooltip => "The font size used by most GUI elements",
175 connect_changed => sub {
176 $CFG->{gui_fontsize} = 0.1 * int $_[1] * 10;
177# $FONTSIZE = int $HEIGHT / 40 * $CFG->{gui_fontsize};
178 }
179 );
180
181 $table->add (0, $row, new CFClient::UI::Label valign => 0, align => 1, text => "Server Log Fontsize");
182 $table->add (1, $row++, new CFClient::UI::Slider
183 range => [$CFG->{log_fontsize}, 0.5, 2, 0.1],
184 tooltip => "The font size used by the server log window only",
185 connect_changed => sub {
186 $LOGVIEW->set_fontsize ($CFG->{log_fontsize} = 0.1 * int $_[1] * 10);
187 }
188 );
189
190 $table->add (0, $row, new CFClient::UI::Label valign => 0, align => 1, text => "Stats Fontsize");
191
192 $table->add (1, $row++, new CFClient::UI::Slider
193 range => [$CFG->{stat_fontsize}, 0.5, 2, 0.1],
194 tooltip => "The font size used by the statistics window only",
195 connect_changed => sub {
196 $CFG->{stat_fontsize} = 0.1 * int $_[1] * 10;
197 &set_stats_window_fontsize;
198 }
199 );
200
201 $table->add (0, $row, new CFClient::UI::Label valign => 0, align => 1, text => "Gaugesize");
202 $table->add (1, $row++, new CFClient::UI::Slider range => [$CFG->{gauge_size}, 0.2, 0.8, 0.02], connect_changed => sub {
203 $CFG->{gauge_size} = $_[1];
204 my $h = int ($HEIGHT * $CFG->{gauge_size});
205 $GAUGES->{win}->set_size ($WIDTH, $h);
206 $GAUGES->{win}->{y} = $HEIGHT - $h;
207 $GAUGES->{win}->{x} = 0;
208 $GAUGES->{win}->update;
131 }); 209 });
132 210
133 $table->add (0, 3, new CFClient::UI::Label valign => 0, align => 1, text => "Fog of War"); 211 $table->add (0, $row, new CFClient::UI::Label valign => 0, align => 1, text => "Gauge size");
134 $table->add (1, 3, new CFClient::UI::CheckBox state => $CFG->{fow_enable}, connect_changed => sub { 212 $table->add (1, $row++, new CFClient::UI::Slider
135 my ($self, $value) = @_; 213 range => [$CFG->{gauge_size}, 0.2, 0.8, 0.02],
136 $CFG->{fow_enable} = $value; 214 tooltip => "Adjust the size of the stats gauges at the bottom right",
215 connect_changed => sub {
216 $CFG->{gauge_size} = $_[1];
217 my $h = int ($HEIGHT * $CFG->{gauge_size});
218 $GAUGES->{win}->set_size ($WIDTH, $h);
219 $GAUGES->{win}->{y} = $HEIGHT - $h;
220 $GAUGES->{win}->{x} = 0;
221 $GAUGES->{win}->update;
222 }
137 }); 223 );
138 224
139 $table->add (0, 4, new CFClient::UI::Label valign => 0, align => 1, text => "FoW Intensity");
140 $table->add (1, 4, new CFClient::UI::Slider range => [$CFG->{fow_intensity}, 0, 1 + 0.001, 0.001], connect_changed => sub {
141 my ($self, $value) = @_;
142 $CFG->{fow_intensity} = $value;
143 });
144
145 $table->add (0, 5, new CFClient::UI::Label valign => 0, align => 1, text => "FoW Smooth");
146 $table->add (1, 5, new CFClient::UI::CheckBox state => $CFG->{fow_smooth}, connect_changed => sub {
147 my ($self, $value) = @_;
148 $CFG->{fow_smooth} = $value;
149 status "Fog of War smoothing requires OpenGL 1.2 or higher" if $CFClient::GL_VERSION < 1.2;
150 });
151
152 $table->add (0, 6, new CFClient::UI::Label valign => 0, align => 1, text => "GUI Fontsize"); 225 $table->add (0, $row, new CFClient::UI::Label valign => 0, align => 1, text => "Gauge fontsize");
153 $table->add (1, 6, new CFClient::UI::Slider range => [$CFG->{gui_fontsize}, 0.7, 1.7, 0.1], connect_changed => sub { 226 $table->add (1, $row++, new CFClient::UI::Slider
227 range => [$CFG->{gauge_fontsize}, 0.5, 2.0, 0.1],
228 connect_changed => sub {
154 $CFG->{gui_fontsize} = 0.1 * int $_[1] * 10; 229 $CFG->{gauge_fontsize} = 0.1 * int $_[1] * 10;
155# $FONTSIZE = int $HEIGHT / 40 * $CFG->{gui_fontsize}; 230 &set_gauge_window_fontsize;
231 $GAUGES->{win}->check_size;
232 $GAUGES->{win}->update;
233 }
156 }); 234 );
157 235
158 $table->add (0, 7, new CFClient::UI::Label valign => 0, align => 1, text => "Server Log Fontsize"); 236 $table->add (1, $row++, new CFClient::UI::Button
159 $table->add (1, 7, new CFClient::UI::Slider range => [$CFG->{log_fontsize}, 0.7, 1.7, 0.1], connect_changed => sub { 237 expand => 1, align => 0, text => "Apply",
160 $LOGVIEW->set_fontsize ($CFG->{log_fontsize} = 0.1 * int $_[1] * 10); 238 tooltip => "Apply the video settings (unless they are auto-apply)",
161 }); 239 connect_activate => sub {
162
163 $table->add (1, 8, new CFClient::UI::Button expand => 1, align => 0, text => "Apply", connect_activate => sub {
164 video_shutdown (); 240 video_shutdown ();
165 video_init (); 241 video_init ();
242 }
166 }); 243 );
167 244
168 $table->add (0, 9, new CFClient::UI::Label valign => 0, align => 1, text => "Audio Enable"); 245 $table->add (0, $row, new CFClient::UI::Label valign => 0, align => 1, text => "Audio Enable");
169 $table->add (1, 9, new CFClient::UI::CheckBox state => $CFG->{audio_enable}, connect_changed => sub { 246 $table->add (1, $row++, new CFClient::UI::CheckBox
247 state => $CFG->{audio_enable},
248 tooltip => "If enabled, sound effects and music will be played. If disabled, no audio will be used and the soundcard will not be opened.",
249 connect_changed => sub {
170 $CFG->{audio_enable} = $_[1]; 250 $CFG->{audio_enable} = $_[1];
251 }
171 }); 252 );
172# $table->add (0, 9, new CFClient::UI::Label valign => 0, align => 1, text => "Effects Volume"); 253# $table->add (0, 9, new CFClient::UI::Label valign => 0, align => 1, text => "Effects Volume");
173# $table->add (1, 8, new CFClient::UI::Slider range => [$CFG->{effects_volume}, 0, 128, 1], connect_changed => sub { 254# $table->add (1, 8, new CFClient::UI::Slider range => [$CFG->{effects_volume}, 0, 128, 1], connect_changed => sub {
174# $CFG->{effects_volume} = $_[1]; 255# $CFG->{effects_volume} = $_[1];
175# }); 256# });
176 $table->add (0, 10, new CFClient::UI::Label valign => 0, align => 1, text => "Background Music"); 257 $table->add (0, $row, new CFClient::UI::Label valign => 0, align => 1, text => "Background Music");
177 $table->add (1, 10, my $hbox = new CFClient::UI::HBox); 258 $table->add (1, $row++, my $hbox = new CFClient::UI::HBox);
178 $hbox->add (new CFClient::UI::CheckBox expand => 1, state => $CFG->{bgm_enable}, connect_changed => sub { 259 $hbox->add (new CFClient::UI::CheckBox
260 expand => 1, state => $CFG->{bgm_enable},
261 tooltip => "Enable background music playing",
262 connect_changed => sub {
179 $CFG->{bgm_enable} = $_[1]; 263 $CFG->{bgm_enable} = $_[1];
264 }
180 }); 265 );
181 $hbox->add (new CFClient::UI::Slider expand => 1, range => [$CFG->{bgm_volume}, 0, 1, 0.1], connect_changed => sub { 266 $hbox->add (new CFClient::UI::Slider
267 expand => 1, range => [$CFG->{bgm_volume}, 0, 1, 0.1],
268 tooltip => "The volume of the background music",
269 connect_changed => sub {
182 $CFG->{bgm_volume} = $_[1]; 270 $CFG->{bgm_volume} = $_[1];
183 CFClient::MixMusic::volume $_[1] * 128; 271 CFClient::MixMusic::volume $_[1] * 128;
272 }
184 }); 273 );
185 274
186 $table->add (1, 11, new CFClient::UI::Button expand => 1, align => 0, text => "Apply", connect_activate => sub { 275 $table->add (1, $row++, new CFClient::UI::Button
276 expand => 1, align => 0, text => "Apply",
277 tooltip => "Apply the audio settings that are not auto-apply",
278 connect_activate => sub {
187 audio_shutdown (); 279 audio_shutdown ();
188 audio_init (); 280 audio_init ();
281 }
189 }); 282 );
190 283
191 $dialog 284 $dialog
285}
286
287sub set_stats_window_fontsize {
288 for (values %{$STATWIDS}) {
289 $_->set_fontsize ($::CFG->{stat_fontsize});
290 }
291}
292
293sub set_gauge_window_fontsize {
294 for (map { $GAUGES->{$_} } grep { $_ ne 'win' } keys %{$GAUGES}) {
295 $_->set_fontsize ($::CFG->{gauge_fontsize});
296 }
297}
298
299sub make_gauge_window {
300 my $gh = int ($HEIGHT * $CFG->{gauge_size});
301# my $gw = int ($WIDTH * $CFG->{gauge_w_size});
302
303 my $win = new CFClient::UI::Frame (
304 y => $HEIGHT - $gh, x => 0, req_w => $WIDTH, req_h => $gh
305 );
306 $win->add (my $vb = new CFClient::UI::VBox);
307
308 $vb->add (my $hbg = new CFClient::UI::HBox expand => 1);
309
310
311 $hbg->add (new CFClient::UI::Empty expand => 1);
312 $hbg->add (my $hb = new CFClient::UI::HBox);
313 $hb->add (my $hg = new CFClient::UI::Gauge type => 'hp');
314 $hb->add (my $mg = new CFClient::UI::Gauge type => 'mana');
315 $hb->add (my $gg = new CFClient::UI::Gauge type => 'grace');
316 $hb->add (my $fg = new CFClient::UI::Gauge type => 'food');
317
318 $vb->add (my $exp = new CFClient::UI::Label valign => 0, align => 1, text => "XP:");
319# $vb->add (my $lvl = new CFClient::UI::Label valign => 0, align => 1, text => "Lvl:");
320 $vb->add (my $rng = new CFClient::UI::Label valign => 0, align => 1, text => "Rng:");
321
322
323 $GAUGES = {
324 exp => $exp,# lvl => $lvl,
325 win => $win, range => $rng,
326 food => $fg, mana => $mg, hp => $hg, grace => $gg
327 };
328 $win
329}
330
331sub make_stats_window {
332 my $tgw = new CFClient::UI::FancyFrame (x => $WIDTH * 2/5, y => 0, title => "Stats");
333
334 $tgw->add (my $vb = new CFClient::UI::VBox);
335 $vb->add (my $uhb = new CFClient::UI::HBox);
336 $uhb->add ($STATWIDS->{title} = new CFClient::UI::Label valign => 0, align => -1, text => "Title:", expand => 1);
337 $uhb->add ($STATWIDS->{map} = new CFClient::UI::Label valign => 0, align => -1, text => "Map:", expand => 1);
338
339 $vb->add (my $hb = new CFClient::UI::HBox expand => 1);
340
341 $hb->add (my $tbl = new CFClient::UI::Table expand => 1);
342
343 $tbl->add (0, 0, $STATWIDS->{st_str_lbl} = new CFClient::UI::Label valign => 0, align => +1, text => "Str");
344 $tbl->add (0, 1, $STATWIDS->{st_dex_lbl} = new CFClient::UI::Label valign => 0, align => +1, text => "Dex");
345 $tbl->add (0, 2, $STATWIDS->{st_con_lbl} = new CFClient::UI::Label valign => 0, align => +1, text => "Con");
346 $tbl->add (0, 3, $STATWIDS->{st_int_lbl} = new CFClient::UI::Label valign => 0, align => +1, text => "Int");
347 $tbl->add (0, 4, $STATWIDS->{st_wis_lbl} = new CFClient::UI::Label valign => 0, align => +1, text => "Wis");
348 $tbl->add (0, 5, $STATWIDS->{st_pow_lbl} = new CFClient::UI::Label valign => 0, align => +1, text => "Pow");
349 $tbl->add (0, 6, $STATWIDS->{st_cha_lbl} = new CFClient::UI::Label valign => 0, align => +1, text => "Cha");
350
351 $tbl->add (1, 0, $STATWIDS->{st_str} = new CFClient::UI::Label valign => 0, align => +1, text => "");
352 $tbl->add (1, 1, $STATWIDS->{st_dex} = new CFClient::UI::Label valign => 0, align => +1, text => "");
353 $tbl->add (1, 2, $STATWIDS->{st_con} = new CFClient::UI::Label valign => 0, align => +1, text => "");
354 $tbl->add (1, 3, $STATWIDS->{st_int} = new CFClient::UI::Label valign => 0, align => +1, text => "");
355 $tbl->add (1, 4, $STATWIDS->{st_wis} = new CFClient::UI::Label valign => 0, align => +1, text => "");
356 $tbl->add (1, 5, $STATWIDS->{st_pow} = new CFClient::UI::Label valign => 0, align => +1, text => "");
357 $tbl->add (1, 6, $STATWIDS->{st_cha} = new CFClient::UI::Label valign => 0, align => +1, text => "");
358
359 $tbl->add (2, 0, $STATWIDS->{st_wc_lbl} = new CFClient::UI::Label valign => 0, align => +1, text => "Wc");
360 $tbl->add (2, 1, $STATWIDS->{st_ac_lbl} = new CFClient::UI::Label valign => 0, align => +1, text => "Ac");
361 $tbl->add (2, 2, $STATWIDS->{st_dam_lbl} = new CFClient::UI::Label valign => 0, align => +1, text => "Dam");
362 $tbl->add (2, 3, $STATWIDS->{st_arm_lbl} = new CFClient::UI::Label valign => 0, align => +1, text => "Arm");
363 $tbl->add (2, 4, $STATWIDS->{st_spd_lbl} = new CFClient::UI::Label valign => 0, align => +1, text => "Sp");
364 $tbl->add (2, 5, $STATWIDS->{st_wspd_lbl} = new CFClient::UI::Label valign => 0, align => +1, text => "WSp");
365
366 $tbl->add (3, 0, $STATWIDS->{st_wc} = new CFClient::UI::Label valign => 0, align => +1, text => "");
367 $tbl->add (3, 1, $STATWIDS->{st_ac} = new CFClient::UI::Label valign => 0, align => +1, text => "");
368 $tbl->add (3, 2, $STATWIDS->{st_dam} = new CFClient::UI::Label valign => 0, align => +1, text => "");
369 $tbl->add (3, 3, $STATWIDS->{st_arm} = new CFClient::UI::Label valign => 0, align => +1, text => "");
370 $tbl->add (3, 4, $STATWIDS->{st_spd} = new CFClient::UI::Label valign => 0, align => +1, text => "");
371 $tbl->add (3, 5, $STATWIDS->{st_wspd} = new CFClient::UI::Label valign => 0, align => +1, text => "");
372
373 $hb->add (my $tbl2 = new CFClient::UI::Table expand => 1);
374
375 my $row = 0;
376 my $col = 0;
377
378 for (qw/slow holyw conf fire depl magic
379 drain acid pois para deat phys
380 blind fear tund elec cold ghit/)
381 {
382 $tbl2->add ($col , $row,
383 $STATWIDS->{"res_$_"} =
384 new CFClient::UI::Label text => "0", align => +1, valign => 0
385 );
386 $tbl2->add ($col + 1, $row, new CFClient::UI::Image image => "ui/resist/resist_$_.png");
387
388 $row++;
389 if ($row % 6 == 0) {
390 $col += 2;
391 $row = 0;
392 }
393 }
394
395 &set_stats_window_fontsize;
396 update_stats_window ({});
397
398 $tgw
399}
400
401sub update_stats_window {
402 my ($stats) = @_;
403
404 # i love text protocols!!!
405 my $hp = $stats->{1} * 1;
406 my $hp_m = $stats->{2} * 1;
407 my $sp = $stats->{3} * 1;
408 my $sp_m = $stats->{4} * 1;
409 my $fo = $stats->{18} * 1;
410 my $fo_m = 999;
411 my $gr = $stats->{23} * 1;
412 my $gr_m = $stats->{24} * 1;
413
414 $GAUGES->{hp} ->set_value ($hp, $hp_m);
415 $GAUGES->{mana} ->set_value ($sp, $sp_m);
416 $GAUGES->{food} ->set_value ($fo, $fo_m);
417 $GAUGES->{grace} ->set_value ($gr, $gr_m);
418 $GAUGES->{exp} ->set_text ("XP: " . ($stats->{11} || $stats->{28}) * 1
419 ." LVL: " . $stats->{12} * 1);
420 my $rng = $stats->{20};
421 $rng =~ s/^Range: //; # thank you so much dear server
422 $GAUGES->{range} ->set_text ("Rng: " . $rng);
423# $GAUGES->{lvl} ->set_text ("LVL: " . $stats->{12});
424 $STATWIDS->{title} ->set_text ("Title: " . $stats->{21});
425
426 if (0) { # this code can vanish, just wanted to preserver it for a checkin
427 $STATWIDS->{st_str} ->set_text (sprintf "S%d", $stats->{5});
428 $STATWIDS->{st_dex} ->set_text (sprintf "D%d", $stats->{8});
429 $STATWIDS->{st_con} ->set_text (sprintf "Co%d", $stats->{9});
430 $STATWIDS->{st_int} ->set_text (sprintf "I%d", $stats->{6});
431 $STATWIDS->{st_wis} ->set_text (sprintf "W%d", $stats->{7});
432 $STATWIDS->{st_pow} ->set_text (sprintf "P%d", $stats->{22});
433 $STATWIDS->{st_cha} ->set_text (sprintf "Ch%d", $stats->{10});
434 $STATWIDS->{st_wc} ->set_text (sprintf "Wc%d", $stats->{13});
435 $STATWIDS->{st_ac} ->set_text (sprintf "Ac%d", $stats->{14});
436 $STATWIDS->{st_dam} ->set_text (sprintf "Dam%d", $stats->{15});
437 $STATWIDS->{st_arm} ->set_text (sprintf "Arm%d", $stats->{16});
438 $STATWIDS->{st_spd} ->set_text (sprintf "Sp%.1f", $stats->{17});
439 $STATWIDS->{st_wspd}->set_text (sprintf "WSp%.1f", $stats->{19});
440 } else {
441 $STATWIDS->{st_str} ->set_text (sprintf "%d", $stats->{5});
442 $STATWIDS->{st_dex} ->set_text (sprintf "%d", $stats->{8});
443 $STATWIDS->{st_con} ->set_text (sprintf "%d", $stats->{9});
444 $STATWIDS->{st_int} ->set_text (sprintf "%d", $stats->{6});
445 $STATWIDS->{st_wis} ->set_text (sprintf "%d", $stats->{7});
446 $STATWIDS->{st_pow} ->set_text (sprintf "%d", $stats->{22});
447 $STATWIDS->{st_cha} ->set_text (sprintf "%d", $stats->{10});
448 $STATWIDS->{st_wc} ->set_text (sprintf "%d", $stats->{13});
449 $STATWIDS->{st_ac} ->set_text (sprintf "%d", $stats->{14});
450 $STATWIDS->{st_dam} ->set_text (sprintf "%d", $stats->{15});
451 $STATWIDS->{st_arm} ->set_text (sprintf "%d", $stats->{16});
452 $STATWIDS->{st_spd} ->set_text (sprintf "%.1f", $stats->{17});
453 $STATWIDS->{st_wspd}->set_text (sprintf "%.1f", $stats->{19});
454 }
455
456 my %tbl = (
457 phys => 100,
458 magic => 101,
459 fire => 102,
460 elec => 103,
461 cold => 104,
462 conf => 105,
463 acid => 106,
464 drain => 107,
465 ghit => 108,
466 pois => 109,
467 slow => 110,
468 para => 111,
469 tund => 112,
470 fear => 113,
471 deat => 115,
472 holyw => 116,
473 blind => 117
474 );
475
476 for (keys %tbl) {
477 $STATWIDS->{"res_$_"}->set_text (sprintf "%d%", $stats->{$tbl{$_}});
478 }
479
192} 480}
193 481
194sub metaserver_dialog { 482sub metaserver_dialog {
195 my $dialog = new CFClient::UI::FancyFrame 483 my $dialog = new CFClient::UI::FancyFrame
196 title => "Metaserver", 484 title => "Metaserver",
443 $BUTTONBAR->add (new CFClient::UI::Button text => "Save Config", connect_activate => sub { 731 $BUTTONBAR->add (new CFClient::UI::Button text => "Save Config", connect_activate => sub {
444 CFClient::write_cfg "$Crossfire::VARDIR/pclientrc"; 732 CFClient::write_cfg "$Crossfire::VARDIR/pclientrc";
445 status "Configuration Saved"; 733 status "Configuration Saved";
446 }); 734 });
447 735
736 $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
737 $BUTTONBAR->add (new CFClient::UI::Flopper text => "Stats Window", other => make_stats_window);
738
448 $BUTTONBAR->{children}[1]->emit ("activate"); # pop up server setup 739 $BUTTONBAR->{children}[1]->emit ("activate"); # pop up server setup
449 740
450 my $tgw = new CFClient::UI::FancyFrame (x => $WIDTH - 300, y => 0, title => "Stats");
451 $tgw->add (my $hbox = new CFClient::UI::HBox ());
452 741
453 $hbox->add (my $hg = new CFClient::UI::Gauge (type => 'hp'));
454 $hbox->add (my $mg = new CFClient::UI::Gauge (type => 'mana'));
455 $hbox->add (my $gg = new CFClient::UI::Gauge (type => 'grace'));
456 $hbox->add (my $fg = new CFClient::UI::Gauge (type => 'food'));
457
458 $GAUGES = { food => $fg, mana => $mg, hp => $hg, grace => $gg };
459 $CFClient::UI::ROOT->add ($tgw);
460} 742}
461 743
462sub video_shutdown { 744sub video_shutdown {
463 $CFClient::UI::ROOT->{children} = []; 745 $CFClient::UI::ROOT->{children} = [];
464 undef $SDL_ACTIVE; 746 undef $SDL_ACTIVE;
478} 760}
479 761
480sub audio_init { 762sub audio_init {
481 if ($CFG->{audio_enable}) { 763 if ($CFG->{audio_enable}) {
482 if (open my $fh, "<:utf8", CFClient::find_rcfile "sounds/config") { 764 if (open my $fh, "<:utf8", CFClient::find_rcfile "sounds/config") {
483
484 $SDL_MIXER = !CFClient::Mix_OpenAudio; 765 $SDL_MIXER = !CFClient::Mix_OpenAudio;
485 CFClient::Mix_AllocateChannels 8; 766 CFClient::Mix_AllocateChannels 8;
486 CFClient::MixMusic::volume $CFG->{bgm_volume} * 128; 767 CFClient::MixMusic::volume $CFG->{bgm_volume} * 128;
487 768
488 audio_music_finished; 769 audio_music_finished;
571@conn::ISA = Crossfire::Protocol::; 852@conn::ISA = Crossfire::Protocol::;
572 853
573sub conn::stats_update { 854sub conn::stats_update {
574 my ($self, $stats) = @_; 855 my ($self, $stats) = @_;
575 856
576 # i love text protocols!!! 857 update_stats_window ($stats);
577 # FIXME: the stats are somehow weird
578 my $hp = $stats->{1};
579 my $hp_m = $stats->{2};
580 my $sp = $stats->{3};
581 my $sp_m = $stats->{4};
582 my $fo = $stats->{18};
583 my $fo_m = 999;
584 my $gr = $stats->{23};
585 my $gr_m = $stats->{24};
586
587 #d# warn "DATA $hp $hp_m $sp $sp_m $fo $fo_m $gr $gr_m\n";
588 $GAUGES->{hp} ->set_value ($hp, $hp_m);
589 $GAUGES->{mana} ->set_value ($sp, $sp_m);
590 $GAUGES->{food} ->set_value ($fo, $fo_m);
591 $GAUGES->{grace}->set_value ($gr, $gr_m);
592} 858}
593 859
594sub conn::user_send { 860sub conn::user_send {
595 my ($self, $command) = @_; 861 my ($self, $command) = @_;
596 862
726 992
727 $x += $ox; 993 $x += $ox;
728 $y += $oy; 994 $y += $oy;
729 995
730 $self->{map_info} = [$hash, $x, $y, $w, $h]; 996 $self->{map_info} = [$hash, $x, $y, $w, $h];
997
998 my $map = $self->{map_info}[0];
999 $map =~ s/^.*?\/([^\/]+)$/\1/;
1000 $STATWIDS->{map}->set_text ("Map: " . $map);
731 1001
732 $self->load_map ($hash, $x, $y); 1002 $self->load_map ($hash, $x, $y);
733} 1003}
734 1004
735sub conn::face_find { 1005sub conn::face_find {
899 fast => 0, 1169 fast => 0,
900 fow_enable => 1, 1170 fow_enable => 1,
901 fow_intensity => 0.45, 1171 fow_intensity => 0.45,
902 fow_smooth => 0, 1172 fow_smooth => 0,
903 gui_fontsize => 1, 1173 gui_fontsize => 1,
904 log_fontsize => 14, 1174 log_fontsize => 1,
1175 gauge_fontsize => 1,
1176 gauge_size => 0.35,
1177 stat_fontsize => 1,
905 mapsize => 100, 1178 mapsize => 100,
906 host => "crossfire.schmorp.de", 1179 host => "crossfire.schmorp.de",
907 say_command => 'say', 1180 say_command => 'say',
908 audio_enable => 1, 1181 audio_enable => 1,
909 bgm_enable => 1, 1182 bgm_enable => 1,

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines