public void doPaletteStuff() {

        int palette;
        //byte[] pal;
        int cnt;
        int bzc;

        cnt = plyr.damagecount;

        if (plyr.powers[pw_strength] != 0) {
            // slowly fade the berzerk out
            bzc = 12 - (plyr.powers[pw_strength] >> 6);

            if (bzc > cnt)
                cnt = bzc;
        }

        if (cnt != 0) {
            palette = (cnt + 7) >> 3;

            if (palette >= NUMREDPALS)
                palette = NUMREDPALS - 1;

            palette += STARTREDPALS;
        } else if (plyr.bonuscount != 0) {
            palette = (plyr.bonuscount + 7) >> 3;

            if (palette >= NUMBONUSPALS)
                palette = NUMBONUSPALS - 1;

            palette += STARTBONUSPALS;
        } else if (plyr.powers[pw_ironfeet] > 4 * 32
                || (plyr.powers[pw_ironfeet] & 8) != 0)
            palette = RADIATIONPAL;
        else
            palette = 0;

        if (palette != st_palette) {
            st_palette = palette;
            VI.SetPalette(palette);
        }

    }