Ejemplo n.º 1
0
FpsCounter::FpsCounter(int x, int y) : TextArea(x,y)
{
    _lastTicks = SDL_GetTicks();
    _frames = 0;
    setText(_frames);
    setWidth(40);
    setHorizontalAlign(TextArea::HORIZONTAL_ALIGN_RIGHT);
}
Ejemplo n.º 2
0
void Credits::init()
{
    if (_initialized) return;
    State::init();

    setModal(true);
    setFullscreen(true);

    Game::getInstance()->mouse()->pushState(Input::Mouse::Cursor::NONE);
    auto renderer = Game::getInstance()->renderer();
    setPosition(Point((renderer->size().width() - 640) / 2, renderer->size().height()));

    auto credits = ResourceManager::getInstance()->datFileItem("text/english/credits.txt");
    std::stringstream ss;
    credits->setPosition(0);
    ss << credits;
    std::string line;

    auto font_default = ResourceManager::getInstance()->font("font4.aaf", 0x907824ff);
    auto font_at = ResourceManager::getInstance()->font("font3.aaf", 0x706050ff);
    auto font_hash = ResourceManager::getInstance()->font("font4.aaf", 0x8c8c84ff);

    int y = 0;
    while (std::getline(ss, line))
    {
        Font* cur_font = font_default;
        int additionalGap = 0;
        if (line.find('\r') != std::string::npos)
        {
            line.erase(line.find('\r'));
        }
        if (line[0] == '#')
        {
            line.erase(line.begin());
            cur_font = font_hash;
        }
        else if (line[0] == '@')
        {
            line.erase(line.begin());
            cur_font = font_at;
            additionalGap = 6;
        }
        else if (line.empty())
        {
            line = "    ";
        }

        auto tx = new UI::TextArea(line, 0, y);
        tx->setFont(cur_font);
        tx->setSize({640, 0});
        tx->setHorizontalAlign(UI::TextArea::HorizontalAlign::CENTER);
        addUI(tx);
        _lines.push_back(tx);
        y += tx->textSize().height() + cur_font->verticalGap() + additionalGap;
    }
    _lastTicks=SDL_GetTicks();
}
Ejemplo n.º 3
0
TextArea::TextArea(TextArea* textArea, int x, int y) : InteractiveSurface(0, 0, x, y)
{
    init();
    setText(textArea->text());
    setColor(textArea->color());
    setHorizontalAlign(textArea->horizontalAlign());
    setVerticalAlign(textArea->verticalAlign());
    if (textArea->_width) setWidth(textArea->width());
    if (textArea->_height) setWidth(textArea->height());
    setFont(textArea->font()->filename());
    setWordWrap(textArea->wordWrap());
}
Ejemplo n.º 4
0
void PlayerEditAlertState::init()
{
    State::init();
    setFullscreen(false);
    setModal(true);

    auto bg = new Image("art/intrface/lgdialog.frm");

    auto bgX = (Game::getInstance()->renderer()->width() - 640)*0.5;
    auto bgY = (Game::getInstance()->renderer()->height() - 480)*0.5;

    bg->setX(bgX+164);
    bg->setY(bgY+173);

    auto font1_ff9f48ff = ResourceManager::font("font1.aaf", 0xff9f48ff);

    auto message = new TextArea(_message.c_str(), bgX+194, bgY+213);
    message->setWidth(250);
    message->setHorizontalAlign(TextArea::HORIZONTAL_ALIGN_CENTER);
    message->setFont(font1_ff9f48ff);

    auto doneBox = new Image("art/intrface/donebox.frm");
    doneBox->setX(bgX+254);
    doneBox->setY(bgY+270);

    auto doneButton = new ImageButton(ImageButton::TYPE_SMALL_RED_CIRCLE, bgX+264, bgY+273);
    doneButton->addEventHandler("mouseleftclick", this, (EventRecieverMethod) &PlayerEditAlertState::onDoneButtonClick);

    auto msg = ResourceManager::msgFileType("text/english/game/editor.msg");
    auto doneLabel = new TextArea(msg->message(100), bgX+284, bgY+273);
    auto font3_b89c28ff = ResourceManager::font("font3.aaf", 0xb89c28ff);
    doneLabel->setFont(font3_b89c28ff);

    addUI(bg);
    addUI(message);
    addUI(doneBox);
    addUI(doneButton);
    addUI(doneLabel);
}
Ejemplo n.º 5
0
void Opcode810AHandler::_run()
{
    Logger::debug("SCRIPT") << "[810A] [=] void float_msg(object who, string msg, int type) " << std::endl;
    int type = _vm->dataStack()->popInteger();
    unsigned int color = 0x000000ff;
    switch (type)
    {
        case -2:
            // CAPITAL RED LETTERS  FF 00 00
            color = 0xff0000ff;
            break;
        case -1:
            // Self-rotating colors @todo
            color = 0xff0000ff; // temporary taken from -2
            break;
        case 0:
        case 8:
        case 13:
            color = 0xffff7fff;
            break;
        case 1:
        case 5:
        case 10:
            color = 0x555555ff;
            break;
        case 2:
            color = 0xff0000ff;
            break;
        case 3:
            color = 0x3cfb00ff;
            break;
        case 4:
            color = 0x30598eff;
            break;
        case 6:
            color = 0xa2a2a2ff;
            break;
        case 7:
            color = 0xff4949ff;
            break;
        case 9:
            color = 0xffffffff;
            break;
        case 11:
            color = 0x3c3c3cff;
            break;
        case 12:
            color = 0x757575ff;
            break;
        default:
            _error("float_msg - wrong type: " + std::to_string(type));
    }

    auto string = _vm->dataStack()->popString();
    auto object = _vm->dataStack()->popObject();

    auto floatMessage = new UI::TextArea(string);
    floatMessage->setWidth(200);
    floatMessage->setWordWrap(true);
    floatMessage->setHorizontalAlign(UI::TextArea::HorizontalAlign::CENTER);
    floatMessage->setOutline(true);
    floatMessage->setOutlineColor(0x000000ff);
    floatMessage->setFont(ResourceManager::getInstance()->font("font1.aaf", color));
    object->setFloatMessage(floatMessage);

}
Ejemplo n.º 6
0
void GameMenu::init()
{
    if (_initialized) return;
    State::init();

    setModal(true);
    setFullscreen(false);

    auto background = new UI::Image("art/intrface/opbase.frm");
    auto panelHeight = Game::getInstance()->locationState()->playerPanel()->size().height();

    auto backgroundPos = (Game::getInstance()->renderer()->size() - background->size() - Point(0, panelHeight)) / 2;
    int backgroundX = backgroundPos.x();
    int backgroundY = backgroundPos.y();

    auto saveGameButton    = new UI::ImageButton(UI::ImageButton::Type::OPTIONS_BUTTON, backgroundX+14, backgroundY+18);
    auto loadGameButton    = new UI::ImageButton(UI::ImageButton::Type::OPTIONS_BUTTON, backgroundX+14, backgroundY+18+37);
    auto preferencesButton = new UI::ImageButton(UI::ImageButton::Type::OPTIONS_BUTTON, backgroundX+14, backgroundY+18+37*2);
    auto exitGameButton    = new UI::ImageButton(UI::ImageButton::Type::OPTIONS_BUTTON, backgroundX+14, backgroundY+18+37*3);
    auto doneButton        = new UI::ImageButton(UI::ImageButton::Type::OPTIONS_BUTTON, backgroundX+14, backgroundY+18+37*4);

    preferencesButton->mouseClickHandler().add([this](Event::Event* event){ this->doPreferences(); });
    exitGameButton->mouseClickHandler().add(   [this](Event::Event* event){ this->doExit(); });
    doneButton->mouseClickHandler().add(       [this](Event::Event* event){ this->closeMenu(); });

    auto font = ResourceManager::getInstance()->font("font3.aaf", 0xb89c28ff);

    // label: save game
    auto saveGameButtonLabel = new UI::TextArea(_t(MSG_OPTIONS, 0), backgroundX+8, backgroundY+26);
    saveGameButtonLabel->setFont(font);
    saveGameButtonLabel->setSize({150, 0});
    saveGameButtonLabel->setHorizontalAlign(UI::TextArea::HorizontalAlign::CENTER);
    saveGameButton->mouseClickHandler().add([this](Event::Event* event){ this->doSaveGame(); });

    // label: load game
    auto loadGameButtonLabel = new UI::TextArea(_t(MSG_OPTIONS, 1), backgroundX+8, backgroundY+26+37);
    loadGameButtonLabel->setFont(font);
    loadGameButtonLabel->setSize({150, 0});
    loadGameButtonLabel->setHorizontalAlign(UI::TextArea::HorizontalAlign::CENTER);
    loadGameButton->mouseClickHandler().add([this](Event::Event* event){ this->doLoadGame(); });

    // label: preferences
    auto preferencesButtonLabel = new UI::TextArea(_t(MSG_OPTIONS, 2), backgroundX+8, backgroundY+26+37*2);
    preferencesButtonLabel->setFont(font);
    preferencesButtonLabel->setSize({150, 0});
    preferencesButtonLabel->setHorizontalAlign(UI::TextArea::HorizontalAlign::CENTER);

    // label: exit game
    auto exitGameButtonLabel = new UI::TextArea(_t(MSG_OPTIONS, 3), backgroundX+8, backgroundY+26+37*3);
    exitGameButtonLabel->setFont(font);
    exitGameButtonLabel->setSize({150, 0});
    exitGameButtonLabel->setHorizontalAlign(UI::TextArea::HorizontalAlign::CENTER);

    // label: done
    auto doneButtonLabel = new UI::TextArea(_t(MSG_OPTIONS, 4), backgroundX+8, backgroundY+26+37*4);
    doneButtonLabel->setFont(font);
    doneButtonLabel->setSize({150, 0});
    doneButtonLabel->setHorizontalAlign(UI::TextArea::HorizontalAlign::CENTER);

    background->setPosition(backgroundPos);

    addUI(background);
    addUI(saveGameButton);
    addUI(loadGameButton);
    addUI(preferencesButton);
    addUI(exitGameButton);
    addUI(doneButton);
    addUI(saveGameButtonLabel);
    addUI(loadGameButtonLabel);
    addUI(preferencesButtonLabel);
    addUI(exitGameButtonLabel);
    addUI(doneButtonLabel);
}
Ejemplo n.º 7
0
        void SettingsMenu::init()
        {
            if (_initialized) return;
            State::init();

            setModal(true);
            setFullscreen(true);

            // background
            auto background = new UI::Image("art/intrface/prefscrn.frm");
            Point backgroundPos = Point((Game::getInstance()->renderer()->size() - background->size()) / 2);
            int backgroundX = backgroundPos.x();
            int backgroundY = backgroundPos.y();
            background->setPosition(backgroundPos);
            addUI(background);

            auto settings = Game::getInstance()->settings();

            // Switches (big)
            auto combatDifficultySwitch = new UI::MultistateImageButton(UI::MultistateImageButton::Type::BIG_SWITCH, backgroundX+76, backgroundY+149);
            combatDifficultySwitch->setMaxState(3);
            combatDifficultySwitch->setState(settings->combatDifficulty());
            addUI("combat_difficulty",combatDifficultySwitch);

            auto gameDifficultySwitch = new UI::MultistateImageButton(UI::MultistateImageButton::Type::BIG_SWITCH, backgroundX+76, backgroundY+71);
            gameDifficultySwitch->setMaxState(3);
            gameDifficultySwitch->setState(settings->gameDifficulty());
            addUI("game_difficulty",gameDifficultySwitch);

            auto violenceLevelSwitch = new UI::MultistateImageButton(UI::MultistateImageButton::Type::BIG_SWITCH, backgroundX+76, backgroundY+227);
            violenceLevelSwitch->setState(settings->violenceLevel());
            addUI("violence_level",violenceLevelSwitch);

            auto targetHighlightSwitch = new UI::MultistateImageButton(UI::MultistateImageButton::Type::BIG_SWITCH, backgroundX+76, backgroundY+309);
            targetHighlightSwitch->setMaxState(3);
            targetHighlightSwitch->setState(settings->targetHighlight());
            addUI("target_highlight",targetHighlightSwitch);

            auto combatLooksSwitch = new UI::MultistateImageButton(UI::MultistateImageButton::Type::BIG_SWITCH, backgroundX+76, backgroundY+387);
            combatLooksSwitch->setMaxState(2);
            combatLooksSwitch->setState(settings->combatLooks());
            addUI("combat_looks",combatLooksSwitch);

            // Switches (small)
            auto combatMessagesSwitch = new UI::MultistateImageButton(UI::MultistateImageButton::Type::SMALL_SWITCH, backgroundX+299, backgroundY+74);
            combatMessagesSwitch->setState(settings->combatMessages());
            addUI("combat_messages",combatMessagesSwitch);

            auto combatTauntsSwitch = new UI::MultistateImageButton(UI::MultistateImageButton::Type::SMALL_SWITCH, backgroundX+299, backgroundY+74+66);
            combatTauntsSwitch->setState(settings->combatTaunts());
            addUI("combat_taunts",combatTauntsSwitch);

            auto languageFilterSwitch = new UI::MultistateImageButton(UI::MultistateImageButton::Type::SMALL_SWITCH, backgroundX+299, backgroundY+74+66*2);
            languageFilterSwitch->setState(settings->languageFilter());
            addUI("language_filter",languageFilterSwitch);

            auto runningSwitch = new UI::MultistateImageButton(UI::MultistateImageButton::Type::SMALL_SWITCH, backgroundX+299, backgroundY+74+66*3);
            runningSwitch->setState(settings->running());
            addUI("running",runningSwitch);

            auto subtitlesSwitch = new UI::MultistateImageButton(UI::MultistateImageButton::Type::SMALL_SWITCH, backgroundX+299, backgroundY+74+66*4);
            subtitlesSwitch->setState(settings->subtitles());
            addUI("subtitles",subtitlesSwitch);

            auto itemHightlightSwitch = new UI::MultistateImageButton(UI::MultistateImageButton::Type::SMALL_SWITCH, backgroundX+299, backgroundY+74+66*5);
            itemHightlightSwitch->setState(settings->itemHighlight());
            addUI("item_highlight",itemHightlightSwitch);

            // LABELS
            SDL_Color color = {0x90, 0x78, 0x24, 0xff};

            std::string font1_907824ff = "font1.aaf";
            std::string font3_907824ff = "font3.aaf";
            std::string font4_907824ff = "font4.aaf";

            // GAME PREFERENCES
            _addTextArea(_t(MSG_OPTIONS, 100), backgroundX+74, backgroundY+10)->setFont(font4_907824ff, color);

            // COMBAT DIFFICULTY
            auto difficulty = _addTextArea(_t(MSG_OPTIONS, 101), backgroundX+21, backgroundY+48);
            difficulty->setWidth(158);
            difficulty->setHorizontalAlign(UI::TextArea::HorizontalAlign::CENTER);
            difficulty->setFont(font3_907824ff, color);

            // GAME DIFFICULTY
            _addTextArea(difficulty, backgroundX+21, backgroundY+48+77)->setText(_t(MSG_OPTIONS, 102));

            // VIOLENCE LEVEL
            _addTextArea(difficulty, backgroundX+21, backgroundY+48+156)->setText(_t(MSG_OPTIONS, 103));

            // TARGET HIGHLIGHT
            _addTextArea(difficulty, backgroundX+21, backgroundY+128+158)->setText(_t(MSG_OPTIONS, 104));

            // COMBAT LOOKS
            _addTextArea(difficulty, backgroundX+21, backgroundY+128+235)->setText(_t(MSG_OPTIONS, 105));

            // COMBAT MESSAGES
            auto combatMessages = _addTextArea(_t(MSG_OPTIONS, 106), backgroundX+206, backgroundY+49);
            combatMessages->setFont(font3_907824ff, color);

            // COMBAT TAUNTS
            _addTextArea(combatMessages, backgroundX+206, backgroundY+49+66)->setText(_t(MSG_OPTIONS, 107));

            // LANGUAGE FILTER
            _addTextArea(combatMessages, backgroundX+206, backgroundY+49+66*2)->setText(_t(MSG_OPTIONS, 108));

            // RUNNING
            _addTextArea(combatMessages, backgroundX+206, backgroundY+49+66*3)->setText(_t(MSG_OPTIONS, 109));

            // SUBTITLES
            _addTextArea(combatMessages, backgroundX+206, backgroundY+49+66*4)->setText(_t(MSG_OPTIONS, 110));

            // ITEM HIGHLIGHT
            _addTextArea(combatMessages, backgroundX+206, backgroundY+49+66*5)->setText(_t(MSG_OPTIONS, 111));

            // COMBAT SPEED
            auto combatSpeed = _addTextArea(_t(MSG_OPTIONS, 112), backgroundX+384, backgroundY+19);
            combatSpeed->setFont(font3_907824ff, color);

            // TEXT DELAY
            _addTextArea(combatSpeed, backgroundX+384, backgroundY+95)->setText(_t(MSG_OPTIONS, 113));

            // MASTER AUDIO VOLUME
            _addTextArea(combatSpeed, backgroundX+384, backgroundY+165)->setText(_t(MSG_OPTIONS, 114));

            // MUSIC/MOVIE VOLUME
            _addTextArea(combatSpeed, backgroundX+384, backgroundY+165+51)->setText(_t(MSG_OPTIONS, 115));

            // SOUND EFFECTS VOLUME
            _addTextArea(combatSpeed, backgroundX+384, backgroundY+165+51*2)->setText(_t(MSG_OPTIONS, 116));

            // SPEECH VOLUME
            _addTextArea(combatSpeed, backgroundX+384, backgroundY+165+51*3)->setText(_t(MSG_OPTIONS, 117));

            // BRIGHTNESS LEVEL
            _addTextArea(combatSpeed, backgroundX+384, backgroundY+165+51*4)->setText(_t(MSG_OPTIONS, 118));

            // MOUSE SENSITIVITY
            _addTextArea(combatSpeed, backgroundX+384, backgroundY+165+51*5)->setText(_t(MSG_OPTIONS, 119));

            // DEFAULT BUTTON LABEL
            auto label = _addTextArea(combatSpeed, backgroundX+43, backgroundY+449);
            label->setText(_t(MSG_OPTIONS, 120));
            label->setFont(font3_907824ff, color);

            // DONE BUTTON LABEL
            label = _addTextArea(combatSpeed, backgroundX+169, backgroundY+449);
            label->setText(_t(MSG_OPTIONS, 300));
            label->setFont(font3_907824ff, color);

            // CANCEL BUTTON LABEL
            label = _addTextArea(combatSpeed, backgroundX+283, backgroundY+449);
            label->setText(_t(MSG_OPTIONS, 121));
            label->setFont(font3_907824ff, color);

            // COMBAT DIFFICULTY SWITCH LABELS
            _addTextArea(_t(MSG_OPTIONS, 203), backgroundX+50, backgroundY+81)->setFont(font1_907824ff, color);     // EASY
            _addTextArea(_t(MSG_OPTIONS, 204), backgroundX+81, backgroundY+67)->setFont(font1_907824ff, color);     // NORMAL
            _addTextArea(_t(MSG_OPTIONS, 205), backgroundX+122, backgroundY+81)->setFont(font1_907824ff, color);    // HARD

            // GAME DIFFICULTY SWITCH LABELS
            _addTextArea(_t(MSG_OPTIONS, 206), backgroundX+45, backgroundY+159)->setFont(font1_907824ff, color);    // WIMPY
            _addTextArea(_t(MSG_OPTIONS, 207), backgroundX+83, backgroundY+145)->setFont(font1_907824ff, color);    // NORMAL
            _addTextArea(_t(MSG_OPTIONS, 208), backgroundX+122, backgroundY+159)->setFont(font1_907824ff, color);   // ROUGH

            // VIOLENCE LEVEL SWITCH LABELS
            _addTextArea(_t(MSG_OPTIONS, 214), backgroundX+48, backgroundY+236)->setFont(font1_907824ff, color);    // NONE
            _addTextArea(_t(MSG_OPTIONS, 215), backgroundX+83, backgroundY+222)->setFont(font1_907824ff, color);    // MINIMUM
            _addTextArea(_t(MSG_OPTIONS, 207), backgroundX+122, backgroundY+236)->setFont(font1_907824ff, color);   // NORMAL
            label = _addTextArea(_t(MSG_OPTIONS, 216).insert(8, " "), backgroundX+122, backgroundY+257);
            label->setFont(font1_907824ff, color);
            label->setWidth(50);
            label->setWordWrap(true); // MAXIMUM BLOOD

            // TARGET HIGHLIGHT SWITCH LABELS
            _addTextArea(_t(MSG_OPTIONS, 202), backgroundX+59, backgroundY+319)->setFont(font1_907824ff, color);    // OFF
            _addTextArea(_t(MSG_OPTIONS, 201), backgroundX+95, backgroundY+305)->setFont(font1_907824ff, color);    // ON
            label = _addTextArea(_t(MSG_OPTIONS, 213).insert(10, " "), backgroundX+122, backgroundY+319);
            label->setFont(font1_907824ff, color);
            label->setWidth(60);
            label->setWordWrap(true); // TARGETING ONLY

            // COMBAT LOOKS SWITCH LABELS
            _addTextArea(_t(MSG_OPTIONS, 202), backgroundX+59, backgroundY+397)->setFont(font1_907824ff, color);    // OFF
            _addTextArea(_t(MSG_OPTIONS, 201), backgroundX+95, backgroundY+383)->setFont(font1_907824ff, color);    // ON

            // COMBAT MESSAGES SWITCH LABELS
            auto verboseLabel = _addTextArea(_t(MSG_OPTIONS, 211), backgroundX+203, backgroundY+69);         // VERBOSE
            verboseLabel->setFont(font1_907824ff, color);
            verboseLabel->setHorizontalAlign(UI::TextArea::HorizontalAlign::RIGHT);
            verboseLabel->setWidth(100);
            _addTextArea(_t(MSG_OPTIONS, 212), backgroundX+320, backgroundY+69)->setFont(font1_907824ff, color);    // BRIEF

            // COMBAT TAUNTS SWITCH LABELS
            _addTextArea(verboseLabel, backgroundX+203, backgroundY+69+67)->setText(_t(MSG_OPTIONS, 202)); // OFF
            _addTextArea(_t(MSG_OPTIONS, 201), backgroundX+320, backgroundY+69+67)->setFont(font1_907824ff, color); // ON

            // LANGUAGE FILTER SWITCH LABELS
            _addTextArea(verboseLabel, backgroundX+203, backgroundY+69+67+66)->setText(_t(MSG_OPTIONS, 202)); // OFF
            _addTextArea(_t(MSG_OPTIONS, 201), backgroundX+320, backgroundY+69+67+66)->setFont(font1_907824ff, color); // ON

            // RUNNING SWITCH LABELS
            _addTextArea(verboseLabel, backgroundX+203, backgroundY+69+67+66+64)->setText(_t(MSG_OPTIONS, 209)); // NORMAL
            _addTextArea(_t(MSG_OPTIONS, 219), backgroundX+320, backgroundY+69+67+66+64)->setFont(font1_907824ff, color); // ALWAYS

            // SUBTITLES SWITCH LABELS
            _addTextArea(verboseLabel, backgroundX+203, backgroundY+69+67+66+66+65)->setText(_t(MSG_OPTIONS, 202)); // OFF
            _addTextArea(_t(MSG_OPTIONS, 201), backgroundX+320, backgroundY+69+66+67+66+65)->setFont(font1_907824ff, color); // OFF

            // ITEM HIGHLIGHT SWITCH LABELS
            _addTextArea(verboseLabel, backgroundX+203, backgroundY+69+67+66+64+65+68)->setText(_t(MSG_OPTIONS, 202)); // OFF
            _addTextArea(_t(MSG_OPTIONS, 201), backgroundX+320, backgroundY+69+64+67+66+65+68)->setFont(font1_907824ff, color); // ON

            // AFFECT PLAYER SPEECH
            _addTextArea(_t(MSG_OPTIONS, 122), backgroundX+405, backgroundY+72)->setFont(font1_907824ff, color);

            // COMBAT SPEED SLIDER LABELS
            _addTextArea(_t(MSG_OPTIONS, 209), backgroundX+384, backgroundY+38)->setFont(font1_907824ff, color);      // NORMAL
            auto fastestLabel = _addTextArea(_t(MSG_OPTIONS, 210), backgroundX+524, backgroundY+38);           // FASTEST
            fastestLabel->setFont(font1_907824ff, color);
            fastestLabel->setHorizontalAlign(UI::TextArea::HorizontalAlign::RIGHT);
            fastestLabel->setWidth(100);

            // TEXT DELAY SLIDER LABELS
            _addTextArea(_t(MSG_OPTIONS, 217), backgroundX+384, backgroundY+113)->setFont(font1_907824ff, color);     // SLOW
            _addTextArea(_t(MSG_OPTIONS, 209), backgroundX+484, backgroundY+113)->setFont(font1_907824ff, color);     // NORMAL
            _addTextArea(fastestLabel, backgroundX+524, backgroundY+113)->setText(_t(MSG_OPTIONS, 218));       // FASTER

            // MASTER AUDIO VOLUME SLIDER LABELS
            _addTextArea(_t(MSG_OPTIONS, 202), backgroundX+384, backgroundY+184)->setFont(font1_907824ff, color);     // OFF
            _addTextArea(_t(MSG_OPTIONS, 221), backgroundX+452, backgroundY+184)->setFont(font1_907824ff, color);     // QUIET
            _addTextArea(_t(MSG_OPTIONS, 209), backgroundX+521, backgroundY+184)->setFont(font1_907824ff, color);     // NORMAL
            _addTextArea(fastestLabel, backgroundX+524, backgroundY+184)->setText(_t(MSG_OPTIONS, 222));       // LOUD

            // MUSIC/MOVIE VOLUME SLIDER LABELS
            _addTextArea(_t(MSG_OPTIONS, 202), backgroundX+384, backgroundY+184+51)->setFont(font1_907824ff, color);  // OFF
            _addTextArea(_t(MSG_OPTIONS, 221), backgroundX+452, backgroundY+184+51)->setFont(font1_907824ff, color);  // QUIET
            _addTextArea(_t(MSG_OPTIONS, 209), backgroundX+521, backgroundY+184+51)->setFont(font1_907824ff, color);  // NORMAL
            _addTextArea(fastestLabel, backgroundX+524, backgroundY+184+51)->setText(_t(MSG_OPTIONS, 222));    // LOUD

            // SOUND EFFECTS SLIDER LABELS
            _addTextArea(_t(MSG_OPTIONS, 202), backgroundX+384, backgroundY+184+51*2)->setFont(font1_907824ff, color);// OFF
            _addTextArea(_t(MSG_OPTIONS, 221), backgroundX+452, backgroundY+184+51*2)->setFont(font1_907824ff, color);// QUIET
            _addTextArea(_t(MSG_OPTIONS, 209), backgroundX+521, backgroundY+184+51*2)->setFont(font1_907824ff, color);// NORMAL
            _addTextArea(fastestLabel, backgroundX+524, backgroundY+184+51*2)->setText(_t(MSG_OPTIONS, 222));  // LOUD

            // SPEECH VOLUME SLIDER LABELS
            _addTextArea(_t(MSG_OPTIONS, 202), backgroundX+384, backgroundY+184+51*3)->setFont(font1_907824ff, color);// OFF
            _addTextArea(_t(MSG_OPTIONS, 221), backgroundX+452, backgroundY+184+51*3)->setFont(font1_907824ff, color);// QUIET
            _addTextArea(_t(MSG_OPTIONS, 209), backgroundX+521, backgroundY+184+51*3)->setFont(font1_907824ff, color);// NORMAL
            _addTextArea(fastestLabel, backgroundX+524, backgroundY+184+51*3)->setText(_t(MSG_OPTIONS, 222));  // LOUD

            // BRIGHTNESS LEVEL SLIDER LABELS
            _addTextArea(_t(MSG_OPTIONS, 209), backgroundX+384, backgroundY+184+51*4)->setFont(font1_907824ff, color);// NORMAL
            _addTextArea(fastestLabel, backgroundX+524, backgroundY+184+51*4)->setText(_t(MSG_OPTIONS, 223));  // BRIGHTER

            // MOUSE SENSITIVITY SLIDER LABELS
            _addTextArea(_t(MSG_OPTIONS, 209), backgroundX+384, backgroundY+184+51*5)->setFont(font1_907824ff, color);// NORMAL
            _addTextArea(fastestLabel, backgroundX+524, backgroundY+184+51*5)->setText(_t(MSG_OPTIONS, 218));  // FASTER

            // BUTTONS

            // button: Default
            auto defaultButton = new UI::ImageButton(UI::ImageButton::Type::SMALL_RED_CIRCLE, backgroundX+23, backgroundY+450);
            defaultButton->mouseClickHandler().add(std::bind(&SettingsMenu::onDefaultButtonClick, this, std::placeholders::_1));
            addUI(defaultButton);

            // button: Done
            auto doneButton = new UI::ImageButton(UI::ImageButton::Type::SMALL_RED_CIRCLE, backgroundX+148, backgroundY+450);
            doneButton->mouseClickHandler().add([this](Event::Event* event){ this->doSave(); });
            addUI(doneButton);

            // button: Cancel
            auto cancelButton = new UI::ImageButton(UI::ImageButton::Type::SMALL_RED_CIRCLE, backgroundX+263, backgroundY+450);
            cancelButton->mouseClickHandler().add([this](Event::Event* event){ this->doCancel(); });
            addUI(cancelButton);

            // button: Affect player speed
            auto affectPlayerSpeedCheckBox = new UI::ImageButton(UI::ImageButton::Type::CHECKBOX, backgroundX+383, backgroundY+68);
            affectPlayerSpeedCheckBox->setChecked(settings->playerSpeedup());
            addUI("player_speedup", affectPlayerSpeedCheckBox);

            // SLIDERS
            // COMBAT SPEED SLIDER
            auto combatSpeedSlider = new UI::Slider(backgroundX+384, backgroundY+50);
            combatSpeedSlider->setMinValue(0.0);
            combatSpeedSlider->setMaxValue(50.0);
            combatSpeedSlider->setValue(settings->combatSpeed());
            addUI("combat_speed",combatSpeedSlider);

            // TEXT DELAY SLIDER
            auto textDelaySlider = new UI::Slider(backgroundX+384, backgroundY+125);
            textDelaySlider->setValue(settings->textDelay());
            addUI("text_delay",textDelaySlider);

            // MASTER AUDIO VOLUME SLIDER
            auto masterAudioVolumeSlider = new UI::Slider(backgroundX+384, backgroundY+196);
            masterAudioVolumeSlider->setValue(settings->masterVolume());
            addUI("master_volume", masterAudioVolumeSlider);

            // MUSIC VOLUME SLIDER
            auto musicVolumeSlider = new UI::Slider(backgroundX+384, backgroundY+196+51);
            musicVolumeSlider->setValue(settings->musicVolume());
            addUI("music_volume", musicVolumeSlider);
            musicVolumeSlider->changeHandler().add([=](Event::Event* evt)
            {
                Game::getInstance()->mixer()->setMusicVolume(musicVolumeSlider->value());
            });

            // SOUND EFFECTS VOLUME SLIDER
            auto soundEffectsVolumeSlider = new UI::Slider(backgroundX+384, backgroundY+196+51*2);
            soundEffectsVolumeSlider->setValue(settings->sfxVolume());
            addUI("sfx_volume", soundEffectsVolumeSlider);

            // SPEECH VOLUME SLIDER
            auto speechVolumeSlider = new UI::Slider(backgroundX+384, backgroundY+196+51*3);
            speechVolumeSlider->setValue(settings->voiceVolume());
            addUI("voice_volume", speechVolumeSlider);

            // BRIGHTNESS LEVEL SLIDER
            auto brightnessLevelSlider = new UI::Slider(backgroundX+384, backgroundY+196+51*4);
            brightnessLevelSlider->setValue(settings->brightness());
            addUI("brightness", brightnessLevelSlider);

            // MOUSE SENSITIVITY SLIDER
            auto mouseSensitivitySlider = new UI::Slider(backgroundX+384, backgroundY+196+51*5);
            mouseSensitivitySlider->setValue(settings->mouseSensitivity());
            addUI("mouse_sensitivity",mouseSensitivitySlider);
        }
