I know this is a pretty dead topic, but whatever haha.
I have been messing with this tutorial on and off for a few weeks and finally decided to attempt to get some help. I am using a vanilla MSE and only have tried to add this in. This is what I got.
I have added in the new variables like BigRed said to do, as well as initializing the surfaces and setting the color keys. This is my BltMap sub.
Code:
Dim Ground As Long
Dim Anim1 As Long
Dim Fringe As Long
Dim x As Byte
Dim y As Byte
With rec
.top = 0
.Bottom = ((MAX_MAPX + 1) * PIC_X)
.Left = 0
.Right = ((MAX_MAPY + 1) * PIC_Y)
End With
DD_LowerBuffer.BltColorFill rec, RGB(0, 0, 0)
DD_UpperBuffer.BltColorFill rec, RGB(0, 0, 0)
For y = 0 To MAX_MAPY
For x = 0 To MAX_MAPX
With Map.Tile(x, y)
Ground = .Ground
Anim1 = .Mask
Fringe = .Fringe
End With
' Ground
With rec
.top = Int(Ground / 7) * PIC_Y
.Bottom = .top + PIC_Y
.Left = (Ground - Int(Ground / 7) * 7) * PIC_X
.Right = .Left + PIC_X
End With
Call DD_LowerBuffer.BltFast(x * PIC_X, y * PIC_Y, DD_TileSurf, rec, DDBLTFAST_WAIT)
' Mask
With rec
.top = Int(Anim1 / 7) * PIC_Y
.Bottom = .top + PIC_Y
.Left = (Anim1 - Int(Anim1 / 7) * 7) * PIC_X
.Right = .Left + PIC_X
End With
Call DD_LowerBuffer.BltFast(x * PIC_X, y * PIC_Y, DD_TileSurf, rec, DDBLTFAST_WAIT Or DDBLTFAST_SRCCOLORKEY)
' Fringe
If Fringe > 0 Then
With rec
.top = Int(Fringe / 7) * PIC_Y
.Bottom = .top + PIC_Y
.Left = (Fringe - Int(Fringe / 7) * 7) * PIC_X
.Right = .Left + PIC_X
End With
Call DD_UpperBuffer.BltFast(x * PIC_X, y * PIC_Y, DD_TileSurf, rec, DDBLTFAST_WAIT Or DDBLTFAST_SRCCOLORKEY)
End If
Next x
Next y
I believe this is correct, I have removed the animation part of it to be replaced with this:
Code:
Sub BltAnimation()
Dim Anim As Long
Dim x As Byte
Dim y As Byte
For y = 0 To MAX_MAPY
For x = 0 To MAX_MAPX
Anim = Map.Tile(x, y).Anim
If Anim > 0 Then
With rec
.top = Int(Anim / 7) * PIC_Y
.Bottom = .top + PIC_Y
.Left = (Anim - Int(Anim / 7) * 7) * PIC_X
.Right = .Left + PIC_X
End With
Call DD_LowerBuffer.BltFast(x * PIC_X, y * PIC_Y, DD_TileSurf, rec, DDBLTFAST_WAIT Or DDBLTFAST_SRCCOLORKEY)
End If
Next x
Next y
End Sub
The other Subs like BltItem, Npc and Player have only been changed from BackBuffer to MiddleBuffer. Umm, in my GameLoop I have this:
Code:
' Clear the back and middle buffers
DD_BackBuffer.BltColorFill rec, RGB(0, 0, 0)
DD_MiddleBuffer.BltColorFill rec, RGB(0, 0, 0)
Which is right under the End If for the Clear Surfaces check. Then I have this:
Code:
' Draw all buffers to the back buffer
With rec
.top = 0
.Bottom = ((MAX_MAPX + 1) * PIC_X)
.Left = 0
.Right = ((MAX_MAPY + 1) * PIC_Y)
End With
Call DD_BackBuffer.BltFast(0, 0, DD_LowerBuffer, rec, DDBLTFAST_WAIT Or DDBLTFAST_SRCCOLORKEY)
Call DD_BackBuffer.BltFast(0, 0, DD_MiddleBuffer, rec, DDBLTFAST_WAIT Or DDBLTFAST_SRCCOLORKEY)
Call DD_BackBuffer.BltFast(0, 0, DD_UpperBuffer, rec, DDBLTFAST_WAIT Or DDBLTFAST_SRCCOLORKEY)
Right before the back buffer is locked for the text to be drawn. I guess thats all. The Call BltMap is right after the GettingMap boolean in "mapdone" packet and I have added them to the EditorMouseDown and Cancel subs too however the tiles, items, npcs and players are all not being shown and there is no trailing on the map and no errors
. Oh, also I did move the InitDirectX. I cannot seem to figure out where I went wrong and hope somebody can help me
. Thanks a lot!