MenuSubState* MenuSubStateFactory::createMain()
{
	MenuSubState* tmp			= createMenuSubState();
	vector<string> texts		= createMainTexts();
	MenuItemProperties props	= createMainProperties();
	vector<MenuItem*> items		= createItems( props, texts );
	
	float fw = 1.0f/1920.0f;
	float fh = 1.0f/1080.0f;

	// Add logo!
	items.push_back( m_gof->createMenuItem( 
		fVector3( 0.5f, 0.66f, 0.7f ), fVector2( 960.0f*fw, 525.0f*fh ),
		"", fVector2(0.0f, 0.0f),
		fVector2(fw*20, fh*20), "../Textures/logo.png" ));

	tmp->addItems( items );
	tmp->setBehaviour( new MainSubState() );
	tmp->setAllSelectable();
	tmp->setSelectable( MainSubState::MM_NUM_ITEMS, false );

	tmp->setMenuBackSnd( m_gof->CreateSoundInfo( m_menuBackSoundPath, 80 ) );
	tmp->setMenuNavigatonSnd( m_gof->CreateSoundInfo( m_navigationSoundPath, 80 ) );
	tmp->setItemSelectSnd( m_gof->CreateSoundInfo( m_itemSelectSoundPath, 80 ) );
	
	return tmp;
}
//打开一个玩家的摊位
VOID CGameInterface::Stall_OpenStallSale(INT nObjId)
{
	CObject *pChar = (CObject*) CObjectManager::GetMe()->FindServerObject(nObjId);
	if(pChar)
	{
		//先判定距离是不是合法
		const fVector3 pMePos = CObjectManager::GetMe()->GetMySelf()->GetPosition();
		const fVector3 pOtherPos = (pChar)->GetPosition();

		FLOAT fDistance = 
			TDU_GetDist(fVector2(pMePos.x, pMePos.z),
						fVector2(pOtherPos.x, pOtherPos.z));

		AxTrace(0,0,"%f", fDistance);

		if( EXCHANGE_MAX_DISTANCE < fDistance )
		{
			CEventSystem::GetMe()->PushEvent(GE_NEW_DEBUGMESSAGE,"距离太远,不能打开这个摊位");
			return ;
		}

		//发送打开摊位的消息
		CGStallOpen OpenStallMsg;
		OpenStallMsg.SetObjID(nObjId);
		CNetManager::GetMe()->SendPacket(&OpenStallMsg);

		//同时发送请求StallMessage的消息
		//CGBBSApply BbsMsg;
		//BbsMsg.SetObjID(nObjId);
		//CNetManager::GetMe()->SendPacket(&BbsMsg);
	}

}
AvatarWalking::AvatarWalking(GameObject* p_gameObject,
	NavigationData* p_navigationData, GameStats* p_stats):
GOState(p_gameObject)
{
	m_navigationData = p_navigationData;
	m_gameStats = p_stats;

	m_right = new Animation(fVector2(0, 0), 64, 64, 8, 0.06f, true);
	m_left = new Animation(fVector2(0, 64), 64, 64, 8, 0.06f, true);
	m_down = new Animation(fVector2(0, 128), 64, 64, 8, 0.06f, true);
	m_up = new Animation(fVector2(0, 192), 64, 64, 8, 0.06f, true);
}
fVector2 GOFactory::GetScaledSize(Tile* p_tile, float p_scale)
{
	if (p_tile)
	{
		float w = p_tile->getWidth();
		float h = p_tile->getHeight();
		TilePosition tp = p_tile->getTilePosition();

		return fVector2(w * p_scale, h * p_scale);
	}
	return fVector2(0, 0);
}
TextArea* GOFactory::createMenuItemTextArea( fVector3 p_position,
	string p_text, fVector2 p_textOffset, fVector2 p_fontSize )
{
	float scrW = GAME_FAIL;
	float scrH = GAME_FAIL;
	if(m_io != NULL)
	{
		scrW = (float)m_io->getScreenWidth();
		scrH = (float)m_io->getScreenHeight();
	}

	unsigned int fontWidth = (unsigned int)(scrW * p_fontSize.x);
	unsigned int fontHeight = (unsigned int)(scrH * p_fontSize.y);
	float finalTextPosX = scrW * (p_position.x + p_textOffset.x);
	float finalTextPosY = scrH * (p_position.y + p_textOffset.y);

	GlyphMap* font = new GlyphMap(
			" !¨}_%#'()$+,-./0123456789:{<=>?@ABCDEFGHIJKLMNOPQRSTUVWXYZÄÀÁÅçCCCIIiñóöòööAÜUUU;¤",
			"../Textures/bubblemad_32x32.png", 32, 32);

	vector<GlyphAnimation*> animators;
	animators.push_back( new GlyphAnimIn() ); // Intro
	animators.push_back( new GlyphAnimSinus() ); // In menu
	animators.push_back( new GlyphAnimSinus() ); // Selected
	animators.push_back( new GlyphAnimOut() ); // Outro
	animators.push_back( new GlyphAnimShake() ); //Shake in GUI

	TextArea* text = new TextArea( font, p_text.size(), this, finalTextPosX,
			finalTextPosY, TextArea::CEN_CENTER,
			fVector2(fontWidth/32.0f, fontHeight/32.0f), animators);

	return text;
}
MenuItem* GOFactory::createMenuItem( fVector3 p_position, fVector2 p_size,
	string p_text, fVector2 p_textOffset, fVector2 p_fontSize, string p_bgTexPath)
{
	float scrW = GAME_FAIL;
	float scrH = GAME_FAIL;
	if(m_io != NULL)
	{
		scrW = (float)m_io->getScreenWidth();
		scrH = (float)m_io->getScreenHeight();
	}

	fVector2 finalPos, finalTextOffset;
	finalPos.x = scrW * (p_position.x);	
	finalPos.y = scrH * (p_position.y);
	finalTextOffset.x = scrW * (p_textOffset.x);
	finalTextOffset.y = scrH * (p_textOffset.y);

	SpriteInfo* spriteInfo = NULL;
	if( p_bgTexPath != "" )
		spriteInfo = CreateSpriteInfo( p_bgTexPath,
		fVector3(finalPos.x, finalPos.y, p_position.z),
		fVector2(p_size.x*scrW, p_size.y*scrH), NULL );


	GlyphMap* font = NULL;
	TextArea* text = NULL;
	if( p_text != "" )
	{
		text = createMenuItemTextArea(p_position, p_text, p_textOffset, p_fontSize );
		text->setText( p_text );
	}

	return new MenuItem( spriteInfo, text, finalPos, finalTextOffset );
}
Monster* GOFactory::CreateMonster(Tile* p_tile, Tilemap* p_map, GameStats* p_stats, int p_type)
{
	int type = p_type - (TileTypes::ENEMIESPAWN-30);
	fVector3 pos = GetCenter(p_tile, 0.2f); 
	fVector2 size = GetScaledSize(p_tile, 2.0f);
	if (type == 2)
	{
		float frac = p_tile->getWidth() / 32.0f;
		size = fVector2(100 * frac, 100*frac);
	}
	std::string spriteInfoPath;
	if(type == 1)
		spriteInfoPath = "../Textures/rat.png";
	else if(type == 2)
		spriteInfoPath = "../Textures/robotaparte.png";

	SpriteInfo* spriteInfo = CreateSpriteInfo( spriteInfoPath,
		pos, size, NULL);
	if(type == 1)
		return new Rat(p_stats, spriteInfo, p_tile, p_map, CreateSoundInfo("../Sounds/monster_killed_v2.wav",100));
	else if(type == 2)
		return new InfectedRat(p_stats, spriteInfo, p_tile, p_map, CreateSoundInfo("../Sounds/monster_killed_v2.wav",100));

	return NULL;
}
VOID CObject_Character::Initial( VOID* pParam )
{
	//AxProfile::AxProfile_PopNode("ObjInit");
	CObject_Phy::Initial(pParam);

	m_bAnimationEnd				= FALSE;
	m_uFightStateTime	= 0;

	SetCurrentLogicCommand(NULL);
	m_fLogic_Speed				= 1.f;

	SetMapPosition( fVector2( GetPosition().x, GetPosition().z ) );
	
	//创建逻辑信息
	m_pCharacterData = CDataPool::GetMe()->CharacterData_Create(this);

	//创建信息板
	//AxProfile::AxProfile_PushNode("ObjInit_CreateBoard");
	if(!GetFakeObjectFlag()&& CGameProcedure::s_pUISystem)
	{
		m_pInfoBoard = CGameProcedure::s_pUISystem->CreateCreatureBoard();
		m_pInfoBoard->SetElement_ObjId(this->GetServerID());

		m_pInfoBoard->SetElement_LeaderFlag(FALSE);
		m_pInfoBoard->SetElement_Name("");
		m_pInfoBoard->SetElement_SaleSign(FALSE);
		SetElement_Title("",_TITLE::NO_TITLE);
		m_pInfoBoard->Show(FALSE);
	}
	//AxProfile::AxProfile_PopNode("ObjInit_CreateBoard");

	m_uTime_LogicEventListTick	= CGameProcedure::s_pTimeSystem->GetTimeNow();

	Enable(OSF_VISIABLE);
	Disalbe(OSF_OUT_VISUAL_FIELD);

	m_bDropBox_HaveData			= FALSE;
	m_nDropBox_ItemBoxID		= INVALID_ID;
	m_DropBox_OwnerGUID			= INVALID_ID;
	m_posDropBox_CreatePos		= WORLD_POS(-1.f, -1.f);

	m_bHideWeapon = FALSE;
	UpdateCharRace();
	UpdateCharModel();
	UpdateMountModel();

	SObjectInit *pCharacterInit = (SObjectInit*)pParam;
	if ( pCharacterInit != NULL )
	{
		// 状态信息
		RemoveAllImpact();
		Start_Idle();
	}
}
Rat::Rat(GameStats* p_gameStats, SpriteInfo* p_spriteInfo, Tile* p_tile, Tilemap* p_map,
					SoundInfo* p_monsterKilledSound)
	: Monster(p_gameStats, p_spriteInfo)
{
	dt = 0;
	m_startTile = m_currentTile = m_nextTile = p_tile;
	m_map = p_map;
	m_respawning = false;
	m_dead = false;
	m_ai = NULL;

	m_monsterKilledSound = p_monsterKilledSound;

	m_right = new Animation(fVector2(0, 0), 64, 64, 4, 0.1f, true);
	m_left = new Animation(fVector2(0, 64), 64, 64, 4, 0.1f, true);
	m_down = new Animation(fVector2(0, 128), 64, 64, 4, 0.1f, true);
	m_up = new Animation(fVector2(0, 192), 64, 64, 4, 0.1f, true);

	m_currentAnimation = m_down;
	m_timeSinceSpawn = 0;
	m_size = fVector2(p_spriteInfo->transformInfo.scale[TransformInfo::X],
						p_spriteInfo->transformInfo.scale[TransformInfo::Y]);
}
Tile* GOFactory::CreateTile(bool p_type, TilePosition p_position, float p_width,
	float p_height)
{
	fVector3 pos = fVector3(p_position.x * p_width + p_width * 0.5f,
		p_position.y * p_height + p_height * 0.5f, 0.0f);
	fVector2 size = fVector2(p_width, p_height);
	SpriteInfo* spriteInfo = CreateSpriteInfo("../Textures/wall.png",
		pos, size, NULL);

	if (spriteInfo)
		spriteInfo->visible = !p_type;

	return new Tile(p_type, p_position, p_width, p_height, spriteInfo);
}
Example #11
0
BOOL CObject_Bus::StartMove(const fVector3 *pTargetPos)
{
	if(pTargetPos == NULL)
	{
		return FALSE;
	}

	m_fvMoveTargetPos = *pTargetPos;
	m_fvSaveStartPos = GetPosition();

	m_fTargetDir = KLU_GetYAngle(fVector2(GetPosition().x, GetPosition().z), fVector2(m_fvMoveTargetPos.x, m_fvMoveTargetPos.z));
	if(m_fTargetDir < 0.f)
	{
		m_fTargetDir = __PI * 2.f + m_fTargetDir;
	}

	if(m_nCurrentAnimationIndex != BASE_ACTION_N_RUN)
	{
		ChangeAction(BASE_ACTION_N_RUN, 1.f, TRUE);
	}

	m_bMoving = TRUE;
	return TRUE;
}
Example #12
0
BOOL CObject_Dynamic::CalcMoveDir( VOID )
{
	if ( m_listPathNode.empty() )
		return FALSE;

	fVector3 fvNextPos;
	fVector2 fvNextPos2D;
	fvNextPos		= (*m_listPathNode.begin());
	fvNextPos2D.x	= fvNextPos.x;
	fvNextPos2D.y	= fvNextPos.z;

	FLOAT fYAngle = TDU_GetYAngle(
		fVector2(GetPosition().x, GetPosition().z), 
		fvNextPos2D);

	SetFaceDir( fYAngle );
	return TRUE;
}
Example #13
0
VOID CObject_Bus::SetPosition(const fVector3& fvPosition) 
{

	CObject_Dynamic::SetPosition( fvPosition );

	INT i;
	for(i = 0; i < m_nPassengerCount; i++)
	{
		if(m_anPassengerIDs[i] != INVALID_ID)
		{
			CObject *pObj = (CObject*)(CObjectManager::GetMe()->FindServerObject(m_anPassengerIDs[i]));
			if(pObj != NULL)
			{
				pObj->SetMapPosition(fVector2(fvPosition.x, fvPosition.z));
				pObj->SetFootPosition(fvPosition);
			}
		}
	}
}
Example #14
0
fVector2 CVariableSystem::GetAs_Vector2(LPCTSTR szName, BOOL* bHave)
{
	static fVector2 fvNULL(0.0f, 0.0f);

	VARIABLE_MAP::iterator itFind = m_mapCurrent.find(szName);
	if(itFind == m_mapCurrent.end())
	{
		if(bHave) *bHave = FALSE;
		return fvNULL;
	}

	if(bHave) *bHave = true;

	CHAR szTemp[64];
	strncpy(szTemp, itFind->second.vValue.c_str(), 64);

	char* pDot = strchr(szTemp, ',');
	if(!pDot) return fvNULL;
	*pDot = '\0';

	return fVector2((FLOAT)atof(szTemp), (FLOAT)atof(pDot+1));
}
Example #15
0
tCircleParams PhysicsRecord::getCircleParams(const Hit & p1, const Hit & p2, const Hit & p3) const{

	tCircleParams params;

	//circle fit
	//map points to parabloid: (x,y) -> (x,y,x^2+y^2)
	fVector3 pP1 (p1.globalX(),
			p1.globalY(),
			p1.globalX() * p1.globalX() + p1.globalY() * p1.globalY());

	fVector3 pP2 (p2.globalX(),
			p2.globalY(),
			p2.globalX() * p2.globalX() + p2.globalY() * p2.globalY());

	fVector3 pP3 (p3.globalX(),
			p3.globalY(),
			p3.globalX() * p3.globalX() + p3.globalY() * p3.globalY());

	//span two vectors
	fVector3 a(pP2.x - pP1.x, pP2.y - pP1.y, pP2.z - pP1.z);
	fVector3 b(pP3.x - pP1.x, pP3.y - pP1.y, pP3.z - pP1.z);

	//compute unit cross product
	fVector3 n(a.y*b.z - a.z*b.y,
			a.z*b.x - a.x*b.z,
			a.x*b.y - a.y*b.x );
	double value = sqrt(n.x*n.x+n.y*n.y+n.z*n.z);
	n.x /= value; n.y /= value; n.z /= value;

	//formula for orign and radius of circle from Strandlie et al.
	params.center = fVector2((-n.x) / (2*n.z),
			(-n.y) / (2*n.z));

	double c = -(n.x*pP1.x + n.y*pP1.y + n.z*pP1.z);

	params.radius = sqrt((1 - n.z*n.z - 4 * c * n.z) / (4*n.z*n.z));

	return params;
}
Example #16
0
void Draw::DrawBox(const fRect &rect, float rotation, const cColorRGBA &color, Texture *texture, Shader *shader)
{
	VertexDraw2D *buffer = LE_DrawManager.GetVertexBuffer2D(6);
    fSize screenSize(LE_DrawManager.GetVirtualScreenSize());
    fRect rectInProj = rect / screenSize;
    fPoint rightTop(rect.width, 0.0f);
	fPoint rightBottom(rect.width, rect.height);
    fPoint leftBottom(0.0f, rect.height);
    fMatrix4x4 rotmat = fMatrix4x4::RotationZ(rotation);
    rightBottom = rotmat * rightBottom / screenSize;
    rightBottom += rectInProj.xy();
    rightTop = rotmat * rightTop / screenSize;
    rightTop += rectInProj.xy();
    leftBottom = rotmat * leftBottom / screenSize;
    leftBottom += rectInProj.xy();
    buffer[0].SetPosition(fVector3(rectInProj.xy(), 0.0f));
	buffer[0].SetColor(color);
	buffer[0].SetTexcoord(fVector2(0.0f, 0.0f));
	buffer[1].SetPosition(fVector3(leftBottom, 0.0f));
	buffer[1].SetColor(color);
	buffer[1].SetTexcoord(fVector2(0.0f, 1.0f));
	buffer[2].SetPosition(fVector3(rightTop, 0.0f));
	buffer[2].SetColor(color);
	buffer[2].SetTexcoord(fVector2(1.0f, 0.0f));
	buffer[3].SetPosition(fVector3(leftBottom, 0.0f));
	buffer[3].SetColor(color);
	buffer[3].SetTexcoord(fVector2(0.0f, 1.0f));
	buffer[4].SetPosition(fVector3(rightBottom, 0.0f));
	buffer[4].SetColor(color);
	buffer[4].SetTexcoord(fVector2(1.0f, 1.0f));
	buffer[5].SetPosition(fVector3(rightTop, 0.0f));
	buffer[5].SetColor(color);
	buffer[5].SetTexcoord(fVector2(1.0f, 0.0f));
    if(shader == NULL) {
        if(texture) {
            DrawCommand::BindTexture(0, texture);
        } else {
            DrawCommand::BindTexture(0, RenderContext::GetSingleton().GetDefaultTexture(RenderContext::DefaultTextureTypeWhite));
        }
    }
    LE_DrawManager.Draw2DFlush(GraphicsFlag::PT_TRIANGLELIST, shader);
}
Example #17
0
    void Sprite::Draw(const iRect &frame, const iRect &rect, float rotation)
    {
        if (_texture) DrawCommand::BindTexture(0, _texture);
        fSize texSize(_texture->GetSize());
        fSize screenSize(LE_DrawManager.GetVirtualScreenSize());
        VertexDraw2D *buffer = LE_DrawManager.GetVertexBuffer2D(6);

        fRect frameInProj = frame / texSize;
        fRect rectInProj = rect / screenSize;
        fPoint rightTop(float(rect.width), 0.0f);
        fPoint rightBottom(float(rect.width), float(rect.height));
        fPoint leftBottom(0.0f, float(rect.height));
        fMatrix4x4 rotmat = fMatrix4x4::RotationZ(rotation);
        rightBottom = rotmat * rightBottom / screenSize;
        rightBottom += rectInProj.xy();
        rightTop = rotmat * rightTop / screenSize;
        rightTop += rectInProj.xy();
        leftBottom = rotmat * leftBottom / screenSize;
        leftBottom += rectInProj.xy();

        buffer[0].SetPosition(rectInProj.xy());
        buffer[0].SetColor(0xffffffff);
        buffer[0].SetTexcoord(fVector2(frameInProj.x, frameInProj.y));
        buffer[1].SetPosition(leftBottom);
        buffer[1].SetColor(0xffffffff);
        buffer[1].SetTexcoord(fVector2(frameInProj.x, frameInProj.y+frameInProj.height));
        buffer[2].SetPosition(rightTop);
        buffer[2].SetColor(0xffffffff);
        buffer[2].SetTexcoord(fVector2(frameInProj.x + frameInProj.width, frameInProj.y));
        buffer[3].SetPosition(leftBottom);
        buffer[3].SetColor(0xffffffff);
        buffer[3].SetTexcoord(fVector2(frameInProj.x, frameInProj.y + frameInProj.height));
        buffer[4].SetPosition(rightBottom);
        buffer[4].SetColor(0xffffffff);
        buffer[4].SetTexcoord(fVector2(frameInProj.x + frameInProj.width, frameInProj.y + frameInProj.height));
        buffer[5].SetPosition(rightTop);
        buffer[5].SetColor(0xffffffff);
        buffer[5].SetTexcoord(fVector2(frameInProj.x + frameInProj.width, frameInProj.y));
        LE_DrawManager.Draw2DFlush(GraphicsFlag::PT_TRIANGLELIST);
    }
