Decouple <cstddef>
This commit is contained in:
+1
-7
@@ -107,20 +107,14 @@ check_function_exists(waitpid HAVE_WAITPID)
|
||||
|
||||
# Mostly universal symbols.
|
||||
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)
|
||||
|
||||
# Checks to make it easier to work with 32-bit/64-bit builds if required.
|
||||
include(CheckTypeSize)
|
||||
check_type_size(intptr_t SIZEOF_INTPTR_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(SIZEOF_INTPTR_T EQUAL 8)
|
||||
if(CMAKE_SIZEOF_VOID_P EQUAL 8)
|
||||
set(SM_WIN32_ARCH "x64")
|
||||
else()
|
||||
set(SM_WIN32_ARCH "x86")
|
||||
|
||||
Vendored
-6
@@ -17,16 +17,10 @@
|
||||
#endif
|
||||
|
||||
/* 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
|
||||
#endif
|
||||
|
||||
/* 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
|
||||
#endif
|
||||
|
||||
/* At some point, allow for defining CHAR_IS_UNSIGNED. */
|
||||
|
||||
|
||||
+13
-12
@@ -15,6 +15,7 @@
|
||||
#include "Preference.h"
|
||||
|
||||
#include <cmath>
|
||||
#include <cstddef>
|
||||
#include <typeinfo>
|
||||
|
||||
static Preference<bool> g_bShowMasks("ShowMasks", false);
|
||||
@@ -173,7 +174,7 @@ Actor::~Actor()
|
||||
{
|
||||
StopTweening();
|
||||
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]);
|
||||
}
|
||||
@@ -194,7 +195,7 @@ Actor::Actor( const Actor &cpy ):
|
||||
CPY( m_pLuaInstance );
|
||||
|
||||
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]));
|
||||
}
|
||||
@@ -402,7 +403,7 @@ void Actor::Draw()
|
||||
{
|
||||
m_FakeParent->BeginDraw();
|
||||
}
|
||||
size_t wrapper_states_used= 0;
|
||||
std::size_t wrapper_states_used= 0;
|
||||
RageColor last_diffuse;
|
||||
RageColor last_glow;
|
||||
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[1] is inside wrapper[2]. The actor is inside wrapper[1].
|
||||
// -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];
|
||||
if(!state->m_bVisible || state->m_fHibernateSecondsLeft > 0 ||
|
||||
@@ -467,7 +468,7 @@ void Actor::Draw()
|
||||
}
|
||||
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];
|
||||
if(abort_with_end_draw)
|
||||
@@ -886,7 +887,7 @@ void Actor::Update( float fDeltaTime )
|
||||
fDeltaTime = -m_fHibernateSecondsLeft;
|
||||
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);
|
||||
}
|
||||
@@ -992,14 +993,14 @@ void Actor::AddWrapperState()
|
||||
m_WrapperStates.push_back(wrapper);
|
||||
}
|
||||
|
||||
void Actor::RemoveWrapperState(size_t i)
|
||||
void Actor::RemoveWrapperState(std::size_t i)
|
||||
{
|
||||
ASSERT(i < m_WrapperStates.size());
|
||||
SAFE_DELETE(m_WrapperStates[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());
|
||||
return m_WrapperStates[i];
|
||||
@@ -1972,11 +1973,11 @@ public:
|
||||
p->GetWrapperState(p->GetNumWrapperStates()-1)->PushSelf(L);
|
||||
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.
|
||||
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())
|
||||
{
|
||||
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)
|
||||
{
|
||||
size_t si= get_state_index(p, L, 1);
|
||||
std::size_t si= get_state_index(p, L, 1);
|
||||
p->RemoveWrapperState(si);
|
||||
COMMON_RETURN_SELF;
|
||||
}
|
||||
@@ -1996,7 +1997,7 @@ public:
|
||||
}
|
||||
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);
|
||||
return 1;
|
||||
}
|
||||
|
||||
+21
-19
@@ -13,6 +13,8 @@ class LuaClass;
|
||||
#include "MessageManager.h"
|
||||
#include "Tween.h"
|
||||
|
||||
#include <cstddef>
|
||||
|
||||
typedef AutoPtrCopyOnWrite<LuaReference> apActorCommands;
|
||||
|
||||
/** @brief The background layer. */
|
||||
@@ -275,8 +277,8 @@ public:
|
||||
virtual void DrawPrimitives() {};
|
||||
/** @brief Pop the transform from the world matrix stack. */
|
||||
virtual void EndDraw();
|
||||
|
||||
// TODO: make Update non virtual and change all classes to override UpdateInternal
|
||||
|
||||
// TODO: make Update non virtual and change all classes to override UpdateInternal
|
||||
// instead.
|
||||
bool IsFirstUpdate() const;
|
||||
virtual void Update( float fDeltaTime ); // this can short circuit UpdateInternal
|
||||
@@ -315,9 +317,9 @@ public:
|
||||
Actor* GetFakeParent() { return m_FakeParent; }
|
||||
|
||||
void AddWrapperState();
|
||||
void RemoveWrapperState(size_t i);
|
||||
Actor* GetWrapperState(size_t i);
|
||||
size_t GetNumWrapperStates() const { return m_WrapperStates.size(); }
|
||||
void RemoveWrapperState(std::size_t i);
|
||||
Actor* GetWrapperState(std::size_t i);
|
||||
std::size_t GetNumWrapperStates() const { return m_WrapperStates.size(); }
|
||||
|
||||
/**
|
||||
* @brief Retrieve the Actor's x position.
|
||||
@@ -397,9 +399,9 @@ public:
|
||||
* @brief Set the zoom factor for all dimensions of the Actor.
|
||||
* @param zoom the zoom factor for all dimensions. */
|
||||
void SetZoom( float zoom )
|
||||
{
|
||||
DestTweenState().scale.x = zoom;
|
||||
DestTweenState().scale.y = zoom;
|
||||
{
|
||||
DestTweenState().scale.x = zoom;
|
||||
DestTweenState().scale.y = zoom;
|
||||
DestTweenState().scale.z = zoom;
|
||||
}
|
||||
/**
|
||||
@@ -497,7 +499,7 @@ public:
|
||||
|
||||
/** @brief How do we handle stretching the Actor? */
|
||||
enum StretchType
|
||||
{
|
||||
{
|
||||
fit_inside, /**< Have the Actor fit inside its parent, using the smaller zoom. */
|
||||
cover /**< Have the Actor cover its parent, using the larger zoom. */
|
||||
};
|
||||
@@ -579,16 +581,16 @@ public:
|
||||
void StopAnimating() { this->EnableAnimation(false); }
|
||||
|
||||
// render states
|
||||
void SetBlendMode( BlendMode mode ) { m_BlendMode = mode; }
|
||||
void SetBlendMode( BlendMode mode ) { m_BlendMode = mode; }
|
||||
void SetTextureTranslate( float x, float y ) { m_texTranslate.x = x; m_texTranslate.y = y; }
|
||||
void SetTextureWrapping( bool b ) { m_bTextureWrapping = b; }
|
||||
void SetTextureFiltering( bool b ) { m_bTextureFiltering = b; }
|
||||
void SetClearZBuffer( bool b ) { m_bClearZBuffer = b; }
|
||||
void SetUseZBuffer( bool b ) { SetZTestMode(b?ZTEST_WRITE_ON_PASS:ZTEST_OFF); SetZWrite(b); }
|
||||
virtual void SetZTestMode( ZTestMode mode ) { m_ZTestMode = mode; }
|
||||
virtual void SetZWrite( bool b ) { m_bZWrite = b; }
|
||||
void SetTextureWrapping( bool b ) { m_bTextureWrapping = b; }
|
||||
void SetTextureFiltering( bool b ) { m_bTextureFiltering = b; }
|
||||
void SetClearZBuffer( bool b ) { m_bClearZBuffer = b; }
|
||||
void SetUseZBuffer( bool b ) { SetZTestMode(b?ZTEST_WRITE_ON_PASS:ZTEST_OFF); SetZWrite(b); }
|
||||
virtual void SetZTestMode( ZTestMode mode ) { m_ZTestMode = mode; }
|
||||
virtual void SetZWrite( bool b ) { m_bZWrite = b; }
|
||||
void SetZBias( float f ) { m_fZBias = f; }
|
||||
virtual void SetCullMode( CullMode mode ) { m_CullMode = mode; }
|
||||
virtual void SetCullMode( CullMode mode ) { m_CullMode = mode; }
|
||||
|
||||
// Lua
|
||||
virtual void PushSelf( lua_State *L );
|
||||
@@ -761,7 +763,7 @@ private:
|
||||
* @author Chris Danford (c) 2001-2004
|
||||
* @section LICENSE
|
||||
* All rights reserved.
|
||||
*
|
||||
*
|
||||
* Permission is hereby granted, free of charge, to any person obtaining a
|
||||
* copy of this software and associated documentation files (the
|
||||
* "Software"), to deal in the Software without restriction, including
|
||||
@@ -771,7 +773,7 @@ private:
|
||||
* copyright notice(s) and this permission notice appear in all copies of
|
||||
* the Software and that both the above copyright notice(s) and this
|
||||
* permission notice appear in supporting documentation.
|
||||
*
|
||||
*
|
||||
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
|
||||
* OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
||||
* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT OF
|
||||
|
||||
@@ -1,6 +1,4 @@
|
||||
#include "global.h"
|
||||
#include <cassert>
|
||||
|
||||
#include "ActorMultiTexture.h"
|
||||
#include "RageTextureManager.h"
|
||||
#include "XmlFile.h"
|
||||
@@ -9,10 +7,12 @@
|
||||
#include "RageTexture.h"
|
||||
#include "RageUtil.h"
|
||||
#include "ActorUtil.h"
|
||||
|
||||
#include "LuaBinding.h"
|
||||
#include "LuaManager.h"
|
||||
|
||||
#include <cassert>
|
||||
#include <cstddef>
|
||||
|
||||
REGISTER_ACTOR_CLASS( ActorMultiTexture );
|
||||
|
||||
|
||||
@@ -98,7 +98,7 @@ void ActorMultiTexture::DrawPrimitives()
|
||||
quadVerticies.bottom = +m_size.y/2.0f;
|
||||
|
||||
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);
|
||||
DISPLAY->SetTexture( tu, m_aTextureUnits[i].m_pTexture->GetTexHandle() );
|
||||
@@ -127,7 +127,7 @@ void ActorMultiTexture::DrawPrimitives()
|
||||
|
||||
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->SetEffectMode( EffectMode_Normal );
|
||||
@@ -142,7 +142,7 @@ bool ActorMultiTexture::EarlyAbortDraw() const
|
||||
// lua start
|
||||
#include "LuaBinding.h"
|
||||
|
||||
/** @brief Allow Lua to have access to the ActorMultiTexture. */
|
||||
/** @brief Allow Lua to have access to the ActorMultiTexture. */
|
||||
class LunaActorMultiTexture: public Luna<ActorMultiTexture>
|
||||
{
|
||||
public:
|
||||
@@ -200,7 +200,7 @@ LUA_REGISTER_DERIVED_CLASS( ActorMultiTexture, Actor )
|
||||
/*
|
||||
* (c) 2001-2007 Glenn Maynard, Chris Danford
|
||||
* All rights reserved.
|
||||
*
|
||||
*
|
||||
* Permission is hereby granted, free of charge, to any person obtaining a
|
||||
* copy of this software and associated documentation files (the
|
||||
* "Software"), to deal in the Software without restriction, including
|
||||
@@ -210,7 +210,7 @@ LUA_REGISTER_DERIVED_CLASS( ActorMultiTexture, Actor )
|
||||
* copyright notice(s) and this permission notice appear in all copies of
|
||||
* the Software and that both the above copyright notice(s) and this
|
||||
* permission notice appear in supporting documentation.
|
||||
*
|
||||
*
|
||||
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
|
||||
* OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
||||
* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT OF
|
||||
|
||||
+53
-53
@@ -1,6 +1,4 @@
|
||||
#include "global.h"
|
||||
#include <cassert>
|
||||
|
||||
#include "ActorMultiVertex.h"
|
||||
#include "RageTextureManager.h"
|
||||
#include "XmlFile.h"
|
||||
@@ -14,6 +12,8 @@
|
||||
#include "LuaManager.h"
|
||||
#include "LocalizedString.h"
|
||||
|
||||
#include <cassert>
|
||||
#include <cstddef>
|
||||
#include <numeric>
|
||||
|
||||
const float min_state_delay= 0.0001f;
|
||||
@@ -67,7 +67,7 @@ ActorMultiVertex::ActorMultiVertex()
|
||||
_EffectMode = EffectMode_Normal;
|
||||
_TextureMode = TextureMode_Modulate;
|
||||
_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].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 )
|
||||
{
|
||||
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();
|
||||
}
|
||||
@@ -169,7 +169,7 @@ void ActorMultiVertex::SetNumVertices( size_t n )
|
||||
}
|
||||
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 );
|
||||
}
|
||||
@@ -180,7 +180,7 @@ void ActorMultiVertex::SetNumVertices( size_t n )
|
||||
|
||||
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() );
|
||||
}
|
||||
@@ -192,7 +192,7 @@ void ActorMultiVertex::AddVertices( int Add )
|
||||
{
|
||||
int size = AMV_DestTweenState().vertices.size();
|
||||
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 );
|
||||
}
|
||||
@@ -224,7 +224,7 @@ void ActorMultiVertex::DrawPrimitives()
|
||||
|
||||
Actor::SetTextureRenderStates();
|
||||
DISPLAY->SetEffectMode( _EffectMode );
|
||||
|
||||
|
||||
// set temporary diffuse and glow
|
||||
static AMV_TweenState TS;
|
||||
|
||||
@@ -235,7 +235,7 @@ void ActorMultiVertex::DrawPrimitives()
|
||||
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.
|
||||
// RageColor uses a float. 0-1.
|
||||
@@ -254,9 +254,9 @@ void ActorMultiVertex::DrawPrimitives()
|
||||
MULT_COLOR_ELEMENTS(TS.vertices[i].c.a, m_pTempState->diffuse[0].a);
|
||||
#undef MULT_COLOR_ELEMENTS
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
||||
// Draw diffuse pass.
|
||||
if( m_pTempState->diffuse[0].a > 0 )
|
||||
{
|
||||
@@ -268,10 +268,10 @@ void ActorMultiVertex::DrawPrimitives()
|
||||
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;
|
||||
}
|
||||
}
|
||||
DISPLAY->SetTextureMode( TextureUnit_1, TextureMode_Glow );
|
||||
DrawInternal( AMV_TempState );
|
||||
|
||||
@@ -343,19 +343,19 @@ bool ActorMultiVertex::EarlyAbortDraw() const
|
||||
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;
|
||||
size_t first= AMV_DestTweenState().FirstToDraw + offset;
|
||||
size_t num_verts= AMV_DestTweenState().GetSafeNumToDraw(AMV_DestTweenState()._DrawMode, AMV_DestTweenState().NumToDraw) - offset;
|
||||
std::size_t first= AMV_DestTweenState().FirstToDraw + offset;
|
||||
std::size_t num_verts= AMV_DestTweenState().GetSafeNumToDraw(AMV_DestTweenState()._DrawMode, AMV_DestTweenState().NumToDraw) - offset;
|
||||
std::vector<float> tper(num_splines, 0.0f);
|
||||
float num_parts= (static_cast<float>(num_verts) /
|
||||
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;
|
||||
}
|
||||
for(size_t v= 0; v < num_verts; ++v)
|
||||
for(std::size_t v= 0; v < num_verts; ++v)
|
||||
{
|
||||
std::vector<float> pos;
|
||||
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);
|
||||
return &(_splines[i]);
|
||||
@@ -403,7 +403,7 @@ CubicSplineN* ActorMultiVertex::GetSpline(size_t 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;
|
||||
_secs_into_state= 0.0f;
|
||||
}
|
||||
@@ -439,7 +439,7 @@ void ActorMultiVertex::UpdateAnimationState(bool force_update)
|
||||
{
|
||||
AMV_TweenState& dest= AMV_DestTweenState();
|
||||
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() ||
|
||||
dest._DrawMode == DrawMode_LineStrip || qs.empty())
|
||||
{ return; }
|
||||
@@ -456,15 +456,15 @@ void ActorMultiVertex::UpdateAnimationState(bool force_update)
|
||||
}
|
||||
if(state_changed)
|
||||
{
|
||||
size_t first= dest.FirstToDraw;
|
||||
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();
|
||||
std::size_t first= dest.FirstToDraw;
|
||||
std::size_t last= first+dest.GetSafeNumToDraw(dest._DrawMode, dest.NumToDraw);
|
||||
#define STATE_ID const std::size_t state_id= (_cur_state + qs[quad_id % qs.size()]) % _states.size();
|
||||
switch(AMV_DestTweenState()._DrawMode)
|
||||
{
|
||||
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;
|
||||
switch((i-first)%4)
|
||||
{
|
||||
@@ -488,9 +488,9 @@ void ActorMultiVertex::UpdateAnimationState(bool force_update)
|
||||
}
|
||||
break;
|
||||
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;
|
||||
switch((i-first)%2)
|
||||
{
|
||||
@@ -507,18 +507,18 @@ void ActorMultiVertex::UpdateAnimationState(bool force_update)
|
||||
break;
|
||||
case DrawMode_Strip:
|
||||
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;
|
||||
verts[i].t.x= _states[state_id].rect.left;
|
||||
verts[i].t.y= _states[state_id].rect.top;
|
||||
}
|
||||
break;
|
||||
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;
|
||||
switch((i-first)%3)
|
||||
{
|
||||
@@ -538,9 +538,9 @@ void ActorMultiVertex::UpdateAnimationState(bool force_update)
|
||||
}
|
||||
break;
|
||||
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;
|
||||
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)
|
||||
{
|
||||
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);
|
||||
}
|
||||
@@ -685,7 +685,7 @@ int ActorMultiVertex::AMV_TweenState::GetSafeNumToDraw( DrawMode dm, int num ) c
|
||||
// lua start
|
||||
#include "LuaBinding.h"
|
||||
|
||||
/** @brief Allow Lua to have access to the ActorMultiVertex. */
|
||||
/** @brief Allow Lua to have access to the ActorMultiVertex. */
|
||||
class LunaActorMultiVertex: public Luna<ActorMultiVertex>
|
||||
{
|
||||
public:
|
||||
@@ -696,7 +696,7 @@ public:
|
||||
}
|
||||
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
|
||||
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.");
|
||||
return;
|
||||
}
|
||||
size_t NumDataParts = lua_objlen(L, DataStackIndex);
|
||||
for(size_t i = 0; i < NumDataParts; ++i)
|
||||
std::size_t NumDataParts = lua_objlen(L, DataStackIndex);
|
||||
for(std::size_t i = 0; i < NumDataParts; ++i)
|
||||
{
|
||||
lua_pushnumber(L, i+1);
|
||||
lua_gettable(L, DataStackIndex);
|
||||
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)
|
||||
{
|
||||
LuaHelpers::ReportScriptErrorFmt( "ActorMultiVertex::SetVertex: non-table parameter %u supplied inside table of parameters, table expected.", (unsigned int)i );
|
||||
@@ -889,7 +889,7 @@ public:
|
||||
lua_pushnumber(L, p->GetDestNumToDraw());
|
||||
return 1;
|
||||
}
|
||||
|
||||
|
||||
static int GetCurrDrawMode( T* p, lua_State* L )
|
||||
{
|
||||
Enum::Push(L, p->GetCurrDrawMode());
|
||||
@@ -908,7 +908,7 @@ public:
|
||||
lua_pushnumber(L, p->GetCurrNumToDraw());
|
||||
return 1;
|
||||
}
|
||||
|
||||
|
||||
static int LoadTexture( T* p, lua_State *L )
|
||||
{
|
||||
if( lua_isnil(L, 1) )
|
||||
@@ -928,7 +928,7 @@ public:
|
||||
|
||||
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)
|
||||
{
|
||||
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);
|
||||
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;
|
||||
if(index < 0 || index >= p->GetNumStates())
|
||||
{
|
||||
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)
|
||||
{
|
||||
@@ -1069,9 +1069,9 @@ public:
|
||||
luaL_error(L, "The texture must be set before adding 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);
|
||||
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);
|
||||
FillStateFromLua(L, new_states[i], tex, -1);
|
||||
@@ -1096,14 +1096,14 @@ public:
|
||||
lua_pushnumber(L, p->GetNumQuadStates());
|
||||
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;
|
||||
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);
|
||||
}
|
||||
return static_cast<size_t>(index);
|
||||
return static_cast<std::size_t>(index);
|
||||
}
|
||||
static int AddQuadState(T* p, lua_State *L)
|
||||
{
|
||||
@@ -1215,7 +1215,7 @@ LUA_REGISTER_DERIVED_CLASS( ActorMultiVertex, Actor )
|
||||
/*
|
||||
* (c) 2014 Matthew Gardner and Eric Reese
|
||||
* All rights reserved.
|
||||
*
|
||||
*
|
||||
* Permission is hereby granted, free of charge, to any person obtaining a
|
||||
* copy of this software and associated documentation files (the
|
||||
* "Software"), to deal in the Software without restriction, including
|
||||
@@ -1225,7 +1225,7 @@ LUA_REGISTER_DERIVED_CLASS( ActorMultiVertex, Actor )
|
||||
* copyright notice(s) and this permission notice appear in all copies of
|
||||
* the Software and that both the above copyright notice(s) and this
|
||||
* permission notice appear in supporting documentation.
|
||||
*
|
||||
*
|
||||
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
|
||||
* OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
||||
* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT OF
|
||||
|
||||
+24
-22
@@ -6,6 +6,8 @@
|
||||
#include "RageMath.h"
|
||||
#include "RageTextureID.h"
|
||||
|
||||
#include <cstddef>
|
||||
|
||||
enum DrawMode
|
||||
{
|
||||
DrawMode_Quads = 0,
|
||||
@@ -28,7 +30,7 @@ class RageTexture;
|
||||
class ActorMultiVertex: public Actor
|
||||
{
|
||||
public:
|
||||
static const size_t num_vert_splines= 4;
|
||||
static const std::size_t num_vert_splines= 4;
|
||||
ActorMultiVertex();
|
||||
ActorMultiVertex( const ActorMultiVertex &cpy );
|
||||
virtual ~ActorMultiVertex();
|
||||
@@ -49,7 +51,7 @@ public:
|
||||
int GetSafeNumToDraw( DrawMode dm, int num ) const;
|
||||
|
||||
std::vector<RageSpriteVertex> vertices;
|
||||
std::vector<size_t> quad_states;
|
||||
std::vector<std::size_t> quad_states;
|
||||
|
||||
DrawMode _DrawMode;
|
||||
int FirstToDraw;
|
||||
@@ -73,7 +75,7 @@ public:
|
||||
virtual bool EarlyAbortDraw() const override;
|
||||
virtual void DrawPrimitives() override;
|
||||
virtual void DrawInternal( const AMV_TweenState *TS );
|
||||
|
||||
|
||||
void SetCurrentTweenStart() override;
|
||||
void EraseHeadTween() override;
|
||||
void UpdatePercentThroughTween( float PercentThroughTween ) override;
|
||||
@@ -81,13 +83,13 @@ public:
|
||||
|
||||
void StopTweening() override;
|
||||
void FinishTweening() override;
|
||||
|
||||
|
||||
void SetTexture( RageTexture *Texture );
|
||||
RageTexture* GetTexture() { return _Texture; };
|
||||
void LoadFromTexture( RageTextureID ID );
|
||||
|
||||
void UnloadTexture();
|
||||
void SetNumVertices( size_t n );
|
||||
void SetNumVertices( std::size_t n );
|
||||
|
||||
void AddVertex();
|
||||
void AddVertices( int Add );
|
||||
@@ -104,15 +106,15 @@ public:
|
||||
DrawMode GetCurrDrawMode() const { return AMV_current._DrawMode; }
|
||||
int GetCurrFirstToDraw() const { return AMV_current.FirstToDraw; }
|
||||
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 SetVertexColor( int index , RageColor c );
|
||||
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();
|
||||
CubicSplineN* GetSpline(size_t i);
|
||||
CubicSplineN* GetSpline(std::size_t i);
|
||||
|
||||
struct State
|
||||
{
|
||||
@@ -121,12 +123,12 @@ public:
|
||||
};
|
||||
int GetNumStates() const override { return _states.size(); }
|
||||
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); }
|
||||
size_t GetState() { return _cur_state; }
|
||||
State& GetStateData(size_t i)
|
||||
std::size_t GetState() { return _cur_state; }
|
||||
State& GetStateData(std::size_t 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; }
|
||||
void SetStateProperties(const std::vector<State>& new_states)
|
||||
{ _states= new_states; SetState(0); }
|
||||
@@ -135,15 +137,15 @@ public:
|
||||
float GetAnimationLengthSeconds() const override;
|
||||
void SetSecondsIntoAnimation(float seconds) override;
|
||||
void UpdateAnimationState(bool force_update= false);
|
||||
size_t GetNumQuadStates() const
|
||||
std::size_t GetNumQuadStates() const
|
||||
{ return AMV_DestTweenState().quad_states.size(); }
|
||||
void AddQuadState(size_t s)
|
||||
void AddQuadState(std::size_t 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); }
|
||||
size_t GetQuadState(size_t i)
|
||||
std::size_t GetQuadState(std::size_t 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; }
|
||||
bool _use_animation_state;
|
||||
bool _decode_movie;
|
||||
@@ -160,7 +162,7 @@ private:
|
||||
|
||||
// required to handle diffuse and glow
|
||||
AMV_TweenState *AMV_TempState;
|
||||
|
||||
|
||||
EffectMode _EffectMode;
|
||||
TextureMode _TextureMode;
|
||||
|
||||
@@ -170,7 +172,7 @@ private:
|
||||
|
||||
bool _skip_next_update;
|
||||
float _secs_into_state;
|
||||
size_t _cur_state;
|
||||
std::size_t _cur_state;
|
||||
std::vector<State> _states;
|
||||
};
|
||||
|
||||
@@ -179,7 +181,7 @@ private:
|
||||
* @author Matthew Gardner and Eric Reese (c) 2014
|
||||
* @section LICENSE
|
||||
* All rights reserved.
|
||||
*
|
||||
*
|
||||
* Permission is hereby granted, free of charge, to any person obtaining a
|
||||
* copy of this software and associated documentation files (the
|
||||
* "Software"), to deal in the Software without restriction, including
|
||||
@@ -189,7 +191,7 @@ private:
|
||||
* copyright notice(s) and this permission notice appear in all copies of
|
||||
* the Software and that both the above copyright notice(s) and this
|
||||
* permission notice appear in supporting documentation.
|
||||
*
|
||||
*
|
||||
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
|
||||
* OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
||||
* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT OF
|
||||
|
||||
+4
-3
@@ -43,6 +43,7 @@
|
||||
#include "ScreenManager.h"
|
||||
|
||||
#include <cmath>
|
||||
#include <cstddef>
|
||||
|
||||
|
||||
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*> &bpmOrig = original.GetTimingSegments(SEGMENT_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 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);
|
||||
|
||||
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 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);
|
||||
|
||||
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] )
|
||||
continue;
|
||||
|
||||
@@ -15,6 +15,7 @@
|
||||
|
||||
#include <cfloat>
|
||||
#include <cmath>
|
||||
#include <cstddef>
|
||||
|
||||
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_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 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 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 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 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 ThemeMetric<float> DRUNK_COLUMN_FREQUENCY( "ArrowEffects", "DrunkColumnFrequency" );
|
||||
|
||||
+15
-14
@@ -11,6 +11,7 @@
|
||||
#include "LuaBinding.h"
|
||||
|
||||
#include <cmath>
|
||||
#include <cstddef>
|
||||
|
||||
|
||||
REGISTER_ACTOR_CLASS( BitmapText );
|
||||
@@ -643,13 +644,13 @@ bool BitmapText::StringWillUseAlternate( const RString& sText, const RString& sA
|
||||
return true;
|
||||
}
|
||||
|
||||
void BitmapText::CropLineToWidth(size_t l, int width)
|
||||
void BitmapText::CropLineToWidth(std::size_t l, int width)
|
||||
{
|
||||
if(l < m_wTextLines.size())
|
||||
{
|
||||
int used_width= width;
|
||||
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())
|
||||
{
|
||||
line.erase(line.begin()+fit, line.end());
|
||||
@@ -660,7 +661,7 @@ void BitmapText::CropLineToWidth(size_t l, 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);
|
||||
}
|
||||
@@ -721,12 +722,12 @@ void BitmapText::DrawPrimitives()
|
||||
}
|
||||
else
|
||||
{
|
||||
size_t i = 0;
|
||||
std::map<size_t,Attribute>::const_iterator iter = m_mAttributes.begin();
|
||||
std::size_t i = 0;
|
||||
std::map<std::size_t,Attribute>::const_iterator iter = m_mAttributes.begin();
|
||||
while( i < m_aVertices.size() )
|
||||
{
|
||||
// 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() );
|
||||
for( ; i < iEnd; i += 4 )
|
||||
{
|
||||
@@ -746,7 +747,7 @@ void BitmapText::DrawPrimitives()
|
||||
iEnd = i + attr.length*4;
|
||||
iEnd = std::min( iEnd, m_aVertices.size() );
|
||||
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];
|
||||
if(m_mult_attrs_with_diffuse)
|
||||
@@ -806,12 +807,12 @@ void BitmapText::DrawPrimitives()
|
||||
{
|
||||
DISPLAY->SetTextureMode( TextureUnit_1, TextureMode_Glow );
|
||||
|
||||
size_t i = 0;
|
||||
std::map<size_t,Attribute>::const_iterator iter = m_mAttributes.begin();
|
||||
std::size_t i = 0;
|
||||
std::map<std::size_t,Attribute>::const_iterator iter = m_mAttributes.begin();
|
||||
while( i < m_aVertices.size() )
|
||||
{
|
||||
// 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() );
|
||||
for( ; i < iEnd; ++i )
|
||||
m_aVertices[i].c = m_pTempState->glow;
|
||||
@@ -874,15 +875,15 @@ BitmapText::Attribute BitmapText::GetDefaultAttribute() const
|
||||
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.
|
||||
int iLines = 0;
|
||||
size_t iAdjustedPos = iPos;
|
||||
std::size_t iAdjustedPos = iPos;
|
||||
|
||||
for (std::wstring const & line : m_wTextLines)
|
||||
{
|
||||
size_t length = line.length();
|
||||
std::size_t length = line.length();
|
||||
if( length >= iAdjustedPos )
|
||||
break;
|
||||
iAdjustedPos -= length;
|
||||
@@ -989,7 +990,7 @@ public:
|
||||
static int GetText( T* p, lua_State *L ) { lua_pushstring( L, p->GetText() ); return 1; }
|
||||
static int AddAttribute( T* p, lua_State *L )
|
||||
{
|
||||
size_t iPos = IArg(1);
|
||||
std::size_t iPos = IArg(1);
|
||||
BitmapText::Attribute attr = p->GetDefaultAttribute();
|
||||
|
||||
attr.FromStack( L, 2 );
|
||||
|
||||
+9
-7
@@ -2,6 +2,8 @@
|
||||
#define BITMAP_TEXT_H
|
||||
|
||||
#include "Actor.h"
|
||||
|
||||
#include <cstddef>
|
||||
#include <map>
|
||||
|
||||
class RageTexture;
|
||||
@@ -62,7 +64,7 @@ public:
|
||||
void SetMaxHeight( float fMaxHeight );
|
||||
void SetMaxDimUseZoom(bool use);
|
||||
void SetWrapWidthPixels( int iWrapWidthPixels );
|
||||
void CropLineToWidth(size_t l, int width);
|
||||
void CropLineToWidth(std::size_t l, int width);
|
||||
void CropToWidth(int width);
|
||||
|
||||
virtual bool EarlyAbortDraw() const override;
|
||||
@@ -103,7 +105,7 @@ public:
|
||||
};
|
||||
|
||||
Attribute GetDefaultAttribute() const;
|
||||
void AddAttribute( size_t iPos, const Attribute &attr );
|
||||
void AddAttribute( std::size_t iPos, const Attribute &attr );
|
||||
void ClearAttributes();
|
||||
|
||||
// Commands
|
||||
@@ -128,9 +130,9 @@ protected:
|
||||
|
||||
std::vector<RageSpriteVertex> m_aVertices;
|
||||
|
||||
std::vector<FontPageTextures*> m_vpFontPageTextures;
|
||||
std::map<size_t, Attribute> m_mAttributes;
|
||||
bool m_bHasGlowAttribute;
|
||||
std::vector<FontPageTextures*> m_vpFontPageTextures;
|
||||
std::map<std::size_t, Attribute> m_mAttributes;
|
||||
bool m_bHasGlowAttribute;
|
||||
|
||||
TextGlowMode m_TextGlowMode;
|
||||
|
||||
@@ -153,7 +155,7 @@ private:
|
||||
* @author Chris Danford, Charles Lohr, Steve Checkoway (c) 2001-2007
|
||||
* @section LICENSE
|
||||
* All rights reserved.
|
||||
*
|
||||
*
|
||||
* Permission is hereby granted, free of charge, to any person obtaining a
|
||||
* copy of this software and associated documentation files (the
|
||||
* "Software"), to deal in the Software without restriction, including
|
||||
@@ -163,7 +165,7 @@ private:
|
||||
* copyright notice(s) and this permission notice appear in all copies of
|
||||
* the Software and that both the above copyright notice(s) and this
|
||||
* permission notice appear in supporting documentation.
|
||||
*
|
||||
*
|
||||
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
|
||||
* OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
||||
* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT OF
|
||||
|
||||
@@ -6,9 +6,11 @@
|
||||
#include "ThemeMetric.h"
|
||||
#include "ActorUtil.h"
|
||||
|
||||
#include <cstddef>
|
||||
|
||||
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 );
|
||||
switch( i )
|
||||
@@ -32,7 +34,7 @@ static void TugMeterPercentChangeInit( size_t /*ScoreEvent*/ i, RString &sNameOu
|
||||
|
||||
static Preference1D<float> g_fTugMeterPercentChange( TugMeterPercentChangeInit, NUM_ScoreEvent );
|
||||
|
||||
CombinedLifeMeterTug::CombinedLifeMeterTug()
|
||||
CombinedLifeMeterTug::CombinedLifeMeterTug()
|
||||
{
|
||||
FOREACH_PlayerNumber( p )
|
||||
{
|
||||
@@ -92,7 +94,7 @@ void CombinedLifeMeterTug::ChangeLife( PlayerNumber pn, TapNoteScore score )
|
||||
|
||||
void CombinedLifeMeterTug::HandleTapScoreNone( PlayerNumber pn )
|
||||
{
|
||||
|
||||
|
||||
}
|
||||
|
||||
void CombinedLifeMeterTug::ChangeLife( PlayerNumber pn, HoldNoteScore score, TapNoteScore tscore )
|
||||
@@ -155,7 +157,7 @@ void CombinedLifeMeterTug::SetLife(PlayerNumber pn, float value)
|
||||
/*
|
||||
* (c) 2003-2004 Chris Danford
|
||||
* All rights reserved.
|
||||
*
|
||||
*
|
||||
* Permission is hereby granted, free of charge, to any person obtaining a
|
||||
* copy of this software and associated documentation files (the
|
||||
* "Software"), to deal in the Software without restriction, including
|
||||
@@ -165,7 +167,7 @@ void CombinedLifeMeterTug::SetLife(PlayerNumber pn, float value)
|
||||
* copyright notice(s) and this permission notice appear in all copies of
|
||||
* the Software and that both the above copyright notice(s) and this
|
||||
* permission notice appear in supporting documentation.
|
||||
*
|
||||
*
|
||||
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
|
||||
* OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
||||
* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT OF
|
||||
|
||||
+6
-5
@@ -4,9 +4,10 @@
|
||||
#include "RageLog.h"
|
||||
#include "arch/Dialog/Dialog.h"
|
||||
|
||||
#include <cstddef>
|
||||
#include <numeric>
|
||||
|
||||
RString Command::GetName() const
|
||||
RString Command::GetName() const
|
||||
{
|
||||
if( m_vsArgs.empty() )
|
||||
return RString();
|
||||
@@ -41,9 +42,9 @@ static void SplitWithQuotes( const RString sSource, const char Delimitor, std::v
|
||||
if( sSource.empty() )
|
||||
return;
|
||||
|
||||
size_t startpos = 0;
|
||||
std::size_t startpos = 0;
|
||||
do {
|
||||
size_t pos = startpos;
|
||||
std::size_t pos = startpos;
|
||||
while( pos < sSource.size() )
|
||||
{
|
||||
if( sSource[pos] == Delimitor )
|
||||
@@ -110,7 +111,7 @@ Commands ParseCommands( const RString &sCommands )
|
||||
/*
|
||||
* (c) 2004 Chris Danford
|
||||
* All rights reserved.
|
||||
*
|
||||
*
|
||||
* Permission is hereby granted, free of charge, to any person obtaining a
|
||||
* copy of this software and associated documentation files (the
|
||||
* "Software"), to deal in the Software without restriction, including
|
||||
@@ -120,7 +121,7 @@ Commands ParseCommands( const RString &sCommands )
|
||||
* copyright notice(s) and this permission notice appear in all copies of
|
||||
* the Software and that both the above copyright notice(s) and this
|
||||
* permission notice appear in supporting documentation.
|
||||
*
|
||||
*
|
||||
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
|
||||
* OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
||||
* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT OF
|
||||
|
||||
+22
-20
@@ -1,4 +1,3 @@
|
||||
#include <limits.h>
|
||||
#include "global.h"
|
||||
#include "Course.h"
|
||||
#include "CourseLoaderCRS.h"
|
||||
@@ -19,6 +18,9 @@
|
||||
#include "Game.h"
|
||||
#include "Style.h"
|
||||
|
||||
#include <cstddef>
|
||||
#include <limits.h>
|
||||
|
||||
static Preference<int> MAX_SONGS_IN_EDIT_COURSE( "MaxSongsInEditCourse", -1 );
|
||||
|
||||
static const char *SongSortNames[] = {
|
||||
@@ -49,7 +51,7 @@ RString CourseEntry::GetTextDescription() const
|
||||
std::vector<RString> vsEntryDescription;
|
||||
Song *pSong = songID.ToSong();
|
||||
if( pSong )
|
||||
vsEntryDescription.push_back( pSong->GetTranslitFullTitle() );
|
||||
vsEntryDescription.push_back( pSong->GetTranslitFullTitle() );
|
||||
else
|
||||
vsEntryDescription.push_back( "Random" );
|
||||
if( !songCriteria.m_sGroupName.empty() )
|
||||
@@ -89,7 +91,7 @@ int CourseEntry::GetNumModChanges() const
|
||||
Course::Course(): m_bIsAutogen(false), m_sPath(""), m_sMainTitle(""),
|
||||
m_sMainTitleTranslit(""), m_sSubTitle(""), m_sSubTitleTranslit(""),
|
||||
m_sScripter(""), m_sDescription(""), m_sBannerPath(""), m_sBackgroundPath(""),
|
||||
m_sCDTitlePath(""), m_sGroupName(""), m_bRepeat(false), m_fGoalSeconds(0),
|
||||
m_sCDTitlePath(""), m_sGroupName(""), m_bRepeat(false), m_fGoalSeconds(0),
|
||||
m_bShuffle(false), m_iLives(-1), m_bSortByMeter(false),
|
||||
m_bIncomplete(false), m_vEntries(), m_SortOrder_TotalDifficulty(0),
|
||||
m_SortOrder_Ranking(0), m_LoadedFromProfile(ProfileSlot_Invalid),
|
||||
@@ -104,7 +106,7 @@ CourseType Course::GetCourseType() const
|
||||
{
|
||||
if( m_bRepeat )
|
||||
return COURSE_TYPE_ENDLESS;
|
||||
if( m_iLives > 0 )
|
||||
if( m_iLives > 0 )
|
||||
return COURSE_TYPE_ONI;
|
||||
if( !m_vEntries.empty() && m_vEntries[0].fGainSeconds > 0 )
|
||||
return COURSE_TYPE_SURVIVAL;
|
||||
@@ -223,9 +225,9 @@ struct SortTrailEntry
|
||||
{
|
||||
TrailEntry entry;
|
||||
int SortMeter;
|
||||
|
||||
|
||||
SortTrailEntry(): entry(), SortMeter(0) {}
|
||||
|
||||
|
||||
bool operator< ( const SortTrailEntry &rhs ) const { return SortMeter < rhs.SortMeter; }
|
||||
};
|
||||
|
||||
@@ -445,7 +447,7 @@ bool Course::GetTrailUnsorted( StepsType st, CourseDifficulty cd, Trail &trail )
|
||||
// Set to true if CourseDifficulty is able to change something.
|
||||
bool bCourseDifficultyIsSignificant = (cd == Difficulty_Medium);
|
||||
|
||||
|
||||
|
||||
|
||||
// Resolve each entry to a Song and Steps.
|
||||
if( trail.m_CourseType == COURSE_TYPE_ENDLESS )
|
||||
@@ -743,7 +745,7 @@ void Course::GetTrailUnsortedEndless( const std::vector<CourseEntry> &entries, T
|
||||
ASSERT(e->iChooseIndex >= 0);
|
||||
// If we're trying to pick BEST100 when only 99 songs exist,
|
||||
// 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;
|
||||
}
|
||||
|
||||
@@ -959,7 +961,7 @@ void Course::Invalidate( const Song *pStaleSong )
|
||||
}
|
||||
|
||||
// Invalidate any Trails that contain this song.
|
||||
// If we find a Trail that contains this song, then it's part of a
|
||||
// If we find a Trail that contains this song, then it's part of a
|
||||
// non-fixed entry. So, regenerating the Trail will force different
|
||||
// songs to be chosen.
|
||||
FOREACH_ENUM( StepsType,st )
|
||||
@@ -980,8 +982,8 @@ void Course::Invalidate( const Song *pStaleSong )
|
||||
void Course::RegenerateNonFixedTrails() const
|
||||
{
|
||||
// Only need to regen Trails if the Course has a random entry.
|
||||
// We can create these Trails on demand because we don't
|
||||
// calculate RadarValues for Trails with one or more non-fixed
|
||||
// We can create these Trails on demand because we don't
|
||||
// calculate RadarValues for Trails with one or more non-fixed
|
||||
// entry.
|
||||
if( AllSongsAreFixed() )
|
||||
return;
|
||||
@@ -1003,7 +1005,7 @@ RageColor Course::GetColor() const
|
||||
case COURSE_SORT_PREFERRED:
|
||||
return SORT_PREFERRED_COLOR; //This will also be used for autogen'd courses in some cases.
|
||||
|
||||
case COURSE_SORT_SONGS:
|
||||
case COURSE_SORT_SONGS:
|
||||
if( m_vEntries.size() >= 7 ) return SORT_LEVEL2_COLOR;
|
||||
else if( m_vEntries.size() >= 4 ) return SORT_LEVEL4_COLOR;
|
||||
else return SORT_LEVEL5_COLOR;
|
||||
@@ -1220,7 +1222,7 @@ bool Course::Matches( RString sGroup, RString sCourse ) const
|
||||
// lua start
|
||||
#include "LuaBinding.h"
|
||||
|
||||
/** @brief Allow Lua to have access to the CourseEntry. */
|
||||
/** @brief Allow Lua to have access to the CourseEntry. */
|
||||
class LunaCourseEntry: public Luna<CourseEntry>
|
||||
{
|
||||
public:
|
||||
@@ -1240,7 +1242,7 @@ public:
|
||||
// GetTimedModifiers - table
|
||||
DEFINE_METHOD( GetNumModChanges, GetNumModChanges() );
|
||||
DEFINE_METHOD( GetTextDescription, GetTextDescription() );
|
||||
|
||||
|
||||
LunaCourseEntry()
|
||||
{
|
||||
ADD_METHOD( GetSong );
|
||||
@@ -1259,7 +1261,7 @@ public:
|
||||
LUA_REGISTER_CLASS( CourseEntry )
|
||||
|
||||
// Now for the Course bindings:
|
||||
/** @brief Allow Lua to have access to the Course. */
|
||||
/** @brief Allow Lua to have access to the Course. */
|
||||
class LunaCourse: public Luna<Course>
|
||||
{
|
||||
public:
|
||||
@@ -1271,7 +1273,7 @@ public:
|
||||
DEFINE_METHOD( GetCourseType, GetCourseType() )
|
||||
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())
|
||||
{
|
||||
lua_pushnil(L);
|
||||
@@ -1356,8 +1358,8 @@ public:
|
||||
ADD_METHOD( GetGroupName );
|
||||
ADD_METHOD( IsAutogen );
|
||||
ADD_METHOD( GetEstimatedNumStages );
|
||||
ADD_METHOD( GetScripter );
|
||||
ADD_METHOD( GetDescription );
|
||||
ADD_METHOD( GetScripter );
|
||||
ADD_METHOD( GetDescription );
|
||||
ADD_METHOD( GetTotalSeconds );
|
||||
ADD_METHOD( IsEndless );
|
||||
ADD_METHOD( IsNonstop );
|
||||
@@ -1379,7 +1381,7 @@ LUA_REGISTER_CLASS( Course )
|
||||
/*
|
||||
* (c) 2001-2004 Chris Danford, Glenn Maynard
|
||||
* All rights reserved.
|
||||
*
|
||||
*
|
||||
* Permission is hereby granted, free of charge, to any person obtaining a
|
||||
* copy of this software and associated documentation files (the
|
||||
* "Software"), to deal in the Software without restriction, including
|
||||
@@ -1389,7 +1391,7 @@ LUA_REGISTER_CLASS( Course )
|
||||
* copyright notice(s) and this permission notice appear in all copies of
|
||||
* the Software and that both the above copyright notice(s) and this
|
||||
* permission notice appear in supporting documentation.
|
||||
*
|
||||
*
|
||||
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
|
||||
* OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
||||
* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT OF
|
||||
|
||||
+11
-10
@@ -1,6 +1,7 @@
|
||||
#include "global.h"
|
||||
|
||||
#include <stdio.h>
|
||||
#include <cstddef>
|
||||
#include <cstdio>
|
||||
|
||||
#if defined(_WINDOWS)
|
||||
#include <tchar.h>
|
||||
@@ -144,7 +145,7 @@ typedef char TCHAR;
|
||||
typedef unsigned char uch; // unsigned 8-bit value
|
||||
typedef unsigned short ush; // unsigned 16-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 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 {
|
||||
ush vem, ver, flg, how; // See central header in zipfile.c for what vem..off are
|
||||
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
|
||||
ulg atx, off;
|
||||
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);
|
||||
PUTSH(z->nam, 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)
|
||||
return ZE_TEMP;
|
||||
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)
|
||||
return ZE_TEMP;
|
||||
}
|
||||
@@ -441,15 +442,15 @@ int putcentral(struct zlist *z, WRITEFUNC wfunc, void *param)
|
||||
PUTSH(z->att, f);
|
||||
PUTLG(z->atx, f);
|
||||
PUTLG(z->off, f);
|
||||
if ((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->com && (size_t)wfunc(param, z->comment, (unsigned int)z->com) != z->com))
|
||||
if ((std::size_t)wfunc(param, z->iname, (unsigned int)z->nam) != z->nam ||
|
||||
(z->cext && (std::size_t)wfunc(param, z->cextra, (unsigned int)z->cext) != z->cext) ||
|
||||
(z->com && (std::size_t)wfunc(param, z->comment, (unsigned int)z->com) != z->com))
|
||||
return ZE_TEMP;
|
||||
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.
|
||||
PUTLG(ENDSIG, f);
|
||||
@@ -530,7 +531,7 @@ const ulg crc_table[256] = {
|
||||
#define DO4(buf) DO2(buf); DO2(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;
|
||||
crc = crc ^ 0xffffffffL;
|
||||
|
||||
+2
-2
@@ -137,7 +137,7 @@ bool CsvFile::WriteFile( RageFileBasic &f ) const
|
||||
/*
|
||||
* (c) 2001-2004 Adam Clauss, Chris Danford
|
||||
* All rights reserved.
|
||||
*
|
||||
*
|
||||
* Permission is hereby granted, free of charge, to any person obtaining a
|
||||
* copy of this software and associated documentation files (the
|
||||
* "Software"), to deal in the Software without restriction, including
|
||||
@@ -147,7 +147,7 @@ bool CsvFile::WriteFile( RageFileBasic &f ) const
|
||||
* copyright notice(s) and this permission notice appear in all copies of
|
||||
* the Software and that both the above copyright notice(s) and this
|
||||
* permission notice appear in supporting documentation.
|
||||
*
|
||||
*
|
||||
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
|
||||
* OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
||||
* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT OF
|
||||
|
||||
+90
-88
@@ -2,6 +2,8 @@
|
||||
#include "CubicSpline.h"
|
||||
#include "RageLog.h"
|
||||
#include "RageUtil.h"
|
||||
|
||||
#include <cstddef>
|
||||
#include <list>
|
||||
|
||||
// Spline solving optimization:
|
||||
@@ -27,29 +29,29 @@ struct SplineSolutionCache
|
||||
void solve_diagonals_straight(std::vector<float>& diagonals, std::vector<float>& multiples);
|
||||
void solve_diagonals_looped(std::vector<float>& diagonals, std::vector<float>& multiples);
|
||||
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);
|
||||
void add_to_cache(std::list<Entry>& cache, std::vector<float>& outd, std::vector<float>& outm);
|
||||
std::list<Entry> straight_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)
|
||||
{
|
||||
size_t out_size= outd.size();
|
||||
std::size_t out_size= outd.size();
|
||||
for(std::list<Entry>::iterator entry= cache.begin();
|
||||
entry != cache.end(); ++entry)
|
||||
{
|
||||
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];
|
||||
}
|
||||
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];
|
||||
}
|
||||
@@ -70,9 +72,9 @@ void SplineSolutionCache::add_to_cache(std::list<Entry>& cache, std::vector<floa
|
||||
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;
|
||||
}
|
||||
@@ -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 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;
|
||||
prep_inner(last-1, diagonals);
|
||||
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].
|
||||
diagonals[1]-= .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].
|
||||
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);
|
||||
}
|
||||
// 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].
|
||||
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 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;
|
||||
prep_inner(last, diagonals);
|
||||
// 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;
|
||||
|
||||
// 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].
|
||||
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);
|
||||
}
|
||||
// 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].
|
||||
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);
|
||||
}
|
||||
// Stage three.
|
||||
const size_t end= last-1;
|
||||
for(size_t i= 0; i < end; ++i)
|
||||
const std::size_t end= last-1;
|
||||
for(std::size_t i= 0; i < end; ++i)
|
||||
{
|
||||
// Operation: Add row[e] * (right_column[i] / [re][ce]) to row[i] to
|
||||
// zero right_column[i].
|
||||
@@ -251,7 +253,7 @@ float loop_space_difference(float a, float b, float spatial_extent)
|
||||
void CubicSpline::solve_looped()
|
||||
{
|
||||
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> diagonals(m_points.size());
|
||||
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
|
||||
// handle right_column. This does not handle right_column, so the loop
|
||||
// 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].
|
||||
results[i+1]-= results[i] * multiples[i];
|
||||
}
|
||||
size_t next_mult= last-1;
|
||||
std::size_t next_mult= last-1;
|
||||
// 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].
|
||||
results[i-1]-= results[i] * multiples[next_mult];
|
||||
@@ -286,8 +288,8 @@ void CubicSpline::solve_looped()
|
||||
results[last-1]-= results[0] * multiples[next_mult];
|
||||
++next_mult;
|
||||
// Stage three.
|
||||
const size_t end= last-1;
|
||||
for(size_t i= 0; i < end; ++i)
|
||||
const std::size_t end= last-1;
|
||||
for(std::size_t i= 0; i < end; ++i)
|
||||
{
|
||||
// Operation: Add row[e] * -multiples[nm] to row[i].
|
||||
results[i]-= results[end] * multiples[next_mult];
|
||||
@@ -300,7 +302,7 @@ void CubicSpline::solve_looped()
|
||||
void CubicSpline::solve_straight()
|
||||
{
|
||||
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> diagonals(m_points.size());
|
||||
std::vector<float> multiples;
|
||||
@@ -313,14 +315,14 @@ void CubicSpline::solve_straight()
|
||||
// Steps explained in detail in SplineSolutionCache.
|
||||
// Only the operations on the results column are performed here.
|
||||
// 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].
|
||||
results[i+1]-= results[i] * multiples[i];
|
||||
}
|
||||
size_t next_mult= last-1;
|
||||
std::size_t next_mult= last-1;
|
||||
// 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].
|
||||
results[i-1]-= results[i] * multiples[next_mult];
|
||||
@@ -333,8 +335,8 @@ void CubicSpline::solve_straight()
|
||||
void CubicSpline::solve_polygonal()
|
||||
{
|
||||
if(check_minimum_size()) { return; }
|
||||
size_t last= m_points.size() - 1;
|
||||
for(size_t i= 0; i < last; ++i)
|
||||
std::size_t last= m_points.size() - 1;
|
||||
for(std::size_t i= 0; i < last; ++i)
|
||||
{
|
||||
m_points[i].b= loop_space_difference(
|
||||
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()
|
||||
{
|
||||
size_t last= m_points.size();
|
||||
std::size_t last= m_points.size();
|
||||
if(last < 2)
|
||||
{
|
||||
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;
|
||||
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;
|
||||
if(m_points[i].a != a) { all_points_identical= false; }
|
||||
@@ -372,27 +374,27 @@ bool CubicSpline::check_minimum_size()
|
||||
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(
|
||||
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.
|
||||
for(size_t i= 0; i < last; ++i)
|
||||
for(std::size_t i= 0; i < last; ++i)
|
||||
{
|
||||
results[i]/= diagonals[i];
|
||||
}
|
||||
// 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.
|
||||
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(
|
||||
m_points[next].a, m_points[i].a, m_spatial_extent);
|
||||
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.
|
||||
}
|
||||
|
||||
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)
|
||||
{
|
||||
float max_t= static_cast<float>(m_points.size());
|
||||
t= std::fmod(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);
|
||||
}
|
||||
else
|
||||
@@ -425,14 +427,14 @@ void CubicSpline::p_and_tfrac_from_t(float t, bool loop, size_t& p, float& tfrac
|
||||
p= 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;
|
||||
tfrac= 0;
|
||||
}
|
||||
else
|
||||
{
|
||||
p= static_cast<size_t>(flort);
|
||||
p= static_cast<std::size_t>(flort);
|
||||
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 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);
|
||||
|
||||
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 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.");
|
||||
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.");
|
||||
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;
|
||||
}
|
||||
|
||||
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.");
|
||||
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;
|
||||
}
|
||||
|
||||
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)
|
||||
{
|
||||
set_coefficients(i, b, c, d);
|
||||
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
|
||||
{
|
||||
get_coefficients(i, b, c, d);
|
||||
a= m_points[i].a;
|
||||
}
|
||||
|
||||
void CubicSpline::resize(size_t s)
|
||||
void CubicSpline::resize(std::size_t s)
|
||||
{
|
||||
m_points.resize(s);
|
||||
}
|
||||
|
||||
size_t CubicSpline::size() const
|
||||
std::size_t CubicSpline::size() const
|
||||
{
|
||||
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.
|
||||
// Points that exist in both will be averaged.
|
||||
// Points that only exist in one will come only from that one.
|
||||
const size_t from_size= from.size();
|
||||
const size_t to_size= to.size();
|
||||
size_t out_size= to_size;
|
||||
size_t limit= to_size;
|
||||
const std::size_t from_size= from.size();
|
||||
const std::size_t to_size= to.size();
|
||||
std::size_t out_size= to_size;
|
||||
std::size_t limit= 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);
|
||||
}
|
||||
else if(to_size < 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);
|
||||
}
|
||||
CLAMP(out_size, 0, limit);
|
||||
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 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
|
||||
|
||||
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.");
|
||||
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_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)
|
||||
{
|
||||
ASSERT_M(b.size() == c.size() && c.size() == d.size() &&
|
||||
d.size() == m_splines.size(), "CubicSplineN: coefficient vectors must 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_coefficients(i, b[n], c[n], d[n]);
|
||||
}
|
||||
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)
|
||||
{
|
||||
ASSERT_M(b.size() == c.size() && c.size() == d.size() &&
|
||||
d.size() == m_splines.size(), "CubicSplineN: coefficient vectors must 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].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"
|
||||
" of is out of range.");
|
||||
@@ -722,14 +724,14 @@ void CubicSplineN::set_spatial_extent(size_t i, float extent)
|
||||
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"
|
||||
" of is out of range.");
|
||||
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();
|
||||
spline != m_splines.end(); ++spline)
|
||||
@@ -739,7 +741,7 @@ void CubicSplineN::resize(size_t s)
|
||||
m_dirty= true;
|
||||
}
|
||||
|
||||
size_t CubicSplineN::size() const
|
||||
std::size_t CubicSplineN::size() const
|
||||
{
|
||||
if(!m_splines.empty())
|
||||
{
|
||||
@@ -753,13 +755,13 @@ bool CubicSplineN::empty() const
|
||||
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_dirty= true;
|
||||
}
|
||||
|
||||
size_t CubicSplineN::dimension() const
|
||||
std::size_t CubicSplineN::dimension() const
|
||||
{
|
||||
return m_splines.size();
|
||||
}
|
||||
@@ -787,18 +789,18 @@ SET_GET_MEM(m_dirty, dirty);
|
||||
|
||||
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())
|
||||
{
|
||||
luaL_error(L, "Spline dimension index out of range.");
|
||||
}
|
||||
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())
|
||||
{
|
||||
luaL_error(L, "Spline point index out of range.");
|
||||
@@ -816,7 +818,7 @@ struct LunaCubicSplineN : Luna<CubicSplineN>
|
||||
std::vector<float> pos; \
|
||||
p->something(FArg(1), pos); \
|
||||
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_rawseti(L, -2, i+1); \
|
||||
@@ -830,13 +832,13 @@ struct LunaCubicSplineN : Luna<CubicSplineN>
|
||||
#undef LCSN_EVAL_SOMETHING
|
||||
|
||||
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
|
||||
// to reuse the same position data set after changing the dimension size.
|
||||
// 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);
|
||||
ret.push_back(FArg(-1));
|
||||
@@ -847,7 +849,7 @@ struct LunaCubicSplineN : Luna<CubicSplineN>
|
||||
}
|
||||
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))
|
||||
{
|
||||
@@ -859,17 +861,17 @@ struct LunaCubicSplineN : Luna<CubicSplineN>
|
||||
}
|
||||
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);
|
||||
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))
|
||||
{
|
||||
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> 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);
|
||||
@@ -877,24 +879,24 @@ struct LunaCubicSplineN : Luna<CubicSplineN>
|
||||
}
|
||||
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);
|
||||
COMMON_RETURN_SELF;
|
||||
}
|
||||
static int get_coefficients(T* p, lua_State* L)
|
||||
{
|
||||
size_t i= point_index(p, L, 1);
|
||||
size_t limit= p->dimension();
|
||||
std::size_t i= point_index(p, L, 1);
|
||||
std::size_t limit= p->dimension();
|
||||
std::vector<std::vector<float> > coeff(3);
|
||||
coeff[0].resize(limit);
|
||||
coeff[1].resize(limit);
|
||||
coeff[2].resize(limit);
|
||||
p->get_coefficients(i, coeff[0], coeff[1], coeff[2]);
|
||||
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);
|
||||
for(size_t v= 0; v < limit; ++v)
|
||||
for(std::size_t v= 0; v < limit; ++v)
|
||||
{
|
||||
lua_pushnumber(L, coeff[co][v]);
|
||||
lua_rawseti(L, -2, v+1);
|
||||
@@ -905,13 +907,13 @@ struct LunaCubicSplineN : Luna<CubicSplineN>
|
||||
}
|
||||
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));
|
||||
COMMON_RETURN_SELF;
|
||||
}
|
||||
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));
|
||||
return 1;
|
||||
}
|
||||
@@ -927,7 +929,7 @@ struct LunaCubicSplineN : Luna<CubicSplineN>
|
||||
{
|
||||
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;
|
||||
}
|
||||
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.");
|
||||
}
|
||||
p->redimension(static_cast<size_t>(dim));
|
||||
p->redimension(static_cast<std::size_t>(dim));
|
||||
COMMON_RETURN_SELF;
|
||||
}
|
||||
static int get_dimension(T* p, lua_State* L)
|
||||
|
||||
+23
-20
@@ -1,8 +1,11 @@
|
||||
#ifndef CUBIC_SPLINE_H
|
||||
#define CUBIC_SPLINE_H
|
||||
|
||||
#include <vector>
|
||||
#include "RageTypes.h"
|
||||
|
||||
#include <cstddef>
|
||||
#include <vector>
|
||||
|
||||
struct lua_State;
|
||||
|
||||
struct CubicSpline
|
||||
@@ -11,24 +14,24 @@ CubicSpline() :m_spatial_extent(0.0f) {}
|
||||
void solve_looped();
|
||||
void solve_straight();
|
||||
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_derivative(float t, bool loop) const;
|
||||
float evaluate_second_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_coefficients(size_t i, float b, float c, float d);
|
||||
void get_coefficients(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 get_point_and_coefficients(size_t i, float& a, float& b, float& c, float& d) const;
|
||||
void resize(size_t s);
|
||||
size_t size() const;
|
||||
void set_point(std::size_t i, float v);
|
||||
void set_coefficients(std::size_t i, float b, float c, float d);
|
||||
void get_coefficients(std::size_t i, float& b, float& c, float& d) const;
|
||||
void set_point_and_coefficients(std::size_t i, float a, float b, float c, float d);
|
||||
void get_point_and_coefficients(std::size_t i, float& a, float& b, float& c, float& d) const;
|
||||
void resize(std::size_t s);
|
||||
std::size_t size() const;
|
||||
bool empty() const;
|
||||
float m_spatial_extent;
|
||||
private:
|
||||
bool check_minimum_size();
|
||||
void prep_inner(size_t last, std::vector<float>& results);
|
||||
void set_results(size_t last, std::vector<float>& diagonals, std::vector<float>& results);
|
||||
void prep_inner(std::size_t last, std::vector<float>& results);
|
||||
void set_results(std::size_t last, std::vector<float>& diagonals, std::vector<float>& results);
|
||||
|
||||
struct SplinePoint
|
||||
{
|
||||
@@ -51,17 +54,17 @@ struct CubicSplineN
|
||||
void evaluate_third_derivative(float t, std::vector<float>& v) const;
|
||||
void evaluate(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_coefficients(size_t i, const std::vector<float>& b,
|
||||
void set_point(std::size_t i, const std::vector<float>& v);
|
||||
void set_coefficients(std::size_t i, const std::vector<float>& b,
|
||||
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);
|
||||
void set_spatial_extent(size_t i, float extent);
|
||||
float get_spatial_extent(size_t i);
|
||||
void resize(size_t s);
|
||||
size_t size() const;
|
||||
void redimension(size_t d);
|
||||
size_t dimension() const;
|
||||
void set_spatial_extent(std::size_t i, float extent);
|
||||
float get_spatial_extent(std::size_t i);
|
||||
void resize(std::size_t s);
|
||||
std::size_t size() const;
|
||||
void redimension(std::size_t d);
|
||||
std::size_t dimension() const;
|
||||
bool empty() const;
|
||||
float get_max_t() const {
|
||||
if(m_loop) { return static_cast<float>(size()); }
|
||||
|
||||
+12
-11
@@ -7,10 +7,11 @@
|
||||
#include "StepsDisplay.h"
|
||||
#include "StepsUtil.h"
|
||||
#include "CommonMetrics.h"
|
||||
|
||||
#include "SongUtil.h"
|
||||
#include "XmlFile.h"
|
||||
|
||||
#include <cstddef>
|
||||
|
||||
/** @brief Specifies the max number of charts available for a song.
|
||||
*
|
||||
* This includes autogenned charts. */
|
||||
@@ -213,13 +214,13 @@ void StepsDisplayList::UpdatePositions()
|
||||
|
||||
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() );
|
||||
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];
|
||||
bool bHidden = row.m_bHidden;
|
||||
@@ -237,7 +238,7 @@ void StepsDisplayList::PositionItems()
|
||||
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;
|
||||
if( m_bShown && m < m_Rows.size() )
|
||||
@@ -270,7 +271,7 @@ void StepsDisplayList::SetFromGameState()
|
||||
if( pSong == nullptr )
|
||||
{
|
||||
// FIXME: This clamps to between the min and the max difficulty, but
|
||||
// it really should round to the nearest difficulty that's in
|
||||
// it really should round to the nearest difficulty that's in
|
||||
// DIFFICULTIES_TO_SHOW.
|
||||
const std::vector<Difficulty>& difficulties = CommonMetrics::DIFFICULTIES_TO_SHOW.GetValue();
|
||||
m_Rows.resize( difficulties.size() );
|
||||
@@ -303,7 +304,7 @@ void StepsDisplayList::SetFromGameState()
|
||||
UpdatePositions();
|
||||
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();
|
||||
}
|
||||
|
||||
@@ -323,7 +324,7 @@ void StepsDisplayList::TweenOnScreen()
|
||||
FOREACH_HumanPlayer( 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 );
|
||||
|
||||
this->SetHibernate( 0.5f );
|
||||
@@ -374,7 +375,7 @@ void StepsDisplayList::HandleMessage( const Message &msg )
|
||||
FOREACH_ENUM( PlayerNumber, pn )
|
||||
{
|
||||
if( msg.GetName() == MessageIDToString((MessageID)(Message_CurrentStepsP1Changed+Enum::to_integral(pn))) ||
|
||||
msg.GetName() == MessageIDToString((MessageID)(Message_CurrentTrailP1Changed+Enum::to_integral(pn))) )
|
||||
msg.GetName() == MessageIDToString((MessageID)(Message_CurrentTrailP1Changed+Enum::to_integral(pn))) )
|
||||
SetFromGameState();
|
||||
}
|
||||
|
||||
@@ -385,7 +386,7 @@ void StepsDisplayList::HandleMessage( const Message &msg )
|
||||
// lua start
|
||||
#include "LuaBinding.h"
|
||||
|
||||
/** @brief Allow Lua to have access to the StepsDisplayList. */
|
||||
/** @brief Allow Lua to have access to the StepsDisplayList. */
|
||||
class LunaStepsDisplayList: public Luna<StepsDisplayList>
|
||||
{
|
||||
public:
|
||||
@@ -403,7 +404,7 @@ LUA_REGISTER_DERIVED_CLASS( StepsDisplayList, ActorFrame )
|
||||
/*
|
||||
* (c) 2003-2004 Glenn Maynard
|
||||
* All rights reserved.
|
||||
*
|
||||
*
|
||||
* Permission is hereby granted, free of charge, to any person obtaining a
|
||||
* copy of this software and associated documentation files (the
|
||||
* "Software"), to deal in the Software without restriction, including
|
||||
@@ -413,7 +414,7 @@ LUA_REGISTER_DERIVED_CLASS( StepsDisplayList, ActorFrame )
|
||||
* copyright notice(s) and this permission notice appear in all copies of
|
||||
* the Software and that both the above copyright notice(s) and this
|
||||
* permission notice appear in supporting documentation.
|
||||
*
|
||||
*
|
||||
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
|
||||
* OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
||||
* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT OF
|
||||
|
||||
@@ -8,6 +8,7 @@
|
||||
#include "LuaBinding.h"
|
||||
|
||||
#include <cmath>
|
||||
#include <cstddef>
|
||||
|
||||
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());
|
||||
// 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];
|
||||
}
|
||||
|
||||
+4
-3
@@ -8,12 +8,13 @@
|
||||
#include "Steps.h"
|
||||
#include "Song.h"
|
||||
#include "StepsUtil.h"
|
||||
|
||||
#include "CommonMetrics.h"
|
||||
#include "ImageCache.h"
|
||||
#include "UnlockManager.h"
|
||||
#include "SongUtil.h"
|
||||
|
||||
#include <cstddef>
|
||||
|
||||
static const char *EditMenuRowNames[] = {
|
||||
"Group",
|
||||
"Song",
|
||||
@@ -37,8 +38,8 @@ XToString( EditMenuAction );
|
||||
XToLocalizedString( EditMenuAction );
|
||||
StringToX( EditMenuAction );
|
||||
|
||||
static RString ARROWS_X_NAME( 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 ARROWS_X_NAME( std::size_t i ) { return ssprintf("Arrows%dX",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 )
|
||||
{
|
||||
|
||||
+5
-4
@@ -12,6 +12,7 @@
|
||||
#include "arch/Dialog/Dialog.h"
|
||||
|
||||
#include <cmath>
|
||||
#include <cstddef>
|
||||
|
||||
FontPage::FontPage(): m_iHeight(0), m_iLineSpacing(0), m_fVshift(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.
|
||||
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)
|
||||
{
|
||||
@@ -264,7 +265,7 @@ size_t Font::GetGlyphsThatFit(const std::wstring& line, int* width) const
|
||||
return line.size();
|
||||
}
|
||||
int curr_width= 0;
|
||||
size_t i= 0;
|
||||
std::size_t i= 0;
|
||||
for(i= 0; i < line.size() && curr_width < *width; ++i)
|
||||
{
|
||||
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 )
|
||||
{
|
||||
size_t begin = sFilename.find_first_of( '[' );
|
||||
std::size_t begin = sFilename.find_first_of( '[' );
|
||||
if( begin == std::string::npos )
|
||||
return "main";
|
||||
|
||||
size_t end = sFilename.find_first_of( ']', begin );
|
||||
std::size_t end = sFilename.find_first_of( ']', begin );
|
||||
if( end == std::string::npos )
|
||||
return "main";
|
||||
|
||||
|
||||
+13
-11
@@ -6,6 +6,8 @@
|
||||
#include "RageTextureID.h"
|
||||
#include "RageUtil.h"
|
||||
#include "RageTypes.h"
|
||||
|
||||
#include <cstddef>
|
||||
#include <map>
|
||||
|
||||
class FontPage;
|
||||
@@ -57,7 +59,7 @@ struct glyph
|
||||
|
||||
/** @brief Texture coordinate rect. */
|
||||
RectF m_TexRect;
|
||||
|
||||
|
||||
/** @brief Set up the glyph with default values. */
|
||||
glyph() : m_pPage(nullptr), m_FontPageTextures(), m_iHadvance(0),
|
||||
m_fWidth(0), m_fHeight(0), m_fHshift(0), m_TexRect() {}
|
||||
@@ -86,7 +88,7 @@ struct FontPageSettings
|
||||
/** @brief The initial settings for the FontPage. */
|
||||
FontPageSettings(): m_sTexturePath(""),
|
||||
m_iDrawExtraPixelsLeft(0), m_iDrawExtraPixelsRight(0),
|
||||
m_iAddToAllWidths(0),
|
||||
m_iAddToAllWidths(0),
|
||||
m_iLineSpacing(-1),
|
||||
m_iTop(-1),
|
||||
m_iBaseline(-1),
|
||||
@@ -154,7 +156,7 @@ public:
|
||||
|
||||
int GetLineWidthInSourcePixels( 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;
|
||||
|
||||
@@ -192,8 +194,8 @@ private:
|
||||
|
||||
/**
|
||||
* @brief This is the primary fontpage of this font.
|
||||
*
|
||||
* The font-wide height, center, etc. is pulled from it.
|
||||
*
|
||||
* The font-wide height, center, etc. is pulled from it.
|
||||
* (This is one of pages[].) */
|
||||
FontPage *m_pDefault;
|
||||
|
||||
@@ -205,10 +207,10 @@ private:
|
||||
/**
|
||||
* @brief True for Hebrew, Arabic, Urdu fonts.
|
||||
*
|
||||
* This will also change the way glyphs from the default FontPage are rendered.
|
||||
* This will also change the way glyphs from the default FontPage are rendered.
|
||||
* There may be a better way to handle this. */
|
||||
bool m_bRightToLeft;
|
||||
|
||||
|
||||
bool m_bDistanceField;
|
||||
|
||||
RageColor m_DefaultStrokeColor;
|
||||
@@ -219,14 +221,14 @@ private:
|
||||
void LoadFontPageSettings( FontPageSettings &cfg, IniFile &ini, const RString &sTexturePath, const RString &PageName, RString sChars );
|
||||
static void GetFontPaths( const RString &sFontOrTextureFilePath, std::vector<RString> &sTexturePaths );
|
||||
RString GetPageNameFromFileName( const RString &sFilename );
|
||||
|
||||
|
||||
Font(const Font& rhs);
|
||||
Font& operator=(const Font& rhs);
|
||||
};
|
||||
|
||||
/**
|
||||
* @brief Last private-use Unicode character:
|
||||
*
|
||||
*
|
||||
* This is in the header to reduce file dependencies. */
|
||||
const wchar_t FONT_DEFAULT_GLYPH = 0xF8FF;
|
||||
|
||||
@@ -236,7 +238,7 @@ const wchar_t FONT_DEFAULT_GLYPH = 0xF8FF;
|
||||
* @file
|
||||
* @author Glenn Maynard, Chris Danford (c) 2001-2004
|
||||
* All rights reserved.
|
||||
*
|
||||
*
|
||||
* Permission is hereby granted, free of charge, to any person obtaining a
|
||||
* copy of this software and associated documentation files (the
|
||||
* "Software"), to deal in the Software without restriction, including
|
||||
@@ -246,7 +248,7 @@ const wchar_t FONT_DEFAULT_GLYPH = 0xF8FF;
|
||||
* copyright notice(s) and this permission notice appear in all copies of
|
||||
* the Software and that both the above copyright notice(s) and this
|
||||
* permission notice appear in supporting documentation.
|
||||
*
|
||||
*
|
||||
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
|
||||
* OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
||||
* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT OF
|
||||
|
||||
+21
-19
@@ -23,6 +23,8 @@
|
||||
#include "arch/ArchHooks/ArchHooks.h"
|
||||
#include "ScreenPrompt.h"
|
||||
|
||||
#include <cstddef>
|
||||
|
||||
static LocalizedString COULD_NOT_LAUNCH_BROWSER( "GameCommand", "Could not launch web browser." );
|
||||
|
||||
REGISTER_CLASS_TRAITS( GameCommand, new GameCommand(*pCopy) );
|
||||
@@ -86,8 +88,8 @@ bool GameCommand::DescribesCurrentMode( PlayerNumber pn ) const
|
||||
return false;
|
||||
if( m_pStyle && GAMESTATE->GetCurrentStyle(pn) != m_pStyle )
|
||||
return false;
|
||||
// HACK: don't compare m_dc if m_pSteps is set. This causes problems
|
||||
// in ScreenSelectOptionsMaster::ImportOptions if m_PreferredDifficulty
|
||||
// HACK: don't compare m_dc if m_pSteps is set. This causes problems
|
||||
// in ScreenSelectOptionsMaster::ImportOptions if m_PreferredDifficulty
|
||||
// doesn't match the difficulty of m_pCurSteps.
|
||||
if( m_pSteps == nullptr && m_dc != Difficulty_Invalid )
|
||||
{
|
||||
@@ -278,7 +280,7 @@ void GameCommand::LoadOne( const Command& cmd )
|
||||
{
|
||||
CHECK_INVALID_COND(m_pSong, SONGMAN->FindSong(sValue),
|
||||
(SONGMAN->FindSong(sValue) == nullptr),
|
||||
(ssprintf("Song \"%s\" not found", sValue.c_str())));
|
||||
(ssprintf("Song \"%s\" not found", sValue.c_str())));
|
||||
}
|
||||
|
||||
else if( sName == "steps" )
|
||||
@@ -318,7 +320,7 @@ void GameCommand::LoadOne( const Command& cmd )
|
||||
(SONGMAN->FindCourse("", sValue) == nullptr),
|
||||
(ssprintf( "Course \"%s\" not found", sValue.c_str())));
|
||||
}
|
||||
|
||||
|
||||
else if( sName == "trail" )
|
||||
{
|
||||
RString sTrail = sValue;
|
||||
@@ -348,7 +350,7 @@ void GameCommand::LoadOne( const Command& cmd )
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
else if( sName == "setenv" )
|
||||
{
|
||||
if((cmd.m_vsArgs.size() - 1) % 2 != 0)
|
||||
@@ -357,13 +359,13 @@ void GameCommand::LoadOne( const Command& cmd )
|
||||
}
|
||||
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];
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
else if( sName == "songgroup" )
|
||||
{
|
||||
CHECK_INVALID_COND(m_sSongGroup, sValue, (!SONGMAN->DoesSongGroupExist(sValue)), ("Song group \"" + sValue + "\" does not exist."));
|
||||
@@ -447,7 +449,7 @@ void GameCommand::LoadOne( const Command& cmd )
|
||||
}
|
||||
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)
|
||||
{
|
||||
@@ -568,7 +570,7 @@ bool GameCommand::IsPlayable( RString *why ) const
|
||||
|
||||
const int iNumCreditsPaid = GetNumCreditsPaid();
|
||||
const int iNumCreditsRequired = GetCreditsRequiredToPlayStyle(m_pStyle);
|
||||
|
||||
|
||||
/* With PREFSMAN->m_bDelayedCreditsReconcile disabled, enough credits must
|
||||
* be paid. (This means that enough sides must be joined.) Enabled, simply
|
||||
* having enough credits lying in the machine is sufficient; we'll deduct the
|
||||
@@ -724,7 +726,7 @@ void GameCommand::ApplySelf( const std::vector<PlayerNumber> &vpns ) const
|
||||
//Credit Used, make sure to update CoinsFile
|
||||
BOOKKEEPER->WriteCoinsFile(GAMESTATE->m_iCoins.Get());
|
||||
}
|
||||
|
||||
|
||||
// If only one side is joined and we picked a style that requires both
|
||||
// sides, join the other side.
|
||||
switch( m_pStyle->m_StyleType )
|
||||
@@ -871,7 +873,7 @@ void GameCommand::ApplySelf( const std::vector<PlayerNumber> &vpns ) const
|
||||
GAMESTATE->GetDefaultSongOptions( so );
|
||||
GAMESTATE->m_SongOptions.Assign( ModsLevel_Stage, so );
|
||||
}
|
||||
// HACK: Set life type to BATTERY just once here so it happens once and
|
||||
// HACK: Set life type to BATTERY just once here so it happens once and
|
||||
// we don't override the user's changes if they back out.
|
||||
FOREACH_PlayerNumber(pn)
|
||||
{
|
||||
@@ -892,11 +894,11 @@ bool GameCommand::IsZero() const
|
||||
m_sAnnouncer != "" ||
|
||||
m_sPreferredModifiers != "" ||
|
||||
m_sStageModifiers != "" ||
|
||||
m_pSong != nullptr ||
|
||||
m_pSteps != nullptr ||
|
||||
m_pCourse != nullptr ||
|
||||
m_pTrail != nullptr ||
|
||||
m_pCharacter != nullptr ||
|
||||
m_pSong != nullptr ||
|
||||
m_pSteps != nullptr ||
|
||||
m_pCourse != nullptr ||
|
||||
m_pTrail != nullptr ||
|
||||
m_pCharacter != nullptr ||
|
||||
m_CourseDifficulty != Difficulty_Invalid ||
|
||||
!m_sSongGroup.empty() ||
|
||||
m_SortOrder != SortOrder_Invalid ||
|
||||
@@ -916,7 +918,7 @@ bool GameCommand::IsZero() const
|
||||
#include "Steps.h"
|
||||
#include "Character.h"
|
||||
|
||||
/** @brief Allow Lua to have access to the GameCommand. */
|
||||
/** @brief Allow Lua to have access to the GameCommand. */
|
||||
class LunaGameCommand: public Luna<GameCommand>
|
||||
{
|
||||
public:
|
||||
@@ -975,7 +977,7 @@ LUA_REGISTER_CLASS( GameCommand )
|
||||
/*
|
||||
* (c) 2001-2004 Chris Danford, Glenn Maynard
|
||||
* All rights reserved.
|
||||
*
|
||||
*
|
||||
* Permission is hereby granted, free of charge, to any person obtaining a
|
||||
* copy of this software and associated documentation files (the
|
||||
* "Software"), to deal in the Software without restriction, including
|
||||
@@ -985,7 +987,7 @@ LUA_REGISTER_CLASS( GameCommand )
|
||||
* copyright notice(s) and this permission notice appear in all copies of
|
||||
* the Software and that both the above copyright notice(s) and this
|
||||
* permission notice appear in supporting documentation.
|
||||
*
|
||||
*
|
||||
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
|
||||
* OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
||||
* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT OF
|
||||
|
||||
+61
-59
@@ -14,9 +14,11 @@
|
||||
#include "Game.h"
|
||||
#include "Style.h"
|
||||
|
||||
#include <cstddef>
|
||||
|
||||
GameManager* GAMEMAN = nullptr; // global and accessable from anywhere in our program
|
||||
|
||||
enum
|
||||
enum
|
||||
{
|
||||
TRACK_1 = 0,
|
||||
TRACK_2,
|
||||
@@ -405,7 +407,7 @@ static const Style g_Style_Dance_ThreePanel =
|
||||
// todo: re-enable? (lol)
|
||||
/*
|
||||
static const Style g_Style_Dance_Solo_Versus =
|
||||
{ // STYLE_DANCE_SOLO_VERSUS
|
||||
{ // STYLE_DANCE_SOLO_VERSUS
|
||||
"dance-solo-versus", // m_szName
|
||||
StepsType_dance_solo, // m_StepsType
|
||||
ONE_PLAYER_ONE_CREDIT, // m_StyleType
|
||||
@@ -495,7 +497,7 @@ static const Style *g_apGame_Dance_Styles[] =
|
||||
nullptr
|
||||
};
|
||||
|
||||
static const Game g_Game_Dance =
|
||||
static const Game g_Game_Dance =
|
||||
{
|
||||
"dance", // m_szName
|
||||
g_apGame_Dance_Styles, // m_apStyles
|
||||
@@ -860,7 +862,7 @@ static const Style *g_apGame_Pump_Styles[] =
|
||||
nullptr
|
||||
};
|
||||
|
||||
static const Game g_Game_Pump =
|
||||
static const Game g_Game_Pump =
|
||||
{
|
||||
"pump", // m_szName
|
||||
g_apGame_Pump_Styles, // m_apStyles
|
||||
@@ -1041,7 +1043,7 @@ static const Style *g_apGame_KB7_Styles[] =
|
||||
nullptr
|
||||
};
|
||||
|
||||
static const Game g_Game_KB7 =
|
||||
static const Game g_Game_KB7 =
|
||||
{
|
||||
"kb7", // m_szName
|
||||
g_apGame_KB7_Styles, // m_apStyles
|
||||
@@ -1114,7 +1116,7 @@ static const Style g_Style_Ez2_Single =
|
||||
{ 0, 4, 2, 1, 3, Style::END_MAPPING },
|
||||
},
|
||||
{ // m_iColumnDrawOrder[MAX_COLS_PER_PLAYER];
|
||||
2,0,4,1,3 // This should be from back to front: Down, UpLeft, UpRight, Upper Left Hand, Upper Right Hand
|
||||
2,0,4,1,3 // This should be from back to front: Down, UpLeft, UpRight, Upper Left Hand, Upper Right Hand
|
||||
},
|
||||
false, // m_bCanUseBeginnerHelper
|
||||
false, // m_bLockDifficulties
|
||||
@@ -1134,18 +1136,18 @@ static const Style g_Style_Ez2_Real =
|
||||
{ // PLAYER_1
|
||||
{ TRACK_1, -EZ2_REAL_COL_SPACING*2.3f, nullptr },
|
||||
{ TRACK_2, -EZ2_REAL_COL_SPACING*1.6f, nullptr },
|
||||
{ TRACK_3, -EZ2_REAL_COL_SPACING*0.9f, nullptr },
|
||||
{ TRACK_3, -EZ2_REAL_COL_SPACING*0.9f, nullptr },
|
||||
{ TRACK_4, +EZ2_REAL_COL_SPACING*0.0f, nullptr },
|
||||
{ TRACK_5, +EZ2_REAL_COL_SPACING*0.9f, nullptr },
|
||||
{ TRACK_5, +EZ2_REAL_COL_SPACING*0.9f, nullptr },
|
||||
{ TRACK_6, +EZ2_REAL_COL_SPACING*1.6f, nullptr },
|
||||
{ TRACK_7, +EZ2_REAL_COL_SPACING*2.3f, nullptr },
|
||||
},
|
||||
{ // PLAYER_2
|
||||
{ TRACK_1, -EZ2_REAL_COL_SPACING*2.3f, nullptr },
|
||||
{ TRACK_2, -EZ2_REAL_COL_SPACING*1.6f, nullptr },
|
||||
{ TRACK_3, -EZ2_REAL_COL_SPACING*0.9f, nullptr },
|
||||
{ TRACK_3, -EZ2_REAL_COL_SPACING*0.9f, nullptr },
|
||||
{ TRACK_4, +EZ2_REAL_COL_SPACING*0.0f, nullptr },
|
||||
{ TRACK_5, +EZ2_REAL_COL_SPACING*0.9f, nullptr },
|
||||
{ TRACK_5, +EZ2_REAL_COL_SPACING*0.9f, nullptr },
|
||||
{ TRACK_6, +EZ2_REAL_COL_SPACING*1.6f, nullptr },
|
||||
{ TRACK_7, +EZ2_REAL_COL_SPACING*2.3f, nullptr },
|
||||
},
|
||||
@@ -1192,7 +1194,7 @@ static const Style g_Style_Ez2_Single_Versus =
|
||||
{ 0, 4, 2, 1, 3, Style::END_MAPPING },
|
||||
},
|
||||
{ // m_iColumnDrawOrder[MAX_COLS_PER_PLAYER];
|
||||
2,0,4,1,3 // This should be from back to front: Down, UpLeft, UpRight, Upper Left Hand, Upper Right Hand
|
||||
2,0,4,1,3 // This should be from back to front: Down, UpLeft, UpRight, Upper Left Hand, Upper Right Hand
|
||||
},
|
||||
false, // m_bCanUseBeginnerHelper
|
||||
false, // m_bLockDifficulties
|
||||
@@ -1212,18 +1214,18 @@ static const Style g_Style_Ez2_Real_Versus =
|
||||
{ // PLAYER_1
|
||||
{ TRACK_1, -EZ2_REAL_COL_SPACING*2.3f, nullptr },
|
||||
{ TRACK_2, -EZ2_REAL_COL_SPACING*1.6f, nullptr },
|
||||
{ TRACK_3, -EZ2_REAL_COL_SPACING*0.9f, nullptr },
|
||||
{ TRACK_3, -EZ2_REAL_COL_SPACING*0.9f, nullptr },
|
||||
{ TRACK_4, +EZ2_REAL_COL_SPACING*0.0f, nullptr },
|
||||
{ TRACK_5, +EZ2_REAL_COL_SPACING*0.9f, nullptr },
|
||||
{ TRACK_5, +EZ2_REAL_COL_SPACING*0.9f, nullptr },
|
||||
{ TRACK_6, +EZ2_REAL_COL_SPACING*1.6f, nullptr },
|
||||
{ TRACK_7, +EZ2_REAL_COL_SPACING*2.3f, nullptr },
|
||||
},
|
||||
{ // PLAYER_2
|
||||
{ TRACK_1, -EZ2_REAL_COL_SPACING*2.3f, nullptr },
|
||||
{ TRACK_2, -EZ2_REAL_COL_SPACING*1.6f, nullptr },
|
||||
{ TRACK_3, -EZ2_REAL_COL_SPACING*0.9f, nullptr },
|
||||
{ TRACK_3, -EZ2_REAL_COL_SPACING*0.9f, nullptr },
|
||||
{ TRACK_4, +EZ2_REAL_COL_SPACING*0.0f, nullptr },
|
||||
{ TRACK_5, +EZ2_REAL_COL_SPACING*0.9f, nullptr },
|
||||
{ TRACK_5, +EZ2_REAL_COL_SPACING*0.9f, nullptr },
|
||||
{ TRACK_6, +EZ2_REAL_COL_SPACING*1.6f, nullptr },
|
||||
{ TRACK_7, +EZ2_REAL_COL_SPACING*2.3f, nullptr },
|
||||
},
|
||||
@@ -1233,7 +1235,7 @@ static const Style g_Style_Ez2_Real_Versus =
|
||||
{ 0, 6, 3, 2, 4, 1, 5, Style::END_MAPPING },
|
||||
},
|
||||
{ // m_iColumnDrawOrder[MAX_COLS_PER_PLAYER];
|
||||
3,0,6,2,4,1,5 // This should be from back to front: Down, UpLeft, UpRight, Lower Left Hand, Lower Right Hand, Upper Left Hand, Upper Right Hand
|
||||
3,0,6,2,4,1,5 // This should be from back to front: Down, UpLeft, UpRight, Lower Left Hand, Lower Right Hand, Upper Left Hand, Upper Right Hand
|
||||
},
|
||||
false, // m_bCanUseBeginnerHelper
|
||||
false, // m_bLockDifficulties
|
||||
@@ -1280,7 +1282,7 @@ static const Style g_Style_Ez2_Double =
|
||||
{ 5, 9, 7, 6, 8, Style::END_MAPPING },
|
||||
},
|
||||
{ // m_iColumnDrawOrder[MAX_COLS_PER_PLAYER];
|
||||
2,0,4,1,3,7,5,9,6,8 // This should be from back to front: Down, UpLeft, UpRight, Upper Left Hand, Upper Right Hand
|
||||
2,0,4,1,3,7,5,9,6,8 // This should be from back to front: Down, UpLeft, UpRight, Upper Left Hand, Upper Right Hand
|
||||
},
|
||||
false, // m_bCanUseBeginnerHelper
|
||||
false, // m_bLockDifficulties
|
||||
@@ -1309,7 +1311,7 @@ static const AutoMappings g_AutoKeyMappings_Ez2 = AutoMappings (
|
||||
AutoMappingEntry( 0, KEY_Cf, EZ2_BUTTON_HANDLRRIGHT, false )
|
||||
);
|
||||
|
||||
static const Game g_Game_Ez2 =
|
||||
static const Game g_Game_Ez2 =
|
||||
{
|
||||
"ez2", // m_szName
|
||||
g_apGame_Ez2_Styles, // m_apStyles
|
||||
@@ -1380,7 +1382,7 @@ static const Style g_Style_Para_Single =
|
||||
{ 0, 1, 2, 3, 4, Style::END_MAPPING },
|
||||
},
|
||||
{ // m_iColumnDrawOrder[MAX_COLS_PER_PLAYER];
|
||||
2,0,4,1,3
|
||||
2,0,4,1,3
|
||||
},
|
||||
false, // m_bCanUseBeginnerHelper
|
||||
false, // m_bLockDifficulties
|
||||
@@ -1417,7 +1419,7 @@ static const Style g_Style_Para_Versus =
|
||||
{ 0, 1, 2, 3, 4, Style::END_MAPPING },
|
||||
},
|
||||
{ // m_iColumnDrawOrder[MAX_COLS_PER_PLAYER];
|
||||
2,0,4,1,3
|
||||
2,0,4,1,3
|
||||
},
|
||||
false, // m_bCanUseBeginnerHelper
|
||||
false, // m_bLockDifficulties
|
||||
@@ -1441,7 +1443,7 @@ static const AutoMappings g_AutoKeyMappings_Para = AutoMappings (
|
||||
AutoMappingEntry( 0, KEY_Cb, PARA_BUTTON_RIGHT, false )
|
||||
);
|
||||
|
||||
static const Game g_Game_Para =
|
||||
static const Game g_Game_Para =
|
||||
{
|
||||
"para", // m_szName
|
||||
g_apGame_Para_Styles, // m_apStyles
|
||||
@@ -1539,7 +1541,7 @@ static const AutoMappings g_AutoKeyMappings_DS3DDX = AutoMappings (
|
||||
AutoMappingEntry( 0, KEY_Cd, DS3DDX_BUTTON_HANDRIGHT, false )
|
||||
);
|
||||
|
||||
static const Game g_Game_DS3DDX =
|
||||
static const Game g_Game_DS3DDX =
|
||||
{
|
||||
"ds3ddx", // m_szName
|
||||
g_apGame_DS3DDX_Styles, // m_apStyles
|
||||
@@ -1880,7 +1882,7 @@ static const AutoMappings g_AutoKeyMappings_Beat = AutoMappings (
|
||||
AutoMappingEntry( 0, KEY_SPACE, BEAT_BUTTON_SCRATCHUP, false )
|
||||
);
|
||||
|
||||
static const Game g_Game_Beat =
|
||||
static const Game g_Game_Beat =
|
||||
{
|
||||
"beat", // m_szName
|
||||
g_apGame_Beat_Styles, // m_apStyles
|
||||
@@ -2058,7 +2060,7 @@ static const AutoMappings g_AutoKeyMappings_Maniax = AutoMappings (
|
||||
AutoMappingEntry( 0, KEY_KP_C2, MANIAX_BUTTON_HANDLRRIGHT, true )
|
||||
);
|
||||
|
||||
static const Game g_Game_Maniax =
|
||||
static const Game g_Game_Maniax =
|
||||
{
|
||||
"maniax", // m_szName
|
||||
g_apGame_Maniax_Styles, // m_apStyles
|
||||
@@ -2529,7 +2531,7 @@ static const AutoMappings g_AutoKeyMappings_Techno = AutoMappings (
|
||||
AutoMappingEntry( 0, KEY_KP_C3, TECHNO_BUTTON_DOWNRIGHT,true )
|
||||
);
|
||||
|
||||
static const Game g_Game_Techno =
|
||||
static const Game g_Game_Techno =
|
||||
{
|
||||
"techno", // m_szName
|
||||
g_apGame_Techno_Styles, // m_apStyles
|
||||
@@ -2572,9 +2574,9 @@ static const Game g_Game_Techno =
|
||||
|
||||
/** popn *********************************************************************/
|
||||
//ThemeMetric<int> POPN5_COL_SPACING ("ColumnSpacing","Popn5");
|
||||
static const int POPN5_COL_SPACING = 32;
|
||||
static const int POPN5_COL_SPACING = 32;
|
||||
//ThemeMetric<int> POPN9_COL_SPACING ("ColumnSpacing","Popn9");
|
||||
static const int POPN9_COL_SPACING = 32;
|
||||
static const int POPN9_COL_SPACING = 32;
|
||||
static const Style g_Style_Popn_Five =
|
||||
{ // STYLE_POPN_FIVE
|
||||
true, // m_bUsedForGameplay
|
||||
@@ -2679,7 +2681,7 @@ static const AutoMappings g_AutoKeyMappings_Popn = AutoMappings (
|
||||
AutoMappingEntry( 0, KEY_Cb, POPN_BUTTON_RIGHT_WHITE,false )
|
||||
);
|
||||
|
||||
static const Game g_Game_Popn =
|
||||
static const Game g_Game_Popn =
|
||||
{
|
||||
"popn", // m_szName
|
||||
g_apGame_Popn_Styles, // m_apStyles
|
||||
@@ -2785,7 +2787,7 @@ static const Style *g_apGame_Lights_Styles[] =
|
||||
nullptr
|
||||
};
|
||||
|
||||
static const Game g_Game_Lights =
|
||||
static const Game g_Game_Lights =
|
||||
{
|
||||
"lights", // m_szName
|
||||
g_apGame_Lights_Styles, // m_apStyles
|
||||
@@ -3211,7 +3213,7 @@ static const Game g_Game_Kickbox =
|
||||
TNS_W5, // m_mapW5To
|
||||
};
|
||||
|
||||
static const Game *g_Games[] =
|
||||
static const Game *g_Games[] =
|
||||
{
|
||||
&g_Game_Dance,
|
||||
&g_Game_Pump,
|
||||
@@ -3252,12 +3254,12 @@ GameManager::~GameManager()
|
||||
|
||||
void GameManager::GetStylesForGame( const Game *pGame, std::vector<const Style*>& aStylesAddTo, bool editor )
|
||||
{
|
||||
for( int s=0; pGame->m_apStyles[s]; ++s )
|
||||
for( int s=0; pGame->m_apStyles[s]; ++s )
|
||||
{
|
||||
const Style *style = pGame->m_apStyles[s];
|
||||
if( !editor && !style->m_bUsedForGameplay )
|
||||
if( !editor && !style->m_bUsedForGameplay )
|
||||
continue;
|
||||
if( editor && !style->m_bUsedForEdit )
|
||||
if( editor && !style->m_bUsedForEdit )
|
||||
continue;
|
||||
|
||||
aStylesAddTo.push_back( style );
|
||||
@@ -3266,10 +3268,10 @@ void GameManager::GetStylesForGame( const Game *pGame, std::vector<const Style*>
|
||||
|
||||
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];
|
||||
for( int s=0; pGame->m_apStyles[s]; ++s )
|
||||
for( int s=0; pGame->m_apStyles[s]; ++s )
|
||||
{
|
||||
if( pGame->m_apStyles[s] == pStyle )
|
||||
return pGame;
|
||||
@@ -3280,10 +3282,10 @@ const Game *GameManager::GetGameForStyle( const Style *pStyle )
|
||||
|
||||
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];
|
||||
for( int s=0; pGame->m_apStyles[s]; ++s )
|
||||
for( int s=0; pGame->m_apStyles[s]; ++s )
|
||||
{
|
||||
const Style *style = pGame->m_apStyles[s];
|
||||
if( style->m_StepsType == st && style->m_bUsedForEdit )
|
||||
@@ -3302,14 +3304,14 @@ void GameManager::GetStepsTypesForGame( const Game *pGame, std::vector<StepsType
|
||||
{
|
||||
StepsType st = pGame->m_apStyles[i]->m_StepsType;
|
||||
ASSERT(st < NUM_StepsType);
|
||||
|
||||
|
||||
// Some Styles use the same StepsType (e.g. single and versus) so check
|
||||
// that we aren't doubling up.
|
||||
bool found = false;
|
||||
for( unsigned j=0; j < aStepsTypeAddTo.size(); j++ )
|
||||
if( st == aStepsTypeAddTo[j] ) { found = true; break; }
|
||||
if(found) continue;
|
||||
|
||||
|
||||
aStepsTypeAddTo.push_back( st );
|
||||
}
|
||||
}
|
||||
@@ -3318,19 +3320,19 @@ void GameManager::GetDemonstrationStylesForGame( const Game *pGame, std::vector<
|
||||
{
|
||||
vpStylesOut.clear();
|
||||
|
||||
for( int s=0; pGame->m_apStyles[s]; ++s )
|
||||
for( int s=0; pGame->m_apStyles[s]; ++s )
|
||||
{
|
||||
const Style *style = pGame->m_apStyles[s];
|
||||
if( style->m_bUsedForDemonstration )
|
||||
vpStylesOut.push_back( style );
|
||||
}
|
||||
|
||||
|
||||
ASSERT( vpStylesOut.size()>0 ); // this Game is missing a Style that can be used with the demonstration
|
||||
}
|
||||
|
||||
const Style* GameManager::GetHowToPlayStyleForGame( const Game *pGame )
|
||||
{
|
||||
for( int s=0; pGame->m_apStyles[s]; ++s )
|
||||
for( int s=0; pGame->m_apStyles[s]; ++s )
|
||||
{
|
||||
const Style *style = pGame->m_apStyles[s];
|
||||
if( style->m_bUsedForHowToPlay )
|
||||
@@ -3361,7 +3363,7 @@ void GameManager::GetCompatibleStyles( const Game *pGame, int iNumPlayers, std::
|
||||
if( iNumPlayers != iNumPlayersRequired )
|
||||
continue;
|
||||
|
||||
for( int s=0; pGame->m_apStyles[s]; ++s )
|
||||
for( int s=0; pGame->m_apStyles[s]; ++s )
|
||||
{
|
||||
const Style *style = pGame->m_apStyles[s];
|
||||
if( style->m_StyleType != styleType )
|
||||
@@ -3391,7 +3393,7 @@ const Style *GameManager::GetFirstCompatibleStyle( const Game *pGame, int iNumPl
|
||||
|
||||
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];
|
||||
if( IsGameEnabled( pGame ) )
|
||||
@@ -3404,7 +3406,7 @@ const Game* GameManager::GetDefaultGame()
|
||||
const Game *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]) )
|
||||
pDefault = g_Games[i];
|
||||
@@ -3413,13 +3415,13 @@ const Game* GameManager::GetDefaultGame()
|
||||
if( pDefault == nullptr )
|
||||
RageException::Throw( "No NoteSkins found" );
|
||||
}
|
||||
|
||||
|
||||
return pDefault;
|
||||
}
|
||||
|
||||
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 )
|
||||
return g;
|
||||
@@ -3468,7 +3470,7 @@ RString GameManager::StyleToLocalizedString( const Style* style )
|
||||
|
||||
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) )
|
||||
return g_Games[i];
|
||||
|
||||
@@ -3478,7 +3480,7 @@ const Game* GameManager::StringToGame( RString sGame )
|
||||
|
||||
const Style* GameManager::GameAndStringToStyle( const Game *game, RString sStyle )
|
||||
{
|
||||
for( int s=0; game->m_apStyles[s]; ++s )
|
||||
for( int s=0; game->m_apStyles[s]; ++s )
|
||||
{
|
||||
const Style* style = game->m_apStyles[s];
|
||||
if( sStyle.CompareNoCase(style->m_szName) == 0 )
|
||||
@@ -3491,7 +3493,7 @@ const Style* GameManager::GameAndStringToStyle( const Game *game, RString sStyle
|
||||
// lua start
|
||||
#include "LuaBinding.h"
|
||||
|
||||
/** @brief Allow Lua to have access to the GameManager. */
|
||||
/** @brief Allow Lua to have access to the GameManager. */
|
||||
class LunaGameManager: public Luna<GameManager>
|
||||
{
|
||||
public:
|
||||
@@ -3504,7 +3506,7 @@ public:
|
||||
p->GetStepsTypesForGame( pGame, vstAddTo );
|
||||
ASSERT( !vstAddTo.empty() );
|
||||
StepsType st = vstAddTo[0];
|
||||
LuaHelpers::Push( L, st );
|
||||
LuaHelpers::Push( L, st );
|
||||
return 1;
|
||||
}
|
||||
static int IsGameEnabled( T* p, lua_State *L )
|
||||
@@ -3527,12 +3529,12 @@ public:
|
||||
}
|
||||
std::vector<Style*> aStyles;
|
||||
lua_createtable(L, 0, 0);
|
||||
for( int s=0; pGame->m_apStyles[s]; ++s )
|
||||
for( int s=0; pGame->m_apStyles[s]; ++s )
|
||||
{
|
||||
Style *pStyle = const_cast<Style *>( pGame->m_apStyles[s] );
|
||||
pStyle->PushSelf(L);
|
||||
lua_rawseti(L, -2, s+1);
|
||||
}
|
||||
}
|
||||
return 1;
|
||||
}
|
||||
static int GetEnabledGames( T* p, lua_State *L )
|
||||
@@ -3540,14 +3542,14 @@ public:
|
||||
std::vector<const Game*> aGames;
|
||||
p->GetEnabledGames( aGames );
|
||||
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_rawseti(L, -2, i+1);
|
||||
}
|
||||
return 1;
|
||||
return 1;
|
||||
}
|
||||
|
||||
|
||||
static int SetGame( T* p, lua_State *L )
|
||||
{
|
||||
RString game_name= SArg(1);
|
||||
@@ -3568,7 +3570,7 @@ public:
|
||||
GameLoop::ChangeGame(game_name, theme);
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
LunaGameManager()
|
||||
{
|
||||
ADD_METHOD( StepsTypeToLocalizedString );
|
||||
@@ -3587,7 +3589,7 @@ LUA_REGISTER_CLASS( GameManager )
|
||||
/*
|
||||
* (c) 2001-2006 Chris Danford, Glenn Maynard
|
||||
* All rights reserved.
|
||||
*
|
||||
*
|
||||
* Permission is hereby granted, free of charge, to any person obtaining a
|
||||
* copy of this software and associated documentation files (the
|
||||
* "Software"), to deal in the Software without restriction, including
|
||||
@@ -3597,7 +3599,7 @@ LUA_REGISTER_CLASS( GameManager )
|
||||
* copyright notice(s) and this permission notice appear in all copies of
|
||||
* the Software and that both the above copyright notice(s) and this
|
||||
* permission notice appear in supporting documentation.
|
||||
*
|
||||
*
|
||||
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
|
||||
* OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
||||
* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT OF
|
||||
|
||||
@@ -3,6 +3,7 @@
|
||||
|
||||
#include "Preference.h"
|
||||
#include "GameConstantsAndTypes.h"
|
||||
|
||||
/** @brief Quick access to other variables. */
|
||||
namespace GamePreferences
|
||||
{
|
||||
@@ -16,7 +17,7 @@ namespace GamePreferences
|
||||
/*
|
||||
* (c) 2001-2004 Chris Danford, Chris Gomez
|
||||
* All rights reserved.
|
||||
*
|
||||
*
|
||||
* Permission is hereby granted, free of charge, to any person obtaining a
|
||||
* copy of this software and associated documentation files (the
|
||||
* "Software"), to deal in the Software without restriction, including
|
||||
@@ -26,7 +27,7 @@ namespace GamePreferences
|
||||
* copyright notice(s) and this permission notice appear in all copies of
|
||||
* the Software and that both the above copyright notice(s) and this
|
||||
* permission notice appear in supporting documentation.
|
||||
*
|
||||
*
|
||||
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
|
||||
* OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
||||
* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT OF
|
||||
|
||||
@@ -21,6 +21,7 @@
|
||||
#include "arch/Sound/RageSoundDriver.h"
|
||||
|
||||
#include <cmath>
|
||||
#include <cstddef>
|
||||
|
||||
GameSoundManager *SOUND = nullptr;
|
||||
|
||||
@@ -905,7 +906,7 @@ int LuaFunc_get_sound_driver_list(lua_State* L)
|
||||
std::vector<RString> driver_names;
|
||||
split(RageSoundDriver::GetDefaultSoundDriverList(), ",", driver_names, true);
|
||||
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_rawseti(L, -2, n+1);
|
||||
|
||||
+4
-3
@@ -43,6 +43,7 @@
|
||||
#include "Screen.h"
|
||||
|
||||
#include <cmath>
|
||||
#include <cstddef>
|
||||
#include <ctime>
|
||||
#include <set>
|
||||
|
||||
@@ -1481,7 +1482,7 @@ int GameState::prepare_song_for_gameplay()
|
||||
copy_exts.push_back("lrc");
|
||||
std::vector<RString> 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];
|
||||
if(!FileCopy(from_dir + fname, to_dir + fname))
|
||||
@@ -3333,7 +3334,7 @@ public:
|
||||
{
|
||||
int i= IArg(1) - 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; }
|
||||
lua_pushnumber(L, p->GetAutoGenFarg(si));
|
||||
return 1;
|
||||
@@ -3346,7 +3347,7 @@ public:
|
||||
luaL_error(L, "%i is not a valid autogen arg index.", i);
|
||||
}
|
||||
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())
|
||||
{
|
||||
p->m_autogen_fargs.push_back(0.0f);
|
||||
|
||||
+8
-7
@@ -13,8 +13,9 @@
|
||||
#include "SongPosition.h"
|
||||
#include "Preference.h"
|
||||
|
||||
#include <map>
|
||||
#include <cstddef>
|
||||
#include <deque>
|
||||
#include <map>
|
||||
#include <set>
|
||||
|
||||
class Character;
|
||||
@@ -104,7 +105,7 @@ public:
|
||||
/**
|
||||
* @brief The number of coins presently in the machine.
|
||||
*
|
||||
* Note that coins are not "credits". One may have to put in two coins
|
||||
* Note that coins are not "credits". One may have to put in two coins
|
||||
* to get one credit, only to have to put in another four coins to get
|
||||
* the three credits needed to begin the game. */
|
||||
BroadcastOnChange<int> m_iCoins;
|
||||
@@ -377,7 +378,7 @@ public:
|
||||
// Preferences
|
||||
static Preference<bool> m_bAutoJoin;
|
||||
|
||||
// These options have weird interactions depending on m_bEventMode,
|
||||
// These options have weird interactions depending on m_bEventMode,
|
||||
// so wrap them.
|
||||
bool m_bTemporaryEventMode;
|
||||
bool IsEventMode() const;
|
||||
@@ -385,7 +386,7 @@ public:
|
||||
Premium GetPremium() const;
|
||||
|
||||
// Edit stuff
|
||||
|
||||
|
||||
/**
|
||||
* @brief Is the game right now using Song timing or Steps timing?
|
||||
*
|
||||
@@ -412,7 +413,7 @@ public:
|
||||
|
||||
// Autogen stuff. This should probably be moved to its own singleton or
|
||||
// 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; }
|
||||
return m_autogen_fargs[i];
|
||||
@@ -466,7 +467,7 @@ extern GameState* GAMESTATE; // global and accessible from anywhere in our progr
|
||||
* @author Chris Danford, Glenn Maynard, Chris Gomez (c) 2001-2004
|
||||
* @section LICENSE
|
||||
* All rights reserved.
|
||||
*
|
||||
*
|
||||
* Permission is hereby granted, free of charge, to any person obtaining a
|
||||
* copy of this software and associated documentation files (the
|
||||
* "Software"), to deal in the Software without restriction, including
|
||||
@@ -476,7 +477,7 @@ extern GameState* GAMESTATE; // global and accessible from anywhere in our progr
|
||||
* copyright notice(s) and this permission notice appear in all copies of
|
||||
* the Software and that both the above copyright notice(s) and this
|
||||
* permission notice appear in supporting documentation.
|
||||
*
|
||||
*
|
||||
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
|
||||
* OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
||||
* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT OF
|
||||
|
||||
@@ -10,6 +10,8 @@
|
||||
#include "Style.h"
|
||||
#include "ActorUtil.h"
|
||||
|
||||
#include <cstddef>
|
||||
|
||||
void GhostArrowRow::Load( const PlayerState* pPlayerState, float fYReverseOffset )
|
||||
{
|
||||
m_pPlayerState = pPlayerState;
|
||||
@@ -20,7 +22,7 @@ void GhostArrowRow::Load( const PlayerState* pPlayerState, float fYReverseOffset
|
||||
NOTESKIN->SetPlayerNumber( pn );
|
||||
|
||||
// init arrows
|
||||
for( int c=0; c<pStyle->m_iColsPerPlayer; c++ )
|
||||
for( int c=0; c<pStyle->m_iColsPerPlayer; c++ )
|
||||
{
|
||||
const RString &sButton = GAMESTATE->GetCurrentStyle(pn)->ColToButtonName( c );
|
||||
|
||||
@@ -39,7 +41,7 @@ void GhostArrowRow::Load( const PlayerState* pPlayerState, float fYReverseOffset
|
||||
void GhostArrowRow::SetColumnRenderers(std::vector<NoteColumnRenderer>& renderers)
|
||||
{
|
||||
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]));
|
||||
}
|
||||
@@ -147,7 +149,7 @@ void GhostArrowRow::SetHoldShowing( int iCol, const TapNote &tn )
|
||||
/*
|
||||
* (c) 2001-2004 Chris Danford
|
||||
* All rights reserved.
|
||||
*
|
||||
*
|
||||
* Permission is hereby granted, free of charge, to any person obtaining a
|
||||
* copy of this software and associated documentation files (the
|
||||
* "Software"), to deal in the Software without restriction, including
|
||||
@@ -157,7 +159,7 @@ void GhostArrowRow::SetHoldShowing( int iCol, const TapNote &tn )
|
||||
* copyright notice(s) and this permission notice appear in all copies of
|
||||
* the Software and that both the above copyright notice(s) and this
|
||||
* permission notice appear in supporting documentation.
|
||||
*
|
||||
*
|
||||
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
|
||||
* OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
||||
* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT OF
|
||||
|
||||
@@ -6,6 +6,8 @@
|
||||
#include "ActorUtil.h"
|
||||
#include "ThemeManager.h"
|
||||
|
||||
#include <cstddef>
|
||||
|
||||
REGISTER_ACTOR_CLASS( GradeDisplay );
|
||||
|
||||
void GradeDisplay::Load( RString sMetricsGroup )
|
||||
@@ -18,14 +20,14 @@ void GradeDisplay::Load( RString sMetricsGroup )
|
||||
AutoActor &spr = m_vSpr[i];
|
||||
spr.Load( THEME->GetPathG(sMetricsGroup,GradeToString(g)) );
|
||||
spr->SetVisible( false );
|
||||
this->AddChild( spr );
|
||||
this->AddChild( spr );
|
||||
i++;
|
||||
}
|
||||
}
|
||||
|
||||
void GradeDisplay::SetGrade( Grade grade )
|
||||
{
|
||||
size_t i = 0;
|
||||
std::size_t i = 0;
|
||||
FOREACH_PossibleGrade( g )
|
||||
{
|
||||
if(i >= m_vSpr.size())
|
||||
@@ -43,7 +45,7 @@ void GradeDisplay::SetGrade( Grade grade )
|
||||
// lua start
|
||||
#include "LuaBinding.h"
|
||||
|
||||
/** @brief Allow Lua to have access to the GradeDisplay. */
|
||||
/** @brief Allow Lua to have access to the GradeDisplay. */
|
||||
class LunaGradeDisplay: public Luna<GradeDisplay>
|
||||
{
|
||||
public:
|
||||
@@ -72,7 +74,7 @@ LUA_REGISTER_DERIVED_CLASS( GradeDisplay, ActorFrame )
|
||||
/*
|
||||
* (c) 2001-2002 Chris Danford
|
||||
* All rights reserved.
|
||||
*
|
||||
*
|
||||
* Permission is hereby granted, free of charge, to any person obtaining a
|
||||
* copy of this software and associated documentation files (the
|
||||
* "Software"), to deal in the Software without restriction, including
|
||||
@@ -82,7 +84,7 @@ LUA_REGISTER_DERIVED_CLASS( GradeDisplay, ActorFrame )
|
||||
* copyright notice(s) and this permission notice appear in all copies of
|
||||
* the Software and that both the above copyright notice(s) and this
|
||||
* permission notice appear in supporting documentation.
|
||||
*
|
||||
*
|
||||
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
|
||||
* OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
||||
* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT OF
|
||||
|
||||
+15
-14
@@ -8,6 +8,7 @@
|
||||
#include "RadarValues.h"
|
||||
|
||||
#include <algorithm>
|
||||
#include <cstddef>
|
||||
|
||||
ThemeMetric<RString> EMPTY_NAME("HighScore","EmptyName");
|
||||
|
||||
@@ -41,7 +42,7 @@ struct HighScoreImpl
|
||||
bool operator!=( const HighScoreImpl& other ) const { return !(*this == other); }
|
||||
};
|
||||
|
||||
bool HighScoreImpl::operator==( const HighScoreImpl& other ) const
|
||||
bool HighScoreImpl::operator==( const HighScoreImpl& other ) const
|
||||
{
|
||||
#define COMPARE(x) if( x!=other.x ) return false;
|
||||
COMPARE( sName );
|
||||
@@ -265,7 +266,7 @@ bool HighScore::operator>=( const HighScore& other ) const
|
||||
return !operator<(other);
|
||||
}
|
||||
|
||||
bool HighScore::operator==( const HighScore& other ) const
|
||||
bool HighScore::operator==( const HighScore& other ) const
|
||||
{
|
||||
return *m_Impl == *other.m_Impl;
|
||||
}
|
||||
@@ -280,7 +281,7 @@ XNode* HighScore::CreateNode() const
|
||||
return m_Impl->CreateNode();
|
||||
}
|
||||
|
||||
void HighScore::LoadFromNode( const XNode* pNode )
|
||||
void HighScore::LoadFromNode( const XNode* pNode )
|
||||
{
|
||||
m_Impl->LoadFromNode( pNode );
|
||||
}
|
||||
@@ -309,8 +310,8 @@ void HighScoreList::AddHighScore( HighScore hs, int &iIndexOut, bool bIsMachine
|
||||
if( hs >= vHighScores[i] )
|
||||
break;
|
||||
}
|
||||
const int iMaxScores = bIsMachine ?
|
||||
PREFSMAN->m_iMaxHighScoresPerListForMachine :
|
||||
const int iMaxScores = bIsMachine ?
|
||||
PREFSMAN->m_iMaxHighScoresPerListForMachine :
|
||||
PREFSMAN->m_iMaxHighScoresPerListForPlayer;
|
||||
if( i < iMaxScores )
|
||||
{
|
||||
@@ -318,7 +319,7 @@ void HighScoreList::AddHighScore( HighScore hs, int &iIndexOut, bool bIsMachine
|
||||
iIndexOut = i;
|
||||
|
||||
// Delete extra machine high scores in RemoveAllButOneOfEachNameAndClampSize
|
||||
// and not here so that we don't end up with less than iMaxScores after
|
||||
// and not here so that we don't end up with less than iMaxScores after
|
||||
// removing HighScores with duplicate names.
|
||||
//
|
||||
if( !bIsMachine )
|
||||
@@ -420,8 +421,8 @@ void HighScoreList::RemoveAllButOneOfEachName()
|
||||
|
||||
void HighScoreList::ClampSize( bool bIsMachine )
|
||||
{
|
||||
const int iMaxScores = bIsMachine ?
|
||||
PREFSMAN->m_iMaxHighScoresPerListForMachine :
|
||||
const int iMaxScores = bIsMachine ?
|
||||
PREFSMAN->m_iMaxHighScoresPerListForMachine :
|
||||
PREFSMAN->m_iMaxHighScoresPerListForPlayer;
|
||||
if( vHighScores.size() > unsigned(iMaxScores) )
|
||||
vHighScores.erase( vHighScores.begin()+iMaxScores, vHighScores.end() );
|
||||
@@ -457,7 +458,7 @@ XNode* Screenshot::CreateNode() const
|
||||
return pNode;
|
||||
}
|
||||
|
||||
void Screenshot::LoadFromNode( const XNode* pNode )
|
||||
void Screenshot::LoadFromNode( const XNode* pNode )
|
||||
{
|
||||
ASSERT( pNode->GetName() == "Screenshot" );
|
||||
|
||||
@@ -542,7 +543,7 @@ public:
|
||||
static int GetHighestScoreOfName( T* p, lua_State *L )
|
||||
{
|
||||
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())
|
||||
{
|
||||
@@ -557,8 +558,8 @@ public:
|
||||
static int GetRankOfName( T* p, lua_State *L )
|
||||
{
|
||||
RString name= SArg(1);
|
||||
size_t rank= 0;
|
||||
for(size_t i= 0; i < p->vHighScores.size(); ++i)
|
||||
std::size_t rank= 0;
|
||||
for(std::size_t i= 0; i < p->vHighScores.size(); ++i)
|
||||
{
|
||||
if(name == p->vHighScores[i].GetName())
|
||||
{
|
||||
@@ -586,7 +587,7 @@ LUA_REGISTER_CLASS( HighScoreList )
|
||||
/*
|
||||
* (c) 2004 Chris Danford
|
||||
* All rights reserved.
|
||||
*
|
||||
*
|
||||
* Permission is hereby granted, free of charge, to any person obtaining a
|
||||
* copy of this software and associated documentation files (the
|
||||
* "Software"), to deal in the Software without restriction, including
|
||||
@@ -596,7 +597,7 @@ LUA_REGISTER_CLASS( HighScoreList )
|
||||
* copyright notice(s) and this permission notice appear in all copies of
|
||||
* the Software and that both the above copyright notice(s) and this
|
||||
* permission notice appear in supporting documentation.
|
||||
*
|
||||
*
|
||||
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
|
||||
* OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
||||
* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT OF
|
||||
|
||||
+2
-1
@@ -20,6 +20,7 @@
|
||||
#include "Banner.h"
|
||||
|
||||
#include <cmath>
|
||||
#include <cstddef>
|
||||
|
||||
static Preference<bool> g_bPalettedImageCache( "PalettedImageCache", false );
|
||||
|
||||
@@ -272,7 +273,7 @@ RageTextureID ImageCache::LoadCachedImage( RString sImageDir, RString sImagePath
|
||||
{
|
||||
RageTextureID ID( GetImageCachePath(sImageDir,sImagePath) );
|
||||
|
||||
size_t Found = sImagePath.find("_blank");
|
||||
std::size_t Found = sImagePath.find("_blank");
|
||||
if( sImagePath == "" || Found!=RString::npos )
|
||||
return ID;
|
||||
|
||||
|
||||
+3
-1
@@ -10,6 +10,8 @@ http://en.wikipedia.org/wiki/INI_file
|
||||
#include "RageLog.h"
|
||||
#include "RageFile.h"
|
||||
|
||||
#include <cstddef>
|
||||
|
||||
|
||||
IniFile::IniFile(): XNode("IniFile")
|
||||
{
|
||||
@@ -94,7 +96,7 @@ bool IniFile::ReadFile( RageFileBasic &f )
|
||||
if(keychild == nullptr)
|
||||
{ break; }
|
||||
// New value.
|
||||
size_t iEqualIndex = line.find("=");
|
||||
std::size_t iEqualIndex = line.find("=");
|
||||
if( iEqualIndex != std::string::npos )
|
||||
{
|
||||
RString valuename = line.Left((int) iEqualIndex);
|
||||
|
||||
+17
-15
@@ -11,6 +11,8 @@
|
||||
#include "LocalizedString.h"
|
||||
#include "arch/Dialog/Dialog.h"
|
||||
|
||||
#include <cstddef>
|
||||
|
||||
#define AUTOMAPPINGS_DIR "/Data/AutoMappings/"
|
||||
|
||||
static Preference<RString> g_sLastSeenInputDevices( "LastSeenInputDevices", "" );
|
||||
@@ -284,7 +286,7 @@ static const AutoMappings g_AutoMappings[] =
|
||||
),
|
||||
AutoMappings(
|
||||
"dance",
|
||||
"0b43:0003", // The EMS USB2 doesn't provide a model string, so Linux
|
||||
"0b43:0003", // The EMS USB2 doesn't provide a model string, so Linux
|
||||
// just gives us the VendorID and ModelID in hex.
|
||||
"EMS USB2",
|
||||
// Player 1.
|
||||
@@ -868,7 +870,7 @@ void InputMapper::SetInputMap( const DeviceInput &DeviceI, const GameInput &Game
|
||||
void InputMapper::ClearFromInputMap( const DeviceInput &DeviceI )
|
||||
{
|
||||
m_mappings.ClearFromInputMap( DeviceI );
|
||||
|
||||
|
||||
UpdateTempDItoGI();
|
||||
}
|
||||
|
||||
@@ -983,7 +985,7 @@ bool InputMapper::IsBeingPressed( GameButton MenuI, PlayerNumber pn ) const
|
||||
}
|
||||
std::vector<GameInput> 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]) )
|
||||
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 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);
|
||||
}
|
||||
@@ -1023,7 +1025,7 @@ void InputMapper::RepeatStopKey( GameButton MenuI, PlayerNumber pn )
|
||||
}
|
||||
std::vector<GameInput> 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] );
|
||||
}
|
||||
|
||||
@@ -1059,7 +1061,7 @@ float InputMapper::GetSecsHeld( GameButton MenuI, PlayerNumber pn ) const
|
||||
|
||||
std::vector<GameInput> 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]) );
|
||||
|
||||
return fMaxSecsHeld;
|
||||
@@ -1087,7 +1089,7 @@ void InputMapper::ResetKeyRepeat( GameButton MenuI, PlayerNumber pn )
|
||||
}
|
||||
std::vector<GameInput> 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] );
|
||||
}
|
||||
|
||||
@@ -1118,7 +1120,7 @@ float InputMapper::GetLevel( GameButton MenuI, PlayerNumber pn ) const
|
||||
MenuToGame( MenuI, pn, GameI );
|
||||
|
||||
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]) );
|
||||
|
||||
return fLevel;
|
||||
@@ -1140,7 +1142,7 @@ MultiPlayer InputMapper::InputDeviceToMultiPlayer( InputDevice id )
|
||||
|
||||
GameButton InputScheme::ButtonNameToIndex( const RString &sButtonName ) const
|
||||
{
|
||||
for( GameButton gb=(GameButton) 0; gb<m_iButtonsPerController; gb=(GameButton)(gb+1) )
|
||||
for( GameButton gb=(GameButton) 0; gb<m_iButtonsPerController; gb=(GameButton)(gb+1) )
|
||||
if( strcasecmp(GetGameButtonName(gb), sButtonName) == 0 )
|
||||
return gb;
|
||||
|
||||
@@ -1301,7 +1303,7 @@ void InputMappings::WriteMappings( const InputScheme *pInputScheme, RString sFil
|
||||
{
|
||||
IniFile ini;
|
||||
ini.ReadFile( sFilePath );
|
||||
|
||||
|
||||
// erase the key so that we overwrite everything for this game
|
||||
ini.DeleteKey( pInputScheme->m_szName );
|
||||
|
||||
@@ -1321,10 +1323,10 @@ void InputMappings::WriteMappings( const InputScheme *pInputScheme, RString sFil
|
||||
std::vector<RString> asValues;
|
||||
for( int slot = 0; slot < NUM_USER_GAME_TO_DEVICE_SLOTS; ++slot ) // don't save data from the last (keyboard automap) slot
|
||||
asValues.push_back( m_GItoDI[i][j][slot].ToString() );
|
||||
|
||||
|
||||
while( asValues.size() && asValues.back() == "" )
|
||||
asValues.erase( asValues.begin()+asValues.size()-1 );
|
||||
|
||||
|
||||
RString sValueString = join( DEVICE_INPUT_SEPARATOR, asValues );
|
||||
|
||||
pKey->AppendAttr( sNameString, sValueString );
|
||||
@@ -1339,7 +1341,7 @@ void InputMappings::SetInputMap( const DeviceInput &DeviceI, const GameInput &Ga
|
||||
// remove the old input
|
||||
ClearFromInputMap( DeviceI );
|
||||
ClearFromInputMap( GameI, iSlotIndex );
|
||||
|
||||
|
||||
ASSERT_M( GameI.controller < NUM_GameController,
|
||||
ssprintf("controller: %u >= %u", GameI.controller, NUM_GameController) );
|
||||
ASSERT_M( GameI.button < NUM_GameButton,
|
||||
@@ -1383,7 +1385,7 @@ bool InputMappings::ClearFromInputMap( const GameInput &GameI, int iSlotIndex )
|
||||
/*
|
||||
* (c) 2001-2003 Chris Danford
|
||||
* All rights reserved.
|
||||
*
|
||||
*
|
||||
* Permission is hereby granted, free of charge, to any person obtaining a
|
||||
* copy of this software and associated documentation files (the
|
||||
* "Software"), to deal in the Software without restriction, including
|
||||
@@ -1393,7 +1395,7 @@ bool InputMappings::ClearFromInputMap( const GameInput &GameI, int iSlotIndex )
|
||||
* copyright notice(s) and this permission notice appear in all copies of
|
||||
* the Software and that both the above copyright notice(s) and this
|
||||
* permission notice appear in supporting documentation.
|
||||
*
|
||||
*
|
||||
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
|
||||
* OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
||||
* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT OF
|
||||
|
||||
+13
-11
@@ -16,7 +16,9 @@
|
||||
#include "Steps.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()
|
||||
{
|
||||
@@ -97,8 +99,8 @@ void LifeMeterBar::Load( const PlayerState *pPlayerState, PlayerStageStats *pPla
|
||||
}
|
||||
|
||||
// Change life difficulty to really easy if merciful beginner on
|
||||
m_bMercifulBeginnerInEffect =
|
||||
GAMESTATE->m_PlayMode == PLAY_MODE_REGULAR &&
|
||||
m_bMercifulBeginnerInEffect =
|
||||
GAMESTATE->m_PlayMode == PLAY_MODE_REGULAR &&
|
||||
GAMESTATE->IsPlayerEnabled( pPlayerState ) &&
|
||||
GAMESTATE->m_pCurSteps[pn]->GetDifficulty() == Difficulty_Beginner &&
|
||||
PREFSMAN->m_bMercifulBeginner;
|
||||
@@ -274,17 +276,17 @@ void LifeMeterBar::AfterLifeChanged()
|
||||
}
|
||||
|
||||
bool LifeMeterBar::IsHot() const
|
||||
{
|
||||
return m_fLifePercentage >= HOT_VALUE;
|
||||
{
|
||||
return m_fLifePercentage >= HOT_VALUE;
|
||||
}
|
||||
|
||||
bool LifeMeterBar::IsInDanger() const
|
||||
{
|
||||
return m_fLifePercentage < DANGER_THRESHOLD;
|
||||
{
|
||||
return m_fLifePercentage < DANGER_THRESHOLD;
|
||||
}
|
||||
|
||||
bool LifeMeterBar::IsFailing() const
|
||||
{
|
||||
{
|
||||
return m_fLifePercentage <= m_pPlayerState->m_PlayerOptions.GetCurrent().m_fPassmark;
|
||||
}
|
||||
|
||||
@@ -384,7 +386,7 @@ void LifeMeterBar::UpdateNonstopLifebar()
|
||||
int iLifeDifficulty = int( (1.8f - m_fLifeDifficulty)/0.2f );
|
||||
|
||||
// first eight values don't matter
|
||||
float fDifficultyValues[16] = {0,0,0,0,0,0,0,0,
|
||||
float fDifficultyValues[16] = {0,0,0,0,0,0,0,0,
|
||||
0.3f, 0.25f, 0.2f, 0.16f, 0.14f, 0.12f, 0.10f, 0.08f};
|
||||
|
||||
if( iLifeDifficulty >= 16 )
|
||||
@@ -413,7 +415,7 @@ void LifeMeterBar::FillForHowToPlay( int NumW2s, int NumMisses )
|
||||
/*
|
||||
* (c) 2001-2004 Chris Danford
|
||||
* All rights reserved.
|
||||
*
|
||||
*
|
||||
* Permission is hereby granted, free of charge, to any person obtaining a
|
||||
* copy of this software and associated documentation files (the
|
||||
* "Software"), to deal in the Software without restriction, including
|
||||
@@ -423,7 +425,7 @@ void LifeMeterBar::FillForHowToPlay( int NumW2s, int NumMisses )
|
||||
* copyright notice(s) and this permission notice appear in all copies of
|
||||
* the Software and that both the above copyright notice(s) and this
|
||||
* permission notice appear in supporting documentation.
|
||||
*
|
||||
*
|
||||
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
|
||||
* OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
||||
* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT OF
|
||||
|
||||
@@ -12,6 +12,8 @@
|
||||
#include "PlayerState.h"
|
||||
#include "MessageManager.h"
|
||||
|
||||
#include <cstddef>
|
||||
|
||||
const float FULL_LIFE_SECONDS = 1.5f*60;
|
||||
|
||||
static ThemeMetric<float> METER_WIDTH ("LifeMeterTime","MeterWidth");
|
||||
@@ -37,7 +39,7 @@ static const float g_fTimeMeterSecondsChangeInit[] =
|
||||
};
|
||||
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 );
|
||||
defaultValueOut = g_fTimeMeterSecondsChangeInit[i];
|
||||
@@ -230,7 +232,7 @@ void LifeMeterTime::Update( float fDeltaTime )
|
||||
float fSecs = GetLifeSeconds();
|
||||
fSecs = std::max( 0.0f, fSecs );
|
||||
m_pPlayerStageStats->m_fLifeRemainingSeconds = fSecs;
|
||||
|
||||
|
||||
LifeMeter::Update( fDeltaTime );
|
||||
|
||||
m_pStream->SetPercent( GetLife() );
|
||||
@@ -259,7 +261,7 @@ float LifeMeterTime::GetLifeSeconds() const
|
||||
/*
|
||||
* (c) 2001-2004 Chris Danford
|
||||
* All rights reserved.
|
||||
*
|
||||
*
|
||||
* Permission is hereby granted, free of charge, to any person obtaining a
|
||||
* copy of this software and associated documentation files (the
|
||||
* "Software"), to deal in the Software without restriction, including
|
||||
@@ -269,7 +271,7 @@ float LifeMeterTime::GetLifeSeconds() const
|
||||
* copyright notice(s) and this permission notice appear in all copies of
|
||||
* the Software and that both the above copyright notice(s) and this
|
||||
* permission notice appear in supporting documentation.
|
||||
*
|
||||
*
|
||||
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
|
||||
* OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
||||
* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT OF
|
||||
|
||||
@@ -15,6 +15,7 @@
|
||||
#include "Style.h"
|
||||
|
||||
#include <cmath>
|
||||
#include <cstddef>
|
||||
|
||||
const RString DEFAULT_LIGHTS_DRIVER = "SystemMessage,Export";
|
||||
static Preference<RString> g_sLightsDriver( "LightsDriver", "" ); // "" == DEFAULT_LIGHTS_DRIVER
|
||||
@@ -84,7 +85,7 @@ static void GetUsedGameInputs( std::vector<GameInput> &vGameInputsOut )
|
||||
{
|
||||
std::vector<GameInput> 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())
|
||||
{
|
||||
|
||||
+4
-3
@@ -13,11 +13,12 @@
|
||||
#include "MessageManager.h"
|
||||
#include "ver.h"
|
||||
|
||||
#include <sstream> // conversion for lua functions.
|
||||
#include <csetjmp>
|
||||
#include <cassert>
|
||||
#include <cmath>
|
||||
#include <csetjmp>
|
||||
#include <cstddef>
|
||||
#include <map>
|
||||
#include <sstream> // conversion for lua functions.
|
||||
|
||||
LuaManager *LUA = nullptr;
|
||||
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<RString>( Lua *L, RString &Object, int iOffset )
|
||||
{
|
||||
size_t iLen;
|
||||
std::size_t iLen;
|
||||
const char *pStr = lua_tolstring( L, iOffset, &iLen );
|
||||
if( pStr != nullptr )
|
||||
Object.assign( pStr, iLen );
|
||||
|
||||
+17
-15
@@ -12,27 +12,29 @@
|
||||
#include "arch/MemoryCard/MemoryCardDriver_Null.h"
|
||||
#include "LuaManager.h"
|
||||
|
||||
#include <cstddef>
|
||||
|
||||
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) );
|
||||
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) );
|
||||
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) );
|
||||
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) );
|
||||
defaultValueOut = -1;
|
||||
@@ -72,7 +74,7 @@ public:
|
||||
ThreadedMemoryCardWorker();
|
||||
~ThreadedMemoryCardWorker();
|
||||
|
||||
enum MountThreadState
|
||||
enum MountThreadState
|
||||
{
|
||||
detect_and_mount,
|
||||
detect_and_dont_mount,
|
||||
@@ -275,7 +277,7 @@ MemoryCardManager::MemoryCardManager()
|
||||
m_bMounted[p] = false;
|
||||
m_State[p] = MemoryCardState_NoCard;
|
||||
}
|
||||
|
||||
|
||||
/* These can play at any time. Preload them, so we don't cause a skip in gameplay. */
|
||||
m_soundReady.Load( THEME->GetPathS("MemoryCardManager","ready"), true );
|
||||
m_soundError.Load( THEME->GetPathS("MemoryCardManager","error"), true );
|
||||
@@ -310,7 +312,7 @@ MemoryCardManager::~MemoryCardManager()
|
||||
void MemoryCardManager::Update()
|
||||
{
|
||||
std::vector<UsbStorageDevice> vOld;
|
||||
|
||||
|
||||
vOld = m_vStorageDevices; // copy
|
||||
if( !g_pWorker->StorageDevicesChanged( m_vStorageDevices ) )
|
||||
return;
|
||||
@@ -371,27 +373,27 @@ void MemoryCardManager::UpdateAssignments()
|
||||
}
|
||||
|
||||
LOG->Trace( "Looking for a card for Player %d", p+1 );
|
||||
|
||||
|
||||
for (std::vector<UsbStorageDevice>::iterator d = vUnassignedDevices.begin(); d != vUnassignedDevices.end(); ++d)
|
||||
{
|
||||
// search for card dir match
|
||||
if( !m_sMemoryCardOsMountPoint[p].Get().empty() &&
|
||||
d->sOsMountDir.CompareNoCase(m_sMemoryCardOsMountPoint[p].Get()) )
|
||||
continue; // not a match
|
||||
|
||||
|
||||
// search for USB bus match
|
||||
if( m_iMemoryCardUsbBus[p] != -1 &&
|
||||
m_iMemoryCardUsbBus[p] != d->iBus )
|
||||
continue; // not a match
|
||||
|
||||
|
||||
if( m_iMemoryCardUsbPort[p] != -1 &&
|
||||
m_iMemoryCardUsbPort[p] != d->iPort )
|
||||
continue; // not a match
|
||||
|
||||
|
||||
if( m_iMemoryCardUsbLevel[p] != -1 &&
|
||||
m_iMemoryCardUsbLevel[p] != d->iLevel )
|
||||
continue;// not a match
|
||||
|
||||
|
||||
LOG->Trace( "Player %i: matched %s", p+1, d->sDevice.c_str() );
|
||||
|
||||
assigned_device = *d; // save a copy
|
||||
@@ -714,7 +716,7 @@ void MemoryCardManager::UnPauseMountingThread()
|
||||
// lua start
|
||||
#include "LuaBinding.h"
|
||||
|
||||
/** @brief Allow Lua to have access to the MemoryCardManager. */
|
||||
/** @brief Allow Lua to have access to the MemoryCardManager. */
|
||||
class LunaMemoryCardManager: public Luna<MemoryCardManager>
|
||||
{
|
||||
public:
|
||||
@@ -745,7 +747,7 @@ LUA_REGISTER_CLASS( MemoryCardManager )
|
||||
/*
|
||||
* (c) 2003-2005 Chris Danford, Glenn Maynard
|
||||
* All rights reserved.
|
||||
*
|
||||
*
|
||||
* Permission is hereby granted, free of charge, to any person obtaining a
|
||||
* copy of this software and associated documentation files (the
|
||||
* "Software"), to deal in the Software without restriction, including
|
||||
@@ -755,7 +757,7 @@ LUA_REGISTER_CLASS( MemoryCardManager )
|
||||
* copyright notice(s) and this permission notice appear in all copies of
|
||||
* the Software and that both the above copyright notice(s) and this
|
||||
* permission notice appear in supporting documentation.
|
||||
*
|
||||
*
|
||||
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
|
||||
* OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
||||
* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT OF
|
||||
|
||||
+2
-1
@@ -10,8 +10,9 @@
|
||||
#include "ActorUtil.h"
|
||||
|
||||
#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;
|
||||
|
||||
|
||||
+7
-5
@@ -9,7 +9,9 @@
|
||||
#include "ThemeMetric.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
|
||||
{
|
||||
@@ -17,8 +19,8 @@ public:
|
||||
MenuTimer();
|
||||
virtual ~MenuTimer();
|
||||
void Load( RString sMetricsGroup );
|
||||
|
||||
virtual void Update( float fDeltaTime );
|
||||
|
||||
virtual void Update( float fDeltaTime );
|
||||
|
||||
void SetSeconds( float fSeconds );
|
||||
float GetSeconds() const { return m_fSecondsLeft; }
|
||||
@@ -65,7 +67,7 @@ protected:
|
||||
/*
|
||||
* (c) 2002-2004 Chris Danford
|
||||
* All rights reserved.
|
||||
*
|
||||
*
|
||||
* Permission is hereby granted, free of charge, to any person obtaining a
|
||||
* copy of this software and associated documentation files (the
|
||||
* "Software"), to deal in the Software without restriction, including
|
||||
@@ -75,7 +77,7 @@ protected:
|
||||
* copyright notice(s) and this permission notice appear in all copies of
|
||||
* the Software and that both the above copyright notice(s) and this
|
||||
* permission notice appear in supporting documentation.
|
||||
*
|
||||
*
|
||||
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
|
||||
* OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
||||
* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT OF
|
||||
|
||||
+13
-11
@@ -13,6 +13,8 @@
|
||||
#include "LuaBinding.h"
|
||||
#include "PrefsManager.h"
|
||||
|
||||
#include <cstddef>
|
||||
|
||||
REGISTER_ACTOR_CLASS( Model );
|
||||
|
||||
static const float FRAMES_PER_SECOND = 30;
|
||||
@@ -297,13 +299,13 @@ void Model::DrawCelShaded()
|
||||
DISPLAY->SetCullMode(CULL_FRONT);
|
||||
this->SetZWrite(false); // XXX: Why on earth isn't the culling working? -Colby
|
||||
this->Draw();
|
||||
|
||||
|
||||
// Second pass: cel shading
|
||||
DISPLAY->SetCelShaded(2);
|
||||
DISPLAY->SetCullMode(CULL_BACK);
|
||||
this->SetZWrite(true);
|
||||
this->Draw();
|
||||
|
||||
|
||||
DISPLAY->SetCelShaded(0);
|
||||
}
|
||||
|
||||
@@ -570,8 +572,8 @@ void Model::SetPosition( float fSeconds )
|
||||
|
||||
void Model::AdvanceFrame( float fDeltaTime )
|
||||
{
|
||||
if( m_pGeometry == nullptr ||
|
||||
m_pGeometry->m_Meshes.empty() ||
|
||||
if( m_pGeometry == nullptr ||
|
||||
m_pGeometry->m_Meshes.empty() ||
|
||||
!m_pCurAnimation )
|
||||
{
|
||||
return; // bail early
|
||||
@@ -600,7 +602,7 @@ void Model::AdvanceFrame( float fDeltaTime )
|
||||
|
||||
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];
|
||||
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
|
||||
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];
|
||||
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
|
||||
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];
|
||||
if( pRotationKey->fTime >= fFrame )
|
||||
@@ -744,7 +746,7 @@ void Model::SetState( int iNewState )
|
||||
}
|
||||
}
|
||||
|
||||
void Model::RecalcAnimationLengthSeconds()
|
||||
void Model::RecalcAnimationLengthSeconds()
|
||||
{
|
||||
m_animation_length_seconds= 0;
|
||||
for (msMaterial const &m : m_Materials)
|
||||
@@ -771,7 +773,7 @@ bool Model::MaterialsNeedNormals() const
|
||||
// lua start
|
||||
#include "LuaBinding.h"
|
||||
|
||||
/** @brief Allow Lua to have access to the Model. */
|
||||
/** @brief Allow Lua to have access to the Model. */
|
||||
class LunaModel: public Luna<Model>
|
||||
{
|
||||
public:
|
||||
@@ -805,7 +807,7 @@ LUA_REGISTER_DERIVED_CLASS( Model, Actor )
|
||||
/*
|
||||
* (c) 2003-2004 Chris Danford
|
||||
* All rights reserved.
|
||||
*
|
||||
*
|
||||
* Permission is hereby granted, free of charge, to any person obtaining a
|
||||
* copy of this software and associated documentation files (the
|
||||
* "Software"), to deal in the Software without restriction, including
|
||||
@@ -815,7 +817,7 @@ LUA_REGISTER_DERIVED_CLASS( Model, Actor )
|
||||
* copyright notice(s) and this permission notice appear in all copies of
|
||||
* the Software and that both the above copyright notice(s) and this
|
||||
* permission notice appear in supporting documentation.
|
||||
*
|
||||
*
|
||||
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
|
||||
* OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
||||
* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT OF
|
||||
|
||||
+5
-3
@@ -4,6 +4,8 @@
|
||||
#include "EnumHelper.h"
|
||||
#include "RageTimer.h"
|
||||
|
||||
#include <cstddef>
|
||||
|
||||
enum ModsLevel
|
||||
{
|
||||
ModsLevel_Preferred, // user-chosen player options. Does not include any forced mods.
|
||||
@@ -56,7 +58,7 @@ public:
|
||||
}
|
||||
|
||||
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 );
|
||||
if( level != ModsLevel_Song )
|
||||
@@ -111,7 +113,7 @@ public:
|
||||
/*
|
||||
* (c) 2006 Chris Danford, Steve Checkoway
|
||||
* All rights reserved.
|
||||
*
|
||||
*
|
||||
* Permission is hereby granted, free of charge, to any person obtaining a
|
||||
* copy of this software and associated documentation files (the
|
||||
* "Software"), to deal in the Software without restriction, including
|
||||
@@ -121,7 +123,7 @@ public:
|
||||
* copyright notice(s) and this permission notice appear in all copies of
|
||||
* the Software and that both the above copyright notice(s) and this
|
||||
* permission notice appear in supporting documentation.
|
||||
*
|
||||
*
|
||||
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
|
||||
* OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
||||
* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT OF
|
||||
|
||||
+3
-2
@@ -24,6 +24,7 @@
|
||||
#include "LocalizedString.h"
|
||||
|
||||
#include <cmath>
|
||||
#include <cstddef>
|
||||
|
||||
static Preference<bool> g_bMoveRandomToEnd( "MoveRandomToEnd", 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 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 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()); }
|
||||
@@ -443,7 +444,7 @@ void MusicWheel::GetSongList( std::vector<Song*> &arraySongs, SortOrder so )
|
||||
if(GAMESTATE->IsPlayerEnabled(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]);
|
||||
}
|
||||
|
||||
@@ -17,6 +17,7 @@
|
||||
|
||||
#include <algorithm>
|
||||
#include <climits>
|
||||
#include <cstddef>
|
||||
#include <memory>
|
||||
#include <sstream>
|
||||
#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
|
||||
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))
|
||||
return true;
|
||||
}
|
||||
@@ -339,7 +340,7 @@ int WebSocketHandle::Send(lua_State *L)
|
||||
void *udata = luaL_checkudata(L, 1, "WebSocketHandle");
|
||||
auto handle = *static_cast<WebSocketHandlePtr*>(udata);
|
||||
|
||||
size_t len;
|
||||
std::size_t len;
|
||||
const char *s = luaL_checklstring(L, 2, &len);
|
||||
std::string data(s, len);
|
||||
|
||||
@@ -452,7 +453,7 @@ public:
|
||||
{
|
||||
if (lua_isstring(L, -1))
|
||||
{
|
||||
size_t len;
|
||||
std::size_t len;
|
||||
const char *s = lua_tolstring(L, -1, &len);
|
||||
args.body = std::string(s, len);
|
||||
}
|
||||
@@ -468,7 +469,7 @@ public:
|
||||
{
|
||||
if (lua_isstring(L, -1))
|
||||
{
|
||||
size_t len;
|
||||
std::size_t len;
|
||||
const char *s = lua_tolstring(L, -1, &len);
|
||||
args.multipartBoundary = std::string(s, len);
|
||||
}
|
||||
|
||||
+15
-13
@@ -12,6 +12,8 @@
|
||||
#include "GameState.h" // blame radar calculations.
|
||||
#include "RageUtil_AutoPtr.h"
|
||||
|
||||
#include <cstddef>
|
||||
|
||||
REGISTER_CLASS_TRAITS( NoteData, new NoteData(*pCopy) )
|
||||
|
||||
void NoteData::Init()
|
||||
@@ -407,7 +409,7 @@ bool NoteData::IsHoldNoteAtRow( int iTrack, int iRow, int *pHeadRow ) const
|
||||
}
|
||||
|
||||
bool NoteData::IsEmpty() const
|
||||
{
|
||||
{
|
||||
for( int t=0; t < GetNumTracks(); t++ )
|
||||
{
|
||||
int iRow = -1;
|
||||
@@ -421,7 +423,7 @@ bool NoteData::IsEmpty() const
|
||||
}
|
||||
|
||||
int NoteData::GetFirstRow() const
|
||||
{
|
||||
{
|
||||
int iEarliestRowFoundSoFar = -1;
|
||||
|
||||
for( int t=0; t < GetNumTracks(); t++ )
|
||||
@@ -443,7 +445,7 @@ int NoteData::GetFirstRow() const
|
||||
}
|
||||
|
||||
int NoteData::GetLastRow() const
|
||||
{
|
||||
{
|
||||
int iOldestRowFoundSoFar = 0;
|
||||
|
||||
for( int t=0; t < GetNumTracks(); t++ )
|
||||
@@ -702,14 +704,14 @@ int NoteData::GetNumLifts( int iStartIndex, int iEndIndex ) const
|
||||
int NoteData::GetNumFakes( int iStartIndex, int iEndIndex ) const
|
||||
{
|
||||
int iNumFakes = 0;
|
||||
|
||||
|
||||
for( int t=0; t<GetNumTracks(); t++ )
|
||||
{
|
||||
FOREACH_NONEMPTY_ROW_IN_TRACK_RANGE( *this, t, r, iStartIndex, iEndIndex )
|
||||
if( this->IsFake(GetTapNote(t, r), r))
|
||||
iNumFakes++;
|
||||
}
|
||||
|
||||
|
||||
return iNumFakes;
|
||||
}
|
||||
|
||||
@@ -922,7 +924,7 @@ void NoteData::LoadTransformed( const NoteData& in, int iNewNumTracks, const int
|
||||
for( int t=0; t<GetNumTracks(); t++ )
|
||||
{
|
||||
const int iOriginalTrack = iOriginalTrackToTakeFrom[t];
|
||||
ASSERT_M( iOriginalTrack < in.GetNumTracks(), ssprintf("from OriginalTrack %i >= %i (#tracks) (taking from %i)",
|
||||
ASSERT_M( iOriginalTrack < in.GetNumTracks(), ssprintf("from OriginalTrack %i >= %i (#tracks) (taking from %i)",
|
||||
iOriginalTrack, in.GetNumTracks(), iOriginalTrackToTakeFrom[t]));
|
||||
|
||||
if( iOriginalTrack == -1 )
|
||||
@@ -981,7 +983,7 @@ bool NoteData::GetNextTapNoteRowForTrack( int track, int &rowInOut, bool ignoreA
|
||||
{
|
||||
const TrackMap &mapTrack = m_TapNotes[track];
|
||||
|
||||
// lower_bound and upper_bound have the same effect here because duplicate
|
||||
// lower_bound and upper_bound have the same effect here because duplicate
|
||||
// keys aren't allowed.
|
||||
|
||||
// lower_bound "finds the first element whose key is not less than k" (>=);
|
||||
@@ -1016,7 +1018,7 @@ bool NoteData::GetPrevTapNoteRowForTrack( int track, int &rowInOut ) const
|
||||
return false;
|
||||
|
||||
// Move back by one.
|
||||
--iter;
|
||||
--iter;
|
||||
ASSERT( iter->first < rowInOut );
|
||||
rowInOut = iter->first;
|
||||
return true;
|
||||
@@ -1407,12 +1409,12 @@ template<typename ND, typename iter, typename TN>
|
||||
if(added)
|
||||
{
|
||||
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.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];
|
||||
m_PrevCurrentRows.insert(m_PrevCurrentRows.begin()+track_id, avg_row);
|
||||
@@ -1423,7 +1425,7 @@ template<typename ND, typename iter, typename TN>
|
||||
}
|
||||
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];
|
||||
m_PrevCurrentRows.erase(m_PrevCurrentRows.begin()+track_id);
|
||||
@@ -1496,7 +1498,7 @@ template class NoteData::_all_tracks_iterator<const NoteData, NoteData::const_it
|
||||
/*
|
||||
* (c) 2001-2004 Chris Danford, Glenn Maynard
|
||||
* All rights reserved.
|
||||
*
|
||||
*
|
||||
* Permission is hereby granted, free of charge, to any person obtaining a
|
||||
* copy of this software and associated documentation files (the
|
||||
* "Software"), to deal in the Software without restriction, including
|
||||
@@ -1506,7 +1508,7 @@ template class NoteData::_all_tracks_iterator<const NoteData, NoteData::const_it
|
||||
* copyright notice(s) and this permission notice appear in all copies of
|
||||
* the Software and that both the above copyright notice(s) and this
|
||||
* permission notice appear in supporting documentation.
|
||||
*
|
||||
*
|
||||
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
|
||||
* OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
||||
* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT OF
|
||||
|
||||
@@ -11,6 +11,7 @@
|
||||
#include "TimingData.h"
|
||||
|
||||
#include <cmath>
|
||||
#include <cstddef>
|
||||
#include <utility>
|
||||
|
||||
// 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
|
||||
// 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_goals(num_kickbox_limbs, 0);
|
||||
RandomGen rnd(nonrandom_seed);
|
||||
@@ -942,7 +943,7 @@ void NoteDataUtil::AutogenKickbox(const NoteData& in, NoteData& out, const Timin
|
||||
default:
|
||||
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])
|
||||
{
|
||||
// Use a different panel.
|
||||
@@ -1024,7 +1025,7 @@ void NoteDataUtil::CalculateRadarValues( const NoteData &in, float fSongSeconds,
|
||||
float total_taps= 0;
|
||||
const float voltage_window_beats= 8.0f;
|
||||
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;
|
||||
crv_state state;
|
||||
|
||||
@@ -1037,7 +1038,7 @@ void NoteDataUtil::CalculateRadarValues( const NoteData &in, float fSongSeconds,
|
||||
state.num_notes_on_curr_row= 0;
|
||||
state.num_holds_on_curr_row= 0;
|
||||
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)
|
||||
{
|
||||
@@ -1045,7 +1046,7 @@ void NoteDataUtil::CalculateRadarValues( const NoteData &in, float fSongSeconds,
|
||||
--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)
|
||||
{
|
||||
@@ -1976,7 +1977,7 @@ static void HyperShuffleNotes( NoteData &inout, int iStartIndex, int iEndIndex)
|
||||
std::shuffle(viTargetTracks.begin(), viTargetTracks.end(), g_RandomNumberGenerator);
|
||||
|
||||
// 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 TapNote current_tn = vtnTargetTaps[i];
|
||||
|
||||
@@ -9,6 +9,8 @@
|
||||
#include "RageLog.h"
|
||||
#include "TimingData.h"
|
||||
|
||||
#include <cstddef>
|
||||
|
||||
namespace
|
||||
{
|
||||
|
||||
@@ -29,13 +31,13 @@ int LastTapNoteScoreTrack( const NoteData &in, unsigned iRow, PlayerNumber pn )
|
||||
if (tn.type == TapNoteType_Empty ||
|
||||
tn.type == TapNoteType_Mine ||
|
||||
tn.type == TapNoteType_Fake ||
|
||||
tn.type == TapNoteType_AutoKeysound)
|
||||
tn.type == TapNoteType_AutoKeysound)
|
||||
continue;
|
||||
if( tn.pn != PLAYER_INVALID && tn.pn != pn && pn != PLAYER_INVALID )
|
||||
continue;
|
||||
|
||||
TapNoteScore tns = tn.result.tns;
|
||||
|
||||
|
||||
if( tns == TNS_Miss || tns == TNS_None )
|
||||
return t;
|
||||
|
||||
@@ -66,7 +68,7 @@ int MinTapNoteScoreTrack( const NoteData &in, unsigned iRow, PlayerNumber pn )
|
||||
if (tn.type == TapNoteType_Empty ||
|
||||
tn.type == TapNoteType_Mine ||
|
||||
tn.type == TapNoteType_Fake ||
|
||||
tn.type == TapNoteType_AutoKeysound)
|
||||
tn.type == TapNoteType_AutoKeysound)
|
||||
continue;
|
||||
if( tn.pn != PLAYER_INVALID && tn.pn != pn && pn != PLAYER_INVALID )
|
||||
continue;
|
||||
@@ -249,8 +251,8 @@ static void DoRowEndRadarActualCalc(garv_state& state, RadarValues& out)
|
||||
{
|
||||
if(state.worst_tns_on_row >= state.hands_tns)
|
||||
{
|
||||
size_t holds_down= 0;
|
||||
for(size_t n= 0; n < state.hold_ends.size(); ++n)
|
||||
std::size_t holds_down= 0;
|
||||
for(std::size_t n= 0; n < state.hold_ends.size(); ++n)
|
||||
{
|
||||
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_holds_on_curr_row= 0;
|
||||
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)
|
||||
{
|
||||
@@ -390,7 +392,7 @@ void NoteDataWithScoring::GetActualRadarValues(const NoteData &in,
|
||||
float hittable_steps_length= std::max(0.0f,
|
||||
timing->GetElapsedTimeFromBeat(NoteRowToBeat(last_hittable_row)) -
|
||||
timing->GetElapsedTimeFromBeat(NoteRowToBeat(first_hittable_row)));
|
||||
// The for loop and the assert are used to ensure that all fields of
|
||||
// The for loop and the assert are used to ensure that all fields of
|
||||
// RadarValue get set in here.
|
||||
FOREACH_ENUM(RadarCategory, rc)
|
||||
{
|
||||
@@ -446,7 +448,7 @@ void NoteDataWithScoring::GetActualRadarValues(const NoteData &in,
|
||||
/*
|
||||
* (c) 2001-2004 Chris Danford, Glenn Maynard
|
||||
* All rights reserved.
|
||||
*
|
||||
*
|
||||
* Permission is hereby granted, free of charge, to any person obtaining a
|
||||
* copy of this software and associated documentation files (the
|
||||
* "Software"), to deal in the Software without restriction, including
|
||||
@@ -456,7 +458,7 @@ void NoteDataWithScoring::GetActualRadarValues(const NoteData &in,
|
||||
* copyright notice(s) and this permission notice appear in all copies of
|
||||
* the Software and that both the above copyright notice(s) and this
|
||||
* permission notice appear in supporting documentation.
|
||||
*
|
||||
*
|
||||
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
|
||||
* OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
||||
* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT OF
|
||||
|
||||
+7
-6
@@ -22,6 +22,7 @@
|
||||
|
||||
#include <cfloat>
|
||||
#include <cmath>
|
||||
#include <cstddef>
|
||||
|
||||
float FindFirstDisplayedBeat( const PlayerState* pPlayerState, int iDrawDistanceAfterTargetsPixels );
|
||||
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> 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 );
|
||||
|
||||
NoteField::NoteField()
|
||||
@@ -289,7 +290,7 @@ void NoteField::InitColumnRenderers()
|
||||
m_FieldRenderArgs.ghost_row= &(m_pCurDisplay->m_GhostArrowRow);
|
||||
m_FieldRenderArgs.note_data= m_pNoteData;
|
||||
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)
|
||||
{
|
||||
@@ -314,7 +315,7 @@ void NoteField::Update( float fDeltaTime )
|
||||
ActorFrame::Update( fDeltaTime );
|
||||
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);
|
||||
}
|
||||
@@ -801,7 +802,7 @@ void NoteField::DrawPrimitives()
|
||||
{
|
||||
const std::vector<TimingSegment *> &tSigs = *segs[SEGMENT_TIME_SIG];
|
||||
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]);
|
||||
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) \
|
||||
horiz_align= caps_name##_IS_LEFT_SIDE ? align_right : align_left; \
|
||||
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]); \
|
||||
if(seg->GetRow() >= m_FieldRenderArgs.first_row && \
|
||||
@@ -1256,7 +1257,7 @@ public:
|
||||
static int get_column_actors(T* p, lua_State* L)
|
||||
{
|
||||
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);
|
||||
lua_rawseti(L, -2, i+1);
|
||||
|
||||
+12
-10
@@ -13,9 +13,11 @@
|
||||
#include "ActorUtil.h"
|
||||
#include "XmlFileUtil.h"
|
||||
#include "Sprite.h"
|
||||
#include <map>
|
||||
#include "SpecialFiles.h"
|
||||
|
||||
#include <cstddef>
|
||||
#include <map>
|
||||
|
||||
/** @brief Have the NoteSkinManager available throughout the 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)
|
||||
{
|
||||
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]))
|
||||
{
|
||||
@@ -280,7 +282,7 @@ void NoteSkinManager::GetAllNoteSkinNamesForGame( const Game *pGame, std::vector
|
||||
StripCvsAndSvn( AddTo );
|
||||
StripMacResourceForks( AddTo );
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
RString NoteSkinManager::GetMetric( const RString &sButtonName, const RString &sValue )
|
||||
{
|
||||
@@ -383,8 +385,8 @@ RString NoteSkinManager::GetPath( const RString &sButtonName, const RString &sEl
|
||||
}
|
||||
|
||||
RString message = ssprintf(
|
||||
"The NoteSkin element \"%s %s\" could not be found in any of the following directories:\n%s",
|
||||
sButtonName.c_str(), sElement.c_str(),
|
||||
"The NoteSkin element \"%s %s\" could not be found in any of the following directories:\n%s",
|
||||
sButtonName.c_str(), sElement.c_str(),
|
||||
sPaths.c_str() );
|
||||
|
||||
switch(LuaHelpers::ReportScriptError(message, "NOTESKIN_ERROR", true))
|
||||
@@ -446,7 +448,7 @@ RString NoteSkinManager::GetPath( const RString &sButtonName, const RString &sEl
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
sPath = sRealPath;
|
||||
}
|
||||
|
||||
@@ -535,14 +537,14 @@ RString NoteSkinManager::GetPathFromDirAndFile( const RString &sDir, const RStri
|
||||
sError+= join(", ", matches);
|
||||
LuaHelpers::ReportScriptError(sError, "NOTESKIN_ERROR");
|
||||
}
|
||||
|
||||
|
||||
return matches[0];
|
||||
}
|
||||
|
||||
// lua start
|
||||
#include "LuaBinding.h"
|
||||
|
||||
/** @brief Allow Lua to have access to the NoteSkinManager. */
|
||||
/** @brief Allow Lua to have access to the NoteSkinManager. */
|
||||
class LunaNoteSkinManager: public Luna<NoteSkinManager>
|
||||
{
|
||||
public:
|
||||
@@ -629,7 +631,7 @@ LUA_REGISTER_CLASS( NoteSkinManager )
|
||||
/*
|
||||
* (c) 2003-2004 Chris Danford
|
||||
* All rights reserved.
|
||||
*
|
||||
*
|
||||
* Permission is hereby granted, free of charge, to any person obtaining a
|
||||
* copy of this software and associated documentation files (the
|
||||
* "Software"), to deal in the Software without restriction, including
|
||||
@@ -639,7 +641,7 @@ LUA_REGISTER_CLASS( NoteSkinManager )
|
||||
* copyright notice(s) and this permission notice appear in all copies of
|
||||
* the Software and that both the above copyright notice(s) and this
|
||||
* permission notice appear in supporting documentation.
|
||||
*
|
||||
*
|
||||
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
|
||||
* OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
||||
* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT OF
|
||||
|
||||
+7
-5
@@ -8,21 +8,23 @@
|
||||
#include "NotesLoaderKSF.h"
|
||||
#include "RageUtil.h"
|
||||
|
||||
#include <cstddef>
|
||||
|
||||
void NotesLoader::GetMainAndSubTitlesFromFullTitle( const RString &sFullTitle, RString &sMainTitleOut, RString &sSubTitleOut )
|
||||
{
|
||||
const RString sLeftSeps[] = { "\t", " -", " ~", " (", " [" };
|
||||
|
||||
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 )
|
||||
continue;
|
||||
sMainTitleOut = sFullTitle.Left( (int) iBeginIndex );
|
||||
sSubTitleOut = sFullTitle.substr( iBeginIndex+1, sFullTitle.size()-iBeginIndex+1 );
|
||||
return;
|
||||
}
|
||||
sMainTitleOut = sFullTitle;
|
||||
sSubTitleOut = "";
|
||||
sMainTitleOut = sFullTitle;
|
||||
sSubTitleOut = "";
|
||||
};
|
||||
|
||||
bool NotesLoader::LoadFromDir( const RString &sPath, Song &out, std::set<RString> &BlacklistedImages, bool load_autosave )
|
||||
@@ -67,7 +69,7 @@ bool NotesLoader::LoadFromDir( const RString &sPath, Song &out, std::set<RString
|
||||
/*
|
||||
* (c) 2001-2004,2007 Chris Danford, Glenn Maynard, Steve Checkoway
|
||||
* All rights reserved.
|
||||
*
|
||||
*
|
||||
* Permission is hereby granted, free of charge, to any person obtaining a
|
||||
* copy of this software and associated documentation files (the
|
||||
* "Software"), to deal in the Software without restriction, including
|
||||
@@ -77,7 +79,7 @@ bool NotesLoader::LoadFromDir( const RString &sPath, Song &out, std::set<RString
|
||||
* copyright notice(s) and this permission notice appear in all copies of
|
||||
* the Software and that both the above copyright notice(s) and this
|
||||
* permission notice appear in supporting documentation.
|
||||
*
|
||||
*
|
||||
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
|
||||
* OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
||||
* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT OF
|
||||
|
||||
@@ -18,6 +18,8 @@
|
||||
#include "ActorUtil.h"
|
||||
#include "RageFileManager.h"
|
||||
|
||||
#include <cstddef>
|
||||
|
||||
/* BMS encoding: tap-hold
|
||||
* 4&8panel: Player1 Player2
|
||||
* Left 11-51 21-61
|
||||
@@ -408,14 +410,14 @@ struct bmsCommandTree
|
||||
return;
|
||||
|
||||
// LTrim the statement to allow indentation
|
||||
size_t hash = statement.find('#');
|
||||
std::size_t hash = statement.find('#');
|
||||
|
||||
if (hash == RString::npos)
|
||||
return;
|
||||
|
||||
statement = statement.substr(hash);
|
||||
|
||||
size_t space = statement.find(' ');
|
||||
std::size_t space = statement.find(' ');
|
||||
RString name = statement.substr(0, space);
|
||||
RString value = "";
|
||||
|
||||
@@ -649,7 +651,7 @@ int BMSSong::AllocateKeysound( RString filename, RString path )
|
||||
if( !IsAFile(dir + normalizedFilename) )
|
||||
{
|
||||
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] );
|
||||
if( IsAFile(dir + fn) )
|
||||
@@ -716,7 +718,7 @@ bool BMSSong::GetBackground( RString filename, RString path, RString &bgfile )
|
||||
std::vector<RString> exts;
|
||||
ActorUtil::AddTypeExtensionsToList(FT_Movie, 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] );
|
||||
if( IsAFile(dir + fn) )
|
||||
|
||||
+49
-48
@@ -12,6 +12,7 @@
|
||||
#include "PrefsManager.h"
|
||||
#include "Difficulty.h"
|
||||
|
||||
#include <cstddef>
|
||||
#include <map>
|
||||
|
||||
Difficulty DwiCompatibleStringToDifficulty( const RString& sDC );
|
||||
@@ -71,7 +72,7 @@ static void DWIcharToNote( char c, GameController i, int ¬e1Out, int ¬e2Ou
|
||||
case 'K': note1Out = DANCE_NOTE_PAD1_UP; note2Out = DANCE_NOTE_PAD1_UPRIGHT; break;
|
||||
case 'L': note1Out = DANCE_NOTE_PAD1_UPRIGHT; note2Out = DANCE_NOTE_PAD1_RIGHT; break;
|
||||
case 'M': note1Out = DANCE_NOTE_PAD1_UPLEFT; note2Out = DANCE_NOTE_PAD1_UPRIGHT; break;
|
||||
default:
|
||||
default:
|
||||
LOG->UserLog( "Song file", sPath, "has an invalid DWI note character '%c'.", c );
|
||||
note1Out = DANCE_NOTE_NONE; note2Out = DANCE_NOTE_NONE; break;
|
||||
}
|
||||
@@ -122,12 +123,12 @@ static void DWIcharToNoteCol( char c, GameController i, int &col1Out, int &col2O
|
||||
* point, <...> was changed to indicate jumps, and `' was used for
|
||||
* 1/192nds. So, we have to do a check to figure out what it really
|
||||
* means. If it contains 0s, it's most likely 192nds; otherwise,
|
||||
* it's most likely a jump. Search for a 0 before the next >:
|
||||
* it's most likely a jump. Search for a 0 before the next >:
|
||||
* @param sStepData the step data.
|
||||
* @param pos the position of the step data.
|
||||
* @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() )
|
||||
{
|
||||
@@ -137,7 +138,7 @@ static bool Is192( const RString &sStepData, size_t pos )
|
||||
return true;
|
||||
++pos;
|
||||
}
|
||||
|
||||
|
||||
return false;
|
||||
}
|
||||
/** @brief All DWI files use 4 beats per measure. */
|
||||
@@ -217,10 +218,10 @@ static NoteData ParseNoteData(RString &step1, RString &step2,
|
||||
break;
|
||||
DEFAULT_FAIL( out.m_StepsType );
|
||||
}
|
||||
|
||||
|
||||
NoteData newNoteData;
|
||||
newNoteData.SetNumTracks( g_mapDanceNoteToNoteDataColumn.size() );
|
||||
|
||||
|
||||
for( int pad=0; pad<2; pad++ ) // foreach pad
|
||||
{
|
||||
RString sStepData;
|
||||
@@ -236,16 +237,16 @@ static NoteData ParseNoteData(RString &step1, RString &step2,
|
||||
break;
|
||||
DEFAULT_FAIL( pad );
|
||||
}
|
||||
|
||||
|
||||
sStepData.Replace("\n", "");
|
||||
sStepData.Replace("\r", "");
|
||||
sStepData.Replace("\t", "");
|
||||
sStepData.Replace(" ", "");
|
||||
|
||||
|
||||
double fCurrentBeat = 0;
|
||||
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++];
|
||||
switch( c )
|
||||
@@ -263,7 +264,7 @@ static NoteData ParseNoteData(RString &step1, RString &step2,
|
||||
case '`':
|
||||
fCurrentIncrementer = 1.0/192 * BEATS_PER_MEASURE;
|
||||
break;
|
||||
|
||||
|
||||
// ends a series
|
||||
case ')':
|
||||
case ']':
|
||||
@@ -272,7 +273,7 @@ static NoteData ParseNoteData(RString &step1, RString &step2,
|
||||
case '>':
|
||||
fCurrentIncrementer = 1.0/8 * BEATS_PER_MEASURE;
|
||||
break;
|
||||
|
||||
|
||||
default: // this is a note character
|
||||
{
|
||||
if( c == '!' )
|
||||
@@ -283,7 +284,7 @@ static NoteData ParseNoteData(RString &step1, RString &step2,
|
||||
"has an unexpected character: '!'." );
|
||||
continue;
|
||||
}
|
||||
|
||||
|
||||
bool jump = false;
|
||||
if( c == '<' )
|
||||
{
|
||||
@@ -293,21 +294,21 @@ static NoteData ParseNoteData(RString &step1, RString &step2,
|
||||
fCurrentIncrementer = 1.0/192 * BEATS_PER_MEASURE;
|
||||
break;
|
||||
}
|
||||
|
||||
|
||||
/* It's a jump.
|
||||
* We need to keep reading notes until we hit a >. */
|
||||
jump = true;
|
||||
i++;
|
||||
}
|
||||
|
||||
|
||||
const int iIndex = BeatToNoteRow( (float)fCurrentBeat );
|
||||
i--;
|
||||
do {
|
||||
c = sStepData[i++];
|
||||
|
||||
|
||||
if( jump && c == '>' )
|
||||
break;
|
||||
|
||||
|
||||
int iCol1, iCol2;
|
||||
DWIcharToNoteCol(
|
||||
c,
|
||||
@@ -315,7 +316,7 @@ static NoteData ParseNoteData(RString &step1, RString &step2,
|
||||
iCol1,
|
||||
iCol2,
|
||||
path );
|
||||
|
||||
|
||||
if( iCol1 != -1 )
|
||||
newNoteData.SetTapNote(iCol1,
|
||||
iIndex,
|
||||
@@ -324,25 +325,25 @@ static NoteData ParseNoteData(RString &step1, RString &step2,
|
||||
newNoteData.SetTapNote(iCol2,
|
||||
iIndex,
|
||||
TAP_ORIGINAL_TAP);
|
||||
|
||||
|
||||
if(i>=sStepData.length())
|
||||
{
|
||||
break;
|
||||
//we ran out of data
|
||||
//while looking for the ending > mark
|
||||
}
|
||||
|
||||
|
||||
if( sStepData[i] == '!' )
|
||||
{
|
||||
i++;
|
||||
const char holdChar = sStepData[i++];
|
||||
|
||||
|
||||
DWIcharToNoteCol(holdChar,
|
||||
(GameController)pad,
|
||||
iCol1,
|
||||
iCol2,
|
||||
path );
|
||||
|
||||
|
||||
if( iCol1 != -1 )
|
||||
newNoteData.SetTapNote(iCol1,
|
||||
iIndex,
|
||||
@@ -360,7 +361,7 @@ static NoteData ParseNoteData(RString &step1, RString &step2,
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/* Fill in iDuration. */
|
||||
for( int t=0; t<newNoteData.GetNumTracks(); ++t )
|
||||
{
|
||||
@@ -369,7 +370,7 @@ static NoteData ParseNoteData(RString &step1, RString &step2,
|
||||
TapNote tn = newNoteData.GetTapNote( t, iHeadRow );
|
||||
if( tn.type != TapNoteType_HoldHead )
|
||||
continue;
|
||||
|
||||
|
||||
int iTailRow = iHeadRow;
|
||||
bool bFound = false;
|
||||
while( !bFound && newNoteData.GetNextTapNoteRowForTrack(t, iTailRow) )
|
||||
@@ -383,21 +384,21 @@ static NoteData ParseNoteData(RString &step1, RString &step2,
|
||||
newNoteData.SetTapNote( t, iHeadRow, tn );
|
||||
bFound = true;
|
||||
}
|
||||
|
||||
|
||||
if( !bFound )
|
||||
{
|
||||
/* The hold was never closed. */
|
||||
LOG->UserLog("Song file",
|
||||
path,
|
||||
"failed to close a hold note in \"%s\" on track %i",
|
||||
"failed to close a hold note in \"%s\" on track %i",
|
||||
DifficultyToString(out.GetDifficulty()).c_str(),
|
||||
t);
|
||||
|
||||
|
||||
newNoteData.SetTapNote( t, iHeadRow, TAP_EMPTY );
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
ASSERT( newNoteData.GetNumTracks() > 0 );
|
||||
return newNoteData;
|
||||
}
|
||||
@@ -413,11 +414,11 @@ static NoteData ParseNoteData(RString &step1, RString &step2,
|
||||
* @param sPath the path to the file.
|
||||
* @return the success or failure of the operation.
|
||||
*/
|
||||
static bool LoadFromDWITokens(
|
||||
RString sMode,
|
||||
static bool LoadFromDWITokens(
|
||||
RString sMode,
|
||||
RString sDescription,
|
||||
RString sNumFeet,
|
||||
RString sStepData1,
|
||||
RString sStepData1,
|
||||
RString sStepData2,
|
||||
Steps &out,
|
||||
const RString &sPath )
|
||||
@@ -492,16 +493,16 @@ bool DWILoader::LoadNoteDataFromSimfile( const RString &path, Steps &out )
|
||||
msd.GetError().c_str() );
|
||||
return false;
|
||||
}
|
||||
|
||||
|
||||
for( unsigned i=0; i<msd.GetNumValues(); i++ )
|
||||
{
|
||||
int iNumParams = msd.GetNumParams(i);
|
||||
const MsdFile::value_t ¶ms = msd.GetValue(i);
|
||||
RString valueName = params[0];
|
||||
|
||||
if(valueName.EqualsNoCase("SINGLE") ||
|
||||
|
||||
if(valueName.EqualsNoCase("SINGLE") ||
|
||||
valueName.EqualsNoCase("DOUBLE") ||
|
||||
valueName.EqualsNoCase("COUPLE") ||
|
||||
valueName.EqualsNoCase("COUPLE") ||
|
||||
valueName.EqualsNoCase("SOLO") )
|
||||
{
|
||||
if (out.m_StepsType != GetTypeFromMode(valueName))
|
||||
@@ -576,7 +577,7 @@ bool DWILoader::LoadFromDir( const RString &sPath_, Song &out, std::set<RString>
|
||||
out.m_sArtist = sParams[1];
|
||||
ConvertString( out.m_sArtist, "utf-8,english" );
|
||||
}
|
||||
|
||||
|
||||
else if( sValueName.EqualsNoCase("GENRE") )
|
||||
{
|
||||
out.m_sGenre = sParams[1];
|
||||
@@ -689,17 +690,17 @@ bool DWILoader::LoadFromDir( const RString &sPath_, Song &out, std::set<RString>
|
||||
}
|
||||
}
|
||||
|
||||
else if( sValueName.EqualsNoCase("SINGLE") ||
|
||||
else if( sValueName.EqualsNoCase("SINGLE") ||
|
||||
sValueName.EqualsNoCase("DOUBLE") ||
|
||||
sValueName.EqualsNoCase("COUPLE") ||
|
||||
sValueName.EqualsNoCase("COUPLE") ||
|
||||
sValueName.EqualsNoCase("SOLO") )
|
||||
{
|
||||
Steps* pNewNotes = out.CreateSteps();
|
||||
LoadFromDWITokens(
|
||||
sParams[0],
|
||||
sParams[1],
|
||||
sParams[2],
|
||||
sParams[3],
|
||||
LoadFromDWITokens(
|
||||
sParams[0],
|
||||
sParams[1],
|
||||
sParams[2],
|
||||
sParams[3],
|
||||
(iNumParams==5) ? sParams[4] : RString(""),
|
||||
*pNewNotes,
|
||||
sPath
|
||||
@@ -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). */
|
||||
RString param = sParams[1];
|
||||
/* "{foo} ... {foo2}" */
|
||||
size_t pos = 0;
|
||||
std::size_t pos = 0;
|
||||
while( pos < RString::npos )
|
||||
{
|
||||
|
||||
size_t startpos = param.find('{', pos);
|
||||
std::size_t startpos = param.find('{', pos);
|
||||
if( startpos == RString::npos )
|
||||
break;
|
||||
size_t endpos = param.find('}', startpos);
|
||||
std::size_t endpos = param.find('}', startpos);
|
||||
if( endpos == RString::npos )
|
||||
break;
|
||||
|
||||
@@ -750,7 +751,7 @@ bool DWILoader::LoadFromDir( const RString &sPath_, Song &out, std::set<RString>
|
||||
/*
|
||||
* (c) 2001-2004 Chris Danford, Glenn Maynard
|
||||
* All rights reserved.
|
||||
*
|
||||
*
|
||||
* Permission is hereby granted, free of charge, to any person obtaining a
|
||||
* copy of this software and associated documentation files (the
|
||||
* "Software"), to deal in the Software without restriction, including
|
||||
@@ -760,7 +761,7 @@ bool DWILoader::LoadFromDir( const RString &sPath_, Song &out, std::set<RString>
|
||||
* copyright notice(s) and this permission notice appear in all copies of
|
||||
* the Software and that both the above copyright notice(s) and this
|
||||
* permission notice appear in supporting documentation.
|
||||
*
|
||||
*
|
||||
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
|
||||
* OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
||||
* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT OF
|
||||
|
||||
@@ -13,6 +13,8 @@
|
||||
#include "Attack.h"
|
||||
#include "PrefsManager.h"
|
||||
|
||||
#include <cstddef>
|
||||
|
||||
// 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
|
||||
// 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)
|
||||
RString sChanges;
|
||||
size_t start = 0;
|
||||
std::size_t start = 0;
|
||||
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)
|
||||
pos = _sChanges.size();
|
||||
|
||||
@@ -1429,7 +1431,7 @@ void SMLoader::ParseBGChangesString(const RString& _sChanges, std::vector<std::v
|
||||
// the string itself matches
|
||||
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?
|
||||
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
|
||||
|
||||
{
|
||||
size_t eqpos = sChanges.find('=', start);
|
||||
size_t compos = sChanges.find(',', start);
|
||||
std::size_t eqpos = sChanges.find('=', start);
|
||||
std::size_t compos = sChanges.find(',', start);
|
||||
|
||||
if ((eqpos == RString::npos) && (compos == RString::npos))
|
||||
{
|
||||
|
||||
+22
-20
@@ -14,6 +14,8 @@
|
||||
#include "Attack.h"
|
||||
#include "PrefsManager.h"
|
||||
|
||||
#include <cstddef>
|
||||
|
||||
// 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
|
||||
// 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
|
||||
// categories to expect, look at the number of values and split them
|
||||
// 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];
|
||||
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]);
|
||||
}
|
||||
@@ -645,7 +647,7 @@ void SSCLoader::ProcessBPMs( TimingData &out, const RString sParam )
|
||||
{
|
||||
std::vector<RString> arrayBPMExpressions;
|
||||
split( sParam, ",", arrayBPMExpressions );
|
||||
|
||||
|
||||
for( unsigned b=0; b<arrayBPMExpressions.size(); b++ )
|
||||
{
|
||||
std::vector<RString> arrayBPMValues;
|
||||
@@ -658,7 +660,7 @@ void SSCLoader::ProcessBPMs( TimingData &out, const RString sParam )
|
||||
arrayBPMExpressions[b].c_str() );
|
||||
continue;
|
||||
}
|
||||
|
||||
|
||||
const float fBeat = StringToFloat( arrayBPMValues[0] );
|
||||
const float fNewBPM = StringToFloat( arrayBPMValues[1] );
|
||||
if( fBeat >= 0 && fNewBPM > 0 )
|
||||
@@ -679,7 +681,7 @@ void SSCLoader::ProcessStops( TimingData &out, const RString sParam )
|
||||
{
|
||||
std::vector<RString> arrayStopExpressions;
|
||||
split( sParam, ",", arrayStopExpressions );
|
||||
|
||||
|
||||
for( unsigned b=0; b<arrayStopExpressions.size(); b++ )
|
||||
{
|
||||
std::vector<RString> arrayStopValues;
|
||||
@@ -692,7 +694,7 @@ void SSCLoader::ProcessStops( TimingData &out, const RString sParam )
|
||||
arrayStopExpressions[b].c_str() );
|
||||
continue;
|
||||
}
|
||||
|
||||
|
||||
const float fBeat = StringToFloat( arrayStopValues[0] );
|
||||
const float fNewStop = StringToFloat( arrayStopValues[1] );
|
||||
if( fBeat >= 0 && fNewStop > 0 )
|
||||
@@ -711,7 +713,7 @@ void SSCLoader::ProcessWarps( TimingData &out, const RString sParam, const float
|
||||
{
|
||||
std::vector<RString> arrayWarpExpressions;
|
||||
split( sParam, ",", arrayWarpExpressions );
|
||||
|
||||
|
||||
for( unsigned b=0; b<arrayWarpExpressions.size(); b++ )
|
||||
{
|
||||
std::vector<RString> arrayWarpValues;
|
||||
@@ -724,7 +726,7 @@ void SSCLoader::ProcessWarps( TimingData &out, const RString sParam, const float
|
||||
arrayWarpExpressions[b].c_str() );
|
||||
continue;
|
||||
}
|
||||
|
||||
|
||||
const float fBeat = StringToFloat( arrayWarpValues[0] );
|
||||
const float fNewBeat = StringToFloat( arrayWarpValues[1] );
|
||||
// Early versions were absolute in beats. They should be relative.
|
||||
@@ -748,7 +750,7 @@ void SSCLoader::ProcessLabels( TimingData &out, const RString sParam )
|
||||
{
|
||||
std::vector<RString> arrayLabelExpressions;
|
||||
split( sParam, ",", arrayLabelExpressions );
|
||||
|
||||
|
||||
for( unsigned b=0; b<arrayLabelExpressions.size(); b++ )
|
||||
{
|
||||
std::vector<RString> arrayLabelValues;
|
||||
@@ -761,20 +763,20 @@ void SSCLoader::ProcessLabels( TimingData &out, const RString sParam )
|
||||
arrayLabelExpressions[b].c_str() );
|
||||
continue;
|
||||
}
|
||||
|
||||
|
||||
const float fBeat = StringToFloat( arrayLabelValues[0] );
|
||||
RString sLabel = arrayLabelValues[1];
|
||||
TrimRight(sLabel);
|
||||
if( fBeat >= 0.0f )
|
||||
out.AddSegment( LabelSegment(BeatToNoteRow(fBeat), sLabel) );
|
||||
else
|
||||
else
|
||||
{
|
||||
LOG->UserLog("Song file",
|
||||
this->GetSongTitle(),
|
||||
"has an invalid Label at beat %f called %s.",
|
||||
fBeat, sLabel.c_str() );
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
@@ -782,7 +784,7 @@ void SSCLoader::ProcessCombos( TimingData &out, const RString line, const int ro
|
||||
{
|
||||
std::vector<RString> arrayComboExpressions;
|
||||
split( line, ",", arrayComboExpressions );
|
||||
|
||||
|
||||
for( unsigned f=0; f<arrayComboExpressions.size(); f++ )
|
||||
{
|
||||
std::vector<RString> arrayComboValues;
|
||||
@@ -807,12 +809,12 @@ void SSCLoader::ProcessScrolls( TimingData &out, const RString sParam )
|
||||
{
|
||||
std::vector<RString> vs1;
|
||||
split( sParam, ",", vs1 );
|
||||
|
||||
|
||||
for (RString const &s1 : vs1)
|
||||
{
|
||||
std::vector<RString> vs2;
|
||||
split( s1, "=", vs2 );
|
||||
|
||||
|
||||
if( vs2.size() < 2 )
|
||||
{
|
||||
LOG->UserLog("Song file",
|
||||
@@ -841,7 +843,7 @@ void SSCLoader::ProcessScrolls( TimingData &out, const RString sParam )
|
||||
bool SSCLoader::LoadNoteDataFromSimfile( const RString & cachePath, Steps &out )
|
||||
{
|
||||
LOG->Trace( "Loading notes from %s", cachePath.c_str() );
|
||||
|
||||
|
||||
MsdFile msd;
|
||||
if (!msd.ReadFile(cachePath, true))
|
||||
{
|
||||
@@ -851,11 +853,11 @@ bool SSCLoader::LoadNoteDataFromSimfile( const RString & cachePath, Steps &out )
|
||||
msd.GetError().c_str());
|
||||
return false;
|
||||
}
|
||||
|
||||
|
||||
bool tryingSteps = false;
|
||||
float storedVersion = 0;
|
||||
const unsigned values = msd.GetNumValues();
|
||||
|
||||
|
||||
for (unsigned i = 0; i < values; i++)
|
||||
{
|
||||
const MsdFile::value_t ¶ms = msd.GetValue(i);
|
||||
@@ -1222,7 +1224,7 @@ bool SSCLoader::LoadEditFromMsd(const MsdFile &msd,
|
||||
/*
|
||||
* (c) 2011 Jason Felds
|
||||
* All rights reserved.
|
||||
*
|
||||
*
|
||||
* Permission is hereby granted, free of charge, to any person obtaining a
|
||||
* copy of this software and associated documentation files (the
|
||||
* "Software"), to deal in the Software without restriction, including
|
||||
@@ -1232,7 +1234,7 @@ bool SSCLoader::LoadEditFromMsd(const MsdFile &msd,
|
||||
* copyright notice(s) and this permission notice appear in all copies of
|
||||
* the Software and that both the above copyright notice(s) and this
|
||||
* permission notice appear in supporting documentation.
|
||||
*
|
||||
*
|
||||
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
|
||||
* OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
||||
* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT OF
|
||||
|
||||
+3
-2
@@ -12,6 +12,7 @@
|
||||
#include "ActorUtil.h"
|
||||
|
||||
#include <cmath>
|
||||
#include <cstddef>
|
||||
|
||||
const RString NEXT_ROW_NAME = "NextRow";
|
||||
const RString EXIT_NAME = "Exit";
|
||||
@@ -29,8 +30,8 @@ RString OptionRow::GetThemedItemText( int iChoice ) const
|
||||
return s;
|
||||
}
|
||||
|
||||
RString ITEMS_LONG_ROW_X_NAME( 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 ITEMS_LONG_ROW_X_NAME( std::size_t p ) { return ssprintf("ItemsLongRowP%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 )
|
||||
{
|
||||
|
||||
+6
-4
@@ -9,14 +9,16 @@
|
||||
#include "ModIcon.h"
|
||||
#include "ThemeMetric.h"
|
||||
#include "AutoActor.h"
|
||||
|
||||
#include <array>
|
||||
#include <cstddef>
|
||||
|
||||
class OptionRowHandler;
|
||||
class GameCommand;
|
||||
struct OptionRowDefinition;
|
||||
|
||||
RString ITEMS_LONG_ROW_X_NAME( size_t p );
|
||||
RString MOD_ICON_X_NAME( size_t p );
|
||||
RString ITEMS_LONG_ROW_X_NAME( std::size_t p );
|
||||
RString MOD_ICON_X_NAME( std::size_t p );
|
||||
|
||||
class OptionRowType
|
||||
{
|
||||
@@ -158,7 +160,7 @@ public:
|
||||
/*
|
||||
* (c) 2001-2004 Chris Danford
|
||||
* All rights reserved.
|
||||
*
|
||||
*
|
||||
* Permission is hereby granted, free of charge, to any person obtaining a
|
||||
* copy of this software and associated documentation files (the
|
||||
* "Software"), to deal in the Software without restriction, including
|
||||
@@ -168,7 +170,7 @@ public:
|
||||
* copyright notice(s) and this permission notice appear in all copies of
|
||||
* the Software and that both the above copyright notice(s) and this
|
||||
* permission notice appear in supporting documentation.
|
||||
*
|
||||
*
|
||||
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
|
||||
* OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
||||
* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT OF
|
||||
|
||||
+13
-13
@@ -314,7 +314,7 @@ public:
|
||||
for (PlayerNumber const &p : vpns)
|
||||
{
|
||||
const std::vector<bool> &vbSel = vbSelected[p];
|
||||
|
||||
|
||||
m_Default.Apply( p );
|
||||
for( unsigned i=0; i<vbSel.size(); i++ )
|
||||
{
|
||||
@@ -341,7 +341,7 @@ public:
|
||||
gcOut = m_aListEntries[iFirstSelection];
|
||||
}
|
||||
virtual RString GetScreen( int iChoice ) const
|
||||
{
|
||||
{
|
||||
const GameCommand &gc = m_aListEntries[iChoice];
|
||||
return gc.m_sScreen;
|
||||
}
|
||||
@@ -556,7 +556,7 @@ public:
|
||||
{
|
||||
ROW_INVALID_IF(true, "Invalid StepsType param \"" + sParam + "\".", false);
|
||||
}
|
||||
|
||||
|
||||
m_Def.m_sName = sParam;
|
||||
m_Def.m_bOneChoiceForAllPlayers = true;
|
||||
m_Def.m_layoutType = LAYOUT_SHOW_ONE_IN_ROW;
|
||||
@@ -703,7 +703,7 @@ class OptionRowHandlerListCharacters: public OptionRowHandlerList
|
||||
RString s = pCharacter->GetDisplayName();
|
||||
s.MakeUpper();
|
||||
|
||||
m_Def.m_vsChoices.push_back( s );
|
||||
m_Def.m_vsChoices.push_back( s );
|
||||
GameCommand mc;
|
||||
mc.m_pCharacter = pCharacter;
|
||||
m_aListEntries.push_back( mc );
|
||||
@@ -725,7 +725,7 @@ class OptionRowHandlerListStyles: public OptionRowHandlerList
|
||||
ASSERT( vStyles.size() != 0 );
|
||||
for (Style const *s : vStyles)
|
||||
{
|
||||
m_Def.m_vsChoices.push_back( GAMEMAN->StyleToLocalizedString(s) );
|
||||
m_Def.m_vsChoices.push_back( GAMEMAN->StyleToLocalizedString(s) );
|
||||
GameCommand mc;
|
||||
mc.m_pStyle = s;
|
||||
m_aListEntries.push_back( mc );
|
||||
@@ -758,7 +758,7 @@ class OptionRowHandlerListGroups: public OptionRowHandlerList
|
||||
|
||||
for (RString const &g : vSongGroups)
|
||||
{
|
||||
m_Def.m_vsChoices.push_back( g );
|
||||
m_Def.m_vsChoices.push_back( g );
|
||||
GameCommand mc;
|
||||
mc.m_sSongGroup = g;
|
||||
m_aListEntries.push_back( mc );
|
||||
@@ -789,7 +789,7 @@ class OptionRowHandlerListDifficulties: public OptionRowHandlerList
|
||||
StepsType st = GAMEMAN->GetHowToPlayStyleForGame( GAMESTATE->m_pCurGame )->m_StepsType;
|
||||
RString s = CustomDifficultyToLocalizedString( GetCustomDifficulty(st, d, CourseType_Invalid) );
|
||||
|
||||
m_Def.m_vsChoices.push_back( s );
|
||||
m_Def.m_vsChoices.push_back( s );
|
||||
GameCommand mc;
|
||||
mc.m_dc = d;
|
||||
m_aListEntries.push_back( mc );
|
||||
@@ -815,7 +815,7 @@ class OptionRowHandlerListSongsInCurrentSongGroup: public OptionRowHandlerList
|
||||
|
||||
for (Song *p : vpSongs)
|
||||
{
|
||||
m_Def.m_vsChoices.push_back( p->GetTranslitFullTitle() );
|
||||
m_Def.m_vsChoices.push_back( p->GetTranslitFullTitle() );
|
||||
GameCommand mc;
|
||||
mc.m_pSong = p;
|
||||
m_aListEntries.push_back( mc );
|
||||
@@ -1061,7 +1061,7 @@ public:
|
||||
m_GoToFirstOnStart = lua_toboolean(L, -1) > 0;
|
||||
lua_pop(L, 1);
|
||||
|
||||
lua_getfield(L, -1, "OneChoiceForAllPlayers");
|
||||
lua_getfield(L, -1, "OneChoiceForAllPlayers");
|
||||
m_Def.m_bOneChoiceForAllPlayers = lua_toboolean( L, -1 ) > 0;
|
||||
lua_pop( L, 1 );
|
||||
|
||||
@@ -1535,7 +1535,7 @@ public:
|
||||
gcOut = m_gc;
|
||||
}
|
||||
virtual RString GetScreen( int iChoice ) const
|
||||
{
|
||||
{
|
||||
return m_gc.m_sScreen;
|
||||
}
|
||||
};
|
||||
@@ -1572,7 +1572,7 @@ OptionRowHandler* OptionRowHandlerUtil::Make( const Commands &cmds )
|
||||
else if( sParam.CompareNoCase("Steps")==0 ) MAKE( OptionRowHandlerListSteps )
|
||||
else if( sParam.CompareNoCase("StepsLocked")==0 )
|
||||
{
|
||||
MAKE( OptionRowHandlerListSteps );
|
||||
MAKE( OptionRowHandlerListSteps );
|
||||
pHand->m_Def.m_bOneChoiceForAllPlayers = true;
|
||||
}
|
||||
else if( sParam.CompareNoCase("Characters")==0 ) MAKE( OptionRowHandlerListCharacters )
|
||||
@@ -1661,7 +1661,7 @@ LuaXType( ReloadChanged );
|
||||
/*
|
||||
* (c) 2002-2004 Chris Danford
|
||||
* All rights reserved.
|
||||
*
|
||||
*
|
||||
* Permission is hereby granted, free of charge, to any person obtaining a
|
||||
* copy of this software and associated documentation files (the
|
||||
* "Software"), to deal in the Software without restriction, including
|
||||
@@ -1671,7 +1671,7 @@ LuaXType( ReloadChanged );
|
||||
* copyright notice(s) and this permission notice appear in all copies of
|
||||
* the Software and that both the above copyright notice(s) and this
|
||||
* permission notice appear in supporting documentation.
|
||||
*
|
||||
*
|
||||
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
|
||||
* OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
||||
* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT OF
|
||||
|
||||
+25
-22
@@ -4,7 +4,10 @@
|
||||
#include "GameCommand.h"
|
||||
#include "LuaReference.h"
|
||||
#include "RageUtil.h"
|
||||
|
||||
#include <cstddef>
|
||||
#include <set>
|
||||
|
||||
struct MenuRowDef;
|
||||
class OptionRow;
|
||||
struct ConfOption;
|
||||
@@ -77,21 +80,21 @@ struct OptionRowDefinition
|
||||
* @brief Is this option enabled for the Player?
|
||||
* @param pn the Player the PlayerNumber represents.
|
||||
* @return true if the option is enabled, false otherwise. */
|
||||
bool IsEnabledForPlayer( PlayerNumber pn ) const
|
||||
bool IsEnabledForPlayer( PlayerNumber pn ) const
|
||||
{
|
||||
return m_vEnabledForPlayers.find(pn) != m_vEnabledForPlayers.end();
|
||||
return m_vEnabledForPlayers.find(pn) != m_vEnabledForPlayers.end();
|
||||
}
|
||||
|
||||
OptionRowDefinition(): m_sName(""), m_sExplanationName(""),
|
||||
m_bOneChoiceForAllPlayers(false), m_selectType(SELECT_ONE),
|
||||
m_layoutType(LAYOUT_SHOW_ALL_IN_ROW), m_vsChoices(),
|
||||
m_layoutType(LAYOUT_SHOW_ALL_IN_ROW), m_vsChoices(),
|
||||
m_vEnabledForPlayers(), m_iDefault(-1),
|
||||
m_bExportOnChange(false), m_bAllowThemeItems(true),
|
||||
m_bAllowThemeTitle(true), m_bAllowExplanation(true),
|
||||
m_bShowChoicesListOnSelect(false)
|
||||
{
|
||||
FOREACH_PlayerNumber( pn )
|
||||
m_vEnabledForPlayers.insert( pn );
|
||||
m_vEnabledForPlayers.insert( pn );
|
||||
}
|
||||
void Init()
|
||||
{
|
||||
@@ -112,20 +115,20 @@ struct OptionRowDefinition
|
||||
m_bShowChoicesListOnSelect = false;
|
||||
}
|
||||
|
||||
OptionRowDefinition( const char *n, bool b, const char *c0=nullptr,
|
||||
const char *c1=nullptr, const char *c2=nullptr,
|
||||
const char *c3=nullptr, const char *c4=nullptr,
|
||||
const char *c5=nullptr, const char *c6=nullptr,
|
||||
const char *c7=nullptr, const char *c8=nullptr,
|
||||
const char *c9=nullptr, const char *c10=nullptr,
|
||||
const char *c11=nullptr, const char *c12=nullptr,
|
||||
const char *c13=nullptr, const char *c14=nullptr,
|
||||
const char *c15=nullptr, const char *c16=nullptr,
|
||||
const char *c17=nullptr, const char *c18=nullptr,
|
||||
OptionRowDefinition( const char *n, bool b, const char *c0=nullptr,
|
||||
const char *c1=nullptr, const char *c2=nullptr,
|
||||
const char *c3=nullptr, const char *c4=nullptr,
|
||||
const char *c5=nullptr, const char *c6=nullptr,
|
||||
const char *c7=nullptr, const char *c8=nullptr,
|
||||
const char *c9=nullptr, const char *c10=nullptr,
|
||||
const char *c11=nullptr, const char *c12=nullptr,
|
||||
const char *c13=nullptr, const char *c14=nullptr,
|
||||
const char *c15=nullptr, const char *c16=nullptr,
|
||||
const char *c17=nullptr, const char *c18=nullptr,
|
||||
const char *c19=nullptr ): m_sName(n),
|
||||
m_sExplanationName(""), m_bOneChoiceForAllPlayers(b),
|
||||
m_selectType(SELECT_ONE),
|
||||
m_layoutType(LAYOUT_SHOW_ALL_IN_ROW), m_vsChoices(),
|
||||
m_layoutType(LAYOUT_SHOW_ALL_IN_ROW), m_vsChoices(),
|
||||
m_vEnabledForPlayers(), m_iDefault(-1),
|
||||
m_bExportOnChange(false), m_bAllowThemeItems(true),
|
||||
m_bAllowThemeTitle(true), m_bAllowExplanation(true),
|
||||
@@ -133,7 +136,7 @@ struct OptionRowDefinition
|
||||
{
|
||||
FOREACH_PlayerNumber( pn )
|
||||
m_vEnabledForPlayers.insert( pn );
|
||||
|
||||
|
||||
#define PUSH( c ) if(c) m_vsChoices.push_back(c);
|
||||
PUSH(c0);PUSH(c1);PUSH(c2);PUSH(c3);PUSH(c4);PUSH(c5);
|
||||
PUSH(c6);PUSH(c7);PUSH(c8);PUSH(c9);PUSH(c10);PUSH(c11);
|
||||
@@ -205,7 +208,7 @@ inline void VerifySelected(SelectType st, std::vector<bool> &selected, const RSt
|
||||
int num_selected = 0;
|
||||
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())
|
||||
{
|
||||
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());
|
||||
return;
|
||||
}
|
||||
for(size_t e= 0; e < selected.size(); ++e)
|
||||
for(std::size_t e= 0; e < selected.size(); ++e)
|
||||
{
|
||||
if(selected[e])
|
||||
{
|
||||
num_selected++;
|
||||
if(first_selected == std::numeric_limits<size_t>::max())
|
||||
if(first_selected == std::numeric_limits<std::size_t>::max())
|
||||
{
|
||||
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 "
|
||||
"thing to be selected, but %i out of %i things are selected.",
|
||||
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)
|
||||
{
|
||||
@@ -252,7 +255,7 @@ inline void VerifySelected(SelectType st, std::vector<bool> &selected, const RSt
|
||||
* @author Chris Danford (c) 2002-2004
|
||||
* @section LICENSE
|
||||
* All rights reserved.
|
||||
*
|
||||
*
|
||||
* Permission is hereby granted, free of charge, to any person obtaining a
|
||||
* copy of this software and associated documentation files (the
|
||||
* "Software"), to deal in the Software without restriction, including
|
||||
@@ -262,7 +265,7 @@ inline void VerifySelected(SelectType st, std::vector<bool> &selected, const RSt
|
||||
* copyright notice(s) and this permission notice appear in all copies of
|
||||
* the Software and that both the above copyright notice(s) and this
|
||||
* permission notice appear in supporting documentation.
|
||||
*
|
||||
*
|
||||
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
|
||||
* OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
||||
* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT OF
|
||||
|
||||
@@ -5,6 +5,9 @@
|
||||
|
||||
#ifndef OptionsBinding_H
|
||||
#define OptionsBinding_H
|
||||
|
||||
#include <cstddef>
|
||||
|
||||
// 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.
|
||||
// The previous value is returned.
|
||||
@@ -103,19 +106,19 @@
|
||||
{ \
|
||||
int original_top= lua_gettop(L); \
|
||||
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_rawseti(L, -2, n+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)) \
|
||||
{ \
|
||||
p->m_ ## member.clear(); \
|
||||
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_gettable(L, 1); \
|
||||
@@ -134,7 +137,7 @@
|
||||
/*
|
||||
* (c) 2014 Eric Reese
|
||||
* All rights reserved.
|
||||
*
|
||||
*
|
||||
* Permission is hereby granted, free of charge, to any person obtaining a
|
||||
* copy of this software and associated documentation files (the
|
||||
* "Software"), to deal in the Software without restriction, including
|
||||
@@ -144,7 +147,7 @@
|
||||
* copyright notice(s) and this permission notice appear in all copies of
|
||||
* the Software and that both the above copyright notice(s) and this
|
||||
* permission notice appear in supporting documentation.
|
||||
*
|
||||
*
|
||||
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
|
||||
* OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
||||
* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT OF
|
||||
|
||||
+5
-3
@@ -11,6 +11,8 @@
|
||||
#include "InputMapper.h"
|
||||
#include "PlayerState.h"
|
||||
|
||||
#include <cstddef>
|
||||
|
||||
#define LINE(sLineName) THEME->GetMetric (m_sName,ssprintf("Line%s",sLineName.c_str()))
|
||||
#define MAX_ITEMS_BEFORE_SPLIT THEME->GetMetricI(m_sName,"MaxItemsBeforeSplit")
|
||||
#define ITEMS_SPLIT_WIDTH THEME->GetMetricF(m_sName,"ItemsSplitWidth")
|
||||
@@ -190,7 +192,7 @@ void OptionsList::Load( RString sType, PlayerNumber pn )
|
||||
m_bStartIsDown = false;
|
||||
m_GameButtonPreviousItem = INPUTMAPPER->GetInputScheme()->ButtonNameToIndex( THEME->GetMetric( m_sName,"PrevItemButton" ) );
|
||||
m_GameButtonNextItem = INPUTMAPPER->GetInputScheme()->ButtonNameToIndex( THEME->GetMetric( m_sName,"NextItemButton" ) );
|
||||
|
||||
|
||||
m_Codes.Load( sType );
|
||||
|
||||
m_Cursor.Load( THEME->GetPathG(sType, "cursor") );
|
||||
@@ -229,7 +231,7 @@ void OptionsList::Load( RString sType, PlayerNumber pn )
|
||||
m_Rows[sLineName] = pHand;
|
||||
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);
|
||||
if( !sScreen.empty() )
|
||||
@@ -570,7 +572,7 @@ void OptionsList::SetDefaultCurrentRow()
|
||||
|
||||
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 )
|
||||
return i;
|
||||
|
||||
+10
-9
@@ -42,9 +42,10 @@
|
||||
#include "AdjustSync.h"
|
||||
|
||||
#include <cmath>
|
||||
#include <cstddef>
|
||||
|
||||
RString ATTACK_DISPLAY_X_NAME( size_t p, size_t both_sides );
|
||||
void TimingWindowSecondsInit( size_t /*TimingWindow*/ i, RString &sNameOut, float &defaultValueOut );
|
||||
RString ATTACK_DISPLAY_X_NAME( std::size_t p, std::size_t both_sides );
|
||||
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.
|
||||
@@ -55,9 +56,9 @@ class JudgedRows
|
||||
int m_iStart;
|
||||
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() );
|
||||
vNewRows.reserve( iNewSize );
|
||||
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.
|
||||
@@ -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. */
|
||||
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) );
|
||||
switch( i )
|
||||
@@ -2161,7 +2162,7 @@ void Player::Step( int col, int row, const RageTimer &tm, bool bHeld, bool bRele
|
||||
std::vector<GameInput> GameI;
|
||||
GAMESTATE->GetCurrentStyle(GetPlayerState()->m_PlayerNumber)->StyleInputToGameInput( t, pn, GameI );
|
||||
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] ));
|
||||
}
|
||||
@@ -2796,7 +2797,7 @@ void Player::CrossedRows( int iLastRowCrossed, const RageTimer &now )
|
||||
GAMESTATE->GetCurrentStyle(GetPlayerState()->m_PlayerNumber)->StyleInputToGameInput( iTrack, pn, GameI );
|
||||
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);
|
||||
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 );
|
||||
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);
|
||||
if(fSecsHeld >= PREFSMAN->m_fPadStickSeconds)
|
||||
|
||||
@@ -12,6 +12,7 @@
|
||||
|
||||
#include <cfloat>
|
||||
#include <cmath>
|
||||
#include <cstddef>
|
||||
#include <numeric>
|
||||
|
||||
#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 )
|
||||
{
|
||||
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_pushstring(L, "StartSecond");
|
||||
|
||||
+15
-12
@@ -6,6 +6,9 @@
|
||||
#include "EnumHelper.h"
|
||||
#include "LuaManager.h"
|
||||
#include "RageUtil.h"
|
||||
|
||||
#include <cstddef>
|
||||
|
||||
class XNode;
|
||||
|
||||
enum class PreferenceType
|
||||
@@ -14,7 +17,7 @@ enum class PreferenceType
|
||||
// This is the default behavior.
|
||||
Mutable,
|
||||
|
||||
// Mark the preference as read-only i.e. don't allow setting of the
|
||||
// Mark the preference as read-only i.e. don't allow setting of the
|
||||
// preference through Lua.
|
||||
Immutable,
|
||||
|
||||
@@ -80,7 +83,7 @@ public:
|
||||
{
|
||||
if( !StringConversion::FromString<T>(s, m_currentValue) )
|
||||
m_currentValue = m_defaultValue;
|
||||
if( m_pfnValidate )
|
||||
if( m_pfnValidate )
|
||||
m_pfnValidate( m_currentValue );
|
||||
}
|
||||
void SetFromStack( lua_State *L )
|
||||
@@ -109,7 +112,7 @@ public:
|
||||
{
|
||||
return m_currentValue;
|
||||
}
|
||||
|
||||
|
||||
const T &GetDefault() const
|
||||
{
|
||||
return m_defaultValue;
|
||||
@@ -119,7 +122,7 @@ public:
|
||||
{
|
||||
return Get();
|
||||
}
|
||||
|
||||
|
||||
void Set( const T& other )
|
||||
{
|
||||
m_currentValue = other;
|
||||
@@ -148,10 +151,10 @@ class Preference1D
|
||||
public:
|
||||
typedef Preference<T> PreferenceT;
|
||||
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;
|
||||
T defaultValue;
|
||||
@@ -162,14 +165,14 @@ public:
|
||||
|
||||
~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] );
|
||||
}
|
||||
const Preference<T>& operator[]( size_t i ) const
|
||||
const Preference<T>& operator[]( std::size_t i ) const
|
||||
{
|
||||
return *m_v[i];
|
||||
}
|
||||
Preference<T>& operator[]( size_t i )
|
||||
Preference<T>& operator[]( std::size_t i )
|
||||
{
|
||||
return *m_v[i];
|
||||
}
|
||||
@@ -180,7 +183,7 @@ public:
|
||||
/*
|
||||
* (c) 2001-2004 Chris Danford, Chris Gomez
|
||||
* All rights reserved.
|
||||
*
|
||||
*
|
||||
* Permission is hereby granted, free of charge, to any person obtaining a
|
||||
* copy of this software and associated documentation files (the
|
||||
* "Software"), to deal in the Software without restriction, including
|
||||
@@ -190,7 +193,7 @@ public:
|
||||
* copyright notice(s) and this permission notice appear in all copies of
|
||||
* the Software and that both the above copyright notice(s) and this
|
||||
* permission notice appear in supporting documentation.
|
||||
*
|
||||
*
|
||||
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
|
||||
* OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
||||
* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT OF
|
||||
|
||||
+33
-32
@@ -27,6 +27,7 @@
|
||||
#include "Character.h"
|
||||
|
||||
#include <algorithm>
|
||||
#include <cstddef>
|
||||
|
||||
const RString STATS_XML = "Stats.xml";
|
||||
const RString STATS_XML_GZ = "Stats.xml.gz";
|
||||
@@ -81,7 +82,7 @@ void Profile::ClearSongs()
|
||||
return;
|
||||
}
|
||||
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];
|
||||
if(curr_song == gamestate_curr_song)
|
||||
@@ -256,7 +257,7 @@ int Profile::GetCalculatedWeightPounds() const
|
||||
{
|
||||
if( m_iWeightPounds == 0 ) // weight not entered
|
||||
return DEFAULT_WEIGHT_POUNDS;
|
||||
else
|
||||
else
|
||||
return m_iWeightPounds;
|
||||
}
|
||||
|
||||
@@ -361,7 +362,7 @@ float Profile::GetSongsPossible( StepsType st, Difficulty dc ) const
|
||||
for( unsigned i=0; i<vSongs.size(); i++ )
|
||||
{
|
||||
Song* pSong = vSongs[i];
|
||||
|
||||
|
||||
if( !pSong->NormallyDisplayed() )
|
||||
continue; // skip
|
||||
|
||||
@@ -369,7 +370,7 @@ float Profile::GetSongsPossible( StepsType st, Difficulty dc ) const
|
||||
for( unsigned j=0; j<vSteps.size(); j++ )
|
||||
{
|
||||
Steps* pSteps = vSteps[j];
|
||||
|
||||
|
||||
if( pSteps->m_StepsType != st )
|
||||
continue; // skip
|
||||
|
||||
@@ -396,7 +397,7 @@ float Profile::GetSongsActual( StepsType st, Difficulty dc ) const
|
||||
|
||||
CHECKPOINT_M( ssprintf("Profile::GetSongsActual: %p", static_cast<void*>(pSong)) );
|
||||
|
||||
// If the Song isn't loaded on the current machine, then we can't
|
||||
// If the Song isn't loaded on the current machine, then we can't
|
||||
// get radar values to compute dance points.
|
||||
if( pSong == nullptr )
|
||||
continue;
|
||||
@@ -413,7 +414,7 @@ float Profile::GetSongsActual( StepsType st, Difficulty dc ) const
|
||||
Steps* pSteps = sid.ToSteps( pSong, true );
|
||||
CHECKPOINT_M( ssprintf("Profile::GetSongsActual: song %p, steps %p", static_cast<void*>(pSong), static_cast<void*>(pSteps)) );
|
||||
|
||||
// If the Steps isn't loaded on the current machine, then we can't
|
||||
// If the Steps isn't loaded on the current machine, then we can't
|
||||
// get radar values to compute dance points.
|
||||
if( pSteps == nullptr )
|
||||
continue;
|
||||
@@ -426,7 +427,7 @@ float Profile::GetSongsActual( StepsType st, Difficulty dc ) const
|
||||
{
|
||||
continue; // skip
|
||||
}
|
||||
|
||||
|
||||
CHECKPOINT_M( ssprintf("Profile::GetSongsActual: difficulty %s is correct", DifficultyToString(dc).c_str()));
|
||||
|
||||
const HighScoresForASteps& h = j.second;
|
||||
@@ -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
|
||||
// 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(),
|
||||
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 new_path= to_dir + "Screenshots/" + m_vScreenshots[sid].sFileName;
|
||||
@@ -1149,7 +1150,7 @@ void Profile::HandleStatsPrefixChange(RString dir, bool require_signature)
|
||||
SaveAllToDir(dir, require_signature);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
ProfileLoadResult Profile::LoadAllFromDir( RString sDir, bool bRequireSignature )
|
||||
{
|
||||
LOG->Trace( "Profile::LoadAllFromDir( %s )", sDir.c_str() );
|
||||
@@ -1194,7 +1195,7 @@ void Profile::LoadSongsFromDir(RString const& dir, ProfileSlot prof_slot)
|
||||
StripMacResourceForks(song_folders);
|
||||
LOG->Trace("Found %i songs in profile.", int(song_folders.size()));
|
||||
// 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;
|
||||
++song_index)
|
||||
{
|
||||
@@ -1276,7 +1277,7 @@ ProfileLoadResult Profile::LoadStatsFromDir(RString dir, bool require_signature)
|
||||
}
|
||||
|
||||
if(require_signature)
|
||||
{
|
||||
{
|
||||
RString sStatsXmlSigFile = fn+SIGNATURE_APPEND;
|
||||
RString sDontShareFile = dir + DONT_SHARE_SIG;
|
||||
|
||||
@@ -1531,7 +1532,7 @@ XNode* Profile::SaveGeneralDataCreateNode() const
|
||||
XNode* pGeneralDataNode = new XNode( "GeneralData" );
|
||||
|
||||
// TRICKY: These are write-only elements that are normally never read again.
|
||||
// This data is required by other apps (like internet ranking), but is
|
||||
// This data is required by other apps (like internet ranking), but is
|
||||
// redundant to the game app.
|
||||
pGeneralDataNode->AppendChild( "DisplayName", GetDisplayNameOrHighScoreName() );
|
||||
pGeneralDataNode->AppendChild( "CharacterID", m_sCharacterID );
|
||||
@@ -1574,7 +1575,7 @@ XNode* Profile::SaveGeneralDataCreateNode() const
|
||||
pGeneralDataNode->AppendChild( "TotalHands", m_iTotalHands );
|
||||
pGeneralDataNode->AppendChild( "TotalLifts", m_iTotalLifts );
|
||||
|
||||
// Keep declared variables in a very local scope so they aren't
|
||||
// Keep declared variables in a very local scope so they aren't
|
||||
// accidentally used where they're not intended. There's a lot of
|
||||
// copying and pasting in this code.
|
||||
|
||||
@@ -1918,9 +1919,9 @@ float Profile::CalculateCaloriesFromHeartRate(float HeartRate, float Duration)
|
||||
Female: ((-20.4022 + (0.4472 x HR) - (0.1263 x W) + (0.074 x A))/4.184) x T
|
||||
where
|
||||
|
||||
HR = Heart rate (in beats/minute)
|
||||
W = Weight (in kilograms)
|
||||
A = Age (in years)
|
||||
HR = Heart rate (in beats/minute)
|
||||
W = Weight (in kilograms)
|
||||
A = Age (in years)
|
||||
T = Exercise duration time (in minutes)
|
||||
|
||||
Equations for Determination of Calorie Burn if VO2max is Known
|
||||
@@ -1929,10 +1930,10 @@ float Profile::CalculateCaloriesFromHeartRate(float HeartRate, float Duration)
|
||||
Female: ((-59.3954 + (0.45 x HR) + (0.380 x VO2max) + (0.103 x W) + (0.274 x A))/4.184) x T
|
||||
where
|
||||
|
||||
HR = Heart rate (in beats/minute)
|
||||
VO2max = Maximal oxygen consumption (in mL•kg-1•min-1)
|
||||
W = Weight (in kilograms)
|
||||
A = Age (in years)
|
||||
HR = Heart rate (in beats/minute)
|
||||
VO2max = Maximal oxygen consumption (in mL•kg-1•min-1)
|
||||
W = Weight (in kilograms)
|
||||
A = Age (in years)
|
||||
T = Exercise duration time (in minutes)
|
||||
*/
|
||||
// Duration passed in is in seconds. Convert it to minutes to make the code
|
||||
@@ -2054,7 +2055,7 @@ void Profile::LoadSongScoresFromNode( const XNode* pSongScores )
|
||||
const XNode *pHighScoreListNode = pSteps->GetChild("HighScoreList");
|
||||
if( pHighScoreListNode == nullptr )
|
||||
WARN_AND_CONTINUE;
|
||||
|
||||
|
||||
HighScoreList &hsl = m_SongHighScores[songID].m_StepsHighScores[stepsID].hsl;
|
||||
hsl.LoadFromNode( pHighScoreListNode );
|
||||
}
|
||||
@@ -2124,9 +2125,9 @@ void Profile::LoadCourseScoresFromNode( const XNode* pCourseScores )
|
||||
// WARN_AND_CONTINUE;
|
||||
|
||||
|
||||
// Backward compatability hack to fix importing scores of old style
|
||||
// Backward compatability hack to fix importing scores of old style
|
||||
// courses that weren't in group folder but have now been moved into
|
||||
// a group folder:
|
||||
// a group folder:
|
||||
// If the courseID doesn't resolve, then take the file name part of sPath
|
||||
// and search for matches of just the file name.
|
||||
{
|
||||
@@ -2156,7 +2157,7 @@ void Profile::LoadCourseScoresFromNode( const XNode* pCourseScores )
|
||||
{
|
||||
if( pTrail->GetName() != "Trail" )
|
||||
continue;
|
||||
|
||||
|
||||
TrailID trailID;
|
||||
trailID.LoadFromNode( pTrail );
|
||||
if( !trailID.IsValid() )
|
||||
@@ -2165,7 +2166,7 @@ void Profile::LoadCourseScoresFromNode( const XNode* pCourseScores )
|
||||
const XNode *pHighScoreListNode = pTrail->GetChild("HighScoreList");
|
||||
if( pHighScoreListNode == nullptr )
|
||||
WARN_AND_CONTINUE;
|
||||
|
||||
|
||||
HighScoreList &hsl = m_CourseHighScores[courseID].m_TrailHighScores[trailID].hsl;
|
||||
hsl.LoadFromNode( pHighScoreListNode );
|
||||
}
|
||||
@@ -2240,7 +2241,7 @@ void Profile::LoadCategoryScoresFromNode( const XNode* pCategoryScores )
|
||||
const XNode *pHighScoreListNode = pRadarCategory->GetChild("HighScoreList");
|
||||
if( pHighScoreListNode == nullptr )
|
||||
WARN_AND_CONTINUE;
|
||||
|
||||
|
||||
HighScoreList &hsl = this->GetCategoryHighScoreList( st, rc );
|
||||
hsl.LoadFromNode( pHighScoreListNode );
|
||||
}
|
||||
@@ -2319,7 +2320,7 @@ void Profile::LoadCalorieDataFromNode( const XNode* pCalorieData )
|
||||
pCaloriesBurned->GetTextValue(fCaloriesBurned);
|
||||
|
||||
m_mapDayToCaloriesBurned[date].fCals = fCaloriesBurned;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
XNode* Profile::SaveCalorieDataCreateNode() const
|
||||
@@ -2540,7 +2541,7 @@ RString Profile::MakeFileNameNoExtension( RString sFileNameBeginning, int iIndex
|
||||
// lua start
|
||||
#include "LuaBinding.h"
|
||||
|
||||
/** @brief Allow Lua to have access to the Profile. */
|
||||
/** @brief Allow Lua to have access to the Profile. */
|
||||
class LunaProfile: public Luna<Profile>
|
||||
{
|
||||
public:
|
||||
@@ -2780,7 +2781,7 @@ public:
|
||||
{
|
||||
lua_createtable(L, p->m_songs.size(), 0);
|
||||
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);
|
||||
lua_rawseti(L, song_tab, i+1);
|
||||
@@ -2867,7 +2868,7 @@ LUA_REGISTER_CLASS( Profile )
|
||||
/*
|
||||
* (c) 2001-2004 Chris Danford
|
||||
* All rights reserved.
|
||||
*
|
||||
*
|
||||
* Permission is hereby granted, free of charge, to any person obtaining a
|
||||
* copy of this software and associated documentation files (the
|
||||
* "Software"), to deal in the Software without restriction, including
|
||||
@@ -2877,7 +2878,7 @@ LUA_REGISTER_CLASS( Profile )
|
||||
* copyright notice(s) and this permission notice appear in all copies of
|
||||
* the Software and that both the above copyright notice(s) and this
|
||||
* permission notice appear in supporting documentation.
|
||||
*
|
||||
*
|
||||
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
|
||||
* OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
||||
* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT OF
|
||||
|
||||
+23
-22
@@ -24,6 +24,7 @@
|
||||
#include "Character.h"
|
||||
#include "CharacterManager.h"
|
||||
|
||||
#include <cstddef>
|
||||
|
||||
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 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) );
|
||||
defaultValueOut = "";
|
||||
@@ -119,7 +120,7 @@ void ProfileManager::Init()
|
||||
// resize to the fixed number
|
||||
if( (int)g_vLocalProfile.size() > NUM_FIXED_PROFILES )
|
||||
g_vLocalProfile.erase( g_vLocalProfile.begin()+NUM_FIXED_PROFILES, g_vLocalProfile.end() );
|
||||
|
||||
|
||||
for( int i=g_vLocalProfile.size(); i<NUM_FIXED_PROFILES; i++ )
|
||||
{
|
||||
RString sCharacterID = FIXED_PROFILE_CHARACTER_ID( i );
|
||||
@@ -233,7 +234,7 @@ bool ProfileManager::LoadLocalProfileFromMachine( PlayerNumber pn )
|
||||
}
|
||||
|
||||
GetProfile(pn)->LoadCustomFunction(m_sProfileDir[pn], pn);
|
||||
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
@@ -318,7 +319,7 @@ bool ProfileManager::LoadFirstAvailableProfile( PlayerNumber pn, bool bLoadEdits
|
||||
|
||||
if( LoadLocalProfileFromMachine(pn) )
|
||||
return true;
|
||||
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
@@ -654,7 +655,7 @@ bool ProfileManager::CreateLocalProfile( RString sName, RString &sProfileIDOut )
|
||||
{
|
||||
ASSERT( !sName.empty() );
|
||||
|
||||
// Find a directory directory name that's a number greater than all
|
||||
// Find a directory directory name that's a number greater than all
|
||||
// existing numbers. This preserves the "order by create date".
|
||||
// Profile IDs are actually the directory names, so they can be any string,
|
||||
// and we have to handle the case where the user renames one.
|
||||
@@ -823,7 +824,7 @@ bool ProfileManager::DeleteLocalProfile( RString sProfileID )
|
||||
void ProfileManager::SaveMachineProfile() const
|
||||
{
|
||||
// If the machine name has changed, make sure we use the new name.
|
||||
// It's important that this name be applied before the Player profiles
|
||||
// It's important that this name be applied before the Player profiles
|
||||
// are saved, so that the Player's profiles show the right machine name.
|
||||
const_cast<ProfileManager *> (this)->m_pMachineProfile->m_sDisplayName = PREFSMAN->m_sMachineName;
|
||||
|
||||
@@ -939,7 +940,7 @@ void ProfileManager::MergeLocalProfileIntoMachine(RString const& from_id, bool s
|
||||
|
||||
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; }
|
||||
if(new_type == g_vLocalProfile[index].profile.m_Type)
|
||||
{ return; }
|
||||
@@ -951,7 +952,7 @@ void ProfileManager::ChangeProfileType(int index, ProfileType new_type)
|
||||
|
||||
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;
|
||||
}
|
||||
@@ -959,7 +960,7 @@ void ProfileManager::MoveProfileTopBottom(int index, bool top)
|
||||
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.
|
||||
// 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;
|
||||
if (!top)
|
||||
@@ -993,14 +994,14 @@ void ProfileManager::MoveProfileTopBottom(int index, bool top)
|
||||
|
||||
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;
|
||||
}
|
||||
|
||||
int swindex = 0;
|
||||
// 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;
|
||||
if (type != ProfileType_Guest)
|
||||
@@ -1035,7 +1036,7 @@ void ProfileManager::MoveProfileSorted(int index, bool bAscending) {
|
||||
|
||||
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; }
|
||||
// Changing the priority is complicated a bit because the profiles might
|
||||
// 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);
|
||||
ProfileType type= g_vLocalProfile[index].profile.m_Type;
|
||||
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];
|
||||
if(curr->profile.m_Type == type)
|
||||
@@ -1052,7 +1053,7 @@ void ProfileManager::MoveProfilePriority(int index, bool up)
|
||||
if(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);
|
||||
}
|
||||
@@ -1065,7 +1066,7 @@ void ProfileManager::MoveProfilePriority(int index, bool up)
|
||||
}
|
||||
}
|
||||
// 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[index].profile.m_Type)
|
||||
{
|
||||
@@ -1122,7 +1123,7 @@ void ProfileManager::AddStepsScore( const Song* pSong, const Steps* pSteps, Play
|
||||
}
|
||||
|
||||
//
|
||||
// save high score
|
||||
// save high score
|
||||
//
|
||||
if( IsPersistentProfile(pn) )
|
||||
GetProfile(pn)->AddStepsHighScore( pSong, pSteps, hs, iPersonalIndexOut );
|
||||
@@ -1220,7 +1221,7 @@ bool ProfileManager::IsPersistentProfile( ProfileSlot slot ) const
|
||||
{
|
||||
case ProfileSlot_Player1:
|
||||
case ProfileSlot_Player2:
|
||||
return GAMESTATE->IsHumanPlayer((PlayerNumber)slot) && !m_sProfileDir[slot].empty();
|
||||
return GAMESTATE->IsHumanPlayer((PlayerNumber)slot) && !m_sProfileDir[slot].empty();
|
||||
case ProfileSlot_Machine:
|
||||
return true;
|
||||
default:
|
||||
@@ -1277,7 +1278,7 @@ int ProfileManager::GetNumLocalProfiles() const
|
||||
void ProfileManager::SetStatsPrefix(RString const& 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);
|
||||
}
|
||||
@@ -1295,7 +1296,7 @@ void ProfileManager::SetStatsPrefix(RString const& prefix)
|
||||
// lua start
|
||||
#include "LuaBinding.h"
|
||||
|
||||
/** @brief Allow Lua to have access to the ProfileManager. */
|
||||
/** @brief Allow Lua to have access to the ProfileManager. */
|
||||
class LunaProfileManager: public Luna<ProfileManager>
|
||||
{
|
||||
public:
|
||||
@@ -1317,7 +1318,7 @@ public:
|
||||
static int GetLocalProfile( T* p, lua_State *L )
|
||||
{
|
||||
Profile *pProfile = p->GetLocalProfile(SArg(1));
|
||||
if( pProfile )
|
||||
if( pProfile )
|
||||
pProfile->PushSelf(L);
|
||||
else
|
||||
lua_pushnil(L);
|
||||
@@ -1420,7 +1421,7 @@ LUA_REGISTER_CLASS( ProfileManager )
|
||||
/*
|
||||
* (c) 2003-2004 Chris Danford
|
||||
* All rights reserved.
|
||||
*
|
||||
*
|
||||
* Permission is hereby granted, free of charge, to any person obtaining a
|
||||
* copy of this software and associated documentation files (the
|
||||
* "Software"), to deal in the Software without restriction, including
|
||||
@@ -1430,7 +1431,7 @@ LUA_REGISTER_CLASS( ProfileManager )
|
||||
* copyright notice(s) and this permission notice appear in all copies of
|
||||
* the Software and that both the above copyright notice(s) and this
|
||||
* permission notice appear in supporting documentation.
|
||||
*
|
||||
*
|
||||
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
|
||||
* OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
||||
* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT OF
|
||||
|
||||
+3
-2
@@ -16,6 +16,7 @@
|
||||
#include "arch/ArchHooks/ArchHooks.h"
|
||||
|
||||
#include <cmath>
|
||||
#include <cstddef>
|
||||
|
||||
// Statistics stuff
|
||||
RageTimer g_LastCheckTimer;
|
||||
@@ -974,8 +975,8 @@ void RageCompiledGeometry::Set( const std::vector<msMesh> &vMeshes, bool bNeedsN
|
||||
{
|
||||
m_bNeedsNormals = bNeedsNormals;
|
||||
|
||||
size_t totalVerts = 0;
|
||||
size_t totalTriangles = 0;
|
||||
std::size_t totalVerts = 0;
|
||||
std::size_t totalTriangles = 0;
|
||||
|
||||
m_bAnyNeedsTextureMatrixScale = false;
|
||||
|
||||
|
||||
+21
-19
@@ -5,6 +5,8 @@
|
||||
|
||||
#include "RageTypes.h"
|
||||
#include "ModelTypes.h"
|
||||
|
||||
#include <cstddef>
|
||||
#include <set>
|
||||
|
||||
class DisplaySpec;
|
||||
@@ -12,7 +14,7 @@ typedef std::set<DisplaySpec> DisplaySpecs;
|
||||
|
||||
const int REFRESH_DEFAULT = 0;
|
||||
struct RageSurface;
|
||||
enum TextureUnit
|
||||
enum TextureUnit
|
||||
{
|
||||
TextureUnit_1,
|
||||
TextureUnit_2,
|
||||
@@ -21,7 +23,7 @@ enum TextureUnit
|
||||
NUM_TextureUnit
|
||||
};
|
||||
|
||||
// RageCompiledGeometry holds vertex data in a format that is most efficient
|
||||
// RageCompiledGeometry holds vertex data in a format that is most efficient
|
||||
// for the graphics API.
|
||||
class RageCompiledGeometry
|
||||
{
|
||||
@@ -35,8 +37,8 @@ public:
|
||||
virtual void Draw( int iMeshIndex ) const = 0;
|
||||
|
||||
protected:
|
||||
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 GetTotalVertices() const { if( m_vMeshInfo.empty() ) return 0; return m_vMeshInfo.back().iVertexStart + m_vMeshInfo.back().iVertexCount; }
|
||||
std::size_t GetTotalTriangles() const { if( m_vMeshInfo.empty() ) return 0; return m_vMeshInfo.back().iTriangleStart + m_vMeshInfo.back().iTriangleCount; }
|
||||
|
||||
struct MeshInfo
|
||||
{
|
||||
@@ -77,7 +79,7 @@ class VideoModeParams
|
||||
public:
|
||||
// Initialize with a constructor so to guarantee all paramters
|
||||
// are filled (in case new params are added).
|
||||
VideoModeParams(
|
||||
VideoModeParams(
|
||||
bool windowed_,
|
||||
RString sDisplayId_,
|
||||
int width_,
|
||||
@@ -252,17 +254,17 @@ public:
|
||||
virtual void BeginConcurrentRendering();
|
||||
virtual void EndConcurrentRendering() { }
|
||||
|
||||
/* return 0 if failed or internal texture resource handle
|
||||
/* return 0 if failed or internal texture resource handle
|
||||
* (unsigned in OpenGL, texture pointer in D3D) */
|
||||
virtual uintptr_t CreateTexture(
|
||||
virtual uintptr_t CreateTexture(
|
||||
RagePixelFormat pixfmt, // format of img and of texture in video mem
|
||||
RageSurface* img, // must be in pixfmt
|
||||
bool bGenerateMipMaps
|
||||
) = 0;
|
||||
virtual void UpdateTexture(
|
||||
uintptr_t iTexHandle,
|
||||
virtual void UpdateTexture(
|
||||
uintptr_t iTexHandle,
|
||||
RageSurface* img,
|
||||
int xoffset, int yoffset, int width, int height
|
||||
int xoffset, int yoffset, int width, int height
|
||||
) = 0;
|
||||
virtual void DeleteTexture( uintptr_t iTexHandle ) = 0;
|
||||
/* Return an object to lock pixels for streaming. If not supported, returns nullptr.
|
||||
@@ -309,7 +311,7 @@ public:
|
||||
|
||||
virtual void SetAlphaTest( bool b ) = 0;
|
||||
|
||||
virtual void SetMaterial(
|
||||
virtual void SetMaterial(
|
||||
const RageColor &emissive,
|
||||
const RageColor &ambient,
|
||||
const RageColor &diffuse,
|
||||
@@ -319,11 +321,11 @@ public:
|
||||
|
||||
virtual void SetLighting( bool b ) = 0;
|
||||
virtual void SetLightOff( int index ) = 0;
|
||||
virtual void SetLightDirectional(
|
||||
int index,
|
||||
const RageColor &ambient,
|
||||
const RageColor &diffuse,
|
||||
const RageColor &specular,
|
||||
virtual void SetLightDirectional(
|
||||
int index,
|
||||
const RageColor &ambient,
|
||||
const RageColor &diffuse,
|
||||
const RageColor &specular,
|
||||
const RageVector3 &dir ) = 0;
|
||||
|
||||
virtual void SetSphereEnvironmentMapping( TextureUnit tu, bool b ) = 0;
|
||||
@@ -412,7 +414,7 @@ public:
|
||||
void TexturePushMatrix();
|
||||
void TexturePopMatrix();
|
||||
void TextureTranslate( float x, float y );
|
||||
void TextureTranslate( const RageVector2 &v ) { this->TextureTranslate( v.x, v.y ); }
|
||||
void TextureTranslate( const RageVector2 &v ) { this->TextureTranslate( v.x, v.y ); }
|
||||
|
||||
// Projection and View matrix stack functions.
|
||||
void CameraPushMatrix();
|
||||
@@ -435,8 +437,8 @@ protected:
|
||||
RageMatrix GetPerspectiveMatrix( float fovy, float aspect, float zNear, float zFar );
|
||||
|
||||
// Different for D3D and OpenGL. Not sure why they're not compatible. -Chris
|
||||
virtual RageMatrix GetOrthoMatrix( float l, float r, float b, float t, float zn, float zf );
|
||||
virtual RageMatrix GetFrustumMatrix( float l, float r, float b, float t, float zn, float zf );
|
||||
virtual RageMatrix GetOrthoMatrix( float l, float r, float b, float t, float zn, float zf );
|
||||
virtual RageMatrix GetFrustumMatrix( float l, float r, float b, float t, float zn, float zf );
|
||||
|
||||
// Matrix that adjusts position and scale of image on the screen
|
||||
RageMatrix GetCenteringMatrix( float fTranslateX, float fTranslateY, float fAddWidth, float fAddHeight ) const;
|
||||
|
||||
+16
-15
@@ -25,6 +25,7 @@
|
||||
#endif
|
||||
|
||||
#include <cmath>
|
||||
#include <cstddef>
|
||||
#include <list>
|
||||
|
||||
// Globals
|
||||
@@ -44,8 +45,8 @@ const D3DFORMAT g_DefaultAdapterFormat = D3DFMT_X8R8G8B8;
|
||||
/* 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
|
||||
* stored in what slot. */
|
||||
std::map<uintptr_t, size_t> g_TexResourceToPaletteIndex;
|
||||
std::list<size_t> g_PaletteIndex;
|
||||
std::map<uintptr_t, std::size_t> g_TexResourceToPaletteIndex;
|
||||
std::list<std::size_t> g_PaletteIndex;
|
||||
struct TexturePalette { PALETTEENTRY p[256]; };
|
||||
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());
|
||||
|
||||
// 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 )
|
||||
continue;
|
||||
@@ -81,7 +82,7 @@ static void SetPalette( uintptr_t TexResource )
|
||||
const int iPalIndex = g_TexResourceToPaletteIndex[TexResource];
|
||||
|
||||
// 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 )
|
||||
continue;
|
||||
@@ -327,7 +328,7 @@ D3DFORMAT FindBackBufferType(bool bWindowed, int iBPP)
|
||||
}
|
||||
|
||||
// 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];
|
||||
|
||||
@@ -782,18 +783,18 @@ public:
|
||||
}
|
||||
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 msMesh& mesh = vMeshes[i];
|
||||
const std::vector<RageModelVertex> &Vertices = mesh.Vertices;
|
||||
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];
|
||||
|
||||
for( size_t j=0; j<Triangles.size(); j++ )
|
||||
for( size_t k=0; k<3; k++ )
|
||||
for( std::size_t j=0; j<Triangles.size(); j++ )
|
||||
for( std::size_t k=0; k<3; 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
|
||||
static std::vector<uint16_t> vIndices;
|
||||
size_t uOldSize = vIndices.size();
|
||||
size_t uNewSize = std::max(uOldSize, static_cast<size_t>(iNumIndices));
|
||||
std::size_t uOldSize = vIndices.size();
|
||||
std::size_t uNewSize = std::max(uOldSize, static_cast<std::size_t>(iNumIndices));
|
||||
vIndices.resize( uNewSize );
|
||||
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
|
||||
static std::vector<uint16_t> vIndices;
|
||||
size_t uOldSize = vIndices.size();
|
||||
size_t uNewSize = std::max(uOldSize, static_cast<size_t>(iNumIndices));
|
||||
std::size_t uOldSize = vIndices.size();
|
||||
std::size_t uNewSize = std::max(uOldSize, static_cast<std::size_t>(iNumIndices));
|
||||
vIndices.resize( uNewSize );
|
||||
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
|
||||
static std::vector<uint16_t> vIndices;
|
||||
size_t uOldSize = vIndices.size();
|
||||
size_t uNewSize = std::max(uOldSize, static_cast<size_t>(iNumIndices));
|
||||
std::size_t uOldSize = vIndices.size();
|
||||
std::size_t uNewSize = std::max(uOldSize, static_cast<std::size_t>(iNumIndices));
|
||||
vIndices.resize( uNewSize );
|
||||
for( uint16_t i=(uint16_t)uOldSize/12; i<(uint16_t)iNumPieces; i++ )
|
||||
{
|
||||
|
||||
+21
-20
@@ -10,13 +10,14 @@
|
||||
#include "RageUtil.h"
|
||||
#include "RageSurface.h"
|
||||
#include "RageTextureManager.h"
|
||||
|
||||
#include "DisplaySpec.h"
|
||||
|
||||
#include "arch/LowLevelWindow/LowLevelWindow.h"
|
||||
|
||||
#include <GL/glew.h>
|
||||
|
||||
#include <cstddef>
|
||||
|
||||
#ifdef NO_GL_FLUSH
|
||||
#define glFlush()
|
||||
#endif
|
||||
@@ -261,12 +262,12 @@ RageDisplay_GLES2::Init( const VideoModeParams &p, bool bAllowUnacceleratedRende
|
||||
}
|
||||
|
||||
sort( extensions.begin(), extensions.end() );
|
||||
size_t next = 0;
|
||||
std::size_t next = 0;
|
||||
while( next < extensions.size() )
|
||||
{
|
||||
size_t last = next;
|
||||
std::size_t last = next;
|
||||
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;
|
||||
split(extensions[i], '_', segments);
|
||||
@@ -308,12 +309,12 @@ RageDisplay_GLES2::Init( const VideoModeParams &p, bool bAllowUnacceleratedRende
|
||||
std::vector<RString> asExtensions;
|
||||
split( szExtensionString, " ", asExtensions );
|
||||
sort( asExtensions.begin(), asExtensions.end() );
|
||||
size_t iNextToPrint = 0;
|
||||
std::size_t iNextToPrint = 0;
|
||||
while( iNextToPrint < asExtensions.size() )
|
||||
{
|
||||
size_t iLastToPrint = iNextToPrint;
|
||||
std::size_t iLastToPrint = iNextToPrint;
|
||||
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;
|
||||
split( asExtensions[i], "_", asBits );
|
||||
@@ -486,7 +487,7 @@ RageDisplay_GLES2::GetOrthoMatrix( float l, float r, float b, float t, float zn,
|
||||
class RageCompiledGeometryGLES2 : public RageCompiledGeometry
|
||||
{
|
||||
public:
|
||||
|
||||
|
||||
void Allocate( const std::vector<msMesh> &vMeshes )
|
||||
{
|
||||
// TODO
|
||||
@@ -573,10 +574,10 @@ RageDisplay_GLES2::CreateTexture(
|
||||
}
|
||||
|
||||
void
|
||||
RageDisplay_GLES2::UpdateTexture(
|
||||
uintptr_t iTexHandle,
|
||||
RageDisplay_GLES2::UpdateTexture(
|
||||
uintptr_t iTexHandle,
|
||||
RageSurface* img,
|
||||
int xoffset, int yoffset, int width, int height
|
||||
int xoffset, int yoffset, int width, int height
|
||||
)
|
||||
{
|
||||
// TODO
|
||||
@@ -631,7 +632,7 @@ RageDisplay_GLES2::SetTexture( TextureUnit tu, uintptr_t iTexture )
|
||||
}
|
||||
}
|
||||
|
||||
void
|
||||
void
|
||||
RageDisplay_GLES2::SetTextureMode( TextureUnit tu, TextureMode tm )
|
||||
{
|
||||
// TODO
|
||||
@@ -647,7 +648,7 @@ void
|
||||
RageDisplay_GLES2::SetTextureFiltering( TextureUnit tu, bool b )
|
||||
{
|
||||
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, b ? GL_LINEAR : GL_NEAREST);
|
||||
|
||||
|
||||
GLint iMinFilter = 0;
|
||||
if (b)
|
||||
{
|
||||
@@ -851,7 +852,7 @@ RageDisplay_GLES2::SetAlphaTest( bool b )
|
||||
}
|
||||
|
||||
void
|
||||
RageDisplay_GLES2::SetMaterial(
|
||||
RageDisplay_GLES2::SetMaterial(
|
||||
const RageColor &emissive,
|
||||
const RageColor &ambient,
|
||||
const RageColor &diffuse,
|
||||
@@ -895,11 +896,11 @@ RageDisplay_GLES2::SetLightOff( int index )
|
||||
}
|
||||
|
||||
void
|
||||
RageDisplay_GLES2::SetLightDirectional(
|
||||
int index,
|
||||
const RageColor &ambient,
|
||||
const RageColor &diffuse,
|
||||
const RageColor &specular,
|
||||
RageDisplay_GLES2::SetLightDirectional(
|
||||
int index,
|
||||
const RageColor &ambient,
|
||||
const RageColor &diffuse,
|
||||
const RageColor &specular,
|
||||
const RageVector3 &dir )
|
||||
{
|
||||
// TODO
|
||||
@@ -948,7 +949,7 @@ RageDisplay_GLES2::DrawTrianglesInternal( const RageSpriteVertex v[], int iNumVe
|
||||
}
|
||||
|
||||
void
|
||||
RageDisplay_GLES2::DrawCompiledGeometryInternal( const RageCompiledGeometry *p, int
|
||||
RageDisplay_GLES2::DrawCompiledGeometryInternal( const RageCompiledGeometry *p, int
|
||||
iMeshIndex )
|
||||
{
|
||||
// TODO
|
||||
|
||||
@@ -20,6 +20,7 @@ using namespace RageDisplay_Legacy_Helpers;
|
||||
#include "arch/LowLevelWindow/LowLevelWindow.h"
|
||||
|
||||
#include <cmath>
|
||||
#include <cstddef>
|
||||
#include <set>
|
||||
|
||||
#if defined(WINDOWS)
|
||||
@@ -495,12 +496,12 @@ RString RageDisplay_Legacy::Init( const VideoModeParams &p, bool bAllowUnacceler
|
||||
std::vector<RString> asExtensions;
|
||||
split( szExtensionString, " ", asExtensions );
|
||||
sort( asExtensions.begin(), asExtensions.end() );
|
||||
size_t iNextToPrint = 0;
|
||||
std::size_t iNextToPrint = 0;
|
||||
while( iNextToPrint < asExtensions.size() )
|
||||
{
|
||||
size_t iLastToPrint = iNextToPrint;
|
||||
std::size_t iLastToPrint = iNextToPrint;
|
||||
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;
|
||||
split( asExtensions[i], "_", asBits );
|
||||
|
||||
+14
-12
@@ -2,7 +2,7 @@
|
||||
* This provides an interface to open files in RageFileManager's namespace
|
||||
* This is just a simple RageFileBasic wrapper on top of another RageFileBasic;
|
||||
* when a file is open, is acts like the underlying RageFileBasic, except that
|
||||
* a few extra sanity checks are made to check file modes.
|
||||
* a few extra sanity checks are made to check file modes.
|
||||
*/
|
||||
|
||||
#include "global.h"
|
||||
@@ -12,11 +12,13 @@
|
||||
#include "RageUtil.h"
|
||||
#include "RageFileDriver.h"
|
||||
|
||||
#include <cstddef>
|
||||
|
||||
RageFile::RageFile()
|
||||
{
|
||||
m_File = nullptr;
|
||||
}
|
||||
|
||||
|
||||
RageFile::RageFile( const RageFile &cpy ):
|
||||
RageFileBasic( cpy )
|
||||
{
|
||||
@@ -143,7 +145,7 @@ void RageFile::SetError( const RString &err )
|
||||
m_sError = err;
|
||||
}
|
||||
|
||||
int RageFile::Read( void *pBuffer, size_t iBytes )
|
||||
int RageFile::Read( void *pBuffer, std::size_t iBytes )
|
||||
{
|
||||
ASSERT_READ;
|
||||
return m_File->Read( pBuffer, iBytes );
|
||||
@@ -179,14 +181,14 @@ int RageFile::Read( RString &buffer, int 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;
|
||||
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;
|
||||
return m_File->Write( buffer, bytes, nmemb );
|
||||
@@ -203,7 +205,7 @@ int RageFile::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;
|
||||
return m_File->Read( buffer, bytes, nmemb );
|
||||
@@ -317,7 +319,7 @@ int32_t FileReading::read_32_le( RageFileBasic &f, RString &sError )
|
||||
// lua start
|
||||
#include "LuaBinding.h"
|
||||
|
||||
/** @brief Allow Lua to have access to the RageFile. */
|
||||
/** @brief Allow Lua to have access to the RageFile. */
|
||||
class LunaRageFile: public Luna<RageFile>
|
||||
{
|
||||
public:
|
||||
@@ -393,7 +395,7 @@ public:
|
||||
lua_pushstring( L, string );
|
||||
return 1;
|
||||
}
|
||||
|
||||
|
||||
static int ReadBytes( T* p, lua_State *L )
|
||||
{
|
||||
can_safely_read(p, L);
|
||||
@@ -432,7 +434,7 @@ public:
|
||||
lua_pushinteger( L, p->PutLine( SArg(1) ) );
|
||||
return 1;
|
||||
}
|
||||
|
||||
|
||||
static int GetError( T* p, lua_State *L )
|
||||
{
|
||||
RString error;
|
||||
@@ -440,13 +442,13 @@ public:
|
||||
lua_pushstring( L, error );
|
||||
return 1;
|
||||
}
|
||||
|
||||
|
||||
static int ClearError( T* p, lua_State *L )
|
||||
{
|
||||
p->ClearError();
|
||||
return 1;
|
||||
}
|
||||
|
||||
|
||||
static int AtEOF( T* p, lua_State *L )
|
||||
{
|
||||
can_safely_read(p, L);
|
||||
@@ -454,7 +456,7 @@ public:
|
||||
return 1;
|
||||
}
|
||||
|
||||
LunaRageFile()
|
||||
LunaRageFile()
|
||||
{
|
||||
ADD_METHOD( Open );
|
||||
ADD_METHOD( Close );
|
||||
|
||||
+10
-7
@@ -4,12 +4,15 @@
|
||||
#define RAGE_FILE_H
|
||||
|
||||
#include "RageFileBasic.h"
|
||||
|
||||
#include <cstddef>
|
||||
|
||||
struct lua_State;
|
||||
|
||||
/**
|
||||
* @brief High-level file access.
|
||||
*
|
||||
* This is the high-level interface, which interfaces with RageFileObj
|
||||
* This is the high-level interface, which interfaces with RageFileObj
|
||||
* implementations and RageFileManager. */
|
||||
class RageFile: public RageFileBasic
|
||||
{
|
||||
@@ -58,15 +61,15 @@ public:
|
||||
int GetFD();
|
||||
|
||||
/* 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 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 Flush();
|
||||
|
||||
/* These are just here to make wrappers (eg. vorbisfile, SDL_rwops) easier. */
|
||||
int Write( const void *buffer, size_t bytes, int nmemb );
|
||||
int Read( void *buffer, size_t bytes, int nmemb );
|
||||
int Write( const void *buffer, std::size_t bytes, int nmemb );
|
||||
int Read( void *buffer, std::size_t bytes, int nmemb );
|
||||
int Seek( int offset, int whence );
|
||||
|
||||
/* Line-based I/O: */
|
||||
@@ -80,12 +83,12 @@ public:
|
||||
virtual void PushSelf( lua_State *L );
|
||||
private:
|
||||
void SetError( const RString &err );
|
||||
|
||||
|
||||
RageFileBasic *m_File;
|
||||
RString m_Path;
|
||||
RString m_sError;
|
||||
int m_Mode;
|
||||
|
||||
|
||||
// Swallow up warnings. If they must be used, define them.
|
||||
RageFile& operator=(const RageFile& rhs);
|
||||
};
|
||||
|
||||
@@ -3,6 +3,8 @@
|
||||
#include "RageUtil.h"
|
||||
#include "RageUtil_AutoPtr.h"
|
||||
|
||||
#include <cstddef>
|
||||
|
||||
REGISTER_CLASS_TRAITS( RageFileBasic, pCopy->Copy() );
|
||||
|
||||
RageFileObj::RageFileObj()
|
||||
@@ -99,7 +101,7 @@ int RageFileObj::Seek( int offset, int whence )
|
||||
return Seek( (int) offset );
|
||||
}
|
||||
|
||||
int RageFileObj::Read( void *pBuffer, size_t iBytes )
|
||||
int RageFileObj::Read( void *pBuffer, std::size_t iBytes )
|
||||
{
|
||||
int iRet = 0;
|
||||
|
||||
@@ -186,7 +188,7 @@ int RageFileObj::Read( RString &sBuffer, int iBytes )
|
||||
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 );
|
||||
if( iRet == -1 )
|
||||
@@ -228,7 +230,7 @@ int RageFileObj::EmptyWriteBuf()
|
||||
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 )
|
||||
{
|
||||
@@ -266,7 +268,7 @@ int RageFileObj::Write( const void *pBuffer, size_t iBytes )
|
||||
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. */
|
||||
int iRet = Write( pBuffer, iBytes*iNmemb ) / iBytes;
|
||||
|
||||
+14
-12
@@ -5,6 +5,8 @@
|
||||
|
||||
#include "global.h"
|
||||
|
||||
#include <cstddef>
|
||||
|
||||
/* 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
|
||||
* 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
|
||||
* does not necessarily mean that the end of the stream has been reached;
|
||||
* 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( 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. */
|
||||
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 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
|
||||
* all errors may be returned by it. Data will be flushed when the stream (or its
|
||||
@@ -71,20 +73,20 @@ public:
|
||||
|
||||
virtual RString GetError() const { return m_sError; }
|
||||
virtual void ClearError() { SetError(""); }
|
||||
|
||||
|
||||
bool AtEOF() const { return m_bEOF; }
|
||||
|
||||
int Seek( int iOffset );
|
||||
int Seek( int offset, int whence );
|
||||
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( 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 void *buffer, size_t bytes, int nmemb );
|
||||
int Write( const void *buffer, std::size_t bytes, int nmemb );
|
||||
|
||||
int Flush();
|
||||
|
||||
@@ -101,8 +103,8 @@ public:
|
||||
|
||||
protected:
|
||||
virtual int SeekInternal( int /* iOffset */ ) { FAIL_M( "Seeking unimplemented" ); }
|
||||
virtual int ReadInternal( void *pBuffer, size_t iBytes ) = 0;
|
||||
virtual int WriteInternal( const void *pBuffer, size_t iBytes ) = 0;
|
||||
virtual int ReadInternal( void *pBuffer, std::size_t iBytes ) = 0;
|
||||
virtual int WriteInternal( const void *pBuffer, std::size_t iBytes ) = 0;
|
||||
virtual int FlushInternal() { return 0; }
|
||||
|
||||
void EnableReadBuffering();
|
||||
@@ -154,7 +156,7 @@ private:
|
||||
* file, and no seeking is performed. */
|
||||
bool m_bCRC32Enabled;
|
||||
uint32_t m_iCRC32;
|
||||
|
||||
|
||||
// Swallow up warnings. If they must be used, define them.
|
||||
RageFileObj& operator=(const RageFileObj& rhs);
|
||||
};
|
||||
|
||||
@@ -4,6 +4,8 @@
|
||||
#include "RageFile.h"
|
||||
#include "RageLog.h"
|
||||
#include "RageUtil.h"
|
||||
|
||||
#include <cstddef>
|
||||
#include <memory>
|
||||
|
||||
#if defined(_WINDOWS)
|
||||
@@ -62,7 +64,7 @@ RageFileObjInflate *RageFileObjInflate::Copy() const
|
||||
{
|
||||
return new RageFileObjInflate( *this );
|
||||
}
|
||||
|
||||
|
||||
|
||||
RageFileObjInflate::~RageFileObjInflate()
|
||||
{
|
||||
@@ -76,13 +78,13 @@ RageFileObjInflate::~RageFileObjInflate()
|
||||
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
|
||||
* possible for a .gz to contain a header claiming 500k of data, but to actually
|
||||
* contain much more deflated data. */
|
||||
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;
|
||||
int ret = 0;
|
||||
@@ -221,7 +223,7 @@ RageFileObjDeflate::~RageFileObjDeflate()
|
||||
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 )
|
||||
{
|
||||
@@ -373,7 +375,7 @@ RageFileObjInflate *GunzipFile( RageFileBasic *pFile_, RString &sError, uint32_t
|
||||
if( iFlags & FCOMMENT )
|
||||
while( sError == "" && FileReading::read_8( *pFile, sError ) != 0 )
|
||||
;
|
||||
|
||||
|
||||
if( iFlags & FHCRC )
|
||||
{
|
||||
/* Get the CRC of the data read so far. Be sure to do this before
|
||||
@@ -381,7 +383,7 @@ RageFileObjInflate *GunzipFile( RageFileBasic *pFile_, RString &sError, uint32_t
|
||||
uint32_t iActualCRC32;
|
||||
bool bOK = pFile->GetCRC32( &iActualCRC32 );
|
||||
ASSERT( bOK );
|
||||
|
||||
|
||||
uint16_t iExpectedCRC16 = FileReading::read_u16_le( *pFile, sError );
|
||||
uint16_t iActualCRC16 = int16_t( iActualCRC32 & 0xFFFF );
|
||||
if( sError != "" )
|
||||
@@ -407,17 +409,17 @@ RageFileObjInflate *GunzipFile( RageFileBasic *pFile_, RString &sError, uint32_t
|
||||
int iFooterPos = pFile->GetFileSize() - 8;
|
||||
|
||||
FileReading::Seek( *pFile, iFooterPos, sError );
|
||||
|
||||
|
||||
uint32_t iExpectedCRC32 = FileReading::read_u32_le( *pFile, sError );
|
||||
uint32_t iUncompressedSize = FileReading::read_u32_le( *pFile, sError );
|
||||
if( iCRC32 != nullptr )
|
||||
*iCRC32 = iExpectedCRC32;
|
||||
|
||||
|
||||
FileReading::Seek( *pFile, iDataPos, sError );
|
||||
|
||||
|
||||
if( sError != "" )
|
||||
return nullptr;
|
||||
|
||||
|
||||
RageFileDriverSlice *pSliceFile = new RageFileDriverSlice( pFile.release(), iDataPos, iFooterPos-iDataPos );
|
||||
pSliceFile->DeleteFileWhenFinished();
|
||||
RageFileObjInflate *pInflateFile = new RageFileObjInflate( pSliceFile, iUncompressedSize );
|
||||
@@ -440,7 +442,7 @@ RageFileObjInflate *GunzipFile( RageFileBasic *pFile_, RString &sError, uint32_t
|
||||
* gzip.Start();
|
||||
* gzip.Write( "data" );
|
||||
* gzip.Finish();
|
||||
*/
|
||||
*/
|
||||
RageFileObjGzip::RageFileObjGzip( RageFileBasic *pFile ):
|
||||
RageFileObjDeflate( pFile )
|
||||
{
|
||||
@@ -465,7 +467,7 @@ int RageFileObjGzip::Start()
|
||||
|
||||
if( m_pFile->Write( header, sizeof(header) ) == -1 )
|
||||
return -1;
|
||||
|
||||
|
||||
m_iDataStartOffset = Tell();
|
||||
|
||||
/* Enable and reset the CRC32 for the uncompressed data about to be
|
||||
@@ -506,7 +508,7 @@ int RageFileObjGzip::Finish()
|
||||
SetError( m_pFile->GetError() );
|
||||
return -1;
|
||||
}
|
||||
|
||||
|
||||
/* Flush the CRC and wize that we just wrote directly to the file. */
|
||||
return m_pFile->Flush();
|
||||
}
|
||||
|
||||
@@ -5,6 +5,8 @@
|
||||
|
||||
#include "RageFileBasic.h"
|
||||
|
||||
#include <cstddef>
|
||||
|
||||
typedef struct z_stream_s z_stream;
|
||||
|
||||
class RageFileObjInflate: public RageFileObj
|
||||
@@ -15,8 +17,8 @@ public:
|
||||
RageFileObjInflate( RageFileBasic *pFile, int iUncompressedSize );
|
||||
RageFileObjInflate( const RageFileObjInflate &cpy );
|
||||
~RageFileObjInflate();
|
||||
int ReadInternal( void *pBuffer, size_t iBytes );
|
||||
int WriteInternal( const void * /* pBuffer */, size_t /* iBytes */ ) { SetError( "Not implemented" ); return -1; }
|
||||
int ReadInternal( void *pBuffer, std::size_t iBytes );
|
||||
int WriteInternal( const void * /* pBuffer */, std::size_t /* iBytes */ ) { SetError( "Not implemented" ); return -1; }
|
||||
int SeekInternal( int iOffset );
|
||||
int GetFileSize() const { return m_iUncompressedSize; }
|
||||
int GetFD() { return m_pFile->GetFD(); }
|
||||
@@ -47,10 +49,10 @@ public:
|
||||
void DeleteFileWhenFinished() { m_bFileOwned = true; }
|
||||
|
||||
protected:
|
||||
int ReadInternal( void * /* pBuffer */, size_t /* iBytes */ ) { SetError( "Not implemented" ); return -1; }
|
||||
int WriteInternal( const void *pBuffer, size_t iBytes );
|
||||
int ReadInternal( void * /* pBuffer */, std::size_t /* iBytes */ ) { SetError( "Not implemented" ); return -1; }
|
||||
int WriteInternal( const void *pBuffer, std::size_t iBytes );
|
||||
int FlushInternal();
|
||||
|
||||
|
||||
RageFileBasic *m_pFile;
|
||||
z_stream *m_pDeflate;
|
||||
bool m_bFileOwned;
|
||||
|
||||
@@ -10,6 +10,7 @@
|
||||
#include <fcntl.h>
|
||||
#endif
|
||||
#include <cerrno>
|
||||
#include <cstddef>
|
||||
#include <sys/types.h>
|
||||
#include <sys/stat.h>
|
||||
|
||||
@@ -296,7 +297,7 @@ bool RageFileObjDirect::FinalFlush()
|
||||
/* Only do the rest of the flushes if SLOW_FLUSH is enabled. */
|
||||
if( !(m_iMode & RageFile::SLOW_FLUSH) )
|
||||
return true;
|
||||
|
||||
|
||||
/* Force a kernel buffer flush. */
|
||||
if( fsync( m_iFD ) == -1 )
|
||||
{
|
||||
@@ -319,7 +320,7 @@ bool RageFileObjDirect::FinalFlush()
|
||||
RageFileObjDirect::~RageFileObjDirect()
|
||||
{
|
||||
bool bFailed = !FinalFlush();
|
||||
|
||||
|
||||
if( m_iFD != -1 )
|
||||
{
|
||||
if( DoClose( m_iFD ) == -1 )
|
||||
@@ -363,7 +364,7 @@ RageFileObjDirect::~RageFileObjDirect()
|
||||
#else
|
||||
if( rename( sOldPath, sNewPath ) == -1 )
|
||||
{
|
||||
WARN( ssprintf("Error renaming \"%s\" to \"%s\": %s",
|
||||
WARN( ssprintf("Error renaming \"%s\" to \"%s\": %s",
|
||||
sOldPath.c_str(), sNewPath.c_str(), strerror(errno)) );
|
||||
SetError( strerror(errno) );
|
||||
break;
|
||||
@@ -389,7 +390,7 @@ RageFileObjDirect::~RageFileObjDirect()
|
||||
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 );
|
||||
if( iRet == -1 )
|
||||
@@ -402,7 +403,7 @@ int RageFileObjDirect::ReadInternal( void *pBuf, size_t iBytes )
|
||||
}
|
||||
|
||||
// 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;
|
||||
do
|
||||
@@ -426,7 +427,7 @@ int RageFileObjDirect::FlushInternal()
|
||||
return 0;
|
||||
}
|
||||
|
||||
int RageFileObjDirect::WriteInternal( const void *pBuf, size_t iBytes )
|
||||
int RageFileObjDirect::WriteInternal( const void *pBuf, std::size_t iBytes )
|
||||
{
|
||||
if( WriteFailed() )
|
||||
{
|
||||
|
||||
@@ -4,6 +4,8 @@
|
||||
#include "RageFile.h"
|
||||
#include "RageFileDriver.h"
|
||||
|
||||
#include <cstddef>
|
||||
|
||||
/** @brief File driver for accessing a regular filesystem. */
|
||||
class RageFileDriverDirect: public RageFileDriver
|
||||
{
|
||||
@@ -35,22 +37,22 @@ class RageFileObjDirect: public RageFileObj
|
||||
public:
|
||||
RageFileObjDirect( const RString &sPath, int iFD, int iMode );
|
||||
virtual ~RageFileObjDirect();
|
||||
virtual int ReadInternal( void *pBuffer, size_t iBytes );
|
||||
virtual int WriteInternal( const void *pBuffer, size_t iBytes );
|
||||
virtual int ReadInternal( void *pBuffer, std::size_t iBytes );
|
||||
virtual int WriteInternal( const void *pBuffer, std::size_t iBytes );
|
||||
virtual int FlushInternal();
|
||||
virtual int SeekInternal( int offset );
|
||||
virtual RageFileObjDirect *Copy() const;
|
||||
virtual RString GetDisplayPath() const { return m_sPath; }
|
||||
virtual int GetFileSize() const;
|
||||
virtual int GetFD();
|
||||
|
||||
|
||||
private:
|
||||
bool FinalFlush();
|
||||
|
||||
|
||||
int m_iFD;
|
||||
int m_iMode;
|
||||
RString m_sPath; /* for Copy */
|
||||
|
||||
|
||||
/*
|
||||
* When not streaming to disk, we write to a temporary file, and rename to the
|
||||
* real file on completion. If any write, this is aborted. When streaming to
|
||||
@@ -58,7 +60,7 @@ private:
|
||||
*/
|
||||
bool m_bWriteFailed;
|
||||
bool WriteFailed() const { return !(m_iMode & RageFile::STREAMED) && m_bWriteFailed; }
|
||||
|
||||
|
||||
// unused
|
||||
RageFileObjDirect& operator=(const RageFileObjDirect& rhs);
|
||||
RageFileObjDirect(const RageFileObjDirect& rhs);
|
||||
|
||||
@@ -3,6 +3,8 @@
|
||||
#include "RageFile.h"
|
||||
#include "RageUtil.h"
|
||||
#include "RageUtil_FileDB.h"
|
||||
|
||||
#include <cstddef>
|
||||
#include <errno.h>
|
||||
|
||||
struct RageFileObjMemFile
|
||||
@@ -49,12 +51,12 @@ RageFileObjMem::~RageFileObjMem()
|
||||
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);
|
||||
|
||||
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 )
|
||||
return 0;
|
||||
memcpy( buffer, &m_pFile->m_sBuf[m_iFilePos], bytes );
|
||||
@@ -63,7 +65,7 @@ int RageFileObjMem::ReadInternal( void *buffer, size_t 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_sBuf.replace( m_iFilePos, bytes, (const char *) buffer, bytes );
|
||||
@@ -184,7 +186,7 @@ static struct FileDriverEntry_MEM: public FileDriverEntry
|
||||
/*
|
||||
* (c) 2004 Glenn Maynard
|
||||
* All rights reserved.
|
||||
*
|
||||
*
|
||||
* Permission is hereby granted, free of charge, to any person obtaining a
|
||||
* copy of this software and associated documentation files (the
|
||||
* "Software"), to deal in the Software without restriction, including
|
||||
@@ -194,7 +196,7 @@ static struct FileDriverEntry_MEM: public FileDriverEntry
|
||||
* copyright notice(s) and this permission notice appear in all copies of
|
||||
* the Software and that both the above copyright notice(s) and this
|
||||
* permission notice appear in supporting documentation.
|
||||
*
|
||||
*
|
||||
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
|
||||
* OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
||||
* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT OF
|
||||
|
||||
@@ -7,6 +7,8 @@
|
||||
#include "RageFileBasic.h"
|
||||
#include "RageThreads.h"
|
||||
|
||||
#include <cstddef>
|
||||
|
||||
struct RageFileObjMemFile;
|
||||
class RageFileObjMem: public RageFileObj
|
||||
{
|
||||
@@ -15,8 +17,8 @@ public:
|
||||
RageFileObjMem( const RageFileObjMem &cpy );
|
||||
~RageFileObjMem();
|
||||
|
||||
int ReadInternal( void *buffer, size_t bytes );
|
||||
int WriteInternal( const void *buffer, size_t bytes );
|
||||
int ReadInternal( void *buffer, std::size_t bytes );
|
||||
int WriteInternal( const void *buffer, std::size_t bytes );
|
||||
int SeekInternal( int offset );
|
||||
int GetFileSize() const;
|
||||
RageFileObjMem *Copy() const;
|
||||
@@ -51,7 +53,7 @@ private:
|
||||
/*
|
||||
* (c) 2004 Glenn Maynard
|
||||
* All rights reserved.
|
||||
*
|
||||
*
|
||||
* Permission is hereby granted, free of charge, to any person obtaining a
|
||||
* copy of this software and associated documentation files (the
|
||||
* "Software"), to deal in the Software without restriction, including
|
||||
@@ -61,7 +63,7 @@ private:
|
||||
* copyright notice(s) and this permission notice appear in all copies of
|
||||
* the Software and that both the above copyright notice(s) and this
|
||||
* permission notice appear in supporting documentation.
|
||||
*
|
||||
*
|
||||
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
|
||||
* OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
||||
* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT OF
|
||||
|
||||
@@ -47,6 +47,7 @@
|
||||
#include <fcntl.h>
|
||||
#endif
|
||||
#include <cerrno>
|
||||
#include <cstddef>
|
||||
#if defined(WIN32)
|
||||
#include <io.h>
|
||||
#endif
|
||||
@@ -115,7 +116,7 @@ void RageFileDriverReadAhead::FillBuffer( int iBytes )
|
||||
RageFileManagerReadAhead::CacheHintStreaming( m_pFile );
|
||||
}
|
||||
|
||||
int RageFileDriverReadAhead::ReadInternal( void *pBuffer, size_t iBytes )
|
||||
int RageFileDriverReadAhead::ReadInternal( void *pBuffer, std::size_t iBytes )
|
||||
{
|
||||
int iRet = -1;
|
||||
if( m_bReadAheadNeeded && m_iFilePos < (int) m_sBuffer.size() )
|
||||
|
||||
@@ -5,6 +5,8 @@
|
||||
|
||||
#include "RageFileBasic.h"
|
||||
|
||||
#include <cstddef>
|
||||
|
||||
class RageFileDriverReadAhead: public RageFileObj
|
||||
{
|
||||
public:
|
||||
@@ -22,8 +24,8 @@ public:
|
||||
virtual RString GetError() const { return m_pFile->GetError(); }
|
||||
virtual void ClearError() { return m_pFile->ClearError(); }
|
||||
|
||||
int ReadInternal( void *pBuffer, size_t iBytes );
|
||||
int WriteInternal( const void *pBuffer, size_t iBytes ) { return m_pFile->Write( pBuffer, iBytes ); }
|
||||
int ReadInternal( void *pBuffer, std::size_t iBytes );
|
||||
int WriteInternal( const void *pBuffer, std::size_t iBytes ) { return m_pFile->Write( pBuffer, iBytes ); }
|
||||
int SeekInternal( int iOffset );
|
||||
int GetFileSize() const { return m_pFile->GetFileSize(); }
|
||||
int GetFD() { return m_pFile->GetFD(); }
|
||||
|
||||
@@ -1,6 +1,8 @@
|
||||
#include "global.h"
|
||||
#include "RageFileDriverSlice.h"
|
||||
|
||||
#include <cstddef>
|
||||
|
||||
RageFileDriverSlice::RageFileDriverSlice( RageFileBasic *pFile, int iOffset, int iFileSize )
|
||||
{
|
||||
m_pFile = pFile;
|
||||
@@ -32,7 +34,7 @@ RageFileDriverSlice *RageFileDriverSlice::Copy() const
|
||||
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
|
||||
* with a file not pointing to iOffset. */
|
||||
|
||||
@@ -5,6 +5,8 @@
|
||||
|
||||
#include "RageFileBasic.h"
|
||||
|
||||
#include <cstddef>
|
||||
|
||||
class RageFileDriverSlice: public RageFileObj
|
||||
{
|
||||
public:
|
||||
@@ -16,8 +18,8 @@ public:
|
||||
|
||||
void DeleteFileWhenFinished() { m_bFileOwned = true; }
|
||||
|
||||
int ReadInternal( void *pBuffer, size_t iBytes );
|
||||
int WriteInternal( const void * /* pBuffer */, size_t /* iBytes */ ) { SetError( "Not implemented" ); return -1; }
|
||||
int ReadInternal( void *pBuffer, std::size_t iBytes );
|
||||
int WriteInternal( const void * /* pBuffer */, std::size_t /* iBytes */ ) { SetError( "Not implemented" ); return -1; }
|
||||
int SeekInternal( int iOffset );
|
||||
int GetFileSize() const { return m_iFileSize; }
|
||||
int GetFD() { return m_pFile->GetFD(); }
|
||||
|
||||
@@ -28,7 +28,7 @@
|
||||
* an operation times out, we'll refuse all further access until all operations have
|
||||
* finished and exited. (Load a separate driver for each device, so if one device fails,
|
||||
* others continue to function.)
|
||||
*
|
||||
*
|
||||
* All operations must run in the thread, including retrieving directory lists, Open()
|
||||
* and deleting file objects. Read/write operations are copied through an intermediate
|
||||
* buffer, so we don't clobber stuff if the operation times out, the call returns and the
|
||||
@@ -47,7 +47,9 @@
|
||||
#include "RageUtil_FileDB.h"
|
||||
#include "RageUtil_WorkerThread.h"
|
||||
#include "RageLog.h"
|
||||
#include <errno.h>
|
||||
|
||||
#include <cerrno>
|
||||
#include <cstddef>
|
||||
|
||||
enum ThreadRequest
|
||||
{
|
||||
@@ -354,7 +356,7 @@ void ThreadedFileWorker::Close( RageFileBasic *pFile )
|
||||
int ThreadedFileWorker::GetFileSize( RageFileBasic *&pFile )
|
||||
{
|
||||
ASSERT( m_pChildDriver != nullptr ); /* how did you get a file to begin with? */
|
||||
|
||||
|
||||
/* If we're currently in a timed-out state, fail. */
|
||||
if( IsTimedOut() )
|
||||
{
|
||||
@@ -382,7 +384,7 @@ int ThreadedFileWorker::GetFileSize( RageFileBasic *&pFile )
|
||||
int ThreadedFileWorker::GetFD( RageFileBasic *&pFile )
|
||||
{
|
||||
ASSERT( m_pChildDriver != nullptr ); /* how did you get a file to begin with? */
|
||||
|
||||
|
||||
/* If we're currently in a timed-out state, fail. */
|
||||
if( IsTimedOut() )
|
||||
{
|
||||
@@ -778,7 +780,7 @@ protected:
|
||||
}
|
||||
|
||||
|
||||
int ReadInternal( void *pBuffer, size_t iBytes )
|
||||
int ReadInternal( void *pBuffer, std::size_t iBytes )
|
||||
{
|
||||
RString sError;
|
||||
int iRet = m_pWorker->Read( m_pFile, pBuffer, iBytes, sError );
|
||||
@@ -795,7 +797,7 @@ protected:
|
||||
return iRet;
|
||||
}
|
||||
|
||||
int WriteInternal( const void *pBuffer, size_t iBytes )
|
||||
int WriteInternal( const void *pBuffer, std::size_t iBytes )
|
||||
{
|
||||
RString sError;
|
||||
int iRet = m_pWorker->Write( m_pFile, pBuffer, iBytes, sError );
|
||||
@@ -916,7 +918,7 @@ bool RageFileDriverTimeout::Move( const RString &sOldPath, const RString &sNewPa
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
bool RageFileDriverTimeout::Remove( const RString &sPath )
|
||||
{
|
||||
int iRet = m_pWorker->Remove( sPath );
|
||||
|
||||
+26
-24
@@ -10,12 +10,14 @@
|
||||
#include "LuaManager.h"
|
||||
|
||||
#include <cerrno>
|
||||
#include <cstddef>
|
||||
#include <sstream>
|
||||
|
||||
#if defined(WIN32)
|
||||
#include <windows.h>
|
||||
#elif defined(UNIX) || defined(MACOSX)
|
||||
#include <paths.h>
|
||||
#include <sys/types.h>
|
||||
#endif
|
||||
|
||||
#include <miniz.h>
|
||||
@@ -110,7 +112,7 @@ void RageFileManager::ReleaseFileDriver( RageFileDriver *pDriver )
|
||||
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);
|
||||
|
||||
@@ -123,7 +125,7 @@ size_t zipRead(void *pOpaque, mz_uint64 file_ofs, void *pBuf, size_t 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);
|
||||
|
||||
@@ -187,7 +189,7 @@ bool RageFileManager::Unzip(const std::string &zipPath, std::string targetPath,
|
||||
|
||||
for (int i = 0; i < strip; i++)
|
||||
{
|
||||
size_t pos = filename.find('/');
|
||||
std::size_t pos = filename.find('/');
|
||||
if (pos != std::string::npos)
|
||||
pos++;
|
||||
filename.erase(0, pos);
|
||||
@@ -297,7 +299,7 @@ static RageFileDriverMountpoints *g_Mountpoints = nullptr;
|
||||
static RString ExtractDirectory( RString 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 )
|
||||
sPath.erase(n);
|
||||
else
|
||||
@@ -421,7 +423,7 @@ RageFileManager::RageFileManager( const RString &argv0 )
|
||||
{
|
||||
CHECKPOINT_M( argv0 );
|
||||
ChangeToDirOfExecutable( argv0 );
|
||||
|
||||
|
||||
g_Mutex = new RageEvent("RageFileManager");
|
||||
|
||||
g_Mountpoints = new RageFileDriverMountpoints;
|
||||
@@ -484,7 +486,7 @@ RString LoadedDriver::GetPath( const RString &sPath ) const
|
||||
if( m_sMountPoint.size() < 2 || m_sMountPoint[1] != '@' )
|
||||
return RString();
|
||||
}
|
||||
|
||||
|
||||
if( sPath.Left(m_sMountPoint.size()).CompareNoCase(m_sMountPoint) )
|
||||
return RString(); /* no match */
|
||||
|
||||
@@ -499,7 +501,7 @@ void RageFileManager::GetDirListing( const RString &sPath_, std::vector<RString>
|
||||
{
|
||||
RString sPath = sPath_;
|
||||
NormalizePath( sPath );
|
||||
|
||||
|
||||
// NormalizePath() calls CollapsePath() which will remove "dir/.." pairs.
|
||||
// So if a "/.." is still present, they're trying to go below the root,
|
||||
// which isn't valid.
|
||||
@@ -519,7 +521,7 @@ void RageFileManager::GetDirListing( const RString &sPath_, std::vector<RString>
|
||||
continue;
|
||||
|
||||
const unsigned OldStart = AddTo.size();
|
||||
|
||||
|
||||
pLoadedDriver->m_pDriver->GetDirListing( p, AddTo, bOnlyDirs, bReturnPathToo );
|
||||
if( AddTo.size() != OldStart )
|
||||
++iDriversThatReturnedFiles;
|
||||
@@ -572,7 +574,7 @@ bool RageFileManager::Move( const RString &fromPath_, const RString &toPath_ )
|
||||
|
||||
NormalizePath( fromPath );
|
||||
NormalizePath( toPath );
|
||||
|
||||
|
||||
/* Multiple drivers may have the same file. */
|
||||
bool Deleted = false;
|
||||
for( unsigned i = 0; i < aDriverList.size(); ++i )
|
||||
@@ -630,7 +632,7 @@ bool RageFileManager::Remove( const RString &sPath_ )
|
||||
ReferenceAllDrivers( apDriverList );
|
||||
|
||||
NormalizePath( sPath );
|
||||
|
||||
|
||||
/* Multiple drivers may have the same file. */
|
||||
bool bDeleted = false;
|
||||
for( unsigned i = 0; i < apDriverList.size(); ++i )
|
||||
@@ -669,7 +671,7 @@ void RageFileManager::CreateDir( const RString &sDir )
|
||||
static void AdjustMountpoint( RString &sMountPoint )
|
||||
{
|
||||
FixSlashesInPlace( sMountPoint );
|
||||
|
||||
|
||||
ASSERT_M( sMountPoint.Left(1) == "/", "Mountpoints must be absolute: " + sMountPoint );
|
||||
|
||||
if( sMountPoint.size() && sMountPoint.Right(1) != "/" )
|
||||
@@ -928,35 +930,35 @@ RString RageFileManager::ResolvePath(const RString &path)
|
||||
{
|
||||
RString tmpPath = path;
|
||||
NormalizePath(tmpPath);
|
||||
|
||||
|
||||
RString resolvedPath = tmpPath;
|
||||
|
||||
std::vector<LoadedDriver *> apDriverList;
|
||||
ReferenceAllDrivers( apDriverList );
|
||||
|
||||
|
||||
for( unsigned i = 0; i < apDriverList.size(); ++i )
|
||||
{
|
||||
LoadedDriver *pDriver = apDriverList[i];
|
||||
const RString driverPath = pDriver->GetPath( tmpPath );
|
||||
|
||||
|
||||
if ( driverPath.empty() || pDriver->m_sRoot.empty() )
|
||||
continue;
|
||||
|
||||
|
||||
if ( pDriver->m_sType != "dir" && pDriver->m_sType != "dirro" )
|
||||
continue;
|
||||
|
||||
|
||||
int iMountPointLen = pDriver->m_sMountPoint.length();
|
||||
if( tmpPath.substr(0, iMountPointLen) != pDriver->m_sMountPoint )
|
||||
continue;
|
||||
|
||||
|
||||
resolvedPath = pDriver->m_sRoot + "/" + RString(tmpPath.substr(iMountPointLen));
|
||||
break;
|
||||
}
|
||||
|
||||
|
||||
UnreferenceAllDrivers( apDriverList );
|
||||
|
||||
|
||||
NormalizePath( resolvedPath );
|
||||
|
||||
|
||||
return resolvedPath;
|
||||
}
|
||||
|
||||
@@ -1010,9 +1012,9 @@ RageFileBasic *RageFileManager::Open( const RString &sPath_, int mode, int &err
|
||||
void RageFileManager::CacheFile( const RageFileBasic *fb, const RString &sPath_ )
|
||||
{
|
||||
std::map<const RageFileBasic*, LoadedDriver*>::iterator it = g_mFileDriverMap.find( fb );
|
||||
|
||||
|
||||
ASSERT_M( it != g_mFileDriverMap.end(), ssprintf("No recorded driver for file: %s", sPath_.c_str()) );
|
||||
|
||||
|
||||
RString sPath = sPath_;
|
||||
NormalizePath( sPath );
|
||||
sPath = it->second->GetPath( sPath );
|
||||
@@ -1254,13 +1256,13 @@ unsigned int GetHashForDirectory( const RString &sDir )
|
||||
hash += GetHashForFile( sFilePath );
|
||||
}
|
||||
|
||||
return hash;
|
||||
return hash;
|
||||
}
|
||||
|
||||
// lua start
|
||||
#include "LuaBinding.h"
|
||||
|
||||
/** @brief Allow Lua to have access to the RageFileManager. */
|
||||
/** @brief Allow Lua to have access to the RageFileManager. */
|
||||
class LunaRageFileManager: public Luna<RageFileManager>
|
||||
{
|
||||
public:
|
||||
|
||||
@@ -13,6 +13,7 @@
|
||||
#include <sys/types.h>
|
||||
#endif
|
||||
#include <cerrno>
|
||||
#include <cstddef>
|
||||
#if defined(WIN32)
|
||||
#include <io.h>
|
||||
#endif
|
||||
@@ -115,7 +116,7 @@ static std::vector<RageFileReadAheadThread *> g_apReadAheads;
|
||||
void RageFileManagerReadAhead::Init() { }
|
||||
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];
|
||||
g_apReadAheads.clear();
|
||||
}
|
||||
@@ -140,7 +141,7 @@ void RageFileManagerReadAhead::ReadAhead( RageFileBasic *pFile, int iBytes )
|
||||
RageFileReadAheadThread *pReadAhead = new RageFileReadAheadThread( iFD, iStart, iBytes );
|
||||
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() )
|
||||
{
|
||||
|
||||
@@ -13,6 +13,7 @@
|
||||
#include "RageThreads.h"
|
||||
|
||||
#include <cmath>
|
||||
#include <cstddef>
|
||||
#include <numeric>
|
||||
|
||||
/* 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. */
|
||||
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();
|
||||
}
|
||||
|
||||
@@ -602,14 +603,14 @@ void RageSoundReader_Resample_Good::GetFactors( int &iDownFactor, int &iUpFactor
|
||||
/* Call this if the sample factor changes. */
|
||||
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];
|
||||
m_apResamplers.clear();
|
||||
|
||||
int 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 iMaxDownFactor = iDownFactor;
|
||||
@@ -623,13 +624,13 @@ void RageSoundReader_Resample_Good::ReopenResampler()
|
||||
if( m_fRate != -1 )
|
||||
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 );
|
||||
}
|
||||
|
||||
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];
|
||||
}
|
||||
|
||||
@@ -702,7 +703,7 @@ void RageSoundReader_Resample_Good::SetRate( float fRatio )
|
||||
/* Set m_fRate to the actual rate, after quantization by 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 );
|
||||
}
|
||||
|
||||
@@ -717,7 +718,7 @@ float RageSoundReader_Resample_Good::GetRate() const
|
||||
RageSoundReader_Resample_Good::RageSoundReader_Resample_Good( const RageSoundReader_Resample_Good &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_iSampleRate = cpy.m_iSampleRate;
|
||||
this->m_fRate = cpy.m_fRate;
|
||||
|
||||
@@ -4,6 +4,7 @@
|
||||
#include "RageLog.h"
|
||||
|
||||
#include <cmath>
|
||||
#include <cstddef>
|
||||
|
||||
static const int WINDOW_SIZE_MS = 30;
|
||||
|
||||
@@ -35,7 +36,7 @@ void RageSoundReader_SpeedChange::Reset()
|
||||
{
|
||||
m_fTrailingSpeedRatio = m_fSpeedRatio;
|
||||
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];
|
||||
c.m_iCorrelatedPos = 0;
|
||||
@@ -101,7 +102,7 @@ int RageSoundReader_SpeedChange::FillData( int iMaxFrames )
|
||||
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];
|
||||
|
||||
@@ -133,7 +134,7 @@ void RageSoundReader_SpeedChange::EraseData( int iFramesToDelete )
|
||||
int iFramesToMove = m_iDataBufferAvailFrames - iFramesToDelete;
|
||||
m_iDataBufferAvailFrames -= 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];
|
||||
if( iFramesToMove )
|
||||
@@ -153,7 +154,7 @@ int RageSoundReader_SpeedChange::Step()
|
||||
{
|
||||
/* 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. */
|
||||
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 );
|
||||
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. */
|
||||
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];
|
||||
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. */
|
||||
{
|
||||
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() );
|
||||
|
||||
int iGot = FillData( iMaxPositionNeeded );
|
||||
@@ -211,7 +212,7 @@ int RageSoundReader_SpeedChange::Step()
|
||||
int iCorrelatedToMatch = GetWindowSizeFrames()/4;
|
||||
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];
|
||||
ASSERT( c.m_iCorrelatedPos >= 0 );
|
||||
@@ -228,7 +229,7 @@ int RageSoundReader_SpeedChange::Step()
|
||||
int RageSoundReader_SpeedChange::GetCursorAvail() const
|
||||
{
|
||||
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;
|
||||
iCursorAvail = std::min( iCursorAvail, iCursorAvailForChannel );
|
||||
@@ -274,7 +275,7 @@ int RageSoundReader_SpeedChange::Read( float *pBuf, int iFrames )
|
||||
int iWindowSizeFrames = GetWindowSizeFrames();
|
||||
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];
|
||||
float i1 = c.m_DataBuffer[c.m_iCorrelatedPos+m_iPos];
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
#include "global.h"
|
||||
|
||||
#include "RageFile.h"
|
||||
#include "RageUtil.h"
|
||||
#include "RageSoundReader_Vorbisfile.h"
|
||||
#include "RageLog.h"
|
||||
@@ -10,10 +11,11 @@
|
||||
#include <vorbis/vorbisfile.h>
|
||||
#endif
|
||||
|
||||
#include <cstring>
|
||||
#include <cerrno>
|
||||
#include "RageFile.h"
|
||||
static size_t OggRageFile_read_func( void *ptr, size_t size, size_t nmemb, void *datasource )
|
||||
#include <cstddef>
|
||||
#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;
|
||||
return f->Read( ptr, size, nmemb );
|
||||
@@ -115,7 +117,7 @@ int RageSoundReader_Vorbisfile::GetLength() const
|
||||
if( len == OV_EINVAL )
|
||||
RageException::Throw( "RageSoundReader_Vorbisfile::GetLength: ov_time_total returned OV_EINVAL." );
|
||||
|
||||
return len;
|
||||
return len;
|
||||
}
|
||||
|
||||
int RageSoundReader_Vorbisfile::SetPosition( int iFrame )
|
||||
@@ -157,7 +159,7 @@ int RageSoundReader_Vorbisfile::Read( float *buf, int iFrames )
|
||||
{
|
||||
/* The timestamps moved backwards. Ignore it. This file probably
|
||||
* won't sync correctly. */
|
||||
LOG->Trace( "p ahead %p %i < %i, we're ahead by %i",
|
||||
LOG->Trace( "p ahead %p %i < %i, we're ahead by %i",
|
||||
static_cast<void*>(this), curofs, read_offset, read_offset-curofs );
|
||||
read_offset = curofs;
|
||||
}
|
||||
|
||||
@@ -6,6 +6,7 @@
|
||||
#include "RageFile.h"
|
||||
|
||||
#include <cmath>
|
||||
#include <cstddef>
|
||||
|
||||
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 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 A = (index & Amask) >> Ashift;
|
||||
|
||||
@@ -5,6 +5,7 @@
|
||||
#include "RageFile.h"
|
||||
#include "RageSurface.h"
|
||||
|
||||
#include <cstddef>
|
||||
#include <setjmp.h>
|
||||
|
||||
extern "C" {
|
||||
@@ -26,7 +27,7 @@ extern "C" {
|
||||
struct my_jpeg_error_mgr
|
||||
{
|
||||
struct jpeg_error_mgr pub; /* "public" fields */
|
||||
|
||||
|
||||
char errorbuf[JMSG_LENGTH_MAX];
|
||||
jmp_buf setjmp_buffer; /* for return to caller */
|
||||
};
|
||||
@@ -66,7 +67,7 @@ void RageFile_JPEG_init_source( j_decompress_ptr cinfo )
|
||||
boolean RageFile_JPEG_fill_input_buffer( j_decompress_ptr cinfo )
|
||||
{
|
||||
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 )
|
||||
{
|
||||
@@ -113,14 +114,14 @@ static RageSurface *RageSurface_Load_JPEG( RageFile *f, const char *fn, char err
|
||||
cinfo.err = jpeg_std_error(&jerr.pub);
|
||||
jerr.pub.error_exit = my_error_exit;
|
||||
jerr.pub.output_message = my_output_message;
|
||||
|
||||
|
||||
RageSurface *volatile img = nullptr; /* volatile to prevent possible problems with setjmp */
|
||||
|
||||
if( setjmp(jerr.setjmp_buffer) )
|
||||
{
|
||||
my_jpeg_error_mgr *myerr = (my_jpeg_error_mgr *) cinfo.err;
|
||||
memcpy( errorbuf, myerr->errorbuf, JMSG_LENGTH_MAX );
|
||||
|
||||
|
||||
jpeg_destroy_decompress( &cinfo );
|
||||
delete img;
|
||||
return nullptr;
|
||||
@@ -217,7 +218,7 @@ RageSurfaceUtils::OpenResult RageSurface_Load_JPEG( const RString &sPath, RageSu
|
||||
/*
|
||||
* (c) 2004 Glenn Maynard
|
||||
* All rights reserved.
|
||||
*
|
||||
*
|
||||
* Permission is hereby granted, free of charge, to any person obtaining a
|
||||
* copy of this software and associated documentation files (the
|
||||
* "Software"), to deal in the Software without restriction, including
|
||||
@@ -227,7 +228,7 @@ RageSurfaceUtils::OpenResult RageSurface_Load_JPEG( const RString &sPath, RageSu
|
||||
* copyright notice(s) and this permission notice appear in all copies of
|
||||
* the Software and that both the above copyright notice(s) and this
|
||||
* permission notice appear in supporting documentation.
|
||||
*
|
||||
*
|
||||
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
|
||||
* OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
||||
* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT OF
|
||||
|
||||
@@ -6,6 +6,8 @@
|
||||
#include "RageUtil.h"
|
||||
#include "RageFile.h"
|
||||
|
||||
#include <cstddef>
|
||||
|
||||
#undef FAR // fix for VC
|
||||
/** @brief A helper to get the jpeg lib. */
|
||||
namespace jpeg
|
||||
@@ -102,7 +104,7 @@ bool RageSurfaceUtils::SaveJPEG( RageSurface *surface, RageFile &f, bool bHighQu
|
||||
|
||||
/* Now we can initialize the JPEG compression object. */
|
||||
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_height = surface->h;
|
||||
|
||||
+65
-64
@@ -14,6 +14,7 @@
|
||||
|
||||
#include <cfloat>
|
||||
#include <cmath>
|
||||
#include <cstddef>
|
||||
#include <ctime>
|
||||
#include <functional>
|
||||
#include <map>
|
||||
@@ -26,7 +27,7 @@ const RString CUSTOM_SONG_PATH= "/@mem/";
|
||||
|
||||
bool HexToBinary(const RString&, 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;
|
||||
|
||||
@@ -145,7 +146,7 @@ bool IsAnInt( const RString &s )
|
||||
if( !s.size() )
|
||||
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' )
|
||||
return false;
|
||||
|
||||
@@ -157,7 +158,7 @@ bool IsHexVal( const RString &s )
|
||||
if( !s.size() )
|
||||
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') &&
|
||||
!(toupper(s[i]) >= 'A' && toupper(s[i]) <= 'F'))
|
||||
return false;
|
||||
@@ -165,11 +166,11 @@ bool IsHexVal( const RString &s )
|
||||
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_;
|
||||
RString s;
|
||||
for( size_t i=0; i<iNumBytes; i++ )
|
||||
for( std::size_t i=0; i<iNumBytes; i++ )
|
||||
{
|
||||
unsigned val = pData[i];
|
||||
s += ssprintf( "%02x", val );
|
||||
@@ -287,10 +288,10 @@ RString Commify( int iNum )
|
||||
|
||||
RString Commify(const RString& num, const RString& sep, const RString& dot)
|
||||
{
|
||||
size_t num_start= 0;
|
||||
size_t num_end= num.size();
|
||||
size_t dot_pos= num.find(dot);
|
||||
size_t dash_pos= num.find('-');
|
||||
std::size_t num_start= 0;
|
||||
std::size_t num_end= num.size();
|
||||
std::size_t dot_pos= num.find(dot);
|
||||
std::size_t dash_pos= num.find('-');
|
||||
if(dot_pos != std::string::npos)
|
||||
{
|
||||
num_end= dot_pos;
|
||||
@@ -299,22 +300,22 @@ RString Commify(const RString& num, const RString& sep, const RString& dot)
|
||||
{
|
||||
num_start= dash_pos + 1;
|
||||
}
|
||||
size_t num_size= num_end - num_start;
|
||||
size_t commies= (num_size / 3) - (!(num_size % 3));
|
||||
std::size_t num_size= num_end - num_start;
|
||||
std::size_t commies= (num_size / 3) - (!(num_size % 3));
|
||||
if(commies < 1)
|
||||
{
|
||||
return num;
|
||||
}
|
||||
size_t commified_len= num.size() + (commies * sep.size());
|
||||
std::size_t commified_len= num.size() + (commies * sep.size());
|
||||
RString ret;
|
||||
ret.resize(commified_len);
|
||||
size_t dest= 0;
|
||||
size_t next_comma= (num_size % 3) + (3 * (!(num_size % 3))) + num_start;
|
||||
for(size_t c= 0; c < num.size(); ++c)
|
||||
std::size_t dest= 0;
|
||||
std::size_t next_comma= (num_size % 3) + (3 * (!(num_size % 3))) + num_start;
|
||||
for(std::size_t c= 0; c < num.size(); ++c)
|
||||
{
|
||||
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];
|
||||
++dest;
|
||||
@@ -454,17 +455,17 @@ RString ConvertI64FormatString( const RString &sStr )
|
||||
RString sRet;
|
||||
sRet.reserve( sStr.size() + 16 );
|
||||
|
||||
size_t iOffset = 0;
|
||||
std::size_t iOffset = 0;
|
||||
while( iOffset < sStr.size() )
|
||||
{
|
||||
size_t iPercent = sStr.find( '%', iOffset );
|
||||
std::size_t iPercent = sStr.find( '%', iOffset );
|
||||
if( iPercent != sStr.npos )
|
||||
{
|
||||
sRet.append( sStr, iOffset, iPercent - iOffset );
|
||||
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' )
|
||||
{
|
||||
sRet.append( sStr, iPercent, iEnd - iPercent - 2 ); // %
|
||||
@@ -655,9 +656,9 @@ RString join( const RString &sDeliminator, const std::vector<RString> &sSource)
|
||||
return RString();
|
||||
|
||||
RString sTmp;
|
||||
size_t final_size= 0;
|
||||
size_t delim_size= sDeliminator.size();
|
||||
for(size_t n= 0; n < sSource.size()-1; ++n)
|
||||
std::size_t final_size= 0;
|
||||
std::size_t delim_size= sDeliminator.size();
|
||||
for(std::size_t n= 0; n < sSource.size()-1; ++n)
|
||||
{
|
||||
final_size+= sSource[n].size() + delim_size;
|
||||
}
|
||||
@@ -679,8 +680,8 @@ RString join( const RString &sDelimitor, std::vector<RString>::const_iterator be
|
||||
return RString();
|
||||
|
||||
RString sRet;
|
||||
size_t final_size= 0;
|
||||
size_t delim_size= sDelimitor.size();
|
||||
std::size_t final_size= 0;
|
||||
std::size_t delim_size= sDelimitor.size();
|
||||
for(std::vector<RString>::const_iterator curr= begin; curr != end; ++curr)
|
||||
{
|
||||
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() )
|
||||
return;
|
||||
|
||||
size_t startpos = 0;
|
||||
std::size_t startpos = 0;
|
||||
|
||||
do {
|
||||
size_t pos;
|
||||
std::size_t pos;
|
||||
pos = Source.find( Delimitor, startpos );
|
||||
if( pos == Source.npos )
|
||||
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?
|
||||
* C++ strings apparently are missing that ... */
|
||||
size_t pos;
|
||||
std::size_t pos;
|
||||
if( Delimitor.size() == 1 )
|
||||
pos = Source.find( Delimitor[0], begin );
|
||||
else
|
||||
@@ -943,11 +944,11 @@ RString SetExtension( const RString &sPath, const RString &sExt )
|
||||
|
||||
RString GetExtension( const RString &sPath )
|
||||
{
|
||||
size_t pos = sPath.rfind( '.' );
|
||||
std::size_t pos = sPath.rfind( '.' );
|
||||
if( pos == sPath.npos )
|
||||
return RString();
|
||||
|
||||
size_t slash = sPath.find( '/', pos );
|
||||
std::size_t slash = sPath.find( '/', pos );
|
||||
if( slash != sPath.npos )
|
||||
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,
|
||||
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]);
|
||||
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]))
|
||||
{
|
||||
@@ -1005,12 +1006,12 @@ bool FindFirstFilenameContaining(const std::vector<RString>& filenames,
|
||||
return true;
|
||||
}
|
||||
}
|
||||
size_t lower_size= lower.size();
|
||||
for(size_t s= 0; s < ends_with.size(); ++s)
|
||||
std::size_t lower_size= lower.size();
|
||||
for(std::size_t s= 0; s < ends_with.size(); ++s)
|
||||
{
|
||||
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]))
|
||||
{
|
||||
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)
|
||||
{
|
||||
@@ -1058,7 +1059,7 @@ bool GetCommandlineArgument( const RString &option, RString *argument, int iInde
|
||||
{
|
||||
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);
|
||||
if( CurOption.CompareNoCase(optstr) )
|
||||
continue; // no match
|
||||
@@ -1098,7 +1099,7 @@ RString GetCwd()
|
||||
* http://www.theorem.com/java/CRC32.java,
|
||||
* 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 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. */
|
||||
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 )
|
||||
return false;
|
||||
@@ -1722,7 +1723,7 @@ void utf8_remove_bom( RString &sLine )
|
||||
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
|
||||
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
|
||||
* length, so we never have to move the whole string. This is optimized for strings that have no
|
||||
* non-ASCII characters. */
|
||||
void MakeUpper( char *p, size_t iLen )
|
||||
void MakeUpper( char *p, std::size_t iLen )
|
||||
{
|
||||
char *pStart = p;
|
||||
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 *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;
|
||||
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 );
|
||||
}
|
||||
|
||||
void MakeLower( wchar_t *p, size_t iLen )
|
||||
void MakeLower( wchar_t *p, std::size_t iLen )
|
||||
{
|
||||
UnicodeUpperLower( p, iLen, g_LowerCase );
|
||||
}
|
||||
@@ -1928,10 +1929,10 @@ void ReplaceEntityText( RString &sText, const std::map<RString, RString> &m )
|
||||
{
|
||||
RString sRet;
|
||||
|
||||
size_t iOffset = 0;
|
||||
std::size_t iOffset = 0;
|
||||
while( iOffset != sText.size() )
|
||||
{
|
||||
size_t iStart = sText.find( '&', iOffset );
|
||||
std::size_t iStart = sText.find( '&', iOffset );
|
||||
if( iStart == sText.npos )
|
||||
{
|
||||
// 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;
|
||||
|
||||
// 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] == '&' )
|
||||
{
|
||||
// & 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;
|
||||
|
||||
size_t iOffset = 0;
|
||||
std::size_t iOffset = 0;
|
||||
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 )
|
||||
{
|
||||
// Optimization: if we didn't replace anything at all, do nothing.
|
||||
@@ -2028,7 +2029,7 @@ void Replace_Unicode_Markers( RString &sText )
|
||||
{
|
||||
// Look for &#digits;
|
||||
bool bHex = false;
|
||||
size_t iPos = sText.find( "&#", iStart );
|
||||
std::size_t iPos = sText.find( "&#", iStart );
|
||||
if( iPos == sText.npos )
|
||||
{
|
||||
bHex = true;
|
||||
@@ -2084,11 +2085,11 @@ RString WcharDisplayText( wchar_t c )
|
||||
*/
|
||||
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 )
|
||||
return RString();
|
||||
|
||||
size_t iStart = sDir.find_last_of( "/\\", iEnd );
|
||||
std::size_t iStart = sDir.find_last_of( "/\\", iEnd );
|
||||
if( iStart == sDir.npos )
|
||||
iStart = 0;
|
||||
else
|
||||
@@ -2205,8 +2206,8 @@ void CollapsePath( RString &sPath, bool bRemoveLeadingDot )
|
||||
RString sOut;
|
||||
sOut.reserve( sPath.size() );
|
||||
|
||||
size_t iPos = 0;
|
||||
size_t iNext;
|
||||
std::size_t iPos = 0;
|
||||
std::size_t iNext;
|
||||
for( ; iPos < sPath.size(); iPos = iNext )
|
||||
{
|
||||
// Find the next slash.
|
||||
@@ -2242,7 +2243,7 @@ void CollapsePath( RString &sPath, bool bRemoveLeadingDot )
|
||||
}
|
||||
|
||||
// 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 )
|
||||
iPrev = 0;
|
||||
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)
|
||||
{
|
||||
size_t l;
|
||||
std::size_t l;
|
||||
const char *s = luaL_checklstring(L, 1, &l);
|
||||
|
||||
RString hex = BinaryToHex(s, l);
|
||||
@@ -2485,7 +2486,7 @@ int LuaFunc_JsonEncode(lua_State* L)
|
||||
return Json::Value(val);
|
||||
}
|
||||
case LUA_TSTRING: {
|
||||
size_t len;
|
||||
std::size_t len;
|
||||
const char *s = lua_tolstring(L, index, &len);
|
||||
|
||||
return Json::Value(std::string(s, len));
|
||||
@@ -2499,7 +2500,7 @@ int LuaFunc_JsonEncode(lua_State* L)
|
||||
index = lua_gettop(L) + index + 1;
|
||||
}
|
||||
|
||||
size_t len = lua_objlen(L, index);
|
||||
std::size_t len = lua_objlen(L, index);
|
||||
|
||||
if (len > 0)
|
||||
{
|
||||
@@ -2529,7 +2530,7 @@ int LuaFunc_JsonEncode(lua_State* L)
|
||||
luaL_error(L, "object keys must be strings");
|
||||
}
|
||||
|
||||
size_t keylen;
|
||||
std::size_t keylen;
|
||||
const char *key = lua_tolstring(L, -2, &keylen);
|
||||
obj[std::string(key, keylen)] = convert(-1);
|
||||
lua_pop(L, 1);
|
||||
@@ -2578,7 +2579,7 @@ int LuaFunc_JsonDecode(lua_State* L)
|
||||
luaL_error(L, "JsonDecode requires an argument");
|
||||
}
|
||||
|
||||
size_t datalen;
|
||||
std::size_t datalen;
|
||||
const char *data = lua_tolstring(L, 1, &datalen);
|
||||
|
||||
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.");
|
||||
}
|
||||
size_t currents_len= lua_objlen(L, 1);
|
||||
size_t goals_len= lua_objlen(L, 2);
|
||||
size_t speeds_len= lua_objlen(L, 3);
|
||||
std::size_t currents_len= lua_objlen(L, 1);
|
||||
std::size_t goals_len= lua_objlen(L, 2);
|
||||
std::size_t speeds_len= lua_objlen(L, 3);
|
||||
float mult= 1.0f;
|
||||
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.");
|
||||
}
|
||||
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, 2, i);
|
||||
|
||||
+12
-9
@@ -3,13 +3,16 @@
|
||||
#ifndef RAGE_UTIL_H
|
||||
#define RAGE_UTIL_H
|
||||
|
||||
#include "global.h"
|
||||
|
||||
#include <algorithm>
|
||||
#include <cmath>
|
||||
#include <cstddef>
|
||||
#include <map>
|
||||
#include <random>
|
||||
#include <vector>
|
||||
#include <sstream>
|
||||
#include "global.h"
|
||||
|
||||
class RageFileDriver;
|
||||
|
||||
/** @brief Safely delete pointers. */
|
||||
@@ -337,7 +340,7 @@ float fmodfp( float x, float y );
|
||||
int power_of_two( int input );
|
||||
bool IsAnInt( 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 );
|
||||
bool HexToBinary( const RString &s, unsigned char *stringOut );
|
||||
bool HexToBinary( const RString &s, RString *sOut );
|
||||
@@ -382,16 +385,16 @@ bool FindFirstFilenameContaining(
|
||||
extern const wchar_t INVALID_CHAR;
|
||||
|
||||
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 );
|
||||
void wchar_to_utf8( wchar_t ch, RString &out );
|
||||
wchar_t utf8_get_char( const RString &s );
|
||||
bool utf8_is_valid( const RString &s );
|
||||
void utf8_remove_bom( RString &s );
|
||||
void MakeUpper( char *p, size_t iLen );
|
||||
void MakeLower( char *p, size_t iLen );
|
||||
void MakeUpper( wchar_t *p, size_t iLen );
|
||||
void MakeLower( wchar_t *p, size_t iLen );
|
||||
void MakeUpper( char *p, std::size_t iLen );
|
||||
void MakeLower( char *p, std::size_t iLen );
|
||||
void MakeUpper( wchar_t *p, std::size_t iLen );
|
||||
void MakeLower( wchar_t *p, std::size_t iLen );
|
||||
|
||||
// TODO: Have the three functions below be moved to better locations.
|
||||
float StringToFloat( const RString &sString );
|
||||
@@ -454,7 +457,7 @@ bool GetCommandlineArgument( const RString &option, RString *argument=nullptr, i
|
||||
extern int g_argc;
|
||||
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 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
|
||||
@@ -570,7 +573,7 @@ struct char_traits_char_nocase: public std::char_traits<char>
|
||||
static inline bool lt( char c1, 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;
|
||||
while( n-- )
|
||||
|
||||
@@ -33,6 +33,7 @@ static bool AttemptKoreanConversion( RString &sText ) { return CodePageConvert(
|
||||
static bool AttemptJapaneseConversion( RString &sText ) { return CodePageConvert( sText, 932 ); }
|
||||
|
||||
#elif defined(HAVE_ICONV)
|
||||
#include <cstddef>
|
||||
#include <errno.h>
|
||||
#include <iconv.h>
|
||||
|
||||
@@ -47,19 +48,19 @@ static bool ConvertFromCharset( RString &sText, const char *szCharset )
|
||||
|
||||
/* Copy the string into a char* for iconv */
|
||||
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 */
|
||||
RString sBuf;
|
||||
sBuf.resize( sText.size() * 5 );
|
||||
|
||||
char *sTextOut = const_cast<char*>( sBuf.data() );
|
||||
size_t iOutLeft = sBuf.size();
|
||||
size_t size = iconv( converter, &szTextIn, &iInLeft, &sTextOut, &iOutLeft );
|
||||
std::size_t iOutLeft = sBuf.size();
|
||||
std::size_t size = iconv( converter, &szTextIn, &iInLeft, &sTextOut, &iOutLeft );
|
||||
|
||||
iconv_close( converter );
|
||||
|
||||
if( size == (size_t)(-1) )
|
||||
if( size == (std::size_t)(-1) )
|
||||
{
|
||||
LOG->Trace( "%s\n", strerror( errno ) );
|
||||
return false; /* Returned an error */
|
||||
@@ -85,21 +86,22 @@ static bool AttemptKoreanConversion( RString &sText ) { return ConvertFromCharse
|
||||
static bool AttemptJapaneseConversion( RString &sText ) { return ConvertFromCharset( sText, "CP932" ); }
|
||||
|
||||
#elif defined(MACOSX)
|
||||
#include <cstddef>
|
||||
#include <CoreFoundation/CoreFoundation.h>
|
||||
|
||||
static bool ConvertFromCP( RString &sText, int iCodePage )
|
||||
{
|
||||
CFStringEncoding encoding = CFStringConvertWindowsCodepageToEncoding( iCodePage );
|
||||
|
||||
|
||||
if( encoding == kCFStringEncodingInvalidId )
|
||||
return false;
|
||||
|
||||
|
||||
CFStringRef old = CFStringCreateWithCString( kCFAllocatorDefault, sText, encoding );
|
||||
|
||||
|
||||
if( old == nullptr )
|
||||
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];
|
||||
buf[0] = '\0';
|
||||
bool result = CFStringGetCString( old, buf, size, kCFStringEncodingUTF8 );
|
||||
|
||||
+13
-11
@@ -4,6 +4,8 @@
|
||||
#include "RageUtil.h"
|
||||
#include "RageLog.h"
|
||||
|
||||
#include <cstddef>
|
||||
|
||||
/* Search for "beginning*containing*ending". */
|
||||
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). */
|
||||
if( !sContaining.empty() )
|
||||
{
|
||||
size_t pos = sPath.find( sContaining, sBeginning.size() );
|
||||
std::size_t pos = sPath.find( sContaining, sBeginning.size() );
|
||||
if( pos == sPath.npos )
|
||||
continue; /* doesn't contain it */
|
||||
if( pos + sContaining.size() > unsigned(end_pos) )
|
||||
@@ -104,7 +106,7 @@ static void SplitPath( RString sPath, RString &sDir, RString &sName )
|
||||
if( sPath.Right(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 )
|
||||
{
|
||||
sDir = "";
|
||||
@@ -204,7 +206,7 @@ bool FilenameDB::ResolvePath( RString &sPath )
|
||||
|
||||
m_Mutex.Unlock(); /* locked by GetFileSet */
|
||||
}
|
||||
|
||||
|
||||
if( sPath.size() && sPath[sPath.size()-1] == '/' )
|
||||
sPath = ret + "/";
|
||||
else
|
||||
@@ -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 )
|
||||
{
|
||||
/* 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 )
|
||||
{
|
||||
/* No; just do a regular search. */
|
||||
GetFilesEqualTo( sDir, sMask, asOut, bOnlyDirs );
|
||||
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 )
|
||||
{
|
||||
/* Only one *: "A*B". */
|
||||
@@ -251,7 +253,7 @@ void FilenameDB::GetFilesSimpleMatch( const RString &sDir, const RString &sMask,
|
||||
}
|
||||
|
||||
/* Two *s: "A*B*C". */
|
||||
GetFilesMatching( sDir,
|
||||
GetFilesMatching( sDir,
|
||||
sMask.substr(0, first_pos),
|
||||
sMask.substr(first_pos+1, second_pos-first_pos-1),
|
||||
sMask.substr(second_pos+1), asOut, bOnlyDirs );
|
||||
@@ -485,20 +487,20 @@ void FilenameDB::FlushDirCache( const RString & /* sDir */ )
|
||||
{
|
||||
if( dirs.empty() )
|
||||
break;
|
||||
|
||||
|
||||
/* Grab the first entry. Take it out of the list while we hold the
|
||||
* lock, to guarantee that we own it. */
|
||||
pFileSet = dirs.begin()->second;
|
||||
|
||||
|
||||
dirs.erase( dirs.begin() );
|
||||
|
||||
|
||||
/* If it's being filled, we don't really own it until it's finished being
|
||||
* filled, so wait. */
|
||||
while( !pFileSet->m_bFilled )
|
||||
m_Mutex.Wait();
|
||||
delete pFileSet;
|
||||
}
|
||||
|
||||
|
||||
#if 0
|
||||
/* XXX: This is tricky, we want to flush all of the subdirectories of
|
||||
* sDir, but once we unlock the mutex, we basically have to start over.
|
||||
@@ -576,7 +578,7 @@ void FilenameDB::GetDirListing( const RString &sPath_, std::vector<RString> &asA
|
||||
ASSERT( !sPath.empty() );
|
||||
|
||||
/* 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;
|
||||
if( pos == sPath.npos )
|
||||
{
|
||||
|
||||
@@ -7,6 +7,8 @@
|
||||
#include "PlayerState.h"
|
||||
#include "Style.h"
|
||||
|
||||
#include <cstddef>
|
||||
|
||||
ReceptorArrowRow::ReceptorArrowRow()
|
||||
{
|
||||
m_pPlayerState = nullptr;
|
||||
@@ -22,7 +24,7 @@ void ReceptorArrowRow::Load( const PlayerState* pPlayerState, float fYReverseOff
|
||||
|
||||
const Style* pStyle = GAMESTATE->GetCurrentStyle(pPlayerState->m_PlayerNumber);
|
||||
|
||||
for( int c=0; c<pStyle->m_iColsPerPlayer; c++ )
|
||||
for( int c=0; c<pStyle->m_iColsPerPlayer; c++ )
|
||||
{
|
||||
m_ReceptorArrow.push_back( new ReceptorArrow );
|
||||
m_ReceptorArrow[c]->SetName( "ReceptorArrow" );
|
||||
@@ -34,7 +36,7 @@ void ReceptorArrowRow::Load( const PlayerState* pPlayerState, float fYReverseOff
|
||||
void ReceptorArrowRow::SetColumnRenderers(std::vector<NoteColumnRenderer>& renderers)
|
||||
{
|
||||
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]));
|
||||
}
|
||||
@@ -119,7 +121,7 @@ void ReceptorArrowRow::SetNoteUpcoming( int iCol, bool b )
|
||||
/*
|
||||
* (c) 2001-2003 Chris Danford
|
||||
* All rights reserved.
|
||||
*
|
||||
*
|
||||
* Permission is hereby granted, free of charge, to any person obtaining a
|
||||
* copy of this software and associated documentation files (the
|
||||
* "Software"), to deal in the Software without restriction, including
|
||||
@@ -129,7 +131,7 @@ void ReceptorArrowRow::SetNoteUpcoming( int iCol, bool b )
|
||||
* copyright notice(s) and this permission notice appear in all copies of
|
||||
* the Software and that both the above copyright notice(s) and this
|
||||
* permission notice appear in supporting documentation.
|
||||
*
|
||||
*
|
||||
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
|
||||
* OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
||||
* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT OF
|
||||
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user