Decouple <cstddef>
This commit is contained in:
+1
-7
@@ -107,20 +107,14 @@ check_function_exists(waitpid HAVE_WAITPID)
|
|||||||
|
|
||||||
# Mostly universal symbols.
|
# Mostly universal symbols.
|
||||||
check_cxx_symbol_exists(strtof cstdlib HAVE_STRTOF)
|
check_cxx_symbol_exists(strtof cstdlib HAVE_STRTOF)
|
||||||
check_symbol_exists(size_t stddef.h HAVE_SIZE_T_STDDEF)
|
|
||||||
check_symbol_exists(size_t stdlib.h HAVE_SIZE_T_STDLIB)
|
|
||||||
check_symbol_exists(size_t stdio.h HAVE_SIZE_T_STDIO)
|
|
||||||
check_symbol_exists(posix_fadvise fcntl.h HAVE_POSIX_FADVISE)
|
check_symbol_exists(posix_fadvise fcntl.h HAVE_POSIX_FADVISE)
|
||||||
|
|
||||||
# Checks to make it easier to work with 32-bit/64-bit builds if required.
|
# Checks to make it easier to work with 32-bit/64-bit builds if required.
|
||||||
include(CheckTypeSize)
|
include(CheckTypeSize)
|
||||||
check_type_size(intptr_t SIZEOF_INTPTR_T)
|
|
||||||
check_type_size(pid_t SIZEOF_PID_T)
|
check_type_size(pid_t SIZEOF_PID_T)
|
||||||
check_type_size(size_t SIZEOF_SIZE_T)
|
|
||||||
check_type_size(ssize_t SIZEOF_SSIZE_T)
|
|
||||||
|
|
||||||
if(WIN32)
|
if(WIN32)
|
||||||
if(SIZEOF_INTPTR_T EQUAL 8)
|
if(CMAKE_SIZEOF_VOID_P EQUAL 8)
|
||||||
set(SM_WIN32_ARCH "x64")
|
set(SM_WIN32_ARCH "x64")
|
||||||
else()
|
else()
|
||||||
set(SM_WIN32_ARCH "x86")
|
set(SM_WIN32_ARCH "x86")
|
||||||
|
|||||||
Vendored
-6
@@ -17,16 +17,10 @@
|
|||||||
#endif
|
#endif
|
||||||
|
|
||||||
/* Defined to 1 if we have an unsigned char type. */
|
/* Defined to 1 if we have an unsigned char type. */
|
||||||
#cmakedefine HAVE_SIZEOF_UNSIGNED_CHAR 1
|
|
||||||
#if defined(HAVE_SIZEOF_UNSIGNED_CHAR)
|
|
||||||
#define HAVE_UNSIGNED_CHAR 1
|
#define HAVE_UNSIGNED_CHAR 1
|
||||||
#endif
|
|
||||||
|
|
||||||
/* Defined to 1 if we have an unsigned short type. */
|
/* Defined to 1 if we have an unsigned short type. */
|
||||||
#cmakedefine HAVE_SIZEOF_UNSIGNED_SHORT 1
|
|
||||||
#if defined(HAVE_SIZEOF_UNSIGNED_SHORT)
|
|
||||||
#define HAVE_UNSIGNED_SHORT 1
|
#define HAVE_UNSIGNED_SHORT 1
|
||||||
#endif
|
|
||||||
|
|
||||||
/* At some point, allow for defining CHAR_IS_UNSIGNED. */
|
/* At some point, allow for defining CHAR_IS_UNSIGNED. */
|
||||||
|
|
||||||
|
|||||||
+13
-12
@@ -15,6 +15,7 @@
|
|||||||
#include "Preference.h"
|
#include "Preference.h"
|
||||||
|
|
||||||
#include <cmath>
|
#include <cmath>
|
||||||
|
#include <cstddef>
|
||||||
#include <typeinfo>
|
#include <typeinfo>
|
||||||
|
|
||||||
static Preference<bool> g_bShowMasks("ShowMasks", false);
|
static Preference<bool> g_bShowMasks("ShowMasks", false);
|
||||||
@@ -173,7 +174,7 @@ Actor::~Actor()
|
|||||||
{
|
{
|
||||||
StopTweening();
|
StopTweening();
|
||||||
UnsubscribeAll();
|
UnsubscribeAll();
|
||||||
for(size_t i= 0; i < m_WrapperStates.size(); ++i)
|
for(std::size_t i= 0; i < m_WrapperStates.size(); ++i)
|
||||||
{
|
{
|
||||||
SAFE_DELETE(m_WrapperStates[i]);
|
SAFE_DELETE(m_WrapperStates[i]);
|
||||||
}
|
}
|
||||||
@@ -194,7 +195,7 @@ Actor::Actor( const Actor &cpy ):
|
|||||||
CPY( m_pLuaInstance );
|
CPY( m_pLuaInstance );
|
||||||
|
|
||||||
m_WrapperStates.resize(cpy.m_WrapperStates.size());
|
m_WrapperStates.resize(cpy.m_WrapperStates.size());
|
||||||
for(size_t i= 0; i < m_WrapperStates.size(); ++i)
|
for(std::size_t i= 0; i < m_WrapperStates.size(); ++i)
|
||||||
{
|
{
|
||||||
m_WrapperStates[i]= new ActorFrame(*dynamic_cast<ActorFrame*>(cpy.m_WrapperStates[i]));
|
m_WrapperStates[i]= new ActorFrame(*dynamic_cast<ActorFrame*>(cpy.m_WrapperStates[i]));
|
||||||
}
|
}
|
||||||
@@ -402,7 +403,7 @@ void Actor::Draw()
|
|||||||
{
|
{
|
||||||
m_FakeParent->BeginDraw();
|
m_FakeParent->BeginDraw();
|
||||||
}
|
}
|
||||||
size_t wrapper_states_used= 0;
|
std::size_t wrapper_states_used= 0;
|
||||||
RageColor last_diffuse;
|
RageColor last_diffuse;
|
||||||
RageColor last_glow;
|
RageColor last_glow;
|
||||||
bool use_last_diffuse= false;
|
bool use_last_diffuse= false;
|
||||||
@@ -418,7 +419,7 @@ void Actor::Draw()
|
|||||||
// wrapper[3] is the outermost frame. wrapper[2] is inside wrapper[3].
|
// wrapper[3] is the outermost frame. wrapper[2] is inside wrapper[3].
|
||||||
// wrapper[1] is inside wrapper[2]. The actor is inside wrapper[1].
|
// wrapper[1] is inside wrapper[2]. The actor is inside wrapper[1].
|
||||||
// -Kyz
|
// -Kyz
|
||||||
for(size_t i= m_WrapperStates.size(); i > 0 && dont_abort_draw; --i)
|
for(std::size_t i= m_WrapperStates.size(); i > 0 && dont_abort_draw; --i)
|
||||||
{
|
{
|
||||||
Actor* state= m_WrapperStates[i-1];
|
Actor* state= m_WrapperStates[i-1];
|
||||||
if(!state->m_bVisible || state->m_fHibernateSecondsLeft > 0 ||
|
if(!state->m_bVisible || state->m_fHibernateSecondsLeft > 0 ||
|
||||||
@@ -467,7 +468,7 @@ void Actor::Draw()
|
|||||||
}
|
}
|
||||||
this->PostDraw();
|
this->PostDraw();
|
||||||
}
|
}
|
||||||
for(size_t i= 0; i < wrapper_states_used; ++i)
|
for(std::size_t i= 0; i < wrapper_states_used; ++i)
|
||||||
{
|
{
|
||||||
Actor* state= m_WrapperStates[i];
|
Actor* state= m_WrapperStates[i];
|
||||||
if(abort_with_end_draw)
|
if(abort_with_end_draw)
|
||||||
@@ -886,7 +887,7 @@ void Actor::Update( float fDeltaTime )
|
|||||||
fDeltaTime = -m_fHibernateSecondsLeft;
|
fDeltaTime = -m_fHibernateSecondsLeft;
|
||||||
m_fHibernateSecondsLeft = 0;
|
m_fHibernateSecondsLeft = 0;
|
||||||
}
|
}
|
||||||
for(size_t i= 0; i < m_WrapperStates.size(); ++i)
|
for(std::size_t i= 0; i < m_WrapperStates.size(); ++i)
|
||||||
{
|
{
|
||||||
m_WrapperStates[i]->Update(fDeltaTime);
|
m_WrapperStates[i]->Update(fDeltaTime);
|
||||||
}
|
}
|
||||||
@@ -992,14 +993,14 @@ void Actor::AddWrapperState()
|
|||||||
m_WrapperStates.push_back(wrapper);
|
m_WrapperStates.push_back(wrapper);
|
||||||
}
|
}
|
||||||
|
|
||||||
void Actor::RemoveWrapperState(size_t i)
|
void Actor::RemoveWrapperState(std::size_t i)
|
||||||
{
|
{
|
||||||
ASSERT(i < m_WrapperStates.size());
|
ASSERT(i < m_WrapperStates.size());
|
||||||
SAFE_DELETE(m_WrapperStates[i]);
|
SAFE_DELETE(m_WrapperStates[i]);
|
||||||
m_WrapperStates.erase(m_WrapperStates.begin()+i);
|
m_WrapperStates.erase(m_WrapperStates.begin()+i);
|
||||||
}
|
}
|
||||||
|
|
||||||
Actor* Actor::GetWrapperState(size_t i)
|
Actor* Actor::GetWrapperState(std::size_t i)
|
||||||
{
|
{
|
||||||
ASSERT(i < m_WrapperStates.size());
|
ASSERT(i < m_WrapperStates.size());
|
||||||
return m_WrapperStates[i];
|
return m_WrapperStates[i];
|
||||||
@@ -1972,11 +1973,11 @@ public:
|
|||||||
p->GetWrapperState(p->GetNumWrapperStates()-1)->PushSelf(L);
|
p->GetWrapperState(p->GetNumWrapperStates()-1)->PushSelf(L);
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
static size_t get_state_index(T* p, lua_State* L, int stack_index)
|
static std::size_t get_state_index(T* p, lua_State* L, int stack_index)
|
||||||
{
|
{
|
||||||
// Lua is one indexed.
|
// Lua is one indexed.
|
||||||
int i= IArg(stack_index)-1;
|
int i= IArg(stack_index)-1;
|
||||||
const size_t si= static_cast<size_t>(i);
|
const std::size_t si= static_cast<std::size_t>(i);
|
||||||
if(i < 0 || si >= p->GetNumWrapperStates())
|
if(i < 0 || si >= p->GetNumWrapperStates())
|
||||||
{
|
{
|
||||||
luaL_error(L, "%d is not a valid wrapper state index.", i+1);
|
luaL_error(L, "%d is not a valid wrapper state index.", i+1);
|
||||||
@@ -1985,7 +1986,7 @@ public:
|
|||||||
}
|
}
|
||||||
static int RemoveWrapperState(T* p, lua_State* L)
|
static int RemoveWrapperState(T* p, lua_State* L)
|
||||||
{
|
{
|
||||||
size_t si= get_state_index(p, L, 1);
|
std::size_t si= get_state_index(p, L, 1);
|
||||||
p->RemoveWrapperState(si);
|
p->RemoveWrapperState(si);
|
||||||
COMMON_RETURN_SELF;
|
COMMON_RETURN_SELF;
|
||||||
}
|
}
|
||||||
@@ -1996,7 +1997,7 @@ public:
|
|||||||
}
|
}
|
||||||
static int GetWrapperState(T* p, lua_State* L)
|
static int GetWrapperState(T* p, lua_State* L)
|
||||||
{
|
{
|
||||||
size_t si= get_state_index(p, L, 1);
|
std::size_t si= get_state_index(p, L, 1);
|
||||||
p->GetWrapperState(si)->PushSelf(L);
|
p->GetWrapperState(si)->PushSelf(L);
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
|
|||||||
+5
-3
@@ -13,6 +13,8 @@ class LuaClass;
|
|||||||
#include "MessageManager.h"
|
#include "MessageManager.h"
|
||||||
#include "Tween.h"
|
#include "Tween.h"
|
||||||
|
|
||||||
|
#include <cstddef>
|
||||||
|
|
||||||
typedef AutoPtrCopyOnWrite<LuaReference> apActorCommands;
|
typedef AutoPtrCopyOnWrite<LuaReference> apActorCommands;
|
||||||
|
|
||||||
/** @brief The background layer. */
|
/** @brief The background layer. */
|
||||||
@@ -315,9 +317,9 @@ public:
|
|||||||
Actor* GetFakeParent() { return m_FakeParent; }
|
Actor* GetFakeParent() { return m_FakeParent; }
|
||||||
|
|
||||||
void AddWrapperState();
|
void AddWrapperState();
|
||||||
void RemoveWrapperState(size_t i);
|
void RemoveWrapperState(std::size_t i);
|
||||||
Actor* GetWrapperState(size_t i);
|
Actor* GetWrapperState(std::size_t i);
|
||||||
size_t GetNumWrapperStates() const { return m_WrapperStates.size(); }
|
std::size_t GetNumWrapperStates() const { return m_WrapperStates.size(); }
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @brief Retrieve the Actor's x position.
|
* @brief Retrieve the Actor's x position.
|
||||||
|
|||||||
@@ -1,6 +1,4 @@
|
|||||||
#include "global.h"
|
#include "global.h"
|
||||||
#include <cassert>
|
|
||||||
|
|
||||||
#include "ActorMultiTexture.h"
|
#include "ActorMultiTexture.h"
|
||||||
#include "RageTextureManager.h"
|
#include "RageTextureManager.h"
|
||||||
#include "XmlFile.h"
|
#include "XmlFile.h"
|
||||||
@@ -9,10 +7,12 @@
|
|||||||
#include "RageTexture.h"
|
#include "RageTexture.h"
|
||||||
#include "RageUtil.h"
|
#include "RageUtil.h"
|
||||||
#include "ActorUtil.h"
|
#include "ActorUtil.h"
|
||||||
|
|
||||||
#include "LuaBinding.h"
|
#include "LuaBinding.h"
|
||||||
#include "LuaManager.h"
|
#include "LuaManager.h"
|
||||||
|
|
||||||
|
#include <cassert>
|
||||||
|
#include <cstddef>
|
||||||
|
|
||||||
REGISTER_ACTOR_CLASS( ActorMultiTexture );
|
REGISTER_ACTOR_CLASS( ActorMultiTexture );
|
||||||
|
|
||||||
|
|
||||||
@@ -98,7 +98,7 @@ void ActorMultiTexture::DrawPrimitives()
|
|||||||
quadVerticies.bottom = +m_size.y/2.0f;
|
quadVerticies.bottom = +m_size.y/2.0f;
|
||||||
|
|
||||||
DISPLAY->ClearAllTextures();
|
DISPLAY->ClearAllTextures();
|
||||||
for( size_t i = 0; i < m_aTextureUnits.size(); ++i )
|
for( std::size_t i = 0; i < m_aTextureUnits.size(); ++i )
|
||||||
{
|
{
|
||||||
TextureUnit tu = enum_add2(TextureUnit_1, i);
|
TextureUnit tu = enum_add2(TextureUnit_1, i);
|
||||||
DISPLAY->SetTexture( tu, m_aTextureUnits[i].m_pTexture->GetTexHandle() );
|
DISPLAY->SetTexture( tu, m_aTextureUnits[i].m_pTexture->GetTexHandle() );
|
||||||
@@ -127,7 +127,7 @@ void ActorMultiTexture::DrawPrimitives()
|
|||||||
|
|
||||||
DISPLAY->DrawQuad( v );
|
DISPLAY->DrawQuad( v );
|
||||||
|
|
||||||
for( size_t i = 0; i < m_aTextureUnits.size(); ++i )
|
for( std::size_t i = 0; i < m_aTextureUnits.size(); ++i )
|
||||||
DISPLAY->SetTexture( enum_add2(TextureUnit_1, i), 0 );
|
DISPLAY->SetTexture( enum_add2(TextureUnit_1, i), 0 );
|
||||||
|
|
||||||
DISPLAY->SetEffectMode( EffectMode_Normal );
|
DISPLAY->SetEffectMode( EffectMode_Normal );
|
||||||
|
|||||||
+44
-44
@@ -1,6 +1,4 @@
|
|||||||
#include "global.h"
|
#include "global.h"
|
||||||
#include <cassert>
|
|
||||||
|
|
||||||
#include "ActorMultiVertex.h"
|
#include "ActorMultiVertex.h"
|
||||||
#include "RageTextureManager.h"
|
#include "RageTextureManager.h"
|
||||||
#include "XmlFile.h"
|
#include "XmlFile.h"
|
||||||
@@ -14,6 +12,8 @@
|
|||||||
#include "LuaManager.h"
|
#include "LuaManager.h"
|
||||||
#include "LocalizedString.h"
|
#include "LocalizedString.h"
|
||||||
|
|
||||||
|
#include <cassert>
|
||||||
|
#include <cstddef>
|
||||||
#include <numeric>
|
#include <numeric>
|
||||||
|
|
||||||
const float min_state_delay= 0.0001f;
|
const float min_state_delay= 0.0001f;
|
||||||
@@ -67,7 +67,7 @@ ActorMultiVertex::ActorMultiVertex()
|
|||||||
_EffectMode = EffectMode_Normal;
|
_EffectMode = EffectMode_Normal;
|
||||||
_TextureMode = TextureMode_Modulate;
|
_TextureMode = TextureMode_Modulate;
|
||||||
_splines.resize(num_vert_splines);
|
_splines.resize(num_vert_splines);
|
||||||
for(size_t i= 0; i < num_vert_splines; ++i)
|
for(std::size_t i= 0; i < num_vert_splines; ++i)
|
||||||
{
|
{
|
||||||
_splines[i].redimension(3);
|
_splines[i].redimension(3);
|
||||||
_splines[i].m_owned_by_actor= true;
|
_splines[i].m_owned_by_actor= true;
|
||||||
@@ -156,11 +156,11 @@ void ActorMultiVertex::UnloadTexture()
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void ActorMultiVertex::SetNumVertices( size_t n )
|
void ActorMultiVertex::SetNumVertices( std::size_t n )
|
||||||
{
|
{
|
||||||
if( n == 0 )
|
if( n == 0 )
|
||||||
{
|
{
|
||||||
for( size_t i = 0; i < AMV_Tweens.size(); ++i )
|
for( std::size_t i = 0; i < AMV_Tweens.size(); ++i )
|
||||||
{
|
{
|
||||||
AMV_Tweens[i].vertices.clear();
|
AMV_Tweens[i].vertices.clear();
|
||||||
}
|
}
|
||||||
@@ -169,7 +169,7 @@ void ActorMultiVertex::SetNumVertices( size_t n )
|
|||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
for( size_t i = 0; i < AMV_Tweens.size(); ++i )
|
for( std::size_t i = 0; i < AMV_Tweens.size(); ++i )
|
||||||
{
|
{
|
||||||
AMV_Tweens[i].vertices.resize( n );
|
AMV_Tweens[i].vertices.resize( n );
|
||||||
}
|
}
|
||||||
@@ -180,7 +180,7 @@ void ActorMultiVertex::SetNumVertices( size_t n )
|
|||||||
|
|
||||||
void ActorMultiVertex::AddVertex()
|
void ActorMultiVertex::AddVertex()
|
||||||
{
|
{
|
||||||
for( size_t i = 0; i < AMV_Tweens.size(); ++i )
|
for( std::size_t i = 0; i < AMV_Tweens.size(); ++i )
|
||||||
{
|
{
|
||||||
AMV_Tweens[i].vertices.push_back( RageSpriteVertex() );
|
AMV_Tweens[i].vertices.push_back( RageSpriteVertex() );
|
||||||
}
|
}
|
||||||
@@ -192,7 +192,7 @@ void ActorMultiVertex::AddVertices( int Add )
|
|||||||
{
|
{
|
||||||
int size = AMV_DestTweenState().vertices.size();
|
int size = AMV_DestTweenState().vertices.size();
|
||||||
size += Add;
|
size += Add;
|
||||||
for( size_t i = 0; i < AMV_Tweens.size(); ++i )
|
for( std::size_t i = 0; i < AMV_Tweens.size(); ++i )
|
||||||
{
|
{
|
||||||
AMV_Tweens[i].vertices.resize( size );
|
AMV_Tweens[i].vertices.resize( size );
|
||||||
}
|
}
|
||||||
@@ -235,7 +235,7 @@ void ActorMultiVertex::DrawPrimitives()
|
|||||||
if( m_pTempState->diffuse[0] != RageColor(1, 1, 1, 1) && m_pTempState->diffuse[0].a > 0 )
|
if( m_pTempState->diffuse[0] != RageColor(1, 1, 1, 1) && m_pTempState->diffuse[0].a > 0 )
|
||||||
{
|
{
|
||||||
|
|
||||||
for( size_t i=0; i < TS.vertices.size(); i++ )
|
for( std::size_t i=0; i < TS.vertices.size(); i++ )
|
||||||
{
|
{
|
||||||
// RageVColor uses a uint8_t for each channel. 0-255.
|
// RageVColor uses a uint8_t for each channel. 0-255.
|
||||||
// RageColor uses a float. 0-1.
|
// RageColor uses a float. 0-1.
|
||||||
@@ -268,7 +268,7 @@ void ActorMultiVertex::DrawPrimitives()
|
|||||||
if( m_pTempState->glow.a > 0 )
|
if( m_pTempState->glow.a > 0 )
|
||||||
{
|
{
|
||||||
|
|
||||||
for( size_t i=0; i < TS.vertices.size(); i++ )
|
for( std::size_t i=0; i < TS.vertices.size(); i++ )
|
||||||
{
|
{
|
||||||
TS.vertices[i].c = m_pTempState->glow;
|
TS.vertices[i].c = m_pTempState->glow;
|
||||||
}
|
}
|
||||||
@@ -343,19 +343,19 @@ bool ActorMultiVertex::EarlyAbortDraw() const
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
void ActorMultiVertex::SetVertsFromSplinesInternal(size_t num_splines, size_t offset)
|
void ActorMultiVertex::SetVertsFromSplinesInternal(std::size_t num_splines, std::size_t offset)
|
||||||
{
|
{
|
||||||
std::vector<RageSpriteVertex>& verts= AMV_DestTweenState().vertices;
|
std::vector<RageSpriteVertex>& verts= AMV_DestTweenState().vertices;
|
||||||
size_t first= AMV_DestTweenState().FirstToDraw + offset;
|
std::size_t first= AMV_DestTweenState().FirstToDraw + offset;
|
||||||
size_t num_verts= AMV_DestTweenState().GetSafeNumToDraw(AMV_DestTweenState()._DrawMode, AMV_DestTweenState().NumToDraw) - offset;
|
std::size_t num_verts= AMV_DestTweenState().GetSafeNumToDraw(AMV_DestTweenState()._DrawMode, AMV_DestTweenState().NumToDraw) - offset;
|
||||||
std::vector<float> tper(num_splines, 0.0f);
|
std::vector<float> tper(num_splines, 0.0f);
|
||||||
float num_parts= (static_cast<float>(num_verts) /
|
float num_parts= (static_cast<float>(num_verts) /
|
||||||
static_cast<float>(num_splines)) - 1.0f;
|
static_cast<float>(num_splines)) - 1.0f;
|
||||||
for(size_t i= 0; i < num_splines; ++i)
|
for(std::size_t i= 0; i < num_splines; ++i)
|
||||||
{
|
{
|
||||||
tper[i]= _splines[i].get_max_t() / num_parts;
|
tper[i]= _splines[i].get_max_t() / num_parts;
|
||||||
}
|
}
|
||||||
for(size_t v= 0; v < num_verts; ++v)
|
for(std::size_t v= 0; v < num_verts; ++v)
|
||||||
{
|
{
|
||||||
std::vector<float> pos;
|
std::vector<float> pos;
|
||||||
const int spi= v%num_splines;
|
const int spi= v%num_splines;
|
||||||
@@ -395,7 +395,7 @@ void ActorMultiVertex::SetVertsFromSplines()
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
CubicSplineN* ActorMultiVertex::GetSpline(size_t i)
|
CubicSplineN* ActorMultiVertex::GetSpline(std::size_t i)
|
||||||
{
|
{
|
||||||
ASSERT(i < num_vert_splines);
|
ASSERT(i < num_vert_splines);
|
||||||
return &(_splines[i]);
|
return &(_splines[i]);
|
||||||
@@ -403,7 +403,7 @@ CubicSplineN* ActorMultiVertex::GetSpline(size_t i)
|
|||||||
|
|
||||||
void ActorMultiVertex::SetState(int i)
|
void ActorMultiVertex::SetState(int i)
|
||||||
{
|
{
|
||||||
ASSERT(i >= 0 && static_cast<size_t>(i) < _states.size());
|
ASSERT(i >= 0 && static_cast<std::size_t>(i) < _states.size());
|
||||||
_cur_state= i;
|
_cur_state= i;
|
||||||
_secs_into_state= 0.0f;
|
_secs_into_state= 0.0f;
|
||||||
}
|
}
|
||||||
@@ -439,7 +439,7 @@ void ActorMultiVertex::UpdateAnimationState(bool force_update)
|
|||||||
{
|
{
|
||||||
AMV_TweenState& dest= AMV_DestTweenState();
|
AMV_TweenState& dest= AMV_DestTweenState();
|
||||||
std::vector<RageSpriteVertex>& verts= dest.vertices;
|
std::vector<RageSpriteVertex>& verts= dest.vertices;
|
||||||
std::vector<size_t>& qs= dest.quad_states;
|
std::vector<std::size_t>& qs= dest.quad_states;
|
||||||
if(!_use_animation_state || _states.empty() ||
|
if(!_use_animation_state || _states.empty() ||
|
||||||
dest._DrawMode == DrawMode_LineStrip || qs.empty())
|
dest._DrawMode == DrawMode_LineStrip || qs.empty())
|
||||||
{ return; }
|
{ return; }
|
||||||
@@ -456,15 +456,15 @@ void ActorMultiVertex::UpdateAnimationState(bool force_update)
|
|||||||
}
|
}
|
||||||
if(state_changed)
|
if(state_changed)
|
||||||
{
|
{
|
||||||
size_t first= dest.FirstToDraw;
|
std::size_t first= dest.FirstToDraw;
|
||||||
size_t last= first+dest.GetSafeNumToDraw(dest._DrawMode, dest.NumToDraw);
|
std::size_t last= first+dest.GetSafeNumToDraw(dest._DrawMode, dest.NumToDraw);
|
||||||
#define STATE_ID const size_t state_id= (_cur_state + qs[quad_id % qs.size()]) % _states.size();
|
#define STATE_ID const std::size_t state_id= (_cur_state + qs[quad_id % qs.size()]) % _states.size();
|
||||||
switch(AMV_DestTweenState()._DrawMode)
|
switch(AMV_DestTweenState()._DrawMode)
|
||||||
{
|
{
|
||||||
case DrawMode_Quads:
|
case DrawMode_Quads:
|
||||||
for(size_t i= first; i < last; ++i)
|
for(std::size_t i= first; i < last; ++i)
|
||||||
{
|
{
|
||||||
const size_t quad_id= (i-first)/4;
|
const std::size_t quad_id= (i-first)/4;
|
||||||
STATE_ID;
|
STATE_ID;
|
||||||
switch((i-first)%4)
|
switch((i-first)%4)
|
||||||
{
|
{
|
||||||
@@ -488,9 +488,9 @@ void ActorMultiVertex::UpdateAnimationState(bool force_update)
|
|||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
case DrawMode_QuadStrip:
|
case DrawMode_QuadStrip:
|
||||||
for(size_t i= first; i < last; ++i)
|
for(std::size_t i= first; i < last; ++i)
|
||||||
{
|
{
|
||||||
const size_t quad_id= (i-first)/2;
|
const std::size_t quad_id= (i-first)/2;
|
||||||
STATE_ID;
|
STATE_ID;
|
||||||
switch((i-first)%2)
|
switch((i-first)%2)
|
||||||
{
|
{
|
||||||
@@ -507,18 +507,18 @@ void ActorMultiVertex::UpdateAnimationState(bool force_update)
|
|||||||
break;
|
break;
|
||||||
case DrawMode_Strip:
|
case DrawMode_Strip:
|
||||||
case DrawMode_Fan:
|
case DrawMode_Fan:
|
||||||
for(size_t i= first; i < last; ++i)
|
for(std::size_t i= first; i < last; ++i)
|
||||||
{
|
{
|
||||||
const size_t quad_id= (i-first);
|
const std::size_t quad_id= (i-first);
|
||||||
STATE_ID;
|
STATE_ID;
|
||||||
verts[i].t.x= _states[state_id].rect.left;
|
verts[i].t.x= _states[state_id].rect.left;
|
||||||
verts[i].t.y= _states[state_id].rect.top;
|
verts[i].t.y= _states[state_id].rect.top;
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
case DrawMode_Triangles:
|
case DrawMode_Triangles:
|
||||||
for(size_t i= first; i < last; ++i)
|
for(std::size_t i= first; i < last; ++i)
|
||||||
{
|
{
|
||||||
const size_t quad_id= (i-first)/3;
|
const std::size_t quad_id= (i-first)/3;
|
||||||
STATE_ID;
|
STATE_ID;
|
||||||
switch((i-first)%3)
|
switch((i-first)%3)
|
||||||
{
|
{
|
||||||
@@ -538,9 +538,9 @@ void ActorMultiVertex::UpdateAnimationState(bool force_update)
|
|||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
case DrawMode_SymmetricQuadStrip:
|
case DrawMode_SymmetricQuadStrip:
|
||||||
for(size_t i= first; i < last; ++i)
|
for(std::size_t i= first; i < last; ++i)
|
||||||
{
|
{
|
||||||
const size_t quad_id= (i-first)/3;
|
const std::size_t quad_id= (i-first)/3;
|
||||||
STATE_ID;
|
STATE_ID;
|
||||||
switch((i-first)%3)
|
switch((i-first)%3)
|
||||||
{
|
{
|
||||||
@@ -660,7 +660,7 @@ void ActorMultiVertex::AMV_TweenState::SetDrawState( DrawMode dm, int first, int
|
|||||||
void ActorMultiVertex::AMV_TweenState::MakeWeightedAverage(AMV_TweenState& average_out, const AMV_TweenState& ts1, const AMV_TweenState& ts2, float percent_between)
|
void ActorMultiVertex::AMV_TweenState::MakeWeightedAverage(AMV_TweenState& average_out, const AMV_TweenState& ts1, const AMV_TweenState& ts2, float percent_between)
|
||||||
{
|
{
|
||||||
average_out.line_width= lerp(percent_between, ts1.line_width, ts2.line_width);
|
average_out.line_width= lerp(percent_between, ts1.line_width, ts2.line_width);
|
||||||
for(size_t v= 0; v < average_out.vertices.size(); ++v)
|
for(std::size_t v= 0; v < average_out.vertices.size(); ++v)
|
||||||
{
|
{
|
||||||
WeightedAvergeOfRSVs(average_out.vertices[v], ts1.vertices[v], ts2.vertices[v], percent_between);
|
WeightedAvergeOfRSVs(average_out.vertices[v], ts1.vertices[v], ts2.vertices[v], percent_between);
|
||||||
}
|
}
|
||||||
@@ -696,7 +696,7 @@ public:
|
|||||||
}
|
}
|
||||||
static int GetNumVertices( T* p, lua_State *L ) { lua_pushnumber( L, p->GetNumVertices() ); return 1; }
|
static int GetNumVertices( T* p, lua_State *L ) { lua_pushnumber( L, p->GetNumVertices() ); return 1; }
|
||||||
|
|
||||||
static void SetVertexFromStack(T* p, lua_State* L, size_t VertexIndex, int DataStackIndex)
|
static void SetVertexFromStack(T* p, lua_State* L, std::size_t VertexIndex, int DataStackIndex)
|
||||||
{
|
{
|
||||||
// Use the number of arguments to determine which property a table is for
|
// Use the number of arguments to determine which property a table is for
|
||||||
if(lua_type(L, DataStackIndex) != LUA_TTABLE)
|
if(lua_type(L, DataStackIndex) != LUA_TTABLE)
|
||||||
@@ -704,13 +704,13 @@ public:
|
|||||||
LuaHelpers::ReportScriptErrorFmt("ActorMultiVertex::SetVertex: non-table parameter supplied. Table of tables of vertex data expected.");
|
LuaHelpers::ReportScriptErrorFmt("ActorMultiVertex::SetVertex: non-table parameter supplied. Table of tables of vertex data expected.");
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
size_t NumDataParts = lua_objlen(L, DataStackIndex);
|
std::size_t NumDataParts = lua_objlen(L, DataStackIndex);
|
||||||
for(size_t i = 0; i < NumDataParts; ++i)
|
for(std::size_t i = 0; i < NumDataParts; ++i)
|
||||||
{
|
{
|
||||||
lua_pushnumber(L, i+1);
|
lua_pushnumber(L, i+1);
|
||||||
lua_gettable(L, DataStackIndex);
|
lua_gettable(L, DataStackIndex);
|
||||||
int DataPieceIndex = lua_gettop(L);
|
int DataPieceIndex = lua_gettop(L);
|
||||||
size_t DataPieceElements = lua_objlen(L, DataPieceIndex);
|
std::size_t DataPieceElements = lua_objlen(L, DataPieceIndex);
|
||||||
if(lua_type(L, DataPieceIndex) != LUA_TTABLE)
|
if(lua_type(L, DataPieceIndex) != LUA_TTABLE)
|
||||||
{
|
{
|
||||||
LuaHelpers::ReportScriptErrorFmt( "ActorMultiVertex::SetVertex: non-table parameter %u supplied inside table of parameters, table expected.", (unsigned int)i );
|
LuaHelpers::ReportScriptErrorFmt( "ActorMultiVertex::SetVertex: non-table parameter %u supplied inside table of parameters, table expected.", (unsigned int)i );
|
||||||
@@ -928,7 +928,7 @@ public:
|
|||||||
|
|
||||||
static int GetSpline(T* p, lua_State* L)
|
static int GetSpline(T* p, lua_State* L)
|
||||||
{
|
{
|
||||||
size_t i= static_cast<size_t>(IArg(1)-1);
|
std::size_t i= static_cast<std::size_t>(IArg(1)-1);
|
||||||
if(i >= ActorMultiVertex::num_vert_splines)
|
if(i >= ActorMultiVertex::num_vert_splines)
|
||||||
{
|
{
|
||||||
luaL_error(L, "Spline index must be greater than 0 and less than or equal to %zu.", ActorMultiVertex::num_vert_splines);
|
luaL_error(L, "Spline index must be greater than 0 and less than or equal to %zu.", ActorMultiVertex::num_vert_splines);
|
||||||
@@ -999,14 +999,14 @@ public:
|
|||||||
p->AddState(s);
|
p->AddState(s);
|
||||||
COMMON_RETURN_SELF;
|
COMMON_RETURN_SELF;
|
||||||
}
|
}
|
||||||
static size_t ValidStateIndex(T* p, lua_State *L, int pos)
|
static std::size_t ValidStateIndex(T* p, lua_State *L, int pos)
|
||||||
{
|
{
|
||||||
int index= IArg(pos)-1;
|
int index= IArg(pos)-1;
|
||||||
if(index < 0 || index >= p->GetNumStates())
|
if(index < 0 || index >= p->GetNumStates())
|
||||||
{
|
{
|
||||||
luaL_error(L, "Invalid state index %d.", index+1);
|
luaL_error(L, "Invalid state index %d.", index+1);
|
||||||
}
|
}
|
||||||
return static_cast<size_t>(index);
|
return static_cast<std::size_t>(index);
|
||||||
}
|
}
|
||||||
static int RemoveState(T* p, lua_State *L)
|
static int RemoveState(T* p, lua_State *L)
|
||||||
{
|
{
|
||||||
@@ -1069,9 +1069,9 @@ public:
|
|||||||
luaL_error(L, "The texture must be set before adding states.");
|
luaL_error(L, "The texture must be set before adding states.");
|
||||||
}
|
}
|
||||||
std::vector<ActorMultiVertex::State> new_states;
|
std::vector<ActorMultiVertex::State> new_states;
|
||||||
size_t num_states= lua_objlen(L, 1);
|
std::size_t num_states= lua_objlen(L, 1);
|
||||||
new_states.resize(num_states);
|
new_states.resize(num_states);
|
||||||
for(size_t i= 0; i < num_states; ++i)
|
for(std::size_t i= 0; i < num_states; ++i)
|
||||||
{
|
{
|
||||||
lua_rawgeti(L, 1, i+1);
|
lua_rawgeti(L, 1, i+1);
|
||||||
FillStateFromLua(L, new_states[i], tex, -1);
|
FillStateFromLua(L, new_states[i], tex, -1);
|
||||||
@@ -1096,14 +1096,14 @@ public:
|
|||||||
lua_pushnumber(L, p->GetNumQuadStates());
|
lua_pushnumber(L, p->GetNumQuadStates());
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
static size_t QuadStateIndex(T* p, lua_State *L, int pos)
|
static std::size_t QuadStateIndex(T* p, lua_State *L, int pos)
|
||||||
{
|
{
|
||||||
int index= IArg(pos)-1;
|
int index= IArg(pos)-1;
|
||||||
if(index < 0 || static_cast<size_t>(index) >= p->GetNumQuadStates())
|
if(index < 0 || static_cast<std::size_t>(index) >= p->GetNumQuadStates())
|
||||||
{
|
{
|
||||||
luaL_error(L, "Invalid state index %d.", index+1);
|
luaL_error(L, "Invalid state index %d.", index+1);
|
||||||
}
|
}
|
||||||
return static_cast<size_t>(index);
|
return static_cast<std::size_t>(index);
|
||||||
}
|
}
|
||||||
static int AddQuadState(T* p, lua_State *L)
|
static int AddQuadState(T* p, lua_State *L)
|
||||||
{
|
{
|
||||||
|
|||||||
+18
-16
@@ -6,6 +6,8 @@
|
|||||||
#include "RageMath.h"
|
#include "RageMath.h"
|
||||||
#include "RageTextureID.h"
|
#include "RageTextureID.h"
|
||||||
|
|
||||||
|
#include <cstddef>
|
||||||
|
|
||||||
enum DrawMode
|
enum DrawMode
|
||||||
{
|
{
|
||||||
DrawMode_Quads = 0,
|
DrawMode_Quads = 0,
|
||||||
@@ -28,7 +30,7 @@ class RageTexture;
|
|||||||
class ActorMultiVertex: public Actor
|
class ActorMultiVertex: public Actor
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
static const size_t num_vert_splines= 4;
|
static const std::size_t num_vert_splines= 4;
|
||||||
ActorMultiVertex();
|
ActorMultiVertex();
|
||||||
ActorMultiVertex( const ActorMultiVertex &cpy );
|
ActorMultiVertex( const ActorMultiVertex &cpy );
|
||||||
virtual ~ActorMultiVertex();
|
virtual ~ActorMultiVertex();
|
||||||
@@ -49,7 +51,7 @@ public:
|
|||||||
int GetSafeNumToDraw( DrawMode dm, int num ) const;
|
int GetSafeNumToDraw( DrawMode dm, int num ) const;
|
||||||
|
|
||||||
std::vector<RageSpriteVertex> vertices;
|
std::vector<RageSpriteVertex> vertices;
|
||||||
std::vector<size_t> quad_states;
|
std::vector<std::size_t> quad_states;
|
||||||
|
|
||||||
DrawMode _DrawMode;
|
DrawMode _DrawMode;
|
||||||
int FirstToDraw;
|
int FirstToDraw;
|
||||||
@@ -87,7 +89,7 @@ public:
|
|||||||
void LoadFromTexture( RageTextureID ID );
|
void LoadFromTexture( RageTextureID ID );
|
||||||
|
|
||||||
void UnloadTexture();
|
void UnloadTexture();
|
||||||
void SetNumVertices( size_t n );
|
void SetNumVertices( std::size_t n );
|
||||||
|
|
||||||
void AddVertex();
|
void AddVertex();
|
||||||
void AddVertices( int Add );
|
void AddVertices( int Add );
|
||||||
@@ -104,15 +106,15 @@ public:
|
|||||||
DrawMode GetCurrDrawMode() const { return AMV_current._DrawMode; }
|
DrawMode GetCurrDrawMode() const { return AMV_current._DrawMode; }
|
||||||
int GetCurrFirstToDraw() const { return AMV_current.FirstToDraw; }
|
int GetCurrFirstToDraw() const { return AMV_current.FirstToDraw; }
|
||||||
int GetCurrNumToDraw() const { return AMV_current.NumToDraw; }
|
int GetCurrNumToDraw() const { return AMV_current.NumToDraw; }
|
||||||
size_t GetNumVertices() { return AMV_DestTweenState().vertices.size(); }
|
std::size_t GetNumVertices() { return AMV_DestTweenState().vertices.size(); }
|
||||||
|
|
||||||
void SetVertexPos( int index , float x , float y , float z );
|
void SetVertexPos( int index , float x , float y , float z );
|
||||||
void SetVertexColor( int index , RageColor c );
|
void SetVertexColor( int index , RageColor c );
|
||||||
void SetVertexCoords( int index , float TexCoordX , float TexCoordY );
|
void SetVertexCoords( int index , float TexCoordX , float TexCoordY );
|
||||||
|
|
||||||
inline void SetVertsFromSplinesInternal(size_t num_splines, size_t start_vert);
|
inline void SetVertsFromSplinesInternal(std::size_t num_splines, std::size_t start_vert);
|
||||||
void SetVertsFromSplines();
|
void SetVertsFromSplines();
|
||||||
CubicSplineN* GetSpline(size_t i);
|
CubicSplineN* GetSpline(std::size_t i);
|
||||||
|
|
||||||
struct State
|
struct State
|
||||||
{
|
{
|
||||||
@@ -121,12 +123,12 @@ public:
|
|||||||
};
|
};
|
||||||
int GetNumStates() const override { return _states.size(); }
|
int GetNumStates() const override { return _states.size(); }
|
||||||
void AddState(const State& new_state) { _states.push_back(new_state); }
|
void AddState(const State& new_state) { _states.push_back(new_state); }
|
||||||
void RemoveState(size_t i)
|
void RemoveState(std::size_t i)
|
||||||
{ ASSERT(i < _states.size()); _states.erase(_states.begin()+i); }
|
{ ASSERT(i < _states.size()); _states.erase(_states.begin()+i); }
|
||||||
size_t GetState() { return _cur_state; }
|
std::size_t GetState() { return _cur_state; }
|
||||||
State& GetStateData(size_t i)
|
State& GetStateData(std::size_t i)
|
||||||
{ ASSERT(i < _states.size()); return _states[i]; }
|
{ ASSERT(i < _states.size()); return _states[i]; }
|
||||||
void SetStateData(size_t i, const State& s)
|
void SetStateData(std::size_t i, const State& s)
|
||||||
{ ASSERT(i < _states.size()); _states[i]= s; }
|
{ ASSERT(i < _states.size()); _states[i]= s; }
|
||||||
void SetStateProperties(const std::vector<State>& new_states)
|
void SetStateProperties(const std::vector<State>& new_states)
|
||||||
{ _states= new_states; SetState(0); }
|
{ _states= new_states; SetState(0); }
|
||||||
@@ -135,15 +137,15 @@ public:
|
|||||||
float GetAnimationLengthSeconds() const override;
|
float GetAnimationLengthSeconds() const override;
|
||||||
void SetSecondsIntoAnimation(float seconds) override;
|
void SetSecondsIntoAnimation(float seconds) override;
|
||||||
void UpdateAnimationState(bool force_update= false);
|
void UpdateAnimationState(bool force_update= false);
|
||||||
size_t GetNumQuadStates() const
|
std::size_t GetNumQuadStates() const
|
||||||
{ return AMV_DestTweenState().quad_states.size(); }
|
{ return AMV_DestTweenState().quad_states.size(); }
|
||||||
void AddQuadState(size_t s)
|
void AddQuadState(std::size_t s)
|
||||||
{ AMV_DestTweenState().quad_states.push_back(s); }
|
{ AMV_DestTweenState().quad_states.push_back(s); }
|
||||||
void RemoveQuadState(size_t i)
|
void RemoveQuadState(std::size_t i)
|
||||||
{ AMV_DestTweenState().quad_states.erase(AMV_DestTweenState().quad_states.begin()+i); }
|
{ AMV_DestTweenState().quad_states.erase(AMV_DestTweenState().quad_states.begin()+i); }
|
||||||
size_t GetQuadState(size_t i)
|
std::size_t GetQuadState(std::size_t i)
|
||||||
{ return AMV_DestTweenState().quad_states[i]; }
|
{ return AMV_DestTweenState().quad_states[i]; }
|
||||||
void SetQuadState(size_t i, size_t s)
|
void SetQuadState(std::size_t i, std::size_t s)
|
||||||
{ AMV_DestTweenState().quad_states[i]= s; }
|
{ AMV_DestTweenState().quad_states[i]= s; }
|
||||||
bool _use_animation_state;
|
bool _use_animation_state;
|
||||||
bool _decode_movie;
|
bool _decode_movie;
|
||||||
@@ -170,7 +172,7 @@ private:
|
|||||||
|
|
||||||
bool _skip_next_update;
|
bool _skip_next_update;
|
||||||
float _secs_into_state;
|
float _secs_into_state;
|
||||||
size_t _cur_state;
|
std::size_t _cur_state;
|
||||||
std::vector<State> _states;
|
std::vector<State> _states;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|||||||
+4
-3
@@ -43,6 +43,7 @@
|
|||||||
#include "ScreenManager.h"
|
#include "ScreenManager.h"
|
||||||
|
|
||||||
#include <cmath>
|
#include <cmath>
|
||||||
|
#include <cstddef>
|
||||||
|
|
||||||
|
|
||||||
std::vector<TimingData> AdjustSync::s_vpTimingDataOriginal;
|
std::vector<TimingData> AdjustSync::s_vpTimingDataOriginal;
|
||||||
@@ -359,7 +360,7 @@ void AdjustSync::GetSyncChangeTextSong( std::vector<RString> &vsAddTo )
|
|||||||
const std::vector<TimingSegment*> &bpmTest = testing.GetTimingSegments(SEGMENT_BPM);
|
const std::vector<TimingSegment*> &bpmTest = testing.GetTimingSegments(SEGMENT_BPM);
|
||||||
const std::vector<TimingSegment*> &bpmOrig = original.GetTimingSegments(SEGMENT_BPM);
|
const std::vector<TimingSegment*> &bpmOrig = original.GetTimingSegments(SEGMENT_BPM);
|
||||||
SEGMENTS_MISMATCH_MESSAGE(bpmOrig, bpmTest, bpm);
|
SEGMENTS_MISMATCH_MESSAGE(bpmOrig, bpmTest, bpm);
|
||||||
for(size_t i= 0; i < bpmTest.size() && i < bpmOrig.size(); i++)
|
for(std::size_t i= 0; i < bpmTest.size() && i < bpmOrig.size(); i++)
|
||||||
{
|
{
|
||||||
float fNew = Quantize( ToBPM(bpmTest[i])->GetBPM(), 0.001f );
|
float fNew = Quantize( ToBPM(bpmTest[i])->GetBPM(), 0.001f );
|
||||||
float fOld = Quantize( ToBPM(bpmOrig[i])->GetBPM(), 0.001f );
|
float fOld = Quantize( ToBPM(bpmOrig[i])->GetBPM(), 0.001f );
|
||||||
@@ -383,7 +384,7 @@ void AdjustSync::GetSyncChangeTextSong( std::vector<RString> &vsAddTo )
|
|||||||
const std::vector<TimingSegment*> &stopOrig = original.GetTimingSegments(SEGMENT_STOP);
|
const std::vector<TimingSegment*> &stopOrig = original.GetTimingSegments(SEGMENT_STOP);
|
||||||
|
|
||||||
SEGMENTS_MISMATCH_MESSAGE(stopOrig, stopTest, stop);
|
SEGMENTS_MISMATCH_MESSAGE(stopOrig, stopTest, stop);
|
||||||
for(size_t i= 0; i < stopTest.size() && i < stopOrig.size(); i++)
|
for(std::size_t i= 0; i < stopTest.size() && i < stopOrig.size(); i++)
|
||||||
{
|
{
|
||||||
float fOld = Quantize( ToStop(stopOrig[i])->GetPause(), 0.001f );
|
float fOld = Quantize( ToStop(stopOrig[i])->GetPause(), 0.001f );
|
||||||
float fNew = Quantize( ToStop(stopTest[i])->GetPause(), 0.001f );
|
float fNew = Quantize( ToStop(stopTest[i])->GetPause(), 0.001f );
|
||||||
@@ -406,7 +407,7 @@ void AdjustSync::GetSyncChangeTextSong( std::vector<RString> &vsAddTo )
|
|||||||
const std::vector<TimingSegment*> &delyOrig = original.GetTimingSegments(SEGMENT_DELAY);
|
const std::vector<TimingSegment*> &delyOrig = original.GetTimingSegments(SEGMENT_DELAY);
|
||||||
|
|
||||||
SEGMENTS_MISMATCH_MESSAGE(delyOrig, delyTest, delay);
|
SEGMENTS_MISMATCH_MESSAGE(delyOrig, delyTest, delay);
|
||||||
for(size_t i= 0; i < delyTest.size() && i < delyOrig.size(); i++)
|
for(std::size_t i= 0; i < delyTest.size() && i < delyOrig.size(); i++)
|
||||||
{
|
{
|
||||||
if( delyTest[i] == delyOrig[i] )
|
if( delyTest[i] == delyOrig[i] )
|
||||||
continue;
|
continue;
|
||||||
|
|||||||
@@ -15,6 +15,7 @@
|
|||||||
|
|
||||||
#include <cfloat>
|
#include <cfloat>
|
||||||
#include <cmath>
|
#include <cmath>
|
||||||
|
#include <cstddef>
|
||||||
|
|
||||||
static char const dimension_names[4]= "XYZ";
|
static char const dimension_names[4]= "XYZ";
|
||||||
|
|
||||||
@@ -50,15 +51,15 @@ static ThemeMetric<float> TIPSY_OFFSET_TIMER_FREQUENCY( "ArrowEffects", "TipsyOf
|
|||||||
static ThemeMetric<float> TIPSY_OFFSET_COLUMN_FREQUENCY( "ArrowEffects", "TipsyOffsetColumnFrequency" );
|
static ThemeMetric<float> TIPSY_OFFSET_COLUMN_FREQUENCY( "ArrowEffects", "TipsyOffsetColumnFrequency" );
|
||||||
static ThemeMetric<float> TIPSY_OFFSET_ARROW_MAGNITUDE( "ArrowEffects", "TipsyOffsetArrowMagnitude" );
|
static ThemeMetric<float> TIPSY_OFFSET_ARROW_MAGNITUDE( "ArrowEffects", "TipsyOffsetArrowMagnitude" );
|
||||||
|
|
||||||
static RString TPSTL_NAME(size_t i) { return ssprintf("Tornado%cPositionScaleToLow", dimension_names[i]); }
|
static RString TPSTL_NAME(std::size_t i) { return ssprintf("Tornado%cPositionScaleToLow", dimension_names[i]); }
|
||||||
static ThemeMetric1D<float> TORNADO_POSITION_SCALE_TO_LOW("ArrowEffects", TPSTL_NAME, 3);
|
static ThemeMetric1D<float> TORNADO_POSITION_SCALE_TO_LOW("ArrowEffects", TPSTL_NAME, 3);
|
||||||
static RString TPSTH_NAME(size_t i) { return ssprintf("Tornado%cPositionScaleToHigh", dimension_names[i]); }
|
static RString TPSTH_NAME(std::size_t i) { return ssprintf("Tornado%cPositionScaleToHigh", dimension_names[i]); }
|
||||||
static ThemeMetric1D<float> TORNADO_POSITION_SCALE_TO_HIGH("ArrowEffects", TPSTH_NAME, 3);
|
static ThemeMetric1D<float> TORNADO_POSITION_SCALE_TO_HIGH("ArrowEffects", TPSTH_NAME, 3);
|
||||||
static RString TOF_NAME(size_t i) { return ssprintf("Tornado%cOffsetFrequency", dimension_names[i]); }
|
static RString TOF_NAME(std::size_t i) { return ssprintf("Tornado%cOffsetFrequency", dimension_names[i]); }
|
||||||
static ThemeMetric1D<float> TORNADO_OFFSET_FREQUENCY("ArrowEffects", TOF_NAME, 3);
|
static ThemeMetric1D<float> TORNADO_OFFSET_FREQUENCY("ArrowEffects", TOF_NAME, 3);
|
||||||
static RString TOSFL_NAME(size_t i) { return ssprintf("Tornado%cOffsetScaleFromLow", dimension_names[i]); }
|
static RString TOSFL_NAME(std::size_t i) { return ssprintf("Tornado%cOffsetScaleFromLow", dimension_names[i]); }
|
||||||
static ThemeMetric1D<float> TORNADO_OFFSET_SCALE_FROM_LOW("ArrowEffects", TOSFL_NAME, 3);
|
static ThemeMetric1D<float> TORNADO_OFFSET_SCALE_FROM_LOW("ArrowEffects", TOSFL_NAME, 3);
|
||||||
static RString TOSFH_NAME(size_t i) { return ssprintf("Tornado%cOffsetScaleFromHigh", dimension_names[i]); }
|
static RString TOSFH_NAME(std::size_t i) { return ssprintf("Tornado%cOffsetScaleFromHigh", dimension_names[i]); }
|
||||||
static ThemeMetric1D<float> TORNADO_OFFSET_SCALE_FROM_HIGH("ArrowEffects", TOSFH_NAME, 3);
|
static ThemeMetric1D<float> TORNADO_OFFSET_SCALE_FROM_HIGH("ArrowEffects", TOSFH_NAME, 3);
|
||||||
|
|
||||||
static ThemeMetric<float> DRUNK_COLUMN_FREQUENCY( "ArrowEffects", "DrunkColumnFrequency" );
|
static ThemeMetric<float> DRUNK_COLUMN_FREQUENCY( "ArrowEffects", "DrunkColumnFrequency" );
|
||||||
|
|||||||
+15
-14
@@ -11,6 +11,7 @@
|
|||||||
#include "LuaBinding.h"
|
#include "LuaBinding.h"
|
||||||
|
|
||||||
#include <cmath>
|
#include <cmath>
|
||||||
|
#include <cstddef>
|
||||||
|
|
||||||
|
|
||||||
REGISTER_ACTOR_CLASS( BitmapText );
|
REGISTER_ACTOR_CLASS( BitmapText );
|
||||||
@@ -643,13 +644,13 @@ bool BitmapText::StringWillUseAlternate( const RString& sText, const RString& sA
|
|||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
void BitmapText::CropLineToWidth(size_t l, int width)
|
void BitmapText::CropLineToWidth(std::size_t l, int width)
|
||||||
{
|
{
|
||||||
if(l < m_wTextLines.size())
|
if(l < m_wTextLines.size())
|
||||||
{
|
{
|
||||||
int used_width= width;
|
int used_width= width;
|
||||||
std::wstring& line= m_wTextLines[l];
|
std::wstring& line= m_wTextLines[l];
|
||||||
const size_t fit= m_pFont->GetGlyphsThatFit(line, &used_width);
|
const std::size_t fit= m_pFont->GetGlyphsThatFit(line, &used_width);
|
||||||
if(fit < line.size())
|
if(fit < line.size())
|
||||||
{
|
{
|
||||||
line.erase(line.begin()+fit, line.end());
|
line.erase(line.begin()+fit, line.end());
|
||||||
@@ -660,7 +661,7 @@ void BitmapText::CropLineToWidth(size_t l, int width)
|
|||||||
|
|
||||||
void BitmapText::CropToWidth(int width)
|
void BitmapText::CropToWidth(int width)
|
||||||
{
|
{
|
||||||
for(size_t l= 0; l < m_wTextLines.size(); ++l)
|
for(std::size_t l= 0; l < m_wTextLines.size(); ++l)
|
||||||
{
|
{
|
||||||
CropLineToWidth(l, width);
|
CropLineToWidth(l, width);
|
||||||
}
|
}
|
||||||
@@ -721,12 +722,12 @@ void BitmapText::DrawPrimitives()
|
|||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
size_t i = 0;
|
std::size_t i = 0;
|
||||||
std::map<size_t,Attribute>::const_iterator iter = m_mAttributes.begin();
|
std::map<std::size_t,Attribute>::const_iterator iter = m_mAttributes.begin();
|
||||||
while( i < m_aVertices.size() )
|
while( i < m_aVertices.size() )
|
||||||
{
|
{
|
||||||
// Set the colors up to the next attribute.
|
// Set the colors up to the next attribute.
|
||||||
size_t iEnd = iter == m_mAttributes.end()? m_aVertices.size():iter->first*4;
|
std::size_t iEnd = iter == m_mAttributes.end()? m_aVertices.size():iter->first*4;
|
||||||
iEnd = std::min( iEnd, m_aVertices.size() );
|
iEnd = std::min( iEnd, m_aVertices.size() );
|
||||||
for( ; i < iEnd; i += 4 )
|
for( ; i < iEnd; i += 4 )
|
||||||
{
|
{
|
||||||
@@ -746,7 +747,7 @@ void BitmapText::DrawPrimitives()
|
|||||||
iEnd = i + attr.length*4;
|
iEnd = i + attr.length*4;
|
||||||
iEnd = std::min( iEnd, m_aVertices.size() );
|
iEnd = std::min( iEnd, m_aVertices.size() );
|
||||||
std::vector<RageColor> temp_attr_diffuse(NUM_DIFFUSE_COLORS, m_internalDiffuse);
|
std::vector<RageColor> temp_attr_diffuse(NUM_DIFFUSE_COLORS, m_internalDiffuse);
|
||||||
for(size_t c= 0; c < NUM_DIFFUSE_COLORS; ++c)
|
for(std::size_t c= 0; c < NUM_DIFFUSE_COLORS; ++c)
|
||||||
{
|
{
|
||||||
temp_attr_diffuse[c]*= attr.diffuse[c];
|
temp_attr_diffuse[c]*= attr.diffuse[c];
|
||||||
if(m_mult_attrs_with_diffuse)
|
if(m_mult_attrs_with_diffuse)
|
||||||
@@ -806,12 +807,12 @@ void BitmapText::DrawPrimitives()
|
|||||||
{
|
{
|
||||||
DISPLAY->SetTextureMode( TextureUnit_1, TextureMode_Glow );
|
DISPLAY->SetTextureMode( TextureUnit_1, TextureMode_Glow );
|
||||||
|
|
||||||
size_t i = 0;
|
std::size_t i = 0;
|
||||||
std::map<size_t,Attribute>::const_iterator iter = m_mAttributes.begin();
|
std::map<std::size_t,Attribute>::const_iterator iter = m_mAttributes.begin();
|
||||||
while( i < m_aVertices.size() )
|
while( i < m_aVertices.size() )
|
||||||
{
|
{
|
||||||
// Set the glow up to the next attribute.
|
// Set the glow up to the next attribute.
|
||||||
size_t iEnd = iter == m_mAttributes.end()? m_aVertices.size():iter->first*4;
|
std::size_t iEnd = iter == m_mAttributes.end()? m_aVertices.size():iter->first*4;
|
||||||
iEnd = std::min( iEnd, m_aVertices.size() );
|
iEnd = std::min( iEnd, m_aVertices.size() );
|
||||||
for( ; i < iEnd; ++i )
|
for( ; i < iEnd; ++i )
|
||||||
m_aVertices[i].c = m_pTempState->glow;
|
m_aVertices[i].c = m_pTempState->glow;
|
||||||
@@ -874,15 +875,15 @@ BitmapText::Attribute BitmapText::GetDefaultAttribute() const
|
|||||||
return attr;
|
return attr;
|
||||||
}
|
}
|
||||||
|
|
||||||
void BitmapText::AddAttribute( size_t iPos, const Attribute &attr )
|
void BitmapText::AddAttribute( std::size_t iPos, const Attribute &attr )
|
||||||
{
|
{
|
||||||
// Fixup position for new lines.
|
// Fixup position for new lines.
|
||||||
int iLines = 0;
|
int iLines = 0;
|
||||||
size_t iAdjustedPos = iPos;
|
std::size_t iAdjustedPos = iPos;
|
||||||
|
|
||||||
for (std::wstring const & line : m_wTextLines)
|
for (std::wstring const & line : m_wTextLines)
|
||||||
{
|
{
|
||||||
size_t length = line.length();
|
std::size_t length = line.length();
|
||||||
if( length >= iAdjustedPos )
|
if( length >= iAdjustedPos )
|
||||||
break;
|
break;
|
||||||
iAdjustedPos -= length;
|
iAdjustedPos -= length;
|
||||||
@@ -989,7 +990,7 @@ public:
|
|||||||
static int GetText( T* p, lua_State *L ) { lua_pushstring( L, p->GetText() ); return 1; }
|
static int GetText( T* p, lua_State *L ) { lua_pushstring( L, p->GetText() ); return 1; }
|
||||||
static int AddAttribute( T* p, lua_State *L )
|
static int AddAttribute( T* p, lua_State *L )
|
||||||
{
|
{
|
||||||
size_t iPos = IArg(1);
|
std::size_t iPos = IArg(1);
|
||||||
BitmapText::Attribute attr = p->GetDefaultAttribute();
|
BitmapText::Attribute attr = p->GetDefaultAttribute();
|
||||||
|
|
||||||
attr.FromStack( L, 2 );
|
attr.FromStack( L, 2 );
|
||||||
|
|||||||
+7
-5
@@ -2,6 +2,8 @@
|
|||||||
#define BITMAP_TEXT_H
|
#define BITMAP_TEXT_H
|
||||||
|
|
||||||
#include "Actor.h"
|
#include "Actor.h"
|
||||||
|
|
||||||
|
#include <cstddef>
|
||||||
#include <map>
|
#include <map>
|
||||||
|
|
||||||
class RageTexture;
|
class RageTexture;
|
||||||
@@ -62,7 +64,7 @@ public:
|
|||||||
void SetMaxHeight( float fMaxHeight );
|
void SetMaxHeight( float fMaxHeight );
|
||||||
void SetMaxDimUseZoom(bool use);
|
void SetMaxDimUseZoom(bool use);
|
||||||
void SetWrapWidthPixels( int iWrapWidthPixels );
|
void SetWrapWidthPixels( int iWrapWidthPixels );
|
||||||
void CropLineToWidth(size_t l, int width);
|
void CropLineToWidth(std::size_t l, int width);
|
||||||
void CropToWidth(int width);
|
void CropToWidth(int width);
|
||||||
|
|
||||||
virtual bool EarlyAbortDraw() const override;
|
virtual bool EarlyAbortDraw() const override;
|
||||||
@@ -103,7 +105,7 @@ public:
|
|||||||
};
|
};
|
||||||
|
|
||||||
Attribute GetDefaultAttribute() const;
|
Attribute GetDefaultAttribute() const;
|
||||||
void AddAttribute( size_t iPos, const Attribute &attr );
|
void AddAttribute( std::size_t iPos, const Attribute &attr );
|
||||||
void ClearAttributes();
|
void ClearAttributes();
|
||||||
|
|
||||||
// Commands
|
// Commands
|
||||||
@@ -128,9 +130,9 @@ protected:
|
|||||||
|
|
||||||
std::vector<RageSpriteVertex> m_aVertices;
|
std::vector<RageSpriteVertex> m_aVertices;
|
||||||
|
|
||||||
std::vector<FontPageTextures*> m_vpFontPageTextures;
|
std::vector<FontPageTextures*> m_vpFontPageTextures;
|
||||||
std::map<size_t, Attribute> m_mAttributes;
|
std::map<std::size_t, Attribute> m_mAttributes;
|
||||||
bool m_bHasGlowAttribute;
|
bool m_bHasGlowAttribute;
|
||||||
|
|
||||||
TextGlowMode m_TextGlowMode;
|
TextGlowMode m_TextGlowMode;
|
||||||
|
|
||||||
|
|||||||
@@ -6,9 +6,11 @@
|
|||||||
#include "ThemeMetric.h"
|
#include "ThemeMetric.h"
|
||||||
#include "ActorUtil.h"
|
#include "ActorUtil.h"
|
||||||
|
|
||||||
|
#include <cstddef>
|
||||||
|
|
||||||
ThemeMetric<float> METER_WIDTH ("CombinedLifeMeterTug","MeterWidth");
|
ThemeMetric<float> METER_WIDTH ("CombinedLifeMeterTug","MeterWidth");
|
||||||
|
|
||||||
static void TugMeterPercentChangeInit( size_t /*ScoreEvent*/ i, RString &sNameOut, float &defaultValueOut )
|
static void TugMeterPercentChangeInit( std::size_t /*ScoreEvent*/ i, RString &sNameOut, float &defaultValueOut )
|
||||||
{
|
{
|
||||||
sNameOut = "TugMeterPercentChange" + ScoreEventToString( (ScoreEvent)i );
|
sNameOut = "TugMeterPercentChange" + ScoreEventToString( (ScoreEvent)i );
|
||||||
switch( i )
|
switch( i )
|
||||||
|
|||||||
+3
-2
@@ -4,6 +4,7 @@
|
|||||||
#include "RageLog.h"
|
#include "RageLog.h"
|
||||||
#include "arch/Dialog/Dialog.h"
|
#include "arch/Dialog/Dialog.h"
|
||||||
|
|
||||||
|
#include <cstddef>
|
||||||
#include <numeric>
|
#include <numeric>
|
||||||
|
|
||||||
RString Command::GetName() const
|
RString Command::GetName() const
|
||||||
@@ -41,9 +42,9 @@ static void SplitWithQuotes( const RString sSource, const char Delimitor, std::v
|
|||||||
if( sSource.empty() )
|
if( sSource.empty() )
|
||||||
return;
|
return;
|
||||||
|
|
||||||
size_t startpos = 0;
|
std::size_t startpos = 0;
|
||||||
do {
|
do {
|
||||||
size_t pos = startpos;
|
std::size_t pos = startpos;
|
||||||
while( pos < sSource.size() )
|
while( pos < sSource.size() )
|
||||||
{
|
{
|
||||||
if( sSource[pos] == Delimitor )
|
if( sSource[pos] == Delimitor )
|
||||||
|
|||||||
+5
-3
@@ -1,4 +1,3 @@
|
|||||||
#include <limits.h>
|
|
||||||
#include "global.h"
|
#include "global.h"
|
||||||
#include "Course.h"
|
#include "Course.h"
|
||||||
#include "CourseLoaderCRS.h"
|
#include "CourseLoaderCRS.h"
|
||||||
@@ -19,6 +18,9 @@
|
|||||||
#include "Game.h"
|
#include "Game.h"
|
||||||
#include "Style.h"
|
#include "Style.h"
|
||||||
|
|
||||||
|
#include <cstddef>
|
||||||
|
#include <limits.h>
|
||||||
|
|
||||||
static Preference<int> MAX_SONGS_IN_EDIT_COURSE( "MaxSongsInEditCourse", -1 );
|
static Preference<int> MAX_SONGS_IN_EDIT_COURSE( "MaxSongsInEditCourse", -1 );
|
||||||
|
|
||||||
static const char *SongSortNames[] = {
|
static const char *SongSortNames[] = {
|
||||||
@@ -743,7 +745,7 @@ void Course::GetTrailUnsortedEndless( const std::vector<CourseEntry> &entries, T
|
|||||||
ASSERT(e->iChooseIndex >= 0);
|
ASSERT(e->iChooseIndex >= 0);
|
||||||
// If we're trying to pick BEST100 when only 99 songs exist,
|
// If we're trying to pick BEST100 when only 99 songs exist,
|
||||||
// we have a problem, so bail out
|
// we have a problem, so bail out
|
||||||
if (static_cast<size_t>(e->iChooseIndex) >= vpSongs.size()) {
|
if (static_cast<std::size_t>(e->iChooseIndex) >= vpSongs.size()) {
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -1271,7 +1273,7 @@ public:
|
|||||||
DEFINE_METHOD( GetCourseType, GetCourseType() )
|
DEFINE_METHOD( GetCourseType, GetCourseType() )
|
||||||
static int GetCourseEntry(T* p, lua_State* L)
|
static int GetCourseEntry(T* p, lua_State* L)
|
||||||
{
|
{
|
||||||
size_t id= static_cast<size_t>(IArg(1));
|
std::size_t id= static_cast<std::size_t>(IArg(1));
|
||||||
if(id >= p->m_vEntries.size())
|
if(id >= p->m_vEntries.size())
|
||||||
{
|
{
|
||||||
lua_pushnil(L);
|
lua_pushnil(L);
|
||||||
|
|||||||
+11
-10
@@ -1,6 +1,7 @@
|
|||||||
#include "global.h"
|
#include "global.h"
|
||||||
|
|
||||||
#include <stdio.h>
|
#include <cstddef>
|
||||||
|
#include <cstdio>
|
||||||
|
|
||||||
#if defined(_WINDOWS)
|
#if defined(_WINDOWS)
|
||||||
#include <tchar.h>
|
#include <tchar.h>
|
||||||
@@ -144,7 +145,7 @@ typedef char TCHAR;
|
|||||||
typedef unsigned char uch; // unsigned 8-bit value
|
typedef unsigned char uch; // unsigned 8-bit value
|
||||||
typedef unsigned short ush; // unsigned 16-bit value
|
typedef unsigned short ush; // unsigned 16-bit value
|
||||||
typedef unsigned long ulg; // unsigned 32-bit value
|
typedef unsigned long ulg; // unsigned 32-bit value
|
||||||
typedef size_t extent; // file size
|
typedef std::size_t extent; // file size
|
||||||
typedef unsigned Pos; // must be at least 32 bits
|
typedef unsigned Pos; // must be at least 32 bits
|
||||||
typedef unsigned IPos; // A Pos is an index in the character window. Pos is used only for parameter passing
|
typedef unsigned IPos; // A Pos is an index in the character window. Pos is used only for parameter passing
|
||||||
|
|
||||||
@@ -347,7 +348,7 @@ typedef struct iztimes {
|
|||||||
typedef struct zlist {
|
typedef struct zlist {
|
||||||
ush vem, ver, flg, how; // See central header in zipfile.c for what vem..off are
|
ush vem, ver, flg, how; // See central header in zipfile.c for what vem..off are
|
||||||
ulg tim, crc, siz, len;
|
ulg tim, crc, siz, len;
|
||||||
size_t nam, ext, cext, com; // offset of ext must be >= LOCHEAD
|
std::size_t nam, ext, cext, com; // offset of ext must be >= LOCHEAD
|
||||||
ush dsk, att, lflg; // offset of lflg must be >= LOCHEAD
|
ush dsk, att, lflg; // offset of lflg must be >= LOCHEAD
|
||||||
ulg atx, off;
|
ulg atx, off;
|
||||||
char name[MAX_PATH]; // File name in zip file
|
char name[MAX_PATH]; // File name in zip file
|
||||||
@@ -400,12 +401,12 @@ int putlocal(struct zlist *z, WRITEFUNC wfunc,void *param)
|
|||||||
PUTLG(z->len, f);
|
PUTLG(z->len, f);
|
||||||
PUTSH(z->nam, f);
|
PUTSH(z->nam, f);
|
||||||
PUTSH(z->ext, f);
|
PUTSH(z->ext, f);
|
||||||
size_t res = (size_t)wfunc(param, z->iname, (unsigned int)z->nam);
|
std::size_t res = (std::size_t)wfunc(param, z->iname, (unsigned int)z->nam);
|
||||||
if (res!=z->nam)
|
if (res!=z->nam)
|
||||||
return ZE_TEMP;
|
return ZE_TEMP;
|
||||||
if (z->ext)
|
if (z->ext)
|
||||||
{
|
{
|
||||||
res = (size_t)wfunc(param, z->extra, (unsigned int)z->ext);
|
res = (std::size_t)wfunc(param, z->extra, (unsigned int)z->ext);
|
||||||
if (res!=z->ext)
|
if (res!=z->ext)
|
||||||
return ZE_TEMP;
|
return ZE_TEMP;
|
||||||
}
|
}
|
||||||
@@ -441,15 +442,15 @@ int putcentral(struct zlist *z, WRITEFUNC wfunc, void *param)
|
|||||||
PUTSH(z->att, f);
|
PUTSH(z->att, f);
|
||||||
PUTLG(z->atx, f);
|
PUTLG(z->atx, f);
|
||||||
PUTLG(z->off, f);
|
PUTLG(z->off, f);
|
||||||
if ((size_t)wfunc(param, z->iname, (unsigned int)z->nam) != z->nam ||
|
if ((std::size_t)wfunc(param, z->iname, (unsigned int)z->nam) != z->nam ||
|
||||||
(z->cext && (size_t)wfunc(param, z->cextra, (unsigned int)z->cext) != z->cext) ||
|
(z->cext && (std::size_t)wfunc(param, z->cextra, (unsigned int)z->cext) != z->cext) ||
|
||||||
(z->com && (size_t)wfunc(param, z->comment, (unsigned int)z->com) != z->com))
|
(z->com && (std::size_t)wfunc(param, z->comment, (unsigned int)z->com) != z->com))
|
||||||
return ZE_TEMP;
|
return ZE_TEMP;
|
||||||
return ZE_OK;
|
return ZE_OK;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
int putend(int n, ulg s, ulg c, size_t m, char *z, WRITEFUNC wfunc, void *param)
|
int putend(int n, ulg s, ulg c, std::size_t m, char *z, WRITEFUNC wfunc, void *param)
|
||||||
{
|
{
|
||||||
// write the end of the central-directory-data to file *f.
|
// write the end of the central-directory-data to file *f.
|
||||||
PUTLG(ENDSIG, f);
|
PUTLG(ENDSIG, f);
|
||||||
@@ -530,7 +531,7 @@ const ulg crc_table[256] = {
|
|||||||
#define DO4(buf) DO2(buf); DO2(buf)
|
#define DO4(buf) DO2(buf); DO2(buf)
|
||||||
#define DO8(buf) DO4(buf); DO4(buf)
|
#define DO8(buf) DO4(buf); DO4(buf)
|
||||||
|
|
||||||
ulg crc32(ulg crc, const uch *buf, size_t len)
|
ulg crc32(ulg crc, const uch *buf, std::size_t len)
|
||||||
{
|
{
|
||||||
if (buf== nullptr) return 0L;
|
if (buf== nullptr) return 0L;
|
||||||
crc = crc ^ 0xffffffffL;
|
crc = crc ^ 0xffffffffL;
|
||||||
|
|||||||
+90
-88
@@ -2,6 +2,8 @@
|
|||||||
#include "CubicSpline.h"
|
#include "CubicSpline.h"
|
||||||
#include "RageLog.h"
|
#include "RageLog.h"
|
||||||
#include "RageUtil.h"
|
#include "RageUtil.h"
|
||||||
|
|
||||||
|
#include <cstddef>
|
||||||
#include <list>
|
#include <list>
|
||||||
|
|
||||||
// Spline solving optimization:
|
// Spline solving optimization:
|
||||||
@@ -27,29 +29,29 @@ struct SplineSolutionCache
|
|||||||
void solve_diagonals_straight(std::vector<float>& diagonals, std::vector<float>& multiples);
|
void solve_diagonals_straight(std::vector<float>& diagonals, std::vector<float>& multiples);
|
||||||
void solve_diagonals_looped(std::vector<float>& diagonals, std::vector<float>& multiples);
|
void solve_diagonals_looped(std::vector<float>& diagonals, std::vector<float>& multiples);
|
||||||
private:
|
private:
|
||||||
void prep_inner(size_t last, std::vector<float>& out);
|
void prep_inner(std::size_t last, std::vector<float>& out);
|
||||||
bool find_in_cache(std::list<Entry>& cache, std::vector<float>& outd, std::vector<float>& outm);
|
bool find_in_cache(std::list<Entry>& cache, std::vector<float>& outd, std::vector<float>& outm);
|
||||||
void add_to_cache(std::list<Entry>& cache, std::vector<float>& outd, std::vector<float>& outm);
|
void add_to_cache(std::list<Entry>& cache, std::vector<float>& outd, std::vector<float>& outm);
|
||||||
std::list<Entry> straight_diagonals;
|
std::list<Entry> straight_diagonals;
|
||||||
std::list<Entry> looped_diagonals;
|
std::list<Entry> looped_diagonals;
|
||||||
};
|
};
|
||||||
|
|
||||||
const size_t solution_cache_limit= 16;
|
const std::size_t solution_cache_limit= 16;
|
||||||
|
|
||||||
bool SplineSolutionCache::find_in_cache(std::list<Entry>& cache, std::vector<float>& outd, std::vector<float>& outm)
|
bool SplineSolutionCache::find_in_cache(std::list<Entry>& cache, std::vector<float>& outd, std::vector<float>& outm)
|
||||||
{
|
{
|
||||||
size_t out_size= outd.size();
|
std::size_t out_size= outd.size();
|
||||||
for(std::list<Entry>::iterator entry= cache.begin();
|
for(std::list<Entry>::iterator entry= cache.begin();
|
||||||
entry != cache.end(); ++entry)
|
entry != cache.end(); ++entry)
|
||||||
{
|
{
|
||||||
if(out_size == entry->diagonals.size())
|
if(out_size == entry->diagonals.size())
|
||||||
{
|
{
|
||||||
for(size_t i= 0; i < out_size; ++i)
|
for(std::size_t i= 0; i < out_size; ++i)
|
||||||
{
|
{
|
||||||
outd[i]= entry->diagonals[i];
|
outd[i]= entry->diagonals[i];
|
||||||
}
|
}
|
||||||
outm.resize(entry->multiples.size());
|
outm.resize(entry->multiples.size());
|
||||||
for(size_t i= 0; i < entry->multiples.size(); ++i)
|
for(std::size_t i= 0; i < entry->multiples.size(); ++i)
|
||||||
{
|
{
|
||||||
outm[i]= entry->multiples[i];
|
outm[i]= entry->multiples[i];
|
||||||
}
|
}
|
||||||
@@ -70,9 +72,9 @@ void SplineSolutionCache::add_to_cache(std::list<Entry>& cache, std::vector<floa
|
|||||||
cache.front().multiples= outm;
|
cache.front().multiples= outm;
|
||||||
}
|
}
|
||||||
|
|
||||||
void SplineSolutionCache::prep_inner(size_t last, std::vector<float>& out)
|
void SplineSolutionCache::prep_inner(std::size_t last, std::vector<float>& out)
|
||||||
{
|
{
|
||||||
for(size_t i= 1; i < last; ++i)
|
for(std::size_t i= 1; i < last; ++i)
|
||||||
{
|
{
|
||||||
out[i]= 4.0f;
|
out[i]= 4.0f;
|
||||||
}
|
}
|
||||||
@@ -98,7 +100,7 @@ void SplineSolutionCache::solve_diagonals_straight(std::vector<float>& diagonals
|
|||||||
// | 0 0 b 0 | -> | 0 0 b 0 | -> | 0 0 b 0 |
|
// | 0 0 b 0 | -> | 0 0 b 0 | -> | 0 0 b 0 |
|
||||||
// | 0 0 0 c | -> | 0 0 0 c | -> | 0 0 0 c |
|
// | 0 0 0 c | -> | 0 0 0 c | -> | 0 0 0 c |
|
||||||
|
|
||||||
size_t last= diagonals.size();
|
std::size_t last= diagonals.size();
|
||||||
diagonals[0]= 2.0f;
|
diagonals[0]= 2.0f;
|
||||||
prep_inner(last-1, diagonals);
|
prep_inner(last-1, diagonals);
|
||||||
diagonals[last-1]= 2.0f;
|
diagonals[last-1]= 2.0f;
|
||||||
@@ -107,7 +109,7 @@ void SplineSolutionCache::solve_diagonals_straight(std::vector<float>& diagonals
|
|||||||
// Operation: Add row[0] * -.5 to row[1] to zero [r1][c0].
|
// Operation: Add row[0] * -.5 to row[1] to zero [r1][c0].
|
||||||
diagonals[1]-= .5f;
|
diagonals[1]-= .5f;
|
||||||
multiples.push_back(.5f);
|
multiples.push_back(.5f);
|
||||||
for(size_t i= 1; i < last-1; ++i)
|
for(std::size_t i= 1; i < last-1; ++i)
|
||||||
{
|
{
|
||||||
// Operation: Add row[i] / -[ri][ci] to row[i+1] to zero [ri+1][ci].
|
// Operation: Add row[i] / -[ri][ci] to row[i+1] to zero [ri+1][ci].
|
||||||
const float diag_recip= 1.0f / diagonals[i];
|
const float diag_recip= 1.0f / diagonals[i];
|
||||||
@@ -115,7 +117,7 @@ void SplineSolutionCache::solve_diagonals_straight(std::vector<float>& diagonals
|
|||||||
multiples.push_back(diag_recip);
|
multiples.push_back(diag_recip);
|
||||||
}
|
}
|
||||||
// Stage two.
|
// Stage two.
|
||||||
for(size_t i= last-1; i > 0; --i)
|
for(std::size_t i= last-1; i > 0; --i)
|
||||||
{
|
{
|
||||||
// Operation: Add row [i] / -[ri][ci] to row[i-1] to zero [ri-1][ci].
|
// Operation: Add row [i] / -[ri][ci] to row[i-1] to zero [ri-1][ci].
|
||||||
multiples.push_back(1.0f / diagonals[i]);
|
multiples.push_back(1.0f / diagonals[i]);
|
||||||
@@ -160,7 +162,7 @@ void SplineSolutionCache::solve_diagonals_looped(std::vector<float>& diagonals,
|
|||||||
// | 0 0 0 c w | -> | 0 0 0 c w | -> | 0 0 0 c w | -> | 0 0 0 c 0 |
|
// | 0 0 0 c w | -> | 0 0 0 c w | -> | 0 0 0 c w | -> | 0 0 0 c 0 |
|
||||||
// | 0 0 0 0 f | -> | 0 0 0 0 f | -> | 0 0 0 0 f | -> | 0 0 0 0 f |
|
// | 0 0 0 0 f | -> | 0 0 0 0 f | -> | 0 0 0 0 f | -> | 0 0 0 0 f |
|
||||||
|
|
||||||
size_t last= diagonals.size();
|
std::size_t last= diagonals.size();
|
||||||
diagonals[0]= 4.0f;
|
diagonals[0]= 4.0f;
|
||||||
prep_inner(last, diagonals);
|
prep_inner(last, diagonals);
|
||||||
// right_column is sized to not store the diagonal .
|
// right_column is sized to not store the diagonal .
|
||||||
@@ -169,7 +171,7 @@ void SplineSolutionCache::solve_diagonals_looped(std::vector<float>& diagonals,
|
|||||||
right_column[last-2]= 1.0f;
|
right_column[last-2]= 1.0f;
|
||||||
|
|
||||||
// Stage one.
|
// Stage one.
|
||||||
for(size_t i= 0; i < last-2; ++i)
|
for(std::size_t i= 0; i < last-2; ++i)
|
||||||
{
|
{
|
||||||
// Operation: Add row[i] / -[ri][ci] to row[i+1] to zero [ri+1][ci].
|
// Operation: Add row[i] / -[ri][ci] to row[i+1] to zero [ri+1][ci].
|
||||||
const float diag_recip= 1.0f / diagonals[i];
|
const float diag_recip= 1.0f / diagonals[i];
|
||||||
@@ -185,7 +187,7 @@ void SplineSolutionCache::solve_diagonals_looped(std::vector<float>& diagonals,
|
|||||||
multiples.push_back(diag_recip);
|
multiples.push_back(diag_recip);
|
||||||
}
|
}
|
||||||
// Stage two.
|
// Stage two.
|
||||||
for(size_t i= last-2; i > 0; --i)
|
for(std::size_t i= last-2; i > 0; --i)
|
||||||
{
|
{
|
||||||
// Operation: Add row[i] / -[ri][ci] to row[i-1] to zero [ri-1][ci].
|
// Operation: Add row[i] / -[ri][ci] to row[i-1] to zero [ri-1][ci].
|
||||||
const float diag_recip= 1.0f / diagonals[i];
|
const float diag_recip= 1.0f / diagonals[i];
|
||||||
@@ -200,8 +202,8 @@ void SplineSolutionCache::solve_diagonals_looped(std::vector<float>& diagonals,
|
|||||||
multiples.push_back(diag_recip);
|
multiples.push_back(diag_recip);
|
||||||
}
|
}
|
||||||
// Stage three.
|
// Stage three.
|
||||||
const size_t end= last-1;
|
const std::size_t end= last-1;
|
||||||
for(size_t i= 0; i < end; ++i)
|
for(std::size_t i= 0; i < end; ++i)
|
||||||
{
|
{
|
||||||
// Operation: Add row[e] * (right_column[i] / [re][ce]) to row[i] to
|
// Operation: Add row[e] * (right_column[i] / [re][ce]) to row[i] to
|
||||||
// zero right_column[i].
|
// zero right_column[i].
|
||||||
@@ -251,7 +253,7 @@ float loop_space_difference(float a, float b, float spatial_extent)
|
|||||||
void CubicSpline::solve_looped()
|
void CubicSpline::solve_looped()
|
||||||
{
|
{
|
||||||
if(check_minimum_size()) { return; }
|
if(check_minimum_size()) { return; }
|
||||||
size_t last= m_points.size();
|
std::size_t last= m_points.size();
|
||||||
std::vector<float> results(m_points.size());
|
std::vector<float> results(m_points.size());
|
||||||
std::vector<float> diagonals(m_points.size());
|
std::vector<float> diagonals(m_points.size());
|
||||||
std::vector<float> multiples;
|
std::vector<float> multiples;
|
||||||
@@ -268,14 +270,14 @@ void CubicSpline::solve_looped()
|
|||||||
// SplineSolutionCache's Stage one loop ends at last-2 because it has to
|
// SplineSolutionCache's Stage one loop ends at last-2 because it has to
|
||||||
// handle right_column. This does not handle right_column, so the loop
|
// handle right_column. This does not handle right_column, so the loop
|
||||||
// goes to last-1.
|
// goes to last-1.
|
||||||
for(size_t i= 0; i < last-1; ++i)
|
for(std::size_t i= 0; i < last-1; ++i)
|
||||||
{
|
{
|
||||||
// Operation: Add row[i] * -multiples[i] to row[i+1].
|
// Operation: Add row[i] * -multiples[i] to row[i+1].
|
||||||
results[i+1]-= results[i] * multiples[i];
|
results[i+1]-= results[i] * multiples[i];
|
||||||
}
|
}
|
||||||
size_t next_mult= last-1;
|
std::size_t next_mult= last-1;
|
||||||
// Stage two.
|
// Stage two.
|
||||||
for(size_t i= last-2; i > 0; --i)
|
for(std::size_t i= last-2; i > 0; --i)
|
||||||
{
|
{
|
||||||
// Operation: Add row[i] * -multiples[nm] to row[i-1].
|
// Operation: Add row[i] * -multiples[nm] to row[i-1].
|
||||||
results[i-1]-= results[i] * multiples[next_mult];
|
results[i-1]-= results[i] * multiples[next_mult];
|
||||||
@@ -286,8 +288,8 @@ void CubicSpline::solve_looped()
|
|||||||
results[last-1]-= results[0] * multiples[next_mult];
|
results[last-1]-= results[0] * multiples[next_mult];
|
||||||
++next_mult;
|
++next_mult;
|
||||||
// Stage three.
|
// Stage three.
|
||||||
const size_t end= last-1;
|
const std::size_t end= last-1;
|
||||||
for(size_t i= 0; i < end; ++i)
|
for(std::size_t i= 0; i < end; ++i)
|
||||||
{
|
{
|
||||||
// Operation: Add row[e] * -multiples[nm] to row[i].
|
// Operation: Add row[e] * -multiples[nm] to row[i].
|
||||||
results[i]-= results[end] * multiples[next_mult];
|
results[i]-= results[end] * multiples[next_mult];
|
||||||
@@ -300,7 +302,7 @@ void CubicSpline::solve_looped()
|
|||||||
void CubicSpline::solve_straight()
|
void CubicSpline::solve_straight()
|
||||||
{
|
{
|
||||||
if(check_minimum_size()) { return; }
|
if(check_minimum_size()) { return; }
|
||||||
size_t last= m_points.size();
|
std::size_t last= m_points.size();
|
||||||
std::vector<float> results(m_points.size());
|
std::vector<float> results(m_points.size());
|
||||||
std::vector<float> diagonals(m_points.size());
|
std::vector<float> diagonals(m_points.size());
|
||||||
std::vector<float> multiples;
|
std::vector<float> multiples;
|
||||||
@@ -313,14 +315,14 @@ void CubicSpline::solve_straight()
|
|||||||
// Steps explained in detail in SplineSolutionCache.
|
// Steps explained in detail in SplineSolutionCache.
|
||||||
// Only the operations on the results column are performed here.
|
// Only the operations on the results column are performed here.
|
||||||
// Stage one.
|
// Stage one.
|
||||||
for(size_t i= 0; i < last-1; ++i)
|
for(std::size_t i= 0; i < last-1; ++i)
|
||||||
{
|
{
|
||||||
// Operation: Add row[i] * -multiples[i] to row[i+1].
|
// Operation: Add row[i] * -multiples[i] to row[i+1].
|
||||||
results[i+1]-= results[i] * multiples[i];
|
results[i+1]-= results[i] * multiples[i];
|
||||||
}
|
}
|
||||||
size_t next_mult= last-1;
|
std::size_t next_mult= last-1;
|
||||||
// Stage two.
|
// Stage two.
|
||||||
for(size_t i= last-1; i > 0; --i)
|
for(std::size_t i= last-1; i > 0; --i)
|
||||||
{
|
{
|
||||||
// Operation: Add row[i] * -multiples[nm] to row [i-1].
|
// Operation: Add row[i] * -multiples[nm] to row [i-1].
|
||||||
results[i-1]-= results[i] * multiples[next_mult];
|
results[i-1]-= results[i] * multiples[next_mult];
|
||||||
@@ -333,8 +335,8 @@ void CubicSpline::solve_straight()
|
|||||||
void CubicSpline::solve_polygonal()
|
void CubicSpline::solve_polygonal()
|
||||||
{
|
{
|
||||||
if(check_minimum_size()) { return; }
|
if(check_minimum_size()) { return; }
|
||||||
size_t last= m_points.size() - 1;
|
std::size_t last= m_points.size() - 1;
|
||||||
for(size_t i= 0; i < last; ++i)
|
for(std::size_t i= 0; i < last; ++i)
|
||||||
{
|
{
|
||||||
m_points[i].b= loop_space_difference(
|
m_points[i].b= loop_space_difference(
|
||||||
m_points[i+1].a, m_points[i].a, m_spatial_extent);
|
m_points[i+1].a, m_points[i].a, m_spatial_extent);
|
||||||
@@ -345,7 +347,7 @@ void CubicSpline::solve_polygonal()
|
|||||||
|
|
||||||
bool CubicSpline::check_minimum_size()
|
bool CubicSpline::check_minimum_size()
|
||||||
{
|
{
|
||||||
size_t last= m_points.size();
|
std::size_t last= m_points.size();
|
||||||
if(last < 2)
|
if(last < 2)
|
||||||
{
|
{
|
||||||
m_points[0].b= m_points[0].c= m_points[0].d= 0.0f;
|
m_points[0].b= m_points[0].c= m_points[0].d= 0.0f;
|
||||||
@@ -364,7 +366,7 @@ bool CubicSpline::check_minimum_size()
|
|||||||
}
|
}
|
||||||
float a= m_points[0].a;
|
float a= m_points[0].a;
|
||||||
bool all_points_identical= true;
|
bool all_points_identical= true;
|
||||||
for(size_t i= 0; i < m_points.size(); ++i)
|
for(std::size_t i= 0; i < m_points.size(); ++i)
|
||||||
{
|
{
|
||||||
m_points[i].b= m_points[i].c= m_points[i].d= 0.0f;
|
m_points[i].b= m_points[i].c= m_points[i].d= 0.0f;
|
||||||
if(m_points[i].a != a) { all_points_identical= false; }
|
if(m_points[i].a != a) { all_points_identical= false; }
|
||||||
@@ -372,27 +374,27 @@ bool CubicSpline::check_minimum_size()
|
|||||||
return all_points_identical;
|
return all_points_identical;
|
||||||
}
|
}
|
||||||
|
|
||||||
void CubicSpline::prep_inner(size_t last, std::vector<float>& results)
|
void CubicSpline::prep_inner(std::size_t last, std::vector<float>& results)
|
||||||
{
|
{
|
||||||
for(size_t i= 1; i < last - 1; ++i)
|
for(std::size_t i= 1; i < last - 1; ++i)
|
||||||
{
|
{
|
||||||
results[i]= 3 * loop_space_difference(
|
results[i]= 3 * loop_space_difference(
|
||||||
m_points[i+1].a, m_points[i-1].a, m_spatial_extent);
|
m_points[i+1].a, m_points[i-1].a, m_spatial_extent);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void CubicSpline::set_results(size_t last, std::vector<float>& diagonals, std::vector<float>& results)
|
void CubicSpline::set_results(std::size_t last, std::vector<float>& diagonals, std::vector<float>& results)
|
||||||
{
|
{
|
||||||
// No more operations left, everything not a diagonal should be zero now.
|
// No more operations left, everything not a diagonal should be zero now.
|
||||||
for(size_t i= 0; i < last; ++i)
|
for(std::size_t i= 0; i < last; ++i)
|
||||||
{
|
{
|
||||||
results[i]/= diagonals[i];
|
results[i]/= diagonals[i];
|
||||||
}
|
}
|
||||||
// Now we can go through and set the b, c, d values of each point.
|
// Now we can go through and set the b, c, d values of each point.
|
||||||
// b, c, d values of the last point are not set because they are unused.
|
// b, c, d values of the last point are not set because they are unused.
|
||||||
for(size_t i= 0; i < last; ++i)
|
for(std::size_t i= 0; i < last; ++i)
|
||||||
{
|
{
|
||||||
size_t next= (i+1) % last;
|
std::size_t next= (i+1) % last;
|
||||||
float diff= loop_space_difference(
|
float diff= loop_space_difference(
|
||||||
m_points[next].a, m_points[i].a, m_spatial_extent);
|
m_points[next].a, m_points[i].a, m_spatial_extent);
|
||||||
m_points[i].b= results[i];
|
m_points[i].b= results[i];
|
||||||
@@ -407,14 +409,14 @@ void CubicSpline::set_results(size_t last, std::vector<float>& diagonals, std::v
|
|||||||
// Solving is now complete.
|
// Solving is now complete.
|
||||||
}
|
}
|
||||||
|
|
||||||
void CubicSpline::p_and_tfrac_from_t(float t, bool loop, size_t& p, float& tfrac) const
|
void CubicSpline::p_and_tfrac_from_t(float t, bool loop, std::size_t& p, float& tfrac) const
|
||||||
{
|
{
|
||||||
if(loop)
|
if(loop)
|
||||||
{
|
{
|
||||||
float max_t= static_cast<float>(m_points.size());
|
float max_t= static_cast<float>(m_points.size());
|
||||||
t= std::fmod(t, max_t);
|
t= std::fmod(t, max_t);
|
||||||
if(t < 0.0f) { t+= max_t; }
|
if(t < 0.0f) { t+= max_t; }
|
||||||
p= static_cast<size_t>(t);
|
p= static_cast<std::size_t>(t);
|
||||||
tfrac= t - static_cast<float>(p);
|
tfrac= t - static_cast<float>(p);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
@@ -425,14 +427,14 @@ void CubicSpline::p_and_tfrac_from_t(float t, bool loop, size_t& p, float& tfrac
|
|||||||
p= 0;
|
p= 0;
|
||||||
tfrac= 0;
|
tfrac= 0;
|
||||||
}
|
}
|
||||||
else if(static_cast<size_t>(flort) >= m_points.size() - 1)
|
else if(static_cast<std::size_t>(flort) >= m_points.size() - 1)
|
||||||
{
|
{
|
||||||
p= m_points.size() - 1;
|
p= m_points.size() - 1;
|
||||||
tfrac= 0;
|
tfrac= 0;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
p= static_cast<size_t>(flort);
|
p= static_cast<std::size_t>(flort);
|
||||||
tfrac= t - static_cast<float>(p);
|
tfrac= t - static_cast<float>(p);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -440,7 +442,7 @@ void CubicSpline::p_and_tfrac_from_t(float t, bool loop, size_t& p, float& tfrac
|
|||||||
|
|
||||||
#define RETURN_IF_EMPTY if(m_points.empty()) { return 0.0f; }
|
#define RETURN_IF_EMPTY if(m_points.empty()) { return 0.0f; }
|
||||||
#define DECLARE_P_AND_TFRAC \
|
#define DECLARE_P_AND_TFRAC \
|
||||||
size_t p= 0; float tfrac= 0.0f; \
|
std::size_t p= 0; float tfrac= 0.0f; \
|
||||||
p_and_tfrac_from_t(t, loop, p, tfrac);
|
p_and_tfrac_from_t(t, loop, p, tfrac);
|
||||||
|
|
||||||
float CubicSpline::evaluate(float t, bool loop) const
|
float CubicSpline::evaluate(float t, bool loop) const
|
||||||
@@ -479,13 +481,13 @@ float CubicSpline::evaluate_third_derivative(float t, bool loop) const
|
|||||||
#undef RETURN_IF_EMPTY
|
#undef RETURN_IF_EMPTY
|
||||||
#undef DECLARE_P_AND_TFRAC
|
#undef DECLARE_P_AND_TFRAC
|
||||||
|
|
||||||
void CubicSpline::set_point(size_t i, float v)
|
void CubicSpline::set_point(std::size_t i, float v)
|
||||||
{
|
{
|
||||||
ASSERT_M(i < m_points.size(), "CubicSpline::set_point requires the index to be less than the number of points.");
|
ASSERT_M(i < m_points.size(), "CubicSpline::set_point requires the index to be less than the number of points.");
|
||||||
m_points[i].a= v;
|
m_points[i].a= v;
|
||||||
}
|
}
|
||||||
|
|
||||||
void CubicSpline::set_coefficients(size_t i, float b, float c, float d)
|
void CubicSpline::set_coefficients(std::size_t i, float b, float c, float d)
|
||||||
{
|
{
|
||||||
ASSERT_M(i < m_points.size(), "CubicSpline: point index must be less than the number of points.");
|
ASSERT_M(i < m_points.size(), "CubicSpline: point index must be less than the number of points.");
|
||||||
m_points[i].b= b;
|
m_points[i].b= b;
|
||||||
@@ -493,7 +495,7 @@ void CubicSpline::set_coefficients(size_t i, float b, float c, float d)
|
|||||||
m_points[i].d= d;
|
m_points[i].d= d;
|
||||||
}
|
}
|
||||||
|
|
||||||
void CubicSpline::get_coefficients(size_t i, float& b, float& c, float& d) const
|
void CubicSpline::get_coefficients(std::size_t i, float& b, float& c, float& d) const
|
||||||
{
|
{
|
||||||
ASSERT_M(i < m_points.size(), "CubicSpline: point index must be less than the number of points.");
|
ASSERT_M(i < m_points.size(), "CubicSpline: point index must be less than the number of points.");
|
||||||
b= m_points[i].b;
|
b= m_points[i].b;
|
||||||
@@ -501,26 +503,26 @@ void CubicSpline::get_coefficients(size_t i, float& b, float& c, float& d) const
|
|||||||
d= m_points[i].d;
|
d= m_points[i].d;
|
||||||
}
|
}
|
||||||
|
|
||||||
void CubicSpline::set_point_and_coefficients(size_t i, float a, float b,
|
void CubicSpline::set_point_and_coefficients(std::size_t i, float a, float b,
|
||||||
float c, float d)
|
float c, float d)
|
||||||
{
|
{
|
||||||
set_coefficients(i, b, c, d);
|
set_coefficients(i, b, c, d);
|
||||||
m_points[i].a= a;
|
m_points[i].a= a;
|
||||||
}
|
}
|
||||||
|
|
||||||
void CubicSpline::get_point_and_coefficients(size_t i, float& a, float& b,
|
void CubicSpline::get_point_and_coefficients(std::size_t i, float& a, float& b,
|
||||||
float& c, float& d) const
|
float& c, float& d) const
|
||||||
{
|
{
|
||||||
get_coefficients(i, b, c, d);
|
get_coefficients(i, b, c, d);
|
||||||
a= m_points[i].a;
|
a= m_points[i].a;
|
||||||
}
|
}
|
||||||
|
|
||||||
void CubicSpline::resize(size_t s)
|
void CubicSpline::resize(std::size_t s)
|
||||||
{
|
{
|
||||||
m_points.resize(s);
|
m_points.resize(s);
|
||||||
}
|
}
|
||||||
|
|
||||||
size_t CubicSpline::size() const
|
std::size_t CubicSpline::size() const
|
||||||
{
|
{
|
||||||
return m_points.size();
|
return m_points.size();
|
||||||
}
|
}
|
||||||
@@ -551,27 +553,27 @@ void CubicSplineN::weighted_average(CubicSplineN& out,
|
|||||||
// Behavior for splines of different sizes: Use a size between the two.
|
// Behavior for splines of different sizes: Use a size between the two.
|
||||||
// Points that exist in both will be averaged.
|
// Points that exist in both will be averaged.
|
||||||
// Points that only exist in one will come only from that one.
|
// Points that only exist in one will come only from that one.
|
||||||
const size_t from_size= from.size();
|
const std::size_t from_size= from.size();
|
||||||
const size_t to_size= to.size();
|
const std::size_t to_size= to.size();
|
||||||
size_t out_size= to_size;
|
std::size_t out_size= to_size;
|
||||||
size_t limit= to_size;
|
std::size_t limit= to_size;
|
||||||
if(from_size < to_size)
|
if(from_size < to_size)
|
||||||
{
|
{
|
||||||
out_size= from_size + static_cast<size_t>(
|
out_size= from_size + static_cast<std::size_t>(
|
||||||
static_cast<float>(to_size - from_size) * between);
|
static_cast<float>(to_size - from_size) * between);
|
||||||
}
|
}
|
||||||
else if(to_size < from_size)
|
else if(to_size < from_size)
|
||||||
{
|
{
|
||||||
limit= from_size;
|
limit= from_size;
|
||||||
out_size= to_size + static_cast<size_t>(
|
out_size= to_size + static_cast<std::size_t>(
|
||||||
static_cast<float>(from_size - to_size) * between);
|
static_cast<float>(from_size - to_size) * between);
|
||||||
}
|
}
|
||||||
CLAMP(out_size, 0, limit);
|
CLAMP(out_size, 0, limit);
|
||||||
out.resize(out_size);
|
out.resize(out_size);
|
||||||
|
|
||||||
for(size_t spli= 0; spli < out.m_splines.size(); ++spli)
|
for(std::size_t spli= 0; spli < out.m_splines.size(); ++spli)
|
||||||
{
|
{
|
||||||
for(size_t p= 0; p < out_size; ++p)
|
for(std::size_t p= 0; p < out_size; ++p)
|
||||||
{
|
{
|
||||||
float fc[4]= {0.0f, 0.0f, 0.0f, 0.0f};
|
float fc[4]= {0.0f, 0.0f, 0.0f, 0.0f};
|
||||||
float tc[4]= {0.0f, 0.0f, 0.0f, 0.0f};
|
float tc[4]= {0.0f, 0.0f, 0.0f, 0.0f};
|
||||||
@@ -679,42 +681,42 @@ CSN_EVAL_RV_SOMETHING(evaluate_derivative);
|
|||||||
|
|
||||||
#undef CSN_EVAL_RV_SOMETHING
|
#undef CSN_EVAL_RV_SOMETHING
|
||||||
|
|
||||||
void CubicSplineN::set_point(size_t i, const std::vector<float>& v)
|
void CubicSplineN::set_point(std::size_t i, const std::vector<float>& v)
|
||||||
{
|
{
|
||||||
ASSERT_M(v.size() == m_splines.size(), "CubicSplineN::set_point requires the passed point to be the same dimension as the spline.");
|
ASSERT_M(v.size() == m_splines.size(), "CubicSplineN::set_point requires the passed point to be the same dimension as the spline.");
|
||||||
for(size_t n= 0; n < m_splines.size(); ++n)
|
for(std::size_t n= 0; n < m_splines.size(); ++n)
|
||||||
{
|
{
|
||||||
m_splines[n].set_point(i, v[n]);
|
m_splines[n].set_point(i, v[n]);
|
||||||
}
|
}
|
||||||
m_dirty= true;
|
m_dirty= true;
|
||||||
}
|
}
|
||||||
|
|
||||||
void CubicSplineN::set_coefficients(size_t i, const std::vector<float>& b,
|
void CubicSplineN::set_coefficients(std::size_t i, const std::vector<float>& b,
|
||||||
const std::vector<float>& c, const std::vector<float>& d)
|
const std::vector<float>& c, const std::vector<float>& d)
|
||||||
{
|
{
|
||||||
ASSERT_M(b.size() == c.size() && c.size() == d.size() &&
|
ASSERT_M(b.size() == c.size() && c.size() == d.size() &&
|
||||||
d.size() == m_splines.size(), "CubicSplineN: coefficient vectors must be "
|
d.size() == m_splines.size(), "CubicSplineN: coefficient vectors must be "
|
||||||
"the same dimension as the spline.");
|
"the same dimension as the spline.");
|
||||||
for(size_t n= 0; n < m_splines.size(); ++n)
|
for(std::size_t n= 0; n < m_splines.size(); ++n)
|
||||||
{
|
{
|
||||||
m_splines[n].set_coefficients(i, b[n], c[n], d[n]);
|
m_splines[n].set_coefficients(i, b[n], c[n], d[n]);
|
||||||
}
|
}
|
||||||
m_dirty= true;
|
m_dirty= true;
|
||||||
}
|
}
|
||||||
|
|
||||||
void CubicSplineN::get_coefficients(size_t i, std::vector<float>& b,
|
void CubicSplineN::get_coefficients(std::size_t i, std::vector<float>& b,
|
||||||
std::vector<float>& c, std::vector<float>& d)
|
std::vector<float>& c, std::vector<float>& d)
|
||||||
{
|
{
|
||||||
ASSERT_M(b.size() == c.size() && c.size() == d.size() &&
|
ASSERT_M(b.size() == c.size() && c.size() == d.size() &&
|
||||||
d.size() == m_splines.size(), "CubicSplineN: coefficient vectors must be "
|
d.size() == m_splines.size(), "CubicSplineN: coefficient vectors must be "
|
||||||
"the same dimension as the spline.");
|
"the same dimension as the spline.");
|
||||||
for(size_t n= 0; n < m_splines.size(); ++n)
|
for(std::size_t n= 0; n < m_splines.size(); ++n)
|
||||||
{
|
{
|
||||||
m_splines[n].get_coefficients(i, b[n], c[n], d[n]);
|
m_splines[n].get_coefficients(i, b[n], c[n], d[n]);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void CubicSplineN::set_spatial_extent(size_t i, float extent)
|
void CubicSplineN::set_spatial_extent(std::size_t i, float extent)
|
||||||
{
|
{
|
||||||
ASSERT_M(i < m_splines.size(), "CubicSplineN: index of spline to set extent"
|
ASSERT_M(i < m_splines.size(), "CubicSplineN: index of spline to set extent"
|
||||||
" of is out of range.");
|
" of is out of range.");
|
||||||
@@ -722,14 +724,14 @@ void CubicSplineN::set_spatial_extent(size_t i, float extent)
|
|||||||
m_dirty= true;
|
m_dirty= true;
|
||||||
}
|
}
|
||||||
|
|
||||||
float CubicSplineN::get_spatial_extent(size_t i)
|
float CubicSplineN::get_spatial_extent(std::size_t i)
|
||||||
{
|
{
|
||||||
ASSERT_M(i < m_splines.size(), "CubicSplineN: index of spline to get extent"
|
ASSERT_M(i < m_splines.size(), "CubicSplineN: index of spline to get extent"
|
||||||
" of is out of range.");
|
" of is out of range.");
|
||||||
return m_splines[i].m_spatial_extent;
|
return m_splines[i].m_spatial_extent;
|
||||||
}
|
}
|
||||||
|
|
||||||
void CubicSplineN::resize(size_t s)
|
void CubicSplineN::resize(std::size_t s)
|
||||||
{
|
{
|
||||||
for(spline_cont_t::iterator spline= m_splines.begin();
|
for(spline_cont_t::iterator spline= m_splines.begin();
|
||||||
spline != m_splines.end(); ++spline)
|
spline != m_splines.end(); ++spline)
|
||||||
@@ -739,7 +741,7 @@ void CubicSplineN::resize(size_t s)
|
|||||||
m_dirty= true;
|
m_dirty= true;
|
||||||
}
|
}
|
||||||
|
|
||||||
size_t CubicSplineN::size() const
|
std::size_t CubicSplineN::size() const
|
||||||
{
|
{
|
||||||
if(!m_splines.empty())
|
if(!m_splines.empty())
|
||||||
{
|
{
|
||||||
@@ -753,13 +755,13 @@ bool CubicSplineN::empty() const
|
|||||||
return m_splines.empty() || m_splines[0].empty();
|
return m_splines.empty() || m_splines[0].empty();
|
||||||
}
|
}
|
||||||
|
|
||||||
void CubicSplineN::redimension(size_t d)
|
void CubicSplineN::redimension(std::size_t d)
|
||||||
{
|
{
|
||||||
m_splines.resize(d);
|
m_splines.resize(d);
|
||||||
m_dirty= true;
|
m_dirty= true;
|
||||||
}
|
}
|
||||||
|
|
||||||
size_t CubicSplineN::dimension() const
|
std::size_t CubicSplineN::dimension() const
|
||||||
{
|
{
|
||||||
return m_splines.size();
|
return m_splines.size();
|
||||||
}
|
}
|
||||||
@@ -787,18 +789,18 @@ SET_GET_MEM(m_dirty, dirty);
|
|||||||
|
|
||||||
struct LunaCubicSplineN : Luna<CubicSplineN>
|
struct LunaCubicSplineN : Luna<CubicSplineN>
|
||||||
{
|
{
|
||||||
static size_t dimension_index(T* p, lua_State* L, int s)
|
static std::size_t dimension_index(T* p, lua_State* L, int s)
|
||||||
{
|
{
|
||||||
size_t i= static_cast<size_t>(IArg(s)-1);
|
std::size_t i= static_cast<std::size_t>(IArg(s)-1);
|
||||||
if(i >= p->dimension())
|
if(i >= p->dimension())
|
||||||
{
|
{
|
||||||
luaL_error(L, "Spline dimension index out of range.");
|
luaL_error(L, "Spline dimension index out of range.");
|
||||||
}
|
}
|
||||||
return i;
|
return i;
|
||||||
}
|
}
|
||||||
static size_t point_index(T* p, lua_State* L, int s)
|
static std::size_t point_index(T* p, lua_State* L, int s)
|
||||||
{
|
{
|
||||||
size_t i= static_cast<size_t>(IArg(s)-1);
|
std::size_t i= static_cast<std::size_t>(IArg(s)-1);
|
||||||
if(i >= p->size())
|
if(i >= p->size())
|
||||||
{
|
{
|
||||||
luaL_error(L, "Spline point index out of range.");
|
luaL_error(L, "Spline point index out of range.");
|
||||||
@@ -816,7 +818,7 @@ struct LunaCubicSplineN : Luna<CubicSplineN>
|
|||||||
std::vector<float> pos; \
|
std::vector<float> pos; \
|
||||||
p->something(FArg(1), pos); \
|
p->something(FArg(1), pos); \
|
||||||
lua_createtable(L, pos.size(), 0); \
|
lua_createtable(L, pos.size(), 0); \
|
||||||
for(size_t i= 0; i < pos.size(); ++i) \
|
for(std::size_t i= 0; i < pos.size(); ++i) \
|
||||||
{ \
|
{ \
|
||||||
lua_pushnumber(L, pos[i]); \
|
lua_pushnumber(L, pos[i]); \
|
||||||
lua_rawseti(L, -2, i+1); \
|
lua_rawseti(L, -2, i+1); \
|
||||||
@@ -830,13 +832,13 @@ struct LunaCubicSplineN : Luna<CubicSplineN>
|
|||||||
#undef LCSN_EVAL_SOMETHING
|
#undef LCSN_EVAL_SOMETHING
|
||||||
|
|
||||||
static void get_element_table_from_stack(T* p, lua_State* L, int s,
|
static void get_element_table_from_stack(T* p, lua_State* L, int s,
|
||||||
size_t limit, std::vector<float>& ret)
|
std::size_t limit, std::vector<float>& ret)
|
||||||
{
|
{
|
||||||
size_t elements= lua_objlen(L, s);
|
std::size_t elements= lua_objlen(L, s);
|
||||||
// Too many elements is not an error because allowing it allows the user
|
// Too many elements is not an error because allowing it allows the user
|
||||||
// to reuse the same position data set after changing the dimension size.
|
// to reuse the same position data set after changing the dimension size.
|
||||||
// The same is true for too few elements.
|
// The same is true for too few elements.
|
||||||
for(size_t e= 0; e < elements; ++e)
|
for(std::size_t e= 0; e < elements; ++e)
|
||||||
{
|
{
|
||||||
lua_rawgeti(L, s, e+1);
|
lua_rawgeti(L, s, e+1);
|
||||||
ret.push_back(FArg(-1));
|
ret.push_back(FArg(-1));
|
||||||
@@ -847,7 +849,7 @@ struct LunaCubicSplineN : Luna<CubicSplineN>
|
|||||||
}
|
}
|
||||||
ret.resize(limit);
|
ret.resize(limit);
|
||||||
}
|
}
|
||||||
static void set_point_from_stack(T* p, lua_State* L, size_t i, int s)
|
static void set_point_from_stack(T* p, lua_State* L, std::size_t i, int s)
|
||||||
{
|
{
|
||||||
if(!lua_istable(L, s))
|
if(!lua_istable(L, s))
|
||||||
{
|
{
|
||||||
@@ -859,17 +861,17 @@ struct LunaCubicSplineN : Luna<CubicSplineN>
|
|||||||
}
|
}
|
||||||
static int set_point(T* p, lua_State* L)
|
static int set_point(T* p, lua_State* L)
|
||||||
{
|
{
|
||||||
size_t i= point_index(p, L, 1);
|
std::size_t i= point_index(p, L, 1);
|
||||||
set_point_from_stack(p, L, i, 2);
|
set_point_from_stack(p, L, i, 2);
|
||||||
COMMON_RETURN_SELF;
|
COMMON_RETURN_SELF;
|
||||||
}
|
}
|
||||||
static void set_coefficients_from_stack(T* p, lua_State* L, size_t i, int s)
|
static void set_coefficients_from_stack(T* p, lua_State* L, std::size_t i, int s)
|
||||||
{
|
{
|
||||||
if(!lua_istable(L, s) || !lua_istable(L, s+1) || !lua_istable(L, s+2))
|
if(!lua_istable(L, s) || !lua_istable(L, s+1) || !lua_istable(L, s+2))
|
||||||
{
|
{
|
||||||
luaL_error(L, "Spline coefficient args must be three tables.");
|
luaL_error(L, "Spline coefficient args must be three tables.");
|
||||||
}
|
}
|
||||||
size_t limit= p->dimension();
|
std::size_t limit= p->dimension();
|
||||||
std::vector<float> b; get_element_table_from_stack(p, L, s, limit, b);
|
std::vector<float> b; get_element_table_from_stack(p, L, s, limit, b);
|
||||||
std::vector<float> c; get_element_table_from_stack(p, L, s+1, limit, c);
|
std::vector<float> c; get_element_table_from_stack(p, L, s+1, limit, c);
|
||||||
std::vector<float> d; get_element_table_from_stack(p, L, s+2, limit, d);
|
std::vector<float> d; get_element_table_from_stack(p, L, s+2, limit, d);
|
||||||
@@ -877,24 +879,24 @@ struct LunaCubicSplineN : Luna<CubicSplineN>
|
|||||||
}
|
}
|
||||||
static int set_coefficients(T* p, lua_State* L)
|
static int set_coefficients(T* p, lua_State* L)
|
||||||
{
|
{
|
||||||
size_t i= point_index(p, L, 1);
|
std::size_t i= point_index(p, L, 1);
|
||||||
set_coefficients_from_stack(p, L, i, 2);
|
set_coefficients_from_stack(p, L, i, 2);
|
||||||
COMMON_RETURN_SELF;
|
COMMON_RETURN_SELF;
|
||||||
}
|
}
|
||||||
static int get_coefficients(T* p, lua_State* L)
|
static int get_coefficients(T* p, lua_State* L)
|
||||||
{
|
{
|
||||||
size_t i= point_index(p, L, 1);
|
std::size_t i= point_index(p, L, 1);
|
||||||
size_t limit= p->dimension();
|
std::size_t limit= p->dimension();
|
||||||
std::vector<std::vector<float> > coeff(3);
|
std::vector<std::vector<float> > coeff(3);
|
||||||
coeff[0].resize(limit);
|
coeff[0].resize(limit);
|
||||||
coeff[1].resize(limit);
|
coeff[1].resize(limit);
|
||||||
coeff[2].resize(limit);
|
coeff[2].resize(limit);
|
||||||
p->get_coefficients(i, coeff[0], coeff[1], coeff[2]);
|
p->get_coefficients(i, coeff[0], coeff[1], coeff[2]);
|
||||||
lua_createtable(L, 3, 0);
|
lua_createtable(L, 3, 0);
|
||||||
for(size_t co= 0; co < coeff.size(); ++co)
|
for(std::size_t co= 0; co < coeff.size(); ++co)
|
||||||
{
|
{
|
||||||
lua_createtable(L, limit, 0);
|
lua_createtable(L, limit, 0);
|
||||||
for(size_t v= 0; v < limit; ++v)
|
for(std::size_t v= 0; v < limit; ++v)
|
||||||
{
|
{
|
||||||
lua_pushnumber(L, coeff[co][v]);
|
lua_pushnumber(L, coeff[co][v]);
|
||||||
lua_rawseti(L, -2, v+1);
|
lua_rawseti(L, -2, v+1);
|
||||||
@@ -905,13 +907,13 @@ struct LunaCubicSplineN : Luna<CubicSplineN>
|
|||||||
}
|
}
|
||||||
static int set_spatial_extent(T* p, lua_State* L)
|
static int set_spatial_extent(T* p, lua_State* L)
|
||||||
{
|
{
|
||||||
size_t i= dimension_index(p, L, 1);
|
std::size_t i= dimension_index(p, L, 1);
|
||||||
p->set_spatial_extent(i, FArg(2));
|
p->set_spatial_extent(i, FArg(2));
|
||||||
COMMON_RETURN_SELF;
|
COMMON_RETURN_SELF;
|
||||||
}
|
}
|
||||||
static int get_spatial_extent(T* p, lua_State* L)
|
static int get_spatial_extent(T* p, lua_State* L)
|
||||||
{
|
{
|
||||||
size_t i= dimension_index(p, L, 1);
|
std::size_t i= dimension_index(p, L, 1);
|
||||||
lua_pushnumber(L, p->get_spatial_extent(i));
|
lua_pushnumber(L, p->get_spatial_extent(i));
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
@@ -927,7 +929,7 @@ struct LunaCubicSplineN : Luna<CubicSplineN>
|
|||||||
{
|
{
|
||||||
luaL_error(L, "A spline cannot have less than 0 points.");
|
luaL_error(L, "A spline cannot have less than 0 points.");
|
||||||
}
|
}
|
||||||
p->resize(static_cast<size_t>(siz));
|
p->resize(static_cast<std::size_t>(siz));
|
||||||
COMMON_RETURN_SELF;
|
COMMON_RETURN_SELF;
|
||||||
}
|
}
|
||||||
static int get_size(T* p, lua_State* L)
|
static int get_size(T* p, lua_State* L)
|
||||||
@@ -947,7 +949,7 @@ struct LunaCubicSplineN : Luna<CubicSplineN>
|
|||||||
{
|
{
|
||||||
luaL_error(L, "A spline cannot have less than 0 dimensions.");
|
luaL_error(L, "A spline cannot have less than 0 dimensions.");
|
||||||
}
|
}
|
||||||
p->redimension(static_cast<size_t>(dim));
|
p->redimension(static_cast<std::size_t>(dim));
|
||||||
COMMON_RETURN_SELF;
|
COMMON_RETURN_SELF;
|
||||||
}
|
}
|
||||||
static int get_dimension(T* p, lua_State* L)
|
static int get_dimension(T* p, lua_State* L)
|
||||||
|
|||||||
+23
-20
@@ -1,8 +1,11 @@
|
|||||||
#ifndef CUBIC_SPLINE_H
|
#ifndef CUBIC_SPLINE_H
|
||||||
#define CUBIC_SPLINE_H
|
#define CUBIC_SPLINE_H
|
||||||
|
|
||||||
#include <vector>
|
|
||||||
#include "RageTypes.h"
|
#include "RageTypes.h"
|
||||||
|
|
||||||
|
#include <cstddef>
|
||||||
|
#include <vector>
|
||||||
|
|
||||||
struct lua_State;
|
struct lua_State;
|
||||||
|
|
||||||
struct CubicSpline
|
struct CubicSpline
|
||||||
@@ -11,24 +14,24 @@ CubicSpline() :m_spatial_extent(0.0f) {}
|
|||||||
void solve_looped();
|
void solve_looped();
|
||||||
void solve_straight();
|
void solve_straight();
|
||||||
void solve_polygonal();
|
void solve_polygonal();
|
||||||
void p_and_tfrac_from_t(float t, bool loop, size_t& p, float& tfrac) const;
|
void p_and_tfrac_from_t(float t, bool loop, std::size_t& p, float& tfrac) const;
|
||||||
float evaluate(float t, bool loop) const;
|
float evaluate(float t, bool loop) const;
|
||||||
float evaluate_derivative(float t, bool loop) const;
|
float evaluate_derivative(float t, bool loop) const;
|
||||||
float evaluate_second_derivative(float t, bool loop) const;
|
float evaluate_second_derivative(float t, bool loop) const;
|
||||||
float evaluate_third_derivative(float t, bool loop) const;
|
float evaluate_third_derivative(float t, bool loop) const;
|
||||||
void set_point(size_t i, float v);
|
void set_point(std::size_t i, float v);
|
||||||
void set_coefficients(size_t i, float b, float c, float d);
|
void set_coefficients(std::size_t i, float b, float c, float d);
|
||||||
void get_coefficients(size_t i, float& b, float& c, float& d) const;
|
void get_coefficients(std::size_t i, float& b, float& c, float& d) const;
|
||||||
void set_point_and_coefficients(size_t i, float a, float b, float c, float d);
|
void set_point_and_coefficients(std::size_t i, float a, float b, float c, float d);
|
||||||
void get_point_and_coefficients(size_t i, float& a, float& b, float& c, float& d) const;
|
void get_point_and_coefficients(std::size_t i, float& a, float& b, float& c, float& d) const;
|
||||||
void resize(size_t s);
|
void resize(std::size_t s);
|
||||||
size_t size() const;
|
std::size_t size() const;
|
||||||
bool empty() const;
|
bool empty() const;
|
||||||
float m_spatial_extent;
|
float m_spatial_extent;
|
||||||
private:
|
private:
|
||||||
bool check_minimum_size();
|
bool check_minimum_size();
|
||||||
void prep_inner(size_t last, std::vector<float>& results);
|
void prep_inner(std::size_t last, std::vector<float>& results);
|
||||||
void set_results(size_t last, std::vector<float>& diagonals, std::vector<float>& results);
|
void set_results(std::size_t last, std::vector<float>& diagonals, std::vector<float>& results);
|
||||||
|
|
||||||
struct SplinePoint
|
struct SplinePoint
|
||||||
{
|
{
|
||||||
@@ -51,17 +54,17 @@ struct CubicSplineN
|
|||||||
void evaluate_third_derivative(float t, std::vector<float>& v) const;
|
void evaluate_third_derivative(float t, std::vector<float>& v) const;
|
||||||
void evaluate(float t, RageVector3& v) const;
|
void evaluate(float t, RageVector3& v) const;
|
||||||
void evaluate_derivative(float t, RageVector3& v) const;
|
void evaluate_derivative(float t, RageVector3& v) const;
|
||||||
void set_point(size_t i, const std::vector<float>& v);
|
void set_point(std::size_t i, const std::vector<float>& v);
|
||||||
void set_coefficients(size_t i, const std::vector<float>& b,
|
void set_coefficients(std::size_t i, const std::vector<float>& b,
|
||||||
const std::vector<float>& c, const std::vector<float>& d);
|
const std::vector<float>& c, const std::vector<float>& d);
|
||||||
void get_coefficients(size_t i, std::vector<float>& b,
|
void get_coefficients(std::size_t i, std::vector<float>& b,
|
||||||
std::vector<float>& c, std::vector<float>& d);
|
std::vector<float>& c, std::vector<float>& d);
|
||||||
void set_spatial_extent(size_t i, float extent);
|
void set_spatial_extent(std::size_t i, float extent);
|
||||||
float get_spatial_extent(size_t i);
|
float get_spatial_extent(std::size_t i);
|
||||||
void resize(size_t s);
|
void resize(std::size_t s);
|
||||||
size_t size() const;
|
std::size_t size() const;
|
||||||
void redimension(size_t d);
|
void redimension(std::size_t d);
|
||||||
size_t dimension() const;
|
std::size_t dimension() const;
|
||||||
bool empty() const;
|
bool empty() const;
|
||||||
float get_max_t() const {
|
float get_max_t() const {
|
||||||
if(m_loop) { return static_cast<float>(size()); }
|
if(m_loop) { return static_cast<float>(size()); }
|
||||||
|
|||||||
@@ -7,10 +7,11 @@
|
|||||||
#include "StepsDisplay.h"
|
#include "StepsDisplay.h"
|
||||||
#include "StepsUtil.h"
|
#include "StepsUtil.h"
|
||||||
#include "CommonMetrics.h"
|
#include "CommonMetrics.h"
|
||||||
|
|
||||||
#include "SongUtil.h"
|
#include "SongUtil.h"
|
||||||
#include "XmlFile.h"
|
#include "XmlFile.h"
|
||||||
|
|
||||||
|
#include <cstddef>
|
||||||
|
|
||||||
/** @brief Specifies the max number of charts available for a song.
|
/** @brief Specifies the max number of charts available for a song.
|
||||||
*
|
*
|
||||||
* This includes autogenned charts. */
|
* This includes autogenned charts. */
|
||||||
@@ -213,13 +214,13 @@ void StepsDisplayList::UpdatePositions()
|
|||||||
|
|
||||||
void StepsDisplayList::PositionItems()
|
void StepsDisplayList::PositionItems()
|
||||||
{
|
{
|
||||||
for( size_t i = 0; i < MAX_METERS; ++i )
|
for( std::size_t i = 0; i < MAX_METERS; ++i )
|
||||||
{
|
{
|
||||||
bool bUnused = ( i >= m_Rows.size() );
|
bool bUnused = ( i >= m_Rows.size() );
|
||||||
m_Lines[i].m_Meter.SetVisible( !bUnused );
|
m_Lines[i].m_Meter.SetVisible( !bUnused );
|
||||||
}
|
}
|
||||||
|
|
||||||
for( size_t m = 0; m < m_Rows.size(); ++m )
|
for( std::size_t m = 0; m < m_Rows.size(); ++m )
|
||||||
{
|
{
|
||||||
Row &row = m_Rows[m];
|
Row &row = m_Rows[m];
|
||||||
bool bHidden = row.m_bHidden;
|
bool bHidden = row.m_bHidden;
|
||||||
@@ -237,7 +238,7 @@ void StepsDisplayList::PositionItems()
|
|||||||
m_Lines[m].m_Meter.SetY( row.m_fY );
|
m_Lines[m].m_Meter.SetY( row.m_fY );
|
||||||
}
|
}
|
||||||
|
|
||||||
for( size_t m=0; m < MAX_METERS; ++m )
|
for( std::size_t m=0; m < MAX_METERS; ++m )
|
||||||
{
|
{
|
||||||
bool bHidden = true;
|
bool bHidden = true;
|
||||||
if( m_bShown && m < m_Rows.size() )
|
if( m_bShown && m < m_Rows.size() )
|
||||||
@@ -303,7 +304,7 @@ void StepsDisplayList::SetFromGameState()
|
|||||||
UpdatePositions();
|
UpdatePositions();
|
||||||
PositionItems();
|
PositionItems();
|
||||||
|
|
||||||
for( size_t m = 0; m < MAX_METERS; ++m )
|
for( std::size_t m = 0; m < MAX_METERS; ++m )
|
||||||
m_Lines[m].m_Meter.FinishTweening();
|
m_Lines[m].m_Meter.FinishTweening();
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -323,7 +324,7 @@ void StepsDisplayList::TweenOnScreen()
|
|||||||
FOREACH_HumanPlayer( pn )
|
FOREACH_HumanPlayer( pn )
|
||||||
ON_COMMAND( m_Cursors[pn] );
|
ON_COMMAND( m_Cursors[pn] );
|
||||||
|
|
||||||
for( size_t m = 0; m < MAX_METERS; ++m )
|
for( std::size_t m = 0; m < MAX_METERS; ++m )
|
||||||
ON_COMMAND( m_Lines[m].m_Meter );
|
ON_COMMAND( m_Lines[m].m_Meter );
|
||||||
|
|
||||||
this->SetHibernate( 0.5f );
|
this->SetHibernate( 0.5f );
|
||||||
|
|||||||
@@ -8,6 +8,7 @@
|
|||||||
#include "LuaBinding.h"
|
#include "LuaBinding.h"
|
||||||
|
|
||||||
#include <cmath>
|
#include <cmath>
|
||||||
|
#include <cstddef>
|
||||||
|
|
||||||
DynamicActorScroller *DynamicActorScroller::Copy() const { return new DynamicActorScroller(*this); }
|
DynamicActorScroller *DynamicActorScroller::Copy() const { return new DynamicActorScroller(*this); }
|
||||||
|
|
||||||
@@ -23,7 +24,7 @@ void DynamicActorScroller::LoadFromNode( const XNode *pNode )
|
|||||||
{
|
{
|
||||||
LuaHelpers::ReportScriptErrorFmt("%s: DynamicActorScroller: loaded %i nodes; require exactly one", ActorUtil::GetWhere(pNode).c_str(), (int)m_SubActors.size());
|
LuaHelpers::ReportScriptErrorFmt("%s: DynamicActorScroller: loaded %i nodes; require exactly one", ActorUtil::GetWhere(pNode).c_str(), (int)m_SubActors.size());
|
||||||
// Remove all but one.
|
// Remove all but one.
|
||||||
for( size_t i=1; i<m_SubActors.size(); i++ )
|
for( std::size_t i=1; i<m_SubActors.size(); i++ )
|
||||||
{
|
{
|
||||||
delete m_SubActors[i];
|
delete m_SubActors[i];
|
||||||
}
|
}
|
||||||
|
|||||||
+4
-3
@@ -8,12 +8,13 @@
|
|||||||
#include "Steps.h"
|
#include "Steps.h"
|
||||||
#include "Song.h"
|
#include "Song.h"
|
||||||
#include "StepsUtil.h"
|
#include "StepsUtil.h"
|
||||||
|
|
||||||
#include "CommonMetrics.h"
|
#include "CommonMetrics.h"
|
||||||
#include "ImageCache.h"
|
#include "ImageCache.h"
|
||||||
#include "UnlockManager.h"
|
#include "UnlockManager.h"
|
||||||
#include "SongUtil.h"
|
#include "SongUtil.h"
|
||||||
|
|
||||||
|
#include <cstddef>
|
||||||
|
|
||||||
static const char *EditMenuRowNames[] = {
|
static const char *EditMenuRowNames[] = {
|
||||||
"Group",
|
"Group",
|
||||||
"Song",
|
"Song",
|
||||||
@@ -37,8 +38,8 @@ XToString( EditMenuAction );
|
|||||||
XToLocalizedString( EditMenuAction );
|
XToLocalizedString( EditMenuAction );
|
||||||
StringToX( EditMenuAction );
|
StringToX( EditMenuAction );
|
||||||
|
|
||||||
static RString ARROWS_X_NAME( size_t i ) { return ssprintf("Arrows%dX",int(i+1)); }
|
static RString ARROWS_X_NAME( std::size_t i ) { return ssprintf("Arrows%dX",int(i+1)); }
|
||||||
static RString ROW_Y_NAME( size_t i ) { return ssprintf("Row%dY",int(i+1)); }
|
static RString ROW_Y_NAME( std::size_t i ) { return ssprintf("Row%dY",int(i+1)); }
|
||||||
|
|
||||||
void EditMenu::StripLockedStepsAndDifficulty( std::vector<StepsAndDifficulty> &v )
|
void EditMenu::StripLockedStepsAndDifficulty( std::vector<StepsAndDifficulty> &v )
|
||||||
{
|
{
|
||||||
|
|||||||
+5
-4
@@ -12,6 +12,7 @@
|
|||||||
#include "arch/Dialog/Dialog.h"
|
#include "arch/Dialog/Dialog.h"
|
||||||
|
|
||||||
#include <cmath>
|
#include <cmath>
|
||||||
|
#include <cstddef>
|
||||||
|
|
||||||
FontPage::FontPage(): m_iHeight(0), m_iLineSpacing(0), m_fVshift(0),
|
FontPage::FontPage(): m_iHeight(0), m_iLineSpacing(0), m_fVshift(0),
|
||||||
m_iDrawExtraPixelsLeft(0), m_iDrawExtraPixelsRight(0),
|
m_iDrawExtraPixelsLeft(0), m_iDrawExtraPixelsRight(0),
|
||||||
@@ -256,7 +257,7 @@ int Font::GetLineHeightInSourcePixels( const std::wstring &szLine ) const
|
|||||||
}
|
}
|
||||||
|
|
||||||
// width is a pointer so that we can return the used width through it.
|
// width is a pointer so that we can return the used width through it.
|
||||||
size_t Font::GetGlyphsThatFit(const std::wstring& line, int* width) const
|
std::size_t Font::GetGlyphsThatFit(const std::wstring& line, int* width) const
|
||||||
{
|
{
|
||||||
if(*width == 0)
|
if(*width == 0)
|
||||||
{
|
{
|
||||||
@@ -264,7 +265,7 @@ size_t Font::GetGlyphsThatFit(const std::wstring& line, int* width) const
|
|||||||
return line.size();
|
return line.size();
|
||||||
}
|
}
|
||||||
int curr_width= 0;
|
int curr_width= 0;
|
||||||
size_t i= 0;
|
std::size_t i= 0;
|
||||||
for(i= 0; i < line.size() && curr_width < *width; ++i)
|
for(i= 0; i < line.size() && curr_width < *width; ++i)
|
||||||
{
|
{
|
||||||
curr_width+= GetGlyph(line[i]).m_iHadvance;
|
curr_width+= GetGlyph(line[i]).m_iHadvance;
|
||||||
@@ -430,11 +431,11 @@ void Font::GetFontPaths( const RString &sFontIniPath, std::vector<RString> &asTe
|
|||||||
|
|
||||||
RString Font::GetPageNameFromFileName( const RString &sFilename )
|
RString Font::GetPageNameFromFileName( const RString &sFilename )
|
||||||
{
|
{
|
||||||
size_t begin = sFilename.find_first_of( '[' );
|
std::size_t begin = sFilename.find_first_of( '[' );
|
||||||
if( begin == std::string::npos )
|
if( begin == std::string::npos )
|
||||||
return "main";
|
return "main";
|
||||||
|
|
||||||
size_t end = sFilename.find_first_of( ']', begin );
|
std::size_t end = sFilename.find_first_of( ']', begin );
|
||||||
if( end == std::string::npos )
|
if( end == std::string::npos )
|
||||||
return "main";
|
return "main";
|
||||||
|
|
||||||
|
|||||||
+3
-1
@@ -6,6 +6,8 @@
|
|||||||
#include "RageTextureID.h"
|
#include "RageTextureID.h"
|
||||||
#include "RageUtil.h"
|
#include "RageUtil.h"
|
||||||
#include "RageTypes.h"
|
#include "RageTypes.h"
|
||||||
|
|
||||||
|
#include <cstddef>
|
||||||
#include <map>
|
#include <map>
|
||||||
|
|
||||||
class FontPage;
|
class FontPage;
|
||||||
@@ -154,7 +156,7 @@ public:
|
|||||||
|
|
||||||
int GetLineWidthInSourcePixels( const std::wstring &szLine ) const;
|
int GetLineWidthInSourcePixels( const std::wstring &szLine ) const;
|
||||||
int GetLineHeightInSourcePixels( const std::wstring &szLine ) const;
|
int GetLineHeightInSourcePixels( const std::wstring &szLine ) const;
|
||||||
size_t GetGlyphsThatFit(const std::wstring& line, int* width) const;
|
std::size_t GetGlyphsThatFit(const std::wstring& line, int* width) const;
|
||||||
|
|
||||||
bool FontCompleteForString( const std::wstring &str ) const;
|
bool FontCompleteForString( const std::wstring &str ) const;
|
||||||
|
|
||||||
|
|||||||
+4
-2
@@ -23,6 +23,8 @@
|
|||||||
#include "arch/ArchHooks/ArchHooks.h"
|
#include "arch/ArchHooks/ArchHooks.h"
|
||||||
#include "ScreenPrompt.h"
|
#include "ScreenPrompt.h"
|
||||||
|
|
||||||
|
#include <cstddef>
|
||||||
|
|
||||||
static LocalizedString COULD_NOT_LAUNCH_BROWSER( "GameCommand", "Could not launch web browser." );
|
static LocalizedString COULD_NOT_LAUNCH_BROWSER( "GameCommand", "Could not launch web browser." );
|
||||||
|
|
||||||
REGISTER_CLASS_TRAITS( GameCommand, new GameCommand(*pCopy) );
|
REGISTER_CLASS_TRAITS( GameCommand, new GameCommand(*pCopy) );
|
||||||
@@ -357,7 +359,7 @@ void GameCommand::LoadOne( const Command& cmd )
|
|||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
for(size_t i= 1; i < cmd.m_vsArgs.size(); i+= 2)
|
for(std::size_t i= 1; i < cmd.m_vsArgs.size(); i+= 2)
|
||||||
{
|
{
|
||||||
m_SetEnv[cmd.m_vsArgs[i]]= cmd.m_vsArgs[i+1];
|
m_SetEnv[cmd.m_vsArgs[i]]= cmd.m_vsArgs[i+1];
|
||||||
}
|
}
|
||||||
@@ -447,7 +449,7 @@ void GameCommand::LoadOne( const Command& cmd )
|
|||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
for(size_t i= 1; i < cmd.m_vsArgs.size(); i+= 2)
|
for(std::size_t i= 1; i < cmd.m_vsArgs.size(); i+= 2)
|
||||||
{
|
{
|
||||||
if(IPreference::GetPreferenceByName(cmd.m_vsArgs[i]) == nullptr)
|
if(IPreference::GetPreferenceByName(cmd.m_vsArgs[i]) == nullptr)
|
||||||
{
|
{
|
||||||
|
|||||||
+9
-7
@@ -14,6 +14,8 @@
|
|||||||
#include "Game.h"
|
#include "Game.h"
|
||||||
#include "Style.h"
|
#include "Style.h"
|
||||||
|
|
||||||
|
#include <cstddef>
|
||||||
|
|
||||||
GameManager* GAMEMAN = nullptr; // global and accessable from anywhere in our program
|
GameManager* GAMEMAN = nullptr; // global and accessable from anywhere in our program
|
||||||
|
|
||||||
enum
|
enum
|
||||||
@@ -3266,7 +3268,7 @@ void GameManager::GetStylesForGame( const Game *pGame, std::vector<const Style*>
|
|||||||
|
|
||||||
const Game *GameManager::GetGameForStyle( const Style *pStyle )
|
const Game *GameManager::GetGameForStyle( const Style *pStyle )
|
||||||
{
|
{
|
||||||
for( size_t g=0; g<ARRAYLEN(g_Games); ++g )
|
for( std::size_t g=0; g<ARRAYLEN(g_Games); ++g )
|
||||||
{
|
{
|
||||||
const Game *pGame = g_Games[g];
|
const Game *pGame = g_Games[g];
|
||||||
for( int s=0; pGame->m_apStyles[s]; ++s )
|
for( int s=0; pGame->m_apStyles[s]; ++s )
|
||||||
@@ -3280,7 +3282,7 @@ const Game *GameManager::GetGameForStyle( const Style *pStyle )
|
|||||||
|
|
||||||
const Style* GameManager::GetEditorStyleForStepsType( StepsType st )
|
const Style* GameManager::GetEditorStyleForStepsType( StepsType st )
|
||||||
{
|
{
|
||||||
for( size_t g=0; g<ARRAYLEN(g_Games); ++g )
|
for( std::size_t g=0; g<ARRAYLEN(g_Games); ++g )
|
||||||
{
|
{
|
||||||
const Game *pGame = g_Games[g];
|
const Game *pGame = g_Games[g];
|
||||||
for( int s=0; pGame->m_apStyles[s]; ++s )
|
for( int s=0; pGame->m_apStyles[s]; ++s )
|
||||||
@@ -3391,7 +3393,7 @@ const Style *GameManager::GetFirstCompatibleStyle( const Game *pGame, int iNumPl
|
|||||||
|
|
||||||
void GameManager::GetEnabledGames( std::vector<const Game*>& aGamesOut )
|
void GameManager::GetEnabledGames( std::vector<const Game*>& aGamesOut )
|
||||||
{
|
{
|
||||||
for( size_t g=0; g<ARRAYLEN(g_Games); ++g )
|
for( std::size_t g=0; g<ARRAYLEN(g_Games); ++g )
|
||||||
{
|
{
|
||||||
const Game *pGame = g_Games[g];
|
const Game *pGame = g_Games[g];
|
||||||
if( IsGameEnabled( pGame ) )
|
if( IsGameEnabled( pGame ) )
|
||||||
@@ -3404,7 +3406,7 @@ const Game* GameManager::GetDefaultGame()
|
|||||||
const Game *pDefault = nullptr;
|
const Game *pDefault = nullptr;
|
||||||
if( pDefault == nullptr )
|
if( pDefault == nullptr )
|
||||||
{
|
{
|
||||||
for( size_t i=0; pDefault == nullptr && i < ARRAYLEN(g_Games); ++i )
|
for( std::size_t i=0; pDefault == nullptr && i < ARRAYLEN(g_Games); ++i )
|
||||||
{
|
{
|
||||||
if( IsGameEnabled(g_Games[i]) )
|
if( IsGameEnabled(g_Games[i]) )
|
||||||
pDefault = g_Games[i];
|
pDefault = g_Games[i];
|
||||||
@@ -3419,7 +3421,7 @@ const Game* GameManager::GetDefaultGame()
|
|||||||
|
|
||||||
int GameManager::GetIndexFromGame( const Game* pGame )
|
int GameManager::GetIndexFromGame( const Game* pGame )
|
||||||
{
|
{
|
||||||
for( size_t g=0; g<ARRAYLEN(g_Games); ++g )
|
for( std::size_t g=0; g<ARRAYLEN(g_Games); ++g )
|
||||||
{
|
{
|
||||||
if( g_Games[g] == pGame )
|
if( g_Games[g] == pGame )
|
||||||
return g;
|
return g;
|
||||||
@@ -3468,7 +3470,7 @@ RString GameManager::StyleToLocalizedString( const Style* style )
|
|||||||
|
|
||||||
const Game* GameManager::StringToGame( RString sGame )
|
const Game* GameManager::StringToGame( RString sGame )
|
||||||
{
|
{
|
||||||
for( size_t i=0; i<ARRAYLEN(g_Games); ++i )
|
for( std::size_t i=0; i<ARRAYLEN(g_Games); ++i )
|
||||||
if( !sGame.CompareNoCase(g_Games[i]->m_szName) )
|
if( !sGame.CompareNoCase(g_Games[i]->m_szName) )
|
||||||
return g_Games[i];
|
return g_Games[i];
|
||||||
|
|
||||||
@@ -3540,7 +3542,7 @@ public:
|
|||||||
std::vector<const Game*> aGames;
|
std::vector<const Game*> aGames;
|
||||||
p->GetEnabledGames( aGames );
|
p->GetEnabledGames( aGames );
|
||||||
lua_createtable(L, aGames.size(), 0);
|
lua_createtable(L, aGames.size(), 0);
|
||||||
for(size_t i= 0; i < aGames.size(); ++i)
|
for(std::size_t i= 0; i < aGames.size(); ++i)
|
||||||
{
|
{
|
||||||
lua_pushstring(L, aGames[i]->m_szName);
|
lua_pushstring(L, aGames[i]->m_szName);
|
||||||
lua_rawseti(L, -2, i+1);
|
lua_rawseti(L, -2, i+1);
|
||||||
|
|||||||
@@ -3,6 +3,7 @@
|
|||||||
|
|
||||||
#include "Preference.h"
|
#include "Preference.h"
|
||||||
#include "GameConstantsAndTypes.h"
|
#include "GameConstantsAndTypes.h"
|
||||||
|
|
||||||
/** @brief Quick access to other variables. */
|
/** @brief Quick access to other variables. */
|
||||||
namespace GamePreferences
|
namespace GamePreferences
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -21,6 +21,7 @@
|
|||||||
#include "arch/Sound/RageSoundDriver.h"
|
#include "arch/Sound/RageSoundDriver.h"
|
||||||
|
|
||||||
#include <cmath>
|
#include <cmath>
|
||||||
|
#include <cstddef>
|
||||||
|
|
||||||
GameSoundManager *SOUND = nullptr;
|
GameSoundManager *SOUND = nullptr;
|
||||||
|
|
||||||
@@ -905,7 +906,7 @@ int LuaFunc_get_sound_driver_list(lua_State* L)
|
|||||||
std::vector<RString> driver_names;
|
std::vector<RString> driver_names;
|
||||||
split(RageSoundDriver::GetDefaultSoundDriverList(), ",", driver_names, true);
|
split(RageSoundDriver::GetDefaultSoundDriverList(), ",", driver_names, true);
|
||||||
lua_createtable(L, driver_names.size(), 0);
|
lua_createtable(L, driver_names.size(), 0);
|
||||||
for(size_t n= 0; n < driver_names.size(); ++n)
|
for(std::size_t n= 0; n < driver_names.size(); ++n)
|
||||||
{
|
{
|
||||||
lua_pushstring(L, driver_names[n].c_str());
|
lua_pushstring(L, driver_names[n].c_str());
|
||||||
lua_rawseti(L, -2, n+1);
|
lua_rawseti(L, -2, n+1);
|
||||||
|
|||||||
+4
-3
@@ -43,6 +43,7 @@
|
|||||||
#include "Screen.h"
|
#include "Screen.h"
|
||||||
|
|
||||||
#include <cmath>
|
#include <cmath>
|
||||||
|
#include <cstddef>
|
||||||
#include <ctime>
|
#include <ctime>
|
||||||
#include <set>
|
#include <set>
|
||||||
|
|
||||||
@@ -1481,7 +1482,7 @@ int GameState::prepare_song_for_gameplay()
|
|||||||
copy_exts.push_back("lrc");
|
copy_exts.push_back("lrc");
|
||||||
std::vector<RString> files_in_dir;
|
std::vector<RString> files_in_dir;
|
||||||
FILEMAN->GetDirListingWithMultipleExtensions(from_dir, copy_exts, files_in_dir);
|
FILEMAN->GetDirListingWithMultipleExtensions(from_dir, copy_exts, files_in_dir);
|
||||||
for(size_t i= 0; i < files_in_dir.size(); ++i)
|
for(std::size_t i= 0; i < files_in_dir.size(); ++i)
|
||||||
{
|
{
|
||||||
RString& fname= files_in_dir[i];
|
RString& fname= files_in_dir[i];
|
||||||
if(!FileCopy(from_dir + fname, to_dir + fname))
|
if(!FileCopy(from_dir + fname, to_dir + fname))
|
||||||
@@ -3333,7 +3334,7 @@ public:
|
|||||||
{
|
{
|
||||||
int i= IArg(1) - 1;
|
int i= IArg(1) - 1;
|
||||||
if(i < 0) { lua_pushnil(L); return 1; }
|
if(i < 0) { lua_pushnil(L); return 1; }
|
||||||
size_t si= static_cast<size_t>(i);
|
std::size_t si= static_cast<std::size_t>(i);
|
||||||
if(si >= p->m_autogen_fargs.size()) { lua_pushnil(L); return 1; }
|
if(si >= p->m_autogen_fargs.size()) { lua_pushnil(L); return 1; }
|
||||||
lua_pushnumber(L, p->GetAutoGenFarg(si));
|
lua_pushnumber(L, p->GetAutoGenFarg(si));
|
||||||
return 1;
|
return 1;
|
||||||
@@ -3346,7 +3347,7 @@ public:
|
|||||||
luaL_error(L, "%i is not a valid autogen arg index.", i);
|
luaL_error(L, "%i is not a valid autogen arg index.", i);
|
||||||
}
|
}
|
||||||
float v= FArg(2);
|
float v= FArg(2);
|
||||||
size_t si= static_cast<size_t>(i);
|
std::size_t si= static_cast<std::size_t>(i);
|
||||||
while(si >= p->m_autogen_fargs.size())
|
while(si >= p->m_autogen_fargs.size())
|
||||||
{
|
{
|
||||||
p->m_autogen_fargs.push_back(0.0f);
|
p->m_autogen_fargs.push_back(0.0f);
|
||||||
|
|||||||
+3
-2
@@ -13,8 +13,9 @@
|
|||||||
#include "SongPosition.h"
|
#include "SongPosition.h"
|
||||||
#include "Preference.h"
|
#include "Preference.h"
|
||||||
|
|
||||||
#include <map>
|
#include <cstddef>
|
||||||
#include <deque>
|
#include <deque>
|
||||||
|
#include <map>
|
||||||
#include <set>
|
#include <set>
|
||||||
|
|
||||||
class Character;
|
class Character;
|
||||||
@@ -412,7 +413,7 @@ public:
|
|||||||
|
|
||||||
// Autogen stuff. This should probably be moved to its own singleton or
|
// Autogen stuff. This should probably be moved to its own singleton or
|
||||||
// something when autogen is generalized and more customizable. -Kyz
|
// something when autogen is generalized and more customizable. -Kyz
|
||||||
float GetAutoGenFarg(size_t i)
|
float GetAutoGenFarg(std::size_t i)
|
||||||
{
|
{
|
||||||
if(i >= m_autogen_fargs.size()) { return 0.0f; }
|
if(i >= m_autogen_fargs.size()) { return 0.0f; }
|
||||||
return m_autogen_fargs[i];
|
return m_autogen_fargs[i];
|
||||||
|
|||||||
@@ -10,6 +10,8 @@
|
|||||||
#include "Style.h"
|
#include "Style.h"
|
||||||
#include "ActorUtil.h"
|
#include "ActorUtil.h"
|
||||||
|
|
||||||
|
#include <cstddef>
|
||||||
|
|
||||||
void GhostArrowRow::Load( const PlayerState* pPlayerState, float fYReverseOffset )
|
void GhostArrowRow::Load( const PlayerState* pPlayerState, float fYReverseOffset )
|
||||||
{
|
{
|
||||||
m_pPlayerState = pPlayerState;
|
m_pPlayerState = pPlayerState;
|
||||||
@@ -39,7 +41,7 @@ void GhostArrowRow::Load( const PlayerState* pPlayerState, float fYReverseOffset
|
|||||||
void GhostArrowRow::SetColumnRenderers(std::vector<NoteColumnRenderer>& renderers)
|
void GhostArrowRow::SetColumnRenderers(std::vector<NoteColumnRenderer>& renderers)
|
||||||
{
|
{
|
||||||
ASSERT_M(renderers.size() == m_Ghost.size(), "Notefield has different number of columns than ghost row.");
|
ASSERT_M(renderers.size() == m_Ghost.size(), "Notefield has different number of columns than ghost row.");
|
||||||
for(size_t c= 0; c < m_Ghost.size(); ++c)
|
for(std::size_t c= 0; c < m_Ghost.size(); ++c)
|
||||||
{
|
{
|
||||||
m_Ghost[c]->SetFakeParent(&(renderers[c]));
|
m_Ghost[c]->SetFakeParent(&(renderers[c]));
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -6,6 +6,8 @@
|
|||||||
#include "ActorUtil.h"
|
#include "ActorUtil.h"
|
||||||
#include "ThemeManager.h"
|
#include "ThemeManager.h"
|
||||||
|
|
||||||
|
#include <cstddef>
|
||||||
|
|
||||||
REGISTER_ACTOR_CLASS( GradeDisplay );
|
REGISTER_ACTOR_CLASS( GradeDisplay );
|
||||||
|
|
||||||
void GradeDisplay::Load( RString sMetricsGroup )
|
void GradeDisplay::Load( RString sMetricsGroup )
|
||||||
@@ -25,7 +27,7 @@ void GradeDisplay::Load( RString sMetricsGroup )
|
|||||||
|
|
||||||
void GradeDisplay::SetGrade( Grade grade )
|
void GradeDisplay::SetGrade( Grade grade )
|
||||||
{
|
{
|
||||||
size_t i = 0;
|
std::size_t i = 0;
|
||||||
FOREACH_PossibleGrade( g )
|
FOREACH_PossibleGrade( g )
|
||||||
{
|
{
|
||||||
if(i >= m_vSpr.size())
|
if(i >= m_vSpr.size())
|
||||||
|
|||||||
+4
-3
@@ -8,6 +8,7 @@
|
|||||||
#include "RadarValues.h"
|
#include "RadarValues.h"
|
||||||
|
|
||||||
#include <algorithm>
|
#include <algorithm>
|
||||||
|
#include <cstddef>
|
||||||
|
|
||||||
ThemeMetric<RString> EMPTY_NAME("HighScore","EmptyName");
|
ThemeMetric<RString> EMPTY_NAME("HighScore","EmptyName");
|
||||||
|
|
||||||
@@ -542,7 +543,7 @@ public:
|
|||||||
static int GetHighestScoreOfName( T* p, lua_State *L )
|
static int GetHighestScoreOfName( T* p, lua_State *L )
|
||||||
{
|
{
|
||||||
RString name= SArg(1);
|
RString name= SArg(1);
|
||||||
for(size_t i= 0; i < p->vHighScores.size(); ++i)
|
for(std::size_t i= 0; i < p->vHighScores.size(); ++i)
|
||||||
{
|
{
|
||||||
if(name == p->vHighScores[i].GetName())
|
if(name == p->vHighScores[i].GetName())
|
||||||
{
|
{
|
||||||
@@ -557,8 +558,8 @@ public:
|
|||||||
static int GetRankOfName( T* p, lua_State *L )
|
static int GetRankOfName( T* p, lua_State *L )
|
||||||
{
|
{
|
||||||
RString name= SArg(1);
|
RString name= SArg(1);
|
||||||
size_t rank= 0;
|
std::size_t rank= 0;
|
||||||
for(size_t i= 0; i < p->vHighScores.size(); ++i)
|
for(std::size_t i= 0; i < p->vHighScores.size(); ++i)
|
||||||
{
|
{
|
||||||
if(name == p->vHighScores[i].GetName())
|
if(name == p->vHighScores[i].GetName())
|
||||||
{
|
{
|
||||||
|
|||||||
+2
-1
@@ -20,6 +20,7 @@
|
|||||||
#include "Banner.h"
|
#include "Banner.h"
|
||||||
|
|
||||||
#include <cmath>
|
#include <cmath>
|
||||||
|
#include <cstddef>
|
||||||
|
|
||||||
static Preference<bool> g_bPalettedImageCache( "PalettedImageCache", false );
|
static Preference<bool> g_bPalettedImageCache( "PalettedImageCache", false );
|
||||||
|
|
||||||
@@ -272,7 +273,7 @@ RageTextureID ImageCache::LoadCachedImage( RString sImageDir, RString sImagePath
|
|||||||
{
|
{
|
||||||
RageTextureID ID( GetImageCachePath(sImageDir,sImagePath) );
|
RageTextureID ID( GetImageCachePath(sImageDir,sImagePath) );
|
||||||
|
|
||||||
size_t Found = sImagePath.find("_blank");
|
std::size_t Found = sImagePath.find("_blank");
|
||||||
if( sImagePath == "" || Found!=RString::npos )
|
if( sImagePath == "" || Found!=RString::npos )
|
||||||
return ID;
|
return ID;
|
||||||
|
|
||||||
|
|||||||
+3
-1
@@ -10,6 +10,8 @@ http://en.wikipedia.org/wiki/INI_file
|
|||||||
#include "RageLog.h"
|
#include "RageLog.h"
|
||||||
#include "RageFile.h"
|
#include "RageFile.h"
|
||||||
|
|
||||||
|
#include <cstddef>
|
||||||
|
|
||||||
|
|
||||||
IniFile::IniFile(): XNode("IniFile")
|
IniFile::IniFile(): XNode("IniFile")
|
||||||
{
|
{
|
||||||
@@ -94,7 +96,7 @@ bool IniFile::ReadFile( RageFileBasic &f )
|
|||||||
if(keychild == nullptr)
|
if(keychild == nullptr)
|
||||||
{ break; }
|
{ break; }
|
||||||
// New value.
|
// New value.
|
||||||
size_t iEqualIndex = line.find("=");
|
std::size_t iEqualIndex = line.find("=");
|
||||||
if( iEqualIndex != std::string::npos )
|
if( iEqualIndex != std::string::npos )
|
||||||
{
|
{
|
||||||
RString valuename = line.Left((int) iEqualIndex);
|
RString valuename = line.Left((int) iEqualIndex);
|
||||||
|
|||||||
+8
-6
@@ -11,6 +11,8 @@
|
|||||||
#include "LocalizedString.h"
|
#include "LocalizedString.h"
|
||||||
#include "arch/Dialog/Dialog.h"
|
#include "arch/Dialog/Dialog.h"
|
||||||
|
|
||||||
|
#include <cstddef>
|
||||||
|
|
||||||
#define AUTOMAPPINGS_DIR "/Data/AutoMappings/"
|
#define AUTOMAPPINGS_DIR "/Data/AutoMappings/"
|
||||||
|
|
||||||
static Preference<RString> g_sLastSeenInputDevices( "LastSeenInputDevices", "" );
|
static Preference<RString> g_sLastSeenInputDevices( "LastSeenInputDevices", "" );
|
||||||
@@ -983,7 +985,7 @@ bool InputMapper::IsBeingPressed( GameButton MenuI, PlayerNumber pn ) const
|
|||||||
}
|
}
|
||||||
std::vector<GameInput> GameI;
|
std::vector<GameInput> GameI;
|
||||||
MenuToGame( MenuI, pn, GameI );
|
MenuToGame( MenuI, pn, GameI );
|
||||||
for( size_t i=0; i<GameI.size(); i++ )
|
for( std::size_t i=0; i<GameI.size(); i++ )
|
||||||
if( IsBeingPressed(GameI[i]) )
|
if( IsBeingPressed(GameI[i]) )
|
||||||
return true;
|
return true;
|
||||||
|
|
||||||
@@ -993,7 +995,7 @@ bool InputMapper::IsBeingPressed( GameButton MenuI, PlayerNumber pn ) const
|
|||||||
bool InputMapper::IsBeingPressed(const std::vector<GameInput>& GameI, MultiPlayer mp, const DeviceInputList *pButtonState ) const
|
bool InputMapper::IsBeingPressed(const std::vector<GameInput>& GameI, MultiPlayer mp, const DeviceInputList *pButtonState ) const
|
||||||
{
|
{
|
||||||
bool pressed= false;
|
bool pressed= false;
|
||||||
for(size_t i= 0; i < GameI.size(); ++i)
|
for(std::size_t i= 0; i < GameI.size(); ++i)
|
||||||
{
|
{
|
||||||
pressed |= IsBeingPressed(GameI[i], mp, pButtonState);
|
pressed |= IsBeingPressed(GameI[i], mp, pButtonState);
|
||||||
}
|
}
|
||||||
@@ -1023,7 +1025,7 @@ void InputMapper::RepeatStopKey( GameButton MenuI, PlayerNumber pn )
|
|||||||
}
|
}
|
||||||
std::vector<GameInput> GameI;
|
std::vector<GameInput> GameI;
|
||||||
MenuToGame( MenuI, pn, GameI );
|
MenuToGame( MenuI, pn, GameI );
|
||||||
for( size_t i=0; i<GameI.size(); i++ )
|
for( std::size_t i=0; i<GameI.size(); i++ )
|
||||||
RepeatStopKey( GameI[i] );
|
RepeatStopKey( GameI[i] );
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -1059,7 +1061,7 @@ float InputMapper::GetSecsHeld( GameButton MenuI, PlayerNumber pn ) const
|
|||||||
|
|
||||||
std::vector<GameInput> GameI;
|
std::vector<GameInput> GameI;
|
||||||
MenuToGame( MenuI, pn, GameI );
|
MenuToGame( MenuI, pn, GameI );
|
||||||
for( size_t i=0; i<GameI.size(); i++ )
|
for( std::size_t i=0; i<GameI.size(); i++ )
|
||||||
fMaxSecsHeld = std::max( fMaxSecsHeld, GetSecsHeld(GameI[i]) );
|
fMaxSecsHeld = std::max( fMaxSecsHeld, GetSecsHeld(GameI[i]) );
|
||||||
|
|
||||||
return fMaxSecsHeld;
|
return fMaxSecsHeld;
|
||||||
@@ -1087,7 +1089,7 @@ void InputMapper::ResetKeyRepeat( GameButton MenuI, PlayerNumber pn )
|
|||||||
}
|
}
|
||||||
std::vector<GameInput> GameI;
|
std::vector<GameInput> GameI;
|
||||||
MenuToGame( MenuI, pn, GameI );
|
MenuToGame( MenuI, pn, GameI );
|
||||||
for( size_t i=0; i<GameI.size(); i++ )
|
for( std::size_t i=0; i<GameI.size(); i++ )
|
||||||
ResetKeyRepeat( GameI[i] );
|
ResetKeyRepeat( GameI[i] );
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -1118,7 +1120,7 @@ float InputMapper::GetLevel( GameButton MenuI, PlayerNumber pn ) const
|
|||||||
MenuToGame( MenuI, pn, GameI );
|
MenuToGame( MenuI, pn, GameI );
|
||||||
|
|
||||||
float fLevel = 0;
|
float fLevel = 0;
|
||||||
for( size_t i=0; i<GameI.size(); i++ )
|
for( std::size_t i=0; i<GameI.size(); i++ )
|
||||||
fLevel = std::max( fLevel, GetLevel(GameI[i]) );
|
fLevel = std::max( fLevel, GetLevel(GameI[i]) );
|
||||||
|
|
||||||
return fLevel;
|
return fLevel;
|
||||||
|
|||||||
@@ -16,7 +16,9 @@
|
|||||||
#include "Steps.h"
|
#include "Steps.h"
|
||||||
#include "Course.h"
|
#include "Course.h"
|
||||||
|
|
||||||
static RString LIFE_PERCENT_CHANGE_NAME( size_t i ) { return "LifePercentChange" + ScoreEventToString( (ScoreEvent)i ); }
|
#include <cstddef>
|
||||||
|
|
||||||
|
static RString LIFE_PERCENT_CHANGE_NAME( std::size_t i ) { return "LifePercentChange" + ScoreEventToString( (ScoreEvent)i ); }
|
||||||
|
|
||||||
LifeMeterBar::LifeMeterBar()
|
LifeMeterBar::LifeMeterBar()
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -12,6 +12,8 @@
|
|||||||
#include "PlayerState.h"
|
#include "PlayerState.h"
|
||||||
#include "MessageManager.h"
|
#include "MessageManager.h"
|
||||||
|
|
||||||
|
#include <cstddef>
|
||||||
|
|
||||||
const float FULL_LIFE_SECONDS = 1.5f*60;
|
const float FULL_LIFE_SECONDS = 1.5f*60;
|
||||||
|
|
||||||
static ThemeMetric<float> METER_WIDTH ("LifeMeterTime","MeterWidth");
|
static ThemeMetric<float> METER_WIDTH ("LifeMeterTime","MeterWidth");
|
||||||
@@ -37,7 +39,7 @@ static const float g_fTimeMeterSecondsChangeInit[] =
|
|||||||
};
|
};
|
||||||
COMPILE_ASSERT( ARRAYLEN(g_fTimeMeterSecondsChangeInit) == NUM_ScoreEvent );
|
COMPILE_ASSERT( ARRAYLEN(g_fTimeMeterSecondsChangeInit) == NUM_ScoreEvent );
|
||||||
|
|
||||||
static void TimeMeterSecondsChangeInit( size_t /*ScoreEvent*/ i, RString &sNameOut, float &defaultValueOut )
|
static void TimeMeterSecondsChangeInit( std::size_t /*ScoreEvent*/ i, RString &sNameOut, float &defaultValueOut )
|
||||||
{
|
{
|
||||||
sNameOut = "TimeMeterSecondsChange" + ScoreEventToString( (ScoreEvent)i );
|
sNameOut = "TimeMeterSecondsChange" + ScoreEventToString( (ScoreEvent)i );
|
||||||
defaultValueOut = g_fTimeMeterSecondsChangeInit[i];
|
defaultValueOut = g_fTimeMeterSecondsChangeInit[i];
|
||||||
|
|||||||
@@ -15,6 +15,7 @@
|
|||||||
#include "Style.h"
|
#include "Style.h"
|
||||||
|
|
||||||
#include <cmath>
|
#include <cmath>
|
||||||
|
#include <cstddef>
|
||||||
|
|
||||||
const RString DEFAULT_LIGHTS_DRIVER = "SystemMessage,Export";
|
const RString DEFAULT_LIGHTS_DRIVER = "SystemMessage,Export";
|
||||||
static Preference<RString> g_sLightsDriver( "LightsDriver", "" ); // "" == DEFAULT_LIGHTS_DRIVER
|
static Preference<RString> g_sLightsDriver( "LightsDriver", "" ); // "" == DEFAULT_LIGHTS_DRIVER
|
||||||
@@ -84,7 +85,7 @@ static void GetUsedGameInputs( std::vector<GameInput> &vGameInputsOut )
|
|||||||
{
|
{
|
||||||
std::vector<GameInput> gi;
|
std::vector<GameInput> gi;
|
||||||
style->StyleInputToGameInput( iCol, pn, gi );
|
style->StyleInputToGameInput( iCol, pn, gi );
|
||||||
for(size_t i= 0; i < gi.size(); ++i)
|
for(std::size_t i= 0; i < gi.size(); ++i)
|
||||||
{
|
{
|
||||||
if(gi[i].IsValid())
|
if(gi[i].IsValid())
|
||||||
{
|
{
|
||||||
|
|||||||
+4
-3
@@ -13,11 +13,12 @@
|
|||||||
#include "MessageManager.h"
|
#include "MessageManager.h"
|
||||||
#include "ver.h"
|
#include "ver.h"
|
||||||
|
|
||||||
#include <sstream> // conversion for lua functions.
|
|
||||||
#include <csetjmp>
|
|
||||||
#include <cassert>
|
#include <cassert>
|
||||||
#include <cmath>
|
#include <cmath>
|
||||||
|
#include <csetjmp>
|
||||||
|
#include <cstddef>
|
||||||
#include <map>
|
#include <map>
|
||||||
|
#include <sstream> // conversion for lua functions.
|
||||||
|
|
||||||
LuaManager *LUA = nullptr;
|
LuaManager *LUA = nullptr;
|
||||||
struct Impl
|
struct Impl
|
||||||
@@ -95,7 +96,7 @@ namespace LuaHelpers
|
|||||||
template<> bool FromStack<unsigned int>( Lua *L, unsigned int &Object, int iOffset ) { Object = lua_tointeger( L, iOffset ); return true; }
|
template<> bool FromStack<unsigned int>( Lua *L, unsigned int &Object, int iOffset ) { Object = lua_tointeger( L, iOffset ); return true; }
|
||||||
template<> bool FromStack<RString>( Lua *L, RString &Object, int iOffset )
|
template<> bool FromStack<RString>( Lua *L, RString &Object, int iOffset )
|
||||||
{
|
{
|
||||||
size_t iLen;
|
std::size_t iLen;
|
||||||
const char *pStr = lua_tolstring( L, iOffset, &iLen );
|
const char *pStr = lua_tolstring( L, iOffset, &iLen );
|
||||||
if( pStr != nullptr )
|
if( pStr != nullptr )
|
||||||
Object.assign( pStr, iLen );
|
Object.assign( pStr, iLen );
|
||||||
|
|||||||
@@ -12,27 +12,29 @@
|
|||||||
#include "arch/MemoryCard/MemoryCardDriver_Null.h"
|
#include "arch/MemoryCard/MemoryCardDriver_Null.h"
|
||||||
#include "LuaManager.h"
|
#include "LuaManager.h"
|
||||||
|
|
||||||
|
#include <cstddef>
|
||||||
|
|
||||||
MemoryCardManager* MEMCARDMAN = nullptr; // global and accessible from anywhere in our program
|
MemoryCardManager* MEMCARDMAN = nullptr; // global and accessible from anywhere in our program
|
||||||
|
|
||||||
static void MemoryCardOsMountPointInit( size_t /*PlayerNumber*/ i, RString &sNameOut, RString &defaultValueOut )
|
static void MemoryCardOsMountPointInit( std::size_t /*PlayerNumber*/ i, RString &sNameOut, RString &defaultValueOut )
|
||||||
{
|
{
|
||||||
sNameOut = ssprintf( "MemoryCardOsMountPointP%d", int(i+1) );
|
sNameOut = ssprintf( "MemoryCardOsMountPointP%d", int(i+1) );
|
||||||
defaultValueOut = "";
|
defaultValueOut = "";
|
||||||
}
|
}
|
||||||
|
|
||||||
static void MemoryCardUsbBusInit( size_t /*PlayerNumber*/ i, RString &sNameOut, int &defaultValueOut )
|
static void MemoryCardUsbBusInit( std::size_t /*PlayerNumber*/ i, RString &sNameOut, int &defaultValueOut )
|
||||||
{
|
{
|
||||||
sNameOut = ssprintf( "MemoryCardUsbBusP%d", int(i+1) );
|
sNameOut = ssprintf( "MemoryCardUsbBusP%d", int(i+1) );
|
||||||
defaultValueOut = -1;
|
defaultValueOut = -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
static void MemoryCardUsbPortInit( size_t /*PlayerNumber*/ i, RString &sNameOut, int &defaultValueOut )
|
static void MemoryCardUsbPortInit( std::size_t /*PlayerNumber*/ i, RString &sNameOut, int &defaultValueOut )
|
||||||
{
|
{
|
||||||
sNameOut = ssprintf( "MemoryCardUsbPortP%d",int(i+1) );
|
sNameOut = ssprintf( "MemoryCardUsbPortP%d",int(i+1) );
|
||||||
defaultValueOut = -1;
|
defaultValueOut = -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
static void MemoryCardUsbLevelInit( size_t /*PlayerNumber*/ i, RString &sNameOut, int &defaultValueOut )
|
static void MemoryCardUsbLevelInit( std::size_t /*PlayerNumber*/ i, RString &sNameOut, int &defaultValueOut )
|
||||||
{
|
{
|
||||||
sNameOut = ssprintf( "MemoryCardUsbLevelP%d", int(i+1) );
|
sNameOut = ssprintf( "MemoryCardUsbLevelP%d", int(i+1) );
|
||||||
defaultValueOut = -1;
|
defaultValueOut = -1;
|
||||||
|
|||||||
+2
-1
@@ -10,8 +10,9 @@
|
|||||||
#include "ActorUtil.h"
|
#include "ActorUtil.h"
|
||||||
|
|
||||||
#include <cmath>
|
#include <cmath>
|
||||||
|
#include <cstddef>
|
||||||
|
|
||||||
RString WARNING_COMMAND_NAME( size_t i ) { return ssprintf("Warning%dCommand",int(i)); }
|
RString WARNING_COMMAND_NAME( std::size_t i ) { return ssprintf("Warning%dCommand",int(i)); }
|
||||||
|
|
||||||
static const float TIMER_PAUSE_SECONDS = 99.99f;
|
static const float TIMER_PAUSE_SECONDS = 99.99f;
|
||||||
|
|
||||||
|
|||||||
+3
-1
@@ -9,7 +9,9 @@
|
|||||||
#include "ThemeMetric.h"
|
#include "ThemeMetric.h"
|
||||||
#include "AutoActor.h"
|
#include "AutoActor.h"
|
||||||
|
|
||||||
RString WARNING_COMMAND_NAME( size_t i );
|
#include <cstddef>
|
||||||
|
|
||||||
|
RString WARNING_COMMAND_NAME( std::size_t i );
|
||||||
|
|
||||||
class MenuTimer : public ActorFrame
|
class MenuTimer : public ActorFrame
|
||||||
{
|
{
|
||||||
|
|||||||
+5
-3
@@ -13,6 +13,8 @@
|
|||||||
#include "LuaBinding.h"
|
#include "LuaBinding.h"
|
||||||
#include "PrefsManager.h"
|
#include "PrefsManager.h"
|
||||||
|
|
||||||
|
#include <cstddef>
|
||||||
|
|
||||||
REGISTER_ACTOR_CLASS( Model );
|
REGISTER_ACTOR_CLASS( Model );
|
||||||
|
|
||||||
static const float FRAMES_PER_SECOND = 30;
|
static const float FRAMES_PER_SECOND = 30;
|
||||||
@@ -600,7 +602,7 @@ void Model::AdvanceFrame( float fDeltaTime )
|
|||||||
|
|
||||||
void Model::SetBones( const msAnimation* pAnimation, float fFrame, std::vector<myBone_t> &vpBones )
|
void Model::SetBones( const msAnimation* pAnimation, float fFrame, std::vector<myBone_t> &vpBones )
|
||||||
{
|
{
|
||||||
for( size_t i = 0; i < pAnimation->Bones.size(); ++i )
|
for( std::size_t i = 0; i < pAnimation->Bones.size(); ++i )
|
||||||
{
|
{
|
||||||
const msBone *pBone = &pAnimation->Bones[i];
|
const msBone *pBone = &pAnimation->Bones[i];
|
||||||
if( pBone->PositionKeys.size() == 0 && pBone->RotationKeys.size() == 0 )
|
if( pBone->PositionKeys.size() == 0 && pBone->RotationKeys.size() == 0 )
|
||||||
@@ -611,7 +613,7 @@ void Model::SetBones( const msAnimation* pAnimation, float fFrame, std::vector<m
|
|||||||
|
|
||||||
// search for the adjacent position keys
|
// search for the adjacent position keys
|
||||||
const msPositionKey *pLastPositionKey = nullptr, *pThisPositionKey = nullptr;
|
const msPositionKey *pLastPositionKey = nullptr, *pThisPositionKey = nullptr;
|
||||||
for( size_t j = 0; j < pBone->PositionKeys.size(); ++j )
|
for( std::size_t j = 0; j < pBone->PositionKeys.size(); ++j )
|
||||||
{
|
{
|
||||||
const msPositionKey *pPositionKey = &pBone->PositionKeys[j];
|
const msPositionKey *pPositionKey = &pBone->PositionKeys[j];
|
||||||
if( pPositionKey->fTime >= fFrame )
|
if( pPositionKey->fTime >= fFrame )
|
||||||
@@ -635,7 +637,7 @@ void Model::SetBones( const msAnimation* pAnimation, float fFrame, std::vector<m
|
|||||||
|
|
||||||
// search for the adjacent rotation keys
|
// search for the adjacent rotation keys
|
||||||
const msRotationKey *pLastRotationKey = nullptr, *pThisRotationKey = nullptr;
|
const msRotationKey *pLastRotationKey = nullptr, *pThisRotationKey = nullptr;
|
||||||
for( size_t j = 0; j < pBone->RotationKeys.size(); ++j )
|
for( std::size_t j = 0; j < pBone->RotationKeys.size(); ++j )
|
||||||
{
|
{
|
||||||
const msRotationKey *pRotationKey = &pBone->RotationKeys[j];
|
const msRotationKey *pRotationKey = &pBone->RotationKeys[j];
|
||||||
if( pRotationKey->fTime >= fFrame )
|
if( pRotationKey->fTime >= fFrame )
|
||||||
|
|||||||
+3
-1
@@ -4,6 +4,8 @@
|
|||||||
#include "EnumHelper.h"
|
#include "EnumHelper.h"
|
||||||
#include "RageTimer.h"
|
#include "RageTimer.h"
|
||||||
|
|
||||||
|
#include <cstddef>
|
||||||
|
|
||||||
enum ModsLevel
|
enum ModsLevel
|
||||||
{
|
{
|
||||||
ModsLevel_Preferred, // user-chosen player options. Does not include any forced mods.
|
ModsLevel_Preferred, // user-chosen player options. Does not include any forced mods.
|
||||||
@@ -56,7 +58,7 @@ public:
|
|||||||
}
|
}
|
||||||
|
|
||||||
template<typename U, int n>
|
template<typename U, int n>
|
||||||
inline void Assign_n( ModsLevel level, U (T::*member)[n], size_t index, const U &val )
|
inline void Assign_n( ModsLevel level, U (T::*member)[n], std::size_t index, const U &val )
|
||||||
{
|
{
|
||||||
DEBUG_ASSERT( index < n );
|
DEBUG_ASSERT( index < n );
|
||||||
if( level != ModsLevel_Song )
|
if( level != ModsLevel_Song )
|
||||||
|
|||||||
+3
-2
@@ -24,6 +24,7 @@
|
|||||||
#include "LocalizedString.h"
|
#include "LocalizedString.h"
|
||||||
|
|
||||||
#include <cmath>
|
#include <cmath>
|
||||||
|
#include <cstddef>
|
||||||
|
|
||||||
static Preference<bool> g_bMoveRandomToEnd( "MoveRandomToEnd", false );
|
static Preference<bool> g_bMoveRandomToEnd( "MoveRandomToEnd", false );
|
||||||
static Preference<bool> g_bPrecacheAllSorts( "PreCacheAllWheelSorts", false);
|
static Preference<bool> g_bPrecacheAllSorts( "PreCacheAllWheelSorts", false);
|
||||||
@@ -32,7 +33,7 @@ static Preference<bool> g_bPrecacheAllSorts( "PreCacheAllWheelSorts", false);
|
|||||||
#define WHEEL_TEXT(s) THEME->GetString( "MusicWheel", ssprintf("%sText",s.c_str()) );
|
#define WHEEL_TEXT(s) THEME->GetString( "MusicWheel", ssprintf("%sText",s.c_str()) );
|
||||||
#define CUSTOM_ITEM_WHEEL_TEXT(s) THEME->GetString( "MusicWheel", ssprintf("CustomItem%sText",s.c_str()) );
|
#define CUSTOM_ITEM_WHEEL_TEXT(s) THEME->GetString( "MusicWheel", ssprintf("CustomItem%sText",s.c_str()) );
|
||||||
|
|
||||||
static RString SECTION_COLORS_NAME( size_t i ) { return ssprintf("SectionColor%d",int(i+1)); }
|
static RString SECTION_COLORS_NAME( std::size_t i ) { return ssprintf("SectionColor%d",int(i+1)); }
|
||||||
static RString CHOICE_NAME( RString s ) { return ssprintf("Choice%s",s.c_str()); }
|
static RString CHOICE_NAME( RString s ) { return ssprintf("Choice%s",s.c_str()); }
|
||||||
static RString CUSTOM_WHEEL_ITEM_NAME( RString s ) { return ssprintf("CustomWheelItem%s",s.c_str()); }
|
static RString CUSTOM_WHEEL_ITEM_NAME( RString s ) { return ssprintf("CustomWheelItem%s",s.c_str()); }
|
||||||
static RString CUSTOM_WHEEL_ITEM_COLOR( RString s ) { return ssprintf("%sColor",s.c_str()); }
|
static RString CUSTOM_WHEEL_ITEM_COLOR( RString s ) { return ssprintf("%sColor",s.c_str()); }
|
||||||
@@ -443,7 +444,7 @@ void MusicWheel::GetSongList( std::vector<Song*> &arraySongs, SortOrder so )
|
|||||||
if(GAMESTATE->IsPlayerEnabled(pn))
|
if(GAMESTATE->IsPlayerEnabled(pn))
|
||||||
{
|
{
|
||||||
Profile* prof= PROFILEMAN->GetProfile(pn);
|
Profile* prof= PROFILEMAN->GetProfile(pn);
|
||||||
for(size_t i= 0; i < prof->m_songs.size(); ++i)
|
for(std::size_t i= 0; i < prof->m_songs.size(); ++i)
|
||||||
{
|
{
|
||||||
apAllSongs.push_back(prof->m_songs[i]);
|
apAllSongs.push_back(prof->m_songs[i]);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -17,6 +17,7 @@
|
|||||||
|
|
||||||
#include <algorithm>
|
#include <algorithm>
|
||||||
#include <climits>
|
#include <climits>
|
||||||
|
#include <cstddef>
|
||||||
#include <memory>
|
#include <memory>
|
||||||
#include <sstream>
|
#include <sstream>
|
||||||
#include <unordered_map>
|
#include <unordered_map>
|
||||||
@@ -140,7 +141,7 @@ bool NetworkManager::IsUrlAllowed(const std::string& url)
|
|||||||
// subdomain wildcards; ".domain" doesn't match "*.domain", but "a.domain" does
|
// subdomain wildcards; ".domain" doesn't match "*.domain", but "a.domain" does
|
||||||
if (allowedHost.substr(0, 2) == "*." && host.length() >= allowedHost.length())
|
if (allowedHost.substr(0, 2) == "*." && host.length() >= allowedHost.length())
|
||||||
{
|
{
|
||||||
size_t pos = host.length() - allowedHost.length() + 1;
|
std::size_t pos = host.length() - allowedHost.length() + 1;
|
||||||
if (host.substr(pos) == allowedHost.substr(1))
|
if (host.substr(pos) == allowedHost.substr(1))
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
@@ -339,7 +340,7 @@ int WebSocketHandle::Send(lua_State *L)
|
|||||||
void *udata = luaL_checkudata(L, 1, "WebSocketHandle");
|
void *udata = luaL_checkudata(L, 1, "WebSocketHandle");
|
||||||
auto handle = *static_cast<WebSocketHandlePtr*>(udata);
|
auto handle = *static_cast<WebSocketHandlePtr*>(udata);
|
||||||
|
|
||||||
size_t len;
|
std::size_t len;
|
||||||
const char *s = luaL_checklstring(L, 2, &len);
|
const char *s = luaL_checklstring(L, 2, &len);
|
||||||
std::string data(s, len);
|
std::string data(s, len);
|
||||||
|
|
||||||
@@ -452,7 +453,7 @@ public:
|
|||||||
{
|
{
|
||||||
if (lua_isstring(L, -1))
|
if (lua_isstring(L, -1))
|
||||||
{
|
{
|
||||||
size_t len;
|
std::size_t len;
|
||||||
const char *s = lua_tolstring(L, -1, &len);
|
const char *s = lua_tolstring(L, -1, &len);
|
||||||
args.body = std::string(s, len);
|
args.body = std::string(s, len);
|
||||||
}
|
}
|
||||||
@@ -468,7 +469,7 @@ public:
|
|||||||
{
|
{
|
||||||
if (lua_isstring(L, -1))
|
if (lua_isstring(L, -1))
|
||||||
{
|
{
|
||||||
size_t len;
|
std::size_t len;
|
||||||
const char *s = lua_tolstring(L, -1, &len);
|
const char *s = lua_tolstring(L, -1, &len);
|
||||||
args.multipartBoundary = std::string(s, len);
|
args.multipartBoundary = std::string(s, len);
|
||||||
}
|
}
|
||||||
|
|||||||
+5
-3
@@ -12,6 +12,8 @@
|
|||||||
#include "GameState.h" // blame radar calculations.
|
#include "GameState.h" // blame radar calculations.
|
||||||
#include "RageUtil_AutoPtr.h"
|
#include "RageUtil_AutoPtr.h"
|
||||||
|
|
||||||
|
#include <cstddef>
|
||||||
|
|
||||||
REGISTER_CLASS_TRAITS( NoteData, new NoteData(*pCopy) )
|
REGISTER_CLASS_TRAITS( NoteData, new NoteData(*pCopy) )
|
||||||
|
|
||||||
void NoteData::Init()
|
void NoteData::Init()
|
||||||
@@ -1407,12 +1409,12 @@ template<typename ND, typename iter, typename TN>
|
|||||||
if(added)
|
if(added)
|
||||||
{
|
{
|
||||||
int avg_row= 0;
|
int avg_row= 0;
|
||||||
for(size_t p= 0; p < m_PrevCurrentRows.size(); ++p)
|
for(std::size_t p= 0; p < m_PrevCurrentRows.size(); ++p)
|
||||||
{
|
{
|
||||||
avg_row+= m_PrevCurrentRows[p];
|
avg_row+= m_PrevCurrentRows[p];
|
||||||
}
|
}
|
||||||
avg_row/= m_PrevCurrentRows.size();
|
avg_row/= m_PrevCurrentRows.size();
|
||||||
for(size_t a= 0; a < added_or_removed_tracks.size(); ++a)
|
for(std::size_t a= 0; a < added_or_removed_tracks.size(); ++a)
|
||||||
{
|
{
|
||||||
int track_id= added_or_removed_tracks[a];
|
int track_id= added_or_removed_tracks[a];
|
||||||
m_PrevCurrentRows.insert(m_PrevCurrentRows.begin()+track_id, avg_row);
|
m_PrevCurrentRows.insert(m_PrevCurrentRows.begin()+track_id, avg_row);
|
||||||
@@ -1423,7 +1425,7 @@ template<typename ND, typename iter, typename TN>
|
|||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
for(size_t a= 0; a < added_or_removed_tracks.size(); ++a)
|
for(std::size_t a= 0; a < added_or_removed_tracks.size(); ++a)
|
||||||
{
|
{
|
||||||
int track_id= added_or_removed_tracks[a];
|
int track_id= added_or_removed_tracks[a];
|
||||||
m_PrevCurrentRows.erase(m_PrevCurrentRows.begin()+track_id);
|
m_PrevCurrentRows.erase(m_PrevCurrentRows.begin()+track_id);
|
||||||
|
|||||||
@@ -11,6 +11,7 @@
|
|||||||
#include "TimingData.h"
|
#include "TimingData.h"
|
||||||
|
|
||||||
#include <cmath>
|
#include <cmath>
|
||||||
|
#include <cstddef>
|
||||||
#include <utility>
|
#include <utility>
|
||||||
|
|
||||||
// TODO: Remove these constants that aren't time signature-aware
|
// TODO: Remove these constants that aren't time signature-aware
|
||||||
@@ -845,7 +846,7 @@ void NoteDataUtil::AutogenKickbox(const NoteData& in, NoteData& out, const Timin
|
|||||||
}
|
}
|
||||||
// prev_limb_panels keeps track of which panel in the track list the limb
|
// prev_limb_panels keeps track of which panel in the track list the limb
|
||||||
// hit last.
|
// hit last.
|
||||||
std::vector<size_t> prev_limb_panels(num_kickbox_limbs, 0);
|
std::vector<std::size_t> prev_limb_panels(num_kickbox_limbs, 0);
|
||||||
std::vector<int> panel_repeat_counts(num_kickbox_limbs, 0);
|
std::vector<int> panel_repeat_counts(num_kickbox_limbs, 0);
|
||||||
std::vector<int> panel_repeat_goals(num_kickbox_limbs, 0);
|
std::vector<int> panel_repeat_goals(num_kickbox_limbs, 0);
|
||||||
RandomGen rnd(nonrandom_seed);
|
RandomGen rnd(nonrandom_seed);
|
||||||
@@ -942,7 +943,7 @@ void NoteDataUtil::AutogenKickbox(const NoteData& in, NoteData& out, const Timin
|
|||||||
default:
|
default:
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
size_t this_panel= prev_limb_panels[this_limb];
|
std::size_t this_panel= prev_limb_panels[this_limb];
|
||||||
if(panel_repeat_counts[this_limb] + 1 > panel_repeat_goals[this_limb])
|
if(panel_repeat_counts[this_limb] + 1 > panel_repeat_goals[this_limb])
|
||||||
{
|
{
|
||||||
// Use a different panel.
|
// Use a different panel.
|
||||||
@@ -1024,7 +1025,7 @@ void NoteDataUtil::CalculateRadarValues( const NoteData &in, float fSongSeconds,
|
|||||||
float total_taps= 0;
|
float total_taps= 0;
|
||||||
const float voltage_window_beats= 8.0f;
|
const float voltage_window_beats= 8.0f;
|
||||||
const int voltage_window= BeatToNoteRow(voltage_window_beats);
|
const int voltage_window= BeatToNoteRow(voltage_window_beats);
|
||||||
size_t max_notes_in_voltage_window= 0;
|
std::size_t max_notes_in_voltage_window= 0;
|
||||||
int num_chaos_rows= 0;
|
int num_chaos_rows= 0;
|
||||||
crv_state state;
|
crv_state state;
|
||||||
|
|
||||||
@@ -1037,7 +1038,7 @@ void NoteDataUtil::CalculateRadarValues( const NoteData &in, float fSongSeconds,
|
|||||||
state.num_notes_on_curr_row= 0;
|
state.num_notes_on_curr_row= 0;
|
||||||
state.num_holds_on_curr_row= 0;
|
state.num_holds_on_curr_row= 0;
|
||||||
state.judgable= timing->IsJudgableAtRow(curr_row);
|
state.judgable= timing->IsJudgableAtRow(curr_row);
|
||||||
for(size_t n= 0; n < state.hold_ends.size(); ++n)
|
for(std::size_t n= 0; n < state.hold_ends.size(); ++n)
|
||||||
{
|
{
|
||||||
if(state.hold_ends[n] < curr_row)
|
if(state.hold_ends[n] < curr_row)
|
||||||
{
|
{
|
||||||
@@ -1045,7 +1046,7 @@ void NoteDataUtil::CalculateRadarValues( const NoteData &in, float fSongSeconds,
|
|||||||
--n;
|
--n;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
for(size_t n= 0; n < recent_notes.size(); ++n)
|
for(std::size_t n= 0; n < recent_notes.size(); ++n)
|
||||||
{
|
{
|
||||||
if(recent_notes[n].row < curr_row - voltage_window)
|
if(recent_notes[n].row < curr_row - voltage_window)
|
||||||
{
|
{
|
||||||
@@ -1976,7 +1977,7 @@ static void HyperShuffleNotes( NoteData &inout, int iStartIndex, int iEndIndex)
|
|||||||
std::shuffle(viTargetTracks.begin(), viTargetTracks.end(), g_RandomNumberGenerator);
|
std::shuffle(viTargetTracks.begin(), viTargetTracks.end(), g_RandomNumberGenerator);
|
||||||
|
|
||||||
// Go through the tracks in their shuffled order and drop tap notes.
|
// Go through the tracks in their shuffled order and drop tap notes.
|
||||||
for(size_t i = 0; i < viTargetTracks.size(); i++)
|
for(std::size_t i = 0; i < viTargetTracks.size(); i++)
|
||||||
{
|
{
|
||||||
const int targetTrack = viTargetTracks[i];
|
const int targetTrack = viTargetTracks[i];
|
||||||
const TapNote current_tn = vtnTargetTaps[i];
|
const TapNote current_tn = vtnTargetTaps[i];
|
||||||
|
|||||||
@@ -9,6 +9,8 @@
|
|||||||
#include "RageLog.h"
|
#include "RageLog.h"
|
||||||
#include "TimingData.h"
|
#include "TimingData.h"
|
||||||
|
|
||||||
|
#include <cstddef>
|
||||||
|
|
||||||
namespace
|
namespace
|
||||||
{
|
{
|
||||||
|
|
||||||
@@ -249,8 +251,8 @@ static void DoRowEndRadarActualCalc(garv_state& state, RadarValues& out)
|
|||||||
{
|
{
|
||||||
if(state.worst_tns_on_row >= state.hands_tns)
|
if(state.worst_tns_on_row >= state.hands_tns)
|
||||||
{
|
{
|
||||||
size_t holds_down= 0;
|
std::size_t holds_down= 0;
|
||||||
for(size_t n= 0; n < state.hold_ends.size(); ++n)
|
for(std::size_t n= 0; n < state.hold_ends.size(); ++n)
|
||||||
{
|
{
|
||||||
holds_down+= (state.curr_row <= state.hold_ends[n].last_held_row);
|
holds_down+= (state.curr_row <= state.hold_ends[n].last_held_row);
|
||||||
}
|
}
|
||||||
@@ -303,7 +305,7 @@ void NoteDataWithScoring::GetActualRadarValues(const NoteData &in,
|
|||||||
state.num_notes_on_curr_row= 0;
|
state.num_notes_on_curr_row= 0;
|
||||||
state.num_holds_on_curr_row= 0;
|
state.num_holds_on_curr_row= 0;
|
||||||
state.judgable= timing->IsJudgableAtRow(state.curr_row);
|
state.judgable= timing->IsJudgableAtRow(state.curr_row);
|
||||||
for(size_t n= 0; n < state.hold_ends.size(); ++n)
|
for(std::size_t n= 0; n < state.hold_ends.size(); ++n)
|
||||||
{
|
{
|
||||||
if(state.hold_ends[n].end_row < state.curr_row)
|
if(state.hold_ends[n].end_row < state.curr_row)
|
||||||
{
|
{
|
||||||
|
|||||||
+7
-6
@@ -22,6 +22,7 @@
|
|||||||
|
|
||||||
#include <cfloat>
|
#include <cfloat>
|
||||||
#include <cmath>
|
#include <cmath>
|
||||||
|
#include <cstddef>
|
||||||
|
|
||||||
float FindFirstDisplayedBeat( const PlayerState* pPlayerState, int iDrawDistanceAfterTargetsPixels );
|
float FindFirstDisplayedBeat( const PlayerState* pPlayerState, int iDrawDistanceAfterTargetsPixels );
|
||||||
float FindLastDisplayedBeat( const PlayerState* pPlayerState, int iDrawDistanceBeforeTargetsPixels );
|
float FindLastDisplayedBeat( const PlayerState* pPlayerState, int iDrawDistanceBeforeTargetsPixels );
|
||||||
@@ -35,7 +36,7 @@ static ThemeMetric<float> BAR_8TH_ALPHA( "NoteField", "Bar8thAlpha" );
|
|||||||
static ThemeMetric<float> BAR_16TH_ALPHA( "NoteField", "Bar16thAlpha" );
|
static ThemeMetric<float> BAR_16TH_ALPHA( "NoteField", "Bar16thAlpha" );
|
||||||
static ThemeMetric<float> FADE_FAIL_TIME( "NoteField", "FadeFailTime" );
|
static ThemeMetric<float> FADE_FAIL_TIME( "NoteField", "FadeFailTime" );
|
||||||
|
|
||||||
static RString RoutineNoteSkinName( size_t i ) { return ssprintf("RoutineNoteSkinP%i",int(i+1)); }
|
static RString RoutineNoteSkinName( std::size_t i ) { return ssprintf("RoutineNoteSkinP%i",int(i+1)); }
|
||||||
static ThemeMetric1D<RString> ROUTINE_NOTESKIN( "NoteField", RoutineNoteSkinName, NUM_PLAYERS );
|
static ThemeMetric1D<RString> ROUTINE_NOTESKIN( "NoteField", RoutineNoteSkinName, NUM_PLAYERS );
|
||||||
|
|
||||||
NoteField::NoteField()
|
NoteField::NoteField()
|
||||||
@@ -289,7 +290,7 @@ void NoteField::InitColumnRenderers()
|
|||||||
m_FieldRenderArgs.ghost_row= &(m_pCurDisplay->m_GhostArrowRow);
|
m_FieldRenderArgs.ghost_row= &(m_pCurDisplay->m_GhostArrowRow);
|
||||||
m_FieldRenderArgs.note_data= m_pNoteData;
|
m_FieldRenderArgs.note_data= m_pNoteData;
|
||||||
m_ColumnRenderers.resize(GAMESTATE->GetCurrentStyle(m_pPlayerState->m_PlayerNumber)->m_iColsPerPlayer);
|
m_ColumnRenderers.resize(GAMESTATE->GetCurrentStyle(m_pPlayerState->m_PlayerNumber)->m_iColsPerPlayer);
|
||||||
for(size_t ncr= 0; ncr < m_ColumnRenderers.size(); ++ncr)
|
for(std::size_t ncr= 0; ncr < m_ColumnRenderers.size(); ++ncr)
|
||||||
{
|
{
|
||||||
FOREACH_EnabledPlayer(pn)
|
FOREACH_EnabledPlayer(pn)
|
||||||
{
|
{
|
||||||
@@ -314,7 +315,7 @@ void NoteField::Update( float fDeltaTime )
|
|||||||
ActorFrame::Update( fDeltaTime );
|
ActorFrame::Update( fDeltaTime );
|
||||||
ArrowEffects::SetCurrentOptions(&m_pPlayerState->m_PlayerOptions.GetCurrent());
|
ArrowEffects::SetCurrentOptions(&m_pPlayerState->m_PlayerOptions.GetCurrent());
|
||||||
|
|
||||||
for(size_t c= 0; c < m_ColumnRenderers.size(); ++c)
|
for(std::size_t c= 0; c < m_ColumnRenderers.size(); ++c)
|
||||||
{
|
{
|
||||||
m_ColumnRenderers[c].Update(fDeltaTime);
|
m_ColumnRenderers[c].Update(fDeltaTime);
|
||||||
}
|
}
|
||||||
@@ -801,7 +802,7 @@ void NoteField::DrawPrimitives()
|
|||||||
{
|
{
|
||||||
const std::vector<TimingSegment *> &tSigs = *segs[SEGMENT_TIME_SIG];
|
const std::vector<TimingSegment *> &tSigs = *segs[SEGMENT_TIME_SIG];
|
||||||
int iMeasureIndex = 0;
|
int iMeasureIndex = 0;
|
||||||
for (size_t i = 0; i < tSigs.size(); i++)
|
for (std::size_t i = 0; i < tSigs.size(); i++)
|
||||||
{
|
{
|
||||||
const TimeSignatureSegment *ts = ToTimeSignature(tSigs[i]);
|
const TimeSignatureSegment *ts = ToTimeSignature(tSigs[i]);
|
||||||
int iSegmentEndRow = (i + 1 == tSigs.size()) ? m_FieldRenderArgs.last_row : tSigs[i+1]->GetRow();
|
int iSegmentEndRow = (i + 1 == tSigs.size()) ? m_FieldRenderArgs.last_row : tSigs[i+1]->GetRow();
|
||||||
@@ -849,7 +850,7 @@ void NoteField::DrawPrimitives()
|
|||||||
#define draw_all_segments(str_exp, name, caps_name) \
|
#define draw_all_segments(str_exp, name, caps_name) \
|
||||||
horiz_align= caps_name##_IS_LEFT_SIDE ? align_right : align_left; \
|
horiz_align= caps_name##_IS_LEFT_SIDE ? align_right : align_left; \
|
||||||
side_sign= caps_name##_IS_LEFT_SIDE ? -1 : 1; \
|
side_sign= caps_name##_IS_LEFT_SIDE ? -1 : 1; \
|
||||||
for(size_t i= 0; i < segs[SEGMENT_##caps_name]->size(); ++i) \
|
for(std::size_t i= 0; i < segs[SEGMENT_##caps_name]->size(); ++i) \
|
||||||
{ \
|
{ \
|
||||||
const name##Segment* seg= To##name((*segs[SEGMENT_##caps_name])[i]); \
|
const name##Segment* seg= To##name((*segs[SEGMENT_##caps_name])[i]); \
|
||||||
if(seg->GetRow() >= m_FieldRenderArgs.first_row && \
|
if(seg->GetRow() >= m_FieldRenderArgs.first_row && \
|
||||||
@@ -1256,7 +1257,7 @@ public:
|
|||||||
static int get_column_actors(T* p, lua_State* L)
|
static int get_column_actors(T* p, lua_State* L)
|
||||||
{
|
{
|
||||||
lua_createtable(L, p->m_ColumnRenderers.size(), 0);
|
lua_createtable(L, p->m_ColumnRenderers.size(), 0);
|
||||||
for(size_t i= 0; i < p->m_ColumnRenderers.size(); ++i)
|
for(std::size_t i= 0; i < p->m_ColumnRenderers.size(); ++i)
|
||||||
{
|
{
|
||||||
p->m_ColumnRenderers[i].PushSelf(L);
|
p->m_ColumnRenderers[i].PushSelf(L);
|
||||||
lua_rawseti(L, -2, i+1);
|
lua_rawseti(L, -2, i+1);
|
||||||
|
|||||||
@@ -13,9 +13,11 @@
|
|||||||
#include "ActorUtil.h"
|
#include "ActorUtil.h"
|
||||||
#include "XmlFileUtil.h"
|
#include "XmlFileUtil.h"
|
||||||
#include "Sprite.h"
|
#include "Sprite.h"
|
||||||
#include <map>
|
|
||||||
#include "SpecialFiles.h"
|
#include "SpecialFiles.h"
|
||||||
|
|
||||||
|
#include <cstddef>
|
||||||
|
#include <map>
|
||||||
|
|
||||||
/** @brief Have the NoteSkinManager available throughout the program. */
|
/** @brief Have the NoteSkinManager available throughout the program. */
|
||||||
NoteSkinManager* NOTESKIN = nullptr; // global and accessible from anywhere in our program
|
NoteSkinManager* NOTESKIN = nullptr; // global and accessible from anywhere in our program
|
||||||
|
|
||||||
@@ -209,7 +211,7 @@ void NoteSkinManager::GetNoteSkinNames( const Game* pGame, std::vector<RString>
|
|||||||
|
|
||||||
bool NoteSkinManager::NoteSkinNameInList(const RString name, std::vector<RString> name_list)
|
bool NoteSkinManager::NoteSkinNameInList(const RString name, std::vector<RString> name_list)
|
||||||
{
|
{
|
||||||
for(size_t i= 0; i < name_list.size(); ++i)
|
for(std::size_t i= 0; i < name_list.size(); ++i)
|
||||||
{
|
{
|
||||||
if(0 == strcasecmp(name, name_list[i]))
|
if(0 == strcasecmp(name, name_list[i]))
|
||||||
{
|
{
|
||||||
|
|||||||
+3
-1
@@ -8,13 +8,15 @@
|
|||||||
#include "NotesLoaderKSF.h"
|
#include "NotesLoaderKSF.h"
|
||||||
#include "RageUtil.h"
|
#include "RageUtil.h"
|
||||||
|
|
||||||
|
#include <cstddef>
|
||||||
|
|
||||||
void NotesLoader::GetMainAndSubTitlesFromFullTitle( const RString &sFullTitle, RString &sMainTitleOut, RString &sSubTitleOut )
|
void NotesLoader::GetMainAndSubTitlesFromFullTitle( const RString &sFullTitle, RString &sMainTitleOut, RString &sSubTitleOut )
|
||||||
{
|
{
|
||||||
const RString sLeftSeps[] = { "\t", " -", " ~", " (", " [" };
|
const RString sLeftSeps[] = { "\t", " -", " ~", " (", " [" };
|
||||||
|
|
||||||
for( unsigned i=0; i<ARRAYLEN(sLeftSeps); i++ )
|
for( unsigned i=0; i<ARRAYLEN(sLeftSeps); i++ )
|
||||||
{
|
{
|
||||||
size_t iBeginIndex = sFullTitle.find( sLeftSeps[i] );
|
std::size_t iBeginIndex = sFullTitle.find( sLeftSeps[i] );
|
||||||
if( iBeginIndex == std::string::npos )
|
if( iBeginIndex == std::string::npos )
|
||||||
continue;
|
continue;
|
||||||
sMainTitleOut = sFullTitle.Left( (int) iBeginIndex );
|
sMainTitleOut = sFullTitle.Left( (int) iBeginIndex );
|
||||||
|
|||||||
@@ -18,6 +18,8 @@
|
|||||||
#include "ActorUtil.h"
|
#include "ActorUtil.h"
|
||||||
#include "RageFileManager.h"
|
#include "RageFileManager.h"
|
||||||
|
|
||||||
|
#include <cstddef>
|
||||||
|
|
||||||
/* BMS encoding: tap-hold
|
/* BMS encoding: tap-hold
|
||||||
* 4&8panel: Player1 Player2
|
* 4&8panel: Player1 Player2
|
||||||
* Left 11-51 21-61
|
* Left 11-51 21-61
|
||||||
@@ -408,14 +410,14 @@ struct bmsCommandTree
|
|||||||
return;
|
return;
|
||||||
|
|
||||||
// LTrim the statement to allow indentation
|
// LTrim the statement to allow indentation
|
||||||
size_t hash = statement.find('#');
|
std::size_t hash = statement.find('#');
|
||||||
|
|
||||||
if (hash == RString::npos)
|
if (hash == RString::npos)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
statement = statement.substr(hash);
|
statement = statement.substr(hash);
|
||||||
|
|
||||||
size_t space = statement.find(' ');
|
std::size_t space = statement.find(' ');
|
||||||
RString name = statement.substr(0, space);
|
RString name = statement.substr(0, space);
|
||||||
RString value = "";
|
RString value = "";
|
||||||
|
|
||||||
@@ -649,7 +651,7 @@ int BMSSong::AllocateKeysound( RString filename, RString path )
|
|||||||
if( !IsAFile(dir + normalizedFilename) )
|
if( !IsAFile(dir + normalizedFilename) )
|
||||||
{
|
{
|
||||||
std::vector<RString> const& exts= ActorUtil::GetTypeExtensionList(FT_Sound);
|
std::vector<RString> const& exts= ActorUtil::GetTypeExtensionList(FT_Sound);
|
||||||
for(size_t i = 0; i < exts.size(); ++i)
|
for(std::size_t i = 0; i < exts.size(); ++i)
|
||||||
{
|
{
|
||||||
RString fn = SetExtension( normalizedFilename, exts[i] );
|
RString fn = SetExtension( normalizedFilename, exts[i] );
|
||||||
if( IsAFile(dir + fn) )
|
if( IsAFile(dir + fn) )
|
||||||
@@ -716,7 +718,7 @@ bool BMSSong::GetBackground( RString filename, RString path, RString &bgfile )
|
|||||||
std::vector<RString> exts;
|
std::vector<RString> exts;
|
||||||
ActorUtil::AddTypeExtensionsToList(FT_Movie, exts);
|
ActorUtil::AddTypeExtensionsToList(FT_Movie, exts);
|
||||||
ActorUtil::AddTypeExtensionsToList(FT_Bitmap, exts);
|
ActorUtil::AddTypeExtensionsToList(FT_Bitmap, exts);
|
||||||
for(size_t i = 0; i < exts.size(); ++i)
|
for(std::size_t i = 0; i < exts.size(); ++i)
|
||||||
{
|
{
|
||||||
RString fn = SetExtension( normalizedFilename, exts[i] );
|
RString fn = SetExtension( normalizedFilename, exts[i] );
|
||||||
if( IsAFile(dir + fn) )
|
if( IsAFile(dir + fn) )
|
||||||
|
|||||||
@@ -12,6 +12,7 @@
|
|||||||
#include "PrefsManager.h"
|
#include "PrefsManager.h"
|
||||||
#include "Difficulty.h"
|
#include "Difficulty.h"
|
||||||
|
|
||||||
|
#include <cstddef>
|
||||||
#include <map>
|
#include <map>
|
||||||
|
|
||||||
Difficulty DwiCompatibleStringToDifficulty( const RString& sDC );
|
Difficulty DwiCompatibleStringToDifficulty( const RString& sDC );
|
||||||
@@ -127,7 +128,7 @@ static void DWIcharToNoteCol( char c, GameController i, int &col1Out, int &col2O
|
|||||||
* @param pos the position of the step data.
|
* @param pos the position of the step data.
|
||||||
* @return true if it's a 192nd note, false otherwise.
|
* @return true if it's a 192nd note, false otherwise.
|
||||||
*/
|
*/
|
||||||
static bool Is192( const RString &sStepData, size_t pos )
|
static bool Is192( const RString &sStepData, std::size_t pos )
|
||||||
{
|
{
|
||||||
while( pos < sStepData.size() )
|
while( pos < sStepData.size() )
|
||||||
{
|
{
|
||||||
@@ -245,7 +246,7 @@ static NoteData ParseNoteData(RString &step1, RString &step2,
|
|||||||
double fCurrentBeat = 0;
|
double fCurrentBeat = 0;
|
||||||
double fCurrentIncrementer = 1.0/8 * BEATS_PER_MEASURE;
|
double fCurrentIncrementer = 1.0/8 * BEATS_PER_MEASURE;
|
||||||
|
|
||||||
for( size_t i=0; i<sStepData.size(); )
|
for( std::size_t i=0; i<sStepData.size(); )
|
||||||
{
|
{
|
||||||
char c = sStepData[i++];
|
char c = sStepData[i++];
|
||||||
switch( c )
|
switch( c )
|
||||||
@@ -719,14 +720,14 @@ bool DWILoader::LoadFromDir( const RString &sPath_, Song &out, std::set<RString>
|
|||||||
* to pick up images used here as song images (eg. banners). */
|
* to pick up images used here as song images (eg. banners). */
|
||||||
RString param = sParams[1];
|
RString param = sParams[1];
|
||||||
/* "{foo} ... {foo2}" */
|
/* "{foo} ... {foo2}" */
|
||||||
size_t pos = 0;
|
std::size_t pos = 0;
|
||||||
while( pos < RString::npos )
|
while( pos < RString::npos )
|
||||||
{
|
{
|
||||||
|
|
||||||
size_t startpos = param.find('{', pos);
|
std::size_t startpos = param.find('{', pos);
|
||||||
if( startpos == RString::npos )
|
if( startpos == RString::npos )
|
||||||
break;
|
break;
|
||||||
size_t endpos = param.find('}', startpos);
|
std::size_t endpos = param.find('}', startpos);
|
||||||
if( endpos == RString::npos )
|
if( endpos == RString::npos )
|
||||||
break;
|
break;
|
||||||
|
|
||||||
|
|||||||
@@ -13,6 +13,8 @@
|
|||||||
#include "Attack.h"
|
#include "Attack.h"
|
||||||
#include "PrefsManager.h"
|
#include "PrefsManager.h"
|
||||||
|
|
||||||
|
#include <cstddef>
|
||||||
|
|
||||||
// Everything from this line to the creation of sm_parser_helper exists to
|
// Everything from this line to the creation of sm_parser_helper exists to
|
||||||
// speed up parsing by allowing the use of std::map. All these functions
|
// speed up parsing by allowing the use of std::map. All these functions
|
||||||
// are put into a map of function pointers which is used when loading.
|
// are put into a map of function pointers which is used when loading.
|
||||||
@@ -1388,9 +1390,9 @@ void SMLoader::ParseBGChangesString(const RString& _sChanges, std::vector<std::v
|
|||||||
|
|
||||||
// strip newlines (basically operates as both split and join at the same time)
|
// strip newlines (basically operates as both split and join at the same time)
|
||||||
RString sChanges;
|
RString sChanges;
|
||||||
size_t start = 0;
|
std::size_t start = 0;
|
||||||
do {
|
do {
|
||||||
size_t pos = _sChanges.find_first_of("\r\n", start);
|
std::size_t pos = _sChanges.find_first_of("\r\n", start);
|
||||||
if (RString::npos == pos)
|
if (RString::npos == pos)
|
||||||
pos = _sChanges.size();
|
pos = _sChanges.size();
|
||||||
|
|
||||||
@@ -1429,7 +1431,7 @@ void SMLoader::ParseBGChangesString(const RString& _sChanges, std::vector<std::v
|
|||||||
// the string itself matches
|
// the string itself matches
|
||||||
if (f.EqualsNoCase(sChanges.substr(start, f.size()).c_str()))
|
if (f.EqualsNoCase(sChanges.substr(start, f.size()).c_str()))
|
||||||
{
|
{
|
||||||
size_t nextpos = start + f.size();
|
std::size_t nextpos = start + f.size();
|
||||||
|
|
||||||
// is this name followed by end-of-string, equals, or comma?
|
// is this name followed by end-of-string, equals, or comma?
|
||||||
if ((nextpos == sChanges.size()) || (sChanges[nextpos] == '=') || (sChanges[nextpos] == ','))
|
if ((nextpos == sChanges.size()) || (sChanges[nextpos] == '=') || (sChanges[nextpos] == ','))
|
||||||
@@ -1467,8 +1469,8 @@ void SMLoader::ParseBGChangesString(const RString& _sChanges, std::vector<std::v
|
|||||||
if(0 == pnum) vvsAddTo.push_back(std::vector<RString>()); // first value of this set. create our vector
|
if(0 == pnum) vvsAddTo.push_back(std::vector<RString>()); // first value of this set. create our vector
|
||||||
|
|
||||||
{
|
{
|
||||||
size_t eqpos = sChanges.find('=', start);
|
std::size_t eqpos = sChanges.find('=', start);
|
||||||
size_t compos = sChanges.find(',', start);
|
std::size_t compos = sChanges.find(',', start);
|
||||||
|
|
||||||
if ((eqpos == RString::npos) && (compos == RString::npos))
|
if ((eqpos == RString::npos) && (compos == RString::npos))
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -14,6 +14,8 @@
|
|||||||
#include "Attack.h"
|
#include "Attack.h"
|
||||||
#include "PrefsManager.h"
|
#include "PrefsManager.h"
|
||||||
|
|
||||||
|
#include <cstddef>
|
||||||
|
|
||||||
// Everything from this line to the creation of parser_helper exists to
|
// Everything from this line to the creation of parser_helper exists to
|
||||||
// speed up parsing by allowing the use of std::map. All these functions
|
// speed up parsing by allowing the use of std::map. All these functions
|
||||||
// are put into a map of function pointers which is used when loading.
|
// are put into a map of function pointers which is used when loading.
|
||||||
@@ -362,11 +364,11 @@ void SetRadarValues(StepsTagInfo& info)
|
|||||||
// Instead of trying to use the version to figure out how many
|
// Instead of trying to use the version to figure out how many
|
||||||
// categories to expect, look at the number of values and split them
|
// categories to expect, look at the number of values and split them
|
||||||
// evenly. -Kyz
|
// evenly. -Kyz
|
||||||
size_t cats_per_player= values.size() / NUM_PlayerNumber;
|
std::size_t cats_per_player= values.size() / NUM_PlayerNumber;
|
||||||
RadarValues v[NUM_PLAYERS];
|
RadarValues v[NUM_PLAYERS];
|
||||||
FOREACH_PlayerNumber(pn)
|
FOREACH_PlayerNumber(pn)
|
||||||
{
|
{
|
||||||
for(size_t i= 0; i < cats_per_player; ++i)
|
for(std::size_t i= 0; i < cats_per_player; ++i)
|
||||||
{
|
{
|
||||||
v[pn][i]= StringToFloat(values[pn * cats_per_player + i]);
|
v[pn][i]= StringToFloat(values[pn * cats_per_player + i]);
|
||||||
}
|
}
|
||||||
|
|||||||
+3
-2
@@ -12,6 +12,7 @@
|
|||||||
#include "ActorUtil.h"
|
#include "ActorUtil.h"
|
||||||
|
|
||||||
#include <cmath>
|
#include <cmath>
|
||||||
|
#include <cstddef>
|
||||||
|
|
||||||
const RString NEXT_ROW_NAME = "NextRow";
|
const RString NEXT_ROW_NAME = "NextRow";
|
||||||
const RString EXIT_NAME = "Exit";
|
const RString EXIT_NAME = "Exit";
|
||||||
@@ -29,8 +30,8 @@ RString OptionRow::GetThemedItemText( int iChoice ) const
|
|||||||
return s;
|
return s;
|
||||||
}
|
}
|
||||||
|
|
||||||
RString ITEMS_LONG_ROW_X_NAME( size_t p ) { return ssprintf("ItemsLongRowP%dX",int(p+1)); }
|
RString ITEMS_LONG_ROW_X_NAME( std::size_t p ) { return ssprintf("ItemsLongRowP%dX",int(p+1)); }
|
||||||
RString MOD_ICON_X_NAME( size_t p ) { return ssprintf("ModIconP%dX",int(p+1)); }
|
RString MOD_ICON_X_NAME( std::size_t p ) { return ssprintf("ModIconP%dX",int(p+1)); }
|
||||||
|
|
||||||
OptionRow::OptionRow( const OptionRowType *pSource )
|
OptionRow::OptionRow( const OptionRowType *pSource )
|
||||||
{
|
{
|
||||||
|
|||||||
+4
-2
@@ -9,14 +9,16 @@
|
|||||||
#include "ModIcon.h"
|
#include "ModIcon.h"
|
||||||
#include "ThemeMetric.h"
|
#include "ThemeMetric.h"
|
||||||
#include "AutoActor.h"
|
#include "AutoActor.h"
|
||||||
|
|
||||||
#include <array>
|
#include <array>
|
||||||
|
#include <cstddef>
|
||||||
|
|
||||||
class OptionRowHandler;
|
class OptionRowHandler;
|
||||||
class GameCommand;
|
class GameCommand;
|
||||||
struct OptionRowDefinition;
|
struct OptionRowDefinition;
|
||||||
|
|
||||||
RString ITEMS_LONG_ROW_X_NAME( size_t p );
|
RString ITEMS_LONG_ROW_X_NAME( std::size_t p );
|
||||||
RString MOD_ICON_X_NAME( size_t p );
|
RString MOD_ICON_X_NAME( std::size_t p );
|
||||||
|
|
||||||
class OptionRowType
|
class OptionRowType
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -4,7 +4,10 @@
|
|||||||
#include "GameCommand.h"
|
#include "GameCommand.h"
|
||||||
#include "LuaReference.h"
|
#include "LuaReference.h"
|
||||||
#include "RageUtil.h"
|
#include "RageUtil.h"
|
||||||
|
|
||||||
|
#include <cstddef>
|
||||||
#include <set>
|
#include <set>
|
||||||
|
|
||||||
struct MenuRowDef;
|
struct MenuRowDef;
|
||||||
class OptionRow;
|
class OptionRow;
|
||||||
struct ConfOption;
|
struct ConfOption;
|
||||||
@@ -205,7 +208,7 @@ inline void VerifySelected(SelectType st, std::vector<bool> &selected, const RSt
|
|||||||
int num_selected = 0;
|
int num_selected = 0;
|
||||||
if( st == SELECT_ONE )
|
if( st == SELECT_ONE )
|
||||||
{
|
{
|
||||||
size_t first_selected= std::numeric_limits<size_t>::max();
|
std::size_t first_selected= std::numeric_limits<std::size_t>::max();
|
||||||
if(selected.empty())
|
if(selected.empty())
|
||||||
{
|
{
|
||||||
LuaHelpers::ReportScriptErrorFmt("Option row %s requires only one "
|
LuaHelpers::ReportScriptErrorFmt("Option row %s requires only one "
|
||||||
@@ -213,12 +216,12 @@ inline void VerifySelected(SelectType st, std::vector<bool> &selected, const RSt
|
|||||||
"elements.", sName.c_str());
|
"elements.", sName.c_str());
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
for(size_t e= 0; e < selected.size(); ++e)
|
for(std::size_t e= 0; e < selected.size(); ++e)
|
||||||
{
|
{
|
||||||
if(selected[e])
|
if(selected[e])
|
||||||
{
|
{
|
||||||
num_selected++;
|
num_selected++;
|
||||||
if(first_selected == std::numeric_limits<size_t>::max())
|
if(first_selected == std::numeric_limits<std::size_t>::max())
|
||||||
{
|
{
|
||||||
first_selected= e;
|
first_selected= e;
|
||||||
}
|
}
|
||||||
@@ -229,7 +232,7 @@ inline void VerifySelected(SelectType st, std::vector<bool> &selected, const RSt
|
|||||||
LuaHelpers::ReportScriptErrorFmt("Option row %s requires only one "
|
LuaHelpers::ReportScriptErrorFmt("Option row %s requires only one "
|
||||||
"thing to be selected, but %i out of %i things are selected.",
|
"thing to be selected, but %i out of %i things are selected.",
|
||||||
sName.c_str(), num_selected, static_cast<int>(selected.size()));
|
sName.c_str(), num_selected, static_cast<int>(selected.size()));
|
||||||
for(size_t e= 0; e < selected.size(); ++e)
|
for(std::size_t e= 0; e < selected.size(); ++e)
|
||||||
{
|
{
|
||||||
if(selected[e] && e != first_selected)
|
if(selected[e] && e != first_selected)
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -5,6 +5,9 @@
|
|||||||
|
|
||||||
#ifndef OptionsBinding_H
|
#ifndef OptionsBinding_H
|
||||||
#define OptionsBinding_H
|
#define OptionsBinding_H
|
||||||
|
|
||||||
|
#include <cstddef>
|
||||||
|
|
||||||
// Functions are designed to combine Get and Set into one, to be less clumsy to use. -Kyz
|
// Functions are designed to combine Get and Set into one, to be less clumsy to use. -Kyz
|
||||||
// If a valid arg is passed, the value is set.
|
// If a valid arg is passed, the value is set.
|
||||||
// The previous value is returned.
|
// The previous value is returned.
|
||||||
@@ -103,19 +106,19 @@
|
|||||||
{ \
|
{ \
|
||||||
int original_top= lua_gettop(L); \
|
int original_top= lua_gettop(L); \
|
||||||
lua_createtable(L, p->m_ ## member.size(), 0); \
|
lua_createtable(L, p->m_ ## member.size(), 0); \
|
||||||
for(size_t n= 0; n < p->m_ ## member.size(); ++n) \
|
for(std::size_t n= 0; n < p->m_ ## member.size(); ++n) \
|
||||||
{ \
|
{ \
|
||||||
lua_pushnumber(L, p->m_ ## member[n]); \
|
lua_pushnumber(L, p->m_ ## member[n]); \
|
||||||
lua_rawseti(L, -2, n+1); \
|
lua_rawseti(L, -2, n+1); \
|
||||||
} \
|
} \
|
||||||
if(lua_istable(L, 1) && original_top >= 1) \
|
if(lua_istable(L, 1) && original_top >= 1) \
|
||||||
{ \
|
{ \
|
||||||
size_t size= lua_objlen(L, 1); \
|
std::size_t size= lua_objlen(L, 1); \
|
||||||
if(valid(L, 1)) \
|
if(valid(L, 1)) \
|
||||||
{ \
|
{ \
|
||||||
p->m_ ## member.clear(); \
|
p->m_ ## member.clear(); \
|
||||||
p->m_ ## member.reserve(size); \
|
p->m_ ## member.reserve(size); \
|
||||||
for(size_t n= 1; n <= size; ++n) \
|
for(std::size_t n= 1; n <= size; ++n) \
|
||||||
{ \
|
{ \
|
||||||
lua_pushnumber(L, n); \
|
lua_pushnumber(L, n); \
|
||||||
lua_gettable(L, 1); \
|
lua_gettable(L, 1); \
|
||||||
|
|||||||
+4
-2
@@ -11,6 +11,8 @@
|
|||||||
#include "InputMapper.h"
|
#include "InputMapper.h"
|
||||||
#include "PlayerState.h"
|
#include "PlayerState.h"
|
||||||
|
|
||||||
|
#include <cstddef>
|
||||||
|
|
||||||
#define LINE(sLineName) THEME->GetMetric (m_sName,ssprintf("Line%s",sLineName.c_str()))
|
#define LINE(sLineName) THEME->GetMetric (m_sName,ssprintf("Line%s",sLineName.c_str()))
|
||||||
#define MAX_ITEMS_BEFORE_SPLIT THEME->GetMetricI(m_sName,"MaxItemsBeforeSplit")
|
#define MAX_ITEMS_BEFORE_SPLIT THEME->GetMetricI(m_sName,"MaxItemsBeforeSplit")
|
||||||
#define ITEMS_SPLIT_WIDTH THEME->GetMetricF(m_sName,"ItemsSplitWidth")
|
#define ITEMS_SPLIT_WIDTH THEME->GetMetricF(m_sName,"ItemsSplitWidth")
|
||||||
@@ -229,7 +231,7 @@ void OptionsList::Load( RString sType, PlayerNumber pn )
|
|||||||
m_Rows[sLineName] = pHand;
|
m_Rows[sLineName] = pHand;
|
||||||
m_asLoadedRows.push_back( sLineName );
|
m_asLoadedRows.push_back( sLineName );
|
||||||
|
|
||||||
for( size_t i = 0; i < pHand->m_Def.m_vsChoices.size(); ++i )
|
for( std::size_t i = 0; i < pHand->m_Def.m_vsChoices.size(); ++i )
|
||||||
{
|
{
|
||||||
RString sScreen = pHand->GetScreen(i);
|
RString sScreen = pHand->GetScreen(i);
|
||||||
if( !sScreen.empty() )
|
if( !sScreen.empty() )
|
||||||
@@ -570,7 +572,7 @@ void OptionsList::SetDefaultCurrentRow()
|
|||||||
|
|
||||||
int OptionsList::FindScreenInHandler( const OptionRowHandler *pHandler, RString sScreen )
|
int OptionsList::FindScreenInHandler( const OptionRowHandler *pHandler, RString sScreen )
|
||||||
{
|
{
|
||||||
for( size_t i = 0; i < pHandler->m_Def.m_vsChoices.size(); ++i )
|
for( std::size_t i = 0; i < pHandler->m_Def.m_vsChoices.size(); ++i )
|
||||||
{
|
{
|
||||||
if( pHandler->GetScreen(i) == sScreen )
|
if( pHandler->GetScreen(i) == sScreen )
|
||||||
return i;
|
return i;
|
||||||
|
|||||||
+10
-9
@@ -42,9 +42,10 @@
|
|||||||
#include "AdjustSync.h"
|
#include "AdjustSync.h"
|
||||||
|
|
||||||
#include <cmath>
|
#include <cmath>
|
||||||
|
#include <cstddef>
|
||||||
|
|
||||||
RString ATTACK_DISPLAY_X_NAME( size_t p, size_t both_sides );
|
RString ATTACK_DISPLAY_X_NAME( std::size_t p, std::size_t both_sides );
|
||||||
void TimingWindowSecondsInit( size_t /*TimingWindow*/ i, RString &sNameOut, float &defaultValueOut );
|
void TimingWindowSecondsInit( std::size_t /*TimingWindow*/ i, RString &sNameOut, float &defaultValueOut );
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @brief Helper class to ensure that each row is only judged once without taking too much memory.
|
* @brief Helper class to ensure that each row is only judged once without taking too much memory.
|
||||||
@@ -55,9 +56,9 @@ class JudgedRows
|
|||||||
int m_iStart;
|
int m_iStart;
|
||||||
int m_iOffset;
|
int m_iOffset;
|
||||||
|
|
||||||
void Resize( size_t iMin )
|
void Resize( std::size_t iMin )
|
||||||
{
|
{
|
||||||
size_t iNewSize = std::max( 2*m_vRows.size(), iMin );
|
std::size_t iNewSize = std::max( 2*m_vRows.size(), iMin );
|
||||||
std::vector<bool> vNewRows( m_vRows.begin() + m_iOffset, m_vRows.end() );
|
std::vector<bool> vNewRows( m_vRows.begin() + m_iOffset, m_vRows.end() );
|
||||||
vNewRows.reserve( iNewSize );
|
vNewRows.reserve( iNewSize );
|
||||||
vNewRows.insert( vNewRows.end(), m_vRows.begin(), m_vRows.begin() + m_iOffset );
|
vNewRows.insert( vNewRows.end(), m_vRows.begin(), m_vRows.begin() + m_iOffset );
|
||||||
@@ -95,7 +96,7 @@ public:
|
|||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
RString ATTACK_DISPLAY_X_NAME( size_t p, size_t both_sides ) { return "AttackDisplayXOffset" + (both_sides ? RString("BothSides") : ssprintf("OneSideP%d",int(p+1)) ); }
|
RString ATTACK_DISPLAY_X_NAME( std::size_t p, std::size_t both_sides ) { return "AttackDisplayXOffset" + (both_sides ? RString("BothSides") : ssprintf("OneSideP%d",int(p+1)) ); }
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @brief Distance to search for a note in Step(), in seconds.
|
* @brief Distance to search for a note in Step(), in seconds.
|
||||||
@@ -103,7 +104,7 @@ RString ATTACK_DISPLAY_X_NAME( size_t p, size_t both_sides ) { return "AttackDis
|
|||||||
* TODO: This should be calculated based on the max size of the current judgment windows. */
|
* TODO: This should be calculated based on the max size of the current judgment windows. */
|
||||||
static const float StepSearchDistance = 1.0f;
|
static const float StepSearchDistance = 1.0f;
|
||||||
|
|
||||||
void TimingWindowSecondsInit( size_t /*TimingWindow*/ i, RString &sNameOut, float &defaultValueOut )
|
void TimingWindowSecondsInit( std::size_t /*TimingWindow*/ i, RString &sNameOut, float &defaultValueOut )
|
||||||
{
|
{
|
||||||
sNameOut = "TimingWindowSeconds" + TimingWindowToString( static_cast<TimingWindow>(i) );
|
sNameOut = "TimingWindowSeconds" + TimingWindowToString( static_cast<TimingWindow>(i) );
|
||||||
switch( i )
|
switch( i )
|
||||||
@@ -2161,7 +2162,7 @@ void Player::Step( int col, int row, const RageTimer &tm, bool bHeld, bool bRele
|
|||||||
std::vector<GameInput> GameI;
|
std::vector<GameInput> GameI;
|
||||||
GAMESTATE->GetCurrentStyle(GetPlayerState()->m_PlayerNumber)->StyleInputToGameInput( t, pn, GameI );
|
GAMESTATE->GetCurrentStyle(GetPlayerState()->m_PlayerNumber)->StyleInputToGameInput( t, pn, GameI );
|
||||||
float secs_held= 0.0f;
|
float secs_held= 0.0f;
|
||||||
for(size_t i= 0; i < GameI.size(); ++i)
|
for(std::size_t i= 0; i < GameI.size(); ++i)
|
||||||
{
|
{
|
||||||
secs_held= std::max(secs_held, INPUTMAPPER->GetSecsHeld( GameI[i] ));
|
secs_held= std::max(secs_held, INPUTMAPPER->GetSecsHeld( GameI[i] ));
|
||||||
}
|
}
|
||||||
@@ -2796,7 +2797,7 @@ void Player::CrossedRows( int iLastRowCrossed, const RageTimer &now )
|
|||||||
GAMESTATE->GetCurrentStyle(GetPlayerState()->m_PlayerNumber)->StyleInputToGameInput( iTrack, pn, GameI );
|
GAMESTATE->GetCurrentStyle(GetPlayerState()->m_PlayerNumber)->StyleInputToGameInput( iTrack, pn, GameI );
|
||||||
if( PREFSMAN->m_fPadStickSeconds > 0.f )
|
if( PREFSMAN->m_fPadStickSeconds > 0.f )
|
||||||
{
|
{
|
||||||
for(size_t i= 0; i < GameI.size(); ++i)
|
for(std::size_t i= 0; i < GameI.size(); ++i)
|
||||||
{
|
{
|
||||||
float fSecsHeld = INPUTMAPPER->GetSecsHeld(GameI[i], m_pPlayerState->m_mp);
|
float fSecsHeld = INPUTMAPPER->GetSecsHeld(GameI[i], m_pPlayerState->m_mp);
|
||||||
if(fSecsHeld >= PREFSMAN->m_fPadStickSeconds)
|
if(fSecsHeld >= PREFSMAN->m_fPadStickSeconds)
|
||||||
@@ -2824,7 +2825,7 @@ void Player::CrossedRows( int iLastRowCrossed, const RageTimer &now )
|
|||||||
GAMESTATE->GetCurrentStyle(GetPlayerState()->m_PlayerNumber)->StyleInputToGameInput( iTrack, pn, GameI );
|
GAMESTATE->GetCurrentStyle(GetPlayerState()->m_PlayerNumber)->StyleInputToGameInput( iTrack, pn, GameI );
|
||||||
if( PREFSMAN->m_fPadStickSeconds > 0.0f )
|
if( PREFSMAN->m_fPadStickSeconds > 0.0f )
|
||||||
{
|
{
|
||||||
for(size_t i= 0; i < GameI.size(); ++i)
|
for(std::size_t i= 0; i < GameI.size(); ++i)
|
||||||
{
|
{
|
||||||
float fSecsHeld = INPUTMAPPER->GetSecsHeld(GameI[i], m_pPlayerState->m_mp);
|
float fSecsHeld = INPUTMAPPER->GetSecsHeld(GameI[i], m_pPlayerState->m_mp);
|
||||||
if(fSecsHeld >= PREFSMAN->m_fPadStickSeconds)
|
if(fSecsHeld >= PREFSMAN->m_fPadStickSeconds)
|
||||||
|
|||||||
@@ -12,6 +12,7 @@
|
|||||||
|
|
||||||
#include <cfloat>
|
#include <cfloat>
|
||||||
#include <cmath>
|
#include <cmath>
|
||||||
|
#include <cstddef>
|
||||||
#include <numeric>
|
#include <numeric>
|
||||||
|
|
||||||
#define GRADE_PERCENT_TIER(i) THEME->GetMetricF("PlayerStageStats",ssprintf("GradePercent%s",GradeToString((Grade)i).c_str()))
|
#define GRADE_PERCENT_TIER(i) THEME->GetMetricF("PlayerStageStats",ssprintf("GradePercent%s",GradeToString((Grade)i).c_str()))
|
||||||
@@ -792,7 +793,7 @@ public:
|
|||||||
static int GetComboList( T* p, lua_State *L )
|
static int GetComboList( T* p, lua_State *L )
|
||||||
{
|
{
|
||||||
lua_createtable(L, p->m_ComboList.size(), 0);
|
lua_createtable(L, p->m_ComboList.size(), 0);
|
||||||
for( size_t i= 0; i < p->m_ComboList.size(); ++i)
|
for( std::size_t i= 0; i < p->m_ComboList.size(); ++i)
|
||||||
{
|
{
|
||||||
lua_createtable(L, 0, 6);
|
lua_createtable(L, 0, 6);
|
||||||
lua_pushstring(L, "StartSecond");
|
lua_pushstring(L, "StartSecond");
|
||||||
|
|||||||
+8
-5
@@ -6,6 +6,9 @@
|
|||||||
#include "EnumHelper.h"
|
#include "EnumHelper.h"
|
||||||
#include "LuaManager.h"
|
#include "LuaManager.h"
|
||||||
#include "RageUtil.h"
|
#include "RageUtil.h"
|
||||||
|
|
||||||
|
#include <cstddef>
|
||||||
|
|
||||||
class XNode;
|
class XNode;
|
||||||
|
|
||||||
enum class PreferenceType
|
enum class PreferenceType
|
||||||
@@ -149,9 +152,9 @@ public:
|
|||||||
typedef Preference<T> PreferenceT;
|
typedef Preference<T> PreferenceT;
|
||||||
std::vector<PreferenceT*> m_v;
|
std::vector<PreferenceT*> m_v;
|
||||||
|
|
||||||
Preference1D( void pfn(size_t i, RString &sNameOut, T &defaultValueOut ), size_t N, PreferenceType type = PreferenceType::Mutable )
|
Preference1D( void pfn(std::size_t i, RString &sNameOut, T &defaultValueOut ), std::size_t N, PreferenceType type = PreferenceType::Mutable )
|
||||||
{
|
{
|
||||||
for( size_t i=0; i<N; ++i )
|
for( std::size_t i=0; i<N; ++i )
|
||||||
{
|
{
|
||||||
RString sName;
|
RString sName;
|
||||||
T defaultValue;
|
T defaultValue;
|
||||||
@@ -162,14 +165,14 @@ public:
|
|||||||
|
|
||||||
~Preference1D()
|
~Preference1D()
|
||||||
{
|
{
|
||||||
for( size_t i=0; i<m_v.size(); ++i )
|
for( std::size_t i=0; i<m_v.size(); ++i )
|
||||||
SAFE_DELETE( m_v[i] );
|
SAFE_DELETE( m_v[i] );
|
||||||
}
|
}
|
||||||
const Preference<T>& operator[]( size_t i ) const
|
const Preference<T>& operator[]( std::size_t i ) const
|
||||||
{
|
{
|
||||||
return *m_v[i];
|
return *m_v[i];
|
||||||
}
|
}
|
||||||
Preference<T>& operator[]( size_t i )
|
Preference<T>& operator[]( std::size_t i )
|
||||||
{
|
{
|
||||||
return *m_v[i];
|
return *m_v[i];
|
||||||
}
|
}
|
||||||
|
|||||||
+6
-5
@@ -27,6 +27,7 @@
|
|||||||
#include "Character.h"
|
#include "Character.h"
|
||||||
|
|
||||||
#include <algorithm>
|
#include <algorithm>
|
||||||
|
#include <cstddef>
|
||||||
|
|
||||||
const RString STATS_XML = "Stats.xml";
|
const RString STATS_XML = "Stats.xml";
|
||||||
const RString STATS_XML_GZ = "Stats.xml.gz";
|
const RString STATS_XML_GZ = "Stats.xml.gz";
|
||||||
@@ -81,7 +82,7 @@ void Profile::ClearSongs()
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
Song* gamestate_curr_song= GAMESTATE->m_pCurSong;
|
Song* gamestate_curr_song= GAMESTATE->m_pCurSong;
|
||||||
for(size_t i= 0; i < m_songs.size(); ++i)
|
for(std::size_t i= 0; i < m_songs.size(); ++i)
|
||||||
{
|
{
|
||||||
Song* curr_song= m_songs[i];
|
Song* curr_song= m_songs[i];
|
||||||
if(curr_song == gamestate_curr_song)
|
if(curr_song == gamestate_curr_song)
|
||||||
@@ -920,10 +921,10 @@ void Profile::MergeScoresFromOtherProfile(Profile* other, bool skip_totals,
|
|||||||
{
|
{
|
||||||
// The old screenshot count is stored so we know where to start in the
|
// The old screenshot count is stored so we know where to start in the
|
||||||
// list when copying the screenshot images.
|
// list when copying the screenshot images.
|
||||||
size_t old_count= m_vScreenshots.size();
|
std::size_t old_count= m_vScreenshots.size();
|
||||||
m_vScreenshots.insert(m_vScreenshots.end(),
|
m_vScreenshots.insert(m_vScreenshots.end(),
|
||||||
other->m_vScreenshots.begin(), other->m_vScreenshots.end());
|
other->m_vScreenshots.begin(), other->m_vScreenshots.end());
|
||||||
for(size_t sid= old_count; sid < m_vScreenshots.size(); ++sid)
|
for(std::size_t sid= old_count; sid < m_vScreenshots.size(); ++sid)
|
||||||
{
|
{
|
||||||
RString old_path= from_dir + "Screenshots/" + m_vScreenshots[sid].sFileName;
|
RString old_path= from_dir + "Screenshots/" + m_vScreenshots[sid].sFileName;
|
||||||
RString new_path= to_dir + "Screenshots/" + m_vScreenshots[sid].sFileName;
|
RString new_path= to_dir + "Screenshots/" + m_vScreenshots[sid].sFileName;
|
||||||
@@ -1194,7 +1195,7 @@ void Profile::LoadSongsFromDir(RString const& dir, ProfileSlot prof_slot)
|
|||||||
StripMacResourceForks(song_folders);
|
StripMacResourceForks(song_folders);
|
||||||
LOG->Trace("Found %i songs in profile.", int(song_folders.size()));
|
LOG->Trace("Found %i songs in profile.", int(song_folders.size()));
|
||||||
// Only songs that are successfully loaded count towards the limit. -Kyz
|
// Only songs that are successfully loaded count towards the limit. -Kyz
|
||||||
for(size_t song_index= 0; song_index < song_folders.size()
|
for(std::size_t song_index= 0; song_index < song_folders.size()
|
||||||
&& m_songs.size() < PREFSMAN->m_custom_songs_max_count;
|
&& m_songs.size() < PREFSMAN->m_custom_songs_max_count;
|
||||||
++song_index)
|
++song_index)
|
||||||
{
|
{
|
||||||
@@ -2780,7 +2781,7 @@ public:
|
|||||||
{
|
{
|
||||||
lua_createtable(L, p->m_songs.size(), 0);
|
lua_createtable(L, p->m_songs.size(), 0);
|
||||||
int song_tab= lua_gettop(L);
|
int song_tab= lua_gettop(L);
|
||||||
for(size_t i= 0; i < p->m_songs.size(); ++i)
|
for(std::size_t i= 0; i < p->m_songs.size(); ++i)
|
||||||
{
|
{
|
||||||
p->m_songs[i]->PushSelf(L);
|
p->m_songs[i]->PushSelf(L);
|
||||||
lua_rawseti(L, song_tab, i+1);
|
lua_rawseti(L, song_tab, i+1);
|
||||||
|
|||||||
+12
-11
@@ -24,6 +24,7 @@
|
|||||||
#include "Character.h"
|
#include "Character.h"
|
||||||
#include "CharacterManager.h"
|
#include "CharacterManager.h"
|
||||||
|
|
||||||
|
#include <cstddef>
|
||||||
|
|
||||||
ProfileManager* PROFILEMAN = nullptr; // global and accessible from anywhere in our program
|
ProfileManager* PROFILEMAN = nullptr; // global and accessible from anywhere in our program
|
||||||
|
|
||||||
@@ -31,7 +32,7 @@ ProfileManager* PROFILEMAN = nullptr; // global and accessible from anywhere in
|
|||||||
#define ID_DIGITS_STR "8"
|
#define ID_DIGITS_STR "8"
|
||||||
#define MAX_ID 99999999
|
#define MAX_ID 99999999
|
||||||
|
|
||||||
static void DefaultLocalProfileIDInit( size_t /*PlayerNumber*/ i, RString &sNameOut, RString &defaultValueOut )
|
static void DefaultLocalProfileIDInit( std::size_t /*PlayerNumber*/ i, RString &sNameOut, RString &defaultValueOut )
|
||||||
{
|
{
|
||||||
sNameOut = ssprintf( "DefaultLocalProfileIDP%d", int(i+1) );
|
sNameOut = ssprintf( "DefaultLocalProfileIDP%d", int(i+1) );
|
||||||
defaultValueOut = "";
|
defaultValueOut = "";
|
||||||
@@ -939,7 +940,7 @@ void ProfileManager::MergeLocalProfileIntoMachine(RString const& from_id, bool s
|
|||||||
|
|
||||||
void ProfileManager::ChangeProfileType(int index, ProfileType new_type)
|
void ProfileManager::ChangeProfileType(int index, ProfileType new_type)
|
||||||
{
|
{
|
||||||
if(index < 0 || static_cast<size_t>(index) >= g_vLocalProfile.size())
|
if(index < 0 || static_cast<std::size_t>(index) >= g_vLocalProfile.size())
|
||||||
{ return; }
|
{ return; }
|
||||||
if(new_type == g_vLocalProfile[index].profile.m_Type)
|
if(new_type == g_vLocalProfile[index].profile.m_Type)
|
||||||
{ return; }
|
{ return; }
|
||||||
@@ -951,7 +952,7 @@ void ProfileManager::ChangeProfileType(int index, ProfileType new_type)
|
|||||||
|
|
||||||
void ProfileManager::MoveProfileTopBottom(int index, bool top)
|
void ProfileManager::MoveProfileTopBottom(int index, bool top)
|
||||||
{
|
{
|
||||||
if (index < 0 || static_cast<size_t>(index) >= g_vLocalProfile.size())
|
if (index < 0 || static_cast<std::size_t>(index) >= g_vLocalProfile.size())
|
||||||
{
|
{
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
@@ -959,7 +960,7 @@ void ProfileManager::MoveProfileTopBottom(int index, bool top)
|
|||||||
int swindex = 0;
|
int swindex = 0;
|
||||||
// There may be guest profiles at the top of the list, so we need to skip over them if moving to the top.
|
// There may be guest profiles at the top of the list, so we need to skip over them if moving to the top.
|
||||||
// If we're moving the profile to the bottom we should stop once we find the first test profile.
|
// If we're moving the profile to the bottom we should stop once we find the first test profile.
|
||||||
for (size_t i= 0; i < g_vLocalProfile.size(); ++i)
|
for (std::size_t i= 0; i < g_vLocalProfile.size(); ++i)
|
||||||
{
|
{
|
||||||
ProfileType type= g_vLocalProfile[i].profile.m_Type;
|
ProfileType type= g_vLocalProfile[i].profile.m_Type;
|
||||||
if (!top)
|
if (!top)
|
||||||
@@ -993,14 +994,14 @@ void ProfileManager::MoveProfileTopBottom(int index, bool top)
|
|||||||
|
|
||||||
void ProfileManager::MoveProfileSorted(int index, bool bAscending) {
|
void ProfileManager::MoveProfileSorted(int index, bool bAscending) {
|
||||||
|
|
||||||
if (index < 0 || static_cast<size_t>(index) >= g_vLocalProfile.size())
|
if (index < 0 || static_cast<std::size_t>(index) >= g_vLocalProfile.size())
|
||||||
{
|
{
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
int swindex = 0;
|
int swindex = 0;
|
||||||
// There may be guest profiles at the top of the list, so we need to skip over them.
|
// There may be guest profiles at the top of the list, so we need to skip over them.
|
||||||
for (size_t i= 0; i < g_vLocalProfile.size(); ++i)
|
for (std::size_t i= 0; i < g_vLocalProfile.size(); ++i)
|
||||||
{
|
{
|
||||||
ProfileType type= g_vLocalProfile[i].profile.m_Type;
|
ProfileType type= g_vLocalProfile[i].profile.m_Type;
|
||||||
if (type != ProfileType_Guest)
|
if (type != ProfileType_Guest)
|
||||||
@@ -1035,7 +1036,7 @@ void ProfileManager::MoveProfileSorted(int index, bool bAscending) {
|
|||||||
|
|
||||||
void ProfileManager::MoveProfilePriority(int index, bool up)
|
void ProfileManager::MoveProfilePriority(int index, bool up)
|
||||||
{
|
{
|
||||||
if(index < 0 || static_cast<size_t>(index) >= g_vLocalProfile.size())
|
if(index < 0 || static_cast<std::size_t>(index) >= g_vLocalProfile.size())
|
||||||
{ return; }
|
{ return; }
|
||||||
// Changing the priority is complicated a bit because the profiles might
|
// Changing the priority is complicated a bit because the profiles might
|
||||||
// all have the same priority. So this function has to assign priorities
|
// all have the same priority. So this function has to assign priorities
|
||||||
@@ -1044,7 +1045,7 @@ void ProfileManager::MoveProfilePriority(int index, bool up)
|
|||||||
int swindex= index + ((up * -2) + 1);
|
int swindex= index + ((up * -2) + 1);
|
||||||
ProfileType type= g_vLocalProfile[index].profile.m_Type;
|
ProfileType type= g_vLocalProfile[index].profile.m_Type;
|
||||||
int priority= 0;
|
int priority= 0;
|
||||||
for(size_t i= 0; i < g_vLocalProfile.size(); ++i)
|
for(std::size_t i= 0; i < g_vLocalProfile.size(); ++i)
|
||||||
{
|
{
|
||||||
DirAndProfile* curr= &g_vLocalProfile[i];
|
DirAndProfile* curr= &g_vLocalProfile[i];
|
||||||
if(curr->profile.m_Type == type)
|
if(curr->profile.m_Type == type)
|
||||||
@@ -1052,7 +1053,7 @@ void ProfileManager::MoveProfilePriority(int index, bool up)
|
|||||||
if(curr->profile.m_ListPriority != priority)
|
if(curr->profile.m_ListPriority != priority)
|
||||||
{
|
{
|
||||||
curr->profile.m_ListPriority= priority;
|
curr->profile.m_ListPriority= priority;
|
||||||
if(i != static_cast<size_t>(index) && i != static_cast<size_t>(swindex))
|
if(i != static_cast<std::size_t>(index) && i != static_cast<std::size_t>(swindex))
|
||||||
{
|
{
|
||||||
curr->profile.SaveTypeToDir(curr->sDir);
|
curr->profile.SaveTypeToDir(curr->sDir);
|
||||||
}
|
}
|
||||||
@@ -1065,7 +1066,7 @@ void ProfileManager::MoveProfilePriority(int index, bool up)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
// Only swap if both indices are valid and the types match.
|
// Only swap if both indices are valid and the types match.
|
||||||
if(swindex >= 0 && static_cast<size_t>(swindex) < g_vLocalProfile.size() &&
|
if(swindex >= 0 && static_cast<std::size_t>(swindex) < g_vLocalProfile.size() &&
|
||||||
g_vLocalProfile[swindex].profile.m_Type ==
|
g_vLocalProfile[swindex].profile.m_Type ==
|
||||||
g_vLocalProfile[index].profile.m_Type)
|
g_vLocalProfile[index].profile.m_Type)
|
||||||
{
|
{
|
||||||
@@ -1277,7 +1278,7 @@ int ProfileManager::GetNumLocalProfiles() const
|
|||||||
void ProfileManager::SetStatsPrefix(RString const& prefix)
|
void ProfileManager::SetStatsPrefix(RString const& prefix)
|
||||||
{
|
{
|
||||||
m_stats_prefix= prefix;
|
m_stats_prefix= prefix;
|
||||||
for(size_t i= 0; i < g_vLocalProfile.size(); ++i)
|
for(std::size_t i= 0; i < g_vLocalProfile.size(); ++i)
|
||||||
{
|
{
|
||||||
g_vLocalProfile[i].profile.HandleStatsPrefixChange(g_vLocalProfile[i].sDir, PREFSMAN->m_bSignProfileData);
|
g_vLocalProfile[i].profile.HandleStatsPrefixChange(g_vLocalProfile[i].sDir, PREFSMAN->m_bSignProfileData);
|
||||||
}
|
}
|
||||||
|
|||||||
+3
-2
@@ -16,6 +16,7 @@
|
|||||||
#include "arch/ArchHooks/ArchHooks.h"
|
#include "arch/ArchHooks/ArchHooks.h"
|
||||||
|
|
||||||
#include <cmath>
|
#include <cmath>
|
||||||
|
#include <cstddef>
|
||||||
|
|
||||||
// Statistics stuff
|
// Statistics stuff
|
||||||
RageTimer g_LastCheckTimer;
|
RageTimer g_LastCheckTimer;
|
||||||
@@ -974,8 +975,8 @@ void RageCompiledGeometry::Set( const std::vector<msMesh> &vMeshes, bool bNeedsN
|
|||||||
{
|
{
|
||||||
m_bNeedsNormals = bNeedsNormals;
|
m_bNeedsNormals = bNeedsNormals;
|
||||||
|
|
||||||
size_t totalVerts = 0;
|
std::size_t totalVerts = 0;
|
||||||
size_t totalTriangles = 0;
|
std::size_t totalTriangles = 0;
|
||||||
|
|
||||||
m_bAnyNeedsTextureMatrixScale = false;
|
m_bAnyNeedsTextureMatrixScale = false;
|
||||||
|
|
||||||
|
|||||||
+4
-2
@@ -5,6 +5,8 @@
|
|||||||
|
|
||||||
#include "RageTypes.h"
|
#include "RageTypes.h"
|
||||||
#include "ModelTypes.h"
|
#include "ModelTypes.h"
|
||||||
|
|
||||||
|
#include <cstddef>
|
||||||
#include <set>
|
#include <set>
|
||||||
|
|
||||||
class DisplaySpec;
|
class DisplaySpec;
|
||||||
@@ -35,8 +37,8 @@ public:
|
|||||||
virtual void Draw( int iMeshIndex ) const = 0;
|
virtual void Draw( int iMeshIndex ) const = 0;
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
size_t GetTotalVertices() const { if( m_vMeshInfo.empty() ) return 0; return m_vMeshInfo.back().iVertexStart + m_vMeshInfo.back().iVertexCount; }
|
std::size_t GetTotalVertices() const { if( m_vMeshInfo.empty() ) return 0; return m_vMeshInfo.back().iVertexStart + m_vMeshInfo.back().iVertexCount; }
|
||||||
size_t GetTotalTriangles() const { if( m_vMeshInfo.empty() ) return 0; return m_vMeshInfo.back().iTriangleStart + m_vMeshInfo.back().iTriangleCount; }
|
std::size_t GetTotalTriangles() const { if( m_vMeshInfo.empty() ) return 0; return m_vMeshInfo.back().iTriangleStart + m_vMeshInfo.back().iTriangleCount; }
|
||||||
|
|
||||||
struct MeshInfo
|
struct MeshInfo
|
||||||
{
|
{
|
||||||
|
|||||||
+16
-15
@@ -25,6 +25,7 @@
|
|||||||
#endif
|
#endif
|
||||||
|
|
||||||
#include <cmath>
|
#include <cmath>
|
||||||
|
#include <cstddef>
|
||||||
#include <list>
|
#include <list>
|
||||||
|
|
||||||
// Globals
|
// Globals
|
||||||
@@ -44,8 +45,8 @@ const D3DFORMAT g_DefaultAdapterFormat = D3DFMT_X8R8G8B8;
|
|||||||
/* Direct3D doesn't associate a palette with textures. Instead, we load a
|
/* Direct3D doesn't associate a palette with textures. Instead, we load a
|
||||||
* palette into a slot. We need to keep track of which texture's palette is
|
* palette into a slot. We need to keep track of which texture's palette is
|
||||||
* stored in what slot. */
|
* stored in what slot. */
|
||||||
std::map<uintptr_t, size_t> g_TexResourceToPaletteIndex;
|
std::map<uintptr_t, std::size_t> g_TexResourceToPaletteIndex;
|
||||||
std::list<size_t> g_PaletteIndex;
|
std::list<std::size_t> g_PaletteIndex;
|
||||||
struct TexturePalette { PALETTEENTRY p[256]; };
|
struct TexturePalette { PALETTEENTRY p[256]; };
|
||||||
std::map<uintptr_t, TexturePalette> g_TexResourceToTexturePalette;
|
std::map<uintptr_t, TexturePalette> g_TexResourceToTexturePalette;
|
||||||
|
|
||||||
@@ -63,7 +64,7 @@ static void SetPalette( uintptr_t TexResource )
|
|||||||
UINT iPalIndex = static_cast<UINT>(g_PaletteIndex.front());
|
UINT iPalIndex = static_cast<UINT>(g_PaletteIndex.front());
|
||||||
|
|
||||||
// If any other texture is currently using this slot, mark that palette unloaded.
|
// If any other texture is currently using this slot, mark that palette unloaded.
|
||||||
for( std::map<uintptr_t, size_t>::iterator i = g_TexResourceToPaletteIndex.begin(); i != g_TexResourceToPaletteIndex.end(); ++i )
|
for( std::map<uintptr_t, std::size_t>::iterator i = g_TexResourceToPaletteIndex.begin(); i != g_TexResourceToPaletteIndex.end(); ++i )
|
||||||
{
|
{
|
||||||
if( i->second != iPalIndex )
|
if( i->second != iPalIndex )
|
||||||
continue;
|
continue;
|
||||||
@@ -81,7 +82,7 @@ static void SetPalette( uintptr_t TexResource )
|
|||||||
const int iPalIndex = g_TexResourceToPaletteIndex[TexResource];
|
const int iPalIndex = g_TexResourceToPaletteIndex[TexResource];
|
||||||
|
|
||||||
// Find this palette index in the least-recently-used queue and move it to the end.
|
// Find this palette index in the least-recently-used queue and move it to the end.
|
||||||
for(std::list<size_t>::iterator i = g_PaletteIndex.begin(); i != g_PaletteIndex.end(); ++i)
|
for(std::list<std::size_t>::iterator i = g_PaletteIndex.begin(); i != g_PaletteIndex.end(); ++i)
|
||||||
{
|
{
|
||||||
if( *i != iPalIndex )
|
if( *i != iPalIndex )
|
||||||
continue;
|
continue;
|
||||||
@@ -327,7 +328,7 @@ D3DFORMAT FindBackBufferType(bool bWindowed, int iBPP)
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Test each back buffer format until we find something that works.
|
// Test each back buffer format until we find something that works.
|
||||||
for( size_t i=0; i < vBackBufferFormats.size(); i++ )
|
for( std::size_t i=0; i < vBackBufferFormats.size(); i++ )
|
||||||
{
|
{
|
||||||
D3DFORMAT fmtBackBuffer = vBackBufferFormats[i];
|
D3DFORMAT fmtBackBuffer = vBackBufferFormats[i];
|
||||||
|
|
||||||
@@ -782,18 +783,18 @@ public:
|
|||||||
}
|
}
|
||||||
void Change( const std::vector<msMesh> &vMeshes )
|
void Change( const std::vector<msMesh> &vMeshes )
|
||||||
{
|
{
|
||||||
for( size_t i=0; i<vMeshes.size(); i++ )
|
for( std::size_t i=0; i<vMeshes.size(); i++ )
|
||||||
{
|
{
|
||||||
const MeshInfo& meshInfo = m_vMeshInfo[i];
|
const MeshInfo& meshInfo = m_vMeshInfo[i];
|
||||||
const msMesh& mesh = vMeshes[i];
|
const msMesh& mesh = vMeshes[i];
|
||||||
const std::vector<RageModelVertex> &Vertices = mesh.Vertices;
|
const std::vector<RageModelVertex> &Vertices = mesh.Vertices;
|
||||||
const std::vector<msTriangle> &Triangles = mesh.Triangles;
|
const std::vector<msTriangle> &Triangles = mesh.Triangles;
|
||||||
|
|
||||||
for( size_t j=0; j<Vertices.size(); j++ )
|
for( std::size_t j=0; j<Vertices.size(); j++ )
|
||||||
m_vVertex[meshInfo.iVertexStart+j] = Vertices[j];
|
m_vVertex[meshInfo.iVertexStart+j] = Vertices[j];
|
||||||
|
|
||||||
for( size_t j=0; j<Triangles.size(); j++ )
|
for( std::size_t j=0; j<Triangles.size(); j++ )
|
||||||
for( size_t k=0; k<3; k++ )
|
for( std::size_t k=0; k<3; k++ )
|
||||||
m_vTriangles[meshInfo.iTriangleStart+j].nVertexIndices[k] = (uint16_t) meshInfo.iVertexStart + Triangles[j].nVertexIndices[k];
|
m_vTriangles[meshInfo.iTriangleStart+j].nVertexIndices[k] = (uint16_t) meshInfo.iVertexStart + Triangles[j].nVertexIndices[k];
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -851,8 +852,8 @@ void RageDisplay_D3D::DrawQuadsInternal( const RageSpriteVertex v[], int iNumVer
|
|||||||
|
|
||||||
// make a temporary index buffer
|
// make a temporary index buffer
|
||||||
static std::vector<uint16_t> vIndices;
|
static std::vector<uint16_t> vIndices;
|
||||||
size_t uOldSize = vIndices.size();
|
std::size_t uOldSize = vIndices.size();
|
||||||
size_t uNewSize = std::max(uOldSize, static_cast<size_t>(iNumIndices));
|
std::size_t uNewSize = std::max(uOldSize, static_cast<std::size_t>(iNumIndices));
|
||||||
vIndices.resize( uNewSize );
|
vIndices.resize( uNewSize );
|
||||||
for( uint16_t i=(uint16_t)uOldSize/6; i<(uint16_t)iNumQuads; i++ )
|
for( uint16_t i=(uint16_t)uOldSize/6; i<(uint16_t)iNumQuads; i++ )
|
||||||
{
|
{
|
||||||
@@ -887,8 +888,8 @@ void RageDisplay_D3D::DrawQuadStripInternal( const RageSpriteVertex v[], int iNu
|
|||||||
|
|
||||||
// make a temporary index buffer
|
// make a temporary index buffer
|
||||||
static std::vector<uint16_t> vIndices;
|
static std::vector<uint16_t> vIndices;
|
||||||
size_t uOldSize = vIndices.size();
|
std::size_t uOldSize = vIndices.size();
|
||||||
size_t uNewSize = std::max(uOldSize, static_cast<size_t>(iNumIndices));
|
std::size_t uNewSize = std::max(uOldSize, static_cast<std::size_t>(iNumIndices));
|
||||||
vIndices.resize( uNewSize );
|
vIndices.resize( uNewSize );
|
||||||
for( uint16_t i=(uint16_t)uOldSize/6; i<(uint16_t)iNumQuads; i++ )
|
for( uint16_t i=(uint16_t)uOldSize/6; i<(uint16_t)iNumQuads; i++ )
|
||||||
{
|
{
|
||||||
@@ -922,8 +923,8 @@ void RageDisplay_D3D::DrawSymmetricQuadStripInternal( const RageSpriteVertex v[]
|
|||||||
|
|
||||||
// make a temporary index buffer
|
// make a temporary index buffer
|
||||||
static std::vector<uint16_t> vIndices;
|
static std::vector<uint16_t> vIndices;
|
||||||
size_t uOldSize = vIndices.size();
|
std::size_t uOldSize = vIndices.size();
|
||||||
size_t uNewSize = std::max(uOldSize, static_cast<size_t>(iNumIndices));
|
std::size_t uNewSize = std::max(uOldSize, static_cast<std::size_t>(iNumIndices));
|
||||||
vIndices.resize( uNewSize );
|
vIndices.resize( uNewSize );
|
||||||
for( uint16_t i=(uint16_t)uOldSize/12; i<(uint16_t)iNumPieces; i++ )
|
for( uint16_t i=(uint16_t)uOldSize/12; i<(uint16_t)iNumPieces; i++ )
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -10,13 +10,14 @@
|
|||||||
#include "RageUtil.h"
|
#include "RageUtil.h"
|
||||||
#include "RageSurface.h"
|
#include "RageSurface.h"
|
||||||
#include "RageTextureManager.h"
|
#include "RageTextureManager.h"
|
||||||
|
|
||||||
#include "DisplaySpec.h"
|
#include "DisplaySpec.h"
|
||||||
|
|
||||||
#include "arch/LowLevelWindow/LowLevelWindow.h"
|
#include "arch/LowLevelWindow/LowLevelWindow.h"
|
||||||
|
|
||||||
#include <GL/glew.h>
|
#include <GL/glew.h>
|
||||||
|
|
||||||
|
#include <cstddef>
|
||||||
|
|
||||||
#ifdef NO_GL_FLUSH
|
#ifdef NO_GL_FLUSH
|
||||||
#define glFlush()
|
#define glFlush()
|
||||||
#endif
|
#endif
|
||||||
@@ -261,12 +262,12 @@ RageDisplay_GLES2::Init( const VideoModeParams &p, bool bAllowUnacceleratedRende
|
|||||||
}
|
}
|
||||||
|
|
||||||
sort( extensions.begin(), extensions.end() );
|
sort( extensions.begin(), extensions.end() );
|
||||||
size_t next = 0;
|
std::size_t next = 0;
|
||||||
while( next < extensions.size() )
|
while( next < extensions.size() )
|
||||||
{
|
{
|
||||||
size_t last = next;
|
std::size_t last = next;
|
||||||
string type;
|
string type;
|
||||||
for( size_t i = next; i<extensions.size(); ++i )
|
for( std::size_t i = next; i<extensions.size(); ++i )
|
||||||
{
|
{
|
||||||
std::vector<string> segments;
|
std::vector<string> segments;
|
||||||
split(extensions[i], '_', segments);
|
split(extensions[i], '_', segments);
|
||||||
@@ -308,12 +309,12 @@ RageDisplay_GLES2::Init( const VideoModeParams &p, bool bAllowUnacceleratedRende
|
|||||||
std::vector<RString> asExtensions;
|
std::vector<RString> asExtensions;
|
||||||
split( szExtensionString, " ", asExtensions );
|
split( szExtensionString, " ", asExtensions );
|
||||||
sort( asExtensions.begin(), asExtensions.end() );
|
sort( asExtensions.begin(), asExtensions.end() );
|
||||||
size_t iNextToPrint = 0;
|
std::size_t iNextToPrint = 0;
|
||||||
while( iNextToPrint < asExtensions.size() )
|
while( iNextToPrint < asExtensions.size() )
|
||||||
{
|
{
|
||||||
size_t iLastToPrint = iNextToPrint;
|
std::size_t iLastToPrint = iNextToPrint;
|
||||||
RString sType;
|
RString sType;
|
||||||
for( size_t i = iNextToPrint; i<asExtensions.size(); ++i )
|
for( std::size_t i = iNextToPrint; i<asExtensions.size(); ++i )
|
||||||
{
|
{
|
||||||
std::vector<RString> asBits;
|
std::vector<RString> asBits;
|
||||||
split( asExtensions[i], "_", asBits );
|
split( asExtensions[i], "_", asBits );
|
||||||
|
|||||||
@@ -20,6 +20,7 @@ using namespace RageDisplay_Legacy_Helpers;
|
|||||||
#include "arch/LowLevelWindow/LowLevelWindow.h"
|
#include "arch/LowLevelWindow/LowLevelWindow.h"
|
||||||
|
|
||||||
#include <cmath>
|
#include <cmath>
|
||||||
|
#include <cstddef>
|
||||||
#include <set>
|
#include <set>
|
||||||
|
|
||||||
#if defined(WINDOWS)
|
#if defined(WINDOWS)
|
||||||
@@ -495,12 +496,12 @@ RString RageDisplay_Legacy::Init( const VideoModeParams &p, bool bAllowUnacceler
|
|||||||
std::vector<RString> asExtensions;
|
std::vector<RString> asExtensions;
|
||||||
split( szExtensionString, " ", asExtensions );
|
split( szExtensionString, " ", asExtensions );
|
||||||
sort( asExtensions.begin(), asExtensions.end() );
|
sort( asExtensions.begin(), asExtensions.end() );
|
||||||
size_t iNextToPrint = 0;
|
std::size_t iNextToPrint = 0;
|
||||||
while( iNextToPrint < asExtensions.size() )
|
while( iNextToPrint < asExtensions.size() )
|
||||||
{
|
{
|
||||||
size_t iLastToPrint = iNextToPrint;
|
std::size_t iLastToPrint = iNextToPrint;
|
||||||
RString sType;
|
RString sType;
|
||||||
for( size_t i = iNextToPrint; i<asExtensions.size(); ++i )
|
for( std::size_t i = iNextToPrint; i<asExtensions.size(); ++i )
|
||||||
{
|
{
|
||||||
std::vector<RString> asBits;
|
std::vector<RString> asBits;
|
||||||
split( asExtensions[i], "_", asBits );
|
split( asExtensions[i], "_", asBits );
|
||||||
|
|||||||
+6
-4
@@ -12,6 +12,8 @@
|
|||||||
#include "RageUtil.h"
|
#include "RageUtil.h"
|
||||||
#include "RageFileDriver.h"
|
#include "RageFileDriver.h"
|
||||||
|
|
||||||
|
#include <cstddef>
|
||||||
|
|
||||||
RageFile::RageFile()
|
RageFile::RageFile()
|
||||||
{
|
{
|
||||||
m_File = nullptr;
|
m_File = nullptr;
|
||||||
@@ -143,7 +145,7 @@ void RageFile::SetError( const RString &err )
|
|||||||
m_sError = err;
|
m_sError = err;
|
||||||
}
|
}
|
||||||
|
|
||||||
int RageFile::Read( void *pBuffer, size_t iBytes )
|
int RageFile::Read( void *pBuffer, std::size_t iBytes )
|
||||||
{
|
{
|
||||||
ASSERT_READ;
|
ASSERT_READ;
|
||||||
return m_File->Read( pBuffer, iBytes );
|
return m_File->Read( pBuffer, iBytes );
|
||||||
@@ -179,14 +181,14 @@ int RageFile::Read( RString &buffer, int bytes )
|
|||||||
return m_File->Read( buffer, bytes );
|
return m_File->Read( buffer, bytes );
|
||||||
}
|
}
|
||||||
|
|
||||||
int RageFile::Write( const void *buffer, size_t bytes )
|
int RageFile::Write( const void *buffer, std::size_t bytes )
|
||||||
{
|
{
|
||||||
ASSERT_WRITE;
|
ASSERT_WRITE;
|
||||||
return m_File->Write( buffer, bytes );
|
return m_File->Write( buffer, bytes );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
int RageFile::Write( const void *buffer, size_t bytes, int nmemb )
|
int RageFile::Write( const void *buffer, std::size_t bytes, int nmemb )
|
||||||
{
|
{
|
||||||
ASSERT_WRITE;
|
ASSERT_WRITE;
|
||||||
return m_File->Write( buffer, bytes, nmemb );
|
return m_File->Write( buffer, bytes, nmemb );
|
||||||
@@ -203,7 +205,7 @@ int RageFile::Flush()
|
|||||||
return m_File->Flush();
|
return m_File->Flush();
|
||||||
}
|
}
|
||||||
|
|
||||||
int RageFile::Read( void *buffer, size_t bytes, int nmemb )
|
int RageFile::Read( void *buffer, std::size_t bytes, int nmemb )
|
||||||
{
|
{
|
||||||
ASSERT_READ;
|
ASSERT_READ;
|
||||||
return m_File->Read( buffer, bytes, nmemb );
|
return m_File->Read( buffer, bytes, nmemb );
|
||||||
|
|||||||
+7
-4
@@ -4,6 +4,9 @@
|
|||||||
#define RAGE_FILE_H
|
#define RAGE_FILE_H
|
||||||
|
|
||||||
#include "RageFileBasic.h"
|
#include "RageFileBasic.h"
|
||||||
|
|
||||||
|
#include <cstddef>
|
||||||
|
|
||||||
struct lua_State;
|
struct lua_State;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -58,15 +61,15 @@ public:
|
|||||||
int GetFD();
|
int GetFD();
|
||||||
|
|
||||||
/* Raw I/O: */
|
/* Raw I/O: */
|
||||||
int Read( void *buffer, size_t bytes );
|
int Read( void *buffer, std::size_t bytes );
|
||||||
int Read( RString &buffer, int bytes = -1 );
|
int Read( RString &buffer, int bytes = -1 );
|
||||||
int Write( const void *buffer, size_t bytes );
|
int Write( const void *buffer, std::size_t bytes );
|
||||||
int Write( const RString& string ) { return Write( string.data(), string.size() ); }
|
int Write( const RString& string ) { return Write( string.data(), string.size() ); }
|
||||||
int Flush();
|
int Flush();
|
||||||
|
|
||||||
/* These are just here to make wrappers (eg. vorbisfile, SDL_rwops) easier. */
|
/* These are just here to make wrappers (eg. vorbisfile, SDL_rwops) easier. */
|
||||||
int Write( const void *buffer, size_t bytes, int nmemb );
|
int Write( const void *buffer, std::size_t bytes, int nmemb );
|
||||||
int Read( void *buffer, size_t bytes, int nmemb );
|
int Read( void *buffer, std::size_t bytes, int nmemb );
|
||||||
int Seek( int offset, int whence );
|
int Seek( int offset, int whence );
|
||||||
|
|
||||||
/* Line-based I/O: */
|
/* Line-based I/O: */
|
||||||
|
|||||||
@@ -3,6 +3,8 @@
|
|||||||
#include "RageUtil.h"
|
#include "RageUtil.h"
|
||||||
#include "RageUtil_AutoPtr.h"
|
#include "RageUtil_AutoPtr.h"
|
||||||
|
|
||||||
|
#include <cstddef>
|
||||||
|
|
||||||
REGISTER_CLASS_TRAITS( RageFileBasic, pCopy->Copy() );
|
REGISTER_CLASS_TRAITS( RageFileBasic, pCopy->Copy() );
|
||||||
|
|
||||||
RageFileObj::RageFileObj()
|
RageFileObj::RageFileObj()
|
||||||
@@ -99,7 +101,7 @@ int RageFileObj::Seek( int offset, int whence )
|
|||||||
return Seek( (int) offset );
|
return Seek( (int) offset );
|
||||||
}
|
}
|
||||||
|
|
||||||
int RageFileObj::Read( void *pBuffer, size_t iBytes )
|
int RageFileObj::Read( void *pBuffer, std::size_t iBytes )
|
||||||
{
|
{
|
||||||
int iRet = 0;
|
int iRet = 0;
|
||||||
|
|
||||||
@@ -186,7 +188,7 @@ int RageFileObj::Read( RString &sBuffer, int iBytes )
|
|||||||
return iRet;
|
return iRet;
|
||||||
}
|
}
|
||||||
|
|
||||||
int RageFileObj::Read( void *pBuffer, size_t iBytes, int iNmemb )
|
int RageFileObj::Read( void *pBuffer, std::size_t iBytes, int iNmemb )
|
||||||
{
|
{
|
||||||
const int iRet = Read( pBuffer, iBytes*iNmemb );
|
const int iRet = Read( pBuffer, iBytes*iNmemb );
|
||||||
if( iRet == -1 )
|
if( iRet == -1 )
|
||||||
@@ -228,7 +230,7 @@ int RageFileObj::EmptyWriteBuf()
|
|||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
int RageFileObj::Write( const void *pBuffer, size_t iBytes )
|
int RageFileObj::Write( const void *pBuffer, std::size_t iBytes )
|
||||||
{
|
{
|
||||||
if( m_pWriteBuffer != nullptr )
|
if( m_pWriteBuffer != nullptr )
|
||||||
{
|
{
|
||||||
@@ -266,7 +268,7 @@ int RageFileObj::Write( const void *pBuffer, size_t iBytes )
|
|||||||
return iRet;
|
return iRet;
|
||||||
}
|
}
|
||||||
|
|
||||||
int RageFileObj::Write( const void *pBuffer, size_t iBytes, int iNmemb )
|
int RageFileObj::Write( const void *pBuffer, std::size_t iBytes, int iNmemb )
|
||||||
{
|
{
|
||||||
/* Simple write. We never return partial writes. */
|
/* Simple write. We never return partial writes. */
|
||||||
int iRet = Write( pBuffer, iBytes*iNmemb ) / iBytes;
|
int iRet = Write( pBuffer, iBytes*iNmemb ) / iBytes;
|
||||||
|
|||||||
+12
-10
@@ -5,6 +5,8 @@
|
|||||||
|
|
||||||
#include "global.h"
|
#include "global.h"
|
||||||
|
|
||||||
|
#include <cstddef>
|
||||||
|
|
||||||
/* This is a simple file I/O interface. Although most of these operations
|
/* This is a simple file I/O interface. Although most of these operations
|
||||||
* are straightforward, there are several of them; most of the time, you'll
|
* are straightforward, there are several of them; most of the time, you'll
|
||||||
* only want to implement RageFileObj. */
|
* only want to implement RageFileObj. */
|
||||||
@@ -28,14 +30,14 @@ public:
|
|||||||
* 0 on end of stream, or -1 on error. Note that reading less than iSize
|
* 0 on end of stream, or -1 on error. Note that reading less than iSize
|
||||||
* does not necessarily mean that the end of the stream has been reached;
|
* does not necessarily mean that the end of the stream has been reached;
|
||||||
* keep reading until 0 is returned. */
|
* keep reading until 0 is returned. */
|
||||||
virtual int Read( void *pBuffer, size_t iBytes ) = 0;
|
virtual int Read( void *pBuffer, std::size_t iBytes ) = 0;
|
||||||
virtual int Read( RString &buffer, int bytes = -1 ) = 0;
|
virtual int Read( RString &buffer, int bytes = -1 ) = 0;
|
||||||
virtual int Read( void *buffer, size_t bytes, int nmemb ) = 0;
|
virtual int Read( void *buffer, std::size_t bytes, int nmemb ) = 0;
|
||||||
|
|
||||||
/* Write iSize bytes of data from pBuf. Return 0 on success, -1 on error. */
|
/* Write iSize bytes of data from pBuf. Return 0 on success, -1 on error. */
|
||||||
virtual int Write( const void *pBuffer, size_t iBytes ) = 0;
|
virtual int Write( const void *pBuffer, std::size_t iBytes ) = 0;
|
||||||
virtual int Write( const RString &sString ) = 0;
|
virtual int Write( const RString &sString ) = 0;
|
||||||
virtual int Write( const void *buffer, size_t bytes, int nmemb ) = 0;
|
virtual int Write( const void *buffer, std::size_t bytes, int nmemb ) = 0;
|
||||||
|
|
||||||
/* Due to buffering, writing may not happen by the end of a Write() call, so not
|
/* Due to buffering, writing may not happen by the end of a Write() call, so not
|
||||||
* all errors may be returned by it. Data will be flushed when the stream (or its
|
* all errors may be returned by it. Data will be flushed when the stream (or its
|
||||||
@@ -78,13 +80,13 @@ public:
|
|||||||
int Seek( int offset, int whence );
|
int Seek( int offset, int whence );
|
||||||
int Tell() const { return m_iFilePos; }
|
int Tell() const { return m_iFilePos; }
|
||||||
|
|
||||||
int Read( void *pBuffer, size_t iBytes );
|
int Read( void *pBuffer, std::size_t iBytes );
|
||||||
int Read( RString &buffer, int bytes = -1 );
|
int Read( RString &buffer, int bytes = -1 );
|
||||||
int Read( void *buffer, size_t bytes, int nmemb );
|
int Read( void *buffer, std::size_t bytes, int nmemb );
|
||||||
|
|
||||||
int Write( const void *pBuffer, size_t iBytes );
|
int Write( const void *pBuffer, std::size_t iBytes );
|
||||||
int Write( const RString &sString ) { return Write( sString.data(), sString.size() ); }
|
int Write( const RString &sString ) { return Write( sString.data(), sString.size() ); }
|
||||||
int Write( const void *buffer, size_t bytes, int nmemb );
|
int Write( const void *buffer, std::size_t bytes, int nmemb );
|
||||||
|
|
||||||
int Flush();
|
int Flush();
|
||||||
|
|
||||||
@@ -101,8 +103,8 @@ public:
|
|||||||
|
|
||||||
protected:
|
protected:
|
||||||
virtual int SeekInternal( int /* iOffset */ ) { FAIL_M( "Seeking unimplemented" ); }
|
virtual int SeekInternal( int /* iOffset */ ) { FAIL_M( "Seeking unimplemented" ); }
|
||||||
virtual int ReadInternal( void *pBuffer, size_t iBytes ) = 0;
|
virtual int ReadInternal( void *pBuffer, std::size_t iBytes ) = 0;
|
||||||
virtual int WriteInternal( const void *pBuffer, size_t iBytes ) = 0;
|
virtual int WriteInternal( const void *pBuffer, std::size_t iBytes ) = 0;
|
||||||
virtual int FlushInternal() { return 0; }
|
virtual int FlushInternal() { return 0; }
|
||||||
|
|
||||||
void EnableReadBuffering();
|
void EnableReadBuffering();
|
||||||
|
|||||||
@@ -4,6 +4,8 @@
|
|||||||
#include "RageFile.h"
|
#include "RageFile.h"
|
||||||
#include "RageLog.h"
|
#include "RageLog.h"
|
||||||
#include "RageUtil.h"
|
#include "RageUtil.h"
|
||||||
|
|
||||||
|
#include <cstddef>
|
||||||
#include <memory>
|
#include <memory>
|
||||||
|
|
||||||
#if defined(_WINDOWS)
|
#if defined(_WINDOWS)
|
||||||
@@ -76,13 +78,13 @@ RageFileObjInflate::~RageFileObjInflate()
|
|||||||
delete m_pInflate;
|
delete m_pInflate;
|
||||||
}
|
}
|
||||||
|
|
||||||
int RageFileObjInflate::ReadInternal( void *buf, size_t bytes )
|
int RageFileObjInflate::ReadInternal( void *buf, std::size_t bytes )
|
||||||
{
|
{
|
||||||
/* Don't read more than m_iUncompressedSize of data. If we don't do this, it's
|
/* Don't read more than m_iUncompressedSize of data. If we don't do this, it's
|
||||||
* possible for a .gz to contain a header claiming 500k of data, but to actually
|
* possible for a .gz to contain a header claiming 500k of data, but to actually
|
||||||
* contain much more deflated data. */
|
* contain much more deflated data. */
|
||||||
ASSERT_M( m_iFilePos <= m_iUncompressedSize, ssprintf("%i, %i",m_iFilePos, m_iUncompressedSize) );
|
ASSERT_M( m_iFilePos <= m_iUncompressedSize, ssprintf("%i, %i",m_iFilePos, m_iUncompressedSize) );
|
||||||
bytes = std::min( bytes, size_t(m_iUncompressedSize-m_iFilePos) );
|
bytes = std::min( bytes, std::size_t(m_iUncompressedSize-m_iFilePos) );
|
||||||
|
|
||||||
bool done=false;
|
bool done=false;
|
||||||
int ret = 0;
|
int ret = 0;
|
||||||
@@ -221,7 +223,7 @@ RageFileObjDeflate::~RageFileObjDeflate()
|
|||||||
delete m_pDeflate;
|
delete m_pDeflate;
|
||||||
}
|
}
|
||||||
|
|
||||||
int RageFileObjDeflate::WriteInternal( const void *pBuffer, size_t iBytes )
|
int RageFileObjDeflate::WriteInternal( const void *pBuffer, std::size_t iBytes )
|
||||||
{
|
{
|
||||||
if( iBytes == 0 )
|
if( iBytes == 0 )
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -5,6 +5,8 @@
|
|||||||
|
|
||||||
#include "RageFileBasic.h"
|
#include "RageFileBasic.h"
|
||||||
|
|
||||||
|
#include <cstddef>
|
||||||
|
|
||||||
typedef struct z_stream_s z_stream;
|
typedef struct z_stream_s z_stream;
|
||||||
|
|
||||||
class RageFileObjInflate: public RageFileObj
|
class RageFileObjInflate: public RageFileObj
|
||||||
@@ -15,8 +17,8 @@ public:
|
|||||||
RageFileObjInflate( RageFileBasic *pFile, int iUncompressedSize );
|
RageFileObjInflate( RageFileBasic *pFile, int iUncompressedSize );
|
||||||
RageFileObjInflate( const RageFileObjInflate &cpy );
|
RageFileObjInflate( const RageFileObjInflate &cpy );
|
||||||
~RageFileObjInflate();
|
~RageFileObjInflate();
|
||||||
int ReadInternal( void *pBuffer, size_t iBytes );
|
int ReadInternal( void *pBuffer, std::size_t iBytes );
|
||||||
int WriteInternal( const void * /* pBuffer */, size_t /* iBytes */ ) { SetError( "Not implemented" ); return -1; }
|
int WriteInternal( const void * /* pBuffer */, std::size_t /* iBytes */ ) { SetError( "Not implemented" ); return -1; }
|
||||||
int SeekInternal( int iOffset );
|
int SeekInternal( int iOffset );
|
||||||
int GetFileSize() const { return m_iUncompressedSize; }
|
int GetFileSize() const { return m_iUncompressedSize; }
|
||||||
int GetFD() { return m_pFile->GetFD(); }
|
int GetFD() { return m_pFile->GetFD(); }
|
||||||
@@ -47,8 +49,8 @@ public:
|
|||||||
void DeleteFileWhenFinished() { m_bFileOwned = true; }
|
void DeleteFileWhenFinished() { m_bFileOwned = true; }
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
int ReadInternal( void * /* pBuffer */, size_t /* iBytes */ ) { SetError( "Not implemented" ); return -1; }
|
int ReadInternal( void * /* pBuffer */, std::size_t /* iBytes */ ) { SetError( "Not implemented" ); return -1; }
|
||||||
int WriteInternal( const void *pBuffer, size_t iBytes );
|
int WriteInternal( const void *pBuffer, std::size_t iBytes );
|
||||||
int FlushInternal();
|
int FlushInternal();
|
||||||
|
|
||||||
RageFileBasic *m_pFile;
|
RageFileBasic *m_pFile;
|
||||||
|
|||||||
@@ -10,6 +10,7 @@
|
|||||||
#include <fcntl.h>
|
#include <fcntl.h>
|
||||||
#endif
|
#endif
|
||||||
#include <cerrno>
|
#include <cerrno>
|
||||||
|
#include <cstddef>
|
||||||
#include <sys/types.h>
|
#include <sys/types.h>
|
||||||
#include <sys/stat.h>
|
#include <sys/stat.h>
|
||||||
|
|
||||||
@@ -389,7 +390,7 @@ RageFileObjDirect::~RageFileObjDirect()
|
|||||||
DoRemove( MakeTempFilename(m_sPath) );
|
DoRemove( MakeTempFilename(m_sPath) );
|
||||||
}
|
}
|
||||||
|
|
||||||
int RageFileObjDirect::ReadInternal( void *pBuf, size_t iBytes )
|
int RageFileObjDirect::ReadInternal( void *pBuf, std::size_t iBytes )
|
||||||
{
|
{
|
||||||
int iRet = DoRead( m_iFD, pBuf, iBytes );
|
int iRet = DoRead( m_iFD, pBuf, iBytes );
|
||||||
if( iRet == -1 )
|
if( iRet == -1 )
|
||||||
@@ -402,7 +403,7 @@ int RageFileObjDirect::ReadInternal( void *pBuf, size_t iBytes )
|
|||||||
}
|
}
|
||||||
|
|
||||||
// write(), but retry a couple times on EINTR.
|
// write(), but retry a couple times on EINTR.
|
||||||
static int RetriedWrite( int iFD, const void *pBuf, size_t iCount )
|
static int RetriedWrite( int iFD, const void *pBuf, std::size_t iCount )
|
||||||
{
|
{
|
||||||
int iTries = 3, iRet;
|
int iTries = 3, iRet;
|
||||||
do
|
do
|
||||||
@@ -426,7 +427,7 @@ int RageFileObjDirect::FlushInternal()
|
|||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
int RageFileObjDirect::WriteInternal( const void *pBuf, size_t iBytes )
|
int RageFileObjDirect::WriteInternal( const void *pBuf, std::size_t iBytes )
|
||||||
{
|
{
|
||||||
if( WriteFailed() )
|
if( WriteFailed() )
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -4,6 +4,8 @@
|
|||||||
#include "RageFile.h"
|
#include "RageFile.h"
|
||||||
#include "RageFileDriver.h"
|
#include "RageFileDriver.h"
|
||||||
|
|
||||||
|
#include <cstddef>
|
||||||
|
|
||||||
/** @brief File driver for accessing a regular filesystem. */
|
/** @brief File driver for accessing a regular filesystem. */
|
||||||
class RageFileDriverDirect: public RageFileDriver
|
class RageFileDriverDirect: public RageFileDriver
|
||||||
{
|
{
|
||||||
@@ -35,8 +37,8 @@ class RageFileObjDirect: public RageFileObj
|
|||||||
public:
|
public:
|
||||||
RageFileObjDirect( const RString &sPath, int iFD, int iMode );
|
RageFileObjDirect( const RString &sPath, int iFD, int iMode );
|
||||||
virtual ~RageFileObjDirect();
|
virtual ~RageFileObjDirect();
|
||||||
virtual int ReadInternal( void *pBuffer, size_t iBytes );
|
virtual int ReadInternal( void *pBuffer, std::size_t iBytes );
|
||||||
virtual int WriteInternal( const void *pBuffer, size_t iBytes );
|
virtual int WriteInternal( const void *pBuffer, std::size_t iBytes );
|
||||||
virtual int FlushInternal();
|
virtual int FlushInternal();
|
||||||
virtual int SeekInternal( int offset );
|
virtual int SeekInternal( int offset );
|
||||||
virtual RageFileObjDirect *Copy() const;
|
virtual RageFileObjDirect *Copy() const;
|
||||||
|
|||||||
@@ -3,6 +3,8 @@
|
|||||||
#include "RageFile.h"
|
#include "RageFile.h"
|
||||||
#include "RageUtil.h"
|
#include "RageUtil.h"
|
||||||
#include "RageUtil_FileDB.h"
|
#include "RageUtil_FileDB.h"
|
||||||
|
|
||||||
|
#include <cstddef>
|
||||||
#include <errno.h>
|
#include <errno.h>
|
||||||
|
|
||||||
struct RageFileObjMemFile
|
struct RageFileObjMemFile
|
||||||
@@ -49,12 +51,12 @@ RageFileObjMem::~RageFileObjMem()
|
|||||||
RageFileObjMemFile::ReleaseReference( m_pFile );
|
RageFileObjMemFile::ReleaseReference( m_pFile );
|
||||||
}
|
}
|
||||||
|
|
||||||
int RageFileObjMem::ReadInternal( void *buffer, size_t bytes )
|
int RageFileObjMem::ReadInternal( void *buffer, std::size_t bytes )
|
||||||
{
|
{
|
||||||
LockMut(m_pFile->m_Mutex);
|
LockMut(m_pFile->m_Mutex);
|
||||||
|
|
||||||
m_iFilePos = std::min( m_iFilePos, GetFileSize() );
|
m_iFilePos = std::min( m_iFilePos, GetFileSize() );
|
||||||
bytes = std::min( bytes, (size_t) GetFileSize() - m_iFilePos );
|
bytes = std::min( bytes, (std::size_t) GetFileSize() - m_iFilePos );
|
||||||
if( bytes == 0 )
|
if( bytes == 0 )
|
||||||
return 0;
|
return 0;
|
||||||
memcpy( buffer, &m_pFile->m_sBuf[m_iFilePos], bytes );
|
memcpy( buffer, &m_pFile->m_sBuf[m_iFilePos], bytes );
|
||||||
@@ -63,7 +65,7 @@ int RageFileObjMem::ReadInternal( void *buffer, size_t bytes )
|
|||||||
return bytes;
|
return bytes;
|
||||||
}
|
}
|
||||||
|
|
||||||
int RageFileObjMem::WriteInternal( const void *buffer, size_t bytes )
|
int RageFileObjMem::WriteInternal( const void *buffer, std::size_t bytes )
|
||||||
{
|
{
|
||||||
m_pFile->m_Mutex.Lock();
|
m_pFile->m_Mutex.Lock();
|
||||||
m_pFile->m_sBuf.replace( m_iFilePos, bytes, (const char *) buffer, bytes );
|
m_pFile->m_sBuf.replace( m_iFilePos, bytes, (const char *) buffer, bytes );
|
||||||
|
|||||||
@@ -7,6 +7,8 @@
|
|||||||
#include "RageFileBasic.h"
|
#include "RageFileBasic.h"
|
||||||
#include "RageThreads.h"
|
#include "RageThreads.h"
|
||||||
|
|
||||||
|
#include <cstddef>
|
||||||
|
|
||||||
struct RageFileObjMemFile;
|
struct RageFileObjMemFile;
|
||||||
class RageFileObjMem: public RageFileObj
|
class RageFileObjMem: public RageFileObj
|
||||||
{
|
{
|
||||||
@@ -15,8 +17,8 @@ public:
|
|||||||
RageFileObjMem( const RageFileObjMem &cpy );
|
RageFileObjMem( const RageFileObjMem &cpy );
|
||||||
~RageFileObjMem();
|
~RageFileObjMem();
|
||||||
|
|
||||||
int ReadInternal( void *buffer, size_t bytes );
|
int ReadInternal( void *buffer, std::size_t bytes );
|
||||||
int WriteInternal( const void *buffer, size_t bytes );
|
int WriteInternal( const void *buffer, std::size_t bytes );
|
||||||
int SeekInternal( int offset );
|
int SeekInternal( int offset );
|
||||||
int GetFileSize() const;
|
int GetFileSize() const;
|
||||||
RageFileObjMem *Copy() const;
|
RageFileObjMem *Copy() const;
|
||||||
|
|||||||
@@ -47,6 +47,7 @@
|
|||||||
#include <fcntl.h>
|
#include <fcntl.h>
|
||||||
#endif
|
#endif
|
||||||
#include <cerrno>
|
#include <cerrno>
|
||||||
|
#include <cstddef>
|
||||||
#if defined(WIN32)
|
#if defined(WIN32)
|
||||||
#include <io.h>
|
#include <io.h>
|
||||||
#endif
|
#endif
|
||||||
@@ -115,7 +116,7 @@ void RageFileDriverReadAhead::FillBuffer( int iBytes )
|
|||||||
RageFileManagerReadAhead::CacheHintStreaming( m_pFile );
|
RageFileManagerReadAhead::CacheHintStreaming( m_pFile );
|
||||||
}
|
}
|
||||||
|
|
||||||
int RageFileDriverReadAhead::ReadInternal( void *pBuffer, size_t iBytes )
|
int RageFileDriverReadAhead::ReadInternal( void *pBuffer, std::size_t iBytes )
|
||||||
{
|
{
|
||||||
int iRet = -1;
|
int iRet = -1;
|
||||||
if( m_bReadAheadNeeded && m_iFilePos < (int) m_sBuffer.size() )
|
if( m_bReadAheadNeeded && m_iFilePos < (int) m_sBuffer.size() )
|
||||||
|
|||||||
@@ -5,6 +5,8 @@
|
|||||||
|
|
||||||
#include "RageFileBasic.h"
|
#include "RageFileBasic.h"
|
||||||
|
|
||||||
|
#include <cstddef>
|
||||||
|
|
||||||
class RageFileDriverReadAhead: public RageFileObj
|
class RageFileDriverReadAhead: public RageFileObj
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
@@ -22,8 +24,8 @@ public:
|
|||||||
virtual RString GetError() const { return m_pFile->GetError(); }
|
virtual RString GetError() const { return m_pFile->GetError(); }
|
||||||
virtual void ClearError() { return m_pFile->ClearError(); }
|
virtual void ClearError() { return m_pFile->ClearError(); }
|
||||||
|
|
||||||
int ReadInternal( void *pBuffer, size_t iBytes );
|
int ReadInternal( void *pBuffer, std::size_t iBytes );
|
||||||
int WriteInternal( const void *pBuffer, size_t iBytes ) { return m_pFile->Write( pBuffer, iBytes ); }
|
int WriteInternal( const void *pBuffer, std::size_t iBytes ) { return m_pFile->Write( pBuffer, iBytes ); }
|
||||||
int SeekInternal( int iOffset );
|
int SeekInternal( int iOffset );
|
||||||
int GetFileSize() const { return m_pFile->GetFileSize(); }
|
int GetFileSize() const { return m_pFile->GetFileSize(); }
|
||||||
int GetFD() { return m_pFile->GetFD(); }
|
int GetFD() { return m_pFile->GetFD(); }
|
||||||
|
|||||||
@@ -1,6 +1,8 @@
|
|||||||
#include "global.h"
|
#include "global.h"
|
||||||
#include "RageFileDriverSlice.h"
|
#include "RageFileDriverSlice.h"
|
||||||
|
|
||||||
|
#include <cstddef>
|
||||||
|
|
||||||
RageFileDriverSlice::RageFileDriverSlice( RageFileBasic *pFile, int iOffset, int iFileSize )
|
RageFileDriverSlice::RageFileDriverSlice( RageFileBasic *pFile, int iOffset, int iFileSize )
|
||||||
{
|
{
|
||||||
m_pFile = pFile;
|
m_pFile = pFile;
|
||||||
@@ -32,7 +34,7 @@ RageFileDriverSlice *RageFileDriverSlice::Copy() const
|
|||||||
return pRet;
|
return pRet;
|
||||||
}
|
}
|
||||||
|
|
||||||
int RageFileDriverSlice::ReadInternal( void *buf, size_t bytes )
|
int RageFileDriverSlice::ReadInternal( void *buf, std::size_t bytes )
|
||||||
{
|
{
|
||||||
/* Make sure we're reading from the right place. We might have been constructed
|
/* Make sure we're reading from the right place. We might have been constructed
|
||||||
* with a file not pointing to iOffset. */
|
* with a file not pointing to iOffset. */
|
||||||
|
|||||||
@@ -5,6 +5,8 @@
|
|||||||
|
|
||||||
#include "RageFileBasic.h"
|
#include "RageFileBasic.h"
|
||||||
|
|
||||||
|
#include <cstddef>
|
||||||
|
|
||||||
class RageFileDriverSlice: public RageFileObj
|
class RageFileDriverSlice: public RageFileObj
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
@@ -16,8 +18,8 @@ public:
|
|||||||
|
|
||||||
void DeleteFileWhenFinished() { m_bFileOwned = true; }
|
void DeleteFileWhenFinished() { m_bFileOwned = true; }
|
||||||
|
|
||||||
int ReadInternal( void *pBuffer, size_t iBytes );
|
int ReadInternal( void *pBuffer, std::size_t iBytes );
|
||||||
int WriteInternal( const void * /* pBuffer */, size_t /* iBytes */ ) { SetError( "Not implemented" ); return -1; }
|
int WriteInternal( const void * /* pBuffer */, std::size_t /* iBytes */ ) { SetError( "Not implemented" ); return -1; }
|
||||||
int SeekInternal( int iOffset );
|
int SeekInternal( int iOffset );
|
||||||
int GetFileSize() const { return m_iFileSize; }
|
int GetFileSize() const { return m_iFileSize; }
|
||||||
int GetFD() { return m_pFile->GetFD(); }
|
int GetFD() { return m_pFile->GetFD(); }
|
||||||
|
|||||||
@@ -47,7 +47,9 @@
|
|||||||
#include "RageUtil_FileDB.h"
|
#include "RageUtil_FileDB.h"
|
||||||
#include "RageUtil_WorkerThread.h"
|
#include "RageUtil_WorkerThread.h"
|
||||||
#include "RageLog.h"
|
#include "RageLog.h"
|
||||||
#include <errno.h>
|
|
||||||
|
#include <cerrno>
|
||||||
|
#include <cstddef>
|
||||||
|
|
||||||
enum ThreadRequest
|
enum ThreadRequest
|
||||||
{
|
{
|
||||||
@@ -778,7 +780,7 @@ protected:
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
int ReadInternal( void *pBuffer, size_t iBytes )
|
int ReadInternal( void *pBuffer, std::size_t iBytes )
|
||||||
{
|
{
|
||||||
RString sError;
|
RString sError;
|
||||||
int iRet = m_pWorker->Read( m_pFile, pBuffer, iBytes, sError );
|
int iRet = m_pWorker->Read( m_pFile, pBuffer, iBytes, sError );
|
||||||
@@ -795,7 +797,7 @@ protected:
|
|||||||
return iRet;
|
return iRet;
|
||||||
}
|
}
|
||||||
|
|
||||||
int WriteInternal( const void *pBuffer, size_t iBytes )
|
int WriteInternal( const void *pBuffer, std::size_t iBytes )
|
||||||
{
|
{
|
||||||
RString sError;
|
RString sError;
|
||||||
int iRet = m_pWorker->Write( m_pFile, pBuffer, iBytes, sError );
|
int iRet = m_pWorker->Write( m_pFile, pBuffer, iBytes, sError );
|
||||||
|
|||||||
@@ -10,12 +10,14 @@
|
|||||||
#include "LuaManager.h"
|
#include "LuaManager.h"
|
||||||
|
|
||||||
#include <cerrno>
|
#include <cerrno>
|
||||||
|
#include <cstddef>
|
||||||
#include <sstream>
|
#include <sstream>
|
||||||
|
|
||||||
#if defined(WIN32)
|
#if defined(WIN32)
|
||||||
#include <windows.h>
|
#include <windows.h>
|
||||||
#elif defined(UNIX) || defined(MACOSX)
|
#elif defined(UNIX) || defined(MACOSX)
|
||||||
#include <paths.h>
|
#include <paths.h>
|
||||||
|
#include <sys/types.h>
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#include <miniz.h>
|
#include <miniz.h>
|
||||||
@@ -110,7 +112,7 @@ void RageFileManager::ReleaseFileDriver( RageFileDriver *pDriver )
|
|||||||
g_Mutex->Unlock();
|
g_Mutex->Unlock();
|
||||||
}
|
}
|
||||||
|
|
||||||
size_t zipRead(void *pOpaque, mz_uint64 file_ofs, void *pBuf, size_t n)
|
std::size_t zipRead(void *pOpaque, mz_uint64 file_ofs, void *pBuf, std::size_t n)
|
||||||
{
|
{
|
||||||
RageFile *f = static_cast<RageFile*>(pOpaque);
|
RageFile *f = static_cast<RageFile*>(pOpaque);
|
||||||
|
|
||||||
@@ -123,7 +125,7 @@ size_t zipRead(void *pOpaque, mz_uint64 file_ofs, void *pBuf, size_t n)
|
|||||||
return f->Read(pBuf, n);
|
return f->Read(pBuf, n);
|
||||||
}
|
}
|
||||||
|
|
||||||
size_t zipWriteFile(void *pOpaque, mz_uint64 file_ofs, const void *pBuf, size_t n)
|
std::size_t zipWriteFile(void *pOpaque, mz_uint64 file_ofs, const void *pBuf, std::size_t n)
|
||||||
{
|
{
|
||||||
RageFile *f = static_cast<RageFile*>(pOpaque);
|
RageFile *f = static_cast<RageFile*>(pOpaque);
|
||||||
|
|
||||||
@@ -187,7 +189,7 @@ bool RageFileManager::Unzip(const std::string &zipPath, std::string targetPath,
|
|||||||
|
|
||||||
for (int i = 0; i < strip; i++)
|
for (int i = 0; i < strip; i++)
|
||||||
{
|
{
|
||||||
size_t pos = filename.find('/');
|
std::size_t pos = filename.find('/');
|
||||||
if (pos != std::string::npos)
|
if (pos != std::string::npos)
|
||||||
pos++;
|
pos++;
|
||||||
filename.erase(0, pos);
|
filename.erase(0, pos);
|
||||||
@@ -297,7 +299,7 @@ static RageFileDriverMountpoints *g_Mountpoints = nullptr;
|
|||||||
static RString ExtractDirectory( RString sPath )
|
static RString ExtractDirectory( RString sPath )
|
||||||
{
|
{
|
||||||
// return the directory containing sPath
|
// return the directory containing sPath
|
||||||
size_t n = sPath.find_last_of("/");
|
std::size_t n = sPath.find_last_of("/");
|
||||||
if( n != sPath.npos )
|
if( n != sPath.npos )
|
||||||
sPath.erase(n);
|
sPath.erase(n);
|
||||||
else
|
else
|
||||||
|
|||||||
@@ -13,6 +13,7 @@
|
|||||||
#include <sys/types.h>
|
#include <sys/types.h>
|
||||||
#endif
|
#endif
|
||||||
#include <cerrno>
|
#include <cerrno>
|
||||||
|
#include <cstddef>
|
||||||
#if defined(WIN32)
|
#if defined(WIN32)
|
||||||
#include <io.h>
|
#include <io.h>
|
||||||
#endif
|
#endif
|
||||||
@@ -115,7 +116,7 @@ static std::vector<RageFileReadAheadThread *> g_apReadAheads;
|
|||||||
void RageFileManagerReadAhead::Init() { }
|
void RageFileManagerReadAhead::Init() { }
|
||||||
void RageFileManagerReadAhead::Shutdown()
|
void RageFileManagerReadAhead::Shutdown()
|
||||||
{
|
{
|
||||||
for( size_t i = 0; i < g_apReadAheads.size(); ++i )
|
for( std::size_t i = 0; i < g_apReadAheads.size(); ++i )
|
||||||
delete g_apReadAheads[i];
|
delete g_apReadAheads[i];
|
||||||
g_apReadAheads.clear();
|
g_apReadAheads.clear();
|
||||||
}
|
}
|
||||||
@@ -140,7 +141,7 @@ void RageFileManagerReadAhead::ReadAhead( RageFileBasic *pFile, int iBytes )
|
|||||||
RageFileReadAheadThread *pReadAhead = new RageFileReadAheadThread( iFD, iStart, iBytes );
|
RageFileReadAheadThread *pReadAhead = new RageFileReadAheadThread( iFD, iStart, iBytes );
|
||||||
g_apReadAheads.push_back( pReadAhead );
|
g_apReadAheads.push_back( pReadAhead );
|
||||||
|
|
||||||
for( size_t i = 0; i < g_apReadAheads.size(); ++i )
|
for( std::size_t i = 0; i < g_apReadAheads.size(); ++i )
|
||||||
{
|
{
|
||||||
if( g_apReadAheads[i]->IsFinished() )
|
if( g_apReadAheads[i]->IsFinished() )
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -13,6 +13,7 @@
|
|||||||
#include "RageThreads.h"
|
#include "RageThreads.h"
|
||||||
|
|
||||||
#include <cmath>
|
#include <cmath>
|
||||||
|
#include <cstddef>
|
||||||
#include <numeric>
|
#include <numeric>
|
||||||
|
|
||||||
/* Filter length. This must be a power of 2. */
|
/* Filter length. This must be a power of 2. */
|
||||||
@@ -575,7 +576,7 @@ RageSoundReader_Resample_Good::RageSoundReader_Resample_Good( RageSoundReader *p
|
|||||||
/* Call this if the input position is changed or reset. */
|
/* Call this if the input position is changed or reset. */
|
||||||
void RageSoundReader_Resample_Good::Reset()
|
void RageSoundReader_Resample_Good::Reset()
|
||||||
{
|
{
|
||||||
for( size_t iChannel = 0; iChannel < m_pSource->GetNumChannels(); ++iChannel )
|
for( std::size_t iChannel = 0; iChannel < m_pSource->GetNumChannels(); ++iChannel )
|
||||||
m_apResamplers[iChannel]->Reset();
|
m_apResamplers[iChannel]->Reset();
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -602,14 +603,14 @@ void RageSoundReader_Resample_Good::GetFactors( int &iDownFactor, int &iUpFactor
|
|||||||
/* Call this if the sample factor changes. */
|
/* Call this if the sample factor changes. */
|
||||||
void RageSoundReader_Resample_Good::ReopenResampler()
|
void RageSoundReader_Resample_Good::ReopenResampler()
|
||||||
{
|
{
|
||||||
for( size_t iChannel = 0; iChannel < m_apResamplers.size(); ++iChannel )
|
for( std::size_t iChannel = 0; iChannel < m_apResamplers.size(); ++iChannel )
|
||||||
delete m_apResamplers[iChannel];
|
delete m_apResamplers[iChannel];
|
||||||
m_apResamplers.clear();
|
m_apResamplers.clear();
|
||||||
|
|
||||||
int iDownFactor, iUpFactor;
|
int iDownFactor, iUpFactor;
|
||||||
GetFactors( iDownFactor, iUpFactor );
|
GetFactors( iDownFactor, iUpFactor );
|
||||||
|
|
||||||
for( size_t iChannel = 0; iChannel < m_pSource->GetNumChannels(); ++iChannel )
|
for( std::size_t iChannel = 0; iChannel < m_pSource->GetNumChannels(); ++iChannel )
|
||||||
{
|
{
|
||||||
int iMinDownFactor = iDownFactor;
|
int iMinDownFactor = iDownFactor;
|
||||||
int iMaxDownFactor = iDownFactor;
|
int iMaxDownFactor = iDownFactor;
|
||||||
@@ -623,13 +624,13 @@ void RageSoundReader_Resample_Good::ReopenResampler()
|
|||||||
if( m_fRate != -1 )
|
if( m_fRate != -1 )
|
||||||
iDownFactor = std::lrint( m_fRate * iDownFactor );
|
iDownFactor = std::lrint( m_fRate * iDownFactor );
|
||||||
|
|
||||||
for( size_t iChannel = 0; iChannel < m_apResamplers.size(); ++iChannel )
|
for( std::size_t iChannel = 0; iChannel < m_apResamplers.size(); ++iChannel )
|
||||||
m_apResamplers[iChannel]->SetDownFactor( iDownFactor );
|
m_apResamplers[iChannel]->SetDownFactor( iDownFactor );
|
||||||
}
|
}
|
||||||
|
|
||||||
RageSoundReader_Resample_Good::~RageSoundReader_Resample_Good()
|
RageSoundReader_Resample_Good::~RageSoundReader_Resample_Good()
|
||||||
{
|
{
|
||||||
for( size_t iChannel = 0; iChannel < m_apResamplers.size(); ++iChannel )
|
for( std::size_t iChannel = 0; iChannel < m_apResamplers.size(); ++iChannel )
|
||||||
delete m_apResamplers[iChannel];
|
delete m_apResamplers[iChannel];
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -702,7 +703,7 @@ void RageSoundReader_Resample_Good::SetRate( float fRatio )
|
|||||||
/* Set m_fRate to the actual rate, after quantization by iUpFactor. */
|
/* Set m_fRate to the actual rate, after quantization by iUpFactor. */
|
||||||
m_fRate = float(iDownFactor) / iUpFactor;
|
m_fRate = float(iDownFactor) / iUpFactor;
|
||||||
|
|
||||||
for( size_t iChannel = 0; iChannel < m_apResamplers.size(); ++iChannel )
|
for( std::size_t iChannel = 0; iChannel < m_apResamplers.size(); ++iChannel )
|
||||||
m_apResamplers[iChannel]->SetDownFactor( iDownFactor );
|
m_apResamplers[iChannel]->SetDownFactor( iDownFactor );
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -717,7 +718,7 @@ float RageSoundReader_Resample_Good::GetRate() const
|
|||||||
RageSoundReader_Resample_Good::RageSoundReader_Resample_Good( const RageSoundReader_Resample_Good &cpy ):
|
RageSoundReader_Resample_Good::RageSoundReader_Resample_Good( const RageSoundReader_Resample_Good &cpy ):
|
||||||
RageSoundReader_Filter(cpy)
|
RageSoundReader_Filter(cpy)
|
||||||
{
|
{
|
||||||
for( size_t i = 0; i < cpy.m_apResamplers.size(); ++i )
|
for( std::size_t i = 0; i < cpy.m_apResamplers.size(); ++i )
|
||||||
this->m_apResamplers.push_back( new RageSoundResampler_Polyphase(*cpy.m_apResamplers[i]) );
|
this->m_apResamplers.push_back( new RageSoundResampler_Polyphase(*cpy.m_apResamplers[i]) );
|
||||||
this->m_iSampleRate = cpy.m_iSampleRate;
|
this->m_iSampleRate = cpy.m_iSampleRate;
|
||||||
this->m_fRate = cpy.m_fRate;
|
this->m_fRate = cpy.m_fRate;
|
||||||
|
|||||||
@@ -4,6 +4,7 @@
|
|||||||
#include "RageLog.h"
|
#include "RageLog.h"
|
||||||
|
|
||||||
#include <cmath>
|
#include <cmath>
|
||||||
|
#include <cstddef>
|
||||||
|
|
||||||
static const int WINDOW_SIZE_MS = 30;
|
static const int WINDOW_SIZE_MS = 30;
|
||||||
|
|
||||||
@@ -35,7 +36,7 @@ void RageSoundReader_SpeedChange::Reset()
|
|||||||
{
|
{
|
||||||
m_fTrailingSpeedRatio = m_fSpeedRatio;
|
m_fTrailingSpeedRatio = m_fSpeedRatio;
|
||||||
m_iDataBufferAvailFrames = 0;
|
m_iDataBufferAvailFrames = 0;
|
||||||
for( size_t i = 0; i < m_Channels.size(); ++i )
|
for( std::size_t i = 0; i < m_Channels.size(); ++i )
|
||||||
{
|
{
|
||||||
ChannelInfo &c = m_Channels[i];
|
ChannelInfo &c = m_Channels[i];
|
||||||
c.m_iCorrelatedPos = 0;
|
c.m_iCorrelatedPos = 0;
|
||||||
@@ -101,7 +102,7 @@ int RageSoundReader_SpeedChange::FillData( int iMaxFrames )
|
|||||||
return iGotFrames;
|
return iGotFrames;
|
||||||
}
|
}
|
||||||
|
|
||||||
for( size_t i = 0; i < m_Channels.size(); ++i )
|
for( std::size_t i = 0; i < m_Channels.size(); ++i )
|
||||||
{
|
{
|
||||||
ChannelInfo &c = m_Channels[i];
|
ChannelInfo &c = m_Channels[i];
|
||||||
|
|
||||||
@@ -133,7 +134,7 @@ void RageSoundReader_SpeedChange::EraseData( int iFramesToDelete )
|
|||||||
int iFramesToMove = m_iDataBufferAvailFrames - iFramesToDelete;
|
int iFramesToMove = m_iDataBufferAvailFrames - iFramesToDelete;
|
||||||
m_iDataBufferAvailFrames -= iFramesToDelete;
|
m_iDataBufferAvailFrames -= iFramesToDelete;
|
||||||
m_iUncorrelatedPos -= iFramesToDelete;
|
m_iUncorrelatedPos -= iFramesToDelete;
|
||||||
for( size_t i = 0; i < m_Channels.size(); ++i )
|
for( std::size_t i = 0; i < m_Channels.size(); ++i )
|
||||||
{
|
{
|
||||||
ChannelInfo &c = m_Channels[i];
|
ChannelInfo &c = m_Channels[i];
|
||||||
if( iFramesToMove )
|
if( iFramesToMove )
|
||||||
@@ -153,7 +154,7 @@ int RageSoundReader_SpeedChange::Step()
|
|||||||
{
|
{
|
||||||
/* Advance m_iCorrelatedPos past the data that was just copied, to point to the
|
/* Advance m_iCorrelatedPos past the data that was just copied, to point to the
|
||||||
* sound that we would have played if we had continued copying at that point. */
|
* sound that we would have played if we had continued copying at that point. */
|
||||||
for( size_t i = 0; i < m_Channels.size(); ++i )
|
for( std::size_t i = 0; i < m_Channels.size(); ++i )
|
||||||
{
|
{
|
||||||
ASSERT( m_Channels[i].m_iCorrelatedPos + m_iPos <= m_iDataBufferAvailFrames );
|
ASSERT( m_Channels[i].m_iCorrelatedPos + m_iPos <= m_iDataBufferAvailFrames );
|
||||||
m_Channels[i].m_iCorrelatedPos += m_iPos;
|
m_Channels[i].m_iCorrelatedPos += m_iPos;
|
||||||
@@ -178,7 +179,7 @@ int RageSoundReader_SpeedChange::Step()
|
|||||||
|
|
||||||
/* We don't need any data before the earlier of m_iUncorrelatedPos or m_iCorrelatedPos. */
|
/* We don't need any data before the earlier of m_iUncorrelatedPos or m_iCorrelatedPos. */
|
||||||
int iToDelete = m_iUncorrelatedPos;
|
int iToDelete = m_iUncorrelatedPos;
|
||||||
for( size_t i = 0; i < m_Channels.size(); ++i )
|
for( std::size_t i = 0; i < m_Channels.size(); ++i )
|
||||||
{
|
{
|
||||||
ChannelInfo &c = m_Channels[i];
|
ChannelInfo &c = m_Channels[i];
|
||||||
ASSERT( c.m_iCorrelatedPos <= m_iDataBufferAvailFrames );
|
ASSERT( c.m_iCorrelatedPos <= m_iDataBufferAvailFrames );
|
||||||
@@ -190,7 +191,7 @@ int RageSoundReader_SpeedChange::Step()
|
|||||||
/* Fill as much data as we might need to do the search and use the result. */
|
/* Fill as much data as we might need to do the search and use the result. */
|
||||||
{
|
{
|
||||||
int iMaxPositionNeeded = m_iUncorrelatedPos + GetToleranceFrames() + GetWindowSizeFrames();
|
int iMaxPositionNeeded = m_iUncorrelatedPos + GetToleranceFrames() + GetWindowSizeFrames();
|
||||||
for( size_t i = 0; i < m_Channels.size(); ++i )
|
for( std::size_t i = 0; i < m_Channels.size(); ++i )
|
||||||
iMaxPositionNeeded = std::max( iMaxPositionNeeded, m_Channels[i].m_iCorrelatedPos + GetWindowSizeFrames() );
|
iMaxPositionNeeded = std::max( iMaxPositionNeeded, m_Channels[i].m_iCorrelatedPos + GetWindowSizeFrames() );
|
||||||
|
|
||||||
int iGot = FillData( iMaxPositionNeeded );
|
int iGot = FillData( iMaxPositionNeeded );
|
||||||
@@ -211,7 +212,7 @@ int RageSoundReader_SpeedChange::Step()
|
|||||||
int iCorrelatedToMatch = GetWindowSizeFrames()/4;
|
int iCorrelatedToMatch = GetWindowSizeFrames()/4;
|
||||||
int iUncorrelatedToMatch = GetToleranceFrames() + iCorrelatedToMatch; // maximum distance to search
|
int iUncorrelatedToMatch = GetToleranceFrames() + iCorrelatedToMatch; // maximum distance to search
|
||||||
|
|
||||||
for( size_t i = 0; i < m_Channels.size(); ++i )
|
for( std::size_t i = 0; i < m_Channels.size(); ++i )
|
||||||
{
|
{
|
||||||
ChannelInfo &c = m_Channels[i];
|
ChannelInfo &c = m_Channels[i];
|
||||||
ASSERT( c.m_iCorrelatedPos >= 0 );
|
ASSERT( c.m_iCorrelatedPos >= 0 );
|
||||||
@@ -228,7 +229,7 @@ int RageSoundReader_SpeedChange::Step()
|
|||||||
int RageSoundReader_SpeedChange::GetCursorAvail() const
|
int RageSoundReader_SpeedChange::GetCursorAvail() const
|
||||||
{
|
{
|
||||||
int iCursorAvail = GetWindowSizeFrames() - m_iPos;
|
int iCursorAvail = GetWindowSizeFrames() - m_iPos;
|
||||||
for( size_t i = 0; i < m_Channels.size(); ++i )
|
for( std::size_t i = 0; i < m_Channels.size(); ++i )
|
||||||
{
|
{
|
||||||
int iCursorAvailForChannel = (m_iDataBufferAvailFrames-m_Channels[i].m_iCorrelatedPos) - m_iPos;
|
int iCursorAvailForChannel = (m_iDataBufferAvailFrames-m_Channels[i].m_iCorrelatedPos) - m_iPos;
|
||||||
iCursorAvail = std::min( iCursorAvail, iCursorAvailForChannel );
|
iCursorAvail = std::min( iCursorAvail, iCursorAvailForChannel );
|
||||||
@@ -274,7 +275,7 @@ int RageSoundReader_SpeedChange::Read( float *pBuf, int iFrames )
|
|||||||
int iWindowSizeFrames = GetWindowSizeFrames();
|
int iWindowSizeFrames = GetWindowSizeFrames();
|
||||||
while( iFramesAvail-- )
|
while( iFramesAvail-- )
|
||||||
{
|
{
|
||||||
for( size_t i = 0; i < m_Channels.size(); ++i )
|
for( std::size_t i = 0; i < m_Channels.size(); ++i )
|
||||||
{
|
{
|
||||||
ChannelInfo &c = m_Channels[i];
|
ChannelInfo &c = m_Channels[i];
|
||||||
float i1 = c.m_DataBuffer[c.m_iCorrelatedPos+m_iPos];
|
float i1 = c.m_DataBuffer[c.m_iCorrelatedPos+m_iPos];
|
||||||
|
|||||||
@@ -1,5 +1,6 @@
|
|||||||
#include "global.h"
|
#include "global.h"
|
||||||
|
|
||||||
|
#include "RageFile.h"
|
||||||
#include "RageUtil.h"
|
#include "RageUtil.h"
|
||||||
#include "RageSoundReader_Vorbisfile.h"
|
#include "RageSoundReader_Vorbisfile.h"
|
||||||
#include "RageLog.h"
|
#include "RageLog.h"
|
||||||
@@ -10,10 +11,11 @@
|
|||||||
#include <vorbis/vorbisfile.h>
|
#include <vorbis/vorbisfile.h>
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#include <cstring>
|
|
||||||
#include <cerrno>
|
#include <cerrno>
|
||||||
#include "RageFile.h"
|
#include <cstddef>
|
||||||
static size_t OggRageFile_read_func( void *ptr, size_t size, size_t nmemb, void *datasource )
|
#include <cstring>
|
||||||
|
|
||||||
|
static std::size_t OggRageFile_read_func( void *ptr, std::size_t size, std::size_t nmemb, void *datasource )
|
||||||
{
|
{
|
||||||
RageFileBasic *f = (RageFileBasic *) datasource;
|
RageFileBasic *f = (RageFileBasic *) datasource;
|
||||||
return f->Read( ptr, size, nmemb );
|
return f->Read( ptr, size, nmemb );
|
||||||
|
|||||||
@@ -6,6 +6,7 @@
|
|||||||
#include "RageFile.h"
|
#include "RageFile.h"
|
||||||
|
|
||||||
#include <cmath>
|
#include <cmath>
|
||||||
|
#include <cstddef>
|
||||||
|
|
||||||
uint32_t RageSurfaceUtils::decodepixel( const uint8_t *p, int bpp )
|
uint32_t RageSurfaceUtils::decodepixel( const uint8_t *p, int bpp )
|
||||||
{
|
{
|
||||||
@@ -857,7 +858,7 @@ RageSurface *RageSurfaceUtils::PalettizeToGrayscale( const RageSurface *src_surf
|
|||||||
const unsigned int Amask = ((1u << AlphaBits) - 1u) << Ashift; // alpha mask
|
const unsigned int Amask = ((1u << AlphaBits) - 1u) << Ashift; // alpha mask
|
||||||
const unsigned int Aloss = 8u-AlphaBits;
|
const unsigned int Aloss = 8u-AlphaBits;
|
||||||
|
|
||||||
for( size_t index = 0; index < TotalColors; ++index )
|
for( std::size_t index = 0; index < TotalColors; ++index )
|
||||||
{
|
{
|
||||||
const unsigned int I = (index & Imask) >> Ishift;
|
const unsigned int I = (index & Imask) >> Ishift;
|
||||||
const unsigned int A = (index & Amask) >> Ashift;
|
const unsigned int A = (index & Amask) >> Ashift;
|
||||||
|
|||||||
@@ -5,6 +5,7 @@
|
|||||||
#include "RageFile.h"
|
#include "RageFile.h"
|
||||||
#include "RageSurface.h"
|
#include "RageSurface.h"
|
||||||
|
|
||||||
|
#include <cstddef>
|
||||||
#include <setjmp.h>
|
#include <setjmp.h>
|
||||||
|
|
||||||
extern "C" {
|
extern "C" {
|
||||||
@@ -66,7 +67,7 @@ void RageFile_JPEG_init_source( j_decompress_ptr cinfo )
|
|||||||
boolean RageFile_JPEG_fill_input_buffer( j_decompress_ptr cinfo )
|
boolean RageFile_JPEG_fill_input_buffer( j_decompress_ptr cinfo )
|
||||||
{
|
{
|
||||||
RageFile_source_mgr *src = (RageFile_source_mgr *) cinfo->src;
|
RageFile_source_mgr *src = (RageFile_source_mgr *) cinfo->src;
|
||||||
size_t nbytes = src->file->Read( src->buffer, sizeof(src->buffer) );
|
std::size_t nbytes = src->file->Read( src->buffer, sizeof(src->buffer) );
|
||||||
|
|
||||||
if( nbytes <= 0 )
|
if( nbytes <= 0 )
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -6,6 +6,8 @@
|
|||||||
#include "RageUtil.h"
|
#include "RageUtil.h"
|
||||||
#include "RageFile.h"
|
#include "RageFile.h"
|
||||||
|
|
||||||
|
#include <cstddef>
|
||||||
|
|
||||||
#undef FAR // fix for VC
|
#undef FAR // fix for VC
|
||||||
/** @brief A helper to get the jpeg lib. */
|
/** @brief A helper to get the jpeg lib. */
|
||||||
namespace jpeg
|
namespace jpeg
|
||||||
@@ -102,7 +104,7 @@ bool RageSurfaceUtils::SaveJPEG( RageSurface *surface, RageFile &f, bool bHighQu
|
|||||||
|
|
||||||
/* Now we can initialize the JPEG compression object. */
|
/* Now we can initialize the JPEG compression object. */
|
||||||
jpeg::jpeg_CreateCompress(&cinfo, JPEG_LIB_VERSION, \
|
jpeg::jpeg_CreateCompress(&cinfo, JPEG_LIB_VERSION, \
|
||||||
(size_t) sizeof(struct jpeg::jpeg_compress_struct));
|
(std::size_t) sizeof(struct jpeg::jpeg_compress_struct));
|
||||||
|
|
||||||
cinfo.image_width = surface->w; /* image width and height, in pixels */
|
cinfo.image_width = surface->w; /* image width and height, in pixels */
|
||||||
cinfo.image_height = surface->h;
|
cinfo.image_height = surface->h;
|
||||||
|
|||||||
+65
-64
@@ -14,6 +14,7 @@
|
|||||||
|
|
||||||
#include <cfloat>
|
#include <cfloat>
|
||||||
#include <cmath>
|
#include <cmath>
|
||||||
|
#include <cstddef>
|
||||||
#include <ctime>
|
#include <ctime>
|
||||||
#include <functional>
|
#include <functional>
|
||||||
#include <map>
|
#include <map>
|
||||||
@@ -26,7 +27,7 @@ const RString CUSTOM_SONG_PATH= "/@mem/";
|
|||||||
|
|
||||||
bool HexToBinary(const RString&, RString&);
|
bool HexToBinary(const RString&, RString&);
|
||||||
void utf8_sanitize(RString &);
|
void utf8_sanitize(RString &);
|
||||||
void UnicodeUpperLower(wchar_t *, size_t, const unsigned char *);
|
void UnicodeUpperLower(wchar_t *, std::size_t, const unsigned char *);
|
||||||
|
|
||||||
RandomGen g_RandomNumberGenerator;
|
RandomGen g_RandomNumberGenerator;
|
||||||
|
|
||||||
@@ -145,7 +146,7 @@ bool IsAnInt( const RString &s )
|
|||||||
if( !s.size() )
|
if( !s.size() )
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
for( size_t i=0; i < s.size(); ++i )
|
for( std::size_t i=0; i < s.size(); ++i )
|
||||||
if( s[i] < '0' || s[i] > '9' )
|
if( s[i] < '0' || s[i] > '9' )
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
@@ -157,7 +158,7 @@ bool IsHexVal( const RString &s )
|
|||||||
if( !s.size() )
|
if( !s.size() )
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
for( size_t i=0; i < s.size(); ++i )
|
for( std::size_t i=0; i < s.size(); ++i )
|
||||||
if( !(s[i] >= '0' && s[i] <= '9') &&
|
if( !(s[i] >= '0' && s[i] <= '9') &&
|
||||||
!(toupper(s[i]) >= 'A' && toupper(s[i]) <= 'F'))
|
!(toupper(s[i]) >= 'A' && toupper(s[i]) <= 'F'))
|
||||||
return false;
|
return false;
|
||||||
@@ -165,11 +166,11 @@ bool IsHexVal( const RString &s )
|
|||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
RString BinaryToHex( const void *pData_, size_t iNumBytes )
|
RString BinaryToHex( const void *pData_, std::size_t iNumBytes )
|
||||||
{
|
{
|
||||||
const unsigned char *pData = (const unsigned char *) pData_;
|
const unsigned char *pData = (const unsigned char *) pData_;
|
||||||
RString s;
|
RString s;
|
||||||
for( size_t i=0; i<iNumBytes; i++ )
|
for( std::size_t i=0; i<iNumBytes; i++ )
|
||||||
{
|
{
|
||||||
unsigned val = pData[i];
|
unsigned val = pData[i];
|
||||||
s += ssprintf( "%02x", val );
|
s += ssprintf( "%02x", val );
|
||||||
@@ -287,10 +288,10 @@ RString Commify( int iNum )
|
|||||||
|
|
||||||
RString Commify(const RString& num, const RString& sep, const RString& dot)
|
RString Commify(const RString& num, const RString& sep, const RString& dot)
|
||||||
{
|
{
|
||||||
size_t num_start= 0;
|
std::size_t num_start= 0;
|
||||||
size_t num_end= num.size();
|
std::size_t num_end= num.size();
|
||||||
size_t dot_pos= num.find(dot);
|
std::size_t dot_pos= num.find(dot);
|
||||||
size_t dash_pos= num.find('-');
|
std::size_t dash_pos= num.find('-');
|
||||||
if(dot_pos != std::string::npos)
|
if(dot_pos != std::string::npos)
|
||||||
{
|
{
|
||||||
num_end= dot_pos;
|
num_end= dot_pos;
|
||||||
@@ -299,22 +300,22 @@ RString Commify(const RString& num, const RString& sep, const RString& dot)
|
|||||||
{
|
{
|
||||||
num_start= dash_pos + 1;
|
num_start= dash_pos + 1;
|
||||||
}
|
}
|
||||||
size_t num_size= num_end - num_start;
|
std::size_t num_size= num_end - num_start;
|
||||||
size_t commies= (num_size / 3) - (!(num_size % 3));
|
std::size_t commies= (num_size / 3) - (!(num_size % 3));
|
||||||
if(commies < 1)
|
if(commies < 1)
|
||||||
{
|
{
|
||||||
return num;
|
return num;
|
||||||
}
|
}
|
||||||
size_t commified_len= num.size() + (commies * sep.size());
|
std::size_t commified_len= num.size() + (commies * sep.size());
|
||||||
RString ret;
|
RString ret;
|
||||||
ret.resize(commified_len);
|
ret.resize(commified_len);
|
||||||
size_t dest= 0;
|
std::size_t dest= 0;
|
||||||
size_t next_comma= (num_size % 3) + (3 * (!(num_size % 3))) + num_start;
|
std::size_t next_comma= (num_size % 3) + (3 * (!(num_size % 3))) + num_start;
|
||||||
for(size_t c= 0; c < num.size(); ++c)
|
for(std::size_t c= 0; c < num.size(); ++c)
|
||||||
{
|
{
|
||||||
if(c == next_comma && c < num_end)
|
if(c == next_comma && c < num_end)
|
||||||
{
|
{
|
||||||
for(size_t s= 0; s < sep.size(); ++s)
|
for(std::size_t s= 0; s < sep.size(); ++s)
|
||||||
{
|
{
|
||||||
ret[dest]= sep[s];
|
ret[dest]= sep[s];
|
||||||
++dest;
|
++dest;
|
||||||
@@ -454,17 +455,17 @@ RString ConvertI64FormatString( const RString &sStr )
|
|||||||
RString sRet;
|
RString sRet;
|
||||||
sRet.reserve( sStr.size() + 16 );
|
sRet.reserve( sStr.size() + 16 );
|
||||||
|
|
||||||
size_t iOffset = 0;
|
std::size_t iOffset = 0;
|
||||||
while( iOffset < sStr.size() )
|
while( iOffset < sStr.size() )
|
||||||
{
|
{
|
||||||
size_t iPercent = sStr.find( '%', iOffset );
|
std::size_t iPercent = sStr.find( '%', iOffset );
|
||||||
if( iPercent != sStr.npos )
|
if( iPercent != sStr.npos )
|
||||||
{
|
{
|
||||||
sRet.append( sStr, iOffset, iPercent - iOffset );
|
sRet.append( sStr, iOffset, iPercent - iOffset );
|
||||||
iOffset = iPercent;
|
iOffset = iPercent;
|
||||||
}
|
}
|
||||||
|
|
||||||
size_t iEnd = sStr.find_first_of( "diouxXeEfFgGaAcsCSpnm%", iOffset + 1 );
|
std::size_t iEnd = sStr.find_first_of( "diouxXeEfFgGaAcsCSpnm%", iOffset + 1 );
|
||||||
if( iEnd != sStr.npos && iEnd - iPercent >= 3 && iPercent > 2 && sStr[iEnd-2] == 'l' && sStr[iEnd-1] == 'l' )
|
if( iEnd != sStr.npos && iEnd - iPercent >= 3 && iPercent > 2 && sStr[iEnd-2] == 'l' && sStr[iEnd-1] == 'l' )
|
||||||
{
|
{
|
||||||
sRet.append( sStr, iPercent, iEnd - iPercent - 2 ); // %
|
sRet.append( sStr, iPercent, iEnd - iPercent - 2 ); // %
|
||||||
@@ -655,9 +656,9 @@ RString join( const RString &sDeliminator, const std::vector<RString> &sSource)
|
|||||||
return RString();
|
return RString();
|
||||||
|
|
||||||
RString sTmp;
|
RString sTmp;
|
||||||
size_t final_size= 0;
|
std::size_t final_size= 0;
|
||||||
size_t delim_size= sDeliminator.size();
|
std::size_t delim_size= sDeliminator.size();
|
||||||
for(size_t n= 0; n < sSource.size()-1; ++n)
|
for(std::size_t n= 0; n < sSource.size()-1; ++n)
|
||||||
{
|
{
|
||||||
final_size+= sSource[n].size() + delim_size;
|
final_size+= sSource[n].size() + delim_size;
|
||||||
}
|
}
|
||||||
@@ -679,8 +680,8 @@ RString join( const RString &sDelimitor, std::vector<RString>::const_iterator be
|
|||||||
return RString();
|
return RString();
|
||||||
|
|
||||||
RString sRet;
|
RString sRet;
|
||||||
size_t final_size= 0;
|
std::size_t final_size= 0;
|
||||||
size_t delim_size= sDelimitor.size();
|
std::size_t delim_size= sDelimitor.size();
|
||||||
for(std::vector<RString>::const_iterator curr= begin; curr != end; ++curr)
|
for(std::vector<RString>::const_iterator curr= begin; curr != end; ++curr)
|
||||||
{
|
{
|
||||||
final_size+= curr->size();
|
final_size+= curr->size();
|
||||||
@@ -777,10 +778,10 @@ void do_split( const S &Source, const C Delimitor, std::vector<S> &AddIt, const
|
|||||||
if( Source.empty() )
|
if( Source.empty() )
|
||||||
return;
|
return;
|
||||||
|
|
||||||
size_t startpos = 0;
|
std::size_t startpos = 0;
|
||||||
|
|
||||||
do {
|
do {
|
||||||
size_t pos;
|
std::size_t pos;
|
||||||
pos = Source.find( Delimitor, startpos );
|
pos = Source.find( Delimitor, startpos );
|
||||||
if( pos == Source.npos )
|
if( pos == Source.npos )
|
||||||
pos = Source.size();
|
pos = Source.size();
|
||||||
@@ -854,7 +855,7 @@ void do_split( const S &Source, const S &Delimitor, int &begin, int &size, int l
|
|||||||
|
|
||||||
/* Where's the string function to find within a substring?
|
/* Where's the string function to find within a substring?
|
||||||
* C++ strings apparently are missing that ... */
|
* C++ strings apparently are missing that ... */
|
||||||
size_t pos;
|
std::size_t pos;
|
||||||
if( Delimitor.size() == 1 )
|
if( Delimitor.size() == 1 )
|
||||||
pos = Source.find( Delimitor[0], begin );
|
pos = Source.find( Delimitor[0], begin );
|
||||||
else
|
else
|
||||||
@@ -943,11 +944,11 @@ RString SetExtension( const RString &sPath, const RString &sExt )
|
|||||||
|
|
||||||
RString GetExtension( const RString &sPath )
|
RString GetExtension( const RString &sPath )
|
||||||
{
|
{
|
||||||
size_t pos = sPath.rfind( '.' );
|
std::size_t pos = sPath.rfind( '.' );
|
||||||
if( pos == sPath.npos )
|
if( pos == sPath.npos )
|
||||||
return RString();
|
return RString();
|
||||||
|
|
||||||
size_t slash = sPath.find( '/', pos );
|
std::size_t slash = sPath.find( '/', pos );
|
||||||
if( slash != sPath.npos )
|
if( slash != sPath.npos )
|
||||||
return RString(); /* rare: path/dir.ext/fn */
|
return RString(); /* rare: path/dir.ext/fn */
|
||||||
|
|
||||||
@@ -993,11 +994,11 @@ bool FindFirstFilenameContaining(const std::vector<RString>& filenames,
|
|||||||
RString& out, const std::vector<RString>& starts_with,
|
RString& out, const std::vector<RString>& starts_with,
|
||||||
const std::vector<RString>& contains, const std::vector<RString>& ends_with)
|
const std::vector<RString>& contains, const std::vector<RString>& ends_with)
|
||||||
{
|
{
|
||||||
for(size_t i= 0; i < filenames.size(); ++i)
|
for(std::size_t i= 0; i < filenames.size(); ++i)
|
||||||
{
|
{
|
||||||
RString lower= GetFileNameWithoutExtension(filenames[i]);
|
RString lower= GetFileNameWithoutExtension(filenames[i]);
|
||||||
lower.MakeLower();
|
lower.MakeLower();
|
||||||
for(size_t s= 0; s < starts_with.size(); ++s)
|
for(std::size_t s= 0; s < starts_with.size(); ++s)
|
||||||
{
|
{
|
||||||
if(!lower.compare(0, starts_with[s].size(), starts_with[s]))
|
if(!lower.compare(0, starts_with[s].size(), starts_with[s]))
|
||||||
{
|
{
|
||||||
@@ -1005,12 +1006,12 @@ bool FindFirstFilenameContaining(const std::vector<RString>& filenames,
|
|||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
size_t lower_size= lower.size();
|
std::size_t lower_size= lower.size();
|
||||||
for(size_t s= 0; s < ends_with.size(); ++s)
|
for(std::size_t s= 0; s < ends_with.size(); ++s)
|
||||||
{
|
{
|
||||||
if(lower_size >= ends_with[s].size())
|
if(lower_size >= ends_with[s].size())
|
||||||
{
|
{
|
||||||
size_t end_pos= lower_size - ends_with[s].size();
|
std::size_t end_pos= lower_size - ends_with[s].size();
|
||||||
if(!lower.compare(end_pos, std::string::npos, ends_with[s]))
|
if(!lower.compare(end_pos, std::string::npos, ends_with[s]))
|
||||||
{
|
{
|
||||||
out= filenames[i];
|
out= filenames[i];
|
||||||
@@ -1018,7 +1019,7 @@ bool FindFirstFilenameContaining(const std::vector<RString>& filenames,
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
for(size_t s= 0; s < contains.size(); ++s)
|
for(std::size_t s= 0; s < contains.size(); ++s)
|
||||||
{
|
{
|
||||||
if(lower.find(contains[s]) != std::string::npos)
|
if(lower.find(contains[s]) != std::string::npos)
|
||||||
{
|
{
|
||||||
@@ -1058,7 +1059,7 @@ bool GetCommandlineArgument( const RString &option, RString *argument, int iInde
|
|||||||
{
|
{
|
||||||
const RString CurArgument = g_argv[arg];
|
const RString CurArgument = g_argv[arg];
|
||||||
|
|
||||||
const size_t i = CurArgument.find( "=" );
|
const std::size_t i = CurArgument.find( "=" );
|
||||||
RString CurOption = CurArgument.substr(0,i);
|
RString CurOption = CurArgument.substr(0,i);
|
||||||
if( CurOption.CompareNoCase(optstr) )
|
if( CurOption.CompareNoCase(optstr) )
|
||||||
continue; // no match
|
continue; // no match
|
||||||
@@ -1098,7 +1099,7 @@ RString GetCwd()
|
|||||||
* http://www.theorem.com/java/CRC32.java,
|
* http://www.theorem.com/java/CRC32.java,
|
||||||
* http://www.faqs.org/rfcs/rfc1952.html
|
* http://www.faqs.org/rfcs/rfc1952.html
|
||||||
*/
|
*/
|
||||||
void CRC32( unsigned int &iCRC, const void *pVoidBuffer, size_t iSize )
|
void CRC32( unsigned int &iCRC, const void *pVoidBuffer, std::size_t iSize )
|
||||||
{
|
{
|
||||||
static unsigned tab[256];
|
static unsigned tab[256];
|
||||||
static bool initted = false;
|
static bool initted = false;
|
||||||
@@ -1594,7 +1595,7 @@ bool utf8_to_wchar_ec( const RString &s, unsigned &start, wchar_t &ch )
|
|||||||
}
|
}
|
||||||
|
|
||||||
/* Like utf8_to_wchar_ec, but only does enough error checking to prevent crashing. */
|
/* Like utf8_to_wchar_ec, but only does enough error checking to prevent crashing. */
|
||||||
bool utf8_to_wchar( const char *s, size_t iLength, unsigned &start, wchar_t &ch )
|
bool utf8_to_wchar( const char *s, std::size_t iLength, unsigned &start, wchar_t &ch )
|
||||||
{
|
{
|
||||||
if( start >= iLength )
|
if( start >= iLength )
|
||||||
return false;
|
return false;
|
||||||
@@ -1722,7 +1723,7 @@ void utf8_remove_bom( RString &sLine )
|
|||||||
sLine.erase(0, 3);
|
sLine.erase(0, 3);
|
||||||
}
|
}
|
||||||
|
|
||||||
static int UnicodeDoUpper( char *p, size_t iLen, const unsigned char pMapping[256] )
|
static int UnicodeDoUpper( char *p, std::size_t iLen, const unsigned char pMapping[256] )
|
||||||
{
|
{
|
||||||
// Note: this has problems with certain accented characters. -aj
|
// Note: this has problems with certain accented characters. -aj
|
||||||
wchar_t wc = L'\0';
|
wchar_t wc = L'\0';
|
||||||
@@ -1749,7 +1750,7 @@ static int UnicodeDoUpper( char *p, size_t iLen, const unsigned char pMapping[25
|
|||||||
/* Fast in-place MakeUpper and MakeLower. This only replaces characters with characters of the same UTF-8
|
/* Fast in-place MakeUpper and MakeLower. This only replaces characters with characters of the same UTF-8
|
||||||
* length, so we never have to move the whole string. This is optimized for strings that have no
|
* length, so we never have to move the whole string. This is optimized for strings that have no
|
||||||
* non-ASCII characters. */
|
* non-ASCII characters. */
|
||||||
void MakeUpper( char *p, size_t iLen )
|
void MakeUpper( char *p, std::size_t iLen )
|
||||||
{
|
{
|
||||||
char *pStart = p;
|
char *pStart = p;
|
||||||
char *pEnd = p + iLen;
|
char *pEnd = p + iLen;
|
||||||
@@ -1769,7 +1770,7 @@ void MakeUpper( char *p, size_t iLen )
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void MakeLower( char *p, size_t iLen )
|
void MakeLower( char *p, std::size_t iLen )
|
||||||
{
|
{
|
||||||
char *pStart = p;
|
char *pStart = p;
|
||||||
char *pEnd = p + iLen;
|
char *pEnd = p + iLen;
|
||||||
@@ -1789,7 +1790,7 @@ void MakeLower( char *p, size_t iLen )
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void UnicodeUpperLower( wchar_t *p, size_t iLen, const unsigned char pMapping[256] )
|
void UnicodeUpperLower( wchar_t *p, std::size_t iLen, const unsigned char pMapping[256] )
|
||||||
{
|
{
|
||||||
wchar_t *pEnd = p + iLen;
|
wchar_t *pEnd = p + iLen;
|
||||||
while( p != pEnd )
|
while( p != pEnd )
|
||||||
@@ -1800,12 +1801,12 @@ void UnicodeUpperLower( wchar_t *p, size_t iLen, const unsigned char pMapping[25
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void MakeUpper( wchar_t *p, size_t iLen )
|
void MakeUpper( wchar_t *p, std::size_t iLen )
|
||||||
{
|
{
|
||||||
UnicodeUpperLower( p, iLen, g_UpperCase );
|
UnicodeUpperLower( p, iLen, g_UpperCase );
|
||||||
}
|
}
|
||||||
|
|
||||||
void MakeLower( wchar_t *p, size_t iLen )
|
void MakeLower( wchar_t *p, std::size_t iLen )
|
||||||
{
|
{
|
||||||
UnicodeUpperLower( p, iLen, g_LowerCase );
|
UnicodeUpperLower( p, iLen, g_LowerCase );
|
||||||
}
|
}
|
||||||
@@ -1928,10 +1929,10 @@ void ReplaceEntityText( RString &sText, const std::map<RString, RString> &m )
|
|||||||
{
|
{
|
||||||
RString sRet;
|
RString sRet;
|
||||||
|
|
||||||
size_t iOffset = 0;
|
std::size_t iOffset = 0;
|
||||||
while( iOffset != sText.size() )
|
while( iOffset != sText.size() )
|
||||||
{
|
{
|
||||||
size_t iStart = sText.find( '&', iOffset );
|
std::size_t iStart = sText.find( '&', iOffset );
|
||||||
if( iStart == sText.npos )
|
if( iStart == sText.npos )
|
||||||
{
|
{
|
||||||
// Optimization: if we didn't replace anything at all, do nothing.
|
// Optimization: if we didn't replace anything at all, do nothing.
|
||||||
@@ -1948,7 +1949,7 @@ void ReplaceEntityText( RString &sText, const std::map<RString, RString> &m )
|
|||||||
iOffset += iStart-iOffset;
|
iOffset += iStart-iOffset;
|
||||||
|
|
||||||
// Optimization: stop early on "&", so "&&&&&&&&&&&" isn't n^2.
|
// Optimization: stop early on "&", so "&&&&&&&&&&&" isn't n^2.
|
||||||
size_t iEnd = sText.find_first_of( "&;", iStart+1 );
|
std::size_t iEnd = sText.find_first_of( "&;", iStart+1 );
|
||||||
if( iEnd == sText.npos || sText[iEnd] == '&' )
|
if( iEnd == sText.npos || sText[iEnd] == '&' )
|
||||||
{
|
{
|
||||||
// & with no matching ;, or two & in a row. Append the & and continue.
|
// & with no matching ;, or two & in a row. Append the & and continue.
|
||||||
@@ -1986,10 +1987,10 @@ void ReplaceEntityText( RString &sText, const std::map<char, RString> &m )
|
|||||||
|
|
||||||
RString sRet;
|
RString sRet;
|
||||||
|
|
||||||
size_t iOffset = 0;
|
std::size_t iOffset = 0;
|
||||||
while( iOffset != sText.size() )
|
while( iOffset != sText.size() )
|
||||||
{
|
{
|
||||||
size_t iStart = sText.find_first_of( sFind, iOffset );
|
std::size_t iStart = sText.find_first_of( sFind, iOffset );
|
||||||
if( iStart == sText.npos )
|
if( iStart == sText.npos )
|
||||||
{
|
{
|
||||||
// Optimization: if we didn't replace anything at all, do nothing.
|
// Optimization: if we didn't replace anything at all, do nothing.
|
||||||
@@ -2028,7 +2029,7 @@ void Replace_Unicode_Markers( RString &sText )
|
|||||||
{
|
{
|
||||||
// Look for &#digits;
|
// Look for &#digits;
|
||||||
bool bHex = false;
|
bool bHex = false;
|
||||||
size_t iPos = sText.find( "&#", iStart );
|
std::size_t iPos = sText.find( "&#", iStart );
|
||||||
if( iPos == sText.npos )
|
if( iPos == sText.npos )
|
||||||
{
|
{
|
||||||
bHex = true;
|
bHex = true;
|
||||||
@@ -2084,11 +2085,11 @@ RString WcharDisplayText( wchar_t c )
|
|||||||
*/
|
*/
|
||||||
RString Basename( const RString &sDir )
|
RString Basename( const RString &sDir )
|
||||||
{
|
{
|
||||||
size_t iEnd = sDir.find_last_not_of( "/\\" );
|
std::size_t iEnd = sDir.find_last_not_of( "/\\" );
|
||||||
if( iEnd == sDir.npos )
|
if( iEnd == sDir.npos )
|
||||||
return RString();
|
return RString();
|
||||||
|
|
||||||
size_t iStart = sDir.find_last_of( "/\\", iEnd );
|
std::size_t iStart = sDir.find_last_of( "/\\", iEnd );
|
||||||
if( iStart == sDir.npos )
|
if( iStart == sDir.npos )
|
||||||
iStart = 0;
|
iStart = 0;
|
||||||
else
|
else
|
||||||
@@ -2205,8 +2206,8 @@ void CollapsePath( RString &sPath, bool bRemoveLeadingDot )
|
|||||||
RString sOut;
|
RString sOut;
|
||||||
sOut.reserve( sPath.size() );
|
sOut.reserve( sPath.size() );
|
||||||
|
|
||||||
size_t iPos = 0;
|
std::size_t iPos = 0;
|
||||||
size_t iNext;
|
std::size_t iNext;
|
||||||
for( ; iPos < sPath.size(); iPos = iNext )
|
for( ; iPos < sPath.size(); iPos = iNext )
|
||||||
{
|
{
|
||||||
// Find the next slash.
|
// Find the next slash.
|
||||||
@@ -2242,7 +2243,7 @@ void CollapsePath( RString &sPath, bool bRemoveLeadingDot )
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Search backwards for the previous path element.
|
// Search backwards for the previous path element.
|
||||||
size_t iPrev = sOut.rfind( '/', sOut.size()-2 );
|
std::size_t iPrev = sOut.rfind( '/', sOut.size()-2 );
|
||||||
if( iPrev == RString::npos )
|
if( iPrev == RString::npos )
|
||||||
iPrev = 0;
|
iPrev = 0;
|
||||||
else
|
else
|
||||||
@@ -2417,7 +2418,7 @@ LuaFunction( lerp, lerp(FArg(1), FArg(2), FArg(3)) );
|
|||||||
int LuaFunc_BinaryToHex(lua_State* L);
|
int LuaFunc_BinaryToHex(lua_State* L);
|
||||||
int LuaFunc_BinaryToHex(lua_State* L)
|
int LuaFunc_BinaryToHex(lua_State* L)
|
||||||
{
|
{
|
||||||
size_t l;
|
std::size_t l;
|
||||||
const char *s = luaL_checklstring(L, 1, &l);
|
const char *s = luaL_checklstring(L, 1, &l);
|
||||||
|
|
||||||
RString hex = BinaryToHex(s, l);
|
RString hex = BinaryToHex(s, l);
|
||||||
@@ -2485,7 +2486,7 @@ int LuaFunc_JsonEncode(lua_State* L)
|
|||||||
return Json::Value(val);
|
return Json::Value(val);
|
||||||
}
|
}
|
||||||
case LUA_TSTRING: {
|
case LUA_TSTRING: {
|
||||||
size_t len;
|
std::size_t len;
|
||||||
const char *s = lua_tolstring(L, index, &len);
|
const char *s = lua_tolstring(L, index, &len);
|
||||||
|
|
||||||
return Json::Value(std::string(s, len));
|
return Json::Value(std::string(s, len));
|
||||||
@@ -2499,7 +2500,7 @@ int LuaFunc_JsonEncode(lua_State* L)
|
|||||||
index = lua_gettop(L) + index + 1;
|
index = lua_gettop(L) + index + 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
size_t len = lua_objlen(L, index);
|
std::size_t len = lua_objlen(L, index);
|
||||||
|
|
||||||
if (len > 0)
|
if (len > 0)
|
||||||
{
|
{
|
||||||
@@ -2529,7 +2530,7 @@ int LuaFunc_JsonEncode(lua_State* L)
|
|||||||
luaL_error(L, "object keys must be strings");
|
luaL_error(L, "object keys must be strings");
|
||||||
}
|
}
|
||||||
|
|
||||||
size_t keylen;
|
std::size_t keylen;
|
||||||
const char *key = lua_tolstring(L, -2, &keylen);
|
const char *key = lua_tolstring(L, -2, &keylen);
|
||||||
obj[std::string(key, keylen)] = convert(-1);
|
obj[std::string(key, keylen)] = convert(-1);
|
||||||
lua_pop(L, 1);
|
lua_pop(L, 1);
|
||||||
@@ -2578,7 +2579,7 @@ int LuaFunc_JsonDecode(lua_State* L)
|
|||||||
luaL_error(L, "JsonDecode requires an argument");
|
luaL_error(L, "JsonDecode requires an argument");
|
||||||
}
|
}
|
||||||
|
|
||||||
size_t datalen;
|
std::size_t datalen;
|
||||||
const char *data = lua_tolstring(L, 1, &datalen);
|
const char *data = lua_tolstring(L, 1, &datalen);
|
||||||
|
|
||||||
Json::Reader reader;
|
Json::Reader reader;
|
||||||
@@ -2687,9 +2688,9 @@ int LuaFunc_multiapproach(lua_State* L)
|
|||||||
{
|
{
|
||||||
luaL_error(L, "multiapproach: A table of current values, a table of goal values, and a table of speeds must be passed.");
|
luaL_error(L, "multiapproach: A table of current values, a table of goal values, and a table of speeds must be passed.");
|
||||||
}
|
}
|
||||||
size_t currents_len= lua_objlen(L, 1);
|
std::size_t currents_len= lua_objlen(L, 1);
|
||||||
size_t goals_len= lua_objlen(L, 2);
|
std::size_t goals_len= lua_objlen(L, 2);
|
||||||
size_t speeds_len= lua_objlen(L, 3);
|
std::size_t speeds_len= lua_objlen(L, 3);
|
||||||
float mult= 1.0f;
|
float mult= 1.0f;
|
||||||
if(lua_isnumber(L, 4))
|
if(lua_isnumber(L, 4))
|
||||||
{
|
{
|
||||||
@@ -2703,7 +2704,7 @@ int LuaFunc_multiapproach(lua_State* L)
|
|||||||
{
|
{
|
||||||
luaL_error(L, "multiapproach: current, goal, and speed must all be tables.");
|
luaL_error(L, "multiapproach: current, goal, and speed must all be tables.");
|
||||||
}
|
}
|
||||||
for(size_t i= 1; i <= currents_len; ++i)
|
for(std::size_t i= 1; i <= currents_len; ++i)
|
||||||
{
|
{
|
||||||
lua_rawgeti(L, 1, i);
|
lua_rawgeti(L, 1, i);
|
||||||
lua_rawgeti(L, 2, i);
|
lua_rawgeti(L, 2, i);
|
||||||
|
|||||||
+12
-9
@@ -3,13 +3,16 @@
|
|||||||
#ifndef RAGE_UTIL_H
|
#ifndef RAGE_UTIL_H
|
||||||
#define RAGE_UTIL_H
|
#define RAGE_UTIL_H
|
||||||
|
|
||||||
|
#include "global.h"
|
||||||
|
|
||||||
#include <algorithm>
|
#include <algorithm>
|
||||||
#include <cmath>
|
#include <cmath>
|
||||||
|
#include <cstddef>
|
||||||
#include <map>
|
#include <map>
|
||||||
#include <random>
|
#include <random>
|
||||||
#include <vector>
|
#include <vector>
|
||||||
#include <sstream>
|
#include <sstream>
|
||||||
#include "global.h"
|
|
||||||
class RageFileDriver;
|
class RageFileDriver;
|
||||||
|
|
||||||
/** @brief Safely delete pointers. */
|
/** @brief Safely delete pointers. */
|
||||||
@@ -337,7 +340,7 @@ float fmodfp( float x, float y );
|
|||||||
int power_of_two( int input );
|
int power_of_two( int input );
|
||||||
bool IsAnInt( const RString &s );
|
bool IsAnInt( const RString &s );
|
||||||
bool IsHexVal( const RString &s );
|
bool IsHexVal( const RString &s );
|
||||||
RString BinaryToHex( const void *pData_, size_t iNumBytes );
|
RString BinaryToHex( const void *pData_, std::size_t iNumBytes );
|
||||||
RString BinaryToHex( const RString &sString );
|
RString BinaryToHex( const RString &sString );
|
||||||
bool HexToBinary( const RString &s, unsigned char *stringOut );
|
bool HexToBinary( const RString &s, unsigned char *stringOut );
|
||||||
bool HexToBinary( const RString &s, RString *sOut );
|
bool HexToBinary( const RString &s, RString *sOut );
|
||||||
@@ -382,16 +385,16 @@ bool FindFirstFilenameContaining(
|
|||||||
extern const wchar_t INVALID_CHAR;
|
extern const wchar_t INVALID_CHAR;
|
||||||
|
|
||||||
int utf8_get_char_len( char p );
|
int utf8_get_char_len( char p );
|
||||||
bool utf8_to_wchar( const char *s, size_t iLength, unsigned &start, wchar_t &ch );
|
bool utf8_to_wchar( const char *s, std::size_t iLength, unsigned &start, wchar_t &ch );
|
||||||
bool utf8_to_wchar_ec( const RString &s, unsigned &start, wchar_t &ch );
|
bool utf8_to_wchar_ec( const RString &s, unsigned &start, wchar_t &ch );
|
||||||
void wchar_to_utf8( wchar_t ch, RString &out );
|
void wchar_to_utf8( wchar_t ch, RString &out );
|
||||||
wchar_t utf8_get_char( const RString &s );
|
wchar_t utf8_get_char( const RString &s );
|
||||||
bool utf8_is_valid( const RString &s );
|
bool utf8_is_valid( const RString &s );
|
||||||
void utf8_remove_bom( RString &s );
|
void utf8_remove_bom( RString &s );
|
||||||
void MakeUpper( char *p, size_t iLen );
|
void MakeUpper( char *p, std::size_t iLen );
|
||||||
void MakeLower( char *p, size_t iLen );
|
void MakeLower( char *p, std::size_t iLen );
|
||||||
void MakeUpper( wchar_t *p, size_t iLen );
|
void MakeUpper( wchar_t *p, std::size_t iLen );
|
||||||
void MakeLower( wchar_t *p, size_t iLen );
|
void MakeLower( wchar_t *p, std::size_t iLen );
|
||||||
|
|
||||||
// TODO: Have the three functions below be moved to better locations.
|
// TODO: Have the three functions below be moved to better locations.
|
||||||
float StringToFloat( const RString &sString );
|
float StringToFloat( const RString &sString );
|
||||||
@@ -454,7 +457,7 @@ bool GetCommandlineArgument( const RString &option, RString *argument=nullptr, i
|
|||||||
extern int g_argc;
|
extern int g_argc;
|
||||||
extern char **g_argv;
|
extern char **g_argv;
|
||||||
|
|
||||||
void CRC32( unsigned int &iCRC, const void *pBuffer, size_t iSize );
|
void CRC32( unsigned int &iCRC, const void *pBuffer, std::size_t iSize );
|
||||||
unsigned int GetHashForString( const RString &s );
|
unsigned int GetHashForString( const RString &s );
|
||||||
unsigned int GetHashForFile( const RString &sPath );
|
unsigned int GetHashForFile( const RString &sPath );
|
||||||
unsigned int GetHashForDirectory( const RString &sDir ); // a hash value that remains the same as long as nothing in the directory has changed
|
unsigned int GetHashForDirectory( const RString &sDir ); // a hash value that remains the same as long as nothing in the directory has changed
|
||||||
@@ -570,7 +573,7 @@ struct char_traits_char_nocase: public std::char_traits<char>
|
|||||||
static inline bool lt( char c1, char c2 )
|
static inline bool lt( char c1, char c2 )
|
||||||
{ return g_UpperCase[(unsigned char)c1] < g_UpperCase[(unsigned char)c2]; }
|
{ return g_UpperCase[(unsigned char)c1] < g_UpperCase[(unsigned char)c2]; }
|
||||||
|
|
||||||
static int compare( const char* s1, const char* s2, size_t n )
|
static int compare( const char* s1, const char* s2, std::size_t n )
|
||||||
{
|
{
|
||||||
int ret = 0;
|
int ret = 0;
|
||||||
while( n-- )
|
while( n-- )
|
||||||
|
|||||||
@@ -33,6 +33,7 @@ static bool AttemptKoreanConversion( RString &sText ) { return CodePageConvert(
|
|||||||
static bool AttemptJapaneseConversion( RString &sText ) { return CodePageConvert( sText, 932 ); }
|
static bool AttemptJapaneseConversion( RString &sText ) { return CodePageConvert( sText, 932 ); }
|
||||||
|
|
||||||
#elif defined(HAVE_ICONV)
|
#elif defined(HAVE_ICONV)
|
||||||
|
#include <cstddef>
|
||||||
#include <errno.h>
|
#include <errno.h>
|
||||||
#include <iconv.h>
|
#include <iconv.h>
|
||||||
|
|
||||||
@@ -47,19 +48,19 @@ static bool ConvertFromCharset( RString &sText, const char *szCharset )
|
|||||||
|
|
||||||
/* Copy the string into a char* for iconv */
|
/* Copy the string into a char* for iconv */
|
||||||
ICONV_CONST char *szTextIn = const_cast<ICONV_CONST char*>( sText.data() );
|
ICONV_CONST char *szTextIn = const_cast<ICONV_CONST char*>( sText.data() );
|
||||||
size_t iInLeft = sText.size();
|
std::size_t iInLeft = sText.size();
|
||||||
|
|
||||||
/* Create a new string with enough room for the new conversion */
|
/* Create a new string with enough room for the new conversion */
|
||||||
RString sBuf;
|
RString sBuf;
|
||||||
sBuf.resize( sText.size() * 5 );
|
sBuf.resize( sText.size() * 5 );
|
||||||
|
|
||||||
char *sTextOut = const_cast<char*>( sBuf.data() );
|
char *sTextOut = const_cast<char*>( sBuf.data() );
|
||||||
size_t iOutLeft = sBuf.size();
|
std::size_t iOutLeft = sBuf.size();
|
||||||
size_t size = iconv( converter, &szTextIn, &iInLeft, &sTextOut, &iOutLeft );
|
std::size_t size = iconv( converter, &szTextIn, &iInLeft, &sTextOut, &iOutLeft );
|
||||||
|
|
||||||
iconv_close( converter );
|
iconv_close( converter );
|
||||||
|
|
||||||
if( size == (size_t)(-1) )
|
if( size == (std::size_t)(-1) )
|
||||||
{
|
{
|
||||||
LOG->Trace( "%s\n", strerror( errno ) );
|
LOG->Trace( "%s\n", strerror( errno ) );
|
||||||
return false; /* Returned an error */
|
return false; /* Returned an error */
|
||||||
@@ -85,6 +86,7 @@ static bool AttemptKoreanConversion( RString &sText ) { return ConvertFromCharse
|
|||||||
static bool AttemptJapaneseConversion( RString &sText ) { return ConvertFromCharset( sText, "CP932" ); }
|
static bool AttemptJapaneseConversion( RString &sText ) { return ConvertFromCharset( sText, "CP932" ); }
|
||||||
|
|
||||||
#elif defined(MACOSX)
|
#elif defined(MACOSX)
|
||||||
|
#include <cstddef>
|
||||||
#include <CoreFoundation/CoreFoundation.h>
|
#include <CoreFoundation/CoreFoundation.h>
|
||||||
|
|
||||||
static bool ConvertFromCP( RString &sText, int iCodePage )
|
static bool ConvertFromCP( RString &sText, int iCodePage )
|
||||||
@@ -98,7 +100,7 @@ static bool ConvertFromCP( RString &sText, int iCodePage )
|
|||||||
|
|
||||||
if( old == nullptr )
|
if( old == nullptr )
|
||||||
return false;
|
return false;
|
||||||
const size_t size = CFStringGetMaximumSizeForEncoding( CFStringGetLength(old), kCFStringEncodingUTF8 );
|
const std::size_t size = CFStringGetMaximumSizeForEncoding( CFStringGetLength(old), kCFStringEncodingUTF8 );
|
||||||
|
|
||||||
char *buf = new char[size+1];
|
char *buf = new char[size+1];
|
||||||
buf[0] = '\0';
|
buf[0] = '\0';
|
||||||
|
|||||||
@@ -4,6 +4,8 @@
|
|||||||
#include "RageUtil.h"
|
#include "RageUtil.h"
|
||||||
#include "RageLog.h"
|
#include "RageLog.h"
|
||||||
|
|
||||||
|
#include <cstddef>
|
||||||
|
|
||||||
/* Search for "beginning*containing*ending". */
|
/* Search for "beginning*containing*ending". */
|
||||||
void FileSet::GetFilesMatching( const RString &sBeginning_, const RString &sContaining_, const RString &sEnding_, std::vector<RString> &asOut, bool bOnlyDirs ) const
|
void FileSet::GetFilesMatching( const RString &sBeginning_, const RString &sContaining_, const RString &sEnding_, std::vector<RString> &asOut, bool bOnlyDirs ) const
|
||||||
{
|
{
|
||||||
@@ -46,7 +48,7 @@ void FileSet::GetFilesMatching( const RString &sBeginning_, const RString &sCont
|
|||||||
* search instead of string match). */
|
* search instead of string match). */
|
||||||
if( !sContaining.empty() )
|
if( !sContaining.empty() )
|
||||||
{
|
{
|
||||||
size_t pos = sPath.find( sContaining, sBeginning.size() );
|
std::size_t pos = sPath.find( sContaining, sBeginning.size() );
|
||||||
if( pos == sPath.npos )
|
if( pos == sPath.npos )
|
||||||
continue; /* doesn't contain it */
|
continue; /* doesn't contain it */
|
||||||
if( pos + sContaining.size() > unsigned(end_pos) )
|
if( pos + sContaining.size() > unsigned(end_pos) )
|
||||||
@@ -104,7 +106,7 @@ static void SplitPath( RString sPath, RString &sDir, RString &sName )
|
|||||||
if( sPath.Right(1) == "/" )
|
if( sPath.Right(1) == "/" )
|
||||||
sPath.erase( sPath.size()-1 );
|
sPath.erase( sPath.size()-1 );
|
||||||
|
|
||||||
size_t iSep = sPath.find_last_of( '/' );
|
std::size_t iSep = sPath.find_last_of( '/' );
|
||||||
if( iSep == RString::npos )
|
if( iSep == RString::npos )
|
||||||
{
|
{
|
||||||
sDir = "";
|
sDir = "";
|
||||||
@@ -234,14 +236,14 @@ void FilenameDB::GetFilesEqualTo( const RString &sDir, const RString &sFile, std
|
|||||||
void FilenameDB::GetFilesSimpleMatch( const RString &sDir, const RString &sMask, std::vector<RString> &asOut, bool bOnlyDirs )
|
void FilenameDB::GetFilesSimpleMatch( const RString &sDir, const RString &sMask, std::vector<RString> &asOut, bool bOnlyDirs )
|
||||||
{
|
{
|
||||||
/* Does this contain a wildcard? */
|
/* Does this contain a wildcard? */
|
||||||
size_t first_pos = sMask.find_first_of( '*' );
|
std::size_t first_pos = sMask.find_first_of( '*' );
|
||||||
if( first_pos == sMask.npos )
|
if( first_pos == sMask.npos )
|
||||||
{
|
{
|
||||||
/* No; just do a regular search. */
|
/* No; just do a regular search. */
|
||||||
GetFilesEqualTo( sDir, sMask, asOut, bOnlyDirs );
|
GetFilesEqualTo( sDir, sMask, asOut, bOnlyDirs );
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
size_t second_pos = sMask.find_first_of( '*', first_pos+1 );
|
std::size_t second_pos = sMask.find_first_of( '*', first_pos+1 );
|
||||||
if( second_pos == sMask.npos )
|
if( second_pos == sMask.npos )
|
||||||
{
|
{
|
||||||
/* Only one *: "A*B". */
|
/* Only one *: "A*B". */
|
||||||
@@ -576,7 +578,7 @@ void FilenameDB::GetDirListing( const RString &sPath_, std::vector<RString> &asA
|
|||||||
ASSERT( !sPath.empty() );
|
ASSERT( !sPath.empty() );
|
||||||
|
|
||||||
/* Strip off the last path element and use it as a mask. */
|
/* Strip off the last path element and use it as a mask. */
|
||||||
size_t pos = sPath.find_last_of( '/' );
|
std::size_t pos = sPath.find_last_of( '/' );
|
||||||
RString fn;
|
RString fn;
|
||||||
if( pos == sPath.npos )
|
if( pos == sPath.npos )
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -7,6 +7,8 @@
|
|||||||
#include "PlayerState.h"
|
#include "PlayerState.h"
|
||||||
#include "Style.h"
|
#include "Style.h"
|
||||||
|
|
||||||
|
#include <cstddef>
|
||||||
|
|
||||||
ReceptorArrowRow::ReceptorArrowRow()
|
ReceptorArrowRow::ReceptorArrowRow()
|
||||||
{
|
{
|
||||||
m_pPlayerState = nullptr;
|
m_pPlayerState = nullptr;
|
||||||
@@ -34,7 +36,7 @@ void ReceptorArrowRow::Load( const PlayerState* pPlayerState, float fYReverseOff
|
|||||||
void ReceptorArrowRow::SetColumnRenderers(std::vector<NoteColumnRenderer>& renderers)
|
void ReceptorArrowRow::SetColumnRenderers(std::vector<NoteColumnRenderer>& renderers)
|
||||||
{
|
{
|
||||||
ASSERT_M(renderers.size() == m_ReceptorArrow.size(), "Notefield has different number of columns than receptor row.");
|
ASSERT_M(renderers.size() == m_ReceptorArrow.size(), "Notefield has different number of columns than receptor row.");
|
||||||
for(size_t c= 0; c < m_ReceptorArrow.size(); ++c)
|
for(std::size_t c= 0; c < m_ReceptorArrow.size(); ++c)
|
||||||
{
|
{
|
||||||
m_ReceptorArrow[c]->SetFakeParent(&(renderers[c]));
|
m_ReceptorArrow[c]->SetFakeParent(&(renderers[c]));
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -20,8 +20,10 @@
|
|||||||
#include "TimingData.h"
|
#include "TimingData.h"
|
||||||
#include "NoteDataWithScoring.h"
|
#include "NoteDataWithScoring.h"
|
||||||
|
|
||||||
static RString PercentScoreWeightName( size_t i ) { return "PercentScoreWeight" + ScoreEventToString( (ScoreEvent)i ); }
|
#include <cstddef>
|
||||||
static RString GradeWeightName( size_t i ) { return "GradeWeight" + ScoreEventToString( (ScoreEvent)i ); }
|
|
||||||
|
static RString PercentScoreWeightName( std::size_t i ) { return "PercentScoreWeight" + ScoreEventToString( (ScoreEvent)i ); }
|
||||||
|
static RString GradeWeightName( std::size_t i ) { return "GradeWeight" + ScoreEventToString( (ScoreEvent)i ); }
|
||||||
|
|
||||||
static ThemeMetric1D<int> g_iPercentScoreWeight("ScoreKeeperNormal", PercentScoreWeightName, NUM_ScoreEvent );
|
static ThemeMetric1D<int> g_iPercentScoreWeight("ScoreKeeperNormal", PercentScoreWeightName, NUM_ScoreEvent );
|
||||||
static ThemeMetric1D<int> g_iGradeWeight("ScoreKeeperNormal", GradeWeightName, NUM_ScoreEvent );
|
static ThemeMetric1D<int> g_iGradeWeight("ScoreKeeperNormal", GradeWeightName, NUM_ScoreEvent );
|
||||||
|
|||||||
@@ -10,9 +10,11 @@
|
|||||||
#include "PlayerState.h"
|
#include "PlayerState.h"
|
||||||
#include "NoteTypes.h"
|
#include "NoteTypes.h"
|
||||||
|
|
||||||
|
#include <cstddef>
|
||||||
|
|
||||||
ThemeMetric<float> ATTACK_DURATION_SECONDS ("ScoreKeeperRave","AttackDurationSeconds");
|
ThemeMetric<float> ATTACK_DURATION_SECONDS ("ScoreKeeperRave","AttackDurationSeconds");
|
||||||
|
|
||||||
static void SuperMeterPercentChangeInit( size_t /*ScoreEvent*/ i, RString &sNameOut, float &defaultValueOut )
|
static void SuperMeterPercentChangeInit( std::size_t /*ScoreEvent*/ i, RString &sNameOut, float &defaultValueOut )
|
||||||
{
|
{
|
||||||
ScoreEvent ci = (ScoreEvent)i;
|
ScoreEvent ci = (ScoreEvent)i;
|
||||||
sNameOut = "SuperMeterPercentChange" + ScoreEventToString( ci );
|
sNameOut = "SuperMeterPercentChange" + ScoreEventToString( ci );
|
||||||
|
|||||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user