#include "StdAfx.h"
#include "HeroInfoWindow.h"

#include "Gauge.h"
#include "Label.h"
#include "GameUIManager.h"
#include "GameResourceManager.h"

#include "ObjectManager.h"

#include "LevelScript.h"
#include "ItemManager.h"
#include "UIImage.h"
#include "Player_Common.h"

cHeroInfoWindow::cHeroInfoWindow()
: mpHPGauge(0), mpMPGauge(0)
, mpEXPGauge(0), mpSXPGauge(0)
, mpWeightGuage(0)
{
	mpName = 0;
	mpRace = 0;
	mpGender = 0;
	mpClass = 0;
	mpFame = 0;	/// 명성
	mpGuild = 0;
	mpRank = 0;	/// 직위

	/// 게이지 수치
	mpLevel = 0;		/// 레벨
	mpSkillLevel = 0;	/// 스킬 레벨
	mpSkillPoint = 0;	/// 스킬 포인트

	/// 스테이터스 
	mpStr = 0;	/// 힘
	mpDex = 0;	/// 민첩
	mpCon = 0;	/// 체력
	mpInt = 0;	/// 지능
	mpWis = 0;	/// 지혜

	/// 스테이터스 추가량 
	mpPlusStr = 0;	/// 힘 증가
	mpPlusDex = 0;	/// 민첩 증가
	mpPlusCon = 0;	/// 체력 증가
	mpPlusInt = 0;	/// 지능 증가
	mpPlusWis = 0;	/// 지혜 증가

	/// 물리수치
	mpAtt = 0;	/// 공격력
	mpDef = 0;	/// 방어력
	mpHit = 0;	/// 명중
	mpAvoid = 0;	/// 회피
	/// 마법수치 
	mpMag = 0;	/// 마법력
	mpRes = 0;	/// 저항력

	mpAttackCri = 0;
	mpMagicCri = 0;
	mpHPRecover = 0;
	mpMPRecover = 0;

	mpForceType = 0;
}

cHeroInfoWindow::~cHeroInfoWindow()
{
}

void cHeroInfoWindow::UIStageIn()
{
	if( HERO == 0 )
	{
		assert(0);
		return;
	}

	/// 이름세팅
	if( mpName )
		mpName->SetText( HERO->GetName() );

	/// 종족 세팅
	if( mpRace )
		mpRace->SetText( GAMERESOURCEMAN->GetRaceName( HERO->GetRace() ) );

	/// 성별 세팅
	if( mpGender )
	{
		if( HERO->GetGender() == 0 || HERO->GetGender() == 2 )
			mpGender->SetText( GAMERESOURCEMAN->GetGameText( 1005 ) );		// 남
		else 
			mpGender->SetText( GAMERESOURCEMAN->GetGameText( 1006 ) );		// 여
	}

	UpdateHeroInfo();
	UpdateExpSxp();
}

void cHeroInfoWindow::UpdateExpSxp()
{
	if( HERO == 0 )
	{
		assert(0);
		return;
	}

	/// 캐릭터 경험치
	sExpTable*	pExp = LEVELSCRIPT->GetExpTable( HERO->GetLevel() );
	if( pExp )
	{
		unsigned int exp = HERO->GetHeroInfo()->Exp;
		SetMAXEXP( (float)pExp->mExp );
		SetEXP( (float)exp );
	}
	else
	{
		assert(0);
		return;
	}

	/// 캐릭터 스킬 경험치
	sSxpTable*	pSxp = LEVELSCRIPT->GetSxpTable( HERO->GetSkillLevel() );
	if( pSxp )
	{
		unsigned int sxp = HERO->GetHeroInfo()->SkillExp;
		SetMAXSXP( (float)pSxp->mSxp );
		SetSXP( static_cast<float>(sxp) );
	}
	else
	{
		assert(0);
		return;
	}
}

