#include "camera.h"
#include "debug.h"
#include "client.h"
-#include "main.h" // for g_settings
#include "map.h"
-#include "clientmap.h" // MapDrawControl
+#include "clientmap.h" // MapDrawControl
#include "player.h"
#include <cmath>
#include "settings.h"
#include "wieldmesh.h"
-#include "noise.h" // easeCurve
+#include "noise.h" // easeCurve
#include "gamedef.h"
#include "sound.h"
#include "event.h"
m_wieldmgr->drop();
}
-bool Camera::successfullyCreated(std::wstring& error_message)
+bool Camera::successfullyCreated(std::string &error_message)
{
- if (m_playernode == NULL)
- {
- error_message = L"Failed to create the player scene node";
- return false;
- }
- if (m_headnode == NULL)
- {
- error_message = L"Failed to create the head scene node";
- return false;
- }
- if (m_cameranode == NULL)
- {
- error_message = L"Failed to create the camera scene node";
- return false;
- }
- if (m_wieldmgr == NULL)
- {
- error_message = L"Failed to create the wielded item scene manager";
- return false;
- }
- if (m_wieldnode == NULL)
- {
- error_message = L"Failed to create the wielded item scene node";
- return false;
+ if (!m_playernode) {
+ error_message = "Failed to create the player scene node";
+ } else if (!m_headnode) {
+ error_message = "Failed to create the head scene node";
+ } else if (!m_cameranode) {
+ error_message = "Failed to create the camera scene node";
+ } else if (!m_wieldmgr) {
+ error_message = "Failed to create the wielded item scene manager";
+ } else if (!m_wieldnode) {
+ error_message = "Failed to create the wielded item scene node";
+ } else {
+ error_message.clear();
}
- return true;
+ return error_message.empty();
}
// Returns the fractional part of x
{
f32 oldy = old_player_position.Y;
f32 newy = player_position.Y;
- f32 t = exp(-10*frametime);
+ f32 t = exp(-23*frametime);
player_position.Y = oldy * t + newy * (1-t);
}