Example #1
0
Vector ActionEffector::GetSelfVelWithQueuedActions()
{
	if (IsDash()){
		return mSelfState.GetPredictedVelWithDash(1, mDash.GetPower());
	}
	else if (IsMove()){
		Vector player_pos = Vector(0.0, 0.0);
		Vector player_vel = Vector(0.0, 0.0);
		ComputeInfoAfterMove(mMove.GetMovePos(), player_pos, player_vel);
		return player_vel;
	}
	else return mSelfState.GetPredictedVel();
}
BOOL CLibInfoCharCli::IsMove(
	PCInfoCharBase pInfoChar,		/* [in] キャラ情報 */
	int &nDirection)				/* [in/ou] 移動する向き */
{
	int x, y, nDirectionTmp;
	BOOL bRet, bResult;
	RECT rcMap;
	PCInfoMapBase pInfoMap;
	POINT ptFront, ptBack;

	bRet = FALSE;
	pInfoMap = m_pMgrData->GetMap ();
	if (pInfoMap == NULL) {
		goto Exit;
	}

	ptBack.x = pInfoChar->m_nMapX;
	ptBack.y = pInfoChar->m_nMapY;

	switch (nDirection) {
	case 4:
		nDirectionTmp = 0;
		bRet = IsMove (pInfoChar, nDirectionTmp);
		if (bRet == FALSE) {
			nDirection = 3;
		} else {
			pInfoChar->GetFrontPos (ptFront, nDirectionTmp, TRUE);
			pInfoChar->m_nMapX = ptFront.x;
			pInfoChar->m_nMapY = ptFront.y;
			nDirectionTmp = 3;
			bRet = IsMove (pInfoChar, nDirectionTmp);
			pInfoChar->m_nMapX = ptBack.x;
			pInfoChar->m_nMapY = ptBack.y;
			if (bRet) {
				return TRUE;
			}
			nDirection = 0;
			return TRUE;
		}
		break;
	case 5:
		nDirectionTmp = 1;
		bRet = IsMove (pInfoChar, nDirectionTmp);
		if (bRet == FALSE) {
			nDirection = 3;
		} else {
			pInfoChar->GetFrontPos (ptFront, nDirectionTmp, TRUE);
			pInfoChar->m_nMapX = ptFront.x;
			pInfoChar->m_nMapY = ptFront.y;
			nDirectionTmp = 3;
			bRet = IsMove (pInfoChar, nDirectionTmp);
			pInfoChar->m_nMapX = ptBack.x;
			pInfoChar->m_nMapY = ptBack.y;
			if (bRet) {
				return TRUE;
			}
			nDirection = 1;
			return TRUE;
		}
		break;
	case 6:
		nDirectionTmp = 1;
		bRet = IsMove (pInfoChar, nDirectionTmp);
		if (bRet == FALSE) {
			nDirection = 2;
		} else {
			pInfoChar->GetFrontPos (ptFront, nDirectionTmp, TRUE);
			pInfoChar->m_nMapX = ptFront.x;
			pInfoChar->m_nMapY = ptFront.y;
			nDirectionTmp = 2;
			bRet = IsMove (pInfoChar, nDirectionTmp);
			pInfoChar->m_nMapX = ptBack.x;
			pInfoChar->m_nMapY = ptBack.y;
			if (bRet) {
				return TRUE;
			}
			nDirection = 1;
			return TRUE;
		}
		break;
	case 7:
		nDirectionTmp = 0;
		bRet = IsMove (pInfoChar, nDirectionTmp);
		if (bRet == FALSE) {
			nDirection = 2;
		} else {
			pInfoChar->GetFrontPos (ptFront, nDirectionTmp, TRUE);
			pInfoChar->m_nMapX = ptFront.x;
			pInfoChar->m_nMapY = ptFront.y;
			nDirectionTmp = 2;
			bRet = IsMove (pInfoChar, nDirectionTmp);
			pInfoChar->m_nMapX = ptBack.x;
			pInfoChar->m_nMapY = ptBack.y;
			if (bRet) {
				return TRUE;
			}
			nDirection = 0;
			return TRUE;
		}
		break;
	}

	/* 脱出可能かチェック */
	bResult = FALSE;
	pInfoChar->GetFrontMapPosRect (rcMap, nDirection);
	for (y = rcMap.top; y <= rcMap.bottom; y ++) {
		for (x = rcMap.left; x <= rcMap.right; x ++) {
			bResult |= !pInfoMap->IsMoveOut (x, y, nDirection);
		}
	}
	bResult = !bResult;
	if (bResult == FALSE) {
		goto Exit;
	}

	/* 進めるかチェック */
	bResult = FALSE;
	pInfoChar->GetFrontMapPosRect (rcMap, nDirection);
	for (y = rcMap.top; y <= rcMap.bottom; y ++) {
		for (x = rcMap.left; x <= rcMap.right; x ++) {
			bResult |= !pInfoMap->IsMove (x, y, nDirection);
		}
	}
	bResult = !bResult;
	if (rcMap.top < 0) {
		bResult = FALSE;
	}
	if (bResult == FALSE) {
		goto Exit;
	}

	bRet = TRUE;
Exit:
	return bRet;
}
BOOL CLibInfoCharSvr::UseSkillBATTLE_MOVEATACK(CInfoCharSvr *pInfoChar, CInfoSkillBase *pInfoSkillBase)
{
	int i, nCount, nDirectionTmp, nDirection;
	BOOL bRet, bResult;
	POINT ptFront;
	PCInfoMapBase pInfoMap;
	PCInfoSkillMOVEATACK pInfoSkill = (PCInfoSkillMOVEATACK)pInfoSkillBase;
	CInfoCharMOVEATACKSvr InfoCharTmp, *pInfoCharTmp;
	CPacketMAP_FORMATMSG PacketMsg;
	ARRAYINT anDirection;

	bRet = FALSE;

	pInfoMap = (PCInfoMapBase)m_pLibInfoMap->GetPtr (pInfoChar->m_dwMapID);
	if (pInfoMap == NULL) {
		goto Exit;
	}

	switch (pInfoSkill->m_dwPutType) {
	case SKILLMOVEATACKPUTTYPE_FRONT:		/* 前方 */
		nDirection = pInfoChar->GetDrawDirection ();
		anDirection.Add (nDirection);
		break;
	case SKILLMOVEATACKPUTTYPE_CROSS:		/* 上下左右 */
		anDirection.Add (0);
		anDirection.Add (1);
		anDirection.Add (2);
		anDirection.Add (3);
		break;
	}

	nCount = anDirection.GetSize ();
	for (i = 0; i < nCount; i ++) {
		nDirectionTmp = anDirection[i];
		/* 進めるかチェック */
		bResult = IsMove (pInfoChar, nDirectionTmp);
		if (bResult == FALSE) {
			continue;
		}

		nDirection = pInfoChar->GetDrawDirection ();
		pInfoChar->GetFrontPos (ptFront, nDirectionTmp, TRUE);
		InfoCharTmp.m_dwParentCharID	= pInfoChar->m_dwCharID;
		InfoCharTmp.m_dwMapID			= pInfoChar->m_dwMapID;
		InfoCharTmp.m_nDirection		= nDirectionTmp;
		InfoCharTmp.m_bChargeAtack		= pInfoChar->m_bChargeAtack;
		InfoCharTmp.m_nMapX				= ptFront.x;
		InfoCharTmp.m_nMapY				= ptFront.y;
		InfoCharTmp.m_dwHP				= 1;
		InfoCharTmp.m_nMoveType			= CHARMOVETYPE_MOVEATACK;
		InfoCharTmp.m_wGrpIDNPC			= (WORD)-1;
		InfoCharTmp.m_wGrpIDCloth		= (WORD)pInfoSkill->m_adwEffectID[nDirectionTmp];

		pInfoCharTmp = (PCInfoCharMOVEATACKSvr)AddNPC (&InfoCharTmp);
		pInfoCharTmp->SetMap (pInfoMap);
		pInfoCharTmp->m_bParentInfo		= FALSE;
		pInfoCharTmp->m_bHitQuit		= pInfoSkill->m_bHitQuit;
		pInfoCharTmp->m_bDistanceDelete	= pInfoSkill->m_bDistanceDelete;
		pInfoCharTmp->m_nAtackTarget	= pInfoSkill->m_dwTartgetType;
		pInfoCharTmp->m_dwMoveWait		= pInfoSkill->m_dwWaitTime;
		pInfoCharTmp->m_dwMoveCount		= pInfoSkill->m_dwDistance;
		pInfoCharTmp->m_dwHitEffectID	= pInfoSkill->m_dwHitEffectID;
		pInfoCharTmp->m_dwValue1		= pInfoSkill->m_dwValue1;
		pInfoCharTmp->m_dwValue2		= pInfoSkill->m_dwValue2;
		pInfoCharTmp->m_dwQuitTime		= timeGetTime () + pInfoSkill->m_dwAliveTime;
	}
	PacketMsg.Make (
			FORMATMSGID_USESKILL,
			pInfoChar->m_dwCharID,
			pInfoSkillBase->m_dwSkillID,
			RGB (255, 255, 255),
			FALSE,
			FORMATMSGTYPE_NOLOG);
	m_pMainFrame->SendToScreenChar (pInfoChar, &PacketMsg);

	bRet = TRUE;
Exit:
	return bRet;
}
Example #4
0
size_t FuzzyClip(
		PPOINT	IPoints,
		PBYTE	ITypes,
		size_t	ILength,
		BOOL	IsClosed,
		RECT	*InnerRect,
		RECT	*OuterRect,
		PPOINT	pOPoints,
		PBYTE	pOTypes,
		size_t	pOMaxLength
	)
{
	IRect		= (GRECT*) InnerRect ;
	ORect		= (GRECT*) OuterRect ;
	OPoints		= pOPoints ;
	OTypes		= pOTypes ;
	OMaxLength	= pOMaxLength ;
	OLength		= 0 ;

	if ( ILength <= 0 )
		return 0 ;

	try {

		Index = 0 ;
		while ( Index<ILength )
		{
			OFirstPoint = TRUE ;
			POINT StartPoint = IPoints[Index++] ;
			LastSector = GetSector( StartPoint ) ;
			LastPoint = StartPoint ;
			while ( Index<ILength && (IsLine(ITypes[Index]) || IsCurve(ITypes[Index])) )
			{
				if ( IsLine(ITypes[Index]) )
				{
					ClipLine( LastPoint,IPoints[Index] ) ;
					LastPoint = IPoints[Index++] ;
				}
				else
				{
					ClipCurve( LastPoint,IPoints[Index],IPoints[Index+1],IPoints[Index+2] ) ;
					LastPoint = IPoints[Index+2] ;
					Index += 3 ;
				}
			}
			if ( IsClosed || (ITypes[Index-1] & PT_CLOSEFIGURE) )
			{
				ClipLine( LastPoint,StartPoint ) ;
				if ( !OFirstPoint )
					*(OTypes-1) |= PT_CLOSEFIGURE ;
			}
			if ( !OFirstPoint && IsMove(*(OTypes-1)) )
			{
				OTypes-- ;
				OPoints-- ;
				OLength-- ;
			}
		}

	} catch ( INT32 ) {
		OLength = (size_t)-1 ;
	}

	return OLength ;
}