Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
[Feature] Dynamic sprite sizes!
#51
init the surface before you run the code. Also change all of the ddsd_sprite to dds_sprite.surfdescription. Thats what I did and it worked fine.
Reply
#52
How would i init the surface ?
Reply
#53
Here's my clipper code (Dugor helped with it a long time ago, makes surfaces not disappear when off screen):

Code:
If Y < 0 Then
        rec.Top = rec.Top - Y
        Y = 0
    End If
    
    If X < 0 Then
        rec.Left = rec.Left - X
        X = 0
    End If
    
    If X + Anim_Size(AnimNum).SizeX > DDSD_BackBuffer.lWidth Then
        rec.Right = rec.Right - (X + Anim_Size(AnimNum).SizeX - DDSD_BackBuffer.lWidth)
    End If
    
    If Y + Anim_Size(AnimNum).SizeY > DDSD_BackBuffer.lHeight Then
        rec.Bottom = rec.Bottom - (Y + Anim_Size(AnimNum).SizeY - DDSD_BackBuffer.lHeight)
    End If

Just change the Anim_Size stuff to whatever the size of the surface is.
Reply
#54
Updated to work with the latest MS4.

Basically, the lHeight and lWidth were being stored in the .SurfDescription when the sprite ready-ing code was called, which came after all the calculations were passed. I changed it so this was called before the calculations.
Quote:Robin:
Why aren't maps and shit loaded up in a dynamic array?
Jacob:
the 4 people that know how are lazy
Robin:
Who are those 4 people?
Jacob:
um
you, me, and 2 others?
Reply
#55
Using Giaken's clipping code, I'm trying to modify it a bit to work with Advocate/Matt's dynamic maps version of MS4. The X clipping works fine as:

Code:
' Is player's X more than max map values..?
    If X + (DDSD_Sprite(Sprite).lWidth / 12) > MAX_MAPX * 32 + 32 Then
        With rec
            .Right = .Right - ((Map.MaxX / 2) - 24)
        End With
    End If

I know the formula should be similar for the Y clipping, but I can't seem to get it to work properly. Any ideas?
Reply
#56
An easy way to fix clipping problems is to convert map drawing to using Blt instead of BltFast. The way DirectX 7 works is BltFast takes out clipping, resizing, and whatever other things and just simply draws it to the screen, which makes it faster. Clipping code is already set up with like DD_Clipper I think...but it only works with Blt.
Reply


Forum Jump:


Users browsing this thread: 2 Guest(s)