diff --git a/Client/ULandscape.pas b/Client/ULandscape.pas index 8490c9b..a317826 100644 --- a/Client/ULandscape.pas +++ b/Client/ULandscape.pas @@ -102,8 +102,10 @@ type FArtCache: TMaterialCache; FFlatLandArtCache: TMaterialCache; FTexCache: TMaterialCache; - FAnimations: TMaterialCache; + FAnimCache: TMaterialCache; + FUseAnims: Boolean; public + property UseAnims: Boolean read FUseAnims write FUseAnims; function GetArtMaterial(ATileID: Word): TMaterial; overload; function GetArtMaterial(ATileID: Word; AHue: THue; APartialHue: Boolean): TMaterial; overload; @@ -309,7 +311,8 @@ begin FArtCache := TMaterialCache.Create(1024); FFlatLandArtCache := TMaterialCache.Create(128); FTexCache := TMaterialCache.Create(128); - FAnimations := TMaterialCache.Create(128); + FAnimCache := TMaterialCache.Create(128); + FUseAnims := True; end; destructor TLandTextureManager.Destroy; @@ -317,7 +320,7 @@ begin FreeAndNil(FArtCache); FreeAndNil(FFlatLandArtCache); FreeAndNil(FTexCache); - FreeAndNil(FAnimations); + FreeAndNil(FAnimCache); inherited Destroy; end; @@ -328,14 +331,14 @@ var begin Result := nil; - if (ATileID >= $4000) and (tdfAnimation in + if FUseAnims and (ATileID >= $4000) and (tdfAnimation in ResMan.Tiledata.StaticTiles[ATileID -$4000].Flags) then begin animData := ResMan.Animdata.AnimData[ATileID - $4000]; - if (animData.FrameCount > 0) and not FAnimations.QueryID(ATileID, Result) then + if (animData.FrameCount > 0) and not FAnimCache.QueryID(ATileID, Result) then begin Result := TAnimMaterial.Create(ATileID, animData); - FAnimations.StoreID(ATileID, Result); + FAnimCache.StoreID(ATileID, Result); end; end; @@ -365,14 +368,14 @@ begin Result := nil; id := ATileID or ((AHue.ID and $3FFF) shl 16) or (Byte(APartialHue) shl 30); - if (ATileID >= $4000) and (tdfAnimation in + if FUseAnims and (ATileID >= $4000) and (tdfAnimation in ResMan.Tiledata.StaticTiles[ATileID -$4000].Flags) then begin animData := ResMan.Animdata.AnimData[ATileID - $4000]; - if (animData.FrameCount > 0) and not FAnimations.QueryID(id, Result) then + if (animData.FrameCount > 0) and not FAnimCache.QueryID(id, Result) then begin Result := TAnimMaterial.Create(ATileID, animData, AHue, APartialHue); - FAnimations.StoreID(id, Result); + FAnimCache.StoreID(id, Result); end; end; diff --git a/Client/UfrmMain.lfm b/Client/UfrmMain.lfm index 215281a..dfca3f5 100644 --- a/Client/UfrmMain.lfm +++ b/Client/UfrmMain.lfm @@ -16,7 +16,7 @@ object frmMain: TfrmMain OnCreate = FormCreate OnDestroy = FormDestroy Position = poScreenCenter - SessionProperties = 'Height;Left;Top;Width;WindowState;acFlat.Checked;acNoDraw.Checked;tbStatics.Down;tbTerrain.Down;mnuFlatShowHeight.Checked' + SessionProperties = 'acFlat.Checked;acNoDraw.Checked;Height;Left;mnuFlatShowHeight.Checked;tbStatics.Down;tbTerrain.Down;Top;Width;WindowState;mnuShowAnimations.Checked;mnuSecurityQuestion.Checked' ShowInTaskBar = stAlways LCLVersion = '0.9.29' WindowState = wsMaximized @@ -1423,6 +1423,22 @@ object frmMain: TfrmMain OnClick = mnuLargeScaleCommandsClick end end + object mnuSettings: TMenuItem + Caption = '&Settings' + object mnuShowAnimations: TMenuItem + AutoCheck = True + Caption = '&Animations' + Checked = True + Hint = 'Toggles whether to animate tiles or not.' + OnClick = mnuShowAnimationsClick + end + object mnuSecurityQuestion: TMenuItem + AutoCheck = True + Caption = '&Security question' + Checked = True + Hint = 'Ask for permission before processing area commands.' + end + end object mnuHelp: TMenuItem Caption = '&?' object mnuAbout: TMenuItem @@ -2627,6 +2643,7 @@ object frmMain: TfrmMain StoredValues = <> RootNodePath = 'Forms/frmMain' Active = False + OnRestoreProperties = XMLPropStorage1RestoreProperties left = 368 top = 208 end diff --git a/Client/UfrmMain.pas b/Client/UfrmMain.pas index eb7a274..554e687 100644 --- a/Client/UfrmMain.pas +++ b/Client/UfrmMain.pas @@ -88,6 +88,9 @@ type lblY: TLabel; lbClients: TListBox; MainMenu1: TMainMenu; + mnuSecurityQuestion: TMenuItem; + mnuShowAnimations: TMenuItem; + mnuSettings: TMenuItem; mnuFlatShowHeight: TMenuItem; mnuGrabHue: TMenuItem; mnuGrabTileID: TMenuItem; @@ -209,6 +212,7 @@ type procedure mnuGrabTileIDClick(Sender: TObject); procedure mnuLargeScaleCommandsClick(Sender: TObject); procedure mnuRegionControlClick(Sender: TObject); + procedure mnuShowAnimationsClick(Sender: TObject); procedure mnuShutdownClick(Sender: TObject); procedure oglGameWindowDblClick(Sender: TObject); procedure oglGameWindowKeyDown(Sender: TObject; var Key: Word; @@ -274,6 +278,7 @@ type Column: TColumnIndex; const NewText: String); procedure vstLocationsSaveNode(Sender: TBaseVirtualTree; Node: PVirtualNode; Stream: TStream); + procedure XMLPropStorage1RestoreProperties(Sender: TObject); protected { Members } FAppDir: String; @@ -468,6 +473,12 @@ begin frmRegionControl.Show; end; +procedure TfrmMain.mnuShowAnimationsClick(Sender: TObject); +begin + FTextureManager.UseAnims := mnuShowAnimations.Checked; + RebuildScreenBuffer; +end; + procedure TfrmMain.mnuShutdownClick(Sender: TObject); begin dmNetwork.Send(TQuitServerPacket.Create('')); @@ -1691,6 +1702,11 @@ begin Stream.Write(locationInfo^.Name[1], stringLength); end; +procedure TfrmMain.XMLPropStorage1RestoreProperties(Sender: TObject); +begin + FTextureManager.UseAnims := mnuShowAnimations.Checked; +end; + procedure TfrmMain.SetX(const AValue: Integer); begin SetPos(AValue, FY); @@ -2775,6 +2791,10 @@ begin begin Result := frmMoveSettings.ShowModal = mrYes; end else + if not mnuSecurityQuestion.Checked then + begin + Result := True; + end else begin frmConfirmation.Left := Mouse.CursorPos.x - frmConfirmation.btnYes.Left - frmConfirmation.btnYes.Width div 2; frmConfirmation.Top := Mouse.CursorPos.y - frmConfirmation.btnYes.Top - frmConfirmation.btnYes.Height div 2;