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.95 by root, Sun Jul 16 23:30:08 2006 UTC vs.
Revision 1.101 by elmex, Sun Jul 23 17:03:44 2006 UTC

36 36
37use CFClient; 37use CFClient;
38use CFClient::OpenGL (); 38use CFClient::OpenGL ();
39use CFClient::Protocol; 39use CFClient::Protocol;
40use CFClient::UI; 40use CFClient::UI;
41use CFClient::Pod;
41use CFClient::BindingEditor; 42use CFClient::BindingEditor;
42use CFClient::MapWidget; 43use CFClient::MapWidget;
43 44
44$SIG{QUIT} = sub { Carp::cluck "QUIT" }; 45$SIG{QUIT} = sub { Carp::cluck "QUIT" };
45$SIG{PIPE} = 'IGNORE'; 46$SIG{PIPE} = 'IGNORE';
130our $BIND_UPD_CB; 131our $BIND_UPD_CB;
131 132
132our $PICKUP_CFG; 133our $PICKUP_CFG;
133 134
134sub status { 135sub status {
135 $STATUSBOX->add (CFClient::UI::Label::escape $_[0], pri => -10, group => "status", timeout => 10, fg => [1, 1, 0, 1]); 136 $STATUSBOX->add (CFClient::asxml $_[0], pri => -10, group => "status", timeout => 10, fg => [1, 1, 0, 1]);
136} 137}
137 138
138sub debug { 139sub debug {
139 $DEBUG_STATUS->set_text ($_[0]); 140 $DEBUG_STATUS->set_text ($_[0]);
140} 141}
189 $MESSAGE_WINDOW->show; 190 $MESSAGE_WINDOW->show;
190 191
191 unshift @dialog, new CFClient::UI::Label 192 unshift @dialog, new CFClient::UI::Label
192 max_w => $::WIDTH * 0.4, 193 max_w => $::WIDTH * 0.4,
193 ellipsise => 0, 194 ellipsise => 0,
194 markup => "\nOr use your keyboard:\n"; 195 markup => "\nOr use your keyboard and the text entry below:\n";
195 196
196 unshift @dialog, my $table = new CFClient::UI::Table; 197 unshift @dialog, my $table = new CFClient::UI::Table;
197 198
198 $table->add (0, 0, new CFClient::UI::Button 199 $table->add (0, 0, new CFClient::UI::Button
199 text => "Next Race", 200 text => "Next Race",
216 max_w => $::WIDTH * 0.4, 217 max_w => $::WIDTH * 0.4,
217 ellipsise => 0, 218 ellipsise => 0,
218 markup => 219 markup =>
219 "<big><b>Character Creation: Race</b></big>\n\n" 220 "<big><b>Character Creation: Race</b></big>\n\n"
220 . "Look at the <b>Messages</b> window to see a description of this race " 221 . "Look at the <b>Messages</b> window to see a description of this race "
221 . "(<small>or hover with your mouse over the bottommost entry in the status area in the lower left area of the screen</small>) "
222 . "and the center of the screen to see how this race looks like " 222 . "and the center of the screen to see how this race looks like "
223 . "(<small>this is below this dialog window, you may need to click on the display area to make it visible</small>).\n\n" 223 . "(<small>below this dialog window: you may need to move the dialog away and "
224 . "click into the display area to make it visible</small>).\n\n"
224 . "You can look at another race, or accept this race (you will come back to this race eventually, " 225 . "You can look at another race, or accept this race (you will cycle back to "
225 . "so you can take your time making this important choice." 226 . "this race eventually, so you can take your time making this important choice."
226 ; 227 ;
227 228
228 } elsif ($prompt =~ /roll new stats/) { 229 } elsif ($prompt =~ /roll new stats/) {
229 if (my $stat = delete $conn->{stat_change_with}) { 230 if (my $stat = delete $conn->{stat_change_with}) {
230 $conn->send ("reply $stat"); 231 $conn->send ("reply $stat");
236 $MESSAGE_WINDOW->hide; 237 $MESSAGE_WINDOW->hide;
237 238
238 unshift @dialog, new CFClient::UI::Label 239 unshift @dialog, new CFClient::UI::Label
239 max_w => $::WIDTH * 0.4, 240 max_w => $::WIDTH * 0.4,
240 ellipsise => 0, 241 ellipsise => 0,
241 markup => "\nOr use your keyboard:\n"; 242 markup => "\nOr use your keyboard and the text entry below:\n";
242 243
243 unshift @dialog, my $table = new CFClient::UI::Table; 244 unshift @dialog, my $table = new CFClient::UI::Table;
244 245
245 # left: re-roll 246 # left: re-roll
246 $table->add (0, 0, new CFClient::UI::Button 247 $table->add (0, 0, new CFClient::UI::Button
252 }, 253 },
253 ); 254 );
254 255
255 # center: swap stats 256 # center: swap stats
256 my ($sw1, $sw2) = map +(new CFClient::UI::Combobox 257 my ($sw1, $sw2) = map +(new CFClient::UI::Combobox
258 expand => 1,
257 value => $_, 259 value => $_,
258 options => [ 260 options => [
259 [1 => "Str", "Strength ($conn->{stat}{+CS_STAT_STR})"], 261 [1 => "Str", "Strength ($conn->{stat}{+CS_STAT_STR})"],
260 [2 => "Dex", "Dexterity ($conn->{stat}{+CS_STAT_DEX})"], 262 [2 => "Dex", "Dexterity ($conn->{stat}{+CS_STAT_DEX})"],
261 [3 => "Con", "Constitution ($conn->{stat}{+CS_STAT_CON})"], 263 [3 => "Con", "Constitution ($conn->{stat}{+CS_STAT_CON})"],
286 destroy_query_dialog $conn; 288 destroy_query_dialog $conn;
287 0 289 0
288 }, 290 },
289 ); 291 );
290 292
293 unshift @dialog, my $hbox = new CFClient::UI::HBox;
294 for (
295 [Str => CS_STAT_STR],
296 [Dex => CS_STAT_DEX],
297 [Con => CS_STAT_CON],
298 [Int => CS_STAT_INT],
299 [Wis => CS_STAT_WIS],
300 [Pow => CS_STAT_POW],
301 [Cha => CS_STAT_CHA],
302 ) {
303 my ($name, $id) = @$_;
304 $hbox->add (new CFClient::UI::Label
305 markup => "$conn->{stat}{$id} <span foreground='yellow'>$name</span>",
306 align => 0,
307 expand => 1,
308 can_events => 1,
309 can_hover => 1,
310 tooltip => $CFClient::STAT_TOOLTIP{$name},
311 );
312 }
313
291 unshift @dialog, new CFClient::UI::Label 314 unshift @dialog, new CFClient::UI::Label
292 max_w => $::WIDTH * 0.4, 315 max_w => $::WIDTH * 0.4,
293 ellipsise => 0, 316 ellipsise => 0,
294 markup => 317 markup =>
295 "<big><b>Character Creation: Stats</b></big>\n\n" 318 "<big><b>Character Creation: Stats</b></big>\n\n"
296 . "Look at the <b>Stats</b> window to see your basic stats " 319 . "<b>Stats</b> are a very important aspect of your character. You can use the tooltips to learn what each Stat governs.\n\n"
297 . "(first column: 1 strength, 2 dexterity, 3 constitution, 4 intelligence, 5 wisdom, 6 power and 7 charisma).\n\n" 320 . "The stats generated by the server are always sorted from Str (highest) to Cha (lowest). "
321 . "They will be modified later by both the race and the class you choose.\n\n"
298 . "You can create another set of stats, swap two stat values with each other or accept the stats as they are now and continue. " 322 . "You can create another set of stats, swap two stat values with each other or accept the stats as shown below and continue.\n"
299 . "Race selection will influence those values later on."
300 ; 323 ;
301 } 324 }
302 325
303 push @dialog, my $entry = new CFClient::UI::Entry 326 push @dialog, my $entry = new CFClient::UI::Entry
304 on_changed => sub { 327 on_changed => sub {
644 667
645 $table 668 $table
646} 669}
647 670
648sub stats_window { 671sub stats_window {
672 my $r = new CFClient::UI::ScrolledWindow (
673 expand => 1,
674 scroll_y => 1
675 );
649 my $vb = new CFClient::UI::VBox; 676 $r->add (my $vb = new CFClient::UI::VBox);
650 677
651 $vb->add ($STATWIDS->{title} = new CFClient::UI::Label valign => 0, align => -1, text => "Title:", expand => 1, 678 $vb->add ($STATWIDS->{title} = new CFClient::UI::Label valign => 0, align => -1, text => "Title:", expand => 1,
652 can_hover => 1, can_events => 1, 679 can_hover => 1, can_events => 1,
653 tooltip => "Your name and title. You can change your title by using the <b>title</b> command, if supported by the server."); 680 tooltip => "Your name and title. You can change your title by using the <b>title</b> command, if supported by the server.");
654 $vb->add ($STATWIDS->{map} = new CFClient::UI::Label valign => 0, align => -1, text => "Map:", expand => 1, 681 $vb->add ($STATWIDS->{map} = new CFClient::UI::Label valign => 0, align => -1, text => "Map:", expand => 1,
668 $hb->add (my $tbl = new CFClient::UI::Table expand => 1); 695 $hb->add (my $tbl = new CFClient::UI::Table expand => 1);
669 696
670 my $color2 = [1, 1, 0]; 697 my $color2 = [1, 1, 0];
671 698
672 for ( 699 for (
673 [0, 0, st_str => "Str", 30, "<b>Physical Strength</b>, determines damage dealt with weapons, how much you can carry, and how often you can attack"], 700 [0, 0, st_str => "Str", 30],
674 [0, 1, st_dex => "Dex", 30, "<b>Dexterity</b>, your physical agility. Determines chance of being hit and affects armor class and speed"], 701 [0, 1, st_dex => "Dex", 30],
675 [0, 2, st_con => "Con", 30, "<b>Constitution</b>, physical health and toughness. Determines how many healthpoints you can have"], 702 [0, 2, st_con => "Con", 30],
676 [0, 3, st_int => "Int", 30, "<b>Intelligence</b>, your ability to learn and use skills and incantations (both prayers and magic) and determines how much spell points you can have"], 703 [0, 3, st_int => "Int", 30],
677 [0, 4, st_wis => "Wis", 30, "<b>Wisdom</b>, the ability to learn and use divine magic (prayers). Determines how many grace points you can have"], 704 [0, 4, st_wis => "Wis", 30],
678 [0, 5, st_pow => "Pow", 30, "<b>Power</b>, your magical potential. Influences the strength of spell effects, and also how much your spell and grace points increase when leveling up"], 705 [0, 5, st_pow => "Pow", 30],
679 [0, 6, st_cha => "Cha", 30, "<b>Charisma</b>, how well you are received by NPCs. Affects buying and selling prices in shops."], 706 [0, 6, st_cha => "Cha", 30],
680 707
681 [2, 0, st_wc => "Wc", -120, "<b>Weapon Class</b>, effectiveness of melee/missile attacks. Lower is more potent. Current weapon, level and Str are some things which effect the value of Wc. The value of Wc may range between 25 and -72."], 708 [2, 0, st_wc => "Wc", -120],
682 [2, 1, st_ac => "Ac", -120, "<b>Armour Class</b>, how protected you are from being hit by any attack. Lower values are better. Ac is based on your race and is modified by the Dex and current armour worn. For characters that cannot wear armour, Ac improves as their level increases."], 709 [2, 1, st_ac => "Ac", -120],
683 [2, 2, st_dam => "Dam", 120, "<b>Damage</b>, how much damage your melee/missile attack inflicts. Higher values indicate a greater amount of damage will be inflicted with each attack."], 710 [2, 2, st_dam => "Dam", 120],
684 [2, 3, st_arm => "Arm", 120, "<b>Armour</b>, how much damage (from physical attacks) will be subtracted from successful hits made upon you. This value ranges between 0 to 99%. Current armour worn primarily determines Arm value. This is the same as the physical resistance."], 711 [2, 3, st_arm => "Arm", 120],
685 [2, 4, st_spd => "Spd", 10.54, "<b>Speed</b>, how fast you can move. The value of speed may range between nearly 0 (\"very slow\") to higher than 5 (\"lightning fast\"). Base speed is determined from the Dex and modified downward proportionally by the amount of weight carried which exceeds the Max Carry limit. The armour worn also sets the upper limit on speed."], 712 [2, 4, st_spd => "Spd", 10.54],
686 [2, 5, st_wspd => "WSp", 10.54, "<b>Weapon Speed</b>, how many attacks you may make per unit of time (0.120s). Higher values indicate faster attack speed. Current weapon and Dex effect the value of weapon speed."], 713 [2, 5, st_wspd => "WSp", 10.54],
687 ) { 714 ) {
688 my ($col, $row, $id, $label, $template, $tooltip) = @$_; 715 my ($col, $row, $id, $label, $template) = @$_;
689 716
690 $tbl->add ($col , $row, $STATWIDS->{$id} = new CFClient::UI::Label 717 $tbl->add ($col , $row, $STATWIDS->{$id} = new CFClient::UI::Label
691 font => $FONT_FIXED, can_hover => 1, can_events => 1, valign => 0, align => +1, template => $template, tooltip => $tooltip); 718 font => $FONT_FIXED, can_hover => 1, can_events => 1, valign => 0,
719 align => +1, template => $template, tooltip => $CFClient::STAT_TOOLTIP{$label});
692 $tbl->add ($col + 1, $row, $STATWIDS->{"$id\_lbl"} = new CFClient::UI::Label 720 $tbl->add ($col + 1, $row, $STATWIDS->{"$id\_lbl"} = new CFClient::UI::Label
693 font => $FONT_FIXED, can_hover => 1, can_events => 1, fg => $color2, valign => 0, align => -1, text => $label, tooltip => $tooltip); 721 font => $FONT_FIXED, can_hover => 1, can_events => 1, fg => $color2, valign => 0,
722 align => -1, text => $label, tooltip => $CFClient::STAT_TOOLTIP{$label});
694 } 723 }
695 724
696 $vb->add (my $tbl2 = new CFClient::UI::Table expand => 1); 725 $vb->add (my $tbl2 = new CFClient::UI::Table expand => 1);
697 726
698 my $row = 0; 727 my $row = 0;
773 } 802 }
774 } 803 }
775 804
776 #update_stats_window ({}); 805 #update_stats_window ({});
777 806
778 $vb 807 $r
779} 808}
780 809
781sub skill_window { 810sub skill_window {
811 my $sw = new CFClient::UI::ScrolledWindow (expand => 1);
782 $STATWIDS->{skill_tbl} = new CFClient::UI::Table expand => 1, col_expand => [0, 0, 1, 0, 0, 1] 812 $sw->add ($STATWIDS->{skill_tbl} = new CFClient::UI::Table expand => 1, col_expand => [0, 0, 1, 0, 0, 1]);
813 $sw
783} 814}
784 815
785sub formsep($) { 816sub formsep($) {
786 scalar reverse join ",", unpack "(A3)*", reverse $_[0] * 1 817 scalar reverse join ",", unpack "(A3)*", reverse $_[0] * 1
787} 818}
1102 $QUIT_DIALOG = new CFClient::UI::FancyFrame 1133 $QUIT_DIALOG = new CFClient::UI::FancyFrame
1103 x => "center", 1134 x => "center",
1104 y => "center", 1135 y => "center",
1105 z => 50, 1136 z => 50,
1106 title => "Really Quit?", 1137 title => "Really Quit?",
1138 on_key_down => sub {
1139 my ($dialog, $ev) = @_;
1140 $ev->{sym} == 27 and $dialog->hide;
1141 }
1107 ; 1142 ;
1108 1143
1109 $QUIT_DIALOG->add (my $vb = new CFClient::UI::VBox expand => 1); 1144 $QUIT_DIALOG->add (my $vb = new CFClient::UI::VBox expand => 1);
1110 1145
1111 $vb->add (new CFClient::UI::Label 1146 $vb->add (new CFClient::UI::Label
1125 on_activate => sub { exit }, 1160 on_activate => sub { exit },
1126 ); 1161 );
1127 } 1162 }
1128 1163
1129 $QUIT_DIALOG->show; 1164 $QUIT_DIALOG->show;
1165 $QUIT_DIALOG->grab_focus;
1130} 1166}
1131 1167
1132sub autopickup_setup { 1168sub autopickup_setup {
1133 my $table = new CFClient::UI::Table; 1169 my $table = new CFClient::UI::Table;
1134 1170
1229sub inventory_widget { 1265sub inventory_widget {
1230 my $hb = new CFClient::UI::HBox homogeneous => 1; 1266 my $hb = new CFClient::UI::HBox homogeneous => 1;
1231 1267
1232 $hb->add (my $vb1 = new CFClient::UI::VBox); 1268 $hb->add (my $vb1 = new CFClient::UI::VBox);
1233 $vb1->add (new CFClient::UI::Label align => 0, text => "Player"); 1269 $vb1->add (new CFClient::UI::Label align => 0, text => "Player");
1270
1271 $vb1->add (my $hb1 = new CFClient::UI::HBox);
1272
1273 use sort 'stable';
1274
1275 $hb1->add (new CFClient::UI::Combobox
1276 value => undef,
1277 options => [
1278 [undef, "Type/Name"],
1279 [
1280 sub { sort {
1281 $a->{weight} * ($a->{nrof} || 1) <=> $b->{weight} * ($b->{nrof} || 1)
1282 or $a->{type} <=> $b->{type}
1283 } @_ },
1284 "Weight/Type",
1285 ],
1286 [sub { } => "#TODO#"],
1287 ],
1288 on_changed => sub {
1289 $INV->set_sort_order ($_[1]);
1290 },
1291 );
1292 $hb1->add (new CFClient::UI::Label text => "Weight: ", align => 1, expand => 1);
1293 #TODO# update to weigh/maxweight
1294 $hb1->add ($STATWIDS->{i_weight} = new CFClient::UI::Label align => -1);
1295
1296 $vb1->add (my $sw1 = new CFClient::UI::ScrolledWindow expand => 1, scroll_y => 1);
1234 $vb1->add ($INV = new CFClient::UI::Inventory); 1297 $sw1->add ($INV = new CFClient::UI::Inventory);
1235 1298
1236 $hb->add (my $vb2 = new CFClient::UI::VBox); 1299 $hb->add (my $vb2 = new CFClient::UI::VBox);
1237 1300
1238 $vb2->add ($INV_RIGHT_HB = new CFClient::UI::HBox); 1301 $vb2->add ($INV_RIGHT_HB = new CFClient::UI::HBox);
1239 1302
1303 $vb2->add (my $sw2 = new CFClient::UI::ScrolledWindow expand => 1, scroll_y => 1);
1240 $vb2->add ($INVR = new CFClient::UI::Inventory); 1304 $sw2->add ($INVR = new CFClient::UI::Inventory);
1241 1305
1242 # XXX: Call after $INVR = ... because set_opencont sets the items 1306 # XXX: Call after $INVR = ... because set_opencont sets the items
1243 CFClient::Protocol::set_opencont ($::CONN, 0, "Floor"); 1307 CFClient::Protocol::set_opencont ($::CONN, 0, "Floor");
1244 1308
1245 $hb 1309 $hb
1267 has_close_button => 1 1331 has_close_button => 1
1268 ; 1332 ;
1269 1333
1270 my $ntb = 1334 my $ntb =
1271 $PL_NOTEBOOK = 1335 $PL_NOTEBOOK =
1272 new CFClient::UI::Notebook 1336 new CFClient::UI::Notebook expand => 1, debug => 1;
1273 expand => 1,
1274 debug => 1,
1275 filter => (new CFClient::UI::ScrolledWindow expand => 1, scroll_y => 1),
1276 ;
1277 1337
1278 $ntb->add ( 1338 $ntb->add (
1279 "Statistics (F2)" => $STATS_PAGE = stats_window, 1339 "Statistics (F2)" => $STATS_PAGE = stats_window,
1280 "Shows statistics, where all your Stats and Resistances are shown." 1340 "Shows statistics, where all your Stats and Resistances are shown."
1281 ); 1341 );
1282 $ntb->add ( 1342 $ntb->add (
1283 "Skills (F3)" => $SKILL_PAGE = skill_window, 1343 "Skills (F3)" => $SKILL_PAGE = skill_window,
1284 "Shows all your Skills." 1344 "Shows all your Skills."
1285 ); 1345 );
1346
1347 my $spellsw = new CFClient::UI::ScrolledWindow (expand => 1, scroll_y => 1);
1348 $spellsw->add ($SPELL_PAGE = new CFClient::UI::SpellList);
1286 $ntb->add ( 1349 $ntb->add (
1287 "Spellbook (F4)" => $SPELL_PAGE = new CFClient::UI::SpellList, 1350 "Spellbook (F4)" => $spellsw,
1288 "Displays all spells you have and lets you edit keyboard shortcuts for them." 1351 "Displays all spells you have and lets you edit keyboard shortcuts for them."
1289 ); 1352 );
1290 $ntb->add ( 1353 $ntb->add (
1291 "Inventory (F5)" => $INVENTORY_PAGE = inventory_widget, 1354 "Inventory (F5)" => $INVENTORY_PAGE = inventory_widget,
1292 "Toggles the inventory window, where you can manage your loot (or treasures :). " 1355 "Toggles the inventory window, where you can manage your loot (or treasures :). "
1409 $refresh->(); 1472 $refresh->();
1410 1473
1411 $vb 1474 $vb
1412} 1475}
1413 1476
1477# just weirdness, pls. ignore
1478sub load_html_page {
1479 my ($viewer, $base) = @_;
1480
1481 $viewer->clear;
1482
1483 require LWP::Simple;
1484 require HTML::Parser;
1485 require URI;
1486
1487 my $page = LWP::Simple::get ($base)
1488 or return;
1489
1490 my @s = { };
1491 my %passthrough = map ($_ => undef), qw(b i u s tt big small sub sup);
1492
1493 my $parser = HTML::Parser->new (
1494 text_h => [sub {
1495 my ($text) = @_;
1496 $text =~ s/\s+/ /g;
1497 $s[-1]{text} .= CFClient::asxml $text;
1498 }, "dtext"],
1499 start_h => [sub {
1500 my ($tag, $attr) = @_;
1501 if ($passthrough{$tag}) {
1502 $s[-1]{text} .= "<$tag>";
1503 } elsif ($tag eq "h1") {
1504 push @s, { text => "<span foreground='#ffff00' size='x-large'>" };
1505 } elsif ($tag eq "h2") {
1506 push @s, { text => "<span foreground='#ccccff' size='large'>" };
1507 } elsif ($tag eq "h3") {
1508 push @s, { text => "<span size='large'>" };
1509 } elsif ($tag eq "a") {
1510 push @s, { text => "", url => $attr->{href} };
1511 } elsif ($tag eq "p") {
1512 push @s, { };
1513 } elsif ($tag eq "img") {
1514 eval {
1515 push @{$s[-1]{obj}}, new CFClient::UI::Image
1516 tex => (new_from_image CFClient::Texture LWP::Simple::get (URI->new ($attr->{src}, $base)->abs ($base)));
1517 $s[-1]{text} .= "\x{fffc}";
1518 };
1519 }
1520 }, "tagname, attr"],
1521 end_h => [sub {
1522 my ($tag) = @_;
1523 if ($passthrough{$tag}) {
1524 $s[-1]{text} .= "</$tag>";
1525 } elsif ($tag =~ /^h\d$/) {
1526 $s[-1]{text} .= "</span>";
1527 push @s, { };
1528 } elsif ($tag eq "a") {
1529 my $S = pop @s;
1530 $s[-1]{text} .= "\x{fffc}";
1531 push @{$s[-1]{obj}}, new CFClient::UI::Label
1532 fg => [0.8, 0.8, 1],
1533 markup => "<u>$S->{text}</u>",
1534 fontsize => 0.8,
1535 can_events => 1,
1536 can_focus => 1,
1537 on_button_up => sub {
1538 load_html_page ($viewer, URI->new ($S->{url}, $base)->abs ($base));
1539 },
1540 ;
1541 }
1542 }, "tagname"],
1543 );
1544
1545 $parser->parse ($page);
1546 $parser->eof;
1547
1548 $viewer->add_paragraph ([1, 1, 1, 1], [$_->{text}, @{ $_->{obj} || [] }], $_->{indent})
1549 for @s;
1550
1551 $viewer->set_offset (0);
1552}
1553
1414sub help_window { 1554sub help_window {
1415 my $win = new CFClient::UI::FancyFrame 1555 my $win = new CFClient::UI::FancyFrame
1416 x => 'center', 1556 x => 'center',
1417 y => 'center', 1557 y => 'center',
1418 z => 2, 1558 z => 2,
1436 [manual => "Main Manual"], 1576 [manual => "Main Manual"],
1437 [skill_help => "Skill Reference"], 1577 [skill_help => "Skill Reference"],
1438 [command_help => "Command Reference"], 1578 [command_help => "Command Reference"],
1439 [dmcommand_help => "DM Commands"], 1579 [dmcommand_help => "DM Commands"],
1440 [COPYING => "License Terms"], 1580 [COPYING => "License Terms"],
1581 [test => "test (do not select)"], #d#TODO
1441 ], 1582 ],
1442 on_changed => sub { 1583 on_changed => sub {
1443 my ($self, $pod) = @_; 1584 my ($self, $pod) = @_;
1444 1585
1586 if ($pod eq "test") {#d#TODO
1587 eval {
1588 load_html_page $viewer, "http://crossfire.real-time.com/guides/walkthrough/newbie-tower.html";
1589 };
1590 warn "$@" if $@;
1591 return;
1592 }
1593
1445 my $pom = CFClient::load_pod CFClient::find_rcfile "pod/$pod.pod", 1594 my $pom = CFClient::Pod::load CFClient::find_rcfile "pod/$pod.pod",
1446 doc_viewer => 1, sub { CFClient::pod_to_pango_list $_[0] }; 1595 doc_viewer => 1, sub { CFClient::Pod::as_paragraphs $_[0] };
1596
1597 #use Data::Dumper; warn Dumper $pom;#d#
1447 1598
1448 $viewer->clear; 1599 $viewer->clear;
1449 1600
1450# $viewer->add_paragraph ([1, 1, 1, 1], ["<big>Test</big>\n\n \x{fffc} \x{fffc}\n", 1601# $viewer->add_paragraph ([1, 1, 1, 1], ["<big>Test</big>\n\n \x{fffc} \x{fffc}\n",
1451# (new CFClient::UI::Image path => "x.png", can_hover => 1, can_events => 1), 1602# (new CFClient::UI::Image path => "x.png", can_hover => 1, can_events => 1),
1452# (new CFClient::UI::Label text => "üüüü", can_hover => 1, can_events => 1, tooltip => "??"), 1603# (new CFClient::UI::Label text => "üüüü", can_hover => 1, can_events => 1, tooltip => "??"),
1453# ]);#d# 1604# ]);#d#
1454 1605
1455 $viewer->add_paragraph ([1, 1, 1, 1], $_->[1], $_->[0]) 1606 $viewer->add_paragraph ([1, 1, 1, 1], [$_->{text}, @{ $_->{obj} || [] }], $_->{indent})
1456 for @$pom; 1607 for @$pom;
1457 1608
1458 $viewer->set_offset (0); 1609 $viewer->set_offset (0);
1459 1610
1460 0 1611 0
1726 1877
1727 $WANT_REFRESH = 0; 1878 $WANT_REFRESH = 0;
1728 $CAN_REFRESH = 0; 1879 $CAN_REFRESH = 0;
1729 $LAST_REFRESH = $NOW; 1880 $LAST_REFRESH = $NOW;
1730 1881
17310 && do {
1732 # some weird model-drawing code, just a joke right now
1733 use CFClient::OpenGL;
1734
1735 $demo{t}{eye_auv} ||= new_from_file CFClient::Texture "eye2.png" or die;
1736 $demo{t}{body_auv} ||= new_from_file CFClient::Texture "body_auv3.png" or die;
1737 $demo{r} ||= do {
1738 my $mod = Compress::LZF::sthaw do { local $/; open my $fh, "<:raw:perlio", "dread.lz3"; <$fh> };
1739 $mod->{v} = pack "f*", @{$mod->{v}};
1740 $_ = [scalar @$_, pack "S!*", @$_]
1741 for values %{$mod->{g}};
1742 $mod
1743 };
1744
1745 my $r = $demo{r} or die;
1746
1747 glDepthMask 1;
1748 glClear GL_DEPTH_BUFFER_BIT;
1749 glEnable GL_TEXTURE_2D;
1750 glEnable GL_DEPTH_TEST;
1751 glEnable GL_CULL_FACE;
1752 glShadeModel $::FAST ? GL_FLAT : GL_SMOOTH;
1753
1754 glMatrixMode GL_PROJECTION;
1755 glLoadIdentity;
1756 glFrustum -1 * ($::WIDTH / $::HEIGHT), 1 * ($::WIDTH / $::HEIGHT), 1, -1, 1, 10000;
1757 #glOrtho 0, $::WIDTH, 0, $::HEIGHT, -10000, 10000;
1758 glMatrixMode GL_MODELVIEW;
1759 glLoadIdentity;
1760
1761 glPushMatrix;
1762 glTranslate 0, 0, -800;
1763 glScale 1, -1, 1;
1764 glRotate $NOW * 1000 % 36000 / 5, 0, 1, 0;
1765 glRotate $NOW * 1000 % 36000 / 6, 1, 0, 0;
1766 glRotate $NOW * 1000 % 36000 / 7, 0, 0, 1;
1767 glScale 50, 50, 50;
1768
1769 glInterleavedArrays GL_T2F_N3F_V3F, 0, $r->{v};
1770 while (my ($k, $v) = each %{$r->{g}}) {
1771 glBindTexture GL_TEXTURE_2D, ($demo{t}{$k}{name} or die);
1772 glDrawElements GL_TRIANGLES, $v->[0], GL_UNSIGNED_SHORT, $v->[1];
1773 }
1774
1775 glPopMatrix;
1776
1777 glShadeModel GL_FLAT;
1778 glDisable GL_DEPTH_TEST;
1779 glDisable GL_TEXTURE_2D;
1780 glDepthMask 0;
1781
1782 $WANT_REFRESH++;
1783};
1784
1785 CFClient::SDL_GL_SwapBuffers; 1882 CFClient::SDL_GL_SwapBuffers;
1786} 1883}
1787 1884
1788my $refresh_watcher = Event->timer (after => 0, hard => 0, interval => 1 / $MAX_FPS, cb => sub { 1885my $refresh_watcher = Event->timer (after => 0, hard => 0, interval => 1 / $MAX_FPS, cb => sub {
1789 $NOW = time; 1886 $NOW = time;

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines