… | |
… | |
9 | use SDL; |
9 | use SDL; |
10 | use SDL::App; |
10 | use SDL::App; |
11 | use SDL::Event; |
11 | use SDL::Event; |
12 | use SDL::Surface; |
12 | use SDL::Surface; |
13 | |
13 | |
|
|
14 | use SDL::Mixer; |
14 | use SDL::Sound; |
15 | use SDL::Sound; |
15 | use SDL::Mixer; |
16 | use SDL::Music; |
16 | |
17 | |
17 | use SDL::OpenGL; |
18 | use SDL::OpenGL; |
18 | |
19 | |
19 | use Crossfire; |
20 | use Crossfire; |
20 | use Crossfire::Protocol; |
21 | use Crossfire::Protocol; |
21 | |
22 | |
22 | use Compress::LZF; |
23 | use Compress::LZF; |
23 | |
24 | |
24 | use CFClient; |
25 | use CFClient; |
25 | use CFClient::UI; |
26 | use CFClient::UI; |
|
|
27 | use CFClient::MapWidget; |
26 | |
28 | |
27 | our $VERSION = '0.1'; |
29 | our $VERSION = '0.1'; |
28 | |
30 | |
29 | my $MAX_FPS = 60; |
31 | my $MAX_FPS = 60; |
30 | my $MIN_FPS = 5; # unused as of yet |
32 | my $MIN_FPS = 5; # unused as of yet |
… | |
… | |
109 | } |
111 | } |
110 | |
112 | |
111 | sub client_setup { |
113 | sub client_setup { |
112 | my $dialog = new CFClient::UI::FancyFrame |
114 | my $dialog = new CFClient::UI::FancyFrame |
113 | child => (my $vbox = new CFClient::UI::VBox); |
115 | child => (my $vbox = new CFClient::UI::VBox); |
114 | $vbox->add (new CFClient::UI::Label align => 0, text => "Client Setup"); |
116 | $vbox->add (new CFClient::UI::Label valign => 0, align => 0, text => "Client Setup"); |
115 | $vbox->add (my $table = new CFClient::UI::Table expand => 1, col_expand => [0, 1]); |
117 | $vbox->add (my $table = new CFClient::UI::Table expand => 1, col_expand => [0, 1]); |
116 | |
118 | |
117 | $table->add (0, 0, new CFClient::UI::Label align => 1, text => "Video Mode"); |
119 | $table->add (0, 0, new CFClient::UI::Label valign => 0, align => 1, text => "Video Mode"); |
118 | $table->add (1, 0, my $hbox = new CFClient::UI::HBox); |
120 | $table->add (1, 0, my $hbox = new CFClient::UI::HBox); |
119 | |
121 | |
120 | $hbox->add (my $mode_slider = new CFClient::UI::Slider expand => 1, req_w => 100, range => [$CFG->{sdl_mode}, 0, scalar @SDL_MODES, 1]); |
122 | $hbox->add (my $mode_slider = new CFClient::UI::Slider expand => 1, req_w => 100, range => [$CFG->{sdl_mode}, 0, scalar @SDL_MODES, 1]); |
121 | $hbox->add (my $mode_label = new CFClient::UI::Label height => $FONTSIZE * 0.8); |
123 | $hbox->add (my $mode_label = new CFClient::UI::Label valign => 0, height => 0.8); |
122 | |
124 | |
123 | $mode_slider->connect (changed => sub { |
125 | $mode_slider->connect (changed => sub { |
124 | my ($self, $value) = @_; |
126 | my ($self, $value) = @_; |
125 | |
127 | |
126 | $CFG->{sdl_mode} = $self->{range}[0] = $value = int $value; |
128 | $CFG->{sdl_mode} = $self->{range}[0] = $value = int $value; |
127 | $mode_label->set_text (sprintf "%dx%d", @{$SDL_MODES[$value]}); |
129 | $mode_label->set_text (sprintf "%dx%d", @{$SDL_MODES[$value]}); |
128 | }); |
130 | }); |
129 | $mode_slider->emit (changed => $mode_slider->{range}[0]); |
131 | $mode_slider->emit (changed => $mode_slider->{range}[0]); |
130 | |
132 | |
131 | $table->add (0, 1, new CFClient::UI::Label align => 1, text => "Fullscreen"); |
133 | $table->add (0, 1, new CFClient::UI::Label valign => 0, align => 1, text => "Fullscreen"); |
132 | $table->add (1, 1, new CFClient::UI::CheckBox state => $CFG->{fullscreen}, connect_changed => sub { |
134 | $table->add (1, 1, new CFClient::UI::CheckBox state => $CFG->{fullscreen}, connect_changed => sub { |
133 | my ($self, $value) = @_; |
135 | my ($self, $value) = @_; |
134 | $CFG->{fullscreen} = $value; |
136 | $CFG->{fullscreen} = $value; |
135 | }); |
137 | }); |
136 | |
138 | |
137 | $table->add (0, 2, new CFClient::UI::Label align => 1, text => "Fast & Ugly"); |
139 | $table->add (0, 2, new CFClient::UI::Label valign => 0, align => 1, text => "Fast & Ugly"); |
138 | $table->add (1, 2, new CFClient::UI::CheckBox state => $CFG->{fast}, connect_changed => sub { |
140 | $table->add (1, 2, new CFClient::UI::CheckBox state => $CFG->{fast}, connect_changed => sub { |
139 | my ($self, $value) = @_; |
141 | my ($self, $value) = @_; |
140 | $CFG->{fast} = $value; |
142 | $CFG->{fast} = $value; |
141 | }); |
143 | }); |
142 | |
144 | |
143 | $table->add (0, 3, new CFClient::UI::Label align => 1, text => "Fog of War"); |
145 | $table->add (0, 3, new CFClient::UI::Label valign => 0, align => 1, text => "Fog of War"); |
144 | $table->add (1, 3, new CFClient::UI::CheckBox state => $CFG->{fow_enable}, connect_changed => sub { |
146 | $table->add (1, 3, new CFClient::UI::CheckBox state => $CFG->{fow_enable}, connect_changed => sub { |
145 | my ($self, $value) = @_; |
147 | my ($self, $value) = @_; |
146 | $CFG->{fow_enable} = $value; |
148 | $CFG->{fow_enable} = $value; |
147 | }); |
149 | }); |
148 | |
150 | |
149 | $table->add (0, 4, new CFClient::UI::Label align => 1, text => "FoW Intensity"); |
151 | $table->add (0, 4, new CFClient::UI::Label valign => 0, align => 1, text => "FoW Intensity"); |
150 | $table->add (1, 4, new CFClient::UI::Slider range => [$CFG->{fow_intensity}, 0, 1 + 0.001, 0.001], connect_changed => sub { |
152 | $table->add (1, 4, new CFClient::UI::Slider range => [$CFG->{fow_intensity}, 0, 1 + 0.001, 0.001], connect_changed => sub { |
151 | my ($self, $value) = @_; |
153 | my ($self, $value) = @_; |
152 | $CFG->{fow_intensity} = $value; |
154 | $CFG->{fow_intensity} = $value; |
153 | }); |
155 | }); |
154 | |
156 | |
155 | $table->add (0, 5, new CFClient::UI::Label align => 1, text => "FoW Smooth"); |
157 | $table->add (0, 5, new CFClient::UI::Label valign => 0, align => 1, text => "FoW Smooth"); |
156 | $table->add (1, 5, new CFClient::UI::CheckBox state => $CFG->{fow_smooth}, connect_changed => sub { |
158 | $table->add (1, 5, new CFClient::UI::CheckBox state => $CFG->{fow_smooth}, connect_changed => sub { |
157 | my ($self, $value) = @_; |
159 | my ($self, $value) = @_; |
158 | $CFG->{fow_smooth} = $value; |
160 | $CFG->{fow_smooth} = $value; |
159 | status "Fog of War smoothing requires OpenGL 1.2 or higher" if $CFClient::GL_VERSION < 1.2; |
161 | status "Fog of War smoothing requires OpenGL 1.2 or higher" if $CFClient::GL_VERSION < 1.2; |
160 | }); |
162 | }); |
161 | |
163 | |
162 | $table->add (0, 6, new CFClient::UI::Label align => 1, text => "Log Fontsize"); |
164 | $table->add (0, 6, new CFClient::UI::Label valign => 0, align => 1, text => "GUI Fontsize"); |
|
|
165 | $table->add (1, 6, new CFClient::UI::Slider range => [$CFG->{gui_fontsize}, 0.7, 1.7, 0.1], connect_changed => sub { |
|
|
166 | $CFG->{gui_fontsize} = 0.1 * int $_[1] * 10; |
|
|
167 | # $FONTSIZE = int $HEIGHT / 40 * $CFG->{gui_fontsize}; |
|
|
168 | }); |
|
|
169 | |
|
|
170 | $table->add (0, 7, new CFClient::UI::Label valign => 0, align => 1, text => "Server Log Fontsize"); |
163 | $table->add (1, 6, new CFClient::UI::Slider range => [$CFG->{log_fontsize}, 8, 30, 1], connect_changed => sub { |
171 | $table->add (1, 7, new CFClient::UI::Slider range => [$CFG->{log_fontsize}, 0.7, 1.7, 0.1], connect_changed => sub { |
164 | my ($self, $value) = @_; |
|
|
165 | $LOGVIEW->set_fontsize ($CFG->{log_fontsize} = int $value); |
172 | $LOGVIEW->set_fontsize ($CFG->{log_fontsize} = 0.1 * int $_[1] * 10); |
166 | }); |
173 | }); |
167 | |
174 | |
168 | $table->add (1, 7, new CFClient::UI::Button expand => 1, align => 0, text => "Apply", connect_activate => sub { |
175 | $table->add (1, 8, new CFClient::UI::Button expand => 1, align => 0, text => "Apply", connect_activate => sub { |
169 | video_shutdown (); |
176 | video_shutdown (); |
170 | video_init (); |
177 | video_init (); |
|
|
178 | }); |
|
|
179 | |
|
|
180 | $table->add (0, 9, new CFClient::UI::Label valign => 0, align => 1, text => "Audio Enable"); |
|
|
181 | $table->add (1, 9, new CFClient::UI::CheckBox state => $CFG->{audio_enable}, connect_changed => sub { |
|
|
182 | $CFG->{audio_enable} = $_[1]; |
|
|
183 | }); |
|
|
184 | # $table->add (0, 9, new CFClient::UI::Label valign => 0, align => 1, text => "Effects Volume"); |
|
|
185 | # $table->add (1, 8, new CFClient::UI::Slider range => [$CFG->{effects_volume}, 0, 128, 1], connect_changed => sub { |
|
|
186 | # $CFG->{effects_volume} = $_[1]; |
|
|
187 | # }); |
|
|
188 | $table->add (0, 10, new CFClient::UI::Label valign => 0, align => 1, text => "Background Music"); |
|
|
189 | $table->add (1, 10, my $hbox = new CFClient::UI::HBox); |
|
|
190 | $hbox->add (new CFClient::UI::CheckBox expand => 1, state => $CFG->{bgm_enable}, connect_changed => sub { |
|
|
191 | $CFG->{bgm_enable} = $_[1]; |
|
|
192 | }); |
|
|
193 | $hbox->add (new CFClient::UI::Slider expand => 1, range => [$CFG->{bgm_volume}, 0, 128, 1], connect_changed => sub { |
|
|
194 | $CFG->{bgm_volume} = $_[1]; |
|
|
195 | $SDL_MIXER->music_volume ($_[1]); |
|
|
196 | }); |
|
|
197 | |
|
|
198 | $table->add (1, 11, new CFClient::UI::Button expand => 1, align => 0, text => "Apply", connect_activate => sub { |
|
|
199 | audio_shutdown (); |
|
|
200 | audio_init (); |
171 | }); |
201 | }); |
172 | |
202 | |
173 | $dialog |
203 | $dialog |
174 | } |
204 | } |
175 | |
205 | |
… | |
… | |
239 | $HOST->set_text ($CFG->{host} = $host); |
269 | $HOST->set_text ($CFG->{host} = $host); |
240 | }), |
270 | }), |
241 | (new CFClient::UI::Empty expand => 1), |
271 | (new CFClient::UI::Empty expand => 1), |
242 | ]); |
272 | ]); |
243 | |
273 | |
244 | $table->add ($_ + 1, $y, new CFClient::UI::Label align => $align[$_], text => $m->[$_], fontsize => $FONTSIZE * 0.8) |
274 | $table->add ($_ + 1, $y, new CFClient::UI::Label align => $align[$_], text => $m->[$_], fontsize => 0.8) |
245 | for 0 .. $#$m; |
275 | for 0 .. $#$m; |
246 | } |
276 | } |
247 | } |
277 | } |
248 | }); |
278 | }); |
249 | } |
279 | } |
250 | |
280 | |
251 | sub server_setup { |
281 | sub server_setup { |
252 | my $dialog = new CFClient::UI::FancyFrame |
282 | my $dialog = new CFClient::UI::FancyFrame |
253 | child => (my $vbox = new CFClient::UI::VBox); |
283 | child => (my $vbox = new CFClient::UI::VBox); |
254 | |
284 | |
255 | $vbox->add (new CFClient::UI::Label align => 0, text => "Server Setup"); |
285 | $vbox->add (new CFClient::UI::Label valign => 0, align => 0, text => "Server Setup"); |
256 | $vbox->add (my $table = new CFClient::UI::Table expand => 1, col_expand => [0, 1]); |
286 | $vbox->add (my $table = new CFClient::UI::Table expand => 1, col_expand => [0, 1]); |
257 | $table->add (0, 2, new CFClient::UI::Label align => 1, text => "Host:Port"); |
287 | $table->add (0, 2, new CFClient::UI::Label valign => 0, align => 1, text => "Host:Port"); |
258 | |
288 | |
259 | { |
289 | { |
260 | $table->add (1, 2, my $vbox = new CFClient::UI::VBox); |
290 | $table->add (1, 2, my $vbox = new CFClient::UI::VBox); |
261 | |
291 | |
262 | $vbox->add (my $HOST = new CFClient::UI::Entry text => $CFG->{host}, connect_changed => sub { |
292 | $vbox->add (my $HOST = new CFClient::UI::Entry expand => 1, text => $CFG->{host}, connect_changed => sub { |
263 | my ($self, $value) = @_; |
293 | my ($self, $value) = @_; |
264 | $CFG->{host} = $value; |
294 | $CFG->{host} = $value; |
265 | }); |
295 | }); |
266 | |
296 | |
267 | $METASERVER = metaserver_dialog; |
297 | $METASERVER = metaserver_dialog; |
268 | |
298 | |
269 | $vbox->add (new CFClient::UI::Flopper text => "Metaserver", other => $METASERVER, connect_open => sub { |
299 | $vbox->add (new CFClient::UI::Flopper expand => 1, text => "Metaserver", other => $METASERVER, connect_open => sub { |
270 | update_metaserver $HOST; |
300 | update_metaserver $HOST; |
271 | }); |
301 | }); |
272 | } |
302 | } |
273 | |
303 | |
274 | $table->add (0, 4, new CFClient::UI::Label align => 1, text => "Username"); |
304 | $table->add (0, 4, new CFClient::UI::Label valign => 0, align => 1, text => "Username"); |
275 | $table->add (1, 4, new CFClient::UI::Entry text => $CFG->{user}, connect_changed => sub { |
305 | $table->add (1, 4, new CFClient::UI::Entry text => $CFG->{user}, connect_changed => sub { |
276 | my ($self, $value) = @_; |
306 | my ($self, $value) = @_; |
277 | $CFG->{user} = $value; |
307 | $CFG->{user} = $value; |
278 | }); |
308 | }); |
279 | |
309 | |
280 | $table->add (0, 5, new CFClient::UI::Label align => 1, text => "Password"); |
310 | $table->add (0, 5, new CFClient::UI::Label valign => 0, align => 1, text => "Password"); |
281 | $table->add (1, 5, new CFClient::UI::Entry text => $CFG->{password}, hidden => 1, connect_changed => sub { |
311 | $table->add (1, 5, new CFClient::UI::Entry text => $CFG->{password}, hidden => 1, connect_changed => sub { |
282 | my ($self, $value) = @_; |
312 | my ($self, $value) = @_; |
283 | $CFG->{password} = $value; |
313 | $CFG->{password} = $value; |
284 | }); |
314 | }); |
285 | |
315 | |
286 | $table->add (0, 6, new CFClient::UI::Label align => 1, text => "Def. say cmd"); |
316 | $table->add (0, 6, new CFClient::UI::Label valign => 0, align => 1, text => "Def. say cmd"); |
287 | $table->add (1, 6, my $saycmd = new CFClient::UI::Entry text => $CFG->{say_command}, connect_changed => sub { |
317 | $table->add (1, 6, my $saycmd = new CFClient::UI::Entry text => $CFG->{say_command}, connect_changed => sub { |
288 | my ($self, $value) = @_; |
318 | my ($self, $value) = @_; |
289 | $CFG->{say_command} = $value; |
319 | $CFG->{say_command} = $value; |
290 | }); |
320 | }); |
291 | |
321 | |
292 | $table->add (0, 7, new CFClient::UI::Label align => 1, text => "Map Size"); |
322 | $table->add (0, 7, new CFClient::UI::Label valign => 0, align => 1, text => "Map Size"); |
293 | $table->add (1, 7, new CFClient::UI::Slider |
323 | $table->add (1, 7, new CFClient::UI::Slider |
294 | req_w => 100, |
324 | req_w => 100, |
295 | range => [$CFG->{mapsize}, 10, 100 + 1, 1], |
325 | range => [$CFG->{mapsize}, 10, 100 + 1, 1], |
296 | connect_changed => sub { |
326 | connect_changed => sub { |
297 | my ($self, $value) = @_; |
327 | my ($self, $value) = @_; |
… | |
… | |
400 | |
430 | |
401 | $LAST_REFRESH = time - 0.01; |
431 | $LAST_REFRESH = time - 0.01; |
402 | |
432 | |
403 | CFClient::gl_init; |
433 | CFClient::gl_init; |
404 | |
434 | |
405 | $FONTSIZE = int $HEIGHT / 40; |
435 | $FONTSIZE = int $HEIGHT / 40 * $CFG->{gui_fontsize}; |
406 | |
436 | |
407 | ############################################################################# |
437 | ############################################################################# |
408 | |
438 | |
409 | $DEBUG_STATUS = new CFClient::UI::Label padding => 0, z => 100; |
439 | $DEBUG_STATUS = new CFClient::UI::Label padding => 0, z => 100; |
410 | $CFClient::UI::ROOT->add ($DEBUG_STATUS); |
440 | $DEBUG_STATUS->show; |
411 | |
441 | |
412 | $STATUS_LINE = new CFClient::UI::Label |
442 | $STATUS_LINE = new CFClient::UI::Label |
413 | padding => 0, |
443 | padding => 0, |
414 | y => $HEIGHT * 44 / 45 - $FONTSIZE; |
444 | y => $HEIGHT - $FONTSIZE * 1.8; |
415 | $CFClient::UI::ROOT->add ($STATUS_LINE); |
445 | $STATUS_LINE->show; |
416 | |
446 | |
417 | $ALT_ENTER_MESSAGE = new CFClient::UI::Label |
447 | $ALT_ENTER_MESSAGE = new CFClient::UI::Label |
418 | padding => 0, |
448 | padding => 0, |
419 | y => $HEIGHT * 44 / 45, |
|
|
420 | fontsize => $HEIGHT / 45, |
449 | fontsize => 0.8, |
421 | markup => "Use <b>Alt-Enter</b> to toggle fullscreen mode"; |
450 | markup => "Use <b>Alt-Enter</b> to toggle fullscreen mode"; |
422 | $CFClient::UI::ROOT->add ($ALT_ENTER_MESSAGE); |
451 | $ALT_ENTER_MESSAGE->show; |
|
|
452 | $ALT_ENTER_MESSAGE->move (0, $HEIGHT - $ALT_ENTER_MESSAGE->{h}); |
423 | |
453 | |
424 | $CFClient::UI::ROOT->add ($MAPWIDGET = new CFClient::UI::MapWidget); |
454 | $CFClient::UI::ROOT->add ($MAPWIDGET = new CFClient::MapWidget); |
425 | $MAPWIDGET->focus_in; |
455 | $MAPWIDGET->focus_in; |
426 | $MAPWIDGET->connect (activate_console => sub { |
456 | $MAPWIDGET->connect (activate_console => sub { |
427 | my ($mapwidget, $preset) = @_; |
457 | my ($mapwidget, $preset) = @_; |
428 | |
458 | |
429 | if ($CONSOLE) { |
459 | if ($CONSOLE) { |
… | |
… | |
465 | $CFClient::UI::ROOT->{children} = []; |
495 | $CFClient::UI::ROOT->{children} = []; |
466 | undef $SDL_ACTIVE; |
496 | undef $SDL_ACTIVE; |
467 | undef $SDL_EV; |
497 | undef $SDL_EV; |
468 | } |
498 | } |
469 | |
499 | |
|
|
500 | my $bgmusic;#TODO#hack#d# |
|
|
501 | |
470 | sub audio_init { |
502 | sub audio_init { |
471 | if ($CFG->{sound} || 1) { |
503 | if ($CFG->{audio_enable}) { |
472 | if (open my $fh, "<:utf8", CFClient::find_rcfile "sounds/config") { |
504 | if (open my $fh, "<:utf8", CFClient::find_rcfile "sounds/config") { |
|
|
505 | |
473 | $SDL_MIXER = new SDL::Mixer; |
506 | $SDL_MIXER = new SDL::Mixer |
|
|
507 | -rate => 22050, |
|
|
508 | -channels => 1, # mono |
|
|
509 | -size => 512; |
|
|
510 | |
474 | $SDL_MIXER->allocate_channels (8); |
511 | $SDL_MIXER->allocate_channels (8); |
|
|
512 | |
|
|
513 | # TODO: hack, do play loop and mood music |
|
|
514 | if ($CFG->{bgm_enable}) { |
|
|
515 | $bgmusic = new SDL::Music CFClient::find_rcfile "music/game3.ogg"; |
|
|
516 | $SDL_MIXER->play_music ($bgmusic, -1); |
|
|
517 | $SDL_MIXER->music_volume ($CFG->{bgm_volume}); |
|
|
518 | } |
475 | |
519 | |
476 | while (<$fh>) { |
520 | while (<$fh>) { |
477 | next if /^\s*#/; |
521 | next if /^\s*#/; |
478 | next if /^\s*$/; |
522 | next if /^\s*$/; |
479 | |
523 | |
… | |
… | |
750 | } |
794 | } |
751 | |
795 | |
752 | sub conn::sound_play { |
796 | sub conn::sound_play { |
753 | my ($self, $x, $y, $soundnum, $type) = @_; |
797 | my ($self, $x, $y, $soundnum, $type) = @_; |
754 | |
798 | |
|
|
799 | $SDL_MIXER |
|
|
800 | or return; |
|
|
801 | |
755 | my $chunk = $AUDIO_CHUNKS{$SOUNDS[$soundnum]} |
802 | my $chunk = $AUDIO_CHUNKS{$SOUNDS[$soundnum]} |
756 | or return; |
803 | or return; |
757 | |
804 | |
758 | $SDL_MIXER->play_channel (-1, $chunk); |
805 | $SDL_MIXER->play_channel (-1, $chunk); |
759 | warn "sound $x,$y,$soundnum,$type\n";#d# |
806 | # warn "sound $x,$y,$soundnum,$type\n";#d# |
760 | } |
807 | } |
761 | |
808 | |
762 | sub conn::query { |
809 | sub conn::query { |
763 | my ($self, $flags, $prompt) = @_; |
810 | my ($self, $flags, $prompt) = @_; |
764 | |
811 | |
765 | #TODO |
812 | #TODO, display dialog with relevant information |
766 | warn "<<<<QUERY:$flags:$prompt>>>\n";#d# |
813 | warn "<<<<QUERY:$flags:$prompt>>>\n";#d# |
767 | } |
814 | } |
768 | |
815 | |
769 | sub conn::drawinfo { |
816 | sub conn::drawinfo { |
770 | my ($self, $color, $text) = @_; |
817 | my ($self, $color, $text) = @_; |
… | |
… | |
784 | [0.99, 0.77, 0.26], |
831 | [0.99, 0.77, 0.26], |
785 | [0.74, 0.65, 0.41], |
832 | [0.74, 0.65, 0.41], |
786 | ); |
833 | ); |
787 | |
834 | |
788 | $LOGVIEW->add_paragraph ($color[$color], $text); |
835 | $LOGVIEW->add_paragraph ($color[$color], $text); |
|
|
836 | } |
|
|
837 | |
|
|
838 | sub conn::spell_add { |
|
|
839 | my ($self, $spell) = @_; |
|
|
840 | |
|
|
841 | $MAPWIDGET->add_command ("invoke $spell->{name}", $spell->{message}, sub { |
|
|
842 | }); |
|
|
843 | $MAPWIDGET->add_command ("cast $spell->{name}", $spell->{message}, sub { |
|
|
844 | }); |
|
|
845 | } |
|
|
846 | |
|
|
847 | sub conn::spell_delete { |
|
|
848 | my ($self, $spell) = @_; |
|
|
849 | } |
|
|
850 | |
|
|
851 | sub conn::addme_success { |
|
|
852 | my ($self) = @_; |
|
|
853 | |
|
|
854 | for my $skill (values %{$self->{skill_info}}) { |
|
|
855 | $MAPWIDGET->add_command ("ready_skill $skill", "", sub { |
|
|
856 | }); |
|
|
857 | $MAPWIDGET->add_command ("use_skill $skill", "", sub { |
|
|
858 | }); |
|
|
859 | } |
789 | } |
860 | } |
790 | |
861 | |
791 | %SDL_CB = ( |
862 | %SDL_CB = ( |
792 | SDL_QUIT() => sub { |
863 | SDL_QUIT() => sub { |
793 | Event::unloop -1; |
864 | Event::unloop -1; |
… | |
… | |
840 | fullscreen => 0, |
911 | fullscreen => 0, |
841 | fast => 0, |
912 | fast => 0, |
842 | fow_enable => 1, |
913 | fow_enable => 1, |
843 | fow_intensity => 0.45, |
914 | fow_intensity => 0.45, |
844 | fow_smooth => 0, |
915 | fow_smooth => 0, |
|
|
916 | gui_fontsize => 1, |
845 | log_fontsize => 14, |
917 | log_fontsize => 14, |
846 | mapsize => 100, |
918 | mapsize => 100, |
847 | host => "crossfire.schmorp.de", |
919 | host => "crossfire.schmorp.de", |
848 | say_command => 'say', |
920 | say_command => 'say', |
|
|
921 | audio_enable => 1, |
|
|
922 | bgm_enable => 1, |
|
|
923 | bgm_volume => 64, |
849 | ); |
924 | ); |
850 | |
925 | |
851 | while (my ($k, $v) = each %DEF_CFG) { |
926 | while (my ($k, $v) = each %DEF_CFG) { |
852 | $CFG->{$k} = $v unless exists $CFG->{$k}; |
927 | $CFG->{$k} = $v unless exists $CFG->{$k}; |
853 | } |
928 | } |