This commit is contained in:
Arthur-D 2014-10-10 13:18:00 +02:00
commit 8d6daf8e14
44 changed files with 293 additions and 219 deletions

View File

@ -48,4 +48,8 @@
title="Banana Lover" description="Collect at least 5 bananas in one race.">
<banana goal="5"/>
</achievement>
<achievement id="10" secret="yes" check-type="all-at-least" reset-type="race"
title="It's secret" description="Really ... a secret.">
</achievement>
</achievements>

View File

@ -8,6 +8,8 @@
<button id="assignEsc" I18N="When configuring input" text="Assign to ESC key" align="center"/>
<spacer height="10" width="10" />
<button id="assignNone" I18N="When configuring input" text="Assign nothing" align="center"/>
<spacer height="10" width="10" />
<button id="cancel" I18N="When configuring input" text="Press ESC to cancel" align="center"/>
</div>

View File

@ -35,6 +35,7 @@ AchievementInfo::AchievementInfo(const XMLNode * input)
m_id = 0;
m_title = "";
m_description = "";
m_is_secret = false;
bool all;
all = input->get("id", &m_id ) &&
input->get("title", &m_title ) &&
@ -69,6 +70,7 @@ AchievementInfo::AchievementInfo(const XMLNode * input)
else
Log::warn("AchievementInfo", "Achievement check type '%s' unknown.",
s.c_str());
input->get("secret", &m_is_secret);
// Now load the goal nodes
for (unsigned int n = 0; n < input->getNumNodes(); n++)

View File

@ -94,6 +94,9 @@ private:
/** Determines when the achievement needs to be reset */
ResetType m_reset_type;
/** A secret achievement has its progress not shown. */
bool m_is_secret;
public:
AchievementInfo(const XMLNode * input);
virtual ~AchievementInfo() {};
@ -119,6 +122,9 @@ public:
/** Returns the check type for this achievement. */
AchievementCheckType getCheckType() const { return m_check_type; }
// ------------------------------------------------------------------------
/** Returns if this achievement is a secret achievement. */
bool isSecret() const { return m_is_secret; }
// ------------------------------------------------------------------------
}; // class AchievementInfo

View File

@ -48,7 +48,7 @@ public:
virtual SFXManager::SFXStatus getStatus() { return SFXManager::SFX_STOPPED; }
virtual void onSoundEnabledBack() {}
virtual void setRolloff(float rolloff) {}
virtual bool isPlaying() { return false; }
virtual const SFXBuffer* getBuffer() const { return NULL; }
}; // DummySFX

View File

@ -48,6 +48,7 @@ public:
virtual bool init() = 0;
virtual void position(const Vec3 &position) = 0;
virtual void setLoop(bool status) = 0;
virtual bool isPlaying() = 0;
virtual void play() = 0;
virtual void reallyPlayNow() = 0;
virtual void stop() = 0;

View File

@ -43,6 +43,7 @@ SFXOpenAL::SFXOpenAL(SFXBuffer* buffer, bool positional, float gain, bool ownsBu
m_soundBuffer = buffer;
m_soundSource = 0;
m_ok = false;
m_is_playing = false;
m_positional = positional;
m_defaultGain = gain;
m_loop = false;
@ -85,10 +86,8 @@ bool SFXOpenAL::init()
assert( alIsBuffer(m_soundBuffer->getBufferID()) );
assert( alIsSource(m_soundSource) );
//std::cout << "Setting a source with buffer " << m_soundBuffer
// << ", rolloff " << rolloff
// << ", gain=" << m_defaultGain << ", positional="
// << (positional ? "true" : "false") << std::endl;
//Log::info("SFXOpenAL", "Setting a source with buffer, %p, rolloff %f, gain = %f, position = %s",
// m_soundBuffer, rolloff, m_defaultGain, positional ? "true" : "false");
alSourcei (m_soundSource, AL_BUFFER, m_soundBuffer->getBufferID());
@ -189,7 +188,8 @@ void SFXOpenAL::stop()
{
if(!m_ok) return;
m_loop = false;
m_is_playing = false;
m_loop = false;
alSourcei(m_soundSource, AL_LOOPING, AL_FALSE);
alSourceStop(m_soundSource);
SFXManager::checkError("stoping");
@ -230,6 +230,10 @@ void SFXOpenAL::resume()
*/
void SFXOpenAL::play()
{
// Technically the sfx is only playing after the sfx thread starts it,
// but for STK this is correct since we don't want to start the same
// sfx twice.
m_is_playing = true;
SFXManager::get()->queue(this);
} // play
@ -252,6 +256,14 @@ void SFXOpenAL::reallyPlayNow()
SFXManager::checkError("playing");
} // reallyPlayNow
//-----------------------------------------------------------------------------
/** Returns true if the sound effect is currently playing.
*/
bool SFXOpenAL::isPlaying()
{
return m_is_playing;
} // isPlaying
//-----------------------------------------------------------------------------
/** Sets the position where this sound effects is played.
* \param position Position of the sound effect.

View File

@ -55,6 +55,9 @@ private:
the sound source won't be created and we'll be left with no clue when enabling
sounds later. */
float m_gain;
/** True when the sfx is currently playing. */
bool m_is_playing;
/** The master gain set in user preferences */
float m_master_gain;
@ -72,6 +75,7 @@ public:
virtual void play();
virtual void reallyPlayNow();
virtual void setLoop(bool status);
virtual bool isPlaying();
virtual void stop();
virtual void pause();
virtual void resume();

View File

@ -83,6 +83,10 @@ irr::core::stringw DeviceConfig::getMappingIdString (const PlayerAction action)
returnString += id;
break;
case Input::IT_NONE:
returnString += "none";
break;
default:
assert(false);
returnString += type;

View File

@ -32,6 +32,10 @@
#include <set>
#include <sstream>
#include <string>
#ifndef WIN32
# include <sys/param.h> // To get BSD macro
# include <sys/utsname.h>
#endif
#include <vector>
@ -166,7 +170,33 @@ void determineOSVersion()
if(StringUtils::hasSuffix(*i, "-release"))
if (readEtcReleaseFile(*i)) return;
}
// Fallback in case that we can't find any valid information in /etc/*release
struct utsname u;
if (uname(&u))
{
m_os_version = "Linux unknown";
return;
}
// Ignore data after "-", since it could identify a system (self compiled
// kernels).
std::vector<std::string> l = StringUtils::split(std::string(u.release),'-');
m_os_version = std::string(u.sysname) + " " + l[0];
#endif
#ifdef BSD
struct utsname u;
if (uname(&u))
{
m_os_version = "BSD unknown";
return;
}
// Ignore data after "-", since it could identify a system (self compiled
// kernels).
std::vector<std::string> l = StringUtils::split(std::string(u.release),'-');
m_os_version = std::string(u.sysname) + " " + l[0];
#endif
#ifdef WIN32
// (C) 2014 by Wildfire Games (0 A.D.), ported by Joerg Henrichs.

View File

@ -140,8 +140,7 @@ void GroupUserConfigParam::findYourDataInAChildOf(const XMLNode* node)
const XMLNode* child = node->getNode( m_param_name );
if (child == NULL)
{
//std::cerr << "/!\\ User Config : Couldn't find parameter group "
// << paramName << std::endl;
//Log::error("User Config", "Couldn't find parameter group %s", m_param_name.c_str());
return;
}
@ -271,8 +270,7 @@ void ListUserConfigParam<T, U>::findYourDataInAChildOf(const XMLNode* node)
const XMLNode* child = node->getNode( m_param_name );
if (child == NULL)
{
//std::cerr << "/!\\ User Config : Couldn't find parameter group "
// << paramName << std::endl;
//Log::error("User Config", "Couldn't find parameter group %s", m_param_name.c_str());
return;
}
@ -374,12 +372,12 @@ void IntUserConfigParam::findYourDataInAChildOf(const XMLNode* node)
const XMLNode* child = node->getNode( m_param_name );
if(child == NULL)
{
//std::cout << "Couldn't find int parameter " << paramName << std::endl;
//Log::error("UserConfigParam", "Couldn't find int parameter %s", m_param_name.c_str());
return;
}
child->get( "value", &m_value );
//std::cout << "read int " << paramName << ", value=" << value << std::endl;
//Log::info("UserConfigParam", "Read int %s ,value = %d", m_param_name.c_str(), value);
} // findYourDataInAChildOf
// ----------------------------------------------------------------------------
@ -442,7 +440,7 @@ void TimeUserConfigParam::findYourDataInAChildOf(const XMLNode* node)
const XMLNode* child = node->getNode( m_param_name );
if(child == NULL)
{
//std::cout << "Couldn't find int parameter " << paramName <<std::endl;
//Log::error("UserConfigParam", "Couldn't find int parameter %s", m_param_name.c_str());
return;
}
@ -564,8 +562,7 @@ void BoolUserConfigParam::findYourDataInAChildOf(const XMLNode* node)
}
else
{
std::cerr << "Unknown value for " << m_param_name
<< "; expected true or false\n";
Log::error("User Config", "Unknown value for %s; expected true or false", m_param_name.c_str());
}
} // findYourDataInAChildOf
@ -585,8 +582,7 @@ void BoolUserConfigParam::findYourDataInAnAttributeOf(const XMLNode* node)
}
else
{
std::cerr << "Unknown value for " << m_param_name
<< "; expected true or false\n";
Log::error("User Config", "Unknown value for %s; expected true or false", m_param_name.c_str());
}
} // findYourDataInAnAttributeOf
@ -760,7 +756,7 @@ void UserConfig::saveConfig()
const int paramAmount = all_params.size();
for(int i=0; i<paramAmount; i++)
{
//std::cout << "saving parameter " << i << " to file\n";
//Log::info("UserConfig", "Saving parameter %d to file", i);
all_params[i].write(configfile);
}
@ -769,8 +765,8 @@ void UserConfig::saveConfig()
}
catch (std::runtime_error& e)
{
std::cerr << "[UserConfig::saveConfig] ERROR: Failed to write config to " << filename.c_str()
<< "; cause : " << e.what() << "\n";
Log::error("UserConfig::saveConfig", "Failed to write config to %s, because %s",
filename.c_str(), e.what());
}
} // saveConfig

View File

@ -2279,7 +2279,7 @@ void IrrDriver::RTTProvider::setupRTTScene(PtrVector<scene::IMesh, REF>& mesh,
node->setAnimationSpeed(0);
node->updateAbsolutePosition();
node->setScale( mesh_scale[n].toIrrVector() );
//std::cout << "(((( set frame " << model_frames[n] << " ))))\n";
//Log::info("RTTProvider::setupRTTScene", "Set frame %d", model_frames[n]);
}
}

View File

@ -93,8 +93,8 @@ void AbstractStateManager::pushMenu(std::string name)
if (UserConfigParams::logGUI())
{
std::cout << "[AbstractStateManager::pushMenu] switching to screen "
<< name.c_str() << std::endl;
Log::info("AbstractStateManager::pushMenu", "Switching to screen %s",
name.c_str());
}
// Send tear-down event to previous menu
@ -125,8 +125,8 @@ void AbstractStateManager::pushScreen(Screen* screen)
if (UserConfigParams::logGUI())
{
std::cout << "[AbstractStateManager::pushScreen] switching to screen "
<< screen->getName().c_str() << std::endl;
Log::info("AbstractStateManager::pushScreen", "Switching to screen %s",
screen->getName().c_str());
}
if (!screen->isLoaded()) screen->loadFromFile();
@ -152,8 +152,8 @@ void AbstractStateManager::replaceTopMostScreen(Screen* screen, GUIEngine::GameS
if (UserConfigParams::logGUI())
{
std::cout << "[AbstractStateManager::replaceTopmostScreen] "
"switching to screen " << name.c_str() << std::endl;
Log::info("AbstractStateManager::replaceTopMostScreen", "Switching to screen %s",
name.c_str());
}
assert(m_menu_stack.size() > 0);
@ -215,8 +215,8 @@ void AbstractStateManager::popMenu()
if (UserConfigParams::logGUI())
{
std::cout << "[AbstractStateManager::popMenu] switching to screen "
<< m_menu_stack[m_menu_stack.size()-1].c_str() << std::endl;
Log::info("AbstractStateManager::popMenu", "Switching to screen %s",
m_menu_stack[m_menu_stack.size()-1].c_str());
}
if (m_menu_stack[m_menu_stack.size()-1] == RACE_STATE_NAME)
@ -247,10 +247,8 @@ void AbstractStateManager::resetAndGoToScreen(Screen* screen)
std::string name = screen->getName();
if (UserConfigParams::logGUI())
{
std::cout << "[AbstractStateManager::resetAndGoToScreen] "
"switching to screen " << name.c_str() << std::endl;
}
Log::info("AbstractStateManager::resetAndGoToScreen", "Switching to screen %s",
name.c_str());
if (m_game_mode != GAME) getCurrentScreen()->tearDown();
m_menu_stack.clear();

View File

@ -167,6 +167,10 @@ namespace GUIEngine
virtual void onTopMostScreenChanged() = 0;
// --------------------------------------------------------------------
/** Returns the number of screens on the stack. Is used to decide
* if exiting a screen would cause STK to end or not. */
unsigned int getMenuStackSize() const { return m_menu_stack.size(); }
}; // Class AbstractStateManager
} // GUIEngine

View File

@ -72,18 +72,16 @@ void AbstractTopLevelContainer::addWidgetsRecursively(
widgets[n].getType() != WTYPE_ICON_BUTTON &&
widgets[n].getType() != WTYPE_SPACER)
{
std::cerr << "/!\\ Warning /!\\ : widget "
<< widgets[n].m_properties[PROP_ID].c_str()
<< " of type " << widgets[n].getType()
<< " has no dimensions" << std::endl;
Log::warn("AbstractTopLevelContainer::addWidgetsRecursively",
"Widget %s of type %d has no dimensions",
widgets[n].m_properties[PROP_ID].c_str(), widgets[n].getType());
}
if (widgets[n].m_x == -1 || widgets[n].m_y == -1)
{
std::cerr << "/!\\ Warning /!\\ : widget "
<< widgets[n].m_properties[PROP_ID].c_str()
<< " of type " << widgets[n].getType()
<< " has no position" << std::endl;
Log::warn("AbstractTopLevelContainer::addWidgetsRecursively",
"Widget %s of type %d has no position",
widgets[n].m_properties[PROP_ID].c_str(), widgets[n].getType());
}
widgets[n].add();
@ -197,10 +195,8 @@ Widget* AbstractTopLevelContainer::getWidget(const int id,
if (widget.searchInsideMe() && widget.getChildren().size() > 0)
{
// std::cout << "widget = <"
// << widget.m_properties[PROP_ID].c_str()
// << "> widget.m_children.size()="
// << widget.m_children.size() << std::endl;
//Log::info("AbstractTopLevelContainer", "widget = <%s> widget.m_children.size() = ",
// widget.m_properties[PROP_ID].c_str(), widget.m_children.size());
Widget* el = getWidget(id, &(widget.m_children));
if(el != NULL) return el;
}

View File

@ -1019,12 +1019,10 @@ namespace GUIEngine
g_skin->drop(); // GUI env grabbed it
assert(g_skin->getReferenceCount() == 1);
}
catch (std::runtime_error& err)
catch (std::runtime_error& /*err*/)
{
(void)err; // avoid warning about unused variable
std::cerr <<
"ERROR, cannot load skin specified in user config. Falling "
"back to defaults.\n";
Log::error("Engine::init", "Cannot load skin specified in user config. "
"Falling back to defaults.");
UserConfigParams::m_skin_file.revertToDefaults();
try
@ -1036,8 +1034,7 @@ namespace GUIEngine
}
catch (std::runtime_error& err)
{
std::cerr << "FATAL, cannot load default GUI skin\n";
throw err;
Log::fatal("Engine::init", "Canot load default GUI skin");
}
}
@ -1135,10 +1132,9 @@ namespace GUIEngine
// one so that the fallback skin is not dropped
newSkin = new Skin(fallbackSkin);
}
catch (std::runtime_error& err)
catch (std::runtime_error& /*err*/)
{
(void)err; // avoid warning about unused variable
std::cerr << "ERROR, cannot load newly specified skin!\n";
Log::error("Engine::reloadSkin", "Canot load newly specified skin");
return;
}
@ -1369,8 +1365,8 @@ namespace GUIEngine
}
else
{
std::cerr << "WARNING: GUIEngine::addLoadingIcon given "
"NULL icon\n";
Log::warn("Engine::addLoadingIcon", "Given "
"NULL icon");
}
} // addLoadingIcon

View File

@ -199,7 +199,7 @@ bool EventHandler::OnEvent (const SEvent &event)
// mode ignore this error message, but leave it in for debugging.
if(std::string(event.LogEvent.Text)=="Unsupported texture format")
#ifdef DEBUG
printf("The following message will not be printed in release mode:\n");
Log::info("EventHandler", "The following message will not be printed in release mode");
#else
return true; // EVENT_BLOCK
#endif
@ -414,7 +414,7 @@ void EventHandler::navigate(const int playerID, Input::InputType type, const boo
if (el == NULL)
{
std::cerr << "WARNING : m_tab_down/up_root is set to an ID for which I can't find the widget\n";
Log::warn("EventHandler::navigate", "m_tab_down/up_root is set to an ID for which I can't find the widget");
return;
}
}
@ -448,7 +448,7 @@ void EventHandler::navigate(const int playerID, Input::InputType type, const boo
if (NAVIGATION_DEBUG)
{
std::cout << "Navigating " << (reverse ? "up" : "down") << " to " << closest->getID() << std::endl;
Log::info("EventHandler", "Navigating %s to %d", (reverse ? "up" : "down"), closest->getID());
}
assert(closestWidget != NULL);
@ -474,7 +474,7 @@ void EventHandler::navigate(const int playerID, Input::InputType type, const boo
if (!found)
{
if (NAVIGATION_DEBUG)
std::cout << "EventHandler::navigat : wrap around\n";
Log::info( "EventHandler::navigate", "Wrap around");
// select the last/first widget
Widget* wrapWidget = NULL;
@ -529,7 +529,7 @@ EventPropagation EventHandler::onWidgetActivated(GUIEngine::Widget* w, const int
if (w->m_event_handler == NULL) return EVENT_LET;
}
//std::cout << "**** widget activated : " << w->m_properties[PROP_ID].c_str() << " ****" << std::endl;
//Log::info("EventHandler", "Widget activated: %s", w->m_properties[PROP_ID].c_str());
if (w->m_event_handler != NULL)
{

View File

@ -21,9 +21,6 @@
#include <IGUIFont.h>
#include <ITexture.h>
using namespace irr;
using namespace gui;
using namespace video;
#include "graphics/irr_driver.hpp"
#include "guiengine/abstract_top_level_container.hpp"
@ -35,6 +32,9 @@ using namespace video;
#include "utils/string_utils.hpp"
#include "utils/vs.hpp"
using namespace irr;
using namespace gui;
using namespace video;
using namespace GUIEngine;
/** Like atoi, but on error prints an error message to stderr */
@ -420,7 +420,7 @@ void LayoutManager::doCalculateLayout(PtrVector<Widget>& widgets, AbstractTopLev
horizontal = false;
else
{
std::cerr << "Unknown layout name : " << layout_name.c_str() << std::endl;
Log::error("LayoutManager::doCalculateLayout", "Unknown layout name: %s", layout_name.c_str());
break;
}
@ -475,11 +475,9 @@ void LayoutManager::doCalculateLayout(PtrVector<Widget>& widgets, AbstractTopLev
int proportion = 1;
std::istringstream myStream(prop);
if (!(myStream >> proportion))
{
std::cerr << "/!\\ Warning /!\\ : proportion '" << prop.c_str()
<< "' is not a number for widget " << widgets[n].m_properties[PROP_ID].c_str()
<< std::endl;
}
Log::warn("LayoutManager::doCalculateLayout",
"Proportion '%s' is not a number for widget %s", prop.c_str(),
widgets[n].m_properties[PROP_ID].c_str());
const float fraction = (float)proportion/(float)total_proportion;
@ -522,9 +520,9 @@ void LayoutManager::doCalculateLayout(PtrVector<Widget>& widgets, AbstractTopLev
}
else
{
std::cerr << "/!\\ Warning /!\\ : alignment '" << align.c_str()
<< "' is unknown (widget '" << widgets[n].m_properties[PROP_ID].c_str()
<< "', in a horiozntal-row layout)\n";
Log::warn("LayoutManager::doCalculateLayout",
"Alignment '%s' is unknown (widget '%s', in a horiozntal-row layout)",
align.c_str(), widgets[n].m_properties[PROP_ID].c_str());
}
widgets[n].m_w = (int)(left_space*fraction);
@ -597,9 +595,9 @@ void LayoutManager::doCalculateLayout(PtrVector<Widget>& widgets, AbstractTopLev
}
else
{
std::cerr << "/!\\ Warning /!\\ : alignment '" << align.c_str()
<< "' is unknown (widget '" << widgets[n].m_properties[PROP_ID].c_str()
<< "', in a vertical-row layout)\n";
Log::warn("LayoutManager::doCalculateLayout",
"Alignment '%s' is unknown (widget '%s', in a vertical-row layout)",
align.c_str(), widgets[n].m_properties[PROP_ID].c_str());
}
widgets[n].m_y = y;
@ -651,9 +649,9 @@ void LayoutManager::doCalculateLayout(PtrVector<Widget>& widgets, AbstractTopLev
}
else
{
std::cerr << "/!\\ Warning /!\\ : alignment '" << align.c_str()
<< "' is unknown in widget " << widgets[n].m_properties[PROP_ID].c_str()
<< std::endl;
Log::warn("LayoutManager::doCalculateLayout",
"Alignment '%s' is unknown in widget '%s'",
align.c_str(), widgets[n].m_properties[PROP_ID].c_str());
}
x += widgets[n].m_w;
@ -697,8 +695,9 @@ void LayoutManager::doCalculateLayout(PtrVector<Widget>& widgets, AbstractTopLev
}
else
{
std::cerr << "/!\\ Warning /!\\ : alignment '" << align.c_str()
<< "' is unknown in widget " << widgets[n].m_properties[PROP_ID].c_str() << std::endl;
Log::warn("LayoutManager::doCalculateLayout",
"Alignment '%s' is unknown in widget '%s'",
align.c_str(), widgets[n].m_properties[PROP_ID].c_str());
}
widgets[n].m_y = y;

View File

@ -101,7 +101,7 @@ void ScalableFont::doReadXmlFile(io::IXMLReader* xml)
/*
const wchar_t* iflangis = xml->getAttributeValue(L"iflanguage");
printf("langcode = %s\n", translations->getCurrentLanguageCode().c_str());
Log::info("ScalableFont", "langcode = %s", translations->getCurrentLanguageCode().c_str());
if (iflangis != NULL &&
core::stringc(iflangis) != translations->getCurrentLanguageCode().c_str())
@ -128,8 +128,10 @@ void ScalableFont::doReadXmlFile(io::IXMLReader* xml)
float scale=1.0f;
if(xml->getAttributeValue(L"scale"))
{
scale = xml->getAttributeValueAsFloat(L"scale");
//std::cout << "scale = " << scale << std::endl;
//Log::info("ScalableFont", "scale = %f", scale);
}
bool excludeFromMaxHeightCalculation = false;
if (xml->getAttributeValue(L"excludeFromMaxHeightCalculation"))
@ -137,7 +139,7 @@ void ScalableFont::doReadXmlFile(io::IXMLReader* xml)
core::stringw alpha = xml->getAttributeValue(L"hasAlpha");
//std::cout << "---- Adding font texture " << fn.c_str() << "; alpha=" << alpha.c_str() << std::endl;
//Log::info("ScalableFont", "Adding font texture %s; alpha = %s", fn.c_str(), alpha.c_str());
// make sure the sprite bank has enough textures in it
@ -227,7 +229,7 @@ void ScalableFont::doReadXmlFile(io::IXMLReader* xml)
CharacterMap[ch] = Areas.size();
//std::cout << "Inserting character '" << (int)ch << "' with area " << Areas.size() << std::endl;
//Log::info("ScalableFont", "Inserting character '%d' with area %d", (int)ch, Areas.size());
// make frame
f.rectNumber = SpriteBank->getPositions().size();
@ -366,18 +368,18 @@ s32 ScalableFont::getAreaIDFromCharacter(const wchar_t c, bool* fallback_font) c
if (n != CharacterMap.end())
{
if (fallback_font != NULL) *fallback_font = false;
// std::cout << "Character " << (int)c << " found in font\n";
//Log::info("ScalableFont", "Character %d found in font", (int)c);
return (*n).second;
}
else if (m_fallback_font != NULL && fallback_font != NULL)
{
// std::cout << "Font does not have this character : <" << (int)c << ">, trying fallback font" << std::endl;
//Log::warn("ScalableFont", "Font does not have this character: <%d>, try fallback font", (int)c);
*fallback_font = true;
return m_fallback_font->getAreaIDFromCharacter(c, NULL);
}
else
{
// std::cout << "The font does not have this character : <" << (int)c << ">" << std::endl;
//Log::warn("ScalableFont", "The font does not have this character: <%d>", (int)c);
if (fallback_font != NULL) *fallback_font = false;
return WrongCharacter;
}
@ -453,12 +455,12 @@ core::dimension2d<u32> ScalableFont::getDimension(const wchar_t* text) const
dim.Height += thisLine.Height;
if (dim.Width < thisLine.Width) dim.Width = thisLine.Width;
// std::cout << "ScalableFont::getDimension returns : " << dim.Width << ", " << dim.Height << " --> ";
//Log::info("ScalableFont", "ScalableFont::getDimension returns: %d, %d", dim.Width, dim.Height);
dim.Width = (int)(dim.Width + 0.9f); // round up
dim.Height = (int)(dim.Height + 0.9f);
//std::cout << dim.Width << ", " << dim.Height << std::endl;
//Log::info("ScalableFont", "After: %d, %d", dim.Width, dim.Height);
return dim;
}
@ -616,10 +618,9 @@ void ScalableFont::doDraw(const core::stringw& text,
/*
if (fallback[n])
{
std::cout << "USING fallback font " << core::stringc(texture->getName()).c_str()
<< "; source area is " << source.UpperLeftCorner.X << ", " << source.UpperLeftCorner.Y
<< ", size " << source.getWidth() << ", " << source.getHeight() << "; dest = "
<< offsets[n].X << ", " << offsets[n].Y << std::endl;
Log::info("ScalableFont", "Using fallback font %s; source area is %d, %d; size %d, %d; dest = %d, %d",
core::stringc(texture->getName()).c_str(), source.UpperLeftCorner.X, source.UpperLeftCorner.Y,
source.getWidth(), source.getHeight(), offsets[n].X, offsets[n].Y);
}
*/
@ -773,7 +774,7 @@ int ScalableFont::getCharWidth(const SFontArea& area, const bool fallback) const
assert(info.m_file_name.size() > 0);
const float char_scale = info.m_scale;
//std::cout << "area.spriteno=" << area.spriteno << ", char_scale=" << char_scale << std::endl;
//Log::info("ScalableFont", "area.spriteno = %d, char_scale = %f", area.spriteno, char_scale);
if (fallback) return (int)(((area.width + area.overhang)*m_fallback_font_scale + m_fallback_kerning_width) * m_scale * char_scale);
else return (int)((area.width + area.overhang + GlobalKerningWidth) * m_scale * char_scale);

View File

@ -187,11 +187,11 @@ void Screen::addWidgets()
addWidgetsRecursively( m_widgets );
//std::cout << "*****ScreenAddWidgets " << m_filename.c_str() << " : focusing the first widget*****\n";
//Log::info("Screen::AddWidgets", "%s: focusing the first widget", m_filename.c_str());
// select the first widget (for first players only; if other players need some focus the Screen must provide it).
Widget* w = getFirstWidget();
//std::cout << "First widget is " << (w == NULL ? "null" : w->m_properties[PROP_ID].c_str()) << std::endl;
//Log::info("Screen::AddWidgets", "First widget is %s", (w == NULL ? "null" : w->m_properties[PROP_ID].c_str()));
if (w != NULL) w->setFocusForPlayer( PLAYER_ID_GAME_MASTER );
else Log::warn("Screen::AddWidgets", "Couldn't select first widget, NULL was returned");
} // addWidgets

View File

@ -181,8 +181,7 @@ void Screen::parseScreenFileDiv(irr::io::IXMLReader* xml, PtrVector<Widget>& app
}
else
{
std::cerr << "/!\\ Warning /!\\ : unknown tag found in STK GUI file : '"
<< xml->getNodeName() << "'" << std::endl;
Log::warn("Screen::parseScreenFileDiv", "unknown tag found in STK GUI file '%s'", xml->getNodeName());
continue;
}

View File

@ -258,9 +258,9 @@ void DynamicRibbonWidget::add()
const float score = log(2.0f*visible_items) *
std::min(ratio, 1.0f) * std::min(taken_area/total_area, 1.0f);
//std::cout << " " << row_count << " rows : " << visible_items << " visible items; area = "
// << taken_area << "; size penalty = " << std::min((float)item_height / (float)m_child_height, 1.0f)
// << "; score = " << score << "\n";
//Log::info("DynamicRibbonWidget", "%d rown: %d visible items; area = %f; "
// "size penalty = %f; score = %f", row_count, visible_items, taken_area,
// std::min((float)item_height / (float)m_child_height, 1.0f), score);
if (score > max_score_so_far)
{
@ -276,8 +276,8 @@ void DynamicRibbonWidget::add()
const int max_rows = atoi(m_properties[PROP_MAX_ROWS].c_str());
if (max_rows < 1)
{
std::cout << "/!\\ WARNING : the 'max_rows' property must be an integer greater than zero."
<< " Ingoring current value '" << m_properties[PROP_MAX_ROWS] << "'\n";
Log::warn("DynamicRibbonWidget", "The 'max_rows' property must be an integer greater than zero; "
"Ignoring current value '%s'", m_properties[PROP_MAX_ROWS].c_str());
}
else
{
@ -300,7 +300,7 @@ void DynamicRibbonWidget::add()
for (int i=0; i<m_row_amount; i++)
{
m_ids[i] = getNewID();
//std::cout << "ribbon : getNewID returns " << m_ids[i] << std::endl;
//Log::info("DynamicRibbonWidget", "getNewID returns %d", m_ids[i]);
}
buildInternalStructure();
@ -334,11 +334,11 @@ void DynamicRibbonWidget::buildInternalStructure()
// ajust column amount to not add more item slots than we actually need
const int item_count = (int) m_items.size();
//std::cout << "item_count=" << item_count << ", row_amount*m_col_amount=" << m_row_amount*m_col_amount << std::endl;
//Log::info("DynamicRibbonWidget", "%d items; %d cells", item_count, row_amount * m_col_amount);
if (m_row_amount*m_col_amount > item_count)
{
m_col_amount = (int)ceil((float)item_count/(float)m_row_amount);
//std::cout << "Adjusting m_col_amount to be " << m_col_amount << std::endl;
//Log::info("DynamicRibbonWidget", "Adjusting m_col_amount to be %d", m_col_amount);
}
assert( m_left_widget->ok() );
@ -411,7 +411,7 @@ void DynamicRibbonWidget::buildInternalStructure()
// it will assume there is no label and none will be created (FIXME: that's ugly)
if (m_properties[PROP_LABELS_LOCATION] == "each") icon->m_text = " ";
// std::cout << "ribbon text = " << m_properties[PROP_TEXT].c_str() << std::endl;
//Log::info("DynamicRibbonWidget", "Ribbon text = %s", m_properties[PROP_TEXT].c_str());
ribbon->m_children.push_back( icon );
added_item_count++;
@ -612,12 +612,12 @@ EventPropagation DynamicRibbonWidget::rightPressed(const int playerID)
getSelectedRibbon(playerID)->getSelectionText(playerID), playerID);
}
}
//std::cout << "rightpressed (dynamic ribbon) " << m_properties[PROP_ID] << "\n";
//Log::info("DynamicRibbonWidget", "Rightpressed %s", m_properties[PROP_ID].c_str());
assert(m_rows.size() >= 1);
if (m_rows[0].m_ribbon_type == RIBBON_TOOLBAR) return EVENT_BLOCK;
//std::cout << " rightpressed returning EVENT_LET\n";
//Log::info("DynamicRibbonWidget", "Rightpressed returning EVENT_LET");
return EVENT_LET;
}
@ -682,7 +682,7 @@ EventPropagation DynamicRibbonWidget::transmitEvent(Widget* w,
EventPropagation DynamicRibbonWidget::mouseHovered(Widget* child, const int playerID)
{
if (m_deactivated) return EVENT_LET;
//std::cout << "DynamicRibbonWidget::mouseHovered " << playerID << std::endl;
//Log::info("DynamicRibbonWidget", "mouseHovered %d", playerID);
updateLabel();
propagateSelection();
@ -1085,15 +1085,14 @@ bool DynamicRibbonWidget::setSelection(int item_id, const int playerID,
if (iterations > 50)
{
assert(false);
std::cerr << "DynamicRibbonWidget::setSelection cannot find item " << item_id << " (" << name.c_str() << ")\n";
Log::fatal("DynamicRibbonWidget::setSelection", "Cannot find item %d (%s)", item_id, name.c_str());
return false;
}
iterations++;
}
//std::cout << "Player " << playerID << " has item " << item_id << " (" << name.c_str() << ") in row " << row << std::endl;
//Log::info("DynamicRibbonWidget", "Player %d has item %d (%s) in row %d", playerID, item_id, name.c_str(), row);
m_rows[row].setSelection(id, playerID);
if (focusIt)
{

View File

@ -136,8 +136,9 @@ void ModelViewWidget::update(float delta)
distance_with_negative_rotation = (int)(angle - m_rotation_target);
}
//std::cout << "distance_with_positive_rotation=" << distance_with_positive_rotation <<
//" distance_with_negative_rotation=" << distance_with_negative_rotation << " angle="<< angle <<std::endl;
//Log::info("ModelViewWidget", "distance_with_positive_rotation = %d; "
// "distance_with_negative_rotation = %d; angle = %f", distance_with_positive_rotation,
// distance_with_negative_rotation, angle);
if (distance_with_positive_rotation < distance_with_negative_rotation)
{
@ -242,7 +243,7 @@ void ModelViewWidget::setupRTTScene(PtrVector<scene::IMesh, REF>& mesh,
node->setAnimationSpeed(0);
node->updateAbsolutePosition();
node->setScale(mesh_scale[n].toIrrVector());
//std::cout << "(((( set frame " << model_frames[n] << " ))))\n";
//Log::info("ModelViewWidget", "Set frame %d", model_frames[n]);
}
}

View File

@ -594,7 +594,7 @@ EventPropagation RibbonWidget::mouseHovered(Widget* child,
if (m_ribbon_type == RIBBON_COMBO || m_ribbon_type == RIBBON_TABS)
{
//std::cout << "SETTING m_mouse_focus\n";
//Log::info("RibbonWidget", "Setting m_mouse_focus");
m_mouse_focus = child;
}
@ -642,7 +642,6 @@ void RibbonWidget::updateSelection()
// FIXME: m_selection, m_selected, m_mouse_focus... what a mess...
//std::cout << "----\n";
// Update selection flags for mouse player
for (unsigned int p=0; p<MAX_PLAYER_COUNT; p++)
{

View File

@ -231,7 +231,7 @@ EventPropagation SpinnerWidget::rightPressed(const int playerID)
// if widget is deactivated, do nothing
if (m_deactivated) return EVENT_BLOCK;
//std::cout << "Right pressed\n";
//Log::info("SpinnerWidget", "Right pressed");
if (m_value+1 <= m_max)
{
setValue(m_value+1);
@ -253,7 +253,7 @@ EventPropagation SpinnerWidget::leftPressed(const int playerID)
// if widget is deactivated, do nothing
if (m_deactivated) return EVENT_BLOCK;
//std::cout << "Left pressed\n";
//Log::info("SpinnerWidget", "Left pressed");
if (m_value-1 >= m_min)
{
setValue(m_value-1);
@ -386,9 +386,7 @@ void SpinnerWidget::setValue(irr::core::stringw new_value)
}
}
std::cerr << "ERROR [SpinnerWidget::setValue] : cannot find element named '"
<< irr::core::stringc(new_value.c_str()).c_str() << "'\n";
assert(false);
Log::fatal("SpinnerWidget::setValue", "Cannot find element named '%s'", irr::core::stringc(new_value.c_str()).c_str());
}
// -----------------------------------------------------------------------------

View File

@ -145,9 +145,9 @@ void DeviceManager::setAssignMode(const PlayerAssignMode assignMode)
m_assign_mode = assignMode;
#if INPUT_MODE_DEBUG
if (assignMode == NO_ASSIGN) std::cout << "====== DeviceManager::setAssignMode(NO_ASSIGN) ======\n";
if (assignMode == ASSIGN) std::cout << "====== DeviceManager::setAssignMode(ASSIGN) ======\n";
if (assignMode == DETECT_NEW) std::cout << "====== DeviceManager::setAssignMode(DETECT_NEW) ======\n";
if (assignMode == NO_ASSIGN) Log::info("DeviceManager::setAssignMode(NO_ASSIGN)");
if (assignMode == ASSIGN) Log::info("DeviceManager::setAssignMode(ASSIGN)");
if (assignMode == DETECT_NEW) Log::info("DeviceManager::setAssignMode(DETECT_NEW)");
#endif
// when going back to no-assign mode, do some cleanup
@ -289,7 +289,7 @@ InputDevice* DeviceManager::mapKeyboardInput( int btnID, InputManager::InputDriv
{
const int keyboard_amount = m_keyboards.size();
//std::cout << "mapKeyboardInput " << btnID << " to " << keyboard_amount << " keyboards\n";
//Log::info("DeviceManager::mapKeyboardInput", "Map %d to %d", btnID, keyboard_amount);
for (int n=0; n<keyboard_amount; n++)
{
@ -297,10 +297,10 @@ InputDevice* DeviceManager::mapKeyboardInput( int btnID, InputManager::InputDriv
if (keyboard->processAndMapInput(btnID, mode, action))
{
//std::cout << " binding found in keyboard #" << (n+1) << "; action is " << KartActionStrings[*action] << "\n";
//Log::info("DeviceManager::mapKeyboardInput", "Binding found in keyboard #%d; action is %s", n + 1, KartActionStrings[*action]);
if (m_single_player != NULL)
{
//printf("Single player\n");
//Log::info("DeviceManager", "Single player");
*player = m_single_player;
}
else if (m_assign_mode == NO_ASSIGN) // Don't set the player in NO_ASSIGN mode
@ -423,7 +423,7 @@ InputDevice* DeviceManager::getLatestUsedDevice()
if (m_latest_used_device == NULL)
{
//std::cout<< "========== No latest device, returning keyboard ==========\n";
//Log::info("DeviceManager", "No latest device, returning keyboard);
return m_keyboards.get(0); // FIXME: is this right?
}

View File

@ -298,7 +298,7 @@ void InputManager::inputSensing(Input::InputType type, int deviceID,
int value)
{
#if INPUT_MODE_DEBUG
std::cout << "INPUT SENSING... ";
Log::info("InputManager::inputSensing", "Start sensing input");
#endif
// don't store if we're trying to do something like bindings keyboard
@ -310,7 +310,7 @@ void InputManager::inputSensing(Input::InputType type, int deviceID,
return;
#if INPUT_MODE_DEBUG
std::cout << (store_new ? "storing it" : "ignoring it") << "\n";
Log::info("InputManager::inputSensing", store_new ? "storing it" : "ignoring it");
#endif
@ -350,10 +350,9 @@ void InputManager::inputSensing(Input::InputType type, int deviceID,
break;
case Input::IT_STICKMOTION:
{
std::cout << "%% storing new axis binding, value=" << value <<
" deviceID=" << deviceID << " button=" << button <<
" axisDirection=" <<
(axisDirection == Input::AD_NEGATIVE ? "-" : "+") << "\n";
Log::info("InputManager::inputSensing", "Storing new axis binding, value = %d; "
"deviceID = %d; button = %d; axisDirection = %s", value, deviceID, button,
axisDirection == Input::AD_NEGATIVE ? "-" : "+");
// We have to save the direction in which the axis was moved.
// This is done by storing it as a sign (and since button can
// be zero, we add one before changing the sign).
@ -573,8 +572,7 @@ void InputManager::dispatchInput(Input::InputType type, int deviceID,
InputDevice *device = NULL;
if (type == Input::IT_KEYBOARD)
{
//std::cout << "==== New Player Joining with Key " <<
// button << " ====" << std::endl;
//Log::info("InputManager", "New Player Joining with Key %d", button);
device = m_device_manager->getKeyboardFromBtnID(button);
}
else if (type == Input::IT_STICKBUTTON ||
@ -609,8 +607,8 @@ void InputManager::dispatchInput(Input::InputType type, int deviceID,
if (pk == NULL)
{
std::cerr <<
"Error, trying to process action for an unknown player\n";
Log::error("InputManager::dispatchInput", "Trying to process "
"action for an unknown player");
return;
}
@ -700,8 +698,7 @@ void InputManager::dispatchInput(Input::InputType type, int deviceID,
void InputManager::setMasterPlayerOnly(bool enabled)
{
#if INPUT_MODE_DEBUG
std::cout <<
"====== InputManager::setMasterPlayerOnly(" << enabled << ") ======\n";
Log::info("InputManager::setMasterPlayerOnly", enabled ? "enabled" : "disabled");
#endif
m_master_player_only = enabled;
}
@ -955,7 +952,7 @@ void InputManager::setMode(InputDriverMode new_mode)
{
case MENU:
#if INPUT_MODE_DEBUG
std::cout << "====== InputManager::setMode(MENU) ======\n";
Log::info("InputManager::setMode", "MENU");
#endif
switch (m_mode)
{
@ -1017,7 +1014,7 @@ void InputManager::setMode(InputDriverMode new_mode)
break;
case INGAME:
#if INPUT_MODE_DEBUG
std::cout << "====== InputManager::setMode(INGAME) ======\n";
Log::info("InputManager::setMode", "INGAME");
#endif
// We must be in menu mode now in order to switch.
assert (m_mode == MENU);
@ -1036,7 +1033,7 @@ void InputManager::setMode(InputDriverMode new_mode)
case INPUT_SENSE_KEYBOARD:
case INPUT_SENSE_GAMEPAD:
#if INPUT_MODE_DEBUG
std::cout << "====== InputManager::setMode(INPUT_SENSE_*) ======\n";
Log::info("InputManager::setMode", "INPUT_SENSE_*");
#endif
// We must be in menu mode now in order to switch.
assert (m_mode == MENU);
@ -1050,7 +1047,7 @@ void InputManager::setMode(InputDriverMode new_mode)
/*
case LOWLEVEL:
#if INPUT_MODE_DEBUG
std::cout << "====== InputManager::setMode(LOWLEVEL) ======\n";
Log::info("InputManager::setMode", "LOWLEVEL");
#endif
// We must be in menu mode now in order to switch.
assert (m_mode == MENU);

View File

@ -1893,12 +1893,12 @@ void Kart::crashed(const Material* m, AbstractKart *k)
// it's not already playing.
if (isShielded() || (k != NULL && k->isShielded()))
{
if (m_boing_sound->getStatus() != SFXManager::SFX_PLAYING)
if (!m_boing_sound->isPlaying())
m_boing_sound->play();
}
else
{
if(m_crash_sound->getStatus() != SFXManager::SFX_PLAYING)
if(!m_crash_sound->isPlaying())
m_crash_sound->play();
}
}
@ -1973,7 +1973,7 @@ bool Kart::playCustomSFX(unsigned int type)
// SFXManager::get()->getCustomTagName(type),
// m_kart_properties->getIdent().c_str());
// If it's already playing, let it finish
if (m_custom_sounds[type]->getStatus() != SFXManager::SFX_PLAYING)
if (!m_custom_sounds[type]->isPlaying())
{
m_custom_sounds[type]->play();
}
@ -2018,10 +2018,10 @@ void Kart::updatePhysics(float dt)
m_skidding->getSkidState() == Skidding::SKID_ACCUMULATE_RIGHT ) &&
m_skidding->getGraphicalJumpOffset()==0)
{
if(m_skid_sound->getStatus() != SFXManager::SFX_PLAYING &&!isWheeless())
if(!m_skid_sound->isPlaying() && !isWheeless())
m_skid_sound->play();
}
else if(m_skid_sound->getStatus() == SFXManager::SFX_PLAYING)
else if(m_skid_sound->isPlaying())
{
m_skid_sound->stop();
}

View File

@ -94,6 +94,7 @@ void* waitInput(void* data)
std::cin >> cnt;
clrp->voteRaceCount(cnt);
}
std::cout << "\n";
}
// If STK shuts down, but should receive an input after the network
// manager was deleted, the getInstance call will return NULL.

View File

@ -126,7 +126,7 @@ void RaceManager::setDefaultAIKartList(const std::vector<std::string>& ai_list)
// player (and therefore the current slot) is not defined yet.
//if(unlock_manager->getCurrentSlot()->isLocked(name))
//{
// printf("Kart '%s' is locked and therefore ignored.\n",
// Log::info("RaceManager", "Kart '%s' is locked and therefore ignored.",
// name.c_str());
// continue;
//}
@ -240,9 +240,8 @@ void RaceManager::computeRandomKartList()
{
int n = m_num_karts - (int)m_player_karts.size();
if(UserConfigParams::logMisc())
std::cout << "AI karts count = " << n << " for m_num_karts="
<< m_num_karts << " and m_player_karts.size()="
<< m_player_karts.size() << std::endl;
Log::info("RaceManager", "AI karts count = %d for m_num_karts = %d and "
"m_player_karts.size() = %d", n, m_num_karts, m_player_karts.size());
// If less kart selected than there are player karts, adjust the number of
// karts to the minimum
@ -655,8 +654,8 @@ void RaceManager::exitRace(bool delete_world)
{
if(UserConfigParams::logMisc())
{
std::cout << m_kart_status[i].m_ident << " has GP final rank "
<< m_kart_status[i].m_gp_rank << std::endl;
Log::info("RaceManager", "%s has GP final rank %d",
m_kart_status[i].m_ident.c_str(), m_kart_status[i].m_gp_rank);
}
const int rank = m_kart_status[i].m_gp_rank;

View File

@ -146,8 +146,7 @@ void AddonsScreen::init()
getWidget<GUIEngine::RibbonWidget>("category")->setDeactivated();
if(UserConfigParams::logAddons())
std::cout << "[addons] Using directory <" + file_manager->getAddonsDir()
<< ">\n";
Log::info("addons", "Using directory <%s>", file_manager->getAddonsDir().c_str());
GUIEngine::ListWidget* w_list =
getWidget<GUIEngine::ListWidget>("list_addons");

View File

@ -133,7 +133,7 @@ void ArenasScreen::eventCallback(Widget* widget, const std::string& name, const
const std::string selection = w2->getSelectionIDString(PLAYER_ID_GAME_MASTER);
if (UserConfigParams::logGUI())
std::cout << "Clicked on arena " << selection.c_str() << std::endl;
Log::info("ArenasScreen", "Clicked on arena %s", selection.c_str());
if (selection == "random_track")

View File

@ -79,7 +79,7 @@ void ConfirmResolutionDialog::updateMessage()
{
//I18N: In the 'confirm resolution' dialog, that's shown when switching resoluton
stringw msg = _("Confirm resolution within %i seconds", (int)m_remaining_time);
//std::cout << stringc(msg.c_str()).c_str() << std::endl;
//Log::info("ConfirmResolutionDialog", "stringc(msg.c_str()).c_str());
LabelWidget* countdown_message = getWidget<LabelWidget>("title");
countdown_message->setText( msg.c_str(), false );

View File

@ -44,6 +44,12 @@ GUIEngine::EventPropagation PressAKeyDialog::processEvent(const std::string& eve
dismiss();
return GUIEngine::EVENT_BLOCK;
}
else if (eventSource == "assignNone")
{
Input simulatedInput;
OptionsScreenInput2::getInstance()->gotSensedInput(simulatedInput);
return GUIEngine::EVENT_BLOCK;
}
else if (eventSource == "assignEsc")
{
Input simulatedInput(Input::IT_KEYBOARD, 0 /* deviceID */, KEY_ESCAPE);

View File

@ -65,8 +65,7 @@ void EasterEggScreen::eventCallback(Widget* widget, const std::string& name, con
{
const std::string selection = w2->getSelectionIDString(PLAYER_ID_GAME_MASTER);
if(UserConfigParams::logGUI())
std::cout << "Clicked on track " << selection.c_str()
<< std::endl;
Log::info("EasterEggScreen", "Clicked on track %s", selection.c_str());
UserConfigParams::m_last_track = selection;

View File

@ -250,8 +250,8 @@ void FeatureUnlockedCutScene::addUnlockedPicture(irr::video::ITexture* picture,
{
if (picture == NULL)
{
std::cerr << "[FeatureUnlockedCutScene::addUnlockedPicture] WARNING: unlockable has no picture : "
<< core::stringc(msg.c_str()).c_str() << "\n";
Log::warn("FeatureUnlockedCutScene::addUnlockedPicture", "Unlockable has no picture: %s",
core::stringc(msg.c_str()).c_str());
picture = irr_driver->getTexture(file_manager->getAsset(FileManager::GUI,"main_help.png"));
}
@ -278,7 +278,8 @@ void FeatureUnlockedCutScene::init()
const int unlockedStuffCount = m_unlocked_stuff.size();
if (unlockedStuffCount == 0) std::cerr << "There is nothing in the unlock chest!!!\n";
if (unlockedStuffCount == 0)
Log::error("FeatureUnlockedCutScene::init", "There is nothing in the unlock chest");
m_all_kart_models.clearAndDeleteAll();
for (int n=0; n<unlockedStuffCount; n++)
@ -350,7 +351,7 @@ void FeatureUnlockedCutScene::init()
}
else
{
std::cerr << "Malformed unlocked goody!!!\n";
Log::error("FeatureUnlockedCutScene::init", "Malformed unlocked goody");
}
}
@ -402,8 +403,8 @@ void FeatureUnlockedCutScene::onUpdate(float dt)
else if (n > 1) pos.X += 1.0f*dt*(n - 0.3f);
//else pos.X += 6.2f*dt*float( int((n + 1)/2) );
//std::cout << "Object " << n << " moving by " <<
// (n % 2 == 0 ? -4.0f : 4.0f)*float( n/2 + 1 ) << std::endl;
//Log::info("FeatureUnlockedCutScene", "Object %d moving by %f", n,
// (n % 2 == 0 ? -4.0f : 4.0f)*float( n/2 + 1 ));
}
else
{
@ -514,7 +515,7 @@ void FeatureUnlockedCutScene::addUnlockedTrack(const Track* track)
{
if (track == NULL)
{
std::cerr << "ERROR: Unlocked track does not exist???\n";
Log::error("FeatureUnlockedCutScene::addUnlockedTrack", "Unlocked track does not exist");
return;
}
@ -531,7 +532,7 @@ void FeatureUnlockedCutScene::addUnlockedGP(const GrandPrixData* gp)
std::vector<ITexture*> images;
if (gp == NULL)
{
std::cerr << "ERROR: Unlocked GP does not exist???\n";
Log::error("FeatureUnlockedCutScene::addUnlockedGP", "Unlocked GP does not exist");
video::ITexture* WTF_image = irr_driver->getTexture( file_manager->getAsset(FileManager::GUI,"main_help.png"));
images.push_back(WTF_image);
}
@ -542,7 +543,7 @@ void FeatureUnlockedCutScene::addUnlockedGP(const GrandPrixData* gp)
if (track_amount == 0)
{
std::cerr << "ERROR: Unlocked GP is empty???\n";
Log::error("FeatureUnlockedCutScene::addUnlockedGP", "Unlocked GP is empty");
video::ITexture* WTF_image = irr_driver->getTexture( file_manager->getAsset(FileManager::GUI,"main_help.png"));
images.push_back(WTF_image);
}

View File

@ -103,6 +103,8 @@ void OnlineProfileAchievements::init()
{
std::vector<ListWidget::ListCell> row;
const Achievement *a = it->second;
if(a->getInfo()->isSecret() && !a->isAchieved())
continue;
ListWidget::ListCell title(a->getInfo()->getTitle(), -1, 2);
ListWidget::ListCell progress(a->getProgressAsString(), -1, 1);
row.push_back(title);

View File

@ -151,7 +151,7 @@ void OptionsScreenAudio::eventCallback(Widget* widget, const std::string& name,
CheckBoxWidget* w = dynamic_cast<CheckBoxWidget*>(widget);
UserConfigParams::m_music = w->getState();
std::cout << "music state is now " << (bool)UserConfigParams::m_music << std::endl;
Log::info("OptionsScreenAudio", "Music is now %s", ((bool) UserConfigParams::m_music) ? "on" : "off");
if(w->getState() == false)
music_manager->stopMusic();

View File

@ -235,7 +235,8 @@ void OptionsScreenInput::eventCallback(Widget* widget, const std::string& name,
}
else
{
std::cerr << "Cannot read internal gamepad input device ID : " << selection.c_str() << std::endl;
Log::error("OptionsScreenInput", "Cannot read internal gamepad input device ID: %s",
selection.c_str());
}
}
else if (selection.find("keyboard") != std::string::npos)
@ -250,12 +251,13 @@ void OptionsScreenInput::eventCallback(Widget* widget, const std::string& name,
}
else
{
std::cerr << "Cannot read internal keyboard input device ID : " << selection.c_str() << std::endl;
Log::error("OptionsScreenInput", "Cannot read internal keyboard input device ID: %s",
selection.c_str());
}
}
else
{
std::cerr << "Cannot read internal input device ID : " << selection.c_str() << std::endl;
Log::error("OptionsScreenInput", "Cannot read internal input device ID: %s", selection.c_str());
}
}

View File

@ -394,9 +394,8 @@ void OptionsScreenInput2::gotSensedInput(const Input& sensed_input)
{
if (UserConfigParams::logMisc())
{
std::cout << "% Binding " << KartActionStrings[binding_to_set]
<< " : setting to keyboard key " << sensed_input.m_button_id
<< " \n\n";
Log::info("OptionsScreenInput2", "Binding %s: setting to keyboard key %d",
KartActionStrings[binding_to_set].c_str(), sensed_input.m_button_id);
}
KeyboardConfig* keyboard = (KeyboardConfig*)m_config;
@ -412,24 +411,21 @@ void OptionsScreenInput2::gotSensedInput(const Input& sensed_input)
{
if (UserConfigParams::logMisc())
{
std::cout << "% Binding " << KartActionStrings[binding_to_set]
<< " : setting to gamepad #"
<< sensed_input.m_device_id<< " : ";
Log::info("OptionsScreenInput2", "Binding %s: setting to gamepad #%d",
KartActionStrings[binding_to_set].c_str(), sensed_input.m_device_id);
if (sensed_input.m_type == Input::IT_STICKMOTION)
{
std::cout << "axis " <<sensed_input.m_button_id<< " direction "
<< (sensed_input.m_axis_direction==Input::AD_NEGATIVE
? "-" : "+")
<< "\n\n";
Log::info("OptionsScreenInput2", "Axis %d; direction %s", sensed_input.m_button_id,
sensed_input.m_axis_direction == Input::AD_NEGATIVE ? "-" : "+");
}
else if (sensed_input.m_type == Input::IT_STICKBUTTON)
{
std::cout << "button " << sensed_input.m_button_id<< "\n\n";
Log::info("OptionsScreenInput2", "Button %d", sensed_input.m_button_id);
}
else
{
std::cout << "Sensed unknown gamepad event type??\n";
Log::info("OptionsScreenInput2", "Sensed unknown gamepad event type??");
}
}
@ -447,6 +443,23 @@ void OptionsScreenInput2::gotSensedInput(const Input& sensed_input)
updateInputButtons();
}
}
else if (sensed_input.m_type == Input::IT_NONE)
{
if (UserConfigParams::logMisc())
{
Log::info("OptionsScreenInput2", "Binding %s: setting to keyboard key NONE",
KartActionStrings[binding_to_set].c_str());
}
KeyboardConfig* keyboard = (KeyboardConfig*)m_config;
keyboard->setBinding(binding_to_set, Input::IT_NONE,
sensed_input.m_button_id, Input::AD_NEUTRAL,
Input::AR_HALF,
sensed_input.m_character);
// refresh display
updateInputButtons();
}
else
{
return;
@ -524,9 +537,8 @@ void OptionsScreenInput2::eventCallback(Widget* widget,
// we found which one. show the "press a key" dialog.
if (UserConfigParams::logMisc())
{
std::cout << "\n% Entering sensing mode for "
<< m_config->getName().c_str()
<< std::endl;
Log::info("OptionsScreenInput2", "Entering sensing mode for %s",
m_config->getName().c_str());
}
binding_to_set = (PlayerAction)n;
@ -543,8 +555,8 @@ void OptionsScreenInput2::eventCallback(Widget* widget,
}
else
{
std::cerr << "unknown selection device in options : "
<< m_config->getName().c_str() << std::endl;
Log::error("OptionsScreenInput2", "Unknown selection device in options: %s",
m_config->getName().c_str());
}
break;
}

View File

@ -318,15 +318,10 @@ void OptionsScreenVideo::init()
(int)UserConfigParams::m_height);
if (res->setSelection(searching_for, PLAYER_ID_GAME_MASTER,
if (!res->setSelection(searching_for, PLAYER_ID_GAME_MASTER,
false /* focus it */, true /* even if deactivated*/))
{
// ok found
}
else
{
std::cerr << "[OptionsScreenVideo] Cannot find resolution '"
<< searching_for << "'\n";
Log::error("OptionsScreenVideo", "Cannot find resolution %s", searching_for);
}
@ -517,8 +512,7 @@ void OptionsScreenVideo::eventCallback(Widget* widget, const std::string& name,
int w = -1, h = -1;
if (sscanf(res.c_str(), "%ix%i", &w, &h) != 2 || w == -1 || h == -1)
{
std::cerr << "Failed to decode resolution : " << res.c_str()
<< std::endl;
Log::error("OptionsScreenVideo", "Failed to decode resolution %s", res.c_str());
return;
}

View File

@ -187,11 +187,11 @@ void RaceGUIOverworld::renderPlayerView(const Camera *camera, float dt)
const core::recti &viewport = camera->getViewport();
core::vector2df scaling = camera->getScaling();
//std::cout << "Applied ratio : " << viewport.getWidth()/800.0f << std::endl;
//Log::info("RaceGUIOverworld", "Applied ratio: %f", viewport.getWidth()/800.0f);
scaling *= viewport.getWidth()/800.0f; // scale race GUI along screen size
//std::cout << "Scale : " << scaling.X << ", " << scaling.Y << std::endl;
//Log::info("RaceGUIOverworld", "Scale: %f, %f", scaling.X, scaling.Y);
drawAllMessages (kart, viewport, scaling);

View File

@ -73,6 +73,15 @@ void BaseUserScreen::init()
m_info_widget = getWidget<LabelWidget>("message");
assert(m_info_widget);
// The behaviour of the screen is slightly different at startup, i.e.
// when it is the first screen: cancel will exit the game, and in
// this case no 'back' error should be shown.
bool is_first_screen = StateManager::get()->getMenuStackSize()==1;
getWidget<IconButtonWidget>("back")->setVisible(!is_first_screen);
getWidget<IconButtonWidget>("cancel")->setLabel(is_first_screen
? _("Exit game")
: _("Cancel") );
m_sign_out_name = "";
m_sign_in_name = "";
@ -203,7 +212,11 @@ void BaseUserScreen::makeEntryFieldsVisible()
getWidget<LabelWidget>("label_remember")->setVisible(online);
getWidget<CheckBoxWidget>("remember-user")->setVisible(online);
PlayerProfile *player = getSelectedPlayer();
if(player && player->hasSavedSession() && online)
// Don't show the password fields if the player wants to be online
// and either is the current player (no need to enter a password then)
// or has a saved session.
if(player && online &&
(player->hasSavedSession() || player==PlayerManager::getCurrentPlayer()))
{
// If we show the online login fields, but the player has a
// saved session, don't show the password field.
@ -289,7 +302,7 @@ void BaseUserScreen::eventCallback(Widget* widget,
}
else if (button == "cancel")
{
StateManager::get()->popMenu();
// EscapePressed will pop this screen.
StateManager::get()->escapePressed();
}
else if (button == "recover")

View File

@ -153,17 +153,16 @@ Translations::Translations() //: m_dictionary_manager("UTF-16")
/*
const std::set<Language>& languages = m_dictionary_manager.get_languages();
std::cout << "Number of languages: " << languages.size() << std::endl;
Log::info("Translatings", "Number of languages: %d", languages.size());
for (std::set<Language>::const_iterator i = languages.begin();
i != languages.end(); ++i)
{
const Language& language = *i;
std::cout << "Env: " << language.str() << std::endl
<< "Name: " << language.get_name() << std::endl
<< "Language: " << language.get_language() << std::endl
<< "Country: " << language.get_country() << std::endl
<< "Modifier: " << language.get_modifier() << std::endl
<< std::endl;
Log::info("Translatings", "Env: %s", language.str());
Log::info("Translatings", "Name: %s", language.get_name());
Log::info("Translatings", "Language: %s", language.get_language());
Log::info("Translatings", "Country: %s", language.get_country());
Log::info("Translatings", "Modifier: %s", language.get_modifier());
}
*/
@ -297,8 +296,7 @@ const wchar_t* Translations::fribidize(const wchar_t* in_ptr)
if (n == FRIBIDI_BUFFER_SIZE-1) // prevent buffeoverflows
{
std::cerr
<< "WARNING : translated string too long, truncating!\n";
Log::warn("Translations::fribidize", "translated string too long, truncating");
fribidiInput[n] = 0;
break;
}
@ -329,7 +327,7 @@ const wchar_t* Translations::fribidize(const wchar_t* in_ptr)
if (!result)
{
std::cerr << "Fribidi failed in 'fribidi_log2vis' =(\n";
Log::error("Translations::fribidize", "Fribidi failed in 'fribidi_log2vis' =(");
m_converted_string = core::stringw(in_ptr);
return m_converted_string.c_str();
}
@ -373,7 +371,7 @@ const wchar_t* Translations::w_gettext(const char* original, const char* context
if (original[0] == '\0') return L"";
#if TRANSLATE_VERBOSE
std::cout << "Translating " << original << "\n";
Log::info("Translations", "Translating %s", original);
#endif
const std::string& original_t = (context == NULL ?