08-01-2007, 06:25 PM
Tutorial Originally Posted By: Shadow
Warning: If you use this tutorial, you will have to delete all your maps!
Ok, now open the client project (Mirage.vbp)
Open the Module called 'modTypes' and search for
Replace with
Now search for (still in modTypes)
In that sub Replace
With
Search for
in that sub Replace
With
Replace
With
Replace
With
Now Search for
Replace
With
Replace
With
Now Search for:
Replace
With
Search for
Replace
With
Now Search for
Replace
With
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
Replace with
Now search for
In that sub Replace
With
Done with modTypes, now onto 'modServerTCP'
Seach for
Replace
With
Search for
Replace
With
Warning: If you use this tutorial, you will have to delete all your maps!
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
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
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 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
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
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
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
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