- Added option to toggle animated tiles

- Added option to toggle the security question when performing area commands
This commit is contained in:
Andreas Schneider 2009-12-10 14:30:47 +01:00
parent 222abd54fd
commit 9c010eeb89
3 changed files with 50 additions and 10 deletions

View File

@ -102,8 +102,10 @@ type
FArtCache: TMaterialCache; FArtCache: TMaterialCache;
FFlatLandArtCache: TMaterialCache; FFlatLandArtCache: TMaterialCache;
FTexCache: TMaterialCache; FTexCache: TMaterialCache;
FAnimations: TMaterialCache; FAnimCache: TMaterialCache;
FUseAnims: Boolean;
public public
property UseAnims: Boolean read FUseAnims write FUseAnims;
function GetArtMaterial(ATileID: Word): TMaterial; overload; function GetArtMaterial(ATileID: Word): TMaterial; overload;
function GetArtMaterial(ATileID: Word; AHue: THue; function GetArtMaterial(ATileID: Word; AHue: THue;
APartialHue: Boolean): TMaterial; overload; APartialHue: Boolean): TMaterial; overload;
@ -309,7 +311,8 @@ begin
FArtCache := TMaterialCache.Create(1024); FArtCache := TMaterialCache.Create(1024);
FFlatLandArtCache := TMaterialCache.Create(128); FFlatLandArtCache := TMaterialCache.Create(128);
FTexCache := TMaterialCache.Create(128); FTexCache := TMaterialCache.Create(128);
FAnimations := TMaterialCache.Create(128); FAnimCache := TMaterialCache.Create(128);
FUseAnims := True;
end; end;
destructor TLandTextureManager.Destroy; destructor TLandTextureManager.Destroy;
@ -317,7 +320,7 @@ begin
FreeAndNil(FArtCache); FreeAndNil(FArtCache);
FreeAndNil(FFlatLandArtCache); FreeAndNil(FFlatLandArtCache);
FreeAndNil(FTexCache); FreeAndNil(FTexCache);
FreeAndNil(FAnimations); FreeAndNil(FAnimCache);
inherited Destroy; inherited Destroy;
end; end;
@ -328,14 +331,14 @@ var
begin begin
Result := nil; Result := nil;
if (ATileID >= $4000) and (tdfAnimation in if FUseAnims and (ATileID >= $4000) and (tdfAnimation in
ResMan.Tiledata.StaticTiles[ATileID -$4000].Flags) then ResMan.Tiledata.StaticTiles[ATileID -$4000].Flags) then
begin begin
animData := ResMan.Animdata.AnimData[ATileID - $4000]; 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 begin
Result := TAnimMaterial.Create(ATileID, animData); Result := TAnimMaterial.Create(ATileID, animData);
FAnimations.StoreID(ATileID, Result); FAnimCache.StoreID(ATileID, Result);
end; end;
end; end;
@ -365,14 +368,14 @@ begin
Result := nil; Result := nil;
id := ATileID or ((AHue.ID and $3FFF) shl 16) or (Byte(APartialHue) shl 30); 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 ResMan.Tiledata.StaticTiles[ATileID -$4000].Flags) then
begin begin
animData := ResMan.Animdata.AnimData[ATileID - $4000]; 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 begin
Result := TAnimMaterial.Create(ATileID, animData, AHue, APartialHue); Result := TAnimMaterial.Create(ATileID, animData, AHue, APartialHue);
FAnimations.StoreID(id, Result); FAnimCache.StoreID(id, Result);
end; end;
end; end;

View File

@ -16,7 +16,7 @@ object frmMain: TfrmMain
OnCreate = FormCreate OnCreate = FormCreate
OnDestroy = FormDestroy OnDestroy = FormDestroy
Position = poScreenCenter 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 ShowInTaskBar = stAlways
LCLVersion = '0.9.29' LCLVersion = '0.9.29'
WindowState = wsMaximized WindowState = wsMaximized
@ -1423,6 +1423,22 @@ object frmMain: TfrmMain
OnClick = mnuLargeScaleCommandsClick OnClick = mnuLargeScaleCommandsClick
end end
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 object mnuHelp: TMenuItem
Caption = '&?' Caption = '&?'
object mnuAbout: TMenuItem object mnuAbout: TMenuItem
@ -2627,6 +2643,7 @@ object frmMain: TfrmMain
StoredValues = <> StoredValues = <>
RootNodePath = 'Forms/frmMain' RootNodePath = 'Forms/frmMain'
Active = False Active = False
OnRestoreProperties = XMLPropStorage1RestoreProperties
left = 368 left = 368
top = 208 top = 208
end end

