Changeset 41
- Timestamp:
- Apr 18, 2019, 4:39:53 PM (6 years ago)
- Location:
- trunk
- Files:
-
- 9 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/Forms/UDebugForm.lfm
r39 r41 1 1 object DebugForm: TDebugForm 2 Left = 2432 Left = 453 3 3 Height = 300 4 Top = 325 Width = 4004 Top = 543 5 Width = 613 6 6 Caption = 'Debug' 7 7 DesignTimePPI = 120 -
trunk/Forms/UDebugForm.pas
r30 r41 1 1 unit UDebugForm; 2 2 3 {$mode objfpc}{$H+}3 {$mode delphi}{$H+} 4 4 5 5 interface -
trunk/Forms/UGameResultForm.pas
r30 r41 1 1 unit UGameResultForm; 2 2 3 {$mode objfpc}{$H+}3 {$mode delphi}{$H+} 4 4 5 5 interface -
trunk/Forms/UMainForm.pas
r38 r41 1 1 unit UMainForm; 2 2 3 {$mode Delphi}{$H+}3 {$mode delphi}{$H+} 4 4 5 5 interface -
trunk/Forms/UMapForm.pas
r24 r41 1 1 unit UMapForm; 2 2 3 {$mode objfpc}{$H+}3 {$mode delphi}{$H+} 4 4 5 5 interface -
trunk/Forms/UNewGameForm.pas
r38 r41 1 1 unit UNewGameForm; 2 2 3 {$mode objfpc}{$H+}3 {$mode delphi}{$H+} 4 4 5 5 interface -
trunk/Languages/Tunneler.cs.po
r39 r41 12 12 "X-Generator: Poedit 2.2\n" 13 13 14 #: tdebugform.debugform.caption 14 #: tdebugform.caption 15 #, fuzzy 16 msgctxt "tdebugform.caption" 15 17 msgid "Debug" 16 18 msgstr "LadÄnÃ" 17 18 #: tdebugform.listview1.columns[0].caption19 msgctxt "TDEBUGFORM.LISTVIEW1.COLUMNS[0].CAPTION"20 msgid "Player"21 msgstr "HráÄ"22 23 #: tdebugform.listview1.columns[1].caption24 msgid "Frame size"25 msgstr "Velikost rámce"26 27 #: tdebugform.listview1.columns[2].caption28 msgid "Bullets"29 msgstr "Kulky"30 31 #: tform1.caption32 msgid "Form1"33 msgstr "Form1"34 19 35 20 #: tgameresultform.caption 36 21 msgid "Game result" 37 22 msgstr "VÃœsledek hry" 38 39 #: tgameresultsform.gameresultsform.caption40 msgid "Final results"41 msgstr "KonÄené vÃœsledky"42 23 43 24 #: tmainform.aabout.caption … … 152 133 msgstr "%0:s z %1:s" 153 134 154 #: uthreading.scurrentthreadnotfound155 msgid "Current thread ID %d not found in virtual thread list."156 msgstr "Aktuálnà vlákno ID %s nenalezeno v seznamu virtuálnÃch vláken." -
trunk/UCore.pas
r36 r41 1 1 unit UCore; 2 2 3 {$mode Delphi}{$H+}3 {$mode delphi}{$H+} 4 4 5 5 interface … … 8 8 Dialogs, Classes, SysUtils, Graphics, SpecializedMatrix, SpecializedList, 9 9 IntfGraphics, FPImage, LCLType, SpecializedBitmap, GraphType, Math, URectangle, 10 Syncobjs, UThreading, Forms, DateUtils, UAudioSystem, UAudioSystemMPlayer, 11 XMLConf, DOM; 10 Syncobjs, UThreading, Forms, DateUtils, UAudioSystem, XMLConf, DOM, fgl; 12 11 13 12 const … … 71 70 { TTanks } 72 71 73 TTanks = class(T ListObject)72 TTanks = class(TFPGObjectList<TTank>) 74 73 procedure Assign(Source: TTanks); 75 74 end; … … 148 147 { TPlayers } 149 148 150 TPlayers = class(T ListObject)149 TPlayers = class(TFPGObjectList<TPlayer>) 151 150 Engine: TEngine; 151 function AddNew: TPlayer; 152 152 procedure Assign(Players: TPlayers); 153 153 procedure LoadConfig(Config: TXMLConfig; Path: string); … … 163 163 Diggable: Boolean; 164 164 Blocking: Boolean; 165 end; 166 167 { TMatters } 168 169 TMatters = class(TFPGObjectList<TMatter>) 170 function AddNew: TMatter; 165 171 end; 166 172 … … 175 181 Engine: TEngine; 176 182 Surface: TMatrixByte; 177 Matter : TListObject; // TListObject<TMatter>183 Matters: TMatters; 178 184 procedure Generate; 179 185 constructor Create; … … 229 235 Keyboard: TKeyboard; 230 236 World: TWorld; 231 PlayerPool: TPlayers; // TListObject<TPlayer>232 Players: TPlayers; // TListObject<TPlayer>237 PlayerPool: TPlayers; 238 Players: TPlayers; 233 239 DigMasks: TListObject; // TListObject<TMatrixByte> 234 240 Lock: TCriticalSection; … … 283 289 end; 284 290 291 { TMatters } 292 293 function TMatters.AddNew: TMatter; 294 begin 295 Result := TMatter.Create; 296 Add(Result); 297 end; 298 285 299 { TTanks } 286 300 … … 298 312 299 313 { TPlayers } 314 315 function TPlayers.AddNew: TPlayer; 316 begin 317 Result := TPlayer.Create; 318 Add(Result); 319 end; 300 320 301 321 procedure TPlayers.Assign(Players: TPlayers); … … 407 427 begin 408 428 // Space 409 with TMatter(Matter.AddNew(TMatter.Create))do begin429 with Matters.AddNew do begin 410 430 Kind := mkSpace; 411 431 Color := clBlack; … … 413 433 end; 414 434 // Dirt1 415 with TMatter(Matter.AddNew(TMatter.Create))do begin435 with Matters.AddNew do begin 416 436 Kind := mkDirt; 417 437 Color := $0756b0; … … 420 440 end; 421 441 // Dirt2 422 with TMatter(Matter.AddNew(TMatter.Create))do begin442 with Matters.AddNew do begin 423 443 Kind := mkDirt; 424 444 Color := $2170c3; … … 427 447 end; 428 448 // Rock 429 with TMatter(Matter.AddNew(TMatter.Create))do begin449 with Matters.AddNew do begin 430 450 Kind := mkRock; 431 451 Color := TColor($9a9a9a); … … 434 454 end; 435 455 // Bullet1 436 with TMatter(Matter.AddNew(TMatter.Create))do begin456 with Matters.AddNew do begin 437 457 Kind := mkBullet; 438 458 Color := clRed; … … 440 460 end; 441 461 // Bullet2 442 with TMatter(Matter.AddNew(TMatter.Create))do begin462 with Matters.AddNew do begin 443 463 Kind := mkBullet; 444 464 Color := clRed; … … 446 466 end; 447 467 // Border 448 with TMatter(Matter.AddNew(TMatter.Create))do begin468 with Matters.AddNew do begin 449 469 Kind := mkBorder; 450 470 Color := clNavy; … … 453 473 454 474 // Player 1 cannon 455 with TMatter(Matter.AddNew(TMatter.Create))do begin475 with Matters.AddNew do begin 456 476 Kind := mkTankBody; 457 477 Color := clYellow; … … 460 480 end; 461 481 // Player 1 home 462 with TMatter(Matter.AddNew(TMatter.Create))do begin482 with Matters.AddNew do begin 463 483 Kind := mkHome; 464 484 Color := TColor($00ff00); … … 467 487 end; 468 488 // Player 1 body1 469 with TMatter(Matter.AddNew(TMatter.Create))do begin489 with Matters.AddNew do begin 470 490 Kind := mkTankBody; 471 491 Color := TColor($00ff00); … … 474 494 end; 475 495 // Player 1 body2 476 with TMatter(Matter.AddNew(TMatter.Create))do begin496 with Matters.AddNew do begin 477 497 Kind := mkTankBody; 478 498 Color := TColor($00a000); … … 482 502 483 503 // Player 2 cannon 484 with TMatter(Matter.AddNew(TMatter.Create))do begin504 with Matters.AddNew do begin 485 505 Kind := mkTankBody; 486 506 Color := clYellow; … … 489 509 end; 490 510 // Player 2 home 491 with TMatter(Matter.AddNew(TMatter.Create))do begin511 with Matters.AddNew do begin 492 512 Kind := mkHome; 493 513 Color := TColor($ff2c2c); … … 496 516 end; 497 517 // Player 2 body1 498 with TMatter(Matter.AddNew(TMatter.Create))do begin518 with Matters.AddNew do begin 499 519 Kind := mkTankBody; 500 520 Color := TColor($ff2c2c); … … 503 523 end; 504 524 // Player 2 body2 505 with TMatter(Matter.AddNew(TMatter.Create))do begin525 with Matters.AddNew do begin 506 526 Kind := mkTankBody; 507 527 Color := TColor($b60000); … … 511 531 512 532 // Player 3 cannon 513 with TMatter(Matter.AddNew(TMatter.Create))do begin533 with Matters.AddNew do begin 514 534 Kind := mkTankBody; 515 535 Color := clYellow; … … 518 538 end; 519 539 // Player 3 home 520 with TMatter(Matter.AddNew(TMatter.Create))do begin540 with Matters.AddNew do begin 521 541 Kind := mkHome; 522 542 Color := TColor($0000ff); … … 525 545 end; 526 546 // Player 3 body1 527 with TMatter(Matter.AddNew(TMatter.Create))do begin547 with Matters.AddNew do begin 528 548 Kind := mkTankBody; 529 549 Color := TColor($0000ff); … … 532 552 end; 533 553 // Player 3 body2 534 with TMatter(Matter.AddNew(TMatter.Create))do begin554 with Matters.AddNew do begin 535 555 Kind := mkTankBody; 536 556 Color := TColor($0000a0); … … 540 560 541 561 // Player 4 cannon 542 with TMatter(Matter.AddNew(TMatter.Create))do begin562 with Matters.AddNew do begin 543 563 Kind := mkTankBody; 544 564 Color := clYellow; … … 547 567 end; 548 568 // Player 4 home 549 with TMatter(Matter.AddNew(TMatter.Create))do begin569 with Matters.AddNew do begin 550 570 Kind := mkHome; 551 571 Color := TColor($ff2cff); … … 554 574 end; 555 575 // Player 4 body1 556 with TMatter(Matter.AddNew(TMatter.Create))do begin576 with Matters.AddNew do begin 557 577 Kind := mkTankBody; 558 578 Color := TColor($ff2cff); … … 561 581 end; 562 582 // Player 4 body2 563 with TMatter(Matter.AddNew(TMatter.Create))do begin583 with Matters.AddNew do begin 564 584 Kind := mkTankBody; 565 585 Color := TColor($b600b6); … … 569 589 570 590 // Player 5 cannon 571 with TMatter(Matter.AddNew(TMatter.Create))do begin591 with Matters.AddNew do begin 572 592 Kind := mkTankBody; 573 593 Color := clYellow; … … 576 596 end; 577 597 // Player 5 home 578 with TMatter(Matter.AddNew(TMatter.Create))do begin598 with Matters.AddNew do begin 579 599 Kind := mkHome; 580 600 Color := TColor($ffff2c); … … 583 603 end; 584 604 // Player 5 body1 585 with TMatter(Matter.AddNew(TMatter.Create))do begin605 with Matters.AddNew do begin 586 606 Kind := mkTankBody; 587 607 Color := TColor($ffff2c); … … 590 610 end; 591 611 // Player 5 body2 592 with TMatter(Matter.AddNew(TMatter.Create))do begin612 with Matters.AddNew do begin 593 613 Kind := mkTankBody; 594 614 Color := TColor($b6b600); … … 598 618 599 619 // Player 6 cannon 600 with TMatter(Matter.AddNew(TMatter.Create))do begin620 with Matters.AddNew do begin 601 621 Kind := mkTankBody; 602 622 Color := clYellow; … … 605 625 end; 606 626 // Player 6 home 607 with TMatter(Matter.AddNew(TMatter.Create))do begin627 with Matters.AddNew do begin 608 628 Kind := mkHome; 609 629 Color := TColor($2cffff); … … 612 632 end; 613 633 // Player 6 body1 614 with TMatter(Matter.AddNew(TMatter.Create))do begin634 with Matters.AddNew do begin 615 635 Kind := mkTankBody; 616 636 Color := TColor($2cffff); … … 619 639 end; 620 640 // Player 6 body2 621 with TMatter(Matter.AddNew(TMatter.Create))do begin641 with Matters.AddNew do begin 622 642 Kind := mkTankBody; 623 643 Color := TColor($00b6b6); … … 627 647 628 648 // Player 7 cannon 629 with TMatter(Matter.AddNew(TMatter.Create))do begin649 with Matters.AddNew do begin 630 650 Kind := mkTankBody; 631 651 Color := clYellow; … … 634 654 end; 635 655 // Player 7 home 636 with TMatter(Matter.AddNew(TMatter.Create))do begin656 with Matters.AddNew do begin 637 657 Kind := mkHome; 638 658 Color := TColor($008cff); … … 641 661 end; 642 662 // Player 7 body1 643 with TMatter(Matter.AddNew(TMatter.Create))do begin663 with Matters.AddNew do begin 644 664 Kind := mkTankBody; 645 665 Color := TColor($008cff); … … 648 668 end; 649 669 // Player 7 body2 650 with TMatter(Matter.AddNew(TMatter.Create))do begin670 with Matters.AddNew do begin 651 671 Kind := mkTankBody; 652 672 Color := TColor($002da0); … … 656 676 657 677 // Player 8 cannon 658 with TMatter(Matter.AddNew(TMatter.Create))do begin678 with Matters.AddNew do begin 659 679 Kind := mkTankBody; 660 680 Color := clYellow; … … 663 683 end; 664 684 // Player 8 home 665 with TMatter(Matter.AddNew(TMatter.Create))do begin685 with Matters.AddNew do begin 666 686 Kind := mkHome; 667 687 Color := TColor($d0d0d0); … … 670 690 end; 671 691 // Player 8 body1 672 with TMatter(Matter.AddNew(TMatter.Create))do begin692 with Matters.AddNew do begin 673 693 Kind := mkTankBody; 674 694 Color := TColor($d0d0d0); … … 677 697 end; 678 698 // Player 8 body2 679 with TMatter(Matter.AddNew(TMatter.Create))do begin699 with Matters.AddNew do begin 680 700 Kind := mkTankBody; 681 701 Color := TColor($707070); … … 743 763 NewSize: TMatrixByteIndex; 744 764 begin 745 Matter := TListObject.Create;765 Matters := TMatters.Create; 746 766 InitMatter; 747 767 Surface := TMatrixByte.Create; … … 754 774 begin 755 775 FreeAndNil(Surface); 756 FreeAndNil(Matter );776 FreeAndNil(Matters); 757 777 inherited Destroy; 758 778 end; … … 775 795 PixelPtr := PixelRowPtr; 776 796 for X := 0 to Bitmap.Width - 1 do begin 777 P := TMatter(Matter [Surface.ItemsXY[Trunc(X / Bitmap.Width * Surface.Count.X),797 P := TMatter(Matters[Surface.ItemsXY[Trunc(X / Bitmap.Width * Surface.Count.X), 778 798 Trunc(Y / Bitmap.Height * Surface.Count.Y)]]).Color; 779 799 PixelPtr^ := SwapBRComponent(P); … … 970 990 with TPlayer(Engine.Players[P]) do 971 991 if (Self.Id <> P) and 972 (TMatter(Engine.World.Matter [ItemsXY[Pos.X, Pos.Y]]).Kind = mkTankBody) and973 (TMatter(Engine.World.Matter [ItemsXY[Pos.X, Pos.Y]]).Player = P) then992 (TMatter(Engine.World.Matters[ItemsXY[Pos.X, Pos.Y]]).Kind = mkTankBody) and 993 (TMatter(Engine.World.Matters[ItemsXY[Pos.X, Pos.Y]]).Player = P) then 974 994 Shield := Shield - 1 / ShieldSteps; 975 995 if StopByDirt then Explosion(LastPos, BulletExplosionRange); … … 1007 1027 Fill(CreateIndex(ScreenFrame.Left, ScreenFrame.Top), 1008 1028 CreateIndex(ScreenFrame.Right, ScreenFrame.Bottom), 1009 TMatter(Engine.World.Matter [Integer(miRock)]).Color);1029 TMatter(Engine.World.Matters[Integer(miRock)]).Color); 1010 1030 1011 1031 with Engine.World do … … 1015 1035 YY := Y - ScreenFrame.Top - ((ScreenFrame.Bottom - ScreenFrame.Top) div 2) + Position.Y; 1016 1036 if (YY >= 0) and (YY < Surface.Count.Y) and (XX >= 0) and (XX < Surface.Count.X) then 1017 ItemsXY[X, Y] := TMatter(Engine.World.Matter [Surface.ItemsXY[XX, YY]]).Color;1037 ItemsXY[X, Y] := TMatter(Engine.World.Matters[Surface.ItemsXY[XX, YY]]).Color; 1018 1038 end; 1019 1039 … … 1067 1087 YY := Y + NewPosition.Y - Image.Count.Y div 2; 1068 1088 if Image.ItemsXY[X, Y] > 0 then begin 1069 if TMatter(Matter [Surface.ItemsXY[XX, YY]]).Blocking then1089 if TMatter(Matters[Surface.ItemsXY[XX, YY]]).Blocking then 1070 1090 Result.Blocking := True; 1071 if TMatter(Matter [Surface.ItemsXY[XX, YY]]).Diggable then1091 if TMatter(Matters[Surface.ItemsXY[XX, YY]]).Diggable then 1072 1092 Result.Diggable := True; 1073 1093 end; … … 1278 1298 begin 1279 1299 with Config do begin 1280 Self.Name := GetValue(DOMString(Path + '/Name'), '');1300 Self.Name := string(GetValue(DOMString(Path + '/Name'), '')); 1281 1301 Color := GetValue(DOMString(Path + '/Color'), 0); 1282 1302 Enabled := GetValue(DOMString(Path + '/Enabled'), False); … … 1293 1313 begin 1294 1314 with Config do begin 1295 SetValue(DOMString(Path + '/Name'), Self.Name);1315 SetValue(DOMString(Path + '/Name'), DOMString(Self.Name)); 1296 1316 SetValue(DOMString(Path + '/Color'), Color); 1297 1317 SetValue(DOMString(Path + '/Enabled'), Enabled); … … 1381 1401 BytePerRow := RawImage.Description.BytesPerLine; 1382 1402 if ClearBackground then begin 1383 BgColor := TMatter(World.Matter [Integer(miBorder)]).Color;1403 BgColor := TMatter(World.Matters[Integer(miBorder)]).Color; 1384 1404 BgColor := SwapBRComponent(BgColor); 1385 1405 FillDWord(RawImage.Data^, Bitmap.Height * BytePerRow div 4, BgColor); … … 1540 1560 begin 1541 1561 PlayerPool.Clear; 1542 with TPlayer(PlayerPool.AddNew(TPlayer.Create))do begin1562 with PlayerPool.AddNew do begin 1543 1563 Keys.Left := 65; 1544 1564 Keys.Down := 83; … … 1548 1568 Enabled := True; 1549 1569 end; 1550 with TPlayer(PlayerPool.AddNew(TPlayer.Create))do begin1570 with PlayerPool.AddNew do begin 1551 1571 Keys.Left := 37; 1552 1572 Keys.Down := 40; … … 1556 1576 Enabled := True; 1557 1577 end; 1558 with TPlayer(PlayerPool.AddNew(TPlayer.Create))do begin1578 with PlayerPool.AddNew do begin 1559 1579 Keys.Left := 76; 1560 1580 Keys.Down := 147; … … 1563 1583 Keys.Shoot := 191; 1564 1584 end; 1565 with TPlayer(PlayerPool.AddNew(TPlayer.Create))do begin1585 with PlayerPool.AddNew do begin 1566 1586 Keys.Left := 100; 1567 1587 Keys.Down := 98; … … 1570 1590 Keys.Shoot := 105; 1571 1591 end; 1572 with TPlayer(PlayerPool.AddNew(TPlayer.Create))do begin1592 with PlayerPool.AddNew do begin 1573 1593 Keys.Left := 0; 1574 1594 Keys.Down := 0; … … 1577 1597 Keys.Shoot := 0; 1578 1598 end; 1579 with TPlayer(PlayerPool.AddNew(TPlayer.Create))do begin1599 with PlayerPool.AddNew do begin 1580 1600 Keys.Left := 0; 1581 1601 Keys.Down := 0; … … 1584 1604 Keys.Shoot := 0; 1585 1605 end; 1586 with TPlayer(PlayerPool.AddNew(TPlayer.Create))do begin1606 with PlayerPool.AddNew do begin 1587 1607 Keys.Left := 0; 1588 1608 Keys.Down := 0; … … 1591 1611 Keys.Shoot := 0; 1592 1612 end; 1593 with TPlayer(PlayerPool.AddNew(TPlayer.Create))do begin1613 with PlayerPool.AddNew do begin 1594 1614 Keys.Left := 0; 1595 1615 Keys.Down := 0; … … 1755 1775 1756 1776 procedure TEngine.NewGame; 1757 var1758 I: Integer;1759 1777 begin 1760 1778 Active := False; -
trunk/tunneler.lpr
r39 r41 1 1 program tunneler; 2 2 3 {$mode objfpc}{$H+}3 {$mode delphi}{$H+} 4 4 5 5 uses
Note:
See TracChangeset
for help on using the changeset viewer.