- Inscrit
- 28 Mai 2016
- Messages
- 34
- Reactions
- 1
hey ! voila j'ai un problème je ne comprend pas le calcule que fait ces codes la pour trouver la position X et Y d'une map par rapport au Mapid si qq pourrait éclairer ma lanterne
Code:
public int X
{
get
{
m_x = (Id & 0x3FE00) >> 9; // 9 higher bits
if ((m_x & 0x100) == 0x100) // 9th bit is the sign. 1 means it's minus
{
m_x = -(X & 0xFF); // just take the 8 first bits and take the opposite number
}
return m_x.Value;
}
}
public int Y
{
get
{
m_y = Id & 0x01FF; // 9 lower bits
if ((m_y & 0x100) == 0x100) // 9th bit is the sign. 1 means it's minus
{
m_y = -(X & 0xFF); // just take the 8 first bits and take the opposite number
}
return m_y.Value;
}
}