Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
[Feature] Map Editor In Its Own Form
#1
Map Editor In Its Own Form
Difficulty: 2/5 - This is a fairly easy tutorial, just make sure you follow the directions properly!
This is another thing that there used to be a tutorial for, but it is now gone. So I am re-writing a new tutorial for it! All this does is basically puts the map editor in a form, letting you move it around freely.

Client Side
First things first, make a new form called frmMapEditor

frmMirage
  • Open up the code for frmMirage. Cut out the following code:
    Code:
    Private Sub optLayers_Click()
        If optLayers.Value Then
            fraLayers.Visible = True
            fraAttribs.Visible = False
        End If
    End Sub

    Private Sub optAttribs_Click()
        If optAttribs.Value Then
            fraLayers.Visible = False
            fraAttribs.Visible = True
        End If
    End Sub

    Private Sub picBackSelect_MouseDown(Button As Integer, Shift As Integer, X As Single, Y As Single)
        If Button = vbLeftButton Then
            Call MapEditorChooseTile(X, Y)
        End If
    End Sub

    Private Sub picBackSelect_MouseMove(Button As Integer, Shift As Integer, X As Single, Y As Single)
        shpLoc.Top = (Y \ PIC_Y) * PIC_Y
        shpLoc.Left = (X \ PIC_X) * PIC_X
        
        shpLoc.Visible = True
    End Sub

    Private Sub cmdSend_Click()
        Call MapEditorSend
    End Sub

    Private Sub cmdCancel_Click()
        Call MapEditorCancel
    End Sub

    Private Sub cmdProperties_Click()
        frmMapProperties.Show vbModal
    End Sub

    Private Sub optWarp_Click()
        frmMapWarp.Show vbModal
    End Sub

    Private Sub optItem_Click()
        frmMapItem.Show vbModal
    End Sub

    Private Sub optKey_Click()
        frmMapKey.Show vbModal
    End Sub

    Private Sub optKeyOpen_Click()
        frmKeyOpen.Show vbModal
    End Sub

    Private Sub scrlPicture_Change()
        Call MapEditorTileScroll
    End Sub

    Private Sub cmdFill_Click()
        MapEditorFillLayer
    End Sub

    Private Sub cmdClear_Click()
        Call MapEditorClearLayer
    End Sub

    Private Sub cmdClear2_Click()
        Call MapEditorClearAttribs
    End Sub

    Private Sub scrlTileSet_Change()
        Map.TileSet = scrlTileSet.Value
        lblTileset = scrlTileSet.Value
        
        Call InitTileSurf(scrlTileSet)
        
        Call BltMapEditor
        Call BltMapEditorTilePreview

        scrlPicture.Max = (picBackSelect.Height \ PIC_Y) - (picBack.Height \ PIC_Y)
    End Sub
    and paste it into the code for your new form! Then go back to the GUI editing mode (Where you can drag around the commands) and copy picMapEditor and all it's contents (the actual map editor) into the new form, then deleting them from frmMirage.

    IMPORTANT: Set the Visible property of picMapEditor to true!!!

    Now, look for sub picScreen_MouseMove and replace the following line :
    Code:
    shpLoc.Visible = False
    With :
    Code:
    frmMapEditor.shpLoc.Visible = False

modGameEditors
  • First things first, go to the sub MapEditorInit. Look for the following snippet of code:
    Code:
    With frmMirage
            .Width = 14175
            .picMapEditor.Visible = True
            .lblTileset = Map.TileSet
            .scrlTileSet = Map.TileSet
            .scrlPicture.Max = (.picBackSelect.Height \ PIC_Y) - (.picBack.Height \ PIC_Y)
        End With
    And replace it with :
    Code:
    With frmMapEditor
            .Show
            .lblTileset = Map.TileSet
            .scrlTileSet = Map.TileSet
            .scrlPicture.Max = (.picBackSelect.Height \ PIC_Y) - (.picBack.Height \ PIC_Y)
        End With

    Now, go to sub MapEditorMouseDown, and replace every frmMirage.blablabla with frmMapEditor.blablabla. Do the same for the subs MapEditorChooseTile, MapEditorTileScroll. MapEditorClearLayer and MapEditorFillLayer.

    Now, go to sub MapEditorCancel and replace the following :
    Code:
    With frmMirage
            .Width = 10080
            .picMapEditor.Visible = False
        End With

    With :
    Code:
    frmMapEditor.Visible=false


modDirectDraw7
  • Now, go to sub BltMapEditor and replace every frmMirage.blablabla with frmMapEditor.blablabla. Do the same for the sub BltMapEditorTilePreview.

    Now go to sub Render_Graphics and look for the following code :
    Code:
    If Editor = EDITOR_MAP Then
                If frmMirage.optAttribs.Value Then
                    Call DrawMapAttributes
                End If
            End If
    And replace it with :
    Code:
    If Editor = EDITOR_MAP Then
                If frmMapEditor.optAttribs.Value Then
                    Call DrawMapAttributes
                End If
            End If


modDatabase
  • Look for sub CheckTiles. Replace the line :
    Code:
    frmMirage.scrlTileSet.Max = NumTileSets
    With :
    Code:
    frmMapEditor.scrlTileSet.Max = NumTileSets


modHandleData
  • Now, look for sub HandleMapData. Look for the following line:
    Code:
    frmMirage.picMapEditor.Visible = False
    And replace it with :
    Code:
    frmMapEditor.Visible = False


And there you go! Enjoy Big Grin If you have any problems, just ask! Smile
Reply


Messages In This Thread

Forum Jump:


Users browsing this thread: 1 Guest(s)