Changeset 66
- Timestamp:
- Jan 7, 2023, 11:06:35 PM (23 months ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/UEngine.pas
r64 r66 6 6 Dialogs, Classes, SysUtils, Graphics, SpecializedMatrix, URegistry, 7 7 IntfGraphics, FPImage, LCLType, SpecializedBitmap, GraphType, Math, URectangle, 8 Syncobjs, UThreading, Forms, DateUtils, UAudioSystem, XMLConf, DOM,9 Generics.Collections,UWorld, UMatter;8 Syncobjs, UThreading, Forms, DateUtils, UAudioSystem, Generics.Collections, 9 UWorld, UMatter; 10 10 11 11 const 12 12 MaxBulletCount = 10; 13 EnergySteps = 4000; 14 EnergyDecreaseDig = 0.001; 15 EnergyDecreaseShoot = 0.005; 13 EnergyDecreaseDig = 0; 14 EnergyDecreaseMove = 0.00025; // ~2.5 minutes of movement 15 EnergyDecreaseShoot = 0.005; // ~20 seconds of shooting 16 EnergyDecreaseOutside = 0.00003; // ~5 minutes of live 17 EnergyIncreaseHome = 0.001; 16 18 ShieldSteps = 40; 17 19 ExplosionBulletCount = 100; … … 26 28 PlayerFrameWidth = 80; 27 29 PlayerFrameHeight = 80; 28 PlayerHouseSize = 30;29 PlayerHouseDoorSize = 8;30 PlayerHouseSize = 29; 31 PlayerHouseDoorSize = 7; 30 32 ExplosionDelay = 2; 31 33 NewRoundDelay = 2; … … 476 478 CheckNewDestination; 477 479 end else begin 478 NewPosition := Position; 479 if not CheckNewDestination then begin 480 // if direction is changed then try to check movement plus one step 481 // to prevent tank block 482 NewPosition := Point(Position.X + Delta.X, Position.Y + Delta.Y); 483 CheckNewDestination; 484 end; 480 NewPosition := Position; 481 if not CheckNewDestination then begin 482 // if direction is changed then try to check movement plus one step 483 // to prevent tank block 484 NewPosition := Point(Position.X + Delta.X, Position.Y + Delta.Y); 485 CheckNewDestination; 485 486 end; 487 end; 486 488 end; 487 489 … … 520 522 if ColisionState.Diggable then begin 521 523 if (Engine.KeyBoard.KeyState[Ord(Keys.Shoot)] and 522 ((Now - LastDigTime) > ShootDigDelay * OneSecond)) or523 (not Engine.KeyBoard.KeyState[Ord(Keys.Shoot)] and524 ((Now - LastDigTime) > DigDelay * OneSecond)) then begin525 Dig := not Dig;526 with Engine, World do527 Surface.Merge(Surface.CreateIndex(528 Position.X - TMatrixByte(DigMasks[Direction]).Count.X div 2,529 Position.Y - TMatrixByte(DigMasks[Direction]).Count.Y div 2),530 TMatrixByte(DigMasks[Direction]), DigProc);531 Energy := Energy - EnergyDecreaseDig;532 if Energy < 0 then Energy := 0;533 Engine.Redraw;534 LastDigTime := Now;535 Direction := NewDirection;536 Result := True;524 ((Now - LastDigTime) > ShootDigDelay * OneSecond)) or 525 (not Engine.KeyBoard.KeyState[Ord(Keys.Shoot)] and 526 ((Now - LastDigTime) > DigDelay * OneSecond)) then begin 527 Dig := not Dig; 528 with Engine, World do 529 Surface.Merge(Surface.CreateIndex( 530 Position.X - TMatrixByte(DigMasks[Direction]).Count.X div 2, 531 Position.Y - TMatrixByte(DigMasks[Direction]).Count.Y div 2), 532 TMatrixByte(DigMasks[Direction]), DigProc); 533 Energy := Energy - EnergyDecreaseDig; 534 if Energy < 0 then Energy := 0; 535 Engine.Redraw; 536 LastDigTime := Now; 537 Direction := NewDirection; 538 Result := True; 537 539 end; 538 540 end else begin … … 543 545 Engine.Redraw; 544 546 LastMoveTime := Now; 547 Energy := Energy - EnergyDecreaseMove; 545 548 end; 546 549 end; … … 558 561 if not ExplosionPending then begin 559 562 if not Engine.IsInsideHouses(Position) then begin 560 Energy := Energy - 1 / EnergySteps;563 Energy := Energy - EnergyDecreaseOutside; 561 564 end else begin 562 565 if not Exploded then 563 Energy := Energy + 5 * 1 / EnergySteps;566 Energy := Energy + EnergyIncreaseHome; 564 567 if Energy > 1 then Energy := 1; 565 568 end; … … 711 714 for X := 0 to PlayerHouseSize - 1 do begin 712 715 if ((Y = 0) or (Y = (PlayerHouseSize - 1)) or (X = 0) or (X = (PlayerHouseSize - 1))) and 713 not (((Y = 0) or (Y = (PlayerHouseSize - 1))) and (X > ((PlayerHouseSize - PlayerHouseDoorSize) div 2)) and 714 (X < ((PlayerHouseSize - 1 + PlayerHouseDoorSize) div 2))) 716 not (((Y = 0) or (Y = (PlayerHouseSize - 1))) and 717 (X >= ((PlayerHouseSize - PlayerHouseDoorSize) div 2)) and 718 (X <= ((PlayerHouseSize - 1 + PlayerHouseDoorSize) div 2))) 715 719 then Matter := Byte(miPlayer1Home) + Id * 4 716 720 else Matter := Byte(miSpace); … … 1787 1791 State := gsMenu; 1788 1792 end; 1793 end else 1794 if State = gsGame then begin 1795 if Key = KeyEsc then begin 1796 State := gsMap; 1797 end; 1789 1798 end; 1790 1799 … … 1799 1808 end; 1800 1809 end; 1801 end else1802 if (State = gsGame) and (Key = KeyF5) then begin1803 State := gsMap;1804 1810 end; 1805 1811 {$ENDIF}
Note:
See TracChangeset
for help on using the changeset viewer.