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:
.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
m2_cast_vwf_free:
.incbin "data/cast_roll_first_free.bin"

View File

@ -70,9 +70,20 @@ namespace RenderCastRoll
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
if (renders[i].Separate_file_name == "")
for (int j = 0; j < buffers[i].used; j++)
for(int k = 0; k < WritingBuffer.yLength; k++)
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
@ -96,6 +107,19 @@ namespace RenderCastRoll
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)
{
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));
}
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)
{
byte[] newArr = new byte[2];

View File

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

View File

@ -4,241 +4,358 @@
"Y":16,
"Center_X":120,
"Text":"Picky Minch",
"Font": 0
"Font": 0,
"Separate_file_name": ""
},
{
"Y":24,
"Center_X":64,
"Text":"Lardna Minch",
"Font": 0
"Font": 0,
"Separate_file_name": ""
},
{
"Y":24,
"Center_X":176,
"Text":"Aloysius Minch",
"Font": 0
"Font": 0,
"Separate_file_name": ""
},
{
"Y":32,
"Center_X":120,
"Text":"Pokey Minch",
"Font": 0
"Font": 0,
"Separate_file_name": ""
},
{
"Y":42,
"Center_X":120,
"Text":"Buzz Buzz",
"Font": 0
"Font": 0,
"Separate_file_name": ""
},
{
"Y":51,
"Center_X":120,
"Text":"Lier`X.`Agerate",
"Font": 0
"Font": 0,
"Separate_file_name": ""
},
{
"Y":62,
"Center_X":120,
"Text":"Frank Fly",
"Font": 0
"Font": 0,
"Separate_file_name": ""
},
{
"Y":71,
"Center_X":120,
"Text":"The Sharks",
"Font": 0
"Font": 0,
"Separate_file_name": ""
},
{
"Y":82,
"Center_X":120,
"Text":"B. H. Pirkle",
"Font": 0
"Font": 0,
"Separate_file_name": ""
},
{
"Y":93,
"Center_X":120,
"Text":"Captain Strong",
"Font": 0
"Font": 0,
"Separate_file_name": ""
},
{
"Y":102,
"Center_X":120,
"Text":"Onett police force",
"Font": 0
"Font": 0,
"Separate_file_name": ""
},
{
"Y":108,
"Y":109,
"Center_X":120,
"Text":"[DOT]",
"Font": 0
"Font": 0,
"Separate_file_name": ""
},
{
"Y":108,
"Y":139,
"Center_X":120,
"Text":"Orange kid",
"Font": 0
"Font": 0,
"Separate_file_name": ""
},
{
"Y":108,
"Y":148,
"Center_X":120,
"Text":"Apple kid",
"Font": 0
"Font": 0,
"Separate_file_name": ""
},
{
"Y":108,
"Y":159,
"Center_X":120,
"Text":"Mr. Everdred",
"Font": 0
"Font": 0,
"Separate_file_name": ""
},
{
"Y":108,
"Y":175,
"Center_X":120,
"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,
"Text":"Happy Happyists",
"Font": 0
"Font": 0,
"Separate_file_name": ""
},
{
"Y":108,
"Y":204,
"Center_X":120,
"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,
"Text":"Bubble Monkey",
"Font": 0
"Font": 0,
"Separate_file_name": ""
},
{
"Y":108,
"Center_X":120,
"Y":230,
"Center_X":64,
"Text":"Tony",
"Font": 0
"Font": 0,
"Separate_file_name": ""
},
{
"Y":108,
"Center_X":120,
"Y":230,
"Center_X":176,
"Text":"Maxwell",
"Font": 0
"Font": 0,
"Separate_file_name": ""
},
{
"Y":108,
"Y":237,
"Center_X":120,
"Text":"Tessie",
"Font": 0
"Font": 0,
"Separate_file_name": ""
},
{
"Y":108,
"Y":245,
"Center_X":120,
"Text":"Tessie-Watching Club",
"Font": 0
"Font": 0,
"Separate_file_name": ""
},
{
"Y":108,
"Y":257,
"Center_X":120,
"Text":"Brickroad",
"Font": 0
"Font": 0,
"Separate_file_name": ""
},
{
"Y":108,
"Center_X":120,
"Y":272,
"Center_X":80,
"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,
"Text":"mr.saturn",
"Font": 1
"Font": 1,
"Separate_file_name": ""
},
{
"Y":108,
"Y":325,
"Center_X":120,
"Text":"Master Belch",
"Font": 0
"Font": 0,
"Separate_file_name": "master_belch"
},
{
"Y":108,
"Y":332,
"Center_X":120,
"Text":"George Montague",
"Font": 0
"Text":"[DOT]",
"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,
"Text":"Gerardo Montague",
"Font": 0
"Font": 0,
"Separate_file_name": ""
},
{
"Y":108,
"Y":371,
"Center_X":120,
"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,
"Text":"Geldegarde Monotoli",
"Font": 0
"Font": 0,
"Separate_file_name": ""
},
{
"Y":108,
"Y":400,
"Center_X":120,
"Text":"Venus",
"Font": 0
"Font": 0,
"Separate_file_name": ""
},
{
"Y":108,
"Y":407,
"Center_X":120,
"Text":"Star Master",
"Font": 0
"Text":"[DOT]",
"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,
"Text":"Dungeon Man",
"Font": 0
"Font": 0,
"Separate_file_name": ""
},
{
"Y":108,
"Center_X":120,
"Y":457,
"Center_X":192,
"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,
"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,
"Text":"Flying Men",
"Font": 0
"Font": 0,
"Separate_file_name": ""
},
{
"Y":108,
"Y":504,
"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",
"Font": 0
"Font": 0,
"Separate_file_name": ""
},
{
"Y":108,
"Center_X":120,
"Y":579,
"Center_X":72,
"Text":"Tracy",
"Font": 0
"Font": 0,
"Separate_file_name": ""
},
{
"Y":108,
"Center_X":120,
"Y":579,
"Center_X":168,
"Text":"Mom",
"Font": 0
"Font": 0,
"Separate_file_name": ""
}
]
}