Actor.cpp
上传用户:cydong117
上传日期:2009-11-10
资源大小:638k
文件大小:175k
- // fnDecode6BitBuf(&lpPacketMsg->szEncodeData[_FEATURESIZE*2], (char*)&stFeatureEx, sizeof(FEATUREEX));
- memcpy(&stFeature, &stCharDesc.nFeature, sizeof(FEATURE));
- m_nState = stCharDesc.nStatus;
- if( m_nState & 0X2 ) m_bOpenHealth = TRUE;
- else m_bOpenHealth = FALSE;
- ChangeFeature(stFeature, m_stFeatureEx);
- if ( m_stFeatureEx.bHorse == _HORSE_NONE ) SetMotionFrame(_MT_WALK, bDir);
- else SetMotionFrame(_MT_HORSEWALK, bDir);
-
- m_bMoveSpeed = _SPEED_WALK;
- SetMoving();
- }
- VOID CHero::OnRun(LPPACKETMSG lpPacketMsg)
- {
- BYTE bDir;
- CHARDESC stCharDesc;
- FEATURE stFeature;
- // FEATUREEX stFeatureEx;
- // m_wPosX = lpPacketMsg->stDefMsg.wParam;
- // m_wPosY = lpPacketMsg->stDefMsg.wTag;
- bDir = LOBYTE(lpPacketMsg->stDefMsg.wSeries);
- m_bLightSize = HIBYTE(lpPacketMsg->stDefMsg.wSeries);
- fnDecode6BitBuf(lpPacketMsg->szEncodeData, (char*)&stCharDesc, sizeof(CHARDESC));
- // fnDecode6BitBuf(&lpPacketMsg->szEncodeData[_CHARDESCSIZE], (char*)&stFeatureEx, sizeof(FEATUREEX));
- memcpy(&stFeature, &stCharDesc.nFeature, sizeof(FEATURE));
- m_nState = stCharDesc.nStatus;
- if( m_nState & 0X2 ) m_bOpenHealth = TRUE;
- else m_bOpenHealth = FALSE;
- ChangeFeature(stFeature, m_stFeatureEx);
- if ( m_stFeatureEx.bHorse == _HORSE_NONE )
- {
- SetMotionFrame(_MT_RUN, bDir);
- m_bMoveSpeed = _SPEED_RUN;
- }
- else
- {
- SetMotionFrame(_MT_HORSERUN, bDir);
- m_bMoveSpeed = _SPEED_HORSERUN;
- }
- SetMoving();
- }
- VOID CHero::OnTurn(LPPACKETMSG lpPacketMsg)
- {
- BYTE bDir;
- CHARDESC stCharDesc;
- FEATURE stFeature;
- INT nPos;
- m_wPosX = lpPacketMsg->stDefMsg.wParam;
- m_wPosY = lpPacketMsg->stDefMsg.wTag;
- bDir = LOBYTE(lpPacketMsg->stDefMsg.wSeries);
- m_bLightSize = HIBYTE(lpPacketMsg->stDefMsg.wSeries);
- fnDecode6BitBuf(lpPacketMsg->szEncodeData, (char*)&stCharDesc, sizeof(CHARDESC));
- fnDecode6BitBuf(&lpPacketMsg->szEncodeData[_CHARDESCSIZE], (char*)&m_stFeatureEx , sizeof(FEATUREEX));
- if (strlen(lpPacketMsg->szEncodeData) > _CHARDESCSIZE)
- {
- nPos = fnDecode6BitBuf(&lpPacketMsg->szEncodeData[_CHARDESCSIZE +_FEATURESIZEEX], m_szName, sizeof(m_szName));
- m_szName[nPos] = ' ';
- CHAR* szClr = strrchr(m_szName, '/');
- if ( szClr )
- {
- m_dwNameClr = GetUserNameColor(atoi(szClr+1));
- *szClr = ' ';
- }
- }
- memcpy(&stFeature, &stCharDesc.nFeature, sizeof(FEATURE));
- m_nState = stCharDesc.nStatus;
- if( m_nState & 0X2 ) m_bOpenHealth = TRUE;
- else m_bOpenHealth = FALSE;
- if ( !m_bIsMon )
- {
- ChangeFeature(stFeature, m_stFeatureEx);
- if ( m_stFeatureEx.bHorse == _HORSE_NONE ) SetMotionFrame(_MT_STAND, bDir);
- else SetMotionFrame(_MT_HORSESTAND, bDir);
- }
- else
- {
- SetMotionFrame(_MT_MON_STAND, bDir);
- }
- }
- VOID CHero::OnStruck(LPPACKETMSG lpPacketMsg)
- {
- MESSAGEBODYWL stMsgBodyWl;
- FEATURE stFeature;
- FLOAT wHPRate = (FLOAT)((FLOAT)lpPacketMsg->stDefMsg.wParam/(FLOAT)lpPacketMsg->stDefMsg.wTag);
- WORD wDamage = lpPacketMsg->stDefMsg.wSeries;
- m_wHP = lpPacketMsg->stDefMsg.wParam;
- m_wMAXHP = lpPacketMsg->stDefMsg.wTag;
- m_bHPPercent = wHPRate*100;
- m_bShieldCurrFrm = 0;
- fnDecode6BitBuf(lpPacketMsg->szEncodeData, (char*)&stMsgBodyWl, sizeof(MESSAGEBODYWL));
- memcpy(&stFeature, &stMsgBodyWl.lParam1, sizeof(LONG));
- if ( !m_bIsMon )
- {
- ChangeFeature(stFeature, m_stFeatureEx);
- if ( m_stFeatureEx.bHorse == _HORSE_NONE ) SetMotionFrame(_MT_HITTED, m_bCurrDir);
- else SetMotionFrame(_MT_HORSEHIT, m_bCurrDir);
- }
- else
- {
- SetMotionFrame(_MT_MON_HITTED, m_bCurrDir);
- }
- // 阁胶磐老锭.
- if ( m_stHitter.bGender == _GENDER_MON )
- {
- CMagic* pxMagic;
- switch ( m_stHitter.bDress )
- {
- case 2: // 纳迫肺橇.
- pxMagic = new CMagic;
- pxMagic->CreateMagic(_MONMAGIC_KEPAL, m_wPosX, m_wPosY, m_wPosX, m_wPosY, this, 0);
- g_xGameProc.m_xMagicList.AddNode(pxMagic);
- break;
- case 8: // 癌林俺固.
- pxMagic = new CMagic;
- pxMagic->CreateMagic(_MONMAGIC_GREATANT, m_wPosX, m_wPosY, m_wPosX, m_wPosY, this);
- g_xGameProc.m_xMagicList.AddNode(pxMagic);
- break;
- case 14: // 捍侩俺固.
- pxMagic = new CMagic;
- pxMagic->CreateMagic(_MONMAGIC_ANT, m_wPosX, m_wPosY, m_wPosX, m_wPosY, this);
- g_xGameProc.m_xMagicList.AddNode(pxMagic);
- break;
- case 16: // 靛抄俺固.
- pxMagic = new CMagic;
- pxMagic->CreateMagic(_MONMAGIC_WORKANT, m_wPosX, m_wPosY, m_wPosX, m_wPosY, this);
- g_xGameProc.m_xMagicList.AddNode(pxMagic);
- break;
- case 67: // 盟锋脚.
- pxMagic = new CMagic;
- pxMagic->CreateMagic(_MONMAGIC_BIGGINE_CHAR, m_wPosX, m_wPosY, m_wPosX, m_wPosY, this);
- g_xGameProc.m_xMagicList.AddNode(pxMagic);
- break;
- default :
- break;
- }
- }
- ZeroMemory(&m_stHitter, sizeof(FEATURE));
- }
- VOID CHero::OnHit(LPPACKETMSG lpPacketMsg)
- {
- BYTE bDir;
- bDir = lpPacketMsg->stDefMsg.wSeries;
- m_wPosX = lpPacketMsg->stDefMsg.wParam;
- m_wPosY = lpPacketMsg->stDefMsg.wTag;
- if ( !m_bIsMon )
- {
- m_dwCurrEffectFrame = 50;
- m_dwFstEffectFrame = 50;
- m_dwEndEffectFrame = 60;
- m_bEffectFrame = 0;
- m_bEffectFrameCnt = _DEFAULT_SPELLFRAME;
- m_bWarMode = TRUE;
- if ( lpPacketMsg->stDefMsg.wIdent == SM_WIDEHIT )
- {
- SetMotionFrame(_MT_ONEHSWING, bDir);
- LoadEffect(&g_xGameProc.m_xImage, _SKILL_BANWOL, bDir);
- m_bUseSwordEffect = TRUE;
- }
- else if ( lpPacketMsg->stDefMsg.wIdent == SM_POWERHIT )
- {
- SetMotionFrame(_MT_ONEVSWING, bDir);
- LoadEffect(&g_xGameProc.m_xImage, _SKILL_YEDO, bDir);
- m_bUseSwordEffect = TRUE;
- }
- else if ( lpPacketMsg->stDefMsg.wIdent == SM_FIREHIT )
- {
- SetMotionFrame(_MT_ONEVSWING, bDir);
- LoadEffect(&g_xGameProc.m_xImage, _SKILL_FIRESWORD, bDir);
- m_bUseSwordEffect = TRUE;
- }
- else if ( lpPacketMsg->stDefMsg.wIdent == SM_LONGHIT )
- {
- SetMotionFrame(_MT_ONEVSWING, bDir);
- LoadEffect(&g_xGameProc.m_xImage, _SKILL_ERGUM, bDir);
- m_bUseSwordEffect = TRUE;
- }
- else
- {
- bDir = LOBYTE(lpPacketMsg->stDefMsg.wSeries);
- BYTE bAttackMode = HIBYTE(lpPacketMsg->stDefMsg.wSeries);
- SetMotionFrame(_MT_ONEVSWING, bDir);
- }
- }
- }
- VOID CHero::OnMagicFire(LPPACKETMSG lpPacketMsg)
- {
- POINT ptPos;
- BYTE bMagicID;
- INT nMagicTargetID, nPos;
- ptPos.x = lpPacketMsg->stDefMsg.wParam;
- ptPos.y = lpPacketMsg->stDefMsg.wTag;
- bMagicID = lpPacketMsg->stDefMsg.wSeries;
- nPos = fnDecode6BitBuf(lpPacketMsg->szEncodeData, (CHAR*)&nMagicTargetID, sizeof(INT));
- if ( bMagicID == _SKILL_SKELLETON )
- {
- return;
- }
- if ( bMagicID == _SKILL_SHOOTLIGHTEN )
- {
- CElecMagic* pxElecMagic;
- pxElecMagic = new CElecMagic;
- pxElecMagic->CreateMagic(bMagicID, m_wPosX, m_wPosY, ptPos.x, ptPos.y, NULL, nMagicTargetID);
- g_xGameProc.m_xMagicList.AddNode(pxElecMagic);
- }
- // if ( bMagicID == _SKILL_SHOOTLIGHTEN || bMagicID == _SKILL_FIRE )
- else if ( bMagicID == _SKILL_FIRE )
- {
- BYTE bDir16 = (BYTE)g_xGameProc.m_xMap.CalcDirection8(m_wPosX, m_wPosY, ptPos.x, ptPos.y);
- POINT ptTileGap = {0, 0};
- POINT ptTileDest = {0, 0};
- BYTE bLoopCnt = 0;
- BYTE bDelay = 0;
- if ( bMagicID == _SKILL_SHOOTLIGHTEN ) { bLoopCnt = 15; bDelay = 70; }
- else { bLoopCnt = 5; bDelay = 150; }
- switch ( bDir16 )
- {
- case 0 : ptTileGap.x = 0; ptTileGap.y = -1; break;
- case 1 : ptTileGap.x = 1; ptTileGap.y = -1; break;
- case 2 : ptTileGap.x = 1; ptTileGap.y = 0; break;
- case 3 : ptTileGap.x = 1; ptTileGap.y = 1; break;
- case 4 : ptTileGap.x = 0; ptTileGap.y = 1; break;
- case 5 : ptTileGap.x = -1; ptTileGap.y = 1; break;
- case 6 : ptTileGap.x = -1; ptTileGap.y = 0; break;
- case 7 : ptTileGap.x = -1; ptTileGap.y = -1; break;
- }
- for ( INT nCnt = 0; nCnt < bLoopCnt; nCnt++ )
- {
- CMagicStream* pxMagicStream;
- pxMagicStream = new CMagicStream;
- ptTileDest.x = m_wPosX + ptTileGap.x*(nCnt+1);
- ptTileDest.y = m_wPosY + ptTileGap.y*(nCnt+1);
- pxMagicStream->CreateMagic(bMagicID, m_wPosX, m_wPosY, ptTileDest.x, ptTileDest.y, NULL, nMagicTargetID, nCnt*bDelay, ptTileGap);
- if ( bMagicID == _SKILL_SHOOTLIGHTEN )
- g_xGameProc.m_xMagicList.AddNode(pxMagicStream);
- else
- g_xGameProc.m_xGroundMagicList.AddNode(pxMagicStream);
- }
- }
- else if ( bMagicID == _SKILL_SHIELD )
- {
- CMagic* pxMagic;
- pxMagic = new CMagic;
- pxMagic->CreateMagic(bMagicID, m_wPosX, m_wPosY, m_wPosX, m_wPosY, NULL, m_dwIdentity);
- g_xGameProc.m_xMagicList.AddNode(pxMagic);
- }
- else if ( bMagicID != _SKILL_EARTHFIRE && bMagicID != _SKILL_HOLYSHIELD )
- {
- CMagic* pxMagic;
- pxMagic = new CMagic;
- pxMagic->CreateMagic(bMagicID, m_wPosX, m_wPosY, ptPos.x, ptPos.y, NULL, nMagicTargetID);
- g_xGameProc.m_xMagicList.AddNode(pxMagic);
- }
- m_shCurrMagicID = bMagicID;
- }
- VOID CHero::OnSpell(LPPACKETMSG lpPacketMsg)
- {
- BYTE bMagicDir;
- INT nMagicID;
- POINT ptTargetPos;
- ptTargetPos.x = lpPacketMsg->stDefMsg.wParam;
- ptTargetPos.y = lpPacketMsg->stDefMsg.wTag;
- // bDir = lpPacketMsg->stDefMsg.wSeries;
- // nPos = fnDecode6BitBuf(lpPacketMsg->szEncodeData, szDecodeMsg, sizeof(szDecodeMsg));
- // szDecodeMsg[nPos] = ' ';
- bMagicDir = g_xGameProc.m_xMap.CalcDirection8(m_wPosX, m_wPosY, ptTargetPos.x, ptTargetPos.y);
- nMagicID = atoi(lpPacketMsg->szEncodeData);
- if ( nMagicID == _SKILL_FIREBALL || nMagicID == _SKILL_FIREBALL2 || nMagicID == _SKILL_FIRE || nMagicID == _SKILL_SHOOTLIGHTEN ||
- nMagicID == _SKILL_HANGMAJINBUB || nMagicID== _SKILL_DEJIWONHO || nMagicID == _SKILL_FIRECHARM || nMagicID == _SKILL_BIGCLOAK || nMagicID == _SKILL_SINSU )
- LoadEffect(&g_xGameProc.m_xImage, nMagicID, bMagicDir);
- else
- LoadEffect(&g_xGameProc.m_xImage, nMagicID);
- if ( nMagicID == _SKILL_SHOWHP ) m_bEffectFrameCnt = 20;
- else if ( nMagicID == _SKILL_LIGHTFLOWER ) m_bEffectFrameCnt = 20;
- else if ( nMagicID == _SKILL_SPACEMOVE ) m_bEffectFrameCnt = 19;
- else if ( nMagicID == _SKILL_LIGHTENING ) m_bEffectFrameCnt = 17;
- m_bWarMode = m_bUseEffect = TRUE;
- /* if ( nMagicID == _SKILL_SHIELD )
- {
- m_dwFstEffectFrame = 50;
- m_dwEndEffectFrame = 60;
- m_dwCurrEffectFrame = 50;
- m_bEffectFrame = 0;
- m_bEffectFrameCnt = _DEFAULT_SPELLFRAME;
- }
- */ m_shCurrMagicID = nMagicID;
- switch( nMagicID )
- {
- case _SKILL_HANGMAJINBUB:
- case _SKILL_DEJIWONHO:
- case _SKILL_FIRECHARM:
- case _SKILL_FIRE:
- case _SKILL_FIREBALL2:
- case _SKILL_SINSU:
- case _SKILL_FIREBALL:
- case _SKILL_SHOOTLIGHTEN:
- case _SKILL_BIGCLOAK:
- SetMotionFrame(_MT_SPELL1, bMagicDir);
- break;
- case _SKILL_FIREWIND:
- case _SKILL_AMYOUNSUL:
- case _SKILL_TAMMING:
- case _SKILL_KILLUNDEAD:
- case _SKILL_HEALLING:
- case _SKILL_HOLYSHIELD:
- case _SKILL_BIGHEALLING:
- case _SKILL_LIGHTFLOWER:
- case _SKILL_SKELLETON:
- case _SKILL_SNOWWIND:
- case _SKILL_SHIELD:
- case _SKILL_SHOWHP:
- case _SKILL_EARTHFIRE:
- case _SKILL_FIREBOOM:
- case _SKILL_SPACEMOVE:
- case _SKILL_CLOAK:
- case _SKILL_LIGHTENING:
- default:
- SetMotionFrame(_MT_SPELL2, bMagicDir);
- break;
- }
- }
- VOID CHero::OnButch(LPPACKETMSG lpPacketMsg)
- {
- BYTE bDir;
- m_wPosX = lpPacketMsg->stDefMsg.wParam;
- m_wPosY = lpPacketMsg->stDefMsg.wTag;
- bDir = lpPacketMsg->stDefMsg.wSeries;
- SetMotionFrame(_MT_CUT, bDir);
- }
- /******************************************************************************************************************
- 窃荐疙 : CHero::UpdatePacketState()
- 累己磊 :
- 累己老 :
- 格利 :
- 免仿 : BOOL
- [老磊][荐沥磊] : 荐沥郴侩
- *******************************************************************************************************************/
- BOOL CHero::UpdatePacketState()
- {
- LPPACKETMSG lpPacketMsg = NULL;
- if ( m_bCurrMtn == _MT_STAND || m_bCurrMtn == _MT_ATTACKMODE || m_bCurrMtn == _MT_HORSESTAND || (m_bCurrMtn==_MT_SPELL1 && m_dwCurrFrame == m_dwEndFrame-2) )
- {
- LPPACKETMSG lpPacketMsg;
- SHORT shLeftMsgCnt = m_xPacketQueue.GetCount();
- if ( shLeftMsgCnt > 0 )
- {
- lpPacketMsg = (LPPACKETMSG)m_xPacketQueue.PopQ();
- if ( shLeftMsgCnt >= 3 ) m_bMsgHurryCheck = TRUE;
- else m_bMsgHurryCheck = FALSE;
- if ( lpPacketMsg )
- {
- switch ( lpPacketMsg->stDefMsg.wIdent )
- {
- case SM_SITDOWN:
- case SM_BUTCH: { OnButch(lpPacketMsg); break; }
- case SM_FEATURECHANGED: { OnFeatureChanged(lpPacketMsg); break; }
- case SM_CHARSTATUSCHANGE: { OnCharStatusChanged(lpPacketMsg); break; }
- case SM_OPENHEALTH: { OnOpenHealth(lpPacketMsg); break; }
- case SM_CLOSEHEALTH: { OnCloseHealth(lpPacketMsg); break; }
- case SM_CHANGELIGHT: { OnChangeLight(lpPacketMsg); break; }
- case SM_USERNAME: { OnUserName(lpPacketMsg); break; }
- case SM_CHANGENAMECOLOR: { OnChangeNameClr(lpPacketMsg); break; }
- case SM_HEALTHSPELLCHANGED: { OnHealthSpellChanged(lpPacketMsg); break; }
- case SM_RUSH: { OnRush(lpPacketMsg); break; }
- case SM_BACKSTEP: { OnBackStep(lpPacketMsg); break; }
- case SM_NOWDEATH:
- case SM_DEATH: { OnDeath(lpPacketMsg); break; }
- case SM_WALK: { OnWalk(lpPacketMsg); break; }
- case SM_RUN: { OnRun(lpPacketMsg); break; }
- case SM_TURN: { OnTurn(lpPacketMsg); break; }
- case SM_STRUCK: { OnStruck(lpPacketMsg); break; }
- case SM_HIT:
- case SM_FIREHIT:
- case SM_LONGHIT:
- case SM_POWERHIT:
- case SM_WIDEHIT: { OnHit(lpPacketMsg); break; }
- case SM_MAGICFIRE: { OnMagicFire(lpPacketMsg); break; }
- case SM_SPELL: { OnSpell(lpPacketMsg); break; }
- default:
- {
- break;
- }
- }
- }
- SAFE_DELETE(lpPacketMsg);
- return TRUE;
- }
- }
- return FALSE;
- }
- /******************************************************************************************************************
- 窃荐疙 : CHero::UpdateMotionState()
- 累己磊 :
- 累己老 :
- 格利 :
- 涝仿 : INT nLoopTime
- BOOL bIsMoveTime
- 免仿 : VOID
- [老磊][荐沥磊] : 荐沥郴侩
- *******************************************************************************************************************/
- VOID CHero::UpdateMotionState(INT nLoopTime, BOOL bIsMoveTime)
- {
- if ( m_bWarMode )
- m_dwWarModeTime += nLoopTime;
- m_wABlendCurrDelay += nLoopTime;
- if ( m_wABlendCurrDelay >= m_wABlendDelay )
- {
- m_wABlendCurrDelay = 0;
- m_wABlendDelay = 0;
- m_bABlendRev = FALSE;
- }
- if ( m_bCurrMtn == _MT_DIE && m_dwCurrFrame >= m_dwEndFrame-1 )
- {
- m_bIsDead = TRUE;
- }
- if ( m_bIsDead )
- {
- SetMotionFrame(_MT_DIE, m_bCurrDir);
- m_dwCurrFrame = m_dwEndFrame - 1;
- return;
- }
- if ( UpdateMove(bIsMoveTime) )
- {
- UpdatePacketState();
- return;
- }
- else
- {
- m_wCurrDelay += nLoopTime;
- m_wShieldCurrDelay += nLoopTime;
- if ( m_wShieldCurrDelay > 150 )
- {
- m_bShieldCurrFrm++;
- m_wShieldCurrDelay = 0;
- if ( m_bShieldCurrFrm > 2 )
- m_bShieldCurrFrm = 0;
- }
- if ( m_wCurrDelay > m_wDelay )
- {
- m_wCurrDelay = 0;
- if ( m_dwCurrFrame < m_dwEndFrame )
- {
- m_dwCurrFrame++;
- PlayActSound();
- if ( (m_bCurrMtn == _MT_SPELL2 || m_bCurrMtn == _MT_SPELL1) && m_bUseEffect )
- {
- m_dwCurrEffectFrame++;
- m_bEffectFrame++;
- }
- if ( m_bMsgHurryCheck )
- {
- m_wDelay = m_wDelay/2;
- m_bMsgHurryCheck = FALSE;
- }
- }
- }
- UpdatePacketState();
-
- if ( m_dwWarModeTime > _WARMODE_TIME )
- {
- m_dwWarModeTime = 0;
- m_bWarMode = FALSE;
- }
- if ( m_dwCurrFrame >= m_dwEndFrame-1 )
- {
- if ( (m_bCurrMtn == _MT_SPELL2) && m_bUseEffect )
- {
- if ( m_dwCurrEffectFrame - m_dwFstEffectFrame < m_bEffectFrameCnt-2 )
- {
- m_dwCurrFrame = m_dwEndFrame - 2;
- }
- }
- }
- else if ( m_dwCurrFrame >= m_dwEndFrame-3 )
- {
- if ( (m_bCurrMtn == _MT_SPELL1) && m_bUseEffect )
- {
- if ( m_dwCurrEffectFrame - m_dwFstEffectFrame < m_bEffectFrameCnt-5 )
- {
- m_dwCurrFrame = m_dwEndFrame - 4;
- }
- }
- }
- if ( m_dwCurrFrame >= m_dwEndFrame )
- {
- m_dwCurrEffectFrame = 0;
- m_dwFstEffectFrame = 0;
- m_dwEndEffectFrame = 0;
- m_bEffectFrame = 0;
- m_bEffectFrameCnt = _DEFAULT_SPELLFRAME;
- m_bUseEffect = FALSE;
- m_bUseSwordEffect = FALSE;
- m_dwCurrFrame = m_dwFstFrame;
- if ( m_stFeatureEx.bHorse == _HORSE_NONE )
- {
- if ( m_bWarMode )
- SetMotionFrame(_MT_ATTACKMODE, m_bCurrDir);
- else
- SetMotionFrame(_MT_STAND, m_bCurrDir);
- }
- else
- {
- SetMotionFrame(_MT_HORSESTAND, m_bCurrDir);
- }
- }
- }
- }
- /******************************************************************************************************************
- 窃荐疙 : CHero::ChangeFeature()
- 累己磊 :
- 累己老 :
- 格利 : BYTE bGender, BYTE bWear, BYTE bHair, BYTE bWeapon;
- 涝仿 : WORD wActor
- BYTE bHair
- BYTE bWeapon
- 免仿 : BOOL
- [老磊][荐沥磊] : 荐沥郴侩
- *******************************************************************************************************************/
- BOOL CHero::ChangeFeature(FEATURE stFeature, FEATUREEX stFeatureEx)
- {
- if ( CActor::ChangeFeature(stFeature) )
- {
- CImageHandler* pxImgHandler = &g_xGameProc.m_xImage;
- m_stFeatureEx = stFeatureEx;
- //!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
- // m_stFeatureEx.bHorse = 0;
- // m_stFeatureEx.wDressColor = 0XFFFF;
- // m_stFeatureEx.wHairColor = 0XFFFF;
- //!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
- if ( m_stFeature.bHair >= _MAX_HAIR ) m_stFeature.bHair = _HAIR_NONE;
- if ( m_stFeature.bWeapon >= _MAX_WEAPON ) m_stFeature.bWeapon = _WEAPON_NONE;
- if ( m_stFeatureEx.bHorse >= _MAX_HORSE ) m_stFeatureEx.bHorse= _HORSE_NONE;
- m_bHorseImgIdx = _IMAGE_HORSE;
- if ( m_stFeature.bGender == _GENDER_MAN )
- {
- m_bHairImgIdx = _IMAGE_M_HAIR;
- if ( m_stFeature.bWeapon != _WEAPON_NONE ) m_bWeaponImgIdx = _IMAGE_M_WEAPON1+(m_stFeature.bWeapon-1)/10;
- }
- else if ( m_stFeature.bGender == _GENDER_WOMAN )
- {
- m_bHairImgIdx = _IMAGE_WM_HAIR;
- if ( m_stFeature.bWeapon != _WEAPON_NONE ) m_bWeaponImgIdx = _IMAGE_WM_WEAPON1+(m_stFeature.bWeapon-1)/10;
- }
- else return FALSE;
- if ( m_stFeature.bHair != _HAIR_NONE ) m_pxHairImage = &pxImgHandler->m_xImageList[m_bHairImgIdx];
- else m_pxHairImage = NULL;
- if ( m_stFeature.bWeapon != _WEAPON_NONE ) m_pxWeaponImage = &pxImgHandler->m_xImageList[m_bWeaponImgIdx];
- else m_pxWeaponImage = NULL;
- if ( m_stFeatureEx.bHorse != _HORSE_NONE ) m_pxHorseImage = &pxImgHandler->m_xImageList[m_bHorseImgIdx];
- else m_pxHorseImage = NULL;
- return TRUE;
- }
- return FALSE;
- }
- /******************************************************************************************************************
- 窃荐疙 : CHero::DrawActor()
- 累己磊 :
- 累己老 :
- 格利 :
- 涝仿 : BOOL bFocused
- BOOL bShadowAblended
- 免仿 : BOOL
- [老磊][荐沥磊] : 荐沥郴侩
- *******************************************************************************************************************/
- BOOL CHero::DrawActor(CMapHandler* pxMap, BOOL bFocused, BOOL bShadowAblended, BOOL bUseScrnPos, BOOL bDrawShadow)
- {
- // 谅钎贸府.
- if ( bUseScrnPos )
- {
- m_shScrnPosX = (m_wPosX - pxMap->m_shStartViewTileX) * _CELL_WIDTH + _VIEW_CELL_X_START - pxMap->m_shViewOffsetX + m_shShiftPixelX;
- m_shScrnPosY = (m_wPosY - pxMap->m_shStartViewTileY) * _CELL_HEIGHT+ _VIEW_CELL_Y_START - pxMap->m_shViewOffsetY + m_shShiftPixelY;
- }
- BYTE bShadowType;
- SHORT shShadowPX;
- SHORT shShadowPY;
- SHORT shPX, shPY;
- //---------------------------------------------------------------------------------------------------------------//
- // 阿 捞固瘤 技泼棺 谅钎康开 眉农.
- //---------------------------------------------------------------------------------------------------------------//
- // 富.
- if ( m_stFeatureEx.bHorse != _HORSE_NONE && m_pxHorseImage != NULL )
- {
- if ( m_bCurrMtn >= _START_HORSE_MTN )
- {
- m_dwCurrHorseFrame = (m_stFeatureEx.bHorse*_MAX_HORSE_FRAME-_MAX_HORSE_FRAME)+(m_dwCurrFrame-(_MAX_HERO_FRAME*m_stFeature.bDress)-_START_HORSE_FRAME);
- if ( !m_pxHorseImage->NewSetIndex(m_dwCurrHorseFrame) )
- return FALSE;
- shPX = m_pxHorseImage->m_lpstNewCurrWilImageInfo->shPX;
- shPY = m_pxHorseImage->m_lpstNewCurrWilImageInfo->shPY;
- SetRect(&m_rcHorse, m_shScrnPosX + shPX, m_shScrnPosY + shPY,
- m_shScrnPosX + shPX + m_pxHorseImage->m_lpstNewCurrWilImageInfo->shWidth,
- m_shScrnPosX + shPY + m_pxHorseImage->m_lpstNewCurrWilImageInfo->shHeight);
- }
- }
- // 公扁.
- if ( m_stFeature.bWeapon != _WEAPON_NONE && m_pxWeaponImage != NULL )
- {
- if ( m_bCurrMtn < _MAX_WEAPON_MTN )
- {
- m_dwCurrWeaponFrame = (((m_stFeature.bWeapon-1)%10)*_MAX_WEAPON_FRAME)+(m_dwCurrFrame-(_MAX_HERO_FRAME*m_stFeature.bDress));
- if ( !m_pxWeaponImage->NewSetIndex(m_dwCurrWeaponFrame) )
- return FALSE;
- shPX = m_pxWeaponImage->m_lpstNewCurrWilImageInfo->shPX;
- shPY = m_pxWeaponImage->m_lpstNewCurrWilImageInfo->shPY;
- SetRect(&m_rcWeapon, m_shScrnPosX + shPX, m_shScrnPosY + shPY,
- m_shScrnPosX + shPX + m_pxWeaponImage->m_lpstNewCurrWilImageInfo->shWidth,
- m_shScrnPosY + shPY + m_pxWeaponImage->m_lpstNewCurrWilImageInfo->shHeight);
- }
- }
- // 某腐磐.
- if ( m_pxActorImage )
- {
- if ( !m_pxActorImage->NewSetIndex(m_dwCurrFrame) )
- return FALSE;
- shPX = m_pxActorImage->m_lpstNewCurrWilImageInfo->shPX;
- shPY = m_pxActorImage->m_lpstNewCurrWilImageInfo->shPY;
- bShadowType = m_pxActorImage->m_lpstNewCurrWilImageInfo->bShadow;
- shShadowPX = m_pxActorImage->m_lpstNewCurrWilImageInfo->shShadowPX;
- shShadowPY = m_pxActorImage->m_lpstNewCurrWilImageInfo->shShadowPY;
- SetRect(&m_rcActor, m_shScrnPosX + shPX, m_shScrnPosY + shPY,
- m_shScrnPosX + shPX + m_pxActorImage->m_lpstNewCurrWilImageInfo->shWidth,
- m_shScrnPosY + shPY + m_pxActorImage->m_lpstNewCurrWilImageInfo->shHeight);
- if ( ( m_rcActor.right - m_rcActor.left ) > _CELL_WIDTH + _TARGETRGN_GAPX )
- {
- m_rcTargetRgn.left = m_rcActor.left + ( (m_rcActor.right - m_rcActor.left) - (_CELL_WIDTH + _TARGETRGN_GAPX) )/2;
- m_rcTargetRgn.right = m_rcActor.left + ( (m_rcActor.right - m_rcActor.left) + (_CELL_WIDTH + _TARGETRGN_GAPX) )/2;
- }
- else
- {
- m_rcTargetRgn.left = m_rcActor.left;
- m_rcTargetRgn.right = m_rcActor.right;
- }
- if ( ( m_rcActor.bottom - m_rcActor.top ) > _CELL_HEIGHT + _TARGETRGN_GAPY )
- {
- m_rcTargetRgn.top = m_rcActor.top + ( (m_rcActor.bottom - m_rcActor.top) - (_CELL_HEIGHT + _TARGETRGN_GAPY) )/2;
- m_rcTargetRgn.bottom = m_rcActor.top + ( (m_rcActor.bottom - m_rcActor.top) + (_CELL_HEIGHT + _TARGETRGN_GAPY) )/2;
- }
- else
- {
- m_rcTargetRgn.top = m_rcActor.top;
- m_rcTargetRgn.bottom = m_rcActor.bottom;
- }
- }
- // 赣府.
- if ( m_stFeature.bHair != _HAIR_NONE && m_pxHairImage != NULL )
- {
- m_dwCurrHairFrame = (m_stFeature.bHair*_MAX_HERO_FRAME-_MAX_HERO_FRAME)+(m_dwCurrFrame-(_MAX_HERO_FRAME*m_stFeature.bDress));
- if ( !m_pxHairImage->NewSetIndex(m_dwCurrHairFrame) )
- return FALSE;
- shPX = m_pxHairImage->m_lpstNewCurrWilImageInfo->shPX;
- shPY = m_pxHairImage->m_lpstNewCurrWilImageInfo->shPY;
- SetRect(&m_rcHair, m_shScrnPosX + shPX, m_shScrnPosY + shPY,
- m_shScrnPosX + shPX + m_pxHairImage->m_lpstNewCurrWilImageInfo->shWidth,
- m_shScrnPosY + shPY + m_pxHairImage->m_lpstNewCurrWilImageInfo->shHeight);
- }
- //---------------------------------------------------------------------------------------------------------------//
- // 弊覆磊弊府扁.
- //---------------------------------------------------------------------------------------------------------------//
- BYTE bOpaRate = 70;
- WORD wState = GetCharState();
- // 公扁.
- if ( m_stFeature.bWeapon != _WEAPON_NONE && m_pxWeaponImage != NULL )
- {
- if ( m_bCurrMtn < _MAX_WEAPON_MTN )
- {
- if ( bDrawShadow )
- {
- if ( !m_bIsDead )
- {
- g_xMainWnd.DrawWithShadowABlend(
- m_rcWeapon.left, m_rcWeapon.top,
- m_pxWeaponImage->m_lpstNewCurrWilImageInfo->shWidth,
- m_pxWeaponImage->m_lpstNewCurrWilImageInfo->shHeight,
- m_pxWeaponImage->m_lpstNewCurrWilImageInfo->shPX,
- m_pxWeaponImage->m_lpstNewCurrWilImageInfo->shPY,
- (WORD*)m_pxWeaponImage->m_pbCurrImage,
- _CLIP_WIDTH, _CLIP_HEIGHT, g_xGameProc.m_wShadowClr, bShadowAblended, bOpaRate);
- }
- /* else
- {
- g_xMainWnd.DrawWithShadowABlend(
- m_rcWeapon.left+3, m_rcWeapon.top-2,
- m_pxWeaponImage->m_lpstNewCurrWilImageInfo->shWidth,
- m_pxWeaponImage->m_lpstNewCurrWilImageInfo->shHeight,
- m_pxWeaponImage->m_lpstNewCurrWilImageInfo->shPX,
- m_pxWeaponImage->m_lpstNewCurrWilImageInfo->shPY,
- (WORD*)m_pxWeaponImage->m_pbCurrImage,
- _CLIP_WIDTH, _CLIP_HEIGHT, g_xGameProc.m_wShadowClr, bShadowAblended, bOpaRate);
- }
- */ }
- }
- }
- // 富.
- if ( m_stFeatureEx.bHorse != _HORSE_NONE && m_pxHorseImage != NULL )
- {
- if ( m_bCurrMtn >= _START_HORSE_MTN )
- {
- if ( bDrawShadow )
- {
- if ( !m_bIsDead )
- {
- g_xMainWnd.DrawWithShadowABlend(
- m_rcHorse.left, m_rcHorse.top,
- m_pxHorseImage->m_lpstNewCurrWilImageInfo->shWidth,
- m_pxHorseImage->m_lpstNewCurrWilImageInfo->shHeight,
- m_pxHorseImage->m_lpstNewCurrWilImageInfo->shPX,
- m_pxHorseImage->m_lpstNewCurrWilImageInfo->shPY,
- (WORD*)m_pxHorseImage->m_pbCurrImage,
- _CLIP_WIDTH, _CLIP_HEIGHT, g_xGameProc.m_wShadowClr, bShadowAblended, bOpaRate);
- }
- else
- {
- g_xMainWnd.DrawWithShadowABlend(
- m_rcHorse.left+3, m_rcHorse.top+2,
- m_pxHorseImage->m_lpstNewCurrWilImageInfo->shWidth,
- m_pxHorseImage->m_lpstNewCurrWilImageInfo->shHeight,
- m_pxHorseImage->m_lpstNewCurrWilImageInfo->shPX,
- m_pxHorseImage->m_lpstNewCurrWilImageInfo->shPY,
- (WORD*)m_pxHorseImage->m_pbCurrImage,
- _CLIP_WIDTH, _CLIP_HEIGHT, g_xGameProc.m_wShadowClr, bShadowAblended, bOpaRate);
- }
- }
- }
- }
- // 某腐磐.
- if ( m_pxActorImage )
- {
- INT nStartX1 = m_shScrnPosX + shShadowPX;
- INT nStartY1 = m_shScrnPosY + shShadowPY;
- if ( bDrawShadow )
- {
- if ( !m_bIsDead )
- {
- g_xMainWnd.DrawWithShadowABlend(
- nStartX1, nStartY1,
- m_pxActorImage->m_lpstNewCurrWilImageInfo->shWidth,
- m_pxActorImage->m_lpstNewCurrWilImageInfo->shHeight,
- (WORD*)m_pxActorImage->m_pbCurrImage,
- _CLIP_WIDTH, _CLIP_HEIGHT, g_xGameProc.m_wShadowClr, bShadowAblended, bShadowType, bOpaRate);
- }
- else
- {
- g_xMainWnd.DrawWithShadowABlend(
- m_rcActor.left+3, m_rcActor.top+2,
- m_pxActorImage->m_lpstNewCurrWilImageInfo->shWidth,
- m_pxActorImage->m_lpstNewCurrWilImageInfo->shHeight,
- (WORD*)m_pxActorImage->m_pbCurrImage,
- _CLIP_WIDTH, _CLIP_HEIGHT, g_xGameProc.m_wShadowClr, bShadowAblended, 50, bOpaRate);
- }
- }
- }
- // 赣府绰 弊覆磊甫 弊府瘤 臼绰促.
- if ( m_wABlendDelay )
- {
- bShadowAblended = TRUE;
- if ( m_wABlendDelay )
- {
- if ( !m_bABlendRev )
- bOpaRate = 100 - ( (m_wABlendCurrDelay * 100) / m_wABlendDelay );
- else
- bOpaRate = ( (m_wABlendCurrDelay * 100) / m_wABlendDelay );
- }
- if ( bFocused )
- {
- if ( !m_bABlendRev )
- bOpaRate -= 20;
- else
- bOpaRate += 20;
- }
- if ( bOpaRate < 0 && bOpaRate > 100 ) bOpaRate = 0;
- }
- else if ( wState==_STATE_ABLEND ) bShadowAblended = TRUE;
- //---------------------------------------------------------------------------------------------------------------//
- // 捞固瘤 弊府扁.
- //---------------------------------------------------------------------------------------------------------------//
- // 富.
- if ( m_stFeatureEx.bHorse != _HORSE_NONE && m_pxHorseImage != NULL )
- {
- if ( m_bCurrMtn >= _START_HORSE_MTN )
- {
- DrawWithEffected(m_rcHorse.left, m_rcHorse.top, m_pxHorseImage->m_lpstNewCurrWilImageInfo->shWidth, m_pxHorseImage->m_lpstNewCurrWilImageInfo->shHeight, (WORD*)m_pxHorseImage->m_pbCurrImage,
- 0XFFFF, 0XFFFF, bFocused, bOpaRate, wState);
- }
- }
- // 公扁甫 刚历 弊妨具瞪规氢.
- if ( m_stFeature.bWeapon != _WEAPON_NONE && m_pxWeaponImage != NULL && g_xSpriteInfo.m_bWOrder[(m_dwCurrFrame-(_MAX_HERO_FRAME*m_stFeature.bDress))] )
- {
- if ( m_bCurrMtn < _MAX_WEAPON_MTN )
- {
- DrawWithEffected(m_rcWeapon.left, m_rcWeapon.top, m_pxWeaponImage->m_lpstNewCurrWilImageInfo->shWidth, m_pxWeaponImage->m_lpstNewCurrWilImageInfo->shHeight, (WORD*)m_pxWeaponImage->m_pbCurrImage,
- 0XFFFF, 0XFFFF, bFocused, bOpaRate, wState);
- /* g_xMainWnd.DrawWithImageForCompClipRgn(
- m_rcWeapon.left, m_rcWeapon.top,
- m_pxWeaponImage->m_lpstNewCurrWilImageInfo->shWidth,
- m_pxWeaponImage->m_lpstNewCurrWilImageInfo->shHeight,
- (WORD*)m_pxWeaponImage->m_pbCurrImage, _CLIP_WIDTH, _CLIP_HEIGHT, bFocused);
- */ }
- }
- // 某腐磐.
- if ( m_pxActorImage != NULL )
- {
- DrawWithEffected(m_rcActor.left, m_rcActor.top, m_pxActorImage->m_lpstNewCurrWilImageInfo->shWidth, m_pxActorImage->m_lpstNewCurrWilImageInfo->shHeight, (WORD*)m_pxActorImage->m_pbCurrImage,
- m_stFeatureEx.wDressColor, m_stFeatureEx.wHairColor, bFocused, bOpaRate, wState);
- }
- // 赣府.
- if ( m_stFeature.bHair != _HAIR_NONE && m_pxHairImage != NULL )
- {
- DrawWithEffected(m_rcHair.left, m_rcHair.top, m_pxHairImage->m_lpstNewCurrWilImageInfo->shWidth, m_pxHairImage->m_lpstNewCurrWilImageInfo->shHeight, (WORD*)m_pxHairImage->m_pbCurrImage,
- m_stFeatureEx.wDressColor, m_stFeatureEx.wHairColor, bFocused, bOpaRate, wState);
- }
- // 公扁甫 唱吝俊 弊妨具瞪 规氢.
- if ( m_stFeature.bWeapon != _WEAPON_NONE && m_pxWeaponImage != NULL && !g_xSpriteInfo.m_bWOrder[(m_dwCurrFrame-(_MAX_HERO_FRAME*m_stFeature.bDress))] )
- {
- if ( m_bCurrMtn < _MAX_WEAPON_MTN )
- {
- DrawWithEffected(m_rcWeapon.left, m_rcWeapon.top, m_pxWeaponImage->m_lpstNewCurrWilImageInfo->shWidth, m_pxWeaponImage->m_lpstNewCurrWilImageInfo->shHeight, (WORD*)m_pxWeaponImage->m_pbCurrImage,
- 0XFFFF, 0XFFFF, bFocused, /*bOpaRate*/20, wState);
- /* g_xMainWnd.DrawWithImageForCompClipRgn(
- m_rcWeapon.left, m_rcWeapon.top,
- m_pxWeaponImage->m_lpstNewCurrWilImageInfo->shWidth,
- m_pxWeaponImage->m_lpstNewCurrWilImageInfo->shHeight,
- (WORD*)m_pxWeaponImage->m_pbCurrImage, _CLIP_WIDTH, _CLIP_HEIGHT, bFocused);
- */ }
- }
- DrawEffect();
- ShowShield();
- if ( !bDrawShadow )
- return TRUE;
- if ( bUseScrnPos )
- {
- if ( m_bLightSize == 2 )
- g_xGameProc.m_xLightFog.SetLightRadiusWithCircle(m_rcActor.left+_CELL_WIDTH/2, m_rcActor.top+_CELL_HEIGHT/2, 3, 100, 100, 100);
- else
- g_xGameProc.m_xLightFog.SetLightRadiusWithCircle(m_rcActor.left+_CELL_WIDTH/2, m_rcActor.top+_CELL_HEIGHT/2, m_bLightSize, 255, 255, 255);
- }
- else
- {
- if ( m_bLightSize == 2 )
- g_xGameProc.m_xLightFog.SetLightRadiusWithCircle(400, 242, 3, 100, 100, 100);
- else
- g_xGameProc.m_xLightFog.SetLightRadiusWithCircle(400, 242, m_bLightSize, 255, 255, 255);
- }
- return TRUE;
- }
- /******************************************************************************************************************
- CMyHero Class
- *******************************************************************************************************************/
- /******************************************************************************************************************
- 窃荐疙 : CMyHero::CMyHero()
- 累己磊 :
- 累己老 :
- 格利 :
- 免仿 :
- [老磊][荐沥磊] : 荐沥郴侩
- *******************************************************************************************************************/
- CMyHero::CMyHero()
- {
- InitActor();
- }
- /******************************************************************************************************************
- 窃荐疙 : CMyHero::~CMyHero()
- 累己磊 :
- 累己老 :
- 格利 :
- 免仿 :
- [老磊][荐沥磊] : 荐沥郴侩
- *******************************************************************************************************************/
- CMyHero::~CMyHero()
- {
- DestroyActor();
- }
- VOID CMyHero::InitActor()
- {
- CHero::InitActor();
- m_wOldPosX = 0;
- m_wOldPosY = 0;
- m_bOldDir = 0;
- m_dwWarModeTime = 0;
- m_dwMotionLockTime = 0;
- m_wMagicDelayTime = 0;
- m_wMagicPKDelayTime = 0;
- m_bJob = 0;
- m_nGlod = 0;
- m_dwLastHitTime = timeGetTime();
- m_dwLastSpellTime = timeGetTime();
- m_dwLastMagicTime = timeGetTime();
- m_dwLastStruckTime = timeGetTime();
- m_dwLastPKStruckTime= timeGetTime();
- m_dwLastRushTime = timeGetTime();
- m_dwLastFireHitTime = timeGetTime();
- m_bCanRun = FALSE;
- m_bInputLock = FALSE;
- m_bMotionLock = FALSE;
- m_bWarMode = FALSE;
- m_pxMap = NULL;
- m_bAttackMode = _MT_ONEHSWING;
- ZeroMemory(&m_stAbility, sizeof(ACTORABILITY));
- ZeroMemory(&m_stSubAbility, sizeof(ACTORSUBABILITY));
- }
- VOID CMyHero::DestroyActor()
- {
- INT nCnt;
- SHORT shLeftMsgCnt;
- LPPACKETMSG lpPacketMsg;
- CHero::DestroyActor();
- lpPacketMsg = NULL;
- shLeftMsgCnt = m_xPriorPacketQueue.GetCount();
- // 阶咯乐绰 菩哦阑 瘤款促.
- if ( shLeftMsgCnt > 0 )
- {
- for ( nCnt = 0; nCnt < shLeftMsgCnt; nCnt++ )
- {
- lpPacketMsg = (LPPACKETMSG)m_xPriorPacketQueue.PopQ();
- if ( lpPacketMsg )
- {
- SAFE_DELETE(lpPacketMsg);
- }
- }
- }
- InitActor();
- }
- BOOL CMyHero::Create(CImageHandler* pxImgHandler, BYTE bMtn, BYTE bDir, WORD wPosX, WORD wPosY,
- FEATURE* pstFeature, FEATUREEX* pstFeatureEx)
- {
- ZeroMemory(&m_stAbility, sizeof(ACTORABILITY));
- ZeroMemory(&m_stSubAbility, sizeof(ACTORSUBABILITY));
-
- if ( !(CHero::Create(pxImgHandler, bMtn, bDir, wPosX, wPosY, pstFeature, pstFeatureEx)) )
- return FALSE;
- return TRUE;
- }
- /******************************************************************************************************************
- 窃荐疙 : CMyHero::SetMapHandler()
- 累己磊 :
- 累己老 :
- 格利 :
- 涝仿 : CMapHandler* pxMap
- 免仿 : VOID
- [老磊][荐沥磊] : 荐沥郴侩
- *******************************************************************************************************************/
- VOID CMyHero::SetMapHandler(CMapHandler* pxMap)
- {
- m_pxMap = pxMap;
- }
- VOID CMyHero::OnHealthSpellChanged(LPPACKETMSG lpPacketMsg)
- {
- m_stAbility.wHP = lpPacketMsg->stDefMsg.wParam;
- m_stAbility.wMaxHP = lpPacketMsg->stDefMsg.wSeries;
- m_stAbility.wMP = lpPacketMsg->stDefMsg.wTag;
- if ( m_stAbility.wHP <= 0 ) m_stAbility.wHP = m_bHPPercent = 0;
- else
- {
- FLOAT wHPRate= (FLOAT)((FLOAT)m_stAbility.wHP/(FLOAT)m_stAbility.wMaxHP);
- m_bHPPercent = wHPRate * 100;
- }
- }
- /******************************************************************************************************************
- 窃荐疙 : CMyHero::UpdatePacketState()
- 累己磊 :
- 累己老 :
- 格利 :
- 免仿 : BOOL
- [老磊][荐沥磊] : 荐沥郴侩
- *******************************************************************************************************************/
- BOOL CMyHero::UpdatePacketState()
- {
- LPPACKETMSG lpPacketMsg = NULL;
- SHORT shLeftMsgCnt = m_xPriorPacketQueue.GetCount();
- if ( shLeftMsgCnt > 0 )
- {
- lpPacketMsg = (LPPACKETMSG)m_xPriorPacketQueue.PopQ();
- if ( lpPacketMsg )
- {
- if ( lpPacketMsg->stDefMsg.wIdent == SM_NOWDEATH || lpPacketMsg->stDefMsg.wIdent == SM_DEATH )
- {
- OnDeath(lpPacketMsg);
- SAFE_DELETE(lpPacketMsg);
- return TRUE;
- }
- }
- }
- if ( m_bCurrMtn == _MT_STAND || m_bCurrMtn == _MT_ATTACKMODE || m_bCurrMtn == _MT_HORSESTAND || (m_bCurrMtn==_MT_SPELL1 && m_dwCurrFrame==m_dwEndFrame - 2) )
- {
- LPPACKETMSG lpPacketMsg;
- SHORT shLeftMsgCnt = m_xPacketQueue.GetCount();
- if ( shLeftMsgCnt > 0 )
- {
- lpPacketMsg = (LPPACKETMSG)m_xPacketQueue.PopQ();
- if ( shLeftMsgCnt >= 3 ) m_bMsgHurryCheck = TRUE;
- else m_bMsgHurryCheck = FALSE;
-
- if ( lpPacketMsg )
- {
- switch ( lpPacketMsg->stDefMsg.wIdent )
- {
- case SM_STRUCK:
- {
- m_bInputLock = TRUE;
- m_stAbility.wHP = lpPacketMsg->stDefMsg.wParam;
- m_stAbility.wMaxHP = lpPacketMsg->stDefMsg.wTag;
- OnStruck(lpPacketMsg);
- if ( m_dwNameClr == RGB(255, 0, 0) )
- {
- m_dwLastPKStruckTime = timeGetTime();
- }
- m_dwLastStruckTime = timeGetTime();
- break;
- }
- case SM_RUSH:
- {
- m_bInputLock = TRUE;
- m_wOldPosX = m_wPosX;
- m_wOldPosY = m_wPosY;
- m_bOldDir = m_bCurrDir;
- OnRush(lpPacketMsg);
- if ( !CheckMyPostion() ) AdjustMyPostion();
- m_pxMap->ScrollMap(m_bMoveDir, m_dwCurrFrame-m_dwFstFrame, m_bMoveSpeed);
- break;
- }
- case SM_BACKSTEP:
- {
- m_bInputLock = TRUE;
- m_wOldPosX = m_wPosX;
- m_wOldPosY = m_wPosY;
- m_bOldDir = m_bCurrDir;
- OnBackStep(lpPacketMsg);
- if ( !CheckMyPostion() ) AdjustMyPostion();
- m_pxMap->ScrollMap(m_bMoveDir, m_dwCurrFrame-m_dwFstFrame, m_bMoveSpeed);
- break;
- }
- case SM_FEATURECHANGED: { OnFeatureChanged(lpPacketMsg); break; }
- case SM_OPENHEALTH: { OnOpenHealth(lpPacketMsg); break; }
- case SM_CLOSEHEALTH: { OnCloseHealth(lpPacketMsg); break; }
- case SM_CHANGELIGHT: { OnChangeLight(lpPacketMsg); break; }
- case SM_USERNAME: { OnUserName(lpPacketMsg); break; }
- case SM_CHANGENAMECOLOR: { OnChangeNameClr(lpPacketMsg); break; }
- case SM_CHARSTATUSCHANGE: { OnCharStatusChanged(lpPacketMsg); break; }
- case SM_MAGICFIRE: { OnMagicFire(lpPacketMsg); break; }
- case SM_HEALTHSPELLCHANGED: { OnHealthSpellChanged(lpPacketMsg); break; }
- default:
- {
- break;
- }
- }
- }
- SAFE_DELETE(lpPacketMsg);
- return TRUE;
- }
- }
- return FALSE;
- }
- /******************************************************************************************************************
- 窃荐疙 : CMyHero::SetOldPosition()
- 累己磊 :
- 累己老 :
- 格利 :
- 免仿 : BOOL
- [老磊][荐沥磊] : 荐沥郴侩
- *******************************************************************************************************************/
- BOOL CMyHero::SetOldPosition()
- {
- m_wPosX = m_wOldPosX;
- m_wPosY = m_wOldPosY;
- m_bCurrDir = m_bOldDir;
- if ( m_stFeatureEx.bHorse == _HORSE_NONE )
- {
- if ( SetMotionFrame(_MT_STAND, m_bCurrDir) )
- {
- AdjustMyPostion();
- m_bMotionLock = m_bInputLock = FALSE;
- return TRUE;
- }
- }
- else
- {
- if ( SetMotionFrame(_MT_HORSESTAND, m_bCurrDir) )
- {
- AdjustMyPostion();
- m_bMotionLock = m_bInputLock = FALSE;
- return TRUE;
- }
- }
- return FALSE;
- }
- /******************************************************************************************************************
- 窃荐疙 : CMyHero::CheckMyPostion()
- 累己磊 :
- 累己老 :
- 格利 :
- 免仿 : BOOL
- [老磊][荐沥磊] : 荐沥郴侩
- *******************************************************************************************************************/
- BOOL CMyHero::CheckMyPostion()
- {
- if ( m_wPosX != m_pxMap->m_shStartViewTileX + _GAPX_TILE_CHAR_MAP ||
- m_wPosY != m_pxMap->m_shStartViewTileY + _GAPY_TILE_CHAR_MAP )
- {
- return FALSE;
- }
- return TRUE;
- }
- /******************************************************************************************************************
- 窃荐疙 : CMyHero::AdjustMyPostion()
- 累己磊 :
- 累己老 :
- 格利 :
- 免仿 : VOID
- [老磊][荐沥磊] : 荐沥郴侩
- *******************************************************************************************************************/
- VOID CMyHero::AdjustMyPostion()
- {
- m_pxMap->SetStartViewTile(m_wPosX-_GAPX_TILE_CHAR_MAP, m_wPosY-_GAPY_TILE_CHAR_MAP);
- m_pxMap->LoadNewMapBuffer();
- }
- /******************************************************************************************************************
- 窃荐疙 : CMyHero::SetMotionState()
- 累己磊 :
- 累己老 :
- 格利 :
- 涝仿 : BYTE bMtn
- BYTE bDir
- LPPOINT lpptTarget
- 免仿 : VOID
- [老磊][荐沥磊] : 荐沥郴侩
- *******************************************************************************************************************/
- VOID CMyHero::SetMotionState(BYTE bMtn, BYTE bDir, INT nMouseTargetID, BOOL bIsDead, LPPOINT lpptPos, SHORT shSkill)
- {
- if ( !m_bIsMon )
- {
- switch ( bMtn )
- {
- case _MT_WALK:
- case _MT_HORSEWALK:
- {
- if ( lpptPos )
- {
- POINT ptNext;
- for ( INT nCnt = 0; nCnt < _MAX_DIRECTION; nCnt++ )
- {
- m_pxMap->GetNextTileCanMove(lpptPos->x, lpptPos->y, nCnt, 1, &ptNext);
- if ( !m_pxMap->IsDoorOpen(ptNext.x, ptNext.y) )
- {
- g_xClientSocket.SendOpenDoor(ptNext.x, ptNext.y, m_pxMap->GetDoor(ptNext.x, ptNext.y));
- break;
- }
- }
- g_xClientSocket.SendActMsg(CM_WALK, lpptPos->x, lpptPos->y, bDir);
- m_bMotionLock = m_bInputLock = TRUE;
- m_wOldPosX = m_wPosX;
- m_wOldPosY = m_wPosY;
- m_bOldDir = m_bCurrDir;
- SetMotionFrame(bMtn, bDir);
- m_bMoveSpeed = _SPEED_WALK;
- m_pxMap->ScrollMap(m_bMoveDir, m_dwCurrFrame-m_dwFstFrame, m_bMoveSpeed);
- }
- break;
- }
- case _MT_RUN:
- case _MT_HORSERUN:
- {
- if ( lpptPos )
- {
- POINT ptNext;
- POINT ptStart;
- if ( bMtn == _MT_RUN )
- m_bMoveSpeed = _SPEED_RUN;
- else
- m_bMoveSpeed = _SPEED_HORSERUN;
-
- m_pxMap->GetNextTileCanMove(m_wPosX, m_wPosY, bDir, 1, &ptStart);
- for ( INT nCnt = 0; nCnt < _MAX_DIRECTION; nCnt++ )
- {
- for ( INT nSpeedCnt = 0; nSpeedCnt < m_bMoveSpeed; nSpeedCnt++ )
- {
- m_pxMap->GetNextTileCanMove(ptStart.x, ptStart.y, nCnt, nSpeedCnt+1, &ptNext);
- if ( !m_pxMap->IsDoorOpen(ptNext.x, ptNext.y) )
- {
- g_xClientSocket.SendOpenDoor(ptNext.x, ptNext.y, m_pxMap->GetDoor(ptNext.x, ptNext.y));
- break;
- }
- }
- }
- g_xClientSocket.SendActMsg(CM_RUN, lpptPos->x, lpptPos->y, bDir);
- m_bMotionLock = m_bInputLock = TRUE;
- m_wOldPosX = m_wPosX;
- m_wOldPosY = m_wPosY;
- m_bOldDir = m_bCurrDir;
- SetMotionFrame(bMtn, bDir);
- m_pxMap->ScrollMap(m_bMoveDir, m_dwCurrFrame-m_dwFstFrame, m_bMoveSpeed);
- }
- break;
- }
- case _MT_ONEHSWING:
- {
- if ( m_bAttackMode == _MT_ONEHSWING || m_bAttackMode == _MT_ONEVSWING )
- {
- BYTE bAttackStyle = rand()%2;
- if ( bAttackStyle ) m_bAttackMode = _MT_ONEVSWING;
- else m_bAttackMode = _MT_ONEHSWING;
- m_bAttackMode = _MT_ONEVSWING;
- }
- if ( lpptPos && CanNextHit() )
- {
- m_bMotionLock = m_bInputLock = TRUE;
- m_wOldPosX = m_wPosX;
- m_wOldPosY = m_wPosY;
- m_bOldDir = m_bCurrDir;
- m_bWarMode = TRUE;
- m_dwWarModeTime = 0;
- if ( m_bUseErgum && g_xGameProc.TargetInLongAttack(bDir) )
- {
- SetMotionFrame(_MT_ONEVSWING, bDir);
- LoadEffect(&g_xGameProc.m_xImage, _SKILL_ERGUM, bDir);
- m_bUseSwordEffect = TRUE;
- g_xClientSocket.SendActMsg(CM_LONGHIT, lpptPos->x, lpptPos->y, bDir);
- }
- else if ( m_bFireHitCnt == 1 && m_stAbility.wMP > 7 )
- {
- SetMotionFrame(_MT_ONEVSWING, bDir);
- LoadEffect(&g_xGameProc.m_xImage, _SKILL_FIRESWORD, bDir);
- m_bUseSwordEffect = TRUE;
- g_xClientSocket.SendActMsg(CM_FIREHIT, lpptPos->x, lpptPos->y, bDir);
- m_bFireHitCnt = 2;
- }
- else if ( m_bYedoCnt == 1 )
- {
- SetMotionFrame(_MT_ONEVSWING, bDir);
- LoadEffect(&g_xGameProc.m_xImage, _SKILL_YEDO, bDir);
- m_bUseSwordEffect = TRUE;
- g_xClientSocket.SendActMsg(CM_POWERHIT, lpptPos->x, lpptPos->y, bDir);
- m_bYedoCnt = 2;
- }
- else if ( m_bUseBanwol && m_stAbility.wMP > 3 )
- {
- SetMotionFrame(_MT_ONEHSWING, bDir);
- LoadEffect(&g_xGameProc.m_xImage, _SKILL_BANWOL, bDir);
- m_bUseSwordEffect = TRUE;
- g_xClientSocket.SendActMsg(CM_WIDEHIT, lpptPos->x, lpptPos->y, bDir);
- }
- else
- {
- SetMotionFrame(m_bAttackMode, bDir);
- if ( m_bAttackMode == _MT_WHEELWIND )
- {
- LoadEffect(&g_xGameProc.m_xImage, _SKILL_JUMPSHOT, bDir);
- m_bUseSwordEffect = TRUE;
- }
- else if ( m_bAttackMode == _MT_RANDSWING )
- {
- LoadEffect(&g_xGameProc.m_xImage, _SKILL_RANDSWING, bDir);
- m_bUseSwordEffect = TRUE;
- }
- WORD wAttackStyle;
- if ( m_bAttackMode != _MT_ONEVSWING && m_bAttackMode != _MT_ONEHSWING )
- wAttackStyle = _MT_ONEVSWING;
- else
- {
- wAttackStyle = m_bAttackMode;
- }
- g_xClientSocket.SendHitMsg(CM_HIT, lpptPos->x, lpptPos->y, bDir, wAttackStyle);
- }
- }
- break;
- }
- case _MT_MOODEPO:
- {
- if ( lpptPos )
- {
- g_xClientSocket.SendSpellMsg(shSkill, lpptPos->x, lpptPos->y, 0);
- // 公怕焊 矫埃蔼 扁废.
- m_dwLastRushTime = timeGetTime();
- m_bMotionLock = m_bInputLock = TRUE;
- m_bWarMode = TRUE;
- }
- break;
- }
- case _MT_SPELL2:
- case _MT_SPELL1:
- {
- if ( lpptPos )
- {
- g_xClientSocket.SendSpellMsg(shSkill, lpptPos->x, lpptPos->y, nMouseTargetID);
- m_wOldPosX = m_wPosX;
- m_wOldPosY = m_wPosY;
- m_bOldDir = m_bCurrDir;
- m_bMotionLock = m_bInputLock = TRUE;
- m_bWarMode = TRUE;
- if ( m_shCurrMagicID == _SKILL_FIREBALL || m_shCurrMagicID == _SKILL_FIREBALL2 || m_shCurrMagicID == _SKILL_FIRE || m_shCurrMagicID == _SKILL_SHOOTLIGHTEN ||
- m_shCurrMagicID == _SKILL_HANGMAJINBUB || m_shCurrMagicID== _SKILL_DEJIWONHO || m_shCurrMagicID == _SKILL_FIRECHARM || m_shCurrMagicID == _SKILL_SINSU ||
- m_shCurrMagicID == _SKILL_BIGCLOAK )
- LoadEffect(&g_xGameProc.m_xImage, m_shCurrMagicID, bDir);
- else
- LoadEffect(&g_xGameProc.m_xImage, m_shCurrMagicID);
- m_bUseEffect = TRUE;
- /* if ( m_shCurrMagicID == _SKILL_SHIELD )
- {
- m_dwFstEffectFrame = 50;
- m_dwEndEffectFrame = 60;
- m_dwCurrEffectFrame = 50;
- m_bEffectFrame = 0;
- m_bEffectFrameCnt = _DEFAULT_SPELLFRAME;
- }
- */
- if ( m_shCurrMagicID == _SKILL_SHOWHP )
- m_bEffectFrameCnt = 20;
- else if ( m_shCurrMagicID == _SKILL_LIGHTFLOWER )
- m_bEffectFrameCnt = 15;
- else if ( m_shCurrMagicID == _SKILL_SPACEMOVE )
- m_bEffectFrameCnt = 19;
- else if ( m_shCurrMagicID == _SKILL_LIGHTENING )
- m_bEffectFrameCnt = 17;
- SetMotionFrame(bMtn, bDir);
- }
- break;
- }
- case _MT_CUT:
- {
- m_bInputLock = TRUE;
- m_bMotionLock = TRUE;
- m_wOldPosX = m_wPosX;
- m_wOldPosY = m_wPosY;
- m_bOldDir = m_bCurrDir;
- SetMotionFrame(bMtn, bDir);
- g_xClientSocket.SendActMsg(CM_SITDOWN, m_wPosX, m_wPosY, bDir);
- if ( nMouseTargetID && bIsDead )
- {
- g_xClientSocket.SendButchAnimal(m_wPosX, m_wPosY, bDir, nMouseTargetID);
- }
- break;
- }
- case _MT_HORSESTAND:
- case _MT_STAND:
- {
- if ( bDir != m_bCurrDir )
- {
- g_xClientSocket.SendActMsg(CM_TRUN, m_wPosX, m_wPosY, bDir);
- m_bMotionLock = TRUE;
- m_bInputLock = TRUE;
- m_wOldPosX = m_wPosX;
- m_wOldPosY = m_wPosY;
- m_bOldDir = m_bCurrDir;
- SetMotionFrame(bMtn, bDir);
- }
- break;
- }
- }
- }
- else
- {
- switch ( bMtn )
- {
- case _MT_HORSESTAND:
- case _MT_STAND:
- {
- bMtn = _MT_MON_STAND;
- if ( bDir != m_bCurrDir ) g_xClientSocket.SendActMsg(CM_TRUN, m_wPosX, m_wPosY, bDir);
- // m_bMotionLock = TRUE;
- m_wOldPosX = m_wPosX;
- m_wOldPosY = m_wPosY;
- m_bOldDir = m_bCurrDir;
- SetMotionFrame(bMtn, bDir);
- break;
- }
- case _MT_WALK:
- case _MT_HORSEWALK:
- {
- bMtn = _MT_MON_WALK;
- g_xClientSocket.SendActMsg(CM_WALK, m_wPosX, m_wPosY, bDir);
- m_bMotionLock = m_bInputLock = TRUE;
- m_wOldPosX = m_wPosX;
- m_wOldPosY = m_wPosY;
- m_bOldDir = m_bCurrDir;
- SetMotionFrame(bMtn, bDir);
- m_bMoveSpeed = _SPEED_WALK;
- m_pxMap->ScrollMap(m_bMoveDir, m_dwCurrFrame-m_dwFstFrame, m_bMoveSpeed);
- break;
- }
- case _MT_ONEHSWING:
- {
- bMtn = _MT_MON_ATTACK_A;
- m_bMotionLock = m_bInputLock = TRUE;
- m_wOldPosX = m_wPosX;
- m_wOldPosY = m_wPosY;
- m_bOldDir = m_bCurrDir;
- m_bWarMode = TRUE;
- m_dwWarModeTime = 0;
- SetMotionFrame(_MT_MON_ATTACK_A, bDir);
- g_xClientSocket.SendHitMsg(CM_HIT, lpptPos->x, lpptPos->y, bDir, 0);
- break;
- }
- }
- }
- m_dwMotionLockTime = 0;
- }
- /******************************************************************************************************************
- 窃荐疙 : CMyHero::UpdateMotionState()
- 累己磊 :
- 累己老 :
- 格利 :
- 涝仿 : INT nLoopTime
- 免仿 : VOID
- [老磊][荐沥磊] : 荐沥郴侩
- *******************************************************************************************************************/
- VOID CMyHero::UpdateMotionState(INT nLoopTime, BOOL bIsMoveTime)
- {
- if ( m_bMotionLock )
- m_dwMotionLockTime += nLoopTime;
- if ( m_bWarMode )
- m_dwWarModeTime += nLoopTime;
- m_wABlendCurrDelay += nLoopTime;
- if ( m_wABlendCurrDelay >= m_wABlendDelay )
- {
- m_wABlendCurrDelay = 0;
- m_wABlendDelay = 0;
- m_bABlendRev = FALSE;
- }
- if ( m_bCurrMtn == _MT_DIE && m_dwCurrFrame >= m_dwEndFrame-1 )
- {
- m_bIsDead = TRUE;
- }
- if ( m_bIsDead )
- {
- if ( m_bIsMon )
- SetMotionFrame(_MT_MON_DIE, m_bCurrDir);
- else
- SetMotionFrame(_MT_DIE, m_bCurrDir);
- m_dwCurrFrame = m_dwEndFrame - 1;
- m_bInputLock = TRUE;
- return;
- }
- if ( UpdateMove(bIsMoveTime) )
- {
- UpdatePacketState();
- return;
- }
- else
- {
- if ( !m_bIsMon )
- {
- m_wCurrDelay += nLoopTime;
- m_wShieldCurrDelay += nLoopTime;
- if ( m_wShieldCurrDelay > 150 )
- {
- m_bShieldCurrFrm++;
- m_wShieldCurrDelay = 0;
- if ( m_bShieldCurrFrm > 2 )
- m_bShieldCurrFrm = 0;
- }
- if ( m_wCurrDelay > m_wDelay )
- {
- m_wCurrDelay = 0;
- if ( m_dwCurrFrame < m_dwEndFrame )
- {
- m_dwCurrFrame++;
- PlayActSound();
- if ( (m_bCurrMtn == _MT_SPELL2 || m_bCurrMtn == _MT_SPELL1) && m_bUseEffect )
- {
- m_dwCurrEffectFrame++;
- m_bEffectFrame++;
- }
- }
- }
- UpdatePacketState();
- // 楷加利牢 橇饭烙 吝俊辑 秦具且老.
- if ( m_dwMotionLockTime > _MOTION_LOCKTIME )
- {
- m_dwMotionLockTime = 0;
- m_bMotionLock = FALSE;
- // SetOldPosition();
- }
- if ( m_dwWarModeTime > _WARMODE_TIME )
- {
- m_dwWarModeTime = 0;
- m_bWarMode = FALSE;
- }
- if ( m_dwCurrFrame >= m_dwEndFrame-1 )
- {
- if ( (m_bCurrMtn == _MT_SPELL2) && m_bUseEffect )
- {
- if ( m_dwCurrEffectFrame - m_dwFstEffectFrame < m_bEffectFrameCnt-2 )
- {
- m_dwCurrFrame = m_dwEndFrame - 2;
- }
- }
- }
- else if ( m_dwCurrFrame >= m_dwEndFrame-3 )
- {
- if ( (m_bCurrMtn == _MT_SPELL1) && m_bUseEffect )
- {
- if ( m_dwCurrEffectFrame - m_dwFstEffectFrame < m_bEffectFrameCnt-5 )
- {
- m_dwCurrFrame = m_dwEndFrame - 4;
- }
- }
- }
- if ( m_dwCurrFrame >= m_dwEndFrame )
- {
- switch ( m_bCurrMtn )
- {
- case _MT_CUT:
- {
- m_bInputLock = FALSE;
- m_bMotionLock = FALSE;
- m_dwCurrFrame = m_dwFstFrame;
- if ( m_stFeatureEx.bHorse == _HORSE_NONE ) SetMotionFrame(_MT_STAND, m_bCurrDir);
- else SetMotionFrame(_MT_HORSESTAND, m_bCurrDir);
- }
- break;
- case _MT_STAND:
- case _MT_HORSESTAND:
- {
- m_bInputLock = FALSE;
- m_bMotionLock = FALSE;
- m_bUseEffect = FALSE;
- m_bUseSwordEffect = FALSE;
- m_dwCurrFrame = m_dwFstFrame;
- break;
- }
- case _MT_ATTACKMODE:
- {
- if ( !m_bWarMode )
- SetMotionFrame(_MT_STAND, m_bCurrDir);
- else
- {
- m_bInputLock = FALSE;
- m_bMotionLock = FALSE;
- m_dwCurrFrame = m_dwFstFrame;
- }
- break;
- }
- default:
- {
- m_dwCurrEffectFrame = 0;
- m_dwFstEffectFrame = 0;
- m_dwEndEffectFrame = 0;
- m_bEffectFrame = 0;
- m_bEffectFrameCnt = _DEFAULT_SPELLFRAME;
- m_bUseEffect = FALSE;
- m_bUseSwordEffect = FALSE;
- if ( !m_bMotionLock )
- {
- m_bInputLock = FALSE;
- if ( m_stFeatureEx.bHorse == _HORSE_NONE )
- {
- if ( m_bWarMode )
- SetMotionFrame(_MT_ATTACKMODE, m_bCurrDir);
- else
- SetMotionFrame(_MT_STAND, m_bCurrDir);
- }
- else
- {
- SetMotionFrame(_MT_HORSESTAND, m_bCurrDir);
- }
- }
- else
- {
- m_dwCurrFrame = m_dwEndFrame-1;
- }
- }
- break;
- }
- }
- if ( m_bCurrMtn == _MT_STAND || m_bCurrMtn == _MT_HORSESTAND )
- {
- POINT ptMouse;
- GetCursorPos(&ptMouse);
- ScreenToClient(g_xMainWnd.GetSafehWnd(), &ptMouse);
- m_bCanRun = FALSE;
- if ( HIBYTE(GetKeyState(VK_RBUTTON)) || ( HIBYTE(GetKeyState(VK_LBUTTON)) && HIBYTE(GetKeyState(VK_CONTROL))) )
- {
- OnRButtonDown(ptMouse);
- }
- else if ( HIBYTE(GetKeyState(VK_LBUTTON)) )
- {
- OnLButtonDown(ptMouse);
- /* LPARAM lParam = MAKELPARAM((WORD)ptMouse.x, (WORD)ptMouse.y);
- WPARAM wParam = 0;
- g_xGameProc.OnLButtonDown(wParam, lParam);
- */ }
- }
- }
- else
- {
- m_wCurrDelay += nLoopTime;
- m_wShieldCurrDelay += nLoopTime;
- m_wABlendCurrDelay += nLoopTime;
- if ( m_wShieldCurrDelay > 150 )
- {
- m_bShieldCurrFrm++;
- m_wShieldCurrDelay = 0;
- if ( m_bShieldCurrFrm > 2 )
- m_bShieldCurrFrm = 0;
- }
- if ( m_wCurrDelay > m_wDelay )
- {
- m_wCurrDelay = 0;
- if ( m_dwCurrFrame < m_dwEndFrame )
- {
- m_dwCurrFrame++;
- }
- }
- UpdatePacketState();
- // 楷加利牢 橇饭烙 吝俊辑 秦具且老.
- if ( m_dwMotionLockTime > _MOTION_LOCKTIME )
- {
- m_dwMotionLockTime = 0;
- m_bMotionLock = FALSE;
- // SetOldPosition();
- }
- if ( m_dwWarModeTime > _WARMODE_TIME )
- {
- m_dwWarModeTime = 0;
- m_bWarMode = FALSE;
- }
- if ( m_dwCurrFrame >= m_dwEndFrame )
- {
- switch ( m_bCurrMtn )
- {
- case _MT_MON_STAND:
- {
- m_bInputLock = FALSE;
- m_bMotionLock = FALSE;
- m_bUseEffect = FALSE;
- m_bUseSwordEffect = FALSE;
- m_dwCurrFrame = m_dwFstFrame;
- break;
- }
- default:
- {
- m_dwCurrEffectFrame = 0;
- m_dwFstEffectFrame = 0;
- m_dwEndEffectFrame = 0;
- m_bEffectFrame = 0;
- m_bEffectFrameCnt = _DEFAULT_SPELLFRAME;
- m_bUseEffect = FALSE;
- m_bUseSwordEffect = FALSE;
- if ( !m_bMotionLock )
- {
- m_bInputLock = FALSE;
- SetMotionFrame(_MT_MON_STAND, m_bCurrDir);
- }
- else
- {
- m_dwCurrFrame = m_dwEndFrame-1;
- }
- }
- break;
- }
- }
- if ( m_bCurrMtn == _MT_MON_STAND )
- {
- POINT ptMouse;
- GetCursorPos(&ptMouse);
- ScreenToClient(g_xMainWnd.GetSafehWnd(), &ptMouse);
- m_bCanRun = FALSE;
- if ( HIBYTE(GetKeyState(VK_RBUTTON)) || ( HIBYTE(GetKeyState(VK_LBUTTON)) && HIBYTE(GetKeyState(VK_CONTROL))) )
- {
- OnRButtonDown(ptMouse);
- }
- else if ( HIBYTE(GetKeyState(VK_LBUTTON)) )
- {
- OnLButtonDown(ptMouse);
- /* LPARAM lParam = MAKELPARAM((WORD)ptMouse.x, (WORD)ptMouse.y);
- WPARAM wParam = 0;
- g_xGameProc.OnLButtonDown(wParam, lParam);
- */ }
- }
- }
- }
- }
- /******************************************************************************************************************
- 窃荐疙 : CMyHero::UpdateMove(BOOL bIsMoveTime)
- 累己磊 :
- 累己老 :
- 格利 :
- 涝仿 : BOOL bIsMoveTime
- 免仿 : BOOL
- [老磊][荐沥磊] : 荐沥郴侩
- *******************************************************************************************************************/
- BOOL CMyHero::UpdateMove(BOOL bIsMoveTime)
- {
- if ( !m_bIsMon )
- {
- if ( m_bCurrMtn == _MT_WALK || m_bCurrMtn == _MT_RUN || m_bCurrMtn == _MT_HORSEWALK || m_bCurrMtn == _MT_HORSERUN || m_bCurrMtn == _MT_MOODEPO || m_bCurrMtn == _MT_PUSHBACK)
- {
- m_wCurrDelay = 0;
- if ( bIsMoveTime )
- {
- if ( m_bCurrMtn == _MT_PUSHBACK )
- {
- m_bBackStepFrame += 2;
- if ( m_bBackStepFrame >= m_bBackStepFrameCnt )
- {
- m_dwCurrFrame++;
- m_bBackStepFrame = m_bBackStepFrameCnt;
- }
- }
- else if ( m_bCurrMtn == _MT_MOODEPO )
- {
- m_dwCurrFrame += 2;
- if ( m_dwCurrFrame >= m_dwEndFrame )
- {
- m_dwCurrFrame = m_dwEndFrame;
- }
- }
- else
- {
- m_dwCurrFrame++;
- PlayMoveSound();
- /* if ( m_bMsgHurryCheck )
- {
- m_dwCurrFrame++;
- }
- */ }
- if ( m_bCurrMtn == _MT_PUSHBACK )
- {
- if ( m_bBackStepFrame >= m_bBackStepFrameCnt-m_bMoveNextFrmCnt && !m_bIsMoved )
- {
- SetMoved();
- m_bIsMoved = TRUE;
- }
- }
- else
- {
- if ( m_dwCurrFrame >= m_dwEndFrame-m_bMoveNextFrmCnt && !m_bIsMoved )
- {
- SetMoved();
- m_bIsMoved = TRUE;
- }
- }
- }
- // 楷加利牢 橇饭烙 吝俊辑 秦具且老.
- if ( m_dwCurrFrame >= m_dwEndFrame )
- {
- m_dwCurrFrame = m_dwEndFrame-1;
- m_bCanRun = FALSE;
- switch ( m_bCurrMtn )
- {
- case _MT_MOODEPO:
- {
- if ( m_bInputLock )
- {
- m_bIsMoved = FALSE;
- m_bInputLock = FALSE;
- m_pxMap->SetMovedTileBuffer(m_shShiftTileX, m_shShiftTileY);
- m_bMoveSpeed = 0;
- m_shShiftPixelX = 0;
- m_shShiftPixelY = 0;
- m_shShiftTileX = 0;
- m_shShiftTileY = 0;
- // 捞悼饶 谅钎犬牢.
- if ( CheckMyPostion() == FALSE )
- AdjustMyPostion();
- if ( m_bWarMode )
- SetMotionFrame(_MT_ATTACKMODE, m_bCurrDir);
- else
- SetMotionFrame(_MT_STAND, m_bCurrDir);
- }
- break;
- }
- case _MT_PUSHBACK:
- {
- if ( m_bInputLock )
- {
- m_bIsMoved = FALSE;
- m_bInputLock = FALSE;
- m_pxMap->SetMovedTileBuffer(m_shShiftTileX, m_shShiftTileY);
- m_bMoveSpeed = 0;
- m_shShiftPixelX = 0;
- m_shShiftPixelY = 0;
- m_shShiftTileX = 0;
- m_shShiftTileY = 0;
- m_bBackStepFrame = 0;
- m_bBackStepFrameCnt = 0;
- // 捞悼饶 谅钎犬牢.
- if ( CheckMyPostion() == FALSE )
- AdjustMyPostion();
- if ( m_bWarMode )
- SetMotionFrame(_MT_ATTACKMODE, m_bCurrDir);
- else
- SetMotionFrame(_MT_STAND, m_bCurrDir);
- }
- break;
- }
- case _MT_WALK:
- case _MT_HORSEWALK:
- {
- if ( !m_bMotionLock && m_bInputLock )
- {
- m_bIsMoved = FALSE;
- m_bInputLock = FALSE;
- m_pxMap->SetMovedTileBuffer(m_shShiftTileX, m_shShiftTileY);
- m_bMoveSpeed = 0;
- m_shShiftPixelX = 0;
- m_shShiftPixelY = 0;
- m_shShiftTileX = 0;
- m_shShiftTileY = 0;
- if ( m_bCurrMtn == _MT_WALK && m_stFeatureEx.bHorse == _HORSE_NONE )
- {
- if ( m_bWarMode )
- {
- SetMotionFrame(_MT_ATTACKMODE, m_bCurrDir);
- }
- else SetMotionFrame(_MT_STAND, m_bCurrDir);
- }
- else SetMotionFrame(_MT_HORSESTAND, m_bCurrDir);
- // 捞悼饶 谅钎犬牢.
- if ( CheckMyPostion() == FALSE )
- AdjustMyPostion();
- POINT ptMouse;
- GetCursorPos(&ptMouse);
- ScreenToClient(g_xMainWnd.GetSafehWnd(), &ptMouse);
- if ( HIBYTE(GetKeyState(VK_RBUTTON)) || ( HIBYTE(GetKeyState(VK_LBUTTON)) && HIBYTE(GetKeyState(VK_CONTROL))) )
- {
- m_bCanRun = TRUE;
- OnRButtonDown(ptMouse);
- }
- else if ( HIBYTE(GetKeyState(VK_LBUTTON)) )
- {
- OnLButtonDown(ptMouse);
- }
- }
- break;
- }
- case _MT_RUN:
- case _MT_HORSERUN:
- {
- if ( !m_bMotionLock && m_bInputLock )
- {
- m_bIsMoved = FALSE;
- m_bInputLock = FALSE;
- m_pxMap->SetMovedTileBuffer(m_shShiftTileX, m_shShiftTileX);
- m_bMoveSpeed = 0;
- m_shShiftPixelX = 0;
- m_shShiftPixelY = 0;
- m_shShiftTileX = 0;
- m_shShiftTileY = 0;
- if ( m_bCurrMtn == _MT_RUN && m_stFeatureEx.bHorse == _HORSE_NONE )
- {
- if ( m_bWarMode )
- {
- SetMotionFrame(_MT_ATTACKMODE, m_bCurrDir);
- }
- else SetMotionFrame(_MT_STAND, m_bCurrDir);
- }
- else SetMotionFrame(_MT_HORSESTAND, m_bCurrDir);
- if ( CheckMyPostion() == FALSE )
- AdjustMyPostion();
- POINT ptMouse;
- GetCursorPos(&ptMouse);
- ScreenToClient(g_xMainWnd.GetSafehWnd(), &ptMouse);
- if ( HIBYTE(GetKeyState(VK_RBUTTON)) || ( HIBYTE(GetKeyState(VK_LBUTTON)) && HIBYTE(GetKeyState(VK_CONTROL))) )
- {
- m_bCanRun = TRUE;
- OnRButtonDown(ptMouse);
- }
- else if ( HIBYTE(GetKeyState(VK_LBUTTON)) )
- {
- OnLButtonDown(ptMouse);
- }
- }
- break;
- }
- }
- }
- else
- {
- switch ( m_bCurrMtn )
- {
- case _MT_WALK:
- case _MT_RUN:
- case _MT_HORSEWALK:
- case _MT_HORSERUN:
- case _MT_MOODEPO:
- m_pxMap->ScrollMap(m_bMoveDir, m_dwCurrFrame-m_dwFstFrame, m_bMoveSpeed);
- // m_pxMap->ScrollMap(m_bMoveDir, m_wCurrDelay, m_wDelay*(m_dwEndFrame-m_dwFstFrame), m_bMoveSpeed);
- break;
- case _MT_PUSHBACK:
- m_pxMap->ScrollMap(m_bMoveDir, m_bBackStepFrame, m_bMoveSpeed);
- break;
- }
- }
- // 楷加利牢 橇饭烙 吝俊辑 秦具且老.
- if ( m_dwMotionLockTime > _MOTION_LOCKTIME )
- {
- m_dwMotionLockTime = 0;
- m_bMotionLock = FALSE;
- // SetOldPosition();
- }
- if ( m_dwWarModeTime > _WARMODE_TIME )
- {
- m_dwWarModeTime = 0;
- m_bWarMode = FALSE;
- }
- return TRUE;
- }
- }
- else
- {
- if ( m_bCurrMtn == _MT_MON_WALK )
- {
- m_wCurrDelay = 0;
- if ( bIsMoveTime )
- {
- m_dwCurrFrame++;
- if ( m_dwCurrFrame >= m_dwEndFrame-m_bMoveNextFrmCnt && !m_bIsMoved )
- {
- SetMoved();
- m_bIsMoved = TRUE;
- }
- }
- if ( m_dwCurrFrame >= m_dwEndFrame )
- {
- m_dwCurrFrame = m_dwEndFrame-1;
- m_bCanRun = FALSE;
- switch ( m_bCurrMtn )
- {
- case _MT_MON_WALK:
- {
- if ( !m_bMotionLock && m_bInputLock )
- {
- m_bIsMoved = FALSE;
- m_bInputLock = FALSE;
- m_pxMap->SetMovedTileBuffer(m_shShiftTileX, m_shShiftTileY);
- m_bMoveSpeed = 0;
- m_shShiftPixelX = 0;
- m_shShiftPixelY = 0;
- m_shShiftTileX = 0;
- m_shShiftTileY = 0;
-
- SetMotionFrame(_MT_MON_STAND, m_bCurrDir);
- // 捞悼饶 谅钎犬牢.
- if ( CheckMyPostion() == FALSE )
- AdjustMyPostion();
- POINT ptMouse;
- GetCursorPos(&ptMouse);
- ScreenToClient(g_xMainWnd.GetSafehWnd(), &ptMouse);
- if ( HIBYTE(GetKeyState(VK_LBUTTON)) )
- {
- OnLButtonDown(ptMouse);
- }
- }
- break;
- }
- }
- }
- else
- {
- switch ( m_bCurrMtn )
- {
- case _MT_MON_WALK:
- m_pxMap->ScrollMap(m_bMoveDir, m_dwCurrFrame-m_dwFstFrame, m_bMoveSpeed);
- break;
- }
- }
- // 楷加利牢 橇饭烙 吝俊辑 秦具且老.
- if ( m_dwMotionLockTime > _MOTION_LOCKTIME )
- {
- m_dwMotionLockTime = 0;
- m_bMotionLock = FALSE;
- // SetOldPosition();
- }
- if ( m_dwWarModeTime > _WARMODE_TIME )
- {
- m_dwWarModeTime = 0;
- m_bWarMode = FALSE;
- }
- return TRUE;
- }
- }
- return FALSE;
- }
- /******************************************************************************************************************
- 窃荐疙 : CMyHero:DrawActor()
- 累己磊 :
- 累己老 :
- 格利 :
- 涝仿 : BOOL bFocused
- BOOL bShadowAblended
- 免仿 : BOOL
- [老磊][荐沥磊] : 荐沥郴侩
- *******************************************************************************************************************/
- BOOL CMyHero::DrawActor(BOOL bFocused, BOOL bShadowAblended, BOOL bUseScrnPos, BOOL bDrawShadow)
- {
- // 某腐磐 谅钎绰 绊沥.
- m_shScrnPosX = _CHAR_CENTER_XPOS - 24;
- m_shScrnPosY = _CHAR_CENTER_YPOS - 16;
- if ( m_bIsMon )
- {
- if ( CActor::DrawActor(m_pxMap, bFocused, bShadowAblended, bUseScrnPos, bDrawShadow) )
- return TRUE;
- }
- else
- {
- if ( CHero::DrawActor(m_pxMap, bFocused, bShadowAblended, bUseScrnPos, bDrawShadow) )
- return TRUE;
- }
- return FALSE;
- }
- /******************************************************************************************************************
- 窃荐疙 : CMyHero::CalcDirection()
- 累己磊 :
- 累己老 :
- 格利 :
- 涝仿 : INT nTargetTileX
- INT nTargetTileY
- 免仿 :
- [老磊][荐沥磊] : 荐沥郴侩
- *******************************************************************************************************************/
- BYTE CMyHero::CalcDirection(INT nTargetTileX, INT nTargetTileY)
- {
- INT nWidth = nTargetTileX - m_wPosX;
- INT nHeight = nTargetTileY - m_wPosY;
- FLOAT rLineLength, rBottomInTriangle;
- INT nDimension;
- BYTE bDir;
- rLineLength = (FLOAT)sqrt(nWidth*nWidth+nHeight*nHeight);
-
- // 扁夯.
- // 7 0 1
- // 6 2
- // 5 4 3
- // 老窜篮 4俺狼 盒搁(90档扁霖)栏肺 唱穿绊 盒搁俊 措茄 cos蔼阑 利侩茄促.
- ( nWidth >= 0 ) ?
- ( nHeight < 0 ? (rBottomInTriangle=(FLOAT)-nHeight, nDimension=0) : (rBottomInTriangle=(FLOAT) nWidth, nDimension=2) ):
- ( nHeight >= 0 ? (rBottomInTriangle=(FLOAT) nHeight, nDimension=4) : (rBottomInTriangle=(FLOAT)-nWidth, nDimension=6) );
- // 6(cos45) 0(cos 0) 0(cos45)
- // 4(cos90) 2(cos 0) 2(cos 0)
- // 4(cos45) 2(cos90) 2(cos45)
- FLOAT rCosVal = rBottomInTriangle/rLineLength;
-
- // cos(0), cos(pi/8), cos(pi/4), cos(pi/2)
- CONST FLOAT rCosVal8[4] = { 1.0f, 0.923880f, 0.707107f, 0.382683f };
-
- // 阿盒搁阑 3俺狼 康开栏肺 唱穿绢辑 康开阑 犁炼沥茄促.
- bDir = 0;
- for ( INT nCnt = 0; nCnt < 4; nCnt++ )
- {
- if( rCosVal <= rCosVal8[nCnt] )
- bDir = nDimension+(nCnt+1)/2;
- else break;
- }
-
- if( bDir >= 8 ) bDir = 0;
-
- return bDir;
- }
- /******************************************************************************************************************
- 窃荐疙 : CMyHero::GetPosMouseToTile()
- 累己磊 :
- 累己老 :
- 格利 :
- 涝仿 : INT nXPos
- INT nYPos
- 免仿 : POINT
- [老磊][荐沥磊] : 荐沥郴侩
- *******************************************************************************************************************/
- POINT CMyHero::GetPosMouseToTile(INT nXPos, INT nYPos)
- {
- POINT ptTilePos;
- if ( m_pxMap )
- {
- ptTilePos.x = m_pxMap->m_shStartViewTileX + (nXPos - _VIEW_CELL_X_START) / _CELL_WIDTH;
- ptTilePos.y = m_pxMap->m_shStartViewTileY + (nYPos - _VIEW_CELL_Y_START) / _CELL_HEIGHT;
- }
- return ptTilePos;
- }
- BOOL CMyHero::CanNextHit()
- {
- DWORD dwCurrTick;
- INT nNextHit, nLevelFast;
- BOOL bAttackSlow = FALSE;
- nLevelFast = min(370, m_stAbility.bLevel*14);
- nLevelFast = min(800, nLevelFast + m_shHitSpeed * 60);
- if ( m_stAbility.bHandWeight > m_stAbility.bMaxHandWeight )
- bAttackSlow = TRUE;
- if ( bAttackSlow ) nNextHit = 1400 - nLevelFast + 1500;
- else nNextHit = 1400 - nLevelFast;
- dwCurrTick = timeGetTime();
- if ( dwCurrTick - m_dwLastHitTime > nNextHit )
- {
- m_dwLastHitTime = dwCurrTick;
- return TRUE;
- }
- return FALSE;
- }
- BOOL CMyHero::CanWalk()
- {
- if ( timeGetTime() - m_dwLastSpellTime < m_wMagicPKDelayTime )
- return TRUE;
- return FALSE;
- }
- BOOL CMyHero::CanRun()
- {
- if ( m_stAbility.wHP < _RUN_MINHEALTH )
- return FALSE;
- if ( (timeGetTime() - m_dwLastPKStruckTime < 3000) || (timeGetTime() - m_dwLastSpellTime < m_wMagicPKDelayTime ) )
- return FALSE;
- return TRUE;
- }
- //---------------------------------------------------------------------------------------------------------------//
- // 蜡历 涝仿窃荐.
- //---------------------------------------------------------------------------------------------------------------//
- /******************************************************************************************************************
- 窃荐疙 : CMyHero::OnLButtonDown()
- 累己磊 :
- 累己老 :
- 格利 :
- 涝仿 : POINT ptMouse
- INT nTargetID
- POINT* lpptTargetPos
- 免仿 : BOOL
- [老磊][荐沥磊] : 荐沥郴侩
- *******************************************************************************************************************/
- BOOL CMyHero::OnLButtonDown(POINT ptMouse, INT nTargetID, BOOL bIsDead, POINT* lpptTargetPos)
- {
- POINT ptTargetTile;
- POINT ptMouseTilePos;
- BYTE bDir;
- if ( g_xGameProc.m_xInterface.OnLButtonDown(ptMouse) )
- return FALSE;
- if ( m_wABlendDelay )
- return FALSE;
- if ( !m_bMotionLock && !m_bInputLock )
- {
- SHORT shLeftMsgCnt = m_xPacketQueue.GetCount();
- if ( shLeftMsgCnt > 0 )
- {
- UpdatePacketState();
- return FALSE;
- }
-
- ptMouseTilePos = GetPosMouseToTile(ptMouse.x, ptMouse.y);
- bDir = CalcDirection(ptMouseTilePos.x, ptMouseTilePos.y);
- if ( m_wPosX == ptMouseTilePos.x && m_wPosY == ptMouseTilePos.y )
- bDir = m_bCurrDir;
- INT nLength;
- if ( lpptTargetPos )
- nLength = (INT)sqrt((m_wPosX-lpptTargetPos->x)*(m_wPosX-lpptTargetPos->x) + (m_wPosY-lpptTargetPos->y)*(m_wPosY-lpptTargetPos->y));
- else
- nLength = (INT)sqrt((m_wPosX-ptMouseTilePos.x)*(m_wPosX-ptMouseTilePos.x) + (m_wPosY-ptMouseTilePos.y)*(m_wPosY-ptMouseTilePos.y));
- // 1. SHIFT.(碍力 傍拜)
- if ( HIBYTE(GetKeyState(VK_SHIFT)) )
- {
- if ( m_stFeatureEx.bHorse == _HORSE_NONE )
- {
- if ( m_bUseErgum && g_xGameProc.TargetInLongAttack(bDir) )
- {
- if ( m_stFeatureEx.bHorse == _HORSE_NONE && !bIsDead )
- {
- // 傍拜茄促.
- ptTargetTile.x = m_wPosX;
- ptTargetTile.y = m_wPosY;
- SetMotionState(_MT_ONEHSWING, bDir, nTargetID, bIsDead, &ptTargetTile);
- }
- }
- else
- {
- ptTargetTile.x = m_wPosX;
- ptTargetTile.y = m_wPosY;
- SetMotionState(_MT_ONEHSWING, bDir, nTargetID, bIsDead, &ptTargetTile);
- }
- }
- }
- // 2. ALT.(戒扁)
- else if ( HIBYTE(GetKeyState(VK_MENU)) )
- {
- SetMotionState(_MT_CUT, bDir, nTargetID, bIsDead, &ptTargetTile);
- }
- /*
- // 3. 努腐茄鸥老捞 郴 某腐磐啊 困摹茄 镑牢啊?
- else if ()
- {
- // 酒捞袍捞 乐绰啊?
- if ()
- {
- // 酒捞袍阑 凛绰促.
- }
- }*/
- // 4. 努腐茄 谅钎啊 Actor 康开 救俊 乐绰啊?
- else if ( nTargetID != -1 && lpptTargetPos )
- {
- //1. 鸥百 鸥老狼 困摹啊 1鸥老 捞郴牢啊?
- if ( nLength < 2 && nLength > 0 )
- {
- if ( m_stFeatureEx.bHorse == _HORSE_NONE && !bIsDead )
- {
- // 傍拜茄促.
- ptTargetTile.x = m_wPosX;
- ptTargetTile.y = m_wPosY;
- bDir = CalcDirection(lpptTargetPos->x, lpptTargetPos->y);
- SetMotionState(_MT_ONEHSWING, bDir, nTargetID, bIsDead, &ptTargetTile);
- }
- }
- // Actor啊 乐绰 规氢栏肺 捞悼 啊瓷茄啊?(甘加己眉农)
- else if ( m_pxMap->GetNextTileCanMove(m_wPosX, m_wPosY, bDir, 1, &ptTargetTile) && nLength > 0)
- {
- // 1鸥老 捞悼茄促.
- if ( m_stFeatureEx.bHorse == _HORSE_NONE ) SetMotionState(_MT_WALK, bDir, nTargetID, bIsDead, &ptTargetTile);
- else SetMotionState(_MT_HORSEWALK, bDir, nTargetID, bIsDead, &ptTargetTile);
- }
- else
- {
- if ( m_stFeatureEx.bHorse == _HORSE_NONE ) SetMotionState(_MT_STAND, bDir);
- else SetMotionState(_MT_HORSESTAND, bDir);
- }
- /*// Actor啊 NPC牢啊?
- if ()
- {
- // 措拳芒捞唱 惑痢芒阑 楷促.
- }
- // Actor啊 傍拜 啊瓷茄啊?
- else if()
- {
- // Actor狼 困摹啊 1鸥老 郴牢啊?
- if ()
- {
- // 傍拜茄促.
- }
- // Actor啊 乐绰 规氢栏肺 捞悼 啊瓷茄啊?(甘加己眉农)
- else if ()
- {
- // 1鸥老 捞悼茄促.
- }
- }*/
- }
- // 6. 泅犁 付快胶鸥老规氢栏肺 捞悼 啊瓷茄啊?(甘加己眉农)
- else if ( m_pxMap->GetNextTileCanMove(m_wPosX, m_wPosY, bDir, 1, &ptTargetTile) && nLength > 0 )
- {
- // 1鸥老 捞悼茄促.
- if ( m_stFeatureEx.bHorse == _HORSE_NONE ) SetMotionState(_MT_WALK, bDir, nTargetID, bIsDead, &ptTargetTile);
- else SetMotionState(_MT_HORSEWALK, bDir, nTargetID, bIsDead, &ptTargetTile);
- }
- // 7. 捞悼 且荐 绝促搁 林函俊 捞悼且荐 乐绰 鸥老阑 茫酒郴绢 格利 鸥老苞狼 啊厘 啊鳖款 鸥老阑 茫酒辰促.
- else if ( !m_pxMap->GetNextTileCanMove(m_wPosX, m_wPosY, bDir, 1, &ptTargetTile) )
- {
- INT nSelectedDir = -1;
- INT nDistance;
- INT nSelectedDistance = 100;
- for ( INT nCnt = 0; nCnt < _MAX_DIRECTION; nCnt++ )
- {
- if ( m_pxMap->GetNextTileCanMove(m_wPosX, m_wPosY, nCnt, 1, &ptTargetTile) )
- {
- nDistance = (INT)(sqrt((ptTargetTile.x-ptMouseTilePos.x)*(ptTargetTile.x-ptMouseTilePos.x) +
- (ptTargetTile.y-ptMouseTilePos.y)*(ptTargetTile.y-ptMouseTilePos.y)));
- if ( nDistance <= nSelectedDistance )
- {
- nSelectedDistance = nDistance;
- nSelectedDir = nCnt;
- }
- }
- }
- if ( nSelectedDir != -1 && nDistance > 0 )
- {
- // 1鸥老 捞悼茄促.
- m_pxMap->GetNextTileCanMove(m_wPosX, m_wPosY, nSelectedDir, 1, &ptTargetTile);
- if ( m_stFeatureEx.bHorse == _HORSE_NONE ) SetMotionState(_MT_WALK, nSelectedDir, nTargetID, bIsDead, &ptTargetTile);
- else SetMotionState(_MT_HORSEWALK, nSelectedDir, nTargetID, bIsDead, &ptTargetTile);
- }
- else
- {
- if ( m_stFeatureEx.bHorse == _HORSE_NONE ) SetMotionState(_MT_STAND, bDir);
- else SetMotionState(_MT_HORSESTAND, bDir);
- }
- }
- else
- {
- if ( m_stFeatureEx.bHorse == _HORSE_NONE ) SetMotionState(_MT_STAND, bDir);
- else SetMotionState(_MT_HORSESTAND, bDir);
- }
- }
- return FALSE;
- }
- /******************************************************************************************************************
- 窃荐疙 : CMyHero::OnRButtonDown()
- 累己磊 :
- 累己老 :
- 格利 :
- 涝仿 : POINT ptMouse
- 免仿 : BOOL
- [老磊][荐沥磊] : 荐沥郴侩
- *******************************************************************************************************************/
- BOOL CMyHero::OnRButtonDown(POINT ptMouse)
- {
- POINT ptTargetTile;
- POINT ptMouseTilePos;
- BYTE bDir;
- if ( m_wABlendDelay )
- return FALSE;
- if ( !m_bMotionLock && !m_bInputLock )
- {
- SHORT shLeftMsgCnt = m_xPacketQueue.GetCount();
- if ( shLeftMsgCnt > 0 )
- {
- UpdatePacketState();
- return FALSE;
- }
-
- ptMouseTilePos = GetPosMouseToTile(ptMouse.x, ptMouse.y);
- bDir = CalcDirection(ptMouseTilePos.x, ptMouseTilePos.y);
- //1. 鸥百 鸥老狼 困摹啊 1鸥老 捞郴牢啊?
- if ( (INT)(sqrt((m_wPosX-ptMouseTilePos.x)*(m_wPosX-ptMouseTilePos.x) + (m_wPosY-ptMouseTilePos.y)*(m_wPosY-ptMouseTilePos.y)))
- < 2 )
- {
- // 规氢阑 官槽促.
- if ( m_stFeatureEx.bHorse == _HORSE_NONE ) SetMotionState(_MT_STAND, bDir);
- else SetMotionState(_MT_HORSESTAND, bDir);
- }
- //2. 框流牢促.
- else
- {
- // 崔副荐 乐阑锭.
- if ( m_bCanRun )
- {
- m_bCanRun = FALSE;
- if ( m_stFeatureEx.bHorse != _HORSE_NONE )
- {
- // 格利瘤鸥老苞狼 规氢栏肺 1, 2, 3鸥老掳狼 困摹俊 规秦拱捞 绝阑锭.
- if ( m_pxMap->GetNextTileCanMove(m_wPosX, m_wPosY, bDir, 1, &ptTargetTile) &&
- m_pxMap->GetNextTileCanMove(m_wPosX, m_wPosY, bDir, 2, &ptTargetTile) &&
- m_pxMap->GetNextTileCanMove(m_wPosX, m_wPosY, bDir, 3, &ptTargetTile) )
- {
- // 3鸥老 捞悼茄促.
- m_pxMap->GetNextTileCanMove(m_wPosX, m_wPosY, bDir, 3, &ptTargetTile);
- SetMotionState(_MT_HORSERUN, bDir, 0, FALSE, &ptTargetTile);
- }
- // 格利瘤鸥老苞狼 规氢栏肺 1鸥老掳狼 困摹俊 规秦拱捞 绝阑锭.
- else if ( m_pxMap->GetNextTileCanMove(m_wPosX, m_wPosY, bDir, 1, &ptTargetTile) )
- {
- SetMotionState(_MT_HORSEWALK, bDir, 0, FALSE, &ptTargetTile);
- }
- // 格利瘤鸥老苞狼 规氢栏肺 1鸥老掳狼 困摹俊 规秦拱捞 乐阑锭.
- else
- {
- INT nSelectedDir = -1;
- INT nDistance;
- INT nSelectedDistance = 100;
- for ( INT nCnt = 0; nCnt < _MAX_DIRECTION; nCnt++ )
- {
- if ( m_pxMap->GetNextTileCanMove(m_wPosX, m_wPosY, nCnt, 1, &ptTargetTile) )
- {
- nDistance = (INT)(sqrt((ptTargetTile.x-ptMouseTilePos.x)*(ptTargetTile.x-ptMouseTilePos.x) +
- (ptTargetTile.y-ptMouseTilePos.y)*(ptTargetTile.y-ptMouseTilePos.y)));
- if ( nDistance <= nSelectedDistance )
- {
- nSelectedDistance = nDistance;
- nSelectedDir = nCnt;
- }
- }
- }
- if ( nSelectedDir != -1 )
- {
- // 1鸥老 捞悼茄促.
- m_pxMap->GetNextTileCanMove(m_wPosX, m_wPosY, nSelectedDir, 1, &ptTargetTile);
- SetMotionState(_MT_HORSEWALK, nSelectedDir, 0, FALSE, &ptTargetTile);
- }
- else
- {
- SetMotionState(_MT_HORSESTAND, nSelectedDir);
- }
- }
- }
- // 富阑 救鸥绊 乐阑锭.
- else
- {
- // 格利瘤鸥老苞狼 规氢栏肺 1, 2鸥老掳狼 困摹俊 规秦拱捞 绝阑锭.
- if ( m_pxMap->GetNextTileCanMove(m_wPosX, m_wPosY, bDir, 1, &ptTargetTile) &&
- m_pxMap->GetNextTileCanMove(m_wPosX, m_wPosY, bDir, 2, &ptTargetTile) )
- {
- // 2鸥老 捞悼茄促.
- m_pxMap->GetNextTileCanMove(m_wPosX, m_wPosY, bDir, 2, &ptTargetTile);
- SetMotionState(_MT_RUN, bDir, 0, FALSE, &ptTargetTile);
- }
- // 格利瘤鸥老苞狼 规氢栏肺 1鸥老掳狼 困摹俊 规秦拱捞 绝阑锭.
- else if ( m_pxMap->GetNextTileCanMove(m_wPosX, m_wPosY, bDir, 1, &ptTargetTile) )
- {
- SetMotionState(_MT_WALK, bDir, 0, FALSE, &ptTargetTile);
- }
- // 格利瘤鸥老苞狼 规氢栏肺 1鸥老掳狼 困摹俊 规秦拱捞 乐阑锭.
- else
- {
- INT nSelectedDir = -1;
- INT nDistance;
- INT nSelectedDistance = 100;
- for ( INT nCnt = 0; nCnt < _MAX_DIRECTION; nCnt++ )
- {
- if ( m_pxMap->GetNextTileCanMove(m_wPosX, m_wPosY, nCnt, 1, &ptTargetTile) )
- {
- nDistance = (INT)(sqrt((ptTargetTile.x-ptMouseTilePos.x)*(ptTargetTile.x-ptMouseTilePos.x) +
- (ptTargetTile.y-ptMouseTilePos.y)*(ptTargetTile.y-ptMouseTilePos.y)));
- if ( nDistance <= nSelectedDistance )
- {
- nSelectedDistance = nDistance;
- nSelectedDir = nCnt;
- }
- }
- }
- if ( nSelectedDir != -1 )
- {
- // 1鸥老 捞悼茄促.
- m_pxMap->GetNextTileCanMove(m_wPosX, m_wPosY, nSelectedDir, 1, &ptTargetTile);
- SetMotionState(_MT_WALK, nSelectedDir, 0, FALSE, &ptTargetTile);
- }
- else
- {
- SetMotionState(_MT_STAND, nSelectedDir);
- }
- }
- }
- }
- else
- {
- // 格利瘤鸥老苞狼 规氢栏肺 1鸥老掳狼 困摹俊 规秦拱捞 绝阑锭.
- if ( m_pxMap->GetNextTileCanMove(m_wPosX, m_wPosY, bDir, 1, &ptTargetTile) )
- {
- if ( m_stFeatureEx.bHorse == _HORSE_NONE ) SetMotionState(_MT_WALK, bDir, 0, FALSE, &ptTargetTile);
- else SetMotionState(_MT_HORSEWALK, bDir, 0, FALSE, &ptTargetTile);
- }
- // 格利瘤鸥老苞狼 规氢栏肺 1鸥老掳狼 困摹俊 规秦拱捞 乐阑锭.
- else
- {
- INT nSelectedDir = -1;
- INT nDistance;
- INT nSelectedDistance = 100;
- for ( INT nCnt = 0; nCnt < _MAX_DIRECTION; nCnt++ )
- {
- if ( m_pxMap->GetNextTileCanMove(m_wPosX, m_wPosY, nCnt, 1, &ptTargetTile) )
- {
- nDistance = (INT)(sqrt((ptTargetTile.x-ptMouseTilePos.x)*(ptTargetTile.x-ptMouseTilePos.x) +
- (ptTargetTile.y-ptMouseTilePos.y)*(ptTargetTile.y-ptMouseTilePos.y)));
- if ( nDistance <= nSelectedDistance )
- {
- nSelectedDistance = nDistance;
- nSelectedDir = nCnt;
- }
- }
- }
- if ( nSelectedDir != -1 )
- {
- // 1鸥老 捞悼茄促.
- m_pxMap->GetNextTileCanMove(m_wPosX, m_wPosY, nSelectedDir, 1, &ptTargetTile);
- if ( m_stFeatureEx.bHorse == _HORSE_NONE ) SetMotionState(_MT_WALK, nSelectedDir, 0, FALSE, &ptTargetTile);
- else SetMotionState(_MT_HORSEWALK, nSelectedDir, 0, FALSE, &ptTargetTile);
- }
- else
- {
- if ( m_stFeatureEx.bHorse == _HORSE_NONE ) SetMotionState(_MT_STAND, bDir);
- else SetMotionState(_MT_HORSESTAND, bDir);
- }
- }
- }
- }
- }
- return FALSE;
- }
- VOID CMyHero::SetMagic(LPCLIENTMAGICRCD pstMagic, BYTE bKeyNum, BYTE bDir, INT nTargetID, FEATURE stTargetFeature, POINT ptTargetPos)
- {
- DWORD dwCurrTick = timeGetTime();
- if ( !m_bMotionLock && !m_bInputLock )
- {
- switch ( m_shCurrMagicID )
- {
- case _SKILL_MOOTEBO:
- if ( dwCurrTick - m_dwLastRushTime > 3000 )
- {
- SetMotionState(_MT_MOODEPO, bDir, 0, FALSE, &ptTargetPos, m_shCurrMagicID);
- // SetMotionState(_MT_MOODEPO, bDir, &ptTargetPos, bKeyNum, 0);
- }
- break;
- case _SKILL_HANGMAJINBUB:
- case _SKILL_DEJIWONHO:
- case _SKILL_FIRECHARM:
- case _SKILL_FIRE:
- case _SKILL_FIREBALL2:
- case _SKILL_SINSU:
- case _SKILL_FIREBALL:
- case _SKILL_SHOOTLIGHTEN:
- case _SKILL_BIGCLOAK:
- m_dwLastSpellTime = dwCurrTick;
- m_wMagicDelayTime = 200 + pstMagic->stStdMagic.nDelayTime;
- SetMotionState(_MT_SPELL1, bDir, nTargetID, TRUE, &ptTargetPos, m_shCurrMagicID);
- break;
- case _SKILL_FIREWIND:
- case _SKILL_AMYOUNSUL:
- case _SKILL_TAMMING:
- case _SKILL_KILLUNDEAD:
- case _SKILL_HEALLING:
- case _SKILL_HOLYSHIELD:
- case _SKILL_BIGHEALLING:
- case _SKILL_LIGHTFLOWER:
- case _SKILL_SKELLETON:
- case _SKILL_SNOWWIND:
- case _SKILL_SHIELD:
- case _SKILL_SHOWHP:
- case _SKILL_EARTHFIRE:
- case _SKILL_FIREBOOM:
- case _SKILL_SPACEMOVE:
- case _SKILL_CLOAK:
- case _SKILL_LIGHTENING:
- m_dwLastSpellTime = dwCurrTick;
- m_wMagicDelayTime = 200 + pstMagic->stStdMagic.nDelayTime;
- SetMotionState(_MT_SPELL2, bDir, nTargetID, TRUE, &ptTargetPos, m_shCurrMagicID);
- break;
- }
- }
- switch ( m_shCurrMagicID )
- {
- // 堪拳搬.
- case _SKILL_FIRESWORD:
- if ( dwCurrTick - m_dwLastFireHitTime > 10000 )
- g_xClientSocket.SendSpellMsg(m_shCurrMagicID, 0, 0, nTargetID);
- break;
- // 堪拳搬捞寇狼 八过.
- case _SKILL_BANWOL:
- case _SKILL_ERGUM:
- if ( dwCurrTick - m_dwLastSpellTime > 200 )
- {
- m_dwLastSpellTime = dwCurrTick;
- m_wMagicDelayTime = 0;
- g_xClientSocket.SendSpellMsg(m_shCurrMagicID, 0, 0, nTargetID);
- }
- break;
- }
- // 傍拜付过老锭 立加辆丰 给窍霸窍绰 Delay.
- switch ( m_shCurrMagicID )
- {
- case _SKILL_MOOTEBO: case _SKILL_FIRESWORD: case _SKILL_BANWOL: case _SKILL_ERGUM: case _SKILL_FIRECHARM:
- case _SKILL_FIRE: case _SKILL_FIREBALL2: case _SKILL_FIREBALL: case _SKILL_SHOOTLIGHTEN: case _SKILL_AMYOUNSUL:
- case _SKILL_KILLUNDEAD: case _SKILL_LIGHTFLOWER: case _SKILL_SNOWWIND: case _SKILL_EARTHFIRE:
- m_dwLastMagicTime = dwCurrTick;
- break;
- }
- // 荤恩阑 傍拜沁阑锭 框流烙 菩澄萍 Delay.
- m_wMagicPKDelayTime = 0;
- if ( nTargetID )
- {
- if ( stTargetFeature.bGender == 0 || stTargetFeature.bGender == 1 )
- m_wMagicPKDelayTime = 300 + GetRandomNum(1, 1100);
- }
- }
- /******************************************************************************************************************
- 窃荐疙 : CMyHero::OnKeyDown()
- 累己磊 :
- 累己老 :
- 格利 :
- 涝仿 : WPARAM wParam
- LPARAM lParam
- POINT ptMouse
- 免仿 : BOOL
- [老磊][荐沥磊] : 荐沥郴侩
- *******************************************************************************************************************/
- BOOL CMyHero::OnKeyDown(WPARAM wParam, LPARAM lParam, POINT ptMouse, POINT ptTargetPos, INT nMosueTargetID, FEATURE stTargetFeature)
- {
- BYTE bDir, bMagicKey;
- POINT ptTargetTile, ptMouseTilePos;
- LPCLIENTMAGICRCD pstMagic;
- DWORD dwCurrTick;
- bMagicKey = 0;
- ZeroMemory(&ptTargetTile, sizeof(POINT));
- switch ( wParam )
- {
- case 'A':
- {
- }
- case VK_F1: { bMagicKey = '1'; break; }
- case VK_F2: { bMagicKey = '2'; break; }
- case VK_F3: { bMagicKey = '3'; break; }
- case VK_F4: { bMagicKey = '4'; break; }
- case VK_F5: { bMagicKey = '5'; break; }
- case VK_F6: { bMagicKey = '6'; break; }
- case VK_F7: { bMagicKey = '7'; break; }
- case VK_F8: { bMagicKey = '8'; break; }
- case VK_SPACE:
- {
- static INT nMode = 0;
- nMode++;
- switch ( nMode )
- {
- case 0: m_bAttackMode = _MT_ONEHSWING; break;
- case 1: m_bAttackMode = _MT_ONEVSWING; break;
- case 2: m_bAttackMode = _MT_TWOVSWING; break;
- case 3: m_bAttackMode = _MT_TWOHSWING; break;
- case 4: m_bAttackMode = _MT_SPEARVSWING; break;
- case 5: m_bAttackMode = _MT_SPEARHSWING; break;
- case 6: m_bAttackMode = _MT_WHEELWIND; break;
- case 7: m_bAttackMode = _MT_RANDSWING; break;
- case 8: m_bAttackMode = _MT_BACKDROPKICK; break;
- case 9: m_bAttackMode = _MT_ONEHSWING; break;
- }
- if ( nMode > 8 ) nMode = 0;
- break;
- }
- }
- dwCurrTick = timeGetTime();
- // 付过捞侩啊瓷 Delay Time Check.
- if ( dwCurrTick - m_dwLastSpellTime > 500 + m_wMagicDelayTime )
- {
- // 付过捞 力措肺 技泼登菌绰瘤 Check.
- if ( bMagicKey )
- {
- if ( nMosueTargetID == NULL ) ptMouseTilePos = GetPosMouseToTile(ptMouse.x, ptMouse.y);
- else ptMouseTilePos = ptTargetPos;
- bDir = CalcDirection(ptMouseTilePos.x, ptMouseTilePos.y);
- pstMagic = g_xGameProc.m_xInterface.m_xStatusWnd.GetMagicByKey(bMagicKey);
- if ( pstMagic )
- {
- if ( (10 + pstMagic->stStdMagic.bDefSpell) <= m_stAbility.wMP )
- {
- m_shCurrMagicID = pstMagic->stStdMagic.wMagicID;
- SetMagic(pstMagic, bMagicKey, bDir, nMosueTargetID, stTargetFeature, ptMouseTilePos);
- }
- else
- g_xGameProc.m_xInterface.m_xClientSysMsg.AddSysMsg("付仿捞 葛磊而聪促.");
- }
- }
- }
- return TRUE;
- }