344 }
else if (
id_ == 0x05) {
347 }
else if (
id_ == 0x06) {
350 }
else if (
id_ == 0x09) {
354 }
else if (
id_ == 0x14) {
386 }
else if (
id_ == 0x01) {
389 }
else if (
id_ == 0x02) {
391 }
else if (
id_ == 0x04) {
396 }
else if (
id_ == 0x05) {
401 }
else if (
id_ == 0x06) {
406 }
else if (
id_ == 0x07) {
411 }
else if (
id_ == 0x08) {
414 }
else if (
id_ == 0x09) {
428 }
else if (
id_ == 0x0A) {
431 }
else if (
id_ == 0x0B) {
433 }
else if (
id_ == 0x0C) {
436 }
else if (
id_ == 0x0D) {
438 }
else if (
id_ == 0x0E) {
440 }
else if (
id_ == 0x0F) {
443 }
else if (
id_ == 0x10) {
445 }
else if (
id_ == 0x11) {
454 }
else if (
id_ == 0x12) {
457 }
else if (
id_ == 0x13) {
459 }
else if (
id_ == 0x15) {
467 }
else if (
id_ == 0x16) {
470 }
else if (
id_ == 0x17)
473 }
else if (
id_ == 0x18)
483 }
else if (
id_ == 0x19)
486 }
else if (
id_ == 0x1A)
491 }
else if (
id_ == 0x1C)
496 }
else if (
id_ == 0x1E)
499 }
else if (
id_ == 0x1F)
507 }
else if (
id_ == 0x20) {
509 }
else if (
id_ == 0x21)
514 }
else if (
id_ == 0x22)
517 }
else if (
id_ == 0x23)
521 }
else if (
id_ == 0x24)
525 }
else if (
id_ == 0x25)
528 }
else if (
id_ == 0x26)
530 if ((
x & 0x01) == 0x00) {
537 }
else if (
id_ == 0x27)
540 }
else if (
id_ == 0x28)
543 }
else if (
id_ == 0x29)
546 }
else if (
id_ == 0x2A)
549 }
else if (
id_ == 0x2B)
552 }
else if (
id_ == 0x2C)
574 }
else if (
id_ == 0x2D)
577 }
else if (
id_ == 0x2E)
580 }
else if (
id_ == 0x2F)
583 }
else if (
id_ == 0x30)
586 }
else if (
id_ == 0x31)
589 }
else if (
id_ == 0x32)
599 else if (
id_ == 0x34)
602 }
else if (
id_ == 0x35)
605 }
else if (
id_ == 0x36)
615 else if (
id_ == 0x38)
618 }
else if (
id_ == 0x39)
621 }
else if (
id_ == 0x3A)
624 }
else if (
id_ == 0x3B)
626 }
else if (
id_ == 0x3C)
629 }
else if (
id_ == 0x3D)
632 }
else if (
id_ == 0x3E)
635 }
else if (
id_ == 0x3F)
638 }
else if (
id_ == 0x40)
645 }
else if (
id_ == 0x41)
654 }
else if (
id_ == 0x42)
663 }
else if (
id_ == 0x43)
672 }
else if (
id_ == 0x44)
679 }
else if (
id_ == 0x45)
688 }
else if (
id_ == 0x46)
697 }
else if (
id_ == 0x47)
705 }
else if (
id_ == 0x48)
712 }
else if (
id_ == 0x49)
720 }
else if (
id_ == 0x4A)
726 }
else if (
id_ == 0x4B)
731 }
else if (
id_ == 0x4C)
734 }
else if (
id_ == 0x4D)
737 }
else if (
id_ == 0x4E)
740 }
else if (
id_ == 0x4F)
743 }
else if (
id_ == 0x50)
746 }
else if (
id_ == 0x51)
749 }
else if (
id_ == 0x53)
752 }
else if (
id_ == 0x54) {
756 }
else if (
id_ == 0x55)
759 }
else if (
id_ == 0x56)
763 }
else if (
id_ == 0x57)
767 }
else if (
id_ == 0x58)
771 }
else if (
id_ == 0x5B)
774 }
else if (
id_ == 0x5C)
777 }
else if (
id_ == 0x5D)
780 if (((
y * 16) & 0x10) == 0x10) {
783 for (
int i = 0; i < 7; i++) {
795 }
else if (
id_ == 0x5E)
798 if (((
y * 16) & 0x10) == 0x10) {
801 for (
int i = 0; i < 7; i++) {
812 }
else if (
id_ == 0x5F)
814 if (((
x * 16) & 0x10) == 0x10) {
820 for (
int i = 0; i < 7; i++) {
827 }
else if (
id_ == 0x60)
830 if (((
x * 16) & 0x10) == 0x10) {
836 for (
int i = 0; i < 7; i++) {
844 }
else if (
id_ == 0x61)
848 }
else if (
id_ == 0x63)
855 }
else if (
id_ == 0x64)
862 }
else if (
id_ == 0x66)
865 }
else if (
id_ == 0x67)
868 }
else if (
id_ == 0x68)
871 }
else if (
id_ == 0x69)
874 }
else if (
id_ == 0x6A)
880 }
else if (
id_ == 0x6B)
886 }
else if (
id_ == 0x6C)
889 }
else if (
id_ == 0x6D)
892 }
else if (
id_ == 0x6E)
895 }
else if (
id_ == 0x6F) {
897 }
else if (
id_ == 0x70)
900 }
else if (
id_ == 0x71)
903 }
else if (
id_ == 0x73)
905 }
else if (
id_ == 0x79)
908 }
else if (
id_ == 0x7C)
911 }
else if (
id_ == 0x7D)
917 }
else if (
id_ == 0x7E)
923 }
else if (
id_ == 0x7F)
929 }
else if (
id_ == 0x80)
936 }
else if (
id_ == 0x81)
939 }
else if (
id_ == 0x82)
946 DrawSpriteTile((
x * 16 + 14) - 4, (
y * 16 + 8) - 16, 3, 30, 5,
false,
false,
948 DrawSpriteTile((
x * 16 + 8) - 4, (
y * 16 + 14) - 16, 3, 30, 5,
false,
false,
957 DrawSpriteTile((
x * 16 + 14) - 16, (
y * 16 + 8) - 4, 3, 30, 5,
false,
false,
959 DrawSpriteTile((
x * 16 + 8) - 16, (
y * 16 + 14) - 4, 3, 30, 5,
false,
false,
985 }
else if (
id_ == 0x83)
989 }
else if (
id_ == 0x84)
993 }
else if (
id_ == 0x85)
997 }
else if (
id_ == 0x86)
1000 }
else if (
id_ == 0x88)
1004 }
else if (
id_ == 0x8A)
1007 }
else if (
id_ == 0x8B)
1011 }
else if (
id_ == 0x8C)
1015 }
else if (
id_ == 0x8D)
1018 }
else if (
id_ == 0x8E)
1026 }
else if (
id_ == 0x90)
1030 DrawSpriteTile((
x * 16) + 16, (
y * 16) + 8, 9, 26, 12,
false,
false, 1, 2);
1032 DrawSpriteTile((
x * 16) + 8, (
y * 16) + 16, 8, 27, 12,
false,
false, 1, 1);
1033 }
else if (
id_ == 0x91)
1035 DrawSpriteTile((
x * 16) - 2, (
y * 16) + 12, 4, 22, 12,
false,
false, 1, 2);
1036 DrawSpriteTile((
x * 16) + 10, (
y * 16) + 12, 4, 22, 12,
true,
false, 1, 2);
1038 DrawSpriteTile((
x * 16) + 12, (
y * 16) + 4, 3, 22, 12,
false,
false, 1, 2);
1040 }
else if (
id_ == 0x92)
1052 }
else if (
id_ == 0x93)
1058 }
else if (
id_ == 0x95)
1062 }
else if (
id_ == 0x96)
1066 }
else if (
id_ == 0x97)
1070 }
else if (
id_ == 0x98)
1074 }
else if (
id_ == 0x99) {
1077 }
else if (
id_ == 0x9A)
1080 }
else if (
id_ == 0x9B)
1084 }
else if (
id_ == 0x9C)
1088 }
else if (
id_ == 0x9D)
1092 }
else if (
id_ == 0xA1) {
1095 }
else if (
id_ == 0xA2) {
1097 }
else if (
id_ == 0xA5) {
1100 }
else if (
id_ == 0xA6) {
1103 }
else if (
id_ == 0xA7) {
1106 }
else if (
id_ == 0xAC) {
1108 }
else if (
id_ == 0xAD) {
1111 }
else if (
id_ == 0xBA) {
1113 }
else if (
id_ == 0xC1 ||
id_ == 0x7A) {
1115 DrawSpriteTile((
x * 16) + 16, (
y * 16) - 16, 2, 24, 12,
true,
false, 2, 4);
1116 }
else if (
id_ == 0xC3) {
1118 }
else if (
id_ == 0xC4) {
1121 }
else if (
id_ == 0xC5) {
1122 }
else if (
id_ == 0xC6) {
1123 DrawSpriteTile((
x * 16) + 4, (
y * 16) + 14, 3, 30, 14,
false,
false, 1, 1);
1124 DrawSpriteTile((
x * 16) + 14, (
y * 16) + 4, 3, 30, 14,
false,
false, 1, 1);
1128 }
else if (
id_ == 0xC7) {
1133 }
else if (
id_ == 0xC8) {
1136 }
else if (
id_ == 0xC9) {
1139 }
else if (
id_ == 0xCA) {
1141 }
else if (
id_ == 0xD0) {
1144 }
else if (
id_ == 0xD1) {
1152 }
else if (
id_ == 0xD4) {
1155 }
else if (
id_ == 0xE3)
1158 }
else if (
id_ == 0xE4)
1161 }
else if (
id_ == 0xE7)
1164 }
else if (
id_ == 0xE8)
1168 }
else if (
id_ == 0xEB) {
1170 }
else if (
id_ == 0xF2) {
1172 DrawSpriteTile((
x * 16) + 16, (
y * 16) - 16, 12, 24, 2,
true,
false, 2, 4);
1173 }
else if (
id_ == 0xF4) {
1226 bool mirror_x,
bool mirror_y,
int sizex,
1229 const uint8_t* gfx_data =
1231 const size_t gfx_size =
1234 if (gfx_data ==
nullptr || gfx_size == 0) {
1244 if (sizex <= 0 || sizey <= 0) {
1248 if (srcx < 0 || srcy < 0 || pal < 0) {
1254 int drawid_ = (srcx + (srcy * 16)) + 512;
1257 if (drawid_ < 0 || drawid_ > 4096) {
1261 if (use_external_8bpp) {
1262 const int width = sizex * 8;
1263 const int height = sizey * 8;
1264 constexpr int kTilesPerRow = 16;
1265 constexpr int kTileSize = 8;
1266 constexpr int kTileRowStride = 1024;
1267 constexpr int kPixelRowStride = 128;
1269 for (
int dest_y = 0; dest_y <
height; ++dest_y) {
1270 const int src_y = mirror_y ? (
height - 1 - dest_y) : dest_y;
1271 const int src_tile_y = src_y / kTileSize;
1272 const int src_py = src_y % kTileSize;
1274 for (
int dest_x = 0; dest_x <
width; ++dest_x) {
1275 const int src_x = mirror_x ? (
width - 1 - dest_x) : dest_x;
1276 const int src_tile_x = src_x / kTileSize;
1277 const int src_px = src_x % kTileSize;
1278 const int tile_id = drawid_ + (src_tile_y * kTilesPerRow) + src_tile_x;
1283 const int tile_col = tile_id % kTilesPerRow;
1284 const int tile_row = tile_id / kTilesPerRow;
1285 const int gfx_index = (tile_row * kTileRowStride) +
1286 (src_py * kPixelRowStride) +
1287 (tile_col * kTileSize) + src_px;
1288 if (gfx_index < 0 || gfx_index >=
static_cast<int>(gfx_size)) {
1292 const uint8_t pixel = gfx_data[gfx_index] & 0x0F;
1297 const int preview_x =
x + dest_x;
1298 const int preview_y =
y + dest_y;
1299 if (preview_x < 0 || preview_x >= 64 || preview_y < 0 ||
1303 const int index = preview_x + (preview_y * 64);
1304 if (index >= 0 && index <
static_cast<int>(
preview_gfx_.size())) {
1306 static_cast<uint8_t
>((pixel & 0x0F) + 112 + (pal * 8));
1313 for (
auto yl = 0; yl < sizey * 8; yl++) {
1314 for (
auto xl = 0; xl < (sizex * 8) / 2; xl++) {
1319 mx = (((sizex * 8) / 2) - 1) - xl;
1322 my = ((sizey * 8) - 1) - yl;
1328 int tx = ((drawid_ / 0x10) * 0x400) +
1329 ((drawid_ - ((drawid_ / 0x10) * 0x10)) * 8);
1332 int gfx_index = tx + (yl * 0x80) + xl;
1333 if (gfx_index < 0 || gfx_index >=
static_cast<int>(gfx_size)) {
1337 auto pixel = gfx_data[gfx_index];
1340 int index = (
x) + (
y * 64) + (mx + (my * 0x80));
1343 if (index >= 0 && index <
static_cast<int>(
preview_gfx_.size()) &&
1345 preview_gfx_[index] = (uint8_t)((pixel & 0x0F) + 112 + (pal * 8));
void DrawSpriteTile(int x, int y, int srcx, int srcy, int pal, bool mirror_x=false, bool mirror_y=false, int sizex=2, int sizey=2)