tweak StringOutputStream use
auto str = StringOutputStream()(bla) use form was not doing copy elision or move, but copy
This commit is contained in:
parent
b4e44bc8ed
commit
df02774ff5
|
|
@ -214,8 +214,8 @@ void Build1dArray( vec3_t* array, const drawVert_t points[MAX_PATCH_WIDTH][MAX_P
|
|||
|
||||
void Print1dArray( vec3_t* array, int size ){
|
||||
for ( int i = 0; i < size; i++ )
|
||||
globalOutputStream() << "(" << array[i][0] << " " << array[i][1] << " " << array[i][2] << ")\t";
|
||||
globalOutputStream() << "\n";
|
||||
globalOutputStream() << '(' << array[i][0] << ' ' << array[i][1] << ' ' << array[i][2] << ")\t";
|
||||
globalOutputStream() << '\n';
|
||||
}
|
||||
|
||||
bool Compare1dArrays( vec3_t* a1, vec3_t* a2, int size ){
|
||||
|
|
@ -362,14 +362,14 @@ void DPatch::Invert(){
|
|||
//Function to figure out what is actually going wrong.
|
||||
void DPatch::DebugPrint()
|
||||
{
|
||||
globalOutputStream() << "width: " << width << "\theight: " << height << "\n";
|
||||
globalOutputStream() << "width: " << width << "\theight: " << height << '\n';
|
||||
for(int x = 0; x < height; x++)
|
||||
{
|
||||
for(int y = 0; y < width; y++)
|
||||
{
|
||||
globalOutputStream() << "\t(" << points[x][y].xyz[0] << " " << points[x][y].xyz[1] << " " << points[x][y].xyz[2] << ")\t";
|
||||
globalOutputStream() << "\t(" << points[x][y].xyz[0] << ' ' << points[x][y].xyz[1] << ' ' << points[x][y].xyz[2] << ")\t";
|
||||
}
|
||||
globalOutputStream() << "\n";
|
||||
globalOutputStream() << '\n';
|
||||
}
|
||||
}
|
||||
*/
|
||||
|
|
|
|||
|
|
@ -205,7 +205,7 @@ void DWinding::CheckWinding(){
|
|||
int j;
|
||||
for ( j = 0; j < 3; j++ )
|
||||
if ( p1[j] > BOGUS_RANGE || p1[j] < -BOGUS_RANGE ) {
|
||||
globalWarningStream() << "CheckFace: BOGUS_RANGE: " << p1[j] << "\n";
|
||||
globalWarningStream() << "CheckFace: BOGUS_RANGE: " << p1[j] << '\n';
|
||||
}
|
||||
|
||||
j = i + 1 == numpoints ? 0 : i + 1;
|
||||
|
|
|
|||
|
|
@ -40,7 +40,7 @@ bool LoadExclusionList( char* filename, std::list<Str>* exclusionList ){
|
|||
return true;
|
||||
}
|
||||
|
||||
globalErrorStream() << "Failed To Load Exclusion List: " << filename << "\n";
|
||||
globalErrorStream() << "Failed To Load Exclusion List: " << filename << '\n';
|
||||
return false;
|
||||
}
|
||||
|
||||
|
|
@ -64,6 +64,6 @@ QStringList LoadListStore( char* filename ){
|
|||
return list;
|
||||
}
|
||||
|
||||
globalErrorStream() << "Failed To Load GList: " << filename << "\n";
|
||||
globalErrorStream() << "Failed To Load GList: " << filename << '\n';
|
||||
return list;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -20,7 +20,7 @@ static std::string s_export_path;
|
|||
|
||||
void OnExportClicked( bool choose_path ){
|
||||
if( choose_path ){
|
||||
StringOutputStream buffer( 1024 );
|
||||
StringOutputStream buffer( 256 );
|
||||
|
||||
if( !s_export_path.empty() ){
|
||||
buffer << s_export_path.c_str();
|
||||
|
|
@ -28,14 +28,13 @@ void OnExportClicked( bool choose_path ){
|
|||
if( buffer.empty() ){
|
||||
buffer << GlobalRadiant().getEnginePath() << GlobalRadiant().getGameName() << "/models/";
|
||||
|
||||
if ( !file_readable( buffer.c_str() ) ) {
|
||||
if ( !file_readable( buffer ) ) {
|
||||
// just go to fsmain
|
||||
buffer.clear();
|
||||
buffer << GlobalRadiant().getEnginePath() << GlobalRadiant().getGameName();
|
||||
buffer( GlobalRadiant().getEnginePath(), GlobalRadiant().getGameName() );
|
||||
}
|
||||
}
|
||||
|
||||
const char* cpath = GlobalRadiant().m_pfnFileDialog( g_dialog.window, false, "Save as Obj", buffer.c_str(), 0, false, false, true );
|
||||
const char* cpath = GlobalRadiant().m_pfnFileDialog( g_dialog.window, false, "Save as Obj", buffer, 0, false, false, true );
|
||||
if ( !cpath ) {
|
||||
return;
|
||||
}
|
||||
|
|
@ -63,7 +62,7 @@ void OnExportClicked( bool choose_path ){
|
|||
}
|
||||
#ifdef _DEBUG
|
||||
for ( const std::string& str : ignore )
|
||||
globalOutputStream() << str.c_str() << "\n";
|
||||
globalOutputStream() << str.c_str() << '\n';
|
||||
#endif
|
||||
// collapse mode
|
||||
collapsemode mode = COLLAPSE_NONE;
|
||||
|
|
|
|||
|
|
@ -76,9 +76,7 @@ void ExportData::BeginBrush( Brush& b ){
|
|||
groups.push_back( group() );
|
||||
current = &groups.back();
|
||||
|
||||
StringOutputStream str( 256 );
|
||||
str << "Brush" << (unsigned int)groups.size();
|
||||
current->name = str.c_str();
|
||||
current->name = StringStream<16>( "Brush", (unsigned int)groups.size() );
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -127,7 +125,7 @@ void ExportData::AddBrushFace( Face& f ){
|
|||
current->faces.push_back( &f );
|
||||
|
||||
#ifdef _DEBUG
|
||||
globalOutputStream() << "Added Face to group " << current->name.c_str() << "\n";
|
||||
globalOutputStream() << "Added Face to group " << current->name.c_str() << '\n';
|
||||
#endif
|
||||
}
|
||||
|
||||
|
|
@ -144,7 +142,7 @@ void ExportData::GetShaderNameFromShaderPath( const char* path, std::string& nam
|
|||
}
|
||||
|
||||
#ifdef _DEBUG
|
||||
globalOutputStream() << "Last: " << (const unsigned int) last_slash << " " << "length: " << (const unsigned int)tmp.length() << "Name: " << name.c_str() << "\n";
|
||||
globalOutputStream() << "Last: " << (const unsigned int) last_slash << " length: " << (const unsigned int)tmp.length() << "Name: " << name.c_str() << '\n';
|
||||
#endif
|
||||
}
|
||||
|
||||
|
|
@ -198,7 +196,7 @@ bool ExportDataAsWavefront::WriteToFile( const std::string& path, collapsemode m
|
|||
if ( expmat ) {
|
||||
size_t last = mtlFile.find_last_of( "//" );
|
||||
std::string mtllib = mtlFile.substr( last + 1, mtlFile.size() - last ).c_str();
|
||||
out << "mtllib " << mtllib.c_str() << "\n";
|
||||
out << "mtllib " << mtllib.c_str() << '\n';
|
||||
}
|
||||
|
||||
unsigned int vertex_count = 0;
|
||||
|
|
@ -217,7 +215,7 @@ bool ExportDataAsWavefront::WriteToFile( const std::string& path, collapsemode m
|
|||
else {
|
||||
out << "\ng ";
|
||||
}
|
||||
out << group.name.c_str() << "\n";
|
||||
out << group.name.c_str() << '\n';
|
||||
|
||||
// material
|
||||
if ( expmat && mode == COLLAPSE_ALL ) {
|
||||
|
|
@ -253,9 +251,9 @@ bool ExportDataAsWavefront::WriteToFile( const std::string& path, collapsemode m
|
|||
// write vertices
|
||||
if( vertexN == 0 ){
|
||||
vertexN = ++vertex_count;
|
||||
out << "v " << FloatFormat( vertex.x(), 1, 6 ) << " " << FloatFormat( vertex.z(), 1, 6 ) << " " << FloatFormat( -vertex.y(), 1, 6 ) << "\n";
|
||||
out << "v " << FloatFormat( vertex.x(), 1, 6 ) << ' ' << FloatFormat( vertex.z(), 1, 6 ) << ' ' << FloatFormat( -vertex.y(), 1, 6 ) << '\n';
|
||||
}
|
||||
faceLine << " " << vertexN << "/" << texcoord_count; // store faces
|
||||
faceLine << ' ' << vertexN << '/' << texcoord_count; // store faces
|
||||
}
|
||||
while( i != 0 );
|
||||
|
||||
|
|
@ -265,7 +263,7 @@ bool ExportDataAsWavefront::WriteToFile( const std::string& path, collapsemode m
|
|||
brushMaterials.emplace( face->getShader().getShader(), faceLine.c_str() );
|
||||
}
|
||||
|
||||
out << "\n";
|
||||
out << '\n';
|
||||
|
||||
for ( const Face* face : group.faces )
|
||||
{
|
||||
|
|
@ -275,7 +273,7 @@ bool ExportDataAsWavefront::WriteToFile( const std::string& path, collapsemode m
|
|||
size_t i = w.numpoints;
|
||||
do{
|
||||
--i;
|
||||
out << "vt " << FloatFormat( w[i].texcoord.x(), 1, 6 ) << " " << FloatFormat( -w[i].texcoord.y(), 1, 6 ) << "\n";
|
||||
out << "vt " << FloatFormat( w[i].texcoord.x(), 1, 6 ) << ' ' << FloatFormat( -w[i].texcoord.y(), 1, 6 ) << '\n';
|
||||
}
|
||||
while( i != 0 );
|
||||
}
|
||||
|
|
@ -301,7 +299,7 @@ bool ExportDataAsWavefront::WriteToFile( const std::string& path, collapsemode m
|
|||
}
|
||||
}
|
||||
|
||||
out << "\n";
|
||||
out << '\n';
|
||||
}
|
||||
|
||||
if ( expmat ) {
|
||||
|
|
@ -318,13 +316,13 @@ bool ExportDataAsWavefront::WriteToFile( const std::string& path, collapsemode m
|
|||
const std::string& str = material.first;
|
||||
const Colour3& clr = material.second;
|
||||
if ( limNames && str.size() > MAX_MATERIAL_NAME ) {
|
||||
outMtl << "newmtl " << str.substr( str.size() - MAX_MATERIAL_NAME, str.size() ).c_str() << "\n";
|
||||
outMtl << "newmtl " << str.substr( str.size() - MAX_MATERIAL_NAME, str.size() ).c_str() << '\n';
|
||||
}
|
||||
else {
|
||||
outMtl << "newmtl " << str.c_str() << "\n";
|
||||
outMtl << "newmtl " << str.c_str() << '\n';
|
||||
}
|
||||
outMtl << "Kd " << clr.x() << " " << clr.y() << " " << clr.z() << "\n";
|
||||
outMtl << "map_Kd " << str.c_str() << "\n";
|
||||
outMtl << "Kd " << clr.x() << ' ' << clr.y() << ' ' << clr.z() << '\n';
|
||||
outMtl << "map_Kd " << str.c_str() << '\n';
|
||||
|
||||
}
|
||||
}
|
||||
|
|
@ -388,7 +386,7 @@ bool ExportSelection( const StringSetWithLambda& ignorelist, collapsemode m, boo
|
|||
GlobalSelectionSystem().foreachSelected( vis );
|
||||
|
||||
if( exporter.WriteToFile( path, m ) ){
|
||||
globalOutputStream() << "brushexport::ExportSelection " << path.c_str() << "\n";
|
||||
globalOutputStream() << "brushexport::ExportSelection " << path.c_str() << '\n';
|
||||
return true;
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -70,7 +70,7 @@ bool DoLoadPortalFileDialog(){
|
|||
}
|
||||
|
||||
|
||||
portals.fn = StringOutputStream( 256 )( PathExtensionless( GlobalRadiant().getMapName() ), ".prt" );
|
||||
portals.fn = StringStream( PathExtensionless( GlobalRadiant().getMapName() ), ".prt" );
|
||||
|
||||
line->setText( portals.fn.c_str() );
|
||||
check3d->setChecked( portals.show_3d );
|
||||
|
|
|
|||
|
|
@ -69,9 +69,7 @@ const char CLIP[] = "Clip";
|
|||
|
||||
|
||||
void PrtView_construct(){
|
||||
StringOutputStream tmp( 64 );
|
||||
tmp << GlobalRadiant().getSettingsPath() << "prtview.ini";
|
||||
INIfn = tmp.c_str();
|
||||
INIfn = StringStream( GlobalRadiant().getSettingsPath(), "prtview.ini" );
|
||||
|
||||
portals.show_2d = INIGetInt( RENDER_2D, 0 );
|
||||
portals.width_2d = std::clamp( INIGetInt( WIDTH_2D, 3 ), 1, 10 );
|
||||
|
|
|
|||
|
|
@ -165,8 +165,8 @@ void CreateTagFile(){
|
|||
}
|
||||
|
||||
// Get the tag file
|
||||
const auto tagFile = StringOutputStream( 256 )( GlobalRadiant().getLocalRcPath(), SHADERTAG_FILE );
|
||||
const auto message = StringOutputStream( 256 )( "Tag file saved to\n", tagFile, "\nPlease restart Radiant now.\n" );
|
||||
const auto tagFile = StringStream( GlobalRadiant().getLocalRcPath(), SHADERTAG_FILE );
|
||||
const auto message = StringStream( "Tag file saved to\n", tagFile, "\nPlease restart Radiant now.\n" );
|
||||
|
||||
if ( file_exists( tagFile ) ) {
|
||||
EMessageBoxReturn result = GlobalRadiant().m_pfnMessageBox( g_window,
|
||||
|
|
|
|||
|
|
@ -204,8 +204,8 @@ void MapCoordinator(){
|
|||
|
||||
globalOutputStream() << "SunPlug: calculating optimal coordinates\n"; // write to console that we are calculating the coordinates
|
||||
const auto [ calc_min, calc_max ] = GetOptimalCoordinates(); // calculate optimal mapcoords with the dimensions of the level bounding box
|
||||
globalOutputStream() << "SunPlug: advised mapcoordsmins=" << calc_min.x() << " " << calc_max.y() << "\n"; // console info about mapcoordsmins
|
||||
globalOutputStream() << "SunPlug: advised mapcoordsmaxs=" << calc_max.x() << " " << calc_min.y() << "\n"; // console info about mapcoordsmaxs
|
||||
globalOutputStream() << "SunPlug: advised mapcoordsmins=" << calc_min.x() << ' ' << calc_max.y() << '\n'; // console info about mapcoordsmins
|
||||
globalOutputStream() << "SunPlug: advised mapcoordsmaxs=" << calc_max.x() << ' ' << calc_min.y() << '\n'; // console info about mapcoordsmaxs
|
||||
|
||||
{
|
||||
QDialog dialog( SunPlug::main_window, Qt::Dialog | Qt::WindowCloseButtonHint );
|
||||
|
|
@ -260,8 +260,8 @@ void MapCoordinator(){
|
|||
|
||||
if( dialog.exec() ){
|
||||
UndoableCommand undo( "SunPlug.entitySetMapcoords" );
|
||||
theWorldspawn->setKeyValue( "mapcoordsmins", ( spin_minX->cleanText() + " " + spin_minY->cleanText() ).toLatin1().constData() );
|
||||
theWorldspawn->setKeyValue( "mapcoordsmaxs", ( spin_maxX->cleanText() + " " + spin_maxY->cleanText() ).toLatin1().constData() );
|
||||
theWorldspawn->setKeyValue( "mapcoordsmins", ( spin_minX->cleanText() + ' ' + spin_minY->cleanText() ).toLatin1().constData() );
|
||||
theWorldspawn->setKeyValue( "mapcoordsmaxs", ( spin_maxX->cleanText() + ' ' + spin_maxY->cleanText() ).toLatin1().constData() );
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -119,7 +119,7 @@ public:
|
|||
*/
|
||||
void get_team_count( const char *classname, int *count, int *team ){
|
||||
GlobalSceneGraph().traverse( EntityFindTeams( classname, count, team ) );
|
||||
globalOutputStream() << "UFO:AI: classname: " << classname << ": #" << ( *count ) << "\n";
|
||||
globalOutputStream() << "UFO:AI: classname: " << classname << ": #" << ( *count ) << '\n';
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
|
|||
|
|
@ -162,11 +162,11 @@ public:
|
|||
/// \brief Prints the (up to) 128 characters in the current extended-ascii character set.
|
||||
/// Useful for debugging.
|
||||
void print() const {
|
||||
globalOutputStream() << "UTF-8 conversion required from charset: " << globalCharacterSet().get() << "\n";
|
||||
globalOutputStream() << "UTF-8 conversion required from charset: " << globalCharacterSet().get() << '\n';
|
||||
for ( std::size_t i = 1; i < 128; ++i )
|
||||
{
|
||||
if ( m_decodeMap[i].buffer != 0 ) {
|
||||
globalOutputStream() << extended_ascii_for_index( i ) << " = " << m_decodeMap[i] << "\n";
|
||||
globalOutputStream() << extended_ascii_for_index( i ) << " = " << m_decodeMap[i] << '\n';
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -105,13 +105,13 @@ inline DebugMessageHandler& globalDebugMessageHandler(){
|
|||
#define ASSERT_MESSAGE( condition, message ) do { \
|
||||
if ( !( condition ) ) \
|
||||
{ \
|
||||
globalDebugMessageHandler().getOutputStream() << FILE_LINE "\nassertion failure: " << message << "\n"; \
|
||||
globalDebugMessageHandler().getOutputStream() << FILE_LINE "\nassertion failure: " << message << '\n'; \
|
||||
if ( !globalDebugMessageHandler().handleMessage() ) { DEBUGGER_BREAKPOINT(); } \
|
||||
}} while ( 0 )
|
||||
|
||||
/// \brief Sends a \p message to the current debug-message-handler text-output-stream.
|
||||
#define ERROR_MESSAGE( message ) do { \
|
||||
globalDebugMessageHandler().getOutputStream() << FILE_LINE "\nruntime error: " << message << "\n"; \
|
||||
globalDebugMessageHandler().getOutputStream() << FILE_LINE "\nruntime error: " << message << '\n'; \
|
||||
if ( !globalDebugMessageHandler().handleMessage() ) { DEBUGGER_BREAKPOINT(); }} while ( 0 )
|
||||
|
||||
#define ASSERT_NOTNULL( ptr ) ASSERT_MESSAGE( ptr != 0, "pointer \"" # ptr "\" is null" )
|
||||
|
|
|
|||
|
|
@ -117,12 +117,12 @@ void Keys_releaseAll( PressedKeys::Keys& keys, Qt::KeyboardModifiers state ){
|
|||
}
|
||||
|
||||
bool PressedKeys_key_press( const QKeyEvent* event, PressedKeys& pressedKeys ){
|
||||
//globalOutputStream() << "pressed: " << event->key() << "\n";
|
||||
//globalOutputStream() << "pressed: " << event->key() << '\n';
|
||||
return event->modifiers() == 0 && Keys_press( pressedKeys.keys, qt_keyvalue_is_known( event->key() )? event->key() : event->nativeVirtualKey() );
|
||||
}
|
||||
|
||||
bool PressedKeys_key_release( const QKeyEvent* event, PressedKeys& pressedKeys ){
|
||||
//globalOutputStream() << "released: " << event->key() << "\n";
|
||||
//globalOutputStream() << "released: " << event->key() << '\n';
|
||||
return Keys_release( pressedKeys.keys, qt_keyvalue_is_known( event->key() )? event->key() : event->nativeVirtualKey() );
|
||||
}
|
||||
|
||||
|
|
@ -172,28 +172,28 @@ void GlobalPressedKeys_connect( QWidget* window ){
|
|||
|
||||
|
||||
void keydown_accelerators_add( QKeySequence accelerator, const Callback& callback ){
|
||||
//globalOutputStream() << "keydown_accelerators_add: " << makeQuoted(accelerator) << "\n";
|
||||
//globalOutputStream() << "keydown_accelerators_add: " << makeQuoted(accelerator) << '\n';
|
||||
if ( !accelerator_map_insert( g_keydown_accelerators, accelerator, callback ) ) {
|
||||
globalErrorStream() << "keydown_accelerators_add: already exists: " << makeQuoted( accelerator ) << "\n";
|
||||
globalErrorStream() << "keydown_accelerators_add: already exists: " << makeQuoted( accelerator ) << '\n';
|
||||
}
|
||||
}
|
||||
void keydown_accelerators_remove( QKeySequence accelerator ){
|
||||
//globalOutputStream() << "keydown_accelerators_remove: " << makeQuoted(accelerator) << "\n";
|
||||
//globalOutputStream() << "keydown_accelerators_remove: " << makeQuoted(accelerator) << '\n';
|
||||
if ( !accelerator_map_erase( g_keydown_accelerators, accelerator ) ) {
|
||||
globalErrorStream() << "keydown_accelerators_remove: not found: " << makeQuoted( accelerator ) << "\n";
|
||||
globalErrorStream() << "keydown_accelerators_remove: not found: " << makeQuoted( accelerator ) << '\n';
|
||||
}
|
||||
}
|
||||
|
||||
void keyup_accelerators_add( QKeySequence accelerator, const Callback& callback ){
|
||||
//globalOutputStream() << "keyup_accelerators_add: " << makeQuoted(accelerator) << "\n";
|
||||
//globalOutputStream() << "keyup_accelerators_add: " << makeQuoted(accelerator) << '\n';
|
||||
if ( !accelerator_map_insert( g_keyup_accelerators, accelerator, callback ) ) {
|
||||
globalErrorStream() << "keyup_accelerators_add: already exists: " << makeQuoted( accelerator ) << "\n";
|
||||
globalErrorStream() << "keyup_accelerators_add: already exists: " << makeQuoted( accelerator ) << '\n';
|
||||
}
|
||||
}
|
||||
void keyup_accelerators_remove( QKeySequence accelerator ){
|
||||
//globalOutputStream() << "keyup_accelerators_remove: " << makeQuoted(accelerator) << "\n";
|
||||
//globalOutputStream() << "keyup_accelerators_remove: " << makeQuoted(accelerator) << '\n';
|
||||
if ( !accelerator_map_erase( g_keyup_accelerators, accelerator ) ) {
|
||||
globalErrorStream() << "keyup_accelerators_remove: not found: " << makeQuoted( accelerator ) << "\n";
|
||||
globalErrorStream() << "keyup_accelerators_remove: not found: " << makeQuoted( accelerator ) << '\n';
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -90,12 +90,7 @@ public:
|
|||
m_masks.reserve( m_types.size() );
|
||||
for ( const auto& type : types )
|
||||
{
|
||||
const std::size_t len = strlen( type.m_name.c_str() ) + strlen( type.m_pattern.c_str() ) + 3;
|
||||
StringOutputStream buffer( len + 1 ); // length + null char
|
||||
|
||||
buffer << type.m_name << " (" << type.m_pattern << ")";
|
||||
|
||||
m_masks.push_back( buffer.c_str() );
|
||||
m_masks.push_back( StringStream<64>( type.m_name, " (", type.m_pattern, ')' ).c_str() );
|
||||
}
|
||||
|
||||
m_filters.reserve( m_types.size() );
|
||||
|
|
@ -146,7 +141,7 @@ const char* file_dialog( QWidget* parent, bool open, const char* title, const ch
|
|||
filter += ' ';
|
||||
filter += f.c_str();
|
||||
}
|
||||
filter += ")";
|
||||
filter += ')';
|
||||
}
|
||||
|
||||
for ( const auto& mask : masks.m_masks ) // e.g.: quake3 maps (*.map);;quake3 region (*.reg)
|
||||
|
|
@ -170,7 +165,7 @@ const char* file_dialog( QWidget* parent, bool open, const char* title, const ch
|
|||
if( !string_empty( extension ) ){ // validate it
|
||||
const auto check = [extension]( const CopiedString& filter ){ return extension_equal( extension, path_get_extension( filter.c_str() ) ); };
|
||||
if( !std::any_of( masks.m_filters.cbegin(), masks.m_filters.cend(), check ) ) {
|
||||
qt_MessageBox( parent, StringOutputStream( 256 )( makeQuoted( extension ), " is unsupported file type for requested operation\n" ), extension, EMessageBoxType::Error );
|
||||
qt_MessageBox( parent, StringStream<64>( makeQuoted( extension ), " is unsupported file type for requested operation\n" ), extension, EMessageBoxType::Error );
|
||||
g_file_dialog_file.clear();
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -44,7 +44,7 @@ void glwidget_context_created( QOpenGLWidget& widget ){
|
|||
<< " depth: " << widget.format().depthBufferSize()
|
||||
<< " swapInterval: " << widget.format().swapInterval()
|
||||
<< " samples: " << widget.format().samples()
|
||||
<< "\n";
|
||||
<< '\n';
|
||||
|
||||
ASSERT_MESSAGE( widget.isValid(), "failed to create OpenGL widget" );
|
||||
|
||||
|
|
|
|||
|
|
@ -36,11 +36,11 @@ void BitmapsPath_set( const char* path ){
|
|||
}
|
||||
|
||||
QPixmap new_local_image( const char* filename ){
|
||||
const auto fullPath = StringOutputStream( 256 )( g_bitmapsPath, filename );
|
||||
const auto fullPath = StringStream( g_bitmapsPath, filename );
|
||||
return QPixmap( QString( fullPath.c_str() ) );
|
||||
}
|
||||
|
||||
QIcon new_local_icon( const char* filename ){
|
||||
const auto fullPath = StringOutputStream( 256 )( g_bitmapsPath, filename );
|
||||
const auto fullPath = StringStream( g_bitmapsPath, filename );
|
||||
return QIcon( fullPath.c_str() );
|
||||
}
|
||||
|
|
|
|||
|
|
@ -63,7 +63,7 @@ public:
|
|||
UndoFileChangeTracker() : m_size( 0 ), m_saved( MAPFILE_MAX_CHANGES ), m_pending( 0 ){
|
||||
}
|
||||
void print(){
|
||||
globalOutputStream() << "saved: " << m_saved << " size: " << m_size << "\n";
|
||||
globalOutputStream() << "saved: " << m_saved << " size: " << m_size << '\n';
|
||||
}
|
||||
|
||||
void push(){
|
||||
|
|
|
|||
|
|
@ -109,7 +109,7 @@ class ScriptTokeniser final : public Tokeniser
|
|||
{
|
||||
case eNewline:
|
||||
if ( !m_crossline ) {
|
||||
globalErrorStream() << getLine() << ":" << getColumn() << ": unexpected end-of-line before token\n";
|
||||
globalErrorStream() << getLine() << ':' << getColumn() << ": unexpected end-of-line before token\n";
|
||||
return false;
|
||||
}
|
||||
break;
|
||||
|
|
@ -162,7 +162,7 @@ class ScriptTokeniser final : public Tokeniser
|
|||
{
|
||||
case eNewline:
|
||||
if ( m_crossline ) {
|
||||
globalErrorStream() << getLine() << ":" << getColumn() << ": unexpected end-of-line in quoted token\n";
|
||||
globalErrorStream() << getLine() << ':' << getColumn() << ": unexpected end-of-line in quoted token\n";
|
||||
return false;
|
||||
}
|
||||
break;
|
||||
|
|
|
|||
|
|
@ -153,3 +153,10 @@ template<typename T>
|
|||
inline StringOutputStream& operator<<( StringOutputStream& ostream, const T& t ){
|
||||
return ostream_write( ostream, t );
|
||||
}
|
||||
|
||||
template<std::size_t capacity = 256, typename ... Args>
|
||||
StringOutputStream StringStream( Args&& ... args ){
|
||||
StringOutputStream str( capacity );
|
||||
( str << ... << std::forward<Args>( args ) );
|
||||
return str;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -24,10 +24,10 @@ inline void StringPool_analyse( StringPool& pool ){
|
|||
pooled += size + 20;
|
||||
ordered.insert( Ordered::value_type( ( *i ).value, ( *i ).key ) );
|
||||
}
|
||||
globalOutputStream() << "total: " << total << " pooled:" << pooled << "\n";
|
||||
globalOutputStream() << "total: " << total << " pooled:" << pooled << '\n';
|
||||
for ( Ordered::iterator i = ordered.begin(); i != ordered.end(); ++i )
|
||||
{
|
||||
globalOutputStream() << ( *i ).second << " " << ( *i ).first << "\n";
|
||||
globalOutputStream() << ( *i ).second << ' ' << ( *i ).first << '\n';
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -222,7 +222,7 @@ inline bool string_parse_size( const char* string, std::size_t& i ){
|
|||
#define RETURN_FALSE_IF_FAIL( expression ) do{ if ( !expression ) {return false; } }while( 0 )
|
||||
|
||||
inline void Tokeniser_unexpectedError( Tokeniser& tokeniser, const char* token, const char* expected ){
|
||||
globalErrorStream() << tokeniser.getLine() << ":" << tokeniser.getColumn() << ": parse error at '" << ( token != 0 ? token : "#EOF" ) << "': expected '" << expected << "'\n";
|
||||
globalErrorStream() << tokeniser.getLine() << ':' << tokeniser.getColumn() << ": parse error at '" << ( token != 0 ? token : "#EOF" ) << "': expected '" << expected << "'\n";
|
||||
}
|
||||
|
||||
|
||||
|
|
@ -233,7 +233,7 @@ inline bool Tokeniser_getFloat( Tokeniser& tokeniser, float& f ){
|
|||
}
|
||||
//fallback for 1.#IND 1.#INF 1.#QNAN cases, happening sometimes after texture locking algorithms
|
||||
else if ( token != 0 && strstr( token, ".#" ) ) {
|
||||
globalWarningStream() << "Warning: " << tokeniser.getLine() << ":" << tokeniser.getColumn() << ": expected parse problem at '" << token << "': wanted '#number'\nProcessing anyway\n";
|
||||
globalWarningStream() << "Warning: " << tokeniser.getLine() << ':' << tokeniser.getColumn() << ": expected parse problem at '" << token << "': wanted '#number'\nProcessing anyway\n";
|
||||
// *strstr( token, ".#" ) = '\0';
|
||||
return true;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -188,7 +188,7 @@ public:
|
|||
char buf[80];
|
||||
name_t r( "","" );
|
||||
name_write( buf, name );
|
||||
globalErrorStream() << "find unique name for " << buf << "\n";
|
||||
globalErrorStream() << "find unique name for " << buf << '\n';
|
||||
globalErrorStream() << "> currently registered names:\n";
|
||||
for ( names_t::const_iterator i = m_names.begin(); i != m_names.end(); ++i )
|
||||
{
|
||||
|
|
@ -198,7 +198,7 @@ public:
|
|||
j->first.write( buf );
|
||||
globalErrorStream() << " '" << buf << "'";
|
||||
}
|
||||
globalErrorStream() << "\n";
|
||||
globalErrorStream() << '\n';
|
||||
}
|
||||
names_t::const_iterator i = m_names.find( name.first );
|
||||
if ( i == m_names.end() ) {
|
||||
|
|
@ -209,7 +209,7 @@ public:
|
|||
r = name_t( name.first, ( *i ).second.make_unique( name.second ) );
|
||||
}
|
||||
name_write( buf, r );
|
||||
globalErrorStream() << "> unique name is " << buf << "\n";
|
||||
globalErrorStream() << "> unique name is " << buf << '\n';
|
||||
return r;
|
||||
#else
|
||||
names_t::const_iterator i = m_names.find( name.first );
|
||||
|
|
|
|||
|
|
@ -92,7 +92,7 @@ public:
|
|||
|
||||
PakFileSystem::entry_type& file = m_filesystem[entry.filename];
|
||||
if ( !file.is_directory() ) {
|
||||
globalWarningStream() << "Warning: pak archive " << makeQuoted( m_name ) << " contains duplicated file: " << makeQuoted( entry.filename ) << "\n";
|
||||
globalWarningStream() << "Warning: pak archive " << makeQuoted( m_name ) << " contains duplicated file: " << makeQuoted( entry.filename ) << '\n';
|
||||
}
|
||||
else
|
||||
{
|
||||
|
|
|
|||
|
|
@ -161,7 +161,7 @@ class ZipArchive final : public Archive
|
|||
{
|
||||
ZipFileSystem::entry_type& file = m_filesystem[filename.data()];
|
||||
if ( !file.is_directory() ) {
|
||||
globalWarningStream() << "Warning: zip archive " << makeQuoted( m_name ) << " contains duplicated file: " << makeQuoted( filename.data() ) << "\n";
|
||||
globalWarningStream() << "Warning: zip archive " << makeQuoted( m_name ) << " contains duplicated file: " << makeQuoted( filename.data() ) << '\n';
|
||||
}
|
||||
else
|
||||
{
|
||||
|
|
|
|||
|
|
@ -223,7 +223,7 @@ private:
|
|||
|
||||
aiString matname = material->GetName();
|
||||
#ifdef _DEBUG
|
||||
globalOutputStream() << "matname: " << matname.C_Str() << "\n";
|
||||
globalOutputStream() << "matname: " << matname.C_Str() << '\n';
|
||||
#endif
|
||||
if( aiString texname;
|
||||
aiReturn_SUCCESS == material->Get( AI_MATKEY_TEXTURE_DIFFUSE(0), texname )
|
||||
|
|
@ -233,18 +233,18 @@ private:
|
|||
&& !string_equal_prefix_nocase( matname.C_Str(), "models/" )
|
||||
&& !string_equal_prefix_nocase( matname.C_Str(), "models\\" ) ){
|
||||
#ifdef _DEBUG
|
||||
globalOutputStream() << "texname: " << texname.C_Str() << "\n";
|
||||
globalOutputStream() << "texname: " << texname.C_Str() << '\n';
|
||||
#endif
|
||||
m_shader = StringOutputStream()( PathCleaned( PathExtensionless( texname.C_Str() ) ) );
|
||||
m_shader = StringStream<64>( PathCleaned( PathExtensionless( texname.C_Str() ) ) );
|
||||
|
||||
}
|
||||
else{
|
||||
m_shader = StringOutputStream()( PathCleaned( PathExtensionless( matname.C_Str() ) ) );
|
||||
m_shader = StringStream<64>( PathCleaned( PathExtensionless( matname.C_Str() ) ) );
|
||||
}
|
||||
|
||||
const CopiedString oldShader( m_shader );
|
||||
if( strchr( m_shader.c_str(), '/' ) == nullptr ){ /* texture is likely in the folder, where model is */
|
||||
m_shader = StringOutputStream()( scene.m_rootPath, m_shader );
|
||||
m_shader = StringStream<64>( scene.m_rootPath, m_shader );
|
||||
}
|
||||
else{
|
||||
const char *name = m_shader.c_str();
|
||||
|
|
@ -255,13 +255,13 @@ private:
|
|||
m_shader = p + 1;
|
||||
}
|
||||
else{
|
||||
m_shader = StringOutputStream()( scene.m_rootPath, path_get_filename_start( name ) );
|
||||
m_shader = StringStream<64>( scene.m_rootPath, path_get_filename_start( name ) );
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if( oldShader != m_shader )
|
||||
globalOutputStream() << "substituting: " << oldShader << " -> " << m_shader << "\n";
|
||||
globalOutputStream() << "substituting: " << oldShader << " -> " << m_shader << '\n';
|
||||
}
|
||||
|
||||
m_vertices.resize( mesh->mNumVertices );
|
||||
|
|
@ -688,8 +688,8 @@ scene::Node& loadPicoModel( Assimp::Importer& importer, ArchiveFile& file ){
|
|||
if( scene != nullptr ){
|
||||
if( scene->mFlags & AI_SCENE_FLAGS_INCOMPLETE )
|
||||
globalWarningStream() << "AI_SCENE_FLAGS_INCOMPLETE\n";
|
||||
const auto rootPath = StringOutputStream()( PathFilenameless( file.getName() ) );
|
||||
const auto matName = StringOutputStream()( PathExtensionless( file.getName() ) );
|
||||
const auto rootPath = StringStream<64>( PathFilenameless( file.getName() ) );
|
||||
const auto matName = StringStream<64>( PathExtensionless( file.getName() ) );
|
||||
return ( new PicoModelNode( AssScene{ scene, rootPath, path_extension_is( file.getName(), "mdl" )? matName.c_str() : nullptr } ) )->node();
|
||||
}
|
||||
else{
|
||||
|
|
|
|||
|
|
@ -62,24 +62,24 @@ class AssLogger : public Assimp::Logger
|
|||
public:
|
||||
void OnDebug( const char* message ) override {
|
||||
#ifdef _DEBUG
|
||||
globalOutputStream() << message << "\n";
|
||||
globalOutputStream() << message << '\n';
|
||||
#endif
|
||||
}
|
||||
void OnVerboseDebug( const char *message ) override {
|
||||
#ifdef _DEBUG
|
||||
globalOutputStream() << message << "\n";
|
||||
globalOutputStream() << message << '\n';
|
||||
#endif
|
||||
}
|
||||
void OnInfo( const char* message ) override {
|
||||
#ifdef _DEBUG
|
||||
globalOutputStream() << message << "\n";
|
||||
globalOutputStream() << message << '\n';
|
||||
#endif
|
||||
}
|
||||
void OnWarn( const char* message ) override {
|
||||
globalWarningStream() << message << "\n";
|
||||
globalWarningStream() << message << '\n';
|
||||
}
|
||||
void OnError( const char* message ) override {
|
||||
globalErrorStream() << message << "\n";
|
||||
globalErrorStream() << message << '\n';
|
||||
}
|
||||
|
||||
bool attachStream( Assimp::LogStream *pStream, unsigned int severity ) override {
|
||||
|
|
@ -102,7 +102,7 @@ public:
|
|||
*/
|
||||
bool Exists( const char* pFile ) const override {
|
||||
if( strchr( pFile, '\\' ) != nullptr ){
|
||||
globalWarningStream() << "AssIOSystem::Exists " << pFile << "\n";
|
||||
globalWarningStream() << "AssIOSystem::Exists " << pFile << '\n';
|
||||
return false;
|
||||
}
|
||||
|
||||
|
|
@ -139,7 +139,7 @@ public:
|
|||
*/
|
||||
Assimp::IOStream* Open( const char* pFile, const char* pMode = "rb" ) override {
|
||||
if( strchr( pFile, '\\' ) != nullptr ){
|
||||
globalWarningStream() << "AssIOSystem::Open " << pFile << "\n";
|
||||
globalWarningStream() << "AssIOSystem::Open " << pFile << '\n';
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
|
|
@ -238,7 +238,7 @@ public:
|
|||
typedef ModelLoader Type;
|
||||
|
||||
ModelPicoAPI( const char* extension ){
|
||||
GlobalFiletypesModule::getTable().addType( Type::Name, extension, filetype_t( StringOutputStream()( extension, " model" ), StringOutputStream()( "*.", extension ) ) );
|
||||
GlobalFiletypesModule::getTable().addType( Type::Name, extension, filetype_t( StringStream<32>( extension, " model" ), StringStream<16>( "*.", extension ) ) );
|
||||
}
|
||||
ModelLoader* getTable(){
|
||||
return &m_modelLoader;
|
||||
|
|
@ -307,7 +307,7 @@ extern "C" void RADIANT_DLLEXPORT Radiant_RegisterModules( ModuleServer& server
|
|||
s_assImporter->GetExtensionList( extensions ); // "*.3ds;*.obj;*.dae"
|
||||
const char *c = extensions.C_Str();
|
||||
while( !string_empty( c ) ){
|
||||
StringOutputStream ext;
|
||||
StringOutputStream ext( 16 );
|
||||
do{
|
||||
if( *c == '*' && *( c + 1 ) == '.' ){
|
||||
c += 2;
|
||||
|
|
@ -326,7 +326,7 @@ extern "C" void RADIANT_DLLEXPORT Radiant_RegisterModules( ModuleServer& server
|
|||
g_PicoModelModules.push_back( PicoModelModule( PicoModelAPIConstructor( ext ) ) );
|
||||
g_PicoModelModules.back().selfRegister();
|
||||
|
||||
// globalOutputStream() << ext << "\n";
|
||||
// globalOutputStream() << ext << '\n';
|
||||
}
|
||||
|
||||
g_ImageMDLModule.selfRegister();
|
||||
|
|
|
|||
|
|
@ -51,16 +51,16 @@ inline void plotBasisFunction( std::size_t numSegments, int point, int degree ){
|
|||
globalOutputStream() << "plotBasisFunction point " << point << " of 4, knot vector:";
|
||||
for ( Knots::iterator i = knots.begin(); i != knots.end(); ++i )
|
||||
{
|
||||
globalOutputStream() << " " << *i;
|
||||
globalOutputStream() << ' ' << *i;
|
||||
}
|
||||
globalOutputStream() << "\n";
|
||||
globalOutputStream() << "t=0 basis=" << BSpline_basis( knots, point, degree, 0.0 ) << "\n";
|
||||
globalOutputStream() << '\n';
|
||||
globalOutputStream() << "t=0 basis=" << BSpline_basis( knots, point, degree, 0.0 ) << '\n';
|
||||
for ( std::size_t i = 1; i < numSegments; ++i )
|
||||
{
|
||||
double t = ( 1.0 / double(numSegments) ) * double(i);
|
||||
globalOutputStream() << "t=" << t << " basis=" << BSpline_basis( knots, point, degree, t ) << "\n";
|
||||
globalOutputStream() << "t=" << t << " basis=" << BSpline_basis( knots, point, degree, t ) << '\n';
|
||||
}
|
||||
globalOutputStream() << "t=1 basis=" << BSpline_basis( knots, point, degree, 1.0 ) << "\n";
|
||||
globalOutputStream() << "t=1 basis=" << BSpline_basis( knots, point, degree, 1.0 ) << '\n';
|
||||
}
|
||||
|
||||
inline bool ControlPoints_parse( ControlPoints& controlPoints, const char* value ){
|
||||
|
|
@ -97,9 +97,9 @@ inline void ControlPoints_write( const ControlPoints& controlPoints, StringOutpu
|
|||
value << controlPoints.size() << " (";
|
||||
for ( ControlPoints::const_iterator i = controlPoints.begin(); i != controlPoints.end(); ++i )
|
||||
{
|
||||
value << " " << ( *i ).x() << " " << ( *i ).y() << " " << ( *i ).z() << " ";
|
||||
value << ' ' << ( *i ).x() << ' ' << ( *i ).y() << ' ' << ( *i ).z() << ' ';
|
||||
}
|
||||
value << ")";
|
||||
value << ')';
|
||||
}
|
||||
|
||||
inline void ControlPoint_testSelect( const Vector3& point, ObservedSelectable& selectable, Selector& selector, SelectionTest& test ){
|
||||
|
|
@ -166,7 +166,7 @@ inline void ControlPoints_write( ControlPoints& controlPoints, const char* key,
|
|||
if ( !controlPoints.empty() ) {
|
||||
ControlPoints_write( controlPoints, value );
|
||||
}
|
||||
entity.setKeyValue( key, value.c_str() );
|
||||
entity.setKeyValue( key, value );
|
||||
}
|
||||
|
||||
class CurveEdit
|
||||
|
|
|
|||
|
|
@ -132,15 +132,13 @@ public:
|
|||
ConnectEntities( Entity* e1, Entity* e2, int index ) : m_e1( e1 ), m_e2( e2 ), m_index( index ){
|
||||
}
|
||||
const char *keyname(){
|
||||
StringOutputStream key( 16 );
|
||||
if ( m_index <= 0 ) {
|
||||
return "target";
|
||||
}
|
||||
if ( m_index == 1 ) {
|
||||
return "killtarget";
|
||||
}
|
||||
key << "target" << m_index;
|
||||
return key.c_str();
|
||||
return StringStream<16>( "target", m_index );
|
||||
}
|
||||
void connect( const char* name ){
|
||||
m_e1->setKeyValue( keyname(), name );
|
||||
|
|
@ -189,26 +187,24 @@ public:
|
|||
if ( g_gameType == eGameTypeDoom3 ) {
|
||||
StringOutputStream key( 16 );
|
||||
if ( index >= 0 ) {
|
||||
key << "target";
|
||||
key( "target" );
|
||||
if ( index != 0 ) {
|
||||
key << index;
|
||||
}
|
||||
e1->setKeyValue( key.c_str(), e2->getKeyValue( "name" ) );
|
||||
key.clear();
|
||||
e1->setKeyValue( key, e2->getKeyValue( "name" ) );
|
||||
}
|
||||
else
|
||||
{
|
||||
for ( unsigned int i = 0; ; ++i )
|
||||
{
|
||||
key << "target";
|
||||
key( "target" );
|
||||
if ( i != 0 ) {
|
||||
key << i;
|
||||
}
|
||||
if ( !e1->hasKeyValue( key.c_str() ) ) {
|
||||
e1->setKeyValue( key.c_str(), e2->getKeyValue( "name" ) );
|
||||
if ( !e1->hasKeyValue( key ) ) {
|
||||
e1->setKeyValue( key, e2->getKeyValue( "name" ) );
|
||||
break;
|
||||
}
|
||||
key.clear();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -227,9 +223,8 @@ public:
|
|||
if ( string_empty( type ) ) {
|
||||
type = "t";
|
||||
}
|
||||
StringOutputStream key( 64 );
|
||||
key << type << "1";
|
||||
GlobalNamespace().makeUnique( key.c_str(), ConnectEntities::ConnectCaller( connector ) );
|
||||
const auto key = StringStream<64>( type, '1' );
|
||||
GlobalNamespace().makeUnique( key, ConnectEntities::ConnectCaller( connector ) );
|
||||
}
|
||||
}
|
||||
//normal connect
|
||||
|
|
@ -250,9 +245,8 @@ public:
|
|||
if ( string_empty( type ) ) {
|
||||
type = "t";
|
||||
}
|
||||
StringOutputStream key( 64 );
|
||||
key << type << "1";
|
||||
GlobalNamespace().makeUnique( key.c_str(), ConnectEntities::ConnectCaller( connector ) );
|
||||
const auto key = StringStream<64>( type, '1' );
|
||||
GlobalNamespace().makeUnique( key, ConnectEntities::ConnectCaller( connector ) );
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -846,7 +846,7 @@ public:
|
|||
r[2] = r[0] / sqrt( 255.f );
|
||||
}
|
||||
}
|
||||
// globalOutputStream() << r[0] << " " << r[1] << " " << r[2] << " m_radii_transformed\n";
|
||||
// globalOutputStream() << r[0] << ' ' << r[1] << ' ' << r[2] << " m_radii_transformed\n";
|
||||
}
|
||||
float calculateIntensityFromRadii() const {
|
||||
return std::copysign( spawnflags_linear( m_flags ) // keep intensity sign, while adjusting it via radii
|
||||
|
|
@ -1935,7 +1935,7 @@ public:
|
|||
}
|
||||
else
|
||||
{
|
||||
//globalOutputStream() << getTranslation() << "\n";
|
||||
//globalOutputStream() << getTranslation() << '\n';
|
||||
if ( g_lightType == LIGHTTYPE_DOOM3 ) {
|
||||
m_dragPlanes.m_bounds = m_contained.aabb();
|
||||
m_contained.setLightRadius( m_dragPlanes.evaluateResize( getTranslation(), rotation() ) );
|
||||
|
|
|
|||
|
|
@ -67,7 +67,7 @@ class RemapKeysObserver : public Entity::Observer, public ModelSkin
|
|||
const char* split = strchr( value, ';' );
|
||||
if( split != nullptr ){
|
||||
m_from = { value, split };
|
||||
m_to = StringOutputStream( 64 )( PathCleaned( split + 1 ) ).c_str();
|
||||
m_to = StringStream<64>( PathCleaned( split + 1 ) );
|
||||
}
|
||||
else{
|
||||
m_from = "";
|
||||
|
|
|
|||
|
|
@ -58,10 +58,8 @@ public:
|
|||
}
|
||||
|
||||
void modelChanged( const char* value ){
|
||||
StringOutputStream cleaned( string_length( value ) );
|
||||
cleaned << PathCleaned( value );
|
||||
m_resource.detach( *this );
|
||||
m_resource.setName( cleaned.c_str() );
|
||||
m_resource.setName( StringOutputStream( string_length( value ) + 1 )( PathCleaned( value ) ) );
|
||||
m_resource.attach( *this );
|
||||
m_modelChanged();
|
||||
}
|
||||
|
|
|
|||
|
|
@ -30,7 +30,7 @@
|
|||
#include "traverselib.h"
|
||||
|
||||
inline void parseTextureName( CopiedString& name, const char* token ){
|
||||
name = StringOutputStream( 256 )( PathCleaned( PathExtensionless( token ) ) ).c_str(); // remove extension
|
||||
name = StringStream( PathCleaned( PathExtensionless( token ) ) ); // remove extension
|
||||
}
|
||||
|
||||
class ModelSkinKey : public ModuleObserver
|
||||
|
|
|
|||
|
|
@ -141,9 +141,9 @@ public:
|
|||
// globalOutputStream() << position << " Projection division\n";
|
||||
matrix4_transform_vector4( volume.GetViewport(), position );
|
||||
// globalOutputStream() << position << " Viewport\n";
|
||||
// globalOutputStream() << volume.GetViewport()[0] << " " << volume.GetViewport()[5] << " Viewport size\n";
|
||||
// globalOutputStream() << volume.GetViewport()[0] << ' ' << volume.GetViewport()[5] << " Viewport size\n";
|
||||
m_label.screenPos = position.vec3().vec2();
|
||||
// globalOutputStream() << m_label.screenPos << "\n";
|
||||
// globalOutputStream() << m_label.screenPos << '\n';
|
||||
|
||||
renderer.PushState();
|
||||
|
||||
|
|
|
|||
|
|
@ -60,13 +60,13 @@ class NameKeys : public Entity::Observer, public Namespaced
|
|||
|
||||
void insertName( const char* key, EntityKeyValue& value ){
|
||||
if ( m_namespace != 0 && m_keyIsName( key ) ) {
|
||||
//globalOutputStream() << "insert " << key << "\n";
|
||||
//globalOutputStream() << "insert " << key << '\n';
|
||||
m_namespace->attach( KeyValueAssignCaller( value ), KeyValueAttachCaller( value ) );
|
||||
}
|
||||
}
|
||||
void eraseName( const char* key, EntityKeyValue& value ){
|
||||
if ( m_namespace != 0 && m_keyIsName( key ) ) {
|
||||
//globalOutputStream() << "erase " << key << "\n";
|
||||
//globalOutputStream() << "erase " << key << '\n';
|
||||
m_namespace->detach( KeyValueAssignCaller( value ), KeyValueDetachCaller( value ) );
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -57,17 +57,17 @@ inline void write_rotation( const Float9 rotation, Entity* entity, const char* k
|
|||
}
|
||||
else
|
||||
{
|
||||
StringOutputStream value( 256 );
|
||||
value << rotation[0] << ' '
|
||||
<< rotation[1] << ' '
|
||||
<< rotation[2] << ' '
|
||||
<< rotation[3] << ' '
|
||||
<< rotation[4] << ' '
|
||||
<< rotation[5] << ' '
|
||||
<< rotation[6] << ' '
|
||||
<< rotation[7] << ' '
|
||||
<< rotation[8];
|
||||
entity->setKeyValue( key, value.c_str() );
|
||||
const auto value = StringStream(
|
||||
rotation[0], ' ',
|
||||
rotation[1], ' ',
|
||||
rotation[2], ' ',
|
||||
rotation[3], ' ',
|
||||
rotation[4], ' ',
|
||||
rotation[5], ' ',
|
||||
rotation[6], ' ',
|
||||
rotation[7], ' ',
|
||||
rotation[8] );
|
||||
entity->setKeyValue( key, value );
|
||||
}
|
||||
}
|
||||
inline void read_rotation( Float9 rotation, const char* value ){
|
||||
|
|
|
|||
|
|
@ -38,7 +38,7 @@
|
|||
#include "stringio.h"
|
||||
|
||||
void parseShaderName( CopiedString& name, const char* token ){
|
||||
name = StringOutputStream( 256 )( PathCleaned( token ) ).c_str();
|
||||
name = StringStream( PathCleaned( token ) );
|
||||
}
|
||||
|
||||
class Doom3ModelSkin
|
||||
|
|
@ -136,11 +136,9 @@ public:
|
|||
}
|
||||
|
||||
void parseFile( const char* name ){
|
||||
StringOutputStream relativeName( 64 );
|
||||
relativeName << "skins/" << name;
|
||||
ArchiveTextFile* file = GlobalFileSystem().openTextFile( relativeName.c_str() );
|
||||
ArchiveTextFile* file = GlobalFileSystem().openTextFile( StringStream<64>( "skins/", name ) );
|
||||
if ( file != 0 ) {
|
||||
globalOutputStream() << "parsing skins from " << makeQuoted( name ) << "\n";
|
||||
globalOutputStream() << "parsing skins from " << makeQuoted( name ) << '\n';
|
||||
{
|
||||
Tokeniser& tokeniser = GlobalScriptLibrary().m_pfnNewSimpleTokeniser( file->getInputStream() );
|
||||
parseTokens( tokeniser );
|
||||
|
|
@ -150,7 +148,7 @@ public:
|
|||
}
|
||||
else
|
||||
{
|
||||
globalErrorStream() << "failed to open " << makeQuoted( name ) << "\n";
|
||||
globalErrorStream() << "failed to open " << makeQuoted( name ) << '\n';
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -356,7 +356,7 @@ static Image* LoadJPGBuff_( const void *src_buffer, int src_size ){
|
|||
jerr.pub.error_exit = my_jpeg_error_exit;
|
||||
|
||||
if ( setjmp( jerr.setjmp_buffer ) ) { //< TODO: use c++ exceptions instead of setjmp/longjmp to handle errors
|
||||
globalWarningStream() << "WARNING: JPEG library error: " << errormsg << "\n";
|
||||
globalWarningStream() << "WARNING: JPEG library error: " << errormsg << '\n';
|
||||
jpeg_destroy_decompress( &cinfo );
|
||||
return 0;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -371,7 +371,7 @@ Image* LoadKTXBuff( PointerInputStream& istream ){
|
|||
}
|
||||
|
||||
if ( !decoder ) {
|
||||
globalErrorStream() << "LoadKTX: Image has an unsupported pixel type " << type << " or format " << format << "\n";
|
||||
globalErrorStream() << "LoadKTX: Image has an unsupported pixel type " << type << " or format " << format << '\n';
|
||||
image->release();
|
||||
return 0;
|
||||
}
|
||||
|
|
@ -400,7 +400,7 @@ Image* LoadKTXBuff( PointerInputStream& istream ){
|
|||
KTX_DecodeETC1( istream, *image );
|
||||
break;
|
||||
default:
|
||||
globalErrorStream() << "LoadKTX: Image has an unsupported compressed format " << format << "\n";
|
||||
globalErrorStream() << "LoadKTX: Image has an unsupported compressed format " << format << '\n';
|
||||
image->release();
|
||||
return 0;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -34,11 +34,11 @@
|
|||
#include <cstdlib>
|
||||
|
||||
void user_warning_fn( png_structp png_ptr, png_const_charp warning_msg ){
|
||||
globalWarningStream() << "libpng warning: " << warning_msg << "\n";
|
||||
globalWarningStream() << "libpng warning: " << warning_msg << '\n';
|
||||
}
|
||||
|
||||
void user_error_fn( png_structp png_ptr, png_const_charp error_msg ){
|
||||
globalErrorStream() << "libpng error: " << error_msg << "\n";
|
||||
globalErrorStream() << "libpng error: " << error_msg << '\n';
|
||||
longjmp( png_jmpbuf(png_ptr), 0 );
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -93,7 +93,7 @@ NodeSmartReference Entity_parseTokens( Tokeniser& tokeniser, EntityCreator& enti
|
|||
}
|
||||
else
|
||||
{
|
||||
globalErrorStream() << "entity " << index << ": type " << classname << ": discarding brush " << count_primitives << "\n";
|
||||
globalErrorStream() << "entity " << index << ": type " << classname << ": discarding brush " << count_primitives << '\n';
|
||||
}
|
||||
++count_primitives;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -111,7 +111,7 @@ public:
|
|||
return;
|
||||
}
|
||||
if ( version != MapVersion ) {
|
||||
globalErrorStream() << "Doom 3 map version " << MapVersion << " supported, version is " << version << "\n";
|
||||
globalErrorStream() << "Doom 3 map version " << MapVersion << " supported, version is " << version << '\n';
|
||||
return;
|
||||
}
|
||||
tokeniser.nextLine();
|
||||
|
|
@ -182,7 +182,7 @@ public:
|
|||
return;
|
||||
}
|
||||
if ( version != MapVersion ) {
|
||||
globalErrorStream() << "Quake 4 map version " << MapVersion << " supported, version is " << version << "\n";
|
||||
globalErrorStream() << "Quake 4 map version " << MapVersion << " supported, version is " << version << '\n';
|
||||
return;
|
||||
}
|
||||
tokeniser.nextLine();
|
||||
|
|
|
|||
|
|
@ -72,7 +72,7 @@ public:
|
|||
if ( entity != 0 ) {
|
||||
if( entity->isContainer() && Node_getTraversable( node )->empty() && !string_equal( entity->getClassName(), "worldspawn" )
|
||||
&& !entity->hasKeyValue( "origin" ) ){
|
||||
globalErrorStream() << "discarding empty group entity: # = " << g_count_entities << "; classname = " << entity->getClassName() << "\n";
|
||||
globalErrorStream() << "discarding empty group entity: # = " << g_count_entities << "; classname = " << entity->getClassName() << '\n';
|
||||
return false;
|
||||
}
|
||||
m_writer.writeToken( "//" );
|
||||
|
|
|
|||
|
|
@ -250,9 +250,9 @@ void MD2Surface_read( Model& model, const byte* buffer, ArchiveFile& file ){
|
|||
}
|
||||
path[i] = '\0';
|
||||
}
|
||||
// globalErrorStream() << "modified skinname: " << path << " (path) and " << skinnameRelative << " (texture)" << "\n";
|
||||
// globalErrorStream() << "modified skinname: " << path << " (path) and " << skinnameRelative << " (texture)" << '\n';
|
||||
snprintf( skinname, MD2_MAX_SKINNAME, "%s%s", path, &skinnameRelative[1] );
|
||||
// globalErrorStream() << skinname << "\n";
|
||||
// globalErrorStream() << skinname << '\n';
|
||||
}
|
||||
else
|
||||
{
|
||||
|
|
|
|||
|
|
@ -65,7 +65,7 @@ inline VertexPointer vertexpointer_arbitrarymeshvertex( const ArbitraryMeshVerte
|
|||
}
|
||||
|
||||
inline void parseTextureName( CopiedString& name, const char* token ){
|
||||
name = StringOutputStream( 256 )( PathCleaned( PathExtensionless( token ) ) ).c_str(); // remove extension
|
||||
name = StringStream<64>( PathCleaned( PathExtensionless( token ) ) ); // remove extension
|
||||
}
|
||||
|
||||
// generic renderable triangle surface
|
||||
|
|
|
|||
|
|
@ -53,23 +53,23 @@ void PicoPrintFunc( int level, const char *str ){
|
|||
switch ( level )
|
||||
{
|
||||
case PICO_NORMAL:
|
||||
globalOutputStream() << str << "\n";
|
||||
globalOutputStream() << str << '\n';
|
||||
break;
|
||||
|
||||
case PICO_VERBOSE:
|
||||
//globalOutputStream() << "PICO_VERBOSE: " << str << "\n";
|
||||
//globalOutputStream() << "PICO_VERBOSE: " << str << '\n';
|
||||
break;
|
||||
|
||||
case PICO_WARNING:
|
||||
globalWarningStream() << "PICO_WARNING: " << str << "\n";
|
||||
globalWarningStream() << "PICO_WARNING: " << str << '\n';
|
||||
break;
|
||||
|
||||
case PICO_ERROR:
|
||||
globalErrorStream() << "PICO_ERROR: " << str << "\n";
|
||||
globalErrorStream() << "PICO_ERROR: " << str << '\n';
|
||||
break;
|
||||
|
||||
case PICO_FATAL:
|
||||
globalErrorStream() << "PICO_FATAL: " << str << "\n";
|
||||
globalErrorStream() << "PICO_FATAL: " << str << '\n';
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
|
@ -122,9 +122,8 @@ public:
|
|||
|
||||
ModelPicoAPI( const char* extension, const picoModule_t* module ) :
|
||||
m_modelLoader( module ){
|
||||
StringOutputStream filter( 128 );
|
||||
filter << "*." << extension;
|
||||
GlobalFiletypesModule::getTable().addType( Type::Name, extension, filetype_t( module->displayName, filter.c_str() ) );
|
||||
const auto filter = StringStream<16>( "*.", extension );
|
||||
GlobalFiletypesModule::getTable().addType( Type::Name, extension, filetype_t( module->displayName, filter ) );
|
||||
}
|
||||
ModelLoader* getTable(){
|
||||
return &m_modelLoader;
|
||||
|
|
|
|||
|
|
@ -202,9 +202,7 @@ Image* loadHeightmap( void* environment, const char* name ){
|
|||
|
||||
Image* loadSpecial( void* environment, const char* name ){
|
||||
if ( *name == '_' ) { // special image
|
||||
StringOutputStream bitmapName( 256 );
|
||||
bitmapName << GlobalRadiant().getAppPath() << "bitmaps/" << name + 1 << ".png";
|
||||
Image* image = loadBitmap( environment, bitmapName.c_str() );
|
||||
Image* image = loadBitmap( environment, StringStream( GlobalRadiant().getAppPath(), "bitmaps/", name + 1, ".png" ) );
|
||||
if ( image != 0 ) {
|
||||
return image;
|
||||
}
|
||||
|
|
@ -228,7 +226,7 @@ typedef CopiedString TextureExpression;
|
|||
//++timo FIXME: we need to put code somewhere to detect when two shaders that are case insensitive equal are present
|
||||
template<typename StringType>
|
||||
void parseTextureName( StringType& name, const char* token ){
|
||||
name = StringOutputStream( 256 )( PathCleaned( PathExtensionless( token ) ) ).c_str(); // remove extension
|
||||
name = StringStream<64>( PathCleaned( PathExtensionless( token ) ) ).c_str(); // remove extension
|
||||
}
|
||||
|
||||
bool Tokeniser_parseTextureName( Tokeniser& tokeniser, TextureExpression& name ){
|
||||
|
|
@ -705,7 +703,7 @@ bool parseTemplateInstance( Tokeniser& tokeniser, const char* filename ){
|
|||
const char* templateName = tokeniser.getToken();
|
||||
ShaderTemplate* shaderTemplate = findTemplate( templateName );
|
||||
if ( shaderTemplate == 0 ) {
|
||||
globalErrorStream() << "shader instance: " << makeQuoted( name ) << ": shader template not found: " << makeQuoted( templateName ) << "\n";
|
||||
globalErrorStream() << "shader instance: " << makeQuoted( name ) << ": shader template not found: " << makeQuoted( templateName ) << '\n';
|
||||
}
|
||||
|
||||
ShaderArguments args;
|
||||
|
|
@ -772,14 +770,14 @@ qtexture_t* evaluateTexture( const TextureExpression& texture, const ShaderParam
|
|||
}
|
||||
result << expression;
|
||||
}
|
||||
return GlobalTexturesCache().capture( loader, result.c_str() );
|
||||
return GlobalTexturesCache().capture( loader, result );
|
||||
}
|
||||
|
||||
float evaluateFloat( const ShaderValue& value, const ShaderParameters& params, const ShaderArguments& args ){
|
||||
const char* result = evaluateShaderValue( value.c_str(), params, args );
|
||||
float f;
|
||||
if ( !string_parse_float( result, f ) ) {
|
||||
globalErrorStream() << "parsing float value failed: " << makeQuoted( result ) << "\n";
|
||||
globalErrorStream() << "parsing float value failed: " << makeQuoted( result ) << '\n';
|
||||
return 1.f;
|
||||
}
|
||||
return f;
|
||||
|
|
@ -822,7 +820,7 @@ BlendFactor evaluateBlendFactor( const ShaderValue& value, const ShaderParameter
|
|||
return BLEND_SRC_ALPHA_SATURATE;
|
||||
}
|
||||
|
||||
globalErrorStream() << "parsing blend-factor value failed: " << makeQuoted( result ) << "\n";
|
||||
globalErrorStream() << "parsing blend-factor value failed: " << makeQuoted( result ) << '\n';
|
||||
return BLEND_ZERO;
|
||||
}
|
||||
|
||||
|
|
@ -957,11 +955,8 @@ public:
|
|||
if ( m_pTexture->texture_number == 0 ) {
|
||||
m_notfound = m_pTexture;
|
||||
|
||||
{
|
||||
StringOutputStream name( 256 );
|
||||
name << GlobalRadiant().getAppPath() << "bitmaps/" << ( IsDefault() ? "notex.png" : "shadernotex.png" );
|
||||
m_pTexture = GlobalTexturesCache().capture( LoadImageCallback( 0, loadBitmap ), name.c_str() );
|
||||
}
|
||||
const auto name = StringStream( GlobalRadiant().getAppPath(), "bitmaps/", ( IsDefault() ? "notex.png" : "shadernotex.png" ) );
|
||||
m_pTexture = GlobalTexturesCache().capture( LoadImageCallback( 0, loadBitmap ), name );
|
||||
}
|
||||
|
||||
realiseLighting();
|
||||
|
|
@ -1021,7 +1016,7 @@ public:
|
|||
}
|
||||
else
|
||||
{
|
||||
globalErrorStream() << "parsing blend value failed: " << makeQuoted( blend ) << "\n";
|
||||
globalErrorStream() << "parsing blend value failed: " << makeQuoted( blend ) << '\n';
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -1402,7 +1397,7 @@ void ParseShaderFile( Tokeniser& tokeniser, const char* filename ){
|
|||
}
|
||||
else
|
||||
{
|
||||
globalErrorStream() << "Error parsing shader " << shaderTemplate->getName() << "\n";
|
||||
globalErrorStream() << "Error parsing shader " << shaderTemplate->getName() << '\n';
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
|
@ -1452,7 +1447,7 @@ void LoadShaderFile( const char* filename ){
|
|||
ArchiveTextFile* file = GlobalFileSystem().openTextFile( filename );
|
||||
|
||||
if ( file != 0 ) {
|
||||
globalOutputStream() << "Parsing shaderfile " << filename << "\n";
|
||||
globalOutputStream() << "Parsing shaderfile " << filename << '\n';
|
||||
|
||||
Tokeniser& tokeniser = GlobalScriptLibrary().m_pfnNewScriptTokeniser( file->getInputStream() );
|
||||
|
||||
|
|
@ -1463,7 +1458,7 @@ void LoadShaderFile( const char* filename ){
|
|||
}
|
||||
else
|
||||
{
|
||||
globalWarningStream() << "Unable to read shaderfile " << filename << "\n";
|
||||
globalWarningStream() << "Unable to read shaderfile " << filename << '\n';
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -1471,23 +1466,22 @@ typedef FreeCaller1<const char*, LoadShaderFile> LoadShaderFileCaller;
|
|||
|
||||
|
||||
void loadGuideFile( const char* filename ){
|
||||
StringOutputStream fullname( 256 );
|
||||
fullname << "guides/" << filename;
|
||||
ArchiveTextFile* file = GlobalFileSystem().openTextFile( fullname.c_str() );
|
||||
const auto fullname = StringStream( "guides/", filename );
|
||||
ArchiveTextFile* file = GlobalFileSystem().openTextFile( fullname );
|
||||
|
||||
if ( file != 0 ) {
|
||||
globalOutputStream() << "Parsing guide file " << fullname.c_str() << "\n";
|
||||
globalOutputStream() << "Parsing guide file " << fullname << '\n';
|
||||
|
||||
Tokeniser& tokeniser = GlobalScriptLibrary().m_pfnNewScriptTokeniser( file->getInputStream() );
|
||||
|
||||
parseGuideFile( tokeniser, fullname.c_str() );
|
||||
parseGuideFile( tokeniser, fullname );
|
||||
|
||||
tokeniser.release();
|
||||
file->release();
|
||||
}
|
||||
else
|
||||
{
|
||||
globalWarningStream() << "Unable to read guide file " << fullname.c_str() << "\n";
|
||||
globalWarningStream() << "Unable to read guide file " << fullname << '\n';
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -1561,7 +1555,7 @@ void IfFound_dumpUnreferencedShader( bool& bFound, const char* filename ){
|
|||
bFound = true;
|
||||
globalOutputStream() << "Following shader files are not referenced in any shaderlist.txt:\n";
|
||||
}
|
||||
globalOutputStream() << "\t" << filename << "\n";
|
||||
globalOutputStream() << '\t' << filename << '\n';
|
||||
}
|
||||
}
|
||||
typedef ReferenceCaller1<bool, const char*, IfFound_dumpUnreferencedShader> IfFoundDumpUnreferencedShaderCaller;
|
||||
|
|
@ -1599,22 +1593,15 @@ typedef FreeCaller1<const char*, ShaderList_addShaderFile> AddShaderFileCaller;
|
|||
*/
|
||||
void BuildShaderList( TextInputStream& shaderlist ){
|
||||
Tokeniser& tokeniser = GlobalScriptLibrary().m_pfnNewSimpleTokeniser( shaderlist );
|
||||
tokeniser.nextLine();
|
||||
const char* token = tokeniser.getToken();
|
||||
StringOutputStream shaderFile( 64 );
|
||||
while ( token != 0 )
|
||||
for( const char* token; tokeniser.nextLine(), token = tokeniser.getToken(); )
|
||||
{
|
||||
// each token should be a shader filename
|
||||
shaderFile << token;
|
||||
shaderFile( token );
|
||||
if( !path_extension_is( token, g_shadersExtension ) )
|
||||
shaderFile << "." << g_shadersExtension;
|
||||
shaderFile << '.' << g_shadersExtension;
|
||||
|
||||
ShaderList_addShaderFile( shaderFile.c_str() );
|
||||
|
||||
tokeniser.nextLine();
|
||||
token = tokeniser.getToken();
|
||||
|
||||
shaderFile.clear();
|
||||
ShaderList_addShaderFile( shaderFile );
|
||||
}
|
||||
tokeniser.release();
|
||||
}
|
||||
|
|
@ -1627,9 +1614,9 @@ void ShaderList_addFromArchive( const char *archivename ){
|
|||
|
||||
Archive *archive = GlobalFileSystem().getArchive( archivename, false );
|
||||
if ( archive ) {
|
||||
ArchiveTextFile *file = archive->openTextFile( StringOutputStream( 64 )( DirectoryCleaned( shaderpath ), "shaderlist.txt" ).c_str() );
|
||||
ArchiveTextFile *file = archive->openTextFile( StringStream<64>( DirectoryCleaned( shaderpath ), "shaderlist.txt" ) );
|
||||
if ( file ) {
|
||||
globalOutputStream() << "Found shaderlist.txt in " << archivename << "\n";
|
||||
globalOutputStream() << "Found shaderlist.txt in " << archivename << '\n';
|
||||
BuildShaderList( file->getInputStream() );
|
||||
file->release();
|
||||
}
|
||||
|
|
@ -1641,23 +1628,20 @@ typedef FreeCaller1<const char *, ShaderList_addFromArchive> AddShaderListFromAr
|
|||
#include "stream/filestream.h"
|
||||
|
||||
bool shaderlist_findOrInstall( const char* enginePath, const char* toolsPath, const char* shaderPath, const char* gamename ){
|
||||
StringOutputStream absShaderList( 256 );
|
||||
absShaderList << enginePath << gamename << '/' << shaderPath << "shaderlist.txt";
|
||||
if ( file_exists( absShaderList.c_str() ) ) {
|
||||
const auto absShaderList = StringStream( enginePath, gamename, '/', shaderPath, "shaderlist.txt" );
|
||||
if ( file_exists( absShaderList ) ) {
|
||||
return true;
|
||||
}
|
||||
{
|
||||
StringOutputStream directory( 256 );
|
||||
directory << enginePath << gamename << '/' << shaderPath;
|
||||
if ( !file_exists( directory.c_str() ) && !Q_mkdir( directory.c_str() ) ) {
|
||||
const auto directory = StringStream( enginePath, gamename, '/', shaderPath );
|
||||
if ( !file_exists( directory ) && !Q_mkdir( directory ) ) {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
{
|
||||
StringOutputStream defaultShaderList( 256 );
|
||||
defaultShaderList << toolsPath << gamename << '/' << "default_shaderlist.txt";
|
||||
if ( file_exists( defaultShaderList.c_str() ) ) {
|
||||
return file_copy( defaultShaderList.c_str(), absShaderList.c_str() );
|
||||
const auto defaultShaderList = StringStream( toolsPath, gamename, '/', "default_shaderlist.txt" );
|
||||
if ( file_exists( defaultShaderList ) ) {
|
||||
return file_copy( defaultShaderList, absShaderList );
|
||||
}
|
||||
}
|
||||
return false;
|
||||
|
|
@ -1670,7 +1654,7 @@ void Shaders_Load(){
|
|||
|
||||
const char* shaderPath = GlobalRadiant().getGameDescriptionKeyValue( "shaderpath" );
|
||||
if ( !string_empty( shaderPath ) ) {
|
||||
const auto path = StringOutputStream( 64 )( DirectoryCleaned( shaderPath ) );
|
||||
const auto path = StringStream<64>( DirectoryCleaned( shaderPath ) );
|
||||
|
||||
if ( g_useShaderList ) {
|
||||
// preload shader files that have been listed in shaderlist.txt
|
||||
|
|
@ -1681,9 +1665,9 @@ void Shaders_Load(){
|
|||
|
||||
bool isMod = !string_equal( basegame, gamename );
|
||||
|
||||
if ( !isMod || !shaderlist_findOrInstall( enginePath, toolsPath, path.c_str(), gamename ) ) {
|
||||
if ( !isMod || !shaderlist_findOrInstall( enginePath, toolsPath, path, gamename ) ) {
|
||||
gamename = basegame;
|
||||
shaderlist_findOrInstall( enginePath, toolsPath, path.c_str(), gamename );
|
||||
shaderlist_findOrInstall( enginePath, toolsPath, path, gamename );
|
||||
}
|
||||
|
||||
GlobalFileSystem().forEachArchive( AddShaderListFromArchiveCaller(), false, true );
|
||||
|
|
@ -1692,20 +1676,18 @@ void Shaders_Load(){
|
|||
}
|
||||
else{
|
||||
globalOutputStream() << "No shaderlist.txt found: loading all shaders\n";
|
||||
GlobalFileSystem().forEachFile( path.c_str(), g_shadersExtension, AddShaderFileCaller(), 1 );
|
||||
GlobalFileSystem().forEachFile( path, g_shadersExtension, AddShaderFileCaller(), 1 );
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
GlobalFileSystem().forEachFile( path.c_str(), g_shadersExtension, AddShaderFileCaller(), 0 );
|
||||
GlobalFileSystem().forEachFile( path, g_shadersExtension, AddShaderFileCaller(), 0 );
|
||||
}
|
||||
|
||||
StringOutputStream shadername( 256 );
|
||||
for( const CopiedString& sh : l_shaderfiles )
|
||||
{
|
||||
shadername << path.c_str() << sh;
|
||||
LoadShaderFile( shadername.c_str() );
|
||||
shadername.clear();
|
||||
LoadShaderFile( shadername( path, sh ) );
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -105,7 +105,7 @@ static void AddSlash( char *str ){
|
|||
std::size_t n = strlen( str );
|
||||
if ( n > 0 ) {
|
||||
if ( str[n - 1] != '\\' && str[n - 1] != '/' ) {
|
||||
globalWarningStream() << "WARNING: directory path does not end with separator: " << str << "\n";
|
||||
globalWarningStream() << "WARNING: directory path does not end with separator: " << str << '\n';
|
||||
strcat( str, "/" );
|
||||
}
|
||||
}
|
||||
|
|
@ -116,7 +116,7 @@ static void FixDOSName( char *src ){
|
|||
return;
|
||||
}
|
||||
|
||||
globalWarningStream() << "WARNING: invalid path separator '\\': " << src << "\n";
|
||||
globalWarningStream() << "WARNING: invalid path separator '\\': " << src << '\n';
|
||||
|
||||
while ( *src )
|
||||
{
|
||||
|
|
@ -130,16 +130,14 @@ static void FixDOSName( char *src ){
|
|||
|
||||
|
||||
const _QERArchiveTable* GetArchiveTable( ArchiveModules& archiveModules, const char* ext ){
|
||||
StringOutputStream tmp( 16 );
|
||||
tmp << LowerCase( ext );
|
||||
return archiveModules.findModule( tmp.c_str() );
|
||||
return archiveModules.findModule( StringStream<16>( LowerCase( ext ) ) );
|
||||
}
|
||||
static void InitPakFile( ArchiveModules& archiveModules, const char *filename ){
|
||||
const _QERArchiveTable* table = GetArchiveTable( archiveModules, path_get_extension( filename ) );
|
||||
|
||||
if ( table != 0 ) {
|
||||
g_archives.push_back( archive_entry_t{ filename, table->m_pfnOpenArchive( filename ), true } );
|
||||
globalOutputStream() << " pak file: " << filename << "\n";
|
||||
globalOutputStream() << " pak file: " << filename << '\n';
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -287,15 +285,13 @@ void InitDirectory( const char* directory, ArchiveModules& archiveModules ){
|
|||
|
||||
g_numDirs++;
|
||||
|
||||
{
|
||||
g_archives.push_back( archive_entry_t{ path, OpenArchive( path ), false } );
|
||||
}
|
||||
g_archives.push_back( archive_entry_t{ path, OpenArchive( path ), false } );
|
||||
|
||||
if ( g_bUsePak ) {
|
||||
GDir* dir = g_dir_open( path, 0, 0 );
|
||||
|
||||
if ( dir != 0 ) {
|
||||
globalOutputStream() << "vfs directory: " << path << "\n";
|
||||
globalOutputStream() << "vfs directory: " << path << '\n';
|
||||
|
||||
const char* ignore_prefix = "";
|
||||
const char* override_prefix = "";
|
||||
|
|
@ -347,9 +343,7 @@ void InitDirectory( const char* directory, ArchiveModules& archiveModules ){
|
|||
AddSlash( g_strDirs[g_numDirs] );
|
||||
g_numDirs++;
|
||||
|
||||
{
|
||||
g_archives.push_back( archive_entry_t{ g_strDirs[g_numDirs - 1], OpenArchive( g_strDirs[g_numDirs - 1] ), false } );
|
||||
}
|
||||
g_archives.push_back( archive_entry_t{ g_strDirs[g_numDirs - 1], OpenArchive( g_strDirs[g_numDirs - 1] ), false } );
|
||||
}
|
||||
|
||||
if ( ( ext == 0 ) || *( ++ext ) == '\0' || GetArchiveTable( archiveModules, ext ) == 0 ) {
|
||||
|
|
@ -388,7 +382,7 @@ void InitDirectory( const char* directory, ArchiveModules& archiveModules ){
|
|||
}
|
||||
else
|
||||
{
|
||||
globalErrorStream() << "vfs directory not found: " << path << "\n";
|
||||
globalErrorStream() << "vfs directory not found: " << path << '\n';
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -436,7 +430,7 @@ int GetFileCount( const char *filename, int flag ){
|
|||
}
|
||||
|
||||
ArchiveFile* OpenFile( const char* filename ){
|
||||
ASSERT_MESSAGE( strchr( filename, '\\' ) == 0, "path contains invalid separator '\\': \"" << filename << "\"" );
|
||||
ASSERT_MESSAGE( strchr( filename, '\\' ) == 0, "path contains invalid separator '\\': " << makeQuoted( filename ) );
|
||||
for ( archive_entry_t& arch : g_archives )
|
||||
{
|
||||
ArchiveFile* file = arch.archive->openFile( filename );
|
||||
|
|
@ -449,7 +443,7 @@ ArchiveFile* OpenFile( const char* filename ){
|
|||
}
|
||||
|
||||
ArchiveTextFile* OpenTextFile( const char* filename ){
|
||||
ASSERT_MESSAGE( strchr( filename, '\\' ) == 0, "path contains invalid separator '\\': \"" << filename << "\"" );
|
||||
ASSERT_MESSAGE( strchr( filename, '\\' ) == 0, "path contains invalid separator '\\': " << makeQuoted( filename ) );
|
||||
for ( archive_entry_t& arch : g_archives )
|
||||
{
|
||||
ArchiveTextFile* file = arch.archive->openTextFile( filename );
|
||||
|
|
|
|||
|
|
@ -54,12 +54,12 @@ void Map_Snapshot(){
|
|||
// 2. find out what the lastest save is based on number
|
||||
// 3. inc that and save the map
|
||||
const char* mapname = Map_Name( g_map );
|
||||
const auto snapshotsDir = StringOutputStream( 256 )( PathFilenameless( mapname ), "snapshots" );
|
||||
const auto snapshotsDir = StringStream( PathFilenameless( mapname ), "snapshots" );
|
||||
|
||||
if ( file_exists( snapshotsDir.c_str() ) || Q_mkdir( snapshotsDir.c_str() ) ) {
|
||||
if ( file_exists( snapshotsDir ) || Q_mkdir( snapshotsDir ) ) {
|
||||
std::size_t lSize = 0;
|
||||
const auto strNewPath = StringOutputStream( 256 )( snapshotsDir.c_str(), '/', path_get_filename_start( mapname ) );
|
||||
const char* ext = path_get_filename_base_end( strNewPath.c_str() );
|
||||
const auto strNewPath = StringStream( snapshotsDir, '/', path_get_filename_start( mapname ) );
|
||||
const char* ext = path_get_filename_base_end( strNewPath );
|
||||
|
||||
StringOutputStream snapshotFilename( 256 );
|
||||
for ( int nCount = 0; ; ++nCount )
|
||||
|
|
@ -68,23 +68,22 @@ void Map_Snapshot(){
|
|||
// The snapshot's filename will be "<path>/snapshots/<name>.<count>.<ext>"
|
||||
snapshotFilename( StringRange( strNewPath.c_str(), ext ), '.', nCount, ext );
|
||||
|
||||
if ( !DoesFileExist( snapshotFilename.c_str(), lSize ) ) {
|
||||
if ( !DoesFileExist( snapshotFilename, lSize ) ) {
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
// save in the next available slot
|
||||
Map_SaveFile( snapshotFilename.c_str() );
|
||||
Map_SaveFile( snapshotFilename );
|
||||
|
||||
if ( lSize > 50 * 1024 * 1024 ) { // total size of saves > 50 mb
|
||||
globalOutputStream() << "The snapshot files in " << snapshotsDir.c_str() << " total more than 50 megabytes. You might consider cleaning up.";
|
||||
globalOutputStream() << "The snapshot files in " << snapshotsDir << " total more than 50 megabytes. You might consider cleaning up.";
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
StringOutputStream strMsg( 256 );
|
||||
strMsg << "Snapshot save failed.. unabled to create directory\n" << snapshotsDir.c_str();
|
||||
qt_MessageBox( MainFrame_getWindow(), strMsg.c_str() );
|
||||
const auto strMsg = StringStream( "Snapshot save failed.. unabled to create directory\n", snapshotsDir );
|
||||
qt_MessageBox( MainFrame_getWindow(), strMsg );
|
||||
}
|
||||
}
|
||||
/*
|
||||
|
|
@ -132,7 +131,7 @@ void QE_CheckAutoSave(){
|
|||
|
||||
if ( g_AutoSave_Enabled ) {
|
||||
const char* strMsg = g_SnapShots_Enabled ? "Autosaving snapshot..." : "Autosaving...";
|
||||
globalOutputStream() << strMsg << "\n";
|
||||
globalOutputStream() << strMsg << '\n';
|
||||
//Sys_Status(strMsg);
|
||||
|
||||
// only snapshot if not working on a default map
|
||||
|
|
@ -142,18 +141,17 @@ void QE_CheckAutoSave(){
|
|||
else
|
||||
{
|
||||
if ( Map_Unnamed( g_map ) ) {
|
||||
StringOutputStream autosave( 256 );
|
||||
autosave << g_qeglobals.m_userGamePath << "maps/";
|
||||
Q_mkdir( autosave.c_str() );
|
||||
auto autosave = StringStream( g_qeglobals.m_userGamePath, "maps/" );
|
||||
Q_mkdir( autosave );
|
||||
autosave << "autosave.map";
|
||||
Map_SaveFile( autosave.c_str() );
|
||||
Map_SaveFile( autosave );
|
||||
}
|
||||
else
|
||||
{
|
||||
const char* name = Map_Name( g_map );
|
||||
const char* extension = path_get_filename_base_end( name );
|
||||
const auto autosave = StringOutputStream( 256 )( StringRange( name, extension ), ".autosave", extension );
|
||||
Map_SaveFile( autosave.c_str() );
|
||||
const auto autosave = StringStream( StringRange( name, extension ), ".autosave", extension );
|
||||
Map_SaveFile( autosave );
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -605,9 +605,9 @@ public:
|
|||
};
|
||||
|
||||
inline void planepts_print( const PlanePoints& planePoints, TextOutputStream& ostream ){
|
||||
ostream << "( " << planePoints[0][0] << " " << planePoints[0][1] << " " << planePoints[0][2] << " ) "
|
||||
<< "( " << planePoints[1][0] << " " << planePoints[1][1] << " " << planePoints[1][2] << " ) "
|
||||
<< "( " << planePoints[2][0] << " " << planePoints[2][1] << " " << planePoints[2][2] << " )";
|
||||
ostream << "( " << planePoints[0][0] << ' ' << planePoints[0][1] << ' ' << planePoints[0][2] << " ) "
|
||||
<< "( " << planePoints[1][0] << ' ' << planePoints[1][1] << ' ' << planePoints[1][2] << " ) "
|
||||
<< "( " << planePoints[2][0] << ' ' << planePoints[2][1] << ' ' << planePoints[2][2] << " )";
|
||||
}
|
||||
|
||||
|
||||
|
|
@ -688,7 +688,7 @@ public:
|
|||
if ( check_plane_is_integer( m_planepts ) ) {
|
||||
globalErrorStream() << "non-integer planepts: ";
|
||||
planepts_print( m_planepts, globalErrorStream() );
|
||||
globalErrorStream() << "\n";
|
||||
globalErrorStream() << '\n';
|
||||
}
|
||||
#endif
|
||||
m_planeCached = plane3_for_points( m_planepts );
|
||||
|
|
@ -1689,7 +1689,7 @@ public:
|
|||
Brush& operator=( const Brush& other ) = delete;
|
||||
|
||||
void setDoom3GroupOrigin( const Vector3& origin ){
|
||||
//globalOutputStream() << "func_static origin before: " << m_funcStaticOrigin << " after: " << origin << "\n";
|
||||
//globalOutputStream() << "func_static origin before: " << m_funcStaticOrigin << " after: " << origin << '\n';
|
||||
for ( Faces::iterator i = m_faces.begin(); i != m_faces.end(); ++i )
|
||||
{
|
||||
( *i )->getPlane().m_funcStaticOrigin = origin;
|
||||
|
|
@ -2172,7 +2172,7 @@ public:
|
|||
buffer[!swap].clear();
|
||||
|
||||
#if BRUSH_CONNECTIVITY_DEBUG
|
||||
globalOutputStream() << "clip vs face: " << i << "\n";
|
||||
globalOutputStream() << "clip vs face: " << i << '\n';
|
||||
#endif
|
||||
|
||||
{
|
||||
|
|
@ -2185,7 +2185,7 @@ public:
|
|||
for ( FixedWinding::Points::iterator k = buffer[!swap].points.begin(), j = buffer[!swap].points.end() - 1; k != buffer[!swap].points.end(); j = k, ++k )
|
||||
{
|
||||
if ( vector3_length_squared( vector3_subtracted( ( *k ).vertex, ( *j ).vertex ) ) < 1 ) {
|
||||
globalOutputStream() << "v: " << std::distance( buffer[!swap].points.begin(), j ) << " tiny edge adjacent to face " << ( *j ).adjacent << "\n";
|
||||
globalOutputStream() << "v: " << std::distance( buffer[!swap].points.begin(), j ) << " tiny edge adjacent to face " << ( *j ).adjacent << '\n';
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
|
@ -2204,7 +2204,7 @@ public:
|
|||
for ( Winding::iterator i = winding.begin(), j = winding.end() - 1; i != winding.end(); j = i, ++i )
|
||||
{
|
||||
if ( vector3_length_squared( vector3_subtracted( ( *i ).vertex, ( *j ).vertex ) ) < 1 ) {
|
||||
globalOutputStream() << "v: " << std::distance( winding.begin(), j ) << " tiny edge adjacent to face " << ( *j ).adjacent << "\n";
|
||||
globalOutputStream() << "v: " << std::distance( winding.begin(), j ) << " tiny edge adjacent to face " << ( *j ).adjacent << '\n';
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
|
@ -2373,7 +2373,7 @@ private:
|
|||
std::size_t next = Winding_next( winding, index );
|
||||
if ( Edge_isDegenerate( winding[index].vertex, winding[next].vertex ) ) {
|
||||
#if BRUSH_DEGENERATE_DEBUG
|
||||
globalOutputStream() << "Brush::buildWindings: face " << i << ": degenerate edge adjacent to " << winding[index].adjacent << "\n";
|
||||
globalOutputStream() << "Brush::buildWindings: face " << i << ": degenerate edge adjacent to " << winding[index].adjacent << '\n';
|
||||
#endif
|
||||
Winding& other = m_faces[winding[index].adjacent]->getWinding();
|
||||
std::size_t adjacent = Winding_FindAdjacent( other, i );
|
||||
|
|
@ -2399,7 +2399,7 @@ private:
|
|||
|
||||
if ( degen.numpoints == 2 ) {
|
||||
#if BRUSH_DEGENERATE_DEBUG
|
||||
globalOutputStream() << "Brush::buildWindings: face " << i << ": degenerate winding adjacent to " << degen[0].adjacent << ", " << degen[1].adjacent << "\n";
|
||||
globalOutputStream() << "Brush::buildWindings: face " << i << ": degenerate winding adjacent to " << degen[0].adjacent << ", " << degen[1].adjacent << '\n';
|
||||
#endif
|
||||
// this is an "edge" face, where the plane touches the edge of the brush
|
||||
{
|
||||
|
|
@ -2407,7 +2407,7 @@ private:
|
|||
std::size_t index = Winding_FindAdjacent( winding, i );
|
||||
if ( index != c_brush_maxFaces ) {
|
||||
#if BRUSH_DEGENERATE_DEBUG
|
||||
globalOutputStream() << "Brush::buildWindings: face " << degen[0].adjacent << ": remapping adjacent " << winding[index].adjacent << " to " << degen[1].adjacent << "\n";
|
||||
globalOutputStream() << "Brush::buildWindings: face " << degen[0].adjacent << ": remapping adjacent " << winding[index].adjacent << " to " << degen[1].adjacent << '\n';
|
||||
#endif
|
||||
winding[index].adjacent = degen[1].adjacent;
|
||||
}
|
||||
|
|
@ -2418,7 +2418,7 @@ private:
|
|||
std::size_t index = Winding_FindAdjacent( winding, i );
|
||||
if ( index != c_brush_maxFaces ) {
|
||||
#if BRUSH_DEGENERATE_DEBUG
|
||||
globalOutputStream() << "Brush::buildWindings: face " << degen[1].adjacent << ": remapping adjacent " << winding[index].adjacent << " to " << degen[0].adjacent << "\n";
|
||||
globalOutputStream() << "Brush::buildWindings: face " << degen[1].adjacent << ": remapping adjacent " << winding[index].adjacent << " to " << degen[0].adjacent << '\n';
|
||||
#endif
|
||||
winding[index].adjacent = degen[0].adjacent;
|
||||
}
|
||||
|
|
@ -2442,7 +2442,7 @@ private:
|
|||
std::size_t next = Winding_next( winding, j );
|
||||
if ( winding[j].adjacent == winding[next].adjacent ) {
|
||||
#if BRUSH_DEGENERATE_DEBUG
|
||||
globalOutputStream() << "Brush::buildWindings: face " << i << ": removed duplicate edge adjacent to face " << winding[j].adjacent << "\n";
|
||||
globalOutputStream() << "Brush::buildWindings: face " << i << ": removed duplicate edge adjacent to face " << winding[j].adjacent << '\n';
|
||||
#endif
|
||||
winding.erase( winding.begin() + next );
|
||||
}
|
||||
|
|
@ -2466,13 +2466,13 @@ private:
|
|||
for ( Winding::iterator j = winding.begin(); j != winding.end(); )
|
||||
{
|
||||
#if BRUSH_CONNECTIVITY_DEBUG
|
||||
globalOutputStream() << "Brush::buildWindings: face " << i << ": adjacent to face " << ( *j ).adjacent << "\n";
|
||||
globalOutputStream() << "Brush::buildWindings: face " << i << ": adjacent to face " << ( *j ).adjacent << '\n';
|
||||
#endif
|
||||
// remove unidirectional graph edges
|
||||
if ( ( *j ).adjacent == c_brush_maxFaces
|
||||
|| Winding_FindAdjacent( m_faces[( *j ).adjacent]->getWinding(), i ) == c_brush_maxFaces ) {
|
||||
#if BRUSH_CONNECTIVITY_DEBUG
|
||||
globalOutputStream() << "Brush::buildWindings: face " << i << ": removing unidirectional connectivity graph edge adjacent to face " << ( *j ).adjacent << "\n";
|
||||
globalOutputStream() << "Brush::buildWindings: face " << i << ": removing unidirectional connectivity graph edge adjacent to face " << ( *j ).adjacent << '\n';
|
||||
#endif
|
||||
winding.erase( j );
|
||||
}
|
||||
|
|
@ -2515,7 +2515,7 @@ private:
|
|||
else
|
||||
{
|
||||
#if BRUSH_CONNECTIVITY_DEBUG
|
||||
globalOutputStream() << "face: " << i << "\n";
|
||||
globalOutputStream() << "face: " << i << '\n';
|
||||
#endif
|
||||
windingForClipPlane( f.getWinding(), f.plane3() );
|
||||
|
||||
|
|
|
|||
|
|
@ -187,7 +187,7 @@ inline void Texdef_fromTransform( texdef_t& texdef, float width, float height, c
|
|||
texdef.scale[1] = -texdef.scale[1];
|
||||
}
|
||||
}
|
||||
//globalOutputStream() << "fromTransform: " << texdef.shift[0] << " " << texdef.shift[1] << " " << texdef.scale[0] << " " << texdef.scale[1] << " " << texdef.rotate << "\n";
|
||||
//globalOutputStream() << "fromTransform: " << texdef.shift[0] << ' ' << texdef.shift[1] << ' ' << texdef.scale[0] << ' ' << texdef.scale[1] << ' ' << texdef.rotate << '\n';
|
||||
}
|
||||
|
||||
inline void BPTexdef_fromTransform( brushprimit_texdef_t& bp_texdef, const Matrix4& transform ){
|
||||
|
|
@ -197,7 +197,7 @@ inline void BPTexdef_fromTransform( brushprimit_texdef_t& bp_texdef, const Matri
|
|||
bp_texdef.coords[1][0] = transform.xy();
|
||||
bp_texdef.coords[1][1] = transform.yy();
|
||||
bp_texdef.coords[1][2] = transform.ty();
|
||||
//globalOutputStream() << bp_texdef.coords[0][0] << " " << bp_texdef.coords[0][1] << " " << bp_texdef.coords[0][2] << "\n";
|
||||
//globalOutputStream() << bp_texdef.coords[0][0] << ' ' << bp_texdef.coords[0][1] << ' ' << bp_texdef.coords[0][2] << '\n';
|
||||
}
|
||||
|
||||
inline void Texdef_fromTransform( TextureProjection& projection, float width, float height, const Matrix4& transform ){
|
||||
|
|
@ -217,7 +217,7 @@ inline void Texdef_normalise( texdef_t& texdef, float width, float height ){
|
|||
// it may be useful to also normalise the rotation here, if this function is used elsewhere.
|
||||
texdef.shift[0] = float_mod( texdef.shift[0], width );
|
||||
texdef.shift[1] = float_mod( texdef.shift[1], height );
|
||||
//globalOutputStream() << "normalise: " << texdef.shift[0] << " " << texdef.shift[1] << " " << texdef.scale[0] << " " << texdef.scale[1] << " " << texdef.rotate << "\n";
|
||||
//globalOutputStream() << "normalise: " << texdef.shift[0] << ' ' << texdef.shift[1] << ' ' << texdef.scale[0] << ' ' << texdef.scale[1] << ' ' << texdef.rotate << '\n';
|
||||
}
|
||||
/// this is supposed to work with brushprimit_texdef_t.removeScale()'d
|
||||
inline void BPTexdef_normalise( brushprimit_texdef_t& bp_texdef, float width, float height ){
|
||||
|
|
@ -242,7 +242,7 @@ void Texdef_normalise( TextureProjection& projection, float width, float height
|
|||
inline void DebugAxisBase( const Vector3& normal ){
|
||||
Vector3 x, y;
|
||||
ComputeAxisBase( normal, x, y );
|
||||
globalOutputStream() << "BP debug: " << x << y << normal << "\n";
|
||||
globalOutputStream() << "BP debug: " << x << y << normal << '\n';
|
||||
}
|
||||
|
||||
void Texdef_basisForNormal( const TextureProjection& projection, const Vector3& normal, Matrix4& basis ){
|
||||
|
|
@ -259,7 +259,7 @@ void Texdef_basisForNormal( const TextureProjection& projection, const Vector3&
|
|||
basis.y().vec3() = vector3_negated( projection.m_basis_t );
|
||||
basis.z().vec3() = vector3_normalised( vector3_cross( basis.x().vec3(), basis.y().vec3() ) );
|
||||
// matrix4_multiply_by_matrix4( basis, matrix4_rotation_for_z_degrees( -projection.m_texdef.rotate ) );
|
||||
//globalOutputStream() << "debug: " << projection.m_basis_s << projection.m_basis_t << normal << "\n";
|
||||
//globalOutputStream() << "debug: " << projection.m_basis_s << projection.m_basis_t << normal << '\n';
|
||||
matrix4_transpose( basis );
|
||||
}
|
||||
else
|
||||
|
|
@ -281,11 +281,11 @@ void Texdef_EmitTextureCoordinates( const TextureProjection& projection, std::si
|
|||
if ( w.numpoints < 3 ) {
|
||||
return;
|
||||
}
|
||||
//globalOutputStream() << "normal: " << normal << "\n";
|
||||
//globalOutputStream() << "normal: " << normal << '\n';
|
||||
|
||||
Matrix4 local2tex;
|
||||
Texdef_toTransform( projection, (float)width, (float)height, local2tex );
|
||||
//globalOutputStream() << "texdef: " << static_cast<const Vector3&>(local2tex.x()) << static_cast<const Vector3&>(local2tex.y()) << "\n";
|
||||
//globalOutputStream() << "texdef: " << static_cast<const Vector3&>(local2tex.x()) << static_cast<const Vector3&>(local2tex.y()) << '\n';
|
||||
|
||||
#if 0
|
||||
{
|
||||
|
|
@ -301,7 +301,7 @@ void Texdef_EmitTextureCoordinates( const TextureProjection& projection, std::si
|
|||
Matrix4 xyz2st;
|
||||
// we don't care if it's not normalised...
|
||||
Texdef_basisForNormal( projection, matrix4_transformed_direction( localToWorld, normal ), xyz2st );
|
||||
//globalOutputStream() << "basis: " << static_cast<const Vector3&>(xyz2st.x()) << static_cast<const Vector3&>(xyz2st.y()) << static_cast<const Vector3&>(xyz2st.z()) << "\n";
|
||||
//globalOutputStream() << "basis: " << static_cast<const Vector3&>(xyz2st.x()) << static_cast<const Vector3&>(xyz2st.y()) << static_cast<const Vector3&>(xyz2st.z()) << '\n';
|
||||
matrix4_multiply_by_matrix4( local2tex, xyz2st );
|
||||
}
|
||||
|
||||
|
|
@ -693,7 +693,7 @@ void FakeTexCoordsToTexMat( const texdef_t& texdef, brushprimit_texdef_t& bp_tex
|
|||
bp_texdef.coords[1][1] = static_cast<float>( y * c );
|
||||
bp_texdef.coords[0][2] = -texdef.shift[0];
|
||||
bp_texdef.coords[1][2] = texdef.shift[1];
|
||||
// globalOutputStream() << "[ " << bp_texdef.coords[0][0] << " " << bp_texdef.coords[0][1] << " ][ " << bp_texdef.coords[1][0] << " " << bp_texdef.coords[1][1] << " ]\n";
|
||||
// globalOutputStream() << "[ " << bp_texdef.coords[0][0] << ' ' << bp_texdef.coords[0][1] << " ][ " << bp_texdef.coords[1][0] << ' ' << bp_texdef.coords[1][1] << " ]\n";
|
||||
}
|
||||
|
||||
#if 0 // texture locking (brush primit)
|
||||
|
|
@ -931,11 +931,11 @@ void BPMatMul( float A[2][3], float B[2][3], float C[2][3] ){
|
|||
|
||||
void BPMatDump( float A[2][3] ){
|
||||
globalOutputStream() << "" << A[0][0]
|
||||
<< " " << A[0][1]
|
||||
<< " " << A[0][2]
|
||||
<< "\n" << A[1][0]
|
||||
<< " " << A[1][2]
|
||||
<< " " << A[1][2]
|
||||
<< ' ' << A[0][1]
|
||||
<< ' ' << A[0][2]
|
||||
<< '\n' << A[1][0]
|
||||
<< ' ' << A[1][2]
|
||||
<< ' ' << A[1][2]
|
||||
<< "\n0 0 1\n";
|
||||
}
|
||||
|
||||
|
|
@ -1325,25 +1325,25 @@ void ShiftScaleRotate_fromPatch( texdef_t& shiftScaleRotate, const TextureProjec
|
|||
|
||||
|
||||
inline void printAP( const TextureProjection& projection ){
|
||||
globalOutputStream() << "AP: scale( " << projection.m_texdef.scale[0] << " " << projection.m_texdef.scale[1] << " ) shift( " << projection.m_texdef.shift[0] << " " << projection.m_texdef.shift[1] << " ) rotate: " << projection.m_texdef.rotate << "\n";
|
||||
globalOutputStream() << "AP: scale( " << projection.m_texdef.scale[0] << ' ' << projection.m_texdef.scale[1] << " ) shift( " << projection.m_texdef.shift[0] << ' ' << projection.m_texdef.shift[1] << " ) rotate: " << projection.m_texdef.rotate << '\n';
|
||||
}
|
||||
inline void printBP( const TextureProjection& projection ){
|
||||
globalOutputStream() << "BP: ( " << projection.m_brushprimit_texdef.coords[0][0] << " " << projection.m_brushprimit_texdef.coords[0][1] << " " << projection.m_brushprimit_texdef.coords[0][2] << " ) ( " << projection.m_brushprimit_texdef.coords[1][0] << " " << projection.m_brushprimit_texdef.coords[1][1] << " " << projection.m_brushprimit_texdef.coords[1][2] << " )\n";
|
||||
globalOutputStream() << "BP: ( " << projection.m_brushprimit_texdef.coords[0][0] << ' ' << projection.m_brushprimit_texdef.coords[0][1] << ' ' << projection.m_brushprimit_texdef.coords[0][2] << " ) ( " << projection.m_brushprimit_texdef.coords[1][0] << ' ' << projection.m_brushprimit_texdef.coords[1][1] << ' ' << projection.m_brushprimit_texdef.coords[1][2] << " )\n";
|
||||
}
|
||||
inline void print220( const TextureProjection& projection ){
|
||||
globalOutputStream() << "220: projection.m_basis_s: " << projection.m_basis_s << " projection.m_basis_t: " << projection.m_basis_t << "\n";
|
||||
globalOutputStream() << "220: projection.m_basis_s: " << projection.m_basis_s << " projection.m_basis_t: " << projection.m_basis_t << '\n';
|
||||
printAP( projection );
|
||||
}
|
||||
|
||||
#if 0
|
||||
inline void print_vector3( const Vector3& v ){
|
||||
globalOutputStream() << "( " << v.x() << " " << v.y() << " " << v.z() << " )\n";
|
||||
globalOutputStream() << "( " << v.x() << ' ' << v.y() << ' ' << v.z() << " )\n";
|
||||
}
|
||||
|
||||
inline void print_3x3( const Matrix4& m ){
|
||||
globalOutputStream() << "( " << m.xx() << " " << m.xy() << " " << m.xz() << " ) "
|
||||
<< "( " << m.yx() << " " << m.yy() << " " << m.yz() << " ) "
|
||||
<< "( " << m.zx() << " " << m.zy() << " " << m.zz() << " )\n";
|
||||
globalOutputStream() << "( " << m.xx() << ' ' << m.xy() << ' ' << m.xz() << " ) "
|
||||
<< "( " << m.yx() << ' ' << m.yy() << ' ' << m.yz() << " ) "
|
||||
<< "( " << m.zx() << ' ' << m.zy() << ' ' << m.zz() << " )\n";
|
||||
}
|
||||
|
||||
|
||||
|
|
@ -1442,11 +1442,11 @@ void Texdef_transformLocked_original( TextureProjection& projection, std::size_t
|
|||
// globalOutputStream() << "\t\t----------------------\n";
|
||||
// printAP( projection );
|
||||
// printBP( projection );
|
||||
// globalOutputStream() << "width:" << width << " height" << height << "\n";
|
||||
// globalOutputStream() << "width:" << width << " height" << height << '\n';
|
||||
|
||||
//globalOutputStream() << "identity2transformed: " << identity2transformed << "\n";
|
||||
//globalOutputStream() << "identity2transformed: " << identity2transformed << '\n';
|
||||
|
||||
//globalOutputStream() << "plane.normal(): " << plane.normal() << "\n";
|
||||
//globalOutputStream() << "plane.normal(): " << plane.normal() << '\n';
|
||||
#if 0
|
||||
const Vector3 normalTransformed( matrix4_transformed_direction( identity2transformed, plane.normal() ) );
|
||||
#else //preserves scale in BP while scaling, but not shift //fixes QNAN
|
||||
|
|
@ -1454,7 +1454,7 @@ void Texdef_transformLocked_original( TextureProjection& projection, std::size_t
|
|||
const Vector3 normalTransformed( vector3_normalised( matrix4_transformed_direction( maa, plane.normal() ) ) );
|
||||
#endif
|
||||
|
||||
//globalOutputStream() << "normalTransformed: " << normalTransformed << "\n";
|
||||
//globalOutputStream() << "normalTransformed: " << normalTransformed << '\n';
|
||||
|
||||
// identity: identity space
|
||||
// transformed: transformation
|
||||
|
|
@ -1466,7 +1466,7 @@ void Texdef_transformLocked_original( TextureProjection& projection, std::size_t
|
|||
|
||||
Matrix4 identity2stIdentity;
|
||||
Texdef_basisForNormal( projection, plane.normal(), identity2stIdentity );
|
||||
//globalOutputStream() << "identity2stIdentity: " << identity2stIdentity << "\n";
|
||||
//globalOutputStream() << "identity2stIdentity: " << identity2stIdentity << '\n';
|
||||
|
||||
if ( g_bp_globals.m_texdefTypeId == TEXDEFTYPEID_VALVE ) {
|
||||
matrix4_transform_direction( maa, projection.m_basis_s );
|
||||
|
|
@ -1475,22 +1475,22 @@ void Texdef_transformLocked_original( TextureProjection& projection, std::size_t
|
|||
|
||||
Matrix4 transformed2stTransformed;
|
||||
Texdef_basisForNormal( projection, normalTransformed, transformed2stTransformed );
|
||||
// globalOutputStream() << "transformed2stTransformed: " << transformed2stTransformed << "\n";
|
||||
// globalOutputStream() << "transformed2stTransformed: " << transformed2stTransformed << '\n';
|
||||
Matrix4 stTransformed2identity( matrix4_affine_inverse( matrix4_multiplied_by_matrix4( transformed2stTransformed, identity2transformed ) ) );
|
||||
// globalOutputStream() << "stTransformed2identity: " << stTransformed2identity << "\n";
|
||||
// globalOutputStream() << "stTransformed2identity: " << stTransformed2identity << '\n';
|
||||
Vector3 originalProjectionAxis( matrix4_affine_inverse( identity2stIdentity ).z().vec3() );
|
||||
|
||||
Vector3 transformedProjectionAxis( stTransformed2identity.z().vec3() );
|
||||
|
||||
Matrix4 stIdentity2stOriginal;
|
||||
Texdef_toTransform( projection, (float)width, (float)height, stIdentity2stOriginal );
|
||||
// globalOutputStream() << "stIdentity2stOriginal: " << stIdentity2stOriginal << "\n";
|
||||
// globalOutputStream() << "stIdentity2stOriginal: " << stIdentity2stOriginal << '\n';
|
||||
Matrix4 identity2stOriginal( matrix4_multiplied_by_matrix4( stIdentity2stOriginal, identity2stIdentity ) );
|
||||
// globalOutputStream() << "identity2stOriginal: " << identity2stOriginal << "\n";
|
||||
//globalOutputStream() << "originalProj: " << originalProjectionAxis << "\n";
|
||||
//globalOutputStream() << "transformedProj: " << transformedProjectionAxis << "\n";
|
||||
// globalOutputStream() << "identity2stOriginal: " << identity2stOriginal << '\n';
|
||||
//globalOutputStream() << "originalProj: " << originalProjectionAxis << '\n';
|
||||
//globalOutputStream() << "transformedProj: " << transformedProjectionAxis << '\n';
|
||||
double dot = vector3_dot( originalProjectionAxis, transformedProjectionAxis );
|
||||
//globalOutputStream() << "dot: " << dot << "\n";
|
||||
//globalOutputStream() << "dot: " << dot << '\n';
|
||||
if ( dot == 0 ) {
|
||||
// The projection axis chosen for the transformed normal is at 90 degrees
|
||||
// to the transformed projection axis chosen for the original normal.
|
||||
|
|
@ -1516,7 +1516,7 @@ void Texdef_transformLocked_original( TextureProjection& projection, std::size_t
|
|||
}
|
||||
|
||||
Matrix4 stTransformed2stOriginal = matrix4_multiplied_by_matrix4( identity2stOriginal, stTransformed2identity );
|
||||
// globalOutputStream() << "stTransformed2stOriginal: " << stTransformed2stOriginal << "\n";
|
||||
// globalOutputStream() << "stTransformed2stOriginal: " << stTransformed2stOriginal << '\n';
|
||||
Texdef_fromTransform( projection, (float)width, (float)height, stTransformed2stOriginal );
|
||||
// printAP( projection );
|
||||
// printBP( projection );
|
||||
|
|
@ -1583,7 +1583,7 @@ void BP_from_ST( brushprimit_texdef_t& bp, const DoubleVector3 points[3], const
|
|||
bp.coords[i][1] = D1 / D;
|
||||
bp.coords[i][2] = normalize? fmod( D2 / D, 1.0 ) : ( D2 / D );
|
||||
}
|
||||
// globalOutputStream() << "BP out: ( " << bp.coords[0][0] << " " << bp.coords[0][1] << " " << bp.coords[0][2] << " ) ( " << bp.coords[1][0] << " " << bp.coords[1][1] << " " << bp.coords[1][2] << " )\n";
|
||||
// globalOutputStream() << "BP out: ( " << bp.coords[0][0] << ' ' << bp.coords[0][1] << ' ' << bp.coords[0][2] << " ) ( " << bp.coords[1][0] << ' ' << bp.coords[1][1] << ' ' << bp.coords[1][2] << " )\n";
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -1677,7 +1677,7 @@ void AP_from_axes( const Vector3& axisX, const Vector3& axisY, const DoubleVecto
|
|||
// determine the new texture coordinates of the transformed center of the face, sans offsets
|
||||
const Vector2 newInvariantTexCoords( vector3_dot( xAxis / scale[0], invariant ),
|
||||
vector3_dot( yAxis / scale[1], invariant ) );
|
||||
// globalOutputStream() << "newInvariantTexCoords: " << newInvariantTexCoords[0] << " " << newInvariantTexCoords[1] << "\n";
|
||||
// globalOutputStream() << "newInvariantTexCoords: " << newInvariantTexCoords[0] << ' ' << newInvariantTexCoords[1] << '\n';
|
||||
// since the center should be invariant, the offsets are determined by the difference of the current and
|
||||
// the original texture coordinates of the center
|
||||
texdef.shift[0] = invariantTexCoords[0] - newInvariantTexCoords[0];
|
||||
|
|
@ -1695,7 +1695,7 @@ void Texdef_transformLocked( TextureProjection& projection, std::size_t width, s
|
|||
return; //TODO FIXME !!! this (and whole pipeline?) is called with g_matrix4_identity after every transform //now only on freezeTransform, it seems
|
||||
}
|
||||
if ( g_bp_globals.m_texdefTypeId == TEXDEFTYPEID_BRUSHPRIMITIVES ) {
|
||||
// globalOutputStream() << "identity2transformed: " << identity2transformed << "\n";
|
||||
// globalOutputStream() << "identity2transformed: " << identity2transformed << '\n';
|
||||
// globalOutputStream() << "in "; printBP( projection );
|
||||
DoubleVector3 texX, texY;
|
||||
ComputeAxisBase( plane.normal(), texX, texY );
|
||||
|
|
@ -1722,8 +1722,8 @@ void Texdef_transformLocked( TextureProjection& projection, std::size_t width, s
|
|||
BP_from_ST( projection.m_brushprimit_texdef, points, st, normalTransformed );
|
||||
}
|
||||
else if( g_bp_globals.m_texdefTypeId == TEXDEFTYPEID_QUAKE ) {
|
||||
// globalOutputStream() << "\t\t***: " << invariant << "\n";
|
||||
// globalOutputStream() << "identity2transformed: " << identity2transformed << "\n";
|
||||
// globalOutputStream() << "\t\t***: " << invariant << '\n';
|
||||
// globalOutputStream() << "identity2transformed: " << identity2transformed << '\n';
|
||||
// printAP( projection );
|
||||
if( projection.m_texdef.scale[0] == 0.0f || projection.m_texdef.scale[1] == 0.0f ) {
|
||||
return;
|
||||
|
|
@ -1757,14 +1757,14 @@ void Texdef_transformLocked( TextureProjection& projection, std::size_t width, s
|
|||
Vector3 xAxis = BaseAxes[index * 3 + 1];
|
||||
Vector3 yAxis = BaseAxes[index * 3 + 2];
|
||||
Vector3 zAxis = BaseAxes[( index / 2 ) * 6];
|
||||
// globalOutputStream() << xAxis << " " << yAxis << " " << zAxis << "\n";
|
||||
// globalOutputStream() << xAxis << ' ' << yAxis << ' ' << zAxis << '\n';
|
||||
Matrix4 rotmat = matrix4_rotation_for_axisangle( vector3_cross( yAxis, xAxis ), degrees_to_radians( projection.m_texdef.rotate ) );
|
||||
matrix4_transform_direction( rotmat, xAxis );
|
||||
matrix4_transform_direction( rotmat, yAxis );
|
||||
|
||||
const Vector2 invariantTexCoords( vector3_dot( xAxis / projection.m_texdef.scale[0], invariant ) + projection.m_texdef.shift[0],
|
||||
vector3_dot( yAxis / projection.m_texdef.scale[1], invariant ) + projection.m_texdef.shift[1] );
|
||||
// globalOutputStream() << "invariantTexCoords: " << invariantTexCoords[0] << " " << invariantTexCoords[1] << "\n";
|
||||
// globalOutputStream() << "invariantTexCoords: " << invariantTexCoords[0] << ' ' << invariantTexCoords[1] << '\n';
|
||||
// project the texture axes onto the boundary plane along the texture Z axis
|
||||
const Vector3 boundaryOffset = plane3_project_point( plane, Vector3( 0, 0, 0 ), zAxis );
|
||||
const Vector3 xAxisOnBoundary = plane3_project_point( plane, xAxis * projection.m_texdef.scale[0], zAxis ) - boundaryOffset;
|
||||
|
|
@ -1779,7 +1779,7 @@ void Texdef_transformLocked( TextureProjection& projection, std::size_t width, s
|
|||
}
|
||||
else{ //TEXDEFTYPEID_VALVE
|
||||
// print220( projection );
|
||||
// globalOutputStream() << "identity2transformed: " << identity2transformed << "\n";
|
||||
// globalOutputStream() << "identity2transformed: " << identity2transformed << '\n';
|
||||
/* hack: is often broken with niggative scale */
|
||||
if( projection.m_texdef.scale[0] < 0 ){
|
||||
projection.m_texdef.scale[0] *= -1.f;
|
||||
|
|
@ -1790,10 +1790,10 @@ void Texdef_transformLocked( TextureProjection& projection, std::size_t width, s
|
|||
projection.m_basis_t *= -1.f;
|
||||
}
|
||||
|
||||
//globalOutputStream() << "plane.normal(): " << plane.normal() << "\n";
|
||||
//globalOutputStream() << "plane.normal(): " << plane.normal() << '\n';
|
||||
const Matrix4 maa( matrix4_for_normal_transform( identity2transformed ) );
|
||||
const Vector3 normalTransformed( vector3_normalised( matrix4_transformed_direction( maa, plane.normal() ) ) );
|
||||
//globalOutputStream() << "normalTransformed: " << normalTransformed << "\n";
|
||||
//globalOutputStream() << "normalTransformed: " << normalTransformed << '\n';
|
||||
|
||||
// identity: identity space
|
||||
// transformed: transformation
|
||||
|
|
@ -1840,8 +1840,8 @@ void Texdef_transform( TextureProjection& projection, std::size_t width, std::si
|
|||
Texdef_transformLocked( projection, width, height, plane, identity2transformed, invariant );
|
||||
}
|
||||
else if( g_bp_globals.m_texdefTypeId == TEXDEFTYPEID_QUAKE ) {
|
||||
// globalOutputStream() << "\t\t***: " << invariant << "\n";
|
||||
// globalOutputStream() << "identity2transformed: " << identity2transformed << "\n";
|
||||
// globalOutputStream() << "\t\t***: " << invariant << '\n';
|
||||
// globalOutputStream() << "identity2transformed: " << identity2transformed << '\n';
|
||||
// printAP( projection );
|
||||
if( projection.m_texdef.scale[0] == 0.0f || projection.m_texdef.scale[1] == 0.0f ) {
|
||||
return;
|
||||
|
|
@ -1852,14 +1852,14 @@ void Texdef_transform( TextureProjection& projection, std::size_t width, std::si
|
|||
Vector3 xAxis = BaseAxes[index * 3 + 1];
|
||||
Vector3 yAxis = BaseAxes[index * 3 + 2];
|
||||
Vector3 zAxis = BaseAxes[( index / 2 ) * 6];
|
||||
// globalOutputStream() << xAxis << " " << yAxis << " " << zAxis << "\n";
|
||||
// globalOutputStream() << xAxis << ' ' << yAxis << ' ' << zAxis << '\n';
|
||||
Matrix4 rotmat = matrix4_rotation_for_axisangle( vector3_cross( yAxis, xAxis ), degrees_to_radians( projection.m_texdef.rotate ) );
|
||||
matrix4_transform_direction( rotmat, xAxis );
|
||||
matrix4_transform_direction( rotmat, yAxis );
|
||||
|
||||
const Vector2 invariantTexCoords( vector3_dot( xAxis / projection.m_texdef.scale[0], invariant ) + projection.m_texdef.shift[0],
|
||||
vector3_dot( yAxis / projection.m_texdef.scale[1], invariant ) + projection.m_texdef.shift[1] );
|
||||
// globalOutputStream() << "invariantTexCoords: " << invariantTexCoords[0] << " " << invariantTexCoords[1] << "\n";
|
||||
// globalOutputStream() << "invariantTexCoords: " << invariantTexCoords[0] << ' ' << invariantTexCoords[1] << '\n';
|
||||
// project the texture axes onto the boundary plane along the texture Z axis
|
||||
const Vector3 boundaryOffset = plane3_project_point( plane, Vector3( 0, 0, 0 ), zAxis );
|
||||
const Vector3 xAxisOnBoundary = plane3_project_point( plane, xAxis * projection.m_texdef.scale[0], zAxis ) - boundaryOffset;
|
||||
|
|
@ -1942,7 +1942,7 @@ inline void BPTexdef_fromST011( TextureProjection& projection, const Plane3& pla
|
|||
|
||||
for ( std::size_t i = 0; i < 3; ++i ){
|
||||
st[i] = matrix4_transformed_point( local2tex, points[i] );
|
||||
//globalOutputStream() << st[i] << "\n";
|
||||
//globalOutputStream() << st[i] << '\n';
|
||||
}
|
||||
// compute texture matrix
|
||||
projection.m_brushprimit_texdef.coords[0][2] = float_mod( st[0][0], 1.0 );
|
||||
|
|
@ -2016,8 +2016,8 @@ void AP_from_BP( TextureProjection& projection, const Plane3& plane, std::size_t
|
|||
Texdef_Construct_local2tex( projection, width, height, plane.normal(), local2tex );
|
||||
const Vector3 st = matrix4_transformed_point( local2tex, invariant );
|
||||
const Vector2 invariantTexCoords( st[0] * width, st[1] * height );
|
||||
// globalOutputStream() << "local2tex: " << local2tex << "\n";
|
||||
// globalOutputStream() << "invariantTexCoords: " << invariantTexCoords[0] << " " << invariantTexCoords[1] << "\n";
|
||||
// globalOutputStream() << "local2tex: " << local2tex << '\n';
|
||||
// globalOutputStream() << "invariantTexCoords: " << invariantTexCoords[0] << ' ' << invariantTexCoords[1] << '\n';
|
||||
|
||||
const Matrix4 tex2local = matrix4_affine_inverse( local2tex );
|
||||
AP_from_axes( tex2local.x().vec3() / width, tex2local.y().vec3() / height, plane.normal(), width, height, invariant, invariantTexCoords, projection.m_texdef );
|
||||
|
|
|
|||
|
|
@ -98,11 +98,11 @@ const char* const c_brushPrism_name = "brushPrism";
|
|||
|
||||
void Brush_ConstructPrism( Brush& brush, const AABB& bounds, std::size_t sides, size_t axis, const char* shader, const TextureProjection& projection ){
|
||||
if ( sides < c_brushPrism_minSides ) {
|
||||
globalErrorStream() << c_brushPrism_name << ": sides " << sides << ": too few sides, minimum is " << c_brushPrism_minSides << "\n";
|
||||
globalErrorStream() << c_brushPrism_name << ": sides " << sides << ": too few sides, minimum is " << c_brushPrism_minSides << '\n';
|
||||
return;
|
||||
}
|
||||
if ( sides > c_brushPrism_maxSides ) {
|
||||
globalErrorStream() << c_brushPrism_name << ": sides " << sides << ": too many sides, maximum is " << c_brushPrism_maxSides << "\n";
|
||||
globalErrorStream() << c_brushPrism_name << ": sides " << sides << ": too many sides, maximum is " << c_brushPrism_maxSides << '\n';
|
||||
return;
|
||||
}
|
||||
|
||||
|
|
@ -168,11 +168,11 @@ const char* const c_brushCone_name = "brushCone";
|
|||
|
||||
void Brush_ConstructCone( Brush& brush, const AABB& bounds, std::size_t sides, size_t axis, const char* shader, const TextureProjection& projection ){
|
||||
if ( sides < c_brushCone_minSides ) {
|
||||
globalErrorStream() << c_brushCone_name << ": sides " << sides << ": too few sides, minimum is " << c_brushCone_minSides << "\n";
|
||||
globalErrorStream() << c_brushCone_name << ": sides " << sides << ": too few sides, minimum is " << c_brushCone_minSides << '\n';
|
||||
return;
|
||||
}
|
||||
if ( sides > c_brushCone_maxSides ) {
|
||||
globalErrorStream() << c_brushCone_name << ": sides " << sides << ": too many sides, maximum is " << c_brushCone_maxSides << "\n";
|
||||
globalErrorStream() << c_brushCone_name << ": sides " << sides << ": too many sides, maximum is " << c_brushCone_maxSides << '\n';
|
||||
return;
|
||||
}
|
||||
|
||||
|
|
@ -220,11 +220,11 @@ const char* const c_brushSphere_name = "brushSphere";
|
|||
|
||||
void Brush_ConstructSphere( Brush& brush, const AABB& bounds, std::size_t sides, const char* shader, const TextureProjection& projection ){
|
||||
if ( sides < c_brushSphere_minSides ) {
|
||||
globalErrorStream() << c_brushSphere_name << ": sides " << sides << ": too few sides, minimum is " << c_brushSphere_minSides << "\n";
|
||||
globalErrorStream() << c_brushSphere_name << ": sides " << sides << ": too few sides, minimum is " << c_brushSphere_minSides << '\n';
|
||||
return;
|
||||
}
|
||||
if ( sides > c_brushSphere_maxSides ) {
|
||||
globalErrorStream() << c_brushSphere_name << ": sides " << sides << ": too many sides, maximum is " << c_brushSphere_maxSides << "\n";
|
||||
globalErrorStream() << c_brushSphere_name << ": sides " << sides << ": too many sides, maximum is " << c_brushSphere_maxSides << '\n';
|
||||
return;
|
||||
}
|
||||
|
||||
|
|
@ -273,11 +273,11 @@ const char* const c_brushRock_name = "brushRock";
|
|||
|
||||
void Brush_ConstructRock( Brush& brush, const AABB& bounds, std::size_t sides, const char* shader, const TextureProjection& projection ){
|
||||
if ( sides < c_brushRock_minSides ) {
|
||||
globalErrorStream() << c_brushRock_name << ": sides " << sides << ": too few sides, minimum is " << c_brushRock_minSides << "\n";
|
||||
globalErrorStream() << c_brushRock_name << ": sides " << sides << ": too few sides, minimum is " << c_brushRock_minSides << '\n';
|
||||
return;
|
||||
}
|
||||
if ( sides > c_brushRock_maxSides ) {
|
||||
globalErrorStream() << c_brushRock_name << ": sides " << sides << ": too many sides, maximum is " << c_brushRock_maxSides << "\n";
|
||||
globalErrorStream() << c_brushRock_name << ": sides " << sides << ": too many sides, maximum is " << c_brushRock_maxSides << '\n';
|
||||
return;
|
||||
}
|
||||
|
||||
|
|
@ -420,9 +420,8 @@ void Brush_ConstructPrefab( Brush& brush, EBrushPrefab type, const AABB& bounds,
|
|||
case EBrushPrefab::Prism:
|
||||
{
|
||||
const size_t axis = GlobalXYWnd_getCurrentViewType();
|
||||
StringOutputStream command;
|
||||
command << c_brushPrism_name << " -sides " << sides << " -axis " << axis;
|
||||
UndoableCommand undo( command.c_str() );
|
||||
const auto command = StringStream<64>( c_brushPrism_name, " -sides ", sides, " -axis ", axis );
|
||||
UndoableCommand undo( command );
|
||||
|
||||
Brush_ConstructPrism( brush, bounds, sides, axis, shader, projection );
|
||||
}
|
||||
|
|
@ -430,36 +429,32 @@ void Brush_ConstructPrefab( Brush& brush, EBrushPrefab type, const AABB& bounds,
|
|||
case EBrushPrefab::Cone:
|
||||
{
|
||||
const size_t axis = GlobalXYWnd_getCurrentViewType();
|
||||
StringOutputStream command;
|
||||
command << c_brushCone_name << " -sides " << sides << " -axis " << axis;
|
||||
UndoableCommand undo( command.c_str() );
|
||||
const auto command = StringStream<64>( c_brushCone_name, " -sides ", sides, " -axis ", axis );
|
||||
UndoableCommand undo( command );
|
||||
|
||||
Brush_ConstructCone( brush, bounds, sides, axis, shader, projection );
|
||||
}
|
||||
break;
|
||||
case EBrushPrefab::Sphere:
|
||||
{
|
||||
StringOutputStream command;
|
||||
command << c_brushSphere_name << " -sides " << sides;
|
||||
UndoableCommand undo( command.c_str() );
|
||||
const auto command = StringStream<64>( c_brushSphere_name, " -sides ", sides );
|
||||
UndoableCommand undo( command );
|
||||
|
||||
Brush_ConstructSphere( brush, bounds, sides, shader, projection );
|
||||
}
|
||||
break;
|
||||
case EBrushPrefab::Rock:
|
||||
{
|
||||
StringOutputStream command;
|
||||
command << c_brushRock_name << " -sides " << sides;
|
||||
UndoableCommand undo( command.c_str() );
|
||||
const auto command = StringStream<64>( c_brushRock_name, " -sides ", sides );
|
||||
UndoableCommand undo( command );
|
||||
|
||||
Brush_ConstructRock( brush, bounds, sides, shader, projection );
|
||||
}
|
||||
break;
|
||||
case EBrushPrefab::Icosahedron:
|
||||
{
|
||||
StringOutputStream command;
|
||||
command << "brushIcosahedron" << " -subdivisions " << sides;
|
||||
UndoableCommand undo( command.c_str() );
|
||||
const auto command = StringStream<64>( "brushIcosahedron", " -subdivisions ", sides );
|
||||
UndoableCommand undo( command );
|
||||
|
||||
icosahedron::Brush_ConstructIcosahedron( brush, bounds, sides, option, shader, projection );
|
||||
}
|
||||
|
|
|
|||
|
|
@ -148,9 +148,7 @@ inline bool FaceShader_importTokens( FaceShader& faceShader, Tokeniser& tokenise
|
|||
}
|
||||
else
|
||||
{
|
||||
StringOutputStream shader( string_length( GlobalTexturePrefix_get() ) + string_length( texture ) );
|
||||
shader << GlobalTexturePrefix_get() << texture;
|
||||
faceShader.setShader( shader.c_str() );
|
||||
faceShader.setShader( StringStream<64>( GlobalTexturePrefix_get(), texture ) );
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -87,7 +87,7 @@ class FaceXMLImporter
|
|||
return m_state;
|
||||
}
|
||||
const char* content() const {
|
||||
return m_content.c_str();
|
||||
return m_content;
|
||||
}
|
||||
std::size_t write( const char* buffer, std::size_t length ){
|
||||
return m_content.write( buffer, length );
|
||||
|
|
|
|||
|
|
@ -45,7 +45,7 @@ const char* build_get_variable( const char* name ){
|
|||
if ( i != g_build_variables.end() ) {
|
||||
return ( *i ).second.c_str();
|
||||
}
|
||||
globalErrorStream() << "undefined build variable: " << makeQuoted( name ) << "\n";
|
||||
globalErrorStream() << "undefined build variable: " << makeQuoted( name ) << '\n';
|
||||
return "";
|
||||
}
|
||||
|
||||
|
|
@ -191,7 +191,7 @@ public:
|
|||
return length;
|
||||
}
|
||||
XMLElementParser& pushElement( const XMLElement& element ){
|
||||
ERROR_MESSAGE( "parse error: invalid element \"" << element.name() << "\"" );
|
||||
ERROR_MESSAGE( "parse error: invalid element " << makeQuoted( element.name() ) );
|
||||
return *this;
|
||||
}
|
||||
void popElement( const char* name ){
|
||||
|
|
@ -213,7 +213,7 @@ public:
|
|||
return length;
|
||||
}
|
||||
XMLElementParser& pushElement( const XMLElement& element ){
|
||||
ERROR_MESSAGE( "parse error: invalid element \"" << element.name() << "\"" );
|
||||
ERROR_MESSAGE( "parse error: invalid element " << makeQuoted( element.name() ) );
|
||||
return *this;
|
||||
}
|
||||
void popElement( const char* name ){
|
||||
|
|
@ -245,7 +245,7 @@ public:
|
|||
}
|
||||
else
|
||||
{
|
||||
ERROR_MESSAGE( "parse error: invalid element \"" << element.name() << "\"" );
|
||||
ERROR_MESSAGE( "parse error: invalid element " << makeQuoted( element.name() ) );
|
||||
return *this;
|
||||
}
|
||||
}
|
||||
|
|
@ -428,7 +428,7 @@ public:
|
|||
}
|
||||
else
|
||||
{
|
||||
//ERROR_MESSAGE("parse error: invalid element \"" << element.name() << "\"");
|
||||
//ERROR_MESSAGE( "parse error: invalid element " << makeQuoted( element.name() ) );
|
||||
return *this;
|
||||
}
|
||||
}
|
||||
|
|
@ -538,7 +538,7 @@ bool build_commands_parse( const char* filename ){
|
|||
|
||||
return true;
|
||||
}
|
||||
globalErrorStream() << "failed to parse build menu: " << makeQuoted( filename ) << "\n";
|
||||
globalErrorStream() << "failed to parse build menu: " << makeQuoted( filename ) << '\n';
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
|
@ -555,14 +555,14 @@ public:
|
|||
BuildXMLExporter( const Build& build ) : m_build( build ){
|
||||
}
|
||||
void exportXML( XMLImporter& importer ) const {
|
||||
importer << "\n";
|
||||
importer << '\n';
|
||||
for ( const auto& command : m_build )
|
||||
{
|
||||
StaticElement commandElement( "command" );
|
||||
importer.pushElement( commandElement );
|
||||
command.exportXML( importer );
|
||||
importer.popElement( commandElement.name() );
|
||||
importer << "\n";
|
||||
importer << '\n';
|
||||
}
|
||||
}
|
||||
};
|
||||
|
|
@ -578,7 +578,7 @@ public:
|
|||
StaticElement projectElement( "project" );
|
||||
projectElement.insertAttribute( "version", BUILDMENU_VERSION );
|
||||
importer.pushElement( projectElement );
|
||||
importer << "\n";
|
||||
importer << '\n';
|
||||
|
||||
for ( const auto& [ name, tool ] : m_tools )
|
||||
{
|
||||
|
|
@ -587,7 +587,7 @@ public:
|
|||
importer.pushElement( toolElement );
|
||||
tool.exportXML( importer );
|
||||
importer.popElement( toolElement.name() );
|
||||
importer << "\n";
|
||||
importer << '\n';
|
||||
}
|
||||
for ( const auto& [ name, build ] : m_project )
|
||||
{
|
||||
|
|
@ -595,7 +595,7 @@ public:
|
|||
StaticElement buildElement( "separator" );
|
||||
importer.pushElement( buildElement );
|
||||
importer.popElement( buildElement.name() );
|
||||
importer << "\n";
|
||||
importer << '\n';
|
||||
}
|
||||
else
|
||||
{
|
||||
|
|
@ -605,7 +605,7 @@ public:
|
|||
BuildXMLExporter buildExporter( build );
|
||||
buildExporter.exportXML( importer );
|
||||
importer.popElement( buildElement.name() );
|
||||
importer << "\n";
|
||||
importer << '\n';
|
||||
}
|
||||
}
|
||||
importer.popElement( projectElement.name() );
|
||||
|
|
@ -619,9 +619,9 @@ void build_commands_write( const char* filename ){
|
|||
if ( !projectFile.failed() ) {
|
||||
XMLStreamWriter writer( projectFile );
|
||||
ProjectXMLExporter projectExporter( g_build_project, g_build_tools );
|
||||
writer << "\n";
|
||||
writer << '\n';
|
||||
projectExporter.exportXML( writer );
|
||||
writer << "\n";
|
||||
writer << '\n';
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -920,9 +920,9 @@ EMessageBoxReturn BuildMenuDialog_construct( ProjectList& projectList ){
|
|||
tool.evaluate( output );
|
||||
build_set_variable( name.c_str(), output.c_str() );
|
||||
}
|
||||
StringOutputStream stream;
|
||||
StringOutputStream stream( 256 );
|
||||
for( const auto& [ name, var ] : g_build_variables ){
|
||||
stream << "[" << name << "] = " << var << "\n";
|
||||
stream << '[' << name << "] = " << var << '\n';
|
||||
}
|
||||
build_clear_variables();
|
||||
|
||||
|
|
@ -1041,9 +1041,7 @@ const char* g_buildMenuFullPah(){
|
|||
return g_buildMenu.c_str();
|
||||
|
||||
static StringOutputStream buffer( 256 );
|
||||
buffer.clear();
|
||||
buffer << SettingsPath_get() << g_pGameDescription->mGameFile << "/" << g_buildMenu;
|
||||
return buffer.c_str();
|
||||
return buffer( SettingsPath_get(), g_pGameDescription->mGameFile, '/', g_buildMenu );
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -1055,11 +1053,10 @@ void LoadBuildMenu(){
|
|||
return;
|
||||
}
|
||||
{
|
||||
StringOutputStream buffer( 256 );
|
||||
buffer << GameToolsPath_get() << "default_build_menu.xml";
|
||||
const auto buffer = StringStream( GameToolsPath_get(), "default_build_menu.xml" );
|
||||
|
||||
bool success = build_commands_parse( buffer.c_str() );
|
||||
ASSERT_MESSAGE( success, "failed to parse default build commands: " << buffer.c_str() );
|
||||
const bool success = build_commands_parse( buffer );
|
||||
ASSERT_MESSAGE( success, "failed to parse default build commands: " << buffer );
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -809,9 +809,7 @@ private:
|
|||
if( extent != _extents[i] ){
|
||||
_extents[i] = extent;
|
||||
m_labels[i].texFree();
|
||||
StringOutputStream stream( 16 );
|
||||
stream << ( extent * 2 );
|
||||
m_labels[i].texAlloc( stream.c_str(), getColor( i ) );
|
||||
m_labels[i].texAlloc( StringStream<16>( extent * 2 ), getColor( i ) );
|
||||
}
|
||||
}
|
||||
};
|
||||
|
|
@ -1113,7 +1111,7 @@ void context_menu_show(){
|
|||
/* GDK_2BUTTON_PRESS doesn't always work in this case, so... */
|
||||
/* with Qt freezepointer interrupts internal doubleclick timer, so use custom one */
|
||||
inline bool context_menu_try( const CamWnd& camwnd ){
|
||||
//globalOutputStream() << camwnd->m_rightClickTimer.elapsed_msec() << "\n";
|
||||
//globalOutputStream() << camwnd->m_rightClickTimer.elapsed_msec() << '\n';
|
||||
return camwnd.m_rightClickTimer.elapsed_msec() < 250;
|
||||
//doesn't work if cam redraw > 200msec (3x click works): gtk_widget_queue_draw proceeds after timer.start()
|
||||
}
|
||||
|
|
@ -1281,7 +1279,7 @@ static void camera_zoom( CamWnd& camwnd, float x, float y, float step ){
|
|||
normalized *= ( camera_t::near_z * 2.f );
|
||||
//globalOutputStream() << normalized << " normalized ";
|
||||
matrix4_transform_point( screen2world, normalized );
|
||||
//globalOutputStream() << normalized << "\n";
|
||||
//globalOutputStream() << normalized << '\n';
|
||||
const Vector3 norm = vector3_normalised( normalized - Camera_getOrigin( camwnd ) );
|
||||
//globalOutputStream() << normalized - Camera_getOrigin( *camwnd ) << " normalized - Camera_getOrigin( *camwnd )\n";
|
||||
//globalOutputStream() << norm << " norm\n";
|
||||
|
|
@ -2105,9 +2103,7 @@ void CamWnd::Cam_Draw(){
|
|||
if ( g_camwindow_globals.m_showStats ) {
|
||||
gl().glRasterPos3f( 1.0f, static_cast<float>( m_Camera.height ), 0.0f );
|
||||
extern const char* Renderer_GetStats();
|
||||
StringOutputStream stream;
|
||||
stream << Renderer_GetStats() << " | f2f: " << m_render_time.elapsed_msec();
|
||||
GlobalOpenGL().drawString( stream.c_str() );
|
||||
GlobalOpenGL().drawString( StringStream( Renderer_GetStats(), " | f2f: ", m_render_time.elapsed_msec() ) );
|
||||
m_render_time.start();
|
||||
|
||||
gl().glRasterPos3f( 1.0f, static_cast<float>( m_Camera.height ) - GlobalOpenGL().m_font->getPixelHeight(), 0.0f );
|
||||
|
|
@ -2478,13 +2474,13 @@ typedef FreeCaller1<bool, CamWnd_Move_Discrete_Import> CamWndMoveDiscreteImportC
|
|||
void CameraSpeed_increase(){
|
||||
g_camwindow_globals_private.m_nMoveSpeed = std::min( g_camwindow_globals_private.m_nMoveSpeed + CAM_SPEED_STEP, CAM_MAX_SPEED );
|
||||
globalOutputStream() << " ++Camera Move Speed: ";
|
||||
globalWarningStream() << g_camwindow_globals_private.m_nMoveSpeed << "\n";
|
||||
globalWarningStream() << g_camwindow_globals_private.m_nMoveSpeed << '\n';
|
||||
}
|
||||
|
||||
void CameraSpeed_decrease(){
|
||||
g_camwindow_globals_private.m_nMoveSpeed = std::max( g_camwindow_globals_private.m_nMoveSpeed - CAM_SPEED_STEP, CAM_MIN_SPEED );
|
||||
globalOutputStream() << " --Camera Move Speed: ";
|
||||
globalWarningStream() << g_camwindow_globals_private.m_nMoveSpeed << "\n";
|
||||
globalWarningStream() << g_camwindow_globals_private.m_nMoveSpeed << '\n';
|
||||
}
|
||||
|
||||
/// \brief Initialisation for things that have the same lifespan as this module.
|
||||
|
|
|
|||
|
|
@ -61,7 +61,7 @@ void GlobalShortcuts_register( const char* name, int type ){
|
|||
void GlobalShortcuts_reportUnregistered(){
|
||||
for ( const auto& [name, shortcut] : g_shortcuts )
|
||||
if ( !shortcut.accelerator.isEmpty() && shortcut.type == 0 )
|
||||
globalWarningStream() << "shortcut not registered: " << name << "\n";
|
||||
globalWarningStream() << "shortcut not registered: " << name << '\n';
|
||||
}
|
||||
|
||||
typedef std::map<CopiedString, Command> Commands;
|
||||
|
|
@ -204,10 +204,9 @@ public:
|
|||
return;
|
||||
}
|
||||
if ( accelerator == newAccel ) {
|
||||
StringOutputStream msg;
|
||||
msg << "The command <b>" << name << "</b> is already assigned to the key <b>" << accelerator << "</b>.<br><br>"
|
||||
<< "Do you want to unassign <b>" << name << "</b> first?";
|
||||
const EMessageBoxReturn r = qt_MessageBox( tree->window(), msg.c_str(), "Key already used", EMessageBoxType::Question, eIDYES | eIDNO | eIDCANCEL );
|
||||
const auto msg = StringStream( "The command <b>", name, "</b> is already assigned to the key <b>", accelerator, "</b>.<br><br>",
|
||||
"Do you want to unassign <b>", name, "</b> first?" );
|
||||
const EMessageBoxReturn r = qt_MessageBox( tree->window(), msg, "Key already used", EMessageBoxType::Question, eIDYES | eIDNO | eIDCANCEL );
|
||||
if ( r == eIDYES ) {
|
||||
// clear the ACTUAL accelerator too!
|
||||
disconnect_accelerator( name );
|
||||
|
|
@ -355,10 +354,10 @@ void DoCommandListDlg(){
|
|||
|
||||
{
|
||||
// Initialize dialog
|
||||
const auto path = StringOutputStream( 256 )( SettingsPath_get(), "commandlist.txt" );
|
||||
globalOutputStream() << "Writing the command list to " << path.c_str() << "\n";
|
||||
const auto path = StringStream( SettingsPath_get(), "commandlist.txt" );
|
||||
globalOutputStream() << "Writing the command list to " << path << '\n';
|
||||
|
||||
TextFileOutputStream commandList( path.c_str() );
|
||||
TextFileOutputStream commandList( path );
|
||||
|
||||
for( const auto&[ name, value ] : g_shortcuts )
|
||||
{
|
||||
|
|
@ -434,20 +433,19 @@ void DoCommandListDlg(){
|
|||
const char* const COMMANDS_VERSION = "1.0-gtk-accelnames";
|
||||
|
||||
void SaveCommandMap( const char* path ){
|
||||
StringOutputStream strINI( 256 );
|
||||
strINI << path << "shortcuts.ini";
|
||||
const auto strINI = StringStream( path, "shortcuts.ini" );
|
||||
|
||||
TextFileOutputStream file( strINI.c_str() );
|
||||
TextFileOutputStream file( strINI );
|
||||
if ( !file.failed() ) {
|
||||
file << "[Version]\n";
|
||||
file << "number=" << COMMANDS_VERSION << "\n";
|
||||
file << "\n";
|
||||
file << "number=" << COMMANDS_VERSION << '\n';
|
||||
file << '\n';
|
||||
file << "[Commands]\n";
|
||||
|
||||
auto writeCommandMap = [&file]( const char* name, const QKeySequence& accelerator ){
|
||||
file << name << "=";
|
||||
file << name << '=';
|
||||
file << accelerator;
|
||||
file << "\n";
|
||||
file << '\n';
|
||||
};
|
||||
GlobalShortcuts_foreach( writeCommandMap );
|
||||
}
|
||||
|
|
@ -473,7 +471,7 @@ public:
|
|||
}
|
||||
else
|
||||
{
|
||||
globalWarningStream() << "WARNING: failed to parse user command " << makeQuoted( name ) << ": unknown key " << makeQuoted( value ) << "\n";
|
||||
globalWarningStream() << "WARNING: failed to parse user command " << makeQuoted( name ) << ": unknown key " << makeQuoted( value ) << '\n';
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -484,37 +482,36 @@ public:
|
|||
};
|
||||
|
||||
void LoadCommandMap( const char* path ){
|
||||
StringOutputStream strINI( 256 );
|
||||
strINI << path << "shortcuts.ini";
|
||||
const auto strINI = StringStream( path, "shortcuts.ini" );
|
||||
|
||||
FILE* f = fopen( strINI.c_str(), "r" );
|
||||
FILE* f = fopen( strINI, "r" );
|
||||
if ( f != 0 ) {
|
||||
fclose( f );
|
||||
globalOutputStream() << "loading custom shortcuts list from " << makeQuoted( strINI.c_str() ) << "\n";
|
||||
globalOutputStream() << "loading custom shortcuts list from " << makeQuoted( strINI ) << '\n';
|
||||
|
||||
Version version = version_parse( COMMANDS_VERSION );
|
||||
Version dataVersion = { 0, 0 };
|
||||
|
||||
{
|
||||
char value[1024];
|
||||
if ( read_var( strINI.c_str(), "Version", "number", value ) ) {
|
||||
if ( read_var( strINI, "Version", "number", value ) ) {
|
||||
dataVersion = version_parse( value );
|
||||
}
|
||||
}
|
||||
|
||||
if ( version_compatible( version, dataVersion ) ) {
|
||||
globalOutputStream() << "commands import: data version " << dataVersion << " is compatible with code version " << version << "\n";
|
||||
ReadCommandMap visitor( strINI.c_str() );
|
||||
globalOutputStream() << "commands import: data version " << dataVersion << " is compatible with code version " << version << '\n';
|
||||
ReadCommandMap visitor( strINI );
|
||||
GlobalShortcuts_foreach( visitor );
|
||||
globalOutputStream() << "parsed " << visitor.count() << " custom shortcuts\n";
|
||||
}
|
||||
else
|
||||
{
|
||||
globalWarningStream() << "commands import: data version " << dataVersion << " is not compatible with code version " << version << "\n";
|
||||
globalWarningStream() << "commands import: data version " << dataVersion << " is not compatible with code version " << version << '\n';
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
globalWarningStream() << "failed to load custom shortcuts from " << makeQuoted( strINI.c_str() ) << "\n";
|
||||
globalWarningStream() << "failed to load custom shortcuts from " << makeQuoted( strINI ) << '\n';
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -56,11 +56,10 @@ void Sys_LogFile( bool enable ){
|
|||
// open a file to log the console (if user prefs say so)
|
||||
// the file handle is g_hLogFile
|
||||
// the log file is erased
|
||||
StringOutputStream name( 256 );
|
||||
name << SettingsPath_get() << "radiant.log";
|
||||
g_hLogFile = fopen( name.c_str(), "w" );
|
||||
const auto name = StringStream( SettingsPath_get(), "radiant.log" );
|
||||
g_hLogFile = fopen( name, "w" );
|
||||
if ( g_hLogFile != 0 ) {
|
||||
globalOutputStream() << "Started logging to " << name.c_str() << "\n";
|
||||
globalOutputStream() << "Started logging to " << name << '\n';
|
||||
time_t localtime;
|
||||
time( &localtime );
|
||||
globalOutputStream() << "Today is: " << ctime( &localtime )
|
||||
|
|
@ -75,7 +74,7 @@ void Sys_LogFile( bool enable ){
|
|||
// settings say we should not be logging but still we have an active logfile .. close it
|
||||
time_t localtime;
|
||||
time( &localtime );
|
||||
globalOutputStream() << "Closing log file at " << ctime( &localtime ) << "\n";
|
||||
globalOutputStream() << "Closing log file at " << ctime( &localtime ) << '\n';
|
||||
fclose( g_hLogFile );
|
||||
g_hLogFile = 0;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -424,7 +424,7 @@ public:
|
|||
return true;
|
||||
}
|
||||
void post( const scene::Path& path, scene::Instance& instance ) const {
|
||||
//globalOutputStream() << path.size() << "\n";
|
||||
//globalOutputStream() << path.size() << '\n';
|
||||
if ( path.top().get().visible() ) {
|
||||
Brush* brush = Node_getBrush( path.top() );
|
||||
if ( brush != 0
|
||||
|
|
@ -1163,7 +1163,7 @@ void CSG_WrapMerge( const ClipperPoints& clipperPoints ){
|
|||
brush->addFace( *( p.m_face ) );
|
||||
else
|
||||
brush->addPlane( p.m_verts[0], p.m_verts[1], p.m_verts[2], shader, projection );
|
||||
// globalOutputStream() << p.m_plane.normal() << " " << p.m_plane.dist() << " p.m_plane\n";
|
||||
// globalOutputStream() << p.m_plane.normal() << ' ' << p.m_plane.dist() << " p.m_plane\n";
|
||||
}
|
||||
brush->removeEmptyFaces();
|
||||
}
|
||||
|
|
|
|||
|
|
@ -159,10 +159,9 @@ public:
|
|||
|
||||
// for a given name, we grab the first .def in the vfs
|
||||
// this allows to override baseq3/scripts/entities.def for instance
|
||||
StringOutputStream relPath( 256 );
|
||||
relPath << m_directory << name;
|
||||
const auto relPath = StringStream( m_directory, name );
|
||||
|
||||
scanner.scanFile( g_collector, relPath.c_str() );
|
||||
scanner.scanFile( g_collector, relPath );
|
||||
}
|
||||
};
|
||||
|
||||
|
|
@ -195,12 +194,8 @@ void EntityClassQuake3_constructDirectory( const char* directory, const char* ex
|
|||
|
||||
|
||||
void EntityClassQuake3_Construct(){
|
||||
StringOutputStream baseDirectory( 256 );
|
||||
StringOutputStream gameDirectory( 256 );
|
||||
const char* basegame = GlobalRadiant().getRequiredGameDescriptionKeyValue( "basegame" );
|
||||
const char* gamename = GlobalRadiant().getGameName();
|
||||
baseDirectory << GlobalRadiant().getGameToolsPath() << basegame << '/';
|
||||
gameDirectory << GlobalRadiant().getGameToolsPath() << gamename << '/';
|
||||
const auto baseDirectory = StringStream( GlobalRadiant().getGameToolsPath(), GlobalRadiant().getRequiredGameDescriptionKeyValue( "basegame" ), '/' );
|
||||
const auto gameDirectory = StringStream( GlobalRadiant().getGameToolsPath(), GlobalRadiant().getGameName(), '/' );
|
||||
|
||||
class LoadEntityDefinitionsVisitor : public EClassModules::Visitor
|
||||
{
|
||||
|
|
@ -224,7 +219,7 @@ void EntityClassQuake3_Construct(){
|
|||
}
|
||||
};
|
||||
|
||||
EntityClassManager_getEClassModules().foreachModule( LoadEntityDefinitionsVisitor( baseDirectory.c_str(), gameDirectory.c_str() ) );
|
||||
EntityClassManager_getEClassModules().foreachModule( LoadEntityDefinitionsVisitor( baseDirectory, gameDirectory ) );
|
||||
}
|
||||
|
||||
EntityClass *Eclass_ForName( const char *name, bool has_brushes ){
|
||||
|
|
|
|||
|
|
@ -273,7 +273,7 @@ EntityClass *Eclass_InitFromText( const char *text ){
|
|||
e->m_comments = text;
|
||||
|
||||
setSpecialLoad( e, "model=", e->m_modelpath );
|
||||
e->m_modelpath = StringOutputStream( 256 )( PathCleaned( e->m_modelpath.c_str() ) ).c_str();
|
||||
e->m_modelpath = StringStream<64>( PathCleaned( e->m_modelpath.c_str() ) );
|
||||
|
||||
if ( !e->fixedsize ) {
|
||||
EntityClass_insertAttribute( *e, "angle", EntityClassAttribute( "direction", "Direction" ) );
|
||||
|
|
@ -296,7 +296,7 @@ void Eclass_ScanFile( EntityClassCollector& collector, const char *filename ){
|
|||
globalErrorStream() << "ScanFile: " << filename << " not found\n";
|
||||
return;
|
||||
}
|
||||
globalOutputStream() << "ScanFile: " << filename << "\n";
|
||||
globalOutputStream() << "ScanFile: " << filename << '\n';
|
||||
|
||||
enum EParserState
|
||||
{
|
||||
|
|
@ -367,7 +367,7 @@ void Eclass_ScanFile( EntityClassCollector& collector, const char *filename ){
|
|||
collector.insert( e );
|
||||
}
|
||||
else{
|
||||
globalErrorStream() << "Error parsing: " << debugname << " in " << filename << "\n";
|
||||
globalErrorStream() << "Error parsing: " << debugname << " in " << filename << '\n';
|
||||
}
|
||||
|
||||
buffer.clear();
|
||||
|
|
|
|||
|
|
@ -124,7 +124,7 @@ bool EntityClassDoom3_parseUnknown( Tokeniser& tokeniser ){
|
|||
//const char* name =
|
||||
PARSE_RETURN_FALSE_IF_FAIL( EntityClassDoom3_parseToken( tokeniser ) );
|
||||
|
||||
//globalOutputStream() << "parsing unknown block " << makeQuoted(name) << "\n";
|
||||
//globalOutputStream() << "parsing unknown block " << makeQuoted(name) << '\n';
|
||||
|
||||
PARSE_RETURN_FALSE_IF_FAIL( EntityClassDoom3_parseToken( tokeniser, "{" ) );
|
||||
tokeniser.nextLine();
|
||||
|
|
@ -173,7 +173,7 @@ void Model_resolveInheritance( const char* name, Model& model ){
|
|||
if ( !model.m_parent.empty() ) {
|
||||
Models::iterator i = g_models.find( model.m_parent );
|
||||
if ( i == g_models.end() ) {
|
||||
globalErrorStream() << "model " << name << " inherits unknown model " << model.m_parent << "\n";
|
||||
globalErrorStream() << "model " << name << " inherits unknown model " << model.m_parent << '\n';
|
||||
}
|
||||
else
|
||||
{
|
||||
|
|
@ -276,7 +276,7 @@ bool EntityClassDoom3_parseModel( Tokeniser& tokeniser ){
|
|||
}
|
||||
else
|
||||
{
|
||||
globalErrorStream() << "unknown model parameter: " << makeQuoted( parameter ) << "\n";
|
||||
globalErrorStream() << "unknown model parameter: " << makeQuoted( parameter ) << '\n';
|
||||
return false;
|
||||
}
|
||||
tokeniser.nextLine();
|
||||
|
|
@ -339,13 +339,13 @@ static bool EntityClass_parse( EntityClass& entityClass, Tokeniser& tokeniser ){
|
|||
|
||||
if ( currentString != 0 && string_equal( key, "\\" ) ) {
|
||||
tokeniser.nextLine();
|
||||
*currentString << " ";
|
||||
*currentString << ' ';
|
||||
PARSE_RETURN_FALSE_IF_FAIL( EntityClassDoom3_parseString( tokeniser, *currentString ) );
|
||||
continue;
|
||||
}
|
||||
|
||||
if ( currentDescription != 0 ) {
|
||||
*currentDescription = description.c_str();
|
||||
*currentDescription = description;
|
||||
description.clear();
|
||||
currentDescription = 0;
|
||||
}
|
||||
|
|
@ -359,7 +359,7 @@ static bool EntityClass_parse( EntityClass& entityClass, Tokeniser& tokeniser ){
|
|||
const char* token;
|
||||
PARSE_RETURN_FALSE_IF_FAIL( EntityClassDoom3_parseString( tokeniser, token ) );
|
||||
entityClass.fixedsize = true;
|
||||
entityClass.m_modelpath = StringOutputStream( 256 )( PathCleaned( token ) ).c_str();
|
||||
entityClass.m_modelpath = StringStream<64>( PathCleaned( token ) );
|
||||
}
|
||||
else if ( string_equal( key, "editor_color" ) ) {
|
||||
const char* value;
|
||||
|
|
@ -523,7 +523,7 @@ static bool EntityClass_parse( EntityClass& entityClass, Tokeniser& tokeniser ){
|
|||
tokeniser.nextLine();
|
||||
}
|
||||
|
||||
entityClass.m_comments = usage.c_str();
|
||||
entityClass.m_comments = usage;
|
||||
|
||||
if ( string_equal( entityClass.name(), "light" ) ) {
|
||||
{
|
||||
|
|
@ -604,7 +604,7 @@ bool EntityClassDoom3_parse( TextInputStream& inputStream, const char* filename
|
|||
}
|
||||
CopiedString tmp( blockType );
|
||||
if ( !EntityClassDoom3_parseBlock( tokeniser, tmp.c_str() ) ) {
|
||||
globalErrorStream() << GlobalFileSystem().findFile( filename ) << filename << ":" << (unsigned int)tokeniser.getLine() << ": " << tmp << " parse failed, skipping rest of file\n";
|
||||
globalErrorStream() << GlobalFileSystem().findFile( filename ) << filename << ':' << (unsigned int)tokeniser.getLine() << ": " << tmp << " parse failed, skipping rest of file\n";
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
|
@ -614,14 +614,13 @@ bool EntityClassDoom3_parse( TextInputStream& inputStream, const char* filename
|
|||
|
||||
|
||||
void EntityClassDoom3_loadFile( const char* filename ){
|
||||
globalOutputStream() << "parsing entity classes from " << makeQuoted( filename ) << "\n";
|
||||
globalOutputStream() << "parsing entity classes from " << makeQuoted( filename ) << '\n';
|
||||
|
||||
StringOutputStream fullname( 256 );
|
||||
fullname << "def/" << filename;
|
||||
const auto fullname = StringStream( "def/", filename );
|
||||
|
||||
ArchiveTextFile* file = GlobalFileSystem().openTextFile( fullname.c_str() );
|
||||
ArchiveTextFile* file = GlobalFileSystem().openTextFile( fullname );
|
||||
if ( file != 0 ) {
|
||||
EntityClassDoom3_parse( file->getInputStream(), fullname.c_str() );
|
||||
EntityClassDoom3_parse( file->getInputStream(), fullname );
|
||||
file->release();
|
||||
}
|
||||
}
|
||||
|
|
@ -656,7 +655,7 @@ void EntityClass_resolveInheritance( EntityClass* derivedClass ){
|
|||
derivedClass->inheritanceResolved = true;
|
||||
EntityClasses::iterator i = g_EntityClassDoom3_classes.find( derivedClass->m_parent.front().c_str() );
|
||||
if ( i == g_EntityClassDoom3_classes.end() ) {
|
||||
globalErrorStream() << "failed to find entityDef " << makeQuoted( derivedClass->m_parent.front() ) << " inherited by " << makeQuoted( derivedClass->name() ) << "\n";
|
||||
globalErrorStream() << "failed to find entityDef " << makeQuoted( derivedClass->m_parent.front() ) << " inherited by " << makeQuoted( derivedClass->name() ) << '\n';
|
||||
}
|
||||
else
|
||||
{
|
||||
|
|
@ -717,7 +716,7 @@ public:
|
|||
usage << "-------- NOTES --------\n";
|
||||
|
||||
if ( !( *i ).second->m_comments.empty() ) {
|
||||
usage << ( *i ).second->m_comments << "\n";
|
||||
usage << ( *i ).second->m_comments << '\n';
|
||||
}
|
||||
|
||||
usage << "\n-------- KEYS --------\n";
|
||||
|
|
@ -727,11 +726,11 @@ public:
|
|||
const char* name = EntityClassAttributePair_getName( *j );
|
||||
const char* description = EntityClassAttributePair_getDescription( *j );
|
||||
if ( !string_equal( name, description ) ) {
|
||||
usage << EntityClassAttributePair_getName( *j ) << " : " << EntityClassAttributePair_getDescription( *j ) << "\n";
|
||||
usage << EntityClassAttributePair_getName( *j ) << " : " << EntityClassAttributePair_getDescription( *j ) << '\n';
|
||||
}
|
||||
}
|
||||
|
||||
( *i ).second->m_comments = usage.c_str();
|
||||
( *i ).second->m_comments = usage;
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -63,7 +63,7 @@ void EntityClassFGD_clear(){
|
|||
EntityClass* EntityClassFGD_insertUniqueBase( EntityClass* entityClass ){
|
||||
std::pair<BaseClasses::iterator, bool> result = g_EntityClassFGD_bases.insert( BaseClasses::value_type( entityClass->name(), entityClass ) );
|
||||
if ( !result.second ) {
|
||||
globalErrorStream() << "duplicate base class: " << makeQuoted( entityClass->name() ) << "\n";
|
||||
globalErrorStream() << "duplicate base class: " << makeQuoted( entityClass->name() ) << '\n';
|
||||
//eclass_capture_state(entityClass);
|
||||
//entityClass->free(entityClass);
|
||||
}
|
||||
|
|
@ -74,7 +74,7 @@ EntityClass* EntityClassFGD_insertUnique( EntityClass* entityClass ){
|
|||
EntityClassFGD_insertUniqueBase( entityClass );
|
||||
std::pair<EntityClasses::iterator, bool> result = g_EntityClassFGD_classes.insert( EntityClasses::value_type( entityClass->name(), entityClass ) );
|
||||
if ( !result.second ) {
|
||||
globalErrorStream() << "duplicate entity class: " << makeQuoted( entityClass->name() ) << "\n";
|
||||
globalErrorStream() << "duplicate entity class: " << makeQuoted( entityClass->name() ) << '\n';
|
||||
eclass_capture_state( entityClass );
|
||||
entityClass->free( entityClass );
|
||||
}
|
||||
|
|
@ -120,7 +120,7 @@ void EntityClassFGD_parseSplitString( Tokeniser& tokeniser, CopiedString& string
|
|||
buffer << tokeniser.getToken();
|
||||
if ( !string_equal( tokeniser.getToken(), "+" ) ) {
|
||||
tokeniser.ungetToken();
|
||||
string = buffer.c_str();
|
||||
string = buffer;
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
|
@ -186,7 +186,7 @@ void EntityClassFGD_parseClass( Tokeniser& tokeniser, bool fixedsize, bool isBas
|
|||
}
|
||||
else if ( string_equal( property, "iconsprite" ) ) {
|
||||
ASSERT_MESSAGE( EntityClassFGD_parseToken( tokeniser, "(" ), PARSE_ERROR );
|
||||
entityClass->m_modelpath = StringOutputStream( 256 )( PathCleaned( tokeniser.getToken() ) ).c_str();
|
||||
entityClass->m_modelpath = StringStream<64>( PathCleaned( tokeniser.getToken() ) );
|
||||
ASSERT_MESSAGE( EntityClassFGD_parseToken( tokeniser, ")" ), PARSE_ERROR );
|
||||
}
|
||||
else if ( string_equal( property, "sprite" )
|
||||
|
|
@ -415,9 +415,8 @@ void EntityClassFGD_parseClass( Tokeniser& tokeniser, bool fixedsize, bool isBas
|
|||
ASSERT_MESSAGE( EntityClassFGD_parseToken( tokeniser, "[" ), PARSE_ERROR );
|
||||
tokeniser.nextLine();
|
||||
|
||||
StringOutputStream listTypeName( 64 );
|
||||
listTypeName << entityClass->name() << "_" << attribute.m_name;
|
||||
attribute.m_type = listTypeName.c_str();
|
||||
const auto listTypeName = StringStream<64>( entityClass->name(), '_', attribute.m_name );
|
||||
attribute.m_type = listTypeName;
|
||||
|
||||
ListAttributeType& listType = g_listTypesFGD[listTypeName.c_str()];
|
||||
|
||||
|
|
@ -572,7 +571,7 @@ void EntityClassFGD_parse( TextInputStream& inputStream, const char* path ){
|
|||
}
|
||||
// hl2 below
|
||||
else if ( string_equal( blockType, "@include" ) ) {
|
||||
EntityClassFGD_loadFile( StringOutputStream( 256 )( PathFilenameless( path ), tokeniser.getToken() ).c_str() );
|
||||
EntityClassFGD_loadFile( StringStream( PathFilenameless( path ), tokeniser.getToken() ) );
|
||||
}
|
||||
else if ( string_equal( blockType, "@mapsize" ) ) {
|
||||
ASSERT_MESSAGE( EntityClassFGD_parseToken( tokeniser, "(" ), PARSE_ERROR );
|
||||
|
|
@ -596,7 +595,7 @@ void EntityClassFGD_parse( TextInputStream& inputStream, const char* path ){
|
|||
void EntityClassFGD_loadFile( const char* filename ){
|
||||
TextFileInputStream file( filename );
|
||||
if ( !file.failed() ) {
|
||||
globalOutputStream() << "parsing entity classes from " << makeQuoted( filename ) << "\n";
|
||||
globalOutputStream() << "parsing entity classes from " << makeQuoted( filename ) << '\n';
|
||||
|
||||
EntityClassFGD_parse( file, filename );
|
||||
}
|
||||
|
|
@ -637,7 +636,7 @@ void EntityClassFGD_resolveInheritance( EntityClass* derivedClass ){
|
|||
{
|
||||
BaseClasses::iterator i = g_EntityClassFGD_bases.find( ( *j ).c_str() );
|
||||
if ( i == g_EntityClassFGD_bases.end() ) {
|
||||
globalErrorStream() << "failed to find entityDef " << makeQuoted( ( *j ).c_str() ) << " inherited by " << makeQuoted( derivedClass->name() ) << "\n";
|
||||
globalErrorStream() << "failed to find entityDef " << makeQuoted( ( *j ).c_str() ) << " inherited by " << makeQuoted( derivedClass->name() ) << '\n';
|
||||
}
|
||||
else
|
||||
{
|
||||
|
|
@ -680,8 +679,8 @@ public:
|
|||
if ( --m_unrealised == 0 ) {
|
||||
|
||||
{
|
||||
const auto baseDirectory = StringOutputStream( 256 )( GlobalRadiant().getGameToolsPath(), GlobalRadiant().getRequiredGameDescriptionKeyValue( "basegame" ), '/' );
|
||||
const auto gameDirectory = StringOutputStream( 256 )( GlobalRadiant().getGameToolsPath(), GlobalRadiant().getGameName(), '/' );
|
||||
const auto baseDirectory = StringStream( GlobalRadiant().getGameToolsPath(), GlobalRadiant().getRequiredGameDescriptionKeyValue( "basegame" ), '/' );
|
||||
const auto gameDirectory = StringStream( GlobalRadiant().getGameToolsPath(), GlobalRadiant().getGameName(), '/' );
|
||||
|
||||
const auto pathLess = []( const CopiedString& one, const CopiedString& other ){
|
||||
return path_less( one.c_str(), other.c_str() );
|
||||
|
|
@ -701,7 +700,7 @@ public:
|
|||
}
|
||||
|
||||
for( const auto& [ name, path ] : name_path ){
|
||||
EntityClassFGD_loadFile( StringOutputStream()( path, name ) );
|
||||
EntityClassFGD_loadFile( StringStream( path, name ) );
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -245,7 +245,7 @@ public:
|
|||
desc = StringRange( data, length );
|
||||
}
|
||||
else{ // in case of special symbols, e.g. ", &apos, <, >, &, xml writes in a few steps
|
||||
desc = StringOutputStream()( desc, StringRange( data, length ) );
|
||||
desc = StringStream( desc, StringRange( data, length ) );
|
||||
}
|
||||
|
||||
return m_comment.write( data, length );
|
||||
|
|
@ -290,7 +290,8 @@ class ClassImporter : public TreeXMLImporter
|
|||
ListAttributeTypes& m_listTypes;
|
||||
|
||||
public:
|
||||
ClassImporter( EntityClassCollector& collector, ListAttributeTypes& listTypes, const XMLElement& element ) : m_collector( collector ), m_listTypes( listTypes ){
|
||||
ClassImporter( EntityClassCollector& collector, ListAttributeTypes& listTypes, const XMLElement& element )
|
||||
: m_collector( collector ), m_comment( 1024 ), m_listTypes( listTypes ){
|
||||
m_eclass = Eclass_Alloc();
|
||||
m_eclass->free = &Eclass_Free;
|
||||
|
||||
|
|
@ -305,7 +306,7 @@ public:
|
|||
|
||||
const char* model = element.attribute( "model" );
|
||||
if ( !string_empty( model ) ) {
|
||||
m_eclass->m_modelpath = StringOutputStream( 256 )( PathCleaned( model ) ).c_str();
|
||||
m_eclass->m_modelpath = StringStream<64>( PathCleaned( model ) );
|
||||
}
|
||||
|
||||
const char* type = element.name();
|
||||
|
|
@ -317,7 +318,7 @@ public:
|
|||
}
|
||||
}
|
||||
~ClassImporter(){
|
||||
m_eclass->m_comments = m_comment.c_str();
|
||||
m_eclass->m_comments = m_comment;
|
||||
m_collector.insert( m_eclass );
|
||||
|
||||
for ( ListAttributeTypes::iterator i = m_listTypes.begin(); i != m_listTypes.end(); ++i )
|
||||
|
|
|
|||
|
|
@ -171,12 +171,12 @@ void Scene_EntitySetKeyValue_Selected( const char* key, const char* value ){
|
|||
|
||||
void Scene_EntitySetClassname_Selected( const char* classname ){
|
||||
if ( GlobalSelectionSystem().countSelected() > 0 ) {
|
||||
StringOutputStream command;
|
||||
StringOutputStream command( 64 );
|
||||
if( string_equal( classname, "worldspawn" ) )
|
||||
command << "ungroupSelectedEntities";
|
||||
else
|
||||
command << "entitySetClass -class " << classname;
|
||||
UndoableCommand undo( command.c_str() );
|
||||
UndoableCommand undo( command );
|
||||
GlobalSceneGraph().traverse( EntitySetClassnameSelected( classname ) );
|
||||
}
|
||||
}
|
||||
|
|
@ -306,9 +306,8 @@ void Entity_moveSelectedPrimitives( bool toLast ){
|
|||
scene::Node& node = ( !Node_isEntity( path.top() ) && path.size() > 1 )? path.parent() : path.top();
|
||||
|
||||
if ( Node_isEntity( node ) && node_is_group( node ) ) {
|
||||
StringOutputStream command;
|
||||
command << "movePrimitivesToEntity " << makeQuoted( Node_getEntity( node )->getClassName() );
|
||||
UndoableCommand undo( command.c_str() );
|
||||
const auto command = StringStream<64>( "movePrimitivesToEntity ", makeQuoted( Node_getEntity( node )->getClassName() ) );
|
||||
UndoableCommand undo( command );
|
||||
Scene_parentSelectedBrushesToEntity( GlobalSceneGraph(), node );
|
||||
}
|
||||
}
|
||||
|
|
@ -394,9 +393,8 @@ void Entity_createFromSelection( const char* name, const Vector3& origin ){
|
|||
}
|
||||
#endif
|
||||
|
||||
StringOutputStream command;
|
||||
command << "entityCreate -class " << name;
|
||||
UndoableCommand undo( command.c_str() );
|
||||
const auto command = StringStream<64>( "entityCreate -class ", name );
|
||||
UndoableCommand undo( command );
|
||||
|
||||
EntityClass* entityClass = GlobalEntityClassManager().findOrInsert( name, true );
|
||||
|
||||
|
|
@ -484,13 +482,9 @@ void Entity_createFromSelection( const char* name, const Vector3& origin ){
|
|||
}
|
||||
}
|
||||
else if ( brushesSelected ) { // use workzone to set light position/size for doom3 lights, if there are brushes selected
|
||||
AABB bounds( Doom3Light_getBounds( workzone ) );
|
||||
StringOutputStream key( 64 );
|
||||
key << bounds.origin[0] << " " << bounds.origin[1] << " " << bounds.origin[2];
|
||||
entity->setKeyValue( "origin", key.c_str() );
|
||||
key.clear();
|
||||
key << bounds.extents[0] << " " << bounds.extents[1] << " " << bounds.extents[2];
|
||||
entity->setKeyValue( "light_radius", key.c_str() );
|
||||
const AABB bounds( Doom3Light_getBounds( workzone ) );
|
||||
entity->setKeyValue( "origin", StringStream<64>( bounds.origin[0], ' ', bounds.origin[1], ' ', bounds.origin[2] ) );
|
||||
entity->setKeyValue( "light_radius", StringStream<64>( bounds.extents[0], ' ', bounds.extents[1], ' ', bounds.extents[2] ) );
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -538,9 +532,8 @@ void Entity_normalizeColor(){
|
|||
g_entity_globals.color_entity[1],
|
||||
g_entity_globals.color_entity[2] );
|
||||
|
||||
StringOutputStream command( 256 );
|
||||
command << "entityNormalizeColour " << buffer;
|
||||
UndoableCommand undo( command.c_str() );
|
||||
const auto command = StringStream<64>( "entityNormalizeColour ", buffer );
|
||||
UndoableCommand undo( command );
|
||||
Scene_EntitySetKeyValue_Selected( "_color", buffer );
|
||||
}
|
||||
}
|
||||
|
|
@ -571,9 +564,8 @@ void Entity_setColour(){
|
|||
g_entity_globals.color_entity[1],
|
||||
g_entity_globals.color_entity[2] );
|
||||
|
||||
StringOutputStream command( 256 );
|
||||
command << "entitySetColour " << buffer;
|
||||
UndoableCommand undo( command.c_str() );
|
||||
const auto command = StringStream<64>( "entitySetColour ", buffer );
|
||||
UndoableCommand undo( command );
|
||||
Scene_EntitySetKeyValue_Selected( "_color", buffer );
|
||||
}
|
||||
}
|
||||
|
|
@ -581,7 +573,7 @@ void Entity_setColour(){
|
|||
}
|
||||
|
||||
const char* misc_model_dialog( QWidget* parent, const char* filepath ){
|
||||
StringOutputStream buffer( 1024 );
|
||||
StringOutputStream buffer( 256 );
|
||||
|
||||
if( !string_empty( filepath ) ){
|
||||
const char* root = GlobalFileSystem().findFile( filepath );
|
||||
|
|
@ -591,14 +583,13 @@ const char* misc_model_dialog( QWidget* parent, const char* filepath ){
|
|||
if( buffer.empty() ){
|
||||
buffer << g_qeglobals.m_userGamePath << "models/";
|
||||
|
||||
if ( !file_readable( buffer.c_str() ) ) {
|
||||
if ( !file_readable( buffer ) ) {
|
||||
// just go to fsmain
|
||||
buffer.clear();
|
||||
buffer << g_qeglobals.m_userGamePath;
|
||||
buffer( g_qeglobals.m_userGamePath );
|
||||
}
|
||||
}
|
||||
|
||||
const char *filename = file_dialog( parent, true, "Choose Model", buffer.c_str(), ModelLoader::Name );
|
||||
const char *filename = file_dialog( parent, true, "Choose Model", buffer, ModelLoader::Name );
|
||||
if ( filename != 0 ) {
|
||||
// use VFS to get the correct relative path
|
||||
const char* relative = path_make_relative( filename, GlobalFileSystem().findRoot( filename ) );
|
||||
|
|
|
|||
|
|
@ -103,9 +103,8 @@ const char* SelectedEntity_getValueForKey( const char* key ){
|
|||
}
|
||||
|
||||
void Scene_EntitySetKeyValue_Selected_Undoable( const char* key, const char* value ){
|
||||
StringOutputStream command( 256 );
|
||||
command << "entitySetKeyValue -key " << makeQuoted( key ) << " -value " << makeQuoted( value );
|
||||
UndoableCommand undo( command.c_str() );
|
||||
const auto command = StringStream( "entitySetKeyValue -key ", makeQuoted( key ), " -value ", makeQuoted( value ) );
|
||||
UndoableCommand undo( command );
|
||||
Scene_EntitySetKeyValue_Selected( key, value );
|
||||
}
|
||||
|
||||
|
|
@ -274,7 +273,7 @@ public:
|
|||
};
|
||||
|
||||
const char* browse_sound( QWidget* parent, const char* filepath ){
|
||||
StringOutputStream buffer( 1024 );
|
||||
StringOutputStream buffer( 256 );
|
||||
|
||||
if( !string_empty( filepath ) ){
|
||||
const char* root = GlobalFileSystem().findFile( filepath );
|
||||
|
|
@ -284,14 +283,13 @@ const char* browse_sound( QWidget* parent, const char* filepath ){
|
|||
if( buffer.empty() ){
|
||||
buffer << g_qeglobals.m_userGamePath << "sound/";
|
||||
|
||||
if ( !file_readable( buffer.c_str() ) ) {
|
||||
if ( !file_readable( buffer ) ) {
|
||||
// just go to fsmain
|
||||
buffer.clear();
|
||||
buffer << g_qeglobals.m_userGamePath;
|
||||
buffer( g_qeglobals.m_userGamePath );
|
||||
}
|
||||
}
|
||||
|
||||
const char* filename = file_dialog( parent, true, "Open Sound File", buffer.c_str(), "sound" );
|
||||
const char* filename = file_dialog( parent, true, "Open Sound File", buffer, "sound" );
|
||||
if ( filename != 0 ) {
|
||||
const char* relative = path_make_relative( filename, GlobalFileSystem().findRoot( filename ) );
|
||||
if ( relative == filename ) {
|
||||
|
|
@ -387,17 +385,15 @@ public:
|
|||
return m_hbox;
|
||||
}
|
||||
void apply(){
|
||||
StringOutputStream angle( 32 );
|
||||
angle << angle_normalised( entry_get_float( m_entry ) );
|
||||
Scene_EntitySetKeyValue_Selected_Undoable( m_key.c_str(), angle.c_str() );
|
||||
const auto angle = StringStream<32>( angle_normalised( entry_get_float( m_entry ) ) );
|
||||
Scene_EntitySetKeyValue_Selected_Undoable( m_key.c_str(), angle );
|
||||
}
|
||||
typedef MemberCaller<AngleAttribute, &AngleAttribute::apply> ApplyCaller;
|
||||
|
||||
void update() override {
|
||||
const char* value = SelectedEntity_getValueForKey( m_key.c_str() );
|
||||
if ( !string_empty( value ) ) {
|
||||
StringOutputStream angle( 32 );
|
||||
angle << angle_normalised( atof( value ) );
|
||||
const auto angle = StringStream<32>( angle_normalised( atof( value ) ) );
|
||||
m_entry->setText( angle.c_str() );
|
||||
}
|
||||
else
|
||||
|
|
@ -441,9 +437,8 @@ public:
|
|||
return m_hbox;
|
||||
}
|
||||
void apply(){
|
||||
StringOutputStream angle( 32 );
|
||||
angle << angle_normalised( entry_get_float( m_entry ) );
|
||||
Scene_EntitySetKeyValue_Selected_Undoable( m_key.c_str(), angle.c_str() );
|
||||
const auto angle = StringStream<32>( angle_normalised( entry_get_float( m_entry ) ) );
|
||||
Scene_EntitySetKeyValue_Selected_Undoable( m_key.c_str(), angle );
|
||||
}
|
||||
typedef MemberCaller<DirectionAttribute, &DirectionAttribute::apply> ApplyCaller;
|
||||
|
||||
|
|
@ -465,8 +460,7 @@ public:
|
|||
{
|
||||
m_entry->setEnabled( true );
|
||||
m_radio.m_radio->button( 2 )->setChecked( true );
|
||||
StringOutputStream angle( 32 );
|
||||
angle << angle_normalised( f );
|
||||
const auto angle = StringStream<32>( angle_normalised( f ) );
|
||||
m_entry->setText( angle.c_str() );
|
||||
}
|
||||
}
|
||||
|
|
@ -532,22 +526,21 @@ public:
|
|||
return m_hbox;
|
||||
}
|
||||
void apply(){
|
||||
StringOutputStream angles( 64 );
|
||||
angles << angle_normalised( entry_get_float( m_angles.m_pitch ) )
|
||||
<< " " << angle_normalised( entry_get_float( m_angles.m_yaw ) )
|
||||
<< " " << angle_normalised( entry_get_float( m_angles.m_roll ) );
|
||||
Scene_EntitySetKeyValue_Selected_Undoable( m_key.c_str(), angles.c_str() );
|
||||
const auto angles = StringStream<64>( angle_normalised( entry_get_float( m_angles.m_pitch ) ),
|
||||
' ', angle_normalised( entry_get_float( m_angles.m_yaw ) ),
|
||||
' ', angle_normalised( entry_get_float( m_angles.m_roll ) ) );
|
||||
Scene_EntitySetKeyValue_Selected_Undoable( m_key.c_str(), angles );
|
||||
}
|
||||
typedef MemberCaller<AnglesAttribute, &AnglesAttribute::apply> ApplyCaller;
|
||||
|
||||
void update() override {
|
||||
StringOutputStream angle( 32 );
|
||||
const char* value = SelectedEntity_getValueForKey( m_key.c_str() );
|
||||
if ( !string_empty( value ) ) {
|
||||
DoubleVector3 pitch_yaw_roll;
|
||||
if ( !string_parse_vector3( value, pitch_yaw_roll ) ) {
|
||||
pitch_yaw_roll = DoubleVector3( 0, 0, 0 );
|
||||
}
|
||||
StringOutputStream angle( 32 );
|
||||
|
||||
angle( angle_normalised( pitch_yaw_roll.x() ) );
|
||||
m_angles.m_pitch->setText( angle.c_str() );
|
||||
|
|
@ -606,22 +599,21 @@ public:
|
|||
return m_hbox;
|
||||
}
|
||||
void apply(){
|
||||
StringOutputStream vector3( 64 );
|
||||
vector3 << entry_get_float( m_vector3.m_x )
|
||||
<< " " << entry_get_float( m_vector3.m_y )
|
||||
<< " " << entry_get_float( m_vector3.m_z );
|
||||
Scene_EntitySetKeyValue_Selected_Undoable( m_key.c_str(), vector3.c_str() );
|
||||
const auto vector3 = StringStream<64>( entry_get_float( m_vector3.m_x ),
|
||||
' ', entry_get_float( m_vector3.m_y ),
|
||||
' ', entry_get_float( m_vector3.m_z ) );
|
||||
Scene_EntitySetKeyValue_Selected_Undoable( m_key.c_str(), vector3 );
|
||||
}
|
||||
typedef MemberCaller<Vector3Attribute, &Vector3Attribute::apply> ApplyCaller;
|
||||
|
||||
void update() override {
|
||||
StringOutputStream buffer( 32 );
|
||||
const char* value = SelectedEntity_getValueForKey( m_key.c_str() );
|
||||
if ( !string_empty( value ) ) {
|
||||
DoubleVector3 x_y_z;
|
||||
if ( !string_parse_vector3( value, x_y_z ) ) {
|
||||
x_y_z = DoubleVector3( 0, 0, 0 );
|
||||
}
|
||||
StringOutputStream buffer( 32 );
|
||||
|
||||
buffer( x_y_z.x() );
|
||||
m_vector3.m_x->setText( buffer.c_str() );
|
||||
|
|
@ -864,7 +856,7 @@ void SpawnFlags_setEntityClass( EntityClass* eclass ){
|
|||
|
||||
for ( int i = 0; i < g_spawnflag_count; ++i )
|
||||
{
|
||||
const auto str = StringOutputStream( 16 )( LowerCase( eclass->flagnames[spawn_table[i]] ) );
|
||||
const auto str = StringStream<16>( LowerCase( eclass->flagnames[spawn_table[i]] ) );
|
||||
|
||||
QCheckBox *check = g_entitySpawnflagsCheck[i];
|
||||
check->setText( str.c_str() );
|
||||
|
|
@ -990,12 +982,12 @@ void EntityInspector_applySpawnflags(){
|
|||
f |= v << spawn_table[i];
|
||||
}
|
||||
|
||||
char sz[32];
|
||||
sprintf( sz, "%i", f );
|
||||
const char* value = ( f == 0 ) ? "" : sz;
|
||||
char value[32] = {};
|
||||
if( f != 0 )
|
||||
sprintf( value, "%i", f );
|
||||
|
||||
{
|
||||
const auto command = StringOutputStream( 64 )( "entitySetSpawnflags -flags ", f );
|
||||
const auto command = StringStream<64>( "entitySetSpawnflags -flags ", f );
|
||||
UndoableCommand undo( command );
|
||||
|
||||
Scene_EntitySetKeyValue_Selected( "spawnflags", value );
|
||||
|
|
@ -1085,8 +1077,8 @@ void EntityInspector_clearKeyValue(){
|
|||
const auto key = item->text( 0 ).toLatin1();
|
||||
|
||||
if ( !string_equal( key.constData(), "classname" ) ) {
|
||||
const auto command = StringOutputStream( 64 )( "entityDeleteKey -key ", key.constData() );
|
||||
UndoableCommand undo( command.c_str() );
|
||||
const auto command = StringStream<64>( "entityDeleteKey -key ", key.constData() );
|
||||
UndoableCommand undo( command );
|
||||
Scene_EntitySetKeyValue_Selected( key.constData(), "" );
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -63,7 +63,7 @@ void gamedetect_found_game( const char *game, char *path ){
|
|||
return;
|
||||
}
|
||||
|
||||
globalOutputStream() << "Detected game " << game << " in " << path << "\n";
|
||||
globalOutputStream() << "Detected game " << game << " in " << path << '\n';
|
||||
|
||||
sprintf( buf, "-%s-EnginePath", game );
|
||||
argc = 0;
|
||||
|
|
@ -83,14 +83,14 @@ bool gamedetect_check_game( const char *gamefile, const char *checkfile1, const
|
|||
buf[bufpos] = '/';
|
||||
|
||||
strcpy( buf + bufpos + 1, checkfile1 );
|
||||
globalOutputStream() << "Checking for a game file in " << buf << "\n";
|
||||
globalOutputStream() << "Checking for a game file in " << buf << '\n';
|
||||
if ( !file_exists( buf ) ) {
|
||||
return false;
|
||||
}
|
||||
|
||||
if ( checkfile2 ) {
|
||||
strcpy( buf + bufpos + 1, checkfile2 );
|
||||
globalOutputStream() << "Checking for a game file in " << buf << "\n";
|
||||
globalOutputStream() << "Checking for a game file in " << buf << '\n';
|
||||
if ( !file_exists( buf ) ) {
|
||||
return false;
|
||||
}
|
||||
|
|
@ -185,10 +185,9 @@ const char* environment_get_app_filepath(){
|
|||
}
|
||||
|
||||
bool portable_app_setup(){
|
||||
StringOutputStream confdir( 256 );
|
||||
confdir << app_path << "settings/";
|
||||
if ( file_exists( confdir.c_str() ) ) {
|
||||
home_path = confdir.c_str();
|
||||
const auto confdir = StringStream( app_path, "settings/" );
|
||||
if ( file_exists( confdir ) ) {
|
||||
home_path = confdir;
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
|
|
@ -200,7 +199,7 @@ CopiedString g_openMapByCmd;
|
|||
void cmdMap(){
|
||||
for ( int i = 1; i < g_argc; ++i )
|
||||
if( path_extension_is( g_argv[i], "map" ) ){
|
||||
g_openMapByCmd = StringOutputStream( 256 )( PathCleaned( g_argv[i] ) ).c_str();
|
||||
g_openMapByCmd = StringStream( PathCleaned( g_argv[i] ) );
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
|
@ -261,7 +260,7 @@ void environment_init( int argc, char* argv[] ){
|
|||
}
|
||||
|
||||
if ( !portable_app_setup() ) {
|
||||
home_path = StringOutputStream( 256 )( DirectoryCleaned( g_get_home_dir() ), ".netradiant/" ).c_str();
|
||||
home_path = StringStream( DirectoryCleaned( g_get_home_dir() ), ".netradiant/" );
|
||||
Q_mkdir( home_path.c_str() );
|
||||
}
|
||||
gamedetect();
|
||||
|
|
@ -280,7 +279,7 @@ void environment_init( int argc, char* argv[] ){
|
|||
char filename[MAX_PATH + 1];
|
||||
GetModuleFileName( 0, filename, MAX_PATH );
|
||||
|
||||
app_filepath = StringOutputStream( 256 )( PathCleaned( filename ) ).c_str();
|
||||
app_filepath = StringStream( PathCleaned( filename ) );
|
||||
app_path = PathFilenameless( app_filepath.c_str() );
|
||||
}
|
||||
|
||||
|
|
@ -297,8 +296,8 @@ void environment_init( int argc, char* argv[] ){
|
|||
home << PathCleaned( appdata );
|
||||
}
|
||||
home << "/NetRadiantSettings/";
|
||||
Q_mkdir( home.c_str() );
|
||||
home_path = home.c_str();
|
||||
Q_mkdir( home );
|
||||
home_path = home;
|
||||
}
|
||||
gamedetect();
|
||||
cmdMap();
|
||||
|
|
|
|||
|
|
@ -58,7 +58,7 @@ void CSelectMsg::saxStartElement( message_info_t *ctx, const xmlChar *name, cons
|
|||
ASSERT_MESSAGE( string_equal( reinterpret_cast<const char*>( name ), "brush" ), "FEEDBACK PARSE ERROR" );
|
||||
ASSERT_MESSAGE( ESelectState == SELECT_MESSAGE, "FEEDBACK PARSE ERROR" );
|
||||
ESelectState = SELECT_BRUSH;
|
||||
globalWarningStream() << message.c_str() << '\n';
|
||||
globalWarningStream() << message << '\n';
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -80,7 +80,7 @@ void CSelectMsg::saxCharacters( message_info_t *ctx, const xmlChar *ch, int len
|
|||
IGL2DWindow* CSelectMsg::Highlight(){
|
||||
GlobalSelectionSystem().setSelectedAll( false );
|
||||
int entitynum, brushnum;
|
||||
if ( sscanf( reinterpret_cast<const char*>( brush.c_str() ), "%i %i", &entitynum, &brushnum ) == 2 ) {
|
||||
if ( sscanf( brush, "%i %i", &entitynum, &brushnum ) == 2 ) {
|
||||
SelectBrush( entitynum, brushnum );
|
||||
}
|
||||
return 0;
|
||||
|
|
@ -97,7 +97,7 @@ void CPointMsg::saxStartElement( message_info_t *ctx, const xmlChar *name, const
|
|||
ASSERT_MESSAGE( string_equal( reinterpret_cast<const char*>( name ), "point" ), "FEEDBACK PARSE ERROR" );
|
||||
ASSERT_MESSAGE( EPointState == POINT_MESSAGE, "FEEDBACK PARSE ERROR" );
|
||||
EPointState = POINT_POINT;
|
||||
globalWarningStream() << message.c_str() << '\n';
|
||||
globalWarningStream() << message << '\n';
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -105,7 +105,7 @@ void CPointMsg::saxEndElement( message_info_t *ctx, const xmlChar *name ){
|
|||
if ( string_equal( reinterpret_cast<const char*>( name ), "pointmsg" ) ) {
|
||||
}
|
||||
else if ( string_equal( reinterpret_cast<const char*>( name ), "point" ) ) {
|
||||
sscanf( point.c_str(), "%g %g %g", &( pt[0] ), &( pt[1] ), &( pt[2] ) );
|
||||
sscanf( point, "%g %g %g", &( pt[0] ), &( pt[1] ), &( pt[2] ) );
|
||||
point.clear();
|
||||
}
|
||||
}
|
||||
|
|
@ -154,7 +154,7 @@ void CWindingMsg::saxStartElement( message_info_t *ctx, const xmlChar *name, con
|
|||
ASSERT_MESSAGE( string_equal( reinterpret_cast<const char*>( name ), "winding" ), "FEEDBACK PARSE ERROR" );
|
||||
ASSERT_MESSAGE( EPointState == WINDING_MESSAGE, "FEEDBACK PARSE ERROR" );
|
||||
EPointState = WINDING_WINDING;
|
||||
globalWarningStream() << message.c_str() << '\n';
|
||||
globalWarningStream() << message << '\n';
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -162,7 +162,7 @@ void CWindingMsg::saxEndElement( message_info_t *ctx, const xmlChar *name ){
|
|||
if ( string_equal( reinterpret_cast<const char*>( name ), "windingmsg" ) ) {
|
||||
}
|
||||
else if ( string_equal( reinterpret_cast<const char*>( name ), "winding" ) ) {
|
||||
const char* c = winding.c_str();
|
||||
const char* c = winding;
|
||||
sscanf( c, "%i ", &numpoints );
|
||||
|
||||
int i = 0;
|
||||
|
|
|
|||
|
|
@ -72,7 +72,7 @@ public:
|
|||
void saxCharacters( message_info_t *ctx, const xmlChar *ch, int len );
|
||||
// for use in the dialog window
|
||||
const char* getName() {
|
||||
return message.c_str();
|
||||
return message;
|
||||
}
|
||||
IGL2DWindow* Highlight();
|
||||
void DropHighlight() { }
|
||||
|
|
@ -99,7 +99,7 @@ public:
|
|||
void saxCharacters( message_info_t *ctx, const xmlChar *ch, int len );
|
||||
// for use in the dialog window
|
||||
const char* getName() {
|
||||
return message.c_str();
|
||||
return message;
|
||||
}
|
||||
IGL2DWindow* Highlight();
|
||||
void DropHighlight();
|
||||
|
|
@ -142,7 +142,7 @@ public:
|
|||
void saxCharacters( message_info_t *ctx, const xmlChar *ch, int len );
|
||||
// for use in the dialog window
|
||||
const char* getName() {
|
||||
return message.c_str();
|
||||
return message;
|
||||
}
|
||||
IGL2DWindow* Highlight();
|
||||
void DropHighlight();
|
||||
|
|
|
|||
|
|
@ -18,24 +18,20 @@
|
|||
|
||||
|
||||
CopiedString GetCommonShader( const char* name ){
|
||||
StringOutputStream sstream( 128 );
|
||||
sstream << "shader_" << name;
|
||||
const char* gotShader = g_pGameDescription->getKeyValue( sstream.c_str() );
|
||||
const char* gotShader = g_pGameDescription->getKeyValue( StringStream<32>( "shader_", name ) );
|
||||
if( !string_empty( gotShader ) ){
|
||||
return gotShader;
|
||||
}
|
||||
else{
|
||||
sstream.clear();
|
||||
if( string_empty( g_pGameDescription->getKeyValue( "show_wads" ) ) ){
|
||||
const char* commonDir = g_pGameDescription->getKeyValue( "common_shaders_dir" );
|
||||
if( string_empty( commonDir ) )
|
||||
commonDir = "common/";
|
||||
sstream << "textures/" << commonDir << name;
|
||||
return StringStream<64>( "textures/", commonDir, name ).c_str();
|
||||
}
|
||||
else{
|
||||
sstream << "textures/" << name;
|
||||
return StringStream<64>( "textures/", name ).c_str();
|
||||
}
|
||||
return sstream.c_str();
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -84,9 +84,9 @@ static bool g_bFindActive = true;
|
|||
namespace
|
||||
{
|
||||
void FindTextureDialog_apply(){
|
||||
const auto find = StringOutputStream( 256 )( "textures/", g_FindTextureDialog.m_strFind );
|
||||
const auto replace = StringOutputStream( 256 )( "textures/", PathCleaned( g_FindTextureDialog.m_strReplace.c_str() ) );
|
||||
FindReplaceTextures( find.c_str(), replace.c_str(), g_FindTextureDialog.m_bSelectedOnly );
|
||||
const auto find = StringStream<64>( "textures/", g_FindTextureDialog.m_strFind );
|
||||
const auto replace = StringStream<64>( "textures/", PathCleaned( g_FindTextureDialog.m_strReplace.c_str() ) );
|
||||
FindReplaceTextures( find, replace, g_FindTextureDialog.m_bSelectedOnly );
|
||||
}
|
||||
|
||||
class FindActiveTracker : public QObject
|
||||
|
|
|
|||
|
|
@ -363,12 +363,12 @@ void DoAbout(){
|
|||
hbox->addWidget( buttons );
|
||||
{
|
||||
auto button = buttons->addButton( "Credits", QDialogButtonBox::ButtonRole::NoRole );
|
||||
QObject::connect( button, &QPushButton::clicked, [](){ OpenURL( StringOutputStream( 256 )( AppPath_get(), "credits.html" ) ); } );
|
||||
QObject::connect( button, &QPushButton::clicked, [](){ OpenURL( StringStream( AppPath_get(), "credits.html" ) ); } );
|
||||
button->setEnabled( false );
|
||||
}
|
||||
{
|
||||
auto button = buttons->addButton( "Changelog", QDialogButtonBox::ButtonRole::NoRole );
|
||||
QObject::connect( button, &QPushButton::clicked, [](){ OpenURL( StringOutputStream( 256 )( AppPath_get(), "changelog.txt" ) ); } );
|
||||
QObject::connect( button, &QPushButton::clicked, [](){ OpenURL( StringStream( AppPath_get(), "changelog.txt" ) ); } );
|
||||
button->setEnabled( false );
|
||||
}
|
||||
{
|
||||
|
|
@ -445,13 +445,13 @@ bool DoLightIntensityDlg( int *intensity ){
|
|||
}
|
||||
|
||||
void DoShaderInfoDlg( const char* name, const char* filename, const char* title ){
|
||||
StringOutputStream text( 256 );
|
||||
text << " The selected shader<br>";
|
||||
text << "<b>" << name << "</b><br>";
|
||||
text << " is located in file<br>";
|
||||
text << "<b>" << filename << "</b>";
|
||||
|
||||
qt_MessageBox( MainFrame_getWindow(), text.c_str(), title );
|
||||
const auto text = StringStream(
|
||||
" The selected shader<br>"
|
||||
"<b>", name, "</b><br>"
|
||||
" is located in file<br>"
|
||||
"<b>", filename, "</b>"
|
||||
);
|
||||
qt_MessageBox( MainFrame_getWindow(), text, title );
|
||||
}
|
||||
|
||||
// =============================================================================
|
||||
|
|
@ -579,7 +579,7 @@ retry:
|
|||
if( copiedN == files.size() )
|
||||
qt_MessageBox( &dialog, "All files have been copied.", "Great Success!" );
|
||||
else if( copiedN != 0 )
|
||||
qt_MessageBox( &dialog, StringOutputStream( 64 )( copiedN, '/', files.size(), " files have been copied." ), "Moderate Success!" );
|
||||
qt_MessageBox( &dialog, StringStream<64>( copiedN, '/', files.size(), " files have been copied." ), "Moderate Success!" );
|
||||
else
|
||||
qt_MessageBox( &dialog, "No files have been copied.", "Boo!" );
|
||||
|
||||
|
|
@ -1984,12 +1984,15 @@ private:
|
|||
{
|
||||
const char* m_dirstring;
|
||||
TexTree& m_texTree;
|
||||
mutable StringOutputStream m_stringStream;
|
||||
public:
|
||||
void insert( const char *name ) const {
|
||||
m_texTree.insert( StringOutputStream( 64 )( m_dirstring, PathExtensionless( name ) ) );
|
||||
m_texTree.insert( m_stringStream( m_dirstring, PathExtensionless( name ) ) );
|
||||
}
|
||||
typedef ConstMemberCaller1<LoadTexturesByTypeVisitor, const char*, &LoadTexturesByTypeVisitor::insert> InsertCaller;
|
||||
LoadTexturesByTypeVisitor( const char* dirstring, TexTree& texTree ) : m_dirstring( dirstring ), m_texTree( texTree ){}
|
||||
LoadTexturesByTypeVisitor( const char* dirstring, TexTree& texTree ) :
|
||||
m_dirstring( dirstring ), m_texTree( texTree ), m_stringStream( 64 )
|
||||
{}
|
||||
void visit( const char* minor, const _QERPlugImageTable& table ) const {
|
||||
GlobalFileSystem().forEachFile( m_dirstring, minor, InsertCaller( *this ), 99 );
|
||||
}
|
||||
|
|
@ -2236,9 +2239,7 @@ class TextEditor : public QObject
|
|||
QObject::connect( m_textView->document(), &QTextDocument::modificationChanged, [this]( bool modified ){
|
||||
m_button->setEnabled( modified );
|
||||
|
||||
StringOutputStream str( 256 );
|
||||
str << ( modified? "*" : "" ) << m_filename;
|
||||
m_window->setWindowTitle( str.c_str() );
|
||||
m_window->setWindowTitle( StringStream( ( modified? "*" : "" ), m_filename ).c_str() );
|
||||
} );
|
||||
|
||||
QObject::connect( m_button, &QAbstractButton::clicked, [this](){ editor_save(); } );
|
||||
|
|
@ -2387,27 +2388,25 @@ void DoShaderView( const char *shaderFileName, const char *shaderName, bool exte
|
|||
const bool pathEmpty = string_empty( pathRoot );
|
||||
const bool pathIsDir = !pathEmpty && file_is_directory( pathRoot );
|
||||
|
||||
StringOutputStream pathFull( 256 );
|
||||
pathFull << pathRoot << ( pathIsDir? "" : "::" ) << shaderFileName;
|
||||
const auto pathFull = StringStream( pathRoot, ( pathIsDir? "" : "::" ), shaderFileName );
|
||||
|
||||
if( pathEmpty ){
|
||||
globalErrorStream() << "Failed to load shader file " << shaderFileName << "\n";
|
||||
globalErrorStream() << "Failed to load shader file " << shaderFileName << '\n';
|
||||
}
|
||||
else if( external_editor && pathIsDir ){
|
||||
if( g_TextEditor_editorCommand.empty() ){
|
||||
#ifdef WIN32
|
||||
ShellExecute( (HWND)MainFrame_getWindow()->effectiveWinId(), 0, pathFull.c_str(), 0, 0, SW_SHOWNORMAL );
|
||||
#else
|
||||
globalWarningStream() << "Failed to open '" << pathFull.c_str() << "'\nSet Shader Editor Command in preferences\n";
|
||||
globalWarningStream() << "Failed to open '" << pathFull << "'\nSet Shader Editor Command in preferences\n";
|
||||
#endif
|
||||
}
|
||||
else{
|
||||
StringOutputStream command( 256 );
|
||||
command << g_TextEditor_editorCommand << " \"" << pathFull.c_str() << "\"";
|
||||
globalOutputStream() << "Launching: " << command.c_str() << "\n";
|
||||
auto command = StringStream( g_TextEditor_editorCommand, ' ', makeQuoted( pathFull ) );
|
||||
globalOutputStream() << "Launching: " << command << '\n';
|
||||
// note: linux does not return false if the command failed so it will assume success
|
||||
if ( !Q_Exec( 0, const_cast<char*>( command.c_str() ), 0, true, false ) )
|
||||
globalErrorStream() << "Failed to execute " << command.c_str() << "\n";
|
||||
if ( !Q_Exec( 0, command.c_str(), 0, true, false ) )
|
||||
globalErrorStream() << "Failed to execute " << command << '\n';
|
||||
}
|
||||
}
|
||||
else if( ArchiveFile* file = GlobalFileSystem().openFile( shaderFileName ) ){
|
||||
|
|
@ -2417,7 +2416,7 @@ void DoShaderView( const char *shaderFileName, const char *shaderName, bool exte
|
|||
text[size] = 0;
|
||||
file->release();
|
||||
|
||||
g_textEditor.DoGtkTextEditor( text, shaderName, pathFull.c_str(), pathIsDir );
|
||||
g_textEditor.DoGtkTextEditor( text, shaderName, pathFull, pathIsDir );
|
||||
free( text );
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -82,9 +82,7 @@ void process_xlink( const char* filename, const char *menu_name, const char *bas
|
|||
else
|
||||
{
|
||||
// relative URL
|
||||
StringOutputStream full( 256 );
|
||||
full << base_url << reinterpret_cast<const char*>( prop );
|
||||
url = full.c_str();
|
||||
url = StringStream( base_url, reinterpret_cast<const char*>( prop ) );
|
||||
}
|
||||
|
||||
mHelpURLs.push_back( url );
|
||||
|
|
@ -113,18 +111,16 @@ void process_xlink( const char* filename, const char *menu_name, const char *bas
|
|||
}
|
||||
|
||||
void create_game_help_menu( QMenu *menu ){
|
||||
auto filename = StringOutputStream( 256 )( AppPath_get(), "global.xlink" );
|
||||
process_xlink( filename.c_str(), "General", AppPath_get(), menu );
|
||||
|
||||
auto filename = StringStream<256>( AppPath_get(), "global.xlink" );
|
||||
process_xlink( filename, "General", AppPath_get(), menu );
|
||||
#if 1
|
||||
filename( g_pGameDescription->mGameToolsPath, "game.xlink" );
|
||||
process_xlink( filename.c_str(), g_pGameDescription->getRequiredKeyValue( "name" ), g_pGameDescription->mGameToolsPath.c_str(), menu );
|
||||
process_xlink( filename, g_pGameDescription->getRequiredKeyValue( "name" ), g_pGameDescription->mGameToolsPath.c_str(), menu );
|
||||
#else
|
||||
for ( std::list<CGameDescription *>::iterator iGame = g_GamesDialog.mGames.begin(); iGame != g_GamesDialog.mGames.end(); ++iGame )
|
||||
{
|
||||
filename.clear();
|
||||
filename << ( *iGame )->mGameToolsPath.c_str() << "game.xlink";
|
||||
process_xlink( filename.c_str(), ( *iGame )->getRequiredKeyValue( "name" ), ( *iGame )->mGameToolsPath.c_str(), menu );
|
||||
filename( ( *iGame )->mGameToolsPath.c_str(), "game.xlink" );
|
||||
process_xlink( filename, ( *iGame )->getRequiredKeyValue( "name" ), ( *iGame )->mGameToolsPath.c_str(), menu );
|
||||
}
|
||||
#endif
|
||||
}
|
||||
|
|
|
|||
|
|
@ -47,9 +47,7 @@ Image* QERApp_LoadImage( void* environment, const char* name ){
|
|||
}
|
||||
void visit( const char* name, const _QERPlugImageTable& table ) const {
|
||||
if ( m_image == 0 ) {
|
||||
StringOutputStream fullname( 256 );
|
||||
fullname << m_name << '.' << name;
|
||||
ArchiveFile* file = GlobalFileSystem().openFile( fullname.c_str() );
|
||||
ArchiveFile* file = GlobalFileSystem().openFile( StringStream( m_name, '.', name ) );
|
||||
if ( file != 0 ) {
|
||||
m_image = table.loadImage( *file );
|
||||
file->release();
|
||||
|
|
|
|||
108
radiant/main.cpp
108
radiant/main.cpp
|
|
@ -202,17 +202,17 @@ public:
|
|||
LineLimitedTextOutputStream outputStream( getOutputStream(), 24 );
|
||||
write_stack_trace( outputStream );
|
||||
getOutputStream() << "----------------\n";
|
||||
globalErrorStream() << m_buffer.c_str();
|
||||
globalErrorStream() << m_buffer;
|
||||
if ( !m_lock.locked() ) {
|
||||
ScopedLock lock( m_lock );
|
||||
#if defined _DEBUG
|
||||
m_buffer << "Break into the debugger?\n";
|
||||
bool handled = qt_MessageBox( 0, m_buffer.c_str(), "Radiant - Runtime Error", EMessageBoxType::Error, eIDYES | eIDNO ) == eIDNO;
|
||||
bool handled = qt_MessageBox( 0, m_buffer, "Radiant - Runtime Error", EMessageBoxType::Error, eIDYES | eIDNO ) == eIDNO;
|
||||
m_buffer.clear();
|
||||
return handled;
|
||||
#else
|
||||
m_buffer << "Please report this error to the developers\n";
|
||||
qt_MessageBox( 0, m_buffer.c_str(), "Radiant - Runtime Error", EMessageBoxType::Error );
|
||||
qt_MessageBox( 0, m_buffer, "Radiant - Runtime Error", EMessageBoxType::Error );
|
||||
m_buffer.clear();
|
||||
#endif
|
||||
}
|
||||
|
|
@ -236,11 +236,7 @@ void paths_init(){
|
|||
|
||||
Q_mkdir( home );
|
||||
|
||||
{
|
||||
StringOutputStream path( 256 );
|
||||
path << home << "1." << RADIANT_MAJOR_VERSION "." << RADIANT_MINOR_VERSION << '/';
|
||||
g_strSettingsPath = path.c_str();
|
||||
}
|
||||
g_strSettingsPath = StringStream( home, "1." RADIANT_MAJOR_VERSION "." RADIANT_MINOR_VERSION "/" );
|
||||
|
||||
Q_mkdir( g_strSettingsPath.c_str() );
|
||||
|
||||
|
|
@ -253,11 +249,7 @@ void paths_init(){
|
|||
// NOTE: this is not very easy for debugging
|
||||
// maybe add options to lookup in several places?
|
||||
// (for now I had to create symlinks)
|
||||
{
|
||||
StringOutputStream path( 256 );
|
||||
path << g_strAppPath << "bitmaps/";
|
||||
BitmapsPath_set( path.c_str() );
|
||||
}
|
||||
BitmapsPath_set( StringStream( g_strAppPath, "bitmaps/" ) );
|
||||
|
||||
// we will set this right after the game selection is done
|
||||
g_strGameToolsPath = g_strAppPath;
|
||||
|
|
@ -293,22 +285,17 @@ bool check_version(){
|
|||
// locate and open RADIANT_MAJOR and RADIANT_MINOR
|
||||
bool bVerIsGood = true;
|
||||
{
|
||||
StringOutputStream ver_file_name( 256 );
|
||||
ver_file_name << AppPath_get() << "RADIANT_MAJOR";
|
||||
bVerIsGood = check_version_file( ver_file_name.c_str(), RADIANT_MAJOR_VERSION );
|
||||
bVerIsGood = check_version_file( StringStream( AppPath_get(), "RADIANT_MAJOR" ), RADIANT_MAJOR_VERSION );
|
||||
}
|
||||
{
|
||||
StringOutputStream ver_file_name( 256 );
|
||||
ver_file_name << AppPath_get() << "RADIANT_MINOR";
|
||||
bVerIsGood = check_version_file( ver_file_name.c_str(), RADIANT_MINOR_VERSION );
|
||||
bVerIsGood = check_version_file( StringStream( AppPath_get(), "RADIANT_MINOR" ), RADIANT_MINOR_VERSION );
|
||||
}
|
||||
|
||||
if ( !bVerIsGood ) {
|
||||
StringOutputStream msg( 256 );
|
||||
msg << "This editor binary (" RADIANT_VERSION ") doesn't match what the latest setup has configured in this directory\n"
|
||||
"Make sure you run the right/latest editor binary you installed\n"
|
||||
<< AppPath_get();
|
||||
qt_MessageBox( 0, msg.c_str(), "Radiant" );
|
||||
const auto msg = StringStream(
|
||||
"This editor binary (" RADIANT_VERSION ") doesn't match what the latest setup has configured in this directory\n"
|
||||
"Make sure you run the right/latest editor binary you installed\n", AppPath_get() );
|
||||
qt_MessageBox( 0, msg, "Radiant" );
|
||||
}
|
||||
return bVerIsGood;
|
||||
#else
|
||||
|
|
@ -324,36 +311,30 @@ void create_global_pid(){
|
|||
this is the first part of the two step .pid system
|
||||
http://zerowing.idsoftware.com/bugzilla/show_bug.cgi?id=297
|
||||
*/
|
||||
StringOutputStream g_pidFile( 256 ); ///< the global .pid file (only for global part of the startup)
|
||||
|
||||
g_pidFile << SettingsPath_get() << "radiant.pid";
|
||||
const auto g_pidFile = StringStream( SettingsPath_get(), "radiant.pid" ); ///< the global .pid file (only for global part of the startup)
|
||||
|
||||
FILE *pid;
|
||||
pid = fopen( g_pidFile.c_str(), "r" );
|
||||
pid = fopen( g_pidFile, "r" );
|
||||
if ( pid != 0 ) {
|
||||
fclose( pid );
|
||||
|
||||
if ( remove( g_pidFile.c_str() ) == -1 ) {
|
||||
StringOutputStream msg( 256 );
|
||||
msg << "WARNING: Could not delete " << g_pidFile.c_str();
|
||||
qt_MessageBox( 0, msg.c_str(), "Radiant", EMessageBoxType::Error );
|
||||
if ( remove( g_pidFile ) == -1 ) {
|
||||
qt_MessageBox( 0, StringStream( "WARNING: Could not delete ", g_pidFile ), "Radiant", EMessageBoxType::Error );
|
||||
}
|
||||
|
||||
// in debug, never prompt to clean registry, turn console logging auto after a failed start
|
||||
#if !defined( _DEBUG )
|
||||
StringOutputStream msg( 256 );
|
||||
msg << "Radiant failed to start properly the last time it was run.\n"
|
||||
"The failure may be related to current global preferences.\n"
|
||||
"Do you want to reset global preferences to defaults?";
|
||||
const char msg[] = "Radiant failed to start properly the last time it was run.\n"
|
||||
"The failure may be related to current global preferences.\n"
|
||||
"Do you want to reset global preferences to defaults?";
|
||||
|
||||
if ( qt_MessageBox( 0, msg.c_str(), "Radiant - Startup Failure", EMessageBoxType::Question ) == eIDYES ) {
|
||||
if ( qt_MessageBox( 0, msg, "Radiant - Startup Failure", EMessageBoxType::Question ) == eIDYES ) {
|
||||
g_GamesDialog.Reset();
|
||||
}
|
||||
|
||||
msg.clear();
|
||||
msg << "Logging console output to " << SettingsPath_get() << "radiant.log\nRefer to the log if Radiant fails to start again.";
|
||||
|
||||
qt_MessageBox( 0, msg.c_str(), "Radiant - Console Log" );
|
||||
const auto msg2 = StringStream( "Logging console output to ", SettingsPath_get(),
|
||||
"radiant.log\nRefer to the log if Radiant fails to start again." );
|
||||
qt_MessageBox( 0, msg2, "Radiant - Console Log" );
|
||||
#endif
|
||||
|
||||
// set without saving, the class is not in a coherent state yet
|
||||
|
|
@ -363,21 +344,17 @@ void create_global_pid(){
|
|||
}
|
||||
|
||||
// create a primary .pid for global init run
|
||||
pid = fopen( g_pidFile.c_str(), "w" );
|
||||
pid = fopen( g_pidFile, "w" );
|
||||
if ( pid ) {
|
||||
fclose( pid );
|
||||
}
|
||||
}
|
||||
|
||||
void remove_global_pid(){
|
||||
StringOutputStream g_pidFile( 256 );
|
||||
g_pidFile << SettingsPath_get() << "radiant.pid";
|
||||
|
||||
const auto g_pidFile = StringStream( SettingsPath_get(), "radiant.pid" );
|
||||
// close the primary
|
||||
if ( remove( g_pidFile.c_str() ) == -1 ) {
|
||||
StringOutputStream msg( 256 );
|
||||
msg << "WARNING: Could not delete " << g_pidFile.c_str();
|
||||
qt_MessageBox( 0, msg.c_str(), "Radiant", EMessageBoxType::Error );
|
||||
if ( remove( g_pidFile ) == -1 ) {
|
||||
qt_MessageBox( 0, StringStream( "WARNING: Could not delete ", g_pidFile ), "Radiant", EMessageBoxType::Error );
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -386,33 +363,28 @@ void remove_global_pid(){
|
|||
http://zerowing.idsoftware.com/bugzilla/show_bug.cgi?id=297
|
||||
*/
|
||||
void create_local_pid(){
|
||||
StringOutputStream g_pidGameFile( 256 ); ///< the game-specific .pid file
|
||||
g_pidGameFile << SettingsPath_get() << g_pGameDescription->mGameFile << "/radiant-game.pid";
|
||||
const auto g_pidGameFile = StringStream( SettingsPath_get(), g_pGameDescription->mGameFile, "/radiant-game.pid" ); ///< the game-specific .pid file
|
||||
|
||||
FILE *pid = fopen( g_pidGameFile.c_str(), "r" );
|
||||
FILE *pid = fopen( g_pidGameFile, "r" );
|
||||
if ( pid != 0 ) {
|
||||
fclose( pid );
|
||||
if ( remove( g_pidGameFile.c_str() ) == -1 ) {
|
||||
StringOutputStream msg;
|
||||
msg << "WARNING: Could not delete " << g_pidGameFile.c_str();
|
||||
qt_MessageBox( 0, msg.c_str(), "Radiant", EMessageBoxType::Error );
|
||||
if ( remove( g_pidGameFile ) == -1 ) {
|
||||
qt_MessageBox( 0, StringStream( "WARNING: Could not delete ", g_pidGameFile ), "Radiant", EMessageBoxType::Error );
|
||||
}
|
||||
|
||||
// in debug, never prompt to clean registry, turn console logging auto after a failed start
|
||||
#if !defined( _DEBUG )
|
||||
StringOutputStream msg;
|
||||
msg << "Radiant failed to start properly the last time it was run.\n"
|
||||
"The failure may be caused by current preferences.\n"
|
||||
"Do you want to reset all preferences to defaults?";
|
||||
const char msg[] = "Radiant failed to start properly the last time it was run.\n"
|
||||
"The failure may be caused by current preferences.\n"
|
||||
"Do you want to reset all preferences to defaults?";
|
||||
|
||||
if ( qt_MessageBox( 0, msg.c_str(), "Radiant - Startup Failure", EMessageBoxType::Question ) == eIDYES ) {
|
||||
if ( qt_MessageBox( 0, msg, "Radiant - Startup Failure", EMessageBoxType::Question ) == eIDYES ) {
|
||||
Preferences_Reset();
|
||||
}
|
||||
|
||||
msg.clear();
|
||||
msg << "Logging console output to " << SettingsPath_get() << "radiant.log\nRefer to the log if Radiant fails to start again.";
|
||||
|
||||
qt_MessageBox( 0, msg.c_str(), "Radiant - Console Log" );
|
||||
const auto msg2 = StringStream( "Logging console output to ", SettingsPath_get(),
|
||||
"radiant.log\nRefer to the log if Radiant fails to start again." );
|
||||
qt_MessageBox( 0, msg2, "Radiant - Console Log" );
|
||||
#endif
|
||||
|
||||
// force console logging on! (will go in prefs too)
|
||||
|
|
@ -422,7 +394,7 @@ void create_local_pid(){
|
|||
else
|
||||
{
|
||||
// create one, will remove right after entering message loop
|
||||
pid = fopen( g_pidGameFile.c_str(), "w" );
|
||||
pid = fopen( g_pidGameFile, "w" );
|
||||
if ( pid ) {
|
||||
fclose( pid );
|
||||
}
|
||||
|
|
@ -435,9 +407,7 @@ void create_local_pid(){
|
|||
http://zerowing.idsoftware.com/bugzilla/show_bug.cgi?id=297
|
||||
*/
|
||||
void remove_local_pid(){
|
||||
StringOutputStream g_pidGameFile( 256 );
|
||||
g_pidGameFile << SettingsPath_get() << g_pGameDescription->mGameFile << "/radiant-game.pid";
|
||||
remove( g_pidGameFile.c_str() );
|
||||
remove( StringStream( SettingsPath_get(), g_pGameDescription->mGameFile, "/radiant-game.pid" ) );
|
||||
}
|
||||
|
||||
|
||||
|
|
|
|||
|
|
@ -175,14 +175,12 @@ void HomePaths_Realise(){
|
|||
StringOutputStream path( 256 );
|
||||
|
||||
#if defined( __APPLE__ )
|
||||
path.clear();
|
||||
path << DirectoryCleaned( g_get_home_dir() ) << "Library/Application Support" << ( prefix + 1 ) << "/";
|
||||
if ( file_is_directory( path.c_str() ) ) {
|
||||
g_qeglobals.m_userEnginePath = path.c_str();
|
||||
path( DirectoryCleaned( g_get_home_dir() ), "Library/Application Support", ( prefix + 1 ), '/' );
|
||||
if ( file_is_directory( path ) ) {
|
||||
g_qeglobals.m_userEnginePath = path;
|
||||
break;
|
||||
}
|
||||
path.clear();
|
||||
path << DirectoryCleaned( g_get_home_dir() ) << prefix << "/";
|
||||
path( DirectoryCleaned( g_get_home_dir() ), prefix, '/' );
|
||||
#endif
|
||||
|
||||
#if defined( WIN32 )
|
||||
|
|
@ -200,10 +198,9 @@ void HomePaths_Realise(){
|
|||
memset( mydocsdir, 0, sizeof( mydocsdir ) );
|
||||
wcstombs( mydocsdir, mydocsdirw, sizeof( mydocsdir ) - 1 );
|
||||
CoTaskMemFree( mydocsdirw );
|
||||
path.clear();
|
||||
path << DirectoryCleaned( mydocsdir ) << ( prefix + 1 ) << "/";
|
||||
if ( file_is_directory( path.c_str() ) ) {
|
||||
g_qeglobals.m_userEnginePath = path.c_str();
|
||||
path( DirectoryCleaned( mydocsdir ), ( prefix + 1 ), '/' );
|
||||
if ( file_is_directory( path ) ) {
|
||||
g_qeglobals.m_userEnginePath = path;
|
||||
CoUninitialize();
|
||||
FreeLibrary( shfolder );
|
||||
break;
|
||||
|
|
@ -214,20 +211,18 @@ void HomePaths_Realise(){
|
|||
FreeLibrary( shfolder );
|
||||
}
|
||||
if ( SUCCEEDED( SHGetFolderPath( NULL, CSIDL_PERSONAL, NULL, 0, mydocsdir ) ) ) {
|
||||
path.clear();
|
||||
path << DirectoryCleaned( mydocsdir ) << "My Games/" << ( prefix + 1 ) << "/";
|
||||
path( DirectoryCleaned( mydocsdir ), "My Games/", ( prefix + 1 ), '/' );
|
||||
// win32: only add it if it already exists
|
||||
if ( file_is_directory( path.c_str() ) ) {
|
||||
g_qeglobals.m_userEnginePath = path.c_str();
|
||||
if ( file_is_directory( path ) ) {
|
||||
g_qeglobals.m_userEnginePath = path;
|
||||
break;
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
||||
#if defined( POSIX )
|
||||
path.clear();
|
||||
path << DirectoryCleaned( g_get_home_dir() ) << prefix << "/";
|
||||
g_qeglobals.m_userEnginePath = path.c_str();
|
||||
path( DirectoryCleaned( g_get_home_dir() ), prefix, '/' );
|
||||
g_qeglobals.m_userEnginePath = path;
|
||||
break;
|
||||
#endif
|
||||
}
|
||||
|
|
@ -238,11 +233,7 @@ void HomePaths_Realise(){
|
|||
|
||||
Q_mkdir( g_qeglobals.m_userEnginePath.c_str() );
|
||||
|
||||
{
|
||||
StringOutputStream path( 256 );
|
||||
path << g_qeglobals.m_userEnginePath << gamename_get() << '/';
|
||||
g_qeglobals.m_userGamePath = path.c_str();
|
||||
}
|
||||
g_qeglobals.m_userGamePath = StringStream( g_qeglobals.m_userEnginePath, gamename_get(), '/' );
|
||||
ASSERT_MESSAGE( !g_qeglobals.m_userGamePath.empty(), "HomePaths_Realise: user-game-path is empty" );
|
||||
Q_mkdir( g_qeglobals.m_userGamePath.c_str() );
|
||||
}
|
||||
|
|
@ -330,8 +321,8 @@ static void installDevFiles(){
|
|||
}
|
||||
|
||||
void setEnginePath( CopiedString& self, const char* value ){
|
||||
const auto buffer = StringOutputStream( 256 )( DirectoryCleaned( value ) );
|
||||
if ( !path_equal( buffer.c_str(), self.c_str() ) ) {
|
||||
const auto buffer = StringStream( DirectoryCleaned( value ) );
|
||||
if ( !path_equal( buffer, self.c_str() ) ) {
|
||||
#if 0
|
||||
while ( !ConfirmModified( "Paths Changed" ) )
|
||||
{
|
||||
|
|
@ -350,7 +341,7 @@ void setEnginePath( CopiedString& self, const char* value ){
|
|||
|
||||
EnginePath_Unrealise();
|
||||
|
||||
self = buffer.c_str();
|
||||
self = buffer;
|
||||
|
||||
installDevFiles();
|
||||
|
||||
|
|
@ -381,9 +372,7 @@ const char* AppPath_get(){
|
|||
const char* LocalRcPath_get(){
|
||||
static CopiedString rc_path;
|
||||
if ( rc_path.empty() ) {
|
||||
StringOutputStream stream( 256 );
|
||||
stream << GlobalRadiant().getSettingsPath() << g_pGameDescription->mGameFile << "/";
|
||||
rc_path = stream.c_str();
|
||||
rc_path = StringStream( GlobalRadiant().getSettingsPath(), g_pGameDescription->mGameFile, '/' );
|
||||
}
|
||||
return rc_path.c_str();
|
||||
}
|
||||
|
|
@ -459,8 +448,7 @@ public:
|
|||
#else
|
||||
#error "unsupported platform"
|
||||
#endif
|
||||
StringOutputStream text( 256 );
|
||||
text << "Select directory, where game executable sits (typically \"" << engine << "\")\n";
|
||||
const auto text = StringStream( "Select directory, where game executable sits (typically ", makeQuoted( engine ), ")\n" );
|
||||
grid->addWidget( new QLabel( text.c_str() ), 0, 0, 1, 2 );
|
||||
}
|
||||
{
|
||||
|
|
@ -578,16 +566,10 @@ void Radiant_loadModules( const char* path ){
|
|||
}
|
||||
|
||||
void Radiant_loadModulesFromRoot( const char* directory ){
|
||||
{
|
||||
StringOutputStream path( 256 );
|
||||
path << directory << g_pluginsDir;
|
||||
Radiant_loadModules( path.c_str() );
|
||||
}
|
||||
Radiant_loadModules( StringStream( directory, g_pluginsDir ) );
|
||||
|
||||
if ( !string_equal( g_pluginsDir, g_modulesDir ) ) {
|
||||
StringOutputStream path( 256 );
|
||||
path << directory << g_modulesDir;
|
||||
Radiant_loadModules( path.c_str() );
|
||||
Radiant_loadModules( StringStream( directory, g_modulesDir ) );
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -672,11 +654,10 @@ extern char **environ;
|
|||
#endif
|
||||
void Radiant_Restart(){
|
||||
if( ConfirmModified( "Restart Radiant" ) ){
|
||||
StringOutputStream mapname;
|
||||
mapname << "\"" << Map_Name( g_map ) << "\"";
|
||||
const auto mapname = StringStream( makeQuoted( Map_Name( g_map ) ) );
|
||||
|
||||
char *argv[] = { string_clone( environment_get_app_filepath() ),
|
||||
Map_Unnamed( g_map )? NULL : string_clone( mapname.c_str() ),
|
||||
Map_Unnamed( g_map )? NULL : string_clone( mapname ),
|
||||
NULL };
|
||||
#ifdef WIN32
|
||||
const int status = !_spawnv( P_NOWAIT, argv[0], argv );
|
||||
|
|
@ -720,16 +701,14 @@ void OpenUpdateURL(){
|
|||
#endif
|
||||
URL << "&Version_dlup=" RADIANT_VERSION;
|
||||
g_GamesDialog.AddPacksURL( URL );
|
||||
OpenURL( URL.c_str() );
|
||||
OpenURL( URL );
|
||||
#endif
|
||||
}
|
||||
|
||||
// open the Q3Rad manual
|
||||
void OpenHelpURL(){
|
||||
// at least on win32, AppPath + "docs/index.html"
|
||||
StringOutputStream help( 256 );
|
||||
help << AppPath_get() << "docs/index.html";
|
||||
OpenURL( help.c_str() );
|
||||
OpenURL( StringStream( AppPath_get(), "docs/index.html" ) );
|
||||
}
|
||||
|
||||
void OpenBugReportURL(){
|
||||
|
|
@ -1641,16 +1620,14 @@ void hide_splash(){
|
|||
|
||||
|
||||
void user_shortcuts_init(){
|
||||
StringOutputStream path( 256 );
|
||||
path << SettingsPath_get() << g_pGameDescription->mGameFile << '/';
|
||||
LoadCommandMap( path.c_str() );
|
||||
SaveCommandMap( path.c_str() );
|
||||
const auto path = StringStream( SettingsPath_get(), g_pGameDescription->mGameFile, '/' );
|
||||
LoadCommandMap( path );
|
||||
SaveCommandMap( path );
|
||||
}
|
||||
|
||||
void user_shortcuts_save(){
|
||||
StringOutputStream path( 256 );
|
||||
path << SettingsPath_get() << g_pGameDescription->mGameFile << '/';
|
||||
SaveCommandMap( path.c_str() );
|
||||
const auto path = StringStream( SettingsPath_get(), g_pGameDescription->mGameFile, '/' );
|
||||
SaveCommandMap( path );
|
||||
}
|
||||
|
||||
|
||||
|
|
@ -1703,9 +1680,7 @@ void MainFrame::Create(){
|
|||
g_page_textures = GroupDialog_addPage( "Textures", TextureBrowser_constructWindow( GroupDialog_getWindow() ), TextureBrowserExportTitleCaller() );
|
||||
}
|
||||
|
||||
{
|
||||
g_page_models = GroupDialog_addPage( "Models", ModelBrowser_constructWindow( GroupDialog_getWindow() ), RawStringExportCaller( "Models" ) );
|
||||
}
|
||||
g_page_models = GroupDialog_addPage( "Models", ModelBrowser_constructWindow( GroupDialog_getWindow() ), RawStringExportCaller( "Models" ) );
|
||||
|
||||
window->show();
|
||||
|
||||
|
|
@ -1963,7 +1938,7 @@ void MainFrame::SetGridStatus(){
|
|||
<< " F:" << GridStatus_getTexdefTypeIdLabel()
|
||||
<< " C:" << GridStatus_getFarClipDistance()
|
||||
<< " L:" << lock;
|
||||
SetStatusText( c_status_grid, status.c_str() );
|
||||
SetStatusText( c_status_grid, status );
|
||||
}
|
||||
|
||||
void GridStatus_changed(){
|
||||
|
|
@ -1993,10 +1968,10 @@ void OpenGLFont_select(){
|
|||
|
||||
void GlobalGL_sharedContextCreated(){
|
||||
// report OpenGL information
|
||||
globalOutputStream() << "GL_VENDOR: " << reinterpret_cast<const char*>( gl().glGetString( GL_VENDOR ) ) << "\n";
|
||||
globalOutputStream() << "GL_RENDERER: " << reinterpret_cast<const char*>( gl().glGetString( GL_RENDERER ) ) << "\n";
|
||||
globalOutputStream() << "GL_VERSION: " << reinterpret_cast<const char*>( gl().glGetString( GL_VERSION ) ) << "\n";
|
||||
globalOutputStream() << "GL_EXTENSIONS: " << reinterpret_cast<const char*>( gl().glGetString( GL_EXTENSIONS ) ) << "\n";
|
||||
globalOutputStream() << "GL_VENDOR: " << reinterpret_cast<const char*>( gl().glGetString( GL_VENDOR ) ) << '\n';
|
||||
globalOutputStream() << "GL_RENDERER: " << reinterpret_cast<const char*>( gl().glGetString( GL_RENDERER ) ) << '\n';
|
||||
globalOutputStream() << "GL_VERSION: " << reinterpret_cast<const char*>( gl().glGetString( GL_VERSION ) ) << '\n';
|
||||
globalOutputStream() << "GL_EXTENSIONS: " << reinterpret_cast<const char*>( gl().glGetString( GL_EXTENSIONS ) ) << '\n';
|
||||
|
||||
QGL_sharedContextCreated( GlobalOpenGL() );
|
||||
|
||||
|
|
@ -2098,7 +2073,7 @@ void MainFrame_Construct(){
|
|||
GlobalPreferenceSystem().registerPreference( "OpenGLFontSize", IntImportStringCaller( g_OpenGLFontSize ), IntExportStringCaller( g_OpenGLFontSize ) );
|
||||
|
||||
for( size_t i = 0; i < g_strExtraResourcePaths.size(); ++i )
|
||||
GlobalPreferenceSystem().registerPreference( StringOutputStream( 32 )( "ExtraResourcePath", i ),
|
||||
GlobalPreferenceSystem().registerPreference( StringStream<32>( "ExtraResourcePath", i ),
|
||||
CopiedStringImportStringCaller( g_strExtraResourcePaths[i] ), CopiedStringExportStringCaller( g_strExtraResourcePaths[i] ) );
|
||||
|
||||
GlobalPreferenceSystem().registerPreference( "EnginePath", CopiedStringImportStringCaller( g_strEnginePath ), CopiedStringExportStringCaller( g_strEnginePath ) );
|
||||
|
|
@ -2117,7 +2092,7 @@ void MainFrame_Construct(){
|
|||
#error "unknown platform"
|
||||
#endif
|
||||
;
|
||||
g_strEnginePath = StringOutputStream( 256 )( DirectoryCleaned( g_pGameDescription->getRequiredKeyValue( ENGINEPATH_ATTRIBUTE ) ) ).c_str();
|
||||
g_strEnginePath = StringStream( DirectoryCleaned( g_pGameDescription->getRequiredKeyValue( ENGINEPATH_ATTRIBUTE ) ) );
|
||||
}
|
||||
|
||||
|
||||
|
|
|
|||
|
|
@ -85,13 +85,13 @@ class NameObserver
|
|||
|
||||
void construct(){
|
||||
if ( !empty() ) {
|
||||
//globalOutputStream() << "construct " << makeQuoted(c_str()) << "\n";
|
||||
//globalOutputStream() << "construct " << makeQuoted(c_str()) << '\n';
|
||||
m_names.insert( name_read( c_str() ) );
|
||||
}
|
||||
}
|
||||
void destroy(){
|
||||
if ( !empty() ) {
|
||||
//globalOutputStream() << "destroy " << makeQuoted(c_str()) << "\n";
|
||||
//globalOutputStream() << "destroy " << makeQuoted(c_str()) << '\n';
|
||||
m_names.erase( name_read( c_str() ) );
|
||||
}
|
||||
}
|
||||
|
|
@ -133,12 +133,12 @@ public:
|
|||
std::pair<Names::iterator, bool> result = m_names.insert( Names::value_type( setName, m_uniqueNames ) );
|
||||
ASSERT_MESSAGE( result.second, "cannot attach name" );
|
||||
attachObserver( NameObserver::NameChangedCaller( ( *result.first ).second ) );
|
||||
//globalOutputStream() << "attach: " << reinterpret_cast<const unsigned int&>(setName) << "\n";
|
||||
//globalOutputStream() << "attach: " << reinterpret_cast<const unsigned int&>(setName) << '\n';
|
||||
}
|
||||
void detach( const NameCallback& setName, const NameCallbackCallback& detachObserver ){
|
||||
Names::iterator i = m_names.find( setName );
|
||||
ASSERT_MESSAGE( i != m_names.end(), "cannot detach name" );
|
||||
//globalOutputStream() << "detach: " << reinterpret_cast<const unsigned int&>(setName) << "\n";
|
||||
//globalOutputStream() << "detach: " << reinterpret_cast<const unsigned int&>(setName) << '\n';
|
||||
detachObserver( NameObserver::NameChangedCaller( ( *i ).second ) );
|
||||
m_names.erase( i );
|
||||
}
|
||||
|
|
@ -169,7 +169,7 @@ public:
|
|||
char buffer[1024];
|
||||
name_write( buffer, uniqueName );
|
||||
|
||||
//globalOutputStream() << "renaming " << makeQuoted(name.c_str()) << " to " << makeQuoted(buffer) << "\n";
|
||||
//globalOutputStream() << "renaming " << makeQuoted(name.c_str()) << " to " << makeQuoted(buffer) << '\n';
|
||||
|
||||
for ( const NameCallback& nameCallback : setNameCallbacks )
|
||||
{
|
||||
|
|
@ -931,7 +931,7 @@ void DoMapInfo(){
|
|||
int n_groupents_ingame = 0;
|
||||
Scene_CountStuff( n_ents_ingame, n_groupents, n_groupents_ingame );
|
||||
|
||||
StringOutputStream str;
|
||||
StringOutputStream str( 32 );
|
||||
w_brushes->setText( str( "<b><i>", g_brushCount.get(), "</b></i>" ).c_str() );
|
||||
w_patches->setText( str( "<b><i>", g_patchCount.get(), "</b></i>" ).c_str() );
|
||||
w_ents->setText( str( "<b><i>", g_entityCount.get(), "</b></i>" ).c_str() );
|
||||
|
|
@ -964,7 +964,7 @@ public:
|
|||
*/
|
||||
|
||||
void Map_LoadFile( const char *filename ){
|
||||
globalOutputStream() << "Loading map from " << filename << "\n";
|
||||
globalOutputStream() << "Loading map from " << filename << '\n';
|
||||
ScopeDisableScreenUpdates disableScreenUpdates( "Processing...", "Loading Map" );
|
||||
|
||||
{
|
||||
|
|
@ -977,7 +977,7 @@ void Map_LoadFile( const char *filename ){
|
|||
}
|
||||
|
||||
globalOutputStream() << "--- LoadMapFile ---\n";
|
||||
globalOutputStream() << g_map.m_name << "\n";
|
||||
globalOutputStream() << g_map.m_name << '\n';
|
||||
|
||||
globalOutputStream() << g_brushCount.get() + g_patchCount.get() << " primitives\n";
|
||||
globalOutputStream() << g_entityCount.get() << " entities\n";
|
||||
|
|
@ -1538,12 +1538,12 @@ tryDecompile:
|
|||
const char *type = GlobalRadiant().getGameDescriptionKeyValue( "q3map2_type" );
|
||||
if ( path_extension_is( filename, "bsp" ) || path_extension_is( filename, "map" ) ) {
|
||||
StringOutputStream str( 256 );
|
||||
str << AppPath_get() << "q3map2." << RADIANT_EXECUTABLE;
|
||||
str << " -v -game " << ( ( type && *type ) ? type : "quake3" );
|
||||
str << " -fs_basepath " << makeQuoted( EnginePath_get() );
|
||||
str << " -fs_homepath " << makeQuoted( g_qeglobals.m_userEnginePath.c_str() );
|
||||
str << " -fs_game " << gamename_get();
|
||||
str << " -convert -format " << ( BrushType_getTexdefType( GlobalBrushCreator().getFormat() ) == TEXDEFTYPEID_QUAKE ? "map" : "map_bp" );
|
||||
str << AppPath_get() << "q3map2." << RADIANT_EXECUTABLE
|
||||
<< " -v -game " << ( ( type && *type ) ? type : "quake3" )
|
||||
<< " -fs_basepath " << makeQuoted( EnginePath_get() )
|
||||
<< " -fs_homepath " << makeQuoted( g_qeglobals.m_userEnginePath )
|
||||
<< " -fs_game " << gamename_get()
|
||||
<< " -convert -format " << ( BrushType_getTexdefType( GlobalBrushCreator().getFormat() ) == TEXDEFTYPEID_QUAKE ? "map" : "map_bp" );
|
||||
if ( path_extension_is( filename, "map" ) ) {
|
||||
str << " -readmap ";
|
||||
}
|
||||
|
|
@ -1927,9 +1927,9 @@ public:
|
|||
|
||||
void Scene_FindEntityBrush( std::size_t entity, std::size_t brush, scene::Path& path ){
|
||||
path.push( makeReference( GlobalSceneGraph().root() ) );
|
||||
{
|
||||
Node_getTraversable( path.top() )->traverse( EntityFindByIndexWalker( entity, path ) );
|
||||
}
|
||||
|
||||
Node_getTraversable( path.top() )->traverse( EntityFindByIndexWalker( entity, path ) );
|
||||
|
||||
if ( path.size() == 2 ) {
|
||||
scene::Traversable* traversable = Node_getTraversable( path.top() );
|
||||
if ( traversable != 0 ) {
|
||||
|
|
@ -2112,8 +2112,7 @@ void map_autocaulk_selected(){
|
|||
|
||||
ScopeDisableScreenUpdates disableScreenUpdates( "processing", "autocaulk" );
|
||||
|
||||
StringOutputStream filename( 256 );
|
||||
filename << PathExtensionless( g_map.m_name.c_str() ) << "_ac.map";
|
||||
auto filename = StringStream( PathExtensionless( g_map.m_name.c_str() ), "_ac.map" );
|
||||
|
||||
{ // write .map
|
||||
const Vector3 spawn( Camera_getOrigin( *g_pParentWnd->GetCamWnd() ) );
|
||||
|
|
@ -2127,9 +2126,9 @@ void map_autocaulk_selected(){
|
|||
return;
|
||||
}
|
||||
|
||||
TextFileOutputStream file( filename.c_str() );
|
||||
TextFileOutputStream file( filename );
|
||||
if ( file.failed() ) {
|
||||
globalErrorStream() << "writing " << filename.c_str() << " failure\n";
|
||||
globalErrorStream() << "writing " << filename << " failure\n";
|
||||
return;
|
||||
}
|
||||
|
||||
|
|
@ -2168,10 +2167,10 @@ void map_autocaulk_selected(){
|
|||
// spawn
|
||||
file << "{\n"
|
||||
"\"classname\" \"info_player_start\"\n"
|
||||
"\"origin\" \"" << spawn[0] << " " << spawn[1] << " " << spawn[2] << "\"\n"
|
||||
"\"origin\" \"" << spawn[0] << ' ' << spawn[1] << ' ' << spawn[2] << "\"\n"
|
||||
"}\n";
|
||||
// point entities
|
||||
const MapFormat& format = MapFormat_forFile( filename.c_str() );
|
||||
const MapFormat& format = MapFormat_forFile( filename );
|
||||
auto traverse_selected_point_entities = []( scene::Node& root, const scene::Traversable::Walker& walker ){
|
||||
scene::Traversable* traversable = Node_getTraversable( root );
|
||||
if ( traversable != 0 ) {
|
||||
|
|
@ -2216,7 +2215,7 @@ void map_autocaulk_selected(){
|
|||
<< " -fs_homepath " << makeQuoted( g_qeglobals.m_userEnginePath )
|
||||
<< " -fs_game " << gamename_get()
|
||||
<< " -autocaulk -fulldetail "
|
||||
<< makeQuoted( filename.c_str() );
|
||||
<< makeQuoted( filename );
|
||||
// run
|
||||
Q_Exec( NULL, str.c_str(), NULL, false, true );
|
||||
}
|
||||
|
|
@ -2224,12 +2223,11 @@ void map_autocaulk_selected(){
|
|||
typedef std::map<std::size_t, CopiedString> CaulkMap;
|
||||
CaulkMap map;
|
||||
{ // load
|
||||
filename.clear();
|
||||
filename << PathExtensionless( g_map.m_name.c_str() ) << "_ac.caulk";
|
||||
filename( PathExtensionless( g_map.m_name.c_str() ), "_ac.caulk" );
|
||||
|
||||
TextFileInputStream file( filename.c_str() );
|
||||
TextFileInputStream file( filename );
|
||||
if( file.failed() ){
|
||||
globalErrorStream() << "reading " << filename.c_str() << " failure\n";
|
||||
globalErrorStream() << "reading " << filename << " failure\n";
|
||||
return;
|
||||
}
|
||||
|
||||
|
|
@ -2315,9 +2313,8 @@ void map_autocaulk_selected(){
|
|||
CaulkBrushesWalker caulkBrushesWalker( map );
|
||||
GlobalUndoSystem().start();
|
||||
Map_Traverse_Selected( GlobalSceneGraph().root(), caulkBrushesWalker );
|
||||
StringOutputStream str( 32 );
|
||||
str << "AutoCaulk " << caulkBrushesWalker.m_caulkedCount << " faces";
|
||||
GlobalUndoSystem().finish( str.c_str() );
|
||||
const auto str = StringStream<32>( "AutoCaulk ", caulkBrushesWalker.m_caulkedCount, " faces" );
|
||||
GlobalUndoSystem().finish( str );
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -2365,10 +2362,8 @@ public:
|
|||
void realise(){
|
||||
if ( --m_unrealised == 0 ) {
|
||||
ASSERT_MESSAGE( !g_qeglobals.m_userGamePath.empty(), "maps_directory: user-game-path is empty" );
|
||||
StringOutputStream buffer( 256 );
|
||||
buffer << g_qeglobals.m_userGamePath << "maps/";
|
||||
Q_mkdir( buffer.c_str() );
|
||||
g_mapsPath = buffer.c_str();
|
||||
g_mapsPath = StringStream( g_qeglobals.m_userGamePath, "maps/" );
|
||||
Q_mkdir( g_mapsPath.c_str() );
|
||||
}
|
||||
}
|
||||
void unrealise(){
|
||||
|
|
|
|||
|
|
@ -1028,9 +1028,8 @@ protected:
|
|||
GlobalSelectionSystem().setSelectedAll( false );
|
||||
Instance_setSelected( instance, true );
|
||||
|
||||
StringOutputStream sstream( 128 );
|
||||
sstream << m_modBro.m_currentFolderPath << std::next( m_modBro.m_currentFolder->m_files.begin(), m_modBro.m_currentModelId )->c_str();
|
||||
Node_getEntity( node )->setKeyValue( entityClass->miscmodel_key(), sstream.c_str() );
|
||||
const auto sstream = StringStream<128>( m_modBro.m_currentFolderPath, std::next( m_modBro.m_currentFolder->m_files.begin(), m_modBro.m_currentModelId )->c_str() );
|
||||
Node_getEntity( node )->setKeyValue( entityClass->miscmodel_key(), sstream );
|
||||
}
|
||||
}
|
||||
void mouseReleaseEvent( QMouseEvent *event ) override {
|
||||
|
|
@ -1039,8 +1038,7 @@ protected:
|
|||
m_modBro.tracking_MouseUp();
|
||||
}
|
||||
if ( release == MousePresses::Left && m_modBro.m_move_amount < 16 && m_modBro.m_currentFolder != nullptr && m_modBro.m_currentModelId >= 0 ) { // assign model to selected entity nodes
|
||||
StringOutputStream sstream( 128 );
|
||||
sstream << m_modBro.m_currentFolderPath << std::next( m_modBro.m_currentFolder->m_files.begin(), m_modBro.m_currentModelId )->c_str();
|
||||
const auto sstream = StringStream<128>( m_modBro.m_currentFolderPath, std::next( m_modBro.m_currentFolder->m_files.begin(), m_modBro.m_currentModelId )->c_str() );
|
||||
class EntityVisitor : public SelectionSystem::Visitor
|
||||
{
|
||||
const char* m_filePath;
|
||||
|
|
@ -1052,7 +1050,7 @@ protected:
|
|||
entity->setKeyValue( entity->getEntityClass().miscmodel_key(), m_filePath );
|
||||
}
|
||||
}
|
||||
} visitor( sstream.c_str() );
|
||||
} visitor( sstream );
|
||||
UndoableCommand undo( "entityAssignModel" );
|
||||
GlobalSelectionSystem().foreachSelected( visitor );
|
||||
}
|
||||
|
|
@ -1087,17 +1085,17 @@ static void TreeView_onRowActivated( const QModelIndex& index ){
|
|||
const auto found = modelFS->m_folders.find( ModelFS( StringRange( dir.constData(), strlen( dir.constData() ) ) ) );
|
||||
if( found != modelFS->m_folders.end() ){ // ok to not find, while loading root
|
||||
modelFS = &( *found );
|
||||
sstream << dir.constData() << "/";
|
||||
sstream << dir.constData() << '/';
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
//% globalOutputStream() << sstream.c_str() << " sstream.c_str()\n";
|
||||
//% globalOutputStream() << sstream << " sstream\n";
|
||||
|
||||
ModelGraph_clear(); // this goes 1st: resets m_currentFolder
|
||||
|
||||
g_ModelBrowser.m_currentFolder = modelFS;
|
||||
g_ModelBrowser.m_currentFolderPath = sstream.c_str();
|
||||
g_ModelBrowser.m_currentFolderPath = sstream;
|
||||
|
||||
{
|
||||
ScopeDisableScreenUpdates disableScreenUpdates( g_ModelBrowser.m_currentFolderPath.c_str(), "Loading Models" );
|
||||
|
|
@ -1105,7 +1103,7 @@ static void TreeView_onRowActivated( const QModelIndex& index ){
|
|||
for( const CopiedString& filename : g_ModelBrowser.m_currentFolder->m_files ){
|
||||
sstream( g_ModelBrowser.m_currentFolderPath, filename );
|
||||
ModelNode *modelNode = new ModelNode;
|
||||
modelNode->setModel( sstream.c_str() );
|
||||
modelNode->setModel( sstream );
|
||||
NodeSmartReference node( modelNode->node() );
|
||||
Node_getTraversable( g_modelGraph->root() )->insert( node );
|
||||
}
|
||||
|
|
@ -1125,9 +1123,9 @@ void modelFS_traverse( const ModelFS& modelFS ){
|
|||
static int depth = -1;
|
||||
++depth;
|
||||
for( int i = 0; i < depth; ++i ){
|
||||
globalOutputStream() << "\t";
|
||||
globalOutputStream() << '\t';
|
||||
}
|
||||
globalOutputStream() << modelFS.m_folderName.c_str() << "\n";
|
||||
globalOutputStream() << modelFS.m_folderName << '\n';
|
||||
for( const ModelFS& m : modelFS.m_folders )
|
||||
modelFS_traverse( m );
|
||||
|
||||
|
|
@ -1150,7 +1148,7 @@ public:
|
|||
// parse string of format *pathToLoad/depth*path2ToLoad/depth*
|
||||
// */depth* for root path
|
||||
ModelFolders( const char* pathsString ){
|
||||
const auto str = StringOutputStream( 128 )( PathCleaned( pathsString ) );
|
||||
const auto str = StringStream<128>( PathCleaned( pathsString ) );
|
||||
|
||||
const char* start = str.c_str();
|
||||
while( 1 ){
|
||||
|
|
|
|||
|
|
@ -395,7 +395,7 @@ void Patch::Smooth( EMatrixMajor mt ){
|
|||
{
|
||||
p1 = m_ctrl.data() + ( h * row_stride );
|
||||
p2 = p1 + ( 2 * width ) * col_stride;
|
||||
//globalErrorStream() << "compare " << p1->m_vertex << " and " << p2->m_vertex << "\n";
|
||||
//globalErrorStream() << "compare " << p1->m_vertex << " and " << p2->m_vertex << '\n';
|
||||
if ( vector3_length_squared( vector3_subtracted( p1->m_vertex, p2->m_vertex ) ) > 1.0 ) {
|
||||
//globalErrorStream() << "too far\n";
|
||||
wrap = false;
|
||||
|
|
@ -3119,9 +3119,9 @@ void Patch::createThickenedOpposite(const Patch& sourcePatch,
|
|||
|
||||
normal = getAverageNormal(normal1, normal2);
|
||||
/*globalOutputStream() << "0\n";
|
||||
globalOutputStream() << normal1 << "\n";
|
||||
globalOutputStream() << normal2 << "\n";
|
||||
globalOutputStream() << normal << "\n";*/
|
||||
globalOutputStream() << normal1 << '\n';
|
||||
globalOutputStream() << normal2 << '\n';
|
||||
globalOutputStream() << normal << '\n';*/
|
||||
|
||||
}
|
||||
// If two column tangents are available, take the length-corrected average
|
||||
|
|
@ -3133,9 +3133,9 @@ void Patch::createThickenedOpposite(const Patch& sourcePatch,
|
|||
|
||||
normal = getAverageNormal(normal1, normal2);
|
||||
/*globalOutputStream() << "1\n";
|
||||
globalOutputStream() << normal1 << "\n";
|
||||
globalOutputStream() << normal2 << "\n";
|
||||
globalOutputStream() << normal << "\n";*/
|
||||
globalOutputStream() << normal1 << '\n';
|
||||
globalOutputStream() << normal2 << '\n';
|
||||
globalOutputStream() << normal << '\n';*/
|
||||
|
||||
}
|
||||
else
|
||||
|
|
@ -3149,12 +3149,12 @@ void Patch::createThickenedOpposite(const Patch& sourcePatch,
|
|||
|
||||
normal = getAverageNormal(normal1, normal2);
|
||||
/*globalOutputStream() << "2\n";
|
||||
globalOutputStream() << rowTangent[0] << "\n";
|
||||
globalOutputStream() << colTangent[0] << "\n";
|
||||
globalOutputStream() << vector3_cross( rowTangent[0], colTangent[0]) << "\n";
|
||||
globalOutputStream() << normal1 << "\n";
|
||||
globalOutputStream() << normal2 << "\n";
|
||||
globalOutputStream() << normal << "\n";*/
|
||||
globalOutputStream() << rowTangent[0] << '\n';
|
||||
globalOutputStream() << colTangent[0] << '\n';
|
||||
globalOutputStream() << vector3_cross( rowTangent[0], colTangent[0]) << '\n';
|
||||
globalOutputStream() << normal1 << '\n';
|
||||
globalOutputStream() << normal2 << '\n';
|
||||
globalOutputStream() << normal << '\n';*/
|
||||
|
||||
}
|
||||
else
|
||||
|
|
@ -3162,8 +3162,8 @@ void Patch::createThickenedOpposite(const Patch& sourcePatch,
|
|||
if ( vector3_length_squared( vector3_cross( rowTangent[0], colTangent[0] ) ) > 0 ){
|
||||
normal = vector3_normalised( vector3_cross( rowTangent[0], colTangent[0] ) );
|
||||
/*globalOutputStream() << "3\n";
|
||||
globalOutputStream() << (float)vector3_length_squared( vector3_cross( rowTangent[0], colTangent[0] ) ) << "\n";
|
||||
globalOutputStream() << normal << "\n";*/
|
||||
globalOutputStream() << (float)vector3_length_squared( vector3_cross( rowTangent[0], colTangent[0] ) ) << '\n';
|
||||
globalOutputStream() << normal << '\n';*/
|
||||
}
|
||||
else{
|
||||
normal = extrudeAxis;
|
||||
|
|
|
|||
|
|
@ -1030,9 +1030,7 @@ inline bool Patch_importShader( Patch& patch, Tokeniser& tokeniser ){
|
|||
}
|
||||
else
|
||||
{
|
||||
StringOutputStream shader( string_length( GlobalTexturePrefix_get() ) + string_length( texture ) );
|
||||
shader << GlobalTexturePrefix_get() << texture;
|
||||
patch.SetShader( shader.c_str() );
|
||||
patch.SetShader( StringStream<64>( GlobalTexturePrefix_get(), texture ) );
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -234,7 +234,7 @@ void SoundTypes_register(){
|
|||
const char* name;
|
||||
while( !string_empty( name = tokeniser.getToken() ) )
|
||||
{
|
||||
GlobalFiletypes().addType( "sound", name, filetype_t( StringOutputStream()( name, " sound files" ), StringOutputStream()( "*.", name ) ) );
|
||||
GlobalFiletypes().addType( "sound", name, filetype_t( StringStream<32>( name, " sound files" ), StringStream<32>( "*.", name ) ) );
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -35,23 +35,18 @@
|
|||
|
||||
QIcon new_plugin_icon( const char* filename ){
|
||||
StringOutputStream fullpath( 256 );
|
||||
{
|
||||
fullpath( AppPath_get(), g_pluginsDir, "bitmaps/", filename );
|
||||
if( file_exists( fullpath ) )
|
||||
return QIcon( fullpath.c_str() );
|
||||
}
|
||||
|
||||
{
|
||||
fullpath( GameToolsPath_get(), g_pluginsDir, "bitmaps/", filename );
|
||||
if( file_exists( fullpath ) )
|
||||
return QIcon( fullpath.c_str() );
|
||||
}
|
||||
fullpath( AppPath_get(), g_pluginsDir, "bitmaps/", filename );
|
||||
if( file_exists( fullpath ) )
|
||||
return QIcon( fullpath.c_str() );
|
||||
|
||||
{
|
||||
fullpath( AppPath_get(), g_modulesDir, "bitmaps/", filename );
|
||||
if( file_exists( fullpath ) )
|
||||
return QIcon( fullpath.c_str() );
|
||||
}
|
||||
fullpath( GameToolsPath_get(), g_pluginsDir, "bitmaps/", filename );
|
||||
if( file_exists( fullpath ) )
|
||||
return QIcon( fullpath.c_str() );
|
||||
|
||||
fullpath( AppPath_get(), g_modulesDir, "bitmaps/", filename );
|
||||
if( file_exists( fullpath ) )
|
||||
return QIcon( fullpath.c_str() );
|
||||
|
||||
return {};
|
||||
}
|
||||
|
|
|
|||
|
|
@ -169,7 +169,7 @@ void CPointfile::GenerateDisplayList(){
|
|||
|
||||
void Pointfile_Delete(){
|
||||
const char* mapname = Map_Name( g_map );
|
||||
file_remove( StringOutputStream( 256 )( PathExtensionless( mapname ), ".lin" ).c_str() );
|
||||
file_remove( StringStream( PathExtensionless( mapname ), ".lin" ) );
|
||||
}
|
||||
|
||||
|
||||
|
|
@ -254,11 +254,11 @@ void Pointfile_Parse( CPointfile& pointfile ){
|
|||
|
||||
size = LoadFile( name( PathExtensionless( mapname ), ".lin" ), (void**)&data );
|
||||
if ( size == -1 ) {
|
||||
globalErrorStream() << "Pointfile " << name.c_str() << " not found\n";
|
||||
globalErrorStream() << "Pointfile " << name << " not found\n";
|
||||
/* try .pts (q1) */
|
||||
size = LoadFile( name( PathExtensionless( mapname ), ".pts" ), (void**)&data );
|
||||
if ( size == -1 ) {
|
||||
globalErrorStream() << "Pointfile " << name.c_str() << " not found\n";
|
||||
globalErrorStream() << "Pointfile " << name << " not found\n";
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
|
@ -266,7 +266,7 @@ void Pointfile_Parse( CPointfile& pointfile ){
|
|||
// store a pointer
|
||||
text = data;
|
||||
|
||||
globalOutputStream() << "Reading pointfile " << name.c_str() << "\n";
|
||||
globalOutputStream() << "Reading pointfile " << name << '\n';
|
||||
|
||||
pointfile.Init();
|
||||
|
||||
|
|
@ -274,7 +274,7 @@ void Pointfile_Parse( CPointfile& pointfile ){
|
|||
{
|
||||
Vector3 v;
|
||||
if ( sscanf( data,"%f %f %f", &v[0], &v[1], &v[2] ) != 3 ) {
|
||||
globalWarningStream() << "Corrupt point file, line " << line << "\n";
|
||||
globalWarningStream() << "Corrupt point file, line " << line << '\n';
|
||||
break;
|
||||
}
|
||||
|
||||
|
|
@ -288,7 +288,7 @@ void Pointfile_Parse( CPointfile& pointfile ){
|
|||
// deal with zhlt style point files.
|
||||
if ( *data == '-' ) {
|
||||
if ( sscanf( data,"- %f %f %f", &v[0], &v[1], &v[2] ) != 3 ) {
|
||||
globalWarningStream() << "Corrupt point file, line " << line << "\n";
|
||||
globalWarningStream() << "Corrupt point file, line " << line << '\n';
|
||||
break;
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -204,12 +204,12 @@ public:
|
|||
if ( string_equal( element.name(), "qpref" ) ) {
|
||||
Version dataVersion( version_parse( element.attribute( "version" ) ) );
|
||||
if ( !version_compatible( m_version, dataVersion ) ) {
|
||||
globalOutputStream() << "qpref import: data version " << dataVersion << " is not compatible with code version " << m_version << "\n";
|
||||
globalOutputStream() << "qpref import: data version " << dataVersion << " is not compatible with code version " << m_version << '\n';
|
||||
m_xml_stack.push_back( xml_state_t::tag_qpref_ignore );
|
||||
}
|
||||
else
|
||||
{
|
||||
globalOutputStream() << "qpref import: data version " << dataVersion << " is compatible with code version " << m_version << "\n";
|
||||
globalOutputStream() << "qpref import: data version " << dataVersion << " is compatible with code version " << m_version << '\n';
|
||||
m_xml_stack.push_back( xml_state_t::tag_qpref );
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -99,9 +99,7 @@ CGameDescription::CGameDescription( xmlDocPtr pDoc, const CopiedString& gameFile
|
|||
m_gameDescription.insert( GameDescription::value_type( xmlAttr_getName( attr ), xmlAttr_getValue( attr ) ) );
|
||||
}
|
||||
|
||||
{
|
||||
mGameToolsPath = StringOutputStream( 256 )( AppPath_get(), "gamepacks/", gameFile, '/' );
|
||||
}
|
||||
mGameToolsPath = StringStream( AppPath_get(), "gamepacks/", gameFile, '/' );
|
||||
|
||||
ASSERT_MESSAGE( file_exists( mGameToolsPath.c_str() ), "game directory not found: " << makeQuoted( mGameToolsPath ) );
|
||||
|
||||
|
|
@ -122,10 +120,10 @@ CGameDescription::CGameDescription( xmlDocPtr pDoc, const CopiedString& gameFile
|
|||
}
|
||||
|
||||
void CGameDescription::Dump(){
|
||||
globalOutputStream() << "game description file: " << makeQuoted( mGameFile ) << "\n";
|
||||
globalOutputStream() << "game description file: " << makeQuoted( mGameFile ) << '\n';
|
||||
for ( GameDescription::iterator i = m_gameDescription.begin(); i != m_gameDescription.end(); ++i )
|
||||
{
|
||||
globalOutputStream() << ( *i ).first << " = " << makeQuoted( ( *i ).second ) << "\n";
|
||||
globalOutputStream() << ( *i ).first << " = " << makeQuoted( ( *i ).second ) << '\n';
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -181,7 +179,7 @@ bool Preferences_Save( PreferenceDictionary& preferences, const char* filename )
|
|||
}
|
||||
|
||||
bool Preferences_Save_Safe( PreferenceDictionary& preferences, const char* filename ){
|
||||
const auto tmpName = StringOutputStream()( filename, "TMP" );
|
||||
const auto tmpName = StringStream( filename, "TMP" );
|
||||
return Preferences_Save( preferences, tmpName ) && file_move( tmpName, filename );
|
||||
}
|
||||
|
||||
|
|
@ -208,24 +206,22 @@ void GlobalPreferences_Init(){
|
|||
|
||||
void CGameDialog::LoadPrefs(){
|
||||
// load global .pref file
|
||||
StringOutputStream strGlobalPref( 256 );
|
||||
strGlobalPref << g_Preferences.m_global_rc_path << "global.pref";
|
||||
const auto strGlobalPref = StringStream( g_Preferences.m_global_rc_path, "global.pref" );
|
||||
|
||||
globalOutputStream() << "loading global preferences from " << makeQuoted( strGlobalPref.c_str() ) << "\n";
|
||||
globalOutputStream() << "loading global preferences from " << makeQuoted( strGlobalPref ) << '\n';
|
||||
|
||||
if ( !Preferences_Load( g_global_preferences, strGlobalPref.c_str(), "global" ) ) {
|
||||
globalOutputStream() << "failed to load global preferences from " << strGlobalPref.c_str() << "\n";
|
||||
if ( !Preferences_Load( g_global_preferences, strGlobalPref, "global" ) ) {
|
||||
globalOutputStream() << "failed to load global preferences from " << strGlobalPref << '\n';
|
||||
}
|
||||
}
|
||||
|
||||
void CGameDialog::SavePrefs(){
|
||||
StringOutputStream strGlobalPref( 256 );
|
||||
strGlobalPref << g_Preferences.m_global_rc_path << "global.pref";
|
||||
const auto strGlobalPref = StringStream( g_Preferences.m_global_rc_path, "global.pref" );
|
||||
|
||||
globalOutputStream() << "saving global preferences to " << strGlobalPref.c_str() << "\n";
|
||||
globalOutputStream() << "saving global preferences to " << strGlobalPref << '\n';
|
||||
|
||||
if ( !Preferences_Save_Safe( g_global_preferences, strGlobalPref.c_str() ) ) {
|
||||
globalOutputStream() << "failed to save global preferences to " << strGlobalPref.c_str() << "\n";
|
||||
if ( !Preferences_Save_Safe( g_global_preferences, strGlobalPref ) ) {
|
||||
globalOutputStream() << "failed to save global preferences to " << strGlobalPref << '\n';
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -327,24 +323,23 @@ public:
|
|||
if ( !path_extension_is( name, "game" ) ) {
|
||||
return;
|
||||
}
|
||||
StringOutputStream strPath( 256 );
|
||||
strPath << mPath << name;
|
||||
globalOutputStream() << strPath.c_str() << '\n';
|
||||
const auto strPath = StringStream( mPath, name );
|
||||
globalOutputStream() << strPath << '\n';
|
||||
|
||||
xmlDocPtr pDoc = xmlParseFile( strPath.c_str() );
|
||||
xmlDocPtr pDoc = xmlParseFile( strPath );
|
||||
if ( pDoc ) {
|
||||
mGames.push_back( new CGameDescription( pDoc, name ) );
|
||||
xmlFreeDoc( pDoc );
|
||||
}
|
||||
else
|
||||
{
|
||||
globalErrorStream() << "XML parser failed on '" << strPath.c_str() << "'\n";
|
||||
globalErrorStream() << "XML parser failed on '" << strPath << "'\n";
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
void CGameDialog::ScanForGames(){
|
||||
const auto path = StringOutputStream( 256 )( AppPath_get(), "gamepacks/games/" );
|
||||
const auto path = StringStream( AppPath_get(), "gamepacks/games/" );
|
||||
|
||||
globalOutputStream() << "Scanning for game description files: " << path << '\n';
|
||||
|
||||
|
|
@ -369,7 +364,7 @@ void CGameDialog::Reset(){
|
|||
InitGlobalPrefPath();
|
||||
}
|
||||
|
||||
file_remove( StringOutputStream( 256 )( g_Preferences.m_global_rc_path, "global.pref" ) );
|
||||
file_remove( StringStream( g_Preferences.m_global_rc_path, "global.pref" ) );
|
||||
}
|
||||
|
||||
void CGameDialog::Init(){
|
||||
|
|
@ -486,11 +481,11 @@ void PrefsDlg::Init(){
|
|||
|
||||
// this is common to win32 and Linux init now
|
||||
// game sub-dir
|
||||
m_rc_path = StringOutputStream( 256 )( m_global_rc_path, g_pGameDescription->mGameFile.c_str(), '/' );
|
||||
m_rc_path = StringStream( m_global_rc_path, g_pGameDescription->mGameFile.c_str(), '/' );
|
||||
Q_mkdir( m_rc_path.c_str() );
|
||||
|
||||
// then the ini file
|
||||
m_inipath = StringOutputStream( 256 )( m_rc_path, PREFS_LOCAL_FILENAME );
|
||||
m_inipath = StringStream( m_rc_path, PREFS_LOCAL_FILENAME );
|
||||
}
|
||||
|
||||
|
||||
|
|
@ -787,10 +782,10 @@ StaticRegisterModule staticRegisterPreferenceSystem( StaticPreferenceSystemModul
|
|||
void Preferences_Load(){
|
||||
g_GamesDialog.LoadPrefs();
|
||||
|
||||
globalOutputStream() << "loading local preferences from " << g_Preferences.m_inipath << "\n";
|
||||
globalOutputStream() << "loading local preferences from " << g_Preferences.m_inipath << '\n';
|
||||
|
||||
if ( !Preferences_Load( g_preferences, g_Preferences.m_inipath.c_str(), g_GamesDialog.m_sGameFile.m_value.c_str() ) ) {
|
||||
globalWarningStream() << "failed to load local preferences from " << g_Preferences.m_inipath << "\n";
|
||||
globalWarningStream() << "failed to load local preferences from " << g_Preferences.m_inipath << '\n';
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -801,10 +796,10 @@ void Preferences_Save(){
|
|||
|
||||
g_GamesDialog.SavePrefs();
|
||||
|
||||
globalOutputStream() << "saving local preferences to " << g_Preferences.m_inipath << "\n";
|
||||
globalOutputStream() << "saving local preferences to " << g_Preferences.m_inipath << '\n';
|
||||
|
||||
if ( !Preferences_Save_Safe( g_preferences, g_Preferences.m_inipath.c_str() ) ) {
|
||||
globalWarningStream() << "failed to save local preferences to " << g_Preferences.m_inipath << "\n";
|
||||
globalWarningStream() << "failed to save local preferences to " << g_Preferences.m_inipath << '\n';
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -831,14 +826,13 @@ void PreferencesDialog_showDialog(){
|
|||
g_Preferences.m_treeview->setFocus(); // focus tree to have it immediately available for text search
|
||||
if ( g_Preferences.DoModal() == QDialog::DialogCode::Accepted ) {
|
||||
if ( !g_restart_required.empty() ) {
|
||||
StringOutputStream message( 256 );
|
||||
message << "Preference changes require a restart:\n\n";
|
||||
auto message = StringStream( "Preference changes require a restart:\n\n" );
|
||||
for ( const auto i : g_restart_required )
|
||||
message << i << '\n';
|
||||
g_restart_required.clear();
|
||||
message << "\nRestart now?";
|
||||
|
||||
if( qt_MessageBox( MainFrame_getWindow(), message.c_str(), "Restart is required", EMessageBoxType::Question ) == eIDYES )
|
||||
if( qt_MessageBox( MainFrame_getWindow(), message, "Restart is required", EMessageBoxType::Question ) == eIDYES )
|
||||
Radiant_Restart();
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -160,16 +160,15 @@ void bsp_init(){
|
|||
build_set_variable( "EnginePath", EnginePath_get() );
|
||||
build_set_variable( "UserEnginePath", g_qeglobals.m_userEnginePath.c_str() );
|
||||
for( const auto& path : ExtraResourcePaths_get() )
|
||||
if( !string_empty( path.c_str() ) )
|
||||
if( !path.empty() )
|
||||
stream << " -fs_pakpath " << makeQuoted( path );
|
||||
build_set_variable( "ExtraResourcePaths", stream );
|
||||
build_set_variable( "MonitorAddress", ( g_WatchBSP_Enabled ) ? RADIANT_MONITOR_ADDRESS : "" );
|
||||
build_set_variable( "GameName", gamename_get() );
|
||||
|
||||
const char* mapname = Map_Name( g_map );
|
||||
{
|
||||
build_set_variable( "BspFile", stream( PathExtensionless( mapname ), ".bsp" ) );
|
||||
}
|
||||
|
||||
build_set_variable( "BspFile", stream( PathExtensionless( mapname ), ".bsp" ) );
|
||||
|
||||
if( g_region_active ){
|
||||
build_set_variable( "MapFile", stream( PathExtensionless( mapname ), ".reg" ) );
|
||||
|
|
@ -178,9 +177,7 @@ void bsp_init(){
|
|||
build_set_variable( "MapFile", mapname );
|
||||
}
|
||||
|
||||
{
|
||||
build_set_variable( "MapName", stream( PathFilename( mapname ) ) );
|
||||
}
|
||||
build_set_variable( "MapName", stream( PathFilename( mapname ) ) );
|
||||
}
|
||||
|
||||
void bsp_shutdown(){
|
||||
|
|
@ -200,9 +197,9 @@ public:
|
|||
m_file << command;
|
||||
if( m_outputRedirect ){
|
||||
m_file << ( m_commandCount == 0? " > " : " >> " );
|
||||
m_file << "\"" << m_outputRedirect << "\"";
|
||||
m_file << makeQuoted( m_outputRedirect );
|
||||
}
|
||||
m_file << "\n";
|
||||
m_file << '\n';
|
||||
++m_commandCount;
|
||||
}
|
||||
};
|
||||
|
|
@ -222,7 +219,7 @@ void RunBSP( size_t buildIdx ){
|
|||
|
||||
if ( g_region_active ) {
|
||||
const char* mapname = Map_Name( g_map );
|
||||
Map_SaveRegion( StringOutputStream( 256 )( PathExtensionless( mapname ), ".reg" ).c_str() );
|
||||
Map_SaveRegion( StringStream( PathExtensionless( mapname ), ".reg" ) );
|
||||
}
|
||||
|
||||
Pointfile_Delete();
|
||||
|
|
@ -237,17 +234,17 @@ void RunBSP( size_t buildIdx ){
|
|||
if ( g_WatchBSP_Enabled && monitor ) {
|
||||
// grab the file name for engine running
|
||||
const char* fullname = Map_Name( g_map );
|
||||
const auto bspname = StringOutputStream( 64 )( PathFilename( fullname ) );
|
||||
BuildMonitor_Run( commands, bspname.c_str() );
|
||||
const auto bspname = StringStream<64>( PathFilename( fullname ) );
|
||||
BuildMonitor_Run( commands, bspname );
|
||||
}
|
||||
else
|
||||
{
|
||||
const auto junkpath = StringOutputStream( 256 )( SettingsPath_get(), "junk.txt" );
|
||||
const auto junkpath = StringStream( SettingsPath_get(), "junk.txt" );
|
||||
|
||||
#if defined( POSIX )
|
||||
const auto batpath = StringOutputStream( 256 )( SettingsPath_get(), "qe3bsp.sh" );
|
||||
const auto batpath = StringStream( SettingsPath_get(), "qe3bsp.sh" );
|
||||
#elif defined( WIN32 )
|
||||
const auto batpath = StringOutputStream( 256 )( SettingsPath_get(), "qe3bsp.bat" );
|
||||
const auto batpath = StringStream( SettingsPath_get(), "qe3bsp.bat" );
|
||||
#else
|
||||
#error "unsupported platform"
|
||||
#endif
|
||||
|
|
@ -282,8 +279,7 @@ void RunBSP( size_t buildIdx ){
|
|||
// Sys_ functions
|
||||
|
||||
void Sys_SetTitle( const char *text, bool modified ){
|
||||
StringOutputStream title;
|
||||
title << text;
|
||||
auto title = StringStream( text );
|
||||
|
||||
if ( modified ) {
|
||||
title << " *";
|
||||
|
|
|
|||
|
|
@ -150,11 +150,11 @@ void QGL_assertNoErrors( const char *file, int line ){
|
|||
{
|
||||
const char* errorString = reinterpret_cast<const char*>( qgluErrorString( error ) );
|
||||
if ( error == GL_OUT_OF_MEMORY ) {
|
||||
ERROR_MESSAGE( "OpenGL out of memory error at " << file << ":" << line << ": " << errorString );
|
||||
ERROR_MESSAGE( "OpenGL out of memory error at " << file << ':' << line << ": " << errorString );
|
||||
}
|
||||
else
|
||||
{
|
||||
ERROR_MESSAGE( "OpenGL error at " << file << ":" << line << ": " << errorString );
|
||||
ERROR_MESSAGE( "OpenGL error at " << file << ':' << line << ": " << errorString );
|
||||
}
|
||||
error = gl().glGetError();
|
||||
}
|
||||
|
|
|
|||
|
|
@ -84,15 +84,14 @@ bool MapResource_loadFile( const MapFormat& format, scene::Node& root, const cha
|
|||
NodeSmartReference MapResource_load( const MapFormat& format, const char* path, const char* name ){
|
||||
NodeSmartReference root( NewMapRoot( name ) );
|
||||
|
||||
StringOutputStream fullpath( 256 );
|
||||
fullpath << path << name;
|
||||
const auto fullpath = StringStream( path, name );
|
||||
|
||||
if ( path_is_absolute( fullpath.c_str() ) ) {
|
||||
MapResource_loadFile( format, root, fullpath.c_str() );
|
||||
if ( path_is_absolute( fullpath ) ) {
|
||||
MapResource_loadFile( format, root, fullpath );
|
||||
}
|
||||
else
|
||||
{
|
||||
globalErrorStream() << "map path is not fully qualified: " << makeQuoted( fullpath.c_str() ) << "\n";
|
||||
globalErrorStream() << "map path is not fully qualified: " << makeQuoted( fullpath ) << '\n';
|
||||
}
|
||||
|
||||
return root;
|
||||
|
|
@ -114,35 +113,34 @@ bool MapResource_saveFile( const MapFormat& format, scene::Node& root, GraphTrav
|
|||
}
|
||||
|
||||
bool file_saveBackup( const char* path ){
|
||||
const auto backup = StringOutputStream( 256 )( PathExtensionless( path ), ".bak" );
|
||||
const auto backup = StringStream( PathExtensionless( path ), ".bak" );
|
||||
|
||||
if ( file_move( path, backup.c_str() ) ) {
|
||||
if ( file_move( path, backup ) ) {
|
||||
return true;
|
||||
}
|
||||
if ( !file_exists( path ) ) {
|
||||
return true; // nothing to move, no wonder it failed
|
||||
}
|
||||
globalErrorStream() << "map path (or backup path) is not writable: " << makeQuoted( path ) << "\n";
|
||||
globalErrorStream() << "map path (or backup path) is not writable: " << makeQuoted( path ) << '\n';
|
||||
return false;
|
||||
}
|
||||
|
||||
bool MapResource_save( const MapFormat& format, scene::Node& root, const char* path, const char* name ){
|
||||
StringOutputStream fullpath( 256 );
|
||||
fullpath << path << name;
|
||||
const auto fullpath = StringStream( path, name );
|
||||
|
||||
if ( path_is_absolute( fullpath.c_str() ) ) {
|
||||
if ( path_is_absolute( fullpath ) ) {
|
||||
// We don't want a backup + rename operation if the .map file is
|
||||
// a symlink. Otherwise we'll break the user's careful symlink setup.
|
||||
// Just overwrite the original file. Assume the user has versioning.
|
||||
if ( file_is_symlink( fullpath.c_str() ) || file_saveBackup( fullpath.c_str() ) ) {
|
||||
return MapResource_saveFile( format, root, Map_Traverse, fullpath.c_str() );
|
||||
if ( file_is_symlink( fullpath ) || file_saveBackup( fullpath ) ) {
|
||||
return MapResource_saveFile( format, root, Map_Traverse, fullpath );
|
||||
}
|
||||
|
||||
globalErrorStream() << "failed to save map file: " << makeQuoted( fullpath.c_str() ) << "\n";
|
||||
globalErrorStream() << "failed to save map file: " << makeQuoted( fullpath ) << '\n';
|
||||
return false;
|
||||
}
|
||||
|
||||
globalErrorStream() << "map path is not fully qualified: " << makeQuoted( fullpath.c_str() ) << "\n";
|
||||
globalErrorStream() << "map path is not fully qualified: " << makeQuoted( fullpath ) << '\n';
|
||||
return false;
|
||||
}
|
||||
|
||||
|
|
@ -454,7 +452,7 @@ struct ModelResource : public Resource
|
|||
m_path = rootPath( m_originalName.c_str() );
|
||||
m_name = path_make_relative( m_originalName.c_str(), m_path.c_str() );
|
||||
|
||||
//globalOutputStream() << "ModelResource::realise: " << m_path.c_str() << m_name.c_str() << "\n";
|
||||
//globalOutputStream() << "ModelResource::realise: " << m_path.c_str() << m_name.c_str() << '\n';
|
||||
|
||||
m_observers.realise();
|
||||
}
|
||||
|
|
@ -463,7 +461,7 @@ struct ModelResource : public Resource
|
|||
if ( ++m_unrealised == 1 ) {
|
||||
m_observers.unrealise();
|
||||
|
||||
//globalOutputStream() << "ModelResource::unrealise: " << m_path.c_str() << m_name.c_str() << "\n";
|
||||
//globalOutputStream() << "ModelResource::unrealise: " << m_path.c_str() << m_name.c_str() << '\n';
|
||||
clearModel();
|
||||
}
|
||||
}
|
||||
|
|
@ -477,9 +475,7 @@ struct ModelResource : public Resource
|
|||
}
|
||||
}
|
||||
std::time_t modified() const {
|
||||
StringOutputStream fullpath( 256 );
|
||||
fullpath << m_path << m_name;
|
||||
return file_modified( fullpath );
|
||||
return file_modified( StringStream( m_path, m_name ) );
|
||||
}
|
||||
void mapSave(){
|
||||
m_modified = modified();
|
||||
|
|
|
|||
|
|
@ -59,13 +59,13 @@
|
|||
|
||||
inline void debug_string( const char* string ){
|
||||
#if (DEBUG_RENDER)
|
||||
globalOutputStream() << string << "\n";
|
||||
globalOutputStream() << string << '\n';
|
||||
#endif
|
||||
}
|
||||
|
||||
inline void debug_int( const char* comment, int i ){
|
||||
#if (DEBUG_RENDER)
|
||||
globalOutputStream() << comment << " " << i << "\n";
|
||||
globalOutputStream() << comment << ' ' << i << '\n';
|
||||
#endif
|
||||
}
|
||||
|
||||
|
|
@ -74,9 +74,9 @@ inline void debug_colour( const char* comment ){
|
|||
Vector4 v;
|
||||
gl().glGetFloatv( GL_CURRENT_COLOR, reinterpret_cast<float*>( &v ) );
|
||||
globalOutputStream() << comment << " colour: "
|
||||
<< v[0] << " "
|
||||
<< v[1] << " "
|
||||
<< v[2] << " "
|
||||
<< v[0] << ' '
|
||||
<< v[1] << ' '
|
||||
<< v[2] << ' '
|
||||
<< v[3];
|
||||
if ( gl().glIsEnabled( GL_COLOR_ARRAY ) ) {
|
||||
globalOutputStream() << " ARRAY";
|
||||
|
|
@ -84,7 +84,7 @@ inline void debug_colour( const char* comment ){
|
|||
if ( gl().glIsEnabled( GL_COLOR_MATERIAL ) ) {
|
||||
globalOutputStream() << " MATERIAL";
|
||||
}
|
||||
globalOutputStream() << "\n";
|
||||
globalOutputStream() << '\n';
|
||||
#endif
|
||||
}
|
||||
|
||||
|
|
@ -121,7 +121,7 @@ const char* Renderer_GetStats(){
|
|||
<< " | states: " << g_count_states
|
||||
<< " | transforms: " << g_count_transforms
|
||||
<< " | msec: " << g_timer.elapsed_msec();
|
||||
return g_renderer_stats.c_str();
|
||||
return g_renderer_stats;
|
||||
}
|
||||
|
||||
|
||||
|
|
@ -132,7 +132,7 @@ void printShaderLog( GLuint shader ){
|
|||
Array<char> log( log_length );
|
||||
gl().glGetShaderInfoLog( shader, log_length, &log_length, log.data() );
|
||||
|
||||
globalErrorStream() << StringRange( log.begin(), log_length ) << "\n";
|
||||
globalErrorStream() << StringRange( log.begin(), log_length ) << '\n';
|
||||
}
|
||||
|
||||
void printProgramLog( GLuint program ){
|
||||
|
|
@ -142,7 +142,7 @@ void printProgramLog( GLuint program ){
|
|||
Array<char> log( log_length );
|
||||
gl().glGetProgramInfoLog( program, log_length, &log_length, log.data() );
|
||||
|
||||
globalErrorStream() << StringRange( log.begin(), log_length ) << "\n";
|
||||
globalErrorStream() << StringRange( log.begin(), log_length ) << '\n';
|
||||
}
|
||||
|
||||
void createShader( GLuint program, const char* filename, GLenum type ){
|
||||
|
|
@ -643,7 +643,7 @@ public:
|
|||
if ( lights != 0 ) {
|
||||
CountLights counter;
|
||||
lights->forEachLight( makeCallback1( counter ) );
|
||||
globalOutputStream() << "count = " << counter.count() << "\n";
|
||||
globalOutputStream() << "count = " << counter.count() << '\n';
|
||||
for ( std::size_t i = 0; i < counter.count(); ++i )
|
||||
{
|
||||
g_lightDebugShaders[counter.count()]->addRenderable( renderable, modelview );
|
||||
|
|
@ -856,7 +856,7 @@ public:
|
|||
~OpenGLShaderCache(){
|
||||
for ( Shaders::iterator i = m_shaders.begin(); i != m_shaders.end(); ++i )
|
||||
{
|
||||
globalOutputStream() << "leaked shader: " << makeQuoted( ( *i ).key ) << "\n";
|
||||
globalOutputStream() << "leaked shader: " << makeQuoted( ( *i ).key ) << '\n';
|
||||
}
|
||||
}
|
||||
Shader* capture( const char* name ){
|
||||
|
|
@ -865,7 +865,7 @@ public:
|
|||
|| *name == '<'
|
||||
|| *name == '('
|
||||
|| *name == '{'
|
||||
|| strchr( name, '\\' ) == 0, "shader name contains invalid characters: \"" << name << "\"" );
|
||||
|| strchr( name, '\\' ) == 0, "shader name contains invalid characters: " << makeQuoted( name ) );
|
||||
#if DEBUG_SHADERS
|
||||
globalOutputStream() << "shaders capture: " << makeQuoted( name ) << '\n';
|
||||
#endif
|
||||
|
|
@ -1160,8 +1160,8 @@ void ShaderCache_Construct(){
|
|||
StringOutputStream buffer( 256 );
|
||||
for ( std::size_t i = 0; i < 256; ++i )
|
||||
{
|
||||
buffer << "(" << g_DebugShaderColours[i].x() << " " << g_DebugShaderColours[i].y() << " " << g_DebugShaderColours[i].z() << ")";
|
||||
g_lightDebugShaders.push_back( g_ShaderCache->capture( buffer.c_str() ) );
|
||||
buffer << '(' << g_DebugShaderColours[i].x() << ' ' << g_DebugShaderColours[i].y() << ' ' << g_DebugShaderColours[i].z() << ')';
|
||||
g_lightDebugShaders.push_back( g_ShaderCache->capture( buffer ) );
|
||||
buffer.clear();
|
||||
}
|
||||
#endif
|
||||
|
|
@ -1179,8 +1179,8 @@ void ShaderCache_Destroy(){
|
|||
StringOutputStream buffer( 256 );
|
||||
for ( std::size_t i = 0; i < 256; ++i )
|
||||
{
|
||||
buffer << "(" << g_DebugShaderColours[i].x() << " " << g_DebugShaderColours[i].y() << " " << g_DebugShaderColours[i].z() << ")";
|
||||
g_ShaderCache->release( buffer.c_str() );
|
||||
buffer << '(' << g_DebugShaderColours[i].x() << ' ' << g_DebugShaderColours[i].y() << ' ' << g_DebugShaderColours[i].z() << ')';
|
||||
g_ShaderCache->release( buffer );
|
||||
}
|
||||
#endif
|
||||
}
|
||||
|
|
@ -1249,7 +1249,7 @@ void OpenGLState_apply( const OpenGLState& self, OpenGLState& current, unsigned
|
|||
gl().glLoadIdentity();
|
||||
GLint viewprt[4];
|
||||
gl().glGetIntegerv( GL_VIEWPORT, viewprt );
|
||||
//globalOutputStream() << viewprt[2] << " " << viewprt[3] << "\n";
|
||||
//globalOutputStream() << viewprt[2] << ' ' << viewprt[3] << '\n';
|
||||
gl().glOrtho( 0, viewprt[2], 0, viewprt[3], -100, 100 );
|
||||
gl().glTranslated( double( viewprt[2] ) / 2.0, double( viewprt[3] ) / 2.0, 0 );
|
||||
gl().glMatrixMode( GL_MODELVIEW );
|
||||
|
|
|
|||
|
|
@ -47,7 +47,7 @@ public:
|
|||
TypeId getTypeId( const char* name ){
|
||||
TypeName* i = std::find_if( m_typeNames, m_typeNamesEnd, [name]( const char* other ){ return string_equal( name, other ); } );
|
||||
if ( i == m_typeNamesEnd ) {
|
||||
ASSERT_MESSAGE( m_typeNamesEnd != m_typeNames + SIZE, "reached maximum number of type names supported (" << SIZE << ")" );
|
||||
ASSERT_MESSAGE( m_typeNamesEnd != m_typeNames + SIZE, "reached maximum number of type names supported (" << SIZE << ')' );
|
||||
*m_typeNamesEnd++ = name;
|
||||
}
|
||||
return i - m_typeNames;
|
||||
|
|
|
|||
|
|
@ -355,7 +355,7 @@ public:
|
|||
}
|
||||
globalOutputStream() << " classname_" << entity->getKeyValue( "classname" );
|
||||
}
|
||||
globalOutputStream() << "\n";
|
||||
globalOutputStream() << '\n';
|
||||
// globalOutputStream() << "" << ;
|
||||
// globalOutputStream() << "" << ;
|
||||
// globalOutputStream() << "" << ;
|
||||
|
|
@ -377,7 +377,7 @@ public:
|
|||
}
|
||||
globalOutputStream() << " classname_" << entity->getKeyValue( "classname" );
|
||||
}
|
||||
globalOutputStream() << "\n";
|
||||
globalOutputStream() << '\n';
|
||||
--m_depth;
|
||||
}
|
||||
};
|
||||
|
|
@ -695,9 +695,8 @@ void FindReplaceTextures( const char* pFind, const char* pReplace, bool bSelecte
|
|||
return;
|
||||
}
|
||||
|
||||
StringOutputStream command;
|
||||
command << "textureFindReplace -find " << pFind << " -replace " << pReplace;
|
||||
UndoableCommand undo( command.c_str() );
|
||||
const auto command = StringStream<64>( "textureFindReplace -find ", pFind, " -replace ", pReplace );
|
||||
UndoableCommand undo( command );
|
||||
|
||||
if( shader_equal( pReplace, "textures/" ) )
|
||||
pReplace = 0; //do search
|
||||
|
|
@ -1122,9 +1121,8 @@ void Nudge( int nDim, float fNudge ){
|
|||
}
|
||||
|
||||
void Selection_NudgeZ( float amount ){
|
||||
StringOutputStream command;
|
||||
command << "nudgeSelected -axis z -amount " << amount;
|
||||
UndoableCommand undo( command.c_str() );
|
||||
const auto command = StringStream<64>( "nudgeSelected -axis z -amount ", amount );
|
||||
UndoableCommand undo( command );
|
||||
|
||||
Nudge( 2, amount );
|
||||
}
|
||||
|
|
@ -1462,9 +1460,8 @@ void Selection_NudgeRight(){
|
|||
|
||||
|
||||
void Texdef_Rotate( float angle ){
|
||||
StringOutputStream command;
|
||||
command << "brushRotateTexture -angle " << angle;
|
||||
UndoableCommand undo( command.c_str() );
|
||||
const auto command = StringStream<64>( "brushRotateTexture -angle ", angle );
|
||||
UndoableCommand undo( command );
|
||||
Select_RotateTexture( angle );
|
||||
}
|
||||
// these are actually {Anti,}Clockwise in BP mode only (AP/220 - 50/50)
|
||||
|
|
@ -1478,9 +1475,8 @@ void Texdef_RotateAntiClockwise(){
|
|||
}
|
||||
|
||||
void Texdef_Scale( float x, float y ){
|
||||
StringOutputStream command;
|
||||
command << "brushScaleTexture -x " << x << " -y " << y;
|
||||
UndoableCommand undo( command.c_str() );
|
||||
const auto command = StringStream<64>( "brushScaleTexture -x ", x, " -y ", y );
|
||||
UndoableCommand undo( command );
|
||||
Select_ScaleTexture( x, y );
|
||||
}
|
||||
|
||||
|
|
@ -1501,9 +1497,8 @@ void Texdef_ScaleRight(){
|
|||
}
|
||||
|
||||
void Texdef_Shift( float x, float y ){
|
||||
StringOutputStream command;
|
||||
command << "brushShiftTexture -x " << x << " -y " << y;
|
||||
UndoableCommand undo( command.c_str() );
|
||||
const auto command = StringStream<64>( "brushShiftTexture -x ", x, " -y ", y );
|
||||
UndoableCommand undo( command );
|
||||
Select_ShiftTexture( x, y );
|
||||
}
|
||||
|
||||
|
|
@ -1572,9 +1567,8 @@ void Scene_SnapToGrid_Component_Selected( scene::Graph& graph, float snap ){
|
|||
}
|
||||
|
||||
void Selection_SnapToGrid(){
|
||||
StringOutputStream command;
|
||||
command << "snapSelected -grid " << GetGridSize();
|
||||
UndoableCommand undo( command.c_str() );
|
||||
const auto command = StringStream<64>( "snapSelected -grid ", GetGridSize() );
|
||||
UndoableCommand undo( command );
|
||||
|
||||
if ( GlobalSelectionSystem().Mode() == SelectionSystem::eComponent && GlobalSelectionSystem().countSelectedComponents() ) {
|
||||
Scene_SnapToGrid_Component_Selected( GlobalSceneGraph(), GetGridSize() );
|
||||
|
|
@ -1629,9 +1623,8 @@ class RotateDialog : public QObject
|
|||
void apply(){
|
||||
const Vector3 eulerXYZ( m_x->value(), m_y->value(), m_z->value() );
|
||||
|
||||
StringOutputStream command;
|
||||
command << "rotateSelectedEulerXYZ -x " << eulerXYZ[0] << " -y " << eulerXYZ[1] << " -z " << eulerXYZ[2];
|
||||
UndoableCommand undo( command.c_str() );
|
||||
const auto command = StringStream<64>( "rotateSelectedEulerXYZ -x ", eulerXYZ[0], " -y ", eulerXYZ[1], " -z ", eulerXYZ[2] );
|
||||
UndoableCommand undo( command );
|
||||
|
||||
GlobalSelectionSystem().rotateSelected( quaternion_for_euler_xyz_degrees( eulerXYZ ) );
|
||||
}
|
||||
|
|
@ -1722,9 +1715,8 @@ class ScaleDialog : public QObject
|
|||
void apply(){
|
||||
const float sx = m_x->value(), sy = m_y->value(), sz = m_z->value();
|
||||
|
||||
StringOutputStream command;
|
||||
command << "scaleSelected -x " << sx << " -y " << sy << " -z " << sz;
|
||||
UndoableCommand undo( command.c_str() );
|
||||
const auto command = StringStream<64>( "scaleSelected -x ", sx, " -y ", sy, " -z ", sz );
|
||||
UndoableCommand undo( command );
|
||||
|
||||
Select_Scale( sx, sy, sz );
|
||||
}
|
||||
|
|
|
|||
|
|
@ -309,7 +309,7 @@ public:
|
|||
void aabb_snap_translation( Vector3& move, const AABB& bounds ){
|
||||
const Vector3 maxs( bounds.origin + bounds.extents );
|
||||
const Vector3 mins( bounds.origin - bounds.extents );
|
||||
// globalOutputStream() << "move: " << move << "\n";
|
||||
// globalOutputStream() << "move: " << move << '\n';
|
||||
for( std::size_t i = 0; i < 3; ++i ){
|
||||
if( fabs( move[i] ) > 1e-2f ){
|
||||
const float snapto1 = float_snapped( maxs[i] + move[i], GetSnapGridSize() );
|
||||
|
|
@ -318,8 +318,8 @@ void aabb_snap_translation( Vector3& move, const AABB& bounds ){
|
|||
const float dist1 = fabs( fabs( maxs[i] + move[i] ) - fabs( snapto1 ) );
|
||||
const float dist2 = fabs( fabs( mins[i] + move[i] ) - fabs( snapto2 ) );
|
||||
|
||||
// globalOutputStream() << "maxs[i] + move[i]: " << maxs[i] + move[i] << " snapto1: " << snapto1 << " dist1: " << dist1 << "\n";
|
||||
// globalOutputStream() << "mins[i] + move[i]: " << mins[i] + move[i] << " snapto2: " << snapto2 << " dist2: " << dist2 << "\n";
|
||||
// globalOutputStream() << "maxs[i] + move[i]: " << maxs[i] + move[i] << " snapto1: " << snapto1 << " dist1: " << dist1 << '\n';
|
||||
// globalOutputStream() << "mins[i] + move[i]: " << mins[i] + move[i] << " snapto2: " << snapto2 << " dist2: " << dist2 << '\n';
|
||||
move[i] = dist2 > dist1 ? snapto1 - maxs[i] : snapto2 - mins[i];
|
||||
}
|
||||
}
|
||||
|
|
@ -545,7 +545,7 @@ public:
|
|||
m_bounds = bounds;
|
||||
}
|
||||
void Transform( const Matrix4& manip2object, const Matrix4& device2manip, const float x, const float y, const bool snap, const bool snapbbox, const bool alt ){
|
||||
//globalOutputStream() << "manip2object: " << manip2object << " device2manip: " << device2manip << " x: " << x << " y:" << y <<"\n";
|
||||
//globalOutputStream() << "manip2object: " << manip2object << " device2manip: " << device2manip << " x: " << x << " y:" << y << '\n';
|
||||
Vector3 current = point_on_axis( m_axis, device2manip, x, y );
|
||||
Vector3 delta = vector3_subtracted( current, m_start );
|
||||
|
||||
|
|
@ -559,7 +559,7 @@ public:
|
|||
start[i] = GetSnapGridSize();
|
||||
}
|
||||
}
|
||||
//globalOutputStream() << "m_start: " << m_start << " start: " << start << " delta: " << delta <<"\n";
|
||||
//globalOutputStream() << "m_start: " << m_start << " start: " << start << " delta: " << delta << '\n';
|
||||
/* boundless way */
|
||||
Vector3 scale(
|
||||
start[0] == 0 ? 1 : 1 + delta[0] / start[0],
|
||||
|
|
@ -583,7 +583,7 @@ public:
|
|||
}
|
||||
}
|
||||
}
|
||||
//globalOutputStream() << "scale: " << scale <<"\n";
|
||||
//globalOutputStream() << "scale: " << scale << '\n';
|
||||
m_scalable.scale( scale );
|
||||
}
|
||||
|
||||
|
|
@ -643,7 +643,7 @@ public:
|
|||
start[2] == 0 ? 1 : 1 + delta[2] / start[2]
|
||||
);
|
||||
|
||||
//globalOutputStream() << "m_start: " << m_start << " start: " << start << " delta: " << delta <<"\n";
|
||||
//globalOutputStream() << "m_start: " << m_start << " start: " << start << " delta: " << delta << '\n';
|
||||
for( std::size_t i = 0; i < 3; i++ ){
|
||||
if( m_chosen_extent[i] > 0.0625f && start[i] != 0.f ){
|
||||
scale[i] = ( m_chosen_extent[i] + delta[i] ) / m_chosen_extent[i];
|
||||
|
|
@ -653,14 +653,14 @@ public:
|
|||
}
|
||||
}
|
||||
}
|
||||
//globalOutputStream() << "pre snap scale: " << scale <<"\n";
|
||||
//globalOutputStream() << "pre snap scale: " << scale << '\n';
|
||||
if( snap ){
|
||||
float bestscale = ignore_axis != 0 ? scale[0] : scale[1];
|
||||
for( std::size_t i = ignore_axis != 0 ? 1 : 2; i < 3; i++ ){
|
||||
if( ignore_axis != i && fabs( scale[i] ) < fabs( bestscale ) ){
|
||||
bestscale = scale[i];
|
||||
}
|
||||
//globalOutputStream() << "bestscale: " << bestscale <<"\n";
|
||||
//globalOutputStream() << "bestscale: " << bestscale << '\n';
|
||||
}
|
||||
for( std::size_t i = 0; i < 3; i++ ){
|
||||
if( ignore_axis != i ){
|
||||
|
|
@ -668,7 +668,7 @@ public:
|
|||
}
|
||||
}
|
||||
}
|
||||
//globalOutputStream() << "scale: " << scale <<"\n";
|
||||
//globalOutputStream() << "scale: " << scale << '\n';
|
||||
m_scalable.scale( scale );
|
||||
}
|
||||
void SetAxes( const Vector3& axis, const Vector3& axis2 ){
|
||||
|
|
@ -715,7 +715,7 @@ public:
|
|||
}
|
||||
void Transform( const Matrix4& manip2object, const Matrix4& device2manip, const float x, const float y, const bool snap, const bool snapbbox, const bool alt ){
|
||||
const Vector3 current = point_on_plane( m_planeZ, m_view->GetViewMatrix(), x, y ) - m_0;
|
||||
// globalOutputStream() << m_axis_which << " by axis " << m_axis_by << "\n";
|
||||
// globalOutputStream() << m_axis_which << " by axis " << m_axis_by << '\n';
|
||||
m_skewable.skew( Skew( m_axis_by * 4 + m_axis_which, m_axis_by_extent != 0.f? float_snapped( current[m_axis_which], GetSnapGridSize() ) / m_axis_by_extent : 0 ) );
|
||||
}
|
||||
void SetAxes( int axis_which, int axis_by, int axis_by_sign ){
|
||||
|
|
@ -1239,7 +1239,7 @@ void BestPoint( std::size_t count, Vector4 clipped[9], SelectionIntersection& be
|
|||
plaine = plane3_for_points( normalised[0], normalised[1], normalised[2] );
|
||||
plane = &plaine;
|
||||
}
|
||||
//globalOutputStream() << plane.a << " " << plane.b << " " << plane.c << " " << "\n";
|
||||
//globalOutputStream() << plane.a << ' ' << plane.b << ' ' << plane.c << ' ' << '\n';
|
||||
const point_iterator_t end = normalised + count;
|
||||
for ( point_iterator_t previous = end - 1, current = normalised; current != end; previous = current, ++current )
|
||||
{
|
||||
|
|
@ -1259,7 +1259,7 @@ void BestPoint( std::size_t count, Vector4 clipped[9], SelectionIntersection& be
|
|||
// globalOutputStream() << static_cast<float>( ray_distance_to_plane(
|
||||
// Ray( Vector3( 0, 0, 0 ), Vector3( 0, 0, 1 ) ),
|
||||
// plane
|
||||
// ) ) << "\n";
|
||||
// ) ) << '\n';
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -2483,7 +2483,7 @@ public:
|
|||
//m_pivot.update( matrix4_translation_for_vec3( matrix4_get_translation_vec3( pivot2world ) ), volume.GetModelview(), volume.GetProjection(), volume.GetViewport() );
|
||||
m_pivot.update( matrix4_translation_for_vec3( m_bounds.origin ), volume.GetModelview(), volume.GetProjection(), volume.GetViewport() );
|
||||
//m_pivot.update( g_matrix4_identity, volume.GetModelview(), volume.GetProjection(), volume.GetViewport() ); //no shaking in cam due to low precision this way; smooth and sometimes very incorrect result
|
||||
// globalOutputStream() << m_pivot.m_worldSpace << "\n";
|
||||
// globalOutputStream() << m_pivot.m_worldSpace << '\n';
|
||||
Matrix4& m = m_pivot.m_worldSpace; /* go affine to increase precision */
|
||||
m[1] = m[2] = m[3] = m[4] = m[6] = m[7] = m[8] = m[9] = m[11] = 0;
|
||||
m[15] = 1;
|
||||
|
|
@ -2501,8 +2501,8 @@ public:
|
|||
matrix4_premultiply_by_matrix4( m_worldSpace, matrix4_translation_for_vec3( -matrix4_get_translation_vec3( pivot2world ) ) );
|
||||
matrix4_premultiply_by_matrix4( m_worldSpace, pivot2world );
|
||||
|
||||
// globalOutputStream() << m_worldSpace << "\n";
|
||||
// globalOutputStream() << pivot2world << "\n";
|
||||
// globalOutputStream() << m_worldSpace << '\n';
|
||||
// globalOutputStream() << pivot2world << '\n';
|
||||
}
|
||||
|
||||
void render( Renderer& renderer, const VolumeTest& volume, const Matrix4& pivot2world ) {
|
||||
|
|
@ -2614,7 +2614,7 @@ public:
|
|||
point -= origin;
|
||||
point = vector3_added( point, vector3_scaled( m_pivot.m_axis_screen, -vector3_dot( point, m_pivot.m_axis_screen ) ) ); //constrain_to_axis
|
||||
m_rotateAxis.SetRadius( vector3_length( point ) - g_SELECT_EPSILON / 2.0 - 1.0 ); /* use smaller radius to constrain to one rotation direction in 2D */
|
||||
//globalOutputStream() << "radius " << ( vector3_length( point ) - g_SELECT_EPSILON / 2.0 - 1.0 ) << "\n";
|
||||
//globalOutputStream() << "radius " << ( vector3_length( point ) - g_SELECT_EPSILON / 2.0 - 1.0 ) << '\n';
|
||||
}
|
||||
else{
|
||||
m_rotateAxis.SetRadius( g_radius );
|
||||
|
|
@ -3512,11 +3512,11 @@ void translation_for_pivoted_matrix_transform( Vector3& parent_translation, cons
|
|||
|
||||
/*
|
||||
// verify it!
|
||||
globalOutputStream() << "World pivot is at " << world_pivot << "\n";
|
||||
globalOutputStream() << "Local pivot is at " << local_pivot << "\n";
|
||||
globalOutputStream() << "Transformation " << local_transform << " moves it to: " << matrix4_transformed_point(local_transform, local_pivot) << "\n";
|
||||
globalOutputStream() << "Must move by " << local_translation << " in the local system" << "\n";
|
||||
globalOutputStream() << "Must move by " << parent_translation << " in the parent system" << "\n";
|
||||
globalOutputStream() << "World pivot is at " << world_pivot << '\n';
|
||||
globalOutputStream() << "Local pivot is at " << local_pivot << '\n';
|
||||
globalOutputStream() << "Transformation " << local_transform << " moves it to: " << matrix4_transformed_point(local_transform, local_pivot) << '\n';
|
||||
globalOutputStream() << "Must move by " << local_translation << " in the local system" << '\n';
|
||||
globalOutputStream() << "Must move by " << parent_translation << " in the parent system" << '\n';
|
||||
*/
|
||||
}
|
||||
|
||||
|
|
@ -7134,7 +7134,7 @@ public:
|
|||
}
|
||||
|
||||
void SelectPoint( const View& view, const float device_point[2], const float device_epsilon[2], RadiantSelectionSystem::EModifier modifier, bool face ){
|
||||
//globalOutputStream() << device_point[0] << " " << device_point[1] << "\n";
|
||||
//globalOutputStream() << device_point[0] << " " << device_point[1] << '\n';
|
||||
ASSERT_MESSAGE( fabs( device_point[0] ) <= 1.f && fabs( device_point[1] ) <= 1.f, "point-selection error" );
|
||||
|
||||
if ( modifier == eReplace ) {
|
||||
|
|
@ -7294,8 +7294,8 @@ public:
|
|||
globalOutputStream() << "\n\n\n===========\n";
|
||||
while ( i != selector.end() )
|
||||
{
|
||||
globalOutputStream() << "depth:" << ( *i ).first.m_depth << " dist:" << ( *i ).first.m_distance << " depth2:" << ( *i ).first.m_depth2 << "\n";
|
||||
globalOutputStream() << "depth - best depth:" << ( *i ).first.m_depth - ( *best ).first.m_depth << "\n";
|
||||
globalOutputStream() << "depth:" << ( *i ).first.m_depth << " dist:" << ( *i ).first.m_distance << " depth2:" << ( *i ).first.m_depth2 << '\n';
|
||||
globalOutputStream() << "depth - best depth:" << ( *i ).first.m_depth - ( *best ).first.m_depth << '\n';
|
||||
++i;
|
||||
}
|
||||
#endif
|
||||
|
|
@ -7355,7 +7355,7 @@ public:
|
|||
}
|
||||
}
|
||||
void outputTranslation( TextOutputStream& ostream ){
|
||||
ostream << " -xyz " << m_translation.x() << " " << m_translation.y() << " " << m_translation.z();
|
||||
ostream << " -xyz " << m_translation.x() << ' ' << m_translation.y() << ' ' << m_translation.z();
|
||||
}
|
||||
void rotate( const Quaternion& rotation ){
|
||||
if ( !nothingSelected() ) {
|
||||
|
|
@ -7385,7 +7385,7 @@ public:
|
|||
}
|
||||
}
|
||||
void outputRotation( TextOutputStream& ostream ){
|
||||
ostream << " -eulerXYZ " << m_rotation.x() << " " << m_rotation.y() << " " << m_rotation.z();
|
||||
ostream << " -eulerXYZ " << m_rotation.x() << ' ' << m_rotation.y() << ' ' << m_rotation.z();
|
||||
}
|
||||
void scale( const Vector3& scaling ){
|
||||
if ( !nothingSelected() ) {
|
||||
|
|
@ -7412,7 +7412,7 @@ public:
|
|||
}
|
||||
}
|
||||
void outputScale( TextOutputStream& ostream ){
|
||||
ostream << " -scale " << m_scale.x() << " " << m_scale.y() << " " << m_scale.z();
|
||||
ostream << " -scale " << m_scale.x() << ' ' << m_scale.y() << ' ' << m_scale.z();
|
||||
}
|
||||
|
||||
void skew( const Skew& skew ){
|
||||
|
|
@ -7774,7 +7774,7 @@ bool RadiantSelectionSystem::endMove(){
|
|||
SceneChangeNotify();
|
||||
|
||||
if ( m_undo_begun ) {
|
||||
StringOutputStream command;
|
||||
StringOutputStream command( 64 );
|
||||
|
||||
if ( ManipulatorMode() == eTranslate ) {
|
||||
command << "translateTool";
|
||||
|
|
@ -7799,7 +7799,7 @@ bool RadiantSelectionSystem::endMove(){
|
|||
command << "UVTool";
|
||||
}
|
||||
|
||||
GlobalUndoSystem().finish( command.c_str() );
|
||||
GlobalUndoSystem().finish( command );
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
|
@ -7926,7 +7926,7 @@ void RadiantSelectionSystem::ConstructPivot() const {
|
|||
Vector3 object_pivot = m_bounds.origin;
|
||||
|
||||
//vector3_snap( object_pivot, GetSnapGridSize() );
|
||||
//globalOutputStream() << object_pivot << "\n";
|
||||
//globalOutputStream() << object_pivot << '\n';
|
||||
m_pivot2world = matrix4_translation_for_vec3( object_pivot );
|
||||
}
|
||||
else{
|
||||
|
|
@ -7941,7 +7941,7 @@ void RadiantSelectionSystem::ConstructPivot() const {
|
|||
void RadiantSelectionSystem::setCustomTransformOrigin( const Vector3& origin, const bool set[3] ) const {
|
||||
if ( !nothingSelected() && transformOrigin_isTranslatable() ) {
|
||||
|
||||
//globalOutputStream() << origin << "\n";
|
||||
//globalOutputStream() << origin << '\n';
|
||||
for( std::size_t i = 0; i < 3; i++ ){
|
||||
float value = origin[i];
|
||||
if( set[i] ){
|
||||
|
|
|
|||
|
|
@ -64,11 +64,11 @@ public:
|
|||
void registerModule( const char* type, int version, const char* name, Module& module ){
|
||||
ASSERT_NOTNULL( (volatile intptr_t)&module );
|
||||
if ( !m_modules.insert( Modules_::value_type( ModuleKey( ModuleType( type, version ), name ), &module ) ).second ) {
|
||||
globalErrorStream() << "module already registered: type=" << makeQuoted( type ) << " name=" << makeQuoted( name ) << "\n";
|
||||
globalErrorStream() << "module already registered: type=" << makeQuoted( type ) << " name=" << makeQuoted( name ) << '\n';
|
||||
}
|
||||
else
|
||||
{
|
||||
globalOutputStream() << "Module Registered: type=" << makeQuoted( type ) << " version=" << makeQuoted( version ) << " name=" << makeQuoted( name ) << "\n";
|
||||
globalOutputStream() << "Module Registered: type=" << makeQuoted( type ) << " version=" << makeQuoted( version ) << " name=" << makeQuoted( name ) << '\n';
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -42,7 +42,7 @@ void write_stack_trace( TextOutputStream& outputStream ){
|
|||
char** symbol_names = backtrace_symbols( symbols, symbol_count );
|
||||
if ( symbol_names ) {
|
||||
for ( int i = 0; ( i < symbol_count ); ++i )
|
||||
outputStream << symbol_names[i] << "\n";
|
||||
outputStream << symbol_names[i] << '\n';
|
||||
|
||||
// not a memleak, see www.gnu.org/software/libc/manual (Debugging Support, Backtraces)
|
||||
free( symbol_names );
|
||||
|
|
@ -133,7 +133,7 @@ void write_symbol( PSYMBOL_INFO pSym, STACKFRAME64& sf, TextOutputStream& output
|
|||
WCHAR* name;
|
||||
if ( SymGetTypeInfo( GetCurrentProcess(), pSym->ModBase, typeId,
|
||||
TI_GET_SYMNAME, &name ) ) {
|
||||
outputStream << name << " ";
|
||||
outputStream << name << ' ';
|
||||
LocalFree( name );
|
||||
int bleh = 0;
|
||||
}
|
||||
|
|
@ -240,7 +240,7 @@ void write_stack_trace( PCONTEXT pContext, TextOutputStream& outputStream ){
|
|||
|
||||
IMAGEHLP_MODULE64 module = { sizeof( IMAGEHLP_MODULE64 ) };
|
||||
if ( SymGetModuleInfo64( m_hProcess, sf.AddrPC.Offset, &module ) ) {
|
||||
outputStream << module.ModuleName << "!";
|
||||
outputStream << module.ModuleName << '!';
|
||||
|
||||
if ( SymFromAddr( m_hProcess, sf.AddrPC.Offset, &symDisplacement, pSymbol ) ) {
|
||||
char undecoratedName[max_sym_name];
|
||||
|
|
@ -248,7 +248,7 @@ void write_stack_trace( PCONTEXT pContext, TextOutputStream& outputStream ){
|
|||
|
||||
outputStream << undecoratedName;
|
||||
|
||||
outputStream << "(";
|
||||
outputStream << '(';
|
||||
// Use SymSetContext to get just the locals/params for this frame
|
||||
IMAGEHLP_STACK_FRAME imagehlpStackFrame;
|
||||
imagehlpStackFrame.InstructionOffset = sf.AddrPC.Offset;
|
||||
|
|
@ -257,7 +257,7 @@ void write_stack_trace( PCONTEXT pContext, TextOutputStream& outputStream ){
|
|||
// Enumerate the locals/parameters
|
||||
EnumerateSymbolsContext context( sf, outputStream );
|
||||
SymEnumSymbols( m_hProcess, 0, 0, EnumerateSymbolsCallback, &context );
|
||||
outputStream << ")";
|
||||
outputStream << ')';
|
||||
|
||||
outputStream << " + " << Offset( reinterpret_cast<void*>( symDisplacement ) );
|
||||
|
||||
|
|
@ -266,7 +266,7 @@ void write_stack_trace( PCONTEXT pContext, TextOutputStream& outputStream ){
|
|||
DWORD dwLineDisplacement;
|
||||
if ( SymGetLineFromAddr64( m_hProcess, sf.AddrPC.Offset,
|
||||
&dwLineDisplacement, &lineInfo ) ) {
|
||||
outputStream << " " << lineInfo.FileName << " line " << lineInfo.LineNumber;
|
||||
outputStream << ' ' << lineInfo.FileName << " line " << lineInfo.LineNumber;
|
||||
}
|
||||
}
|
||||
else
|
||||
|
|
@ -275,7 +275,7 @@ void write_stack_trace( PCONTEXT pContext, TextOutputStream& outputStream ){
|
|||
}
|
||||
}
|
||||
|
||||
outputStream << "\n";
|
||||
outputStream << '\n';
|
||||
}
|
||||
|
||||
SymCleanup( m_hProcess );
|
||||
|
|
|
|||
|
|
@ -382,9 +382,8 @@ void SurfaceInspector_ProjectTexture( EProjectTexture type, bool isGuiClick ){
|
|||
texdef.scale[0] = texdef.scale[1] = Texdef_getDefaultTextureScale();
|
||||
}
|
||||
|
||||
StringOutputStream str( 32 );
|
||||
str << "textureProject" << ( type == eProjectAxial? "Axial" : type == eProjectOrtho? "Ortho" : "Cam" );
|
||||
UndoableCommand undo( str.c_str() );
|
||||
const auto str = StringStream<32>( "textureProject", ( type == eProjectAxial? "Axial" : type == eProjectOrtho? "Ortho" : "Cam" ) );
|
||||
UndoableCommand undo( str );
|
||||
|
||||
Vector3 direction;
|
||||
|
||||
|
|
@ -1008,17 +1007,17 @@ void SurfaceInspector::Update(){
|
|||
===============
|
||||
*/
|
||||
void SurfaceInspector::ApplyShader(){
|
||||
const auto name = StringOutputStream( 256 )( GlobalTexturePrefix_get(), PathCleaned( m_textureEntry->text().toLatin1().constData() ) );
|
||||
const auto name = StringStream<64>( GlobalTexturePrefix_get(), PathCleaned( m_textureEntry->text().toLatin1().constData() ) );
|
||||
|
||||
// TTimo: detect and refuse invalid texture names (at least the ones with spaces)
|
||||
if ( !texdef_name_valid( name.c_str() ) ) {
|
||||
globalErrorStream() << "invalid texture name '" << name.c_str() << "'\n";
|
||||
if ( !texdef_name_valid( name ) ) {
|
||||
globalErrorStream() << "invalid texture name '" << name << "'\n";
|
||||
SurfaceInspector_queueDraw();
|
||||
return;
|
||||
}
|
||||
|
||||
UndoableCommand undo( "textureNameSetSelected" );
|
||||
Select_SetShader( name.c_str() );
|
||||
Select_SetShader( name );
|
||||
}
|
||||
#if 0
|
||||
void SurfaceInspector::ApplyTexdef(){
|
||||
|
|
@ -1039,45 +1038,40 @@ void SurfaceInspector::ApplyTexdef(){
|
|||
#endif
|
||||
void SurfaceInspector::ApplyTexdef_HShift(){
|
||||
const float value = m_hshiftIncrement.m_spin->value();
|
||||
StringOutputStream command;
|
||||
command << "textureProjectionSetSelected -hShift " << value;
|
||||
UndoableCommand undo( command.c_str() );
|
||||
const auto command = StringStream<64>( "textureProjectionSetSelected -hShift ", value );
|
||||
UndoableCommand undo( command );
|
||||
Select_SetTexdef( &value, 0, 0, 0, 0 );
|
||||
Patch_SetTexdef( &value, 0, 0, 0, 0 );
|
||||
}
|
||||
|
||||
void SurfaceInspector::ApplyTexdef_VShift(){
|
||||
const float value = m_vshiftIncrement.m_spin->value();
|
||||
StringOutputStream command;
|
||||
command << "textureProjectionSetSelected -vShift " << value;
|
||||
UndoableCommand undo( command.c_str() );
|
||||
const auto command = StringStream<64>( "textureProjectionSetSelected -vShift ", value );
|
||||
UndoableCommand undo( command );
|
||||
Select_SetTexdef( 0, &value, 0, 0, 0 );
|
||||
Patch_SetTexdef( 0, &value, 0, 0, 0 );
|
||||
}
|
||||
|
||||
void SurfaceInspector::ApplyTexdef_HScale(){
|
||||
const float value = m_hscaleIncrement.m_spin->value();
|
||||
StringOutputStream command;
|
||||
command << "textureProjectionSetSelected -hScale " << value;
|
||||
UndoableCommand undo( command.c_str() );
|
||||
const auto command = StringStream<64>( "textureProjectionSetSelected -hScale ", value );
|
||||
UndoableCommand undo( command );
|
||||
Select_SetTexdef( 0, 0, &value, 0, 0 );
|
||||
Patch_SetTexdef( 0, 0, &value, 0, 0 );
|
||||
}
|
||||
|
||||
void SurfaceInspector::ApplyTexdef_VScale(){
|
||||
const float value = m_vscaleIncrement.m_spin->value();
|
||||
StringOutputStream command;
|
||||
command << "textureProjectionSetSelected -vScale " << value;
|
||||
UndoableCommand undo( command.c_str() );
|
||||
const auto command = StringStream<64>( "textureProjectionSetSelected -vScale ", value );
|
||||
UndoableCommand undo( command );
|
||||
Select_SetTexdef( 0, 0, 0, &value, 0 );
|
||||
Patch_SetTexdef( 0, 0, 0, &value, 0 );
|
||||
}
|
||||
|
||||
void SurfaceInspector::ApplyTexdef_Rotation(){
|
||||
const float value = m_rotateIncrement.m_spin->value();
|
||||
StringOutputStream command;
|
||||
command << "textureProjectionSetSelected -rotation " << static_cast<float>( float_to_integer( value * 100.f ) ) / 100.f;;
|
||||
UndoableCommand undo( command.c_str() );
|
||||
const auto command = StringStream<64>( "textureProjectionSetSelected -rotation ", static_cast<float>( float_to_integer( value * 100.f ) ) / 100.f );
|
||||
UndoableCommand undo( command );
|
||||
Select_SetTexdef( 0, 0, 0, 0, &value );
|
||||
Patch_SetTexdef( 0, 0, 0, 0, &value );
|
||||
}
|
||||
|
|
@ -1391,7 +1385,7 @@ void Face_setTexture( Face& face, const char* shader, const FaceTexture& clipboa
|
|||
}
|
||||
|
||||
const Quaternion rotation = quaternion_for_unit_vectors( clipboard.m_plane.normal(), face.getPlane().plane3().normal() );
|
||||
// globalOutputStream() << "rotation: " << rotation.x() << " " << rotation.y() << " " << rotation.z() << " " << rotation.w() << " " << "\n";
|
||||
// globalOutputStream() << "rotation: " << rotation.x() << ' ' << rotation.y() << ' ' << rotation.z() << ' ' << rotation.w() << ' ' << '\n';
|
||||
Matrix4 transform = g_matrix4_identity;
|
||||
matrix4_pivoted_rotate_by_quaternion( transform, rotation, line.origin );
|
||||
|
||||
|
|
|
|||
|
|
@ -93,7 +93,7 @@ void R_ResampleTextureLerpLine( const byte *in, byte *out, int inwidth, int outw
|
|||
}
|
||||
else
|
||||
{
|
||||
globalWarningStream() << "R_ResampleTextureLerpLine: unsupported bytesperpixel " << bytesperpixel << "\n";
|
||||
globalWarningStream() << "R_ResampleTextureLerpLine: unsupported bytesperpixel " << bytesperpixel << '\n';
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -304,7 +304,7 @@ void R_ResampleTexture( const void *indata, int inwidth, int inheight, void *out
|
|||
}
|
||||
else
|
||||
{
|
||||
globalWarningStream() << "R_ResampleTexture: unsupported bytesperpixel " << bytesperpixel << "\n";
|
||||
globalWarningStream() << "R_ResampleTexture: unsupported bytesperpixel " << bytesperpixel << '\n';
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -355,7 +355,7 @@ void qtexture_realise( qtexture_t& texture, const TextureKey& key ){
|
|||
/* load in order, so that Q3 cubemap is seamless in openGL, but rotated & flipped; fix misorientation in shader later */
|
||||
const char *suffixes[] = { "_ft", "_bk", "_up", "_dn", "_rt", "_lf" };
|
||||
for( int i = 0; i < 6; ++i ){
|
||||
images[i] = key.first.loadImage( StringOutputStream( 64 )( key.second, suffixes[i] ) );
|
||||
images[i] = key.first.loadImage( StringStream<64>( key.second, suffixes[i] ) );
|
||||
}
|
||||
if( std::all_of( images, images + std::size( images ), []( const Image *img ){ return img != nullptr; } ) ){
|
||||
gl().glGenTextures( 1, &texture.texture_number );
|
||||
|
|
|
|||
|
|
@ -36,7 +36,6 @@
|
|||
#include "moduleobserver.h"
|
||||
|
||||
#include <set>
|
||||
#include <string>
|
||||
#include <vector>
|
||||
|
||||
#include <QVBoxLayout>
|
||||
|
|
@ -371,10 +370,11 @@ const char* TextureBrowser_GetSelectedShader(){
|
|||
void TextureBrowser_SetStatus( const char* name ){
|
||||
IShader* shader = QERApp_Shader_ForName( name );
|
||||
qtexture_t* q = shader->getTexture();
|
||||
StringOutputStream strTex( 256 );
|
||||
strTex << ( string_equal_prefix_nocase( name, "textures/" )? name + 9 : name ) << " W: " << q->width << " H: " << q->height;
|
||||
const auto strTex = StringStream( ( string_equal_prefix_nocase( name, "textures/" )? name + 9 : name ),
|
||||
" W: ", q->width,
|
||||
" H: ", q->height );
|
||||
shader->DecRef();
|
||||
g_pParentWnd->SetStatusText( c_status_texture, strTex.c_str() );
|
||||
g_pParentWnd->SetStatusText( c_status_texture, strTex );
|
||||
}
|
||||
|
||||
void TextureBrowser_Focus( TextureBrowser& textureBrowser, const char* name );
|
||||
|
|
@ -606,7 +606,7 @@ typedef ReferenceCaller1<TextureBrowser, bool, TextureBrowser_importShowScrollba
|
|||
*/
|
||||
|
||||
inline bool texture_name_ignore( const char* name ){
|
||||
auto temp = StringOutputStream( 64 )( LowerCase( name ) );
|
||||
const auto temp = StringStream<64>( LowerCase( name ) );
|
||||
|
||||
return
|
||||
string_equal_suffix( temp, ".specular" ) ||
|
||||
|
|
@ -673,22 +673,23 @@ public:
|
|||
}
|
||||
};
|
||||
|
||||
void TextureDirectory_loadTexture( const char* directory, const char* texture ){
|
||||
const auto name = StringOutputStream( 256 )( directory, PathExtensionless( texture ) );
|
||||
|
||||
if ( texture_name_ignore( name.c_str() ) ) {
|
||||
void TexturePath_loadTexture( const char* name ){
|
||||
if ( texture_name_ignore( name ) ) {
|
||||
return;
|
||||
}
|
||||
|
||||
if ( !shader_valid( name.c_str() ) ) {
|
||||
globalWarningStream() << "Skipping invalid texture name: [" << name.c_str() << "]\n";
|
||||
if ( !shader_valid( name ) ) {
|
||||
globalWarningStream() << "Skipping invalid texture name: [" << name << "]\n";
|
||||
return;
|
||||
}
|
||||
|
||||
// if a texture is already in use to represent a shader, ignore it
|
||||
IShader* shader = QERApp_Shader_ForName( name.c_str() );
|
||||
IShader* shader = QERApp_Shader_ForName( name );
|
||||
shader->DecRef();
|
||||
}
|
||||
void TextureDirectory_loadTexture( const char* directory, const char* texture ){
|
||||
TexturePath_loadTexture( StringStream<64>( directory, PathExtensionless( texture ) ) );
|
||||
}
|
||||
typedef ConstPointerCaller1<char, const char*, TextureDirectory_loadTexture> TextureDirectoryLoadTextureCaller;
|
||||
|
||||
class LoadTexturesByTypeVisitor : public ImageModules::Visitor
|
||||
|
|
@ -727,11 +728,7 @@ void TextureBrowser_ShowDirectory( const char* directory ){
|
|||
|
||||
if ( g_pGameDescription->mGameType != "doom3" ) {
|
||||
// load remaining texture files
|
||||
|
||||
StringOutputStream dirstring( 64 );
|
||||
dirstring << "textures/" << directory;
|
||||
|
||||
Radiant_getImageModules().foreachModule( LoadTexturesByTypeVisitor( dirstring.c_str() ) );
|
||||
Radiant_getImageModules().foreachModule( LoadTexturesByTypeVisitor( StringStream<64>( "textures/", directory ) ) );
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -1414,8 +1411,8 @@ void TextureBrowser_searchTags(){
|
|||
const auto selected = g_TexBro.m_tagsListWidget->selectedItems();
|
||||
|
||||
if ( !selected.empty() ) {
|
||||
auto buffer = StringOutputStream( 256 )( "/root/*/*[tag='" );
|
||||
auto tags_searched = StringOutputStream( 256 )( "[TAGS] " );
|
||||
auto buffer = StringStream( "/root/*/*[tag='" );
|
||||
auto tags_searched = StringStream( "[TAGS] " );
|
||||
|
||||
for ( auto it = selected.begin(); it != selected.end(); ++it )
|
||||
{
|
||||
|
|
@ -1434,16 +1431,12 @@ void TextureBrowser_searchTags(){
|
|||
TagBuilder.TagSearch( buffer, g_TexBro.m_found_shaders );
|
||||
|
||||
if ( !g_TexBro.m_found_shaders.empty() ) { // found something
|
||||
globalOutputStream() << "Found " << g_TexBro.m_found_shaders.size() << " textures and shaders with " << tags_searched << "\n";
|
||||
globalOutputStream() << "Found " << g_TexBro.m_found_shaders.size() << " textures and shaders with " << tags_searched << '\n';
|
||||
ScopeDisableScreenUpdates disableScreenUpdates( "Searching...", "Loading Textures" );
|
||||
|
||||
for ( const CopiedString& shader : g_TexBro.m_found_shaders )
|
||||
{
|
||||
std::string path = shader.c_str();
|
||||
const size_t pos = path.find_last_of( "/" );
|
||||
const std::string name = path.substr( pos + 1 );
|
||||
path = path.substr( 0, pos + 1 );
|
||||
TextureDirectory_loadTexture( path.c_str(), name.c_str() );
|
||||
TexturePath_loadTexture( shader.c_str() );
|
||||
}
|
||||
}
|
||||
TextureBrowser_SetHideUnused( g_TexBro, false );
|
||||
|
|
@ -1474,11 +1467,7 @@ void TextureBrowser_showUntagged(){
|
|||
|
||||
for ( const CopiedString& shader : g_TexBro.m_found_shaders )
|
||||
{
|
||||
std::string path = shader.c_str();
|
||||
size_t pos = path.find_last_of( "/", path.size() );
|
||||
std::string name = path.substr( pos + 1, path.size() );
|
||||
path = path.substr( 0, pos + 1 );
|
||||
TextureDirectory_loadTexture( path.c_str(), name.c_str() );
|
||||
TexturePath_loadTexture( shader.c_str() );
|
||||
}
|
||||
|
||||
TextureBrowser_SetHideUnused( g_TexBro, false );
|
||||
|
|
@ -1491,8 +1480,8 @@ void TextureBrowser_showUntagged(){
|
|||
}
|
||||
|
||||
void TextureBrowser_checkTagFile(){
|
||||
const auto rc_filename = StringOutputStream( 256 )( LocalRcPath_get(), SHADERTAG_FILE );
|
||||
const auto default_filename = StringOutputStream( 256 )( g_pGameDescription->mGameToolsPath, SHADERTAG_FILE );
|
||||
const auto rc_filename = StringStream( LocalRcPath_get(), SHADERTAG_FILE );
|
||||
const auto default_filename = StringStream( g_pGameDescription->mGameToolsPath, SHADERTAG_FILE );
|
||||
|
||||
if ( file_exists( rc_filename ) && TagBuilder.OpenXmlDoc( rc_filename ) )
|
||||
{
|
||||
|
|
@ -1512,7 +1501,7 @@ void TextureBrowser_checkTagFile(){
|
|||
}
|
||||
|
||||
void TextureBrowser_addTag(){
|
||||
auto tag = StringOutputStream( 64 )( "NewTag" );
|
||||
auto tag = StringStream<64>( "NewTag" );
|
||||
int index = 0;
|
||||
while( g_TexBro.m_all_tags.find( tag.c_str() ) != g_TexBro.m_all_tags.cend() )
|
||||
tag( "NewTag", ++index );
|
||||
|
|
@ -1592,13 +1581,8 @@ void TextureBrowser_pasteTag(){
|
|||
|
||||
|
||||
void TextureBrowser_SetNotex(){
|
||||
StringOutputStream name( 256 );
|
||||
name << GlobalRadiant().getAppPath() << "bitmaps/notex.png";
|
||||
g_notex = name.c_str();
|
||||
|
||||
name.clear();
|
||||
name << GlobalRadiant().getAppPath() << "bitmaps/shadernotex.png";
|
||||
g_shadernotex = name.c_str();
|
||||
g_notex = StringStream( GlobalRadiant().getAppPath(), "bitmaps/notex.png" );
|
||||
g_shadernotex = StringStream( GlobalRadiant().getAppPath(), "bitmaps/shadernotex.png" );
|
||||
}
|
||||
|
||||
|
||||
|
|
@ -1948,16 +1932,10 @@ void TextureBrowser_filter_searchFromStart(){
|
|||
|
||||
|
||||
void TextureBrowser_exportTitle( const StringImportCallback& importer ){
|
||||
StringOutputStream buffer( 64 );
|
||||
buffer << "Textures: ";
|
||||
if ( !g_TextureBrowser_currentDirectory.empty() ) {
|
||||
buffer << g_TextureBrowser_currentDirectory;
|
||||
}
|
||||
else
|
||||
{
|
||||
buffer << "all";
|
||||
}
|
||||
importer( buffer.c_str() );
|
||||
const auto buffer = StringStream<64>( "Textures: ", !g_TextureBrowser_currentDirectory.empty()
|
||||
? g_TextureBrowser_currentDirectory.c_str()
|
||||
: "all" );
|
||||
importer( buffer );
|
||||
}
|
||||
|
||||
|
||||
|
|
@ -2040,10 +2018,9 @@ void TextureBrowser_constructPreferences( PreferencesPage& page ){
|
|||
page.appendCombo( "Load Shaders at Startup", reinterpret_cast<int&>( g_TexBro.m_startupShaders ), StringArrayRange( startup_shaders ) );
|
||||
}
|
||||
{
|
||||
StringOutputStream sstream( 256 );
|
||||
sstream << "Hide nonShaders in " << TextureBrowser_getCommonShadersDir() << " folder";
|
||||
const auto str = StringStream<64>( "Hide nonShaders in ", TextureBrowser_getCommonShadersDir(), " folder" );
|
||||
page.appendCheckBox(
|
||||
"", sstream.c_str(),
|
||||
"", str,
|
||||
g_TexBro.m_hideNonShadersInCommon
|
||||
);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -306,7 +306,7 @@ public:
|
|||
else
|
||||
{
|
||||
Operation* operation = m_undo_stack.back();
|
||||
globalOutputStream() << "Undo: " << operation->m_command << "\n";
|
||||
globalOutputStream() << "Undo: " << operation->m_command << '\n';
|
||||
|
||||
startRedo();
|
||||
trackersUndo();
|
||||
|
|
@ -322,7 +322,7 @@ public:
|
|||
else
|
||||
{
|
||||
Operation* operation = m_redo_stack.back();
|
||||
globalOutputStream() << "Redo: " << operation->m_command << "\n";
|
||||
globalOutputStream() << "Redo: " << operation->m_command << '\n';
|
||||
|
||||
startUndo();
|
||||
trackersRedo();
|
||||
|
|
|
|||
|
|
@ -28,7 +28,7 @@
|
|||
|
||||
void OpenURL( const char *url ){
|
||||
// let's put a little comment
|
||||
globalOutputStream() << "OpenURL: " << url << "\n";
|
||||
globalOutputStream() << "OpenURL: " << url << '\n';
|
||||
// QUrl::fromUserInput appears to work well for urls and local paths with spaces
|
||||
// alternatively can prepend file:/// to the latter and use default QUrl contructor
|
||||
if ( !QDesktopServices::openUrl( QUrl::fromUserInput( url ) ) ) {
|
||||
|
|
|
|||
|
|
@ -180,7 +180,7 @@ public:
|
|||
m_string = string;
|
||||
}
|
||||
void ExportWithDefault( const StringImportCallback& importer ) const {
|
||||
importer( m_string.empty()? StringOutputStream( 256 )( m_defaultPrefix, m_getDefault() ) : m_string.c_str() );
|
||||
importer( m_string.empty()? StringStream( m_defaultPrefix, m_getDefault() ) : m_string.c_str() );
|
||||
}
|
||||
void Export( const StringImportCallback& importer ) const {
|
||||
importer( m_string.c_str() );
|
||||
|
|
@ -330,11 +330,11 @@ static void abortStream( message_info_t *data ){
|
|||
|
||||
static void saxStartElement( message_info_t *data, const xmlChar *name, const xmlChar **attrs ){
|
||||
#if 0
|
||||
globalOutputStream() << "<" << name;
|
||||
globalOutputStream() << '<' << name;
|
||||
if ( attrs != 0 ) {
|
||||
for ( const xmlChar** p = attrs; *p != 0; p += 2 )
|
||||
{
|
||||
globalOutputStream() << " " << p[0] << "=" << makeQuoted( p[1] );
|
||||
globalOutputStream() << ' ' << p[0] << '=' << makeQuoted( p[1] );
|
||||
}
|
||||
}
|
||||
globalOutputStream() << ">\n";
|
||||
|
|
@ -417,7 +417,7 @@ static void saxStartElement( message_info_t *data, const xmlChar *name, const xm
|
|||
|
||||
static void saxEndElement( message_info_t *data, const xmlChar *name ){
|
||||
#if 0
|
||||
globalOutputStream() << "<" << name << "/>\n";
|
||||
globalOutputStream() << '<' << name << "/>\n";
|
||||
#endif
|
||||
|
||||
data->recurse--;
|
||||
|
|
@ -488,7 +488,7 @@ static void saxCharacters( message_info_t *data, const xmlChar *ch, int len ){
|
|||
}
|
||||
|
||||
static void saxComment( void *ctx, const xmlChar *msg ){
|
||||
globalOutputStream() << "XML comment: " << reinterpret_cast<const char*>( msg ) << "\n";
|
||||
globalOutputStream() << "XML comment: " << reinterpret_cast<const char*>( msg ) << '\n';
|
||||
}
|
||||
|
||||
static void saxWarning( void *ctx, const char *msg, ... ){
|
||||
|
|
@ -498,7 +498,7 @@ static void saxWarning( void *ctx, const char *msg, ... ){
|
|||
va_start( args, msg );
|
||||
vsprintf( saxMsgBuffer, msg, args );
|
||||
va_end( args );
|
||||
globalWarningStream() << "XML warning: " << saxMsgBuffer << "\n";
|
||||
globalWarningStream() << "XML warning: " << saxMsgBuffer << '\n';
|
||||
}
|
||||
|
||||
static void saxError( void *ctx, const char *msg, ... ){
|
||||
|
|
@ -508,7 +508,7 @@ static void saxError( void *ctx, const char *msg, ... ){
|
|||
va_start( args, msg );
|
||||
vsprintf( saxMsgBuffer, msg, args );
|
||||
va_end( args );
|
||||
globalErrorStream() << "XML error: " << saxMsgBuffer << "\n";
|
||||
globalErrorStream() << "XML error: " << saxMsgBuffer << '\n';
|
||||
}
|
||||
|
||||
static void saxFatal( void *ctx, const char *msg, ... ){
|
||||
|
|
@ -519,7 +519,7 @@ static void saxFatal( void *ctx, const char *msg, ... ){
|
|||
va_start( args, msg );
|
||||
vsprintf( buffer, msg, args );
|
||||
va_end( args );
|
||||
globalErrorStream() << "XML fatal error: " << buffer << "\n";
|
||||
globalErrorStream() << "XML fatal error: " << buffer << '\n';
|
||||
}
|
||||
|
||||
static xmlSAXHandler saxParser = {
|
||||
|
|
@ -606,15 +606,13 @@ void CWatchBSP::DoEBeginStep(){
|
|||
|
||||
if ( !m_bBSPPlugin ) {
|
||||
globalOutputStream() << "=== running build command ===\n"
|
||||
<< m_commands[m_iCurrentStep] << "\n";
|
||||
<< m_commands[m_iCurrentStep] << '\n';
|
||||
|
||||
if ( !Q_Exec( NULL, const_cast<char*>( m_commands[m_iCurrentStep].c_str() ), NULL, true, false ) ) {
|
||||
StringOutputStream msg( 256 );
|
||||
msg << "Failed to execute the following command: ";
|
||||
msg << m_commands[m_iCurrentStep];
|
||||
msg << "\nCheck that the file exists and that you don't run out of system resources.\n";
|
||||
globalOutputStream() << msg.c_str();
|
||||
qt_MessageBox( MainFrame_getWindow(), msg.c_str(), "Build monitoring", EMessageBoxType::Error );
|
||||
const auto msg = StringStream( "Failed to execute the following command: ", m_commands[m_iCurrentStep],
|
||||
"\nCheck that the file exists and that you don't run out of system resources.\n" );
|
||||
globalOutputStream() << msg;
|
||||
qt_MessageBox( MainFrame_getWindow(), msg, "Build monitoring", EMessageBoxType::Error );
|
||||
return;
|
||||
}
|
||||
// re-initialise the debug window
|
||||
|
|
@ -728,8 +726,8 @@ void CWatchBSP::RoutineProcessing(){
|
|||
// launch the engine .. OMG
|
||||
if ( g_WatchBSP_RunQuake ) {
|
||||
globalOutputStream() << "Running engine...\n";
|
||||
auto cmd = StringOutputStream( 256 )( EnginePath_get() );
|
||||
StringOutputStream cmdline;
|
||||
auto cmd = StringStream( EnginePath_get() );
|
||||
auto cmdline = StringOutputStream( 256 );
|
||||
|
||||
const auto buildArgs = [&]( const char *str ){
|
||||
const char *map = strstr( str, "%mapname%" );
|
||||
|
|
@ -750,14 +748,13 @@ void CWatchBSP::RoutineProcessing(){
|
|||
buildArgs( g_engineArgs.string().c_str() );
|
||||
}
|
||||
|
||||
globalOutputStream() << cmd.c_str() << " " << cmdline.c_str() << "\n";
|
||||
globalOutputStream() << cmd << ' ' << cmdline << '\n';
|
||||
|
||||
// execute now
|
||||
if ( !Q_Exec( cmd.c_str(), cmdline.c_str(), EnginePath_get(), false, false ) ) {
|
||||
StringOutputStream msg;
|
||||
msg << "Failed to execute the following command: " << cmd.c_str() << cmdline.c_str();
|
||||
globalOutputStream() << msg.c_str();
|
||||
qt_MessageBox( MainFrame_getWindow(), msg.c_str(), "Build monitoring", EMessageBoxType::Error );
|
||||
if ( !Q_Exec( cmd, cmdline.c_str(), EnginePath_get(), false, false ) ) {
|
||||
const auto msg = StringStream( "Failed to execute the following command: ", cmd, cmdline );
|
||||
globalOutputStream() << msg;
|
||||
qt_MessageBox( MainFrame_getWindow(), msg, "Build monitoring", EMessageBoxType::Error );
|
||||
}
|
||||
}
|
||||
EndMonitoringLoop();
|
||||
|
|
|
|||
Some files were not shown because too many files have changed in this diff Show More
Loading…
Reference in New Issue
Block a user