Print Page | Close Window

Adding More Layers Tutorial

Printed From: Mirage Source
Category: Tutorials
Forum Name: Temporary Archive (Read Only)
Forum Discription: Temporary 3.0.3 archive tutorials, will be deleted when converted.
URL: http://ms.shannaracorp.com/backup-forums/forum_posts.asp?TID=237
Printed Date: 20 December 2006 at 5:53pm
Software Version: Web Wiz Forums 8.01 - http://www.webwizforums.com


Topic: Adding More Layers Tutorial
Posted By: Sync
Subject: Adding More Layers Tutorial
Date Posted: 11 February 2006 at 3:43pm
Difficulty: Hard 5/5

Originaly Posted By: Asrrin29

ok, big props to shadow for this little piece of wonder, one in which I thin keveryoine uses. LAYERS!

Aight, this is my Tutorial on how I added layer's as follow's


Quote:

NOTES:
Adding more Layer's will mean that you will have to re-map what you have already done
Easyest thing to test this is make a Copy of your Source, and Delete all the maps, then try
I Say replace alot, you can just add the stuff that isnt there but if you stuff up, dont ask me for help!
 




Ground 'already in source code
Mask1 'already in source code
Mask1 Animation 'already in source code
Mask2
Mask2 Animation
Fringe1 'already in source code
Fringe1 Animation
Fringe2
Fringe2 Animation
 


Ok, now open the client project (Mirage.vbp)

Open the Module called 'modTypes' and search for
Code:

Type TileRec
    Ground As Integer
    Mask As Integer
    Anim As Integer
    Fringe As Integer
    Type As Byte
    Data1 As Integer
    Data2 As Integer
    Data3 As Integer
End Type
 


Replace with
Code:

Type TileRec
    Ground As Integer
    Mask As Integer
    Anim As Integer
    Mask2 As Integer
    M2Anim As Integer
    Fringe As Integer
    FAnim As Integer
    Fringe2 As Integer
    F2Anim As Integer
    Type As Byte
    Data1 As Integer
    Data2 As Integer
    Data3 As Integer
End Type
 

Quote:

'Mask2 As Integer' will hold the Mask2 Layer
'M2Anim As Integer' will hold the Mask2 Animation Layer
'FAnim As Integer' will hold the Fringe1 Animation Layer
'Fringe2 As Integer' will hold the Fringe2 Layer
'F2Anim As Integer' will hold the Fringe2 Animation Layer
 


Now search for (still in modTypes)
Code:

Sub ClearMap()
 


In that sub Replace
Code:

    For y = 0 To MAX_MAPY
        For x = 0 To MAX_MAPX
             Map.Tile(x, y).Ground = 0
             Map.Tile(x, y).Mask = 0
             Map.Tile(x, y).Anim = 0
             Map.Tile(x, y).Fringe = 0
             Map.Tile(x, y).Type = 0
             Map.Tile(x, y).Data1 = 0
             Map.Tile(x, y).Data2 = 0
             Map.Tile(x, y).Data3 = 0
        Next x
    Next y
 


With
Code:

    For y = 0 To MAX_MAPY
        For x = 0 To MAX_MAPX
             Map.Tile(x, y).Ground = 0
             Map.Tile(x, y).Mask = 0
             Map.Tile(x, y).Anim = 0
             Map.Tile(x, y).Mask2 = 0
             Map.Tile(x, y).M2Anim = 0
             Map.Tile(x, y).Fringe = 0
             Map.Tile(x, y).FAnim = 0
             Map.Tile(x, y).Fringe2 = 0
             Map.Tile(x, y).F2Anim = 0
             Map.Tile(x, y).Type = 0
             Map.Tile(x, y).Data1 = 0
             Map.Tile(x, y).Data2 = 0
             Map.Tile(x, y).Data3 = 0
        Next x
    Next y
 


Ok that is all in the modTypes, now onto 'modGameLogic'

Search for
Code:

Sub BltTile(ByVal x As Long, ByVal y As Long)
 


in that sub Replace
Code:

Dim Ground As Long
Dim Anim1 As Long
Dim Anim2 As Long
 


With
Code:

Dim Ground As Long
Dim Anim1 As Long
Dim Anim2 As Long
Dim Mask2 As Long
Dim M2Anim As Long
 


Replace
Code:

    Ground = Map.Tile(x, y).Ground
    Anim1 = Map.Tile(x, y).Mask
    Anim2 = Map.Tile(x, y).Anim
 


With
Code:

    Ground = Map.Tile(x, y).Ground
    Anim1 = Map.Tile(x, y).Mask
    Anim2 = Map.Tile(x, y).Anim
    Mask2 = Map.Tile(x, y).Mask2
    M2Anim = Map.Tile(x, y).M2Anim
 


Replace
Code:

    'Call DD_BackBuffer.Blt(rec_pos, DD_TileSurf, rec, DDBLT_WAIT)
    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
             rec.top = Int(Anim1 / 7) * PIC_Y
             rec.Bottom = rec.top + PIC_Y
             rec.Left = (Anim1 - Int(Anim1 / 7) * 7) * PIC_X
             rec.Right = rec.Left + PIC_X
             'Call DD_BackBuffer.Blt(rec_pos, DD_TileSurf, rec, DDBLT_WAIT Or DDBLT_KEYSRC)
             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
             rec.top = Int(Anim2 / 7) * PIC_Y
             rec.Bottom = rec.top + PIC_Y
             rec.Left = (Anim2 - Int(Anim2 / 7) * 7) * PIC_X
             rec.Right = rec.Left + PIC_X
             'Call DD_BackBuffer.Blt(rec_pos, DD_TileSurf, rec, DDBLT_WAIT Or DDBLT_KEYSRC)
             Call DD_BackBuffer.BltFast(x * PIC_X, y * PIC_Y, DD_TileSurf, rec, DDBLTFAST_WAIT Or DDBLTFAST_SRCCOLORKEY)
        End If
    End If
 


With
Code:

    'Call DD_BackBuffer.Blt(rec_pos, DD_TileSurf, rec, DDBLT_WAIT)
    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
             rec.top = Int(Anim1 / 7) * PIC_Y
             rec.Bottom = rec.top + PIC_Y
             rec.Left = (Anim1 - Int(Anim1 / 7) * 7) * PIC_X
             rec.Right = rec.Left + PIC_X
             'Call DD_BackBuffer.Blt(rec_pos, DD_TileSurf, rec, DDBLT_WAIT Or DDBLT_KEYSRC)
             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
             rec.top = Int(Anim2 / 7) * PIC_Y
             rec.Bottom = rec.top + PIC_Y
             rec.Left = (Anim2 - Int(Anim2 / 7) * 7) * PIC_X
             rec.Right = rec.Left + PIC_X
             'Call DD_BackBuffer.Blt(rec_pos, DD_TileSurf, rec, DDBLT_WAIT Or DDBLT_KEYSRC)
             Call DD_BackBuffer.BltFast(x * PIC_X, y * PIC_Y, DD_TileSurf, rec, DDBLTFAST_WAIT Or DDBLTFAST_SRCCOLORKEY)
        End If
    End If
   
    If (MapAnim = 0) Or (M2Anim <= 0) Then
        ' Is there an animation tile to plot?
        If Mask2 > 0 Then
             rec.top = Int(Mask2 / 7) * PIC_Y
             rec.Bottom = rec.top + PIC_Y
             rec.Left = (Mask2 - Int(Mask2 / 7) * 7) * PIC_X
             rec.Right = rec.Left + PIC_X
             'Call DD_BackBuffer.Blt(rec_pos, DD_TileSurf, rec, DDBLT_WAIT Or DDBLT_KEYSRC)
             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 M2Anim > 0 Then
             rec.top = Int(M2Anim / 7) * PIC_Y
             rec.Bottom = rec.top + PIC_Y
             rec.Left = (M2Anim - Int(M2Anim / 7) * 7) * PIC_X
             rec.Right = rec.Left + PIC_X
             'Call DD_BackBuffer.Blt(rec_pos, DD_TileSurf, rec, DDBLT_WAIT Or DDBLT_KEYSRC)
             Call DD_BackBuffer.BltFast(x * PIC_X, y * PIC_Y, DD_TileSurf, rec, DDBLTFAST_WAIT Or DDBLTFAST_SRCCOLORKEY)
        End If
    End If
 



