////////////////////////////////////////////////////////////////////////////////
//
// Copyright 2016 RWS Inc, All Rights Reserved
//
// This program is free software; you can redistribute it and/or modify
// it under the terms of version 2 of the GNU General Public License as published by
// the Free Software Foundation
//
// This program is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
// GNU General Public License for more details.
//
// You should have received a copy of the GNU General Public License along
// with this program; if not, write to the Free Software Foundation, Inc.,
// 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
//
// person.cpp
// Project: Postal
//
// This module implements the CPerson class which is mostly a test object
//	the the most basic functionality of the enemy guys derrived from CDoofus.
//
// History:
//
//		04/28/97 BRH	Started this person to be the generic Enemy/Victim
//							that will use the structures set up in
//							Personatorium to determine the abilities and
//							desired logic.
//
//		04/30/97 BRH	Fixed up the EditModify dialog box to select any type
//							of personality and any type of weapon.  Modified the
//							Update to shoot any weapon.
//
//		05/11/97 BRH	Imported the Update function from CDoofus.  CDoofus will
//							most likely make its Update funciton pure virtual so that
//							it is up to the derived classes to move from state to
//							state.
//
//		05/12/97 BRH	Added the crawling special case for the Cop and Gunner in
//							Logic_Writhing.  Added the logic for the circle fight
//							and retreat in CDoofus.
//
//		05/19/97	JMI	Added ms_u16IdLogAI and EditModify() code to check and
//							change it.
//
//		05/19/97	JMI	Added m_szLogicFile, m_sShowState, and Render() override.
//							Can change m_szLogicFile and m_sShowState in EditModify().
//
//		05/19/97 BRH	Saved the m_sShowState variable so that it works during
//							play mode.  Changed the name of the logic file to an
//							RString and added the RString load and save to the
//							CPerson load and save functions.
//
//		05/20/97 BRH	Making the high level actions more concrete by adding
//							Actions as a higher level concept than the states.  Each
//							action may consist of several pre-programmed state
//							sequences.  At good evaluation points in each action,
//							it will check the suggested logic action and change states
//							to perform that action.
//
//		05/21/97 BRH	Added Resource management for ShootRun animation.
//
//		05/22/97	JMI	FreeResources() was releasing m_pLogicTable in g_resmgrGame
//							instead of g_resmgrRes (which is where it was
//							rspGetResource'ed from).
//
//		05/23/97	JMI	Added NULLs for new pszEventName parameter to
//							CAnim3D::Get()s indicating to load no events.
//
//		05/25/97 BRH	Added Release calls for the new animations.
//
//		05/25/97	JMI	Changed "Personality.GUI" to "Person.GUI".
//
//		05/26/97 BRH	Calls CDoofus::OnDead rather than the CCharacter version.
//
//		06/02/97 BRH	Added case for State_HuntHold.
//
//		06/04/97 BRH	Fixed Writing crawl to use the m_AnimRot so that it faces
//							the correct direction.
//
//		06/05/97	JMI	Changed m_sHitPoints to m_stockpile.m_sHitPoints to
//							accommodate new m_stockpile in base class, CThing3d (which
//							used to contain the m_sHitPoints).
//
//		06/10/97 BRH	Sends Death certificate to CDemon.
//
//		06/10/97 BRH	Added Search and Crouch animations to Get and Free Resources
//
//		06/13/97	JMI	Now GetResources() loads events for animations that need
//							them.
//
//		06/15/97 BRH	Adjusted the time and comment count so people don't
//							speak as often.
//
//		06/16/97 BRH	Tried Aborting any shot sounds if it wasn't done playing.
//							If it doesn sound good, then we will just verify that
//							the previous sample is done before playing the next one.
//							We were thinking that it may sound cool if he interrupted
//							"My leg" before saying "Ug".
//
//		06/16/97 BRH	Switched to IsSamplePlaying rather than aborting, because
//							the phrases were rarely finished before aborting so you
//							never got to hear them if you kept shooting.
//
//		06/17/97 BRH	Took out IsSamplePlaying because it screws up the network
//							mode because the Sample can play for different intervals
//							on different systems.
//
//		06/18/97 BRH	Enabled the Shooting sounds.
//
//		06/18/97	JMI	Changed PlaySoundWrithing() to return the duration of the
//							played sample.
//
//		06/18/97 BRH	Changed to using GetRandom();
//
//		06/18/97	JMI	Now uses the sample duration returned from PlaySample()
//							instead of getting it from the RSnd.
//
//		06/25/97	JMI	Now calls PrepareShadow() in Init() which loads and sets up
//							a shadow sprite.
//
//		06/27/97	JMI	Now shows weapon type when in edit mode via EditRender().
//
//		06/30/97 BRH	Changed the random type sounds to play and then purge to
//							save memory.  Cached the other sound effects during the
//							load for each different person type loaded so that their
//							sounds won't pause the game when they are first shot,
//							set on fire, etc.
//
//		07/03/97	JMI	Converted calls to rspOpen/SaveBox() to new parm
//							conventions.
//
//		07/04/97 BRH	Changed run and shoot prefix from run45rt to 45rt to
//							match the exported names.  Also added a substitution of
//							the run animation if there is no onfire animation since
//							the victims don't yet have an onfire animaiton.
//
//		07/06/97 BRH	Added new victim states to the Update function.
//
//		07/08/97 BRH	Changed run backwards animation name to runbackwr since
//							some of the filenames were too long for the delicate
//							MacOS.
//
//		07/17/97 BRH	Added delay shoot case in update.
//
//		07/17/97	JMI	Changed RSnd*'s to SampleMaster::SoundInstances.
//							Now uses new SampleMaster interface for volume and play
//							instance reference.
//
//		07/18/97	JMI	Got rid of bogus immitation PlaySample functions.
//							Now there is one PlaySample() function.  Also, you now
//							MUST specify a category and you don't have to specify a
//							SoundInstance ptr to specify a volume.
//
//		07/21/97	JMI	Now Update() calls CCharacter version (note that this is
//							skipping CDoofus::Update() ).
//
//		07/23/97 BRH	Checks for a live dude before making a random comment so
//							that they don't say stupid things after the CDude is dead.
//
//		07/26/97 BRH	Changed the initial setting of hit points from the CThing3D
//							default value to using the new value in the personatorium.
//
//		08/01/97 BRH	Enemies now upgrade their weapons if the game is set
//							on difficulty 11.  Guns are upgraded to Assault Weapons
//							and rockets are upgraded to heatseekers.  Also added
//							case for State_AvoidFire and State_DangerNear.
//
//		08/06/97	JMI	Now loads execution target points for writhing mode.
//							Also, now uses CDoofus's PositionSmash() for positioning
//							the main smash.
//
//		08/07/97	JMI	Now loads new resname gotten from Personatorium for the
//							linkpoint/rigid-body for the person's hand.
//							Now calls CDoofus' GetResources()/ReleaseResources() to
//							get and release resources for weapons.
//
//		08/08/97	JMI	Now does not display the mines in the EditModify().
//
//		08/08/97	JMI	Upgraded to use all the new weapons.
//							Now does the weapon upgrade for difficulty 11 in only
//							when editing flag is set to false in the realm so it does
//							not occur in the editor.
//
//		08/09/97 BRH	Added TRACE message for invalid state type - so if it
//							it happens sgain where a state is not accounted for in
//							the Update switch statement, it will print the number
//							and them attempt to print the description of the state
//							for debugging purposes.
//
//		08/10/97 BRH	Fixed problem with executions when people yelled
//							things like ah my leg when they were being executed.
//							Changed this to a generic grunt that should work
//							for all people.
//
//		08/11/97	JMI	Now sets backup weapon type based on personatorium.
//							Also, added case for State_WalkNext to Update()'s logic
//							switch.
//
//		08/12/97	JMI	Now loads main event for all animations.
//
//		08/12/97 BRH	Added missing case statement for Hide and HideBegin.
//							Also upped the number of random comments for the victims
//							(the ones in panic mode so that they will scream and
//							yell more often when in panic mode).  Also added
//							special case for shot sound effects where the first
//							shot sound will be the comment, and the other 3 just
//							noises.  Once the comment is played (randomly chosen)
//							the m_bHitComment will be set so it doesn't get played
//							again.
//
//		08/14/97	JMI	Switched references to g_GameSettings.m_sDifficulty to
//							m_pRealm->m_flags.sDifficulty.
//
//		08/17/97 BRH	Slowed writhing crawl velocity from 5 to 2.5
//
//		08/20/97 BRH	Changed the sound categories from voice to voice and
//							the new pain and suffering categories.
//
//		08/24/97	JMI	Also, now the gunner type of motion (PushBack) also dies
//							when it hits something.
//							Now checks a point that should be the person's furthest
//							extremity when he's writhing and if that point goes into
//							anything he acts the same as if his main attrib check area
//							hit it except he ignores the height (that is, he treats it
//							all as no walk)
//
//		08/24/97 BRH	The PlaySound functions now set the new doofus m_siPlaying
//							sound instance so that it can be aborted when the guy is
//							killed so he doesn't keep making noises, especially after
//							being executed.
//
//		08/25/97	JMI	When I added the last change on checking their heads'
//							while writhing, I inadvertently took out the check to kill
//							them if they're feet hit something.  Since there moving
//							in the direction of their head, this shouldn't've been a
//							problem, but it's worth fixing.  Fixed.
//
//		08/26/97 BRH	Added special case for the people who have a description
//							starting with "Kid".  The Kids smash bits are set to zero
//							so that they cannot be hit by weapons for the final
//							scene.
//
//		08/28/97 BRH	Fixed the push back code in Logic_Writhing
//
//		08/29/97 BRH	Added static variable for the logic table to use to set
//							group motions.
//
//		09/03/97	JMI	Civilians now use Civilian Smash bit instead of Bad.
//
//		10/24/97	JMI	Added Mac specific code to make sure browsed-for logic
//							files are relative paths.
//
//		01/14/98	JMI	Added more descriptive alert (than the ASSERT(0) ) for
//							unexpected states in the main switch() based on the TRACEs
//							Bill had.
//
//		10/03/99	JMI	Now launches TexEdit when Edit Textures... chosen.
//
//		10/06/99	JMI	Now only adds the sTextureScheme if it is non-negative.
//							Now passes the hood lights to the texture editor.
//
////////////////////////////////////////////////////////////////////////////////
#define PERSON_CPP

#include "RSPiX.h"
#include <math.h>

#include "person.h"
#include "pvr.h"

////////////////////////////////////////////////////////////////////////////////
// Macros/types/etc.
////////////////////////////////////////////////////////////////////////////////

#define NEAR_DEATH_HITPOINTS 20
#define MS_BETWEEN_SAMPLES 100
#define PERSONALITY_ITEM_ID_BASE 200
#define NUM_ELEMENTS(a) (sizeof(a) / sizeof(a[0]))

////////////////////////////////////////////////////////////////////////////////
// Variables/data
////////////////////////////////////////////////////////////////////////////////

// These are default values -- actually values are set using the editor!

double CPerson::ms_dLongRange = 500 * 500;		  // Squared distance (500 pixels away)
double CPerson::ms_dInRangeLow = 190 * 190;		  // Squared distance to be in range with weapon
double CPerson::ms_dInRangeHigh = 230 * 230;	  // Squared distance to be in range with weapon
double CPerson::ms_dThrowHorizVel = 200;		  // Throw out at this velocity
double CPerson::ms_dMaxCrawlVel = 2.5;			  // Speed at which cop crawls
int32_t CPerson::ms_lMinCommentTime = 10000;	  // Amount of time before making a comment
int32_t CPerson::ms_lCommentTimeVariance = 35000; // Random amount added on.
int32_t CPerson::ms_lRandomAvoidTime = 200;		  // Time to wander before looking again
int32_t CPerson::ms_lReseekTime = 1000;			  // Do a 'find' again
int32_t CPerson::ms_lWatchWaitTime = 5000;		  // Time to watch shot go
int32_t CPerson::ms_lReselectDudeTime = 3000;	  // Time to go without finding a dude
												  // before calling SelectDude() to find
												  // possibly a closer one.
int16_t CPerson::ms_sLogTabUserGlobal = 0;		  // Logic table variable for group effects

// Let this auto-init to 0
int16_t CPerson::ms_sFileCount;

// This is the one CPerson that can log its AI table transitions or
// CIdBank::IdNil.
U16 CPerson::ms_u16IdLogAI = CIdBank::IdNil;

// The max amount a guy and step up while writhing.
#define WRITHING_VERTICAL_TOLERANCE (MaxStepUpThreshold / 2)

#define ID_GUI_EDIT_TEXTURES 900

//#ifdef MOBILE
extern bool demoCompat;
//#endif
extern PVR::cRenderMgr *g_pvrRenderer;


// todo???
extern bool g_ucMinimalSampleSetEnabled;
extern uint8_t g_ucMinimalSampleSet;

////////////////////////////////////////////////////////////////////////////////
// Load object (should call base class version!)
////////////////////////////////////////////////////////////////////////////////
int16_t CPerson::Load(		// Returns 0 if successfull, non-zero otherwise
	RFile *pFile,			// In:  File to load from
	bool bEditMode,			// In:  True for edit mode, false otherwise
	int16_t sFileCount,		// In:  File count (unique per file, never 0)
	uint32_t ulFileVersion) // In:  Version of file format to load.
{
	int16_t sResult = 0;	
	sResult = CDoofus::Load(pFile, bEditMode, sFileCount, ulFileVersion);

	if (sResult == 0)
	{
		// Load common data just once per file (not with each object)
		if (ms_sFileCount != sFileCount)
		{
			ms_sFileCount = sFileCount;

			// Load static data
			switch (ulFileVersion)
			{
			default:
			case 1:
				pFile->Read(&ms_dLongRange);
				pFile->Read(&ms_dInRangeLow);
				pFile->Read(&ms_dInRangeHigh);
				pFile->Read(&ms_lRandomAvoidTime);
				pFile->Read(&ms_lReseekTime);
				pFile->Read(&ms_lWatchWaitTime);
				pFile->Read(&ms_lReselectDudeTime);
				break;
			}
		}

		uint8_t uc;

		// Load data specific to CPerson (if any)
		switch (ulFileVersion)
		{
		default:
		case 14:
			pFile->Read(&uc);
			m_ePersonType = (Personatorium::Index)uc;
			pFile->Read(&m_sShowState);
			m_rstrLogicFile.Load(pFile);
			break;

		case 1:
		case 2:
		case 3:
		case 4:
		case 5:
		case 6:
		case 7:
		case 8:
		case 9:
		case 10:
		case 11:
		case 12:
		case 13:
		{
			pFile->Read(&uc);
			m_ePersonType = (Personatorium::Index)uc;
			break;
		}
		}

		// Cache the samples that this type of person uses
		TRACE("m_ePersonType = %d\n", m_ePersonType);
		TRACE("NUM_ELEMENTS(g_apersons) = %d\n", NUM_ELEMENTS(g_apersons));
		// TODO sound
		CacheSample(*(g_apersons[m_ePersonType].Sample.psmidSuffering1));
		CacheSample(*(g_apersons[m_ePersonType].Sample.psmidSuffering2));
		CacheSample(*(g_apersons[m_ePersonType].Sample.psmidSuffering3));
		CacheSample(*(g_apersons[m_ePersonType].Sample.psmidSuffering4));
		CacheSample(*(g_apersons[m_ePersonType].Sample.psmidShot1));
		CacheSample(*(g_apersons[m_ePersonType].Sample.psmidShot2));
		CacheSample(*(g_apersons[m_ePersonType].Sample.psmidShot3));
		CacheSample(*(g_apersons[m_ePersonType].Sample.psmidShot4));
		CacheSample(*(g_apersons[m_ePersonType].Sample.psmidBlownup1));
		CacheSample(*(g_apersons[m_ePersonType].Sample.psmidBlownup2));
		CacheSample(*(g_apersons[m_ePersonType].Sample.psmidBurning1));
		CacheSample(*(g_apersons[m_ePersonType].Sample.psmidBurning2));
		CacheSample(*(g_apersons[m_ePersonType].Sample.psmidDying1));
		CacheSample(*(g_apersons[m_ePersonType].Sample.psmidDying2));
		CacheSample(*(g_apersons[m_ePersonType].Sample.psmidShooting1));
		CacheSample(*(g_apersons[m_ePersonType].Sample.psmidShooting2));
		CacheSample(*(g_apersons[m_ePersonType].Sample.psmidShooting3));
		CacheSample(*(g_apersons[m_ePersonType].Sample.psmidShooting4));
		CacheSample(*(g_apersons[m_ePersonType].Sample.psmidRandom1));
		CacheSample(*(g_apersons[m_ePersonType].Sample.psmidRandom2));
		CacheSample(*(g_apersons[m_ePersonType].Sample.psmidRandom3));
		CacheSample(*(g_apersons[m_ePersonType].Sample.psmidRandom4));

		m_bCivilian = (g_apersons[m_ePersonType].eLifestyle == Personatorium::Civilian);

		// Make sure there were no file errors or format errors . . .
		if (!pFile->Error() && sResult == 0)
		{
			// Get resources
			sResult = GetResources();
		}
		else
		{
			sResult = -1;
			TRACE("CPerson::Load(): Error reading from file!\n");			
		}
	}
	else
	{
		TRACE("CPerson::Load():  CDoofus::Load() failed.\n");		
	}
	
	return sResult;
}

////////////////////////////////////////////////////////////////////////////////
// Startup object
////////////////////////////////////////////////////////////////////////////////
int16_t CPerson::Startup(void) // Returns 0 if successfull, non-zero otherwise
{
	int16_t sResult = 0;

	// Set the current height, previous time, and Nav Net
	CDoofus::Startup();

	// Init other stuff
	Init();

	return sResult;
}

////////////////////////////////////////////////////////////////////////////////
// Init - Call this after the resources are in place
////////////////////////////////////////////////////////////////////////////////

int16_t CPerson::Init(void)
{
	int16_t sResult = 0;

	// Prepare shadow (get resources and setup sprite).
	sResult = PrepareShadow();

	// Clear the hit comment
	m_bHitComment = false;

	// Init other stuff
	m_dVel = 0.0;
	m_dRot = 0.0;
	// Set to different starting state based on the design of the animation, but
	// for now, ok.  Then also set his current animation.
	m_state = CCharacter::State_Guard;
	m_eCurrentAction = m_eSuggestedAction = CDoofus::Action_Guard;
	m_dAcc = ms_dAccUser;
	m_panimCur = &m_animStand;
	m_lTimer = m_pRealm->m_time.GetGameTime() + 500;

	// Stock up.
	m_stockpile.Copy(&CStockPile::ms_stockpileMax);

	m_stockpile.m_sHitPoints = g_apersons[m_ePersonType].sInitialHitPoints;

	// Get back up weapon type.
	m_eFallbackWeaponType = g_apersons[m_ePersonType].Weapon.idWeapon1;

	// If not civilian . . .
	if (g_apersons[m_ePersonType].eLifestyle != Personatorium::Civilian)
	{
		// Bad guy.
		m_smash.m_bits = CSmash::Bad | CSmash::Character;
	}
	else
	{
		// Civilian.
		m_smash.m_bits = CSmash::Civilian | CSmash::Character;
	}

	m_smash.m_pThing = this;

	// Special case for the kids who cannot be hit.
	if (strncmp(g_apersons[m_ePersonType].pszDescription, "Kid", 3) == 0)
		m_smash.m_bits = 0;

	m_sBrightness = 0; // Default Brightness level

	m_lCommentTimer = m_pRealm->m_time.GetGameTime() + ms_lMinCommentTime + GetRandom() % ms_lCommentTimeVariance;

	// Override the Doofus set timeout defaults by replacing the values with the
	// personatorium values.
	m_lGuardTimeout = g_apersons[m_ePersonType].lGuardTimeout;
	m_lRunShootInterval = g_apersons[m_ePersonType].lRunShootInterval;
	m_lShotReactionTimeout = g_apersons[m_ePersonType].lShotTimeout;

	// If the difficulty is set up to its highest level, then upgrade
	// guns to spray cannons and missiles to heatseekers.
	// Note we only do this if not in edit mode.
	if (m_pRealm->m_flags.sDifficulty == 11 && m_pRealm->m_flags.bEditing == false)
	{
		switch (m_eWeaponType)
		{
		case CUziID:
		case CAutoRifleID:
		case CSmallPistolID:
		case CPistolID:
		case CMachineGunID:
		case CShotGunID:
			m_eWeaponType = CAssaultWeaponID;
			break;

		case CRocketID:
			m_eWeaponType = CHeatseekerID;
			break;
		}
	}

	// Set initial group state to zero.  If you use dispensers then initalizing
	// this value here would be bad, but this is a special case for the last
	// demo level with the kids and there aren't any dispensers on that level.
	ms_sLogTabUserGlobal = 0;

	return sResult;
}

CThing * CPerson::FindExecutor(void)
{
	bool bFoundOne = false; // Assume not found.

	CSmash *psmashee = NULL; // Safety.

	CSmash::Bits includeBits = 0;
	CSmash::Bits excludeBits = 0;
		
	includeBits = CSmash::Good;
			
	// Find the closest person including writhers.
	if (m_pRealm->m_smashatorium.QuickCheckClosest(
			&m_smash,			// In:  CSmash to check				
			includeBits, 		// In:  Bits we can hit.
			0,					// In:  Bits that you don't care about
			excludeBits,		// In:  Bits that must be 0 to collide with a given CSmash
			&psmashee) == true)
	{		
		return psmashee->m_pThing;
	}

	return nullptr;
}



////////////////////////////////////////////////////////////////////////
// Update object
////////////////////////////////////////////////////////////////////////////////
void CPerson::Update(void)
{
	CThing *pDemon = NULL;

	if (!m_sSuspend)
	{
		int32_t lThisTime = m_pRealm->m_time.GetGameTime();

		// See if its time to reevaluate the states
		if (lThisTime > m_lEvalTimer && !m_bRegisteredDeath)
		{
			m_lEvalTimer = lThisTime + 500 + (GetRandom() % 500);
			m_pLogicTable->Evaluate(this, ms_u16IdLogAI == GetInstanceID());
		}

		// Check for new messages that may change the state
		ProcessMessages();

		if (m_bRegisteredDeath)
		{
			m_pRealm->m_scene.RemoveSprite(&m_sprite);
			m_pRealm->m_smashatorium.Remove(&m_smash);
			return;
		}

		// See if its time to make a random comment yet
		if (lThisTime > m_lCommentTimer)
		{
			m_lCommentTimer = lThisTime + ms_lMinCommentTime + GetRandom() % ms_lCommentTimeVariance;
			PlaySoundRandom();
		}

		// See if there are any pylons nearby that he wants to use.
		//		if (m_state == State_Idle ||
		//		    m_state == State_Wait ||
		//			 m_state == State_Hunt)
		//			Logic_PylonDetect();

		switch (m_state)
		{
		case State_Guard:
			Logic_Guard();
			break;

		case State_PopBegin:
			Logic_PopBegin();
			break;

		case State_PopWait:
			Logic_PopWait();
			break;

		case State_Popout:
			Logic_Popout();
			break;

		case State_RunShootBegin:
			Logic_RunShootBegin();
			break;

		case State_RunShoot:
			Logic_RunShoot();
			break;

		case State_RunShootWait:
			Logic_RunShootWait();
			break;

		case State_Shoot:
			Logic_Shoot();
			break;

		case State_ShootRun:
			Logic_ShootRun();
			break;

		case State_Hunt:
			Logic_Hunt();
			break;

		case State_HuntNext:
		case State_MoveNext:
		case State_MarchNext:
		case State_WalkNext:
			Logic_MoveNext();
			break;

		case State_HuntHold:
			Logic_HuntHold();
			break;

		case State_Shot:
			Logic_Shot();
			break;

		case State_BlownUp:
			Logic_BlownUp();
			break;

		case State_Burning:
			Logic_Burning();
			break;

		case State_Die:
			Logic_Die();
			break;

		case State_Writhing:			
			Logic_Writhing();
			break;

		case State_Engage:
			Logic_Engage();
			break;

		case State_PositionSet:
			Logic_PositionSet();
			break;

		case State_PositionMove:
			Logic_PositionMove();
			break;

		case State_Retreat:
			Logic_Retreat();
			break;

		case State_Dead:

			if (!m_bRegisteredDeath)
			{
				m_sLayerOverride = CRealm::LayerBg;
				GameMessage msg;
				msg.msg_Death.eType = typeDeath;
				msg.msg_Death.sPriority = 0;
				pDemon = m_pRealm->m_aclassHeads[CThing::CDemonID].GetNext();
				if (pDemon)
					SendThingMessage(&msg, pDemon);
				CDoofus::OnDead();
				CDoofus::RegisterDeath();
				m_spritePrompt.m_sInFlags |= CSprite::InHidden;
				m_pRealm->m_scene.RemoveSprite(&m_sprite);
				m_pRealm->m_smashatorium.Remove(&m_smash);
			}
			return;
			break;

		case State_PanicBegin:
			Logic_PanicBegin();
			break;

		case State_PanicContinue:
			Logic_PanicContinue();
			// Call this a few times to make it happen more often, since
			// it normally happens only every 10th time.
			PlaySoundRandom();
			PlaySoundRandom();
			PlaySoundRandom();
			PlaySoundRandom();
			break;

		case State_WalkBegin:
			Logic_WalkBegin();
			break;

		case State_WalkContinue:
			Logic_WalkContinue();
			break;

		case State_DelayShoot:
			Logic_DelayShoot();
			break;

		case State_AvoidFire:
			Logic_AvoidFire();
			break;

		case State_Helping:
			Logic_Helping();
			break;

		case State_March:
			Logic_MarchBegin();
			break;

		case State_HideBegin:
			Logic_HideBegin();
			break;

		case State_Hide:
			Logic_Hide();
			break;

		default:
			// If it ever gets to this case, then it has entered an unknown
			// state which may perhaps be out of range.  Please note the
			// value of the state to check to see if it is in the valid range
			// of states, and also note the m_ePreviousState to see if we can
			// detect where the error occurred.
#if 1
			TRACE("Current state is %d - description is on next line if possible\n", m_state);
			if (m_state < NumThing3dStates)
				TRACE("Current state is %s\n", ms_apszStateNames[m_state]);
			ASSERT(0);
			ASSERT(m_state > 0);
			if (m_state == m_ePreviousState)
				TRACE("STATE-ALERT Probably an uninitialized previous state\n");
#else
			/*if (rspMsgBox(
						RSP_MB_ICN_EXCLAIM | RSP_MB_BUT_YESNO,
						g_pszAppName,
						"Person.cpp encountered an unexpected state.\n"
						"Displaying the state's description may cause a crash.\n"
						"Would you like to see the state's description?\n"
						"%s",
						(m_state < 0) ? "The state is negative!!" : "") == RSP_MB_RET_YES)
					{
					rspMsgBox(
						RSP_MB_ICN_INFO | RSP_MB_BUT_OK,
						g_pszAppName,
						"The state is \"%s\" (%ld).\n"
						"%s",
						ms_apszStateNames[m_state],
						m_state,
						(m_state == m_ePreviousState) ? "STATE-ALERT Probably an uninitialized previous state!" : "");
					}*/
#endif
			break;
		}

		// Update the avoidance smash
		m_smashAvoid.m_sphere.sphere.X = m_dX + (rspCos(m_dRot) * ms_lAvoidRadius);
		m_smashAvoid.m_sphere.sphere.Y = m_dY;
		m_smashAvoid.m_sphere.sphere.Z = m_dZ - (rspSin(m_dRot) * ms_lAvoidRadius);

		// Determine appropriate position for main smash.
		PositionSmash();

		// Update the smash.
		m_pRealm->m_smashatorium.Update(&m_smash);

		m_lPrevTime = lThisTime;

		// Call base class //////////////////////////////////////////////////////

		CCharacter::Update();
	}
}

////////////////////////////////////////////////////////////////////////////////
// Render object.
////////////////////////////////////////////////////////////////////////////////
void CPerson::Render(void)
{

	#ifdef MSTATS																																							
	//m_sShowState = true;
	#endif

	if (m_sShowState != FALSE)	
	{
		m_rstrLogicName = ms_apszStateNames[m_state];
		m_rstrLogicName += "/";
		m_rstrLogicName += ms_apszActionNames[m_eCurrentAction];
		m_sprite.m_pszText = (char *)m_rstrLogicName;		
		m_sprite.m_sFontSize = (g_GameSettings.m_cHudMode == 1) ? 19 : 15;
		m_sprite.m_cTextLayerOffset = -10;
		m_sprite.m_sTextOffsetY = -(((CSprite3*)&m_sprite)->m_sRadius*2.5);
		m_sprite.m_sTextOffsetX = 0;
	}
	else
		m_sprite.m_pszText = NULL;
						
	if (m_state == State_Dead)
	{	
		m_sprite.m_cFrameTokenLevel = 1;	
		m_sprite.m_cFrameTokenLevelExclude = 1;		
	}
	else
	{
		m_sprite.m_cFrameTokenLevel = 2;
	}
		 
	CDoofus::Render();		
}

////////////////////////////////////////////////////////////////////////////////
// Logic_Writhing - special case for the cop since he has to crawl
////////////////////////////////////////////////////////////////////////////////

