Changeset 57
- Timestamp:
- Dec 25, 2022, 9:29:43 AM (23 months ago)
- Location:
- trunk
- Files:
-
- 3 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/Forms/UFormMain.pas
r55 r57 191 191 procedure TFormMain.AShowMapExecute(Sender: TObject); 192 192 begin 193 if not Assigned(FormMap) then FormMap := TFormMap.Create( nil);193 if not Assigned(FormMap) then FormMap := TFormMap.Create(Self); 194 194 FormMap.Show; 195 195 end; … … 225 225 procedure TFormMain.FormKeyUp(Sender: TObject; var Key: Word; Shift: TShiftState 226 226 ); 227 const 228 KeyF11 = 112; 229 var 230 I: Integer; 227 231 begin 228 232 Engine.KeyBoard.KeyState[Key] := False; 233 {$IFDEF DEBUG} 234 if Key = KeyF11 then begin 235 // Destroy first alive player 236 for I := 0 to Engine.Players.Count - 1 do 237 with Engine.Players[I] do begin 238 if not Exploded then begin 239 Energy := -100; 240 Break; 241 end; 242 end; 243 end; 244 {$ENDIF} 229 245 end; 230 246 -
trunk/UEngine.pas
r56 r57 6 6 Dialogs, Classes, SysUtils, Graphics, SpecializedMatrix, 7 7 IntfGraphics, FPImage, LCLType, SpecializedBitmap, GraphType, Math, URectangle, 8 Syncobjs, UThreading, Forms, DateUtils, UAudioSystem, XMLConf, DOM, fgl; 8 Syncobjs, UThreading, Forms, DateUtils, UAudioSystem, XMLConf, DOM, 9 Generics.Collections; 9 10 10 11 const … … 27 28 PlayerHouseSize = 30; 28 29 PlayerHouseDoorSize = 8; 30 ExplosionDelay = 2; 29 31 30 32 type … … 56 58 end; 57 59 58 TBullets = class(T FPGObjectList<TBullet>)60 TBullets = class(TObjectList<TBullet>) 59 61 end; 60 62 … … 71 73 { TTanks } 72 74 73 TTanks = class(T FPGObjectList<TTank>)75 TTanks = class(TObjectList<TTank>) 74 76 procedure Assign(Source: TTanks); 75 77 end; … … 102 104 Dig: Boolean; 103 105 LastPos: TPoint; 106 ExplosionPending: Boolean; 107 ExplosionTime: TDateTime; 104 108 procedure SetExploded(const AValue: Boolean); 105 109 function ShowTankProc(Item1, Item2: Byte): Byte; … … 149 153 { TPlayers } 150 154 151 TPlayers = class(T FPGObjectList<TPlayer>)155 TPlayers = class(TObjectList<TPlayer>) 152 156 Engine: TEngine; 153 157 function AddNew: TPlayer; … … 169 173 { TMatters } 170 174 171 TMatters = class(T FPGObjectList<TMatter>)175 TMatters = class(TObjectList<TMatter>) 172 176 function AddNew: TMatter; 173 177 end; … … 238 242 PlayerPool: TPlayers; 239 243 Players: TPlayers; 240 DigMasks: T FPGObjectList<TMatrixByte>;244 DigMasks: TObjectList<TMatrixByte>; 241 245 Lock: TCriticalSection; 242 246 CurrentRound: Integer; … … 714 718 begin 715 719 // Check energy 716 if not Engine.IsInsideHouses(Position) then begin 717 Energy := Energy - 1 / EnergySteps; 720 if not ExplosionPending then begin 721 if not Engine.IsInsideHouses(Position) then begin 722 Energy := Energy - 1 / EnergySteps; 723 end else begin 724 if not Exploded then 725 Energy := Energy + 5 * 1 / EnergySteps; 726 if Energy > 1 then Energy := 1; 727 end; 718 728 if Energy <= 0 then begin 719 729 Energy := 0; 720 730 Explosion(Position, ExplosionRange); 721 731 Exploded := True; 732 ExplosionPending := True; 733 ExplosionTime := Now; 722 734 Engine.AudioExplode.Play; 723 735 end; 724 end else begin725 if not Exploded then726 Energy := Energy + 5 * 1 / EnergySteps;727 if Energy > 1 then Energy := 1;736 end; 737 if ExplosionPending and (SecondOf(Now - ExplosionTime) > ExplosionDelay) then begin 738 ExplosionPending := False; 739 Synchronize(Engine.CheckGameEnd); 728 740 end; 729 741 if LastEnergy <> Energy then begin … … 907 919 Energy := 0; 908 920 Shield := 0; 909 //Synchronize(Engine.CheckGameEnd);910 921 end; 911 922 … … 936 947 Round(World.Surface.Count.Y * 0.2) + Random(Round(World.Surface.Count.Y * 0.6))); 937 948 Exploded := False; 949 ExplosionPending := False; 938 950 Bullets.Clear; 939 951 Energy := 1; … … 1540 1552 AudioExplode.Open; 1541 1553 InitPlayerPool; 1542 DigMasks := T FPGObjectList<TMatrixByte>.Create;1554 DigMasks := TObjectList<TMatrixByte>.Create; 1543 1555 InitDigMasks; 1544 1556 Redraw; … … 1621 1633 I: Integer; 1622 1634 begin 1623 Active := False;1624 1635 World.Generate; 1625 1636 … … 1628 1639 ClearBackground := True; 1629 1640 Redraw; 1630 Active := True;1631 1641 end; 1632 1642 -
trunk/tunneler.lpr
r55 r57 32 32 Application.CreateForm(TCore, Core); 33 33 Application.CreateForm(TFormMain, FormMain); 34 Application.CreateForm(TFormMap, FormMap);35 34 {$IFDEF DEBUG} 36 35 {$ENDIF}
Note:
See TracChangeset
for help on using the changeset viewer.