Initial commit

This commit is contained in:
Brandon Scott 2015-06-29 21:08:19 -05:00
parent ae30afb16b
commit 0566ecfdd7
16 changed files with 3561 additions and 0 deletions

169
About.dfm Normal file
View File

@ -0,0 +1,169 @@
object AboutDialog: TAboutDialog
Left = 0
Top = 0
BorderIcons = [biSystemMenu, biMinimize]
BorderStyle = bsSingle
Caption = 'About'
ClientHeight = 255
ClientWidth = 417
Color = clBtnFace
Font.Charset = DEFAULT_CHARSET
Font.Color = clWindowText
Font.Height = -11
Font.Name = 'Tahoma'
Font.Style = []
OldCreateOrder = False
PixelsPerInch = 96
TextHeight = 13
object Shape1: TShape
Left = 64
Top = 0
Width = 353
Height = 216
Pen.Color = clWhite
end
object Bevel1: TBevel
Left = 0
Top = 216
Width = 417
Height = 2
end
object Shape2: TShape
Left = 0
Top = 0
Width = 65
Height = 217
Brush.Color = clRed
Pen.Color = clSkyBlue
Pen.Style = psClear
Pen.Width = 0
end
object AppNameLabel: TLabel
Left = 72
Top = 8
Width = 46
Height = 13
Caption = 'RedMap'
Color = clWhite
Font.Charset = ANSI_CHARSET
Font.Color = clWindowText
Font.Height = -11
Font.Name = 'Tahoma'
Font.Style = [fsBold]
ParentColor = False
ParentFont = False
Transparent = False
end
object Label1: TLabel
Left = 72
Top = 192
Width = 271
Height = 13
Caption = 'Joint effort by Xeon, Koolboyman, and BlueSonic'
Color = clWhite
Font.Charset = DEFAULT_CHARSET
Font.Color = clWindowText
Font.Height = -11
Font.Name = 'Tahoma'
Font.Style = [fsBold]
ParentColor = False
ParentFont = False
end
object VersionLabel: TLabel
Left = 72
Top = 24
Width = 79
Height = 13
Caption = 'Version 2.0 Beta'
Color = clWhite
ParentColor = False
end
object Image1: TImage
Left = 16
Top = 16
Width = 32
Height = 32
Picture.Data = {
055449636F6E0000010002001010100000000000280100002600000020201000
00000000E80200004E0100002800000010000000200000000100040000000000
C000000000000000000000001000000000000000000000000000800000800000
00808000800000008000800080800000C0C0C000808080000000FF0000FF0000
00FFFF00FF000000FF00FF00FFFF0000FFFFFF000000000000000000000F7000
000F7000880F7088880F7088880F7088880F70880000000000000000FFFFFFFF
FFFFFFFFF888888FF888888FFFFFFFFFFFFFFFFF0FFF00FF0F0FF00F00FF0F0F
0F0F00FF0F0F0F0F00FF0F0F0F0F0F0F0F0F000F00FFF00F0F0FF0FF77777777
7777770700000000000000007777777777777777E7E7FFFF0000FFFF0000FFFF
0000FFFF0000FFFF0000FFFF0000FFFF0000FFFF0000FFFF0000FFFF0000FFFF
0000FFFF0000FFFF0000FFFF0000FFFF0000FFFF280000002000000040000000
0100040000000000800200000000000000000000100000000000000000000000
000080000080000000808000800000008000800080800000C0C0C00080808000
0000FF0000FF000000FFFF00FF000000FF00FF00FFFF0000FFFFFF0000000000
000000000000000000000000000F7000000F70000000000000000000880F7088
880F70888888888887000000880F7088880F7088888888888700000000000000
000000007777777777000000FFFFFFFFFFFFFFFFFFFFFFFFFF000000F888888F
F888888F77777777FF000000FFFFFFFFFFFFFFFF77777777770000000FFF00FF
0F0FF00FF777778FFF00000000FF0F0F0F0F00FFFFFFFFFFFF0000000F0F0F0F
00FF0F0F778F7777FF0000000F0F0F0F0F0F000F778F7777FF00000000FFF00F
0F0FF0FFFFFFFFFFFF00000077777777777777077777778FFF00000000000000
000000007777778FFF0000007777777777777777FFFFFFFFFF000000F777778F
F777778FF777778FFF000000FFFFFFFFFFFFFFFFFFFFFFFFFF000000778F7777
778F7777778F7777FF000000778F7777778F7777778F7777FF000000FFFFFFFF
FFFFFFFFFFFFFFFFFF0000007777778F7777778F7777778FFF0000007777778F
7777778F7777778FFF000000FFFFFFFFFFFFFFFFFFFFFFFFFF00000080000008
8000000880000008FF00000007F8F88007F8F88007F8F880FF0000000F7F8780
0F7F87800F7F8780FF0000000FF7F8F00FF7F8F00FF7F8F0FF0000000FFF7F80
0FFF7F800FFF7F80FF0000000FFFF7F00FFFF7F00FFFF7F0FF00000080000008
8000000880000008FF000000777777777777777777777777FF000000E7E7FFFF
0000003F0000001F0000001F0000001F0000001F0000001F0000001F0000001F
0000001F0000001F0000001F0000001F0000001F0000001F0000001F0000001F
0000001F0000001F0000001F0000001F0000001F0000001F0000001F0000001F
0000001F0000001F0000001F0000001F0000001F0000001F0000001F0D0A}
end
object Button1: TButton
Left = 336
Top = 224
Width = 75
Height = 23
Cancel = True
Caption = 'OK'
Default = True
ModalResult = 1
TabOrder = 0
end
object Memo1: TMemo
Left = 72
Top = 48
Width = 337
Height = 137
BorderStyle = bsNone
Lines.Strings = (
'Special thanks to BlueSonic (aka Jigglypuff) for letting me use '
'some of GoldMap to forge this frankenstein of a program. And '
'for putting up with all my questions regarding Delphi.'
''
'Koolboyman for the immense amount of data and information you '
'provided me. '
''
'Tauwasser for showing me how the warp-to points, connection '
'data, and ram addresses where calculated. '
''
'And also, tons of respect to the author of ZeroMap, you where '
'my inspiration for how to go about displaying the connected '
'maps.'
''
'This program is not endorsed or supported by Nintendo, and the '
'author is not affiliated with any other corporate entity.'
''
'This program is Freeware and provided "as is". The author '
'cannot be held liable for damages any kind arising from it'#39's use' +
' or '
'presence.'
''
'Pok'#233'mon is copyright of '#169'1995-2005 '
'Nintendo/Creatures Inc./GAME FREAK Inc.')
ReadOnly = True
ScrollBars = ssVertical
TabOrder = 1
end
end

