Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 5 additions & 2 deletions common/game/movealgo.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -263,8 +263,11 @@ bool MoveAlgo::implTick(uint64_t dt, MvFlags moveFlg) {
}

if(npc.isJumpAnim()) {
fallSpeed += dp;
fallCount += float(dt);
// keep current speed, not average over whole jump arc
if(dt>0) {
fallSpeed = dp;
fallCount = float(dt);
}
}
else if(!dead) {
setState(InAir);
Expand Down
15 changes: 13 additions & 2 deletions common/graphics/mesh/animation.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -249,6 +249,11 @@ float Animation::Sequence::totalTime() const {
return float(data->numFrames)*1000.f/data->fpsRate;
}

uint64_t Animation::Sequence::moveTime() const {
// last sample of root motion is at numFrames-1
return uint64_t(float(data->tr.size())*1000.f/data->fpsRate);
}

float Animation::Sequence::atkTotalTime(uint16_t comboLen) const {
if(comboLen<data->defHitEnd.size()) {
uint64_t time = data->defHitEnd[comboLen];
Expand Down Expand Up @@ -518,6 +523,12 @@ void Animation::Sequence::processEvent(const zenkit::MdsEventTag& e, Animation::
}

Tempest::Vec3 Animation::Sequence::speed(uint64_t at, uint64_t dt) const {
if(animCls==Transition && isFly()) {
// keep last speed after end of jump
uint64_t all = moveTime();
if(at+dt>all)
at = all>dt ? all-dt : 0;
}
auto a = translateXZ(at), b=translateXZ(at+dt); // note: at-dt vs at is more correct probably
Tempest::Vec3 f = b-a;

Expand All @@ -532,8 +543,8 @@ Tempest::Vec3 Animation::Sequence::translateXZ(uint64_t at) const {
if(numFrames==0 || d.tr.size()==0)
return Tempest::Vec3();

if(animCls==Transition && !isFly()){
uint64_t all=uint64_t(totalTime());
if(animCls==Transition) {
uint64_t all = moveTime();
if(at>all)
at = all;
}
Expand Down
1 change: 1 addition & 0 deletions common/graphics/mesh/animation.h
Original file line number Diff line number Diff line change
Expand Up @@ -88,6 +88,7 @@ class Animation final {
bool isDefParWindow(uint64_t t) const;
bool isDefWindow(uint64_t t) const;
float totalTime() const;
uint64_t moveTime() const;

bool isAttackAnim() const;
bool isPrehit(uint64_t sTime, uint64_t now) const;
Expand Down