📄 draw actor, players.vb.svn-base
字号:
'### Visual Basic.NET and Direct X9 Legend of MiR Project ###'
'### Mir Unleashed Client Player Module ###'
'### http://www.lomcn.co.uk ###' '### Credits to TrueADM and DeathWish ###'
'This basically handles the draws for players and actors.
'Actor being yourself and Player being other players. This draws weapons, effects, armours, handles the movements basically everything todo with drawing characters.
Imports Microsoft.DirectX
Imports Microsoft.DirectX.Direct3D
Module Unleashed_Actors_Players
#Region "Draw All Actor Movements/Looks and Effects - Draw yourself basically!"
Public Sub DrawActor()
Dim TempX As Integer
Dim TempY As Integer
Dim TempInt As Integer
'find this so that we can use the height and width for text overhead
TempInt = (ActorLook() * 600)
If WIL_HumImage.ImageLoaded(TempInt) = False Then
WIL_HumImage.ImageLoaded(TempInt) = True
LoadWILHumImage(TempInt)
End If
Actor.MainHeight = WIL_HumImage.ImageHeight(TempInt)
Actor.MainWidth = WIL_HumImage.ImageWidth(TempInt)
If Actor.ActionState = 4 Then
Actor.ActionLook = 536
ElseIf Actor.ActionState = 0 And Actor.Stance = 1 Then
Actor.ActionLook = 192
ElseIf Actor.ActionState = 1 And Actor.MoveType = 1 Then
Actor.ActionLook = 64
ElseIf Actor.ActionState = 1 And Actor.MoveType = 2 Then
Actor.ActionLook = 128
ElseIf Actor.ActionState = 2 Then
Actor.ActionLook = 200
ElseIf Actor.ActionState = 3 Then
Actor.ActionLook = 472
ElseIf Actor.ActionState = 7 Then
If Actor.Animation = 5 Then
Actor.ActionLook = 391
ElseIf Actor.Animation = 6 Then
Actor.ActionLook = 390
ElseIf Actor.Animation = 7 Then
Actor.ActionLook = 390
Else
Actor.ActionLook = 392
End If
Else
Actor.ActionLook = 0
End If
If Actor.ActionState = 0 And Actor.IsDead = True Then
TempInt = (ActorLook() * 600) + (Actor.Direction * 8) + 536 + 3
ElseIf Not Actor.Stance = 0 And Actor.ActionState = 0 And Not Actor.ActionState = 3 Then
TempInt = (ActorLook() * 600) + Actor.Animation + (Actor.Direction) + Actor.ActionLook
ElseIf Actor.ActionState = 3 Then
TempInt = (ActorLook() * 600) + Actor.Animation + (Actor.Direction * 8) + Actor.ActionLook
ElseIf Actor.ActionState = 4 And Actor.IsDead = True Then
TempInt = (ActorLook() * 600) + Actor.Animation + (Actor.Direction * 4) + Actor.ActionLook
ElseIf Not Actor.ActionState = 3 Then
TempInt = (ActorLook() * 600) + Actor.Animation + (Actor.Direction * 8) + Actor.ActionLook
End If
If WIL_HumImage.ImageLoaded(TempInt) = False Then
WIL_HumImage.ImageLoaded(TempInt) = True
LoadWILHumImage(TempInt)
End If
TempX = (GameWidth / 2) - 30 + WIL_HumImage.ImageX(TempInt)
TempY = (GameHeight / 2) - 73 + WIL_HumImage.ImageY(TempInt) - 10
Actor.ShadowImage = TempInt
Actor.ShadowX = TempX
Actor.ShadowY = TempY
Actor.MainTop = TempY
Actor.MainLeft = TempX
Actor.MainPlaceX = WIL_HumImage.ImageX(TempInt)
Actor.MainPlaceY = WIL_HumImage.ImageY(TempInt)
Actor.CurrentHeight = WIL_HumImage.ImageHeight(TempInt)
Actor.CurrentWidth = WIL_HumImage.ImageWidth(TempInt)
GameSprite.Begin(SpriteFlags.DoNotSaveState)
If Actor.GhostForm = False Then
SetBlend(1)
Else
SetBlend(0.1)
End If
If Actor.Direction = 0 Or Actor.Direction = 4 Or Actor.Direction = 5 Or Actor.Direction = 6 Or Actor.Direction = 7 Then
DrawActorWeapon(TempInt)
End If
If WIL_HumImage.ImageLoaded(TempInt) = True Then
If Actor.MapLight = 0 Then
GameSprite.Draw(WIL_HumImage.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_HumImage.ImageTexture(TempInt), Rectangle.Empty, New Microsoft.DirectX.Vector3(0, 0, 0), New Microsoft.DirectX.Vector3(TempX, TempY, 0), Color.FromArgb(255, 225, 150, 80))
Else
GameSprite.Draw(WIL_HumImage.ImageTexture(TempInt), Rectangle.Empty, New Microsoft.DirectX.Vector3(0, 0, 0), New Microsoft.DirectX.Vector3(TempX, TempY, 0), Color.White)
End If
If CheckMouseOverActor(CursorX, CursorY) = True Then
Dim S As Short
Dim GuildRankNumber As String
For S = 0 To 10
TextOverlayText(S) = ""
Next S
Select Case Actor.GuildRankNumber
Case 0
'Leader
GuildRankNumber = "Leader"
Case 1
'Co-Leader
GuildRankNumber = "Co-Leader"
Case 2
'Member
GuildRankNumber = "Member"
End Select
TextOverlayText(0) = "You have your self selected."
TextOverlayText(1) = "Your Current Level Is: " & Actor.Level
If Not Actor.Guild = "" Then
TextOverlayText(2) = "Guild: " & Actor.Guild & " " & GuildRankNumber
TextOverlayText(3) = "Guild Title: " & Actor.GuildRankName
Else
TextOverlayText(2) = "You do not reside in a guild."
TextOverlayText(3) = ""
End If
TextOverlayText(4) = "Visiting: " & Actor.MapName
TextOverlay = True
Else
TextOverlayText(0) = ""
TextOverlayText(1) = ""
TextOverlayText(2) = ""
TextOverlayText(3) = ""
TextOverlayText(4) = ""
End If
Else
If Actor.MapLight = 0 Then
GameSprite.Draw(WIL_HumImage.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_HumImage.ImageTexture(TempInt), Rectangle.Empty, New Microsoft.DirectX.Vector3(0, 0, 0), New Microsoft.DirectX.Vector3(TempX, TempY, 0), Color.FromArgb(255, 225, 150, 80))
Else
GameSprite.Draw(WIL_HumImage.ImageTexture(TempInt), Rectangle.Empty, New Microsoft.DirectX.Vector3(0, 0, 0), New Microsoft.DirectX.Vector3(TempX, TempY, 0), Color.White)
End If
End If
If Actor.Direction = 3 Or Actor.Direction = 2 Or Actor.Direction = 1 Then
DrawActorWeapon(TempInt)
End If
GameSprite.End()
'DrawActorHumEffect(TempInt)
End Sub
Public Sub DrawActorWeapon(ByVal Look As Integer)
Dim TempX As Integer
Dim TempY As Integer
Dim TempInt As Integer
If Actor.EquipItem(12).Exist = True And Not Actor.EquipItem(12).Shape = 0 Then
TempInt = (1200 * Actor.EquipItem(12).Shape) + (Look - (ActorLook() * 600))
If WIL_WeaponImage.ImageLoaded(TempInt) = False Then
WIL_WeaponImage.ImageLoaded(TempInt) = True
LoadWILWeaponImage(TempInt)
End If
TempX = (GameWidth / 2) - 30 + WIL_WeaponImage.ImageX(TempInt)
TempY = (GameHeight / 2) - 82 + WIL_WeaponImage.ImageY(TempInt)
GameSprite.Draw(WIL_WeaponImage.ImageTexture(TempInt), Rectangle.Empty, New Microsoft.DirectX.Vector3(0, 0, 0), New Microsoft.DirectX.Vector3(TempX, TempY, 0), Color.White)
End If
End Sub
Public Sub DrawActorFade()
Dim TempX As Integer
Dim TempY As Integer
Dim TempInt As Integer
TempInt = Actor.ShadowImage
TempX = Actor.ShadowX
TempY = Actor.ShadowY
GameSprite.Begin(SpriteFlags.AlphaBlend)
SetBlend(0.4)
If WIL_HumImage.ImageLoaded(TempInt) = False Then
WIL_HumImage.ImageLoaded(TempInt) = True
LoadWILHumImage(TempInt)
End If
GameSprite.End()
End Sub
Public Sub ProcessPlayerChangeDirection(ByVal PlayerServerIndex As Integer, ByVal Direction As Integer)
If PlayerServerIndex = Actor.ServerID Then
Actor.Direction = Direction
End If
End Sub
Public Sub ProcessPlayerAction(ByVal ActionTypes As PlayerActionType, ByVal PlayerServerIndex As Integer, ByVal Direction As Integer, ByVal MoveType As Integer, ByVal RealCordX As Integer, ByVal RealCordY As Integer, Optional ByVal UseSound As Boolean = True)
If PlayerServerIndex = Actor.ServerID Then
'add to actor stack
Dim I As Integer
I = Actor.StackItems
If Actor.StackExist(I) = False Then
Actor.StackDirection(I) = Direction
Actor.StackMoveType(I) = MoveType
Actor.StackActionType(I) = ActionTypes
Actor.StackCordX(I) = RealCordX
Actor.StackCordY(I) = RealCordY
Actor.StackExist(I) = True
Actor.StackUseSound(I) = UseSound
Actor.StackItems = Actor.StackItems + 1
End If
ElseIf Player(PlayerGameIndex(PlayerServerIndex)).Exist = True Then
Dim Index As Integer
Index = PlayerGameIndex(PlayerServerIndex)
'add to actor stack
Dim I As Integer
I = Player(Index).StackItems
If Player(Index).StackExist(I) = False Then
Player(Index).StackDirection(I) = Direction
Player(Index).StackMoveType(I) = MoveType
Player(Index).StackActionType(I) = ActionTypes
Player(Index).StackCordX(I) = RealCordX
Player(Index).StackCordY(I) = RealCordY
Player(Index).StackExist(I) = True
Player(Index).StackUseSound(I) = UseSound
Player(Index).StackItems = Player(Index).StackItems + 1
End If
End If
End Sub
Public Sub ActorUseStack()
If Actor.StackExist(0) = True Then
Actor.LastX = Actor.X
Actor.LastY = Actor.Y
Actor.LastDirection = Actor.Direction
'remove tile
If Actor.StackActionType(0) = PlayerActionType.Move Then
RemoveTilePlayerCollsion(Actor.X, Actor.Y)
End If
Actor.Direction = Actor.StackDirection(0)
Actor.MoveType = Actor.StackMoveType(0)
Actor.X = Actor.StackCordX(0)
Actor.Y = Actor.StackCordY(0)
Actor.Animation = 0
Actor.StackExist(0) = False
Actor.Stance = 0
If Actor.StackActionType(0) = PlayerActionType.Move Then
Actor.ActionState = 1
ElseIf Actor.StackActionType(0) = PlayerActionType.Attack Then
Actor.ActionState = 2
If Actor.StackUseSound(0) = True Then
'ActorAttackSound()
End If
ElseIf Actor.StackActionType(0) = PlayerActionType.Stun Then
Actor.ActionState = 3
If Actor.StackUseSound(0) = True Then
'ActorStunSound()
End If
ElseIf Actor.StackActionType(0) = PlayerActionType.Die Then
Actor.ActionState = 4
Actor.IsDead = True
If Actor.StackUseSound(0) = True Then
'ActorDieSound()
End If
ElseIf Actor.StackActionType(0) = PlayerActionType.Cast Then
Actor.ActionState = 7
End If
'add tile
If Actor.StackActionType(0) = PlayerActionType.Move Then
AddTilePlayerCollsion(Actor.X, Actor.Y)
End If
Dim I As Short
'If Not Actor.StackItems = 0 Then
For I = 0 To 14
Actor.StackCordX(I) = Actor.StackCordX(I + 1)
Actor.StackCordY(I) = Actor.StackCordY(I + 1)
Actor.StackDirection(I) = Actor.StackDirection(I + 1)
Actor.StackMoveType(I) = Actor.StackMoveType(I + 1)
Actor.StackExist(I) = Actor.StackExist(I + 1)
Actor.StackActionType(I) = Actor.StackActionType(I + 1)
Actor.StackUseSound(I) = Actor.StackUseSound(I + 1)
Next I
'End If
Actor.StackItems = Actor.StackItems - 1
End If
End Sub
Public Sub ActorStand()
Actor.Animation = Actor.Animation + 1
If Actor.MagicShieldEffect = True Then Actor.MagicShieldEffectAnimation = Actor.MagicShieldEffectAnimation + 1
If Actor.Animation >= 4 Then Actor.Animation = 0
If Actor.MagicShieldEffect = True And Actor.MagicShieldEffectAnimation = 3 Then Actor.MagicShieldEffectAnimation = 0
End Sub
Public Sub ActorAttack()
Actor.Animation = Actor.Animation + 1
If Actor.Animation >= 6 Then
If MouseButtonDown = True And Actor.AttackTick + (Actor.AttackSpeed * 10000) < DateTime.Now.Ticks And ShiftDown = True Then
Packets.SendAttack(TempPlayerDirection)
Actor.AttackTick = DateTime.Now.Ticks
End If
If Actor.StackActionType(0) = PlayerActionType.Attack Then
ActorUseStack()
Else
Actor.ActionState = 0
Actor.Animation = 0
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -