コード例 #1
0
ファイル: FontManager.cpp プロジェクト: amichaelt/pentagram
FontManager::FontManager(bool ttf_antialiasing_) : ttf_antialiasing(ttf_antialiasing_)
{
	con.Print(MM_INFO, "Creating Font Manager...\n");

	assert(fontmanager == 0);
	fontmanager = this;

	SettingManager* settingman = SettingManager::get_instance();
	settingman->setDefault("ttf_highres", true);

	TTF_Init();
}
コード例 #2
0
ファイル: Game.cpp プロジェクト: amichaelt/pentagram
uint32 Game::I_playEndgame(const uint8* args, unsigned int /*argsize*/)
{
	SettingManager* settingman = SettingManager::get_instance();
	settingman->set("endgame", true);
	settingman->write();

	PaletteManager* palman = PaletteManager::get_instance();
	palman->untransformPalette(PaletteManager::Pal_Game);

	Process* menuproc = new MainMenuProcess();
	Kernel::get_instance()->addProcess(menuproc);

	ProcId moviepid = Game::get_instance()->playEndgameMovie();
	Process* movieproc = Kernel::get_instance()->getProcess(moviepid);
	if (movieproc) {
		menuproc->waitFor(movieproc);
	}

	return 0;
}
コード例 #3
0
ファイル: MenuGump.cpp プロジェクト: amichaelt/pentagram
void MenuGump::selectEntry(int entry)
{
	SettingManager* settingman = SettingManager::get_instance();
	bool endgame, quotes;
	settingman->get("endgame", endgame);
	settingman->get("quotes", quotes);

	switch (entry)
	{
	case 1: // Intro
		Game::get_instance()->playIntroMovie();
		break;
	case 2: case 3: // Read/Write Diary
		U8SaveGump::showLoadSaveGump(this,entry==3);
		break;
	case 4: // Options
	{
		PagedGump * gump = new PagedGump(34, -38, 3, gumpShape);
		gump->InitGump(this);

		OptionsGump * options = new OptionsGump();
		options->InitGump(gump, false);
		gump->addPage(options);
		gump->setRelativePosition(CENTER);
	} break;
	case 5: // Credits
		Game::get_instance()->playCredits();
		break;
	case 6: // Quit
		QuitGump::verifyQuit();
		break;
	case 7: // Quotes
		if (quotes) Game::get_instance()->playQuotes();
		break;
	case 8: // End Game
		if (endgame) Game::get_instance()->playEndgameMovie();
		break;
	default:
		break;
	}
}
コード例 #4
0
ファイル: timidity.cpp プロジェクト: CalvinRodo/exult
int Timidity_Init_Simple(int rate, int samples, sint32 encoding)
{
	std::string configfile;
	/* see if the pentagram config file specifies an alternate timidity.cfg */
#ifndef PENTAGRAM_IN_EXULT
	SettingManager* settings = SettingManager::get_instance();
	if (!settings->get("timiditycfg", configfile))
		configfile = CONFIG_FILE;
#else
	config->value("config/audio/midi/timiditycfg", configfile, CONFIG_FILE);
#endif

	if (read_config_file(configfile.c_str())<0) {
		return(-1);
	}

	/* Check to see if the encoding is 'valid' */

	// Only 16 bit can be byte swapped
	if ((encoding & PE_BYTESWAP) && !(encoding & PE_16BIT))
		return(-1);

	// u-Law can only be mono or stereo 
	if ((encoding & PE_ULAW) && (encoding & ~(PE_ULAW|PE_MONO)))
		return(-1);

	/* Set play mode parameters */
	play_mode->rate = rate;
	play_mode->encoding = encoding;
	switch (play_mode->encoding) {
		case 0:
		case PE_MONO:
			s32tobuf = s32tou8;
			break;

		case PE_SIGNED:
		case PE_SIGNED|PE_MONO:
			s32tobuf = s32tos8;
			break;

		case PE_ULAW:
		case PE_ULAW|PE_MONO:
			s32tobuf = s32toulaw;
			break;

		case PE_16BIT:
		case PE_16BIT|PE_MONO:
			s32tobuf = s32tou16;
			break;

		case PE_16BIT|PE_SIGNED:
		case PE_16BIT|PE_SIGNED|PE_MONO:
			s32tobuf = s32tos16;
			break;

		case PE_BYTESWAP|PE_16BIT:
		case PE_BYTESWAP|PE_16BIT|PE_MONO:
			s32tobuf = s32tou16x;
			break;

		case PE_BYTESWAP|PE_16BIT|PE_SIGNED:
		case PE_BYTESWAP|PE_16BIT|PE_SIGNED|PE_MONO:
			s32tobuf = s32tos16x;
			break;

		default:
			ctl->cmsg(CMSG_ERROR, VERB_NORMAL, "Unsupported audio format");
			return(-1);
	}

	AUDIO_BUFFER_SIZE = samples;

	/* Allocate memory for mixing (WARNING:  Memory leak!) */
	resample_buffer = safe_Malloc<sample_t>(AUDIO_BUFFER_SIZE);
	common_buffer = safe_Malloc<sint32>(AUDIO_BUFFER_SIZE*2);

	init_tables();

	if (ctl->open(0, 0)) {
		ctl->cmsg(CMSG_ERROR, VERB_NORMAL, "Couldn't open %s\n", ctl->id_name);
		return(-1);
	}

	if (!control_ratio) {
		control_ratio = play_mode->rate / CONTROLS_PER_SECOND;
		if(control_ratio<1)
			control_ratio=1;
		else if (control_ratio > MAX_CONTROL_RATIO)
			control_ratio=MAX_CONTROL_RATIO;
	}
	if (*def_instr_name)
		set_default_instrument(def_instr_name);
	return(0);
}
コード例 #5
0
ファイル: MenuGump.cpp プロジェクト: amichaelt/pentagram
void MenuGump::InitGump(Gump* newparent, bool take_focus)
{
	ModalGump::InitGump(newparent, take_focus);

	shape = GameData::get_instance()->getGumps()->getShape(gumpShape);
	ShapeFrame* sf = shape->getFrame(0);
	assert(sf);

	dims.w = sf->width;
	dims.h = sf->height;

	Shape* logoShape;
	logoShape = GameData::get_instance()->getGumps()->getShape(paganShape);
	sf = logoShape->getFrame(0);
	assert(sf);

	Gump * logo = new Gump(42, 10, sf->width, sf->height);
	logo->SetShape(logoShape, 0);
	logo->InitGump(this, false);

	if (!nameEntryMode) {
		SettingManager* settingman = SettingManager::get_instance();
		bool endgame, quotes;
		settingman->get("endgame", endgame);
		settingman->get("quotes", quotes);

		int x = dims.w / 2 + 14;
		int y = 18;
		Gump * widget;
		for (int i = 0; i < 8; ++i)
		{
			if ((quotes || i != 6) && (endgame || i != 7)) {
				FrameID frame_up(GameData::GUMPS, menuEntryShape, i * 2);
				FrameID frame_down(GameData::GUMPS, menuEntryShape, i * 2 + 1);
				frame_up = _TL_SHP_(frame_up);
				frame_down = _TL_SHP_(frame_down);
				widget = new ButtonWidget(x, y, frame_up, frame_down, true);
				widget->InitGump(this, false);
				widget->SetIndex(i + 1);
			}

			y += 14;
		}
		
		MainActor* av = getMainActor();
		std::string name;
		if (av)
			name = av->getName();

		if (!name.empty()) {
			Pentagram::Rect rect;
			widget = new TextWidget(0, 0, name, true, 6);
			widget->InitGump(this, false);
			widget->GetDims(rect);
			widget->Move(90 - rect.w / 2, dims.h - 40);
		}
	} else {
		Gump * widget;
		widget = new TextWidget(0, 0, _TL_("Give thy name:"), true, 6); // CONSTANT!
		widget->InitGump(this, false);
		widget->Move(dims.w / 2 + 6, 10);

		Pentagram::Rect textdims;
		widget->GetDims(textdims);

		widget = new EditWidget(0, 0, "", true, 6, 110, 40, 15); // CONSTANTS!
		widget->InitGump(this, true);
		widget->Move(dims.w / 2 + 6, 10 + textdims.h);
		widget->MakeFocus();
	}
}