void cHeroInfoWindow::UpdateHeroInfo()
{
	assert( HERO );

	/// 캐릭터 레벨
	SetLevel( HERO->GetLevel() );

	/// 캐릭터 스킬 레벨
	SetSkillLevel( HERO->GetSkillLevel() );
	/// 캐릭터 스킬 포인트
	SetSkillPoint( HERO->GetSkillPointRemain() );

	/// 캐릭터 Weight , MAX Weight 세팅 
	SetMAXWeight( (float)HERO->GetMaxWeight(), HERO->GetExtStatusInfoType( ePLAYER_STATUS_EXT_WEIGHT ) );

	/// 인벤토리도 세팅
	ITEMMAN->SetMaxWeightGauge( (float)HERO->GetMaxWeight() );

	/// 클래스
	SetClass( HERO->GetJob() );

	/// 세력 세팅
	SetForceType( HERO->GetForceType() );

	/// 명성
	//SetFame( 123456 );
	
	/// 길드
	SetGuild( HERO->GetGuildName() );

	/// 직위
	//SetRank( "임시직위" );

	/// 힘
	SetStr( FloatToInt( HERO->GetStatus1()->mStr ), eCOLOR_WHITE );	
	/// 민첩
	SetDex( FloatToInt( HERO->GetStatus1()->mDex ), eCOLOR_WHITE );	
	/// 체력
	SetCon( FloatToInt( HERO->GetStatus1()->mCon ), eCOLOR_WHITE );	
	/// 지능
	SetInt( FloatToInt( HERO->GetStatus1()->mInt ), eCOLOR_WHITE );	
	/// 지혜
	SetWis( FloatToInt( HERO->GetStatus1()->mWis ), eCOLOR_WHITE );	


	/// 스테이터스 추가량 출력
	SetPlusStr( FloatToInt( HERO->GetStatus1Plus()->mStr ), HERO->GetBaseStatusInfoType( ePLAYER_STATUS_STR ) );
	SetPlusAgi( FloatToInt( HERO->GetStatus1Plus()->mDex ), HERO->GetBaseStatusInfoType( ePLAYER_STATUS_DEX ) );
	SetPlusCon( FloatToInt( HERO->GetStatus1Plus()->mCon ), HERO->GetBaseStatusInfoType( ePLAYER_STATUS_CON ) );
	SetPlusInt( FloatToInt( HERO->GetStatus1Plus()->mInt ), HERO->GetBaseStatusInfoType( ePLAYER_STATUS_INT ) );
	SetPlusWis( FloatToInt( HERO->GetStatus1Plus()->mWis ), HERO->GetBaseStatusInfoType( ePLAYER_STATUS_WIS ) );

	int attack = 0;
	/// 무기에 따른 공격력 출력
	if( HERO->GetWeaponState() == eWEAPON_STATE_GUN ) 
	{
		/// 원거리 무기
		SetAtt( FloatToInt(HERO->GetStatus2()->mPhysicMinRangeAttack), 
				FloatToInt(HERO->GetStatus2()->mPhysicMaxRangeAttack), HERO->GetExtStatusInfoType( ePLAYER_STATUS_EXT_ATK ) );	
	}
	else
	{
		/// 근거리 무기
		SetAtt( FloatToInt(HERO->GetStatus2()->mPhysicMinAttack), 
				FloatToInt(HERO->GetStatus2()->mPhysicMaxAttack), HERO->GetExtStatusInfoType( ePLAYER_STATUS_EXT_ATK ) );	
	}

	/// 방어력
	SetDef( FloatToInt( HERO->GetStatus2()->mPhysicDefense ), HERO->GetExtStatusInfoType( ePLAYER_STATUS_EXT_DEF ) );	
	
	/// 마법력
	SetMag( FloatToInt( HERO->GetStatus2()->mMagicMinAttack ), 
			FloatToInt( HERO->GetStatus2()->mMagicMaxAttack ), HERO->GetExtStatusInfoType( ePLAYER_STATUS_EXT_MATK ) );	

	/// 저항력
	SetRes( FloatToInt( HERO->GetStatus2()->mMagicDefense ), HERO->GetExtStatusInfoType( ePLAYER_STATUS_EXT_MDEF ) );	
	/// 명중
	SetHit( FloatToInt( HERO->GetStatus2()->mPhysicAttackRate ), HERO->GetExtStatusInfoType( ePLAYER_STATUS_EXT_HIT ) );	
	/// 회피
	SetAvoid( FloatToInt( HERO->GetStatus2()->mAvoid ), HERO->GetExtStatusInfoType( ePLAYER_STATUS_EXT_AVOID ) );	

	/// 물리 크리티컬
	SetAttackCritical( HERO->GetStatus2()->mPhysicCritical, HERO->GetExtStatusInfoType( ePLAYER_STATUS_EXT_CRI ));
	/// 마법 크리티컬
	SetMagicCritical( HERO->GetStatus2()->mMagicCritical, HERO->GetExtStatusInfoType( ePLAYER_STATUS_EXT_MCRI ));
	/// HP 회복량
	SetHPrecovery( HERO->GetStatus2()->mRecovHP, HERO->GetExtStatusInfoType( ePLAYER_STATUS_EXT_RECOVHP ));
	/// MP 회복량
	SetMPrecovery( HERO->GetStatus2()->mRecovMP, HERO->GetExtStatusInfoType( ePLAYER_STATUS_EXT_RECOVMP ));

	/// HP,MP세팅
	UpdateHeroHPMP();
}

void cHeroInfoWindow::UpdateHeroHPMP()
{
	unsigned long maxHP = HERO->GetMaxHP();
	if( mpHPGauge )
	{
		if( mpHPGauge->GetMaxValue() != maxHP )
			mpHPGauge->SetMaxValue( (float)maxHP );
	}

	unsigned long curHP = HERO->GetHP();
	if( mpHPGauge )
	{
		if( mpHPGauge->GetValue() != curHP )
			mpHPGauge->SetGaugeNoAni( (float)curHP );
	}

	unsigned long maxMP = HERO->GetMaxMP();
	if( mpMPGauge )
	{
		if( mpMPGauge->GetMaxValue() != maxMP )
			mpMPGauge->SetMaxValue( (float)maxMP );
	}

	unsigned long curMP = HERO->GetMP();
	if( mpMPGauge )
	{
		if( mpMPGauge->GetValue() != curMP )
			mpMPGauge->SetGaugeNoAni( (float)curMP );
	}
}

// 주의사항 : 
bool cHeroInfoWindow::OnCreate( cUINodeProperty* pproperty )
{
	if( cUIWindow::OnCreate( pproperty ) == false )
		return false;

	mpHPGauge = (cDoubleGauge*)GetChild( eUIID_HERO_HP_GAUGE_BAR );
	mpMPGauge = (cDoubleGauge*)GetChild( eUIID_HERO_MP_GAUGE_BAR );
	mpEXPGauge = (cGauge*)GetChild( eUIID_HERO_EXP_GAUGE_BAR );
	mpSXPGauge = (cGauge*)GetChild( eUIID_HERO_SXP_GAUGE_BAR );
	mpWeightGuage = (cGauge*)GetChild( eUIID_HERO_WEIGHT_GAUGE_BAR );

	mpLevel = (cLabel*)GetChild( eUIID_HERO_LEVEL_LABEL );	
	mpSkillLevel = (cLabel*)GetChild( eUIID_HERO_SKILLLEVEL_LABEL );	 
	mpSkillPoint = (cLabel*)GetChild( eUIID_HERO_SKILLPOINT_LABEL );	

	mpName = (cLabel*)GetChild( eUIID_HERO_NAME );	
	mpRace  = (cLabel*)GetChild( eUIID_HERO_RACE );	
	mpGender  = (cLabel*)GetChild( eUIID_HERO_GENDER );	
	mpClass  = (cLabel*)GetChild( eUIID_HERO_CLASS );	
	mpFame  = (cLabel*)GetChild( eUIID_HERO_FAME );	
	mpGuild  = (cLabel*)GetChild( eUIID_HERO_GUILD );	
	mpRank  = (cLabel*)GetChild( eUIID_HERO_RANK );	

	mpStr = (cLabel*)GetChild( eUIID_HERO_STR );	
	mpDex = (cLabel*)GetChild( eUIID_HERO_DEX );	
	mpCon = (cLabel*)GetChild( eUIID_HERO_CON );	
	mpInt = (cLabel*)GetChild( eUIID_HERO_INT );	
	mpWis = (cLabel*)GetChild( eUIID_HERO_WIS );	

	mpPlusStr = (cLabel*)GetChild( eUIID_HERO_PLUSSTR );	
	mpPlusDex = (cLabel*)GetChild( eUIID_HERO_PLUSDEX );	
	mpPlusCon = (cLabel*)GetChild( eUIID_HERO_PLUSCON );	
	mpPlusInt = (cLabel*)GetChild( eUIID_HERO_PLUSINT );	
	mpPlusWis = (cLabel*)GetChild( eUIID_HERO_PLUSWIS );	

	mpAtt = (cLabel*)GetChild( eUIID_HERO_ATT );	
	mpDef = (cLabel*)GetChild( eUIID_HERO_DEF );	
	mpHit = (cLabel*)GetChild( eUIID_HERO_HIT );	
	mpAvoid = (cLabel*)GetChild( eUIID_HERO_AVOID );	

	mpMag = (cLabel*)GetChild( eUIID_HERO_MAG );	
	mpRes = (cLabel*)GetChild( eUIID_HERO_RES );	

	mpAttackCri = (cLabel*)GetChild( eUIID_HERO_ATTACKCRI );	
	mpMagicCri = (cLabel*)GetChild( eUIID_HERO_MAGICCRI );	
	mpHPRecover = (cLabel*)GetChild( eUIID_HERO_HPRECOVER );	
	mpMPRecover = (cLabel*)GetChild( eUIID_HERO_MPRECOVER );	

	mpForceType = (cLabel*)GetChild( eUIID_HERO_FORCETYPE );
	return true;
}

/// 주의사항 : 
void cHeroInfoWindow::OnCommand( cUINode*, unsigned int id )
{
	if( id == eUIID_HERO_CLOSE_BUTTON )
		Hide();
}

/// 주의사항 : Weight 세팅
void cHeroInfoWindow::SetWeight( float value )
{
	if( mpWeightGuage )
		mpWeightGuage->SetGaugeNoAni( value );
}

/// 주의사항 : max Weight 값 세팅 
void cHeroInfoWindow::SetMAXWeight( float value, eStateInfo_Type type )
{
	if( mpWeightGuage )
		mpWeightGuage->SetMaxValue( value );
}


/// 주의사항 : EXP 게이지와 EXP 라벨 세팅 
void cHeroInfoWindow::SetEXP( float exp )
{
	/// EXP 
	if( mpEXPGauge )
	{
		mpEXPGauge->SetGaugeNoAni( exp );

		cStringT str;
		str.Format( _T("%.2f%"), mpEXPGauge->GetPercent() );
	}
}

/// 주의사항 : EXP 게이지와 EXP 라벨 세팅 
void cHeroInfoWindow::SetMAXEXP( float exp )
{
	if( mpEXPGauge )
		mpEXPGauge->SetMaxValue( exp );
}

/// 주의사항 : 스킬 경험치 세팅 
void cHeroInfoWindow::SetSXP( float sexp )
{
	/// sxp 세팅
	if( mpSXPGauge )
	{
		mpSXPGauge->SetGaugeNoAni( sexp );

		cStringT str;
		str.Format( _T("%.2f%"), mpSXPGauge->GetPercent() );
	}
}

/// 주의사항 : 스킬 경험치 세팅 
void cHeroInfoWindow::SetMAXSXP( float sexp )
{
	if( mpSXPGauge )
		mpSXPGauge->SetMaxValue( sexp );
}

/// 주의사항 : 레벨 세팅
void cHeroInfoWindow::SetLevel( int level )
{
	if( mpLevel )
		mpLevel->SetValue( level );
}

/// 주의사항 : 스킬 레벨 세팅
void cHeroInfoWindow::SetSkillLevel( int slevel )
{
	if( mpSkillLevel )
		mpSkillLevel->SetValue( slevel );
}

/// 주의사항 : 스킬 포인트 세팅
void cHeroInfoWindow::SetSkillPoint( int sp )
{
	if( mpSkillPoint )
		mpSkillPoint->SetValue( sp );
}

/// 클래스
void cHeroInfoWindow::SetClass( unsigned long job )
{
	if( mpClass )
		mpClass->SetText( GAMERESOURCEMAN->GetJobName( job ) );
}

