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.154 by elmex, Thu Apr 20 16:29: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;
187 audio_shutdown (); 188 audio_shutdown ();
188 audio_init (); 189 audio_init ();
189 }); 190 });
190 191
191 $dialog 192 $dialog
193}
194
195sub make_stats_window {
196 my $tgw = new CFClient::UI::FancyFrame (x => $WIDTH * 2/3, y => 0, title => "Stats");
197 $tgw->add (my $vb = new CFClient::UI::VBox ());
198 $vb->add ($STATWIDS->{stat} = new CFClient::UI::Label valign => 0, align => -1);
199 $vb->add (my $hb2 = new CFClient::UI::HBox);
200 $hb2->add (my $hg = new CFClient::UI::Gauge (type => 'hp'));
201 $hb2->add (my $mg = new CFClient::UI::Gauge (type => 'mana'));
202 $hb2->add (my $gg = new CFClient::UI::Gauge (type => 'grace'));
203 $hb2->add (my $fg = new CFClient::UI::Gauge (type => 'food'));
204 $GAUGES = { food => $fg, mana => $mg, hp => $hg, grace => $gg };
205 $tgw
206}
207
208sub update_stats_window {
209 my ($stats) = @_;
210
211 $STATWIDS->{stat}->set_text (
212 "Title: $stats->{21}\nExp.: " . ($stats->{11} || $stats->{28})
213 . " Level: $stats->{12}\n"
214 . (sprintf "S%d D%d Co%d I%d W%d P%d Ch%2d, Wc%d Ac%d\n",
215 @$stats{5,8,9,6,7,22,10, 13, 14})
216 . (sprintf "Dam %d Arm %d Speed %.2f/%.2f",
217 @$stats{15,16,17,19})
218 );
192} 219}
193 220
194sub metaserver_dialog { 221sub metaserver_dialog {
195 my $dialog = new CFClient::UI::FancyFrame 222 my $dialog = new CFClient::UI::FancyFrame
196 title => "Metaserver", 223 title => "Metaserver",
445 status "Configuration Saved"; 472 status "Configuration Saved";
446 }); 473 });
447 474
448 $BUTTONBAR->{children}[1]->emit ("activate"); # pop up server setup 475 $BUTTONBAR->{children}[1]->emit ("activate"); # pop up server setup
449 476
450 my $tgw = new CFClient::UI::FancyFrame (x => $WIDTH - 300, y => 0, title => "Stats");
451 $tgw->add (my $hbox = new CFClient::UI::HBox ());
452 477
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); 478 $CFClient::UI::ROOT->add (make_stats_window);
460} 479}
461 480
462sub video_shutdown { 481sub video_shutdown {
463 $CFClient::UI::ROOT->{children} = []; 482 $CFClient::UI::ROOT->{children} = [];
464 undef $SDL_ACTIVE; 483 undef $SDL_ACTIVE;
478} 497}
479 498
480sub audio_init { 499sub audio_init {
481 if ($CFG->{audio_enable}) { 500 if ($CFG->{audio_enable}) {
482 if (open my $fh, "<:utf8", CFClient::find_rcfile "sounds/config") { 501 if (open my $fh, "<:utf8", CFClient::find_rcfile "sounds/config") {
483
484 $SDL_MIXER = !CFClient::Mix_OpenAudio; 502 $SDL_MIXER = !CFClient::Mix_OpenAudio;
485 CFClient::Mix_AllocateChannels 8; 503 CFClient::Mix_AllocateChannels 8;
486 CFClient::MixMusic::volume $CFG->{bgm_volume} * 128; 504 CFClient::MixMusic::volume $CFG->{bgm_volume} * 128;
487 505
488 audio_music_finished; 506 audio_music_finished;
587 #d# warn "DATA $hp $hp_m $sp $sp_m $fo $fo_m $gr $gr_m\n"; 605 #d# warn "DATA $hp $hp_m $sp $sp_m $fo $fo_m $gr $gr_m\n";
588 $GAUGES->{hp} ->set_value ($hp, $hp_m); 606 $GAUGES->{hp} ->set_value ($hp, $hp_m);
589 $GAUGES->{mana} ->set_value ($sp, $sp_m); 607 $GAUGES->{mana} ->set_value ($sp, $sp_m);
590 $GAUGES->{food} ->set_value ($fo, $fo_m); 608 $GAUGES->{food} ->set_value ($fo, $fo_m);
591 $GAUGES->{grace}->set_value ($gr, $gr_m); 609 $GAUGES->{grace}->set_value ($gr, $gr_m);
610
611 update_stats_window ($stats);
592} 612}
593 613
594sub conn::user_send { 614sub conn::user_send {
595 my ($self, $command) = @_; 615 my ($self, $command) = @_;
596 616

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines