| Mirage Source http://miragesource.net/forums/ |
|
| Adding Width to the MapEditor http://miragesource.net/forums/viewtopic.php?f=210&t=797 |
Page 1 of 1 |
| Author: | Tutorial Bot [ Tue Dec 05, 2006 10:02 pm ] |
| Post subject: | Adding Width to the MapEditor |
Author: Leighland Difficulty: 1/5 See Also: http://www.key2heaven.net/ms/forums/viewtopic.php?t=36 For this tutorial I will be changing the width of the MapEditor tile set from 7 to 14. Please read through the whole tutorial and understand what you're doing before doing it. :: CLIENT SIDE :: In frmMirage, locate the mapeditor pic box. Add a horizontal scrollbar and give it these properties: Code: Name: scrlPicture2 Max: 7 Min: 0 Now, double click on the scroll bar and add the following code to its sub: Code: Call EditorTileScrollLeft In modGameLogic, preferably after the "EditorTileScroll" sub, add: Code: Public Sub EditorTileScrollLeft() frmMirage.picBackSelect.Left = (frmMirage.scrlPicture2.Value * PIC_X) * -1 End Sub Find: Code: Public Sub EditorMouseDown In that sub, change the four 7's to 14's. Example: Code: Public Sub EditorMouseDown(Button As Integer, Shift As Integer, x As Single, y As Single) Dim x1, y1 As Long If InEditor Then x1 = Int(x / PIC_X) y1 = Int(y / PIC_Y) If (Button = 1) And (x1 >= 0) And (x1 <= MAX_MAPX) And (y1 >= 0) And (y1 <= MAX_MAPY) Then If frmMirage.optLayers.Value = True Then With Map.Tile(x1, y1) If frmMirage.optGround.Value = True Then .Ground = EditorTileY * 14 + EditorTileX If frmMirage.optMask.Value = True Then .Mask = EditorTileY * 14 + EditorTileX If frmMirage.optAnim.Value = True Then .Anim = EditorTileY * 14 + EditorTileX If frmMirage.optFringe.Value = True Then .Fringe = EditorTileY * 14 + EditorTileX End With Find: Code: Public Sub EditorInit In that sub, change: Code: .width = 7 * PIC_X To: Code: .width = 14 * PIC_X Find: Code: Public Sub BltFringeTile(ByVal x As Long, ByVal y As Long) Change: Code: If Fringe > 0 Then With rec .top = Int(Fringe / 7) * PIC_Y .Bottom = .top + PIC_Y .Left = (Fringe - Int(Fringe / 7) * 7) * PIC_X .Right = .Left + PIC_X End With Call DD_BackBuffer.BltFast(x * PIC_X, y * PIC_Y, DD_TileSurf, rec, DDBLTFAST_WAIT Or DDBLTFAST_SRCCOLORKEY) End If To: Code: If Fringe > 0 Then With rec .top = Int(Fringe / 14) * PIC_Y .Bottom = .top + PIC_Y .Left = (Fringe - Int(Fringe / 14) * 14) * PIC_X .Right = .Left + PIC_X End With Call DD_BackBuffer.BltFast(x * PIC_X, y * PIC_Y, DD_TileSurf, rec, DDBLTFAST_WAIT Or DDBLTFAST_SRCCOLORKEY) End If Find: Code: Public Sub BltTile(ByVal X As Long, ByVal Y As Long) Replace that entire sub with: Code: Public Sub BltTile(ByVal X As Long, ByVal Y As Long) '**************************************************************** '* WHEN WHO WHAT '* ---- --- ---- '* 07/12/2005 Shannara Optimized function. '**************************************************************** Dim Ground As Long Dim Anim1 As Long Dim Anim2 As Long With Map.Tile(X, Y) Ground = .Ground Anim1 = .Mask Anim2 = .Anim End With ' Only used if ever want to switch to blt rather then bltfast With rec_pos .top = Y * PIC_Y .Bottom = .top + PIC_Y .Left = X * PIC_X .Right = .Left + PIC_X End With With rec .top = Int(Ground / 14) * PIC_Y .Bottom = .top + PIC_Y .Left = (Ground - Int(Ground / 14) * 14) * PIC_X .Right = .Left + PIC_X End With Call DD_BackBuffer.BltFast(X * PIC_X, Y * PIC_Y, DD_TileSurf, rec, DDBLTFAST_WAIT) If (MapAnim = 0) Or (Anim2 <= 0) Then ' Is there an animation tile to plot? If Anim1 > 0 And TempTile(X, Y).DoorOpen = NO Then With rec .top = Int(Anim1 / 14) * PIC_Y .Bottom = .top + PIC_Y .Left = (Anim1 - Int(Anim1 / 14) * 14) * PIC_X .Right = .Left + PIC_X End With Call DD_BackBuffer.BltFast(X * PIC_X, Y * PIC_Y, DD_TileSurf, rec, DDBLTFAST_WAIT Or DDBLTFAST_SRCCOLORKEY) End If Else ' Is there a second animation tile to plot? If Anim2 > 0 Then With rec .top = Int(Anim2 / 14) * PIC_Y .Bottom = .top + PIC_Y .Left = (Anim2 - Int(Anim2 / 14) * 14) * PIC_X .Right = .Left + PIC_X End With Call DD_BackBuffer.BltFast(X * PIC_X, Y * PIC_Y, DD_TileSurf, rec, DDBLTFAST_WAIT Or DDBLTFAST_SRCCOLORKEY) End If End If End Sub Author's notes: Quote: NOTE: If you want to have more, or less, tiles wide, then change all the 14's in this tutorial to whatever you want.
The horizontal bar will need to be changed also. To do that, think about how many tiles you are wanting to show and then subtract 7. Put that number in your Max: property for the scrlPicture2 scroll bar. Examples: 8 tiles wide - Max: 1 18 tiles wide - Max: 11 27 tiles wide - Max: 20 Also note that this is only going to work on a Vanilla copy of MS, or one that hasn't previously been messed with to display a different amount of tiles by default (resizing picBack to display 8 tiles instead of 7). |
|
| Page 1 of 1 | All times are UTC |
| Powered by phpBB® Forum Software © phpBB Group https://www.phpbb.com/ |
|