Exemplo n.º 1
0
static int TemplateSelection(int loadFlag, int x, int index,
			     struct PlayerData *data, int cmd)
{
	int i;
	int y;
	static int selection[2] = { 0, 0 };

	if (cmd & CMD_BUTTON1)
	{
		if (loadFlag)
		{
			UseTemplate(index, data, &templates[selection[index]]);
		}
		else
		{
			SaveTemplate(data, &templates[selection[index]]);
		}
		SoundPlay(&gSoundDevice, rand() % SND_COUNT);
		return 0;
	}
	else if (cmd & CMD_BUTTON2)
	{
		SoundPlay(&gSoundDevice, rand() % SND_COUNT);
		return 0;
	} else if (cmd & (CMD_LEFT | CMD_UP)) {
		if (selection[index] > 0) {
			selection[index]--;
			SoundPlay(&gSoundDevice, SND_SWITCH);
		}
		else if (selection[index] == 0)
		{
			selection[index] = MAX_TEMPLATE - 1;
			SoundPlay(&gSoundDevice, SND_SWITCH);
		}
	} else if (cmd & (CMD_RIGHT | CMD_DOWN)) {
		if (selection[index] < MAX_TEMPLATE - 1) {
			selection[index]++;
			SoundPlay(&gSoundDevice, SND_SWITCH);
		}
		else if (selection[index] == MAX_TEMPLATE - 1)
		{
			selection[index] = 0;
			SoundPlay(&gSoundDevice, SND_SWITCH);
		}
	}

	y = CenterY((CDogsTextHeight() * MAX_TEMPLATE));

	if (!loadFlag) {
		CDogsTextStringAt(x, y - 4 - CDogsTextHeight(), "Save ");
		CDogsTextString(data->name);
		CDogsTextString("...");
	}

	for (i = 0; i < MAX_TEMPLATE; i++)
		DisplayMenuItem(x, y + i * CDogsTextHeight(),
				templates[i].name, i == selection[index]);

	return 1;
}
C_ASW_Gun_Smoke_Emitter::C_ASW_Gun_Smoke_Emitter()
{
	m_fFireCount = 0;
	m_fLastFireTime = 0;
	UseTemplate("autogunsmoke", true);
}