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.100 by root, Sun Jul 23 16:11:12 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}
1229sub inventory_widget { 1260sub inventory_widget {
1230 my $hb = new CFClient::UI::HBox homogeneous => 1; 1261 my $hb = new CFClient::UI::HBox homogeneous => 1;
1231 1262
1232 $hb->add (my $vb1 = new CFClient::UI::VBox); 1263 $hb->add (my $vb1 = new CFClient::UI::VBox);
1233 $vb1->add (new CFClient::UI::Label align => 0, text => "Player"); 1264 $vb1->add (new CFClient::UI::Label align => 0, text => "Player");
1265
1266 $vb1->add (my $hb1 = new CFClient::UI::HBox);
1267
1268 use sort 'stable';
1269
1270 $hb1->add (new CFClient::UI::Combobox
1271 value => undef,
1272 options => [
1273 [undef, "Type/Name"],
1274 [
1275 sub { sort {
1276 $a->{weight} * ($a->{nrof} || 1) <=> $b->{weight} * ($b->{nrof} || 1)
1277 or $a->{type} <=> $b->{type}
1278 } @_ },
1279 "Weight/Type",
1280 ],
1281 [sub { } => "#TODO#"],
1282 ],
1283 on_changed => sub {
1284 $INV->set_sort_order ($_[1]);
1285 },
1286 );
1287 $hb1->add (new CFClient::UI::Label text => "Weight: ", align => 1, expand => 1);
1288 #TODO# update to weigh/maxweight
1289 $hb1->add ($STATWIDS->{i_weight} = new CFClient::UI::Label align => -1);
1290
1291 $vb1->add (my $sw1 = new CFClient::UI::ScrolledWindow expand => 1, scroll_y => 1);
1234 $vb1->add ($INV = new CFClient::UI::Inventory); 1292 $sw1->add ($INV = new CFClient::UI::Inventory);
1235 1293
1236 $hb->add (my $vb2 = new CFClient::UI::VBox); 1294 $hb->add (my $vb2 = new CFClient::UI::VBox);
1237 1295
1238 $vb2->add ($INV_RIGHT_HB = new CFClient::UI::HBox); 1296 $vb2->add ($INV_RIGHT_HB = new CFClient::UI::HBox);
1239 1297
1298 $vb2->add (my $sw2 = new CFClient::UI::ScrolledWindow expand => 1, scroll_y => 1);
1240 $vb2->add ($INVR = new CFClient::UI::Inventory); 1299 $sw2->add ($INVR = new CFClient::UI::Inventory);
1241 1300
1242 # XXX: Call after $INVR = ... because set_opencont sets the items 1301 # XXX: Call after $INVR = ... because set_opencont sets the items
1243 CFClient::Protocol::set_opencont ($::CONN, 0, "Floor"); 1302 CFClient::Protocol::set_opencont ($::CONN, 0, "Floor");
1244 1303
1245 $hb 1304 $hb
1267 has_close_button => 1 1326 has_close_button => 1
1268 ; 1327 ;
1269 1328
1270 my $ntb = 1329 my $ntb =
1271 $PL_NOTEBOOK = 1330 $PL_NOTEBOOK =
1272 new CFClient::UI::Notebook 1331 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 1332
1278 $ntb->add ( 1333 $ntb->add (
1279 "Statistics (F2)" => $STATS_PAGE = stats_window, 1334 "Statistics (F2)" => $STATS_PAGE = stats_window,
1280 "Shows statistics, where all your Stats and Resistances are shown." 1335 "Shows statistics, where all your Stats and Resistances are shown."
1281 ); 1336 );
1282 $ntb->add ( 1337 $ntb->add (
1283 "Skills (F3)" => $SKILL_PAGE = skill_window, 1338 "Skills (F3)" => $SKILL_PAGE = skill_window,
1284 "Shows all your Skills." 1339 "Shows all your Skills."
1285 ); 1340 );
1341
1342 my $spellsw = new CFClient::UI::ScrolledWindow (expand => 1, scroll_y => 1);
1343 $spellsw->add ($SPELL_PAGE = new CFClient::UI::SpellList);
1286 $ntb->add ( 1344 $ntb->add (
1287 "Spellbook (F4)" => $SPELL_PAGE = new CFClient::UI::SpellList, 1345 "Spellbook (F4)" => $spellsw,
1288 "Displays all spells you have and lets you edit keyboard shortcuts for them." 1346 "Displays all spells you have and lets you edit keyboard shortcuts for them."
1289 ); 1347 );
1290 $ntb->add ( 1348 $ntb->add (
1291 "Inventory (F5)" => $INVENTORY_PAGE = inventory_widget, 1349 "Inventory (F5)" => $INVENTORY_PAGE = inventory_widget,
1292 "Toggles the inventory window, where you can manage your loot (or treasures :). " 1350 "Toggles the inventory window, where you can manage your loot (or treasures :). "
1409 $refresh->(); 1467 $refresh->();
1410 1468
1411 $vb 1469 $vb
1412} 1470}
1413 1471
1472# just weirdness, pls. ignore
1473sub load_html_page {
1474 my ($viewer, $base) = @_;
1475
1476 $viewer->clear;
1477
1478 require LWP::Simple;
1479 require HTML::Parser;
1480 require URI;
1481
1482 my $page = LWP::Simple::get ($base)
1483 or return;
1484
1485 my @s = { };
1486 my %passthrough = map ($_ => undef), qw(b i u s tt big small sub sup);
1487
1488 my $parser = HTML::Parser->new (
1489 text_h => [sub {
1490 my ($text) = @_;
1491 $text =~ s/\s+/ /g;
1492 $s[-1]{text} .= CFClient::asxml $text;
1493 }, "dtext"],
1494 start_h => [sub {
1495 my ($tag, $attr) = @_;
1496 if ($passthrough{$tag}) {
1497 $s[-1]{text} .= "<$tag>";
1498 } elsif ($tag eq "h1") {
1499 push @s, { text => "<span foreground='#ffff00' size='x-large'>" };
1500 } elsif ($tag eq "h2") {
1501 push @s, { text => "<span foreground='#ccccff' size='large'>" };
1502 } elsif ($tag eq "h3") {
1503 push @s, { text => "<span size='large'>" };
1504 } elsif ($tag eq "a") {
1505 push @s, { text => "", url => $attr->{href} };
1506 } elsif ($tag eq "p") {
1507 push @s, { };
1508 } elsif ($tag eq "img") {
1509 eval {
1510 push @{$s[-1]{obj}}, new CFClient::UI::Image
1511 tex => (new_from_image CFClient::Texture LWP::Simple::get (URI->new ($attr->{src}, $base)->abs ($base)));
1512 $s[-1]{text} .= "\x{fffc}";
1513 };
1514 }
1515 }, "tagname, attr"],
1516 end_h => [sub {
1517 my ($tag) = @_;
1518 if ($passthrough{$tag}) {
1519 $s[-1]{text} .= "</$tag>";
1520 } elsif ($tag =~ /^h\d$/) {
1521 $s[-1]{text} .= "</span>";
1522 push @s, { };
1523 } elsif ($tag eq "a") {
1524 my $S = pop @s;
1525 $s[-1]{text} .= "\x{fffc}";
1526 push @{$s[-1]{obj}}, new CFClient::UI::Label
1527 fg => [0.8, 0.8, 1],
1528 markup => "<u>$S->{text}</u>",
1529 fontsize => 0.8,
1530 can_events => 1,
1531 can_focus => 1,
1532 on_button_up => sub {
1533 load_html_page ($viewer, URI->new ($S->{url}, $base)->abs ($base));
1534 },
1535 ;
1536 }
1537 }, "tagname"],
1538 );
1539
1540 $parser->parse ($page);
1541 $parser->eof;
1542
1543 $viewer->add_paragraph ([1, 1, 1, 1], [$_->{text}, @{ $_->{obj} || [] }], $_->{indent})
1544 for @s;
1545
1546 $viewer->set_offset (0);
1547}
1548
1414sub help_window { 1549sub help_window {
1415 my $win = new CFClient::UI::FancyFrame 1550 my $win = new CFClient::UI::FancyFrame
1416 x => 'center', 1551 x => 'center',
1417 y => 'center', 1552 y => 'center',
1418 z => 2, 1553 z => 2,
1436 [manual => "Main Manual"], 1571 [manual => "Main Manual"],
1437 [skill_help => "Skill Reference"], 1572 [skill_help => "Skill Reference"],
1438 [command_help => "Command Reference"], 1573 [command_help => "Command Reference"],
1439 [dmcommand_help => "DM Commands"], 1574 [dmcommand_help => "DM Commands"],
1440 [COPYING => "License Terms"], 1575 [COPYING => "License Terms"],
1576 [test => "test (do not select)"], #d#TODO
1441 ], 1577 ],
1442 on_changed => sub { 1578 on_changed => sub {
1443 my ($self, $pod) = @_; 1579 my ($self, $pod) = @_;
1444 1580
1581 if ($pod eq "test") {#d#TODO
1582 eval {
1583 load_html_page $viewer, "http://crossfire.real-time.com/guides/walkthrough/newbie-tower.html";
1584 };
1585 warn "$@" if $@;
1586 return;
1587 }
1588
1445 my $pom = CFClient::load_pod CFClient::find_rcfile "pod/$pod.pod", 1589 my $pom = CFClient::Pod::load CFClient::find_rcfile "pod/$pod.pod",
1446 doc_viewer => 1, sub { CFClient::pod_to_pango_list $_[0] }; 1590 doc_viewer => 1, sub { CFClient::Pod::as_paragraphs $_[0] };
1591
1592 #use Data::Dumper; warn Dumper $pom;#d#
1447 1593
1448 $viewer->clear; 1594 $viewer->clear;
1449 1595
1450# $viewer->add_paragraph ([1, 1, 1, 1], ["<big>Test</big>\n\n \x{fffc} \x{fffc}\n", 1596# $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), 1597# (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 => "??"), 1598# (new CFClient::UI::Label text => "üüüü", can_hover => 1, can_events => 1, tooltip => "??"),
1453# ]);#d# 1599# ]);#d#
1454 1600
1455 $viewer->add_paragraph ([1, 1, 1, 1], $_->[1], $_->[0]) 1601 $viewer->add_paragraph ([1, 1, 1, 1], [$_->{text}, @{ $_->{obj} || [] }], $_->{indent})
1456 for @$pom; 1602 for @$pom;
1457 1603
1458 $viewer->set_offset (0); 1604 $viewer->set_offset (0);
1459 1605
1460 0 1606 0
1726 1872
1727 $WANT_REFRESH = 0; 1873 $WANT_REFRESH = 0;
1728 $CAN_REFRESH = 0; 1874 $CAN_REFRESH = 0;
1729 $LAST_REFRESH = $NOW; 1875 $LAST_REFRESH = $NOW;
1730 1876
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; 1877 CFClient::SDL_GL_SwapBuffers;
1786} 1878}
1787 1879
1788my $refresh_watcher = Event->timer (after => 0, hard => 0, interval => 1 / $MAX_FPS, cb => sub { 1880my $refresh_watcher = Event->timer (after => 0, hard => 0, interval => 1 / $MAX_FPS, cb => sub {
1789 $NOW = time; 1881 $NOW = time;

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines