… | |
… | |
25 | # need to do it again because that pile of garbage called PAR nukes it before main |
25 | # need to do it again because that pile of garbage called PAR nukes it before main |
26 | unshift @INC, $ENV{PAR_TEMP} |
26 | unshift @INC, $ENV{PAR_TEMP} |
27 | if %PAR::LibCache; |
27 | if %PAR::LibCache; |
28 | |
28 | |
29 | use Time::HiRes 'time'; |
29 | use Time::HiRes 'time'; |
30 | use Pod::POM; |
|
|
31 | use Event; |
30 | use Event; |
32 | |
31 | |
33 | use Crossfire; |
32 | use Crossfire; |
34 | use Crossfire::Protocol::Constants; |
33 | use Crossfire::Protocol::Constants; |
35 | |
34 | |
… | |
… | |
38 | use CFClient; |
37 | use CFClient; |
39 | use CFClient::OpenGL (); |
38 | use CFClient::OpenGL (); |
40 | use CFClient::Protocol; |
39 | use CFClient::Protocol; |
41 | use CFClient::UI; |
40 | use CFClient::UI; |
42 | use CFClient::MapWidget; |
41 | use CFClient::MapWidget; |
|
|
42 | |
|
|
43 | $SIG{QUIT} = sub { Carp::cluck "QUIT" }; |
43 | |
44 | |
44 | $Event::DIED = sub { |
45 | $Event::DIED = sub { |
45 | # TODO: display dialog box or so |
46 | # TODO: display dialog box or so |
46 | Carp::confess $_[1];#d#TODO: remove when stable |
47 | Carp::confess $_[1];#d#TODO: remove when stable |
47 | CFClient::error $_[1]; |
48 | CFClient::error $_[1]; |
… | |
… | |
83 | our $CONSOLE; |
84 | our $CONSOLE; |
84 | our $METASERVER; |
85 | our $METASERVER; |
85 | our $LOGIN_BUTTON; |
86 | our $LOGIN_BUTTON; |
86 | our $QUIT_DIALOG; |
87 | our $QUIT_DIALOG; |
87 | our $HOST_ENTRY; |
88 | our $HOST_ENTRY; |
|
|
89 | our $SERVER_INFO; |
88 | |
90 | |
89 | our $SETUP_DIALOG; |
91 | our $SETUP_DIALOG; |
90 | our $SETUP_NOTEBOOK; |
92 | our $SETUP_NOTEBOOK; |
91 | our $SETUP_SERVER; |
93 | our $SETUP_SERVER; |
92 | our $SETUP_KEYBOARD; |
94 | our $SETUP_KEYBOARD; |
93 | our $SETUP_SPELLS; |
95 | our $SETUP_SPELLS; |
94 | |
96 | |
|
|
97 | our $STATS_WINDOW; |
|
|
98 | our $MESSAGE_WINDOW; |
95 | our $FLOORBOX; |
99 | our $FLOORBOX; |
96 | our $GAUGES; |
100 | our $GAUGES; |
97 | our $STATWIDS; |
101 | our $STATWIDS; |
98 | |
102 | |
99 | our $SDL_ACTIVE; |
103 | our $SDL_ACTIVE; |
… | |
… | |
122 | |
126 | |
123 | sub debug { |
127 | sub debug { |
124 | $DEBUG_STATUS->set_text ($_[0]); |
128 | $DEBUG_STATUS->set_text ($_[0]); |
125 | } |
129 | } |
126 | |
130 | |
|
|
131 | sub destroy_query_dialog { |
|
|
132 | (delete $_[0]{query_dialog})->destroy |
|
|
133 | if $_[0]{query_dialog}; |
|
|
134 | } |
|
|
135 | |
|
|
136 | # server query dialog |
|
|
137 | sub server_query { |
|
|
138 | my ($conn, $flags, $prompt) = @_; |
|
|
139 | |
|
|
140 | $conn->{query_dialog} = my $dialog = new CFClient::UI::FancyFrame |
|
|
141 | x => "center", |
|
|
142 | y => "center", |
|
|
143 | title => "Server Query", |
|
|
144 | child => my $vbox = new CFClient::UI::VBox, |
|
|
145 | ; |
|
|
146 | |
|
|
147 | my @dialog = my $label = new CFClient::UI::Label |
|
|
148 | max_w => $::WIDTH * 0.4, |
|
|
149 | ellipsise => 0, |
|
|
150 | text => $prompt; |
|
|
151 | |
|
|
152 | if ($flags & CS_QUERY_YESNO) { |
|
|
153 | push @dialog, my $hbox = new CFClient::UI::HBox; |
|
|
154 | |
|
|
155 | $hbox->add (new CFClient::UI::Button |
|
|
156 | text => "No", |
|
|
157 | on_activate => sub { |
|
|
158 | $conn->send ("reply n"); |
|
|
159 | $dialog->destroy; |
|
|
160 | 0 |
|
|
161 | } |
|
|
162 | ); |
|
|
163 | $hbox->add (new CFClient::UI::Button |
|
|
164 | text => "Yes", |
|
|
165 | on_activate => sub { |
|
|
166 | $conn->send ("reply y"); |
|
|
167 | destroy_query_dialog $conn; |
|
|
168 | 0 |
|
|
169 | }, |
|
|
170 | ); |
|
|
171 | |
|
|
172 | $dialog->grab_focus; |
|
|
173 | |
|
|
174 | } elsif ($flags & CS_QUERY_SINGLECHAR) { |
|
|
175 | $dialog->{tooltip} = "Press a key (click on the entry to make sure it has keyboard focus)"; |
|
|
176 | |
|
|
177 | if ($prompt =~ /Now choose a character|Press any key for the next race/i) { |
|
|
178 | $MESSAGE_WINDOW->show; |
|
|
179 | |
|
|
180 | unshift @dialog, new CFClient::UI::Label |
|
|
181 | max_w => $::WIDTH * 0.4, |
|
|
182 | ellipsise => 0, |
|
|
183 | markup => "\nOr use your keyboard:\n"; |
|
|
184 | |
|
|
185 | unshift @dialog, my $table = new CFClient::UI::Table; |
|
|
186 | |
|
|
187 | $table->add (0, 0, new CFClient::UI::Button |
|
|
188 | text => "Next Race", |
|
|
189 | on_activate => sub { |
|
|
190 | $conn->send ("reply n"); |
|
|
191 | destroy_query_dialog $conn; |
|
|
192 | 0 |
|
|
193 | }, |
|
|
194 | ); |
|
|
195 | $table->add (2, 0, new CFClient::UI::Button |
|
|
196 | text => "Accept", |
|
|
197 | on_activate => sub { |
|
|
198 | $conn->send ("reply d"); |
|
|
199 | destroy_query_dialog $conn; |
|
|
200 | 0 |
|
|
201 | }, |
|
|
202 | ); |
|
|
203 | |
|
|
204 | unshift @dialog, new CFClient::UI::Label |
|
|
205 | max_w => $::WIDTH * 0.4, |
|
|
206 | ellipsise => 0, |
|
|
207 | markup => |
|
|
208 | "<big><b>Character Creation: Race</b></big>\n\n" |
|
|
209 | . "Look at the <b>Messages</b> window to see a description of this race " |
|
|
210 | . "(<small>or hover with your mouse over the bottommost entry in the status area in the lower left area of the screen</small>) " |
|
|
211 | . "and the center of the screen to see how this race looks like " |
|
|
212 | . "(<small>this is below this dialog window, you may need to click on the display area to make it visible</small>).\n\n" |
|
|
213 | . "You can look at another race, or accept this race (you will come back to this race eventually, " |
|
|
214 | . "so you can take your time making this important choice." |
|
|
215 | ; |
|
|
216 | |
|
|
217 | } elsif ($prompt =~ /roll new stats/) { |
|
|
218 | if (my $stat = delete $conn->{stat_change_with}) { |
|
|
219 | $conn->send ("reply $stat"); |
|
|
220 | destroy_query_dialog $conn; |
|
|
221 | return; |
|
|
222 | } |
|
|
223 | |
|
|
224 | $STATS_WINDOW->show; |
|
|
225 | $MESSAGE_WINDOW->hide; |
|
|
226 | |
|
|
227 | unshift @dialog, new CFClient::UI::Label |
|
|
228 | max_w => $::WIDTH * 0.4, |
|
|
229 | ellipsise => 0, |
|
|
230 | markup => "\nOr use your keyboard:\n"; |
|
|
231 | |
|
|
232 | unshift @dialog, my $table = new CFClient::UI::Table; |
|
|
233 | |
|
|
234 | # left: re-roll |
|
|
235 | $table->add (0, 0, new CFClient::UI::Button |
|
|
236 | text => "Roll Again", |
|
|
237 | on_activate => sub { |
|
|
238 | $conn->send ("reply y"); |
|
|
239 | destroy_query_dialog $conn; |
|
|
240 | 0 |
|
|
241 | }, |
|
|
242 | ); |
|
|
243 | |
|
|
244 | # center: swap stats |
|
|
245 | my ($sw1, $sw2) = map +(new CFClient::UI::Combobox |
|
|
246 | value => $_, |
|
|
247 | options => [ |
|
|
248 | [1 => "Str", "Strength ($conn->{stat}{+CS_STAT_STR})"], |
|
|
249 | [2 => "Dex", "Dexterity ($conn->{stat}{+CS_STAT_DEX})"], |
|
|
250 | [3 => "Con", "Constitution ($conn->{stat}{+CS_STAT_CON})"], |
|
|
251 | [4 => "Int", "Intelligence ($conn->{stat}{+CS_STAT_INT})"], |
|
|
252 | [5 => "Wis", "Wisdom ($conn->{stat}{+CS_STAT_WIS})"], |
|
|
253 | [6 => "Pow", "Power ($conn->{stat}{+CS_STAT_POW})"], |
|
|
254 | [7 => "Cha", "Charisma ($conn->{stat}{+CS_STAT_CHA})"], |
|
|
255 | ], |
|
|
256 | ), 1 .. 2; |
|
|
257 | |
|
|
258 | $table->add (2, 0, new CFClient::UI::Button |
|
|
259 | text => "Swap Stats", |
|
|
260 | on_activate => sub { |
|
|
261 | $conn->{stat_change_with} = $sw2->{value}; |
|
|
262 | $conn->send ("reply $sw1->{value}"); |
|
|
263 | destroy_query_dialog $conn; |
|
|
264 | 0 |
|
|
265 | }, |
|
|
266 | ); |
|
|
267 | $table->add (2, 1, new CFClient::UI::HBox children => [$sw1, $sw2]); |
|
|
268 | |
|
|
269 | # right: accept |
|
|
270 | $table->add (4, 0, new CFClient::UI::Button |
|
|
271 | text => "Accept", |
|
|
272 | on_activate => sub { |
|
|
273 | $conn->send ("reply n"); |
|
|
274 | $STATS_WINDOW->hide; |
|
|
275 | destroy_query_dialog $conn; |
|
|
276 | 0 |
|
|
277 | }, |
|
|
278 | ); |
|
|
279 | |
|
|
280 | unshift @dialog, new CFClient::UI::Label |
|
|
281 | max_w => $::WIDTH * 0.4, |
|
|
282 | ellipsise => 0, |
|
|
283 | markup => |
|
|
284 | "<big><b>Character Creation: Stats</b></big>\n\n" |
|
|
285 | . "Look at the <b>Stats</b> window to see your basic stats " |
|
|
286 | . "(first column: 1 strength, 2 dexterity, 3 constitution, 4 intelligence, 5 wisdom, 6 power and 7 charisma).\n\n" |
|
|
287 | . "You can create another set of stats, swap two stat values with each other or accept the stats as they are now and continue. " |
|
|
288 | . "Race selection will influence those values later on." |
|
|
289 | ; |
|
|
290 | } |
|
|
291 | |
|
|
292 | push @dialog, my $entry = new CFClient::UI::Entry |
|
|
293 | on_changed => sub { |
|
|
294 | $conn->send ("reply $_[1]"); |
|
|
295 | destroy_query_dialog $conn; |
|
|
296 | 0 |
|
|
297 | }, |
|
|
298 | ; |
|
|
299 | |
|
|
300 | $entry->grab_focus; |
|
|
301 | |
|
|
302 | } else { |
|
|
303 | $dialog->{tooltip} = "Enter the reply and press return (click on the entry to make sure it has keyboard focus)"; |
|
|
304 | |
|
|
305 | push @dialog, my $entry = new CFClient::UI::Entry |
|
|
306 | $flags & CS_QUERY_HIDEINPUT ? (hidden => "*") : (), |
|
|
307 | on_activate => sub { |
|
|
308 | $conn->send ("reply $_[1]"); |
|
|
309 | destroy_query_dialog $conn; |
|
|
310 | 0 |
|
|
311 | }, |
|
|
312 | ; |
|
|
313 | |
|
|
314 | $entry->grab_focus; |
|
|
315 | } |
|
|
316 | |
|
|
317 | $vbox->add (@dialog); |
|
|
318 | $dialog->show; |
|
|
319 | } |
|
|
320 | |
127 | sub start_game { |
321 | sub start_game { |
128 | status "logging in..."; |
322 | status "logging in..."; |
129 | |
323 | |
130 | $LOGIN_BUTTON->set_text ("Logout"); |
324 | $LOGIN_BUTTON->set_text ("Logout"); |
131 | $SETUP_DIALOG->hide; |
325 | $SETUP_DIALOG->hide; |
132 | |
326 | |
133 | my $mapsize = List::Util::min 32, List::Util::max 11, int $WIDTH * $CFG->{mapsize} * 0.01 / 32; |
327 | my $mapsize = List::Util::min 32, List::Util::max 11, int $WIDTH * $CFG->{mapsize} * 0.01 / 32; |
134 | |
328 | |
135 | my ($host, $port) = split /:/, $CFG->{host}; |
329 | my ($host, $port) = split /:/, $CFG->{profile}{default}{host}; |
136 | |
330 | |
137 | $MAP = new CFClient::Map $mapsize, $mapsize; |
331 | $MAP = new CFClient::Map $mapsize, $mapsize; |
138 | |
332 | |
139 | $CONN = eval { |
333 | $CONN = eval { |
140 | new CFClient::Protocol |
334 | new CFClient::Protocol |
141 | host => $host, |
335 | host => $host, |
142 | port => $port || 13327, |
336 | port => $port || 13327, |
143 | user => $CFG->{user}, |
337 | user => $CFG->{profile}{default}{user}, |
144 | pass => $CFG->{password}, |
338 | pass => $CFG->{profile}{default}{password}, |
145 | mapw => $mapsize, |
339 | mapw => $mapsize, |
146 | maph => $mapsize, |
340 | maph => $mapsize, |
147 | |
341 | |
148 | map_widget => $MAPWIDGET, |
342 | map_widget => $MAPWIDGET, |
149 | logview => $LOGVIEW, |
343 | logview => $LOGVIEW, |
150 | statusbox => $STATUSBOX, |
344 | statusbox => $STATUSBOX, |
151 | map => $MAP, |
345 | map => $MAP, |
152 | mapmap => $MAPMAP, |
346 | mapmap => $MAPMAP, |
|
|
347 | query => \&server_query, |
153 | |
348 | |
154 | sound_play => sub { |
349 | sound_play => sub { |
155 | my ($x, $y, $soundnum, $type) = @_; |
350 | my ($x, $y, $soundnum, $type) = @_; |
156 | |
351 | |
157 | $SDL_MIXER |
352 | $SDL_MIXER |
… | |
… | |
174 | } |
369 | } |
175 | } |
370 | } |
176 | |
371 | |
177 | sub stop_game { |
372 | sub stop_game { |
178 | $LOGIN_BUTTON->set_text ("Login"); |
373 | $LOGIN_BUTTON->set_text ("Login"); |
|
|
374 | $SETUP_NOTEBOOK->set_current_page ($SETUP_SERVER); |
179 | $SETUP_DIALOG->show; |
375 | $SETUP_DIALOG->show; |
180 | $INV_WINDOW->hide; |
376 | $INV_WINDOW->hide; |
181 | $LOGVIEW->hide; |
377 | $SETUP_SPELLS->clear_spells; |
182 | |
378 | |
183 | return unless $CONN; |
379 | return unless $CONN; |
184 | |
380 | |
185 | status "connection closed"; |
381 | status "connection closed"; |
186 | |
382 | |
|
|
383 | destroy_query_dialog $CONN; |
187 | $CONN->destroy; |
384 | $CONN->destroy; |
188 | $CONN = 0; # false, does not autovivify |
385 | $CONN = 0; # false, does not autovivify |
|
|
386 | |
|
|
387 | undef $MAP; |
189 | } |
388 | } |
190 | |
389 | |
191 | sub graphics_setup { |
390 | sub graphics_setup { |
192 | my $vbox = new CFClient::UI::VBox; |
391 | my $vbox = new CFClient::UI::VBox; |
193 | |
392 | |
… | |
… | |
211 | |
410 | |
212 | $table->add (0, $row, new CFClient::UI::Label valign => 0, align => 1, text => "Fullscreen"); |
411 | $table->add (0, $row, new CFClient::UI::Label valign => 0, align => 1, text => "Fullscreen"); |
213 | $table->add (1, $row++, new CFClient::UI::CheckBox |
412 | $table->add (1, $row++, new CFClient::UI::CheckBox |
214 | state => $CFG->{fullscreen}, |
413 | state => $CFG->{fullscreen}, |
215 | tooltip => "Bring the client into fullscreen mode.", |
414 | tooltip => "Bring the client into fullscreen mode.", |
216 | on_changed => sub { |
415 | on_changed => sub { my ($self, $value) = @_; $CFG->{fullscreen} = $value; 0 } |
217 | my ($self, $value) = @_; |
|
|
218 | $CFG->{fullscreen} = $value; |
|
|
219 | } |
|
|
220 | ); |
416 | ); |
221 | |
417 | |
222 | $table->add (0, $row, new CFClient::UI::Label valign => 0, align => 1, text => "Fast & Ugly"); |
418 | $table->add (0, $row, new CFClient::UI::Label valign => 0, align => 1, text => "Fast & Ugly"); |
223 | $table->add (1, $row++, new CFClient::UI::CheckBox |
419 | $table->add (1, $row++, new CFClient::UI::CheckBox |
224 | state => $CFG->{fast}, |
420 | state => $CFG->{fast}, |
225 | tooltip => "Lower the visual quality considerably to speed up rendering.", |
421 | tooltip => "Lower the visual quality considerably to speed up rendering.", |
226 | on_changed => sub { |
422 | on_changed => sub { my ($self, $value) = @_; $CFG->{fast} = $value; 0 } |
227 | my ($self, $value) = @_; |
|
|
228 | $CFG->{fast} = $value; |
|
|
229 | } |
|
|
230 | ); |
423 | ); |
231 | |
424 | |
232 | $table->add (0, $row, new CFClient::UI::Label valign => 0, align => 1, text => "Map Scale"); |
425 | $table->add (0, $row, new CFClient::UI::Label valign => 0, align => 1, text => "Map Scale"); |
233 | $table->add (1, $row++, new CFClient::UI::Slider |
426 | $table->add (1, $row++, new CFClient::UI::Slider |
234 | range => [(log $CFG->{map_scale}) / (log 2), -3, 1, 0, 1], |
427 | range => [(log $CFG->{map_scale}) / (log 2), -3, 1, 0, 1], |
235 | tooltip => "Enlarge or shrink the displayed map. Changes are instant.", |
428 | tooltip => "Enlarge or shrink the displayed map. Changes are instant.", |
236 | on_changed => sub { |
429 | on_changed => sub { my ($self, $value) = @_; $CFG->{map_scale} = 2 ** $value; 0 } |
237 | my ($self, $value) = @_; |
|
|
238 | $CFG->{map_scale} = 2 ** $value; |
|
|
239 | } |
|
|
240 | ); |
430 | ); |
241 | |
431 | |
242 | $table->add (0, $row, new CFClient::UI::Label valign => 0, align => 1, text => "Fog of War"); |
432 | $table->add (0, $row, new CFClient::UI::Label valign => 0, align => 1, text => "Fog of War"); |
243 | $table->add (1, $row++, new CFClient::UI::CheckBox |
433 | $table->add (1, $row++, new CFClient::UI::CheckBox |
244 | state => $CFG->{fow_enable}, |
434 | state => $CFG->{fow_enable}, |
245 | tooltip => "<b>Fog-of-War</b> marks areas that cannot be seen by the player. Changes are instant.", |
435 | tooltip => "<b>Fog-of-War</b> marks areas that cannot be seen by the player. Changes are instant.", |
246 | on_changed => sub { |
436 | on_changed => sub { my ($self, $value) = @_; $CFG->{fow_enable} = $value; 0 } |
247 | my ($self, $value) = @_; |
|
|
248 | $CFG->{fow_enable} = $value; |
|
|
249 | } |
|
|
250 | ); |
437 | ); |
251 | |
438 | |
252 | $table->add (0, $row, new CFClient::UI::Label valign => 0, align => 1, text => "FoW Intensity"); |
439 | $table->add (0, $row, new CFClient::UI::Label valign => 0, align => 1, text => "FoW Intensity"); |
253 | $table->add (1, $row++, new CFClient::UI::Slider |
440 | $table->add (1, $row++, new CFClient::UI::Slider |
254 | range => [$CFG->{fow_intensity}, 0, 1, 0, 1 / 256], |
441 | range => [$CFG->{fow_intensity}, 0, 1, 0, 1 / 256], |
255 | tooltip => "<b>Fog of War Lightness.</b> The higher the intensity, the lighter the Fog-of-War color. Changes are instant.", |
442 | tooltip => "<b>Fog of War Lightness.</b> The higher the intensity, the lighter the Fog-of-War color. Changes are instant.", |
256 | on_changed => sub { |
443 | on_changed => sub { my ($self, $value) = @_; $CFG->{fow_intensity} = $value; 0 } |
257 | my ($self, $value) = @_; |
|
|
258 | $CFG->{fow_intensity} = $value; |
|
|
259 | } |
|
|
260 | ); |
444 | ); |
261 | |
445 | |
262 | $table->add (0, $row, new CFClient::UI::Label valign => 0, align => 1, text => "FoW Smooth"); |
446 | $table->add (0, $row, new CFClient::UI::Label valign => 0, align => 1, text => "FoW Smooth"); |
263 | $table->add (1, $row++, new CFClient::UI::CheckBox |
447 | $table->add (1, $row++, new CFClient::UI::CheckBox |
264 | state => $CFG->{fow_smooth}, |
448 | state => $CFG->{fow_smooth}, |
265 | tooltip => "Smooth the Fog-of-War a bit to make it more realistic. Changes are instant.", |
449 | tooltip => "Smooth the Fog-of-War a bit to make it more realistic. Changes are instant.", |
266 | on_changed => sub { |
450 | on_changed => sub { |
267 | my ($self, $value) = @_; |
451 | my ($self, $value) = @_; |
268 | $CFG->{fow_smooth} = $value; |
452 | $CFG->{fow_smooth} = $value; |
269 | status "Fog of War smoothing requires OpenGL 1.2 or higher" if $CFClient::OpenGL::GL_VERSION < 1.2; |
453 | status "Fog of War smoothing requires OpenGL 1.2 or higher" if $CFClient::OpenGL::GL_VERSION < 1.2; |
|
|
454 | 0 |
270 | } |
455 | } |
271 | ); |
456 | ); |
272 | |
457 | |
273 | $table->add (0, $row, new CFClient::UI::Label valign => 0, align => 1, text => "GUI Fontsize"); |
458 | $table->add (0, $row, new CFClient::UI::Label valign => 0, align => 1, text => "GUI Fontsize"); |
274 | $table->add (1, $row++, new CFClient::UI::Slider |
459 | $table->add (1, $row++, new CFClient::UI::Slider |
275 | range => [$CFG->{gui_fontsize}, 0.5, 2, 0, 0.1], |
460 | range => [$CFG->{gui_fontsize}, 0.5, 2, 0, 0.1], |
276 | tooltip => "The base font size used by most GUI elements that do not have their own setting.", |
461 | tooltip => "The base font size used by most GUI elements that do not have their own setting.", |
277 | on_changed => sub { $CFG->{gui_fontsize} = $_[1] }, |
462 | on_changed => sub { $CFG->{gui_fontsize} = $_[1]; 0 }, |
278 | ); |
463 | ); |
279 | |
464 | |
280 | $table->add (0, $row, new CFClient::UI::Label valign => 0, align => 1, text => "Message Fontsize"); |
465 | $table->add (0, $row, new CFClient::UI::Label valign => 0, align => 1, text => "Message Fontsize"); |
281 | $table->add (1, $row++, new CFClient::UI::Slider |
466 | $table->add (1, $row++, new CFClient::UI::Slider |
282 | range => [$CFG->{log_fontsize}, 0.5, 2, 0, 0.1], |
467 | range => [$CFG->{log_fontsize}, 0.5, 2, 0, 0.1], |
283 | tooltip => "The font size used by the <b>message/server log</b> window only. Changes are instant.", |
468 | tooltip => "The font size used by the <b>message/server log</b> window only. Changes are instant.", |
284 | on_changed => sub { $LOGVIEW->set_fontsize ($CFG->{log_fontsize} = $_[1]) }, |
469 | on_changed => sub { $LOGVIEW->set_fontsize ($CFG->{log_fontsize} = $_[1]); 0 }, |
285 | ); |
470 | ); |
286 | |
471 | |
287 | $table->add (0, $row, new CFClient::UI::Label valign => 0, align => 1, text => "Stats Fontsize"); |
472 | $table->add (0, $row, new CFClient::UI::Label valign => 0, align => 1, text => "Stats Fontsize"); |
288 | |
473 | |
289 | $table->add (1, $row++, new CFClient::UI::Slider |
474 | $table->add (1, $row++, new CFClient::UI::Slider |
290 | range => [$CFG->{stat_fontsize}, 0.5, 2, 0, 0.1], |
475 | range => [$CFG->{stat_fontsize}, 0.5, 2, 0, 0.1], |
291 | tooltip => "The font size used by the <b>statistics window</b> only. Changes are instant.", |
476 | tooltip => "The font size used by the <b>statistics window</b> only. Changes are instant.", |
292 | on_changed => sub { |
477 | on_changed => sub { |
293 | $CFG->{stat_fontsize} = $_[1]; |
478 | $CFG->{stat_fontsize} = $_[1]; |
294 | &set_stats_window_fontsize; |
479 | &set_stats_window_fontsize; |
|
|
480 | 0 |
295 | } |
481 | } |
296 | ); |
482 | ); |
297 | |
483 | |
298 | $table->add (0, $row, new CFClient::UI::Label valign => 0, align => 1, text => "Gauge fontsize"); |
484 | $table->add (0, $row, new CFClient::UI::Label valign => 0, align => 1, text => "Gauge fontsize"); |
299 | $table->add (1, $row++, new CFClient::UI::Slider |
485 | $table->add (1, $row++, new CFClient::UI::Slider |
300 | range => [$CFG->{gauge_fontsize}, 0.5, 2, 0, 0.1], |
486 | range => [$CFG->{gauge_fontsize}, 0.5, 2, 0, 0.1], |
301 | tooltip => "Adjusts the fontsize of the gauges at the bottom right. Changes are instant.", |
487 | tooltip => "Adjusts the fontsize of the gauges at the bottom right. Changes are instant.", |
302 | on_changed => sub { |
488 | on_changed => sub { |
303 | $CFG->{gauge_fontsize} = $_[1]; |
489 | $CFG->{gauge_fontsize} = $_[1]; |
304 | &set_gauge_window_fontsize; |
490 | &set_gauge_window_fontsize; |
|
|
491 | 0 |
305 | } |
492 | } |
306 | ); |
493 | ); |
307 | |
494 | |
308 | $table->add (0, $row, new CFClient::UI::Label valign => 0, align => 1, text => "Gauge size"); |
495 | $table->add (0, $row, new CFClient::UI::Label valign => 0, align => 1, text => "Gauge size"); |
309 | $table->add (1, $row++, new CFClient::UI::Slider |
496 | $table->add (1, $row++, new CFClient::UI::Slider |
310 | range => [$CFG->{gauge_size}, 0.2, 0.8], |
497 | range => [$CFG->{gauge_size}, 0.2, 0.8], |
311 | tooltip => "Adjust the size of the stats gauges at the bottom right. Changes are instant.", |
498 | tooltip => "Adjust the size of the stats gauges at the bottom right. Changes are instant.", |
312 | on_changed => sub { |
499 | on_changed => sub { |
313 | $CFG->{gauge_size} = $_[1]; |
500 | $CFG->{gauge_size} = $_[1]; |
314 | $GAUGES->{win}->set_size ($WIDTH, int $HEIGHT * $CFG->{gauge_size}); |
501 | $GAUGES->{win}->set_size ($WIDTH, int $HEIGHT * $CFG->{gauge_size}); |
|
|
502 | 0 |
315 | } |
503 | } |
316 | ); |
504 | ); |
317 | |
505 | |
318 | $table->add (1, $row++, new CFClient::UI::Button |
506 | $table->add (1, $row++, new CFClient::UI::Button |
319 | expand => 1, align => 0, text => "Apply", |
507 | expand => 1, align => 0, text => "Apply", |
320 | tooltip => "Apply the video settings", |
508 | tooltip => "Apply the video settings", |
321 | on_activate => sub { |
509 | on_activate => sub { |
322 | video_shutdown (); |
510 | video_shutdown (); |
323 | video_init (); |
511 | video_init (); |
|
|
512 | 0 |
324 | } |
513 | } |
325 | ); |
514 | ); |
326 | |
515 | |
327 | $vbox |
516 | $vbox |
328 | } |
517 | } |
… | |
… | |
336 | |
525 | |
337 | $table->add (0, $row, new CFClient::UI::Label valign => 0, align => 1, text => "Audio Enable"); |
526 | $table->add (0, $row, new CFClient::UI::Label valign => 0, align => 1, text => "Audio Enable"); |
338 | $table->add (1, $row++, new CFClient::UI::CheckBox |
527 | $table->add (1, $row++, new CFClient::UI::CheckBox |
339 | state => $CFG->{audio_enable}, |
528 | state => $CFG->{audio_enable}, |
340 | 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.", |
529 | 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.", |
341 | on_changed => sub { |
530 | on_changed => sub { $CFG->{audio_enable} = $_[1]; 0 } |
342 | $CFG->{audio_enable} = $_[1]; |
|
|
343 | } |
|
|
344 | ); |
531 | ); |
345 | # $table->add (0, 9, new CFClient::UI::Label valign => 0, align => 1, text => "Effects Volume"); |
532 | # $table->add (0, 9, new CFClient::UI::Label valign => 0, align => 1, text => "Effects Volume"); |
346 | # $table->add (1, 8, new CFClient::UI::Slider range => [$CFG->{effects_volume}, 0, 128, 1], on_changed => sub { |
533 | # $table->add (1, 8, new CFClient::UI::Slider range => [$CFG->{effects_volume}, 0, 128, 1], on_changed => sub { |
347 | # $CFG->{effects_volume} = $_[1]; |
534 | # $CFG->{effects_volume} = $_[1]; |
348 | # }); |
535 | # }); |
349 | $table->add (0, $row, new CFClient::UI::Label valign => 0, align => 1, text => "Background Music"); |
536 | $table->add (0, $row, new CFClient::UI::Label valign => 0, align => 1, text => "Background Music"); |
350 | $table->add (1, $row++, my $hbox = new CFClient::UI::HBox); |
537 | $table->add (1, $row++, my $hbox = new CFClient::UI::HBox); |
351 | $hbox->add (new CFClient::UI::CheckBox |
538 | $hbox->add (new CFClient::UI::CheckBox |
352 | expand => 1, state => $CFG->{bgm_enable}, |
539 | expand => 1, state => $CFG->{bgm_enable}, |
353 | tooltip => "If enabled, playing of background music is enabled. If disabled, no background music will be played.", |
540 | tooltip => "If enabled, playing of background music is enabled. If disabled, no background music will be played.", |
354 | on_changed => sub { |
541 | on_changed => sub { $CFG->{bgm_enable} = $_[1]; 0 } |
355 | $CFG->{bgm_enable} = $_[1]; |
|
|
356 | } |
|
|
357 | ); |
542 | ); |
358 | $hbox->add (new CFClient::UI::Slider |
543 | $hbox->add (new CFClient::UI::Slider |
359 | expand => 1, range => [$CFG->{bgm_volume}, 0, 1, 0, 1/128], |
544 | expand => 1, range => [$CFG->{bgm_volume}, 0, 1, 0, 1/128], |
360 | tooltip => "The volume of the background music. Changes are instant.", |
545 | tooltip => "The volume of the background music. Changes are instant.", |
361 | on_changed => sub { |
546 | on_changed => sub { $CFG->{bgm_volume} = $_[1]; CFClient::MixMusic::volume $_[1] * 128; 0 } |
362 | $CFG->{bgm_volume} = $_[1]; |
|
|
363 | CFClient::MixMusic::volume $_[1] * 128; |
|
|
364 | } |
|
|
365 | ); |
547 | ); |
366 | |
548 | |
367 | $table->add (1, $row++, new CFClient::UI::Button |
549 | $table->add (1, $row++, new CFClient::UI::Button |
368 | expand => 1, align => 0, text => "Apply", |
550 | expand => 1, align => 0, text => "Apply", |
369 | tooltip => "Apply the audio settings", |
551 | tooltip => "Apply the audio settings", |
370 | on_activate => sub { |
552 | on_activate => sub { |
371 | audio_shutdown (); |
553 | audio_shutdown (); |
372 | audio_init (); |
554 | audio_init (); |
|
|
555 | 0 |
373 | } |
556 | } |
374 | ); |
557 | ); |
375 | |
558 | |
376 | $vbox |
559 | $vbox |
377 | } |
560 | } |
… | |
… | |
439 | &set_gauge_window_fontsize; |
622 | &set_gauge_window_fontsize; |
440 | |
623 | |
441 | $win |
624 | $win |
442 | } |
625 | } |
443 | |
626 | |
|
|
627 | sub debug_setup { |
|
|
628 | my $table = new CFClient::UI::Table; |
444 | |
629 | |
|
|
630 | $table->add (0, 0, new CFClient::UI::Label text => "Widget Borders"); |
|
|
631 | $table->add (1, 0, new CFClient::UI::CheckBox on_changed => sub { $ENV{CFPLUS_DEBUG} ^= 1; 0 }); |
|
|
632 | $table->add (0, 1, new CFClient::UI::Label text => "Tooltip Widget Info"); |
|
|
633 | $table->add (1, 1, new CFClient::UI::CheckBox on_changed => sub { $ENV{CFPLUS_DEBUG} ^= 2; 0 }); |
|
|
634 | $table->add (0, 2, new CFClient::UI::Label text => "Show FPS"); |
|
|
635 | $table->add (1, 2, new CFClient::UI::CheckBox on_changed => sub { $ENV{CFPLUS_DEBUG} ^= 4; 0 }); |
|
|
636 | $table->add (0, 3, new CFClient::UI::Label text => "Suppress Tooltips"); |
|
|
637 | $table->add (1, 3, new CFClient::UI::CheckBox on_changed => sub { $ENV{CFPLUS_DEBUG} ^= 8; 0 }); |
|
|
638 | |
|
|
639 | my @default_smooth = (0.05, 0.13, 0.05, 0.13, 0.30, 0.13, 0.05, 0.13, 0.05); |
|
|
640 | |
|
|
641 | for my $x (0..2) { |
|
|
642 | for my $y (0 .. 2) { |
|
|
643 | $table->add ($x + 3, $y, |
|
|
644 | new CFClient::UI::Entry |
|
|
645 | text => $default_smooth[$x * 3 + $y], |
|
|
646 | on_changed => sub { $MAP->{smooth_matrix}[$x * 3 + $y] = $_[1] if $MAP; 0 }, |
|
|
647 | ); |
|
|
648 | } |
|
|
649 | } |
|
|
650 | |
|
|
651 | |
|
|
652 | $table |
|
|
653 | } |
|
|
654 | |
445 | sub make_stats_window { |
655 | sub stats_window { |
446 | my $tgw = new CFClient::UI::FancyFrame |
656 | my $tgw = new CFClient::UI::FancyFrame |
447 | y => $HEIGHT * (2/8), |
657 | y => $HEIGHT * (2/8), |
448 | x => "max", |
658 | x => "max", |
449 | title => "Stats", |
659 | title => "Stats", |
450 | name => "stats_window"; |
660 | name => "stats_window", |
|
|
661 | has_close_button => 1; |
451 | |
662 | |
452 | $tgw->add (new CFClient::UI::Window child => my $vb = new CFClient::UI::VBox); |
663 | $tgw->add (new CFClient::UI::Window child => my $vb = new CFClient::UI::VBox); |
453 | $vb->add ($STATWIDS->{title} = new CFClient::UI::Label valign => 0, align => -1, text => "Title:", expand => 1, |
664 | $vb->add ($STATWIDS->{title} = new CFClient::UI::Label valign => 0, align => -1, text => "Title:", expand => 1, |
454 | can_hover => 1, can_events => 1, |
665 | can_hover => 1, can_events => 1, |
455 | tooltip => "Your name and title. You can change your title by using the <b>title</b> command, if supported by the server."); |
666 | tooltip => "Your name and title. You can change your title by using the <b>title</b> command, if supported by the server."); |
… | |
… | |
601 | $STATWIDS->{st_spd} ->set_text (sprintf "%.1f", $stats->{+CS_STAT_SPEED}); |
812 | $STATWIDS->{st_spd} ->set_text (sprintf "%.1f", $stats->{+CS_STAT_SPEED}); |
602 | $STATWIDS->{st_wspd}->set_text (sprintf "%.1f", $stats->{+CS_STAT_WEAP_SP}); |
813 | $STATWIDS->{st_wspd}->set_text (sprintf "%.1f", $stats->{+CS_STAT_WEAP_SP}); |
603 | |
814 | |
604 | $STATWIDS->{m_weight}->set_text (sprintf "Max weight: %.1fkg", $stats->{+CS_STAT_WEIGHT_LIM} / 1000); |
815 | $STATWIDS->{m_weight}->set_text (sprintf "Max weight: %.1fkg", $stats->{+CS_STAT_WEIGHT_LIM} / 1000); |
605 | |
816 | |
606 | # TODO: replace by CS_STAT_RES_xxx constants |
|
|
607 | my %tbl = ( |
817 | my %tbl = ( |
608 | phys => 100, |
818 | phys => CS_STAT_RES_PHYS, |
609 | magic => 101, |
819 | magic => CS_STAT_RES_MAG, |
610 | fire => 102, |
820 | fire => CS_STAT_RES_FIRE, |
611 | elec => 103, |
821 | elec => CS_STAT_RES_ELEC, |
612 | cold => 104, |
822 | cold => CS_STAT_RES_COLD, |
613 | conf => 105, |
823 | conf => CS_STAT_RES_CONF, |
614 | acid => 106, |
824 | acid => CS_STAT_RES_ACID, |
615 | drain => 107, |
825 | drain => CS_STAT_RES_DRAIN, |
616 | ghit => 108, |
826 | ghit => CS_STAT_RES_GHOSTHIT, |
617 | pois => 109, |
827 | pois => CS_STAT_RES_POISON, |
618 | slow => 110, |
828 | slow => CS_STAT_RES_SLOW, |
619 | para => 111, |
829 | para => CS_STAT_RES_PARA, |
620 | tund => 112, |
830 | tund => CS_STAT_TURN_UNDEAD, |
621 | fear => 113, |
831 | fear => CS_STAT_RES_FEAR, |
622 | depl => 113, |
832 | depl => CS_STAT_RES_DEPLETE, |
623 | deat => 115, |
833 | deat => CS_STAT_RES_DEATH, |
624 | holyw => 116, |
834 | holyw => CS_STAT_RES_HOLYWORD, |
625 | blind => 117, |
835 | blind => CS_STAT_RES_BLIND, |
626 | ); |
836 | ); |
627 | |
837 | |
628 | $STATWIDS->{"res_$_"}->set_text (sprintf "%d%", $stats->{$tbl{$_}}) |
838 | $STATWIDS->{"res_$_"}->set_text (sprintf "%d%", $stats->{$tbl{$_}}) |
629 | for keys %tbl; |
839 | for keys %tbl; |
630 | } |
840 | } |
… | |
… | |
660 | |
870 | |
661 | utf8::decode $buf if utf8::valid $buf; |
871 | utf8::decode $buf if utf8::valid $buf; |
662 | |
872 | |
663 | $table->clear; |
873 | $table->clear; |
664 | |
874 | |
|
|
875 | my @tip = ( |
|
|
876 | "The current number of users logged in on the server.", |
|
|
877 | "The hostname of the server.", |
|
|
878 | "The time this server has been running without being restarted.", |
|
|
879 | "The server software version - a '+' indicates a Crossfire+ server.", |
|
|
880 | "Short information about this server provided by its admins.", |
|
|
881 | ); |
665 | my @col = qw(Use #Users Host Uptime Version Description); |
882 | my @col = qw(#Users Host Uptime Version Description); |
666 | $table->add ($_, 0, new CFClient::UI::Label align => 0, fg => [1, 1, 0], text => $col[$_]) |
883 | $table->add ($_, 0, new CFClient::UI::Label |
|
|
884 | can_hover => 1, can_events => 1, |
|
|
885 | align => 0, fg => [1, 1, 0], |
|
|
886 | text => $col[$_], tooltip => $tip[$_]) |
667 | for 0 .. $#col; |
887 | for 0 .. $#col; |
668 | |
888 | |
669 | my @align = qw(1 0 1 1 -1); |
889 | my @align = qw(1 0 1 1 -1); |
670 | |
890 | |
671 | my $y = 0; |
891 | my $y = 0; |
672 | for my $m (sort { $b->[3] <=> $a->[3] } map [split /\|/], split /\015?\012/, $buf) { |
892 | for my $m (sort { $b->[3] <=> $a->[3] } map [split /\|/], split /\015?\012/, $buf) { |
… | |
… | |
689 | |
909 | |
690 | $m = [$users, $host, $uptime, $version, $desc]; |
910 | $m = [$users, $host, $uptime, $version, $desc]; |
691 | |
911 | |
692 | $y++; |
912 | $y++; |
693 | |
913 | |
694 | $table->add (0, $y, new CFClient::UI::VBox children => [ |
914 | $table->add (scalar @$m, $y, new CFClient::UI::VBox children => [ |
695 | (new CFClient::UI::Button text => "Use", on_activate => sub { |
915 | (new CFClient::UI::Button |
|
|
916 | text => "Use", |
|
|
917 | tooltip => "Put this server into the <b>Host:Port</b> field", |
|
|
918 | on_activate => sub { |
696 | $HOST_ENTRY->set_text ($CFG->{host} = $host); |
919 | $HOST_ENTRY->set_text ($CFG->{profile}{default}{host} = $host); |
697 | $METASERVER->toggle_visibility; |
920 | $METASERVER->hide; |
|
|
921 | 0 |
|
|
922 | }, |
698 | }), |
923 | ), |
699 | (new CFClient::UI::Empty expand => 1), |
924 | (new CFClient::UI::Empty expand => 1), |
700 | ]); |
925 | ]); |
701 | |
926 | |
702 | $table->add ($_ + 1, $y, new CFClient::UI::Label |
927 | $table->add ($_, $y, new CFClient::UI::Label |
703 | ellipsise => 0, align => $align[$_], text => $m->[$_], fontsize => 0.8) |
928 | ellipsise => 0, |
|
|
929 | align => $align[$_], |
|
|
930 | text => $m->[$_], |
|
|
931 | tooltip => $tip[$_], |
|
|
932 | can_hover => 1, |
|
|
933 | can_events => 1, |
|
|
934 | fontsize => 0.8) |
704 | for 0 .. $#$m; |
935 | for 0 .. $#$m; |
705 | } |
936 | } |
706 | } |
937 | } |
707 | }); |
938 | }); |
708 | } |
939 | } |
709 | |
940 | |
710 | sub metaserver_dialog { |
941 | sub metaserver_dialog { |
711 | my $dialog = new CFClient::UI::FancyFrame |
942 | my $dialog = new CFClient::UI::FancyFrame |
712 | title => "Server List", |
943 | title => "Server List", |
713 | name => 'metaserver_dialog', |
944 | name => 'metaserver_dialog', |
714 | x => 'center', |
945 | x => 'center', |
715 | y => 'center', |
946 | y => 'center', |
|
|
947 | z => 3, |
|
|
948 | force_h => $::HEIGHT * 0.4, |
716 | child => (my $vbox = new CFClient::UI::VBox), |
949 | child => (my $vbox = new CFClient::UI::VBox), |
717 | on_visibility_change => sub { |
950 | on_visibility_change => sub { |
718 | update_metaserver if $_[1]; |
951 | update_metaserver if $_[1]; |
|
|
952 | 0 |
719 | }, |
953 | }, |
720 | ; |
954 | ; |
721 | |
955 | |
722 | $vbox->add ($dialog->{table} = new CFClient::UI::Table); |
956 | $dialog->{table} = new CFClient::UI::Table; |
|
|
957 | |
|
|
958 | $vbox->add (new CFClient::UI::ScrolledWindow expand => 1, child => $dialog->{table}); |
723 | |
959 | |
724 | $dialog |
960 | $dialog |
725 | } |
961 | } |
726 | |
962 | |
727 | sub server_setup { |
963 | sub server_setup { |
… | |
… | |
734 | $table->add (1, 2, my $vbox = new CFClient::UI::VBox); |
970 | $table->add (1, 2, my $vbox = new CFClient::UI::VBox); |
735 | |
971 | |
736 | $vbox->add ( |
972 | $vbox->add ( |
737 | $HOST_ENTRY = new CFClient::UI::Entry |
973 | $HOST_ENTRY = new CFClient::UI::Entry |
738 | expand => 1, |
974 | expand => 1, |
739 | text => $CFG->{host}, |
975 | text => $CFG->{profile}{default}{host}, |
740 | tooltip => "The hostname or ip address of the Crossfire(+) server to connect to", |
976 | tooltip => "The hostname or ip address of the Crossfire(+) server to connect to", |
741 | on_changed => sub { |
977 | on_changed => sub { |
742 | my ($self, $value) = @_; |
978 | my ($self, $value) = @_; |
743 | $CFG->{host} = $value; |
979 | $CFG->{profile}{default}{host} = $value; |
|
|
980 | 0 |
744 | } |
981 | } |
745 | ); |
982 | ); |
746 | |
983 | |
747 | $METASERVER = metaserver_dialog; |
984 | $METASERVER = metaserver_dialog; |
748 | |
985 | |
749 | $vbox->add (new CFClient::UI::Button |
986 | $vbox->add (new CFClient::UI::Button |
750 | expand => 1, |
987 | expand => 1, |
751 | text => "Server List", |
988 | text => "Server List", |
752 | other => $METASERVER, |
989 | other => $METASERVER, |
753 | tooltip => "Show a list of available crossfire servers", |
990 | tooltip => "Show a list of available crossfire servers", |
754 | on_activate => sub { $METASERVER->toggle_visibility }, |
991 | on_activate => sub { $METASERVER->toggle_visibility; 0 }, |
|
|
992 | on_visibility_change => sub { $METASERVER->hide unless $_[1]; 0 }, |
755 | ); |
993 | ); |
756 | } |
994 | } |
757 | |
995 | |
758 | $table->add (0, 4, new CFClient::UI::Label valign => 0, align => 1, text => "Username"); |
996 | $table->add (0, 4, new CFClient::UI::Label valign => 0, align => 1, text => "Username"); |
759 | $table->add (1, 4, new CFClient::UI::Entry |
997 | $table->add (1, 4, new CFClient::UI::Entry |
760 | text => $CFG->{user}, |
998 | text => $CFG->{profile}{default}{user}, |
761 | tooltip => "The name of your character on the server", |
999 | tooltip => "The name of your character on the server", |
762 | on_changed => sub { |
1000 | on_changed => sub { my ($self, $value) = @_; $CFG->{profile}{default}{user} = $value } |
763 | my ($self, $value) = @_; |
|
|
764 | $CFG->{user} = $value; |
|
|
765 | } |
|
|
766 | ); |
1001 | ); |
767 | |
1002 | |
768 | $table->add (0, 5, new CFClient::UI::Label valign => 0, align => 1, text => "Password"); |
1003 | $table->add (0, 5, new CFClient::UI::Label valign => 0, align => 1, text => "Password"); |
769 | $table->add (1, 5, new CFClient::UI::Entry |
1004 | $table->add (1, 5, new CFClient::UI::Entry |
770 | text => $CFG->{password}, |
1005 | text => $CFG->{profile}{default}{password}, |
771 | hidden => 1, |
1006 | hidden => 1, |
772 | tooltip => "The password for your character", |
1007 | tooltip => "The password for your character", |
773 | on_changed => sub { |
1008 | on_changed => sub { my ($self, $value) = @_; $CFG->{profile}{default}{password} = $value } |
774 | my ($self, $value) = @_; |
|
|
775 | $CFG->{password} = $value; |
|
|
776 | } |
|
|
777 | ); |
1009 | ); |
778 | |
1010 | |
779 | $table->add (0, 7, new CFClient::UI::Label valign => 0, align => 1, text => "Map Size"); |
1011 | $table->add (0, 7, new CFClient::UI::Label valign => 0, align => 1, text => "Map Size"); |
780 | $table->add (1, 7, new CFClient::UI::Slider |
1012 | $table->add (1, 7, new CFClient::UI::Slider |
781 | force_w => 100, |
1013 | force_w => 100, |
782 | range => [$CFG->{mapsize}, 10, 100, 0, 1], |
1014 | range => [$CFG->{mapsize}, 10, 100, 0, 1], |
783 | tooltip => "This is the size of the portion of the map update the server sends you. " |
1015 | tooltip => "This is the size of the portion of the map update the server sends you. " |
784 | . "If you set this to a high value you will be able to see further, " |
1016 | . "If you set this to a high value you will be able to see further, " |
785 | . "but you also increase bandwidth requirements and latency. " |
1017 | . "but you also increase bandwidth requirements and latency. " |
786 | . "This option is only used once at log-in.", |
1018 | . "This option is only used once at log-in.", |
787 | on_changed => sub { |
1019 | on_changed => sub { my ($self, $value) = @_; $CFG->{mapsize} = $self->{range}[0] = $value = int $value; 0 }, |
788 | my ($self, $value) = @_; |
|
|
789 | |
|
|
790 | $CFG->{mapsize} = $self->{range}[0] = $value = int $value; |
|
|
791 | }, |
|
|
792 | ); |
1020 | ); |
793 | |
1021 | |
794 | $table->add (0, 8, new CFClient::UI::Label valign => 0, align => 1, text => "Face Prefetch"); |
1022 | $table->add (0, 8, new CFClient::UI::Label valign => 0, align => 1, text => "Face Prefetch"); |
795 | $table->add (1, 8, new CFClient::UI::CheckBox |
1023 | $table->add (1, 8, new CFClient::UI::CheckBox |
796 | state => $CFG->{face_prefetch}, |
1024 | state => $CFG->{face_prefetch}, |
… | |
… | |
799 | . "This might increase or create lag, but increases the chances " |
1027 | . "This might increase or create lag, but increases the chances " |
800 | . "of faces being ready for display when you encounter them. " |
1028 | . "of faces being ready for display when you encounter them. " |
801 | . "It also uses up server bandwidth on every connect, " |
1029 | . "It also uses up server bandwidth on every connect, " |
802 | . "so only set it if you really need to prefetch images. " |
1030 | . "so only set it if you really need to prefetch images. " |
803 | . "This option can be set and unset any time.", |
1031 | . "This option can be set and unset any time.", |
804 | on_changed => sub { $CFG->{face_prefetch} = $_[1] }, |
1032 | on_changed => sub { $CFG->{face_prefetch} = $_[1]; 0 }, |
805 | ); |
1033 | ); |
806 | |
1034 | |
807 | $table->add (0, 9, new CFClient::UI::Label valign => 0, align => 1, text => "Output-Count"); |
1035 | $table->add (0, 9, new CFClient::UI::Label valign => 0, align => 1, text => "Output-Count"); |
808 | $table->add (1, 9, new CFClient::UI::Entry |
1036 | $table->add (1, 9, new CFClient::UI::Entry |
809 | text => $CFG->{output_count}, |
1037 | text => $CFG->{output_count}, |
810 | tooltip => "Should be set to 1 unless you know what you are doing. This option is only used once at log-in.", |
1038 | tooltip => "Should be set to 1 unless you know what you are doing. This option is only used once at log-in.", |
811 | on_changed => sub { $CFG->{output_count} = $_[1] }, |
1039 | on_changed => sub { $CFG->{output_count} = $_[1]; 0 }, |
812 | ); |
1040 | ); |
813 | |
1041 | |
814 | $table->add (0, 10, new CFClient::UI::Label valign => 0, align => 1, text => "Output-Sync"); |
1042 | $table->add (0, 10, new CFClient::UI::Label valign => 0, align => 1, text => "Output-Sync"); |
815 | $table->add (1, 10, new CFClient::UI::Entry |
1043 | $table->add (1, 10, new CFClient::UI::Entry |
816 | text => $CFG->{output_sync}, |
1044 | text => $CFG->{output_sync}, |
817 | tooltip => "Should be set to 1 unless you know what you are doing. This option is only used once at log-in.", |
1045 | tooltip => "Should be set to 1 unless you know what you are doing. This option is only used once at log-in.", |
818 | on_changed => sub { $CFG->{output_sync} = $_[1] }, |
1046 | on_changed => sub { $CFG->{output_sync} = $_[1]; 0 }, |
819 | ); |
1047 | ); |
820 | |
1048 | |
821 | $table->add (1, 11, $LOGIN_BUTTON = new CFClient::UI::Button |
1049 | $table->add (1, 11, $LOGIN_BUTTON = new CFClient::UI::Button |
822 | expand => 1, |
1050 | expand => 1, |
823 | align => 0, |
1051 | align => 0, |
824 | text => "Login", |
1052 | text => "Login", |
825 | on_activate => sub { |
1053 | on_activate => sub { |
826 | $CONN ? stop_game |
1054 | $CONN ? stop_game |
827 | : start_game; |
1055 | : start_game; |
|
|
1056 | 0 |
828 | }, |
1057 | }, |
829 | ); |
1058 | ); |
830 | |
1059 | |
831 | $table->add (0, 12, new CFClient::UI::Label valign => 0, align => 1, text => "Chat Command"); |
1060 | $table->add (0, 12, new CFClient::UI::Label valign => 0, align => 1, text => "Chat Command"); |
832 | $table->add (1, 12, my $saycmd = new CFClient::UI::Entry |
1061 | $table->add (1, 12, my $saycmd = new CFClient::UI::Entry |
… | |
… | |
835 | . "Usually you want to enter something like 'say' or 'shout' or 'gsay' here. " |
1064 | . "Usually you want to enter something like 'say' or 'shout' or 'gsay' here. " |
836 | . "But you could also set it to <b>tell <i>playername</i></b> to only chat with that user.", |
1065 | . "But you could also set it to <b>tell <i>playername</i></b> to only chat with that user.", |
837 | on_changed => sub { |
1066 | on_changed => sub { |
838 | my ($self, $value) = @_; |
1067 | my ($self, $value) = @_; |
839 | $CFG->{say_command} = $value; |
1068 | $CFG->{say_command} = $value; |
|
|
1069 | 0 |
840 | } |
1070 | } |
841 | ); |
1071 | ); |
|
|
1072 | |
|
|
1073 | $vbox->add (new CFClient::UI::Label |
|
|
1074 | text => "Server Info", |
|
|
1075 | fontsize => 1.2, |
|
|
1076 | padding_y => 8, |
|
|
1077 | fg => [1, 1, 0, 1], |
|
|
1078 | ); |
|
|
1079 | |
|
|
1080 | $vbox->add ($SERVER_INFO = new CFClient::UI::Label ellipsise => 0); |
842 | |
1081 | |
843 | $vbox |
1082 | $vbox |
844 | } |
1083 | } |
845 | |
1084 | |
846 | sub message_window { |
1085 | sub message_window { |
… | |
… | |
849 | title => "Messages", |
1088 | title => "Messages", |
850 | border_bg => [1, 1, 1, 1], |
1089 | border_bg => [1, 1, 1, 1], |
851 | bg => [0, 0, 0, 0.75], |
1090 | bg => [0, 0, 0, 0.75], |
852 | x => "max", |
1091 | x => "max", |
853 | y => 0, |
1092 | y => 0, |
854 | force_w => $::WIDTH / 3, |
1093 | force_w => $::WIDTH * 0.4, |
855 | force_h => $::HEIGHT / 5, |
1094 | force_h => $::HEIGHT * 0.5, |
856 | child => (my $vbox = new CFClient::UI::VBox); |
1095 | child => (my $vbox = new CFClient::UI::VBox), |
|
|
1096 | has_close_button => 1; |
857 | |
1097 | |
858 | $vbox->add ($LOGVIEW); |
1098 | $vbox->add ($LOGVIEW); |
859 | |
1099 | |
860 | $vbox->add (my $input = new CFClient::UI::Entry |
1100 | $vbox->add (my $input = new CFClient::UI::Entry |
861 | tooltip => "<b>Chat Box</b>. If you enter a text and press return/enter here, the current <i>communication command</i> " |
1101 | tooltip => "<b>Chat Box</b>. If you enter a text and press return/enter here, the current <i>communication command</i> " |
… | |
… | |
869 | |
1109 | |
870 | if ($prev_focus == $MAPWIDGET && $input->{auto_activated}) { |
1110 | if ($prev_focus == $MAPWIDGET && $input->{auto_activated}) { |
871 | $input->{refocus_map} = 1; |
1111 | $input->{refocus_map} = 1; |
872 | } |
1112 | } |
873 | delete $input->{auto_activated}; |
1113 | delete $input->{auto_activated}; |
|
|
1114 | |
|
|
1115 | 0 |
874 | }, |
1116 | }, |
875 | on_activate => sub { |
1117 | on_activate => sub { |
876 | my ($input, $text) = @_; |
1118 | my ($input, $text) = @_; |
877 | $input->set_text (''); |
1119 | $input->set_text (''); |
878 | |
1120 | |
… | |
… | |
884 | } |
1126 | } |
885 | if ($input->{refocus_map}) { |
1127 | if ($input->{refocus_map}) { |
886 | delete $input->{refocus_map}; |
1128 | delete $input->{refocus_map}; |
887 | $MAPWIDGET->focus_in |
1129 | $MAPWIDGET->focus_in |
888 | } |
1130 | } |
|
|
1131 | |
|
|
1132 | 0 |
889 | }, |
1133 | }, |
890 | on_escape => sub { |
1134 | on_escape => sub { |
891 | $MAPWIDGET->focus_in |
1135 | $MAPWIDGET->grab_focus; |
|
|
1136 | |
|
|
1137 | 0 |
892 | }, |
1138 | }, |
893 | ); |
1139 | ); |
894 | |
1140 | |
895 | $CONSOLE = { |
1141 | $CONSOLE = { |
896 | window => $window, |
1142 | window => $window, |
… | |
… | |
903 | sub open_quit_dialog { |
1149 | sub open_quit_dialog { |
904 | unless ($QUIT_DIALOG) { |
1150 | unless ($QUIT_DIALOG) { |
905 | $QUIT_DIALOG = new CFClient::UI::FancyFrame |
1151 | $QUIT_DIALOG = new CFClient::UI::FancyFrame |
906 | x => "center", |
1152 | x => "center", |
907 | y => "center", |
1153 | y => "center", |
|
|
1154 | z => 50, |
908 | title => "Really Quit?", |
1155 | title => "Really Quit?", |
909 | ; |
1156 | ; |
910 | |
1157 | |
911 | $QUIT_DIALOG->add (my $vb = new CFClient::UI::VBox expand => 1); |
1158 | $QUIT_DIALOG->add (my $vb = new CFClient::UI::VBox expand => 1); |
912 | |
1159 | |
… | |
… | |
917 | ); |
1164 | ); |
918 | $vb->add (my $hb = new CFClient::UI::HBox expand => 1); |
1165 | $vb->add (my $hb = new CFClient::UI::HBox expand => 1); |
919 | $hb->add (new CFClient::UI::Button |
1166 | $hb->add (new CFClient::UI::Button |
920 | text => "Ok", |
1167 | text => "Ok", |
921 | expand => 1, |
1168 | expand => 1, |
922 | on_activate => sub { $QUIT_DIALOG->hide }, |
1169 | on_activate => sub { $QUIT_DIALOG->hide; 0 }, |
923 | ); |
1170 | ); |
924 | $hb->add (new CFClient::UI::Button |
1171 | $hb->add (new CFClient::UI::Button |
925 | text => "Quit anyway", |
1172 | text => "Quit anyway", |
926 | expand => 1, |
1173 | expand => 1, |
927 | on_activate => sub { exit }, |
1174 | on_activate => sub { exit }, |
… | |
… | |
934 | sub autopickup_setup { |
1181 | sub autopickup_setup { |
935 | my $table = new CFClient::UI::Table; |
1182 | my $table = new CFClient::UI::Table; |
936 | |
1183 | |
937 | for ( |
1184 | for ( |
938 | ["General", 0, 0, |
1185 | ["General", 0, 0, |
939 | ["Enable autopickup" => CFClient::Pickup::PU_NEWMODE], |
1186 | ["Enable autopickup" => PICKUP_NEWMODE], |
940 | ["Inhibit autopickup" => CFClient::Pickup::PU_INHIBIT], |
1187 | ["Inhibit autopickup" => PICKUP_INHIBIT], |
941 | ["Stop before pickup" => CFClient::Pickup::PU_STOP], |
1188 | ["Stop before pickup" => PICKUP_STOP], |
942 | ["Debug autopickup" => CFClient::Pickup::PU_DEBUG], |
1189 | ["Debug autopickup" => PICKUP_DEBUG], |
943 | ], |
1190 | ], |
944 | ["Weapons", 0, 6, |
1191 | ["Weapons", 0, 6, |
945 | ["All weapons" => CFClient::Pickup::PU_ALLWEAPON], |
1192 | ["All weapons" => PICKUP_ALLWEAPON], |
946 | ["Missile weapons" => CFClient::Pickup::PU_MISSILEWEAPON], |
1193 | ["Missile weapons" => PICKUP_MISSILEWEAPON], |
947 | ["Bows" => CFClient::Pickup::PU_BOW], |
1194 | ["Bows" => PICKUP_BOW], |
948 | ["Arrows" => CFClient::Pickup::PU_ARROW], |
1195 | ["Arrows" => PICKUP_ARROW], |
949 | ], |
1196 | ], |
950 | ["Armour", 0, 12, |
1197 | ["Armour", 0, 12, |
951 | ["Helmets" => CFClient::Pickup::PU_HELMET], |
1198 | ["Helmets" => PICKUP_HELMET], |
952 | ["Shields" => CFClient::Pickup::PU_SHIELD], |
1199 | ["Shields" => PICKUP_SHIELD], |
953 | ["Body Armour" => CFClient::Pickup::PU_ARMOUR], |
1200 | ["Body Armour" => PICKUP_ARMOUR], |
954 | ["Boots" => CFClient::Pickup::PU_BOOTS], |
1201 | ["Boots" => PICKUP_BOOTS], |
955 | ["Gloves" => CFClient::Pickup::PU_GLOVES], |
1202 | ["Gloves" => PICKUP_GLOVES], |
956 | ["Cloaks" => CFClient::Pickup::PU_CLOAK], |
1203 | ["Cloaks" => PICKUP_CLOAK], |
957 | ], |
1204 | ], |
958 | |
1205 | |
959 | ["Readables", 2, 2, |
1206 | ["Readables", 2, 2, |
960 | ["Spellbooks" => CFClient::Pickup::PU_SPELLBOOK], |
1207 | ["Spellbooks" => PICKUP_SPELLBOOK], |
961 | ["Skillscrolls" => CFClient::Pickup::PU_SKILLSCROLL], |
1208 | ["Skillscrolls" => PICKUP_SKILLSCROLL], |
962 | ["Normal Books/Scrolls" => CFClient::Pickup::PU_READABLES], |
1209 | ["Normal Books/Scrolls" => PICKUP_READABLES], |
963 | ], |
1210 | ], |
964 | ["Misc", 2, 7, |
1211 | ["Misc", 2, 7, |
965 | ["Food" => CFClient::Pickup::PU_FOOD], |
1212 | ["Food" => PICKUP_FOOD], |
966 | ["Drinks" => CFClient::Pickup::PU_DRINK], |
1213 | ["Drinks" => PICKUP_DRINK], |
967 | ["Valuables (Money, Gems)" => CFClient::Pickup::PU_VALUABLES], |
1214 | ["Valuables (Money, Gems)" => PICKUP_VALUABLES], |
968 | ["Keys" => CFClient::Pickup::PU_KEY], |
1215 | ["Keys" => PICKUP_KEY], |
969 | ["Magical Items" => CFClient::Pickup::PU_MAGICAL], |
1216 | ["Magical Items" => PICKUP_MAGICAL], |
970 | ["Potions" => CFClient::Pickup::PU_POTION], |
1217 | ["Potions" => PICKUP_POTION], |
971 | ["Magic Devices" => CFClient::Pickup::PU_MAGIC_DEVICE], |
1218 | ["Magic Devices" => PICKUP_MAGIC_DEVICE], |
972 | ["Ignore cursed" => CFClient::Pickup::PU_NOT_CURSED], |
1219 | ["Ignore cursed" => PICKUP_NOT_CURSED], |
973 | ["Jewelery" => CFClient::Pickup::PU_JEWELS], |
1220 | ["Jewelery" => PICKUP_JEWELS], |
974 | ], |
1221 | ], |
|
|
1222 | ["Weight/Value ratio", 2, 17] |
975 | ) |
1223 | ) |
976 | { |
1224 | { |
977 | my ($title, $x, $y, @bits) = @$_; |
1225 | my ($title, $x, $y, @bits) = @$_; |
978 | $table->add ($x, $y, new CFClient::UI::Label text => $title, align => 1, fg => [1, 1, 0]); |
1226 | $table->add ($x, $y, new CFClient::UI::Label text => $title, align => 1, fg => [1, 1, 0]); |
979 | |
1227 | |
… | |
… | |
984 | $table->add ($x , $y, new CFClient::UI::Label text => $_->[0], align => 1, expand => 1); |
1232 | $table->add ($x , $y, new CFClient::UI::Label text => $_->[0], align => 1, expand => 1); |
985 | $table->add ($x+1, $y, new CFClient::UI::CheckBox |
1233 | $table->add ($x+1, $y, new CFClient::UI::CheckBox |
986 | state => $CFG->{pickup} & $mask, |
1234 | state => $CFG->{pickup} & $mask, |
987 | on_changed => sub { |
1235 | on_changed => sub { |
988 | my ($box, $value) = @_; |
1236 | my ($box, $value) = @_; |
|
|
1237 | |
989 | if ($value) { |
1238 | if ($value) { |
990 | $::CFG->{pickup} |= $mask; |
1239 | $::CFG->{pickup} |= $mask; |
991 | } else { |
1240 | } else { |
992 | $::CFG->{pickup} = $::CFG->{pickup} & ~$mask; |
1241 | $::CFG->{pickup} &= ~$mask; |
993 | } |
1242 | } |
|
|
1243 | |
994 | $::CONN->send (sprintf "command pickup %u", $::CFG->{pickup}) |
1244 | $::CONN->send_command ("pickup $::CFG->{pickup}") |
995 | if defined $::CONN; |
1245 | if defined $::CONN; |
|
|
1246 | |
|
|
1247 | 0 |
996 | }); |
1248 | }); |
997 | } |
1249 | } |
998 | } |
1250 | } |
999 | |
1251 | |
|
|
1252 | $table->add (2, 18, new CFClient::UI::ValSlider |
|
|
1253 | range => [0, 0, 16, 1, 1], |
|
|
1254 | to_value => sub { ">= " . 5 * $_[0] }, |
|
|
1255 | on_changed => sub { |
|
|
1256 | my ($slider, $value) = @_; |
|
|
1257 | |
|
|
1258 | $::CFG->{pickup} &= ~0x7; |
|
|
1259 | $::CFG->{pickup} |= int $value |
|
|
1260 | if $value; |
|
|
1261 | 1; |
|
|
1262 | }); |
|
|
1263 | $table->add (3, 18, new CFClient::UI::Button |
|
|
1264 | text => "set", |
|
|
1265 | on_activate => sub { |
|
|
1266 | $::CONN->send_command ("pickup $::CFG->{pickup}") |
|
|
1267 | if defined $::CONN; |
|
|
1268 | 0 |
|
|
1269 | }); |
|
|
1270 | |
1000 | $table |
1271 | $table |
1001 | } |
1272 | } |
1002 | |
1273 | |
1003 | sub make_inventory_window { |
1274 | sub inventory_window { |
1004 | my $invwin = $INV_WINDOW = new CFClient::UI::FancyFrame |
1275 | my $invwin = $INV_WINDOW = new CFClient::UI::FancyFrame |
1005 | x => "center", |
1276 | x => "center", |
1006 | y => "center", |
1277 | y => "center", |
1007 | force_w => $WIDTH * 9/10, |
1278 | force_w => $WIDTH * 9/10, |
1008 | force_h => $HEIGHT * 9/10, |
1279 | force_h => $HEIGHT * 9/10, |
1009 | title => "Inventory", |
1280 | title => "Inventory", |
|
|
1281 | has_close_button => 1, |
1010 | ; |
1282 | ; |
1011 | |
1283 | |
1012 | $invwin->add (my $hb = new CFClient::UI::HBox homogeneous => 1); |
1284 | $invwin->add (my $hb = new CFClient::UI::HBox homogeneous => 1); |
1013 | |
1285 | |
1014 | $hb->add (my $vb1 = new CFClient::UI::VBox); |
1286 | $hb->add (my $vb1 = new CFClient::UI::VBox); |
… | |
… | |
1036 | |
1308 | |
1037 | my $refresh; |
1309 | my $refresh; |
1038 | $refresh = sub { |
1310 | $refresh = sub { |
1039 | $binding_list->clear (); |
1311 | $binding_list->clear (); |
1040 | |
1312 | |
1041 | for my $mod (keys %{$::CFG->{bindings}}) { |
1313 | for my $mod (keys %{$::CFG->{profile}{default}{bindings}}) { |
1042 | for my $sym (keys %{$::CFG->{bindings}->{$mod}}) { |
1314 | for my $sym (keys %{$::CFG->{profile}{default}{bindings}{$mod}}) { |
1043 | my $cmds = $::CFG->{bindings}->{$mod}->{$sym}; |
1315 | my $cmds = $::CFG->{profile}{default}{bindings}{$mod}{$sym}; |
1044 | next unless ref $cmds eq 'ARRAY' and @$cmds > 0; |
1316 | next unless ref $cmds eq 'ARRAY' and @$cmds > 0; |
1045 | |
1317 | |
1046 | my $lbl = join "; ", @$cmds; |
1318 | my $lbl = join "; ", @$cmds; |
1047 | my $nam = CFClient::Binder::keycombo_to_name ($mod, $sym); |
1319 | my $nam = CFClient::Binder::keycombo_to_name ($mod, $sym); |
1048 | $binding_list->add (my $hb = new CFClient::UI::HBox); |
1320 | $binding_list->add (my $hb = new CFClient::UI::HBox); |
1049 | $hb->add (new CFClient::UI::Button |
1321 | $hb->add (new CFClient::UI::Button |
1050 | text => "delete", |
1322 | text => "delete", |
1051 | tooltip => "Deletes the binding", |
1323 | tooltip => "Deletes the binding", |
1052 | on_activate => sub { |
1324 | on_activate => sub { |
1053 | $binding_list->remove ($hb); |
1325 | $binding_list->remove ($hb); |
1054 | delete $::CFG->{bindings}->{$mod}->{$sym}; |
1326 | delete $::CFG->{profile}{default}{bindings}{$mod}{$sym}; |
|
|
1327 | 0 |
1055 | }); |
1328 | }); |
1056 | |
1329 | |
1057 | $hb->add (new CFClient::UI::Button |
1330 | $hb->add (new CFClient::UI::Button |
1058 | text => "edit", |
1331 | text => "edit", |
1059 | tooltip => "Edits the binding", |
1332 | tooltip => "Edits the binding", |
1060 | on_activate => sub { |
1333 | on_activate => sub { |
1061 | $::BIND_EDITOR->set_binding ( |
1334 | $::BIND_EDITOR->set_binding ( |
1062 | $mod, $sym, $::CFG->{bindings}->{$mod}->{$sym}, |
1335 | $mod, $sym, $::CFG->{profile}{default}{bindings}{$mod}{$sym}, |
1063 | sub { |
1336 | sub { |
1064 | my ($nmod, $nsym, $ncmds) = @_; |
1337 | my ($nmod, $nsym, $ncmds) = @_; |
1065 | delete $::CFG->{bindings}->{$mod}->{$sym}; |
1338 | delete $::CFG->{profile}{default}{bindings}{$mod}{$sym}; |
1066 | $::CFG->{bindings}->{$nmod}->{$nsym} = $ncmds; |
1339 | $::CFG->{profile}{default}{bindings}{$nmod}{$nsym} = $ncmds; |
1067 | $refresh->(); |
1340 | $refresh->(); |
1068 | $SETUP_NOTEBOOK->set_current_page ($SETUP_KEYBOARD); |
1341 | $SETUP_NOTEBOOK->set_current_page ($SETUP_KEYBOARD); |
1069 | $SETUP_DIALOG->show; |
1342 | $SETUP_DIALOG->show; |
1070 | }, |
1343 | }, |
1071 | sub { |
1344 | sub { |
1072 | $SETUP_NOTEBOOK->set_current_page ($SETUP_KEYBOARD); |
1345 | $SETUP_NOTEBOOK->set_current_page ($SETUP_KEYBOARD); |
1073 | $SETUP_DIALOG->show; |
1346 | $SETUP_DIALOG->show; |
1074 | }); |
1347 | }); |
1075 | $::BIND_EDITOR->show; |
1348 | $::BIND_EDITOR->show; |
1076 | $SETUP_DIALOG->hide; |
1349 | $SETUP_DIALOG->hide; |
|
|
1350 | 0 |
1077 | }); |
1351 | }); |
1078 | |
1352 | |
1079 | $hb->add (new CFClient::UI::Label text => "(Key: $nam)"); |
1353 | $hb->add (new CFClient::UI::Label text => "(Key: $nam)"); |
1080 | $hb->add (new CFClient::UI::Label text => $lbl, expand => 1); |
1354 | $hb->add (new CFClient::UI::Label text => $lbl, expand => 1); |
1081 | } |
1355 | } |
1082 | } |
1356 | } |
1083 | }; |
1357 | }; |
1084 | |
1358 | |
1085 | my $vb = new CFClient::UI::VBox; |
1359 | my $vb = new CFClient::UI::VBox; |
|
|
1360 | $vb->add (my $hb = new CFClient::UI::HBox); |
|
|
1361 | $hb->add (new CFClient::UI::Label text => "only shift-up stops fire"); |
|
|
1362 | $hb->add (new CFClient::UI::CheckBox |
|
|
1363 | expand => 1, |
|
|
1364 | state => $CFG->{shift_fire_stop}, |
|
|
1365 | tooltip => "If this checkbox is enabled you will stop fire only if you stop pressing shift", |
|
|
1366 | on_changed => sub { |
|
|
1367 | my ($cbox, $value) = @_; |
|
|
1368 | $CFG->{shift_fire_stop} = $value; |
|
|
1369 | 0 |
|
|
1370 | }); |
|
|
1371 | |
1086 | $vb->add ($binding_list); |
1372 | $vb->add ($binding_list); |
1087 | $vb->add (my $hb = new CFClient::UI::HBox); |
1373 | $vb->add (my $hb = new CFClient::UI::HBox); |
1088 | |
1374 | |
1089 | $hb->add (new CFClient::UI::Button |
1375 | $hb->add (new CFClient::UI::Button |
1090 | text => "record new", |
1376 | text => "record new", |
… | |
… | |
1092 | tooltip => "This button opens the binding editor with an empty binding.", |
1378 | tooltip => "This button opens the binding editor with an empty binding.", |
1093 | on_activate => sub { |
1379 | on_activate => sub { |
1094 | $::BIND_EDITOR->set_binding (undef, undef, [], |
1380 | $::BIND_EDITOR->set_binding (undef, undef, [], |
1095 | sub { |
1381 | sub { |
1096 | my ($mod, $sym, $cmds) = @_; |
1382 | my ($mod, $sym, $cmds) = @_; |
1097 | $::CFG->{bindings}->{$mod}->{$sym} = $cmds; |
1383 | $::CFG->{profile}{default}{bindings}{$mod}{$sym} = $cmds; |
1098 | $refresh->(); |
1384 | $refresh->(); |
1099 | $SETUP_NOTEBOOK->set_current_page ($SETUP_KEYBOARD); |
1385 | $SETUP_NOTEBOOK->set_current_page ($SETUP_KEYBOARD); |
1100 | $SETUP_DIALOG->show; |
1386 | $SETUP_DIALOG->show; |
1101 | }, |
1387 | }, |
1102 | sub { |
1388 | sub { |
1103 | $SETUP_NOTEBOOK->set_current_page ($SETUP_KEYBOARD); |
1389 | $SETUP_NOTEBOOK->set_current_page ($SETUP_KEYBOARD); |
1104 | $SETUP_DIALOG->show; |
1390 | $SETUP_DIALOG->show; |
1105 | }); |
1391 | }, |
|
|
1392 | ); |
1106 | $SETUP_DIALOG->hide; |
1393 | $SETUP_DIALOG->hide; |
1107 | $::BIND_EDITOR->show; |
1394 | $::BIND_EDITOR->show; |
|
|
1395 | 0 |
1108 | }, |
1396 | }, |
1109 | ); |
1397 | ); |
1110 | |
1398 | |
1111 | $hb->add (new CFClient::UI::Button |
1399 | $hb->add (new CFClient::UI::Button |
1112 | text => "close", |
1400 | text => "close", |
1113 | tooltip => "Closes the binding window", |
1401 | tooltip => "Closes the binding window", |
1114 | expand => 1, |
1402 | expand => 1, |
1115 | on_activate => sub { |
1403 | on_activate => sub { |
1116 | $SETUP_DIALOG->hide; |
1404 | $SETUP_DIALOG->hide; |
|
|
1405 | 0 |
1117 | } |
1406 | } |
1118 | ); |
1407 | ); |
1119 | |
1408 | |
1120 | $refresh->(); |
1409 | $refresh->(); |
1121 | |
1410 | |
1122 | $vb |
1411 | $vb |
1123 | } |
1412 | } |
1124 | |
1413 | |
1125 | sub make_help_window { |
1414 | sub help_window { |
1126 | my $win = new CFClient::UI::FancyFrame |
1415 | my $win = new CFClient::UI::FancyFrame |
1127 | x => 'center', |
1416 | x => 'center', |
1128 | y => 'center', |
1417 | y => 'center', |
|
|
1418 | z => 2, |
1129 | name => 'doc_browser', |
1419 | name => 'doc_browser', |
1130 | force_w => int $WIDTH * 7/8, |
1420 | force_w => int $WIDTH * 7/8, |
1131 | force_h => int $HEIGHT * 7/8, |
1421 | force_h => int $HEIGHT * 7/8, |
1132 | title => "Documentation"; |
1422 | title => "Documentation"; |
1133 | |
1423 | |
1134 | $win->add (my $vbox = new CFClient::UI::VBox); |
1424 | $win->add (my $vbox = new CFClient::UI::VBox); |
1135 | |
1425 | |
1136 | $vbox->add (my $buttons = new CFClient::UI::HBox); |
1426 | $vbox->add (my $buttons = new CFClient::UI::HBox); |
1137 | $vbox->add (my $viewer = new CFClient::UI::TextView expand => 1, fontsize => 0.8); |
1427 | $vbox->add (my $viewer = new CFClient::UI::TextScroller |
|
|
1428 | expand => 1, fontsize => 0.8, padding_x => 4); |
1138 | |
1429 | |
1139 | for ( |
1430 | $buttons->add (new CFClient::UI::Label text => "Choose a document to display: "); |
|
|
1431 | $buttons->add (my $combo = new CFClient::UI::Combobox |
|
|
1432 | value => undef, |
|
|
1433 | options => [ |
1140 | [intro => "Introduction"], |
1434 | [intro => "Introduction"], |
1141 | [manual => "Manual"], |
1435 | [manual => "Manual"], |
|
|
1436 | [skill_help => "Skills"], |
1142 | [command_help => "Commands"], |
1437 | [command_help => "Commands"], |
1143 | [skill_help => "Skills"], |
1438 | [dmcommand_help => "DM Commands"], |
1144 | ) { |
1439 | [COPYING => "License Terms"], |
1145 | my ($pod, $label) = @$_; |
1440 | ], |
|
|
1441 | on_changed => sub { |
|
|
1442 | my ($self, $pod) = @_; |
1146 | |
1443 | |
1147 | $buttons->add (new CFClient::UI::Button |
1444 | my $pom = CFClient::load_pod CFClient::find_rcfile "pod/$pod.pod", |
1148 | text => $label, |
1445 | doc_viewer => 1, sub { CFClient::pod_to_pango_list $_[0] }; |
1149 | on_activate => sub { |
|
|
1150 | my $parser = new Pod::POM; |
|
|
1151 | my $pom = $parser->parse_file (CFClient::find_rcfile "pod/$pod.pod"); |
|
|
1152 | |
1446 | |
1153 | $viewer->clear; |
1447 | $viewer->clear; |
1154 | |
1448 | |
1155 | $viewer->add_paragraph ([1, 1, 1, 1], $_->[1], $_->[0]) |
1449 | $viewer->add_paragraph ([1, 1, 1, 1], $_->[1], $_->[0]) |
1156 | for @{ CFClient::pod_to_pango_list $pom }; |
1450 | for @$pom; |
1157 | |
1451 | |
1158 | $viewer->set_offset (0); |
1452 | $viewer->set_offset (0); |
1159 | }, |
1453 | 0 |
|
|
1454 | }, |
|
|
1455 | on_visibility_change => sub { |
|
|
1456 | my ($self, $visible) = @_; |
|
|
1457 | return unless $visible; |
|
|
1458 | return if $self->{value}; |
|
|
1459 | $self->set_value ("intro"); |
|
|
1460 | 0 |
|
|
1461 | }, |
1160 | ); |
1462 | ); |
1161 | } |
|
|
1162 | |
|
|
1163 | $viewer->add_paragraph ([1, 1, 0, 1], "<big>Use one of the buttons above to display a document.</big>"); |
|
|
1164 | |
1463 | |
1165 | $win |
1464 | $win |
1166 | } |
1465 | } |
1167 | |
1466 | |
1168 | sub sdl_init { |
1467 | sub sdl_init { |
… | |
… | |
1208 | $DEBUG_STATUS->show; |
1507 | $DEBUG_STATUS->show; |
1209 | |
1508 | |
1210 | $BIND_EDITOR = new CFClient::UI::BindEditor (x => "max", y => 0); |
1509 | $BIND_EDITOR = new CFClient::UI::BindEditor (x => "max", y => 0); |
1211 | |
1510 | |
1212 | $STATUSBOX = new CFClient::UI::Statusbox; |
1511 | $STATUSBOX = new CFClient::UI::Statusbox; |
1213 | $STATUSBOX->add ("Use <b>Alt-Enter</b> to toggle fullscreen mode", pri => -100, color => [1, 1, 1, 0.8]); |
1512 | $STATUSBOX->add ("Use <b>Alt-Enter</b> to toggle fullscreen mode", timeout => 864000, pri => -100, color => [1, 1, 1, 0.8]); |
1214 | |
1513 | |
1215 | (new CFClient::UI::Frame |
1514 | (new CFClient::UI::Frame |
1216 | bg => [0, 0, 0, 0.4], |
1515 | bg => [0, 0, 0, 0.4], |
1217 | force_x => 0, |
1516 | force_x => 0, |
1218 | force_y => "max", |
1517 | force_y => "max", |
… | |
… | |
1235 | $MAPWIDGET->connect (activate_console => sub { |
1534 | $MAPWIDGET->connect (activate_console => sub { |
1236 | my ($mapwidget, $preset) = @_; |
1535 | my ($mapwidget, $preset) = @_; |
1237 | |
1536 | |
1238 | if ($CONSOLE) { |
1537 | if ($CONSOLE) { |
1239 | $CONSOLE->{input}->{auto_activated} = 1; |
1538 | $CONSOLE->{input}->{auto_activated} = 1; |
1240 | $CONSOLE->{input}->focus_in; |
1539 | $CONSOLE->{input}->grab_focus; |
1241 | |
1540 | |
1242 | if ($preset && $CONSOLE->{input}->get_text eq '') { |
1541 | if ($preset && $CONSOLE->{input}->get_text eq '') { |
1243 | $CONSOLE->{input}->set_text ($preset); |
1542 | $CONSOLE->{input}->set_text ($preset); |
1244 | } |
1543 | } |
1245 | } |
1544 | } |
1246 | }); |
1545 | }); |
1247 | $MAPWIDGET->show; |
1546 | $MAPWIDGET->show; |
1248 | $MAPWIDGET->focus_in; |
1547 | $MAPWIDGET->grab_focus; |
1249 | |
1548 | |
1250 | $LOGVIEW = new CFClient::UI::TextView |
1549 | $LOGVIEW = new CFClient::UI::TextScroller |
1251 | expand => 1, |
1550 | expand => 1, |
1252 | font => $FONT_FIXED, |
1551 | font => $FONT_FIXED, |
1253 | fontsize => $::CFG->{log_fontsize}, |
1552 | fontsize => $::CFG->{log_fontsize}, |
|
|
1553 | indent => -4, |
1254 | can_hover => 1, |
1554 | can_hover => 1, |
1255 | can_events => 1, |
1555 | can_events => 1, |
1256 | tooltip => "<b>Server Log</b>. This text viewer contains all the messages sent by the server.", |
1556 | tooltip => "<b>Server Log</b>. This text viewer contains all the messages sent by the server.", |
1257 | ; |
1557 | ; |
1258 | |
1558 | |
1259 | $SETUP_DIALOG = new CFClient::UI::FancyFrame |
1559 | $SETUP_DIALOG = new CFClient::UI::FancyFrame |
1260 | title => "Setup", |
1560 | title => "Setup", |
1261 | name => "setup_dialog", |
1561 | name => "setup_dialog", |
1262 | x => 'center', |
1562 | x => 'center', |
1263 | y => 'center', |
1563 | y => 'center', |
|
|
1564 | z => 2, |
1264 | force_w => $::WIDTH * 0.6, |
1565 | force_w => $::WIDTH * 0.6, |
1265 | force_h => $::HEIGHT * 0.6, |
1566 | force_h => $::HEIGHT * 0.6, |
|
|
1567 | has_close_button => 1, |
1266 | ; |
1568 | ; |
1267 | |
1569 | |
1268 | $SETUP_DIALOG->add ($SETUP_NOTEBOOK = new CFClient::UI::Notebook expand => 1, debug => 1, |
1570 | $SETUP_DIALOG->add ($SETUP_NOTEBOOK = new CFClient::UI::Notebook expand => 1, debug => 1, |
1269 | filter => new CFClient::UI::ScrolledWindow xxx => 1, expand => 1, scroll_y => 1); |
1571 | filter => new CFClient::UI::ScrolledWindow expand => 1, scroll_y => 1); |
1270 | |
1572 | |
1271 | $SETUP_NOTEBOOK->add (Server => $SETUP_SERVER = server_setup, |
1573 | $SETUP_NOTEBOOK->add (Server => $SETUP_SERVER = server_setup, |
1272 | "Configure the server to play on, your username, password and other server-related options."); |
1574 | "Configure the server to play on, your username, password and other server-related options."); |
1273 | $SETUP_NOTEBOOK->add (Pickup => autopickup_setup, |
1575 | $SETUP_NOTEBOOK->add (Pickup => autopickup_setup, |
1274 | "Configure autopicking stetings, i.e. which items you will pick up automatically when walking over them."); |
1576 | "Configure autopickup settings, i.e. which items you will pick up automatically when walking (or running) over them."); |
1275 | $SETUP_NOTEBOOK->add (Graphics => graphics_setup, |
1577 | $SETUP_NOTEBOOK->add (Graphics => graphics_setup, |
1276 | "Configure the video mode, performance, fonts and other graphical aspects of the game."); |
1578 | "Configure the video mode, performance, fonts and other graphical aspects of the game."); |
1277 | $SETUP_NOTEBOOK->add (Audio => audio_setup, |
1579 | $SETUP_NOTEBOOK->add (Audio => audio_setup, |
1278 | "Configure the use of audio, sound effects and background music."); |
1580 | "Configure the use of audio, sound effects and background music."); |
1279 | $SETUP_NOTEBOOK->add (Keyboard => $SETUP_KEYBOARD = keyboard_setup, |
1581 | $SETUP_NOTEBOOK->add (Keyboard => $SETUP_KEYBOARD = keyboard_setup, |
1280 | "Lets you define, edit and delete bindings." |
1582 | "Lets you define, edit and delete key bindings." |
1281 | . "There is a shortcut for making bindings: Left Control + Insert opens the binding editor " |
1583 | . "There is a shortcut for making bindings: <b>Control-Insert</b> opens the binding editor " |
1282 | . "with nothing set and the recording started. After doing the actions you " |
1584 | . "with nothing set and the recording started. After doing the actions you " |
1283 | . "want to record press Insert and you will be asked to press a key-combo." |
1585 | . "want to record press <b>Insert</b> and you will be asked to press a key-combo. " |
1284 | . "After pressing the combo the binding will be saved automatically and the " |
1586 | . "After pressing the combo the binding will be saved automatically and the " |
1285 | . "binding editor closes"); |
1587 | . "binding editor closes"); |
1286 | $SETUP_NOTEBOOK->add (Spells => $SETUP_SPELLS = spell_setup, |
1588 | $SETUP_NOTEBOOK->add (Spells => $SETUP_SPELLS = spell_setup, |
1287 | "Displays all spells you have and lets you edit keyboard shortcuts for them."); |
1589 | "Displays all spells you have and lets you edit keyboard shortcuts for them."); |
|
|
1590 | $SETUP_NOTEBOOK->add (Debug => debug_setup, |
|
|
1591 | "Some debuggin' options. Do not ask."); |
1288 | |
1592 | |
1289 | $BUTTONBAR = new CFClient::UI::HBox x => 0, y => 0; |
1593 | $BUTTONBAR = new CFClient::UI::Buttonbar x => 0, y => 0, z => 200; # put on top |
1290 | |
1594 | |
1291 | $BUTTONBAR->add (new CFClient::UI::Flopper text => "Setup", other => $SETUP_DIALOG, |
1595 | $BUTTONBAR->add (new CFClient::UI::Flopper text => "Setup", other => $SETUP_DIALOG, |
1292 | tooltip => "Toggles a dialog where you can configure all aspects of this client."); |
1596 | tooltip => "Toggles a dialog where you can configure all aspects of this client."); |
1293 | |
1597 | |
1294 | $BUTTONBAR->add (new CFClient::UI::Flopper text => "Message Window", other => message_window, |
1598 | $BUTTONBAR->add (new CFClient::UI::Flopper text => "Message Window", other => $MESSAGE_WINDOW = message_window, |
1295 | tooltip => "Toggles the server message log, where the client collects <i>all</i> messages from the server."); |
1599 | tooltip => "Toggles the server message log, where the client collects <i>all</i> messages from the server."); |
1296 | |
1600 | |
1297 | make_gauge_window->show; # XXX: this has to be set before make_stats_window as make_stats_window calls update_stats_window which updated the gauges also X-D |
1601 | make_gauge_window->show; # XXX: this has to be set before make_stats_window as make_stats_window calls update_stats_window which updated the gauges also X-D |
1298 | |
1602 | |
1299 | $BUTTONBAR->add (new CFClient::UI::Flopper text => "Stats Window", other => make_stats_window, |
1603 | $BUTTONBAR->add (new CFClient::UI::Flopper text => "Stats Window", other => $STATS_WINDOW = stats_window, |
1300 | tooltip => "Toggles the statistics window, where all your Stats and Resistances are being displayed at all times."); |
1604 | tooltip => "Toggles the statistics window, where all your Stats and Resistances are being displayed at all times."); |
1301 | $BUTTONBAR->add (new CFClient::UI::Flopper text => "Inventory", other => make_inventory_window, |
1605 | $BUTTONBAR->add (new CFClient::UI::Flopper text => "Inventory", other => inventory_window, |
1302 | tooltip => "Toggles the inventory window, where you can manage your loot (or treasures :). " |
1606 | tooltip => "Toggles the inventory window, where you can manage your loot (or treasures :). " |
1303 | ."You can also hit the <b>Tab</b>-key to show/hide the Inventory."); |
1607 | . "You can also hit the <b>Tab</b>-key to show/hide the Inventory."); |
1304 | |
1608 | |
1305 | $BUTTONBAR->add (new CFClient::UI::Button |
1609 | $BUTTONBAR->add (new CFClient::UI::Button |
1306 | text => "Save Config", |
1610 | text => "Save Config", |
1307 | tooltip => "Saves the options chosen in the client setting, server settings and the window layout to be restored on later runs.", |
1611 | tooltip => "Saves the options chosen in the client setting, server settings and the window layout to be restored on later runs.", |
1308 | on_activate => sub { |
1612 | on_activate => sub { |
1309 | $::CFG->{layout} = CFClient::UI::get_layout; |
1613 | $::CFG->{layout} = CFClient::UI::get_layout; |
1310 | CFClient::write_cfg "$Crossfire::VARDIR/cfplusrc"; |
1614 | CFClient::write_cfg "$Crossfire::VARDIR/cfplusrc"; |
1311 | status "Configuration Saved"; |
1615 | status "Configuration Saved"; |
|
|
1616 | 0 |
1312 | }, |
1617 | }, |
1313 | ); |
1618 | ); |
1314 | |
1619 | |
1315 | $BUTTONBAR->add (new CFClient::UI::Flopper text => "Help!", other => make_help_window, |
1620 | $BUTTONBAR->add (new CFClient::UI::Flopper text => "Help!", other => help_window, |
1316 | tooltip => "View Documentation"); |
1621 | tooltip => "View Documentation"); |
1317 | |
1622 | |
1318 | $BUTTONBAR->add (new CFClient::UI::Button |
1623 | $BUTTONBAR->add (new CFClient::UI::Button |
1319 | text => "Quit", |
1624 | text => "Quit", |
1320 | tooltip => "Terminates the program", |
1625 | tooltip => "Terminates the program", |
… | |
… | |
1322 | if ($CONN) { |
1627 | if ($CONN) { |
1323 | open_quit_dialog; |
1628 | open_quit_dialog; |
1324 | } else { |
1629 | } else { |
1325 | exit; |
1630 | exit; |
1326 | } |
1631 | } |
|
|
1632 | 0 |
1327 | }, |
1633 | }, |
1328 | ); |
1634 | ); |
1329 | |
1635 | |
1330 | $BUTTONBAR->show; |
1636 | $BUTTONBAR->show; |
1331 | $SETUP_DIALOG->show; |
1637 | $SETUP_DIALOG->show; |
… | |
… | |
1333 | |
1639 | |
1334 | $STATUSBOX->add ("Set video mode $WIDTH×$HEIGHT", timeout => 10, fg => [1, 1, 1, 0.5]); |
1640 | $STATUSBOX->add ("Set video mode $WIDTH×$HEIGHT", timeout => 10, fg => [1, 1, 1, 0.5]); |
1335 | } |
1641 | } |
1336 | |
1642 | |
1337 | sub video_shutdown { |
1643 | sub video_shutdown { |
|
|
1644 | CFClient::OpenGL::shutdown; |
|
|
1645 | |
1338 | undef $SDL_ACTIVE; |
1646 | undef $SDL_ACTIVE; |
1339 | } |
1647 | } |
1340 | |
1648 | |
1341 | my @bgmusic = qw(game1.ogg game2.ogg game3.ogg game5.ogg game6.ogg ross1.ogg ross2.ogg ross3.ogg ross4.ogg ross5.ogg); #d# |
1649 | my @bgmusic = qw(game1.ogg game2.ogg game3.ogg game5.ogg game6.ogg ross1.ogg ross2.ogg ross3.ogg ross4.ogg ross5.ogg); #d# |
1342 | my $bgmusic;#TODO#hack#d# |
1650 | my $bgmusic;#TODO#hack#d# |
… | |
… | |
1558 | |
1866 | |
1559 | CFClient::read_cfg "$Crossfire::VARDIR/cfplusrc"; |
1867 | CFClient::read_cfg "$Crossfire::VARDIR/cfplusrc"; |
1560 | CFClient::UI::set_layout ($::CFG->{layout}); |
1868 | CFClient::UI::set_layout ($::CFG->{layout}); |
1561 | |
1869 | |
1562 | my %DEF_CFG = ( |
1870 | my %DEF_CFG = ( |
1563 | sdl_mode => 0, |
1871 | sdl_mode => 0, |
1564 | width => 640, |
1872 | width => 640, |
1565 | height => 480, |
1873 | height => 480, |
1566 | fullscreen => 0, |
1874 | fullscreen => 0, |
1567 | fast => 0, |
1875 | fast => 0, |
1568 | map_scale => 1, |
1876 | map_scale => 1, |
1569 | fow_enable => 1, |
1877 | fow_enable => 1, |
1570 | fow_intensity => 0.45, |
1878 | fow_intensity => 0.45, |
1571 | fow_smooth => 0, |
1879 | fow_smooth => 0, |
1572 | gui_fontsize => 1, |
1880 | gui_fontsize => 1, |
1573 | log_fontsize => 1, |
1881 | log_fontsize => 0.7, |
1574 | gauge_fontsize=> 1, |
1882 | gauge_fontsize => 1, |
1575 | gauge_size => 0.35, |
1883 | gauge_size => 0.35, |
1576 | stat_fontsize => 1, |
1884 | stat_fontsize => 0.7, |
1577 | mapsize => 100, |
1885 | mapsize => 100, |
1578 | host => "crossfire.schmorp.de", |
|
|
1579 | say_command => 'say', |
1886 | say_command => 'say', |
1580 | audio_enable => 1, |
1887 | audio_enable => 1, |
1581 | bgm_enable => 1, |
1888 | bgm_enable => 1, |
1582 | bgm_volume => 0.25, |
1889 | bgm_volume => 0.25, |
1583 | face_prefetch => 0, |
1890 | face_prefetch => 0, |
1584 | output_sync => 1, |
1891 | output_sync => 1, |
1585 | output_count => 1, |
1892 | output_count => 1, |
|
|
1893 | pickup => 0, |
|
|
1894 | default => "profile", # default profile |
|
|
1895 | ); |
1586 | ); |
1896 | |
1587 | |
|
|
1588 | while (my ($k, $v) = each %DEF_CFG) { |
1897 | while (my ($k, $v) = each %DEF_CFG) { |
1589 | $CFG->{$k} = $v unless exists $CFG->{$k}; |
1898 | $CFG->{$k} = $v unless exists $CFG->{$k}; |
1590 | } |
1899 | } |
|
|
1900 | |
|
|
1901 | $CFG->{profile}{default}{host} ||= "crossfire.schmorp.de"; |
1591 | |
1902 | |
1592 | sdl_init; |
1903 | sdl_init; |
1593 | |
1904 | |
1594 | @SDL_MODES = reverse |
1905 | @SDL_MODES = reverse |
1595 | grep $_->[0] >= 640 && $_->[1] >= 480, |
1906 | grep $_->[0] >= 640 && $_->[1] >= 480, |
… | |
… | |
1637 | video_init; |
1948 | video_init; |
1638 | audio_init; |
1949 | audio_init; |
1639 | } |
1950 | } |
1640 | |
1951 | |
1641 | Event::loop; |
1952 | Event::loop; |
|
|
1953 | #CFClient::SDL_Quit; |
|
|
1954 | #CFClient::_exit 0; |
1642 | |
1955 | |
1643 | END { CFClient::SDL_Quit } |
1956 | END { CFClient::SDL_Quit } |
1644 | |
1957 | |
1645 | =head1 NAME |
1958 | =head1 NAME |
1646 | |
1959 | |