1
0
Fork 0

Bundled fixes [SEE DESC]

* Fixed compiler warning in Monster.cpp
* Future proofed particle effects
* Improved pickups, made less jittery
This commit is contained in:
Tiger Wang 2013-11-10 22:20:25 +00:00
parent 71abbb2f56
commit f713780db3
9 changed files with 24 additions and 19 deletions

View File

@ -96,7 +96,7 @@ void cDropSpenserEntity::DropSpense(cChunk & a_Chunk)
case E_META_DROPSPENSER_FACING_ZM: SmokeDir = 1; break;
case E_META_DROPSPENSER_FACING_ZP: SmokeDir = 7; break;
}
m_World->BroadcastSoundParticleEffect(2000, m_PosX * 8, m_PosY * 8, m_PosZ * 8, SmokeDir);
m_World->BroadcastSoundParticleEffect(2000, m_PosX, m_PosY, m_PosZ, SmokeDir);
m_World->BroadcastSoundEffect("random.click", m_PosX * 8, m_PosY * 8, m_PosZ * 8, 1.0f, 1.0f);
// Update the UI window, if open:

View File

@ -57,7 +57,7 @@ void cJukeboxEntity::UsedBy(cPlayer * a_Player)
void cJukeboxEntity::PlayRecord( void )
{
m_World->BroadcastSoundParticleEffect(1005, m_PosX * 8, m_PosY * 8, m_PosZ * 8, m_Record);
m_World->BroadcastSoundParticleEffect(1005, m_PosX, m_PosY, m_PosZ, m_Record);
}
@ -68,8 +68,8 @@ void cJukeboxEntity::EjectRecord( void )
{
cItems Drops;
Drops.push_back(cItem(m_Record, 1, 0));
m_World->SpawnItemPickups(Drops, m_PosX + 0.5, m_PosY + 1, m_PosZ + 0.5, 5);
m_World->BroadcastSoundParticleEffect(1005, m_PosX * 8, m_PosY * 8, m_PosZ * 8, 0);
m_World->SpawnItemPickups(Drops, m_PosX + 0.5, m_PosY + 1, m_PosZ + 0.5, 8);
m_World->BroadcastSoundParticleEffect(1005, m_PosX, m_PosY, m_PosZ, 0);
}

View File

