diff options
| author | Nguyễn Gia Phong <cnx@loang.net> | 2023-08-25 03:07:59 +0900 |
|---|---|---|
| committer | Nguyễn Gia Phong <cnx@loang.net> | 2023-08-25 03:07:59 +0900 |
| commit | d08aaf50515cf3fcf03e6523976258b02f6b2e95 (patch) | |
| tree | 08a1eaf05b05b41c3c612769e1b249eef41b9c46 /src/Person.cpp | |
| parent | 95cdcaf3214a29cbe6ea5d39ac4616eefd963b03 (diff) | |
| download | blackshades-d08aaf50515cf3fcf03e6523976258b02f6b2e95.tar.gz | |
Narrow visions flag to a bool
Diffstat (limited to 'src/Person.cpp')
| -rw-r--r-- | src/Person.cpp | 22 |
1 files changed, 16 insertions, 6 deletions
diff --git a/src/Person.cpp b/src/Person.cpp index 0115a89..1c5ce32 100644 --- a/src/Person.cpp +++ b/src/Person.cpp @@ -29,7 +29,7 @@ extern float multiplier; extern unsigned int gSourceID[37]; extern Animation animation[30]; extern int thirdperson; -extern int visions; +extern bool visions; extern Camera camera; extern float rad2deg; extern Model gunmodels[10]; @@ -671,10 +671,9 @@ void Person::DoStuff(int who) playerrotation = playerlowrotation - 70; } - if (who == 0) + if (who == 0) { camera.rotation = 180 - playerrotation; - - if(who!=0&&visions==0){ + } else if (!visions) { if(targetanimation!=walkanim&&targetanimation!=zombiewalkanim)speed=1.0*speedmult; if(targetanimation==walkanim||targetanimation==zombiewalkanim)speed=1.8*speedmult; playerlowrotation=playerrotation; @@ -694,12 +693,23 @@ void Person::DoStuff(int who) if(onground) velocity = {}; - if(((currentanimation==joganim||currentanimation==zombiejoganim||currentanimation==diveanim)&&onground)||(who==0&&visions==1&&((currentanimation==joganim||currentanimation==walkanim||currentanimation==diveanim)||(currentanimation==zombiejoganim||currentanimation==zombiewalkanim)))){ + if (((currentanimation == joganim + || currentanimation == zombiejoganim + || currentanimation == diveanim) + && onground) + || ((currentanimation == joganim + || currentanimation == zombiejoganim + || currentanimation == diveanim + || currentanimation == walkanim + || currentanimation == zombiewalkanim) + && who == 0 && visions)) { playercoords+=facing*multiplier*15*speed; velocity.x=facing.x*15*speed; velocity.z=facing.z*15*speed; } - if((currentanimation==walkanim||currentanimation==zombiewalkanim)&&onground&&(who!=0||visions==0)){ + if ((currentanimation == walkanim + || currentanimation == zombiewalkanim) + && onground && (who != 0 || !visions)) { playercoords+=facing*multiplier*4*speed; velocity.x=facing.x*4*speed; velocity.z=facing.z*4*speed; |
