当前位置: 首页>>代码示例>>C++>>正文


C++ GetZ函数代码示例

本文整理汇总了C++中GetZ函数的典型用法代码示例。如果您正苦于以下问题:C++ GetZ函数的具体用法?C++ GetZ怎么用?C++ GetZ使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。


在下文中一共展示了GetZ函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。

示例1: ASSERT

void CUser::MoveProcess(Packet & pkt)
{
	ASSERT(GetMap() != nullptr);
	if (m_bWarp || isDead()) 
		return;

	uint16 will_x, will_z, will_y;
	int16 speed=0;
	float real_x, real_z, real_y;
	uint8 echo;

	pkt >> will_x >> will_z >> will_y >> speed >> echo;
	real_x = will_x/10.0f; real_z = will_z/10.0f; real_y = will_y/10.0f;

	if (!isGM())
	{
		// TO-DO: Handle proper speed checks against server-side amounts.
		// We should also avoid relying on what the client has sent us.
		if (speed > 200)	// What is the signifance of this number? Considering 90 is light feet...
			// We shouldn't be using magic numbers at all here.
		{
			Disconnect();
			return;
		}
	}

	if (!GetMap()->IsValidPosition(real_x, real_z, real_y)) 
		return;

	if (m_oldx != GetX()
		|| m_oldz != GetZ())
	{
		m_oldx = GetX();
		m_oldy = GetY();
		m_oldz = GetZ();
	}

	// TO-DO: Ensure this is checked properly to prevent speedhacking
	SetPosition(real_x, real_y, real_z);

	if (RegisterRegion())
	{
		g_pMain->RegionNpcInfoForMe(this);
		g_pMain->RegionUserInOutForMe(this);
		g_pMain->MerchantUserInOutForMe(this);
	}

	if (m_bInvisibilityType == INVIS_DISPEL_ON_MOVE)
		CMagicProcess::RemoveStealth(this, INVIS_DISPEL_ON_MOVE);

	Packet result(WIZ_MOVE);
	result << GetSocketID() << will_x << will_z << will_y << speed << echo;
	SendToRegion(&result);

	GetMap()->CheckEvent(real_x, real_z, this);

	result.Initialize(AG_USER_MOVE);
	result << GetSocketID() << m_curx << m_curz << m_cury << speed;
	Send_AIServer(&result);
}
开发者ID:asis21,项目名称:koserver,代码行数:60,代码来源:CharacterMovementHandler.cpp

示例2: GetZ

//o--------------------------------------------------------------------------o
//|	Function		-	Cleanup( void )
//|	Date			-	26th September, 2001
//|	Programmer		-	Abaddon
//|	Modified		-
//o--------------------------------------------------------------------------o
//|	Purpose			-	Makes sure that any items and chars inside the multi
//|						are removed
//o--------------------------------------------------------------------------o
void CMultiObj::Cleanup( void )
{
	for( CItem *iRemove = itemInMulti.First(); !itemInMulti.Finished(); iRemove = itemInMulti.Next() )
	{
		if( ValidateObject( iRemove ) )
		{
			ItemTypes iType = iRemove->GetType();
			if( iType == IT_DOOR || iType == IT_LOCKEDDOOR || iType == IT_HOUSESIGN )
				iRemove->Delete();
			else
			{
				if( iRemove->IsLockedDown() )
					iRemove->SetMovable( 1 );
				iRemove->SetMulti( INVALIDSERIAL );
				iRemove->SetZ( GetZ() );
			}
		}
	}
	for( CChar *cRemove = charInMulti.First(); !charInMulti.Finished(); cRemove = charInMulti.Next() )
	{
		if( ValidateObject( cRemove ) )
		{
			cRemove->SetMulti( INVALIDSERIAL );
			cRemove->SetZ( GetZ() );
		}
	}
	CItem::Cleanup();
}
开发者ID:bholtsclaw,项目名称:uox3,代码行数:37,代码来源:cMultiObj.cpp

示例3:

NaGeVector3D NaGeVector3D::operator * (const NaGeMatrix33 &M)
{
	NaGeVector3D V;
	V.SetX(M(0,0)*GetX()+M(0,1)*GetY()+M(0,2)*GetZ());
	V.SetY(M(1,0)*GetX()+M(1,1)*GetY()+M(1,2)*GetZ());
	V.SetZ(M(2,0)*GetX()+M(2,1)*GetY()+M(2,2)*GetZ());
	return V;
}
开发者ID:cybaj,项目名称:NAK,代码行数:8,代码来源:NaGeVector3D.cpp

示例4: GetZ

  bool BoundingBox::CollidesWith (const ICollidable& other) const
  {
    if (GetZ () >= other.GetZ () + other.GetH () ||
        GetZ () + GetH () <= other.GetZ ())
      return false;

    return spatial3Info_.GetRectangle ().intersects (other.GetRectangle ());
  }
开发者ID:Noxalus,项目名称:YAPOG,代码行数:8,代码来源:BoundingBox.cpp

示例5: CurrentPosition

void Mob::CalculateNewFearpoint()
{
	if(RuleB(Pathing, Fear) && zone->pathing)
	{
		int Node = zone->pathing->GetRandomPathNode();
	
		VERTEX Loc = zone->pathing->GetPathNodeCoordinates(Node);

		++Loc.z;

		VERTEX CurrentPosition(GetX(), GetY(), GetZ());

		list<int> Route = zone->pathing->FindRoute(CurrentPosition, Loc);

		if(Route.size() > 0)
		{
			fear_walkto_x = Loc.x;
			fear_walkto_y = Loc.y;
			fear_walkto_z = Loc.z;
			curfp = true;

			mlog(PATHING__DEBUG, "Feared to node %i (%8.3f, %8.3f, %8.3f)", Node, Loc.x, Loc.y, Loc.z);
			return;
		}

		mlog(PATHING__DEBUG, "No path found to selected node. Falling through to old fear point selection.");
	}

	int loop = 0;
	float ranx, rany, ranz;
	curfp = false;
	while (loop < 100) //Max 100 tries
	{
		int ran = 250 - (loop*2);
		loop++;
		ranx = GetX()+MakeRandomInt(0, ran-1)-MakeRandomInt(0, ran-1);
		rany = GetY()+MakeRandomInt(0, ran-1)-MakeRandomInt(0, ran-1);
		ranz = FindGroundZ(ranx,rany);
		if (ranz == -999999)
			continue;
		float fdist = ranz - GetZ();
		if (fdist >= -12 && fdist <= 12 && CheckCoordLosNoZLeaps(GetX(),GetY(),GetZ(),ranx,rany,ranz))
		{
			curfp = true;
			break;
		}
	}
	if (curfp)
	{
		fear_walkto_x = ranx;
		fear_walkto_y = rany;
		fear_walkto_z = ranz;
	}
	else //Break fear
	{
		BuffFadeByEffect(SE_Fear);
	}
}
开发者ID:Vaion,项目名称:Server,代码行数:58,代码来源:fearpath.cpp

示例6: PRINTF

///**
// *	MyWindow::OnMouseWheel()
// *	マウスホイールを動かした
// */
//bool MyWindow::OnMouseWheel(MouseMessage* pMsg)
//{
//	float z = 0.0f;
//	if (pMsg->GetZ() > 0) z = 0.1f;
//	if (pMsg->GetZ() < 0) z = -0.1f;
//
//	MyApp::GetInstance().Scale(z);
//
//	PRINTF("WHEEL: z=%d\n", pMsg->GetZ());
//	return true;
//}
bool MyWindow::OnMouseWheel::Handle()
{
	float z = 0.0f;
	if (GetZ() > 0) z = 0.1f;
	if (GetZ() < 0) z = -0.1f;

	MyApp::GetInstance().Scale(z);

	PRINTF("WHEEL: z=%d\n", GetZ());
	return true;
}
开发者ID:erio-nk,项目名称:MyCxxProgram2011,代码行数:26,代码来源:MyApp.cpp

示例7: ASSERT

