S802 GS角色实现纪念指环的旗子显示效果完整过程源代码

//////////////////////////////////////////////////////////////////////////////
// User.cpp
//////////////////////////////////////////////////////////////////////////////
// CharSet篮 促弗 轰器飘狼 荤侩磊甸俊霸 唱狼 葛嚼阑 焊咯林扁 困秦 弥利拳等
// 滚欺捞促... 促澜 窃荐绰 捞 滚欺甫 备己窍绰单 荤侩等促.
// 林狼!!!  胶饭靛 悼扁拳啊 荤侩等 镑俊辑 荤侩秦具茄促.
void gObjMakePreviewCharSet(int aIndex)
{
        BYTE index;

        if (!OBJMAX_RANGE(aIndex))
        {
                LogAdd("error : %s %d", __FILE__, __LINE__);
                return;
        }

        LPOBJECTSTRUCT lpObj = &gObj[aIndex];
        memset(lpObj->CharSet, 0, MAX_PREVIEWCHARSET);

        lpObj->CharSet[0]  = (lpObj->Class << 5) & 0xE0;
        lpObj->CharSet[0] |= (lpObj->ChangeUP << 4) & 0x10;
        lpObj->CharSet[0] |= (lpObj->ThirdChangeUp << 3) & 0x08;

        if (lpObj->m_ActionNumber == 0x80)
                lpObj->CharSet[0] |= 2;
        else if (lpObj->m_ActionNumber == 0x81)
                lpObj->CharSet[0] |= 3;
        else lpObj->CharSet[0] |= 0;

        if (lpObj->pInventory[EQUIPMENT_WEAPON_RIGHT].m_Type < 0) {
                lpObj->CharSet[12] |= (0x0F << 8) >> 4;
                lpObj->CharSet[1] = 0xFF;
        }
        else {
                lpObj->CharSet[12] |= (lpObj->pInventory[EQUIPMENT_WEAPON_RIGHT].m_Type & (0x0F << 8)) >> 4;
                lpObj->CharSet[1] = (lpObj->pInventory[EQUIPMENT_WEAPON_RIGHT].m_Type) & 0xFF;
        }

        if (lpObj->pInventory[EQUIPMENT_WEAPON_LEFT].m_Type < 0) {
                lpObj->CharSet[13] |= (0x0F << 8) >> 4;
                lpObj->CharSet[2] = 0xFF;
        }
        else {
                lpObj->CharSet[13] |= (lpObj->pInventory[EQUIPMENT_WEAPON_LEFT].m_Type & (0x0F << 8)) >> 4;
                lpObj->CharSet[2] = (lpObj->pInventory[EQUIPMENT_WEAPON_LEFT].m_Type) & 0xFF;
        }

        if (lpObj->pInventory[EQUIPMENT_HELM].m_Type < 0) {
                lpObj->CharSet[13] |= 0x1E0 >> 5;
                lpObj->CharSet[9] |= 0x10 << 3;
                lpObj->CharSet[3] |= 0x0F << 4;
        }
        else{
                lpObj->CharSet[13] |= ((lpObj->pInventory[EQUIPMENT_HELM].m_Type) & 0x1E0) >> 5;
                lpObj->CharSet[9] |= ((lpObj->pInventory[EQUIPMENT_HELM].m_Type) & 0x10) << 3;
                lpObj->CharSet[3] |= ((lpObj->pInventory[EQUIPMENT_HELM].m_Type) & 0x0F) << 4;
        }

        if (lpObj->pInventory[EQUIPMENT_ARMOR].m_Type < 0) {
                lpObj->CharSet[14] |= 0x1E0 >> 1;
                lpObj->CharSet[9] |= 0x10 << 2;
                lpObj->CharSet[3] |= 0x0F;
        }
        else{
                lpObj->CharSet[14] |= ((lpObj->pInventory[EQUIPMENT_ARMOR].m_Type) & 0x1E0) >> 1;
                lpObj->CharSet[9] |= ((lpObj->pInventory[EQUIPMENT_ARMOR].m_Type) & 0x10) << 2;
                lpObj->CharSet[3] |= (lpObj->pInventory[EQUIPMENT_ARMOR].m_Type) & 0x0F;
        }

        if (lpObj->pInventory[EQUIPMENT_PANTS].m_Type < 0) {
                lpObj->CharSet[14] |= 0x1E0 >> 5;
                lpObj->CharSet[9] |= 0x10 << 1;
                lpObj->CharSet[4] |= 0x0F << 4;
        }
        else{
                lpObj->CharSet[14] |= ((lpObj->pInventory[EQUIPMENT_PANTS].m_Type) & 0x1E0) >> 5;
                lpObj->CharSet[9] |= ((lpObj->pInventory[EQUIPMENT_PANTS].m_Type) & 0x10) << 1;
                lpObj->CharSet[4] |= ((lpObj->pInventory[EQUIPMENT_PANTS].m_Type) & 0x0F) << 4;
        }

        if (lpObj->pInventory[EQUIPMENT_GLOVES].m_Type < 0) {
                lpObj->CharSet[15] |= 0x1E0 >> 1;
                lpObj->CharSet[9] |= 0x10;
                lpObj->CharSet[4] |= 0x0F;
        }
        else{
                lpObj->CharSet[15] |= ((lpObj->pInventory[EQUIPMENT_GLOVES].m_Type) & 0x1E0) >> 1;
                lpObj->CharSet[9] |= (lpObj->pInventory[EQUIPMENT_GLOVES].m_Type) & 0x10;
                lpObj->CharSet[4] |= (lpObj->pInventory[EQUIPMENT_GLOVES].m_Type) & 0x0F;
        }

        if (lpObj->pInventory[EQUIPMENT_BOOTS].m_Type < 0) {
                lpObj->CharSet[15] |= 0x1E0 >> 5;
                lpObj->CharSet[9] |= 0x10 >> 1;
                lpObj->CharSet[5] |= 0x0F << 4;
        }
        else{
                lpObj->CharSet[15] |= ((lpObj->pInventory[EQUIPMENT_BOOTS].m_Type) & 0x1E0) >> 5;
                lpObj->CharSet[9] |= ((lpObj->pInventory[EQUIPMENT_BOOTS].m_Type) & 0x10) >> 1;
                lpObj->CharSet[5] |= ((lpObj->pInventory[EQUIPMENT_BOOTS].m_Type) & 0x0F) << 4;
        }

        index = 0;

        // 朝俺客 秋欺绰 2厚飘究
        if (lpObj->pInventory[EQUIPMENT_WING].m_Type < 0)
                index = 0;
       
        if (lpObj->pInventory[EQUIPMENT_HELPER].m_Type != ITEMGET(13, 4))
        {
                if (lpObj->pInventory[EQUIPMENT_HELPER].m_Type < 0) index |= 0x03;
                else if (lpObj->pInventory[EQUIPMENT_HELPER].m_Type != ITEMGET(13, 67) && lpObj->pInventory[EQUIPMENT_HELPER].m_Type != ITEMGET(13, 123))
                {
                        index |= (lpObj->pInventory[EQUIPMENT_HELPER].m_Type & 0x03);
                }
                // 鲁道夫
                // 幼龙骨架
        }
        else
        {
                // 黑王马之角
                index |= 0x03;
        }
        lpObj->CharSet[5] |= index;

        int levelindex;

        levelindex  = ((int)LevelSmallConvert(aIndex, 0));
        levelindex |= ((int)LevelSmallConvert(aIndex, 1) << 3);
        levelindex |= ((int)LevelSmallConvert(aIndex, 2) << 6);
        levelindex |= ((int)LevelSmallConvert(aIndex, 3) << 9);
        levelindex |= ((int)LevelSmallConvert(aIndex, 4) << 12);
        levelindex |= ((int)LevelSmallConvert(aIndex, 5) << 15);
        levelindex |= ((int)LevelSmallConvert(aIndex, 6) << 18);

        lpObj->CharSet[6] = LOBYTE(HIWORD(levelindex));
        lpObj->CharSet[7] = HIBYTE(levelindex);
        lpObj->CharSet[8] = LOBYTE(levelindex);

        WING_TYPE enWingType = GetWingType(lpObj->pInventory[EQUIPMENT_WING].m_Type, WCF_ITEMNUMBER);
        switch (enWingType)
        {
        case FIRST_WING :
                lpObj->CharSet[5] |= 0x04;
                if (lpObj->pInventory[EQUIPMENT_WING].m_Type == ITEMGET(12, 41))
                {
                        // 灾难之翼
                        lpObj->CharSet[9] |= 0x04;
                }
                else
                {
                        lpObj->CharSet[9] |= (BYTE)ITEM_GET_INDEX(lpObj->pInventory[EQUIPMENT_WING].m_Type) + 1;
                }
                break;
        case SECOND_WING :
                lpObj->CharSet[5] |= 0x08;
                switch (lpObj->pInventory[EQUIPMENT_WING].m_Type)
                {
                case ITEMGET(13, 30) :        // 王者披风
                        lpObj->CharSet[9] |= 0x05;
                        break;
                case ITEMGET(12, 42) :        // 绝望之翼
                        lpObj->CharSet[9] |= 0x06;
                        break;
                case ITEMGET(12, 49) :        // 武者披风
                        lpObj->CharSet[9] |= 0x07;
                        break;
                default :
                        lpObj->CharSet[9] |= (BYTE)ITEM_GET_INDEX(lpObj->pInventory[EQUIPMENT_WING].m_Type) - 2;
                        break;
                }
                break;
        case THIRD_WING :
                lpObj->CharSet[5] |= 0x0C;
                if (lpObj->pInventory[EQUIPMENT_WING].m_Type == ITEMGET(12, 43))
                {
                        // 次元之翼
                        lpObj->CharSet[9] |= 0x06;
                }
                else if (lpObj->pInventory[EQUIPMENT_WING].m_Type == ITEMGET(12, 50))
                {
                        // 斗皇披风
                        lpObj->CharSet[9] |= 0x07;
                }
                else
                {
                        lpObj->CharSet[9] |= (BYTE)ITEM_GET_INDEX(lpObj->pInventory[EQUIPMENT_WING].m_Type) - 35;
                }
                break;
        case LITTLE_WING :
                lpObj->CharSet[5] |= 0x0C;
                lpObj->CharSet[9] &= 0xF8;
                break;
        case MONSTER_WING :
                lpObj->CharSet[5] |= 0x08;
                lpObj->CharSet[9] &= 0xF8;
                break;
        case CHAOSCASTLE_WING :
                lpObj->CharSet[5] |= 0x04;
                lpObj->CharSet[9] |= 0x05;
                break;
        case GOODANDDEVIL_WING :
                lpObj->CharSet[5] |= 0x04;
                lpObj->CharSet[9] |= 0x06;
                break;
        default :
                lpObj->CharSet[5] &= 0xF3;
                lpObj->CharSet[9] &= 0xF8;
                break;
        }

本文出自 7j45 > 奇迹一条龙