📄 draw npc.vb.svn-base
字号:
'### Visual Basic.NET and Direct X9 Legend of MiR Project ###'
'### Mir Unleashed Client NPC Module ###'
'### http://www.lomcn.co.uk ###' '### Credits to TrueADM and DeathWish ###'
'This basically handles the draws for NPCs.
'Drawing the NPCs, Adding them and Removing them.
Module Unleashed_NPCs
#Region "Draw/Add and Remove NPC"
Public Sub AddNPC(ByVal NPCServerID As Integer, ByVal Look As Integer, ByVal CordX As Short, ByVal CordY As Short, ByVal Direction As Short, ByVal Name As String)
Dim I As Integer
For I = 0 To 1000
If NPC(I).Exist = False Then
NPC(I).Exist = True
NPC(I).ServerIndex = NPCServerID
NPC(I).Look = Look
NPC(I).X = CordX
NPC(I).Y = CordY
NPC(I).Name = Name
NPC(I).Direction = Direction
NPC(I).Animation = 0
TotalNPC = TotalNPC + 1
LinkServerID(I, NPCServerID, 3)
NPC(I).LightIndex = AddLight(4, CordX, CordY, I)
If DebugMode Then
AddChat("NPC Added, " & I, 3)
End If
AddTilePlayerCollsion(CordX, CordY)
Exit For
End If
Next I
End Sub
Public Sub RemoveNPC(ByVal NPCID As Integer)
TotalNPC = TotalNPC - 1
If DebugMode Then
AddChat("NPC Removed, " & NPCID, 3)
End If
RemoveLight(NPC(NPCGameIndex(NPCID)).LightIndex)
NPC(PlayerGameIndex(NPCID)).Exist = False
RemoveTilePlayerCollsion(NPC(NPCGameIndex(NPCID)).X, NPC(NPCGameIndex(NPCID)).Y)
End Sub
Public Sub DrawNPC(ByVal Index As Integer)
Dim TempX As Integer
Dim TempY As Integer
Dim TempInt As Integer
Dim BaseX As Single
Dim BaseY As Single
BaseX = Actor.CurrentX
BaseY = Actor.CurrentY
TempInt = (NPC(Index).Look * 60)
If WIL_NPCImage.ImageLoaded(TempInt) = False Then
WIL_NPCImage.ImageLoaded(TempInt) = True
LoadWILNPCImage(TempInt)
End If
NPC(Index).MainHeight = WIL_NPCImage.ImageHeight(TempInt)
NPC(Index).MainWidth = WIL_NPCImage.ImageWidth(TempInt)
TempInt = (NPC(Index).Look * 60) + NPC(Index).Animation + (NPC(Index).Direction * 10)
If WIL_NPCImage.ImageLoaded(TempInt) = False Then
WIL_NPCImage.ImageLoaded(TempInt) = True
LoadWILNPCImage(TempInt)
End If
TempX = (GameWidth / 2) + (48 * (NPC(Index).X - BaseX)) - 30 + WIL_NPCImage.ImageX(TempInt)
TempY = (GameHeight / 2) + (32 * (NPC(Index).Y - BaseY)) - 75 + WIL_NPCImage.ImageY(TempInt) - 10
NPC(Index).MainTop = TempY
NPC(Index).MainLeft = TempX
NPC(Index).MainPlaceX = WIL_NPCImage.ImageX(TempInt)
NPC(Index).MainPlaceY = WIL_NPCImage.ImageY(TempInt)
NPC(Index).CurrentHeight = WIL_NPCImage.ImageHeight(TempInt)
NPC(Index).CurrentWidth = WIL_NPCImage.ImageWidth(TempInt)
If Actor.MapLight = 0 Then
GameSprite.Draw(WIL_NPCImage.ImageTexture(TempInt), Rectangle.Empty, New Microsoft.DirectX.Vector3(0, 0, 0), New Microsoft.DirectX.Vector3(TempX, TempY, 0), Color.SkyBlue)
ElseIf Actor.MapLight = 2 Then
GameSprite.Draw(WIL_NPCImage.ImageTexture(TempInt), Rectangle.Empty, New Microsoft.DirectX.Vector3(0, 0, 0), New Microsoft.DirectX.Vector3(TempX, TempY, 0), Color.FromArgb(255, 215, 150, 80))
Else
GameSprite.Draw(WIL_NPCImage.ImageTexture(TempInt), Rectangle.Empty, New Microsoft.DirectX.Vector3(0, 0, 0), New Microsoft.DirectX.Vector3(TempX, TempY, 0), Color.White)
End If
End Sub
#End Region
End Module
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -