Beispiel #1
0
void Menu::handleInfoScreen() {
	debug(DBG_MENU, "Menu::handleInfoScreen()");
	_vid->fadeOut();
	switch (_res->_lang) {
	case LANG_FR:
		loadPicture("instru_f");
		break;
	case LANG_EN:
	case LANG_DE:
	case LANG_SP:
	case LANG_IT:
		loadPicture("instru_e");
		break;
	}
	_vid->fullRefresh();
	_vid->updateScreen();
	do {
		_stub->sleep(EVENTS_DELAY);
		_stub->processEvents();
		if (_stub->_pi.enter) {
			_stub->_pi.enter = false;
			break;
		}
	} while (!_stub->_pi.quit);
}
bool ScImgDataLoader_GMagick::preloadAlphaChannel(const QString& fn, int /*page*/, int res, bool& hasAlpha)
{
	initGraphicsMagick();
	initialize();
	hasAlpha = false;

	if (!QFile::exists(fn))
		return false;

	ExceptionInfo exception;
	GetExceptionInfo(&exception);
	ImageInfo *image_info = CloneImageInfo(0);
	strcpy(image_info->filename, fn.toUtf8().data());
	image_info->units = PixelsPerInchResolution;
	Image *image = PingImage(image_info, &exception);
	if (exception.severity != UndefinedException)
		CatchException(&exception);
	if (!image) {
		qCritical() << "Failed to read image" << fn;
		return false;
	}

	hasAlpha = image->matte;
	if (!hasAlpha) return true;
	return loadPicture(fn, 0, 0, false);
}
Beispiel #3
0
void QgsComposerPicture::refreshPicture( const QgsExpressionContext *context )
{
  const QgsExpressionContext* evalContext = context;
  QScopedPointer< QgsExpressionContext > scopedContext;
  if ( !evalContext )
  {
    scopedContext.reset( createExpressionContext() );
    evalContext = scopedContext.data();
  }

  QString source = mSourcePath;

  //data defined source set?
  mHasExpressionError = false;
  QVariant exprVal;
  if ( dataDefinedProperty( QgsComposerObject::PictureSource )->isActive() )
  {
    if ( dataDefinedEvaluate( QgsComposerObject::PictureSource, exprVal, *evalContext ) )
    {
      source = exprVal.toString().trimmed();
      QgsDebugMsg( QString( "exprVal PictureSource:%1" ).arg( source ) );
    }
    else
    {
      mHasExpressionError = true;
      source = QString();
      QgsMessageLog::logMessage( tr( "Picture expression eval error" ) );
    }
  }

  loadPicture( source );
}
Beispiel #4
0
void SkDebuggerGUI::openFile(const QString &filename) {
    if (!filename.isEmpty()) {
        QFileInfo pathInfo(filename);
        loadPicture(SkString(filename.toAscii().data()));
        setupDirectoryWidget(pathInfo.path());
    }
}
Beispiel #5
0
void QgsLayoutItemPicture::refreshPicture( const QgsExpressionContext *context )
{
  QgsExpressionContext scopedContext = createExpressionContext();
  const QgsExpressionContext *evalContext = context ? context : &scopedContext;

  QString source = mSourcePath;

  //data defined source set?
  mHasExpressionError = false;
  if ( mDataDefinedProperties.isActive( QgsLayoutObject::PictureSource ) )
  {
    bool ok = false;
    source = mDataDefinedProperties.valueAsString( QgsLayoutObject::PictureSource, *evalContext, source, &ok );
    if ( ok )
    {
      source = source.trimmed();
      QgsDebugMsg( QString( "exprVal PictureSource:%1" ).arg( source ) );
    }
    else
    {
      mHasExpressionError = true;
      source = QString();
      QgsMessageLog::logMessage( tr( "Picture expression eval error" ) );
    }
  }

  loadPicture( source );
}
Beispiel #6
0
bool Menu::handlePasswordScreen(DifficultySetting &new_skill, uint8 &new_level) {
    debug(DBG_MENU, "Menu::handlePasswordScreen()");
    _vid->fadeOut();
    _vid->_charShadowColor = _charVar1;
    _vid->_charTransparentColor = 0xFF;
    _vid->_charFrontColor = _charVar4;
    _vid->fullRefresh();
    char password[7];
    int len = 0;
    do {
        loadPicture("menu2");
        drawString2(_res->getMenuString(LocaleData::LI_16_ENTER_PASSWORD1), 15, 3);
        drawString2(_res->getMenuString(LocaleData::LI_17_ENTER_PASSWORD2), 17, 3);

        for (int i = 0; i < len; ++i) {
            _vid->PC_drawChar((uint8)password[i], 21, i + 15);
        }
        _vid->PC_drawChar(0x20, 21, len + 15);

        _vid->markBlockAsDirty(15 * 8, 21 * 8, (len + 1) * 8, 8);
        _vid->updateScreen();
        _stub->sleep(EVENTS_DELAY);
        _stub->processEvents();
        char c = _stub->_pi.lastChar;
        if (c != 0) {
            _stub->_pi.lastChar = 0;
            if (len < 6) {
                if (c >= 'a' && c <= 'z') {
                    c &= ~0x20;
                }
                if ((c >= 'A' && c <= 'Z') || (c == 0x20)) {
                    password[len] = c;
                    ++len;
                }
            }
        }
        if (_stub->_pi.backspace) {
            _stub->_pi.backspace = false;
            if (len > 0) {
                --len;
            }
        }
        if (_stub->_pi.enter) {
            _stub->_pi.enter = false;
            password[len] = '\0';
            for (int level = 0; level < 8; ++level) {
                for (int skill = 0; skill < 3; ++skill) {
                    if (strcmp(_passwords[level][skill], password) == 0) {
                        new_level = level;
                        new_skill = (DifficultySetting)skill;
                        return true;
                    }
                }
            }
            return false;
        }
    } while (!_stub->_pi.quit);
    return false;
}
Beispiel #7
0
void QgsComposerPicture::refreshPicture()
{
  if ( mUseSourceExpression )
  {
    //using expression for picture source file

    //evaluate expression
    QFile path;
    path.setFileName( evalPictureExpression() );
    loadPicture( path );
  }
  else
  {
    //using a static picture path
    loadPicture( mSourceFile );
  }
}
Beispiel #8
0
//--------------------------------------------------------------
void testApp::setup(){

    ofBackground(239,155,15);
    ofEnableAlphaBlending();

    loadPicture();
    font.loadFont("font/GillSans.ttc", 72, true, false, true, 0.1);
    
    
    XML.load("mySettings.xml");
    
    if(XML.getName() == "PHOTO" && XML.setTo("val[0]"))
    {
        do {
            Polaroidframe  photo;
            frames.push_back(photo);
            int x = int(XML.getValue<float>("X")*ofGetWidth());
            int y = int(XML.getValue<float>("Y")*ofGetHeight());
            float w = float(XML.getValue<float>("W")*ofGetWidth());
            
            frames.back().init(x,y,w);
            frames.back().loadPic(images[ofRandom(images.size())]);
            frames.back().setAngle(XML.getValue<int>("A"));
            frames.back().loadFont(font);
            frames.back().loadShadow(shadows[0]);
            frames.back().picName = "Hello";
            frames.back().cityName = "New York";
            frames.back().setLevel(XML.getValue<int>("L"));
            if (XML.getValue<int>("S") == 0) {
                frames.back().setStyle(Polaroidframe::NO_FRAME_1);
                frames.back().loadShadow(shadows[1]);
            }else if (XML.getValue<int>("S") == 1) {
                frames.back().setStyle(Polaroidframe::NO_FRAME_2);
                frames.back().loadShadow(shadows[0]);
            }else if (XML.getValue<int>("S") == 2) {
                frames.back().setStyle(Polaroidframe::FRAME);
                frames.back().loadShadow(shadows[1]);
            }else if (XML.getValue<int>("S") == 3) {
                frames.back().setStyle(Polaroidframe::POLAROID);
                frames.back().loadShadow(shadows[2]);
            }
        }
        while(XML.setToSibling());
        XML.setToParent();
    }
    sortPicture();
    
    Angle =0;
    frameWidth= 0;
    frameStyle = 0;
    shadowNum = 0;
    bTransition = false;
    enable_Debug_Mode = false;
}
Beispiel #9
0
void PicLoader::loadNextPicture()
{
    // загружаем сдедующее по списку директории изображение, если сейчас не граничное
    if (!m_fileList.contains(m_currentFile) || (m_fileList.indexOf(m_currentFile) + 1 >= m_fileList.size()))
    {
        m_viewer->stopLoadAnimation();
        return;
    }

    loadPicture(m_dir.path() + "/" + m_fileList.at(m_fileList.indexOf(m_currentFile) + 1));
}
void CMakeAviDlg::OnItemChangedListNames(NMHDR *pNMHDR, LRESULT *pResult) {
  NM_LISTVIEW *pNMListView = (NM_LISTVIEW*)pNMHDR;

  if((pNMListView->uChanged & LVIF_STATE) && (pNMListView->uNewState & LVNI_SELECTED)) {
    int index = getSelectedIndex();
    if(index >= 0) {
      loadPicture(m_nameArray[index]);
      updatePreview();
    }
  }
  *pResult = 0;
}
Beispiel #11
0
void Map::loadPictures(PictureKind kind,
                                 QHash<int, QOpenGLTexture*>& textures)
{
    SystemPicture* picture;
    QStandardItemModel* model = RPM::get()->project()->picturesDatas()
            ->model(kind);
    for (int i = 0; i < model->invisibleRootItem()->rowCount(); i++){
        picture = (SystemPicture*) model->item(i)->data().value<qintptr>();
        QImage image;
        loadPicture(picture, kind, image);
        textures[picture->id()] = createTexture(image);
    }
}
Beispiel #12
0
Node::Node(NodeType nodeType) : QGraphicsPixmapItem(), is_hovered(false), type(nodeType) {
    myModel = new NodeModel(0);
    stringList.append("TEST1");
    stringList.append("TEST2");
    stringList.append("TEST3");
    stringList.append("TEST4");
    stringList.append("TEST5");

    initDrawingTools();
    loadPicture();
    setAcceptHoverEvents(true);

    setFlag(ItemSendsGeometryChanges);
    setFlag(ItemIsMovable);
    setFlag(ItemIsSelectable);
}
Beispiel #13
0
void loadTextures(){
	//glGenTextures(1, &defaultTex);

	vector<string> files;
	scanDirectory(files,"Textures");


	GLuint temps[files.size()];
	glGenTextures(files.size(),temps);

	for(int x=0;x<files.size();x++){
		loadPicture("Textures/"+files.at(x),temps[x]);
		loadedTextures[files.at(x).substr(0,files.at(x).size()-4)]=temps[x];
	}

}
Beispiel #14
0
void SkDebuggerGUI::loadFile(QListWidgetItem *item) {
    if (item == nullptr) {
        return;
    }

    SkString fileName(fPath.toAscii().data());
    // don't add a '/' to files in the local directory
    if (fileName.size() > 0) {
        fileName.append("/");
    }
    fileName.append(item->text().toAscii().data());

    if (!fileName.equals(fFileName)) {
        fFileName = fileName;
        loadPicture(fFileName);
    }
}
Beispiel #15
0
bool LoadingScene::init(){
	if (!Layer::init())
	{
		return false;
	}
	count = 1;
	//loading picture matter
	loadPicture();
	auto logo = Sprite::create(LOGO_FILENAME);
	logo->setVisible(true);
	logo->setPosition(480, 320);
	this->addChild(logo);

	//loading music matter
	loadMusic();
	return true;
}
void CMakeAviDlg::OnEditDeleteSelected() {
  int index = getSelectedIndex();
  if(index >= 0) {
    m_nameArray.removeIndex(index);
    m_nameList.DeleteItem(index);
    if(m_nameArray.size() > 0) {
      index = min(index, (int)m_nameArray.size()-1);
      loadPicture(m_nameArray[index]);
      if(m_currentPicture.isLoaded()) {
        setSelectedIndex(m_nameList, index);
      }
    } else {
      unloadPicture();
    }
    updateWindowState();
    updatePreview();
  }
}
Beispiel #17
0
void Map::loadSpecialPictures(PictureKind kind,
                              QHash<int, QOpenGLTexture*>& textures)
{
    SystemSpecialElement* special;
    SystemTileset* tileset = m_mapProperties->tileset();
    QStandardItemModel* model = tileset->model(kind);
    QStandardItemModel* modelSpecials = RPM::get()->project()
            ->specialElementsDatas()->model(kind);
    int id;
    for (int i = 0; i < model->invisibleRootItem()->rowCount(); i++) {
        id = ((SuperListItem*) model->item(i)->data().value<qintptr>())->id();
        special = (SystemSpecialElement*) SuperListItem::getById(
                    modelSpecials->invisibleRootItem(), id);
        QImage image;
        loadPicture(special->picture(), kind, image);
        textures[special->id()] = createTexture(image);
    }
    addEmptyPicture(textures);
}
Beispiel #18
0
ChangeSkyboxDialog::ChangeSkyboxDialog(QOpenGLFunctions_3_3_Core* ogl, QWidget *parent)
	:ogl(ogl), QDialog(parent)
{
	ui.setupUi(this);
	this->setModal(true);

	//connect(ui.importMultipleButton, SIGNAL(clicked()), this, SLOT(loadDocument()));
	connect(ui.importSingleButton, SIGNAL(clicked()), this, SLOT(loadPicture()));

	connect(ui.importTopButton, SIGNAL(clicked()), this, SLOT(loadTopPicture()));
	connect(ui.importDownButton, SIGNAL(clicked()), this, SLOT(loadDownPicture()));
	connect(ui.importFrontButton, SIGNAL(clicked()), this, SLOT(loadFrontPicture()));
	connect(ui.importBackButton, SIGNAL(clicked()), this, SLOT(loadBackPicture()));
	connect(ui.importLeftButton, SIGNAL(clicked()), this, SLOT(loadLeftPicture()));
	connect(ui.importRightButton, SIGNAL(clicked()), this, SLOT(loadRightPicture()));

	connect(ui.modifyButton, SIGNAL(clicked()), this, SLOT(accept()));
	connect(ui.cancelButton, SIGNAL(clicked()), this, SLOT(cancel()));

}
Beispiel #19
0
void Menu::handleSkillScreen(DifficultySetting &new_skill) {
    debug(DBG_MENU, "Menu::handleSkillScreen()");
    static const uint8 option_colors[3][3] = { { 2, 3, 3 }, { 3, 2, 3}, { 3, 3, 2 } };
    _vid->fadeOut();
    loadPicture("menu3");
    _vid->fullRefresh();
    drawString(_res->getMenuString(LocaleData::LI_12_SKILL_LEVEL), 12, 4, 3);
    DifficultySetting skill_level = new_skill;
    do {
        drawString(_res->getMenuString(LocaleData::LI_13_EASY), 15, 14, option_colors[skill_level][0]);
        drawString(_res->getMenuString(LocaleData::LI_14_NORMAL), 17, 14, option_colors[skill_level][1]);
        drawString(_res->getMenuString(LocaleData::LI_15_EXPERT), 19, 14, option_colors[skill_level][2]);

        _vid->updateScreen();
        _stub->sleep(EVENTS_DELAY);
        _stub->processEvents();

        if (_stub->_pi.dirMask & PlayerInput::DIR_UP) {
            _stub->_pi.dirMask &= ~PlayerInput::DIR_UP;
            if (skill_level != SKILL_EASY) {
                skill_level = (DifficultySetting)(skill_level - 1);
            } else {
                skill_level = SKILL_HARD;
            }
        }
        if (_stub->_pi.dirMask & PlayerInput::DIR_DOWN) {
            _stub->_pi.dirMask &= ~PlayerInput::DIR_DOWN;
            if (skill_level != SKILL_HARD) {
                skill_level = (DifficultySetting)(skill_level + 1);
            } else {
                skill_level = SKILL_EASY;
            }
        }
        if (_stub->_pi.enter) {
            _stub->_pi.enter = false;
            new_skill = skill_level;
            return;
        }
    } while (!_stub->_pi.quit);
    new_skill = SKILL_NORMAL;
}
Beispiel #20
0
void QgsComposerPicture::refreshPicture()
{
  QString source = mSourcePath;

  //data defined source set?
  mHasExpressionError = false;
  QVariant exprVal;
  if ( dataDefinedProperty( QgsComposerObject::PictureSource )->isActive() )
  {
    if ( dataDefinedEvaluate( QgsComposerObject::PictureSource, exprVal ) )
    {
      source = exprVal.toString().trimmed();
      QgsDebugMsg( QString( "exprVal PictureSource:%1" ).arg( source ) );
    }
    else
    {
      mHasExpressionError = true;
      source = QString();
      QgsMessageLog::logMessage( tr( "Picture expression eval error" ) );
    }
  }

  loadPicture( source );
}
Beispiel #21
0
void setupGL(){
    glClearColor(.2, .3, .4, 0);
    glClearDepth(1.0f);

    glEnable(GL_DEPTH_TEST);

    glViewport(0, 0, 600, 600);

	program=glCreateProgram();
	GLuint vs=loadShader("main.vert.txt",GL_VERTEX_SHADER);
	GLuint fs=loadShader("main.frag.txt",GL_FRAGMENT_SHADER);

	glAttachShader(program,vs);
	glAttachShader(program,fs);

	glBindAttribLocation(program, 0, "in_Position");
      glBindAttribLocation(program, 1, "in_Color");
      glBindAttribLocation(program, 2, "in_Tex");
      glBindAttribLocation(program, 3, "in_Norm");

      glLinkProgram(program);
      printLog(program);
      
      //load second shader
      outlineProg=glCreateProgram();
	vs=loadShader("outline.vert.txt",GL_VERTEX_SHADER);
	fs=loadShader("outline.frag.txt",GL_FRAGMENT_SHADER);

	glAttachShader(outlineProg,vs);
	glAttachShader(outlineProg,fs);

	glBindAttribLocation(outlineProg, 0, "in_Position");
      glBindAttribLocation(outlineProg, 1, "in_Color");
      glBindAttribLocation(outlineProg, 2, "in_Tex");

      glLinkProgram(outlineProg);
      printLog(outlineProg);
      
    glUseProgram(program);
      
    glm::mat4 mainProjMatrix;
    //mainProjMatrix = glm::ortho(-45.0,45.0,-45.0,45.0,-20.0,5000.0);
    mainProjMatrix = glm::perspective(57.0,1.0,.1,5000.0);
    int tempLoc = glGetUniformLocation(program, "Matrix");
    glUniformMatrix4fv(tempLoc, 1, GL_FALSE, &mainProjMatrix[0][0]);
    
    glm::mat4 temp;
    tempLoc = glGetUniformLocation(program, "modelMatrix");
    glUniformMatrix4fv(tempLoc, 1, GL_FALSE, &temp[0][0]);
    
    tempLoc = glGetUniformLocation(program, "Sam");
    glUniform1i(tempLoc,0);
    
    tempLoc = glGetUniformLocation(program, "mode");
    glUniform1i(tempLoc,0);


	glUseProgram(outlineProg);

	tempLoc = glGetUniformLocation(outlineProg, "Matrix");
    glUniformMatrix4fv(tempLoc, 1, GL_FALSE, &mainProjMatrix[0][0]);

	tempLoc = glGetUniformLocation(outlineProg, "modelMatrix");
    glUniformMatrix4fv(tempLoc, 1, GL_FALSE, &temp[0][0]);



   glGenTextures(1,&tex);
   loadPicture("pic.bmp",tex);

}
Beispiel #22
0
bool Menu::handleTitleScreen(DifficultySetting &new_skill, uint8 &new_level) {
    debug(DBG_MENU, "Menu::handleTitleScreen()");
    bool quit_loop = false;
    int menu_entry = 0;
    bool reinit_screen = true;
    bool continue_game = true;
    _charVar1 = 0;
    _charVar2 = 0;
    _charVar3 = 0;
    _charVar4 = 0;
    _charVar5 = 0;
    _ply->play(1);
    static const struct {
        int str;
        int opt;
    } menu_items[] = {
        { LocaleData::LI_07_START, MENU_OPTION_ITEM_START },
#ifdef ENABLE_PASSWORD_MENU
        { LocaleData::LI_08_SKILL, MENU_OPTION_ITEM_SKILL },
        { LocaleData::LI_09_PASSWORD, MENU_OPTION_ITEM_PASSWORD },
#else
        { LocaleData::LI_06_LEVEL, MENU_OPTION_ITEM_LEVEL },
#endif
        { LocaleData::LI_10_INFO, MENU_OPTION_ITEM_INFO },
        { LocaleData::LI_11_QUIT, MENU_OPTION_ITEM_QUIT }
    };
    static const int menu_items_count = ARRAYSIZE(menu_items);
    while (!quit_loop) {
        if (reinit_screen) {
            _vid->fadeOut();
            loadPicture("menu1");
            _vid->fullRefresh();
            _charVar3 = 1;
            _charVar4 = 2;
            menu_entry = 0;
            reinit_screen = false;
        }
        int selected_menu_entry = -1;
        const int y_start = 26 - menu_items_count * 2;
        for (int i = 0; i < menu_items_count; ++i) {
            drawString(_res->getMenuString(menu_items[i].str), y_start + i * 2, 20, (i == menu_entry) ? 2 : 3);
        }

        _vid->updateScreen();
        _stub->sleep(EVENTS_DELAY);
        _stub->processEvents();

        if (_stub->_pi.dirMask & PlayerInput::DIR_UP) {
            _stub->_pi.dirMask &= ~PlayerInput::DIR_UP;
            if (menu_entry != 0) {
                --menu_entry;
            } else {
                menu_entry = menu_items_count - 1;
            }
        }
        if (_stub->_pi.dirMask & PlayerInput::DIR_DOWN) {
            _stub->_pi.dirMask &= ~PlayerInput::DIR_DOWN;
            if (menu_entry != menu_items_count - 1) {
                ++menu_entry;
            } else {
                menu_entry = 0;
            }
        }
        if (_stub->_pi.enter) {
            _stub->_pi.enter = false;
            selected_menu_entry = menu_entry;
        }

        if (selected_menu_entry != -1) {
            switch (menu_items[selected_menu_entry].opt) {
            case MENU_OPTION_ITEM_START:
                new_level = 0;
                quit_loop = true;
                break;
            case MENU_OPTION_ITEM_SKILL:
                handleSkillScreen(new_skill);
                reinit_screen = true;
                break;
            case MENU_OPTION_ITEM_PASSWORD:
                if (handlePasswordScreen(new_skill, new_level)) {
                    quit_loop = true;
                } else {
                    reinit_screen = true;
                }
                break;
            case MENU_OPTION_ITEM_LEVEL:
                if (handleLevelScreen(new_skill, new_level)) {
                    quit_loop = true;
                } else {
                    reinit_screen = true;
                }
                break;
            case MENU_OPTION_ITEM_INFO:
                handleInfoScreen();
                reinit_screen = true;
                break;
            case MENU_OPTION_ITEM_QUIT:
                continue_game = false;
                quit_loop = true;
                break;
            }
        }
        if (_stub->_pi.quit) {
            continue_game = false;
            quit_loop = true;
            break;
        }
    }
    _ply->stop();
    return continue_game;
}
Beispiel #23
0
bool Menu::handleLevelScreen(DifficultySetting &new_skill, uint8 &new_level) {
    debug(DBG_MENU, "Menu::handleLevelScreen()");
    _vid->fadeOut();
    loadPicture("menu2");
    _vid->fullRefresh();
    DifficultySetting currentSkill = new_skill;
    uint8 currentLevel = new_level;
#ifdef GCW0
    uint8 maxLevelEasy = _config->GetLevelAllowed(SKILL_EASY);
    uint8 maxLevelNormal = _config->GetLevelAllowed(SKILL_NORMAL);
    uint8 maxLevelHard = _config->GetLevelAllowed(SKILL_HARD);
    uint8 maxLevel = maxLevelEasy;
    if(maxLevelNormal>maxLevel)
        maxLevel = maxLevelNormal;
    if(maxLevelHard>maxLevel)
        maxLevel = maxLevelHard;
#endif
    do {
        static const char *levelTitles[] = {
            "Titan / The Jungle",
            "Titan / New Washington",
            "Titan / Death Tower Show",
            "Earth / Surface",
            "Earth / Paradise Club",
            "Planet Morphs / Surface",
            "Planet Morphs / Inner Core"
        };
#ifdef GCW0
        for (int i = 0; i < 7; ++i) {
            drawString(levelTitles[i], 7 + i * 2, 4, (i>maxLevel)?6:((currentLevel == i) ? 2 : 3));
        }
        _vid->markBlockAsDirty(4 * 8, 7 * 8, 192, 7 * 8);

        drawString(_res->getMenuString(LocaleData::LI_13_EASY),   23,  4, (currentLevel>maxLevelEasy)?6:((currentSkill == SKILL_EASY) ? 2 : 3));
        drawString(_res->getMenuString(LocaleData::LI_14_NORMAL), 23, 14, (currentLevel>maxLevelNormal)?6:((currentSkill == SKILL_NORMAL) ? 2 : 3));
        drawString(_res->getMenuString(LocaleData::LI_15_EXPERT), 23, 24, (currentLevel>maxLevelHard)?6:((currentSkill == SKILL_HARD) ? 2 : 3));
#else
        for (int i = 0; i < 7; ++i) {
            drawString(levelTitles[i], 7 + i * 2, 4, (currentLevel == i) ? 2 : 3);
        }
        _vid->markBlockAsDirty(4 * 8, 7 * 8, 192, 7 * 8);

        drawString(_res->getMenuString(LocaleData::LI_13_EASY),   23,  4, (currentSkill == SKILL_EASY) ? 2 : 3);
        drawString(_res->getMenuString(LocaleData::LI_14_NORMAL), 23, 14, (currentSkill == SKILL_NORMAL) ? 2 : 3);
        drawString(_res->getMenuString(LocaleData::LI_15_EXPERT), 23, 24, (currentSkill == SKILL_HARD) ? 2 : 3);
#endif
        _vid->markBlockAsDirty(4 * 8, 23 * 8, 192, 8);

        _vid->updateScreen();
        _stub->sleep(EVENTS_DELAY);
        _stub->processEvents();

#ifdef GCW0
        bool needSkillFixup = false;
        if (_stub->_pi.dirMask & PlayerInput::DIR_UP) {
            _stub->_pi.dirMask &= ~PlayerInput::DIR_UP;
            if (currentLevel != 0) {
                --currentLevel;
            } else {
                currentLevel = maxLevel;
                needSkillFixup = true;
            }
        }
        if (_stub->_pi.dirMask & PlayerInput::DIR_DOWN) {
            _stub->_pi.dirMask &= ~PlayerInput::DIR_DOWN;
            if (currentLevel != maxLevel) {
                ++currentLevel;
                needSkillFixup = true;
            } else {
                currentLevel = 0;
            }
        }
        if(needSkillFixup) {
            switch(currentSkill) {
            case SKILL_EASY:
                if(currentLevel>maxLevelEasy) {
                    if(currentLevel>maxLevelNormal) {
                        if(currentLevel>maxLevelHard) {
                            currentLevel=SKILL_EASY;
                        } else {
                            currentSkill = SKILL_HARD;
                        }
                    } else {
                        currentSkill = SKILL_NORMAL;
                    }
                }
                break;
            case SKILL_NORMAL:
                if(currentLevel>maxLevelNormal) {
                    if(currentLevel>maxLevelEasy) {
                        if(currentLevel>maxLevelHard) {
                            currentLevel=SKILL_EASY;
                        } else {
                            currentSkill = SKILL_HARD;
                        }
                    } else {
                        currentSkill = SKILL_EASY;
                    }
                }
                break;
            case SKILL_HARD:
                if(currentLevel>maxLevelHard) {
                    if(currentLevel>maxLevelEasy) {
                        if(currentLevel>maxLevelNormal) {
                            currentLevel=SKILL_EASY;
                        } else {
                            currentSkill = SKILL_NORMAL;
                        }
                    } else {
                        currentSkill = SKILL_EASY;
                    }
                }
                break;
            }
        }
        if (_stub->_pi.dirMask & PlayerInput::DIR_LEFT) {
            _stub->_pi.dirMask &= ~PlayerInput::DIR_LEFT;
            switch(currentSkill) {
            case SKILL_EASY:
                if(currentLevel <= maxLevelHard) {
                    currentSkill = SKILL_HARD;
                } else if(currentLevel <= maxLevelNormal) {
                    currentSkill = SKILL_NORMAL;
                }
                break;
            case SKILL_NORMAL:
                if(currentLevel <= maxLevelEasy) {
                    currentSkill = SKILL_EASY;
                } else if(currentLevel <= maxLevelHard) {
                    currentSkill = SKILL_HARD;
                }
                break;
            case SKILL_HARD:
                if(currentLevel <= maxLevelNormal) {
                    currentSkill = SKILL_NORMAL;
                } else if(currentLevel <= maxLevelEasy) {
                    currentSkill = SKILL_EASY;
                }
                break;
            }
        }
        if (_stub->_pi.dirMask & PlayerInput::DIR_RIGHT) {
            _stub->_pi.dirMask &= ~PlayerInput::DIR_RIGHT;
            switch(currentSkill) {
            case SKILL_EASY:
                if(currentLevel <= maxLevelNormal) {
                    currentSkill = SKILL_NORMAL;
                } else if(currentLevel <= maxLevelHard) {
                    currentSkill = SKILL_HARD;
                }
                break;
            case SKILL_NORMAL:
                if(currentLevel <= maxLevelHard) {
                    currentSkill = SKILL_HARD;
                } else if(currentLevel <= maxLevelEasy) {
                    currentSkill = SKILL_EASY;
                }
                break;
            case SKILL_HARD:
                if(currentLevel <= maxLevelEasy) {
                    currentSkill = SKILL_EASY;
                } else if(currentLevel <= maxLevelNormal) {
                    currentSkill = SKILL_NORMAL;
                }
                break;
            }
        }
#else
        if (_stub->_pi.dirMask & PlayerInput::DIR_UP) {
            _stub->_pi.dirMask &= ~PlayerInput::DIR_UP;
            if (currentLevel != 0) {
                --currentLevel;
            } else {
                currentLevel = 6;
            }
        }
        if (_stub->_pi.dirMask & PlayerInput::DIR_DOWN) {
            _stub->_pi.dirMask &= ~PlayerInput::DIR_DOWN;
            if (currentLevel != 6) {
                ++currentLevel;
            } else {
                currentLevel = 0;
            }
        }
        if (_stub->_pi.dirMask & PlayerInput::DIR_LEFT) {
            _stub->_pi.dirMask &= ~PlayerInput::DIR_LEFT;
            if (currentSkill != SKILL_EASY) {
                currentSkill = (DifficultySetting)(currentSkill-1);
            } else {
                currentSkill = SKILL_HARD;
            }
        }
        if (_stub->_pi.dirMask & PlayerInput::DIR_RIGHT) {
            _stub->_pi.dirMask &= ~PlayerInput::DIR_RIGHT;
            if (currentSkill != SKILL_HARD) {
                currentSkill = (DifficultySetting)(currentSkill+1);
            } else {
                currentSkill = SKILL_EASY;
            }
        }
#endif
        if (_stub->_pi.enter) {
            _stub->_pi.enter = false;
            new_skill = currentSkill;
            new_level = currentLevel;
            return true;
        }

        if (_stub->_pi.backspace) {
            _stub->_pi.backspace = false;
            return false;
        }
    } while (!_stub->_pi.quit);
    return false;
}
Beispiel #24
0
void Menu::handleInfoScreen() {
#ifdef NEW_GCW0_MAPPING
    debug(DBG_MENU, "Menu::handleInfoScreen()");
    //_vid->fadeOut();

    ControlType controlType = _config->GetControlType();

    LoadInfoScreen(controlType);

    do {
        _stub->sleep(EVENTS_DELAY);
        _stub->processEvents();
        if (_stub->_pi.enter) {
            _stub->_pi.enter = false;
            break;
        }

        if (_stub->_pi.dirMask & PlayerInput::DIR_LEFT) {
            _stub->_pi.dirMask &= ~PlayerInput::DIR_LEFT;
            switch(controlType) {
            case CONTROL_A:
                controlType = CONTROL_B;
                break;
            case CONTROL_B:
                controlType = CONTROL_A;
                break;
            }
            _config->SetControlType(controlType);
            LoadInfoScreen(controlType);
        }
        if (_stub->_pi.dirMask & PlayerInput::DIR_RIGHT) {
            _stub->_pi.dirMask &= ~PlayerInput::DIR_RIGHT;
            switch(controlType) {
            case CONTROL_A:
                controlType = CONTROL_B;
                break;
            case CONTROL_B:
                controlType = CONTROL_A;
                break;
            }
            _config->SetControlType(controlType);
            LoadInfoScreen(controlType);
        }
    } while (!_stub->_pi.quit);
#else
    debug(DBG_MENU, "Menu::handleInfoScreen()");
    _vid->fadeOut();
    //todo: replace me with a GCW0 specific mapping image
    switch (_res->_lang) {
    case LANG_FR:
        loadPicture("instru_f");
        break;
    case LANG_EN:
    case LANG_DE:
    case LANG_SP:
        loadPicture("instru_e");
        break;
    }
    _vid->fullRefresh();
    _vid->updateScreen();
    do {
        _stub->sleep(EVENTS_DELAY);
        _stub->processEvents();
        if (_stub->_pi.enter) {
            _stub->_pi.enter = false;
            break;
        }
    } while (!_stub->_pi.quit);
#endif
}
Beispiel #25
0
// calls the loadPicture function
extern "C" Picture *
rLoadPicture (const char * file)
{ 
  return (new PicturePtr(loadPicture(file)))->get();
}
Beispiel #26
0
static bool readFile(const unsigned id)
{
    bool success;
    file_t fp;
    void * vp;

    switch (id)
    {
#ifndef GFXST
            case Resource_PICHAF: /* fallthrough */
            case Resource_PICCONGRATS: /* fallthrough */
            case Resource_PICSPLASH: return true;
#endif /* ndef GFXST */
#ifndef GFXPC
            case Resource_IMAINHOFT: /* fallthrough */
            case Resource_IMAINRDT: /* fallthrough */
            case Resource_IMAINCDC: /* fallthrough */
            case Resource_SCREENCONGRATS: return true;
#endif /* ndef GFXPC */
            default: break;
    }

    if (resourceFiles[id] == NULL)
    {
        sys_error("(resources) resource ID %d not available", id);
        return false;
    }

    if (!checkCrc32(id))
    {
        return false;
    }

    fp = sysfile_open(resourceFiles[id]);
    if (fp == NULL)
    {
        sys_error("(resources) unable to open \"%s\"", resourceFiles[id]);
        return false;
    }

    success = readHeader(fp, id);

    if (success)
    {
        switch (id)
        {
            case Resource_FILELIST: success = loadResourceFilelist(fp); break;
            case Resource_PALETTE:
            {
                vp = game_colors;
                success = loadRawData(fp, &vp, sizeof(*game_colors), &game_color_count);
                game_colors = vp;
                break;
            }
            case Resource_ENTDATA: success = loadResourceEntdata(fp); break;
            case Resource_SPRSEQ:
            {
                vp = ent_sprseq;
                success = loadRawData(fp, &vp, sizeof(*ent_sprseq), &ent_nbr_sprseq);
                ent_sprseq = vp;
                break;
            }
            case Resource_MVSTEP:
            {
                vp = ent_mvstep;
                success = loadRawData(fp, &vp, sizeof(*ent_mvstep), &ent_nbr_mvstep);
                ent_mvstep = vp;
                break;
            }
            case Resource_MAPS: success = loadResourceMaps(fp); break;
            case Resource_SUBMAPS: success = loadResourceSubmaps(fp); break;
            case Resource_CONNECT:
            {
                vp = map_connect;
                success = loadRawData(fp, &vp, sizeof(*map_connect), &map_nbr_connect);
                map_connect = vp;
                break;
            }
            case Resource_BNUMS:
            {
                vp = map_bnums;
                success = loadRawData(fp, &vp, sizeof(*map_bnums), &map_nbr_bnums);
                map_bnums = vp;
                break;
            }
            case Resource_BLOCKS:
            {
                vp = map_blocks;
                success = loadRawData(fp, &vp, sizeof(*map_blocks), &map_nbr_blocks);
                map_blocks = vp;
                break;
            }
            case Resource_MARKS:
            {
                vp = map_marks;
                success = loadRawData(fp, &vp, sizeof(*map_marks), &map_nbr_marks);
                map_marks = vp;
                break;
            }
            case Resource_EFLGC:
            {
                vp = map_eflg_c;
                success = loadRawData(fp, &vp, sizeof(*map_eflg_c), &map_nbr_eflgc);
                map_eflg_c = vp;
                break;
            }
            case Resource_IMAPSL:
            {
                vp = screen_imapsl;
                success = loadRawData(fp, &vp, sizeof(*screen_imapsl), &screen_nbr_imapsl);
                screen_imapsl = vp;
                break;
            }
            case Resource_IMAPSTEPS: success = loadResourceImapsteps(fp); break;
            case Resource_IMAPSOFS:
            {
                vp = screen_imapsofs;
                success = loadRawData(fp, &vp, sizeof(*screen_imapsofs), &screen_nbr_imapsofs);
                screen_imapsofs = vp;
                break;
            }
            case Resource_IMAPTEXT: success = loadResourceImaptext(fp); break;
            case Resource_GAMEOVERTXT: success = loadString(fp, (char **)(&screen_gameovertxt), 0xFE); break;
            case Resource_PAUSEDTXT: success = loadString(fp, (char **)(&screen_pausedtxt), 0xFE); break;
            case Resource_SPRITESDATA: success = loadResourceSpritesData(fp); break;
            case Resource_TILESDATA: success = loadResourceTilesData(fp); break;
            case Resource_HIGHSCORES: success = loadResourceHighScores(fp); break;
            case Resource_IMGSPLASH: success = loadImage(fp, &img_splash); break;
#ifdef GFXST
            case Resource_PICHAF: success = loadPicture(fp, &pic_haf); break;
            case Resource_PICCONGRATS: success = loadPicture(fp, &pic_congrats); break;
            case Resource_PICSPLASH: success = loadPicture(fp, &pic_splash); break;
#endif /* GFXST */
#ifdef GFXPC
            case Resource_IMAINHOFT: success = loadString(fp, (char **)(&screen_imainhoft), 0xFE); break;
            case Resource_IMAINRDT: success = loadString(fp, (char **)(&screen_imainrdt), 0xFE); break;
            case Resource_IMAINCDC: success = loadString(fp, (char **)(&screen_imaincdc), 0xFE); break;
            case Resource_SCREENCONGRATS: success = loadString(fp, (char **)(&screen_congrats), 0xFE); break;
#endif /* GFXPC */
            default: success = false; break;
        }
    }

    if (!success)
    {
        sys_error("(resources) error when parsing \"%s\"", resourceFiles[id]);
    }

    sysfile_close(fp);
    return success;
}
Beispiel #27
0
bool Menu::handleLevelScreen(uint8_t &new_skill, uint8_t &new_level) {
	debug(DBG_MENU, "Menu::handleLevelScreen()");
	_vid->fadeOut();
	loadPicture("menu2");
	_vid->fullRefresh();
	uint8_t currentSkill = new_skill;
	uint8_t currentLevel = new_level;
	do {
		static const char *levelTitles[] = {
			"Titan / The Jungle",
			"Titan / New Washington",
			"Titan / Death Tower Show",
			"Earth / Surface",
			"Earth / Paradise Club",
			"Planet Morphs / Surface",
			"Planet Morphs / Inner Core"
		};
		for (int i = 0; i < 7; ++i) {
			drawString(levelTitles[i], 7 + i * 2, 4, (currentLevel == i) ? 2 : 3);
		}
		_vid->markBlockAsDirty(4 * 8, 7 * 8, 192, 7 * 8);

                drawString(_res->getMenuString(LocaleData::LI_13_EASY),   23,  4, (currentSkill == 0) ? 2 : 3);
                drawString(_res->getMenuString(LocaleData::LI_14_NORMAL), 23, 14, (currentSkill == 1) ? 2 : 3);
                drawString(_res->getMenuString(LocaleData::LI_15_EXPERT), 23, 24, (currentSkill == 2) ? 2 : 3);
		_vid->markBlockAsDirty(4 * 8, 23 * 8, 192, 8);

		_vid->updateScreen();
		_stub->sleep(EVENTS_DELAY);
		_stub->processEvents();

		if (_stub->_pi.dirMask & PlayerInput::DIR_UP) {
			_stub->_pi.dirMask &= ~PlayerInput::DIR_UP;
			if (currentLevel != 0) {
				--currentLevel;
			} else {
				currentLevel = 6;
			}
		}
		if (_stub->_pi.dirMask & PlayerInput::DIR_DOWN) {
			_stub->_pi.dirMask &= ~PlayerInput::DIR_DOWN;
			if (currentLevel != 6) {
				++currentLevel;
			} else {
				currentLevel = 0;
			}
		}
		if (_stub->_pi.dirMask & PlayerInput::DIR_LEFT) {
			_stub->_pi.dirMask &= ~PlayerInput::DIR_LEFT;
			if (currentSkill != 0) {
				--currentSkill;
			} else {
				currentSkill = 2;
			}
		}
		if (_stub->_pi.dirMask & PlayerInput::DIR_RIGHT) {
			_stub->_pi.dirMask &= ~PlayerInput::DIR_RIGHT;
			if (currentSkill != 2) {
				++currentSkill;
			} else {
				currentSkill = 0;
			}
		}
		if (_stub->_pi.enter) {
			_stub->_pi.enter = false;
			new_skill = currentSkill;
			new_level = currentLevel;
			return true;
		}
	} while (!_stub->_pi.quit);
	return false;
}
Beispiel #28
0
// Constructeur
Image::Image(string input){
	loadPicture(input,red_,green_,blue_,taille_); // On utilise la procédure pour charger l'image en tant que constructeur.
}