Initial commit

This commit is contained in:
Brandon Scott 2014-07-10 23:56:29 -05:00
commit a8856756f6
10 changed files with 1670 additions and 0 deletions

39
OverworldEditor.vbp Normal file
View File

@ -0,0 +1,39 @@
Type=Exe
Form=frmOverworldEditor.frm
Reference=*\G{00020430-0000-0000-C000-000000000046}#2.0#0#C:\Windows\SysWOW64\stdole2.tlb#OLE Automation
Module=modGraphicEditing; modGraphicEditing.bas
Form=frmAbout.frm
Class=clsCommonDialog; clsCommonDialog.cls
IconForm="frmOverworldEditor"
Startup="frmOverworldEditor"
HelpFile=""
Title="OverworldEditor"
ExeName32="OverworldEditor.exe"
Command32=""
Name="OverworldEditor"
HelpContextID="0"
CompatibleMode="0"
MajorVer=1
MinorVer=0
RevisionVer=13
AutoIncrementVer=1
ServerSupportFiles=0
VersionCompanyName="Xeon Productions"
CompilationType=0
OptimizationType=0
FavorPentiumPro(tm)=0
CodeViewDebugInfo=0
NoAliasing=0
BoundsCheck=0
OverflowCheck=0
FlPointCheck=0
FDIVCheck=0
UnroundedFP=0
StartMode=0
Unattended=0
Retained=0
ThreadPerObject=0
MaxNumberOfThreads=1
[MS Transaction Server]
AutoRefresh=1

4
OverworldEditor.vbw Normal file
View File

@ -0,0 +1,4 @@
frmOverworldEditor = 99, 12, 892, 426, , 135, -15, 928, 481, C
modGraphicEditing = 110, 29, 925, 419,
frmAbout = 44, 58, 862, 423, , 22, 29, 840, 394, C
clsCommonDialog = 0, 0, 861, 286, Z

51
README.md Normal file
View File

@ -0,0 +1,51 @@
Pokémon Overworld Sprite Editor
===============================
Sprite Navigation
-----------------
This is where you can pick the index of the sprite
to edit, there are over 200 sprites on all the games.
Right now there is no way of determining how many
frames each sprite has, so if you go over how many
frames are actually in a sprite, it will start reading
from the sprite # after it.
Sprite Header #1 Info
---------------------
Sprite #: Current sprite you are on.
Starter Bytes: First two bytes in the header, always FFFF.
Pallete #: This is just the numerical index of the Pallete. There are around 20+ sprite palletes in the game.
Unknown Data: Self-Explanitory, its in the header, and I have no idea what it does?
Sprite Data Size: The number of bytes a the sprite takes
Width and Height: Self-explanitory.
Unknown Data 2: More data I have no clue what it does.
Unknown Pointer 1, 2, 3, and 4 I have no idea what kind of data these pointers point to. I believe 2 has to do with tile arrangment.
Sprite Pointer: Points to Sprite Header #2
Sprite Header #2 Info
---------------------
Sprite Pointer: Actual pointer to the sprite image data.
Data Size: another specifier of datasize
Unknown 1: As the name says!
Drawing Canvas Features
-----------------------
- You can drag the current color, its like paintbrush.
- Right click on a pixel and it will make that the selected
color.
- Displays the color your mouse is over, and the currently
selected color.
Games Supported
===============
- Pokemon Ruby/Sapphire/Emerald (English Versions)
- Pokemon FireRed/LeafGreen (English and Japanese Versions)
Features Coming Soon
====================
- Import/Export Bitmaps
- Undo/Redo
- German and More japanese ROM support.
- Repointing and Pallete Editing

41
Sprites.ini Normal file
View File

@ -0,0 +1,41 @@
[AXVE]
Name = Pokémon Ruby (English)
SpritePalleteHeaders = &H37377C
SpriteBank = &H3718D4
SpriteCount = 217
[AXPE]
Name = Pokémon Sapphire (English)
SpritePalleteHeaders = &H37370C
SpriteBank = &H371864
SpriteCount = 217
[BPEE]
Name = Pokémon Emerald (English)
SpritePalleteHeaders = &H50BBC8
SpriteBank = &H509954
SpriteCount = 244
[BPRE]
Name = Pokémon Fire Red (English)
SpritePalleteHeaders = &H3A5158
SpriteBank = &H3A3BB0
SpriteCount = 153
[BPRJ]
Name = Pokémon Fire Red (Japanese)
SpritePalleteHeaders = &H3691E0
SpriteBank = &H367C38
SpriteCount = 153
[BPGE]
Name = Pokémon Leaf Green (English)
SpritePalleteHeaders = &H3A5138
SpriteBank = &H3A3B90
SpriteCount = 153
[BPGJ]
Name = Pokémon Leaf Green (Japanese)
SpritePalleteHeaders = &H3691C0
SpriteBank = &H367C18
SpriteCount = 153

147
clsCommonDialog.cls Normal file
View File

@ -0,0 +1,147 @@
VERSION 1.0 CLASS
BEGIN
MultiUse = -1 'True
Persistable = 0 'NotPersistable
DataBindingBehavior = 0 'vbNone
DataSourceBehavior = 0 'vbNone
MTSTransactionMode = 0 'NotAnMTSObject
END
Attribute VB_Name = "clsCommonDialog"
Attribute VB_GlobalNameSpace = False
Attribute VB_Creatable = True
Attribute VB_PredeclaredId = False
Attribute VB_Exposed = False
Option Explicit
Private Declare Function GetOpenFileName Lib "COMDLG32.DLL" Alias "GetOpenFileNameA" (pOpenfilename As OPENFILENAME) As Long
Private Declare Function GetSaveFileName Lib "COMDLG32.DLL" Alias "GetSaveFileNameA" (pOpenfilename As OPENFILENAME) As Long
Private cdlg As OPENFILENAME
Private LastFileName As String
Private Type OPENFILENAME
lStructSize As Long
hwndOwner As Long
hInstance As Long
lpstrFilter As String
lpstrCustomFilter As String
nMaxCustFilter As Long
nFilterIndex As Long
lpstrFile As String
nMaxFile As Long
lpstrFileTitle As String
nMaxFileTitle As Long
lpstrInitialDir As String
lpstrTitle As String
Flags As Long
nFileOffset As Integer
nFileExtension As Integer
lpstrDefExt As String
lCustData As Long
lpfnHook As Long
lpTemplateName As String
End Type
Private Const OFN_ALLOWMULTISELECT = &H200
Private Const OFN_CREATEPROMPT = &H2000
Private Const OFN_ENABLEHOOK = &H20
Private Const OFN_ENABLETEMPLATE = &H40
Private Const OFN_ENABLETEMPLATEHANDLE = &H80
Private Const OFN_EXPLORER = &H80000 ' new look commdlg
Private Const OFN_EXTENSIONDIFFERENT = &H400
Private Const OFN_FILEMUSTEXIST = &H1000
Private Const OFN_HIDEREADONLY = &H4
Private Const OFN_LONGNAMES = &H200000 ' force long names for 3.x modules
Private Const OFN_NOCHANGEDIR = &H8
Private Const OFN_NODEREFERENCELINKS = &H100000
Private Const OFN_NOLONGNAMES = &H40000 ' force no long names for 4.x modules
Private Const OFN_NONETWORKBUTTON = &H20000
Private Const OFN_NOREADONLYRETURN = &H8000
Private Const OFN_NOTESTFILECREATE = &H10000
Private Const OFN_NOVALIDATE = &H100
Private Const OFN_OVERWRITEPROMPT = &H2
Private Const OFN_PATHMUSTEXIST = &H800
Private Const OFN_READONLY = &H1
Private Const OFN_SHAREAWARE = &H4000
Private Const OFN_SHAREFALLTHROUGH = 2
Private Const OFN_SHARENOWARN = 1
Private Const OFN_SHAREWARN = 0
Private Const OFN_SHOWHELP = &H10
Public Enum DialogFlags
ALLOWMULTISELECT = OFN_ALLOWMULTISELECT
CREATEPROMPT = OFN_CREATEPROMPT
ENABLEHOOK = OFN_ENABLEHOOK
ENABLETEMPLATE = OFN_ENABLETEMPLATE
ENABLETEMPLATEHANDLE = OFN_ENABLETEMPLATEHANDLE
EXPLORER = OFN_EXPLORER
EXTENSIONDIFFERENT = OFN_EXTENSIONDIFFERENT
FILEMUSTEXIST = OFN_FILEMUSTEXIST
HIDEREADONLY = OFN_HIDEREADONLY
LONGNAMES = OFN_LONGNAMES
NOCHANGEDIR = OFN_NOCHANGEDIR
NODEREFERENCELINKS = OFN_NODEREFERENCELINKS
NOLONGNAMES = OFN_NOLONGNAMES
NONETWORKBUTTON = OFN_NONETWORKBUTTON
NOREADONLYRETURN = OFN_NOREADONLYRETURN
NOTESTFILECREATE = OFN_NOTESTFILECREATE
NOVALIDATE = OFN_NOVALIDATE
OVERWRITEPROMPT = OFN_OVERWRITEPROMPT
PATHMUSTEXIST = OFN_PATHMUSTEXIST
ReadOnly = OFN_READONLY
SHAREAWARE = OFN_SHAREAWARE
SHAREFALLTHROUGH = OFN_SHAREFALLTHROUGH
SHARENOWARN = OFN_SHARENOWARN
SHAREWARN = OFN_SHAREWARN
SHOWHELP = OFN_SHOWHELP
End Enum
Public Function ShowOpen(ByVal Form_hWnd As Long, ByVal Title As String, Optional ByVal InitDir As String = "", Optional ByVal Filter As String = "All Files (*.*)|*.*|", Optional Flags As DialogFlags = FILEMUSTEXIST Or PATHMUSTEXIST) As String
Dim i As Integer
Filter = Replace(Filter, "|", Chr(0))
If Right(Filter, 1) <> Chr(0) Then Filter = Filter & Chr(0)
If Len(InitDir) = 0 Then InitDir = LastFileName
cdlg.lStructSize = Len(cdlg)
cdlg.hwndOwner = Form_hWnd
cdlg.hInstance = App.hInstance
cdlg.lpstrFilter = Filter
cdlg.lpstrFile = Space(254)
cdlg.nMaxFile = 255
cdlg.lpstrFileTitle = Space(254)
cdlg.nMaxFileTitle = 255
cdlg.lpstrInitialDir = InitDir
cdlg.lpstrTitle = Title
cdlg.Flags = Flags
ShowOpen = IIf(GetOpenFileName(cdlg), Trim(cdlg.lpstrFile), "")
If Len(ShowOpen) > 0 Then LastFileName = ShowOpen
End Function
Public Function ShowSave(ByVal Form_hWnd As Long, ByVal Title As String, Optional ByVal InitDir As String = "", Optional ByVal Filter As String = "All Files (*.*)|*.*|", Optional ByVal DefExt As String = "", Optional Flags As DialogFlags = OVERWRITEPROMPT) As String
Dim i As Integer
Filter = Replace(Filter, "|", Chr(0))
If Right(Filter, 1) <> Chr(0) Then Filter = Filter & Chr(0)
If Len(InitDir) = 0 Then InitDir = LastFileName
cdlg.lStructSize = Len(cdlg)
cdlg.lpstrTitle = Title
cdlg.hwndOwner = Form_hWnd
cdlg.hInstance = App.hInstance
cdlg.lpstrFilter = Filter
cdlg.lpstrDefExt = DefExt
cdlg.lpstrFile = Space(255)
cdlg.nMaxFile = 255
cdlg.lpstrFileTitle = Space(254)
cdlg.nMaxFileTitle = 255
cdlg.lpstrInitialDir = InitDir
cdlg.Flags = Flags
ShowSave = IIf(GetSaveFileName(cdlg), Trim(cdlg.lpstrFile), "")
If Len(ShowSave) > 0 Then LastFileName = ShowSave
End Function
Public Property Let FileName(szFileName)
LastFileName = szFileName
End Property
Public Property Get FileName()
FileName = LastFileName
End Property

117
frmAbout.frm Normal file
View File

@ -0,0 +1,117 @@
VERSION 5.00
Begin VB.Form frmAbout
BorderStyle = 1 'Fixed Single
Caption = "About..."
ClientHeight = 2535
ClientLeft = 45
ClientTop = 435
ClientWidth = 5175
BeginProperty Font
Name = "Tahoma"
Size = 8.25
Charset = 0
Weight = 400
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
Icon = "frmAbout.frx":0000
LinkTopic = "Form1"
MaxButton = 0 'False
MinButton = 0 'False
ScaleHeight = 2535
ScaleWidth = 5175
StartUpPosition = 3 'Windows Default
Begin VB.CommandButton cmdOK
Caption = "OK"
Height = 345
Left = 3960
TabIndex = 4
Top = 840
Width = 1095
End
Begin VB.Label lblAbout
Caption = $"frmAbout.frx":151A
Height = 1215
Index = 1
Left = 120
TabIndex = 3
Top = 1200
Width = 3615
End
Begin VB.Label lblAbout
Alignment = 2 'Center
Caption = "Coded by Xeon"
BeginProperty Font
Name = "Tahoma"
Size = 8.25
Charset = 0
Weight = 700
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
Height = 255
Index = 0
Left = 120
TabIndex = 2
Top = 840
Width = 3615
End
Begin VB.Label lblVersion
BackColor = &H00FFFFFF&
Caption = "Version 1.0"
Height = 255
Left = 840
TabIndex = 1
Top = 360
Width = 3255
End
Begin VB.Label lblApplicationTitle
BackColor = &H00FFFFFF&
Caption = "Pokémon Overworld Sprite Editor"
BeginProperty Font
Name = "Tahoma"
Size = 8.25
Charset = 0
Weight = 700
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
Height = 255
Left = 840
TabIndex = 0
Top = 120
Width = 3735
End
Begin VB.Image imgProgramIcon
Height = 480
Left = 120
Picture = "frmAbout.frx":162C
Top = 120
Width = 480
End
Begin VB.Shape shpHeaderBackground
BackStyle = 1 'Opaque
BorderStyle = 0 'Transparent
Height = 735
Left = 0
Top = 0
Width = 6375
End
End
Attribute VB_Name = "frmAbout"
Attribute VB_GlobalNameSpace = False
Attribute VB_Creatable = False
Attribute VB_PredeclaredId = True
Attribute VB_Exposed = False
Option Explicit
Private Sub cmdOK_Click()
Unload Me
End Sub
Private Sub Form_Load()
lblVersion.Caption = "Version " & App.Major & "." & App.Minor & "." & App.Revision & " by Xeon"
End Sub

BIN
frmAbout.frx Normal file

Binary file not shown.

1113
frmOverworldEditor.frm Normal file

File diff suppressed because it is too large Load Diff

BIN
frmOverworldEditor.frx Normal file

Binary file not shown.

158
modGraphicEditing.bas Normal file
View File

@ -0,0 +1,158 @@
Attribute VB_Name = "modGraphicEditing"
Option Explicit
Public Type SpriteHeader
StarterBytes As Integer
PalleteModifier As Byte
Unknown1(2) As Byte
SpriteDataSize As Integer
Width As Integer
Height As Integer
Unknown2 As Byte
Unknown3 As Byte
Unknown4 As Integer
Pointer1 As Long
Pointer2 As Long
Pointer3 As Long
SpriteHeader2Pointer As Long
Pointer5 As Long
End Type
Public Type SpriteHeader2
SpritePointer As Long
SpriteDataSize As Integer
Unknown As Integer
End Type
Public Type PalleteHeader
DataPointer As Long
Index As Byte
UnknownData(2) As Byte
End Type
Public Type BITMAPINFOHEADER
biSize As Long
biWidth As Long
biHeight As Long
biPlanes As Integer
biBitCount As Integer
biCompression As Long
biSizeImage As Long
biXPelsPerMeter As Long
biYPelsPerMeter As Long
biClrUsed As Long
biClrImportant As Long
End Type
Public Type BITMAPINFO
bmiHeader As BITMAPINFOHEADER
bmiColor0 As Long
bmiColor1 As Long
bmiColor2 As Long
End Type
Public Type BITMAPFILEHEADER
bfType As Integer
bfSize As Long
bfReserved1 As Integer
bfReserved2 As Integer
bfOffBits As Long
End Type
Public Type BITMAPV4HEADER
bV4Size As Long
bV4Width As Long
bV4Height As Long
bV4Planes As Integer
bV4BitCount As Integer
bV4V4Compression As Long
bV4SizeImage As Long
bV4XPelsPerMeter As Long
bV4YPelsPerMeter As Long
bV4ClrUsed As Long
bV4ClrImportant As Long
bV4RedMask As Long
bV4GreenMask As Long
bV4BlueMask As Long
bV4AlphaMask As Long
bV4CSType As Long
bV4Endpoints As Long
bV4GammaRed As Long
bV4GammaGreen As Long
bV4GammaBlue As Long
End Type
Public Declare Function GetPrivateProfileString Lib "kernel32" Alias "GetPrivateProfileStringA" (ByVal lpApplicationName As String, ByVal lpKeyName As String, ByVal lpDefault As String, ByVal lpReturnedString As String, ByVal nSize As Long, ByVal lpFileName As String) As Long
Public Declare Function WritePrivateProfileString Lib "kernel32" Alias "WritePrivateProfileStringA" (ByVal lpApplicationName As String, ByVal lpKeyName As String, ByVal lpString As Any, ByVal lpFileName As String) As Long
Public Declare Function BitBlt Lib "gdi32" (ByVal hDestDC As Long, ByVal X As Long, ByVal Y As Long, ByVal nWidth As Long, ByVal nHeight As Long, ByVal hSrcDC As Long, ByVal xSrc As Long, ByVal ySrc As Long, ByVal dwRop As Long) As Long
Public Declare Function StretchDIBits Lib "gdi32" (ByVal hdc As Long, ByVal X As Long, ByVal Y As Long, ByVal dx As Long, ByVal dy As Long, ByVal SrcX As Long, ByVal SrcY As Long, ByVal wSrcWidth As Long, ByVal wSrcHeight As Long, lpBits As Any, lpBitsInfo As BITMAPINFO, ByVal wUsage As Long, ByVal dwRop As Long) As Long
Public Declare Function GetBitmapBits Lib "gdi32" (ByVal hBitmap As Long, ByVal dwCount As Long, lpBits As Any) As Long
Public Function ReadINI(ByVal Section As String, ByVal KeyName As String, ByVal FileName As String) As String
Dim sRet As String
sRet = String(256, Chr(0))
ReadINI = Left(sRet, GetPrivateProfileString(Section, ByVal KeyName, "", sRet, Len(sRet), FileName))
End Function
Public Function WriteINI(sSection As String, sKeyName As String, sNewString As String, sFileName) As Integer
Call WritePrivateProfileString(sSection, sKeyName, sNewString, sFileName)
End Function
Public Sub Blit32(Buffer() As Long, ByRef pic As PictureBox, imagewidth As Long, imageheight As Long)
If imagewidth = 0 Or imageheight = 0 Then Exit Sub
Dim bi As BITMAPINFO
With bi.bmiHeader
.biWidth = imagewidth
.biHeight = -imageheight
.biSize = 40
.biBitCount = 32
.biPlanes = 1
End With
If pic.ScaleMode <> 3 Then pic.ScaleMode = 3
StretchDIBits pic.hdc, 0, 0, pic.ScaleWidth, pic.ScaleHeight, 0, 0, imagewidth, imageheight, Buffer(0), bi, 0, vbSrcCopy
End Sub
Public Sub Blit15(Buffer() As Integer, ByRef pic As PictureBox, imagewidth As Long, imageheight As Long)
If imagewidth = 0 Or imageheight = 0 Then Exit Sub
Dim bi As BITMAPINFO
With bi.bmiHeader
.biWidth = imagewidth
.biHeight = -imageheight
.biSize = 40
.biBitCount = 16
.biPlanes = 1
End With
If pic.ScaleMode <> 3 Then pic.ScaleMode = 3
StretchDIBits pic.hdc, 0, 0, pic.ScaleWidth, pic.ScaleHeight, 0, 0, imagewidth, imageheight, Buffer(0), bi, 0, vbSrcCopy
End Sub
Public Function Colour15To24(ByVal ColourData As Integer) As Long
Dim R As Byte, G As Byte, B As Byte
R = ((ColourData And 31) / 31) * &HFF
G = (((ColourData \ 32) And 31) / 31) * &HFF
B = (((ColourData \ 1024) And 31) / 31) * &HFF
Colour15To24 = CLng(B) + (256 * CLng(G)) + (65536 * CLng(R))
End Function
Public Function Colour15To24RGB(ByVal ColourData As Integer) As Long
Dim R As Byte, G As Byte, B As Byte
R = ((ColourData And 31) / 31) * &HFF
G = (((ColourData \ 32) And 31) / 31) * &HFF
B = (((ColourData \ 1024) And 31) / 31) * &HFF
Colour15To24RGB = CLng(R) + (256 * CLng(G)) + (65536 * CLng(B))
End Function
Public Function FileExists(sFileName As String) As Boolean
If Len(sFileName$) = 0 Then
FileExists = False
Exit Function
End If
If Len(Dir$(sFileName$)) Then
FileExists = True
Else
FileExists = False
End If
End Function