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.189 by root, Tue Apr 25 13:51:48 2006 UTC vs.
Revision 1.204 by root, Mon May 8 21:16:10 2006 UTC

76our $MAPWIDGET; 76our $MAPWIDGET;
77our $BUTTONBAR; 77our $BUTTONBAR;
78our $LOGVIEW; 78our $LOGVIEW;
79our $CONSOLE; 79our $CONSOLE;
80our $METASERVER; 80our $METASERVER;
81our $LOGIN_BUTTON;
81 82
82our $FLOORBOX; 83our $FLOORBOX;
83our $GAUGES; 84our $GAUGES;
84our $STATWIDS; 85our $STATWIDS;
85 86
92 93
93our $ALT_ENTER_MESSAGE; 94our $ALT_ENTER_MESSAGE;
94our $STATUS_LINE; 95our $STATUS_LINE;
95our $DEBUG_STATUS; 96our $DEBUG_STATUS;
96 97
98our $INVWIN;
99our $INV;
100
97sub status { 101sub status {
98 $STATUS_LINE->set_text ($_[0]); 102 $STATUS_LINE->set_text ($_[0]);
99 $STATUS_LINE->move (0, $HEIGHT - $ALT_ENTER_MESSAGE->{h} - $STATUS_LINE->{h}); 103 $STATUS_LINE->move (0, $HEIGHT - $ALT_ENTER_MESSAGE->{h} - $STATUS_LINE->{h});
100} 104}
101 105
108 status "logging in..."; 112 status "logging in...";
109 113
110 my $mapsize = List::Util::min 32, List::Util::max 11, int $WIDTH * $CFG->{mapsize} * 0.01 / 32; 114 my $mapsize = List::Util::min 32, List::Util::max 11, int $WIDTH * $CFG->{mapsize} * 0.01 / 32;
111 115
112 $MAPCACHE = CFClient::db_table "mapcache_$CFG->{host}"; 116 $MAPCACHE = CFClient::db_table "mapcache_$CFG->{host}";
113
114 $MAP = new CFClient::Map $mapsize, $mapsize; 117 $MAP = new CFClient::Map $mapsize, $mapsize;
115 118
116 my ($host, $port) = split /:/, $CFG->{host}; 119 my ($host, $port) = split /:/, $CFG->{host};
117 120
118 $CONN = new conn 121 $CONN = eval {
122 new conn
119 host => $host, 123 host => $host,
120 port => $port || 13327, 124 port => $port || 13327,
121 user => $CFG->{user}, 125 user => $CFG->{user},
122 pass => $CFG->{password}, 126 pass => $CFG->{password},
123 mapw => $mapsize, 127 mapw => $mapsize,
124 maph => $mapsize, 128 maph => $mapsize,
129 ;
125 ; 130 };
126 131
132 if ($CONN) {
133 $LOGIN_BUTTON->set_text ("Logout");
134
127 status "login successful"; 135 status "login successful";
128 136
129 CFClient::lowdelay fileno $CONN->{fh}; 137 CFClient::lowdelay fileno $CONN->{fh};
138 } else {
139 status "unable to connect";
140 stop_game();
141 }
130} 142}
131 143
132sub stop_game { 144sub stop_game {
145 return unless $CONN;
146
147 status "connection closed";
148 $LOGIN_BUTTON->set_text ("Login");
149 $CONN->destroy;
150 $CONN = 0; # false, does not autovivify
151
152 undef $MAPCACHE;
133 undef $CONN; 153 undef $MAP;
134} 154}
135 155
136sub client_setup { 156sub client_setup {
137 my $dialog = new CFClient::UI::FancyFrame 157 my $dialog = new CFClient::UI::FancyFrame
138 title => "Client Setup", 158 title => "Client Setup",
434 454
435 my $row = 0; 455 my $row = 0;
436 my $col = 0; 456 my $col = 0;
437 457
438 my %resist_names = ( 458 my %resist_names = (
439 slow => "Slow", 459 slow => "Slow (slows you down when you are hit by the spell. Monsters will have an opportunity to come near you faster and hit you more often.)",
440 holyw => "Holy Word", 460 holyw => "Holy Word (resistance you against getting the fear when someone whose god doesn't like you spells the holy word on you.)",
441 conf => "Confusion", 461 conf => "Confusion (If you are hit by confusion you will move into random directions, and likely into monsters.)",
442 fire => "Fire", 462 fire => "Fire (just your resistance to fire spells like burning hands, dragonbreath, meteor swarm fire, ...)",
443 depl => "Depletion (some monsters and other effects can cause stats depletion)", 463 depl => "Depletion (some monsters and other effects can cause stats depletion)",
444 magic => "Magic", 464 magic => "Magic (resistance to magic spells like magic missile or similar)",
445 drain => "Draining (some monsters (e.g. vampires) and other effects can steal experience)", 465 drain => "Draining (some monsters (e.g. vampires) and other effects can steal experience)",
446 acid => "Acid", 466 acid => "Acid (resistance to acid, acid hurts pretty much and also corrodes your weapons)",
447 pois => "Poison", 467 pois => "Poison (resistance to getting poisoned)",
448 para => "Paralysation", 468 para => "Paralysation (this resistance affects the chance you get paralysed)",
449 deat => "Death (resistance against death spells)", 469 deat => "Death (resistance against death spells)",
450 phys => "Physical", 470 phys => "Physical (this is the resistance against physical attacks, like when a monster hit you in melee combat)",
451 blind => "Blind", 471 blind => "Blind (blind resistance affects the chance of a successful blinding attack)",
452 fear => "Fear", 472 fear => "Fear (this attack will drive you away from monsters who cast this and hit you successfully, being resistant to this helps a lot when fighting those monsters)",
453 tund => "Turn undead", 473 tund => "Turn undead",
454 elec => "Electricity", 474 elec => "Electricity (resistance againt electricity, spells like large lightning, small lightning, ...)",
455 cold => "Cold", 475 cold => "Cold (this is your resistance against cold spells like icestorm, snowstorm, ...)",
456 ghit => "Ghost hit (special attack used by ghosts and ghost-like beings)", 476 ghit => "Ghost hit (special attack used by ghosts and ghost-like beings)",
457 ); 477 );
458 for (qw/slow holyw conf fire depl magic 478 for (qw/slow holyw conf fire depl magic
459 drain acid pois para deat phys 479 drain acid pois para deat phys
460 blind fear tund elec cold ghit/) 480 blind fear tund elec cold ghit/)
562 582
563} 583}
564 584
565sub metaserver_dialog { 585sub metaserver_dialog {
566 my $dialog = new CFClient::UI::FancyFrame 586 my $dialog = new CFClient::UI::FancyFrame
567 title => "Metaserver", 587 title => "Server List",
568 child => (my $vbox = new CFClient::UI::VBox); 588 child => (my $vbox = new CFClient::UI::VBox);
569 589
570 $vbox->add ($dialog->{table} = new CFClient::UI::Table); 590 $vbox->add ($dialog->{table} = new CFClient::UI::Table);
571 591
572 $dialog 592 $dialog
674 694
675 $METASERVER = metaserver_dialog; 695 $METASERVER = metaserver_dialog;
676 696
677 $vbox->add (new CFClient::UI::Flopper 697 $vbox->add (new CFClient::UI::Flopper
678 expand => 1, 698 expand => 1,
679 text => "Metaserver", 699 text => "Server List",
680 other => $METASERVER, 700 other => $METASERVER,
681 tooltip => "Show a list of avaible crossfire servers", 701 tooltip => "Show a list of available crossfire servers",
682 connect_open => sub { 702 connect_open => sub {
683 update_metaserver $HOST; 703 update_metaserver $HOST;
684 } 704 }
685 ); 705 );
686 } 706 }
717 737
718 $CFG->{mapsize} = $self->{range}[0] = $value = int $value; 738 $CFG->{mapsize} = $self->{range}[0] = $value = int $value;
719 }, 739 },
720 ); 740 );
721 741
722 $table->add (1, 8, new CFClient::UI::Button expand => 1, align => 0, text => "Login", connect_activate => sub { 742 $table->add (1, 8, $LOGIN_BUTTON = new CFClient::UI::Button
743 expand => 1,
744 align => 0,
745 text => "Login",
746 connect_activate => sub {
747 $CONN ? stop_game
723 start_game; 748 : start_game;
749 },
724 }); 750 );
725 751
726 $dialog 752 $dialog
727} 753}
728 754
729sub message_window { 755sub message_window {
778 }; 804 };
779 805
780 $window 806 $window
781} 807}
782 808
809sub make_inventory_window {
810 my $invwin = new CFClient::UI::FancyFrame user_w => 300, user_h => 300, title => "Inventory";
811 $invwin->add ($INV = new CFClient::UI::Inventory expand => 1);
812 $invwin
813}
814
783sub sdl_init { 815sub sdl_init {
784 CFClient::SDL_Init 816 CFClient::SDL_Init
785 and die "SDL::Init failed!\n"; 817 and die "SDL::Init failed!\n";
786} 818}
787 819
788sub video_init { 820sub video_init {
789 sdl_init; 821 sdl_init;
790 822
823 $CFG->{sdl_mode} = 0 if $CFG->{sdl_mode} >= @SDL_MODES;
824
791 ($WIDTH, $HEIGHT) = @{ $SDL_MODES[$CFG->{sdl_mode}] }; 825 ($WIDTH, $HEIGHT) = @{ $SDL_MODES[$CFG->{sdl_mode}] };
792 $FULLSCREEN = $CFG->{fullscreen}; 826 $FULLSCREEN = $CFG->{fullscreen};
793 $FAST = $CFG->{fast}; 827 $FAST = $CFG->{fast};
794 828
795 CFClient::SDL_SetVideoMode $WIDTH, $HEIGHT, $FULLSCREEN 829 CFClient::SDL_SetVideoMode $WIDTH, $HEIGHT, $FULLSCREEN
796 or die "SDL_SetVideoMode failed!\n"; 830 or die "SDL_SetVideoMode failed!\n";
797 831
798 $SDL_ACTIVE = 1; 832 $SDL_ACTIVE = 1;
799
800 $LAST_REFRESH = time - 0.01; 833 $LAST_REFRESH = time - 0.01;
801 834
802 CFClient::gl_init; 835 CFClient::gl_init;
803 836
804 $FONTSIZE = int $HEIGHT / 40 * $CFG->{gui_fontsize}; 837 $FONTSIZE = int $HEIGHT / 40 * $CFG->{gui_fontsize};
805 838
839 $CFClient::UI::ROOT->configure (0, 0, $WIDTH, $HEIGHT);#d#
840
806 ############################################################################# 841 #############################################################################
807 842
843 if ($DEBUG_STATUS) {
844 # reconfigure all widgets
845 $CFClient::UI::ROOT->reconfigure;
846
847 } else {
848 # create the widgets
849
808 $DEBUG_STATUS = new CFClient::UI::Label padding => 0, z => 100; 850 $DEBUG_STATUS = new CFClient::UI::Label padding => 0, z => 100;
809 $DEBUG_STATUS->show; 851 $DEBUG_STATUS->show;
810 852
811 $STATUS_LINE = new CFClient::UI::Label 853 $STATUS_LINE = new CFClient::UI::Label
812 padding => 0, 854 padding => 0,
813 y => $HEIGHT - $FONTSIZE * 1.8; 855 y => $HEIGHT - $FONTSIZE * 1.8;
814 $STATUS_LINE->show; 856 $STATUS_LINE->show;
815 857
816 $ALT_ENTER_MESSAGE = new CFClient::UI::Label 858 $ALT_ENTER_MESSAGE = new CFClient::UI::Label
817 padding => 0, 859 padding => 0,
818 fontsize => 0.8, 860 fontsize => 0.8,
819 markup => "Use <b>Alt-Enter</b> to toggle fullscreen mode"; 861 markup => "Use <b>Alt-Enter</b> to toggle fullscreen mode";
820 $ALT_ENTER_MESSAGE->show; 862 $ALT_ENTER_MESSAGE->show;
821 $ALT_ENTER_MESSAGE->move (0, $HEIGHT - $ALT_ENTER_MESSAGE->{h}); 863 $ALT_ENTER_MESSAGE->move (0, $HEIGHT - $ALT_ENTER_MESSAGE->{h});
822 864
823 CFClient::UI::FancyFrame->new ( 865 CFClient::UI::FancyFrame->new (
824 border_bg => [1, 1, 1, 192/255], 866 border_bg => [1, 1, 1, 192/255],
825 bg => [1, 1, 1, 0], 867 bg => [1, 1, 1, 0],
826 child => ($MAPMAP = new CFClient::MapWidget::MapMap), 868 child => ($MAPMAP = new CFClient::MapWidget::MapMap),
827 )->show; 869 )->show;
828 870
829 $MAPWIDGET = new CFClient::MapWidget; 871 $MAPWIDGET = new CFClient::MapWidget;
830 $MAPWIDGET->connect (activate_console => sub { 872 $MAPWIDGET->connect (activate_console => sub {
831 my ($mapwidget, $preset) = @_; 873 my ($mapwidget, $preset) = @_;
832 874
833 if ($CONSOLE) { 875 if ($CONSOLE) {
834 $CONSOLE->{input}->{auto_activated} = 1; 876 $CONSOLE->{input}->{auto_activated} = 1;
835 $CONSOLE->{input}->focus_in; 877 $CONSOLE->{input}->focus_in;
836 878
837 if ($preset && $CONSOLE->{input}->get_text eq '') { 879 if ($preset && $CONSOLE->{input}->get_text eq '') {
838 $CONSOLE->{input}->set_text ($preset); 880 $CONSOLE->{input}->set_text ($preset);
881 }
839 } 882 }
840 } 883 });
841 });
842 $MAPWIDGET->show; 884 $MAPWIDGET->show;
843 $MAPWIDGET->focus_in; 885 $MAPWIDGET->focus_in;
844 886
845 $BUTTONBAR = new CFClient::UI::HBox; 887 $BUTTONBAR = new CFClient::UI::HBox;
846 888
847 $BUTTONBAR->add (new CFClient::UI::Flopper text => "Client Setup", other => client_setup); 889 $BUTTONBAR->add (new CFClient::UI::Flopper text => "Client Setup", other => client_setup);
848 $BUTTONBAR->add (new CFClient::UI::Flopper text => "Server Setup", other => server_setup); 890 $BUTTONBAR->add (new CFClient::UI::Flopper text => "Server Setup", other => server_setup);
849 $BUTTONBAR->add (new CFClient::UI::Flopper text => "Message Window", other => message_window); 891 $BUTTONBAR->add (new CFClient::UI::Flopper text => "Message Window", other => message_window);
850 892
851 $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 893 make_gauge_window->show; # 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
894
852 $BUTTONBAR->add (new CFClient::UI::Flopper text => "Stats Window", other => make_stats_window); 895 $BUTTONBAR->add (new CFClient::UI::Flopper text => "Stats Window", other => make_stats_window);
896 $BUTTONBAR->add (new CFClient::UI::Flopper text => "Inventory", other => make_inventory_window);
853 897
854 $BUTTONBAR->add (new CFClient::UI::Button text => "Save Config", connect_activate => sub { 898 $BUTTONBAR->add (new CFClient::UI::Button text => "Save Config", connect_activate => sub {
855 CFClient::write_cfg "$Crossfire::VARDIR/pclientrc"; 899 CFClient::write_cfg "$Crossfire::VARDIR/pclientrc";
856 status "Configuration Saved"; 900 status "Configuration Saved";
857 }); 901 });
858 902
859 $BUTTONBAR->show; 903 $BUTTONBAR->show;
860 904
861 $BUTTONBAR->{children}[1]->emit ("activate"); # pop up server setup 905 $BUTTONBAR->{children}[1]->emit ("activate"); # pop up server setup
906 }
862} 907}
863 908
864sub video_shutdown { 909sub video_shutdown {
865 $CFClient::UI::ROOT->{children} = [];
866 undef $CFClient::UI::GRAB;
867 undef $CFClient::UI::HOVER;
868 undef $SDL_ACTIVE; 910 undef $SDL_ACTIVE;
869} 911}
870 912
871my @bgmusic = qw(game1.ogg game2.ogg game3.ogg game5.ogg game6.ogg ross1.ogg ross2.ogg ross3.ogg ross4.ogg ross5.ogg); #d# 913my @bgmusic = qw(game1.ogg game2.ogg game3.ogg game5.ogg game6.ogg ross1.ogg ross2.ogg ross3.ogg ross4.ogg ross5.ogg); #d#
872my $bgmusic;#TODO#hack#d# 914my $bgmusic;#TODO#hack#d#
915
916sub audio_channel_finished {
917 my ($channel) = @_;
918
919 warn "channel $channel finished\n";#d#
920}
873 921
874sub audio_music_finished { 922sub audio_music_finished {
875 return unless $CFG->{bgm_enable}; 923 return unless $CFG->{bgm_enable};
876 924
877 # TODO: hack, do play loop and mood music 925 # TODO: hack, do play loop and mood music
881 push @bgmusic, shift @bgmusic; 929 push @bgmusic, shift @bgmusic;
882} 930}
883 931
884sub audio_init { 932sub audio_init {
885 if ($CFG->{audio_enable}) { 933 if ($CFG->{audio_enable}) {
886 if (open my $fh, "<:utf8", CFClient::find_rcfile "sounds/config") { 934 if (open my $fh, "<", CFClient::find_rcfile "sounds/config") {
887 $SDL_MIXER = !CFClient::Mix_OpenAudio; 935 $SDL_MIXER = !CFClient::Mix_OpenAudio;
888 CFClient::Mix_AllocateChannels 8; 936 CFClient::Mix_AllocateChannels 8;
889 CFClient::MixMusic::volume $CFG->{bgm_volume} * 128; 937 CFClient::MixMusic::volume $CFG->{bgm_volume} * 128;
890 938
891 audio_music_finished; 939 audio_music_finished;
1302 1350
1303 for my $skill (values %{$self->{skill_info}}) { 1351 for my $skill (values %{$self->{skill_info}}) {
1304 $MAPWIDGET->add_command ("ready_skill $skill", "Ready the skill '$skill'"); 1352 $MAPWIDGET->add_command ("ready_skill $skill", "Ready the skill '$skill'");
1305 $MAPWIDGET->add_command ("use_skill $skill", "Immediately use the skill '$skill'"); 1353 $MAPWIDGET->add_command ("use_skill $skill", "Immediately use the skill '$skill'");
1306 } 1354 }
1355
1356 $MAPWIDGET->add_command ("pet\\_mode defend", "Tell pets to stay close to you and defend you");
1357 $MAPWIDGET->add_command ("pet\\_mode arena", "Same as petmode attack, but also attack other players");
1358 $MAPWIDGET->add_command ("pet\\_mode sad", "Search &amp; Destroy - tell pets to roam about and attack enemies");
1359 $MAPWIDGET->add_command ("kill\\_pets", "kill your pets");
1360}
1361
1362sub conn::eof {
1363 stop_game;
1307} 1364}
1308 1365
1309sub update_floorbox { 1366sub update_floorbox {
1310 $CFClient::UI::ROOT->on_refresh ($FLOORBOX => sub { 1367 $CFClient::UI::ROOT->on_refresh ($FLOORBOX => sub {
1368 return unless $CONN;
1369
1311 $FLOORBOX->clear; 1370 $FLOORBOX->clear;
1312 $FLOORBOX->add (new CFClient::UI::Empty expand => 1); 1371 $FLOORBOX->add (new CFClient::UI::Empty expand => 1);
1313 1372
1314 my @items = values %{ $CONN->{container}{0} };
1315
1316 # we basically have to use the same sorting as everybody else 1373 # we basically have to use the same sorting as everybody else
1317 @items = sort { $a->{type} <=> $b->{type} } @items; 1374 $FLOORBOX->add (
1318 1375 map +(new CFClient::UI::InventoryItem item => $_),
1319 for my $item (reverse @items) { 1376 @{ $CONN->{container}{0} }
1320 my $desc = $item->{nrof} < 2
1321 ? $item->{name}
1322 : "$item->{nrof} $item->{name_pl}";
1323 # todo: animation widget, face widget, weight(?) etc.
1324 $FLOORBOX->add (my $hbox = new CFClient::UI::HBox
1325 tooltip => (CFClient::UI::Label->escape ($desc)
1326 . "\n<small>leftclick - pick up\nmiddle click - apply\nrightclick - menu</small>"),
1327 can_hover => 1,
1328 can_events => 1,
1329 connect_button_down => sub {
1330 my ($self, $ev, $x, $y) = @_;
1331
1332 # todo: maybe put examine on 1? but should just be a tooltip :(
1333 if ($ev->{button} == 1) {
1334 $CONN->send ("move $CONN->{player}{tag} $item->{tag} 0");
1335 } elsif ($ev->{button} == 2) {
1336 $CONN->send ("apply $item->{tag}");
1337 } elsif ($ev->{button} == 3) {
1338 CFClient::UI::Menu->new (
1339 items => [
1340 ["examine", sub { $CONN->send ("examine $item->{tag}") }],
1341 [
1342 $item->{flags} & Crossfire::Protocol::F_LOCKED ? "lock" : "unlock",
1343 sub { $CONN->send ("lock $item->{tag}") },
1344 ],
1345 ["mark", sub { $CONN->send ("mark $item->{tag}") }],
1346 ["apply", sub { $CONN->send ("apply $item->{tag}") }],
1347 ],
1348 )->popup ($ev);
1349 }
1350
1351 1
1352 },
1353 ); 1377 );
1354
1355 $hbox->add (new CFClient::UI::Face
1356 can_events => 0,
1357 face => $item->{face},
1358 anim => $item->{anim},
1359 animspeed => $item->{animspeed},
1360 );
1361
1362 $hbox->add (new CFClient::UI::Label
1363 can_events => 0,
1364 text => $desc,
1365 );
1366 }
1367 }); 1378 });
1368 refresh; 1379 refresh;
1369} 1380}
1370 1381
1371sub conn::container_add { 1382sub conn::container_add {
1372 my ($self, $id, $items) = @_; 1383 my ($self, $tag, $items) = @_;
1373 1384
1374 update_floorbox if $id == 0; 1385 update_floorbox if $tag == 0;
1386
1387 $INV->set_items ($self->{container}{$self->{player}{tag}})
1388 if $tag == $self->{player}{tag};
1389
1375 # $self-<{player}{tag} => player inv 1390 # $self-<{player}{tag} => player inv
1376 #use PApp::Util; warn PApp::Util::dumpval $self->{container}{$self->{player}{tag}}; 1391 #use PApp::Util; warn PApp::Util::dumpval $self->{container}{$self->{player}{tag}};
1377} 1392}
1378 1393
1379sub conn::container_clear { 1394sub conn::container_clear {
1380 my ($self, $id) = @_; 1395 my ($self, $tag) = @_;
1381 1396
1382 update_floorbox if $id == 0; 1397 update_floorbox if $tag == 0;
1398
1399 $INV->set_items ($self->{container}{$tag})
1400 if $tag == $self->{player}{tag};
1401
1383# use PApp::Util; warn PApp::Util::dumpval $self->{container}{0}; 1402# use PApp::Util; warn PApp::Util::dumpval $self->{container}{0};
1384} 1403}
1385 1404
1386sub conn::item_delete { 1405sub conn::item_delete {
1387 my ($self, @items) = @_; 1406 my ($self, @items) = @_;
1388 1407
1389 for (@items) { 1408 for (@items) {
1390 update_floorbox if $_->{container} == 0; 1409 update_floorbox if $_->{container} == 0;
1410
1411 $INV->set_items ($self->{container}{$_->{container}})
1412 if $_->{container} == $self->{player}{tag};
1391 } 1413 }
1392} 1414}
1393 1415
1394sub conn::item_update { 1416sub conn::item_update {
1395 my ($self, $item) = @_; 1417 my ($self, $item) = @_;
1396 1418
1397 update_floorbox if $item->{container} == 0; 1419 update_floorbox if $item->{container} == 0;
1420
1421 $INV->set_items ($self->{container}{$item->{container}})
1422 if $item->{container} == $self->{player}{tag};
1398} 1423}
1399 1424
1400%SDL_CB = ( 1425%SDL_CB = (
1401 CFClient::SDL_QUIT => sub { 1426 CFClient::SDL_QUIT => sub {
1402 Event::unloop -1; 1427 Event::unloop -1;
1415 video_init; 1440 video_init;
1416 } else { 1441 } else {
1417 CFClient::UI::feed_sdl_key_down_event ($_[0]); 1442 CFClient::UI::feed_sdl_key_down_event ($_[0]);
1418 } 1443 }
1419 }, 1444 },
1420 CFClient::SDL_KEYUP => \&CFClient::UI::feed_sdl_key_up_event, 1445 CFClient::SDL_KEYUP => \&CFClient::UI::feed_sdl_key_up_event,
1421 CFClient::SDL_MOUSEMOTION => \&CFClient::UI::feed_sdl_motion_event, 1446 CFClient::SDL_MOUSEMOTION => \&CFClient::UI::feed_sdl_motion_event,
1422 CFClient::SDL_MOUSEBUTTONDOWN => \&CFClient::UI::feed_sdl_button_down_event, 1447 CFClient::SDL_MOUSEBUTTONDOWN => \&CFClient::UI::feed_sdl_button_down_event,
1423 CFClient::SDL_MOUSEBUTTONUP => \&CFClient::UI::feed_sdl_button_up_event, 1448 CFClient::SDL_MOUSEBUTTONUP => \&CFClient::UI::feed_sdl_button_up_event,
1424 CFClient::SDL_USEREVENT => \&audio_music_finished, 1449 CFClient::SDL_USEREVENT => sub {
1450 if ($_[0]{code} == 1) {
1451 audio_channel_finished $_[0]{data1};
1452 } elsif ($_[0]{code} == 0) {
1453 audio_music_finished;
1454 }
1455 },
1425); 1456);
1426 1457
1427############################################################################# 1458#############################################################################
1428 1459
1429$SIG{INT} = $SIG{TERM} = sub { exit }; 1460$SIG{INT} = $SIG{TERM} = sub { exit };
1461
1462CFClient::read_cfg "$Crossfire::VARDIR/pclientrc";
1430 1463
1431$TILECACHE = CFClient::db_table "tilecache"; 1464$TILECACHE = CFClient::db_table "tilecache";
1432$FACEMAP = CFClient::db_table "facemap"; 1465$FACEMAP = CFClient::db_table "facemap";
1433
1434CFClient::read_cfg "$Crossfire::VARDIR/pclientrc";
1435 1466
1436my %DEF_CFG = ( 1467my %DEF_CFG = (
1437 sdl_mode => 0, 1468 sdl_mode => 0,
1438 width => 640, 1469 width => 640,
1439 height => 480, 1470 height => 480,

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines