Fix some bugs and copyright year
This commit is contained in:
parent
62f5be0d9d
commit
e1f1461488
@ -1,7 +1,7 @@
|
|||||||
//
|
//
|
||||||
// SuperTuxKart - a fun racing game with go-kart
|
// SuperTuxKart - a fun racing game with go-kart
|
||||||
// Copyright (C) 2006-2009 Eduardo Hernandez Munoz
|
// Copyright (C) 2006-2009 Eduardo Hernandez Munoz
|
||||||
// Copyright (C) 2009, 2010 Joerg Henrichs
|
// Copyright (C) 2009-2015 Joerg Henrichs
|
||||||
//
|
//
|
||||||
// This program is free software; you can redistribute it and/or
|
// This program is free software; you can redistribute it and/or
|
||||||
// modify it under the terms of the GNU General Public License
|
// modify it under the terms of the GNU General Public License
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
//
|
//
|
||||||
// SuperTuxKart - a fun racing game with go-kart
|
// SuperTuxKart - a fun racing game with go-kart
|
||||||
// Copyright (C) 2010 Joerg Henrichs
|
// Copyright (C) 2010-2015 Joerg Henrichs
|
||||||
// This program is free software; you can redistribute it and/or
|
// This program is free software; you can redistribute it and/or
|
||||||
// modify it under the terms of the GNU General Public License
|
// modify it under the terms of the GNU General Public License
|
||||||
// as published by the Free Software Foundation; either version 3
|
// as published by the Free Software Foundation; either version 3
|
||||||
|
@ -18,15 +18,12 @@
|
|||||||
// along with this program; if not, write to the Free Software
|
// along with this program; if not, write to the Free Software
|
||||||
// Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
// Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
||||||
|
|
||||||
//#define AI_DEBUG
|
#undef AI_DEBUG
|
||||||
#include <iostream>
|
|
||||||
using namespace std;
|
|
||||||
|
|
||||||
#include "karts/controller/battle_ai.hpp"
|
#include "karts/controller/battle_ai.hpp"
|
||||||
|
|
||||||
//#ifdef AI_DEBUG
|
#ifdef AI_DEBUG
|
||||||
#include "graphics/irr_driver.hpp"
|
#include "graphics/irr_driver.hpp"
|
||||||
//#endif
|
#endif
|
||||||
|
|
||||||
#include "items/attachment.hpp"
|
#include "items/attachment.hpp"
|
||||||
#include "items/item_manager.hpp"
|
#include "items/item_manager.hpp"
|
||||||
@ -201,7 +198,7 @@ void BattleAI::handleSteering(const float dt)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
//After this AI kart has a powerup, try to follow a closet kart in the map
|
// After this AI kart has a powerup, try to follow a closest kart in the map
|
||||||
findClosestKart(&m_target_point , &m_target_node);
|
findClosestKart(&m_target_point , &m_target_node);
|
||||||
if (m_target_node == BattleGraph::UNKNOWN_POLY) return;
|
if (m_target_node == BattleGraph::UNKNOWN_POLY) return;
|
||||||
|
|
||||||
@ -252,7 +249,7 @@ void BattleAI::findClosestKart(Vec3* aim_point, int* target_node)
|
|||||||
const AbstractKart* kart = m_world->getKart(i);
|
const AbstractKart* kart = m_world->getKart(i);
|
||||||
if(kart->isEliminated()) continue;
|
if(kart->isEliminated()) continue;
|
||||||
|
|
||||||
if (kart->getXYZ() == m_kart->getXYZ())
|
if (kart->getWorldKartId() == m_kart->getWorldKartId())
|
||||||
continue; // Skip the same kart
|
continue; // Skip the same kart
|
||||||
|
|
||||||
Vec3 d = kart->getXYZ() - m_kart->getXYZ();
|
Vec3 d = kart->getXYZ() - m_kart->getXYZ();
|
||||||
|
@ -21,6 +21,7 @@
|
|||||||
#include <IMeshSceneNode.h>
|
#include <IMeshSceneNode.h>
|
||||||
|
|
||||||
#include "audio/music_manager.hpp"
|
#include "audio/music_manager.hpp"
|
||||||
|
#include "config/user_config.hpp"
|
||||||
#include "graphics/camera.hpp"
|
#include "graphics/camera.hpp"
|
||||||
#include "graphics/irr_driver.hpp"
|
#include "graphics/irr_driver.hpp"
|
||||||
#include "io/file_manager.hpp"
|
#include "io/file_manager.hpp"
|
||||||
@ -178,7 +179,8 @@ void ThreeStrikesBattle::kartHit(const unsigned int kart_id)
|
|||||||
if(wheels[1]) wheels[1]->setVisible(false);
|
if(wheels[1]) wheels[1]->setVisible(false);
|
||||||
if(wheels[2]) wheels[2]->setVisible(false);
|
if(wheels[2]) wheels[2]->setVisible(false);
|
||||||
if(wheels[3]) wheels[3]->setVisible(false);
|
if(wheels[3]) wheels[3]->setVisible(false);
|
||||||
eliminateKart(kart_id, /*notify_of_elimination*/ true);
|
if (getCurrentNumPlayers())
|
||||||
|
eliminateKart(kart_id, /*notify_of_elimination*/ true);
|
||||||
// Find a camera of the kart with the most lives ("leader"), and
|
// Find a camera of the kart with the most lives ("leader"), and
|
||||||
// attach all cameras for this kart to the leader.
|
// attach all cameras for this kart to the leader.
|
||||||
int max_lives = 0;
|
int max_lives = 0;
|
||||||
@ -196,7 +198,7 @@ void ThreeStrikesBattle::kartHit(const unsigned int kart_id)
|
|||||||
}
|
}
|
||||||
// leader could be 0 if the last two karts hit each other in
|
// leader could be 0 if the last two karts hit each other in
|
||||||
// the same frame
|
// the same frame
|
||||||
if(leader)
|
if(leader && getCurrentNumPlayers())
|
||||||
{
|
{
|
||||||
for(unsigned int i=0; i<Camera::getNumCameras(); i++)
|
for(unsigned int i=0; i<Camera::getNumCameras(); i++)
|
||||||
{
|
{
|
||||||
@ -418,7 +420,9 @@ void ThreeStrikesBattle::updateKartRanks()
|
|||||||
bool ThreeStrikesBattle::isRaceOver()
|
bool ThreeStrikesBattle::isRaceOver()
|
||||||
{
|
{
|
||||||
// for tests : never over when we have a single player there :)
|
// for tests : never over when we have a single player there :)
|
||||||
if (race_manager->getNumPlayers() < 2)
|
if (race_manager->getNumberOfKarts()==1 &&
|
||||||
|
getCurrentNumKarts()==1 &&
|
||||||
|
UserConfigParams::m_artist_debug_mode)
|
||||||
{
|
{
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
@ -432,6 +436,8 @@ bool ThreeStrikesBattle::isRaceOver()
|
|||||||
*/
|
*/
|
||||||
void ThreeStrikesBattle::updateKartNodes()
|
void ThreeStrikesBattle::updateKartNodes()
|
||||||
{
|
{
|
||||||
|
if (isRaceOver()) return;
|
||||||
|
|
||||||
const unsigned int n = getNumKarts();
|
const unsigned int n = getNumKarts();
|
||||||
for(unsigned int i=0; i<n; i++)
|
for(unsigned int i=0; i<n; i++)
|
||||||
{
|
{
|
||||||
|
@ -197,7 +197,7 @@ public:
|
|||||||
case MINOR_MODE_NORMAL_RACE: return true;
|
case MINOR_MODE_NORMAL_RACE: return true;
|
||||||
case MINOR_MODE_TIME_TRIAL: return true;
|
case MINOR_MODE_TIME_TRIAL: return true;
|
||||||
case MINOR_MODE_FOLLOW_LEADER: return true;
|
case MINOR_MODE_FOLLOW_LEADER: return true;
|
||||||
case MINOR_MODE_3_STRIKES: return false;
|
case MINOR_MODE_3_STRIKES: return true;
|
||||||
case MINOR_MODE_EASTER_EGG: return false;
|
case MINOR_MODE_EASTER_EGG: return false;
|
||||||
case MINOR_MODE_SOCCER: return false;
|
case MINOR_MODE_SOCCER: return false;
|
||||||
default: assert(false); return false;
|
default: assert(false); return false;
|
||||||
|
@ -156,7 +156,13 @@ void TrackInfoScreen::init()
|
|||||||
if (num_ai < 0) num_ai = 0;
|
if (num_ai < 0) num_ai = 0;
|
||||||
m_ai_kart_spinner->setValue(num_ai);
|
m_ai_kart_spinner->setValue(num_ai);
|
||||||
race_manager->setNumKarts(num_ai + race_manager->getNumLocalPlayers());
|
race_manager->setNumKarts(num_ai + race_manager->getNumLocalPlayers());
|
||||||
m_ai_kart_spinner->setMax(stk_config->m_max_karts - race_manager->getNumLocalPlayers());
|
// Currently battle arena only has 4 starting position
|
||||||
|
if(race_manager->getMinorMode()==RaceManager::MINOR_MODE_3_STRIKES)
|
||||||
|
{
|
||||||
|
m_ai_kart_spinner->setMax(4 - race_manager->getNumLocalPlayers());
|
||||||
|
}
|
||||||
|
else
|
||||||
|
m_ai_kart_spinner->setMax(stk_config->m_max_karts - race_manager->getNumLocalPlayers());
|
||||||
// A ftl reace needs at least three karts to make any sense
|
// A ftl reace needs at least three karts to make any sense
|
||||||
if(race_manager->getMinorMode()==RaceManager::MINOR_MODE_FOLLOW_LEADER)
|
if(race_manager->getMinorMode()==RaceManager::MINOR_MODE_FOLLOW_LEADER)
|
||||||
{
|
{
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
//
|
//
|
||||||
// SuperTuxKart - a fun racing game with go-kart
|
// SuperTuxKart - a fun racing game with go-kart
|
||||||
// Copyright (C) 2009 Joerg Henrichs
|
// Copyright (C) 2009-2015 Joerg Henrichs
|
||||||
//
|
//
|
||||||
// This program is free software; you can redistribute it and/or
|
// This program is free software; you can redistribute it and/or
|
||||||
// modify it under the terms of the GNU General Public License
|
// modify it under the terms of the GNU General Public License
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
//
|
//
|
||||||
// SuperTuxKart - a fun racing game with go-kart
|
// SuperTuxKart - a fun racing game with go-kart
|
||||||
// Copyright (C) 2009 Joerg Henrichs
|
// Copyright (C) 2009-2015 Joerg Henrichs
|
||||||
//
|
//
|
||||||
// This program is free software; you can redistribute it and/or
|
// This program is free software; you can redistribute it and/or
|
||||||
// modify it under the terms of the GNU General Public License
|
// modify it under the terms of the GNU General Public License
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
//
|
//
|
||||||
// SuperTuxKart - a fun racing game with go-kart
|
// SuperTuxKart - a fun racing game with go-kart
|
||||||
// Copyright (C) 2009 Joerg Henrichs
|
// Copyright (C) 2009-2015 Joerg Henrichs
|
||||||
//
|
//
|
||||||
// This program is free software; you can redistribute it and/or
|
// This program is free software; you can redistribute it and/or
|
||||||
// modify it under the terms of the GNU General Public License
|
// modify it under the terms of the GNU General Public License
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
//
|
//
|
||||||
// SuperTuxKart - a fun racing game with go-kart
|
// SuperTuxKart - a fun racing game with go-kart
|
||||||
// Copyright (C) 2009 Joerg Henrichs
|
// Copyright (C) 2009-2015 Joerg Henrichs
|
||||||
//
|
//
|
||||||
// This program is free software; you can redistribute it and/or
|
// This program is free software; you can redistribute it and/or
|
||||||
// modify it under the terms of the GNU General Public License
|
// modify it under the terms of the GNU General Public License
|
||||||
|
@ -102,6 +102,10 @@ enum DebugMenuCommand
|
|||||||
DEBUG_GUI_CAM_NORMAL,
|
DEBUG_GUI_CAM_NORMAL,
|
||||||
DEBUG_GUI_CAM_SMOOTH,
|
DEBUG_GUI_CAM_SMOOTH,
|
||||||
DEBUG_GUI_CAM_ATTACH,
|
DEBUG_GUI_CAM_ATTACH,
|
||||||
|
DEBUG_VIEW_KART_ONE,
|
||||||
|
DEBUG_VIEW_KART_TWO,
|
||||||
|
DEBUG_VIEW_KART_THREE,
|
||||||
|
DEBUG_VIEW_KART_FOUR,
|
||||||
DEBUG_HIDE_KARTS,
|
DEBUG_HIDE_KARTS,
|
||||||
DEBUG_THROTTLE_FPS,
|
DEBUG_THROTTLE_FPS,
|
||||||
DEBUG_VISUAL_VALUES,
|
DEBUG_VISUAL_VALUES,
|
||||||
@ -154,7 +158,27 @@ void addAttachment(Attachment::AttachmentType type)
|
|||||||
|
|
||||||
} // addAttachment
|
} // addAttachment
|
||||||
|
|
||||||
|
// ----------------------------------------------------------------------------
|
||||||
|
void changeCameraTarget(u32 num)
|
||||||
|
{
|
||||||
|
World* world = World::getWorld();
|
||||||
|
Camera *cam = Camera::getActiveCamera();
|
||||||
|
if (world == NULL || cam == NULL) return;
|
||||||
|
|
||||||
|
if ((num - 1) < (world->getNumKarts() + 1))
|
||||||
|
{
|
||||||
|
AbstractKart* kart = world->getKart(num - 1);
|
||||||
|
if (kart->isEliminated()) return;
|
||||||
|
cam->setMode(Camera::CM_NORMAL);
|
||||||
|
cam->setKart(kart);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
return;
|
||||||
|
|
||||||
|
} // changeCameraTarget
|
||||||
|
|
||||||
// -----------------------------------------------------------------------------
|
// -----------------------------------------------------------------------------
|
||||||
|
|
||||||
/** returns the light node with the lowest distance to the player kart (excluding
|
/** returns the light node with the lowest distance to the player kart (excluding
|
||||||
* nitro emitters) */
|
* nitro emitters) */
|
||||||
LightNode* findNearestLight()
|
LightNode* findNearestLight()
|
||||||
@ -452,6 +476,22 @@ bool handleContextMenuAction(s32 cmdID)
|
|||||||
Camera *cam = Camera::getActiveCamera();
|
Camera *cam = Camera::getActiveCamera();
|
||||||
cam->setAttachedFpsCam(!cam->getAttachedFpsCam());
|
cam->setAttachedFpsCam(!cam->getAttachedFpsCam());
|
||||||
}
|
}
|
||||||
|
else if (cmdID == DEBUG_VIEW_KART_ONE)
|
||||||
|
{
|
||||||
|
changeCameraTarget(1);
|
||||||
|
}
|
||||||
|
else if (cmdID == DEBUG_VIEW_KART_TWO)
|
||||||
|
{
|
||||||
|
changeCameraTarget(2);
|
||||||
|
}
|
||||||
|
else if (cmdID == DEBUG_VIEW_KART_THREE)
|
||||||
|
{
|
||||||
|
changeCameraTarget(3);
|
||||||
|
}
|
||||||
|
else if (cmdID == DEBUG_VIEW_KART_FOUR)
|
||||||
|
{
|
||||||
|
changeCameraTarget(4);
|
||||||
|
}
|
||||||
else if (cmdID == DEBUG_PRINT_START_POS)
|
else if (cmdID == DEBUG_PRINT_START_POS)
|
||||||
{
|
{
|
||||||
if (!world) return false;
|
if (!world) return false;
|
||||||
@ -643,6 +683,13 @@ bool onEvent(const SEvent &event)
|
|||||||
sub->addItem(L"Toggle smooth camera", DEBUG_GUI_CAM_SMOOTH);
|
sub->addItem(L"Toggle smooth camera", DEBUG_GUI_CAM_SMOOTH);
|
||||||
sub->addItem(L"Attach fps camera to kart", DEBUG_GUI_CAM_ATTACH);
|
sub->addItem(L"Attach fps camera to kart", DEBUG_GUI_CAM_ATTACH);
|
||||||
|
|
||||||
|
mnu->addItem(L"Change camera target >",-1,true, true);
|
||||||
|
sub = mnu->getSubMenu(4);
|
||||||
|
sub->addItem(L"To kart one", DEBUG_VIEW_KART_ONE);
|
||||||
|
sub->addItem(L"To kart two", DEBUG_VIEW_KART_TWO);
|
||||||
|
sub->addItem(L"To kart three", DEBUG_VIEW_KART_THREE);
|
||||||
|
sub->addItem(L"To kart four", DEBUG_VIEW_KART_FOUR);
|
||||||
|
|
||||||
mnu->addItem(L"Adjust values", DEBUG_VISUAL_VALUES);
|
mnu->addItem(L"Adjust values", DEBUG_VISUAL_VALUES);
|
||||||
|
|
||||||
mnu->addItem(L"Profiler", DEBUG_PROFILER);
|
mnu->addItem(L"Profiler", DEBUG_PROFILER);
|
||||||
|
Loading…
Reference in New Issue
Block a user