Mirage Source
http://www.miragesource.net/forums/

[Feature] Map Editor In Its Own Form
http://www.miragesource.net/forums/viewtopic.php?f=183&t=6086
Page 1 of 77

Author:  JokeofWeek [ Sat Aug 01, 2009 4:37 pm ]
Post subject:  [Feature] Map Editor In Its Own Form

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 :D If you have any problems, just ask! :)

Author:  Nean [ Sat Aug 01, 2009 5:18 pm ]
Post subject:  Re: [Feature] Map Editor In Its Own Form

Pretty sweet tutorial. Though, I must say it's not that great of an idea to have a lot of forms. If you can cut down and have as least forms as possible, that's the best. They take up memory/space, etc, etc. Though it can certaintly be more convenient.

Author:  James [ Mon Aug 03, 2009 5:50 am ]
Post subject:  Re: [Feature] Map Editor In Its Own Form

Best thing to do is completely remove the mapeditor and make it a separate program for developers and then remove all that dev crap from the client. :)

Author:  KruSuPhy [ Tue Aug 04, 2009 9:10 pm ]
Post subject:  Re: [Feature] Map Editor In Its Own Form

;D
I made a suckier version of this tutorial <3

Author:  ShadowMaster [ Sun Aug 09, 2009 1:46 pm ]
Post subject:  Re: [Feature] Map Editor In Its Own Form

Here an idea. What about making the map editor as a different app?

Author:  wanai [ Wed Dec 01, 2021 9:25 am ]
Post subject:  Re: [Feature] Map Editor In Its Own Form

сайтсайтсайтсайтсайтсайтсайтсайтсайтсайтсайтсайтсайтсайтсайтсайтсайтсайтсайтсайтсайтсайтсайт
сайтсайтсайтсайтсайтсайтсайтсайтсайтсайтсайтсайтсайтсайтсайтсайтсайтсайтсайтсайтсайтсайтсайт
сайтсайтсайтсайтсайтсайтсайтсайтсайтсайтсайтсайтсайтсайтсайтсайтсайтсайтсайтсайтсайтсайтсайт
сайтсайтсайтсайтсайтсайтсайтсайтсайтсайтсайтсайтсайтсайтсайтсайтсайтсайтсайтсайтсайтсайтсайт
сайтсайтсайтсайтсайтсайтсайтсайтсайтсайтсайтсайтсайтсайтсайтсайтсайтсайтсайтсайтсайтсайтсайт
сайтсайтсайтсайтсайтсайтсайтсайтсайтсайтсайтсайтсайтсайтсайтсайтсайтсайтсайтсайтсайтсайтсайт
сайтсайтсайтсайтсайтсайтсайтсайтсайтсайтсайтсайтсайтсайтсайтсайтсайтсайтсайтсайтсайтсайтсайт
сайтсайтсайтсайтсайтсайтсайтсайтсайтсайтсайтсайтсайтсайтсайтсайтсайтсайтсайтсайтсайтсайтсайт
сайтсайтсайтсайтсайтсайтсайтсайтсайтсайтсайтсайтсайтсайтсайтсайтсайтсайтсайтsemiasphalticfluxсайтсайтсайт
сайтсайтсайтсайтсайтсайтhttp://taskreasoning.ruсайтсайтсайтинфосайтсайтtuchkasсайтсайт

Author:  wanai [ Sat Jan 08, 2022 3:12 am ]
Post subject:  Re: [Feature] Map Editor In Its Own Form

Econ

Author:  wanai [ Sat Jan 08, 2022 3:13 am ]
Post subject:  Re: [Feature] Map Editor In Its Own Form

120.1

Author:  wanai [ Sat Jan 08, 2022 3:15 am ]
Post subject:  Re: [Feature] Map Editor In Its Own Form

Bett

Author:  wanai [ Sat Jan 08, 2022 3:16 am ]
Post subject:  Re: [Feature] Map Editor In Its Own Form

Bett

Author:  wanai [ Sat Jan 08, 2022 3:17 am ]
Post subject:  Re: [Feature] Map Editor In Its Own Form

Thom

Author:  wanai [ Sat Jan 08, 2022 3:18 am ]
Post subject:  Re: [Feature] Map Editor In Its Own Form

Know

Author:  wanai [ Sat Jan 08, 2022 3:19 am ]
Post subject:  Re: [Feature] Map Editor In Its Own Form

Jane

Author:  wanai [ Sat Jan 08, 2022 3:20 am ]
Post subject:  Re: [Feature] Map Editor In Its Own Form

June

Author:  wanai [ Sat Jan 08, 2022 3:21 am ]
Post subject:  Re: [Feature] Map Editor In Its Own Form

Gilb

Author:  wanai [ Sat Jan 08, 2022 3:22 am ]
Post subject:  Re: [Feature] Map Editor In Its Own Form

Zodi

Author:  wanai [ Sat Jan 08, 2022 3:24 am ]
Post subject:  Re: [Feature] Map Editor In Its Own Form

Clan

Author:  wanai [ Sat Jan 08, 2022 3:25 am ]
Post subject:  Re: [Feature] Map Editor In Its Own Form

Fisk

Author:  wanai [ Sat Jan 08, 2022 3:26 am ]
Post subject:  Re: [Feature] Map Editor In Its Own Form

Ruco

Author:  wanai [ Sat Jan 08, 2022 3:27 am ]
Post subject:  Re: [Feature] Map Editor In Its Own Form

Kara

Author:  wanai [ Sat Jan 08, 2022 3:28 am ]
Post subject:  Re: [Feature] Map Editor In Its Own Form

Thin

Author:  wanai [ Sat Jan 08, 2022 3:29 am ]
Post subject:  Re: [Feature] Map Editor In Its Own Form

Eleg

Author:  wanai [ Sat Jan 08, 2022 3:30 am ]
Post subject:  Re: [Feature] Map Editor In Its Own Form

Toni

Author:  wanai [ Sat Jan 08, 2022 3:31 am ]
Post subject:  Re: [Feature] Map Editor In Its Own Form

Eliz

Author:  wanai [ Sat Jan 08, 2022 3:32 am ]
Post subject:  Re: [Feature] Map Editor In Its Own Form

Vilo

Page 1 of 77 All times are UTC
Powered by phpBB® Forum Software © phpBB Group
https://www.phpbb.com/