bool CActorInstance::CanAct() { if (IsDead()) return false; if (IsStun()) return false; if (IsParalysis()) return false; if (IsFaint()) return false; if (IsSleep()) return false; return true; }
void CActorInstance::ReservingMotionProcess() { if (m_MotionDeque.empty()) return; TReservingMotionNode & rReservingMotionNode = m_MotionDeque.front(); float fCurrentTime = GetLocalTime(); if (rReservingMotionNode.fStartTime > fCurrentTime) return; DWORD dwNextMotionIndex = GET_MOTION_INDEX(rReservingMotionNode.dwMotionKey); switch (dwNextMotionIndex) { case CRaceMotionData::NAME_STAND_UP: case CRaceMotionData::NAME_STAND_UP_BACK: if (IsFaint()) { //Tracenf("일어서려고 했으나 기절중"); SetEndStopMotion(); // 이후의 모션 전부 1초씩 딜레이 TMotionDeque::iterator itor = m_MotionDeque.begin(); for (; itor != m_MotionDeque.end(); ++itor) { TReservingMotionNode & rNode = *itor; rNode.fStartTime += 1.0f; } return; } break; } SCurrentMotionNode kPrevMotionNode=m_kCurMotNode; EMotionPushType iMotionType=rReservingMotionNode.iMotionType; float fSpeedRatio=rReservingMotionNode.fSpeedRatio; float fBlendTime=rReservingMotionNode.fBlendTime; DWORD dwMotionKey=rReservingMotionNode.dwMotionKey; m_MotionDeque.pop_front(); DWORD dwCurrentMotionIndex=GET_MOTION_INDEX(dwMotionKey); switch (dwCurrentMotionIndex) { case CRaceMotionData::NAME_STAND_UP: case CRaceMotionData::NAME_STAND_UP_BACK: if (IsDead()) { //Tracenf("일어서려고 했으나 사망"); // 예전 데이터로 복구 m_kCurMotNode=kPrevMotionNode; __ClearMotion(); // 이전 동작 마지막 상태 유지 SetEndStopMotion(); return; } break; } //Tracenf("MOTION %d", GET_MOTION_INDEX(dwMotionKey)); int iLoopCount; if (MOTION_TYPE_ONCE == iMotionType) iLoopCount=1; else iLoopCount=0; SSetMotionData kSetMotData; kSetMotData.dwMotKey=dwMotionKey; kSetMotData.fBlendTime=fBlendTime; kSetMotData.fSpeedRatio=fSpeedRatio; kSetMotData.iLoopCount=iLoopCount; DWORD dwRealMotionKey = __SetMotion(kSetMotData); if (0 == dwRealMotionKey) return; // FIX: 위에서 호출한 __SetMotion 함수 안에서 랜덤으로 다른 모션을 재생할 가능성도 있으므로 duration은 '현재 재생중인' 모션의 duration값을 사용해야 함. //float fDurationTime=rReservingMotionNode.fDuration; float fDurationTime = GetMotionDuration(dwRealMotionKey) / fSpeedRatio; float fStartTime = rReservingMotionNode.fStartTime; float fEndTime = fStartTime + fDurationTime; if (dwRealMotionKey == 16777473) { int bp = 0; bp++; } m_kCurMotNode.uSkill = 0; m_kCurMotNode.iMotionType = iMotionType; m_kCurMotNode.fSpeedRatio = fSpeedRatio; m_kCurMotNode.fStartTime = fStartTime; m_kCurMotNode.fEndTime = fEndTime; m_kCurMotNode.dwMotionKey = dwRealMotionKey; m_kCurMotNode.dwcurFrame = 0; m_kCurMotNode.dwFrameCount = fDurationTime / (1.0f / g_fGameFPS); }