Ejemplo n.º 8
0
        void Movie::init()
        {
            if (_initialized) return;
            State::init();

            setFullscreen(true);
            setModal(true);

            Game::getInstance()->mouse()->pushState(Input::Mouse::Cursor::NONE);
            auto renderer = Game::getInstance()->renderer();
            setPosition((renderer->size() - Point(640, 320)) / 2);

            auto lst = ResourceManager::getInstance()->lstFileType("data/movies.lst");
            std::string movie = "art/cuts/" + lst->strings()->at(_id);

            auto cfglst = ResourceManager::getInstance()->lstFileType("data/moviecfgs.lst");
            std::string moviecfgfile = "art/cuts/" + cfglst->strings()->at(_id);
            _effects.push_back({0,1, 0, 0, 0, 1});

            if (cfglst->strings()->at(_id)!="reserved.cfg")
            {
                auto moviecfg = ResourceManager::getInstance()->datFileItem(moviecfgfile);
                //parse ini
                moviecfg->setPosition(0);
                std::istream str(moviecfg);
                auto inifile = new Ini::Parser(str);
                auto ini = inifile->parse();
                int total_effects = ini->section("info")->propertyInt("total_effects",0);
                auto effect_frames = ini->section("info")->propertyArray("effect_frames");
                for (int i =0;i<total_effects;i++)
                {
                    unsigned int effect_frame = effect_frames.at(i).intValue();
                    std::string effect_section = effect_frames.at(i).value();
                    int dir = (ini->section(effect_section)->propertyString("fade_type","in") == "in" ? -1 : 1);
                    int steps = ini->section(effect_section)->propertyInt("fade_steps",0);
                    auto colors = ini->section(effect_section)->propertyArray("fade_color");
                    int r = colors[0].intValue()*4;
                    int g = colors[1].intValue()*4;
                    int b = colors[2].intValue()*4;
                    _effects.push_back({effect_frame, dir, r, g, b, steps/15*1000});
                }
            }
            else
            {
                _effects.push_back({1,-1, 0, 0, 0, 1});
            }

            auto sublst = ResourceManager::getInstance()->lstFileType("data/subtitles.lst");
            std::string subfile = "text/english/cuts/" + sublst->strings()->at(_id);

            if (sublst->strings()->at(_id)!="reserved.sve")
            {
                _subs = ResourceManager::getInstance()->sveFileType(subfile);
                if (_subs) _hasSubs = true;
            }
            addUI("movie", new UI::MvePlayer(ResourceManager::getInstance()->mveFileType(movie)));

            auto font0_ffffffff = ResourceManager::getInstance()->font("font1.aaf");
            auto subLabel = new UI::TextArea("", 0, 320+35);

            subLabel->setFont(font0_ffffffff, {0xFF, 0xFF, 0xFF, 0xFF});
            subLabel->setWidth(640);
            subLabel->setHorizontalAlign(UI::TextArea::HorizontalAlign::CENTER);
            addUI("subs",subLabel);

            if (_hasSubs)
                _nextSubLine = _subs->getSubLine(0);
            else
                _nextSubLine = std::pair<int,std::string>(999999,"");
        }
