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.131 by root, Sun Nov 19 20:31:29 2006 UTC vs.
Revision 1.134 by elmex, Mon Dec 4 15:17:14 2006 UTC

21 } 21 }
22} 22}
23 23
24use strict; 24use strict;
25use utf8; 25use utf8;
26
27use Carp 'verbose';
26 28
27# do things only needed for single-binary version (par) 29# do things only needed for single-binary version (par)
28BEGIN { 30BEGIN {
29 if (%PAR::LibCache) { 31 if (%PAR::LibCache) {
30 @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
66$SIG{QUIT} = sub { Carp::cluck "QUIT" }; 68$SIG{QUIT} = sub { Carp::cluck "QUIT" };
67$SIG{PIPE} = 'IGNORE'; 69$SIG{PIPE} = 'IGNORE';
68 70
69$Event::Eval = 0; 71$Event::Eval = 0;
70$Event::DIED = sub { 72$Event::DIED = sub {
71 # TODO: display dialog box or so 73 CFPlus::fatal Carp::longmess $_[1]
72 Carp::cluck $_[1];#d#TODO: remove when stable
73 return;#d#
74 CFPlus::fatal ($_[1]);
75}; 74};
76 75
77my $MAX_FPS = 60; 76my $MAX_FPS = 60;
78my $MIN_FPS = 5; # unused as of yet 77my $MIN_FPS = 5; # unused as of yet
79 78
150 149
151our $BIND_EDITOR; 150our $BIND_EDITOR;
152our $BIND_UPD_CB; 151our $BIND_UPD_CB;
153 152
154our $PICKUP_CFG; 153our $PICKUP_CFG;
154
155our $IN_BUILD_MODE;
156our $BUILD_BUTTON;
155 157
156sub status { 158sub status {
157 $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]);
158} 160}
159 161
430sub stop_game { 432sub stop_game {
431 $LOGIN_BUTTON->set_text ("Login"); 433 $LOGIN_BUTTON->set_text ("Login");
432 $SETUP_NOTEBOOK->set_current_page ($SETUP_SERVER); 434 $SETUP_NOTEBOOK->set_current_page ($SETUP_SERVER);
433 $SETUP_DIALOG->show; 435 $SETUP_DIALOG->show;
434 $PL_WINDOW->hide; 436 $PL_WINDOW->hide;
435 $SPELL_PAGE->clear_spells; 437 $SPELL_LIST->clear_spells;
436 438
437 return unless $CONN; 439 return unless $CONN;
438 440
439 status "connection closed"; 441 status "connection closed";
440 442
667 $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 });
668 $table->add (0, 2, new CFPlus::UI::Label text => "Show FPS"); 670 $table->add (0, 2, new CFPlus::UI::Label text => "Show FPS");
669 $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 });
670 $table->add (0, 3, new CFPlus::UI::Label text => "Suppress Tooltips"); 672 $table->add (0, 3, new CFPlus::UI::Label text => "Suppress Tooltips");
671 $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" } );
672 675
673 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);
674 677
675 for my $x (0..2) { 678 for my $x (0..2) {
676 for my $y (0 .. 2) { 679 for my $y (0 .. 2) {
1190 ["Boots" => PICKUP_BOOTS], 1193 ["Boots" => PICKUP_BOOTS],
1191 ["Gloves" => PICKUP_GLOVES], 1194 ["Gloves" => PICKUP_GLOVES],
1192 ["Cloaks" => PICKUP_CLOAK], 1195 ["Cloaks" => PICKUP_CLOAK],
1193 ], 1196 ],
1194 1197
1195 ["Readables", 2, 2, 1198 ["Readables", 2, 0,
1196 ["Spellbooks" => PICKUP_SPELLBOOK], 1199 ["Spellbooks" => PICKUP_SPELLBOOK],
1197 ["Skillscrolls" => PICKUP_SKILLSCROLL], 1200 ["Skillscrolls" => PICKUP_SKILLSCROLL],
1198 ["Normal Books/Scrolls" => PICKUP_READABLES], 1201 ["Normal Books/Scrolls" => PICKUP_READABLES],
1199 ], 1202 ],
1200 ["Misc", 2, 7, 1203 ["Misc", 2, 5,
1201 ["Food" => PICKUP_FOOD], 1204 ["Food" => PICKUP_FOOD],
1202 ["Drinks" => PICKUP_DRINK], 1205 ["Drinks" => PICKUP_DRINK],
1203 ["Valuables (Money, Gems)" => PICKUP_VALUABLES], 1206 ["Valuables (Money, Gems)" => PICKUP_VALUABLES],
1204 ["Keys" => PICKUP_KEY], 1207 ["Keys" => PICKUP_KEY],
1205 ["Magical Items" => PICKUP_MAGICAL], 1208 ["Magical Items" => PICKUP_MAGICAL],
1206 ["Potions" => PICKUP_POTION], 1209 ["Potions" => PICKUP_POTION],
1207 ["Magic Devices" => PICKUP_MAGIC_DEVICE], 1210 ["Magic Devices" => PICKUP_MAGIC_DEVICE],
1208 ["Ignore cursed" => PICKUP_NOT_CURSED], 1211 ["Ignore cursed" => PICKUP_NOT_CURSED],
1209 ["Jewelery" => PICKUP_JEWELS], 1212 ["Jewelery" => PICKUP_JEWELS],
1213 ["Flesh" => PICKUP_FLESH],
1210 ], 1214 ],
1211 ["Weight/Value ratio", 2, 17] 1215 ["Weight/Value ratio", 2, 17]
1212 ) 1216 )
1213 { 1217 {
1214 my ($title, $x, $y, @bits) = @$_; 1218 my ($title, $x, $y, @bits) = @$_;
1861 ); 1865 );
1862 1866
1863 $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,
1864 tooltip => "View Documentation"); 1868 tooltip => "View Documentation");
1865 1869
1870
1866 $BUTTONBAR->add (new CFPlus::UI::Button 1871 $BUTTONBAR->add (new CFPlus::UI::Button
1867 text => "Quit", 1872 text => "Quit",
1868 tooltip => "Terminates the program", 1873 tooltip => "Terminates the program",
1869 on_activate => sub { 1874 on_activate => sub {
1870 if ($CONN) { 1875 if ($CONN) {
1879 $BUTTONBAR->show; 1884 $BUTTONBAR->show;
1880 $SETUP_DIALOG->show; 1885 $SETUP_DIALOG->show;
1881 } 1886 }
1882 1887
1883 $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]);
1889}
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;
1884} 1945}
1885 1946
1886sub video_shutdown { 1947sub video_shutdown {
1887 CFPlus::OpenGL::shutdown; 1948 CFPlus::OpenGL::shutdown;
1888 1949

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines