1) Added DEBUG define which enables some cheats, which are not
to be used in a release. Currently DEBUG enables the F1/2/3 cheats to give a player sparks, missiles, homing missiles, and enables the player to call for a rescue while not touching the ground. 2) Added many casts from size_t to int (and similar), to remove warnings when compiling with windows. 3) Disabled F4 'bullet debug' shortcut, since it doesn't work and it's not too useful anyway. git-svn-id: svn+ssh://svn.code.sf.net/p/supertuxkart/code/trunk/supertuxkart@1333 178a84e3-b1eb-0310-8ba1-8eac791a3b58
This commit is contained in:
parent
18b70c9dd1
commit
d79777f1a2
@ -363,6 +363,13 @@ bullet_LIBS="-L bullet/Demos/OpenGL -lbulletopenglsupport -L bullet/src -lbullet
|
||||
|
||||
AC_SUBST(BULLETTREE)
|
||||
|
||||
dnl =============================================
|
||||
dnl Define debug which enables some cheats
|
||||
dnl This should be DISABLED when doing a release!
|
||||
dnl =============================================
|
||||
AC_DEFINE([DEBUG], [], [Enable debugging cheats and shortcuts])
|
||||
SUMMARY="$SUMMARY\nEnabled cheats for debugging, please disable for a release!!"
|
||||
|
||||
dnl ================
|
||||
dnl Create makefiles
|
||||
dnl ================
|
||||
|
@ -225,7 +225,7 @@ void ConfigDisplay::getScreenModes()
|
||||
|
||||
//Prevent use of very small resolutions
|
||||
const int minRes = 640;
|
||||
m_sizes_size = m_sizes.size();
|
||||
m_sizes_size = (int)m_sizes.size();
|
||||
|
||||
for (int i = m_sizes_size-1; i >= 0; --i)
|
||||
{
|
||||
@ -240,7 +240,7 @@ void ConfigDisplay::getScreenModes()
|
||||
|
||||
// search m_sizes for the current resolution
|
||||
m_sizes_index = -1;
|
||||
m_sizes_size = m_sizes.size();
|
||||
m_sizes_size = (int)m_sizes.size();
|
||||
for (int i = 0; i < m_sizes_size; i++)
|
||||
{
|
||||
if (m_sizes[i].first == user_config->m_width
|
||||
|
@ -39,7 +39,7 @@ public:
|
||||
void getBBox(const std::string &text, int size, bool italic,
|
||||
float *left, float *right, float *bot, float *top)
|
||||
{
|
||||
m_fnt->getBBox(text.c_str(), size, italic, left, right, bot, top);
|
||||
m_fnt->getBBox(text.c_str(), (float)size, italic, left, right, bot, top);
|
||||
}
|
||||
|
||||
// The actual main function which does everything
|
||||
|
@ -130,11 +130,6 @@ RaceGUI::handle(GameAction ga, int value)
|
||||
m_fps_counter=0;
|
||||
}
|
||||
break;
|
||||
#ifdef BULLET
|
||||
case GA_DEBUG_BULLET:
|
||||
user_config->m_bullet_debug = !user_config->m_bullet_debug;
|
||||
break;
|
||||
#endif
|
||||
case GA_DEBUG_TOGGLE_WIREFRAME:
|
||||
glPolygonMode(GL_FRONT_AND_BACK, isWireframe ? GL_FILL : GL_LINE);
|
||||
isWireframe = ! isWireframe;
|
||||
@ -677,12 +672,8 @@ void RaceGUI::drawSpeed(Kart* kart, int offset_x, int offset_y,
|
||||
glTexCoord2f(0, 1);glVertex2i(offset_x , offset_y+height);
|
||||
glEnd () ;
|
||||
|
||||
#ifdef BULLET
|
||||
//convention taken from btRaycastVehicle::updateVehicle
|
||||
const float speed = kart->getSpeed();
|
||||
#else
|
||||
const float speed = kart->getVelocity()->xyz[1];
|
||||
#endif
|
||||
|
||||
if ( !kart->isOnGround() )
|
||||
font_race->PrintShadow("!", (int)(60*minRatio),
|
||||
|
@ -97,4 +97,4 @@ float Homing::steerTowards(btTransform& trans, btVector3& target)
|
||||
if(angle> 180.0f) angle=angle-360.0f;
|
||||
if(angle<-180.0f) angle=angle+360.0f;
|
||||
return angle;
|
||||
} // steerTowards
|
||||
} // steerTowards
|
||||
|
@ -148,7 +148,7 @@ void KartPropertiesManager::fillWithRandomKarts(std::vector<std::string>& vec)
|
||||
i != m_karts_properties.end(); ++i)
|
||||
all_karts.push_back((*i)->getIdent());
|
||||
|
||||
std::srand(std::time(0));
|
||||
std::srand((unsigned int)std::time(0));
|
||||
|
||||
std::random_shuffle(all_karts.begin(), all_karts.end());
|
||||
|
||||
|
@ -46,7 +46,7 @@ MaterialManager::MaterialManager()
|
||||
int MaterialManager::addEntity(Material *m)
|
||||
{
|
||||
m_materials.push_back(m);
|
||||
return m_materials.size()-1;
|
||||
return (int)m_materials.size()-1;
|
||||
}
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
|
@ -147,7 +147,13 @@ void PlayerKart::update(float dt)
|
||||
m_collectable.use() ;
|
||||
m_controls.fire = false;
|
||||
}
|
||||
#ifdef DEBUG
|
||||
// Allow rescuing while still falling ... it's convenient for debugging, but
|
||||
// not for a release
|
||||
if ( m_controls.rescue )
|
||||
#else
|
||||
if ( isOnGround() && m_controls.rescue )
|
||||
#endif
|
||||
{
|
||||
sound_manager -> playSfx ( SOUND_BEEP ) ;
|
||||
forceRescue();
|
||||
|
@ -63,12 +63,12 @@ GrandPrixMode::GrandPrixMode(const std::vector<std::string>& players_,
|
||||
: m_difficulty(difficulty_), m_num_karts(numKarts_), m_players(players_),
|
||||
m_cup(cup_), m_track(0)
|
||||
{
|
||||
const int NUM_PLAYERS = m_players.size();
|
||||
const int NUM_PLAYERS = (int)m_players.size();
|
||||
|
||||
std::vector<std::string> kart_names;
|
||||
|
||||
if(m_num_karts < 0 ) m_num_karts = stk_config->m_max_karts;
|
||||
if((unsigned int)m_num_karts < m_players.size()) m_num_karts = m_players.size();
|
||||
if((size_t)m_num_karts < m_players.size()) m_num_karts = (int)m_players.size();
|
||||
|
||||
kart_names.resize(m_num_karts);
|
||||
|
||||
@ -187,7 +187,7 @@ QuickRaceMode::QuickRaceMode(const std::string& track_,
|
||||
m_num_karts(numKarts_), m_num_laps(numLaps_)
|
||||
{
|
||||
if(m_num_karts < 0 ) m_num_karts = stk_config->m_max_karts;
|
||||
if((unsigned int)m_num_karts < m_players.size()) m_num_karts = m_players.size();
|
||||
if((size_t)m_num_karts < m_players.size()) m_num_karts = (int)m_players.size();
|
||||
}
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
@ -202,7 +202,7 @@ QuickRaceMode::start()
|
||||
raceSetup.m_num_laps = m_num_laps;
|
||||
raceSetup.m_karts.resize(m_num_karts);
|
||||
|
||||
const int FIRST_PLAYER = m_num_karts - m_players.size();
|
||||
const int FIRST_PLAYER = m_num_karts - (int)m_players.size();
|
||||
for(int i = 0; i < int(m_players.size()); ++i)
|
||||
{
|
||||
raceSetup.m_karts[FIRST_PLAYER + i] = m_players[i]; // Players starts last in the race
|
||||
|
@ -183,7 +183,7 @@ void Scene::draw(float dt)
|
||||
|
||||
for (World::Karts::size_type i = 0 ; i < world->getNumKarts(); ++i)
|
||||
{
|
||||
world->getKart(i)->draw();
|
||||
world->getKart((int)i)->draw();
|
||||
}
|
||||
world->getPhysics()->draw();
|
||||
} // bullet_debug
|
||||
|
@ -38,7 +38,7 @@ SkidMark::~SkidMark()
|
||||
{
|
||||
if(!m_skid_marks.empty())
|
||||
{
|
||||
const unsigned int SIZE = m_skid_marks.size() -1;
|
||||
const unsigned int SIZE = (unsigned int)m_skid_marks.size() -1;
|
||||
for(unsigned int i = 0; i < SIZE; ++i)
|
||||
{
|
||||
ssgDeRefDelete(m_skid_marks[i]);
|
||||
@ -52,14 +52,14 @@ void SkidMark::add(sgCoord* coord)
|
||||
{
|
||||
assert(m_skid_marking);
|
||||
|
||||
const int CURRENT = m_skid_marks.size() - 1;
|
||||
const int CURRENT = (int)m_skid_marks.size() - 1;
|
||||
m_skid_marks[CURRENT]->add(coord);
|
||||
} // add
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
void SkidMark::addBreak(sgCoord* coord)
|
||||
{
|
||||
const unsigned int CURRENT = m_skid_marks.size() - 1;
|
||||
const unsigned int CURRENT = (unsigned int)m_skid_marks.size() - 1;
|
||||
if(m_skid_marking)
|
||||
m_skid_marks[CURRENT]->addEnd(coord);
|
||||
else
|
||||
|
@ -177,7 +177,7 @@ float StaticSSG::hot(sgVec3 start, sgVec3 end, ssgLeaf** leaf, sgVec4** nrm)
|
||||
|
||||
float hot = NOINTERSECT;
|
||||
int N_HASH_START = GetHash(start[0], start[1]);
|
||||
int nTriangles = (*m_buckets)[N_HASH_START].size();
|
||||
int nTriangles = (int)(*m_buckets)[N_HASH_START].size();
|
||||
*leaf = NULL;
|
||||
for(int i=0; i<nTriangles; i++)
|
||||
{
|
||||
@ -194,7 +194,7 @@ float StaticSSG::hot(sgVec3 start, sgVec3 end, ssgLeaf** leaf, sgVec4** nrm)
|
||||
if(start[0]==end[0] && start[1]==end[1]) return hot;
|
||||
|
||||
const int HASH_END = GetHash(end[0], end[1]);
|
||||
nTriangles = (*m_buckets)[HASH_END].size();
|
||||
nTriangles = (int)(*m_buckets)[HASH_END].size();
|
||||
for(int i=0; i<nTriangles; i++)
|
||||
{
|
||||
InfoTriangle *t = (*m_buckets)[HASH_END][i];
|
||||
@ -245,7 +245,7 @@ int StaticSSG::collision(sgSphere *s, AllHits *allHits)
|
||||
{ // that should be a car off track
|
||||
continue; // rescue should take care of this
|
||||
}
|
||||
int nCount = (*m_buckets)[N_HASH].size();
|
||||
int nCount = (int)(*m_buckets)[N_HASH].size();
|
||||
for(int k=0; k<nCount; k++)
|
||||
{
|
||||
InfoTriangle *t = (*m_buckets)[N_HASH][k];
|
||||
|
@ -196,21 +196,20 @@ void UserConfig::setDefaults()
|
||||
Input(IT_KEYBOARD, SDLK_F9));
|
||||
set(GA_LEAVE_RACE,
|
||||
Input(IT_KEYBOARD, SDLK_ESCAPE));
|
||||
|
||||
#ifdef DEBUG
|
||||
set(GA_DEBUG_ADD_SPARK,
|
||||
Input(IT_KEYBOARD, SDLK_F1));
|
||||
set(GA_DEBUG_ADD_MISSILE,
|
||||
Input(IT_KEYBOARD, SDLK_F2));
|
||||
set(GA_DEBUG_ADD_HOMING,
|
||||
Input(IT_KEYBOARD, SDLK_F3));
|
||||
#endif
|
||||
set(GA_DEBUG_TOGGLE_FPS,
|
||||
Input(IT_KEYBOARD, SDLK_F12));
|
||||
set(GA_DEBUG_TOGGLE_WIREFRAME,
|
||||
Input(IT_KEYBOARD, SDLK_F11));
|
||||
set(GA_DEBUG_HISTORY,
|
||||
Input(IT_KEYBOARD, SDLK_F10));
|
||||
set(GA_DEBUG_BULLET,
|
||||
Input(IT_KEYBOARD, SDLK_F4));
|
||||
|
||||
// TODO: The following should become a static
|
||||
// array. This allows:
|
||||
|
@ -177,11 +177,11 @@ void Widget::update(const float DELTA)
|
||||
//Y-axis preset positions
|
||||
if( m_scroll_pos_y == WGT_SCROLL_START_TOP )
|
||||
{
|
||||
m_scroll_pos_y = Y_LIMIT / 2 - m_height;
|
||||
m_scroll_pos_y =(float)(Y_LIMIT / 2 - m_height);
|
||||
}
|
||||
else if( m_scroll_pos_y == WGT_SCROLL_START_BOTTOM )
|
||||
{
|
||||
m_scroll_pos_y = Y_LIMIT / 2;
|
||||
m_scroll_pos_y = (float)(Y_LIMIT / 2);
|
||||
}
|
||||
else if( m_scroll_pos_y == WGT_SCROLL_CENTER )
|
||||
{
|
||||
@ -189,11 +189,11 @@ void Widget::update(const float DELTA)
|
||||
}
|
||||
else if( m_scroll_pos_y == WGT_SCROLL_END_TOP )
|
||||
{
|
||||
m_scroll_pos_y = -Y_LIMIT / 2;
|
||||
m_scroll_pos_y = (float)(-Y_LIMIT / 2);
|
||||
}
|
||||
else if( m_scroll_pos_y == WGT_SCROLL_END_BOTTOM )
|
||||
{
|
||||
m_scroll_pos_y = -Y_LIMIT / 2 + m_height;
|
||||
m_scroll_pos_y = (float)(-Y_LIMIT / 2 + m_height);
|
||||
}
|
||||
else if( m_scroll_pos_y > MAX_SCROLL )
|
||||
{
|
||||
@ -211,19 +211,19 @@ void Widget::update(const float DELTA)
|
||||
}
|
||||
else if( m_scroll_pos_x == WGT_SCROLL_START_RIGHT )
|
||||
{
|
||||
m_scroll_pos_x = m_width;
|
||||
m_scroll_pos_x = (float)m_width;
|
||||
}
|
||||
else if( m_scroll_pos_x == WGT_SCROLL_CENTER )
|
||||
{
|
||||
m_scroll_pos_x = (m_width - text_width) / 2;
|
||||
m_scroll_pos_x = (float)( (m_width - text_width) / 2 );
|
||||
}
|
||||
else if( m_scroll_pos_x == WGT_SCROLL_END_LEFT )
|
||||
{
|
||||
m_scroll_pos_x = -text_width;
|
||||
m_scroll_pos_x = (float)(-text_width);
|
||||
}
|
||||
else if( m_scroll_pos_x == WGT_SCROLL_END_RIGHT )
|
||||
{
|
||||
m_scroll_pos_x = -text_width + m_width;
|
||||
m_scroll_pos_x = (float)(-text_width + m_width);
|
||||
}
|
||||
else if( m_scroll_pos_x > MAX_SCROLL )
|
||||
{
|
||||
|
@ -81,13 +81,13 @@ bool WidgetManager::add_wgt
|
||||
new_id.widget->m_text.assign(m_default_text);
|
||||
new_id.widget->m_text_size = m_default_text_size;
|
||||
|
||||
new_id.widget->m_enable_scroll = m_default_enable_scroll;
|
||||
new_id.widget->m_scroll_pos_x = m_default_scroll_x_pos;
|
||||
new_id.widget->m_scroll_pos_y = m_default_scroll_y_pos;
|
||||
new_id.widget->m_scroll_speed_x = m_default_scroll_x_speed;
|
||||
new_id.widget->m_scroll_speed_y = m_default_scroll_y_speed;
|
||||
new_id.widget->m_enable_scroll = m_default_enable_scroll;
|
||||
new_id.widget->m_scroll_pos_x = (float)m_default_scroll_x_pos;
|
||||
new_id.widget->m_scroll_pos_y = (float)m_default_scroll_y_pos;
|
||||
new_id.widget->m_scroll_speed_x = (float)m_default_scroll_x_speed;
|
||||
new_id.widget->m_scroll_speed_y = (float)m_default_scroll_y_speed;
|
||||
|
||||
m_elems.push_back(WidgetElement(ET_WGT, m_widgets.size()));
|
||||
m_elems.push_back(WidgetElement(ET_WGT, (int)m_widgets.size()));
|
||||
m_widgets.push_back(new_id);
|
||||
|
||||
return true;
|
||||
@ -96,8 +96,8 @@ bool WidgetManager::add_wgt
|
||||
//-----------------------------------------------------------------------------
|
||||
bool WidgetManager::insert_column()
|
||||
{
|
||||
const int LAST_ELEM = m_elems.size() - 1;
|
||||
const int LAST_WGT = m_widgets.size() - 1;
|
||||
const int LAST_ELEM = (int)m_elems.size() - 1;
|
||||
const int LAST_WGT = (int)m_widgets.size() - 1;
|
||||
|
||||
if( LAST_ELEM > -1)
|
||||
{
|
||||
@ -147,7 +147,7 @@ bool WidgetManager::is_column_break( const int BREAK_POS) const
|
||||
//-----------------------------------------------------------------------------
|
||||
bool WidgetManager::break_line()
|
||||
{
|
||||
const int LAST_WGT = m_widgets.size() - 1;
|
||||
const int LAST_WGT = (int)m_widgets.size() - 1;
|
||||
|
||||
if( LAST_WGT < 0 )
|
||||
{
|
||||
@ -156,7 +156,7 @@ bool WidgetManager::break_line()
|
||||
return false;
|
||||
}
|
||||
|
||||
const int LAST_ELEM = m_elems.size() - 1;
|
||||
const int LAST_ELEM = (int)m_elems.size() - 1;
|
||||
if( m_elems[LAST_ELEM].type == ET_COLUMN )
|
||||
{
|
||||
std::cerr << "WARNING: tried to add a break to end a column " <<
|
||||
@ -200,7 +200,7 @@ bool WidgetManager::break_line()
|
||||
//-----------------------------------------------------------------------------
|
||||
void WidgetManager::reset()
|
||||
{
|
||||
const int NUM_WIDGETS = m_widgets.size();
|
||||
const int NUM_WIDGETS = (int)m_widgets.size();
|
||||
|
||||
for(int i = 0; i < NUM_WIDGETS; ++i)
|
||||
{
|
||||
@ -216,7 +216,7 @@ void WidgetManager::reset()
|
||||
//-----------------------------------------------------------------------------
|
||||
int WidgetManager::find_id(const int TOKEN) const
|
||||
{
|
||||
const int NUM_WIDGETS = m_widgets.size();
|
||||
const int NUM_WIDGETS = (int)m_widgets.size();
|
||||
|
||||
for( int i = 0; i < NUM_WIDGETS; ++i )
|
||||
{
|
||||
@ -250,7 +250,7 @@ void WidgetManager::update(const float DELTA)
|
||||
glDisable(GL_DEPTH_TEST);
|
||||
glDisable(GL_CULL_FACE ) ;
|
||||
|
||||
const int NUM_WIDGETS = m_widgets.size();
|
||||
const int NUM_WIDGETS = (int)m_widgets.size();
|
||||
for( int i = 0; i < NUM_WIDGETS; ++i)
|
||||
{
|
||||
m_widgets[i].widget->update(DELTA);
|
||||
@ -269,7 +269,7 @@ void WidgetManager::update(const float DELTA)
|
||||
*/
|
||||
int WidgetManager::calc_width() const
|
||||
{
|
||||
const int NUM_ELEMS = m_elems.size();
|
||||
const int NUM_ELEMS = (int)m_elems.size();
|
||||
int curr_width = 0, total_width = 0;
|
||||
|
||||
for( int i = 0; i < NUM_ELEMS; ++i )
|
||||
@ -308,7 +308,7 @@ int WidgetManager::calc_width() const
|
||||
*/
|
||||
int WidgetManager::calc_height() const
|
||||
{
|
||||
const int NUM_ELEMS = m_elems.size();
|
||||
const int NUM_ELEMS = (int)m_elems.size();
|
||||
if( NUM_ELEMS < 0 ) return 0;
|
||||
|
||||
int total_height = calc_line_height(0);
|
||||
@ -348,7 +348,7 @@ bool WidgetManager::layout(const WidgetArea POSITION)
|
||||
}
|
||||
prev_layout_pos = POSITION;
|
||||
|
||||
const int NUM_WIDGETS = m_widgets.size();
|
||||
const int NUM_WIDGETS = (int)m_widgets.size();
|
||||
if( NUM_WIDGETS < 0 ) return true;
|
||||
|
||||
int SCREEN_WIDTH = user_config->m_width;
|
||||
@ -466,7 +466,7 @@ bool WidgetManager::layout(const WidgetArea POSITION)
|
||||
int widget_x = m_x + ( WGTS_WIDTH - calc_line_width( 0 )) / 2;
|
||||
int widget_y = m_y;
|
||||
|
||||
const int NUM_ELEMS = m_elems.size();
|
||||
const int NUM_ELEMS = (int)m_elems.size();
|
||||
int line_pos = 0;
|
||||
int column_pos = -1;
|
||||
int curr_wgt = 0;
|
||||
@ -566,7 +566,7 @@ int WidgetManager::calc_line_width( const int START_ELEM ) const
|
||||
{
|
||||
int curr_wgt;
|
||||
int total_width = 0;
|
||||
const int NUM_ELEMS = m_elems.size();
|
||||
const int NUM_ELEMS = (int)m_elems.size();
|
||||
|
||||
for( int i = START_ELEM; i < NUM_ELEMS; ++i )
|
||||
{
|
||||
@ -601,7 +601,7 @@ int WidgetManager::calc_line_height( const int START_ELEM ) const
|
||||
int curr_wgt;
|
||||
int line_height = 0;
|
||||
int column_height;
|
||||
const int NUM_ELEMS = m_elems.size();
|
||||
const int NUM_ELEMS = (int)m_elems.size();
|
||||
|
||||
for( int i = START_ELEM; i < NUM_ELEMS; ++i )
|
||||
{
|
||||
@ -642,7 +642,7 @@ int WidgetManager::calc_column_width(const int START_ELEM) const
|
||||
{
|
||||
int curr_wgt;
|
||||
int column_width = 0;
|
||||
const int NUM_ELEMS = m_elems.size();
|
||||
const int NUM_ELEMS = (int)m_elems.size();
|
||||
|
||||
for( int i = START_ELEM; i < NUM_ELEMS; ++i )
|
||||
{
|
||||
@ -665,7 +665,7 @@ int WidgetManager::calc_column_height(const int START_ELEM) const
|
||||
{
|
||||
int curr_wgt;
|
||||
int total_height = 0;
|
||||
const int NUM_ELEMS = m_elems.size();
|
||||
const int NUM_ELEMS = (int)m_elems.size();
|
||||
|
||||
for( int i = START_ELEM; i < NUM_ELEMS; ++i )
|
||||
{
|
||||
|
Loading…
x
Reference in New Issue
Block a user