mirror of
https://gitlab.com/skmp/dca3-game.git
synced 2025-01-16 21:08:22 +01:00
Add support for C565 and C4444 on texture import, some game distro uses those in particle.txd
This commit is contained in:
parent
d523140fa4
commit
4e8f09ac66
9
vendor/librw/src/d3d-x/d3d.cpp
vendored
9
vendor/librw/src/d3d-x/d3d.cpp
vendored
@ -902,10 +902,15 @@ rasterToImage(Raster *raster)
|
||||
depth = 16;
|
||||
conv = conv_ARGB1555_from_RGB555;
|
||||
break;
|
||||
|
||||
default:
|
||||
case Raster::C565:
|
||||
depth = 24;
|
||||
conv = conv_RGB888_from_BGR565;
|
||||
break;
|
||||
case Raster::C4444:
|
||||
depth = 32;
|
||||
conv = conv_RGBA8888_from_BGRA4444;
|
||||
break;
|
||||
default:
|
||||
case Raster::LUM8:
|
||||
RWERROR((ERR_INVRASTER));
|
||||
return nil;
|
||||
|
28
vendor/librw/src/raster.cpp
vendored
28
vendor/librw/src/raster.cpp
vendored
@ -313,6 +313,34 @@ conv_ARGB1555_from_RGBA5551(uint8 *out, uint8 *in)
|
||||
out[1] = g>>3 | r<<2 | a<<7;
|
||||
}
|
||||
|
||||
void conv_RGB888_from_BGR565(uint8 *out, uint8 *in)
|
||||
{
|
||||
uint16_t col = in[0] | in[1]<<8;
|
||||
|
||||
uint32 r, g, b;
|
||||
r = (col>>11) & 0x1F;
|
||||
g = (col>>5) & 0x3F;
|
||||
b = (col>>0) & 0x1F;
|
||||
out[0] = r*0xFF/0x1f;
|
||||
out[1] = g*0xFF/0x3f;
|
||||
out[2] = b*0xFF/0x1f;
|
||||
}
|
||||
|
||||
void conv_RGBA8888_from_BGRA4444(uint8 *out, uint8 *in)
|
||||
{
|
||||
uint16_t col = in[0] | in[1]<<8;
|
||||
|
||||
uint32 r, g, b, a;
|
||||
a = (col>>12) & 0xF;
|
||||
r = (col>>8) & 0xF;
|
||||
g = (col>>4) & 0xF;
|
||||
b = (col>>0) & 0xF;
|
||||
out[0] = r*0xFF/0xf;
|
||||
out[1] = g*0xFF/0xf;
|
||||
out[2] = b*0xFF/0xf;
|
||||
out[3] = a*0xFF/0xf;
|
||||
}
|
||||
|
||||
void
|
||||
conv_RGBA8888_from_ARGB1555(uint8 *out, uint8 *in)
|
||||
{
|
||||
|
2
vendor/librw/src/rwobjects.h
vendored
2
vendor/librw/src/rwobjects.h
vendored
@ -328,6 +328,8 @@ void conv_ARGB1555_from_ARGB1555(uint8 *out, uint8 *in);
|
||||
void conv_ARGB1555_from_RGB555(uint8 *out, uint8 *in);
|
||||
void conv_RGBA5551_from_ARGB1555(uint8 *out, uint8 *in);
|
||||
void conv_ARGB1555_from_RGBA5551(uint8 *out, uint8 *in);
|
||||
void conv_RGB888_from_BGR565(uint8 *out, uint8 *in);
|
||||
void conv_RGBA8888_from_BGRA4444(uint8 *out, uint8 *in);
|
||||
void conv_RGBA8888_from_ARGB1555(uint8 *out, uint8 *in);
|
||||
void conv_ABGR1555_from_ARGB1555(uint8 *out, uint8 *in);
|
||||
inline void conv_8_from_8(uint8 *out, uint8 *in) { *out = *in; }
|
||||
|
Loading…
x
Reference in New Issue
Block a user