Skip to content

Commit

Permalink
1.1
Browse files Browse the repository at this point in the history
  • Loading branch information
cvghivebrain committed Sep 18, 2021
1 parent de35926 commit f4b4b17
Show file tree
Hide file tree
Showing 5 changed files with 43 additions and 5 deletions.
Binary file modified Generic.dcu
Binary file not shown.
19 changes: 18 additions & 1 deletion Generic.dfm
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
object Form1: TForm1
Left = 192
Top = 124
Caption = 'HiveSprite'
Caption = 'HiveSprite 1.1'
ClientHeight = 636
ClientWidth = 1289
Color = clBtnFace
Expand Down Expand Up @@ -91,6 +91,14 @@ object Form1: TForm1
Width = 73
Height = 73
end
object lblMapcountt: TLabel
Left = 207
Top = 139
Width = 59
Height = 38
Caption = 'Mapcount (0 for auto)'
WordWrap = True
end
object editROM: TLabeledEdit
Left = 8
Top = 32
Expand Down Expand Up @@ -289,6 +297,15 @@ object Form1: TForm1
TabOrder = 20
OnClick = btnSaveClick
end
object editMapcount: TEdit
Left = 143
Top = 139
Width = 58
Height = 21
TabStop = False
TabOrder = 21
Text = '0'
end
object dlgOpen: TOpenDialog
Left = 8
Top = 544
Expand Down
28 changes: 24 additions & 4 deletions Generic.pas
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ interface

uses
Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
Dialogs, StrUtils, ExtCtrls, StdCtrls, pngimage;
Dialogs, StrUtils, ExtCtrls, StdCtrls, pngimage, Math;

type
TForm1 = class(TForm)
Expand Down Expand Up @@ -32,6 +32,8 @@ TForm1 = class(TForm)
btnSave: TButton;
dlgSave: TSaveDialog;
img: TImage;
editMapcount: TEdit;
lblMapcountt: TLabel;
procedure editROMClick(Sender: TObject);
procedure editMapClick(Sender: TObject);
procedure editDPLCClick(Sender: TObject);
Expand Down Expand Up @@ -73,7 +75,7 @@ TForm1 = class(TForm)
PNG: TPNGImage;
formatlist: array[0..100] of string;
mapindex: array[0..255] of integer;
imgsize, spacing, bgcolor, mapcount, sprcount_size, spr_size, x_, x_size, x_mask,
imgsize, spacing, bgcolor, bgcolor2, mapcount, sprcount_size, spr_size, x_, x_size, x_mask,
y_, y_size, y_mask, dim_, dim_size, dim_mask, tile_, tile_size, tile_mask,
xflip_, xflip_size, xflip_mask, yflip_, yflip_size, yflip_mask,
palette_, palette_size, palette_mask, priority_, priority_size, priority_mask,
Expand Down Expand Up @@ -164,6 +166,7 @@ procedure TForm1.FormCreate(Sender: TObject);
begin
Application.Title := 'HiveSprite';
bgcolor := 0;
bgcolor2 := 0;
if not FileExists(ExtractFilePath(Application.ExeName)+'hivesprite.ini') then
begin
ShowMessage('ini file not found.');
Expand All @@ -183,6 +186,11 @@ procedure TForm1.FormCreate(Sender: TObject);
bgcolor := StrtoInt(Explode(s,'=',1)); // Get background colour.
bgcolor := (bgcolor shr 16)+(bgcolor and $FF00)+((bgcolor and $FF) shl 16); // Convert RBG to TColor BGR.
end
else if Explode(s,'=',0) = 'bgcolor2' then
begin
bgcolor2 := StrtoInt(Explode(s,'=',1)); // Get background colour.
bgcolor2 := (bgcolor2 shr 16)+(bgcolor2 and $FF00)+((bgcolor2 and $FF) shl 16); // Convert RBG to TColor BGR.
end
else
begin
menuMap.Items.Add(Explode(s,'=',0)); // Add mappings format.
Expand Down Expand Up @@ -313,7 +321,9 @@ procedure TForm1.btnViewClick(Sender: TObject);
imgsize := spacing*16;
PNG := TPNGImage.CreateBlank(COLOR_RGB,8,imgsize,imgsize); // Create PNG.
for i := 0 to (imgsize*imgsize)-1 do
PNG.Pixels[i mod imgsize,i div imgsize] := bgcolor; // Fill background.
if Odd((i mod imgsize) div spacing) xor Odd((i div imgsize) div spacing) then
PNG.Pixels[i mod imgsize,i div imgsize] := bgcolor // Fill background.
else PNG.Pixels[i mod imgsize,i div imgsize] := bgcolor2;
if (editROM.Text = '') or (editMap.Text = '') or (editPal1.Text = '') then // Check file fields.
begin
ShowMessage('Files not selected.');
Expand Down Expand Up @@ -361,7 +371,17 @@ procedure TForm1.btnViewClick(Sender: TObject);
// Mappings
for i := 0 to 255 do mapindex[i] := 0; // Clear mappings index.
maploc := StrtoInt(editMaploc.Text);
mapcount := GetM(maploc,2,$FFFF) div 2; // Assume 1st in index is 1st listed.
if editMapcount.Text = '0' then
mapcount := GetM(maploc,2,$FFFF) div 2 // Assume 1st in index is 1st listed.
else
begin
if TryStrtoInt(editMapcount.Text,i) = true then mapcount := Min(i,256) // Check number is valid, limited to 256.
else
begin
editMapcount.Text := '0';
mapcount := GetM(maploc,2,$FFFF) div 2;
end;
end;
for i := 0 to mapcount-1 do mapindex[i] := GetM(maploc+(i*2),2,$FFFF)+maploc; // Populate index.
for i := 0 to mapcount-1 do
begin
Expand Down
Binary file modified Project1.exe
Binary file not shown.
1 change: 1 addition & 0 deletions hivesprite.ini
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
bgcolor=$009900
bgcolor2=$007700
Sonic 1=1|5|4:1:$ff|0:1:$ff|1:1:$f|2:2:$7ff|2:1:8|2:1:$10|2:1:$60|2:1:$80|1|2|0:1:$f0|0:2:$fff
Sonic 2=2|8|6:2:$ffff|0:1:$ff|1:1:$f|2:2:$7ff|2:1:8|2:1:$10|2:1:$60|2:1:$80|2|2|0:1:$f0|0:2:$fff

Expand Down

0 comments on commit f4b4b17

Please sign in to comment.