… | |
… | |
5 | use Coro; |
5 | use Coro; |
6 | use Coro::EV; |
6 | use Coro::EV; |
7 | use Coro::Debug; |
7 | use Coro::Debug; |
8 | our $debug = new_unix_server Coro::Debug "/tmp/dc"; |
8 | our $debug = new_unix_server Coro::Debug "/tmp/dc"; |
9 | '; |
9 | '; |
|
|
10 | die if $@; |
10 | } |
11 | } |
11 | |
12 | |
12 | # do splash-screen thingy on win32 |
13 | # do splash-screen thingy on win32 |
13 | my $startup_done = sub { }; |
14 | my $startup_done = sub { }; |
14 | BEGIN { |
15 | BEGIN { |
… | |
… | |
17 | $zip->extractMember ("SPLASH.bmp", "$ENV{PAR_TEMP}/SPLASH.bmp"); |
18 | $zip->extractMember ("SPLASH.bmp", "$ENV{PAR_TEMP}/SPLASH.bmp"); |
18 | } |
19 | } |
19 | |
20 | |
20 | require Win32::GUI::SplashScreen; |
21 | require Win32::GUI::SplashScreen; |
21 | |
22 | |
22 | # initialise the resolver now, as vista forces us back to the desktop |
|
|
23 | # when doing this. |
|
|
24 | use AnyEvent::DNS (); |
|
|
25 | AnyEvent::DNS::resolver; |
|
|
26 | |
|
|
27 | Win32::GUI::SplashScreen::Show ( |
23 | Win32::GUI::SplashScreen::Show ( |
28 | -file => "$ENV{PAR_TEMP}/SPLASH.bmp", |
24 | -file => "$ENV{PAR_TEMP}/SPLASH.bmp", |
29 | ); |
25 | ); |
|
|
26 | |
|
|
27 | # initialise the resolver now, as vista forces us back to the desktop |
|
|
28 | # when doing this later. |
|
|
29 | require AnyEvent::DNS; |
|
|
30 | AnyEvent::DNS::resolver (); |
30 | |
31 | |
31 | $startup_done = sub { |
32 | $startup_done = sub { |
32 | Win32::GUI::SplashScreen::Done (1); |
33 | Win32::GUI::SplashScreen::Done (1); |
33 | }; |
34 | }; |
34 | } |
35 | } |
… | |
… | |
143 | our $NOW; |
144 | our $NOW; |
144 | |
145 | |
145 | our $CFG; |
146 | our $CFG; |
146 | our $PROFILE; # current profile |
147 | our $PROFILE; # current profile |
147 | our $FAST; # fast, low-quality mode, possibly useful for software-rendering |
148 | our $FAST; # fast, low-quality mode, possibly useful for software-rendering |
|
|
149 | our $DELIANTRA_DEBUG = $ENV{DELIANTRA_DEBUG} * 1; |
148 | |
150 | |
149 | our $WANT_REFRESH; |
151 | our $WANT_REFRESH; |
150 | |
152 | |
151 | our $MODE_SLIDER; |
153 | our $MODE_SLIDER; |
152 | our $CAVEAT_LABEL; |
154 | our $CAVEAT_LABEL; |
… | |
… | |
517 | audio_music_push; |
519 | audio_music_push; |
518 | } |
520 | } |
519 | |
521 | |
520 | sub audio_init { |
522 | sub audio_init { |
521 | if ($CFG->{audio_enable}) { |
523 | if ($CFG->{audio_enable}) { |
|
|
524 | if (length $CFG->{audio_driver}) { |
|
|
525 | local $ENV{SDL_AUDIODRIVER} = $CFG->{audio_driver}; |
|
|
526 | DC::SDL_Init DC::SDL_INIT_AUDIO |
|
|
527 | and die "SDL::Init failed!\n"; |
|
|
528 | } else { |
|
|
529 | DC::SDL_Init DC::SDL_INIT_AUDIO |
|
|
530 | and die "SDL::Init failed!\n"; |
|
|
531 | } |
|
|
532 | |
522 | $ENV{MIX_EFFECTSMAXSPEED} = 1; |
533 | $ENV{MIX_EFFECTSMAXSPEED} = 1; |
523 | $SDL_MIXER = !DC::Mix_OpenAudio |
534 | $SDL_MIXER = !DC::Mix_OpenAudio |
524 | $CFG->{audio_hw_frequency}, |
535 | $CFG->{audio_hw_frequency}, |
525 | DC::MIX_DEFAULT_FORMAT, |
536 | DC::MIX_DEFAULT_FORMAT, |
526 | $CFG->{audio_hw_channels}, |
537 | $CFG->{audio_hw_channels}, |
… | |
… | |
556 | %AUDIO_PLAY = (); |
567 | %AUDIO_PLAY = (); |
557 | %AUDIO_CHUNK = (); |
568 | %AUDIO_CHUNK = (); |
558 | |
569 | |
559 | DC::Mix_CloseAudio if $SDL_MIXER; |
570 | DC::Mix_CloseAudio if $SDL_MIXER; |
560 | undef $SDL_MIXER; |
571 | undef $SDL_MIXER; |
|
|
572 | |
|
|
573 | DC::SDL_QuitSubSystem DC::SDL_INIT_AUDIO; |
561 | } |
574 | } |
562 | |
575 | |
563 | ############################################################################# |
576 | ############################################################################# |
564 | |
577 | |
565 | sub destroy_query_dialog { |
578 | sub destroy_query_dialog { |
… | |
… | |
806 | user => $PROFILE->{user}, |
819 | user => $PROFILE->{user}, |
807 | pass => $PROFILE->{password}, |
820 | pass => $PROFILE->{password}, |
808 | mapw => $mapw, |
821 | mapw => $mapw, |
809 | maph => $maph, |
822 | maph => $maph, |
810 | |
823 | |
811 | version => { |
824 | c_version => { |
812 | client => "deliantra", |
825 | client => "deliantra", |
813 | clientver => $DC::VERSION, |
826 | clientver => $DC::VERSION, |
814 | gl_vendor => DC::OpenGL::gl_vendor, |
827 | gl_vendor => DC::OpenGL::gl_vendor, |
815 | gl_version => DC::OpenGL::gl_version, |
828 | gl_version => DC::OpenGL::gl_version, |
816 | }, |
829 | }, |
… | |
… | |
853 | |
866 | |
854 | # hack to make SURE we find the IP address all right |
867 | # hack to make SURE we find the IP address all right |
855 | # can be removed once AnyEvent::DNS is proven stable. |
868 | # can be removed once AnyEvent::DNS is proven stable. |
856 | if ($host eq "gameserver.deliantra.net") { |
869 | if ($host eq "gameserver.deliantra.net") { |
857 | AnyEvent::DNS::a "dnstest.deliantra.net", sub { |
870 | AnyEvent::DNS::a "dnstest.deliantra.net", sub { |
858 | if ($_[0] ne "80.101.114.108") { # Perl |
871 | if ($_[0] ne "80.101.114.108") { # P-e-r-l |
859 | status "dns failure, trying differently"; |
872 | status "dns failure, trying differently"; |
860 | $host = eval { Socket::inet_ntoa Socket::inet_aton "gameserver.deliantra.net" }; |
873 | $host = eval { Socket::inet_ntoa Socket::inet_aton "gameserver.deliantra.net" }; |
861 | unless (defined $host) { |
874 | unless (defined $host) { |
862 | status "dns failure, using hardcoded address"; |
875 | status "dns failure, using hardcoded address"; |
863 | $host = "129.13.162.95"; |
876 | $host = "194.126.175.154"; |
864 | } |
877 | } |
865 | } |
878 | } |
866 | |
879 | |
867 | dc_connect $host, $port; |
880 | dc_connect $host, $port; |
868 | }; |
881 | }; |
… | |
… | |
1144 | ]); |
1157 | ]); |
1145 | |
1158 | |
1146 | my $text = !$freq |
1159 | my $text = !$freq |
1147 | ? "audio is off" |
1160 | ? "audio is off" |
1148 | : "audio is enabled\n" |
1161 | : "audio is enabled\n" |
|
|
1162 | . "driver: " . DC::SDL_AudioDriverName . "\n" |
1149 | . "frequency (Hz): $freq\n" |
1163 | . "frequency (Hz): $freq\n" |
1150 | . "channels: $chans\n" |
1164 | . "channels: $chans\n" |
1151 | . "chunk decoders available: " . (join ", ", DC::MixChunk::decoders) . "\n" |
1165 | . "chunk decoders available: " . (join ", ", DC::MixChunk::decoders) . "\n" |
1152 | . "music decoders available: " . (join ", ", DC::MixMusic::decoders); |
1166 | . "music decoders available: " . (join ", ", DC::MixMusic::decoders); |
1153 | |
1167 | |
1154 | $AUDIO_INFO->set_text ($text); |
1168 | $AUDIO_INFO->set_text ($text); |
1155 | } |
1169 | } |
1156 | |
1170 | |
1157 | sub audio_setup { |
1171 | sub audio_setup { |
… | |
… | |
1160 | $vbox->add (my $table = new DC::UI::Table expand => 1, col_expand => [0, 0, 1]); |
1174 | $vbox->add (my $table = new DC::UI::Table expand => 1, col_expand => [0, 0, 1]); |
1161 | |
1175 | |
1162 | my $row = 0; |
1176 | my $row = 0; |
1163 | |
1177 | |
1164 | $table->add_at (0, $row, new DC::UI::Label align => 1, text => "Audio Enable"); |
1178 | $table->add_at (0, $row, new DC::UI::Label align => 1, text => "Audio Enable"); |
1165 | $table->add_at (1, $row++, new DC::UI::CheckBox |
1179 | $table->add_at (1, $row, new DC::UI::CheckBox |
1166 | state => $CFG->{audio_enable}, |
1180 | state => $CFG->{audio_enable}, |
1167 | tooltip => "<b>Master Audio Enable.</b> If enabled, sound effects and music will be played. If disabled, no audio will be used and the soundcard will not be opened.", |
1181 | tooltip => "<b>Master Audio Enable.</b> If enabled, sound effects and music will be played. If disabled, no audio will be used and the soundcard will not be opened.", |
1168 | on_changed => sub { $CFG->{audio_enable} = $_[1]; 1 } |
1182 | on_changed => sub { $CFG->{audio_enable} = $_[1]; 1 } |
|
|
1183 | ); |
|
|
1184 | $table->add_at (2, $row++, my $driver = new DC::UI::HBox expand => 1); |
|
|
1185 | |
|
|
1186 | $driver->add (new DC::UI::Label align => 1, text => " Audio driver override"); |
|
|
1187 | $driver->add (new DC::UI::Entry |
|
|
1188 | text => $CFG->{audio_driver}, |
|
|
1189 | template => "dsound1234", |
|
|
1190 | tooltip => "You can override the audio driver to use here. Leaving it empty will result " |
|
|
1191 | . "in Deliantra picking one automatically. GNU/Linux users often prefer specific " |
|
|
1192 | . "drivers though, and can experiment with <b>alsa</b>, <b>dsp</b>, <b>esd</b>, <b>pulse</b>, <b>arts</b>, <b>nas</b> " |
|
|
1193 | . "or other system-specific drivers. Selecting the wrong driver here will simply result" |
|
|
1194 | . "in no sound.", |
|
|
1195 | on_changed => sub { my ($self, $value) = @_; $CFG->{audio_driver} = $value; 1 } |
1169 | ); |
1196 | ); |
1170 | |
1197 | |
1171 | $table->add_at (0, $row, new DC::UI::Label align => 1, text => "Sound Effects"); |
1198 | $table->add_at (0, $row, new DC::UI::Label align => 1, text => "Sound Effects"); |
1172 | $table->add_at (1, $row, new DC::UI::CheckBox |
1199 | $table->add_at (1, $row, new DC::UI::CheckBox |
1173 | expand => 1, state => $CFG->{effects_enable}, |
1200 | expand => 1, state => $CFG->{effects_enable}, |
… | |
… | |
1186 | ); |
1213 | ); |
1187 | |
1214 | |
1188 | $table->add_at (0, $row, new DC::UI::Label align => 1, text => "Background Music"); |
1215 | $table->add_at (0, $row, new DC::UI::Label align => 1, text => "Background Music"); |
1189 | $table->add_at (1, $row, new DC::UI::CheckBox |
1216 | $table->add_at (1, $row, new DC::UI::CheckBox |
1190 | expand => 1, state => $CFG->{bgm_enable}, |
1217 | expand => 1, state => $CFG->{bgm_enable}, |
1191 | tooltip => "If enabled, playing of background music is enabled. If disabled, no background music will be played.", |
1218 | tooltip => "If enabled, playing of background music is enabled. If disabled, no background music will be played. Needs server reconnect to take effect.", |
1192 | on_changed => sub { |
1219 | on_changed => sub { |
1193 | $CFG->{bgm_enable} = $_[1]; |
1220 | $CFG->{bgm_enable} = $_[1]; |
1194 | $CONN->update_fx_want if $CONN; |
1221 | $CONN->update_fx_want if $CONN; |
1195 | audio_music_push; |
1222 | audio_music_push; |
1196 | 1 |
1223 | 1 |
… | |
… | |
1207 | c_colspan => 2, expand => 1, |
1234 | c_colspan => 2, expand => 1, |
1208 | value => $CFG->{audio_hw_frequency}, |
1235 | value => $CFG->{audio_hw_frequency}, |
1209 | options => [ |
1236 | options => [ |
1210 | [ 0, "default" , "Use System Default"], |
1237 | [ 0, "default" , "Use System Default"], |
1211 | [11025, "11 kHz" , "11kHz (low quality)"], |
1238 | [11025, "11 kHz" , "11kHz (low quality)"], |
1212 | [22050, "22 kHz" , "22kHz (reduced quality)"], |
1239 | [22050, "22 kHz" , "22kHz (reduced quality, recommended)"], |
1213 | [44100, "44.1 kHz", "44.1kHz (cd quality)"], |
1240 | [44100, "44.1 kHz", "44.1kHz (cd quality)"], |
1214 | [48000, "48 kHz" , "48kHz (studio quality)"], |
1241 | [48000, "48 kHz" , "48kHz (studio quality, not recommended)"], |
1215 | ], |
1242 | ], |
1216 | tooltip => "The sampling frequency to use. Higher sounds better, but also more cpu-intensive and might cause stuttering.", |
1243 | tooltip => "The sampling frequency to use. Higher sounds better, but also more cpu-intensive and might cause stuttering.", |
1217 | on_changed => sub { |
1244 | on_changed => sub { |
1218 | $CFG->{audio_hw_frequency} = $_[1]; |
1245 | $CFG->{audio_hw_frequency} = $_[1]; |
1219 | audio_tab_update; |
1246 | audio_tab_update; |
… | |
… | |
1243 | $table->add_at (0, $row, new DC::UI::Label align => 1, text => "Latency"); |
1270 | $table->add_at (0, $row, new DC::UI::Label align => 1, text => "Latency"); |
1244 | $table->add_at (1, $row++, $AUDIO_HW_CHUNKSIZE = new DC::UI::Selector |
1271 | $table->add_at (1, $row++, $AUDIO_HW_CHUNKSIZE = new DC::UI::Selector |
1245 | c_colspan => 2, expand => 1, |
1272 | c_colspan => 2, expand => 1, |
1246 | value => $CFG->{audio_hw_chunksize}, |
1273 | value => $CFG->{audio_hw_chunksize}, |
1247 | tooltip => "The guarenteed latency. Lower is better, but also more cpu-intensive and might cause stuttering. If music playback " |
1274 | tooltip => "The guarenteed latency. Lower is better, but also more cpu-intensive and might cause stuttering. If music playback " |
1248 | . "is stuttering, increase this value. Values of 50-100ms are optimal.", |
1275 | . "is stuttering, increase this value. Values of 50-150ms are optimal.", |
1249 | on_changed => sub { |
1276 | on_changed => sub { |
1250 | $CFG->{audio_hw_chunksize} = $_[1]; |
1277 | $CFG->{audio_hw_chunksize} = $_[1]; |
1251 | audio_tab_update; |
1278 | audio_tab_update; |
1252 | 1 |
1279 | 1 |
1253 | } |
1280 | } |
… | |
… | |
1333 | &set_gauge_window_fontsize; |
1360 | &set_gauge_window_fontsize; |
1334 | |
1361 | |
1335 | $win |
1362 | $win |
1336 | } |
1363 | } |
1337 | |
1364 | |
|
|
1365 | our $BW_WATCHER; |
|
|
1366 | |
|
|
1367 | sub debug_toggle($) { |
|
|
1368 | $DELIANTRA_DEBUG ^= $_[0]; |
|
|
1369 | |
|
|
1370 | if ($DELIANTRA_DEBUG & 16) { |
|
|
1371 | $BW_WATCHER = EV::periodic 0, 1, 0, sub { |
|
|
1372 | return unless $CONN; |
|
|
1373 | debug sprintf "%8.2gKB/s", $CONN->{octets_in} / 1e3; |
|
|
1374 | $CONN->{octets_in} = 0; |
|
|
1375 | }; |
|
|
1376 | } else { |
|
|
1377 | undef $BW_WATCHER; |
|
|
1378 | } |
|
|
1379 | |
|
|
1380 | } |
|
|
1381 | |
1338 | sub debug_setup { |
1382 | sub debug_setup { |
1339 | my $table = new DC::UI::Table; |
1383 | my $table = new DC::UI::Table; |
1340 | |
1384 | |
1341 | $table->add_at (0, 0, new DC::UI::Label text => "Widget Borders"); |
1385 | $table->add_at (0, 0, new DC::UI::Label text => "Widget Borders"); |
1342 | $table->add_at (1, 0, new DC::UI::CheckBox on_changed => sub { $ENV{CFPLUS_DEBUG} ^= 1; 0 }); |
1386 | $table->add_at (1, 0, new DC::UI::CheckBox on_changed => sub { debug_toggle 1; 0 }); |
1343 | $table->add_at (0, 1, new DC::UI::Label text => "Tooltip Widget Info"); |
1387 | $table->add_at (0, 1, new DC::UI::Label text => "Tooltip Widget Info"); |
1344 | $table->add_at (1, 1, new DC::UI::CheckBox on_changed => sub { $ENV{CFPLUS_DEBUG} ^= 2; 0 }); |
1388 | $table->add_at (1, 1, new DC::UI::CheckBox on_changed => sub { debug_toggle 2; 0 }); |
1345 | $table->add_at (0, 2, new DC::UI::Label text => "Show FPS"); |
1389 | $table->add_at (0, 2, new DC::UI::Label text => "Show FPS"); |
1346 | $table->add_at (1, 2, new DC::UI::CheckBox on_changed => sub { $ENV{CFPLUS_DEBUG} ^= 4; 0 }); |
1390 | $table->add_at (1, 2, new DC::UI::CheckBox on_changed => sub { debug_toggle 4; 0 }); |
1347 | $table->add_at (0, 3, new DC::UI::Label text => "Suppress Tooltips"); |
1391 | $table->add_at (0, 3, new DC::UI::Label text => "Suppress Tooltips"); |
1348 | $table->add_at (1, 3, new DC::UI::CheckBox on_changed => sub { $ENV{CFPLUS_DEBUG} ^= 8; 0 }); |
1392 | $table->add_at (1, 3, new DC::UI::CheckBox on_changed => sub { debug_toggle 8; 0 }); |
|
|
1393 | $table->add_at (0, 4, new DC::UI::Label text => "Show Bandwidth"); |
|
|
1394 | $table->add_at (1, 4, new DC::UI::CheckBox on_changed => sub { debug_toggle 16; 0 }); |
|
|
1395 | |
1349 | $table->add_at (0, 4, new DC::UI::Button text => "die on click(tm)", on_activate => sub { &DC::debug() } ); |
1396 | $table->add_at (0, 6, new DC::UI::Button text => "die on click(tm)", on_activate => sub { &DC::debug() } ); |
1350 | |
|
|
1351 | $table->add_at (0, 5, new DC::UI::TextEdit text => "line1\0152\0153\nµikachu\nづx゙つ゛");#d# |
1397 | $table->add_at (0, 7, new DC::UI::TextEdit text => "line1\0152\0153\nµikachu\nづx゙つ゛");#d# |
1352 | |
1398 | |
1353 | $table->add_at (7,7, my $t = new DC::UI::Table expand => 0); |
1399 | $table->add_at (7,7, my $t = new DC::UI::Table expand => 0); |
1354 | $t->add_at (0,0, new DC::UI::Label text => "a a", c_rowspan => 1, c_colspan => 2); |
1400 | $t->add_at (0,0, new DC::UI::Label text => "a a", c_rowspan => 1, c_colspan => 2); |
1355 | $t->add_at (2,0, new DC::UI::Label text => "b\nb", c_rowspan => 2, c_colspan => 1, ellipsise => 0 ); |
1401 | $t->add_at (2,0, new DC::UI::Label text => "b\nb", c_rowspan => 2, c_colspan => 1, ellipsise => 0 ); |
1356 | $t->add_at (1,2, new DC::UI::Label text => "c c", c_rowspan => 1, c_colspan => 2); |
1402 | $t->add_at (1,2, new DC::UI::Label text => "c c", c_rowspan => 1, c_colspan => 2); |
… | |
… | |
1477 | para => ["Paralysation", |
1523 | para => ["Paralysation", |
1478 | "<b>Paralysation</b> (this resistance affects the chance you get paralysed)"], |
1524 | "<b>Paralysation</b> (this resistance affects the chance you get paralysed)"], |
1479 | deat => ["Death", |
1525 | deat => ["Death", |
1480 | "<b>Death</b> (resistance against death spells)"], |
1526 | "<b>Death</b> (resistance against death spells)"], |
1481 | phys => ["Physical", |
1527 | phys => ["Physical", |
1482 | "<b>Physical</b> (this is the resistance against physical attacks, like when a monster hit you in melee combat. The value displayed here is also displayed in the 'Arm' field on the left.)"], |
1528 | "<b>Physical</b> (this is the resistance against physical attacks, like when a monster hit you in melee combat. The value displayed here is also displayed as the 'Arm' secondary stat.)"], |
1483 | blind => ["Blind", |
1529 | blind => ["Blind", |
1484 | "<b>Blind</b> (blind resistance affects the chance of a successful blinding attack)"], |
1530 | "<b>Blind</b> (blind resistance affects the chance of a successful blinding attack)"], |
1485 | fear => ["Fear", |
1531 | fear => ["Fear", |
1486 | "<b>Fear</b> (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)"], |
1532 | "<b>Fear</b> (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)"], |
1487 | tund => ["Turn undead", |
1533 | tund => ["Turn undead", |
… | |
… | |
2418 | |
2464 | |
2419 | $dialog->show; |
2465 | $dialog->show; |
2420 | }; |
2466 | }; |
2421 | } |
2467 | } |
2422 | |
2468 | |
2423 | sub sdl_init { |
|
|
2424 | DC::SDL_Init DC::SDL_INIT_AUDIO #| DC::SDL_NOPARACHUTE |
|
|
2425 | and die "SDL::Init failed!\n"; |
|
|
2426 | } |
|
|
2427 | |
|
|
2428 | sub video_init { |
2469 | sub video_init { |
2429 | DC::set_theme $CFG->{uitheme}; |
2470 | DC::set_theme $CFG->{uitheme}; |
2430 | |
2471 | |
2431 | DC::SDL_InitSubSystem DC::SDL_INIT_VIDEO if $SDL_REINIT; |
2472 | DC::SDL_InitSubSystem DC::SDL_INIT_VIDEO if $SDL_REINIT; |
2432 | $SDL_REINIT = 0; |
2473 | $SDL_REINIT = 0; |
… | |
… | |
2491 | |
2532 | |
2492 | $DEBUG_STATUS = new DC::UI::Label |
2533 | $DEBUG_STATUS = new DC::UI::Label |
2493 | padding => 0, |
2534 | padding => 0, |
2494 | z => 100, |
2535 | z => 100, |
2495 | force_x => "max", |
2536 | force_x => "max", |
2496 | force_y => 0; |
2537 | force_y => 20; |
2497 | $DEBUG_STATUS->show; |
2538 | $DEBUG_STATUS->show; |
2498 | |
2539 | |
2499 | $STATUSBOX = new DC::UI::Statusbox; |
2540 | $STATUSBOX = new DC::UI::Statusbox; |
2500 | |
2541 | |
2501 | $MODBOX = new DC::UI::Label |
2542 | $MODBOX = new DC::UI::Label |
… | |
… | |
2629 | my $animate_timer; |
2670 | my $animate_timer; |
2630 | |
2671 | |
2631 | my $fps = 9; |
2672 | my $fps = 9; |
2632 | |
2673 | |
2633 | sub force_refresh { |
2674 | sub force_refresh { |
2634 | if ($ENV{CFPLUS_DEBUG} & 4) { |
2675 | if ($DELIANTRA_DEBUG & 4) { |
2635 | $fps = $fps * 0.98 + 1 / (($NOW - $LAST_REFRESH) || 0.1) * 0.02; |
2676 | $fps = $fps * 0.98 + 1 / (($NOW - $LAST_REFRESH) || 0.1) * 0.02; |
2636 | debug sprintf "%3.2f", $fps; |
2677 | debug sprintf "%3.2f", $fps; |
2637 | } |
2678 | } |
2638 | |
2679 | |
2639 | undef $WANT_REFRESH; |
2680 | undef $WANT_REFRESH; |
… | |
… | |
2792 | $CFG->{$k} = $v unless exists $CFG->{$k}; |
2833 | $CFG->{$k} = $v unless exists $CFG->{$k}; |
2793 | } |
2834 | } |
2794 | |
2835 | |
2795 | my @args = @ARGV; |
2836 | my @args = @ARGV; |
2796 | |
2837 | |
|
|
2838 | # OS X passes some process serial number of other shit. they |
|
|
2839 | # could have used an env var or any other sane mechanism. but |
|
|
2840 | # would it be os x then? no... |
|
|
2841 | shift @args if $args[0] =~ /^-psn_/; |
|
|
2842 | |
2797 | my $profile = 'default'; |
2843 | my $profile = 'default'; |
2798 | |
2844 | |
2799 | for (my $i = 0; $i < @args; $i++) { |
2845 | for (my $i = 0; $i < @args; $i++) { |
2800 | if ($args[$i] =~ /^--?profile$/) { |
2846 | if ($args[$i] =~ /^--?profile$/) { |
2801 | $profile = $args[$i + 1]; |
2847 | $profile = $args[$i + 1]; |
… | |
… | |
2824 | action => $cmds, |
2870 | action => $cmds, |
2825 | }; |
2871 | }; |
2826 | } |
2872 | } |
2827 | } |
2873 | } |
2828 | } |
2874 | } |
2829 | |
|
|
2830 | sdl_init; |
|
|
2831 | |
2875 | |
2832 | $ENV{FONTCONFIG_FILE} = DC::find_rcfile "fonts/fonts.conf"; |
2876 | $ENV{FONTCONFIG_FILE} = DC::find_rcfile "fonts/fonts.conf"; |
2833 | $ENV{FONTCONFIG_DIR} = DC::find_rcfile "fonts"; |
2877 | $ENV{FONTCONFIG_DIR} = DC::find_rcfile "fonts"; |
2834 | |
2878 | |
2835 | { |
2879 | { |
… | |
… | |
2866 | # } |
2910 | # } |
2867 | # my $t2 = Time::HiRes::time; |
2911 | # my $t2 = Time::HiRes::time; |
2868 | # warn $t2-$t1; |
2912 | # warn $t2-$t1; |
2869 | # } |
2913 | # } |
2870 | |
2914 | |
2871 | video_init; |
2915 | DC::IMG_Init; video_init; |
2872 | audio_init; |
2916 | DC::Mix_Init; audio_init; |
2873 | } |
2917 | } |
2874 | |
2918 | |
2875 | show_tip_of_the_day if $CFG->{show_tips}; |
2919 | show_tip_of_the_day if $CFG->{show_tips}; |
2876 | |
2920 | |
2877 | our $STARTUP_CANCEL = EV::idle sub { |
2921 | our $STARTUP_CANCEL = EV::idle sub { |
2878 | undef $::STARTUP_CANCEL; |
2922 | undef $::STARTUP_CANCEL; |
2879 | $startup_done->(); |
2923 | $startup_done->(); |
2880 | }; |
2924 | }; |
2881 | |
2925 | |
|
|
2926 | debug_toggle 0; |
|
|
2927 | |
2882 | delete $SIG{__DIE__}; |
2928 | delete $SIG{__DIE__}; |
2883 | EV::loop; |
2929 | EV::loop; |
2884 | |
2930 | |
2885 | DC::write_cfg if $CFG->{config_autosave}; |
2931 | DC::write_cfg if $CFG->{config_autosave}; |
2886 | |
2932 | |
… | |
… | |
2908 | The deliantra client utilises OpenGL for all UI elements and the game. It |
2954 | The deliantra client utilises OpenGL for all UI elements and the game. It |
2909 | is supposed to be used in fullscreen mode and interactively. |
2955 | is supposed to be used in fullscreen mode and interactively. |
2910 | |
2956 | |
2911 | =head1 DEBUGGING |
2957 | =head1 DEBUGGING |
2912 | |
2958 | |
2913 | CFPLUS_DEBUG - environment variable |
2959 | DELIANTRA_DEBUG - environment variable |
2914 | |
2960 | |
2915 | 1 draw borders around widgets |
2961 | 1 draw borders around widgets |
2916 | 2 add low-level widget info to tooltips |
2962 | 2 add low-level widget info to tooltips |
2917 | 4 show fps |
2963 | 4 show fps |
2918 | 8 suppress tooltips |
2964 | 8 suppress tooltips |
|
|
2965 | 16 show bandwidth downstream |
2919 | |
2966 | |
2920 | =head1 AUTHOR |
2967 | =head1 AUTHOR |
2921 | |
2968 | |
2922 | Marc Lehmann <deliantra@schmorp.de>, Robin Redeker <elmex@ta-sa.org> |
2969 | Marc Lehmann <deliantra@schmorp.de>, Robin Redeker <elmex@ta-sa.org> |
2923 | |
2970 | |