void CUser::MoveProcess(Packet & pkt)
{
	ASSERT(GetMap() != nullptr);
	if (m_bWarp || isDead()) 
		return;

	uint16 will_x, will_z, will_y;
	int16 speed=0;
	float real_x, real_z, real_y;
	uint8 echo;

	pkt >> will_x >> will_z >> will_y >> speed >> echo;
	real_x = will_x/10.0f; real_z = will_z/10.0f; real_y = will_y/10.0f;

	m_sSpeed = speed;
	SpeedHackUser();

	if (!GetMap()->IsValidPosition(real_x, real_z, real_y)) 
		return;

	if (m_oldx != GetX()
		|| m_oldz != GetZ())
	{
		m_oldx = GetX();
		m_oldy = GetY();
		m_oldz = GetZ();
	}

	// TODO: Ensure this is checked properly to prevent speedhacking
	SetPosition(real_x, real_y, real_z);

	if (RegisterRegion())
	{
		g_pMain->RegionNpcInfoForMe(this);
		g_pMain->RegionUserInOutForMe(this);
		g_pMain->MerchantUserInOutForMe(this);
	}

	if (m_bInvisibilityType == INVIS_DISPEL_ON_MOVE)
		CMagicProcess::RemoveStealth(this, INVIS_DISPEL_ON_MOVE);

	Packet result(WIZ_MOVE);
	result << GetSocketID() << will_x << will_z << will_y << speed << echo;
	SendToRegion(&result);

	GetMap()->CheckEvent(real_x, real_z, this);

	result.Initialize(AG_USER_MOVE);
	result << GetSocketID() << m_curx << m_curz << m_cury << speed;
	Send_AIServer(&result);
}
开发者ID:BARBAROSS,项目名称:X-ShieldProject,代码行数:51,代码来源:CharacterMovementHandler.cpp

示例8: CurrentPosition

void Mob::CalculateNewFearpoint()
{
	if(RuleB(Pathing, Fear) && zone->pathing)
	{
		int Node = zone->pathing->GetRandomPathNode();

		glm::vec3 Loc = zone->pathing->GetPathNodeCoordinates(Node);

		++Loc.z;

		glm::vec3 CurrentPosition(GetX(), GetY(), GetZ());

		std::deque<int> Route = zone->pathing->FindRoute(CurrentPosition, Loc);

		if(Route.size() > 0)
		{
            m_FearWalkTarget = glm::vec3(Loc.x, Loc.y, Loc.z);
			curfp = true;

			Log.Out(Logs::Detail, Logs::None, "Feared to node %i (%8.3f, %8.3f, %8.3f)", Node, Loc.x, Loc.y, Loc.z);
			return;
		}

		Log.Out(Logs::Detail, Logs::None, "No path found to selected node. Falling through to old fear point selection.");
	}

	int loop = 0;
	float ranx, rany, ranz;
	curfp = false;
	while (loop < 100) //Max 100 tries
	{
		int ran = 250 - (loop*2);
		loop++;
		ranx = GetX()+zone->random.Int(0, ran-1)-zone->random.Int(0, ran-1);
		rany = GetY()+zone->random.Int(0, ran-1)-zone->random.Int(0, ran-1);
		ranz = FindGroundZ(ranx,rany);
		if (ranz == -999999)
			continue;
		float fdist = ranz - GetZ();
		if (fdist >= -12 && fdist <= 12 && CheckCoordLosNoZLeaps(GetX(),GetY(),GetZ(),ranx,rany,ranz))
		{
			curfp = true;
			break;
		}
	}
	if (curfp)
        m_FearWalkTarget = glm::vec3(ranx, rany, ranz);
	else //Break fear
		BuffFadeByEffect(SE_Fear);
}
开发者ID:RicardoCampos,项目名称:Server,代码行数:50,代码来源:fearpath.cpp

示例9: assert

bool Triple::EpsilonEquals(Triple t, double d)
{
  assert(d >= 0);
  if (GetX() - t.GetX() < d && GetX() - t.GetX() > -d)
    {
      if (GetY() - t.GetY() < d && GetY() - t.GetY() > -d)
	{
	  if (GetZ() - t.GetZ() < d && GetZ() - t.GetZ() > -d)
	    {
	      return true;
	    }
	}
    }
  return false;
}
开发者ID:costrouc,项目名称:undergrad-codings,代码行数:15,代码来源:Triple.cpp