void CPerson::Logic_Writhing(void)
{
	//	m_dAnimRot = m_dRot;

	// todo: magic #
			CDude *pDude = (CDude*)FindExecutor();
			if (pDude)
			{											
				switch (pDude->m_pController->m_cControlSchemeId)
				{
					case CONTROL_SCHEME_STANDARD:
					case CONTROL_SCHEME_STANDARD_ALT:		
						PreparePrompt(PromptPulseY);
					break;
					case CONTROL_SCHEME_WINGMAN:						
					case CONTROL_SCHEME_REVERSE:
						PreparePrompt(PromptPulseDPadUp);
					break;
					case CONTROL_SCHEME_TWINSTICK:	
						PreparePrompt(PromptPulseD);
					break;
				}			
				m_smash.m_bits |= CSmash::FinishHim;				
			}		
			else
			{
				m_smash.m_bits &= ~CSmash::FinishHim;
				m_spritePrompt.m_sInFlags |= CSprite::InHidden;	
			}	


	CDoofus::Logic_Writhing();

	//	if (m_ePersonType == Personatorium::Cop || m_ePersonType == Personatorium::Gunner)
	if (g_apersons[m_ePersonType].eWrithingMotion != Personatorium::Still)
	{
		double dX = m_dX;
		double dZ = m_dZ;
		double dNewX;
		double dNewY;
		double dNewZ;
		double dSeconds = (m_pRealm->m_time.GetGameTime() - m_lPrevTime) / 1000.0;

		m_dAcc = ms_dAccUser;
		UpdateVelocities(dSeconds, ms_dMaxCrawlVel, ms_dMaxCrawlVel);
		GetNewPosition(&dNewX, &dNewY, &dNewZ, dSeconds);
		if (MakeValidPosition(&dNewX, &dNewY, &dNewZ, WRITHING_VERTICAL_TOLERANCE) == true)
		{
			// Update Values /////////////////////////////////////////////////////////

			m_dX = dNewX;
			m_dY = dNewY;
			m_dZ = dNewZ;

			UpdateFirePosition();
		}
		else
		{
			// Restore Values ////////////////////////////////////////////////////////

			m_dVel -= m_dDeltaVel;
		}

#if 1
		// Get radius.
		int16_t sRadius = m_sprite.m_sRadius;
		// Determine pseudo-head point.
		int16_t sRot = rspMod360(m_dAnimRot);
		float cosp;
		float sinp;
		rspSinCos(float(sRot), &sinp, &cosp);
		int16_t sPseudoHeadX = m_dX + cosp * sRadius;
		int16_t sPseudoHeadY = m_dZ - sinp * sRadius;
		// Check pseudo-head point.
		U16 u16Attrib = 0;	 // Safety.
		int16_t sHeight = 0; // Safety.
		GetFloorAttributes(sPseudoHeadX, sPseudoHeadY, &u16Attrib, &sHeight);
		if ((u16Attrib & REALM_ATTR_NOT_WALKABLE) || sHeight > m_dY + WRITHING_VERTICAL_TOLERANCE || (dX == m_dX && dZ == m_dZ))
		{
			// Die real soon.
			m_stockpile.m_sHitPoints = 0;
		}
		else
		{
			if (g_apersons[m_ePersonType].eWrithingMotion == Personatorium::PushBack)
			{
				// If they are supposed to push themselves on their back, then the
				// animation angle and the direction angle need to be 180 degrees
				// apart.
				if (m_dRot != rspMod360(m_dAnimRot + 180))
					m_dRot = rspMod360(m_dAnimRot + 180);
			}
		}
#else
		//		if (m_ePersonType == Personatorium::Gunner)
		if (g_apersons[m_ePersonType].eWrithingMotion == Personatorium::PushBack)
		{
#if 1
			// If he hits something, just make him die since his hotspot
			// is not in the correct place, he rotates around his feet
			// and it looks weird.
			m_stockpile.m_sHitPoints = 0;

			if (m_dRot != rspMod360(m_dAnimRot + 180))
				m_dRot = rspMod360(m_dAnimRot + 180);
#else
			if (dX == m_dX && dZ == m_dZ)
			{
				// This is a sort of randomness that will make some turn left and
				// others turn right depending on if their rotation is even or odd.
				if (((int16_t)m_dRot) & 0x01)
					m_dRot = rspMod360(m_dRot - 20);
				else
					m_dRot = rspMod360(m_dRot + 20);
				m_dAnimRot = rspMod360(m_dRot + 180);
			}
#endif
		}
		else
		{
			// If he didn't move at all, then turn him so he will
			// avoid the wall
			if (dX == m_dX && dZ == m_dZ)
			{
#if 1
				// If he hits something, just make him die since his hotspot
				// is not in the correct place, he rotates around his feet
				// and it looks weird.
				m_stockpile.m_sHitPoints = 0;
#else
				// This is a sort of randomness that will make some turn left and
				// others turn right depending on if their rotation is even or odd.
				if (((int16_t)m_dRot) & 0x01)
					m_dAnimRot = m_dShootAngle = m_dRot = rspMod360(m_dRot - 20);
				else
					m_dAnimRot = m_dShootAngle = m_dRot = rspMod360(m_dRot + 20);
#endif
			}
		}
#endif
	}
}

////////////////////////////////////////////////////////////////////////////////
// Shutdown object
////////////////////////////////////////////////////////////////////////////////
int16_t CPerson::Shutdown(void) // Returns 0 if successfull, non-zero otherwise
{
	return 0;
}

////////////////////////////////////////////////////////////////////////////////
// Get all required resources
////////////////////////////////////////////////////////////////////////////////
int16_t CPerson::GetResources(void) // Returns 0 if successfull, non-zero otherwise
{
	int16_t sResult = 0;
	int16_t sLoadResult = 0;

	// Load Stand animation
	sResult = m_animStand.Get(g_apersons[m_ePersonType].Anim.pszBaseName,
							  g_apersons[m_ePersonType].Anim.sTextureScheme,
							  "stand",
							  g_apersons[m_ePersonType].Anim.pszObjectName,
							  g_apersons[m_ePersonType].Anim.pszEventName,
							  g_apersons[m_ePersonType].Anim.pszHandName,
							  RChannel_LoopAtStart | RChannel_LoopAtEnd);	

	// Load Run animation, or load stand in its place if that fails
	sLoadResult = m_animRun.Get(g_apersons[m_ePersonType].Anim.pszBaseName,
								g_apersons[m_ePersonType].Anim.sTextureScheme,
								"run",
								g_apersons[m_ePersonType].Anim.pszObjectName,
								g_apersons[m_ePersonType].Anim.pszEventName,
								g_apersons[m_ePersonType].Anim.pszHandName,
								RChannel_LoopAtStart | RChannel_LoopAtEnd);
	if (sLoadResult != SUCCESS)
		sResult |= m_animRun.Get(g_apersons[m_ePersonType].Anim.pszBaseName,
								 g_apersons[m_ePersonType].Anim.sTextureScheme,
								 "stand",
								 g_apersons[m_ePersonType].Anim.pszObjectName,
								 g_apersons[m_ePersonType].Anim.pszEventName,
								 g_apersons[m_ePersonType].Anim.pszHandName,
								 RChannel_LoopAtStart | RChannel_LoopAtEnd);

	// Load Shoot animation or load stand in its place if that fails
	sLoadResult = m_animShoot.Get(g_apersons[m_ePersonType].Anim.pszBaseName,
								  g_apersons[m_ePersonType].Anim.sTextureScheme,
								  "shoot",
								  g_apersons[m_ePersonType].Anim.pszObjectName,
								  g_apersons[m_ePersonType].Anim.pszEventName,
								  g_apersons[m_ePersonType].Anim.pszHandName,
								  0);
	if (sLoadResult != SUCCESS)
		sResult |= m_animShoot.Get(g_apersons[m_ePersonType].Anim.pszBaseName,
								   g_apersons[m_ePersonType].Anim.sTextureScheme,
								   "stand",
								   g_apersons[m_ePersonType].Anim.pszObjectName,
								   g_apersons[m_ePersonType].Anim.pszEventName,
								   g_apersons[m_ePersonType].Anim.pszHandName,
								   RChannel_LoopAtStart | RChannel_LoopAtEnd);

	// Load Shot animation or load stand in its place if that fails
	sLoadResult = m_animShot.Get(g_apersons[m_ePersonType].Anim.pszBaseName,
								 g_apersons[m_ePersonType].Anim.sTextureScheme,
								 "shot",
								 g_apersons[m_ePersonType].Anim.pszObjectName,
								 g_apersons[m_ePersonType].Anim.pszEventName,
								 g_apersons[m_ePersonType].Anim.pszHandName,
								 0);
	if (sLoadResult != SUCCESS)
		sResult |= m_animShot.Get(g_apersons[m_ePersonType].Anim.pszBaseName,
								  g_apersons[m_ePersonType].Anim.sTextureScheme,
								  "stand",
								  g_apersons[m_ePersonType].Anim.pszObjectName,
								  g_apersons[m_ePersonType].Anim.pszEventName,
								  g_apersons[m_ePersonType].Anim.pszHandName,
								  RChannel_LoopAtStart | RChannel_LoopAtEnd);

	// Load Die animation or load stand in its place if that fails
	sLoadResult = m_animDie.Get(g_apersons[m_ePersonType].Anim.pszBaseName,
								g_apersons[m_ePersonType].Anim.sTextureScheme,
								"die",
								g_apersons[m_ePersonType].Anim.pszObjectName,
								g_apersons[m_ePersonType].Anim.pszEventName,
								g_apersons[m_ePersonType].Anim.pszHandName,
								0);
	if (sLoadResult != SUCCESS)
		sResult |= m_animDie.Get(g_apersons[m_ePersonType].Anim.pszBaseName,
								 g_apersons[m_ePersonType].Anim.sTextureScheme,
								 "stand",
								 g_apersons[m_ePersonType].Anim.pszObjectName,
								 g_apersons[m_ePersonType].Anim.pszEventName,
								 g_apersons[m_ePersonType].Anim.pszHandName,
								 RChannel_LoopAtStart | RChannel_LoopAtEnd);

	// Load Writhing animation or load stand in its place if that fails
	sLoadResult = m_animWrithing.Get(g_apersons[m_ePersonType].Anim.pszBaseName,
									 g_apersons[m_ePersonType].Anim.sTextureScheme,
									 "writhing",
									 g_apersons[m_ePersonType].Anim.pszObjectName,
									 g_apersons[m_ePersonType].Anim.pszEventName,
									 g_apersons[m_ePersonType].Anim.pszHandName,
									 RChannel_LoopAtEnd);
	if (sLoadResult != SUCCESS)
		sResult |= m_animWrithing.Get(g_apersons[m_ePersonType].Anim.pszBaseName,
									  g_apersons[m_ePersonType].Anim.sTextureScheme,
									  "stand",
									  g_apersons[m_ePersonType].Anim.pszObjectName,
									  g_apersons[m_ePersonType].Anim.pszEventName,
									  g_apersons[m_ePersonType].Anim.pszHandName,
									  RChannel_LoopAtStart | RChannel_LoopAtEnd);

	// Load Executed animation or load stand in its place if that fails
	sLoadResult = m_animExecuted.Get(g_apersons[m_ePersonType].Anim.pszBaseName,
									 g_apersons[m_ePersonType].Anim.sTextureScheme,
									 "executed",
									 g_apersons[m_ePersonType].Anim.pszObjectName,
									 g_apersons[m_ePersonType].Anim.pszEventName,
									 g_apersons[m_ePersonType].Anim.pszHandName,
									 0);
	if (sLoadResult != SUCCESS)
		sResult |= m_animExecuted.Get(g_apersons[m_ePersonType].Anim.pszBaseName,
									  g_apersons[m_ePersonType].Anim.sTextureScheme,
									  "stand",
									  g_apersons[m_ePersonType].Anim.pszObjectName,
									  g_apersons[m_ePersonType].Anim.pszEventName,
									  g_apersons[m_ePersonType].Anim.pszHandName,
									  RChannel_LoopAtStart | RChannel_LoopAtEnd);

	// Load Onfire animation animation or load stand in its place if that fails
	sLoadResult = m_animOnfire.Get(g_apersons[m_ePersonType].Anim.pszBaseName,
								   g_apersons[m_ePersonType].Anim.sTextureScheme,
								   "onfire",
								   g_apersons[m_ePersonType].Anim.pszObjectName,
								   g_apersons[m_ePersonType].Anim.pszEventName,
								   g_apersons[m_ePersonType].Anim.pszHandName,
								   RChannel_LoopAtEnd);

	if (sLoadResult != SUCCESS)
	{
		sResult |= m_animOnfire.Get(g_apersons[m_ePersonType].Anim.pszBaseName,
									g_apersons[m_ePersonType].Anim.sTextureScheme,
									"run",
									g_apersons[m_ePersonType].Anim.pszObjectName,
									g_apersons[m_ePersonType].Anim.pszEventName,
									g_apersons[m_ePersonType].Anim.pszHandName,
									RChannel_LoopAtEnd);

		if (sLoadResult != SUCCESS)
			sResult |= m_animOnfire.Get(g_apersons[m_ePersonType].Anim.pszBaseName,
										g_apersons[m_ePersonType].Anim.sTextureScheme,
										"stand",
										g_apersons[m_ePersonType].Anim.pszObjectName,
										g_apersons[m_ePersonType].Anim.pszEventName,
										g_apersons[m_ePersonType].Anim.pszHandName,
										RChannel_LoopAtStart | RChannel_LoopAtEnd);
	}

	// Load Walk animation animation or load stand in its place if that fails
	sLoadResult = m_animWalk.Get(g_apersons[m_ePersonType].Anim.pszBaseName,
								 g_apersons[m_ePersonType].Anim.sTextureScheme,
								 "walk",
								 g_apersons[m_ePersonType].Anim.pszObjectName,
								 g_apersons[m_ePersonType].Anim.pszEventName,
								 g_apersons[m_ePersonType].Anim.pszHandName,
								 RChannel_LoopAtEnd);
	if (sLoadResult != SUCCESS)
		sResult |= m_animWalk.Get(g_apersons[m_ePersonType].Anim.pszBaseName,
								  g_apersons[m_ePersonType].Anim.sTextureScheme,
								  "stand",
								  g_apersons[m_ePersonType].Anim.pszObjectName,
								  g_apersons[m_ePersonType].Anim.pszEventName,
								  g_apersons[m_ePersonType].Anim.pszHandName,
								  RChannel_LoopAtStart | RChannel_LoopAtEnd);
	if (sResult != SUCCESS)
		TRACE("CPerson::GetResources - Error loading animation resources\n");

	// Load ShootRun animation, or try Shoot if there isn't one, or stand as last option
	sLoadResult = m_animShootRun.Get(g_apersons[m_ePersonType].Anim.pszBaseName,
									 g_apersons[m_ePersonType].Anim.sTextureScheme,
									 "runshoot",
									 g_apersons[m_ePersonType].Anim.pszObjectName,
									 g_apersons[m_ePersonType].Anim.pszEventName,
									 g_apersons[m_ePersonType].Anim.pszHandName,
									 0);
	if (sLoadResult != SUCCESS)
	{
		sLoadResult = m_animShootRun.Get(g_apersons[m_ePersonType].Anim.pszBaseName,
										 g_apersons[m_ePersonType].Anim.sTextureScheme,
										 "shoot",
										 g_apersons[m_ePersonType].Anim.pszObjectName,
										 g_apersons[m_ePersonType].Anim.pszEventName,
										 g_apersons[m_ePersonType].Anim.pszHandName,
										 0);
		if (sLoadResult != SUCCESS)
			sResult |= m_animShootRun.Get(g_apersons[m_ePersonType].Anim.pszBaseName,
										  g_apersons[m_ePersonType].Anim.sTextureScheme,
										  "stand",
										  g_apersons[m_ePersonType].Anim.pszObjectName,
										  g_apersons[m_ePersonType].Anim.pszEventName,
										  g_apersons[m_ePersonType].Anim.pszHandName,
										  0);
	}

	// Load ShootRunR0 animation, or try Shoot if there isn't one, or stand as last option
	sLoadResult = m_animShootRunR0.Get(g_apersons[m_ePersonType].Anim.pszBaseName,
									   g_apersons[m_ePersonType].Anim.sTextureScheme,
									   "45rt",
									   g_apersons[m_ePersonType].Anim.pszObjectName,
									   g_apersons[m_ePersonType].Anim.pszEventName,
									   g_apersons[m_ePersonType].Anim.pszHandName,
									   0);
	if (sLoadResult != SUCCESS)
	{
		sLoadResult = m_animShootRunR0.Get(g_apersons[m_ePersonType].Anim.pszBaseName,
										   g_apersons[m_ePersonType].Anim.sTextureScheme,
										   "shoot",
										   g_apersons[m_ePersonType].Anim.pszObjectName,
										   g_apersons[m_ePersonType].Anim.pszEventName,
										   g_apersons[m_ePersonType].Anim.pszHandName,
										   0);
		if (sLoadResult != SUCCESS)
			sResult |= m_animShootRunR0.Get(g_apersons[m_ePersonType].Anim.pszBaseName,
											g_apersons[m_ePersonType].Anim.sTextureScheme,
											"stand",
											g_apersons[m_ePersonType].Anim.pszObjectName,
											g_apersons[m_ePersonType].Anim.pszEventName,
											g_apersons[m_ePersonType].Anim.pszHandName,
											0);
	}

	// Load ShootRunR1 animation, or try Shoot if there isn't one, or stand as last option
	sLoadResult = m_animShootRunR1.Get(g_apersons[m_ePersonType].Anim.pszBaseName,
									   g_apersons[m_ePersonType].Anim.sTextureScheme,
									   "90rt",
									   g_apersons[m_ePersonType].Anim.pszObjectName,
									   g_apersons[m_ePersonType].Anim.pszEventName,
									   g_apersons[m_ePersonType].Anim.pszHandName,
									   0);
	if (sLoadResult != SUCCESS)
	{
		sLoadResult = m_animShootRunR1.Get(g_apersons[m_ePersonType].Anim.pszBaseName,
										   g_apersons[m_ePersonType].Anim.sTextureScheme,
										   "shoot",
										   g_apersons[m_ePersonType].Anim.pszObjectName,
										   g_apersons[m_ePersonType].Anim.pszEventName,
										   g_apersons[m_ePersonType].Anim.pszHandName,
										   0);
		if (sLoadResult != SUCCESS)
			sResult |= m_animShootRunR1.Get(g_apersons[m_ePersonType].Anim.pszBaseName,
											g_apersons[m_ePersonType].Anim.sTextureScheme,
											"stand",
											g_apersons[m_ePersonType].Anim.pszObjectName,
											g_apersons[m_ePersonType].Anim.pszEventName,
											g_apersons[m_ePersonType].Anim.pszHandName,
											0);
	}

	// Load ShootRunL0 animation, or try Shoot if there isn't one, or stand as last option
	sLoadResult = m_animShootRunL0.Get(g_apersons[m_ePersonType].Anim.pszBaseName,
									   g_apersons[m_ePersonType].Anim.sTextureScheme,
									   "45lft",
									   g_apersons[m_ePersonType].Anim.pszObjectName,
									   g_apersons[m_ePersonType].Anim.pszEventName,
									   g_apersons[m_ePersonType].Anim.pszHandName,
									   0);
	if (sLoadResult != SUCCESS)
	{
		sLoadResult = m_animShootRunL0.Get(g_apersons[m_ePersonType].Anim.pszBaseName,
										   g_apersons[m_ePersonType].Anim.sTextureScheme,
										   "shoot",
										   g_apersons[m_ePersonType].Anim.pszObjectName,
										   g_apersons[m_ePersonType].Anim.pszEventName,
										   g_apersons[m_ePersonType].Anim.pszHandName,
										   0);
		if (sLoadResult != SUCCESS)
			sResult |= m_animShootRunL0.Get(g_apersons[m_ePersonType].Anim.pszBaseName,
											g_apersons[m_ePersonType].Anim.sTextureScheme,
											"stand",
											g_apersons[m_ePersonType].Anim.pszObjectName,
											g_apersons[m_ePersonType].Anim.pszEventName,
											g_apersons[m_ePersonType].Anim.pszHandName,
											0);
	}

	// Load ShootRunL1 animation, or try Shoot if there isn't one, or stand as last option
	sLoadResult = m_animShootRunL1.Get(g_apersons[m_ePersonType].Anim.pszBaseName,
									   g_apersons[m_ePersonType].Anim.sTextureScheme,
									   "90lft",
									   g_apersons[m_ePersonType].Anim.pszObjectName,
									   g_apersons[m_ePersonType].Anim.pszEventName,
									   g_apersons[m_ePersonType].Anim.pszHandName,
									   0);
	if (sLoadResult != SUCCESS)
	{
		sLoadResult = m_animShootRunL1.Get(g_apersons[m_ePersonType].Anim.pszBaseName,
										   g_apersons[m_ePersonType].Anim.sTextureScheme,
										   "shoot",
										   g_apersons[m_ePersonType].Anim.pszObjectName,
										   g_apersons[m_ePersonType].Anim.pszEventName,
										   g_apersons[m_ePersonType].Anim.pszHandName,
										   0);
		if (sLoadResult != SUCCESS)
			sResult |= m_animShootRunL1.Get(g_apersons[m_ePersonType].Anim.pszBaseName,
											g_apersons[m_ePersonType].Anim.sTextureScheme,
											"stand",
											g_apersons[m_ePersonType].Anim.pszObjectName,
											g_apersons[m_ePersonType].Anim.pszEventName,
											g_apersons[m_ePersonType].Anim.pszHandName,
											0);
	}

	// Load ShootRunBack animation, or try Shoot if there isn't one, or stand as last option
	sLoadResult = m_animShootRunBack.Get(g_apersons[m_ePersonType].Anim.pszBaseName,
										 g_apersons[m_ePersonType].Anim.sTextureScheme,
										 "runbackwr",
										 g_apersons[m_ePersonType].Anim.pszObjectName,
										 g_apersons[m_ePersonType].Anim.pszEventName,
										 g_apersons[m_ePersonType].Anim.pszHandName,
										 0);
	if (sLoadResult != SUCCESS)
	{
		sLoadResult = m_animShootRunBack.Get(g_apersons[m_ePersonType].Anim.pszBaseName,
											 g_apersons[m_ePersonType].Anim.sTextureScheme,
											 "shoot",
											 g_apersons[m_ePersonType].Anim.pszObjectName,
											 g_apersons[m_ePersonType].Anim.pszEventName,
											 g_apersons[m_ePersonType].Anim.pszHandName,
											 0);
		if (sLoadResult != SUCCESS)
			sResult |= m_animShootRunBack.Get(g_apersons[m_ePersonType].Anim.pszBaseName,
											  g_apersons[m_ePersonType].Anim.sTextureScheme,
											  "stand",
											  g_apersons[m_ePersonType].Anim.pszObjectName,
											  g_apersons[m_ePersonType].Anim.pszEventName,
											  g_apersons[m_ePersonType].Anim.pszHandName,
											  0);
	}

	// Load Crouch animation, or load stand in its place if that fails
	sLoadResult = m_animCrouch.Get(g_apersons[m_ePersonType].Anim.pszBaseName,
								   g_apersons[m_ePersonType].Anim.sTextureScheme,
								   "crouch",
								   g_apersons[m_ePersonType].Anim.pszObjectName,
								   g_apersons[m_ePersonType].Anim.pszEventName,
								   g_apersons[m_ePersonType].Anim.pszHandName,
								   0);
	if (sLoadResult != SUCCESS)
		sResult |= m_animCrouch.Get(g_apersons[m_ePersonType].Anim.pszBaseName,
									g_apersons[m_ePersonType].Anim.sTextureScheme,
									"stand",
									g_apersons[m_ePersonType].Anim.pszObjectName,
									g_apersons[m_ePersonType].Anim.pszEventName,
									g_apersons[m_ePersonType].Anim.pszHandName,
									0);

	// Load Search animation, or load stand in its place if that fails
	sLoadResult = m_animSearch.Get(g_apersons[m_ePersonType].Anim.pszBaseName,
								   g_apersons[m_ePersonType].Anim.sTextureScheme,
								   "search",
								   g_apersons[m_ePersonType].Anim.pszObjectName,
								   g_apersons[m_ePersonType].Anim.pszEventName,
								   g_apersons[m_ePersonType].Anim.pszHandName,
								   RChannel_LoopAtStart | RChannel_LoopAtEnd);
	if (sLoadResult != SUCCESS)
		sResult |= m_animSearch.Get(g_apersons[m_ePersonType].Anim.pszBaseName,
									g_apersons[m_ePersonType].Anim.sTextureScheme,
									"stand",
									g_apersons[m_ePersonType].Anim.pszObjectName,
									g_apersons[m_ePersonType].Anim.pszEventName,
									g_apersons[m_ePersonType].Anim.pszHandName,
									RChannel_LoopAtStart | RChannel_LoopAtEnd);

	// Get execution target points -- NOT essential.
	char szExeTargetResName[RSP_MAX_PATH];
	sprintf(szExeTargetResName, "%s_writhing_exe.trans", g_apersons[m_ePersonType].Anim.pszBaseName);
	sLoadResult = rspGetResource(&g_resmgrGame, szExeTargetResName, &m_ptransExecutionTarget);
	if (sLoadResult == 0)
	{
		m_ptransExecutionTarget->SetLooping(RChannel_LoopAtStart | RChannel_LoopAtEnd);
	}

	//todo??
	if (strstr((char *)m_rstrLogicFile, "logics") != NULL)
	{
		char tmp[100];
		sprintf(tmp, "/cd/%s", (char *)m_rstrLogicFile);
		m_rstrLogicFile = tmp;
	}

	// Get Logic Table
	sResult |= rspGetResource(&g_resmgrRes, (char *)m_rstrLogicFile, &m_pLogicTable);

	// Get base class resources.
	sResult |= CDoofus::GetResources();

	return sResult;
}

