Пример #1
0
void MapPosition::store(const cmd::ArgumentList& args) {
    rMessage() << "Storing map position #" << _index << std::endl;
    CamWndPtr camwnd = GlobalCamera().getActiveCamWnd();

    if (camwnd != NULL) {
        _position = camwnd->getCameraOrigin();
        _angle = camwnd->getCameraAngles();

        // Tag the map as modified
        GlobalMap().setModified(true);
    }
    else {
        rError() << "MapPosition: Warning: Couldn't find Camera." << std::endl;
    }
}
Пример #2
0
/* greebo: Saves the current camera position/angles to worldspawn
 */
void Map::saveCameraPosition() {
    const std::string keyLastCamPos = GlobalRegistry().get(RKEY_LAST_CAM_POSITION);
    const std::string keyLastCamAngle = GlobalRegistry().get(RKEY_LAST_CAM_ANGLE);

    if (m_world_node != NULL) {
        // Retrieve the entity from the worldspawn node
        Entity* worldspawn = Node_getEntity(m_world_node);
        assert(worldspawn != NULL); // This must succeed

        CamWndPtr camWnd = GlobalCamera().getActiveCamWnd();
        if (camWnd == NULL) return;

        worldspawn->setKeyValue(keyLastCamPos,
                                string::to_string(camWnd->getCameraOrigin()));
        worldspawn->setKeyValue(keyLastCamAngle,
                                string::to_string(camWnd->getCameraAngles()));
    }
}