SpikeL Comunidad
Hola, bienvenido a SpikeL Foro.

Si eres nuevo, deves registrarte.

Si ya tienes una cuenta, deves ingresar.

¡Muchas gracias!

PD: Si te has registrado pero no puedes logear tienes que activar tu cuenta desde tu e-mail.


Unirse al foro, es rápido y fácil

SpikeL Comunidad
Hola, bienvenido a SpikeL Foro.

Si eres nuevo, deves registrarte.

Si ya tienes una cuenta, deves ingresar.

¡Muchas gracias!

PD: Si te has registrado pero no puedes logear tienes que activar tu cuenta desde tu e-mail.
SpikeL Comunidad
¿Quieres reaccionar a este mensaje? Regístrate en el foro con unos pocos clics o inicia sesión para continuar.

Reflejo de pj en agua

2 participantes

Ir abajo

Reflejo de pj en agua Empty Reflejo de pj en agua

Mensaje por santi55 Jue Dic 23, 2010 12:09 pm

Empesemos, todo en el Cliente:

Reemplazar el Sub Device_Box_Textured_Render_Advance por este:


Código:
Private Sub Device_Box_Textured_Render_Advance(ByVal GrhIndex As Long, ByVal dest_x As Integer, ByVal dest_y As Integer, ByVal src_width As Integer, _
                                            ByVal src_height As Integer, ByRef rgb_list() As Long, ByVal src_x As Integer, _
                                            ByVal src_y As Integer, Optional ByVal alpha_blend As Boolean, Optional ByVal angle As Single, _
                                            Optional ByVal shadow As Byte = 0, _
                                            Optional ByVal Invert_x As Boolean = False, _
                                            Optional ByVal Invert_y As Boolean = False)
    Static src_rect As RECT
    Static dest_rect As RECT
    Static temp_verts(3) As TLVERTEX
    Static d3dTextures As D3D8Textures
    Static light_value(0 To 3) As Long
   
    If GrhIndex = 0 Then Exit Sub
    Set d3dTextures.texture = GetTexture(GrhData(GrhIndex).FileNum, d3dTextures.texwidth, d3dTextures.texheight)
   
    light_value(0) = rgb_list(0)
    light_value(1) = rgb_list(1)
    light_value(2) = rgb_list(2)
    light_value(3) = rgb_list(3)
   
    If (light_value(0) = 0) Then light_value(0) = base_light
    If (light_value(1) = 0) Then light_value(1) = base_light
    If (light_value(2) = 0) Then light_value(2) = base_light
    If (light_value(3) = 0) Then light_value(3) = base_light
       
    'Set up the source rectangle
    With src_rect
        .bottom = src_y + src_height
        .Left = src_x
        .Right = src_x + src_width
        .Top = src_y
    End With
               
    'Set up the destination rectangle
    With dest_rect
        .bottom = dest_y + src_height
        .Left = dest_x
        .Right = dest_x + src_width
        .Top = dest_y
    End With
   
    'Set up the TempVerts(3) vertices
    Geometry_Create_Box temp_verts(), dest_rect, src_rect, light_value(), d3dTextures.texwidth, d3dTextures.texheight, angle, Invert_x, Invert_y
   
    'Set Textures
    D3DDevice.SetTexture 0, d3dTextures.texture
   
    If shadow Then
        temp_verts(1).X = temp_verts(1).X + src_width / 2
        temp_verts(1).Y = temp_verts(1).Y - src_height / 2
     
        temp_verts(3).X = temp_verts(3).X + src_width
        temp_verts(3).Y = temp_verts(3).Y - src_width
    End If
   
    If alpha_blend Then
      'Set Rendering for alphablending
        D3DDevice.SetRenderState D3DRS_SRCBLEND, D3DBLEND_ONE
        D3DDevice.SetRenderState D3DRS_DESTBLEND, D3DBLEND_ONE
    End If
   
    'Draw the triangles that make up our square Textures
    D3DDevice.DrawPrimitiveUP D3DPT_TRIANGLESTRIP, 2, temp_verts(0), Len(temp_verts(0))
   
    If alpha_blend Then
        'Set Rendering for colokeying
        D3DDevice.SetRenderState D3DRS_SRCBLEND, D3DBLEND_SRCALPHA
        D3DDevice.SetRenderState D3DRS_DESTBLEND, D3DBLEND_INVSRCALPHA
    End If
 
End Sub


En el modulo TileEngine, abajo de todo poner:


Código:
Sub Draw_Grh(Grh As Grh, ByVal X As Integer, ByVal Y As Integer, center As Byte, Animate As Byte, ByRef color() As Long, Optional alpha As Boolean, Optional ByVal Invert_x As Boolean = False, Optional ByVal Invert_y As Boolean = False, Optional ByVal KillAnim As Integer = 0, Optional ByVal map_x As Byte, Optional ByVal map_y As Byte)
'***************************
'/////By Thusing/////
'***************************
 
