Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
bltPlayer & bltPlayerTop
#1
Im in need of some help, I can't seem to get a thing working. You see, when my player walks to the very top of the map, halv of him dissapears, I believe many have had the same problem. And the same goes when he walks to the very left, but only certain equipment dissapears then.

bltPlayer
Code:
Sub BltPlayer(ByVal Index As Long)
Dim Anim As Byte
Dim X As Long, Y As Long
Dim AttackSpeed As Long

    If GetPlayerWeaponSlot(Index) > 0 Then
        AttackSpeed = Item(GetPlayerInvItemNum(Index, GetPlayerWeaponSlot(Index))).AttackSpeed
    Else
        AttackSpeed = 1000
    End If

   ' Only used if ever want to switch to blt rather then bltfast
   With rec_pos
       .top = GetPlayerY(Index) * PIC_Y + Player(Index).YOffset
       .Bottom = .top + PIC_Y
       .Left = GetPlayerX(Index) * PIC_X + Player(Index).XOffset
       .Right = .Left + PIC_X
   End With

   ' Check for animation
    If Player(Index).Attacking = 0 Then
       Select Case GetPlayerDir(Index)
           Case DIR_UP
               If (Player(Index).YOffset < PIC_Y / 1) Then
                    Anim = 1
               End If
               If (Player(Index).YOffset < PIC_Y / 2) Then
                    Anim = 2
               End If
               If (Player(Index).YOffset < PIC_Y / 8) Then
                    Anim = 0
               End If
           Case DIR_DOWN
               If (Player(Index).YOffset > (PIC_Y / 1) * -1) Then
                    Anim = 1
               End If
               If (Player(Index).YOffset > (PIC_Y / 2) * -1) Then
                    Anim = 2
               End If
               If (Player(Index).YOffset > (PIC_Y / 8) * -1) Then
                    Anim = 0
               End If
           Case DIR_LEFT
               If (Player(Index).XOffset < PIC_Y / 1) Then
                    Anim = 1
               End If
               If (Player(Index).XOffset < PIC_Y / 2) Then
                    Anim = 0
               End If
           Case DIR_RIGHT
               If (Player(Index).XOffset < PIC_Y / 2 * -1) Then
                    Anim = 1
               End If
       End Select
   Else
       If Player(Index).AttackTimer + AttackSpeed > GetTickCount Then
           Anim = 3
       End If
   End If
   ' Check to see if we want to stop making him attack
   If Player(Index).AttackTimer + AttackSpeed < GetTickCount Then
       Player(Index).Attacking = 0
       Player(Index).AttackTimer = 0
   End If
    
   rec.Left = (GetPlayerDir(Index) * 4 + Anim) * PIC_X
   rec.Right = rec.Left + PIC_X
    
   X = GetPlayerX(Index) * PIC_X + Player(Index).XOffset
   Y = GetPlayerY(Index) * PIC_Y + Player(Index).YOffset - 4
    
' Check if its out of bounds because of the offset
    If Y < 0 Then
        Y = 0
        With rec
            .top = .top + (Y * -1)
        End With
    End If
    
    If GetPlayerDir(Index) = DIR_DOWN Then
        If Player(Index).Wing > 0 Then
            If GetPlayerAccess(Index) < 1 Then
                rec.top = 170 * PIC_Y + 32
            ElseIf GetPlayerAccess(Index) > 0 Then
                rec.top = 172 * PIC_Y + 32
            End If
            rec.Bottom = rec.top + PIC_Y
            rec.Left = (GetPlayerDir(Index) * 4 + Anim) * 64
            rec.Right = rec.Left + PIC_X + 32
            Call DD_BackBuffer.BltFast(X - 16, Y, DD_ItemSurf, rec, DDBLTFAST_WAIT Or DDBLTFAST_SRCCOLORKEY)
        End If
        If Player(Index).Cape > 0 Then
           rec.top = Item(Player(Index).Cape).Pic * PIC_Y + 32
           rec.Bottom = rec.top + PIC_Y
            rec.Left = (GetPlayerDir(Index) * 4 + Anim) * PIC_X
            rec.Right = rec.Left + PIC_X
           Call DD_BackBuffer.BltFast(X, Y, DD_ItemSurf, rec, DDBLTFAST_WAIT Or DDBLTFAST_SRCCOLORKEY)
        End If
    End If
    
   If GetPlayerDir(Index) = DIR_UP Then
       If Player(Index).Shield > 0 Then
           rec.top = Item(Player(Index).Shield).Pic * PIC_Y + 32
           rec.Bottom = rec.top + PIC_Y
           rec.Left = (GetPlayerDir(Index) * 4 + Anim) * PIC_X
            rec.Right = rec.Left + PIC_X
           Call DD_BackBuffer.BltFast(X, Y, DD_ItemSurf, rec, DDBLTFAST_WAIT Or DDBLTFAST_SRCCOLORKEY)
       End If
       'If Item(Player(Index).Weapon).Pic  0 Then
           rec.top = Item(Player(Index).Weapon).Pic * PIC_Y + 32
           rec.Bottom = rec.top + PIC_Y
           rec.Left = (GetPlayerDir(Index) * 4 + Anim) * 64
           rec.Right = rec.Left + PIC_X + 32
           Call DD_BackBuffer.BltFast(X - 16, Y, DD_ItemSurf, rec, DDBLTFAST_WAIT Or DDBLTFAST_SRCCOLORKEY)
       End If
   End If
    
   If GetPlayerDir(Index) = DIR_DOWN Then
       If Player(Index).Weapon > 0 Then
           rec.top = Item(Player(Index).Weapon).Pic * PIC_Y + 32
           rec.Bottom = rec.top + PIC_Y
           rec.Left = (GetPlayerDir(Index) * 4 + Anim) * 64
           rec.Right = rec.Left + PIC_X + 32
           Call DD_BackBuffer.BltFast(X - 16, Y, DD_ItemSurf, rec, DDBLTFAST_WAIT Or DDBLTFAST_SRCCOLORKEY)
       End If
       If Player(Index).Shield > 0 Then
           rec.Left = (GetPlayerDir(Index) * 4 + Anim) * PIC_X
           rec.Right = rec.Left + PIC_X
           rec.top = Item(Player(Index).Shield).Pic * PIC_Y + 32
           rec.Bottom = rec.top + PIC_Y
           Call DD_BackBuffer.BltFast(X, Y, DD_ItemSurf, rec, DDBLTFAST_WAIT Or DDBLTFAST_SRCCOLORKEY)
       End If
   End If
    
    If GetPlayerDir(Index) = DIR_UP Then
        If Player(Index).Cape > 0 Then
           rec.top = Item(Player(Index).Cape).Pic * PIC_Y + 32
           rec.Bottom = rec.top + PIC_Y
           rec.Left = (GetPlayerDir(Index) * 4 + Anim) * PIC_X
            rec.Right = rec.Left + PIC_X
           Call DD_BackBuffer.BltFast(X, Y, DD_ItemSurf, rec, DDBLTFAST_WAIT Or DDBLTFAST_SRCCOLORKEY)
        End If
        If Player(Index).Wing > 0 Then
            If GetPlayerAccess(Index) < 1 Then
                rec.top = 170 * PIC_Y + 32
            ElseIf GetPlayerAccess(Index) > 0 Then
                rec.top = 172 * PIC_Y + 32
            End If
            rec.Bottom = rec.top + PIC_Y
            rec.Left = (GetPlayerDir(Index) * 4 + Anim) * 64
            rec.Right = rec.Left + PIC_X + 32
            Call DD_BackBuffer.BltFast(X - 16, Y, DD_ItemSurf, rec, DDBLTFAST_WAIT Or DDBLTFAST_SRCCOLORKEY)
        End If
    End If
End Sub

