📄 player.cpp
字号:
// Player.cpp: implementation of the CPlayer class.
//
//////////////////////////////////////////////////////////////////////
#include "stdafx.h"
#include "Player.h"
#include "GameResourceManager.h"
#include "MoveManager.h "
#include "./interface/cWindowManager.h"
#include "AppearanceManager.h"
#include "PartyManager.h"
#include "ItemManager.h"
#include "ObjectManager.h"
#include "KyungGongManager.h"
#include "StreetStallTitleTip.h"
#include "StreetStallManager.h"
#include "GameIn.h"
#include "PeaceWarModeManager.h"
#include "ObjectBalloon.h"
#include "MonsterGuageDlg.h"
#include "ObjectStateManager.h"
#include "PKManager.h"
#include "ChatManager.h"
//#include "QuestGroup.h"
//////////////////////////////////////////////////////////////////////
// Construction/Destruction
//////////////////////////////////////////////////////////////////////
CPlayer::CPlayer()
{
// m_pQuestGroup = NULL;
}
CPlayer::~CPlayer()
{
// if( m_pQuestGroup )
// delete m_pQuestGroup;
}
void CPlayer::InitPlayer(CHARACTER_TOTALINFO* pTotalInfo)
{
memcpy(&m_CharacterInfo,pTotalInfo,sizeof(CHARACTER_TOTALINFO));
memset(&m_MoveInfo,0,sizeof(MOVE_INFO));
SetBaseMotion();
}
/*void CPlayer::AddChat(char * chatMsg)
{
m_pObjectName->GetObjectChatTip()->SetText(chatMsg);
m_pObjectName->GetObjectChatTip()->SetDisappearTime(5000);
if(!m_pObjectName->IsActive())
{
DropObjectName();
m_pObjectName->GetObjectChatTip()->SetActive(TRUE);
WINDOWMGR->AddChatTooltip(m_pObjectName);
}
}*/
void CPlayer::GetCharacterTotalInfo(CHARACTER_TOTALINFO* pRtInfo)
{
memcpy(pRtInfo,&m_CharacterInfo,sizeof(CHARACTER_TOTALINFO));
}
void CPlayer::Process()
{
if( GetState() == eObjectState_Die )
if( GAMEIN->GetMonsterGuageDlg() )
{
CObject * pSelectedObj = GAMEIN->GetMonsterGuageDlg()->GetCurMonster();
if( pSelectedObj == this )
{
// OBJECTMGR->SetSelectedObject(NULL);
GAMEIN->GetMonsterGuageDlg()->SetActive(FALSE);
}
}
CObject::Process();
}
void CPlayer::SetWearedItemIdx(DWORD WearedPosition,WORD ItemIdx)
{
if(WearedPosition == eWearedItem_Weapon)
{
// 公扁甫 官操搁 刘气篮 荤扼柳促.
GetSpecialStateParam1(eSpecialState_AmplifiedPowerPhy);
}
m_CharacterInfo.WearedItemIdx[WearedPosition] = ItemIdx;
SetBaseMotion(); // 公扁啊 官差搁 扁夯悼累捞 官诧促
}
WORD CPlayer::GetWeaponEquipType() {
//YH2DO EquipType俊 措茄 沥府 鞘夸!!!!
WORD WeaponItemIdx = GetWearedItemIdx(eWearedItem_Weapon);
if(WeaponItemIdx == 0)
return WP_GWUN;
ITEM_INFO * pItemInfo = ITEMMGR->GetItemInfo(WeaponItemIdx);
ASSERT(pItemInfo);
if(pItemInfo->WeaponType != 0)
return pItemInfo->WeaponType;
else
return 0;
}
void CPlayer::SetBaseMotion()
{
WORD WeaponEquipType = GetWeaponEquipType();
if(m_MoveInfo.KyungGongIdx)
{ // 版傍吝捞搁
// 版傍 辆幅俊 蝶扼 版傍悼累 1,2,3吝 搬沥茄促.
CKyungGongInfo* pKGInfo = KYUNGGONGMGR->GetKyungGongInfo(m_MoveInfo.KyungGongIdx);
ASSERT(pKGInfo);
int MoveType;
if(pKGInfo != NULL)
MoveType = pKGInfo->GetMoveType() - 1; // -1 篮 1何磐 矫累窍扁 锭巩俊 0栏肺 矫累阑 嘎勉
else
MoveType = 0;
if(MoveType == 1) // 滴锅掳 版傍篮 矫累悼累 画 by SSAMI
m_Move_Start_Motion = eMotion_KyungGong1_Move_NoWeapon + MoveType*3;
else
m_Move_Start_Motion = eMotion_KyungGong1_Start_NoWeapon + MoveType*3;
m_Move_Ing_Motion = eMotion_KyungGong1_Move_NoWeapon + MoveType*3;
m_Move_End_Motion = eMotion_KyungGong1_End_NoWeapon;// + MoveType*3;
if(m_CharacterInfo.bPeace == TRUE) // 乞拳葛靛 捞衬
{ // 乞拳葛靛
if(WeaponEquipType == WP_DO)
m_StandardMotion = eMotion_Peace_Standard_Do;
else if(WeaponEquipType == WP_CHANG)
m_StandardMotion = eMotion_Peace_Standard_Change;
else
m_StandardMotion = eMotion_Peace_Standard;
}
else
{
WORD WeaponEquipType = GetWeaponEquipType();
m_StandardMotion = eMotion_Battle_Gum_Standard + WeaponEquipType -1;
}
return;
}
if(m_CharacterInfo.bPeace == TRUE) // 乞拳葛靛 捞衬
{ // 乞拳葛靛
if(WeaponEquipType == WP_DO)
m_StandardMotion = eMotion_Peace_Standard_Do;
else if(WeaponEquipType == WP_CHANG)
m_StandardMotion = eMotion_Peace_Standard_Change;
else
m_StandardMotion = eMotion_Peace_Standard;
if(m_MoveInfo.MoveMode == eMoveMode_Walk)
{ // 叭扁
if(WeaponEquipType == WP_DO)
m_Move_Start_Motion = eMotion_Peace_Walk_Do;
else if(WeaponEquipType == WP_CHANG)
m_Move_Start_Motion = eMotion_Peace_Walk_Change;
else
m_Move_Start_Motion = eMotion_Peace_Walk;
m_Move_Ing_Motion = m_Move_Start_Motion;
m_Move_End_Motion = -1;
}
else
{ // 顿扁
if(WeaponEquipType == WP_DO)
m_Move_Start_Motion = eMotion_Peace_Run_Do;
else if(WeaponEquipType == WP_CHANG)
m_Move_Start_Motion = eMotion_Peace_Run_Change;
else
m_Move_Start_Motion = eMotion_Peace_Run;
m_Move_Ing_Motion = m_Move_Start_Motion;
m_Move_End_Motion = -1;
}
}
else
{ // 傈捧葛靛
m_StandardMotion = eMotion_Battle_Gum_Standard + WeaponEquipType -1;
if(m_MoveInfo.MoveMode == eMoveMode_Walk)
{ // 叭扁
m_Move_Start_Motion = eMotion_Battle_Gum_Walk + WeaponEquipType -1;
m_Move_Ing_Motion = eMotion_Battle_Gum_Walk + WeaponEquipType -1;
m_Move_End_Motion = -1;
}
else
{ // 顿扁
m_Move_Start_Motion = eMotion_Battle_Gum_Run + WeaponEquipType -1;
m_Move_Ing_Motion = eMotion_Battle_Gum_Run + WeaponEquipType -1;
m_Move_End_Motion = -1;
}
}
}
void CPlayer::StartSocietyAct( int nStartMotion, int nIngMotion, int nEndMotion, BOOL bHideWeapon )
{
OBJECTSTATEMGR->EndObjectState( this, GetState(), 0 ); //泅犁 惑怕甫 场辰促.
m_ObjectState.State_Start_Motion = (short int)nStartMotion;
m_ObjectState.State_Ing_Motion = (short int)nIngMotion;
m_ObjectState.State_End_Motion = (short int)nEndMotion;
if( nEndMotion != -1 )
m_ObjectState.State_End_MotionTime = GetEngineObject()->GetAnimationTime(nEndMotion);
else
m_ObjectState.State_End_MotionTime = 0;
if(m_ObjectState.State_Start_Motion != -1)
{
ChangeMotion( m_ObjectState.State_Start_Motion, FALSE );
if( m_ObjectState.State_Ing_Motion != -1 )
ChangeBaseMotion( m_ObjectState.State_Ing_Motion );
}
if(m_ObjectState.State_End_MotionTime)
m_ObjectState.BeforeState = m_BaseObjectInfo.ObjectState;
m_BaseObjectInfo.ObjectState = eObjectState_Society;
m_ObjectState.State_Start_Time = gCurTime;
m_ObjectState.bEndState = FALSE;
if( bHideWeapon )
APPEARANCEMGR->HideWeapon( this );
m_ObjectState.BeforeState = m_BaseObjectInfo.ObjectState;
m_BaseObjectInfo.ObjectState = eObjectState_Society;
m_ObjectState.State_Start_Time = gCurTime;
m_ObjectState.bEndState = FALSE;
if( m_ObjectState.State_Ing_Motion == -1 )
OBJECTSTATEMGR->EndObjectState( this, eObjectState_Society, GetEngineObject()->GetAnimationTime( m_ObjectState.State_Start_Motion ) );
}
void CPlayer::SetMotionInState(BYTE State)
{
switch(State)
{
case eObjectState_StreetStall_Owner:
{
m_ObjectState.State_Start_Motion = eMotion_StreetStall_Start;
m_ObjectState.State_Ing_Motion = eMotion_StreetStall_Ing;
m_ObjectState.State_End_Motion = eMotion_StreetStall_End;
m_ObjectState.State_End_MotionTime = GetEngineObject()->GetAnimationTime(eMotion_StreetStall_End);
}
break;
case eObjectState_Move:
{
m_ObjectState.State_Start_Motion = m_Move_Start_Motion;
m_ObjectState.State_Ing_Motion = m_Move_Ing_Motion;
m_ObjectState.State_End_Motion = m_Move_End_Motion;
m_ObjectState.State_End_MotionTime = GetEngineObject()->GetAnimationTime(m_Move_End_Motion);
}
break;
case eObjectState_None:
case eObjectState_Exchange:
case eObjectState_Deal:
case eObjectState_Munpa:
case eObjectState_PrivateWarehouse:
case eObjectState_StreetStall_Guest:
{
m_ObjectState.State_Start_Motion = m_StandardMotion;
//YH2DO
if( GetState() == eObjectState_SkillSyn ||
GetState() == eObjectState_SkillUsing )
m_ObjectState.State_Start_Motion = -1;
m_ObjectState.State_Ing_Motion = m_StandardMotion;
m_ObjectState.State_End_Motion = -1;
m_ObjectState.State_End_MotionTime = 0;
}
break;
case eObjectState_Ungijosik:
{
m_ObjectState.State_Start_Motion = eMotion_Ungijosik_Start;
m_ObjectState.State_Ing_Motion = eMotion_Ungijosik_Ing;
m_ObjectState.State_End_Motion = eMotion_Ungijosik_End;
m_ObjectState.State_End_MotionTime = GetEngineObject()->GetAnimationTime(eMotion_Ungijosik_End);
}
break;
case eObjectState_Tactic:
{
m_ObjectState.State_Start_Motion = eMotion_Tactic_Start;
m_ObjectState.State_Ing_Motion = eMotion_Tactic_Ing;
m_ObjectState.State_End_Motion = -1;
m_ObjectState.State_End_MotionTime = 0;
}
break;
default:
{
m_ObjectState.State_Start_Motion = -1;
m_ObjectState.State_Ing_Motion = -1;
m_ObjectState.State_End_Motion = -1;
m_ObjectState.State_End_MotionTime = 0;
}
break;
}
}
BYTE CPlayer::GetLifePercent()
{
return (BYTE)((m_CharacterInfo.Life*100) / GetMaxLife());
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -