ViewVC Help
View File | Revision Log | Show Annotations | Download File
/cvs/deliantra/Deliantra-Client/bin/cfplus
(Generate patch)

Comparing deliantra/Deliantra-Client/bin/cfplus (file contents):
Revision 1.22 by root, Sun May 28 01:37:45 2006 UTC vs.
Revision 1.23 by root, Sun May 28 02:31:04 2006 UTC

81our $LOGVIEW; 81our $LOGVIEW;
82our $CONSOLE; 82our $CONSOLE;
83our $METASERVER; 83our $METASERVER;
84our $LOGIN_BUTTON; 84our $LOGIN_BUTTON;
85our $QUIT_DIALOG; 85our $QUIT_DIALOG;
86our $SERVER_SETUP;
86 87
87our $FLOORBOX; 88our $FLOORBOX;
88our $GAUGES; 89our $GAUGES;
89our $STATWIDS; 90our $STATWIDS;
90 91
97 98
98our $ALT_ENTER_MESSAGE; 99our $ALT_ENTER_MESSAGE;
99our $STATUSBOX; 100our $STATUSBOX;
100our $DEBUG_STATUS; 101our $DEBUG_STATUS;
101 102
103our $INV_WINDOW;
102our $INV; 104our $INV;
103our $INVR; 105our $INVR;
104our $INVR_LBL; 106our $INVR_LBL;
105 107
106sub status { 108sub status {
113 $DEBUG_STATUS->move ($WIDTH - $w, 0); 115 $DEBUG_STATUS->move ($WIDTH - $w, 0);
114} 116}
115 117
116sub start_game { 118sub start_game {
117 status "logging in..."; 119 status "logging in...";
120
121 $LOGIN_BUTTON->set_text ("Logout");
122 $SERVER_SETUP->hide;
118 123
119 my $mapsize = List::Util::min 32, List::Util::max 11, int $WIDTH * $CFG->{mapsize} * 0.01 / 32; 124 my $mapsize = List::Util::min 32, List::Util::max 11, int $WIDTH * $CFG->{mapsize} * 0.01 / 32;
120 125
121 my ($host, $port) = split /:/, $CFG->{host}; 126 my ($host, $port) = split /:/, $CFG->{host};
122 127
151 }; 156 };
152 157
153 if ($CONN) { 158 if ($CONN) {
154 CFClient::lowdelay fileno $CONN->{fh}; 159 CFClient::lowdelay fileno $CONN->{fh};
155 160
156 $LOGIN_BUTTON->set_text ("Logout");
157 status "login successful"; 161 status "login successful";
158
159 $BUTTONBAR->{children}[1]->emit ("activate")
160 if $BUTTONBAR->{children}[1]->{state};
161
162 } else { 162 } else {
163 status "unable to connect"; 163 status "unable to connect";
164 stop_game(); 164 stop_game();
165 } 165 }
166} 166}
167 167
168sub stop_game { 168sub stop_game {
169 $LOGIN_BUTTON->set_text ("Login");
170 $SERVER_SETUP->show;
171 $INV_WINDOW->hide;
172 $LOGVIEW->hide;
173
169 return unless $CONN; 174 return unless $CONN;
170 175
171 status "connection closed"; 176 status "connection closed";
172 $LOGIN_BUTTON->set_text ("Login"); 177
173 $CONN->destroy; 178 $CONN->destroy;
174 $CONN = 0; # false, does not autovivify 179 $CONN = 0; # false, does not autovivify
175
176 $BUTTONBAR->{children}[1]->emit ("activate")
177 unless $BUTTONBAR->{children}[1]->{state};
178} 180}
179 181
180sub client_setup { 182sub client_setup {
181 my $dialog = new CFClient::UI::FancyFrame 183 my $dialog = new CFClient::UI::FancyFrame
182 req_x => 1, 184 req_x => 1,
711 } 713 }
712 }); 714 });
713} 715}
714 716
715sub server_setup { 717sub server_setup {
716 my $dialog = new CFClient::UI::FancyFrame 718 my $dialog = $SERVER_SETUP = new CFClient::UI::FancyFrame
717 x => $WIDTH * (1/3), 719 x => $WIDTH * (1/3),
718 y => $HEIGHT * (1/8), 720 y => $HEIGHT * (1/8),
719 name => "server_setup", 721 name => "server_setup",
720 title => "Server Setup", 722 title => "Server Setup",
721 child => (my $vbox = new CFClient::UI::VBox), 723 child => (my $vbox = new CFClient::UI::VBox),
915 $QUIT_DIALOG->show; 917 $QUIT_DIALOG->show;
916 $QUIT_DIALOG->center; 918 $QUIT_DIALOG->center;
917} 919}
918 920
919sub make_inventory_window { 921sub make_inventory_window {
920 my $invwin = new CFClient::UI::FancyFrame 922 my $invwin = $INV_WINDOW = new CFClient::UI::FancyFrame
921 def_w => $WIDTH * 7/8, 923 def_w => $WIDTH * 7/8,
922 def_h => $HEIGHT * 7/8, 924 def_h => $HEIGHT * 7/8,
923 title => "Inventory", 925 title => "Inventory",
924 name => "inventory_window", 926 name => "inventory_window",
925 on_visibility_change => sub { 927 on_visibility_change => sub {
1115 1117
1116 $BUTTONBAR->show; 1118 $BUTTONBAR->show;
1117 1119
1118 $STATUSBOX->add ("Set video mode $WIDTH×$HEIGHT", timeout => 10, fg => [1, 1, 1, 0.5]); 1120 $STATUSBOX->add ("Set video mode $WIDTH×$HEIGHT", timeout => 10, fg => [1, 1, 1, 0.5]);
1119 1121
1120 $BUTTONBAR->{children}[1]->emit ("activate"); # pop up server setup 1122 $SERVER_SETUP->show;
1121 } 1123 }
1122} 1124}
1123 1125
1124sub video_shutdown { 1126sub video_shutdown {
1125 undef $SDL_ACTIVE; 1127 undef $SDL_ACTIVE;

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines