… | |
… | |
105 | our $INVR; |
105 | our $INVR; |
106 | our $INVR_LBL; |
106 | our $INVR_LBL; |
107 | our $OPENCONT; |
107 | our $OPENCONT; |
108 | |
108 | |
109 | sub status { |
109 | sub status { |
110 | $STATUSBOX->add ($_[0], pri => -10, group => "status", timeout => 20, fg => [1, 1, 0, 1]); |
110 | $STATUSBOX->add (CFClient::UI::Label::escape $_[0], pri => -10, group => "status", timeout => 20, fg => [1, 1, 0, 1]); |
111 | } |
111 | } |
112 | |
112 | |
113 | sub debug { |
113 | sub debug { |
114 | $DEBUG_STATUS->set_text ($_[0]); |
114 | $DEBUG_STATUS->set_text ($_[0]); |
115 | my ($w, $h) = $DEBUG_STATUS->size_request; |
115 | my ($w, $h) = $DEBUG_STATUS->size_request; |
… | |
… | |
136 | maph => $mapsize, |
136 | maph => $mapsize, |
137 | ; |
137 | ; |
138 | }; |
138 | }; |
139 | |
139 | |
140 | if ($CONN) { |
140 | if ($CONN) { |
|
|
141 | CFClient::lowdelay fileno $CONN->{fh}; |
|
|
142 | |
141 | $LOGIN_BUTTON->set_text ("Logout"); |
143 | $LOGIN_BUTTON->set_text ("Logout"); |
142 | |
|
|
143 | status "login successful"; |
144 | status "login successful"; |
144 | |
145 | |
145 | CFClient::lowdelay fileno $CONN->{fh}; |
146 | $BUTTONBAR->{children}[1]->emit ("activate") |
|
|
147 | if $BUTTONBAR->{children}[1]->{state}; |
|
|
148 | |
146 | } else { |
149 | } else { |
147 | status "unable to connect"; |
150 | status "unable to connect"; |
148 | stop_game(); |
151 | stop_game(); |
149 | } |
152 | } |
150 | } |
153 | } |
… | |
… | |
154 | |
157 | |
155 | status "connection closed"; |
158 | status "connection closed"; |
156 | $LOGIN_BUTTON->set_text ("Login"); |
159 | $LOGIN_BUTTON->set_text ("Login"); |
157 | $CONN->destroy; |
160 | $CONN->destroy; |
158 | $CONN = 0; # false, does not autovivify |
161 | $CONN = 0; # false, does not autovivify |
|
|
162 | |
|
|
163 | $BUTTONBAR->{children}[1]->emit ("activate") |
|
|
164 | unless $BUTTONBAR->{children}[1]->{state}; |
159 | |
165 | |
160 | undef $MAPCACHE; |
166 | undef $MAPCACHE; |
161 | undef $MAP; |
167 | undef $MAP; |
162 | } |
168 | } |
163 | |
169 | |
… | |
… | |
744 | |
750 | |
745 | $CFG->{mapsize} = $self->{range}[0] = $value = int $value; |
751 | $CFG->{mapsize} = $self->{range}[0] = $value = int $value; |
746 | }, |
752 | }, |
747 | ); |
753 | ); |
748 | |
754 | |
|
|
755 | $table->add (0, 8, new CFClient::UI::Label valign => 0, align => 1, text => "Output-Count"); |
|
|
756 | $table->add (1, 8, new CFClient::UI::Entry |
|
|
757 | text => $CFG->{output_count}, |
|
|
758 | tooltip => "Should be set to 1 unless you know what you are doing", |
|
|
759 | connect_changed => sub { $CFG->{output_count} = $_[1] }, |
|
|
760 | ); |
|
|
761 | |
|
|
762 | $table->add (0, 9, new CFClient::UI::Label valign => 0, align => 1, text => "Output-Sync"); |
|
|
763 | $table->add (1, 9, new CFClient::UI::Entry |
|
|
764 | text => $CFG->{output_sync}, |
|
|
765 | tooltip => "Should be set to 1 unless you know what you are doing", |
|
|
766 | connect_changed => sub { $CFG->{output_sync} = $_[1] }, |
|
|
767 | ); |
|
|
768 | |
749 | $table->add (1, 8, $LOGIN_BUTTON = new CFClient::UI::Button |
769 | $table->add (1, 10, $LOGIN_BUTTON = new CFClient::UI::Button |
750 | expand => 1, |
770 | expand => 1, |
751 | align => 0, |
771 | align => 0, |
752 | text => "Login", |
772 | text => "Login", |
753 | connect_activate => sub { |
773 | connect_activate => sub { |
754 | $CONN ? stop_game |
774 | $CONN ? stop_game |
… | |
… | |
766 | bg => [0, 0, 0, 0.5], |
786 | bg => [0, 0, 0, 0.5], |
767 | user_w => int $::WIDTH / 3, |
787 | user_w => int $::WIDTH / 3, |
768 | user_h => int $::HEIGHT / 5, |
788 | user_h => int $::HEIGHT / 5, |
769 | child => (my $vbox = new CFClient::UI::VBox); |
789 | child => (my $vbox = new CFClient::UI::VBox); |
770 | |
790 | |
771 | $vbox->add ($LOGVIEW = new CFClient::UI::TextView |
791 | $vbox->add ($LOGVIEW); |
772 | expand => 1, |
|
|
773 | font => $FONT_FIXED, |
|
|
774 | fontsize => $::CFG->{log_fontsize}, |
|
|
775 | ); |
|
|
776 | |
792 | |
777 | $vbox->add (my $input = new CFClient::UI::Entry |
793 | $vbox->add (my $input = new CFClient::UI::Entry |
778 | connect_focus_in => sub { |
794 | connect_focus_in => sub { |
779 | my ($input, $prev_focus) = @_; |
795 | my ($input, $prev_focus) = @_; |
780 | |
796 | |
… | |
… | |
815 | |
831 | |
816 | sub make_inventory_window { |
832 | sub make_inventory_window { |
817 | my $invwin = new CFClient::UI::FancyFrame |
833 | my $invwin = new CFClient::UI::FancyFrame |
818 | user_w => $WIDTH * (4/5), user_h => $HEIGHT * (4/5), title => "Inventory"; |
834 | user_w => $WIDTH * (4/5), user_h => $HEIGHT * (4/5), title => "Inventory"; |
819 | |
835 | |
820 | $invwin->add (my $hb = new CFClient::UI::HBox); |
836 | $invwin->add (my $hb = new CFClient::UI::HBox expand => 1); |
821 | |
837 | |
822 | $hb->add (my $vb1 = new CFClient::UI::VBox expand => 1); |
838 | $hb->add (my $vb1 = new CFClient::UI::VBox expand => 1); |
823 | $vb1->add (my $lbl = new CFClient::UI::Label); |
839 | $vb1->add (my $lbl = new CFClient::UI::Label); |
824 | $lbl->set_text ("Player"); |
840 | $lbl->set_text ("Player"); |
825 | $vb1->add ($INV = new CFClient::UI::Inventory expand => 1); |
841 | $vb1->add ($INV = new CFClient::UI::Inventory expand => 1); |
… | |
… | |
845 | ($WIDTH, $HEIGHT) = @{ $SDL_MODES[$CFG->{sdl_mode}] }; |
861 | ($WIDTH, $HEIGHT) = @{ $SDL_MODES[$CFG->{sdl_mode}] }; |
846 | $FULLSCREEN = $CFG->{fullscreen}; |
862 | $FULLSCREEN = $CFG->{fullscreen}; |
847 | $FAST = $CFG->{fast}; |
863 | $FAST = $CFG->{fast}; |
848 | |
864 | |
849 | CFClient::SDL_SetVideoMode $WIDTH, $HEIGHT, $FULLSCREEN |
865 | CFClient::SDL_SetVideoMode $WIDTH, $HEIGHT, $FULLSCREEN |
850 | or die "SDL_SetVideoMode failed!\n"; |
866 | or die "SDL_SetVideoMode failed: " . (CFClient::SDL_GetError) . "\n"; |
851 | |
867 | |
852 | $SDL_ACTIVE = 1; |
868 | $SDL_ACTIVE = 1; |
853 | $LAST_REFRESH = time - 0.01; |
869 | $LAST_REFRESH = time - 0.01; |
854 | |
870 | |
855 | CFClient::gl_init; |
871 | CFClient::gl_init; |
… | |
… | |
895 | } |
911 | } |
896 | }); |
912 | }); |
897 | $MAPWIDGET->show; |
913 | $MAPWIDGET->show; |
898 | $MAPWIDGET->focus_in; |
914 | $MAPWIDGET->focus_in; |
899 | |
915 | |
|
|
916 | $LOGVIEW = new CFClient::UI::TextView |
|
|
917 | expand => 1, |
|
|
918 | font => $FONT_FIXED, |
|
|
919 | fontsize => $::CFG->{log_fontsize}, |
|
|
920 | ; |
|
|
921 | |
900 | $BUTTONBAR = new CFClient::UI::HBox; |
922 | $BUTTONBAR = new CFClient::UI::HBox; |
901 | |
923 | |
902 | $BUTTONBAR->add (new CFClient::UI::Flopper text => "Client Setup", other => client_setup); |
924 | $BUTTONBAR->add (new CFClient::UI::Flopper text => "Client Setup", other => client_setup); |
903 | $BUTTONBAR->add (new CFClient::UI::Flopper text => "Server Setup", other => server_setup); |
925 | $BUTTONBAR->add (new CFClient::UI::Flopper text => "Server Setup", other => server_setup); |
904 | $BUTTONBAR->add (new CFClient::UI::Flopper text => "Message Window", other => message_window); |
926 | $BUTTONBAR->add (new CFClient::UI::Flopper text => "Message Window", other => message_window); |
… | |
… | |
935 | my $bgmusic;#TODO#hack#d# |
957 | my $bgmusic;#TODO#hack#d# |
936 | |
958 | |
937 | sub audio_channel_finished { |
959 | sub audio_channel_finished { |
938 | my ($channel) = @_; |
960 | my ($channel) = @_; |
939 | |
961 | |
940 | warn "channel $channel finished\n";#d# |
962 | #warn "channel $channel finished\n";#d# |
941 | } |
963 | } |
942 | |
964 | |
943 | sub audio_music_finished { |
965 | sub audio_music_finished { |
944 | return unless $CFG->{bgm_enable}; |
966 | return unless $CFG->{bgm_enable}; |
945 | |
967 | |
… | |
… | |
989 | my %animate_object; |
1011 | my %animate_object; |
990 | my $animate_timer; |
1012 | my $animate_timer; |
991 | |
1013 | |
992 | my $fps = 9; |
1014 | my $fps = 9; |
993 | |
1015 | |
|
|
1016 | my %demo;#d# |
|
|
1017 | |
994 | sub force_refresh { |
1018 | sub force_refresh { |
995 | $fps = $fps * 0.95 + 1 / (($NOW - $LAST_REFRESH) || 0.1) * 0.05; |
1019 | $fps = $fps * 0.95 + 1 / (($NOW - $LAST_REFRESH) || 0.1) * 0.05; |
996 | debug sprintf "%3.2f", $fps; |
1020 | debug sprintf "%3.2f", $fps; |
997 | |
1021 | |
998 | $CFClient::UI::ROOT->draw; |
1022 | $CFClient::UI::ROOT->draw; |
999 | CFClient::SDL_GL_SwapBuffers; |
|
|
1000 | |
1023 | |
1001 | $WANT_REFRESH = 0; |
1024 | $WANT_REFRESH = 0; |
1002 | $CAN_REFRESH = 0; |
1025 | $CAN_REFRESH = 0; |
1003 | $LAST_REFRESH = $NOW; |
1026 | $LAST_REFRESH = $NOW; |
|
|
1027 | |
|
|
1028 | 0 && do { |
|
|
1029 | # some weird model-drawing code, just a joke right now |
|
|
1030 | use CFClient::OpenGL; |
|
|
1031 | |
|
|
1032 | $demo{t}{eye_auv} ||= new_from_file CFClient::Texture "eye2.png" or die; |
|
|
1033 | $demo{t}{body_auv} ||= new_from_file CFClient::Texture "body_auv3.png" or die; |
|
|
1034 | $demo{r} ||= do { |
|
|
1035 | my $mod = Compress::LZF::sthaw do { local $/; open my $fh, "<:raw:perlio", "dread.lz3"; <$fh> }; |
|
|
1036 | $mod->{v} = pack "f*", @{$mod->{v}}; |
|
|
1037 | $_ = [scalar @$_, pack "S!*", @$_] |
|
|
1038 | for values %{$mod->{g}}; |
|
|
1039 | $mod |
|
|
1040 | }; |
|
|
1041 | |
|
|
1042 | my $r = $demo{r} or die; |
|
|
1043 | |
|
|
1044 | glDepthMask 1; |
|
|
1045 | glClear GL_DEPTH_BUFFER_BIT; |
|
|
1046 | glEnable GL_TEXTURE_2D; |
|
|
1047 | glEnable GL_DEPTH_TEST; |
|
|
1048 | glEnable GL_CULL_FACE; |
|
|
1049 | glShadeModel $::FAST ? GL_FLAT : GL_SMOOTH; |
|
|
1050 | |
|
|
1051 | glMatrixMode GL_PROJECTION; |
|
|
1052 | glLoadIdentity; |
|
|
1053 | glFrustum -1 * ($::WIDTH / $::HEIGHT), 1 * ($::WIDTH / $::HEIGHT), 1, -1, 1, 10000; |
|
|
1054 | #glOrtho 0, $::WIDTH, 0, $::HEIGHT, -10000, 10000; |
|
|
1055 | glMatrixMode GL_MODELVIEW; |
|
|
1056 | glLoadIdentity; |
|
|
1057 | |
|
|
1058 | glPushMatrix; |
|
|
1059 | glTranslate 0, 0, -800; |
|
|
1060 | glScale 1, -1, 1; |
|
|
1061 | glRotate $NOW * 1000 % 36000 / 5, 0, 1, 0; |
|
|
1062 | glRotate $NOW * 1000 % 36000 / 6, 1, 0, 0; |
|
|
1063 | glRotate $NOW * 1000 % 36000 / 7, 0, 0, 1; |
|
|
1064 | glScale 50, 50, 50; |
|
|
1065 | |
|
|
1066 | glInterleavedArrays GL_T2F_N3F_V3F, 0, $r->{v}; |
|
|
1067 | while (my ($k, $v) = each %{$r->{g}}) { |
|
|
1068 | glBindTexture GL_TEXTURE_2D, ($demo{t}{$k}{name} or die); |
|
|
1069 | glDrawElements GL_TRIANGLES, $v->[0], GL_UNSIGNED_SHORT, $v->[1]; |
|
|
1070 | } |
|
|
1071 | |
|
|
1072 | glPopMatrix; |
|
|
1073 | |
|
|
1074 | glShadeModel GL_FLAT; |
|
|
1075 | glDisable GL_DEPTH_TEST; |
|
|
1076 | glDisable GL_TEXTURE_2D; |
|
|
1077 | glDepthMask 0; |
|
|
1078 | |
|
|
1079 | $WANT_REFRESH++; |
|
|
1080 | }; |
|
|
1081 | |
|
|
1082 | CFClient::SDL_GL_SwapBuffers; |
1004 | } |
1083 | } |
1005 | |
1084 | |
1006 | my $refresh_watcher = Event->timer (after => 0, hard => 1, interval => 1 / $MAX_FPS, cb => sub { |
1085 | my $refresh_watcher = Event->timer (after => 0, hard => 1, interval => 1 / $MAX_FPS, cb => sub { |
1007 | $NOW = time; |
1086 | $NOW = time; |
1008 | |
1087 | |
… | |
… | |
1030 | my ($widget) = @_; |
1109 | my ($widget) = @_; |
1031 | delete $animate_object{$widget}; |
1110 | delete $animate_object{$widget}; |
1032 | } |
1111 | } |
1033 | |
1112 | |
1034 | @conn::ISA = Crossfire::Protocol::; |
1113 | @conn::ISA = Crossfire::Protocol::; |
|
|
1114 | |
|
|
1115 | sub conn::new { |
|
|
1116 | my $class = shift; |
|
|
1117 | |
|
|
1118 | my $self = $class->Crossfire::Protocol::new (@_); |
|
|
1119 | |
|
|
1120 | $MAPWIDGET->clr_commands; |
|
|
1121 | |
|
|
1122 | my $parser = new Pod::POM; |
|
|
1123 | my $pod = $parser->parse_file (CFClient::find_rcfile "pod/command_help.pod"); |
|
|
1124 | |
|
|
1125 | for my $head2 ($pod->head2) { |
|
|
1126 | $head2->title =~ /^(\S+) (?:\s+ \( ([^\)]*) \) )?/x |
|
|
1127 | or next; |
|
|
1128 | |
|
|
1129 | my $cmd = $1; |
|
|
1130 | my @args = split /\|/, $2; |
|
|
1131 | @args = (".*") unless @args; |
|
|
1132 | |
|
|
1133 | my $text = CFClient::pod_to_pango $head2->content; |
|
|
1134 | |
|
|
1135 | for my $arg (@args) { |
|
|
1136 | $arg = $arg eq ".*" ? "" : " $arg"; |
|
|
1137 | |
|
|
1138 | $MAPWIDGET->add_command ("$cmd$arg", $text); |
|
|
1139 | } |
|
|
1140 | } |
|
|
1141 | |
|
|
1142 | $self |
|
|
1143 | } |
1035 | |
1144 | |
1036 | sub conn::stats_update { |
1145 | sub conn::stats_update { |
1037 | my ($self, $stats) = @_; |
1146 | my ($self, $stats) = @_; |
1038 | |
1147 | |
1039 | if (my $exp = $stats->{Crossfire::Protocol::CS_STAT_EXP64}) { |
1148 | if (my $exp = $stats->{Crossfire::Protocol::CS_STAT_EXP64}) { |
… | |
… | |
1104 | $self->set_texture ($id => $data); |
1213 | $self->set_texture ($id => $data); |
1105 | } |
1214 | } |
1106 | } |
1215 | } |
1107 | } |
1216 | } |
1108 | |
1217 | |
|
|
1218 | # hardcode /world/world_xxx_xxx map names, the savings are enourmous, |
|
|
1219 | # (server resource,s latency, bandwidth), so this hack is warranted. |
|
|
1220 | # the right fix is to make real tiled maps with an overview file |
|
|
1221 | sub conn::send_mapinfo { |
|
|
1222 | my ($self, $data, $cb) = @_; |
|
|
1223 | |
|
|
1224 | if ($self->{map_info}[0] =~ m%^/world/world_(\d\d\d)_(\d\d\d)$%) { |
|
|
1225 | my ($wx, $wy) = ($1, $2); |
|
|
1226 | |
|
|
1227 | if ($data =~ /^spatial ([1-4]+)$/) { |
|
|
1228 | my @dx = (0, 0, 1, 0, -1); |
|
|
1229 | my @dy = (0, -1, 0, 1, 0); |
|
|
1230 | my ($dx, $dy); |
|
|
1231 | |
|
|
1232 | for (split //, $1) { |
|
|
1233 | $dx += $dx[$_]; |
|
|
1234 | $dy += $dy[$_]; |
|
|
1235 | } |
|
|
1236 | |
|
|
1237 | $cb->(spatial => 15, |
|
|
1238 | $self->{map_info}[1] - $MAP->ox + $dx * 50, |
|
|
1239 | $self->{map_info}[2] - $MAP->oy + $dy * 50, |
|
|
1240 | 50, 50, |
|
|
1241 | sprintf "/world/world_%03d_%03d", $wx + $dx, $wy + $dy |
|
|
1242 | ); |
|
|
1243 | |
|
|
1244 | return; |
|
|
1245 | } |
|
|
1246 | } |
|
|
1247 | |
|
|
1248 | $self->SUPER::send_mapinfo ($data, $cb); |
|
|
1249 | } |
|
|
1250 | |
1109 | # this method does a "flood fill" into every tile direction |
1251 | # this method does a "flood fill" into every tile direction |
1110 | # it assumes that tiles are arranged in a rectangular grid, |
1252 | # it assumes that tiles are arranged in a rectangular grid, |
1111 | # i.e. a map is the same as the left of the right map etc. |
1253 | # i.e. a map is the same as the left of the right map etc. |
1112 | # failure to comply are harmless and result in display errors |
1254 | # failure to comply are harmless and result in display errors |
1113 | # at worst. |
1255 | # at worst. |
1114 | sub conn::flood_fill { |
1256 | sub conn::flood_fill { |
1115 | my ($self, $gx, $gy, $path, $hash, $flags) = @_; |
1257 | my ($self, $block, $gx, $gy, $path, $hash, $flags) = @_; |
1116 | |
1258 | |
1117 | # the server does not allow map paths > 6 |
1259 | # the server does not allow map paths > 6 |
1118 | return if 7 <= length $path; |
1260 | return if 7 <= length $path; |
1119 | |
1261 | |
1120 | my ($x0, $y0, $x1, $y1) = @{$self->{neigh_rect}}; |
1262 | my ($x0, $y0, $x1, $y1) = @{$self->{neigh_rect}}; |
1121 | |
1263 | |
1122 | for ( |
1264 | for ( |
1123 | [1, 0, -1], |
1265 | [1, 3, 0, -1], |
1124 | [2, 1, 0], |
1266 | [2, 4, 1, 0], |
1125 | [3, 0, 1], |
1267 | [3, 1, 0, 1], |
1126 | [4, -1, 0], |
1268 | [4, 2, -1, 0], |
1127 | ) { |
1269 | ) { |
1128 | my ($tile, $dx, $dy) = @$_; |
1270 | my ($tile, $tile2, $dx, $dy) = @$_; |
|
|
1271 | |
|
|
1272 | next if $block & (1 << $tile); |
|
|
1273 | my $block = $block | (1 << $tile2); |
1129 | |
1274 | |
1130 | my $gx = $gx + $dx; |
1275 | my $gx = $gx + $dx; |
1131 | my $gy = $gy + $dy; |
1276 | my $gy = $gy + $dy; |
1132 | |
1277 | |
1133 | next unless $flags & (1 << ($tile - 1)); |
1278 | next unless $flags & (1 << ($tile - 1)); |
… | |
… | |
1135 | |
1280 | |
1136 | my $neigh = $self->{neigh_map}{$hash} ||= []; |
1281 | my $neigh = $self->{neigh_map}{$hash} ||= []; |
1137 | if (my $info = $neigh->[$tile]) { |
1282 | if (my $info = $neigh->[$tile]) { |
1138 | my ($flags, $x, $y, $w, $h, $hash) = @$info; |
1283 | my ($flags, $x, $y, $w, $h, $hash) = @$info; |
1139 | |
1284 | |
1140 | $self->flood_fill ($gx, $gy, "$path$tile", $hash, $flags) |
1285 | $self->flood_fill ($block, $gx, $gy, "$path$tile", $hash, $flags) |
1141 | if $x >= $x0 && $x + $w < $x1 && $y >= $y0 && $y + $h < $y1; |
1286 | if $x >= $x0 && $x + $w < $x1 && $y >= $y0 && $y + $h < $y1; |
1142 | |
1287 | |
1143 | } else { |
1288 | } else { |
1144 | $self->send_mapinfo ("spatial $path$tile", sub { |
1289 | $self->send_mapinfo ("spatial $path$tile", sub { |
1145 | my ($mode, $flags, $x, $y, $w, $h, $hash) = @_; |
1290 | my ($mode, $flags, $x, $y, $w, $h, $hash) = @_; |
1146 | |
1291 | |
1147 | return if $mode ne "spatial"; |
1292 | return if $mode ne "spatial"; |
1148 | |
1293 | |
1149 | $x += $MAP->ox; |
1294 | $x += $MAP->ox; |
1150 | $y += $MAP->oy; |
1295 | $y += $MAP->oy; |
1151 | |
1296 | |
1152 | $self->load_map ($hash, $x, $y) |
1297 | $self->load_map ($hash, $x, $y) |
1153 | unless $self->{neigh_map}{$hash}[5]++;#d# |
1298 | unless $self->{neigh_map}{$hash}[5]++;#d# |
1154 | |
1299 | |
1155 | $neigh->[$tile] = [$flags, $x, $y, $w, $h, $hash]; |
1300 | $neigh->[$tile] = [$flags, $x, $y, $w, $h, $hash]; |
1156 | |
1301 | |
1157 | $self->flood_fill ($gx, $gy, "$path$tile", $hash, $flags) |
1302 | $self->flood_fill ($block, $gx, $gy, "$path$tile", $hash, $flags) |
1158 | if $x >= $x0 && $x + $w < $x1 && $y >= $y0 && $y + $h < $y1; |
1303 | if $x >= $x0 && $x + $w < $x1 && $y >= $y0 && $y + $h < $y1; |
1159 | }); |
1304 | }); |
1160 | } |
1305 | } |
1161 | } |
1306 | } |
1162 | } |
1307 | } |
… | |
… | |
1175 | $ox - $mapmapw * 0.5, $oy - $mapmapw * 0.5, |
1320 | $ox - $mapmapw * 0.5, $oy - $mapmapw * 0.5, |
1176 | $ox + $mapmapw * 0.5 + $w, $oy + $mapmapw * 0.5 + $h, |
1321 | $ox + $mapmapw * 0.5 + $w, $oy + $mapmapw * 0.5 + $h, |
1177 | ]; |
1322 | ]; |
1178 | |
1323 | |
1179 | delete $self->{neigh_grid}; |
1324 | delete $self->{neigh_grid}; |
1180 | $self->flood_fill (0, 0, "", $hash, $flags); |
|
|
1181 | |
1325 | |
1182 | $x += $ox; |
1326 | $x += $ox; |
1183 | $y += $oy; |
1327 | $y += $oy; |
1184 | |
1328 | |
1185 | $self->{map_info} = [$hash, $x, $y, $w, $h]; |
1329 | $self->{map_info} = [$hash, $x, $y, $w, $h]; |
1186 | |
1330 | |
1187 | my $map = $self->{map_info}[0]; |
|
|
1188 | $map =~ s/^.*?\/([^\/]+)$/\1/; |
1331 | (my $map = $hash) =~ s/^.*?\/([^\/]+)$/\1/; |
1189 | $STATWIDS->{map}->set_text ("Map: " . $map); |
1332 | $STATWIDS->{map}->set_text ("Map: " . $map); |
1190 | |
1333 | |
1191 | $self->load_map ($hash, $x, $y); |
1334 | $self->load_map ($hash, $x, $y); |
|
|
1335 | $self->flood_fill (0, 0, 0, "", $hash, $flags); |
1192 | } |
1336 | } |
1193 | |
1337 | |
1194 | sub conn::face_find { |
1338 | sub conn::face_find { |
1195 | my ($self, $facenum, $face) = @_; |
1339 | my ($self, $facenum, $face) = @_; |
1196 | |
1340 | |
… | |
… | |
1385 | } |
1529 | } |
1386 | |
1530 | |
1387 | sub conn::addme_success { |
1531 | sub conn::addme_success { |
1388 | my ($self) = @_; |
1532 | my ($self) = @_; |
1389 | |
1533 | |
1390 | $MAPWIDGET->clr_commands; |
1534 | $self->send ("command output-sync $CFG->{output_sync}"); |
|
|
1535 | $self->send ("command output-count $CFG->{output_count}"); |
1391 | |
1536 | |
1392 | for my $skill (values %{$self->{skill_info}}) { |
1537 | for my $skill (values %{$self->{skill_info}}) { |
1393 | $MAPWIDGET->add_command ("ready_skill $skill", CFClient::UI::Label::escape "Ready the skill '$skill'"); |
1538 | $MAPWIDGET->add_command ("ready_skill $skill", CFClient::UI::Label::escape "Ready the skill '$skill'"); |
1394 | $MAPWIDGET->add_command ("use_skill $skill", CFClient::UI::Label::escape "Immediately use the skill '$skill'"); |
1539 | $MAPWIDGET->add_command ("use_skill $skill", CFClient::UI::Label::escape "Immediately use the skill '$skill'"); |
1395 | } |
|
|
1396 | |
|
|
1397 | $MAPWIDGET->add_command ("petmode defend", "Tell pets to stay close to you and defend you"); |
|
|
1398 | $MAPWIDGET->add_command ("petmode arena", "Same as petmode sad, but also attack other players"); |
|
|
1399 | $MAPWIDGET->add_command ("petmode sad", "Search & Destroy - tell pets to roam about and attack enemies"); |
|
|
1400 | $MAPWIDGET->add_command ("killpets", "Kill your pets"); |
|
|
1401 | $MAPWIDGET->add_command ("chat", "chat TEXT\nChat with all other players"); |
|
|
1402 | $MAPWIDGET->add_command ("shout", "shout TEXT\nShout loudly, used for emergencies"); |
|
|
1403 | $MAPWIDGET->add_command ("tell", "tell USERNAME TEXT\nPrivately tell a specific player"); |
|
|
1404 | |
|
|
1405 | my $parser = new Pod::POM; |
|
|
1406 | my $pod = $parser->parse_file (CFClient::find_rcfile "pod/command_help.pod"); |
|
|
1407 | |
|
|
1408 | for my $head2 ($pod->head2) { |
|
|
1409 | $head2->title =~ /^(\S+) (?:\s+ \( ([^\)]*) \) )?/x |
|
|
1410 | or next; |
|
|
1411 | |
|
|
1412 | my $cmd = $1; |
|
|
1413 | my @args = split /\|/, $2; |
|
|
1414 | @args = (".*") unless @args; |
|
|
1415 | |
|
|
1416 | my $text = CFClient::pod_to_pango $head2; |
|
|
1417 | |
|
|
1418 | for my $arg (@args) { |
|
|
1419 | $arg = $arg eq ".*" ? "" : " $arg"; |
|
|
1420 | |
|
|
1421 | $MAPWIDGET->add_command ("$cmd$arg", $text); |
|
|
1422 | } |
|
|
1423 | } |
1540 | } |
1424 | } |
1541 | } |
1425 | |
1542 | |
1426 | sub conn::eof { |
1543 | sub conn::eof { |
1427 | $MAPWIDGET->clr_commands; |
1544 | $MAPWIDGET->clr_commands; |
… | |
… | |
1592 | sdl_mode => 0, |
1709 | sdl_mode => 0, |
1593 | width => 640, |
1710 | width => 640, |
1594 | height => 480, |
1711 | height => 480, |
1595 | fullscreen => 0, |
1712 | fullscreen => 0, |
1596 | fast => 0, |
1713 | fast => 0, |
1597 | map_scale => 0.5, |
1714 | map_scale => 1, |
1598 | fow_enable => 1, |
1715 | fow_enable => 1, |
1599 | fow_intensity => 0.45, |
1716 | fow_intensity => 0.45, |
1600 | fow_smooth => 0, |
1717 | fow_smooth => 0, |
1601 | gui_fontsize => 1, |
1718 | gui_fontsize => 1, |
1602 | log_fontsize => 1, |
1719 | log_fontsize => 1, |
… | |
… | |
1607 | host => "crossfire.schmorp.de", |
1724 | host => "crossfire.schmorp.de", |
1608 | say_command => 'say', |
1725 | say_command => 'say', |
1609 | audio_enable => 1, |
1726 | audio_enable => 1, |
1610 | bgm_enable => 1, |
1727 | bgm_enable => 1, |
1611 | bgm_volume => 0.25, |
1728 | bgm_volume => 0.25, |
|
|
1729 | output_sync => 1, |
|
|
1730 | output_count => 1, |
1612 | ); |
1731 | ); |
1613 | |
1732 | |
1614 | while (my ($k, $v) = each %DEF_CFG) { |
1733 | while (my ($k, $v) = each %DEF_CFG) { |
1615 | $CFG->{$k} = $v unless exists $CFG->{$k}; |
1734 | $CFG->{$k} = $v unless exists $CFG->{$k}; |
1616 | } |
1735 | } |
… | |
… | |
1721 | |
1840 | |
1722 | Typing B<climb> will display a list of commands with I<climb> in their |
1841 | Typing B<climb> will display a list of commands with I<climb> in their |
1723 | name, such as I<ready_skill climbing> and I<use_skill climbing>. |
1842 | name, such as I<ready_skill climbing> and I<use_skill climbing>. |
1724 | |
1843 | |
1725 | You can abbreviate commands by typing only the first character of every |
1844 | You can abbreviate commands by typing only the first character of every |
1726 | word. For example, typing I<iwor> will likely select I<invoke word of |
1845 | word (or even characters within the word - the client will try to make |
1727 | recall>, while I<ccfo> will select I<cast create food>. Likewise, I<rscli> |
1846 | a good guess, as long as the characters are in order). For example, |
1728 | will likely select I<ready_skill climbing> and I<usl> will give you |
1847 | typing I<iwor> will likely select I<invoke word of recall>, while I<ccfo> |
1729 | I<use_skill levitation>. |
1848 | will select I<cast create food>. Likewise, I<rscli> will likely select |
|
|
1849 | I<ready_skill climbing> and I<usl> will give you I<use_skill levitation>. |
|
|
1850 | |
|
|
1851 | You can enter space and other text as arguemnt to the command. For |
|
|
1852 | example, C<cfoo waybread> will expand to C<cast create food waybread>. |
1730 | |
1853 | |
1731 | =head2 The map overview |
1854 | =head2 The map overview |
1732 | |
1855 | |
1733 | #TODO# |
1856 | #TODO# |
1734 | |
1857 | |