/// 명성
void cHeroInfoWindow::SetFame( int famevalue )
{
	if( mpFame )
		mpFame->SetValue( famevalue );
}
/// 길드
void cHeroInfoWindow::SetGuild( LPCTSTR text )
{
	int len = ::_tcslen( text );
	if( mpGuild )
	{
		if( len > 0 )
			mpGuild->SetText( text );
		else
			mpGuild->Clear();
	}
}
/// 직위
void cHeroInfoWindow::SetRank( LPCTSTR text )
{
	int len = ::_tcslen( text );
	if( mpRank )
	{
		if( len > 0 )
			mpRank->SetText( text );
		else
			mpRank->Clear();
	}
}
/// 힘
void cHeroInfoWindow::SetStr( int value, eText_Color color )	
{
	if( mpStr )
		mpStr->SetValue( value, color );
}
/// 민첩
void cHeroInfoWindow::SetDex( int value, eText_Color color )	
{
	if( mpDex )
		mpDex->SetValue( value, color );
}	
/// 체력
void cHeroInfoWindow::SetCon( int value, eText_Color color )		
{
	if( mpCon )
		mpCon->SetValue( value, color );
}
/// 지능
void cHeroInfoWindow::SetInt( int value, eText_Color color )		
{
	if( mpInt )
		mpInt->SetValue( value, color );
}
/// 지혜
void cHeroInfoWindow::SetWis( int value, eText_Color color )		
{
	if( mpWis )
		mpWis->SetValue( value, color );
}

//// 추가량 
/// 힘
void cHeroInfoWindow::SetPlusStr( int value, eStateInfo_Type type )	
{
	if( mpPlusStr )
	{
		cStringT str;
		if( value > 0 )
			str.Format( _T("+%d"), value );
		else
			str.Format( _T("%d"), value );

		eText_Color color = GetColorForStateType(type);
		mpPlusStr->SetTextColor( color );
		mpPlusStr->SetText( (LPCTSTR)str.Cstr() );

		if( str.IsEmpty() == false && color == eCOLOR_WHITE )
		{
			assert(0);
		}

		if( value == 0 )	
			mpPlusStr->Hide();
		else
			mpPlusStr->Show();
	}
}
/// 민첩
void cHeroInfoWindow::SetPlusAgi( int value, eStateInfo_Type type )	
{
	if( mpPlusDex )
	{
		cStringT str;
		if( value > 0 )
			str.Format( _T("+%d"), value );
		else
			str.Format( _T("%d"), value );

		eText_Color color = GetColorForStateType(type);
		mpPlusDex->SetTextColor( color );
		mpPlusDex->SetText( (LPCTSTR)str.Cstr() );

		if( str.IsEmpty() == false && color == eCOLOR_WHITE )
		{
			assert(0);
		}

		if( value == 0 )
			mpPlusDex->Hide();
		else
			mpPlusDex->Show();
	}
}	
/// 체력
void cHeroInfoWindow::SetPlusCon( int value, eStateInfo_Type type )		
{
	if( mpPlusCon )
	{
		cStringT str;
		if( value > 0 )
			str.Format( _T("+%d"), value );
		else
			str.Format( _T("%d"), value );

		eText_Color color = GetColorForStateType(type);
		mpPlusCon->SetTextColor( GetColorForStateType(type) );
		mpPlusCon->SetText( (LPCTSTR)str.Cstr() );

		if( str.IsEmpty() == false && color == eCOLOR_WHITE )
		{
			assert(0);
		}

		if( value == 0 )	
			mpPlusCon->Hide();
		else
			mpPlusCon->Show();
	}
}
/// 지능
void cHeroInfoWindow::SetPlusInt( int value, eStateInfo_Type type )		
{
	if( mpPlusInt )
	{
		cStringT str;
		if( value > 0 )
			str.Format( _T("+%d"), value );
		else
			str.Format( _T("%d"), value );

		eText_Color color = GetColorForStateType(type);
		mpPlusInt->SetTextColor( GetColorForStateType(type) );
		mpPlusInt->SetText( (LPCTSTR)str.Cstr() );

		if( str.IsEmpty() == false && color == eCOLOR_WHITE )
		{
			assert(0);
		}

		if( value == 0 )	
			mpPlusInt->Hide();
		else
			mpPlusInt->Show();
	}
}
/// 지혜
void cHeroInfoWindow::SetPlusWis( int value, eStateInfo_Type type )		
{
	if( mpPlusWis )
	{
		cStringT str;
		if( value > 0 )
			str.Format( _T("+%d"), value );
		else
			str.Format( _T("%d"), value );

		mpPlusWis->SetTextColor( GetColorForStateType(type) );
		mpPlusWis->SetText( (LPCTSTR)str.Cstr() );

		if( value == 0 )
			mpPlusWis->Hide();
		else
			mpPlusWis->Show();
	}
}

