05-12-2006, 10:02 PM
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:Now, double click on the scroll bar and add the following code to its sub:In modGameLogic, preferably after the "EditorTileScroll" sub, add:Find:In that sub, change the four 7's to 14's. Example:To:Find:Replace that entire sub with:Author's notes:
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
Code:
Call EditorTileScrollLeft
Code:
Public Sub EditorTileScrollLeft()
frmMirage.picBackSelect.Left = (frmMirage.scrlPicture2.Value * PIC_X) * -1
End Sub
Code:
Public Sub EditorMouseDown
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 = 0) And (y1 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
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
Code:
Public Sub BltTile(ByVal X As Long, ByVal Y As Long)
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
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
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).