From 3e4e4e00f12ba2663c01904dda005a520fe4fcdd Mon Sep 17 00:00:00 2001 From: hikerstk Date: Tue, 26 Oct 2010 06:30:39 +0000 Subject: [PATCH] Forgotten controller/* in previous patch. They now also define a proper slowdown on end controller without stopping on hills. git-svn-id: svn+ssh://svn.code.sf.net/p/supertuxkart/code/main/trunk@6340 178a84e3-b1eb-0310-8ba1-8eac791a3b58 --- src/karts/controller/default_ai_controller.cpp | 8 ++++---- src/karts/controller/end_controller.cpp | 3 ++- src/karts/controller/new_ai_controller.cpp | 8 ++++---- 3 files changed, 10 insertions(+), 9 deletions(-) diff --git a/src/karts/controller/default_ai_controller.cpp b/src/karts/controller/default_ai_controller.cpp index 9f2a63a6e..7daad18d3 100644 --- a/src/karts/controller/default_ai_controller.cpp +++ b/src/karts/controller/default_ai_controller.cpp @@ -155,7 +155,7 @@ void DefaultAIController::reset() { m_time_since_last_shot = 0.0f; m_start_kart_crash_direction = 0; - m_curve_target_speed = m_kart->getMaxSpeedOnTerrain(); + m_curve_target_speed = m_kart->getCurrentMaxSpeed(); m_curve_angle = 0.0; m_start_delay = -1.0f; m_crash_time = 0.0f; @@ -685,7 +685,7 @@ void DefaultAIController::handleAcceleration( const float dt) if(m_kart->hasViewBlockedByPlunger()) { - if(!(m_kart->getSpeed() > m_kart->getMaxSpeedOnTerrain() / 2)) + if(!(m_kart->getSpeed() > m_kart->getCurrentMaxSpeed() / 2)) m_controls->m_accel = 0.05f; else m_controls->m_accel = 0.0f; @@ -764,7 +764,7 @@ void DefaultAIController::handleNitroAndZipper() { m_controls->m_nitro = false; // If we are already very fast, save nitro. - if(m_kart->getSpeed() > 0.95f*m_kart->getMaxSpeedOnTerrain()) + if(m_kart->getSpeed() > 0.95f*m_kart->getCurrentMaxSpeed()) return; // Don't use nitro when the AI has a plunger in the face! if(m_kart->hasViewBlockedByPlunger()) return; @@ -1040,5 +1040,5 @@ void DefaultAIController::findCurve() -m_quad_graph->getAngleToNext(m_track_node, m_successor_index[m_track_node]) ); - m_curve_target_speed = m_kart->getMaxSpeedOnTerrain(); + m_curve_target_speed = m_kart->getCurrentMaxSpeed(); } // findCurve diff --git a/src/karts/controller/end_controller.cpp b/src/karts/controller/end_controller.cpp index d645caf5d..28950a2af 100644 --- a/src/karts/controller/end_controller.cpp +++ b/src/karts/controller/end_controller.cpp @@ -94,6 +94,7 @@ EndController::EndController(Kart *kart, StateManager::ActivePlayer *player) #ifdef AI_DEBUG m_debug_sphere = irr_driver->getSceneManager()->addSphereSceneNode(1); #endif + m_kart->setSlowdown(MaxSpeed::MS_DECREASE_AI, 0.3f, 2); } // EndController //----------------------------------------------------------------------------- @@ -143,7 +144,7 @@ void EndController::update(float dt) m_controls->m_look_back = false; m_controls->m_nitro = false; m_controls->m_brake = false; - m_controls->m_accel = 0.3f; + m_controls->m_accel = 1.0f; // Update the current node: if(m_track_node!=QuadGraph::UNKNOWN_SECTOR) diff --git a/src/karts/controller/new_ai_controller.cpp b/src/karts/controller/new_ai_controller.cpp index 05465b5dc..163a021c4 100644 --- a/src/karts/controller/new_ai_controller.cpp +++ b/src/karts/controller/new_ai_controller.cpp @@ -571,7 +571,7 @@ void NewAIController::handleAcceleration( const float DELTA ) if(m_kart->hasViewBlockedByPlunger()) { - if(!(m_kart->getSpeed() > m_kart->getMaxSpeedOnTerrain() / 2)) + if(!(m_kart->getSpeed() > m_kart->getCurrentMaxSpeed() / 2)) m_controls->m_accel = 0.05f; else m_controls->m_accel = 0.0f; @@ -642,7 +642,7 @@ void NewAIController::handleNitroAndZipper() { m_controls->m_nitro = false; // If we are already very fast, save nitro. - if(m_kart->getSpeed() > 0.95f*m_kart->getMaxSpeedOnTerrain()) + if(m_kart->getSpeed() > 0.95f*m_kart->getCurrentMaxSpeed()) return; // Don't use nitro when the AI has a plunger in the face! if(m_kart->hasViewBlockedByPlunger()) return; @@ -865,7 +865,7 @@ void NewAIController::reset() { m_time_since_last_shot = 0.0f; m_start_kart_crash_direction = 0; - m_curve_target_speed = m_kart->getMaxSpeedOnTerrain(); + m_curve_target_speed = m_kart->getCurrentMaxSpeed(); m_curve_angle = 0.0; m_time_till_start = -1.0f; m_crash_time = 0.0f; @@ -939,5 +939,5 @@ void NewAIController::findCurve() -m_quad_graph->getAngleToNext(m_track_node, m_successor_index[m_track_node]) ); - m_curve_target_speed = m_kart->getMaxSpeedOnTerrain(); + m_curve_target_speed = m_kart->getCurrentMaxSpeed(); } // findCurve