Pokemon Sprite Efficient Import

If the Efficient Import box is checked in pokemonedit, sprites will now be saved in Ram when they are imported. And if another sprite with the same imgstring or palstring is imported, it will not be inserted, instead it will just be repointed to the old image. Only stores the comparison info for as long as pokemonedit is open. So it will only work for pictures imported ina single session.
This commit is contained in:
Dreuu 2018-08-04 13:03:01 -04:00
parent f610b0b64c
commit cd8189d573
10 changed files with 96 additions and 9 deletions

View File

@ -591,11 +591,20 @@ Module ImportDataFunctions
ConvertBitmapToPalette(OShinyBackBitmapAnimation, AnimationShinyPalette, True)
End If
SynchSprite(FrontSprite, ONormalFrontBitmap, OShinyFrontBitmap)
SynchSprite(BackSprite, ONormalBackBitmap, OShinyBackBitmap)
Try
SynchSprite(FrontSprite, ONormalFrontBitmap, OShinyFrontBitmap)
SynchSprite(BackSprite, ONormalBackBitmap, OShinyBackBitmap)
Catch
SynchSpriteOverflow(FrontSprite, ONormalFrontBitmap, OShinyFrontBitmap)
SynchSpriteOverflow(BackSprite, ONormalBackBitmap, OShinyBackBitmap)
End Try
If LoadAnimationFlag = True Then
SynchSprite2(AnimationNormalSprite, ONormalFrontBitmapAnimation, OShinyFrontBitmapAnimation)
Try
SynchSprite2(AnimationNormalSprite, ONormalFrontBitmapAnimation, OShinyFrontBitmapAnimation)
Catch
SynchSprite2Overflow(AnimationNormalSprite, ONormalFrontBitmapAnimation, OShinyFrontBitmapAnimation)
End Try
End If
mainbitmap.Dispose()
@ -687,6 +696,84 @@ Module ImportDataFunctions
Loop
End Sub
Private Sub SynchSpriteOverflow(ByRef SpriteArray As Byte(), ByRef NormalSprite As Bitmap, ByRef ShinySprite As Bitmap)
Dim num11 As Double = ((CDbl(SpriteArray.Length) / 256) - 1)
Dim i As Double = 0
Do While (i <= num11)
Dim num8 As Integer = 0
Do
Dim num9 As Integer = 0
Do
Dim num10 As Integer = 0
Do
Dim num3 As Byte
Dim num4 As UInt32
Dim index As Byte = CByte(Array.IndexOf(Of Color)(FrontPalette, FrontPalette(GetClosestColorFromPalette(NormalSprite.GetPixel(((num8 * 8) + (num10 * 2)), CInt(Math.Round(CDbl(((i * 8) + num9))))), FrontPalette))))
Dim num2 As Byte = CByte(Array.IndexOf(Of Color)(FrontPalette, FrontPalette(GetClosestColorFromPalette(NormalSprite.GetPixel((((num8 * 8) + (num10 * 2)) + 1), CInt(Math.Round(CDbl(((i * 8) + num9))))), FrontPalette))))
Dim num5 As Byte = CByte(Array.IndexOf(Of Color)(BackPalette, BackPalette(GetClosestColorFromPalette(ShinySprite.GetPixel(((num8 * 8) + (num10 * 2)), CInt(Math.Round(CDbl(((i * 8) + num9))))), BackPalette))))
Dim num6 As Byte = CByte(Array.IndexOf(Of Color)(BackPalette, BackPalette(GetClosestColorFromPalette(ShinySprite.GetPixel((((num8 * 8) + (num10 * 2)) + 1), CInt(Math.Round(CDbl(((i * 8) + num9))))), BackPalette))))
If (num5 > index) Then
num3 = num5
Else
num3 = index
End If
If (num6 > num2) Then
num3 = CByte((num3 Or CByte((num6 << 4))))
Else
num3 = CByte((num3 Or CByte((num2 << 4))))
End If
SpriteArray(num4) = num3
Dim addvar As UInteger = 1
num4 = (num4 + addvar)
num10 += 1
Loop While (num10 <= 3)
num9 += 1
Loop While (num9 <= 7)
num8 += 1
Loop While (num8 <= 7)
i += 1
Loop
End Sub
Private Sub SynchSprite2Overflow(ByRef SpriteArray As Byte(), ByRef NormalSprite As Bitmap, ByRef ShinySprite As Bitmap)
Dim num11 As Double = ((CDbl(SpriteArray.Length) / 256) - 1)
Dim i As Double = 0
Do While (i <= num11)
Dim num8 As Integer = 0
Do
Dim num9 As Integer = 0
Do
Dim num10 As Integer = 0
Do
Dim num3 As Byte
Dim num4 As UInt32
Dim index As Byte = CByte(Math.Abs(Array.IndexOf(Of Color)(AnimationNormalPalette, AnimationNormalPalette(GetClosestColorFromPalette(NormalSprite.GetPixel(((num8 * 8) + (num10 * 2)), CInt(Math.Round(CDbl(((i * 8) + num9))))), AnimationNormalPalette)))))
Dim num2 As Byte = CByte(Math.Abs(Array.IndexOf(Of Color)(AnimationNormalPalette, AnimationNormalPalette(GetClosestColorFromPalette(NormalSprite.GetPixel((((num8 * 8) + (num10 * 2)) + 1), CInt(Math.Round(CDbl(((i * 8) + num9))))), AnimationNormalPalette)))))
Dim num5 As Byte = CByte(Math.Abs(Array.IndexOf(Of Color)(AnimationShinyPalette, AnimationShinyPalette(GetClosestColorFromPalette(ShinySprite.GetPixel(((num8 * 8) + (num10 * 2)), CInt(Math.Round(CDbl(((i * 8) + num9))))), AnimationShinyPalette)))))
Dim num6 As Byte = CByte(Math.Abs(Array.IndexOf(Of Color)(AnimationShinyPalette, AnimationShinyPalette(GetClosestColorFromPalette(ShinySprite.GetPixel((((num8 * 8) + (num10 * 2)) + 1), CInt(Math.Round(CDbl(((i * 8) + num9))))), AnimationShinyPalette)))))
If (num5 > index) Then
num3 = num5
Else
num3 = index
End If
If (num6 > num2) Then
num3 = CByte((num3 Or CByte((num6 << 4))))
Else
num3 = CByte((num3 Or CByte((num2 << 4))))
End If
SpriteArray(num4) = num3
Dim addvar As UInteger = 1
num4 = (num4 + addvar)
num10 += 1
Loop While (num10 <= 3)
num9 += 1
Loop While (num9 <= 7)
num8 += 1
Loop While (num8 <= 7)
i += 1
Loop
End Sub
Public Sub ImportPokemonIcon(filename As String, PokemonIndex As Integer)
Dim iconpals(2)() As Color

