Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Optimizing Graphic Output (Finished)
#8
Well, the code you posted is wrong. So please make sure you post the correct code before posting it.

You still using two For Loops.. I think this is what you mean:
Code:
For i = 1 To MAX_MAP_NPCS
' Make sure that theres an npc there, and if not exit the sub
            If MapNpc(i).Num > 0 Then
                ' Blit tiles around the npc
                yChange1 = 2
                yChange2 = 1
                xChange1 = 1
                xChange2 = 1
          
                If MapNpc(i).y - 2 < 0 Then yChange1 = 1
                If MapNpc(i).y + 2 > MAX_MAPY Then yChange2 = 1
                If MapNpc(i).x - 2 < 1 Then xChange1 = 1
                If MapNpc(i).x + 2 > MAX_MAPX Then xChange2 = 1
          
                If MapNpc(i).y - 1 < 0 Then yChange1 = 0
                If MapNpc(i).y + 1 > MAX_MAPY Then yChange2 = 0
                If MapNpc(i).x - 1 < 0 Then xChange1 = 0
                If MapNpc(i).x + 1 > MAX_MAPX Then xChange2 = 0
          
                For y1 = MapNpc(i).y - yChange1 To MapNpc(i).y + yChange2
                    For x1 = (MapNpc(i).x - xChange1) To (MapNpc(i).x + xChange2)
                       Call BltTile(x1, y1)
                    Next x1
                Next y1
            End If

Call BltNpc(i)

            ' Make sure that theres an npc there
            If MapNpc(i).Num > 0 Then
                ' Blit tiles around the npc
                yChange1 = 2
                yChange2 = 1
                xChange1 = 1
                xChange2 = 1
          
                If MapNpc(i).y - 2 < 0 Then yChange1 = 1
                If MapNpc(i).y + 2 > MAX_MAPY Then yChange2 = 1
                If MapNpc(i).x - 2 < 1 Then xChange1 = 1
                If MapNpc(i).x + 2 > MAX_MAPX Then xChange2 = 1
          
                If MapNpc(i).y - 1 < 0 Then yChange1 = 0
                If MapNpc(i).y + 1 > MAX_MAPY Then yChange2 = 0
                If MapNpc(i).x - 1 < 0 Then xChange1 = 0
                If MapNpc(i).x + 1 > MAX_MAPX Then xChange2 = 0
          
                For y1 = MapNpc(i).y - yChange1 To MapNpc(i).y + yChange2
                    For x1 = (MapNpc(i).x - xChange1) To (MapNpc(i).x + xChange2)
                       Call BltFringeTile(x1, y1)
                    Next x1
                Next y1
            End If
Next i

I think I tested that, and it didn't work. But I can test it when I get home. Cause if it works, then I can optimize the MAX_PLAYERS too.


Messages In This Thread

Forum Jump:


Users browsing this thread: 1 Guest(s)