From d08aaf50515cf3fcf03e6523976258b02f6b2e95 Mon Sep 17 00:00:00 2001 From: Nguyễn Gia Phong Date: Fri, 25 Aug 2023 03:07:59 +0900 Subject: Narrow visions flag to a bool --- src/Person.cpp | 22 ++++++++++++++++------ 1 file changed, 16 insertions(+), 6 deletions(-) (limited to 'src/Person.cpp') 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; -- cgit 1.4.1