View File

@ -16,7 +16,7 @@
<dsig:Transform Algorithm="urn:schemas-microsoft-com:HashTransforms.Identity" />
</dsig:Transforms>
<dsig:DigestMethod Algorithm="http://www.w3.org/2000/09/xmldsig#sha256" />
<dsig:DigestValue>ePjmzcNYEee7PIv5KUrfLfCHzbaq5HIYsgdotH5ZvR8=</dsig:DigestValue>
<dsig:DigestValue>ec7N7gQJhiSqdXE2Pc0nveGeG8F1O5DPKlKqjLyMTsI=</dsig:DigestValue>
</hash>
</dependentAssembly>
</dependency>

View File

@ -43,14 +43,14 @@
</dependentAssembly>
</dependency>
<dependency>
<dependentAssembly dependencyType="install" allowDelayedBinding="true" codebase="PokemonGameEditor.exe" size="2096640">
<dependentAssembly dependencyType="install" allowDelayedBinding="true" codebase="PokemonGameEditor.exe" size="2097664">
<assemblyIdentity name="PokemonGameEditor" version="3.8.1.0" language="neutral" processorArchitecture="msil" />
<hash>
<dsig:Transforms>
<dsig:Transform Algorithm="urn:schemas-microsoft-com:HashTransforms.Identity" />
</dsig:Transforms>
<dsig:DigestMethod Algorithm="http://www.w3.org/2000/09/xmldsig#sha256" />
<dsig:DigestValue>vVjxd+Xyi+P07L43P8QiG5Ey5gPdrYAVcbgxWCRSQzM=</dsig:DigestValue>
<dsig:DigestValue>7pxg2xb8XevLFOacVz09p4ExKZZGx06y/dXCPbLKwog=</dsig:DigestValue>
</hash>
</dependentAssembly>
</dependency>

View File

@ -16,7 +16,7 @@
<dsig:Transform Algorithm="urn:schemas-microsoft-com:HashTransforms.Identity" />
</dsig:Transforms>
<dsig:DigestMethod Algorithm="http://www.w3.org/2000/09/xmldsig#sha256" />
<dsig:DigestValue>ePjmzcNYEee7PIv5KUrfLfCHzbaq5HIYsgdotH5ZvR8=</dsig:DigestValue>
<dsig:DigestValue>ec7N7gQJhiSqdXE2Pc0nveGeG8F1O5DPKlKqjLyMTsI=</dsig:DigestValue>
</hash>
</dependentAssembly>
</dependency>

View File

@ -43,14 +43,14 @@
</dependentAssembly>
</dependency>
<dependency>
<dependentAssembly dependencyType="install" allowDelayedBinding="true" codebase="PokemonGameEditor.exe" size="2096640">
<dependentAssembly dependencyType="install" allowDelayedBinding="true" codebase="PokemonGameEditor.exe" size="2097664">
<assemblyIdentity name="PokemonGameEditor" version="3.8.1.0" language="neutral" processorArchitecture="msil" />
<hash>
<dsig:Transforms>
<dsig:Transform Algorithm="urn:schemas-microsoft-com:HashTransforms.Identity" />
</dsig:Transforms>
<dsig:DigestMethod Algorithm="http://www.w3.org/2000/09/xmldsig#sha256" />
<dsig:DigestValue>vVjxd+Xyi+P07L43P8QiG5Ey5gPdrYAVcbgxWCRSQzM=</dsig:DigestValue>
<dsig:DigestValue>7pxg2xb8XevLFOacVz09p4ExKZZGx06y/dXCPbLKwog=</dsig:DigestValue>
</hash>
</dependentAssembly>
</dependency>