… | |
… | |
78 | } |
78 | } |
79 | |
79 | |
80 | # prepend private library directory |
80 | # prepend private library directory |
81 | BEGIN { |
81 | BEGIN { |
82 | for (grep !ref, @INC) { |
82 | for (grep !ref, @INC) { |
83 | my $path = "$_/Deliantra/Client/private/dc"; |
83 | my $path = "$_/Deliantra/Client/private"; |
84 | if (-d $path) { |
84 | if (-d $path) { |
85 | unshift @INC, $path; |
85 | unshift @INC, $path; |
86 | last; |
86 | last; |
87 | } |
87 | } |
88 | } |
88 | } |
… | |
… | |
108 | use DC::UI; |
108 | use DC::UI; |
109 | use DC::UI::Canvas; |
109 | use DC::UI::Canvas; |
110 | use DC::UI::Inventory; |
110 | use DC::UI::Inventory; |
111 | use DC::UI::SpellList; |
111 | use DC::UI::SpellList; |
112 | use DC::UI::Dockable; |
112 | use DC::UI::Dockable; |
|
|
113 | use DC::UI::Dockbar; |
113 | use DC::UI::MessageWindow; |
114 | use DC::UI::MessageWindow; |
114 | use DC::UI::ChatView; |
115 | use DC::UI::ChatView; |
|
|
116 | use DC::MessageDistributor; |
115 | use DC::Pod; |
117 | use DC::Pod; |
116 | use DC::MapWidget; |
118 | use DC::MapWidget; |
117 | use DC::Macro; |
119 | use DC::Macro; |
118 | |
120 | |
119 | $SIG{QUIT} = sub { Carp::cluck "QUIT" }; |
121 | $SIG{QUIT} = sub { Carp::cluck "QUIT" }; |
… | |
… | |
178 | our $SPELL_PAGE; |
180 | our $SPELL_PAGE; |
179 | our $SPELL_LIST; |
181 | our $SPELL_LIST; |
180 | |
182 | |
181 | our $HELP_WINDOW; |
183 | our $HELP_WINDOW; |
182 | our $MESSAGE_WINDOW; |
184 | our $MESSAGE_WINDOW; |
|
|
185 | our $MESSAGE_DIST; |
183 | our $FLOORBOX; |
186 | our $FLOORBOX; |
184 | our $GAUGES; |
187 | our $GAUGES; |
185 | our $STATWIDS; |
188 | our $STATWIDS; |
186 | |
189 | |
187 | our $SDL_ACTIVE; |
190 | our $SDL_ACTIVE; |
188 | our %SDL_CB; |
191 | our %SDL_CB; |
189 | |
192 | |
190 | our $ALT_ENTER_MESSAGE; |
193 | our $ALT_ENTER_MESSAGE; |
191 | our $STATUSBOX; |
194 | our $STATUSBOX; |
|
|
195 | our $MODBOX; |
192 | our $DEBUG_STATUS; |
196 | our $DEBUG_STATUS; |
193 | |
197 | |
194 | our $INV; |
198 | our $INV; |
195 | our $INVR; |
199 | our $INVR; |
196 | our $INVR_HB; |
200 | our $INVR_HB; |
… | |
… | |
204 | sub debug { |
208 | sub debug { |
205 | $DEBUG_STATUS->set_text ($_[0]); |
209 | $DEBUG_STATUS->set_text ($_[0]); |
206 | } |
210 | } |
207 | |
211 | |
208 | sub message { |
212 | sub message { |
209 | $MESSAGE_WINDOW->message (@_); |
213 | $MESSAGE_DIST->message (@_); |
|
|
214 | } |
|
|
215 | |
|
|
216 | sub update_modbox { |
|
|
217 | my $mod = DC::SDL_GetModState; |
|
|
218 | |
|
|
219 | my $markup; |
|
|
220 | |
|
|
221 | $markup .= $mod & DC::KMOD_CTRL |
|
|
222 | ? ($MAPWIDGET->{ctrl} ? "[REPEAT]" : "[<span foreground='#888'>REPEAT</span>]") |
|
|
223 | : "[<span foreground='#888'> once </span>]"; |
|
|
224 | |
|
|
225 | $markup .= $mod & DC::KMOD_SHIFT |
|
|
226 | ? ($MAPWIDGET->{shft} ? "[FIRE]" : "[<span foreground='#888'>FIRE</span>]") |
|
|
227 | : "[<span foreground='#888'>move</span>]"; |
|
|
228 | |
|
|
229 | $markup .= $mod & (DC::KMOD_ALT | DC::KMOD_META) |
|
|
230 | ? "[ALT]" |
|
|
231 | : "[<span foreground='#888'>alt</span>]"; |
|
|
232 | |
|
|
233 | $markup .= $mod & DC::KMOD_NUM |
|
|
234 | ? "[NUM]" |
|
|
235 | : "[<span foreground='#888'>num</span>]"; |
|
|
236 | |
|
|
237 | $MODBOX->set_markup ($markup); |
210 | } |
238 | } |
211 | |
239 | |
212 | ############################################################################# |
240 | ############################################################################# |
213 | #TODO: maybe move into own audio module... |
241 | #TODO: maybe move into own audio module... |
214 | |
242 | |
… | |
… | |
717 | user => $PROFILE->{user}, |
745 | user => $PROFILE->{user}, |
718 | pass => $PROFILE->{password}, |
746 | pass => $PROFILE->{password}, |
719 | mapw => $mapsize, |
747 | mapw => $mapsize, |
720 | maph => $mapsize, |
748 | maph => $mapsize, |
721 | |
749 | |
722 | client => "cfplus $DC::VERSION $] $^O", |
750 | client => "$DC::VERSION $] $^O", |
723 | |
751 | |
724 | map_widget => $MAPWIDGET, |
752 | map_widget => $MAPWIDGET, |
725 | statusbox => $STATUSBOX, |
753 | statusbox => $STATUSBOX, |
726 | map => $MAP, |
754 | map => $MAP, |
727 | mapmap => $MAPMAP, |
755 | mapmap => $MAPMAP, |
… | |
… | |
805 | ); |
833 | ); |
806 | |
834 | |
807 | $table->add_at (0, $row, new DC::UI::Label align => 1, text => "Force OpenGL 1.1"); |
835 | $table->add_at (0, $row, new DC::UI::Label align => 1, text => "Force OpenGL 1.1"); |
808 | $table->add_at (1, $row++, new DC::UI::CheckBox |
836 | $table->add_at (1, $row++, new DC::UI::CheckBox |
809 | state => $CFG->{force_opengl11}, |
837 | state => $CFG->{force_opengl11}, |
810 | tooltip => "Limit CFPlus to use OpenGL 1.1 features only. This will normally result in " |
838 | tooltip => "Limit Deliantra to use OpenGL 1.1 features only. This will normally result in " |
811 | . "higher memory usage and slower performance. It will, however, help tremendously on " |
839 | . "higher memory usage and slower performance. It will, however, help tremendously on " |
812 | . "cards that claim to support a feature but fall back to software rendering. " |
840 | . "cards that claim to support a feature but fall back to software rendering. " |
813 | . "Nvidia Geforce FX cards are known to claim features the hardware doesn't support, " |
841 | . "Nvidia Geforce FX cards are known to claim features the hardware doesn't support, " |
814 | . "but cards and drivers from other vendors (ATI) are often just as bad. <b>If you " |
842 | . "but cards and drivers from other vendors (ATI) are often just as bad. <b>If you " |
815 | . "experience extremely low framerates and your card should do better, try this option.</b>", |
843 | . "experience extremely low framerates and your card should do better, try this option.</b>", |
… | |
… | |
883 | $table->add_at (0, $row, new DC::UI::Label align => 1, text => "Message Fontsize"); |
911 | $table->add_at (0, $row, new DC::UI::Label align => 1, text => "Message Fontsize"); |
884 | $table->add_at (1, $row++, new DC::UI::Slider |
912 | $table->add_at (1, $row++, new DC::UI::Slider |
885 | range => [$CFG->{log_fontsize}, 0.5, 2, 0, 0.1], |
913 | range => [$CFG->{log_fontsize}, 0.5, 2, 0, 0.1], |
886 | tooltip => "The font size used by the <b>message/server log</b> window only. Changes are instant, " |
914 | tooltip => "The font size used by the <b>message/server log</b> window only. Changes are instant, " |
887 | . "but you still need to press apply to correctly re-layout the widget.", |
915 | . "but you still need to press apply to correctly re-layout the widget.", |
888 | on_changed => sub { $MESSAGE_WINDOW->set_fontsize ($CFG->{log_fontsize} = $_[1]); 0 }, |
916 | on_changed => sub { $MESSAGE_DIST->set_fontsize ($CFG->{log_fontsize} = $_[1]); 0 }, |
889 | ); |
917 | ); |
890 | |
918 | |
891 | $table->add_at (0, $row, new DC::UI::Label align => 1, text => "Gauge fontsize"); |
919 | $table->add_at (0, $row, new DC::UI::Label align => 1, text => "Gauge fontsize"); |
892 | $table->add_at (1, $row++, new DC::UI::Slider |
920 | $table->add_at (1, $row++, new DC::UI::Slider |
893 | range => [$CFG->{gauge_fontsize}, 0.5, 2, 0, 0.1], |
921 | range => [$CFG->{gauge_fontsize}, 0.5, 2, 0, 0.1], |
… | |
… | |
1525 | |
1553 | |
1526 | $vbox->add ( |
1554 | $vbox->add ( |
1527 | $HOST_ENTRY = new DC::UI::Entry |
1555 | $HOST_ENTRY = new DC::UI::Entry |
1528 | expand => 1, |
1556 | expand => 1, |
1529 | text => $CFG->{profile}{default}{host}, |
1557 | text => $CFG->{profile}{default}{host}, |
1530 | tooltip => "The hostname or ip address of the Deliantra server to connect to", |
1558 | tooltip => "The hostname or ip address of the Deliantra server to connect to (e.g. <b>gameserver.deliantra.net</b>)", |
1531 | on_changed => sub { |
1559 | on_changed => sub { |
1532 | my ($self, $value) = @_; |
1560 | my ($self, $value) = @_; |
1533 | $CFG->{profile}{default}{host} = $value; |
1561 | $CFG->{profile}{default}{host} = $value; |
1534 | 1 |
1562 | 1 |
1535 | } |
1563 | } |
… | |
… | |
1538 | if (0) { #d# disabled |
1566 | if (0) { #d# disabled |
1539 | $vbox->add (new DC::UI::Button |
1567 | $vbox->add (new DC::UI::Button |
1540 | expand => 1, |
1568 | expand => 1, |
1541 | text => "Server List", |
1569 | text => "Server List", |
1542 | other => $METASERVER, |
1570 | other => $METASERVER, |
1543 | tooltip => "Show a list of available crossfire servers", |
1571 | tooltip => "Show a list of available Deliantra servers", |
1544 | on_activate => sub { $METASERVER->toggle_visibility; 0 }, |
1572 | on_activate => sub { $METASERVER->toggle_visibility; 0 }, |
1545 | on_visibility_change => sub { $METASERVER->hide unless $_[1]; 1 }, |
1573 | on_visibility_change => sub { $METASERVER->hide unless $_[1]; 1 }, |
1546 | ); |
1574 | ); |
1547 | }#d# |
1575 | }#d# |
1548 | } |
1576 | } |
… | |
… | |
1598 | tooltip => "This is maximum number of messages remembered in the <b>Messages</b> window. If the server " |
1626 | tooltip => "This is maximum number of messages remembered in the <b>Messages</b> window. If the server " |
1599 | . "sends more messages than this number, older messages get removed to save memory and " |
1627 | . "sends more messages than this number, older messages get removed to save memory and " |
1600 | . "computing time. A value of <b>0</b> disables this feature, but that is not recommended.", |
1628 | . "computing time. A value of <b>0</b> disables this feature, but that is not recommended.", |
1601 | on_changed => sub { |
1629 | on_changed => sub { |
1602 | my ($self, $value) = @_; |
1630 | my ($self, $value) = @_; |
1603 | $MESSAGE_WINDOW->set_max_para ($CFG->{logview_max_par} = $value*1); |
1631 | $MESSAGE_DIST->set_max_par ($CFG->{logview_max_par} = $value*1); |
1604 | 0 |
1632 | 0 |
1605 | }, |
1633 | }, |
1606 | ); |
1634 | ); |
1607 | |
1635 | |
1608 | $table |
1636 | $table |
… | |
… | |
2143 | force_x => "max", |
2171 | force_x => "max", |
2144 | force_y => 0; |
2172 | force_y => 0; |
2145 | $DEBUG_STATUS->show; |
2173 | $DEBUG_STATUS->show; |
2146 | |
2174 | |
2147 | $STATUSBOX = new DC::UI::Statusbox; |
2175 | $STATUSBOX = new DC::UI::Statusbox; |
2148 | $STATUSBOX->add ("Use <b>Alt-Enter</b> to toggle fullscreen mode", timeout => 864000, pri => -100, color => [1, 1, 1, 0.8]); |
2176 | |
|
|
2177 | $MODBOX = new DC::UI::Label |
|
|
2178 | can_events => 1, |
|
|
2179 | can_hover => 1, |
|
|
2180 | markup => "", |
|
|
2181 | align => 0, |
|
|
2182 | font => $FONT_FIXED, |
|
|
2183 | tooltip => "#modifier_box"; |
|
|
2184 | |
|
|
2185 | update_modbox; |
2149 | |
2186 | |
2150 | (new DC::UI::Frame |
2187 | (new DC::UI::Frame |
2151 | bg => [0, 0, 0, 0.4], |
2188 | bg => [0, 0, 0, 0.4], |
2152 | force_x => 0, |
2189 | force_x => 0, |
2153 | force_y => "max", |
2190 | force_y => "max", |
2154 | child => $STATUSBOX, |
2191 | child => (my $LR = new DC::UI::VBox), |
2155 | )->show; |
2192 | )->show; |
|
|
2193 | |
|
|
2194 | $LR->add ($STATUSBOX); |
|
|
2195 | $LR->add ($MODBOX); |
|
|
2196 | $LR->add (new DC::UI::Label |
|
|
2197 | align => 0, |
|
|
2198 | markup => "Use <b>Alt-Enter</b> to toggle fullscreen mode", |
|
|
2199 | fontsize => 0.5, |
|
|
2200 | fg => [1, 1, 0, 0.7], |
|
|
2201 | ); |
2156 | |
2202 | |
2157 | DC::UI::Toplevel->new ( |
2203 | DC::UI::Toplevel->new ( |
2158 | title => "Minimap", |
2204 | title => "Minimap", |
2159 | name => "mapmap", |
2205 | name => "mapmap", |
2160 | x => 0, |
2206 | x => 0, |
… | |
… | |
2168 | |
2214 | |
2169 | $MAPWIDGET = new DC::MapWidget; |
2215 | $MAPWIDGET = new DC::MapWidget; |
2170 | $MAPWIDGET->connect (activate_console => sub { |
2216 | $MAPWIDGET->connect (activate_console => sub { |
2171 | my ($mapwidget, $preset) = @_; |
2217 | my ($mapwidget, $preset) = @_; |
2172 | |
2218 | |
2173 | $MESSAGE_WINDOW->activate_console ($preset) |
2219 | $MESSAGE_DIST->activate_console ($preset) |
2174 | if $MESSAGE_WINDOW; |
2220 | if $MESSAGE_DIST; |
2175 | }); |
2221 | }); |
2176 | $MAPWIDGET->show; |
2222 | $MAPWIDGET->show; |
2177 | $MAPWIDGET->grab_focus; |
2223 | $MAPWIDGET->grab_focus; |
2178 | |
2224 | |
2179 | $COMPLETER = new DC::MapWidget::Command:: |
2225 | $COMPLETER = new DC::MapWidget::Command:: |
… | |
… | |
2191 | force_h => $::HEIGHT * 0.6, |
2237 | force_h => $::HEIGHT * 0.6, |
2192 | has_close_button => 1, |
2238 | has_close_button => 1, |
2193 | ; |
2239 | ; |
2194 | |
2240 | |
2195 | $METASERVER = metaserver_dialog; |
2241 | $METASERVER = metaserver_dialog; |
2196 | $MESSAGE_WINDOW = new DC::UI::MessageWindow; |
2242 | $MESSAGE_WINDOW = new DC::UI::Dockbar (name => 'message_window', title => 'Messages'); |
|
|
2243 | $MESSAGE_DIST = new DC::MessageDistributor dockbar => $MESSAGE_WINDOW; |
2197 | |
2244 | |
2198 | $SETUP_DIALOG->add ($SETUP_NOTEBOOK = new DC::UI::Notebook expand => 1, debug => 1, |
2245 | $SETUP_DIALOG->add ($SETUP_NOTEBOOK = new DC::UI::Notebook expand => 1, debug => 1, |
2199 | filter => new DC::UI::ScrolledWindow expand => 1, scroll_y => 1); |
2246 | filter => new DC::UI::ScrolledWindow expand => 1, scroll_y => 1); |
2200 | |
2247 | |
2201 | $SETUP_NOTEBOOK->add_tab (Login => $SETUP_LOGIN = login_setup, |
2248 | $SETUP_NOTEBOOK->add_tab (Login => $SETUP_LOGIN = login_setup, |
… | |
… | |
2341 | # alt-enter |
2388 | # alt-enter |
2342 | $FULLSCREEN_ENABLE->toggle; |
2389 | $FULLSCREEN_ENABLE->toggle; |
2343 | video_shutdown; |
2390 | video_shutdown; |
2344 | video_init; |
2391 | video_init; |
2345 | } else { |
2392 | } else { |
2346 | DC::UI::feed_sdl_key_down_event ($_[0]); |
2393 | &DC::UI::feed_sdl_key_down_event; |
2347 | } |
2394 | } |
|
|
2395 | update_modbox; |
2348 | }, |
2396 | }, |
2349 | DC::SDL_KEYUP => \&DC::UI::feed_sdl_key_up_event, |
2397 | DC::SDL_KEYUP => sub { |
|
|
2398 | &DC::UI::feed_sdl_key_up_event; |
|
|
2399 | update_modbox; |
|
|
2400 | }, |
2350 | DC::SDL_MOUSEMOTION => \&DC::UI::feed_sdl_motion_event, |
2401 | DC::SDL_MOUSEMOTION => \&DC::UI::feed_sdl_motion_event, |
2351 | DC::SDL_MOUSEBUTTONDOWN => \&DC::UI::feed_sdl_button_down_event, |
2402 | DC::SDL_MOUSEBUTTONDOWN => \&DC::UI::feed_sdl_button_down_event, |
2352 | DC::SDL_MOUSEBUTTONUP => \&DC::UI::feed_sdl_button_up_event, |
2403 | DC::SDL_MOUSEBUTTONUP => \&DC::UI::feed_sdl_button_up_event, |
2353 | DC::SDL_USEREVENT => sub { |
2404 | DC::SDL_USEREVENT => sub { |
2354 | if ($_[0]{code} == 1) { |
2405 | if ($_[0]{code} == 1) { |
… | |
… | |
2370 | if (-e "$Deliantra::VARDIR/client.cf") { |
2421 | if (-e "$Deliantra::VARDIR/client.cf") { |
2371 | DC::read_cfg "$Deliantra::VARDIR/client.cf"; |
2422 | DC::read_cfg "$Deliantra::VARDIR/client.cf"; |
2372 | } else { |
2423 | } else { |
2373 | #TODO: compatibility cruft |
2424 | #TODO: compatibility cruft |
2374 | DC::read_cfg "$Deliantra::OLDDIR/cfplusrc"; |
2425 | DC::read_cfg "$Deliantra::OLDDIR/cfplusrc"; |
2375 | print STDERR "INFO: used old configuratrion file\n"; |
2426 | print STDERR "INFO: used old configuration file\n"; |
2376 | } |
2427 | } |
2377 | |
2428 | |
2378 | DC::DB::Server::run; |
2429 | DC::DB::Server::run; |
2379 | |
2430 | |
2380 | DC::UI::set_layout ($::CFG->{layout}); |
2431 | DC::UI::set_layout ($::CFG->{layout}); |