Applied :)
Thanks!
Florian Köberle a écrit :
> ---
> src/particles/body_member.cpp | 9 ++++++---
> src/particles/explosion_smoke.cpp | 5 +++--
> src/particles/fire.cpp | 10 ++++++++--
> src/particles/ill_bubble.cpp | 6 ++++--
> src/particles/magic_star.cpp | 5 +++--
> src/particles/particle.cpp | 21 +++++++++++++--------
> src/particles/teleport_member.cpp | 8 +++++---
> 7 files changed, 42 insertions(+), 22 deletions(-)
>
> diff --git a/src/particles/body_member.cpp b/src/particles/body_member.cpp
> index 3320d14..c0df406 100644
> --- a/src/particles/body_member.cpp
> +++ b/src/particles/body_member.cpp
> @@ -22,7 +22,7 @@
> #include "particles/body_member.h"
> #include "particles/particle.h"
> #include "graphic/sprite.h"
> -#include <WORMUX_random.h>
> +#include "network/randomsync.h"
>
> BodyMemberParticle::BodyMemberParticle(const Sprite& spr, const Point2i&
> position) :
> Particle("body_member_particle")
> @@ -36,8 +36,11 @@ BodyMemberParticle::BodyMemberParticle(const Sprite& spr,
> const Point2i& positio
>
> SetSize(image->GetSize());
> SetOnTop(true);
> - SetSpeed( (double)RandomLocal().GetLong(10, 15),
> - - (double)RandomLocal().GetLong(0, 3000)/1000.0);
> + MSG_DEBUG("random.get", "BodyMemberParticle::BodyMemberParticle(...) speed
> vector length");
> + double speed_vector_length = (double)RandomSync().GetLong(10, 15);
> + MSG_DEBUG("random.get", "BodyMemberParticle::BodyMemberParticle(...) speed
> vector angle");
> + double speed_vector_angle = - (double)RandomSync().GetLong(0, 3000)/1000.0;
> + SetSpeed(speed_vector_length, speed_vector_angle);
> }
>
> void BodyMemberParticle::Refresh()
> diff --git a/src/particles/explosion_smoke.cpp
> b/src/particles/explosion_smoke.cpp
> index 271e0e8..3312c58 100644
> --- a/src/particles/explosion_smoke.cpp
> +++ b/src/particles/explosion_smoke.cpp
> @@ -24,7 +24,7 @@
> #include "particles/particle.h"
> #include "game/time.h"
> #include "graphic/sprite.h"
> -#include <WORMUX_random.h>
> +#include "network/randomsync.h"
>
> ExplosionSmoke::ExplosionSmoke(const uint size_init) :
> Particle("explosion_smoke_particle")
> @@ -40,7 +40,8 @@ ExplosionSmoke::ExplosionSmoke(const uint size_init) :
> image->SetCurrentFrame(0);
> image->Start();
>
> - SetGravityFactor(RandomLocal().GetDouble(-1.0,-2.0));
> + MSG_DEBUG("random.get", "ExplosionSmoke::ExplosionSmoke(...)");
> + SetGravityFactor(RandomSync().GetDouble(-1.0,-2.0));
>
> image->ScaleSize(m_initial_size, m_initial_size);
> SetSize( Point2i(1, 1) );
> diff --git a/src/particles/fire.cpp b/src/particles/fire.cpp
> index 4f1cb96..d6994dd 100644
> --- a/src/particles/fire.cpp
> +++ b/src/particles/fire.cpp
> @@ -24,7 +24,7 @@
> #include "game/time.h"
> #include "graphic/sprite.h"
> #include "sound/jukebox.h"
> -#include <WORMUX_random.h>
> +#include "network/randomsync.h"
> #include "weapon/explosion.h"
> #include "weapon/weapon_cfg.h"
>
> @@ -33,11 +33,17 @@ const uint dig_ground_time = 1000;
>
> ExplosiveWeaponConfig fire_cfg;
>
> +static long GetRandomDigGroundTime()
> +{
> + MSG_DEBUG("random.get", "GetRandomDigGroundTime");
> + return RandomSync().GetLong(0, dig_ground_time);
> +}
> +
> FireParticle::FireParticle() :
> Particle("fire_particle"),
> creation_time(Time::GetInstance()->Read()),
> on_ground(false),
> - oscil_delta(RandomLocal().GetLong(0, dig_ground_time))
> + oscil_delta(GetRandomDigGroundTime())
> {
> SetCollisionModel(true, false, false);
> m_left_time_to_live = 100;
> diff --git a/src/particles/ill_bubble.cpp b/src/particles/ill_bubble.cpp
> index c3238b1..c6a3b58 100644
> --- a/src/particles/ill_bubble.cpp
> +++ b/src/particles/ill_bubble.cpp
> @@ -24,7 +24,7 @@
> #include "particles/explosion_smoke.h"
> #include "game/time.h"
> #include "graphic/sprite.h"
> -#include <WORMUX_random.h>
> +#include "network/randomsync.h"
>
> // Vibration period of the bubble
> const uint vib_period = 250;
> @@ -35,7 +35,9 @@ IllBubble::IllBubble() : ExplosionSmoke(20)
> delete image;
> image = ParticleEngine::GetSprite(ILL_BUBBLE_spr);
> SetAirResistFactor( GetAirResistFactor() * 3.0 );
> - vib_phi = RandomLocal().GetLong(0, vib_period);
> +
> + MSG_DEBUG("random.get", "IllBubble::IllBubble()");
> + vib_phi = RandomSync().GetLong(0, vib_period);
> }
>
> void IllBubble::Draw()
> diff --git a/src/particles/magic_star.cpp b/src/particles/magic_star.cpp
> index bdedda7..7fcfa08 100644
> --- a/src/particles/magic_star.cpp
> +++ b/src/particles/magic_star.cpp
> @@ -22,7 +22,7 @@
>
> #include "particles/magic_star.h"
> #include "particles/particle.h"
> -#include <WORMUX_random.h>
> +#include "network/randomsync.h"
> #include "game/time.h"
> #include "graphic/sprite.h"
>
> @@ -33,7 +33,8 @@ MagicStarParticle::MagicStarParticle() :
> m_left_time_to_live = m_initial_time_to_live;
> m_time_between_scale = 25;
>
> - uint color=RandomLocal().GetLong(0,2);
> + MSG_DEBUG("random.get", "MagicStarParticle::MagicStarParticle()");
> + uint color=RandomSync().GetLong(0,2);
> switch(color)
> {
> case 0 : image = ParticleEngine::GetSprite(MAGIC_STAR_R_spr); break;
> diff --git a/src/particles/particle.cpp b/src/particles/particle.cpp
> index 728e675..60d455c 100644
> --- a/src/particles/particle.cpp
> +++ b/src/particles/particle.cpp
> @@ -26,10 +26,10 @@
> #include "graphic/sprite.h"
> #include "object/objects_list.h"
> #include "tool/resource_manager.h"
> -#include <WORMUX_random.h>
> #include <WORMUX_point.h>
> #include "weapon/explosion.h"
> #include "map/map.h"
> +#include "network/randomsync.h"
>
> #include "particles/body_member.h"
> #include "particles/teleport_member.h"
> @@ -128,7 +128,8 @@ void ParticleEngine::AddPeriodic(const Point2i &position,
> particle_t type,
> uint time = Time::GetInstance()->Read() - m_last_refresh;
> uint tmp = Time::GetInstance()->Read();
>
> - uint delta = uint(m_time_between_add * double(RandomLocal().GetLong(3,
> 40)) / 10);
> + MSG_DEBUG("random.get", "ParticleEngine::AddPeriodic(...)");
> + uint delta = uint(m_time_between_add * double(RandomSync().GetLong(3, 40))
> / 10);
> if (time >= delta) {
> m_last_refresh = tmp;
> ParticleEngine::AddNow(position, 1, type, upper, angle, norme);
> @@ -242,15 +243,19 @@ void ParticleEngine::AddNow(const Point2i &position,
>
> if (particle != NULL) {
>
> - if( norme == -1 )
> - tmp_norme = double(RandomLocal().GetLong(0, 5000))/100;
> - else
> + if( norme == -1 ) {
> + MSG_DEBUG("random.get", "ParticleEngine::AddNow(...) speed vector
> length");
> + tmp_norme = double(RandomSync().GetLong(0, 5000))/100;
> + } else {
> tmp_norme = norme;
> + }
>
> - if( angle == -1 )
> - tmp_angle = - double(RandomLocal().GetLong(0, 3000))/1000;
> - else
> + if( angle == -1 ) {
> + MSG_DEBUG("random.get", "ParticleEngine::AddNow(...) speed vector
> angle");
> + tmp_angle = - double(RandomSync().GetLong(0, 3000))/1000;
> + } else {
> tmp_angle = angle;
> + }
>
> particle->SetXY(position);
> particle->SetOnTop(upper);
> diff --git a/src/particles/teleport_member.cpp
> b/src/particles/teleport_member.cpp
> index aea0545..3e29f42 100644
> --- a/src/particles/teleport_member.cpp
> +++ b/src/particles/teleport_member.cpp
> @@ -21,7 +21,7 @@
>
> #include "particles/teleport_member.h"
> #include "particles/particle.h"
> -#include <WORMUX_random.h>
> +#include "network/randomsync.h"
> #include "game/time.h"
> #include "graphic/sprite.h"
> #include "map/camera.h"
> @@ -46,8 +46,10 @@ TeleportMemberParticle::TeleportMemberParticle(const
> Sprite& spr, const Point2i&
> start = position;
> time = Time::GetInstance()->Read();
>
> - sin_x_max = RandomLocal().GetDouble(M_PI_4, 3.0 * M_PI_4);
> - sin_y_max = RandomLocal().GetDouble(M_PI_4, 3.0 * M_PI_4);
> + MSG_DEBUG("random.get",
> "TeleportMemberParticle::TeleportMemberParticle(...)");
> + sin_x_max = RandomSync().GetDouble(M_PI_4, 3.0 * M_PI_4);
> + MSG_DEBUG("random.get",
> "TeleportMemberParticle::TeleportMemberParticle(...)");
> + sin_y_max = RandomSync().GetDouble(M_PI_4, 3.0 * M_PI_4);
> Camera::GetInstance()->FollowObject(this, true);
> }
>
>
_______________________________________________
Wormux-dev mailing list
[email protected]
https://mail.gna.org/listinfo/wormux-dev