• R/O
  • SSH
  • HTTPS

gd10: Commit


Commit MetaInfo

Revisão134 (tree)
Hora2019-08-18 16:19:08
Autorhgtterry

Mensagem de Log

Shell 180819

Mudança Sumário

Diff

--- GD_Shell2/Shell2/Shell2/BT_PhysicsListener.cpp (revision 133)
+++ GD_Shell2/Shell2/Shell2/BT_PhysicsListener.cpp (revision 134)
@@ -418,14 +418,61 @@
418418 // Right
419419 if (GetAsyncKeyState(65) < 0)
420420 {
421- mTranslateVector.x = -mMoveScale;
421+ if (GD_CameraMode == Enums::CamDetached)
422+ {
423+ mTranslateVector.x = -mMoveScale;
424+ }
425+ else
426+ {
427+ if (App->GDCL_Player->PlayerAdded == 1)
428+ {
429+ App->GDCL_Player->Move_Right();
430+ App->GDCL_Player->IsMOving_Right = 1;
431+ }
432+ }
422433 }
434+ else
435+ {
436+ if (GD_CameraMode == Enums::CamDetached)
437+ {
438+
439+ }
440+ else if (App->GDCL_Player->PlayerAdded == 1 && App->GDCL_Player->IsMOving_Right == 1)
441+ {
442+ App->GDCL_Player->Stop();
443+ App->GDCL_Player->IsMOving_Right = 0;
444+ }
445+ }
423446 // Left
424447 if (GetAsyncKeyState(68) < 0)
425448 {
426- mTranslateVector.x = mMoveScale;
449+ if (GD_CameraMode == Enums::CamDetached)
450+ {
451+ mTranslateVector.x = mMoveScale;
452+ }
453+ else
454+ {
455+ if (App->GDCL_Player->PlayerAdded == 1)
456+ {
457+ App->GDCL_Player->Move_Left();
458+ App->GDCL_Player->IsMOving_Left = 1;
459+ }
460+ }
427461 }
462+ else
463+ {
464+ if (GD_CameraMode == Enums::CamDetached)
465+ {
428466
467+ }
468+ else if (App->GDCL_Player->PlayerAdded == 1 && App->GDCL_Player->IsMOving_Left == 1)
469+ {
470+ App->GDCL_Player->Stop();
471+ App->GDCL_Player->IsMOving_Left = 0;
472+ }
473+ }
474+
475+
429476 if (GetAsyncKeyState(VK_ESCAPE) < 0) // Back to full Screen;
430477 {
431478 StopOgre = 1;
--- GD_Shell2/Shell2/Shell2/GD_Player.cpp (revision 133)
+++ GD_Shell2/Shell2/Shell2/GD_Player.cpp (revision 134)
@@ -13,6 +13,8 @@
1313
1414 IsMOving = 0;
1515 IsMOving_Back = 0;
16+ IsMOving_Right = 0;
17+ IsMOving_Left = 0;
1618
1719 mOnGround = 1;
1820 Ground_speed = 2.2;
@@ -187,6 +189,74 @@
187189 }
188190
189191 // *************************************************************************
192+// * Move_Right Terry Bernie *
193+// *************************************************************************
194+void GD_Player::Move_Right(void)
195+{
196+ if (PlayerAdded == 1)
197+ {
198+ if (IsMOving == 0)
199+ {
200+
201+ App->Ogre17->PhysicsFrameListener->Animate_State->setEnabled(false);
202+ App->Ogre17->PhysicsFrameListener->Animate_State2->setEnabled(false);
203+ App->Ogre17->PhysicsFrameListener->Animate_State = Player_Ent->getAnimationState("RunBase");
204+ App->Ogre17->PhysicsFrameListener->Animate_State2 = Player_Ent->getAnimationState("RunTop");
205+ App->Ogre17->PhysicsFrameListener->Animate_State->setLoop(true);
206+ App->Ogre17->PhysicsFrameListener->Animate_State2->setLoop(true);
207+ App->Ogre17->PhysicsFrameListener->Animate_State->setEnabled(true);
208+ App->Ogre17->PhysicsFrameListener->Animate_State2->setEnabled(true);
209+
210+ }
211+
212+ btVector3 vel;
213+
214+ btTransform xform = mObject->getWorldTransform();
215+ btVector3 cur = mObject->getLinearVelocity();
216+ btVector3 basis = xform.getBasis()[2];
217+ vel = -Ground_speed * 10 * basis;
218+
219+ mObject->setLinearVelocity(btVector3(vel[2], cur[1], -vel[0]));
220+
221+ Check_Collisions();
222+ }
223+}
224+
225+// *************************************************************************
226+// * Move_Left Terry Bernie *
227+// *************************************************************************
228+void GD_Player::Move_Left(void)
229+{
230+ if (PlayerAdded == 1)
231+ {
232+ if (IsMOving == 0)
233+ {
234+
235+ App->Ogre17->PhysicsFrameListener->Animate_State->setEnabled(false);
236+ App->Ogre17->PhysicsFrameListener->Animate_State2->setEnabled(false);
237+ App->Ogre17->PhysicsFrameListener->Animate_State = Player_Ent->getAnimationState("RunBase");
238+ App->Ogre17->PhysicsFrameListener->Animate_State2 = Player_Ent->getAnimationState("RunTop");
239+ App->Ogre17->PhysicsFrameListener->Animate_State->setLoop(true);
240+ App->Ogre17->PhysicsFrameListener->Animate_State2->setLoop(true);
241+ App->Ogre17->PhysicsFrameListener->Animate_State->setEnabled(true);
242+ App->Ogre17->PhysicsFrameListener->Animate_State2->setEnabled(true);
243+
244+ }
245+
246+ btVector3 vel;
247+
248+ btTransform xform = mObject->getWorldTransform();
249+ btVector3 cur = mObject->getLinearVelocity();
250+ btVector3 basis = xform.getBasis()[2];
251+ vel = -Ground_speed * 10 * basis;
252+
253+ mObject->setLinearVelocity(btVector3(-vel[2], cur[1], vel[0]));
254+
255+ Check_Collisions();
256+ }
257+}
258+
259+// *************************************************************************
190260 // * Back Terry Bernie *
191261 // *************************************************************************
192262 void GD_Player::Back(void)
@@ -265,13 +335,18 @@
265335 // *************************************************************************
266336 void GD_Player::Jump(const Ogre::Vector3 axis, float force)
267337 {
268- if(PlayerAdded == 1)
338+ btVector3 pos = mObject->getWorldTransform().getOrigin();
339+ pos[1] = pos[1] + 0.2;
340+
341+ mObject->getWorldTransform().setOrigin(btVector3(pos[0], pos[1], pos[2]));
342+
343+ /*if(PlayerAdded == 1)
269344 {
270345 if(mOnGround == 1)
271346 {
272347 mObject->applyForce(btVector3(0,330,0),btVector3(0,0,0));
273348 }
274- }
349+ }*/
275350 }
276351
277352 // *************************************************************************
--- GD_Shell2/Shell2/Shell2/GD_Player.h (revision 133)
+++ GD_Shell2/Shell2/Shell2/GD_Player.h (revision 134)
@@ -8,6 +8,9 @@
88 void SetUp(void);
99 void Load_Player(void);
1010
11+ void Move_Right(void);
12+ void Move_Left(void);
13+
1114 void Stop(void);
1215 void Forward(void);
1316 void Back(void);
@@ -32,6 +35,8 @@
3235 bool mOnGround;
3336 bool IsMOving;
3437 bool IsMOving_Back;
38+ bool IsMOving_Right;
39+ bool IsMOving_Left;
3540
3641 int Round;
3742 float Distance;
Show on old repository browser