Ejemplo n.º 9
0
void Opcode810AHandler::_run()
{
    Logger::debug("SCRIPT") << "[810A] [=] void float_msg(void* who, string* msg, int type) " << std::endl;
    int type = _vm->popDataInteger();
    unsigned int color;
    switch (type)
    {
        case -2:
            //БОЛЬШИЕ КРАСНЫЕ БУКВЫ	FF 00 00
            color = 0xff0000ff;
            break;
        case -1:
            //Самоперебирающиеся цвета @todo
            color = 0xff0000ff; // временно взят из -2
            break;
        case 0:
        case 8:
        case 13:
            color = 0xffff7fff;
            break;
        case 1:
        case 5:
        case 10:
            color = 0x555555ff;
            break;
        case 2:
            color = 0xff0000ff;
            break;
        case 3:
            color = 0x3cfb00ff;
            break;
        case 4:
            color = 0x30598eff;
            break;
        case 6:
            color = 0xa2a2a2ff;
            break;
        case 7:
            color = 0xff4949ff;
            break;
        case 9:
            color = 0xffffffff;
            break;
        case 11:
            color = 0x3c3c3cff;
            break;
        case 12:
            color = 0x757575ff;
            break;
        default:
            throw Exception("Opcode810AHandler - wrong type: " + std::to_string(type));
    }

    auto string = static_cast<std::string*>(_vm->popDataPointer());
    auto object = static_cast<GameObject*>(_vm->popDataPointer());

    auto floatMessage = new TextArea(*string);
    floatMessage->setWidth(200);
    floatMessage->setWordWrap(true);
    floatMessage->setHorizontalAlign(TextArea::HORIZONTAL_ALIGN_CENTER);
    floatMessage->setFont(ResourceManager::font("font1.aaf", color));
    floatMessage->setOutlineColor(0x000000ff);
    object->setFloatMessage(floatMessage);

}