📄 draw monster.vb.svn-base
字号:
Imports Microsoft.DirectX
Imports Microsoft.DirectX.Direct3D
Module Draw_Mob
Public Sub ProcessMobAction(ByVal ActionTypes As PlayerActionType, ByVal MobServerIndex As Integer, ByVal Direction As Short, ByVal RealCordX As Short, ByVal RealCordY As Short)
If Mob(MobGameIndex(MobServerIndex)).Exist = True Then
Dim Index As Integer
Index = MobGameIndex(MobServerIndex)
'add to actor stack
Dim I As Integer
I = Mob(Index).StackItems
If Mob(Index).StackExist(I) = False Then
Mob(Index).StackDirection(I) = Direction
Mob(Index).StackActionType(I) = ActionTypes
Mob(Index).StackCordX(I) = RealCordX
Mob(Index).StackCordY(I) = RealCordY
Mob(Index).StackExist(I) = True
Mob(Index).StackItems = Mob(Index).StackItems + 1
End If
End If
End Sub
Public Sub DrawMob(ByVal Index As Integer)
Dim TempX As Integer
Dim TempY As Integer
Dim TempInt As Integer
Dim BaseX As Single
Dim BaseY As Single
Dim SpecialMob As Integer
Dim SpecialRepeat As Boolean
BaseX = Actor.CurrentX
BaseY = Actor.CurrentY
'241
If Mob(Index).File > 17 Then
If Mob(Index).Look = 2 And Mob(Index).File = 18 Then
TempInt = 920
SpecialMob = 1
Else
TempInt = ((Mob(Index).Look) * 430)
End If
Else
TempInt = ((Mob(Index).Look) * 360)
End If
If WIL_MonImage(Mob(Index).File).ImageLoaded(TempInt) = False Then
WIL_MonImage(Mob(Index).File).ImageLoaded(TempInt) = True
LoadWILMonImage(Mob(Index).File, TempInt)
End If
Mob(Index).MainHeight = WIL_MonImage(Mob(Index).File).ImageHeight(TempInt)
Mob(Index).MainWidth = WIL_MonImage(Mob(Index).File).ImageWidth(TempInt)
If Mob(Index).ActionState = 4 Then
Mob(Index).ActionLook = 260
ElseIf Mob(Index).ActionState = 1 Then
Mob(Index).ActionLook = 80
ElseIf Mob(Index).ActionState = 2 Then
Mob(Index).ActionLook = 160
ElseIf Mob(Index).ActionState = 3 Then
If Mob(Index).Animation = 2 Then
Mob(Index).ActionLook = 239
Else
Mob(Index).ActionLook = 240
End If
Else
Mob(Index).ActionLook = 0
End If
If SpecialMob = 1 Then 'holy deva
If Mob(Index).ActionState = 0 And Mob(Index).IsDead = True Then
TempInt = (918) + (Mob(Index).Direction * 10) + 9 + 260
ElseIf Not Mob(Index).ActionState = 3 Then
TempInt = (918) + Mob(Index).Animation + (Mob(Index).Direction * 10) + Mob(Index).ActionLook
ElseIf Mob(Index).ActionState = 3 Then
TempInt = (918) + Mob(Index).Animation + (Mob(Index).Direction * 2) + Mob(Index).ActionLook
End If
ElseIf Mob(Index).File > 17 Then
If Mob(Index).ActionState = 0 And Mob(Index).IsDead = True Then
TempInt = ((Mob(Index).Look) * 430) + (Mob(Index).Direction * 10) + 9 + 260
ElseIf Not Mob(Index).ActionState = 3 Then
TempInt = ((Mob(Index).Look) * 430) + Mob(Index).Animation + (Mob(Index).Direction * 10) + Mob(Index).ActionLook
ElseIf Mob(Index).ActionState = 3 Then
TempInt = ((Mob(Index).Look) * 430) + Mob(Index).Animation + (Mob(Index).Direction * 2) + Mob(Index).ActionLook
End If
Else
If Mob(Index).ActionState = 0 And Mob(Index).IsDead = True Then
TempInt = ((Mob(Index).Look) * 360) + (Mob(Index).Direction * 10) + 9 + 260
ElseIf Not Mob(Index).ActionState = 3 Then
TempInt = ((Mob(Index).Look) * 360) + Mob(Index).Animation + (Mob(Index).Direction * 10) + Mob(Index).ActionLook
ElseIf Mob(Index).ActionState = 3 Then
TempInt = ((Mob(Index).Look) * 360) + Mob(Index).Animation + (Mob(Index).Direction * 2) + Mob(Index).ActionLook
End If
End If
Repeat:
If SpecialRepeat = True Then TempInt = TempInt + 359
If WIL_MonImage(Mob(Index).File).ImageLoaded(TempInt) = False Then
WIL_MonImage(Mob(Index).File).ImageLoaded(TempInt) = True
LoadWILMonImage(Mob(Index).File, TempInt)
End If
TempX = (GameWidth / 2) + (48 * (Mob(Index).CordX - BaseX)) - 30 + WIL_MonImage(Mob(Index).File).ImageX(TempInt)
TempY = (GameHeight / 2) + (32 * (Mob(Index).CordY - BaseY)) - 75 + WIL_MonImage(Mob(Index).File).ImageY(TempInt) - 10
Mob(Index).MainTop = TempY
Mob(Index).MainLeft = TempX
Mob(Index).MainPlaceX = WIL_MonImage(Mob(Index).File).ImageX(TempInt)
Mob(Index).MainPlaceY = WIL_MonImage(Mob(Index).File).ImageY(TempInt)
Mob(Index).CurrentHeight = WIL_MonImage(Mob(Index).File).ImageHeight(TempInt)
Mob(Index).CurrentWidth = WIL_MonImage(Mob(Index).File).ImageWidth(TempInt)
'DrawBox(Mob(Index).MainLeft, Mob(Index).MainLeft + Mob(Index).CurrentWidth, Mob(Index).MainTop, Mob(Index).MainTop + Mob(Index).CurrentHeight, 1, Color.AntiqueWhite)
'GameSprite.Begin(SpriteFlags.AlphaBlend)
'SetBlend(1)
If Not SpecialMob = 0 And SpecialRepeat = False Then
GameSprite.End()
GameSprite.Begin(SpriteFlags.DoNotSaveState)
D3D.RenderState.SourceBlend = Blend.One
D3D.RenderState.DestinationBlend = Blend.One
ElseIf Not SpecialMob = 0 And SpecialRepeat = True Then
GameSprite.End()
GameSprite.Begin(SpriteFlags.DoNotSaveState)
End If
If Actor.MapLight = 0 Then
GameSprite.Draw(WIL_MonImage(Mob(Index).File).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_MonImage(Mob(Index).File).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_MonImage(Mob(Index).File).ImageTexture(TempInt), Rectangle.Empty, New Microsoft.DirectX.Vector3(0, 0, 0), New Microsoft.DirectX.Vector3(TempX, TempY, 0), Color.White)
End If
If Not SpecialMob = 0 And SpecialRepeat = True Then
GameSprite.End()
GameSprite.Begin(SpriteFlags.DoNotSaveState)
End If
'GameSprite.End()
If SpecialRepeat = False And Not SpecialMob = 0 Then SpecialRepeat = True : GoTo repeat
End Sub
Public Sub ProcessMobChangeDirection(ByVal MobServerIndex As Integer, ByVal Direction As Integer)
Dim I As Integer
If MobServerIndex = Mob(MobGameIndex(MobServerIndex)).ServerIndex Then
Mob(MobGameIndex(MobServerIndex)).Direction = Direction
End If
End Sub
Public Sub MobAttack(ByVal Index As Integer)
Mob(Index).Animation = Mob(Index).Animation + 1
If Mob(Index).Animation >= 6 Then
If Mob(Index).StackActionType(0) = PlayerActionType.Attack Then
MobUseStack(Index)
Else
Mob(Index).ActionState = 0
Mob(Index).Animation = 0
End If
Mob(Index).Animation = 0
End If
End Sub
Public Sub AddMob(ByVal MobServerID As Integer, ByVal Look As Integer, ByVal CordX As Short, ByVal CordY As Short, ByVal Direction As Short, ByVal Name As String, ByVal NameColour As NameColours, ByVal Status As Short, ByVal IsDead As Boolean, ByVal Reved As Boolean, ByVal HP As Integer, ByVal MaxHP As Integer, ByVal IsPet As Boolean, ByVal PetOwner As String, ByVal MobHasLight As Short)
Dim I As Integer
For I = 0 To 1000
If Mob(I).Exist = False Then
Mob(I).Initialize()
Mob(I).Exist = True
Mob(I).ServerIndex = MobServerID
Mob(I).Look = Mid(Look, 3, 2)
Mob(I).File = Mid(Look, 1, 2)
Mob(I).Direction = Direction
Mob(I).CordX = CordX
Mob(I).CordY = CordY
Mob(I).X = CordX
Mob(I).Y = CordY
Mob(I).Name = Name
Mob(I).Status = Status
Mob(I).IsReved = Reved
Mob(I).IsDead = IsDead
Mob(I).Animation = 0
Mob(I).ActionState = 0
Mob(I).IsPet = IsPet
Mob(I).OwnerName = PetOwner
Mob(I).HP = HP
Mob(I).MaxHP = MaxHP
Dim S As Short
For S = 0 To 5
Mob(I).StackExist(S) = False
Next S
LinkServerID(I, MobServerID, 2)
TotalMob = TotalMob + 1
AddTilePlayerCollsion(Mob(I).X, Mob(I).Y)
'MobSound(1, I)
If MobHasLight = 1 Then
Mob(I).LightIndex = AddLight(5, CordX, CordY, I)
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -