Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Too many local, nonstatic variables
#7
Yeah, I just did that, thanks. It fixed that problem, but now I get a subscript out of range with this:

Code:
Ground = Map.Tile(X, Y).Ground

In this:

Code:
Sub BltTile(ByVal X As Long, ByVal Y As Long)
  Dim Bufx As Long, Bufy As Long
  Dim i As Integer
  Dim Ground As Long
  Dim Anim1 As Long
  Dim Anim2 As Long

  For i = -1 To 7
    If i = -1 Then
      Ground = Map.Tile(X, Y).Ground
      Anim1 = Map.Tile(X, Y).Mask
      Anim2 = Map.Tile(X, Y).Anim
      Bufx = (X * PIC_X) + (PIC_X * (MAX_MAPX + 1))
      Bufy = (Y * PIC_Y) + (PIC_Y * (MAX_MAPY + 1))
    Else
      Ground = SMaps(i).Tile(X, Y).Ground
      Anim1 = SMaps(i).Tile(X, Y).Mask
      Anim2 = SMaps(i).Tile(X, Y).Anim
      Select Case i
      Case 0
        Bufx = (X * PIC_X) + (PIC_X * (MAX_MAPX + 1))
        Bufy = Y * PIC_Y
      Case 1
        Bufx = (X * PIC_X) + (2 * (PIC_X * (MAX_MAPX + 1)))
        Bufy = Y * PIC_Y
      Case 2
        Bufx = (X * PIC_X) + (2 * (PIC_X * (MAX_MAPX + 1)))
        Bufy = (Y * PIC_Y) + (PIC_Y * (MAX_MAPY + 1))
      Case 3
        Bufx = (X * PIC_X) + (2 * (PIC_X * (MAX_MAPX + 1)))
        Bufy = (Y * PIC_Y) + (2 * (PIC_Y * (MAX_MAPY + 1)))
      Case 4
        Bufx = (X * PIC_X) + (PIC_X * (MAX_MAPX + 1))
        Bufy = (Y * PIC_Y) + (2 * (PIC_Y * (MAX_MAPY + 1)))
      Case 5
        Bufx = X * PIC_X
        Bufy = (Y * PIC_Y) + (2 * (PIC_Y * (MAX_MAPY + 1)))
      Case 6
        Bufx = X * PIC_X
        Bufy = (Y * PIC_Y) + (PIC_Y * (MAX_MAPY + 1))
      Case 7
        Bufx = X * PIC_X
        Bufy = Y * PIC_Y
      End Select
    End If
    
    rec.top = Int(Ground / 7) * PIC_Y
    rec.Bottom = rec.top + PIC_Y
    rec.Left = (Ground - Int(Ground / 7) * 7) * PIC_X
    rec.Right = rec.Left + PIC_X
    Call DD_BackBuffer.BltFast(Bufx, Bufy, DD_TileSurf, rec, DDBLTFAST_WAIT)
    
    If (MapAnim = 0) Or (Anim2  0 Then
              rec.top = Int(Anim2 / 7) * PIC_Y
              rec.Bottom = rec.top + PIC_Y
              rec.Left = (Anim2 - Int(Anim2 / 7) * 7) * PIC_X
              rec.Right = rec.Left + PIC_X
              Call DD_BackBuffer.BltFast(Bufx, Bufy, DD_TileSurf, rec, DDBLTFAST_WAIT Or DDBLTFAST_SRCCOLORKEY)
        End If
    End If
  Next
End Sub

[EDIT] Ground = 0 If that helps any.
Reply


Messages In This Thread

Forum Jump:


Users browsing this thread: 1 Guest(s)