Example #18
0
void
Draw::DrawBox(const fRect &rect, float rotation, const cColorRGBA &leftTopColor, const cColorRGBA &rightTopColor, const cColorRGBA &leftBottomColor, const cColorRGBA &rightBottomColor)
{
	VertexDraw2D *buffer = LE_DrawManager.GetVertexBuffer2D(6);
    fSize screenSize(LE_DrawManager.GetVirtualScreenSize());
    fRect rectInProj = rect / screenSize;
    fPoint rightTop(rect.width, 0.0f);
	fPoint rightBottom(rect.width, rect.height);
    fPoint leftBottom(0.0f, rect.height);
    fMatrix4x4 rotmat = fMatrix4x4::RotationZ(rotation);
    rightBottom = rotmat * rightBottom / screenSize;
    rightBottom += rectInProj.xy();
    rightTop = rotmat * rightTop / screenSize;
    rightTop += rectInProj.xy();
    leftBottom = rotmat * leftBottom / screenSize;
    leftBottom += rectInProj.xy();
    buffer[0].SetPosition(fVector3(rectInProj.xy(), 0.0f));
	buffer[0].SetColor(leftTopColor);
	buffer[0].SetTexcoord(fVector2(0.0f, 0.0f));
	buffer[1].SetPosition(fVector3(leftBottom, 0.0f));
	buffer[1].SetColor(leftBottomColor);
	buffer[1].SetTexcoord(fVector2(0.0f, 1.0f));
	buffer[2].SetPosition(fVector3(rightTop, 0.0f));
	buffer[2].SetColor(rightTopColor);
	buffer[2].SetTexcoord(fVector2(1.0f, 0.0f));
	buffer[3].SetPosition(fVector3(leftBottom, 0.0f));
	buffer[3].SetColor(leftBottomColor);
	buffer[3].SetTexcoord(fVector2(0.0f, 1.0f));
	buffer[4].SetPosition(fVector3(rightBottom, 0.0f));
	buffer[4].SetColor(rightBottomColor);
	buffer[4].SetTexcoord(fVector2(1.0f, 1.0f));
	buffer[5].SetPosition(fVector3(rightTop, 0.0f));
	buffer[5].SetColor(rightTopColor);
	buffer[5].SetTexcoord(fVector2(1.0f, 0.0f));
    DrawCommand::BindTexture(0, 0);
    LE_DrawManager.Draw2DFlush(GraphicsFlag::PT_TRIANGLELIST);
}
Example #19
0
BOOL CObject_Bus::Tick_Move(UINT uElapseTime)
{
	FLOAT fElapseTime = (FLOAT)uElapseTime / 1000.f;
	FLOAT fMoveDist = fElapseTime * GetMoveSpeed();
	FLOAT fDist = KLU_GetDist(fVector3(GetPosition().x, 0.f, GetPosition().z), fVector3(m_fvMoveTargetPos.x, 0.f, m_fvMoveTargetPos.z));
	if(fMoveDist >= fDist)
	{
		if(m_fvMoveTargetPos.y <= DEF_BUS_PATH_NODE_INVALID_Y)
		{
			SetMapPosition(fVector2(m_fvMoveTargetPos.x, m_fvMoveTargetPos.z));
		}
		else
		{
			SetPosition(m_fvMoveTargetPos);
		}
		StopMove();
	}
	else
	{
		if(fDist > 0.f)
		{
			fVector3 fvThisPos = GetPosition();
			fVector3 fvLen = m_fvMoveTargetPos - fvThisPos;
			if(m_fvMoveTargetPos.y <= DEF_BUS_PATH_NODE_INVALID_Y)
			{
				fvThisPos.x += (fvLen.x/fDist) * fMoveDist;
				fvThisPos.z += (fvLen.z/fDist) * fMoveDist;
				SetMapPosition(fVector2(fvThisPos.x, fvThisPos.z));
			}
			else
			{
				fvThisPos.x += (fvLen.x/fDist) * fMoveDist;
				fvThisPos.y += (fvLen.y/fDist) * fMoveDist;
				fvThisPos.z += (fvLen.z/fDist) * fMoveDist;
				SetPosition(fvThisPos);
			}
		}
	}

	FLOAT fFaceDir = GetFaceDir();
	if(fabsf(m_fTargetDir - fFaceDir) > 0.01f)
	{
		if(fabsf(m_fTargetDir - fFaceDir) < __PI * 5.f / 4.f
			&& fabsf(m_fTargetDir - fFaceDir) > __PI * 3.f / 4.f)
		{
			SetFaceDir(m_fTargetDir);
		}
		else
		{
			FLOAT fElapseDir = fElapseTime * __PI;
			if(m_fTargetDir - fFaceDir > __PI
				|| (m_fTargetDir - fFaceDir < 0.f && m_fTargetDir - fFaceDir > -__PI))
			{// 正转
				fFaceDir -= fElapseDir;
				if(fFaceDir < 0.f)
				{
					fFaceDir += 2.f *__PI;
				}
				SetFaceDir(fFaceDir);
			}
			else
			{// 反转
				fFaceDir += fElapseDir;
				if(fFaceDir > m_fTargetDir)
				{
					fFaceDir = m_fTargetDir;
				}
				SetFaceDir(fFaceDir);
			}
		}
	}
	return TRUE;
}
Example #20
0
uint GCNewMonsterHandler :: Execute( GCNewMonster* pPacket, Player* pPlayer ) 
{
//__ENTER_FUNCTION

	// 当前流程是主流程
	if(CGameProcedure::GetActiveProcedure() == (CGameProcedure*)CGameProcedure::s_pProcMain)
	{
		CObjectManager* pObjectManager = CObjectManager::GetMe();
		// 检查位置是否合法
		if(!CWorldManager::GetMe()->GetActiveScene()->IsValidPosition(fVector2(pPacket->getWorldPos().m_fX, pPacket->getWorldPos().m_fZ)))
		{
			KLThrow("ERROR POSITION @ GCNewMonsterHandler");
		}

		// 创建Npc
		CObject_PlayerNPC* pNPC = (CObject_PlayerNPC*)pObjectManager->FindServerObject( (INT)pPacket->getObjID() );
		fVector3 fvGame;
		CGameProcedure::s_pGfxSystem->Axis_Trans
			( tGfxSystem::AX_PLAN, fVector3(pPacket->getWorldPos().m_fX, 0.0f, pPacket->getWorldPos().m_fZ), tGfxSystem::AX_GAME, fvGame );


		// 设置位置和方向

		// 朝向
		FLOAT fFaceDir = pPacket->getDir();

		// 不存在, 创建新的
		if( pNPC == NULL )
		{
			pNPC = pObjectManager->NewPlayerNPC( (INT)pPacket->getObjID() );

			SObjectInit initPlayerNPC;

			initPlayerNPC.m_fvPos = fvGame;
			initPlayerNPC.m_fvRot = fVector3( 0.f, fFaceDir, 0.f );

			pNPC->Initial( &initPlayerNPC );

			// 20100514 AddCodeBegin 将该行放到此处,如果NPC是新进场景的,才请求详细属性
			// 放入Ask队列
			CObjectManager::GetMe()->GetLoadQueue()->TryAddLoadTask( pNPC->GetID() );
			// 20100514 AddCodeEnd

		}
		else
		{
			fVector2 mapPos(fvGame.x, fvGame.z);
			pNPC->SetMapPosition(mapPos);
			pNPC->SetFaceDir( fFaceDir );
			pNPC->Enable( OSF_VISIABLE );
			pNPC->Disalbe( OSF_OUT_VISUAL_FIELD );
		}

		// 标识为怪
		pNPC->SetNpcType( NPC_TYPE_MONSTER );
		// 设置移动速度
		pNPC->GetCharacterData()->Set_MoveSpeed( pPacket->getMoveSpeed() );
		// 设置坐骑
		pNPC->GetCharacterData()->Set_MountID( pPacket->getHorseID() );
		// 设置武器装备
		pNPC->GetCharacterData()->Set_MonstWeapon( pPacket->getWeaponID() );


		SCommand_Object cmdTemp;
		cmdTemp.m_wID			= OC_IDLE;
		cmdTemp.m_afParam[0]	= fvGame.x;
		cmdTemp.m_afParam[1]	= fvGame.z;
		cmdTemp.m_abParam[2]	= FALSE;

		pNPC->PushCommand( &cmdTemp );


		// 20100514 DeleteCodeBegin
		// 放入Ask队列
		//CObjectManager::GetMe()->GetLoadQueue()->TryAddLoadTask( pNPC->GetID() );
		// 20100514 DeleteCodeEnd


		// 同步渲染层
		char szTemp[MAX_PATH];
		_snprintf(szTemp, MAX_PATH, "GCNewMonster(%.1f,%.1f)", pPacket->getWorldPos().m_fX, pPacket->getWorldPos().m_fZ);
		pNPC->PushDebugString(szTemp);
		pNPC->SetMsgTime(CGameProcedure::s_pTimeSystem->GetTimeNow());



		// 20100415 AddCodeBegin
		// 自动寻路的NPC数据到达后向服务器发请求打开NPC对话框
		if ( CObjectManager::GetMe()->GetMySelf()->GetIsAutoNPCPath()->m_isAutoPath == TRUE &&
			 CObjectManager::GetMe()->GetMySelf()->GetIsAutoNPCPath()->m_strAutoNPCName == pNPC->GetCharacterData()->Get_Name() &&
			CGameProcedure::s_pWorldManager->GetActiveSceneID() == CObjectManager::GetMe()->GetMySelf()->GetIsAutoNPCPath()->m_nSceneID )
		{
			CObject_Character* pCharObj  = NULL;
			STRING			   strName   = CObjectManager::GetMe()->GetMySelf()->GetIsAutoNPCPath()->m_strAutoNPCName;
			pCharObj  = CObjectManager::GetMe()->FindCharacterByName( strName );

			if (  pCharObj != NULL )
			{				
				int i = pCharObj->GetServerID();
				CGameProcedure::s_pGameInterface->Player_Speak( i );

				if ( CObjectManager::GetMe()->GetMySelf()->CharacterLogic_IsStopped( CObject_Character::LOGIC_BASE ) )
				{
					CObjectManager::GetMe()->GetMySelf()->SetIsAutoNPCPath(-1, "", FALSE );
				}
			}	
	
		}
		// 20100415 AddCodeEnd

	}

	return PACKET_EXE_CONTINUE ;
}
GUI* GOFactory::CreateGUI(GameStats* p_gameStats)
{
	float fw = 1.0f/1920.0f;
	float fh = 1.0f/1080.0f;
	float scrW = GAME_FAIL;
	float scrH = GAME_FAIL;
	float guiHeight = 0.08f;
	if(m_io != NULL)
	{
		scrW = (float)m_io->getScreenWidth();
		scrH = (float)m_io->getScreenHeight();
	}

	float heightFraction = m_io->getScreenHeight() / 1080.0f;
	float widthFraction = m_io->getScreenWidth() / 1920.0f;
	int height = m_io->getScreenHeight();

	Rect guiRect(0, 0, m_io->getScreenWidth(),
		(int)(guiHeight) * m_io->getScreenHeight());

	vector<SpriteInfo*> lives;
	for (int i = 0; i < 3; i++)
	{
		fVector2 size = fVector2(50*widthFraction, 50*heightFraction);
		fVector3 pos = fVector3(1.1f * size.x * i + size.x*0.5f, height - 0.08f * height*0.5f, 0.9f); 

		Rect r;
		r.x		= 0;
		r.y		= 0;
		r.width = 39;
		r.height = 28;
		lives.push_back(CreateSpriteInfo("../Textures/life.png",
			pos, size, &r));
	}

	fVector2 size = fVector2(50/scrW, 50/scrH);
	size = fVector2(0,0);
	fVector3 pos = fVector3(0.3f, 1 - guiHeight*0.25f, 0.9f); 
	string texts = "ELAPSED TIME:    ";
	float fontSize = 32.0f;
	fVector2 fontSizeScaled(fontSize*fw, fontSize*fh); 
	MenuItem* elapsed = createMenuItem( 
			pos, fVector2( 0.0f, 0.0f ),
			texts, fVector2(0.0f, 0.0f), fontSizeScaled,"" );

	//Added by Anton

	//Par time
	pos = fVector3(0.3f, 1 - guiHeight*0.75f, 0.9f); 
	texts = "PAR TIME    :    ";
	fontSize = 32.0f;
	fontSizeScaled = fVector2(fontSize*fw, fontSize*fh); 
	MenuItem* par = createMenuItem( 
			pos, fVector2( 0.0f, 0.0f ),
			texts, fVector2(0.0f, 0.0f), fontSizeScaled,"" );

	//Score
	pos = fVector3(0.6f, 1 - guiHeight*0.25f, 0.9f); 
	texts = "SCORE      :      ";
	fontSize = 32.0f;
	fontSizeScaled = fVector2(fontSize*fw, fontSize*fh); 
	MenuItem* score = createMenuItem( 
			pos, fVector2( 0.0f, 0.0f ),
			texts, fVector2(0.0f, 0.0f), fontSizeScaled,"" );

	//Total Score
	pos = fVector3(0.6f, 1 - guiHeight*0.75f, 0.9f); 
	texts = "TOTAL SCORE:      ";
	fontSize = 32.0f;
	fontSizeScaled = fVector2(fontSize*fw, fontSize*fh); 
	MenuItem* totalscore = createMenuItem( 
			pos, fVector2( 0.0f, 0.0f ),
			texts, fVector2(0.0f, 0.0f), fontSizeScaled,"" );

	//Victory

	VictoryStruct victoryData;

	pos = fVector3(0.5f, 0.7f, 0.9f); 
	texts = "VICTORY           ";
	fontSize = 32.0f;
	fontSizeScaled = fVector2(fontSize*fw, fontSize*fh); 
	victoryData.victory = createMenuItem( 
			pos, fVector2( 0.0f, 0.0f ),
			texts, fVector2(0.0f, 0.0f), fontSizeScaled,"" );

	pos = fVector3(0.5f, 0.6f, 0.9f); 
	texts = "BASE SCORE:       ";
	fontSize = 32.0f;
	fontSizeScaled = fVector2(fontSize*fw, fontSize*fh); 
	victoryData.baseScore = createMenuItem( 
			pos, fVector2( 0.0f, 0.0f ),
			texts, fVector2(0.0f, 0.0f), fontSizeScaled,"" );

	pos = fVector3(0.5f, 0.5f, 0.9f); 
	texts = "MULTIPLIER        ";
	fontSize = 32.0f;
	fontSizeScaled = fVector2(fontSize*fw, fontSize*fh); 
	victoryData.multiplier = createMenuItem( 
			pos, fVector2( 0.0f, 0.0f ),
			texts, fVector2(0.0f, 0.0f), fontSizeScaled,"" );

	pos = fVector3(0.5f, 0.4f, 0.9f); 
	texts = "FINAL SCORE:      ";
	fontSize = 32.0f;
	fontSizeScaled = fVector2(fontSize*fw, fontSize*fh); 
	victoryData.finalScore = createMenuItem( 
			pos, fVector2( 0.0f, 0.0f ),
			texts, fVector2(0.0f, 0.0f), fontSizeScaled,"" );

	//Pause

	PauseStruct pauseData;
	pos = fVector3(0.5f, 0.7f, 0.9f); 
	texts = "GAME PAUSED";
	fontSize = 32.0f;
	fontSizeScaled = fVector2(fontSize*fw, fontSize*fh); 
	pauseData.paused = createMenuItem( 
			pos, fVector2( 0.0f, 0.0f ),
			texts, fVector2(0.0f, 0.0f), fontSizeScaled,"" );

	pos = fVector3(0.5f, 0.6f, 0.9f); 
	texts = "PRESS P TO UNPAUSE";
	fontSize = 32.0f;
	fontSizeScaled = fVector2(fontSize*fw, fontSize*fh); 
	pauseData.pressToPlay = createMenuItem( 
			pos, fVector2( 0.0f, 0.0f ),
			texts, fVector2(0.0f, 0.0f), fontSizeScaled,"" );

	//Defeat
	DefeatStruct defeatData;

	pos = fVector3(0.5f, 0.7f, 0.9f); 
	texts = "DEFEAT";
	fontSize = 32.0f;
	fontSizeScaled = fVector2(fontSize*fw, fontSize*fh); 
	defeatData.defeated = createMenuItem( 
			pos, fVector2( 0.0f, 0.0f ),
			texts, fVector2(0.0f, 0.0f), fontSizeScaled,"" );

	pos = fVector3(0.5f, 0.6f, 0.9f); 
	texts = "CONTINUE WILL COST HALF YOUR TOTAL SCORE";
	fontSize = 32.0f;
	fontSizeScaled = fVector2(fontSize*fw, fontSize*fh); 
	defeatData.cost = createMenuItem( 
			pos, fVector2( 0.0f, 0.0f ),
			texts, fVector2(0.0f, 0.0f), fontSizeScaled,"" );

	//End added by Anton

	//Press enter to continue
	ContinueStruct continueStruct;

	pos = fVector3(0.5f,0.2f,0.9f);
	texts = "PRESS ENTER TO CONTINUE!";
	fontSize = 32.0f;
	fontSizeScaled = fVector2(fontSize*fw, fontSize*fh);
	continueStruct.pressToContinue = createMenuItem(
			pos, fVector2(0,0),
			texts,fVector2(0,0), fontSizeScaled,"" );

	pos = fVector3(0.5f,0.2f,0.9f);
	texts = "PRESS ENTER TO CONTINUE OR ESC TO QUIT!";
	fontSize = 32.0f;
	fontSizeScaled = fVector2(fontSize*fw, fontSize*fh);
	continueStruct.pressToEnd = createMenuItem(
			pos, fVector2(0,0),
			texts,fVector2(0,0), fontSizeScaled,"" );


	// Item slots: Speed and Bomb.
	pos		= fVector3(1 - 350/1920.0f, 1 - guiHeight*0.5f, 0.9f);
	size	= fVector2(64*widthFraction, 64*heightFraction);
	string ytext = "Z";
	MenuItem* y = createMenuItem( 
			pos, fVector2( 0.0f, 0.0f ),
			ytext, fVector2(0.0f, 0.0f), fontSizeScaled,"" );

	pos = fVector3((1920-300)*widthFraction, height - 0.08f * height*0.5f, 0.9f); 
	SpriteInfo* bomb = CreateSpriteInfo("../Textures/buffguislot.png",
		pos, size, NULL);

	pos.z = pos.z + 0.01f;
	SpriteInfo* speedIcon = CreateSpriteInfo("../Textures/speedpowerup.png", pos,size,NULL);

	pos = fVector3(1 - 200/1920.0f, 1 - guiHeight*0.5f, 0.9f); 
	string xtext = "X";
	MenuItem* x = createMenuItem( 
			pos, fVector2( 0.0f, 0.0f ),
			xtext, fVector2(0.0f, 0.0f), fontSizeScaled,"" );
	
	pos = fVector3((1920-150)*widthFraction, height - 0.08f * height * 0.5f, 0.9f);
	SpriteInfo* speed = CreateSpriteInfo("../Textures/itemguislot.png",
		pos, size, NULL);

	pos.z = pos.z + 0.01f;
	SpriteInfo* bombIcon = CreateSpriteInfo("../Textures/bombitem.png",pos,size,NULL);

	return new GUI(	p_gameStats, lives, elapsed, score, par, totalscore, victoryData, 
					pauseData, defeatData, x, y, speed, bomb, bombIcon, speedIcon, 
					continueStruct);
}
uint GCNewPlayerHandler :: Execute( GCNewPlayer* pPacket, Player* pPlayer ) 
{
//__ENTER_FUNCTION

	//当前流程是主流程
	if(CGameProcedure::GetActiveProcedure() == (CGameProcedure*)CGameProcedure::s_pProcMain)
	{
		CObjectManager* pObjectManager = CObjectManager::GetMe();
		//检查位置是否合法
		if(!CWorldManager::GetMe()->GetActiveScene()->IsValidPosition(fVector2(pPacket->getWorldPos().m_fX, pPacket->getWorldPos().m_fZ)))
		{
			TDThrow("ERROR POSITION @ GCNewPlayerHandler");
		}

		//创建玩家
		CObject_PlayerOther* pOther = (CObject_PlayerOther*)(pObjectManager->FindServerObject( (INT)pPacket->getObjID()));
		fVector3 fvGame;
		CGameProcedure::s_pGfxSystem->Axis_Trans(
			CRenderSystem::AX_PLAN, fVector3(pPacket->getWorldPos().m_fX, 0.0f, pPacket->getWorldPos().m_fZ),
			CRenderSystem::AX_GAME, fvGame);

		FLOAT fFaceDir = pPacket->getDir();

		if ( pOther == NULL )
		{
			pOther = pObjectManager->NewPlayerOther( (INT)pPacket->getObjID() );

			SObjectInit initPlayerOther;
			initPlayerOther.m_fvPos	= fvGame;
			initPlayerOther.m_fvRot = fVector3( 0.f, fFaceDir, 0.f );
			pOther->Initial( &initPlayerOther );

			fVector2 mapPos(fvGame.x, fvGame.z);
			pOther->SetMapPosition( mapPos );
		}
		else
		{
			fVector2 mapPos(fvGame.x, fvGame.z);
			pOther->SetMapPosition( mapPos );
			pOther->SetFaceDir( fFaceDir );
			pOther->Enable( OSF_VISIABLE );
			pOther->Disalbe( OSF_OUT_VISUAL_FIELD );
		}

		//更新装备信息
		pOther->GetCharacterData()->Set_EquipVer(pPacket->getEquipVer());

		pOther->GetCharacterData()->Set_MoveSpeed(pPacket->getMoveSpeed());

		////激活鼠标查询
		//if(pOther->GetRenderInterface())
		//{
		//	pOther->Enable(OSF_RAY_QUERY);
		//}

		SCommand_Object cmdTemp;
		cmdTemp.m_wID			= OC_IDLE;
		cmdTemp.m_afParam[0]	= fvGame.x;
		cmdTemp.m_afParam[1]	= fvGame.z;
		cmdTemp.m_abParam[2]	= FALSE;
		pOther->PushCommand(&cmdTemp );

		//放入Ask队列
		CObjectManager::GetMe()->GetLoadQueue()->TryAddLoadTask(pOther->GetID(), CObject_Character::CT_PLAYEROTHER);

		// tempcode{
		// 此版不做服务器繁忙客户端延后发消息的处理
//		CGCharAskBaseAttrib msgAskBaseAttrib;
//		msgAskBaseAttrib.setTargetID( (INT)pPacket->getObjID() );
//		CNetManager::GetMe()->SendPacket( &msgAskBaseAttrib );

		//AxTrace(0, 0, "[%d]Ask %d", m_hmObject.size(), pPacket->getObjID());
		// }

		//如果是自己,退出死亡效果
		if(pOther == (CObject_PlayerOther*)pObjectManager->GetMySelf())
		{
			CGameProcedure::s_pGfxSystem->Scene_SetPostFilter_Death(FALSE);
		}

		pOther->PushDebugString("GCNewPlayer");
		pOther->SetMsgTime(CGameProcedure::s_pTimeSystem->GetTimeNow());
	}

	return PACKET_EXE_CONTINUE ;

//__LEAVE_FUNCTION

	return PACKET_EXE_ERROR ;
}
Example #23
0
BOOL CObject_Dynamic::DoMove( FLOAT fElapseTime, FLOAT fSpeed )
{
	const fVector3* pRrePos = GetPrevPathNode();
	if ( m_listPathNode.empty() )
		return FALSE;

	// 当前位置
	fVector3 fvCurPos = GetPosition();
	// 当前的目标路径点
	fVector3 fvBeginPathNode = (*m_listPathNode.begin());

	// 当前位置与当前的目标路径点的距离
	fVector3 fvDistToBeginPathNode = fvBeginPathNode - fvCurPos;
	FLOAT fDir = GetFaceDir();

	// 这一帧可移动的路径长度
	FLOAT fMoveDist = fSpeed * fElapseTime;
	FLOAT fMoveDistSq = fMoveDist * fMoveDist;

	// 当前位置与当前的目标路径点路径长度的平方
	FLOAT fDistToBeginPathNodeSq = fvDistToBeginPathNode.x * fvDistToBeginPathNode.x + fvDistToBeginPathNode.z * fvDistToBeginPathNode.z;

	// 如果这一帧可移动的路径长度小于当前位置到当前的目标路径点路径长度
	if ( fDistToBeginPathNodeSq > fMoveDistSq )
	{
		FLOAT fTarDist = sqrt(fDistToBeginPathNodeSq) ;
		FLOAT fDistX = (fMoveDist*(fvBeginPathNode.x-fvCurPos.x))/fTarDist ;
		FLOAT fDistZ = (fMoveDist*(fvBeginPathNode.z-fvCurPos.z))/fTarDist ;
		
		
		fVector2 fvPos;
		fvPos.x = fvCurPos.x + fDistX;
		fvPos.y = fvCurPos.z + fDistZ;
		
		//需要位置修正,防止因为误差走入阻挡区内部
		if( CObjectManager::GetMe()->GetMySelf() == this && CPath::IsPointInUnreachRegion(fvPos))
		{
			fvPos = TDU_GetReflect(
						fVector2(pRrePos->x, pRrePos->z),
						fVector2(fvBeginPathNode.x, fvBeginPathNode.z),
						fvPos);//

		}

		SetMapPosition( fvPos );
	}
	else
	{
		fVector2 fvPos;
		// 目标路径是最后一点
		if ( !NextPathNode() )
		{
			fvPos.x = fvBeginPathNode.x;
			fvPos.y = fvBeginPathNode.z;
			//需要位置修正,防止因为误差走入阻挡区内部
			if( CObjectManager::GetMe()->GetMySelf() == this && CPath::IsPointInUnreachRegion(fvPos))
			{
				//行走路线的镜像点, 点pRrePos 与 fvBeginPathNode不能是同一个点
				fvPos = TDU_GetReflect(
							fVector2(pRrePos->x, pRrePos->z),
							fVector2(fvBeginPathNode.x, fvBeginPathNode.z),
							fvPos);//
			}

			SetMapPosition( fvPos );
			OnMoveStop( );
		}
		else
		{
			FLOAT fDistToBeginPathNode = sqrt( fDistToBeginPathNodeSq );
			fMoveDist -= fDistToBeginPathNode;

			fvPos.x = fvBeginPathNode.x;
			fvPos.y = fvBeginPathNode.z;
			SetMapPosition( fvPos );
			CalcMoveDir();
			fDir = GetFaceDir();

			FLOAT fDistX = sin( fDir ) * fMoveDist;
			FLOAT fDistZ = cos( fDir ) * fMoveDist;
			fvCurPos = fvBeginPathNode;
			fvPos.x = fvCurPos.x + fDistX;
			fvPos.y = fvCurPos.z + fDistZ;
			
			//需要位置修正,防止因为误差走入阻挡区内部
			if( CObjectManager::GetMe()->GetMySelf() == this && CPath::IsPointInUnreachRegion(fvPos))
			{
				// 得到新的映射向量
				pRrePos = GetPrevPathNode();
				fvBeginPathNode = (*m_listPathNode.begin());

				//行走路线的镜像点, 点pRrePos 与 fvBeginPathNode不能是同一个点
				fvPos = TDU_GetReflect(
							fVector2(pRrePos->x, pRrePos->z),
							fVector2(fvBeginPathNode.x, fvBeginPathNode.z),
							fvPos);//

			}//
			
			SetMapPosition( fvPos );
		}

//		RegisterToZone();
	}
	return TRUE;
}
Example #24
0
fVector2 CCreatureBoard::GetPosition(void) const
{
	CEGUI::Point pt = CEGUI::PropertyHelper::stringToPoint(m_pNameWindow->getProperty( "FitPosition" ));

	return fVector2(pt.d_x, pt.d_y);
}
VOID CActionItem_Skill::DoAction( VOID )
{
	// 获取将使用的技能
	const SCLIENT_SKILL* pSkill = GetSkillImpl();
	if( !pSkill )
		return;

	INT idUser = -1;
	CObject_PlayerMySelf *pMySelf = CObjectManager::GetMe()->GetMySelf();
	if( !pMySelf )
		return; 

	idUser = pMySelf->GetID();	
	
	// 自动打怪,连续施放的技能
	if (TRUE == pSkill->m_pDefine->m_bAutoRedo)
	{
		tActionItem* pItem = CGameInterface::GetMe()->Skill_GetActive();
		// 有激活技能
		if (pItem)
		{
			// 当前技能正在激活中
			if (pItem->GetID() == GetID())
			{
				// 此次操作为关闭操作
				CGameInterface::GetMe()->Skill_SetActive( CActionSystem::GetMe()->GetMyDefaultSkillAtion() );
				
				// 关闭自动打怪
				CAI_MySelf* pMySelfAI = (CAI_MySelf*)( pMySelf->CharacterLogic_GetAI() );
				if( pMySelfAI )
					pMySelfAI->m_bCurrSkill  = FALSE;			

				return;
			}
			else
			{
				// 选中状态
				AutoKeepOn();
			}
		}
		// 没有激活技能
		else
		{
			// 选中状态
			AutoKeepOn();
		}
	}
	// 单次施放的技能
	else
	{
		// 瞬发技能不会打断自动技能
		if (FALSE == pSkill->m_pDefine->m_nImmediately)
		{
			CAI_MySelf* pMySelfAI = (CAI_MySelf*)( pMySelf->CharacterLogic_GetAI() );
			if( pMySelfAI )
				pMySelfAI->m_bCurrSkill  = FALSE;
		}		
	}

	// 进行技能使用的条件判断
	// 是否学会、冷却时间、消耗
	{

		ORESULT oResult;
		// 是否已经学会
		oResult = pSkill->IsCanUse_Leaned();
		if( OR_FAILED( oResult ) )
		{
			CGameProcedure::s_pEventSystem->PushEvent( GE_NEW_DEBUGMESSAGE, GetOResultText( oResult ) );
			return ;
		}

		// 检查冷却是否结束
		oResult = pSkill->IsCanUse_CheckCoolDown();
		if( OR_FAILED( oResult ) )
		{
			CGameProcedure::s_pEventSystem->PushEvent( GE_NEW_DEBUGMESSAGE, GetOResultText( oResult ) );
			return ;
		}

		// 消耗检测
		oResult = pSkill->IsCanUse_CheckDeplete( idUser );
		if( OR_FAILED( oResult ) )
		{
			CGameProcedure::s_pEventSystem->PushEvent( GE_NEW_DEBUGMESSAGE, GetOResultText( oResult ) );
			return ;
		}

	}


	//================
	// 根据鼠标选择操作类型
	switch( pSkill->m_pDefine->m_nSelectType )	// 此类型从表中读出
	{
	case SELECT_TYPE_NONE:	// 无需选择,直接施放(以自己为中心的范围自动攻击)
		{
			// id,位置,方向
			CGameProcedure::s_pGameInterface->Player_UseSkill(GetID(), fVector2(pMySelf->GetPosition().x, pMySelf->GetPosition().z), pMySelf->GetFaceDir());

			// 恢复激活Action
			CActionSystem::GetMe()->SetDefaultAction(CGameProcedure::s_pGameInterface->Skill_GetActive());
		}
		break;

	case SELECT_TYPE_CHARACTER:	// 选择角色
		{
			// 有无选择主目标
			if( CObjectManager::GetMe()->GetMainTarget() )
			{
				// id,目标id
				CGameProcedure::s_pGameInterface->Player_UseSkill(GetID(), CObjectManager::GetMe()->GetMainTarget()->GetServerID());
			}
			else
			{
				// 无选择目标提示信息
				CGameProcedure::s_pEventSystem->PushEvent( GE_NEW_DEBUGMESSAGE, GetOResultText( OR_NO_TARGET ) );
			}

			// 恢复激活Action
			CActionSystem::GetMe()->SetDefaultAction(CGameProcedure::s_pGameInterface->Skill_GetActive());
		}
		break;

	case SELECT_TYPE_POS:	// 以鼠标的位置为中心的范围攻击
		{
			// id,
			//CGameProcedure::s_pGameInterface->Player_UseSkill(GetID(), fVector2(pMySelf->GetPosition().x, pMySelf->GetPosition().z), pMySelf->GetFaceDir());

			// 恢复激活Action
			CActionSystem::GetMe()->SetDefaultAction(this);
		}
		break;

	case SELECT_TYPE_DIR:	// 方向(扇形)

		// 人物的方向技能使用
		//CGameProcedure::s_pGameInterface->Player_UseSkill(GetID(), fVector2(pMySelf->GetPosition().x, pMySelf->GetPosition().z), pMySelf->GetFaceDir());

		CActionSystem::GetMe()->SetDefaultAction(CGameProcedure::s_pGameInterface->Skill_GetActive());
		break;

	case SELECT_TYPE_SELF:	// 对自己进行操作	
		{
			CGameProcedure::s_pGameInterface->Player_UseSkill(GetID(), CObjectManager::GetMe()->GetMySelf()->GetServerID());
			// 恢复激活Action
			CActionSystem::GetMe()->SetDefaultAction(CGameProcedure::s_pGameInterface->Skill_GetActive());
		}
		break;

	case SELECT_TYPE_HUMAN_GUID:	// 其他玩家
		{
			// 当前是否已经选择了一个队友
			GUID_t guid;
			CObjectManager::GetMe()->GetMainTarget(guid);
			if(guid == (GUID_t)-1)
			{
				// 尚未选择合法的对象
				STRING strTemp = NOCOLORMSGFUNC("GMDP_Struct_Skill_Info_Invalidate_Target");
				CEventSystem::GetMe()->PushEvent(GE_NEW_DEBUGMESSAGE, strTemp.c_str());
				return;
			}

			CGameProcedure::s_pGameInterface->Player_UseSkill(GetID(), (GUID_t)guid);
			// 恢复激活Action
			CActionSystem::GetMe()->SetDefaultAction(CGameProcedure::s_pGameInterface->Skill_GetActive());
		}
		break;
	}
}
uint GCNewPet_MoveHandler::Execute( GCNewPet_Move* pPacket, Player* pPlayer ) 
{
	//当前流程是主流程
	if(CGameProcedure::GetActiveProcedure() == (CGameProcedure*)CGameProcedure::s_pProcMain)
	{
		CObjectManager* pObjectManager = CObjectManager::GetMe();

		//检查位置是否合法
		if(!CWorldManager::GetMe()->GetActiveScene()->IsValidPosition(fVector2(pPacket->getWorldPos().m_fX, pPacket->getWorldPos().m_fZ)))
		{
			TDThrow("ERROR POSITION @ GCNewMonster_MoveHandler");
		}
		if(!CWorldManager::GetMe()->GetActiveScene()->IsValidPosition(fVector2(pPacket->getTargetPos().m_fX, pPacket->getTargetPos().m_fZ)))
		{
			TDThrow("ERROR POSITION @ GCNewMonster_MoveHandler target");
		}

		//创建玩家
		CObject_PlayerNPC* pNPC = (CObject_PlayerNPC*)pObjectManager->FindServerObject( (INT)pPacket->getObjID() );
		fVector3 fvGame;
		CGameProcedure::s_pGfxSystem->Axis_Trans(
			CRenderSystem::AX_PLAN, fVector3(pPacket->getWorldPos().m_fX, 0.0f, pPacket->getWorldPos().m_fZ),
			CRenderSystem::AX_GAME, fvGame);

		if ( pNPC == NULL )
		{
			pNPC = pObjectManager->NewPlayerNPC( (INT)pPacket->getObjID() );

			SObjectInit initPlayerNPC;
			initPlayerNPC.m_fvPos	= fvGame;
			initPlayerNPC.m_fvRot	= fVector3( 0.f, 0.f, 0.f );

			pNPC->Initial( &initPlayerNPC );
		}
		else
		{
			fVector2 mapPos(fvGame.x, fvGame.z);
			pNPC->SetMapPosition(mapPos);
			pNPC->Enable( OSF_VISIABLE );
			pNPC->Disalbe( OSF_OUT_VISUAL_FIELD );
		}
		pNPC->SetNpcType(NPC_TYPE_PET);

		pNPC->GetCharacterData()->Set_MoveSpeed(pPacket->getMoveSpeed());

		// move to command
		{
			WORLD_POS posTarget;
			posTarget.m_fX	= pPacket->getTargetPos().m_fX;
			posTarget.m_fZ	= pPacket->getTargetPos().m_fZ;

			SCommand_Object cmdTemp;
			cmdTemp.m_wID			= OC_MOVE;
			cmdTemp.m_auParam[0]	= 0;
			cmdTemp.m_anParam[1]	= pPacket->getHandleID();
			cmdTemp.m_anParam[2]	= 1;
			cmdTemp.m_apParam[3]	= &posTarget;
			pNPC->PushCommand(&cmdTemp );
		}

		//放入Ask队列
		CObjectManager::GetMe()->GetLoadQueue()->TryAddLoadTask(pNPC->GetID(), CObject_Character::CT_MONSTER);

		// tempcode{
		// 此版不做服务器繁忙客户端延后发消息的处理
//		CGCharAskBaseAttrib msgAskBaseAttrib;
//		msgAskBaseAttrib.setTargetID( (INT)pPacket->getObjID() );
//		CNetManager::GetMe()->SendPacket( &msgAskBaseAttrib );

		// }


		//同步渲染层
		char szTemp[MAX_PATH];
		_snprintf(szTemp, MAX_PATH, "GCNewPet_Move(%.1f,%.1f)", 
			pPacket->getWorldPos().m_fX, pPacket->getWorldPos().m_fZ);
		pNPC->PushDebugString(szTemp);
		pNPC->SetMsgTime(CGameProcedure::s_pTimeSystem->GetTimeNow());
	}

	return PACKET_EXE_CONTINUE ;
}
Example #27
0
namespace LimitEngine {
    fVector2 fVector2::ZERO = fVector2(0.0f, 0.0f);
}
Example #28
0
VOID CCursorMng::MouseCommand_Set( BOOL bHoverInUI, CObject* pSelectObj, const fVector3& fvPos, tActionItem* pActiveSkill )
{
    m_cmdCurrent_Left.m_typeMouse	= SCommand_Mouse::MCT_NULL;
    m_cmdCurrent_Right.m_typeMouse	= SCommand_Mouse::MCT_NULL;


    // 在UI上空
    if(bHoverInUI)
    {
        if(!pActiveSkill)
            return;

        switch(pActiveSkill->GetType())
        {
        // 修理装备
        case AOT_MOUSECMD_REPARE:
        {
            //左键挂锤子
            m_cmdCurrent_Left.m_typeMouse  = SCommand_Mouse::MCT_REPAIR;
            //右键取消
            m_cmdCurrent_Right.m_typeMouse = SCommand_Mouse::MCT_CANCLE_REPAIR;
        }
        break;

        //鉴定装备
        case AOT_MOUSECMD_IDENTIFY:
        {
            //左键鉴定
            m_cmdCurrent_Left.m_typeMouse  = SCommand_Mouse::MCT_UI_USE_IDENTIFY;
            //右键取消
            m_cmdCurrent_Right.m_typeMouse = SCommand_Mouse::MCT_UI_USE_CANCEL_IDENTIFY;
        }
        break;
        }
    }
    else
    {
        // 判断鼠标下有无选择对象来计算相应obj鼠标指令
        if( pSelectObj != NULL )
        {
            pSelectObj->FillMouseCommand_Left( &m_cmdCurrent_Left, pActiveSkill );
            pSelectObj->FillMouseCommand_Right( &m_cmdCurrent_Right, pActiveSkill );
        }
        else
        {
            if( !pActiveSkill )
            {
                // 如果鼠标下没有相应的对象, 就当作移动来处理, 改掉了必须要有个默认技能才能走路得问题
                m_cmdCurrent_Left.m_typeMouse = SCommand_Mouse::MCT_PLAYER_MOVETO;
                m_cmdCurrent_Left.m_afParam[0] = fvPos.x;
                m_cmdCurrent_Left.m_afParam[1] = fvPos.z;
            }

        }

        if( m_cmdCurrent_Left.m_typeMouse == SCommand_Mouse::MCT_NULL )
        {
            // 当前存在激活的技能
            if( pActiveSkill != NULL )
            {
                // 根据技能的类型设置鼠标行为
                switch( pActiveSkill->GetType() )
                {
                // 技能 和 宠物技能
                case AOT_SKILL:
                case AOT_PET_SKILL:
                {
                    const void* pSkillImpl = pActiveSkill->GetImpl();

                    // 不存在内部数据就设为行走状态
                    if( !pSkillImpl )
                    {
                        m_cmdCurrent_Left.m_typeMouse = SCommand_Mouse::MCT_PLAYER_MOVETO;
                        m_cmdCurrent_Left.m_afParam[0] = fvPos.x;
                        m_cmdCurrent_Left.m_afParam[1] = fvPos.z;

                        return;
                    }

                    // 根据是否为战斗技能处理是人物(或宠物)的技能选择类型
                    ENUM_SELECT_TYPE typeSel = (ENUM_SELECT_TYPE)(	pActiveSkill->GetType() == AOT_SKILL ?
                                               ((SCLIENT_SKILL*)pSkillImpl)->m_pDefine->m_nSelectType :	// 人物技能
                                               ((PET_SKILL*)pSkillImpl)->m_pDefine->m_nSelectType );		// 宠物技能

                    // 技能使用的鼠标选择逻辑
                    switch( typeSel )
                    {
                    // 点选角色
                    case SELECT_TYPE_CHARACTER:
                    {
                        m_cmdCurrent_Left.m_typeMouse = SCommand_Mouse::MCT_PLAYER_MOVETO;
                        m_cmdCurrent_Left.m_afParam[0] = fvPos.x;
                        m_cmdCurrent_Left.m_afParam[1] = fvPos.z;
                    }
                    break;

                    // 点选范围
                    case SELECT_TYPE_POS:
                    {
                        // 储存技能
                        m_cmdCurrent_Left.m_typeMouse = SCommand_Mouse::MCT_SKILL_AREA;		// 在自动技能时被改为 SCommand_Mouse::MCT_PLAYER_MOVETO;
                        m_cmdCurrent_Left.m_apParam[0] = (VOID*)pActiveSkill;
                        m_cmdCurrent_Left.m_afParam[1] = fvPos.x;
                        m_cmdCurrent_Left.m_afParam[2] = fvPos.z;
                    }
                    break;

                    // 方向
                    case SELECT_TYPE_DIR:
                    {
                        // 储存技能
                        m_cmdCurrent_Left.m_typeMouse = SCommand_Mouse::MCT_SKILL_DIR;	// 在自动技能时被改为 SCommand_Mouse::MCT_PLAYER_MOVETO;
                        m_cmdCurrent_Left.m_apParam[0] = (VOID*)pActiveSkill;

                        //====== 计算方向

                        // 主角位置
                        fVector3 fvPlayer = CObjectManager::GetMe()->GetMySelf()->GetPosition();
                        // 鼠标位置
                        fVector3 fvTarget = fvPos;

                        m_cmdCurrent_Left.m_afParam[1] = KLU_GetYAngle(fVector2(fvPlayer.x, fvPlayer.z), fVector2(fvTarget.x, fvTarget.z));
                    }
                    break;

                    case SELECT_TYPE_SELF:
                        // ERROR...
                        break;
                    }
                }
                break;

                // 物品
                case AOT_ITEM:
                {
                    if(!pActiveSkill || pActiveSkill->GetType() != AOT_ITEM)
                        break;

                    CObject_Item* pItem = (CObject_Item*)(((CActionItem_Item*)pActiveSkill)->GetItemImpl());
                    if(!pItem)
                        break;

                    // 必须是能够使用的物品
                    if(pItem->GetItemClass() != ICLASS_COMITEM)
                        break;

                    BOOL bAreaItem = ((CObject_Item_Medicine*)pItem)->IsAreaTargetType();

                    m_cmdCurrent_Left.m_typeMouse = SCommand_Mouse::MCT_USE_ITEM;
                    m_cmdCurrent_Left.m_apParam[0] = (VOID*)pActiveSkill;
                    m_cmdCurrent_Left.m_adwParam[1] = -1;
                    m_cmdCurrent_Left.m_afParam[2] = fvPos.x;
                    m_cmdCurrent_Left.m_afParam[3] = fvPos.z;
                    m_cmdCurrent_Left.m_adwParam[4] = bAreaItem;

                    m_cmdCurrent_Right.m_typeMouse = SCommand_Mouse::MCT_CANCEL_USE_ITEM;
                }
                break;

                // 修理单独处理
                case AOT_MOUSECMD_REPARE:
                {
                    //左键挂锤子
                    m_cmdCurrent_Left.m_typeMouse  = SCommand_Mouse::MCT_REPAIR;
                    //右键取消
                    m_cmdCurrent_Right.m_typeMouse = SCommand_Mouse::MCT_CANCLE_REPAIR;
                }
                break;

                // 鉴定装备
                case AOT_MOUSECMD_IDENTIFY:
                {
                    //左键鉴定
                    m_cmdCurrent_Left.m_typeMouse  = SCommand_Mouse::MCT_UI_USE_IDENTIFY;
                    //右键取消
                    m_cmdCurrent_Right.m_typeMouse = SCommand_Mouse::MCT_UI_USE_CANCEL_IDENTIFY;
                }
                break;

                // 添加好友
                case AOT_MOUSECMD_ADDFRIEND:
                {
                    m_cmdCurrent_Left.m_typeMouse = SCommand_Mouse::MCT_ADD_FRIEND;
                }
                break;

                default:
                    // 移动
                {
                    m_cmdCurrent_Left.m_typeMouse = SCommand_Mouse::MCT_PLAYER_MOVETO;
                    m_cmdCurrent_Left.m_afParam[0] = fvPos.x;
                    m_cmdCurrent_Left.m_afParam[1] = fvPos.z;
                }
                break;
                }
            }
        }

        // 跳跃 //好像都不太喜欢右键跳跃,忍痛割爱了
        /*if( m_cmdCurrent_Right.m_typeMouse == SCommand_Mouse::MCT_NULL )
        {
        	m_cmdCurrent_Right.m_typeMouse = SCommand_Mouse::MCT_PLAYER_JUMP;
        }*/
    }
}
uint GCNewPlayer_MoveHandler :: Execute( GCNewPlayer_Move* pPacket, Player* pPlayer ) 
{
//__ENTER_FUNCTION
	//AxTrace(0, 2, "GCNewPlayerHandler");
//	return PACKET_EXE_CONTINUE ;

	//当前流程是主流程
	if(CGameProcedure::GetActiveProcedure() == (CGameProcedure*)CGameProcedure::s_pProcMain)
	{
		CObjectManager* pObjectManager = CObjectManager::GetMe();

		//检查位置是否合法
		if(!CWorldManager::GetMe()->GetActiveScene()->IsValidPosition(fVector2(pPacket->getWorldPos().m_fX, pPacket->getWorldPos().m_fZ)))
		{
			TDThrow("ERROR POSITION @ GCNewPlayer_MoveHandler");
		}

		//创建玩家
		CObject_PlayerOther* pOther = (CObject_PlayerOther*)(pObjectManager->FindServerObject( (INT)pPacket->getObjID() ));
		fVector3 fvGame;
		CGameProcedure::s_pGfxSystem->Axis_Trans(
			CRenderSystem::AX_PLAN, fVector3(pPacket->getWorldPos().m_fX, 0.0f, pPacket->getWorldPos().m_fZ),
			CRenderSystem::AX_GAME, fvGame);

		if ( pOther == NULL )
		{
			pOther = pObjectManager->NewPlayerOther( (INT)pPacket->getObjID() );

			SObjectInit initPlayerOther;
			initPlayerOther.m_fvPos	= fvGame;

			pOther->Initial( &initPlayerOther );
		}
		else
		{
			fVector2 mapPos(fvGame.x, fvGame.z);
			pOther->SetMapPosition(mapPos);
			pOther->Enable( OSF_VISIABLE );
			pOther->Disalbe( OSF_OUT_VISUAL_FIELD );
		}

		////激活鼠标查询
		//if(pOther->GetRenderInterface())
		//{
		//	pOther->Enable(OSF_RAY_QUERY);
		//}

		//更新装备信息
		pOther->GetCharacterData()->Set_EquipVer(pPacket->getEquipVer());
		//跟新移动速度
		pOther->GetCharacterData()->Set_MoveSpeed(pPacket->getMoveSpeed());

		// move to command
		{
			WORLD_POS posTarget;
			posTarget.m_fX	= pPacket->getTargetPos().m_fX;
			posTarget.m_fZ	= pPacket->getTargetPos().m_fZ;

			SCommand_Object cmdTemp;
			cmdTemp.m_wID			= OC_MOVE;
			cmdTemp.m_auParam[0]	= 0;
			cmdTemp.m_anParam[1]	= pPacket->getHandleID();
			cmdTemp.m_anParam[2]	= 1;
			cmdTemp.m_apParam[3]	= &posTarget;
			pOther->PushCommand(&cmdTemp );
		}

		//放入Ask队列
		CObjectManager::GetMe()->GetLoadQueue()->TryAddLoadTask(pOther->GetID(), CObject_Character::CT_PLAYEROTHER);

		// tempcode{
		// 此版不做服务器繁忙客户端延后发消息的处理
//		CGCharAskBaseAttrib msgAskBaseAttrib;
//		msgAskBaseAttrib.setTargetID( (INT)pPacket->getObjID() );
//		CNetManager::GetMe()->SendPacket( &msgAskBaseAttrib );

		//AxTrace(0, 0, "[%d]Ask %d", m_hmObject.size(), pPacket->getObjID());
		// }

		pOther->PushDebugString("GCNewPlayer");
		pOther->SetMsgTime(CGameProcedure::s_pTimeSystem->GetTimeNow());
	}

	return PACKET_EXE_CONTINUE ;

//__LEAVE_FUNCTION

	return PACKET_EXE_ERROR ;
//__ENTER_FUNCTION
//	AxTrace(0, 2, "GCNewPlayerHandler");
//
//	//当前流程是主流程
//	if(CGameProcedure::GetActiveProcedure() == (CGameProcedure*)CGameProcedure::s_pProcMain)
//	{
//		CObjectManager* pObjectManager = CObjectManager::GetMe();
//
//		//创建玩家
//		CObject_PlayerOther* pOther = pObjectManager->CreatePlayerOther(
//											(INT)pPacket->getObjID(),
//											(INT)pPacket->getRace(),
//											pPacket->getEquipVer(),
//											fVector2(pPacket->getWorldPos().m_fX, pPacket->getWorldPos().m_fZ),
//											true);
//
//		if(!pOther) return PACKET_EXE_CONTINUE;
//
//		//设置新的位置
//		pOther->SetMapPosition(fVector2(pPacket->getWorldPos().m_fX, pPacket->getWorldPos().m_fZ));
//		pOther->RegisterToZone();
//		//IDLE装态
//		pOther->SetMotionStatus(CMS_STATUS_IDLE);
//		pOther->PushDebugString("GCNewPlayer");
//		pOther->SetMsgTime(CGameProcedure::s_pTimeSystem->GetTimeNow());
//	}
//
//	return PACKET_EXE_CONTINUE ;
//
//__LEAVE_FUNCTION
//
//	return PACKET_EXE_ERROR ;
}
Example #30
0
// 激活当前鼠标上挂接的命令
VOID CCursorMng::MouseCommand_Active(SCommand_Mouse& cmd)
{
    CGameProcedure::s_pGameInterface->SetAutoPathNPC(-1,"");
    switch(cmd.m_typeMouse)
    {
    case SCommand_Mouse::MCT_PLAYER_MOVETO:
    {
        static UINT uPrevMoveTime = 0;
        if(CGameProcedure::s_pTimeSystem->GetTimeNow() > uPrevMoveTime + 100)
        {
            uPrevMoveTime = CGameProcedure::s_pTimeSystem->GetTimeNow();
            CGameProcedure::s_pGameInterface->Player_MoveTo( fVector2( cmd.m_afParam[0], cmd.m_afParam[1] ) );
        }
    }
    break;

    case SCommand_Mouse::MCT_PLAYER_SELECT:
    {
        //
        CGameProcedure::s_pGameInterface->Object_SelectAsMainTarget((INT)cmd.m_adwParam[0], 1);

        if(	m_cmdCurrent_Left.m_typeMouse == SCommand_Mouse::MCT_SKILL_DIR ||
                m_cmdCurrent_Left.m_typeMouse == SCommand_Mouse::MCT_SKILL_AREA)
        {
            m_cmdCurrent_Left.m_typeMouse = SCommand_Mouse::MCT_NULL;
            m_cmdCurrent_Left.m_apParam[0] = NULL;
            m_cmdCurrent_Left.m_afParam[1] = NULL;

            // 恢复激活技能
            CActionSystem::GetMe()->SetDefaultAction(CGameProcedure::s_pGameInterface->Skill_GetActive());
        }
    }
    break;

    // 对单一对象使用技能
    case SCommand_Mouse::MCT_SKILL_OBJ:
    {
        // 首先选择目标
        CGameProcedure::s_pGameInterface->Object_SelectAsMainTarget((INT)cmd.m_adwParam[1], 2);

        tActionItem* pItem = (tActionItem*)cmd.m_apParam[0];
        if( !pItem )
            break;

        // 宠物攻击
        //if( pItem->GetType() == AOT_PET_SKILL )
        //{
        //	int nPetSkillID = ((PET_SKILL*)(((CActionItem_PetSkill*)pItem)->GetImpl()))->m_pDefine->m_nID;
        //	CDataPool::GetMe()->Pet_SendUseSkillMessage(nPetSkillID, INVALID_ID, cmd.m_afParam[1], cmd.m_afParam[2]);
        //}
        //// 玩家攻击
        //else
        {
            CGameProcedure::s_pGameInterface->Player_UseSkill(((tActionItem*)cmd.m_apParam[0])->GetID(), (INT)cmd.m_adwParam[1]);
        }
    }
    break;

    // 对某个范围使用技能
    case SCommand_Mouse::MCT_SKILL_AREA:
    {
        tActionItem* pItem = (tActionItem*)cmd.m_apParam[0];
        if( !pItem )
            break;

        if( pItem->GetType() == AOT_PET_SKILL )
        {
            int nPetSkillID = ((PET_SKILL*)(((CActionItem_PetSkill*)pItem)->GetImpl()))->m_pDefine->m_nID;
            CDataPool::GetMe()->Pet_SendUseSkillMessage(nPetSkillID, INVALID_ID, cmd.m_afParam[1], cmd.m_afParam[2]);
        }
        else
        {
            CGameProcedure::s_pGameInterface->Player_UseSkill(((tActionItem*)cmd.m_apParam[0])->GetID(), fVector2(cmd.m_afParam[1], cmd.m_afParam[2]));
        }

        // 恢复激活Action
        CActionSystem::GetMe()->SetDefaultAction(CGameProcedure::s_pGameInterface->Skill_GetActive());
    }
    break;

    // 对某个方向使用技能(扇形攻击)
    case SCommand_Mouse::MCT_SKILL_DIR:
    {
        tActionItem* pItem = (tActionItem*)cmd.m_apParam[0];
        if(!pItem)
            break;

        // 忽略宠物的技能使用

        // 人物的方向技能使用
        CGameProcedure::s_pGameInterface->Player_UseSkill(((tActionItem*)cmd.m_apParam[0])->GetID(), cmd.m_afParam[1]);

        // 恢复激活Action
        CActionSystem::GetMe()->SetDefaultAction(CGameProcedure::s_pGameInterface->Skill_GetActive());
    }
    break;

    // 掉落包之类的
    case SCommand_Mouse::MCT_HIT_TRIPPEROBJ:
    {
        CGameProcedure::s_pGameInterface->TripperObj_Active(cmd.m_adwParam[0]);
    }
    break;

    // NPC对话
    case SCommand_Mouse::MCT_SPEAK:
    {
        // 首先选择目标
        CGameProcedure::s_pGameInterface->Object_SelectAsMainTarget((INT)cmd.m_adwParam[0], 3);

        // 谈话
        CGameProcedure::s_pGameInterface->Player_Speak(cmd.m_adwParam[0]);
    }
    break;

    // 右键关联菜单
    case SCommand_Mouse::MCT_CONTEXMENU:
    {
        // 首先选择
        CGameProcedure::s_pGameInterface->Object_SelectAsMainTarget((INT)cmd.m_adwParam[0], 0);

        // 显示右键菜单
        CGameProcedure::s_pGameInterface->Object_ShowContexMenu(cmd.m_adwParam[0]);
    }
    break;

    case SCommand_Mouse::MCT_REPAIR:
    {
        //do nothing...
    }
    break;

    case SCommand_Mouse::MCT_CANCLE_REPAIR:
    {
        // 取消修理
        CActionSystem::GetMe()->SetDefaultAction(CGameInterface::GetMe()->Skill_GetActive());
    }
    break;


    case SCommand_Mouse::MCT_UI_USE_IDENTIFY:
    {
        // 使用鉴定卷轴

        break;
    }
    case SCommand_Mouse::MCT_UI_USE_CANCEL_IDENTIFY:
    {
        // 取消使用鉴定卷轴
        CDataPool::GetMe()->Identify_UnLock();
        break;
    }

    case SCommand_Mouse::MCT_USE_ITEM:
    {
        // 使用物品
        CGameProcedure::s_pGameInterface->PacketItem_UserItem((	tActionItem*)cmd.m_apParam[0],
                cmd.m_adwParam[1], fVector2(cmd.m_afParam[2], cmd.m_afParam[3]));

        // 恢复激活Action
        CActionSystem::GetMe()->SetDefaultAction(CGameProcedure::s_pGameInterface->Skill_GetActive());
    }
    break;

    case SCommand_Mouse::MCT_CANCEL_USE_ITEM:
    {
        // 恢复激活Action
        CActionSystem::GetMe()->SetDefaultAction(CGameProcedure::s_pGameInterface->Skill_GetActive());
    }
    break;
    /*case SCommand_Mouse::MCT_PLAYER_JUMP:
    	{
    		CObjectManager::GetMe()->GetMySelf()->Jump();
    	}
    	break;*/

    default:
        AxTrace(0, 0, "Active: ERROR!(%d)", cmd.m_typeMouse);
        break;
    }
}