mirror of
https://github.com/XProger/OpenLara.git
synced 2025-08-13 08:34:32 +02:00
dump of kanji glyphs for TR2 & TR3 (debug only)
This commit is contained in:
@@ -2371,6 +2371,7 @@ namespace TR {
|
|||||||
Color24 *palette;
|
Color24 *palette;
|
||||||
Color32 *palette32;
|
Color32 *palette32;
|
||||||
|
|
||||||
|
uint16 kanjiSprite;
|
||||||
int32 clutsCount;
|
int32 clutsCount;
|
||||||
CLUT *cluts;
|
CLUT *cluts;
|
||||||
|
|
||||||
@@ -2794,7 +2795,8 @@ namespace TR {
|
|||||||
if (version == VER_TR2_PSX || version == VER_TR3_PSX) {
|
if (version == VER_TR2_PSX || version == VER_TR3_PSX) {
|
||||||
stream.read(tiles4, stream.read(tilesCount));
|
stream.read(tiles4, stream.read(tilesCount));
|
||||||
stream.read(clutsCount);
|
stream.read(clutsCount);
|
||||||
if (clutsCount > 1024) { // check for japanese version (skip 2 bytes after tiles data)
|
if (clutsCount > 1024) { // check for japanese version (read kanji CLUT index)
|
||||||
|
kanjiSprite = clutsCount & 0xFFFF;
|
||||||
stream.seek(-2);
|
stream.seek(-2);
|
||||||
stream.read(clutsCount);
|
stream.read(clutsCount);
|
||||||
}
|
}
|
||||||
|
41
src/level.h
41
src/level.h
@@ -1343,8 +1343,11 @@ struct Level : IGame {
|
|||||||
uv[i].y += mm.y;
|
uv[i].y += mm.y;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
/*
|
|
||||||
|
#ifdef _DEBUG
|
||||||
void dumpGlyphs() {
|
void dumpGlyphs() {
|
||||||
|
ASSERT(level.tiles8);
|
||||||
|
|
||||||
TR::SpriteSequence &seq = level.spriteSequences[level.extra.glyphs];
|
TR::SpriteSequence &seq = level.spriteSequences[level.extra.glyphs];
|
||||||
short2 size = short2(0, 0);
|
short2 size = short2(0, 0);
|
||||||
for (int i = 0; i < seq.sCount; i++) {
|
for (int i = 0; i < seq.sCount; i++) {
|
||||||
@@ -1378,7 +1381,37 @@ struct Level : IGame {
|
|||||||
Texture::SaveBMP("pc_glyph.bmp", (char*)data, size.x, size.y);
|
Texture::SaveBMP("pc_glyph.bmp", (char*)data, size.x, size.y);
|
||||||
delete[] data;
|
delete[] data;
|
||||||
}
|
}
|
||||||
*/
|
|
||||||
|
void dumpKanji() {
|
||||||
|
Stream stream("DATA/KANJI.PSX");
|
||||||
|
int size = stream.readLE32() / 2;
|
||||||
|
TR::ColorIndex4 *buffer = new TR::ColorIndex4[size];
|
||||||
|
stream.raw(buffer, size);
|
||||||
|
int width = 256;
|
||||||
|
int height = size / width * 2;
|
||||||
|
|
||||||
|
Color32 *image = new Color32[width * height];
|
||||||
|
|
||||||
|
TR::Tile4 *tile = (TR::Tile4*)buffer;
|
||||||
|
TR::CLUT &clut = level.cluts[level.spriteTextures[level.kanjiSprite].clut];
|
||||||
|
|
||||||
|
TR::ColorIndex4 *idx = buffer;
|
||||||
|
Color32 *ptr = image;
|
||||||
|
|
||||||
|
for (int y = 0; y < height; y++) {
|
||||||
|
for (int x = 0; x < width; x += 2) {
|
||||||
|
*ptr++ = clut.color[idx->a];
|
||||||
|
*ptr++ = clut.color[idx->b];
|
||||||
|
idx++;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
Texture::SaveBMP("kanji", (char*)image, width, height);
|
||||||
|
|
||||||
|
delete[] buffer;
|
||||||
|
delete[] image;
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
void initTextures() {
|
void initTextures() {
|
||||||
#ifndef SPLIT_BY_TILE
|
#ifndef SPLIT_BY_TILE
|
||||||
@@ -1387,7 +1420,11 @@ struct Level : IGame {
|
|||||||
#error atlas packing is not allowed for this platform
|
#error atlas packing is not allowed for this platform
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
#ifdef _DEBUG
|
||||||
//dumpGlyphs();
|
//dumpGlyphs();
|
||||||
|
//dumpKanji();
|
||||||
|
#endif
|
||||||
|
|
||||||
UI::patchGlyphs(level);
|
UI::patchGlyphs(level);
|
||||||
|
|
||||||
{
|
{
|
||||||
|
Reference in New Issue
Block a user