Jump to content

[patch] implement SPLINEFLAG_TRAJECTORY (jump effect visual)


Auntie Mangos

Recommended Posts

Ok, so I've made a few tests with Death Grip and Feral Charge.

Results : it works!

For death grip I had to use another patch (that casts the actual jump spell) : see here. I just applied the dummy effect of spell 49576 :

diff --git a/src/game/SpellEffects.cpp b/src/game/SpellEffects.cpp
index ead3147..c60b0c0 100644
--- a/src/game/SpellEffects.cpp
+++ b/src/game/SpellEffects.cpp
@@ -2578,6 +2578,23 @@ void Spell::EffectDummy(SpellEffectIndex eff_idx)
                // consume diseases
                unitTarget->RemoveAurasWithDispelType(DISPEL_DISEASE, m_caster->GetGUID());
            }
+            //Death Grip - Lacking propper Jump/Leap (EffectJump -  implementation)
+             else if (m_spellInfo->Id == 49576)
+             {
+                 if (!unitTarget)
+                     return;
+
+                 m_caster->CastSpell(unitTarget, 49560, true);
+                 return;
+             }
+             else if (m_spellInfo->Id == 49560)
+             {
+                 if (!unitTarget)
+                     return;
+
+                 unitTarget->CastSpell(m_caster->GetPositionX(), m_caster->GetPositionY(), m_caster->GetPositionZ(), m_spellInfo->CalculateSimple
+                 return;
+             }
            break;
        }
    }

The visual effect is perfect, but maybe too slow, and not enough high in the air.

I'm not allowed to post a video to show it...but to give an example, if you're at 30 yars from the target, it takes more than 1 sec to the target to come to you.

If you're at 5 yards, it takes a lot less.

Afaik, this transit time should be the same regardless of the distance between you and your target.

About the height in the air, I don't know what controls this : is it speed_z ? what is speed_z, actually?

Link to comment
Share on other sites

  • 40 years later...

* What bug does the patch fix? What features does the patch add?

Implements packet structure for sending monster move with SPLINEFLAG_TRAJECTORY and its usage on Spell:EffectJump. This is used for effect of spells like http://www.wowhead.com/spell=49376 and http://www.wowhead.com/spell=49575.

* For which repository revision was the patch created?

10567

* Is there a thread in the bug report section or at lighthouse? If yes, please add a link to the thread.

i think there was one, but can't find it.

* Who has been writing this patch? Please include either forum user names or email addresses.

darkstalker

diff --git a/src/game/SpellEffects.cpp b/src/game/SpellEffects.cpp
index 823966a..76869a5 100644
--- a/src/game/SpellEffects.cpp
+++ b/src/game/SpellEffects.cpp
@@ -2877,7 +2877,14 @@ void Spell::EffectJump(SpellEffectIndex eff_idx)
        return;
    }

-    m_caster->NearTeleportTo(x, y, z, o, true);
+    uint32 speed_z = m_spellInfo->EffectMiscValue[eff_idx];
+    if (!speed_z)
+        speed_z = 10;
+    uint32 time = m_spellInfo->EffectMiscValueB[eff_idx];
+    if (!time)
+        time = speed_z * 10;
+
+    m_caster->MonsterJump(x, y, z, o, time, speed_z);
}

void Spell::EffectTeleportUnits(SpellEffectIndex eff_idx)
diff --git a/src/game/Unit.cpp b/src/game/Unit.cpp
index 3448163..ba3f8d8 100644
--- a/src/game/Unit.cpp
+++ b/src/game/Unit.cpp
@@ -401,6 +401,11 @@ void Unit::SendMonsterMove(float NewPosX, float NewPosY, float NewPosZ, SplineTy

    data << uint32(flags);                                  // splineflags
    data << uint32(moveTime);                               // Time in between points
+    if (flags & SPLINEFLAG_TRAJECTORY)
+    {
+        data << float(va_arg(vargs, double));               // Z jump speed
+        data << uint32(0);                                  // walk time after jump
+    }
    data << uint32(1);                                      // 1 single waypoint
    data << NewPosX << NewPosY << NewPosZ;                  // the single waypoint Point B

@@ -10435,6 +10440,28 @@ void Unit::MonsterMoveWithSpeed(float x, float y, float z, uint32 transitTime)
    }
}

+void Unit::MonsterJump(float x, float y, float z, float o, uint32 transitTime, uint32 verticalSpeed)
+{
+    SendMonsterMove(x, y, z, SPLINETYPE_NORMAL, SplineFlags(SPLINEFLAG_TRAJECTORY | SPLINEFLAG_WALKMODE), transitTime, NULL, double(verticalSpeed));
+
+    if (GetTypeId() != TYPEID_PLAYER)
+    {
+        Creature* c = (Creature*)this;
+        // Creature relocation acts like instant movement generator, so current generator expects interrupt/reset calls to react properly
+        if (!c->GetMotionMaster()->empty())
+            if (MovementGenerator *movgen = c->GetMotionMaster()->top())
+                movgen->Interrupt(*c);
+
+        GetMap()->CreatureRelocation((Creature*)this, x, y, z, o);
+
+        // finished relocation, movegen can different from top before creature relocation,
+        // but apply Reset expected to be safe in any case
+        if (!c->GetMotionMaster()->empty())
+            if (MovementGenerator *movgen = c->GetMotionMaster()->top())
+                movgen->Reset(*c);
+    }
+}
+
struct SetPvPHelper
{
    explicit SetPvPHelper(bool _state) : state(_state) {}
diff --git a/src/game/Unit.h b/src/game/Unit.h
index 5efc783..332b6d4 100644
--- a/src/game/Unit.h
+++ b/src/game/Unit.h
@@ -1450,6 +1450,7 @@ class MANGOS_DLL_SPEC Unit : public WorldObject

        void MonsterMove(float x, float y, float z, uint32 transitTime);
        void MonsterMoveWithSpeed(float x, float y, float z, uint32 transitTime = 0);
+        void MonsterJump(float x, float y, float z, float o, uint32 transitTime, uint32 verticalSpeed);

        // recommend use MonsterMove/MonsterMoveWithSpeed for most case that correctly work with movegens
        // if used additional args in ... part then floats must explicitly casted to double

Link to comment
Share on other sites

thanks, looks interesting :)

One thing I don't understand: Shouldn't a mob(player too perhaps?) be on Idle-movement _while_ he is jumping - so is this handled anywhere else already, or are all of these jump-spells so fast (short time) that there wouldn't be any visual impact?

Yea, but don't know how to do that. I just copied nearby function (MonsterMove) that seems to be working fine atm for similar purpose. Maybe should make something in movement generators but still i don't understand that part of the code.

Any comments about hard-coded '10' constants?

Just giving default values when dbc data is missing. If you got something better for that then contribute it (visually comparing with retail). I don't have any reference, just made it "look ok"

I think this effect should be added to the "knockback" effect : shaman's thunderstorm is an example.

knockback effects are actually a SMSG_MOVE_KNOCK_BACK, has nothing to do with this.

Link to comment
Share on other sites

thanks, looks interesting :)

I think this effect should be added to the "knockback" effect : shaman's thunderstorm is an example.

knockback effects are actually a SMSG_MOVE_KNOCK_BACK, has nothing to do with this.

Not really true, when using thunderstorm on mobs server does send trajectory movement, only difference is another flag that flips the orientation so "leap" becomes "knock back" effect.

For players it's handled by the client of the affected player, server only sends command what momentum player got, and off you go...

I experimented a while ago with a movement generator for knockback spells, but it's pretty rudimentary still (assumes flat terrain):

http://github.com/Lynx3d/mangos/tree/knockback

Link to comment
Share on other sites

+ uint32 speed_z = m_spellInfo->EffectMiscValue[eff_idx];

+ if (!speed_z)

+ speed_z = 10;

+ uint32 time = m_spellInfo->EffectMiscValueB[eff_idx];

+ if (!time)

+ time = speed_z * 10;

This information was incorrect.

If you take Sniff and compare value from offy, you get different data

This data from sniff offy spell - http://www.wowhead.com/spell=49575

First test: distance - 10.931

Current Position: 5739,467 175,6612 181,5781

Time: 0x000000AF (175)

speedZ: float 130,6122

Dest position: 5735,85 185,9771 181,593

Second test: distance - 19.637

Current Position: 5737,253 188,6062 181,593

Time: 0x0000013B (315)

speedZ: float 40,31242

Dest position: 5726,408 204,9769 181,593

Third test: distance - 8.15411512

Current Position: 5727,32 163,5015 179,2827

Time: 0x00000083 (131)

speedZ: float 233,0866

Dest position: 5724,258 156,6079 176,1856

Link to comment
Share on other sites

Confirmed here, I have something about Feral charge - cat: http://pastebin.com/vs6R8Enh - when I was at minimal range(8y i think), distance in packet is 13y and something because of object size, so count with it.

Just before cat lands, server sends another SMSG_MONSTER_MOVE to turn it to target (But i think that it is enough to send first one with SplineType: FacingTarget)

Monster GUID: 0x0100000003591F3D

Monster unk byte: 0

Current Position: -9313.498 342.0572 68.65701

Ticks Count: 0x04E3B6EB

SplineType: FacingTarget

Facing GUID: 0xF13000020D06E922

Spline Flags: WALKMODE

Spline Time: 0x00000000

Splines Count: 1

Dest position: -9313.498 342.0572 68.65701 (distance: 0

Offtopic: Notice that player's highguid is 0x0100 (from Burning Blade EU), and on Skullcrusher(EU) it is 0x0200.

PS: why did you named it speed?

Link to comment
Share on other sites

Thanks for the info, i don't have retail access so everything i did is guessed.

edit: there is the collected data, first block for feral charge and second for death grip

seems to be a lineal relation between travel time and distance, but couldn't find one for speedZ

doesn't look like stuff matching DBC data, maybe values are result of calculating parabolic movement

shot152.png

Link to comment
Share on other sites

  • 2 weeks later...
  • 2 weeks later...
I think that "magic number" is just angle in radians*100, question is, how to calculate it.

out_angle = asin(grav*dist)/(veloc^2))/2

Wasn't following the entire discussion, but there aren't too many angles you can talk about while talking about trajectory.

Sorry in advance if that isn't what you meant.

Link to comment
Share on other sites

What number is gravity in wow?

Either there is none, and all things fall at constant speed of about 54y/s or you reach cruise speed very fast.

Actually calculating it, gives something around 8~ but it varies too much when delta changes.

PS: there's missing "(" in my above post just after arcsin.

Link to comment
Share on other sites

So, let try it with 8, according to http://img713.imageshack.us/img713/9318/shot152.png

Feral charge(-6 because of bounding radius, 15 because MiscValue/10):

asin((8.0f*(13.942730f-6.0f))/(15.0f*15.0f))/2.0f = 0.144138 which is close if we multiply it by 1000

asin((8.0f*(19.163143f-6.0f))/(15.0ff*15.0f))/2.0f = 0.245302 which is really far from 76.28

asin((8.0f*(24.531327f-6.0f))/(14.95f*15.0f))/2.0f = 0.362614

asin((8.0f*(26.161899f-6.0f))/(15.0f*15.0f))/2.0f = 0.403106 which is close

Death Grip:

asin((8.0f*(19.637053f))/(15.0f*15.0f))/2.0f = 0.389722 which is also close

I dont count cases with z difference, theres something else about them...

Link to comment
Share on other sites

Guest
This topic is now closed to further replies.
×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue. Privacy Policy Terms of Use