mirror of
https://github.com/XProger/OpenLara.git
synced 2025-02-24 07:22:58 +01:00
dump of kanji glyphs for TR2 & TR3 (debug only)
This commit is contained in:
parent
97daf17107
commit
b21487d413
@ -2371,6 +2371,7 @@ namespace TR {
|
||||
Color24 *palette;
|
||||
Color32 *palette32;
|
||||
|
||||
uint16 kanjiSprite;
|
||||
int32 clutsCount;
|
||||
CLUT *cluts;
|
||||
|
||||
@ -2794,7 +2795,8 @@ namespace TR {
|
||||
if (version == VER_TR2_PSX || version == VER_TR3_PSX) {
|
||||
stream.read(tiles4, stream.read(tilesCount));
|
||||
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.read(clutsCount);
|
||||
}
|
||||
|
43
src/level.h
43
src/level.h
@ -1343,8 +1343,11 @@ struct Level : IGame {
|
||||
uv[i].y += mm.y;
|
||||
}
|
||||
}
|
||||
/*
|
||||
|
||||
#ifdef _DEBUG
|
||||
void dumpGlyphs() {
|
||||
ASSERT(level.tiles8);
|
||||
|
||||
TR::SpriteSequence &seq = level.spriteSequences[level.extra.glyphs];
|
||||
short2 size = short2(0, 0);
|
||||
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);
|
||||
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() {
|
||||
#ifndef SPLIT_BY_TILE
|
||||
@ -1387,7 +1420,11 @@ struct Level : IGame {
|
||||
#error atlas packing is not allowed for this platform
|
||||
#endif
|
||||
|
||||
//dumpGlyphs();
|
||||
#ifdef _DEBUG
|
||||
//dumpGlyphs();
|
||||
//dumpKanji();
|
||||
#endif
|
||||
|
||||
UI::patchGlyphs(level);
|
||||
|
||||
{
|
||||
|
Loading…
x
Reference in New Issue
Block a user