Crystal Beans from Dungeon Explorer/Cutscene Font Graphics

From Data Crystal
Jump to navigation Jump to search

Format

The cutscene font graphics are in a monochrome 12x12 pixels per tile format. Pixels are stored line by line in a linear manner meaning that 3 nibbles make up the first line, the next 3 nibbles make up the second line, etc. For this reason, it's often processed 2 lines at a time in a 6 step loop.

12x12 to 16x16 C Source

int byte1 = 0, byte2 = 0, byte3 = 0;

for (i = 0; i < 6; i++) {
  byte1 = fgetc(in);
  byte2 = fgetc(in);
  byte3 = fgetc(in);
  fputc(byte1, out); // first line left
  fputc(byte2 & 0xF0, out); // first line right
  fputc(((byte2 & 0x0F) << 4) | ((byte3 & 0xF0)) >> 4, out); // second line left
  fputc((byte3 & 0x0F) << 4, out); // second line right
}

for (i = 0; i < 8; i++)
  fputc(0, out); // insert 4 empty lines

Other games using this format