Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Byte Array: Map Problem
#1
Im having trouble with my map. It seems like the layers are all messed up. When I try to put out a mask, it goes into animation2 etc..

So for those I know programming I could send the parts of code in PM.

Hope you can help me out.
Reply
#2
Maybe you messed up those little option boxes (I remember there being option boxes...)?
Reply
#3
Kite Wrote:Maybe you messed up those little option boxes (I remember there being option boxes...)?
Yes, but they worked fine before adding byte arrays. But either way, I'll recheck that.
Reply
#4
Post exactly what you are sending, and what you are reading, from/to the packet buffer.
Reply
#5
Dave Wrote:I remember having a particularily hard time getting maps to send correctly. Look in the Valkoria source for something to help, maybe.


the version of valkoria i have doesnt have byte arrays o.O, its the normal one downloaded from your site callled valkoria_src
Reply
#6
Client:
Code:
Public Sub SendMap()
  Erase Buffer
  
  Buffer = AddLongToBuffer(Buffer, GetPlayerMap(MyIndex))
  Buffer = AddToBuffer(Buffer, VarPtr(Map), LenB(Map))
    
  Call SendData(Buffer, SMsgMapData)
End Sub
Server:
Code:
Private Sub HandleSMsgMapData(ByVal index As Long, ByVal StartAddr As Long, ByVal ByteLen As Long, ByVal ExtraVar As Long)
  Dim i As Long, MapNum As Long
  Dim Buffer() As Byte
  
  If HasAccess(index, ADMIN_MAPPER) = NO Then Exit Sub
  
  Buffer = FillBuffer(StartAddr, ByteLen)
  MapNum = GetLongFromBuffer(Buffer, True)
  
  Call CopyMemory(ByVal VarPtr(Map(MapNum)), Buffer(0), LenB(Map(MapNum)))
  
  Call SendMapNpcsToMap(MapNum)
  Call SpawnMapNpcs(MapNum)
  
  'Save the map
  Call SaveMap(MapNum)
        
        ' Refresh map for everyone online
        For i = 1 To HighIndex
            If IsPlaying(i) And GetPlayerMap(i) = MapNum Then
                Call PlayerWarp(i, MapNum, GetPlayerX(i), GetPlayerY(i))
            End If
        Next i
End Sub
Reply
#7
Actually, now I think of it I had trouble sending everything but maps when I tried it out.

I tried out Ver's source and spent a while fixing all the Development packets.

I think maps were the only Dev packet which worked for me.
Reply
#8
I don't exactly know how Verrigan's style works, but, wouldn't you want this:

Code:
Buffer = AddLongToBuffer(Buffer, GetPlayerMap(MyIndex))
  Buffer = AddToBuffer(Buffer, VarPtr(Map), LenB(Map))

To be this?

Code:
Buffer = AddLongToBuffer(Buffer, GetPlayerMap(MyIndex))
  Buffer = Buffer & AddToBuffer(Buffer, VarPtr(Map), LenB(Map))
Reply
#9
Nope, it cant be like that. They are supposed to look like this:
Code:
Buffer = AddLongToBuffer(Buffer, GetPlayerMap(MyIndex))
Buffer = AddToBuffer(Buffer, VarPtr(Map), LenB(Map))
Reply
#10
Ah, I see how it works. Nevermind. :wink:
Reply
#11
@ Dave


i didnt find a valkoria version with byte array packets o.O
Reply
#12
Shot me! The problem was that the Type didnt match on both sides, so i just replaced them both with:
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

    Mask2 As Integer
    M2Anim As Integer
    FAnim As Integer
    Fringe2 As Integer
    F2Anim As Integer
End Type
Never thought that could matter Tongue
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)