Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- Public Sub Render_Graphics()
- Dim x As Long
- Dim y As Long
- Dim i As Long
- Dim n As Long
- DX8.BeginScene
- For x = -1 To MAX_MAPX + 1
- For y = -1 To MAX_MAPY + 1
- Call BltMapTile(x, y)
- Next
- Next
- For n = 1 To 9
- If (tMap(n) <> 0) And (tMap(n) < MAX_MAPS + 1) Then
- For i = 1 To MAX_MAP_ITEMS
- If MapItem(i, tMap(n)).Num > 0 Then
- Call BltItem(i, tMap(n))
- End If
- Next
- End If
- Next
- For y = -1 To MAX_MAPY + 1
- For i = 1 To High_Index
- If Player(i).y = y Then
- Call BltPlayer(i)
- End If
- Next
- For n = 1 To 9
- If (tMap(n) <> 0) And (tMap(n) < MAX_MAPS + 1) Then
- For i = 1 To MAX_MAP_NPCS
- If MapNpc(i, tMap(n)).y = y Then
- Call BltNpc(i, tMap(n))
- End If
- Next
- End If
- Next
- Next
- For x = -1 To MAX_MAPX + 1
- For y = -1 To MAX_MAPY + 1
- Call BltMapFringeTile(x, y)
- Next
- Next
- If BFPS Then
- Call DX8.DrawText((MAX_MAPX + 1) * PIC_X - Len(Trim$("FPS: " & GameFPS)) * 10 - 3, 3, Trim$("FPS: " & GameFPS), DX8.ARGB(255, 255, 255, 255))
- End If
- For i = 1 To High_Index
- Call DrawPlayerName(i)
- Call DrawPlayerGuildName(i)
- Next
- ' Draw map name
- Call DX8.DrawText(DrawMapNameX, DrawMapNameY, map(5).Name, DX8.AcRGB(255, DrawMapNameColor))
- ' draw cursor and player location
- If BLoc Then
- Call DX8.DrawText(3, 3, Trim$("Cur X: " & CurX & " Y: " & CurY), DX8.ARGB(255, 255, 255, 255))
- Call DX8.DrawText(3, 14, Trim$("Loc X: " & GetPlayerX(MyIndex) & " Y: " & GetPlayerY(MyIndex)), DX8.ARGB(255, 255, 255, 255))
- Call DX8.DrawText(3, 25, Trim$("Map#:" & GetPlayerMap(MyIndex)), DX8.ARGB(255, 255, 255, 255))
- End If
- ' draw map attributes
- If Editor = EDITOR_MAP Then
- If frmMainGame.optAttribs.Value Then
- Call DrawMapAttributes
- End If
- End If
- Call DX8.EndScene
- End Sub
- '///// BltPLayer and BltNPC////////
- '///////////////////////////////////
- Sub BltPlayer(ByVal Index As Long)
- Dim Anim As Byte
- Dim x As Long, y As Long
- Dim x2 As Long, y2 As Long
- Dim i As Long
- Dim insight As Boolean
- Dim Sprite As Long, spriteleft As Long
- Dim spellnum As Long
- Sprite = GetPlayerSprite(Index)
- If Sprite = 0 Then Sprite = 1
- DX8.SetTexture Tr_Sprites(Sprite)
- insight = False
- Select Case Player(Index).map
- Case map(5).Right
- insight = True
- x2 = MAX_MAPX + 1
- y2 = 0
- Case map(5).Left
- insight = True
- x2 = -1 * (MAX_MAPX + 1)
- y2 = 0
- Case map(5).Up
- insight = True
- x2 = 0
- y2 = -1 * (MAX_MAPY + 1)
- Case map(5).Down
- insight = True
- x2 = 0
- y2 = MAX_MAPY + 1
- Case map(4).Up 'north west
- insight = True
- x2 = -1 * (MAX_MAPX + 1)
- y2 = -1 * (MAX_MAPY + 1)
- Case map(4).Down 'south west
- insight = True
- x2 = -1 * (MAX_MAPX + 1)
- y2 = (MAX_MAPY + 1)
- Case map(6).Up 'north east
- insight = True
- x2 = (MAX_MAPX + 1)
- y2 = -1 * (MAX_MAPY + 1)
- Case map(4).Down ' south east
- insight = True
- x2 = (MAX_MAPX + 1)
- y2 = (MAX_MAPY + 1)
- Case Player(MyIndex).map
- insight = True
- x2 = 0
- y2 = 0
- End Select
- If insight = True Then
- Anim = 0
- If Player(Index).Attacking = 0 Then
- Select Case GetPlayerDir(Index)
- Case DIR_UP
- If Player(Index).YOffset < PIC_Y \ 2 Then Anim = 1
- Case DIR_DOWN
- If Player(Index).YOffset < PIC_Y \ -2 Then Anim = 1
- Case DIR_LEFT
- If Player(Index).XOffset < PIC_Y \ 2 Then Anim = 1
- Case DIR_RIGHT
- If Player(Index).XOffset < PIC_Y \ -2 Then Anim = 1
- End Select
- Else
- If Player(Index).AttackTimer + 500 > GetTickCount Then
- Anim = 2
- End If
- End If
- If Player(Index).AttackTimer + 1000 < GetTickCount Then
- Player(Index).Attacking = 0
- Player(Index).AttackTimer = 0
- End If
- Select Case GetPlayerDir(Index)
- Case DIR_UP
- spriteleft = DIR_UP
- Case DIR_RIGHT
- spriteleft = DIR_RIGHT
- Case DIR_DOWN
- spriteleft = DIR_DOWN
- Case DIR_LEFT
- spriteleft = DIR_LEFT
- End Select
- x = GetPlayerX(Index) * PIC_X + Player(Index).XOffset
- y = GetPlayerY(Index) * PIC_Y + Player(Index).YOffset
- Call DX8.DrawTexture(x2 * PIC_X + x + StaticX, y2 * PIC_Y + y + StaticY, PIC_X, PIC_Y, (spriteleft * 3 + Anim) * (32), 0, PIC_X, PIC_Y, DX8.ARGB(255, 255, 255, 255), 512, 32)
- For i = 1 To MAX_SPELLANIM
- spellnum = Player(Index).SpellAnimations(i).spellnum
- If spellnum > 0 Then
- If Spell(spellnum).Pic > 0 Then
- If Player(Index).SpellAnimations(i).Timer < GetTickCount Then
- Player(Index).SpellAnimations(i).FramePointer = Player(Index).SpellAnimations(i).FramePointer + 1
- Player(Index).SpellAnimations(i).Timer = GetTickCount + 120
- If Player(Index).SpellAnimations(i).FramePointer >= 12 Then
- Player(Index).SpellAnimations(i).spellnum = 0
- Player(Index).SpellAnimations(i).Timer = 0
- Player(Index).SpellAnimations(i).FramePointer = 0
- End If
- End If
- If Player(Index).SpellAnimations(i).spellnum > 0 Then
- Call DX8.SetTexture(Tr_Spells(spellnum))
- Call DX8.DrawTexture(x, y, PIC_X, PIC_Y, Player(Index).SpellAnimations(i).FramePointer * SIZE_X, 0, PIC_X, PIC_Y, DX8.ARGB(255, 255, 255, 255), 512, 32)
- End If
- End If
- End If
- Next
- End If
- End Sub
- Public Sub BltNpc(ByVal MapNpcNum As Long, ByVal MapNum As Long)
- Dim Anim As Long
- Dim i As Long
- Dim spellnum As Long
- Dim x, x2 As Long
- Dim y, y2 As Long
- Dim Sprite As Long, spriteleft As Long
- Dim insight As Boolean
- ' Make sure that theres an npc there, and if not exit the sub
- If MapNpc(MapNpcNum, MapNum).Num <= 0 Then
- Exit Sub
- End If
- Sprite = Npc(MapNpc(MapNpcNum, MapNum).Num).Sprite
- DX8.SetTexture Tr_Sprites(Sprite)
- insight = False
- Select Case MapNum
- Case map(5).Right
- insight = True
- x2 = MAX_MAPX + 1
- y2 = 0
- Case map(5).Left
- insight = True
- x2 = -1 * (MAX_MAPX + 1)
- y2 = 0
- Case map(5).Up
- insight = True
- x2 = 0
- y2 = -1 * (MAX_MAPY + 1)
- Case map(5).Down
- insight = True
- x2 = 0
- y2 = MAX_MAPY + 1
- Case map(4).Up 'north west
- insight = True
- x2 = -1 * (MAX_MAPX + 1)
- y2 = -1 * (MAX_MAPY + 1)
- Case map(4).Down 'south west
- insight = True
- x2 = -1 * (MAX_MAPX + 1)
- y2 = (MAX_MAPY + 1)
- Case map(6).Up 'north east
- insight = True
- x2 = (MAX_MAPX + 1)
- y2 = -1 * (MAX_MAPY + 1)
- Case map(4).Down ' south east
- insight = True
- x2 = (MAX_MAPX + 1)
- y2 = (MAX_MAPY + 1)
- Case Player(MyIndex).map
- insight = True
- x2 = 0
- y2 = 0
- End Select
- If insight Then
- ' Check for animation
- Anim = 0
- If MapNpc(MapNpcNum, MapNum).Attacking = 0 Then
- Select Case MapNpc(MapNpcNum, MapNum).Dir
- Case DIR_UP
- If (MapNpc(MapNpcNum, MapNum).YOffset < SIZE_Y / 2) Then Anim = 1
- Case DIR_DOWN
- If (MapNpc(MapNpcNum, MapNum).YOffset < SIZE_Y / 2 * -1) Then Anim = 1
- Case DIR_LEFT
- If (MapNpc(MapNpcNum, MapNum).XOffset < SIZE_Y / 2) Then Anim = 1
- Case DIR_RIGHT
- If (MapNpc(MapNpcNum, MapNum).XOffset < SIZE_Y / 2 * -1) Then Anim = 1
- End Select
- Else
- If MapNpc(MapNpcNum, MapNum).AttackTimer + 500 > GetTickCount Then
- Anim = 2
- End If
- End If
- ' Check to see if we want to stop making him attack
- With MapNpc(MapNpcNum, MapNum)
- If .AttackTimer + 1000 < GetTickCount Then
- .Attacking = 0
- .AttackTimer = 0
- End If
- End With
- Select Case MapNpc(MapNpcNum, MapNum).Dir
- Case DIR_UP
- spriteleft = DIR_UP
- Case DIR_RIGHT
- spriteleft = DIR_RIGHT
- Case DIR_DOWN
- spriteleft = DIR_DOWN
- Case DIR_LEFT
- spriteleft = DIR_LEFT
- End Select
- 'With rec
- ' .Top = 0
- ' .Bottom = DDS_Sprite(Sprite).SurfDescription.lHeight
- ' .Left = (spriteleft * 3 + Anim) * (DDS_Sprite(Sprite).SurfDescription.lWidth / 12)
- ' .Right = .Left + (DDS_Sprite(Sprite).SurfDescription.lWidth / 12)
- 'End With
- With MapNpc(MapNpcNum, MapNum)
- x = .x * PIC_X + .XOffset
- y = .y * PIC_Y + .YOffset
- End With
- Call DX8.DrawTexture(x2 * PIC_X + x + StaticX, y2 * PIC_Y + y + StaticY, PIC_X, PIC_Y, (spriteleft * 3 + Anim) * (32), 0, PIC_X, PIC_Y, DX8.ARGB(255, 255, 255, 255), 512, 32)
- ' ** Blit Spells Animations **
- For i = 1 To MAX_SPELLANIM
- spellnum = MapNpc(MapNpcNum, MapNum).SpellAnimations(i).spellnum
- If spellnum > 0 Then
- If Spell(spellnum).Pic > 0 Then
- If MapNpc(MapNpcNum, MapNum).SpellAnimations(i).Timer < GetTickCount Then
- MapNpc(MapNpcNum, MapNum).SpellAnimations(i).FramePointer = MapNpc(MapNpcNum, MapNum).SpellAnimations(i).FramePointer + 1
- MapNpc(MapNpcNum, MapNum).SpellAnimations(i).Timer = GetTickCount + 120
- If MapNpc(MapNpcNum, MapNum).SpellAnimations(i).FramePointer >= 12 Then
- MapNpc(MapNpcNum, MapNum).SpellAnimations(i).spellnum = 0
- MapNpc(MapNpcNum, MapNum).SpellAnimations(i).Timer = 0
- MapNpc(MapNpcNum, MapNum).SpellAnimations(i).FramePointer = 0
- End If
- End If
- If MapNpc(MapNpcNum, MapNum).SpellAnimations(i).spellnum > 0 Then
- Call DX8.SetTexture(Tr_Spells(spellnum))
- Call DX8.DrawTexture(x + x2 * PIC_X, y + y2 * PIC_Y, PIC_X, PIC_Y, MapNpc(MapNpcNum, MapNum).SpellAnimations(i).FramePointer * SIZE_X, 0, PIC_X, PIC_Y, DX8.ARGB(255, 255, 255, 255), 512, 32)
- End If
- End If
- End If
- Next
- End If
- End Sub
Add Comment
Please, Sign In to add comment