mirror of
https://github.com/Gamer2020/PokemonGameEditor.git
synced 2026-07-20 09:23:47 -05:00
I was away for a month or so without internet. In that time I continued to work on PGE. There are a lot of new things in this version. The Attack adder has been updated. I've completed Jambo51's move table hack for Fire Red and made it so the Attack adder installs it. I still have yet to port the hack to Emerald. The Pokemon adder works for English Fire Red. I made it add Pokemon the same way that it's done in DoesntKnowHowToPlay's tutorial in order to remain consistent with what others may have already done. If any problems occur with the Pokemon adder please let me know. Unlike G3HS, cries and other things are expanded correctly by PGE. I advise not using G3HS to add more Pokemon. When an offset is missing from the ini, PGE will now dump text to a file named errors.txt letting you know what offset is missing and for what ROM. I may expand on this in the future. Improved importing and exporting of data. Attacks, Abilities, and Pokemon can be exported and imported as inis. It is now handled better than in older versions. I fixed the Pokedex data editor because it seems it wasn't loading some data properly. I've added a Pokedex tab to the Pokemon Editor. Even though I feel they should be seperate I mainly added it because I want Pokedex data to be included when you export Pokemon Data. I made it so that the Pokedex tab shows you how big the sprites will be in the size compare. I will make it show where the sprites will be onscreen once I figure out the formula for it. Bulbapedia is wrong when it comes to the Pokedex data. Added the item use anitmation (FR/LG) bytes to the Pokemon Editor. Added editing of the in battle sprite positions. Has the preview from Advance Series. (Loading of all the Pokemon data seems slow now. Eventually I will have to come back and optimize things.) Pokemon sprites can be imported and exported. The format is the same as Advance Series. The importing and exporting of the animations from Emerald are handled better than in Advance Series. Pokemon Icons can now be imported and exported. Advance Series compatable as well. Pokemon Footprints can be imported and exported. Other Miscellaneous fixes and additions.
203 lines
5.6 KiB
VB.net
203 lines
5.6 KiB
VB.net
Imports System.IO
|
|
|
|
|
|
|
|
Module mMain
|
|
|
|
Public LoadedROM As String
|
|
Public AppPath As String = System.AppDomain.CurrentDomain.BaseDirectory() & IIf(Right(System.AppDomain.CurrentDomain.BaseDirectory(), 1) = "\", "", "\")
|
|
Public i As Integer
|
|
Public FileNum As Integer
|
|
Public header As String = "xxxx"
|
|
Public header2 As String
|
|
Public header3 As String
|
|
Public lwut As String
|
|
Public SkipVar As Integer
|
|
Public x As Integer
|
|
|
|
'For Map Edit
|
|
Public Point2MapBankPointers As String
|
|
Public MapBankPointers As String
|
|
Public HeaderPointer As String
|
|
Public MapBank As String
|
|
Public MapNumber As String
|
|
Public BankOffset As String
|
|
Public HeaderOffset As String
|
|
Public MapData As String
|
|
Public Const TileSetSize As Integer = 16
|
|
Public Const TileSize As Integer = 8 'constant used for tile sizes.
|
|
Public Const TileWidth As Integer = 8
|
|
Public Const TilesPerRow As Integer = 16
|
|
|
|
'These are all the buffers for creating the graphics for the tilesets.
|
|
Public TilesBackbuffer As Bitmap
|
|
Public TilesetMapBackbuffer As Bitmap
|
|
Public TilesGraphics As Graphics
|
|
Public TilesetMapGraphics As Graphics
|
|
Public TilesBackbuffer2 As Bitmap
|
|
Public TilesetMapBackbuffer2 As Bitmap
|
|
Public TilesGraphics2 As Graphics
|
|
Public TilesetMapGraphics2 As Graphics
|
|
|
|
'These are variables for keeping track of which tile is selected in the tile editor
|
|
Public TileEditorTilesCurrentTile As Integer
|
|
Public TileEditorTilesetCurrentTile As Integer
|
|
|
|
'These are arrays that keep track of which tiles go where.
|
|
'There are two because I am using two picture boxes.
|
|
'I do not know how to draw two images and over lay them to the same picturebox.
|
|
'I figured it would be easier to just overlay two pictureboxes.
|
|
'I just noticed that pictureboxes have a background image... Hmm...
|
|
Public TilesetBottomLayer As Integer(,)
|
|
Public TilesetTopLayer As Integer(,)
|
|
Public TilesetHeight As Integer
|
|
Public TilesetWidth As Integer
|
|
|
|
'These are the buffers for the actual tileset and it's buffers.
|
|
Public TilesetBackbuffer As Bitmap
|
|
Public MapBackbuffer As Bitmap
|
|
Public TilesetGraphics As Graphics
|
|
Public MapGraphics As Graphics
|
|
|
|
'This keeps track of current tiles in the map editor.
|
|
Public MapEditorTilesetCurrentTile As Integer
|
|
Public MapEditorMapCurrentTile As Integer
|
|
|
|
'This keeps track of the images for the map.
|
|
'The Map variable is very important cause it is the one used for saving.
|
|
Public Map As Integer(,)
|
|
Public MapTiles1 As Integer(,)
|
|
Public MapTiles2 As Integer(,)
|
|
|
|
|
|
Public Function GetINIFileLocation()
|
|
|
|
If System.IO.File.Exists((LoadedROM).Substring(0, LoadedROM.Length - 4) & ".ini") = True Then
|
|
|
|
Return (LoadedROM).Substring(0, LoadedROM.Length - 4) & ".ini"
|
|
Else
|
|
|
|
Return AppPath & "ini\roms.ini"
|
|
End If
|
|
|
|
End Function
|
|
|
|
Public Function MakeFreeSpaceString(NeededLength As Integer, Optional NeedByteString As String = "FF")
|
|
|
|
Dim PrivLoopVar As Integer
|
|
Dim OutBuffThing As String = ""
|
|
|
|
PrivLoopVar = 0
|
|
|
|
While (PrivLoopVar < NeededLength)
|
|
|
|
OutBuffThing = OutBuffThing & NeedByteString
|
|
|
|
PrivLoopVar = PrivLoopVar + 1
|
|
End While
|
|
|
|
MakeFreeSpaceString = OutBuffThing
|
|
End Function
|
|
|
|
Public Function DecapString(input As String) As String
|
|
|
|
Dim LoopVar As Integer
|
|
Dim outputstring As String = ""
|
|
Dim capflag As Boolean = True
|
|
|
|
LoopVar = 0
|
|
|
|
While LoopVar < Len(input)
|
|
|
|
LoopVar = LoopVar + 1
|
|
|
|
If GetChar(input, LoopVar) = " " Then
|
|
outputstring = outputstring & " "
|
|
capflag = True
|
|
Else
|
|
If capflag = True Then
|
|
|
|
outputstring = outputstring & UCase(GetChar(input, LoopVar))
|
|
capflag = False
|
|
|
|
ElseIf capflag = False
|
|
|
|
outputstring = outputstring & LCase(GetChar(input, LoopVar))
|
|
|
|
End If
|
|
End If
|
|
|
|
End While
|
|
|
|
DecapString = outputstring
|
|
End Function
|
|
|
|
Public Sub OutPutError(message As String)
|
|
|
|
Dim errorfile As String = AppPath & "errors.txt"
|
|
|
|
System.IO.File.AppendAllText(errorfile, message & vbCrLf)
|
|
|
|
End Sub
|
|
|
|
Public Function ByteToSignedInt(InputByte As Byte) As Integer
|
|
Dim ReturnVar As Integer
|
|
|
|
|
|
If InputByte > &H7F Then
|
|
Dim BinaryVar As String = (Convert.ToString(InputByte, 2))
|
|
ReturnVar = ((Convert.ToInt32(Mid(BinaryVar, 2, 7), 2)) - 128)
|
|
Else
|
|
ReturnVar = InputByte
|
|
End If
|
|
|
|
ByteToSignedInt = ReturnVar
|
|
|
|
End Function
|
|
|
|
Public Function SignedIntToHex(InputInt As Integer) As String
|
|
|
|
Dim ReturnVar As String
|
|
|
|
|
|
If InputInt < 0 Then
|
|
|
|
Dim BinaryVar As String = (Convert.ToString(InputInt + 128, 2))
|
|
BinaryVar = "1" & BinaryVar
|
|
ReturnVar = Hex((Convert.ToInt32(BinaryVar, 2)))
|
|
|
|
Else
|
|
ReturnVar = Hex(InputInt)
|
|
End If
|
|
|
|
SignedIntToHex = ReturnVar
|
|
|
|
End Function
|
|
|
|
Public Function ByteArrayToHexString(inputarray As Byte()) As String
|
|
|
|
Dim HexString As String = ""
|
|
|
|
For Each b As Byte In inputarray
|
|
HexString = HexString & MakeProperByte(b)
|
|
Next
|
|
|
|
ByteArrayToHexString = HexString
|
|
End Function
|
|
|
|
Public Function MakeProperByte(DaByte As Byte) As String
|
|
Dim OutputByte As String
|
|
|
|
|
|
If Len(Hex(DaByte)) = 1 Then
|
|
OutputByte = "0" & Hex(DaByte)
|
|
Else
|
|
OutputByte = Hex(DaByte)
|
|
End If
|
|
|
|
MakeProperByte = OutputByte
|
|
|
|
End Function
|
|
|
|
End Module
|