Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Map Editor - Byte Arrays :-(
#3
erm... alright.

what exactly are you looking for? i mean it sends the entire rec from the client to the server, the client sends 64, and the server picks up 60.

here's the tile and maprec for the client, and then the sub that sends the data to the server.

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
    String1 As String
    String2 As String
    String3 As String
End Type

Type MapRec
    MapName(NAME_LENGTH - 1) As Byte
    Revision As Long
    Moral As Byte
    Up As Integer
    Down As Integer
    Left As Integer
    Right As Integer
    Music As Byte
    BootMap As Integer
    BootX As Byte
    BootY As Byte
    IsIndoors As Byte
    IsBank As Byte
    IsHall As Byte
    Tile() As TileRec
    Npc(1 To MAX_MAP_NPCS) As Byte
End Type



Sub SendMap()
Dim Buffer() As Byte

    Buffer = FillBuffer(VarPtr(Map(GetPlayerMap(MyIndex))), LenB(Map(GetPlayerMap(MyIndex))))
    
    MsgBox aLen(Buffer) ' Shows 64.... server shows 60
    Call SendDataNew(Buffer, SMsgMapData)
End Sub


Here's the stuff from the server:

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
    String1 As String
    String2 As String
    String3 As String
End Type

Type MapRec
    MapName(NAME_LENGTH - 1) As Byte
    Revision As Long
    Moral As Byte
    Up As Integer
    Down As Integer
    Left As Integer
    Right As Integer
    Music As Byte
    BootMap As Integer
    BootX As Byte
    BootY As Byte
    IsIndoors As Byte
    IsBank As Byte
    IsHall As Byte
    Tile() As TileRec
    Npc(1 To MAX_MAP_NPCS) As Byte
End Type





Private Sub HandleMapData(ByVal Index As Long, ByVal StartAddr As Long, ByVal ByteLen As Long, ByVal ExtraVar As Long)
Dim Buffer() As Byte
Dim i As Long, MapNum As Integer
Dim nMap As MapRec
  
  If HasAccess(Index, ADMIN_MAPPER) = 0 Then Exit Sub
  
  Buffer = FillBuffer(StartAddr, ByteLen)
  MapNum = GetPlayerMap(Index)
  
  
  'ReDim Map(MapNum).Tile(0 To MAX_MAPX, 0 To MAX_MAPY) As TileRec
  
  MsgBox Len(Map(MapNum))
  Call CopyMemory(nMap, Buffer(0), aLen(Buffer))
  debug.print "passed this point!"
  Map(MapNum) = nMap
  
  Call SendMapNpcsToMap(MapNum)
  Call SpawnMapNpcs(MapNum)
  
  'Save the map
  Call SaveMap(MapNum)
  
  'Refresh map for everyone online
  For i = 1 To MAX_PLAYERS
    If IsPlaying(i) And GetPlayerMap(i) = MapNum Then
      Call PlayerWarp(i, MapNum, GetPlayerX(i), GetPlayerY(i))
    End If
  Next
End Sub
[/code]
Reply


Messages In This Thread

Forum Jump:


Users browsing this thread: 1 Guest(s)