Dim iGrhIndex As Integer
Dim QuitarAnimacion As Boolean
 
 
If Animate Then
    If Grh.Started = 1 Then
        If Grh.SpeedCounter > 0 Then
            Grh.SpeedCounter = Grh.SpeedCounter - 1
            If Grh.SpeedCounter = 0 Then
                Grh.SpeedCounter = GrhData(Grh.GrhIndex).speed
                Grh.FrameCounter = Grh.FrameCounter + 1
                If Grh.FrameCounter > GrhData(Grh.GrhIndex).NumFrames Then
                    Grh.FrameCounter = 1
                    If KillAnim Then
                        If CharList(KillAnim).FxLoopTimes <> LoopAdEternum Then
                           
                            If CharList(KillAnim).FxLoopTimes > 0 Then CharList(KillAnim).FxLoopTimes = CharList(KillAnim).FxLoopTimes - 1
                            If CharList(KillAnim).FxLoopTimes < 1 Then
                                CharList(KillAnim).FX = 0
                                Exit Sub
                            End If
                           
                        End If
                    End If
              End If
            End If
        End If
    End If
End If
 
If Grh.GrhIndex = 0 Then Exit Sub
 
 
iGrhIndex = GrhData(Grh.GrhIndex).Frames(Grh.FrameCounter)
 
If center Then
    If GrhData(iGrhIndex).TileWidth <> 1 Then
        X = X - Int(GrhData(iGrhIndex).TileWidth * 16) + 16
    End If
    If GrhData(iGrhIndex).TileHeight <> 1 Then
        Y = Y - Int(GrhData(iGrhIndex).TileHeight * 32) + 32
    End If
End If
 
If map_x Or map_y = 0 Then map_x = 1: map_y = 1
 
    Device_Box_Textured_Render_Advance iGrhIndex, _
        X, Y, _
        GrhData(iGrhIndex).pixelWidth, GrhData(iGrhIndex).pixelHeight, _
        color(), _
        GrhData(iGrhIndex).sX, GrhData(iGrhIndex).sY, _
        alpha, 0, 0, Invert_x, Invert_y
 
 
End Sub


Reemplazar el Sub Geometry_Create_Box por este:


Código:
Private Sub Geometry_Create_Box(ByRef verts() As TLVERTEX, ByRef dest As RECT, ByRef src As RECT, ByRef rgb_list() As Long, _
                                Optional ByRef Textures_Width As Integer, Optional ByRef Textures_Height As Integer, Optional ByVal angle As Single, Optional ByVal Invert_x As Boolean = False, Optional ByVal Invert_y As Boolean = False)