Now search for
Code:

Sub BltFringeTile(ByVal x As Long, ByVal y As Long)
 


Replace
Code:

Dim Fringe As Long
 


With
Code:

Dim Fringe As Long
Dim FAnim As Long
Dim Fringe2 As Long
Dim F2Anim As Long
 


Replace
Code:

    Fringe = Map.Tile(x, y).Fringe
 


with
Code:

    Fringe = Map.Tile(x, y).Fringe
    FAnim = Map.Tile(x, y).FAnim
    Fringe2 = Map.Tile(x, y).Fringe2
    F2Anim = Map.Tile(x, y).F2Anim
 


Replace
Code:

        If Fringe > 0 Then
        rec.top = Int(Fringe / 7) * PIC_Y
        rec.Bottom = rec.top + PIC_Y
        rec.Left = (Fringe - Int(Fringe / 7) * 7) * PIC_X
        rec.Right = rec.Left + PIC_X
        'Call DD_BackBuffer.Blt(rec_pos, DD_TileSurf, rec, DDBLT_WAIT Or DDBLT_KEYSRC)
        Call DD_BackBuffer.BltFast(x * PIC_X, y * PIC_Y, DD_TileSurf, rec, DDBLTFAST_WAIT Or DDBLTFAST_SRCCOLORKEY)
        End If
 


With
Code:

    If (MapAnim = 0) Or (FAnim <= 0) Then
        ' Is there an animation tile to plot?
       
        If Fringe > 0 Then
        rec.top = Int(Fringe / 7) * PIC_Y
        rec.Bottom = rec.top + PIC_Y
        rec.Left = (Fringe - Int(Fringe / 7) * 7) * PIC_X
        rec.Right = rec.Left + PIC_X
        'Call DD_BackBuffer.Blt(rec_pos, DD_TileSurf, rec, DDBLT_WAIT Or DDBLT_KEYSRC)
        Call DD_BackBuffer.BltFast(x * PIC_X, y * PIC_Y, DD_TileSurf, rec, DDBLTFAST_WAIT Or DDBLTFAST_SRCCOLORKEY)
        End If
   
    Else
   
        If FAnim > 0 Then
        rec.top = Int(FAnim / 7) * PIC_Y
        rec.Bottom = rec.top + PIC_Y
        rec.Left = (FAnim - Int(FAnim / 7) * 7) * PIC_X
        rec.Right = rec.Left + PIC_X
        'Call DD_BackBuffer.Blt(rec_pos, DD_TileSurf, rec, DDBLT_WAIT Or DDBLT_KEYSRC)
        Call DD_BackBuffer.BltFast(x * PIC_X, y * PIC_Y, DD_TileSurf, rec, DDBLTFAST_WAIT Or DDBLTFAST_SRCCOLORKEY)
        End If
       
    End If

    If (MapAnim = 0) Or (F2Anim <= 0) Then
        ' Is there an animation tile to plot?
       
        If Fringe2 > 0 Then
        rec.top = Int(Fringe2 / 7) * PIC_Y
        rec.Bottom = rec.top + PIC_Y
        rec.Left = (Fringe2 - Int(Fringe2 / 7) * 7) * PIC_X
        rec.Right = rec.Left + PIC_X
        'Call DD_BackBuffer.Blt(rec_pos, DD_TileSurf, rec, DDBLT_WAIT Or DDBLT_KEYSRC)
        Call DD_BackBuffer.BltFast(x * PIC_X, y * PIC_Y, DD_TileSurf, rec, DDBLTFAST_WAIT Or DDBLTFAST_SRCCOLORKEY)
        End If
   
    Else
   
        If F2Anim > 0 Then
        rec.top = Int(F2Anim / 7) * PIC_Y
        rec.Bottom = rec.top + PIC_Y
        rec.Left = (F2Anim - Int(F2Anim / 7) * 7) * PIC_X
        rec.Right = rec.Left + PIC_X
        'Call DD_BackBuffer.Blt(rec_pos, DD_TileSurf, rec, DDBLT_WAIT Or DDBLT_KEYSRC)
        Call DD_BackBuffer.BltFast(x * PIC_X, y * PIC_Y, DD_TileSurf, rec, DDBLTFAST_WAIT Or DDBLTFAST_SRCCOLORKEY)
        End If
       
    End If
 



Now Search for
Code:

Public Sub EditorMouseDown(Button As Integer, Shift As Integer, x As Single, y As Single)
 


Replace
Code:

                     If frmMirage.optGround.Value = True Then .Ground = EditorTileY * 7 + EditorTileX
                     If frmMirage.optMask.Value = True Then .Mask = EditorTileY * 7 + EditorTileX
                     If frmMirage.optAnim.Value = True Then .Anim = EditorTileY * 7 + EditorTileX
                     If frmMirage.optFringe.Value = True Then .Fringe = EditorTileY * 7 + EditorTileX
 


With
Code:

                     If frmMirage.optGround.Value = True Then .Ground = EditorTileY * 7 + EditorTileX
                     If frmMirage.optMask.Value = True Then .Mask = EditorTileY * 7 + EditorTileX
                     If frmMirage.optAnim.Value = True Then .Anim = EditorTileY * 7 + EditorTileX
                     If frmMirage.optMask2.Value = True Then .Mask2 = EditorTileY * 7 + EditorTileX
                     If frmMirage.optM2Anim.Value = True Then .M2Anim = EditorTileY * 7 + EditorTileX
                     If frmMirage.optFringe.Value = True Then .Fringe = EditorTileY * 7 + EditorTileX
                     If frmMirage.optFAnim.Value = True Then .FAnim = EditorTileY * 7 + EditorTileX
                     If frmMirage.optFringe2.Value = True Then .Fringe2 = EditorTileY * 7 + EditorTileX
                     If frmMirage.optF2Anim.Value = True Then .F2Anim = EditorTileY * 7 + EditorTileX
 


Replace
Code:

                     If frmMirage.optGround.Value = True Then .Ground = 0
                     If frmMirage.optMask.Value = True Then .Mask = 0
                     If frmMirage.optAnim.Value = True Then .Anim = 0
                     If frmMirage.optFringe.Value = True Then .Fringe = 0
 


With
Code:

                     If frmMirage.optGround.Value = True Then .Ground = 0
                     If frmMirage.optMask.Value = True Then .Mask = 0
                     If frmMirage.optAnim.Value = True Then .Anim = 0
                     If frmMirage.optMask2.Value = True Then .Mask2 = 0
                     If frmMirage.optM2Anim.Value = True Then .M2Anim = 0
                     If frmMirage.optFringe.Value = True Then .Fringe = 0
                     If frmMirage.optFAnim.Value = True Then .FAnim = 0
                     If frmMirage.optFringe2.Value = True Then .Fringe2 = 0
                     If frmMirage.optF2Anim.Value = True Then .F2Anim = 0
 



Now Search for
Code:

Public Sub EditorClearLayer()
 


