Actor.cpp
上传用户:cydong117
上传日期:2009-11-10
资源大小:638k
文件大小:175k
- /******************************************************************************************************************
-
- 葛碘疙:
-
- 累己磊:
- 累己老:
-
- [老磊][荐沥磊] : 荐沥 郴侩
-
- *******************************************************************************************************************/
- #include "StdAfx.h"
- /******************************************************************************************************************
- CActor Class
- *******************************************************************************************************************/
- /******************************************************************************************************************
- 窃荐疙 : CActor::CActor()
- 累己磊 :
- 累己老 :
- 格利 :
- 免仿 :
- [老磊][荐沥磊] : 荐沥郴侩
- *******************************************************************************************************************/
- CActor::CActor()
- {
- InitActor();
- }
- /******************************************************************************************************************
- 窃荐疙 : CActor::~CActor()
- 累己磊 :
- 累己老 :
- 格利 :
- 免仿 :
- [老磊][荐沥磊] : 荐沥郴侩
- *******************************************************************************************************************/
- CActor::~CActor()
- {
- DestroyActor();
- }
- VOID CActor::InitActor()
- {
- m_wOldPosX = 0;
- m_wOldPosY = 0;
- m_bOldDir = 0;
- m_bOpenHealth = FALSE;
- m_bWarMode = FALSE;
- m_bCurrMtn = _MT_MON_STAND;
- m_bCurrDir = _DIRECTION_LIST_1;
- m_bMoveDir = _DIRECTION_LIST_1;
- m_bEffectFrameCnt = _DEFAULT_SPELLFRAME;
- m_bHPPercent = 100;
- m_bMoveNextFrmCnt = 5;
- m_bIsMoved = FALSE;
- m_dwWarModeTime = 0;
- m_wMAXHP = 0;
- m_wHP = 0;
- m_wMP = 0;
- m_wPosX = 0;
- m_wPosY = 0;
- m_bLightSize = 2;
- m_shShiftPixelX = 0;
- m_shShiftPixelY = 0;
- m_shShiftTileX = 0;
- m_shShiftTileY = 0;
- m_bMoveSpeed = 0;
- m_shScrnPosX = 0;
- m_shScrnPosY = 0;
- m_wCurrDelay = 0;
- m_dwFstFrame = 0;
- m_dwEndFrame = 1;
- m_dwCurrFrame = 0;
- m_wDelay = 0;
- m_pxActorImage = NULL;
- m_bMsgHurryCheck = FALSE;
- m_bUseEffect = FALSE;
- m_bUseSwordEffect = FALSE;
- m_bReverse = FALSE;
- m_bIsDead = FALSE;
- m_bABlendRev = FALSE;
- m_dwCurrEffectFrame = 0;
- m_dwFstEffectFrame = 0;
- m_dwEndEffectFrame = 0;
- m_bEffectFrame = 0;
- m_bBackStepFrame = 0;
- m_bBackStepFrameCnt = 0;
- m_nState = 0;
- m_nDividedChatLine = 0;
- m_dwIdentity = 0;
- m_wCurrChatDelay = 0;
- m_wABlendCurrDelay = 0;
- m_wABlendCurrDelay = 0;
- m_bFstSoundPlayed = FALSE;
- m_bAppearState = _DIG_NORMAL;
- m_wStateClr = _STATE_NOTUSED;
- m_dwNameClr = RGB(255, 255, 255);
- m_bActorImgIdx = _IMAGE_M_HUMAN;
- m_bEffectImgIdx = _IMAGE_MAGIC;
- ZeroMemory(m_szName, 64);
- ZeroMemory(&m_stFeature, sizeof(FEATURE));
- ZeroMemory(&m_stHitter, sizeof(FEATURE));
- ZeroMemory(m_bLightRadius, sizeof(BYTE)*2);
- ZeroMemory(m_bLightColor , sizeof(BYTE)*2*3);
- ZeroMemory(m_szChatMsg, MAX_PATH);
- ZeroMemory(m_szChatMsgArg, MAX_PATH*5);
- ZeroMemory(&m_rcActor, sizeof(RECT));
- ZeroMemory(&m_rcTargetRgn, sizeof(RECT));
- D3DVECTOR vNorm(0, 0, -1);
- m_avBoard[0] = D3DVERTEX(D3DVECTOR(-0.5f, 0.5f, 0), vNorm, 0, 0);
- m_avBoard[1] = D3DVERTEX(D3DVECTOR(-0.5f,-0.5f, 0), vNorm, 0, 1);
- m_avBoard[2] = D3DVERTEX(D3DVECTOR( 0.5f, 0.5f, 0), vNorm, 1, 0);
- m_avBoard[3] = D3DVERTEX(D3DVECTOR( 0.5f,-0.5f, 0), vNorm, 1, 1);
- }
- VOID CActor::DestroyActor()
- {
- INT nCnt;
- SHORT shLeftMsgCnt;
- LPPACKETMSG lpPacketMsg;
- lpPacketMsg = NULL;
- shLeftMsgCnt = m_xPacketQueue.GetCount();
- // 阶咯乐绰 菩哦阑 瘤款促.
- if ( shLeftMsgCnt > 0 )
- {
- for ( nCnt = 0; nCnt < shLeftMsgCnt; nCnt++ )
- {
- lpPacketMsg = (LPPACKETMSG)m_xPacketQueue.PopQ();
- if ( lpPacketMsg )
- {
- SAFE_DELETE(lpPacketMsg);
- }
- }
- }
- // 葛电函荐甫 檬扁拳 矫难敌促.
- InitActor();
- }
- WORD CActor::GetCharState()
- {
- WORD wCharState = 0XFFFF;
- // if( m_nState & 0X100000 ) wCharState = _STATE_SHIELDUSE;
- if( m_nState & 0X800000 ) wCharState = _STATE_ABLEND;
- if( m_nState & 0X4000000 ) wCharState = _STATE_GRAY;
- if( m_nState & 0X8000000 ) wCharState = _STATE_FUCHSIA;
- if( m_nState & 0X10000000 ) wCharState = _STATE_YELLOW;
- if( m_nState & 0X20000000 ) wCharState = _STATE_BLUE;
- if( m_nState & 0X40000000 ) wCharState = _STATE_RED;
- if( m_nState & 0X80000000 ) wCharState = _STATE_GREEN;
- m_wStateClr = _STATE_NOTUSED;
- if ( m_wStateClr == _STATE_ABLEND || m_wStateClr == _STATE_SHIELDUSE )
- m_wStateClr = _STATE_NOTUSED;
- return wCharState;
- }
- VOID CActor::DrawWithEffected(INT nX, INT nY, INT nXSize, INT nYSize, WORD* pwSrc, WORD wChooseColor1, WORD wChooseColor2, BOOL bFocused, BYTE bOpa, WORD wState)
- {
- switch ( wState )
- {
- case _STATE_RED:
- case _STATE_GREEN:
- case _STATE_BLUE:
- case _STATE_YELLOW:
- case _STATE_FUCHSIA:
- case _STATE_GRAY:
- if ( m_wABlendDelay )
- g_xMainWnd.DrawWithImageForCompClipRgnColor(nX, nY, nXSize, nYSize, pwSrc, _CLIP_WIDTH, _CLIP_HEIGHT, wState, bFocused, TRUE);
- else
- g_xMainWnd.DrawWithImageForCompClipRgnColor(nX, nY, nXSize, nYSize, pwSrc, _CLIP_WIDTH, _CLIP_HEIGHT, wState, bFocused, FALSE);
- break;
- case _STATE_ABLEND:
- {
- if ( bFocused ) bOpa -= 20;
- if ( bOpa < 0 && bOpa > 100 ) bOpa = 0;
- g_xMainWnd.DrawWithABlendCompDataWithBackBuffer(nX, nY, nXSize, nYSize, pwSrc, _CLIP_WIDTH, _CLIP_HEIGHT, wChooseColor1, wChooseColor2, bOpa);
- }
- break;
- case _STATE_SHIELDUSE:
- case _STATE_NOTUSED:
- default:
- {
- if ( !m_wABlendDelay )
- g_xMainWnd.DrawWithImageForCompClipRgn(nX, nY, nXSize, nYSize, pwSrc, _CLIP_WIDTH, _CLIP_HEIGHT, wChooseColor1, wChooseColor2, bFocused);
- else
- g_xMainWnd.DrawWithABlendCompDataWithBackBuffer(nX, nY, nXSize, nYSize, pwSrc, _CLIP_WIDTH, _CLIP_HEIGHT, wChooseColor1, wChooseColor2, bOpa);
- }
- break;
- }
- }
- /******************************************************************************************************************
- 窃荐疙 : CActor::Create()
- 累己磊 :
- 累己老 :
- 格利 :
- 涝仿 : CImageHandler* pxImgHandler
- FEATURE stFeature
- BYTE bMtn
- WORD bDir
- WORD wPosX
- WORD wPosY
- 免仿 : BOOL
- [老磊][荐沥磊] : 荐沥郴侩
- *******************************************************************************************************************/
- BOOL CActor::Create(CImageHandler* pxImgHandler, FEATURE* pstFeature, BYTE bMtn, WORD bDir, WORD wPosX, WORD wPosY)
- {
- // 傈崔牢磊 利侩 棺 犬牢./////////////////////////////////////////////////////////////////////////////////
- if ( /*(pstFeature->bGender >= 0 && pstFeature->bGender < _MAX_GENDER) && */(bDir >= 0 && bDir < _MAX_DIRECTION) )
- {
- switch ( pstFeature->bGender )
- {
- case _GENDER_MAN:
- {
- if ( (pstFeature->bDress < 0 && pstFeature->bDress >= _MAX_HERO_KIND) ||
- (bMtn < 0 && bMtn >= _MAX_HERO_MTN) )
- return FALSE;
- else
- {
- m_bActorImgIdx = _IMAGE_M_HUMAN;
- m_dwFstFrame = g_xSpriteInfo.m_stHeroSpr[bMtn].wFstFrm + pstFeature->bDress*_MAX_HERO_FRAME + bDir*10;
- m_dwEndFrame = m_dwFstFrame + g_xSpriteInfo.m_stHeroSpr[bMtn].wFrmCnt;
- m_wDelay = g_xSpriteInfo.m_stHeroSpr[bMtn].wDelay;
- //!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
- pstFeature->bHair = 2;
- //!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
- }
- }
- break;
- case _GENDER_WOMAN:
- {
- if ( (pstFeature->bDress < 0 && pstFeature->bDress >= _MAX_HERO_KIND) ||
- (bMtn < 0 && bMtn >= _MAX_HERO_MTN) )
- return FALSE;
- else
- {
- m_bActorImgIdx = _IMAGE_WM_HUMAN;
- m_dwFstFrame = g_xSpriteInfo.m_stHeroSpr[bMtn].wFstFrm + pstFeature->bDress*_MAX_HERO_FRAME + bDir*10;
- m_dwEndFrame = m_dwFstFrame + g_xSpriteInfo.m_stHeroSpr[bMtn].wFrmCnt;
- m_wDelay = g_xSpriteInfo.m_stHeroSpr[bMtn].wDelay;
- //!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
- pstFeature->bHair = 2;
- //!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
- }
- }
- break;
- case _GENDER_MON:
- {
- if ( (pstFeature->bDress < 0 && pstFeature->bDress >= _MAX_MON_KIND) ||
- (bMtn < 0 && bMtn >= _MAX_MON_MTN) )
- return FALSE;
- else
- {
- switch ( m_stFeature.bDress )
- {
- case 31: // 侥牢檬.
- case 67: // 盟锋脚.
- case 73: // 厚阜盔面.
- case 104: // 利岿付.
- bDir = 0;
- case 106: // 气救芭固.
- bDir = 1;
- break;
- default:
- break;
- }
- g_xSpriteInfo.SetMonFrameInfo(pstFeature->bDress);
- m_bActorImgIdx = _IMAGE_MONSTER1 + (pstFeature->bDress / 10);
- m_dwFstFrame = g_xSpriteInfo.m_stMonSpr[bMtn].wFstFrm + (pstFeature->bDress%10)*_MAX_MON_FRAME + bDir*10;
- m_dwEndFrame = m_dwFstFrame + g_xSpriteInfo.m_stMonSpr[bMtn].wFrmCnt;
- m_wDelay = g_xSpriteInfo.m_stMonSpr[bMtn].wDelay;
- }
- }
- break;
- case _GENDER_NPC:
- {
- if ( (pstFeature->bDress < 0 && pstFeature->bDress >= _MAX_NPC_KIND) ||
- (bMtn < 0 && bMtn >= _MAX_NPC_MTN) )
- return FALSE;
- else
- {
- m_bActorImgIdx = _IMAGE_NPC;
- bDir++; // bDir篮 0捞 瞪荐档 乐扁锭巩捞促.
- bDir = bDir/3;
- m_dwFstFrame = g_xSpriteInfo.m_stNPCSpr[bMtn].wFstFrm + pstFeature->bDress*_MAX_NPC_FRAME + bDir*10;
- m_dwEndFrame = m_dwFstFrame + g_xSpriteInfo.m_stNPCSpr[bMtn].wFrmCnt;
- m_wDelay = g_xSpriteInfo.m_stNPCSpr[bMtn].wDelay;
- }
- }
- break;
- default:
- return FALSE;
- }
-
- m_bCurrMtn = bMtn;
- m_bCurrDir = bDir;
- m_bMoveDir = bDir;
- m_wPosX = wPosX;
- m_wPosY = wPosY;
-
- memcpy(&m_stFeature, pstFeature, sizeof(FEATURE));
- m_pxActorImage = &(pxImgHandler->m_xImageList[m_bActorImgIdx]);
- m_dwCurrFrame = m_dwFstFrame;
- m_bMoveDir = m_bCurrDir;
- D3DVECTOR vNorm(0, 0, -1);
- m_avBoard[0] = D3DVERTEX(D3DVECTOR(-0.5f, 0.5f, 0), vNorm, 0, 0);
- m_avBoard[1] = D3DVERTEX(D3DVECTOR(-0.5f,-0.5f, 0), vNorm, 0, 1);
- m_avBoard[2] = D3DVERTEX(D3DVECTOR( 0.5f, 0.5f, 0), vNorm, 1, 0);
- m_avBoard[3] = D3DVERTEX(D3DVECTOR( 0.5f,-0.5f, 0), vNorm, 1, 1);
- return TRUE;
- }
-
- return FALSE;
- }
- /******************************************************************************************************************
- 窃荐疙 : CActor::CheckFeatureValidate()
- 累己磊 :
- 累己老 :
- 格利 :
- 涝仿 : FEATURE stFeature
- 免仿 : BOOL
- [老磊][荐沥磊] : 荐沥郴侩
- *******************************************************************************************************************/
- BOOL CActor::CheckFeatureValidate(FEATURE stFeature)
- {
- // if ( (stFeature.bGender >= 0 && stFeature.bGender < _MAX_GENDER) )
- {
- switch ( stFeature.bGender )
- {
- case _GENDER_MAN:
- case _GENDER_WOMAN:
- if ( stFeature.bDress < 0 && stFeature.bDress >= _MAX_HERO_KIND ) return FALSE;
- break;
- case _GENDER_MON:
- {
- if ( stFeature.bDress < 0 && stFeature.bDress >= _MAX_MON_KIND ) return FALSE;
- }
- break;
- case _GENDER_NPC:
- default:
- return FALSE;
- }
- }
- return TRUE;
- }
- /******************************************************************************************************************
- 窃荐疙 : CActor::ChangeFeature()
- 累己磊 :
- 累己老 :
- 格利 :
- 涝仿 : CImageHandler* pxImgHandler
- FEATURE stFeature
- 免仿 : BOOL
- [老磊][荐沥磊] : 荐沥郴侩
- *******************************************************************************************************************/
- BOOL CActor::ChangeFeature(FEATURE stFeature)
- {
- CImageHandler* pxImgHandler = &g_xGameProc.m_xImage;
- if ( /*stFeature.bGender >= 0 && stFeature.bGender < _MAX_GENDER && */CheckFeatureValidate(stFeature) )
- {
- switch ( stFeature.bGender )
- {
- case _GENDER_MAN:
- {
- if ( stFeature.bDress < 0 && stFeature.bDress >= _MAX_HERO_KIND )
- return FALSE;
- else
- {
- m_bActorImgIdx = _IMAGE_M_HUMAN;
- m_dwFstFrame = g_xSpriteInfo.m_stHeroSpr[m_bCurrMtn].wFstFrm + stFeature.bDress*_MAX_HERO_FRAME + m_bCurrDir*10;
- m_dwEndFrame = m_dwFstFrame + g_xSpriteInfo.m_stHeroSpr[m_bCurrMtn].wFrmCnt;
- m_wDelay = g_xSpriteInfo.m_stHeroSpr[m_bCurrMtn].wDelay;
- //!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
- stFeature.bHair = 2;
- //!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
- }
- }
- break;
- case _GENDER_WOMAN:
- {
- if ( stFeature.bDress < 0 && stFeature.bDress >= _MAX_HERO_KIND )
- return FALSE;
- else
- {
- m_bActorImgIdx = _IMAGE_WM_HUMAN;
- m_dwFstFrame = g_xSpriteInfo.m_stHeroSpr[m_bCurrMtn].wFstFrm + stFeature.bDress*_MAX_HERO_FRAME + m_bCurrDir*10;
- m_dwEndFrame = m_dwFstFrame + g_xSpriteInfo.m_stHeroSpr[m_bCurrMtn].wFrmCnt;
- m_wDelay = g_xSpriteInfo.m_stHeroSpr[m_bCurrMtn].wDelay;
- //!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
- stFeature.bHair = 2;
- //!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
- }
- }
- break;
- case _GENDER_MON:
- {
- if ( stFeature.bDress < 0 && stFeature.bDress >= _MAX_MON_KIND )
- return FALSE;
- else
- {
- g_xSpriteInfo.SetMonFrameInfo(stFeature.bDress);
- m_bActorImgIdx = _IMAGE_MONSTER1 + (stFeature.bDress/10);
- m_dwFstFrame = g_xSpriteInfo.m_stMonSpr[m_bCurrMtn].wFstFrm + (stFeature.bDress%10)*_MAX_MON_FRAME + m_bCurrDir*10;
- m_dwEndFrame = m_dwFstFrame + g_xSpriteInfo.m_stMonSpr[m_bCurrMtn].wFrmCnt;
- m_wDelay = g_xSpriteInfo.m_stMonSpr[m_bCurrMtn].wDelay;
- }
- }
- break;
- // NPC绰 橇饭烙捞 老沥窍瘤 臼栏骨肺 蝶肺 利侩矫挪促.
- case _GENDER_NPC:
- default:
- return FALSE;
- }
- m_stFeature = stFeature;
- m_pxActorImage = &(pxImgHandler->m_xImageList[m_bActorImgIdx]);
- m_dwCurrFrame = m_dwFstFrame;
- return TRUE;
- }
-
- return FALSE;
- }
- /******************************************************************************************************************
- 窃荐疙 : CActor::SetMotionFrame()
- 累己磊 :
- 累己老 :
- 格利 :
- 涝仿 : BYTE bMtn
- BYTE bDir
- 免仿 : BOOL
- [老磊][荐沥磊] : 荐沥郴侩
- *******************************************************************************************************************/
- BOOL CActor::SetMotionFrame(BYTE bMtn, BYTE bDir)
- {
- if ( /*(bMtn < 0 && bMtn >= _MAX_HERO_MTN) || */(bDir < 0 && bDir >= _MAX_DIRECTION) )
- return FALSE;
- switch ( m_stFeature.bGender )
- {
- case _GENDER_MAN:
- {
- m_dwFstFrame = g_xSpriteInfo.m_stHeroSpr[bMtn].wFstFrm + m_stFeature.bDress*_MAX_HERO_FRAME + bDir*10;
- m_dwEndFrame = m_dwFstFrame + g_xSpriteInfo.m_stHeroSpr[bMtn].wFrmCnt;
- m_wDelay = g_xSpriteInfo.m_stHeroSpr[bMtn].wDelay;
- }
- break;
- case _GENDER_WOMAN:
- {
- m_dwFstFrame = g_xSpriteInfo.m_stHeroSpr[bMtn].wFstFrm + m_stFeature.bDress*_MAX_HERO_FRAME + bDir*10;
- m_dwEndFrame = m_dwFstFrame + g_xSpriteInfo.m_stHeroSpr[bMtn].wFrmCnt;
- m_wDelay = g_xSpriteInfo.m_stHeroSpr[bMtn].wDelay;
- }
- break;
- case _GENDER_MON:
- {
- if ( m_stFeature.bDress == 31 && bMtn == _MT_MON_STAND )
- bDir = 0;
- switch ( m_stFeature.bDress )
- {
- case 31: // 侥牢檬.
- case 67: // 盟锋脚.
- case 73: // 厚阜盔面.
- case 104: // 利岿付.
- bDir = 0;
- case 106: // 气救芭固.
- bDir = 1;
- break;
- default:
- break;
- }
- g_xSpriteInfo.SetMonFrameInfo(m_stFeature.bDress);
- m_dwFstFrame = g_xSpriteInfo.m_stMonSpr[bMtn].wFstFrm + (m_stFeature.bDress%10)*_MAX_MON_FRAME + bDir*10;
- m_dwEndFrame = m_dwFstFrame + g_xSpriteInfo.m_stMonSpr[bMtn].wFrmCnt;
- m_wDelay = g_xSpriteInfo.m_stMonSpr[bMtn].wDelay;
- }
- break;
- case _GENDER_NPC:
- {
- bDir++; // bDir篮 0捞 瞪荐档 乐扁锭巩捞促.
- bDir = bDir/3;
- m_dwFstFrame = g_xSpriteInfo.m_stNPCSpr[bMtn].wFstFrm + m_stFeature.bDress*_MAX_NPC_FRAME + bDir*10;
- m_dwEndFrame = m_dwFstFrame + g_xSpriteInfo.m_stNPCSpr[bMtn].wFrmCnt;
- m_wDelay = g_xSpriteInfo.m_stNPCSpr[bMtn].wDelay;
- }
- break;
- default:
- return FALSE;
- }
- m_bCurrMtn = bMtn;
- m_bCurrDir = bDir;
- m_bMoveDir = bDir;
- m_dwCurrFrame = m_dwFstFrame;
- m_wCurrDelay = 0;
- if ( m_bCurrDir == _DIRECTION_LIST_8 )
- m_bMoveNextFrmCnt = 2;
- else
- m_bMoveNextFrmCnt = 5;
- return TRUE;
- }
- VOID CActor::PlayActSound()
- {
- INT nWaveNum = -1;
- const INT nActorSndTbl[100] =
- {
- -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, // 0 - 9
- -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, // 10 - 19
- 160, 161, 100, 101, 102, 163, 0, 162, 83, 80, // 20 - 29
- 1, 10, 20, 21, 22, 23, 150, 24, 25, 26, // 30 - 39
- 27, 30, 32, 31, 151, 34, 28, 18, 40, 50, // 40 - 49
- 51, 52, 53, 152, 36, 72, 37, 38, 43, 44, // 50 - 59
- 45, 48, 49, 90, 91, 70, 73, 140, 74, 120, // 60 - 69
- 121, 81, 82, 41, 42, 39, 110, 111, 112, 130, // 70 - 79
- 164, 46, 47, 61, 62, 63, 71, -1, -1, 170, // 80 - 89
- 171, 33, -1, -1, -1, -1, -1, -1, -1, -1, // 90 - 99
- };
- if ( m_dwCurrFrame == m_dwFstFrame+1 && m_bCurrMtn == _MT_MON_APPEAR ) // 唱鸥唱扁.
- {
- nWaveNum = 200 + nActorSndTbl[m_stFeature.bDress]*10;
- }
- else if ( (m_dwCurrFrame == m_dwFstFrame+1) && (m_bCurrMtn == _MT_MON_STAND || _MT_MON_WALK) ) // 肛苗乐扁.
- {
- INT nRand = rand();
- if ( m_bFstSoundPlayed && !m_bIsDead )
- {
- if ( !(nRand%25) )
- nWaveNum = 200 + nActorSndTbl[m_stFeature.bDress]*10 + 1;
- else
- nWaveNum = -1;
- }
- else
- {
- if ( !(nRand%3) && !m_bIsDead )
- {
- nWaveNum = 200 + nActorSndTbl[m_stFeature.bDress]*10 + 1;
- m_bFstSoundPlayed = TRUE;
- }
- else
- nWaveNum = -1;
- }
- }
- else if ( m_dwCurrFrame == m_dwFstFrame+1 && m_bCurrMtn == _MT_MON_ATTACK_A ) // 老馆傍拜1.
- {
- nWaveNum = 200 + nActorSndTbl[m_stFeature.bDress]*10 + 2;
- }
- else if ( m_dwCurrFrame == m_dwFstFrame+2 && m_bCurrMtn == _MT_MON_ATTACK_A ) // 老馆傍拜1.
- {
- nWaveNum = 200 + nActorSndTbl[m_stFeature.bDress]*10 + 3;
- }
- else if ( m_dwCurrFrame == m_dwFstFrame+1 && m_bCurrMtn == _MT_MON_HITTED )
- {
- if ( m_stFeature.bGender < 2 )
- {
- switch ( m_stHitter.bWeapon )
- {
- case 21: case 24: // 窜八, 厚窜八.
- case 8: case 9: // 格八, 酒府荐格八.
- case 18: case 22: case 23: case 26: case 27: case 28: case 30: // 荤葛八. 没悼八. 枚八. 没澜八. 寒荤八. 玫飞. 邦己八.
- case 1: case 4: case 11: case 13: case 14: case 20: case 25: case 29: case 31: // 蜡岿档. 宫没措档. 腊钦档. 焙档. 档锋焊档. 荤阿档. 技梅档. 抗档. 檬去档.
- nWaveNum = 70;
- break;
- case 5: case 10: case 12: // 伙利措何. 没悼档尝. 楷磊何.
- case 15: // 颇锄柳寸.
- nWaveNum = 71;
- break;
- case 2: case 3: case 6: case 7: case 16: case 17: case 19: // 伙瘤芒. 玫屈格. 全酒芒. 邦豹捞. 没付芒, 侩酒厘. 力付豪
- nWaveNum = 72;
- break;
- default:
- nWaveNum = 73; // 盖颊.
- break;
- }
- }
- }
- else if ( m_dwCurrFrame == m_dwFstFrame+2 && m_bCurrMtn == _MT_MON_HITTED ) // 嘎扁.
- {
- nWaveNum = 200 + nActorSndTbl[m_stFeature.bDress]*10 + 4;
- }
- else if ( m_dwCurrFrame == m_dwFstFrame+2 && m_bCurrMtn == _MT_MON_DIE ) // 磷扁1.
- {
- nWaveNum = 200 + nActorSndTbl[m_stFeature.bDress]*10 + 5;
- }
- else if ( m_dwCurrFrame == m_dwFstFrame+3 && m_bCurrMtn == _MT_MON_DIE ) // 磷扁2.
- {
- nWaveNum = 200 + nActorSndTbl[m_stFeature.bDress]*10 + 6;
- }
- /* if ( nWaveNum != -1 )
- g_xSound.PlayActorWav(m_wPosX, m_wPosY, g_xGameProc.m_xMyHero.m_wPosX, g_xGameProc.m_xMyHero.m_wPosY, nWaveNum);
- */
- }
- /******************************************************************************************************************
- 窃荐疙 : CActor::SetMoving()
- 累己磊 :
- 累己老 :
- 格利 :
- 免仿 : VOID
- [老磊][荐沥磊] : 荐沥郴侩
- *******************************************************************************************************************/
- VOID CActor::SetMoving()
- {
- WORD wFrmCnt = m_dwEndFrame - m_dwFstFrame;
- WORD wCurrFrm = m_dwCurrFrame - m_dwFstFrame;
- switch ( m_bMoveDir )
- {
- case _DIRECTION_LIST_1:
- m_shShiftPixelX = 0;
- if ( wCurrFrm < (6-m_bMoveNextFrmCnt) )
- m_shShiftPixelY = -(_CELL_HEIGHT/wFrmCnt * (wCurrFrm+1))*m_bMoveSpeed;
- else
- m_shShiftPixelY = (_CELL_HEIGHT/wFrmCnt * (wFrmCnt - wCurrFrm -1))*m_bMoveSpeed;
- break;
- case _DIRECTION_LIST_2:
- if ( wCurrFrm < (6-m_bMoveNextFrmCnt) )
- m_shShiftPixelX = (_CELL_WIDTH /wFrmCnt * (wCurrFrm+1))*m_bMoveSpeed;
- else
- m_shShiftPixelX = -(_CELL_WIDTH /wFrmCnt * (wFrmCnt - wCurrFrm -1))*m_bMoveSpeed;
- if ( wCurrFrm < (6-m_bMoveNextFrmCnt) )
- m_shShiftPixelY = -(_CELL_HEIGHT/wFrmCnt * (wCurrFrm+1))*m_bMoveSpeed;
- else
- m_shShiftPixelY = (_CELL_HEIGHT/wFrmCnt * (wFrmCnt - wCurrFrm -1))*m_bMoveSpeed;
- break;
- case _DIRECTION_LIST_3:
- if ( wCurrFrm < (6-m_bMoveNextFrmCnt) )
- m_shShiftPixelX = (_CELL_WIDTH /wFrmCnt * (wCurrFrm+1))*m_bMoveSpeed;
- else
- m_shShiftPixelX = -(_CELL_WIDTH /wFrmCnt * (wFrmCnt - wCurrFrm -1))*m_bMoveSpeed;
- m_shShiftPixelY = 0;
- break;
- case _DIRECTION_LIST_4:
- if ( wCurrFrm < (6-m_bMoveNextFrmCnt) )
- m_shShiftPixelX = (_CELL_WIDTH /wFrmCnt * (wCurrFrm+1))*m_bMoveSpeed;
- else
- m_shShiftPixelX = -(_CELL_WIDTH /wFrmCnt * (wFrmCnt - wCurrFrm -1))*m_bMoveSpeed;
- if ( wCurrFrm < (6-m_bMoveNextFrmCnt) )
- m_shShiftPixelY = (_CELL_HEIGHT/wFrmCnt * (wCurrFrm+1))*m_bMoveSpeed;
- else
- m_shShiftPixelY = -(_CELL_HEIGHT/wFrmCnt * (wFrmCnt - wCurrFrm -1))*m_bMoveSpeed;
- break;
- case _DIRECTION_LIST_5:
- m_shShiftPixelX = 0;
- if ( wCurrFrm < (6-m_bMoveNextFrmCnt) )
- m_shShiftPixelY = (_CELL_HEIGHT/wFrmCnt * (wCurrFrm+1))*m_bMoveSpeed;
- else
- m_shShiftPixelY = -(_CELL_HEIGHT/wFrmCnt * (wFrmCnt - wCurrFrm -1))*m_bMoveSpeed;
- break;
- case _DIRECTION_LIST_6:
- if ( wCurrFrm < (6-m_bMoveNextFrmCnt) )
- m_shShiftPixelX = -(_CELL_WIDTH /wFrmCnt * (wCurrFrm+1))*m_bMoveSpeed;
- else
- m_shShiftPixelX = (_CELL_WIDTH /wFrmCnt * (wFrmCnt - wCurrFrm -1))*m_bMoveSpeed;
- if ( wCurrFrm < (6-m_bMoveNextFrmCnt) )
- m_shShiftPixelY = (_CELL_HEIGHT/wFrmCnt * (wCurrFrm+1))*m_bMoveSpeed;
- else
- m_shShiftPixelY = -(_CELL_HEIGHT/wFrmCnt * (wFrmCnt - wCurrFrm -1))*m_bMoveSpeed;
- break;
- case _DIRECTION_LIST_7:
- if ( wCurrFrm < (6-m_bMoveNextFrmCnt) )
- m_shShiftPixelX = -(_CELL_WIDTH /wFrmCnt * (wCurrFrm+1))*m_bMoveSpeed;
- else
- m_shShiftPixelX = (_CELL_WIDTH /wFrmCnt * (wFrmCnt - wCurrFrm -1))*m_bMoveSpeed;
- m_shShiftPixelY = 0;
- break;
- case _DIRECTION_LIST_8:
- if ( wCurrFrm < (6-m_bMoveNextFrmCnt) )
- m_shShiftPixelX = -(_CELL_WIDTH /wFrmCnt * (wCurrFrm+1))*m_bMoveSpeed;
- else
- m_shShiftPixelX = (_CELL_WIDTH /wFrmCnt * (wFrmCnt - wCurrFrm -1))*m_bMoveSpeed;
- if ( wCurrFrm < (6-m_bMoveNextFrmCnt) )
- m_shShiftPixelY = -(_CELL_HEIGHT/wFrmCnt * (wCurrFrm+1))*m_bMoveSpeed;
- else
- m_shShiftPixelY = (_CELL_HEIGHT/wFrmCnt * (wFrmCnt - wCurrFrm -1))*m_bMoveSpeed;
- break;
- }
- }
- /******************************************************************************************************************
- 窃荐疙 : CActor::SetBackStepMoving()
- 累己磊 :
- 累己老 :
- 格利 :
- 免仿 : VOID
- [老磊][荐沥磊] : 荐沥郴侩
- *******************************************************************************************************************/
- VOID CActor::SetBackStepMoving()
- {
- switch ( m_bMoveDir )
- {
- case _DIRECTION_LIST_1:
- m_shShiftPixelX = 0;
- if ( m_bBackStepFrame < (6-m_bMoveNextFrmCnt) )
- m_shShiftPixelY = -(_CELL_HEIGHT/m_bBackStepFrameCnt * (m_bBackStepFrame+1))*m_bMoveSpeed;
- else
- m_shShiftPixelY = (_CELL_HEIGHT/m_bBackStepFrameCnt * (m_bBackStepFrameCnt - m_bBackStepFrame -1))*m_bMoveSpeed;
- break;
- case _DIRECTION_LIST_2:
- if ( m_bBackStepFrame < (6-m_bMoveNextFrmCnt) )
- m_shShiftPixelX = (_CELL_WIDTH /m_bBackStepFrameCnt * (m_bBackStepFrame+1))*m_bMoveSpeed;
- else
- m_shShiftPixelX = -(_CELL_WIDTH /m_bBackStepFrameCnt * (m_bBackStepFrameCnt - m_bBackStepFrame -1))*m_bMoveSpeed;
- if ( m_bBackStepFrame < (6-m_bMoveNextFrmCnt) )
- m_shShiftPixelY = -(_CELL_HEIGHT/m_bBackStepFrameCnt * (m_bBackStepFrame+1))*m_bMoveSpeed;
- else
- m_shShiftPixelY = (_CELL_HEIGHT/m_bBackStepFrameCnt * (m_bBackStepFrameCnt - m_bBackStepFrame -1))*m_bMoveSpeed;
- break;
- case _DIRECTION_LIST_3:
- if ( m_bBackStepFrame < (6-m_bMoveNextFrmCnt) )
- m_shShiftPixelX = (_CELL_WIDTH /m_bBackStepFrameCnt * (m_bBackStepFrame+1))*m_bMoveSpeed;
- else
- m_shShiftPixelX = -(_CELL_WIDTH /m_bBackStepFrameCnt * (m_bBackStepFrameCnt - m_bBackStepFrame -1))*m_bMoveSpeed;
- m_shShiftPixelY = 0;
- break;
- case _DIRECTION_LIST_4:
- if ( m_bBackStepFrame < (6-m_bMoveNextFrmCnt) )
- m_shShiftPixelX = (_CELL_WIDTH /m_bBackStepFrameCnt * (m_bBackStepFrame+1))*m_bMoveSpeed;
- else
- m_shShiftPixelX = -(_CELL_WIDTH /m_bBackStepFrameCnt * (m_bBackStepFrameCnt - m_bBackStepFrame -1))*m_bMoveSpeed;
- if ( m_bBackStepFrame < (6-m_bMoveNextFrmCnt) )
- m_shShiftPixelY = (_CELL_HEIGHT/m_bBackStepFrameCnt * (m_bBackStepFrame+1))*m_bMoveSpeed;
- else
- m_shShiftPixelY = -(_CELL_HEIGHT/m_bBackStepFrameCnt * (m_bBackStepFrameCnt - m_bBackStepFrame -1))*m_bMoveSpeed;
- break;
- case _DIRECTION_LIST_5:
- m_shShiftPixelX = 0;
- if ( m_bBackStepFrame < (6-m_bMoveNextFrmCnt) )
- m_shShiftPixelY = (_CELL_HEIGHT/m_bBackStepFrameCnt * (m_bBackStepFrame+1))*m_bMoveSpeed;
- else
- m_shShiftPixelY = -(_CELL_HEIGHT/m_bBackStepFrameCnt * (m_bBackStepFrameCnt - m_bBackStepFrame -1))*m_bMoveSpeed;
- break;
- case _DIRECTION_LIST_6:
- if ( m_bBackStepFrame < (6-m_bMoveNextFrmCnt) )
- m_shShiftPixelX = -(_CELL_WIDTH /m_bBackStepFrameCnt * (m_bBackStepFrame+1))*m_bMoveSpeed;
- else
- m_shShiftPixelX = (_CELL_WIDTH /m_bBackStepFrameCnt * (m_bBackStepFrameCnt - m_bBackStepFrame -1))*m_bMoveSpeed;
- if ( m_bBackStepFrame < (6-m_bMoveNextFrmCnt) )
- m_shShiftPixelY = (_CELL_HEIGHT/m_bBackStepFrameCnt * (m_bBackStepFrame+1))*m_bMoveSpeed;
- else
- m_shShiftPixelY = -(_CELL_HEIGHT/m_bBackStepFrameCnt * (m_bBackStepFrameCnt - m_bBackStepFrame -1))*m_bMoveSpeed;
- break;
- case _DIRECTION_LIST_7:
- if ( m_bBackStepFrame < (6-m_bMoveNextFrmCnt) )
- m_shShiftPixelX = -(_CELL_WIDTH /m_bBackStepFrameCnt * (m_bBackStepFrame+1))*m_bMoveSpeed;
- else
- m_shShiftPixelX = (_CELL_WIDTH /m_bBackStepFrameCnt * (m_bBackStepFrameCnt - m_bBackStepFrame -1))*m_bMoveSpeed;
- m_shShiftPixelY = 0;
- break;
- case _DIRECTION_LIST_8:
- if ( m_bBackStepFrame < (6-m_bMoveNextFrmCnt) )
- m_shShiftPixelX = -(_CELL_WIDTH /m_bBackStepFrameCnt * (m_bBackStepFrame+1))*m_bMoveSpeed;
- else
- m_shShiftPixelX = (_CELL_WIDTH /m_bBackStepFrameCnt * (m_bBackStepFrameCnt - m_bBackStepFrame -1))*m_bMoveSpeed;
- if ( m_bBackStepFrame < (6-m_bMoveNextFrmCnt) )
- m_shShiftPixelY = -(_CELL_HEIGHT/m_bBackStepFrameCnt * (m_bBackStepFrame+1))*m_bMoveSpeed;
- else
- m_shShiftPixelY = (_CELL_HEIGHT/m_bBackStepFrameCnt * (m_bBackStepFrameCnt - m_bBackStepFrame -1))*m_bMoveSpeed;
- break;
- }
- }
- /******************************************************************************************************************
- 窃荐疙 : CActor::SetMoved()
- 累己磊 :
- 累己老 :
- 格利 :
- 免仿 : VOID
- [老磊][荐沥磊] : 荐沥郴侩
- *******************************************************************************************************************/
- VOID CActor::SetMoved()
- {
- switch ( m_bMoveDir )
- {
- case _DIRECTION_LIST_1:
- m_shShiftTileX = 0;
- m_shShiftTileY = -m_bMoveSpeed;
- break;
- case _DIRECTION_LIST_2:
- m_shShiftTileX = m_bMoveSpeed;
- m_shShiftTileY = -m_bMoveSpeed;
- break;
- case _DIRECTION_LIST_3:
- m_shShiftTileX = m_bMoveSpeed;
- m_shShiftTileY = 0;
- break;
- case _DIRECTION_LIST_4:
- m_shShiftTileX = m_bMoveSpeed;
- m_shShiftTileY = m_bMoveSpeed;
- break;
- case _DIRECTION_LIST_5:
- m_shShiftTileX = 0;
- m_shShiftTileY = m_bMoveSpeed;
- break;
- case _DIRECTION_LIST_6:
- m_shShiftTileX = -m_bMoveSpeed;
- m_shShiftTileY = m_bMoveSpeed;
- break;
- case _DIRECTION_LIST_7:
- m_shShiftTileX = -m_bMoveSpeed;
- m_shShiftTileY = 0;
- break;
- case _DIRECTION_LIST_8:
- m_shShiftTileX = -m_bMoveSpeed;
- m_shShiftTileY = -m_bMoveSpeed;
- break;
- }
- m_wPosX += m_shShiftTileX;
- m_wPosY += m_shShiftTileY;
- m_shShiftPixelX = 0;
- m_shShiftPixelY = 0;
- }
- /******************************************************************************************************************
- 窃荐疙 : CActor::OnCharDescPacket()
- 累己磊 :
- 累己老 :
- 格利 : SM_WALK, SM_DEATH, SM_TURN, SM_RUN, SM_DIGUP 皋矫瘤俊 荤侩茄促.
- 涝仿 : LPPACKETMSG lpPacketMsg
- 免仿 : VOID
- [老磊][荐沥磊] : 荐沥郴侩
- *******************************************************************************************************************/
- VOID CActor::OnCharDescPacket(LPPACKETMSG lpPacketMsg)
- {
- CHARDESC stCharDesc;
- FEATURE stFeature;
- fnDecode6BitBuf(lpPacketMsg->szEncodeData, (char*)&stCharDesc, sizeof(CHARDESC));
- memcpy(&stFeature, &stCharDesc.nFeature, sizeof(FEATURE));
- m_nState = stCharDesc.nStatus;
- if( m_nState & 0X2 ) m_bOpenHealth = TRUE;
- else m_bOpenHealth = FALSE;
- ChangeFeature(stFeature);
- }
- VOID CActor::OnUserName(LPPACKETMSG lpPacketMsg)
- {
- INT nPos = fnDecode6BitBuf(lpPacketMsg->szEncodeData, m_szName, sizeof(m_szName));
- m_szName[nPos] = ' ';
- m_dwNameClr = GetUserNameColor(lpPacketMsg->stDefMsg.wParam);
- }
- VOID CActor::OnChangeNameClr(LPPACKETMSG lpPacketMsg)
- {
- m_dwNameClr = GetUserNameColor(lpPacketMsg->stDefMsg.wParam);
- }
- VOID CActor::OnChangeLight(LPPACKETMSG lpPacketMsg)
- {
- m_bLightSize = lpPacketMsg->stDefMsg.wParam;
- }
- VOID CActor::OnOpenHealth(LPPACKETMSG lpPacketMsg)
- {
- m_bOpenHealth = TRUE;
- }
- VOID CActor::OnCloseHealth(LPPACKETMSG lpPacketMsg)
- {
- m_bOpenHealth = FALSE;
- }
- VOID CActor::OnFeatureChanged(LPPACKETMSG lpPacketMsg)
- {
- FEATURE stFeature;
- LONG nFeature = MAKELONG(lpPacketMsg->stDefMsg.wParam, lpPacketMsg->stDefMsg.wTag);
- memcpy(&stFeature, &nFeature, sizeof(LONG));
- ChangeFeature(stFeature);
- }
- VOID CActor::OnHealthSpellChanged(LPPACKETMSG lpPacketMsg)
- {
- m_wHP = lpPacketMsg->stDefMsg.wParam;
- m_wMP = lpPacketMsg->stDefMsg.wTag;
- m_wMAXHP = lpPacketMsg->stDefMsg.wSeries;
- FLOAT wHPRate = (FLOAT)((FLOAT)m_wHP/(FLOAT)m_wMAXHP);
- m_bHPPercent = wHPRate*100;
- }
- VOID CActor::OnWalk(LPPACKETMSG lpPacketMsg)
- {
- BYTE bDir;
- // m_wPosX = lpPacketMsg->stDefMsg.wParam;
- // m_wPosY = lpPacketMsg->stDefMsg.wTag;
- bDir = LOBYTE(lpPacketMsg->stDefMsg.wSeries);
- m_bLightSize = HIBYTE(lpPacketMsg->stDefMsg.wSeries);
- OnCharDescPacket(lpPacketMsg);
- SetMotionFrame(_MT_MON_WALK, bDir);
- m_bMoveSpeed = _SPEED_WALK;
- SetMoving();
- }
- VOID CActor::OnTurn(LPPACKETMSG lpPacketMsg)
- {
- BYTE bDir;
- m_wPosX = lpPacketMsg->stDefMsg.wParam;
- m_wPosY = lpPacketMsg->stDefMsg.wTag;
- bDir = LOBYTE(lpPacketMsg->stDefMsg.wSeries);
- m_bLightSize = HIBYTE(lpPacketMsg->stDefMsg.wSeries);
- // 侥牢檬.
- if ( m_stFeature.bDress == 31 )
- bDir = 0;
- OnCharDescPacket(lpPacketMsg);
- SetMotionFrame(_MT_MON_STAND, bDir);
- if( m_nState & 0X1 ) // 籍拳惑怕.
- {
- switch ( m_stFeature.bDress )
- {
- case 83: //林付脚厘.
- case 84: //林付龋过.
- case 85: //林付空.
- SetMotionFrame(_MT_MON_APPEAR, 0);
- m_dwEndFrame = m_dwFstFrame + 1;
- m_bCurrMtn = _MT_MON_STAND;
- }
- }
- }
- VOID CActor::OnDigup(LPPACKETMSG lpPacketMsg)
- {
- //MESSAGEBODYWL ????????
- BYTE bDir;
- m_wPosX = lpPacketMsg->stDefMsg.wParam;
- m_wPosY = lpPacketMsg->stDefMsg.wTag;
- bDir = LOBYTE(lpPacketMsg->stDefMsg.wSeries);
- m_bLightSize = HIBYTE(lpPacketMsg->stDefMsg.wSeries);
- OnCharDescPacket(lpPacketMsg);
- m_bReverse = FALSE;
- switch ( m_stFeature.bDress )
- {
- case 3:
- m_bReverse = TRUE;
- break;
- case 85: //林付空.
- bDir = 0;
- break;
- case 31: //侥牢檬.
- bDir = 0;
- m_bReverse = TRUE;
- break;
- case 56:
- {
- CMagic* pxMagic;
- pxMagic = new CMagic;
- pxMagic->CreateMagic(_SKILL_SKELLETON, m_wPosX, m_wPosY, m_wPosX, m_wPosY, NULL, 0);
- g_xGameProc.m_xMagicList.AddNode(pxMagic);
- break;
- }
- /* case 89:
- {
- CMagic* pxMagic;
- pxMagic = new CMagic;
- pxMagic->CreateMagic(_SKILL_SINSU, m_wPosX, m_wPosY, m_wPosX, m_wPosY, NULL, 0);
- g_xGameProc.m_xMagicList.AddNode(pxMagic);
- break;
- }
- */ }
- m_bAppearState = _DIG_UP;
- SetMotionFrame(_MT_MON_APPEAR, bDir);
- }
- VOID CActor::OnDigDown(LPPACKETMSG lpPacketMsg)
- {
- BYTE bDir;
- m_wPosX = lpPacketMsg->stDefMsg.wParam;
- m_wPosY = lpPacketMsg->stDefMsg.wTag;
- bDir = m_bCurrDir;
- m_bReverse = TRUE;
- switch ( m_stFeature.bDress )
- {
- case 3:
- m_bReverse = FALSE;
- break;
- case 31: //侥牢檬.
- bDir = 0;
- m_bReverse = FALSE;
- break;
- }
- m_bAppearState = _DIG_DOWN;
- SetMotionFrame(_MT_MON_APPEAR, bDir);
- }
- VOID CActor::OnDeath(LPPACKETMSG lpPacketMsg)
- {
- BYTE bDir;
- m_wPosX = lpPacketMsg->stDefMsg.wParam;
- m_wPosY = lpPacketMsg->stDefMsg.wTag;
- bDir = lpPacketMsg->stDefMsg.wSeries;
- OnCharDescPacket(lpPacketMsg);
- SetMotionFrame(_MT_MON_DIE, bDir);
- if ( lpPacketMsg->stDefMsg.wIdent == SM_DEATH )
- {
- m_dwCurrFrame = m_dwEndFrame - 1;
- m_bIsDead = TRUE;
- }
- else
- {
- // 阁胶磐老锭.
- if ( m_stFeature.bGender == _GENDER_MON )
- {
- CMagic* pxMagic;
- switch ( m_stFeature.bDress )
- {
- case 4: // 籍厘牢.
- pxMagic = new CMagic;
- pxMagic->CreateMagic(_MONMAGIC_EXPLODE1, m_wPosX, m_wPosY, m_wPosX, m_wPosY, this);
- g_xGameProc.m_xMagicList.AddNode(pxMagic);
- break;
- case 5: // 官捻啊福唱.
- case 6: // 官磊匡.
- case 11: // 葛叼怜.
- case 19: // 饭叼啊福唱.
- pxMagic = new CMagic;
- pxMagic->CreateMagic(_MONMAGIC_SINGI_DIE, m_wPosX, m_wPosY, m_wPosX, m_wPosY, this);
- g_xGameProc.m_xMagicList.AddNode(pxMagic);
- /* LoadEffect(&g_xGameProc.m_xImage, _MONMAGIC_DIE);
- m_bUseSwordEffect = TRUE;
- */ break;
- case 40: // 倾荐酒厚.
- pxMagic = new CMagic;
- pxMagic->CreateMagic(_MONMAGIC_HUSU_DIE, m_wPosX, m_wPosY, m_wPosX, m_wPosY, this);
- g_xGameProc.m_xMagicList.AddNode(pxMagic);
- /* LoadEffect(&g_xGameProc.m_xImage, _MONMAGIC_HUSU_DIE);
- m_bUseSwordEffect = TRUE;
- */ break;
- case 48: // 粱厚.
- pxMagic = new CMagic;
- pxMagic->CreateMagic(_MONMAGIC_ZOMBIE_DIE, m_wPosX, m_wPosY, m_wPosX, m_wPosY, this);
- g_xGameProc.m_xMagicList.AddNode(pxMagic);
- /* LoadEffect(&g_xGameProc.m_xImage, _MONMAGIC_ZOMBIE_DIE);
- m_bUseSwordEffect = TRUE;
- */ break;
- case 99: // 官坷崔靛.
- pxMagic = new CMagic;
- pxMagic->CreateMagic(_MONMAGIC_BAODIE, m_wPosX, m_wPosY, m_wPosX, m_wPosY, this);
- g_xGameProc.m_xMagicList.AddNode(pxMagic);
- break;
- default :
- break;
- }
- }
- }
- }
- VOID CActor::OnBackStep(LPPACKETMSG lpPacketMsg)
- {
- BYTE bDir;
- bDir = lpPacketMsg->stDefMsg.wSeries;
- m_wPosX = lpPacketMsg->stDefMsg.wParam;
- m_wPosY = lpPacketMsg->stDefMsg.wTag;
- SetMotionFrame(_MT_MON_WALK, bDir);
- if ( m_bCurrDir < 4 ) m_bMoveDir = m_bCurrDir + 4;
- else m_bMoveDir = m_bCurrDir - 4;
- m_bMoveSpeed = _SPEED_WALK;
- m_bBackStepFrame = 0;
- m_bBackStepFrameCnt = 6;
- SetBackStepMoving();
- }
- VOID CActor::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;
- fnDecode6BitBuf(lpPacketMsg->szEncodeData, (char*)&stMsgBodyWl, sizeof(MESSAGEBODYWL));
- memcpy(&stFeature, &stMsgBodyWl.lParam1, sizeof(LONG));
- ChangeFeature(stFeature);
- 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);
- g_xGameProc.m_xMagicList.AddNode(pxMagic);
- break;
- case 8: // 癌林俺固.
- case 14: // 捍侩俺固.
- case 16: // 靛抄俺固.
- pxMagic = new CMagic;
- pxMagic->CreateMagic(_MONMAGIC_GREATANT, 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 CActor::OnLighting(LPPACKETMSG lpPacketMsg)
- {
- WORD wTargetX, wTargetY;
- INT nTargetID;
- CMagic* pxMagic;
- m_wPosX = lpPacketMsg->stDefMsg.wParam;
- m_wPosY = lpPacketMsg->stDefMsg.wTag;
- m_bCurrDir = lpPacketMsg->stDefMsg.wSeries;
- MESSAGEBODYWL stMsgBodyWl;
- fnDecode6BitBuf(lpPacketMsg->szEncodeData, (char*)&stMsgBodyWl, sizeof(MESSAGEBODYWL));
- wTargetX = stMsgBodyWl.lParam1;
- wTargetY = stMsgBodyWl.lParam2;
- nTargetID = MAKELONG(stMsgBodyWl.nTag1, stMsgBodyWl.nTag2);
- switch ( m_stFeature.bDress )
- {
- case 48: // 粱厚. 8规氢.
- pxMagic = new CMagic;
- pxMagic->CreateMagic(_MONMAGIC_ZOMBIE, m_wPosX, m_wPosY, m_wPosX, m_wPosY, this, nTargetID);
- g_xGameProc.m_xMagicList.AddNode(pxMagic);
- SetMotionFrame(_MT_MON_ATTACK_A, m_bCurrDir);
- break;
- }
- }
- VOID CActor::OnFlyAxe(LPPACKETMSG lpPacketMsg)
- {
- WORD wTargetX, wTargetY;
- INT nTargetID;
- CMagic* pxMagic;
- m_wPosX = lpPacketMsg->stDefMsg.wParam;
- m_wPosY = lpPacketMsg->stDefMsg.wTag;
- m_bCurrDir = lpPacketMsg->stDefMsg.wSeries;
- MESSAGEBODYW stMsgBodyW;
- fnDecode6BitBuf(lpPacketMsg->szEncodeData, (char*)&stMsgBodyW, sizeof(MESSAGEBODYW));
- wTargetX = stMsgBodyW.wParam1;
- wTargetY = stMsgBodyW.wParam2;
- nTargetID = MAKELONG(stMsgBodyW.wTag1, stMsgBodyW.wTag2);
- switch ( m_stFeature.bDress )
- {
- case 33: // 街档尝秦榜.
- pxMagic = new CMagic;
- pxMagic->CreateMagic(_MONMAGIC_DUALAXE, m_wPosX, m_wPosY, wTargetX, wTargetY, this, nTargetID);
- g_xGameProc.m_xMagicList.AddNode(pxMagic);
- SetMotionFrame(_MT_MON_ATTACK_A, m_bCurrDir);
- break;
- case 46: // 促农.
- pxMagic = new CMagic;
- pxMagic->CreateMagic(_MONMAGIC_CHIM, m_wPosX, m_wPosY, wTargetX, wTargetY, this, nTargetID);
- g_xGameProc.m_xMagicList.AddNode(pxMagic);
- SetMotionFrame(_MT_MON_ATTACK_A, m_bCurrDir);
- break;
- case 82: // 付泵荤.
- pxMagic = new CMagic;
- pxMagic->CreateMagic(_MONMAGIC_MAARROW, m_wPosX, m_wPosY, wTargetX, wTargetY, this, nTargetID);
- g_xGameProc.m_xMagicList.AddNode(pxMagic);
- SetMotionFrame(_MT_MON_ATTACK_A, m_bCurrDir);
- break;
- }
- }
- VOID CActor::OnHit(LPPACKETMSG lpPacketMsg)
- {
- BYTE bDir;
- bDir = lpPacketMsg->stDefMsg.wSeries;
- m_wPosX = lpPacketMsg->stDefMsg.wParam;
- m_wPosY = lpPacketMsg->stDefMsg.wTag;
- SetMotionFrame(_MT_MON_ATTACK_A, bDir);
- // 阁胶磐老锭.
- if ( m_stFeature.bGender == _GENDER_MON )
- {
- CMagic* pxMagic;
- switch ( m_stFeature.bDress )
- {
- case 9: // 沸.
- pxMagic = new CMagic;
- pxMagic->CreateMagic(_MONMAGIC_EXPLODE, m_wPosX, m_wPosY, m_wPosX, m_wPosY, this);
- g_xGameProc.m_xMagicList.AddNode(pxMagic);
- break;
- case 5: // 官捻啊福唱.
- pxMagic = new CMagic;
- pxMagic->CreateMagic(_MONMAGIC_BLACK1, m_wPosX, m_wPosY, m_wPosX, m_wPosY, this);
- g_xGameProc.m_xMagicList.AddNode(pxMagic);
- break;
- case 19: // 饭叼啊福唱.
- pxMagic = new CMagic;
- pxMagic->CreateMagic(_MONMAGIC_RED1, m_wPosX, m_wPosY, m_wPosX, m_wPosY, this);
- g_xGameProc.m_xMagicList.AddNode(pxMagic);
- break;
- case 45: // 快搁蓖空.
- pxMagic = new CMagic;
- pxMagic->CreateMagic(_MONMAGIC_COWGHOST, m_wPosX, m_wPosY, m_wPosX, m_wPosY, this);
- g_xGameProc.m_xMagicList.AddNode(pxMagic);
- break;
- case 90: // 脚荐.
- pxMagic = new CMagic;
- pxMagic->CreateMagic(_MONMAGIC_SINSU, m_wPosX, m_wPosY, m_wPosX, m_wPosY, this);
- g_xGameProc.m_xMagicList.AddNode(pxMagic);
- break;
- case 43: // 拳堪快搁蓖.
- pxMagic = new CMagic;
- pxMagic->CreateMagic(_MONMAGIC_COWFLAME, m_wPosX, m_wPosY, m_wPosX, m_wPosY, this);
- g_xGameProc.m_xMagicList.AddNode(pxMagic);
- break;
- case 85: // 林付空.
- pxMagic = new CMagic;
- pxMagic->CreateMagic(_MONMAGIC_JUMAWANG, 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_ATT, m_wPosX, m_wPosY, m_wPosX, m_wPosY, this);
- g_xGameProc.m_xMagicList.AddNode(pxMagic);
- break;
- case 75: // 禁扁唱规.
- pxMagic = new CMagic;
- pxMagic->CreateMagic(_MONMAGIC_SSEGI, m_wPosX, m_wPosY, m_wPosX, m_wPosY, this);
- g_xGameProc.m_xMagicList.AddNode(pxMagic);
- break;
- case 94: // 荤绢.
- pxMagic = new CMagic;
- pxMagic->CreateMagic(_MONMAGIC_SANDFISH, m_wPosX, m_wPosY, m_wPosX, m_wPosY, this);
- g_xGameProc.m_xMagicList.AddNode(pxMagic);
- break;
- case 98: // 惑鞭鲍拱.
- m_dwCurrEffectFrame = 50;
- m_dwFstEffectFrame = 50;
- m_dwEndEffectFrame = 60;
- m_bEffectFrame = 0;
- m_bEffectFrameCnt = _DEFAULT_SPELLFRAME;
- LoadEffect(&g_xGameProc.m_xImage, _MONMAGIC_NUMAGUMGI, bDir);
- m_bUseSwordEffect = TRUE;
- break;
- default :
- break;
- }
- }
- }
- VOID CActor::StruckMsgReassign()
- {
- INT nCnt;
- SHORT shLeftMsgCnt;
- LPPACKETMSG lpPacketMsg;
- lpPacketMsg = NULL;
- shLeftMsgCnt = m_xPacketQueue.GetCount();
- if ( shLeftMsgCnt > 1 )
- {
- for ( nCnt = 0; nCnt < shLeftMsgCnt; nCnt++ )
- {
- lpPacketMsg = (LPPACKETMSG)m_xPacketQueue.PopQ();
- if ( lpPacketMsg )
- {
- if ( lpPacketMsg->stDefMsg.wIdent == SM_STRUCK )
- {
- SAFE_DELETE(lpPacketMsg);
- }
- else
- {
- m_xPacketQueue.PushQ((BYTE*)lpPacketMsg);
- }
- }
- }
- }
- }
- /******************************************************************************************************************
- 窃荐疙 : CActor::UpdatePacketState()
- 累己磊 :
- 累己老 :
- 格利 :
- 免仿 : BOOL
- [老磊][荐沥磊] : 荐沥郴侩
- *******************************************************************************************************************/
- BOOL CActor::UpdatePacketState()
- {
- LPPACKETMSG lpPacketMsg = NULL;
- if ( m_bCurrMtn == _MT_MON_STAND )
- {
- 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_NOWDEATH:
- case SM_DEATH: { OnDeath(lpPacketMsg); break; }
- case SM_WALK: { OnWalk(lpPacketMsg); break; }
- case SM_TURN: { OnTurn(lpPacketMsg); break; }
- case SM_DIGUP: { OnDigup(lpPacketMsg); break; }
- case SM_DIGDOWN: { OnDigDown(lpPacketMsg); 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_CHANGENAMECOLOR: { OnChangeNameClr(lpPacketMsg); break; }
- case SM_USERNAME: { OnUserName(lpPacketMsg); break; }
- case SM_HEALTHSPELLCHANGED: { OnHealthSpellChanged(lpPacketMsg); break; }
- case SM_BACKSTEP: { OnBackStep(lpPacketMsg); break; }
- case SM_STRUCK: { OnStruck(lpPacketMsg); break; }
- case SM_HIT: { OnHit(lpPacketMsg); break; }
- case SM_FLYAXE: { OnFlyAxe(lpPacketMsg); break; }
- case SM_LIGHTING: { OnLighting(lpPacketMsg); break; }
- case SM_SKELETON:
- OnWalk(lpPacketMsg);
- break;
- default:
- {
- break;
- }
- }
- }
- SAFE_DELETE(lpPacketMsg);
- return TRUE;
- }
- }
- return FALSE;
- }
- /******************************************************************************************************************
- 窃荐疙 : CActor::LoadEffect()
- 累己磊 :
- 累己老 :
- 格利 :
- 涝仿 : CImageHandler* pxImgHandler
- WORD wEffectNum
- BYTE bDir
- 免仿 : BOOL
- [老磊][荐沥磊] : 荐沥郴侩
- *******************************************************************************************************************/
- BOOL CActor::LoadEffect(CImageHandler* pxImgHandler, WORD wEffectNum, BYTE bDir)
- {
- WORD wFileType;
- LPEFFECTSPRINFO pstEffect = g_xSpriteInfo.GetEffectInfo(wEffectNum);
- if ( pstEffect )
- {
- m_bEffectImgIdx = pstEffect->wImgIdx;
- m_dwFstEffectFrame = pstEffect->dwFstFrm;
- m_dwEndEffectFrame = pstEffect->dwEndFrm;
- if ( bDir )
- {
- m_dwFstEffectFrame = m_dwFstEffectFrame + bDir*10;
- m_dwEndEffectFrame = m_dwEndEffectFrame + bDir*10;
- }
- m_dwCurrEffectFrame = m_dwFstEffectFrame;
- m_bEffectFrame = 0;
- m_bLightRadius[0] = pstEffect->bLightRadius[0];
- m_bLightRadius[1] = pstEffect->bLightRadius[1];
- m_bLightColor[0][0] = pstEffect->bLightColor[0][0];
- m_bLightColor[0][1] = pstEffect->bLightColor[0][1];
- m_bLightColor[0][2] = pstEffect->bLightColor[0][2];
-
- m_bLightColor[1][0] = pstEffect->bLightColor[1][0];
- m_bLightColor[1][1] = pstEffect->bLightColor[1][1];
- m_bLightColor[1][2] = pstEffect->bLightColor[1][2];
- for ( INT nCnt = m_dwFstEffectFrame; nCnt < m_dwEndEffectFrame; nCnt++ )
- {
- if ( m_bEffectImgIdx == _IMAGE_MAGIC )
- {
- wFileType = _TEXTR_FILE_MAGIC;
- }
- else if ( m_bEffectImgIdx == _IMAGE_MONMAGIC )
- {
- wFileType = _TEXTR_FILE_MONMAGIC;
- }
- pxImgHandler->AddTextr(wFileType, m_bEffectImgIdx, nCnt);
- }
- return TRUE;
- }
- return FALSE;
- }
- /******************************************************************************************************************
- 窃荐疙 : CActor::DrawEffect()
- 累己磊 :
- 累己老 :
- 格利 :
- 免仿 : BOOL
- [老磊][荐沥磊] : 荐沥郴侩
- *******************************************************************************************************************/
- BOOL CActor::DrawEffect()
- {
- if ( g_xMainWnd.Get3DDevice() )
- {
- if( SUCCEEDED(g_xMainWnd.Get3DDevice()->BeginScene()) )
- {
- WORD wFileType;
- D3DVECTOR vTrans;
- D3DMATRIX matTrans;
- D3DMATRIX matScale;
- D3DMATRIX matRot;
- D3DMATRIX matWorld;
- D3DMATRIX matWorldOriginal;
- g_xMainWnd.Get3DDevice()->GetTransform(D3DTRANSFORMSTATE_WORLD, &matWorldOriginal);
- D3DMATERIAL7 mtrl;
- CWHWilImageData* pxWilImg;
- if ( m_bUseEffect || m_bUseSwordEffect )
- {
- BOOL bIndexSetted = FALSE;
- if ( m_bUseEffect )
- {
- pxWilImg = &g_xGameProc.m_xImage.m_xImageList[m_bEffectImgIdx];
- bIndexSetted = pxWilImg->NewSetIndex(m_dwCurrEffectFrame);
- }
- else
- {
- pxWilImg = &g_xGameProc.m_xImage.m_xImageList[m_bEffectImgIdx];
- m_dwCurrEffectFrame = m_dwFstEffectFrame + m_dwCurrFrame - m_dwFstFrame;
- bIndexSetted = pxWilImg->NewSetIndex(m_dwCurrEffectFrame);
- }
- if ( bIndexSetted )
- {
- vTrans.x = (FLOAT)m_shScrnPosX+(FLOAT)pxWilImg->m_lpstNewCurrWilImageInfo->shWidth/2+pxWilImg->m_lpstNewCurrWilImageInfo->shPX-400;
- vTrans.y = (FLOAT)-m_shScrnPosY-(FLOAT)pxWilImg->m_lpstNewCurrWilImageInfo->shHeight/2-pxWilImg->m_lpstNewCurrWilImageInfo->shPY+300;
- vTrans.z = 0;
- D3DUtil_SetTranslateMatrix(matTrans, vTrans);
- D3DUtil_SetScaleMatrix(matScale, (FLOAT)pxWilImg->m_lpstNewCurrWilImageInfo->shWidth, (FLOAT)pxWilImg->m_lpstNewCurrWilImageInfo->shHeight, 0.0f);
- D3DMath_MatrixMultiply(matWorld, matScale, matTrans);
- g_xMainWnd.Get3DDevice()->SetTransform(D3DTRANSFORMSTATE_WORLD, &matWorld);
- if ( m_bEffectImgIdx == _IMAGE_MAGIC )
- {
- wFileType = _TEXTR_FILE_MAGIC;
- }
- else if ( m_bEffectImgIdx == _IMAGE_MONMAGIC )
- {
- wFileType = _TEXTR_FILE_MONMAGIC;
- }
- LPDIRECTDRAWSURFACE7 lpddsTextr = g_xGameProc.m_xImage.GetTextrImg(wFileType, m_bEffectImgIdx, m_dwCurrEffectFrame);
- g_xMainWnd.Get3DDevice()->SetTexture(0, lpddsTextr);
- // g_xMainWnd.Get3DDevice()->SetTexture(0, D3DWILTextr_GetSurface(pxWilImg->m_szWilFileName, m_dwCurrEffectFrame));
- D3DUtil_InitMaterial(mtrl,
- (FLOAT)255/255.0f,
- (FLOAT)255/255.0f,
- (FLOAT)255/255.0f);
- mtrl.diffuse.a = 0/255.0f;
- g_xMainWnd.Get3DDevice()->SetMaterial(&mtrl);
- SetBlendRenderState(g_xMainWnd.Get3DDevice(), _BLEND_LIGHTINV, mtrl);
- g_xMainWnd.Get3DDevice()->DrawPrimitive(D3DPT_TRIANGLESTRIP, D3DFVF_VERTEX, m_avBoard, 4, NULL);
- // 盔惑汗蓖.
- ZeroMemory(&mtrl, sizeof(mtrl));
- mtrl.diffuse.r = mtrl.diffuse.g = mtrl.diffuse.b = 0.1f;
- mtrl.ambient.r = mtrl.ambient.g = mtrl.ambient.b = 1.0f;
- g_xMainWnd.Get3DDevice()->SetMaterial(&mtrl);
- ResetBlendenderState(g_xMainWnd.Get3DDevice());
- g_xMainWnd.Get3DDevice()->SetTransform(D3DTRANSFORMSTATE_WORLD, &matWorldOriginal);
- }
- if ( m_bUseEffect )
- {
- if ( m_bEffectFrame < m_bEffectFrameCnt / 2 )
- {
- m_bLightRadius[0] = m_bEffectFrame;
- m_bLightRadius[1] = m_bEffectFrame+1;
- }
- else
- {
- m_bLightRadius[0] = m_bEffectFrameCnt - m_bEffectFrame -1;
- m_bLightRadius[1] = m_bEffectFrameCnt - m_bEffectFrame;
- }
-
- g_xGameProc.m_xLightFog.SetLightRadiusWithRing(
- m_shScrnPosX + _CELL_WIDTH/2,
- m_shScrnPosY + _CELL_HEIGHT/2,
- m_bLightRadius[0], m_bLightColor[0][0], m_bLightColor[0][1], m_bLightColor[0][2],
- m_bLightRadius[1], m_bLightColor[1][0], m_bLightColor[1][1], m_bLightColor[1][2]);
- }
- else if ( m_bUseSwordEffect )
- {
- if ( m_dwEndEffectFrame - m_dwFstEffectFrame > 8 )
- {
- m_bLightRadius[0] = (m_dwCurrEffectFrame - m_dwFstEffectFrame)/2 + 2;
- m_bLightRadius[1] = (m_dwCurrEffectFrame - m_dwFstEffectFrame)/2 + 3;
- }
- else
- {
- m_bLightRadius[0] = m_dwCurrEffectFrame - m_dwFstEffectFrame + 2;
- m_bLightRadius[1] = m_dwCurrEffectFrame - m_dwFstEffectFrame + 3;
- }
- g_xGameProc.m_xLightFog.SetLightRadiusWithRing(
- m_shScrnPosX + _CELL_WIDTH/2,
- m_shScrnPosY + _CELL_HEIGHT/2,
- m_bLightRadius[0], m_bLightColor[0][0], m_bLightColor[0][1], m_bLightColor[0][2],
- m_bLightRadius[1], m_bLightColor[1][0], m_bLightColor[1][1], m_bLightColor[1][2]);
- }
- }
- g_xMainWnd.Get3DDevice()->EndScene();
- return S_OK;
- }
- }
- return E_FAIL;
- }
- /******************************************************************************************************************
- 窃荐疙 : CActor::UpdateMotionState()
- 累己磊 :
- 累己老 :
- 格利 :
- 涝仿 : INT nLoopTime
- SHORT shStartViewTileX
- SHORT shStartViewTileY
- SHORT shViewOffsetX
- SHORT shViewOffsetY
- 免仿 : VOID
- [老磊][荐沥磊] : 荐沥郴侩
- *******************************************************************************************************************/
- VOID CActor::UpdateMotionState(INT nLoopTime, BOOL bIsMoveTime)
- {
- m_wABlendCurrDelay += nLoopTime;
- if ( m_wABlendCurrDelay >= m_wABlendDelay )
- {
- m_wABlendCurrDelay = 0;
- m_wABlendDelay = 0;
- m_bABlendRev = FALSE;
- }
- if ( m_bCurrMtn == _MT_MON_DIE && m_dwCurrFrame >= m_dwEndFrame-1 )
- {
- m_bIsDead = TRUE;
- }
- if ( m_bIsDead )
- {
- SetMotionFrame(_MT_MON_DIE, m_bCurrDir);
- m_dwCurrFrame = m_dwEndFrame - 1;
- return;
- }
- if ( UpdateMove(bIsMoveTime) )
- {
- UpdatePacketState();
- return;
- }
- else
- {
- m_wCurrDelay += nLoopTime;
- if ( m_wCurrDelay > m_wDelay )
- {
- m_wCurrDelay = 0;
- if ( m_dwCurrFrame < m_dwEndFrame )
- {
- m_dwCurrFrame++;
- PlayActSound();
- if ( m_bMsgHurryCheck )
- {
- m_wDelay = m_wDelay/2;
- m_bMsgHurryCheck = FALSE;
- }
- }
- }
- UpdatePacketState();
- if ( m_dwCurrFrame >= m_dwEndFrame )
- {
- m_shShiftTileX = 0;
- m_shShiftTileY = 0;
- m_shShiftPixelX = 0;
- m_shShiftPixelY = 0;
- m_bReverse = FALSE;
- 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;
- SetMotionFrame(_MT_MON_STAND, m_bCurrDir);
- if( m_nState & 0X1 ) // 籍拳惑怕.
- {
- switch ( m_stFeature.bDress )
- {
- case 83: //林付脚厘.
- case 84: //林付龋过.
- case 85: //林付空.
- SetMotionFrame(_MT_MON_APPEAR, 0);
- m_dwEndFrame = m_dwFstFrame + 1;
- m_bCurrMtn = _MT_MON_STAND;
- }
- }
- if ( m_bAppearState == _DIG_DOWN )
- m_bAppearState = _DIG_DOWNDEL;
- }
- }
- }
- /******************************************************************************************************************
- 窃荐疙 : CActor::UpdateMove(BOOL bIsMoveTime)
- 累己磊 :
- 累己老 :
- 格利 :
- 免仿 : BOOL
- [老磊][荐沥磊] : 荐沥郴侩
- *******************************************************************************************************************/
- BOOL CActor::UpdateMove(BOOL bIsMoveTime)
- {
- if ( m_bCurrMtn == _MT_MON_WALK || m_bCurrMtn == _MT_PUSHBACK )
- {
- m_wCurrDelay = 0;
- if ( bIsMoveTime )
- {
- if ( m_bBackStepFrameCnt )
- {
- m_dwCurrFrame += 2;
- }
- else
- {
- m_dwCurrFrame++;
- if ( m_bMsgHurryCheck )
- {
- 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_shShiftTileX = 0;
- m_shShiftTileY = 0;
- m_shShiftPixelX = 0;
- m_shShiftPixelY = 0;
- m_dwCurrEffectFrame = 0;
- m_dwFstEffectFrame = 0;
- m_dwEndEffectFrame = 0;
- m_bEffectFrame = 0;
- m_bUseEffect = FALSE;
- m_bUseSwordEffect = FALSE;
- m_dwCurrFrame = m_dwFstFrame;
- m_bBackStepFrame = 0;
- m_bBackStepFrameCnt = 0;
- m_bIsMoved = FALSE;
- SetMotionFrame(_MT_MON_STAND, m_bCurrDir);
- }
- else if ( m_dwCurrFrame < m_dwEndFrame )
- {
- if ( m_bCurrMtn != _MT_PUSHBACK )
- SetMoving();
- else
- SetBackStepMoving();
- }
- return TRUE;
- }
- return FALSE;
- }
- /******************************************************************************************************************
- 窃荐疙 : CActor::DrawActor()
- 累己磊 :
- 累己老 :
- 格利 :
- 涝仿 : BOOL bFocused
- BOOL bShadowAblended
- 免仿 : VOID
- [老磊][荐沥磊] : 荐沥郴侩
- *******************************************************************************************************************/
- BOOL CActor::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;
- if ( m_pxActorImage )
- {
- SHORT shPX, shPY;
- DWORD dwCurrFrm;
- if ( !m_bReverse )
- {
- if ( m_bBackStepFrameCnt ) dwCurrFrm = m_dwEndFrame - (m_dwCurrFrame - m_dwFstFrame) -1;
- else dwCurrFrm = m_dwCurrFrame;
- }
- else
- {
- if ( m_bBackStepFrameCnt ) dwCurrFrm = m_dwCurrFrame;
- else dwCurrFrm = m_dwEndFrame - (m_dwCurrFrame - m_dwFstFrame) -1;
- }
- if ( m_pxActorImage->NewSetIndex(dwCurrFrm) )
- {
- 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;
- }
- INT nStartX1 = m_shScrnPosX + shShadowPX;
- INT nStartY1 = m_shScrnPosY + shShadowPY;
- BYTE bOpaRate = 70;
- WORD wState = GetCharState();
- // 阁胶磐 弊覆磊 颇老 利侩.
- if ( bDrawShadow )
- {
- CWHWilImageData* pxSahdowImage;
- pxSahdowImage = &g_xGameProc.m_xImage.m_xImageList[m_bActorImgIdx+_MAX_MONSTER_IMAGE];
- if ( pxSahdowImage->NewSetIndex(dwCurrFrm) )
- {
- SHORT shShadowPX, shShadowPY;
- if ( m_wABlendDelay || wState==_STATE_ABLEND || bShadowAblended )
- {
- shShadowPX = pxSahdowImage->m_lpstNewCurrWilImageInfo->shPX;
- shShadowPY = pxSahdowImage->m_lpstNewCurrWilImageInfo->shPY;
- g_xMainWnd.DrawWithABlendCompDataWithBackBuffer(m_shScrnPosX+shShadowPX, m_shScrnPosY+shShadowPY, pxSahdowImage->m_lpstNewCurrWilImageInfo->shWidth, pxSahdowImage->m_lpstNewCurrWilImageInfo->shHeight, (WORD*)pxSahdowImage->m_pbCurrImage,
- _CLIP_WIDTH, _CLIP_HEIGHT, 0XFFFF, 0XFFFF, bOpaRate);
- }
- else
- {
- shShadowPX = pxSahdowImage->m_lpstNewCurrWilImageInfo->shPX;
- shShadowPY = pxSahdowImage->m_lpstNewCurrWilImageInfo->shPY;
-
- if ( !m_bIsDead )
- g_xMainWnd.DrawWithImageForCompClipRgn(m_shScrnPosX+shShadowPX, m_shScrnPosY+shShadowPY, pxSahdowImage->m_lpstNewCurrWilImageInfo->shWidth, pxSahdowImage->m_lpstNewCurrWilImageInfo->shHeight, (WORD*)pxSahdowImage->m_pbCurrImage,
- _CLIP_WIDTH, _CLIP_HEIGHT, 0XFFFF, 0XFFFF, bFocused);
- }
- }
- // 拌魂秦辑 弊府扁.
- else
- {
- // 弊覆磊甫 弊赴促.
- if ( m_wABlendDelay || wState==_STATE_ABLEND || bShadowAblended )
- {
- if ( bOpaRate < 0 && bOpaRate > 100 ) bOpaRate = 0;
- bShadowAblended = TRUE;
- }
- 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 )
- {
- if ( !m_bABlendRev )
- bOpaRate = 100 - ( (m_wABlendCurrDelay * 100) / m_wABlendDelay );
- else
- bOpaRate = ( (m_wABlendCurrDelay * 100) / m_wABlendDelay );
- }
- if ( bOpaRate < 0 && bOpaRate > 100 ) bOpaRate = 0;
- if ( bFocused )
- {
- if ( !m_bABlendRev )
- bOpaRate -= 20;
- else
- bOpaRate += 20;
- }
- DrawWithEffected(m_rcActor.left, m_rcActor.top, m_pxActorImage->m_lpstNewCurrWilImageInfo->shWidth, m_pxActorImage->m_lpstNewCurrWilImageInfo->shHeight, (WORD*)m_pxActorImage->m_pbCurrImage,
- 0XFFFF, 0XFFFF, bFocused, bOpaRate, wState);
- DrawEffect();
- return TRUE;
- }
- }
- return FALSE;
- }
- /******************************************************************************************************************
- 窃荐疙 : CActor::DrawHPBar()
- 累己磊 :
- 累己老 :
- 格利 :
- 免仿 : VOID
- [老磊][荐沥磊] : 荐沥郴侩
- *******************************************************************************************************************/
- VOID CActor::DrawHPBar()
- {
- if ( m_bOpenHealth )
- {
- FLOAT fHPPercent = (FLOAT)((FLOAT)m_bHPPercent/100);
- RECT rcHP = {0, 0, (36*fHPPercent), 4};
- g_xGameProc.m_xImage.m_xImageList[_IMAGE_PROGUSE].NewSetIndex(2);
- g_xMainWnd.DrawWithImageForComp(
- m_shScrnPosX+7,
- m_shScrnPosY-53,
- g_xGameProc.m_xImage.m_xImageList[_IMAGE_PROGUSE].m_lpstNewCurrWilImageInfo->shWidth,
- g_xGameProc.m_xImage.m_xImageList[_IMAGE_PROGUSE].m_lpstNewCurrWilImageInfo->shHeight,
- (WORD*)g_xGameProc.m_xImage.m_xImageList[_IMAGE_PROGUSE].m_pbCurrImage);
- g_xGameProc.m_xImage.m_xImageList[_IMAGE_PROGUSE].NewSetIndex(3);
- g_xMainWnd.DrawWithImageForComp(
- m_shScrnPosX+7,
- m_shScrnPosY-53,
- rcHP,
- (WORD*)g_xGameProc.m_xImage.m_xImageList[_IMAGE_PROGUSE].m_pbCurrImage);
- }
- }
- /******************************************************************************************************************
- 窃荐疙 : CActor::DrawName()
- 累己磊 :
- 累己老 :
- 格利 :
- 免仿 : VOID
- [老磊][荐沥磊] : 荐沥郴侩
- *******************************************************************************************************************/
- VOID CActor::DrawName()
- {
- SIZE sizeLen;
- sizeLen = g_xMainWnd.GetStrLength(NULL, NULL, m_szName);
- // RECT rc = {m_shScrnPosX+(_CELL_WIDTH-sizeLen.cx)/2, m_shScrnPosY-25, m_shScrnPosX+(_CELL_WIDTH+sizeLen.cx)/2, m_shScrnPosY-25+20};
- RECT rc = {m_rcActor.left + (m_rcActor.right-m_rcActor.left-sizeLen.cx)/2, m_rcActor.top + (m_rcActor.bottom-m_rcActor.top-sizeLen.cy)/2,
- m_rcActor.left + (m_rcActor.right-m_rcActor.left+sizeLen.cx)/2, m_rcActor.top + (m_rcActor.bottom-m_rcActor.top+sizeLen.cy)/2};
- RECT rcLeft = {rc.left+1, rc.top-1, rc.right+1, rc.bottom-1};
- g_xMainWnd.PutsHan(NULL, rc, RGB(10, 10, 10), RGB(0, 0, 0), m_szName);
- g_xMainWnd.PutsHan(NULL, rcLeft, m_dwNameClr, RGB(0, 0, 0), m_szName);
- }
- VOID CActor::ChatMsgAdd()
- {
- CHAR szDivied[MAX_PATH*2];
- ZeroMemory(szDivied, MAX_PATH*2);
- g_xMainWnd.StringDivide(_CHAT_WIDTH, m_nDividedChatLine, m_szChatMsg, szDivied);
- sscanf(szDivied, "%[^`]%*c %[^`]%*c %[^`]%*c %[^`]%*c %[^`]%*c",
- m_szChatMsgArg[0], m_szChatMsgArg[1], m_szChatMsgArg[2], m_szChatMsgArg[3], m_szChatMsgArg[4]);
- m_wCurrChatDelay = 0;
- }
- VOID CActor::ShowMessage(INT nLoopTime)
- {
- if ( m_szChatMsg[0] != NULL )
- {
- m_wCurrChatDelay += nLoopTime;
- }
- if ( m_wCurrChatDelay > 3000 )
- {
- m_wCurrChatDelay = 0;
- ZeroMemory(m_szChatMsg, MAX_PATH);
- ZeroMemory(m_szChatMsgArg, MAX_PATH*5);
- }
- if ( m_szChatMsg[0] != NULL )
- {
- INT nStartX = m_shScrnPosX + 28 - _CHAT_WIDTH/2;
- INT nStartY;
- /* if ( m_stFeatureEx.bHorse == _HORSE_NONE )
- nStartY = m_shScrnPosY - 55;
- else
- */ nStartY = m_shScrnPosY - 55;
- RECT rcBack;
- if ( m_nDividedChatLine == 1 )
- {
- SIZE sizeLen;
- sizeLen = g_xMainWnd.GetStrLength(NULL, NULL, m_szChatMsgArg[0]);
- nStartX = m_shScrnPosX + 28 - sizeLen.cx/2;
- SetRect(&rcBack, nStartX, nStartY-14-4, nStartX+sizeLen.cx, nStartY);
- }
- else
- SetRect(&rcBack, nStartX, nStartY-m_nDividedChatLine*14-4, nStartX+_CHAT_WIDTH, nStartY);
- if ( g_xMainWnd.Get3DDevice() )
- {
- if( SUCCEEDED(g_xMainWnd.Get3DDevice()->BeginScene()) )
- {
- D3DVECTOR vTrans;
- D3DMATRIX matTrans;
- D3DMATRIX matScale;
- D3DMATRIX matWorld;
- D3DMATRIX matWorldOriginal;
- g_xMainWnd.Get3DDevice()->GetTransform(D3DTRANSFORMSTATE_WORLD, &matWorldOriginal);
- D3DMATERIAL7 mtrl;
- vTrans.x = (FLOAT)nStartX-400+(rcBack.right-rcBack.left)/2;
- vTrans.y = (FLOAT)-nStartY+300+(rcBack.bottom-rcBack.top)/2;
- vTrans.z = 0;
- D3DUtil_SetTranslateMatrix(matTrans, vTrans);
- D3DUtil_SetScaleMatrix(matScale, (FLOAT)rcBack.right-rcBack.left, (FLOAT)rcBack.bottom-rcBack.top, 0.0f);
- D3DMath_MatrixMultiply(matWorld, matScale, matTrans);
- g_xMainWnd.Get3DDevice()->SetTransform(D3DTRANSFORMSTATE_WORLD, &matWorld);
- D3DUtil_InitMaterial(mtrl,
- (FLOAT)80/255.0f,
- (FLOAT)60/255.0f,
- (FLOAT)40/255.0f);
- mtrl.diffuse.a = 120/255.0f;
- g_xMainWnd.Get3DDevice()->SetMaterial(&mtrl);
- g_xMainWnd.Get3DDevice()->SetRenderState( D3DRENDERSTATE_ALPHABLENDENABLE, TRUE );
- g_xMainWnd.Get3DDevice()->SetRenderState(D3DRENDERSTATE_COLORKEYENABLE, TRUE);
- g_xMainWnd.Get3DDevice()->SetTextureStageState(0, D3DTSS_ALPHAARG1, D3DTA_TEXTURE);
- g_xMainWnd.Get3DDevice()->SetTextureStageState(0, D3DTSS_ALPHAOP, D3DTOP_MODULATE);
- g_xMainWnd.Get3DDevice()->SetTextureStageState(0, D3DTSS_ALPHAARG2, D3DTA_DIFFUSE);
- g_xMainWnd.Get3DDevice()->SetRenderState(D3DRENDERSTATE_SRCBLEND, D3DBLEND_ONE);
- g_xMainWnd.Get3DDevice()->SetRenderState(D3DRENDERSTATE_DESTBLEND, D3DBLEND_INVSRCALPHA);
- g_xMainWnd.Get3DDevice()->SetRenderState(D3DRENDERSTATE_SRCBLEND, D3DBLEND_ONE);
- g_xMainWnd.Get3DDevice()->SetRenderState(D3DRENDERSTATE_DESTBLEND, D3DBLEND_INVSRCALPHA);
- g_xMainWnd.Get3DDevice()->SetTexture(0, NULL);
- g_xMainWnd.Get3DDevice()->DrawPrimitive(D3DPT_TRIANGLESTRIP, D3DFVF_VERTEX, m_avBoard, 4, NULL);
- // 盔惑汗蓖.
- ZeroMemory(&mtrl, sizeof(mtrl));
- mtrl.diffuse.r = mtrl.diffuse.g = mtrl.diffuse.b = 0.1f;
- mtrl.ambient.r = mtrl.ambient.g = mtrl.ambient.b = 1.0f;
- g_xMainWnd.Get3DDevice()->SetMaterial(&mtrl);
- g_xMainWnd.Get3DDevice()->SetTextureStageState(0, D3DTSS_COLORARG1, D3DTA_TEXTURE);
- g_xMainWnd.Get3DDevice()->SetTextureStageState(0, D3DTSS_COLOROP, D3DTOP_MODULATE);
- g_xMainWnd.Get3DDevice()->SetTextureStageState(0, D3DTSS_COLORARG2, D3DTA_DIFFUSE);
- g_xMainWnd.Get3DDevice()->SetTextureStageState(0, D3DTSS_ALPHAARG1, D3DTA_TEXTURE);
- g_xMainWnd.Get3DDevice()->SetTextureStageState(0, D3DTSS_ALPHAOP, D3DTOP_SELECTARG1);
- g_xMainWnd.Get3DDevice()->SetTextureStageState(0, D3DTSS_ALPHAARG2, D3DTA_DIFFUSE);
- g_xMainWnd.Get3DDevice()->SetRenderState(D3DRENDERSTATE_ALPHABLENDENABLE, FALSE);
- g_xMainWnd.Get3DDevice()->SetRenderState(D3DRENDERSTATE_COLORKEYENABLE, FALSE);
- g_xMainWnd.Get3DDevice()->SetRenderState(D3DRENDERSTATE_SRCBLEND , D3DBLEND_ONE);
- g_xMainWnd.Get3DDevice()->SetRenderState(D3DRENDERSTATE_DESTBLEND, D3DBLEND_ZERO);
- g_xMainWnd.Get3DDevice()->SetTransform(D3DTRANSFORMSTATE_WORLD, &matWorldOriginal);
- g_xMainWnd.Get3DDevice()->EndScene();
- }
- }
- for ( INT nCnt = 0; nCnt < m_nDividedChatLine; nCnt++ )
- {
- SIZE sizeLen;
- sizeLen = g_xMainWnd.GetStrLength(NULL, NULL, m_szChatMsgArg[nCnt]);
- if ( m_nDividedChatLine != 1 )
- {
- if ( nCnt == m_nDividedChatLine-1 )
- {
- nStartX += (_CHAT_WIDTH-sizeLen.cx)/2;
- }
- }
- g_xMainWnd.PutsHan(g_xMainWnd.GetBackBuffer(),
- nStartX, nStartY-(m_nDividedChatLine-nCnt)*14,
- RGB(255,255,255), RGB(0,0,0), m_szChatMsgArg[nCnt]);
- }
- }
- }
- /******************************************************************************************************************
- CNPC Class
- *******************************************************************************************************************/
- /******************************************************************************************************************
- 窃荐疙 : CNPC::DrawActor()
- 累己磊 :
- 累己老 :
- 格利 :
- 涝仿 : CMapHandler* pxMap
- BOOL bFocused
- BOOL bShadowAblended
- 免仿 : BOOL
- [老磊][荐沥磊] : 荐沥郴侩
- *******************************************************************************************************************/
- BOOL CNPC::DrawActor(CMapHandler* pxMap, BOOL bFocused, BOOL bShadowAblended, BOOL bUseScrnPos, BOOL bDrawShadow)
- {
- // 谅钎贸府.
- 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;
- if ( m_pxActorImage )
- {
- SHORT shPX, shPY;
- m_pxActorImage->NewSetIndex(m_dwCurrFrame);
- 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;
- }
- // 某腐磐 弊覆磊.
- INT nStartX1 = m_shScrnPosX + shShadowPX;
- INT nStartY1 = m_shScrnPosY + shShadowPY;
- BYTE bOpaRate = 70;
- WORD wState = GetCharState();
- // 弊覆磊甫 弊赴促.
- if ( m_wABlendDelay || wState==_STATE_ABLEND )
- {
- bShadowAblended = TRUE;
- }
- if ( bDrawShadow )
- 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);
- if ( m_wABlendDelay )
- {
- if ( !m_bABlendRev )
- bOpaRate = 100 - ( (m_wABlendCurrDelay * 100) / m_wABlendDelay );
- else
- bOpaRate = ( (m_wABlendCurrDelay * 100) / m_wABlendDelay );
- }
- if ( bOpaRate < 0 && bOpaRate > 100 ) bOpaRate = 0;
- if ( bFocused )
- {
- if ( !m_bABlendRev )
- bOpaRate -= 20;
- else
- bOpaRate += 20;
- }
- DrawWithEffected(m_rcActor.left, m_rcActor.top, m_pxActorImage->m_lpstNewCurrWilImageInfo->shWidth, m_pxActorImage->m_lpstNewCurrWilImageInfo->shHeight, (WORD*)m_pxActorImage->m_pbCurrImage,
- 0XFFFF, 0XFFFF, bFocused, bOpaRate, wState);
- return TRUE;
- }
- return FALSE;
- }
- VOID CNPC::OnTurn(LPPACKETMSG lpPacketMsg)
- {
- BYTE bDir;
- m_wPosX = lpPacketMsg->stDefMsg.wParam;
- m_wPosY = lpPacketMsg->stDefMsg.wTag;
- bDir = LOBYTE(lpPacketMsg->stDefMsg.wSeries);
- m_bLightSize = HIBYTE(lpPacketMsg->stDefMsg.wSeries);
- OnCharDescPacket(lpPacketMsg);
- SetMotionFrame(_MT_NPC_STAND, bDir);
- }
- VOID CNPC::OnHit(LPPACKETMSG lpPacketMsg)
- {
- BYTE bDir;
- bDir = lpPacketMsg->stDefMsg.wSeries;
- m_wPosX = lpPacketMsg->stDefMsg.wParam;
- m_wPosY = lpPacketMsg->stDefMsg.wTag;
- SetMotionFrame(_MT_NPC_ACT01, bDir);
- }
- /******************************************************************************************************************
- 窃荐疙 : CNPC::UpdatePacketState()
- 累己磊 :
- 累己老 :
- 格利 :
- 免仿 : BOOL
- [老磊][荐沥磊] : 荐沥郴侩
- *******************************************************************************************************************/
- BOOL CNPC::UpdatePacketState()
- {
- // if ( m_bCurrMtn == _MT_NPC_STAND )
- {
- 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_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_TURN: { OnTurn(lpPacketMsg); break; }
- case SM_HIT: { OnHit(lpPacketMsg); break; }
- default:
- {
- break;
- }
- }
- }
- SAFE_DELETE(lpPacketMsg);
- return TRUE;
- }
- }
- return FALSE;
- }
- /******************************************************************************************************************
- 窃荐疙 : CNPC::UpdateMotionState()
- 累己磊 :
- 累己老 :
- 格利 :
- 涝仿 : INT nLoopTime
- BOOL bIsMoveTime
- 免仿 : VOID
- [老磊][荐沥磊] : 荐沥郴侩
- *******************************************************************************************************************/
- VOID CNPC::UpdateMotionState(INT nLoopTime, BOOL bIsMoveTime)
- {
- m_wCurrDelay += nLoopTime;
- if ( m_wCurrDelay > m_wDelay )
- {
- m_wCurrDelay = 0;
- if ( m_dwCurrFrame < m_dwEndFrame ) m_dwCurrFrame++;
- }
- UpdatePacketState();
- if ( m_dwCurrFrame >= m_dwEndFrame ) m_dwCurrFrame = m_dwFstFrame;
- }
- /******************************************************************************************************************
- CHero Class
- *******************************************************************************************************************/
- /******************************************************************************************************************
- 窃荐疙 : CHero::CHero()
- 累己磊 :
- 累己老 :
- 格利 :
- 免仿 :
- [老磊][荐沥磊] : 荐沥郴侩
- *******************************************************************************************************************/
- CHero::CHero()
- {
- InitActor();
- }
- /******************************************************************************************************************
- 窃荐疙 : CHero::~CHero()
- 累己磊 :
- 累己老 :
- 格利 :
- 免仿 :
- [老磊][荐沥磊] : 荐沥郴侩
- *******************************************************************************************************************/
- CHero::~CHero()
- {
- DestroyActor();
- }
- VOID CHero::InitActor()
- {
- CActor::InitActor();
- ZeroMemory(&m_stFeatureEx, sizeof(FEATUREEX));
- m_bWeaponImgIdx = 0;
- m_bHairImgIdx = 0;
- m_bHorseImgIdx = 0;
- m_bYedoCnt = 0;
- m_bFireHitCnt = 0;
- m_shHitSpeed = 0;
- m_pxHairImage = NULL;
- m_pxWeaponImage = NULL;
- m_pxHorseImage = NULL;
- m_bUseBanwol = FALSE;
- m_bUseErgum = FALSE;
- m_bIsMon = FALSE;
- m_bShieldCurrFrm = 0;
- m_wShieldCurrDelay = 0;
- m_dwCurrHairFrame = 0;
- m_dwCurrWeaponFrame = 0;
- m_dwCurrHorseFrame = 0;
- m_shCurrMagicID = 0;
- ZeroMemory(&m_rcHair, sizeof(RECT));
- ZeroMemory(&m_rcWeapon, sizeof(RECT));
- ZeroMemory(&m_rcHorse, sizeof(RECT));
- }
- VOID CHero::DestroyActor()
- {
- CActor::DestroyActor();
- InitActor();
- }
- /******************************************************************************************************************
- 窃荐疙 : CHero::Create()
- 累己磊 :
- 累己老 :
- 格利 :
- 涝仿 : CImageHandler* pxImgHandler
- WORD wActor
- BYTE bMtn
- WORD bDir
- WORD wPosX
- WORD wPosY
- FEATURE stFeature
- 免仿 : BOOL
- [老磊][荐沥磊] : 荐沥郴侩
- *******************************************************************************************************************/
- BOOL CHero::Create(CImageHandler* pxImgHandler, BYTE bMtn, BYTE bDir, WORD wPosX, WORD wPosY,
- FEATURE* pstFeature, FEATUREEX* pstFeatureEx)
- {
- if ( CActor::Create(pxImgHandler, pstFeature, bMtn, bDir, wPosX, wPosY) )
- {
- m_bIsMon = FALSE;
-
- // memcpy(&m_stFeatureEx, pstFeatureEx, sizeof(FEATUREEX));
- //!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
- m_stFeatureEx.bHorse = 0;
- m_stFeatureEx.wDressColor = 0XFF;
- m_stFeatureEx.wHairColor = 0XFF;
- //!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
- 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;
- }
- VOID CHero::PlayActSound()
- {
- INT nWaveNum = -1;
- if ( m_dwCurrFrame == m_dwFstFrame+1 && m_bCurrMtn == _MT_HITTED )
- {
- switch ( m_stHitter.bWeapon )
- {
- case 21: case 24: // 窜八, 厚窜八.
- case 8: case 9: // 格八, 酒府荐格八.
- case 18: case 22: case 23: case 26: case 27: case 28: case 30: // 荤葛八. 没悼八. 枚八. 没澜八. 寒荤八. 玫飞. 邦己八.
- case 1: case 4: case 11: case 13: case 14: case 20: case 25: case 29: case 31: // 蜡岿档. 宫没措档. 腊钦档. 焙档. 档锋焊档. 荤阿档. 技梅档. 抗档. 檬去档.
- nWaveNum = 70;
- break;
- case 5: case 10: case 12: // 伙利措何. 没悼档尝. 楷磊何.
- case 15: // 颇锄柳寸.
- nWaveNum = 71;
- break;
- case 2: case 3: case 6: case 7: case 16: case 17: case 19: // 伙瘤芒. 玫屈格. 全酒芒. 邦豹捞. 没付芒, 侩酒厘. 力付豪
- nWaveNum = 72;
- break;
- default:
- nWaveNum = 73; // 盖颊.
- break;
- }
- if ( m_stFeature.bDress == 3 ) // 固癌林.
- nWaveNum += 10;
- }
- else if ( m_dwCurrFrame == m_dwFstFrame+2 && m_bCurrMtn == _MT_HITTED )
- {
- if ( m_stFeature.bGender == _GENDER_MAN ) nWaveNum = 138;
- else nWaveNum = 139;
- }
- else if ( m_dwCurrFrame == m_dwFstFrame+1 && m_bCurrMtn == _MT_DIE )
- {
- if ( m_stFeature.bGender == _GENDER_MAN ) nWaveNum = 144;
- else nWaveNum = 145;
- }
- else if ( m_dwCurrFrame == m_dwFstFrame+1 && m_bCurrMtn >= _MT_ONEVSWING && m_bCurrMtn <= _MT_SPEARHSWING )
- {
- if ( m_bFireHitCnt == 2 )
- {
- nWaveNum = 137;
- }
- else if ( m_bYedoCnt == 2 )
- {
- /* if ( m_stFeature.bGender == _GENDER_MAN )
- {
- g_xSound.PlayActorWav(m_wPosX, m_wPosY, g_xGameProc.m_xMyHero.m_wPosX, g_xGameProc.m_xMyHero.m_wPosY, 130);
- }
- else
- {
- g_xSound.PlayActorWav(m_wPosX, m_wPosY, g_xGameProc.m_xMyHero.m_wPosX, g_xGameProc.m_xMyHero.m_wPosY, 131);
- }
- */ m_bYedoCnt = 0;
- }
- else if ( m_bUseBanwol )
- {
- nWaveNum = 133;
- }
- else if ( m_bUseErgum )
- {
- nWaveNum = 132;
- }
- }
- else if ( m_dwCurrFrame == m_dwFstFrame+2 && m_bCurrMtn >= _MT_ONEVSWING && m_bCurrMtn <= _MT_SPEARHSWING )
- {
- switch ( m_stFeature.bWeapon )
- {
- case 21: case 24: // 窜八, 厚窜八.
- nWaveNum = 50;
- break;
- case 8: case 9: // 格八, 酒府荐格八.
- nWaveNum = 51;
- break;
- case 18: case 22: case 23: case 26: case 27: case 28: case 30: // 荤葛八. 没悼八. 枚八. 没澜八. 寒荤八. 玫飞. 邦己八.
- nWaveNum = 52;
- break;
- case 1: case 4: case 11: case 13: case 14: case 20: case 25: case 29: case 31: // 蜡岿档. 宫没措档. 腊钦档. 焙档. 档锋焊档. 荤阿档. 技梅档. 抗档. 檬去档.
- nWaveNum = 53;
- break;
- case 5: case 10: case 12: // 伙利措何. 没悼档尝. 楷磊何.
- nWaveNum = 54;
- break;
- case 15: // 颇锄柳寸.
- nWaveNum = 55;
- break;
- case 2: case 3: case 6: case 7: case 16: case 17: case 19: // 伙瘤芒. 玫屈格. 全酒芒. 邦豹捞. 没付芒, 侩酒厘. 力付豪
- nWaveNum = 56;
- break;
- default:
- nWaveNum = 57; // 盖颊.
- break;
- }
- }
- else if ( m_dwCurrFrame == m_dwFstFrame+1 && (m_bCurrMtn == _MT_SPELL1 || m_bCurrMtn == _MT_SPELL2) )
- {
- const INT nMagicSndTbl[31] =
- {
- 0, 6, 8, 14, 15, 9, 0, 20, 21, 32,
- 1, 2, 16, 29, 24, 10, 17, 33, 19, 31,
- 28, 22, 13, 21, 5, 0, 12, 11, 0, 18,
- 30,
- };
- if ( m_shCurrMagicID < 31 )
- {
- nWaveNum = nMagicSndTbl[m_shCurrMagicID]*10 + 10000;
- }
- if ( nWaveNum < 10010 )
- nWaveNum = -1;
- }
- /* if ( nWaveNum != -1 )
- g_xSound.PlayActorWav(m_wPosX, m_wPosY, g_xGameProc.m_xMyHero.m_wPosX, g_xGameProc.m_xMyHero.m_wPosY, nWaveNum);
- */}
- VOID CHero::PlayMoveSound()
- {
- 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 )
- {
- /* if ( m_dwCurrFrame == m_dwEndFrame-5 || m_bBackStepFrame == m_dwEndFrame-5 )
- g_xSound.PlayActorWav(m_wPosX, m_wPosY, g_xGameProc.m_xMyHero.m_wPosX, g_xGameProc.m_xMyHero.m_wPosY, 1,100);
- if ( m_dwCurrFrame == m_dwEndFrame-2 || m_bBackStepFrame == m_bBackStepFrameCnt-2 )
- g_xSound.PlayActorWav(m_wPosX, m_wPosY, g_xGameProc.m_xMyHero.m_wPosX, g_xGameProc.m_xMyHero.m_wPosY, 1,100);
- */ }
- }
- VOID CHero::ShowShield()
- {
- if ( m_nState & 0X100000 )
- {
- WORD wShieldFrm;
- if ( m_bCurrMtn == _MT_HITTED ) wShieldFrm = m_bShieldCurrFrm + 853;
- else wShieldFrm = m_bShieldCurrFrm + 850;
- if ( g_xMainWnd.Get3DDevice() )
- {
- if( SUCCEEDED(g_xMainWnd.Get3DDevice()->BeginScene()) )
- {
- D3DVECTOR vTrans;
- D3DMATRIX matTrans;
- D3DMATRIX matScale;
- D3DMATRIX matRot;
- D3DMATRIX matWorld;
- D3DMATRIX matWorldOriginal;
- g_xMainWnd.Get3DDevice()->GetTransform(D3DTRANSFORMSTATE_WORLD, &matWorldOriginal);
- D3DMATERIAL7 mtrl;
- CWHWilImageData* pxWilImg;
- pxWilImg = &g_xGameProc.m_xImage.m_xImageList[_IMAGE_MAGIC];
- if ( pxWilImg->NewSetIndex(wShieldFrm) )
- {
- // if ( !D3DWILTextr_GetSurface(pxWilImg->m_szWilFileName, wShieldFrm) )
- // D3DWILTextr_Restore(pxWilImg->m_szWilFileName, wShieldFrm, g_xMainWnd.Get3DDevice());
- vTrans.x = (FLOAT)m_shScrnPosX+(FLOAT)pxWilImg->m_lpstNewCurrWilImageInfo->shWidth/2+pxWilImg->m_lpstNewCurrWilImageInfo->shPX-400;
- vTrans.y = (FLOAT)-m_shScrnPosY-(FLOAT)pxWilImg->m_lpstNewCurrWilImageInfo->shHeight/2-pxWilImg->m_lpstNewCurrWilImageInfo->shPY+300;
- vTrans.z = 0;
- D3DUtil_SetTranslateMatrix(matTrans, vTrans);
- D3DUtil_SetScaleMatrix(matScale, (FLOAT)pxWilImg->m_lpstNewCurrWilImageInfo->shWidth, (FLOAT)pxWilImg->m_lpstNewCurrWilImageInfo->shHeight, 0.0f);
- D3DMath_MatrixMultiply(matWorld, matScale, matTrans);
- g_xMainWnd.Get3DDevice()->SetTransform(D3DTRANSFORMSTATE_WORLD, &matWorld);
- // g_xMainWnd.Get3DDevice()->SetTexture(0, D3DWILTextr_GetSurface(pxWilImg->m_szWilFileName, wShieldFrm));
- g_xGameProc.m_xImage.AddTextr(_TEXTR_FILE_MAGIC,_IMAGE_MAGIC, wShieldFrm);
- LPDIRECTDRAWSURFACE7 lpddsTextr = g_xGameProc.m_xImage.GetTextrImg(_TEXTR_FILE_MAGIC, _IMAGE_MAGIC, wShieldFrm);
- g_xMainWnd.Get3DDevice()->SetTexture(0, lpddsTextr);
- D3DUtil_InitMaterial(mtrl,
- (FLOAT)255/255.0f,
- (FLOAT)255/255.0f,
- (FLOAT)255/255.0f);
- mtrl.diffuse.a = 0/255.0f;
- g_xMainWnd.Get3DDevice()->SetMaterial(&mtrl);
- SetBlendRenderState(g_xMainWnd.Get3DDevice(), _BLEND_LIGHTINV, mtrl);
- g_xMainWnd.Get3DDevice()->DrawPrimitive(D3DPT_TRIANGLESTRIP, D3DFVF_VERTEX, m_avBoard, 4, NULL);
- // 盔惑汗蓖.
- ZeroMemory(&mtrl, sizeof(mtrl));
- mtrl.diffuse.r = mtrl.diffuse.g = mtrl.diffuse.b = 0.1f;
- mtrl.ambient.r = mtrl.ambient.g = mtrl.ambient.b = 1.0f;
- g_xMainWnd.Get3DDevice()->SetMaterial(&mtrl);
- ResetBlendenderState(g_xMainWnd.Get3DDevice());
- g_xMainWnd.Get3DDevice()->SetTransform(D3DTRANSFORMSTATE_WORLD, &matWorldOriginal);
- }
-
- g_xMainWnd.Get3DDevice()->EndScene();
- }
- }
- }
- }
- /******************************************************************************************************************
- 窃荐疙 : CHero::UpdateMove(BOOL bIsMoveTime)
- 累己磊 :
- 累己老 :
- 格利 :
- 免仿 : BOOL
- [老磊][荐沥磊] : 荐沥郴侩
- *******************************************************************************************************************/
- BOOL CHero::UpdateMove(BOOL bIsMoveTime)
- {
- 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_shShiftTileX = 0;
- m_shShiftTileY = 0;
- m_shShiftPixelX = 0;
- m_shShiftPixelY = 0;
- 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;
- m_bBackStepFrame = 0;
- m_bBackStepFrameCnt = 0;
- m_bIsMoved = 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 if ( m_dwCurrFrame < m_dwEndFrame )
- {
- if ( m_bCurrMtn != _MT_PUSHBACK )
- SetMoving();
- else
- SetBackStepMoving();
- }
- return TRUE;
- }
- return FALSE;
- }
- VOID CHero::OnCharDescPacket(LPPACKETMSG lpPacketMsg)
- {
- CHARDESC stCharDesc;
- FEATURE stFeature;
- fnDecode6BitBuf(lpPacketMsg->szEncodeData, (char*)&stCharDesc, sizeof(CHARDESC));
- 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);
- }
- VOID CHero::OnFeatureChanged(LPPACKETMSG lpPacketMsg)
- {
- FEATURE stFeature;
- LONG nFeature = MAKELONG(lpPacketMsg->stDefMsg.wParam, lpPacketMsg->stDefMsg.wTag);
- memcpy(&stFeature, &nFeature, sizeof(LONG));
- ChangeFeature(stFeature, m_stFeatureEx);
- }
- VOID CHero::OnCharStatusChanged(LPPACKETMSG lpPacketMsg)
- {
- m_shHitSpeed = lpPacketMsg->stDefMsg.wSeries;
- m_nState = MAKELONG(lpPacketMsg->stDefMsg.wParam, lpPacketMsg->stDefMsg.wTag);
- if( m_nState & 0X2 ) m_bOpenHealth = TRUE;
- else m_bOpenHealth = FALSE;
- }
- VOID CHero::OnRush(LPPACKETMSG lpPacketMsg)
- {
- BYTE bDir = lpPacketMsg->stDefMsg.wSeries;
- m_wPosX = lpPacketMsg->stDefMsg.wParam;
- m_wPosY = lpPacketMsg->stDefMsg.wTag;
- SetMotionFrame(_MT_MOODEPO, bDir);
- m_bMoveSpeed = _SPEED_WALK;
- SetMoving();
- }
- VOID CHero::OnBackStep(LPPACKETMSG lpPacketMsg)
- {
- BYTE bDir = lpPacketMsg->stDefMsg.wSeries;
- m_wPosX = lpPacketMsg->stDefMsg.wParam;
- m_wPosY = lpPacketMsg->stDefMsg.wTag;
- SetMotionFrame(_MT_PUSHBACK, bDir);
- if ( m_bCurrDir < 4 ) m_bMoveDir = m_bCurrDir + 4;
- else m_bMoveDir = m_bCurrDir - 4;
- m_bBackStepFrame = 0;
- m_bBackStepFrameCnt = 6;
- m_bMoveSpeed = _SPEED_WALK;
- SetBackStepMoving();
- }
- VOID CHero::OnDeath(LPPACKETMSG lpPacketMsg)
- {
- BYTE bDir;
- m_wPosX = lpPacketMsg->stDefMsg.wParam;
- m_wPosY = lpPacketMsg->stDefMsg.wTag;
- bDir = lpPacketMsg->stDefMsg.wSeries;
- OnCharDescPacket(lpPacketMsg);
- SetMotionFrame(_MT_DIE, bDir);
- if ( lpPacketMsg->stDefMsg.wIdent == SM_DEATH )
- {
- m_dwCurrFrame = m_dwEndFrame - 1;
- m_bIsDead = TRUE;
- }
- }
- VOID CHero::OnWalk(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));