'**************************************************************
'Author: Aaron Perkins
'Modified by Juan Martín Sotuyo Dodero
'Last Modify Date: 11/17/2002
'**************************************************************
    Dim x_center As Single
    Dim y_center As Single
    Dim radius As Single
    Dim x_Cor As Single
    Dim y_Cor As Single
    Dim left_point As Single
    Dim right_point As Single
    Dim temp As Single
    Dim auxr As RECT
 
    If angle <> 0 Then
        'Center coordinates on screen of the square
        x_center = dest.Left + (dest.Right - dest.Left) / 2
        y_center = dest.Top + (dest.bottom - dest.Top) / 2
     
        'Calculate radius
        radius = Sqr((dest.Right - x_center) ^ 2 + (dest.bottom - y_center) ^ 2)
     
        'Calculate left and right points
        temp = (dest.Right - x_center) / radius
        right_point = Atn(temp / Sqr(-temp * temp + 1))
        left_point = PI - right_point
    End If
 
    'Calculate screen coordinates of sprite, and only rotate if necessary
    If angle = 0 Then
        x_Cor = dest.Left
        y_Cor = dest.bottom
    Else
        x_Cor = x_center + Cos(-left_point - angle) * radius
        y_Cor = y_center - Sin(-left_point - angle) * radius
    End If
 
    auxr = src
 
    If angle < 0 Then
        src.Left = auxr.Right
        src.Right = auxr.Left
    End If
 
    If Invert_x Then
        src.Left = auxr.Right
        src.Right = auxr.Left
    End If
 
    If Invert_y Then
        src.Top = auxr.bottom
        src.bottom = auxr.Top
    End If
     
    '0 - Bottom left vertex
    If Textures_Width And Textures_Height Then
        verts(0) = Geometry_Create_TLVertex(x_Cor, y_Cor, 0, 1, rgb_list(0), 0, src.Left / Textures_Width, (src.bottom + 1) / Textures_Height)
    Else
        verts(0) = Geometry_Create_TLVertex(x_Cor, y_Cor, 0, 1, rgb_list(0), 0, 0, 0)
    End If
    'Calculate screen coordinates of sprite, and only rotate if necessary
    If angle = 0 Then
        x_Cor = dest.Left
        y_Cor = dest.Top
    Else
        x_Cor = x_center + Cos(left_point - angle) * radius
        y_Cor = y_center - Sin(left_point - angle) * radius
    End If
 
    '1 - Top left vertex
    If Textures_Width And Textures_Height Then
        verts(1) = Geometry_Create_TLVertex(x_Cor, y_Cor, 0, 1, rgb_list(1), 0, src.Left / Textures_Width, src.Top / Textures_Height)
    Else
        verts(1) = Geometry_Create_TLVertex(x_Cor, y_Cor, 0, 1, rgb_list(1), 0, 0, 1)
    End If
    'Calculate screen coordinates of sprite, and only rotate if necessary
    If angle = 0 Then
        x_Cor = dest.Right
        y_Cor = dest.bottom
    Else
        x_Cor = x_center + Cos(-right_point - angle) * radius
        y_Cor = y_center - Sin(-right_point - angle) * radius
    End If
 
    '2 - Bottom right vertex
    If Textures_Width And Textures_Height Then
        verts(2) = Geometry_Create_TLVertex(x_Cor, y_Cor, 0, 1, rgb_list(2), 0, (src.Right + 1) / Textures_Width, (src.bottom + 1) / Textures_Height)
    Else
        verts(2) = Geometry_Create_TLVertex(x_Cor, y_Cor, 0, 1, rgb_list(2), 0, 1, 0)
    End If
    'Calculate screen coordinates of sprite, and only rotate if necessary
    If angle = 0 Then
        x_Cor = dest.Right
        y_Cor = dest.Top
    Else
        x_Cor = x_center + Cos(right_point - angle) * radius
        y_Cor = y_center - Sin(right_point - angle) * radius
    End If
 
    '3 - Top right vertex
    If Textures_Width And Textures_Height Then
        verts(3) = Geometry_Create_TLVertex(x_Cor, y_Cor, 0, 1, rgb_list(3), 0, (src.Right + 1) / Textures_Width, src.Top / Textures_Height)
    Else
        verts(3) = Geometry_Create_TLVertex(x_Cor, y_Cor, 0, 1, rgb_list(3), 0, 1, 1)
    End If
 
End Sub



Buscar en el Sub RenderScreen:


Código:
ElseIf Not CharList(MapData(X, Y).CharIndex).invisible And TempChar.Head.Head(TempChar.Heading).GrhIndex > 0 Then



Y abajo poner:



Código:
                        '**************************************************
                        'Reflejo de Agua***********************************
                        '/////By Thusing/////
                        With TempChar
                        If HayAgua(.POS.X, .POS.Y + 1) Then
                       
                        'Cuerpo
                        Call Draw_Grh(TempChar.Body.Walk(TempChar.Heading), iPPx, iPPy + 40, 1, 1, MuyTransparente(), True, False, True)
                       
                        'Cabeza
                        If TempChar.Head.Head(TempChar.Heading).GrhIndex > 0 Then
                        Call Draw_Grh(TempChar.Head.Head(TempChar.Heading), iPPx + TempChar.Body.HeadOffset.X, iPPy - TempChar.Body.HeadOffset.Y + 11, 1, 0, MuyTransparente(), True, False, True)
                        End If
                       
                        'Casco
                        If TempChar.casco.Head(TempChar.Heading).GrhIndex > 0 Then
                        Call Draw_Grh(TempChar.casco.Head(TempChar.Heading), iPPx + TempChar.Body.HeadOffset.X, iPPy - TempChar.Body.HeadOffset.Y + 11, 1, 0, MuyTransparente(), True, False, True)
                        End If
                       
                        'Arma
                        If TempChar.arma.WeaponWalk(TempChar.Heading).GrhIndex > 0 Then
                        Call Draw_Grh(TempChar.arma.WeaponWalk(TempChar.Heading), iPPx, iPPy + 40, 1, 1, MuyTransparente(), True, False, True)
                        End If
                       
                        'Escudo
                        If TempChar.escudo.ShieldWalk(TempChar.Heading).GrhIndex > 0 Then
                        Call Draw_Grh(TempChar.escudo.ShieldWalk(TempChar.Heading), iPPx, iPPy + 40, 1, 1, MuyTransparente(), True, False, True)
                        End If
                            End If
                        End With
                        '**************************************************
                        'Reflejo de Agua***********************************


Abajo de esta linea:


Código:
'Cuerpo (Barca / Galeon / Galera)


Está la del renderizado de la barca. Abajo de esa, poner:


Código:
                      If HayAgua(TempChar.POS.X, TempChar.POS.Y + 1) Then
                        Call Draw_Grh(TempChar.Body.Walk(TempChar.Heading), iPPx, iPPy + 40, 1, 1, MuyTransparente(), True, False, True)
                        End If



Buscar esta linea:


Código:
If Len(TempChar.Nombre) = 0 Then


Y debajo de la que aparece (la que dibuja el cuerpo), poner:


Código:
                  If HayAgua(TempChar.POS.X, TempChar.POS.Y + 1) Then
                    Call Draw_Grh(TempChar.Body.Walk(TempChar.Heading), iPPx, iPPy + 40, 1, 1, MuyTransparente(), True, False, True)
                    End If



Justo abajo de eso dice:


Código:
'Cabeza


Debajo aparece una linea de un if, y debajo de esa, la que renderiza.
Entre la del If, y la que renderiza la cabeza, poner esto:


Código:
                      If HayAgua(TempChar.POS.X, TempChar.POS.Y + 1) Then
                            Call Draw_Grh(TempChar.Head.Head(TempChar.Heading), iPPx + TempChar.Body.HeadOffset.X, iPPy - TempChar.Body.HeadOffset.Y + 11, 1, 0, MuyTransparente(), True, False, True)
                            End If




Buscar en el mismo Sub:


Código:
If screenmaxX < XMaxMapSize Then screenmaxX = screenmaxX + 1



Y abajo poner:


Código:
              Dim MuyTransparente(3) As Long
                MuyTransparente(0) = RGB(50, 50, 50)
                MuyTransparente(1) = RGB(50, 50, 50)
                MuyTransparente(2) = RGB(50, 50, 50)
                MuyTransparente(3) = RGB(50, 50, 50)



Listo, eso es todo.

PD: Ahi tambien les deje el sub que hise... Draw_Grh.... para tener todo mas ordenadito y no tener que usar un sub para cada cosa. Con este, y el Device_Box_Textured_Render_Advance que les deje, les va a ser todo mas facil, ponen casi todo desde la linea del llamado (alpha, color, imagen invertida o no, inclinacion, etc)

Edite, y agregue el reflejo de la barca, y de los npc's, que no estaban. Tambien arregle la posicion de la cabeza segun donde termina el cuerpo (para que no queden decapitados los q tienen ropa de enano,


Saludos
santi55
santi55
Nivel 12
Nivel 12

Medallas
Reflejo de pj en agua Prensa1

Advertencias Advertencias : 1
Mensajes Mensajes : 156
Puntos Puntos : 49387
Reputación Reputación : 1
Fecha de inscripción Fecha de inscripción : 19/12/2010
País País : Argentina


Volver arriba Ir abajo

Reflejo de pj en agua Empty Re: Reflejo de pj en agua

Mensaje por Francohhh Jue Dic 23, 2010 12:13 pm

Buen aporte, te edite el TH y te puse los códigos entre "CODE" y "/CODE" pero con [ y ].
Francohhh
Francohhh
Administrador
Administrador

Administrador
Medallas
Reflejo de pj en agua Prensa1Reflejo de pj en agua Fundador1Reflejo de pj en agua Participativo1Reflejo de pj en agua Donar1
Reflejo de pj en agua Staff1x Reflejo de pj en agua Moderador1 Reflejo de pj en agua Ao1 Reflejo de pj en agua Desarrollo
Reflejo de pj en agua Radio10 Reflejo de pj en agua Radio110 Reflejo de pj en agua Colabo10 Reflejo de pj en agua Progra10
Reflejo de pj en agua Cs110Reflejo de pj en agua Postea10 Reflejo de pj en agua Senor_10 Reflejo de pj en agua Dueno_10
Reflejo de pj en agua Futbol10

Mensajes Mensajes : 880
Puntos Puntos : 53096
Reputación Reputación : 41
Sexo Sexo : Masculino

Fecha de inscripción Fecha de inscripción : 23/03/2010
Edad Edad : 27
Localización Localización : Mar del Plata

http://www.spikel.org

Volver arriba Ir abajo

Reflejo de pj en agua Empty Re: Reflejo de pj en agua

Mensaje por santi55 Jue Dic 23, 2010 12:14 pm

grax

Francohhh: Este mensaje es considerado FLOOD. Para la próxima lea el reglamento.
santi55
santi55
Nivel 12
Nivel 12

Medallas
Reflejo de pj en agua Prensa1

Advertencias Advertencias : 1
Mensajes Mensajes : 156
Puntos Puntos : 49387
Reputación Reputación : 1
Fecha de inscripción Fecha de inscripción : 19/12/2010
País País : Argentina


Volver arriba Ir abajo

Reflejo de pj en agua Empty Re: Reflejo de pj en agua

Mensaje por Contenido patrocinado


Contenido patrocinado


Volver arriba Ir abajo

Volver arriba


 
Permisos de este foro:
No puedes responder a temas en este foro.