Ejemplo n.º 1
0
void VolumeDown(void)
{
    if (FXVolume() >= 8)
    {
	SetFXVolume(FXVolume() - 8);
	PlaySound(SND_SWITCH, 0, 255);
    }
}
Ejemplo n.º 2
0
void VolumeUp()
{
    if (FXVolume() < 64)
    {
	SetFXVolume(FXVolume() + 8);
	PlaySound(SND_SWITCH, 0, 255);
    }    
}
Ejemplo n.º 3
0
int SelectVolume(int cmd)
{
	static int index = 0;
	char s[10];
	int x, y;

	if (cmd == CMD_ESC)
		return MODE_MAIN;

	if (AnyButton(cmd) && index == VOLUME_COUNT - 1)
		return MODE_MAIN;

	if (Left(cmd)) {
		switch (index) {
			case 0:
				if (FXVolume() > 8)
					SetFXVolume(FXVolume() - 8);
				break;
			case 1:
				if (MusicVolume() > 8)
					SetMusicVolume(MusicVolume() - 8);
				break;
			case 2:
				if (FXChannels() > 2)
					SetFXChannels(FXChannels() - 2);
				break;
			case 3:
				break;
		}

		PlaySound(SND_SWITCH, 0, 255);
	} else if (Right(cmd)) {
		switch (index) {
			case 0:
				if (FXVolume() < 64)
					SetFXVolume(FXVolume() + 8);
				break;
			case 1:
				if (MusicVolume() < 64)
					SetMusicVolume(MusicVolume() + 8);
				break;
			case 2:
				if (FXChannels() < 8)
					SetFXChannels(FXChannels() + 2);
				break;
			case 3:
				break;
		}

		PlaySound(SND_SWITCH, 0, 255);
	} else if (Up(cmd)) {
		index--;

		if (index < 0)
			index = VOLUME_COUNT - 1;

		PlaySound(SND_SWITCH, 0, 255);
	} else if (Down(cmd)) {
		index++;

		if (index >= VOLUME_COUNT)
			index = 0;

		PlaySound(SND_SWITCH, 0, 255);
	}

	TextStringSpecial("Configure Sound:", TEXT_XCENTER | TEXT_TOP, 0, (SCREEN_WIDTH / 12));
	
	x = CenterX(MenuWidth(volumeMenu, VOLUME_COUNT));
	y = CenterY(MenuHeight(volumeMenu, VOLUME_COUNT));
	
	DisplayMenuAt(x - 20, y, volumeMenu, VOLUME_COUNT, index);
	
	x += MenuWidth(volumeMenu, VOLUME_COUNT);
	x += 10;	

	sprintf(s, "%d", FXVolume() / 8);
	TextStringAt(x, y, s);
	sprintf(s, "%d", MusicVolume() / 8);
	TextStringAt(x, y + TextHeight(), s);
	sprintf(s, "%d", FXChannels());
	TextStringAt(x, y + 2 * TextHeight(), s);
	TextStringAt(x, y + 3 * TextHeight(), "No");

	return MODE_VOLUME;
}
Ejemplo n.º 4
0
void LoadConfig(void)
{
	FILE *f;
	int fx, music, channels, musicChannels;
	int dynamic;
	char s[128];

	f = fopen(GetConfigFilePath("options.cnf"), "r");

	if (f) {
		fscanf(f, "%d %d %d %d %d %d %d %d %d\n",
		       &gOptions.displayFPS,
		       &gOptions.displayTime,
		       &gOptions.playersHurt,
		       &gOptions.copyMode,
		       &gOptions.brightness,
		       &gOptions.swapButtonsJoy1,
		       &gOptions.swapButtonsJoy2,
		       &gOptions.xSplit, &gOptions.ySplit);
		fscanf(f, "%d\n%d %d %d %d %d %d\n",
		       &gPlayer1Data.controls,
		       &gPlayer1Data.keys[0],
		       &gPlayer1Data.keys[1],
		       &gPlayer1Data.keys[2],
		       &gPlayer1Data.keys[3],
		       &gPlayer1Data.keys[4], &gPlayer1Data.keys[5]);
		fscanf(f, "%d\n%d %d %d %d %d %d\n",
		       &gPlayer2Data.controls,
		       &gPlayer2Data.keys[0],
		       &gPlayer2Data.keys[1],
		       &gPlayer2Data.keys[2],
		       &gPlayer2Data.keys[3],
		       &gPlayer2Data.keys[4], &gPlayer2Data.keys[5]);
		fscanf(f, "%d\n", &gOptions.mapKey);
		fscanf(f, "%d %d %d %d\n",
		       &fx, &music, &channels, &musicChannels);
		SetFXVolume(fx);
		SetMusicVolume(music);
		SetFXChannels(channels);
		SetMinMusicChannels(musicChannels);

		fscanf(f, "%d\n", &dynamic);
		fscanf(f, "%s\n", s);
		SetModuleDirectory(s);
		fscanf(f, "%u\n", &gCampaign.seed);
		fscanf(f, "%d %d\n", &gOptions.difficulty,
		       &gOptions.slowmotion);

		fscanf(f, "%d\n", &gOptions.density);
		if (gOptions.density < 25 || gOptions.density > 200)
			gOptions.density = 100;
		fscanf(f, "%d\n", &gOptions.npcHp);
		if (gOptions.npcHp < 25 || gOptions.npcHp > 200)
			gOptions.npcHp = 100;
		fscanf(f, "%d\n", &gOptions.playerHp);
		if (gOptions.playerHp < 25 || gOptions.playerHp > 200)
			gOptions.playerHp = 100;
		
		{
			int w, h, s, fs;

			if (fscanf(f, "%dx%d:%d:%d\n", &w, &h, &fs, &s) == 4) {
				Gfx_SetHint(HINT_WIDTH, w);
				Gfx_SetHint(HINT_HEIGHT, h);

				if (fs != 0) Gfx_HintOn(HINT_FULLSCREEN);
				if (s > 1)  Gfx_SetHint(HINT_SCALEFACTOR, s);
			}
		}

		fclose(f);
	}

	return;
}