Skip to content

Commit

Permalink
add dc6 global OffsetY (hacky)
Browse files Browse the repository at this point in the history
  • Loading branch information
Your Name authored and Your Name committed Apr 14, 2023
1 parent dc4331f commit e818244
Show file tree
Hide file tree
Showing 4 changed files with 9 additions and 7 deletions.
4 changes: 2 additions & 2 deletions Common/Sprite.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -132,7 +132,7 @@ void Sprite::ReadDc6(const char* Path, const Palette& Pal, uint32_t Mask) {
#ifdef BMP_ALPHA
void Sprite::SaveDc6(const char* Path, const Palette& Pal) {
#else
void Sprite::SaveDc6(const char* Path, const Palette& Pal, uint32_t Mask) {
void Sprite::SaveDc6(const char* Path, const Palette& Pal, int32_t Dc6OffsetY, uint32_t Mask) {
#endif
Dc6Header Hdr;
Hdr.Version = Dc6HdrVer;
Expand All @@ -155,7 +155,7 @@ void Sprite::SaveDc6(const char* Path, const Palette& Pal, uint32_t Mask) {
Frm.Width = (uint32_t) Bmp.Width();
Frm.Height = (uint32_t) Bmp.Height();
Frm.OffsetX = 0;
Frm.OffsetY = 0;
Frm.OffsetY = Dc6OffsetY;
Frm.Unk = 0;
Offs[IDir][IFrm] = Cast<uint32_t>(File.Tell(), "The resulted DC6 file is too large (%zu bytes)", File.Size());
File.Advance(sizeof(Dc6FrameHeader));
Expand Down
6 changes: 3 additions & 3 deletions Common/Sprite.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -16,8 +16,8 @@ struct Dc6FrameHeader {
uint32_t Flip; // +00 - 1 if Flipped, 0 else
uint32_t Width; // +04
uint32_t Height; // +08
uint32_t OffsetX; // +0c
uint32_t OffsetY; // +10
int32_t OffsetX; // +0c
int32_t OffsetY; // +10
uint32_t Unk; // +14 - 0x00000000
uint32_t NextBlock; // +18
uint32_t Length; // +1c
Expand All @@ -35,7 +35,7 @@ class Sprite : public RcArray<Bitmap> {
void SaveDc6(const char* Path, const Palette& Pal);
#else
void ReadDc6(const char* Path, const Palette& Pal, uint32_t Mask = 0x000000);
void SaveDc6(const char* Path, const Palette& Pal, uint32_t Mask = 0x000000);
void SaveDc6(const char* Path, const Palette& Pal, int32_t Dc6OffsetY = 0, uint32_t Mask = 0x000000);
#endif
private:
using RcArray::NRow;
Expand Down
3 changes: 2 additions & 1 deletion D2MFC/Main.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -68,6 +68,7 @@ int main(int NArg, char* Args[]) {
auto PalPath = d["pal"].GetString();
auto Dc6Path = d["dc6name"].GetString();
auto TblPath = d["tblname"].GetString();
int32_t GlobalDc6OffsetY = d["Dc6OffsetY"].GetInt();

// Build a list with your free-to-waste RAM
vector<uint16_t> glyphlist;
Expand Down Expand Up @@ -119,7 +120,7 @@ int main(int NArg, char* Args[]) {
FontTable Tbl;
Fnt.Dump(Spr, Tbl);
printf("Saving DC6...\n");
Spr.SaveDc6(Dc6Path, Pal);
Spr.SaveDc6(Dc6Path, Pal, GlobalDc6OffsetY);
printf("Saving TBL...\n");
Tbl.SaveTbl(TblPath);
printf("All done\n");
Expand Down
3 changes: 2 additions & 1 deletion D2MFC/config.json
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,8 @@
"LeadingOffset": 1,
"CapHeight": 1,
"OriginOffset": 0,
"pal": "Resources\\act1-fechar.dat",
"Dc6OffsetY": 0,
"pal": "Resources\\static.dat",

"ranges": [
{"range": [0,255], "note":"Latin + Supp"},
Expand Down

0 comments on commit e818244

Please sign in to comment.