示例10: SetX

void Triple::Absolute()
{
  if (GetX() < 0)
    {
      SetX(-GetX());
    }
  if (GetY() < 0)
    {
      SetY(-GetY());
    }
  if (GetZ() < 0)
    {
      SetZ(-GetZ());
    }
}
开发者ID:costrouc,项目名称:undergrad-codings,代码行数:15,代码来源:Triple.cpp

示例11: ASSERT

//Calculates the position of a point on the line between this matrix and the matrix
//"To" given that position's Z value.  Returns the result in ret;
void CPosMatrix::CalculateIntermediatePosFromZ(float fTargetDepth,CPosMatrix & To,CPosMatrix &ret)
{
	ASSERT(GetZ()>=fTargetDepth && To.GetZ()<=fTargetDepth);	//should be between and from higher then to
	float fDeltaZ=fTargetDepth-GetZ();
	if (fDeltaZ==0.0)	//No Z position change
	{
		ret=*this;
		return;
	}
	float fTotalDeltaZ=GetZ()-To.GetZ();
	float fTotalDeltaX=GetX()-To.GetX();
	float fTotalDeltaY=GetY()-To.GetY();
	float fPercent=fDeltaZ/fTotalDeltaZ;
	ret.Set(GetX()+fTotalDeltaX*fPercent,GetY()+fTotalDeltaY*fPercent,fTargetDepth);
}
开发者ID:felixcollins,项目名称:onstation,代码行数:17,代码来源:mathstuff.CPP

示例12: Draw

void TilemapSubLayer::Draw() {
	if (!tilemap->GetChipset()) {
		return;
	}

	tilemap->Draw(GetZ());
}
开发者ID:FaithFeather,项目名称:Player,代码行数:7,代码来源:tilemap_layer.cpp

示例13: GetX

void ADXL345_SPI::UpdateTable() {
	if (m_table != NULL) {
		m_table->PutNumber("X", GetX());
		m_table->PutNumber("Y", GetY());
		m_table->PutNumber("Z", GetZ());
	}
}
开发者ID:FRCTeam1967,项目名称:FRCTeam1967,代码行数:7,代码来源:ADXL345_SPI.cpp

示例14: TransformIsoCoords

void IsometricSprite::Update(double elapsed, const Map* map) {
	// Llamamos al metodo padre
	Sprite::Update(elapsed, map);

	// Convertimos las coordenadas
	TransformIsoCoords(GetX(), GetY(), GetZ(), &screenX, &screenY);
}
开发者ID:kanc,项目名称:UTAD,代码行数:7,代码来源:isometricsprite.cpp

示例15: return

bool Mob::CheckLosFN(float posX, float posY, float posZ, float mobSize) {
	if(zone->zonemap == nullptr) {
		//not sure what the best return is on error
		//should make this a database variable, but im lazy today
#ifdef LOS_DEFAULT_CAN_SEE
		return(true);
#else
		return(false);
#endif
	}

	glm::vec3 myloc;
	glm::vec3 oloc;

#define LOS_DEFAULT_HEIGHT 6.0f

	myloc.x = GetX();
	myloc.y = GetY();
	myloc.z = GetZ() + (GetSize()==0.0?LOS_DEFAULT_HEIGHT:GetSize())/2 * HEAD_POSITION;

	oloc.x = posX;
	oloc.y = posY;
	oloc.z = posZ + (mobSize==0.0?LOS_DEFAULT_HEIGHT:mobSize)/2 * SEE_POSITION;

#if LOSDEBUG>=5
	Log.Out(Logs::General, Logs::None, "LOS from (%.2f, %.2f, %.2f) to (%.2f, %.2f, %.2f) sizes: (%.2f, %.2f)", myloc.x, myloc.y, myloc.z, oloc.x, oloc.y, oloc.z, GetSize(), mobSize);
#endif
	return zone->zonemap->CheckLoS(myloc, oloc);
}
开发者ID:AthrogatePEQ,项目名称:Server,代码行数:29,代码来源:aggro.cpp


注:本文中的GetZ函数示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。