Gentoo Websites Logo
Go to: Gentoo Home Documentation Forums Lists Bugs Planet Store Wiki Get Gentoo!
View | Details | Raw Unified | Return to bug 598637
Collapse All | Expand All

(-)a/src/base/math.h (-1 / +1 lines)
Lines 20-26 inline float sign(float f) Link Here
20
	return f<0.0f?-1.0f:1.0f;
20
	return f<0.0f?-1.0f:1.0f;
21
}
21
}
22
22
23
inline int round(float f)
23
inline int round_to_int(float f)
24
{
24
{
25
	if(f > 0)
25
	if(f > 0)
26
		return (int)(f+0.5f);
26
		return (int)(f+0.5f);
(-)a/src/game/collision.h (-2 / +2 lines)
Lines 25-33 class CCollision Link Here
25
25
26
	CCollision();
26
	CCollision();
27
	void Init(class CLayers *pLayers);
27
	void Init(class CLayers *pLayers);
28
	bool CheckPoint(float x, float y) { return IsTileSolid(round(x), round(y)); }
28
	bool CheckPoint(float x, float y) { return IsTileSolid(round_to_int(x), round_to_int(y)); }
29
	bool CheckPoint(vec2 Pos) { return CheckPoint(Pos.x, Pos.y); }
29
	bool CheckPoint(vec2 Pos) { return CheckPoint(Pos.x, Pos.y); }
30
	int GetCollisionAt(float x, float y) { return GetTile(round(x), round(y)); }
30
	int GetCollisionAt(float x, float y) { return GetTile(round_to_int(x), round_to_int(y)); }
31
	int GetWidth() { return m_Width; };
31
	int GetWidth() { return m_Width; };
32
	int GetHeight() { return m_Height; };
32
	int GetHeight() { return m_Height; };
33
	int IntersectLine(vec2 Pos0, vec2 Pos1, vec2 *pOutCollision, vec2 *pOutBeforeCollision);
33
	int IntersectLine(vec2 Pos0, vec2 Pos1, vec2 *pOutCollision, vec2 *pOutBeforeCollision);
(-)a/src/game/editor/layer_tiles.cpp (-1 / +1 lines)
Lines 248-254 void CLayerTiles::BrushFlipY() Link Here
248
248
249
void CLayerTiles::BrushRotate(float Amount)
249
void CLayerTiles::BrushRotate(float Amount)
250
{
250
{
251
	int Rotation = (round(360.0f*Amount/(pi*2))/90)%4;	// 0=0°, 1=90°, 2=180°, 3=270°
251
	int Rotation = (round_to_int(360.0f*Amount/(pi*2))/90)%4;	// 0=0°, 1=90°, 2=180°, 3=270°
252
	if(Rotation < 0)
252
	if(Rotation < 0)
253
		Rotation +=4;
253
		Rotation +=4;
254
254
(-)a/src/game/gamecore.cpp (-8 / +8 lines)
Lines 401-417 void CCharacterCore::Move() Link Here
401
401
402
void CCharacterCore::Write(CNetObj_CharacterCore *pObjCore)
402
void CCharacterCore::Write(CNetObj_CharacterCore *pObjCore)
403
{
403
{
404
	pObjCore->m_X = round(m_Pos.x);
404
	pObjCore->m_X = round_to_int(m_Pos.x);
405
	pObjCore->m_Y = round(m_Pos.y);
405
	pObjCore->m_Y = round_to_int(m_Pos.y);
406
406
407
	pObjCore->m_VelX = round(m_Vel.x*256.0f);
407
	pObjCore->m_VelX = round_to_int(m_Vel.x*256.0f);
408
	pObjCore->m_VelY = round(m_Vel.y*256.0f);
408
	pObjCore->m_VelY = round_to_int(m_Vel.y*256.0f);
409
	pObjCore->m_HookState = m_HookState;
409
	pObjCore->m_HookState = m_HookState;
410
	pObjCore->m_HookTick = m_HookTick;
410
	pObjCore->m_HookTick = m_HookTick;
411
	pObjCore->m_HookX = round(m_HookPos.x);
411
	pObjCore->m_HookX = round_to_int(m_HookPos.x);
412
	pObjCore->m_HookY = round(m_HookPos.y);
412
	pObjCore->m_HookY = round_to_int(m_HookPos.y);
413
	pObjCore->m_HookDx = round(m_HookDir.x*256.0f);
413
	pObjCore->m_HookDx = round_to_int(m_HookDir.x*256.0f);
414
	pObjCore->m_HookDy = round(m_HookDir.y*256.0f);
414
	pObjCore->m_HookDy = round_to_int(m_HookDir.y*256.0f);
415
	pObjCore->m_HookedPlayer = m_HookedPlayer;
415
	pObjCore->m_HookedPlayer = m_HookedPlayer;
416
	pObjCore->m_Jumped = m_Jumped;
416
	pObjCore->m_Jumped = m_Jumped;
417
	pObjCore->m_Direction = m_Direction;
417
	pObjCore->m_Direction = m_Direction;
(-)a/src/game/server/entity.cpp (-2 / +2 lines)
Lines 51-56 int CEntity::NetworkClipped(int SnappingClient, vec2 CheckPos) Link Here
51
51
52
bool CEntity::GameLayerClipped(vec2 CheckPos)
52
bool CEntity::GameLayerClipped(vec2 CheckPos)
53
{
53
{
54
	return round(CheckPos.x)/32 < -200 || round(CheckPos.x)/32 > GameServer()->Collision()->GetWidth()+200 ||
54
	return round_to_int(CheckPos.x)/32 < -200 || round_to_int(CheckPos.x)/32 > GameServer()->Collision()->GetWidth()+200 ||
55
			round(CheckPos.y)/32 < -200 || round(CheckPos.y)/32 > GameServer()->Collision()->GetHeight()+200 ? true : false;
55
			round_to_int(CheckPos.y)/32 < -200 || round_to_int(CheckPos.y)/32 > GameServer()->Collision()->GetHeight()+200 ? true : false;
56
}
56
}

Return to bug 598637