////////////////////////////////////////////////////////////////////////////////
// Free all resources
////////////////////////////////////////////////////////////////////////////////
int16_t CPerson::FreeResources(void) // Returns 0 if successfull, non-zero otherwise
{
	bool purge = m_pRealm->m_flags.bPurgeResOnShutdown;
	purge = false;
	m_animRun.Release(purge);
	m_animStand.Release(purge);
	m_animShoot.Release(purge);
	m_animShot.Release(purge);
	m_animDie.Release(purge);
	m_animWrithing.Release(purge);
	m_animExecuted.Release(purge);
	m_animOnfire.Release(purge);
	m_animWalk.Release(purge);
	m_animShootRun.Release(purge);
	m_animShootRunL0.Release(purge);
	m_animShootRunL1.Release(purge);
	m_animShootRunR0.Release(purge);
	m_animShootRunR1.Release(purge);
	m_animShootRunBack.Release(purge);
	m_animCrouch.Release(purge);
	m_animSearch.Release(purge);

	if (purge)
	{
		rspReleaseAndPurgeResource(&g_resmgrRes, &m_pLogicTable);
		// If we have the execution target points . . .
		if (m_ptransExecutionTarget)
			rspReleaseAndPurgeResource(&g_resmgrGame, &m_ptransExecutionTarget);
	}
	else
	{
		rspReleaseResource(&g_resmgrRes, &m_pLogicTable);
		// If we have the execution target points . . .
		if (m_ptransExecutionTarget)
			rspReleaseResource(&g_resmgrGame, &m_ptransExecutionTarget);
	}

	// Release base class resources.
	CDoofus::ReleaseResources();

	return 0;
}

////////////////////////////////////////////////////////////////////////////////
// PlaySoundWrithing - choose among the writhing sound effects
////////////////////////////////////////////////////////////////////////////////

SampleMaster::SoundInstance CPerson::PlaySoundWrithing(
	int32_t *plDuration) // Out:  Duration of sample, if not NULL.
{
	m_siPlaying = 0;
	SampleMasterID *psmid = &g_smidNil;

	//#ifdef MOBILE //Reduce annoying comments when dying
	if ((demoCompat) || (++m_usCommentCounter % 5 == 0))
	{
		//#endif
		switch (GetRandom() % 4)
		{
		case 0:
			psmid = g_apersons[m_ePersonType].Sample.psmidSuffering1;
			break;

		case 1:
			psmid = g_apersons[m_ePersonType].Sample.psmidSuffering2;
			break;

		case 2:
			psmid = g_apersons[m_ePersonType].Sample.psmidSuffering3;
			break;

		case 3:
			psmid = g_apersons[m_ePersonType].Sample.psmidSuffering4;
			break;
		}

		if (g_ucMinimalSampleSetEnabled)
		{
			// Try to get an alternative sound if certain sounds have been culled to save memory.		
			GetSoundWrithingAlt(&psmid);		
		}


		PlaySample(					 // Returns nothing.
									 // Does not fail.
			*psmid,					 // In:  Identifier of sample you want played.
			SampleMaster::Suffering, // In:  Sound Volume Category for user adjustment
			-1,						 // In:  Initial Sound Volume (0 - 255)
									 // Negative indicates to use the distance to the ear.
			&m_siPlaying,			 // Out: Handle for adjusting sound volume
			plDuration);			 // Out: Sample duration in ms, if not NULL.
									 //#ifdef MOBILE
	}
	//#endif
	return m_siPlaying;
}

////////////////////////////////////////////////////////////////////////////////
// PlaySoundShot - choose among the shot sound effects
////////////////////////////////////////////////////////////////////////////////

SampleMaster::SoundInstance CPerson::PlaySoundShot(void)
{
	m_siPlaying = 0;
	SampleMasterID *psmid = &g_smidNil;
	int32_t lThisTime = m_pRealm->m_time.GetGameTime();
	int32_t lSampleDuration = 0; // Safety.
	static int_fast8_t chModGrunts = 0;

	if ((++chModGrunts > (16 - g_GameSettings.m_sPainFrequency)) && (lThisTime > m_lSampleTimeIsPlaying))
	{
		if (m_state == State_Writhing)
		{
			// Use the generic grunt when shot from writhing, so that they
			// don't accidently say something stupid like Oh my leg when
			// you execute them by shooting them in the head.
			psmid = &g_smidRubinAh;
		}
		else
		{
			switch (GetRandom() % 4)
			{
			case 0:
				if (m_bHitComment)
				{
					psmid = g_apersons[m_ePersonType].Sample.psmidShot2;
				}
				else
				{
					psmid = g_apersons[m_ePersonType].Sample.psmidShot1;
					m_bHitComment = true;
				}
				break;

			case 1:
				psmid = g_apersons[m_ePersonType].Sample.psmidShot2;
				break;

			case 2:
				psmid = g_apersons[m_ePersonType].Sample.psmidShot3;
				break;

			case 3:
				psmid = g_apersons[m_ePersonType].Sample.psmidShot4;
				break;
			}
		}

		// We must get the sample duration from the PlaySample() function and NOT
		// from the RSnd that it returns.  The reason is that if we fail to play
		// the sample (perhaps all the sound channels are in use), we still need
		// the time reflected for the duration to be the same so the game will
		// run consistently no matter the speed of sound playback.  It could even
		// be the case that there is no sound card in which case the only way to
		// get it to run the same from machine to machine is to use the sample
		// duration whether we succeed or fail to play the sample.
		m_lSampleTimeIsPlaying = lThisTime + lSampleDuration;

		// reset counter
		chModGrunts = 0;
		TRACE("played grunt\n");
	}

	TRACE("chModGrunts = %d\n", chModGrunts);


	if (g_ucMinimalSampleSetEnabled)
	{
		// Try to get an alternative sound if certain sounds have been culled to save memory.		
		GetSoundShotAlt(&psmid);
	}
	
	PlaySample(				// Returns nothing.
							// Does not fail.
		*psmid,				// In:  Identifier of sample you want played.
		SampleMaster::Pain, // In:  Sound Volume Category for user adjustment
		-1,					// In:  Initial Sound Volume (0 - 255)
							// Negative indicates to use the distance to the ear.
		&m_siPlaying,		// Out: Handle for adjusting sound volume
		&lSampleDuration);	// Out: Sample duration in ms, if not NULL.

	return m_siPlaying;
}

////////////////////////////////////////////////////////////////////////////////
// PlaySoundBlownup - choose among the blown up sound effects
////////////////////////////////////////////////////////////////////////////////

SampleMaster::SoundInstance CPerson::PlaySoundBlownup(void)
{
	m_siPlaying = 0;
	SampleMasterID *psmid = &g_smidNil;

	switch (GetRandom() % 2)
	{
	case 0:
		psmid = g_apersons[m_ePersonType].Sample.psmidBlownup1;
		break;

	case 1:
		psmid = g_apersons[m_ePersonType].Sample.psmidBlownup2;	
		break;
	}

	if (g_ucMinimalSampleSetEnabled)
	{
		// Try to get an alternative sound if certain sounds have been culled to save memory.		
		GetSoundBlownupAlt(&psmid);		
	}
	
	PlaySample(				// Returns nothing.
							// Does not fail.
		*psmid,				// In:  Identifier of sample you want played.
		SampleMaster::Pain, // In:  Sound Volume Category for user adjustment
		-1,					// In:  Initial Sound Volume (0 - 255)
							// Negative indicates to use the distance to the ear.
		&m_siPlaying);		// Out: Handle for adjusting sound volume

	return m_siPlaying;
}

////////////////////////////////////////////////////////////////////////////////
// PlaySoundBurning - choose among burning yells
////////////////////////////////////////////////////////////////////////////////

SampleMaster::SoundInstance CPerson::PlaySoundBurning(void)
{
	m_siPlaying = 0;
	SampleMasterID *psmid = &g_smidNil;

	switch (GetRandom() % 2)
	{
	case 0:
		psmid = g_apersons[m_ePersonType].Sample.psmidBurning1;
		break;

	case 1:
		psmid = g_apersons[m_ePersonType].Sample.psmidBurning2;
		break;
	}
		
	if (g_ucMinimalSampleSetEnabled)
	{
		// Try to get an alternative sound if certain sounds have been culled to save memory.		
		GetSoundBurningAlt(&psmid);		
	}
	

	PlaySample(				// Returns nothing.
							// Does not fail.
		*psmid,				// In:  Identifier of sample you want played.
		SampleMaster::Pain, // In:  Sound Volume Category for user adjustment
		-1,					// In:  Initial Sound Volume (0 - 255)
							// Negative indicates to use the distance to the ear.
		&m_siPlaying);		// Out: Handle for adjusting sound volume

	return m_siPlaying;
}

////////////////////////////////////////////////////////////////////////////////
// PlaySoundShooting - choose among comments to say before shooting
////////////////////////////////////////////////////////////////////////////////

SampleMaster::SoundInstance CPerson::PlaySoundShooting(void)
{
	m_siPlaying = 0;
	SampleMasterID *psmid = &g_smidNil;

	if (++m_usCommentCounter % 10 == 0 && m_idDude != CIdBank::IdNil)
	{
		switch (GetRandom() % 4)
		{
		case 0:
			psmid = g_apersons[m_ePersonType].Sample.psmidShooting1;
			break;

		case 1:
			psmid = g_apersons[m_ePersonType].Sample.psmidShooting2;
			break;

		case 2:
			psmid = g_apersons[m_ePersonType].Sample.psmidShooting3;
			break;

		case 3:
			psmid = g_apersons[m_ePersonType].Sample.psmidShooting4;
			break;
		}
	}

	if (g_ucMinimalSampleSetEnabled)
	{
		// Try to get an alternative sound if certain sounds have been culled to save memory.		
		GetSoundShootingAlt(&psmid);		
	}
	

	PlaySample(				  // Returns nothing.
							  // Does not fail.
		*psmid,				  // In:  Identifier of sample you want played.
		SampleMaster::Voices, // In:  Sound Volume Category for user adjustment
		-1,					  // In:  Initial Sound Volume (0 - 255)
							  // Negative indicates to use the distance to the ear.
		&m_siPlaying);		  // Out: Handle for adjusting sound volume

	return m_siPlaying;
}

////////////////////////////////////////////////////////////////////////////////
// PlaySoundDying - choose among dying sounds and comments
////////////////////////////////////////////////////////////////////////////////

SampleMaster::SoundInstance CPerson::PlaySoundDying(void)
{
	m_siPlaying = 0;
	SampleMasterID *psmid = &g_smidNil;

	if (++m_usCommentCounter % 4 == 0)
	{
		switch (GetRandom() % 2)
		{
		case 0:
			psmid = g_apersons[m_ePersonType].Sample.psmidDying1;
			break;
		case 1:
			psmid = g_apersons[m_ePersonType].Sample.psmidDying2;
			break;
		}
	}

	if (g_ucMinimalSampleSetEnabled)
	{
		// Try to get an alternative sound if certain sounds have been culled to save memory.		
		GetSoundDyingAlt(&psmid);		
	}

	PlaySample(					 // Returns nothing.
								 // Does not fail.
		*psmid,					 // In:  Identifier of sample you want played.
		SampleMaster::Suffering, // In:  Sound Volume Category for user adjustment
		-1,						 // In:  Initial Sound Volume (0 - 255)
								 // Negative indicates to use the distance to the ear.
		&m_siPlaying);			 // Out: Handle for adjusting sound volume

	return m_siPlaying;
}

////////////////////////////////////////////////////////////////////////////////
// PlaySoundRandom - choose among several random comments
////////////////////////////////////////////////////////////////////////////////

SampleMaster::SoundInstance CPerson::PlaySoundRandom(void)
{
	m_siPlaying = 0;
	SampleMasterID *psmid = &g_smidNil;

	//#ifdef MOBILE //reduce NPC random comments
	int n;
	if (demoCompat)
		n = 10;
	else
		n = 20;
	if (++m_usCommentCounter % n == 0 && m_idDude != CIdBank::IdNil)
	//#else
	//if (++m_usCommentCounter % 10 == 0 && m_idDude != CIdBank::IdNil)
	//#endif
	{
		// Make sure the dude you are tracking is not dead before making any
		// stupid comments about him, like "where did he go?", "Get that guy"
		if (m_idDude != CIdBank::IdNil)
		{
			CDude *pdude;
			if (m_pRealm->m_idbank.GetThingByID((CThing **)&pdude, m_idDude) == 0)
			{
				if (pdude && pdude->m_state != State_Dead)
				{
					switch (GetRandom() % 4)
					{
					case 0:
						psmid = g_apersons[m_ePersonType].Sample.psmidRandom1;
						break;

					case 1:
						psmid = g_apersons[m_ePersonType].Sample.psmidRandom2;
						break;

					case 2:
						psmid = g_apersons[m_ePersonType].Sample.psmidRandom3;
						break;

					case 3:
						psmid = g_apersons[m_ePersonType].Sample.psmidRandom4;
						break;
					}

					if (g_ucMinimalSampleSetEnabled)
					{
						// Try to get an alternative sound if certain sounds have been culled to save memory.		
						GetSoundRandomAlt(&psmid);
					}
	
					PlaySample(				  // Returns nothing.
											  // Does not fail.
						*psmid,				  // In:  Identifier of sample you want played.
						SampleMaster::Voices, // In:  Sound Volume Category for user adjustment
						-1,					  // In:  Initial Sound Volume (0 - 255)
											  // Negative indicates to use the distance to the ear.
						&m_siPlaying);		  // Out: Handle for adjusting sound volume
				}
			}
		}
	}

	return m_siPlaying;
}

////////////////////////////////////////////////////////////
// todo

////////////////////////////////////////////////////////////////////////////////
// GetSoundWrithingAlt - Get alternative writhing sound if minimal-sound-samples
////////////////////////////////////////////////////////////////////////////////
void CPerson::GetSoundWrithingAlt(SampleMasterID **sampleId)
{
		switch (g_ucMinimalSampleSet)
	{		
	// SampleSet #1
	case 1:
		switch ((*sampleId)->sSoundId)
		{					
			case 668: case 669: case 670: *sampleId = &g_smidSakura_ss1; 			break; // Ayame => Sakura
			case 690: case 691: case 692: *sampleId = &g_smidCompshop_ss1; 			break; // Compsales => Compshop
			case 712: case 713: case 714: *sampleId = &g_smidCompsales_ss1; 		break; // Compshop => Compsales	
			case 734: case 735: case 736: *sampleId = &g_smidKazuki_ss1; 			break; // Kazuki	
			case 756: case 757: case 758: *sampleId = &g_smidKensaku_ss1; 			break; // Kensaku
			case 778: case 779: case 780: *sampleId = &g_smidNoboru_ss1; 			break; // Noboru
			case 822: case 823: case 824: *sampleId = &g_smidOsamu_ss1; 			break; // Osamu
			case 866: case 867: case 868: *sampleId = &g_smidTomiko_ss1; 			break; // Sakura => Tomiko
			case 932: case 933: case 934: *sampleId = &g_smidAyame_ss1; 			break; // Tomiko => Ayame
			case 954: case 955: case 956: *sampleId = &g_smidYutaka_ss1; 			break; // Yutaka
			
			case 238 : case 251: 		  *sampleId = &g_smidScottCoughBlood1; 		break; // Scott
			case 422 : case 423: 		  *sampleId = &g_smidAmyCantBreathe;		break; // Stephanie

			case 183: case 223: case 242: case 243: case 245: case 246: case 252: *sampleId = &g_smidPaulRTooYoung; break; // Paul
	

			case 646: case 647: case 648:	*sampleId = &g_smidAsami_ss1; 			break; // Asami
			case 800: case 801: case 802:	*sampleId = &g_smidOsales_ss1; 			break; // Osales
			case 844: case 845: case 846:	*sampleId = &g_smidRyuichi_ss1; 		break; // Ryuichi
			case 888: case 889: case 890:	*sampleId = &g_smidShinobu_ss1; 		break; // Shinobu
			case 910: case 911: case 912:	*sampleId = &g_smidTadao_ss1; 			break; // Tadao

		}
		break;

	// SampleSet #2
	case 2:	
		switch ((*sampleId)->sSoundId)
		{					
			case 667: case 669: case 670: *sampleId = &g_smidSakura_ss2; 			break; // Ayame => Sakura
			case 689: case 691: case 692: *sampleId = &g_smidCompshop_ss2; 		break; // Compsales => Compshop
			case 711: case 713: case 714: *sampleId = &g_smidCompsales_ss2; 			break; // Compshop => Compsales	
			case 733: case 735: case 736: *sampleId = &g_smidKazuki_ss2; 			break; // Kazuki	
			case 755: case 757: case 758: *sampleId = &g_smidKensaku_ss2; 			break; // Kensaku
			case 777: case 779: case 780: *sampleId = &g_smidNoboru_ss2; 			break; // Noboru
			case 821: case 823: case 824: *sampleId = &g_smidOsamu_ss2; 			break; // Osamu
			case 865: case 867: case 868: *sampleId = &g_smidTomiko_ss2; 			break; // Sakura => Tomiko
			case 931: case 933: case 934: *sampleId = &g_smidAyame_ss2; 			break; // Tomiko => Ayame
			case 953: case 955: case 956: *sampleId = &g_smidYutaka_ss2; 			break; // Yutaka

			case 237: case 251: 		  *sampleId = &g_smidScottCoughBlood2;		break; // Scott	
			case 422 : case 423: *sampleId = &g_smidAmyCantBreathe;		  break; // Stephanie
			
			case 183: case 223: case 242: case 243: case 244: case 245: case 246: *sampleId = &g_smidPaulRTooYoung; break; // Paul

			case 645: case 647: case 648:	*sampleId = &g_smidAsami_ss2; 			break; // Asami
			case 799: case 801: case 802:	*sampleId = &g_smidOsales_ss2; 			break; // Osales
			case 843: case 845: case 846:	*sampleId = &g_smidRyuichi_ss2; 		break; // Ryuichi
			case 887: case 889: case 890:	*sampleId = &g_smidShinobu_ss2; 		break; // Shinobu
			case 909: case 911: case 912:	*sampleId = &g_smidTadao_ss2; 			break; // Tadao
		}
		break;

	// SampleSet #3
	case 3:	
		switch ((*sampleId)->sSoundId)
		{
			case 667: case 668: case 670: *sampleId = &g_smidSakura_ss3; 			break; // Ayame => Sakura
			case 689: case 690: case 692: *sampleId = &g_smidCompshop_ss3; 			break; // Compsales => Compshop
			case 711: case 712: case 714: *sampleId = &g_smidCompsales_ss3; 		break; // Compshop => Compsales	
			case 733: case 734: case 736: *sampleId = &g_smidKazuki_ss3; 			break; // Kazuki	
			case 755: case 756: case 758: *sampleId = &g_smidKensaku_ss3; 			break; // Kensaku
			case 777: case 778: case 780: *sampleId = &g_smidNoboru_ss3; 			break; // Noboru
			case 821: case 822: case 824: *sampleId = &g_smidOsamu_ss3; 			break; // Osamu
			case 865: case 866: case 868: *sampleId = &g_smidTomiko_ss3; 			break; // Sakura => Tomiko
			case 931: case 932: case 934: *sampleId = &g_smidAyame_ss3; 			break; // Tomiko => Ayame
			case 953: case 954: case 956: *sampleId = &g_smidYutaka_ss3; 			break; // Yutaka
			case 238: case 251: 		  *sampleId = &g_smidScottCoughBlood1;		break; // Scott	
			case 422 : case 423: *sampleId = &g_smidAmyCantBreathe;		  break; // Stephanie		
			case 183: case 223: case 242: case 243: case 245: case 246: case 252: *sampleId = &g_smidPaulRTooYoung; break; // Paul

			case 645: case 646: case 648:	*sampleId = &g_smidAsami_ss3; 			break; // Asami
			case 799: case 800: case 802:	*sampleId = &g_smidOsales_ss3; 			break; // Osales
			case 843: case 844: case 846:	*sampleId = &g_smidRyuichi_ss3; 		break; // Ryuichi
			case 887: case 888: case 890:	*sampleId = &g_smidShinobu_ss3; 		break; // Shinobu
			case 909: case 910: case 912:	*sampleId = &g_smidTadao_ss3; 			break; // Tadao
		}
		break;

	// SampleSet #4
	case 4:	
		switch ((*sampleId)->sSoundId)
		{
			case 667: case 668: case 669: *sampleId = &g_smidSakura_ss4; 			break; // Ayame => Sakura
			case 689: case 690: case 691: *sampleId = &g_smidCompshop_ss4; 			break; // Compsales => Compshop
			case 711: case 712: case 713: *sampleId = &g_smidCompsales_ss4; 		break; // Compshop => Compsales	
			case 733: case 734: case 735: *sampleId = &g_smidKazuki_ss4; 			break; // Kazuki	
			case 755: case 756: case 757: *sampleId = &g_smidKensaku_ss4; 			break; // Kensaku
			case 777: case 778: case 779: *sampleId = &g_smidNoboru_ss4; 			break; // Noboru
			case 821: case 822: case 823: *sampleId = &g_smidOsamu_ss4; 			break; // Osamu
			case 865: case 866: case 867: *sampleId = &g_smidTomiko_ss4; 			break; // Sakura => Tomiko
			case 931: case 932: case 933: *sampleId = &g_smidAyame_ss4; 			break; // Tomiko => Ayame
			case 953: case 954: case 955: *sampleId = &g_smidYutaka_ss4; 			break; // Yutaka

			case 237 : case 251: 	*sampleId = &g_smidScottCoughBlood2;			break; // Scott	
			case 422 : case 423: 	*sampleId = &g_smidAmyCantBreathe;		  		break; // Stephanie
			case 183: case 223: case 242: case 243: case 244: case 245: case 246: *sampleId = &g_smidPaulRTooYoung; break; // Paul

			case 645: case 646: case 647:	*sampleId = &g_smidAsami_ss4; 			break; // Asami
			case 799: case 800: case 801:	*sampleId = &g_smidOsales_ss4; 			break; // Osales
			case 843: case 844: case 845:	*sampleId = &g_smidRyuichi_ss4; 		break; // Ryuichi
			case 887: case 888: case 889:	*sampleId = &g_smidShinobu_ss4; 		break; // Shinobu
			case 909: case 910: case 911:	*sampleId = &g_smidTadao_ss4; 			break; // Tadao
		}
		break;
	}
}

