aboutsummaryrefslogtreecommitdiff
path: root/src/Person.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'src/Person.cpp')
-rw-r--r--src/Person.cpp52
1 files changed, 30 insertions, 22 deletions
diff --git a/src/Person.cpp b/src/Person.cpp
index 1c5ce32..65eb002 100644
--- a/src/Person.cpp
+++ b/src/Person.cpp
@@ -740,15 +740,25 @@ void Person::FindRotationGun(XYZ start, XYZ target)
if(0>tempforward.x)gunrotate3=360-gunrotate3;
}
-float* determine_color(int model, int who, int whichcostume)
+const float EVIL_VISUAL[3] = {1.0f, 0.0f, 0.0f};
+const float VIP_VISUAL[3] = {0.0f, 0.0f, 1.0f};
+const float OTHER_VISUAL[3] = {0.0f, 0.0f, 0.0f};
+
+const float* determine_color(int model, enum PersonType type, int whichcostume)
{
+ if (visions)
+ switch (type) {
+ case eviltype: return EVIL_VISUAL;
+ case viptype: return VIP_VISUAL;
+ default: return OTHER_VISUAL;
+ }
switch (model) {
case 0:
- if (who != 0 || thirdperson)
+ if (type != playertype || thirdperson)
return costume[whichcostume].headcolor;
break;
case 1:
- if (who != 0 || thirdperson)
+ if (type != playertype || thirdperson)
return costume[whichcostume].chestcolor;
break;
case 2:
@@ -769,7 +779,7 @@ float* determine_color(int model, int who, int whichcostume)
return nullptr;
}
-void draw_joint(Joint& joint, int who, int whichcostume)
+void draw_joint(Joint& joint, enum PersonType type, int whichcostume)
{
if (!joint.hasparent || !joint.visible)
return;
@@ -783,14 +793,14 @@ void draw_joint(Joint& joint, int who, int whichcostume)
glRotatef(-joint.rotate3, 0, 1, 0);
auto& model = joint.modelnum;
- if (auto color = determine_color(model, who, whichcostume))
- skeletonmodels[model].draw(*color, color[1], color[2]);
- if (model == 0 && who == 0 && thirdperson)
- skeletonmodels[9].draw();
+ if (auto color = determine_color(model, type, whichcostume))
+ skeletonmodels[model].draw(color[0], color[1], color[2]);
+ if (model == 0 && type == playertype && thirdperson)
+ skeletonmodels[9].draw(); // black shades
glPopMatrix();
}
-void draw_muscle(Muscle& mus, int who, int whichcostume)
+void draw_muscle(Muscle& mus, enum PersonType type, int whichcostume)
{
if (!mus.visible)
return;
@@ -805,14 +815,12 @@ void draw_muscle(Muscle& mus, int who, int whichcostume)
glRotatef(-mus.rotate3, 0, 1, 0);
auto& model = mus.parent1->modelnum;
- if (auto color = determine_color(model, who, whichcostume))
- skeletonmodels[model].draw(*color, color[1], color[2]);
- if (model == 0 && who == 0 && thirdperson)
- skeletonmodels[9].draw();
+ if (auto color = determine_color(model, type, whichcostume))
+ skeletonmodels[model].draw(color[0], color[1], color[2]);
glPopMatrix();
}
-int Person::DrawSkeleton(int who)
+int Person::drawSkeleton()
{
auto& left_wrist = skeleton.joints[lefthand].position;
auto& right_wrist = skeleton.joints[righthand].position;
@@ -854,7 +862,7 @@ int Person::DrawSkeleton(int who)
break;
case handgun1:
case handgun2:
- if (who || thirdperson)
+ if (this->type != playertype || thirdperson)
FindRotationGun(right_wrist,
head_pos * 0.35 + neck_pos * 0.65);
else
@@ -930,9 +938,9 @@ int Person::DrawSkeleton(int who)
glDisable(GL_LIGHT1);
}
- //Find forward vectors
- if (!who || skeleton.free || skeleton.offset || whichgun != nogun
- || currentanimation == lyinganim
+ // Find forward vectors
+ if (this->type == playertype || skeleton.free || skeleton.offset
+ || whichgun != nogun || currentanimation == lyinganim
|| ((currentanimation == getupfrontanim
|| currentanimation == getupbackanim)
&& targetanimation == idleanim)) {
@@ -980,8 +988,8 @@ int Person::DrawSkeleton(int who)
- left_wrist / 2 + skeleton.forward * 0.2);
specialfwd++;
- if(!who && aimamount > 0
- && health == 100 && whichgun != nogun) {
+ if (this->type != playertype && aimamount > 0
+ && health == 100 && whichgun != nogun) {
//Facing
XYZ facing {0};
facing.z = 1;
@@ -1018,9 +1026,9 @@ int Person::DrawSkeleton(int who)
}
for (int i = 0; i < max_joints; i++)
- draw_joint(skeleton.joints[i], who, whichcostume);
+ draw_joint(skeleton.joints[i], this->type, whichcostume);
for (int i = 0; i < skeleton.num_muscles; i++)
- draw_muscle(skeleton.muscles[i], who, whichcostume);
+ draw_muscle(skeleton.muscles[i], this->type, whichcostume);
if (skeleton.offset && skeleton.free < 1)
for (auto& joint : skeleton.joints)