@ -613,7 +613,7 @@ void cChunkMap::BroadcastSoundParticleEffect(int a_EffectID, int a_SrcX, int a_S
cCSLock Lock(m_CSLayers);
int ChunkX, ChunkZ;
cChunkDef::BlockToChunk(a_SrcX / 8, a_SrcZ / 8, ChunkX, ChunkZ);
cChunkDef::BlockToChunk(a_SrcX, a_SrcZ, ChunkX, ChunkZ);
cChunkPtr Chunk = GetChunkNoGen(ChunkX, 0, ChunkZ);
if (Chunk == NULL)
{

View File

@ -729,7 +729,7 @@ void cClientHandle::HandleBlockDigFinished(int a_BlockX, int a_BlockY, int a_Blo
if (a_OldBlock == E_BLOCK_AIR)
{
LOGD("Digged air? wtf?");
LOGD("Dug air - what the function?");
return;
}
@ -738,7 +738,7 @@ void cClientHandle::HandleBlockDigFinished(int a_BlockX, int a_BlockY, int a_Blo
// The ItemHandler is also responsible for spawning the pickups
BlockHandler(a_OldBlock)->OnDestroyedByPlayer(World, m_Player, a_BlockX, a_BlockY, a_BlockZ);
World->BroadcastSoundParticleEffect(2001, a_BlockX * 8, a_BlockY * 8, a_BlockZ * 8, a_OldBlock, this);
World->BroadcastSoundParticleEffect(2001, a_BlockX, a_BlockY, a_BlockZ, a_OldBlock, this);
World->DigBlock(a_BlockX, a_BlockY, a_BlockZ);
cRoot::Get()->GetPluginManager()->CallHookPlayerBrokenBlock(*m_Player, a_BlockX, a_BlockY, a_BlockZ, a_BlockFace, a_OldBlock, a_OldMeta);

View File

@ -31,8 +31,9 @@ cPickup::cPickup(double a_PosX, double a_PosY, double a_PosZ, const cItem & a_It
, m_bCollected( false )
, m_bIsPlayerCreated( IsPlayerCreated )
{
m_MaxHealth = 5;
m_Health = 5;
SetGravity(-10.5f);
SetMaxHealth(5);
SetHealth(5);
SetSpeed(a_SpeedX, a_SpeedY, a_SpeedZ);
}

View File

@ -55,10 +55,10 @@ void cHorse::Tick(float a_Dt, cChunk & a_Chunk)
{
if (m_World->GetTickRandomNumber(50) == 25)
{
m_World->BroadcastSoundParticleEffect(2000, (int)(floor(GetPosX()) * 8), (int)(floor(GetPosY()) * 8), (int)(floor(GetPosZ()) * 8), 0);
m_World->BroadcastSoundParticleEffect(2000, (int)(floor(GetPosX()) * 8), (int)(floor(GetPosY()) * 8), (int)(floor(GetPosZ()) * 8), 2);
m_World->BroadcastSoundParticleEffect(2000, (int)(floor(GetPosX()) * 8), (int)(floor(GetPosY()) * 8), (int)(floor(GetPosZ()) * 8), 6);
m_World->BroadcastSoundParticleEffect(2000, (int)(floor(GetPosX()) * 8), (int)(floor(GetPosY()) * 8), (int)(floor(GetPosZ()) * 8), 8);
m_World->BroadcastSoundParticleEffect(2000, (int)GetPosX(), (int)GetPosY(), (int)GetPosZ(), 0);
m_World->BroadcastSoundParticleEffect(2000, (int)GetPosX(), (int)GetPosY(), (int)GetPosZ(), 2);
m_World->BroadcastSoundParticleEffect(2000, (int)GetPosX(), (int)GetPosY(), (int)GetPosZ(), 6);
m_World->BroadcastSoundParticleEffect(2000, (int)GetPosX(), (int)GetPosY(), (int)GetPosZ(), 8);
m_Attachee->Detach();
m_bIsRearing = true;

View File

@ -633,8 +633,13 @@ cMonster * cMonster::NewMonsterFromType(cMonster::eType a_MobType)
case mtMagmaCube:
case mtSlime: toReturn = new cSlime (RandomDerps.NextInt(2) + 1); break; // Size parameter
case mtSheep: toReturn = new cSheep (RandomDerps.NextInt(15)); break; // Colour parameter
case mtSkeleton: toReturn = new cSkeleton ((bool)(RandomDerps.NextInt(1))); break; // TODO: Actual detection of spawning in Nether
case mtZombie: toReturn = new cZombie (false); break; // TODO: Infected zombie parameter
case mtSkeleton:
{
// TODO: Actual detection of spawning in Nether
toReturn = new cSkeleton(RandomDerps.NextInt(1) == 0 ? false : true);
break;
}
case mtVillager:
{
int VilType = RandomDerps.NextInt(6);

View File

@ -491,7 +491,7 @@ void cProtocol172::SendPlayerAbilities(void)
void cProtocol172::SendPlayerAnimation(const cPlayer & a_Player, char a_Animation)
{
cPacketizer Pkt(*this, 0x0b); // Animation packet
Pkt.WriteInt(a_Player.GetUniqueID());
Pkt.WriteVarInt(a_Player.GetUniqueID());
Pkt.WriteChar(a_Animation);
}
@ -616,8 +616,8 @@ void cProtocol172::SendSoundParticleEffect(int a_EffectID, int a_SrcX, int a_Src
{
cPacketizer Pkt(*this, 0x28); // Effect packet
Pkt.WriteInt(a_EffectID);
Pkt.WriteByte(a_SrcX);
Pkt.WriteInt(a_SrcY);
Pkt.WriteInt(a_SrcX);
Pkt.WriteByte(a_SrcY);
Pkt.WriteInt(a_SrcZ);
Pkt.WriteInt(a_Data);
Pkt.WriteBool(false);

View File

@ -1512,7 +1512,7 @@ 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 = 1;
float SpeedY = (float)(a_FlyAwaySpeed * (r1.randInt(1000) - 500));
float SpeedZ = (float)(a_FlyAwaySpeed * (r1.randInt(1000) - 500));
cPickup * Pickup = new cPickup(
@ -2571,7 +2571,6 @@ int cWorld::SpawnMob(double a_PosX, double a_PosY, double a_PosZ, cMonster::eTyp
}
// Because it's logical that ALL mob spawns need spawn effects, not just spawners
// TODO: Not working - wiki.vg outdated?
BroadcastSoundParticleEffect(2004, (int)a_PosX, (int)a_PosY, (int)a_PosZ, 0);
return SpawnMobFinalize(Monster);