Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Nueva carga de mapas en formato .CSM #641

Open
wants to merge 20 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
The table of contents is too big for display.
Diff view
Diff view
  •  
  •  
  •  
1 change: 1 addition & 0 deletions .gitattributes
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,7 @@
*.exe binary
*.ani binary
*.inf binary
*.csm binary
/GRAFICOS/Fonts/font1.dat binary
/GRAFICOS/Fonts/font2.dat binary
/GRAFICOS/Fonts/font3.dat binary
Expand Down
18 changes: 9 additions & 9 deletions CODIGO/Areas/TileEngine.bas
Original file line number Diff line number Diff line change
Expand Up @@ -175,7 +175,7 @@ Public Type Char
Criminal As Byte
Atacable As Byte

Nombre As String
nombre As String
Clan As String

scrollDirectionX As Integer
Expand Down Expand Up @@ -951,7 +951,7 @@ Public Function RenderSounds()
'**************************************************************
Dim Location As Position

If bRain And bLluvia(UserMap) Then
If bRain And MapDat.zone <> "DUNGEON" Then
If bTecho Then
If frmMain.IsPlaying <> PlayLoop.plLluviain Then
If RainBufferIndex Then
Expand Down Expand Up @@ -1277,7 +1277,7 @@ Private Sub CharRender(ByVal CharIndex As Long, ByVal PixelOffsetX As Integer, B

If Abs(MouseTileX - .Pos.X) < 1 And (Abs(MouseTileY - .Pos.Y)) < 1 And CharIndex <> UserCharIndex And ClientSetup.TonalidadPJ Then

If Len(.Nombre) > 0 Then
If Len(.nombre) > 0 Then

If .Criminal Then
Call Engine_Long_To_RGB_List(ColorFinal(), D3DColorXRGB(204, 100, 100))
Expand Down Expand Up @@ -1338,7 +1338,7 @@ Private Sub CharRender(ByVal CharIndex As Long, ByVal PixelOffsetX As Integer, B
End If

'Draw name when navigating
If Len(.Nombre) > 0 Then
If Len(.nombre) > 0 Then
If Nombres Then
If .iHead = 0 And .iBody > 0 Then
Call RenderName(CharIndex, PixelOffsetX, PixelOffsetY)
Expand Down Expand Up @@ -1373,7 +1373,7 @@ Private Sub CharRender(ByVal CharIndex As Long, ByVal PixelOffsetX As Integer, B
End If

'Draw name over head
If LenB(.Nombre) > 0 Then
If LenB(.nombre) > 0 Then
If Nombres Then
Call RenderName(CharIndex, PixelOffsetX, PixelOffsetY)
End If
Expand Down Expand Up @@ -1406,7 +1406,7 @@ Private Sub CharRender(ByVal CharIndex As Long, ByVal PixelOffsetX As Integer, B
Call Draw_Grh(.Escudo.ShieldWalk(.Heading), PixelOffsetX, PixelOffsetY, 1, ColorFinal(), 1, True)
End If

If LenB(.Nombre) > 0 Then
If LenB(.nombre) > 0 Then
If Nombres Then
Call RenderName(CharIndex, PixelOffsetX, PixelOffsetY, True)
End If
Expand Down Expand Up @@ -1608,7 +1608,7 @@ Private Sub RenderName(ByVal CharIndex As Long, _
Dim Color As Long

With charlist(CharIndex)
Pos = getTagPosition(.Nombre)
Pos = getTagPosition(.nombre)

If .priv = 0 Then
If .muerto Then
Expand All @@ -1630,11 +1630,11 @@ Private Sub RenderName(ByVal CharIndex As Long, _
End If

'Nick
line = Left$(.Nombre, Pos - 2)
line = Left$(.nombre, Pos - 2)
Call DrawText(X + 16, Y + 30, line, Color, True)

'Clan
line = mid$(.Nombre, Pos)
line = mid$(.nombre, Pos)
Call DrawText(X + 16, Y + 45, line, Color, True)

End With
Expand Down
34 changes: 10 additions & 24 deletions CODIGO/Areas/mPooMap.bas
Original file line number Diff line number Diff line change
Expand Up @@ -21,27 +21,13 @@ Public Sub Map_RemoveOldUser()
End With

End Sub
Public Sub Map_CreateObject(ByVal X As Byte, ByVal Y As Byte, ByVal GrhIndex As Long)

'Dim objgrh As Integer

If Not GrhCheck(GrhIndex) Then
Exit Sub
Public Sub Map_CreateObject(ByVal X As Byte, ByVal Y As Byte, ByVal GrhIndex As Long)

End If
If Not GrhCheck(GrhIndex) Then Exit Sub

If (Map_InBounds(X, Y)) Then

With MapData(X, Y)

'If (Map_PosExitsObject(x, y) > 0) Then
' Call Map_DestroyObject(x, y)
'End If

'.objgrh.GrhIndex = GrhIndex
Call InitGrh(.ObjGrh, GrhIndex)
End With

Call InitGrh(MapData(X, Y).ObjGrh, GrhIndex)
End If

End Sub
Expand All @@ -51,10 +37,11 @@ Public Sub Map_DestroyObject(ByVal X As Byte, ByVal Y As Byte)
If (Map_InBounds(X, Y)) Then

With MapData(X, Y)
'.objgrh.GrhIndex = 0
.OBJInfo.ObjIndex = 0
.OBJInfo.Amount = 0
Call GrhUninitialize(.ObjGrh)

.OBJInfo.objindex = 0
.OBJInfo.Amount = 0

Call GrhUninitialize(.ObjGrh)

End With

Expand Down Expand Up @@ -260,18 +247,17 @@ Function Map_LegalPos(ByVal X As Integer, ByVal Y As Integer) As Boolean
If UserEquitando And MapData(X, Y).Trigger = eTrigger.BAJOTECHO Or MapData(X, Y).Trigger = eTrigger.CASA Then

If Not frmMain.MsgTimeadoOn Then

frmMain.MsgTimeadoOn = True
frmMain.MsgTimeado = JsonLanguage.item("MENSAJE_MONTURA_SALIR").item("TEXTO")
End If

Exit Function
End If

If UserEvento Then Exit Function


Map_LegalPos = True

End Function

Function Map_InBounds(ByVal X As Integer, ByVal Y As Integer) As Boolean
Expand Down
127 changes: 4 additions & 123 deletions CODIGO/General.bas
Original file line number Diff line number Diff line change
Expand Up @@ -41,9 +41,6 @@ End Type

Public Posts() As tRedditPost

Public bLluvia() As Byte ' Array para determinar si
'debemos mostrar la animacion de la lluvia

Private lFrameTimer As Long

Private keysMovementPressedQueue As clsArrayList
Expand Down Expand Up @@ -419,130 +416,18 @@ Sub SwitchMap(ByVal Map As Integer)
'Disenado y creado por Juan Martin Sotuyo Dodero (Maraxus) ([email protected])
'**********************************************************************************

'**********************************************************************************
'Formato de mapas optimizado para reducir el espacio que ocupan.
'Nueva carga de mapas desde la memoria (clsByteBuffer)
'[ https://www.gs-zone.org/temas/carga-de-mapas-desde-la-memoria-cliente.91444/ ]
'**********************************************************************************

Dim Y As Long
Dim X As Long

Dim ByFlags As Byte
Dim handle As Integer
Dim fileBuff As clsByteBuffer

Dim dData() As Byte
Dim dLen As Long

Set fileBuff = New clsByteBuffer

'Limpieza adicional del mapa. PARCHE: Solucion a bug de clones. [Gracias Yhunja]
'EDIT: cambio el rango de valores en x y para solucionar otro bug con respecto al cambio de mapas
Call Char_CleanAll

'Erase particle effects
'Borramos las particulas activas en el mapa.
Call Particle_Group_Remove_All

dLen = FileLen(Game.path(Mapas) & "Mapa" & Map & ".map")
ReDim dData(dLen - 1)

handle = FreeFile()

Open Game.path(Mapas) & "Mapa" & Map & ".map" For Binary As handle
Get handle, , dData
Close handle

fileBuff.initializeReader dData

mapInfo.MapVersion = fileBuff.getInteger

With MiCabecera
.Desc = fileBuff.getString(Len(.Desc))
.CRC = fileBuff.getLong
.MagicWord = fileBuff.getLong
End With

fileBuff.getDouble

'Load arrays
For Y = YMinMapSize To YMaxMapSize
For X = XMinMapSize To XMaxMapSize
ByFlags = fileBuff.getByte()

With MapData(X, Y)

'Layer 1
.Blocked = (ByFlags And 1)
.Graphic(1).GrhIndex = fileBuff.getLong()
Call InitGrh(.Graphic(1), .Graphic(1).GrhIndex)

'Layer 2 used?
If ByFlags And 2 Then
.Graphic(2).GrhIndex = fileBuff.getLong()
Call InitGrh(.Graphic(2), .Graphic(2).GrhIndex)
Else
.Graphic(2).GrhIndex = 0
End If

'Layer 3 used?
If ByFlags And 4 Then
.Graphic(3).GrhIndex = fileBuff.getLong()
Call InitGrh(.Graphic(3), .Graphic(3).GrhIndex)
Else
.Graphic(3).GrhIndex = 0
End If

'Layer 4 used?
If ByFlags And 8 Then
.Graphic(4).GrhIndex = fileBuff.getLong()
Call InitGrh(.Graphic(4), .Graphic(4).GrhIndex)
Else
.Graphic(4).GrhIndex = 0
End If

'Trigger used?
If ByFlags And 16 Then
.Trigger = fileBuff.getInteger()
Else
.Trigger = 0
End If

If ByFlags And 32 Then
Call General_Particle_Create(CLng(fileBuff.getInteger()), X, Y)
Else
.Particle_Group_Index = 0
End If

'Erase NPCs
If .CharIndex > 0 Then
.CharIndex = 0
End If

'Erase OBJs
If .ObjGrh.GrhIndex > 0 Then
.ObjGrh.GrhIndex = 0
End If

'Erase Lights
Call Engine_D3DColor_To_RGB_List(.Engine_Light(), Estado_Actual) 'Standelf, Light & Meteo Engine

End With
Next X
Next Y

Call LightRemoveAll

'Borramos las particulas de lluvia
Call mDx8_Particulas.RemoveWeatherParticles(eWeather.Rain)

'Limpiamos el buffer
Set fileBuff = Nothing

With mapInfo
.name = vbNullString
.Music = vbNullString
End With
'Cargamos el mapa.
Call Carga.CargarMapa(Map)

'Dibujamos el Mini-Mapa
If FileExist(Game.path(Graficos) & "MiniMapa\" & Map & ".bmp", vbArchive) Then
Expand All @@ -552,12 +437,9 @@ Sub SwitchMap(ByVal Map As Integer)
frmMain.RecTxt.Width = frmMain.RecTxt.Width + 100
End If

CurMap = Map

Call Init_Ambient(Map)

'Carga las particulas especificas del mapa.
Call Load_Map_Particles(Map)
CurMap = Map
joaquinodz marked this conversation as resolved.
Show resolved Hide resolved

'Resetear el mensaje en render con el nombre del mapa.
renderText = nameMap
Expand Down Expand Up @@ -899,7 +781,6 @@ Private Sub LoadInitialConfig()
True, False, True, rtfCenter)

Call CargarTips
Call CargarArrayLluvia
Call CargarAnimArmas
Call CargarAnimEscudos
Call CargarColores
Expand Down
Loading