Replace
Code:

    ' Ground layer
    If frmMirage.optGround.Value = True Then
        YesNo = MsgBox("Are you sure you wish to clear the ground layer?", vbYesNo, GAME_NAME)
       
        If YesNo = vbYes Then
             For y = 0 To MAX_MAPY
                 For x = 0 To MAX_MAPX
                     Map.Tile(x, y).Ground = 0
                 Next x
             Next y
        End If
    End If

    ' Mask layer
    If frmMirage.optMask.Value = True Then
        YesNo = MsgBox("Are you sure you wish to clear the mask layer?", vbYesNo, GAME_NAME)
       
        If YesNo = vbYes Then
             For y = 0 To MAX_MAPY
                 For x = 0 To MAX_MAPX
                     Map.Tile(x, y).Mask = 0
                 Next x
             Next y
        End If
    End If

    ' Mask Animation layer
    If frmMirage.optAnim.Value = True Then
        YesNo = MsgBox("Are you sure you wish to clear the animation layer?", vbYesNo, GAME_NAME)
       
        If YesNo = vbYes Then
             For y = 0 To MAX_MAPY
                 For x = 0 To MAX_MAPX
                     Map.Tile(x, y).Anim = 0
                 Next x
             Next y
        End If
    End If

    ' Fringe layer
    If frmMirage.optFringe.Value = True Then
        YesNo = MsgBox("Are you sure you wish to clear the fringe layer?", vbYesNo, GAME_NAME)
       
        If YesNo = vbYes Then
             For y = 0 To MAX_MAPY
                 For x = 0 To MAX_MAPX
                     Map.Tile(x, y).Fringe = 0
                 Next x
             Next y
        End If
    End If
 


With
Code:

    ' Ground layer
    If frmMirage.optGround.Value = True Then
        YesNo = MsgBox("Are you sure you wish to clear the ground layer?", vbYesNo, GAME_NAME)
       
        If YesNo = vbYes Then
             For y = 0 To MAX_MAPY
                 For x = 0 To MAX_MAPX
                     Map.Tile(x, y).Ground = 0
                 Next x
             Next y
        End If
    End If

    ' Mask layer
    If frmMirage.optMask.Value = True Then
        YesNo = MsgBox("Are you sure you wish to clear the mask layer?", vbYesNo, GAME_NAME)
       
        If YesNo = vbYes Then
             For y = 0 To MAX_MAPY
                 For x = 0 To MAX_MAPX
                     Map.Tile(x, y).Mask = 0
                 Next x
             Next y
        End If
    End If

    ' Mask Animation layer
    If frmMirage.optAnim.Value = True Then
        YesNo = MsgBox("Are you sure you wish to clear the animation layer?", vbYesNo, GAME_NAME)
       
        If YesNo = vbYes Then
             For y = 0 To MAX_MAPY
                 For x = 0 To MAX_MAPX
                     Map.Tile(x, y).Anim = 0
                 Next x
             Next y
        End If
    End If

    ' Mask 2 layer
    If frmMirage.optMask2.Value = True Then
        YesNo = MsgBox("Are you sure you wish to clear the mask 2 layer?", vbYesNo, GAME_NAME)
       
        If YesNo = vbYes Then
             For y = 0 To MAX_MAPY
                 For x = 0 To MAX_MAPX
                     Map.Tile(x, y).Mask2 = 0
                 Next x
             Next y
        End If
    End If

    ' Mask 2 Animation layer
    If frmMirage.optM2Anim.Value = True Then
        YesNo = MsgBox("Are you sure you wish to clear the mask 2 animation layer?", vbYesNo, GAME_NAME)
       
        If YesNo = vbYes Then
             For y = 0 To MAX_MAPY
                 For x = 0 To MAX_MAPX
                     Map.Tile(x, y).M2Anim = 0
                 Next x
             Next y
        End If
    End If

    ' Fringe layer
    If frmMirage.optFringe.Value = True Then
        YesNo = MsgBox("Are you sure you wish to clear the fringe layer?", vbYesNo, GAME_NAME)
       
        If YesNo = vbYes Then
             For y = 0 To MAX_MAPY
                 For x = 0 To MAX_MAPX
                     Map.Tile(x, y).Fringe = 0
                 Next x
             Next y
        End If
    End If

    ' Fringe Animation layer
    If frmMirage.optFAnim.Value = True Then
        YesNo = MsgBox("Are you sure you wish to clear the fringe animation layer?", vbYesNo, GAME_NAME)
       
        If YesNo = vbYes Then
             For y = 0 To MAX_MAPY
                 For x = 0 To MAX_MAPX
                     Map.Tile(x, y).FAnim = 0
                 Next x
             Next y
        End If
    End If

    ' Fringe 2 layer
    If frmMirage.optFringe2.Value = True Then
        YesNo = MsgBox("Are you sure you wish to clear the fringe 2 layer?", vbYesNo, GAME_NAME)
       
        If YesNo = vbYes Then
             For y = 0 To MAX_MAPY
                 For x = 0 To MAX_MAPX
                     Map.Tile(x, y).Fringe2 = 0
                 Next x
             Next y
        End If
    End If

    ' Fringe 2 Animation layer
    If frmMirage.optF2Anim.Value = True Then
        YesNo = MsgBox("Are you sure you wish to clear the fringe 2 animation layer?", vbYesNo, GAME_NAME)
       
        If YesNo = vbYes Then
             For y = 0 To MAX_MAPY
                 For x = 0 To MAX_MAPX
                     Map.Tile(x, y).F2Anim = 0
                 Next x
             Next y
        End If
    End If
 



Ok that is all in the modGameLogic, now onto 'modClientTCP'

Search for
Code:

If LCase(Parse(0)) = "mapdata" Then
 


Replace
Code:

        For y = 0 To MAX_MAPY
             For x = 0 To MAX_MAPX
                 SaveMap.Tile(x, y).Ground = Val(Parse(n))
                 SaveMap.Tile(x, y).Mask = Val(Parse(n + 1))
                 SaveMap.Tile(x, y).Anim = Val(Parse(n + 2))
                 SaveMap.Tile(x, y).Fringe = Val(Parse(n + 3))
                 SaveMap.Tile(x, y).Type = Val(Parse(n + 4))
                 SaveMap.Tile(x, y).Data1 = Val(Parse(n + 5))
                 SaveMap.Tile(x, y).Data2 = Val(Parse(n + 6))
                 SaveMap.Tile(x, y).Data3 = Val(Parse(n + 7))

                 n = n + 8
             Next x
        Next y
 


With
Code:

        For y = 0 To MAX_MAPY
             For x = 0 To MAX_MAPX
                 SaveMap.Tile(x, y).Ground = Val(Parse(n))
                 SaveMap.Tile(x, y).Mask = Val(Parse(n + 1))
                 SaveMap.Tile(x, y).Anim = Val(Parse(n + 2))
                 SaveMap.Tile(x, y).Mask2 = Val(Parse(n + 3))
                 SaveMap.Tile(x, y).M2Anim = Val(Parse(n + 4))
                 SaveMap.Tile(x, y).Fringe = Val(Parse(n + 5))
                 SaveMap.Tile(x, y).FAnim = Val(Parse(n + 6))
                 SaveMap.Tile(x, y).Fringe2 = Val(Parse(n + 7))
                 SaveMap.Tile(x, y).F2Anim = Val(Parse(n + 8))
                 SaveMap.Tile(x, y).Type = Val(Parse(n + 9))
                 SaveMap.Tile(x, y).Data1 = Val(Parse(n + 10))
                 SaveMap.Tile(x, y).Data2 = Val(Parse(n + 11))
                 SaveMap.Tile(x, y).Data3 = Val(Parse(n + 12))
                
                 n = n + 13
             Next x
        Next y
 



Now Search for
Code:

Sub SendMap()
 


Replace
Code:

    For y = 0 To MAX_MAPY
        For x = 0 To MAX_MAPX
             With Map.Tile(x, y)
                 Packet = Packet & .Ground & SEP_CHAR & .Mask & SEP_CHAR & .Anim & SEP_CHAR & .Fringe & SEP_CHAR & .Type  & SEP_CHAR & .Data1 & SEP_CHAR & .Data2 & SEP_CHAR & .Data3 & SEP_CHAR
             End With
        Next x
    Next y
 