33
About.pas Normal file
View File

@ -0,0 +1,33 @@
unit About;
interface
uses
Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
Dialogs, StdCtrls, pngimage, ExtCtrls;
type
TAboutDialog = class(TForm)
Shape1: TShape;
Bevel1: TBevel;
Shape2: TShape;
AppNameLabel: TLabel;
Label1: TLabel;
VersionLabel: TLabel;
Image1: TImage;
Button1: TButton;
Memo1: TMemo;
private
{ Private declarations }
public
{ Public declarations }
end;
var
AboutDialog: TAboutDialog;
implementation
{$R *.dfm}
end.

BIN
BlockEditor.dfm Normal file

Binary file not shown.

160
BlockEditor.pas Normal file
View File

@ -0,0 +1,160 @@
//******************************************************************************
//GoldMap
//by BlueSonic (aka Jigglypuff)
//******************************************************************************
unit BlockEditor;
interface
uses
SysUtils, Controls, Classes, Forms, StdCtrls, ExtCtrls, Graphics;
type
TBlockEditorForm = class(TForm)
ScrollBox1: TScrollBox;
TileLabel: TLabel;
BlockLabel: TLabel;
UpdateButton: TButton;
AddressLabel: TLabel;
BlockEditBox: TImage;
BlockBox: TPaintBox;
TilePalette: TImage;
procedure FormCreate(Sender: TObject);
procedure BlockBoxMouseMove(Sender: TObject; Shift: TShiftState; X,Y: Integer);
procedure BlockBoxMouseDown(Sender: TObject; Button: TMouseButton;Shift: TShiftState; X, Y: Integer);
procedure LoadTile;
procedure SaveTile;
procedure UpdateTile;
procedure TilePaletteMouseMove(Sender: TObject; Shift: TShiftState; X, Y: Integer);
procedure TilePaletteMouseDown(Sender: TObject; Button: TMouseButton; Shift: TShiftState; X, Y: Integer);
procedure BlockEditBoxMouseDown(Sender: TObject; Button: TMouseButton; Shift: TShiftState; X, Y: Integer);
procedure UpdateButtonClick(Sender: TObject);
procedure BlockBoxPaint(Sender: TObject);
procedure BlockEditBoxMouseMove(Sender: TObject; Shift: TShiftState; X,
Y: Integer);
public
BlockStart,SelTile,TileNumber : Integer;
BlockData: array [0..15] of Byte;
end;
implementation
uses MapEditor;
{$R *.DFM}
procedure TBlockeditorForm.LoadTile;
begin
Rom.Position := BlockStart;
//loads block
Rom.Read(BlockData, SizeOf(BlockData));
end;
procedure TBlockeditorForm.SaveTile;
begin
Rom.Position := BlockStart;
//Saves block
Rom.Write(BlockData, SizeOf(BlockData));
end;
procedure TBlockeditorForm.UpdateTile;
var
X,Y,I: Integer;
TileX, TileY, TileNumber: Byte;
begin
I := 0;
//draws tiles into block
for Y := 0 to 3 do
for X := 0 to 3 do
begin
TileNumber := BlockData[I];
//calculate x and y coordinate where to copy tile from, the tileset picture has 16 tiles per line
TileY := TileNumber div 16;
TileX := TileNumber mod 16;
//draw tile to block picture
BlockEditBox.Picture.Bitmap.Canvas.CopyRect(Rect(X*8,Y*8,X*8+8,Y*8+8),Tiles.Canvas,Rect(TileX*8,TileY*8,TileX*8+8,TileY*8+8));
Inc(I);
end;
end;
procedure TBlockEditorForm.FormCreate(Sender: TObject);
begin
//create block bitmap
BlockEditBox.Picture.Bitmap := TBitmap.Create;
BlockEditBox.Picture.Bitmap.Height := 32;
BlockEditBox.Picture.Bitmap.Width := 32;
BlockEditBox.Picture.Bitmap.PixelFormat := pf24bit;
//initalize other stuff
//BlockBox.Picture.Bitmap := MainForm.BlockPalette.Picture.Bitmap;
BlockBox.Height := MapEditorForm.BlockPalette.Height;
TilePalette.Picture.Graphic := Tiles;
//TilePalette.Height := Tiles.Height;
Caption := 'Block Editor - Tileset ' + IntToStr(LoadedTileset);
BlockStart := TilesetStart;
LoadTile;
UpdateTile;
end;
procedure TBlockEditorForm.BlockBoxMouseMove(Sender: TObject; Shift: TShiftState; X, Y: Integer);
begin
BlockLabel.Caption := 'Block: $' + IntToHex(Y div 32, 2);
AddressLabel.Caption := 'Offset: $' + IntToHex(TilesetStart + ((Y div 32) * 16), 2);
end;
procedure TBlockEditorForm.BlockBoxMouseDown(Sender: TObject; Button: TMouseButton; Shift: TShiftState; X, Y: Integer);
begin
BlockStart := TilesetStart + ((Y div 32) * 16);
TileNumber := Y div 32;
LoadTile;
UpdateTile;
end;
procedure TBlockEditorForm.TilePaletteMouseMove(Sender: TObject; Shift: TShiftState; X, Y: Integer);
begin
TileLabel.Caption := 'Tile: $' + IntToHex((X div 8) + ((Y div 8) * 8), 2);
end;
procedure TBlockEditorForm.TilePaletteMouseDown(Sender: TObject; Button: TMouseButton; Shift: TShiftState; X, Y: Integer);
begin
//gets tile where cursor is
SelPic := (X div 8) + ((Y div 8) * 8);
end;
procedure TBlockEditorForm.BlockEditBoxMouseDown(Sender: TObject; Button: TMouseButton; Shift: TShiftState; X, Y: Integer);
begin
if Button = mbLeft then
begin
//puts selected tile into block
BlockData[(X div 8) + ((Y div 8) * 4)] := SelPic;
UpdateTile;
end
else
begin
SelPic := BlockData[(X div 8) + ((Y div 8) * 4)];
end;
end;
procedure TBlockEditorForm.UpdateButtonClick(Sender: TObject);
begin
SaveTile;
//draws edited tile into tileset
BlockPics[TileNumber].Canvas.Draw(0, 0, BlockEditBox.Picture.Bitmap);
//update block palette
MapEditorForm.DrawBlocks(MapEditorForm.BlockPalette.Canvas);
MapEditorForm.DrawBlocks(BlockBox.Canvas);
MapEditorForm.DrawMap(MapEditorForm.MapBox.Canvas);
RomModified := True;
end;
procedure TBlockEditorForm.BlockBoxPaint(Sender: TObject);
begin
MapEditorForm.DrawBlocks(BlockBox.Canvas);
end;
procedure TBlockEditorForm.BlockEditBoxMouseMove(Sender: TObject;
Shift: TShiftState; X, Y: Integer);
begin
TileLabel.Caption := 'Tile: $' + IntToHex(BlockData[(X div 8) + ((Y div 8) * 4)], 2);
end;
end.

128
Map.pas Normal file
View File

@ -0,0 +1,128 @@
unit Map;
interface
uses ComCtrls,SysUtils,Dialogs,Classes;
type
TConnectionData = packed record
MapNumber: Byte;
MapDataPointer: Word;
MapLocationRamPointer: Word;
WidthHeightVisiblePart: Byte;
YChangePoint: Byte;
XChangePoint: Byte;
Unknown: Byte;
UnknownPointer: Word;
end;
//Header 1
TMapHeader = packed record
TilesetNumber: Byte;
Height: Byte;
Width: Byte;
DataPointer: Word;
ObjectScriptPointers: Word;
LevelScriptPointer: Word;
ConnectionDataControl: Byte;
ConnectionData: array [$00..$03] of TConnectionData;
ObjectDataPointer: Word;
BorderBlock: Byte;
end;
const
Ln = #13#10;
//table needed for encoding area names
Table: array [$00..$FF] of string[4] = (
{ 0 1 2 3 4 5 6 7 8 9 A B C D E F }
{0}'#' ,'#' ,'#' ,'#' ,'#' ,'#' ,'#' ,'#' ,'#' ,'#' ,'#' ,'#' ,'#' ,'#' ,'#' ,'#' ,
{1}'#' ,'#' ,'#' ,'#' ,'#' ,'#' ,'#' ,'#' ,'#' ,'#' ,'#' ,'#' ,'#' ,'#' ,'#' ,' ' ,
{2}'#' ,'#' ,'#' ,'#' ,'#' ,'#' ,'#' ,'#' ,'#' ,'#' ,'#' ,'#' ,'#' ,'#' ,'#' ,'#' ,
{3}'#' ,'#' ,'#' ,'#' ,'#' ,'#' ,'#' ,'#' ,'#' ,'#' ,'#' ,'#' ,'#' ,'#' ,'#' ,'#' ,
{4}'#' ,'#' ,'#' ,'#' ,'#' ,'#' ,'#' ,'#' ,'#' ,'#' ,'#' ,'#' ,'#' ,'#' ,'#' ,Ln ,
{5}'#' ,Ln+Ln ,'HIRO','GARY','POKé',Ln ,'#' ,'#' ,'#' ,'#' ,'#' ,'#' ,'#' ,'#' ,'#' ,'#' ,
{6}'#' ,'#' ,'#' ,'#' ,'#' ,'#' ,'#' ,'#' ,'#' ,'#' ,'#' ,'#' ,'#' ,'#' ,'#' ,'#' ,
{7}'#' ,'#' ,'#' ,'#' ,'#' ,'…' ,'#' ,'#' ,'#' ,'#' ,'#' ,'#' ,'#' ,'#' ,'#' ,' ' ,
{8}'A' ,'B' ,'C' ,'D' ,'E' ,'F' ,'G' ,'H' ,'I' ,'J' ,'K' ,'L' ,'M' ,'N' ,'O' ,'P' ,
{9}'Q' ,'R' ,'S' ,'T' ,'U' ,'V' ,'W' ,'X' ,'Y' ,'Z' ,'#' ,'#' ,':' ,'#' ,'#' ,'#' ,
{A}'a' ,'b' ,'c' ,'d' ,'e' ,'f' ,'g' ,'h' ,'i' ,'j' ,'k' ,'l' ,'m' ,'n' ,'o' ,'p' ,
{B}'q' ,'r' ,'s' ,'t' ,'u' ,'v' ,'w' ,'x' ,'y' ,'z' ,'#' ,'#' ,'#' ,'#' ,'#' ,'#' ,
{C}'#' ,'#' ,'#' ,'#' ,'#' ,'#' ,'#' ,'#' ,'#' ,'#' ,'#' ,'#' ,'#' ,'#' ,'#' ,'#' ,
{D}'#' ,'''l' ,'''m' ,'''r' ,'''s' ,'''t' ,'''v' ,'#' ,'#' ,'#' ,'#' ,'#' ,'#' ,'#' ,'#' ,'#' ,
{E}'''' ,'#' ,'#' ,'-' ,'#' ,'#' ,'?' ,'!' ,'.' ,'#' ,'#' ,'#' ,'#' ,'#' ,'#' ,'#' ,
{F}'#' ,' ' ,'#' ,'#' ,',' ,'#' ,'0' ,'1' ,'2' ,'3' ,'4' ,'5' ,'6' ,'7' ,'8' ,'9'
);
function GBPtrToFilePos(Bank: Byte; Addr: Word): Integer; overload;
function GBBank(Position: Integer): Byte;
procedure ReadMapHeaderLocations;
function GetMapHeader(MapIndex: Byte): TMapHeader;
var
AreaNames: TStringList;
BankLocations: array [$00..$F9] of Byte;
MapHeaderOffsets: array [$00..$F9] of Word;
implementation
uses MapEditor;
//converts rombank and, address in that bank, into romfile offset
function GBPtrToFilePos(Bank: Byte; Addr: Word): Integer; overload;
begin
Result := (Bank * $4000) + (Addr xor $4000);
end;
//gives gameboy rombank number ar specified file offset
function GBBank(Position: Integer): Byte;
begin
Result := (Position div $4000);
end;
procedure ReadMapHeaderLocations;
begin
Rom.Position := $C23D;
Rom.Read(BankLocations, $F9);
Rom.Position := $01AE;
Rom.Read(MapHeaderOffsets, $F9 * sizeof(Word));
end;
function GetMapHeader(MapIndex: Byte): TMapHeader;
var
TempHeader: TMapHeader;
begin
Rom.Position := GBPtrToFilePos(BankLocations[MapIndex], MapHeaderOffsets[MapIndex]);
Rom.Read(TempHeader.TilesetNumber, 1);
Rom.Read(TempHeader.Height, 1);
Rom.Read(TempHeader.Width, 1);
Rom.Read(TempHeader.DataPointer, 2);
Rom.Read(TempHeader.ObjectScriptPointers, 2);
Rom.Read(TempHeader.LevelScriptPointer, 2);
Rom.Read(TempHeader.ConnectionDataControl, 1);
if (TempHeader.ConnectionDataControl and $08) = $08 then
Rom.Read(TempHeader.ConnectionData[0], SizeOf(TConnectionData));
if (TempHeader.ConnectionDataControl and $04) = $04 then
Rom.Read(TempHeader.ConnectionData[1], SizeOf(TConnectionData));
if (TempHeader.ConnectionDataControl and $02) = $02 then
Rom.Read(TempHeader.ConnectionData[2], SizeOf(TConnectionData));
if (TempHeader.ConnectionDataControl and $01) = $01 then
Rom.Read(TempHeader.ConnectionData[3], SizeOf(TConnectionData));
Rom.Read(TempHeader.ObjectDataPointer, 2);
Rom.Position := GBPtrToFilePos(BankLocations[MapIndex],
TempHeader.ObjectDataPointer);
Rom.Read(TempHeader.BorderBlock, 1);
Result := TempHeader;
end;
end.

BIN
MapEditor.ddp Normal file

Binary file not shown.

1475
MapEditor.dfm Normal file

File diff suppressed because it is too large Load Diff

1151
MapEditor.pas Normal file

File diff suppressed because it is too large Load Diff

30
Misc.pas Normal file
View File

@ -0,0 +1,30 @@
unit Misc;
interface
uses Windows, Sysutils;
procedure DebugString(aCaption, aText: string);
implementation
// GetFormatDT - Output = formated DateTime String
function GetFormatDT(aDateTime: TDateTime): string;
begin
Result := FormatDateTime('dd.mm.yy hh:nn:ss zzz', aDateTime);
end;
// GetFormatT - Output = formated Time String
function GetFormatT(aDateTime: TDateTime): string;
begin
Result := FormatDateTime('hh:nn:ss zzz', aDateTime)
end;
procedure DebugString(aCaption, aText: string);
begin
OutputDebugString(PChar(Format('[%s][%s] %s',
[aCaption, GetFormatDT(Now()),
aText])));
end;
end.

BIN
Pokémap.ico Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.1 KiB

170
RedMap.bdsproj Normal file
View File

@ -0,0 +1,170 @@
<?xml version="1.0" encoding="utf-8"?>
<BorlandProject>
<PersonalityInfo>
<Option>
<Option Name="Personality">Delphi.Personality</Option>
<Option Name="ProjectType"></Option>
<Option Name="Version">1.0</Option>
<Option Name="GUID">{4AE37C7A-D69B-4E9A-8BBD-0A473BE787FC}</Option>
</Option>
</PersonalityInfo>
<Delphi.Personality>
<Source>
<Source Name="MainSource">RedMap.dpr</Source>
</Source>
<FileVersion>
<FileVersion Name="Version">7.0</FileVersion>
</FileVersion>
<Compiler>
<Compiler Name="A">8</Compiler>
<Compiler Name="B">0</Compiler>
<Compiler Name="C">1</Compiler>
<Compiler Name="D">1</Compiler>
<Compiler Name="E">0</Compiler>
<Compiler Name="F">0</Compiler>
<Compiler Name="G">1</Compiler>
<Compiler Name="H">1</Compiler>
<Compiler Name="I">1</Compiler>
<Compiler Name="J">0</Compiler>
<Compiler Name="K">0</Compiler>
<Compiler Name="L">1</Compiler>
<Compiler Name="M">0</Compiler>
<Compiler Name="N">1</Compiler>
<Compiler Name="O">1</Compiler>
<Compiler Name="P">1</Compiler>
<Compiler Name="Q">0</Compiler>
<Compiler Name="R">0</Compiler>
<Compiler Name="S">0</Compiler>
<Compiler Name="T">0</Compiler>
<Compiler Name="U">0</Compiler>
<Compiler Name="V">1</Compiler>
<Compiler Name="W">0</Compiler>
<Compiler Name="X">1</Compiler>
<Compiler Name="Y">1</Compiler>
<Compiler Name="Z">1</Compiler>
<Compiler Name="ShowHints">True</Compiler>
<Compiler Name="ShowWarnings">True</Compiler>
<Compiler Name="UnitAliases">WinTypes=Windows;WinProcs=Windows;DbiTypes=BDE;DbiProcs=BDE;DbiErrs=BDE;</Compiler>
<Compiler Name="NamespacePrefix"></Compiler>
<Compiler Name="GenerateDocumentation">False</Compiler>
<Compiler Name="DefaultNamespace"></Compiler>
<Compiler Name="SymbolDeprecated">True</Compiler>
<Compiler Name="SymbolLibrary">True</Compiler>
<Compiler Name="SymbolPlatform">True</Compiler>
<Compiler Name="SymbolExperimental">True</Compiler>
<Compiler Name="UnitLibrary">True</Compiler>
<Compiler Name="UnitPlatform">True</Compiler>
<Compiler Name="UnitDeprecated">True</Compiler>
<Compiler Name="UnitExperimental">True</Compiler>
<Compiler Name="HResultCompat">True</Compiler>
<Compiler Name="HidingMember">True</Compiler>
<Compiler Name="HiddenVirtual">True</Compiler>
<Compiler Name="Garbage">True</Compiler>
<Compiler Name="BoundsError">True</Compiler>
<Compiler Name="ZeroNilCompat">True</Compiler>
<Compiler Name="StringConstTruncated">True</Compiler>
<Compiler Name="ForLoopVarVarPar">True</Compiler>
<Compiler Name="TypedConstVarPar">True</Compiler>
<Compiler Name="AsgToTypedConst">True</Compiler>
<Compiler Name="CaseLabelRange">True</Compiler>
<Compiler Name="ForVariable">True</Compiler>
<Compiler Name="ConstructingAbstract">True</Compiler>
<Compiler Name="ComparisonFalse">True</Compiler>
<Compiler Name="ComparisonTrue">True</Compiler>
<Compiler Name="ComparingSignedUnsigned">True</Compiler>
<Compiler Name="CombiningSignedUnsigned">True</Compiler>
<Compiler Name="UnsupportedConstruct">True</Compiler>
<Compiler Name="FileOpen">True</Compiler>
<Compiler Name="FileOpenUnitSrc">True</Compiler>
<Compiler Name="BadGlobalSymbol">True</Compiler>
<Compiler Name="DuplicateConstructorDestructor">True</Compiler>
<Compiler Name="InvalidDirective">True</Compiler>
<Compiler Name="PackageNoLink">True</Compiler>
<Compiler Name="PackageThreadVar">True</Compiler>
<Compiler Name="ImplicitImport">True</Compiler>
<Compiler Name="HPPEMITIgnored">True</Compiler>
<Compiler Name="NoRetVal">True</Compiler>
<Compiler Name="UseBeforeDef">True</Compiler>
<Compiler Name="ForLoopVarUndef">True</Compiler>
<Compiler Name="UnitNameMismatch">True</Compiler>
<Compiler Name="NoCFGFileFound">True</Compiler>
<Compiler Name="ImplicitVariants">True</Compiler>
<Compiler Name="UnicodeToLocale">True</Compiler>
<Compiler Name="LocaleToUnicode">True</Compiler>
<Compiler Name="ImagebaseMultiple">True</Compiler>
<Compiler Name="SuspiciousTypecast">True</Compiler>
<Compiler Name="PrivatePropAccessor">True</Compiler>
<Compiler Name="UnsafeType">False</Compiler>
<Compiler Name="UnsafeCode">False</Compiler>
<Compiler Name="UnsafeCast">False</Compiler>
<Compiler Name="OptionTruncated">True</Compiler>
<Compiler Name="WideCharReduced">True</Compiler>
<Compiler Name="DuplicatesIgnored">True</Compiler>
<Compiler Name="UnitInitSeq">True</Compiler>
<Compiler Name="LocalPInvoke">True</Compiler>
<Compiler Name="MessageDirective">True</Compiler>
<Compiler Name="CodePage"></Compiler>
</Compiler>
<Linker>
<Linker Name="MapFile">0</Linker>
<Linker Name="OutputObjs">0</Linker>
<Linker Name="GenerateHpps">False</Linker>
<Linker Name="ConsoleApp">1</Linker>
<Linker Name="DebugInfo">False</Linker>
<Linker Name="RemoteSymbols">False</Linker>
<Linker Name="GenerateDRC">False</Linker>
<Linker Name="MinStackSize">16384</Linker>
<Linker Name="MaxStackSize">1048576</Linker>
<Linker Name="ImageBase">4194304</Linker>
<Linker Name="ExeDescription"></Linker>
</Linker>
<Directories>
<Directories Name="OutputDir"></Directories>
<Directories Name="UnitOutputDir"></Directories>
<Directories Name="PackageDLLOutputDir"></Directories>
<Directories Name="PackageDCPOutputDir"></Directories>
<Directories Name="SearchPath"></Directories>
<Directories Name="Packages">vcl;rtl;vclx;dbrtl;vcldb;VclSmp;xmlrtl;vclie;inet;inetdbbde;inetdbxpress;PNGLib;madBasic_;madDisAsm_;madExcept_</Directories>
<Directories Name="Conditionals"></Directories>
<Directories Name="DebugSourceDirs"></Directories>
<Directories Name="UsePackages">False</Directories>
</Directories>
<Parameters>
<Parameters Name="RunParams"></Parameters>
<Parameters Name="HostApplication"></Parameters>
<Parameters Name="Launcher"></Parameters>
<Parameters Name="UseLauncher">False</Parameters>
<Parameters Name="DebugCWD"></Parameters>
<Parameters Name="Debug Symbols Search Path"></Parameters>
<Parameters Name="LoadAllSymbols">True</Parameters>
<Parameters Name="LoadUnspecifiedSymbols">False</Parameters>
</Parameters>
<VersionInfo>
<VersionInfo Name="IncludeVerInfo">False</VersionInfo>
<VersionInfo Name="AutoIncBuild">False</VersionInfo>
<VersionInfo Name="MajorVer">1</VersionInfo>
<VersionInfo Name="MinorVer">0</VersionInfo>
<VersionInfo Name="Release">0</VersionInfo>
<VersionInfo Name="Build">0</VersionInfo>
<VersionInfo Name="Debug">False</VersionInfo>
<VersionInfo Name="PreRelease">False</VersionInfo>
<VersionInfo Name="Special">False</VersionInfo>
<VersionInfo Name="Private">False</VersionInfo>
<VersionInfo Name="DLL">False</VersionInfo>
<VersionInfo Name="Locale">1033</VersionInfo>
<VersionInfo Name="CodePage">1252</VersionInfo>
</VersionInfo>
<VersionInfoKeys>
<VersionInfoKeys Name="CompanyName"></VersionInfoKeys>
<VersionInfoKeys Name="FileDescription"></VersionInfoKeys>
<VersionInfoKeys Name="FileVersion">1.0.0.0</VersionInfoKeys>
<VersionInfoKeys Name="InternalName"></VersionInfoKeys>
<VersionInfoKeys Name="LegalCopyright"></VersionInfoKeys>
<VersionInfoKeys Name="LegalTrademarks"></VersionInfoKeys>
<VersionInfoKeys Name="OriginalFilename"></VersionInfoKeys>
<VersionInfoKeys Name="ProductName"></VersionInfoKeys>
<VersionInfoKeys Name="ProductVersion">1.0.0.0</VersionInfoKeys>
<VersionInfoKeys Name="Comments"></VersionInfoKeys>
</VersionInfoKeys>
</Delphi.Personality>
</BorlandProject>

132
RedMap.dof Normal file
View File

@ -0,0 +1,132 @@
[FileVersion]
Version=7.0
[Compiler]
A=8
B=0
C=1
D=1
E=0
F=0
G=1
H=1
I=1
J=0
K=0
L=1
M=0
N=1
O=1
P=1
Q=0
R=0
S=0
T=0
U=0
V=1
W=0
X=1
Y=1
Z=1
ShowHints=1
ShowWarnings=1
UnitAliases=WinTypes=Windows;WinProcs=Windows;DbiTypes=BDE;DbiProcs=BDE;DbiErrs=BDE;
NamespacePrefix=
SymbolDeprecated=1
SymbolLibrary=1
SymbolPlatform=1
UnitLibrary=1
UnitPlatform=1
UnitDeprecated=1
HResultCompat=1
HidingMember=1
HiddenVirtual=1
Garbage=1
BoundsError=1
ZeroNilCompat=1
StringConstTruncated=1
ForLoopVarVarPar=1
TypedConstVarPar=1
AsgToTypedConst=1
CaseLabelRange=1
ForVariable=1
ConstructingAbstract=1
ComparisonFalse=1
ComparisonTrue=1
ComparingSignedUnsigned=1
CombiningSignedUnsigned=1
UnsupportedConstruct=1
FileOpen=1
FileOpenUnitSrc=1
BadGlobalSymbol=1
DuplicateConstructorDestructor=1
InvalidDirective=1
PackageNoLink=1
PackageThreadVar=1
ImplicitImport=1
HPPEMITIgnored=1
NoRetVal=1
UseBeforeDef=1
ForLoopVarUndef=1
UnitNameMismatch=1
NoCFGFileFound=1
MessageDirective=1
ImplicitVariants=1
UnicodeToLocale=1
LocaleToUnicode=1
ImagebaseMultiple=1
SuspiciousTypecast=1
PrivatePropAccessor=1
UnsafeType=0
UnsafeCode=0
UnsafeCast=0
[Linker]
MapFile=0
OutputObjs=0
ConsoleApp=1
DebugInfo=0
RemoteSymbols=0
MinStackSize=16384
MaxStackSize=1048576
ImageBase=4194304
ExeDescription=
[Directories]
OutputDir=
UnitOutputDir=
PackageDLLOutputDir=
PackageDCPOutputDir=
SearchPath=
Packages=
Conditionals=
DebugSourceDirs=
UsePackages=0
[Parameters]
RunParams=
HostApplication=
Launcher=
UseLauncher=0
DebugCWD=
[Version Info]
IncludeVerInfo=0
AutoIncBuild=0
MajorVer=1
MinorVer=0
Release=0
Build=0
Debug=0
PreRelease=0
Special=0
Private=0
DLL=0
Locale=1033
CodePage=1252
[Version Info Keys]
CompanyName=
FileDescription=
FileVersion=1.0.0.0
InternalName=
LegalCopyright=
LegalTrademarks=
OriginalFilename=
ProductName=
ProductVersion=1.0.0.0
Comments=

20
RedMap.dpr Normal file
View File

@ -0,0 +1,20 @@
program RedMap;
uses
Forms,
MapEditor in 'MapEditor.pas' {MapEditorForm},
Tileset in 'Tileset.pas',
Map in 'Map.pas',
About in 'About.pas' {AboutDialog},
Misc in 'Misc.pas',
BlockEditor in 'BlockEditor.pas' {BlockEditorForm};
{$R *.res}
begin
Application.Initialize;
Application.Title := 'RedMap';
Application.CreateForm(TMapEditorForm, MapEditorForm);
Application.CreateForm(TAboutDialog, AboutDialog);
Application.Run;
end.

BIN
RedMap.res Normal file

Binary file not shown.

93
Tileset.pas Normal file
View File

@ -0,0 +1,93 @@
unit Tileset;
interface
uses Map, Classes, Dialogs, SysUtils, Graphics;
type
TTilesetHeader = packed record
BankNumber: Byte;
TilesetArrangementPointer: Word;
TilesetGraphicsPointer: Word;
UnknownData: array [0..6] of Byte;
end;
var
//Palette: array [0..3] of TColor = (clWhite,clLtGray,clDkGray,clBlack);
//Palette: array [0..3] of TColor = ($F8E8F8, $A8E058, $A0D0F8, $181010);
Palette: array [0..3] of TColor = ($F8E8F8, $58E0A8, $F8D0A0, $101018);
RawMapPalettes: array [0..12, 0..3] of Word;
const Zero: Byte = 0;
function GetTilesetHeader(TilesetNumber: Byte): TTilesetHeader;
function WordToColor(Value: Word): TColor;
procedure ReadTilesetGraphics(TilesetHeader: TTilesetHeader; Bmp: TBitmap);
procedure ReadMapPallets;
implementation
uses MapEditor;
function GetTilesetHeader(TilesetNumber: Byte): TTilesetHeader;
begin
Rom.Position := $C7BE + ((TilesetNumber) * SizeOf(TTilesetHeader));
Rom.Read(Result, SizeOf(TTilesetHeader));
end;
function WordToColor(Value: Word): TColor;
var
R,G,B: Byte;
begin
R := Round((((Value shr 00) and 31) / 31) * 255);
G := Round((((Value shr 05) and 31) / 31) * 255);
B := Round((((Value shr 10) and 31) / 31) * 255);
Result := R or (G shl 8) or (B shl 16);
end;
//reads tile from Stream into Bmp and uses colors from Pal
procedure ReadTile(Stream: TStream; Bmp: TBitmap);
var
X,Y: Integer;
Data1,Data2: Byte;
begin
for Y := 0 to 7 do
begin
Stream.Read(Data1,1);
Stream.Read(Data2,1);
for X := 0 to 7 do
Bmp.Canvas.Pixels[X,Y] := Palette[((Data1 shr (7-X)) and 1) or (((Data2 shr (7-X)) and 1) shl 1)];
end;
end;
//reads tileset at specific address into Bmp
procedure ReadTilesetGraphics(TilesetHeader: TTilesetHeader; Bmp: TBitmap);
var
Tile: TBitmap;
TileCnt: Byte;
I: Integer;
begin
Tile := TBitmap.Create;
Tile.PixelFormat := pf24bit;
Tile.Width := 8;
Tile.Height := 8;
Rom.Position := GBPtrToFilePos(TilesetHeader.BankNumber, TilesetHeader.TilesetGraphicsPointer);
TileCnt := 0;
for I := 1 to 16 * 6 do
begin
ReadTile(Rom,Tile);
Bmp.Canvas.Draw((TileCnt mod 16) * 8, (TileCnt div 16) * 8, Tile);
Inc(TileCnt);
end;
end;
procedure ReadMapPallets;
begin
Rom.Position := $72660;
Rom.Read(RawMapPalettes, 8*12);
end;
end.

BIN
event-object.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.3 KiB