///////////////////////////////////////////////////////////////////////////////////////
// -- VOICE SCRIPT AND CLASS SWITCH SCRIPTS, WILL BE ADDED SOON -- //
///////////////////////////////////////////////////////////////////////////////////////

///////////////////////////////////
// - VOICE CHANGE SCRIPT - //
/////////////////////////////////////////////////////////////
// - Credit to TMC and ZzZombo for helping with this //
/////////////////////////////////////////////////////////////

#library "VOICES"
#include "zcommon.acs"

#define VOICE_COUNT 5

str VoiceNames[VOICE_COUNT]={ "CoD:BO2 (Merc)", "Killing Floor (Human)", "Killing Floor (D.A.R.)", "CoD:MW (American)", "CoD:WAW (German)" };
str VoiceReloadingSounds[VOICE_COUNT][3] = {
													{ "merc/reload", "merc/reload", "merc/reload" },
													{ "kfmale/reload", "kfmale/reload", "kfmale/reload" },
													{ "dar/reload", "dar/reload", "dar/reload" },
													{ "usa/reload", "usa/reload", "usa/reload" },
													{ "german/reload", "german/reload", "german/reload" },
											  };

str VoiceTauntSounds[VOICE_COUNT][3] = {
													{ "merc/taunt", "merc/taunt", "merc/taunt" },
													{ "kfmale/taunt", "kfmale/taunt", "kfmale/taunt" },
													{ "dar/taunt", "dar/taunt", "dar/taunt" },
													{ "usa/taunt", "usa/taunt", "usa/taunt" },
													{ "german/taunt", "german/taunt", "german/taunt" },
											  };

str VoicePainSounds[VOICE_COUNT][3] = {
													{ "merc/pain", "merc/pain", "merc/pain" },
													{ "kfmale/pain", "kfmale/pain", "kfmale/pain" },
													{ "dar/pain", "dar/pain", "dar/pain" },
													{ "rga/pain", "rga/pain", "rga/pain" },
													{ "german/pain", "german/pain", "german/pain" },
											  };

int VoiceTauntTimes[5]={70, 70, 70, 70, 140 };

// Can be puked via the console
script 818 (int casing) NET CLIENTSIDE
{
	switch (casing)
	{
		case 0:
		ACS_ExecuteAlways(819,0,0,0,0);
		break;

		case 1:
		ACS_ExecuteAlways(820,0,0,0,0);
		break;

		case 2:
		ACS_ExecuteAlways(820,0,1,0,0);
		break;

		case 3:
		ACS_ExecuteAlways(820,0,2,0,0);
		break;
	}
}

script 819 (void) NET
{
			if (CheckInventory("PlayerVoice") < VOICE_COUNT - 1)
				GiveInventory("PlayerVoice",1);
			else
				TakeInventory("PlayerVoice",99);

			SetFont("BIGWRITR");
			HudMessage(s:"\cKVoice changed:\n\cD",s:VoiceNames[CheckInventory("PlayerVoice")];HUDMSG_FADEOUT,385,CR_WHITE,1.5,0.8,2.0,0.5);
			SetFont("SMALLFONT");

			LocalAmbientSound(VoiceReloadingSounds[CheckInventory("PlayerVoice")][GetPlayerInfo(PlayerNumber(), PLAYERINFO_GENDER)],127);
}

// Executes script 821
// Used for puking the taunt
script 820 (int args) NET
{
		ACS_ExecuteAlways(821,0,args,0,0);
}

// Plays the actual sounds
script 821 (int soundmode)
{
	int voice;
	int gender;
	int value;

	value = GetCVar("cl_noreloadsound");

	voice = CheckInventory("PlayerVoice");
	gender = GetPlayerInfo(PlayerNumber(), PLAYERINFO_GENDER);

	// Print(s:"Voice is ",d:voice,s:", gender is ",s:gender);

		switch (soundmode)
		{
			case 0:
				// If cl_noreloadsound is 0...
				if (!value)
				{
				ActivatorSound(VoiceReloadingSounds[voice][gender],127);
				}
			break;

			case 1:
				if (!CheckInventory("TauntTimer"))
				{
					ActivatorSound(VoiceTauntSounds[CheckInventory("PlayerVoice")][GetPlayerInfo(PlayerNumber(), PLAYERINFO_GENDER)],127);
					GiveInventory("TauntTimer",VoiceTauntTimes[CheckInventory("PlayerVoice")]);
				}
			break;

			case 2:
					ActivatorSound(VoicePainSounds[CheckInventory("PlayerVoice")][GetPlayerInfo(PlayerNumber(), PLAYERINFO_GENDER)],127);
			break;
		}
}