With
Code:

    For y = 0 To MAX_MAPY
        For x = 0 To MAX_MAPX
             With Map.Tile(x, y)
                 Packet = Packet & .Ground & SEP_CHAR & .Mask & SEP_CHAR & .Anim & SEP_CHAR & .Mask2 & SEP_CHAR & .M2Anim & SEP_CHAR & .Fringe & SEP_CHAR & .FAnim & SEP_CHAR & .Fringe2 & SEP_CHAR & .F2Anim & SEP_CHAR & .Type & SEP_CHAR & .Data1 & SEP_CHAR & .Data2 & SEP_CHAR & .Data3 & SEP_CHAR
             End With
        Next x
    Next y
 


thats all the Code for in the Client, Now for the hard part, Adding 'Option Buttons' to the Map Editor

Ok, Open the form called 'frmMirage'

Click on the Layers Frame, Make it Longer, so it looks something like this:
 

Drag the 'Clear Button' down to the bottom

click the OptionButton
 

Add a Few OptionButtons so it looks something like this:
 

Now to name them all, alright, they go like this:

Ground's name is 'optGround' (Should already be done)
Mask's name is 'optMask' (Should already be done)
Animation's (first one, Animates Mask1) name is 'optAnim' (Should already be done)
Mask2's name is 'optMask2'
Animation's name is 'optM2Anim'
Fringe's name is 'optFringe' (Should already be done)
Animation's name is 'optFAnim'
Fringe2's name is 'optFringe2'
Animation's name is 'optF2Anim'

Thats all in the Client to do!
Congratulations for getting this far, now onto the Server!


open the Server project (Server.vbp)

Open the Module called 'modTypes' and search for

Code:

Type TileRec
    Ground As Integer
    Mask As Integer
    Anim As Integer
    Fringe As Integer
    Type As Byte
    Data1 As Integer
    Data2 As Integer
    Data3 As Integer
End Type
 


Replace with
Code:

Type TileRec
    Ground As Integer
    Mask As Integer
    Anim As Integer
    Mask2 As Integer
    M2Anim As Integer
    Fringe As Integer
    FAnim As Integer
    Fringe2 As Integer
    F2Anim As Integer
    Type As Byte
    Data1 As Integer
    Data2 As Integer
    Data3 As Integer
End Type
 


Now search for
Code:

Sub ClearMap()
 


In that sub Replace
Code:

    For y = 0 To MAX_MAPY
        For x = 0 To MAX_MAPX
             Map(MapNum).Tile(x, y).Ground = 0
             Map(MapNum).Tile(x, y).Mask = 0
             Map(MapNum).Tile(x, y).Anim = 0
             Map(MapNum).Tile(x, y).Fringe = 0
             Map(MapNum).Tile(x, y).Type = 0
             Map(MapNum).Tile(x, y).Data1 = 0
             Map(MapNum).Tile(x, y).Data2 = 0
             Map(MapNum).Tile(x, y).Data3 = 0
        Next x
    Next y
 


With
Code:

    For y = 0 To MAX_MAPY
        For x = 0 To MAX_MAPX
             Map(MapNum).Tile(x, y).Ground = 0
             Map(MapNum).Tile(x, y).Mask = 0
             Map(MapNum).Tile(x, y).Anim = 0
             Map(MapNum).Tile(x, y).Mask2 = 0
             Map(MapNum).Tile(x, y).M2Anim = 0
             Map(MapNum).Tile(x, y).Fringe = 0
             Map(MapNum).Tile(x, y).FAnim = 0
             Map(MapNum).Tile(x, y).Fringe2 = 0
             Map(MapNum).Tile(x, y).F2Anim = 0
             Map(MapNum).Tile(x, y).Type = 0
             Map(MapNum).Tile(x, y).Data1 = 0
             Map(MapNum).Tile(x, y).Data2 = 0
             Map(MapNum).Tile(x, y).Data3 = 0
        Next x
    Next y
 


