This also fixes partially #31, making the hats visible.
This commit is contained in:
parent
abfa56a336
commit
c3470d9b16
4 changed files with 16 additions and 9 deletions
|
@ -971,6 +971,9 @@ void GfxOpenGL::createMaterial(MaterialData *material, const char *data, const C
|
|||
uint8 col = *(uint8 *)(data);
|
||||
if (col == 0) {
|
||||
memset(texdatapos, 0, 4); // transparent
|
||||
if (!material->_hasAlpha) {
|
||||
texdatapos[3] = '\xff'; // fully opaque
|
||||
}
|
||||
} else {
|
||||
memcpy(texdatapos, cmap->_colors + 3 * (col), 3);
|
||||
texdatapos[3] = '\xff'; // fully opaque
|
||||
|
|
|
@ -812,9 +812,12 @@ void GfxTinyGL::createMaterial(MaterialData *material, const char *data, const C
|
|||
for (int y = 0; y < material->_height; y++) {
|
||||
for (int x = 0; x < material->_width; x++) {
|
||||
uint8 col = *(uint8 *)(data);
|
||||
if (col == 0)
|
||||
if (col == 0) {
|
||||
memset(texdatapos, 0, 4); // transparent
|
||||
else {
|
||||
if (!material->_hasAlpha) {
|
||||
texdatapos[3] = '\xff'; // fully opaque
|
||||
}
|
||||
} else {
|
||||
memcpy(texdatapos, cmap->_colors + 3 * (col), 3);
|
||||
texdatapos[3] = '\xff'; // fully opaque
|
||||
}
|
||||
|
|
|
@ -50,6 +50,7 @@ MaterialData::MaterialData(const Common::String &filename, const char *data, int
|
|||
error("Unknown offset: %d", offset);
|
||||
_width = READ_LE_UINT32(data + 60 + _numImages * 40);
|
||||
_height = READ_LE_UINT32(data + 64 + _numImages * 40);
|
||||
_hasAlpha = READ_LE_UINT32(data + 68 + _numImages * 40);
|
||||
|
||||
if (_width == 0 || _height == 0) {
|
||||
if (gDebugLevel == DEBUG_WARN || gDebugLevel == DEBUG_ALL)
|
||||
|
|
|
@ -40,7 +40,7 @@ public:
|
|||
const ObjectPtr<CMap> _cmap;
|
||||
int _numImages;
|
||||
int _width, _height;
|
||||
int _alpha;
|
||||
bool _hasAlpha;
|
||||
void *_textures;
|
||||
int _refCount;
|
||||
};
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue