예제 #1
0
	/*!
	\brief 基本碰撞算法
	\param group 参与碰撞检测的BOX组
	\param fData 帧数据指针
	*/
	void 
		SimpleColl(LIST<BOX*> &group, const FRAMEDATA *fData)
	{
		BOX* thisBox = NULL;
		BOX* otherBox = NULL;
		for(LIST<BOX*>::NOTE* thisNote = group.GetFirst();
			thisNote; thisNote = thisNote->GetNext())
		{
			SBC_ASSERT(thisNote);
			SBC_ASSERT(thisNote->Get());
			thisBox = thisNote->Get();
			if(thisBox->IsStatic())
				continue;
			/*
			if(thisBox->IsRemove())
				continue;
			*/
			for(LIST<BOX*>::NOTE* otherNote = group.GetFirst();
				otherNote; otherNote = otherNote->GetNext())
			{
				SBC_ASSERT(otherNote);
				SBC_ASSERT(otherNote->Get());
				otherBox = otherNote->Get();
				if(thisBox == otherBox) 
					continue;
				/*
				if(otherBox->IsRemove())
					continue;
				*/
				if(otherBox->Collision(*thisBox))
				{
					if(thisBox->IsPass() || !thisBox->HandleFilter(fData, otherBox))
					{
						continue;
					}
					thisBox->HandleCollision(fData, otherBox);
				}
			}
		}
	}
예제 #2
0
	/*!
	\brief 依据当前BOX对象组来创建一个指定轴的边界组

	\param axis 当前坐标轴
	\param group BOX对象组
	\param boundaryList 存储边界结构的链表
	*/
	void _FindOpenCloseBoundaryList(AXIS axis, LIST<BOX*> &group,
		LIST<OPENCLOSEBOUNDARY> &boundaryList)
	{
		OPENCLOSEBOUNDARY thisBoundary;
		BOX* thisBox = NULL;
		for(LIST<BOX*>::NOTE *thisNote = group.GetFirst();
			thisNote; thisNote = thisNote->GetNext())
		{
			thisBoundary.pBox = thisBox = thisNote->Get();

			thisBoundary.type = TYPE_OPEN;
			thisBoundary.value = (axis == AXIS_X)?
				(thisBox->GetAnchor().x - thisBox->GetWidth() / 2.0f):
			(thisBox->GetAnchor().y - thisBox->GetHeight() / 2.0f);
			boundaryList.Create(thisBoundary);

			thisBoundary.type = TYPE_CLOSE;
			thisBoundary.value = (axis == AXIS_X)?
				(thisBox->GetAnchor().x + thisBox->GetWidth() / 2.0f):
			(thisBox->GetAnchor().y + thisBox->GetHeight() / 2.0f);
			boundaryList.Create(thisBoundary);
		}
	}
예제 #3
0
파일: player.cpp 프로젝트: dougfrazer/asp
//******************************************************************************
PLAYER* Player_GetFirst()
{
    return PlayerList.GetFirst();
}