bltPlayerTop
Code:
Public Sub BltPlayerTop(ByVal Index As Long)
Dim Anim As Byte
Dim X As Long, Y As Long
Dim AttackSpeed As Long

    If GetPlayerWeaponSlot(Index) > 0 Then
        AttackSpeed = Item(GetPlayerInvItemNum(Index, GetPlayerWeaponSlot(Index))).AttackSpeed
    Else
        AttackSpeed = 1000
    End If

   ' Only used if ever want to switch to blt rather then bltfast
   With rec_pos
       .top = GetPlayerY(Index) * PIC_Y + Player(Index).YOffset
       .Bottom = .top + PIC_Y
       .Left = GetPlayerX(Index) * PIC_X + Player(Index).XOffset
       .Right = .Left + PIC_X
   End With

   ' Check for animation
    If Player(Index).Attacking = 0 Then
       Select Case GetPlayerDir(Index)
           Case DIR_UP
               If (Player(Index).YOffset < PIC_Y / 1) Then
                    Anim = 1
               End If
               If (Player(Index).YOffset < PIC_Y / 2) Then
                    Anim = 2
               End If
               If (Player(Index).YOffset < PIC_Y / 8) Then
                    Anim = 0
               End If
           Case DIR_DOWN
               If (Player(Index).YOffset > (PIC_Y / 1) * -1) Then
                    Anim = 1
               End If
               If (Player(Index).YOffset > (PIC_Y / 2) * -1) Then
                    Anim = 2
               End If
               If (Player(Index).YOffset > (PIC_Y / 8) * -1) Then
                    Anim = 0
               End If
           Case DIR_LEFT
               If (Player(Index).XOffset < PIC_Y / 1) Then
                    Anim = 1
               End If
               If (Player(Index).XOffset < PIC_Y / 2) Then
                    Anim = 0
               End If
           Case DIR_RIGHT
               If (Player(Index).XOffset < PIC_Y / 2 * -1) Then
                    Anim = 1
               End If
       End Select
   Else
       If Player(Index).AttackTimer + AttackSpeed > GetTickCount Then
           Anim = 3
       End If
   End If
   ' Check to see if we want to stop making him attack
   If Player(Index).AttackTimer + AttackSpeed < GetTickCount Then
       Player(Index).Attacking = 0
       Player(Index).AttackTimer = 0
   End If
    
   rec.Left = (GetPlayerDir(Index) * 4 + Anim) * PIC_X
   rec.Right = rec.Left + PIC_X
    
   X = GetPlayerX(Index) * PIC_X + Player(Index).XOffset
   Y = GetPlayerY(Index) * PIC_Y + Player(Index).YOffset - 4
    
   ' Check if its out of bounds because of the offset
    If Y < 0 Then
        Y = 0
        With rec
            .top = .top + (Y * -1)
        End With
    End If
    
    If GetPlayerDir(Index) = DIR_DOWN Then
        If Player(Index).Wing > 0 Then
            If GetPlayerAccess(Index) < 1 Then
                rec.top = 170 * PIC_Y
            ElseIf GetPlayerAccess(Index) > 0 Then
                rec.top = 172 * PIC_Y
            End If
            rec.Bottom = rec.top + PIC_Y
            rec.Left = (GetPlayerDir(Index) * 4 + Anim) * 64
            rec.Right = rec.Left + PIC_X + 32
            Call DD_BackBuffer.BltFast(X - 16, Y - 32, DD_ItemSurf, rec, DDBLTFAST_WAIT Or DDBLTFAST_SRCCOLORKEY)
        End If
        If Player(Index).Cape > 0 Then
           rec.top = Item(Player(Index).Cape).Pic * PIC_Y
           rec.Bottom = rec.top + PIC_Y
            rec.Left = (GetPlayerDir(Index) * 4 + Anim) * PIC_X
            rec.Right = rec.Left + PIC_X
           Call DD_BackBuffer.BltFast(X, Y - 32, DD_ItemSurf, rec, DDBLTFAST_WAIT Or DDBLTFAST_SRCCOLORKEY)
        End If
    End If
    
   If GetPlayerDir(Index) = DIR_UP Then
       If Player(Index).Shield > 0 Then
           rec.top = Item(Player(Index).Shield).Pic * PIC_Y
           rec.Bottom = rec.top + PIC_Y
           rec.Left = (GetPlayerDir(Index) * 4 + Anim) * PIC_X
            rec.Right = rec.Left + PIC_X
           Call DD_BackBuffer.BltFast(X, Y - 32, DD_ItemSurf, rec, DDBLTFAST_WAIT Or DDBLTFAST_SRCCOLORKEY)
       End If
       'If Item(Player(Index).Weapon).Pic  0 Then
           rec.top = Item(Player(Index).Cape).Pic * PIC_Y
           rec.Bottom = rec.top + PIC_Y
           rec.Left = (GetPlayerDir(Index) * 4 + Anim) * PIC_X
            rec.Right = rec.Left + PIC_X
           Call DD_BackBuffer.BltFast(X, Y - 32, DD_ItemSurf, rec, DDBLTFAST_WAIT Or DDBLTFAST_SRCCOLORKEY)
        End If
        If Player(Index).Wing > 0 Then
            If GetPlayerAccess(Index) < 1 Then
                rec.top = 170 * PIC_Y
            ElseIf GetPlayerAccess(Index) > 0 Then
                rec.top = 172 * PIC_Y
            End If
            rec.Bottom = rec.top + PIC_Y
            rec.Left = (GetPlayerDir(Index) * 4 + Anim) * 64
            rec.Right = rec.Left + PIC_X + 32
            Call DD_BackBuffer.BltFast(X - 16, Y - 32, DD_ItemSurf, rec, DDBLTFAST_WAIT Or DDBLTFAST_SRCCOLORKEY)
        End If
    End If
    
   If Player(Index).Armor > 0 Then
           rec.top = Item(Player(Index).Armor).Pic * PIC_Y
           rec.Bottom = rec.top + PIC_Y
           rec.Left = (GetPlayerDir(Index) * 4 + Anim) * PIC_X
            rec.Right = rec.Left + PIC_X
           Call DD_BackBuffer.BltFast(X, Y - 32, DD_ItemSurf, rec, DDBLTFAST_WAIT Or DDBLTFAST_SRCCOLORKEY)
   End If
   'ElseIf Player(Index).Armor  0 Then
           rec.top = Item(Player(Index).Helmet).Pic * PIC_Y
           rec.Bottom = rec.top + PIC_Y
           rec.Left = (GetPlayerDir(Index) * 4 + Anim) * PIC_X
            rec.Right = rec.Left + PIC_X
           Call DD_BackBuffer.BltFast(X, Y - 37, DD_ItemSurf, rec, DDBLTFAST_WAIT Or DDBLTFAST_SRCCOLORKEY)
   ElseIf Player(Index).Helmet  0 Then
           rec.top = Item(Player(Index).Shield).Pic * PIC_Y
           rec.Bottom = rec.top + PIC_Y
           rec.Left = (GetPlayerDir(Index) * 4 + Anim) * PIC_X
            rec.Right = rec.Left + PIC_X
           Call DD_BackBuffer.BltFast(X, Y - 32, DD_ItemSurf, rec, DDBLTFAST_WAIT Or DDBLTFAST_SRCCOLORKEY)
       End If
   End If
    
   If GetPlayerDir(Index) = DIR_RIGHT Then
       If Player(Index).Weapon > 0 Then
           rec.top = Item(Player(Index).Weapon).Pic * PIC_Y
           rec.Bottom = rec.top + PIC_Y
           rec.Left = (GetPlayerDir(Index) * 4 + Anim) * 64
           rec.Right = rec.Left + PIC_X + 32
           Call DD_BackBuffer.BltFast(X - 16, Y - 32, DD_ItemSurf, rec, DDBLTFAST_WAIT Or DDBLTFAST_SRCCOLORKEY)
       End If
   End If
    
   If GetPlayerDir(Index) = DIR_DOWN Then
       If Player(Index).Weapon > 0 Then
           rec.top = Item(Player(Index).Weapon).Pic * PIC_Y
           rec.Bottom = rec.top + PIC_Y
           rec.Left = (GetPlayerDir(Index) * 4 + Anim) * 64
           rec.Right = rec.Left + PIC_X + 32
           Call DD_BackBuffer.BltFast(X - 16, Y - 32, DD_ItemSurf, rec, DDBLTFAST_WAIT Or DDBLTFAST_SRCCOLORKEY)
       End If
       If Player(Index).Shield > 0 Then
           rec.Left = (GetPlayerDir(Index) * 4 + Anim) * PIC_X
           rec.Right = rec.Left + PIC_X
           rec.top = Item(Player(Index).Shield).Pic * PIC_Y
           rec.Bottom = rec.top + PIC_Y
           Call DD_BackBuffer.BltFast(X, Y - 32, DD_ItemSurf, rec, DDBLTFAST_WAIT Or DDBLTFAST_SRCCOLORKEY)
       End If
   End If
    
    If GetPlayerDir(Index) = DIR_UP Then
        If Player(Index).Cape > 0 Then
           rec.top = Item(Player(Index).Cape).Pic * PIC_Y
           rec.Bottom = rec.top + PIC_Y
           rec.Left = (GetPlayerDir(Index) * 4 + Anim) * PIC_X
            rec.Right = rec.Left + PIC_X
           Call DD_BackBuffer.BltFast(X, Y - 32, DD_ItemSurf, rec, DDBLTFAST_WAIT Or DDBLTFAST_SRCCOLORKEY)
        End If
        If Player(Index).Wing > 0 Then
            If GetPlayerAccess(Index) < 1 Then
                rec.top = 170 * PIC_Y
            ElseIf GetPlayerAccess(Index) > 0 Then
                rec.top = 172 * PIC_Y
            End If
            rec.Bottom = rec.top + PIC_Y
            rec.Left = (GetPlayerDir(Index) * 4 + Anim) * 64
            rec.Right = rec.Left + PIC_X + 32
            Call DD_BackBuffer.BltFast(X - 16, Y - 32, DD_ItemSurf, rec, DDBLTFAST_WAIT Or DDBLTFAST_SRCCOLORKEY)
        End If
    End If
End Sub

I hope you can help me out Smile

By the way, im like 100% sure it has to do with this:
Code:
' Check if its out of bounds because of the offset
    If Y < 0 Then
        Y = 0
        With rec
            .top = .top + (Y * -1)
        End With
    End If
Reply


Messages In This Thread

Forum Jump:


Users browsing this thread: 1 Guest(s)