Mirage Engine
RM** Sprites Converter - Printable Version

+- Mirage Engine (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: Programming (https://mirage-engine.uk/forums/forumdisplay.php?fid=24)
+----- Forum: Visual Basic 6 (https://mirage-engine.uk/forums/forumdisplay.php?fid=32)
+----- Thread: RM** Sprites Converter (/showthread.php?tid=3076)



RM** Sprites Converter - GIAKEN - 22-08-2009

This will convert RMXP, RMVX, whatever sprites to the single row set up. (RM** has 4 row set up, this converts to single row for use with MS type engines)

This is a modification of my modification of Tony's Image Splitter. (my original modification was splitting a huge sprite sheet into separate files)


Re: RM** Sprites Converter - KruSuPhy - 28-08-2009

Do one that splits individual squares(for something like an item sheet)
Or do something that lets the user specify what and where it needs to be cut >.>


Re: RM** Sprites Converter - Matt - 28-08-2009

KruSuPhy Wrote:Do one that splits individual squares(for something like an item sheet)
Or do something that lets the user specify what and where it needs to be cut >.>

I'm sure he meant to say please, instead of sounding so demanding. Wink


Re: RM** Sprites Converter - KruSuPhy - 28-08-2009

I didn't mean to sound demanding, It was more of a suggestion =P
I'm not trying to ask him to do that, It was more of a, "hey, if you do that I'll give you major props and use it like a boss. But if you don't, Meh." thing. Tongue


Re: RM** Sprites Converter - Matt - 28-09-2009

It only converts 3 directions for RMVX and it puts the up view last instead of first. Lol.

Other than that, it works.


Re: RM** Sprites Converter - GIAKEN - 28-09-2009

Replace Sub SplitImage with this:

Code:
Sub SplitImage()
Dim i As Long
Dim Placehere(0 To 3) As Byte

    frmMain.picConversion.Width = (frmMain.picImage.ScaleWidth * 4) * Screen.TwipsPerPixelX
    frmMain.picConversion.Height = Val(frmMain.txtSizeY) * Screen.TwipsPerPixelY
  
    Placehere(0) = 1
    Placehere(1) = 2
    Placehere(2) = 3
    Placehere(3) = 0
  
    For i = 0 To 3 '((frmMain.picImage.ScaleHeight) / Val(frmMain.txtSizeY)) - 1
        BitBlt frmMain.picConversion.hDC, (frmMain.txtFrames * frmMain.txtSizeX) * Placehere(i), 0, frmMain.picImage.ScaleWidth, Val(frmMain.txtSizeY), frmMain.picImage.hDC, 0, i * Val(frmMain.txtSizeY), vbSrcCopy
    Next
  
    TotalSpritesSaved = TotalSpritesSaved + 1
  
    SavePicture frmMain.picConversion.Image, App.Path & "\Splitted Images\sprite" & TotalSpritesSaved & Extension
    AddToLog "sprite" & TotalSpritesSaved & Extension & " saved. Conversion finished!"
  
End Sub



Re: RM** Sprites Converter - GIAKEN - 28-09-2009

A fix Tongue

Code:
Sub SplitImage()
Dim i As Long
Dim Placehere(0 To 3) As Byte

    frmMain.picConversion.Width = (frmMain.picImage.ScaleWidth * 4) * Screen.TwipsPerPixelX
    frmMain.picConversion.Height = Val(frmMain.txtSizeY) * Screen.TwipsPerPixelY
  
    Placehere(0) = 1
    Placehere(1) = 2
    Placehere(2) = 3
    Placehere(3) = 0
  
    For i = 0 To 3 '((frmMain.picImage.ScaleHeight) / Val(frmMain.txtSizeY)) - 1
        BitBlt frmMain.picConversion.hDC, (frmMain.txtFrames * frmMain.txtSizeX) * Placehere(i), 0, frmMain.picImage.ScaleWidth, Val(frmMain.txtSizeY), frmMain.picImage.hDC, 0, i * Val(frmMain.txtSizeY), vbSrcCopy
    Next
  
    TotalSpritesSaved = TotalSpritesSaved + 1
  
    SavePicture frmMain.picConversion.Image, App.Path & "\Splitted Images\sprite" & TotalSpritesSaved & Extension
    AddToLog "sprite" & TotalSpritesSaved & Extension & " saved. Conversion finished!"
  
End Sub



Re: RM** Sprites Converter - GIAKEN - 29-09-2009

Here is a mega update Tongue This supports converting RM2K sprite sheets into MS format sprites. Here's an example RM2K sprite sheet:

[ATTACHMENT NOT FOUND]

And here is the code (replace Sub SplitImage with this):

Code:
Sub SplitImage()
Dim i As Long
Dim x As Long
Dim y As Long

    frmMain.picConversion.Width = ((Val(frmMain.txtFrames) * Val(frmMain.txtSizeX)) * 4) * Screen.TwipsPerPixelX
    frmMain.picConversion.Height = Val(frmMain.txtSizeY) * Screen.TwipsPerPixelY
    
    For x = 0 To 3
        For y = 0 To 1
            For i = 0 To 3
                BitBlt frmMain.picConversion.hDC, _
                       ((frmMain.txtFrames * frmMain.txtSizeX) * i), _
                       0, _
                       frmMain.picImage.ScaleWidth, _
                       Val(frmMain.txtSizeY), _
                       frmMain.picImage.hDC, _
                       x * (frmMain.picConversion.ScaleWidth / 4), _
                       i * Val(frmMain.txtSizeY) + (y * (frmMain.txtSizeY * 4)), _
                       vbSrcCopy
            Next
            
            TotalSpritesSaved = TotalSpritesSaved + 1
            
            SavePicture frmMain.picConversion.Image, App.Path & "\Splitted Images\sprite" & TotalSpritesSaved & Extension
            AddToLog "sprite" & TotalSpritesSaved & Extension & " saved."
            
            frmMain.picConversion.Cls
            
        Next
    Next
    
End Sub

Also don't forget to put size X as 48 and size Y as 64.