mmp_dump to tga

Talk about Severance Blade of Darkness modifications and maps here. No tips or tech support questions please, use the forum above. Note that the game is rated 18 so some content may be unsuitable for younger readers.

Moderators: prospero, Ade

Post Reply
User avatar
cieply
Dragon
Posts: 335
Joined: Wed Jun 26, 2013 3:43 pm

mmp_dump to tga

Post by cieply »

#
I was just playing with mmp_dump ( http://blade-of-darkness.bigtruck-canad ... p_dump.zip ) and corrected it so can be compiled with gcc and tried to understand how it actually works because wanted to make it work with .tga files that support transparency

there is switch/case which is self explaining but I found few questions to ask

- what is type=5? (it occurs in game, e.g. $BOD/Data/marcadorataque.mmp and other scorer pictures)
- how actually is realised transparency? in sgi-workstation there can be saved mask that is applyed in .mmp but how it exactly works?
- what does that byte shifting in paletted image? ( truecolour[3*k] = palette[data[k]*3] << 2; )

--- cut mmp_dump.cpp ---

Code: Select all

switch (type) {
    case 1:
        {
            printf("paletted)\n");
            unsigned char *palette = data + width*height;//data_len - 768+3;
            unsigned char *truecolour = (unsigned char *) malloc(width*height*3);
            for (int j=0; j<height; ++j)
                for (int k=j*width; k<(j+1)*width; ++k) {
                    truecolour[3*k] = palette[data[k]*3] << 2;
                    truecolour[3*k+1] = palette[data[k]*3+1] << 2;
                    truecolour[3*k+2] = palette[data[k]*3+2] << 2;
                }
            bmp.SaveBMP(name, truecolour, width, height);
            free(truecolour);
            break;
        }
    case 2:
        {
            printf("alpha)\n");
            (...)
        }
    case 4:
        {
            printf("true colour)\n");
            (...)
        }
    default:
        printf("Sorry, I don't know the type %d of texture %s\n", type, name);
    }
--- EOF cut mmp_dump.cpp ---
l'aria fresca,
vino puro, ...

Post Reply