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.191 by root, Sun Jul 29 21:31:48 2007 UTC vs.
Revision 1.195 by root, Tue Jul 31 01:03:52 2007 UTC

168our $MUSIC_PLAYING_DATA; 168our $MUSIC_PLAYING_DATA;
169our $MUSIC_PLAYING_META; 169our $MUSIC_PLAYING_META;
170our $MUSIC_PLAYER; 170our $MUSIC_PLAYER;
171our $MUSIC_RESUME = 30; # resume music when players less than these many seconds before 171our $MUSIC_RESUME = 30; # resume music when players less than these many seconds before
172our @SOUNDS; # event => file mapping 172our @SOUNDS; # event => file mapping
173our %AUDIO_CHUNKS; # audio files 173our %AUDIO_CHUNK; # audio files
174 174
175our $ALT_ENTER_MESSAGE; 175our $ALT_ENTER_MESSAGE;
176our $STATUSBOX; 176our $STATUSBOX;
177our $DEBUG_STATUS; 177our $DEBUG_STATUS;
178 178
179our $INV; 179our $INV;
180our $INVR; 180our $INVR;
181our $INV_RIGHT_HB; 181our $INV_RIGHT_HB;
182 182
183our $PICKUP_CFG; 183our $PICKUP_CFG;
184
185#############################################################################
186#TODO: maybe move into own audio module...
187
188sub audio_channel_finished {
189 my ($channel) = @_;
190
191# warn "channel $channel finished\n";#d#
192}
193
194our %AUDIO_PLAY;
195our %AUDIO_CHUNK;
196
197sub audio_sound_push($) {
198 my ($face) = @_;
199
200 if (my $chunk = $AUDIO_CHUNK{$face}) {
201 for (grep $_->[0] >= Event::time, @{(delete $AUDIO_PLAY{$face}) || []}) {
202 my (undef, $dx, $dy, $vol) = @$_;
203
204 my $channel = CFPlus::Channel::find;
205 $channel->volume (128 + $vol);
206 $dx = $dx / 10 * 255;
207 $channel->set_panning ((min 255, 255 - $dx), (min 255, 255 + $dx));
208
209# my $angle = $dx ? : $dx < 0 ?
210# my $distance = -$vol;
211# $channel->set_position ($angle, $distance);
212
213 $chunk->play ($channel);
214 }
215 } else {
216 # sound_meta not set means data is in flight either way
217 my $meta = $CONN->{sound_meta}{$face}
218 or return;
219
220 # fetch from database
221 CFPlus::DB::get res_data => $meta->{name}, sub {
222 my $vol = $meta->{meta}{volume} || 1;
223 my $rwops = new CFPlus::RW $_[0];
224 my $chunk = new CFPlus::MixChunk $rwops;
225 $chunk->volume ($vol * 128);
226 $AUDIO_CHUNK{$face} = $chunk;
227
228 audio_sound_push ($face);
229 };
230 }
231}
232
233sub audio_sound_play {
234 my ($face, $dx, $dy, $vol) = @_;
235
236 $SDL_MIXER
237 or return;
238
239 my $queue = $AUDIO_PLAY{$face} ||= [];
240 push @$queue, [Event::time + 0.2, $dx, $dy, $vol]; # delay sound by max. 0.2s
241 audio_sound_push $face
242 unless @$queue > 1;
243}
244
245sub audio_music_update_volume {
246 return unless $MUSIC_PLAYING_META;
247 my $volume = $MUSIC_PLAYING_META->{meta}{volume} || 1;
248 my $base = $CFG->{bgm_volume};
249 CFPlus::MixMusic::volume $base * $volume * 128;
250}
251
252sub audio_music_set_ambient {
253 my ($songs) = @_;
254
255 my @want =
256 grep $_,
257 map $CONN->{music_meta}{$_},
258 @$songs;
259
260 if (@want) {
261 @MUSIC_WANT = @want;
262 &audio_music_changed ();
263 }
264}
265
266sub audio_music_start {
267 my $meta = $MUSIC_PLAYING_META;
268
269 CFPlus::DB::get res_data => $meta->{name}, sub {
270 return unless $SDL_MIXER;
271
272 # music might have changed...
273 $meta eq $MUSIC_PLAYING_META
274 or return &audio_music_start ();
275
276 audio_music_update_volume;
277
278 $MUSIC_PLAYING_DATA = \$_[0];
279
280 my $rwops = $meta->{path}
281 ? new_from_file CFPlus::RW $meta->{path}
282 : new CFPlus::RW $$MUSIC_PLAYING_DATA;
283
284 $MUSIC_PLAYER = new CFPlus::MixMusic $rwops
285 or ((warn CFPlus::Mix_GetError), return); # pretty fatal error
286
287 my $NOW = time;
288
289 if ($MUSIC_PLAYING_META->{stop_time} > $NOW - $MUSIC_RESUME) {
290 my $pos = $MUSIC_PLAYING_META->{stop_pos};
291 $MUSIC_PLAYER->fade_in_pos (0, 1000, $pos);
292 $MUSIC_START = time - $pos;
293 } else {
294 $MUSIC_PLAYER->play (0);
295 $MUSIC_START = time;
296 }
297
298 delete $MUSIC_PLAYING_META->{stop_time};
299 delete $MUSIC_PLAYING_META->{stop_pos};
300 }
301}
302
303sub audio_music_changed {
304 return unless $CFG->{bgm_enable};
305 return unless $SDL_MIXER;
306
307 # default MUSIC_WANT == MUSIC_DEFAULT
308 @MUSIC_WANT = { path => CFPlus::find_rcfile "music/$MUSIC_DEFAULT" } unless @MUSIC_WANT;
309
310 # if the currently playing song is acceptable, let it continue
311 return if $MUSIC_PLAYING_META
312 && grep $MUSIC_PLAYING_META == $_, @MUSIC_WANT;
313
314 my $NOW = time;
315
316 if ($MUSIC_PLAYING_META) {
317 $MUSIC_PLAYING_META->{stop_time} = $NOW;
318 $MUSIC_PLAYING_META->{stop_pos} = $NOW - $MUSIC_START;
319 CFPlus::MixMusic::fade_out 1000;
320 } else {
321 # sort by stop time, oldest first
322 @MUSIC_WANT = sort { $a->{stop_time} <=> $b->{stop_time} } @MUSIC_WANT;
323
324 # if the most recently-played piece played very recently,
325 # resume it, else choose the oldest piece for rotation.
326 $MUSIC_PLAYING_META =
327 $MUSIC_WANT[-1]{stop_time} > $NOW - $MUSIC_RESUME
328 ? $MUSIC_WANT[-1]
329 : $MUSIC_WANT[0];
330
331 audio_music_start;
332 }
333}
334
335sub audio_music_finished {
336 undef $MUSIC_PLAYER;
337 undef $MUSIC_PLAYING_META;
338 undef $MUSIC_PLAYING_DATA;
339
340 audio_music_changed;
341}
342
343#############################################################################
184 344
185sub status { 345sub status {
186 $STATUSBOX->add (CFPlus::asxml $_[0], pri => -10, group => "status", timeout => 10, fg => [1, 1, 0, 1]); 346 $STATUSBOX->add (CFPlus::asxml $_[0], pri => -10, group => "status", timeout => 10, fg => [1, 1, 0, 1]);
187} 347}
188 348
481 $SETUP_DIALOG->show; 641 $SETUP_DIALOG->show;
482 $PL_WINDOW->hide; 642 $PL_WINDOW->hide;
483 $SPELL_LIST->clear_spells; 643 $SPELL_LIST->clear_spells;
484 $CFPlus::UI::ROOT->emit (stop_game => ! ! $CONN); 644 $CFPlus::UI::ROOT->emit (stop_game => ! ! $CONN);
485 645
486 &audio_music_set ([]); 646 &audio_music_set_ambient ([]);
487 647
488 return unless $CONN; 648 return unless $CONN;
489 649
490 status "connection closed"; 650 status "connection closed";
491 651
648 on_changed => sub { $CFG->{bgm_enable} = $_[1]; 0 } 808 on_changed => sub { $CFG->{bgm_enable} = $_[1]; 0 }
649 ); 809 );
650 $hbox->add (new CFPlus::UI::Slider 810 $hbox->add (new CFPlus::UI::Slider
651 expand => 1, range => [$CFG->{bgm_volume}, 0, 1, 0, 1/128], 811 expand => 1, range => [$CFG->{bgm_volume}, 0, 1, 0, 1/128],
652 tooltip => "The volume of the background music. Changes are instant.", 812 tooltip => "The volume of the background music. Changes are instant.",
653 on_changed => sub { $CFG->{bgm_volume} = $_[1]; CFPlus::MixMusic::volume $_[1] * 128; 0 } 813 on_changed => sub { $CFG->{bgm_volume} = $_[1]; audio_music_update_volume; 0 }
654 ); 814 );
655 815
656 $table->add_at (1, $row++, new CFPlus::UI::Button 816 $table->add_at (1, $row++, new CFPlus::UI::Button
657 expand => 1, align => 0, text => "Apply", 817 expand => 1, align => 0, text => "Apply",
658 tooltip => "Apply the audio settings", 818 tooltip => "Apply the audio settings",
1071 text => $CFG->{profile}{default}{host}, 1231 text => $CFG->{profile}{default}{host},
1072 tooltip => "The hostname or ip address of the Crossfire(+) server to connect to", 1232 tooltip => "The hostname or ip address of the Crossfire(+) server to connect to",
1073 on_changed => sub { 1233 on_changed => sub {
1074 my ($self, $value) = @_; 1234 my ($self, $value) = @_;
1075 $CFG->{profile}{default}{host} = $value; 1235 $CFG->{profile}{default}{host} = $value;
1076 0 1236 1
1077 } 1237 }
1078 ); 1238 );
1079 1239
1080 $vbox->add (new CFPlus::UI::Button 1240 $vbox->add (new CFPlus::UI::Button
1081 expand => 1, 1241 expand => 1,
1082 text => "Server List", 1242 text => "Server List",
1083 other => $METASERVER, 1243 other => $METASERVER,
1084 tooltip => "Show a list of available crossfire servers", 1244 tooltip => "Show a list of available crossfire servers",
1085 on_activate => sub { $METASERVER->toggle_visibility; 0 }, 1245 on_activate => sub { $METASERVER->toggle_visibility; 0 },
1086 on_visibility_change => sub { $METASERVER->hide unless $_[1]; 0 }, 1246 on_visibility_change => sub { $METASERVER->hide unless $_[1]; 1 },
1087 ); 1247 );
1088 } 1248 }
1089 1249
1090 $table->add_at (0, 4, new CFPlus::UI::Label valign => 0, align => 1, text => "Username"); 1250 $table->add_at (0, 4, new CFPlus::UI::Label valign => 0, align => 1, text => "Username");
1091 $table->add_at (1, 4, new CFPlus::UI::Entry 1251 $table->add_at (1, 4, new CFPlus::UI::Entry
1092 text => $CFG->{profile}{default}{user}, 1252 text => $CFG->{profile}{default}{user},
1093 tooltip => "The name of your character on the server", 1253 tooltip => "The name of your character on the server",
1094 on_changed => sub { my ($self, $value) = @_; $CFG->{profile}{default}{user} = $value } 1254 on_changed => sub { my ($self, $value) = @_; $CFG->{profile}{default}{user} = $value; 1 }
1095 ); 1255 );
1096 1256
1097 $table->add_at (0, 5, new CFPlus::UI::Label valign => 0, align => 1, text => "Password"); 1257 $table->add_at (0, 5, new CFPlus::UI::Label valign => 0, align => 1, text => "Password");
1098 $table->add_at (1, 5, new CFPlus::UI::Entry 1258 $table->add_at (1, 5, new CFPlus::UI::Entry
1099 text => $CFG->{profile}{default}{password}, 1259 text => $CFG->{profile}{default}{password},
1100 hidden => 1, 1260 hidden => 1,
1101 tooltip => "The password for your character", 1261 tooltip => "The password for your character",
1102 on_changed => sub { my ($self, $value) = @_; $CFG->{profile}{default}{password} = $value } 1262 on_changed => sub { my ($self, $value) = @_; $CFG->{profile}{default}{password} = $value; 1 }
1103 ); 1263 );
1104 1264
1105 $table->add_at (0, 7, new CFPlus::UI::Label valign => 0, align => 1, text => "Map Size"); 1265 $table->add_at (0, 7, new CFPlus::UI::Label valign => 0, align => 1, text => "Map Size");
1106 $table->add_at (1, 7, new CFPlus::UI::Slider 1266 $table->add_at (1, 7, new CFPlus::UI::Slider
1107 force_w => 100, 1267 force_w => 100,
1108 range => [$CFG->{mapsize}, 10, 100, 0, 1], 1268 range => [$CFG->{mapsize}, 10, 100, 0, 1],
1109 tooltip => "This is the size of the portion of the map update the server sends you. " 1269 tooltip => "This is the size of the portion of the map update the server sends you. "
1110 . "If you set this to a high value you will be able to see further, " 1270 . "If you set this to a high value you will be able to see further, "
1111 . "but you also increase bandwidth requirements and latency. " 1271 . "but you also increase bandwidth requirements and latency. "
1112 . "This option is only used once at log-in.", 1272 . "This option is only used once at log-in.",
1113 on_changed => sub { my ($self, $value) = @_; $CFG->{mapsize} = $self->{range}[0] = $value = int $value; 0 }, 1273 on_changed => sub { my ($self, $value) = @_; $CFG->{mapsize} = $self->{range}[0] = $value = int $value; 1 },
1114 ); 1274 );
1115 1275
1116 $table->add_at (0, 8, new CFPlus::UI::Label valign => 0, align => 1, text => "Output-Rate"); 1276 $table->add_at (0, 8, new CFPlus::UI::Label valign => 0, align => 1, text => "Output-Rate");
1117 $table->add_at (1, 8, new CFPlus::UI::Entry 1277 $table->add_at (1, 8, new CFPlus::UI::Entry
1118 text => $CFG->{output_rate}, 1278 text => $CFG->{output_rate},
1119 tooltip => "The approximate bandwidth in bytes per second that the server should not exceed " 1279 tooltip => "The maximum bandwidth in bytes per second that the server should not exceed "
1120 . "when sending images, to ensure interactiveness. When 0 or unset, the server " 1280 . "when sending data. When 0 or unset, the server "
1121 . "default will be used, which is usually around 100kb/s.", 1281 . "default will be used, which is usually around 100kb/s. Most servers will "
1282 . "dynamically find an optimal rate, so adjust this only when necessary.",
1122 on_changed => sub { $CFG->{output_rate} = $_[1]; 0 }, 1283 on_changed => sub { $CFG->{output_rate} = $_[1]; 1 },
1123 ); 1284 );
1124 1285
1125 $table->add_at (0, 9, new CFPlus::UI::Label valign => 0, align => 1, text => "Output-Count"); 1286 $table->add_at (0, 9, new CFPlus::UI::Label valign => 0, align => 1, text => "Output-Count");
1126 $table->add_at (1, 9, new CFPlus::UI::Entry 1287 $table->add_at (1, 9, new CFPlus::UI::Entry
1127 text => $CFG->{output_count}, 1288 text => $CFG->{output_count},
1128 tooltip => "Should be set to 1 unless you know what you are doing. This option is only used once at log-in.", 1289 tooltip => "Should be set to 1 unless you know what you are doing. This option is only used once at log-in.",
1129 on_changed => sub { $CFG->{output_count} = $_[1]; 0 }, 1290 on_changed => sub { $CFG->{output_count} = $_[1]; 1 },
1130 ); 1291 );
1131 1292
1132 $table->add_at (0, 10, new CFPlus::UI::Label valign => 0, align => 1, text => "Output-Sync"); 1293 $table->add_at (0, 10, new CFPlus::UI::Label valign => 0, align => 1, text => "Output-Sync");
1133 $table->add_at (1, 10, new CFPlus::UI::Entry 1294 $table->add_at (1, 10, new CFPlus::UI::Entry
1134 text => $CFG->{output_sync}, 1295 text => $CFG->{output_sync},
1135 tooltip => "Should be set to 1 unless you know what you are doing. This option is only used once at log-in.", 1296 tooltip => "Should be set to 1 unless you know what you are doing. This option is only used once at log-in.",
1136 on_changed => sub { $CFG->{output_sync} = $_[1]; 0 }, 1297 on_changed => sub { $CFG->{output_sync} = $_[1]; 1 },
1137 ); 1298 );
1138 1299
1139 $table->add_at (1, 11, $LOGIN_BUTTON = new CFPlus::UI::Button 1300 $table->add_at (1, 11, $LOGIN_BUTTON = new CFPlus::UI::Button
1140 expand => 1, 1301 expand => 1,
1141 align => 0, 1302 align => 0,
1142 text => "Login", 1303 text => "Login",
1143 on_activate => sub { 1304 on_activate => sub {
1144 $CONN ? stop_game 1305 $CONN ? stop_game
1145 : start_game; 1306 : start_game;
1146 0 1307 1
1147 }, 1308 },
1148 ); 1309 );
1149 1310
1150 $vbox->add (new CFPlus::UI::FancyFrame 1311 $vbox->add (new CFPlus::UI::FancyFrame
1151 label => "Server Info", 1312 label => "Server Info",
1786 CFPlus::OpenGL::shutdown; 1947 CFPlus::OpenGL::shutdown;
1787 1948
1788 undef $SDL_ACTIVE; 1949 undef $SDL_ACTIVE;
1789} 1950}
1790 1951
1791sub audio_channel_finished {
1792 my ($channel) = @_;
1793
1794# warn "channel $channel finished\n";#d#
1795}
1796
1797our %AUDIO_PLAY;
1798our %AUDIO_CHUNK;
1799
1800sub audio_sound_push($) {
1801 my ($face) = @_;
1802
1803 if (my $chunk = $AUDIO_CHUNK{$face}) {
1804 for (grep $_->[0] >= Event::time, @{(delete $AUDIO_PLAY{$face}) || []}) {
1805 my (undef, $dx, $dy, $vol) = @$_;
1806
1807 my $channel = $chunk->play
1808 or return;
1809
1810 $channel->volume (128 + $vol);
1811 $dx = $dx / 10 * 255;
1812 $channel->set_panning ((min 255, 255 - $dx), (min 255, 255 + $dx));
1813# my $angle = $dx ? : $dx < 0 ?
1814# my $distance = -$vol;
1815# $channel->set_position ($angle, $distance);
1816 }
1817 } else {
1818 # sound_meta not set means data is in flight either way
1819 my $meta = $CONN->{sound_meta}{$face}
1820 or return;
1821
1822 # fetch from database
1823 CFPlus::DB::get res_data => $meta->{name}, sub {
1824 my $vol = $meta->{meta}{volume} || 100;
1825 my $rwops = new CFPlus::RW $_[0];
1826 my $chunk = new CFPlus::MixChunk $rwops;
1827 $chunk->volume ($vol * 128 / 100);
1828 $AUDIO_CHUNK{$face} = $chunk;
1829
1830 audio_sound_push ($face);
1831 };
1832 }
1833}
1834
1835sub audio_sound_play {
1836 my ($face, $dx, $dy, $vol) = @_;
1837
1838 $SDL_MIXER
1839 or return;
1840
1841 my $queue = $AUDIO_PLAY{$face} ||= [];
1842 push @$queue, [Event::time + 0.2, $dx, $dy, $vol]; # delay sound by max. 0.2s
1843 audio_sound_push $face
1844 unless @$queue > 1;
1845}
1846
1847sub audio_music_set {
1848 my ($songs) = @_;
1849
1850 my @want =
1851 grep $_,
1852 map $CONN->{music_meta}{$_},
1853 @$songs;
1854
1855 if (@want) {
1856 @MUSIC_WANT = @want;
1857 &audio_music_changed ();
1858 }
1859}
1860
1861sub audio_music_start {
1862 my $meta = $MUSIC_PLAYING_META;
1863
1864 CFPlus::DB::get res_data => $meta->{name}, sub {
1865 return unless $SDL_MIXER;
1866
1867 # music might have changed...
1868 $meta eq $MUSIC_PLAYING_META
1869 or return &audio_music_start ();
1870
1871 $MUSIC_PLAYING_DATA = \$_[0];
1872
1873 my $rwops = $meta->{path}
1874 ? new_from_file CFPlus::RW $meta->{path}
1875 : new CFPlus::RW $$MUSIC_PLAYING_DATA;
1876
1877 $MUSIC_PLAYER = new CFPlus::MixMusic $rwops
1878 or ((warn CFPlus::Mix_GetError), return); # pretty fatal error
1879
1880 my $NOW = time;
1881
1882 if ($MUSIC_PLAYING_META->{stop_time} > $NOW - $MUSIC_RESUME) {
1883 my $pos = $MUSIC_PLAYING_META->{stop_pos};
1884 $MUSIC_PLAYER->fade_in_pos (0, 1000, $pos);
1885 $MUSIC_START = time - $pos;
1886 } else {
1887 $MUSIC_PLAYER->play (0);
1888 $MUSIC_START = time;
1889 }
1890
1891 delete $MUSIC_PLAYING_META->{stop_time};
1892 delete $MUSIC_PLAYING_META->{stop_pos};
1893 }
1894}
1895
1896sub audio_music_changed {
1897 return unless $CFG->{bgm_enable};
1898 return unless $SDL_MIXER;
1899
1900 # default MUSIC_WANT == MUSIC_DEFAULT
1901 @MUSIC_WANT = { path => CFPlus::find_rcfile "music/$MUSIC_DEFAULT" } unless @MUSIC_WANT;
1902
1903 # if the currently playing song is acceptable, let it continue
1904 return if $MUSIC_PLAYING_META
1905 && grep $MUSIC_PLAYING_META == $_, @MUSIC_WANT;
1906
1907 my $NOW = time;
1908
1909 if ($MUSIC_PLAYING_META) {
1910 $MUSIC_PLAYING_META->{stop_time} = $NOW;
1911 $MUSIC_PLAYING_META->{stop_pos} = $NOW - $MUSIC_START;
1912 CFPlus::MixMusic::fade_out 1000;
1913 } else {
1914 # sort by stop time, oldest first
1915 @MUSIC_WANT = sort { $a->{stop_time} <=> $b->{stop_time} } @MUSIC_WANT;
1916
1917 # if the most recently-played piece played very recently,
1918 # resume it, else choose the oldest piece for rotation.
1919 $MUSIC_PLAYING_META =
1920 $MUSIC_WANT[-1]{stop_time} > $NOW - $MUSIC_RESUME
1921 ? $MUSIC_WANT[-1]
1922 : $MUSIC_WANT[0];
1923
1924 audio_music_start;
1925 }
1926}
1927
1928sub audio_music_finished {
1929 undef $MUSIC_PLAYER;
1930 undef $MUSIC_PLAYING_META;
1931 undef $MUSIC_PLAYING_DATA;
1932
1933 audio_music_changed;
1934}
1935
1936sub audio_init { 1952sub audio_init {
1937 if ($CFG->{audio_enable}) { 1953 if ($CFG->{audio_enable}) {
1938 $ENV{MIX_EFFECTSMAXSPEED} = 1; 1954 $ENV{MIX_EFFECTSMAXSPEED} = 1;
1939 $SDL_MIXER = !CFPlus::Mix_OpenAudio; 1955 $SDL_MIXER = !CFPlus::Mix_OpenAudio;
1940 1956
1942 status "Unable to open sound device: there will be no sound"; 1958 status "Unable to open sound device: there will be no sound";
1943 return; 1959 return;
1944 } 1960 }
1945 1961
1946 CFPlus::Mix_AllocateChannels 16; 1962 CFPlus::Mix_AllocateChannels 16;
1947 CFPlus::MixMusic::volume $CFG->{bgm_volume} * 128;
1948 1963
1949 audio_music_finished; 1964 audio_music_finished;
1950 } else { 1965 } else {
1951 undef $SDL_MIXER; 1966 undef $SDL_MIXER;
1952 } 1967 }
1954 1969
1955sub audio_shutdown { 1970sub audio_shutdown {
1956 CFPlus::Mix_CloseAudio if $SDL_MIXER; 1971 CFPlus::Mix_CloseAudio if $SDL_MIXER;
1957 undef $SDL_MIXER; 1972 undef $SDL_MIXER;
1958 @SOUNDS = (); 1973 @SOUNDS = ();
1959 %AUDIO_CHUNKS = (); 1974 %AUDIO_CHUNK = ();
1960} 1975}
1961 1976
1962my %animate_object; 1977my %animate_object;
1963my $animate_timer; 1978my $animate_timer;
1964 1979
1965my $fps = 9; 1980my $fps = 9;
1966
1967my %demo;#d#
1968 1981
1969sub force_refresh { 1982sub force_refresh {
1970 $fps = $fps * 0.95 + 1 / (($NOW - $LAST_REFRESH) || 0.1) * 0.05; 1983 $fps = $fps * 0.95 + 1 / (($NOW - $LAST_REFRESH) || 0.1) * 0.05;
1971 debug sprintf "%3.2f", $fps if $ENV{CFPLUS_DEBUG} & 4; 1984 debug sprintf "%3.2f", $fps if $ENV{CFPLUS_DEBUG} & 4;
1972 1985
2057 2070
2058 CFPlus::UI::set_layout ($::CFG->{layout}); 2071 CFPlus::UI::set_layout ($::CFG->{layout});
2059 2072
2060 my %DEF_CFG = ( 2073 my %DEF_CFG = (
2061 sdl_mode => 0, 2074 sdl_mode => 0,
2062 width => 640,
2063 height => 480,
2064 fullscreen => 0, 2075 fullscreen => 0,
2065 fast => 0, 2076 fast => 0,
2066 map_scale => 1, 2077 map_scale => 1,
2067 fow_enable => 1, 2078 fow_enable => 1,
2068 fow_intensity => 0, 2079 fow_intensity => 0,

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines