--- deliantra/Deliantra-Client/bin/cfplus 2007/07/22 17:17:17 1.183
+++ deliantra/Deliantra-Client/bin/cfplus 2007/07/29 18:22:34 1.189
@@ -180,9 +180,6 @@
our $PICKUP_CFG;
-our $IN_BUILD_MODE;
-our $BUILD_BUTTON;
-
sub status {
$STATUSBOX->add (CFPlus::asxml $_[0], pri => -10, group => "status", timeout => 10, fg => [1, 1, 0, 1]);
}
@@ -1126,21 +1123,8 @@
on_changed => sub { my ($self, $value) = @_; $CFG->{mapsize} = $self->{range}[0] = $value = int $value; 0 },
);
- $table->add_at (0, 8, new CFPlus::UI::Label valign => 0, align => 1, text => "Face Prefetch");
- $table->add_at (1, 8, new CFPlus::UI::CheckBox
- state => $CFG->{face_prefetch},
- tooltip => "Background Image Prefetch\n\n"
- . "If enabled, the client automatically pre-fetches images from the server. "
- . "This might increase or create lag, but increases the chances "
- . "of faces being ready for display when you encounter them. "
- . "It also uses up server bandwidth on every connect, "
- . "so only set it if you really need to prefetch images. "
- . "This option can be set and unset any time.",
- on_changed => sub { $CFG->{face_prefetch} = $_[1]; 0 },
- );
-
- $table->add_at (0, 9, new CFPlus::UI::Label valign => 0, align => 1, text => "Output-Rate");
- $table->add_at (1, 9, new CFPlus::UI::Entry
+ $table->add_at (0, 8, new CFPlus::UI::Label valign => 0, align => 1, text => "Output-Rate");
+ $table->add_at (1, 8, new CFPlus::UI::Entry
text => $CFG->{output_rate},
tooltip => "The approximate bandwidth in bytes per second that the server should not exceed "
. "when sending images, to ensure interactiveness. When 0 or unset, the server "
@@ -1148,21 +1132,21 @@
on_changed => sub { $CFG->{output_rate} = $_[1]; 0 },
);
- $table->add_at (0, 10, new CFPlus::UI::Label valign => 0, align => 1, text => "Output-Count");
- $table->add_at (1, 10, new CFPlus::UI::Entry
+ $table->add_at (0, 9, new CFPlus::UI::Label valign => 0, align => 1, text => "Output-Count");
+ $table->add_at (1, 9, new CFPlus::UI::Entry
text => $CFG->{output_count},
tooltip => "Should be set to 1 unless you know what you are doing. This option is only used once at log-in.",
on_changed => sub { $CFG->{output_count} = $_[1]; 0 },
);
- $table->add_at (0, 11, new CFPlus::UI::Label valign => 0, align => 1, text => "Output-Sync");
- $table->add_at (1, 11, new CFPlus::UI::Entry
+ $table->add_at (0, 10, new CFPlus::UI::Label valign => 0, align => 1, text => "Output-Sync");
+ $table->add_at (1, 10, new CFPlus::UI::Entry
text => $CFG->{output_sync},
tooltip => "Should be set to 1 unless you know what you are doing. This option is only used once at log-in.",
on_changed => sub { $CFG->{output_sync} = $_[1]; 0 },
);
- $table->add_at (1, 12, $LOGIN_BUTTON = new CFPlus::UI::Button
+ $table->add_at (1, 11, $LOGIN_BUTTON = new CFPlus::UI::Button
expand => 1,
align => 0,
text => "Login",
@@ -1186,19 +1170,6 @@
my $row = 0;
- $table->add_at (0, $row, new CFPlus::UI::Label valign => 0, align => 1, text => "Chat Command");
- $table->add_at (1, $row++, my $saycmd = new CFPlus::UI::Entry
- text => $CFG->{say_command},
- tooltip => "This is the command that will be used if you write a line in the message window entry or press \" in the map window. "
- . "Usually you want to enter something like 'say' or 'shout' or 'gsay' here. "
- . "But you could also set it to tell playername to only chat with that user.",
- on_changed => sub {
- my ($self, $value) = @_;
- $CFG->{say_command} = $value;
- 0
- }
- );
-
$table->add_at (0, $row, new CFPlus::UI::Label valign => 0, align => 1, text => "Tip of the day");
$table->add_at (1, $row++, new CFPlus::UI::CheckBox
state => $CFG->{show_tips},
@@ -1419,27 +1390,27 @@
$PL_NOTEBOOK =
new CFPlus::UI::Notebook expand => 1;
- $ntb->add (
+ $ntb->add_tab (
"Statistics (F2)" => $STATS_PAGE = stats_window,
"Shows statistics, where all your Stats and Resistances are shown."
);
- $ntb->add (
+ $ntb->add_tab (
"Skills (F3)" => $SKILL_PAGE = skill_window,
"Shows all your Skills."
);
my $spellsw = $SPELL_PAGE = new CFPlus::UI::ScrolledWindow (expand => 1, scroll_y => 1);
$spellsw->add ($SPELL_LIST = new CFPlus::UI::SpellList);
- $ntb->add (
+ $ntb->add_tab (
"Spellbook (F4)" => $spellsw,
"Displays all spells you have and lets you edit keyboard shortcuts for them."
);
- $ntb->add (
+ $ntb->add_tab (
"Inventory (F5)" => $INVENTORY_PAGE = inventory_widget,
"Toggles the inventory window, where you can manage your loot (or treasures :). "
. "You can also hit the Tab-key to show/hide the Inventory."
);
- $ntb->add (Pickup => autopickup_setup,
+ $ntb->add_tab (Pickup => autopickup_setup,
"Configure autopickup settings, i.e. which items you will pick up automatically when walking (or running) over them.");
$ntb->set_current_page ($INVENTORY_PAGE);
@@ -1755,22 +1726,22 @@
$SETUP_DIALOG->add ($SETUP_NOTEBOOK = new CFPlus::UI::Notebook expand => 1, debug => 1,
filter => new CFPlus::UI::ScrolledWindow expand => 1, scroll_y => 1);
- $SETUP_NOTEBOOK->add (Server => $SETUP_SERVER = server_setup,
+ $SETUP_NOTEBOOK->add_tab (Server => $SETUP_SERVER = server_setup,
"Configure the server to play on, your username, password and other server-related options.");
- $SETUP_NOTEBOOK->add (Client => client_setup,
+ $SETUP_NOTEBOOK->add_tab (Client => client_setup,
"Configure various client-specific settings.");
- $SETUP_NOTEBOOK->add (Graphics => graphics_setup,
+ $SETUP_NOTEBOOK->add_tab (Graphics => graphics_setup,
"Configure the video mode, performance, fonts and other graphical aspects of the game.");
- $SETUP_NOTEBOOK->add (Audio => audio_setup,
+ $SETUP_NOTEBOOK->add_tab (Audio => audio_setup,
"Configure the use of audio, sound effects and background music.");
- $SETUP_NOTEBOOK->add (Keyboard => $SETUP_KEYBOARD = keyboard_setup,
+ $SETUP_NOTEBOOK->add_tab (Keyboard => $SETUP_KEYBOARD = keyboard_setup,
"Lets you define, edit and delete key bindings."
. "There is a shortcut for making bindings: Control-Insert opens the binding editor "
. "with nothing set and the recording started. After doing the actions you "
. "want to record press Insert and you will be asked to press a key-combo. "
. "After pressing the combo the binding will be saved automatically and the "
. "binding editor closes");
- $SETUP_NOTEBOOK->add (Debug => debug_setup,
+ $SETUP_NOTEBOOK->add_tab (Debug => debug_setup,
"Some debuggin' options. Do not ask.");
$BUTTONBAR = new CFPlus::UI::Buttonbar x => 0, y => 0, z => 200; # put on top
@@ -1821,125 +1792,6 @@
$STATUSBOX->add ("Set video mode $WIDTH×$HEIGHT", timeout => 10, fg => [1, 1, 1, 0.5]);
}
-sub setup_build_button {
- my ($enabled) = @_;
- if ($enabled) {
- $BUILD_BUTTON->hide if $BUILD_BUTTON;
- $BUILD_BUTTON ||= new CFPlus::UI::Button
- text => "Build",
- tooltip => "Opens the ingame builder",
- on_activate => sub {
- if ($CONN) {
- $CONN->send_ext_req (builder_player_items => sub {
- open_ingame_editor ($_[0]) if exists $_[0]->{items};
- });
- }
- 0
- };
- $BUTTONBAR->add ($BUILD_BUTTON);
- } else {
- $BUILD_BUTTON->hide if $BUILD_BUTTON;
- }
-}
-
-sub open_ingame_editor {
- my ($msg) = @_;
-
- my $win = new CFPlus::UI::Toplevel
- x => 0,
- y => 'center',
- z => 4,
- name => 'builder_window',
- force_w => int $WIDTH * 1/4,
- force_h => int $HEIGHT * 3/4,
- title => "In game builder",
- has_close_button => 1;
-
- my $r = new CFPlus::UI::ScrolledWindow (
- expand => 1,
- scroll_y => 1
- );
- $r->add (my $vb = new CFPlus::UI::VBox);
- $win->add ($r);
-
-
- $vb->add (
- new CFPlus::UI::Button
- text => "Disable build mode",
- on_activate => sub { $::IN_BUILD_MODE = undef }
- );
- $vb->add (
- new CFPlus::UI::Button
- text => "ERASE",
- on_activate => sub { $::IN_BUILD_MODE = { do_erase => 1 } }
- );
-
- for my $itemarchname (
- sort {
- $msg->{items}->{$a}->{build_arch_name}
- cmp $msg->{items}->{$b}->{build_arch_name}
- } keys %{$msg->{items}}
- ) {
- my $info = $msg->{items}->{$itemarchname};
- $vb->add (
- new CFPlus::UI::Button text => $info->{build_arch_name},
- on_activate => sub {
- $::IN_BUILD_MODE = { item => $itemarchname, info => $info };
-
- if (grep { $msg->{items}->{$itemarchname}->{$_} } qw/has_connection has_name has_text/) {
- build_mode_query_arch_info ();
- }
- }
- );
- }
-
- $win->show;
-}
-
-sub build_mode_query_arch_info {
- my ($iteminfo) = $::IN_BUILD_MODE;
- my $itemarchname = $iteminfo->{item};
- my $info = $iteminfo->{info};
-
- my $dialog = new CFPlus::UI::Toplevel
- x => "center",
- y => "center",
- z => 50,
- force_w => int $WIDTH * 1/2,
- title => "Enter information for placement of '$itemarchname'",
- has_close_button => 1;
-
- $dialog->add (my $vb = new CFPlus::UI::VBox expand => 1);
-
- $vb->add (my $table = new CFPlus::UI::Table expand => 1);
- my $row = 0;
- if ($info->{has_name}) {
- $table->add_at (0, $row, new CFPlus::UI::Label text => "Name:");
- $table->add_at (1, $row++, new CFPlus::UI::Entry expand => 1, on_changed => sub { $::IN_BUILD_MODE->{name} = $_[1]; 0 });
- }
- if ($info->{has_text}) {
- $table->add_at (0, $row, new CFPlus::UI::Label text => "Text:");
- $table->add_at (1, $row++, new CFPlus::UI::Entry expand => 1, on_changed => sub { $::IN_BUILD_MODE->{text} = $_[1]; 0 });
- }
- if ($info->{has_connection}) {
- $table->add_at (0, $row, new CFPlus::UI::Label text => "Connection ID:");
- $table->add_at (1, $row++,
- new CFPlus::UI::Entry
- expand => 1,
- on_changed => sub { $::IN_BUILD_MODE->{connection} = $_[1]; 0 },
- tooltip => "Enter the connection ID here. The connection ID connects actors like a lever to a gate or a magic ear to a gate"
- );
- }
-
- $vb->add (my $hb = new CFPlus::UI::HBox expand => 1);
- $hb->add (new CFPlus::UI::Button
- text => "Close",
- expand => 1,
- on_activate => sub { $dialog->hide; 0 },
- );
- $dialog->show;
-}
-
sub video_shutdown {
CFPlus::OpenGL::shutdown;
@@ -1977,7 +1829,8 @@
$path eq $MUSIC_PLAYING->{path}
or return &audio_music_start ();
- $MUSIC_PLAYER = new_from_file CFPlus::MixMusic $path;
+ my $rwops = new_from_file CFPlus::RW $path;
+ $MUSIC_PLAYER = new CFPlus::MixMusic $rwops;
my $NOW = time;
@@ -2037,6 +1890,7 @@
sub audio_init {
if ($CFG->{audio_enable}) {
if (open my $fh, "<", CFPlus::find_rcfile "sounds/config") {
+ $ENV{MIX_EFFECTSMAXSPEED} = 1;
$SDL_MIXER = !CFPlus::Mix_OpenAudio;
unless ($SDL_MIXER) {
@@ -2059,7 +1913,8 @@
push @SOUNDS, "$volume,$file";
$AUDIO_CHUNKS{"$volume,$file"} ||= do {
- my $chunk = new_from_file CFPlus::MixChunk CFPlus::find_rcfile "sounds/$file";
+ my $rwops = new_from_file CFPlus::RW CFPlus::find_rcfile "sounds/$file";
+ my $chunk = new CFPlus::MixChunk $rwops;
$chunk->volume ($volume * 128 / 100);
$chunk
};
@@ -2127,15 +1982,6 @@
delete $animate_object{$widget};
}
-# check once/second for faces that need to be prefetched
-# this should, of course, only run on demand, but
-# SDL forces worse things on us....
-
-Event->timer (after => 1, interval => 0.25, cb => sub {
- $CONN->face_prefetch
- if $CONN;
-});
-
%SDL_CB = (
CFPlus::SDL_QUIT => sub {
exit;
@@ -2202,11 +2048,9 @@
gauge_size => 0.35,
stat_fontsize => 0.7,
mapsize => 100,
- say_command => 'chat',
audio_enable => 1,
bgm_enable => 1,
bgm_volume => 0.25,
- face_prefetch => 0,
output_sync => 1,
output_count => 1,
output_rate => "",