summary refs log tree commit diff
path: root/src/Person.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'src/Person.cpp')
-rw-r--r--src/Person.cpp72
1 files changed, 43 insertions, 29 deletions
diff --git a/src/Person.cpp b/src/Person.cpp
index d02d002..9e49cbb 100644
--- a/src/Person.cpp
+++ b/src/Person.cpp
@@ -17,6 +17,8 @@
 // You should have received a copy of the GNU General Public License
 // along with Black Shades.  If not, see <https://www.gnu.org/licenses/>.
 
+#include <GLFW/glfw3.h>
+
 #include "Person.h"
 
 extern float multiplier;
@@ -680,42 +682,47 @@ void 	Person::DoStuff(int who){
 		if(visions==0&&targetanimation==joganim)speed=2.2;
 		if(visions==0&&targetanimation!=joganim)speed=1.3;
 		if(visions==0&&targetanimation==walkanim)speed=2.5;
-		unsigned char	theKeyMap[16];
-		GetKeys( ( unsigned long * )theKeyMap );
 
-		if(IsKeyDown( theKeyMap, MAC_SHIFT_KEY )||visions==1){
-			moveanim=joganim;
-		}else{
+		if (IsKeyDown(GLFW_KEY_LEFT_SHIFT) || visions == 1)
+			moveanim = joganim;
+		else
 			moveanim=walkanim;
+		if (IsKeyDown(GLFW_KEY_LEFT_CONTROL)
+		    && currentanimation == idleanim
+		    && targetanimation == idleanim) {
+			targetanimation = crouchanim;
+			target = 0;
 		}
-		if(IsKeyDown( theKeyMap, MAC_CONTROL_KEY )&&currentanimation==idleanim&&targetanimation==idleanim){
-			targetanimation=crouchanim;
-			target=0;
-		}
-		if(!IsKeyDown( theKeyMap, MAC_CONTROL_KEY )&&currentanimation==crouchanim&&targetanimation==crouchanim){
-			targetanimation=idleanim;
-			target=0;
+		if (!IsKeyDown(GLFW_KEY_LEFT_CONTROL)
+		    && currentanimation == crouchanim
+		    && targetanimation == crouchanim) {
+			targetanimation = idleanim;
+			target = 0;
 		}
 		if((onground||(who==0&&visions==1))&&currentanimation!=crouchanim){
-			if ( IsKeyDown( theKeyMap, forwardskey )&&!( IsKeyDown( theKeyMap, backwardskey ))){
+			if (IsKeyDown(forwardskey) && !IsKeyDown(backwardskey)) {
 				if(targetanimation!=moveanim)targetframe=0;
 				targetanimation=moveanim;
 			}
-			if ( IsKeyDown( theKeyMap, rightkey )&&!( IsKeyDown( theKeyMap, leftkey ))){
+			if (IsKeyDown(rightkey) && !IsKeyDown(leftkey)) {
 				if(targetanimation!=moveanim)targetframe=0;
 				targetanimation=moveanim;
 				playerlowrotation-=90;
-				if(IsKeyDown( theKeyMap, forwardskey ))playerlowrotation+=45;
-				if(IsKeyDown( theKeyMap, backwardskey ))playerlowrotation-=235;
+				if (IsKeyDown(forwardskey))
+					playerlowrotation += 45;
+				if (IsKeyDown(backwardskey))
+					playerlowrotation -= 235;
 			}
-			if ( IsKeyDown( theKeyMap, leftkey )&&!( IsKeyDown( theKeyMap, rightkey ))){
+			if (IsKeyDown(leftkey) && !IsKeyDown(rightkey)) {
 				if(targetanimation!=moveanim)targetframe=0;
 				targetanimation=moveanim;
 				playerlowrotation+=90;
-				if(IsKeyDown( theKeyMap, forwardskey ))playerlowrotation-=45;
-				if(IsKeyDown( theKeyMap, backwardskey ))playerlowrotation+=235;
+				if (IsKeyDown(forwardskey))
+					playerlowrotation -= 45;
+				if (IsKeyDown(backwardskey))
+					playerlowrotation += 235;
 			}
-			if ( IsKeyDown( theKeyMap, backwardskey )){
+			if (IsKeyDown(backwardskey)) {
 				if(targetanimation!=moveanim)targetframe=0;
 				targetanimation=moveanim;
 				backwardsanim=1;
@@ -724,31 +731,36 @@ void 	Person::DoStuff(int who){
 		//air control
 		if(!onground){
 			float oldplayerrotation=playerrotation;
-			if ( IsKeyDown( theKeyMap, forwardskey )&&!( IsKeyDown( theKeyMap, backwardskey ))){
+			if (IsKeyDown(forwardskey) && !IsKeyDown(backwardskey)) {
 				facing=0;
 				facing.z=1;
 				facing=DoRotation(facing,0,playerrotation,0);
 				velocity=velocity+facing*multiplier*4;
 			}
-			if ( IsKeyDown( theKeyMap, rightkey )&&!( IsKeyDown( theKeyMap, leftkey ))){
+			if (IsKeyDown(rightkey) && !IsKeyDown(leftkey)) {
 				playerrotation-=90;
-				if(IsKeyDown( theKeyMap, forwardskey ))playerrotation+=45;
-				if(IsKeyDown( theKeyMap, backwardskey ))playerrotation-=45;
+				if (IsKeyDown(forwardskey))
+					playerrotation += 45;
+				if (IsKeyDown(backwardskey))
+					playerrotation -= 45;
 				facing=0;
 				facing.z=1;
 				facing=DoRotation(facing,0,playerrotation,0);
 				velocity=velocity+facing*multiplier*4;
 			}
-			if ( IsKeyDown( theKeyMap, leftkey )&&!( IsKeyDown( theKeyMap, rightkey ))){
+			if (IsKeyDown(leftkey) && !IsKeyDown(rightkey)) {
 				playerrotation+=90;
-				if(IsKeyDown( theKeyMap, forwardskey ))playerrotation-=45;
-				if(IsKeyDown( theKeyMap, backwardskey ))playerrotation+=45;
+				if (IsKeyDown(forwardskey))
+					playerrotation -= 45;
+				if (IsKeyDown(backwardskey))
+					playerrotation += 45;
 				facing=0;
 				facing.z=1;
 				facing=DoRotation(facing,0,playerrotation,0);
 				velocity=velocity+facing*multiplier*4;
 			}
-			if ( IsKeyDown( theKeyMap, backwardskey )&&!IsKeyDown( theKeyMap, forwardskey )&&!IsKeyDown( theKeyMap, leftkey )&&!IsKeyDown( theKeyMap, rightkey )){
+			if (IsKeyDown(backwardskey) && !IsKeyDown(forwardskey)
+			    && !IsKeyDown(leftkey) && !IsKeyDown(rightkey)) {
 				playerrotation+=180;
 				facing=0;
 				facing.z=1;
@@ -757,7 +769,9 @@ void 	Person::DoStuff(int who){
 			}
 			playerrotation=oldplayerrotation;
 		}
-		if(!IsKeyDown( theKeyMap, forwardskey )&&!IsKeyDown( theKeyMap, leftkey )&&!IsKeyDown( theKeyMap, rightkey )&&!IsKeyDown( theKeyMap, backwardskey )&&(targetanimation==joganim||targetanimation==walkanim)){
+		if (!IsKeyDown(forwardskey) && !IsKeyDown(leftkey)
+		    && !IsKeyDown(rightkey) && !IsKeyDown(backwardskey)
+		    && (targetanimation==joganim||targetanimation==walkanim)) {
 			if(!(targetanimation==walkanim&&(targetframe==0||targetframe==2))){
 				targetanimation=idleanim;
 				targetframe=0;