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

96 by 96 npc sprites (currently not working)


zidsal
 Share

Recommended Posts

THIS REMAINS UNTESTED: I had to rush the code as I've got to go soon I will test it when I get back. Most of this is just from memory.

DONT DO THIS TUTORIAL YET IT WILL NOT WORK (because I'm an idioit who rushes things)

ALL CLIENT SIDE

step 1 go to frmnpc editor add in a new option button call it BigNpc96.
Add the following code
 ```
If BigNpc96.Value = Checked Then
        picSprite.Width = 960 'not sure on dimentions
        picSprite.Height = 960 'not sure on dimentions
        picSprite.Top = 1900 'not sure on dimentions
        picSprite.Left = 3360 'not sure on dimentions

        picSprites.Picture = LoadPicture(App.Path & "\GFX\96Sprites.bmp")
end if
```
Step 2 coding
go to modDirectx

find
```
Public DD_SpriteSurf As DirectDrawSurface7
Public DDSD_Sprite As DDSURFACEDESC2
```
Add
```
Public DD_96SpriteSurf As DirectDrawSurface7
Public DDSD_96Sprite As DDSURFACEDESC2
```
find
```
' Init sprite ddsd type and load the bitmap
    DDSD_Sprite.lFlags = DDSD_CAPS
    DDSD_Sprite.ddsCaps.lCaps = DDSCAPS_SYSTEMMEMORY
    Set DD_SpriteSurf = DD.CreateSurfaceFromFile(App.Path & "\GFX\Sprites.bmp", DDSD_Sprite)
    SetMaskColorFromPixel DD_SpriteSurf, 0, 0
```
Add
```
' Init sprite ddsd type and load the bitmap
    DDSD_96Sprite.lFlags = DDSD_CAPS
    DDSD_96Sprite.ddsCaps.lCaps = DDSCAPS_SYSTEMMEMORY
    Set DD_96SpriteSurf = DD.CreateSurfaceFromFile(App.Path & "\GFX\96Sprites.bmp", 96DDSD_Sprite)
    SetMaskColorFromPixel DD_96SpriteSurf, 0, 0
```
find
Sub DestroyDirectX()

Add
```
Set DD_96SpriteSurf = Nothing
```
Go to bltnpcBody
and add in

```
  If Npc(MapNpc(MapNpcNum).num).Big = 2 Then
            rec.Top = Npc(MapNpc(MapNpcNum).num).Sprite * 96 + 32
            rec.Bottom = rec.Top + PIC_Y
            rec.Left = (MapNpc(MapNpcNum).Dir * 3 + Anim) * PIC_X
            rec.Right = rec.Left + PIC_X

            X = MapNpc(MapNpcNum).X * PIC_X + sx + MapNpc(MapNpcNum).xOffset
            y = MapNpc(MapNpcNum).y * PIC_Y + sx + MapNpc(MapNpcNum).yOffset

' Check if its out of bounds because of the offset

            If y < 0 Then
                rec.Top = rec.Top + (y * -1)
                y = 0
            End If

            ' Call DD_BackBuffer.Blt(rec_pos, DD_96SpriteSurf, rec, DDBLT_WAIT Or DDBLT_KEYSRC)
            Call DD_BackBuffer.BltFast(X - (NewPlayerX * PIC_X) - NewXOffset, y - (NewPlayerY * PIC_Y) - NewYOffset, DD_96SpriteSurf, rec, DDBLTFAST_WAIT Or DDBLTFAST_SRCCOLORKEY)
        End If
```
Go to BltNpcTop
add in
```
If Npc(MapNpc(MapNpcNum).num).Big = 2 Then
        rec.Top = Npc(MapNpc(MapNpcNum).num).Sprite * 96
        rec.Bottom = rec.Top + PIC_Y
        rec.Left = (MapNpc(MapNpcNum).Dir * 3 + Anim) * PIC_X
        rec.Right = rec.Left + PIC_X

        X = MapNpc(MapNpcNum).X * PIC_X + sx + MapNpc(MapNpcNum).xOffset
        y = MapNpc(MapNpcNum).y * PIC_Y + sx + MapNpc(MapNpcNum).yOffset - 64

        ' Check if its out of bounds because of the offset
        If y < 0 Then
            rec.Top = rec.Top + (y * -1)
            y = 0
        End If

        ' Call DD_BackBuffer.Blt(rec_pos, DD_96SpriteSurf, rec, DDBLT_WAIT Or DDBLT_KEYSRC)
        Call DD_BackBuffer.BltFast(X - (NewPlayerX * PIC_X) - NewXOffset, y - (NewPlayerY * PIC_Y) - NewYOffset, DD_96SpriteSurf, rec, DDBLTFAST_WAIT Or DDBLTFAST_SRCCOLORKEY)
```
EDIT
Bah dont do this tutorial yet it won't work I'll finish it off when I get home
Link to comment
Share on other sites

Well he did say at the bottom that i didnt see:
"Bah dont do this tutorial yet it won't work I'll finish it off when I get home"

However, I sort of still dont understand posting something unless you have got it working. Perhaps posting it, and say "I cant get this working"  :huh:
Link to comment
Share on other sites

The reason is I was in a rush and was doing this tutorial off the top of my head and just looking at the soruce to rip stuff out. When I posted it I thought it would work then forgot I missed some key stuff out  :P. I forgot about this topic will fix the code up now.
Link to comment
Share on other sites

  • 2 weeks later...
Well
This code is already present in Baron's EE2.0(or 2.4 - I dont remember)

I got it working by adding just one line of code.
(Ofcourse, if you're using EE2.7 + you might need to add the 96x96 code aswell.)
But why not just wait for EE3.0?
Link to comment
Share on other sites

  • 3 weeks later...
  • 3 months later...
i found error

change this:
   ```
Set DD_96SpriteSurf = DD.CreateSurfaceFromFile(App.Path & "\GFX\96Sprites.bmp", 96DDSD_Sprite)
```
with:
```
    Set DD_96SpriteSurf = DD.CreateSurfaceFromFile(App.Path & "\GFX\96Sprites.bmp", DDSD_96Sprite)

```
Link to comment
Share on other sites

  • 2 weeks later...

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...