DLMain.pas
资源名称:CAST2SDK.rar [点击查看]
上传用户:yj_qiu
上传日期:2022-08-08
资源大小:23636k
文件大小:22k
源码类别:
游戏引擎
开发平台:
Delphi
- (*
- Dungeon Looter main unit
- (C) 2006-2007 George "Mirage" Bakhtadze, mirage@casteng.com
- Unit contains main application class
- *)
- {$Include GDefines.inc}
- {$Include C2Defines.inc}
- unit DLMain;
- interface
- uses
- SysUtils,
- TextFile,
- Props, OSUtils, Basics, Base3D, Resources,
- BaseTypes, BaseClasses, BaseMsg, GUIMsg, C2GUI, BaseGraph,
- C2VisItems, C22D, C2Materials, C2Res,
- AppsInit, GUIHelper, C2AppHelper, ACSHelper,
- ACSBase, ACS, ACSAdv,
- C2FX, C2Affectors, C2Core,
- C2Anim,
- C2Maps, C2Land, C2TileMaps,
- GWorld, GameMsg,
- DLSound;
- const
- HighScoresCount = 10;
- SplashTimeOut = 5.000;
- MessageTimeout = 2.000;
- RelSoundsDir = 'sounds';
- GameInfoURL = 'http://avagames.net/content/dungeonlooter';
- type
- // Application class
- TDLApp = class(TCast2App)
- private
- FGameState: TGameState;
- SplashFader, GameOverFader: TFader;
- TargetTileX: Integer;
- DefaultConfig: TNiceFileConfig;
- MessageID: Integer;
- SoundsDir: string;
- procedure ClearMessage(EventID: Integer; const ErrorDelta: TTimeUnit);
- procedure OpenShop;
- procedure SetGameState(const Value: TGameState);
- // Checks if menu "Back" button should be enabled
- function IsMenuBackEnabled(Caller: TGUIItem): Boolean;
- // Checks if menu "Save game" button should be enabled
- function IsMenuSaveEnabled(Caller: TGUIItem): Boolean;
- // Checks if menu "Load game" button should be enabled
- function IsMenuLoadEnabled(Caller: TGUIItem): Boolean;
- public
- GUIHelper: TACSHelper; // Helper class to simplify GUI tasks
- constructor Create(const AProgramName: string; AStarter: TAppStarter); override;
- destructor Destroy; override;
- procedure Init;
- // Places current score to high scores list
- procedure UpdateHighScores;
- procedure CreateCore(CoreClass: CCore); override;
- procedure PreviewOptions(OptionName, Value: string); override;
- procedure ApplyOptionSet(const OptionSet: string); override;
- procedure ApplyOptions; override;
- function ApplyVideoOptions: Boolean; override;
- function ApplyAudioOptions: Boolean;
- procedure PrintMessage(const Text: string);
- // Moves character to point where mouse was clicked
- procedure ProcessMouseControl;
- // Determines the point where mouse was clicked
- procedure HandleMouseControl(MX, MY: Integer);
- // Handles a click on a GUI element
- procedure OnGUIClick(Item: TGUIItem);
- // Message handling
- procedure HandleMessage(const Msg: TMessage); override;
- // Main game processing cycle
- procedure Process; override;
- // Changes game state to next stage. E.g. intro screen to main menu, etc
- procedure GoToNextGameState;
- // Current game state. Currently visible items set depends on the state.
- property GameState: TGameState read FGameState write SetGameState;
- end;
- var
- App: TDLApp;
- ShopItemsList: TList;
- implementation
- { TDLApp }
- procedure TDLApp.ClearMessage(EventID: Integer; const ErrorDelta: TTimeUnit);
- begin
- if EventID = MessageID then GUIHelper.SetControlText('Message', '');
- end;
- procedure TDLApp.OpenShop;
- var i: Integer; s: string;
- begin
- GUIHelper.ShowControl('Inventory');
- s := '';
- for i := 0 to TotalGemTypes-1 do
- s := s + Format('[#%S]%S[#] (%D gold): %D [E]', [GemColors[i], GemNames[i], GemPrices[i], World.Player.Inventory.Gems[i]]);
- // GUIHelper.SetGUIItemText('InventoryInfo', s);
- GUIHelper.SetControlText('ShopInfo', s);
- GUIHelper.SetControlText('ShopStatus', 'Gold: ' + IntToStr(World.Player.Inventory.Gold));
- GUIHelper.ShowControl('Shop');
- end;
- procedure TDLApp.SetGameState(const Value: TGameState);
- begin
- FGameState := Value;
- GUIHelper.HideControl('LabelGameOver');
- case Value of
- gsIntro: begin
- SplashFader.Show;
- Core.Timer.SetEvent(SplashTimeOut, TTimeOutMsg); // Set event to go further after some time
- end;
- gsMenu: begin
- SplashFader.FadeOut; // Fadeout splash screens if any
- GameOverFader.FadeOut;
- HandleMessage(TMenuToggleMsg.Create);
- end;
- gsPlay: begin
- SplashFader.FadeOut;
- GameOverFader.FadeOut;
- end;
- gsGameOver: begin
- GameOverFader.Show;
- GUIHelper.ShowControl('LabelGameOver');
- Core.Timer.SetEvent(SplashTimeOut, TTimeOutMsg);
- end;
- gsOutro: ;
- gsCredits: ;
- else Assert(False, 'TDLApp.SetGameState: Invalid game state');
- end;
- end;
- function TDLApp.IsMenuBackEnabled(Caller: TGUIItem): Boolean;
- begin
- Result := FGameState = gsPlay;
- end;
- function TDLApp.IsMenuSaveEnabled(Caller: TGUIItem): Boolean;
- begin
- Result := (FGameState = gsPlay) and (not World.Player.IsDead);
- end;
- function TDLApp.IsMenuLoadEnabled(Caller: TGUIItem): Boolean;
- begin
- Result := FileExists(Config['UserName'] + '.sg');
- end;
- constructor TDLApp.Create(const AProgramName: string; AStarter: TAppStarter);
- var i: Integer; s: string; HSList: TList; TF: Text;
- begin
- // Bind some default key which can be redefined a user profile (.pfl) file
- BindAction(TInventoryToggleMsg, 'Inventory', 'I', '');
- BindAction(TTeleportUseMsg, 'Teleport', 'T', '');
- BindAction(TGameActionMsg, 'Action', 'ENTER', '');
- BindAction(TFireMsg, 'Fire', 'SPACE', '');
- // Cheat codes
- BindAction(TGodModeToggleMsg, 'CheatGodMode', 'G,O,D,M,O,D,E', '');
- BindAction(TThousandTorchesMsg, 'CheatThousandTorches', '1,0,0,0,T,O,R,C,H,E,S', '');
- BindAction(TGiveMoneyMsg, 'CheatManyMoney', 'M,A,N,Y,M,O,N,E,Y', '');
- inherited;
- GUIHelper := TACSHelper.Create(Core, Config);
- // Load default config used to reset configuration
- DefaultConfig := TNiceFileConfig.Create(UserNameToFileName('default'));
- GUIHelper.DefaultConfig := DefaultConfig;
- // if not DefaultConfig.LoadFrom() then
- // Log.Log('Default user profile file "' + UserNameToFileName('default') + '"not found', lkWarning);
- // Load scene file
- LoadScene('dlooter.cbf');
- // Initialize spash screens
- SplashFader := Core.Root.GetChildByName('SplashFader', True) as TFader;
- GameOverFader := Core.Root.GetChildByName('GameOverFader', True) as TFader;
- // Load GUI forms list
- GUIHelper.LoadForms('game.gui');
- // Read high scores
- try
- HSList := Core.Root.GetChildByName('HiScoresList', True) as TList;
- HSList.Items.TotalItems := HighScoresCount;
- AssignFile(TF, 'HIScore.dat'); Reset(TF);
- for i := 0 to HSList.Items.TotalItems-1 do begin
- ReadLn(TF, s);
- HSList.Items[i] := s;
- end;
- CloseFile(TF);
- except
- end;
- // Check for errors
- if not Assigned(World) then begin
- Log.Log('An item of the class TGameWorld not found in the scene', lkFatalError);
- Starter.Terminate;
- Exit;
- end;
- // Logon user and load user's profile from file "player.pfl". The settings will override current config.
- LogOn('Player');
- // Load sounds
- SoundsDir := Starter.ProgramWorkDir + RelSoundsDir;
- World.Sound := TAudiereSound.Create(Core.Timer);
- World.Sound.Load('Step', SoundsDir + 'step.wav', False);
- World.Sound.Load('Click', SoundsDir + 'click.wav', False);
- World.Sound.Load('Pickup', SoundsDir + 'pickup.wav', False);
- World.Sound.Load('Warning', SoundsDir + 'warning.wav', False);
- World.Sound.Load('Breakin', SoundsDir + 'breakin.wav', False);
- World.Sound.Load('Dig', SoundsDir + 'dig.wav', False);
- World.Sound.Load('DigEnd', SoundsDir + 'digend.wav', False);
- World.Sound.Load('Fire', SoundsDir + 'fire.wav', False);
- World.Sound.Load('Gold', SoundsDir + 'gold.wav', False);
- World.Sound.Load('Die', SoundsDir + 'die.wav', False);
- World.Sound.Load('Music', SoundsDir + 'game.xm', False);
- // Set minimum delay between steps
- World.Sound.SetDelay('Step', 0.400);
- World.Sound.SetVolume('Step', 35);
- // Cycle music
- World.Sound.SetRepeat('Music', True);
- World.Sound.SetVolume('Music', 25);
- // Turn the music on
- World.Sound.Play('Music');
- // Apply audio options such as master volume, etc
- ApplyAudioOptions;
- end;
- procedure TDLApp.CreateCore(CoreClass: CCore);
- begin
- inherited;
- GWorld.Core := Core;
- // Register item classes
- Core.RegisterItemClasses(Resources.GetUnitClassList); // Base resources
- Core.RegisterItemClasses(BaseGraph.GetUnitClassList); // Base graphics
- // Engine classes
- Core.RegisterItemClasses(C2Core.GetUnitClassList); // Engine general classes
- Core.RegisterItemClasses(C2Res.GetUnitClassList); // CAST II resource
- Core.RegisterItemClasses(C2VisItems.GetUnitClassList); // Some visible item classes
- Core.RegisterItemClasses(C2Anim.GetUnitClassList); // Animated item classes
- Core.RegisterItemClasses(C22D.GetUnitClassList); // 2D via CAST II wrapper classes
- Core.RegisterItemClasses(C2FX.GetUnitClassList); // Some visual effects classes
- Core.RegisterItemClasses(C2Land.GetUnitClassList); // Landscape classes
- Core.RegisterItemClasses(C2TileMaps.GetUnitClassList); // Tilemap classes
- // ACS classes
- Core.RegisterItemClasses(ACS.GetUnitClassList); // Base controls
- Core.RegisterItemClasses(ACSAdv.GetUnitClassList); // Advanced controls
- Core.RegisterItemClasses(C2GUI.GetUnitClassList); // CAST II wrapper classes
- // Partcile system classes
- Core.RegisterItemClasses(C2Affectors.GetUnitClassList); // Base particle system related classes
- // Game specific classes
- Core.RegisterItemClasses(GWorld.GetUnitClassList); // Advanced particle system related classes
- end;
- procedure TDLApp.PreviewOptions(OptionName, Value: string);
- begin
- inherited;
- // ApplyAudioOptions;
- if OptionName = 'SOUNDVOLUME' then World.Sound.SetVolume('', StrToIntDef(Value, 50)); // Master volume
- if OptionName = 'MUSICVOLUME' then World.Sound.SetVolume('Music', StrToIntDef(Value, 50));
- end;
- procedure TDLApp.ApplyOptionSet(const OptionSet: string);
- begin
- inherited;
- if OptionSet = 'AUDIOOPTIONS' then ApplyAudioOptions;
- end;
- procedure TDLApp.ApplyOptions;
- begin
- inherited;
- ApplyAudioOptions;
- end;
- function TDLApp.ApplyAudioOptions: Boolean;
- begin
- Result := True;
- if not Assigned(World) or not Assigned(World.Sound) then Exit;
- World.Sound.SetVolume('', StrToIntDef(Config['SoundVolume'], 50)); // Master volume
- World.Sound.SetVolume('Music', StrToIntDef(Config['MusicVolume'], 50));
- end;
- function TDLApp.ApplyVideoOptions: Boolean;
- begin
- Result := inherited ApplyVideoOptions;
- if Assigned(World) and Assigned(World.Map) then begin
- { if Config['Bump'] = OnOffStr[True] then begin
- World.BgMap.CurTechnique := World.BgMap.Material.GetChildByName('DOT3 Bump', False) as TTechnique;
- World.Map.CurTechnique := World.Map.Material.GetChildByName('DOT3 Bump', False) as TTechnique;
- end else begin
- World.BgMap.CurTechnique := World.BgMap.Material.GetChildByName('Diffuse', False) as TTechnique;
- World.Map.CurTechnique := World.Map.Material.GetChildByName('Diffuse', False) as TTechnique;
- end;}
- end;
- end;
- destructor TDLApp.Destroy;
- var
- i: Integer; HSList: TList; TF: Text;
- begin
- if Assigned(World) then FreeAndNil(World.Sound);
- // Write high scores to file
- HSList := Core.Root.GetChildByName('HiScoresList', True) as TList;
- AssignFile(TF, 'HIScore.dat');
- try
- Rewrite(TF);
- for i := 0 to HSList.Items.TotalItems-1 do WriteLn(TF, HSList.Items[i]);
- CLoseFile(TF);
- except
- end;
- FreeAndNil(DefaultConfig);
- FreeAndNil(GUIHelper);
- inherited;
- end;
- procedure TDLApp.Init;
- var i: TGameItem; s: string; Button: TGUIItem;
- begin
- // Game world initialization
- World.Init;
- ApplyVideoOptions;
- // Set current game state to intro
- GameState := gsIntro;
- // Fill shop list GUI element
- for i := Low(TGameItem) to High(TGameItem) do begin
- s := s + Format('%S (%D gold)', [ItemNames[i], ItemPrices[i]]);
- if i < High(TGameItem) then s := s + '&';
- end;
- ShopItemsList := Core.Root.GetChildByName('ShopItemList', True) as TList;
- ShopItemsList.Items.VariantsText := s;
- Button := Core.Root.GetChildByName('MenuCloseBut', True) as TGUIItem;
- Button.IsEnabledDelegate := IsMenuBackEnabled;
- Button := Core.Root.GetChildByName('SaveBut', True) as TGUIItem;
- Button.IsEnabledDelegate := IsMenuSaveEnabled;
- Button := Core.Root.GetChildByName('LoadBut', True) as TGUIItem;
- Button.IsEnabledDelegate := IsMenuLoadEnabled;
- TargetTileX := -1;
- end;
- procedure TDLApp.PrintMessage(const Text: string);
- begin
- Inc(MessageID);
- GUIHelper.SetControlText('Message', Text);
- Core.Timer.SetEvent(MessageTimeout, ClearMessage, MessageID);
- end;
- procedure TDLApp.ProcessMouseControl;
- var PlTileX, PlTileY: Integer;
- begin
- if TargetTileX = -1 then Exit;
- World.Map.ObtainTileAt(World.Player.GetAbsLocation.X, World.Player.GetAbsLocation.Y, PlTileX, PlTileY);
- if TargetTileX < PlTileX then World.Player.Action := caMoveLeft;
- if TargetTileX > PlTileX then World.Player.Action := caMoveRight;
- end;
- procedure TDLApp.HandleMouseControl(MX, MY: Integer);
- var TileX, TileY, PlTileX, PlTileY: Integer;
- begin
- World.Map.ObtainTileAtScreen(MX, MY, Core.Renderer.MainCamera, TileX, TileY);
- TargetTileX := TileX;
- World.Map.ObtainTileAt(World.Player.GetAbsLocation.X, World.Player.GetAbsLocation.Y, PlTileX, PlTileY);
- if Abs(TargetTileX - PlTileX) <= 1 then World.Player.PerformAction;
- end;
- procedure TDLApp.OnGUIClick(Item: TGUIItem);
- var i, ItemIndex: Integer; AllowBuy: Boolean; ii: TGameItem;
- begin
- if Item is TButton then World.Sound.Play('Click');
- if Item.Name = 'CreditsLink' then GotoURL(GameInfoURL);
- // Menu
- if (Item.Name = 'MenuToggleBut') or (Item.Name = 'MenuCloseBut') then begin
- HandleMessage(TMenuToggleMsg.Create);
- end;
- if Item.Name = 'NewGameInvoke' then begin
- UpdateHighScores;
- GameState := gsPlay;
- World.StartNewGame;
- ApplyVideoOptions;
- HandleMessage(TMenuToggleMsg.Create);
- end;
- if Item.Name = 'SaveBut' then begin
- World.SaveGame(Config['UserName'] + '.sg');
- GameState := gsPlay;
- HandleMessage(TMenuToggleMsg.Create);
- PrintMessage('Game saved');
- end;
- if Item.Name = 'LoadBut' then begin
- UpdateHighScores;
- World.LoadGame(Config['UserName'] + '.sg');
- GUIHelper.HideControl('Shop');
- GameState := gsPlay;
- ApplyVideoOptions;
- HandleMessage(TMenuToggleMsg.Create);
- PrintMessage('Game loaded');
- end;
- // Shop
- if Item.Name = 'SellAllBut' then begin
- for i := 0 to TotalGemTypes-1 do begin
- Inc(World.Player.Inventory.Gold, GemPrices[i] * World.Player.Inventory.Gems[i]);
- World.Player.Inventory.Gems[i] := 0;
- World.Sound.Play('Gold');
- OpenShop;
- end;
- OpenShop;
- end;
- if Item.Name = 'BuyBut' then begin
- ItemIndex := ShopItemsList.ItemIndex;
- if (ItemIndex >= 0) then begin
- if (World.Player.Inventory.Gold >= ItemPrices[TGameItem(ItemIndex)]) then begin
- if (World.Player.Inventory.Capacity-World.Player.Inventory.Occupied >= MaxI(0, ItemSizes[TGameItem(ItemIndex)])) then begin
- AllowBuy := True;
- for ii := High(TGameItem) downto Low(TGameItem) do
- if (ItemGroups[TGameItem(ItemIndex)] < 0) and (ItemGroups[TGameItem(ItemIndex)] = ItemGroups[ii]) then
- if (ItemIndex <= Ord(ii)) and (World.Player.Inventory.Items[ii] > 0) then begin
- AllowBuy := False;
- PrintMessage('You already have ' + ItemNames[ii]);
- end else World.Player.Inventory.Items[ii] := 0;
- if AllowBuy then begin
- World.Sound.Play('Gold');
- Dec(World.Player.Inventory.Gold, ItemPrices[TGameItem(ItemIndex)]);
- Inc(World.Player.Inventory.Items[TGameItem(ItemIndex)]);
- end else World.Sound.Play('Warning');
- end else begin
- PrintMessage('Not enough inventory space!');
- World.Sound.Play('Warning');
- end;
- end else begin
- PrintMessage('Not enough gold!');
- World.Sound.Play('Warning');
- end;
- end;
- OpenShop;
- end;
- // Help
- if Item.Name = 'HelpMainShow' then begin
- GUIHelper.HideControl('HelpItems');
- GUIHelper.HideControl('HelpControls');
- end;
- if Item.Name = 'HelpItemsShow' then begin
- GUIHelper.HideControl('HelpMain');
- GUIHelper.HideControl('HelpControls');
- end;
- if Item.Name = 'HelpControlsShow' then begin
- GUIHelper.HideControl('HelpMain');
- GUIHelper.HideControl('HelpItems');
- end;
- end;
- procedure TDLApp.HandleMessage(const Msg: TMessage);
- begin
- if Starter.Terminated then Exit;
- inherited;
- if Assigned(World) then World.HandleMessage(Msg);
- // Skip intros when a mouse clicked or by timeout
- if (Msg.ClassType = TMouseDownMsg) or (Msg.ClassType = TTimeOutMsg) then
- case GameState of
- gsPlay: if Msg.ClassType = TMouseDownMsg then with TMouseDownMsg(Msg) do // Handle character moving with mouse
- if not GUIHelper.IsWithinGUI(X, Y) then HandleMouseControl(X, Y);
- gsMenu: ;
- else GoToNextGameState;
- end;
- if Assigned(GUIHelper) then begin
- GUIHelper.HandleMessage(Msg);
- if Msg.ClassType = TInventoryToggleMsg then if GameState = gsPlay then GUIHelper.ToggleControl('Inventory');
- if Msg.ClassType = TMenuToggleMsg then begin
- if GUIHelper.IsControlVisible('Menu', False) then begin
- if IsMenuBackEnabled(nil) then GUIHelper.HideControl('Menu');
- end else GUIHelper.ShowControl('Menu');
- Core.Paused := GUIHelper.IsControlVisible('Menu', False);
- end;
- if Msg.ClassType = THelpToggleMsg then GUIHelper.ToggleControl('HelpMain');
- end;
- // Input messages
- if Msg.ClassType = TGameActionMsg then World.Player.PerformAction;
- if Msg.ClassType = TFireMsg then World.Player.Fire;
- if Msg.ClassType = TTeleportUseMsg then World.Player.PerformTeleport;
- // Gameplay messages
- // A gem was picked up
- if Msg.ClassType = TGemPickedUpMsg then with TGemPickedUpMsg(Msg) do begin
- PrintMessage( GemNames[GemType-1] + ' collected');
- World.Sound.Play('Pickup');
- end;
- // Some item is needed to perform an action
- if Msg.ClassType = TItemLackMsg then with TItemLackMsg(Msg) do begin
- PrintMessage('[#FF0000]' + ItemNames[ItemType] + ' needed!');
- World.Sound.Play('Warning');
- end;
- // Gameplay GUI messages
- if Msg.ClassType = TShopOpenMsg then OpenShop;
- if Msg.ClassType = TShopCloseMsg then GUIHelper.HideControl('Shop');
- if Msg.ClassType = TGUIClickMsg then OnGUIClick((Msg as TGUIClickMsg).Item);
- if Msg.ClassType = TGameOverMsg then begin
- UpdateHighScores;
- GameState := gsGameOver;
- World.Sound.Play('Die');
- end;
- // Cheats
- if (Msg is TCheatCodeMsg) and (GameState = gsPlay) then begin
- if Msg.ClassType = TGodModeToggleMsg then World.GodMode := True;
- if Msg.ClassType = TThousandTorchesMsg then begin
- World.Player.Inventory.Items[giTorch] := 1000;
- World.Sound.Play('Fire');
- end;
- if Msg.ClassType = TGiveMoneyMsg then begin
- World.Player.Inventory.Gold := 100000;
- World.Sound.Play('Gold');
- end;
- PrintMessage('Cheater');
- end;
- end;
- procedure TDLApp.Process;
- procedure DrawInventory;
- var i: Integer; ii: TGameItem; s: string;
- begin
- GUIHelper.SetControlText('InventoryTitle', Format('Inventory (%D/%D)', [World.Player.Inventory.Occupied, World.Player.Inventory.Capacity]));
- s := 'Gold: ' + IntToStr(World.Player.Inventory.Gold) + ' [E]';
- for ii := Low(TGameItem) to High(TGameItem) do if World.Player.Inventory.Items[ii] > 0 then
- s := s + Format('%S: %D [E]', [ItemNames[ii], World.Player.Inventory.Items[ii]]);
- for i := 0 to TotalGemTypes-1 do
- s := s + Format('[#%S]%S[#]: %D [E]', [GemColors[i], GemNames[i], World.Player.Inventory.Gems[i]]);
- GUIHelper.SetControlText('InventoryInfo', s);
- // HUD
- if World.Player.IsInLight then s := '' else s := '[#FFFF0000]!!![#]';
- GUIHelper.SetControlText('HUDTorches', Format('%s T: %D, I: %D', [s, World.Player.Inventory.Items[giTorch], World.Player.Inventory.Capacity - World.Player.Inventory.Occupied]));
- GUIHelper.SetControlText('HUDMoney', 'Gold: ' + IntToStr(World.Player.Inventory.Gold));
- GUIHelper.SetControlText('HUDScore', 'Score: ' + IntToStr(World.Player.Score));
- end;
- begin
- inherited;
- GUIHelper.SetControlText('FPSCounter', Format('FPS: %3.1F', [Core.PerfProfile.FramesPerSecond]));
- DrawInventory;
- // Convert application actions to character's actions
- if Action['Right'] then World.Player.Action := caMoveRight else
- if Action['Left'] then World.Player.Action := caMoveLeft else
- World.Player.Action := caNone;
- if Action['Forward'] then World.Player.Action := caJump;
- if Action['Left'] or Action['Right'] or Action['Forward'] then TargetTileX := -1;
- ProcessMouseControl;
- end;
- procedure TDLApp.UpdateHighScores;
- var HSList: TList;
- begin
- HSList := Core.Root.GetChildByName('HiScoresList', True) as TList;
- HSList.Items.Add(Format('%8.8D - Player', [World.Player.Score]));
- HSList.Items.Sort(False, nil);
- HSList.Items.TotalItems := HighScoresCount;
- end;
- procedure TDLApp.GoToNextGameState;
- begin
- case FGameState of
- gsIntro: GameState := gsMenu;
- gsMenu: GameState := gsMenu;
- gsPlay: GameState := gsPlay;
- gsGameOver: GameState := gsMenu;
- gsOutro: GameState := gsCredits;
- gsCredits: GameState := gsMenu;
- end;
- end;
- end.