mirror of
				https://github.com/OpenMW/openmw.git
				synced 2025-10-31 16:56:42 +00:00 
			
		
		
		
	The player should now be able to run AND walk...
This commit is contained in:
		
							parent
							
								
									f96f53484c
								
							
						
					
					
						commit
						5aec3815fd
					
				
					 2 changed files with 59 additions and 11 deletions
				
			
		|  | @ -61,6 +61,7 @@ namespace MWInput | |||
|       A_CycleWeaponLeft,//Cycling through weapons
 | ||||
|       A_CycleWeaponRight, | ||||
|       A_ToggleSneak, 	//Toggles Sneak, add Push-Sneak later
 | ||||
|       A_ToggleWalk,	//Toggle Walking/Running
 | ||||
| 
 | ||||
|       A_QuickSave, | ||||
|       A_QuickLoad, | ||||
|  | @ -145,6 +146,11 @@ namespace MWInput | |||
| 	player.setmAutoMove(true); | ||||
|     } | ||||
| 
 | ||||
|     void toggleWalking()  | ||||
|     { | ||||
| 	player.setmisWalking(true); | ||||
|     } | ||||
| 
 | ||||
|     // Exit program now button (which is disabled in GUI mode)
 | ||||
|     void exitNow() | ||||
|     { | ||||
|  | @ -188,6 +194,8 @@ namespace MWInput | |||
|                        "Activate"); | ||||
|       disp->funcs.bind(A_AutoMove, boost::bind(&InputImpl::toggleAutoMove, this), | ||||
|                       "Auto Move"); | ||||
|       disp->funcs.bind(A_ToggleWalk, boost::bind(&InputImpl::toggleWalking, this), | ||||
|                       "Toggle Walk/Run"); | ||||
| 
 | ||||
|       // Add the exit listener
 | ||||
|       ogre.getRoot()->addFrameListener(&exit); | ||||
|  | @ -233,6 +241,7 @@ namespace MWInput | |||
|       disp->bind(A_Activate, KC_SPACE); | ||||
|       disp->bind(A_AutoMove, KC_Z); | ||||
|       disp->bind(A_ToggleSneak, KC_X); | ||||
|       disp->bind(A_ToggleWalk, KC_C); | ||||
| 
 | ||||
|       // Key bindings for polled keys
 | ||||
|       // NOTE: These keys are constantly being polled. Only add keys that must be checked each frame.
 | ||||
|  | @ -271,7 +280,10 @@ namespace MWInput | |||
|       // Disable movement in Gui mode
 | ||||
|       if(windows.isGuiMode()) return true; | ||||
| 
 | ||||
|       float speed = 300 * evt.timeSinceLastFrame; | ||||
|       float speed = 300 * evt.timeSinceLastFrame;		//is this a placeholder player speed? 
 | ||||
|       float TESTwalkSpeed = 100 * evt.timeSinceLastFrame;	//Try this, then.
 | ||||
|       float TESTsneakSpeed = 100 * evt.timeSinceLastFrame;	//and this.
 | ||||
| 
 | ||||
|       float moveX = 0, moveY = 0, moveZ = 0; | ||||
|       | ||||
|       //execute Automove - condition checked in function
 | ||||
|  | @ -280,26 +292,50 @@ namespace MWInput | |||
|       //Poll and execute movement keys - will disable automove if pressed.
 | ||||
|       if(poller.isDown(A_MoveLeft))  | ||||
|       {  | ||||
|         player.setmAutoMove(false); | ||||
|       	moveX -= speed; | ||||
|         if (player.getmisWalking() == false)  | ||||
| 	  { | ||||
|       	     player.setmAutoMove(false); | ||||
|              moveX -= speed; | ||||
| 	  } else { | ||||
| 	     player.setmAutoMove(false); | ||||
|              moveX -= TESTwalkSpeed; | ||||
| 	  } | ||||
|       } | ||||
| 
 | ||||
|       if(poller.isDown(A_MoveRight))  | ||||
|       {  | ||||
|       player.setmAutoMove(false); | ||||
|       moveX += speed; | ||||
| 	  if (player.getmisWalking() == false)  | ||||
| 	  { | ||||
|       	     player.setmAutoMove(false); | ||||
|              moveX += speed; | ||||
| 	  } else { | ||||
| 	     player.setmAutoMove(false); | ||||
|              moveX += TESTwalkSpeed; | ||||
| 	  } | ||||
|       } | ||||
| 
 | ||||
|       if(poller.isDown(A_MoveForward)) | ||||
|       {  | ||||
|           player.setmAutoMove(false);  | ||||
|           moveZ -= speed; | ||||
|           if (player.getmisWalking() == false)  | ||||
| 	  { | ||||
|       	     player.setmAutoMove(false); | ||||
|              moveZ -= speed; | ||||
| 	  } else { | ||||
| 	     player.setmAutoMove(false); | ||||
|              moveZ -= TESTwalkSpeed; | ||||
| 	  } | ||||
|       } | ||||
| 
 | ||||
|       if(poller.isDown(A_MoveBackward)) | ||||
|       {  | ||||
| 	  player.setmAutoMove(false);  | ||||
| 	  moveZ += speed; | ||||
| 	  if (player.getmisWalking() == false)  | ||||
| 	  { | ||||
|       	     player.setmAutoMove(false); | ||||
|              moveZ += speed; | ||||
| 	  } else { | ||||
| 	     player.setmAutoMove(false); | ||||
|              moveZ += TESTwalkSpeed; | ||||
| 	  } | ||||
|       } | ||||
| 
 | ||||
| 
 | ||||
|  |  | |||
|  | @ -32,8 +32,9 @@ namespace MWWorld | |||
|         bool mCollisionMode; | ||||
| 
 | ||||
| 	bool mAutoMove; | ||||
| 	bool misSneaking; | ||||
| 	bool misHidden; | ||||
| 	//bool misSneaking;
 | ||||
| 	//bool misHidden;
 | ||||
| 	bool misWalking;	//Testing...
 | ||||
| 
 | ||||
|     public: | ||||
| 
 | ||||
|  | @ -134,6 +135,17 @@ namespace MWWorld | |||
| 	     } | ||||
| 	} | ||||
| 
 | ||||
| 	bool getmisWalking()  | ||||
| 	{  | ||||
| 		return this.misWalking;  | ||||
| 	} | ||||
| 
 | ||||
| 	void setmisWalking(bool setMe)  | ||||
| 	{ | ||||
| 		this.misWalking = setMe; | ||||
| 	} | ||||
| 
 | ||||
| 
 | ||||
| 
 | ||||
|   }; | ||||
| } | ||||
|  |  | |||
		Loading…
	
		Reference in a new issue