Jump to content
Search In
  • More options...
Find results that contain...
Find results in...

Sub EditorNPC_BltSprite Problem


Justn
 Share

Recommended Posts

I had a question. I changed my sprites format and everything works great. Except in my npc editor  where it shows the sprite. I need it to display a 32x64 picture but it only shows the top part of the sprite and the rest is cut off and i cant see some at all because of this.. Can anyone tell me of a problem with my sub?

```
Public Sub EditorNpc_BltSprite()
    Dim Sprite As Long
    Dim sRECT As DxVBLib.RECT
    Dim dRECT As DxVBLib.RECT
    Sprite = frmEditor_NPC.scrlSprite.Value

    If Sprite < 1 Or Sprite > NumCharacters Then
        frmEditor_NPC.picSprite.Cls
        Exit Sub
    End If

    CharacterTimer(Sprite) = GetTickCount + SurfaceTimerMax

    If DDS_Character(Sprite) Is Nothing Then
        Call InitDDSurf("characters\" & Sprite, DDSD_Character(Sprite), DDS_Character(Sprite))
    End If

    sRECT.Top = 0
    sRECT.Bottom = SIZE_Y
    sRECT.Left = PIC_X * 3 ' facing down
    sRECT.Right = sRECT.Left + SIZE_X
    dRECT.Top = 0
    dRECT.Bottom = SIZE_Y
    dRECT.Left = 0
    dRECT.Right = SIZE_X
    Call Engine_BltToDC(DDS_Character(Sprite), sRECT, dRECT, frmEditor_NPC.picSprite)
End Sub
```
Link to comment
Share on other sites

Try this….

```
Public Sub EditorNpc_BltSprite()
    Dim Sprite As Long
    Dim sRECT As DxVBLib.RECT
    Dim dRECT As DxVBLib.RECT
    Sprite = frmEditor_NPC.scrlSprite.Value

    If Sprite < 1 Or Sprite > NumCharacters Then
        frmEditor_NPC.picSprite.Cls
        Exit Sub
    End If

    CharacterTimer(Sprite) = GetTickCount + SurfaceTimerMax

    If DDS_Character(Sprite) Is Nothing Then
        Call InitDDSurf("characters\" & Sprite, DDSD_Character(Sprite), DDS_Character(Sprite))
    End If

    sRECT.Top = 0
    sRECT.Bottom = 64
    sRECT.Left = PIC_X * 3 ' facing down
    sRECT.Right = sRECT.Left + SIZE_X
    dRECT.Top = 0
    dRECT.Bottom = 64
    dRECT.Left = 0
    dRECT.Right = SIZE_X
    Call Engine_BltToDC(DDS_Character(Sprite), sRECT, dRECT, frmEditor_NPC.picSprite)
End Sub
```
I changed the SIZE_Y's to 64 because SIZE_Y is a variable that is set to 32 by default. This will most likely fix your problem.
Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
 Share

×
×
  • Create New...