aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorNguyễn Gia Phong <mcsinyx@disroot.org>2021-10-30 22:24:39 +0700
committerNguyễn Gia Phong <mcsinyx@disroot.org>2021-10-30 22:24:39 +0700
commitdaa4b6c673d3327a5c64e2bd180bb02593eb8c81 (patch)
treebc19c280c1f5becac447f8c576fd2d00a4ea53a3 /src
parente6bf5c413943a443067803312cacce76463ca7d7 (diff)
downloadblackshades-daa4b6c673d3327a5c64e2bd180bb02593eb8c81.tar.gz
Eradicate Skeleton.jointlabels
Diffstat (limited to 'src')
-rw-r--r--src/GameDraw.cpp14
-rw-r--r--src/GameTick.cpp123
-rw-r--r--src/Person.cpp98
-rw-r--r--src/Skeleton.cpp27
-rw-r--r--src/Skeleton.h1
-rw-r--r--src/misc.h1
-rw-r--r--src/misc.zig2
7 files changed, 117 insertions, 149 deletions
diff --git a/src/GameDraw.cpp b/src/GameDraw.cpp
index 5403d3f..c5f6ec5 100644
--- a/src/GameDraw.cpp
+++ b/src/GameDraw.cpp
@@ -614,13 +614,9 @@ void Game::DrawGLScene(void)
}
if(thirdperson==0&&person[0].skeleton.free==1){
-
- glRotatef(person[0].skeleton.joints[(person[0].skeleton.jointlabels[head])].rotate3,0,1,0);
-
- glRotatef(180-(person[0].skeleton.joints[(person[0].skeleton.jointlabels[head])].rotate2+90),0,0,1);
-
- glRotatef(person[0].skeleton.joints[(person[0].skeleton.jointlabels[head])].rotate1+90,0,1,0);
-
+ glRotatef(person[0].skeleton.joints[head].rotate3,0,1,0);
+ glRotatef(180-(person[0].skeleton.joints[head].rotate2+90),0,0,1);
+ glRotatef(person[0].skeleton.joints[head].rotate1+90,0,1,0);
}
if(thirdperson==2){
@@ -1081,13 +1077,13 @@ void Game::DrawGLScene(void)
if(person[i].killtarget>-1&&person[i].killtargetvisible&&person[i].skeleton.free==0&&person[person[i].killtarget].skeleton.free==0){
- sprites.MakeSprite(bulletinstant, (shotdelayamount/difficulty-person[i].shotdelay)/shotdelayamount/difficulty/2, 1, person[i].shotdelay/shotdelayamount/difficulty, person[i].shotdelay/shotdelayamount/difficulty, DoRotation(person[i].skeleton.joints[person[i].skeleton.jointlabels[lefthand]].position,0,person[i].playerrotation,0)+person[i].playercoords, person[person[i].killtarget].skeleton.joints[person[person[i].killtarget].skeleton.jointlabels[abdomen]].position+person[person[i].killtarget].playercoords, person[i].shotdelay*2);
+ sprites.MakeSprite(bulletinstant, (shotdelayamount/difficulty-person[i].shotdelay)/shotdelayamount/difficulty/2, 1, person[i].shotdelay/shotdelayamount/difficulty, person[i].shotdelay/shotdelayamount/difficulty, DoRotation(person[i].skeleton.joints[lefthand].position,0,person[i].playerrotation,0)+person[i].playercoords, person[person[i].killtarget].skeleton.joints[abdomen].position+person[person[i].killtarget].playercoords, person[i].shotdelay*2);
}
if(person[i].killtarget>-1&&person[i].killtargetvisible&&person[i].skeleton.free==0&&person[person[i].killtarget].skeleton.free!=0){
- sprites.MakeSprite(bulletinstant, (shotdelayamount/difficulty-person[i].shotdelay)/shotdelayamount/difficulty/2, 1, person[i].shotdelay/shotdelayamount/difficulty, person[i].shotdelay/shotdelayamount/difficulty, DoRotation(person[i].skeleton.joints[person[i].skeleton.jointlabels[lefthand]].position,0,person[i].playerrotation,0)+person[i].playercoords, person[person[i].killtarget].skeleton.joints[person[person[i].killtarget].skeleton.jointlabels[abdomen]].position, person[i].shotdelay*2);
+ sprites.MakeSprite(bulletinstant, (shotdelayamount/difficulty-person[i].shotdelay)/shotdelayamount/difficulty/2, 1, person[i].shotdelay/shotdelayamount/difficulty, person[i].shotdelay/shotdelayamount/difficulty, DoRotation(person[i].skeleton.joints[lefthand].position,0,person[i].playerrotation,0)+person[i].playercoords, person[person[i].killtarget].skeleton.joints[abdomen].position, person[i].shotdelay*2);
}
diff --git a/src/GameTick.cpp b/src/GameTick.cpp
index f3ce015..4182c71 100644
--- a/src/GameTick.cpp
+++ b/src/GameTick.cpp
@@ -60,9 +60,9 @@ void Game::Splat(int k)
person[k].DoAnimations(k);
auto& joints = skeleton.joints;
- auto& head_joint = joints[skeleton.jointlabels[head]];
+ auto& head_joint = joints[head];
person[k].bjoint1 = &head_joint;
- person[k].bjoint2 = joints + skeleton.jointlabels[neck];
+ person[k].bjoint2 = joints + neck;
for (auto& joint : joints) {
joint.position = DoRotation(joint.position + joint.offset, 0,
@@ -269,7 +269,7 @@ void click(Game* game, int button, int action, int mods)
if (weapon == grenade && player.ammo > 0
&& player.reloading <= 0 && player.attackframe < 0) {
auto& skeleton = player.skeleton;
- auto& hand = skeleton.joints[skeleton.jointlabels[righthand]];
+ auto& hand = skeleton.joints[righthand];
auto soundsrc = DoRotation(hand.position, 0, player.playerrotation, 0)
+ player.playercoords - camera.position;
if (player.grenphase) {
@@ -356,9 +356,7 @@ void Game::setListener(XYZ& facing)
XYZ Game::aimPlayer()
{
auto& joints = person[0].skeleton.joints;
- auto& jointlabels = person[0].skeleton.jointlabels;
- auto point = joints[jointlabels[lefthand]].position
- - joints[jointlabels[righthand]].position;
+ auto point = joints[lefthand].position - joints[righthand].position;
float aimrot = 0.0f, aimrot2 = 0.0f;
switch (person[0].whichgun) {
@@ -376,9 +374,9 @@ XYZ Game::aimPlayer()
case handgun2:
aimrot = -0.9f;
auto k = thirdperson ? 0.35 : 0.65;
- point = joints[jointlabels[righthand]].position
- - joints[jointlabels[head]].position * k
- - joints[jointlabels[neck]].position * (1 - k);
+ point = joints[righthand].position
+ - joints[head].position * k
+ - joints[neck].position * (1 - k);
break;
}
@@ -407,15 +405,14 @@ XYZ Game::aimBot(int j)
auto& target = person[person[j].killtarget];
auto& joints = target.skeleton.joints;
- auto& jointlabels = target.skeleton.jointlabels;
- XYZ aim = joints[jointlabels[abdomen]].position;
+ XYZ aim = joints[abdomen].position;
if (target.skeleton.free)
inaccuracy *= 3;
else
aim = DoRotation(aim, 0, target.playerrotation, 0)
+ target.playercoords;
- auto& lefthandpos = joints[jointlabels[lefthand]].position;
+ auto& lefthandpos = joints[lefthand].position;
aim -= person[j].playercoords
+ DoRotation(lefthandpos, 0, person[j].playerrotation, 0);
return DoRotation(
@@ -974,9 +971,9 @@ void Game::Tick()
for(int i=0;i<numpeople;i++){
if(person[i].health<0&&person[i].longdead<0&&person[i].firstlongdead==0){
if(person[i].type!=zombietype){
- overpoint=person[i].skeleton.joints[person[i].skeleton.jointlabels[abdomen]].position;
+ overpoint=person[i].skeleton.joints[abdomen].position;
overpoint.y+=3000;
- underpoint=person[i].skeleton.joints[person[i].skeleton.jointlabels[abdomen]].position;
+ underpoint=person[i].skeleton.joints[abdomen].position;
underpoint.y-=3000;
move=0;
@@ -994,7 +991,7 @@ void Game::Tick()
decals.MakeDecal(bloodpool,temp,12,normish, whichtri, &sidewalkcollide, move, cityrotation[person[i].whichblockx][person[i].whichblocky]*90);
}
if(whichtri==-1){
- temp=person[i].skeleton.joints[person[i].skeleton.jointlabels[abdomen]].position;
+ temp=person[i].skeleton.joints[abdomen].position;
temp.y=-.5;
move=0;
decals.MakeDecal(bloodpool,temp,12,normish, 0, &sidewalkcollide, move, 0);
@@ -1103,20 +1100,20 @@ void Game::Tick()
if(i > 0
&& person[i].targetanimation == zombieeatanim
&& person[person[i].killtarget].eaten == i) {
- person[person[i].killtarget].skeleton.joints[person[person[i].killtarget].skeleton.jointlabels[head]].locked=1;
- person[person[i].killtarget].skeleton.joints[person[person[i].killtarget].skeleton.jointlabels[rightshoulder]].locked=1;
+ person[person[i].killtarget].skeleton.joints[head].locked=1;
+ person[person[i].killtarget].skeleton.joints[rightshoulder].locked=1;
for(int k=0;k<2;k++){
- person[person[i].killtarget].skeleton.joints[person[person[i].killtarget].skeleton.jointlabels[head]].position=DoRotation(person[i].skeleton.joints[person[i].skeleton.jointlabels[righthand]].position,0,person[i].playerrotation,0)+person[i].playercoords;
- person[person[i].killtarget].skeleton.joints[person[person[i].killtarget].skeleton.jointlabels[head]].velocity=0;
- person[person[i].killtarget].skeleton.joints[person[person[i].killtarget].skeleton.jointlabels[rightshoulder]].position=DoRotation(person[i].skeleton.joints[person[i].skeleton.jointlabels[lefthand]].position,0,person[i].playerrotation,0)+person[i].playercoords;
- person[person[i].killtarget].skeleton.joints[person[person[i].killtarget].skeleton.jointlabels[rightshoulder]].velocity=0;
+ person[person[i].killtarget].skeleton.joints[head].position=DoRotation(person[i].skeleton.joints[righthand].position,0,person[i].playerrotation,0)+person[i].playercoords;
+ person[person[i].killtarget].skeleton.joints[head].velocity=0;
+ person[person[i].killtarget].skeleton.joints[rightshoulder].position=DoRotation(person[i].skeleton.joints[lefthand].position,0,person[i].playerrotation,0)+person[i].playercoords;
+ person[person[i].killtarget].skeleton.joints[rightshoulder].velocity=0;
person[person[i].killtarget].skeleton.DoConstraints();
person[person[i].killtarget].skeleton.DoConstraints(&blocksimplecollide[citytype[person[i].whichblockx][person[i].whichblocky]],&move,cityrotation[person[i].whichblockx][person[i].whichblocky]*90);
}
- person[person[i].killtarget].skeleton.joints[person[person[i].killtarget].skeleton.jointlabels[head]].locked=0;
- person[person[i].killtarget].skeleton.joints[person[person[i].killtarget].skeleton.jointlabels[rightshoulder]].locked=0;
+ person[person[i].killtarget].skeleton.joints[head].locked=0;
+ person[person[i].killtarget].skeleton.joints[rightshoulder].locked=0;
person[person[i].killtarget].longdead=1;
}
@@ -1482,8 +1479,8 @@ void Game::Tick()
auto stabpos = person[i].playercoords + flatfacing - camera.position;
playSound(gSourceID[knifeslashsound],
stabpos.x, stabpos.y, stabpos.z);
- person[person[i].killtarget].bjoint1=&person[person[i].killtarget].skeleton.joints[person[person[i].killtarget].skeleton.jointlabels[neck]];
- person[person[i].killtarget].bjoint2=&person[person[i].killtarget].skeleton.joints[person[person[i].killtarget].skeleton.jointlabels[neck]];
+ person[person[i].killtarget].bjoint1=&person[person[i].killtarget].skeleton.joints[neck];
+ person[person[i].killtarget].bjoint2=&person[person[i].killtarget].skeleton.joints[neck];
person[person[i].killtarget].bleeding=1;
person[person[i].killtarget].bleeddelay=1;
person[person[i].killtarget].health-=20;
@@ -1608,7 +1605,7 @@ void Game::Tick()
person[i].playercoords.y = joint.position.y;
//Find orientation
- XYZ firsttop=person[i].skeleton.joints[person[i].skeleton.jointlabels[neck]].position-person[i].skeleton.joints[person[i].skeleton.jointlabels[groin]].position;
+ XYZ firsttop=person[i].skeleton.joints[neck].position-person[i].skeleton.joints[groin].position;
Normalise(&firsttop);
person[i].playerrotation=acos(0-firsttop.z);
person[i].playerrotation*=360/6.28;
@@ -1639,21 +1636,21 @@ void Game::Tick()
playSound(gSourceID[knifeslashsound],
soundpos.x, soundpos.y, soundpos.z);
- person[person[0].killtarget].bjoint1=&person[person[0].killtarget].skeleton.joints[person[person[0].killtarget].skeleton.jointlabels[neck]];
- person[person[0].killtarget].bjoint2=&person[person[0].killtarget].skeleton.joints[person[person[0].killtarget].skeleton.jointlabels[neck]];
+ person[person[0].killtarget].bjoint1=&person[person[0].killtarget].skeleton.joints[neck];
+ person[person[0].killtarget].bjoint2=&person[person[0].killtarget].skeleton.joints[neck];
person[person[0].killtarget].bleeding=1;
person[person[0].killtarget].bleeddelay=1;
- person[0].bjoint1=&person[0].skeleton.joints[person[0].skeleton.jointlabels[righthand]];
- person[0].bjoint2=&person[0].skeleton.joints[person[0].skeleton.jointlabels[righthand]];
+ person[0].bjoint1=&person[0].skeleton.joints[righthand];
+ person[0].bjoint2=&person[0].skeleton.joints[righthand];
person[0].bleeding=1;
person[0].bleeddelay=1;
velocity=DoRotation(flatfacing,0,70,0)*50+person[0].velocity*2;
velocity.y+=30;
- sprites.MakeSprite(bloodspritedown, .8, 1, .2, .2,DoRotation(person[person[0].killtarget].skeleton.joints[person[person[0].killtarget].skeleton.jointlabels[neck]].position,0,person[person[0].killtarget].playerrotation,0)+person[person[0].killtarget].playercoords, velocity*.3, 2);
- sprites.MakeSprite(bloodspritedown, .8, 1, .2, .2,DoRotation(person[person[0].killtarget].skeleton.joints[person[person[0].killtarget].skeleton.jointlabels[neck]].position,0,person[person[0].killtarget].playerrotation,0)+person[person[0].killtarget].playercoords, velocity*.2, 3);
- sprites.MakeSprite(bloodspritedown, .8, 1, .2, .2,DoRotation(person[person[0].killtarget].skeleton.joints[person[person[0].killtarget].skeleton.jointlabels[neck]].position,0,person[person[0].killtarget].playerrotation,0)+person[person[0].killtarget].playercoords, velocity*.1, 4);
+ sprites.MakeSprite(bloodspritedown, .8, 1, .2, .2,DoRotation(person[person[0].killtarget].skeleton.joints[neck].position,0,person[person[0].killtarget].playerrotation,0)+person[person[0].killtarget].playercoords, velocity*.3, 2);
+ sprites.MakeSprite(bloodspritedown, .8, 1, .2, .2,DoRotation(person[person[0].killtarget].skeleton.joints[neck].position,0,person[person[0].killtarget].playerrotation,0)+person[person[0].killtarget].playercoords, velocity*.2, 3);
+ sprites.MakeSprite(bloodspritedown, .8, 1, .2, .2,DoRotation(person[person[0].killtarget].skeleton.joints[neck].position,0,person[person[0].killtarget].playerrotation,0)+person[person[0].killtarget].playercoords, velocity*.1, 4);
}
person[person[0].killtarget].health-=100;
@@ -1672,8 +1669,8 @@ void Game::Tick()
}
if(person[0].whichgun!=knife){
- person[person[0].killtarget].skeleton.joints[person[person[0].killtarget].skeleton.jointlabels[head]].velocity+=DoRotation(flatfacing,0,40,0)*50;
- person[person[0].killtarget].skeleton.joints[person[person[0].killtarget].skeleton.jointlabels[head]].velocity+=person[0].velocity*2;
+ person[person[0].killtarget].skeleton.joints[head].velocity+=DoRotation(flatfacing,0,40,0)*50;
+ person[person[0].killtarget].skeleton.joints[head].velocity+=person[0].velocity*2;
}
} else if (!whacked) {
whacked = true;
@@ -1684,13 +1681,13 @@ void Game::Tick()
playSound(gSourceID[knifeslashsound],
soundpos.x, soundpos.y, soundpos.z);
- person[person[0].killtarget].bjoint1=&person[person[0].killtarget].skeleton.joints[person[person[0].killtarget].skeleton.jointlabels[neck]];
- person[person[0].killtarget].bjoint2=&person[person[0].killtarget].skeleton.joints[person[person[0].killtarget].skeleton.jointlabels[neck]];
+ person[person[0].killtarget].bjoint1=&person[person[0].killtarget].skeleton.joints[neck];
+ person[person[0].killtarget].bjoint2=&person[person[0].killtarget].skeleton.joints[neck];
person[person[0].killtarget].bleeddelay=1;
- person[0].bjoint1=&person[0].skeleton.joints[person[0].skeleton.jointlabels[righthand]];
- person[0].bjoint2=&person[0].skeleton.joints[person[0].skeleton.jointlabels[righthand]];
+ person[0].bjoint1=&person[0].skeleton.joints[righthand];
+ person[0].bjoint2=&person[0].skeleton.joints[righthand];
person[0].bleeding=1;
person[0].bleeddelay=1;
@@ -1698,9 +1695,9 @@ void Game::Tick()
velocity=DoRotation(flatfacing,0,70,0)*50+person[0].velocity*2;
velocity.y+=30;
- sprites.MakeSprite(bloodspritedown, .8, 1, .2, .2,DoRotation(person[person[0].killtarget].skeleton.joints[person[person[0].killtarget].skeleton.jointlabels[neck]].position,0,person[person[0].killtarget].playerrotation,0)+person[person[0].killtarget].playercoords, velocity*.3, 2);
- sprites.MakeSprite(bloodspritedown, .8, 1, .2, .2,DoRotation(person[person[0].killtarget].skeleton.joints[person[person[0].killtarget].skeleton.jointlabels[neck]].position,0,person[person[0].killtarget].playerrotation,0)+person[person[0].killtarget].playercoords, velocity*.2, 3);
- sprites.MakeSprite(bloodspritedown, .8, 1, .2, .2,DoRotation(person[person[0].killtarget].skeleton.joints[person[person[0].killtarget].skeleton.jointlabels[neck]].position,0,person[person[0].killtarget].playerrotation,0)+person[person[0].killtarget].playercoords, velocity*.1, 4);
+ sprites.MakeSprite(bloodspritedown, .8, 1, .2, .2,DoRotation(person[person[0].killtarget].skeleton.joints[neck].position,0,person[person[0].killtarget].playerrotation,0)+person[person[0].killtarget].playercoords, velocity*.3, 2);
+ sprites.MakeSprite(bloodspritedown, .8, 1, .2, .2,DoRotation(person[person[0].killtarget].skeleton.joints[neck].position,0,person[person[0].killtarget].playerrotation,0)+person[person[0].killtarget].playercoords, velocity*.2, 3);
+ sprites.MakeSprite(bloodspritedown, .8, 1, .2, .2,DoRotation(person[person[0].killtarget].skeleton.joints[neck].position,0,person[person[0].killtarget].playerrotation,0)+person[person[0].killtarget].playercoords, velocity*.1, 4);
}
person[person[0].killtarget].health-=200;
@@ -1720,8 +1717,8 @@ void Game::Tick()
}
if(person[0].whichgun!=knife){
- person[person[0].killtarget].skeleton.joints[person[person[0].killtarget].skeleton.jointlabels[head]].velocity+=DoRotation(flatfacing,0,40,0)*50;
- person[person[0].killtarget].skeleton.joints[person[person[0].killtarget].skeleton.jointlabels[head]].velocity+=person[0].velocity*2;
+ person[person[0].killtarget].skeleton.joints[head].velocity+=DoRotation(flatfacing,0,40,0)*50;
+ person[person[0].killtarget].skeleton.joints[head].velocity+=person[0].velocity*2;
}
}
}
@@ -1846,10 +1843,10 @@ void Game::Tick()
switch (person[j].whichgun) {
case handgun1:
case handgun2:
- aimjoint = person[j].skeleton.jointlabels[rightwrist];
+ aimjoint = rightwrist;
break;
default:
- aimjoint = person[j].skeleton.jointlabels[lefthand];
+ aimjoint = lefthand;
}
start = person[j].playercoords
+ DoRotation(person[j].skeleton.joints[aimjoint].position,
@@ -2260,7 +2257,7 @@ void Game::Tick()
if(&person[whichhit].skeleton.joints[j]==hitstruct.joint1||&person[whichhit].skeleton.joints[j]==hitstruct.joint2){
- if(j!=person[whichhit].skeleton.jointlabels[abdomen]&&j!=person[whichhit].skeleton.jointlabels[groin]&&j!=person[whichhit].skeleton.jointlabels[neck]){
+ if (j != abdomen && j != groin && j != neck) {
sprites.MakeSprite(bloodspritedown, .8, 1, .2, .2,person[whichhit].skeleton.joints[j].position, person[whichhit].skeleton.joints[j].velocity/3, 9);
@@ -2469,19 +2466,19 @@ void Game::Tick()
if(!zoom||j!=0){
- if(person[j].whichgun==assaultrifle)aim=DoRotation(person[j].skeleton.joints[(person[j].skeleton.jointlabels[lefthand])].position-person[j].skeleton.joints[(person[j].skeleton.jointlabels[righthand])].position,0,person[j].playerrotation-2.5,0);
+ if(person[j].whichgun==assaultrifle)aim=DoRotation(person[j].skeleton.joints[lefthand].position-person[j].skeleton.joints[righthand].position,0,person[j].playerrotation-2.5,0);
- if(person[j].whichgun==sniperrifle)aim=DoRotation(person[j].skeleton.joints[(person[j].skeleton.jointlabels[lefthand])].position-person[j].skeleton.joints[(person[j].skeleton.jointlabels[righthand])].position,0,person[j].playerrotation+4,0);
+ if(person[j].whichgun==sniperrifle)aim=DoRotation(person[j].skeleton.joints[lefthand].position-person[j].skeleton.joints[righthand].position,0,person[j].playerrotation+4,0);
- if(person[j].whichgun==shotgun)aim=DoRotation(person[j].skeleton.joints[(person[j].skeleton.jointlabels[lefthand])].position-person[j].skeleton.joints[(person[j].skeleton.jointlabels[righthand])].position,0,person[j].playerrotation+4,0);
+ if(person[j].whichgun==shotgun)aim=DoRotation(person[j].skeleton.joints[lefthand].position-person[j].skeleton.joints[righthand].position,0,person[j].playerrotation+4,0);
- if(person[j].whichgun==handgun1&&!thirdperson&&j==0)aim=DoRotation(person[j].skeleton.joints[(person[j].skeleton.jointlabels[righthand])].position-(person[j].skeleton.joints[person[j].skeleton.jointlabels[head]].position*.65+person[j].skeleton.joints[person[j].skeleton.jointlabels[neck]].position*.35),0,person[j].playerrotation-.9,0);
+ if(person[j].whichgun==handgun1&&!thirdperson&&j==0)aim=DoRotation(person[j].skeleton.joints[righthand].position-(person[j].skeleton.joints[head].position*.65+person[j].skeleton.joints[neck].position*.35),0,person[j].playerrotation-.9,0);
- if(person[j].whichgun==handgun1&&(thirdperson||j!=0))aim=DoRotation(person[j].skeleton.joints[(person[j].skeleton.jointlabels[righthand])].position-(person[j].skeleton.joints[person[j].skeleton.jointlabels[head]].position*.35+person[j].skeleton.joints[person[j].skeleton.jointlabels[neck]].position*.65),0,person[j].playerrotation-.9,0);
+ if(person[j].whichgun==handgun1&&(thirdperson||j!=0))aim=DoRotation(person[j].skeleton.joints[righthand].position-(person[j].skeleton.joints[head].position*.35+person[j].skeleton.joints[neck].position*.65),0,person[j].playerrotation-.9,0);
- if(person[j].whichgun==handgun2&&!thirdperson&&j==0)aim=DoRotation(person[j].skeleton.joints[(person[j].skeleton.jointlabels[righthand])].position-(person[j].skeleton.joints[person[j].skeleton.jointlabels[head]].position*.65+person[j].skeleton.joints[person[j].skeleton.jointlabels[neck]].position*.35),0,person[j].playerrotation-.9,0);
+ if(person[j].whichgun==handgun2&&!thirdperson&&j==0)aim=DoRotation(person[j].skeleton.joints[righthand].position-(person[j].skeleton.joints[head].position*.65+person[j].skeleton.joints[neck].position*.35),0,person[j].playerrotation-.9,0);
- if(person[j].whichgun==handgun2&&(thirdperson||j!=0))aim=DoRotation(person[j].skeleton.joints[(person[j].skeleton.jointlabels[righthand])].position-(person[j].skeleton.joints[person[j].skeleton.jointlabels[head]].position*.35+person[j].skeleton.joints[person[j].skeleton.jointlabels[neck]].position*.65),0,person[j].playerrotation-.9,0);
+ if(person[j].whichgun==handgun2&&(thirdperson||j!=0))aim=DoRotation(person[j].skeleton.joints[righthand].position-(person[j].skeleton.joints[head].position*.35+person[j].skeleton.joints[neck].position*.65),0,person[j].playerrotation-.9,0);
}
@@ -2497,7 +2494,7 @@ void Game::Tick()
if(person[j].whichgun==sniperrifle){
- start=person[j].playercoords+DoRotation(person[j].skeleton.joints[(person[j].skeleton.jointlabels[lefthand])].position,0,person[j].playerrotation,0);
+ start=person[j].playercoords+DoRotation(person[j].skeleton.joints[lefthand].position,0,person[j].playerrotation,0);
start-=DoRotation(DoRotation(DoRotation(aim,0,-person[j].playerrotation,0),90,0,0),0,person[j].playerrotation,0)*(0-.4);
@@ -2505,7 +2502,7 @@ void Game::Tick()
if(person[j].whichgun==shotgun){
- start=person[j].playercoords+DoRotation(person[j].skeleton.joints[(person[j].skeleton.jointlabels[lefthand])].position,0,person[j].playerrotation,0);
+ start=person[j].playercoords+DoRotation(person[j].skeleton.joints[lefthand].position,0,person[j].playerrotation,0);
start-=DoRotation(DoRotation(DoRotation(aim,0,-person[j].playerrotation,0),90,0,0),0,person[j].playerrotation,0)*(0-.4);
@@ -2513,7 +2510,7 @@ void Game::Tick()
if(person[j].whichgun==handgun1){
- start=person[j].playercoords+DoRotation(person[j].skeleton.joints[(person[j].skeleton.jointlabels[rightwrist])].position,0,person[j].playerrotation,0);
+ start=person[j].playercoords+DoRotation(person[j].skeleton.joints[rightwrist].position,0,person[j].playerrotation,0);
start-=DoRotation(DoRotation(DoRotation(aim,0,-person[j].playerrotation,0),90,0,0),0,person[j].playerrotation,0)*(.55-.4);
@@ -2521,7 +2518,7 @@ void Game::Tick()
if(person[j].whichgun==handgun2){
- start=person[j].playercoords+DoRotation(person[j].skeleton.joints[(person[j].skeleton.jointlabels[rightwrist])].position,0,person[j].playerrotation,0);
+ start=person[j].playercoords+DoRotation(person[j].skeleton.joints[rightwrist].position,0,person[j].playerrotation,0);
start-=DoRotation(DoRotation(DoRotation(aim,0,-person[j].playerrotation,0),90,0,0),0,person[j].playerrotation,0)*(.55-.4);
@@ -2529,7 +2526,7 @@ void Game::Tick()
if(person[j].whichgun==assaultrifle){
- start=person[j].playercoords+DoRotation(person[j].skeleton.joints[(person[j].skeleton.jointlabels[lefthand])].position,0,person[j].playerrotation,0);
+ start=person[j].playercoords+DoRotation(person[j].skeleton.joints[lefthand].position,0,person[j].playerrotation,0);
start-=DoRotation(DoRotation(DoRotation(aim,0,-person[j].playerrotation,0),90,0,0),0,person[j].playerrotation,0)*(.25-.4);
@@ -2985,8 +2982,8 @@ void Game::Tick()
person[k].longdead = 1;
person[k].bleeddelay = 1;
- person[k].bjoint1 = &person[k].skeleton.joints[person[k].skeleton.jointlabels[head]];
- person[k].bjoint2 = &person[k].skeleton.joints[person[k].skeleton.jointlabels[neck]];
+ person[k].bjoint1 = &person[k].skeleton.joints[head];
+ person[k].bjoint2 = &person[k].skeleton.joints[neck];
for (auto& joint : person[k].skeleton.joints) {
joint.position = DoRotation(joint.position, 0, person[k].playerrotation, 0);
@@ -3035,9 +3032,9 @@ void Game::Tick()
//camera position
XYZ average;
- if(!zoom)average=person[0].skeleton.joints[(person[0].skeleton.jointlabels[head])].position*(person[0].aimamount/2+.5)+person[0].skeleton.joints[(person[0].skeleton.jointlabels[neck])].position*((1-person[0].aimamount)/2);
+ if(!zoom)average=person[0].skeleton.joints[head].position*(person[0].aimamount/2+.5)+person[0].skeleton.joints[neck].position*((1-person[0].aimamount)/2);
- if(zoom)average=person[0].skeleton.joints[(person[0].skeleton.jointlabels[righthand])].position;
+ if(zoom)average=person[0].skeleton.joints[righthand].position;
if(person[0].skeleton.free==0&&thirdperson!=2)camera.position=person[0].playercoords+DoRotation(average,0,person[0].playerrotation,0);
diff --git a/src/Person.cpp b/src/Person.cpp
index fb05907..888ea8f 100644
--- a/src/Person.cpp
+++ b/src/Person.cpp
@@ -218,8 +218,7 @@ void Person::DoAnimations(int who)
if (targetanimation == zombieeatanim && targetframe == 3) {
auto& joints = skeleton.joints;
- auto& jointlabels = skeleton.jointlabels;
- auto head_joint = joints[jointlabels[head]];
+ auto head_joint = joints[head];
auto soundsrc = (DoRotation(head_joint.position,
0, playerrotation, 0) + playercoords
- camera.position) / soundscalefactor;
@@ -228,7 +227,7 @@ void Person::DoAnimations(int who)
bleeding = 1;
bleeddelay = 1;
bjoint1 = &head_joint;
- bjoint2 = joints + jointlabels[neck];
+ bjoint2 = joints + neck;
}
currentanimation = targetanimation;
@@ -247,8 +246,7 @@ void Person::DoAnimations(int who)
&& currentanimation == diveanim && targetframe == 0) {
targetanimation = getupfrontanim;
auto& joints = skeleton.joints;
- auto& jointlabels = skeleton.jointlabels;
- auto head_joint = joints[jointlabels[head]];
+ auto head_joint = joints[head];
auto soundsrc = (DoRotation(head_joint.position,
0, playerrotation, 0) + playercoords
- camera.position) / soundscalefactor;
@@ -360,8 +358,8 @@ void Person::DoAnimations(int who)
skeleton.joints[i].position = animation[rifleholdanim].position[i][0];
if (currentanimation == crouchanim
|| targetanimation == crouchanim)
- skeleton.joints[i].position += skeleton.joints[skeleton.jointlabels[neck]].position
- - animation[idleanim].position[skeleton.jointlabels[neck]][0];
+ skeleton.joints[i].position += skeleton.joints[neck].position
+ - animation[idleanim].position[neck][0];
}
}
@@ -381,7 +379,7 @@ void Person::DoAnimations(int who)
if(grenamount>0)grenamount-=multiplier*4;
if(grenamount<0)grenamount=0;
}
- rotatearound=skeleton.joints[skeleton.jointlabels[neck]].position;
+ rotatearound=skeleton.joints[neck].position;
for (int i = 0; i < max_joints; ++i){
if(skeleton.joints[i].label!=righthand&&skeleton.joints[i].label!=rightelbow&&skeleton.joints[i].label!=rightwrist&&skeleton.joints[i].label!=lefthand&&skeleton.joints[i].label!=leftelbow&&skeleton.joints[i].label!=leftwrist){
}else{
@@ -389,7 +387,7 @@ void Person::DoAnimations(int who)
oldpos=skeleton.joints[i].position;
skeleton.joints[i].position=animation[rifleaimanim].position[i][0];
if(currentanimation==crouchanim||targetanimation==crouchanim){
- skeleton.joints[i].position-=(animation[idleanim].position[skeleton.jointlabels[neck]][0]-skeleton.joints[skeleton.jointlabels[neck]].position);
+ skeleton.joints[i].position-=(animation[idleanim].position[neck][0]-skeleton.joints[neck].position);
}
skeleton.joints[i].position+=facingright*0.1;
skeleton.joints[i].position=rotatearound+DoRotation(skeleton.joints[i].position-rotatearound,(playerrotation2/2-10)*aimamount,0,0);
@@ -398,27 +396,27 @@ void Person::DoAnimations(int who)
if(whichgun==shotgun){
oldpos=skeleton.joints[i].position;
skeleton.joints[i].position=animation[assaultrifleaimanim].position[i][0];
- if(currentanimation==crouchanim||targetanimation==crouchanim)skeleton.joints[i].position-=(animation[idleanim].position[skeleton.jointlabels[neck]][0]-skeleton.joints[skeleton.jointlabels[neck]].position);
+ if(currentanimation==crouchanim||targetanimation==crouchanim)skeleton.joints[i].position-=(animation[idleanim].position[neck][0]-skeleton.joints[neck].position);
skeleton.joints[i].position=rotatearound+DoRotation(skeleton.joints[i].position-rotatearound,(playerrotation2/2)*aimamount,0,0);
if(currentanimation==crouchanim||targetanimation==crouchanim)skeleton.joints[i].position+=facingdown*.2;
else skeleton.joints[i].position-=facingdown*.02;
- if(skeleton.joints[i].label==righthand)skeleton.joints[i].position=skeleton.joints[skeleton.jointlabels[lefthand]].position-facinghalf*2;
+ if(skeleton.joints[i].label==righthand)skeleton.joints[i].position=skeleton.joints[lefthand].position-facinghalf*2;
skeleton.joints[i].position=skeleton.joints[i].position*(aimamount)+oldpos*(1-aimamount);
}
if(whichgun==assaultrifle){
oldpos=skeleton.joints[i].position;
skeleton.joints[i].position=animation[assaultrifleaimanim].position[i][0];
- if(currentanimation==crouchanim||targetanimation==crouchanim)skeleton.joints[i].position-=(animation[idleanim].position[skeleton.jointlabels[neck]][0]-skeleton.joints[skeleton.jointlabels[neck]].position);
+ if(currentanimation==crouchanim||targetanimation==crouchanim)skeleton.joints[i].position-=(animation[idleanim].position[neck][0]-skeleton.joints[neck].position);
skeleton.joints[i].position=rotatearound+DoRotation(skeleton.joints[i].position-rotatearound,(playerrotation2/2)*aimamount,0,0);
if(currentanimation==crouchanim||targetanimation==crouchanim)skeleton.joints[i].position+=facingdown*.2;
else skeleton.joints[i].position-=facingdown*.02;
- if(skeleton.joints[i].label==righthand)skeleton.joints[i].position=skeleton.joints[skeleton.jointlabels[lefthand]].position-facinghalf*2;
+ if(skeleton.joints[i].label==righthand)skeleton.joints[i].position=skeleton.joints[lefthand].position-facinghalf*2;
skeleton.joints[i].position=skeleton.joints[i].position*(aimamount)+oldpos*(1-aimamount);
}
if(whichgun==handgun1){
oldpos=skeleton.joints[i].position;
skeleton.joints[i].position=animation[pistolaimanim].position[i][0];
- if(currentanimation==crouchanim||targetanimation==crouchanim)skeleton.joints[i].position-=(animation[idleanim].position[skeleton.jointlabels[neck]][0]-skeleton.joints[skeleton.jointlabels[neck]].position);
+ if(currentanimation==crouchanim||targetanimation==crouchanim)skeleton.joints[i].position-=(animation[idleanim].position[neck][0]-skeleton.joints[neck].position);
skeleton.joints[i].position=rotatearound+DoRotation(skeleton.joints[i].position-rotatearound,(playerrotation2/2)*aimamount,0,0);
if(currentanimation==crouchanim||targetanimation==crouchanim){skeleton.joints[i].position+=facingright*.15;skeleton.joints[i].position+=facingdown*.3;}
else skeleton.joints[i].position-=facingdown*.1;
@@ -427,7 +425,7 @@ void Person::DoAnimations(int who)
if(whichgun==handgun2){
oldpos=skeleton.joints[i].position;
skeleton.joints[i].position=animation[pistolaimanim].position[i][0];
- if(currentanimation==crouchanim||targetanimation==crouchanim)skeleton.joints[i].position-=(animation[idleanim].position[skeleton.jointlabels[neck]][0]-skeleton.joints[skeleton.jointlabels[neck]].position);
+ if(currentanimation==crouchanim||targetanimation==crouchanim)skeleton.joints[i].position-=(animation[idleanim].position[neck][0]-skeleton.joints[neck].position);
skeleton.joints[i].position=rotatearound+DoRotation(skeleton.joints[i].position-rotatearound,(playerrotation2/2)*aimamount,0,0);
if(currentanimation==crouchanim||targetanimation==crouchanim){skeleton.joints[i].position+=facingright*.15;skeleton.joints[i].position+=facingdown*.3;}
else skeleton.joints[i].position-=facingdown*.1;
@@ -437,13 +435,13 @@ void Person::DoAnimations(int who)
aimamount=1;
oldpos=skeleton.joints[i].position;
skeleton.joints[i].position=animation[grenadeaimanim].position[i][0];
- if(currentanimation==crouchanim||targetanimation==crouchanim)skeleton.joints[i].position-=(animation[idleanim].position[skeleton.jointlabels[neck]][0]-skeleton.joints[skeleton.jointlabels[neck]].position);
+ if(currentanimation==crouchanim||targetanimation==crouchanim)skeleton.joints[i].position-=(animation[idleanim].position[neck][0]-skeleton.joints[neck].position);
skeleton.joints[i].position=skeleton.joints[i].position*(aimamount)+oldpos*(1-aimamount);
}
if(whichgun==grenade&&grenamount>0){
oldpos=skeleton.joints[i].position;
skeleton.joints[i].position=animation[grenadechargeanim].position[i][0];
- if(currentanimation==crouchanim||targetanimation==crouchanim)skeleton.joints[i].position-=(animation[idleanim].position[skeleton.jointlabels[neck]][0]-skeleton.joints[skeleton.jointlabels[neck]].position);
+ if(currentanimation==crouchanim||targetanimation==crouchanim)skeleton.joints[i].position-=(animation[idleanim].position[neck][0]-skeleton.joints[neck].position);
skeleton.joints[i].position=skeleton.joints[i].position*(grenamount)+oldpos*(1-grenamount);
}
if(thirdperson||who!=0)skeleton.joints[i].position+=facingdown*.4;
@@ -488,11 +486,11 @@ void Person::DoAnimations(int who)
}
if(attackframe==animation[grenadethrowanim].numframes-1&&ammo>0){
ammo=-1;
- sprites.MakeSprite(grenadesprite, 1, 1, 1, 1, DoRotation(skeleton.joints[skeleton.jointlabels[righthand]].position,0,playerrotation,0)+playercoords, DoRotation(facing,0,playerrotation,0)*30+velocity, 1);
- sprites.MakeSprite(spoonsprite, 1, 1, 1, 1, DoRotation(skeleton.joints[skeleton.jointlabels[righthand]].position,0,playerrotation,0)+playercoords, DoRotation(facing,0,playerrotation,0)*10+velocity, 1);
- sprites.MakeSprite(pinsprite, 1, 1, 1, 1, DoRotation(skeleton.joints[skeleton.jointlabels[lefthand]].position,0,playerrotation,0)+playercoords, facing*.1+velocity, 1);
+ sprites.MakeSprite(grenadesprite, 1, 1, 1, 1, DoRotation(skeleton.joints[righthand].position,0,playerrotation,0)+playercoords, DoRotation(facing,0,playerrotation,0)*30+velocity, 1);
+ sprites.MakeSprite(spoonsprite, 1, 1, 1, 1, DoRotation(skeleton.joints[righthand].position,0,playerrotation,0)+playercoords, DoRotation(facing,0,playerrotation,0)*10+velocity, 1);
+ sprites.MakeSprite(pinsprite, 1, 1, 1, 1, DoRotation(skeleton.joints[lefthand].position,0,playerrotation,0)+playercoords, facing*.1+velocity, 1);
- XYZ soundsrc = (DoRotation(skeleton.joints[skeleton.jointlabels[righthand]].position, 0, playerrotation, 0)
+ XYZ soundsrc = (DoRotation(skeleton.joints[righthand].position, 0, playerrotation, 0)
+ playercoords - camera.position) / soundscalefactor;
ALfloat gLoc[] {soundsrc.x, soundsrc.y, soundsrc.z};
alSourcefv(gSourceID[grenadethrowsound], AL_POSITION, gLoc);
@@ -501,7 +499,7 @@ void Person::DoAnimations(int who)
}
}
- rotatearound=skeleton.joints[skeleton.jointlabels[abdomen]].position;
+ rotatearound=skeleton.joints[abdomen].position;
if (who == 0) {
for (auto& joint : skeleton.joints)
if (!joint.lower)
@@ -509,9 +507,9 @@ void Person::DoAnimations(int who)
+ DoRotation(joint.position - rotatearound, playerrotation2 / 2, 0, 0);
else if (joint.label != groin)
joint.position = DoRotation(joint.position, 0, playerlowrotation - playerrotation, 0);
- rotatearound = skeleton.joints[skeleton.jointlabels[neck]].position;
- skeleton.joints[skeleton.jointlabels[head]].position = rotatearound
- + DoRotation(skeleton.joints[skeleton.jointlabels[head]].position - rotatearound, playerrotation2 / 2, 0, 0);
+ rotatearound = skeleton.joints[neck].position;
+ skeleton.joints[head].position = rotatearound
+ + DoRotation(skeleton.joints[head].position - rotatearound, playerrotation2 / 2, 0, 0);
}
skeleton.DoConstraints();
@@ -582,8 +580,7 @@ void Person::DoAnimationslite(int who)
if (targetanimation == zombieeatanim && targetframe == 3) {
auto& joints = skeleton.joints;
- auto& jointlabels = skeleton.jointlabels;
- auto head_joint = joints[jointlabels[head]];
+ auto head_joint = joints[head];
auto soundsrc = (DoRotation(head_joint.position,
0, playerrotation, 0) + playercoords
- camera.position) / soundscalefactor;
@@ -592,7 +589,7 @@ void Person::DoAnimationslite(int who)
bleeding = 1;
bleeddelay = 1;
bjoint1 = &head_joint;
- bjoint2 = joints + jointlabels[neck];
+ bjoint2 = joints + neck;
}
currentanimation = targetanimation;
@@ -830,12 +827,10 @@ void draw_muscle(Muscle& mus, int who, int whichcostume)
int Person::DrawSkeleton(int who)
{
- auto& left_hand = skeleton.jointlabels[lefthand];
- auto& left_wrist = skeleton.joints[left_hand].position;
- auto& right_hand = skeleton.jointlabels[righthand];
- auto& right_wrist = skeleton.joints[right_hand].position;
- auto& head_pos = skeleton.joints[skeleton.jointlabels[head]].position;
- auto& neck_pos = skeleton.joints[skeleton.jointlabels[neck]].position;
+ auto& left_wrist = skeleton.joints[lefthand].position;
+ auto& right_wrist = skeleton.joints[righthand].position;
+ auto& head_pos = skeleton.joints[head].position;
+ auto& neck_pos = skeleton.joints[neck].position;
switch (whichgun) {
case sniperrifle:
@@ -920,7 +915,7 @@ int Person::DrawSkeleton(int who)
glPopMatrix();
break;
case knife:
- auto& wrist = skeleton.joints[skeleton.jointlabels[righthand]];
+ auto& wrist = skeleton.joints[righthand];
glPushMatrix();
glTranslatef(wrist.position.x,
wrist.position.y, wrist.position.z);
@@ -936,8 +931,7 @@ int Person::DrawSkeleton(int who)
if (litup) {
GLfloat LightAmbient[] {0, 0, 0, 1.0f};
GLfloat LightDiffuse[] {1, 1, 1, 1.0f};
- auto& hand = skeleton.jointlabels[lefthand];
- XYZ lightpoint = skeleton.joints[hand].position;
+ XYZ lightpoint = skeleton.joints[lefthand].position;
GLfloat LightPosition[] {lightpoint.x,
lightpoint.y, lightpoint.z, 0};
glLightfv(GL_LIGHT1, GL_POSITION, LightPosition);
@@ -994,17 +988,13 @@ int Person::DrawSkeleton(int who)
auto specialfwd = skeleton.specialforward;
*specialfwd++ = skeleton.forward;
- auto& right_shoulder = skeleton.jointlabels[rightshoulder];
- auto& right_elbow = skeleton.jointlabels[rightelbow];
- *specialfwd = skeleton.joints[right_elbow].position
- - skeleton.joints[right_shoulder].position / 2
+ *specialfwd = skeleton.joints[rightelbow].position
+ - skeleton.joints[rightshoulder].position / 2
- right_wrist / 2 + skeleton.forward * 0.2;
Normalise(specialfwd++);
- auto& left_shoulder = skeleton.jointlabels[leftshoulder];
- auto& left_elbow = skeleton.jointlabels[leftelbow];
- *specialfwd = skeleton.joints[left_elbow].position
- - skeleton.joints[left_shoulder].position / 2
+ *specialfwd = skeleton.joints[leftelbow].position
+ - skeleton.joints[leftshoulder].position / 2
- left_wrist / 2 + skeleton.forward * 0.2;
Normalise(specialfwd++);
@@ -1022,21 +1012,15 @@ int Person::DrawSkeleton(int who)
skeleton.specialforward[2] += facingdown * aimamount;
}
- auto& right_hip = skeleton.jointlabels[righthip];
- auto& right_ankle = skeleton.jointlabels[rightankle];
- auto& right_knee = skeleton.jointlabels[rightknee];
- *specialfwd = skeleton.joints[right_hip].position / 2
- + skeleton.joints[right_ankle].position / 2
- - skeleton.joints[right_knee].position
+ *specialfwd = skeleton.joints[righthip].position / 2
+ + skeleton.joints[rightankle].position / 2
+ - skeleton.joints[rightknee].position
+ skeleton.lowforward * 0.2;
Normalise(specialfwd++);
- auto& left_hip = skeleton.jointlabels[lefthip];
- auto& left_ankle = skeleton.jointlabels[leftankle];
- auto& left_knee = skeleton.jointlabels[leftknee];
- *specialfwd = skeleton.joints[left_hip].position / 2
- + skeleton.joints[left_ankle].position / 2
- - skeleton.joints[left_knee].position
+ *specialfwd = skeleton.joints[lefthip].position / 2
+ + skeleton.joints[leftankle].position / 2
+ - skeleton.joints[leftknee].position
+ skeleton.lowforward * 0.2;
Normalise(specialfwd++);
diff --git a/src/Skeleton.cpp b/src/Skeleton.cpp
index 6aa3508..58f6035 100644
--- a/src/Skeleton.cpp
+++ b/src/Skeleton.cpp
@@ -98,9 +98,7 @@ void Skeleton::DoConstraints(Model *collide, XYZ *move, float rotation)
numrepeats = 2;
for (int j = 0; j < numrepeats; j++) {
for (int i = 0; i < max_joints; i++) {
- if (!joints[i].existing
- && i != jointlabels[lefthand]
- && i != jointlabels[righthand])
+ if (!joints[i].existing && i != lefthand && i != righthand)
continue;
// Length constraints
@@ -181,9 +179,7 @@ void Skeleton::DoConstraints(Model *collide, XYZ *move, float rotation)
for (int i = 0; i < max_joints; i++) {
joints[i].realoldposition = joints[i].position;
//Add velocity
- if (joints[i].existing
- || i == jointlabels[lefthand]
- || i == jointlabels[righthand])
+ if (joints[i].existing || i == lefthand || i == righthand)
joints[i].position += joints[i].velocity * multiplier;
}
}
@@ -420,21 +416,21 @@ void Animation::load(const char* name)
//Special forwards
testskeleton.specialforward[0]=testskeleton.forward;
- testskeleton.specialforward[1]=testskeleton.joints[testskeleton.jointlabels[rightshoulder]].position+testskeleton.joints[testskeleton.jointlabels[rightwrist]].position;
- testskeleton.specialforward[1]=testskeleton.joints[testskeleton.jointlabels[rightelbow]].position-testskeleton.specialforward[1]/2;
+ testskeleton.specialforward[1]=testskeleton.joints[rightshoulder].position+testskeleton.joints[rightwrist].position;
+ testskeleton.specialforward[1]=testskeleton.joints[rightelbow].position-testskeleton.specialforward[1]/2;
testskeleton.specialforward[1]+=testskeleton.forward*.2;
Normalise(&testskeleton.specialforward[1]);
- testskeleton.specialforward[2]=testskeleton.joints[testskeleton.jointlabels[leftshoulder]].position+testskeleton.joints[testskeleton.jointlabels[leftwrist]].position;
- testskeleton.specialforward[2]=testskeleton.joints[testskeleton.jointlabels[leftelbow]].position-testskeleton.specialforward[2]/2;
+ testskeleton.specialforward[2]=testskeleton.joints[leftshoulder].position+testskeleton.joints[leftwrist].position;
+ testskeleton.specialforward[2]=testskeleton.joints[leftelbow].position-testskeleton.specialforward[2]/2;
testskeleton.specialforward[2]+=testskeleton.forward*.2;
Normalise(&testskeleton.specialforward[2]);
- testskeleton.specialforward[3]=testskeleton.joints[testskeleton.jointlabels[righthip]].position+testskeleton.joints[testskeleton.jointlabels[rightankle]].position;
- testskeleton.specialforward[3]=testskeleton.specialforward[3]/2-testskeleton.joints[testskeleton.jointlabels[rightknee]].position;
+ testskeleton.specialforward[3]=testskeleton.joints[righthip].position+testskeleton.joints[rightankle].position;
+ testskeleton.specialforward[3]=testskeleton.specialforward[3]/2-testskeleton.joints[rightknee].position;
testskeleton.specialforward[3]+=testskeleton.lowforward*.2;
Normalise(&testskeleton.specialforward[3]);
- testskeleton.specialforward[4]=testskeleton.joints[testskeleton.jointlabels[lefthip]].position+testskeleton.joints[testskeleton.jointlabels[leftankle]].position;
- testskeleton.specialforward[4]=testskeleton.specialforward[4]/2-testskeleton.joints[testskeleton.jointlabels[leftknee]].position;
+ testskeleton.specialforward[4]=testskeleton.joints[lefthip].position+testskeleton.joints[leftankle].position;
+ testskeleton.specialforward[4]=testskeleton.specialforward[4]/2-testskeleton.joints[leftknee].position;
testskeleton.specialforward[4]+=testskeleton.lowforward*.2;
Normalise(&testskeleton.specialforward[4]);
@@ -513,7 +509,7 @@ void Skeleton::reload()
JointData joints_data[max_joints];
loadJoints(joints_data);
for (int i = 0; i < max_joints; ++i) {
- joints[i].label = joints_data[i].label;
+ joints[i].label = i;
joints[i].position.x = joints_data[i].x;
joints[i].position.y = joints_data[i].y;
joints[i].position.z = joints_data[i].z;
@@ -534,7 +530,6 @@ void Skeleton::reload()
joints[i].locked = false;
joints[i].velocity = 0;
joints[i].oldposition = joints[i].position;
- jointlabels[joints[i].label] = i;
}
forwardjoints[0] = 7;
diff --git a/src/Skeleton.h b/src/Skeleton.h
index c8c41df..487c3c8 100644
--- a/src/Skeleton.h
+++ b/src/Skeleton.h
@@ -101,7 +101,6 @@ class Skeleton
{
public:
Joint joints[max_joints];
- int jointlabels[max_joints];
Muscle muscles[max_muscles];
int num_muscles;
diff --git a/src/misc.h b/src/misc.h
index 7a377f6..36880ff 100644
--- a/src/misc.h
+++ b/src/misc.h
@@ -16,7 +16,6 @@ struct AnimationData {
};
struct JointData {
- signed char label;
float x, y, z;
float length;
unsigned char model;
diff --git a/src/misc.zig b/src/misc.zig
index 359c914..f61fc2d 100644
--- a/src/misc.zig
+++ b/src/misc.zig
@@ -119,7 +119,6 @@ pub fn parseBool(s: []const u8) !bool {
}
const Joint = extern struct {
- label: i8,
x: f32,
y: f32,
z: f32,
@@ -131,7 +130,6 @@ const Joint = extern struct {
pub fn load(self: *Joint, row: []const u8) !void {
var values = tokenize(row, "\t");
- self.label = try parseInt(i8, values.next().?, 10);
self.x = try parseFloat(f32, values.next().?);
self.y = try parseFloat(f32, values.next().?);
self.z = try parseFloat(f32, values.next().?);