diff --git a/animate.lfm b/animate.lfm index e9518e7..d34bb9e 100644 --- a/animate.lfm +++ b/animate.lfm @@ -352,6 +352,10 @@ object AnimationForm: TAnimationForm Caption = 'Delete' OnClick = MenuItem11Click end + object MenuDeleteAll: TMenuItem + Caption = 'Delete All' + OnClick = MenuDeleteAllClick + end object MenuItem7: TMenuItem Caption = 'Export Anim As PNG''s' OnClick = AnimExportMenuClick diff --git a/animate.pas b/animate.pas index 5479c8e..0e4055a 100644 --- a/animate.pas +++ b/animate.pas @@ -26,6 +26,7 @@ TAnimationForm = class(TForm) MenuItem1: TMenuItem; MenuItem10: TMenuItem; MenuItem11: TMenuItem; + MenuDeleteAll: TMenuItem; MenuItem2: TMenuItem; MenuItem3: TMenuItem; MenuItem4: TMenuItem; @@ -70,10 +71,11 @@ TAnimationForm = class(TForm) procedure DeleteMenuClick(Sender: TObject); procedure FormActivate(Sender: TObject); procedure FormCreate(Sender: TObject); - procedure FormPaint(Sender: TObject); + procedure AnimExportMenuClick(Sender: TObject); procedure AnimCopyMenuClick(Sender: TObject); procedure AnimPasteMenuClick(Sender: TObject); + procedure MenuDeleteAllClick(Sender: TObject); procedure MenuItem10Click(Sender: TObject); procedure MenuItem11Click(Sender: TObject); procedure MenuItem2Click(Sender: TObject); @@ -108,6 +110,7 @@ TAnimationForm = class(TForm) procedure AddAnimation; procedure DeleteAnimation(AnimationIndex : integer); + procedure DeleteAll; procedure SelectAnimation(AnimationIndex : integer); end; @@ -123,18 +126,10 @@ implementation procedure TAnimationForm.FormCreate(Sender: TObject); begin -// SpriteListView.Hint:='hello'; -// SpriteListView.ShowHint:=true; - - // CurrentAnimListView.Hint:='hello2'; - // CurrentAnimListView.ShowHint:=true; FPSDelay:=1000 Div FPSTrackBar.Position; end; -procedure TAnimationForm.FormPaint(Sender: TObject); -begin - //CurrentAnimationImageList.Draw(Panel1.Canvas,10,10,AnimFrameCounter,true); -end; + procedure TAnimationForm.AnimExportMenuClick(Sender: TObject); var @@ -199,6 +194,11 @@ procedure TAnimationForm.AnimPasteMenuClick(Sender: TObject); end; end; +procedure TAnimationForm.MenuDeleteAllClick(Sender: TObject); +begin + DeleteAll; +end; + procedure TAnimationForm.MenuItem10Click(Sender: TObject); begin AddEmptyFrame; @@ -267,6 +267,18 @@ procedure TAnimationForm.DeleteAnimation(AnimationIndex : integer); AllAnimListView.Repaint; end; +procedure TAnimationForm.DeleteAll; +begin + AnimateBase.DeleteAll; + AnimateBase.AddAnimation; //we need atleast one animation + + LoadCurrentAnimList; + LoadAnimThumbList; + + CurrentAnimListView.Repaint; + AllAnimListView.Repaint; +end; + procedure TAnimationForm.SelectAnimation(AnimationIndex : integer); begin AnimateBase.SetCurrentAnimation(AnimationIndex); @@ -623,7 +635,13 @@ procedure TAnimationForm.CopyMenuClick(Sender: TObject); index : integer; begin index:=CurrentAnimListView.ItemIndex; - if index > -1 then AnimateBase.CopyToClipBoard(AnimateBase.GetImageIndex(index),AnimateBase.GetUID(index)); + if index > -1 then + begin + if AnimateBase.GetImageIndex(index) > -1 then //prevent copying empty frame - just use add frame + begin + AnimateBase.CopyToClipBoard(AnimateBase.GetImageIndex(index),AnimateBase.GetUID(index)); + end; + end; // info.Caption:='Copy: '+IntToStr(index)+' '+IntToStr(AnimateBase.GetImageIndex(index)); end; @@ -637,7 +655,7 @@ procedure TAnimationForm.DeleteMenuClick(Sender: TObject); begin index:=CurrentAnimListView.ItemIndex; // info.Caption:='Delete: '+IntToStr(index)+' '+IntToStr(AnimateBase.GetImageIndex(index)); - DeleteFrame(Index); + if index > -1 then DeleteFrame(Index); end; end. diff --git a/animbase.pas b/animbase.pas index e41f593..bcbb5ea 100644 --- a/animbase.pas +++ b/animbase.pas @@ -47,6 +47,8 @@ interface procedure AddAnimation; procedure DeleteAnimation(AnimationIndex : integer); + procedure DeleteAll; + procedure InitAnimation; function GetAnimationCount : integer; @@ -100,6 +102,11 @@ procedure TAnimateBase.InitAnimation; Animations.AnimationList[Animations.CurrentAnimation].FrameCount:=0; end; +procedure TAnimateBase.DeleteAll; +begin + InitAnimation; +end; + procedure TAnimateBase.InitClipBoard; begin AnimClipBoard.ClipBoardStatus:=False; diff --git a/mapcore.pas b/mapcore.pas index 1c7cc5b..2c9ddfc 100644 --- a/mapcore.pas +++ b/mapcore.pas @@ -90,7 +90,9 @@ interface CurrentMap : integer; MapCount : integer; + constructor Create; + procedure Init; procedure SetListSize(size : integer); @@ -190,21 +192,27 @@ implementation constructor TMapCoreBase.Create; begin - SetCurrentMap(0); - SetListSize(MaxListSize); - SetZoomSize(0,4); - // SetMapSize(0,DefMaxMapWidth,DefMaxMapHeight); - SetMapSize(0,16,16); - SetMapTileSize(0,64,64); - SetMapCount(1); - SetMapGridStatus(0,1); //grid on - SetMapClipStatus(0,0); //clip off - SetMapDrawTool(0,1); //pencil - SetMapTileMode(0,1); //draw - SetMapScrollVertPos(0,0); - SetMapScrollHorizPos(0,0); - CopyToUndo(0); //copy map 0 to undo - to init it - InitClipBoard; + Init; +end; + +procedure TMapCoreBase.Init; +begin + SetCurrentMap(0); + SetListSize(MaxListSize); + SetZoomSize(0,4); + // SetMapSize(0,DefMaxMapWidth,DefMaxMapHeight); + SetMapSize(0,16,16); + SetMapTileSize(0,64,64); + SetMapCount(1); + SetMapGridStatus(0,1); //grid on + SetMapClipStatus(0,0); //clip off + SetMapDrawTool(0,1); //pencil + SetMapTileMode(0,1); //draw + SetMapScrollVertPos(0,0); + SetMapScrollHorizPos(0,0); + CopyToUndo(0); //copy map 0 to undo - to init it + InitClipBoard; + end; procedure TMapCoreBase.SetListSize(size : integer); diff --git a/mapeditor.lfm b/mapeditor.lfm index 6897766..b384c97 100644 --- a/mapeditor.lfm +++ b/mapeditor.lfm @@ -1,7 +1,7 @@ object MapEdit: TMapEdit - Left = 237 + Left = 175 Height = 860 - Top = 153 + Top = 269 Width = 1491 Caption = 'Map Editor' ClientHeight = 860 @@ -38,11 +38,11 @@ object MapEdit: TMapEdit AnchorSideRight.Side = asrBottom AnchorSideBottom.Control = LeftVertSplitter Left = 1 - Height = 221 + Height = 287 Top = 1 Width = 287 Anchors = [akTop, akLeft, akRight, akBottom] - ClientHeight = 221 + ClientHeight = 287 ClientWidth = 287 ParentFont = False TabOrder = 0 @@ -50,11 +50,12 @@ object MapEdit: TMapEdit AnchorSideLeft.Control = SelectedTilePanel AnchorSideTop.Control = SelectedTilePanel Left = 13 - Height = 90 + Height = 256 Top = 13 - Width = 90 + Width = 256 BorderSpacing.Left = 12 BorderSpacing.Top = 12 + ImageWidth = 256 end end object LeftVertSplitter: TSplitter @@ -66,7 +67,7 @@ object MapEdit: TMapEdit Cursor = crVSplit Left = 1 Height = 9 - Top = 222 + Top = 288 Width = 287 Align = alNone Anchors = [akLeft, akRight] @@ -84,19 +85,19 @@ object MapEdit: TMapEdit AnchorSideBottom.Control = LeftPanel AnchorSideBottom.Side = asrBottom Left = 1 - Height = 628 - Top = 231 + Height = 562 + Top = 297 Width = 287 Anchors = [akTop, akLeft, akRight, akBottom] Caption = 'LeftBottomPanel' - ClientHeight = 628 + ClientHeight = 562 ClientWidth = 287 ParentColor = False ParentFont = False TabOrder = 2 object TileListView: TListView Left = 1 - Height = 626 + Height = 560 Top = 1 Width = 285 Align = alClient @@ -553,6 +554,10 @@ object MapEdit: TMapEdit Caption = 'Delete' OnClick = MenuDeleteClick end + object MenuDeleteAll: TMenuItem + Caption = 'Delete All' + OnClick = MenuDeleteAllClick + end object MenuItem3: TMenuItem Caption = 'Export' object MenuItem2: TMenuItem @@ -776,6 +781,14 @@ object MapEdit: TMapEdit object ExportMapsPropsMenu: TPopupMenu Left = 64 Top = 506 + object MenuPopupNew: TMenuItem + Caption = 'New' + OnClick = MenuNewClick + end + object MenuPopupDelete: TMenuItem + Caption = 'Delete' + OnClick = MenuDeleteClick + end object MenuMapProps: TMenuItem Caption = 'Properties' OnClick = MenuMapPropsClick diff --git a/mapeditor.pas b/mapeditor.pas index 48128b7..bb22671 100644 --- a/mapeditor.pas +++ b/mapeditor.pas @@ -23,6 +23,9 @@ TMapEdit = class(TForm) MapImageList: TImageList; MenuItem15: TMenuItem; CloneMap: TMenuItem; + MenuDeleteAll: TMenuItem; + MenuPopupNew: TMenuItem; + MenuPopupDelete: TMenuItem; Properties: TMenuItem; Panel1: TPanel; RadioDraw: TRadioButton; @@ -141,13 +144,12 @@ TMapEdit = class(TForm) procedure MapImageMouseDown(Sender: TObject; Button: TMouseButton; Shift: TShiftState; X, Y: Integer); procedure MapImageMouseLeave(Sender: TObject); - procedure MapImageMouseMove(Sender: TObject; Shift: TShiftState; X, Y: Integer - ); procedure MapImageMouseUp(Sender: TObject; Button: TMouseButton; Shift: TShiftState; X, Y: Integer); procedure ClearMapClick(Sender: TObject); procedure MapListViewClick(Sender: TObject); procedure MapPaintBoxPaint(Sender: TObject); + procedure MenuDeleteAllClick(Sender: TObject); procedure MenuDeleteClick(Sender: TObject); procedure MenuExportBasicLNMapData(Sender: TObject); @@ -157,6 +159,8 @@ TMapEdit = class(TForm) procedure MenuMapPropsClick(Sender: TObject); procedure MenuOpenClick(Sender: TObject); procedure MenuNewClick(Sender: TObject); + + procedure MenuPopupNewClick(Sender: TObject); procedure MenuSaveClick(Sender: TObject); procedure PasteFromClipBoardClick(Sender: TObject); procedure ReSizeMapClick(Sender: TObject); @@ -212,6 +216,7 @@ TMapEdit = class(TForm) MapX,MapY,MapX2,MapY2,OldMapX,OldMapY : integer; + procedure Init; function GetMapX(x : integer) : integer; function GetMapY(y : integer) : integer; @@ -254,6 +259,7 @@ TMapEdit = class(TForm) procedure MapPreviewPlotTile(MPCanvas : TCanvas;mx,my : integer;var TTile : TileRec); Procedure UpdateMapPreviewImageIcons(var ImageList : TImageList; MapIndex,ImageAction : integer); + procedure DeleteAll; end; @@ -299,22 +305,27 @@ function GetTileTB(x,y : integer) : integer; procedure TMapEdit.FormCreate(Sender: TObject); begin + CTileBitmap:=TBitMap.Create; + FormShowActivate:=false; LoadResourceIcons; SetDrawPixelProc(@DrawTileCB); SetGetPixelProc(@GetTileTB); + + Init; +end; + +procedure TMapEdit.Init; +begin SetMapTileMode(1); //draw SetDrawTool(DrawShapePencil); CurrentMap:=MapCoreBase.GetCurrentMap; MapCoreBase.SetZoomSize(CurrentMap,4); MapCoreBase.SetMapTileSize(CurrentMap,32,32); - CTileBitmap:=TBitMap.Create; - TileWidth:=MapCoreBase.GetZoomMapTileWidth(CurrentMap); TileHeight:=MapCoreBase.GetZoomMapTileHeight(CurrentMap); - CTile.ImageIndex:=TileMissing; - FormShowActivate:=false; + LoadTile(0); MapX:=0; MapY:=0; @@ -326,6 +337,25 @@ procedure TMapEdit.FormCreate(Sender: TObject); RenderDrawToolShape:=False; UpdateToolSelectionIcons; UpdateEditMenus; + +// MapCoreBase.SetCurrentMap(MapCoreBase.GetMapCount-1); +// CurrentMap:=MapCoreBase.GetCurrentMap; + TileMode:=1; //draw + MapCoreBase.SetMapTileMode(CurrentMap,TileMode); // we set to draw because the copied data from map 0 may be in erase mode + +// TileZoom.Position:=4; +// MapCoreBase.SetZoomSize(CurrentMap,TileZoom.Position); + + UpdateMapListView; + UpdatePageSize; + MapScrollBox.HorzScrollBar.Position:=0; + MapScrollBox.VertScrollBar.Position:=0; + SetDrawTool(DrawShapePencil); +// UpdateToolSelectionIcons; + UpdateMenus; +// UpdateEditMenus; + MapPaintBox.Invalidate; + end; procedure TMapEdit.FormDestroy(Sender: TObject); @@ -515,23 +545,6 @@ procedure TMapEdit.PlotTileAt(x,y : integer;TTile : TileRec); PlotTile(mx,my,TTile); end; -procedure TMapEdit.MapImageMouseMove(Sender: TObject; Shift: TShiftState; X, Y: Integer); -begin - (* - UpdateMapInfo(x,y); - - if MDOwnLeft and (TileMode=1) then - begin - APlotTile(x,y,CTile); - //MapCoreBase.SetMapTile(CurrentMap,mx,my,CTile); - end - else if (MDOwnRight=true) or ((MDownLeft=true) and (TileMode=0)) then - begin - AClearTile(x,y); - end; - MapPaintBox.Invalidate; - *) -end; procedure TMapEdit.APlotTile(x,y : integer;var TTile : TileRec); var @@ -688,27 +701,53 @@ procedure TMapEdit.MapPaintBoxPaint(Sender: TObject); if MapCoreBase.GetMapClipStatus(MapCoreBase.GetCurrentMap) = 1 then DrawOverLayOnClipArea; end; +procedure TMapEdit.MenuDeleteAllClick(Sender: TObject); +begin + DeleteAll; +end; + +procedure TMapEdit.DeleteAll; +begin + MapCoreBase.Init; //init core to default values + Init; //init map editor to default values +end; + procedure TMapEdit.MenuDeleteClick(Sender: TObject); +var + index : integer; + item : TListItem; begin if MapCoreBase.GetMapCount > 1 then begin - if (MapListView.SelCount > 0) then + if (MapListView.SelCount > 0) then //if map is selected begin - MapCoreBase.DeleteMap(CurrentMap); - if CurrentMap > (MapCoreBase.GetMapCount-1) then - begin - CurrentMap:=MapCoreBase.GetMapCount-1; - end; - UpdateMapListView; - UpdatePageSize; + item:=MapListView.LastSelected; + index:=item.index; + if index > -1 then + begin + MapCoreBase.DeleteMap(Index); + end + else + begin + MapCoreBase.DeleteMap(CurrentMap); + end; + + if CurrentMap > (MapCoreBase.GetMapCount-1) then + begin + CurrentMap:=MapCoreBase.GetMapCount-1; + MapCoreBase.SetCurrentMap(CurrentMap); + end; + UpdateMapListView; + UpdatePageSize; //UpdateMapView; - MapPaintBox.Invalidate; + MapPaintBox.Invalidate; end; end else begin MapCoreBase.ClearMap(0,TileClear); // if there is only one map we just clear it UpdatePageSize; + UpdateMapListView; //UpdateMapView; MapPaintBox.Invalidate; end; @@ -833,6 +872,17 @@ procedure TMapEdit.MenuNewClick(Sender: TObject); MapPaintBox.Invalidate; end; + + + + +procedure TMapEdit.MenuPopupNewClick(Sender: TObject); +begin + +end; + + + procedure TMapEdit.MenuOpenClick(Sender: TObject); begin OpenDialog1.Filter := 'RM MAP Files|*.map|All Files|*.*'; @@ -1130,19 +1180,20 @@ procedure TMapEdit.LoadTilesToTileImageList; procedure TMapEdit.TileListViewClick(Sender: TObject); var item : TListItem; - awidth,aheight : integer; +// awidth,aheight : integer; begin if (TileListview.SelCount > 0) then begin item:=TileListView.LastSelected; - aheight:=ImageThumbBase.GetHeight(item.index); - awidth:=ImageThumbBase.GetWidth(item.index); + // aheight:=ImageThumbBase.GetHeight(item.index); + // awidth:=ImageThumbBase.GetWidth(item.index); + + // SelectedTilePanel.AutoSize:=true; + // SelectedTileImage.AutoSize:=true; + // SelectedTileImage.Picture.Bitmap.SetSize(awidth,aheight); - SelectedTilePanel.AutoSize:=true; - SelectedTileImage.AutoSize:=true; - SelectedTileImage.Picture.Bitmap.SetSize(awidth,aheight); - SelectedTilePanel.AutoSize:=false; - SelectedTileImage.AutoSize:=false; + // SelectedTilePanel.AutoSize:=false; + // SelectedTileImage.AutoSize:=false; LoadTile(item.Index); UpdateCurrentTile; @@ -1193,8 +1244,10 @@ procedure TMapEdit.UpdateTileView; procedure TMapEdit.Button1Click(Sender: TObject); begin - UpdateMapPreviewImageIcons(MapImageList,MapCoreBase.GetCurrentMap,AddImage); -// ShowMessage('working'); +// UpdateMapPreviewImageIcons(MapImageList,MapCoreBase.GetCurrentMap,AddImage); + ShowMessage(IntToStr(SelectedTileImage.Picture.Bitmap.Width)+' '+IntToStr(SelectedTileImage.Picture.Bitmap.Height)); + +// UpdateCurrentTile; end; procedure TMapEdit.MapPreviewPlotTile(MPCanvas : TCanvas;mx,my : integer;var TTile : TileRec); @@ -1318,8 +1371,16 @@ procedure TMapEdit.UpdatePageSize; procedure TMapEdit.UpdateCurrentTile; begin - SelectedTileImage.Picture.Bitmap.SetSize(CTileBitMap.Width, CTileBitMap.Height); - SelectedTileImage.canvas.CopyRect(Rect(0, 0, CTileBitMap.Width, CTileBitMap.Height), CTileBitMap.Canvas, Rect(0, 0,CTileBitMap.Width, CTileBitMap.Height)); +// SelectedTileImage.Picture.Bitmap.SetSize(CTileBitMap.Width, CTileBitMap.Height); + + //SelectedTileImage.Picture.Bitmap.SetSize(256, 256); +// SelectedTileImage.Picture.Bitmap.Width:=256; +// SelectedTileImage.Picture.Bitmap.Height:=256; + + // SelectedTileImage.canvas.CopyRect(Rect(0, 0, CTileBitMap.Width, CTileBitMap.Height), CTileBitMap.Canvas, Rect(0, 0,CTileBitMap.Width, CTileBitMap.Height)); + SelectedTileImage.canvas.CopyRect(Rect(0, 0, 256,256), CTileBitMap.Canvas, Rect(0, 0,CTileBitMap.Width, CTileBitMap.Height)); +// ActualBox.canvas.CopyRect(Rect(0, 0, 256,256), ACBitMap.Canvas, Rect(0, 0,ACBitMap.Width, ACBitMap.Height)); + end; procedure TMapEdit.UpdateInfoBarX1Y1X2Y2; diff --git a/rmabout.pas b/rmabout.pas index dfc01c5..7615df3 100644 --- a/rmabout.pas +++ b/rmabout.pas @@ -8,8 +8,8 @@ interface Classes, SysUtils, Forms, Controls, Graphics, Dialogs, StdCtrls, ExtCtrls,lclintf; Const - ProgramName ='Raster Master v4.4 R111'; - ProgramLicense = 'Released September 30 - 2024 under MIT License'; + ProgramName ='Raster Master v4.5 R112'; + ProgramLicense = 'Released October 7 - 2024 under MIT License'; type diff --git a/rmcore.pas b/rmcore.pas index 7a39cca..44aeb84 100644 --- a/rmcore.pas +++ b/rmcore.pas @@ -33,6 +33,7 @@ TRMPalette = class(TObject) public Constructor Create; + procedure Init; procedure AddColor(r,g,b : integer); procedure DeleteColor(index : integer); procedure ClearColors; @@ -101,6 +102,7 @@ TRMCoreBase = class(TObject) public Constructor create; + procedure Init; procedure PutPixel(x,y,Color : Integer); procedure PutPixel(x,y : integer); function GetPixel(x,y : Integer) : Integer; @@ -811,6 +813,12 @@ procedure LoadPaletteBuf(var PalBuf : TRMPaletteBuf; PaletteMode : integer); end; Constructor TRMPalette.create; +begin + Init; +end; + + +procedure TRMPalette.Init; begin ColorCount:=0; SetPaletteMode(PaletteModeNone); @@ -1125,12 +1133,17 @@ procedure TRMPalette.UpToCGA; Constructor TRMCoreBase.create; begin Palette:=TRMPalette.Create; - SetWidth(256); - SetHeight(256); - SetCurColor(1); - ClearBuf(0); - CopyToUndoBuf; - end; + Init; +end; + +procedure TRMCoreBase.Init; +begin + SetWidth(256); + SetHeight(256); + SetCurColor(1); + ClearBuf(0); + CopyToUndoBuf; +end; procedure TRMCoreBase.SetWidth(width : integer); begin diff --git a/rmmain.lfm b/rmmain.lfm index b6712ee..20efa9d 100644 --- a/rmmain.lfm +++ b/rmmain.lfm @@ -1,12 +1,12 @@ object RMMainForm: TRMMainForm - Left = 113 - Height = 1057 - Top = 234 - Width = 1824 + Left = 383 + Height = 854 + Top = 155 + Width = 1491 Align = alClient Caption = 'Raster Master' - ClientHeight = 1057 - ClientWidth = 1824 + ClientHeight = 854 + ClientWidth = 1491 DefaultMonitor = dmDesktop Menu = MainMenu1 OnClose = FormClose @@ -23,13 +23,13 @@ object RMMainForm: TRMMainForm AnchorSideRight.Side = asrBottom AnchorSideBottom.Control = Owner AnchorSideBottom.Side = asrBottom - Left = 1532 - Height = 1057 + Left = 1253 + Height = 854 Top = 0 - Width = 292 + Width = 238 Anchors = [akTop, akLeft, akRight, akBottom] - ClientHeight = 1057 - ClientWidth = 292 + ClientHeight = 854 + ClientWidth = 238 TabOrder = 5 object RMPanel: TPanel AnchorSideRight.Control = RightPanel @@ -37,9 +37,9 @@ object RMMainForm: TRMMainForm AnchorSideBottom.Control = RightPanel AnchorSideBottom.Side = asrBottom Cursor = crNo - Left = 118 + Left = 64 Height = 121 - Top = 925 + Top = 722 Width = 158 Anchors = [akRight, akBottom] BorderSpacing.Right = 15 @@ -104,22 +104,22 @@ object RMMainForm: TRMMainForm AnchorSideRight.Control = RightHSplitter AnchorSideBottom.Control = Owner AnchorSideBottom.Side = asrBottom - Left = 308 - Height = 945 + Left = 307 + Height = 742 Top = 112 - Width = 1213 + Width = 935 Anchors = [akTop, akLeft, akRight, akBottom] BevelOuter = bvNone - ClientHeight = 945 - ClientWidth = 1213 + ClientHeight = 742 + ClientWidth = 935 TabOrder = 1 object ZoomScrollBox: TScrollBox AnchorSideLeft.Control = MiddleBottomPanel AnchorSideTop.Control = MiddleBottomPanel Left = 0 - Height = 945 + Height = 742 Top = 0 - Width = 1213 + Width = 935 HorzScrollBar.Increment = 93 HorzScrollBar.Page = 862 HorzScrollBar.Tracking = True @@ -129,8 +129,8 @@ object RMMainForm: TRMMainForm Align = alClient Anchors = [akRight, akBottom] BorderStyle = bsNone - ClientHeight = 945 - ClientWidth = 1213 + ClientHeight = 742 + ClientWidth = 935 TabOrder = 0 object ZoomPaintBox: TPaintBox AnchorSideLeft.Control = ZoomScrollBox @@ -155,13 +155,13 @@ object RMMainForm: TRMMainForm AnchorSideBottom.Control = Owner AnchorSideBottom.Side = asrBottom Left = 0 - Height = 1057 + Height = 854 Top = 0 - Width = 308 + Width = 307 Anchors = [akTop, akLeft, akRight, akBottom] BevelOuter = bvNone - ClientHeight = 1057 - ClientWidth = 308 + ClientHeight = 854 + ClientWidth = 307 TabOrder = 0 object LeftVSplitter: TSplitter AnchorSideLeft.Control = LeftPanel @@ -173,8 +173,8 @@ object RMMainForm: TRMMainForm Cursor = crVSplit Left = 0 Height = 13 - Top = 282 - Width = 308 + Top = 280 + Width = 305 Align = alNone Anchors = [akLeft, akRight] Color = 11625216 @@ -190,9 +190,9 @@ object RMMainForm: TRMMainForm AnchorSideBottom.Control = LeftPanel AnchorSideBottom.Side = asrBottom Left = 0 - Height = 762 - Top = 295 - Width = 297 + Height = 561 + Top = 293 + Width = 296 Anchors = [akTop, akLeft, akRight, akBottom] BorderSpacing.Right = 11 Color = 15790320 @@ -213,20 +213,20 @@ object RMMainForm: TRMMainForm AnchorSideRight.Side = asrBottom AnchorSideBottom.Control = LeftVSplitter Left = 0 - Height = 282 + Height = 280 Top = 0 - Width = 293 + Width = 292 Anchors = [akTop, akLeft, akRight, akBottom] BorderSpacing.Right = 15 BevelOuter = bvNone - ClientHeight = 282 - ClientWidth = 293 + ClientHeight = 280 + ClientWidth = 292 TabOrder = 0 object ActualBox: TImage Left = 16 - Height = 144 + Height = 256 Top = 8 - Width = 104 + Width = 256 end end end @@ -235,8 +235,8 @@ object RMMainForm: TRMMainForm AnchorSideTop.Control = Owner AnchorSideBottom.Control = Owner AnchorSideBottom.Side = asrBottom - Left = 297 - Height = 1057 + Left = 296 + Height = 854 Top = 0 Width = 11 Align = alNone @@ -249,8 +249,8 @@ object RMMainForm: TRMMainForm AnchorSideTop.Control = Owner AnchorSideBottom.Control = Owner AnchorSideBottom.Side = asrBottom - Left = 1521 - Height = 1057 + Left = 1242 + Height = 854 Top = 0 Width = 11 Align = alNone @@ -263,19 +263,19 @@ object RMMainForm: TRMMainForm AnchorSideLeft.Side = asrBottom AnchorSideTop.Control = Owner AnchorSideRight.Control = RightHSplitter - Left = 308 + Left = 307 Height = 112 Top = 0 - Width = 1213 + Width = 935 Anchors = [akTop, akLeft, akRight] ClientHeight = 112 - ClientWidth = 1213 + ClientWidth = 935 TabOrder = 2 object ToolPanel: TPanel AnchorSideTop.Control = MiddleTopPanel AnchorSideRight.Control = MiddleTopPanel AnchorSideRight.Side = asrBottom - Left = 728 + Left = 450 Height = 88 Top = 8 Width = 434 @@ -481,7 +481,7 @@ object RMMainForm: TRMMainForm end end object ZoomTrackBar: TTrackBar - Left = 1177 + Left = 899 Height = 110 Hint = 'Zoom Level' Top = 1 @@ -502,7 +502,7 @@ object RMMainForm: TRMMainForm Left = 16 Height = 23 Top = 8 - Width = 702 + Width = 424 Align = alNone Anchors = [akTop, akLeft, akRight] BorderSpacing.Around = 10 @@ -513,7 +513,7 @@ object RMMainForm: TRMMainForm Left = 16 Height = 23 Top = 40 - Width = 702 + Width = 424 Align = alNone Anchors = [akTop, akLeft, akRight] BorderSpacing.Around = 10 @@ -521,8 +521,8 @@ object RMMainForm: TRMMainForm end end object MainMenu1: TMainMenu - Left = 1624 - Top = 128 + Left = 1176 + Top = 248 object FileExitMenu: TMenuItem Caption = 'File' object NewFile: TMenuItem @@ -1485,8 +1485,8 @@ object RMMainForm: TRMMainForm end end object ActionList1: TActionList - Left = 1624 - Top = 208 + Left = 1176 + Top = 336 object EditCut1: TEditCut Category = 'Edit' Caption = 'Cu&t' @@ -1506,25 +1506,25 @@ object RMMainForm: TRMMainForm object OpenDialog1: TOpenDialog Filter = 'Windows BMP|*.bmp|PC Paintbrush |*.pcx|All Files|*.*' Options = [ofFileMustExist, ofEnableSizing, ofViewDetail] - Left = 1624 - Top = 304 + Left = 1176 + Top = 416 end object SaveDialog1: TSaveDialog Title = 'Save' Filter = 'Windows BMP|*.bmp|PC Paintbrush |*.pcx|*.lbm|Amiga ILBM|*.ilbm|Amiga ILBM|All Files|*.*' Options = [ofOverwritePrompt, ofEnableSizing, ofViewDetail] - Left = 1624 - Top = 400 + Left = 1176 + Top = 496 end object ExportDialog: TSaveDialog Title = 'Export' Options = [ofOverwritePrompt, ofEnableSizing, ofViewDetail] - Left = 1624 - Top = 488 + Left = 1176 + Top = 568 end object ImageList1: TImageList - Left = 1624 - Top = 592 + Left = 1176 + Top = 648 end object ExportPropsMenu: TPopupMenu Left = 168 @@ -1553,12 +1553,12 @@ object RMMainForm: TRMMainForm item end> UsePreProcessor = False - Left = 1592 - Top = 8 + Left = 1176 + Top = 160 end object SelectDirectoryDialog: TSelectDirectoryDialog Title = 'Select Export Directory' - Left = 1640 - Top = 672 + Left = 1176 + Top = 704 end end diff --git a/rmmain.pas b/rmmain.pas index fbd8c7d..b5cc5b6 100644 --- a/rmmain.pas +++ b/rmmain.pas @@ -614,8 +614,6 @@ procedure TRMMainForm.FormCreate(Sender: TObject); ZoomY2:=0; OldZoomX:=-1; OldZoomY:=-1; - - end; procedure TRMMainForm.FormDestroy(Sender: TObject); @@ -1016,7 +1014,10 @@ procedure TRMMainForm.UpdateActualArea; i,j : integer; zoommode : integer; tc : TColor; + ACBitMap : TBitMap; begin + ACBitMap:=TBitMap.Create; + ACBitMap.SetSize(RMCoreBase.GetWidth,RMCoreBase.GetHeight); zoommode:=RMDrawTools.GetZoomMode; RMDrawTools.SetZoomMode(0); for i:=0 to RMCoreBase.GetWidth -1 do @@ -1024,10 +1025,15 @@ procedure TRMMainForm.UpdateActualArea; for j:=0 to RMCoreBase.GetHeight-1 do begin tc:=ColorPalette1.Colors[RMCoreBase.GetPixel(i,j)]; - RMDrawTools.PutPixel(ActualBox.Canvas,i,j,tc,0); +// RMDrawTools.PutPixel(ActualBox.Canvas,i,j,tc,0); + RMDrawTools.PutPixel(ACBitMap.Canvas,i,j,tc,0); end; end; + ActualBox.Picture.Bitmap.SetSize(256, 256); + ActualBox.canvas.CopyRect(Rect(0, 0, 256,256), ACBitMap.Canvas, Rect(0, 0,ACBitMap.Width, ACBitMap.Height)); + RMDrawTools.SetZoomMode(zoommode); + ACBitMap.Free; end; procedure TRMMainForm.updateZoomArea; @@ -1525,9 +1531,10 @@ procedure TRMMainForm.ZPaintBoxMouseDownXYTool(Sender: TObject; Button: TMouseBu UpdateRenderBitMap; RMDrawTools.CreateRandomSprayPoints; RMDrawTools.ADrawShape(RenderBitMap.Canvas,ZoomX,ZoomY,ZoomX,ZoomY,ColorBox.Brush.Color,DrawShapeModeCopy,DrawTool,0); - RMDrawTools.ADrawShape(ActualBox.Canvas,ZoomX,ZoomY,ZoomX,ZoomY,ColorBox.Brush.Color,DrawShapeModeCopy,DrawTool,0); + // RMDrawTools.ADrawShape(ActualBox.Canvas,ZoomX,ZoomY,ZoomX,ZoomY,ColorBox.Brush.Color,DrawShapeModeCopy,DrawTool,0); ZoomPaintBox.Invalidate; RMDrawTools.ADrawShape(RenderBitMap.Canvas,ZoomX,ZoomY,ZoomX,ZoomY,ColorBox.Brush.Color,DrawShapeModeCopyToBuf,DrawTool,0); + // UpdateActualArea; end; end; @@ -1550,9 +1557,10 @@ procedure TRMMainForm.ZPaintBoxMouseMoveXYTool(Sender: TObject; Shift: TShiftSta RMDrawTools.CreateRandomSprayPoints; RMDrawTools.ADrawShape(RenderBitMap.Canvas,ZoomX,ZoomY,ZoomX,ZoomY,ColorBox.Brush.Color,DrawShapeModeCopy,DrawTool,0); - RMDrawTools.ADrawShape(ActualBox.Canvas,ZoomX,ZoomY,ZoomX,ZoomY,ColorBox.Brush.Color,DrawShapeModeCopy,DrawTool,0); +// RMDrawTools.ADrawShape(ActualBox.Canvas,ZoomX,ZoomY,ZoomX,ZoomY,ColorBox.Brush.Color,DrawShapeModeCopy,DrawTool,0); ZoomPaintBox.Invalidate; RMDrawTools.ADrawShape(RenderBitMap.Canvas,ZoomX,ZoomY,ZoomX,ZoomY,ColorBox.Brush.Color,DrawShapeModeCopyToBuf,DrawTool,0); + end; // xy mouse up event - this handles all the tools that just requires x,y coords only - pixel and spraypaint @@ -1591,6 +1599,7 @@ procedure TRMMainForm.ZPaintBoxMouseDownXYX2Y2Tool(Sender: TObject; Button: TMou RenderBitMap2.Canvas.CopyRect(rect(0,0,RenderBitMap2.Width,RenderBitMap2.Height),RenderBitMap.Canvas,rect(0,0,RenderBitMap.Width,RenderBitMap.Height)); RMDrawTools.ADrawShape(RenderBitMap.Canvas,ZoomX,ZoomY,ZoomX,ZoomY,ColorBox.Brush.Color,DrawShapeModeCopy,DrawTool,1); ZoomPaintBox.Invalidate; + end; // xyx2y2 mouse move event - this handles all the tools that just requires x,y,x2,y2 coords only - pixel and spraypaint @@ -1638,6 +1647,7 @@ procedure TRMMainForm.ZPaintBoxMouseUpXYX2Y2Tool(Sender: TObject; Button: TMouse DrawTool:=RMDRAWTools.GetDrawTool; RMDrawTools.ADrawShape(RenderBitMap.Canvas,ZoomX,ZoomY,ZoomX2,ZoomY2,ColorBox.Brush.Color,DrawShapeModeCopyToBuf,DrawTool,1); RMDrawTools.ADrawShape(ActualBox.Canvas,ZoomX,ZoomY,ZoomX2,ZoomY2,ColorBox.Brush.Color,DrawShapeModeCopy,DrawTool,1); + // UpdateActualArea; end; procedure TRMMainForm.ZPaintBoxMouseDown(Sender: TObject; Button: TMouseButton; @@ -1680,6 +1690,7 @@ procedure TRMMainForm.ZPaintBoxMouseUp(Sender: TObject; Button: TMouseButton; end; UpdateThumbview; + UpdateActualArea; end; procedure TRMMainForm.ZoomPaintBoxPaint(Sender: TObject); @@ -2270,8 +2281,8 @@ procedure TRMMainForm.EditResizeToNewSize(Sender: TObject); ImgWidth:=256; ImgHeight:=256; end; - ActualBox.Width:=ImgWidth; - ActualBox.Height:=ImgHeight; + // ActualBox.Width:=ImgWidth; + // ActualBox.Height:=ImgHeight; RMCoreBase.SetWidth(ImgWidth); RMCoreBase.SetHeight(ImgHeight); RMDrawTools.SetZoomSize(1); @@ -3635,8 +3646,8 @@ procedure TRMMainForm.ListView1Click(Sender: TObject); ImageThumbBase.CopyIndexImageToCore(Item.Index); ImageThumbBase.SetCurrent(item.Index); - ActualBox.Width:=RMCoreBase.GetWidth; - ActualBox.Height:=RMCoreBase.GetHeight; + // ActualBox.Width:=RMCoreBase.GetWidth; + // ActualBox.Height:=RMCoreBase.GetHeight; ZoomPaintBox.Width:=RMDrawTools.GetZoomPageWidth; ZoomPaintBox.Height:=RMDrawTools.GetZoomPageHeight; @@ -3667,33 +3678,38 @@ procedure TRMMainForm.DeleteAllClick(Sender: TObject); var ImgWidth,ImgHeight : integer; begin - if MessageDlg('Delete All Images', 'Are you sure you want to do this?', mtConfirmation, + if MessageDlg('Delete All Images, Maps, and Sprite Animations!', 'Are you sure you want to do this?', mtConfirmation, [mbYes, mbNo],0) = mrNo then Exit; ImgWidth:=256; ImgHeight:=256; - ActualBox.Width:=ImgWidth; - ActualBox.Height:=ImgHeight; + //ActualBox.Width:=ImgWidth; + //ActualBox.Height:=ImgHeight; RMCoreBase.SetWidth(ImgWidth); RMCoreBase.SetHeight(ImgHeight); - RMDrawTools.SetZoomSize(1); - RMCoreBase.ClearBuf(0); RMCoreBase.SetCurColor(1); RMDrawTools.SetDrawTool(DrawShapePencil); - UpdateToolSelectionIcons; + UpdateToolSelectionIcons; UpdateColorBox; UpdateActualArea; + RMDrawTools.SetClipStatus(0); RMDrawTools.SetZoomSize(2); + + ZoomPaintBox.Width:=RMDrawTools.GetZoomPageWidth; + ZoomPaintBox.Height:=RMDrawTools.GetZoomPageHeight; + RMDrawTools.SetZoomMaxX(RMDrawTools.GetZoomPageWidth); + RMDrawTools.SetZoomMaxY(RMDrawTools.GetZoomPageHeight); + + ZoomSize:=RMDrawTools.GetZoomSize; RMDrawTools.DrawGrid(ZoomPaintBox.Canvas,0,0,ZoomPaintBox.Width,ZoomPaintBox.Height,0); UpdateZoomArea; ZoomTrackBar.Position:=RMDrawTools.getZoomSize; ImageThumbBase.SetCount(1); ImageThumbBase.SetCurrent(0); - ImageList1.Clear; ListView1.Items.Clear; @@ -3705,6 +3721,9 @@ procedure TRMMainForm.DeleteAllClick(Sender: TObject); ListView1.Items[0].Caption:='Image '+IntToStr(1); ListView1.Items[0].ImageIndex :=0; + + MapEdit.DeleteAll; + AnimationForm.DeleteAll; end; procedure TRMMainForm.MapEditMenuClick(Sender: TObject); @@ -4074,12 +4093,18 @@ procedure TRMMainForm.OpenProjectFileClick(Sender: TObject); ImageThumbBase.SetCurrent(0); ImageThumbBase.CopyIndexImageToCore(0); //update view with this image - ActualBox.Width:=RMCoreBase.GetWidth; - ActualBox.Height:=RMCoreBase.GetHeight; + // ActualBox.Width:=RMCoreBase.GetWidth; + // ActualBox.Height:=RMCoreBase.GetHeight; RMDrawTools.DrawGrid(ZoomPaintBox.Canvas,0,0,ZoomPaintBox.Width,ZoomPaintBox.Height,0); - RMDrawTools.SetZoomMaxX(ZoomPaintBox.Width); - RMDrawTools.SetZoomMaxY(ZoomPaintBox.Height); + // RMDrawTools.SetZoomMaxX(ZoomPaintBox.Width); + // RMDrawTools.SetZoomMaxY(ZoomPaintBox.Height); + RMDrawTools.SetZoomSize(1); + + ZoomPaintBox.Width:=RMDrawTools.GetZoomPageWidth; + ZoomPaintBox.Height:=RMDrawTools.GetZoomPageHeight; + RMDrawTools.SetZoomMaxX(RMDrawTools.GetZoomPageWidth); + RMDrawTools.SetZoomMaxY(RMDrawTools.GetZoomPageHeight); ZoomSize:=RMDrawTools.GetZoomSize; CopyScrollPositionFromCore; @@ -4146,8 +4171,8 @@ procedure TRMMainForm.DeleteImageByIndex(index : integer); ImageThumbBase.CopyIndexImageToCore(ImageThumbBase.GetCurrent); //to future nick - do not delete this line - it is important listview1.refresh; - ActualBox.Width:=RMCoreBase.GetWidth; - ActualBox.Height:=RMCoreBase.GetHeight; + // ActualBox.Width:=RMCoreBase.GetWidth; + // ActualBox.Height:=RMCoreBase.GetHeight; ZoomPaintBox.Width:=1; ZoomPaintBox.Height:=1; diff --git a/rmtools.pas b/rmtools.pas index 835a391..d462871 100644 --- a/rmtools.pas +++ b/rmtools.pas @@ -72,6 +72,7 @@ TRMDrawTools = class(TObject) public Constructor create; + procedure Init; procedure DClip(Image : TCanvas; x,y,x2,y2 : integer;color : TColor; mode : integer); procedure ADrawShape(Image : TCanvas; x,y,x2,y2 : integer;color : TColor; mode,shape,full : Integer); @@ -127,9 +128,6 @@ TRMDrawTools = class(TObject) procedure SaveClipCoords(x,y,x2,y2 : integer); procedure DrawOverlayOnClipArea(Image : TCanvas;color : TColor; mode : integer); - - - procedure SetDrawTool(Tool : integer); function GetDrawTool : integer; @@ -167,18 +165,18 @@ implementation Constructor TRMDrawTools.create; begin - //SetCellWidth(30); - //SetCellHeight(30); -SetZoomMode(1); -SetZoomSize(2); - //SetGridThickY(1); - //SetGridThickX(1); - SetGridMode(1); - SetDrawTool(DrawShapePencil); - SetClipStatus(0); //off - SetClipSizedStatus(0); + Init; end; +procedure TRMDrawTools.Init; +begin + SetZoomMode(1); + SetZoomSize(2); + SetGridMode(1); + SetDrawTool(DrawShapePencil); + SetClipStatus(0); //off + SetClipSizedStatus(0); +end; procedure TRMDrawTools.SetClipStatus(mode : integer); begin @@ -1022,7 +1020,6 @@ procedure TRMDrawTools.SetZoomSize(size : integer); if RMCoreBase.GetWidth = 8 then begin If GridArea.ZoomSize < 4 then GridArea.ZoomSize:=4; - end else if RMCoreBase.GetWidth = 16 then begin