////////////////////////////////////////////////////////////////////////////////
// GetSoundShotAlt - Get alternative shot sound if minimal-sound-samples
////////////////////////////////////////////////////////////////////////////////
void CPerson::GetSoundShotAlt(SampleMasterID **sampleId)
{
	switch (g_ucMinimalSampleSet)
	{		
	// SampleSet #1
	case 1:
		switch ((*sampleId)->sSoundId)
		{					
			case 654: case 655: case 656: 			*sampleId = &g_smidSakura_h1; 			break; // Ayame => Sakura
			case 676: case 677: case 678: 			*sampleId = &g_smidCompshop_h1; 		break; // Compsales => Compshop
			case 698: case 699: case 700: 			*sampleId = &g_smidCompsales_h1; 		break; // Compshop => Compsales	
			case 720: case 721: case 722: 			*sampleId = &g_smidKazuki_h1; 			break; // Kazuki	
			case 742: case 743: case 744: 			*sampleId = &g_smidKensaku_h1; 			break; // Kensaku
			case 764: case 765: case 766: 			*sampleId = &g_smidNoboru_h1; 			break; // Noboru
			case 808: case 809: case 810: 			*sampleId = &g_smidOsamu_h1; 			break; // Osamu
			case 852: case 853: case 854: 			*sampleId = &g_smidTomiko_h1; 			break; // Sakura => Tomiko
			case 918: case 919: case 920: 			*sampleId = &g_smidAyame_h1; 			break; // Tomiko => Ayame
			case 940: case 941: case 942: 			*sampleId = &g_smidYutaka_h1; 			break; // Yutaka

			case 166:  		  			  			*sampleId = &g_smidScottMyLeg;			break; // Scott	
			
			case 181: case 182: case 183: case 184:	*sampleId = &g_smidPaulRHuh;			break; // Paul	


			case 632: case 633: case 634:	*sampleId = &g_smidAsami_h1; 			break; // Asami
			case 786: case 787: case 788:	*sampleId = &g_smidOsales_h1; 			break; // Osales
			case 830: case 831: case 832:	*sampleId = &g_smidRyuichi_h1; 			break; // Ryuichi
			case 874: case 875: case 876:	*sampleId = &g_smidShinobu_h1; 			break; // Shinobu
			case 896: case 897: case 898:	*sampleId = &g_smidTadao_h1; 			break; // Tadao

		}
		break;

	// SampleSet #2
	case 2:	
		switch ((*sampleId)->sSoundId)
		{					
			case 653: case 655: case 656: 				*sampleId = &g_smidSakura_h2; 				break; // Ayame => Sakura
			case 675: case 677: case 678: 				*sampleId = &g_smidCompshop_h2; 			break; // Compsales => Compshop
			case 697: case 699: case 700: 				*sampleId = &g_smidCompsales_h2; 			break; // Compshop => Compsales	
			case 719: case 721: case 722: 				*sampleId = &g_smidKazuki_h2; 				break; // Kazuki	
			case 741: case 743: case 744: 				*sampleId = &g_smidKensaku_h2; 				break; // Kensaku
			case 763: case 765: case 766: 				*sampleId = &g_smidNoboru_h2; 				break; // Noboru
			case 807: case 809: case 810: 				*sampleId = &g_smidOsamu_h2; 				break; // Osamu
			case 851: case 853: case 854: 				*sampleId = &g_smidTomiko_h2; 				break; // Sakura => Tomiko
			case 917: case 919: case 920: 				*sampleId = &g_smidAyame_h2; 				break; // Tomiko => Ayame
			case 939: case 941: case 942: 				*sampleId = &g_smidYutaka_h2; 				break; // Yutaka
			
			case 167:  			  			  			*sampleId = &g_smidScottGrunt;				break; // Scott	
			
			case 181: case 182: case 183: case 185:		*sampleId = &g_smidPaulRHuht;			break; // Paul		

			case 631: case 633: case 634:	*sampleId = &g_smidAsami_h2; 			break; // Asami
			case 785: case 787: case 788:	*sampleId = &g_smidOsales_h2; 			break; // Osales
			case 829: case 831: case 832:	*sampleId = &g_smidRyuichi_h2; 			break; // Ryuichi
			case 873: case 875: case 876:	*sampleId = &g_smidShinobu_h2; 			break; // Shinobu
			case 895: case 897: case 898:	*sampleId = &g_smidTadao_h2; 			break; // Tadao																					
		}
		break;

	// SampleSet #3
	case 3:	
		switch ((*sampleId)->sSoundId)
		{
			case 653: case 654: case 656: 				*sampleId = &g_smidSakura_h3; 				break; // Ayame =>  Sakura
			case 675: case 676: case 678: 				*sampleId = &g_smidCompshop_h3; 			break; // Compsales => Compshop
			case 697: case 698: case 700: 				*sampleId = &g_smidCompsales_h3; 			break; // Compshop => Compsales	
			case 719: case 720: case 722: 				*sampleId = &g_smidKazuki_h3; 				break; // Kazuki	
			case 741: case 742: case 744: 				*sampleId = &g_smidKensaku_h3; 				break; // Kensaku
			case 763: case 764: case 766: 				*sampleId = &g_smidNoboru_h3; 				break; // Noboru
			case 807: case 808: case 810: 				*sampleId = &g_smidOsamu_h3; 				break; // Osamu
			case 851: case 852: case 854: 				*sampleId = &g_smidTomiko_h3; 				break; // Sakura => Tomiko
			case 917: case 918: case 920: 				*sampleId = &g_smidAyame_h3; 				break; // Tomiko => Ayame
			case 939: case 940: case 942: 				*sampleId = &g_smidYutaka_h3; 				break; // Yutaka
			
			case 166:  		  			  				*sampleId = &g_smidScottMyLeg;				break; // Scott	
			case 181: case 182: case 184: 				*sampleId = &g_smidPaulRShotToe;			break; // Paul	

			case 631: case 632: case 634:	*sampleId = &g_smidAsami_h3; 			break; // Asami
			case 785: case 786: case 788:	*sampleId = &g_smidOsales_h3; 			break; // Osales
			case 829: case 830: case 832:	*sampleId = &g_smidRyuichi_h3; 			break; // Ryuichi
			case 873: case 874: case 876:	*sampleId = &g_smidShinobu_h3; 			break; // Shinobu
			case 895: case 896: case 898:	*sampleId = &g_smidTadao_h3; 			break; // Tadao	
		}
		break;

	// SampleSet #4
	case 4:	
		switch ((*sampleId)->sSoundId)
		{
			case 653: case 654: case 655: 				*sampleId = &g_smidSakura_h4; 				break; // Ayame =>  Sakura	
			case 675: case 676: case 679: 				*sampleId = &g_smidCompshop_h4; 			break; // Compsales => Compshop
			case 697: case 698: case 699: 				*sampleId = &g_smidCompsales_h4; 			break; // Compshop => Compsales	
			case 719: case 720: case 721: 				*sampleId = &g_smidKazuki_h4; 				break; // Kazuki	
			case 741: case 742: case 743: 				*sampleId = &g_smidKensaku_h4; 				break; // Kensaku
			case 763: case 764: case 765: 				*sampleId = &g_smidNoboru_h4; 				break; // Noboru
			case 807: case 808: case 809: 				*sampleId = &g_smidOsamu_h4; 				break; // Osamu
			case 851: case 852: case 853: 				*sampleId = &g_smidTomiko_h4; 				break; // Sakura => Tomiko
			case 917: case 918: case 919: 				*sampleId = &g_smidAyame_h4; 				break; // Tomiko => Ayame
			case 939: case 940: case 941: 				*sampleId = &g_smidYutaka_h4; 				break; // Yutaka

			case 167:  		  			  				*sampleId = &g_smidScottGrunt;				break; // Scott	
			case 181: case 182: case 184: 				*sampleId = &g_smidPaulRShotToe;			break; // Paul	

			case 631: case 632: case 633:	*sampleId = &g_smidAsami_h4; 			break; // Asami
			case 785: case 786: case 787:	*sampleId = &g_smidOsales_h4; 			break; // Osales
			case 829: case 830: case 831:	*sampleId = &g_smidRyuichi_h4; 			break; // Ryuichi
			case 873: case 874: case 875:	*sampleId = &g_smidShinobu_h4; 			break; // Shinobu
			case 895: case 896: case 897:	*sampleId = &g_smidTadao_h4; 			break; // Tadao		
		}
		break;	
	}
}

////////////////////////////////////////////////////////////////////////////////
// GetSoundBlownupAlt - Get alternative shot sound if minimal-sound-samples
////////////////////////////////////////////////////////////////////////////////
void CPerson::GetSoundBlownupAlt(SampleMasterID **sampleId)
{
	switch (g_ucMinimalSampleSet)
	{		
	// SampleSet #1
	case 1:
		switch ((*sampleId)->sSoundId)
		{			
		case 166 : case 198 : 							*sampleId = &g_smidScottYell1;			break; // Scott	
		case 205 : 										*sampleId = &g_smidPaulROoh;			break; // Paul

		case 207: 										*sampleId = &g_smidRubinAhHuh;			break; // Rubin


		case 419 : case 426 :							*sampleId = &g_smidCarynScream;			break; // Stephanie

		case 650 :										*sampleId = &g_smidSakura_b1; 			break; // Ayame =>  Sakura
		case 672 : 										*sampleId = &g_smidCompshop_b1; 		break; // Compsales => Compshop		
		case 694 : 										*sampleId = &g_smidCompsales_b1; 		break; // Compshop => Compsales		
		case 716 : 										*sampleId = &g_smidKazuki_b1; 			break; // Kazuki		
		case 738 : 										*sampleId = &g_smidKensaku_b1;			break; // Kensaku		
		case 760 : 										*sampleId = &g_smidNoboru_b1; 			break; // Noboru		
		case 804 : 										*sampleId = &g_smidOsamu_b1; 			break; // Osamu		
		case 848 : 										*sampleId = &g_smidTomiko_b1; 			break; // Sakura => Tomiko		
		case 914 : 										*sampleId = &g_smidAyame_b1; 			break; // Tomiko => Ayame
		case 936 : 										*sampleId = &g_smidYutaka_b1; 			break; // Yutaka


		case 628: 	*sampleId = &g_smidAsami_b1; 			break; // Asami
		case 782: 	*sampleId = &g_smidOsales_b1; 			break; // Osales
		case 826: 	*sampleId = &g_smidRyuichi_b1; 			break; // Ryuichi
		case 870: 	*sampleId = &g_smidShinobu_b1; 			break; // Shinobu
		case 892: 	*sampleId = &g_smidTadao_b1; 			break; // Tadao		
		}
		break;


	// SampleSet #2
	case 2:	
		switch ((*sampleId)->sSoundId)
		{		
		case 167 : case 197 : *sampleId = &g_smidScottYell2;		break; // Scott			
		case 204 : *sampleId = &g_smidPaulROooh;		break; // Paul

		case 419 : case 426 :							*sampleId = &g_smidCarynScream;			break; // Stephanie

		case 206: 										*sampleId = &g_smidRubinUhh;			break; // Rubin

		case 649 : *sampleId = &g_smidSakura_b2; 		break; // Ayame =>  Sakura
		case 671 : *sampleId = &g_smidCompshop_b2; 		break; // Compsales => Compshop		
		case 693 : *sampleId = &g_smidCompsales_b2; 	break; // Compshop => Compsales		
		case 715 : *sampleId = &g_smidKazuki_b2; 		break; // Kazuki		
		case 737 : *sampleId = &g_smidKensaku_b2; 		break; // Kensaku		
		case 759 : *sampleId = &g_smidNoboru_b2; 		break; // Noboru		
		case 803 : *sampleId = &g_smidOsamu_b2; 		break; // Osamu		
		case 847 : *sampleId = &g_smidTomiko_b2;		break; // Sakura => Tomiko		
		case 913 : *sampleId = &g_smidAyame_b2;			break; // Tomiko => Ayame		
		case 935 : *sampleId = &g_smidYutaka_b2;		break; // Yutaka

		case 627: 	*sampleId = &g_smidAsami_b2; 			break; // Asami
		case 781: 	*sampleId = &g_smidOsales_b2; 			break; // Osales
		case 825: 	*sampleId = &g_smidRyuichi_b2; 			break; // Ryuichi
		case 869: 	*sampleId = &g_smidShinobu_b2; 			break; // Shinobu
		case 891: 	*sampleId = &g_smidTadao_b2; 			break; // Tadao		
		}
		break;

	// SampleSet #3
	case 3:	
		switch ((*sampleId)->sSoundId)
		{
		case 198 : *sampleId = &g_smidScottYell1;		break; // Scott	
		case 205 : *sampleId = &g_smidPaulROoh;			break; // Paul

		case 207: 										*sampleId = &g_smidRubinAhHuh;			break; // Rubin

		case 419 : case 426 :							*sampleId = &g_smidCarynScream;			break; // Stephanie

		case 650 : *sampleId = &g_smidSakura_b1; 		break; // Ayame =>  Sakura
		case 672 : *sampleId = &g_smidCompshop_b1; 		break; // Compsales => Compshop		
		case 694 : *sampleId = &g_smidCompsales_b1; 	break; // Compshop => Compsales		
		case 716 : *sampleId = &g_smidKazuki_b1; 		break; // Kazuki		
		case 738 : *sampleId = &g_smidKensaku_b1;		break; // Kensaku		
		case 760 : *sampleId = &g_smidNoboru_b1; 		break; // Noboru		
		case 804 : *sampleId = &g_smidOsamu_b1; 		break; // Osamu		
		case 848 : *sampleId = &g_smidTomiko_b1; 		break; // Sakura => Tomiko		
		case 914 : *sampleId = &g_smidAyame_b1; 		break; // Tomiko => Ayame		
		case 936 : *sampleId = &g_smidYutaka_b1; 		break; // Yutaka

		case 628: 	*sampleId = &g_smidAsami_b1; 			break; // Asami
		case 782: 	*sampleId = &g_smidOsales_b1; 			break; // Osales
		case 826: 	*sampleId = &g_smidRyuichi_b1; 			break; // Ryuichi
		case 870: 	*sampleId = &g_smidShinobu_b1; 			break; // Shinobu
		case 892: 	*sampleId = &g_smidTadao_b1; 			break; // Tadao		
		}
		break;

	// SampleSet #4
	case 4:	
		switch ((*sampleId)->sSoundId)
		{
		case 197 : *sampleId = &g_smidScottYell2;		break; // Scott	
		case 204 : *sampleId = &g_smidPaulROooh;		break; // Paul

		case 206: 										*sampleId = &g_smidRubinUhh;			break; // Rubin

		case 419 : case 426 :							*sampleId = &g_smidCarynScream;			break; // Stephanie

		case 649 : *sampleId = &g_smidSakura_b2; 		break; // Ayame =>  Sakura
		case 671 : *sampleId = &g_smidCompshop_b2; 		break; // Compsales => Compshop		
		case 693 : *sampleId = &g_smidCompsales_b2; 	break; // Compshop => Compsales		
		case 715 : *sampleId = &g_smidKazuki_b2; 		break; // Kazuki		
		case 737 : *sampleId = &g_smidKensaku_b2; 		break; // Kensaku		
		case 759 : *sampleId = &g_smidNoboru_b2; 		break; // Noboru		
		case 803 : *sampleId = &g_smidOsamu_b2; 		break; // Osamu		
		case 847 : *sampleId = &g_smidTomiko_b2;		break; // Sakura => Tomiko		
		case 913 : *sampleId = &g_smidAyame_b2;		break; // Tomiko => Ayame		
		case 935 : *sampleId = &g_smidYutaka_b2;		break; // Yutaka

		case 627: 	*sampleId = &g_smidAsami_b2; 			break; // Asami
		case 781: 	*sampleId = &g_smidOsales_b2; 			break; // Osales
		case 825: 	*sampleId = &g_smidRyuichi_b2; 			break; // Ryuichi
		case 869: 	*sampleId = &g_smidShinobu_b2; 			break; // Shinobu
		case 891: 	*sampleId = &g_smidTadao_b2; 			break; // Tadao		
		}
		break;
	}
}

////////////////////////////////////////////////////////////////////////////////
// GetSoundBurningAlt - Get alternative burning sound if minimal-sound-samples
////////////////////////////////////////////////////////////////////////////////
void CPerson::GetSoundBurningAlt(SampleMasterID **sampleId)
{
	switch (g_ucMinimalSampleSet)
	{		
	// SampleSet #1
	case 1:
		switch ((*sampleId)->sSoundId)
		{					
		case 658 : *sampleId = &g_smidSakura_o1; 			break; // Ayame =>  Sakura
		case 680 : *sampleId = &g_smidCompshop_o1; 			break; // Compsales => Compshop		
		case 702 : *sampleId = &g_smidCompsales_o1; 		break; // Compshop => Compsales		
		case 724 : *sampleId = &g_smidKazuki_o1; 			break; // Kazuki		
		case 746 : *sampleId = &g_smidKensaku_o1;			break; // Kensaku		
		case 768 : *sampleId = &g_smidNoboru_o1; 			break; // Noboru		
		case 812 : *sampleId = &g_smidOsamu_o1; 			break; // Osamu		
		case 856 : *sampleId = &g_smidTomiko_o1; 			break; // Sakura => Tomiko		
		case 922 : *sampleId = &g_smidAyame_o1; 			break; // Tomiko => Ayame
		case 944 : *sampleId = &g_smidYutaka_o1; 			break; // Yutaka

		case 216: case 217: *sampleId = &g_smidScottYell3;	break; // Scott
		
		

		case 424: case 425: *sampleId = &g_smidAmyScream;	break; // Stephanie

		case 636: 	*sampleId = &g_smidAsami_o1; 			break; // Asami
		case 790: 	*sampleId = &g_smidOsales_o1; 			break; // Osales
		case 834: 	*sampleId = &g_smidRyuichi_o1; 			break; // Ryuichi
		case 878: 	*sampleId = &g_smidShinobu_o1; 			break; // Shinobu
		case 900: 	*sampleId = &g_smidTadao_o1; 			break; // Tadao		



		//todo Paul
		}
		break;

	// SampleSet #2
	case 2:	
		switch ((*sampleId)->sSoundId)
		{		
		case 657 : *sampleId = &g_smidSakura_o2; 			break; // Ayame =>  Sakura
		case 679 : *sampleId = &g_smidCompshop_o2; 			break; // Compsales => Compshop		
		case 701 : *sampleId = &g_smidCompsales_o2; 		break; // Compshop => Compsales		
		case 723 : *sampleId = &g_smidKazuki_o2; 			break; // Kazuki		
		case 745 : *sampleId = &g_smidKensaku_o2;			break; // Kensaku		
		case 767 : *sampleId = &g_smidNoboru_o2; 			break; // Noboru		
		case 811 : *sampleId = &g_smidOsamu_o2; 			break; // Osamu		
		case 855 : *sampleId = &g_smidTomiko_o2; 			break; // Sakura => Tomiko		
		case 921 : *sampleId = &g_smidAyame_o2; 			break; // Tomiko => Ayame
		case 943 : *sampleId = &g_smidYutaka_o2; 			break; // Yutaka

		case 215: case 217: *sampleId = &g_smidScottYell4;	break; // Scott
		case 424: case 425: *sampleId = &g_smidAmyScream;	break; // Stephanie

		case 635: 	*sampleId = &g_smidAsami_o2; 			break; // Asami
		case 789: 	*sampleId = &g_smidOsales_o2; 			break; // Osales
		case 833: 	*sampleId = &g_smidRyuichi_o2; 			break; // Ryuichi
		case 877: 	*sampleId = &g_smidShinobu_o2; 			break; // Shinobu
		case 899: 	*sampleId = &g_smidTadao_o2; 			break; // Tadao		
		
		//todo Paul
		}
		break;

	// SampleSet #3
	case 3:	
		switch ((*sampleId)->sSoundId)
		{
		case 658 : *sampleId = &g_smidSakura_o1; 			break; // Ayame =>  Sakura
		case 680 : *sampleId = &g_smidCompshop_o1; 			break; // Compsales => Compshop		
		case 702 : *sampleId = &g_smidCompsales_o1; 		break; // Compshop => Compsales		
		case 724 : *sampleId = &g_smidKazuki_o1; 			break; // Kazuki		
		case 746 : *sampleId = &g_smidKensaku_o1;			break; // Kensaku		
		case 768 : *sampleId = &g_smidNoboru_o1; 			break; // Noboru		
		case 812 : *sampleId = &g_smidOsamu_o1; 			break; // Osamu		
		case 856 : *sampleId = &g_smidTomiko_o1; 			break; // Sakura => Tomiko		
		case 922 : *sampleId = &g_smidAyame_o1; 			break; // Tomiko => Ayame
		case 944 : *sampleId = &g_smidYutaka_o1; 			break; // Yutaka

		case 216: case 217: *sampleId = &g_smidScottYell3;	break; // Scott
		case 424: case 425: *sampleId = &g_smidAmyScream;	break; // Stephanie

				case 636: 	*sampleId = &g_smidAsami_o1; 			break; // Asami
		case 790: 	*sampleId = &g_smidOsales_o1; 			break; // Osales
		case 834: 	*sampleId = &g_smidRyuichi_o1; 			break; // Ryuichi
		case 878: 	*sampleId = &g_smidShinobu_o1; 			break; // Shinobu
		case 900: 	*sampleId = &g_smidTadao_o1; 			break; // Tadao		
		}
		break;

	// SampleSet #4
	case 4:	
		switch ((*sampleId)->sSoundId)
		{
		case 657 : *sampleId = &g_smidSakura_o2; 			break; // Ayame =>  Sakura	
		case 679 : *sampleId = &g_smidCompshop_o2; 			break; // Compsales => Compshop		
		case 701 : *sampleId = &g_smidCompsales_o2; 		break; // Compshop => Compsales		
		case 723 : *sampleId = &g_smidKazuki_o2; 			break; // Kazuki		
		case 745 : *sampleId = &g_smidKensaku_o2;			break; // Kensaku		
		case 767 : *sampleId = &g_smidNoboru_o2; 			break; // Noboru		
		case 811 : *sampleId = &g_smidOsamu_o2; 			break; // Osamu		
		case 855 : *sampleId = &g_smidTomiko_o2; 			break; // Sakura => Tomiko		
		case 921 : *sampleId = &g_smidAyame_o2; 			break; // Tomiko => Ayame
		case 943 : *sampleId = &g_smidYutaka_o2; 			break; // Yutaka

		case 215: case 217: *sampleId = &g_smidScottYell4;	break; // Scott
		case 424: case 425: *sampleId = &g_smidAmyScream;	break; // Stephanie
		

		case 635: 	*sampleId = &g_smidAsami_o2; 			break; // Asami
		case 789: 	*sampleId = &g_smidOsales_o2; 			break; // Osales
		case 833: 	*sampleId = &g_smidRyuichi_o2; 			break; // Ryuichi
		case 877: 	*sampleId = &g_smidShinobu_o2; 			break; // Shinobu
		case 899: 	*sampleId = &g_smidTadao_o2; 			break; // Tadao		


		//todo Paul
		}
		break;
	}
}


////////////////////////////////////////////////////////////////////////////////
// GetSoundShootingAlt - Get alternative shooting sound if minimal-sound-samples
////////////////////////////////////////////////////////////////////////////////
void CPerson::GetSoundShootingAlt(SampleMasterID **sampleId)
{
	switch (g_ucMinimalSampleSet)
	{		
	// SampleSet #1
	case 1:
		switch ((*sampleId)->sSoundId)
		{					
			case 664: case 665: case 666: *sampleId = &g_smidSakura_sc1; 				break; // Ayame =>  Sakura
			case 686: case 687: case 688: *sampleId = &g_smidCompshop_sc1; 				break; // Compsales => Compshop
			case 708: case 709: case 710: *sampleId = &g_smidCompsales_sc1; 			break; // Compshop => Compsales	
			case 730: case 731: case 732: *sampleId = &g_smidKazuki_sc1; 				break; // Kazuki	
			case 752: case 753: case 754: *sampleId = &g_smidKensaku_sc1; 				break; // Kensaku
			case 774: case 775: case 776: *sampleId = &g_smidNoboru_sc1; 				break; // Noboru
			case 818: case 819: case 820: *sampleId = &g_smidOsamu_sc1; 				break; // Osamu
			case 862: case 863: case 864: *sampleId = &g_smidTomiko_sc1; 				break; // Sakura => Tomiko
			case 928: case 929: case 930: *sampleId = &g_smidAyame_sc1; 				break; // Tomiko => Ayame
			case 950: case 951: case 952: *sampleId = &g_smidYutaka_sc1; 				break; // Yutaka

			case 268: 					  *sampleId = &g_smidScottBurn; 				break; // Scott

			case 277: case 279: case 280: case 281: case 282:	*sampleId = &g_smidRubinMadallo; 				break; // Rubin

			case 642: case 643: case 644:	*sampleId = &g_smidAsami_sc1; 				break; // Asami
			case 796: case 797: case 798:	*sampleId = &g_smidOsales_sc1; 				break; // Osales
			case 840: case 841: case 842:	*sampleId = &g_smidRyuichi_sc1; 			break; // Ryuichi
			case 884: case 885: case 886:	*sampleId = &g_smidShinobu_sc1; 			break; // Shinobu
			case 906: case 907: case 908:	*sampleId = &g_smidTadao_sc1; 				break; // Tadao		


			//case 166:  		  			  *sampleId = &g_smidScottMyLeg;			break; // Scott	
			// todo: Paul																						
		}
		break;

	// SampleSet #2
	case 2:	
		switch ((*sampleId)->sSoundId)
		{					
			case 663: case 665: case 666: *sampleId = &g_smidSakura_sc2; 				break; // Ayame =>  Sakura
			case 685: case 687: case 688: *sampleId = &g_smidCompshop_sc2; 				break; // Compsales => Compshop
			case 707: case 709: case 710: *sampleId = &g_smidCompsales_sc2; 			break; // Compshop => Compsales	
			case 729: case 731: case 732: *sampleId = &g_smidKazuki_sc2; 				break; // Kazuki	
			case 751: case 753: case 754: *sampleId = &g_smidKensaku_sc2; 				break; // Kensaku
			case 773: case 775: case 776: *sampleId = &g_smidNoboru_sc2; 				break; // Noboru
			case 817: case 819: case 820: *sampleId = &g_smidOsamu_sc2; 				break; // Osamu
			case 861: case 863: case 864: *sampleId = &g_smidTomiko_sc2; 				break; // Sakura => Tomiko
			case 927: case 929: case 930: *sampleId = &g_smidAyame_sc2; 				break; // Tomiko => Ayame
			case 949: case 951: case 952: *sampleId = &g_smidYutaka_sc2; 				break; // Yutaka
			
			case 267: 					  *sampleId = &g_smidScottBurnHim; 				break; // Scott	

			case 276: case 279: case 280: case 281: case 282:	*sampleId = &g_smidRubinDonwemen; 				break; // Rubin

			case 641: case 643: case 644:	*sampleId = &g_smidAsami_sc2; 				break; // Asami
			case 795: case 797: case 798:	*sampleId = &g_smidOsales_sc2; 				break; // Osales
			case 839: case 841: case 842:	*sampleId = &g_smidRyuichi_sc2; 			break; // Ryuichi
			case 883: case 885: case 886:	*sampleId = &g_smidShinobu_sc2; 			break; // Shinobu
			case 905: case 907: case 908:	*sampleId = &g_smidTadao_sc2; 				break; // Tadao		


			// todo: Paul																									
		}
		break;

	// SampleSet #3
	case 3:	
		switch ((*sampleId)->sSoundId)
		{
			case 663: case 664: case 666: *sampleId = &g_smidSakura_sc3; 				break; // Ayame =>  Sakura
			case 685: case 686: case 688: *sampleId = &g_smidCompshop_sc3; 				break; // Compsales => Compshop
			case 707: case 708: case 710: *sampleId = &g_smidCompsales_sc3; 			break; // Compshop => Compsales	
			case 729: case 730: case 732: *sampleId = &g_smidKazuki_sc3; 				break; // Kazuki	
			case 751: case 752: case 754: *sampleId = &g_smidKensaku_sc3; 				break; // Kensaku
			case 773: case 774: case 776: *sampleId = &g_smidNoboru_sc3; 				break; // Noboru
			case 817: case 818: case 820: *sampleId = &g_smidOsamu_sc3; 				break; // Osamu
			case 861: case 862: case 864: *sampleId = &g_smidTomiko_sc3; 				break; // Sakura => Tomiko
			case 927: case 928: case 930: *sampleId = &g_smidAyame_sc3; 				break; // Tomiko => Ayame
			case 949: case 950: case 952: *sampleId = &g_smidYutaka_sc3; 				break; // Yutaka
			
			case 268: 					  *sampleId = &g_smidScottBurn; 				break; // Scott

			case 276: case 277: case 280: case 281: case 282:	*sampleId = &g_smidRubinCallo; 				break; // Rubin


			case 641: case 642: case 644:	*sampleId = &g_smidAsami_sc3; 				break; // Asami
			case 795: case 796: case 798:	*sampleId = &g_smidOsales_sc3; 				break; // Osales
			case 839: case 840: case 842:	*sampleId = &g_smidRyuichi_sc3; 			break; // Ryuichi
			case 883: case 884: case 886:	*sampleId = &g_smidShinobu_sc3; 			break; // Shinobu
			case 905: case 906: case 908:	*sampleId = &g_smidTadao_sc3; 				break; // Tadao	


			// todo: Paul
		}
		break;

	// SampleSet #4
	case 4:	
		switch ((*sampleId)->sSoundId)
		{
			case 663: case 664: case 665: *sampleId = &g_smidSakura_sc4; 				break; // Ayame =>  Sakura
			case 685: case 686: case 689: *sampleId = &g_smidCompshop_sc4; 				break; // Compsales => Compshop
			case 707: case 708: case 709: *sampleId = &g_smidCompsales_sc4; 			break; // Compshop => Compsales	
			case 729: case 730: case 731: *sampleId = &g_smidKazuki_sc4; 				break; // Kazuki	
			case 751: case 752: case 753: *sampleId = &g_smidKensaku_sc4; 				break; // Kensaku
			case 773: case 774: case 775: *sampleId = &g_smidNoboru_sc4; 				break; // Noboru
			case 817: case 818: case 819: *sampleId = &g_smidOsamu_sc4; 				break; // Osamu
			case 861: case 862: case 863: *sampleId = &g_smidTomiko_sc4; 				break; // Sakura => Tomiko
			case 927: case 928: case 929: *sampleId = &g_smidAyame_sc4; 				break; // Tomiko => Ayame
			case 949: case 950: case 951: *sampleId = &g_smidYutaka_sc4; 				break; // Yutaka

			case 267: 					  *sampleId = &g_smidScottBurnHim; 				break; // Scott	

			case 276: case 277: case 279: case 281: case 282:	*sampleId = &g_smidRubinGudelet; 				break; // Rubin

			case 641: case 642: case 643:	*sampleId = &g_smidAsami_sc4; 				break; // Asami
			case 795: case 796: case 797:	*sampleId = &g_smidOsales_sc4; 				break; // Osales
			case 839: case 840: case 841:	*sampleId = &g_smidRyuichi_sc4; 			break; // Ryuichi
			case 883: case 884: case 885:	*sampleId = &g_smidShinobu_sc4; 			break; // Shinobu
			case 905: case 906: case 907:	*sampleId = &g_smidTadao_sc4; 				break; // Tadao	

			// todo: Paul																		
		}
		break;	
	}
}

