… | |
… | |
36 | our @SDL_MODES; |
36 | our @SDL_MODES; |
37 | our $WIDTH; |
37 | our $WIDTH; |
38 | our $HEIGHT; |
38 | our $HEIGHT; |
39 | our $FULLSCREEN; |
39 | our $FULLSCREEN; |
40 | our $FONTSIZE; |
40 | our $FONTSIZE; |
|
|
41 | |
|
|
42 | our $FONT_PROP; |
|
|
43 | our $FONT_FIXED; |
41 | |
44 | |
42 | our $MAP; |
45 | our $MAP; |
43 | our $MAPWIDGET; |
46 | our $MAPWIDGET; |
44 | our $BUTTONBAR; |
47 | our $BUTTONBAR; |
45 | our $LOGVIEW; |
48 | our $LOGVIEW; |
46 | our $CONSOLE; |
49 | our $CONSOLE; |
47 | our $METASERVER; |
50 | our $METASERVER; |
48 | |
51 | |
49 | our $GAUGES; |
52 | our $GAUGES; |
|
|
53 | our $STATWIDS; |
50 | |
54 | |
51 | our $SDL_ACTIVE; |
55 | our $SDL_ACTIVE; |
52 | our %SDL_CB; |
56 | our %SDL_CB; |
53 | |
57 | |
54 | our $SDL_MIXER; |
58 | our $SDL_MIXER; |
… | |
… | |
116 | $CFG->{sdl_mode} = $self->{range}[0] = $value = int $value; |
120 | $CFG->{sdl_mode} = $self->{range}[0] = $value = int $value; |
117 | $mode_label->set_text (sprintf "%dx%d", @{$SDL_MODES[$value]}); |
121 | $mode_label->set_text (sprintf "%dx%d", @{$SDL_MODES[$value]}); |
118 | }); |
122 | }); |
119 | $mode_slider->emit (changed => $mode_slider->{range}[0]); |
123 | $mode_slider->emit (changed => $mode_slider->{range}[0]); |
120 | |
124 | |
|
|
125 | my $row = 1; |
|
|
126 | |
121 | $table->add (0, 1, new CFClient::UI::Label valign => 0, align => 1, text => "Fullscreen"); |
127 | $table->add (0, $row, new CFClient::UI::Label valign => 0, align => 1, text => "Fullscreen"); |
122 | $table->add (1, 1, new CFClient::UI::CheckBox state => $CFG->{fullscreen}, connect_changed => sub { |
128 | $table->add (1, $row++, new CFClient::UI::CheckBox |
|
|
129 | state => $CFG->{fullscreen}, |
|
|
130 | tooltip => "Bring the client into fullscreen mode", |
|
|
131 | connect_changed => sub { |
123 | my ($self, $value) = @_; |
132 | my ($self, $value) = @_; |
124 | $CFG->{fullscreen} = $value; |
133 | $CFG->{fullscreen} = $value; |
|
|
134 | } |
125 | }); |
135 | ); |
126 | |
136 | |
127 | $table->add (0, 2, new CFClient::UI::Label valign => 0, align => 1, text => "Fast & Ugly"); |
137 | $table->add (0, $row, new CFClient::UI::Label valign => 0, align => 1, text => "Fast & Ugly"); |
128 | $table->add (1, 2, new CFClient::UI::CheckBox state => $CFG->{fast}, connect_changed => sub { |
138 | $table->add (1, $row++, new CFClient::UI::CheckBox |
|
|
139 | state => $CFG->{fast}, |
|
|
140 | tooltip => "Lower the visual quality considerably to speed up rendering.", |
|
|
141 | connect_changed => sub { |
129 | my ($self, $value) = @_; |
142 | my ($self, $value) = @_; |
130 | $CFG->{fast} = $value; |
143 | $CFG->{fast} = $value; |
|
|
144 | } |
131 | }); |
145 | ); |
132 | |
146 | |
|
|
147 | $table->add (0, $row, new CFClient::UI::Label valign => 0, align => 1, text => "Map Scale"); |
|
|
148 | $table->add (1, $row++, new CFClient::UI::Slider |
|
|
149 | range => [$CFG->{map_scale}, 0.25, 2, 0.05], |
|
|
150 | tooltip => "Enlarge or shrink the displayed map", |
|
|
151 | connect_changed => sub { |
|
|
152 | my ($self, $value) = @_; |
|
|
153 | $CFG->{map_scale} = 0.05 * int $value / 0.05; |
|
|
154 | } |
|
|
155 | ); |
|
|
156 | |
133 | $table->add (0, 3, new CFClient::UI::Label valign => 0, align => 1, text => "Fog of War"); |
157 | $table->add (0, $row, new CFClient::UI::Label valign => 0, align => 1, text => "Fog of War"); |
134 | $table->add (1, 3, new CFClient::UI::CheckBox state => $CFG->{fow_enable}, connect_changed => sub { |
158 | $table->add (1, $row++, new CFClient::UI::CheckBox |
|
|
159 | state => $CFG->{fow_enable}, |
|
|
160 | tooltip => "Fog-of-War marks areas that cannot be seen by the player", |
|
|
161 | connect_changed => sub { |
135 | my ($self, $value) = @_; |
162 | my ($self, $value) = @_; |
136 | $CFG->{fow_enable} = $value; |
163 | $CFG->{fow_enable} = $value; |
|
|
164 | } |
137 | }); |
165 | ); |
138 | |
166 | |
139 | $table->add (0, 4, new CFClient::UI::Label valign => 0, align => 1, text => "FoW Intensity"); |
167 | $table->add (0, $row, new CFClient::UI::Label valign => 0, align => 1, text => "FoW Intensity"); |
140 | $table->add (1, 4, new CFClient::UI::Slider range => [$CFG->{fow_intensity}, 0, 1 + 0.001, 0.001], connect_changed => sub { |
168 | $table->add (1, $row++, new CFClient::UI::Slider |
|
|
169 | range => [$CFG->{fow_intensity}, 0, 1 + 0.001, 0.001], |
|
|
170 | tooltip => "The higher the intensity, the lighter the Fog-of-War color", |
|
|
171 | connect_changed => sub { |
141 | my ($self, $value) = @_; |
172 | my ($self, $value) = @_; |
142 | $CFG->{fow_intensity} = $value; |
173 | $CFG->{fow_intensity} = $value; |
|
|
174 | } |
143 | }); |
175 | ); |
144 | |
176 | |
145 | $table->add (0, 5, new CFClient::UI::Label valign => 0, align => 1, text => "FoW Smooth"); |
177 | $table->add (0, $row, new CFClient::UI::Label valign => 0, align => 1, text => "FoW Smooth"); |
146 | $table->add (1, 5, new CFClient::UI::CheckBox state => $CFG->{fow_smooth}, connect_changed => sub { |
178 | $table->add (1, $row++, new CFClient::UI::CheckBox |
|
|
179 | state => $CFG->{fow_smooth}, |
|
|
180 | tooltip => "Smooth the Fog-of-War a bit to make it more realistic", |
|
|
181 | connect_changed => sub { |
147 | my ($self, $value) = @_; |
182 | my ($self, $value) = @_; |
148 | $CFG->{fow_smooth} = $value; |
183 | $CFG->{fow_smooth} = $value; |
149 | status "Fog of War smoothing requires OpenGL 1.2 or higher" if $CFClient::GL_VERSION < 1.2; |
184 | status "Fog of War smoothing requires OpenGL 1.2 or higher" if $CFClient::GL_VERSION < 1.2; |
|
|
185 | } |
150 | }); |
186 | ); |
151 | |
187 | |
152 | $table->add (0, 6, new CFClient::UI::Label valign => 0, align => 1, text => "GUI Fontsize"); |
188 | $table->add (0, $row, new CFClient::UI::Label valign => 0, align => 1, text => "GUI Fontsize"); |
153 | $table->add (1, 6, new CFClient::UI::Slider range => [$CFG->{gui_fontsize}, 0.7, 1.7, 0.1], connect_changed => sub { |
189 | $table->add (1, $row++, new CFClient::UI::Slider |
|
|
190 | range => [$CFG->{gui_fontsize}, 0.5, 2, 0.1], |
|
|
191 | tooltip => "The font size used by most GUI elements", |
|
|
192 | connect_changed => sub { |
154 | $CFG->{gui_fontsize} = 0.1 * int $_[1] * 10; |
193 | $CFG->{gui_fontsize} = 0.1 * int $_[1] * 10; |
155 | # $FONTSIZE = int $HEIGHT / 40 * $CFG->{gui_fontsize}; |
194 | # $FONTSIZE = int $HEIGHT / 40 * $CFG->{gui_fontsize}; |
|
|
195 | } |
156 | }); |
196 | ); |
157 | |
197 | |
158 | $table->add (0, 7, new CFClient::UI::Label valign => 0, align => 1, text => "Server Log Fontsize"); |
198 | $table->add (0, $row, new CFClient::UI::Label valign => 0, align => 1, text => "Server Log Fontsize"); |
159 | $table->add (1, 7, new CFClient::UI::Slider range => [$CFG->{log_fontsize}, 0.7, 1.7, 0.1], connect_changed => sub { |
199 | $table->add (1, $row++, new CFClient::UI::Slider |
|
|
200 | range => [$CFG->{log_fontsize}, 0.5, 2, 0.1], |
|
|
201 | tooltip => "The font size used by the server log window only", |
|
|
202 | connect_changed => sub { |
160 | $LOGVIEW->set_fontsize ($CFG->{log_fontsize} = 0.1 * int $_[1] * 10); |
203 | $LOGVIEW->set_fontsize ($CFG->{log_fontsize} = 0.1 * int $_[1] * 10); |
|
|
204 | } |
161 | }); |
205 | ); |
162 | |
206 | |
163 | $table->add (1, 8, new CFClient::UI::Button expand => 1, align => 0, text => "Apply", connect_activate => sub { |
207 | $table->add (0, $row, new CFClient::UI::Label valign => 0, align => 1, text => "Stats Fontsize"); |
|
|
208 | |
|
|
209 | $table->add (1, $row++, new CFClient::UI::Slider |
|
|
210 | range => [$CFG->{stat_fontsize}, 0.5, 2, 0.1], |
|
|
211 | tooltip => "The font size used by the statistics window only", |
|
|
212 | connect_changed => sub { |
|
|
213 | $CFG->{stat_fontsize} = 0.1 * int $_[1] * 10; |
|
|
214 | &set_stats_window_fontsize; |
|
|
215 | } |
|
|
216 | ); |
|
|
217 | |
|
|
218 | $table->add (0, $row, new CFClient::UI::Label valign => 0, align => 1, text => "Gauge size"); |
|
|
219 | $table->add (1, $row++, new CFClient::UI::Slider |
|
|
220 | range => [$CFG->{gauge_size}, 0.2, 0.8, 0.02], |
|
|
221 | tooltip => "Adjust the size of the stats gauges at the bottom right", |
|
|
222 | connect_changed => sub { |
|
|
223 | $CFG->{gauge_size} = $_[1]; |
|
|
224 | my $h = int $HEIGHT * $CFG->{gauge_size}; |
|
|
225 | $GAUGES->{win}->set_size ($WIDTH, $h); |
|
|
226 | $GAUGES->{win}->move (0, $HEIGHT - $h); |
|
|
227 | } |
|
|
228 | ); |
|
|
229 | |
|
|
230 | $table->add (0, $row, new CFClient::UI::Label valign => 0, align => 1, text => "Gauge fontsize"); |
|
|
231 | $table->add (1, $row++, new CFClient::UI::Slider |
|
|
232 | range => [$CFG->{gauge_fontsize}, 0.5, 2.0, 0.1], |
|
|
233 | tooltip => "Adjusts the fontsize of the gauges at the bottom right", |
|
|
234 | connect_changed => sub { |
|
|
235 | $CFG->{gauge_fontsize} = 0.1 * int $_[1] * 10; |
|
|
236 | &set_gauge_window_fontsize; |
|
|
237 | } |
|
|
238 | ); |
|
|
239 | |
|
|
240 | $table->add (1, $row++, new CFClient::UI::Button |
|
|
241 | expand => 1, align => 0, text => "Apply", |
|
|
242 | tooltip => "Apply the video settings", |
|
|
243 | connect_activate => sub { |
164 | video_shutdown (); |
244 | video_shutdown (); |
165 | video_init (); |
245 | video_init (); |
|
|
246 | } |
166 | }); |
247 | ); |
167 | |
248 | |
168 | $table->add (0, 9, new CFClient::UI::Label valign => 0, align => 1, text => "Audio Enable"); |
249 | $table->add (0, $row, new CFClient::UI::Label valign => 0, align => 1, text => "Audio Enable"); |
169 | $table->add (1, 9, new CFClient::UI::CheckBox state => $CFG->{audio_enable}, connect_changed => sub { |
250 | $table->add (1, $row++, new CFClient::UI::CheckBox |
|
|
251 | state => $CFG->{audio_enable}, |
|
|
252 | tooltip => "If enabled, sound effects and music will be played. If disabled, no audio will be used and the soundcard will not be opened.", |
|
|
253 | connect_changed => sub { |
170 | $CFG->{audio_enable} = $_[1]; |
254 | $CFG->{audio_enable} = $_[1]; |
|
|
255 | } |
171 | }); |
256 | ); |
172 | # $table->add (0, 9, new CFClient::UI::Label valign => 0, align => 1, text => "Effects Volume"); |
257 | # $table->add (0, 9, new CFClient::UI::Label valign => 0, align => 1, text => "Effects Volume"); |
173 | # $table->add (1, 8, new CFClient::UI::Slider range => [$CFG->{effects_volume}, 0, 128, 1], connect_changed => sub { |
258 | # $table->add (1, 8, new CFClient::UI::Slider range => [$CFG->{effects_volume}, 0, 128, 1], connect_changed => sub { |
174 | # $CFG->{effects_volume} = $_[1]; |
259 | # $CFG->{effects_volume} = $_[1]; |
175 | # }); |
260 | # }); |
176 | $table->add (0, 10, new CFClient::UI::Label valign => 0, align => 1, text => "Background Music"); |
261 | $table->add (0, $row, new CFClient::UI::Label valign => 0, align => 1, text => "Background Music"); |
177 | $table->add (1, 10, my $hbox = new CFClient::UI::HBox); |
262 | $table->add (1, $row++, my $hbox = new CFClient::UI::HBox); |
178 | $hbox->add (new CFClient::UI::CheckBox expand => 1, state => $CFG->{bgm_enable}, connect_changed => sub { |
263 | $hbox->add (new CFClient::UI::CheckBox |
|
|
264 | expand => 1, state => $CFG->{bgm_enable}, |
|
|
265 | tooltip => "Enable background music playing", |
|
|
266 | connect_changed => sub { |
179 | $CFG->{bgm_enable} = $_[1]; |
267 | $CFG->{bgm_enable} = $_[1]; |
|
|
268 | } |
180 | }); |
269 | ); |
181 | $hbox->add (new CFClient::UI::Slider expand => 1, range => [$CFG->{bgm_volume}, 0, 1, 0.1], connect_changed => sub { |
270 | $hbox->add (new CFClient::UI::Slider |
|
|
271 | expand => 1, range => [$CFG->{bgm_volume}, 0, 1, 0.1], |
|
|
272 | tooltip => "The volume of the background music", |
|
|
273 | connect_changed => sub { |
182 | $CFG->{bgm_volume} = $_[1]; |
274 | $CFG->{bgm_volume} = $_[1]; |
183 | CFClient::MixMusic::volume $_[1] * 128; |
275 | CFClient::MixMusic::volume $_[1] * 128; |
|
|
276 | } |
184 | }); |
277 | ); |
185 | |
278 | |
186 | $table->add (1, 11, new CFClient::UI::Button expand => 1, align => 0, text => "Apply", connect_activate => sub { |
279 | $table->add (1, $row++, new CFClient::UI::Button |
|
|
280 | expand => 1, align => 0, text => "Apply", |
|
|
281 | tooltip => "Apply the audio settings", |
|
|
282 | connect_activate => sub { |
187 | audio_shutdown (); |
283 | audio_shutdown (); |
188 | audio_init (); |
284 | audio_init (); |
|
|
285 | } |
189 | }); |
286 | ); |
190 | |
287 | |
191 | $dialog |
288 | $dialog |
|
|
289 | } |
|
|
290 | |
|
|
291 | sub set_stats_window_fontsize { |
|
|
292 | for (values %{$STATWIDS}) { |
|
|
293 | $_->set_fontsize ($::CFG->{stat_fontsize}); |
|
|
294 | } |
|
|
295 | } |
|
|
296 | |
|
|
297 | sub set_gauge_window_fontsize { |
|
|
298 | for (map { $GAUGES->{$_} } grep { $_ ne 'win' } keys %{$GAUGES}) { |
|
|
299 | $_->set_fontsize ($::CFG->{gauge_fontsize}); |
|
|
300 | } |
|
|
301 | |
|
|
302 | # local $GAUGES->{win}{parent};#d# |
|
|
303 | # use PApp::Util; open D, ">:utf8", "d"; print D PApp::Util::dumpval $GAUGES->{win}; close D; |
|
|
304 | } |
|
|
305 | |
|
|
306 | sub make_gauge_window { |
|
|
307 | my $gh = int ($HEIGHT * $CFG->{gauge_size}); |
|
|
308 | # my $gw = int ($WIDTH * $CFG->{gauge_w_size}); |
|
|
309 | |
|
|
310 | my $win = new CFClient::UI::Frame ( |
|
|
311 | y => $HEIGHT - $gh, x => 0, user_w => $WIDTH, user_h => $gh |
|
|
312 | ); |
|
|
313 | $win->add (my $vb = new CFClient::UI::VBox); |
|
|
314 | |
|
|
315 | $vb->add (my $hbg = new CFClient::UI::HBox expand => 1); |
|
|
316 | |
|
|
317 | $hbg->add (new CFClient::UI::Empty expand => 1); |
|
|
318 | $hbg->add (my $hb = new CFClient::UI::HBox); |
|
|
319 | $hb->add (my $hg = new CFClient::UI::Gauge type => 'hp', tooltip => "Health points"); |
|
|
320 | $hb->add (my $mg = new CFClient::UI::Gauge type => 'mana', tooltip => "Spellpoints"); |
|
|
321 | $hb->add (my $gg = new CFClient::UI::Gauge type => 'grace', tooltip => "Grace"); |
|
|
322 | $hb->add (my $fg = new CFClient::UI::Gauge type => 'food', tooltip => "Food"); |
|
|
323 | |
|
|
324 | $vb->add (my $exp = new CFClient::UI::Label valign => 0, align => 1, text => "XP: 0 LVL: 0"); |
|
|
325 | $vb->add (my $rng = new CFClient::UI::Label valign => 0, align => 1, text => "Rng:"); |
|
|
326 | |
|
|
327 | $GAUGES = { |
|
|
328 | exp => $exp, win => $win, range => $rng, |
|
|
329 | food => $fg, mana => $mg, hp => $hg, grace => $gg |
|
|
330 | }; |
|
|
331 | |
|
|
332 | &set_gauge_window_fontsize; |
|
|
333 | |
|
|
334 | $win |
|
|
335 | } |
|
|
336 | |
|
|
337 | sub make_stats_window { |
|
|
338 | my $tgw = new CFClient::UI::FancyFrame (x => $WIDTH * 2/5, y => 0, title => "Stats"); |
|
|
339 | |
|
|
340 | $tgw->add (my $vb = new CFClient::UI::VBox); |
|
|
341 | $vb->add ($STATWIDS->{title} = new CFClient::UI::Label valign => 0, align => -1, text => "Title:", expand => 1); |
|
|
342 | $vb->add ($STATWIDS->{map} = new CFClient::UI::Label valign => 0, align => -1, text => "Map:", expand => 1); |
|
|
343 | |
|
|
344 | $vb->add (my $hb = new CFClient::UI::HBox expand => 1); |
|
|
345 | |
|
|
346 | $hb->add (my $tbl = new CFClient::UI::Table expand => 1); |
|
|
347 | |
|
|
348 | $tbl->add (0, 0, $STATWIDS->{st_str} = new CFClient::UI::Label valign => 0, align => +1, template => "30"); |
|
|
349 | $tbl->add (0, 1, $STATWIDS->{st_dex} = new CFClient::UI::Label valign => 0, align => +1, template => "30"); |
|
|
350 | $tbl->add (0, 2, $STATWIDS->{st_con} = new CFClient::UI::Label valign => 0, align => +1, template => "30"); |
|
|
351 | $tbl->add (0, 3, $STATWIDS->{st_int} = new CFClient::UI::Label valign => 0, align => +1, template => "30"); |
|
|
352 | $tbl->add (0, 4, $STATWIDS->{st_wis} = new CFClient::UI::Label valign => 0, align => +1, template => "30"); |
|
|
353 | $tbl->add (0, 5, $STATWIDS->{st_pow} = new CFClient::UI::Label valign => 0, align => +1, template => "30"); |
|
|
354 | $tbl->add (0, 6, $STATWIDS->{st_cha} = new CFClient::UI::Label valign => 0, align => +1, template => "30"); |
|
|
355 | |
|
|
356 | $tbl->add (1, 0, $STATWIDS->{st_str_lbl} = new CFClient::UI::Label valign => 0, align => -1, text => "Str"); |
|
|
357 | $tbl->add (1, 1, $STATWIDS->{st_dex_lbl} = new CFClient::UI::Label valign => 0, align => -1, text => "Dex"); |
|
|
358 | $tbl->add (1, 2, $STATWIDS->{st_con_lbl} = new CFClient::UI::Label valign => 0, align => -1, text => "Con"); |
|
|
359 | $tbl->add (1, 3, $STATWIDS->{st_int_lbl} = new CFClient::UI::Label valign => 0, align => -1, text => "Int"); |
|
|
360 | $tbl->add (1, 4, $STATWIDS->{st_wis_lbl} = new CFClient::UI::Label valign => 0, align => -1, text => "Wis"); |
|
|
361 | $tbl->add (1, 5, $STATWIDS->{st_pow_lbl} = new CFClient::UI::Label valign => 0, align => -1, text => "Pow"); |
|
|
362 | $tbl->add (1, 6, $STATWIDS->{st_cha_lbl} = new CFClient::UI::Label valign => 0, align => -1, text => "Cha"); |
|
|
363 | |
|
|
364 | $tbl->add (2, 0, $STATWIDS->{st_wc} = new CFClient::UI::Label valign => 0, align => +1, template => "-120"); |
|
|
365 | $tbl->add (2, 1, $STATWIDS->{st_ac} = new CFClient::UI::Label valign => 0, align => +1, template => "-120"); |
|
|
366 | $tbl->add (2, 2, $STATWIDS->{st_dam} = new CFClient::UI::Label valign => 0, align => +1, template => "120"); |
|
|
367 | $tbl->add (2, 3, $STATWIDS->{st_arm} = new CFClient::UI::Label valign => 0, align => +1, template => "120"); |
|
|
368 | $tbl->add (2, 4, $STATWIDS->{st_spd} = new CFClient::UI::Label valign => 0, align => +1, template => "10.54"); |
|
|
369 | $tbl->add (2, 5, $STATWIDS->{st_wspd} = new CFClient::UI::Label valign => 0, align => +1, template => "9"); |
|
|
370 | |
|
|
371 | $tbl->add (3, 0, $STATWIDS->{st_wc_lbl} = new CFClient::UI::Label valign => 0, align => -1, text => "Wc"); |
|
|
372 | $tbl->add (3, 1, $STATWIDS->{st_ac_lbl} = new CFClient::UI::Label valign => 0, align => -1, text => "Ac"); |
|
|
373 | $tbl->add (3, 2, $STATWIDS->{st_dam_lbl} = new CFClient::UI::Label valign => 0, align => -1, text => "Dam"); |
|
|
374 | $tbl->add (3, 3, $STATWIDS->{st_arm_lbl} = new CFClient::UI::Label valign => 0, align => -1, text => "Arm"); |
|
|
375 | $tbl->add (3, 4, $STATWIDS->{st_spd_lbl} = new CFClient::UI::Label valign => 0, align => -1, text => "Sp"); |
|
|
376 | $tbl->add (3, 5, $STATWIDS->{st_wspd_lbl} = new CFClient::UI::Label valign => 0, align => -1, text => "WSp"); |
|
|
377 | |
|
|
378 | $hb->add (my $tbl2 = new CFClient::UI::Table expand => 1); |
|
|
379 | |
|
|
380 | my $row = 0; |
|
|
381 | my $col = 0; |
|
|
382 | |
|
|
383 | my %resist_names = ( |
|
|
384 | slow => "Slow", |
|
|
385 | holyw => "Holy Word", |
|
|
386 | conf => "Confusion", |
|
|
387 | fire => "Fire", |
|
|
388 | depl => "Depletion", |
|
|
389 | magic => "Magic", |
|
|
390 | drain => "Draining", |
|
|
391 | acid => "Acid", |
|
|
392 | pois => "Poison", |
|
|
393 | para => "Paralysation", |
|
|
394 | deat => "Death", |
|
|
395 | phys => "Physical", |
|
|
396 | blind => "Blind", |
|
|
397 | fear => "Fear", |
|
|
398 | tund => "Turn undead", |
|
|
399 | elec => "Electricity", |
|
|
400 | cold => "Cold", |
|
|
401 | ghit => "Ghost hit", |
|
|
402 | ); |
|
|
403 | for (qw/slow holyw conf fire depl magic |
|
|
404 | drain acid pois para deat phys |
|
|
405 | blind fear tund elec cold ghit/) |
|
|
406 | { |
|
|
407 | $tbl2->add ($col, $row, |
|
|
408 | $STATWIDS->{"res_$_"} = |
|
|
409 | new CFClient::UI::Label |
|
|
410 | template => "-100%", |
|
|
411 | align => +1, |
|
|
412 | valign => 0, |
|
|
413 | tooltip => $resist_names{$_} |
|
|
414 | ); |
|
|
415 | $tbl2->add ($col + 1, $row, new CFClient::UI::Image |
|
|
416 | can_hover => 1, |
|
|
417 | can_events => 1, |
|
|
418 | image => "ui/resist/resist_$_.png", |
|
|
419 | tooltip => $resist_names{$_} |
|
|
420 | ); |
|
|
421 | |
|
|
422 | $row++; |
|
|
423 | if ($row % 6 == 0) { |
|
|
424 | $col += 2; |
|
|
425 | $row = 0; |
|
|
426 | } |
|
|
427 | } |
|
|
428 | |
|
|
429 | &set_stats_window_fontsize; |
|
|
430 | update_stats_window ({}); |
|
|
431 | |
|
|
432 | $tgw |
|
|
433 | } |
|
|
434 | |
|
|
435 | sub formsep { |
|
|
436 | reverse join ",", grep length, split /(...)/, reverse $_[0] * 1 |
|
|
437 | } |
|
|
438 | |
|
|
439 | sub update_stats_window { |
|
|
440 | my ($stats) = @_; |
|
|
441 | |
|
|
442 | # i love text protocols!!! |
|
|
443 | my $hp = $stats->{Crossfire::Protocol::CS_STAT_HP} * 1; |
|
|
444 | my $hp_m = $stats->{Crossfire::Protocol::CS_STAT_MAXHP} * 1; |
|
|
445 | my $sp = $stats->{Crossfire::Protocol::CS_STAT_SP} * 1; |
|
|
446 | my $sp_m = $stats->{Crossfire::Protocol::CS_STAT_MAXSP} * 1; |
|
|
447 | my $fo = $stats->{Crossfire::Protocol::CS_STAT_FOOD} * 1; |
|
|
448 | my $fo_m = 999; |
|
|
449 | my $gr = $stats->{Crossfire::Protocol::CS_STAT_GRACE} * 1; |
|
|
450 | my $gr_m = $stats->{Crossfire::Protocol::CS_STAT_MAXGRACE} * 1; |
|
|
451 | |
|
|
452 | $GAUGES->{hp} ->set_value ($hp, $hp_m); |
|
|
453 | $GAUGES->{mana} ->set_value ($sp, $sp_m); |
|
|
454 | $GAUGES->{food} ->set_value ($fo, $fo_m); |
|
|
455 | $GAUGES->{grace} ->set_value ($gr, $gr_m); |
|
|
456 | $GAUGES->{exp} ->set_text ("Exp: " . (formsep $stats->{Crossfire::Protocol::CS_STAT_EXP64}) |
|
|
457 | . " (lvl " . ($stats->{Crossfire::Protocol::CS_STAT_LEVEL} * 1) . ")"); |
|
|
458 | my $rng = $stats->{Crossfire::Protocol::CS_STAT_RANGE}; |
|
|
459 | $rng =~ s/^Range: //; # thank you so much dear server |
|
|
460 | $GAUGES->{range} ->set_text ("Rng: " . $rng); |
|
|
461 | my $title = $stats->{Crossfire::Protocol::CS_STAT_TITLE}; |
|
|
462 | $title =~ s/^Player: //; |
|
|
463 | $STATWIDS->{title} ->set_text ("Title: " . $title); |
|
|
464 | |
|
|
465 | $STATWIDS->{st_str} ->set_text (sprintf "%d", $stats->{5}); |
|
|
466 | $STATWIDS->{st_dex} ->set_text (sprintf "%d", $stats->{8}); |
|
|
467 | $STATWIDS->{st_con} ->set_text (sprintf "%d", $stats->{9}); |
|
|
468 | $STATWIDS->{st_int} ->set_text (sprintf "%d", $stats->{6}); |
|
|
469 | $STATWIDS->{st_wis} ->set_text (sprintf "%d", $stats->{7}); |
|
|
470 | $STATWIDS->{st_pow} ->set_text (sprintf "%d", $stats->{22}); |
|
|
471 | $STATWIDS->{st_cha} ->set_text (sprintf "%d", $stats->{10}); |
|
|
472 | $STATWIDS->{st_wc} ->set_text (sprintf "%d", $stats->{13}); |
|
|
473 | $STATWIDS->{st_ac} ->set_text (sprintf "%d", $stats->{14}); |
|
|
474 | $STATWIDS->{st_dam} ->set_text (sprintf "%d", $stats->{15}); |
|
|
475 | $STATWIDS->{st_arm} ->set_text (sprintf "%d", $stats->{16}); |
|
|
476 | $STATWIDS->{st_spd} ->set_text (sprintf "%.1f", $stats->{Crossfire::Protocol::CS_STAT_SPEED}); |
|
|
477 | $STATWIDS->{st_wspd}->set_text (sprintf "%.1f", $stats->{Crossfire::Protocol::CS_STAT_WEAP_SP}); |
|
|
478 | |
|
|
479 | my %tbl = ( |
|
|
480 | phys => 100, |
|
|
481 | magic => 101, |
|
|
482 | fire => 102, |
|
|
483 | elec => 103, |
|
|
484 | cold => 104, |
|
|
485 | conf => 105, |
|
|
486 | acid => 106, |
|
|
487 | drain => 107, |
|
|
488 | ghit => 108, |
|
|
489 | pois => 109, |
|
|
490 | slow => 110, |
|
|
491 | para => 111, |
|
|
492 | tund => 112, |
|
|
493 | fear => 113, |
|
|
494 | depl => 113, |
|
|
495 | deat => 115, |
|
|
496 | holyw => 116, |
|
|
497 | blind => 117 |
|
|
498 | ); |
|
|
499 | |
|
|
500 | for (keys %tbl) { |
|
|
501 | $STATWIDS->{"res_$_"}->set_text (sprintf "%d%", $stats->{$tbl{$_}}); |
|
|
502 | } |
|
|
503 | |
192 | } |
504 | } |
193 | |
505 | |
194 | sub metaserver_dialog { |
506 | sub metaserver_dialog { |
195 | my $dialog = new CFClient::UI::FancyFrame |
507 | my $dialog = new CFClient::UI::FancyFrame |
196 | title => "Metaserver", |
508 | title => "Metaserver", |
… | |
… | |
276 | $table->add (0, 2, new CFClient::UI::Label valign => 0, align => 1, text => "Host:Port"); |
588 | $table->add (0, 2, new CFClient::UI::Label valign => 0, align => 1, text => "Host:Port"); |
277 | |
589 | |
278 | { |
590 | { |
279 | $table->add (1, 2, my $vbox = new CFClient::UI::VBox); |
591 | $table->add (1, 2, my $vbox = new CFClient::UI::VBox); |
280 | |
592 | |
281 | $vbox->add (my $HOST = new CFClient::UI::Entry expand => 1, text => $CFG->{host}, connect_changed => sub { |
593 | $vbox->add ( |
|
|
594 | my $HOST = new CFClient::UI::Entry |
|
|
595 | expand => 1, |
|
|
596 | text => $CFG->{host}, |
|
|
597 | tooltip => "The hostname or ip address of the Crossfire(+) server to connect to", |
|
|
598 | connect_changed => sub { |
|
|
599 | my ($self, $value) = @_; |
|
|
600 | $CFG->{host} = $value; |
|
|
601 | } |
|
|
602 | ); |
|
|
603 | |
|
|
604 | $METASERVER = metaserver_dialog; |
|
|
605 | |
|
|
606 | $vbox->add (new CFClient::UI::Flopper |
|
|
607 | expand => 1, |
|
|
608 | text => "Metaserver", |
|
|
609 | other => $METASERVER, |
|
|
610 | tooltip => "Show a list of avaible crossfire servers", |
|
|
611 | connect_open => sub { |
|
|
612 | update_metaserver $HOST; |
|
|
613 | } |
|
|
614 | ); |
|
|
615 | } |
|
|
616 | |
|
|
617 | $table->add (0, 4, new CFClient::UI::Label valign => 0, align => 1, text => "Username"); |
|
|
618 | $table->add (1, 4, new CFClient::UI::Entry |
|
|
619 | text => $CFG->{user}, |
|
|
620 | tooltip => "The name of your character on the server", |
|
|
621 | connect_changed => sub { |
282 | my ($self, $value) = @_; |
622 | my ($self, $value) = @_; |
283 | $CFG->{host} = $value; |
|
|
284 | }); |
|
|
285 | |
|
|
286 | $METASERVER = metaserver_dialog; |
|
|
287 | |
|
|
288 | $vbox->add (new CFClient::UI::Flopper expand => 1, text => "Metaserver", other => $METASERVER, connect_open => sub { |
|
|
289 | update_metaserver $HOST; |
|
|
290 | }); |
|
|
291 | } |
|
|
292 | |
|
|
293 | $table->add (0, 4, new CFClient::UI::Label valign => 0, align => 1, text => "Username"); |
|
|
294 | $table->add (1, 4, new CFClient::UI::Entry text => $CFG->{user}, connect_changed => sub { |
|
|
295 | my ($self, $value) = @_; |
|
|
296 | $CFG->{user} = $value; |
623 | $CFG->{user} = $value; |
|
|
624 | } |
297 | }); |
625 | ); |
298 | |
626 | |
299 | $table->add (0, 5, new CFClient::UI::Label valign => 0, align => 1, text => "Password"); |
627 | $table->add (0, 5, new CFClient::UI::Label valign => 0, align => 1, text => "Password"); |
300 | $table->add (1, 5, new CFClient::UI::Entry text => $CFG->{password}, hidden => 1, connect_changed => sub { |
628 | $table->add (1, 5, new CFClient::UI::Entry |
|
|
629 | text => $CFG->{password}, |
|
|
630 | hidden => 1, |
|
|
631 | tooltip => "The password for your character", |
|
|
632 | connect_changed => sub { |
301 | my ($self, $value) = @_; |
633 | my ($self, $value) = @_; |
302 | $CFG->{password} = $value; |
634 | $CFG->{password} = $value; |
|
|
635 | } |
303 | }); |
636 | ); |
304 | |
637 | |
305 | $table->add (0, 6, new CFClient::UI::Label valign => 0, align => 1, text => "Def. say cmd"); |
638 | $table->add (0, 6, new CFClient::UI::Label valign => 0, align => 1, text => "Def. say cmd"); |
306 | $table->add (1, 6, my $saycmd = new CFClient::UI::Entry text => $CFG->{say_command}, connect_changed => sub { |
639 | $table->add (1, 6, my $saycmd = new CFClient::UI::Entry |
|
|
640 | text => $CFG->{say_command}, |
|
|
641 | tooltip => "This is the command that will be used if you write a line in the message window entry. " |
|
|
642 | ."Usually you want to enter something like 'say' or 'shout' or 'gsay' here. " |
|
|
643 | ."But you could also set it to 'tell <playername>' to only chat with that user.", |
|
|
644 | connect_changed => sub { |
307 | my ($self, $value) = @_; |
645 | my ($self, $value) = @_; |
308 | $CFG->{say_command} = $value; |
646 | $CFG->{say_command} = $value; |
|
|
647 | } |
309 | }); |
648 | ); |
310 | |
649 | |
311 | $table->add (0, 7, new CFClient::UI::Label valign => 0, align => 1, text => "Map Size"); |
650 | $table->add (0, 7, new CFClient::UI::Label valign => 0, align => 1, text => "Map Size"); |
312 | $table->add (1, 7, new CFClient::UI::Slider |
651 | $table->add (1, 7, new CFClient::UI::Slider |
313 | req_w => 100, |
652 | req_w => 100, |
314 | range => [$CFG->{mapsize}, 10, 100 + 1, 1], |
653 | range => [$CFG->{mapsize}, 10, 100 + 1, 1], |
|
|
654 | tooltip => "This is the size of the portion of the map update the server sends you. " |
|
|
655 | ."If you set this to a high value you will be able to see further for example.", |
315 | connect_changed => sub { |
656 | connect_changed => sub { |
316 | my ($self, $value) = @_; |
657 | my ($self, $value) = @_; |
317 | |
658 | |
318 | $CFG->{mapsize} = $self->{range}[0] = $value = int $value; |
659 | $CFG->{mapsize} = $self->{range}[0] = $value = int $value; |
319 | }, |
660 | }, |
… | |
… | |
335 | user_h => int $::HEIGHT / 5, |
676 | user_h => int $::HEIGHT / 5, |
336 | child => (my $vbox = new CFClient::UI::VBox); |
677 | child => (my $vbox = new CFClient::UI::VBox); |
337 | |
678 | |
338 | $vbox->add ($LOGVIEW = new CFClient::UI::TextView |
679 | $vbox->add ($LOGVIEW = new CFClient::UI::TextView |
339 | expand => 1, |
680 | expand => 1, |
|
|
681 | font => $FONT_FIXED, |
340 | fontsize => $::CFG->{log_fontsize}, |
682 | fontsize => $::CFG->{log_fontsize}, |
341 | ); |
683 | ); |
342 | |
684 | |
343 | $vbox->add (my $input = new CFClient::UI::Entry |
685 | $vbox->add (my $input = new CFClient::UI::Entry |
344 | connect_focus_in => sub { |
686 | connect_focus_in => sub { |
… | |
… | |
438 | |
780 | |
439 | $BUTTONBAR->add (new CFClient::UI::Flopper text => "Client Setup", other => client_setup); |
781 | $BUTTONBAR->add (new CFClient::UI::Flopper text => "Client Setup", other => client_setup); |
440 | $BUTTONBAR->add (new CFClient::UI::Flopper text => "Server Setup", other => server_setup); |
782 | $BUTTONBAR->add (new CFClient::UI::Flopper text => "Server Setup", other => server_setup); |
441 | $BUTTONBAR->add (new CFClient::UI::Flopper text => "Message Window", other => message_window); |
783 | $BUTTONBAR->add (new CFClient::UI::Flopper text => "Message Window", other => message_window); |
442 | |
784 | |
|
|
785 | $CFClient::UI::ROOT->add (make_gauge_window); # 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 |
|
|
786 | $BUTTONBAR->add (new CFClient::UI::Flopper text => "Stats Window", other => make_stats_window); |
|
|
787 | |
443 | $BUTTONBAR->add (new CFClient::UI::Button text => "Save Config", connect_activate => sub { |
788 | $BUTTONBAR->add (new CFClient::UI::Button text => "Save Config", connect_activate => sub { |
444 | CFClient::write_cfg "$Crossfire::VARDIR/pclientrc"; |
789 | CFClient::write_cfg "$Crossfire::VARDIR/pclientrc"; |
445 | status "Configuration Saved"; |
790 | status "Configuration Saved"; |
446 | }); |
791 | }); |
447 | |
792 | |
448 | $BUTTONBAR->{children}[1]->emit ("activate"); # pop up server setup |
793 | $BUTTONBAR->{children}[1]->emit ("activate"); # pop up server setup |
449 | |
|
|
450 | my $tgw = new CFClient::UI::FancyFrame (x => $WIDTH - 300, y => 0, title => "Stats"); |
|
|
451 | $tgw->add (my $hbox = new CFClient::UI::HBox ()); |
|
|
452 | |
|
|
453 | $hbox->add (my $hg = new CFClient::UI::Gauge (type => 'hp')); |
|
|
454 | $hbox->add (my $mg = new CFClient::UI::Gauge (type => 'mana')); |
|
|
455 | $hbox->add (my $gg = new CFClient::UI::Gauge (type => 'grace')); |
|
|
456 | $hbox->add (my $fg = new CFClient::UI::Gauge (type => 'food')); |
|
|
457 | |
|
|
458 | $GAUGES = { food => $fg, mana => $mg, hp => $hg, grace => $gg }; |
|
|
459 | $CFClient::UI::ROOT->add ($tgw); |
|
|
460 | } |
794 | } |
461 | |
795 | |
462 | sub video_shutdown { |
796 | sub video_shutdown { |
463 | $CFClient::UI::ROOT->{children} = []; |
797 | $CFClient::UI::ROOT->{children} = []; |
464 | undef $SDL_ACTIVE; |
798 | undef $SDL_ACTIVE; |
465 | } |
799 | } |
466 | |
800 | |
|
|
801 | my @bgmusic = qw(game1.ogg game2.ogg game3.ogg game5.ogg game6.ogg ross1.ogg ross2.ogg ross3.ogg ross4.ogg ross5.ogg); #d# |
467 | my $bgmusic;#TODO#hack#d# |
802 | my $bgmusic;#TODO#hack#d# |
|
|
803 | |
|
|
804 | sub audio_music_finished { |
|
|
805 | return unless $CFG->{bgm_enable}; |
|
|
806 | |
|
|
807 | # TODO: hack, do play loop and mood music |
|
|
808 | $bgmusic = new_from_file CFClient::MixMusic CFClient::find_rcfile "music/$bgmusic[0]"; |
|
|
809 | $bgmusic->play (0); |
|
|
810 | |
|
|
811 | push @bgmusic, shift @bgmusic; |
|
|
812 | } |
468 | |
813 | |
469 | sub audio_init { |
814 | sub audio_init { |
470 | if ($CFG->{audio_enable}) { |
815 | if ($CFG->{audio_enable}) { |
471 | if (open my $fh, "<:utf8", CFClient::find_rcfile "sounds/config") { |
816 | if (open my $fh, "<:utf8", CFClient::find_rcfile "sounds/config") { |
472 | |
|
|
473 | $SDL_MIXER = !CFClient::Mix_OpenAudio; |
817 | $SDL_MIXER = !CFClient::Mix_OpenAudio; |
474 | CFClient::Mix_AllocateChannels 8; |
818 | CFClient::Mix_AllocateChannels 8; |
475 | CFClient::MixMusic::volume $CFG->{bgm_volume} * 128; |
819 | CFClient::MixMusic::volume $CFG->{bgm_volume} * 128; |
476 | |
820 | |
477 | # TODO: hack, do play loop and mood music |
821 | audio_music_finished; |
478 | if ($CFG->{bgm_enable}) { |
|
|
479 | $bgmusic = new_from_file CFClient::MixMusic CFClient::find_rcfile "music/game3.ogg"; |
|
|
480 | $bgmusic->play; |
|
|
481 | } |
|
|
482 | |
822 | |
483 | while (<$fh>) { |
823 | while (<$fh>) { |
484 | next if /^\s*#/; |
824 | next if /^\s*#/; |
485 | next if /^\s*$/; |
825 | next if /^\s*$/; |
486 | |
826 | |
… | |
… | |
564 | @conn::ISA = Crossfire::Protocol::; |
904 | @conn::ISA = Crossfire::Protocol::; |
565 | |
905 | |
566 | sub conn::stats_update { |
906 | sub conn::stats_update { |
567 | my ($self, $stats) = @_; |
907 | my ($self, $stats) = @_; |
568 | |
908 | |
569 | # i love text protocols!!! |
909 | update_stats_window ($stats); |
570 | # FIXME: the stats are somehow weird |
|
|
571 | my $hp = $stats->{1}; |
|
|
572 | my $hp_m = $stats->{2}; |
|
|
573 | my $sp = $stats->{3}; |
|
|
574 | my $sp_m = $stats->{4}; |
|
|
575 | my $fo = $stats->{18}; |
|
|
576 | my $fo_m = 999; |
|
|
577 | my $gr = $stats->{23}; |
|
|
578 | my $gr_m = $stats->{24}; |
|
|
579 | |
|
|
580 | #d# warn "DATA $hp $hp_m $sp $sp_m $fo $fo_m $gr $gr_m\n"; |
|
|
581 | $GAUGES->{hp} ->set_value ($hp, $hp_m); |
|
|
582 | $GAUGES->{mana} ->set_value ($sp, $sp_m); |
|
|
583 | $GAUGES->{food} ->set_value ($fo, $fo_m); |
|
|
584 | $GAUGES->{grace}->set_value ($gr, $gr_m); |
|
|
585 | } |
910 | } |
586 | |
911 | |
587 | sub conn::user_send { |
912 | sub conn::user_send { |
588 | my ($self, $command) = @_; |
913 | my ($self, $command) = @_; |
589 | |
914 | |
… | |
… | |
719 | |
1044 | |
720 | $x += $ox; |
1045 | $x += $ox; |
721 | $y += $oy; |
1046 | $y += $oy; |
722 | |
1047 | |
723 | $self->{map_info} = [$hash, $x, $y, $w, $h]; |
1048 | $self->{map_info} = [$hash, $x, $y, $w, $h]; |
|
|
1049 | |
|
|
1050 | my $map = $self->{map_info}[0]; |
|
|
1051 | $map =~ s/^.*?\/([^\/]+)$/\1/; |
|
|
1052 | $STATWIDS->{map}->set_text ("Map: " . $map); |
724 | |
1053 | |
725 | $self->load_map ($hash, $x, $y); |
1054 | $self->load_map ($hash, $x, $y); |
726 | } |
1055 | } |
727 | |
1056 | |
728 | sub conn::face_find { |
1057 | sub conn::face_find { |
… | |
… | |
846 | $MAPWIDGET->add_command ("use_skill $skill", "", sub { |
1175 | $MAPWIDGET->add_command ("use_skill $skill", "", sub { |
847 | }); |
1176 | }); |
848 | } |
1177 | } |
849 | } |
1178 | } |
850 | |
1179 | |
|
|
1180 | sub conn::container_add { |
|
|
1181 | my ($self, $id, $items) = @_; |
|
|
1182 | |
|
|
1183 | # 0 floor |
|
|
1184 | # $self-<{player}{tag} => player inv |
|
|
1185 | #use PApp::Util; warn PApp::Util::dumpval $self->{container}{$self->{player}{tag}}; |
|
|
1186 | } |
|
|
1187 | |
|
|
1188 | sub conn::container_clear { |
|
|
1189 | my ($self, $id) = @_; |
|
|
1190 | # use PApp::Util; warn PApp::Util::dumpval $self->{container}{0}; |
|
|
1191 | } |
|
|
1192 | |
851 | %SDL_CB = ( |
1193 | %SDL_CB = ( |
852 | CFClient::SDL_QUIT => sub { |
1194 | CFClient::SDL_QUIT => sub { |
853 | Event::unloop -1; |
1195 | Event::unloop -1; |
854 | }, |
1196 | }, |
855 | CFClient::SDL_VIDEORESIZE => sub { |
1197 | CFClient::SDL_VIDEORESIZE => sub { |
856 | }, |
1198 | }, |
857 | CFClient::SDL_VIDEOEXPOSE => sub { |
1199 | CFClient::SDL_VIDEOEXPOSE => \&refresh, |
858 | refresh; |
1200 | CFClient::SDL_ACTIVEEVENT => sub { |
|
|
1201 | # printf "active %x %x\n", $SDL_EV->active_gain, $SDL_EV->active_state;#d# |
859 | }, |
1202 | }, |
860 | CFClient::SDL_KEYDOWN => sub { |
1203 | CFClient::SDL_KEYDOWN => sub { |
861 | if ($_[0]{mod} & CFClient::KMOD_ALT && $_[0]{sym} == 13) { |
1204 | if ($_[0]{mod} & CFClient::KMOD_ALT && $_[0]{sym} == 13) { |
862 | # alt-enter |
1205 | # alt-enter |
863 | video_shutdown; |
1206 | video_shutdown; |
… | |
… | |
865 | video_init; |
1208 | video_init; |
866 | } else { |
1209 | } else { |
867 | CFClient::UI::feed_sdl_key_down_event ($_[0]); |
1210 | CFClient::UI::feed_sdl_key_down_event ($_[0]); |
868 | } |
1211 | } |
869 | }, |
1212 | }, |
870 | CFClient::SDL_KEYUP => sub { |
1213 | CFClient::SDL_KEYUP => \&CFClient::UI::feed_sdl_key_up_event, |
871 | CFClient::UI::feed_sdl_key_up_event ($_[0]); |
1214 | CFClient::SDL_MOUSEMOTION => \&CFClient::UI::feed_sdl_motion_event, |
872 | }, |
1215 | CFClient::SDL_MOUSEBUTTONDOWN => \&CFClient::UI::feed_sdl_button_down_event, |
873 | CFClient::SDL_MOUSEMOTION => sub { |
1216 | CFClient::SDL_MOUSEBUTTONUP => \&CFClient::UI::feed_sdl_button_up_event, |
874 | CFClient::UI::feed_sdl_motion_event ($_[0]); |
1217 | CFClient::SDL_USEREVENT => \&audio_music_finished, |
875 | }, |
|
|
876 | CFClient::SDL_MOUSEBUTTONDOWN => sub { |
|
|
877 | CFClient::UI::feed_sdl_button_down_event ($_[0]); |
|
|
878 | }, |
|
|
879 | CFClient::SDL_MOUSEBUTTONUP => sub { |
|
|
880 | CFClient::UI::feed_sdl_button_up_event ($_[0]); |
|
|
881 | }, |
|
|
882 | CFClient::SDL_ACTIVEEVENT => sub { |
|
|
883 | # printf "active %x %x\n", $SDL_EV->active_gain, $SDL_EV->active_state;#d# |
|
|
884 | }, |
|
|
885 | ); |
1218 | ); |
886 | |
1219 | |
887 | ############################################################################# |
1220 | ############################################################################# |
888 | |
1221 | |
889 | $SIG{INT} = $SIG{TERM} = sub { exit }; |
1222 | $SIG{INT} = $SIG{TERM} = sub { exit }; |
… | |
… | |
897 | sdl_mode => 0, |
1230 | sdl_mode => 0, |
898 | width => 640, |
1231 | width => 640, |
899 | height => 480, |
1232 | height => 480, |
900 | fullscreen => 0, |
1233 | fullscreen => 0, |
901 | fast => 0, |
1234 | fast => 0, |
|
|
1235 | map_scale => 0.5, |
902 | fow_enable => 1, |
1236 | fow_enable => 1, |
903 | fow_intensity => 0.45, |
1237 | fow_intensity => 0.45, |
904 | fow_smooth => 0, |
1238 | fow_smooth => 0, |
905 | gui_fontsize => 1, |
1239 | gui_fontsize => 1, |
906 | log_fontsize => 14, |
1240 | log_fontsize => 1, |
|
|
1241 | gauge_fontsize => 1, |
|
|
1242 | gauge_size => 0.35, |
|
|
1243 | stat_fontsize => 1, |
907 | mapsize => 100, |
1244 | mapsize => 100, |
908 | host => "crossfire.schmorp.de", |
1245 | host => "crossfire.schmorp.de", |
909 | say_command => 'say', |
1246 | say_command => 'say', |
910 | audio_enable => 1, |
1247 | audio_enable => 1, |
911 | bgm_enable => 1, |
1248 | bgm_enable => 1, |
… | |
… | |
925 | @SDL_MODES or CFClient::fatal "Unable to find a usable video mode\n(hardware accelerated opengl fullscreen)"; |
1262 | @SDL_MODES or CFClient::fatal "Unable to find a usable video mode\n(hardware accelerated opengl fullscreen)"; |
926 | |
1263 | |
927 | $CFG->{sdl_mode} = 0 if $CFG->{sdl_mode} > @SDL_MODES; |
1264 | $CFG->{sdl_mode} = 0 if $CFG->{sdl_mode} > @SDL_MODES; |
928 | |
1265 | |
929 | { |
1266 | { |
930 | my @fonts = map CFClient::find_rcfile $_, qw(uifont.ttf uifontb.ttf uifonti.ttf uifontbi.ttf); |
1267 | my @fonts = map CFClient::find_rcfile "fonts/$_", qw( |
|
|
1268 | DejaVuSans.ttf |
|
|
1269 | DejaVuSansMono.ttf |
|
|
1270 | DejaVuSans-Bold.ttf |
|
|
1271 | DejaVuSansMono-Bold.ttf |
|
|
1272 | DejaVuSans-Oblique.ttf |
|
|
1273 | DejaVuSansMono-Oblique.ttf |
|
|
1274 | DejaVuSans-BoldOblique.ttf |
|
|
1275 | DejaVuSansMono-BoldOblique.ttf |
|
|
1276 | ); |
931 | |
1277 | |
932 | CFClient::add_font $_ for @fonts; |
1278 | CFClient::add_font $_ for @fonts; |
933 | CFClient::set_font $fonts[0]; |
1279 | |
|
|
1280 | $FONT_PROP = new_from_file CFClient::Font $fonts[0]; |
|
|
1281 | $FONT_FIXED = new_from_file CFClient::Font $fonts[1]; |
|
|
1282 | |
|
|
1283 | $FONT_PROP->make_default; |
934 | } |
1284 | } |
935 | |
1285 | |
936 | video_init; |
1286 | video_init; |
937 | audio_init; |
1287 | audio_init; |
938 | |
1288 | |