本文整理汇总了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);
}
示例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();
}
示例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;
}
示例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 ());
}
示例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);
}
}
示例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;
}
示例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);
}
示例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);
}
示例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;
}
示例10: SetX
void Triple::Absolute()
{
if (GetX() < 0)
{
SetX(-GetX());
}
if (GetY() < 0)
{
SetY(-GetY());
}
if (GetZ() < 0)
{
SetZ(-GetZ());
}
}
示例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);
}
示例12: Draw
void TilemapSubLayer::Draw() {
if (!tilemap->GetChipset()) {
return;
}
tilemap->Draw(GetZ());
}
示例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());
}
}
示例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);
}
示例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);
}