/// 물리수치
/// 공격력
void cHeroInfoWindow::SetAtt( int min, int max, eStateInfo_Type type )		
{
	if( mpAtt )
	{
		cStringT str;
		str.Format( _T("%d~%d"), min, max );

		/// 세팅
		mpAtt->SetTextColor( GetColorForStateType(type) );
		mpAtt->SetText( (LPCTSTR)str.Cstr() );
	}
}
/// 방어력
void cHeroInfoWindow::SetDef( int value, eStateInfo_Type type )		
{
	if( mpDef )
		mpDef->SetValue( value, GetColorForStateType(type) );
}
/// 명중
void cHeroInfoWindow::SetHit( int value, eStateInfo_Type type )		
{
	if( mpHit )
		mpHit->SetValue( value, GetColorForStateType(type) );
}
/// 회피
void cHeroInfoWindow::SetAvoid( int value, eStateInfo_Type type )		
{
	if( mpAvoid )
		mpAvoid->SetValue( value, GetColorForStateType(type) );
}

/// 마법력
void cHeroInfoWindow::SetMag( int min, int max, eStateInfo_Type type )		
{
	if( mpMag )
	{
		cStringT str;
		str.Format( _T("%d~%d"), min, max );

		/// 세팅
		mpMag->SetTextColor( GetColorForStateType(type) );
		mpMag->SetText( (LPCTSTR)str.Cstr() );
	}
}
/// 저항력
void cHeroInfoWindow::SetRes( int value, eStateInfo_Type type )		
{
	if( mpRes )
		mpRes->SetValue( value, GetColorForStateType(type) );
}

/// 물리 크리티컬
void cHeroInfoWindow::SetAttackCritical( float value, eStateInfo_Type type )
{
	if( mpAttackCri )
	{
		cStringT str;
		str.Format( _T("%.2f%"), value );

		mpAttackCri->SetTextColor( GetColorForStateType(type) );
		mpAttackCri->SetText( (LPCTSTR)str.Cstr() );
	}
}

/// 마법 크리티컬
void cHeroInfoWindow::SetMagicCritical( float value, eStateInfo_Type type )
{
	if( mpMagicCri )
	{
		cStringT str;
		str.Format( _T("%.2f%"), value );

		mpMagicCri->SetTextColor( GetColorForStateType(type) );
		mpMagicCri->SetText( (LPCTSTR)str.Cstr() );
	}
}

/// HP 회복량
void cHeroInfoWindow::SetHPrecovery( float value, eStateInfo_Type type )
{
	if( mpHPRecover )
	{
		cStringT str;
		str.Format( _T("%.2f%"), value );

		/// 세팅
		mpHPRecover->SetTextColor( GetColorForStateType(type) );
		mpHPRecover->SetText( (LPCTSTR)str.Cstr() );
	}
}

/// MP 회복량
void cHeroInfoWindow::SetMPrecovery( float value, eStateInfo_Type type )
{
	if( mpMPRecover )
	{
		cStringT str;
		str.Format( _T("%.2f%"), value );

		/// 세팅
		mpMPRecover->SetTextColor( GetColorForStateType(type) );
		mpMPRecover->SetText( (LPCTSTR)str.Cstr() );
	}
}

/// 세력 타입
void cHeroInfoWindow::SetForceType( unsigned char type )
{
	int textIdx = 0;
	switch( type )
	{
	case eFORCETYPE_NONE:	textIdx = 119;	break;
	case eFORCETYPE_FIRE:	textIdx = 120;	break;
	case eFORCETYPE_WATER:  textIdx = 121;	break;
	case eFORCETYPE_WIND:	textIdx = 122;	break;
	case eFORCETYPE_EARTH:	textIdx = 123;	break;
	default: assert(0); return;
	}

	if( mpForceType )
		mpForceType->SetText( UIMAN->GetUIText( textIdx ) );
}

///
eText_Color cHeroInfoWindow::GetColorForStateType( eStateInfo_Type type )
{
	eText_Color color = mDefaultColor;

	switch( type )
	{
	case eSTATE_NORMAL:		color = mDefaultColor;		break;
	case eSTATE_PLUS:		color = eCOLOR_GREEN;		break;
	case eSTATE_MINUS:		color = eCOLOR_RED;			break;
	case eSTATE_OVERLAPPLUS:
	case eSTATE_OVERLAPMINUS:
		color = eCOLOR_YELLOW;
		break;
	}

	return color;
}
