Exemple #1
0
void SelectMenu::drawAgent()
{
    Agent *selected = g_Session.agents().squadMember(cur_agent_);
    if (selected == NULL)
        return;

    int torso, arms, legs;
    int armsx = 188;
    int armsy = 152;
    int torsoy = 116;
    int legsy = 218;
    if (selected->isMale()) {
        torso = 30;
        arms = 40;
        legs = 32;
    } else {
        torso = 31;
        arms = 44;
        legs = 36;
        armsx += 10;
        armsy += 6;
        torsoy += 2;
        legsy -= 4;
    }

    if (selected->slot(Mod::MOD_LEGS)) {
        legs = selected->slot(Mod::MOD_LEGS)->icon(selected->isMale());
        getMenuFont(FontManager::SIZE_1)->drawText(366, 250,
            selected->slot(Mod::MOD_LEGS)->getName(),
            false);
    }
    if (selected->slot(Mod::MOD_ARMS)) {
        arms = selected->slot(Mod::MOD_ARMS)->icon(selected->isMale());
        getMenuFont(FontManager::SIZE_1)->drawText(366, 226,
            selected->slot(Mod::MOD_ARMS)->getName(),
            false);
    }

    menuSprites().drawSpriteXYZ(arms, armsx, armsy, 0, false, true);
    menuSprites().drawSpriteXYZ(torso, 224, torsoy, 0, false, true);
    menuSprites().drawSpriteXYZ(legs, 224, legsy, 0, false, true);

    if (selected->slot(Mod::MOD_CHEST)) {
        int chest = selected->slot(Mod::MOD_CHEST)->icon(selected->isMale());
        getMenuFont(FontManager::SIZE_1)->drawText(366, 202,
            selected->slot(Mod::MOD_CHEST)->getName(), false);
        int chestx = 216;
        int chesty = 146;
        if (!selected->isMale()) {
            chestx += 8;
            chesty += 2;
        }
        menu_manager_->menuSprites().drawSpriteXYZ(chest, chestx, chesty, 0, false,
                                          true);
    }

    if (selected->slot(Mod::MOD_HEART)) {
        int heart = selected->slot(Mod::MOD_HEART)->icon(selected->isMale());
        getMenuFont(FontManager::SIZE_1)->drawText(366, 160,
            selected->slot(Mod::MOD_HEART)->getName(), false);
        menu_manager_->menuSprites().drawSpriteXYZ(heart, 254, 166, 0, false, true);
    }

    if (selected->slot(Mod::MOD_EYES)) {
        int eyes = selected->slot(Mod::MOD_EYES)->icon(selected->isMale());
        getMenuFont(FontManager::SIZE_1)->drawText(366, 136,
            selected->slot(Mod::MOD_EYES)->getName(), false);
        int eyesx = 238;
        if (!selected->isMale()) {
            eyesx += 2;
        }
        menuSprites().drawSpriteXYZ(eyes, eyesx, 116, 0, false,
                                          true);
    }

    if (selected->slot(Mod::MOD_BRAIN)) {
        int brain = selected->slot(Mod::MOD_BRAIN)->icon(selected->isMale());
        getMenuFont(FontManager::SIZE_1)->drawText(366, 112,
            selected->slot(Mod::MOD_BRAIN)->getName(), false);
        int brainx = 238;
        if (!selected->isMale()) {
            brainx += 2;
        }
        menuSprites().drawSpriteXYZ(brain, brainx, 114, 0, false, true);
    }
    // restore lines over agent
    menu_manager_->blitFromBackground(254, 124, 30, 2);
    menu_manager_->blitFromBackground(264, 132, 30, 2);
    menu_manager_->blitFromBackground(266, 174, 36, 2);
    menu_manager_->blitFromBackground(252, 210, 56, 2);
    menu_manager_->blitFromBackground(302, 232, 10, 2);
    menu_manager_->blitFromBackground(264, 256, 30, 2);

    // write inventory
    for (int j = 0; j < 2; j++)
        for (int i = 0; i < 4
            && (j * 4 + i < selected->numWeapons()); i++)
        {
            WeaponInstance *wi = selected->weapon(j * 4 + i);
            Weapon *pW = wi->getWeaponClass();
            menuSprites().drawSpriteXYZ(pW->getSmallIconId(),
                366 + i * 32, 308 + j * 32, 0, false, true);
            uint8 data[3] = {204, 204, 204};
            if (pW->ammo() != -1) {
                int n = wi->ammoRemaining();
                if (pW->ammo() == 0)
                    n = 24;
                else {
                    n *= 24;
                    n /= pW->ammo();
                }
                for (int k = 0; k < n; k++)
                    g_Screen.scale2x(366 + i * 32 + k + 4,
                                        308 + j * 32 + 22, 1, 3, data);
            }
        }
}
Exemple #2
0
void SelectMenu::drawAgent()
{
    Agent *selected = g_gameCtrl.agents().squadMember(cur_agent_);
    if (selected == NULL)
        return;

    int torso, arms, legs;
    int armsx = 188;
    int armsy = 152;
    int torsoy = 116;
    int legsy = 218;
    if (selected->isMale()) {
        torso = 30;
        arms = 40;
        legs = 32;
    } else {
        torso = 31;
        arms = 44;
        legs = 36;
        armsx += 10;
        armsy += 6;
        torsoy += 2;
        legsy -= 4;
    }

    if (selected->slot(Mod::MOD_LEGS)) {
        legs = selected->slot(Mod::MOD_LEGS)->icon(selected->isMale());
        getMenuFont(FontManager::SIZE_1)->drawText(366, 250,
            selected->slot(Mod::MOD_LEGS)->getName(),
            false);
    }
    if (selected->slot(Mod::MOD_ARMS)) {
        arms = selected->slot(Mod::MOD_ARMS)->icon(selected->isMale());
        getMenuFont(FontManager::SIZE_1)->drawText(366, 226,
            selected->slot(Mod::MOD_ARMS)->getName(),
            false);
    }

    menuSprites().drawSpriteXYZ(arms, armsx, armsy, 0, false, true);
    menuSprites().drawSpriteXYZ(torso, 224, torsoy, 0, false, true);
    menuSprites().drawSpriteXYZ(legs, 224, legsy, 0, false, true);

    if (selected->slot(Mod::MOD_CHEST)) {
        int chest = selected->slot(Mod::MOD_CHEST)->icon(selected->isMale());
        getMenuFont(FontManager::SIZE_1)->drawText(366, 202,
            selected->slot(Mod::MOD_CHEST)->getName(), false);
        int chestx = 216;
        int chesty = 146;
        if (!selected->isMale()) {
            chestx += 8;
            chesty += 2;
        }
        menuSprites().drawSpriteXYZ(chest, chestx, chesty, 0, false,
                                          true);
    }

    if (selected->slot(Mod::MOD_HEART)) {
        int heart = selected->slot(Mod::MOD_HEART)->icon(selected->isMale());
        getMenuFont(FontManager::SIZE_1)->drawText(366, 160,
            selected->slot(Mod::MOD_HEART)->getName(), false);
        menuSprites().drawSpriteXYZ(heart, 254, 166, 0, false, true);
    }

    if (selected->slot(Mod::MOD_EYES)) {
        int eyes = selected->slot(Mod::MOD_EYES)->icon(selected->isMale());
        getMenuFont(FontManager::SIZE_1)->drawText(366, 136,
            selected->slot(Mod::MOD_EYES)->getName(), false);
        int eyesx = 238;
        if (!selected->isMale()) {
            eyesx += 2;
        }
        menuSprites().drawSpriteXYZ(eyes, eyesx, 116, 0, false,
                                          true);
    }

    if (selected->slot(Mod::MOD_BRAIN)) {
        int brain = selected->slot(Mod::MOD_BRAIN)->icon(selected->isMale());
        getMenuFont(FontManager::SIZE_1)->drawText(366, 112,
            selected->slot(Mod::MOD_BRAIN)->getName(), false);
        int brainx = 238;
        if (!selected->isMale()) {
            brainx += 2;
        }
        menuSprites().drawSpriteXYZ(brain, brainx, 114, 0, false, true);
    }
    // restore lines over agent
    menu_manager_->blitFromBackground(254, 124, 30, 2);
    menu_manager_->blitFromBackground(264, 132, 30, 2);
    menu_manager_->blitFromBackground(266, 174, 36, 2);
    menu_manager_->blitFromBackground(252, 210, 56, 2);
    menu_manager_->blitFromBackground(302, 232, 10, 2);
    menu_manager_->blitFromBackground(264, 256, 30, 2);

    // draw inventory
    screenPoint pos[8];
    WeaponInstance * draw_weapons[8];
    for (uint8 i = 0; i < 8; ++i) {
        draw_weapons[i] = NULL;
    }
    for (int j = 0, k = 0; j < 2; ++j)
        for (int i = 0; i < 4 && (j * 4 + i < selected->numWeapons()); ++i)
        {
            // TODO: make weapon to be drawn at end
            WeaponInstance *wi = selected->weapon(j * 4 + i);
            if (wi == weapon_dragged_ && menu_manager_->isMouseDragged()) {
                pos[7] = weapon_pos_;
                draw_weapons[7] = wi;
            } else {
                draw_weapons[k] = wi;
                screenPoint pos_l = {366 + i * 32, 308 + j * 32};
                pos[k] = pos_l;
                ++k;
            }

        }

    for (uint8 i = 0; i < 8; ++i) {
        WeaponInstance *wi = draw_weapons[i];

        if (wi) {
            Weapon *pW = wi->getWeaponClass();
            menuSprites().drawSpriteXYZ(pW->getSmallIconId(),
                pos[i].x, pos[i].y, 0, false, true);
            uint8 data[3] = {204, 204, 204};
            if (pW->ammo() != -1) {
                int n = wi->ammoRemaining();
                if (pW->ammo() == 0)
                    n = 24;
                else {
                    n *= 24;
                    n /= pW->ammo();
                }
                for (int k = 0; k < n; k++)
                    g_Screen.scale2x(pos[i].x + k + 4, pos[i].y + 22, 1, 3, data);
            }
        }
    }
}