extern bool cellophane;
extern float texdetail;
extern float realtexdetail;
-extern GLubyte bloodText[512 * 512 * 3];
-extern GLubyte wolfbloodText[512 * 512 * 3];
extern int bloodtoggle;
extern bool autoslomo;
extern float camerashake;
, oldcoords()
, coords()
, velocity()
- ,
-
- proportionhead()
- , proportionlegs()
- , proportionarms()
- , proportionbody()
- ,
- unconscioustime(0)
- ,
+ , unconscioustime(0)
- immobile(false)
- ,
+ , immobile(false)
- velspeed(0)
+ , velspeed(0)
, targetyaw(0)
, targetrot(0)
, rot(0)
jumpclimb(false)
{
+ setProportions(1, 1, 1, 1);
}
/* Read a person in tfile. Throws an error if it’s not valid */
funpackf(tfile, "Bf Bf Bf", &metalhead, &metalhigh, &metallow);
funpackf(tfile, "Bf Bf", &power, &speedmult);
- float headprop, legprop, armprop, bodyprop;
-
if (mapvers >= 4) {
- funpackf(tfile, "Bf Bf Bf Bf", &headprop, &bodyprop, &armprop, &legprop);
+ funpackf(tfile, "Bf Bf Bf Bf", &proportions[0], &proportions[1], &proportions[2], &proportions[3]);
} else {
- headprop = 1;
- bodyprop = 1;
- armprop = 1;
- legprop = 1;
- }
-
- if (creature == wolftype) {
- proportionhead = 1.1 * headprop;
- proportionbody = 1.1 * bodyprop;
- proportionarms = 1.1 * armprop;
- proportionlegs = 1.1 * legprop;
- } else if (creature == rabbittype) {
- proportionhead = 1.2 * headprop;
- proportionbody = 1.05 * bodyprop;
- proportionarms = 1.00 * armprop;
- proportionlegs = 1.1 * legprop;
- proportionlegs.y = 1.05 * legprop;
+ setProportions(1, 1, 1, 1);
}
funpackf(tfile, "Bi", &numclothes);
loaded = true;
+ if (creature == wolftype) {
+ damagetolerance = 300;
+ }
+
if (scale < 0) {
if (creature == wolftype) {
scale = .23;
- damagetolerance = 300;
} else {
scale = .2;
}
void Person::skeletonLoad(bool clothes)
{
skeleton.id = id;
- if (creature != wolftype) {
- skeleton.Load(
- "Skeleton/BasicFigure",
- "Skeleton/BasicFigureLow",
- "Skeleton/RabbitBelt",
- "Models/Body.solid",
- "Models/Body2.solid",
- "Models/Body3.solid",
- "Models/Body4.solid",
- "Models/Body5.solid",
- "Models/Body6.solid",
- "Models/Body7.solid",
- "Models/BodyLow.solid",
- "Models/Belt.solid",
- clothes);
- } else {
- skeleton.Load(
- "Skeleton/BasicFigureWolf",
- "Skeleton/BasicFigureWolfLow",
- "Skeleton/RabbitBelt",
- "Models/Wolf.solid",
- "Models/Wolf2.solid",
- "Models/Wolf3.solid",
- "Models/Wolf4.solid",
- "Models/Wolf5.solid",
- "Models/Wolf6.solid",
- "Models/Wolf7.solid",
- "Models/WolfLow.solid",
- "Models/Belt.solid",
- clothes);
- }
-
- skeleton.drawmodel.textureptr.load(creatureskin[creature][whichskin], 1, &skeleton.skinText[0], &skeleton.skinsize);
+ skeleton.Load(
+ PersonType::types[creature].figureFileName,
+ PersonType::types[creature].lowFigureFileName,
+ PersonType::types[creature].clothesFileName,
+ PersonType::types[creature].modelFileNames[0],
+ PersonType::types[creature].modelFileNames[1],
+ PersonType::types[creature].modelFileNames[2],
+ PersonType::types[creature].modelFileNames[3],
+ PersonType::types[creature].modelFileNames[4],
+ PersonType::types[creature].modelFileNames[5],
+ PersonType::types[creature].modelFileNames[6],
+ PersonType::types[creature].lowModelFileName,
+ PersonType::types[creature].modelClothesFileName,
+ clothes);
+
+ skeleton.drawmodel.textureptr.load(PersonType::types[creature].skins[whichskin], 1, &skeleton.skinText[0], &skeleton.skinsize);
+}
+
+void Person::setProportions(float head, float body, float arms, float legs)
+{
+ proportions[0] = head;
+ proportions[1] = body;
+ proportions[2] = arms;
+ proportions[3] = legs;
+}
+
+XYZ Person::getProportion(int part) const
+{
+ XYZ prop = PersonType::types[creature].proportions[part] * proportions[part];
+ if (cellophane) {
+ prop.z = 0;
+ }
+ return prop;
}
/* EFFECT
/* EFFECT
*
* USES:
- * GameTick/doPlayerCollisions - spread fire between players
- * GameTick/doDevKeys - press f to ignite
+ * GameTick::doPlayerCollisions - spread fire between players
+ * GameTick::ProcessDevKeys - press f to ignite
* Person::DoStuff - spread fire from lit campfires and bushes
*/
void Person::CatchFire()
*/
int Person::getIdle()
{
- if (Dialog::inDialog() && (howactive == typeactive) && (creature == rabbittype)) {
- return talkidleanim;
+ if (Dialog::inDialog() && (howactive == typeactive) && PersonType::types[creature].hasAnimTalkIdle()) {
+ return PersonType::types[creature].animTalkIdle;
}
if (hasvictim && (victim != this->shared_from_this())) {
if ((!victim->dead && victim->aitype != passivetype &&
victim->aitype != searchtype && aitype != passivetype && aitype != searchtype &&
victim->id < Person::players.size())) {
if ((aitype == playercontrolled && stunned <= 0 && weaponactive == -1) || pause) {
- if (creature == rabbittype) {
- return fightidleanim;
- }
- if (creature == wolftype) {
- return wolfidle;
- }
+ return PersonType::types[creature].animFightIdle;
}
if (aitype == playercontrolled && stunned <= 0 && weaponactive != -1) {
if (weapons[weaponids[weaponactive]].getType() == knife) {
if (howactive == typedead4) {
return dead4anim;
}
- if (creature == rabbittype) {
- return bounceidleanim;
- }
- if (creature == wolftype) {
- return wolfidle;
- }
- return 0;
+ return PersonType::types[creature].animBounceIdle;
}
/* FUNCTION
*/
int Person::getCrouch()
{
- if (creature == rabbittype) {
- return crouchanim;
- }
- if (creature == wolftype) {
- return wolfcrouchanim;
- }
- return 0;
+ return PersonType::types[creature].animCrouch;
}
/* FUNCTION
*/
int Person::getRun()
{
- if (creature == rabbittype && (!superruntoggle || weaponactive != -1)) {
- return runanim;
- }
- if (creature == wolftype && (!superruntoggle)) {
- return wolfrunanim;
- }
-
- if (creature == rabbittype && (superruntoggle && weaponactive == -1)) {
- return rabbitrunninganim;
- }
- if (creature == wolftype && (superruntoggle)) {
- return wolfrunninganim;
+ if (superruntoggle && (weaponactive == -1)) {
+ return PersonType::types[creature].animRunning;
+ } else {
+ return PersonType::types[creature].animRun;
}
- return 0;
}
/* FUNCTION
*/
int Person::getStop()
{
- if (creature == rabbittype) {
- return stopanim;
- }
- if (creature == wolftype) {
- return wolfstopanim;
- }
- return 0;
+ return PersonType::types[creature].animStop;
}
/* FUNCTION
*/
int Person::getLanding()
{
- if (creature == rabbittype) {
- return landanim;
- }
- if (creature == wolftype) {
- return wolflandanim;
- }
- return 0;
+ return PersonType::types[creature].animLanding;
}
/* FUNCTION
*/
int Person::getLandhard()
{
- if (creature == rabbittype) {
- return landhardanim;
- }
- if (creature == wolftype) {
- return wolflandhardanim;
- }
- return 0;
+ return PersonType::types[creature].animLandingHard;
}
/* EFFECT
bleeding = howmuch + (float)abs(Random() % 100) / 200 - .25;
bleedxint = 0;
bleedyint = 0;
- if (creature == rabbittype) {
- while (bloodText[bleedxint * 512 * 3 + bleedyint * 3 + 0] > which + 4 || bloodText[bleedxint * 512 * 3 + bleedyint * 3 + 0] < which - 4 || bleedxint < 10 || bleedyint < 10 || bleedxint > 500 || bleedyint > 500) {
- bleedxint = abs(Random() % 512);
- bleedyint = abs(Random() % 512);
- }
- }
- if (creature == wolftype) {
- while (wolfbloodText[bleedxint * 512 * 3 + bleedyint * 3 + 0] > which + 4 || wolfbloodText[bleedxint * 512 * 3 + bleedyint * 3 + 0] < which - 4 || bleedxint < 10 || bleedyint < 10 || bleedxint > 500 || bleedyint > 500) {
- bleedxint = abs(Random() % 512);
- bleedyint = abs(Random() % 512);
- }
+ while (PersonType::types[creature].bloodText[bleedxint * 512 * 3 + bleedyint * 3 + 0] > which + 4 || PersonType::types[creature].bloodText[bleedxint * 512 * 3 + bleedyint * 3 + 0] < which - 4 || bleedxint < 10 || bleedyint < 10 || bleedxint > 500 || bleedyint > 500) {
+ bleedxint = abs(Random() % 512);
+ bleedyint = abs(Random() % 512);
}
bleedy = bleedxint;
bleedx = bleedyint;
int endx = 0;
int endy = 0;
GLubyte color;
- if (creature == rabbittype) {
- for (i = 0; i < 512; i++) {
- for (j = 0; j < 512; j++) {
- if (bloodText[i * 512 * 3 + j * 3 + 0] <= which + 4 && bloodText[i * 512 * 3 + j * 3 + 0] >= which - 4) {
- if (i < startx) {
- startx = i;
- }
- if (j < starty) {
- starty = j;
- }
- if (i > endx) {
- endx = i;
- }
- if (j > endy) {
- endy = j;
- }
+ for (i = 0; i < 512; i++) {
+ for (j = 0; j < 512; j++) {
+ if (PersonType::types[creature].bloodText[i * 512 * 3 + j * 3 + 0] <= which + 4 && PersonType::types[creature].bloodText[i * 512 * 3 + j * 3 + 0] >= which - 4) {
+ if (i < startx) {
+ startx = i;
}
- }
- }
- }
- if (creature == wolftype) {
- for (i = 0; i < 512; i++) {
- for (j = 0; j < 512; j++) {
- if (wolfbloodText[i * 512 * 3 + j * 3 + 0] <= which + 4 && wolfbloodText[i * 512 * 3 + j * 3 + 0] >= which - 4) {
- if (i < startx) {
- startx = i;
- }
- if (j < starty) {
- starty = j;
- }
- if (i > endx) {
- endx = i;
- }
- if (j > endy) {
- endy = j;
- }
+ if (j < starty) {
+ starty = j;
+ }
+ if (i > endx) {
+ endx = i;
+ }
+ if (j > endy) {
+ endy = j;
}
}
}
int texdetailint = realtexdetail;
int where;
- if (creature == rabbittype) {
- for (i = startx; i < endx; i++) {
- for (j = starty; j < endy; j++) {
- if (bloodText[(i * texdetailint - offsetx) * 512 * 3 + (j * texdetailint - offsety) * 3 + 0] <= which + 4 && bloodText[(i * texdetailint - offsetx) * 512 * 3 + (j * texdetailint - offsety) * 3 + 0] >= which - 4) {
- color = Random() % 85 + 170;
- where = i * skeleton.skinsize * 3 + j * 3;
- if (skeleton.skinText[where + 0] > color / 2) {
- skeleton.skinText[where + 0] = color / 2;
- }
- skeleton.skinText[where + 1] = 0;
- skeleton.skinText[where + 2] = 0;
- }
- }
- }
- }
- if (creature == wolftype) {
- for (i = startx; i < endx; i++) {
- for (j = starty; j < endy; j++) {
- if (wolfbloodText[(i * texdetailint - offsetx) * 512 * 3 + (j * texdetailint - offsety) * 3 + 0] <= which + 4 && wolfbloodText[(i * texdetailint - offsetx) * 512 * 3 + (j * texdetailint - offsety) * 3 + 0] >= which - 4) {
- color = Random() % 85 + 170;
- where = i * skeleton.skinsize * 3 + j * 3;
- if (skeleton.skinText[where + 0] > color / 2) {
- skeleton.skinText[where + 0] = color / 2;
- }
- skeleton.skinText[where + 1] = 0;
- skeleton.skinText[where + 2] = 0;
+ for (i = startx; i < endx; i++) {
+ for (j = starty; j < endy; j++) {
+ if (PersonType::types[creature].bloodText[(i * texdetailint - offsetx) * 512 * 3 + (j * texdetailint - offsety) * 3 + 0] <= which + 4 && PersonType::types[creature].bloodText[(i * texdetailint - offsetx) * 512 * 3 + (j * texdetailint - offsety) * 3 + 0] >= which - 4) {
+ color = Random() % 85 + 170;
+ where = i * skeleton.skinsize * 3 + j * 3;
+ if (skeleton.skinText[where + 0] > color / 2) {
+ skeleton.skinText[where + 0] = color / 2;
}
+ skeleton.skinText[where + 1] = 0;
+ skeleton.skinText[where + 2] = 0;
}
}
}
bleedxint = 0;
bleedyint = 0;
- if (creature == rabbittype) {
- while (bloodText[bleedxint * 512 * 3 + bleedyint * 3 + 0] > which + 4 || bloodText[bleedxint * 512 * 3 + bleedyint * 3 + 0] < which - 4 || bleedxint < 10 || bleedyint < 10 || bleedxint > 500 || bleedyint > 500) {
- bleedxint = abs(Random() % 512);
- bleedyint = abs(Random() % 512);
- }
- }
- if (creature == wolftype) {
- while (wolfbloodText[bleedxint * 512 * 3 + bleedyint * 3 + 0] > which + 4 || wolfbloodText[bleedxint * 512 * 3 + bleedyint * 3 + 0] < which - 4 || bleedxint < 10 || bleedyint < 10 || bleedxint > 500 || bleedyint > 500) {
- bleedxint = abs(Random() % 512);
- bleedyint = abs(Random() % 512);
- }
+ while (PersonType::types[creature].bloodText[bleedxint * 512 * 3 + bleedyint * 3 + 0] > which + 4 || PersonType::types[creature].bloodText[bleedxint * 512 * 3 + bleedyint * 3 + 0] < which - 4 || bleedxint < 10 || bleedyint < 10 || bleedxint > 500 || bleedyint > 500) {
+ bleedxint = abs(Random() % 512);
+ bleedyint = abs(Random() % 512);
}
bleedy = bleedxint + offsetx;
bleedx = bleedyint + offsety;
int endx = 0;
int endy = 0;
GLubyte color;
- if (creature == rabbittype) {
- for (i = 0; i < 512; i++) {
- for (j = 0; j < 512; j++) {
- if (bloodText[i * 512 * 3 + j * 3 + 0] <= which + 4 && bloodText[i * 512 * 3 + j * 3 + 0] >= which - 4) {
- if (i < startx) {
- startx = i;
- }
- if (j < starty) {
- starty = j;
- }
- if (i > endx) {
- endx = i;
- }
- if (j > endy) {
- endy = j;
- }
+ for (i = 0; i < 512; i++) {
+ for (j = 0; j < 512; j++) {
+ if (PersonType::types[creature].bloodText[i * 512 * 3 + j * 3 + 0] <= which + 4 && PersonType::types[creature].bloodText[i * 512 * 3 + j * 3 + 0] >= which - 4) {
+ if (i < startx) {
+ startx = i;
}
- }
- }
- }
- if (creature == wolftype) {
- for (i = 0; i < 512; i++) {
- for (j = 0; j < 512; j++) {
- if (wolfbloodText[i * 512 * 3 + j * 3 + 0] <= which + 4 && wolfbloodText[i * 512 * 3 + j * 3 + 0] >= which - 4) {
- if (i < startx) {
- startx = i;
- }
- if (j < starty) {
- starty = j;
- }
- if (i > endx) {
- endx = i;
- }
- if (j > endy) {
- endy = j;
- }
+ if (j < starty) {
+ starty = j;
+ }
+ if (i > endx) {
+ endx = i;
+ }
+ if (j > endy) {
+ endy = j;
}
}
}
int texdetailint = realtexdetail;
int where;
- if (creature == rabbittype) {
- for (i = startx; i < endx; i++) {
- for (j = starty; j < endy; j++) {
- if (bloodText[(i * texdetailint - offsetx) * 512 * 3 + (j * texdetailint - offsety) * 3 + 0] <= which + 4 && bloodText[(i * texdetailint - offsetx) * 512 * 3 + (j * texdetailint - offsety) * 3 + 0] >= which - 4) {
- color = Random() % 85 + 170;
- where = i * skeleton.skinsize * 3 + j * 3;
- if (skeleton.skinText[where + 0] > color / 2) {
- skeleton.skinText[where + 0] = color / 2;
- }
- skeleton.skinText[where + 1] = 0;
- skeleton.skinText[where + 2] = 0;
- } else if (bloodText[(i * texdetailint - offsetx) * 512 * 3 + (j * texdetailint - offsety) * 3 + 0] <= 160 + 4 && bloodText[(i * texdetailint - offsetx) * 512 * 3 + (j * texdetailint - offsety) * 3 + 0] >= 160 - 4) {
- color = Random() % 85 + 170;
- where = i * skeleton.skinsize * 3 + j * 3;
- if (skeleton.skinText[where + 0] > color / 2) {
- skeleton.skinText[where + 0] = color / 2;
- }
- skeleton.skinText[where + 1] = 0;
- skeleton.skinText[where + 2] = 0;
+ for (i = startx; i < endx; i++) {
+ for (j = starty; j < endy; j++) {
+ if (PersonType::types[creature].bloodText[(i * texdetailint - offsetx) * 512 * 3 + (j * texdetailint - offsety) * 3 + 0] <= which + 4 && PersonType::types[creature].bloodText[(i * texdetailint - offsetx) * 512 * 3 + (j * texdetailint - offsety) * 3 + 0] >= which - 4) {
+ color = Random() % 85 + 170;
+ where = i * skeleton.skinsize * 3 + j * 3;
+ if (skeleton.skinText[where + 0] > color / 2) {
+ skeleton.skinText[where + 0] = color / 2;
}
- }
- }
- }
- if (creature == wolftype) {
- for (i = startx; i < endx; i++) {
- for (j = starty; j < endy; j++) {
- if (wolfbloodText[(i * texdetailint - offsetx) * 512 * 3 + (j * texdetailint - offsety) * 3 + 0] <= which + 4 && wolfbloodText[(i * texdetailint - offsetx) * 512 * 3 + (j * texdetailint - offsety) * 3 + 0] >= which - 4) {
- color = Random() % 85 + 170;
- where = i * skeleton.skinsize * 3 + j * 3;
- if (skeleton.skinText[where + 0] > color / 2) {
- skeleton.skinText[where + 0] = color / 2;
- }
- skeleton.skinText[where + 1] = 0;
- skeleton.skinText[where + 2] = 0;
- } else if (wolfbloodText[(i * texdetailint - offsetx) * 512 * 3 + (j * texdetailint - offsety) * 3 + 0] <= 160 + 4 && wolfbloodText[(i * texdetailint - offsetx) * 512 * 3 + (j * texdetailint - offsety) * 3 + 0] >= 160 - 4) {
- color = Random() % 85 + 170;
- where = i * skeleton.skinsize * 3 + j * 3;
- if (skeleton.skinText[where + 0] > color / 2) {
- skeleton.skinText[where + 0] = color / 2;
- }
- skeleton.skinText[where + 1] = 0;
- skeleton.skinText[where + 2] = 0;
+ skeleton.skinText[where + 1] = 0;
+ skeleton.skinText[where + 2] = 0;
+ } else if (PersonType::types[creature].bloodText[(i * texdetailint - offsetx) * 512 * 3 + (j * texdetailint - offsety) * 3 + 0] <= 160 + 4 && PersonType::types[creature].bloodText[(i * texdetailint - offsetx) * 512 * 3 + (j * texdetailint - offsety) * 3 + 0] >= 160 - 4) {
+ color = Random() % 85 + 170;
+ where = i * skeleton.skinsize * 3 + j * 3;
+ if (skeleton.skinText[where + 0] > color / 2) {
+ skeleton.skinText[where + 0] = color / 2;
}
+ skeleton.skinText[where + 1] = 0;
+ skeleton.skinText[where + 2] = 0;
}
}
}
if (targetFrame().label == 4 && aitype != playercontrolled) {
if (Animation::animations[animTarget].attack != neutral) {
unsigned r = abs(Random() % 4);
- if (creature == rabbittype) {
- if (r == 0) {
- whichsound = rabbitattacksound;
- }
- if (r == 1) {
- whichsound = rabbitattack2sound;
- }
- if (r == 2) {
- whichsound = rabbitattack3sound;
- }
- if (r == 3) {
- whichsound = rabbitattack4sound;
- }
- }
- if (creature == wolftype) {
- if (r == 0) {
- whichsound = barksound;
- }
- if (r == 1) {
- whichsound = bark2sound;
- }
- if (r == 2) {
- whichsound = bark3sound;
- }
- if (r == 3) {
- whichsound = barkgrowlsound;
- }
- }
+ whichsound = PersonType::types[creature].soundsAttack[r];
speechdelay = .3;
}
}
int whichsound = -1;
if (speechdelay <= 0) {
unsigned int i = abs(Random() % 4);
- if (creature == rabbittype) {
- if (i == 0) {
- whichsound = rabbitchitter;
- }
- if (i == 1) {
- whichsound = rabbitchitter2;
- }
- }
- if (creature == wolftype) {
- if (i == 0) {
- whichsound = growlsound;
- }
- if (i == 1) {
- whichsound = growl2sound;
- }
+ if (i < 2) {
+ whichsound = PersonType::types[creature].soundsTalk[i];
}
}
speechdelay = .3;
glMatrixMode(GL_MODELVIEW);
glPushMatrix();
if (p1 == abdomen || p2 == abdomen) {
- glTranslatef((v0.x * (1 - morphness) + v1.x * morphness) * proportionbody.x,
- (v0.y * (1 - morphness) + v1.y * morphness) * proportionbody.y,
- (v0.z * (1 - morphness) + v1.z * morphness) * proportionbody.z);
+ glTranslatef((v0.x * (1 - morphness) + v1.x * morphness) * getProportion(1).x,
+ (v0.y * (1 - morphness) + v1.y * morphness) * getProportion(1).y,
+ (v0.z * (1 - morphness) + v1.z * morphness) * getProportion(1).z);
}
if (p1 == lefthand || p1 == righthand || p1 == leftwrist || p1 == rightwrist || p1 == leftelbow || p1 == rightelbow || p2 == leftelbow || p2 == rightelbow) {
- glTranslatef((v0.x * (1 - morphness) + v1.x * morphness) * proportionarms.x,
- (v0.y * (1 - morphness) + v1.y * morphness) * proportionarms.y,
- (v0.z * (1 - morphness) + v1.z * morphness) * proportionarms.z);
+ glTranslatef((v0.x * (1 - morphness) + v1.x * morphness) * getProportion(2).x,
+ (v0.y * (1 - morphness) + v1.y * morphness) * getProportion(2).y,
+ (v0.z * (1 - morphness) + v1.z * morphness) * getProportion(2).z);
}
if (p1 == leftfoot || p1 == rightfoot || p1 == leftankle || p1 == rightankle || p1 == leftknee || p1 == rightknee || p2 == leftknee || p2 == rightknee) {
- glTranslatef((v0.x * (1 - morphness) + v1.x * morphness) * proportionlegs.x,
- (v0.y * (1 - morphness) + v1.y * morphness) * proportionlegs.y,
- (v0.z * (1 - morphness) + v1.z * morphness) * proportionlegs.z);
+ glTranslatef((v0.x * (1 - morphness) + v1.x * morphness) * getProportion(3).x,
+ (v0.y * (1 - morphness) + v1.y * morphness) * getProportion(3).y,
+ (v0.z * (1 - morphness) + v1.z * morphness) * getProportion(3).z);
}
if (p1 == head || p2 == head) {
- glTranslatef((v0.x * (1 - morphness) + v1.x * morphness) * proportionhead.x,
- (v0.y * (1 - morphness) + v1.y * morphness) * proportionhead.y,
- (v0.z * (1 - morphness) + v1.z * morphness) * proportionhead.z);
+ glTranslatef((v0.x * (1 - morphness) + v1.x * morphness) * getProportion(0).x,
+ (v0.y * (1 - morphness) + v1.y * morphness) * getProportion(0).y,
+ (v0.z * (1 - morphness) + v1.z * morphness) * getProportion(0).z);
}
glGetFloatv(GL_MODELVIEW_MATRIX, M);
skeleton.drawmodel.vertex[skeleton.muscles[i].vertices[j]].x = M[12] * scale;
glMatrixMode(GL_MODELVIEW);
glPushMatrix();
if (p1 == abdomen || p2 == abdomen) {
- glTranslatef(v0.x * proportionbody.x,
- v0.y * proportionbody.y,
- v0.z * proportionbody.z);
+ glTranslatef(v0.x * getProportion(1).x,
+ v0.y * getProportion(1).y,
+ v0.z * getProportion(1).z);
}
if (p1 == lefthand || p1 == righthand || p1 == leftwrist || p1 == rightwrist || p1 == leftelbow || p1 == rightelbow || p2 == leftelbow || p2 == rightelbow) {
- glTranslatef(v0.x * proportionarms.x,
- v0.y * proportionarms.y,
- v0.z * proportionarms.z);
+ glTranslatef(v0.x * getProportion(2).x,
+ v0.y * getProportion(2).y,
+ v0.z * getProportion(2).z);
}
if (p1 == leftfoot || p1 == rightfoot || p1 == leftankle || p1 == rightankle || p1 == leftknee || p1 == rightknee || p2 == leftknee || p2 == rightknee) {
- glTranslatef(v0.x * proportionlegs.x,
- v0.y * proportionlegs.y,
- v0.z * proportionlegs.z);
+ glTranslatef(v0.x * getProportion(3).x,
+ v0.y * getProportion(3).y,
+ v0.z * getProportion(3).z);
}
if (p1 == head || p2 == head) {
- glTranslatef(v0.x * proportionhead.x,
- v0.y * proportionhead.y,
- v0.z * proportionhead.z);
+ glTranslatef(v0.x * getProportion(0).x,
+ v0.y * getProportion(0).y,
+ v0.z * getProportion(0).z);
}
glGetFloatv(GL_MODELVIEW_MATRIX, M);
glMatrixMode(GL_MODELVIEW);
glPushMatrix();
if (p1 == abdomen || p2 == abdomen) {
- glTranslatef(v0.x * proportionbody.x,
- v0.y * proportionbody.y,
- v0.z * proportionbody.z);
+ glTranslatef(v0.x * getProportion(1).x,
+ v0.y * getProportion(1).y,
+ v0.z * getProportion(1).z);
}
if (p1 == lefthand || p1 == righthand || p1 == leftwrist || p1 == rightwrist || p1 == leftelbow || p1 == rightelbow || p2 == leftelbow || p2 == rightelbow) {
- glTranslatef(v0.x * proportionarms.x,
- v0.y * proportionarms.y,
- v0.z * proportionarms.z);
+ glTranslatef(v0.x * getProportion(2).x,
+ v0.y * getProportion(2).y,
+ v0.z * getProportion(2).z);
}
if (p1 == leftfoot || p1 == rightfoot || p1 == leftankle || p1 == rightankle || p1 == leftknee || p1 == rightknee || p2 == leftknee || p2 == rightknee) {
- glTranslatef(v0.x * proportionlegs.x,
- v0.y * proportionlegs.y,
- v0.z * proportionlegs.z);
+ glTranslatef(v0.x * getProportion(3).x,
+ v0.y * getProportion(3).y,
+ v0.z * getProportion(3).z);
}
if (p1 == head || p2 == head) {
- glTranslatef(v0.x * proportionhead.x,
- v0.y * proportionhead.y,
- v0.z * proportionhead.z);
+ glTranslatef(v0.x * getProportion(0).x,
+ v0.y * getProportion(0).y,
+ v0.z * getProportion(0).z);
}
glGetFloatv(GL_MODELVIEW_MATRIX, M);
skeleton.drawmodelclothes.vertex[skeleton.muscles[i].verticesclothes[j]].x = M[12] * scale;
//chase player
XYZ rotatetarget = Person::players[0]->coords + Person::players[0]->velocity;
XYZ targetpoint = Person::players[0]->coords;
- if (findLength(&velocity) != 0 &&
+ float vellength = findLength(&velocity);
+ if (vellength != 0 &&
distsq(&Person::players[0]->coords, &coords) < distsq(&rotatetarget, &coords)) {
targetpoint += Person::players[0]->velocity *
- findDistance(&Person::players[0]->coords, &coords) / findLength(&velocity);
+ findDistance(&Person::players[0]->coords, &coords) / vellength;
}
targetyaw = roughDirectionTo(coords, targetpoint);
lookyaw = targetyaw;