88#include " PedestrianStates.h"
99#include " Vehicle.h"
1010#include " TimeManager.h"
11- #include " GameCheatsWindow.h"
1211
1312Pedestrian::Pedestrian (GameObjectID id) : GameObject(eGameObjectClass_Pedestrian, id)
1413 , mPhysicsBody()
@@ -86,22 +85,11 @@ void Pedestrian::UpdateFrame()
8685 mStatesManager .ProcessFrame ();
8786}
8887
89- void Pedestrian::DrawFrame (SpriteBatch& spriteBatch )
88+ void Pedestrian::PreDrawFrame ( )
9089{
9190 glm::vec3 position = mPhysicsBody ->mSmoothPosition ;
9291 ComputeDrawHeight (position);
9392
94- if (!gGameCheatsWindow .mEnableDrawPedestrians )
95- return ;
96-
97- ePedestrianState currState = GetCurrentStateID ();
98- if (currState == ePedestrianState_DrivingCar)
99- {
100- // dont draw pedestrian if it in car with hard top
101- if (mDrawHeight < mCurrentCar ->mDrawHeight ) // todo: check car props
102- return ;
103- }
104-
10593 cxx::angle_t rotationAngle = mPhysicsBody ->GetRotationAngle () - cxx::angle_t::from_degrees (SPRITE_ZERO_ANGLE);
10694
10795 int spriteIndex = mCurrentAnimState .GetCurrentFrame ();
@@ -113,7 +101,6 @@ void Pedestrian::DrawFrame(SpriteBatch& spriteBatch)
113101 mDrawSprite .mRotateAngle = rotationAngle;
114102 mDrawSprite .mHeight = mDrawHeight ;
115103 mDrawSprite .SetOriginToCenter ();
116- spriteBatch.DrawSprite (mDrawSprite );
117104}
118105
119106void Pedestrian::DrawDebug (DebugRenderer& debugRender)
@@ -136,10 +123,8 @@ void Pedestrian::ComputeDrawHeight(const glm::vec3& position)
136123{
137124 if (mCurrentCar )
138125 {
139- bool isBike = (mCurrentCar ->mCarStyle ->mVType == eCarVType_Motorcycle);
140126 // dont draw pedestrian if it in car with hard top
141- if ((mCurrentCar ->mCarStyle ->mConvertible == eCarConvertible_HardTop ||
142- mCurrentCar ->mCarStyle ->mConvertible == eCarConvertible_HardTopAnimated) && !isBike)
127+ if (mCurrentCar ->HasHardTop ())
143128 {
144129 mDrawHeight = mCurrentCar ->mDrawHeight - 0 .01f ; // todo: magic numbers
145130 }
0 commit comments