VBGamer |
|||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
Here's my modification... Warder (5 replies, 0 views) (2000-Jul-4) Ok, I changed the numbers so it will reflect 640x480 res..
Public Sub DDBltFast(surface As DirectDrawSurface7, RECTvar As RECT, x As Integer, y As Integer, Optional transparent As Boolean = True, Optional Clip As Boolean = True)
'This subroutine will BltFast a surface to the
'backbuffer. This wont work with clipper.
'CLIPPING
'Temporary rect
Dim RectTEMP As RECT
RectTEMP = RECTvar
If Clip = True Then
'Set up screen rect for clipping
Dim ScreenRECT As RECT
With ScreenRECT
.Top = y
.Left = x
.Bottom = y + RECTvar.Bottom
.Right = x + RECTvar.Right
End With
'Clip surface
With ScreenRECT
If .Bottom > 480 Then
RectTEMP.Bottom = RectTEMP.Bottom - (.Bottom - 480)
.Bottom = 475
End If
If .Left < 0 Then
RectTEMP.Left = RectTEMP.Left - .Left
.Left = 0
x = 0
End If
If .Right > 640 Then
RectTEMP.Right = RectTEMP.Right - (.Right - 640)
.Right = 640
End If
If .Top < 0 Then
RectTEMP.Top = RectTEMP.Top - .Top
.Top = 0
y = 0
End If
End With
End If
If transparent = False Then
Call msurfBack.BltFast(x, y, surface, RectTEMP, DDBLTFAST_WAIT)
Else
Call msurfBack.BltFast(x, y, surface, RectTEMP, DDBLTFAST_WAIT Or DDBLTFAST_SRCCOLORKEY)
End If
End Sub
Now, Here's the call I did..
Private Sub DrawTiles3()
Dim i As Integer
Dim J As Integer
Dim rectTile As RECT 'Ahahahahha! You said...
Dim intX As Integer
Dim intY As Integer
Dim bytTileNum As Byte
'Draw the tiles according to the map array
For i = 0 To 20
For J = 0 To 15 'CInt(SCREEN_HEIGHT / TILE_HEIGHT)
'Calc X,Y coords for this tile's placement
intX = i * TILE_WIDTH - mintX Mod TILE_WIDTH
intY = J * TILE_HEIGHT - mintY Mod TILE_HEIGHT
bytTileNum = GetTile(intX, intY, 3)
If bytTileNum <> 0 Then
GetRect bytTileNum, intX, intY, rectTile
'ClipRect intX, intY, rectTile
'msurfBack.BltFast intX, intY, msurfTiles, rectTile, DDBLTFAST_SRCCOLORKEY Or DDBLTFAST_WAIT
DDBltFast msurfTiles, rectTile, intX, intY, True, True
End If
Next J
Next i
End Sub
That is to draw layer 3 tiles.
A lot of things are commented out as I try this and that.
IntX and Y are the coords for where to place picture.. msurftiles is the surface that holds the complete tileset... RectTile is the rect for a particular tile on the tileset surface.. In above that when it uses the GetRect sub, that sub is to make the RECT have the properties needed for that particular tile.,.. on the tileset surf.. .top,.left.right,.bottom .. etc..
When using your sub, all tiles on layer three disappears...
|