Mirage Source
[Feature] Dynamic sprite sizes! - Printable Version

+- Mirage Source (https://mirage-engine.uk/forums)
+-- Forum: Mirage Source (Nostalgia) (https://mirage-engine.uk/forums/forumdisplay.php?fid=61)
+--- Forum: Archive (2006-2011) (https://mirage-engine.uk/forums/forumdisplay.php?fid=18)
+---- Forum: Source Code Development (https://mirage-engine.uk/forums/forumdisplay.php?fid=51)
+----- Forum: Mirage Source 4 (Visual Basic 6) (https://mirage-engine.uk/forums/forumdisplay.php?fid=44)
+------ Forum: Tutorials (https://mirage-engine.uk/forums/forumdisplay.php?fid=13)
+------ Thread: [Feature] Dynamic sprite sizes! (/showthread.php?tid=2543)

Pages: 1 2 3


Re: [Feature] Dynamic sprite sizes! - Labmonkey - 14-04-2009

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.


Re: [Feature] Dynamic sprite sizes! - Doomy - 14-04-2009

How would i init the surface ?


Re: [Feature] Dynamic sprite sizes! - GIAKEN - 14-04-2009

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.


Re: [Feature] Dynamic sprite sizes! - Robin - 01-06-2009

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.


Re: [Feature] Dynamic sprite sizes! - Kousaten - 05-09-2009

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?


Re: [Feature] Dynamic sprite sizes! - GIAKEN - 05-09-2009

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.