11-12-2006, 01:06 PM
woo hoo copy and paste tuts, sorry but im still new and this is all i can really do ill try explain everything as i go along though.
Replace your bltNpc with this:
Now, if you dont have 32x64 npcs as it is: Copy the bltNpc and rename it npcTop.
Then replace all the rec.top etc with this
Then under that put
So the npcTop sub should look like this:
Now place this
Under
Now, here is the weird part. For some reason while doing this the sprites when off the surface area. While on the max X they wouldnt blit. Sooo i could have; made the sprites into smaller surfaces such as nptopleft, npctopright etc or just increase the surface.
sooooo comment this out
and put this in its spot
alrighty this should be it all. if i miss anything post here or if theyre are bugs tell me and ill try to help
Replace your bltNpc with this:
Code:
Sub BltNpc(ByVal MapNpcNum As Long)
Dim Anim As Byte
Dim X As Long, Y As Long
' Make sure that theres an npc there, and if not exit the sub
If MapNpc(MapNpcNum).Num GetTickCount Then
Anim = 2
End If
End If
' Check to see if we want to stop making him attack
If MapNpc(MapNpcNum).AttackTimer + 1000 < GetTickCount Then
MapNpc(MapNpcNum).Attacking = 0
MapNpc(MapNpcNum).AttackTimer = 0
End If
rec.top = Npc(MapNpc(MapNpcNum).Num).Sprite * 64 + 32
rec.Bottom = rec.top + 32
rec.Left = (MapNpc(MapNpcNum).Dir * 3 + Anim) * 64
rec.Right = rec.Left + 64
X = MapNpc(MapNpcNum).X * 32 + sx - 16 + MapNpc(MapNpcNum).XOffset
Y = MapNpc(MapNpcNum).Y * 32 + sx + MapNpc(MapNpcNum).YOffset
If Y < 0 Then
rec.top = Npc(MapNpc(MapNpcNum).Num).Sprite * 64 + 32
rec.Bottom = rec.top + 32
Y = MapNpc(MapNpcNum).YOffset + sx
End If
If X < 0 Then
rec.Left = (MapNpc(MapNpcNum).Dir * 3 + Anim) * 64 + 16
rec.Right = rec.Left + 48
X = MapNpc(MapNpcNum).XOffset + sx
End If
If X > MAX_MAPX * 32 Then
rec.Left = (MapNpc(MapNpcNum).Dir * 3 + Anim) * 64
rec.Right = rec.Left + 48
X = MAX_MAPX * 32 + sx - 16 + MapNpc(MapNpcNum).XOffset
End If
Call DD_BackBuffer.BltFast(X - (NewPlayerX * PIC_X) - NewXOffset, Y - (NewPlayerY * PIC_Y) - NewYOffset, DD_SpriteSurf, rec, DDBLTFAST_WAIT Or DDBLTFAST_SRCCOLORKEY)
End Sub
Now, if you dont have 32x64 npcs as it is: Copy the bltNpc and rename it npcTop.
Then replace all the rec.top etc with this
Code:
rec.top = Npc(MapNpc(MapNpcNum).Num).Sprite * PIC_Y
rec.top = Npc(MapNpc(MapNpcNum).Num).Sprite * 64
rec.Bottom = rec.top + 32
rec.Left = (MapNpc(MapNpcNum).Dir * 3 + Anim) * 64
rec.Right = rec.Left + 64
Then under that put
Code:
X = MapNpc(MapNpcNum).X * 32 + sx - 16 + MapNpc(MapNpcNum).XOffset
Y = MapNpc(MapNpcNum).Y * 32 + sx + MapNpc(MapNpcNum).YOffset
If Y < 0 Then
rec.top = Npc(MapNpc(MapNpcNum).Num).Sprite * 64 + 32
rec.Bottom = rec.top + 32
Y = MapNpc(MapNpcNum).YOffset + sx
End If
If X < 0 Then
rec.Left = (MapNpc(MapNpcNum).Dir * 3 + Anim) * 64 + 16
rec.Right = rec.Left + 48
X = MapNpc(MapNpcNum).XOffset + sx
End If
If X > MAX_MAPX * 32 Then
rec.Left = (MapNpc(MapNpcNum).Dir * 3 + Anim) * 64
rec.Right = rec.Left + 48
X = MAX_MAPX * 32 + sx - 16 + MapNpc(MapNpcNum).XOffset
End If
So the npcTop sub should look like this:
Code:
Sub BltNpcTop(ByVal MapNpcNum As Long)
Dim Anim As Byte
Dim X As Long, Y As Long
' Make sure that theres an npc there, and if not exit the sub
If MapNpc(MapNpcNum).Num GetTickCount Then
Anim = 2
End If
End If
' Check to see if we want to stop making him attack
If MapNpc(MapNpcNum).AttackTimer + 1000 < GetTickCount Then
MapNpc(MapNpcNum).Attacking = 0
MapNpc(MapNpcNum).AttackTimer = 0
End If
rec.top = Npc(MapNpc(MapNpcNum).Num).Sprite * PIC_Y
rec.top = Npc(MapNpc(MapNpcNum).Num).Sprite * 64
rec.Bottom = rec.top + 32
rec.Left = (MapNpc(MapNpcNum).Dir * 3 + Anim) * 64
rec.Right = rec.Left + 64
X = MapNpc(MapNpcNum).X * 32 + sx - 16 + MapNpc(MapNpcNum).XOffset
Y = MapNpc(MapNpcNum).Y * 32 + sx - 32 + MapNpc(MapNpcNum).YOffset
If Y < 0 Then
rec.top = Npc(MapNpc(MapNpcNum).Num).Sprite * 64 + 32
rec.Bottom = rec.top
Y = MapNpc(MapNpcNum).YOffset + sx
End If
If X < 0 Then
rec.Left = (MapNpc(MapNpcNum).Dir * 3 + Anim) * 64 + 16
rec.Right = rec.Left + 48
X = MapNpc(MapNpcNum).XOffset + sx
End If
If X > MAX_MAPX * 32 Then
rec.Left = (MapNpc(MapNpcNum).Dir * 3 + Anim) * 64
rec.Right = rec.Left + 48
X = MAX_MAPX * 32 + sx - 16 + MapNpc(MapNpcNum).XOffset
End If
Call DD_BackBuffer.BltFast(X - (NewPlayerX * PIC_X) - NewXOffset, Y - (NewPlayerY * PIC_Y) - NewYOffset, DD_SpriteSurf, rec, DDBLTFAST_WAIT Or DDBLTFAST_SRCCOLORKEY)
End Sub
Now place this
Code:
' Blit out the npcs top
For i = 1 To MAX_MAP_NPCS
Call BltNpcTop(i)
Next i
Code:
' Blit out players
For i = 1 To MAX_PLAYERS
If IsPlaying(i) And GetPlayerMap(i) = GetPlayerMap(MyIndex) Then
Call BltPlayer(i)
End If
Next i
Now, here is the weird part. For some reason while doing this the sprites when off the surface area. While on the max X they wouldnt blit. Sooo i could have; made the sprites into smaller surfaces such as nptopleft, npctopright etc or just increase the surface.
sooooo comment this out
Code:
' .lWidth = (MAX_MAPX + 1) * PIC_X
' .lHeight = (MAX_MAPY + 1) * PIC_Y
Code:
.lWidth = (MAX_MAPX + 1) * PIC_X + 32
.lHeight = (MAX_MAPY + 1) * PIC_Y + 32
alrighty this should be it all. if i miss anything post here or if theyre are bugs tell me and ill try to help