#include "Objects/Person.hpp"
#include "Animation/Animation.hpp"
-#include "Audio/openal_wrapper.hpp"
#include "Audio/Sounds.hpp"
+#include "Audio/openal_wrapper.hpp"
#include "Game.hpp"
#include "Level/Awards.hpp"
#include "Level/Dialog.hpp"
-#include "Utils/Folders.hpp"
#include "Tutorial.hpp"
+#include "Utils/Folders.hpp"
extern float multiplier;
extern Terrain terrain;
std::vector<std::shared_ptr<Person>> Person::players(1, std::shared_ptr<Person>(new Person()));
-Person::Person() :
- whichpatchx(0),
- whichpatchz(0),
- animCurrent(bounceidleanim),
- animTarget(bounceidleanim),
- frameCurrent(0),
- frameTarget(1),
- oldanimCurrent(0),
- oldanimTarget(0),
- oldframeCurrent(0),
- oldframeTarget(0),
- howactive(typeactive),
- parriedrecently(0),
- superruntoggle(false),
- lastattack(0), lastattack2(0), lastattack3(0),
- currentoffset(), targetoffset(), offset(),
- target(0),
- transspeed(0),
-
- realoldcoords(),
- oldcoords(),
- coords(),
- velocity(),
-
- proportionhead(),
- proportionlegs(),
- proportionarms(),
- proportionbody(),
-
- unconscioustime(0),
-
- immobile(false),
-
- velspeed(0),
- targetyaw(0),
- targetrot(0),
- rot(0),
- oldrot(0),
- lookyaw(0),
- lookpitch(0),
- yaw(0),
- pitch(0),
- lowyaw(0),
- tilt(0),
- targettilt(0),
- tilt2(0),
- targettilt2(0),
- rabbitkickenabled(false),
-
- bloodloss(0),
- bleeddelay(0),
- skiddelay(0),
- skiddingdelay(0),
- deathbleeding(0),
- tempdeltav(0),
-
- damagetolerance(200),
- damage(0),
- permanentdamage(0),
- superpermanentdamage(0),
- lastcollide(0),
- dead(0),
-
- jumppower(5),
- onground(false),
-
- wentforweapon(0),
-
- calcrot(false),
-
- facing(),
-
- bleeding(0),
- bleedx(0), bleedy(0),
- direction(0),
- texupdatedelay(0),
-
- headyaw(0), headpitch(0),
- targetheadyaw(0), targetheadpitch(0),
-
- onterrain(false),
- pause(false),
-
- grabdelay(0),
-
- victim(nullptr),
- hasvictim(false),
-
- updatedelay(0),
- normalsupdatedelay(0),
-
- jumpstart(false),
- forwardkeydown(false),
- forwardstogglekeydown(false),
- rightkeydown(false),
- leftkeydown(false),
- backkeydown(false),
- jumpkeydown(false),
- jumptogglekeydown(false),
- crouchkeydown(false),
- crouchtogglekeydown(false),
- drawkeydown(false),
- drawtogglekeydown(false),
- throwkeydown(false),
- throwtogglekeydown(false),
- attackkeydown(false),
- feint(false),
- lastfeint(false),
- headless(false),
-
- crouchkeydowntime(0),
- jumpkeydowntime(0),
- freefall(false),
-
- turnspeed(0),
-
- aitype(passivetype),
- aiupdatedelay(0),
- losupdatedelay(0),
- ally(0),
- collide(0),
- collided(-10),
- avoidcollided(0),
- loaded(false),
- whichdirection(false),
- whichdirectiondelay(0),
- avoidsomething(false),
- avoidwhere(),
- blooddimamount(0),
-
- staggerdelay(0),
- blinkdelay(0),
- twitchdelay(0),
- twitchdelay2(0),
- twitchdelay3(0),
- lefthandmorphness(0),
- righthandmorphness(0),
- headmorphness(0),
- chestmorphness(0),
- tailmorphness(0),
- targetlefthandmorphness(0),
- targetrighthandmorphness(0),
- targetheadmorphness(1),
- targetchestmorphness(0),
- targettailmorphness(0),
- lefthandmorphstart(0), lefthandmorphend(0),
- righthandmorphstart(0), righthandmorphend(0),
- headmorphstart(0), headmorphend(0),
- chestmorphstart(0), chestmorphend(0),
- tailmorphstart(0), tailmorphend(0),
-
- weaponmissdelay(0),
- highreversaldelay(0),
- lowreversaldelay(0),
-
- creature(rabbittype),
-
- id(0),
-
- skeleton(),
-
- speed(0),
- scale(-1),
- power(0),
- speedmult(0),
-
- protectionhead(0),
- protectionhigh(0),
- protectionlow(0),
- armorhead(0),
- armorhigh(0),
- armorlow(0),
- metalhead(false),
- metalhigh(false),
- metallow(false),
-
- numclothes(0),
-
- landhard(false),
- bled(false),
- spurt(false),
- onfire(false),
- onfiredelay(0),
- burnt(0),
-
- flamedelay(0),
-
- playerdetail(0),
-
- num_weapons(0),
- weaponactive(-1),
- weaponstuck(-1),
- weaponstuckwhere(0),
-
- numwaypoints(0),
- pausetime(0),
-
- headtarget(),
- interestdelay(0),
-
- finalfinaltarget(),
- finaltarget(),
- finalpathfindpoint(0),
- targetpathfindpoint(0),
- lastpathfindpoint(0),
- lastpathfindpoint2(0),
- lastpathfindpoint3(0),
- lastpathfindpoint4(0),
-
- waypoint(0),
-
- lastseen(),
- lastseentime(0),
- lastchecktime(0),
- stunned(0),
- surprised(0),
- runninghowlong(0),
- occluded(0),
- lastoccluded(0),
- laststanding(0),
- escapednum(0),
-
- speechdelay(0),
- neckspurtdelay(0),
- neckspurtparticledelay(0),
- neckspurtamount(0),
-
- whichskin(0),
- rabbitkickragdoll(false),
-
- tempanimation(),
+Person::Person()
+ : whichpatchx(0)
+ , whichpatchz(0)
+ , animCurrent(bounceidleanim)
+ , animTarget(bounceidleanim)
+ , frameCurrent(0)
+ , frameTarget(1)
+ , oldanimCurrent(0)
+ , oldanimTarget(0)
+ , oldframeCurrent(0)
+ , oldframeTarget(0)
+ , howactive(typeactive)
+ , parriedrecently(0)
+ , superruntoggle(false)
+ , lastattack(0)
+ , lastattack2(0)
+ , lastattack3(0)
+ , currentoffset()
+ , targetoffset()
+ , offset()
+ , target(0)
+ , transspeed(0)
+ ,
+
+ realoldcoords()
+ , oldcoords()
+ , coords()
+ , velocity()
+ ,
+
+ proportionhead()
+ , proportionlegs()
+ , proportionarms()
+ , proportionbody()
+ ,
+
+ unconscioustime(0)
+ ,
+
+ immobile(false)
+ ,
+
+ velspeed(0)
+ , targetyaw(0)
+ , targetrot(0)
+ , rot(0)
+ , oldrot(0)
+ , lookyaw(0)
+ , lookpitch(0)
+ , yaw(0)
+ , pitch(0)
+ , lowyaw(0)
+ , tilt(0)
+ , targettilt(0)
+ , tilt2(0)
+ , targettilt2(0)
+ , rabbitkickenabled(false)
+ ,
+
+ bloodloss(0)
+ , bleeddelay(0)
+ , skiddelay(0)
+ , skiddingdelay(0)
+ , deathbleeding(0)
+ , tempdeltav(0)
+ ,
+
+ damagetolerance(200)
+ , damage(0)
+ , permanentdamage(0)
+ , superpermanentdamage(0)
+ , lastcollide(0)
+ , dead(0)
+ ,
+
+ jumppower(5)
+ , onground(false)
+ ,
+
+ wentforweapon(0)
+ ,
+
+ calcrot(false)
+ ,
+
+ facing()
+ ,
+
+ bleeding(0)
+ , bleedx(0)
+ , bleedy(0)
+ , direction(0)
+ , texupdatedelay(0)
+ ,
+
+ headyaw(0)
+ , headpitch(0)
+ , targetheadyaw(0)
+ , targetheadpitch(0)
+ ,
+
+ onterrain(false)
+ , pause(false)
+ ,
+
+ grabdelay(0)
+ ,
+
+ victim(nullptr)
+ , hasvictim(false)
+ ,
+
+ updatedelay(0)
+ , normalsupdatedelay(0)
+ ,
+
+ jumpstart(false)
+ , forwardkeydown(false)
+ , forwardstogglekeydown(false)
+ , rightkeydown(false)
+ , leftkeydown(false)
+ , backkeydown(false)
+ , jumpkeydown(false)
+ , jumptogglekeydown(false)
+ , crouchkeydown(false)
+ , crouchtogglekeydown(false)
+ , drawkeydown(false)
+ , drawtogglekeydown(false)
+ , throwkeydown(false)
+ , throwtogglekeydown(false)
+ , attackkeydown(false)
+ , feint(false)
+ , lastfeint(false)
+ , headless(false)
+ ,
+
+ crouchkeydowntime(0)
+ , jumpkeydowntime(0)
+ , freefall(false)
+ ,
+
+ turnspeed(0)
+ ,
+
+ aitype(passivetype)
+ , aiupdatedelay(0)
+ , losupdatedelay(0)
+ , ally(0)
+ , collide(0)
+ , collided(-10)
+ , avoidcollided(0)
+ , loaded(false)
+ , whichdirection(false)
+ , whichdirectiondelay(0)
+ , avoidsomething(false)
+ , avoidwhere()
+ , blooddimamount(0)
+ ,
+
+ staggerdelay(0)
+ , blinkdelay(0)
+ , twitchdelay(0)
+ , twitchdelay2(0)
+ , twitchdelay3(0)
+ , lefthandmorphness(0)
+ , righthandmorphness(0)
+ , headmorphness(0)
+ , chestmorphness(0)
+ , tailmorphness(0)
+ , targetlefthandmorphness(0)
+ , targetrighthandmorphness(0)
+ , targetheadmorphness(1)
+ , targetchestmorphness(0)
+ , targettailmorphness(0)
+ , lefthandmorphstart(0)
+ , lefthandmorphend(0)
+ , righthandmorphstart(0)
+ , righthandmorphend(0)
+ , headmorphstart(0)
+ , headmorphend(0)
+ , chestmorphstart(0)
+ , chestmorphend(0)
+ , tailmorphstart(0)
+ , tailmorphend(0)
+ ,
+
+ weaponmissdelay(0)
+ , highreversaldelay(0)
+ , lowreversaldelay(0)
+ ,
+
+ creature(rabbittype)
+ ,
+
+ id(0)
+ ,
+
+ skeleton()
+ ,
+
+ speed(0)
+ , scale(-1)
+ , power(0)
+ , speedmult(0)
+ ,
+
+ protectionhead(0)
+ , protectionhigh(0)
+ , protectionlow(0)
+ , armorhead(0)
+ , armorhigh(0)
+ , armorlow(0)
+ , metalhead(false)
+ , metalhigh(false)
+ , metallow(false)
+ ,
+
+ numclothes(0)
+ ,
+
+ landhard(false)
+ , bled(false)
+ , spurt(false)
+ , onfire(false)
+ , onfiredelay(0)
+ , burnt(0)
+ ,
+
+ flamedelay(0)
+ ,
+
+ playerdetail(0)
+ ,
+
+ num_weapons(0)
+ , weaponactive(-1)
+ , weaponstuck(-1)
+ , weaponstuckwhere(0)
+ ,
+
+ numwaypoints(0)
+ , pausetime(0)
+ ,
+
+ headtarget()
+ , interestdelay(0)
+ ,
+
+ finalfinaltarget()
+ , finaltarget()
+ , finalpathfindpoint(0)
+ , targetpathfindpoint(0)
+ , lastpathfindpoint(0)
+ , lastpathfindpoint2(0)
+ , lastpathfindpoint3(0)
+ , lastpathfindpoint4(0)
+ ,
+
+ waypoint(0)
+ ,
+
+ lastseen()
+ , lastseentime(0)
+ , lastchecktime(0)
+ , stunned(0)
+ , surprised(0)
+ , runninghowlong(0)
+ , occluded(0)
+ , lastoccluded(0)
+ , laststanding(0)
+ , escapednum(0)
+ ,
+
+ speechdelay(0)
+ , neckspurtdelay(0)
+ , neckspurtparticledelay(0)
+ , neckspurtamount(0)
+ ,
+
+ whichskin(0)
+ , rabbitkickragdoll(false)
+ ,
+
+ tempanimation()
+ ,
jumpclimb(false)
{
}
/* Read a person in tfile. Throws an error if it’s not valid */
-Person::Person(FILE *tfile, int mapvers, unsigned i) : Person()
+Person::Person(FILE* tfile, int mapvers, unsigned i)
+ : Person()
{
id = i;
funpackf(tfile, "Bi Bi Bf Bf Bf Bi", &whichskin, &creature, &coords.x, &coords.y, &coords.z, &num_weapons);
"Models/Body7.solid",
"Models/BodyLow.solid",
"Models/Belt.solid",
- clothes
- );
+ clothes);
} else {
skeleton.Load(
"Skeleton/BasicFigureWolf",
"Models/Wolf7.solid",
"Models/WolfLow.solid",
"Models/Belt.solid",
- clothes
- );
+ clothes);
}
skeleton.drawmodel.textureptr.load(creatureskin[creature][whichskin], 1, &skeleton.skinText[0], &skeleton.skinsize);
*/
void Person::CheckKick()
{
- if (!(hasvictim
- && (animTarget == rabbitkickanim
- && victim
- && victim != this->shared_from_this()
- && frameCurrent >= 2
- && animCurrent == rabbitkickanim)
- && distsq(&coords, &victim->coords) < 1.2
- && !victim->skeleton.free))
+ if (!(hasvictim && (animTarget == rabbitkickanim && victim && victim != this->shared_from_this() && frameCurrent >= 2 && animCurrent == rabbitkickanim) && distsq(&coords, &victim->coords) < 1.2 && !victim->skeleton.free))
return;
if (Animation::animations[victim->animTarget].height != lowheight) {
return talkidleanim;
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())) {
+ 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 ((damage > permanentdamage || damage > damagetolerance * .8 || deathbleeding > 0) && creature != wolftype)
return hurtidleanim;
- if (howactive == typesitting) return sitanim;
- if (howactive == typesittingwall) return sitwallanim;
- if (howactive == typesleeping) return sleepanim;
- if (howactive == typedead1) return dead1anim;
- if (howactive == typedead2) return dead2anim;
- if (howactive == typedead3) return dead3anim;
- if (howactive == typedead4) return dead4anim;
- if (creature == rabbittype) return bounceidleanim;
- if (creature == wolftype) return wolfidle;
+ if (howactive == typesitting)
+ return sitanim;
+ if (howactive == typesittingwall)
+ return sitwallanim;
+ if (howactive == typesleeping)
+ return sleepanim;
+ if (howactive == typedead1)
+ return dead1anim;
+ if (howactive == typedead2)
+ return dead2anim;
+ if (howactive == typedead3)
+ return dead3anim;
+ if (howactive == typedead4)
+ return dead4anim;
+ if (creature == rabbittype)
+ return bounceidleanim;
+ if (creature == wolftype)
+ return wolfidle;
return 0;
}
bloodvel.z = 10;
bloodvel = DoRotation(bloodvel, ((float)(Random() % 100)) / 4, yaw + ((float)(Random() % 100)) / 4, 0) * scale;
bloodvel += DoRotation(velocity, ((float)(Random() % 100)) / 4, ((float)(Random() % 100)) / 4, 0) * scale;
- Sprite::MakeSprite(bloodsprite, DoRotation((jointPos(head) + jointPos(neck)) / 2, 0, yaw, 0)*scale + coords, bloodvel, 1, 1, 1, .05, 1);
- Sprite::MakeSprite(bloodflamesprite, DoRotation((jointPos(head) + jointPos(neck)) / 2, 0, yaw, 0)*scale + coords, bloodvel, 1, 1, 1, .3, 1);
+ Sprite::MakeSprite(bloodsprite, DoRotation((jointPos(head) + jointPos(neck)) / 2, 0, yaw, 0) * scale + coords, bloodvel, 1, 1, 1, .05, 1);
+ Sprite::MakeSprite(bloodflamesprite, DoRotation((jointPos(head) + jointPos(neck)) / 2, 0, yaw, 0) * scale + coords, bloodvel, 1, 1, 1, .3, 1);
}
}
if (Random() % 2 == 0) // 50% chance
if (skeleton.free) {
Sprite::MakeSprite(splintersprite, jointPos(head) * scale + coords, bloodvel, 1, 1, 1, .05, 1);
} else {
- Sprite::MakeSprite(splintersprite, DoRotation((jointPos(head) + jointPos(neck)) / 2, 0, yaw, 0)*scale + coords, bloodvel, 1, 1, 1, .05, 1);
+ Sprite::MakeSprite(splintersprite, DoRotation((jointPos(head) + jointPos(neck)) / 2, 0, yaw, 0) * scale + coords, bloodvel, 1, 1, 1, .05, 1);
}
Sprite::setLastSpriteSpecial(3); // sets it to teeth
}
bleedx /= realtexdetail;
direction = abs(Random() % 2) * 2 - 1;
}
-
}
if (bleeding > 2)
bleeding = 2;
bloodvel.z = 10;
bloodvel = DoRotation(bloodvel, ((float)(Random() % 100)) / 4, yaw + ((float)(Random() % 100)) / 4, 0) * scale;
bloodvel += DoRotation(velocity, ((float)(Random() % 100)) / 4, ((float)(Random() % 100)) / 4, 0) * scale;
- Sprite::MakeSprite(bloodsprite, DoRotation((jointPos(head) + jointPos(neck)) / 2, 0, yaw, 0)*scale + coords, bloodvel, 1, 1, 1, .05, 1);
- Sprite::MakeSprite(bloodflamesprite, DoRotation((jointPos(head) + jointPos(neck)) / 2, 0, yaw, 0)*scale + coords, bloodvel, 1, 1, 1, .3, 1);
+ Sprite::MakeSprite(bloodsprite, DoRotation((jointPos(head) + jointPos(neck)) / 2, 0, yaw, 0) * scale + coords, bloodvel, 1, 1, 1, .05, 1);
+ Sprite::MakeSprite(bloodflamesprite, DoRotation((jointPos(head) + jointPos(neck)) / 2, 0, yaw, 0) * scale + coords, bloodvel, 1, 1, 1, .3, 1);
}
}
}
offsetx = 20;
}
-
int startx = 512;
int starty = 512;
int endx = 0;
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;
+ 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 (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 (i < startx)
+ startx = i;
+ if (j < starty)
+ starty = j;
+ if (i > endx)
+ endx = i;
+ if (j > endy)
+ endy = j;
}
}
}
starty += offsety;
endy += offsety;
- if (startx < 0) startx = 0;
- if (starty < 0) starty = 0;
- if (endx > 512 - 1) endx = 512 - 1;
- if (endy > 512 - 1) endy = 512 - 1;
- if (endx < startx) endx = startx;
- if (endy < starty) endy = starty;
+ if (startx < 0)
+ startx = 0;
+ if (starty < 0)
+ starty = 0;
+ if (endx > 512 - 1)
+ endx = 512 - 1;
+ if (endy > 512 - 1)
+ endy = 512 - 1;
+ if (endx < startx)
+ endx = startx;
+ if (endy < starty)
+ endy = starty;
startx /= realtexdetail;
starty /= realtexdetail;
if (bleedy > skeleton.skinsize - 1)
bleedy = skeleton.skinsize - 1;
direction = abs(Random() % 2) * 2 - 1;
-
}
bleeding = howmuch + (float)abs(Random() % 100) / 200 - .25;
deathbleeding += bleeding;
bary.y /= total;
bary.z /= total;
-
gxx.x = skeleton.drawmodel.Triangles[whichtri].gx[0];
gxx.y = skeleton.drawmodel.Triangles[whichtri].gx[1];
gxx.z = skeleton.drawmodel.Triangles[whichtri].gx[2];
bloodvel.z = 10;
bloodvel = DoRotation(bloodvel, ((float)(Random() % 100)) / 4, yaw + ((float)(Random() % 100)) / 4, 0) * scale;
bloodvel += DoRotation(velocity, ((float)(Random() % 100)) / 4, ((float)(Random() % 100)) / 4, 0) * scale;
- Sprite::MakeSprite(bloodsprite, DoRotation((jointPos(head) + jointPos(neck)) / 2, 0, yaw, 0)*scale + coords, bloodvel, 1, 1, 1, .05, 1);
- Sprite::MakeSprite(bloodflamesprite, DoRotation((jointPos(head) + jointPos(neck)) / 2, 0, yaw, 0)*scale + coords, bloodvel, 1, 1, 1, .3, 1);
+ Sprite::MakeSprite(bloodsprite, DoRotation((jointPos(head) + jointPos(neck)) / 2, 0, yaw, 0) * scale + coords, bloodvel, 1, 1, 1, .05, 1);
+ Sprite::MakeSprite(bloodflamesprite, DoRotation((jointPos(head) + jointPos(neck)) / 2, 0, yaw, 0) * scale + coords, bloodvel, 1, 1, 1, .3, 1);
}
}
}
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;
+ 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 (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 (i < startx)
+ startx = i;
+ if (j < starty)
+ starty = j;
+ if (i > endx)
+ endx = i;
+ if (j > endy)
+ endy = j;
}
}
}
starty += offsety;
endy += offsety;
- if (startx < 0) startx = 0;
- if (starty < 0) starty = 0;
- if (endx > 512 - 1) endx = 512 - 1;
- if (endy > 512 - 1) endy = 512 - 1;
- if (endx < startx) endx = startx;
- if (endy < starty) endy = starty;
+ if (startx < 0)
+ startx = 0;
+ if (starty < 0)
+ starty = 0;
+ if (endx > 512 - 1)
+ endx = 512 - 1;
+ if (endy > 512 - 1)
+ endy = 512 - 1;
+ if (endx < startx)
+ endx = startx;
+ if (endy < starty)
+ endy = starty;
startx /= realtexdetail;
starty /= realtexdetail;
return 1;
}
-
-
/* EFFECT
* guessing this performs a reversal
*/
void Person::Reverse()
{
- if (!((victim->aitype == playercontrolled
- || hostiletime > 1
- || staggerdelay <= 0)
- && victim->animTarget != jumpupanim
- && victim->animTarget != jumpdownanim
- && (!Tutorial::active || cananger)
- && hostile))
+ if (!((victim->aitype == playercontrolled || hostiletime > 1 || staggerdelay <= 0) && victim->animTarget != jumpupanim && victim->animTarget != jumpdownanim && (!Tutorial::active || cananger) && hostile))
return;
- if (normaldotproduct (victim->facing, victim->coords - coords) > 0
- && (victim->id != 0 || difficulty >= 2)
- && (creature != wolftype || victim->creature == wolftype))
+ if (normaldotproduct(victim->facing, victim->coords - coords) > 0 && (victim->id != 0 || difficulty >= 2) && (creature != wolftype || victim->creature == wolftype))
return;
if (animTarget == sweepanim) {
for (unsigned i = 0; i < Person::players.size(); i++) {
Person::players[i]->wentforweapon = 0;
}
-
-
}
}
if (hasvictim)
targetheadyaw = (float)((int)((0 - yaw - targetheadyaw + 180) * 100) % 36000) / 100;
targetheadpitch = (float)((int)(targetheadpitch * 100) % 36000) / 100;
- while (targetheadyaw > 180)targetheadyaw -= 360;
- while (targetheadyaw < -180)targetheadyaw += 360;
+ while (targetheadyaw > 180)
+ targetheadyaw -= 360;
+ while (targetheadyaw < -180)
+ targetheadyaw += 360;
if (targetheadyaw > 160)
targetheadpitch = targetheadpitch * -1;
freefall = 1;
skeleton.freefall = 1;
- if (!isnormal(velocity.x)) velocity.x = 0;
- if (!isnormal(velocity.y)) velocity.y = 0;
- if (!isnormal(velocity.z)) velocity.z = 0;
- if (!isnormal(yaw)) yaw = 0;
- if (!isnormal(coords.x)) coords = 0;
- if (!isnormal(tilt)) tilt = 0;
- if (!isnormal(tilt2)) tilt2 = 0;
+ if (!isnormal(velocity.x))
+ velocity.x = 0;
+ if (!isnormal(velocity.y))
+ velocity.y = 0;
+ if (!isnormal(velocity.z))
+ velocity.z = 0;
+ if (!isnormal(yaw))
+ yaw = 0;
+ if (!isnormal(coords.x))
+ coords = 0;
+ if (!isnormal(tilt))
+ tilt = 0;
+ if (!isnormal(tilt2))
+ tilt2 = 0;
for (unsigned i = 0; i < skeleton.joints.size(); i++) {
skeleton.joints[i].delay = 0;
skeleton.joints[i].locked = 0;
skeleton.joints[i].position = DoRotation(DoRotation(DoRotation(skeleton.joints[i].position, 0, 0, tilt), tilt2, 0, 0), 0, yaw, 0);
- if (!isnormal(skeleton.joints[i].position.x)) skeleton.joints[i].position = DoRotation(skeleton.joints[i].position, 0, yaw, 0);
- if (!isnormal(skeleton.joints[i].position.x)) skeleton.joints[i].position = coords;
+ if (!isnormal(skeleton.joints[i].position.x))
+ skeleton.joints[i].position = DoRotation(skeleton.joints[i].position, 0, yaw, 0);
+ if (!isnormal(skeleton.joints[i].position.x))
+ skeleton.joints[i].position = coords;
skeleton.joints[i].position.y += .1;
skeleton.joints[i].oldposition = skeleton.joints[i].position;
skeleton.joints[i].realoldposition = skeleton.joints[i].position * scale + coords;
}
}
-
-
/* EFFECT
*/
void Person::FootLand(bodypart whichfoot, float opacity)
if (!crouchkeydown && velocity.y >= -15)
landhard = 0;
}
- if ((animCurrent == jumpupanim || animTarget == jumpdownanim)/*&&velocity.y<40*/ && !isFlip() && (!isLanding() && !isLandhard()) && ((crouchkeydown && !crouchtogglekeydown))) {
+ if ((animCurrent == jumpupanim || animTarget == jumpdownanim) /*&&velocity.y<40*/ && !isFlip() && (!isLanding() && !isLandhard()) && ((crouchkeydown && !crouchtogglekeydown))) {
XYZ targfacing;
targfacing = 0;
targfacing.z = 1;
crouchtogglekeydown = 1;
}
-
if (Animation::animations[animTarget].attack || animCurrent == getupfrombackanim || animCurrent == getupfromfrontanim) {
if (detail)
normalsupdatedelay = 0;
FootLand(rightfoot, 1);
FootLand(leftfoot, 1);
}
-
}
if (terrain.getOpacity(coords.x, coords.z) >= .2) {
if (targetFrame().label == 1)
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 (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;
+ if (r == 0)
+ whichsound = barksound;
+ if (r == 1)
+ whichsound = bark2sound;
+ if (r == 2)
+ whichsound = bark3sound;
+ if (r == 3)
+ whichsound = barkgrowlsound;
}
speechdelay = .3;
}
}
}
-
-
if ((!wasLanding() && !wasLandhard()) && animCurrent != getIdle() && (isLanding() || isLandhard())) {
FootLand(leftfoot, 1);
FootLand(rightfoot, 1);
}
}
-
if ((animCurrent == walljumprightkickanim && animTarget == walljumprightkickanim) || (animCurrent == walljumpleftkickanim && animTarget == walljumpleftkickanim)) {
XYZ rotatetarget = DoRotation(skeleton.forward, 0, yaw, 0);
Normalise(&rotatetarget);
if ((animTarget == rabbitrunninganim || animTarget == wolfrunninganim) && frameTarget == 3 && (jumpkeydown || attackkeydown || id != 0))
dojumpattack = 1;
if (hasvictim)
- if (distsq(&victim->coords, &/*Person::players[i]->*/coords) < 5 && victim->aitype == gethelptype && (attackkeydown) && !victim->skeleton.free && victim->isRun() && victim->runninghowlong >= 1)
+ if (distsq(&victim->coords, &/*Person::players[i]->*/ coords) < 5 && victim->aitype == gethelptype && (attackkeydown) && !victim->skeleton.free && victim->isRun() && victim->runninghowlong >= 1)
dojumpattack = 1;
if (!hostile)
dojumpattack = 0;
staggerdelay = .5;
if (!victim->dead)
staggerdelay = 1.2;
-
-
}
}
//victim->skeleton.joints[i].velocity=0;
}
emit_sound_at(fleshstabsound, coords, 128);
-
}
if (whichtri != -1 || weapons[weaponids[weaponactive]].bloody) {
weapons[weaponids[weaponactive]].blooddrip += 5;
}
}
-
if (animTarget == winduppunchanim && Animation::animations[animTarget].frames[frameCurrent].label == 5) {
if (distsq(&coords, &victim->coords) < (scale * 5) * (scale * 5) * 2) {
escapednum = 0;
if (animTarget == knifeslashstartanim && Animation::animations[animTarget].frames[frameCurrent].label == 5) {
if (hasvictim)
- if (distsq(&coords, &victim->coords) < (scale * 5) * (scale * 5) * 4.5 &&/*Animation::animations[victim->animTarget].height!=lowheight&&*/victim->animTarget != dodgebackanim && victim->animTarget != rollanim) {
+ if (distsq(&coords, &victim->coords) < (scale * 5) * (scale * 5) * 4.5 && /*Animation::animations[victim->animTarget].height!=lowheight&&*/ victim->animTarget != dodgebackanim && victim->animTarget != rollanim) {
escapednum = 0;
if (!Tutorial::active) {
victim->DoBloodBig(1.5 / victim->armorhigh, 225);
}
}
-
XYZ aim;
victim->Puff(righthand);
victim->target = 0;
for (unsigned i = 0; i < Person::players.size(); i++) {
Person::players[i]->wentforweapon = 0;
}
-
}
}
}
victim->DoBloodBig(2 / victim->armorhigh, 170);
}
}
-
}
}
}
SolidHitBonus(id);
-
}
}
}
}
}
-
-
if (animTarget == swordslashreversalanim && Animation::animations[animTarget].frames[frameCurrent].label == 7) {
escapednum = 0;
victim->RagDoll(1);
Sprite::MakeSprite(bloodsprite, footpoint, DoRotation(footvel * 3, (float)(Random() % 20), (float)(Random() % 20), 0), 1, 1, 1, .05, .9);
Sprite::MakeSprite(bloodflamesprite, footpoint, footvel * 5, 1, 1, 1, .2, 1);
Sprite::MakeSprite(bloodflamesprite, footpoint, footvel * 2, 1, 1, 1, .2, 1);
-
}
victim->bloodloss += 10000;
victim->velocity = 0;
}
}
-
//Animation end
if (frameTarget > int(Animation::animations[animCurrent].frames.size()) - 1) {
frameTarget = 0;
skeleton.muscles[i].newrotate2 = (float)((int)(skeleton.muscles[i].rotate2 * 100) % 36000) / 100;
if (isnormal((float)((int)(skeleton.muscles[i].rotate3 * 100) % 36000) / 100))
skeleton.muscles[i].newrotate3 = (float)((int)(skeleton.muscles[i].rotate3 * 100) % 36000) / 100;
- if (skeleton.muscles[i].newrotate3 > skeleton.muscles[i].oldrotate3 + 180) skeleton.muscles[i].newrotate3 -= 360;
- if (skeleton.muscles[i].newrotate3 < skeleton.muscles[i].oldrotate3 - 180) skeleton.muscles[i].newrotate3 += 360;
- if (skeleton.muscles[i].newrotate2 > skeleton.muscles[i].oldrotate2 + 180) skeleton.muscles[i].newrotate2 -= 360;
- if (skeleton.muscles[i].newrotate2 < skeleton.muscles[i].oldrotate2 - 180) skeleton.muscles[i].newrotate2 += 360;
- if (skeleton.muscles[i].newrotate1 > skeleton.muscles[i].oldrotate1 + 180) skeleton.muscles[i].newrotate1 -= 360;
- if (skeleton.muscles[i].newrotate1 < skeleton.muscles[i].oldrotate1 - 180) skeleton.muscles[i].newrotate1 += 360;
+ if (skeleton.muscles[i].newrotate3 > skeleton.muscles[i].oldrotate3 + 180)
+ skeleton.muscles[i].newrotate3 -= 360;
+ if (skeleton.muscles[i].newrotate3 < skeleton.muscles[i].oldrotate3 - 180)
+ skeleton.muscles[i].newrotate3 += 360;
+ if (skeleton.muscles[i].newrotate2 > skeleton.muscles[i].oldrotate2 + 180)
+ skeleton.muscles[i].newrotate2 -= 360;
+ if (skeleton.muscles[i].newrotate2 < skeleton.muscles[i].oldrotate2 - 180)
+ skeleton.muscles[i].newrotate2 += 360;
+ if (skeleton.muscles[i].newrotate1 > skeleton.muscles[i].oldrotate1 + 180)
+ skeleton.muscles[i].newrotate1 -= 360;
+ if (skeleton.muscles[i].newrotate1 < skeleton.muscles[i].oldrotate1 - 180)
+ skeleton.muscles[i].newrotate1 += 360;
}
}
}
if (skeleton.free) {
bloodvel -= DoRotation(skeleton.forward * 10 * scale, ((float)(Random() % 100)) / 40, ((float)(Random() % 100)) / 40, 0);
bloodvel += DoRotation(jointVel(head), ((float)(Random() % 100)) / 40, yaw + ((float)(Random() % 100)) / 40, 0) * scale;
- Sprite::MakeSprite(bloodsprite, (jointPos(neck) + (jointPos(neck) - jointPos(head)) / 5)*scale + coords, bloodvel, 1, 1, 1, .05, .9);
+ Sprite::MakeSprite(bloodsprite, (jointPos(neck) + (jointPos(neck) - jointPos(head)) / 5) * scale + coords, bloodvel, 1, 1, 1, .05, .9);
} else {
bloodvel.z = 5 * neckspurtamount;
bloodvel = DoRotation(bloodvel, ((float)(Random() % 100)) / 40, yaw + ((float)(Random() % 100)) / 40, 0) * scale;
bloodvel += DoRotation(velocity, ((float)(Random() % 100)) / 40, ((float)(Random() % 100)) / 40, 0) * scale;
- Sprite::MakeSprite(bloodsprite, DoRotation(jointPos(neck) + (jointPos(neck) - jointPos(head)) / 5, 0, yaw, 0)*scale + coords, bloodvel, 1, 1, 1, .05, .9);
+ Sprite::MakeSprite(bloodsprite, DoRotation(jointPos(neck) + (jointPos(neck) - jointPos(head)) / 5, 0, yaw, 0) * scale + coords, bloodvel, 1, 1, 1, .05, .9);
}
neckspurtparticledelay = .05;
}
Sprite::MakeSprite(bloodsprite, jointPos(abdomen) * scale + coords, bloodvel, 1, 1, 1, .05, 1);
} else {
bloodvel += DoRotation(velocity, ((float)(Random() % 100)) / 4, ((float)(Random() % 100)) / 4, 0) * scale;
- Sprite::MakeSprite(bloodsprite, DoRotation((jointPos(abdomen) + jointPos(abdomen)) / 2, 0, yaw, 0)*scale + coords, bloodvel, 1, 1, 1, .05, 1);
+ Sprite::MakeSprite(bloodsprite, DoRotation((jointPos(abdomen) + jointPos(abdomen)) / 2, 0, yaw, 0) * scale + coords, bloodvel, 1, 1, 1, .05, 1);
}
}
}
righthandmorphness = 0;
targetrighthandmorphness = 1;
righthandmorphend = 1;
- if (Random() % 2 == 0)twitchdelay3 = (float)(abs(Random() % 40)) / 5;
+ if (Random() % 2 == 0)
+ twitchdelay3 = (float)(abs(Random() % 40)) / 5;
}
if (righthandmorphstart == 1 && righthandmorphend == 1) {
righthandmorphness = 0;
targetheadmorphness = 1;
}
-
if (howactive > typesleeping) {
XYZ headpoint;
headpoint = coords;
}
}
-
-
if ((id == 0 || distsq(&coords, &viewer) < 50) && autoslomo) {
slomo = 1;
slomodelay = .2;
targettilt2 = asin(terrainnormal.y) * 180 / 3.14 * -1;
-
if (skeleton.forward.y < 0) {
animTarget = getupfrombackanim;
frameTarget = 0;
targetyaw += 45;
}
if (backkeydown) {
- if ( !leftkeydown && !rightkeydown)
+ if (!leftkeydown && !rightkeydown)
targetyaw += 180;
}
targetyaw += 180;
}
if (skeleton.freefall == 0)
freefall = 0;
-
}
if (aitype != passivetype || skeleton.free == 1)
if (findLengthfast(&velocity) > .1)
for (unsigned int i = 0; i < Object::objects.size(); i++) {
if (Object::objects[i]->type == firetype)
- if (distsqflat(&coords, &Object::objects[i]->position) < Object::objects[i]->scale*Object::objects[i]->scale * 12 && distsq(&coords, &Object::objects[i]->position) < Object::objects[i]->scale*Object::objects[i]->scale * 49) {
+ if (distsqflat(&coords, &Object::objects[i]->position) < Object::objects[i]->scale * Object::objects[i]->scale * 12 && distsq(&coords, &Object::objects[i]->position) < Object::objects[i]->scale * Object::objects[i]->scale * 49) {
if (onfire) {
if (!Object::objects[i]->onfire) {
emit_sound_at(firestartsound, Object::objects[i]->position);
}
}
if (Object::objects[i]->type == bushtype)
- if (distsqflat(&coords, &Object::objects[i]->position) < Object::objects[i]->scale*Object::objects[i]->scale * 12 && distsq(&coords, &Object::objects[i]->position) < Object::objects[i]->scale*Object::objects[i]->scale * 49) {
+ if (distsqflat(&coords, &Object::objects[i]->position) < Object::objects[i]->scale * Object::objects[i]->scale * 12 && distsq(&coords, &Object::objects[i]->position) < Object::objects[i]->scale * Object::objects[i]->scale * 49) {
if (onfire) {
if (!Object::objects[i]->onfire) {
emit_sound_at(firestartsound, Object::objects[i]->position);
tempcoord = DoRotation(tempcoord, -Object::objects[i]->pitch, 0, 0);
tempcoord += Object::objects[i]->position;
}
- if (distsqflat(&tempcoord, &Object::objects[i]->position) < Object::objects[i]->scale*Object::objects[i]->scale * 8 && distsq(&tempcoord, &Object::objects[i]->position) < Object::objects[i]->scale*Object::objects[i]->scale * 300 && tempcoord.y > Object::objects[i]->position.y + 3 * Object::objects[i]->scale) {
+ if (distsqflat(&tempcoord, &Object::objects[i]->position) < Object::objects[i]->scale * Object::objects[i]->scale * 8 && distsq(&tempcoord, &Object::objects[i]->position) < Object::objects[i]->scale * Object::objects[i]->scale * 300 && tempcoord.y > Object::objects[i]->position.y + 3 * Object::objects[i]->scale) {
if (Object::objects[i]->messedwith <= 0) {
XYZ tempvel;
XYZ pos;
}
if (animTarget == spinkickanim ||
- animTarget == staffspinhitreversalanim ||
- animTarget == staffspinhitreversedanim ||
- animTarget == staffhitreversalanim ||
- animTarget == staffhitreversedanim ||
- animTarget == hurtidleanim ||
- animTarget == winduppunchanim ||
- animTarget == swordslashreversalanim ||
- animTarget == swordslashreversedanim ||
- animTarget == knifeslashreversalanim ||
- animTarget == knifeslashreversedanim ||
- animTarget == knifethrowanim ||
- animTarget == knifefollowanim ||
- animTarget == knifefollowedanim ||
- animTarget == killanim ||
- animTarget == dropkickanim ||
- animTarget == upunchanim ||
- animTarget == knifeslashstartanim ||
- animTarget == swordslashanim ||
- animTarget == staffhitanim ||
- animTarget == staffspinhitanim ||
- animTarget == staffgroundsmashanim ||
- animTarget == spinkickreversalanim ||
- animTarget == sweepreversalanim ||
- animTarget == lowkickanim ||
- animTarget == sweepreversedanim ||
- animTarget == rabbitkickreversalanim ||
- animTarget == rabbitkickreversedanim ||
- animTarget == jumpreversalanim ||
- animTarget == jumpreversedanim) {
+ animTarget == staffspinhitreversalanim ||
+ animTarget == staffspinhitreversedanim ||
+ animTarget == staffhitreversalanim ||
+ animTarget == staffhitreversedanim ||
+ animTarget == hurtidleanim ||
+ animTarget == winduppunchanim ||
+ animTarget == swordslashreversalanim ||
+ animTarget == swordslashreversedanim ||
+ animTarget == knifeslashreversalanim ||
+ animTarget == knifeslashreversedanim ||
+ animTarget == knifethrowanim ||
+ animTarget == knifefollowanim ||
+ animTarget == knifefollowedanim ||
+ animTarget == killanim ||
+ animTarget == dropkickanim ||
+ animTarget == upunchanim ||
+ animTarget == knifeslashstartanim ||
+ animTarget == swordslashanim ||
+ animTarget == staffhitanim ||
+ animTarget == staffspinhitanim ||
+ animTarget == staffgroundsmashanim ||
+ animTarget == spinkickreversalanim ||
+ animTarget == sweepreversalanim ||
+ animTarget == lowkickanim ||
+ animTarget == sweepreversedanim ||
+ animTarget == rabbitkickreversalanim ||
+ animTarget == rabbitkickreversedanim ||
+ animTarget == jumpreversalanim ||
+ animTarget == jumpreversedanim) {
//close hands and yell
if (righthandmorphend != 1 &&
- righthandmorphness == targetrighthandmorphness) {
+ righthandmorphness == targetrighthandmorphness) {
righthandmorphness = 0;
righthandmorphend = 1;
targetrighthandmorphness = 1;
}
if (lefthandmorphend != 1 &&
- lefthandmorphness == targetlefthandmorphness) {
+ lefthandmorphness == targetlefthandmorphness) {
lefthandmorphness = 0;
lefthandmorphend = 1;
targetlefthandmorphness = 1;
Normalise(&facing);
if (isRun() ||
- animTarget == sneakanim || animTarget == rollanim || animTarget == walkanim) {
+ animTarget == sneakanim || animTarget == rollanim || animTarget == walkanim) {
if (onterrain)
targettilt2 = -facing.y * 20;
else
velocity = flatfacing * velspeed;
}
-
if ((animTarget == bounceidleanim || animCurrent == hurtidleanim) && (animCurrent == fightidleanim || animCurrent == knifefightidleanim)) {
velocity -= facing * multiplier * speed * 700 * scale;
velspeed = findLength(&velocity);
velspeed = findLength(&velocity);
}
-
if (animTarget == jumpupanim || animTarget == jumpdownanim || isFlip()) {
velocity.y += gravity * multiplier;
}
}
if (animTarget == jumpdownanim || isFlip()) {
- if (isFlip())jumppower = -4;
+ if (isFlip())
+ jumppower = -4;
animTarget = getLanding();
emit_sound_at(landsound, coords, 128.);
onterrain = 1;
}
-
if (isIdle() || animTarget == drawrightanim || animTarget == drawleftanim || animTarget == crouchdrawrightanim || animTarget == crouchstabanim || animTarget == swordgroundstabanim || isStop() || animTarget == removeknifeanim || animTarget == crouchremoveknifeanim || isLanding() || isCrouch() || Animation::animations[animTarget].attack || (animTarget == rollanim && targetFrame().label == 6)) {
velspeed = findLength(&velocity);
velocity.y = 0;
}
}
-
/* EFFECT
* inverse kinematics helper function
*/
-void IKHelper(Person *p, float interp)
+void IKHelper(Person* p, float interp)
{
XYZ point, change, change2;
float heightleft, heightright;
if ((dead != 2 || skeleton.free != 2) && updatedelay <= 0) {
if (!isSleeping() && !isSitting()) {
// TODO: give these meaningful names
- const bool cond1 = (isIdle() || isCrouch() || isLanding() || isLandhard()
- || animTarget == drawrightanim || animTarget == drawleftanim || animTarget == crouchdrawrightanim);
- const bool cond2 = (wasIdle() || wasCrouch() || wasLanding() || wasLandhard()
- || animCurrent == drawrightanim || animCurrent == drawleftanim || animCurrent == crouchdrawrightanim);
+ const bool cond1 = (isIdle() || isCrouch() || isLanding() || isLandhard() || animTarget == drawrightanim || animTarget == drawleftanim || animTarget == crouchdrawrightanim);
+ const bool cond2 = (wasIdle() || wasCrouch() || wasLanding() || wasLandhard() || animCurrent == drawrightanim || animCurrent == drawleftanim || animCurrent == crouchdrawrightanim);
if (onterrain && (cond1 && cond2) && !skeleton.free) {
IKHelper(this, 1);
if (!skeleton.free)
glRotatef(tilt, 0, 0, 1);
-
glTranslatef(mid.x, mid.y, mid.z);
skeleton.muscles[i].lastrotate1 = skeleton.muscles[i].rotate1;
if (playerdetail || skeleton.free == 3) {
for (unsigned j = 0; j < skeleton.muscles[i].vertices.size(); j++) {
- XYZ &v0 = skeleton.model[start].vertex[skeleton.muscles[i].vertices[j]];
- XYZ &v1 = skeleton.model[endthing].vertex[skeleton.muscles[i].vertices[j]];
+ XYZ& v0 = skeleton.model[start].vertex[skeleton.muscles[i].vertices[j]];
+ XYZ& v1 = skeleton.model[endthing].vertex[skeleton.muscles[i].vertices[j]];
glMatrixMode(GL_MODELVIEW);
glPushMatrix();
if (p1 == abdomen || p2 == abdomen)
}
if (!playerdetail || skeleton.free == 3) {
for (unsigned j = 0; j < skeleton.muscles[i].verticeslow.size(); j++) {
- XYZ &v0 = skeleton.modellow.vertex[skeleton.muscles[i].verticeslow[j]];
+ XYZ& v0 = skeleton.modellow.vertex[skeleton.muscles[i].verticeslow[j]];
glMatrixMode(GL_MODELVIEW);
glPushMatrix();
if (p1 == abdomen || p2 == abdomen)
glRotatef(-skeleton.muscles[i].lastrotate3, 0, 1, 0);
for (unsigned j = 0; j < skeleton.muscles[i].verticesclothes.size(); j++) {
- XYZ &v0 = skeleton.modelclothes.vertex[skeleton.muscles[i].verticesclothes[j]];
+ XYZ& v0 = skeleton.modelclothes.vertex[skeleton.muscles[i].verticesclothes[j]];
glMatrixMode(GL_MODELVIEW);
glPushMatrix();
if (p1 == abdomen || p2 == abdomen)
glBegin(GL_POINTS);
if (playerdetail) {
for (int i = 0; i < skeleton.drawmodel.vertexNum; i++) {
- XYZ &v0 = skeleton.drawmodel.vertex[i];
+ XYZ& v0 = skeleton.drawmodel.vertex[i];
glVertex3f(v0.x, v0.y, v0.z);
}
}
if (playerdetail) {
for (unsigned int i = 0; i < skeleton.drawmodel.Triangles.size(); i++) {
- const XYZ &v0 = skeleton.drawmodel.getTriangleVertex(i, 0);
- const XYZ &v1 = skeleton.drawmodel.getTriangleVertex(i, 1);
- const XYZ &v2 = skeleton.drawmodel.getTriangleVertex(i, 2);
+ const XYZ& v0 = skeleton.drawmodel.getTriangleVertex(i, 0);
+ const XYZ& v1 = skeleton.drawmodel.getTriangleVertex(i, 1);
+ const XYZ& v2 = skeleton.drawmodel.getTriangleVertex(i, 2);
glVertex3f(v0.x, v0.y, v0.z);
glVertex3f(v1.x, v1.y, v1.z);
glVertex3f(v1.x, v1.y, v1.z);
}
}
-
if (Tutorial::active && id != 0) {
glPopMatrix();
glMatrixMode(GL_MODELVIEW);
return 0;
}
-
/* FUNCTION?
*/
-int Person::SphereCheck(XYZ *p1, float radius, XYZ *p, XYZ *move, float *rotate, Model *model)
+int Person::SphereCheck(XYZ* p1, float radius, XYZ* p, XYZ* move, float* rotate, Model* model)
{
static float distance;
static float olddistance;
distance = abs((model->Triangles[j].facenormal.x * p1->x) + (model->Triangles[j].facenormal.y * p1->y) + (model->Triangles[j].facenormal.z * p1->z) - ((model->Triangles[j].facenormal.x * model->vertex[model->Triangles[j].vertex[0]].x) + (model->Triangles[j].facenormal.y * model->vertex[model->Triangles[j].vertex[0]].y) + (model->Triangles[j].facenormal.z * model->vertex[model->Triangles[j].vertex[0]].z)));
if (distance < radius) {
point = *p1 - model->Triangles[j].facenormal * distance;
- if (PointInTriangle( &point, model->Triangles[j].facenormal, &model->vertex[model->Triangles[j].vertex[0]], &model->vertex[model->Triangles[j].vertex[1]], &model->vertex[model->Triangles[j].vertex[2]]))
+ if (PointInTriangle(&point, model->Triangles[j].facenormal, &model->vertex[model->Triangles[j].vertex[0]], &model->vertex[model->Triangles[j].vertex[1]], &model->vertex[model->Triangles[j].vertex[2]]))
intersecting = 1;
if (!intersecting)
intersecting = sphere_line_intersection(&model->vertex[model->Triangles[j].vertex[0]],
intersecting = 0;
start = *p1;
start.y -= radius / 4;
- XYZ &v0 = model->vertex[model->Triangles[j].vertex[0]];
- XYZ &v1 = model->vertex[model->Triangles[j].vertex[1]];
- XYZ &v2 = model->vertex[model->Triangles[j].vertex[2]];
- distance = abs((model->Triangles[j].facenormal.x * start.x)
- + (model->Triangles[j].facenormal.y * start.y)
- + (model->Triangles[j].facenormal.z * start.z)
- - ((model->Triangles[j].facenormal.x * v0.x)
- + (model->Triangles[j].facenormal.y * v0.y)
- + (model->Triangles[j].facenormal.z * v0.z)));
+ XYZ& v0 = model->vertex[model->Triangles[j].vertex[0]];
+ XYZ& v1 = model->vertex[model->Triangles[j].vertex[1]];
+ XYZ& v2 = model->vertex[model->Triangles[j].vertex[2]];
+ distance = abs((model->Triangles[j].facenormal.x * start.x) + (model->Triangles[j].facenormal.y * start.y) + (model->Triangles[j].facenormal.z * start.z) - ((model->Triangles[j].facenormal.x * v0.x) + (model->Triangles[j].facenormal.y * v0.y) + (model->Triangles[j].facenormal.z * v0.z)));
if (distance < radius * .5) {
point = start - model->Triangles[j].facenormal * distance;
- if (PointInTriangle( &point, model->Triangles[j].facenormal, &v0, &v1, &v2))
+ if (PointInTriangle(&point, model->Triangles[j].facenormal, &v0, &v1, &v2))
intersecting = 1;
if (!intersecting)
intersecting = sphere_line_intersection(v0.x, v0.y, v0.z, v1.x, v1.y, v1.z, p1->x, p1->y, p1->z, radius / 2);
connected = 0;
if (Game::numpathpointconnect[j])
for (int k = 0; k < Game::numpathpointconnect[j]; k++) {
- if (Game::pathpointconnect[j][k] == last)connected = 1;
+ if (Game::pathpointconnect[j][k] == last)
+ connected = 1;
}
if (!connected)
if (Game::numpathpointconnect[last])
for (int k = 0; k < Game::numpathpointconnect[last]; k++) {
- if (Game::pathpointconnect[last][k] == j)connected = 1;
+ if (Game::pathpointconnect[last][k] == j)
+ connected = 1;
}
if (connected)
if (closest == -1 || Random() % 2 == 0) {
float tintg = clothestintg[clothesId];
float tintb = clothestintb[clothesId];
- if (tintr > 1) tintr = 1;
- if (tintg > 1) tintg = 1;
- if (tintb > 1) tintb = 1;
+ if (tintr > 1)
+ tintr = 1;
+ if (tintg > 1)
+ tintg = 1;
+ if (tintb > 1)
+ tintb = 1;
- if (tintr < 0) tintr = 0;
- if (tintg < 0) tintg = 0;
- if (tintb < 0) tintb = 0;
+ if (tintr < 0)
+ tintr = 0;
+ if (tintg < 0)
+ tintg = 0;
+ if (tintb < 0)
+ tintb = 0;
int bytesPerPixel = texture.bpp / 8;
pause = 0;
if (distsqflat(&Person::players[0]->coords, &coords) < 30 &&
- Person::players[0]->coords.y > coords.y + 2 &&
- !Person::players[0]->onterrain)
+ Person::players[0]->coords.y > coords.y + 2 &&
+ !Person::players[0]->onterrain)
pause = 1;
//pathfinding
DistancePointLine(&finalfinaltarget, &Game::pathpoint[j], &Game::pathpoint[Game::pathpointconnect[j][k]], &tempdist, &colpoint);
if (sq(tempdist) < closestdistance)
if (findDistance(&colpoint, &Game::pathpoint[j]) + findDistance(&colpoint, &Game::pathpoint[Game::pathpointconnect[j][k]]) <
- findDistance(&Game::pathpoint[j], &Game::pathpoint[Game::pathpointconnect[j][k]]) + .1) {
+ findDistance(&Game::pathpoint[j], &Game::pathpoint[Game::pathpointconnect[j][k]]) + .1) {
closestdistance = sq(tempdist);
closest = j;
finaltarget = colpoint;
}
}
finalpathfindpoint = closest;
-
}
if (targetpathfindpoint == -1) {
float closestdistance;
for (int j = 0; j < Game::numpathpoints; j++)
if (j != lastpathfindpoint)
for (int k = 0; k < Game::numpathpointconnect[j]; k++) {
- DistancePointLine(&coords, &Game::pathpoint[j], &Game::pathpoint[Game::pathpointconnect[j][k]], &tempdist, &colpoint );
+ DistancePointLine(&coords, &Game::pathpoint[j], &Game::pathpoint[Game::pathpointconnect[j][k]], &tempdist, &colpoint);
if (sq(tempdist) < closestdistance) {
if (findDistance(&colpoint, &Game::pathpoint[j]) + findDistance(&colpoint, &Game::pathpoint[Game::pathpointconnect[j][k]]) <
- findDistance(&Game::pathpoint[j], &Game::pathpoint[Game::pathpointconnect[j][k]]) + .1) {
+ findDistance(&Game::pathpoint[j], &Game::pathpoint[Game::pathpointconnect[j][k]]) + .1) {
closestdistance = sq(tempdist);
closest = j;
}
} else {
for (int j = 0; j < Game::numpathpoints; j++)
if (j != lastpathfindpoint &&
- j != lastpathfindpoint2 &&
- j != lastpathfindpoint3 &&
- j != lastpathfindpoint4) {
+ j != lastpathfindpoint2 &&
+ j != lastpathfindpoint3 &&
+ j != lastpathfindpoint4) {
bool connected = 0;
if (Game::numpathpointconnect[j])
for (int k = 0; k < Game::numpathpointconnect[j]; k++)
lastpathfindpoint4 = lastpathfindpoint3;
targetpathfindpoint = -1;
}
- if ( distsqflat(&coords, &finalfinaltarget) <
- distsqflat(&coords, &finaltarget) ||
- distsqflat(&coords, &finaltarget) < .6 * sq(scale * 5) ||
- lastpathfindpoint == finalpathfindpoint) {
+ if (distsqflat(&coords, &finalfinaltarget) <
+ distsqflat(&coords, &finaltarget) ||
+ distsqflat(&coords, &finaltarget) < .6 * sq(scale * 5) ||
+ lastpathfindpoint == finalpathfindpoint) {
aitype = passivetype;
}
jumpkeydown = 1;
if ((!Tutorial::active || cananger) &&
- hostile &&
- !Person::players[0]->dead &&
- distsq(&coords, &Person::players[0]->coords) < 400 &&
- occluded < 25) {
+ hostile &&
+ !Person::players[0]->dead &&
+ distsq(&coords, &Person::players[0]->coords) < 400 &&
+ occluded < 25) {
if (distsq(&coords, &Person::players[0]->coords) < 12 &&
- Animation::animations[Person::players[0]->animTarget].height != lowheight &&
- !Game::editorenabled &&
- (Person::players[0]->coords.y < coords.y + 5 || Person::players[0]->onterrain))
+ Animation::animations[Person::players[0]->animTarget].height != lowheight &&
+ !Game::editorenabled &&
+ (Person::players[0]->coords.y < coords.y + 5 || Person::players[0]->onterrain))
aitype = attacktypecutoff;
if (distsq(&coords, &Person::players[0]->coords) < 30 &&
- Animation::animations[Person::players[0]->animTarget].height == highheight &&
- !Game::editorenabled)
+ Animation::animations[Person::players[0]->animTarget].height == highheight &&
+ !Game::editorenabled)
aitype = attacktypecutoff;
if (losupdatedelay < 0 && !Game::editorenabled && occluded < 2) {
if (distsq(&coords, &Person::players[j]->coords) < 400)
if (normaldotproduct(facing, Person::players[j]->coords - coords) > 0)
if (Person::players[j]->coords.y < coords.y + 5 || Person::players[j]->onterrain)
- if (!Person::players[j]->isWallJump() && -1 == Object::checkcollide(
- DoRotation(jointPos(head), 0, yaw, 0)
- *scale + coords,
- DoRotation(Person::players[j]->jointPos(head), 0, Person::players[j]->yaw, 0)
- *Person::players[j]->scale + Person::players[j]->coords) ||
- (Person::players[j]->animTarget == hanganim &&
- normaldotproduct(Person::players[j]->facing, coords - Person::players[j]->coords) < 0)) {
+ if (!Person::players[j]->isWallJump() && -1 == Object::checkcollide(DoRotation(jointPos(head), 0, yaw, 0) * scale + coords, DoRotation(Person::players[j]->jointPos(head), 0, Person::players[j]->yaw, 0) * Person::players[j]->scale + Person::players[j]->coords) ||
+ (Person::players[j]->animTarget == hanganim &&
+ normaldotproduct(Person::players[j]->facing, coords - Person::players[j]->coords) < 0)) {
aitype = searchtype;
lastchecktime = 12;
lastseen = Person::players[j]->coords;
waypoint++;
if (waypoint > numwaypoints - 1)
waypoint = 0;
-
}
}
if ((collided > .8 && jumppower >= 5))
jumpkeydown = 1;
-
//hearing sounds
if (!Game::editorenabled) {
if (howactive <= typesleeping)
if (numenvsounds > 0 && (!Tutorial::active || cananger) && hostile)
for (int j = 0; j < numenvsounds; j++) {
float vol = howactive == typesleeping ? envsoundvol[j] - 14 : envsoundvol[j];
- if (vol > 0 && distsq(&coords, &envsound[j]) <
- 2 * (vol + vol * (creature == rabbittype) * 3))
+ if (vol > 0 && distsq(&coords, &envsound[j]) < 2 * (vol + vol * (creature == rabbittype) * 3))
aitype = attacktypecutoff;
}
}
if (howactive < typesleeping &&
- ((!Tutorial::active || cananger) && hostile) &&
- !Person::players[0]->dead &&
- distsq(&coords, &Person::players[0]->coords) < 400 &&
- occluded < 25) {
+ ((!Tutorial::active || cananger) && hostile) &&
+ !Person::players[0]->dead &&
+ distsq(&coords, &Person::players[0]->coords) < 400 &&
+ occluded < 25) {
if (distsq(&coords, &Person::players[0]->coords) < 12 &&
- Animation::animations[Person::players[0]->animTarget].height != lowheight && !Game::editorenabled)
+ Animation::animations[Person::players[0]->animTarget].height != lowheight && !Game::editorenabled)
aitype = attacktypecutoff;
if (distsq(&coords, &Person::players[0]->coords) < 30 &&
- Animation::animations[Person::players[0]->animTarget].height == highheight && !Game::editorenabled)
+ Animation::animations[Person::players[0]->animTarget].height == highheight && !Game::editorenabled)
aitype = attacktypecutoff;
//wolf smell
if (distsq(&coords, &Person::players[j]->coords) < 400)
if (normaldotproduct(facing, Person::players[j]->coords - coords) > 0)
if ((-1 == Object::checkcollide(
- DoRotation(jointPos(head), 0, yaw, 0)*
- scale + coords,
- DoRotation(Person::players[j]->jointPos(head), 0, Person::players[j]->yaw, 0)*
- Person::players[j]->scale + Person::players[j]->coords) &&
- !Person::players[j]->isWallJump()) ||
- (Person::players[j]->animTarget == hanganim &&
- normaldotproduct(Person::players[j]->facing, coords - Person::players[j]->coords) < 0)) {
+ DoRotation(jointPos(head), 0, yaw, 0) *
+ scale +
+ coords,
+ DoRotation(Person::players[j]->jointPos(head), 0, Person::players[j]->yaw, 0) *
+ Person::players[j]->scale +
+ Person::players[j]->coords) &&
+ !Person::players[j]->isWallJump()) ||
+ (Person::players[j]->animTarget == hanganim &&
+ normaldotproduct(Person::players[j]->facing, coords - Person::players[j]->coords) < 0)) {
lastseentime -= .2;
if (j == 0 && Animation::animations[Person::players[j]->animTarget].height == lowheight)
lastseentime -= .4;
}
if (!Person::players[0]->dead &&
- losupdatedelay < 0 &&
- !Game::editorenabled &&
- occluded < 2 &&
- ((!Tutorial::active || cananger) && hostile)) {
+ losupdatedelay < 0 &&
+ !Game::editorenabled &&
+ occluded < 2 &&
+ ((!Tutorial::active || cananger) && hostile)) {
losupdatedelay = .2;
if (distsq(&coords, &Person::players[0]->coords) < 4 && Animation::animations[animTarget].height != lowheight) {
aitype = attacktypecutoff;
if (distsq(&coords, &Person::players[0]->coords) < 400)
if (normaldotproduct(facing, Person::players[0]->coords - coords) > 0)
if ((Object::checkcollide(
- DoRotation(jointPos(head), 0, yaw, 0)*
- scale + coords,
- DoRotation(Person::players[0]->jointPos(head), 0, Person::players[0]->yaw, 0)*
- Person::players[0]->scale + Person::players[0]->coords) == -1) ||
- (Person::players[0]->animTarget == hanganim && normaldotproduct(
- Person::players[0]->facing, coords - Person::players[0]->coords) < 0)) {
+ DoRotation(jointPos(head), 0, yaw, 0) *
+ scale +
+ coords,
+ DoRotation(Person::players[0]->jointPos(head), 0, Person::players[0]->yaw, 0) *
+ Person::players[0]->scale +
+ Person::players[0]->coords) == -1) ||
+ (Person::players[0]->animTarget == hanganim && normaldotproduct(Person::players[0]->facing, coords - Person::players[0]->coords) < 0)) {
/* //TODO: changed j to 0 on a whim, make sure this is correct
(Person::players[j]->animTarget==hanganim&&normaldotproduct(
Person::players[j]->facing,coords-Person::players[j]->coords)<0)
float closestdist = -1;
for (unsigned k = 0; k < Person::players.size(); k++) {
if ((k != id) && (k != 0) && !Person::players[k]->dead &&
- (Person::players[k]->howactive < typedead1) &&
- !Person::players[k]->skeleton.free &&
- (Person::players[k]->aitype == passivetype)) {
+ (Person::players[k]->howactive < typedead1) &&
+ !Person::players[k]->skeleton.free &&
+ (Person::players[k]->aitype == passivetype)) {
float distance = distsq(&coords, &Person::players[k]->coords);
if (closestdist == -1 || distance < closestdist) {
closestdist = distance;
lastseentime = 12;
}
-
lastchecktime = 12;
XYZ facing = coords;
//no available ally, run back to player
if (ally <= 0 ||
- Person::players[ally]->skeleton.free ||
- Person::players[ally]->aitype != passivetype ||
- lastseentime <= 0) {
+ Person::players[ally]->skeleton.free ||
+ Person::players[ally]->aitype != passivetype ||
+ lastseentime <= 0) {
aitype = searchtype;
lastseentime = 12;
}
if (!Person::players[0]->dead)
if (ally >= 0) {
if (weapons[ally].owner != -1 ||
- distsq(&coords, &weapons[ally].position) > 16) {
+ distsq(&coords, &weapons[ally].position) > 16) {
aitype = attacktypecutoff;
lastseentime = 1;
}
aiupdatedelay = .05;
forwardkeydown = 1;
-
if (avoidcollided > .8 && !jumpkeydown && collided < .8) {
if (!avoidsomething)
targetyaw += 90 * (whichdirection * 2 - 1);
throwkeydown = 1;
crouchkeydown = 0;
if (animTarget != crouchremoveknifeanim &&
- animTarget != removeknifeanim)
+ animTarget != removeknifeanim)
throwtogglekeydown = 0;
drawkeydown = 0;
}
//dodge or reverse rabbit kicks, knife throws, flips
if (damage < damagetolerance * 2 / 3)
if ((Person::players[0]->animTarget == rabbitkickanim ||
- Person::players[0]->animTarget == knifethrowanim ||
- (Person::players[0]->isFlip() &&
- normaldotproduct(Person::players[0]->facing, Person::players[0]->coords - coords) < 0)) &&
- !Person::players[0]->skeleton.free &&
- (aiupdatedelay < .1)) {
+ Person::players[0]->animTarget == knifethrowanim ||
+ (Person::players[0]->isFlip() &&
+ normaldotproduct(Person::players[0]->facing, Person::players[0]->coords - coords) < 0)) &&
+ !Person::players[0]->skeleton.free &&
+ (aiupdatedelay < .1)) {
attackkeydown = 0;
if (isIdle())
crouchkeydown = 1;
}
//get confused by flips
if (Person::players[0]->isFlip() &&
- !Person::players[0]->skeleton.free &&
- Person::players[0]->animTarget != walljumprightkickanim &&
- Person::players[0]->animTarget != walljumpleftkickanim) {
+ !Person::players[0]->skeleton.free &&
+ Person::players[0]->animTarget != walljumprightkickanim &&
+ Person::players[0]->animTarget != walljumpleftkickanim) {
if (distsq(&Person::players[0]->coords, &coords) < 25)
if ((1 - damage / damagetolerance) > .5)
stunned = 1;
if (damage < damagetolerance / 2)
if (Animation::animations[animTarget].height != highheight)
if (damage < damagetolerance * .5 &&
- ((Person::players[0]->animTarget == walljumprightkickanim ||
- Person::players[0]->animTarget == walljumpleftkickanim) &&
- ((aiupdatedelay < .15 &&
- difficulty == 2) ||
- (aiupdatedelay < .08 &&
- difficulty != 2)))) {
+ ((Person::players[0]->animTarget == walljumprightkickanim ||
+ Person::players[0]->animTarget == walljumpleftkickanim) &&
+ ((aiupdatedelay < .15 &&
+ difficulty == 2) ||
+ (aiupdatedelay < .08 &&
+ difficulty != 2)))) {
crouchkeydown = 1;
}
//walked off a ledge (?)
}
//lose sight of player in the air (?)
if (Person::players[0]->coords.y > coords.y + 5 &&
- Animation::animations[Person::players[0]->animTarget].height != highheight &&
- !Person::players[0]->onterrain) {
+ Animation::animations[Person::players[0]->animTarget].height != highheight &&
+ !Person::players[0]->onterrain) {
aitype = pathfindtype;
finalfinaltarget = waypoints[waypoint];
finalpathfindpoint = -1;
}
//it's time to think (?)
if (aiupdatedelay < 0 &&
- !Animation::animations[animTarget].attack &&
- animTarget != staggerbackhighanim &&
- animTarget != staggerbackhardanim &&
- animTarget != backhandspringanim &&
- animTarget != dodgebackanim) {
+ !Animation::animations[animTarget].attack &&
+ animTarget != staggerbackhighanim &&
+ animTarget != staggerbackhardanim &&
+ animTarget != backhandspringanim &&
+ animTarget != dodgebackanim) {
//draw weapon
if (weaponactive == -1 && num_weapons > 0)
drawkeydown = Random() % 2;
XYZ rotatetarget = Person::players[0]->coords + Person::players[0]->velocity;
XYZ targetpoint = Person::players[0]->coords;
if (distsq(&Person::players[0]->coords, &coords) <
- distsq(&rotatetarget, &coords))
+ distsq(&rotatetarget, &coords))
targetpoint += Person::players[0]->velocity *
findDistance(&Person::players[0]->coords, &coords) / findLength(&velocity);
targetyaw = roughDirectionTo(coords, targetpoint);
//TODO: wat
if (aitype != playercontrolled &&
- (isIdle() ||
- isCrouch() ||
- isRun())) {
+ (isIdle() ||
+ isCrouch() ||
+ isRun())) {
int target = -2;
for (unsigned j = 0; j < Person::players.size(); j++)
if (j != id && !Person::players[j]->skeleton.free &&
- Person::players[j]->hasvictim &&
- (Tutorial::active && reversaltrain ||
- Random() % 2 == 0 && difficulty == 2 ||
- Random() % 4 == 0 && difficulty == 1 ||
- Random() % 8 == 0 && difficulty == 0 ||
- Person::players[j]->lastattack2 == Person::players[j]->animTarget &&
+ Person::players[j]->hasvictim &&
+ (Tutorial::active && reversaltrain ||
+ Random() % 2 == 0 && difficulty == 2 ||
+ Random() % 4 == 0 && difficulty == 1 ||
+ Random() % 8 == 0 && difficulty == 0 ||
+ Person::players[j]->lastattack2 == Person::players[j]->animTarget &&
Person::players[j]->lastattack3 == Person::players[j]->animTarget &&
(Random() % 2 == 0 || difficulty == 2) ||
- (isIdle() || isRun()) &&
+ (isIdle() || isRun()) &&
Person::players[j]->weaponactive != -1 ||
- Person::players[j]->animTarget == swordslashanim &&
+ Person::players[j]->animTarget == swordslashanim &&
weaponactive != -1 ||
- Person::players[j]->animTarget == staffhitanim ||
- Person::players[j]->animTarget == staffspinhitanim))
+ Person::players[j]->animTarget == staffhitanim ||
+ Person::players[j]->animTarget == staffspinhitanim))
if (distsq(&Person::players[j]->coords, &Person::players[j]->victim->coords) < 4 &&
- Person::players[j]->victim == Person::players[id] &&
- (Person::players[j]->animTarget == sweepanim ||
- Person::players[j]->animTarget == spinkickanim ||
- Person::players[j]->animTarget == staffhitanim ||
- Person::players[j]->animTarget == staffspinhitanim ||
- Person::players[j]->animTarget == winduppunchanim ||
- Person::players[j]->animTarget == upunchanim ||
- Person::players[j]->animTarget == wolfslapanim ||
- Person::players[j]->animTarget == knifeslashstartanim ||
- Person::players[j]->animTarget == swordslashanim &&
+ Person::players[j]->victim == Person::players[id] &&
+ (Person::players[j]->animTarget == sweepanim ||
+ Person::players[j]->animTarget == spinkickanim ||
+ Person::players[j]->animTarget == staffhitanim ||
+ Person::players[j]->animTarget == staffspinhitanim ||
+ Person::players[j]->animTarget == winduppunchanim ||
+ Person::players[j]->animTarget == upunchanim ||
+ Person::players[j]->animTarget == wolfslapanim ||
+ Person::players[j]->animTarget == knifeslashstartanim ||
+ Person::players[j]->animTarget == swordslashanim &&
(distsq(&Person::players[j]->coords, &coords) < 2 ||
weaponactive != -1))) {
if (target >= 0) {
if (collided < 1)
jumpkeydown = 0;
if (collided > .8 && jumppower >= 5 ||
- distsq(&coords, &Person::players[0]->coords) > 400 &&
+ distsq(&coords, &Person::players[0]->coords) > 400 &&
onterrain &&
creature == rabbittype)
jumpkeydown = 1;
if (normaldotproduct(facing, Person::players[0]->coords - coords) > 0)
Person::players[0]->jumpkeydown = 0;
if (Person::players[0]->animTarget == jumpdownanim &&
- distsq(&Person::players[0]->coords, &coords) < 40)
+ distsq(&Person::players[0]->coords, &coords) < 40)
crouchkeydown = 1;
if (jumpkeydown)
attackkeydown = 0;
if (!canattack)
attackkeydown = 0;
-
XYZ facing = coords;
XYZ flatfacing = Person::players[0]->coords;
facing.y += jointPos(head).y * scale;
if (!pause)
lastseentime -= .2;
if (lastseentime <= 0 &&
- (creature != wolftype ||
- weaponstuck == -1)) {
+ (creature != wolftype ||
+ weaponstuck == -1)) {
aitype = searchtype;
lastchecktime = 12;
lastseen = Person::players[0]->coords;
}
}
if (Animation::animations[Person::players[0]->animTarget].height == highheight &&
- (aitype == attacktypecutoff ||
- aitype == searchtype))
+ (aitype == attacktypecutoff ||
+ aitype == searchtype))
if (Person::players[0]->coords.y > terrain.getHeight(Person::players[0]->coords.x, Person::players[0]->coords.z) + 10) {
XYZ test = Person::players[0]->coords;
test.y -= 40;
}
//stunned
if (aitype == passivetype && !(numwaypoints > 1) ||
- stunned > 0 ||
- pause && damage > superpermanentdamage) {
+ stunned > 0 ||
+ pause && damage > superpermanentdamage) {
if (pause)
lastseentime = 1;
targetyaw = yaw;
throwkeydown = 0;
}
-
XYZ facing;
facing = 0;
facing.z = -1;