Skip to content

Commit 643616d

Browse files
committed
so we can now see some characters moving properly...untwisted!
-this was caused in idAnimator::SyncAnimChannels(), where we were foolishly failing copy the frame anims which is the whole FUCKING point of the function!! -also randomly replaced some ==/!= with equals()
1 parent d692e6f commit 643616d

11 files changed

Lines changed: 91 additions & 23 deletions

File tree

src/main/java/neo/CM/CollisionModel_local.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1230,7 +1230,7 @@ public void Translation(trace_s[] results, final idVec3 start, final idVec3 end,
12301230
tw.contacts[i].point.oMulSet(modelAxis);
12311231
}
12321232
}
1233-
if (modelOrigin != getVec3_origin()) {
1233+
if (!modelOrigin.equals(getVec3_origin())) {
12341234
for (i = 0; i < tw.numContacts; i++) {
12351235
tw.contacts[i].point.oPluSet(modelOrigin);
12361236
tw.contacts[i].dist += modelOrigin.oMultiply(tw.contacts[i].normal);

src/main/java/neo/Game/AI/AI.java

Lines changed: 8 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -1481,7 +1481,7 @@ public void Spawn() {
14811481
lookJointAngles.SetGranularity(1);
14821482
kv = spawnArgs.MatchPrefix("look_joint", null);
14831483
while (kv != null) {
1484-
jointName = kv.GetKey();
1484+
jointName.oSet(kv.GetKey());
14851485
jointName.StripLeadingOnce("look_joint ");
14861486
joint = animator.GetJointHandle(jointName);
14871487
if (joint == INVALID_JOINT) {
@@ -1492,7 +1492,7 @@ public void Spawn() {
14921492

14931493
// if no scale on any component, then don't bother adding it. this may be done to
14941494
// zero out rotation from an inherited entitydef.
1495-
if (jointScale != getAng_zero()) {
1495+
if (!jointScale.equals(getAng_zero())) {
14961496
lookJoints.Append(joint);
14971497
lookJointAngles.Append(jointScale);
14981498
}
@@ -2110,7 +2110,7 @@ public static boolean PredictTrajectory(final idVec3 firePos, final idVec3 targe
21102110
}
21112111

21122112
// if no velocity or the projectile is not affected by gravity
2113-
if (projectileSpeed <= 0.0f || projGravity == getVec3_origin()) {
2113+
if (projectileSpeed <= 0.0f || projGravity.equals(getVec3_origin())) {
21142114

21152115
aimDir.oSet(target.oMinus(firePos));
21162116
aimDir.Normalize();
@@ -2739,7 +2739,7 @@ protected void GetMoveDelta(final idMat3 oldaxis, final idMat3 axis, idVec3 delt
27392739
animator.GetDelta(gameLocal.time - gameLocal.msec, gameLocal.time, delta);
27402740
delta.oSet(axis.oMultiply(delta));
27412741

2742-
if (modelOffset != getVec3_zero()) {
2742+
if (!modelOffset.equals(getVec3_zero())) {
27432743
// the pivot of the monster's model is around its origin, and not around the bounding
27442744
// box's origin, so we have to compensate for this when the model is offset so that
27452745
// the monster still appears to rotate around it's origin.
@@ -5414,8 +5414,7 @@ public boolean UpdateAnimationControllers() {
54145414
alignHeadTime = (int) (gameLocal.time + (0.5f + 0.5f * gameLocal.random.RandomFloat()) * focusAlignTime);
54155415
}
54165416
}
5417-
if (idMath.Fabs(newLookAng.yaw)
5418-
< 0.1f) {
5417+
if (idMath.Fabs(newLookAng.yaw) < 0.1f) {
54195418
alignHeadTime = gameLocal.time;
54205419
}
54215420
if ((gameLocal.time >= alignHeadTime) || (gameLocal.time < forceAlignHeadTime)) {
@@ -5424,14 +5423,12 @@ public boolean UpdateAnimationControllers() {
54245423
destLookAng.Clamp(lookMin, lookMax);
54255424
}
54265425
diff = destLookAng.oMinus(lookAng);
5427-
if ((lookMin.pitch == -180.0f) && (lookMax.pitch
5428-
== 180.0f)) {
5426+
if ((lookMin.pitch == -180.0f) && (lookMax.pitch == 180.0f)) {
54295427
if ((diff.pitch > 180.0f) || (diff.pitch <= -180.0f)) {
54305428
diff.pitch = 360.0f - diff.pitch;
54315429
}
54325430
}
5433-
if ((lookMin.yaw == -180.0f) && (lookMax.yaw
5434-
== 180.0f)) {
5431+
if ((lookMin.yaw == -180.0f) && (lookMax.yaw == 180.0f)) {
54355432
if (diff.yaw > 180.0f) {
54365433
diff.yaw -= 360.0f;
54375434
} else if (diff.yaw <= -180.0f) {
@@ -5442,9 +5439,7 @@ public boolean UpdateAnimationControllers() {
54425439

54435440
lookAng.Normalize180();
54445441
jointAng.roll = 0.0f;
5445-
for (i = 0;
5446-
i < lookJoints.Num();
5447-
i++) {
5442+
for (i = 0; i < lookJoints.Num(); i++) {
54485443
jointAng.pitch = lookAng.pitch * lookJointAngles.oGet(i).pitch;
54495444
jointAng.yaw = lookAng.yaw * lookJointAngles.oGet(i).yaw;
54505445
animator.SetJointAxis(lookJoints.oGet(i), JOINTMOD_WORLD, jointAng.ToMat3());

src/main/java/neo/Game/Animation/Anim_Blend.java

Lines changed: 24 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1864,11 +1864,31 @@ public static class idAnimBlend {
18641864
private boolean allowFrameCommands;
18651865
//
18661866
//
1867+
private static int DBG_counter;
1868+
private final int DBG_count = DBG_counter++;
18671869

18681870
public idAnimBlend() {
18691871
Reset(null);
18701872
}
1871-
1873+
1874+
public idAnimBlend(final idAnimBlend blend) {
1875+
this.modelDef = blend.modelDef;
1876+
this.starttime = blend.starttime;
1877+
this.endtime = blend.endtime;
1878+
this.timeOffset = blend.timeOffset;
1879+
this.rate = blend.rate;
1880+
this.blendStartTime = blend.blendStartTime;
1881+
this.blendDuration = blend.blendDuration;
1882+
this.blendStartValue = blend.blendStartValue;
1883+
this.blendEndValue = blend.blendEndValue;
1884+
System.arraycopy(blend.animWeights, 0, this.animWeights, 0, ANIM_MaxSyncedAnims);
1885+
this.cycle = blend.cycle;
1886+
this.frame = blend.frame;
1887+
this.animNum = blend.animNum;
1888+
this.allowMove = blend.allowMove;
1889+
this.allowFrameCommands = blend.allowFrameCommands;
1890+
}
1891+
18721892
private void Reset(final idDeclModelDef _modelDef) {
18731893
modelDef = _modelDef;
18741894
cycle = 1;
@@ -2141,8 +2161,8 @@ private boolean BlendAnim(int currentTime, int channel, int numJoints, idJointQu
21412161
final int num = modelDef.NumJointsOnChannel(channel);
21422162
for (i = 0; i < num; i++) {
21432163
int j = index[i];
2144-
blendFrame[j].t = jointFrame[j].t;
2145-
blendFrame[j].q = jointFrame[j].q;
2164+
blendFrame[j].t.oSet(jointFrame[j].t);
2165+
blendFrame[j].q.oSet(jointFrame[j].q);
21462166
}
21472167
}
21482168
} else {
@@ -3681,6 +3701,7 @@ public void SyncAnimChannels(int channelNum, int fromChannelNum, int currentTime
36813701
float weight = fromBlend.blendEndValue;
36823702
if ((fromBlend.Anim() != toBlend.Anim()) || (fromBlend.GetStartTime() != toBlend.GetStartTime()) || (fromBlend.GetEndTime() != toBlend.GetEndTime())) {
36833703
PushAnims(channelNum, currentTime, blendTime);
3704+
SIMDProcessor.Memcpy(channels[channelNum], channels[fromChannelNum], ANIM_MaxAnimsPerChannel);
36843705
toBlend = fromBlend;
36853706
toBlend.blendStartValue = 0.0f;
36863707
toBlend.blendEndValue = 0.0f;

src/main/java/neo/Game/Mover.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -839,7 +839,7 @@ protected void BeginRotation(idThread thread, boolean stopwhendone) {
839839

840840
physicsObj.GetLocalAngles(ang);
841841
angle_delta = dest_angles.oMinus(ang);
842-
if (angle_delta == getAng_zero()) {
842+
if (angle_delta.equals(getAng_zero())) {
843843
// set our final angles so that we get rid of any numerical inaccuracy
844844
dest_angles.Normalize360();
845845
physicsObj.SetAngularExtrapolation(EXTRAPOLATION_NONE, 0, 0, dest_angles, getAng_zero(), getAng_zero());

src/main/java/neo/Game/Physics/Clip.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -909,7 +909,7 @@ public boolean Motion(trace_s[] results, final idVec3 start, final idVec3 end, f
909909
return true;
910910
}
911911

912-
if (mdl != null && rotation.GetAngle() != 0.0f && rotation.GetVec() != getVec3_origin()) {
912+
if (mdl != null && rotation.GetAngle() != 0.0f && !rotation.GetVec().equals(getVec3_origin())) {
913913
// if no translation
914914
if (start == end) {
915915
// pure rotation

src/main/java/neo/Game/Physics/Physics_AF.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7141,7 +7141,7 @@ private void Rest() {
71417141
private void AddPushVelocity(final idVec6 pushVelocity) {
71427142
int i;
71437143

7144-
if (pushVelocity != getVec6_origin()) {
7144+
if (!pushVelocity.equals(getVec6_origin())) {
71457145
for (i = 0; i < bodies.Num(); i++) {
71467146
bodies.oGet(i).current.spatialVelocity.oPluSet(pushVelocity);
71477147
int a = 0;

src/main/java/neo/Game/Physics/Push.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -421,7 +421,7 @@ public float ClipPush(trace_s[] results, idEntity pusher, final int flags, final
421421
translation = newOrigin.oMinus(oldOrigin);
422422

423423
// if the pusher translates
424-
if (translation != getVec3_origin()) {
424+
if (!translation.equals(getVec3_origin())) {
425425

426426
mass += ClipTranslationalPush(results, pusher, flags, newOrigin, translation);
427427
if (results[0].fraction < 1.0f) {

src/main/java/neo/Tools/Compilers/AAS/Brush.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -363,7 +363,7 @@ public void Transform(final idVec3 origin, final idMat3 axis) {
363363
}
364364
transformed = true;
365365
}
366-
if (origin != getVec3_origin()) {
366+
if (!origin.equals(getVec3_origin())) {
367367
for (i = 0; i < sides.Num(); i++) {
368368
sides.oGet(i).plane.TranslateSelf(origin);
369369
}

src/main/java/neo/idlib/math/Simd.java

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@
33
import java.nio.FloatBuffer;
44
import java.util.Arrays;
55

6+
import neo.Game.Animation.Anim_Blend.idAnimBlend;
67
import neo.Renderer.Model.dominantTri_s;
78
import neo.Renderer.Model.shadowCache_s;
89
import neo.TempDump.TODO_Exception;
@@ -367,6 +368,12 @@ public void Dot(float[] dot, final FloatBuffer src1, final float[] src2, final i
367368
@Deprecated
368369
public abstract void /*VPCALL*/ Memcpy(Object[] dst, final Object[] src, final int count);
369370

371+
public void /*VPCALL*/ Memcpy(idAnimBlend[] dst, final idAnimBlend[] src, final int count) {
372+
for (int i = 0; i < count; i++) {
373+
dst[i] = new idAnimBlend(src[i]);
374+
}
375+
}
376+
370377
public void /*VPCALL*/ Memcpy(idDrawVert[] dst, final idDrawVert[] src, final int count) {
371378
for (int i = 0; i < count; i++) {
372379
dst[i].oSet(src[i]);

src/main/java/neo/idlib/math/Vector.java

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1950,6 +1950,21 @@ public float SubVec3_Normalize(final int i) {
19501950
return normalize;
19511951
}
19521952

1953+
@Override
1954+
public int hashCode() {
1955+
return Arrays.hashCode(p);
1956+
}
1957+
1958+
@Override
1959+
public boolean equals(Object o) {
1960+
if (this == o) return true;
1961+
if (o == null || getClass() != o.getClass()) return false;
1962+
1963+
idVec6 idVec6 = (idVec6) o;
1964+
1965+
return Arrays.equals(p, idVec6.p);
1966+
}
1967+
19531968
@Override
19541969
public String toString() {
19551970
return "idVec6{" +

0 commit comments

Comments
 (0)