• There is NO official Otland's Discord server and NO official Otland's server list. The Otland's Staff does not manage any Discord server or server list. Moderators or administrator of any Discord server or server lists have NO connection to the Otland's Staff. Do not get scammed!

How i can active Transparence

only available for registered users
cannot you simply paste it in public dir of your dropbox or something?
 
Code:
ImagePtr SpriteManager::getSpriteImage(int id)
{
    try {
        enum {
            SPRITE_SIZE = 32,
            SPRITE_DATA_SIZE = SPRITE_SIZE*SPRITE_SIZE*4
        };

        if(id == 0 || !m_spritesFile)
            return nullptr;

        m_spritesFile->seek(((id-1) * 4) + m_spritesOffset);

        uint32 spriteAddress = m_spritesFile->getU32();

        // no sprite? return an empty texture
        if(spriteAddress == 0)
            return nullptr;

        m_spritesFile->seek(spriteAddress);

        // skip color key
        m_spritesFile->getU8();
        m_spritesFile->getU8();
        m_spritesFile->getU8();
		//m_spritesFile->getU8();

        uint16 pixelDataSize = m_spritesFile->getU16();

        ImagePtr image(new Image(Size(SPRITE_SIZE, SPRITE_SIZE)));

        uint8 *pixels = image->getPixelData();
        int writePos = 0;
        int read = 0;

        // decompress pixels
        while(read < pixelDataSize && writePos < SPRITE_DATA_SIZE) {
            uint16 transparentPixels = m_spritesFile->getU16();
            uint16 coloredPixels = m_spritesFile->getU16();

            for(int i = 0; i < transparentPixels && writePos < SPRITE_DATA_SIZE; i++) {
                pixels[writePos + 0] = 0x00;
                pixels[writePos + 1] = 0x00;
                pixels[writePos + 2] = 0x00;
                pixels[writePos + 3] = 0x00;
                writePos += 4;
            }

            for(int i = 0; i < coloredPixels && writePos < SPRITE_DATA_SIZE; i++) {
                pixels[writePos + 0] = m_spritesFile->getU8();
                pixels[writePos + 1] = m_spritesFile->getU8();
                pixels[writePos + 2] = m_spritesFile->getU8();
                pixels[writePos + 3] = m_spritesFile->getU8();
                writePos += 4;
            }

            read += 4 + (4 * coloredPixels);
        }

        // fill remaining pixels with alpha
        while(writePos < SPRITE_DATA_SIZE) {
            pixels[writePos + 0] = 0x00;
            pixels[writePos + 1] = 0x00;
            pixels[writePos + 2] = 0x00;
            pixels[writePos + 3] = 0x00;
            writePos += 4;
        }




        return image;
    } catch(stdext::exception& e) {
        g_logger.error(stdext::format("Failed to get sprite id %d: %s", id, e.what()));
        return nullptr;
    }
}
seems to work with your file, I logged onto random 854 server and everything looks fine(besides strange sprites for items, but they are rendered properly)
(and besides that, your sprites are nice :D)


Can anyone do some autodetect feature to check if sprites are in RGB or RGBA or it have to be set in config manually?
 
open data/spr but transparency dont work :

Your edition and client with alpha
D;.jpg
 
Why is this so small, I cannot see anything...
Well, I haven't checked format, but it looks like it is loaded properly. Maybe it just renders wrong way for some reason...
check in both ogl modes and in dx mode if possible
 
Last edited:
click in image '-' water in img is transparent.

- - - Updated - - -

sorry, I could not understand you.

- - - Updated - - -

i really need it, else i will lose 2 months lots of hard work, not to mention that I have to redo all the spr without alpha
 
it looks like client renders anything with less than 255 opacity as 0 opacity, I tried figuring out where it is but failed
wait for devs

and check how it looks in all 3 graphic modes, maybe some works
 
Your picture looks fine. Since you're at floor 7, transparent sprites on floor will look black.
There's no rendering of floor 8 when you're n 7.
 
Right! This is probably just ground floor ;d
(Anyway ability to change that behaviour would be nice. client receives data about upper floors while player is below ground floor but the other way around is it not sent or just not rendered?)

And that means that my code is PERFECT muahahahaha
(but not ready for joining with main branch due to lack of settings/detecting spr type/whateva)
 
Ok, I have idea how to make autodetection. If I'm not mistaken spr file have on footer or anything like that. So it can be done by just trying to read after the last sprite probably. Is it good idea? If it is then I can code it and do ... Whatever it's called
 
Anything can be a good idea, we can jsut find a way to it work, if we try... so, lets try? :D,

- - - Updated - - -

but transparenci dont need server changes... only client
 
If you are on the ground floor them there's nothing to be drawn below transparent item. It would be nice to have some fix to make sprite fully opaque in situations like this
 
ERROR: invalid thing type client id 622 in category 0?

SAME MISTAKE HELP SUCKKK!!!
 
ERROR: invalid thing type client id 622 in category 0?

SAME MISTAKE HELP SUCKKK!!!
U9vdouk.png

https://imgur.com/U9vdouk
 
Back
Top