summaryrefslogtreecommitdiffstats
path: root/source
diff options
context:
space:
mode:
authorTiger Wang <ziwei.tiger@hotmail.co.uk>2013-09-04 19:26:00 +0200
committerTiger Wang <ziwei.tiger@hotmail.co.uk>2013-09-04 19:26:00 +0200
commitad89a0d460cc6afdc5a433695861cd0bf3ebeadd (patch)
tree19f20d8a31d6bae5f3e3fcb1abcfe8ddf26d2428 /source
parentPlayers toss a little further (diff)
downloadcuberite-ad89a0d460cc6afdc5a433695861cd0bf3ebeadd.tar
cuberite-ad89a0d460cc6afdc5a433695861cd0bf3ebeadd.tar.gz
cuberite-ad89a0d460cc6afdc5a433695861cd0bf3ebeadd.tar.bz2
cuberite-ad89a0d460cc6afdc5a433695861cd0bf3ebeadd.tar.lz
cuberite-ad89a0d460cc6afdc5a433695861cd0bf3ebeadd.tar.xz
cuberite-ad89a0d460cc6afdc5a433695861cd0bf3ebeadd.tar.zst
cuberite-ad89a0d460cc6afdc5a433695861cd0bf3ebeadd.zip
Diffstat (limited to '')
-rw-r--r--source/Entities/Entity.cpp2
-rw-r--r--source/World.cpp40
2 files changed, 12 insertions, 30 deletions
diff --git a/source/Entities/Entity.cpp b/source/Entities/Entity.cpp
index 7e118c74e..8388bf092 100644
--- a/source/Entities/Entity.cpp
+++ b/source/Entities/Entity.cpp
@@ -517,7 +517,7 @@ void cEntity::HandlePhysics(float a_Dt, cChunk & a_Chunk)
}
else
{
- //Push out entity.
+ // Push out entity.
if (NextChunk->GetBlock( RelBlockX + 1, BlockY, RelBlockZ ) == E_BLOCK_AIR) { NextPos.x += 0.2; }
else if (NextChunk->GetBlock( RelBlockX - 1, BlockY, RelBlockZ ) == E_BLOCK_AIR) { NextPos.x += -0.2; }
diff --git a/source/World.cpp b/source/World.cpp
index ab783d7a7..718c86262 100644
--- a/source/World.cpp
+++ b/source/World.cpp
@@ -1514,22 +1514,13 @@ void cWorld::SpawnItemPickups(const cItems & a_Pickups, double a_BlockX, double
for (cItems::const_iterator itr = a_Pickups.begin(); itr != a_Pickups.end(); ++itr)
{
float SpeedX = (float)(a_FlyAwaySpeed * (r1.randInt(1000) - 500));
- float SpeedY = (float)(a_FlyAwaySpeed * r1.randInt(1000));
+ float SpeedY = 1;
float SpeedZ = (float)(a_FlyAwaySpeed * (r1.randInt(1000) - 500));
-
- // Add random offset to the spawn position:
- int MicroX = (int)(a_BlockX * 32) + (r1.randInt(16) + r1.randInt(16) - 16);
- int MicroY = (int)(a_BlockY * 32) + (r1.randInt(16) + r1.randInt(16) - 16);
- int MicroZ = (int)(a_BlockZ * 32) + (r1.randInt(16) + r1.randInt(16) - 16);
-
- // TODO 2013_05_12 _X: Because spawning pickups with nonzero speed causes them to bug (FS #338),
- // I decided to temporarily reset the speed to zero to fix it, until we have proper pickup physics
- SpeedX = SpeedY = SpeedZ = 0;
-
- // TODO 2013_05_12 _X: It seems that pickups bug out even with zero speed, trying mid-block position:
- MicroX = (int)(floor(a_BlockX) * 32) + 16;
- MicroY = (int)(floor(a_BlockY) * 32) + 16;
- MicroZ = (int)(floor(a_BlockZ) * 32) + 16;
+
+ // (FS #338 Fixed with mid block position spawn, previous TODOs/comments removed)
+ int MicroX = (int)(floor(a_BlockX) * 32) + 16;
+ int MicroY = (int)(floor(a_BlockY) * 32) + 16;
+ int MicroZ = (int)(floor(a_BlockZ) * 32) + 16;
cPickup * Pickup = new cPickup(
MicroX, MicroY, MicroZ,
@@ -1545,23 +1536,14 @@ void cWorld::SpawnItemPickups(const cItems & a_Pickups, double a_BlockX, double
void cWorld::SpawnItemPickups(const cItems & a_Pickups, double a_BlockX, double a_BlockY, double a_BlockZ, double a_SpeedX, double a_SpeedY, double a_SpeedZ)
{
- // TODO 2013_05_12 _X: Because spawning pickups with nonzero speed causes them to bug (FS #338),
- // I decided to temporarily reset the speed to zero to fix it, until we have proper pickup physics
- a_SpeedX = a_SpeedY = a_SpeedZ = 0;
-
MTRand r1;
for (cItems::const_iterator itr = a_Pickups.begin(); itr != a_Pickups.end(); ++itr)
{
- // Add random offset to the spawn position:
- int MicroX = (int)(a_BlockX * 32) + (r1.randInt(16) + r1.randInt(16) - 16);
- int MicroY = (int)(a_BlockY * 32) + (r1.randInt(16) + r1.randInt(16) - 16);
- int MicroZ = (int)(a_BlockZ * 32) + (r1.randInt(16) + r1.randInt(16) - 16);
-
- // TODO 2013_05_12 _X: It seems that pickups bug out even with zero speed, trying mid-block position:
- MicroX = (int)(floor(a_BlockX) * 32) + 16;
- MicroY = (int)(floor(a_BlockY) * 32) + 16;
- MicroZ = (int)(floor(a_BlockZ) * 32) + 16;
-
+ // (FS #338 Fixed with mid block position spawn, previous TODOs/comments removed)
+ int MicroX = (int)(floor(a_BlockX) * 32) + 16;
+ int MicroY = (int)(floor(a_BlockY) * 32) + 16;
+ int MicroZ = (int)(floor(a_BlockZ) * 32) + 16;
+
cPickup * Pickup = new cPickup(
MicroX, MicroY, MicroZ,
*itr, (float)a_SpeedX, (float)a_SpeedY, (float)a_SpeedZ