… | |
… | |
117 | $CFG->{sdl_mode} = $self->{range}[0] = $value = int $value; |
117 | $CFG->{sdl_mode} = $self->{range}[0] = $value = int $value; |
118 | $mode_label->set_text (sprintf "%dx%d", @{$SDL_MODES[$value]}); |
118 | $mode_label->set_text (sprintf "%dx%d", @{$SDL_MODES[$value]}); |
119 | }); |
119 | }); |
120 | $mode_slider->emit (changed => $mode_slider->{range}[0]); |
120 | $mode_slider->emit (changed => $mode_slider->{range}[0]); |
121 | |
121 | |
|
|
122 | my $row = 1; |
|
|
123 | |
122 | $table->add (0, 1, new CFClient::UI::Label valign => 0, align => 1, text => "Fullscreen"); |
124 | $table->add (0, $row, new CFClient::UI::Label valign => 0, align => 1, text => "Fullscreen"); |
123 | $table->add (1, 1, new CFClient::UI::CheckBox state => $CFG->{fullscreen}, connect_changed => sub { |
125 | $table->add (1, $row++, new CFClient::UI::CheckBox state => $CFG->{fullscreen}, connect_changed => sub { |
124 | my ($self, $value) = @_; |
126 | my ($self, $value) = @_; |
125 | $CFG->{fullscreen} = $value; |
127 | $CFG->{fullscreen} = $value; |
126 | }); |
128 | }); |
127 | |
129 | |
128 | $table->add (0, 2, new CFClient::UI::Label valign => 0, align => 1, text => "Fast & Ugly"); |
130 | $table->add (0, $row, new CFClient::UI::Label valign => 0, align => 1, text => "Fast & Ugly"); |
129 | $table->add (1, 2, new CFClient::UI::CheckBox state => $CFG->{fast}, connect_changed => sub { |
131 | $table->add (1, $row++, new CFClient::UI::CheckBox |
|
|
132 | state => $CFG->{fast}, |
|
|
133 | tooltip => "Lower the visual quality considerably to speed up rendering.", |
|
|
134 | connect_changed => sub { |
130 | my ($self, $value) = @_; |
135 | my ($self, $value) = @_; |
131 | $CFG->{fast} = $value; |
136 | $CFG->{fast} = $value; |
|
|
137 | } |
132 | }); |
138 | ); |
133 | |
139 | |
134 | $table->add (0, 3, new CFClient::UI::Label valign => 0, align => 1, text => "Fog of War"); |
140 | $table->add (0, $row, new CFClient::UI::Label valign => 0, align => 1, text => "Fog of War"); |
135 | $table->add (1, 3, new CFClient::UI::CheckBox state => $CFG->{fow_enable}, connect_changed => sub { |
141 | $table->add (1, $row++, new CFClient::UI::CheckBox |
|
|
142 | state => $CFG->{fow_enable}, |
|
|
143 | tooltip => "Fog-of-War marks areas that cannot be seen by the player", |
|
|
144 | connect_changed => sub { |
136 | my ($self, $value) = @_; |
145 | my ($self, $value) = @_; |
137 | $CFG->{fow_enable} = $value; |
146 | $CFG->{fow_enable} = $value; |
|
|
147 | } |
138 | }); |
148 | ); |
139 | |
149 | |
140 | $table->add (0, 4, new CFClient::UI::Label valign => 0, align => 1, text => "FoW Intensity"); |
150 | $table->add (0, $row, new CFClient::UI::Label valign => 0, align => 1, text => "FoW Intensity"); |
141 | $table->add (1, 4, new CFClient::UI::Slider range => [$CFG->{fow_intensity}, 0, 1 + 0.001, 0.001], connect_changed => sub { |
151 | $table->add (1, $row++, new CFClient::UI::Slider |
|
|
152 | range => [$CFG->{fow_intensity}, 0, 1 + 0.001, 0.001], |
|
|
153 | tooltip => "The higher the intensity, the lighter the Fog-of-War color", |
|
|
154 | connect_changed => sub { |
142 | my ($self, $value) = @_; |
155 | my ($self, $value) = @_; |
143 | $CFG->{fow_intensity} = $value; |
156 | $CFG->{fow_intensity} = $value; |
|
|
157 | } |
144 | }); |
158 | ); |
145 | |
159 | |
146 | $table->add (0, 5, new CFClient::UI::Label valign => 0, align => 1, text => "FoW Smooth"); |
160 | $table->add (0, $row, new CFClient::UI::Label valign => 0, align => 1, text => "FoW Smooth"); |
147 | $table->add (1, 5, new CFClient::UI::CheckBox state => $CFG->{fow_smooth}, connect_changed => sub { |
161 | $table->add (1, $row++, new CFClient::UI::CheckBox |
|
|
162 | state => $CFG->{fow_smooth}, |
|
|
163 | tooltip => "Smooth the Fog-of-War a bit to make it more realistic", |
|
|
164 | connect_changed => sub { |
148 | my ($self, $value) = @_; |
165 | my ($self, $value) = @_; |
149 | $CFG->{fow_smooth} = $value; |
166 | $CFG->{fow_smooth} = $value; |
150 | status "Fog of War smoothing requires OpenGL 1.2 or higher" if $CFClient::GL_VERSION < 1.2; |
167 | status "Fog of War smoothing requires OpenGL 1.2 or higher" if $CFClient::GL_VERSION < 1.2; |
|
|
168 | } |
151 | }); |
169 | ); |
152 | |
170 | |
153 | $table->add (0, 6, new CFClient::UI::Label valign => 0, align => 1, text => "GUI Fontsize"); |
171 | $table->add (0, $row, new CFClient::UI::Label valign => 0, align => 1, text => "GUI Fontsize"); |
154 | $table->add (1, 6, new CFClient::UI::Slider range => [$CFG->{gui_fontsize}, 0.7, 1.7, 0.1], connect_changed => sub { |
172 | $table->add (1, $row++, new CFClient::UI::Slider |
|
|
173 | range => [$CFG->{gui_fontsize}, 0.5, 2, 0.1], |
|
|
174 | tooltip => "The font size used by most GUI elements", |
|
|
175 | connect_changed => sub { |
155 | $CFG->{gui_fontsize} = 0.1 * int $_[1] * 10; |
176 | $CFG->{gui_fontsize} = 0.1 * int $_[1] * 10; |
156 | # $FONTSIZE = int $HEIGHT / 40 * $CFG->{gui_fontsize}; |
177 | # $FONTSIZE = int $HEIGHT / 40 * $CFG->{gui_fontsize}; |
|
|
178 | } |
157 | }); |
179 | ); |
158 | |
180 | |
159 | $table->add (0, 7, new CFClient::UI::Label valign => 0, align => 1, text => "Server Log Fontsize"); |
181 | $table->add (0, $row, new CFClient::UI::Label valign => 0, align => 1, text => "Server Log Fontsize"); |
160 | $table->add (1, 7, new CFClient::UI::Slider range => [$CFG->{log_fontsize}, 0.7, 1.7, 0.1], connect_changed => sub { |
182 | $table->add (1, $row++, new CFClient::UI::Slider |
|
|
183 | range => [$CFG->{log_fontsize}, 0.5, 2, 0.1], |
|
|
184 | tooltip => "The font size used by the server log window only", |
|
|
185 | connect_changed => sub { |
161 | $LOGVIEW->set_fontsize ($CFG->{log_fontsize} = 0.1 * int $_[1] * 10); |
186 | $LOGVIEW->set_fontsize ($CFG->{log_fontsize} = 0.1 * int $_[1] * 10); |
|
|
187 | } |
162 | }); |
188 | ); |
163 | |
189 | |
164 | $table->add (1, 8, new CFClient::UI::Button expand => 1, align => 0, text => "Apply", connect_activate => sub { |
190 | $table->add (0, $row, new CFClient::UI::Label valign => 0, align => 1, text => "Stats Fontsize"); |
|
|
191 | |
|
|
192 | $table->add (1, $row++, new CFClient::UI::Slider |
|
|
193 | range => [$CFG->{stat_fontsize}, 0.5, 2, 0.1], |
|
|
194 | tooltip => "The font size used by the statistics window only", |
|
|
195 | connect_changed => sub { |
|
|
196 | $CFG->{stat_fontsize} = 0.1 * int $_[1] * 10; |
|
|
197 | &set_stats_window_fontsize; |
|
|
198 | } |
|
|
199 | ); |
|
|
200 | |
|
|
201 | $table->add (0, $row, new CFClient::UI::Label valign => 0, align => 1, text => "Gauge size"); |
|
|
202 | $table->add (1, $row++, new CFClient::UI::Slider |
|
|
203 | range => [$CFG->{gauge_size}, 0.2, 0.8, 0.02], |
|
|
204 | tooltip => "Adjust the size of the stats gauges at the bottom right", |
|
|
205 | connect_changed => sub { |
|
|
206 | $CFG->{gauge_size} = $_[1]; |
|
|
207 | my $h = int $HEIGHT * $CFG->{gauge_size}; |
|
|
208 | $GAUGES->{win}->set_size ($WIDTH, $h); |
|
|
209 | $GAUGES->{win}->move (0, $HEIGHT - $h); |
|
|
210 | } |
|
|
211 | ); |
|
|
212 | |
|
|
213 | $table->add (0, $row, new CFClient::UI::Label valign => 0, align => 1, text => "Gauge fontsize"); |
|
|
214 | $table->add (1, $row++, new CFClient::UI::Slider |
|
|
215 | range => [$CFG->{gauge_fontsize}, 0.5, 2.0, 0.1], |
|
|
216 | connect_changed => sub { |
|
|
217 | $CFG->{gauge_fontsize} = 0.1 * int $_[1] * 10; |
|
|
218 | &set_gauge_window_fontsize; |
|
|
219 | #$GAUGES->{win}->check_size; |
|
|
220 | #$GAUGES->{win}->update; |
|
|
221 | } |
|
|
222 | ); |
|
|
223 | |
|
|
224 | $table->add (1, $row++, new CFClient::UI::Button |
|
|
225 | expand => 1, align => 0, text => "Apply", |
|
|
226 | tooltip => "Apply the video settings (unless they are auto-apply)", |
|
|
227 | connect_activate => sub { |
165 | video_shutdown (); |
228 | video_shutdown (); |
166 | video_init (); |
229 | video_init (); |
|
|
230 | } |
167 | }); |
231 | ); |
168 | |
232 | |
169 | $table->add (0, 9, new CFClient::UI::Label valign => 0, align => 1, text => "Audio Enable"); |
233 | $table->add (0, $row, new CFClient::UI::Label valign => 0, align => 1, text => "Audio Enable"); |
170 | $table->add (1, 9, new CFClient::UI::CheckBox state => $CFG->{audio_enable}, connect_changed => sub { |
234 | $table->add (1, $row++, new CFClient::UI::CheckBox |
|
|
235 | state => $CFG->{audio_enable}, |
|
|
236 | tooltip => "If enabled, sound effects and music will be played. If disabled, no audio will be used and the soundcard will not be opened.", |
|
|
237 | connect_changed => sub { |
171 | $CFG->{audio_enable} = $_[1]; |
238 | $CFG->{audio_enable} = $_[1]; |
|
|
239 | } |
172 | }); |
240 | ); |
173 | # $table->add (0, 9, new CFClient::UI::Label valign => 0, align => 1, text => "Effects Volume"); |
241 | # $table->add (0, 9, new CFClient::UI::Label valign => 0, align => 1, text => "Effects Volume"); |
174 | # $table->add (1, 8, new CFClient::UI::Slider range => [$CFG->{effects_volume}, 0, 128, 1], connect_changed => sub { |
242 | # $table->add (1, 8, new CFClient::UI::Slider range => [$CFG->{effects_volume}, 0, 128, 1], connect_changed => sub { |
175 | # $CFG->{effects_volume} = $_[1]; |
243 | # $CFG->{effects_volume} = $_[1]; |
176 | # }); |
244 | # }); |
177 | $table->add (0, 10, new CFClient::UI::Label valign => 0, align => 1, text => "Background Music"); |
245 | $table->add (0, $row, new CFClient::UI::Label valign => 0, align => 1, text => "Background Music"); |
178 | $table->add (1, 10, my $hbox = new CFClient::UI::HBox); |
246 | $table->add (1, $row++, my $hbox = new CFClient::UI::HBox); |
179 | $hbox->add (new CFClient::UI::CheckBox expand => 1, state => $CFG->{bgm_enable}, connect_changed => sub { |
247 | $hbox->add (new CFClient::UI::CheckBox |
|
|
248 | expand => 1, state => $CFG->{bgm_enable}, |
|
|
249 | tooltip => "Enable background music playing", |
|
|
250 | connect_changed => sub { |
180 | $CFG->{bgm_enable} = $_[1]; |
251 | $CFG->{bgm_enable} = $_[1]; |
|
|
252 | } |
181 | }); |
253 | ); |
182 | $hbox->add (new CFClient::UI::Slider expand => 1, range => [$CFG->{bgm_volume}, 0, 1, 0.1], connect_changed => sub { |
254 | $hbox->add (new CFClient::UI::Slider |
|
|
255 | expand => 1, range => [$CFG->{bgm_volume}, 0, 1, 0.1], |
|
|
256 | tooltip => "The volume of the background music", |
|
|
257 | connect_changed => sub { |
183 | $CFG->{bgm_volume} = $_[1]; |
258 | $CFG->{bgm_volume} = $_[1]; |
184 | CFClient::MixMusic::volume $_[1] * 128; |
259 | CFClient::MixMusic::volume $_[1] * 128; |
|
|
260 | } |
185 | }); |
261 | ); |
186 | |
262 | |
187 | $table->add (1, 11, new CFClient::UI::Button expand => 1, align => 0, text => "Apply", connect_activate => sub { |
263 | $table->add (1, $row++, new CFClient::UI::Button |
|
|
264 | expand => 1, align => 0, text => "Apply", |
|
|
265 | tooltip => "Apply the audio settings that are not auto-apply", |
|
|
266 | connect_activate => sub { |
188 | audio_shutdown (); |
267 | audio_shutdown (); |
189 | audio_init (); |
268 | audio_init (); |
|
|
269 | } |
190 | }); |
270 | ); |
191 | |
271 | |
192 | $dialog |
272 | $dialog |
193 | } |
273 | } |
194 | |
274 | |
|
|
275 | sub set_stats_window_fontsize { |
|
|
276 | for (values %{$STATWIDS}) { |
|
|
277 | $_->set_fontsize ($::CFG->{stat_fontsize}); |
|
|
278 | } |
|
|
279 | } |
|
|
280 | |
|
|
281 | sub set_gauge_window_fontsize { |
|
|
282 | for (map { $GAUGES->{$_} } grep { $_ ne 'win' } keys %{$GAUGES}) { |
|
|
283 | $_->set_fontsize ($::CFG->{gauge_fontsize}); |
|
|
284 | } |
|
|
285 | } |
|
|
286 | |
|
|
287 | sub make_gauge_window { |
|
|
288 | my $gh = int ($HEIGHT * $CFG->{gauge_size}); |
|
|
289 | # my $gw = int ($WIDTH * $CFG->{gauge_w_size}); |
|
|
290 | |
|
|
291 | my $win = new CFClient::UI::Frame ( |
|
|
292 | y => $HEIGHT - $gh, x => 0, req_w => $WIDTH, req_h => $gh |
|
|
293 | ); |
|
|
294 | $win->add (my $vb = new CFClient::UI::VBox); |
|
|
295 | |
|
|
296 | $vb->add (my $hbg = new CFClient::UI::HBox expand => 1); |
|
|
297 | |
|
|
298 | |
|
|
299 | $hbg->add (new CFClient::UI::Empty expand => 1); |
|
|
300 | $hbg->add (my $hb = new CFClient::UI::HBox); |
|
|
301 | $hb->add (my $hg = new CFClient::UI::Gauge type => 'hp'); |
|
|
302 | $hb->add (my $mg = new CFClient::UI::Gauge type => 'mana'); |
|
|
303 | $hb->add (my $gg = new CFClient::UI::Gauge type => 'grace'); |
|
|
304 | $hb->add (my $fg = new CFClient::UI::Gauge type => 'food'); |
|
|
305 | |
|
|
306 | $vb->add (my $exp = new CFClient::UI::Label valign => 0, align => 1, text => "XP:"); |
|
|
307 | # $vb->add (my $lvl = new CFClient::UI::Label valign => 0, align => 1, text => "Lvl:"); |
|
|
308 | $vb->add (my $rng = new CFClient::UI::Label valign => 0, align => 1, text => "Rng:"); |
|
|
309 | |
|
|
310 | |
|
|
311 | $GAUGES = { |
|
|
312 | exp => $exp,# lvl => $lvl, |
|
|
313 | win => $win, range => $rng, |
|
|
314 | food => $fg, mana => $mg, hp => $hg, grace => $gg |
|
|
315 | }; |
|
|
316 | $win |
|
|
317 | } |
|
|
318 | |
195 | sub make_stats_window { |
319 | sub make_stats_window { |
196 | my $tgw = new CFClient::UI::FancyFrame (x => $WIDTH * 2/3, y => 0, title => "Stats"); |
320 | my $tgw = new CFClient::UI::FancyFrame (x => $WIDTH * 2/5, y => 0, title => "Stats"); |
|
|
321 | |
197 | $tgw->add (my $vb = new CFClient::UI::VBox ()); |
322 | $tgw->add (my $vb = new CFClient::UI::VBox); |
198 | $vb->add ($STATWIDS->{stat} = new CFClient::UI::Label valign => 0, align => -1); |
|
|
199 | $vb->add (my $hb2 = new CFClient::UI::HBox); |
323 | $vb->add (my $uhb = new CFClient::UI::HBox); |
|
|
324 | $uhb->add ($STATWIDS->{title} = new CFClient::UI::Label valign => 0, align => -1, text => "Title:", expand => 1); |
|
|
325 | $uhb->add ($STATWIDS->{map} = new CFClient::UI::Label valign => 0, align => -1, text => "Map:", expand => 1); |
|
|
326 | |
|
|
327 | $vb->add (my $hb = new CFClient::UI::HBox expand => 1); |
|
|
328 | |
200 | $hb2->add (my $hg = new CFClient::UI::Gauge (type => 'hp')); |
329 | $hb->add (my $tbl = new CFClient::UI::Table expand => 1); |
201 | $hb2->add (my $mg = new CFClient::UI::Gauge (type => 'mana')); |
330 | |
202 | $hb2->add (my $gg = new CFClient::UI::Gauge (type => 'grace')); |
331 | $tbl->add (0, 0, $STATWIDS->{st_str_lbl} = new CFClient::UI::Label valign => 0, align => +1, text => "Str"); |
203 | $hb2->add (my $fg = new CFClient::UI::Gauge (type => 'food')); |
332 | $tbl->add (0, 1, $STATWIDS->{st_dex_lbl} = new CFClient::UI::Label valign => 0, align => +1, text => "Dex"); |
204 | $GAUGES = { food => $fg, mana => $mg, hp => $hg, grace => $gg }; |
333 | $tbl->add (0, 2, $STATWIDS->{st_con_lbl} = new CFClient::UI::Label valign => 0, align => +1, text => "Con"); |
|
|
334 | $tbl->add (0, 3, $STATWIDS->{st_int_lbl} = new CFClient::UI::Label valign => 0, align => +1, text => "Int"); |
|
|
335 | $tbl->add (0, 4, $STATWIDS->{st_wis_lbl} = new CFClient::UI::Label valign => 0, align => +1, text => "Wis"); |
|
|
336 | $tbl->add (0, 5, $STATWIDS->{st_pow_lbl} = new CFClient::UI::Label valign => 0, align => +1, text => "Pow"); |
|
|
337 | $tbl->add (0, 6, $STATWIDS->{st_cha_lbl} = new CFClient::UI::Label valign => 0, align => +1, text => "Cha"); |
|
|
338 | |
|
|
339 | $tbl->add (1, 0, $STATWIDS->{st_str} = new CFClient::UI::Label valign => 0, align => +1, text => ""); |
|
|
340 | $tbl->add (1, 1, $STATWIDS->{st_dex} = new CFClient::UI::Label valign => 0, align => +1, text => ""); |
|
|
341 | $tbl->add (1, 2, $STATWIDS->{st_con} = new CFClient::UI::Label valign => 0, align => +1, text => ""); |
|
|
342 | $tbl->add (1, 3, $STATWIDS->{st_int} = new CFClient::UI::Label valign => 0, align => +1, text => ""); |
|
|
343 | $tbl->add (1, 4, $STATWIDS->{st_wis} = new CFClient::UI::Label valign => 0, align => +1, text => ""); |
|
|
344 | $tbl->add (1, 5, $STATWIDS->{st_pow} = new CFClient::UI::Label valign => 0, align => +1, text => ""); |
|
|
345 | $tbl->add (1, 6, $STATWIDS->{st_cha} = new CFClient::UI::Label valign => 0, align => +1, text => ""); |
|
|
346 | |
|
|
347 | $tbl->add (2, 0, $STATWIDS->{st_wc_lbl} = new CFClient::UI::Label valign => 0, align => +1, text => "Wc"); |
|
|
348 | $tbl->add (2, 1, $STATWIDS->{st_ac_lbl} = new CFClient::UI::Label valign => 0, align => +1, text => "Ac"); |
|
|
349 | $tbl->add (2, 2, $STATWIDS->{st_dam_lbl} = new CFClient::UI::Label valign => 0, align => +1, text => "Dam"); |
|
|
350 | $tbl->add (2, 3, $STATWIDS->{st_arm_lbl} = new CFClient::UI::Label valign => 0, align => +1, text => "Arm"); |
|
|
351 | $tbl->add (2, 4, $STATWIDS->{st_spd_lbl} = new CFClient::UI::Label valign => 0, align => +1, text => "Sp"); |
|
|
352 | $tbl->add (2, 5, $STATWIDS->{st_wspd_lbl} = new CFClient::UI::Label valign => 0, align => +1, text => "WSp"); |
|
|
353 | |
|
|
354 | $tbl->add (3, 0, $STATWIDS->{st_wc} = new CFClient::UI::Label valign => 0, align => +1, text => ""); |
|
|
355 | $tbl->add (3, 1, $STATWIDS->{st_ac} = new CFClient::UI::Label valign => 0, align => +1, text => ""); |
|
|
356 | $tbl->add (3, 2, $STATWIDS->{st_dam} = new CFClient::UI::Label valign => 0, align => +1, text => ""); |
|
|
357 | $tbl->add (3, 3, $STATWIDS->{st_arm} = new CFClient::UI::Label valign => 0, align => +1, text => ""); |
|
|
358 | $tbl->add (3, 4, $STATWIDS->{st_spd} = new CFClient::UI::Label valign => 0, align => +1, text => ""); |
|
|
359 | $tbl->add (3, 5, $STATWIDS->{st_wspd} = new CFClient::UI::Label valign => 0, align => +1, text => ""); |
|
|
360 | |
|
|
361 | $hb->add (my $tbl2 = new CFClient::UI::Table expand => 1); |
|
|
362 | |
|
|
363 | my $row = 0; |
|
|
364 | my $col = 0; |
|
|
365 | |
|
|
366 | for (qw/slow holyw conf fire depl magic |
|
|
367 | drain acid pois para deat phys |
|
|
368 | blind fear tund elec cold ghit/) |
|
|
369 | { |
|
|
370 | $tbl2->add ($col, $row, |
|
|
371 | $STATWIDS->{"res_$_"} = |
|
|
372 | new CFClient::UI::Label text => "0", align => +1, valign => 0 |
|
|
373 | ); |
|
|
374 | $tbl2->add ($col + 1, $row, new CFClient::UI::Image image => "ui/resist/resist_$_.png"); |
|
|
375 | |
|
|
376 | $row++; |
|
|
377 | if ($row % 6 == 0) { |
|
|
378 | $col += 2; |
|
|
379 | $row = 0; |
|
|
380 | } |
|
|
381 | } |
|
|
382 | |
|
|
383 | &set_stats_window_fontsize; |
|
|
384 | update_stats_window ({}); |
|
|
385 | |
205 | $tgw |
386 | $tgw |
206 | } |
387 | } |
207 | |
388 | |
208 | sub update_stats_window { |
389 | sub update_stats_window { |
209 | my ($stats) = @_; |
390 | my ($stats) = @_; |
210 | |
391 | |
211 | $STATWIDS->{stat}->set_text ( |
392 | # i love text protocols!!! |
212 | "Title: $stats->{21}\nExp.: " . ($stats->{11} || $stats->{28}) |
393 | my $hp = $stats->{1} * 1; |
213 | . " Level: $stats->{12}\n" |
394 | my $hp_m = $stats->{2} * 1; |
214 | . (sprintf "S%d D%d Co%d I%d W%d P%d Ch%2d, Wc%d Ac%d\n", |
395 | my $sp = $stats->{3} * 1; |
215 | @$stats{5,8,9,6,7,22,10, 13, 14}) |
396 | my $sp_m = $stats->{4} * 1; |
216 | . (sprintf "Dam %d Arm %d Speed %.2f/%.2f", |
397 | my $fo = $stats->{18} * 1; |
217 | @$stats{15,16,17,19}) |
398 | my $fo_m = 999; |
|
|
399 | my $gr = $stats->{23} * 1; |
|
|
400 | my $gr_m = $stats->{24} * 1; |
|
|
401 | |
|
|
402 | $GAUGES->{hp} ->set_value ($hp, $hp_m); |
|
|
403 | $GAUGES->{mana} ->set_value ($sp, $sp_m); |
|
|
404 | $GAUGES->{food} ->set_value ($fo, $fo_m); |
|
|
405 | $GAUGES->{grace} ->set_value ($gr, $gr_m); |
|
|
406 | $GAUGES->{exp} ->set_text ("XP: " . ($stats->{11} || $stats->{28}) * 1 |
|
|
407 | ." LVL: " . $stats->{12} * 1); |
|
|
408 | my $rng = $stats->{20}; |
|
|
409 | $rng =~ s/^Range: //; # thank you so much dear server |
|
|
410 | $GAUGES->{range} ->set_text ("Rng: " . $rng); |
|
|
411 | # $GAUGES->{lvl} ->set_text ("LVL: " . $stats->{12}); |
|
|
412 | my $title = $stats->{21}; |
|
|
413 | $title =~ s/^Player: //; |
|
|
414 | $STATWIDS->{title} ->set_text ("Title: " . $title); |
|
|
415 | |
|
|
416 | if (0) { # this code can vanish, just wanted to preserver it for a checkin |
|
|
417 | $STATWIDS->{st_str} ->set_text (sprintf "S%d", $stats->{5}); |
|
|
418 | $STATWIDS->{st_dex} ->set_text (sprintf "D%d", $stats->{8}); |
|
|
419 | $STATWIDS->{st_con} ->set_text (sprintf "Co%d", $stats->{9}); |
|
|
420 | $STATWIDS->{st_int} ->set_text (sprintf "I%d", $stats->{6}); |
|
|
421 | $STATWIDS->{st_wis} ->set_text (sprintf "W%d", $stats->{7}); |
|
|
422 | $STATWIDS->{st_pow} ->set_text (sprintf "P%d", $stats->{22}); |
|
|
423 | $STATWIDS->{st_cha} ->set_text (sprintf "Ch%d", $stats->{10}); |
|
|
424 | $STATWIDS->{st_wc} ->set_text (sprintf "Wc%d", $stats->{13}); |
|
|
425 | $STATWIDS->{st_ac} ->set_text (sprintf "Ac%d", $stats->{14}); |
|
|
426 | $STATWIDS->{st_dam} ->set_text (sprintf "Dam%d", $stats->{15}); |
|
|
427 | $STATWIDS->{st_arm} ->set_text (sprintf "Arm%d", $stats->{16}); |
|
|
428 | $STATWIDS->{st_spd} ->set_text (sprintf "Sp%.1f", $stats->{17}); |
|
|
429 | $STATWIDS->{st_wspd}->set_text (sprintf "WSp%.1f", $stats->{19}); |
|
|
430 | } else { |
|
|
431 | $STATWIDS->{st_str} ->set_text (sprintf "%d", $stats->{5}); |
|
|
432 | $STATWIDS->{st_dex} ->set_text (sprintf "%d", $stats->{8}); |
|
|
433 | $STATWIDS->{st_con} ->set_text (sprintf "%d", $stats->{9}); |
|
|
434 | $STATWIDS->{st_int} ->set_text (sprintf "%d", $stats->{6}); |
|
|
435 | $STATWIDS->{st_wis} ->set_text (sprintf "%d", $stats->{7}); |
|
|
436 | $STATWIDS->{st_pow} ->set_text (sprintf "%d", $stats->{22}); |
|
|
437 | $STATWIDS->{st_cha} ->set_text (sprintf "%d", $stats->{10}); |
|
|
438 | $STATWIDS->{st_wc} ->set_text (sprintf "%d", $stats->{13}); |
|
|
439 | $STATWIDS->{st_ac} ->set_text (sprintf "%d", $stats->{14}); |
|
|
440 | $STATWIDS->{st_dam} ->set_text (sprintf "%d", $stats->{15}); |
|
|
441 | $STATWIDS->{st_arm} ->set_text (sprintf "%d", $stats->{16}); |
|
|
442 | $STATWIDS->{st_spd} ->set_text (sprintf "%.1f", $stats->{17}); |
|
|
443 | $STATWIDS->{st_wspd}->set_text (sprintf "%.1f", $stats->{19}); |
|
|
444 | } |
|
|
445 | |
|
|
446 | my %tbl = ( |
|
|
447 | phys => 100, |
|
|
448 | magic => 101, |
|
|
449 | fire => 102, |
|
|
450 | elec => 103, |
|
|
451 | cold => 104, |
|
|
452 | conf => 105, |
|
|
453 | acid => 106, |
|
|
454 | drain => 107, |
|
|
455 | ghit => 108, |
|
|
456 | pois => 109, |
|
|
457 | slow => 110, |
|
|
458 | para => 111, |
|
|
459 | tund => 112, |
|
|
460 | fear => 113, |
|
|
461 | depl => 113, |
|
|
462 | deat => 115, |
|
|
463 | holyw => 116, |
|
|
464 | blind => 117 |
218 | ); |
465 | ); |
|
|
466 | |
|
|
467 | for (keys %tbl) { |
|
|
468 | $STATWIDS->{"res_$_"}->set_text (sprintf "%d%", $stats->{$tbl{$_}}); |
|
|
469 | } |
|
|
470 | |
219 | } |
471 | } |
220 | |
472 | |
221 | sub metaserver_dialog { |
473 | sub metaserver_dialog { |
222 | my $dialog = new CFClient::UI::FancyFrame |
474 | my $dialog = new CFClient::UI::FancyFrame |
223 | title => "Metaserver", |
475 | title => "Metaserver", |
… | |
… | |
470 | $BUTTONBAR->add (new CFClient::UI::Button text => "Save Config", connect_activate => sub { |
722 | $BUTTONBAR->add (new CFClient::UI::Button text => "Save Config", connect_activate => sub { |
471 | CFClient::write_cfg "$Crossfire::VARDIR/pclientrc"; |
723 | CFClient::write_cfg "$Crossfire::VARDIR/pclientrc"; |
472 | status "Configuration Saved"; |
724 | status "Configuration Saved"; |
473 | }); |
725 | }); |
474 | |
726 | |
|
|
727 | $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 |
|
|
728 | $BUTTONBAR->add (new CFClient::UI::Flopper text => "Stats Window", other => make_stats_window); |
|
|
729 | |
475 | $BUTTONBAR->{children}[1]->emit ("activate"); # pop up server setup |
730 | $BUTTONBAR->{children}[1]->emit ("activate"); # pop up server setup |
476 | |
731 | |
477 | |
732 | |
478 | $CFClient::UI::ROOT->add (make_stats_window); |
|
|
479 | } |
733 | } |
480 | |
734 | |
481 | sub video_shutdown { |
735 | sub video_shutdown { |
482 | $CFClient::UI::ROOT->{children} = []; |
736 | $CFClient::UI::ROOT->{children} = []; |
483 | undef $SDL_ACTIVE; |
737 | undef $SDL_ACTIVE; |
… | |
… | |
589 | @conn::ISA = Crossfire::Protocol::; |
843 | @conn::ISA = Crossfire::Protocol::; |
590 | |
844 | |
591 | sub conn::stats_update { |
845 | sub conn::stats_update { |
592 | my ($self, $stats) = @_; |
846 | my ($self, $stats) = @_; |
593 | |
847 | |
594 | # i love text protocols!!! |
|
|
595 | # FIXME: the stats are somehow weird |
|
|
596 | my $hp = $stats->{1}; |
|
|
597 | my $hp_m = $stats->{2}; |
|
|
598 | my $sp = $stats->{3}; |
|
|
599 | my $sp_m = $stats->{4}; |
|
|
600 | my $fo = $stats->{18}; |
|
|
601 | my $fo_m = 999; |
|
|
602 | my $gr = $stats->{23}; |
|
|
603 | my $gr_m = $stats->{24}; |
|
|
604 | |
|
|
605 | #d# warn "DATA $hp $hp_m $sp $sp_m $fo $fo_m $gr $gr_m\n"; |
|
|
606 | $GAUGES->{hp} ->set_value ($hp, $hp_m); |
|
|
607 | $GAUGES->{mana} ->set_value ($sp, $sp_m); |
|
|
608 | $GAUGES->{food} ->set_value ($fo, $fo_m); |
|
|
609 | $GAUGES->{grace}->set_value ($gr, $gr_m); |
|
|
610 | |
|
|
611 | update_stats_window ($stats); |
848 | update_stats_window ($stats); |
612 | } |
849 | } |
613 | |
850 | |
614 | sub conn::user_send { |
851 | sub conn::user_send { |
615 | my ($self, $command) = @_; |
852 | my ($self, $command) = @_; |
… | |
… | |
746 | |
983 | |
747 | $x += $ox; |
984 | $x += $ox; |
748 | $y += $oy; |
985 | $y += $oy; |
749 | |
986 | |
750 | $self->{map_info} = [$hash, $x, $y, $w, $h]; |
987 | $self->{map_info} = [$hash, $x, $y, $w, $h]; |
|
|
988 | |
|
|
989 | my $map = $self->{map_info}[0]; |
|
|
990 | $map =~ s/^.*?\/([^\/]+)$/\1/; |
|
|
991 | $STATWIDS->{map}->set_text ("Map: " . $map); |
751 | |
992 | |
752 | $self->load_map ($hash, $x, $y); |
993 | $self->load_map ($hash, $x, $y); |
753 | } |
994 | } |
754 | |
995 | |
755 | sub conn::face_find { |
996 | sub conn::face_find { |
… | |
… | |
919 | fast => 0, |
1160 | fast => 0, |
920 | fow_enable => 1, |
1161 | fow_enable => 1, |
921 | fow_intensity => 0.45, |
1162 | fow_intensity => 0.45, |
922 | fow_smooth => 0, |
1163 | fow_smooth => 0, |
923 | gui_fontsize => 1, |
1164 | gui_fontsize => 1, |
924 | log_fontsize => 14, |
1165 | log_fontsize => 1, |
|
|
1166 | gauge_fontsize => 1, |
|
|
1167 | gauge_size => 0.35, |
|
|
1168 | stat_fontsize => 1, |
925 | mapsize => 100, |
1169 | mapsize => 100, |
926 | host => "crossfire.schmorp.de", |
1170 | host => "crossfire.schmorp.de", |
927 | say_command => 'say', |
1171 | say_command => 'say', |
928 | audio_enable => 1, |
1172 | audio_enable => 1, |
929 | bgm_enable => 1, |
1173 | bgm_enable => 1, |