View File

@ -88,6 +88,9 @@ type
lblY: TLabel; lblY: TLabel;
lbClients: TListBox; lbClients: TListBox;
MainMenu1: TMainMenu; MainMenu1: TMainMenu;
mnuSecurityQuestion: TMenuItem;
mnuShowAnimations: TMenuItem;
mnuSettings: TMenuItem;
mnuFlatShowHeight: TMenuItem; mnuFlatShowHeight: TMenuItem;
mnuGrabHue: TMenuItem; mnuGrabHue: TMenuItem;
mnuGrabTileID: TMenuItem; mnuGrabTileID: TMenuItem;
@ -209,6 +212,7 @@ type
procedure mnuGrabTileIDClick(Sender: TObject); procedure mnuGrabTileIDClick(Sender: TObject);
procedure mnuLargeScaleCommandsClick(Sender: TObject); procedure mnuLargeScaleCommandsClick(Sender: TObject);
procedure mnuRegionControlClick(Sender: TObject); procedure mnuRegionControlClick(Sender: TObject);
procedure mnuShowAnimationsClick(Sender: TObject);
procedure mnuShutdownClick(Sender: TObject); procedure mnuShutdownClick(Sender: TObject);
procedure oglGameWindowDblClick(Sender: TObject); procedure oglGameWindowDblClick(Sender: TObject);
procedure oglGameWindowKeyDown(Sender: TObject; var Key: Word; procedure oglGameWindowKeyDown(Sender: TObject; var Key: Word;
@ -274,6 +278,7 @@ type
Column: TColumnIndex; const NewText: String); Column: TColumnIndex; const NewText: String);
procedure vstLocationsSaveNode(Sender: TBaseVirtualTree; procedure vstLocationsSaveNode(Sender: TBaseVirtualTree;
Node: PVirtualNode; Stream: TStream); Node: PVirtualNode; Stream: TStream);
procedure XMLPropStorage1RestoreProperties(Sender: TObject);
protected protected
{ Members } { Members }
FAppDir: String; FAppDir: String;
@ -468,6 +473,12 @@ begin
frmRegionControl.Show; frmRegionControl.Show;
end; end;
procedure TfrmMain.mnuShowAnimationsClick(Sender: TObject);
begin
FTextureManager.UseAnims := mnuShowAnimations.Checked;
RebuildScreenBuffer;
end;
procedure TfrmMain.mnuShutdownClick(Sender: TObject); procedure TfrmMain.mnuShutdownClick(Sender: TObject);
begin begin
dmNetwork.Send(TQuitServerPacket.Create('')); dmNetwork.Send(TQuitServerPacket.Create(''));
@ -1691,6 +1702,11 @@ begin
Stream.Write(locationInfo^.Name[1], stringLength); Stream.Write(locationInfo^.Name[1], stringLength);
end; end;
procedure TfrmMain.XMLPropStorage1RestoreProperties(Sender: TObject);
begin
FTextureManager.UseAnims := mnuShowAnimations.Checked;
end;
procedure TfrmMain.SetX(const AValue: Integer); procedure TfrmMain.SetX(const AValue: Integer);
begin begin
SetPos(AValue, FY); SetPos(AValue, FY);
@ -2775,6 +2791,10 @@ begin
begin begin
Result := frmMoveSettings.ShowModal = mrYes; Result := frmMoveSettings.ShowModal = mrYes;
end else end else
if not mnuSecurityQuestion.Checked then
begin
Result := True;
end else
begin begin
frmConfirmation.Left := Mouse.CursorPos.x - frmConfirmation.btnYes.Left - frmConfirmation.btnYes.Width div 2; 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; frmConfirmation.Top := Mouse.CursorPos.y - frmConfirmation.btnYes.Top - frmConfirmation.btnYes.Height div 2;