Пример #1
0
void Config::RestoreDefaults() {
	if (bGameSpecific) {
		deleteGameConfig(gameId_);
		createGameConfig(gameId_);
	} else {
		if (File::Exists(iniFilename_))
			File::Delete(iniFilename_);
		recentIsos.clear();
		currentDirectory = "";
	}
	Load();
}
Пример #2
0
GameRunner* GameDeploymentUtil::deployGame( const GameDeploymentInfo& info, IProgressObserver& progressDialog )
{
   std::string DEPLOYMENT_RESOURCES_ROOT = info.m_targetDir + "/Data/";

   progressDialog.initialize( 4 );
   progressDialog.setStatus( "Creating directories structure" );
   bool directoryStructureCreated = recreateDirectoriesStructures( DEPLOYMENT_RESOURCES_ROOT, info.m_projectDirectories );
   if ( !directoryStructureCreated )
   {
      progressDialog.cancel();
      return NULL;
   }
   progressDialog.advance();

   progressDialog.setStatus( "Copying project files" );
   bool filesDeployed = copyProjectFiles( DEPLOYMENT_RESOURCES_ROOT, info.m_projectDirectories );
   if ( !filesDeployed )
   {
      progressDialog.cancel();
      return NULL;
   }
   progressDialog.advance();

   progressDialog.setStatus( "Creating game configuration" );
   bool configFileCreated = createGameConfig( DEPLOYMENT_RESOURCES_ROOT, info );
   if ( !configFileCreated )
   {
      progressDialog.cancel();
      return NULL;
   }
   progressDialog.advance();

   progressDialog.setStatus( "Building a game runner" );
   GameRunner* runner = createRunner( info );
   progressDialog.advance();

   return runner;
}
Пример #3
0
void selectWorldStart(GUI* gui, Model* initData, SDL_Surface* windowSurface) {
	if (gui->stateId == EDIT_GAME) {
		currSelectionWindow = EDIT;
	}
	else if (gui->stateId == SAVE_GAME) {
		currSelectionWindow = SAVE;
	}
	else {
		currSelectionWindow = LOAD;
	}


	char stringBuffer[SELECT_WORLD_STRING_LENGTH];
	char digitBuffer[2];
	strcpy(stringBuffer, SELECT_WORLD_COOSE_TEXT);

	gui->viewState = initializeChooseWorldWindow(windowSurface);
	gui->model = guis[gui->stateId]->model;
	if (initData != NULL && initData->prevModel != NULL && gui->stateId == initData->prevModel->stateIdModel && currSelectionWindow != SAVE) {// coming from "back" button
		Widget* worldButton = getWidgetFromId(BUTTON_SELECT_WORLD, gui->viewState);


		gui->model = initData->prevModel;

		currWorld = gui->model->gameConfig->worldIndex;

		sprintf(digitBuffer, "%d", currWorld);
		strcat(stringBuffer, digitBuffer);

		markButtonStart(gui->model, gui->model->markedButton, BUTTON_SELECT_WORLD, gui->viewState);
		setText(worldButton, stringBuffer);
	}

	else if (initData != NULL && initData->gameConfig != NULL) { // coming from "world builder"
		if (gui->model == NULL) {
			gui->model = createModel(gui->stateId, initData, BUTTON_SELECT_WORLD);
		}
		gui -> model->world = initData->world;
		gui->model->gameConfig = initData->gameConfig;

		gui->model->prevModel = initData;

		currWorld = gui->model->gameConfig->worldIndex;

		sprintf(digitBuffer, "%d", currWorld);
		strcat(stringBuffer, digitBuffer);

		Widget* worldButton = getWidgetFromId(BUTTON_SELECT_WORLD, gui->viewState);
		markButtonStart(gui->model, BUTTON_SELECT_WORLD, BUTTON_SELECT_WORLD, gui->viewState);
		setText(worldButton, stringBuffer);
	}
	else { // coming from main menu
		if (gui->model == NULL) { // if we come to this screen for the first time, we need to allocate the model
			gui->model = createModel(gui->stateId, initData, BUTTON_SELECT_WORLD);
		}
		else { // if this is not the first time, we don't allocate, just update the relevant fields
			gui->model->stateIdModel = gui->stateId;
			gui->model->prevModel = initData;
			gui->model->markedButton = BUTTON_SELECT_WORLD;
		}


		if (gui->model->gameConfig == NULL) { // if we come to this screen for the first time, we need to allocate the game config
			gui->model->gameConfig = createGameConfig(0, 0, DEFAULT_WORLD);
		}
		else { // if this is not the first time, we don't allocate, just update the relevant fields to the default values
			gui->model->gameConfig->catSkill = 0;
			gui->model->gameConfig->mouseSkill = 0;
			gui->model->gameConfig->worldIndex = DEFAULT_WORLD;
		}

		Widget* worldButton = getWidgetFromId(BUTTON_SELECT_WORLD, gui->viewState);
		currWorld = DEFAULT_WORLD;

		sprintf(digitBuffer, "%d", currWorld);
		strcat(stringBuffer, digitBuffer);
		setText(worldButton, stringBuffer);

		markButtonStart(gui->model, BUTTON_SELECT_WORLD, BUTTON_SELECT_WORLD, gui->viewState);
	}

	if (currSelectionWindow == SAVE) {
		markButtonStart(gui->model, BUTTON_SELECT_WORLD, BUTTON_SELECT_WORLD_DONE, gui->viewState);
	}

	drawWidget(gui->viewState);
}