mirror of
https://github.com/XProger/OpenLara.git
synced 2025-02-23 23:14:47 +01:00
fix AV; fix textures for static objects (Sega Saturn)
This commit is contained in:
parent
4921d3433d
commit
451aa624c9
27
src/format.h
27
src/format.h
@ -1113,7 +1113,8 @@ namespace TR {
|
||||
};
|
||||
|
||||
struct TextureInfo {
|
||||
TextureType type;
|
||||
TextureType type; // determines in which atlas this texture will be stored
|
||||
TextureType dataType; // original texture type from file
|
||||
uint16 index;
|
||||
uint16 clut;
|
||||
uint16 tile;
|
||||
@ -1126,13 +1127,13 @@ namespace TR {
|
||||
|
||||
TextureInfo() {}
|
||||
|
||||
TextureInfo(TextureType type, int16 l, int16 t, int16 r, int16 b, uint8 tx, uint8 ty, uint8 tw, uint8 th) : type(type), attribute(1), l(l), t(t), r(r), b(b) {
|
||||
TextureInfo(TextureType type, int16 l, int16 t, int16 r, int16 b, uint8 tx, uint8 ty, uint8 tw, uint8 th) : type(type), dataType(type), attribute(1), l(l), t(t), r(r), b(b) {
|
||||
texCoord[0] = texCoordAtlas[0] = short2( tx, ty );
|
||||
texCoord[1] = texCoordAtlas[1] = short2( tx + tw - 1, ty + th - 1 );
|
||||
}
|
||||
|
||||
short4 getMinMax() const {
|
||||
if (type == TEX_TYPE_SPRITE)
|
||||
if (dataType == TEX_TYPE_SPRITE)
|
||||
return short4( texCoord[0].x, texCoord[0].y, texCoord[1].x, texCoord[1].y );
|
||||
|
||||
return short4(
|
||||
@ -1144,7 +1145,7 @@ namespace TR {
|
||||
}
|
||||
|
||||
short4 getMinMaxAtlas() const {
|
||||
if (type == TEX_TYPE_SPRITE)
|
||||
if (dataType == TEX_TYPE_SPRITE)
|
||||
return short4( texCoordAtlas[0].x, texCoordAtlas[0].y, texCoordAtlas[1].x, texCoordAtlas[1].y );
|
||||
|
||||
return short4(
|
||||
@ -5011,7 +5012,7 @@ namespace TR {
|
||||
t.texCoord[3] = t.texCoordAtlas[3] = short2( d.x3, d.y3 );\
|
||||
}
|
||||
|
||||
t.type = type;
|
||||
t.type = t.dataType = type;
|
||||
|
||||
switch (version) {
|
||||
case VER_TR1_SAT : {
|
||||
@ -5128,6 +5129,7 @@ namespace TR {
|
||||
}
|
||||
|
||||
t.type = TEX_TYPE_SPRITE;
|
||||
t.dataType = TEX_TYPE_SPRITE;
|
||||
t.attribute = 1;
|
||||
|
||||
switch (version) {
|
||||
@ -5324,7 +5326,7 @@ namespace TR {
|
||||
uint32 cOffset = uint32(uint16(t->clut + t->tile)) << 3;
|
||||
|
||||
uint8 *data = NULL;
|
||||
switch (t->type) {
|
||||
switch (t->dataType) {
|
||||
case TEX_TYPE_ROOM : data = roomTexturesData; break;
|
||||
case TEX_TYPE_ITEM : data = itemTexturesData; break;
|
||||
case TEX_TYPE_OBJECT : data = objectTexturesData; break;
|
||||
@ -5340,22 +5342,11 @@ namespace TR {
|
||||
int w = uv.z - uv.x;
|
||||
ASSERT(w <= 256 && h <= 256);
|
||||
|
||||
/*
|
||||
if (t->type == TEX_TYPE_OBJECT) {
|
||||
for (int y = 0; y < h; y++)
|
||||
for (int x = 0; x < h; x++) {
|
||||
ColorIndex4 *index = indices + (y * w + x) / 2;
|
||||
uint8 p = uint8((x % 2) ? index->a : index->b) << 4;
|
||||
dst->color[y * 256 + x] = Color32(p, p, p, 255);
|
||||
}
|
||||
return;
|
||||
}
|
||||
*/
|
||||
for (int y = 0; y < h; y++)
|
||||
for (int x = 0; x < w; x++) {
|
||||
ColorIndex4 *index;
|
||||
|
||||
if (t->type == TEX_TYPE_ROOM) {
|
||||
if (t->dataType == TEX_TYPE_ROOM) {
|
||||
int iw = w / 2;
|
||||
int ih = h / 2;
|
||||
int ix = x % iw;
|
||||
|
@ -1515,7 +1515,7 @@ struct Level : IGame {
|
||||
ASSERT(COUNT(CommonTexOffset) == CTEX_MAX);
|
||||
memset(CommonTex, 0, sizeof(CommonTex));
|
||||
for (int i = 0; i < CTEX_MAX; i++) {
|
||||
CommonTex[i].type = TR::TEX_TYPE_SPRITE;
|
||||
CommonTex[i].type = CommonTex[i].dataType = TR::TEX_TYPE_SPRITE;
|
||||
Atlas *dst = (i == CTEX_FLASH || i == CTEX_WHITE_OBJECT) ? oAtlas : ((i == CTEX_WHITE_ROOM) ? rAtlas : gAtlas);
|
||||
dst->add(level.objectTexturesCount + level.spriteTexturesCount + i, short4(i * 32, ATLAS_PAGE_BARS, i * 32 + CommonTexOffset[i].x, ATLAS_PAGE_BARS + CommonTexOffset[i].y), &CommonTex[i]);
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user