Advertisement
Luciano_fuentes

Untitled

Dec 17th, 2016
217
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 2.23 KB | None | 0 0
  1. Option Explicit
  2.  
  3. 'AUTOR: Toyz - Luciano
  4. 'FECHA: 17/12
  5. 'HORA: 23:50
  6.  
  7. Private Const Rango_Puerta_X As Byte = 3
  8. Private Const Rango_Puerta_Y As Byte = 3
  9. Private Puertas As Integer
  10.  
  11. Private Type tCerrarPuerta
  12. Posicion_NPC As WorldPos
  13. Posicion_Puerta As WorldPos
  14. Cerrada As Boolean
  15. Index As Integer
  16. End Type
  17.  
  18. Private CerrarPuerta() As tCerrarPuerta
  19.  
  20. Public Sub Cargar_IAPuertas()
  21.  
  22. Dim Leer As clsIniReader, LoopC As Long
  23. Set Leer = New clsIniReader
  24. Call Leer.Initialize(App.Path & "\Dat\CerrarPuertas.dat")
  25.  
  26.  
  27. Puertas = CInt(Leer.GetValue("INIT", "Puertas"))
  28. ReDim CerrarPuerta(1 To Puertas) As tCerrarPuerta
  29.  
  30. For LoopC = 1 To Puertas
  31. With CerrarPuerta(LoopC)
  32. .Index = CInt(Leer.GetValue("CerrarPuerta" & LoopC, "NPC_Index"))
  33. .Posicion_NPC.Map = CInt(ReadField(1, (Leer.GetValue("CerrarPuerta" & LoopC, "NPC_MAPA")), 45))
  34. .Posicion_NPC.X = CByte(ReadField(2, (Leer.GetValue("CerrarPuerta" & LoopC, "NPC_X")), 45))
  35. .Posicion_NPC.Y = CByte(ReadField(3, (Leer.GetValue("CerrarPuerta" & LoopC, "NPC_Y")), 45))
  36.  
  37. .Posicion_Puerta.Map = CInt(ReadField(1, (Leer.GetValue("CerrarPuerta" & LoopC, "PUERTA_MAPA")), 45))
  38. .Posicion_Puerta.X = CByte(ReadField(2, (Leer.GetValue("CerrarPuerta" & LoopC, "PUERTA_X")), 45))
  39. .Posicion_Puerta.Y = CByte(ReadField(2, (Leer.GetValue("CerrarPuerta" & LoopC, "PUERTA_Y")), 45))
  40. End With
  41. Next LoopC
  42.  
  43. End Sub
  44.  
  45. Public Sub PuedeCerrar()
  46.  
  47. Dim X As Byte, Y As Byte, LoopC As Long, LoopX As Long, LoopI As Long
  48.  
  49. For LoopI = 1 To Puertas
  50. With CerrarPuerta(LoopI)
  51. If .Cerrada = True Then Exit Sub
  52.  
  53. For LoopC = .Posicion_Puerta.X - Rango_Puerta_X To .Posicion_Puerta.X + Rango_Puerta_X
  54. For LoopX = .Posicion_Puerta.Y - Rango_Puerta_Y To .Posicion_Puerta.Y + Rango_Puerta_Y
  55. If MapData(.Posicion_Puerta.Map, LoopC, LoopX).UserIndex > 0 Then Exit Sub
  56. Next LoopX
  57. Next LoopC
  58. End With
  59. Call Cerrar_Puerta(LoopI)
  60. Next LoopI
  61.  
  62. End Sub
  63.  
  64. Private Sub Cerrar_Puerta(ByVal CerrarPuerta As Byte)
  65.  
  66. End Sub
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement