… | |
… | |
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; |
… | |
… | |
786 | bg => [0, 0, 0, 0.5], |
786 | bg => [0, 0, 0, 0.5], |
787 | user_w => int $::WIDTH / 3, |
787 | user_w => int $::WIDTH / 3, |
788 | user_h => int $::HEIGHT / 5, |
788 | user_h => int $::HEIGHT / 5, |
789 | child => (my $vbox = new CFClient::UI::VBox); |
789 | child => (my $vbox = new CFClient::UI::VBox); |
790 | |
790 | |
791 | $vbox->add ($LOGVIEW = new CFClient::UI::TextView |
791 | $vbox->add ($LOGVIEW); |
792 | expand => 1, |
|
|
793 | font => $FONT_FIXED, |
|
|
794 | fontsize => $::CFG->{log_fontsize}, |
|
|
795 | ); |
|
|
796 | |
792 | |
797 | $vbox->add (my $input = new CFClient::UI::Entry |
793 | $vbox->add (my $input = new CFClient::UI::Entry |
798 | connect_focus_in => sub { |
794 | connect_focus_in => sub { |
799 | my ($input, $prev_focus) = @_; |
795 | my ($input, $prev_focus) = @_; |
800 | |
796 | |
… | |
… | |
835 | |
831 | |
836 | sub make_inventory_window { |
832 | sub make_inventory_window { |
837 | my $invwin = new CFClient::UI::FancyFrame |
833 | my $invwin = new CFClient::UI::FancyFrame |
838 | 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"; |
839 | |
835 | |
840 | $invwin->add (my $hb = new CFClient::UI::HBox); |
836 | $invwin->add (my $hb = new CFClient::UI::HBox expand => 1); |
841 | |
837 | |
842 | $hb->add (my $vb1 = new CFClient::UI::VBox expand => 1); |
838 | $hb->add (my $vb1 = new CFClient::UI::VBox expand => 1); |
843 | $vb1->add (my $lbl = new CFClient::UI::Label); |
839 | $vb1->add (my $lbl = new CFClient::UI::Label); |
844 | $lbl->set_text ("Player"); |
840 | $lbl->set_text ("Player"); |
845 | $vb1->add ($INV = new CFClient::UI::Inventory expand => 1); |
841 | $vb1->add ($INV = new CFClient::UI::Inventory expand => 1); |
… | |
… | |
865 | ($WIDTH, $HEIGHT) = @{ $SDL_MODES[$CFG->{sdl_mode}] }; |
861 | ($WIDTH, $HEIGHT) = @{ $SDL_MODES[$CFG->{sdl_mode}] }; |
866 | $FULLSCREEN = $CFG->{fullscreen}; |
862 | $FULLSCREEN = $CFG->{fullscreen}; |
867 | $FAST = $CFG->{fast}; |
863 | $FAST = $CFG->{fast}; |
868 | |
864 | |
869 | CFClient::SDL_SetVideoMode $WIDTH, $HEIGHT, $FULLSCREEN |
865 | CFClient::SDL_SetVideoMode $WIDTH, $HEIGHT, $FULLSCREEN |
870 | or die "SDL_SetVideoMode failed!\n"; |
866 | or die "SDL_SetVideoMode failed: " . (CFClient::SDL_GetError) . "\n"; |
871 | |
867 | |
872 | $SDL_ACTIVE = 1; |
868 | $SDL_ACTIVE = 1; |
873 | $LAST_REFRESH = time - 0.01; |
869 | $LAST_REFRESH = time - 0.01; |
874 | |
870 | |
875 | CFClient::gl_init; |
871 | CFClient::gl_init; |
… | |
… | |
914 | } |
910 | } |
915 | } |
911 | } |
916 | }); |
912 | }); |
917 | $MAPWIDGET->show; |
913 | $MAPWIDGET->show; |
918 | $MAPWIDGET->focus_in; |
914 | $MAPWIDGET->focus_in; |
|
|
915 | |
|
|
916 | $LOGVIEW = new CFClient::UI::TextView |
|
|
917 | expand => 1, |
|
|
918 | font => $FONT_FIXED, |
|
|
919 | fontsize => $::CFG->{log_fontsize}, |
|
|
920 | ; |
919 | |
921 | |
920 | $BUTTONBAR = new CFClient::UI::HBox; |
922 | $BUTTONBAR = new CFClient::UI::HBox; |
921 | |
923 | |
922 | $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); |
923 | $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); |
… | |
… | |
1009 | my %animate_object; |
1011 | my %animate_object; |
1010 | my $animate_timer; |
1012 | my $animate_timer; |
1011 | |
1013 | |
1012 | my $fps = 9; |
1014 | my $fps = 9; |
1013 | |
1015 | |
|
|
1016 | my %demo;#d# |
|
|
1017 | |
1014 | sub force_refresh { |
1018 | sub force_refresh { |
1015 | $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; |
1016 | debug sprintf "%3.2f", $fps; |
1020 | debug sprintf "%3.2f", $fps; |
1017 | |
1021 | |
1018 | $CFClient::UI::ROOT->draw; |
1022 | $CFClient::UI::ROOT->draw; |
1019 | CFClient::SDL_GL_SwapBuffers; |
|
|
1020 | |
1023 | |
1021 | $WANT_REFRESH = 0; |
1024 | $WANT_REFRESH = 0; |
1022 | $CAN_REFRESH = 0; |
1025 | $CAN_REFRESH = 0; |
1023 | $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 | glDisable GL_CULL_FACE; |
|
|
1049 | glShadeModel $::FAST ? GL_FLAT : GL_SMOOTH; |
|
|
1050 | |
|
|
1051 | glMatrixMode GL_PROJECTION; |
|
|
1052 | glLoadIdentity; |
|
|
1053 | #glFrustum -100, 100, 100, -100, 1, 1000; |
|
|
1054 | glOrtho 0, $::WIDTH, 0, $::HEIGHT, -10000, 10000; |
|
|
1055 | glMatrixMode GL_MODELVIEW; |
|
|
1056 | glLoadIdentity; |
|
|
1057 | |
|
|
1058 | glPushMatrix; |
|
|
1059 | glTranslate $::WIDTH * 0.5, $::HEIGHT * 0.5, -100; |
|
|
1060 | glRotate $NOW * 1000 % 36000 / 20, 0, 1, 0; |
|
|
1061 | glScale 50, 50, 50; |
|
|
1062 | |
|
|
1063 | glInterleavedArrays GL_T2F_N3F_V3F, 0, $r->{v}; |
|
|
1064 | while (my ($k, $v) = each %{$r->{g}}) { |
|
|
1065 | glBindTexture GL_TEXTURE_2D, ($demo{t}{$k}{name} or die); |
|
|
1066 | glDrawElements GL_TRIANGLES, $v->[0], GL_UNSIGNED_SHORT, $v->[1]; |
|
|
1067 | } |
|
|
1068 | |
|
|
1069 | glPopMatrix; |
|
|
1070 | |
|
|
1071 | glShadeModel GL_FLAT; |
|
|
1072 | glDisable GL_DEPTH_TEST; |
|
|
1073 | glDisable GL_TEXTURE_2D; |
|
|
1074 | glDepthMask 0; |
|
|
1075 | |
|
|
1076 | $WANT_REFRESH++; |
|
|
1077 | }; |
|
|
1078 | |
|
|
1079 | CFClient::SDL_GL_SwapBuffers; |
1024 | } |
1080 | } |
1025 | |
1081 | |
1026 | my $refresh_watcher = Event->timer (after => 0, hard => 1, interval => 1 / $MAX_FPS, cb => sub { |
1082 | my $refresh_watcher = Event->timer (after => 0, hard => 1, interval => 1 / $MAX_FPS, cb => sub { |
1027 | $NOW = time; |
1083 | $NOW = time; |
1028 | |
1084 | |
… | |
… | |
1615 | sdl_mode => 0, |
1671 | sdl_mode => 0, |
1616 | width => 640, |
1672 | width => 640, |
1617 | height => 480, |
1673 | height => 480, |
1618 | fullscreen => 0, |
1674 | fullscreen => 0, |
1619 | fast => 0, |
1675 | fast => 0, |
1620 | map_scale => 0.5, |
1676 | map_scale => 1, |
1621 | fow_enable => 1, |
1677 | fow_enable => 1, |
1622 | fow_intensity => 0.45, |
1678 | fow_intensity => 0.45, |
1623 | fow_smooth => 0, |
1679 | fow_smooth => 0, |
1624 | gui_fontsize => 1, |
1680 | gui_fontsize => 1, |
1625 | log_fontsize => 1, |
1681 | log_fontsize => 1, |
… | |
… | |
1746 | |
1802 | |
1747 | Typing B<climb> will display a list of commands with I<climb> in their |
1803 | Typing B<climb> will display a list of commands with I<climb> in their |
1748 | name, such as I<ready_skill climbing> and I<use_skill climbing>. |
1804 | name, such as I<ready_skill climbing> and I<use_skill climbing>. |
1749 | |
1805 | |
1750 | You can abbreviate commands by typing only the first character of every |
1806 | You can abbreviate commands by typing only the first character of every |
1751 | word. For example, typing I<iwor> will likely select I<invoke word of |
1807 | word (or even characters within the word - the client will try to make |
1752 | recall>, while I<ccfo> will select I<cast create food>. Likewise, I<rscli> |
1808 | a good guess, as long as the characters are in order). For example, |
1753 | will likely select I<ready_skill climbing> and I<usl> will give you |
1809 | typing I<iwor> will likely select I<invoke word of recall>, while I<ccfo> |
1754 | I<use_skill levitation>. |
1810 | will select I<cast create food>. Likewise, I<rscli> will likely select |
|
|
1811 | I<ready_skill climbing> and I<usl> will give you I<use_skill levitation>. |
|
|
1812 | |
|
|
1813 | You can enter space and other text as arguemnt to the command. For |
|
|
1814 | example, C<cfoo waybread> will expand to C<cast create food waybread>. |
1755 | |
1815 | |
1756 | =head2 The map overview |
1816 | =head2 The map overview |
1757 | |
1817 | |
1758 | #TODO# |
1818 | #TODO# |
1759 | |
1819 | |