void CPerson::GetSoundDyingAlt(SampleMasterID **sampleId)
{
switch (g_ucMinimalSampleSet)
	{		
	// SampleSet #1
	case 1:
		switch ((*sampleId)->sSoundId)
		{					
		case 652 : *sampleId = &g_smidSakura_d1; 			break; // Ayame =>  Sakura
		case 674 : *sampleId = &g_smidCompshop_d1; 			break; // Compsales => Compshop		
		case 696 : *sampleId = &g_smidCompsales_d1;			break; // Compshop => Compsales		
		case 718 : *sampleId = &g_smidKazuki_d1; 			break; // Kazuki		
		case 740 : *sampleId = &g_smidKensaku_d1;			break; // Kensaku		
		case 762 : *sampleId = &g_smidNoboru_d1; 			break; // Noboru		
		case 806 : *sampleId = &g_smidOsamu_d1; 			break; // Osamu		
		case 850 : *sampleId = &g_smidTomiko_d1; 			break; // Sakura => Tomiko		
		case 916 : *sampleId = &g_smidAyame_d1; 			break; // Tomiko => Ayame
		case 938 : *sampleId = &g_smidYutaka_d1; 			break; // Yutaka

		case 238 : case 251: *sampleId = &g_smidScottCoughBlood1; 	break; // Scott
		case 422 : case 423: *sampleId = &g_smidAmyCantBreathe;		break; // Stephanie
		case 258 :  *sampleId = &g_smidRubinICantMove;		  		break; // Rubin
 

		case 630: 	*sampleId = &g_smidAsami_d1; 			break; // Asami
		case 784: 	*sampleId = &g_smidOsales_d1; 			break; // Osales
		case 828: 	*sampleId = &g_smidRyuichi_d1; 			break; // Ryuichi
		case 872: 	*sampleId = &g_smidShinobu_d1; 			break; // Shinobu
		case 894: 	*sampleId = &g_smidTadao_d1; 			break; // Tadao		

	//	case 216: case 217: *sampleId = &g_smidScottYell3;	break; // Scott
		
		//todo Paul
		}
		break;

	// SampleSet #2
	case 2:	
		switch ((*sampleId)->sSoundId)
		{		
		case 651 : *sampleId = &g_smidSakura_d2; 			break; // Ayame =>  Sakura
		case 673 : *sampleId = &g_smidCompshop_d2; 			break; // Compsales => Compshop		
		case 695 : *sampleId = &g_smidCompsales_d2; 		break; // Compshop => Compsales		
		case 717 : *sampleId = &g_smidKazuki_d2; 			break; // Kazuki		
		case 739 : *sampleId = &g_smidKensaku_d2;			break; // Kensaku		
		case 761 : *sampleId = &g_smidNoboru_d2; 			break; // Noboru		
		case 805 : *sampleId = &g_smidOsamu_d2; 			break; // Osamu		
		case 849 : *sampleId = &g_smidTomiko_d2; 			break; // Sakura => Tomiko		
		case 915 : *sampleId = &g_smidAyame_d2; 			break; // Tomiko => Ayame
		case 937 : *sampleId = &g_smidYutaka_d2; 			break; // Yutaka

		case 237 : case 251: *sampleId = &g_smidScottCoughBlood2; break; // Scott
		case 422 : case 423: *sampleId = &g_smidAmyCantBreathe;		  break; // Stephanie

		case 260 :  *sampleId = &g_smidRubinUhhh;		  		break; // Rubin
		

		case 629: 	*sampleId = &g_smidAsami_d2; 			break; // Asami
		case 783: 	*sampleId = &g_smidOsales_d2; 			break; // Osales
		case 827: 	*sampleId = &g_smidRyuichi_d2; 			break; // Ryuichi
		case 871: 	*sampleId = &g_smidShinobu_d2; 			break; // Shinobu
		case 893: 	*sampleId = &g_smidTadao_d2; 			break; // Tadao		



		//todo Paul
		}
		break;

	// SampleSet #3
	case 3:
		switch ((*sampleId)->sSoundId)
		{					
		case 652 : *sampleId = &g_smidSakura_d1; 			break; // Ayame =>  Sakura	
		case 674 : *sampleId = &g_smidCompshop_d1; 			break; // Compsales => Compshop		
		case 696 : *sampleId = &g_smidCompsales_d1; 		break; // Compshop => Compsales		
		case 718 : *sampleId = &g_smidKazuki_d1; 			break; // Kazuki		
		case 740 : *sampleId = &g_smidKensaku_d1;			break; // Kensaku		
		case 762 : *sampleId = &g_smidNoboru_d1; 			break; // Noboru		
		case 806 : *sampleId = &g_smidOsamu_d1; 			break; // Osamu		
		case 850 : *sampleId = &g_smidTomiko_d1; 			break; // Sakura => Tomiko		
		case 916 : *sampleId = &g_smidAyame_d1; 			break; // Tomiko => Ayame
		case 938 : *sampleId = &g_smidYutaka_d1; 			break; // Yutaka

		case 238 : case 251: *sampleId = &g_smidScottCoughBlood1; break; // Scott
		case 422 : case 423: *sampleId = &g_smidAmyCantBreathe;		  break; // Stephanie
		case 258 :  *sampleId = &g_smidRubinICantMove;		  		break; // Rubin
		
		case 630: 	*sampleId = &g_smidAsami_d1; 			break; // Asami
		case 784: 	*sampleId = &g_smidOsales_d1; 			break; // Osales
		case 828: 	*sampleId = &g_smidRyuichi_d1; 			break; // Ryuichi
		case 872: 	*sampleId = &g_smidShinobu_d1; 			break; // Shinobu
		case 894: 	*sampleId = &g_smidTadao_d1; 			break; // Tadao		


		//todo Paul
		}
		break;

	// SampleSet #4
	case 4:	
		switch ((*sampleId)->sSoundId)
		{		
		case 651 : *sampleId = &g_smidSakura_d2; 			break; // Ayame =>  Sakura	
		case 673 : *sampleId = &g_smidCompshop_d2; 			break; // Compsales => Compshop		
		case 695 : *sampleId = &g_smidCompsales_d2; 		break; // Compshop => Compsales		
		case 717 : *sampleId = &g_smidKazuki_d2; 			break; // Kazuki		
		case 739 : *sampleId = &g_smidKensaku_d2;			break; // Kensaku		
		case 761 : *sampleId = &g_smidNoboru_d2; 			break; // Noboru		
		case 805 : *sampleId = &g_smidOsamu_d2; 			break; // Osamu		
		case 849 : *sampleId = &g_smidTomiko_d2; 			break; // Sakura => Tomiko		
		case 915 : *sampleId = &g_smidAyame_d2; 			break; // Tomiko => Ayame
		case 937 : *sampleId = &g_smidYutaka_d2; 			break; // Yutaka

		case 237 : case 251: *sampleId = &g_smidScottCoughBlood2; break; // Scott
		case 422 : case 423: *sampleId = &g_smidAmyCantBreathe;		  break; // Stephanie
				case 260 :  *sampleId = &g_smidRubinUhhh;		  		break; // Rubin
		

case 629: 	*sampleId = &g_smidAsami_d2; 			break; // Asami
		case 783: 	*sampleId = &g_smidOsales_d2; 			break; // Osales
		case 827: 	*sampleId = &g_smidRyuichi_d2; 			break; // Ryuichi
		case 871: 	*sampleId = &g_smidShinobu_d2; 			break; // Shinobu
		case 893: 	*sampleId = &g_smidTadao_d2; 			break; // Tadao		


		//todo Paul
		}
		break;
	}

	
}

void CPerson::GetSoundRandomAlt(SampleMasterID **sampleId)
{
switch (g_ucMinimalSampleSet)
	{		
	// SampleSet #1
	case 1:
		switch ((*sampleId)->sSoundId)
		{					
			case 660: case 661: case 662: *sampleId = &g_smidSakura_r1; 			break; // Ayame =>  Sakura
			case 682: case 683: case 684: *sampleId = &g_smidCompshop_r1; 			break; // Compsales => Compshop => Compshop
			case 704: case 705: case 706: *sampleId = &g_smidCompsales_r1; 			break; // Compshop => Compsales	=> Compsales
			case 726: case 727: case 728: *sampleId = &g_smidKazuki_r1; 			break; // Kazuki	
			case 748: case 749: case 750: *sampleId = &g_smidKensaku_r1; 			break; // Kensaku
			case 770: case 771: case 772: *sampleId = &g_smidNoboru_r1; 			break; // Noboru
			case 814: case 815: case 816: *sampleId = &g_smidOsamu_r1; 				break; // Osamu
			case 858: case 859: case 860: *sampleId = &g_smidTomiko_r1; 			break; // Sakura => Tomiko
			case 924: case 925: case 926: *sampleId = &g_smidAyame_r1; 				break; // Tomiko => Ayame
			case 946: case 947: case 948: *sampleId = &g_smidYutaka_r1; 			break; // Yutaka

			case 316: case 317: 		  *sampleId = &g_smidScottDontGetAway; 		break; // Scott
			
			case 421: case 423: 		  *sampleId = &g_smidAmyWhatThe;			break; // Stephanie

			case 330 : case 331: case 332: case 333: *sampleId = &g_smidRubinVominos;			break; // Rubin

			//case 166:  		  			  *sampleId = &g_smidScottMyLeg;			break; // Scott	
			case 328:		*sampleId = &g_smidPaulHelpCall;			break; // Paul																		


			case 638: case 642: case 643:	*sampleId = &g_smidAsami_r1; 				break; // Asami
			case 792: case 793: case 794:	*sampleId = &g_smidOsales_r1; 				break; // Osales
			case 836: case 837: case 838:	*sampleId = &g_smidRyuichi_r1; 				break; // Ryuichi
			case 880: case 881: case 882:	*sampleId = &g_smidShinobu_r1; 				break; // Shinobu
			case 902: case 903: case 904:	*sampleId = &g_smidTadao_r1; 				break; // Tadao	
		}
		break;

	// SampleSet #2
	case 2:	
		switch ((*sampleId)->sSoundId)
		{					
			case 659: case 661: case 662: *sampleId = &g_smidSakura_r2; 			break; // Ayame =>  Sakura
			case 681: case 683: case 684: *sampleId = &g_smidCompshop_r2; 			break; // Compsales => Compshop
			case 703: case 705: case 706: *sampleId = &g_smidCompsales_r2; 			break; // Compshop => Compsales	
			case 725: case 727: case 728: *sampleId = &g_smidKazuki_r2; 			break; // Kazuki	
			case 747: case 749: case 750: *sampleId = &g_smidKensaku_r2; 			break; // Kensaku
			case 769: case 771: case 772: *sampleId = &g_smidNoboru_r2; 			break; // Noboru
			case 813: case 815: case 816: *sampleId = &g_smidOsamu_r2; 				break; // Osamu
			case 857: case 859: case 860: *sampleId = &g_smidTomiko_r2; 			break; // Sakura => Tomiko
			case 923: case 925: case 926: *sampleId = &g_smidAyame_r2; 				break; // Tomiko => Ayame
			case 945: case 947: case 948: *sampleId = &g_smidYutaka_r2; 			break; // Yutaka
			
			case 315: case 317: 		  *sampleId = &g_smidScottCantShootAll;		break; // Scott

			case 421: case 423: 		  *sampleId = &g_smidAmyWhatThe;			break; // Stephanie

			case 329 : case 331: case 332: case 333: *sampleId = &g_smidRubinMatalo;			break; // Rubin
			case 328:		*sampleId = &g_smidPaulHelpCall;			break; // Paul																		


			
			case 637: case 642: case 643:	*sampleId = &g_smidAsami_r2; 				break; // Asami
			case 791: case 793: case 794:	*sampleId = &g_smidOsales_r2; 				break; // Osales
			case 835: case 837: case 838:	*sampleId = &g_smidRyuichi_r2; 				break; // Ryuichi
			case 879: case 881: case 882:	*sampleId = &g_smidShinobu_r2; 				break; // Shinobu
			case 901: case 903: case 904:	*sampleId = &g_smidTadao_r2; 				break; // Tadao	

			//case 167:  		  			  *sampleId = &g_smidScottGrunt;			break; // Scott																												
		}
		break;

	// SampleSet #3
	case 3:	
		switch ((*sampleId)->sSoundId)
		{
			case 659: case 660: case 662: *sampleId = &g_smidSakura_r3; 			break; // Ayame =>  Sakura
			case 681: case 682: case 684: *sampleId = &g_smidCompshop_r3; 			break; // Compsales => Compshop
			case 703: case 704: case 706: *sampleId = &g_smidCompsales_r3; 			break; // Compshop => Compsales	
			case 725: case 726: case 728: *sampleId = &g_smidKazuki_r3; 			break; // Kazuki	
			case 747: case 748: case 750: *sampleId = &g_smidKensaku_r3; 			break; // Kensaku
			case 769: case 770: case 772: *sampleId = &g_smidNoboru_r3; 			break; // Noboru
			case 813: case 814: case 816: *sampleId = &g_smidOsamu_r3; 				break; // Osamu
			case 857: case 858: case 860: *sampleId = &g_smidTomiko_r3; 			break; // Sakura => Tomiko
			case 923: case 924: case 926: *sampleId = &g_smidAyame_r3; 				break; // Tomiko => Ayame
			case 945: case 946: case 948: *sampleId = &g_smidYutaka_r3; 			break; // Yutaka
			
			case 316: case 317: 		  *sampleId = &g_smidScottDontGetAway; 		break; // Scott
			case 421: case 423: 		  *sampleId = &g_smidAmyWhatThe;			break; // Stephanie

			case 329 : case 330: case 332: case 333: *sampleId = &g_smidRubinIfenVigado;			break; // Rubin
			case 328:		*sampleId = &g_smidPaulHelpCall;			break; // Paul					

			case 637: case 641: case 643:	*sampleId = &g_smidAsami_r3; 				break; // Asami
			case 791: case 792: case 794:	*sampleId = &g_smidOsales_r3; 				break; // Osales
			case 835: case 836: case 838:	*sampleId = &g_smidRyuichi_r3; 				break; // Ryuichi
			case 879: case 880: case 882:	*sampleId = &g_smidShinobu_r3; 				break; // Shinobu
			case 901: case 902: case 904:	*sampleId = &g_smidTadao_r3; 				break; // Tadao														
		}
		break;

	// SampleSet #4
	case 4:	
		switch ((*sampleId)->sSoundId)
		{
			case 659: case 660: case 661: *sampleId = &g_smidSakura_r4; 				break; // Ayame =>  Sakura
			case 681: case 682: case 683: *sampleId = &g_smidCompshop_r4; 				break; // Compsales => Compshop
			case 703: case 704: case 705: *sampleId = &g_smidCompsales_r4; 				break; // Compshop => Compsales	
			case 725: case 726: case 727: *sampleId = &g_smidKazuki_r4; 				break; // Kazuki	
			case 747: case 748: case 749: *sampleId = &g_smidKensaku_r4; 				break; // Kensaku
			case 769: case 770: case 771: *sampleId = &g_smidNoboru_r4; 				break; // Noboru
			case 813: case 814: case 815: *sampleId = &g_smidOsamu_r4; 					break; // Osamu
			case 857: case 858: case 859: *sampleId = &g_smidTomiko_r4; 				break; // Sakura => Tomiko
			case 923: case 924: case 925: *sampleId = &g_smidAyame_r4; 					break; // Tomiko => Ayame
			case 945: case 946: case 947: *sampleId = &g_smidYutaka_r4; 				break; // Yutaka

			case 316: case 317: 		  *sampleId = &g_smidScottDontGetAway; 			break; // Scott
			case 421: case 423: 		  *sampleId = &g_smidAmyWhatThe;			break; // Stephanie

			case 329 : case 330: case 331: case 333: *sampleId = &g_smidRubinGamalo;			break; // Rubin


			case 328:		*sampleId = &g_smidPaulHelpCall;			break; // Paul				

			case 637: case 641: case 642:	*sampleId = &g_smidAsami_r4; 				break; // Asami
			case 791: case 792: case 793:	*sampleId = &g_smidOsales_r4; 				break; // Osales
			case 835: case 836: case 837:	*sampleId = &g_smidRyuichi_r4; 				break; // Ryuichi
			case 879: case 880: case 881:	*sampleId = &g_smidShinobu_r4; 				break; // Shinobu
			case 901: case 902: case 903:	*sampleId = &g_smidTadao_r4; 				break; // Tadao																																	
		}
		break;	
	}
}

////////////////////////////////////////////////////////////////////////////////
// EOF
////////////////////////////////////////////////////////////////////////////////
