Bring to zero some types of issues reported by colobot-lint
parent
883e07ad6a
commit
d11ebc891c
src
object
implementation
interface
script
test/unit
common
graphics/engine
|
@ -72,6 +72,10 @@ CBotClass::~CBotClass()
|
|||
delete m_next; // releases all of them on this level
|
||||
}
|
||||
|
||||
CBotClass* CBotClass::Create(const char* name, CBotClass* parent, bool intrinsic)
|
||||
{
|
||||
return new CBotClass(name, parent, intrinsic);
|
||||
}
|
||||
|
||||
void CBotClass::Free()
|
||||
{
|
||||
|
|
|
@ -610,6 +610,8 @@ virtual ~CBotVar( ); // destructor
|
|||
static
|
||||
CBotVar* Create( CBotVar* pVar );
|
||||
|
||||
static void Destroy(CBotVar* var);
|
||||
|
||||
|
||||
void SetUserPtr(void* pUser);
|
||||
// associate a user pointer to an instance
|
||||
|
@ -807,6 +809,8 @@ public:
|
|||
|
||||
~CBotClass( ); // destructor
|
||||
|
||||
static CBotClass* Create(const char* name, CBotClass* parent, bool intrinsic = false);
|
||||
|
||||
bool AddFunction(const char* name,
|
||||
bool rExec (CBotVar* pThis, CBotVar* pVar, CBotVar* pResult, int& Exception, void* user),
|
||||
CBotTypResult rCompile (CBotVar* pThis, CBotVar* &pVar));
|
||||
|
|
|
@ -444,6 +444,11 @@ CBotVar* CBotVar::Create( const char* name, CBotClass* pClass)
|
|||
return pVar;
|
||||
}
|
||||
|
||||
void CBotVar::Destroy(CBotVar* var)
|
||||
{
|
||||
delete var;
|
||||
}
|
||||
|
||||
CBotTypResult CBotVar::GetTypResult(int mode)
|
||||
{
|
||||
CBotTypResult r = m_type;
|
||||
|
|
|
@ -19,8 +19,6 @@
|
|||
|
||||
#include "app/app.h"
|
||||
|
||||
#include "common/version.h"
|
||||
|
||||
#include "app/controller.h"
|
||||
#include "app/input.h"
|
||||
#include "app/system.h"
|
||||
|
@ -32,6 +30,7 @@
|
|||
#include "common/make_unique.h"
|
||||
#include "common/pathman.h"
|
||||
#include "common/stringutils.h"
|
||||
#include "common/version.h"
|
||||
|
||||
#include "common/resources/resourcemanager.h"
|
||||
|
||||
|
@ -39,10 +38,10 @@
|
|||
|
||||
#include "graphics/opengl/glutil.h"
|
||||
|
||||
#include "object/object_manager.h"
|
||||
|
||||
#include "level/robotmain.h"
|
||||
|
||||
#include "object/object_manager.h"
|
||||
|
||||
#ifdef OPENAL_SOUND
|
||||
#include "sound/oalsound/alsound.h"
|
||||
#endif
|
||||
|
@ -479,7 +478,7 @@ bool CApplication::Create()
|
|||
#ifdef OPENAL_SOUND
|
||||
if (!m_headless)
|
||||
{
|
||||
m_sound = MakeUnique<ALSound>();
|
||||
m_sound = MakeUnique<CALSound>();
|
||||
}
|
||||
else
|
||||
{
|
||||
|
|
|
@ -404,19 +404,19 @@ InputSlot CInput::SearchKeyById(std::string id)
|
|||
return INPUT_SLOT_MAX;
|
||||
}
|
||||
|
||||
std::string CInput::GetKeysString(InputBinding b)
|
||||
std::string CInput::GetKeysString(InputBinding binding)
|
||||
{
|
||||
std::ostringstream ss;
|
||||
if ( b.primary != KEY_INVALID )
|
||||
if ( binding.primary != KEY_INVALID )
|
||||
{
|
||||
std::string iNameStr;
|
||||
if ( GetResource(RES_KEY, b.primary, iNameStr) )
|
||||
if ( GetResource(RES_KEY, binding.primary, iNameStr) )
|
||||
{
|
||||
ss << iNameStr;
|
||||
|
||||
if ( b.secondary != KEY_INVALID )
|
||||
if ( binding.secondary != KEY_INVALID )
|
||||
{
|
||||
if ( GetResource(RES_KEY, b.secondary, iNameStr) )
|
||||
if ( GetResource(RES_KEY, binding.secondary, iNameStr) )
|
||||
{
|
||||
std::string textStr;
|
||||
GetResource(RES_TEXT, RT_KEY_OR, textStr);
|
||||
|
|
|
@ -131,7 +131,7 @@ public:
|
|||
//@}
|
||||
|
||||
//! Seeks a InputSlot by id. Returns INPUT_SLOT_MAX if not found
|
||||
InputSlot SearchKeyById(std::string name);
|
||||
InputSlot SearchKeyById(std::string id);
|
||||
|
||||
//! Returns string describing keys to be pressed
|
||||
//@{
|
||||
|
|
|
@ -23,7 +23,6 @@
|
|||
*/
|
||||
|
||||
#include "common/config.h"
|
||||
#include "common/version.h"
|
||||
|
||||
#include "app/app.h"
|
||||
#include "app/signal_handlers.h"
|
||||
|
@ -35,6 +34,7 @@
|
|||
#include "common/logger.h"
|
||||
#include "common/make_unique.h"
|
||||
#include "common/restext.h"
|
||||
#include "common/version.h"
|
||||
|
||||
#include "common/resources/resourcemanager.h"
|
||||
|
||||
|
|
|
@ -27,6 +27,20 @@
|
|||
|
||||
#include <algorithm>
|
||||
|
||||
struct ActivePause
|
||||
{
|
||||
explicit ActivePause(PauseType type, PauseMusic music = PAUSE_MUSIC_NONE)
|
||||
: type(type),
|
||||
music(music)
|
||||
{}
|
||||
|
||||
ActivePause(const ActivePause&) = delete;
|
||||
ActivePause& operator=(const ActivePause&) = delete;
|
||||
|
||||
PauseType type;
|
||||
PauseMusic music;
|
||||
};
|
||||
|
||||
|
||||
CPauseManager::CPauseManager()
|
||||
{
|
||||
|
@ -39,7 +53,7 @@ CPauseManager::~CPauseManager()
|
|||
ActivePause* CPauseManager::ActivatePause(PauseType type, PauseMusic music)
|
||||
{
|
||||
//GetLogger()->Debug("Activated pause mode - %s\n", GetPauseName(type).c_str());
|
||||
auto pause = std::unique_ptr<ActivePause>(new ActivePause(type, music)); // TODO: Can't use MakeUnique here because the constructor is private
|
||||
auto pause = MakeUnique<ActivePause>(type, music);
|
||||
ActivePause* ptr = pause.get();
|
||||
m_activePause.push_back(std::move(pause));
|
||||
Update();
|
||||
|
|
|
@ -23,6 +23,8 @@
|
|||
*/
|
||||
#pragma once
|
||||
|
||||
#include "common/make_unique.h"
|
||||
|
||||
#include <string>
|
||||
#include <vector>
|
||||
#include <memory>
|
||||
|
@ -63,22 +65,7 @@ enum PauseMusic
|
|||
PAUSE_MUSIC_SATCOM = 2,
|
||||
};
|
||||
|
||||
struct ActivePause
|
||||
{
|
||||
private:
|
||||
friend class CPauseManager;
|
||||
|
||||
explicit ActivePause(PauseType type, PauseMusic music = PAUSE_MUSIC_NONE)
|
||||
: type(type)
|
||||
, music(music)
|
||||
{}
|
||||
|
||||
ActivePause(const ActivePause&) = delete;
|
||||
ActivePause& operator=(const ActivePause&) = delete;
|
||||
|
||||
PauseType type;
|
||||
PauseMusic music;
|
||||
};
|
||||
struct ActivePause;
|
||||
|
||||
class CPauseManager
|
||||
{
|
||||
|
|
|
@ -19,13 +19,12 @@
|
|||
|
||||
#include "app/signal_handlers.h"
|
||||
|
||||
#include "common/version.h"
|
||||
|
||||
#include "common/resources/resourcemanager.h"
|
||||
|
||||
#include "app/system.h"
|
||||
|
||||
#include "common/stringutils.h"
|
||||
#include "common/version.h"
|
||||
|
||||
#include "common/resources/resourcemanager.h"
|
||||
|
||||
#include "level/robotmain.h"
|
||||
|
||||
|
|
|
@ -22,9 +22,6 @@
|
|||
|
||||
#include "common/config.h"
|
||||
|
||||
#include "common/make_unique.h"
|
||||
|
||||
|
||||
#if defined(PLATFORM_WINDOWS)
|
||||
#include "app/system_windows.h"
|
||||
#elif defined(PLATFORM_LINUX)
|
||||
|
@ -35,6 +32,8 @@
|
|||
#include "app/system_other.h"
|
||||
#endif
|
||||
|
||||
#include "common/make_unique.h"
|
||||
|
||||
#include <cassert>
|
||||
#include <iostream>
|
||||
|
||||
|
|
|
@ -151,9 +151,9 @@ bool CLogger::IsOpened()
|
|||
return m_file != nullptr;
|
||||
}
|
||||
|
||||
void CLogger::SetLogLevel(LogLevel type)
|
||||
void CLogger::SetLogLevel(LogLevel level)
|
||||
{
|
||||
m_logLevel = type;
|
||||
m_logLevel = level;
|
||||
}
|
||||
|
||||
bool CLogger::ParseLogLevel(const std::string& str, LogLevel& logLevel)
|
||||
|
|
|
@ -25,7 +25,7 @@ std::string FormatAssertRegexMatchError(const std::string& text,
|
|||
return "Text \"" + text + "\" did not match regex \"" + pattern + "\"";
|
||||
}
|
||||
|
||||
RegexUtils::AssertRegexMatchError::AssertRegexMatchError(
|
||||
RegexUtils::CAssertRegexMatchError::CAssertRegexMatchError(
|
||||
const std::string& text, const std::string& pattern) NOEXCEPT
|
||||
: std::runtime_error(FormatAssertRegexMatchError(text, pattern))
|
||||
{
|
||||
|
@ -37,7 +37,7 @@ boost::smatch RegexUtils::AssertRegexMatch(const std::string& text, const std::s
|
|||
boost::smatch matches;
|
||||
bool ok = boost::regex_match(text, matches, regex);
|
||||
if (!ok)
|
||||
throw AssertRegexMatchError(text, pattern);
|
||||
throw CAssertRegexMatchError(text, pattern);
|
||||
|
||||
return matches;
|
||||
}
|
||||
|
|
|
@ -26,11 +26,11 @@
|
|||
namespace RegexUtils
|
||||
{
|
||||
|
||||
class AssertRegexMatchError : public std::runtime_error
|
||||
class CAssertRegexMatchError : public std::runtime_error
|
||||
{
|
||||
public:
|
||||
explicit AssertRegexMatchError(const std::string& text,
|
||||
const std::string& pattern) NOEXCEPT;
|
||||
explicit CAssertRegexMatchError(const std::string& text,
|
||||
const std::string& pattern) NOEXCEPT;
|
||||
};
|
||||
|
||||
//! Match string with regex and return list of matches; throw exception on mismatch
|
||||
|
|
|
@ -859,8 +859,8 @@ void CCamera::FixCamera()
|
|||
}
|
||||
|
||||
void CCamera::SetViewTime(const Math::Vector &eyePt,
|
||||
const Math::Vector &lookatPt,
|
||||
float rTime)
|
||||
const Math::Vector &lookatPt,
|
||||
float rTime)
|
||||
{
|
||||
Math::Vector eye, lookat;
|
||||
|
||||
|
|
|
@ -249,7 +249,7 @@ protected:
|
|||
bool EventFrameScript(const Event &event);
|
||||
|
||||
//! Specifies the location and direction of view to the 3D engine
|
||||
void SetViewTime(const Math::Vector &vEyePt, const Math::Vector &vLookatPt, float rTime);
|
||||
void SetViewTime(const Math::Vector &eyePt, const Math::Vector &lookatPt, float rTime);
|
||||
//! Avoid the obstacles
|
||||
bool IsCollision(Math::Vector &eye, Math::Vector lookat);
|
||||
//! Avoid the obstacles
|
||||
|
|
|
@ -74,7 +74,7 @@ public:
|
|||
|
||||
//! Management of clouds
|
||||
//@{
|
||||
void SetEnabled(bool enable);
|
||||
void SetEnabled(bool enabled);
|
||||
bool GetEnabled();
|
||||
//@}
|
||||
|
||||
|
|
|
@ -4932,11 +4932,11 @@ int CEngine::GetEngineState(const ModelTriangle& triangle)
|
|||
return state;
|
||||
}
|
||||
|
||||
void CEngine::UpdateObjectShadowSpotNormal(int rank)
|
||||
void CEngine::UpdateObjectShadowSpotNormal(int objRank)
|
||||
{
|
||||
assert(rank >= 0 && rank < static_cast<int>( m_objects.size() ));
|
||||
assert(objRank >= 0 && objRank < static_cast<int>( m_objects.size() ));
|
||||
|
||||
int shadowRank = m_objects[rank].shadowRank;
|
||||
int shadowRank = m_objects[objRank].shadowRank;
|
||||
if (shadowRank == -1)
|
||||
return;
|
||||
|
||||
|
|
|
@ -48,7 +48,6 @@
|
|||
class CApplication;
|
||||
class CSoundInterface;
|
||||
class CImage;
|
||||
class CPauseManager;
|
||||
class CSystemUtils;
|
||||
struct SystemTimeStamp;
|
||||
struct Event;
|
||||
|
@ -717,7 +716,7 @@ public:
|
|||
//@}
|
||||
|
||||
//! Increments the triangle counter for the current frame
|
||||
void AddStatisticTriangle(int nb);
|
||||
void AddStatisticTriangle(int count);
|
||||
//! Returns the number of triangles in current frame
|
||||
int GetStatisticTriangle();
|
||||
|
||||
|
@ -778,7 +777,7 @@ public:
|
|||
// Objects
|
||||
|
||||
//! Print debug info about an object
|
||||
void DebugObject(int rank);
|
||||
void DebugObject(int objRank);
|
||||
|
||||
//! Creates a new object and returns its rank
|
||||
int CreateObject();
|
||||
|
@ -942,7 +941,7 @@ public:
|
|||
void SetTexture(const Texture& tex, int stage = 0);
|
||||
|
||||
//! Deletes the given texture, unloading it and removing from cache
|
||||
void DeleteTexture(const std::string& name);
|
||||
void DeleteTexture(const std::string& texName);
|
||||
//! Deletes the given texture, unloading it and removing from cache
|
||||
void DeleteTexture(const Texture& tex);
|
||||
|
||||
|
@ -1215,7 +1214,7 @@ protected:
|
|||
//! Draws the mouse cursor
|
||||
void DrawMouse();
|
||||
//! Draw part of mouse cursor sprite
|
||||
void DrawMouseSprite(Math::Point pos, Math::Point dim, int icon);
|
||||
void DrawMouseSprite(Math::Point pos, Math::Point size, int icon);
|
||||
//! Draw statistic texts
|
||||
void DrawStats();
|
||||
//! Draw mission timer
|
||||
|
@ -1225,7 +1224,7 @@ protected:
|
|||
EngineBaseObjTexTier& AddLevel2(EngineBaseObject& p1, const std::string& tex1Name, const std::string& tex2Name);
|
||||
//! Creates a new tier 3 object (data)
|
||||
EngineBaseObjDataTier& AddLevel3(EngineBaseObjTexTier &p3, EngineTriangleType type,
|
||||
const Material& mat, int state);
|
||||
const Material& material, int state);
|
||||
|
||||
//! Create texture and add it to cache
|
||||
Texture CreateTexture(const std::string &texName, const TextureCreateParams ¶ms, CImage* image = nullptr);
|
||||
|
|
|
@ -448,7 +448,7 @@ void CLightManager::UpdateDeviceLights(EngineObjectType type)
|
|||
m_lightMap[i] = -1;
|
||||
|
||||
std::vector<DynamicLight> sortedLights = m_dynLights;
|
||||
LightsComparator lightsComparator(m_engine->GetEyePt(), type);
|
||||
CLightsComparator lightsComparator(m_engine->GetEyePt(), type);
|
||||
std::sort(sortedLights.begin(), sortedLights.end(), lightsComparator);
|
||||
|
||||
int lightMapIndex = 0;
|
||||
|
@ -497,13 +497,13 @@ void CLightManager::UpdateDeviceLights(EngineObjectType type)
|
|||
|
||||
// -----------
|
||||
|
||||
CLightManager::LightsComparator::LightsComparator(Math::Vector eyePos, EngineObjectType objectType)
|
||||
CLightManager::CLightsComparator::CLightsComparator(Math::Vector eyePos, EngineObjectType objectType)
|
||||
{
|
||||
m_eyePos = eyePos;
|
||||
m_objectType = objectType;
|
||||
}
|
||||
|
||||
float CLightManager::LightsComparator::GetLightWeight(const DynamicLight& dynLight)
|
||||
float CLightManager::CLightsComparator::GetLightWeight(const DynamicLight& dynLight)
|
||||
{
|
||||
if (dynLight.priority == LIGHT_PRI_HIGHEST)
|
||||
return -1.0f;
|
||||
|
@ -519,7 +519,7 @@ float CLightManager::LightsComparator::GetLightWeight(const DynamicLight& dynLig
|
|||
return enabled ? ( (dynLight.light.position - m_eyePos).Length() * dynLight.priority ) : 10000.0f;
|
||||
}
|
||||
|
||||
bool CLightManager::LightsComparator::operator()(const DynamicLight& left, const DynamicLight& right)
|
||||
bool CLightManager::CLightsComparator::operator()(const DynamicLight& left, const DynamicLight& right)
|
||||
{
|
||||
float leftWeight = GetLightWeight(left);
|
||||
float rightWeight = GetLightWeight(right);
|
||||
|
|
|
@ -168,7 +168,7 @@ public:
|
|||
//! Returns the light parameters for given dynamic light
|
||||
bool GetLight(int lightRank, Light &light);
|
||||
//! Enables/disables the given dynamic light
|
||||
bool SetLightEnabled(int lightRank, bool enable);
|
||||
bool SetLightEnabled(int lightRank, bool enabled);
|
||||
//! Changes the light priority
|
||||
bool SetLightPriority(int lightRank, LightPriority priority);
|
||||
|
||||
|
@ -212,10 +212,10 @@ public:
|
|||
void UpdateDeviceLights(EngineObjectType type);
|
||||
|
||||
protected:
|
||||
class LightsComparator
|
||||
class CLightsComparator
|
||||
{
|
||||
public:
|
||||
LightsComparator(Math::Vector eyePos, EngineObjectType objectType);
|
||||
CLightsComparator(Math::Vector eyePos, EngineObjectType objectType);
|
||||
|
||||
bool operator()(const DynamicLight& left, const DynamicLight& right);
|
||||
|
||||
|
|
|
@ -93,7 +93,7 @@ protected:
|
|||
void DeleteObject(bool primary, bool secondary);
|
||||
|
||||
//! Creates an explosion with triangular form of particles
|
||||
void CreateTriangle(CObject* obj, ObjectType type, int part);
|
||||
void CreateTriangle(CObject* obj, ObjectType oType, int part);
|
||||
|
||||
//! Starts the explosion of a vehicle
|
||||
void ExploStart();
|
||||
|
|
|
@ -247,13 +247,13 @@ bool CTerrain::LoadResources(const std::string& fileName)
|
|||
return true;
|
||||
}
|
||||
|
||||
TerrainRes CTerrain::GetResource(const Math::Vector &p)
|
||||
TerrainRes CTerrain::GetResource(const Math::Vector &pos)
|
||||
{
|
||||
if (m_resources.empty())
|
||||
return TR_NULL;
|
||||
|
||||
int x = static_cast<int>((p.x + (m_mosaicCount*m_brickCount*m_brickSize)/2.0f)/m_brickSize);
|
||||
int y = static_cast<int>((p.z + (m_mosaicCount*m_brickCount*m_brickSize)/2.0f)/m_brickSize);
|
||||
int x = static_cast<int>((pos.x + (m_mosaicCount*m_brickCount*m_brickSize)/2.0f)/m_brickSize);
|
||||
int y = static_cast<int>((pos.z + (m_mosaicCount*m_brickCount*m_brickSize)/2.0f)/m_brickSize);
|
||||
|
||||
if ( x < 0 || x > m_mosaicCount*m_brickCount ||
|
||||
y < 0 || y > m_mosaicCount*m_brickCount )
|
||||
|
@ -1677,16 +1677,16 @@ bool CTerrain::DeleteBuildingLevel(Math::Vector center)
|
|||
return false;
|
||||
}
|
||||
|
||||
float CTerrain::GetBuildingFactor(const Math::Vector &p)
|
||||
float CTerrain::GetBuildingFactor(const Math::Vector &pos)
|
||||
{
|
||||
for (int i = 0; i < static_cast<int>( m_buildingLevels.size() ); i++)
|
||||
{
|
||||
if ( p.x < m_buildingLevels[i].bboxMinX ||
|
||||
p.x > m_buildingLevels[i].bboxMaxX ||
|
||||
p.z < m_buildingLevels[i].bboxMinZ ||
|
||||
p.z > m_buildingLevels[i].bboxMaxZ ) continue;
|
||||
if ( pos.x < m_buildingLevels[i].bboxMinX ||
|
||||
pos.x > m_buildingLevels[i].bboxMaxX ||
|
||||
pos.z < m_buildingLevels[i].bboxMinZ ||
|
||||
pos.z > m_buildingLevels[i].bboxMaxZ ) continue;
|
||||
|
||||
float dist = Math::DistanceProjected(p, m_buildingLevels[i].center);
|
||||
float dist = Math::DistanceProjected(pos, m_buildingLevels[i].center);
|
||||
|
||||
if (dist <= m_buildingLevels[i].max)
|
||||
return m_buildingLevels[i].factor;
|
||||
|
@ -1730,9 +1730,9 @@ void CTerrain::AdjustBuildingLevel(Math::Vector &p)
|
|||
}
|
||||
}
|
||||
|
||||
float CTerrain::GetHardness(const Math::Vector &p)
|
||||
float CTerrain::GetHardness(const Math::Vector &pos)
|
||||
{
|
||||
float factor = GetBuildingFactor(p);
|
||||
float factor = GetBuildingFactor(pos);
|
||||
if (factor != 1.0f) return 1.0f; // on building level
|
||||
|
||||
if (m_materialPoints.empty()) return m_defaultHardness;
|
||||
|
@ -1741,8 +1741,8 @@ float CTerrain::GetHardness(const Math::Vector &p)
|
|||
|
||||
int x, y;
|
||||
|
||||
x = static_cast<int>((p.x+dim)/m_brickSize);
|
||||
y = static_cast<int>((p.z+dim)/m_brickSize);
|
||||
x = static_cast<int>((pos.x+dim)/m_brickSize);
|
||||
y = static_cast<int>((pos.z+dim)/m_brickSize);
|
||||
|
||||
if ( x < 0 || x > m_mosaicCount*m_brickCount ||
|
||||
y < 0 || y > m_mosaicCount*m_brickCount ) return m_defaultHardness;
|
||||
|
|
|
@ -157,7 +157,7 @@ public:
|
|||
//! Clears all terrain materials
|
||||
void FlushMaterials();
|
||||
//! Adds a terrain material the names of textures to use for the land
|
||||
void AddMaterial(int id, const std::string& baseName, const Math::Point& uv,
|
||||
void AddMaterial(int id, const std::string& texName, const Math::Point& uv,
|
||||
int up, int right, int down, int left, float hardness);
|
||||
//! Initializes all the ground with one material
|
||||
bool InitMaterials(int id);
|
||||
|
|
|
@ -22,14 +22,14 @@
|
|||
|
||||
#include "app/app.h"
|
||||
|
||||
#include "graphics/engine/engine.h"
|
||||
|
||||
#include "common/image.h"
|
||||
#include "common/logger.h"
|
||||
#include "common/stringutils.h"
|
||||
|
||||
#include "common/resources/resourcemanager.h"
|
||||
|
||||
#include "graphics/engine/engine.h"
|
||||
|
||||
#include "math/func.h"
|
||||
|
||||
#include <SDL.h>
|
||||
|
|
|
@ -27,8 +27,8 @@
|
|||
|
||||
#include "graphics/core/color.h"
|
||||
|
||||
#include "math/point.h"
|
||||
#include "math/intpoint.h"
|
||||
#include "math/point.h"
|
||||
|
||||
#include <map>
|
||||
#include <memory>
|
||||
|
@ -309,7 +309,7 @@ public:
|
|||
CharTexture GetCharTexture(UTF8Char ch, FontType font, float size);
|
||||
|
||||
protected:
|
||||
CachedFont* GetOrOpenFont(FontType type, float size);
|
||||
CachedFont* GetOrOpenFont(FontType font, float size);
|
||||
CharTexture CreateCharTexture(UTF8Char ch, CachedFont* font);
|
||||
|
||||
void DrawString(const std::string &text, std::vector<FontMetaChar>::iterator format,
|
||||
|
|
|
@ -59,8 +59,8 @@ namespace ModelInput
|
|||
VertexTex2 ReadBinaryVertexTex2(std::istream& stream);
|
||||
Material ReadBinaryMaterial(std::istream& stream);
|
||||
|
||||
std::string ReadLineString(std::istream& stream, const std::string& prefix);
|
||||
void ReadValuePrefix(std::istream& stream, const std::string& prefix);
|
||||
std::string ReadLineString(std::istream& stream, const std::string& expectedPrefix);
|
||||
void ReadValuePrefix(std::istream& stream, const std::string& expectedPrefix);
|
||||
VertexTex2 ParseVertexTex2(const std::string& text);
|
||||
Material ParseMaterial(const std::string& text);
|
||||
Math::Vector ParseVector(const std::string& text);
|
||||
|
|
|
@ -24,10 +24,9 @@
|
|||
|
||||
#pragma once
|
||||
|
||||
#include "level/level_category.h"
|
||||
|
||||
#include "common/make_unique.h"
|
||||
|
||||
#include "level/level_category.h"
|
||||
#include "level/robotmain.h"
|
||||
|
||||
#include "level/parser/parserexceptions.h"
|
||||
|
|
|
@ -502,15 +502,21 @@ void CRobotMain::ChangePhase(Phase phase)
|
|||
if (CResourceManager::DirectoryExists("crashsave"))
|
||||
{
|
||||
GetLogger()->Info("Pre-crash save found!\n");
|
||||
m_ui->GetDialog()->StartQuestion("Your game seems to have crashed. Do you want to restore pre-crash state?", false, false, false, [&]() {
|
||||
GetLogger()->Info("Trying to restore pre-crash state...\n");
|
||||
assert(m_playerProfile != nullptr);
|
||||
m_playerProfile->LoadScene("../../crashsave");
|
||||
CResourceManager::RemoveDirectory("crashsave");
|
||||
}, [&]() {
|
||||
GetLogger()->Info("Not restoring pre-crash state\n");
|
||||
CResourceManager::RemoveDirectory("crashsave");
|
||||
});
|
||||
m_ui->GetDialog()->StartQuestion(
|
||||
"Your game seems to have crashed. Do you want to restore pre-crash state?", false, false, false,
|
||||
[&]()
|
||||
{
|
||||
GetLogger()->Info("Trying to restore pre-crash state...\n");
|
||||
assert(m_playerProfile != nullptr);
|
||||
m_playerProfile->LoadScene("../../crashsave");
|
||||
CResourceManager::RemoveDirectory("crashsave");
|
||||
},
|
||||
[&]()
|
||||
{
|
||||
GetLogger()->Info("Not restoring pre-crash state\n");
|
||||
CResourceManager::RemoveDirectory("crashsave");
|
||||
}
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -1018,9 +1024,13 @@ bool CRobotMain::ProcessEvent(Event &event)
|
|||
break;
|
||||
|
||||
case EVENT_OBJECT_DELETE:
|
||||
m_ui->GetDialog()->StartQuestion(RT_DIALOG_DELOBJ, true, false, false, [&]() {
|
||||
DestroySelectedObject();
|
||||
});
|
||||
m_ui->GetDialog()->StartQuestion(
|
||||
RT_DIALOG_DELOBJ, true, false, false,
|
||||
[&]()
|
||||
{
|
||||
DestroySelectedObject();
|
||||
}
|
||||
);
|
||||
break;
|
||||
|
||||
case EVENT_OBJECT_BHELP:
|
||||
|
@ -2256,9 +2266,9 @@ void CRobotMain::ChangeCamera()
|
|||
}
|
||||
|
||||
//! Remote control the camera using the arrow keys
|
||||
void CRobotMain::KeyCamera(EventType type, InputSlot key)
|
||||
void CRobotMain::KeyCamera(EventType event, InputSlot key)
|
||||
{
|
||||
if (type == EVENT_KEY_UP)
|
||||
if (event == EVENT_KEY_UP)
|
||||
{
|
||||
if (key == INPUT_SLOT_LEFT)
|
||||
{
|
||||
|
@ -2290,7 +2300,7 @@ void CRobotMain::KeyCamera(EventType type, InputSlot key)
|
|||
assert(obj->Implements(ObjectInterfaceType::Controllable));
|
||||
if (!dynamic_cast<CControllableObject*>(obj)->GetTrainer()) return;
|
||||
|
||||
if (type == EVENT_KEY_DOWN)
|
||||
if (event == EVENT_KEY_DOWN)
|
||||
{
|
||||
if (key == INPUT_SLOT_LEFT)
|
||||
{
|
||||
|
|
|
@ -30,14 +30,14 @@
|
|||
#include "common/event.h"
|
||||
#include "common/singleton.h"
|
||||
|
||||
#include "graphics/engine/camera.h"
|
||||
#include "graphics/engine/particle.h"
|
||||
|
||||
#include "level/build_type.h"
|
||||
#include "level/level_category.h"
|
||||
#include "level/mainmovie.h"
|
||||
#include "level/research_type.h"
|
||||
|
||||
#include "graphics/engine/camera.h"
|
||||
#include "graphics/engine/particle.h"
|
||||
|
||||
#include "object/drive_type.h"
|
||||
#include "object/mission_type.h"
|
||||
#include "object/object_type.h"
|
||||
|
@ -193,8 +193,8 @@ public:
|
|||
void SelectHuman();
|
||||
CObject* SearchHuman();
|
||||
CObject* SearchToto();
|
||||
CObject* SearchNearest(Math::Vector pos, CObject* pExclu);
|
||||
bool SelectObject(CObject* pObj, bool displayError=true);
|
||||
CObject* SearchNearest(Math::Vector pos, CObject* exclu);
|
||||
bool SelectObject(CObject* obj, bool displayError=true);
|
||||
CObject* GetSelectObject();
|
||||
CObject* DeselectAll();
|
||||
|
||||
|
@ -259,15 +259,15 @@ public:
|
|||
void HideDropZone(CObject* metal);
|
||||
void ShowDropZone(CObject* metal, CObject* transporter);
|
||||
void FlushShowLimit(int i);
|
||||
void SetShowLimit(int i, Gfx::ParticleType parti, CObject *pObj, Math::Vector pos,
|
||||
void SetShowLimit(int i, Gfx::ParticleType parti, CObject *obj, Math::Vector pos,
|
||||
float radius, float duration=SHOWLIMITTIME);
|
||||
void StartShowLimit();
|
||||
void FrameShowLimit(float rTime);
|
||||
|
||||
void SaveAllScript();
|
||||
void SaveOneScript(CObject *pObj);
|
||||
bool SaveFileStack(CObject *pObj, FILE *file, int objRank);
|
||||
bool ReadFileStack(CObject *pObj, FILE *file, int objRank);
|
||||
void SaveOneScript(CObject *obj);
|
||||
bool SaveFileStack(CObject *obj, FILE *file, int objRank);
|
||||
bool ReadFileStack(CObject *obj, FILE *file, int objRank);
|
||||
|
||||
void FlushNewScriptName();
|
||||
void AddNewScriptName(ObjectType type, const std::string& name);
|
||||
|
@ -365,7 +365,7 @@ public:
|
|||
|
||||
void StartDetectEffect(COldObject* object, CObject* target);
|
||||
|
||||
bool IsSelectable(CObject* pObj);
|
||||
bool IsSelectable(CObject* obj);
|
||||
|
||||
protected:
|
||||
bool EventFrame(const Event &event);
|
||||
|
@ -390,7 +390,7 @@ protected:
|
|||
void RemoteCamera(float pan, float zoom, float rTime);
|
||||
void KeyCamera(EventType event, InputSlot key);
|
||||
void AbortMovie();
|
||||
void SelectOneObject(CObject* pObj, bool displayError=true);
|
||||
void SelectOneObject(CObject* obj, bool displayError=true);
|
||||
void HelpObject();
|
||||
bool DeselectObject();
|
||||
void DeleteAllObjects();
|
||||
|
|
|
@ -19,10 +19,10 @@
|
|||
|
||||
#include "level/scene_conditions.h"
|
||||
|
||||
#include "math/geometry.h"
|
||||
|
||||
#include "level/parser/parserline.h"
|
||||
|
||||
#include "math/geometry.h"
|
||||
|
||||
#include "object/object.h"
|
||||
#include "object/object_manager.h"
|
||||
|
||||
|
|
|
@ -32,12 +32,12 @@
|
|||
|
||||
#include "object/old_object.h"
|
||||
|
||||
#include "sound/sound.h"
|
||||
|
||||
#include "ui/controls/gauge.h"
|
||||
#include "ui/controls/interface.h"
|
||||
#include "ui/controls/window.h"
|
||||
|
||||
#include "sound/sound.h"
|
||||
|
||||
|
||||
// Object's constructor.
|
||||
|
||||
|
@ -372,9 +372,9 @@ bool CAuto::GetBusy()
|
|||
return m_bBusy;
|
||||
}
|
||||
|
||||
void CAuto::SetBusy(bool bBusy)
|
||||
void CAuto::SetBusy(bool busy)
|
||||
{
|
||||
m_bBusy = bBusy;
|
||||
m_bBusy = busy;
|
||||
}
|
||||
|
||||
void CAuto::InitProgressTotal(float total)
|
||||
|
|
|
@ -19,9 +19,8 @@
|
|||
|
||||
#pragma once
|
||||
|
||||
|
||||
#include "common/event.h"
|
||||
#include "common/error.h"
|
||||
#include "common/event.h"
|
||||
|
||||
#include "object/object_type.h"
|
||||
|
||||
|
@ -75,7 +74,7 @@ public:
|
|||
virtual Error GetError();
|
||||
|
||||
virtual bool GetBusy();
|
||||
virtual void SetBusy(bool bBuse);
|
||||
virtual void SetBusy(bool busy);
|
||||
virtual void InitProgressTotal(float total);
|
||||
virtual void EventProgress(float rTime);
|
||||
|
||||
|
|
|
@ -41,8 +41,6 @@
|
|||
#include "ui/controls/interface.h"
|
||||
#include "ui/controls/window.h"
|
||||
|
||||
#include "sound/sound.h"
|
||||
|
||||
|
||||
|
||||
const float BASE_LAND_TIME = 7.5f; // hard landing
|
||||
|
|
|
@ -86,7 +86,7 @@ public:
|
|||
|
||||
protected:
|
||||
void UpdateInterface();
|
||||
void FreezeCargo(bool bFreeze);
|
||||
void FreezeCargo(bool freeze);
|
||||
void MoveCargo();
|
||||
Error CheckCloseDoor();
|
||||
void BeginTransit();
|
||||
|
|
|
@ -22,11 +22,11 @@
|
|||
|
||||
#include "common/make_unique.h"
|
||||
|
||||
#include "level/robotmain.h"
|
||||
|
||||
#include "level/parser/parserline.h"
|
||||
#include "level/parser/parserparam.h"
|
||||
|
||||
#include "level/robotmain.h"
|
||||
|
||||
#include "math/geometry.h"
|
||||
|
||||
#include "object/object_manager.h"
|
||||
|
@ -34,11 +34,11 @@
|
|||
|
||||
#include "object/interface/transportable_object.h"
|
||||
|
||||
#include "sound/sound.h"
|
||||
|
||||
#include "ui/controls/interface.h"
|
||||
#include "ui/controls/window.h"
|
||||
|
||||
#include "sound/sound.h"
|
||||
|
||||
|
||||
// Object's constructor.
|
||||
|
||||
|
|
|
@ -42,7 +42,7 @@ public:
|
|||
CAutoConvert(COldObject* object);
|
||||
~CAutoConvert();
|
||||
|
||||
void DeleteObject(bool bAll=false) override;
|
||||
void DeleteObject(bool all=false) override;
|
||||
|
||||
void Init() override;
|
||||
bool EventProcess(const Event &event) override;
|
||||
|
|
|
@ -37,8 +37,6 @@
|
|||
#include "ui/controls/interface.h"
|
||||
#include "ui/controls/window.h"
|
||||
|
||||
#include "sound/sound.h"
|
||||
|
||||
|
||||
|
||||
const float DERRICK_DELAY = 10.0f; // duration of the extraction
|
||||
|
|
|
@ -42,7 +42,7 @@ public:
|
|||
CAutoDerrick(COldObject* object);
|
||||
~CAutoDerrick();
|
||||
|
||||
void DeleteObject(bool bAll=false) override;
|
||||
void DeleteObject(bool all=false) override;
|
||||
|
||||
void Init() override;
|
||||
bool EventProcess(const Event &event) override;
|
||||
|
|
|
@ -37,8 +37,6 @@
|
|||
#include "ui/controls/interface.h"
|
||||
#include "ui/controls/window.h"
|
||||
|
||||
#include "sound/sound.h"
|
||||
|
||||
#include <limits>
|
||||
|
||||
|
||||
|
|
|
@ -32,8 +32,8 @@
|
|||
#include "object/object_manager.h"
|
||||
#include "object/old_object.h"
|
||||
|
||||
#include "object/interface/programmable_object.h"
|
||||
#include "object/interface/program_storage_object.h"
|
||||
#include "object/interface/programmable_object.h"
|
||||
#include "object/interface/transportable_object.h"
|
||||
|
||||
|
||||
|
|
|
@ -42,7 +42,7 @@ public:
|
|||
CAutoEgg(COldObject* object);
|
||||
~CAutoEgg();
|
||||
|
||||
void DeleteObject(bool bAll=false) override;
|
||||
void DeleteObject(bool all=false) override;
|
||||
|
||||
void Init() override;
|
||||
void Start(int param) override;
|
||||
|
|
|
@ -22,20 +22,20 @@
|
|||
|
||||
#include "common/make_unique.h"
|
||||
|
||||
#include "math/geometry.h"
|
||||
|
||||
#include "level/robotmain.h"
|
||||
|
||||
#include "level/parser/parser.h"
|
||||
#include "level/parser/parserline.h"
|
||||
#include "level/parser/parserparam.h"
|
||||
|
||||
#include "math/geometry.h"
|
||||
|
||||
#include "object/object_create_params.h"
|
||||
#include "object/object_manager.h"
|
||||
#include "object/old_object.h"
|
||||
|
||||
#include "object/interface/programmable_object.h"
|
||||
#include "object/interface/program_storage_object.h"
|
||||
#include "object/interface/programmable_object.h"
|
||||
#include "object/interface/transportable_object.h"
|
||||
|
||||
#include "physics/physics.h"
|
||||
|
|
|
@ -43,7 +43,7 @@ public:
|
|||
CAutoFactory(COldObject* object);
|
||||
~CAutoFactory();
|
||||
|
||||
void DeleteObject(bool bAll=false) override;
|
||||
void DeleteObject(bool all=false) override;
|
||||
|
||||
void Init() override;
|
||||
bool EventProcess(const Event &event) override;
|
||||
|
|
|
@ -35,11 +35,11 @@
|
|||
|
||||
#include "object/interface/powered_object.h"
|
||||
|
||||
#include "sound/sound.h"
|
||||
|
||||
#include "ui/controls/interface.h"
|
||||
#include "ui/controls/window.h"
|
||||
|
||||
#include "sound/sound.h"
|
||||
|
||||
|
||||
|
||||
const float LABO_DELAY = 20.0f; // duration of the analysis
|
||||
|
|
|
@ -39,7 +39,7 @@ public:
|
|||
CAutoNest(COldObject* object);
|
||||
~CAutoNest();
|
||||
|
||||
void DeleteObject(bool bAll=false) override;
|
||||
void DeleteObject(bool all=false) override;
|
||||
|
||||
void Init() override;
|
||||
bool EventProcess(const Event &event) override;
|
||||
|
|
|
@ -22,13 +22,13 @@
|
|||
|
||||
#include "common/make_unique.h"
|
||||
|
||||
#include "math/geometry.h"
|
||||
|
||||
#include "level/robotmain.h"
|
||||
|
||||
#include "level/parser/parserline.h"
|
||||
#include "level/parser/parserparam.h"
|
||||
|
||||
#include "math/geometry.h"
|
||||
|
||||
#include "object/object_manager.h"
|
||||
#include "object/old_object.h"
|
||||
|
||||
|
|
|
@ -42,7 +42,7 @@ public:
|
|||
CAutoNuclearPlant(COldObject* object);
|
||||
~CAutoNuclearPlant();
|
||||
|
||||
void DeleteObject(bool bAll=false) override;
|
||||
void DeleteObject(bool all=false) override;
|
||||
|
||||
void Init() override;
|
||||
bool EventProcess(const Event &event) override;
|
||||
|
|
|
@ -22,11 +22,11 @@
|
|||
|
||||
#include "common/make_unique.h"
|
||||
|
||||
#include "math/geometry.h"
|
||||
|
||||
#include "level/parser/parserline.h"
|
||||
#include "level/parser/parserparam.h"
|
||||
|
||||
#include "math/geometry.h"
|
||||
|
||||
#include "object/object_manager.h"
|
||||
#include "object/old_object.h"
|
||||
|
||||
|
|
|
@ -43,7 +43,7 @@ public:
|
|||
CAutoPowerPlant(COldObject* object);
|
||||
~CAutoPowerPlant();
|
||||
|
||||
void DeleteObject(bool bAll=false) override;
|
||||
void DeleteObject(bool all=false) override;
|
||||
|
||||
void Init() override;
|
||||
bool EventProcess(const Event &event) override;
|
||||
|
|
|
@ -42,7 +42,7 @@ public:
|
|||
void DeleteObject(bool bAll=false) override;
|
||||
|
||||
void Init() override;
|
||||
Error StartAction(int result) override;
|
||||
Error StartAction(int param) override;
|
||||
bool EventProcess(const Event &event) override;
|
||||
Error GetError() override;
|
||||
|
||||
|
|
|
@ -17,7 +17,7 @@
|
|||
* along with this program. If not, see http://gnu.org/licenses
|
||||
*/
|
||||
|
||||
#include "object/implementation/programmable_impl.h"
|
||||
#include "object/implementation/program_storage_impl.h"
|
||||
|
||||
#include "common/global.h"
|
||||
#include "common/logger.h"
|
||||
|
|
|
@ -19,12 +19,13 @@
|
|||
|
||||
#pragma once
|
||||
|
||||
#include "object/interface/interactive_object.h"
|
||||
#include "object/interface/programmable_object.h"
|
||||
#include "object/interface/trace_drawing_object.h"
|
||||
|
||||
#include "math/vector.h"
|
||||
|
||||
#include "object/interface/interactive_object.h"
|
||||
#include "object/interface/trace_drawing_object.h"
|
||||
|
||||
#include <sstream>
|
||||
|
||||
class CObject;
|
||||
|
@ -64,7 +65,7 @@ public:
|
|||
void TraceRecordStop() override;
|
||||
bool IsTraceRecord() override;
|
||||
|
||||
void SetActivity(bool bMode) override;
|
||||
void SetActivity(bool activity) override;
|
||||
bool GetActivity() override;
|
||||
|
||||
void SetCmdLine(unsigned int rank, float value);
|
||||
|
|
|
@ -53,9 +53,9 @@ enum class TraceColor
|
|||
Max,
|
||||
};
|
||||
//! Convert TraceColor to a std::string
|
||||
std::string TraceColorName(TraceColor c);
|
||||
std::string TraceColorName(TraceColor color);
|
||||
//! Return Gfx::Color for this TraceColor constants
|
||||
Gfx::Color TraceColorColor(TraceColor c);
|
||||
Gfx::Color TraceColorColor(TraceColor color);
|
||||
|
||||
/**
|
||||
* \class CTraceDrawingObject
|
||||
|
|
|
@ -23,13 +23,13 @@
|
|||
#include "common/restext.h"
|
||||
#include "common/stringutils.h"
|
||||
|
||||
#include "graphics/model/model_crash_sphere.h"
|
||||
|
||||
#include "level/robotmain.h"
|
||||
|
||||
#include "level/parser/parserline.h"
|
||||
#include "level/parser/parserparam.h"
|
||||
|
||||
#include "graphics/model/model_crash_sphere.h"
|
||||
|
||||
#include "script/scriptfunc.h"
|
||||
|
||||
#include <stdexcept>
|
||||
|
|
|
@ -28,6 +28,11 @@
|
|||
|
||||
#include "object/object.h"
|
||||
|
||||
#include "object/implementation/power_container_impl.h"
|
||||
#include "object/implementation/program_storage_impl.h"
|
||||
#include "object/implementation/programmable_impl.h"
|
||||
#include "object/implementation/task_executor_impl.h"
|
||||
|
||||
#include "object/interface/carrier_object.h"
|
||||
#include "object/interface/controllable_object.h"
|
||||
#include "object/interface/flying_object.h"
|
||||
|
@ -44,11 +49,6 @@
|
|||
#include "object/interface/trace_drawing_object.h"
|
||||
#include "object/interface/transportable_object.h"
|
||||
|
||||
#include "object/implementation/power_container_impl.h"
|
||||
#include "object/implementation/program_storage_impl.h"
|
||||
#include "object/implementation/programmable_impl.h"
|
||||
#include "object/implementation/task_executor_impl.h"
|
||||
|
||||
// The father of all parts must always be the part number zero!
|
||||
const int OBJECTMAXPART = 40;
|
||||
|
||||
|
@ -101,7 +101,7 @@ protected:
|
|||
void SetMovable(std::unique_ptr<CMotion> motion, std::unique_ptr<CPhysics> physics);
|
||||
void SetAuto(std::unique_ptr<CAuto> automat);
|
||||
void SetOption(int option);
|
||||
void SetJostlingSphere(const Math::Sphere& sphere);
|
||||
void SetJostlingSphere(const Math::Sphere& jostlingSphere);
|
||||
|
||||
|
||||
public:
|
||||
|
@ -360,7 +360,6 @@ protected:
|
|||
float m_cameraDist;
|
||||
bool m_bCameraLock;
|
||||
float m_magnifyDamage;
|
||||
float m_param;
|
||||
|
||||
Math::Sphere m_jostlingSphere;
|
||||
float m_shieldRadius;
|
||||
|
|
|
@ -24,8 +24,6 @@
|
|||
#include "level/parser/parserline.h"
|
||||
#include "level/parser/parserparam.h"
|
||||
|
||||
#include "graphics/engine/oldmodelmanager.h"
|
||||
|
||||
#include "object/object_create_params.h"
|
||||
|
||||
#include "object/motion/motionant.h"
|
||||
|
@ -87,7 +85,7 @@ std::unique_ptr<CBaseAlien> CBaseAlien::Create(
|
|||
obj->SetProgrammable();
|
||||
obj->SetMovable(std::move(motion), std::move(physics));
|
||||
|
||||
return std::move(obj);
|
||||
return obj;
|
||||
}
|
||||
|
||||
void CBaseAlien::SetFixed(bool fixed)
|
||||
|
|
|
@ -889,5 +889,5 @@ std::unique_ptr<CBaseBuilding> CBaseBuilding::Create(
|
|||
|
||||
obj->UpdateMapping();
|
||||
|
||||
return std::move(obj);
|
||||
return obj;
|
||||
}
|
||||
|
|
|
@ -55,7 +55,7 @@ std::unique_ptr<CBaseRobot> CBaseRobot::Create(
|
|||
auto motion = MakeUnique<CMotionToto>(obj.get());
|
||||
motion->Create(params.pos, params.angle, params.type, 1.0f, modelManager);
|
||||
obj->SetMovable(std::move(motion), nullptr);
|
||||
return std::move(obj);
|
||||
return obj;
|
||||
}
|
||||
|
||||
if ( params.type == OBJECT_HUMAN ||
|
||||
|
@ -95,5 +95,5 @@ std::unique_ptr<CBaseRobot> CBaseRobot::Create(
|
|||
obj->SetProgrammable();
|
||||
obj->SetMovable(std::move(motion), std::move(physics));
|
||||
|
||||
return std::move(obj);
|
||||
return obj;
|
||||
}
|
||||
|
|
|
@ -66,7 +66,7 @@ std::unique_ptr<CShielder> CShielder::Create(
|
|||
obj->SetProgrammable();
|
||||
obj->SetMovable(std::move(motion), std::move(physics));
|
||||
|
||||
return std::move(obj);
|
||||
return obj;
|
||||
}
|
||||
|
||||
void CShielder::SetShieldRadius(float shieldRadius)
|
||||
|
|
|
@ -20,8 +20,8 @@
|
|||
|
||||
#include "object/task/taskgoto.h"
|
||||
|
||||
#include "common/global.h"
|
||||
#include "common/event.h"
|
||||
#include "common/global.h"
|
||||
#include "common/make_unique.h"
|
||||
|
||||
#include "graphics/engine/terrain.h"
|
||||
|
|
|
@ -19,13 +19,12 @@
|
|||
|
||||
#pragma once
|
||||
|
||||
|
||||
#include "object/task/task.h"
|
||||
|
||||
#include "object/interface/trace_drawing_object.h"
|
||||
|
||||
#include "math/vector.h"
|
||||
|
||||
#include "object/interface/trace_drawing_object.h"
|
||||
|
||||
|
||||
enum TaskPenPhase
|
||||
{
|
||||
|
|
|
@ -23,10 +23,10 @@
|
|||
#include "graphics/engine/pyro_manager.h"
|
||||
#include "graphics/engine/terrain.h"
|
||||
|
||||
#include "math/geometry.h"
|
||||
|
||||
#include "level/robotmain.h"
|
||||
|
||||
#include "math/geometry.h"
|
||||
|
||||
#include "object/object_manager.h"
|
||||
#include "object/old_object.h"
|
||||
|
||||
|
|
|
@ -3680,14 +3680,14 @@ void CScriptFunctions::Init()
|
|||
CBotClass* bc;
|
||||
|
||||
// Add the class Point.
|
||||
bc = new CBotClass("point", nullptr, true); // intrinsic class
|
||||
bc = CBotClass::Create("point", nullptr, true); // intrinsic class
|
||||
bc->AddItem("x", CBotTypFloat);
|
||||
bc->AddItem("y", CBotTypFloat);
|
||||
bc->AddItem("z", CBotTypFloat);
|
||||
bc->AddFunction("point", CScriptFunctions::rPointConstructor, CScriptFunctions::cPointConstructor);
|
||||
|
||||
// Adds the class Object.
|
||||
bc = new CBotClass("object", nullptr);
|
||||
bc = CBotClass::Create("object", nullptr);
|
||||
bc->AddItem("category", CBotTypResult(CBotTypInt), PR_READ);
|
||||
bc->AddItem("position", CBotTypResult(CBotTypClass, "point"), PR_READ);
|
||||
bc->AddItem("orientation", CBotTypResult(CBotTypFloat), PR_READ);
|
||||
|
@ -3718,7 +3718,7 @@ void CScriptFunctions::Init()
|
|||
// canal.close(); // close the file
|
||||
|
||||
// create the class FILE
|
||||
bc = new CBotClass("file", nullptr);
|
||||
bc = CBotClass::Create("file", nullptr);
|
||||
// adds the component ".filename"
|
||||
bc->AddItem("filename", CBotTypString);
|
||||
// adds the component ".handle"
|
||||
|
@ -3991,6 +3991,6 @@ void CScriptFunctions::DestroyObjectVar(CBotVar* botVar, bool permanent)
|
|||
if ( botVar == nullptr ) return;
|
||||
|
||||
botVar->SetUserPtr(OBJECTDELETED);
|
||||
if(permanent)
|
||||
delete botVar;
|
||||
if (permanent)
|
||||
CBotVar::Destroy(botVar);
|
||||
}
|
||||
|
|
|
@ -27,7 +27,7 @@
|
|||
|
||||
#include <boost/filesystem.hpp>
|
||||
|
||||
ALSound::ALSound()
|
||||
CALSound::CALSound()
|
||||
: m_enabled(false),
|
||||
m_audioVolume(1.0f),
|
||||
m_musicVolume(1.0f),
|
||||
|
@ -37,14 +37,12 @@ ALSound::ALSound()
|
|||
{
|
||||
}
|
||||
|
||||
|
||||
ALSound::~ALSound()
|
||||
CALSound::~CALSound()
|
||||
{
|
||||
CleanUp();
|
||||
}
|
||||
|
||||
|
||||
void ALSound::CleanUp()
|
||||
void CALSound::CleanUp()
|
||||
{
|
||||
if (m_enabled)
|
||||
{
|
||||
|
@ -71,8 +69,7 @@ void ALSound::CleanUp()
|
|||
}
|
||||
}
|
||||
|
||||
|
||||
bool ALSound::Create()
|
||||
bool CALSound::Create()
|
||||
{
|
||||
CleanUp();
|
||||
|
||||
|
@ -102,20 +99,17 @@ bool ALSound::Create()
|
|||
return true;
|
||||
}
|
||||
|
||||
|
||||
bool ALSound::GetEnable()
|
||||
bool CALSound::GetEnable()
|
||||
{
|
||||
return m_enabled;
|
||||
}
|
||||
|
||||
|
||||
void ALSound::SetAudioVolume(int volume)
|
||||
void CALSound::SetAudioVolume(int volume)
|
||||
{
|
||||
m_audioVolume = static_cast<float>(volume) / MAXVOLUME;
|
||||
}
|
||||
|
||||
|
||||
int ALSound::GetAudioVolume()
|
||||
int CALSound::GetAudioVolume()
|
||||
{
|
||||
if ( !m_enabled )
|
||||
return 0;
|
||||
|
@ -123,8 +117,7 @@ int ALSound::GetAudioVolume()
|
|||
return m_audioVolume * MAXVOLUME;
|
||||
}
|
||||
|
||||
|
||||
void ALSound::SetMusicVolume(int volume)
|
||||
void CALSound::SetMusicVolume(int volume)
|
||||
{
|
||||
m_musicVolume = static_cast<float>(volume) / MAXVOLUME;
|
||||
if (m_currentMusic)
|
||||
|
@ -133,8 +126,7 @@ void ALSound::SetMusicVolume(int volume)
|
|||
}
|
||||
}
|
||||
|
||||
|
||||
int ALSound::GetMusicVolume()
|
||||
int CALSound::GetMusicVolume()
|
||||
{
|
||||
if ( !m_enabled )
|
||||
return 0.0f;
|
||||
|
@ -142,10 +134,9 @@ int ALSound::GetMusicVolume()
|
|||
return m_musicVolume * MAXVOLUME;
|
||||
}
|
||||
|
||||
|
||||
bool ALSound::Cache(SoundType sound, const std::string &filename)
|
||||
bool CALSound::Cache(SoundType sound, const std::string &filename)
|
||||
{
|
||||
auto buffer = MakeUnique<Buffer>();
|
||||
auto buffer = MakeUnique<CBuffer>();
|
||||
if (buffer->LoadFromFile(filename, sound))
|
||||
{
|
||||
m_sounds[sound] = std::move(buffer);
|
||||
|
@ -154,11 +145,11 @@ bool ALSound::Cache(SoundType sound, const std::string &filename)
|
|||
return false;
|
||||
}
|
||||
|
||||
bool ALSound::CacheMusic(const std::string &filename)
|
||||
bool CALSound::CacheMusic(const std::string &filename)
|
||||
{
|
||||
if (m_music.find(filename) == m_music.end())
|
||||
{
|
||||
auto buffer = MakeUnique<Buffer>();
|
||||
auto buffer = MakeUnique<CBuffer>();
|
||||
if (buffer->LoadFromFile(filename, static_cast<SoundType>(-1)))
|
||||
{
|
||||
m_music[filename] = std::move(buffer);
|
||||
|
@ -168,17 +159,17 @@ bool ALSound::CacheMusic(const std::string &filename)
|
|||
return false;
|
||||
}
|
||||
|
||||
bool ALSound::IsCached(SoundType sound)
|
||||
bool CALSound::IsCached(SoundType sound)
|
||||
{
|
||||
return m_sounds.find(sound) != m_sounds.end();
|
||||
}
|
||||
|
||||
bool ALSound::IsCachedMusic(const std::string &filename)
|
||||
bool CALSound::IsCachedMusic(const std::string &filename)
|
||||
{
|
||||
return m_music.find(filename) != m_music.end();
|
||||
}
|
||||
|
||||
int ALSound::GetPriority(SoundType sound)
|
||||
int CALSound::GetPriority(SoundType sound)
|
||||
{
|
||||
if ( sound == SOUND_FLYh ||
|
||||
sound == SOUND_FLY ||
|
||||
|
@ -226,8 +217,7 @@ int ALSound::GetPriority(SoundType sound)
|
|||
return 10;
|
||||
}
|
||||
|
||||
|
||||
bool ALSound::SearchFreeBuffer(SoundType sound, int &channel, bool &alreadyLoaded)
|
||||
bool CALSound::SearchFreeBuffer(SoundType sound, int &channel, bool &alreadyLoaded)
|
||||
{
|
||||
int priority = GetPriority(sound);
|
||||
|
||||
|
@ -253,7 +243,7 @@ bool ALSound::SearchFreeBuffer(SoundType sound, int &channel, bool &alreadyLoade
|
|||
// just add a new channel if we dont have any
|
||||
if (m_channels.size() == 0)
|
||||
{
|
||||
auto chn = MakeUnique<Channel>();
|
||||
auto chn = MakeUnique<CChannel>();
|
||||
// check if we channel ready to play music, if not report error
|
||||
if (chn->IsReady())
|
||||
{
|
||||
|
@ -278,7 +268,7 @@ bool ALSound::SearchFreeBuffer(SoundType sound, int &channel, bool &alreadyLoade
|
|||
{
|
||||
if (m_channels.find(i) == m_channels.end())
|
||||
{
|
||||
auto chn = MakeUnique<Channel>();
|
||||
auto chn = MakeUnique<CChannel>();
|
||||
// check if channel is ready to play music, if not destroy it and seek free one
|
||||
if (chn->IsReady())
|
||||
{
|
||||
|
@ -321,14 +311,12 @@ bool ALSound::SearchFreeBuffer(SoundType sound, int &channel, bool &alreadyLoade
|
|||
return false;
|
||||
}
|
||||
|
||||
|
||||
int ALSound::Play(SoundType sound, float amplitude, float frequency, bool loop)
|
||||
int CALSound::Play(SoundType sound, float amplitude, float frequency, bool loop)
|
||||
{
|
||||
return Play(sound, m_eye, amplitude, frequency, loop);
|
||||
}
|
||||
|
||||
|
||||
int ALSound::Play(SoundType sound, const Math::Vector &pos, float amplitude, float frequency, bool loop)
|
||||
int CALSound::Play(SoundType sound, const Math::Vector &pos, float amplitude, float frequency, bool loop)
|
||||
{
|
||||
if (!m_enabled)
|
||||
{
|
||||
|
@ -356,7 +344,7 @@ int ALSound::Play(SoundType sound, const Math::Vector &pos, float amplitude, flo
|
|||
}
|
||||
}
|
||||
|
||||
Channel* chn = m_channels[channel].get();
|
||||
CChannel* chn = m_channels[channel].get();
|
||||
|
||||
chn->SetPosition(pos);
|
||||
chn->SetVolumeAtrib(1.0f);
|
||||
|
@ -382,8 +370,7 @@ int ALSound::Play(SoundType sound, const Math::Vector &pos, float amplitude, flo
|
|||
return channel | ((chn->GetId() & 0xffff) << 16);
|
||||
}
|
||||
|
||||
|
||||
bool ALSound::FlushEnvelope(int channel)
|
||||
bool CALSound::FlushEnvelope(int channel)
|
||||
{
|
||||
if (!CheckChannel(channel))
|
||||
{
|
||||
|
@ -394,8 +381,7 @@ bool ALSound::FlushEnvelope(int channel)
|
|||
return true;
|
||||
}
|
||||
|
||||
|
||||
bool ALSound::AddEnvelope(int channel, float amplitude, float frequency, float time, SoundNext oper)
|
||||
bool CALSound::AddEnvelope(int channel, float amplitude, float frequency, float time, SoundNext oper)
|
||||
{
|
||||
if (!CheckChannel(channel))
|
||||
{
|
||||
|
@ -413,8 +399,7 @@ bool ALSound::AddEnvelope(int channel, float amplitude, float frequency, float t
|
|||
return true;
|
||||
}
|
||||
|
||||
|
||||
bool ALSound::Position(int channel, const Math::Vector &pos)
|
||||
bool CALSound::Position(int channel, const Math::Vector &pos)
|
||||
{
|
||||
if (!CheckChannel(channel))
|
||||
{
|
||||
|
@ -425,8 +410,7 @@ bool ALSound::Position(int channel, const Math::Vector &pos)
|
|||
return true;
|
||||
}
|
||||
|
||||
|
||||
bool ALSound::Frequency(int channel, float frequency)
|
||||
bool CALSound::Frequency(int channel, float frequency)
|
||||
{
|
||||
if (!CheckChannel(channel))
|
||||
{
|
||||
|
@ -438,7 +422,7 @@ bool ALSound::Frequency(int channel, float frequency)
|
|||
return true;
|
||||
}
|
||||
|
||||
bool ALSound::Stop(int channel)
|
||||
bool CALSound::Stop(int channel)
|
||||
{
|
||||
if (!CheckChannel(channel))
|
||||
{
|
||||
|
@ -451,8 +435,7 @@ bool ALSound::Stop(int channel)
|
|||
return true;
|
||||
}
|
||||
|
||||
|
||||
bool ALSound::StopAll()
|
||||
bool CALSound::StopAll()
|
||||
{
|
||||
if (!m_enabled)
|
||||
{
|
||||
|
@ -468,8 +451,7 @@ bool ALSound::StopAll()
|
|||
return true;
|
||||
}
|
||||
|
||||
|
||||
bool ALSound::MuteAll(bool mute)
|
||||
bool CALSound::MuteAll(bool mute)
|
||||
{
|
||||
if (!m_enabled)
|
||||
{
|
||||
|
@ -487,8 +469,7 @@ bool ALSound::MuteAll(bool mute)
|
|||
return true;
|
||||
}
|
||||
|
||||
|
||||
void ALSound::FrameMove(float delta)
|
||||
void CALSound::FrameMove(float rTime)
|
||||
{
|
||||
if (!m_enabled)
|
||||
{
|
||||
|
@ -513,7 +494,7 @@ void ALSound::FrameMove(float delta)
|
|||
continue;
|
||||
|
||||
SoundOper &oper = it.second->GetEnvelope();
|
||||
oper.currentTime += delta;
|
||||
oper.currentTime += rTime;
|
||||
progress = oper.currentTime / oper.totalTime;
|
||||
progress = std::min(progress, 1.0f);
|
||||
|
||||
|
@ -560,7 +541,7 @@ void ALSound::FrameMove(float delta)
|
|||
}
|
||||
else
|
||||
{
|
||||
it->currentTime += delta;
|
||||
it->currentTime += rTime;
|
||||
it->music->SetVolume(((it->fadeTime-it->currentTime) / it->fadeTime) * m_musicVolume);
|
||||
++it;
|
||||
}
|
||||
|
@ -574,14 +555,13 @@ void ALSound::FrameMove(float delta)
|
|||
}
|
||||
else
|
||||
{
|
||||
m_previousMusic.currentTime += delta;
|
||||
m_previousMusic.currentTime += rTime;
|
||||
m_previousMusic.music->SetVolume(((m_previousMusic.fadeTime-m_previousMusic.currentTime) / m_previousMusic.fadeTime) * m_musicVolume);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
void ALSound::SetListener(const Math::Vector &eye, const Math::Vector &lookat)
|
||||
void CALSound::SetListener(const Math::Vector &eye, const Math::Vector &lookat)
|
||||
{
|
||||
m_eye = eye;
|
||||
m_lookat = lookat;
|
||||
|
@ -593,15 +573,14 @@ void ALSound::SetListener(const Math::Vector &eye, const Math::Vector &lookat)
|
|||
alListenerfv(AL_ORIENTATION, orientation);
|
||||
}
|
||||
|
||||
|
||||
bool ALSound::PlayMusic(const std::string &filename, bool repeat, float fadeTime)
|
||||
bool CALSound::PlayMusic(const std::string &filename, bool repeat, float fadeTime)
|
||||
{
|
||||
if (!m_enabled)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
Buffer *buffer = nullptr;
|
||||
CBuffer *buffer = nullptr;
|
||||
|
||||
// check if we have music in cache
|
||||
if (m_music.find(filename) == m_music.end())
|
||||
|
@ -613,7 +592,7 @@ bool ALSound::PlayMusic(const std::string &filename, bool repeat, float fadeTime
|
|||
return false;
|
||||
} */
|
||||
|
||||
auto newBuffer = MakeUnique<Buffer>();
|
||||
auto newBuffer = MakeUnique<CBuffer>();
|
||||
buffer = newBuffer.get();
|
||||
if (!newBuffer->LoadFromFile(filename, static_cast<SoundType>(-1)))
|
||||
{
|
||||
|
@ -636,7 +615,7 @@ bool ALSound::PlayMusic(const std::string &filename, bool repeat, float fadeTime
|
|||
m_oldMusic.push_back(std::move(old));
|
||||
}
|
||||
|
||||
m_currentMusic = MakeUnique<Channel>();
|
||||
m_currentMusic = MakeUnique<CChannel>();
|
||||
m_currentMusic->SetBuffer(buffer);
|
||||
m_currentMusic->SetVolume(m_musicVolume);
|
||||
m_currentMusic->SetLoop(repeat);
|
||||
|
@ -645,8 +624,7 @@ bool ALSound::PlayMusic(const std::string &filename, bool repeat, float fadeTime
|
|||
return true;
|
||||
}
|
||||
|
||||
|
||||
bool ALSound::PlayPauseMusic(const std::string &filename, bool repeat)
|
||||
bool CALSound::PlayPauseMusic(const std::string &filename, bool repeat)
|
||||
{
|
||||
if (m_previousMusic.fadeTime > 0.0f)
|
||||
{
|
||||
|
@ -671,8 +649,7 @@ bool ALSound::PlayPauseMusic(const std::string &filename, bool repeat)
|
|||
return PlayMusic(filename, repeat);
|
||||
}
|
||||
|
||||
|
||||
void ALSound::StopPauseMusic()
|
||||
void CALSound::StopPauseMusic()
|
||||
{
|
||||
if (m_previousMusic.fadeTime > 0.0f)
|
||||
{
|
||||
|
@ -691,8 +668,7 @@ void ALSound::StopPauseMusic()
|
|||
}
|
||||
}
|
||||
|
||||
|
||||
bool ALSound::RestartMusic()
|
||||
bool CALSound::RestartMusic()
|
||||
{
|
||||
if (!m_enabled || m_currentMusic == nullptr)
|
||||
{
|
||||
|
@ -704,8 +680,7 @@ bool ALSound::RestartMusic()
|
|||
return true;
|
||||
}
|
||||
|
||||
|
||||
void ALSound::StopMusic(float fadeTime)
|
||||
void CALSound::StopMusic(float fadeTime)
|
||||
{
|
||||
if (!m_enabled || m_currentMusic == nullptr)
|
||||
{
|
||||
|
@ -719,8 +694,7 @@ void ALSound::StopMusic(float fadeTime)
|
|||
m_oldMusic.push_back(std::move(old));
|
||||
}
|
||||
|
||||
|
||||
bool ALSound::IsPlayingMusic()
|
||||
bool CALSound::IsPlayingMusic()
|
||||
{
|
||||
if (!m_enabled || m_currentMusic == nullptr)
|
||||
{
|
||||
|
@ -730,8 +704,7 @@ bool ALSound::IsPlayingMusic()
|
|||
return m_currentMusic->IsPlaying();
|
||||
}
|
||||
|
||||
|
||||
void ALSound::SuspendMusic()
|
||||
void CALSound::SuspendMusic()
|
||||
{
|
||||
if (!m_enabled || m_currentMusic == nullptr)
|
||||
{
|
||||
|
@ -741,8 +714,7 @@ void ALSound::SuspendMusic()
|
|||
m_currentMusic->Stop();
|
||||
}
|
||||
|
||||
|
||||
bool ALSound::CheckChannel(int &channel)
|
||||
bool CALSound::CheckChannel(int &channel)
|
||||
{
|
||||
int id = (channel >> 16) & 0xffff;
|
||||
channel &= 0xffff;
|
||||
|
|
|
@ -60,7 +60,7 @@ struct OldMusic
|
|||
return *this;
|
||||
}
|
||||
|
||||
std::unique_ptr<Channel> music;
|
||||
std::unique_ptr<CChannel> music;
|
||||
float fadeTime = 0.0f;
|
||||
float currentTime = 0.0f;
|
||||
|
||||
|
@ -75,11 +75,11 @@ struct OldMusic
|
|||
}
|
||||
};
|
||||
|
||||
class ALSound : public CSoundInterface
|
||||
class CALSound : public CSoundInterface
|
||||
{
|
||||
public:
|
||||
ALSound();
|
||||
~ALSound();
|
||||
CALSound();
|
||||
~CALSound();
|
||||
|
||||
bool Create() override;
|
||||
bool Cache(SoundType, const std::string &) override;
|
||||
|
@ -126,10 +126,10 @@ private:
|
|||
unsigned int m_channelsLimit;
|
||||
ALCdevice* m_device;
|
||||
ALCcontext* m_context;
|
||||
std::map<SoundType, std::unique_ptr<Buffer>> m_sounds;
|
||||
std::map<std::string, std::unique_ptr<Buffer>> m_music;
|
||||
std::map<int, std::unique_ptr<Channel>> m_channels;
|
||||
std::unique_ptr<Channel> m_currentMusic;
|
||||
std::map<SoundType, std::unique_ptr<CBuffer>> m_sounds;
|
||||
std::map<std::string, std::unique_ptr<CBuffer>> m_music;
|
||||
std::map<int, std::unique_ptr<CChannel>> m_channels;
|
||||
std::unique_ptr<CChannel> m_currentMusic;
|
||||
std::list<OldMusic> m_oldMusic;
|
||||
OldMusic m_previousMusic;
|
||||
Math::Vector m_eye;
|
||||
|
|
|
@ -28,15 +28,14 @@
|
|||
#include <memory>
|
||||
|
||||
|
||||
Buffer::Buffer()
|
||||
CBuffer::CBuffer()
|
||||
: m_buffer(),
|
||||
m_sound(),
|
||||
m_loaded(false),
|
||||
m_duration(0.0f)
|
||||
{}
|
||||
|
||||
|
||||
Buffer::~Buffer()
|
||||
CBuffer::~CBuffer()
|
||||
{
|
||||
if (m_loaded)
|
||||
{
|
||||
|
@ -46,8 +45,7 @@ Buffer::~Buffer()
|
|||
}
|
||||
}
|
||||
|
||||
|
||||
bool Buffer::LoadFromFile(std::string filename, SoundType sound)
|
||||
bool CBuffer::LoadFromFile(std::string filename, SoundType sound)
|
||||
{
|
||||
m_sound = sound;
|
||||
GetLogger()->Debug("Loading audio file: %s\n", filename.c_str());
|
||||
|
@ -92,27 +90,22 @@ bool Buffer::LoadFromFile(std::string filename, SoundType sound)
|
|||
return true;
|
||||
}
|
||||
|
||||
|
||||
SoundType Buffer::GetSoundType()
|
||||
SoundType CBuffer::GetSoundType()
|
||||
{
|
||||
return m_sound;
|
||||
}
|
||||
|
||||
|
||||
ALuint Buffer::GetBuffer()
|
||||
ALuint CBuffer::GetBuffer()
|
||||
{
|
||||
return m_buffer;
|
||||
}
|
||||
|
||||
|
||||
bool Buffer::IsLoaded()
|
||||
bool CBuffer::IsLoaded()
|
||||
{
|
||||
return m_loaded;
|
||||
}
|
||||
|
||||
|
||||
float Buffer::GetDuration()
|
||||
float CBuffer::GetDuration()
|
||||
{
|
||||
return m_duration;
|
||||
}
|
||||
|
||||
|
|
|
@ -32,11 +32,11 @@
|
|||
|
||||
#include <al.h>
|
||||
|
||||
class Buffer
|
||||
class CBuffer
|
||||
{
|
||||
public:
|
||||
Buffer();
|
||||
~Buffer();
|
||||
CBuffer();
|
||||
~CBuffer();
|
||||
|
||||
bool LoadFromFile(std::string, SoundType);
|
||||
bool IsLoaded();
|
||||
|
|
|
@ -22,7 +22,7 @@
|
|||
|
||||
#include "sound/oalsound/buffer.h"
|
||||
|
||||
Channel::Channel()
|
||||
CChannel::CChannel()
|
||||
: m_buffer(nullptr),
|
||||
m_source(0),
|
||||
m_priority(0),
|
||||
|
@ -49,8 +49,7 @@ Channel::Channel()
|
|||
}
|
||||
}
|
||||
|
||||
|
||||
Channel::~Channel()
|
||||
CChannel::~CChannel()
|
||||
{
|
||||
if (m_ready)
|
||||
{
|
||||
|
@ -62,8 +61,7 @@ Channel::~Channel()
|
|||
}
|
||||
}
|
||||
|
||||
|
||||
bool Channel::Play()
|
||||
bool CChannel::Play()
|
||||
{
|
||||
if (!m_ready || m_buffer == nullptr)
|
||||
{
|
||||
|
@ -81,7 +79,7 @@ bool Channel::Play()
|
|||
return true;
|
||||
}
|
||||
|
||||
bool Channel::Pause()
|
||||
bool CChannel::Pause()
|
||||
{
|
||||
if (!m_ready || !IsPlaying())
|
||||
{
|
||||
|
@ -96,8 +94,7 @@ bool Channel::Pause()
|
|||
return true;
|
||||
}
|
||||
|
||||
|
||||
bool Channel::SetPosition(const Math::Vector &pos)
|
||||
bool CChannel::SetPosition(const Math::Vector &pos)
|
||||
{
|
||||
if (!m_ready || m_buffer == nullptr)
|
||||
{
|
||||
|
@ -113,8 +110,7 @@ bool Channel::SetPosition(const Math::Vector &pos)
|
|||
return true;
|
||||
}
|
||||
|
||||
|
||||
bool Channel::SetFrequency(float freq)
|
||||
bool CChannel::SetFrequency(float freq)
|
||||
{
|
||||
if (!m_ready || m_buffer == nullptr)
|
||||
{
|
||||
|
@ -130,8 +126,7 @@ bool Channel::SetFrequency(float freq)
|
|||
return true;
|
||||
}
|
||||
|
||||
|
||||
float Channel::GetFrequency()
|
||||
float CChannel::GetFrequency()
|
||||
{
|
||||
ALfloat freq;
|
||||
if (!m_ready || m_buffer == nullptr)
|
||||
|
@ -149,8 +144,7 @@ float Channel::GetFrequency()
|
|||
return freq;
|
||||
}
|
||||
|
||||
|
||||
bool Channel::SetVolume(float vol)
|
||||
bool CChannel::SetVolume(float vol)
|
||||
{
|
||||
if (!m_ready || vol < 0 || m_buffer == nullptr)
|
||||
{
|
||||
|
@ -166,8 +160,7 @@ bool Channel::SetVolume(float vol)
|
|||
return true;
|
||||
}
|
||||
|
||||
|
||||
float Channel::GetVolume()
|
||||
float CChannel::GetVolume()
|
||||
{
|
||||
ALfloat vol;
|
||||
if (!m_ready || m_buffer == nullptr)
|
||||
|
@ -185,87 +178,72 @@ float Channel::GetVolume()
|
|||
return vol;
|
||||
}
|
||||
|
||||
|
||||
void Channel::SetVolumeAtrib(float volume)
|
||||
void CChannel::SetVolumeAtrib(float volume)
|
||||
{
|
||||
m_volume = volume;
|
||||
}
|
||||
|
||||
|
||||
float Channel::GetVolumeAtrib()
|
||||
float CChannel::GetVolumeAtrib()
|
||||
{
|
||||
return m_volume;
|
||||
}
|
||||
|
||||
|
||||
|
||||
int Channel::GetPriority()
|
||||
int CChannel::GetPriority()
|
||||
{
|
||||
return m_priority;
|
||||
}
|
||||
|
||||
|
||||
void Channel::SetPriority(int pri)
|
||||
void CChannel::SetPriority(int pri)
|
||||
{
|
||||
m_priority = pri;
|
||||
}
|
||||
|
||||
|
||||
void Channel::SetStartAmplitude(float gain)
|
||||
void CChannel::SetStartAmplitude(float gain)
|
||||
{
|
||||
m_startAmplitude = gain;
|
||||
}
|
||||
|
||||
|
||||
void Channel::SetStartFrequency(float freq)
|
||||
void CChannel::SetStartFrequency(float freq)
|
||||
{
|
||||
m_startFrequency = freq;
|
||||
}
|
||||
|
||||
|
||||
void Channel::SetChangeFrequency(float freq)
|
||||
void CChannel::SetChangeFrequency(float freq)
|
||||
{
|
||||
m_changeFrequency = freq;
|
||||
}
|
||||
|
||||
|
||||
float Channel::GetStartAmplitude()
|
||||
float CChannel::GetStartAmplitude()
|
||||
{
|
||||
return m_startAmplitude;
|
||||
}
|
||||
|
||||
|
||||
float Channel::GetStartFrequency()
|
||||
float CChannel::GetStartFrequency()
|
||||
{
|
||||
return m_startFrequency;
|
||||
}
|
||||
|
||||
|
||||
float Channel::GetChangeFrequency()
|
||||
float CChannel::GetChangeFrequency()
|
||||
{
|
||||
return m_changeFrequency;
|
||||
}
|
||||
|
||||
|
||||
float Channel::GetInitFrequency()
|
||||
float CChannel::GetInitFrequency()
|
||||
{
|
||||
return m_initFrequency;
|
||||
}
|
||||
|
||||
|
||||
void Channel::AddOper(SoundOper oper)
|
||||
void CChannel::AddOper(SoundOper oper)
|
||||
{
|
||||
m_oper.push_back(oper);
|
||||
}
|
||||
|
||||
|
||||
void Channel::ResetOper()
|
||||
void CChannel::ResetOper()
|
||||
{
|
||||
m_oper.clear();
|
||||
}
|
||||
|
||||
|
||||
SoundType Channel::GetSoundType()
|
||||
SoundType CChannel::GetSoundType()
|
||||
{
|
||||
if (!m_ready || m_buffer == nullptr)
|
||||
{
|
||||
|
@ -275,8 +253,7 @@ SoundType Channel::GetSoundType()
|
|||
return m_buffer->GetSoundType();
|
||||
}
|
||||
|
||||
|
||||
bool Channel::SetBuffer(Buffer *buffer)
|
||||
bool CChannel::SetBuffer(CBuffer *buffer)
|
||||
{
|
||||
if (!m_ready)
|
||||
return false;
|
||||
|
@ -299,7 +276,7 @@ bool Channel::SetBuffer(Buffer *buffer)
|
|||
return true;
|
||||
}
|
||||
|
||||
bool Channel::IsPlaying()
|
||||
bool CChannel::IsPlaying()
|
||||
{
|
||||
ALint status;
|
||||
if (!m_ready || m_buffer == nullptr)
|
||||
|
@ -317,19 +294,17 @@ bool Channel::IsPlaying()
|
|||
return status == AL_PLAYING;
|
||||
}
|
||||
|
||||
|
||||
bool Channel::IsReady()
|
||||
bool CChannel::IsReady()
|
||||
{
|
||||
return m_ready;
|
||||
}
|
||||
|
||||
bool Channel::IsLoaded()
|
||||
bool CChannel::IsLoaded()
|
||||
{
|
||||
return m_buffer != nullptr;
|
||||
}
|
||||
|
||||
|
||||
bool Channel::Stop()
|
||||
bool CChannel::Stop()
|
||||
{
|
||||
if (!m_ready || m_buffer == nullptr)
|
||||
{
|
||||
|
@ -345,8 +320,7 @@ bool Channel::Stop()
|
|||
return true;
|
||||
}
|
||||
|
||||
|
||||
float Channel::GetCurrentTime()
|
||||
float CChannel::GetCurrentTime()
|
||||
{
|
||||
if (!m_ready || m_buffer == nullptr)
|
||||
{
|
||||
|
@ -363,8 +337,7 @@ float Channel::GetCurrentTime()
|
|||
return current;
|
||||
}
|
||||
|
||||
|
||||
void Channel::SetCurrentTime(float current)
|
||||
void CChannel::SetCurrentTime(float current)
|
||||
{
|
||||
if (!m_ready || m_buffer == nullptr)
|
||||
{
|
||||
|
@ -378,8 +351,7 @@ void Channel::SetCurrentTime(float current)
|
|||
}
|
||||
}
|
||||
|
||||
|
||||
float Channel::GetDuration()
|
||||
float CChannel::GetDuration()
|
||||
{
|
||||
if (!m_ready || m_buffer == nullptr)
|
||||
{
|
||||
|
@ -389,50 +361,42 @@ float Channel::GetDuration()
|
|||
return m_buffer->GetDuration();
|
||||
}
|
||||
|
||||
|
||||
bool Channel::HasEnvelope()
|
||||
bool CChannel::HasEnvelope()
|
||||
{
|
||||
return m_oper.size() > 0;
|
||||
}
|
||||
|
||||
|
||||
SoundOper& Channel::GetEnvelope()
|
||||
SoundOper& CChannel::GetEnvelope()
|
||||
{
|
||||
return m_oper.front();
|
||||
}
|
||||
|
||||
|
||||
void Channel::PopEnvelope()
|
||||
void CChannel::PopEnvelope()
|
||||
{
|
||||
m_oper.pop_front();
|
||||
}
|
||||
|
||||
|
||||
void Channel::SetLoop(bool loop)
|
||||
void CChannel::SetLoop(bool loop)
|
||||
{
|
||||
m_loop = loop;
|
||||
}
|
||||
|
||||
|
||||
void Channel::Mute(bool mute)
|
||||
void CChannel::Mute(bool mute)
|
||||
{
|
||||
m_mute = mute;
|
||||
}
|
||||
|
||||
|
||||
bool Channel::IsMuted()
|
||||
bool CChannel::IsMuted()
|
||||
{
|
||||
return m_mute;
|
||||
}
|
||||
|
||||
|
||||
void Channel::Reset()
|
||||
void CChannel::Reset()
|
||||
{
|
||||
m_id++;
|
||||
}
|
||||
|
||||
|
||||
int Channel::GetId()
|
||||
int CChannel::GetId()
|
||||
{
|
||||
return m_id;
|
||||
}
|
||||
|
|
|
@ -37,7 +37,7 @@
|
|||
#include <al.h>
|
||||
#include <alc.h>
|
||||
|
||||
class Buffer;
|
||||
class CBuffer;
|
||||
|
||||
struct SoundOper
|
||||
{
|
||||
|
@ -49,11 +49,11 @@ struct SoundOper
|
|||
};
|
||||
|
||||
|
||||
class Channel
|
||||
class CChannel
|
||||
{
|
||||
public:
|
||||
Channel();
|
||||
~Channel();
|
||||
CChannel();
|
||||
~CChannel();
|
||||
|
||||
bool Play();
|
||||
bool Pause();
|
||||
|
@ -77,7 +77,7 @@ public:
|
|||
bool IsReady();
|
||||
bool IsLoaded();
|
||||
|
||||
bool SetBuffer(Buffer *buffer);
|
||||
bool SetBuffer(CBuffer *buffer);
|
||||
|
||||
bool HasEnvelope();
|
||||
SoundOper& GetEnvelope();
|
||||
|
@ -106,7 +106,7 @@ public:
|
|||
int GetId();
|
||||
|
||||
private:
|
||||
Buffer *m_buffer;
|
||||
CBuffer *m_buffer;
|
||||
ALuint m_source;
|
||||
|
||||
int m_priority;
|
||||
|
|
|
@ -153,7 +153,7 @@ bool CSoundInterface::StopAll()
|
|||
return true;
|
||||
}
|
||||
|
||||
bool CSoundInterface::MuteAll(bool bMute)
|
||||
bool CSoundInterface::MuteAll(bool mute)
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
|
|
@ -208,9 +208,9 @@ void CButton::Draw()
|
|||
// Management of immediate mode, which sends the event "press"
|
||||
// before the mouse button is released.
|
||||
|
||||
void CButton::SetImmediat(bool bImmediat)
|
||||
void CButton::SetImmediat(bool immediat)
|
||||
{
|
||||
m_bImmediat = bImmediat;
|
||||
m_bImmediat = immediat;
|
||||
}
|
||||
|
||||
bool CButton::GetImmediat()
|
||||
|
|
|
@ -38,7 +38,7 @@ public:
|
|||
|
||||
void Draw() override;
|
||||
|
||||
void SetImmediat(bool bRepeat);
|
||||
void SetImmediat(bool immediat);
|
||||
bool GetImmediat();
|
||||
|
||||
void SetRepeat(bool bRepeat);
|
||||
|
|
|
@ -699,12 +699,12 @@ bool CList::GetCheck(int i)
|
|||
|
||||
// Specifies the bit "enable" for a box.
|
||||
|
||||
void CList::SetEnable(int i, bool bMode)
|
||||
void CList::SetEnable(int i, bool enable)
|
||||
{
|
||||
if ( i < 0 || i >= m_totalLine )
|
||||
return;
|
||||
|
||||
m_items[i].enable = bMode;
|
||||
m_items[i].enable = enable;
|
||||
}
|
||||
|
||||
// Returns the bit "enable" for a box.
|
||||
|
|
|
@ -77,7 +77,7 @@ public:
|
|||
void SetCheck(int i, bool bMode);
|
||||
bool GetCheck(int i);
|
||||
|
||||
void SetEnable(int i, bool bEnable);
|
||||
void SetEnable(int i, bool enable);
|
||||
bool GetEnable(int i);
|
||||
|
||||
void SetTabs(int i, float pos, Gfx::TextAlign justif=Gfx::TEXT_ALIGN_LEFT);
|
||||
|
|
|
@ -34,7 +34,7 @@ public:
|
|||
CSlider();
|
||||
~CSlider();
|
||||
|
||||
bool Create(Math::Point pos, Math::Point dim, int icon, EventType eventMsg) override;
|
||||
bool Create(Math::Point pos, Math::Point dim, int icon, EventType eventType) override;
|
||||
|
||||
void SetPos(Math::Point pos) override;
|
||||
void SetDim(Math::Point dim) override;
|
||||
|
|
|
@ -37,7 +37,7 @@ public:
|
|||
CTarget();
|
||||
~CTarget();
|
||||
|
||||
bool Create(Math::Point pos, Math::Point dim, int icon, EventType eventMsg) override;
|
||||
bool Create(Math::Point pos, Math::Point dim, int icon, EventType eventType) override;
|
||||
|
||||
bool EventProcess(const Event &event) override;
|
||||
void Draw() override;
|
||||
|
|
|
@ -19,8 +19,8 @@
|
|||
|
||||
#pragma once
|
||||
|
||||
#include "common/event.h"
|
||||
#include "common/error.h"
|
||||
#include "common/event.h"
|
||||
|
||||
#include <array>
|
||||
|
||||
|
|
|
@ -29,14 +29,14 @@
|
|||
#include "common/make_unique.h"
|
||||
#include "common/settings.h"
|
||||
|
||||
#include "level/robotmain.h"
|
||||
#include "level/player_profile.h"
|
||||
#include "level/robotmain.h"
|
||||
|
||||
#include "sound/sound.h"
|
||||
|
||||
#include "ui/controls/button.h"
|
||||
#include "ui/controls/label.h"
|
||||
#include "ui/controls/interface.h"
|
||||
#include "ui/controls/label.h"
|
||||
#include "ui/controls/window.h"
|
||||
|
||||
#include "ui/screen/screen_setup.h"
|
||||
|
|
|
@ -35,6 +35,11 @@
|
|||
|
||||
#include "ui/maindialog.h"
|
||||
|
||||
#include "ui/controls/group.h"
|
||||
#include "ui/controls/interface.h"
|
||||
#include "ui/controls/label.h"
|
||||
#include "ui/controls/window.h"
|
||||
|
||||
#include "ui/screen/screen.h"
|
||||
#include "ui/screen/screen_apperance.h"
|
||||
#include "ui/screen/screen_io_read.h"
|
||||
|
@ -43,19 +48,14 @@
|
|||
#include "ui/screen/screen_loading.h"
|
||||
#include "ui/screen/screen_main_menu.h"
|
||||
#include "ui/screen/screen_player_select.h"
|
||||
#include "ui/screen/screen_quit.h"
|
||||
#include "ui/screen/screen_setup_controls.h"
|
||||
#include "ui/screen/screen_setup_display.h"
|
||||
#include "ui/screen/screen_setup_game.h"
|
||||
#include "ui/screen/screen_setup_graphics.h"
|
||||
#include "ui/screen/screen_setup_sound.h"
|
||||
#include "ui/screen/screen_quit.h"
|
||||
#include "ui/screen/screen_welcome.h"
|
||||
|
||||
#include "ui/controls/interface.h"
|
||||
#include "ui/controls/group.h"
|
||||
#include "ui/controls/label.h"
|
||||
#include "ui/controls/window.h"
|
||||
|
||||
namespace Ui
|
||||
{
|
||||
|
||||
|
|
|
@ -53,7 +53,7 @@ public:
|
|||
CObjectInterface(COldObject* object);
|
||||
~CObjectInterface();
|
||||
|
||||
void DeleteObject(bool bAll=false);
|
||||
void DeleteObject(bool all=false);
|
||||
|
||||
bool EventProcess(const Event &event);
|
||||
bool CreateInterface(bool bSelect);
|
||||
|
|
|
@ -19,10 +19,10 @@
|
|||
|
||||
#include "ui/screen/screen.h"
|
||||
|
||||
#include "common/version.h"
|
||||
|
||||
#include "app/app.h"
|
||||
|
||||
#include "common/version.h"
|
||||
|
||||
#include "graphics/engine/engine.h"
|
||||
|
||||
#include "level/robotmain.h"
|
||||
|
|
|
@ -31,15 +31,15 @@
|
|||
|
||||
#include "sound/sound.h"
|
||||
|
||||
#include "ui/screen/screen_level_list.h"
|
||||
|
||||
#include "ui/controls/button.h"
|
||||
#include "ui/controls/edit.h"
|
||||
#include "ui/controls/interface.h"
|
||||
#include "ui/controls/image.h"
|
||||
#include "ui/controls/interface.h"
|
||||
#include "ui/controls/list.h"
|
||||
#include "ui/controls/window.h"
|
||||
|
||||
#include "ui/screen/screen_level_list.h"
|
||||
|
||||
#include <ctime>
|
||||
#include <cstring>
|
||||
|
||||
|
|
|
@ -26,8 +26,8 @@
|
|||
#include "level/robotmain.h"
|
||||
|
||||
#include "ui/controls/button.h"
|
||||
#include "ui/controls/interface.h"
|
||||
#include "ui/controls/image.h"
|
||||
#include "ui/controls/interface.h"
|
||||
#include "ui/controls/list.h"
|
||||
#include "ui/controls/window.h"
|
||||
|
||||
|
|
|
@ -27,8 +27,8 @@
|
|||
|
||||
#include "ui/controls/button.h"
|
||||
#include "ui/controls/edit.h"
|
||||
#include "ui/controls/interface.h"
|
||||
#include "ui/controls/image.h"
|
||||
#include "ui/controls/interface.h"
|
||||
#include "ui/controls/label.h"
|
||||
#include "ui/controls/list.h"
|
||||
#include "ui/controls/window.h"
|
||||
|
|
|
@ -21,13 +21,12 @@
|
|||
|
||||
#include "app/app.h"
|
||||
|
||||
#include "level/robotmain.h"
|
||||
|
||||
#include "common/logger.h"
|
||||
#include "common/misc.h"
|
||||
#include "common/stringutils.h"
|
||||
|
||||
#include "level/player_profile.h"
|
||||
#include "level/robotmain.h"
|
||||
|
||||
#include "sound/sound.h"
|
||||
|
||||
|
@ -194,9 +193,13 @@ bool CScreenPlayerSelect::EventProcess(const Event &event)
|
|||
|
||||
GetResource(RES_TEXT, RT_DIALOG_DELGAME, name);
|
||||
gamer = pl->GetItemName(pl->GetSelect());
|
||||
m_dialog->StartQuestion(StrUtils::Format(name.c_str(), gamer), true, false, false, [&]() {
|
||||
NameDelete();
|
||||
});
|
||||
m_dialog->StartQuestion(
|
||||
StrUtils::Format(name.c_str(), gamer), true, false, false,
|
||||
[&]()
|
||||
{
|
||||
NameDelete();
|
||||
}
|
||||
);
|
||||
break;
|
||||
|
||||
default:
|
||||
|
|
|
@ -32,12 +32,12 @@
|
|||
|
||||
#include "common/resources/resourcemanager.h"
|
||||
|
||||
#include "level/robotmain.h"
|
||||
#include "level/player_profile.h"
|
||||
|
||||
#include "graphics/engine/camera.h"
|
||||
#include "graphics/engine/engine.h"
|
||||
|
||||
#include "level/player_profile.h"
|
||||
#include "level/robotmain.h"
|
||||
|
||||
#include "object/object.h"
|
||||
|
||||
#include "object/interface/program_storage_object.h"
|
||||
|
|
|
@ -61,16 +61,16 @@ public:
|
|||
}
|
||||
};
|
||||
|
||||
class ApplicationUT : public testing::Test
|
||||
class CApplicationUT : public testing::Test
|
||||
{
|
||||
protected:
|
||||
ApplicationUT() :
|
||||
CApplicationUT() :
|
||||
m_systemUtils(nullptr),
|
||||
m_stampUid(0),
|
||||
m_currentTime(0)
|
||||
{}
|
||||
|
||||
~ApplicationUT() NOEXCEPT
|
||||
~CApplicationUT() NOEXCEPT
|
||||
{}
|
||||
|
||||
void SetUp() override;
|
||||
|
@ -99,7 +99,7 @@ private:
|
|||
long long m_currentTime;
|
||||
};
|
||||
|
||||
void ApplicationUT::SetUp()
|
||||
void CApplicationUT::SetUp()
|
||||
{
|
||||
m_systemUtils = m_mocks.Mock<CSystemUtils>();
|
||||
|
||||
|
@ -107,21 +107,21 @@ void ApplicationUT::SetUp()
|
|||
m_mocks.OnCall(m_systemUtils, CSystemUtils::GetLangPath).Return("");
|
||||
m_mocks.OnCall(m_systemUtils, CSystemUtils::GetSaveDir).Return("");
|
||||
|
||||
m_mocks.OnCall(m_systemUtils, CSystemUtils::CreateTimeStamp).Do(std::bind(&ApplicationUT::CreateTimeStamp, this));
|
||||
m_mocks.OnCall(m_systemUtils, CSystemUtils::DestroyTimeStamp).Do(std::bind(&ApplicationUT::DestroyTimeStamp, this, ph::_1));
|
||||
m_mocks.OnCall(m_systemUtils, CSystemUtils::CopyTimeStamp).Do(std::bind(&ApplicationUT::CopyTimeStamp, this, ph::_1, ph::_2));
|
||||
m_mocks.OnCall(m_systemUtils, CSystemUtils::GetCurrentTimeStamp).Do(std::bind(&ApplicationUT::GetCurrentTimeStamp, this, ph::_1));
|
||||
m_mocks.OnCall(m_systemUtils, CSystemUtils::TimeStampExactDiff).Do(std::bind(&ApplicationUT::TimeStampExactDiff, this, ph::_1, ph::_2));
|
||||
m_mocks.OnCall(m_systemUtils, CSystemUtils::CreateTimeStamp).Do(std::bind(&CApplicationUT::CreateTimeStamp, this));
|
||||
m_mocks.OnCall(m_systemUtils, CSystemUtils::DestroyTimeStamp).Do(std::bind(&CApplicationUT::DestroyTimeStamp, this, ph::_1));
|
||||
m_mocks.OnCall(m_systemUtils, CSystemUtils::CopyTimeStamp).Do(std::bind(&CApplicationUT::CopyTimeStamp, this, ph::_1, ph::_2));
|
||||
m_mocks.OnCall(m_systemUtils, CSystemUtils::GetCurrentTimeStamp).Do(std::bind(&CApplicationUT::GetCurrentTimeStamp, this, ph::_1));
|
||||
m_mocks.OnCall(m_systemUtils, CSystemUtils::TimeStampExactDiff).Do(std::bind(&CApplicationUT::TimeStampExactDiff, this, ph::_1, ph::_2));
|
||||
|
||||
m_app = MakeUnique<CApplicationWrapper>(m_systemUtils);
|
||||
}
|
||||
|
||||
void ApplicationUT::TearDown()
|
||||
void CApplicationUT::TearDown()
|
||||
{
|
||||
m_app.reset();
|
||||
}
|
||||
|
||||
SystemTimeStamp* ApplicationUT::CreateTimeStamp()
|
||||
SystemTimeStamp* CApplicationUT::CreateTimeStamp()
|
||||
{
|
||||
auto stamp = MakeUnique<FakeSystemTimeStamp>(++m_stampUid);
|
||||
auto stampPtr = stamp.get();
|
||||
|
@ -129,33 +129,33 @@ SystemTimeStamp* ApplicationUT::CreateTimeStamp()
|
|||
return stampPtr;
|
||||
}
|
||||
|
||||
void ApplicationUT::DestroyTimeStamp(SystemTimeStamp *stamp)
|
||||
void CApplicationUT::DestroyTimeStamp(SystemTimeStamp *stamp)
|
||||
{
|
||||
}
|
||||
|
||||
void ApplicationUT::CopyTimeStamp(SystemTimeStamp *dst, SystemTimeStamp *src)
|
||||
void CApplicationUT::CopyTimeStamp(SystemTimeStamp *dst, SystemTimeStamp *src)
|
||||
{
|
||||
*static_cast<FakeSystemTimeStamp*>(dst) = *static_cast<FakeSystemTimeStamp*>(src);
|
||||
}
|
||||
|
||||
void ApplicationUT::GetCurrentTimeStamp(SystemTimeStamp *stamp)
|
||||
void CApplicationUT::GetCurrentTimeStamp(SystemTimeStamp *stamp)
|
||||
{
|
||||
static_cast<FakeSystemTimeStamp*>(stamp)->time = m_currentTime;
|
||||
}
|
||||
|
||||
long long ApplicationUT::TimeStampExactDiff(SystemTimeStamp *before, SystemTimeStamp *after)
|
||||
long long CApplicationUT::TimeStampExactDiff(SystemTimeStamp *before, SystemTimeStamp *after)
|
||||
{
|
||||
return static_cast<FakeSystemTimeStamp*>(after)->time - static_cast<FakeSystemTimeStamp*>(before)->time;
|
||||
}
|
||||
|
||||
void ApplicationUT::NextInstant(long long diff)
|
||||
void CApplicationUT::NextInstant(long long diff)
|
||||
{
|
||||
m_currentTime += diff;
|
||||
}
|
||||
|
||||
void ApplicationUT::TestCreateUpdateEvent(long long relTimeExact, long long absTimeExact,
|
||||
float relTime, float absTime,
|
||||
long long relTimeReal, long long absTimeReal)
|
||||
void CApplicationUT::TestCreateUpdateEvent(long long relTimeExact, long long absTimeExact,
|
||||
float relTime, float absTime,
|
||||
long long relTimeReal, long long absTimeReal)
|
||||
{
|
||||
Event event = m_app->CreateUpdateEvent();
|
||||
EXPECT_EQ(EVENT_FRAME, event.type);
|
||||
|
@ -169,14 +169,14 @@ void ApplicationUT::TestCreateUpdateEvent(long long relTimeExact, long long absT
|
|||
}
|
||||
|
||||
|
||||
TEST_F(ApplicationUT, UpdateEventTimeCalculation_SimulationSuspended)
|
||||
TEST_F(CApplicationUT, UpdateEventTimeCalculation_SimulationSuspended)
|
||||
{
|
||||
m_app->SuspendSimulation();
|
||||
Event event = m_app->CreateUpdateEvent();
|
||||
EXPECT_EQ(EVENT_NULL, event.type);
|
||||
}
|
||||
|
||||
TEST_F(ApplicationUT, UpdateEventTimeCalculation_NormalOperation)
|
||||
TEST_F(CApplicationUT, UpdateEventTimeCalculation_NormalOperation)
|
||||
{
|
||||
// 1st update
|
||||
|
||||
|
@ -205,7 +205,7 @@ TEST_F(ApplicationUT, UpdateEventTimeCalculation_NormalOperation)
|
|||
TestCreateUpdateEvent(relTimeExact, absTimeExact, relTime, absTime, relTimeReal, absTimeReal);
|
||||
}
|
||||
|
||||
TEST_F(ApplicationUT, UpdateEventTimeCalculation_NegativeTimeOperation)
|
||||
TEST_F(CApplicationUT, UpdateEventTimeCalculation_NegativeTimeOperation)
|
||||
{
|
||||
// 1st update
|
||||
|
||||
|
@ -228,7 +228,7 @@ TEST_F(ApplicationUT, UpdateEventTimeCalculation_NegativeTimeOperation)
|
|||
EXPECT_EQ(EVENT_NULL, event.type);
|
||||
}
|
||||
|
||||
TEST_F(ApplicationUT, UpdateEventTimeCalculation_ChangingSimulationSpeed)
|
||||
TEST_F(CApplicationUT, UpdateEventTimeCalculation_ChangingSimulationSpeed)
|
||||
{
|
||||
m_app->SetSimulationSpeed(2.0f);
|
||||
|
||||
|
@ -287,7 +287,7 @@ TEST_F(ApplicationUT, UpdateEventTimeCalculation_ChangingSimulationSpeed)
|
|||
TestCreateUpdateEvent(relTimeExact, absTimeExact, relTime, absTime, relTimeReal, absTimeReal);
|
||||
}
|
||||
|
||||
TEST_F(ApplicationUT, UpdateEventTimeCalculation_SuspendingAndResumingSimulation)
|
||||
TEST_F(CApplicationUT, UpdateEventTimeCalculation_SuspendingAndResumingSimulation)
|
||||
{
|
||||
// 1st update -- simulation enabled
|
||||
|
||||
|
|
|
@ -22,7 +22,7 @@
|
|||
|
||||
#include <gtest/gtest.h>
|
||||
|
||||
class SystemUtilsLinuxUT : public testing::Test
|
||||
class CSystemUtilsLinuxUT : public testing::Test
|
||||
{
|
||||
protected:
|
||||
static const long long SEC = 1000000000;
|
||||
|
@ -31,7 +31,7 @@ protected:
|
|||
};
|
||||
|
||||
|
||||
TEST_F(SystemUtilsLinuxUT, TimeStampDiff)
|
||||
TEST_F(CSystemUtilsLinuxUT, TimeStampDiff)
|
||||
{
|
||||
SystemTimeStamp before, after;
|
||||
|
||||
|
|
|
@ -31,7 +31,7 @@ public:
|
|||
}
|
||||
};
|
||||
|
||||
class SystemUtilsWindowsUT : public testing::Test
|
||||
class CSystemUtilsWindowsUT : public testing::Test
|
||||
{
|
||||
protected:
|
||||
static const long long SEC = 1000000000;
|
||||
|
@ -39,7 +39,7 @@ protected:
|
|||
CSystemUtilsWindowsWrapper m_systemUtils;
|
||||
};
|
||||
|
||||
TEST_F(SystemUtilsWindowsUT, TimeStampDiff)
|
||||
TEST_F(CSystemUtilsWindowsUT, TimeStampDiff)
|
||||
{
|
||||
m_systemUtils.SetFrequency(SEC);
|
||||
|
||||
|
|
|
@ -17,9 +17,10 @@
|
|||
* along with this program. If not, see http://gnu.org/licenses
|
||||
*/
|
||||
|
||||
#include "app/system.h"
|
||||
|
||||
#include "common/config_file.h"
|
||||
#include "common/logger.h"
|
||||
#include "app/system.h"
|
||||
|
||||
#include <iostream>
|
||||
#include <string>
|
||||
|
|
|
@ -17,12 +17,12 @@
|
|||
* along with this program. If not, see http://gnu.org/licenses
|
||||
*/
|
||||
|
||||
#include "graphics/engine/lightman.h"
|
||||
|
||||
#include "common/make_unique.h"
|
||||
|
||||
#include "graphics/core/device.h"
|
||||
|
||||
#include "graphics/engine/lightman.h"
|
||||
|
||||
#include <gtest/gtest.h>
|
||||
#include <hippomocks.h>
|
||||
|
||||
|
@ -33,15 +33,15 @@ using namespace Gfx;
|
|||
using namespace HippoMocks;
|
||||
namespace ph = std::placeholders;
|
||||
|
||||
class LightManagerUT : public testing::Test
|
||||
class CLightManagerUT : public testing::Test
|
||||
{
|
||||
protected:
|
||||
LightManagerUT() :
|
||||
CLightManagerUT() :
|
||||
m_engine(nullptr),
|
||||
m_device(nullptr),
|
||||
m_maxLightsCount(0)
|
||||
{}
|
||||
~LightManagerUT() NOEXCEPT
|
||||
~CLightManagerUT() NOEXCEPT
|
||||
{}
|
||||
|
||||
void SetUp() override;
|
||||
|
@ -64,7 +64,7 @@ private:
|
|||
int m_maxLightsCount;
|
||||
};
|
||||
|
||||
void LightManagerUT::SetUp()
|
||||
void CLightManagerUT::SetUp()
|
||||
{
|
||||
m_engine = m_mocks.Mock<CEngine>();
|
||||
m_device = m_mocks.Mock<CDevice>();
|
||||
|
@ -72,7 +72,7 @@ void LightManagerUT::SetUp()
|
|||
m_lightManager = MakeUnique<CLightManager>(m_engine);
|
||||
}
|
||||
|
||||
void LightManagerUT::PrepareLightTesting(int maxLights, Math::Vector eyePos)
|
||||
void CLightManagerUT::PrepareLightTesting(int maxLights, Math::Vector eyePos)
|
||||
{
|
||||
m_maxLightsCount = maxLights;
|
||||
|
||||
|
@ -80,12 +80,12 @@ void LightManagerUT::PrepareLightTesting(int maxLights, Math::Vector eyePos)
|
|||
|
||||
m_lightManager->SetDevice(m_device);
|
||||
|
||||
m_mocks.OnCall(m_device, CDevice::SetLight).Do(std::bind(&LightManagerUT::CheckLight, this, ph::_1, ph::_2));
|
||||
m_mocks.OnCall(m_device, CDevice::SetLight).Do(std::bind(&CLightManagerUT::CheckLight, this, ph::_1, ph::_2));
|
||||
|
||||
m_mocks.OnCall(m_engine, CEngine::GetEyePt).Return(eyePos);
|
||||
}
|
||||
|
||||
void LightManagerUT::CheckLightSorting(EngineObjectType objectType, const std::vector<int>& expectedLights)
|
||||
void CLightManagerUT::CheckLightSorting(EngineObjectType objectType, const std::vector<int>& expectedLights)
|
||||
{
|
||||
m_expectedLightTypes = expectedLights;
|
||||
|
||||
|
@ -105,14 +105,14 @@ void LightManagerUT::CheckLightSorting(EngineObjectType objectType, const std::v
|
|||
m_lightManager->UpdateDeviceLights(objectType);
|
||||
}
|
||||
|
||||
void LightManagerUT::CheckLight(int index, const Light& light)
|
||||
void CLightManagerUT::CheckLight(int index, const Light& light)
|
||||
{
|
||||
ASSERT_TRUE(index >= 0 && index < static_cast<int>( m_expectedLightTypes.size() ));
|
||||
ASSERT_EQ(m_expectedLightTypes[index], light.type);
|
||||
}
|
||||
|
||||
void LightManagerUT::AddLight(int type, LightPriority priority, bool used, bool enabled,
|
||||
Math::Vector pos, EngineObjectType includeType, EngineObjectType excludeType)
|
||||
void CLightManagerUT::AddLight(int type, LightPriority priority, bool used, bool enabled,
|
||||
Math::Vector pos, EngineObjectType includeType, EngineObjectType excludeType)
|
||||
{
|
||||
int rank = m_lightManager->CreateLight(priority);
|
||||
|
||||
|
@ -129,7 +129,7 @@ void LightManagerUT::AddLight(int type, LightPriority priority, bool used, bool
|
|||
m_lightManager->DeleteLight(rank);
|
||||
}
|
||||
|
||||
TEST_F(LightManagerUT, LightSorting_UnusedOrDisabledAreSkipped)
|
||||
TEST_F(CLightManagerUT, LightSorting_UnusedOrDisabledAreSkipped)
|
||||
{
|
||||
const int lightCount = 10;
|
||||
const Math::Vector eyePos(0.0f, 0.0f, 0.0f);
|
||||
|
@ -143,7 +143,7 @@ TEST_F(LightManagerUT, LightSorting_UnusedOrDisabledAreSkipped)
|
|||
CheckLightSorting(ENG_OBJTYPE_TERRAIN, expectedLights);
|
||||
}
|
||||
|
||||
TEST_F(LightManagerUT, LightSorting_IncludeTypesAreIncluded)
|
||||
TEST_F(CLightManagerUT, LightSorting_IncludeTypesAreIncluded)
|
||||
{
|
||||
const int lightCount = 10;
|
||||
const Math::Vector eyePos(0.0f, 0.0f, 0.0f);
|
||||
|
@ -157,7 +157,7 @@ TEST_F(LightManagerUT, LightSorting_IncludeTypesAreIncluded)
|
|||
CheckLightSorting(ENG_OBJTYPE_TERRAIN, expectedLights);
|
||||
}
|
||||
|
||||
TEST_F(LightManagerUT, LightSorting_ExcludeTypesAreExcluded)
|
||||
TEST_F(CLightManagerUT, LightSorting_ExcludeTypesAreExcluded)
|
||||
{
|
||||
const int lightCount = 10;
|
||||
const Math::Vector eyePos(0.0f, 0.0f, 0.0f);
|
||||
|
@ -171,7 +171,7 @@ TEST_F(LightManagerUT, LightSorting_ExcludeTypesAreExcluded)
|
|||
CheckLightSorting(ENG_OBJTYPE_TERRAIN, expectedLights);
|
||||
}
|
||||
|
||||
TEST_F(LightManagerUT, LightSorting_SortingAccordingToDistance)
|
||||
TEST_F(CLightManagerUT, LightSorting_SortingAccordingToDistance)
|
||||
{
|
||||
const int lightCount = 3;
|
||||
const Math::Vector eyePos(0.0f, 0.0f, 0.0f);
|
||||
|
|
Loading…
Reference in New Issue