… | |
… | |
49 | } |
49 | } |
50 | } |
50 | } |
51 | |
51 | |
52 | if ($^O eq "MSWin32") { |
52 | if ($^O eq "MSWin32") { |
53 | # pango is relocatable on win32 |
53 | # pango is relocatable on win32 |
54 | } else { |
54 | } elsif (-e "$root/pangoversion") { |
55 | open my $fh, "<:perlio", "$root/pangoversion" |
55 | open my $fh, "<:perlio", "$root/pangoversion" |
56 | or die "pangoversion: $!"; |
56 | or die "pangoversion: $!"; |
57 | my $PANGO = <$fh>; |
57 | my $PANGO = <$fh>; |
58 | # unix, need to patch pango rc file |
58 | # unix, need to patch pango rc file |
59 | open my $fh, "<:perlio", "$root/usr/lib/pango/$PANGO/module-files.d/libpango1.0-0.modules" |
59 | open my $fh, "<:perlio", "$root/usr/lib/pango/$PANGO/module-files.d/libpango1.0-0.modules" |
… | |
… | |
69 | |
69 | |
70 | $ENV{PANGO_RC_FILE} = "$root/pango.rc"; |
70 | $ENV{PANGO_RC_FILE} = "$root/pango.rc"; |
71 | open my $fh, ">:perlio", $ENV{PANGO_RC_FILE} |
71 | open my $fh, ">:perlio", $ENV{PANGO_RC_FILE} |
72 | or die "$ENV{PANGO_RC_FILE}: $!"; |
72 | or die "$ENV{PANGO_RC_FILE}: $!"; |
73 | print $fh "[Pango]\nModuleFiles = $root/pango-modules\n"; |
73 | print $fh "[Pango]\nModuleFiles = $root/pango-modules\n"; |
|
|
74 | } else { |
|
|
75 | # OS X |
|
|
76 | $ENV{FC_CONFIG_FILE} = "$root/fonts.conf"; # no effect??!?! |
|
|
77 | $ENV{FC_CONFIG_DIR} = $root; # no effect??!?! |
|
|
78 | $ENV{PANGO_RC_FILE} = "$root/pango.rc"; |
|
|
79 | $ENV{DYLD_LIBRARY_PATH} = $root; |
|
|
80 | chdir $root; # for pango modules, maybe other things |
74 | } |
81 | } |
75 | |
82 | |
76 | unshift @INC, $root; |
83 | unshift @INC, $root; |
77 | } |
84 | } |
78 | } |
85 | } |
… | |
… | |
97 | use List::Util qw(max min); |
104 | use List::Util qw(max min); |
98 | |
105 | |
99 | use Deliantra; |
106 | use Deliantra; |
100 | use Deliantra::Protocol::Constants; |
107 | use Deliantra::Protocol::Constants; |
101 | |
108 | |
|
|
109 | use AnyEvent::Util (); |
102 | use AnyEvent::DNS; |
110 | use AnyEvent::DNS; |
103 | use AnyEvent::Socket (); |
111 | use AnyEvent::Socket (); |
104 | |
112 | |
105 | use Compress::LZF; |
113 | use Compress::LZF; |
|
|
114 | use JSON::XS; |
106 | |
115 | |
107 | use DC; |
116 | use DC; |
108 | BEGIN { $SIG{__DIE__} = sub { DC::fatal Carp::longmess "$_[0]" unless $^S } } |
117 | |
|
|
118 | ############################################################################# |
|
|
119 | |
|
|
120 | our $CONN; |
|
|
121 | |
|
|
122 | # write a crash message blockingly to the socket, if possible |
|
|
123 | # this is a bit too complicated for my tastes, but it was easy. |
|
|
124 | sub crash($;$) { |
|
|
125 | my ($msg, $backtrace) = @_; |
|
|
126 | |
|
|
127 | return unless $CONN; |
|
|
128 | |
|
|
129 | my $fh = $CONN->{fh} |
|
|
130 | or return; |
|
|
131 | |
|
|
132 | my $buf = delete $CONN->{wbuf}; |
|
|
133 | |
|
|
134 | $buf .= pack "n/a*", "exti " . JSON::XS::encode_json [clientlog => undef, substr $msg, 0, 8000]; |
|
|
135 | |
|
|
136 | AnyEvent::Util::fh_nonblocking $fh, 0; |
|
|
137 | |
|
|
138 | syswrite $fh, $buf; |
|
|
139 | AnyEvent::Util::fh_nonblocking $fh, 1; |
|
|
140 | |
|
|
141 | $msg =~ s/\s+$//; |
|
|
142 | |
|
|
143 | # backtrace as second step, in case it crashes, too |
|
|
144 | crash (Carp::longmess "$msg\nbacktrace, for client version $DC::VERSION, generated") |
|
|
145 | if $backtrace; |
|
|
146 | } |
|
|
147 | |
|
|
148 | ############################################################################# |
|
|
149 | |
|
|
150 | BEGIN { |
|
|
151 | $SIG{__DIE__} = sub { |
|
|
152 | return if $^S; |
|
|
153 | crash ("CRASH/DIE: $_[0]" => 1); |
|
|
154 | DC::fatal Carp::longmess "$_[0]"; |
|
|
155 | } |
|
|
156 | } |
|
|
157 | |
109 | use DC::OpenGL (); |
158 | use DC::OpenGL (); |
110 | use DC::Protocol; |
159 | use DC::Protocol; |
111 | use DC::DB; |
160 | use DC::DB; |
112 | use DC::UI; |
161 | use DC::UI; |
113 | use DC::UI::Canvas; |
162 | use DC::UI::Canvas; |
114 | use DC::UI::Inventory; |
163 | use DC::UI::Inventory; |
115 | use DC::UI::SpellList; |
164 | use DC::UI::SpellList; |
116 | use DC::UI::Dockable; |
165 | use DC::UI::Dockable; |
117 | use DC::UI::Dockbar; |
166 | use DC::UI::Dockbar; |
118 | use DC::UI::MessageWindow; |
|
|
119 | use DC::UI::ChatView; |
167 | use DC::UI::ChatView; |
120 | use DC::MessageDistributor; |
168 | use DC::MessageDistributor; |
121 | use DC::Pod; |
169 | use DC::Pod; |
122 | use DC::MapWidget; |
170 | use DC::MapWidget; |
123 | use DC::Macro; |
171 | use DC::Macro; |
124 | |
172 | |
125 | $SIG{QUIT} = sub { Carp::cluck "QUIT" }; |
173 | $SIG{QUIT} = sub { Carp::cluck "QUIT" }; |
126 | $SIG{PIPE} = 'IGNORE'; |
174 | $SIG{PIPE} = 'IGNORE'; |
127 | |
175 | |
128 | $EV::DIED = sub { |
176 | $EV::DIED = sub { |
|
|
177 | crash ("CRASH/EV::DIED: $@" => 1); |
129 | DC::fatal Carp::longmess $@; |
178 | DC::fatal Carp::longmess $@; |
130 | }; |
179 | }; |
131 | |
180 | |
132 | my $MAX_FPS = 60; |
181 | my $MAX_FPS = 60; |
133 | |
182 | |
… | |
… | |
135 | |
184 | |
136 | our $LAST_REFRESH; |
185 | our $LAST_REFRESH; |
137 | our $NOW; |
186 | our $NOW; |
138 | |
187 | |
139 | our $CFG; |
188 | our $CFG; |
140 | our $CONN; |
|
|
141 | our $PROFILE; # current profile |
189 | our $PROFILE; # current profile |
142 | our $FAST; # fast, low-quality mode, possibly useful for software-rendering |
190 | our $FAST; # fast, low-quality mode, possibly useful for software-rendering |
143 | |
191 | |
144 | our $WANT_REFRESH; |
192 | our $WANT_REFRESH; |
145 | |
193 | |
… | |
… | |
800 | dc_connect $host, $port; |
848 | dc_connect $host, $port; |
801 | } |
849 | } |
802 | } |
850 | } |
803 | |
851 | |
804 | sub stop_game { |
852 | sub stop_game { |
|
|
853 | crash "stop_game"; |
|
|
854 | |
805 | $LOGIN_BUTTON->set_text ("Login / Register"); |
855 | $LOGIN_BUTTON->set_text ("Login / Register"); |
806 | $SETUP_NOTEBOOK->set_current_page ($SETUP_LOGIN); |
856 | $SETUP_NOTEBOOK->set_current_page ($SETUP_LOGIN); |
807 | $SETUP_DIALOG->show; |
857 | $SETUP_DIALOG->show; |
808 | $PL_WINDOW->hide; |
858 | $PL_WINDOW->hide; |
809 | $SPELL_LIST->clear_spells; |
859 | $SPELL_LIST->clear_spells; |
… | |
… | |
829 | |
879 | |
830 | my $row = 0; |
880 | my $row = 0; |
831 | |
881 | |
832 | $table->add_at (0, $row, new DC::UI::Label align => 1, text => "OpenGL Info"); |
882 | $table->add_at (0, $row, new DC::UI::Label align => 1, text => "OpenGL Info"); |
833 | $table->add_at (1, $row++, new DC::UI::Label fontsize => 0.8, text => DC::OpenGL::gl_vendor . ", " . DC::OpenGL::gl_version, |
883 | $table->add_at (1, $row++, new DC::UI::Label fontsize => 0.8, text => DC::OpenGL::gl_vendor . ", " . DC::OpenGL::gl_version, |
834 | can_events => 1, |
884 | can_events => 1, |
835 | tooltip => "<tt><span size='8192'>" . (DC::OpenGL::gl_extensions) . "</span></tt>"); |
885 | tooltip => "<tt><span size='8192'>" . (DC::OpenGL::gl_extensions) . "</span></tt>"); |
836 | |
886 | |
837 | $table->add_at (0, $row, new DC::UI::Label align => 1, text => "Caveats"); |
887 | $table->add_at (0, $row, new DC::UI::Label align => 1, text => "Caveats"); |
838 | $table->add_at (1, $row++, $CAVEAT_LABEL = new DC::UI::Label fontsize => 0.8, |
888 | $table->add_at (1, $row++, $CAVEAT_LABEL = new DC::UI::Label fontsize => 0.8, |
839 | can_events => 1, |
889 | can_events => 1, |
840 | tooltip => "This field shows any known issues with your config or driver, such as " |
890 | tooltip => "This field shows any known issues with your config or driver, such as " |
… | |
… | |
903 | |
953 | |
904 | $table->add_at (0, $row, new DC::UI::Label align => 1, text => "Compress Textures"); |
954 | $table->add_at (0, $row, new DC::UI::Label align => 1, text => "Compress Textures"); |
905 | $table->add_at (1, $row++, new DC::UI::CheckBox |
955 | $table->add_at (1, $row++, new DC::UI::CheckBox |
906 | state => $CFG->{texture_compression}, |
956 | state => $CFG->{texture_compression}, |
907 | tooltip => "Use texture compression. Normally this will not reduce visual quality noticable but " |
957 | tooltip => "Use texture compression. Normally this will not reduce visual quality noticable but " |
908 | . "will save a lot of memory and increase performance. The compression algorithm " |
958 | . "will save a lot of memory and increase performance (and also fall prey to the ever-buggy Mac OS X software renderer). " |
909 | . "can differ form card to card, so your mileage may vary. This setting is ignored in " |
959 | . "The compression algorithm can differ form card to card, so your mileage may vary. This setting is ignored in " |
910 | . "forced OpenGL 1.1 mode.", |
960 | . "forced OpenGL 1.1 mode and when using the Apple renderer.", |
911 | on_changed => sub { my ($self, $value) = @_; $CFG->{texture_compression} = $value; 0 } |
961 | on_changed => sub { my ($self, $value) = @_; $CFG->{texture_compression} = $value; 0 } |
912 | ); |
962 | ); |
913 | |
963 | |
914 | $table->add_at (0, $row, new DC::UI::Label align => 1, text => "Fast & Ugly"); |
964 | $table->add_at (0, $row, new DC::UI::Label align => 1, text => "Fast & Ugly"); |
915 | $table->add_at (1, $row++, new DC::UI::CheckBox |
965 | $table->add_at (1, $row++, new DC::UI::CheckBox |
… | |
… | |
1589 | 1 |
1639 | 1 |
1590 | }, |
1640 | }, |
1591 | ); |
1641 | ); |
1592 | |
1642 | |
1593 | $vbox->add (new DC::UI::FancyFrame |
1643 | $vbox->add (new DC::UI::FancyFrame |
1594 | label => "Registering", |
1644 | label => "How to Play", |
1595 | min_h => 200, |
1645 | min_h => 240, |
1596 | child => (new DC::UI::Label valign => 0, ellipsise => 0, |
1646 | child => (new DC::UI::Label valign => 0, ellipsise => 0, |
1597 | markup => |
1647 | markup => |
|
|
1648 | "First select a suitable video resolution in the <b>Graphics</b> tab, above.\n\n" |
|
|
1649 | . "Then register a new account (or use an existing one if you have one). " |
1598 | "To register a new account, choose a username that hasn't been taken yet and " |
1650 | . "To register an account, choose a username that hasn't been taken yet (just guess) and " |
1599 | . "try to log-in. Follow the instructions in the Log tab in the message window.", |
1651 | . "try to log-in. Follow the instructions in the Log tab in the message window.", |
1600 | ), |
1652 | ), |
1601 | ); |
1653 | ); |
1602 | |
1654 | |
1603 | $vbox |
1655 | $vbox |
… | |
… | |
2124 | on_activate => sub { $QUIT_DIALOG->hide; 0 }, |
2176 | on_activate => sub { $QUIT_DIALOG->hide; 0 }, |
2125 | ); |
2177 | ); |
2126 | $hb->add (new DC::UI::Button |
2178 | $hb->add (new DC::UI::Button |
2127 | text => "Quit anyway", |
2179 | text => "Quit anyway", |
2128 | expand => 1, |
2180 | expand => 1, |
2129 | on_activate => sub { EV::unloop EV::UNLOOP_ALL }, |
2181 | on_activate => sub { |
|
|
2182 | crash "Quit anyway"; |
|
|
2183 | EV::unloop EV::UNLOOP_ALL; |
|
|
2184 | }, |
2130 | ); |
2185 | ); |
2131 | } |
2186 | } |
2132 | |
2187 | |
2133 | $QUIT_DIALOG->show; |
2188 | $QUIT_DIALOG->show; |
2134 | $QUIT_DIALOG->grab_focus; |
2189 | $QUIT_DIALOG->grab_focus; |
… | |
… | |
2202 | @SDL_MODES = DC::SDL_ListModes 5, 0 unless @SDL_MODES; |
2257 | @SDL_MODES = DC::SDL_ListModes 5, 0 unless @SDL_MODES; |
2203 | @SDL_MODES or DC::fatal "Unable to find a usable video mode\n(hardware accelerated opengl fullscreen)"; |
2258 | @SDL_MODES or DC::fatal "Unable to find a usable video mode\n(hardware accelerated opengl fullscreen)"; |
2204 | |
2259 | |
2205 | @SDL_MODES = sort { $a->[0] * $a->[1] <=> $b->[0] * $b->[1] } @SDL_MODES; |
2260 | @SDL_MODES = sort { $a->[0] * $a->[1] <=> $b->[0] * $b->[1] } @SDL_MODES; |
2206 | |
2261 | |
2207 | if (!exists $CFG->{sdl_mode} or $CFG->{sdl_mode} > $#SDL_MODES) { |
2262 | if (!defined $CFG->{sdl_mode} or $CFG->{sdl_mode} > $#SDL_MODES) { |
2208 | $CFG->{sdl_mode} = 0; |
2263 | $CFG->{sdl_mode} = 0; # lowest resolution by default |
|
|
2264 | |
|
|
2265 | # now choose biggets mode <= 1024x768 |
2209 | for (reverse 0 .. $#SDL_MODES) { |
2266 | for (0 .. $#SDL_MODES) { |
2210 | $CFG->{sdl_mode} = $_ if $SDL_MODES[$_][0] * $SDL_MODES[$_][1] >= 800 * 600; |
2267 | if ($SDL_MODES[$_][0] * $SDL_MODES[$_][1] <= 1024 * 768) { |
|
|
2268 | $CFG->{sdl_mode} = $_; |
|
|
2269 | } |
2211 | } |
2270 | } |
2212 | } |
2271 | } |
2213 | |
2272 | |
2214 | my ($old_w, $old_h) = ($WIDTH, $HEIGHT); |
2273 | my ($old_w, $old_h) = ($WIDTH, $HEIGHT); |
2215 | |
2274 | |
2216 | ($WIDTH, $HEIGHT, my ($rgb, $alpha)) = @{ $SDL_MODES[$CFG->{sdl_mode}] }; |
2275 | ($WIDTH, $HEIGHT, my ($rgb, $alpha)) = @{ $SDL_MODES[$CFG->{sdl_mode}] }; |
2217 | $FULLSCREEN = $CFG->{fullscreen}; |
2276 | $FULLSCREEN = $CFG->{fullscreen}; |
2218 | $FAST = $CFG->{fast}; |
2277 | $FAST = $CFG->{fast}; |
2219 | |
2278 | |
|
|
2279 | # due to mac os x braindamage, we simply retry with !fullscreen in case of an error |
2220 | DC::SDL_SetVideoMode $WIDTH, $HEIGHT, $rgb, $alpha, $FULLSCREEN |
2280 | DC::SDL_SetVideoMode $WIDTH, $HEIGHT, $rgb, $alpha, $FULLSCREEN |
|
|
2281 | or DC::SDL_SetVideoMode $WIDTH, $HEIGHT, $rgb, $alpha, !$FULLSCREEN |
2221 | or die "SDL_SetVideoMode failed: " . (DC::SDL_GetError) . "\n"; |
2282 | or die "SDL_SetVideoMode failed: " . (DC::SDL_GetError) . "\n"; |
2222 | |
2283 | |
2223 | $SDL_ACTIVE = 1; |
2284 | $SDL_ACTIVE = 1; |
2224 | $LAST_REFRESH = time - 0.01; |
2285 | $LAST_REFRESH = time - 0.01; |
2225 | |
2286 | |
… | |
… | |
2466 | delete $animate_object{$widget}; |
2527 | delete $animate_object{$widget}; |
2467 | } |
2528 | } |
2468 | |
2529 | |
2469 | %SDL_CB = ( |
2530 | %SDL_CB = ( |
2470 | DC::SDL_QUIT => sub { |
2531 | DC::SDL_QUIT => sub { |
|
|
2532 | crash "SDL_QUIT"; |
2471 | EV::unloop EV::UNLOOP_ALL; |
2533 | EV::unloop EV::UNLOOP_ALL; |
2472 | }, |
2534 | }, |
2473 | DC::SDL_VIDEORESIZE => sub { |
2535 | DC::SDL_VIDEORESIZE => sub { |
2474 | }, |
2536 | }, |
2475 | DC::SDL_VIDEOEXPOSE => sub { |
2537 | DC::SDL_VIDEOEXPOSE => sub { |
… | |
… | |
2515 | $SIG{INT} = $SIG{TERM} = sub { |
2577 | $SIG{INT} = $SIG{TERM} = sub { |
2516 | EV::unloop; |
2578 | EV::unloop; |
2517 | #d# TODO calling exit here hangs the process in some futex |
2579 | #d# TODO calling exit here hangs the process in some futex |
2518 | }; |
2580 | }; |
2519 | |
2581 | |
2520 | { |
2582 | # due to mac os x + sdl combined briandamage, we need this contortion |
|
|
2583 | sub main { |
|
|
2584 | { |
2521 | DC::Pod::load_docwiki DC::find_rcfile "docwiki.pst"; |
2585 | DC::Pod::load_docwiki DC::find_rcfile "docwiki.pst"; |
2522 | |
2586 | |
2523 | if (-e "$Deliantra::VARDIR/client.cf") { |
2587 | if (-e "$Deliantra::VARDIR/client.cf") { |
2524 | DC::read_cfg "$Deliantra::VARDIR/client.cf"; |
2588 | DC::read_cfg "$Deliantra::VARDIR/client.cf"; |
2525 | } else { |
2589 | } else { |
2526 | #TODO: compatibility cruft |
2590 | #TODO: compatibility cruft |
2527 | DC::read_cfg "$Deliantra::OLDDIR/cfplusrc"; |
2591 | DC::read_cfg "$Deliantra::OLDDIR/cfplusrc"; |
2528 | print STDERR "INFO: used old configuration file\n"; |
2592 | print STDERR "INFO: used old configuration file\n"; |
2529 | } |
2593 | } |
2530 | |
2594 | |
2531 | DC::DB::Server::run; |
2595 | DC::DB::Server::run; |
2532 | |
2596 | |
2533 | if ($CFG->{db_schema} < 1) { |
2597 | if ($CFG->{db_schema} < 1) { |
2534 | warn "INFO: upgrading database schema from 0 to 1, mapcache and tilecache will be lost\n"; |
2598 | warn "INFO: upgrading database schema from 0 to 1, mapcache and tilecache will be lost\n"; |
2535 | DC::DB::nuke_db; |
2599 | DC::DB::nuke_db; |
2536 | $CFG->{db_schema} = 1; |
2600 | $CFG->{db_schema} = 1; |
2537 | DC::write_cfg; |
2601 | DC::write_cfg; |
2538 | } |
2602 | } |
2539 | |
2603 | |
2540 | DC::DB::open_db; |
2604 | DC::DB::open_db; |
2541 | |
2605 | |
2542 | DC::UI::set_layout ($::CFG->{layout}); |
2606 | DC::UI::set_layout ($::CFG->{layout}); |
2543 | |
2607 | |
2544 | my %DEF_CFG = ( |
2608 | my %DEF_CFG = ( |
2545 | sdl_mode => 0, |
2609 | sdl_mode => undef, |
2546 | fullscreen => 1, |
2610 | fullscreen => 1, |
2547 | fast => 0, |
2611 | fast => 0, |
2548 | force_opengl11 => undef, |
2612 | force_opengl11 => undef, |
2549 | disable_alpha => 0, |
2613 | disable_alpha => 0, |
2550 | smooth_movement => 1, |
2614 | smooth_movement => 1, |
2551 | texture_compression => 1, |
2615 | texture_compression => 1, |
2552 | map_scale => 1, |
2616 | map_scale => 1, |
2553 | fow_enable => 1, |
2617 | fow_enable => 1, |
2554 | fow_intensity => 0, |
2618 | fow_intensity => 0, |
2555 | map_smoothing => 1, |
2619 | map_smoothing => 1, |
2556 | gui_fontsize => 1, |
2620 | gui_fontsize => 1, |
2557 | log_fontsize => 0.7, |
2621 | log_fontsize => 0.7, |
2558 | gauge_fontsize => 1, |
2622 | gauge_fontsize => 1, |
2559 | gauge_size => 0.35, |
2623 | gauge_size => 0.35, |
2560 | stat_fontsize => 0.7, |
2624 | stat_fontsize => 0.7, |
2561 | mapsize => 100, |
2625 | mapsize => 100, |
2562 | audio_enable => 1, |
2626 | audio_enable => 1, |
2563 | audio_hw_channels => 0, |
2627 | audio_hw_channels => 0, |
2564 | audio_hw_frequency => 0, |
2628 | audio_hw_frequency => 0, |
2565 | audio_hw_chunksize => 0, |
2629 | audio_hw_chunksize => 0, |
2566 | audio_mix_channels => 8, |
2630 | audio_mix_channels => 8, |
2567 | effects_enable => 1, |
2631 | effects_enable => 1, |
2568 | effects_volume => 1, |
2632 | effects_volume => 1, |
2569 | bgm_enable => 1, |
2633 | bgm_enable => 1, |
2570 | bgm_volume => 0.5, |
2634 | bgm_volume => 0.5, |
2571 | output_rate => "", |
2635 | output_rate => "", |
2572 | pickup => 0, |
2636 | pickup => 0, |
2573 | inv_sort => "mtime", |
2637 | inv_sort => "mtime", |
2574 | default => "profile", # default profile |
2638 | default => "profile", # default profile |
2575 | show_tips => 1, |
2639 | show_tips => 1, |
2576 | logview_max_par => 1000, |
2640 | logview_max_par => 1000, |
2577 | shift_fire_stop => 0, |
2641 | shift_fire_stop => 0, |
2578 | ); |
2642 | ); |
2579 | |
2643 | |
2580 | while (my ($k, $v) = each %DEF_CFG) { |
2644 | while (my ($k, $v) = each %DEF_CFG) { |
2581 | $CFG->{$k} = $v unless exists $CFG->{$k}; |
2645 | $CFG->{$k} = $v unless exists $CFG->{$k}; |
2582 | } |
2646 | } |
2583 | |
2647 | |
2584 | $CFG->{profile}{default}{host} ||= "gameserver.deliantra.net"; |
2648 | $CFG->{profile}{default}{host} ||= "gameserver.deliantra.net"; |
2585 | $PROFILE = $CFG->{profile}{default}; |
2649 | $PROFILE = $CFG->{profile}{default}; |
2586 | |
2650 | |
2587 | # convert old bindings (only default profile matters) |
2651 | # convert old bindings (only default profile matters) |
2588 | if (my $bindings = delete $PROFILE->{bindings}) { |
2652 | if (my $bindings = delete $PROFILE->{bindings}) { |
2589 | while (my ($mod, $syms) = each %$bindings) { |
2653 | while (my ($mod, $syms) = each %$bindings) { |
2590 | while (my ($sym, $cmds) = each %$syms) { |
2654 | while (my ($sym, $cmds) = each %$syms) { |
2591 | push @{ $PROFILE->{macro} }, { |
2655 | push @{ $PROFILE->{macro} }, { |
2592 | accelkey => [$mod*1, $sym*1], |
2656 | accelkey => [$mod*1, $sym*1], |
2593 | action => $cmds, |
2657 | action => $cmds, |
|
|
2658 | }; |
2594 | }; |
2659 | } |
2595 | } |
2660 | } |
2596 | } |
2661 | } |
2597 | } |
|
|
2598 | |
2662 | |
2599 | sdl_init; |
2663 | sdl_init; |
2600 | |
2664 | |
2601 | { |
2665 | { |
2602 | my @fonts = map DC::find_rcfile "fonts/$_", qw( |
2666 | my @fonts = map DC::find_rcfile "fonts/$_", qw( |
2603 | DejaVuSans.ttf |
2667 | DejaVuSans.ttf |
2604 | DejaVuSansMono.ttf |
2668 | DejaVuSansMono.ttf |
2605 | DejaVuSans-Bold.ttf |
2669 | DejaVuSans-Bold.ttf |
2606 | DejaVuSansMono-Bold.ttf |
2670 | DejaVuSansMono-Bold.ttf |
2607 | DejaVuSans-Oblique.ttf |
2671 | DejaVuSans-Oblique.ttf |
2608 | DejaVuSansMono-Oblique.ttf |
2672 | DejaVuSansMono-Oblique.ttf |
2609 | DejaVuSans-BoldOblique.ttf |
2673 | DejaVuSans-BoldOblique.ttf |
2610 | DejaVuSansMono-BoldOblique.ttf |
2674 | DejaVuSansMono-BoldOblique.ttf |
2611 | ); |
2675 | ); |
2612 | |
2676 | |
2613 | DC::add_font $_ for @fonts; |
2677 | DC::add_font $_ for @fonts; |
2614 | |
2678 | |
2615 | $FONT_PROP = new_from_file DC::Font $fonts[0]; |
2679 | $FONT_PROP = new_from_file DC::Font $fonts[0]; |
2616 | $FONT_FIXED = new_from_file DC::Font $fonts[1]; |
2680 | $FONT_FIXED = new_from_file DC::Font $fonts[1]; |
2617 | |
2681 | |
2618 | $FONT_PROP->make_default; |
2682 | $FONT_PROP->make_default; |
2619 | |
2683 | |
2620 | DC::pango_init; |
2684 | DC::pango_init; |
2621 | } |
2685 | } |
2622 | |
2686 | |
2623 | # compare mono (ft) vs. rgba (cairo) |
2687 | # compare mono (ft) vs. rgba (cairo) |
2624 | # ft - 1.8s, cairo 3s, even in alpha-only mode |
2688 | # ft - 1.8s, cairo 3s, even in alpha-only mode |
2625 | # for my $rgba (0..1) { |
2689 | # for my $rgba (0..1) { |
2626 | # my $t1 = Time::HiRes::time; |
2690 | # my $t1 = Time::HiRes::time; |
… | |
… | |
2631 | # } |
2695 | # } |
2632 | # my $t2 = Time::HiRes::time; |
2696 | # my $t2 = Time::HiRes::time; |
2633 | # warn $t2-$t1; |
2697 | # warn $t2-$t1; |
2634 | # } |
2698 | # } |
2635 | |
2699 | |
2636 | video_init; |
2700 | video_init; |
2637 | audio_init; |
2701 | audio_init; |
2638 | } |
2702 | } |
2639 | |
2703 | |
2640 | show_tip_of_the_day if $CFG->{show_tips}; |
2704 | show_tip_of_the_day if $CFG->{show_tips}; |
2641 | |
2705 | |
2642 | our $STARTUP_CANCEL = EV::idle sub { |
2706 | our $STARTUP_CANCEL = EV::idle sub { |
2643 | undef $::STARTUP_CANCEL; |
2707 | undef $::STARTUP_CANCEL; |
2644 | $startup_done->(); |
2708 | $startup_done->(); |
2645 | }; |
2709 | }; |
2646 | |
2710 | |
2647 | delete $SIG{__DIE__}; |
2711 | delete $SIG{__DIE__}; |
2648 | EV::loop; |
2712 | EV::loop; |
2649 | |
2713 | |
2650 | #video_shutdown; |
2714 | #video_shutdown; |
2651 | #audio_shutdown; |
2715 | #audio_shutdown; |
2652 | DC::OpenGL::quit; |
2716 | DC::OpenGL::quit; |
2653 | DC::SDL_Quit; |
2717 | DC::SDL_Quit; |
2654 | DC::DB::Server::stop; |
2718 | DC::DB::Server::stop; |
|
|
2719 | } |
|
|
2720 | |
|
|
2721 | DC::SDL_braino; # see sub above |
2655 | |
2722 | |
2656 | =head1 NAME |
2723 | =head1 NAME |
2657 | |
2724 | |
2658 | deliantra - A Deliantra MORPG game client |
2725 | deliantra - A Deliantra MORPG game client |
2659 | |
2726 | |