Done with modTypes, now onto 'modServerTCP'

Seach for
Code:

If LCase(Parse(0)) = "mapdata" Then
 


Replace
Code:

        For y = 0 To MAX_MAPY
             For x = 0 To MAX_MAPX
                 Map(MapNum).Tile(x, y).Ground = Val(Parse(n))
                 Map(MapNum).Tile(x, y).Mask = Val(Parse(n + 1))
                 Map(MapNum).Tile(x, y).Anim = Val(Parse(n + 2))
                 Map(MapNum).Tile(x, y).Fringe = Val(Parse(n + 3))
                 Map(MapNum).Tile(x, y).Type = Val(Parse(n + 4))
                 Map(MapNum).Tile(x, y).Data1 = Val(Parse(n + 5))
                 Map(MapNum).Tile(x, y).Data2 = Val(Parse(n + 6))
                 Map(MapNum).Tile(x, y).Data3 = Val(Parse(n + 7))
                
                 n = n + 8
             Next x
        Next y
 


With
Code:

        For y = 0 To MAX_MAPY
             For x = 0 To MAX_MAPX
                 Map(MapNum).Tile(x, y).Ground = Val(Parse(n))
                 Map(MapNum).Tile(x, y).Mask = Val(Parse(n + 1))
                 Map(MapNum).Tile(x, y).Anim = Val(Parse(n + 2))
                 Map(MapNum).Tile(x, y).Mask2 = Val(Parse(n + 3))
                 Map(MapNum).Tile(x, y).M2Anim = Val(Parse(n + 4))
                 Map(MapNum).Tile(x, y).Fringe = Val(Parse(n + 5))
                 Map(MapNum).Tile(x, y).FAnim = Val(Parse(n + 6))
                 Map(MapNum).Tile(x, y).Fringe2 = Val(Parse(n + 7))
                 Map(MapNum).Tile(x, y).F2Anim = Val(Parse(n + 8))
                 Map(MapNum).Tile(x, y).Type = Val(Parse(n + 9))
                 Map(MapNum).Tile(x, y).Data1 = Val(Parse(n + 10))
                 Map(MapNum).Tile(x, y).Data2 = Val(Parse(n + 11))
                 Map(MapNum).Tile(x, y).Data3 = Val(Parse(n + 12))
                
                 n = n + 13
             Next x
        Next y
 


Search for
Code:

Sub SendMap(ByVal Index As Long, ByVal MapNum As Long)
 


Replace
Code:

    For y = 0 To MAX_MAPY
        For x = 0 To MAX_MAPX
             With Map(MapNum).Tile(x, y)
                 Packet = Packet & .Ground & SEP_CHAR & .Mask & SEP_CHAR & .Anim & SEP_CHAR & .Fringe & SEP_CHAR & .Type  & SEP_CHAR & .Data1 & SEP_CHAR & .Data2 & SEP_CHAR & .Data3 & SEP_CHAR
             End With
        Next x
    Next y
 


With
Code:

    For y = 0 To MAX_MAPY
        For x = 0 To MAX_MAPX
             With Map(MapNum).Tile(x, y)
                 Packet = Packet & .Ground & SEP_CHAR & .Mask & SEP_CHAR & .Anim & SEP_CHAR & .Mask2 & SEP_CHAR & .M2Anim & SEP_CHAR & .Fringe & SEP_CHAR & .FAnim & SEP_CHAR & .Fringe2 & SEP_CHAR & .F2Anim & SEP_CHAR & .Type & SEP_CHAR & .Data1 & SEP_CHAR & .Data2 & SEP_CHAR & .Data3 & SEP_CHAR
             End With
        Next x
    Next y




Print Page | Close Window

Bulletin Board Software by Web Wiz Forums version 8.01 - http://www.webwizforums.com
Copyright ©2001-2006 Web Wiz Guide - http://www.webwizguide.info