Exemplo n.º 1
0
 void Opcode80A9::_run()
 {
     Logger::debug("SCRIPT") << "[80A9] [+] void override_map_start(int x, int y, int elevation, int orientation)" << std::endl;
     auto orientation = _script->dataStack()->popInteger();
     auto elevation = _script->dataStack()->popInteger();
     auto y = _script->dataStack()->popInteger();
     auto x = _script->dataStack()->popInteger();
     auto position = y*200 + x;
     auto game = Game::Game::getInstance();
     auto player = game->player();
     auto hexagon = game->locationState()->hexagonGrid()->at(position);
     Game::getInstance()->locationState()->moveObjectToHexagon(player, hexagon);
                 //player->setPosition(position);
     player->setOrientation(orientation);
     player->setElevation(elevation);
     Game::Game::getInstance()->locationState()->centerCameraAtHexagon(player->hexagon());
 }
Exemplo n.º 2
0
 void Opcode80A7::_run()
 {
     Logger::debug("SCRIPT") << "[80A7] [+] GameObject* tile_contains_pid_obj(int position, int elevation, int PID)" << std::endl;
     auto PID = _script->dataStack()->popInteger();
     auto elevation = _script->dataStack()->popInteger();
     auto position = _script->dataStack()->popInteger();
     auto game = Game::getInstance();
     Game::Object* found = nullptr;
     for (auto object : *game->locationState()->hexagonGrid()->at(position)->objects())
     {
         if (object->PID() == PID && object->elevation() == elevation)
         {
             found = object;
             break;
         }
     }
     _script->dataStack()->push(found);
 }
Exemplo n.º 3
0
void CursorDropdown::showMenu()
{
    int i = 0;
    for (auto icon : _icons)
    {
        std::string activeSurface;
        std::string inactiveSurface;
        switch (icon)
        {
            case Mouse::ICON_INVENTORY:
                activeSurface = "invenh.frm";
                inactiveSurface = "invenn.frm";
                break;
            case Mouse::ICON_CANCEL:
                activeSurface = "cancelh.frm";
                inactiveSurface = "canceln.frm";
                break;
            case Mouse::ICON_ROTATE:
                activeSurface = "rotateh.frm";
                inactiveSurface = "rotaten.frm";
                break;
            case Mouse::ICON_SKILL:
                activeSurface = "skillh.frm";
                inactiveSurface = "skilln.frm";
                break;
            case Mouse::ICON_LOOK:
                activeSurface = "lookh.frm";
                inactiveSurface = "lookn.frm";
                break;
            case Mouse::ICON_TALK:
                activeSurface = "talkh.frm";
                inactiveSurface = "talkn.frm";
                break;
            case Mouse::ICON_PUSH:
                activeSurface = "pushh.frm";
                inactiveSurface = "pushn.frm";
                break;
            case Mouse::ICON_UNLOAD:
                activeSurface = "unloadh.frm";
                inactiveSurface = "unloadn.frm";
                break;
            case Mouse::ICON_USE:
                activeSurface = "usegeth.frm";
                inactiveSurface = "usegetn.frm";
                break;
            default:
                throw Exception("CursorDropdown::init() - unknown icon type");

        }
        _activeIcons.push_back(new Image("art/intrface/" + activeSurface));
        _activeIcons.back()->setY(40*i);
        _inactiveIcons.push_back(new Image("art/intrface/" + inactiveSurface));
        _inactiveIcons.back()->setY(40*i);
        i++;
    }

    auto game = Game::getInstance();
    _surface = new Image(40, 40*_icons.size());
    _surface->setX(_initialX + 29);
    _surface->setY(_initialY);
    int deltaX = _surface->x() + _surface->width() - game->renderer()->width();
    int deltaY = _surface->y() + _surface->height() - game->renderer()->height() + game->locationState()->playerPanelState()->height();
    if (deltaX > 0)
    {
        _surface->setX(_surface->x() - 40 - 29 - 29);
        _cursor = new Image("art/intrface/actarrom.frm");
        _cursor->setXOffset(-29);
        _cursor->setYOffset(0);
    }
    else
    {
        _cursor = new Image("art/intrface/actarrow.frm");
        _cursor->setXOffset(0);
        _cursor->setYOffset(0);
    }
    if (deltaY > 0)
    {
        _surface->setY(_surface->y() - deltaY);
    }
    _cursor->setX(_initialX);
    _cursor->setY(_initialY);
    addUI(_cursor);
    addUI(_surface);
    // draw icons on the surface for the first time
    for (auto ui : _inactiveIcons)
    {
        ui->texture()->copyTo(_surface->texture(), ui->x(), ui->y());
    }
    if (!_onlyShowIcon)
    {
        if (deltaY > 0)
        {
            game->mouse()->setX(_initialX);
            game->mouse()->setY(_surface->y());
        }
        Game::getInstance()->mixer()->playACMSound("sound/sfx/iaccuxx1.acm");
        _activeIcons.at(0)->texture()->copyTo(_surface->texture(), 0,  0); // highlight first item
    }
}
 void Opcode80B8::_run() {
     Logger::debug("SCRIPT") << "[80B8] [*] void display_msg(string)" << std::endl;
     auto value = _script->dataStack()->pop();
     auto game = Game::getInstance();
     game->locationState()->displayMessage(value.toString());
 }