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

Comparing deliantra/Deliantra-Client/bin/cfplus (file contents):
Revision 1.120 by root, Sun Oct 1 14:48:51 2006 UTC vs.
Revision 1.134 by elmex, Mon Dec 4 15:17:14 2006 UTC

1#!/opt/bin/perl 1#!/opt/bin/perl
2
3my $startup_done = sub { };
4
5# do splash-screen thingy on win32
6BEGIN {
7 if (%PAR::LibCache && $^O eq "MSWin32") {
8 while (my ($filename, $zip) = each %PAR::LibCache) {
9 $zip->extractMember ("SPLASH.bmp", "$ENV{PAR_TEMP}/SPLASH.bmp");
10 }
11
12 require Win32::GUI::SplashScreen;
13
14 Win32::GUI::SplashScreen::Show (
15 -file => "$ENV{PAR_TEMP}/SPLASH.bmp",
16 );
17
18 $startup_done = sub {
19 Win32::GUI::SplashScreen::Done (1);
20 };
21 }
22}
2 23
3use strict; 24use strict;
4use utf8; 25use utf8;
26
27use Carp 'verbose';
5 28
6# do things only needed for single-binary version (par) 29# do things only needed for single-binary version (par)
7BEGIN { 30BEGIN {
8 if (%PAR::LibCache) { 31 if (%PAR::LibCache) {
9 @INC = grep ref, @INC; # weed out all paths except pars loader refs 32 @INC = grep ref, @INC; # weed out all paths except pars loader refs
10 33
11 while (my ($filename, $zip) = each %PAR::LibCache) { 34 while (my ($filename, $zip) = each %PAR::LibCache) {
12 for ($zip->memberNames) { 35 for ($zip->memberNames) {
13 next unless /^\/root\/(.*)/; 36 next unless /^root\/(.*)/;
14 $zip->extractMember ($_, "$ENV{PAR_TEMP}/$1") 37 $zip->extractMember ($_, "$ENV{PAR_TEMP}/$1")
15 unless -e "$ENV{PAR_TEMP}/$1"; 38 unless -e "$ENV{PAR_TEMP}/$1";
16 } 39 }
17 } 40 }
18 41
45$SIG{QUIT} = sub { Carp::cluck "QUIT" }; 68$SIG{QUIT} = sub { Carp::cluck "QUIT" };
46$SIG{PIPE} = 'IGNORE'; 69$SIG{PIPE} = 'IGNORE';
47 70
48$Event::Eval = 0; 71$Event::Eval = 0;
49$Event::DIED = sub { 72$Event::DIED = sub {
50 # TODO: display dialog box or so 73 CFPlus::fatal Carp::longmess $_[1]
51 Carp::cluck $_[1];#d#TODO: remove when stable
52 return;#d#
53 CFPlus::fatal ($_[1]);
54}; 74};
55
56our $VERSION = '0.9';
57 75
58my $MAX_FPS = 60; 76my $MAX_FPS = 60;
59my $MIN_FPS = 5; # unused as of yet 77my $MIN_FPS = 5; # unused as of yet
60 78
61our $META_SERVER = "crossfire.real-time.com:13326"; 79our $META_SERVER = "http://metaserver.schmorp.de/current.json";
62 80
63our $LAST_REFRESH; 81our $LAST_REFRESH;
64our $NOW; 82our $NOW;
65 83
66our $CFG; 84our $CFG;
104 122
105our $INVENTORY_PAGE; 123our $INVENTORY_PAGE;
106our $STATS_PAGE; 124our $STATS_PAGE;
107our $SKILL_PAGE; 125our $SKILL_PAGE;
108our $SPELL_PAGE; 126our $SPELL_PAGE;
127our $SPELL_LIST;
109 128
110our $HELP_WINDOW; 129our $HELP_WINDOW;
111our $MESSAGE_WINDOW; 130our $MESSAGE_WINDOW;
112our $FLOORBOX; 131our $FLOORBOX;
113our $GAUGES; 132our $GAUGES;
131our $BIND_EDITOR; 150our $BIND_EDITOR;
132our $BIND_UPD_CB; 151our $BIND_UPD_CB;
133 152
134our $PICKUP_CFG; 153our $PICKUP_CFG;
135 154
155our $IN_BUILD_MODE;
156our $BUILD_BUTTON;
157
136sub status { 158sub status {
137 $STATUSBOX->add (CFPlus::asxml $_[0], pri => -10, group => "status", timeout => 10, fg => [1, 1, 0, 1]); 159 $STATUSBOX->add (CFPlus::asxml $_[0], pri => -10, group => "status", timeout => 10, fg => [1, 1, 0, 1]);
138} 160}
139 161
140sub debug { 162sub debug {
141 $DEBUG_STATUS->set_text ($_[0]); 163 $DEBUG_STATUS->set_text ($_[0]);
164}
165
166sub message {
167 my ($para) = @_;
168
169 my $time = sprintf "%02d:%02d:%02d", (localtime time)[2,1,0];
170
171 $para->{markup} = "<span foreground='#ffffff'>$time</span> $para->{markup}";
172
173 $LOGVIEW->add_paragraph ($para);
174 $LOGVIEW->scroll_to_bottom;
142} 175}
143 176
144sub destroy_query_dialog { 177sub destroy_query_dialog {
145 (delete $_[0]{query_dialog})->destroy 178 (delete $_[0]{query_dialog})->destroy
146 if $_[0]{query_dialog}; 179 if $_[0]{query_dialog};
351 384
352 my $mapsize = List::Util::min 32, List::Util::max 11, int $WIDTH * $CFG->{mapsize} * 0.01 / 32; 385 my $mapsize = List::Util::min 32, List::Util::max 11, int $WIDTH * $CFG->{mapsize} * 0.01 / 32;
353 386
354 my ($host, $port) = split /:/, $PROFILE->{host}; 387 my ($host, $port) = split /:/, $PROFILE->{host};
355 388
356 $MAP = new CFPlus::Map $mapsize, $mapsize; 389 $MAP = new CFPlus::Map;
357 390
358 $CONN = eval { 391 $CONN = eval {
359 new CFPlus::Protocol 392 new CFPlus::Protocol
360 host => $host, 393 host => $host,
361 port => $port || 13327, 394 port => $port || 13327,
362 user => $PROFILE->{user}, 395 user => $PROFILE->{user},
363 pass => $PROFILE->{password}, 396 pass => $PROFILE->{password},
364 mapw => $mapsize, 397 mapw => $mapsize,
365 maph => $mapsize, 398 maph => $mapsize,
366 399
367 client => "cfplus $VERSION $] $^O", 400 client => "cfplus $CFPlus::VERSION $] $^O",
368 401
369 map_widget => $MAPWIDGET, 402 map_widget => $MAPWIDGET,
370 logview => $LOGVIEW, 403 logview => $LOGVIEW,
371 statusbox => $STATUSBOX, 404 statusbox => $STATUSBOX,
372 map => $MAP, 405 map => $MAP,
399sub stop_game { 432sub stop_game {
400 $LOGIN_BUTTON->set_text ("Login"); 433 $LOGIN_BUTTON->set_text ("Login");
401 $SETUP_NOTEBOOK->set_current_page ($SETUP_SERVER); 434 $SETUP_NOTEBOOK->set_current_page ($SETUP_SERVER);
402 $SETUP_DIALOG->show; 435 $SETUP_DIALOG->show;
403 $PL_WINDOW->hide; 436 $PL_WINDOW->hide;
404 $SPELL_PAGE->clear_spells; 437 $SPELL_LIST->clear_spells;
405 438
406 return unless $CONN; 439 return unless $CONN;
407 440
408 status "connection closed"; 441 status "connection closed";
409 442
410 destroy_query_dialog $CONN; 443 destroy_query_dialog $CONN;
411 $CONN->destroy; 444 $CONN->destroy;
412 $CONN = 0; # false, does not autovivify 445 $CONN = 0; # false, does not autovivify
413 446
414 undef $MAP; 447 undef $MAP;
415 undef $PROFILE;
416} 448}
417 449
418sub graphics_setup { 450sub graphics_setup {
419 my $vbox = new CFPlus::UI::VBox; 451 my $vbox = new CFPlus::UI::VBox;
420 452
637 $table->add (1, 1, new CFPlus::UI::CheckBox on_changed => sub { $ENV{CFPLUS_DEBUG} ^= 2; 0 }); 669 $table->add (1, 1, new CFPlus::UI::CheckBox on_changed => sub { $ENV{CFPLUS_DEBUG} ^= 2; 0 });
638 $table->add (0, 2, new CFPlus::UI::Label text => "Show FPS"); 670 $table->add (0, 2, new CFPlus::UI::Label text => "Show FPS");
639 $table->add (1, 2, new CFPlus::UI::CheckBox on_changed => sub { $ENV{CFPLUS_DEBUG} ^= 4; 0 }); 671 $table->add (1, 2, new CFPlus::UI::CheckBox on_changed => sub { $ENV{CFPLUS_DEBUG} ^= 4; 0 });
640 $table->add (0, 3, new CFPlus::UI::Label text => "Suppress Tooltips"); 672 $table->add (0, 3, new CFPlus::UI::Label text => "Suppress Tooltips");
641 $table->add (1, 3, new CFPlus::UI::CheckBox on_changed => sub { $ENV{CFPLUS_DEBUG} ^= 8; 0 }); 673 $table->add (1, 3, new CFPlus::UI::CheckBox on_changed => sub { $ENV{CFPLUS_DEBUG} ^= 8; 0 });
674 $table->add (0, 4, new CFPlus::UI::Button text => "die on click(tm)", on_activate => sub { die "violator" } );
642 675
643 my @default_smooth = (0.05, 0.13, 0.05, 0.13, 0.30, 0.13, 0.05, 0.13, 0.05); 676 my @default_smooth = (0.05, 0.13, 0.05, 0.13, 0.30, 0.13, 0.05, 0.13, 0.05);
644 677
645 for my $x (0..2) { 678 for my $x (0..2) {
646 for my $y (0 .. 2) { 679 for my $y (0 .. 2) {
828 861
829 my $table = $METASERVER->{table}; 862 my $table = $METASERVER->{table};
830 $table->clear; 863 $table->clear;
831 $table->add (0, 0, my $label = new CFPlus::UI::Label max_w => $WIDTH * 0.8, text => "fetching server list..."); 864 $table->add (0, 0, my $label = new CFPlus::UI::Label max_w => $WIDTH * 0.8, text => "fetching server list...");
832 865
833 my $buf; 866 my $ok = 0;
834 867
835 my $fh = new IO::Socket::INET PeerHost => $META_SERVER, Blocking => 0; 868 CFPlus::background {
869 my $ua = CFPlus::lwp_useragent;
836 870
837 unless ($fh) { 871 CFPlus::background_msg CFPlus::from_json +(CFPlus::lwp_check $ua->get ($META_SERVER))->decoded_content;
838 $label->set_text ("unable to contact metaserver: $!"); 872 } sub {
839 return; 873 my ($msg) = @_;
840 } 874 if ($msg) {
841
842 Event->io (fd => $fh, poll => 'r', cb => sub {
843 my $res = sysread $fh, $buf, 8192, length $buf;
844
845 if (!defined $res) {
846 $_[0]->w->cancel;
847 $label->set_text ("error while retrieving server list: $!");
848 } elsif ($res == 0) {
849 $_[0]->w->cancel;
850 status "server list retrieved";
851
852 utf8::decode $buf if utf8::valid $buf;
853
854 $table->clear; 875 $table->clear;
855 876
856 my @tip = ( 877 my @tip = (
857 "The current number of users logged in on the server.", 878 "The current number of users logged in on the server.",
858 "The hostname of the server.", 879 "The hostname of the server.",
868 for 0 .. $#col; 889 for 0 .. $#col;
869 890
870 my @align = qw(1 0 1 1 -1); 891 my @align = qw(1 0 1 1 -1);
871 892
872 my $y = 0; 893 my $y = 0;
873 for my $m (sort { $b->[3] <=> $a->[3] } map [split /\|/], split /\015?\012/, $buf) { 894 for my $m (
895 sort {
896 $b->{version} <=> $a->{version}
897 or $b->{users} <=> $a->{users}
898 }
899 @{ $msg->{servers} }
900 ) {
874 my ($ip, $last, $host, $users, $version, $desc, $ibytes, $obytes, $uptime) = @$m; 901 my ($ip, $last, $host, $users, $version, $desc, $ibytes, $obytes, $uptime) =
902 @$m{qw(ip age hostname users version description ibytes obytes uptime)};
875 903
876 for ($desc) { 904 for ($desc) {
877 s/<br>/\n/gi; 905 s/<br>/\n/gi;
878 s/<li>/\n· /gi; 906 s/<li>/\n· /gi;
879 s/<.*?>//sgi; 907 s/<.*?>//sgi;
880 s/&/&amp;/g; 908 s/&amp;/&/g;
881 s/</&lt;/g; 909 s/&lt;/</g;
882 s/>/&gt;/g; 910 s/&gt;/>/g;
883 } 911 }
884 912
885 $uptime = sprintf "%dd %02d:%02d:%02d", 913 $uptime = sprintf "%dd %02d:%02d:%02d",
886 (int $m->[8] / 86400), 914 (int $uptime / 86400),
887 (int $m->[8] / 3600) % 24, 915 (int $uptime / 3600) % 24,
888 (int $m->[8] / 60) % 60, 916 (int $uptime / 60) % 60,
889 $m->[8] % 60; 917 $uptime % 60;
890 918
891 $m = [$users, $host, $uptime, $version, $desc]; 919 $m = [$users, $host, $uptime, $version, $desc];
892 920
893 $y++; 921 $y++;
894 922
904 ), 932 ),
905 (new CFPlus::UI::Empty expand => 1), 933 (new CFPlus::UI::Empty expand => 1),
906 ]); 934 ]);
907 935
908 $table->add ($_, $y, new CFPlus::UI::Label 936 $table->add ($_, $y, new CFPlus::UI::Label
937 max_w => $::WIDTH * 0.4,
909 ellipsise => 0, 938 ellipsise => 0,
910 align => $align[$_], 939 align => $align[$_],
911 text => $m->[$_], 940 text => $m->[$_],
912 tooltip => $tip[$_], 941 tooltip => $tip[$_],
942 fg => ($m->[3] =~ /\+$/ ? [1, 1, 1] : [.7, .7, .7]),
913 can_hover => 1, 943 can_hover => 1,
914 can_events => 1, 944 can_events => 1,
915 fontsize => 0.8) 945 fontsize => 0.8)
916 for 0 .. $#$m; 946 for 0 .. $#$m;
917 } 947 }
948 } else {
949 $ok or $label->set_text ("error while contacting metaserver");
918 } 950 }
919 }); 951 };
952
920} 953}
921 954
922sub metaserver_dialog { 955sub metaserver_dialog {
923 my $vbox = new CFPlus::UI::VBox; 956 my $vbox = new CFPlus::UI::VBox;
924 my $table = new CFPlus::UI::Table; 957 my $table = new CFPlus::UI::Table;
928 title => "Server List", 961 title => "Server List",
929 name => 'metaserver_dialog', 962 name => 'metaserver_dialog',
930 x => 'center', 963 x => 'center',
931 y => 'center', 964 y => 'center',
932 z => 3, 965 z => 3,
966 force_w => $::WIDTH * 0.9,
933 force_h => $::HEIGHT * 0.4, 967 force_h => $::HEIGHT * 0.7,
934 child => $vbox, 968 child => $vbox,
935 has_close_button => 1, 969 has_close_button => 1,
936 table => $table, 970 table => $table,
937 on_visibility_change => sub { 971 on_visibility_change => sub {
938 update_metaserver ($_[0]) if $_[1]; 972 update_metaserver ($_[0]) if $_[1];
1058 $table->add (1, 13, my $saycmd = new CFPlus::UI::CheckBox 1092 $table->add (1, 13, my $saycmd = new CFPlus::UI::CheckBox
1059 state => $CFG->{show_tips}, 1093 state => $CFG->{show_tips},
1060 tooltip => "Show the <b>Tip of the day</b> window at startup?", 1094 tooltip => "Show the <b>Tip of the day</b> window at startup?",
1061 on_changed => sub { 1095 on_changed => sub {
1062 my ($self, $value) = @_; 1096 my ($self, $value) = @_;
1063 $CFG->{shop_tips} = $value; 1097 $CFG->{show_tips} = $value;
1064 0 1098 0
1065 } 1099 }
1066 ); 1100 );
1067 1101
1068 $vbox->add (new CFPlus::UI::FancyFrame 1102 $vbox->add (new CFPlus::UI::FancyFrame
1159 ["Boots" => PICKUP_BOOTS], 1193 ["Boots" => PICKUP_BOOTS],
1160 ["Gloves" => PICKUP_GLOVES], 1194 ["Gloves" => PICKUP_GLOVES],
1161 ["Cloaks" => PICKUP_CLOAK], 1195 ["Cloaks" => PICKUP_CLOAK],
1162 ], 1196 ],
1163 1197
1164 ["Readables", 2, 2, 1198 ["Readables", 2, 0,
1165 ["Spellbooks" => PICKUP_SPELLBOOK], 1199 ["Spellbooks" => PICKUP_SPELLBOOK],
1166 ["Skillscrolls" => PICKUP_SKILLSCROLL], 1200 ["Skillscrolls" => PICKUP_SKILLSCROLL],
1167 ["Normal Books/Scrolls" => PICKUP_READABLES], 1201 ["Normal Books/Scrolls" => PICKUP_READABLES],
1168 ], 1202 ],
1169 ["Misc", 2, 7, 1203 ["Misc", 2, 5,
1170 ["Food" => PICKUP_FOOD], 1204 ["Food" => PICKUP_FOOD],
1171 ["Drinks" => PICKUP_DRINK], 1205 ["Drinks" => PICKUP_DRINK],
1172 ["Valuables (Money, Gems)" => PICKUP_VALUABLES], 1206 ["Valuables (Money, Gems)" => PICKUP_VALUABLES],
1173 ["Keys" => PICKUP_KEY], 1207 ["Keys" => PICKUP_KEY],
1174 ["Magical Items" => PICKUP_MAGICAL], 1208 ["Magical Items" => PICKUP_MAGICAL],
1175 ["Potions" => PICKUP_POTION], 1209 ["Potions" => PICKUP_POTION],
1176 ["Magic Devices" => PICKUP_MAGIC_DEVICE], 1210 ["Magic Devices" => PICKUP_MAGIC_DEVICE],
1177 ["Ignore cursed" => PICKUP_NOT_CURSED], 1211 ["Ignore cursed" => PICKUP_NOT_CURSED],
1178 ["Jewelery" => PICKUP_JEWELS], 1212 ["Jewelery" => PICKUP_JEWELS],
1213 ["Flesh" => PICKUP_FLESH],
1179 ], 1214 ],
1180 ["Weight/Value ratio", 2, 17] 1215 ["Weight/Value ratio", 2, 17]
1181 ) 1216 )
1182 { 1217 {
1183 my ($title, $x, $y, @bits) = @$_; 1218 my ($title, $x, $y, @bits) = @$_;
1233 $table 1268 $table
1234} 1269}
1235 1270
1236my %SORT_ORDER = ( 1271my %SORT_ORDER = (
1237 type => undef, 1272 type => undef,
1238 mtime => sub { sort { 1273 mtime => sub {
1274 my $NOW = time;
1275 sort {
1276 my $atime = $a->{mtime} - $NOW; $atime = $atime < 5 * 60 ? int $atime / 60 : 6;
1277 my $btime = $b->{mtime} - $NOW; $btime = $btime < 5 * 60 ? int $btime / 60 : 6;
1278
1239 ($a->{flags} & F_LOCKED) <=> ($b->{flags} & F_LOCKED) 1279 ($a->{flags} & F_LOCKED) <=> ($b->{flags} & F_LOCKED)
1240 or $b->{mtime} <=> $a->{mtime} 1280 or $btime <=> $atime
1241 or $a->{type} <=> $b->{type} 1281 or $a->{type} <=> $b->{type}
1282 } @_
1242 } @_ }, 1283 },
1243 weight => sub { sort { 1284 weight => sub { sort {
1244 $a->{weight} * ($a->{nrof} || 1) <=> $b->{weight} * ($b->{nrof} || 1) 1285 $a->{weight} * ($a->{nrof} || 1) <=> $b->{weight} * ($b->{nrof} || 1)
1245 or $a->{type} <=> $b->{type} 1286 or $a->{type} <=> $b->{type}
1246 } @_ }, 1287 } @_ },
1247); 1288);
1272 #TODO# update to weigh/maxweight 1313 #TODO# update to weigh/maxweight
1273 $hb1->add ($STATWIDS->{i_weight} = new CFPlus::UI::Label align => -1); 1314 $hb1->add ($STATWIDS->{i_weight} = new CFPlus::UI::Label align => -1);
1274 1315
1275 $vb1->add (my $sw1 = new CFPlus::UI::ScrolledWindow expand => 1, scroll_y => 1); 1316 $vb1->add (my $sw1 = new CFPlus::UI::ScrolledWindow expand => 1, scroll_y => 1);
1276 $sw1->add ($INV = new CFPlus::UI::Inventory); 1317 $sw1->add ($INV = new CFPlus::UI::Inventory);
1318 $INV->set_sort_order ($SORT_ORDER{$::CFG->{inv_sort}});
1277 1319
1278 $hb->add (my $vb2 = new CFPlus::UI::VBox); 1320 $hb->add (my $vb2 = new CFPlus::UI::VBox);
1279 1321
1280 $vb2->add ($INV_RIGHT_HB = new CFPlus::UI::HBox); 1322 $vb2->add ($INV_RIGHT_HB = new CFPlus::UI::HBox);
1281 1323
1321 $ntb->add ( 1363 $ntb->add (
1322 "Skills (F3)" => $SKILL_PAGE = skill_window, 1364 "Skills (F3)" => $SKILL_PAGE = skill_window,
1323 "Shows all your Skills." 1365 "Shows all your Skills."
1324 ); 1366 );
1325 1367
1326 my $spellsw = new CFPlus::UI::ScrolledWindow (expand => 1, scroll_y => 1); 1368 my $spellsw = $SPELL_PAGE = new CFPlus::UI::ScrolledWindow (expand => 1, scroll_y => 1);
1327 $spellsw->add ($SPELL_PAGE = new CFPlus::UI::SpellList); 1369 $spellsw->add ($SPELL_LIST = new CFPlus::UI::SpellList);
1328 $ntb->add ( 1370 $ntb->add (
1329 "Spellbook (F4)" => $spellsw, 1371 "Spellbook (F4)" => $spellsw,
1330 "Displays all spells you have and lets you edit keyboard shortcuts for them." 1372 "Displays all spells you have and lets you edit keyboard shortcuts for them."
1331 ); 1373 );
1332 $ntb->add ( 1374 $ntb->add (
1823 ); 1865 );
1824 1866
1825 $BUTTONBAR->add (new CFPlus::UI::Flopper text => "Help!", other => $HELP_WINDOW = help_window, 1867 $BUTTONBAR->add (new CFPlus::UI::Flopper text => "Help!", other => $HELP_WINDOW = help_window,
1826 tooltip => "View Documentation"); 1868 tooltip => "View Documentation");
1827 1869
1870
1828 $BUTTONBAR->add (new CFPlus::UI::Button 1871 $BUTTONBAR->add (new CFPlus::UI::Button
1829 text => "Quit", 1872 text => "Quit",
1830 tooltip => "Terminates the program", 1873 tooltip => "Terminates the program",
1831 on_activate => sub { 1874 on_activate => sub {
1832 if ($CONN) { 1875 if ($CONN) {
1843 } 1886 }
1844 1887
1845 $STATUSBOX->add ("Set video mode $WIDTH×$HEIGHT", timeout => 10, fg => [1, 1, 1, 0.5]); 1888 $STATUSBOX->add ("Set video mode $WIDTH×$HEIGHT", timeout => 10, fg => [1, 1, 1, 0.5]);
1846} 1889}
1847 1890
1891sub setup_build_button {
1892 my ($enabled) = @_;
1893 if ($enabled) {
1894 $BUILD_BUTTON ||= new CFPlus::UI::Button
1895 text => "Build",
1896 tooltip => "Opens the ingame builder",
1897 on_activate => sub {
1898 if ($CONN) {
1899 $CONN->send_ext_req (builder_player_items => sub {
1900 open_ingame_editor ($_[0]) if exists $_[0]->{items};
1901 });
1902 }
1903 0
1904 };
1905 $BUTTONBAR->add ($BUILD_BUTTON);
1906 } else {
1907 $BUILD_BUTTON->hide if $BUILD_BUTTON;
1908 }
1909}
1910
1911sub open_ingame_editor {
1912 my ($msg) = @_;
1913
1914 my $win = new CFPlus::UI::Toplevel
1915 x => 0,
1916 y => 'center',
1917 z => 4,
1918 name => 'builder_window',
1919 force_w => int $WIDTH * 1/4,
1920 force_h => int $HEIGHT * 3/4,
1921 title => "In game builder",
1922 has_close_button => 1;
1923
1924 my $r = new CFPlus::UI::ScrolledWindow (
1925 expand => 1,
1926 scroll_y => 1
1927 );
1928 $r->add (my $vb = new CFPlus::UI::VBox);
1929 $win->add ($r);
1930
1931
1932 $vb->add (my $chk = new CFPlus::UI::Button text => "Disable build mode", on_activate => sub { $::IN_BUILD_MODE = undef });
1933 $vb->add (my $chk = new CFPlus::UI::Button text => "ERASE", on_activate => sub { $::IN_BUILD_MODE = { do_erase => 1 } });
1934
1935 for my $itemarchname (keys %{$msg->{items}}) {
1936 $vb->add (
1937 new CFPlus::UI::Button text => "$itemarchname",
1938 on_activate => sub {
1939 $::IN_BUILD_MODE = $itemarchname;
1940 }
1941 );
1942 }
1943
1944 $win->show;
1945}
1946
1848sub video_shutdown { 1947sub video_shutdown {
1849 CFPlus::OpenGL::shutdown; 1948 CFPlus::OpenGL::shutdown;
1850 1949
1851 undef $SDL_ACTIVE; 1950 undef $SDL_ACTIVE;
1852} 1951}
1883 CFPlus::Mix_AllocateChannels 8; 1982 CFPlus::Mix_AllocateChannels 8;
1884 CFPlus::MixMusic::volume $CFG->{bgm_volume} * 128; 1983 CFPlus::MixMusic::volume $CFG->{bgm_volume} * 128;
1885 1984
1886 audio_music_finished; 1985 audio_music_finished;
1887 1986
1987 local $_;
1888 while (<$fh>) { 1988 while (<$fh>) {
1889 next if /^\s*#/; 1989 next if /^\s*#/;
1890 next if /^\s*$/; 1990 next if /^\s*$/;
1891 1991
1892 my ($file, $volume, $event) = split /\s+/, $_, 3; 1992 my ($file, $volume, $event) = split /\s+/, $_, 3;
2026 log_fontsize => 0.7, 2126 log_fontsize => 0.7,
2027 gauge_fontsize => 1, 2127 gauge_fontsize => 1,
2028 gauge_size => 0.35, 2128 gauge_size => 0.35,
2029 stat_fontsize => 0.7, 2129 stat_fontsize => 0.7,
2030 mapsize => 100, 2130 mapsize => 100,
2031 say_command => 'say', 2131 say_command => 'chat',
2032 audio_enable => 1, 2132 audio_enable => 1,
2033 bgm_enable => 1, 2133 bgm_enable => 1,
2034 bgm_volume => 0.25, 2134 bgm_volume => 0.25,
2035 face_prefetch => 0, 2135 face_prefetch => 0,
2036 output_sync => 1, 2136 output_sync => 1,
2090# } 2190# }
2091# my $t2 = Time::HiRes::time; 2191# my $t2 = Time::HiRes::time;
2092# warn $t2-$t1; 2192# warn $t2-$t1;
2093# } 2193# }
2094 2194
2195 $startup_done->();
2196
2095 video_init; 2197 video_init;
2096 audio_init; 2198 audio_init;
2097} 2199}
2098 2200
2099show_tip_of_the_day if $CFG->{show_tips}; 2201show_tip_of_the_day if $CFG->{show_tips};
2100
2101use Data::Dumper; warn Dumper [CFPlus::win32_proxy_info()];#d#
2102 2202
2103Event::loop; 2203Event::loop;
2104#CFPlus::SDL_Quit; 2204#CFPlus::SDL_Quit;
2105#CFPlus::_exit 0; 2205#CFPlus::_exit 0;
2106 2206

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines