Complete pre-rendered cast roll + prepare separate files for belch and star master

This commit is contained in:
Lorenzo Carletti 2020-08-24 03:02:48 +02:00
parent 5c76e3beb2
commit 01765bde39
7 changed files with 243 additions and 81 deletions

Binary file not shown.

Binary file not shown.

View File

@ -1875,6 +1875,14 @@ m2_coord_table_file:
m2_credits_conversion_table: m2_credits_conversion_table:
.incbin "data/m2-credits-conversion-table.bin" .incbin "data/m2-credits-conversion-table.bin"
.align 4
m2_cast_belch_arrangement:
.incbin "data/cast_roll_master_belch_arrangement.bin"
.align 4
m2_cast_star_arrangement:
.incbin "data/cast_roll_star_master_arrangement.bin"
.align 2 .align 2
m2_cast_vwf_free: m2_cast_vwf_free:
.incbin "data/cast_roll_first_free.bin" .incbin "data/cast_roll_first_free.bin"

View File

@ -70,9 +70,20 @@ namespace RenderCastRoll
for (int i = 0; i < renders.Count; i++) for (int i = 0; i < renders.Count; i++)
{ {
int pos = buffers[i].startPos + 1 + (renders[i].Y * 0x20); //The + 1 is here because the scene's map starts from tile 1. Not tile 0 int pos = buffers[i].startPos + 1 + (renders[i].Y * 0x20); //The + 1 is here because the scene's map starts from tile 1. Not tile 0
for (int j = 0; j < buffers[i].used; j++) if (renders[i].Separate_file_name == "")
for(int k = 0; k < WritingBuffer.yLength; k++) for (int j = 0; j < buffers[i].used; j++)
Arrangements[pos + j + (k * 0x20)] = buffers[i].arrangements[k, j]; for (int k = 0; k < WritingBuffer.yLength; k++)
Arrangements[pos + j + (k * 0x20)] = buffers[i].arrangements[k, j];
else
{
//This is an arrangement that changes when the game is running. Set the starting arrangements to empty
for (int j = 0; j < buffers[i].used; j++)
for (int k = 0; k < WritingBuffer.yLength; k++)
Arrangements[pos + j + (k * 0x20)] = 0x3FF; //Empty tile
//Save this in an external file
File.WriteAllBytes(dataFolder + "cast_roll_" + renders[i].Separate_file_name + "_arrangement.bin", prepareSeparateRender(buffers[i]));
}
} }
//Convert the 1bpp tiles to 4bpp //Convert the 1bpp tiles to 4bpp
@ -96,6 +107,19 @@ namespace RenderCastRoll
File.WriteAllBytes(dataFolder + "cast_roll_arrangements_[c].bin", GBA.LZ77.Compress(convertUShortArrToByteArrLE(Arrangements))); File.WriteAllBytes(dataFolder + "cast_roll_arrangements_[c].bin", GBA.LZ77.Compress(convertUShortArrToByteArrLE(Arrangements)));
} }
static byte[] prepareSeparateRender(WritingBuffer buf)
{
//Converts the arrangements to an array that contains the arrangements starting position, the length and the arrangements themselves
byte[] newArr = new byte[8 + (WritingBuffer.yLength * buf.used * 2)];
writeIntToByteArrLE(newArr, 0, buf.startPos + 1); //The + 1 is needed because the map starts from 1, not from 0
writeIntToByteArrLE(newArr, 4, buf.used);
for (int j = 0; j < WritingBuffer.yLength; j++)
for (int i = 0; i < buf.used; i++)
writeUShortToByteArrLE(newArr, 8 + ((i + (j * buf.used)) * 2), buf.arrangements[j, i]);
return newArr;
}
static int readIntLE(byte[] arr, int pos) static int readIntLE(byte[] arr, int pos)
{ {
return arr[pos] + (arr[pos + 1] << 8) + (arr[pos + 2] << 16) + (arr[pos + 3] << 24); return arr[pos] + (arr[pos + 1] << 8) + (arr[pos + 2] << 16) + (arr[pos + 3] << 24);
@ -106,6 +130,18 @@ namespace RenderCastRoll
return (ushort)(arr[pos] + (arr[pos + 1] << 8)); return (ushort)(arr[pos] + (arr[pos + 1] << 8));
} }
static void writeIntToByteArrLE(byte[] arr, int pos, int val)
{
for (int i = 0; i < 4; i++)
arr[pos + i] = (byte)((val >> (i * 8)) & 0xFF);
}
static void writeUShortToByteArrLE(byte[] arr, int pos, ushort val)
{
for (int i = 0; i < 2; i++)
arr[pos + i] = (byte)((val >> (i * 8)) & 0xFF);
}
static byte[] convertUShortToByteArrLE(ushort val) static byte[] convertUShortToByteArrLE(ushort val)
{ {
byte[] newArr = new byte[2]; byte[] newArr = new byte[2];

View File

@ -10,6 +10,7 @@ namespace RenderCastRoll
public int Center_X { get; set; } public int Center_X { get; set; }
public string Text { get; set; } public string Text { get; set; }
public int Font { get; set; } public int Font { get; set; }
public string Separate_file_name { get; set; }
} }
public class RenderRoot public class RenderRoot

View File

@ -4,241 +4,358 @@
"Y":16, "Y":16,
"Center_X":120, "Center_X":120,
"Text":"Picky Minch", "Text":"Picky Minch",
"Font": 0 "Font": 0,
"Separate_file_name": ""
}, },
{ {
"Y":24, "Y":24,
"Center_X":64, "Center_X":64,
"Text":"Lardna Minch", "Text":"Lardna Minch",
"Font": 0 "Font": 0,
"Separate_file_name": ""
}, },
{ {
"Y":24, "Y":24,
"Center_X":176, "Center_X":176,
"Text":"Aloysius Minch", "Text":"Aloysius Minch",
"Font": 0 "Font": 0,
"Separate_file_name": ""
}, },
{ {
"Y":32, "Y":32,
"Center_X":120, "Center_X":120,
"Text":"Pokey Minch", "Text":"Pokey Minch",
"Font": 0 "Font": 0,
"Separate_file_name": ""
}, },
{ {
"Y":42, "Y":42,
"Center_X":120, "Center_X":120,
"Text":"Buzz Buzz", "Text":"Buzz Buzz",
"Font": 0 "Font": 0,
"Separate_file_name": ""
}, },
{ {
"Y":51, "Y":51,
"Center_X":120, "Center_X":120,
"Text":"Lier`X.`Agerate", "Text":"Lier`X.`Agerate",
"Font": 0 "Font": 0,
"Separate_file_name": ""
}, },
{ {
"Y":62, "Y":62,
"Center_X":120, "Center_X":120,
"Text":"Frank Fly", "Text":"Frank Fly",
"Font": 0 "Font": 0,
"Separate_file_name": ""
}, },
{ {
"Y":71, "Y":71,
"Center_X":120, "Center_X":120,
"Text":"The Sharks", "Text":"The Sharks",
"Font": 0 "Font": 0,
"Separate_file_name": ""
}, },
{ {
"Y":82, "Y":82,
"Center_X":120, "Center_X":120,
"Text":"B. H. Pirkle", "Text":"B. H. Pirkle",
"Font": 0 "Font": 0,
"Separate_file_name": ""
}, },
{ {
"Y":93, "Y":93,
"Center_X":120, "Center_X":120,
"Text":"Captain Strong", "Text":"Captain Strong",
"Font": 0 "Font": 0,
"Separate_file_name": ""
}, },
{ {
"Y":102, "Y":102,
"Center_X":120, "Center_X":120,
"Text":"Onett police force", "Text":"Onett police force",
"Font": 0 "Font": 0,
"Separate_file_name": ""
}, },
{ {
"Y":108, "Y":109,
"Center_X":120, "Center_X":120,
"Text":"[DOT]", "Text":"[DOT]",
"Font": 0 "Font": 0,
"Separate_file_name": ""
}, },
{ {
"Y":108, "Y":139,
"Center_X":120, "Center_X":120,
"Text":"Orange kid", "Text":"Orange kid",
"Font": 0 "Font": 0,
"Separate_file_name": ""
}, },
{ {
"Y":108, "Y":148,
"Center_X":120, "Center_X":120,
"Text":"Apple kid", "Text":"Apple kid",
"Font": 0 "Font": 0,
"Separate_file_name": ""
}, },
{ {
"Y":108, "Y":159,
"Center_X":120, "Center_X":120,
"Text":"Mr. Everdred", "Text":"Mr. Everdred",
"Font": 0 "Font": 0,
"Separate_file_name": ""
}, },
{ {
"Y":108, "Y":175,
"Center_X":120, "Center_X":120,
"Text":"Runaway Five", "Text":"Runaway Five",
"Font": 0 "Font": 0,
"Separate_file_name": ""
}, },
{ {
"Y":108, "Y":182,
"Center_X":120,
"Text":"[DOT]",
"Font": 0,
"Separate_file_name": ""
},
{
"Y":194,
"Center_X":120, "Center_X":120,
"Text":"Happy Happyists", "Text":"Happy Happyists",
"Font": 0 "Font": 0,
"Separate_file_name": ""
}, },
{ {
"Y":108, "Y":204,
"Center_X":120, "Center_X":120,
"Text":"Carpainter", "Text":"Carpainter",
"Font": 0 "Font": 0,
"Separate_file_name": ""
}, },
{ {
"Y":108, "Y":211,
"Center_X":120,
"Text":"[DOT]",
"Font": 0,
"Separate_file_name": ""
},
{
"Y":223,
"Center_X":120, "Center_X":120,
"Text":"Bubble Monkey", "Text":"Bubble Monkey",
"Font": 0 "Font": 0,
"Separate_file_name": ""
}, },
{ {
"Y":108, "Y":230,
"Center_X":120, "Center_X":64,
"Text":"Tony", "Text":"Tony",
"Font": 0 "Font": 0,
"Separate_file_name": ""
}, },
{ {
"Y":108, "Y":230,
"Center_X":120, "Center_X":176,
"Text":"Maxwell", "Text":"Maxwell",
"Font": 0 "Font": 0,
"Separate_file_name": ""
}, },
{ {
"Y":108, "Y":237,
"Center_X":120, "Center_X":120,
"Text":"Tessie", "Text":"Tessie",
"Font": 0 "Font": 0,
"Separate_file_name": ""
}, },
{ {
"Y":108, "Y":245,
"Center_X":120, "Center_X":120,
"Text":"Tessie-Watching Club", "Text":"Tessie-Watching Club",
"Font": 0 "Font": 0,
"Separate_file_name": ""
}, },
{ {
"Y":108, "Y":257,
"Center_X":120, "Center_X":120,
"Text":"Brickroad", "Text":"Brickroad",
"Font": 0 "Font": 0,
"Separate_file_name": ""
}, },
{ {
"Y":108, "Y":272,
"Center_X":120, "Center_X":80,
"Text":"Dr. Andonuts", "Text":"Dr. Andonuts",
"Font": 0 "Font": 0,
"Separate_file_name": ""
}, },
{ {
"Y":108, "Y":290,
"Center_X":120,
"Text":"[DOT]",
"Font": 0,
"Separate_file_name": ""
},
{
"Y":313,
"Center_X":120, "Center_X":120,
"Text":"mr.saturn", "Text":"mr.saturn",
"Font": 1 "Font": 1,
"Separate_file_name": ""
}, },
{ {
"Y":108, "Y":325,
"Center_X":120, "Center_X":120,
"Text":"Master Belch", "Text":"Master Belch",
"Font": 0 "Font": 0,
"Separate_file_name": "master_belch"
}, },
{ {
"Y":108, "Y":332,
"Center_X":120, "Center_X":120,
"Text":"George Montague", "Text":"[DOT]",
"Font": 0 "Font": 0,
"Separate_file_name": ""
}, },
{ {
"Y":108, "Y":344,
"Center_X":64,
"Text":"George Montague",
"Font": 0,
"Separate_file_name": ""
},
{
"Y":354,
"Center_X":120, "Center_X":120,
"Text":"Gerardo Montague", "Text":"Gerardo Montague",
"Font": 0 "Font": 0,
"Separate_file_name": ""
}, },
{ {
"Y":108, "Y":371,
"Center_X":120, "Center_X":120,
"Text":"Talah Rama", "Text":"Talah Rama",
"Font": 0 "Font": 0,
"Separate_file_name": ""
}, },
{ {
"Y":108, "Y":378,
"Center_X":120,
"Text":"[DOT]",
"Font": 0,
"Separate_file_name": ""
},
{
"Y":389,
"Center_X":120, "Center_X":120,
"Text":"Geldegarde Monotoli", "Text":"Geldegarde Monotoli",
"Font": 0 "Font": 0,
"Separate_file_name": ""
}, },
{ {
"Y":108, "Y":400,
"Center_X":120, "Center_X":120,
"Text":"Venus", "Text":"Venus",
"Font": 0 "Font": 0,
"Separate_file_name": ""
}, },
{ {
"Y":108, "Y":407,
"Center_X":120, "Center_X":120,
"Text":"Star Master", "Text":"[DOT]",
"Font": 0 "Font": 0,
"Separate_file_name": ""
}, },
{ {
"Y":108, "Y":429,
"Center_X":64,
"Text":"Star Master",
"Font": 0,
"Separate_file_name": "star_master"
},
{
"Y":438,
"Center_X":120,
"Text":"[DOT]",
"Font": 0,
"Separate_file_name": ""
},
{
"Y":457,
"Center_X":120, "Center_X":120,
"Text":"Dungeon Man", "Text":"Dungeon Man",
"Font": 0 "Font": 0,
"Separate_file_name": ""
}, },
{ {
"Y":108, "Y":457,
"Center_X":120, "Center_X":192,
"Text":"Noble warrior", "Text":"Noble warrior",
"Font": 0 "Font": 0,
"Separate_file_name": ""
}, },
{ {
"Y":108, "Y":464,
"Center_X":120,
"Text":"[DOT]",
"Font": 0,
"Separate_file_name": ""
},
{
"Y":474,
"Center_X":120, "Center_X":120,
"Text":"Tenda tribesmen", "Text":"Tenda tribesmen",
"Font": 0 "Font": 0,
"Separate_file_name": ""
}, },
{ {
"Y":108, "Y":481,
"Center_X":120,
"Text":"[DOT]",
"Font": 0,
"Separate_file_name": ""
},
{
"Y":497,
"Center_X":120, "Center_X":120,
"Text":"Flying Men", "Text":"Flying Men",
"Font": 0 "Font": 0,
"Separate_file_name": ""
}, },
{ {
"Y":108, "Y":504,
"Center_X":120, "Center_X":120,
"Text":"[DOT]",
"Font": 0,
"Separate_file_name": ""
},
{
"Y":558,
"Center_X":120,
"Text":"[DOT]",
"Font": 0,
"Separate_file_name": ""
},
{
"Y":570,
"Center_X":96,
"Text":"Dad", "Text":"Dad",
"Font": 0 "Font": 0,
"Separate_file_name": ""
}, },
{ {
"Y":108, "Y":579,
"Center_X":120, "Center_X":72,
"Text":"Tracy", "Text":"Tracy",
"Font": 0 "Font": 0,
"Separate_file_name": ""
}, },
{ {
"Y":108, "Y":579,
"Center_X":120, "Center_X":168,
"Text":"Mom", "Text":"Mom",
"Font": 0 "Font": 0,
"Separate_file_name": ""
} }
] ]
} }